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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-03-25 12:20:19 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-03-25 12:20:19 +0400
commit3b711a6ed009b35bb69cd0ca878eeb8d55fa0e77 (patch)
treeb3fdb366cb49bdea5b57dfa6ba4a82635c68d0ee /source/blender
parenta2ebfc82dbe954acc432ae017ac62a30a11b6a16 (diff)
parente99a23fc6b33b5097eab44aac19c2a089ddebce6 (diff)
Merged changes in the trunk up to revision 45133.
Conflicts resolved: source/blender/blenloader/intern/readfile.c source/blender/blenloader/intern/writefile.c source/blender/bmesh/intern/bmesh_construct.c source/blender/bmesh/intern/bmesh_mesh_conv.c source/blender/bmesh/intern/bmesh_mesh_conv.h source/blender/editors/interface/interface_templates.c source/blender/editors/interface/resources.c source/blender/editors/mesh/bmesh_select.c source/blender/editors/mesh/bmesh_tools.c source/blender/editors/space_view3d/drawobject.c source/blender/render/intern/source/shadeoutput.c
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/avi/intern/avi.c46
-rw-r--r--source/blender/avi/intern/avirgb.c3
-rw-r--r--source/blender/avi/intern/mjpeg.c17
-rw-r--r--source/blender/avi/intern/rgb32.c2
-rw-r--r--source/blender/blenfont/BLF_api.h59
-rw-r--r--source/blender/blenfont/BLF_translation.h23
-rw-r--r--source/blender/blenfont/intern/blf.c224
-rw-r--r--source/blender/blenfont/intern/blf_dir.c78
-rw-r--r--source/blender/blenfont/intern/blf_font.c420
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c239
-rw-r--r--source/blender/blenfont/intern/blf_internal.h2
-rw-r--r--source/blender/blenfont/intern/blf_lang.c80
-rw-r--r--source/blender/blenfont/intern/blf_translation.c40
-rw-r--r--source/blender/blenfont/intern/blf_util.c2
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h21
-rw-r--r--source/blender/blenkernel/BKE_armature.h3
-rw-r--r--source/blender/blenkernel/BKE_blender.h4
-rw-r--r--source/blender/blenkernel/BKE_bmesh.h7
-rw-r--r--source/blender/blenkernel/BKE_cdderivedmesh.h5
-rw-r--r--source/blender/blenkernel/BKE_cloth.h30
-rw-r--r--source/blender/blenkernel/BKE_collision.h8
-rw-r--r--source/blender/blenkernel/BKE_curve.h54
-rw-r--r--source/blender/blenkernel/BKE_customdata.h5
-rw-r--r--source/blender/blenkernel/BKE_deform.h1
-rw-r--r--source/blender/blenkernel/BKE_mesh.h34
-rw-r--r--source/blender/blenkernel/BKE_modifier.h2
-rw-r--r--source/blender/blenkernel/BKE_movieclip.h1
-rw-r--r--source/blender/blenkernel/BKE_multires.h19
-rw-r--r--source/blender/blenkernel/BKE_object.h4
-rw-r--r--source/blender/blenkernel/BKE_paint.h9
-rw-r--r--source/blender/blenkernel/BKE_report.h2
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h1
-rw-r--r--source/blender/blenkernel/BKE_shrinkwrap.h2
-rw-r--r--source/blender/blenkernel/BKE_subsurf.h38
-rw-r--r--source/blender/blenkernel/BKE_tessmesh.h2
-rw-r--r--source/blender/blenkernel/BKE_tracking.h1
-rw-r--r--source/blender/blenkernel/CMakeLists.txt10
-rw-r--r--source/blender/blenkernel/SConscript3
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c11
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c611
-rw-r--r--source/blender/blenkernel/intern/action.c163
-rw-r--r--source/blender/blenkernel/intern/anim.c304
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c4
-rw-r--r--source/blender/blenkernel/intern/armature.c56
-rw-r--r--source/blender/blenkernel/intern/blender.c140
-rw-r--r--source/blender/blenkernel/intern/bmfont.c15
-rw-r--r--source/blender/blenkernel/intern/boids.c294
-rw-r--r--source/blender/blenkernel/intern/booleanops_mesh.c3
-rw-r--r--source/blender/blenkernel/intern/brush.c71
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c64
-rw-r--r--source/blender/blenkernel/intern/camera.c74
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c567
-rw-r--r--source/blender/blenkernel/intern/cloth.c168
-rw-r--r--source/blender/blenkernel/intern/collision.c126
-rw-r--r--source/blender/blenkernel/intern/colortools.c253
-rw-r--r--source/blender/blenkernel/intern/constraint.c51
-rw-r--r--source/blender/blenkernel/intern/context.c138
-rw-r--r--source/blender/blenkernel/intern/curve.c962
-rw-r--r--source/blender/blenkernel/intern/customdata.c596
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c95
-rw-r--r--source/blender/blenkernel/intern/deform.c289
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c658
-rw-r--r--source/blender/blenkernel/intern/displist.c362
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c156
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c35
-rw-r--r--source/blender/blenkernel/intern/effect.c194
-rw-r--r--source/blender/blenkernel/intern/fcurve.c18
-rw-r--r--source/blender/blenkernel/intern/fluidsim.c12
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c8
-rw-r--r--source/blender/blenkernel/intern/font.c141
-rw-r--r--source/blender/blenkernel/intern/group.c136
-rw-r--r--source/blender/blenkernel/intern/icons.c39
-rw-r--r--source/blender/blenkernel/intern/idprop.c69
-rw-r--r--source/blender/blenkernel/intern/image.c644
-rw-r--r--source/blender/blenkernel/intern/image_gen.c44
-rw-r--r--source/blender/blenkernel/intern/implicit.c213
-rw-r--r--source/blender/blenkernel/intern/ipo.c2
-rw-r--r--source/blender/blenkernel/intern/key.c531
-rw-r--r--source/blender/blenkernel/intern/lamp.c42
-rw-r--r--source/blender/blenkernel/intern/lattice.c19
-rw-r--r--source/blender/blenkernel/intern/library.c261
-rw-r--r--source/blender/blenkernel/intern/material.c22
-rw-r--r--source/blender/blenkernel/intern/mball.c120
-rw-r--r--source/blender/blenkernel/intern/mesh.c362
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c641
-rw-r--r--source/blender/blenkernel/intern/modifier.c69
-rw-r--r--source/blender/blenkernel/intern/modifiers_bmesh.c12
-rw-r--r--source/blender/blenkernel/intern/movieclip.c257
-rw-r--r--source/blender/blenkernel/intern/multires.c317
-rw-r--r--source/blender/blenkernel/intern/navmesh_conversion.c6
-rw-r--r--source/blender/blenkernel/intern/node.c452
-rw-r--r--source/blender/blenkernel/intern/object.c52
-rw-r--r--source/blender/blenkernel/intern/ocean.c19
-rw-r--r--source/blender/blenkernel/intern/packedFile.c87
-rw-r--r--source/blender/blenkernel/intern/paint.c37
-rw-r--r--source/blender/blenkernel/intern/particle.c1161
-rw-r--r--source/blender/blenkernel/intern/particle_system.c1103
-rw-r--r--source/blender/blenkernel/intern/pointcache.c799
-rw-r--r--source/blender/blenkernel/intern/property.c51
-rw-r--r--source/blender/blenkernel/intern/report.c53
-rw-r--r--source/blender/blenkernel/intern/sca.c164
-rw-r--r--source/blender/blenkernel/intern/scene.c10
-rw-r--r--source/blender/blenkernel/intern/screen.c106
-rw-r--r--source/blender/blenkernel/intern/seqcache.c8
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c590
-rw-r--r--source/blender/blenkernel/intern/sequencer.c886
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c105
-rw-r--r--source/blender/blenkernel/intern/sketch.c4
-rw-r--r--source/blender/blenkernel/intern/smoke.c351
-rw-r--r--source/blender/blenkernel/intern/softbody.c54
-rw-r--r--source/blender/blenkernel/intern/sound.c8
-rw-r--r--source/blender/blenkernel/intern/speaker.c24
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c659
-rw-r--r--source/blender/blenkernel/intern/suggestions.c12
-rw-r--r--source/blender/blenkernel/intern/text.c475
-rw-r--r--source/blender/blenkernel/intern/texture.c350
-rw-r--r--source/blender/blenkernel/intern/tracking.c756
-rw-r--r--source/blender/blenkernel/intern/world.c42
-rw-r--r--source/blender/blenkernel/intern/writeavi.c4
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c102
-rw-r--r--source/blender/blenkernel/intern/writeframeserver.c6
-rw-r--r--source/blender/blenlib/BLI_bpath.h2
-rw-r--r--source/blender/blenlib/BLI_callbacks.h2
-rw-r--r--source/blender/blenlib/BLI_fileops.h9
-rw-r--r--source/blender/blenlib/BLI_gsqueue.h8
-rw-r--r--source/blender/blenlib/BLI_math_base.h2
-rw-r--r--source/blender/blenlib/BLI_math_geom.h3
-rw-r--r--source/blender/blenlib/BLI_math_inline.h29
-rw-r--r--source/blender/blenlib/BLI_math_vector.h1
-rw-r--r--source/blender/blenlib/BLI_pbvh.h40
-rw-r--r--source/blender/blenlib/BLI_utildefines.h71
-rw-r--r--source/blender/blenlib/BLI_winstuff.h2
-rw-r--r--source/blender/blenlib/CMakeLists.txt6
-rw-r--r--source/blender/blenlib/SConscript1
-rw-r--r--source/blender/blenlib/intern/BLI_args.c8
-rw-r--r--source/blender/blenlib/intern/BLI_dynstr.c36
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c168
-rw-r--r--source/blender/blenlib/intern/BLI_heap.c36
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c266
-rw-r--r--source/blender/blenlib/intern/BLI_kdtree.c162
-rw-r--r--source/blender/blenlib/intern/BLI_linklist.c5
-rw-r--r--source/blender/blenlib/intern/BLI_memarena.c63
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c42
-rw-r--r--source/blender/blenlib/intern/bpath.c116
-rw-r--r--source/blender/blenlib/intern/callbacks.c8
-rw-r--r--source/blender/blenlib/intern/dynlib.c18
-rw-r--r--source/blender/blenlib/intern/fileops.c599
-rw-r--r--source/blender/blenlib/intern/freetypefont.c106
-rw-r--r--source/blender/blenlib/intern/graph.c36
-rw-r--r--source/blender/blenlib/intern/gsqueue.c13
-rw-r--r--source/blender/blenlib/intern/jitter.c30
-rw-r--r--source/blender/blenlib/intern/listbase.c8
-rw-r--r--source/blender/blenlib/intern/math_base.c3
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c30
-rw-r--r--source/blender/blenlib/intern/math_color.c34
-rw-r--r--source/blender/blenlib/intern/math_color_inline.c31
-rw-r--r--source/blender/blenlib/intern/math_geom.c396
-rw-r--r--source/blender/blenlib/intern/math_geom_inline.c6
-rw-r--r--source/blender/blenlib/intern/math_matrix.c204
-rw-r--r--source/blender/blenlib/intern/math_rotation.c136
-rw-r--r--source/blender/blenlib/intern/math_vector.c44
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c32
-rw-r--r--source/blender/blenlib/intern/noise.c10
-rw-r--r--source/blender/blenlib/intern/path_util.c245
-rw-r--r--source/blender/blenlib/intern/pbvh.c514
-rw-r--r--source/blender/blenlib/intern/rand.c14
-rw-r--r--source/blender/blenlib/intern/rct.c140
-rw-r--r--source/blender/blenlib/intern/scanfill.c318
-rw-r--r--source/blender/blenlib/intern/storage.c134
-rw-r--r--source/blender/blenlib/intern/string.c48
-rw-r--r--source/blender/blenlib/intern/string_cursor_utf8.c46
-rw-r--r--source/blender/blenlib/intern/string_utf8.c50
-rw-r--r--source/blender/blenlib/intern/threads.c82
-rw-r--r--source/blender/blenlib/intern/time.c6
-rw-r--r--source/blender/blenlib/intern/uvproject.c101
-rw-r--r--source/blender/blenlib/intern/voxel.c6
-rw-r--r--source/blender/blenlib/intern/winstuff.c73
-rw-r--r--source/blender/blenloader/BLO_readfile.h2
-rw-r--r--source/blender/blenloader/intern/readblenentry.c23
-rw-r--r--source/blender/blenloader/intern/readfile.c3440
-rw-r--r--source/blender/blenloader/intern/runtime.c26
-rw-r--r--source/blender/blenloader/intern/undofile.c28
-rw-r--r--source/blender/blenloader/intern/writefile.c547
-rw-r--r--source/blender/blenpluginapi/intern/pluginapi.c4
-rw-r--r--source/blender/bmesh/CMakeLists.txt16
-rw-r--r--source/blender/bmesh/SConscript1
-rw-r--r--source/blender/bmesh/bmesh.h85
-rw-r--r--source/blender/bmesh/bmesh_class.h33
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c217
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c37
-rw-r--r--source/blender/bmesh/intern/bmesh_core.h3
-rw-r--r--source/blender/bmesh/intern/bmesh_error.h (renamed from source/blender/bmesh/bmesh_error.h)2
-rw-r--r--source/blender/bmesh/intern/bmesh_inline.c76
-rw-r--r--source/blender/bmesh/intern/bmesh_inline.h115
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.c5
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.c1
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators_inline.h (renamed from source/blender/bmesh/intern/bmesh_iterators_inline.c)16
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.c52
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.h3
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c38
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c21
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_validate.c174
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_validate.h35
-rw-r--r--source/blender/bmesh/intern/bmesh_mods.c41
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c28
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api.h (renamed from source/blender/bmesh/bmesh_operator_api.h)34
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api_inline.h (renamed from source/blender/bmesh/intern/bmesh_operator_api_inline.c)37
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c114
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_operators_private.h1
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c66
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.h3
-rw-r--r--source/blender/bmesh/intern/bmesh_private.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c156
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.h21
-rw-r--r--source/blender/bmesh/intern/bmesh_structure.c4
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers.c7
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers.h3
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_impl.c216
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_private.h4
-rw-r--r--source/blender/bmesh/operators/bmo_bevel.c8
-rw-r--r--source/blender/bmesh/operators/bmo_connect.c12
-rw-r--r--source/blender/bmesh/operators/bmo_create.c146
-rw-r--r--source/blender/bmesh/operators/bmo_dissolve.c19
-rw-r--r--source/blender/bmesh/operators/bmo_dupe.c43
-rw-r--r--source/blender/bmesh/operators/bmo_edgesplit.c14
-rw-r--r--source/blender/bmesh/operators/bmo_extrude.c116
-rw-r--r--source/blender/bmesh/operators/bmo_inset.c444
-rw-r--r--source/blender/bmesh/operators/bmo_join_triangles.c12
-rw-r--r--source/blender/bmesh/operators/bmo_mesh_conv.c4
-rw-r--r--source/blender/bmesh/operators/bmo_mirror.c6
-rw-r--r--source/blender/bmesh/operators/bmo_primitive.c28
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c8
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c32
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c12
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c90
-rw-r--r--source/blender/bmesh/tools/BME_bevel.c90
-rw-r--r--source/blender/collada/AnimationExporter.cpp55
-rw-r--r--source/blender/collada/AnimationImporter.cpp14
-rw-r--r--source/blender/collada/ArmatureExporter.cpp20
-rw-r--r--source/blender/collada/ArmatureImporter.cpp8
-rw-r--r--source/blender/collada/DocumentExporter.cpp30
-rw-r--r--source/blender/collada/DocumentImporter.cpp107
-rw-r--r--source/blender/collada/DocumentImporter.h2
-rw-r--r--source/blender/collada/EffectExporter.cpp17
-rw-r--r--source/blender/collada/ErrorHandler.cpp4
-rw-r--r--source/blender/collada/ExtraHandler.cpp6
-rw-r--r--source/blender/collada/ExtraTags.cpp14
-rw-r--r--source/blender/collada/GeometryExporter.cpp2
-rw-r--r--source/blender/collada/ImageExporter.cpp4
-rw-r--r--source/blender/collada/InstanceWriter.cpp2
-rw-r--r--source/blender/collada/LightExporter.cpp2
-rw-r--r--source/blender/collada/MaterialExporter.cpp4
-rw-r--r--source/blender/collada/MeshImporter.cpp19
-rw-r--r--source/blender/collada/SceneExporter.cpp8
-rw-r--r--source/blender/collada/TransformWriter.cpp6
-rw-r--r--source/blender/collada/collada.cpp6
-rw-r--r--source/blender/collada/collada_internal.cpp2
-rw-r--r--source/blender/collada/collada_utils.cpp4
-rw-r--r--source/blender/editors/animation/CMakeLists.txt4
-rw-r--r--source/blender/editors/animation/SConscript7
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c107
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c212
-rw-r--r--source/blender/editors/animation/anim_deps.c2
-rw-r--r--source/blender/editors/animation/anim_draw.c3
-rw-r--r--source/blender/editors/animation/anim_filter.c2
-rw-r--r--source/blender/editors/animation/anim_markers.c168
-rw-r--r--source/blender/editors/animation/anim_ops.c50
-rw-r--r--source/blender/editors/animation/drivers.c40
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c12
-rw-r--r--source/blender/editors/animation/keyframes_draw.c2
-rw-r--r--source/blender/editors/animation/keyframes_edit.c1
-rw-r--r--source/blender/editors/animation/keyframes_general.c2
-rw-r--r--source/blender/editors/animation/keyframing.c86
-rw-r--r--source/blender/editors/animation/keyingsets.c70
-rw-r--r--source/blender/editors/armature/CMakeLists.txt4
-rw-r--r--source/blender/editors/armature/SConscript7
-rw-r--r--source/blender/editors/armature/armature_ops.c58
-rw-r--r--source/blender/editors/armature/editarmature.c606
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c20
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c92
-rw-r--r--source/blender/editors/armature/meshlaplacian.c454
-rw-r--r--source/blender/editors/armature/poseSlide.c70
-rw-r--r--source/blender/editors/armature/poselib.c84
-rw-r--r--source/blender/editors/armature/poseobject.c350
-rw-r--r--source/blender/editors/armature/reeb.c145
-rw-r--r--source/blender/editors/curve/curve_ops.c16
-rw-r--r--source/blender/editors/curve/editcurve.c2154
-rw-r--r--source/blender/editors/curve/editfont.c718
-rw-r--r--source/blender/editors/datafiles/CMakeLists.txt1
-rw-r--r--source/blender/editors/datafiles/blender_icons.png.c13944
-rw-r--r--source/blender/editors/datafiles/claystrips.png.c290
-rw-r--r--source/blender/editors/gpencil/CMakeLists.txt4
-rw-r--r--source/blender/editors/gpencil/SConscript7
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c16
-rw-r--r--source/blender/editors/gpencil/editaction_gpencil.c10
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c72
-rw-r--r--source/blender/editors/gpencil/gpencil_ops.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c32
-rw-r--r--source/blender/editors/gpencil/gpencil_undo.c22
-rw-r--r--source/blender/editors/include/ED_datafiles.h3
-rw-r--r--source/blender/editors/include/ED_mesh.h2
-rw-r--r--source/blender/editors/include/ED_numinput.h9
-rw-r--r--source/blender/editors/include/ED_screen_types.h1
-rw-r--r--source/blender/editors/include/ED_transform.h4
-rw-r--r--source/blender/editors/include/UI_icons.h37
-rw-r--r--source/blender/editors/include/UI_resources.h5
-rw-r--r--source/blender/editors/interface/interface.c846
-rw-r--r--source/blender/editors/interface/interface_anim.c18
-rw-r--r--source/blender/editors/interface/interface_draw.c206
-rw-r--r--source/blender/editors/interface/interface_handlers.c1732
-rw-r--r--source/blender/editors/interface/interface_icons.c105
-rw-r--r--source/blender/editors/interface/interface_intern.h5
-rw-r--r--source/blender/editors/interface/interface_layout.c585
-rw-r--r--source/blender/editors/interface/interface_ops.c128
-rw-r--r--source/blender/editors/interface/interface_panel.c448
-rw-r--r--source/blender/editors/interface/interface_regions.c731
-rw-r--r--source/blender/editors/interface/interface_style.c36
-rw-r--r--source/blender/editors/interface/interface_templates.c524
-rw-r--r--source/blender/editors/interface/interface_utils.c68
-rw-r--r--source/blender/editors/interface/interface_widgets.c506
-rw-r--r--source/blender/editors/interface/resources.c867
-rw-r--r--source/blender/editors/interface/view2d.c264
-rw-r--r--source/blender/editors/interface/view2d_ops.c186
-rw-r--r--source/blender/editors/mesh/CMakeLists.txt11
-rw-r--r--source/blender/editors/mesh/bmesh_selecthistory.c69
-rw-r--r--source/blender/editors/mesh/editface.c158
-rw-r--r--source/blender/editors/mesh/editmesh_add.c150
-rw-r--r--source/blender/editors/mesh/editmesh_bvh.c69
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c (renamed from source/blender/editors/mesh/knifetool.c)1014
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c (renamed from source/blender/editors/mesh/loopcut.c)129
-rw-r--r--source/blender/editors/mesh/editmesh_select.c (renamed from source/blender/editors/mesh/bmesh_select.c)155
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c (renamed from source/blender/editors/mesh/bmesh_tools.c)879
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c (renamed from source/blender/editors/mesh/bmesh_utils.c)159
-rw-r--r--source/blender/editors/mesh/mesh_data.c275
-rw-r--r--source/blender/editors/mesh/mesh_intern.h5
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c210
-rw-r--r--source/blender/editors/mesh/mesh_ops.c53
-rw-r--r--source/blender/editors/mesh/meshtools.c253
-rw-r--r--source/blender/editors/metaball/mball_edit.c168
-rw-r--r--source/blender/editors/metaball/mball_ops.c4
-rw-r--r--source/blender/editors/object/object_add.c477
-rw-r--r--source/blender/editors/object/object_bake.c302
-rw-r--r--source/blender/editors/object/object_constraint.c270
-rw-r--r--source/blender/editors/object/object_edit.c558
-rw-r--r--source/blender/editors/object/object_group.c92
-rw-r--r--source/blender/editors/object/object_hook.c213
-rw-r--r--source/blender/editors/object/object_lattice.c76
-rw-r--r--source/blender/editors/object/object_modifier.c456
-rw-r--r--source/blender/editors/object/object_ops.c42
-rw-r--r--source/blender/editors/object/object_relations.c528
-rw-r--r--source/blender/editors/object/object_select.c213
-rw-r--r--source/blender/editors/object/object_shapekey.c142
-rw-r--r--source/blender/editors/object/object_transform.c228
-rw-r--r--source/blender/editors/object/object_vgroup.c675
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c66
-rw-r--r--source/blender/editors/physics/particle_boids.c124
-rw-r--r--source/blender/editors/physics/particle_edit.c1013
-rw-r--r--source/blender/editors/physics/particle_object.c242
-rw-r--r--source/blender/editors/physics/physics_fluid.c122
-rw-r--r--source/blender/editors/physics/physics_ops.c6
-rw-r--r--source/blender/editors/physics/physics_pointcache.c112
-rw-r--r--source/blender/editors/render/render_internal.c116
-rw-r--r--source/blender/editors/render/render_opengl.c112
-rw-r--r--source/blender/editors/render/render_preview.c241
-rw-r--r--source/blender/editors/render/render_shading.c322
-rw-r--r--source/blender/editors/render/render_update.c116
-rw-r--r--source/blender/editors/render/render_view.c104
-rw-r--r--source/blender/editors/screen/CMakeLists.txt4
-rw-r--r--source/blender/editors/screen/SConscript5
-rw-r--r--source/blender/editors/screen/area.c432
-rw-r--r--source/blender/editors/screen/glutil.c85
-rw-r--r--source/blender/editors/screen/screen_context.c114
-rw-r--r--source/blender/editors/screen/screen_edit.c436
-rw-r--r--source/blender/editors/screen/screen_ops.c850
-rw-r--r--source/blender/editors/screen/screendump.c80
-rw-r--r--source/blender/editors/sculpt_paint/CMakeLists.txt1
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c36
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c392
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c473
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h16
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c321
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c54
-rw-r--r--source/blender/editors/sculpt_paint/paint_undo.c74
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c140
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c1557
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c684
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h13
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c284
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c16
-rw-r--r--source/blender/editors/sound/sound_ops.c132
-rw-r--r--source/blender/editors/space_action/action_draw.c4
-rw-r--r--source/blender/editors/space_action/action_edit.c266
-rw-r--r--source/blender/editors/space_action/action_ops.c20
-rw-r--r--source/blender/editors/space_action/action_select.c110
-rw-r--r--source/blender/editors/space_action/space_action.c24
-rw-r--r--source/blender/editors/space_api/spacetypes.c24
-rw-r--r--source/blender/editors/space_buttons/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_buttons/SConscript3
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c325
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c8
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c54
-rw-r--r--source/blender/editors/space_buttons/buttons_texture.c104
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c51
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c57
-rw-r--r--source/blender/editors/space_clip/clip_draw.c430
-rw-r--r--source/blender/editors/space_clip/clip_editor.c57
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c27
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c88
-rw-r--r--source/blender/editors/space_clip/clip_ops.c243
-rw-r--r--source/blender/editors/space_clip/clip_toolbar.c52
-rw-r--r--source/blender/editors/space_clip/clip_utils.c46
-rw-r--r--source/blender/editors/space_clip/space_clip.c146
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c1091
-rw-r--r--source/blender/editors/space_console/console_draw.c8
-rw-r--r--source/blender/editors/space_console/console_ops.c210
-rw-r--r--source/blender/editors/space_console/space_console.c27
-rw-r--r--source/blender/editors/space_file/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_file/SConscript5
-rw-r--r--source/blender/editors/space_file/file_draw.c34
-rw-r--r--source/blender/editors/space_file/file_ops.c366
-rw-r--r--source/blender/editors/space_file/file_panels.c18
-rw-r--r--source/blender/editors/space_file/filelist.c252
-rw-r--r--source/blender/editors/space_file/filesel.c90
-rw-r--r--source/blender/editors/space_file/fsmenu.c31
-rw-r--r--source/blender/editors/space_file/space_file.c59
-rw-r--r--source/blender/editors/space_graph/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_graph/SConscript7
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c30
-rw-r--r--source/blender/editors/space_graph/graph_draw.c5
-rw-r--r--source/blender/editors/space_graph/graph_edit.c358
-rw-r--r--source/blender/editors/space_graph/graph_ops.c42
-rw-r--r--source/blender/editors/space_graph/graph_select.c104
-rw-r--r--source/blender/editors/space_graph/space_graph.c30
-rw-r--r--source/blender/editors/space_image/image_buttons.c198
-rw-r--r--source/blender/editors/space_image/image_draw.c138
-rw-r--r--source/blender/editors/space_image/image_ops.c590
-rw-r--r--source/blender/editors/space_image/space_image.c138
-rw-r--r--source/blender/editors/space_info/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_info/SConscript3
-rw-r--r--source/blender/editors/space_info/info_draw.c16
-rw-r--r--source/blender/editors/space_info/info_ops.c94
-rw-r--r--source/blender/editors/space_info/info_report.c152
-rw-r--r--source/blender/editors/space_info/info_stats.c128
-rw-r--r--source/blender/editors/space_info/space_info.c25
-rw-r--r--source/blender/editors/space_info/textview.c57
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c60
-rw-r--r--source/blender/editors/space_logic/logic_ops.c142
-rw-r--r--source/blender/editors/space_logic/logic_window.c587
-rw-r--r--source/blender/editors/space_logic/space_logic.c30
-rw-r--r--source/blender/editors/space_nla/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_nla/SConscript7
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c14
-rw-r--r--source/blender/editors/space_nla/nla_channels.c38
-rw-r--r--source/blender/editors/space_nla/nla_draw.c12
-rw-r--r--source/blender/editors/space_nla/nla_edit.c308
-rw-r--r--source/blender/editors/space_nla/nla_ops.c14
-rw-r--r--source/blender/editors/space_nla/nla_select.c66
-rw-r--r--source/blender/editors/space_nla/space_nla.c34
-rw-r--r--source/blender/editors/space_node/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_node/SConscript5
-rw-r--r--source/blender/editors/space_node/drawnode.c171
-rw-r--r--source/blender/editors/space_node/node_buttons.c18
-rw-r--r--source/blender/editors/space_node/node_draw.c260
-rw-r--r--source/blender/editors/space_node/node_edit.c913
-rw-r--r--source/blender/editors/space_node/node_header.c40
-rw-r--r--source/blender/editors/space_node/node_intern.h4
-rw-r--r--source/blender/editors/space_node/node_ops.c16
-rw-r--r--source/blender/editors/space_node/node_select.c147
-rw-r--r--source/blender/editors/space_node/node_state.c30
-rw-r--r--source/blender/editors/space_node/node_templates.c174
-rw-r--r--source/blender/editors/space_node/space_node.c122
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c299
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c324
-rw-r--r--source/blender/editors/space_outliner/outliner_ops.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c269
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c295
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c400
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c38
-rw-r--r--source/blender/editors/space_script/script_edit.c22
-rw-r--r--source/blender/editors/space_script/script_ops.c2
-rw-r--r--source/blender/editors/space_script/space_script.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c278
-rw-r--r--source/blender/editors/space_sequencer/sequencer_buttons.c14
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c206
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c936
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c25
-rw-r--r--source/blender/editors/space_sequencer/sequencer_scopes.c18
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c273
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c70
-rw-r--r--source/blender/editors/space_text/space_text.c24
-rw-r--r--source/blender/editors/space_text/text_draw.c529
-rw-r--r--source/blender/editors/space_text/text_header.c22
-rw-r--r--source/blender/editors/space_text/text_ops.c1034
-rw-r--r--source/blender/editors/space_text/text_python.c228
-rw-r--r--source/blender/editors/space_time/space_time.c32
-rw-r--r--source/blender/editors/space_time/time_ops.c67
-rw-r--r--source/blender/editors/space_view3d/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_view3d/SConscript3
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c4
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c62
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c18
-rw-r--r--source/blender/editors/space_view3d/drawobject.c1480
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c48
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c50
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c306
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c30
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c26
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c115
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c80
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c102
-rw-r--r--source/blender/editors/transform/CMakeLists.txt4
-rw-r--r--source/blender/editors/transform/SConscript7
-rw-r--r--source/blender/editors/transform/transform.c441
-rw-r--r--source/blender/editors/transform/transform.h6
-rw-r--r--source/blender/editors/transform/transform_constraints.c38
-rw-r--r--source/blender/editors/transform/transform_conversions.c682
-rw-r--r--source/blender/editors/transform/transform_generics.c160
-rw-r--r--source/blender/editors/transform/transform_input.c6
-rw-r--r--source/blender/editors/transform/transform_manipulator.c423
-rw-r--r--source/blender/editors/transform/transform_ops.c116
-rw-r--r--source/blender/editors/transform/transform_orientations.c64
-rw-r--r--source/blender/editors/transform/transform_snap.c98
-rw-r--r--source/blender/editors/util/crazyspace.c108
-rw-r--r--source/blender/editors/util/ed_util.c36
-rw-r--r--source/blender/editors/util/editmode_undo.c80
-rw-r--r--source/blender/editors/util/numinput.c9
-rw-r--r--source/blender/editors/util/undo.c146
-rw-r--r--source/blender/editors/uvedit/uvedit_buttons.c12
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c124
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c806
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c36
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c347
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c280
-rw-r--r--source/blender/gpu/GPU_buffers.h27
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c575
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c214
-rw-r--r--source/blender/gpu/intern/gpu_draw.c276
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c102
-rw-r--r--source/blender/gpu/intern/gpu_material.c432
-rw-r--r--source/blender/ikplugin/intern/iksolver_plugin.c96
-rw-r--r--source/blender/ikplugin/intern/itasc_plugin.cpp130
-rw-r--r--source/blender/imbuf/CMakeLists.txt6
-rw-r--r--source/blender/imbuf/IMB_imbuf.h1
-rw-r--r--source/blender/imbuf/IMB_thumbs.h2
-rw-r--r--source/blender/imbuf/SConscript1
-rw-r--r--source/blender/imbuf/intern/allocimbuf.c125
-rw-r--r--source/blender/imbuf/intern/anim_movie.c79
-rw-r--r--source/blender/imbuf/intern/bmp.c14
-rw-r--r--source/blender/imbuf/intern/cache.c64
-rw-r--r--source/blender/imbuf/intern/cineon/cineon_dpx.c8
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.c27
-rw-r--r--source/blender/imbuf/intern/cineon/dpxlib.c26
-rw-r--r--source/blender/imbuf/intern/cineon/logImageLib.c15
-rw-r--r--source/blender/imbuf/intern/cineon/logmemfile.c6
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.cpp48
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.cpp96
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.cpp6
-rw-r--r--source/blender/imbuf/intern/dds/dds_api.cpp4
-rw-r--r--source/blender/imbuf/intern/divers.c245
-rw-r--r--source/blender/imbuf/intern/filetype.c8
-rw-r--r--source/blender/imbuf/intern/filter.c146
-rw-r--r--source/blender/imbuf/intern/imageprocess.c23
-rw-r--r--source/blender/imbuf/intern/indexer.c51
-rw-r--r--source/blender/imbuf/intern/indexer_dv.c20
-rw-r--r--source/blender/imbuf/intern/iris.c150
-rw-r--r--source/blender/imbuf/intern/jp2.c105
-rw-r--r--source/blender/imbuf/intern/jpeg.c28
-rw-r--r--source/blender/imbuf/intern/metadata.c3
-rw-r--r--source/blender/imbuf/intern/moviecache.c63
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp118
-rw-r--r--source/blender/imbuf/intern/png.c15
-rw-r--r--source/blender/imbuf/intern/radiance_hdr.c13
-rw-r--r--source/blender/imbuf/intern/readimage.c52
-rw-r--r--source/blender/imbuf/intern/rectop.c36
-rw-r--r--source/blender/imbuf/intern/rotate.c12
-rw-r--r--source/blender/imbuf/intern/scaling.c34
-rw-r--r--source/blender/imbuf/intern/targa.c149
-rw-r--r--source/blender/imbuf/intern/thumbs.c46
-rw-r--r--source/blender/imbuf/intern/thumbs_blend.c49
-rw-r--r--source/blender/imbuf/intern/tiff.c117
-rw-r--r--source/blender/imbuf/intern/util.c64
-rw-r--r--source/blender/imbuf/intern/writeimage.c10
-rw-r--r--source/blender/makesdna/DNA_action_types.h4
-rw-r--r--source/blender/makesdna/DNA_anim_types.h4
-rw-r--r--source/blender/makesdna/DNA_armature_types.h2
-rw-r--r--source/blender/makesdna/DNA_brush_types.h107
-rw-r--r--source/blender/makesdna/DNA_customdata_types.h8
-rw-r--r--source/blender/makesdna/DNA_gpencil_types.h2
-rw-r--r--source/blender/makesdna/DNA_material_types.h2
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h2
-rw-r--r--source/blender/makesdna/DNA_meshdata_types.h31
-rw-r--r--source/blender/makesdna/DNA_object_force.h2
-rw-r--r--source/blender/makesdna/DNA_particle_types.h12
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h29
-rw-r--r--source/blender/makesdna/DNA_space_types.h4
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h10
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h6
-rw-r--r--source/blender/makesdna/DNA_world_types.h2
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c252
-rw-r--r--source/blender/makesdna/intern/makesdna.c192
-rw-r--r--source/blender/makesrna/RNA_access.h10
-rw-r--r--source/blender/makesrna/RNA_define.h2
-rw-r--r--source/blender/makesrna/RNA_enum_types.h3
-rw-r--r--source/blender/makesrna/intern/makesrna.c401
-rw-r--r--source/blender/makesrna/intern/rna_ID.c25
-rw-r--r--source/blender/makesrna/intern/rna_access.c302
-rw-r--r--source/blender/makesrna/intern/rna_action.c55
-rw-r--r--source/blender/makesrna/intern/rna_action_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c121
-rw-r--r--source/blender/makesrna/intern/rna_actuator_api.c8
-rw-r--r--source/blender/makesrna/intern/rna_animation.c63
-rw-r--r--source/blender/makesrna/intern/rna_animation_api.c9
-rw-r--r--source/blender/makesrna/intern/rna_animviz.c55
-rw-r--r--source/blender/makesrna/intern/rna_armature.c46
-rw-r--r--source/blender/makesrna/intern/rna_armature_api.c7
-rw-r--r--source/blender/makesrna/intern/rna_boid.c40
-rw-r--r--source/blender/makesrna/intern/rna_brush.c199
-rw-r--r--source/blender/makesrna/intern/rna_camera.c7
-rw-r--r--source/blender/makesrna/intern/rna_camera_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_cloth.c25
-rw-r--r--source/blender/makesrna/intern/rna_color.c28
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c201
-rw-r--r--source/blender/makesrna/intern/rna_controller.c25
-rw-r--r--source/blender/makesrna/intern/rna_controller_api.c12
-rw-r--r--source/blender/makesrna/intern/rna_curve.c110
-rw-r--r--source/blender/makesrna/intern/rna_define.c266
-rw-r--r--source/blender/makesrna/intern/rna_dynamicpaint.c60
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c79
-rw-r--r--source/blender/makesrna/intern/rna_fcurve_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_fluidsim.c114
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c2
-rw-r--r--source/blender/makesrna/intern/rna_group.c4
-rw-r--r--source/blender/makesrna/intern/rna_image.c22
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c13
-rw-r--r--source/blender/makesrna/intern/rna_internal.h14
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h15
-rw-r--r--source/blender/makesrna/intern/rna_key.c35
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c53
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c8
-rw-r--r--source/blender/makesrna/intern/rna_main.c26
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c10
-rw-r--r--source/blender/makesrna/intern/rna_material.c58
-rw-r--r--source/blender/makesrna/intern/rna_material_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c137
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_mesh_utils.h2
-rw-r--r--source/blender/makesrna/intern/rna_meta.c5
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c200
-rw-r--r--source/blender/makesrna/intern/rna_movieclip.c25
-rw-r--r--source/blender/makesrna/intern/rna_nla.c77
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c131
-rw-r--r--source/blender/makesrna/intern/rna_object.c107
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c64
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c55
-rw-r--r--source/blender/makesrna/intern/rna_particle.c202
-rw-r--r--source/blender/makesrna/intern/rna_pose.c77
-rw-r--r--source/blender/makesrna/intern/rna_pose_api.c9
-rw-r--r--source/blender/makesrna/intern/rna_property.c2
-rw-r--r--source/blender/makesrna/intern/rna_render.c22
-rw-r--r--source/blender/makesrna/intern/rna_rna.c80
-rw-r--r--source/blender/makesrna/intern/rna_scene.c193
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c13
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c10
-rw-r--r--source/blender/makesrna/intern/rna_sensor.c48
-rw-r--r--source/blender/makesrna/intern/rna_sensor_api.c8
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c196
-rw-r--r--source/blender/makesrna/intern/rna_sequencer_api.c3
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c15
-rw-r--r--source/blender/makesrna/intern/rna_sound.c5
-rw-r--r--source/blender/makesrna/intern/rna_space.c151
-rw-r--r--source/blender/makesrna/intern/rna_test.c5
-rw-r--r--source/blender/makesrna/intern/rna_text.c10
-rw-r--r--source/blender/makesrna/intern/rna_texture.c69
-rw-r--r--source/blender/makesrna/intern/rna_texture_api.c5
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c109
-rw-r--r--source/blender/makesrna/intern/rna_ui.c6
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c24
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c165
-rw-r--r--source/blender/makesrna/intern/rna_wm.c92
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c32
-rw-r--r--source/blender/makesrna/intern/rna_world.c36
-rw-r--r--source/blender/modifiers/CMakeLists.txt5
-rw-r--r--source/blender/modifiers/SConscript5
-rw-r--r--source/blender/modifiers/intern/MOD_armature.c16
-rw-r--r--source/blender/modifiers/intern/MOD_array.c50
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c32
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.c19
-rw-r--r--source/blender/modifiers/intern/MOD_boolean_util.c50
-rw-r--r--source/blender/modifiers/intern/MOD_build.c6
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c92
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c36
-rw-r--r--source/blender/modifiers/intern/MOD_collision.c42
-rw-r--r--source/blender/modifiers/intern/MOD_curve.c6
-rw-r--r--source/blender/modifiers/intern/MOD_decimate.c33
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c26
-rw-r--r--source/blender/modifiers/intern/MOD_dynamicpaint.c6
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c10
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c137
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim.c14
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c103
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c56
-rw-r--r--source/blender/modifiers/intern/MOD_lattice.c8
-rw-r--r--source/blender/modifiers/intern/MOD_mask.c2
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c102
-rw-r--r--source/blender/modifiers/intern/MOD_mirror.c24
-rw-r--r--source/blender/modifiers/intern/MOD_multires.c44
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c8
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c80
-rw-r--r--source/blender/modifiers/intern/MOD_particlesystem.c40
-rw-r--r--source/blender/modifiers/intern/MOD_remesh.c6
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c56
-rw-r--r--source/blender/modifiers/intern/MOD_shapekey.c16
-rw-r--r--source/blender/modifiers/intern/MOD_shrinkwrap.c12
-rw-r--r--source/blender/modifiers/intern/MOD_simpledeform.c40
-rw-r--r--source/blender/modifiers/intern/MOD_smoke.c44
-rw-r--r--source/blender/modifiers/intern/MOD_smooth.c8
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c111
-rw-r--r--source/blender/modifiers/intern/MOD_subsurf.c6
-rw-r--r--source/blender/modifiers/intern/MOD_surface.c28
-rw-r--r--source/blender/modifiers/intern/MOD_util.c45
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c69
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c52
-rw-r--r--source/blender/modifiers/intern/MOD_wave.c60
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c16
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.h2
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgedit.c20
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgmix.c28
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c60
-rw-r--r--source/blender/nodes/CMakeLists.txt4
-rw-r--r--source/blender/nodes/SConscript3
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c302
-rw-r--r--source/blender/nodes/composite/node_composite_util.c250
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bilateralblur.c36
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_blur.c157
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_brightness.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_channelMatte.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_chromaMatte.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorMatte.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorSpill.c38
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorbalance.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_composite.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_crop.c18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_curves.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diffMatte.c18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_dilate.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_directionalblur.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_displace.c20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_distanceMatte.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c2304
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_filter.c46
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_flip.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_gamma.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_glare.c3
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_hueSatVal.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_huecorrect.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_idMask.c20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c168
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_invert.c19
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_levels.c46
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lummaMatte.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapUV.c24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapValue.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_math.c32
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mixrgb.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_movieclip.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_moviedistortion.c27
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normal.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normalize.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_outputFile.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_premulkey.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rotate.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_scale.c19
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_setalpha.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_splitViewer.c24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_stabilize2d.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_texture.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_tonemap.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_transform.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_translate.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_valToRgb.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_vecBlur.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_viewer.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_zcombine.c28
-rw-r--r--source/blender/nodes/intern/node_common.c62
-rw-r--r--source/blender/nodes/intern/node_exec.c36
-rw-r--r--source/blender/nodes/intern/node_socket.c18
-rw-r--r--source/blender/nodes/intern/node_util.c88
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c40
-rw-r--r--source/blender/nodes/shader/node_shader_util.c66
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_camera.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_curves.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_dynamic.c8
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_geom.c16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_hueSatVal.c4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mapping.c16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_material.c64
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.c40
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output.c8
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_checker.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_environment.c4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_gradient.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_image.c4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_magic.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_noise.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_sky.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_wave.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_texture.c18
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_valToRgb.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vectMath.c16
-rw-r--r--source/blender/nodes/texture/node_texture_tree.c46
-rw-r--r--source/blender/nodes/texture/node_texture_util.c23
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_bricks.c7
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_checker.c5
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_compose.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_curves.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_hueSatVal.c8
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_image.c18
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_math.c26
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_output.c35
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_proc.c14
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_texture.c6
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_valToRgb.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_viewer.c2
-rw-r--r--source/blender/python/bmesh/CMakeLists.txt8
-rw-r--r--source/blender/python/bmesh/bmesh_py_api.c106
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c890
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.h35
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.c952
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.h81
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c260
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.h52
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_select.c (renamed from source/blender/python/bmesh/bmesh_py_select.c)158
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_select.h (renamed from source/blender/python/bmesh/bmesh_py_select.h)11
-rw-r--r--source/blender/python/bmesh/bmesh_py_utils.c64
-rw-r--r--source/blender/python/generic/bgl.c234
-rw-r--r--source/blender/python/generic/bgl.h14
-rw-r--r--source/blender/python/generic/blf_py_api.c6
-rw-r--r--source/blender/python/generic/bpy_internal_import.c2
-rw-r--r--source/blender/python/generic/idprop_py_api.c425
-rw-r--r--source/blender/python/generic/py_capi_utils.c138
-rw-r--r--source/blender/python/intern/bpy.c11
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c24
-rw-r--r--source/blender/python/intern/bpy_driver.c6
-rw-r--r--source/blender/python/intern/bpy_interface.c13
-rw-r--r--source/blender/python/intern/bpy_interface_atexit.c2
-rw-r--r--source/blender/python/intern/bpy_library.c10
-rw-r--r--source/blender/python/intern/bpy_operator.c2
-rw-r--r--source/blender/python/intern/bpy_props.c28
-rw-r--r--source/blender/python/intern/bpy_rna.c314
-rw-r--r--source/blender/python/intern/bpy_rna_array.c84
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c2
-rw-r--r--source/blender/python/intern/bpy_traceback.c8
-rw-r--r--source/blender/python/intern/gpu.c26
-rw-r--r--source/blender/python/intern/gpu.h2
-rw-r--r--source/blender/python/mathutils/mathutils.c31
-rw-r--r--source/blender/python/mathutils/mathutils.h6
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c43
-rw-r--r--source/blender/python/mathutils/mathutils_Color.h5
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c39
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.h5
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c60
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.h8
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c64
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.h5
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c137
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.h3
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c182
-rw-r--r--source/blender/python/mathutils/mathutils_noise.c6
-rw-r--r--source/blender/python/simple_enum_gen.py4
-rw-r--r--source/blender/quicktime/apple/qtkit_export.m14
-rw-r--r--source/blender/quicktime/apple/qtkit_import.m4
-rw-r--r--source/blender/quicktime/apple/quicktime_export.c102
-rw-r--r--source/blender/quicktime/apple/quicktime_import.c95
-rw-r--r--source/blender/render/intern/include/sunsky.h2
-rw-r--r--source/blender/render/intern/raytrace/rayobject.cpp104
-rw-r--r--source/blender/render/intern/raytrace/rayobject_blibvh.cpp8
-rw-r--r--source/blender/render/intern/raytrace/rayobject_instance.cpp14
-rw-r--r--source/blender/render/intern/raytrace/rayobject_octree.cpp323
-rw-r--r--source/blender/render/intern/raytrace/rayobject_qbvh.cpp10
-rw-r--r--source/blender/render/intern/raytrace/rayobject_rtbuild.cpp116
-rw-r--r--source/blender/render/intern/raytrace/rayobject_svbvh.cpp14
-rw-r--r--source/blender/render/intern/raytrace/rayobject_vbvh.cpp16
-rw-r--r--source/blender/render/intern/raytrace/reorganize.h5
-rw-r--r--source/blender/render/intern/raytrace/vbvh.h4
-rw-r--r--source/blender/render/intern/source/convertblender.c1467
-rw-r--r--source/blender/render/intern/source/envmap.c157
-rw-r--r--source/blender/render/intern/source/external_engine.c74
-rw-r--r--source/blender/render/intern/source/imagetexture.c401
-rw-r--r--source/blender/render/intern/source/initrender.c134
-rw-r--r--source/blender/render/intern/source/occlusion.c403
-rw-r--r--source/blender/render/intern/source/pipeline.c591
-rw-r--r--source/blender/render/intern/source/pixelblending.c44
-rw-r--r--source/blender/render/intern/source/pixelshading.c167
-rw-r--r--source/blender/render/intern/source/pointdensity.c22
-rw-r--r--source/blender/render/intern/source/rayshade.c417
-rw-r--r--source/blender/render/intern/source/render_result.c499
-rw-r--r--source/blender/render/intern/source/render_texture.c831
-rw-r--r--source/blender/render/intern/source/rendercore.c740
-rw-r--r--source/blender/render/intern/source/renderdatabase.c382
-rw-r--r--source/blender/render/intern/source/shadbuf.c773
-rw-r--r--source/blender/render/intern/source/shadeinput.c315
-rw-r--r--source/blender/render/intern/source/shadeoutput.c539
-rw-r--r--source/blender/render/intern/source/sss.c148
-rw-r--r--source/blender/render/intern/source/strand.c218
-rw-r--r--source/blender/render/intern/source/sunsky.c4
-rw-r--r--source/blender/render/intern/source/volume_precache.c38
-rw-r--r--source/blender/render/intern/source/volumetric.c44
-rw-r--r--source/blender/render/intern/source/voxeldata.c37
-rw-r--r--source/blender/render/intern/source/zbuf.c1343
-rw-r--r--source/blender/windowmanager/CMakeLists.txt6
-rw-r--r--source/blender/windowmanager/SConscript1
-rw-r--r--source/blender/windowmanager/WM_api.h3
-rw-r--r--source/blender/windowmanager/WM_types.h9
-rw-r--r--source/blender/windowmanager/intern/wm.c66
-rw-r--r--source/blender/windowmanager/intern/wm_apple.c3
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c43
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c78
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c238
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c704
-rw-r--r--source/blender/windowmanager/intern/wm_files.c121
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c85
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c43
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c118
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c284
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c926
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c36
-rw-r--r--source/blender/windowmanager/intern/wm_window.c268
944 files changed, 71457 insertions, 60691 deletions
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c
index cc4d6b41f98..1fab96b2075 100644
--- a/source/blender/avi/intern/avi.c
+++ b/source/blender/avi/intern/avi.c
@@ -53,7 +53,7 @@
static int AVI_DEBUG=0;
static char DEBUG_FCC[4];
-#define DEBUG_PRINT(x) if(AVI_DEBUG) printf("AVI DEBUG: " x);
+#define DEBUG_PRINT(x) if (AVI_DEBUG) printf("AVI DEBUG: " x);
/* local functions */
char *fcc_to_char (unsigned int fcc);
@@ -216,7 +216,8 @@ int AVI_is_avi (char *name)
!GET_FCC (fp) ||
GET_FCC (fp) != FCC("AVI ")) {
ret = 0;
- } else {
+ }
+ else {
ret = 1;
}
@@ -312,9 +313,11 @@ int AVI_is_avi (const char *name)
fcca == FCC ("RAW ") ||
fcca == 0) {
movie.streams[temp].format = AVI_FORMAT_AVI_RGB;
- } else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
+ }
+ else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
movie.streams[temp].format = AVI_FORMAT_MJPEG;
- } else {
+ }
+ else {
MEM_freeN(movie.streams);
fclose(movie.fp);
return 0;
@@ -379,10 +382,12 @@ int AVI_is_avi (const char *name)
fcca == FCC ("rgb ") ||
fcca == FCC ("RAW ") ||
fcca == 0 ) {
- } else if ( fcca == FCC ("mjpg") ||
+ }
+ else if ( fcca == FCC ("mjpg") ||
fcca == FCC ("MJPG")) {
movie.streams[temp].format = AVI_FORMAT_MJPEG;
- } else {
+ }
+ else {
MEM_freeN(movie.streams);
fclose(movie.fp);
return 0;
@@ -391,7 +396,8 @@ int AVI_is_avi (const char *name)
}
if (j > 0) fseek (movie.fp, j, SEEK_CUR);
- } else fseek (movie.fp, movie.streams[temp].sf_size, SEEK_CUR);
+ }
+ else fseek (movie.fp, movie.streams[temp].sf_size, SEEK_CUR);
/* Walk to the next LIST */
while (GET_FCC (movie.fp) != FCC("LIST")) {
@@ -495,9 +501,11 @@ AviError AVI_open_movie (const char *name, AviMovie *movie)
fcca == FCC ("RAW ") ||
fcca == 0) {
movie->streams[temp].format = AVI_FORMAT_AVI_RGB;
- } else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
+ }
+ else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
movie->streams[temp].format = AVI_FORMAT_MJPEG;
- } else {
+ }
+ else {
return AVI_ERROR_COMPRESSION;
}
}
@@ -558,17 +566,20 @@ AviError AVI_open_movie (const char *name, AviMovie *movie)
fcca == FCC ("rgb ") ||
fcca == FCC ("RAW ") ||
fcca == 0 ) {
- } else if ( fcca == FCC ("mjpg") ||
+ }
+ else if ( fcca == FCC ("mjpg") ||
fcca == FCC ("MJPG")) {
movie->streams[temp].format = AVI_FORMAT_MJPEG;
- } else {
+ }
+ else {
return AVI_ERROR_COMPRESSION;
}
}
}
if (j > 0) fseek (movie->fp, j, SEEK_CUR);
- } else fseek (movie->fp, movie->streams[temp].sf_size, SEEK_CUR);
+ }
+ else fseek (movie->fp, movie->streams[temp].sf_size, SEEK_CUR);
/* Walk to the next LIST */
while (GET_FCC (movie->fp) != FCC("LIST")) {
@@ -595,7 +606,8 @@ AviError AVI_open_movie (const char *name, AviMovie *movie)
break;
else
fseek (movie->fp, size-4, SEEK_CUR);
- } else {
+ }
+ else {
fseek (movie->fp, size, SEEK_CUR);
}
if (ftell(movie->fp) > movie->size) {
@@ -659,7 +671,7 @@ void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
/* Retrieve the record number of the desired frame in the index
* If a chunk has Size 0 we need to rewind to previous frame */
- while(rewind && frame > -1) {
+ while (rewind && frame > -1) {
i=0;
cur_frame=-1;
rewind = 0;
@@ -670,7 +682,8 @@ void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
if ((cur_frame == frame -1) && (movie->entries[i].Size == 0)) {
rewind = 1;
frame = frame -1;
- } else {
+ }
+ else {
cur_frame++;
}
}
@@ -802,7 +815,8 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
movie->streams[i].sf = MEM_mallocN (sizeof(AviBitmapInfoHeader)
+ sizeof(AviMJPEGUnknown),"moviestreamformatL");
movie->streams[i].sf_size = sizeof(AviBitmapInfoHeader) + sizeof(AviMJPEGUnknown);
- } else {
+ }
+ else {
#endif
movie->streams[i].sf = MEM_mallocN (sizeof(AviBitmapInfoHeader), "moviestreamformatS");
movie->streams[i].sf_size = sizeof(AviBitmapInfoHeader);
diff --git a/source/blender/avi/intern/avirgb.c b/source/blender/avi/intern/avirgb.c
index 42a094b1e1c..8e5806c09cf 100644
--- a/source/blender/avi/intern/avirgb.c
+++ b/source/blender/avi/intern/avirgb.c
@@ -94,7 +94,8 @@ void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *bu
MEM_freeN (buffer);
return buf;
- } else {
+ }
+ else {
buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
rowstride = movie->header->Width*3;
diff --git a/source/blender/avi/intern/mjpeg.c b/source/blender/avi/intern/mjpeg.c
index dab0b213d95..f6ebcab2aeb 100644
--- a/source/blender/avi/intern/mjpeg.c
+++ b/source/blender/avi/intern/mjpeg.c
@@ -159,7 +159,7 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
jpeg_create_decompress(&dinfo);
jpegmemsrcmgr_build(&dinfo, inBuffer, bufsize);
jpeg_read_header(&dinfo, TRUE);
- if (dinfo.dc_huff_tbl_ptrs[0] == NULL){
+ if (dinfo.dc_huff_tbl_ptrs[0] == NULL) {
std_huff_tables(&dinfo);
}
dinfo.out_color_space = JCS_RGB;
@@ -181,13 +181,13 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
numbytes= 0;
jpeg_read_header(&dinfo, TRUE);
- if (dinfo.dc_huff_tbl_ptrs[0] == NULL){
+ if (dinfo.dc_huff_tbl_ptrs[0] == NULL) {
std_huff_tables(&dinfo);
}
jpeg_start_decompress(&dinfo);
rowstride= dinfo.output_width*dinfo.output_components;
- for (y= 0; y<dinfo.output_height; y++){
+ for (y= 0; y<dinfo.output_height; y++) {
jpeg_read_scanlines(&dinfo, (JSAMPARRAY) &outBuffer, 1);
outBuffer += rowstride;
}
@@ -251,7 +251,7 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *
jpeg_write_marker (&cinfo, JPEG_COM, marker, 60);
rowstride= cinfo.image_width*cinfo.input_components;
- for (y = 0; y < cinfo.image_height; y++){
+ for (y = 0; y < cinfo.image_height; y++) {
jpeg_write_scanlines(&cinfo, (JSAMPARRAY) &inBuffer, 1);
inBuffer += rowstride;
}
@@ -301,7 +301,8 @@ static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, in
MEM_freeN(tmpbuf);
return ret;
- } else {
+ }
+ else {
return Decode_JPEG(inbuf, outbuf, width, height, bufsize);
}
}
@@ -329,7 +330,8 @@ static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned
Compress_JPEG(quality, outbuf, tmpbuf, jwidth, jheight, bufsize);
MEM_freeN(tmpbuf);
- } else {
+ }
+ else {
Compress_JPEG(quality, outbuf, inbuf, width, height, bufsize);
}
}
@@ -369,7 +371,8 @@ void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer
buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "avi.avi_converter_to_mjpeg 1");
if (!movie->interlace) {
check_and_compress_jpeg(movie->streams[stream].sh.Quality/100, buf, buffer, movie->header->Width, movie->header->Height, bufsize);
- } else {
+ }
+ else {
deinterlace (movie->odd_fields, buf, buffer, movie->header->Width, movie->header->Height);
MEM_freeN (buffer);
diff --git a/source/blender/avi/intern/rgb32.c b/source/blender/avi/intern/rgb32.c
index e3be082cca6..c6830d9666a 100644
--- a/source/blender/avi/intern/rgb32.c
+++ b/source/blender/avi/intern/rgb32.c
@@ -82,7 +82,7 @@ void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer
to= buf; from= buffer;
i=movie->header->Height*movie->header->Width;
- while(i--) {
+ while (i--) {
memcpy(to, from, 3);
to+=4; from+=3;
}
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index 1e242deece4..911a94cb56a 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -76,61 +76,49 @@ void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t l
void BLF_draw(int fontid, const char *str, size_t len);
void BLF_draw_ascii(int fontid, const char *str, size_t len);
-/*
- * This function return the bounding box of the string
+/* This function return the bounding box of the string
* and are not multiplied by the aspect.
*/
void BLF_boundbox(int fontid, const char *str, struct rctf *box);
-/*
- * The next both function return the width and height
+/* The next both function return the width and height
* of the string, using the current font and both value
* are multiplied by the aspect of the font.
*/
float BLF_width(int fontid, const char *str);
float BLF_height(int fontid, const char *str);
-/*
- * Return dimensions of the font without any sample text.
- */
+/* Return dimensions of the font without any sample text. */
float BLF_height_max(int fontid);
float BLF_width_max(int fontid);
float BLF_descender(int fontid);
float BLF_ascender(int fontid);
-/*
- * The following function return the width and height of the string, but
+/* The following function return the width and height of the string, but
* just in one call, so avoid extra freetype2 stuff.
*/
void BLF_width_and_height(int fontid, const char *str, float *width, float *height);
-/*
- * For fixed width fonts only, returns the width of a
+/* For fixed width fonts only, returns the width of a
* character.
*/
float BLF_fixed_width(int fontid);
-/*
- * and this two function return the width and height
+/* and this two function return the width and height
* of the string, using the default font and both value
* are multiplied by the aspect of the font.
*/
float BLF_width_default(const char *str);
float BLF_height_default(const char *str);
-/*
- * Set rotation for default font.
- */
+/* Set rotation for default font. */
void BLF_rotation_default(float angle);
-/*
- * Enable/disable options to the default font.
- */
+/* Enable/disable options to the default font. */
void BLF_enable_default(int option);
void BLF_disable_default(int option);
-/*
- * By default, rotation and clipping are disable and
+/* By default, rotation and clipping are disable and
* have to be enable/disable using BLF_enable/disable.
*/
void BLF_rotation(int fontid, float angle);
@@ -141,39 +129,34 @@ void BLF_blur(int fontid, int size);
void BLF_enable(int fontid, int option);
void BLF_disable(int fontid, int option);
-/*
- * Shadow options, level is the blur level, can be 3, 5 or 0 and
+/* Shadow options, level is the blur level, can be 3, 5 or 0 and
* the other argument are the rgba color.
- * Take care that shadow need to be enable using BLF_enable!!.
+ * Take care that shadow need to be enable using BLF_enable!!!
*/
void BLF_shadow(int fontid, int level, float r, float g, float b, float a);
-/*
- * Set the offset for shadow text, this is the current cursor
+/* Set the offset for shadow text, this is the current cursor
* position plus this offset, don't need call BLF_position before
* this function, the current position is calculate only on
* BLF_draw, so it's safe call this whenever you like.
*/
void BLF_shadow_offset(int fontid, int x, int y);
-/*
- * Set the buffer, size and number of channels to draw, one thing to take care is call
+/* Set the buffer, size and number of channels to draw, one thing to take care is call
* this function with NULL pointer when we finish, for example:
- * BLF_buffer(my_fbuf, my_cbuf, 100, 100, 4);
*
- * ... set color, position and draw ...
+ * BLF_buffer(my_fbuf, my_cbuf, 100, 100, 4);
*
- * BLF_buffer(NULL, NULL, 0, 0, 0);
+ * ... set color, position and draw ...
+ *
+ * BLF_buffer(NULL, NULL, 0, 0, 0);
*/
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch);
-/*
- * Set the color to be used for text.
- */
+/* Set the color to be used for text. */
void BLF_buffer_col(int fontid, float r, float g, float b, float a);
-/*
- * Draw the string into the buffer, this function draw in both buffer, float and unsigned char _BUT_
+/* Draw the string into the buffer, this function draw in both buffer, float and unsigned char _BUT_
* it's not necessary set both buffer, NULL is valid here.
*/
void BLF_draw_buffer(int fontid, const char *str);
@@ -200,8 +183,8 @@ void BLF_dir_free(char **dirs, int count);
#define BLF_DRAW_STR_DUMMY_MAX 1024
-// XXX, bad design
+/* XXX, bad design */
extern int blf_mono_font;
-extern int blf_mono_font_render; // dont mess drawing with render threads.
+extern int blf_mono_font_render; /* don't mess drawing with render threads. */
#endif /* __BLF_API_H__ */
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index 868a58d23c0..5e2fee36af0 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -47,8 +47,7 @@ const char *BLF_pgettext(const char *context, const char *message);
/* blf_lang.c */
-/*
- * Search the path directory to the locale files, this try all
+/* Search the path directory to the locale files, this try all
* the case for Linux, Win and Mac.
*/
void BLF_lang_init(void);
@@ -62,15 +61,25 @@ void BLF_lang_encoding(const char *str);
/* translation */
int BLF_translate_iface(void);
int BLF_translate_tooltips(void);
-const char *BLF_translate_do_iface(const char *msgid);
-const char *BLF_translate_do_tooltip(const char *msgid);
+const char *BLF_translate_do_iface(const char *contex, const char *msgid);
+const char *BLF_translate_do_tooltip(const char *contex, const char *msgid);
-/*#define _(msgid) BLF_gettext(msgid)*/
/* The "translation-marker" macro. */
#define N_(msgid) msgid
/* Those macros should be used everywhere in UI code. */
-#define IFACE_(msgid) BLF_translate_do_iface(msgid)
-#define TIP_(msgid) BLF_translate_do_tooltip(msgid)
+#ifdef WITH_INTERNATIONAL
+/* #define _(msgid) BLF_gettext(msgid) */
+ #define IFACE_(msgid) BLF_translate_do_iface(NULL, msgid)
+ #define TIP_(msgid) BLF_translate_do_tooltip(NULL, msgid)
+ #define CTX_IFACE_(context, msgid) BLF_translate_do_iface(context, msgid)
+ #define CTX_TIP_(context, msgid) BLF_translate_do_tooltip(context, msgid)
+#else
+/* #define _(msgid) msgid */
+ #define IFACE_(msgid) msgid
+ #define TIP_(msgid) msgid
+ #define CTX_IFACE_(context, msgid) msgid
+ #define CTX_TIP_(context, msgid) msgid
+#endif
#endif /* __BLF_TRANSLATION_H__ */
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index a387b416c38..626c591c40f 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -62,13 +62,13 @@
static FontBLF *global_font[BLF_MAX_FONT] = {0};
/* Default size and dpi, for BLF_draw_default. */
-static int global_font_default= -1;
-static int global_font_points= 11;
-static int global_font_dpi= 72;
+static int global_font_default = -1;
+static int global_font_points = 11;
+static int global_font_dpi = 72;
-// XXX, should these be made into global_font_'s too?
-int blf_mono_font= -1;
-int blf_mono_font_render= -1;
+/* XXX, should these be made into global_font_'s too? */
+int blf_mono_font = -1;
+int blf_mono_font_render = -1;
static FontBLF *BLF_get(int fontid)
{
@@ -81,11 +81,11 @@ int BLF_init(int points, int dpi)
{
int i;
- for (i= 0; i < BLF_MAX_FONT; i++)
- global_font[i]= NULL;
+ for (i = 0; i < BLF_MAX_FONT; i++)
+ global_font[i] = NULL;
- global_font_points= points;
- global_font_dpi= dpi;
+ global_font_points = points;
+ global_font_dpi = dpi;
return blf_font_init();
}
@@ -94,11 +94,11 @@ void BLF_exit(void)
FontBLF *font;
int i;
- for (i= 0; i < BLF_MAX_FONT; i++) {
- font= global_font[i];
+ for (i = 0; i < BLF_MAX_FONT; i++) {
+ font = global_font[i];
if (font) {
blf_font_free(font);
- global_font[i]= NULL;
+ global_font[i] = NULL;
}
}
@@ -110,8 +110,8 @@ void BLF_cache_clear(void)
FontBLF *font;
int i;
- for (i= 0; i < BLF_MAX_FONT; i++) {
- font= global_font[i];
+ for (i = 0; i < BLF_MAX_FONT; i++) {
+ font = global_font[i];
if (font)
blf_glyph_cache_clear(font);
}
@@ -122,8 +122,8 @@ static int blf_search(const char *name)
FontBLF *font;
int i;
- for (i= 0; i < BLF_MAX_FONT; i++) {
- font= global_font[i];
+ for (i = 0; i < BLF_MAX_FONT; i++) {
+ font = global_font[i];
if (font && (!strcmp(font->name, name)))
return i;
}
@@ -135,8 +135,8 @@ static int blf_search_available(void)
{
int i;
- for (i= 0; i < BLF_MAX_FONT; i++)
- if(!global_font[i])
+ for (i = 0; i < BLF_MAX_FONT; i++)
+ if (!global_font[i])
return i;
return -1;
@@ -152,7 +152,7 @@ int BLF_load(const char *name)
return -1;
/* check if we already load this font. */
- i= blf_search(name);
+ i = blf_search(name);
if (i >= 0) {
/*font= global_font[i];*/ /*UNUSED*/
return i;
@@ -164,13 +164,13 @@ int BLF_load(const char *name)
return -1;
}
- filename= blf_dir_search(name);
+ filename = blf_dir_search(name);
if (!filename) {
printf("Can't find font: %s\n", name);
return -1;
}
- font= blf_font_new(name, filename);
+ font = blf_font_new(name, filename);
MEM_freeN(filename);
if (!font) {
@@ -178,7 +178,7 @@ int BLF_load(const char *name)
return -1;
}
- global_font[i]= font;
+ global_font[i] = font;
return i;
}
@@ -200,13 +200,13 @@ int BLF_load_unique(const char *name)
return -1;
}
- filename= blf_dir_search(name);
+ filename = blf_dir_search(name);
if (!filename) {
printf("Can't find font: %s\n", name);
return -1;
}
- font= blf_font_new(name, filename);
+ font = blf_font_new(name, filename);
MEM_freeN(filename);
if (!font) {
@@ -214,13 +214,13 @@ int BLF_load_unique(const char *name)
return -1;
}
- global_font[i]= font;
+ global_font[i] = font;
return i;
}
void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
blf_font_attach_from_mem(font, mem, mem_size);
@@ -235,7 +235,7 @@ int BLF_load_mem(const char *name, unsigned char *mem, int mem_size)
if (!name)
return -1;
- i= blf_search(name);
+ i = blf_search(name);
if (i >= 0) {
/*font= global_font[i];*/ /*UNUSED*/
return i;
@@ -252,13 +252,13 @@ int BLF_load_mem(const char *name, unsigned char *mem, int mem_size)
return -1;
}
- font= blf_font_new_from_mem(name, mem, mem_size);
+ font = blf_font_new_from_mem(name, mem, mem_size);
if (!font) {
printf("Can't load font: %s from memory!!\n", name);
return -1;
}
- global_font[i]= font;
+ global_font[i] = font;
return i;
}
@@ -285,13 +285,13 @@ int BLF_load_mem_unique(const char *name, unsigned char *mem, int mem_size)
return -1;
}
- font= blf_font_new_from_mem(name, mem, mem_size);
+ font = blf_font_new_from_mem(name, mem, mem_size);
if (!font) {
printf("Can't load font: %s from memory!!\n", name);
return -1;
}
- global_font[i]= font;
+ global_font[i] = font;
return i;
}
@@ -300,19 +300,19 @@ void BLF_unload(const char *name)
FontBLF *font;
int i;
- for (i= 0; i < BLF_MAX_FONT; i++) {
- font= global_font[i];
+ for (i = 0; i < BLF_MAX_FONT; i++) {
+ font = global_font[i];
if (font && (!strcmp(font->name, name))) {
blf_font_free(font);
- global_font[i]= NULL;
+ global_font[i] = NULL;
}
}
}
void BLF_enable(int fontid, int option)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
font->flags |= option;
@@ -321,7 +321,7 @@ void BLF_enable(int fontid, int option)
void BLF_disable(int fontid, int option)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
font->flags &= ~option;
@@ -330,7 +330,7 @@ void BLF_disable(int fontid, int option)
void BLF_enable_default(int option)
{
- FontBLF *font= BLF_get(global_font_default);
+ FontBLF *font = BLF_get(global_font_default);
if (font) {
font->flags |= option;
@@ -339,7 +339,7 @@ void BLF_enable_default(int option)
void BLF_disable_default(int option)
{
- FontBLF *font= BLF_get(global_font_default);
+ FontBLF *font = BLF_get(global_font_default);
if (font) {
font->flags &= ~option;
@@ -348,18 +348,18 @@ void BLF_disable_default(int option)
void BLF_aspect(int fontid, float x, float y, float z)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
- font->aspect[0]= x;
- font->aspect[1]= y;
- font->aspect[2]= z;
+ font->aspect[0] = x;
+ font->aspect[1] = y;
+ font->aspect[2] = z;
}
}
void BLF_matrix(int fontid, const double m[16])
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
memcpy(font->m, m, sizeof(font->m));
@@ -368,24 +368,24 @@ void BLF_matrix(int fontid, const double m[16])
void BLF_position(int fontid, float x, float y, float z)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
float xa, ya, za;
float remainder;
if (font->flags & BLF_ASPECT) {
- xa= font->aspect[0];
- ya= font->aspect[1];
- za= font->aspect[2];
+ xa = font->aspect[0];
+ ya = font->aspect[1];
+ za = font->aspect[2];
}
else {
- xa= 1.0f;
- ya= 1.0f;
- za= 1.0f;
+ xa = 1.0f;
+ ya = 1.0f;
+ za = 1.0f;
}
- remainder= x - floorf(x);
+ remainder = x - floorf(x);
if (remainder > 0.4f && remainder < 0.6f) {
if (remainder < 0.5f)
x -= 0.1f * xa;
@@ -393,7 +393,7 @@ void BLF_position(int fontid, float x, float y, float z)
x += 0.1f * xa;
}
- remainder= y - floorf(y);
+ remainder = y - floorf(y);
if (remainder > 0.4f && remainder < 0.6f) {
if (remainder < 0.5f)
y -= 0.1f * ya;
@@ -401,7 +401,7 @@ void BLF_position(int fontid, float x, float y, float z)
y += 0.1f * ya;
}
- remainder= z - floorf(z);
+ remainder = z - floorf(z);
if (remainder > 0.4f && remainder < 0.6f) {
if (remainder < 0.5f)
z -= 0.1f * za;
@@ -409,15 +409,15 @@ void BLF_position(int fontid, float x, float y, float z)
z += 0.1f * za;
}
- font->pos[0]= x;
- font->pos[1]= y;
- font->pos[2]= z;
+ font->pos[0] = x;
+ font->pos[1] = y;
+ font->pos[2] = z;
}
}
void BLF_size(int fontid, int size, int dpi)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
blf_font_size(font, size, dpi);
@@ -426,10 +426,10 @@ void BLF_size(int fontid, int size, int dpi)
void BLF_blur(int fontid, int size)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
- font->blur= size;
+ font->blur = size;
}
}
@@ -439,7 +439,7 @@ void BLF_draw_default(float x, float y, float z, const char *str, size_t len)
return;
if (global_font_default == -1)
- global_font_default= blf_search("default");
+ global_font_default = blf_search("default");
if (global_font_default == -1) {
printf("Warning: Can't found default font!!\n");
@@ -458,7 +458,7 @@ void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t l
return;
if (global_font_default == -1)
- global_font_default= blf_search("default");
+ global_font_default = blf_search("default");
if (global_font_default == -1) {
printf("Warning: Can't found default font!!\n");
@@ -472,10 +472,10 @@ void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t l
void BLF_rotation_default(float angle)
{
- FontBLF *font= BLF_get(global_font_default);
+ FontBLF *font = BLF_get(global_font_default);
if (font) {
- font->angle= angle;
+ font->angle = angle;
}
}
@@ -511,11 +511,11 @@ static void blf_draw__start(FontBLF *font, GLint *mode, GLint *param)
if (font->flags & BLF_ROTATION)
glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
- if(font->shadow || font->blur)
+ if (font->shadow || font->blur)
glGetFloatv(GL_CURRENT_COLOR, font->orig_col);
/* always bind the texture for the first glyph */
- font->tex_bind_state= -1;
+ font->tex_bind_state = -1;
/* Save the current parameter to restore it later. */
glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, param);
@@ -544,7 +544,7 @@ static void blf_draw__end(GLint mode, GLint param)
void BLF_draw(int fontid, const char *str, size_t len)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
GLint mode, param;
if (font && font->glyph_cache) {
@@ -556,7 +556,7 @@ void BLF_draw(int fontid, const char *str, size_t len)
void BLF_draw_ascii(int fontid, const char *str, size_t len)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
GLint mode, param;
if (font && font->glyph_cache) {
@@ -568,7 +568,7 @@ void BLF_draw_ascii(int fontid, const char *str, size_t len)
void BLF_boundbox(int fontid, const char *str, rctf *box)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
blf_font_boundbox(font, str, box);
@@ -577,7 +577,7 @@ void BLF_boundbox(int fontid, const char *str, rctf *box)
void BLF_width_and_height(int fontid, const char *str, float *width, float *height)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font && font->glyph_cache) {
blf_font_width_and_height(font, str, width, height);
@@ -586,7 +586,7 @@ void BLF_width_and_height(int fontid, const char *str, float *width, float *heig
float BLF_width(int fontid, const char *str)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font && font->glyph_cache) {
return blf_font_width(font, str);
@@ -597,7 +597,7 @@ float BLF_width(int fontid, const char *str)
float BLF_fixed_width(int fontid)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font && font->glyph_cache) {
return blf_font_fixed_width(font);
@@ -609,7 +609,7 @@ float BLF_fixed_width(int fontid)
float BLF_width_default(const char *str)
{
if (global_font_default == -1)
- global_font_default= blf_search("default");
+ global_font_default = blf_search("default");
if (global_font_default == -1) {
printf("Error: Can't found default font!!\n");
@@ -622,7 +622,7 @@ float BLF_width_default(const char *str)
float BLF_height(int fontid, const char *str)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font && font->glyph_cache) {
return blf_font_height(font, str);
@@ -633,7 +633,7 @@ float BLF_height(int fontid, const char *str)
float BLF_height_max(int fontid)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font && font->glyph_cache) {
return font->glyph_cache->max_glyph_height;
@@ -644,7 +644,7 @@ float BLF_height_max(int fontid)
float BLF_width_max(int fontid)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font && font->glyph_cache) {
return font->glyph_cache->max_glyph_width;
@@ -655,7 +655,7 @@ float BLF_width_max(int fontid)
float BLF_descender(int fontid)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font && font->glyph_cache) {
return font->glyph_cache->descender;
@@ -666,7 +666,7 @@ float BLF_descender(int fontid)
float BLF_ascender(int fontid)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font && font->glyph_cache) {
return font->glyph_cache->ascender;
@@ -678,7 +678,7 @@ float BLF_ascender(int fontid)
float BLF_height_default(const char *str)
{
if (global_font_default == -1)
- global_font_default= blf_search("default");
+ global_font_default = blf_search("default");
if (global_font_default == -1) {
printf("Error: Can't found default font!!\n");
@@ -692,88 +692,88 @@ float BLF_height_default(const char *str)
void BLF_rotation(int fontid, float angle)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
- font->angle= angle;
+ font->angle = angle;
}
}
void BLF_clipping(int fontid, float xmin, float ymin, float xmax, float ymax)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
- font->clip_rec.xmin= xmin;
- font->clip_rec.ymin= ymin;
- font->clip_rec.xmax= xmax;
- font->clip_rec.ymax= ymax;
+ font->clip_rec.xmin = xmin;
+ font->clip_rec.ymin = ymin;
+ font->clip_rec.xmax = xmax;
+ font->clip_rec.ymax = ymax;
}
}
void BLF_clipping_default(float xmin, float ymin, float xmax, float ymax)
{
- FontBLF *font= BLF_get(global_font_default);
+ FontBLF *font = BLF_get(global_font_default);
if (font) {
- font->clip_rec.xmin= xmin;
- font->clip_rec.ymin= ymin;
- font->clip_rec.xmax= xmax;
- font->clip_rec.ymax= ymax;
+ font->clip_rec.xmin = xmin;
+ font->clip_rec.ymin = ymin;
+ font->clip_rec.xmax = xmax;
+ font->clip_rec.ymax = ymax;
}
}
void BLF_shadow(int fontid, int level, float r, float g, float b, float a)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
- font->shadow= level;
- font->shadow_col[0]= r;
- font->shadow_col[1]= g;
- font->shadow_col[2]= b;
- font->shadow_col[3]= a;
+ font->shadow = level;
+ font->shadow_col[0] = r;
+ font->shadow_col[1] = g;
+ font->shadow_col[2] = b;
+ font->shadow_col[3] = a;
}
}
void BLF_shadow_offset(int fontid, int x, int y)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
- font->shadow_x= x;
- font->shadow_y= y;
+ font->shadow_x = x;
+ font->shadow_y = y;
}
}
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
- font->b_fbuf= fbuf;
- font->b_cbuf= cbuf;
- font->bw= w;
- font->bh= h;
- font->bch= nch;
+ font->b_fbuf = fbuf;
+ font->b_cbuf = cbuf;
+ font->bw = w;
+ font->bh = h;
+ font->bch = nch;
}
}
void BLF_buffer_col(int fontid, float r, float g, float b, float a)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font) {
- font->b_col[0]= r;
- font->b_col[1]= g;
- font->b_col[2]= b;
- font->b_col[3]= a;
+ font->b_col[0] = r;
+ font->b_col[1] = g;
+ font->b_col[2] = b;
+ font->b_col[3] = a;
}
}
void BLF_draw_buffer(int fontid, const char *str)
{
- FontBLF *font= BLF_get(fontid);
+ FontBLF *font = BLF_get(fontid);
if (font && font->glyph_cache && (font->b_fbuf || font->b_cbuf)) {
blf_font_buffer(font, str);
diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c
index b82393fad92..824f1715f3c 100644
--- a/source/blender/blenfont/intern/blf_dir.c
+++ b/source/blender/blenfont/intern/blf_dir.c
@@ -51,17 +51,17 @@
#include "blf_internal_types.h"
#include "blf_internal.h"
-static ListBase global_font_dir= { NULL, NULL };
+static ListBase global_font_dir = { NULL, NULL };
static DirBLF *blf_dir_find(const char *path)
{
DirBLF *p;
- p= global_font_dir.first;
+ p = global_font_dir.first;
while (p) {
if (BLI_path_cmp(p->path, path) == 0)
return p;
- p= p->next;
+ p = p->next;
}
return NULL;
}
@@ -70,12 +70,12 @@ void BLF_dir_add(const char *path)
{
DirBLF *dir;
- dir= blf_dir_find(path);
+ dir = blf_dir_find(path);
if (dir) /* already in the list ? just return. */
return;
- dir= (DirBLF *)MEM_callocN(sizeof(DirBLF), "BLF_dir_add");
- dir->path= BLI_strdup(path);
+ dir = (DirBLF *)MEM_callocN(sizeof(DirBLF), "BLF_dir_add");
+ dir->path = BLI_strdup(path);
BLI_addhead(&global_font_dir, dir);
}
@@ -83,7 +83,7 @@ void BLF_dir_rem(const char *path)
{
DirBLF *dir;
- dir= blf_dir_find(path);
+ dir = blf_dir_find(path);
if (dir) {
BLI_remlink(&global_font_dir, dir);
MEM_freeN(dir->path);
@@ -98,19 +98,19 @@ char **BLF_dir_get(int *ndir)
char *path;
int i, count;
- count= BLI_countlist(&global_font_dir);
+ count = BLI_countlist(&global_font_dir);
if (!count)
return NULL;
- dirs= (char **)MEM_callocN(sizeof(char *) * count, "BLF_dir_get");
- p= global_font_dir.first;
- i= 0;
+ dirs = (char **)MEM_callocN(sizeof(char *) * count, "BLF_dir_get");
+ p = global_font_dir.first;
+ i = 0;
while (p) {
- path= BLI_strdup(p->path);
- dirs[i]= path;
- p= p->next;
+ path = BLI_strdup(p->path);
+ dirs[i] = path;
+ p = p->next;
}
- *ndir= i;
+ *ndir = i;
return dirs;
}
@@ -119,8 +119,8 @@ void BLF_dir_free(char **dirs, int count)
char *path;
int i;
- for (i= 0; i < count; i++) {
- path= dirs[i];
+ for (i = 0; i < count; i++) {
+ path = dirs[i];
MEM_freeN(path);
}
MEM_freeN(dirs);
@@ -130,12 +130,12 @@ char *blf_dir_search(const char *file)
{
DirBLF *dir;
char full_path[FILE_MAX];
- char *s= NULL;
+ char *s = NULL;
- for(dir=global_font_dir.first; dir; dir= dir->next) {
+ for (dir = global_font_dir.first; dir; dir = dir->next) {
BLI_join_dirfile(full_path, sizeof(full_path), dir->path, file);
if (BLI_exists(full_path)) {
- s= BLI_strdup(full_path);
+ s = BLI_strdup(full_path);
break;
}
}
@@ -143,32 +143,32 @@ char *blf_dir_search(const char *file)
if (!s) {
/* check the current directory, why not ? */
if (BLI_exists(file))
- s= BLI_strdup(file);
+ s = BLI_strdup(file);
}
return s;
}
-#if 0 // UNUSED
+#if 0 /* UNUSED */
int blf_dir_split(const char *str, char *file, int *size)
{
int i, len;
char *s;
/* Window, Linux or Mac, this is always / */
- s= strrchr(str, '/');
+ s = strrchr(str, '/');
if (s) {
- len= s - str;
- for (i= 0; i < len; i++)
- file[i]= str[i];
-
- file[i]= '.';
- file[i+1]= 't';
- file[i+2]= 't';
- file[i+3]= 'f';
- file[i+4]= '\0';
+ len = s - str;
+ for (i = 0; i < len; i++)
+ file[i] = str[i];
+
+ file[i] = '.';
+ file[i+1] = 't';
+ file[i+2] = 't';
+ file[i+3] = 'f';
+ file[i+4] = '\0';
s++;
- *size= atoi(s);
+ *size = atoi(s);
return 1;
}
return 0;
@@ -183,24 +183,24 @@ char *blf_dir_metrics_search(const char *filename)
char *mfile;
char *s;
- mfile= BLI_strdup(filename);
- s= strrchr(mfile, '.');
+ mfile = BLI_strdup(filename);
+ s = strrchr(mfile, '.');
if (s) {
if (BLI_strnlen(s, 4) < 4) {
MEM_freeN(mfile);
return NULL;
}
s++;
- s[0]= 'a';
- s[1]= 'f';
- s[2]= 'm';
+ s[0] = 'a';
+ s[1] = 'f';
+ s[2] = 'm';
/* first check .afm */
if (BLI_exists(s))
return s;
/* and now check .pfm */
- s[0]= 'p';
+ s[0] = 'p';
if (BLI_exists(s))
return s;
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 7ec7e2357dd..84cefc923a0 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -73,43 +73,43 @@ void blf_font_size(FontBLF *font, int size, int dpi)
GlyphCacheBLF *gc;
FT_Error err;
- err= FT_Set_Char_Size(font->face, 0, (size * 64), dpi, dpi);
+ err = FT_Set_Char_Size(font->face, 0, (size * 64), dpi, dpi);
if (err) {
/* FIXME: here we can go through the fixed size and choice a close one */
printf("The current font don't support the size, %d and dpi, %d\n", size, dpi);
return;
}
- font->size= size;
- font->dpi= dpi;
+ font->size = size;
+ font->dpi = dpi;
- gc= blf_glyph_cache_find(font, size, dpi);
+ gc = blf_glyph_cache_find(font, size, dpi);
if (gc)
- font->glyph_cache= gc;
+ font->glyph_cache = gc;
else {
- gc= blf_glyph_cache_new(font);
+ gc = blf_glyph_cache_new(font);
if (gc)
- font->glyph_cache= gc;
+ font->glyph_cache = gc;
else
- font->glyph_cache= NULL;
+ font->glyph_cache = NULL;
}
}
static void blf_font_ensure_ascii_table(FontBLF *font)
{
- GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+ GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
/* build ascii on demand */
- if(glyph_ascii_table['0']==NULL) {
+ if (glyph_ascii_table['0'] == NULL) {
GlyphBLF *g;
unsigned int i;
- for(i=0; i<256; i++) {
- g= blf_glyph_search(font->glyph_cache, i);
+ for (i = 0; i<256; i++) {
+ g = blf_glyph_search(font->glyph_cache, i);
if (!g) {
- FT_UInt glyph_index= FT_Get_Char_Index(font->face, i);
- g= blf_glyph_add(font, glyph_index, i);
+ FT_UInt glyph_index = FT_Get_Char_Index(font->face, i);
+ g = blf_glyph_add(font, glyph_index, i);
}
- glyph_ascii_table[i]= g;
+ glyph_ascii_table[i] = g;
}
}
}
@@ -122,67 +122,69 @@ static void blf_font_ensure_ascii_table(FontBLF *font)
/* Note,
* blf_font_ensure_ascii_table(font); must be called before this macro */
-#define BLF_UTF8_NEXT_FAST(_font, _g, _str, _i, _c, _glyph_ascii_table) \
- if(((_c)= (_str)[_i]) < 0x80) { \
- _g= (_glyph_ascii_table)[_c]; \
- _i++; \
- } \
- else if ((_c= BLI_str_utf8_as_unicode_step(_str, &(_i)))!=BLI_UTF8_ERR) { \
- if ((_g= blf_glyph_search((_font)->glyph_cache, _c)) == NULL) { \
- _g= blf_glyph_add(_font, \
- FT_Get_Char_Index((_font)->face, _c), _c); \
- } \
- } \
-
-
-#define BLF_KERNING_VARS(_font, _has_kerning, _kern_mode) \
- const short _has_kerning= FT_HAS_KERNING((_font)->face); \
- const FT_UInt _kern_mode= (_has_kerning == 0) ? 0 : \
- (((_font)->flags & BLF_KERNING_DEFAULT) ? \
- ft_kerning_default : FT_KERNING_UNFITTED) \
-
-
-#define BLF_KERNING_STEP(_font, _kern_mode, _g_prev, _g, _delta, _pen_x) \
-{ \
- if (_g_prev) { \
- _delta.x= _delta.y= 0; \
- if (FT_Get_Kerning((_font)->face, \
- (_g_prev)->idx, \
- (_g)->idx, \
- _kern_mode, \
- &(_delta)) == 0) \
- { \
- _pen_x += delta.x >> 6; \
- } \
- } \
-} \
+#define BLF_UTF8_NEXT_FAST(_font, _g, _str, _i, _c, _glyph_ascii_table) \
+ if (((_c) = (_str)[_i]) < 0x80) { \
+ _g = (_glyph_ascii_table)[_c]; \
+ _i++; \
+ } \
+ else if ((_c = BLI_str_utf8_as_unicode_step(_str, &(_i))) != BLI_UTF8_ERR) { \
+ if ((_g = blf_glyph_search((_font)->glyph_cache, _c)) == NULL) { \
+ _g = blf_glyph_add(_font, \
+ FT_Get_Char_Index((_font)->face, _c), _c); \
+ } \
+ } \
+
+
+#define BLF_KERNING_VARS(_font, _has_kerning, _kern_mode) \
+ const short _has_kerning = FT_HAS_KERNING((_font)->face); \
+ const FT_UInt _kern_mode = (_has_kerning == 0) ? 0 : \
+ (((_font)->flags & BLF_KERNING_DEFAULT) ? \
+ ft_kerning_default : FT_KERNING_UNFITTED) \
+
+
+#define BLF_KERNING_STEP(_font, _kern_mode, _g_prev, _g, _delta, _pen_x) \
+{ \
+ if (_g_prev) { \
+ _delta.x = _delta.y = 0; \
+ if (FT_Get_Kerning((_font)->face, \
+ (_g_prev)->idx, \
+ (_g)->idx, \
+ _kern_mode, \
+ &(_delta)) == 0) \
+ { \
+ _pen_x += delta.x >> 6; \
+ } \
+ } \
+} \
void blf_font_draw(FontBLF *font, const char *str, unsigned int len)
{
unsigned int c;
- GlyphBLF *g, *g_prev= NULL;
+ GlyphBLF *g, *g_prev = NULL;
FT_Vector delta;
- int pen_x= 0, pen_y= 0;
- size_t i= 0;
- GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+ int pen_x = 0, pen_y = 0;
+ size_t i = 0;
+ GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
BLF_KERNING_VARS(font, has_kerning, kern_mode);
blf_font_ensure_ascii_table(font);
while (str[i] && i < len) {
-
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
- if (c == BLI_UTF8_ERR) break;
- if (g == NULL) continue;
- if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
+ if (c == BLI_UTF8_ERR)
+ break;
+ if (g == NULL)
+ continue;
+ if (has_kerning)
+ BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
/* do not return this loop if clipped, we want every character tested */
blf_glyph_render(font, g, (float)pen_x, (float)pen_y);
pen_x += g->advance;
- g_prev= g;
+ g_prev = g;
}
}
@@ -190,24 +192,26 @@ void blf_font_draw(FontBLF *font, const char *str, unsigned int len)
void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len)
{
unsigned char c;
- GlyphBLF *g, *g_prev= NULL;
+ GlyphBLF *g, *g_prev = NULL;
FT_Vector delta;
- int pen_x= 0, pen_y= 0;
- GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+ int pen_x = 0, pen_y = 0;
+ GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
BLF_KERNING_VARS(font, has_kerning, kern_mode);
blf_font_ensure_ascii_table(font);
- while ((c= *(str++)) && len--) {
- if ((g= glyph_ascii_table[c]) == NULL) continue;
- if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
+ while ((c = *(str++)) && len--) {
+ if ((g = glyph_ascii_table[c]) == NULL)
+ continue;
+ if (has_kerning)
+ BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
/* do not return this loop if clipped, we want every character tested */
blf_glyph_render(font, g, (float)pen_x, (float)pen_y);
pen_x += g->advance;
- g_prev= g;
+ g_prev = g;
}
}
@@ -215,17 +219,17 @@ void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len)
void blf_font_buffer(FontBLF *font, const char *str)
{
unsigned int c;
- GlyphBLF *g, *g_prev= NULL;
+ GlyphBLF *g, *g_prev = NULL;
FT_Vector delta;
- int pen_x= (int)font->pos[0], pen_y= 0;
- size_t i= 0;
- GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+ int pen_x = (int)font->pos[0], pen_y = 0;
+ size_t i = 0;
+ GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
/* buffer specific vars*/
- const unsigned char b_col_char[4]= {font->b_col[0] * 255,
- font->b_col[1] * 255,
- font->b_col[2] * 255,
- font->b_col[3] * 255};
+ const unsigned char b_col_char[4] = {font->b_col[0] * 255,
+ font->b_col[1] * 255,
+ font->b_col[2] * 255,
+ font->b_col[3] * 255};
unsigned char *cbuf;
int chx, chy;
int y, x;
@@ -236,15 +240,17 @@ void blf_font_buffer(FontBLF *font, const char *str)
blf_font_ensure_ascii_table(font);
while (str[i]) {
-
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
- if (c == BLI_UTF8_ERR) break;
- if (g == NULL) continue;
- if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
+ if (c == BLI_UTF8_ERR)
+ break;
+ if (g == NULL)
+ continue;
+ if (has_kerning)
+ BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
- chx= pen_x + ((int)g->pos_x);
- chy= (int)font->pos[1] + g->height;
+ chx = pen_x + ((int)g->pos_x);
+ chy = (int)font->pos[1] + g->height;
if (g->pitch < 0) {
pen_y = (int)font->pos[1] + (g->height - (int)g->pos_y);
@@ -254,42 +260,43 @@ void blf_font_buffer(FontBLF *font, const char *str)
}
if ((chx + g->width) >= 0 && chx < font->bw && (pen_y + g->height) >= 0 && pen_y < font->bh) {
- /* dont draw beyond the buffer bounds */
- int width_clip= g->width;
- int height_clip= g->height;
- int yb_start= g->pitch < 0 ? 0 : g->height-1;
-
- if (width_clip + chx > font->bw) width_clip -= chx + width_clip - font->bw;
- if (height_clip + pen_y > font->bh) height_clip -= pen_y + height_clip - font->bh;
+ /* don't draw beyond the buffer bounds */
+ int width_clip = g->width;
+ int height_clip = g->height;
+ int yb_start = g->pitch < 0 ? 0 : g->height-1;
+
+ if (width_clip + chx > font->bw)
+ width_clip -= chx + width_clip - font->bw;
+ if (height_clip + pen_y > font->bh)
+ height_clip -= pen_y + height_clip - font->bh;
/* drawing below the image? */
- if(pen_y < 0) {
+ if (pen_y < 0) {
yb_start += (g->pitch < 0) ? -pen_y : pen_y;
height_clip += pen_y;
- pen_y= 0;
+ pen_y = 0;
}
if (font->b_fbuf) {
- int yb= yb_start;
- for (y=(chy >= 0 ? 0:-chy); y < height_clip; y++) {
- for (x=(chx >= 0 ? 0:-chx); x < width_clip; x++) {
-
- a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
+ int yb = yb_start;
+ for (y = (chy >= 0 ? 0:-chy); y < height_clip; y++) {
+ for (x = (chx >= 0 ? 0:-chx); x < width_clip; x++) {
+ a = *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
- if(a > 0.0f) {
+ if (a > 0.0f) {
float alphatest;
- fbuf= font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
+ fbuf = font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
if (a >= 1.0f) {
- fbuf[0]= font->b_col[0];
- fbuf[1]= font->b_col[1];
- fbuf[2]= font->b_col[2];
- fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]))) < 1.0f ? alphatest : 1.0f;
+ fbuf[0] = font->b_col[0];
+ fbuf[1] = font->b_col[1];
+ fbuf[2] = font->b_col[2];
+ fbuf[3] = (alphatest = (fbuf[3] + (font->b_col[3]))) < 1.0f ? alphatest : 1.0f;
}
else {
- fbuf[0]= (font->b_col[0]*a) + (fbuf[0] * (1-a));
- fbuf[1]= (font->b_col[1]*a) + (fbuf[1] * (1-a));
- fbuf[2]= (font->b_col[2]*a) + (fbuf[2] * (1-a));
- fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]*a))) < 1.0f ? alphatest : 1.0f;
+ fbuf[0] = (font->b_col[0]*a) + (fbuf[0] * (1-a));
+ fbuf[1] = (font->b_col[1]*a) + (fbuf[1] * (1-a));
+ fbuf[2] = (font->b_col[2]*a) + (fbuf[2] * (1-a));
+ fbuf[3] = (alphatest = (fbuf[3] + (font->b_col[3]*a))) < 1.0f ? alphatest : 1.0f;
}
}
}
@@ -302,25 +309,26 @@ void blf_font_buffer(FontBLF *font, const char *str)
}
if (font->b_cbuf) {
- int yb= yb_start;
- for (y= 0; y < height_clip; y++) {
- for (x= 0; x < width_clip; x++) {
- a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
+ int yb = yb_start;
+ for (y = 0; y < height_clip; y++) {
+ for (x = 0; x < width_clip; x++) {
+ a = *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
- if(a > 0.0f) {
+ if (a > 0.0f) {
int alphatest;
- cbuf= font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
+ cbuf = font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
if (a >= 1.0f) {
- cbuf[0]= b_col_char[0];
- cbuf[1]= b_col_char[1];
- cbuf[2]= b_col_char[2];
- cbuf[3]= (alphatest= ((int)cbuf[3] + (int)b_col_char[3])) < 255 ? alphatest : 255;
+ cbuf[0] = b_col_char[0];
+ cbuf[1] = b_col_char[1];
+ cbuf[2] = b_col_char[2];
+ cbuf[3] = (alphatest = ((int)cbuf[3] + (int)b_col_char[3])) < 255 ? alphatest : 255;
}
else {
- cbuf[0]= (b_col_char[0]*a) + (cbuf[0] * (1-a));
- cbuf[1]= (b_col_char[1]*a) + (cbuf[1] * (1-a));
- cbuf[2]= (b_col_char[2]*a) + (cbuf[2] * (1-a));
- cbuf[3]= (alphatest= ((int)cbuf[3] + (int)((font->b_col[3]*a)*255.0f))) < 255 ? alphatest : 255;
+ cbuf[0] = (b_col_char[0]*a) + (cbuf[0] * (1-a));
+ cbuf[1] = (b_col_char[1]*a) + (cbuf[1] * (1-a));
+ cbuf[2] = (b_col_char[2]*a) + (cbuf[2] * (1-a));
+ cbuf[3] = (alphatest = ((int)cbuf[3] + (int)((font->b_col[3]*a)*255.0f))) <
+ 255 ? alphatest : 255;
}
}
}
@@ -334,58 +342,60 @@ void blf_font_buffer(FontBLF *font, const char *str)
}
pen_x += g->advance;
- g_prev= g;
+ g_prev = g;
}
}
void blf_font_boundbox(FontBLF *font, const char *str, rctf *box)
{
unsigned int c;
- GlyphBLF *g, *g_prev= NULL;
+ GlyphBLF *g, *g_prev = NULL;
FT_Vector delta;
- int pen_x= 0, pen_y= 0;
- size_t i= 0;
- GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+ int pen_x = 0, pen_y = 0;
+ size_t i = 0;
+ GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
rctf gbox;
BLF_KERNING_VARS(font, has_kerning, kern_mode);
- box->xmin= 32000.0f;
- box->xmax= -32000.0f;
- box->ymin= 32000.0f;
- box->ymax= -32000.0f;
+ box->xmin = 32000.0f;
+ box->xmax = -32000.0f;
+ box->ymin = 32000.0f;
+ box->ymax = -32000.0f;
blf_font_ensure_ascii_table(font);
while (str[i]) {
-
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
- if (c == BLI_UTF8_ERR) break;
- if (g == NULL) continue;
- if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
+ if (c == BLI_UTF8_ERR)
+ break;
+ if (g == NULL)
+ continue;
+ if (has_kerning)
+ BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
- gbox.xmin= pen_x;
- gbox.xmax= pen_x + g->advance;
- gbox.ymin= g->box.ymin + pen_y;
- gbox.ymax= g->box.ymax + pen_y;
+ gbox.xmin = pen_x;
+ gbox.xmax = pen_x + g->advance;
+ gbox.ymin = g->box.ymin + pen_y;
+ gbox.ymax = g->box.ymax + pen_y;
- if (gbox.xmin < box->xmin) box->xmin= gbox.xmin;
- if (gbox.ymin < box->ymin) box->ymin= gbox.ymin;
+ if (gbox.xmin < box->xmin) box->xmin = gbox.xmin;
+ if (gbox.ymin < box->ymin) box->ymin = gbox.ymin;
- if (gbox.xmax > box->xmax) box->xmax= gbox.xmax;
- if (gbox.ymax > box->ymax) box->ymax= gbox.ymax;
+ if (gbox.xmax > box->xmax) box->xmax = gbox.xmax;
+ if (gbox.ymax > box->ymax) box->ymax = gbox.ymax;
pen_x += g->advance;
- g_prev= g;
+ g_prev = g;
}
if (box->xmin > box->xmax) {
- box->xmin= 0.0f;
- box->ymin= 0.0f;
- box->xmax= 0.0f;
- box->ymax= 0.0f;
+ box->xmin = 0.0f;
+ box->ymin = 0.0f;
+ box->xmax = 0.0f;
+ box->ymax = 0.0f;
}
}
@@ -395,17 +405,17 @@ void blf_font_width_and_height(FontBLF *font, const char *str, float *width, flo
rctf box;
if (font->flags & BLF_ASPECT) {
- xa= font->aspect[0];
- ya= font->aspect[1];
+ xa = font->aspect[0];
+ ya = font->aspect[1];
}
else {
- xa= 1.0f;
- ya= 1.0f;
+ xa = 1.0f;
+ ya = 1.0f;
}
blf_font_boundbox(font, str, &box);
- *width= ((box.xmax - box.xmin) * xa);
- *height= ((box.ymax - box.ymin) * ya);
+ *width = ((box.xmax - box.xmin) * xa);
+ *height = ((box.ymax - box.ymin) * ya);
}
float blf_font_width(FontBLF *font, const char *str)
@@ -414,9 +424,9 @@ float blf_font_width(FontBLF *font, const char *str)
rctf box;
if (font->flags & BLF_ASPECT)
- xa= font->aspect[0];
+ xa = font->aspect[0];
else
- xa= 1.0f;
+ xa = 1.0f;
blf_font_boundbox(font, str, &box);
return (box.xmax - box.xmin) * xa;
@@ -428,9 +438,9 @@ float blf_font_height(FontBLF *font, const char *str)
rctf box;
if (font->flags & BLF_ASPECT)
- ya= font->aspect[1];
+ ya = font->aspect[1];
else
- ya= 1.0f;
+ ya = 1.0f;
blf_font_boundbox(font, str, &box);
return (box.ymax - box.ymin) * ya;
@@ -439,9 +449,9 @@ float blf_font_height(FontBLF *font, const char *str)
float blf_font_fixed_width(FontBLF *font)
{
const unsigned int c = ' ';
- GlyphBLF *g= blf_glyph_search(font->glyph_cache, c);
+ GlyphBLF *g = blf_glyph_search(font->glyph_cache, c);
if (!g) {
- g= blf_glyph_add(font, FT_Get_Char_Index(font->face, c), c);
+ g = blf_glyph_add(font, FT_Get_Char_Index(font->face, c), c);
/* if we don't find the glyph. */
if (!g) {
@@ -456,9 +466,9 @@ void blf_font_free(FontBLF *font)
{
GlyphCacheBLF *gc;
- font->glyph_cache= NULL;
+ font->glyph_cache = NULL;
while (font->cache.first) {
- gc= font->cache.first;
+ gc = font->cache.first;
BLI_remlink(&font->cache, gc);
blf_glyph_cache_free(gc);
}
@@ -475,38 +485,38 @@ static void blf_font_fill(FontBLF *font)
{
unsigned int i;
- font->aspect[0]= 1.0f;
- font->aspect[1]= 1.0f;
- font->aspect[2]= 1.0f;
- font->pos[0]= 0.0f;
- font->pos[1]= 0.0f;
- font->angle= 0.0f;
-
- for (i= 0; i < 16; i++)
- font->m[i]= 0;
-
- font->clip_rec.xmin= 0.0f;
- font->clip_rec.xmax= 0.0f;
- font->clip_rec.ymin= 0.0f;
- font->clip_rec.ymax= 0.0f;
- font->flags= 0;
- font->dpi= 0;
- font->size= 0;
- font->cache.first= NULL;
- font->cache.last= NULL;
- font->glyph_cache= NULL;
- font->blur= 0;
- font->max_tex_size= -1;
- font->b_fbuf= NULL;
- font->b_cbuf= NULL;
- font->bw= 0;
- font->bh= 0;
- font->bch= 0;
- font->b_col[0]= 0;
- font->b_col[1]= 0;
- font->b_col[2]= 0;
- font->b_col[3]= 0;
- font->ft_lib= ft_lib;
+ font->aspect[0] = 1.0f;
+ font->aspect[1] = 1.0f;
+ font->aspect[2] = 1.0f;
+ font->pos[0] = 0.0f;
+ font->pos[1] = 0.0f;
+ font->angle = 0.0f;
+
+ for (i = 0; i < 16; i++)
+ font->m[i] = 0;
+
+ font->clip_rec.xmin = 0.0f;
+ font->clip_rec.xmax = 0.0f;
+ font->clip_rec.ymin = 0.0f;
+ font->clip_rec.ymax = 0.0f;
+ font->flags = 0;
+ font->dpi = 0;
+ font->size = 0;
+ font->cache.first = NULL;
+ font->cache.last = NULL;
+ font->glyph_cache = NULL;
+ font->blur = 0;
+ font->max_tex_size = -1;
+ font->b_fbuf = NULL;
+ font->b_cbuf = NULL;
+ font->bw = 0;
+ font->bh = 0;
+ font->bch = 0;
+ font->b_col[0] = 0;
+ font->b_col[1] = 0;
+ font->b_col[2] = 0;
+ font->b_col[3] = 0;
+ font->ft_lib = ft_lib;
}
FontBLF *blf_font_new(const char *name, const char *filename)
@@ -515,14 +525,14 @@ FontBLF *blf_font_new(const char *name, const char *filename)
FT_Error err;
char *mfile;
- font= (FontBLF *)MEM_callocN(sizeof(FontBLF), "blf_font_new");
- err= FT_New_Face(ft_lib, filename, 0, &font->face);
+ font = (FontBLF *)MEM_callocN(sizeof(FontBLF), "blf_font_new");
+ err = FT_New_Face(ft_lib, filename, 0, &font->face);
if (err) {
MEM_freeN(font);
return NULL;
}
- err= FT_Select_Charmap(font->face, ft_encoding_unicode);
+ err = FT_Select_Charmap(font->face, ft_encoding_unicode);
if (err) {
printf("Can't set the unicode character map!\n");
FT_Done_Face(font->face);
@@ -530,17 +540,17 @@ FontBLF *blf_font_new(const char *name, const char *filename)
return NULL;
}
- mfile= blf_dir_metrics_search(filename);
+ mfile = blf_dir_metrics_search(filename);
if (mfile) {
- err= FT_Attach_File(font->face, mfile);
- if(err) {
+ err = FT_Attach_File(font->face, mfile);
+ if (err) {
fprintf(stderr, "FT_Attach_File failed to load '%s' with error %d\n", filename, (int)err);
}
MEM_freeN(mfile);
}
- font->name= BLI_strdup(name);
- font->filename= BLI_strdup(filename);
+ font->name = BLI_strdup(name);
+ font->filename = BLI_strdup(filename);
blf_font_fill(font);
return font;
}
@@ -549,9 +559,9 @@ void blf_font_attach_from_mem(FontBLF *font, const unsigned char *mem, int mem_s
{
FT_Open_Args open;
- open.flags= FT_OPEN_MEMORY;
- open.memory_base= (FT_Byte *)mem;
- open.memory_size= mem_size;
+ open.flags = FT_OPEN_MEMORY;
+ open.memory_base = (FT_Byte *)mem;
+ open.memory_size = mem_size;
FT_Attach_Stream(font->face, &open);
}
@@ -560,14 +570,14 @@ FontBLF *blf_font_new_from_mem(const char *name, unsigned char *mem, int mem_siz
FontBLF *font;
FT_Error err;
- font= (FontBLF *)MEM_callocN(sizeof(FontBLF), "blf_font_new_from_mem");
- err= FT_New_Memory_Face(ft_lib, mem, mem_size, 0, &font->face);
+ font = (FontBLF *)MEM_callocN(sizeof(FontBLF), "blf_font_new_from_mem");
+ err = FT_New_Memory_Face(ft_lib, mem, mem_size, 0, &font->face);
if (err) {
MEM_freeN(font);
return NULL;
}
- err= FT_Select_Charmap(font->face, ft_encoding_unicode);
+ err = FT_Select_Charmap(font->face, ft_encoding_unicode);
if (err) {
printf("Can't set the unicode character map!\n");
FT_Done_Face(font->face);
@@ -575,8 +585,8 @@ FontBLF *blf_font_new_from_mem(const char *name, unsigned char *mem, int mem_siz
return NULL;
}
- font->name= BLI_strdup(name);
- font->filename= NULL;
+ font->name = BLI_strdup(name);
+ font->filename = NULL;
blf_font_fill(font);
return font;
}
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index f0cfcdc97b9..033efbfc1fc 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -59,11 +59,11 @@ GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi)
{
GlyphCacheBLF *p;
- p= (GlyphCacheBLF *)font->cache.first;
+ p = (GlyphCacheBLF *)font->cache.first;
while (p) {
if (p->size == size && p->dpi == dpi)
return p;
- p= p->next;
+ p = p->next;
}
return NULL;
}
@@ -73,43 +73,43 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
{
GlyphCacheBLF *gc;
- gc= (GlyphCacheBLF *)MEM_callocN(sizeof(GlyphCacheBLF), "blf_glyph_cache_new");
- gc->next= NULL;
- gc->prev= NULL;
- gc->size= font->size;
- gc->dpi= font->dpi;
+ gc = (GlyphCacheBLF *)MEM_callocN(sizeof(GlyphCacheBLF), "blf_glyph_cache_new");
+ gc->next = NULL;
+ gc->prev = NULL;
+ gc->size = font->size;
+ gc->dpi = font->dpi;
memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table));
memset(gc->bucket, 0, sizeof(gc->bucket));
- gc->textures= (GLuint *)malloc(sizeof(GLuint)*256);
- gc->ntex= 256;
- gc->cur_tex= -1;
- gc->x_offs= 0;
- gc->y_offs= 0;
- gc->pad= 3;
+ gc->textures = (GLuint *)malloc(sizeof(GLuint)*256);
+ gc->ntex = 256;
+ gc->cur_tex = -1;
+ gc->x_offs = 0;
+ gc->y_offs = 0;
+ gc->pad = 3;
- gc->num_glyphs= font->face->num_glyphs;
- gc->rem_glyphs= font->face->num_glyphs;
- gc->ascender= ((float)font->face->size->metrics.ascender) / 64.0f;
- gc->descender= ((float)font->face->size->metrics.descender) / 64.0f;
+ gc->num_glyphs = font->face->num_glyphs;
+ gc->rem_glyphs = font->face->num_glyphs;
+ gc->ascender = ((float)font->face->size->metrics.ascender) / 64.0f;
+ gc->descender = ((float)font->face->size->metrics.descender) / 64.0f;
if (FT_IS_SCALABLE(font->face)) {
- gc->max_glyph_width= (float)((font->face->bbox.xMax - font->face->bbox.xMin) *
- (((float)font->face->size->metrics.x_ppem) /
- ((float)font->face->units_per_EM)));
+ gc->max_glyph_width = (float)((font->face->bbox.xMax - font->face->bbox.xMin) *
+ (((float)font->face->size->metrics.x_ppem) /
+ ((float)font->face->units_per_EM)));
- gc->max_glyph_height= (float)((font->face->bbox.yMax - font->face->bbox.yMin) *
- (((float)font->face->size->metrics.y_ppem) /
- ((float)font->face->units_per_EM)));
+ gc->max_glyph_height = (float)((font->face->bbox.yMax - font->face->bbox.yMin) *
+ (((float)font->face->size->metrics.y_ppem) /
+ ((float)font->face->units_per_EM)));
}
else {
- gc->max_glyph_width= ((float)font->face->size->metrics.max_advance) / 64.0f;
- gc->max_glyph_height= ((float)font->face->size->metrics.height) / 64.0f;
+ gc->max_glyph_width = ((float)font->face->size->metrics.max_advance) / 64.0f;
+ gc->max_glyph_height = ((float)font->face->size->metrics.height) / 64.0f;
}
- gc->p2_width= 0;
- gc->p2_height= 0;
+ gc->p2_width = 0;
+ gc->p2_height = 0;
BLI_addhead(&font->cache, gc);
return gc;
@@ -121,10 +121,10 @@ void blf_glyph_cache_clear(FontBLF *font)
GlyphBLF *g;
int i;
- for(gc=font->cache.first; gc; gc=gc->next) {
- for (i= 0; i < 257; i++) {
+ for (gc = font->cache.first; gc; gc = gc->next) {
+ for (i = 0; i < 257; i++) {
while (gc->bucket[i].first) {
- g= gc->bucket[i].first;
+ g = gc->bucket[i].first;
BLI_remlink(&(gc->bucket[i]), g);
blf_glyph_free(g);
}
@@ -139,9 +139,9 @@ void blf_glyph_cache_free(GlyphCacheBLF *gc)
GlyphBLF *g;
int i;
- for (i= 0; i < 257; i++) {
+ for (i = 0; i < 257; i++) {
while (gc->bucket[i].first) {
- g= gc->bucket[i].first;
+ g = gc->bucket[i].first;
BLI_remlink(&(gc->bucket[i]), g);
blf_glyph_free(g);
}
@@ -163,25 +163,25 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
if (gc->cur_tex >= gc->ntex) {
gc->ntex *= 2;
- gc->textures= (GLuint *)realloc((void *)gc->textures, sizeof(GLuint)*gc->ntex);
+ gc->textures = (GLuint *)realloc((void *)gc->textures, sizeof(GLuint)*gc->ntex);
}
- gc->p2_width= blf_next_p2((gc->rem_glyphs * gc->max_glyph_width) + (gc->pad * 2));
+ gc->p2_width = blf_next_p2((gc->rem_glyphs * gc->max_glyph_width) + (gc->pad * 2));
if (gc->p2_width > font->max_tex_size)
- gc->p2_width= font->max_tex_size;
+ gc->p2_width = font->max_tex_size;
- i= (int)((gc->p2_width - (gc->pad * 2)) / gc->max_glyph_width);
- gc->p2_height= blf_next_p2(((gc->num_glyphs / i) + 1) * gc->max_glyph_height);
+ i = (int)((gc->p2_width - (gc->pad * 2)) / gc->max_glyph_width);
+ gc->p2_height = blf_next_p2(((gc->num_glyphs / i) + 1) * gc->max_glyph_height);
if (gc->p2_height > font->max_tex_size)
- gc->p2_height= font->max_tex_size;
+ gc->p2_height = font->max_tex_size;
- tot_mem= gc->p2_width * gc->p2_height;
- buf= (unsigned char *)malloc(tot_mem);
+ tot_mem = gc->p2_width * gc->p2_height;
+ buf = (unsigned char *)malloc(tot_mem);
memset((void *)buf, 0, tot_mem);
glGenTextures(1, &gc->textures[gc->cur_tex]);
- glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state= gc->textures[gc->cur_tex]));
+ glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state = gc->textures[gc->cur_tex]));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -196,12 +196,12 @@ GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c)
GlyphBLF *p;
unsigned int key;
- key= blf_hash(c);
- p= gc->bucket[key].first;
+ key = blf_hash(c);
+ p = gc->bucket[key].first;
while (p) {
if (p->c == c)
return p;
- p= p->next;
+ p = p->next;
}
return NULL;
}
@@ -216,7 +216,7 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
FT_BBox bbox;
unsigned int key;
- g= blf_glyph_search(font->glyph_cache, c);
+ g = blf_glyph_search(font->glyph_cache, c);
if (g)
return g;
@@ -228,7 +228,7 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
return NULL;
/* get the glyph. */
- slot= font->face->glyph;
+ slot = font->face->glyph;
if (sharp) {
err = FT_Render_Glyph(slot, FT_RENDER_MODE_MONO);
@@ -239,47 +239,48 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
err += FT_Bitmap_Convert(font->ft_lib, &slot->bitmap, &tempbitmap, 1); /* Does Blender use Pitch 1 always? It works so far */
err += FT_Bitmap_Copy(font->ft_lib, &tempbitmap, &slot->bitmap);
err += FT_Bitmap_Done(font->ft_lib, &tempbitmap);
- } else {
+ }
+ else {
err = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL);
}
if (err || slot->format != FT_GLYPH_FORMAT_BITMAP)
return NULL;
- g= (GlyphBLF *)MEM_callocN(sizeof(GlyphBLF), "blf_glyph_add");
- g->c= c;
- g->idx= (FT_UInt)index;
- g->xoff= -1;
- g->yoff= -1;
- bitmap= slot->bitmap;
- g->width= bitmap.width;
- g->height= bitmap.rows;
+ g = (GlyphBLF *)MEM_callocN(sizeof(GlyphBLF), "blf_glyph_add");
+ g->c = c;
+ g->idx = (FT_UInt)index;
+ g->xoff = -1;
+ g->yoff = -1;
+ bitmap = slot->bitmap;
+ g->width = bitmap.width;
+ g->height = bitmap.rows;
if (g->width && g->height) {
if (sharp) {
/* Font buffer uses only 0 or 1 values, Blender expects full 0..255 range */
int i;
- for (i=0; i < (g->width * g->height); i++) {
+ for (i = 0; i < (g->width * g->height); i++) {
bitmap.buffer[i] = 255 * bitmap.buffer[i];
}
}
- g->bitmap= (unsigned char *)MEM_mallocN(g->width * g->height, "glyph bitmap");
+ g->bitmap = (unsigned char *)MEM_mallocN(g->width * g->height, "glyph bitmap");
memcpy((void *)g->bitmap, (void *)bitmap.buffer, g->width * g->height);
}
- g->advance= ((float)slot->advance.x) / 64.0f;
- g->pos_x= slot->bitmap_left;
- g->pos_y= slot->bitmap_top;
- g->pitch= slot->bitmap.pitch;
+ g->advance = ((float)slot->advance.x) / 64.0f;
+ g->pos_x = slot->bitmap_left;
+ g->pos_y = slot->bitmap_top;
+ g->pitch = slot->bitmap.pitch;
FT_Outline_Get_CBox(&(slot->outline), &bbox);
- g->box.xmin= ((float)bbox.xMin) / 64.0f;
- g->box.xmax= ((float)bbox.xMax) / 64.0f;
- g->box.ymin= ((float)bbox.yMin) / 64.0f;
- g->box.ymax= ((float)bbox.yMax) / 64.0f;
+ g->box.xmin = ((float)bbox.xMin) / 64.0f;
+ g->box.xmax = ((float)bbox.xMax) / 64.0f;
+ g->box.ymin = ((float)bbox.yMin) / 64.0f;
+ g->box.ymax = ((float)bbox.yMax) / 64.0f;
- key= blf_hash(g->c);
+ key = blf_hash(g->c);
BLI_addhead(&(font->glyph_cache->bucket[key]), g);
return g;
}
@@ -296,7 +297,6 @@ void blf_glyph_free(GlyphBLF *g)
static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, float y2)
{
-
glBegin(GL_QUADS);
glTexCoord2f(uv[0][0], uv[0][1]);
glVertex2f(dx, y1);
@@ -310,27 +310,26 @@ static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, floa
glTexCoord2f(uv[1][0], uv[0][1]);
glVertex2f(dx1, y1);
glEnd();
-
}
static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
{
- float soft[25]= {1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f,
- 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
- 2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f,
- 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
- 1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f};
+ float soft[25] = {1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f,
+ 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
+ 2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f,
+ 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
+ 1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f};
- float color[4], *fp= soft;
+ float color[4], *fp = soft;
int dx, dy;
- color[0]= shadow_col[0];
- color[1]= shadow_col[1];
- color[2]= shadow_col[2];
+ color[0] = shadow_col[0];
+ color[1] = shadow_col[1];
+ color[2] = shadow_col[2];
- for(dx=-2; dx<3; dx++) {
- for(dy=-2; dy<3; dy++, fp++) {
- color[3]= *(fp) * shadow_col[3];
+ for (dx = -2; dx < 3; dx++) {
+ for (dy = -2; dy < 3; dy++, fp++) {
+ color[3] = *(fp) * shadow_col[3];
glColor4fv(color);
blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy);
}
@@ -341,20 +340,20 @@ static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x
static void blf_texture3_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
{
- float soft[9]= {1/16.0f, 2/16.0f, 1/16.0f,
- 2/16.0f,4/16.0f, 2/16.0f,
- 1/16.0f, 2/16.0f, 1/16.0f};
+ float soft[9] = {1/16.0f, 2/16.0f, 1/16.0f,
+ 2/16.0f,4/16.0f, 2/16.0f,
+ 1/16.0f, 2/16.0f, 1/16.0f};
- float color[4], *fp= soft;
+ float color[4], *fp = soft;
int dx, dy;
- color[0]= shadow_col[0];
- color[1]= shadow_col[1];
- color[2]= shadow_col[2];
+ color[0] = shadow_col[0];
+ color[1] = shadow_col[1];
+ color[2] = shadow_col[2];
- for(dx=-1; dx<2; dx++) {
- for(dy=-1; dy<2; dy++, fp++) {
- color[3]= *(fp) * shadow_col[3];
+ for (dx = -1; dx < 2; dx++) {
+ for (dy = -1; dy < 2; dy++, fp++) {
+ color[3] = *(fp) * shadow_col[3];
glColor4fv(color);
blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy);
}
@@ -373,30 +372,30 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
return 1;
if (g->build_tex == 0) {
- GlyphCacheBLF *gc= font->glyph_cache;
+ GlyphCacheBLF *gc = font->glyph_cache;
if (font->max_tex_size == -1)
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&font->max_tex_size);
if (gc->cur_tex == -1) {
blf_glyph_cache_texture(font, gc);
- gc->x_offs= gc->pad;
- gc->y_offs= gc->pad;
+ gc->x_offs = gc->pad;
+ gc->y_offs = gc->pad;
}
if (gc->x_offs > (gc->p2_width - gc->max_glyph_width)) {
- gc->x_offs= gc->pad;
+ gc->x_offs = gc->pad;
gc->y_offs += gc->max_glyph_height;
if (gc->y_offs > (gc->p2_height - gc->max_glyph_height)) {
- gc->y_offs= gc->pad;
+ gc->y_offs = gc->pad;
blf_glyph_cache_texture(font, gc);
}
}
- g->tex= gc->textures[gc->cur_tex];
- g->xoff= gc->x_offs;
- g->yoff= gc->y_offs;
+ g->tex = gc->textures[gc->cur_tex];
+ g->xoff = gc->x_offs;
+ g->yoff = gc->y_offs;
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
@@ -407,32 +406,32 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
glTexSubImage2D(GL_TEXTURE_2D, 0, g->xoff, g->yoff, g->width, g->height, GL_ALPHA, GL_UNSIGNED_BYTE, g->bitmap);
glPopClientAttrib();
- g->uv[0][0]= ((float)g->xoff) / ((float)gc->p2_width);
- g->uv[0][1]= ((float)g->yoff) / ((float)gc->p2_height);
- g->uv[1][0]= ((float)(g->xoff + g->width)) / ((float)gc->p2_width);
- g->uv[1][1]= ((float)(g->yoff + g->height)) / ((float)gc->p2_height);
+ g->uv[0][0] = ((float)g->xoff) / ((float)gc->p2_width);
+ g->uv[0][1] = ((float)g->yoff) / ((float)gc->p2_height);
+ g->uv[1][0] = ((float)(g->xoff + g->width)) / ((float)gc->p2_width);
+ g->uv[1][1] = ((float)(g->yoff + g->height)) / ((float)gc->p2_height);
/* update the x offset for the next glyph. */
gc->x_offs += (int)(g->box.xmax - g->box.xmin + gc->pad);
gc->rem_glyphs--;
- g->build_tex= 1;
+ g->build_tex = 1;
}
- xo= 0.0f;
- yo= 0.0f;
+ xo = 0.0f;
+ yo = 0.0f;
if (font->flags & BLF_SHADOW) {
- xo= x;
- yo= y;
+ xo = x;
+ yo = y;
x += font->shadow_x;
y += font->shadow_y;
}
- dx= floor(x + g->pos_x);
- dx1= dx + g->width;
- y1= y + g->pos_y;
- y2= y + g->pos_y - g->height;
+ dx = floor(x + g->pos_x);
+ dx1 = dx + g->width;
+ y1 = y + g->pos_y;
+ y2 = y + g->pos_y - g->height;
if (font->flags & BLF_CLIPPING) {
if (!BLI_in_rctf(&font->clip_rec, dx + font->pos[0], y1 + font->pos[1]))
@@ -446,12 +445,12 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
}
if (font->tex_bind_state != g->tex) {
- glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state= g->tex));
+ glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state = g->tex));
}
if (font->flags & BLF_SHADOW) {
- switch(font->shadow) {
+ switch (font->shadow) {
case 3:
blf_texture3_draw(font->shadow_col, g->uv, dx, y1, dx1, y2);
break;
@@ -466,16 +465,16 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
glColor4fv(font->orig_col);
- x= xo;
- y= yo;
+ x = xo;
+ y = yo;
- dx= floor(x + g->pos_x);
- dx1= dx + g->width;
- y1= y + g->pos_y;
- y2= y + g->pos_y - g->height;
+ dx = floor(x + g->pos_x);
+ dx1 = dx + g->width;
+ y1 = y + g->pos_y;
+ y2 = y + g->pos_y - g->height;
}
- switch(font->blur) {
+ switch (font->blur) {
case 3:
blf_texture3_draw(font->orig_col, g->uv, dx, y1, dx1, y2);
break;
diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h
index 3ef0b3422fe..f43fa8a7458 100644
--- a/source/blender/blenfont/intern/blf_internal.h
+++ b/source/blender/blenfont/intern/blf_internal.h
@@ -41,7 +41,7 @@ unsigned int blf_hash(unsigned int val);
char *blf_dir_search(const char *file);
char *blf_dir_metrics_search(const char *filename);
-// int blf_dir_split(const char *str, char *file, int *size); // UNUSED
+/* int blf_dir_split(const char *str, char *file, int *size); *//* UNUSED */
int blf_font_init(void);
void blf_font_exit(void);
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index 95203c2b1c0..0c68bca20bd 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -55,7 +55,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_linklist.h" /* linknode */
+#include "BLI_linklist.h" /* linknode */
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLI_path_util.h"
@@ -109,7 +109,7 @@ static const char *locales[] = {
void BLF_lang_init(void)
{
- char *messagepath= BLI_get_folder(BLENDER_DATAFILES, "locale");
+ char *messagepath = BLI_get_folder(BLENDER_DATAFILES, "locale");
BLI_strncpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT, sizeof(global_encoding_name));
@@ -118,7 +118,7 @@ void BLF_lang_init(void)
}
else {
printf("%s: 'locale' data path for translations not found, continuing\n", __func__);
- global_messagepath[0]= '\0';
+ global_messagepath[0] = '\0';
}
}
@@ -126,18 +126,18 @@ void BLF_lang_init(void)
/* get LANG/LANGUAGE environment variable */
static void get_language_variable(const char *varname, char *var, int maxlen)
{
- char *env= getenv(varname);
+ char *env = getenv(varname);
- if(env) {
+ if (env) {
char *s;
/* store defaul locale */
BLI_strncpy(var, env, maxlen);
/* use first language as default */
- s= strchr(var, ':');
- if(s)
- s[0]= 0;
+ s = strchr(var, ':');
+ if (s)
+ s[0] = 0;
}
}
@@ -146,7 +146,7 @@ static void get_language_variable(const char *varname, char *var, int maxlen)
*/
static void get_language(const char *locale, const char *lang, char *language, int maxlen)
{
- if(locale[0]) {
+ if (locale[0]) {
BLI_strncpy(language, locale, maxlen);
}
else {
@@ -154,9 +154,9 @@ static void get_language(const char *locale, const char *lang, char *language, i
BLI_strncpy(language, lang, maxlen);
- s= strchr(language, '.');
- if(s)
- s[0]= 0;
+ s = strchr(language, '.');
+ if (s)
+ s[0] = 0;
}
}
@@ -165,22 +165,22 @@ void BLF_lang_set(const char *str)
{
char *locreturn;
const char *short_locale;
- int ok= 1;
+ int ok = 1;
const char *long_locale = locales[2 * U.language];
- if((U.transopts&USER_DOTRANSLATE)==0)
+ if ((U.transopts&USER_DOTRANSLATE) == 0)
return;
- if(str)
+ if (str)
short_locale = str;
else
short_locale = locales[ 2 * U.language + 1];
#if defined (_WIN32) && !defined(FREE_WINDOWS)
- if(short_locale) {
+ if (short_locale) {
char *envStr;
- if( U.language==0 )/* use system setting */
+ if (U.language == 0)/* use system setting */
envStr = BLI_sprintfN( "LANG=%s", getenv("LANG") );
else
envStr = BLI_sprintfN( "LANG=%s", short_locale );
@@ -189,48 +189,48 @@ void BLF_lang_set(const char *str)
MEM_freeN(envStr);
}
- locreturn= setlocale(LC_ALL, long_locale);
+ locreturn = setlocale(LC_ALL, long_locale);
if (locreturn == NULL) {
- if(G.f & G_DEBUG)
+ if (G.f & G_DEBUG)
printf("Could not change locale to %s\n", long_locale);
- ok= 0;
+ ok = 0;
}
#else
{
- static char default_lang[64]="\0";
- static char default_language[64]="\0";
+ static char default_lang[64] ="\0";
+ static char default_language[64] ="\0";
- if(default_lang[0]==0)
+ if (default_lang[0] == 0)
get_language_variable("LANG", default_lang, sizeof(default_lang));
- if(default_language[0]==0)
+ if (default_language[0] == 0)
get_language_variable("LANGUAGE", default_language, sizeof(default_language));
- if(short_locale[0]) {
- if(G.f & G_DEBUG)
+ if (short_locale[0]) {
+ if (G.f & G_DEBUG)
printf("Setting LANG= and LANGUAGE to %s\n", short_locale);
BLI_setenv("LANG", short_locale);
BLI_setenv("LANGUAGE", short_locale);
}
else {
- if(G.f & G_DEBUG)
+ if (G.f & G_DEBUG)
printf("Setting LANG=%s and LANGUAGE=%s\n", default_lang, default_language);
BLI_setenv("LANG", default_lang);
BLI_setenv("LANGUAGE", default_language);
}
- locreturn= setlocale(LC_ALL, short_locale);
+ locreturn = setlocale(LC_ALL, short_locale);
- if(locreturn == NULL) {
- char *short_locale_utf8= NULL;
+ if (locreturn == NULL) {
+ char *short_locale_utf8 = NULL;
- if(short_locale[0]) {
- short_locale_utf8= BLI_sprintfN("%s.UTF-8", short_locale);
- locreturn= setlocale(LC_ALL, short_locale_utf8);
+ if (short_locale[0]) {
+ short_locale_utf8 = BLI_sprintfN("%s.UTF-8", short_locale);
+ locreturn = setlocale(LC_ALL, short_locale_utf8);
}
if (locreturn == NULL) {
@@ -238,8 +238,8 @@ void BLF_lang_set(const char *str)
get_language(long_locale, default_lang, language, sizeof(language));
- if(G.f & G_DEBUG) {
- if(short_locale[0])
+ if (G.f & G_DEBUG) {
+ if (short_locale[0])
printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8);
else
printf("Could not reset locale\n");
@@ -251,19 +251,19 @@ void BLF_lang_set(const char *str)
BLI_setenv("LANG", default_lang);
BLI_setenv("LANGUAGE", language);
- locreturn= setlocale(LC_ALL, "");
+ locreturn = setlocale(LC_ALL, "");
- ok= 0;
+ ok = 0;
}
- if(short_locale_utf8)
+ if (short_locale_utf8)
MEM_freeN(short_locale_utf8);
}
}
#endif
- if(ok) {
- //printf("Change locale to %s\n", locreturn );
+ if (ok) {
+ /*printf("Change locale to %s\n", locreturn ); */
BLI_strncpy(global_language, locreturn, sizeof(global_language));
}
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index 0ddb6549717..5d74a844425 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -57,34 +57,34 @@
#include "DNA_userdef_types.h" /* For user settings. */
#ifdef WITH_INTERNATIONAL
-static const char unifont_filename[]="droidsans.ttf.gz";
-static unsigned char *unifont_ttf= NULL;
-static int unifont_size= 0;
+static const char unifont_filename[] ="droidsans.ttf.gz";
+static unsigned char *unifont_ttf = NULL;
+static int unifont_size = 0;
unsigned char *BLF_get_unifont(int *unifont_size_r)
{
- if(unifont_ttf==NULL) {
+ if (unifont_ttf == NULL) {
char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts");
if (fontpath) {
char unifont_path[1024];
BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename);
- unifont_ttf= (unsigned char*)BLI_file_ungzip_to_mem(unifont_path, &unifont_size);
+ unifont_ttf = (unsigned char*)BLI_file_ungzip_to_mem(unifont_path, &unifont_size);
}
else {
printf("%s: 'fonts' data path not found for international font, continuing\n", __func__);
}
}
- *unifont_size_r= unifont_size;
+ *unifont_size_r = unifont_size;
return unifont_ttf;
}
void BLF_free_unifont(void)
{
- if(unifont_ttf)
+ if (unifont_ttf)
MEM_freeN(unifont_ttf);
}
@@ -93,8 +93,8 @@ void BLF_free_unifont(void)
const char* BLF_gettext(const char *msgid)
{
#ifdef WITH_INTERNATIONAL
- if( msgid[0] )
- return gettext( msgid );
+ if (msgid[0])
+ return gettext(msgid);
return "";
#else
return msgid;
@@ -154,26 +154,36 @@ int BLF_translate_tooltips(void)
#endif
}
-const char *BLF_translate_do_iface(const char *msgid)
+const char *BLF_translate_do_iface(const char *context, const char *msgid)
{
#ifdef WITH_INTERNATIONAL
- if(BLF_translate_iface())
- return BLF_gettext(msgid);
+ if (BLF_translate_iface()) {
+ if (context)
+ return BLF_pgettext(context, msgid);
+ else
+ return BLF_gettext(msgid);
+ }
else
return msgid;
#else
+ (void)context;
return msgid;
#endif
}
-const char *BLF_translate_do_tooltip(const char *msgid)
+const char *BLF_translate_do_tooltip(const char *context, const char *msgid)
{
#ifdef WITH_INTERNATIONAL
- if(BLF_translate_tooltips())
- return BLF_gettext(msgid);
+ if (BLF_translate_tooltips()) {
+ if (context)
+ return BLF_pgettext(context, msgid);
+ else
+ return BLF_gettext(msgid);
+ }
else
return msgid;
#else
+ (void)context;
return msgid;
#endif
}
diff --git a/source/blender/blenfont/intern/blf_util.c b/source/blender/blenfont/intern/blf_util.c
index 45e01e58312..8240906dd3b 100644
--- a/source/blender/blenfont/intern/blf_util.c
+++ b/source/blender/blenfont/intern/blf_util.c
@@ -53,7 +53,7 @@ unsigned int blf_hash(unsigned int val)
{
unsigned int key;
- key= val;
+ key = val;
key += ~(key << 16);
key ^= (key >> 5);
key += (key << 3);
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 87ba2092437..abdb1d8cc8b 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -98,7 +98,7 @@ struct PBVH;
#define SUB_ELEMS_FACE 50
/*
- * Note: all mface interfaces now officially operate on tesselated data.
+ * Note: all mface interfaces now officially operate on tessellated data.
* Also, the mface origindex layer indexes mpolys, not mfaces.
*/
@@ -147,6 +147,11 @@ typedef enum DMDrawFlag {
DM_DRAW_ALWAYS_SMOOTH = 2
} DMDrawFlag;
+typedef enum DMDirtyFlag {
+ /* dm has valid tessellated faces, but tessellated CDDATA need to be updated. */
+ DM_DIRTY_TESS_CDLAYERS = 1 << 0,
+} DMDirtyFlag;
+
typedef struct DerivedMesh DerivedMesh;
struct DerivedMesh {
/* Private DerivedMesh data, only for internal DerivedMesh use */
@@ -158,6 +163,7 @@ struct DerivedMesh {
struct GPUDrawObject *drawObject;
DerivedMeshType type;
float auto_bump_scale;
+ DMDirtyFlag dirty;
/* calculate vert and face normals */
void (*calcNormals)(DerivedMesh *dm);
@@ -174,7 +180,7 @@ struct DerivedMesh {
int (*getNumLoops)(DerivedMesh *dm);
int (*getNumPolys)(DerivedMesh *dm);
- /* copy a single vert/edge/tesselated face from the derived mesh into
+ /* copy a single vert/edge/tessellated face from the derived mesh into
* *{vert/edge/face}_r. note that the current implementation
* of this function can be quite slow, iterating over all
* elements (editmesh)
@@ -248,6 +254,7 @@ struct DerivedMesh {
DMGridAdjacency *(*getGridAdjacency)(DerivedMesh *dm);
int *(*getGridOffset)(DerivedMesh *dm);
DMFlagMat *(*getGridFlagMats)(DerivedMesh *dm);
+ unsigned int **(*getGridHidden)(DerivedMesh *dm);
/* Iterate over each mapped vertex in the derived mesh, calling the
@@ -300,7 +307,7 @@ struct DerivedMesh {
/* Get a map of vertices to faces
*/
- struct ListBase *(*getPolyMap)(struct Object *ob, DerivedMesh *dm);
+ const struct MeshElemMap *(*getPolyMap)(struct Object *ob, DerivedMesh *dm);
/* Get the BVH used for paint modes
*/
@@ -447,12 +454,12 @@ int DM_release(DerivedMesh *dm);
*/
void DM_to_mesh(DerivedMesh *dm, struct Mesh *me, struct Object *ob);
-struct BMEditMesh *DM_to_editbmesh(struct Object *ob, struct DerivedMesh *dm,
- struct BMEditMesh *existing, int do_tesselate);
+struct BMEditMesh *DM_to_editbmesh(struct DerivedMesh *dm,
+ struct BMEditMesh *existing, int do_tessellate);
/* conversion to bmesh only */
void DM_to_bmesh_ex(struct DerivedMesh *dm, struct BMesh *bm);
-struct BMesh *DM_to_bmesh(struct Object *ob, struct DerivedMesh *dm);
+struct BMesh *DM_to_bmesh(struct DerivedMesh *dm);
/* utility function to convert a DerivedMesh to a shape key block
@@ -539,6 +546,8 @@ void DM_DupPolys(DerivedMesh *source, DerivedMesh *target);
void DM_ensure_tessface(DerivedMesh *dm);
+void DM_update_tessface_data(DerivedMesh *dm);
+
/* interpolates vertex data from the vertices indexed by src_indices in the
* source mesh using the given weights and stores the result in the vertex
* indexed by dest_index in the dest mesh
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index 441d63be764..e4802cfa37f 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -82,6 +82,9 @@ void free_armature(struct bArmature *arm);
void make_local_armature(struct bArmature *arm);
struct bArmature *copy_armature(struct bArmature *arm);
+/* Bounding box. */
+struct BoundBox *BKE_armature_get_bb(struct Object *ob);
+
int bone_autoside_name (char name[64], int strip_number, short axis, float head, float tail);
struct Bone *get_named_bone (struct bArmature *arm, const char *name);
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 392642b5305..eb465ea814b 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 262
-#define BLENDER_SUBVERSION 1
+#define BLENDER_SUBVERSION 2
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
@@ -51,7 +51,7 @@ extern "C" {
/* can be left blank, otherwise a,b,c... etc with no quotes */
#define BLENDER_VERSION_CHAR
/* alpha/beta/rc/release, docs use this */
-#define BLENDER_VERSION_CYCLE alpha
+#define BLENDER_VERSION_CYCLE beta
extern char versionstr[]; /* from blender.c */
diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h
index 677614e26e3..bcb50a9c903 100644
--- a/source/blender/blenkernel/BKE_bmesh.h
+++ b/source/blender/blenkernel/BKE_bmesh.h
@@ -37,6 +37,9 @@
/*NOTE: this is the bmesh 1.0 code. it's completely outdated.*/
+/* uncomment to use the new bevel operator as a modifier */
+// #define USE_BM_BEVEL_OP_AS_MOD
+
/* bevel tool defines */
/* element flags */
#define BME_BEVEL_ORIG 1
@@ -84,6 +87,7 @@ typedef struct BME_TransData_Head {
int len;
} BME_TransData_Head;
+/* this is no longer used */
typedef struct BME_Glob { /* stored in Global G for Transform() purposes */
struct BMesh *bm;
BME_TransData_Head *td;
@@ -95,6 +99,7 @@ typedef struct BME_Glob { /* stored in Global G for Transform() purposes */
struct BME_TransData *BME_get_transdata(struct BME_TransData_Head *td, struct BMVert *v);
void BME_free_transdata(struct BME_TransData_Head *td);
-struct BMesh *BME_bevel(struct BMEditMesh *em, float value, int res, int options, int defgrp_index, float angle, BME_TransData_Head **rtd);
+struct BMesh *BME_bevel(struct BMEditMesh *em, float value, int res, int options, int defgrp_index, float angle,
+ BME_TransData_Head **rtd, int do_tessface);
#endif
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index 9e2dd778b03..bdfe7366f9e 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -76,7 +76,7 @@ struct DerivedMesh *CDDM_copy_from_tessface(struct DerivedMesh *dm);
/* creates a CDDerivedMesh with the same layer stack configuration as the
* given DerivedMesh and containing the requested numbers of elements.
- * elements are initialised to all zeros
+ * elements are initialized to all zeros
*/
struct DerivedMesh *CDDM_from_template(struct DerivedMesh *source,
int numVerts, int numEdges, int numFaces,
@@ -96,13 +96,14 @@ void CDDM_apply_vert_normals(struct DerivedMesh *cddm, short (*vertNormals)[3]);
/* recalculates vertex and face normals for a CDDerivedMesh
*/
+void CDDM_calc_normals_mapping_ex(struct DerivedMesh *dm, const short only_face_normals);
void CDDM_calc_normals_mapping(struct DerivedMesh *dm);
void CDDM_calc_normals(struct DerivedMesh *dm);
void CDDM_calc_normals_tessface(struct DerivedMesh *dm);
/* calculates edges for a CDDerivedMesh (from face data)
* this completely replaces the current edge data in the DerivedMesh
- * builds edges from the tesselated face data.
+ * builds edges from the tessellated face data.
*/
void CDDM_calc_edges_tessface(struct DerivedMesh *dm);
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h
index 98e273f59b2..435832f8c87 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -198,32 +198,32 @@ int cloth_bvh_objcollision (struct Object *ob, struct ClothModifierData * clmd,
////////////////////////////////////////////////
// needed for cloth.c
-int implicit_init ( struct Object *ob, struct ClothModifierData *clmd );
-int implicit_free ( struct ClothModifierData *clmd );
-int implicit_solver ( struct Object *ob, float frame, struct ClothModifierData *clmd, struct ListBase *effectors );
-void implicit_set_positions ( struct ClothModifierData *clmd );
+int implicit_init (struct Object *ob, struct ClothModifierData *clmd );
+int implicit_free (struct ClothModifierData *clmd );
+int implicit_solver (struct Object *ob, float frame, struct ClothModifierData *clmd, struct ListBase *effectors );
+void implicit_set_positions (struct ClothModifierData *clmd );
/////////////////////////////////////////////////
// cloth.c
////////////////////////////////////////////////
// needed for modifier.c
-void cloth_free_modifier_extern ( struct ClothModifierData *clmd );
-void cloth_free_modifier ( struct ClothModifierData *clmd );
-void cloth_init ( struct ClothModifierData *clmd );
-void clothModifier_do ( struct ClothModifierData *clmd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3]);
+void cloth_free_modifier_extern (struct ClothModifierData *clmd );
+void cloth_free_modifier (struct ClothModifierData *clmd );
+void cloth_init (struct ClothModifierData *clmd );
+void clothModifier_do (struct ClothModifierData *clmd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3]);
int cloth_uses_vgroup(struct ClothModifierData *clmd);
// needed for collision.c
-void bvhtree_update_from_cloth ( struct ClothModifierData *clmd, int moving );
-void bvhselftree_update_from_cloth ( struct ClothModifierData *clmd, int moving );
+void bvhtree_update_from_cloth (struct ClothModifierData *clmd, int moving );
+void bvhselftree_update_from_cloth (struct ClothModifierData *clmd, int moving );
// needed for button_object.c
-void cloth_clear_cache ( struct Object *ob, struct ClothModifierData *clmd, float framenr );
+void cloth_clear_cache (struct Object *ob, struct ClothModifierData *clmd, float framenr );
// needed for cloth.c
-int cloth_add_spring ( struct ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type);
+int cloth_add_spring (struct ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type);
////////////////////////////////////////////////
@@ -242,9 +242,9 @@ typedef struct
{
const char *name;
CM_SOLVER_ID id;
- int ( *init ) ( struct Object *ob, struct ClothModifierData *clmd );
- int ( *solver ) ( struct Object *ob, float framenr, struct ClothModifierData *clmd, struct ListBase *effectors );
- int ( *free ) ( struct ClothModifierData *clmd );
+ int ( *init ) (struct Object *ob, struct ClothModifierData *clmd );
+ int ( *solver ) (struct Object *ob, float framenr, struct ClothModifierData *clmd, struct ListBase *effectors );
+ int ( *free ) (struct ClothModifierData *clmd );
}
CM_SOLVER_DEF;
diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h
index 75fdc4981a0..24bce63ea3b 100644
--- a/source/blender/blenkernel/BKE_collision.h
+++ b/source/blender/blenkernel/BKE_collision.h
@@ -130,19 +130,19 @@ FaceCollPair;
// used in modifier.c from collision.c
/////////////////////////////////////////////////
-BVHTree *bvhtree_build_from_mvert ( struct MFace *mfaces, unsigned int numfaces, struct MVert *x, unsigned int numverts, float epsilon );
-void bvhtree_update_from_mvert ( BVHTree * bvhtree, struct MFace *faces, int numfaces, struct MVert *x, struct MVert *xnew, int numverts, int moving );
+BVHTree *bvhtree_build_from_mvert(struct MFace *mfaces, unsigned int numfaces, struct MVert *x, unsigned int numverts, float epsilon );
+void bvhtree_update_from_mvert(BVHTree * bvhtree, struct MFace *faces, int numfaces, struct MVert *x, struct MVert *xnew, int numverts, int moving );
/////////////////////////////////////////////////
// move Collision modifier object inter-frame with step = [0,1]
// defined in collisions.c
-void collision_move_object ( struct CollisionModifierData *collmd, float step, float prevstep );
+void collision_move_object(struct CollisionModifierData *collmd, float step, float prevstep);
/////////////////////////////////////////////////
// used in effect.c
/////////////////////////////////////////////////
-struct Object **get_collisionobjects(struct Scene *scene, struct Object *self, struct Group *group, unsigned int *numcollobj);
+struct Object **get_collisionobjects(struct Scene *scene, struct Object *self, struct Group *group, unsigned int *numcollobj, unsigned int modifier_type);
typedef struct ColliderCache {
struct ColliderCache *next, *prev;
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index dd0c021f281..fa3a1a6897a 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -54,27 +54,27 @@ struct Scene;
#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)
-void unlink_curve( struct Curve *cu);
+void unlink_curve(struct Curve *cu);
void free_curve_editNurb_keyIndex(struct EditNurb *editnurb);
void free_curve_editNurb(struct Curve *cu);
-void free_curve( struct Curve *cu);
+void 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 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);
+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);
@@ -83,19 +83,19 @@ void makeNurbfaces(struct Nurb *nu, float *coord_array, int rowstride, int resol
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);
+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 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 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 switchdirectionNurb(struct Nurb *nu);
void addNurbPoints(struct Nurb *nu, int number);
void addNurbPointsBezier(struct Nurb *nu, int number);
@@ -107,11 +107,11 @@ float (*curve_getKeyVertexCos(struct Curve *cu, struct ListBase *lb, float *key)
void curve_applyKeyVertexTilts(struct Curve *cu, struct ListBase *lb, float *key);
/* nurb checks if they can be drawn, also clamp order func */
-int check_valid_nurb_u( struct Nurb *nu);
-int check_valid_nurb_v( struct Nurb *nu);
+int check_valid_nurb_u(struct Nurb *nu);
+int check_valid_nurb_v(struct Nurb *nu);
-int clamp_nurb_order_u( struct Nurb *nu);
-int clamp_nurb_order_v( struct Nurb *nu);
+int clamp_nurb_order_u(struct Nurb *nu);
+int clamp_nurb_order_v(struct Nurb *nu);
ListBase *BKE_curve_nurbs(struct Curve *cu);
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 27b27ce5b42..a22182a52f5 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -73,10 +73,11 @@ extern const CustomDataMask CD_MASK_FACECORNERS;
#define CD_TYPE_AS_MASK(_type) (CustomDataMask)((CustomDataMask)1 << (CustomDataMask)(_type))
-/* Checks if the layer at physical offset layern (in data->layers) support math
+/**
+ * Checks if the layer at physical offset \a layer_n (in data->layers) support math
* the below operations.
*/
-int CustomData_layer_has_math(struct CustomData *data, int layern);
+int CustomData_layer_has_math(struct CustomData *data, int layer_n);
/* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to
* another, while not overwriting anything else (e.g. flags). probably only
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 2e9c94a3bb1..96bad493a3e 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -64,6 +64,7 @@ void defvert_sync_mapped(struct MDeformVert *dvert_dst, const struct MDeformVert
const int *flip_map, const int flip_map_len, const int use_verify);
void defvert_remap (struct MDeformVert *dvert, int *map, const int map_len);
void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
+void defvert_flip_merged(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
void defvert_normalize(struct MDeformVert *dvert);
void defvert_normalize_lock(struct MDeformVert *dvert, const int def_nr_lock);
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 65ebd23d742..4bccbf9e61e 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -111,6 +111,13 @@ int poly_find_loop_from_vert(const struct MPoly *poly,
int poly_get_adj_loops_from_vert(unsigned adj_r[3], const struct MPoly *poly,
const struct MLoop *mloop, unsigned vert);
+/* update the hide flag for edges and polys from the corresponding
+ flag in verts */
+void mesh_flush_hidden_from_verts(const struct MVert *mvert,
+ const struct MLoop *mloop,
+ struct MEdge *medge, int totedge,
+ struct MPoly *mpoly, int totpoly);
+
void unlink_mesh(struct Mesh *me);
void free_mesh(struct Mesh *me, int unlink);
struct Mesh *add_mesh(const char *name);
@@ -153,7 +160,8 @@ void mesh_get_texspace(struct Mesh *me, float r_loc[3], float r_rot[3], float r_
/* if old, it converts mface->edcode to edge drawflags */
void make_edges(struct Mesh *me, int old);
-void mesh_strip_loose_faces(struct Mesh *me);
+void mesh_strip_loose_faces(struct Mesh *me); /* Needed for compatibility (some old read code). */
+void mesh_strip_loose_polysloops(struct Mesh *me);
void mesh_strip_loose_edges(struct Mesh *me);
/* Calculate vertex and face normals, face normals are returned in *faceNors_r if non-NULL
@@ -243,13 +251,20 @@ UvMapVert *get_uv_map_vert(UvVertMap *vmap, unsigned int v);
void free_uv_vert_map(UvVertMap *vmap);
/* Connectivity data */
+typedef struct MeshElemMap {
+ int *indices;
+ int count;
+} MeshElemMap;
+
typedef struct IndexNode {
struct IndexNode *next, *prev;
int index;
} IndexNode;
-void create_vert_poly_map(struct ListBase **map, IndexNode **mem,
- struct MPoly *mface, struct MLoop *mloop,
- const int totvert, const int totface, const int totloop);
+
+void create_vert_poly_map(MeshElemMap **map, int **mem,
+ const struct MPoly *mface, const struct MLoop *mloop,
+ int totvert, int totface, int totloop);
+
void create_vert_edge_map(struct ListBase **map, IndexNode **mem, const struct MEdge *medge,
const int totvert, const int totedge);
@@ -261,11 +276,14 @@ int mesh_center_bounds(struct Mesh *me, float cent[3]);
void mesh_translate(struct Mesh *me, float offset[3], int do_keys);
/* mesh_validate.c */
+/* XXX Loop v/e are unsigned, so using max uint_32 value as invalid marker... */
+#define INVALID_LOOP_EDGE_MARKER 4294967295u
int BKE_mesh_validate_arrays(
- struct Mesh *me,
+ struct Mesh *me,
struct MVert *mverts, unsigned int totvert,
struct MEdge *medges, unsigned int totedge,
- struct MFace *mfaces, unsigned int totface,
+ struct MLoop *mloops, unsigned int totloop,
+ struct MPoly *mpolys, unsigned int totpoly,
struct MDeformVert *dverts, /* assume totvert length */
const short do_verbose, const short do_fixes);
int BKE_mesh_validate(struct Mesh *me, int do_verbose);
@@ -279,11 +297,11 @@ void BKE_mesh_tessface_calc(struct Mesh *mesh);
void BKE_mesh_tessface_ensure(struct Mesh *mesh);
void BKE_mesh_tessface_clear(struct Mesh *mesh);
-/*convert a triangle of loop facedata to mface facedata*/
+/* Convert a triangle or quadrangle of loop/poly data to tessface data */
void mesh_loops_to_mface_corners(struct CustomData *fdata, struct CustomData *ldata,
struct CustomData *pdata, int lindex[4], int findex,
const int polyindex, const int mf_len,
- const int numTex, const int numCol, const int hasWCol, const int hasOrigSpace);
+ const int numTex, const int numCol, const int hasPCol, const int hasOrigSpace);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 937eb02743f..b73982ca852 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -101,7 +101,7 @@ typedef enum {
/* Some modifier can't be added manually by user */
eModifierTypeFlag_NoUserAdd = (1<<8),
- /* For modifiers that use CD_WEIGHT_MCOL for preview. */
+ /* For modifiers that use CD_PREVIEW_MCOL for preview. */
eModifierTypeFlag_UsesPreview = (1<<9)
} ModifierTypeFlag;
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index 793ad4dca0e..27b377d8cd5 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -51,6 +51,7 @@ struct ImBuf *BKE_movieclip_get_postprocessed_ibuf(struct MovieClip *clip, struc
struct ImBuf *BKE_movieclip_get_stable_ibuf(struct MovieClip *clip, struct MovieClipUser *user, float loc[2], float *scale, float *angle, int postprocess_flag);
struct ImBuf *BKE_movieclip_get_ibuf_flag(struct MovieClip *clip, struct MovieClipUser *user, int flag, int cache_flag);
void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height);
+int BKE_movieclip_get_duration(struct MovieClip *clip);
void BKE_movieclip_aspect(struct MovieClip *clip, float *aspx, float *aspy);
int BKE_movieclip_has_frame(struct MovieClip *clip, struct MovieClipUser *user);
void BKE_movieclip_user_set_frame(struct MovieClipUser *user, int framenr);
diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h
index 34123229863..69482706da6 100644
--- a/source/blender/blenkernel/BKE_multires.h
+++ b/source/blender/blenkernel/BKE_multires.h
@@ -32,26 +32,35 @@
* \ingroup bke
*/
+enum MultiresModifiedFlags;
struct DerivedMesh;
-struct Mesh;
+struct GridHidden;
+struct MDisps;
struct MFace;
+struct Mesh;
+struct ModifierData;
struct Multires;
struct MultiresModifierData;
-struct ModifierData;
struct Object;
struct Scene;
-struct MDisps;
-void multires_mark_as_modified(struct Object *ob);
+/* Delete mesh mdisps */
+void multires_customdata_delete(struct Mesh *me);
+
+void multires_mark_as_modified(struct Object *ob, enum MultiresModifiedFlags flags);
void multires_force_update(struct Object *ob);
void multires_force_render_update(struct Object *ob);
void multires_force_external_reload(struct Object *ob);
+/* internal, only called in subsurf_ccg.c */
+void multires_modifier_update_mdisps(struct DerivedMesh *dm);
+void multires_modifier_update_hidden(struct DerivedMesh *dm);
+
void multiresModifier_set_levels_from_disps(struct MultiresModifierData *mmd, struct Object *ob);
struct DerivedMesh *multires_dm_create_from_derived(struct MultiresModifierData*,
- int local_mmd, struct DerivedMesh*, struct Object *, int, int);
+ int local_mmd, struct DerivedMesh*, struct Object *, int);
struct MultiresModifierData *find_multires_modifier_before(struct Scene *scene,
struct ModifierData *lastmd);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 1e9bb85b549..971320765e9 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -67,6 +67,8 @@ void update_base_layer(struct Scene *scene, struct Object *ob);
void free_object(struct Object *ob);
void object_free_display(struct Object *ob);
+int object_support_modifier_type(struct Object *ob, int modifier_type);
+
void object_link_modifiers(struct Object *ob, struct Object *from);
void object_free_modifiers(struct Object *ob);
@@ -107,7 +109,7 @@ void object_boundbox_flag(struct Object *ob, int flag, int set);
void minmax_object(struct Object *ob, float min[3], float max[3]);
int minmax_object_duplis(struct Scene *scene, struct Object *ob, float min[3], float max[3]);
-/* sometimes min-max isnt enough, we need to loop over each point */
+/* sometimes min-max isn't enough, we need to loop over each point */
void BKE_object_foreach_display_point(
struct Object *ob, float obmat[4][4],
void (*func_cb)(const float[3], void *), void *user_data);
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 045e11c18b8..acf39d83370 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -33,6 +33,8 @@
*/
struct Brush;
+struct MDisps;
+struct MeshElemMap;
struct MFace;
struct MultireModifierData;
struct MVert;
@@ -61,6 +63,11 @@ void paint_brush_set(struct Paint *paint, struct Brush *br);
int paint_facesel_test(struct Object *ob);
int paint_vertsel_test(struct Object *ob);
+/* partial visibility */
+int paint_is_face_hidden(const struct MFace *f, const struct MVert *mvert);
+int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
+ int gridsize, int x, int y);
+
/* Session data (mode-specific) */
typedef struct SculptSession {
@@ -74,7 +81,7 @@ typedef struct SculptSession {
struct KeyBlock *kb;
/* Mesh connectivity */
- struct ListBase *pmap;
+ const struct MeshElemMap *pmap;
/* PBVH acceleration structure */
struct PBVH *pbvh;
diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h
index fd372ae6d83..f6307806491 100644
--- a/source/blender/blenkernel/BKE_report.h
+++ b/source/blender/blenkernel/BKE_report.h
@@ -66,6 +66,8 @@ char *BKE_reports_string(ReportList *reports, ReportType level);
void BKE_reports_print(ReportList *reports, ReportType level);
Report *BKE_reports_last_displayable(ReportList *reports);
+
+int BKE_reports_contain(ReportList *reports, ReportType level);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 4b3a15181c1..7a84e71c763 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -187,7 +187,6 @@ struct Editing *seq_give_editing(struct Scene *scene, int alloc);
const char *give_seqname(struct Sequence *seq);
void calc_sequence(struct Scene *scene, struct Sequence *seq);
void calc_sequence_disp(struct Scene *scene, struct Sequence *seq);
-void new_tstripdata(struct Sequence *seq);
void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq, int lock_range);
void sort_seq(struct Scene *scene);
void build_seqar_cb(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq,
diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h
index 446084053de..626dd64e21e 100644
--- a/source/blender/blenkernel/BKE_shrinkwrap.h
+++ b/source/blender/blenkernel/BKE_shrinkwrap.h
@@ -90,7 +90,7 @@ void space_transform_invert(const struct SpaceTransform *data, float *co);
* - Normal projection
*
* ShrinkwrapCalcData encapsulates all needed data for shrinkwrap functions.
- * (So that you dont have to pass an enormous amount of arguments to functions)
+ * (So that you don't have to pass an enormous amount of arguments to functions)
*/
struct Object;
diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h
index f3cdd858e7d..7f9881926a6 100644
--- a/source/blender/blenkernel/BKE_subsurf.h
+++ b/source/blender/blenkernel/BKE_subsurf.h
@@ -31,13 +31,16 @@
* \ingroup bke
*/
+/* struct DerivedMesh is used directly */
+#include "BKE_DerivedMesh.h"
+
struct DMFlagMat;
struct DMGridAdjacency;
struct DMGridData;
struct DerivedMesh;
-struct IndexNode;
-struct ListBase;
+struct MeshElemMap;
struct Mesh;
+struct MPoly;
struct MultiresSubsurf;
struct Object;
struct PBVH;
@@ -61,6 +64,26 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
void subsurf_calculate_limit_positions(struct Mesh *me, float (*positions_r)[3]);
+/* get gridsize from 'level', level must be greater than zero */
+int ccg_gridsize(int level);
+
+/* x/y grid coordinates at 'low_level' can be multiplied by the result
+ of this function to convert to grid coordinates at 'high_level' */
+int ccg_factor(int low_level, int high_level);
+
+void subsurf_copy_grid_hidden(struct DerivedMesh *dm,
+ const struct MPoly *mpoly,
+ struct MVert *mvert,
+ const struct MDisps *mdisps);
+
+typedef enum MultiresModifiedFlags {
+ /* indicates the grids have been sculpted on, so MDisps
+ have to be updated */
+ MULTIRES_COORDS_MODIFIED = 1,
+ /* indicates elements have been hidden or unhidden */
+ MULTIRES_HIDDEN_MODIFIED = 2
+} MultiresModifiedFlags;
+
/**************************** Internal *****************************/
typedef struct CCGDerivedMesh {
@@ -81,17 +104,16 @@ typedef struct CCGDerivedMesh {
int *reverseFaceMap;
struct PBVH *pbvh;
- struct ListBase *fmap;
- struct IndexNode *fmap_mem;
- struct ListBase *pmap;
- struct IndexNode *pmap_mem;
+ struct MeshElemMap *pmap;
+ int *pmap_mem;
struct DMGridData **gridData;
struct DMGridAdjacency *gridAdjacency;
int *gridOffset;
struct CCGFace **gridFaces;
struct DMFlagMat *gridFlagMats;
+ unsigned int **gridHidden;
struct {
struct MultiresModifierData *mmd;
@@ -101,9 +123,7 @@ typedef struct CCGDerivedMesh {
float (*orco)[3];
struct Object *ob;
- int modified;
-
- void (*update)(DerivedMesh*);
+ MultiresModifiedFlags modified_flags;
} multires;
struct EdgeHash *ehash;
diff --git a/source/blender/blenkernel/BKE_tessmesh.h b/source/blender/blenkernel/BKE_tessmesh.h
index 451fbcdfd28..947b980bb75 100644
--- a/source/blender/blenkernel/BKE_tessmesh.h
+++ b/source/blender/blenkernel/BKE_tessmesh.h
@@ -85,7 +85,7 @@ typedef struct BMEditMesh {
#define BMESH_EM_UNDO_RECALC_TESSFACE_WORKAROUND
void BMEdit_RecalcTessellation(BMEditMesh *tm);
-BMEditMesh *BMEdit_Create(BMesh *bm, int do_tesselate);
+BMEditMesh *BMEdit_Create(BMesh *bm, int do_tessellate);
BMEditMesh *BMEdit_Copy(BMEditMesh *tm);
BMEditMesh *BMEdit_FromObject(struct Object *ob);
void BMEdit_Free(BMEditMesh *em);
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h
index f1daa5d63b3..b853a5b4af9 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -67,7 +67,6 @@ void BKE_tracking_free_track(struct MovieTrackingTrack *track);
void BKE_tracking_clear_path(struct MovieTrackingTrack *track, int ref_frame, int action);
-int BKE_tracking_test_join_tracks(struct MovieTrackingTrack *dst_track, struct MovieTrackingTrack *src_track);
void BKE_tracking_join_tracks(struct MovieTrackingTrack *dst_track, struct MovieTrackingTrack *src_track);
void BKE_tracking_free(struct MovieTracking *tracking);
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 86035e218c5..80888e9b348 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -146,7 +146,6 @@ set(SRC
intern/unit.c
intern/world.c
intern/writeavi.c
- intern/writeffmpeg.c
intern/writeframeserver.c
BKE_DerivedMesh.h
@@ -233,7 +232,6 @@ set(SRC
BKE_utildefines.h
BKE_world.h
BKE_writeavi.h
- BKE_writeffmpeg.h
BKE_writeframeserver.h
depsgraph_private.h
nla_private.h
@@ -302,6 +300,10 @@ if(WITH_CODEC_QUICKTIME)
endif()
if(WITH_CODEC_FFMPEG)
+ list(APPEND SRC
+ intern/writeffmpeg.c
+ BKE_writeffmpeg.h
+ )
list(APPEND INC
../../../intern/ffmpeg
)
@@ -389,6 +391,10 @@ if(WITH_FFTW3)
add_definitions(-DFFTW3=1)
endif()
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
## Warnings as errors, this is too strict!
#if(MSVC)
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index 6fed2072e04..3e4e0cc5646 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -108,6 +108,9 @@ if env['WITH_BF_FFTW3']:
defs.append('FFTW3=1')
incs += ' ' + env['BF_FFTW3_INC']
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 7cee0272e4b..f0075217102 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -8,6 +8,7 @@
#include <math.h>
#include "CCGSubSurf.h"
+#include "BKE_subsurf.h"
#include "MEM_guardedalloc.h"
#include "BLO_sys_types.h" // for intptr_t support
@@ -227,7 +228,7 @@ static CCGAllocatorIFC *_getStandardAllocatorIFC(void)
/***/
-static int ccg_gridsize(int level)
+int ccg_gridsize(int level)
{
BLI_assert(level > 0);
BLI_assert(level <= 31);
@@ -235,6 +236,14 @@ static int ccg_gridsize(int level)
return (1 << (level - 1)) + 1;
}
+int ccg_factor(int low_level, int high_level)
+{
+ BLI_assert(low_level > 0 && high_level > 0);
+ BLI_assert(low_level <= high_level);
+
+ return 1 << (high_level - low_level);
+}
+
static int ccg_edgesize(int level)
{
BLI_assert(level > 0);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 4c683b2b2c8..074ea741f3a 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -51,6 +51,8 @@
#include "BLI_utildefines.h"
#include "BLI_linklist.h"
+#include "BLF_translation.h"
+
#include "BKE_cdderivedmesh.h"
#include "BKE_displist.h"
#include "BKE_key.h"
@@ -65,6 +67,7 @@
#include "BKE_tessmesh.h"
#include "BKE_bvhutils.h"
#include "BKE_deform.h"
+#include "BKE_global.h" /* For debug flag, DM_update_tessface_data() func. */
#ifdef WITH_GAMEENGINE
#include "BKE_navmesh_conversion.h"
@@ -80,8 +83,6 @@ static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm);
#include "GPU_extensions.h"
#include "GPU_material.h"
-extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
-
static void add_shapekey_layers(DerivedMesh *dm, Mesh *me, Object *ob);
static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape_uid);
@@ -121,8 +122,17 @@ static MFace *dm_getTessFaceArray(DerivedMesh *dm)
MFace *mface = CustomData_get_layer(&dm->faceData, CD_MFACE);
if (!mface) {
- mface = CustomData_add_layer(&dm->faceData, CD_MFACE, CD_CALLOC, NULL,
- dm->getNumTessFaces(dm));
+ int numTessFaces = dm->getNumTessFaces(dm);
+
+ if (!numTessFaces) {
+ /* Do not add layer if there's no elements in it, this leads to issues later when
+ * this layer is needed with non-zero size, but currently CD stuff does not check
+ * for requested layer size on creation and just returns layer which was previously
+ * added (sergey) */
+ return NULL;
+ }
+
+ mface = CustomData_add_layer(&dm->faceData, CD_MFACE, CD_CALLOC, NULL, numTessFaces);
CustomData_set_layer_flag(&dm->faceData, CD_MFACE, CD_FLAG_TEMPORARY);
dm->copyTessFaceArray(dm, mface);
}
@@ -163,7 +173,7 @@ static MVert *dm_dupVertArray(DerivedMesh *dm)
MVert *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumVerts(dm),
"dm_dupVertArray tmp");
- if(tmp) dm->copyVertArray(dm, tmp);
+ if (tmp) dm->copyVertArray(dm, tmp);
return tmp;
}
@@ -173,7 +183,7 @@ static MEdge *dm_dupEdgeArray(DerivedMesh *dm)
MEdge *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumEdges(dm),
"dm_dupEdgeArray tmp");
- if(tmp) dm->copyEdgeArray(dm, tmp);
+ if (tmp) dm->copyEdgeArray(dm, tmp);
return tmp;
}
@@ -183,7 +193,7 @@ static MFace *dm_dupFaceArray(DerivedMesh *dm)
MFace *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumTessFaces(dm),
"dm_dupFaceArray tmp");
- if(tmp) dm->copyTessFaceArray(dm, tmp);
+ if (tmp) dm->copyTessFaceArray(dm, tmp);
return tmp;
}
@@ -193,7 +203,7 @@ static MLoop *dm_dupLoopArray(DerivedMesh *dm)
MLoop *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumLoops(dm),
"dm_dupLoopArray tmp");
- if(tmp) dm->copyLoopArray(dm, tmp);
+ if (tmp) dm->copyLoopArray(dm, tmp);
return tmp;
}
@@ -203,7 +213,7 @@ static MPoly *dm_dupPolyArray(DerivedMesh *dm)
MPoly *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumPolys(dm),
"dm_dupPolyArray tmp");
- if(tmp) dm->copyPolyArray(dm, tmp);
+ if (tmp) dm->copyPolyArray(dm, tmp);
return tmp;
}
@@ -277,6 +287,7 @@ void DM_init(DerivedMesh *dm, DerivedMeshType type, int numVerts, int numEdges,
dm->needsFree = 1;
dm->auto_bump_scale = -1.0f;
+ dm->dirty = 0;
}
void DM_from_template(DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type,
@@ -304,6 +315,7 @@ void DM_from_template(DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type
DM_init_funcs(dm);
dm->needsFree = 1;
+ dm->dirty = 0;
}
int DM_release(DerivedMesh *dm)
@@ -372,6 +384,73 @@ void DM_ensure_tessface(DerivedMesh *dm)
}
}
+/* Update tessface CD data from loop/poly ones. Needed when not retessellating after modstack evaluation. */
+/* NOTE: Assumes dm has valid tessellated data! */
+void DM_update_tessface_data(DerivedMesh *dm)
+{
+ MFace *mf = dm->getTessFaceArray(dm);
+ MPoly *mp = dm->getPolyArray(dm);
+ MLoop *ml = dm->getLoopArray(dm);
+
+ CustomData *fdata = dm->getTessFaceDataLayout(dm);
+ CustomData *pdata = dm->getPolyDataLayout(dm);
+ CustomData *ldata = dm->getLoopDataLayout(dm);
+
+ const int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
+ const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
+ const int hasPCol = CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL);
+ const int hasOrigSpace = CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP);
+
+ int *polyindex = CustomData_get_layer(fdata, CD_POLYINDEX);
+
+ int mf_idx,
+ totface = dm->getNumTessFaces(dm),
+ ml_idx[4];
+
+ /* Should never occure, but better abort than segfault! */
+ if (!polyindex)
+ return;
+
+ CustomData_from_bmeshpoly(fdata, pdata, ldata, totface);
+
+ for (mf_idx = 0; mf_idx < totface; mf_idx++, mf++) {
+ const int mf_len = mf->v4 ? 4 : 3;
+ int i, not_done;
+
+ /* Find out loop indices. */
+ /* XXX Is there a better way to do this? */
+ /* NOTE: This assumes tessface are valid and in sync with loop/poly… Else, most likely, segfault! */
+ for (i = mp[polyindex[mf_idx]].loopstart, not_done = mf_len; not_done; i++) {
+ MLoop *tml = &ml[i];
+ if (tml->v == mf->v1) {
+ ml_idx[0] = i;
+ not_done--;
+ }
+ else if (tml->v == mf->v2) {
+ ml_idx[1] = i;
+ not_done--;
+ }
+ else if (tml->v == mf->v3) {
+ ml_idx[2] = i;
+ not_done--;
+ }
+ else if (mf_len == 4 && tml->v == mf->v4) {
+ ml_idx[3] = i;
+ not_done--;
+ }
+ }
+ mesh_loops_to_mface_corners(fdata, ldata, pdata,
+ ml_idx, mf_idx, polyindex[mf_idx],
+ mf_len,
+ numTex, numCol, hasPCol, hasOrigSpace);
+ }
+
+ if (G.f & G_DEBUG)
+ printf("Updated tessellated customdata of dm %p\n", dm);
+
+ dm->dirty &= ~DM_DIRTY_TESS_CDLAYERS;
+}
+
void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob)
{
/* dm might depend on me, so we need to do everything with a local copy */
@@ -422,11 +501,11 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob)
/* not all DerivedMeshes store their verts/edges/faces in CustomData, so
* we set them here in case they are missing */
- if(!CustomData_has_layer(&tmp.vdata, CD_MVERT))
+ if (!CustomData_has_layer(&tmp.vdata, CD_MVERT))
CustomData_add_layer(&tmp.vdata, CD_MVERT, CD_ASSIGN, dm->dupVertArray(dm), totvert);
- if(!CustomData_has_layer(&tmp.edata, CD_MEDGE))
+ if (!CustomData_has_layer(&tmp.edata, CD_MEDGE))
CustomData_add_layer(&tmp.edata, CD_MEDGE, CD_ASSIGN, dm->dupEdgeArray(dm), totedge);
- if(!CustomData_has_layer(&tmp.pdata, CD_MPOLY)) {
+ if (!CustomData_has_layer(&tmp.pdata, CD_MPOLY)) {
tmp.mloop = dm->dupLoopArray(dm);
tmp.mpoly = dm->dupPolyArray(dm);
@@ -436,14 +515,14 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob)
/* object had got displacement layer, should copy this layer to save sculpted data */
/* NOTE: maybe some other layers should be copied? nazgul */
- if(CustomData_has_layer(&me->ldata, CD_MDISPS)) {
+ if (CustomData_has_layer(&me->ldata, CD_MDISPS)) {
if (totloop == me->totloop) {
MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
CustomData_add_layer(&tmp.ldata, CD_MDISPS, CD_DUPLICATE, mdisps, totloop);
}
}
- /* yes, must be before _and_ after tesselate */
+ /* yes, must be before _and_ after tessellate */
mesh_update_customdata_pointers(&tmp, TRUE);
BKE_mesh_tessface_calc(&tmp);
@@ -457,9 +536,9 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob)
/* ok, this should now use new CD shapekey data,
* which shouuld be fed through the modifier
* stack*/
- if(tmp.totvert != me->totvert && !did_shapekeys && me->key) {
+ if (tmp.totvert != me->totvert && !did_shapekeys && me->key) {
printf("YEEK! this should be recoded! Shape key loss!!!\n");
- if(tmp.key) tmp.key->id.us--;
+ if (tmp.key) tmp.key->id.us--;
tmp.key = NULL;
}
@@ -472,16 +551,16 @@ void DM_to_meshkey(DerivedMesh *dm, Mesh *me, KeyBlock *kb)
float *fp;
MVert *mvert;
- if(totvert==0 || me->totvert==0 || me->totvert!=totvert) return;
+ if (totvert==0 || me->totvert==0 || me->totvert!=totvert) return;
- if(kb->data) MEM_freeN(kb->data);
+ if (kb->data) MEM_freeN(kb->data);
kb->data= MEM_callocN(me->key->elemsize*me->totvert, "kb->data");
kb->totelem= totvert;
fp= kb->data;
mvert=dm->getVertDataArray(dm, CD_MVERT);
- for(a=0; a<kb->totelem; a++, fp+=3, mvert++) {
+ for (a=0; a<kb->totelem; a++, fp+=3, mvert++) {
copy_v3_v3(fp, mvert->co);
}
}
@@ -535,7 +614,7 @@ void *DM_get_tessface_data(DerivedMesh *dm, int index, int type)
void *DM_get_vert_data_layer(DerivedMesh *dm, int type)
{
- if(type == CD_MVERT)
+ if (type == CD_MVERT)
return dm->getVertArray(dm);
return CustomData_get_layer(&dm->vertData, type);
@@ -543,7 +622,7 @@ void *DM_get_vert_data_layer(DerivedMesh *dm, int type)
void *DM_get_edge_data_layer(DerivedMesh *dm, int type)
{
- if(type == CD_MEDGE)
+ if (type == CD_MEDGE)
return dm->getEdgeArray(dm);
return CustomData_get_layer(&dm->edgeData, type);
@@ -694,7 +773,7 @@ DerivedMesh *mesh_create_derived(Mesh *me, Object *ob, float (*vertCos)[3])
{
DerivedMesh *dm = CDDM_from_mesh(me, ob);
- if(!dm)
+ if (!dm)
return NULL;
if (vertCos)
@@ -735,7 +814,8 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
add_shapekey_layers(dm, me, ob);
MEM_freeN(deformedVerts);
- } else {
+ }
+ else {
DerivedMesh *tdm = mesh_create_derived(me, ob, NULL);
if (build_shapekey_layers)
@@ -743,7 +823,7 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
dm = mti->applyModifier(md, ob, tdm, 0, 0);
- if(tdm != dm) tdm->release(tdm);
+ if (tdm != dm) tdm->release(tdm);
}
return dm;
@@ -776,23 +856,23 @@ static void *get_orco_coords_dm(Object *ob, BMEditMesh *em, int layer, int *free
{
*free= 0;
- if(layer == CD_ORCO) {
+ if (layer == CD_ORCO) {
/* get original coordinates */
*free= 1;
- if(em)
+ if (em)
return (float(*)[3])get_editbmesh_orco_verts(em);
else
return (float(*)[3])get_mesh_orco_verts(ob);
}
- else if(layer == CD_CLOTH_ORCO) {
+ else if (layer == CD_CLOTH_ORCO) {
/* apply shape key for cloth, this should really be solved
* by a more flexible customdata system, but not simple */
- if(!em) {
+ if (!em) {
ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
KeyBlock *kb= key_get_keyblock(ob_get_key(ob), clmd->sim_parms->shapekey_rest);
- if(kb->data)
+ if (kb->data)
return kb->data;
}
@@ -808,14 +888,14 @@ static DerivedMesh *create_orco_dm(Object *ob, Mesh *me, BMEditMesh *em, int lay
float (*orco)[3];
int free;
- if(em) dm= CDDM_from_BMEditMesh(em, me, FALSE, FALSE);
+ if (em) dm= CDDM_from_BMEditMesh(em, me, FALSE, FALSE);
else dm= CDDM_from_mesh(me, ob);
orco= get_orco_coords_dm(ob, em, layer, &free);
- if(orco) {
+ if (orco) {
CDDM_apply_vert_coords(dm, orco);
- if(free) MEM_freeN(orco);
+ if (free) MEM_freeN(orco);
}
CDDM_calc_normals(dm);
@@ -831,11 +911,11 @@ static void add_orco_dm(Object *ob, BMEditMesh *em, DerivedMesh *dm,
totvert= dm->getNumVerts(dm);
- if(orcodm) {
+ if (orcodm) {
orco= MEM_callocN(sizeof(float)*3*totvert, "dm orco");
free= 1;
- if(orcodm->getNumVerts(orcodm) == totvert)
+ if (orcodm->getNumVerts(orcodm) == totvert)
orcodm->getVertCos(orcodm, orco);
else
dm->getVertCos(dm, orco);
@@ -843,17 +923,17 @@ static void add_orco_dm(Object *ob, BMEditMesh *em, DerivedMesh *dm,
else
orco= get_orco_coords_dm(ob, em, layer, &free);
- if(orco) {
- if(layer == CD_ORCO)
+ if (orco) {
+ if (layer == CD_ORCO)
transform_mesh_orco_verts(ob->data, orco, totvert, 0);
- if(!(layerorco = DM_get_vert_data_layer(dm, layer))) {
+ if (!(layerorco = DM_get_vert_data_layer(dm, layer))) {
DM_add_vert_layer(dm, layer, CD_CALLOC, NULL);
layerorco = DM_get_vert_data_layer(dm, layer);
}
memcpy(layerorco, orco, sizeof(float)*3*totvert);
- if(free) MEM_freeN(orco);
+ if (free) MEM_freeN(orco);
}
}
@@ -908,13 +988,19 @@ static void weightpaint_color(unsigned char r_col[4], ColorBand *coba, const flo
{
float colf[4];
- if(coba) do_colorband(coba, input, colf);
- else weight_to_rgb(colf, input);
+ if (coba) {
+ do_colorband(coba, input, colf);
+ }
+ else {
+ weight_to_rgb(colf, input);
+ }
- r_col[3] = (unsigned char)(colf[0] * 255.0f);
- r_col[2] = (unsigned char)(colf[1] * 255.0f);
- r_col[1] = (unsigned char)(colf[2] * 255.0f);
- r_col[0] = 255;
+ /* don't use rgb_float_to_uchar() here because
+ * the resulting float doesn't need 0-1 clamp check */
+ r_col[0] = (unsigned char)(colf[0] * 255.0f);
+ r_col[1] = (unsigned char)(colf[1] * 255.0f);
+ r_col[2] = (unsigned char)(colf[2] * 255.0f);
+ r_col[3] = 255;
}
@@ -1039,30 +1125,34 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
unsigned char *wtcol_v;
#if 0 /* See coment below. */
- unsigned char *wtcol_f = dm->getTessFaceDataArray(dm, CD_WEIGHT_MCOL);
+ unsigned char *wtcol_f = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
#endif
- unsigned char(*wtcol_l)[4] = CustomData_get_layer(dm->getLoopDataLayout(dm), CD_WEIGHT_MLOOPCOL);
+ unsigned char(*wtcol_l)[4] = CustomData_get_layer(dm->getLoopDataLayout(dm), CD_PREVIEW_MLOOPCOL);
#if 0 /* See coment below. */
MFace *mf = dm->getTessFaceArray(dm);
#endif
MLoop *mloop = dm->getLoopArray(dm), *ml;
MPoly *mp = dm->getPolyArray(dm);
+#if 0
int numFaces = dm->getNumTessFaces(dm);
+#endif
int numVerts = dm->getNumVerts(dm);
int totloop;
int i, j;
#if 0 /* See comment below */
- /* If no CD_WEIGHT_MCOL existed yet, add a new one! */
+ /* If no CD_PREVIEW_MCOL existed yet, add a new one! */
if (!wtcol_f)
- wtcol_f = CustomData_add_layer(&dm->faceData, CD_WEIGHT_MCOL, CD_CALLOC, NULL, numFaces);
+ wtcol_f = CustomData_add_layer(&dm->faceData, CD_PREVIEW_MCOL, CD_CALLOC, NULL, numFaces);
if (wtcol_f) {
unsigned char *wtcol_f_step = wtcol_f;
# else
- /* XXX We have to create a CD_WEIGHT_MCOL, else it might sigsev (after a SubSurf mod, eg)... */
- if(!dm->getTessFaceDataArray(dm, CD_WEIGHT_MCOL))
- CustomData_add_layer(&dm->faceData, CD_WEIGHT_MCOL, CD_CALLOC, NULL, numFaces);
+#if 0
+ /* XXX We have to create a CD_PREVIEW_MCOL, else it might sigsev (after a SubSurf mod, eg)... */
+ if (!dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL))
+ CustomData_add_layer(&dm->faceData, CD_PREVIEW_MCOL, CD_CALLOC, NULL, numFaces);
+#endif
{
#endif
@@ -1072,17 +1162,17 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
float *w = weights;
/* If indices is not NULL, it means we do not have weights for all vertices,
* so we must create them (and set them to zero)... */
- if(indices) {
+ if (indices) {
w = MEM_callocN(sizeof(float)*numVerts, "Temp weight array DM_update_weight_mcol");
i = num;
- while(i--)
+ while (i--)
w[indices[i]] = weights[i];
}
/* Convert float weights to colors. */
wtcol_v = calc_colors_from_weights_array(numVerts, w);
- if(indices)
+ if (indices)
MEM_freeN(w);
}
@@ -1119,7 +1209,7 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
}
#endif
/*now add to loops, so the data can be passed through the modifier stack*/
- /* If no CD_WEIGHT_MLOOPCOL existed yet, we have to add a new one! */
+ /* If no CD_PREVIEW_MLOOPCOL existed yet, we have to add a new one! */
if (!wtcol_l) {
BLI_array_declare(wtcol_l);
totloop = 0;
@@ -1132,7 +1222,7 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
(char *)&wtcol_v[4 * ml->v]);
}
}
- CustomData_add_layer(&dm->loopData, CD_WEIGHT_MLOOPCOL, CD_ASSIGN, wtcol_l, totloop);
+ CustomData_add_layer(&dm->loopData, CD_PREVIEW_MLOOPCOL, CD_ASSIGN, wtcol_l, totloop);
}
else {
totloop = 0;
@@ -1147,6 +1237,8 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
}
MEM_freeN(wtcol_v);
}
+
+ dm->dirty |= DM_DIRTY_TESS_CDLAYERS;
}
@@ -1186,7 +1278,8 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape
for (j=0; j<dm->numVertData; j++, kbcos++, mvert++) {
copy_v3_v3(*kbcos, mvert->co);
}
- } else {
+ }
+ else {
for (j=0; j<kb->totelem; j++, cos++, kbcos++) {
copy_v3_v3(*kbcos, *cos);
}
@@ -1259,7 +1352,8 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
Mesh *me = ob->data;
ModifierData *firstmd, *md, *previewmd = NULL;
LinkNode *datamasks, *curr;
- CustomDataMask mask, nextmask, append_mask = 0;
+ /* XXX Always copying POLYINDEX, else tessellated data are no more valid! */
+ CustomDataMask mask, nextmask, append_mask = CD_MASK_POLYINDEX;
float (*deformedVerts)[3] = NULL;
DerivedMesh *dm=NULL, *orcodm, *clothorcodm, *finaldm;
int numVerts = me->totvert;
@@ -1278,20 +1372,20 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
const int do_final_wmcol = (scene->toolsettings->weights_preview == WP_WPREVIEW_FINAL) && do_wmcol;
#endif
const int do_final_wmcol = FALSE;
- int do_init_wmcol = ((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT) && !do_final_wmcol);
+ int do_init_wmcol = ((dataMask & CD_MASK_PREVIEW_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT) && !do_final_wmcol);
/* XXX Same as above... For now, only weights preview in WPaint mode. */
const int do_mod_wmcol = do_init_wmcol;
- if(mmd && !mmd->sculptlvl)
+ if (mmd && !mmd->sculptlvl)
has_multires = 0;
- if(!skipVirtualArmature) {
+ if (!skipVirtualArmature) {
firstmd = modifiers_getVirtualModifierList(ob);
}
else {
/* game engine exception */
firstmd = ob->modifiers.first;
- if(firstmd && firstmd->type == eModifierType_Armature)
+ if (firstmd && firstmd->type == eModifierType_Armature)
firstmd = firstmd->next;
}
@@ -1299,13 +1393,13 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
modifiers_clearErrors(ob);
- if(useRenderParams) required_mode = eModifierMode_Render;
+ if (useRenderParams) required_mode = eModifierMode_Render;
else required_mode = eModifierMode_Realtime;
datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode);
curr = datamasks;
- if(do_mod_wmcol || do_mod_mcol) {
+ if (do_mod_wmcol || do_mod_mcol) {
/* Find the last active modifier generating a preview, or NULL if none. */
/* XXX Currently, DPaint modifier just ignores this.
* Needs a stupid hack...
@@ -1313,33 +1407,34 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
previewmd = modifiers_getLastPreview(scene, md, required_mode);
}
- if(deform_r) *deform_r = NULL;
+ if (deform_r) *deform_r = NULL;
*final_r = NULL;
- if(useDeform) {
- if(inputVertexCos)
+ if (useDeform) {
+ if (inputVertexCos)
deformedVerts = inputVertexCos;
/* Apply all leading deforming modifiers */
- for(;md; md = md->next, curr = curr->next) {
+ for (;md; md = md->next, curr = curr->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
md->scene= scene;
- if(!modifier_isEnabled(scene, md, required_mode)) continue;
- if(useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) continue;
+ if (!modifier_isEnabled(scene, md, required_mode)) continue;
+ if (useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) continue;
- if(mti->type == eModifierTypeType_OnlyDeform) {
- if(!deformedVerts)
+ if (mti->type == eModifierTypeType_OnlyDeform) {
+ if (!deformedVerts)
deformedVerts = mesh_getVertexCos(me, &numVerts);
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, useRenderParams, useDeform);
- } else {
+ }
+ else {
break;
}
/* grab modifiers until index i */
- if((index >= 0) && (modifiers_indexInObject(ob, md) >= index))
+ if ((index >= 0) && (modifiers_indexInObject(ob, md) >= index))
break;
}
@@ -1353,14 +1448,15 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
if (build_shapekey_layers)
add_shapekey_layers(dm, me, ob);
- if(deformedVerts) {
+ if (deformedVerts) {
CDDM_apply_vert_coords(*deform_r, deformedVerts);
CDDM_calc_normals(*deform_r);
}
}
- } else {
+ }
+ else {
/* default behavior for meshes */
- if(inputVertexCos)
+ if (inputVertexCos)
deformedVerts = inputVertexCos;
else
deformedVerts = mesh_getVertexCos(me, &numVerts);
@@ -1374,41 +1470,41 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
orcodm = NULL;
clothorcodm = NULL;
- for(;md; md = md->next, curr = curr->next) {
+ for (;md; md = md->next, curr = curr->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
md->scene= scene;
- if(!modifier_isEnabled(scene, md, required_mode)) continue;
- if(mti->type == eModifierTypeType_OnlyDeform && !useDeform) continue;
- if((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) {
- modifier_setError(md, "Modifier requires original data, bad stack position.");
+ if (!modifier_isEnabled(scene, md, required_mode)) continue;
+ if (mti->type == eModifierTypeType_OnlyDeform && !useDeform) continue;
+ if ((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) {
+ modifier_setError(md, "%s", TIP_("Modifier requires original data, bad stack position."));
continue;
}
- if(sculpt_mode && (!has_multires || multires_applied)) {
+ if (sculpt_mode && (!has_multires || multires_applied)) {
int unsupported= 0;
- if(scene->toolsettings->sculpt->flags & SCULPT_ONLY_DEFORM)
+ if (scene->toolsettings->sculpt->flags & SCULPT_ONLY_DEFORM)
unsupported|= mti->type != eModifierTypeType_OnlyDeform;
unsupported|= md->type == eModifierType_Multires && ((MultiresModifierData*)md)->sculptlvl==0;
unsupported|= multires_applied;
- if(unsupported) {
- modifier_setError(md, "Not supported in sculpt mode.");
+ if (unsupported) {
+ modifier_setError(md, "%s", TIP_("Not supported in sculpt mode."));
continue;
}
}
- if(needMapping && !modifier_supportsMapping(md)) continue;
- if(useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) continue;
+ if (needMapping && !modifier_supportsMapping(md)) continue;
+ if (useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) continue;
/* add an orco layer if needed by this modifier */
- if(mti->requiredDataMask)
+ if (mti->requiredDataMask)
mask = mti->requiredDataMask(ob, md);
else
mask = 0;
- if(dm && (mask & CD_MASK_ORCO))
+ if (dm && (mask & CD_MASK_ORCO))
add_orco_dm(ob, NULL, dm, orcodm, CD_ORCO);
/* How to apply modifier depends on (a) what we already have as
@@ -1416,10 +1512,10 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
* deformed vertices) and (b) what type the modifier is.
*/
- if(mti->type == eModifierTypeType_OnlyDeform) {
+ if (mti->type == eModifierTypeType_OnlyDeform) {
/* No existing verts to deform, need to build them. */
- if(!deformedVerts) {
- if(dm) {
+ if (!deformedVerts) {
+ if (dm) {
/* Deforming a derived mesh, read the vertex locations
* out of the mesh and deform them. Once done with this
* run of deformers verts will be written back.
@@ -1428,34 +1524,36 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
deformedVerts =
MEM_mallocN(sizeof(*deformedVerts) * numVerts, "dfmv");
dm->getVertCos(dm, deformedVerts);
- } else {
+ }
+ else {
deformedVerts = mesh_getVertexCos(me, &numVerts);
}
}
/* if this is not the last modifier in the stack then recalculate the normals
* to avoid giving bogus normals to the next modifier see: [#23673] */
- if(isPrevDeform && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+ if (isPrevDeform && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
/* XXX, this covers bug #23673, but we may need normal calc for other types */
- if(dm && dm->type == DM_TYPE_CDDM) {
+ if (dm && dm->type == DM_TYPE_CDDM) {
CDDM_apply_vert_coords(dm, deformedVerts);
CDDM_calc_normals(dm);
}
}
mti->deformVerts(md, ob, dm, deformedVerts, numVerts, useRenderParams, useDeform);
- } else {
+ }
+ else {
DerivedMesh *ndm;
/* determine which data layers are needed by following modifiers */
- if(curr->next)
+ if (curr->next)
nextmask= (CustomDataMask)GET_INT_FROM_POINTER(curr->next->link);
else
nextmask= dataMask;
/* apply vertex coordinates or build a DerivedMesh as necessary */
- if(dm) {
- if(deformedVerts) {
+ if (dm) {
+ if (deformedVerts) {
DerivedMesh *tdm = CDDM_copy(dm);
dm->release(dm);
dm = tdm;
@@ -1463,18 +1561,19 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
CDDM_apply_vert_coords(dm, deformedVerts);
CDDM_calc_normals(dm);
}
- } else {
+ }
+ else {
dm = CDDM_from_mesh(me, ob);
if (build_shapekey_layers)
add_shapekey_layers(dm, me, ob);
- if(deformedVerts) {
+ if (deformedVerts) {
CDDM_apply_vert_coords(dm, deformedVerts);
CDDM_calc_normals(dm);
}
- if(do_init_wmcol)
+ if (do_init_wmcol)
DM_update_weight_mcol(ob, dm, draw_flag, NULL, 0, NULL);
/* Constructive modifiers need to have an origindex
@@ -1484,7 +1583,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
* requests it, this way Mirror, Solidify etc will keep ORIGINDEX
* data by using generic DM_copy_vert_data() functions.
*/
- if(needMapping || (nextmask & CD_MASK_ORIGINDEX)) {
+ if (needMapping || (nextmask & CD_MASK_ORIGINDEX)) {
/* calc */
DM_add_vert_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
DM_add_edge_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
@@ -1505,12 +1604,12 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
DM_set_only_copy(dm, mask | (needMapping ? CD_MASK_ORIGINDEX : 0));
/* add cloth rest shape key if need */
- if(mask & CD_MASK_CLOTH_ORCO)
+ if (mask & CD_MASK_CLOTH_ORCO)
add_orco_dm(ob, NULL, dm, clothorcodm, CD_CLOTH_ORCO);
/* add an origspace layer if needed */
- if(((CustomDataMask)GET_INT_FROM_POINTER(curr->link)) & CD_MASK_ORIGSPACE_MLOOP) {
- if(!CustomData_has_layer(&dm->loopData, CD_ORIGSPACE_MLOOP)) {
+ if (((CustomDataMask)GET_INT_FROM_POINTER(curr->link)) & CD_MASK_ORIGSPACE_MLOOP) {
+ if (!CustomData_has_layer(&dm->loopData, CD_ORIGSPACE_MLOOP)) {
DM_add_loop_layer(dm, CD_ORIGSPACE_MLOOP, CD_CALLOC, NULL);
DM_init_origspace(dm);
}
@@ -1518,14 +1617,14 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
ndm = mti->applyModifier(md, ob, dm, useRenderParams, useCache);
- if(ndm) {
+ if (ndm) {
/* if the modifier returned a new dm, release the old one */
- if(dm && dm != ndm) dm->release(dm);
+ if (dm && dm != ndm) dm->release(dm);
dm = ndm;
- if(deformedVerts) {
- if(deformedVerts != inputVertexCos)
+ if (deformedVerts) {
+ if (deformedVerts != inputVertexCos)
MEM_freeN(deformedVerts);
deformedVerts = NULL;
@@ -1533,33 +1632,33 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
}
/* create an orco derivedmesh in parallel */
- if(nextmask & CD_MASK_ORCO) {
- if(!orcodm)
+ if (nextmask & CD_MASK_ORCO) {
+ if (!orcodm)
orcodm= create_orco_dm(ob, me, NULL, CD_ORCO);
nextmask &= ~CD_MASK_ORCO;
DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX);
ndm = mti->applyModifier(md, ob, orcodm, useRenderParams, 0);
- if(ndm) {
+ if (ndm) {
/* if the modifier returned a new dm, release the old one */
- if(orcodm && orcodm != ndm) orcodm->release(orcodm);
+ if (orcodm && orcodm != ndm) orcodm->release(orcodm);
orcodm = ndm;
}
}
/* create cloth orco derivedmesh in parallel */
- if(nextmask & CD_MASK_CLOTH_ORCO) {
- if(!clothorcodm)
+ if (nextmask & CD_MASK_CLOTH_ORCO) {
+ if (!clothorcodm)
clothorcodm= create_orco_dm(ob, me, NULL, CD_CLOTH_ORCO);
nextmask &= ~CD_MASK_CLOTH_ORCO;
DM_set_only_copy(clothorcodm, nextmask | CD_MASK_ORIGINDEX);
ndm = mti->applyModifier(md, ob, clothorcodm, useRenderParams, 0);
- if(ndm) {
+ if (ndm) {
/* if the modifier returned a new dm, release the old one */
- if(clothorcodm && clothorcodm != ndm) clothorcodm->release(clothorcodm);
+ if (clothorcodm && clothorcodm != ndm) clothorcodm->release(clothorcodm);
clothorcodm = ndm;
}
}
@@ -1567,32 +1666,32 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
/* in case of dynamic paint, make sure preview mask remains for following modifiers */
/* XXX Temp and hackish solution! */
if (md->type == eModifierType_DynamicPaint)
- append_mask |= CD_MASK_WEIGHT_MCOL;
+ append_mask |= CD_MASK_PREVIEW_MLOOPCOL;
/* In case of active preview modifier, make sure preview mask remains for following modifiers. */
else if ((md == previewmd) && (do_mod_wmcol)) {
DM_update_weight_mcol(ob, dm, draw_flag, NULL, 0, NULL);
- append_mask |= CD_MASK_WEIGHT_MCOL;
+ append_mask |= CD_MASK_PREVIEW_MLOOPCOL;
}
}
isPrevDeform= (mti->type == eModifierTypeType_OnlyDeform);
/* grab modifiers until index i */
- if((index >= 0) && (modifiers_indexInObject(ob, md) >= index))
+ if ((index >= 0) && (modifiers_indexInObject(ob, md) >= index))
break;
- if(sculpt_mode && md->type == eModifierType_Multires)
+ if (sculpt_mode && md->type == eModifierType_Multires)
multires_applied = 1;
}
- for(md=firstmd; md; md=md->next)
+ for (md=firstmd; md; md=md->next)
modifier_freeTemporaryData(md);
/* Yay, we are done. If we have a DerivedMesh and deformed vertices
* need to apply these back onto the DerivedMesh. If we have no
* DerivedMesh then we need to build one.
*/
- if(dm && deformedVerts) {
+ if (dm && deformedVerts) {
finaldm = CDDM_copy(dm);
dm->release(dm);
@@ -1601,47 +1700,49 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
CDDM_calc_normals(finaldm);
#if 0 /* For later nice mod preview! */
- /* In case we need modified weights in CD_WEIGHT_MCOL, we have to re-compute it. */
- if(do_final_wmcol)
+ /* In case we need modified weights in CD_PREVIEW_MCOL, we have to re-compute it. */
+ if (do_final_wmcol)
DM_update_weight_mcol(ob, finaldm, draw_flag, NULL, 0, NULL);
#endif
- } else if(dm) {
+ }
+ else if (dm) {
finaldm = dm;
#if 0 /* For later nice mod preview! */
- /* In case we need modified weights in CD_WEIGHT_MCOL, we have to re-compute it. */
- if(do_final_wmcol)
+ /* In case we need modified weights in CD_PREVIEW_MCOL, we have to re-compute it. */
+ if (do_final_wmcol)
DM_update_weight_mcol(ob, finaldm, draw_flag, NULL, 0, NULL);
#endif
- } else {
+ }
+ else {
int recalc_normals= 0;
finaldm = CDDM_from_mesh(me, ob);
- if(build_shapekey_layers) {
+ if (build_shapekey_layers) {
add_shapekey_layers(finaldm, me, ob);
recalc_normals= 1;
}
- if(deformedVerts) {
+ if (deformedVerts) {
CDDM_apply_vert_coords(finaldm, deformedVerts);
recalc_normals= 1;
}
- if(recalc_normals) {
+ if (recalc_normals) {
CDDM_calc_normals(finaldm);
}
/* In this case, we should never have weight-modifying modifiers in stack... */
- if(do_init_wmcol)
+ if (do_init_wmcol)
DM_update_weight_mcol(ob, finaldm, draw_flag, NULL, 0, NULL);
}
/* add an orco layer if needed */
- if(dataMask & CD_MASK_ORCO) {
+ if (dataMask & CD_MASK_ORCO) {
add_orco_dm(ob, NULL, finaldm, orcodm, CD_ORCO);
- if(deform_r && *deform_r)
+ if (deform_r && *deform_r)
add_orco_dm(ob, NULL, *deform_r, NULL, CD_ORCO);
}
@@ -1659,7 +1760,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
{
/* calculating normals can re-calculate tessfaces in some cases */
+#if 0
int num_tessface = finaldm->getNumTessFaces(finaldm);
+#endif
/* --------------------------------------------------------------------- */
/* First calculate the polygon and vertex normals, re-tessellation
* copies these into the tessface's normal layer */
@@ -1678,23 +1781,46 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
* redundant in cases where the render mode doesn't use these inputs, but
* ideally eventually tessellation would happen on-demand, and this is one
* of the primary places it would be needed. */
- if (num_tessface == 0 && finaldm->getNumTessFaces(finaldm) == 0) {
+#if 0
+ if (num_tessface == 0 && finaldm->getNumTessFaces(finaldm) == 0)
+#else
+ if (finaldm->getNumTessFaces(finaldm) == 0) /* || !CustomData_has_layer(&finaldm->faceData, CD_POLYINDEX)) */
+#endif
+ {
finaldm->recalcTessellation(finaldm);
}
+ /* Even if tessellation is not needed, some modifiers migh have modified CD layers
+ * (like mloopcol or mloopuv), hence we have to update those. */
+ else if (finaldm->dirty & DM_DIRTY_TESS_CDLAYERS) {
+ /* A tessellation already exists, it should always have a CD_POLYINDEX. */
+ BLI_assert(CustomData_has_layer(&finaldm->faceData, CD_POLYINDEX));
+ DM_update_tessface_data(finaldm);
+ }
/* Need to watch this, it can cause issues, see bug [#29338] */
/* take care with this block, we really need testing frameworks */
/* --------------------------------------------------------------------- */
- }
+ /* without this, drawing ngon tri's faces will show ugly tessellated face
+ * normals and will also have to calculate normals on the fly, try avoid
+ * this where possible since calculating polygon normals isn't fast,
+ * note that this isn't a problem for subsurf (only quads) or editmode
+ * which deals with drawing differently.
+ *
+ * Never calc vertex normals because other code ensures these are up to date.
+ */
+ if ((finaldm->type == DM_TYPE_CDDM) && (CustomData_has_layer(&finaldm->faceData, CD_NORMAL) == FALSE)) {
+ CDDM_calc_normals_mapping_ex(finaldm, TRUE);
+ }
+ }
*final_r = finaldm;
- if(orcodm)
+ if (orcodm)
orcodm->release(orcodm);
- if(clothorcodm)
+ if (clothorcodm)
clothorcodm->release(clothorcodm);
- if(deformedVerts && deformedVerts != inputVertexCos)
+ if (deformedVerts && deformedVerts != inputVertexCos)
MEM_freeN(deformedVerts);
BLI_linklist_free(datamasks, NULL);
@@ -1722,9 +1848,9 @@ int editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *d
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
int required_mode = eModifierMode_Realtime | eModifierMode_Editmode;
- if(!modifier_isEnabled(scene, md, required_mode)) return 0;
- if((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) {
- modifier_setError(md, "Modifier requires original data, bad stack position.");
+ if (!modifier_isEnabled(scene, md, required_mode)) return 0;
+ if ((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) {
+ modifier_setError(md, "%s", TIP_("Modifier requires original data, bad stack position."));
return 0;
}
@@ -1745,7 +1871,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
modifiers_clearErrors(ob);
- if(cage_r && cageIndex == -1) {
+ if (cage_r && cageIndex == -1) {
*cage_r = getEditDerivedBMesh(em, ob, NULL);
}
@@ -1755,18 +1881,18 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode);
curr = datamasks;
- for(i = 0; md; i++, md = md->next, curr = curr->next) {
+ for (i = 0; md; i++, md = md->next, curr = curr->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
md->scene= scene;
- if(!editbmesh_modifier_is_enabled(scene, md, dm))
+ if (!editbmesh_modifier_is_enabled(scene, md, dm))
continue;
/* add an orco layer if needed by this modifier */
- if(dm && mti->requiredDataMask) {
+ if (dm && mti->requiredDataMask) {
mask = mti->requiredDataMask(ob, md);
- if(mask & CD_MASK_ORCO)
+ if (mask & CD_MASK_ORCO)
add_orco_dm(ob, em, dm, orcodm, CD_ORCO);
}
@@ -1775,10 +1901,10 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
* deformed vertices) and (b) what type the modifier is.
*/
- if(mti->type == eModifierTypeType_OnlyDeform) {
+ if (mti->type == eModifierTypeType_OnlyDeform) {
/* No existing verts to deform, need to build them. */
- if(!deformedVerts) {
- if(dm) {
+ if (!deformedVerts) {
+ if (dm) {
/* Deforming a derived mesh, read the vertex locations
* out of the mesh and deform them. Once done with this
* run of deformers verts will be written back.
@@ -1787,7 +1913,8 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
deformedVerts =
MEM_mallocN(sizeof(*deformedVerts) * numVerts, "dfmv");
dm->getVertCos(dm, deformedVerts);
- } else {
+ }
+ else {
deformedVerts = editbmesh_get_vertex_cos(em, &numVerts);
}
}
@@ -1795,28 +1922,31 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
if (mti->deformVertsEM)
mti->deformVertsEM(md, ob, em, dm, deformedVerts, numVerts);
else mti->deformVerts(md, ob, dm, deformedVerts, numVerts, 0, 0);
- } else {
+ }
+ else {
DerivedMesh *ndm;
/* apply vertex coordinates or build a DerivedMesh as necessary */
- if(dm) {
- if(deformedVerts) {
+ if (dm) {
+ if (deformedVerts) {
DerivedMesh *tdm = CDDM_copy(dm);
- if(!(cage_r && dm == *cage_r)) dm->release(dm);
+ if (!(cage_r && dm == *cage_r)) dm->release(dm);
dm = tdm;
CDDM_apply_vert_coords(dm, deformedVerts);
CDDM_calc_normals(dm);
- } else if(cage_r && dm == *cage_r) {
+ }
+ else if (cage_r && dm == *cage_r) {
/* dm may be changed by this modifier, so we need to copy it
*/
dm = CDDM_copy(dm);
}
- } else {
+ }
+ else {
dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE);
- if(deformedVerts) {
+ if (deformedVerts) {
CDDM_apply_vert_coords(dm, deformedVerts);
CDDM_calc_normals(dm);
}
@@ -1824,8 +1954,8 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
/* create an orco derivedmesh in parallel */
mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
- if(mask & CD_MASK_ORCO) {
- if(!orcodm)
+ if (mask & CD_MASK_ORCO) {
+ if (!orcodm)
orcodm= create_orco_dm(ob, ob->data, em, CD_ORCO);
mask &= ~CD_MASK_ORCO;
@@ -1836,9 +1966,9 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
else
ndm = mti->applyModifier(md, ob, orcodm, 0, 0);
- if(ndm) {
+ if (ndm) {
/* if the modifier returned a new dm, release the old one */
- if(orcodm && orcodm != ndm) orcodm->release(orcodm);
+ if (orcodm && orcodm != ndm) orcodm->release(orcodm);
orcodm = ndm;
}
}
@@ -1848,8 +1978,8 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
DM_set_only_copy(dm, mask | CD_MASK_ORIGINDEX);
- if(mask & CD_MASK_ORIGSPACE_MLOOP) {
- if(!CustomData_has_layer(&dm->loopData, CD_ORIGSPACE_MLOOP)) {
+ if (mask & CD_MASK_ORIGSPACE_MLOOP) {
+ if (!CustomData_has_layer(&dm->loopData, CD_ORIGSPACE_MLOOP)) {
DM_add_loop_layer(dm, CD_ORIGSPACE_MLOOP, CD_CALLOC, NULL);
DM_init_origspace(dm);
}
@@ -1861,7 +1991,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
ndm = mti->applyModifier(md, ob, dm, 0, 0);
if (ndm) {
- if(dm && dm != ndm)
+ if (dm && dm != ndm)
dm->release(dm);
dm = ndm;
@@ -1873,13 +2003,15 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
}
}
- if(cage_r && i == cageIndex) {
- if(dm && deformedVerts) {
+ if (cage_r && i == cageIndex) {
+ if (dm && deformedVerts) {
*cage_r = CDDM_copy(dm);
CDDM_apply_vert_coords(*cage_r, deformedVerts);
- } else if(dm) {
+ }
+ else if (dm) {
*cage_r = dm;
- } else {
+ }
+ else {
*cage_r =
getEditDerivedBMesh(em, ob,
deformedVerts ? MEM_dupallocN(deformedVerts) : NULL);
@@ -1893,10 +2025,10 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
* to apply these back onto the DerivedMesh. If we have no DerivedMesh
* then we need to build one.
*/
- if(dm && deformedVerts) {
+ if (dm && deformedVerts) {
*final_r = CDDM_copy(dm);
- if(!(cage_r && dm == *cage_r)) dm->release(dm);
+ if (!(cage_r && dm == *cage_r)) dm->release(dm);
CDDM_apply_vert_coords(*final_r, deformedVerts);
CDDM_calc_normals(*final_r); /* was CDDM_calc_normals_mapping - campbell */
@@ -1918,8 +2050,8 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
/* --- */
/* BMESH_ONLY, ensure tessface's used for drawing,
- * but dont recalculate if the last modifier in the stack gives us tessfaces
- * check if the derived meshes are DM_TYPE_EDITBMESH before calling, this isnt essential
+ * but don't recalculate if the last modifier in the stack gives us tessfaces
+ * check if the derived meshes are DM_TYPE_EDITBMESH before calling, this isn't essential
* but quiets annoying error messages since tessfaces wont be created. */
if ((*final_r)->type != DM_TYPE_EDITBMESH) {
DM_ensure_tessface(*final_r);
@@ -1934,13 +2066,13 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
/* --- */
/* add an orco layer if needed */
- if(dataMask & CD_MASK_ORCO)
+ if (dataMask & CD_MASK_ORCO)
add_orco_dm(ob, em, *final_r, orcodm, CD_ORCO);
- if(orcodm)
+ if (orcodm)
orcodm->release(orcodm);
- if(deformedVerts)
+ if (deformedVerts)
MEM_freeN(deformedVerts);
}
@@ -1971,7 +2103,7 @@ static void clear_mesh_caches(Object *ob)
ob->derivedDeform= NULL;
}
- if(ob->sculpt) {
+ if (ob->sculpt) {
object_sculpt_modifiers_changed(ob);
}
}
@@ -1995,6 +2127,12 @@ static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask,
ob->derivedFinal->needsFree = 0;
ob->derivedDeform->needsFree = 0;
ob->lastDataMask = dataMask;
+
+ if ((ob->mode & OB_MODE_SCULPT) && ob->sculpt) {
+ /* create PBVH immediately (would be created on the fly too,
+ but this avoids waiting on first stroke) */
+ ob->sculpt->pbvh= ob->derivedFinal->getPBVH(ob, ob->derivedFinal);
+ }
}
static void editbmesh_build_data(Scene *scene, Object *obedit, BMEditMesh *em, CustomDataMask dataMask)
@@ -2027,7 +2165,8 @@ void makeDerivedMesh(Scene *scene, Object *ob, BMEditMesh *em,
{
if (em) {
editbmesh_build_data(scene, ob, em, dataMask);
- } else {
+ }
+ else {
mesh_build_data(scene, ob, dataMask, build_shapekey_layers);
}
}
@@ -2039,7 +2178,7 @@ DerivedMesh *mesh_get_derived_final(Scene *scene, Object *ob, CustomDataMask dat
/* if there's no derived mesh or the last data mask used doesn't include
* the data we need, rebuild the derived mesh
*/
- if(!ob->derivedFinal || (dataMask & ob->lastDataMask) != dataMask)
+ if (!ob->derivedFinal || (dataMask & ob->lastDataMask) != dataMask)
mesh_build_data(scene, ob, dataMask, 0);
return ob->derivedFinal;
@@ -2050,7 +2189,7 @@ DerivedMesh *mesh_get_derived_deform(Scene *scene, Object *ob, CustomDataMask da
/* if there's no derived mesh or the last data mask used doesn't include
* the data we need, rebuild the derived mesh
*/
- if(!ob->derivedDeform || (dataMask & ob->lastDataMask) != dataMask)
+ if (!ob->derivedDeform || (dataMask & ob->lastDataMask) != dataMask)
mesh_build_data(scene, ob, dataMask, 0);
return ob->derivedDeform;
@@ -2132,7 +2271,7 @@ DerivedMesh *editbmesh_get_derived_cage_and_final(Scene *scene, Object *obedit,
/* if there's no derived mesh or the last data mask used doesn't include
* the data we need, rebuild the derived mesh
*/
- if(!em->derivedCage ||
+ if (!em->derivedCage ||
(em->lastDataMask & dataMask) != dataMask)
editbmesh_build_data(scene, obedit, em, dataMask);
@@ -2145,7 +2284,7 @@ DerivedMesh *editbmesh_get_derived_cage(Scene *scene, Object *obedit, BMEditMesh
/* if there's no derived mesh or the last data mask used doesn't include
* the data we need, rebuild the derived mesh
*/
- if(!em->derivedCage ||
+ if (!em->derivedCage ||
(em->lastDataMask & dataMask) != dataMask)
editbmesh_build_data(scene, obedit, em, dataMask);
@@ -2167,11 +2306,11 @@ static void make_vertexcosnos__mapFunc(void *userData, int index, float *co, flo
vec+= 6*index;
/* check if we've been here before (normal should not be 0) */
- if(vec[3] || vec[4] || vec[5]) return;
+ if (vec[3] || vec[4] || vec[5]) return;
copy_v3_v3(vec, co);
vec+= 3;
- if(no_f) {
+ if (no_f) {
copy_v3_v3(vec, no_f);
}
else {
@@ -2191,20 +2330,20 @@ float *mesh_get_mapped_verts_nors(Scene *scene, Object *ob)
float *vertexcosnos;
/* lets prevent crashing... */
- if(ob->type!=OB_MESH || me->totvert==0)
+ if (ob->type!=OB_MESH || me->totvert==0)
return NULL;
dm= mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH|CD_MASK_ORIGINDEX);
vertexcosnos= MEM_callocN(6*sizeof(float)*me->totvert, "vertexcosnos map");
- if(dm->foreachMappedVert) {
+ if (dm->foreachMappedVert) {
dm->foreachMappedVert(dm, make_vertexcosnos__mapFunc, vertexcosnos);
}
else {
float *fp= vertexcosnos;
int a;
- for(a=0; a< me->totvert; a++, fp+=6) {
+ for (a=0; a< me->totvert; a++, fp+=6) {
dm->getVertCo(dm, a, fp);
dm->getVertNo(dm, a, fp+3);
}
@@ -2256,7 +2395,7 @@ static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[
//assert(vert_index>=0 && vert_index<4);
SGLSLMeshToTangent * pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
- if(pMesh->mtface!=NULL) {
+ if (pMesh->mtface!=NULL) {
float * uv = pMesh->mtface[face_num].uv[vert_index];
fUV[0]=uv[0]; fUV[1]=uv[1];
}
@@ -2272,8 +2411,8 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const
SGLSLMeshToTangent * pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
const int smoothnormal = (pMesh->mface[face_num].flag & ME_SMOOTH);
- if(!smoothnormal) { // flat
- if(pMesh->precomputedFaceNormals) {
+ if (!smoothnormal) { // flat
+ if (pMesh->precomputedFaceNormals) {
copy_v3_v3(fNorm, &pMesh->precomputedFaceNormals[3*face_num]);
}
else {
@@ -2282,7 +2421,7 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const
float *p1= pMesh->mvert[mf->v2].co;
float *p2= pMesh->mvert[mf->v3].co;
- if(mf->v4) {
+ if (mf->v4) {
float *p3 = pMesh->mvert[mf->v4].co;
normal_quad_v3(fNorm, p0, p1, p2, p3);
}
@@ -2320,7 +2459,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
int i, j, len, mf_vi[4], totvert, totface, iCalcNewMethod;
float *nors;
- if(CustomData_get_layer_index(&dm->faceData, CD_TANGENT) != -1)
+ if (CustomData_get_layer_index(&dm->faceData, CD_TANGENT) != -1)
return;
nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
@@ -2333,9 +2472,9 @@ void DM_add_tangent_layer(DerivedMesh *dm)
mface= dm->getTessFaceArray(dm);
mtface= dm->getTessFaceDataArray(dm, CD_MTFACE);
- if(!mtface) {
+ if (!mtface) {
orco= dm->getVertDataArray(dm, CD_ORCO);
- if(!orco)
+ if (!orco)
return;
}
@@ -2350,7 +2489,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
// new computation method
iCalcNewMethod = 1;
- if(iCalcNewMethod != 0) {
+ if (iCalcNewMethod != 0) {
SGLSLMeshToTangent mesh2tangent= {0};
SMikkTSpaceContext sContext= {0};
SMikkTSpaceInterface sInterface= {0};
@@ -2376,9 +2515,9 @@ void DM_add_tangent_layer(DerivedMesh *dm)
iCalcNewMethod = genTangSpaceDefault(&sContext);
}
- if(!iCalcNewMethod) {
+ if (!iCalcNewMethod) {
/* sum tangents at connected vertices */
- for(i=0, tf=mtface, mf=mface; i < totface; mf++, tf++, i++) {
+ for (i=0, tf=mtface, mf=mface; i < totface; mf++, tf++, i++) {
v1= &mvert[mf->v1];
v2= &mvert[mf->v2];
v3= &mvert[mf->v3];
@@ -2392,7 +2531,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
normal_tri_v3( fno,v3->co, v2->co, v1->co);
}
- if(mtface) {
+ if (mtface) {
uv1= tf->uv[0];
uv2= tf->uv[1];
uv3= tf->uv[2];
@@ -2403,7 +2542,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
map_to_sphere( &uv[0][0], &uv[0][1],orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]);
map_to_sphere( &uv[1][0], &uv[1][1],orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]);
map_to_sphere( &uv[2][0], &uv[2][1],orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]);
- if(v4)
+ if (v4)
map_to_sphere( &uv[3][0], &uv[3][1],orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
}
@@ -2412,7 +2551,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
sum_or_add_vertex_tangent(arena, &vtangents[mf->v2], tang, uv2);
sum_or_add_vertex_tangent(arena, &vtangents[mf->v3], tang, uv3);
- if(mf->v4) {
+ if (mf->v4) {
v4= &mvert[mf->v4];
tangent_from_uv(uv1, uv3, uv4, v1->co, v3->co, v4->co, fno, tang);
@@ -2423,14 +2562,14 @@ void DM_add_tangent_layer(DerivedMesh *dm)
}
/* write tangent to layer */
- for(i=0, tf=mtface, mf=mface; i < totface; mf++, tf++, i++, tangent+=4) {
+ for (i=0, tf=mtface, mf=mface; i < totface; mf++, tf++, i++, tangent+=4) {
len= (mf->v4)? 4 : 3;
- if(mtface == NULL) {
+ if (mtface == NULL) {
map_to_sphere( &uv[0][0], &uv[0][1],orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]);
map_to_sphere( &uv[1][0], &uv[1][1],orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]);
map_to_sphere( &uv[2][0], &uv[2][1],orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]);
- if(len==4)
+ if (len==4)
map_to_sphere( &uv[3][0], &uv[3][1],orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
}
@@ -2439,7 +2578,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
mf_vi[2]= mf->v3;
mf_vi[3]= mf->v4;
- for(j=0; j<len; j++) {
+ for (j=0; j<len; j++) {
vtang= find_vertex_tangent(vtangents[mf_vi[j]], mtface ? tf->uv[j] : uv[j]);
normalize_v3_v3(tangent[j], vtang);
((float *) tangent[j])[3]=1.0f;
@@ -2460,7 +2599,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
MFace * mface = dm->getTessFaceArray(dm);
MTFace * mtface = dm->getTessFaceDataArray(dm, CD_MTFACE);
- if(mtface) {
+ if (mtface) {
double dsum = 0.0;
int nr_accumulated = 0;
int f;
@@ -2480,7 +2619,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
// discard degenerate faces
is_degenerate = 0;
- if( equals_v3v3(verts[0], verts[1]) || equals_v3v3(verts[0], verts[2]) || equals_v3v3(verts[1], verts[2]) ||
+ if ( equals_v3v3(verts[0], verts[1]) || equals_v3v3(verts[0], verts[2]) || equals_v3v3(verts[1], verts[2]) ||
equals_v2v2(tex_coords[0], tex_coords[1]) || equals_v2v2(tex_coords[0], tex_coords[2]) || equals_v2v2(tex_coords[1], tex_coords[2]) )
{
is_degenerate = 1;
@@ -2509,7 +2648,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
if (i == 0 ) {
is_signed = (signed_area < 0.0f) ? 1 : 0;
}
- else if((is_signed != 0) != (signed_area < 0.0f)) {
+ else if ((is_signed != 0) != (signed_area < 0.0f)) {
is_degenerate = 1;
}
@@ -2534,10 +2673,10 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
sub_v3_v3v3(vtmp, verts[3], verts[1]);
pos_len_diag1 = dot_v3v3(vtmp, vtmp);
- if(pos_len_diag1<pos_len_diag0) {
+ if (pos_len_diag1<pos_len_diag0) {
offs=1; // alter split
}
- else if(pos_len_diag0==pos_len_diag1) { /* do UV check instead */
+ else if (pos_len_diag0==pos_len_diag1) { /* do UV check instead */
float tex_len_diag0, tex_len_diag1;
sub_v2_v2v2(vtmp, tex_coords[2], tex_coords[0]);
@@ -2610,25 +2749,25 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
fdata = tfdata = dm->getTessFaceDataLayout(dm);
/* calc auto bump scale if necessary */
- if(dm->auto_bump_scale<=0.0f)
+ if (dm->auto_bump_scale<=0.0f)
DM_calc_auto_bump_scale(dm);
/* add a tangent layer if necessary */
- for(b = 0; b < gattribs->totlayer; b++)
- if(gattribs->layer[b].type == CD_TANGENT)
- if(CustomData_get_layer_index(fdata, CD_TANGENT) == -1)
+ for (b = 0; b < gattribs->totlayer; b++)
+ if (gattribs->layer[b].type == CD_TANGENT)
+ if (CustomData_get_layer_index(fdata, CD_TANGENT) == -1)
DM_add_tangent_layer(dm);
- for(b = 0; b < gattribs->totlayer; b++) {
- if(gattribs->layer[b].type == CD_MTFACE) {
+ for (b = 0; b < gattribs->totlayer; b++) {
+ if (gattribs->layer[b].type == CD_MTFACE) {
/* uv coordinates */
- if(gattribs->layer[b].name[0])
+ if (gattribs->layer[b].name[0])
layer = CustomData_get_named_layer_index(tfdata, CD_MTFACE,
gattribs->layer[b].name);
else
layer = CustomData_get_active_layer_index(tfdata, CD_MTFACE);
- if(layer != -1) {
+ if (layer != -1) {
a = attribs->tottface++;
attribs->tface[a].array = tfdata->layers[layer].data;
@@ -2642,7 +2781,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
int player;
CustomData *pdata = dm->getPolyDataLayout(dm);
- if(gattribs->layer[b].name[0])
+ if (gattribs->layer[b].name[0])
player = CustomData_get_named_layer_index(pdata, CD_MTEXPOLY,
gattribs->layer[b].name);
else
@@ -2660,15 +2799,15 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
}
#endif
}
- else if(gattribs->layer[b].type == CD_MCOL) {
+ else if (gattribs->layer[b].type == CD_MCOL) {
/* vertex colors */
- if(gattribs->layer[b].name[0])
+ if (gattribs->layer[b].name[0])
layer = CustomData_get_named_layer_index(tfdata, CD_MCOL,
gattribs->layer[b].name);
else
layer = CustomData_get_active_layer_index(tfdata, CD_MCOL);
- if(layer != -1) {
+ if (layer != -1) {
a = attribs->totmcol++;
attribs->mcol[a].array = tfdata->layers[layer].data;
@@ -2676,11 +2815,11 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
attribs->mcol[a].glIndex = gattribs->layer[b].glindex;
}
}
- else if(gattribs->layer[b].type == CD_TANGENT) {
+ else if (gattribs->layer[b].type == CD_TANGENT) {
/* tangents */
layer = CustomData_get_layer_index(fdata, CD_TANGENT);
- if(layer != -1) {
+ if (layer != -1) {
attribs->tottang = 1;
attribs->tang.array = fdata->layers[layer].data;
@@ -2688,11 +2827,11 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
attribs->tang.glIndex = gattribs->layer[b].glindex;
}
}
- else if(gattribs->layer[b].type == CD_ORCO) {
+ else if (gattribs->layer[b].type == CD_ORCO) {
/* original coordinates */
layer = CustomData_get_layer_index(vdata, CD_ORCO);
- if(layer != -1) {
+ if (layer != -1) {
attribs->totorco = 1;
attribs->orco.array = vdata->layers[layer].data;
@@ -2713,7 +2852,7 @@ void DM_set_object_boundbox(Object *ob, DerivedMesh *dm)
dm->getMinMax(dm, min, max);
- if(!ob->bb)
+ if (!ob->bb)
ob->bb= MEM_callocN(sizeof(BoundBox), "DM-BoundBox");
boundbox_set_from_min_max(ob->bb, min, max);
@@ -2731,12 +2870,12 @@ void DM_set_object_boundbox(Object *ob, DerivedMesh *dm)
*/
-BM_INLINE int navmesh_bit(int a, int b)
+BLI_INLINE int navmesh_bit(int a, int b)
{
return (a & (1 << b)) >> b;
}
-BM_INLINE void navmesh_intToCol(int i, float col[3])
+BLI_INLINE void navmesh_intToCol(int i, float col[3])
{
int r = navmesh_bit(i, 0) + navmesh_bit(i, 3) * 2 + 1;
int g = navmesh_bit(i, 1) + navmesh_bit(i, 4) * 2 + 1;
@@ -2767,11 +2906,11 @@ static void navmesh_drawColored(DerivedMesh *dm)
#endif
glDisable(GL_LIGHTING);
- /* if(GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */
+ /* if (GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */
DEBUG_VBO( "Using legacy code. drawNavMeshColored\n" );
//glShadeModel(GL_SMOOTH);
glBegin(glmode = GL_QUADS);
- for(a = 0; a < dm->numTessFaceData; a++, mface++) {
+ for (a = 0; a < dm->numTessFaceData; a++, mface++) {
int new_glmode = mface->v4?GL_QUADS:GL_TRIANGLES;
int pi = polygonIdx[a];
if (pi <= 0) {
@@ -2781,7 +2920,7 @@ static void navmesh_drawColored(DerivedMesh *dm)
navmesh_intToCol(pi, col);
}
- if(new_glmode != glmode) {
+ if (new_glmode != glmode) {
glEnd();
glBegin(glmode = new_glmode);
}
@@ -2789,7 +2928,7 @@ static void navmesh_drawColored(DerivedMesh *dm)
glVertex3fv(mvert[mface->v1].co);
glVertex3fv(mvert[mface->v2].co);
glVertex3fv(mvert[mface->v3].co);
- if(mface->v4) {
+ if (mface->v4) {
glVertex3fv(mvert[mface->v4].co);
}
}
@@ -3003,7 +3142,7 @@ char *DM_debug_info(DerivedMesh *dm)
void DM_debug_print(DerivedMesh *dm)
{
char *str = DM_debug_info(dm);
- printf("%s", str);
+ puts(str);
fflush(stdout);
MEM_freeN(str);
}
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index b1b98c030eb..b78a11185cc 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -415,7 +415,7 @@ bPoseChannel *get_pose_channel(const bPose *pose, const char *name)
if (ELEM(NULL, pose, name) || (name[0] == 0))
return NULL;
- if(pose->chanhash)
+ if (pose->chanhash)
return BLI_ghash_lookup(pose->chanhash, (void *)name);
return BLI_findstring(&((bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name));
@@ -432,7 +432,7 @@ bPoseChannel *verify_pose_channel(bPose *pose, const char *name)
/* See if this channel exists */
chan= BLI_findstring(&pose->chanbase, name, offsetof(bPoseChannel, name));
- if(chan) {
+ if (chan) {
return chan;
}
@@ -523,7 +523,7 @@ void copy_pose (bPose **dst, bPose *src, int copycon)
pchan->mpath= NULL; /* motion paths should not get copied yet... */
}
- if(pchan->prop) {
+ if (pchan->prop) {
pchan->prop= IDP_CopyProperty(pchan->prop);
}
}
@@ -570,18 +570,18 @@ void init_pose_ikparam(bPose *pose)
void make_pose_channels_hash(bPose *pose)
{
- if(!pose->chanhash) {
+ if (!pose->chanhash) {
bPoseChannel *pchan;
pose->chanhash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "make_pose_chan gh");
- for(pchan=pose->chanbase.first; pchan; pchan=pchan->next)
+ for (pchan=pose->chanbase.first; pchan; pchan=pchan->next)
BLI_ghash_insert(pose->chanhash, pchan->name, pchan);
}
}
void free_pose_channels_hash(bPose *pose)
{
- if(pose->chanhash) {
+ if (pose->chanhash) {
BLI_ghash_free(pose->chanhash, NULL, NULL);
pose->chanhash= NULL;
}
@@ -656,7 +656,7 @@ static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan
pchan->flag= chan->flag;
con= chan->constraints.first;
- for(pcon= pchan->constraints.first; pcon && con; pcon= pcon->next, con= con->next) {
+ for (pcon= pchan->constraints.first; pcon && con; pcon= pcon->next, con= con->next) {
pcon->enforce= con->enforce;
pcon->headtail= con->headtail;
}
@@ -689,13 +689,13 @@ void duplicate_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *pchan_
copy_constraints(&pchan->constraints, &pchan_from->constraints, TRUE);
/* id-properties */
- if(pchan->prop) {
+ if (pchan->prop) {
/* unlikely but possible it exists */
IDP_FreeProperty(pchan->prop);
MEM_freeN(pchan->prop);
pchan->prop= NULL;
}
- if(pchan_from->prop) {
+ if (pchan_from->prop) {
pchan->prop= IDP_CopyProperty(pchan_from->prop);
}
@@ -727,19 +727,19 @@ void update_pose_constraint_flags(bPose *pose)
pchan->constflag |= PCHAN_HAS_IK;
- if(data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
+ if (data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
pchan->constflag |= PCHAN_HAS_TARGET;
/* negative rootbone = recalc rootbone index. used in do_versions */
- if(data->rootbone<0) {
+ if (data->rootbone<0) {
data->rootbone= 0;
- if(data->flag & CONSTRAINT_IK_TIP) parchan= pchan;
+ if (data->flag & CONSTRAINT_IK_TIP) parchan= pchan;
else parchan= pchan->parent;
- while(parchan) {
+ while (parchan) {
data->rootbone++;
- if((parchan->bone->flag & BONE_CONNECTED)==0)
+ if ((parchan->bone->flag & BONE_CONNECTED)==0)
break;
parchan= parchan->parent;
}
@@ -837,7 +837,7 @@ void pose_remove_group (Object *ob)
/* now, remove it from the pose */
BLI_freelinkN(&pose->agroups, grp);
pose->active_group--;
- if(pose->active_group < 0 || pose->agroups.first == NULL) {
+ if (pose->active_group < 0 || pose->agroups.first == NULL) {
pose->active_group= 0;
}
}
@@ -932,7 +932,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
}
if (foundvert || foundmod) {
- if(min==max) max+= 1.0f;
+ if (min==max) max+= 1.0f;
*start= min;
*end= max;
}
@@ -1054,7 +1054,7 @@ short action_get_item_transforms (bAction *act, Object *ob, bPoseChannel *pchan,
/* Copy the data from the action-pose (src) into the pose */
/* both args are assumed to be valid */
/* exported to game engine */
-/* Note! this assumes both poses are aligned, this isnt always true when dealing with user poses */
+/* Note! this assumes both poses are aligned, this isn't always true when dealing with user poses */
void extract_pose_from_pose(bPose *pose, const bPose *src)
{
const bPoseChannel *schan;
@@ -1097,7 +1097,7 @@ void copy_pose_result(bPose *to, bPose *from)
{
bPoseChannel *pchanto, *pchanfrom;
- if(to==NULL || from==NULL) {
+ if (to==NULL || from==NULL) {
printf("pose result copy error to:%p from:%p\n", (void *)to, (void *)from); // debug temp
return;
}
@@ -1108,9 +1108,9 @@ void copy_pose_result(bPose *to, bPose *from)
}
- for(pchanfrom= from->chanbase.first; pchanfrom; pchanfrom= pchanfrom->next) {
+ for (pchanfrom= from->chanbase.first; pchanfrom; pchanfrom= pchanfrom->next) {
pchanto= get_pose_channel(to, pchanfrom->name);
- if(pchanto) {
+ if (pchanto) {
copy_m4_m4(pchanto->pose_mat, pchanfrom->pose_mat);
copy_m4_m4(pchanto->chan_mat, pchanfrom->chan_mat);
@@ -1237,15 +1237,15 @@ static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src,
/* matching offset bones */
/* take dst offset, and put src on on that location */
- if(strip->offs_bone[0]==0)
+ if (strip->offs_bone[0]==0)
return;
/* are we also blending with matching bones? */
- if(strip->prev && strip->start>=strip->prev->start) {
+ if (strip->prev && strip->start>=strip->prev->start) {
bPoseChannel *dpchan= get_pose_channel(dst, strip->offs_bone);
- if(dpchan) {
+ if (dpchan) {
bPoseChannel *spchan= get_pose_channel(src, strip->offs_bone);
- if(spchan) {
+ if (spchan) {
float vec[3];
/* dst->ctime has the internal strip->prev action time */
@@ -1253,7 +1253,7 @@ static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src,
float ctime= get_actionstrip_frame(strip, src->ctime, 1);
- if( ctime > strip->prev->end) {
+ if ( ctime > strip->prev->end) {
bActionChannel *achan;
/* add src to dest, minus the position of src on strip->prev->end */
@@ -1261,7 +1261,7 @@ static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src,
ctime= get_actionstrip_frame(strip, strip->prev->end, 0);
achan= get_action_channel(strip->act, strip->offs_bone);
- if(achan && achan->ipo) {
+ if (achan && achan->ipo) {
bPoseChannel pchan;
/* Evaluates and sets the internal ipo value */
calc_ipo(achan->ipo, ctime);
@@ -1302,19 +1302,19 @@ static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip
bActionChannel *achan= get_action_channel(act, name);
int stride_axis= strip->stride_axis;
- if(achan && achan->ipo) {
+ if (achan && achan->ipo) {
IpoCurve *icu= NULL;
float minx=0.0f, maxx=0.0f, miny=0.0f, maxy=0.0f;
int foundvert= 0;
- if(stride_axis==0) stride_axis= AC_LOC_X;
- else if(stride_axis==1) stride_axis= AC_LOC_Y;
+ if (stride_axis==0) stride_axis= AC_LOC_X;
+ else if (stride_axis==1) stride_axis= AC_LOC_Y;
else stride_axis= AC_LOC_Z;
/* calculate the min/max */
for (icu=achan->ipo->curve.first; icu; icu=icu->next) {
- if(icu->adrcode==stride_axis) {
- if(icu->totvert>1) {
+ if (icu->adrcode==stride_axis) {
+ if (icu->totvert>1) {
foundvert= 1;
minx= icu->bezt[0].vec[1][0];
maxx= icu->bezt[icu->totvert-1].vec[1][0];
@@ -1326,7 +1326,7 @@ static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip
}
}
- if(foundvert && miny!=maxy) {
+ if (foundvert && miny!=maxy) {
float stridelen= sizecorr*fabs(maxy-miny), striptime;
float actiondist, pdist, pdistNewNormalized, offs;
float vec1[4], vec2[4], dir[3];
@@ -1366,10 +1366,10 @@ static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip
static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float time)
{
/* only called when strip has cyclic, so >= 1.0f works... */
- if(time >= 1.0f) {
+ if (time >= 1.0f) {
bActionChannel *achan= get_action_channel(strip->act, strip->offs_bone);
- if(achan && achan->ipo) {
+ if (achan && achan->ipo) {
IpoCurve *icu= NULL;
Bone *bone;
float min[3]={0.0f, 0.0f, 0.0f}, max[3]={0.0f, 0.0f, 0.0f};
@@ -1377,13 +1377,13 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float
/* calculate the min/max */
for (icu=achan->ipo->curve.first; icu; icu=icu->next) {
- if(icu->totvert>1) {
+ if (icu->totvert>1) {
- if(icu->adrcode==AC_LOC_X)
+ if (icu->adrcode==AC_LOC_X)
index= 0;
- else if(icu->adrcode==AC_LOC_Y)
+ else if (icu->adrcode==AC_LOC_Y)
index= 1;
- else if(icu->adrcode==AC_LOC_Z)
+ else if (icu->adrcode==AC_LOC_Z)
index= 2;
else
continue;
@@ -1393,11 +1393,11 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float
max[index]= icu->bezt[icu->totvert-1].vec[1][1];
}
}
- if(foundvert) {
+ if (foundvert) {
/* bring it into armature space */
sub_v3_v3v3(min, max, min);
bone= get_named_bone(ob->data, strip->offs_bone); /* weak */
- if(bone) {
+ if (bone) {
mul_mat3_m4_v3(bone->arm_mat, min);
/* dominant motion, cyclic_offset was cleared in rest_pose */
@@ -1405,10 +1405,11 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float
if (strip->flag & ACTSTRIP_CYCLIC_USEX) pose->cyclic_offset[0]= time*min[0];
if (strip->flag & ACTSTRIP_CYCLIC_USEY) pose->cyclic_offset[1]= time*min[1];
if (strip->flag & ACTSTRIP_CYCLIC_USEZ) pose->cyclic_offset[2]= time*min[2];
- } else {
- if( fabs(min[0]) >= fabs(min[1]) && fabs(min[0]) >= fabs(min[2]))
+ }
+ else {
+ if ( fabs(min[0]) >= fabs(min[1]) && fabs(min[0]) >= fabs(min[2]))
pose->cyclic_offset[0]= time*min[0];
- else if( fabs(min[1]) >= fabs(min[0]) && fabs(min[1]) >= fabs(min[2]))
+ else if ( fabs(min[1]) >= fabs(min[0]) && fabs(min[1]) >= fabs(min[2]))
pose->cyclic_offset[1]= time*min[1];
else
pose->cyclic_offset[2]= time*min[2];
@@ -1425,12 +1426,12 @@ static Object *get_parent_path(Object *ob)
{
bConstraint *con;
- if(ob->parent && ob->parent->type==OB_CURVE)
+ if (ob->parent && ob->parent->type==OB_CURVE)
return ob->parent;
for (con = ob->constraints.first; con; con=con->next) {
- if(con->type==CONSTRAINT_TYPE_FOLLOWPATH) {
- if(con->enforce>0.5f) {
+ if (con->type==CONSTRAINT_TYPE_FOLLOWPATH) {
+ if (con->enforce>0.5f) {
bFollowPathConstraint *data= con->data;
return data->tar;
}
@@ -1454,7 +1455,7 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
float scene_cfra= BKE_curframe(scene);
int doit, dostride;
- if(blocktype==ID_AR) {
+ if (blocktype==ID_AR) {
copy_pose(&tpose, ob->pose, 1);
rest_pose(ob->pose); // potentially destroying current not-keyed pose
}
@@ -1465,25 +1466,25 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
/* check on extend to left or right, when no strip is hit by 'cfra' */
for (strip=ob->nlastrips.first; strip; strip=strip->next) {
/* escape loop on a hit */
- if( scene_cfra >= strip->start && scene_cfra <= strip->end + 0.1f) /* note 0.1 comes back below */
+ if ( scene_cfra >= strip->start && scene_cfra <= strip->end + 0.1f) /* note 0.1 comes back below */
break;
- if(scene_cfra < strip->start) {
- if(stripfirst==NULL)
+ if (scene_cfra < strip->start) {
+ if (stripfirst==NULL)
stripfirst= strip;
- else if(stripfirst->start > strip->start)
+ else if (stripfirst->start > strip->start)
stripfirst= strip;
}
- else if(scene_cfra > strip->end) {
- if(striplast==NULL)
+ else if (scene_cfra > strip->end) {
+ if (striplast==NULL)
striplast= strip;
- else if(striplast->end < strip->end)
+ else if (striplast->end < strip->end)
striplast= strip;
}
}
- if(strip==NULL) { /* extend */
- if(striplast)
+ if (strip==NULL) { /* extend */
+ if (striplast)
scene_cfra= striplast->end;
- else if(stripfirst)
+ else if (stripfirst)
scene_cfra= stripfirst->start;
}
@@ -1501,7 +1502,7 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
if (striptime>=0.0) {
- if(blocktype==ID_AR)
+ if (blocktype==ID_AR)
rest_pose(tpose);
/* To handle repeat, we add 0.1 frame extra to make sure the last frame is included */
@@ -1517,20 +1518,20 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
if (cu->flag & CU_PATH) {
/* Ensure we have a valid path */
- if(cu->path==NULL || cu->path->data==NULL) makeDispListCurveTypes(scene, parent, 0);
- if(cu->path) {
+ if (cu->path==NULL || cu->path->data==NULL) makeDispListCurveTypes(scene, parent, 0);
+ if (cu->path) {
/* Find the position on the path */
ctime= bsystem_time(scene, ob, scene_cfra, 0.0);
- if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) {
+ if (calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) {
/* correct for actions not starting on zero */
ctime= (ctime - strip->actstart)/cu->pathlen;
CLAMP(ctime, 0.0, 1.0);
}
pdist = ctime*cu->path->totdist;
- if(tpose && strip->stridechannel[0]) {
+ if (tpose && strip->stridechannel[0]) {
striptime= stridechannel_frame(parent, ob->size[0], strip, cu->path, pdist, tpose->stride_offset);
}
else {
@@ -1545,12 +1546,12 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
frametime = (striptime * actlength) + strip->actstart;
frametime= bsystem_time(scene, ob, frametime, 0.0);
- if(blocktype==ID_AR) {
+ if (blocktype==ID_AR) {
extract_pose_from_action (tpose, strip->act, frametime);
}
- else if(blocktype==ID_OB) {
+ else if (blocktype==ID_OB) {
extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
- if(key)
+ if (key)
extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
}
doit=dostride= 1;
@@ -1562,25 +1563,25 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
else {
/* Mod to repeat */
- if(strip->repeat!=1.0f) {
+ if (strip->repeat!=1.0f) {
float cycle= striptime*strip->repeat;
striptime = (float)fmod (cycle, 1.0f + 0.1f/length);
cycle-= striptime;
- if(blocktype==ID_AR)
+ if (blocktype==ID_AR)
cyclic_offs_bone(ob, tpose, strip, cycle);
}
frametime = (striptime * actlength) + strip->actstart;
frametime= nla_time(scene, frametime, (float)strip->repeat);
- if(blocktype==ID_AR) {
+ if (blocktype==ID_AR) {
extract_pose_from_action (tpose, strip->act, frametime);
}
- else if(blocktype==ID_OB) {
+ else if (blocktype==ID_OB) {
extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
- if(key)
+ if (key)
extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
}
@@ -1593,20 +1594,20 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
/* we want the strip to hold on the exact fraction of the repeat value */
frametime = actlength * (strip->repeat-(int)strip->repeat);
- if(frametime<=0.000001f) frametime= actlength; /* rounding errors... */
+ if (frametime<=0.000001f) frametime= actlength; /* rounding errors... */
frametime= bsystem_time(scene, ob, frametime+strip->actstart, 0.0);
- if(blocktype==ID_AR)
+ if (blocktype==ID_AR)
extract_pose_from_action (tpose, strip->act, frametime);
- else if(blocktype==ID_OB) {
+ else if (blocktype==ID_OB) {
extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
- if(key)
+ if (key)
extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
}
/* handle cycle hold */
- if(strip->repeat!=1.0f) {
- if(blocktype==ID_AR)
+ if (strip->repeat!=1.0f) {
+ if (blocktype==ID_AR)
cyclic_offs_bone(ob, tpose, strip, strip->repeat-1.0f);
}
@@ -1627,12 +1628,12 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
else
blendfac = 1;
- if(blocktype==ID_AR) {/* Blend this pose with the accumulated pose */
+ if (blocktype==ID_AR) {/* Blend this pose with the accumulated pose */
/* offset bone, for matching cycles */
blend_pose_offset_bone (strip, ob->pose, tpose, blendfac, strip->mode);
blend_poses (ob->pose, tpose, blendfac, strip->mode);
- if(dostride)
+ if (dostride)
blend_pose_strides (ob->pose, tpose, blendfac, strip->mode);
}
else {
@@ -1644,10 +1645,10 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
}
}
- if(blocktype==ID_OB) {
+ if (blocktype==ID_OB) {
execute_ipochannels(&chanbase);
}
- else if(blocktype==ID_AR) {
+ else if (blocktype==ID_AR) {
/* apply stride offset to object */
add_v3_v3(ob->obmat[3], ob->pose->stride_offset);
}
@@ -1655,7 +1656,7 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
/* free */
if (tpose)
free_pose(tpose);
- if(chanbase.first)
+ if (chanbase.first)
BLI_freelistN(&chanbase);
}
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 743cfba0185..19c4a654f9c 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -29,7 +29,6 @@
* \ingroup bke
*/
-
#include <stdio.h>
#include <math.h>
#include <string.h>
@@ -457,7 +456,7 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
*/
void free_path(Path *path)
{
- if(path->data) MEM_freeN(path->data);
+ if (path->data) MEM_freeN(path->data);
MEM_freeN(path);
}
@@ -480,29 +479,29 @@ void calc_curvepath(Object *ob)
/* in a path vertices are with equal differences: path->len = number of verts */
/* NOW WITH BEVELCURVE!!! */
- if(ob==NULL || ob->type != OB_CURVE) return;
+ if (ob==NULL || ob->type != OB_CURVE) return;
cu= ob->data;
nurbs= BKE_curve_nurbs(cu);
nu= nurbs->first;
- if(cu->path) free_path(cu->path);
+ if (cu->path) free_path(cu->path);
cu->path= NULL;
bl= cu->bev.first;
- if(bl==NULL || !bl->nr) return;
+ if (bl==NULL || !bl->nr) return;
cu->path=path= MEM_callocN(sizeof(Path), "calc_curvepath");
/* if POLY: last vertice != first vertice */
cycl= (bl->poly!= -1);
- if(cycl) tot= bl->nr;
+ if (cycl) tot= bl->nr;
else tot= bl->nr-1;
path->len= tot+1;
/* exception: vector handle paths and polygon paths should be subdivided at least a factor resolu */
- if(path->len<nu->resolu*SEGMENTSU(nu)) path->len= nu->resolu*SEGMENTSU(nu);
+ if (path->len<nu->resolu*SEGMENTSU(nu)) path->len= nu->resolu*SEGMENTSU(nu);
dist= (float *)MEM_mallocN((tot+1)*4, "calcpathdist");
@@ -510,9 +509,9 @@ void calc_curvepath(Object *ob)
bevp= bevpfirst= (BevPoint *)(bl+1);
fp= dist;
*fp= 0;
- for(a=0; a<tot; a++) {
+ for (a=0; a<tot; a++) {
fp++;
- if(cycl && a==tot-1)
+ if (cycl && a==tot-1)
sub_v3_v3v3(xyz, bevpfirst->vec, bevp->vec);
else
sub_v3_v3v3(xyz, (bevp+1)->vec, bevp->vec);
@@ -535,17 +534,17 @@ void calc_curvepath(Object *ob)
fac= 1.0f/((float)path->len-1.0f);
fac = fac * path->totdist;
- for(a=0; a<path->len; a++) {
+ for (a=0; a<path->len; a++) {
d= ((float)a)*fac;
/* we're looking for location (distance) 'd' in the array */
- while((d>= *fp) && fp<maxdist) {
+ while ((d>= *fp) && fp<maxdist) {
fp++;
- if(bevp<bevplast) bevp++;
+ if (bevp<bevplast) bevp++;
bevpn= bevp+1;
- if(bevpn>bevplast) {
- if(cycl) bevpn= bevpfirst;
+ if (bevpn>bevplast) {
+ if (cycl) bevpn= bevpfirst;
else bevpn= bevplast;
}
}
@@ -572,15 +571,15 @@ void calc_curvepath(Object *ob)
/* is this only used internally?*/
int interval_test(int min, int max, int p1, int cycl)
{
- if(cycl) {
- if(p1 < min)
+ if (cycl) {
+ if (p1 < min)
p1= ((p1 -min) % (max-min+1)) + max+1;
- else if(p1 > max)
+ else if (p1 > max)
p1= ((p1 -min) % (max-min+1)) + min;
}
else {
- if(p1 < min) p1= min;
- else if(p1 > max) p1= max;
+ if (p1 < min) p1= min;
+ else if (p1 > max) p1= max;
}
return p1;
}
@@ -604,9 +603,9 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
float data[4];
int cycl=0, s0, s1, s2, s3;
- if(ob==NULL || ob->type != OB_CURVE) return 0;
+ if (ob==NULL || ob->type != OB_CURVE) return 0;
cu= ob->data;
- if(cu->path==NULL || cu->path->data==NULL) {
+ if (cu->path==NULL || cu->path->data==NULL) {
printf("no path!\n");
return 0;
}
@@ -617,7 +616,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
bl= cu->bev.first;
if (!bl) return 0;
if (!bl->nr) return 0;
- if(bl->poly> -1) cycl= 1;
+ if (bl->poly> -1) cycl= 1;
ctime *= (path->len-1);
@@ -649,9 +648,9 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
nu= cu->nurb.first;
/* make sure that first and last frame are included in the vectors here */
- if(nu->type == CU_POLY) key_curve_position_weights(1.0f-fac, data, KEY_LINEAR);
- else if(nu->type == CU_BEZIER) key_curve_position_weights(1.0f-fac, data, KEY_LINEAR);
- else if(s0==s1 || p2==p3) key_curve_position_weights(1.0f-fac, data, KEY_CARDINAL);
+ if (nu->type == CU_POLY) key_curve_position_weights(1.0f-fac, data, KEY_LINEAR);
+ else if (nu->type == CU_BEZIER) key_curve_position_weights(1.0f-fac, data, KEY_LINEAR);
+ else if (s0==s1 || p2==p3) key_curve_position_weights(1.0f-fac, data, KEY_CARDINAL);
else key_curve_position_weights(1.0f-fac, data, KEY_BSPLINE);
vec[0]= data[0]*p0->vec[0] + data[1]*p1->vec[0] + data[2]*p2->vec[0] + data[3]*p3->vec[0] ; /* X */
@@ -663,22 +662,22 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
float totfac, q1[4], q2[4];
totfac= data[0]+data[3];
- if(totfac>FLT_EPSILON) interp_qt_qtqt(q1, p0->quat, p3->quat, data[3] / totfac);
+ if (totfac>FLT_EPSILON) interp_qt_qtqt(q1, p0->quat, p3->quat, data[3] / totfac);
else copy_qt_qt(q1, p1->quat);
totfac= data[1]+data[2];
- if(totfac>FLT_EPSILON) interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac);
+ if (totfac>FLT_EPSILON) interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac);
else copy_qt_qt(q2, p3->quat);
totfac = data[0]+data[1]+data[2]+data[3];
- if(totfac>FLT_EPSILON) interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac);
+ if (totfac>FLT_EPSILON) interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac);
else copy_qt_qt(quat, q2);
}
- if(radius)
+ if (radius)
*radius= data[0]*p0->radius + data[1]*p1->radius + data[2]*p2->radius + data[3]*p3->radius;
- if(weight)
+ if (weight)
*weight= data[0]*p0->weight + data[1]*p1->weight + data[2]*p2->weight + data[3]*p3->weight;
return 1;
@@ -711,23 +710,23 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
GroupObject *go;
float mat[4][4], tmat[4][4];
- if(ob->dup_group==NULL) return;
+ if (ob->dup_group==NULL) return;
group= ob->dup_group;
/* simple preventing of too deep nested groups */
- if(level>MAX_DUPLI_RECUR) return;
+ if (level>MAX_DUPLI_RECUR) return;
/* handles animated groups, and */
/* we need to check update for objects that are not in scene... */
group_handle_recalc_and_update(scene, ob, group);
animated= animated || group_is_animated(ob, group);
- for(go= group->gobject.first; go; go= go->next) {
+ for (go= group->gobject.first; go; go= go->next) {
/* note, if you check on layer here, render goes wrong... it still deforms verts and uses parent imat */
- if(go->ob!=ob) {
+ if (go->ob!=ob) {
/* group dupli offset, should apply after everything else */
- if(!is_zero_v3(group->dupli_ofs)) {
+ if (!is_zero_v3(group->dupli_ofs)) {
copy_m4_m4(tmat, go->ob->obmat);
sub_v3_v3v3(tmat[3], tmat[3], group->dupli_ofs);
mult_m4_m4m4(mat, ob->obmat, tmat);
@@ -739,7 +738,7 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
dob= new_dupli_object(lb, go->ob, mat, ob->lay, 0, OB_DUPLIGROUP, animated);
/* check the group instance and object layers match, also that the object visible flags are ok. */
- if( (dob->origlay & group->layer)==0 ||
+ if ( (dob->origlay & group->layer)==0 ||
(G.rendering==0 && dob->ob->restrictflag & OB_RESTRICT_VIEW) ||
(G.rendering && dob->ob->restrictflag & OB_RESTRICT_RENDER)
) {
@@ -749,7 +748,7 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
dob->no_draw= 0;
}
- if(go->ob->transflag & OB_DUPLI) {
+ if (go->ob->transflag & OB_DUPLI) {
copy_m4_m4(dob->ob->obmat, dob->mat);
object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, level+1, animated);
copy_m4_m4(dob->ob->obmat, dob->omat);
@@ -855,11 +854,11 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
copy_m4_m4(obmat, vdd->obmat);
copy_v3_v3(obmat[3], vec);
- if(vdd->par->transflag & OB_DUPLIROT) {
- if(no_f) {
+ if (vdd->par->transflag & OB_DUPLIROT) {
+ if (no_f) {
vec[0]= -no_f[0]; vec[1]= -no_f[1]; vec[2]= -no_f[2];
}
- else if(no_s) {
+ else if (no_s) {
vec[0]= -no_s[0]; vec[1]= -no_s[1]; vec[2]= -no_s[2];
}
@@ -877,10 +876,10 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
/* restore the original layer so that each dupli will have proper dob->origlay */
vdd->ob->lay = origlay;
- if(vdd->orco)
+ if (vdd->orco)
copy_v3_v3(dob->orco, vdd->orco[index]);
- if(vdd->ob->transflag & OB_DUPLI) {
+ if (vdd->ob->transflag & OB_DUPLI) {
float tmpmat[4][4];
copy_m4_m4(tmpmat, vdd->ob->obmat);
copy_m4_m4(vdd->ob->obmat, obmat); /* pretend we are really this mat */
@@ -907,16 +906,17 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
copy_m4_m4(pmat, par->obmat);
/* simple preventing of too deep nested groups */
- if(level>MAX_DUPLI_RECUR) return;
+ if (level>MAX_DUPLI_RECUR) return;
em = me->edit_btmesh;
- if(em) {
+ if (em) {
dm= editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
- } else
+ }
+ else
dm= mesh_get_derived_deform(scene, par, CD_MASK_BAREMESH);
- if(G.rendering) {
+ if (G.rendering) {
vdd.orco= (float(*)[3])get_mesh_orco_verts(par);
transform_mesh_orco_verts(me, vdd.orco, me->totvert, 0);
}
@@ -930,7 +930,8 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
sce = (Scene *)id;
lay= sce->lay;
base= sce->base.first;
- } else {
+ }
+ else {
group = (Group *)id;
lay= group->layer;
go = group->gobject.first;
@@ -941,15 +942,16 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
if (sce) {
ob_iter= base->object;
oblay = base->lay;
- } else {
+ }
+ else {
ob_iter= go->ob;
oblay = ob_iter->lay;
}
if (lay & oblay && scene->obedit!=ob_iter) {
ob=ob_iter->parent;
- while(ob) {
- if(ob==par) {
+ while (ob) {
+ if (ob==par) {
ob = ob_iter;
/* End Scene/Group object loop, below is generic */
@@ -957,7 +959,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
/* par_space_mat - only used for groups so we can modify the space dupli's are in
* when par_space_mat is NULL ob->obmat can be used instead of ob__obmat
*/
- if(par_space_mat)
+ if (par_space_mat)
mult_m4_m4m4(vdd.obmat, par_space_mat, ob->obmat);
else
copy_m4_m4(vdd.obmat, ob->obmat);
@@ -972,20 +974,20 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
copy_m4_m4(vdd.pmat, pmat);
/* mballs have a different dupli handling */
- if(ob->type!=OB_MBALL) ob->flag |= OB_DONE; /* doesnt render */
+ if (ob->type!=OB_MBALL) ob->flag |= OB_DONE; /* doesnt render */
- if(me->edit_btmesh) {
+ if (me->edit_btmesh) {
dm->foreachMappedVert(dm, vertex_dupli__mapFunc, (void*) &vdd);
}
else {
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
dm->getVertCo(dm, a, vec);
dm->getVertNo(dm, a, no);
vertex_dupli__mapFunc(&vdd, a, vec, no, NULL);
}
}
- if(sce) {
+ if (sce) {
/* Set proper layer in case of scene looping,
* in case of groups the object layer will be
* changed when it's duplicated due to the
@@ -1003,7 +1005,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
else go= go->next; /* group loop */
}
- if(vdd.orco)
+ if (vdd.orco)
MEM_freeN(vdd.orco);
dm->release(dm);
}
@@ -1028,12 +1030,12 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
float ob__obmat[4][4]; /* needed for groups where the object matrix needs to be modified */
/* simple preventing of too deep nested groups */
- if(level>MAX_DUPLI_RECUR) return;
+ if (level>MAX_DUPLI_RECUR) return;
copy_m4_m4(pmat, par->obmat);
em = me->edit_btmesh;
- if(em) {
+ if (em) {
dm= editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
}
else {
@@ -1045,7 +1047,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
mloop= dm->getLoopArray(dm);
mvert= dm->getVertArray(dm);
- if(G.rendering) {
+ if (G.rendering) {
orco= (float(*)[3])get_mesh_orco_verts(par);
transform_mesh_orco_verts(me, orco, me->totvert, 0);
@@ -1061,7 +1063,8 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
sce = (Scene *)id;
lay= sce->lay;
base= sce->base.first;
- } else {
+ }
+ else {
group = (Group *)id;
lay= group->layer;
go = group->gobject.first;
@@ -1072,22 +1075,23 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
if (sce) {
ob_iter= base->object;
oblay = base->lay;
- } else {
+ }
+ else {
ob_iter= go->ob;
oblay = ob_iter->lay;
}
if (lay & oblay && scene->obedit!=ob_iter) {
ob=ob_iter->parent;
- while(ob) {
- if(ob==par) {
+ while (ob) {
+ if (ob==par) {
ob = ob_iter;
/* End Scene/Group object loop, below is generic */
/* par_space_mat - only used for groups so we can modify the space dupli's are in
* when par_space_mat is NULL ob->obmat can be used instead of ob__obmat
*/
- if(par_space_mat)
+ if (par_space_mat)
mult_m4_m4m4(ob__obmat, par_space_mat, ob->obmat);
else
copy_m4_m4(ob__obmat, ob->obmat);
@@ -1095,9 +1099,9 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
copy_m3_m4(imat, ob->parentinv);
/* mballs have a different dupli handling */
- if(ob->type!=OB_MBALL) ob->flag |= OB_DONE; /* doesnt render */
+ if (ob->type!=OB_MBALL) ob->flag |= OB_DONE; /* doesnt render */
- for(a=0, mp= mpoly; a<totface; a++, mp++) {
+ for (a=0, mp= mpoly; a<totface; a++, mp++) {
int mv1;
int mv2;
int mv3;
@@ -1141,7 +1145,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
quat_to_mat3( mat,quat);
/* scale */
- if(par->transflag & OB_DUPLIFACES_SCALE) {
+ if (par->transflag & OB_DUPLIFACES_SCALE) {
float size= mesh_calc_poly_area(mp, loopstart, mvert, NULL);
size= sqrtf(size) * par->dupfacesca;
mul_m3_fl(mat, size);
@@ -1154,17 +1158,17 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
mul_m4_m4m3(obmat, tmat, mat);
dob= new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIFACES, animated);
- if(G.rendering) {
+ if (G.rendering) {
w= 1.0f / (float)mp->totloop;
- if(orco) {
+ if (orco) {
int j;
for (j = 0; j < mpoly->totloop; j++) {
madd_v3_v3fl(dob->orco, orco[loopstart[j].v], w);
}
}
- if(mloopuv) {
+ if (mloopuv) {
int j;
for (j = 0; j < mpoly->totloop; j++) {
madd_v2_v2fl(dob->orco, mloopuv[loopstart[j].v].uv, w);
@@ -1172,7 +1176,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
}
}
- if(ob->transflag & OB_DUPLI) {
+ if (ob->transflag & OB_DUPLI) {
float tmpmat[4][4];
copy_m4_m4(tmpmat, ob->obmat);
copy_m4_m4(ob->obmat, obmat); /* pretend we are really this mat */
@@ -1190,7 +1194,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
else go= go->next; /* group loop */
}
- if(orco)
+ if (orco)
MEM_freeN(orco);
dm->release(dm);
@@ -1215,20 +1219,20 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
int no_draw_flag = PARS_UNEXIST;
- if(psys==NULL) return;
+ if (psys==NULL) return;
/* simple preventing of too deep nested groups */
- if(level>MAX_DUPLI_RECUR) return;
+ if (level>MAX_DUPLI_RECUR) return;
part=psys->part;
- if(part==NULL)
+ if (part==NULL)
return;
- if(!psys_check_enabled(par, psys))
+ if (!psys_check_enabled(par, psys))
return;
- if(G.rendering == 0)
+ if (G.rendering == 0)
no_draw_flag |= PARS_NO_DISP;
ctime = BKE_curframe(scene); /* NOTE: in old animsys, used parent object's timeoffset... */
@@ -1238,7 +1242,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
BLI_srandom(31415926 + psys->seed);
- if((psys->renderdata || part->draw_as==PART_DRAW_REND) && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
+ if ((psys->renderdata || part->draw_as==PART_DRAW_REND) && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
ParticleSimulationData sim= {NULL};
sim.scene= scene;
sim.ob= par;
@@ -1248,24 +1252,24 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
invert_m4_m4(par->imat, par->obmat);
/* first check for loops (particle system object used as dupli object) */
- if(part->ren_as == PART_DRAW_OB) {
- if(ELEM(part->dup_ob, NULL, par))
+ if (part->ren_as == PART_DRAW_OB) {
+ if (ELEM(part->dup_ob, NULL, par))
return;
}
else { /*PART_DRAW_GR */
- if(part->dup_group == NULL || part->dup_group->gobject.first == NULL)
+ if (part->dup_group == NULL || part->dup_group->gobject.first == NULL)
return;
- for(go=part->dup_group->gobject.first; go; go=go->next)
- if(go->ob == par)
+ for (go=part->dup_group->gobject.first; go; go=go->next)
+ if (go->ob == par)
return;
}
/* if we have a hair particle system, use the path cache */
- if(part->type == PART_HAIR) {
- if(psys->flag & PSYS_HAIR_DONE)
+ if (part->type == PART_HAIR) {
+ if (psys->flag & PSYS_HAIR_DONE)
hair= (totchild == 0 || psys->childcache) && psys->pathcache;
- if(!hair)
+ if (!hair)
return;
/* we use cache, update totchild according to cached data */
@@ -1278,15 +1282,15 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
psys->lattice = psys_get_lattice(&sim);
/* gather list of objects or single object */
- if(part->ren_as==PART_DRAW_GR) {
+ if (part->ren_as==PART_DRAW_GR) {
group_handle_recalc_and_update(scene, par, part->dup_group);
- if(part->draw & PART_DRAW_COUNT_GR) {
- for(dw=part->dupliweights.first; dw; dw=dw->next)
+ if (part->draw & PART_DRAW_COUNT_GR) {
+ for (dw=part->dupliweights.first; dw; dw=dw->next)
totgroup += dw->count;
}
else {
- for(go=part->dup_group->gobject.first; go; go=go->next)
+ for (go=part->dup_group->gobject.first; go; go=go->next)
totgroup++;
}
@@ -1296,11 +1300,11 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
obcopylist = MEM_callocN(totgroup*sizeof(Object), "dupgroup copy list");
- if(part->draw & PART_DRAW_COUNT_GR && totgroup) {
+ if (part->draw & PART_DRAW_COUNT_GR && totgroup) {
dw = part->dupliweights.first;
- for(a=0; a<totgroup; dw=dw->next) {
- for(b=0; b<dw->count; b++, a++) {
+ for (a=0; a<totgroup; dw=dw->next) {
+ for (b=0; b<dw->count; b++, a++) {
oblist[a] = dw->ob;
obcopylist[a] = *dw->ob;
}
@@ -1308,7 +1312,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
}
else {
go = part->dup_group->gobject.first;
- for(a=0; a<totgroup; a++, go=go->next) {
+ for (a=0; a<totgroup; a++, go=go->next) {
oblist[a] = go->ob;
obcopylist[a] = *go->ob;
}
@@ -1319,15 +1323,15 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
obcopy = *ob;
}
- if(totchild==0 || part->draw & PART_DRAW_PARENT)
+ if (totchild==0 || part->draw & PART_DRAW_PARENT)
a = 0;
else
a = totpart;
- for(pa=psys->particles,counter=0; a<totpart+totchild; a++,pa++,counter++) {
- if(a<totpart) {
+ for (pa=psys->particles,counter=0; a<totpart+totchild; a++,pa++,counter++) {
+ if (a<totpart) {
/* handle parent particle */
- if(pa->flag & no_draw_flag)
+ if (pa->flag & no_draw_flag)
continue;
/* pa_num = pa->num; */ /* UNUSED */
@@ -1344,18 +1348,18 @@ 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 &&
+ if (hair &&
((a < totpart && psys->pathcache[a]->steps < 0) ||
(a >= totpart && psys->childcache[a-totpart]->steps < 0)))
continue;
- if(part->ren_as==PART_DRAW_GR) {
+ if (part->ren_as==PART_DRAW_GR) {
/* prevent divide by zero below [#28336] */
- if(totgroup == 0)
+ if (totgroup == 0)
continue;
/* for groups, pick the object based on settings */
- if(part->draw&PART_DRAW_RAND_GR)
+ if (part->draw&PART_DRAW_RAND_GR)
b= BLI_rand() % totgroup;
else
b= a % totgroup;
@@ -1369,9 +1373,9 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
oldobmat= obcopy.obmat;
}
- if(hair) {
+ if (hair) {
/* hair we handle separate and compute transform based on hair keys */
- if(a < totpart) {
+ if (a < totpart) {
cache = psys->pathcache[a];
psys_get_dupli_path_transform(&sim, pa, NULL, cache, pamat, &scale);
}
@@ -1387,7 +1391,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
else {
/* first key */
state.time = ctime;
- if(psys_get_particle_state(&sim, a, &state, 0) == 0) {
+ if (psys_get_particle_state(&sim, a, &state, 0) == 0) {
continue;
}
else {
@@ -1399,11 +1403,11 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
}
}
- if(part->ren_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
- for(go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) {
+ if (part->ren_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
+ for (go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) {
/* group dupli offset, should apply after everything else */
- if(!is_zero_v3(part->dup_group->dupli_ofs)) {
+ if (!is_zero_v3(part->dup_group->dupli_ofs)) {
copy_m4_m4(tmat, oblist[b]->obmat);
sub_v3_v3v3(tmat[3], tmat[3], part->dup_group->dupli_ofs);
mult_m4_m4m4(tmat, pamat, tmat);
@@ -1413,14 +1417,14 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
}
mul_mat3_m4_fl(tmat, size*scale);
- if(par_space_mat)
+ if (par_space_mat)
mult_m4_m4m4(mat, par_space_mat, tmat);
else
copy_m4_m4(mat, tmat);
dob= new_dupli_object(lb, go->ob, mat, par->lay, counter, OB_DUPLIPARTS, animated);
copy_m4_m4(dob->omat, obcopylist[b].obmat);
- if(G.rendering)
+ if (G.rendering)
psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
}
}
@@ -1432,7 +1436,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f;
/* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */
- if((part->draw & PART_DRAW_ROTATE_OB) == 0) {
+ if ((part->draw & PART_DRAW_ROTATE_OB) == 0) {
float xvec[3], q[4];
xvec[0] = -1.f;
xvec[1] = xvec[2] = 0;
@@ -1444,7 +1448,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
/* Normal particles and cached hair live in global space so we need to
* remove the real emitter's transformation before 2nd order duplication.
*/
- if(par_space_mat && GS(id->name) != ID_GR)
+ if (par_space_mat && GS(id->name) != ID_GR)
mult_m4_m4m4(mat, psys->imat, pamat);
else
copy_m4_m4(mat, pamat);
@@ -1452,24 +1456,24 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
mult_m4_m4m4(tmat, mat, obmat);
mul_mat3_m4_fl(tmat, size*scale);
- if(par_space_mat)
+ if (par_space_mat)
mult_m4_m4m4(mat, par_space_mat, tmat);
else
copy_m4_m4(mat, tmat);
- if(part->draw & PART_DRAW_GLOBAL_OB)
+ if (part->draw & PART_DRAW_GLOBAL_OB)
add_v3_v3v3(mat[3], mat[3], vec);
dob= new_dupli_object(lb, ob, mat, ob->lay, counter, GS(id->name) == ID_GR ? OB_DUPLIGROUP : OB_DUPLIPARTS, animated);
copy_m4_m4(dob->omat, oldobmat);
- if(G.rendering)
+ if (G.rendering)
psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
}
}
/* restore objects since they were changed in where_is_object_time */
- if(part->ren_as==PART_DRAW_GR) {
- for(a=0; a<totgroup; a++)
+ if (part->ren_as==PART_DRAW_GR) {
+ for (a=0; a<totgroup; a++)
*(oblist[a])= obcopylist[a];
}
else
@@ -1477,12 +1481,12 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
}
/* clean up */
- if(oblist)
+ if (oblist)
MEM_freeN(oblist);
- if(obcopylist)
+ if (obcopylist)
MEM_freeN(obcopylist);
- if(psys->lattice) {
+ if (psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice = NULL;
}
@@ -1493,14 +1497,14 @@ static Object *find_family_object(Object **obar, char *family, char ch)
Object *ob;
int flen;
- if( obar[(int)ch] ) return obar[(int)ch];
+ if ( obar[(int)ch] ) return obar[(int)ch];
flen= strlen(family);
ob= G.main->object.first;
- while(ob) {
- if( ob->id.name[flen+2]==ch ) {
- if( strncmp(ob->id.name+2, family, flen)==0 ) break;
+ while (ob) {
+ if ( ob->id.name[flen+2]==ch ) {
+ if ( strncmp(ob->id.name+2, family, flen)==0 ) break;
}
ob= ob->id.next;
}
@@ -1520,14 +1524,14 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
int slen, a;
/* simple preventing of too deep nested groups */
- if(level>MAX_DUPLI_RECUR) return;
+ if (level>MAX_DUPLI_RECUR) return;
copy_m4_m4(pmat, par->obmat);
/* in par the family name is stored, use this to find the other objects */
chartransdata= BKE_text_to_curve(G.main, scene, par, FO_DUPLI);
- if(chartransdata==NULL) return;
+ if (chartransdata==NULL) return;
cu= par->data;
slen= strlen(cu->str);
@@ -1537,10 +1541,10 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
ct= chartransdata;
- for(a=0; a<slen; a++, ct++) {
+ for (a=0; a<slen; a++, ct++) {
ob= find_family_object(obar, cu->family, cu->str[a]);
- if(ob) {
+ if (ob) {
vec[0]= fsize*(ct->xof - xof);
vec[1]= fsize*(ct->yof - yof);
vec[2]= 0.0;
@@ -1561,7 +1565,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level, int animated)
{
- if((ob->transflag & OB_DUPLI)==0)
+ if ((ob->transflag & OB_DUPLI)==0)
return;
/* Should the dupli's be generated for this object? - Respect restrict flags */
@@ -1569,43 +1573,45 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
if (ob->restrictflag & OB_RESTRICT_RENDER) {
return;
}
- } else {
+ }
+ else {
if (ob->restrictflag & OB_RESTRICT_VIEW) {
return;
}
}
- if(ob->transflag & OB_DUPLIPARTS) {
+ if (ob->transflag & OB_DUPLIPARTS) {
ParticleSystem *psys = ob->particlesystem.first;
- for(; psys; psys=psys->next)
+ for (; psys; psys=psys->next)
new_particle_duplilist(duplilist, id, scene, ob, par_space_mat, psys, level+1, animated);
}
- else if(ob->transflag & OB_DUPLIVERTS) {
- if(ob->type==OB_MESH) {
+ else if (ob->transflag & OB_DUPLIVERTS) {
+ if (ob->type==OB_MESH) {
vertex_duplilist(duplilist, id, scene, ob, par_space_mat, level+1, animated);
}
- else if(ob->type==OB_FONT) {
+ else if (ob->type==OB_FONT) {
if (GS(id->name)==ID_SCE) { /* TODO - support dupligroups */
font_duplilist(duplilist, scene, ob, level+1, animated);
}
}
}
- else if(ob->transflag & OB_DUPLIFACES) {
- if(ob->type==OB_MESH)
+ else if (ob->transflag & OB_DUPLIFACES) {
+ if (ob->type==OB_MESH)
face_duplilist(duplilist, id, scene, ob, par_space_mat, level+1, animated);
}
- else if(ob->transflag & OB_DUPLIFRAMES) {
+ else if (ob->transflag & OB_DUPLIFRAMES) {
if (GS(id->name)==ID_SCE) { /* TODO - support dupligroups */
frames_duplilist(duplilist, scene, ob, level+1, animated);
}
- } else if(ob->transflag & OB_DUPLIGROUP) {
+ }
+ else if (ob->transflag & OB_DUPLIGROUP) {
DupliObject *dob;
group_duplilist(duplilist, scene, ob, level+1, animated); /* now recursive */
if (level==0) {
- for(dob= duplilist->first; dob; dob= dob->next)
- if(dob->type == OB_DUPLIGROUP)
+ for (dob= duplilist->first; dob; dob= dob->next)
+ if (dob->type == OB_DUPLIGROUP)
copy_m4_m4(dob->ob->obmat, dob->mat);
}
}
@@ -1628,7 +1634,7 @@ void free_object_duplilist(ListBase *lb)
/* loop in reverse order, if object is instanced multiple times
* the original layer may not really be original otherwise, proper
* solution is more complicated */
- for(dob= lb->last; dob; dob= dob->prev) {
+ for (dob= lb->last; dob; dob= dob->prev) {
dob->ob->lay= dob->origlay;
copy_m4_m4(dob->ob->obmat, dob->omat);
}
@@ -1639,17 +1645,17 @@ void free_object_duplilist(ListBase *lb)
int count_duplilist(Object *ob)
{
- if(ob->transflag & OB_DUPLI) {
- if(ob->transflag & OB_DUPLIVERTS) {
- if(ob->type==OB_MESH) {
- if(ob->transflag & OB_DUPLIVERTS) {
+ if (ob->transflag & OB_DUPLI) {
+ if (ob->transflag & OB_DUPLIVERTS) {
+ if (ob->type==OB_MESH) {
+ if (ob->transflag & OB_DUPLIVERTS) {
ParticleSystem *psys = ob->particlesystem.first;
int pdup=0;
- for(; psys; psys=psys->next)
+ for (; psys; psys=psys->next)
pdup += psys->totpart;
- if(pdup==0) {
+ if (pdup==0) {
Mesh *me= ob->data;
return me->totvert;
}
@@ -1658,7 +1664,7 @@ int count_duplilist(Object *ob)
}
}
}
- else if(ob->transflag & OB_DUPLIFRAMES) {
+ else if (ob->transflag & OB_DUPLIFRAMES) {
int tot= ob->dupend - ob->dupsta;
tot/= (ob->dupon+ob->dupoff);
return tot*ob->dupon;
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index aa01aecf98d..4cf21dbdfdc 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1039,7 +1039,7 @@ void BKE_keyingset_free_path (KeyingSet *ks, KS_Path *ksp)
return;
/* free RNA-path info */
- if(ksp->rna_path)
+ if (ksp->rna_path)
MEM_freeN(ksp->rna_path);
/* free path itself */
@@ -1201,7 +1201,7 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
/* as long as we don't do property update, we still tag datablock
* as having been updated. this flag does not cause any updates to
* be run, it's for e.g. render engines to synchronize data */
- if(new_ptr.id.data) {
+ if (new_ptr.id.data) {
ID *id= new_ptr.id.data;
id->flag |= LIB_ID_RECALC;
DAG_id_type_tag(G.main, GS(id->name));
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 9bf8de4a2e1..0f3e27a9b6e 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1513,8 +1513,11 @@ void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3])
*
* was 0.00001, causes bug [#27675], with 0.00000495,
* so a value inbetween these is needed.
+ *
+ * was 0.000001, causes bug [#30438] (which is same as [#27675, imho).
+ * Reseting it to org value seems to cause no more [#23954]...
*/
- if (dot_v3v3(axis,axis) > 0.000001f) {
+ if (dot_v3v3(axis,axis) > 1.0e-13f) {
/* if nor is *not* a multiple of target ... */
normalize_v3(axis);
@@ -2599,3 +2602,54 @@ int get_selected_defgroups(Object *ob, char *dg_selection, int defbase_tot)
return dg_flags_sel_tot;
}
+
+/************** Bounding box ********************/
+int minmax_armature(Object *ob, float min[3], float max[3])
+{
+ bPoseChannel *pchan;
+
+ /* For now, we assume where_is_pose has already been called (hence we have valid data in pachan). */
+ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+ DO_MINMAX(pchan->pose_head, min, max);
+ DO_MINMAX(pchan->pose_tail, min, max);
+ }
+
+ return (ob->pose->chanbase.first != NULL);
+}
+
+void boundbox_armature(Object *ob, float *loc, float *size)
+{
+ BoundBox *bb;
+ float min[3], max[3];
+ float mloc[3], msize[3];
+
+ if (ob->bb == NULL)
+ ob->bb = MEM_callocN(sizeof(BoundBox), "Armature boundbox");
+ bb = ob->bb;
+
+ if (!loc)
+ loc = mloc;
+ if (!size)
+ size = msize;
+
+ INIT_MINMAX(min, max);
+ if (!minmax_armature(ob, min, max)) {
+ min[0] = min[1] = min[2] = -1.0f;
+ max[0] = max[1] = max[2] = 1.0f;
+ }
+
+ mid_v3_v3v3(loc, min, max);
+
+ size[0] = (max[0] - min[0]) / 2.0f;
+ size[1] = (max[1] - min[1]) / 2.0f;
+ size[2] = (max[2] - min[2]) / 2.0f;
+
+ boundbox_set_from_min_max(bb, min, max);
+}
+
+BoundBox *BKE_armature_get_bb(Object *ob)
+{
+ boundbox_armature(ob, NULL, NULL);
+
+ return ob->bb;
+}
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index a8644618945..26c59129914 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -31,13 +31,13 @@
#ifndef _WIN32
- #include <unistd.h> // for read close
+# include <unistd.h> // for read close
#else
- #include <io.h> // for open close read
- #define open _open
- #define read _read
- #define close _close
- #define write _write
+# include <io.h> // for open close read
+# define open _open
+# define read _read
+# define close _close
+# define write _write
#endif
#include <stdlib.h>
@@ -127,7 +127,7 @@ void initglobals(void)
strcpy(G.ima, "//");
- if(BLENDER_SUBVERSION)
+ if (BLENDER_SUBVERSION)
BLI_snprintf(versionstr, sizeof(versionstr), "blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION);
else
BLI_snprintf(versionstr, sizeof(versionstr), "blender.org %d", BLENDER_VERSION);
@@ -174,7 +174,7 @@ static void clean_paths(Main *main)
bpath_traverse_main(main, clean_paths_visit_cb, BPATH_TRAVERSE_SKIP_MULTIFILE, NULL);
- for(scene= main->scene.first; scene; scene= scene->id.next) {
+ for (scene= main->scene.first; scene; scene= scene->id.next) {
BLI_clean(scene->r.pic);
}
}
@@ -193,21 +193,21 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
char mode;
/* 'u' = undo save, 'n' = no UI load */
- if(bfd->main->screen.first==NULL) mode= 'u';
- else if(G.fileflags & G_FILE_NO_UI) mode= 'n';
+ if (bfd->main->screen.first==NULL) mode= 'u';
+ else if (G.fileflags & G_FILE_NO_UI) mode= 'n';
else mode= 0;
recover= (G.fileflags & G_FILE_RECOVER);
/* Only make filepaths compatible when loading for real (not undo) */
- if(mode != 'u') {
+ if (mode != 'u') {
clean_paths(bfd->main);
}
/* XXX here the complex windowmanager matching */
/* no load screens? */
- if(mode) {
+ if (mode) {
/* comes from readfile.c */
extern void lib_link_screen_restore(Main *, bScreen *, Scene *);
@@ -219,9 +219,9 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
curscreen= CTX_wm_screen(C);
/* but use new Scene pointer */
curscene= bfd->curscene;
- if(curscene==NULL) curscene= bfd->main->scene.first;
+ if (curscene==NULL) curscene= bfd->main->scene.first;
/* and we enforce curscene to be in current screen */
- if(curscreen) curscreen->scene= curscene; /* can run in bgmode */
+ if (curscreen) curscreen->scene= curscene; /* can run in bgmode */
/* clear_global will free G.main, here we can still restore pointers */
lib_link_screen_restore(bfd->main, curscreen, curscene);
@@ -250,7 +250,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
}
/* case G_FILE_NO_UI or no screens in file */
- if(mode) {
+ if (mode) {
/* leave entire context further unaltered? */
CTX_data_scene_set(C, curscene);
}
@@ -267,14 +267,14 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
}
/* this can happen when active scene was lib-linked, and doesnt exist anymore */
- if(CTX_data_scene(C)==NULL) {
+ if (CTX_data_scene(C)==NULL) {
CTX_data_scene_set(C, bfd->main->scene.first);
CTX_wm_screen(C)->scene= CTX_data_scene(C);
curscene= CTX_data_scene(C);
}
/* special cases, override loaded flags: */
- if(G.f != bfd->globalf) {
+ if (G.f != bfd->globalf) {
const int flags_keep= (G_DEBUG | G_SWAP_EXCHANGE | G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
bfd->globalf= (bfd->globalf & ~flags_keep) | (G.f & flags_keep);
}
@@ -291,7 +291,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
if (G.main->versionfile < 250)
do_versions_ipos_to_animato(G.main);
- if(recover && bfd->filename[0] && G.relbase_valid) {
+ if (recover && bfd->filename[0] && G.relbase_valid) {
/* in case of autosave or quit.blend, use original filename instead
* use relbase_valid to make sure the file is saved, else we get <memory2> in the filename */
filepath= bfd->filename;
@@ -304,7 +304,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
#endif
/* these are the same at times, should never copy to the same location */
- if(G.main->name != filepath)
+ if (G.main->name != filepath)
BLI_strncpy(G.main->name, filepath, FILE_MAX);
/* baseflags, groups, make depsgraph, etc */
@@ -317,7 +317,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
static int handle_subversion_warning(Main *main, ReportList *reports)
{
- if(main->minversionfile > BLENDER_VERSION ||
+ if (main->minversionfile > BLENDER_VERSION ||
(main->minversionfile == BLENDER_VERSION &&
main->minsubversionfile > BLENDER_SUBVERSION)) {
BKE_reportf(reports, RPT_ERROR, "File written by newer Blender binary: %d.%d , expect loss of data!", main->minversionfile, main->minsubversionfile);
@@ -328,11 +328,11 @@ static int handle_subversion_warning(Main *main, ReportList *reports)
static void keymap_item_free(wmKeyMapItem *kmi)
{
- if(kmi->properties) {
+ if (kmi->properties) {
IDP_FreeProperty(kmi->properties);
MEM_freeN(kmi->properties);
}
- if(kmi->ptr)
+ if (kmi->ptr)
MEM_freeN(kmi->ptr);
}
@@ -342,19 +342,19 @@ void BKE_userdef_free(void)
wmKeyMapItem *kmi;
wmKeyMapDiffItem *kmdi;
- for(km=U.user_keymaps.first; km; km=km->next) {
- for(kmdi=km->diff_items.first; kmdi; kmdi=kmdi->next) {
- if(kmdi->add_item) {
+ for (km=U.user_keymaps.first; km; km=km->next) {
+ for (kmdi=km->diff_items.first; kmdi; kmdi=kmdi->next) {
+ if (kmdi->add_item) {
keymap_item_free(kmdi->add_item);
MEM_freeN(kmdi->add_item);
}
- if(kmdi->remove_item) {
+ if (kmdi->remove_item) {
keymap_item_free(kmdi->remove_item);
MEM_freeN(kmdi->remove_item);
}
}
- for(kmi=km->items.first; kmi; kmi=kmi->next)
+ for (kmi=km->items.first; kmi; kmi=kmi->next)
keymap_item_free(kmi);
BLI_freelistN(&km->diff_items);
@@ -373,14 +373,14 @@ int BKE_read_file(bContext *C, const char *filepath, ReportList *reports)
BlendFileData *bfd;
int retval= BKE_READ_FILE_OK;
- if(strstr(filepath, BLENDER_STARTUP_FILE)==NULL) /* dont print user-pref loading */
+ if (strstr(filepath, BLENDER_STARTUP_FILE)==NULL) /* don't print user-pref loading */
printf("read blend: %s\n", filepath);
bfd= BLO_read_from_file(filepath, reports);
if (bfd) {
- if(bfd->user) retval= BKE_READ_FILE_OK_USERPREFS;
+ if (bfd->user) retval= BKE_READ_FILE_OK_USERPREFS;
- if(0==handle_subversion_warning(bfd->main, reports)) {
+ if (0==handle_subversion_warning(bfd->main, reports)) {
free_main(bfd->main);
MEM_freeN(bfd);
bfd= NULL;
@@ -474,7 +474,7 @@ static int read_undosave(bContext *C, UndoElem *uel)
fileflags= G.fileflags;
G.fileflags |= G_FILE_NO_UI;
- if(UNDO_DISK)
+ if (UNDO_DISK)
success= (BKE_read_file(C, uel->str, NULL) != BKE_READ_FILE_FAIL);
else
success= BKE_read_file_from_memfile(C, &uel->memfile, NULL);
@@ -483,7 +483,7 @@ static int read_undosave(bContext *C, UndoElem *uel)
BLI_strncpy(G.main->name, mainstr, sizeof(G.main->name)); /* restore */
G.fileflags= fileflags;
- if(success) {
+ if (success) {
/* important not to update time here, else non keyed tranforms are lost */
DAG_on_visible_update(G.main, FALSE);
}
@@ -498,11 +498,11 @@ void BKE_write_undo(bContext *C, const char *name)
int nr /*, success */ /* UNUSED */;
UndoElem *uel;
- if( (U.uiflag & USER_GLOBALUNDO)==0) return;
- if( U.undosteps==0) return;
+ if ( (U.uiflag & USER_GLOBALUNDO)==0) return;
+ if ( U.undosteps==0) return;
/* remove all undos after (also when curundo==NULL) */
- while(undobase.last != curundo) {
+ while (undobase.last != curundo) {
uel= undobase.last;
BLI_remlink(&undobase, uel);
BLO_free_memfile(&uel->memfile);
@@ -517,13 +517,13 @@ void BKE_write_undo(bContext *C, const char *name)
/* and limit amount to the maximum */
nr= 0;
uel= undobase.last;
- while(uel) {
+ while (uel) {
nr++;
- if(nr==U.undosteps) break;
+ if (nr==U.undosteps) break;
uel= uel->prev;
}
- if(uel) {
- while(undobase.first!=uel) {
+ if (uel) {
+ while (undobase.first!=uel) {
UndoElem *first= undobase.first;
BLI_remlink(&undobase, first);
/* the merge is because of compression */
@@ -534,7 +534,7 @@ void BKE_write_undo(bContext *C, const char *name)
/* disk save version */
- if(UNDO_DISK) {
+ if (UNDO_DISK) {
static int counter= 0;
char filepath[FILE_MAX];
char numstr[32];
@@ -554,31 +554,31 @@ void BKE_write_undo(bContext *C, const char *name)
else {
MemFile *prevfile=NULL;
- if(curundo->prev) prevfile= &(curundo->prev->memfile);
+ if (curundo->prev) prevfile= &(curundo->prev->memfile);
memused= MEM_get_memory_in_use();
/* success= */ /* UNUSED */ BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags);
curundo->undosize= MEM_get_memory_in_use() - memused;
}
- if(U.undomemory != 0) {
+ if (U.undomemory != 0) {
/* limit to maximum memory (afterwards, we can't know in advance) */
totmem= 0;
maxmem= ((uintptr_t)U.undomemory)*1024*1024;
/* keep at least two (original + other) */
uel= undobase.last;
- while(uel && uel->prev) {
+ while (uel && uel->prev) {
totmem+= uel->undosize;
- if(totmem>maxmem) break;
+ if (totmem>maxmem) break;
uel= uel->prev;
}
- if(uel) {
- if(uel->prev && uel->prev->prev)
+ if (uel) {
+ if (uel->prev && uel->prev->prev)
uel= uel->prev;
- while(undobase.first!=uel) {
+ while (undobase.first!=uel) {
UndoElem *first= undobase.first;
BLI_remlink(&undobase, first);
/* the merge is because of compression */
@@ -593,14 +593,14 @@ void BKE_write_undo(bContext *C, const char *name)
void BKE_undo_step(bContext *C, int step)
{
- if(step==0) {
+ if (step==0) {
read_undosave(C, curundo);
}
- else if(step==1) {
+ else if (step==1) {
/* curundo should never be NULL, after restart or load file it should call undo_save */
- if(curundo==NULL || curundo->prev==NULL) ; // XXX error("No undo available");
+ if (curundo==NULL || curundo->prev==NULL) ; // XXX error("No undo available");
else {
- if(G.f & G_DEBUG) printf("undo %s\n", curundo->name);
+ if (G.f & G_DEBUG) printf("undo %s\n", curundo->name);
curundo= curundo->prev;
read_undosave(C, curundo);
}
@@ -609,11 +609,11 @@ void BKE_undo_step(bContext *C, int step)
/* curundo has to remain current situation! */
- if(curundo==NULL || curundo->next==NULL) ; // XXX error("No redo available");
+ if (curundo==NULL || curundo->next==NULL) ; // XXX error("No redo available");
else {
read_undosave(C, curundo->next);
curundo= curundo->next;
- if(G.f & G_DEBUG) printf("redo %s\n", curundo->name);
+ if (G.f & G_DEBUG) printf("redo %s\n", curundo->name);
}
}
}
@@ -623,7 +623,7 @@ void BKE_reset_undo(void)
UndoElem *uel;
uel= undobase.first;
- while(uel) {
+ while (uel) {
BLO_free_memfile(&uel->memfile);
uel= uel->next;
}
@@ -644,7 +644,7 @@ void BKE_undo_name(bContext *C, const char *name)
{
UndoElem *uel= BLI_rfindstring(&undobase, name, offsetof(UndoElem, name));
- if(uel && uel->prev) {
+ if (uel && uel->prev) {
curundo= uel->prev;
BKE_undo_step(C, 0);
}
@@ -653,7 +653,7 @@ void BKE_undo_name(bContext *C, const char *name)
/* name optional */
int BKE_undo_valid(const char *name)
{
- if(name) {
+ if (name) {
UndoElem *uel= BLI_rfindstring(&undobase, name, offsetof(UndoElem, name));
return uel && uel->prev;
}
@@ -667,10 +667,10 @@ const char *BKE_undo_get_name(int nr, int *active)
{
UndoElem *uel= BLI_findlink(&undobase, nr);
- if(active) *active= 0;
+ if (active) *active= 0;
- if(uel) {
- if(active && uel==curundo)
+ if (uel) {
+ if (active && uel==curundo)
*active= 1;
return uel->name;
}
@@ -685,7 +685,7 @@ char *BKE_undo_menu_string(void)
BLI_dynstr_append(ds, "Global Undo History %t");
- for(uel= undobase.first; uel; uel= uel->next) {
+ for (uel= undobase.first; uel; uel= uel->next) {
BLI_dynstr_append(ds, "|");
BLI_dynstr_append(ds, uel->name);
}
@@ -704,34 +704,34 @@ void BKE_undo_save_quit(void)
int file;
char str[FILE_MAX];
- if( (U.uiflag & USER_GLOBALUNDO)==0) return;
+ if ( (U.uiflag & USER_GLOBALUNDO)==0) return;
uel= curundo;
- if(uel==NULL) {
+ if (uel==NULL) {
printf("No undo buffer to save recovery file\n");
return;
}
/* no undo state to save */
- if(undobase.first==undobase.last) return;
+ if (undobase.first==undobase.last) return;
BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend");
- file = open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
- if(file == -1) {
+ file = BLI_open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
+ if (file == -1) {
//XXX error("Unable to save %s, check you have permissions", str);
return;
}
chunk= uel->memfile.chunks.first;
- while(chunk) {
- if( write(file, chunk->buf, chunk->size) != chunk->size) break;
+ while (chunk) {
+ if ( write(file, chunk->buf, chunk->size) != chunk->size) break;
chunk= chunk->next;
}
close(file);
- if(chunk) ; //XXX error("Unable to save %s, internal error", str);
+ if (chunk) ; //XXX error("Unable to save %s, internal error", str);
else printf("Saved session recovery to %s\n", str);
}
@@ -741,9 +741,9 @@ Main *BKE_undo_get_main(Scene **scene)
Main *mainp= NULL;
BlendFileData *bfd= BLO_read_from_memfile(G.main, G.main->name, &curundo->memfile, NULL);
- if(bfd) {
+ if (bfd) {
mainp= bfd->main;
- if(scene)
+ if (scene)
*scene= bfd->curscene;
MEM_freeN(bfd);
diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c
index 0211dcdf42c..278dbe30a95 100644
--- a/source/blender/blenkernel/intern/bmfont.c
+++ b/source/blender/blenkernel/intern/bmfont.c
@@ -163,7 +163,8 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
// we're going to fake alpha here:
calcAlpha(ibuf);
}
- } else {
+ }
+ else {
printf("readBitmapFontVersion0: corrupted bitmapfont\n");
}
}
@@ -183,7 +184,8 @@ void detectBitmapFont(ImBuf *ibuf)
// printf("found 8bit font !\n");
// round y size down
// do the 8 bit font stuff. (not yet)
- } else {
+ }
+ else {
// we try all 4 possible combinations
for (i = 0; i < 4; i++) {
if (rect[0] == 'B' && rect[4] == 'F' && rect[8] == 'N' && rect[12] == 'T') {
@@ -194,7 +196,8 @@ void detectBitmapFont(ImBuf *ibuf)
if (version == 0) {
readBitmapFontVersion0(ibuf, rect, 4);
- } else {
+ }
+ else {
printf("detectBitmapFont :Unsupported version %d\n", version);
}
@@ -223,10 +226,12 @@ int locateGlyph(bmFont *bmfont, unsigned short unicode)
if (bmfont->glyphs[current].unicode == unicode) {
break;
- } else if (bmfont->glyphs[current].unicode < unicode) {
+ }
+ else if (bmfont->glyphs[current].unicode < unicode) {
// have to move up
min = current;
- } else {
+ }
+ else {
// have to move down
max = current;
}
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 8fa0a46f6da..a14988d78b1 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -83,15 +83,15 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
pd_point_from_particle(bbd->sim, pa, &pa->state, &epoint);
/* first find out goal/predator with highest priority */
- if(effectors) for(cur = effectors->first; cur; cur=cur->next) {
+ if (effectors) for (cur = effectors->first; cur; cur=cur->next) {
Object *eob = cur->ob;
PartDeflect *pd = cur->pd;
- if(gabr->ob && (rule->type != eBoidRuleType_Goal || gabr->ob != bpa->ground)) {
- if(gabr->ob == eob) {
+ if (gabr->ob && (rule->type != eBoidRuleType_Goal || gabr->ob != bpa->ground)) {
+ if (gabr->ob == eob) {
/* TODO: effectors with multiple points */
- if(get_effector_data(cur, &efd, &epoint, 0)) {
- if(cur->pd && cur->pd->forcefield == PFIELD_BOID)
+ if (get_effector_data(cur, &efd, &epoint, 0)) {
+ if (cur->pd && cur->pd->forcefield == PFIELD_BOID)
priority = mul * pd->f_strength * effector_falloff(cur, &efd, &epoint, bbd->part->effector_weights);
else
priority = 1.0;
@@ -101,21 +101,21 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
break;
}
}
- else if(rule->type == eBoidRuleType_Goal && eob == bpa->ground)
+ else if (rule->type == eBoidRuleType_Goal && eob == bpa->ground)
; /* skip current object */
- else if(pd->forcefield == PFIELD_BOID && mul * pd->f_strength > 0.0f && get_effector_data(cur, &cur_efd, &epoint, 0)) {
+ else if (pd->forcefield == PFIELD_BOID && mul * pd->f_strength > 0.0f && get_effector_data(cur, &cur_efd, &epoint, 0)) {
float temp = mul * pd->f_strength * effector_falloff(cur, &cur_efd, &epoint, bbd->part->effector_weights);
- if(temp == 0.0f)
+ if (temp == 0.0f)
; /* do nothing */
- else if(temp > priority) {
+ else if (temp > priority) {
priority = temp;
eff = cur;
efd = cur_efd;
len = efd.distance;
}
/* choose closest object with same priority */
- else if(temp == priority && efd.distance < len) {
+ else if (temp == priority && efd.distance < len) {
eff = cur;
efd = cur_efd;
len = efd.distance;
@@ -124,7 +124,7 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
}
/* if the object doesn't have effector data we have to fake it */
- if(eff == NULL && gabr->ob) {
+ if (eff == NULL && gabr->ob) {
memset(&temp_eff, 0, sizeof(EffectorCache));
temp_eff.ob = gabr->ob;
temp_eff.scene = bbd->sim->scene;
@@ -134,12 +134,12 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
}
/* then use that effector */
- if(priority > (rule->type==eBoidRuleType_Avoid ? gabr->fear_factor : 0.0f)) { /* with avoid, factor is "fear factor" */
+ if (priority > (rule->type==eBoidRuleType_Avoid ? gabr->fear_factor : 0.0f)) { /* with avoid, factor is "fear factor" */
Object *eob = eff->ob;
PartDeflect *pd = eff->pd;
float surface = (pd && pd->shape == PFIELD_SHAPE_SURFACE) ? 1.0f : 0.0f;
- if(gabr->options & BRULE_GOAL_AVOID_PREDICT) {
+ if (gabr->options & BRULE_GOAL_AVOID_PREDICT) {
/* estimate future location of target */
get_effector_data(eff, &efd, &epoint, 1);
@@ -149,14 +149,14 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
efd.distance = len_v3(efd.vec_to_point);
}
- if(rule->type == eBoidRuleType_Goal && boids->options & BOID_ALLOW_CLIMB && surface!=0.0f) {
- if(!bbd->goal_ob || bbd->goal_priority < priority) {
+ if (rule->type == eBoidRuleType_Goal && boids->options & BOID_ALLOW_CLIMB && surface!=0.0f) {
+ if (!bbd->goal_ob || bbd->goal_priority < priority) {
bbd->goal_ob = eob;
copy_v3_v3(bbd->goal_co, efd.loc);
copy_v3_v3(bbd->goal_nor, efd.nor);
}
}
- else if(rule->type == eBoidRuleType_Avoid && bpa->data.mode == eBoidMode_Climbing &&
+ else if (rule->type == eBoidRuleType_Avoid && bpa->data.mode == eBoidMode_Climbing &&
priority > 2.0f * gabr->fear_factor) {
/* detach from surface and try to fly away from danger */
negate_v3_v3(efd.vec_to_point, bpa->gravity);
@@ -168,12 +168,12 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
bbd->wanted_speed = val->max_speed * priority;
/* with goals factor is approach velocity factor */
- if(rule->type == eBoidRuleType_Goal && boids->landing_smoothness > 0.0f) {
+ if (rule->type == eBoidRuleType_Goal && boids->landing_smoothness > 0.0f) {
float len2 = 2.0f*len_v3(pa->prev_state.vel);
surface *= pa->size * boids->height;
- if(len2 > 0.0f && efd.distance - surface < len2) {
+ if (len2 > 0.0f && efd.distance - surface < len2) {
len2 = (efd.distance - surface)/len2;
bbd->wanted_speed *= powf(len2, boids->landing_smoothness);
}
@@ -199,7 +199,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
int ret = 0;
//check deflector objects first
- if(acbr->options & BRULE_ACOLL_WITH_DEFLECTORS && bbd->sim->colliders) {
+ if (acbr->options & BRULE_ACOLL_WITH_DEFLECTORS && bbd->sim->colliders) {
ParticleCollision col;
BVHTreeRayHit hit;
float radius = val->personal_space * pa->size, ray_dir[3];
@@ -213,23 +213,23 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
hit.dist = col.original_ray_length = len_v3(ray_dir);
/* find out closest deflector object */
- for(coll = bbd->sim->colliders->first; coll; coll=coll->next) {
+ for (coll = bbd->sim->colliders->first; coll; coll=coll->next) {
/* don't check with current ground object */
- if(coll->ob == bpa->ground)
+ if (coll->ob == bpa->ground)
continue;
col.current = coll->ob;
col.md = coll->collmd;
- if(col.md && col.md->bvhtree)
+ if (col.md && col.md->bvhtree)
BLI_bvhtree_ray_cast(col.md->bvhtree, col.co1, ray_dir, radius, &hit, BKE_psys_collision_neartest_cb, &col);
}
/* then avoid that object */
- if(hit.index>=0) {
+ if (hit.index>=0) {
t = hit.dist/col.original_ray_length;
/* avoid head-on collision */
- if(dot_v3v3(col.pce.nor, pa->prev_state.ave) < -0.99f) {
+ if (dot_v3v3(col.pce.nor, pa->prev_state.ave) < -0.99f) {
/* don't know why, but uneven range [0.0,1.0] */
/* works much better than even [-1.0,1.0] */
bbd->wanted_co[0] = BLI_frand();
@@ -252,7 +252,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
//check boids in own system
if (acbr->options & BRULE_ACOLL_WITH_BOIDS) {
neighbors = BLI_kdtree_range_search(bbd->sim->psys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn);
- if(neighbors > 1) for(n=1; n<neighbors; n++) {
+ if (neighbors > 1) for (n=1; n<neighbors; n++) {
copy_v3_v3(co1, pa->prev_state.co);
copy_v3_v3(vel1, pa->prev_state.vel);
copy_v3_v3(co2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.co);
@@ -265,10 +265,10 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
inp = dot_v3v3(vec,vec);
/* velocities not parallel */
- if(inp != 0.0f) {
+ if (inp != 0.0f) {
t = -dot_v3v3(loc, vec)/inp;
/* cpa is not too far in the future so investigate further */
- if(t > 0.0f && t < t_min) {
+ if (t > 0.0f && t < t_min) {
madd_v3_v3fl(co1, vel1, t);
madd_v3_v3fl(co2, vel2, t);
@@ -277,7 +277,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
len = normalize_v3(vec);
/* distance of cpa is close enough */
- if(len < 2.0f * val->personal_space * pa->size) {
+ if (len < 2.0f * val->personal_space * pa->size) {
t_min = t;
mul_v3_fl(vec, len_v3(vel1));
@@ -293,12 +293,12 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
if (ptn) { MEM_freeN(ptn); ptn=NULL; }
/* check boids in other systems */
- for(pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
+ for (pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
ParticleSystem *epsys = psys_get_target_system(bbd->sim->ob, pt);
- if(epsys) {
+ if (epsys) {
neighbors = BLI_kdtree_range_search(epsys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn);
- if(neighbors > 0) for(n=0; n<neighbors; n++) {
+ if (neighbors > 0) for (n=0; n<neighbors; n++) {
copy_v3_v3(co1, pa->prev_state.co);
copy_v3_v3(vel1, pa->prev_state.vel);
copy_v3_v3(co2, (epsys->particles + ptn[n].index)->prev_state.co);
@@ -311,10 +311,10 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
inp = dot_v3v3(vec,vec);
/* velocities not parallel */
- if(inp != 0.0f) {
+ if (inp != 0.0f) {
t = -dot_v3v3(loc, vec)/inp;
/* cpa is not too far in the future so investigate further */
- if(t > 0.0f && t < t_min) {
+ if (t > 0.0f && t < t_min) {
madd_v3_v3fl(co1, vel1, t);
madd_v3_v3fl(co2, vel2, t);
@@ -323,7 +323,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
len = normalize_v3(vec);
/* distance of cpa is close enough */
- if(len < 2.0f * val->personal_space * pa->size) {
+ if (len < 2.0f * val->personal_space * pa->size) {
t_min = t;
mul_v3_fl(vec, len_v3(vel1));
@@ -341,7 +341,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
}
- if(ptn && nearest==0)
+ if (ptn && nearest==0)
MEM_freeN(ptn);
return ret;
@@ -355,7 +355,7 @@ static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues
int neighbors = BLI_kdtree_range_search(bbd->sim->psys->tree, 2.0f * val->personal_space * pa->size, pa->prev_state.co, NULL, &ptn);
int ret = 0;
- if(neighbors > 1 && ptn[1].dist!=0.0f) {
+ if (neighbors > 1 && ptn[1].dist!=0.0f) {
sub_v3_v3v3(vec, pa->prev_state.co, bbd->sim->psys->particles[ptn[1].index].state.co);
mul_v3_fl(vec, (2.0f * val->personal_space * pa->size - ptn[1].dist) / ptn[1].dist);
add_v3_v3(bbd->wanted_co, vec);
@@ -366,13 +366,13 @@ static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues
if (ptn) { MEM_freeN(ptn); ptn=NULL; }
/* check other boid systems */
- for(pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
+ for (pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
ParticleSystem *epsys = psys_get_target_system(bbd->sim->ob, pt);
- if(epsys) {
+ if (epsys) {
neighbors = BLI_kdtree_range_search(epsys->tree, 2.0f * val->personal_space * pa->size, pa->prev_state.co, NULL, &ptn);
- if(neighbors > 0 && ptn[0].dist < len) {
+ if (neighbors > 0 && ptn[0].dist < len) {
sub_v3_v3v3(vec, pa->prev_state.co, ptn[0].co);
mul_v3_fl(vec, (2.0f * val->personal_space * pa->size - ptn[0].dist) / ptn[1].dist);
add_v3_v3(bbd->wanted_co, vec);
@@ -394,8 +394,8 @@ static int rule_flock(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues *UN
int n;
int ret = 0;
- if(neighbors > 1) {
- for(n=1; n<neighbors; n++) {
+ if (neighbors > 1) {
+ for (n=1; n<neighbors; n++) {
add_v3_v3(loc, bbd->sim->psys->particles[ptn[n].index].prev_state.co);
add_v3_v3(vec, bbd->sim->psys->particles[ptn[n].index].prev_state.vel);
}
@@ -422,7 +422,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
int n = (flbr->queue_size <= 1) ? bbd->sim->psys->totpart : flbr->queue_size;
int i, ret = 0, p = pa - bbd->sim->psys->particles;
- if(flbr->ob) {
+ if (flbr->ob) {
float vec2[3], t;
/* first check we're not blocking the leader*/
@@ -434,10 +434,10 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
mul = dot_v3v3(vec, vec);
/* leader is not moving */
- if(mul < 0.01f) {
+ if (mul < 0.01f) {
len = len_v3(loc);
/* too close to leader */
- if(len < 2.0f * val->personal_space * pa->size) {
+ if (len < 2.0f * val->personal_space * pa->size) {
copy_v3_v3(bbd->wanted_co, loc);
bbd->wanted_speed = val->max_speed;
return 1;
@@ -447,7 +447,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
t = dot_v3v3(loc, vec)/mul;
/* possible blocking of leader in near future */
- if(t > 0.0f && t < 3.0f) {
+ if (t > 0.0f && t < 3.0f) {
copy_v3_v3(vec2, vec);
mul_v3_fl(vec2, t);
@@ -455,7 +455,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
len = len_v3(vec2);
- if(len < 2.0f * val->personal_space * pa->size) {
+ if (len < 2.0f * val->personal_space * pa->size) {
copy_v3_v3(bbd->wanted_co, vec2);
bbd->wanted_speed = val->max_speed * (3.0f - t)/3.0f;
return 1;
@@ -464,7 +464,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
}
/* not blocking so try to follow leader */
- if(p && flbr->options & BRULE_LEADER_IN_LINE) {
+ if (p && flbr->options & BRULE_LEADER_IN_LINE) {
copy_v3_v3(vec, bbd->sim->psys->particles[p-1].prev_state.vel);
copy_v3_v3(loc, bbd->sim->psys->particles[p-1].prev_state.co);
}
@@ -482,11 +482,11 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
ret = 1;
}
- else if(p % n) {
+ else if (p % n) {
float vec2[3], t, t_min = 3.0f;
/* first check we're not blocking any leaders */
- for(i = 0; i< bbd->sim->psys->totpart; i+=n) {
+ for (i = 0; i< bbd->sim->psys->totpart; i+=n) {
copy_v3_v3(vec, bbd->sim->psys->particles[i].prev_state.vel);
sub_v3_v3v3(loc, pa->prev_state.co, bbd->sim->psys->particles[i].prev_state.co);
@@ -494,10 +494,10 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
mul = dot_v3v3(vec, vec);
/* leader is not moving */
- if(mul < 0.01f) {
+ if (mul < 0.01f) {
len = len_v3(loc);
/* too close to leader */
- if(len < 2.0f * val->personal_space * pa->size) {
+ if (len < 2.0f * val->personal_space * pa->size) {
copy_v3_v3(bbd->wanted_co, loc);
bbd->wanted_speed = val->max_speed;
return 1;
@@ -507,7 +507,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
t = dot_v3v3(loc, vec)/mul;
/* possible blocking of leader in near future */
- if(t > 0.0f && t < t_min) {
+ if (t > 0.0f && t < t_min) {
copy_v3_v3(vec2, vec);
mul_v3_fl(vec2, t);
@@ -515,7 +515,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
len = len_v3(vec2);
- if(len < 2.0f * val->personal_space * pa->size) {
+ if (len < 2.0f * val->personal_space * pa->size) {
t_min = t;
copy_v3_v3(bbd->wanted_co, loc);
bbd->wanted_speed = val->max_speed * (3.0f - t)/3.0f;
@@ -525,10 +525,10 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
}
}
- if(ret) return 1;
+ if (ret) return 1;
/* not blocking so try to follow leader */
- if(flbr->options & BRULE_LEADER_IN_LINE) {
+ if (flbr->options & BRULE_LEADER_IN_LINE) {
copy_v3_v3(vec, bbd->sim->psys->particles[p-1].prev_state.vel);
copy_v3_v3(loc, bbd->sim->psys->particles[p-1].prev_state.co);
}
@@ -554,7 +554,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
BoidRuleAverageSpeed *asbr = (BoidRuleAverageSpeed*)rule;
float vec[3] = {0.0f, 0.0f, 0.0f};
- if(asbr->wander > 0.0f) {
+ if (asbr->wander > 0.0f) {
/* abuse pa->r_ave for wandering */
bpa->wander[0] += asbr->wander * (-1.0f + 2.0f * BLI_frand());
bpa->wander[1] += asbr->wander * (-1.0f + 2.0f * BLI_frand());
@@ -573,7 +573,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
add_v3_v3(bbd->wanted_co, vec);
/* leveling */
- if(asbr->level > 0.0f && psys_uses_gravity(bbd->sim)) {
+ if (asbr->level > 0.0f && psys_uses_gravity(bbd->sim)) {
project_v3_v3v3(vec, bbd->wanted_co, bbd->sim->scene->physics_settings.gravity);
mul_v3_fl(vec, asbr->level);
sub_v3_v3(bbd->wanted_co, vec);
@@ -583,14 +583,14 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
copy_v3_v3(bbd->wanted_co, pa->prev_state.ave);
/* may happen at birth */
- if(dot_v2v2(bbd->wanted_co,bbd->wanted_co)==0.0f) {
+ if (dot_v2v2(bbd->wanted_co,bbd->wanted_co)==0.0f) {
bbd->wanted_co[0] = 2.0f*(0.5f - BLI_frand());
bbd->wanted_co[1] = 2.0f*(0.5f - BLI_frand());
bbd->wanted_co[2] = 2.0f*(0.5f - BLI_frand());
}
/* leveling */
- if(asbr->level > 0.0f && psys_uses_gravity(bbd->sim)) {
+ if (asbr->level > 0.0f && psys_uses_gravity(bbd->sim)) {
project_v3_v3v3(vec, bbd->wanted_co, bbd->sim->scene->physics_settings.gravity);
mul_v3_fl(vec, asbr->level);
sub_v3_v3(bbd->wanted_co, vec);
@@ -618,7 +618,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
/* calculate own group strength */
int neighbors = BLI_kdtree_range_search(bbd->sim->psys->tree, fbr->distance, pa->prev_state.co, NULL, &ptn);
- for(n=0; n<neighbors; n++) {
+ for (n=0; n<neighbors; n++) {
bpa = bbd->sim->psys->particles[ptn[n].index].boid;
health += bpa->data.health;
}
@@ -628,39 +628,39 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
if (ptn) { MEM_freeN(ptn); ptn=NULL; }
/* add other friendlies and calculate enemy strength and find closest enemy */
- for(pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
+ for (pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
ParticleSystem *epsys = psys_get_target_system(bbd->sim->ob, pt);
- if(epsys) {
+ if (epsys) {
epars = epsys->particles;
neighbors = BLI_kdtree_range_search(epsys->tree, fbr->distance, pa->prev_state.co, NULL, &ptn);
health = 0.0f;
- for(n=0; n<neighbors; n++) {
+ for (n=0; n<neighbors; n++) {
bpa = epars[ptn[n].index].boid;
health += bpa->data.health;
- if(n==0 && pt->mode==PTARGET_MODE_ENEMY && ptn[n].dist < closest_dist) {
+ if (n==0 && pt->mode==PTARGET_MODE_ENEMY && ptn[n].dist < closest_dist) {
copy_v3_v3(closest_enemy, ptn[n].co);
closest_dist = ptn[n].dist;
enemy_pa = epars + ptn[n].index;
}
}
- if(pt->mode==PTARGET_MODE_ENEMY)
+ if (pt->mode==PTARGET_MODE_ENEMY)
e_strength += epsys->part->boids->strength * health;
- else if(pt->mode==PTARGET_MODE_FRIEND)
+ else if (pt->mode==PTARGET_MODE_FRIEND)
f_strength += epsys->part->boids->strength * health;
if (ptn) { MEM_freeN(ptn); ptn=NULL; }
}
}
/* decide action if enemy presence found */
- if(e_strength > 0.0f) {
+ if (e_strength > 0.0f) {
sub_v3_v3v3(bbd->wanted_co, closest_enemy, pa->prev_state.co);
/* attack if in range */
- if(closest_dist <= bbd->part->boids->range + pa->size + enemy_pa->size) {
+ if (closest_dist <= bbd->part->boids->range + pa->size + enemy_pa->size) {
float damage = BLI_frand();
float enemy_dir[3];
@@ -670,7 +670,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
bbd->wanted_speed = 0.0f;
/* must face enemy to fight */
- if(dot_v3v3(pa->prev_state.ave, enemy_dir)>0.5f) {
+ if (dot_v3v3(pa->prev_state.ave, enemy_dir)>0.5f) {
bpa = enemy_pa->boid;
bpa->data.health -= bbd->part->boids->strength * bbd->timestep * ((1.0f-bbd->part->boids->accuracy)*damage + bbd->part->boids->accuracy);
}
@@ -682,9 +682,9 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
/* check if boid doesn't want to fight */
bpa = pa->boid;
- if(bpa->data.health/bbd->part->boids->health * bbd->part->boids->aggression < e_strength / f_strength) {
+ if (bpa->data.health/bbd->part->boids->health * bbd->part->boids->aggression < e_strength / f_strength) {
/* decide to flee */
- if(closest_dist < fbr->flee_distance * fbr->distance) {
+ if (closest_dist < fbr->flee_distance * fbr->distance) {
negate_v3(bbd->wanted_co);
bbd->wanted_speed = val->max_speed;
}
@@ -722,7 +722,7 @@ static void set_boid_values(BoidValues *val, BoidSettings *boids, ParticleData *
{
BoidParticle *bpa = pa->boid;
- if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) {
+ if (ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) {
val->max_speed = boids->land_max_speed * bpa->data.health/boids->health;
val->max_acc = boids->land_max_acc * val->max_speed;
val->max_ave = boids->land_max_ave * (float)M_PI * bpa->data.health/boids->health;
@@ -744,7 +744,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
{
BoidParticle *bpa = pa->boid;
- if(bpa->data.mode == eBoidMode_Climbing) {
+ if (bpa->data.mode == eBoidMode_Climbing) {
SurfaceModifierData *surmd = NULL;
float x[3], v[3];
@@ -766,7 +766,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
BVHTreeRayHit hit;
float radius = 0.0f, t, ray_dir[3];
- if(!bbd->sim->colliders)
+ if (!bbd->sim->colliders)
return NULL;
/* first try to find below boid */
@@ -778,16 +778,16 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
hit.dist = col.original_ray_length = len_v3(ray_dir);
col.pce.inside = 0;
- for(coll = bbd->sim->colliders->first; coll; coll = coll->next) {
+ for (coll = bbd->sim->colliders->first; coll; coll = coll->next) {
col.current = coll->ob;
col.md = coll->collmd;
col.fac1 = col.fac2 = 0.f;
- if(col.md && col.md->bvhtree)
+ if (col.md && col.md->bvhtree)
BLI_bvhtree_ray_cast(col.md->bvhtree, col.co1, ray_dir, radius, &hit, BKE_psys_collision_neartest_cb, &col);
}
/* then use that object */
- if(hit.index>=0) {
+ if (hit.index>=0) {
t = hit.dist/col.original_ray_length;
interp_v3_v3v3(ground_co, col.co1, col.co2, t);
normalize_v3_v3(ground_nor, col.pce.nor);
@@ -803,15 +803,15 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
hit.index = -1;
hit.dist = col.original_ray_length = len_v3(ray_dir);
- for(coll = bbd->sim->colliders->first; coll; coll = coll->next) {
+ for (coll = bbd->sim->colliders->first; coll; coll = coll->next) {
col.current = coll->ob;
col.md = coll->collmd;
- if(col.md && col.md->bvhtree)
+ if (col.md && col.md->bvhtree)
BLI_bvhtree_ray_cast(col.md->bvhtree, col.co1, ray_dir, radius, &hit, BKE_psys_collision_neartest_cb, &col);
}
/* then use that object */
- if(hit.index>=0) {
+ if (hit.index>=0) {
t = hit.dist/col.original_ray_length;
interp_v3_v3v3(ground_co, col.co1, col.co2, t);
normalize_v3_v3(ground_nor, col.pce.nor);
@@ -830,13 +830,13 @@ static int boid_rule_applies(ParticleData *pa, BoidSettings *UNUSED(boids), Boid
{
BoidParticle *bpa = pa->boid;
- if(rule==NULL)
+ if (rule==NULL)
return 0;
- if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing) && rule->flag & BOIDRULE_ON_LAND)
+ if (ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing) && rule->flag & BOIDRULE_ON_LAND)
return 1;
- if(bpa->data.mode==eBoidMode_InAir && rule->flag & BOIDRULE_IN_AIR)
+ if (bpa->data.mode==eBoidMode_InAir && rule->flag & BOIDRULE_IN_AIR)
return 1;
return 0;
@@ -845,12 +845,12 @@ void boids_precalc_rules(ParticleSettings *part, float cfra)
{
BoidState *state = part->boids->states.first;
BoidRule *rule;
- for(; state; state=state->next) {
- for(rule = state->rules.first; rule; rule=rule->next) {
- if(rule->type==eBoidRuleType_FollowLeader) {
+ for (; state; state=state->next) {
+ for (rule = state->rules.first; rule; rule=rule->next) {
+ if (rule->type==eBoidRuleType_FollowLeader) {
BoidRuleFollowLeader *flbr = (BoidRuleFollowLeader*) rule;
- if(flbr->ob && flbr->cfra != cfra) {
+ if (flbr->ob && flbr->cfra != cfra) {
/* save object locations for velocity calculations */
copy_v3_v3(flbr->oloc, flbr->loc);
copy_v3_v3(flbr->loc, flbr->ob->obmat[3]);
@@ -889,16 +889,16 @@ static float boid_goal_signed_dist(float *boid_co, float *goal_co, float *goal_n
/* wanted_co is relative to boid location */
static int apply_boid_rule(BoidBrainData *bbd, BoidRule *rule, BoidValues *val, ParticleData *pa, float fuzziness)
{
- if(rule==NULL)
+ if (rule==NULL)
return 0;
- if(boid_rule_applies(pa, bbd->part->boids, rule)==0)
+ if (boid_rule_applies(pa, bbd->part->boids, rule)==0)
return 0;
- if(boid_rules[rule->type](rule, bbd, val, pa)==0)
+ if (boid_rules[rule->type](rule, bbd, val, pa)==0)
return 0;
- if(fuzziness < 0.0f || compare_len_v3v3(bbd->wanted_co, pa->prev_state.vel, fuzziness * len_v3(pa->prev_state.vel))==0)
+ if (fuzziness < 0.0f || compare_len_v3v3(bbd->wanted_co, pa->prev_state.vel, fuzziness * len_v3(pa->prev_state.vel))==0)
return 1;
else
return 0;
@@ -908,14 +908,14 @@ static BoidState *get_boid_state(BoidSettings *boids, ParticleData *pa)
BoidState *state = boids->states.first;
BoidParticle *bpa = pa->boid;
- for(; state; state=state->next) {
- if(state->id==bpa->data.state_id)
+ for (; state; state=state->next) {
+ if (state->id==bpa->data.state_id)
return state;
}
/* for some reason particle isn't at a valid state */
state = boids->states.first;
- if(state)
+ if (state)
bpa->data.state_id = state->id;
return state;
@@ -937,7 +937,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
int rand;
//BoidCondition *cond;
- if(bpa->data.health <= 0.0f) {
+ if (bpa->data.health <= 0.0f) {
pa->alive = PARS_DYING;
pa->dietime = bbd->cfra;
return;
@@ -945,8 +945,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
//planned for near future
//cond = state->conditions.first;
- //for(; cond; cond=cond->next) {
- // if(boid_condition_is_true(cond)) {
+ //for (; cond; cond=cond->next) {
+ // if (boid_condition_is_true(cond)) {
// pa->boid->state_id = cond->state_id;
// state = get_boid_state(boids, pa);
// break; /* only first true condition is used */
@@ -965,8 +965,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
switch(state->ruleset_type) {
case eBoidRulesetType_Fuzzy:
{
- for(rule = state->rules.first; rule; rule = rule->next) {
- if(apply_boid_rule(bbd, rule, &val, pa, state->rule_fuzziness))
+ for (rule = state->rules.first; rule; rule = rule->next) {
+ if (apply_boid_rule(bbd, rule, &val, pa, state->rule_fuzziness))
break; /* only first nonzero rule that comes through fuzzy rule is applied */
}
break;
@@ -982,8 +982,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
{
float wanted_co[3] = {0.0f, 0.0f, 0.0f}, wanted_speed = 0.0f;
int n = 0;
- for(rule = state->rules.first; rule; rule=rule->next) {
- if(apply_boid_rule(bbd, rule, &val, pa, -1.0f)) {
+ for (rule = state->rules.first; rule; rule=rule->next) {
+ if (apply_boid_rule(bbd, rule, &val, pa, -1.0f)) {
add_v3_v3(wanted_co, bbd->wanted_co);
wanted_speed += bbd->wanted_speed;
n++;
@@ -991,7 +991,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
}
}
- if(n > 1) {
+ if (n > 1) {
mul_v3_fl(wanted_co, 1.0f/(float)n);
wanted_speed /= (float)n;
}
@@ -1004,11 +1004,11 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
}
/* decide on jumping & liftoff */
- if(bpa->data.mode == eBoidMode_OnLand) {
+ if (bpa->data.mode == eBoidMode_OnLand) {
/* fuzziness makes boids capable of misjudgement */
float mul = 1.0f + state->rule_fuzziness;
- if(boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f) {
+ if (boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f) {
float cvel[3], dir[3];
copy_v3_v3(dir, pa->prev_state.ave);
@@ -1017,15 +1017,15 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
copy_v3_v3(cvel, bbd->wanted_co);
normalize_v2(cvel);
- if(dot_v2v2(cvel, dir) > 0.95f / mul)
+ if (dot_v2v2(cvel, dir) > 0.95f / mul)
bpa->data.mode = eBoidMode_Liftoff;
}
- else if(val.jump_speed > 0.0f) {
+ else if (val.jump_speed > 0.0f) {
float jump_v[3];
int jump = 0;
/* jump to get to a location */
- if(bbd->wanted_co[2] > 0.0f) {
+ if (bbd->wanted_co[2] > 0.0f) {
float cvel[3], dir[3];
float z_v, ground_v, cur_v;
float len;
@@ -1040,7 +1040,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
/* first of all, are we going in a suitable direction? */
/* or at a suitably slow speed */
- if(dot_v2v2(cvel, dir) > 0.95f / mul || len <= state->rule_fuzziness) {
+ if (dot_v2v2(cvel, dir) > 0.95f / mul || len <= state->rule_fuzziness) {
/* try to reach goal at highest point of the parabolic path */
cur_v = len_v2(pa->prev_state.vel);
z_v = sasqrt(-2.0f * bbd->sim->scene->physics_settings.gravity[2] * bbd->wanted_co[2]);
@@ -1048,7 +1048,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
len = sasqrt((ground_v-cur_v)*(ground_v-cur_v) + z_v*z_v);
- if(len < val.jump_speed * mul || bbd->part->boids->options & BOID_ALLOW_FLIGHT) {
+ if (len < val.jump_speed * mul || bbd->part->boids->options & BOID_ALLOW_FLIGHT) {
jump = 1;
len = MIN2(len, val.jump_speed);
@@ -1065,11 +1065,11 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
}
/* jump to go faster */
- if(jump == 0 && val.jump_speed > val.max_speed && bbd->wanted_speed > val.max_speed) {
+ if (jump == 0 && val.jump_speed > val.max_speed && bbd->wanted_speed > val.max_speed) {
}
- if(jump) {
+ if (jump) {
copy_v3_v3(pa->prev_state.vel, jump_v);
bpa->data.mode = eBoidMode_Falling;
}
@@ -1098,14 +1098,14 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* make sure there's something in new velocity, location & rotation */
copy_particle_key(&pa->state,&pa->prev_state,0);
- if(bbd->part->flag & PART_SIZEMASS)
+ if (bbd->part->flag & PART_SIZEMASS)
pa_mass*=pa->size;
/* if boids can't fly they fall to the ground */
- if((boids->options & BOID_ALLOW_FLIGHT)==0 && ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)==0 && psys_uses_gravity(bbd->sim))
+ if ((boids->options & BOID_ALLOW_FLIGHT)==0 && ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)==0 && psys_uses_gravity(bbd->sim))
bpa->data.mode = eBoidMode_Falling;
- if(bpa->data.mode == eBoidMode_Falling) {
+ if (bpa->data.mode == eBoidMode_Falling) {
/* Falling boids are only effected by gravity. */
acc[2] = bbd->sim->scene->physics_settings.gravity[2];
}
@@ -1115,11 +1115,11 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
float level = landing_level + 1.0f;
float new_vel[3];
- if(bpa->data.mode == eBoidMode_Liftoff) {
+ if (bpa->data.mode == eBoidMode_Liftoff) {
bpa->data.mode = eBoidMode_InAir;
bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor);
}
- else if(bpa->data.mode == eBoidMode_InAir && boids->options & BOID_ALLOW_LAND) {
+ else if (bpa->data.mode == eBoidMode_InAir && boids->options & BOID_ALLOW_LAND) {
/* auto-leveling & landing if close to ground */
bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor);
@@ -1129,13 +1129,13 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
landing_level = - boids->landing_smoothness * pa->prev_state.vel[2] * pa_mass;
- if(pa->prev_state.vel[2] < 0.0f) {
- if(level < 1.0f) {
+ if (pa->prev_state.vel[2] < 0.0f) {
+ if (level < 1.0f) {
bbd->wanted_co[0] = bbd->wanted_co[1] = bbd->wanted_co[2] = 0.0f;
bbd->wanted_speed = 0.0f;
bpa->data.mode = eBoidMode_Falling;
}
- else if(level < landing_level) {
+ else if (level < landing_level) {
bbd->wanted_speed *= (level - 1.0f)/landing_level;
bbd->wanted_co[2] *= (level - 1.0f)/landing_level;
}
@@ -1146,7 +1146,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
new_speed = normalize_v3_v3(wanted_dir, bbd->wanted_co);
/* first check if we have valid direction we want to go towards */
- if(new_speed == 0.0f) {
+ if (new_speed == 0.0f) {
copy_v3_v3(new_dir, old_dir);
}
else {
@@ -1158,7 +1158,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* choose random direction to turn if wanted velocity */
/* is directly behind regardless of z-coordinate */
- if(dot_v2v2(old_dir2, wanted_dir2) < -0.99f) {
+ if (dot_v2v2(old_dir2, wanted_dir2) < -0.99f) {
wanted_dir[0] = 2.0f*(0.5f - BLI_frand());
wanted_dir[1] = 2.0f*(0.5f - BLI_frand());
wanted_dir[2] = 2.0f*(0.5f - BLI_frand());
@@ -1185,7 +1185,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* constrain speed with maximum acceleration */
old_speed = len_v3(pa->prev_state.vel);
- if(bbd->wanted_speed < old_speed)
+ if (bbd->wanted_speed < old_speed)
new_speed = MAX2(bbd->wanted_speed, old_speed - val.max_acc);
else
new_speed = MIN2(bbd->wanted_speed, old_speed + val.max_acc);
@@ -1195,7 +1195,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
mul_v3_fl(new_vel, new_speed);
/* maintain minimum flying velocity if not landing */
- if(level >= landing_level) {
+ if (level >= landing_level) {
float len2 = dot_v2v2(new_vel,new_vel);
float root;
@@ -1224,7 +1224,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
pd_point_from_particle(bbd->sim, pa, &pa->state, &epoint);
pdDoEffectors(bbd->sim->psys->effectors, bbd->sim->colliders, bbd->part->effector_weights, &epoint, force, NULL);
- if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) {
+ if (ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) {
float length = normalize_v3(force);
length = MAX2(0.0f, length - boids->land_stick_force);
@@ -1268,7 +1268,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
grav[2]= bbd->sim->scene->physics_settings.gravity[2] < 0.0f ? -1.0f : 0.0f;
/* don't take forward acceleration into account (better banking) */
- if(dot_v3v3(bpa->data.acc, pa->state.vel) > 0.0f) {
+ if (dot_v3v3(bpa->data.acc, pa->state.vel) > 0.0f) {
project_v3_v3v3(dvec, bpa->data.acc, pa->state.vel);
sub_v3_v3v3(dvec, bpa->data.acc, dvec);
}
@@ -1281,21 +1281,21 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
normalize_v3(bpa->gravity);
/* stick boid on goal when close enough */
- if(bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
+ if (bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
bpa->data.mode = eBoidMode_Climbing;
bpa->ground = bbd->goal_ob;
boid_find_ground(bbd, pa, ground_co, ground_nor);
boid_climb(boids, pa, ground_co, ground_nor);
}
- else if(pa->state.co[2] <= ground_co[2] + pa->size * boids->height) {
+ else if (pa->state.co[2] <= ground_co[2] + pa->size * boids->height) {
/* land boid when below ground */
- if(boids->options & BOID_ALLOW_LAND) {
+ if (boids->options & BOID_ALLOW_LAND) {
pa->state.co[2] = ground_co[2] + pa->size * boids->height;
pa->state.vel[2] = 0.0f;
bpa->data.mode = eBoidMode_OnLand;
}
/* fly above ground */
- else if(bpa->ground) {
+ else if (bpa->ground) {
pa->state.co[2] = ground_co[2] + pa->size * boids->height;
pa->state.vel[2] = 0.0f;
}
@@ -1315,22 +1315,22 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
madd_v3_v3fl(bpa->gravity, grav, dtime);
normalize_v3(bpa->gravity);
- if(boids->options & BOID_ALLOW_LAND) {
+ if (boids->options & BOID_ALLOW_LAND) {
/* stick boid on goal when close enough */
- if(bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
+ if (bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
bpa->data.mode = eBoidMode_Climbing;
bpa->ground = bbd->goal_ob;
boid_find_ground(bbd, pa, ground_co, ground_nor);
boid_climb(boids, pa, ground_co, ground_nor);
}
/* land boid when really near ground */
- else if(pa->state.co[2] <= ground_co[2] + 1.01f * pa->size * boids->height) {
+ else if (pa->state.co[2] <= ground_co[2] + 1.01f * pa->size * boids->height) {
pa->state.co[2] = ground_co[2] + pa->size * boids->height;
pa->state.vel[2] = 0.0f;
bpa->data.mode = eBoidMode_OnLand;
}
/* if we're falling, can fly and want to go upwards lets fly */
- else if(boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f)
+ else if (boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f)
bpa->data.mode = eBoidMode_InAir;
}
else
@@ -1359,14 +1359,14 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
case eBoidMode_OnLand:
{
/* stick boid on goal when close enough */
- if(bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
+ if (bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
bpa->data.mode = eBoidMode_Climbing;
bpa->ground = bbd->goal_ob;
boid_find_ground(bbd, pa, ground_co, ground_nor);
boid_climb(boids, pa, ground_co, ground_nor);
}
/* ground is too far away so boid falls */
- else if(pa->state.co[2]-ground_co[2] > 1.1f * pa->size * boids->height)
+ else if (pa->state.co[2]-ground_co[2] > 1.1f * pa->size * boids->height)
bpa->data.mode = eBoidMode_Falling;
else {
/* constrain to surface */
@@ -1374,7 +1374,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
pa->state.vel[2] = 0.0f;
}
- if(boids->banking > 0.0f) {
+ if (boids->banking > 0.0f) {
float grav[3];
/* Don't take gravity's strength in to account, */
/* otherwise amount of banking is hard to control. */
@@ -1398,18 +1398,18 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* save direction to state.ave unless the boid is falling */
/* (boids can't effect their direction when falling) */
- if(bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1f*pa->size) {
+ if (bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1f*pa->size) {
copy_v3_v3(pa->state.ave, pa->state.vel);
pa->state.ave[2] *= bbd->part->boids->pitch;
normalize_v3(pa->state.ave);
}
/* apply damping */
- if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing))
+ if (ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing))
mul_v3_fl(pa->state.vel, 1.0f - 0.2f*bbd->part->dampfac);
/* calculate rotation matrix based on forward & down vectors */
- if(bpa->data.mode == eBoidMode_InAir) {
+ if (bpa->data.mode == eBoidMode_InAir) {
copy_v3_v3(mat[0], pa->state.ave);
project_v3_v3v3(dvec, bpa->gravity, pa->state.ave);
@@ -1434,7 +1434,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
BoidRule *boid_new_rule(int type)
{
BoidRule *rule = NULL;
- if(type <= 0)
+ if (type <= 0)
return NULL;
switch(type) {
@@ -1501,7 +1501,7 @@ BoidState *boid_new_state(BoidSettings *boids)
BoidState *state = MEM_callocN(sizeof(BoidState), "BoidState");
state->id = boids->last_state_id++;
- if(state->id)
+ if (state->id)
BLI_snprintf(state->name, sizeof(state->name), "State %i", state->id);
else
strcpy(state->name, "State");
@@ -1527,10 +1527,10 @@ BoidState *boid_duplicate_state(BoidSettings *boids, BoidState *state)
}
void boid_free_settings(BoidSettings *boids)
{
- if(boids) {
+ if (boids) {
BoidState *state = boids->states.first;
- for(; state; state=state->next) {
+ for (; state; state=state->next) {
BLI_freelistN(&state->rules);
BLI_freelistN(&state->conditions);
BLI_freelistN(&state->actions);
@@ -1545,7 +1545,7 @@ BoidSettings *boid_copy_settings(BoidSettings *boids)
{
BoidSettings *nboids = NULL;
- if(boids) {
+ if (boids) {
BoidState *state;
BoidState *nstate;
@@ -1555,7 +1555,7 @@ BoidSettings *boid_copy_settings(BoidSettings *boids)
state = boids->states.first;
nstate = nboids->states.first;
- for(; state; state=state->next, nstate=nstate->next) {
+ for (; state; state=state->next, nstate=nstate->next) {
BLI_duplicatelist(&nstate->rules, &state->rules);
BLI_duplicatelist(&nstate->conditions, &state->conditions);
BLI_duplicatelist(&nstate->actions, &state->actions);
@@ -1568,8 +1568,8 @@ BoidState *boid_get_current_state(BoidSettings *boids)
{
BoidState *state = boids->states.first;
- for(; state; state=state->next) {
- if(state->flag & BOIDSTATE_CURRENT)
+ for (; state; state=state->next) {
+ if (state->flag & BOIDSTATE_CURRENT)
break;
}
diff --git a/source/blender/blenkernel/intern/booleanops_mesh.c b/source/blender/blenkernel/intern/booleanops_mesh.c
index ea626df5018..31c90d54d14 100644
--- a/source/blender/blenkernel/intern/booleanops_mesh.c
+++ b/source/blender/blenkernel/intern/booleanops_mesh.c
@@ -208,7 +208,8 @@ CSG_PerformOp(
mesh2->m_vertex_iterator,
InterpFaceVertexData
);
- } else {
+ }
+ else {
success =
CSG_PerformBooleanOperation(
bool_op,
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index c178bf6f0a7..e7ba09d3959 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -197,23 +197,23 @@ void make_local_brush(Brush *brush)
Scene *scene;
int is_local= FALSE, is_lib= FALSE;
- if(brush->id.lib==NULL) return;
+ if (brush->id.lib==NULL) return;
- if(brush->clone.image) {
+ if (brush->clone.image) {
/* special case: ima always local immediately. Clone image should only
* have one user anyway. */
id_clear_lib_data(bmain, &brush->clone.image->id);
extern_local_brush(brush);
}
- for(scene= bmain->scene.first; scene && ELEM(0, is_lib, is_local); scene=scene->id.next) {
- if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
- if(scene->id.lib) is_lib= TRUE;
+ for (scene= bmain->scene.first; scene && ELEM(0, is_lib, is_local); scene=scene->id.next) {
+ if (paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
+ if (scene->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
- if(is_local && is_lib == FALSE) {
+ if (is_local && is_lib == FALSE) {
id_clear_lib_data(bmain, &brush->id);
extern_local_brush(brush);
@@ -223,7 +223,7 @@ void make_local_brush(Brush *brush)
brush->id.us++;
}
}
- else if(is_local && is_lib) {
+ else if (is_local && is_lib) {
Brush *brush_new= copy_brush(brush);
brush_new->id.us= 1; /* only keep fake user */
brush_new->id.flag |= LIB_FAKEUSER;
@@ -231,9 +231,9 @@ void make_local_brush(Brush *brush)
/* Remap paths of new ID using old library as base. */
BKE_id_lib_local_paths(bmain, brush->id.lib, &brush_new->id);
- for(scene= bmain->scene.first; scene; scene=scene->id.next) {
- if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
- if(scene->id.lib==NULL) {
+ for (scene= bmain->scene.first; scene; scene=scene->id.next) {
+ if (paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
+ if (scene->id.lib==NULL) {
paint_brush_set(&scene->toolsettings->imapaint.paint, brush_new);
}
}
@@ -248,13 +248,13 @@ void brush_debug_print_state(Brush *br)
brush_set_defaults(&def);
#define BR_TEST(field, t) \
- if(br->field != def.field) \
+ if (br->field != def.field) \
printf("br->" #field " = %" #t ";\n", br->field)
#define BR_TEST_FLAG(_f) \
- if((br->flag & _f) && !(def.flag & _f)) \
+ if ((br->flag & _f) && !(def.flag & _f)) \
printf("br->flag |= " #_f ";\n"); \
- else if(!(br->flag & _f) && (def.flag & _f)) \
+ else if (!(br->flag & _f) && (def.flag & _f)) \
printf("br->flag &= ~" #_f ";\n")
@@ -412,7 +412,7 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset)
{
CurveMap *cm = NULL;
- if(!b->curve)
+ if (!b->curve)
b->curve = curvemapping_add(1, 0, 0, 1, 1);
cm = b->curve->cm;
@@ -430,12 +430,12 @@ int brush_texture_set_nr(Brush *brush, int nr)
id= (ID *)brush->mtex.tex;
idtest= (ID*)BLI_findlink(&G.main->tex, nr-1);
- if(idtest==NULL) { /* new tex */
- if(id) idtest= (ID *)copy_texture((Tex *)id);
+ if (idtest==NULL) { /* new tex */
+ if (id) idtest= (ID *)copy_texture((Tex *)id);
else idtest= (ID *)add_texture("Tex");
idtest->us--;
}
- if(idtest!=id) {
+ if (idtest!=id) {
brush_texture_delete(brush);
brush->mtex.tex= (Tex*)idtest;
@@ -449,7 +449,7 @@ int brush_texture_set_nr(Brush *brush, int nr)
int brush_texture_delete(Brush *brush)
{
- if(brush->mtex.tex)
+ if (brush->mtex.tex)
brush->mtex.tex->id.us--;
return 1;
@@ -457,10 +457,10 @@ int brush_texture_delete(Brush *brush)
int brush_clone_image_set_nr(Brush *brush, int nr)
{
- if(brush && nr > 0) {
+ if (brush && nr > 0) {
Image *ima= (Image*)BLI_findlink(&G.main->image, nr-1);
- if(ima) {
+ if (ima) {
brush_clone_image_delete(brush);
brush->clone.image= ima;
id_us_plus(&ima->id);
@@ -717,7 +717,7 @@ void brush_scale_unprojected_radius(float *unprojected_radius,
{
float scale = new_brush_size;
/* avoid division by zero */
- if(old_brush_size != 0)
+ if (old_brush_size != 0)
scale /= (float)old_brush_size;
(*unprojected_radius) *= scale;
}
@@ -729,7 +729,7 @@ void brush_scale_size(int *brush_size,
{
float scale = new_unprojected_radius;
/* avoid division by zero */
- if(old_unprojected_radius != 0)
+ if (old_unprojected_radius != 0)
scale /= new_unprojected_radius;
(*brush_size)= (int)((float)(*brush_size) * scale);
}
@@ -1077,7 +1077,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2
int totpaintops= 0;
if (pressure == 0.0f) {
- if(painter->lastpressure) // XXX - hack, operator misses
+ if (painter->lastpressure) // XXX - hack, operator misses
pressure= painter->lastpressure;
else
pressure = 1.0f; /* zero pressure == not using tablet */
@@ -1172,7 +1172,8 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2
painter->accumdistance -= spacing;
startdistance -= spacing;
}
- } else {
+ }
+ else {
brush_jitter_pos(scene, brush, pos, finalpos);
if (painter->cache.enabled)
@@ -1230,19 +1231,19 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2
/* Uses the brush curve control to find a strength value between 0 and 1 */
float brush_curve_strength_clamp(Brush *br, float p, const float len)
{
- if(p >= len) return 0;
+ if (p >= len) return 0;
else p= p/len;
p= curvemapping_evaluateF(br->curve, 0, p);
- if(p < 0.0f) p= 0.0f;
- else if(p > 1.0f) p= 1.0f;
+ if (p < 0.0f) p= 0.0f;
+ else if (p > 1.0f) p= 1.0f;
return p;
}
/* same as above but can return negative values if the curve enables
* used for sculpt only */
float brush_curve_strength(Brush *br, float p, const float len)
{
- if(p >= len)
+ if (p >= len)
p= 1.0f;
else
p= p/len;
@@ -1259,7 +1260,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side)
int hasrgb, ix, iy;
int side = half_side * 2;
- if(mtex->tex) {
+ if (mtex->tex) {
float x, y, step = 2.0 / side, co[3];
texcache = MEM_callocN(sizeof(int) * side * side, "Brush texture cache");
@@ -1280,7 +1281,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side)
* intensity, so calculate one (formula from do_material_tex).
* if the texture didn't give an RGB value, copy the intensity across
*/
- if(hasrgb & TEX_RGB)
+ if (hasrgb & TEX_RGB)
texres.tin = (0.35f * texres.tr + 0.45f *
texres.tg + 0.2f * texres.tb);
@@ -1309,17 +1310,17 @@ struct ImBuf *brush_gen_radial_control_imbuf(Brush *br)
im->rect_float = MEM_callocN(sizeof(float) * side * side, "radial control rect");
im->x = im->y = side;
- for(i=0; i<side; ++i) {
- for(j=0; j<side; ++j) {
+ for (i=0; i<side; ++i) {
+ for (j=0; j<side; ++j) {
float magn= sqrt(pow(i - half, 2) + pow(j - half, 2));
im->rect_float[i*side + j]= brush_curve_strength_clamp(br, magn, half);
}
}
/* Modulate curve with texture */
- if(texcache) {
- for(i=0; i<side; ++i) {
- for(j=0; j<side; ++j) {
+ if (texcache) {
+ for (i=0; i<side; ++i) {
+ for (j=0; j<side; ++j) {
const int col= texcache[i*side+j];
im->rect_float[i*side+j]*= (((char*)&col)[0]+((char*)&col)[1]+((char*)&col)[2])/3.0f/255.0f;
}
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 4cade876d09..d7c7a9a569b 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -51,7 +51,7 @@ float bvhtree_ray_tri_intersection(const BVHTreeRay *ray, const float UNUSED(m_d
{
float dist;
- if(isect_ray_tri_epsilon_v3(ray->origin, ray->direction, v0, v1, v2, &dist, NULL, FLT_EPSILON))
+ if (isect_ray_tri_epsilon_v3(ray->origin, ray->direction, v0, v1, v2, &dist, NULL, FLT_EPSILON))
return dist;
return FLT_MAX;
@@ -121,7 +121,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
lv = 1;
}
else {
- if(fabsf(A00) > FLT_EPSILON)
+ if (fabsf(A00) > FLT_EPSILON)
S = -B0/A00;
else
S = 0.0f;
@@ -142,7 +142,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
lv = 2;
}
else {
- if(fabsf(A11) > FLT_EPSILON)
+ if (fabsf(A11) > FLT_EPSILON)
T = -B1 / A11;
else
T = 0.0f;
@@ -164,7 +164,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
lv = 2;
}
else {
- if(fabsf(A11) > FLT_EPSILON)
+ if (fabsf(A11) > FLT_EPSILON)
T = -B1 / A11;
else
T = 0.0;
@@ -197,7 +197,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
else { /* Region 0 */
// Minimum at interior lv
float invDet;
- if(fabsf(Det) > FLT_EPSILON)
+ if (fabsf(Det) > FLT_EPSILON)
invDet = 1.0f / Det;
else
invDet = 0.0f;
@@ -223,7 +223,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
lv = 1;
}
else {
- if(fabsf(denom) > FLT_EPSILON)
+ if (fabsf(denom) > FLT_EPSILON)
S = numer / denom;
else
S = 0.0f;
@@ -246,7 +246,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
lv = 0;
}
else {
- if(fabsf(A11) > FLT_EPSILON)
+ if (fabsf(A11) > FLT_EPSILON)
T = -B1 / A11;
else
T = 0.0f;
@@ -268,7 +268,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
lv = 2;
}
else {
- if(fabsf(denom) > FLT_EPSILON)
+ if (fabsf(denom) > FLT_EPSILON)
T = numer / denom;
else
T = 0.0f;
@@ -291,7 +291,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
lv = 0;
}
else {
- if(fabsf(A00) > FLT_EPSILON)
+ if (fabsf(A00) > FLT_EPSILON)
S = -B0 / A00;
else
S = 0.0f;
@@ -317,7 +317,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
lv = 1;
}
else {
- if(fabsf(denom) > FLT_EPSILON)
+ if (fabsf(denom) > FLT_EPSILON)
S = numer / denom;
else
S = 0.0f;
@@ -390,7 +390,7 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3
t2 = t3;
t3 = NULL;
- } while(t2);
+ } while (t2);
}
// Callback to bvh tree raycast. The tree must bust have been built using bvhtree_from_mesh_faces.
@@ -411,7 +411,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
do
{
float dist;
- if(data->sphere_radius == 0.0f)
+ if (data->sphere_radius == 0.0f)
dist = bvhtree_ray_tri_intersection(ray, hit->dist, t0, t1, t2);
else
dist = sphereray_tri_intersection(ray, data->sphere_radius, hit->dist, t0, t1, t2);
@@ -428,7 +428,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
t2 = t3;
t3 = NULL;
- } while(t2);
+ } while (t2);
}
// Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_edges.
@@ -465,7 +465,7 @@ BVHTree* bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float
BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_VERTICES);
//Not in cache
- if(tree == NULL) {
+ if (tree == NULL) {
int i;
int numVerts= mesh->getNumVerts(mesh);
MVert *vert = mesh->getVertDataArray(mesh, CD_MVERT);
@@ -523,19 +523,19 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
int i;
int numFaces= mesh->getNumTessFaces(mesh);
- /* BMESH spesific check that we have tessfaces,
- * we _could_ tesselate here but rather not - campbell
+ /* BMESH specific check that we have tessfaces,
+ * we _could_ tessellate here but rather not - campbell
*
* this assert checks we have tessfaces,
* if not caller should use DM_ensure_tessface() */
BLI_assert(!(numFaces == 0 && mesh->getNumPolys(mesh) != 0));
- if(numFaces != 0) {
+ if (numFaces != 0) {
/* Create a bvh-tree of the given target */
tree = BLI_bvhtree_new(numFaces, epsilon, tree_type, axis);
if (tree != NULL) {
BMEditMesh *em= data->em_evil;
- if(em) {
+ if (em) {
/* data->em_evil is only set for snapping, and only for the mesh of the object
* which is currently open in edit mode. When set, the bvhtree should not contain
* faces that will interfere with snapping (e.g. faces that are hidden/selected
@@ -545,7 +545,7 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
/* Insert BMesh-tessellation triangles into the bvh tree, unless they are hidden
* and/or selected. Even if the faces themselves are not selected for the snapped
- * transform, having a vertex selected means the face (and thus it's tesselated
+ * transform, having a vertex selected means the face (and thus it's tessellated
* triangles) will be moving and will not be a good snap targets.*/
for (i = 0; i < em->tottri; i++) {
BMLoop **tri = em->looptris[i];
@@ -554,12 +554,12 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
BMIter iter;
int insert;
- /* Each loop of the triangle points back to the BMFace it was tesselated from.
+ /* Each loop of the triangle points back to the BMFace it was tessellated from.
* All three should point to the same face, so just use the face from the first
* loop.*/
f = tri[0]->f;
- /* If the looptris is ordered such that all triangles tesselated from a single
+ /* If the looptris is ordered such that all triangles tessellated from a single
* faces are consecutive elements in the array, then we could speed up the tests
* below by using the insert value from the previous iteration.*/
@@ -567,14 +567,14 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
insert = 1;
if (BM_elem_flag_test(f, BM_ELEM_SELECT) || BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
- /* Don't insert triangles tesselated from faces that are hidden
+ /* Don't insert triangles tessellated from faces that are hidden
* or selected*/
insert = 0;
}
else {
BM_ITER(v, &iter, em->bm, BM_VERTS_OF_FACE, f) {
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
- /* Don't insert triangles tesselated from faces that have
+ /* Don't insert triangles tessellated from faces that have
* any selected verts.*/
insert = 0;
}
@@ -598,12 +598,12 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
MFace *face = mesh->getTessFaceDataArray(mesh, CD_MFACE);
if (vert != NULL && face != NULL) {
- for(i = 0; i < numFaces; i++) {
+ for (i = 0; i < numFaces; i++) {
float co[4][3];
copy_v3_v3(co[0], vert[ face[i].v1 ].co);
copy_v3_v3(co[1], vert[ face[i].v2 ].co);
copy_v3_v3(co[2], vert[ face[i].v3 ].co);
- if(face[i].v4)
+ if (face[i].v4)
copy_v3_v3(co[3], vert[ face[i].v4 ].co);
BLI_bvhtree_insert(tree, i, co[0], face[i].v4 ? 4 : 3);
@@ -627,7 +627,7 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
memset(data, 0, sizeof(*data));
data->tree = tree;
- if(data->tree) {
+ if (data->tree) {
data->cached = TRUE;
data->nearest_callback = mesh_faces_nearest_point;
@@ -649,7 +649,7 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_EDGES);
//Not in cache
- if(tree == NULL)
+ if (tree == NULL)
{
int i;
int numEdges= mesh->getNumEdges(mesh);
@@ -685,7 +685,7 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
memset(data, 0, sizeof(*data));
data->tree = tree;
- if(data->tree) {
+ if (data->tree) {
data->cached = TRUE;
data->nearest_callback = mesh_edges_nearest_point;
@@ -704,8 +704,8 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
// Frees data allocated by a call to bvhtree_from_mesh_*.
void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
{
- if(data->tree) {
- if(!data->cached)
+ if (data->tree) {
+ if (!data->cached)
BLI_bvhtree_free(data->tree);
memset( data, 0, sizeof(*data) );
@@ -726,7 +726,7 @@ static void bvhcacheitem_set_if_match(void *_cached, void *_search)
BVHCacheItem * cached = (BVHCacheItem *)_cached;
BVHCacheItem * search = (BVHCacheItem *)_search;
- if(search->type == cached->type) {
+ if (search->type == cached->type) {
search->tree = cached->tree;
}
}
@@ -754,7 +754,7 @@ void bvhcache_insert(BVHCache *cache, BVHTree *tree, int type)
item->type = type;
item->tree = tree;
- BLI_linklist_prepend( cache, item );
+ BLI_linklist_prepend(cache, item);
}
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index f55ceab7de8..12801228950 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -91,23 +91,23 @@ void make_local_camera(Camera *cam)
* - mixed: make copy
*/
- if(cam->id.lib==NULL) return;
- if(cam->id.us==1) {
+ if (cam->id.lib==NULL) return;
+ if (cam->id.us==1) {
id_clear_lib_data(bmain, &cam->id);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
- if(ob->data==cam) {
- if(ob->id.lib) is_lib= TRUE;
+ for (ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
+ if (ob->data==cam) {
+ if (ob->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
- if(is_local && is_lib == FALSE) {
+ if (is_local && is_lib == FALSE) {
id_clear_lib_data(bmain, &cam->id);
}
- else if(is_local && is_lib) {
+ else if (is_local && is_lib) {
Camera *cam_new= copy_camera(cam);
cam_new->id.us= 0;
@@ -115,9 +115,9 @@ void make_local_camera(Camera *cam)
/* Remap paths of new ID using old library as base. */
BKE_id_lib_local_paths(bmain, cam->id.lib, &cam_new->id);
- for(ob= bmain->object.first; ob; ob= ob->id.next) {
- if(ob->data == cam) {
- if(ob->id.lib==NULL) {
+ for (ob= bmain->object.first; ob; ob= ob->id.next) {
+ if (ob->data == cam) {
+ if (ob->id.lib==NULL) {
ob->data= cam_new;
cam_new->id.us++;
cam->id.us--;
@@ -138,10 +138,10 @@ void object_camera_mode(RenderData *rd, Object *cam_ob)
{
rd->mode &= ~(R_ORTHO|R_PANORAMA);
- if(cam_ob && cam_ob->type==OB_CAMERA) {
+ if (cam_ob && cam_ob->type==OB_CAMERA) {
Camera *cam= cam_ob->data;
- if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
- if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
+ if (cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
+ if (cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
}
}
@@ -168,7 +168,7 @@ float object_camera_dof_distance(Object *ob)
float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
{
/* sensor size used to fit to. for auto, sensor_x is both x and y. */
- if(sensor_fit == CAMERA_SENSOR_FIT_VERT)
+ if (sensor_fit == CAMERA_SENSOR_FIT_VERT)
return sensor_y;
return sensor_x;
@@ -176,8 +176,8 @@ float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
int camera_sensor_fit(int sensor_fit, float sizex, float sizey)
{
- if(sensor_fit == CAMERA_SENSOR_FIT_AUTO) {
- if(sizex >= sizey)
+ if (sensor_fit == CAMERA_SENSOR_FIT_AUTO) {
+ if (sizex >= sizey)
return CAMERA_SENSOR_FIT_HOR;
else
return CAMERA_SENSOR_FIT_VERT;
@@ -202,14 +202,14 @@ void camera_params_init(CameraParams *params)
void camera_params_from_object(CameraParams *params, Object *ob)
{
- if(!ob)
+ if (!ob)
return;
- if(ob->type==OB_CAMERA) {
+ if (ob->type==OB_CAMERA) {
/* camera object */
Camera *cam= ob->data;
- if(cam->type == CAM_ORTHO)
+ if (cam->type == CAM_ORTHO)
params->is_ortho= TRUE;
params->lens= cam->lens;
params->ortho_scale= cam->ortho_scale;
@@ -224,14 +224,14 @@ void camera_params_from_object(CameraParams *params, Object *ob)
params->clipsta= cam->clipsta;
params->clipend= cam->clipend;
}
- else if(ob->type==OB_LAMP) {
+ else if (ob->type==OB_LAMP) {
/* lamp object */
Lamp *la= ob->data;
float fac= cosf((float)M_PI*la->spotsize/360.0f);
float phi= acos(fac);
params->lens= 16.0f*fac/sinf(phi);
- if(params->lens==0.0f)
+ if (params->lens==0.0f)
params->lens= 35.0f;
params->clipsta= la->clipsta;
@@ -246,7 +246,7 @@ void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *
params->clipsta= v3d->near;
params->clipend= v3d->far;
- if(rv3d->persp==RV3D_CAMOB) {
+ if (rv3d->persp==RV3D_CAMOB) {
/* camera view */
camera_params_from_object(params, v3d->camera);
@@ -260,7 +260,7 @@ void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *
params->zoom= 1.0f/params->zoom;
}
- else if(rv3d->persp==RV3D_ORTHO) {
+ else if (rv3d->persp==RV3D_ORTHO) {
/* orthographic view */
params->clipend *= 0.5f; // otherwise too extreme low zbuffer quality
params->clipsta= - params->clipend;
@@ -283,10 +283,10 @@ void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, f
/* fields rendering */
params->ycor= yasp/xasp;
- if(params->use_fields)
+ if (params->use_fields)
params->ycor *= 2.0f;
- if(params->is_ortho) {
+ if (params->is_ortho) {
/* orthographic camera */
/* scale == 1.0 means exact 1 to 1 mapping */
pixsize= params->ortho_scale;
@@ -300,7 +300,7 @@ void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, f
/* determine sensor fit */
sensor_fit = camera_sensor_fit(params->sensor_fit, xasp*winx, yasp*winy);
- if(sensor_fit==CAMERA_SENSOR_FIT_HOR)
+ if (sensor_fit==CAMERA_SENSOR_FIT_HOR)
viewfac= winx;
else
viewfac= params->ycor * winy;
@@ -312,10 +312,10 @@ void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, f
/* compute view plane:
* fully centered, zbuffer fills in jittered between -.5 and +.5 */
- viewplane.xmin= -0.5f*(float)winx;
- viewplane.ymin= -0.5f*params->ycor*(float)winy;
- viewplane.xmax= 0.5f*(float)winx;
- viewplane.ymax= 0.5f*params->ycor*(float)winy;
+ viewplane.xmin = -0.5f*(float)winx;
+ viewplane.ymin = -0.5f*params->ycor*(float)winy;
+ viewplane.xmax = 0.5f*(float)winx;
+ viewplane.ymax = 0.5f*params->ycor*(float)winy;
/* lens shift and offset */
dx= params->shiftx*viewfac + winx*params->offsetx;
@@ -327,8 +327,8 @@ void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, f
viewplane.ymax += dy;
/* fields offset */
- if(params->field_second) {
- if(params->field_odd) {
+ if (params->field_second) {
+ if (params->field_odd) {
viewplane.ymin-= 0.5f * params->ycor;
viewplane.ymax-= 0.5f * params->ycor;
}
@@ -356,7 +356,7 @@ void camera_params_compute_matrix(CameraParams *params)
rctf viewplane= params->viewplane;
/* compute projection matrix */
- if(params->is_ortho)
+ if (params->is_ortho)
orthographic_m4(params->winmat, viewplane.xmin, viewplane.xmax,
viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
else
@@ -378,7 +378,7 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh
float aspy= (float) scene->r.ysch*scene->r.yasp;
int sensor_fit= camera_sensor_fit(camera->sensor_fit, aspx, aspy);
- if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+ if (sensor_fit==CAMERA_SENSOR_FIT_HOR) {
r_asp[0]= 1.0;
r_asp[1]= aspy / aspx;
}
@@ -392,7 +392,7 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh
r_asp[1]= 1.0f;
}
- if(camera->type==CAM_ORTHO) {
+ if (camera->type==CAM_ORTHO) {
facx= 0.5f * camera->ortho_scale * r_asp[0] * scale[0];
facy= 0.5f * camera->ortho_scale * r_asp[1] * scale[1];
r_shift[0]= camera->shiftx * camera->ortho_scale * scale[0];
@@ -408,7 +408,7 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh
*r_drawsize= drawsize / ((scale[0] + scale[1] + scale[2]) / 3.0f);
- if(do_clip) {
+ if (do_clip) {
/* fixed depth, variable size (avoids exceeding clipping range) */
depth = -(camera->clipsta + 0.1f);
fac = depth / (camera->lens/(-half_sensor) * scale[2]);
@@ -465,7 +465,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data)
data->tot++;
}
-/* dont move the camera, just yield the fit location */
+/* don't move the camera, just yield the fit location */
/* only valid for perspective cameras */
int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *camera_ob, float r_co[3])
{
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index cf435e96332..b457e71affd 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -36,14 +36,6 @@
#include "GL/glew.h"
-#include "BKE_cdderivedmesh.h"
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-#include "BKE_paint.h"
-#include "BKE_utildefines.h"
-#include "BKE_tessmesh.h"
-
-#include "BLI_scanfill.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
@@ -52,12 +44,14 @@
#include "BLI_array.h"
#include "BLI_smallhash.h"
#include "BLI_utildefines.h"
+#include "BLI_scanfill.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_paint.h"
-
+#include "BKE_utildefines.h"
+#include "BKE_tessmesh.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -91,11 +85,8 @@ typedef struct {
int pbvh_draw;
/* Mesh connectivity */
- struct ListBase *fmap;
- struct IndexNode *fmap_mem;
-
- struct ListBase *pmap;
- struct IndexNode *pmap_mem;
+ MeshElemMap *pmap;
+ int *pmap_mem;
} CDDerivedMesh;
/**************** DerivedMesh interface functions ****************/
@@ -188,8 +179,10 @@ static void cdDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
for (i=0; i<dm->numVertData; i++) {
DO_MINMAX(cddm->mvert[i].co, min_r, max_r);
}
- } else {
- min_r[0] = min_r[1] = min_r[2] = max_r[0] = max_r[1] = max_r[2] = 0.0;
+ }
+ else {
+ zero_v3(min_r);
+ zero_v3(max_r);
}
}
@@ -205,7 +198,7 @@ static void cdDM_getVertCos(DerivedMesh *dm, float (*cos_r)[3])
MVert *mv = CDDM_get_verts(dm);
int i;
- for(i = 0; i < dm->numVertData; i++, mv++)
+ for (i = 0; i < dm->numVertData; i++, mv++)
copy_v3_v3(cos_r[i], mv->co);
}
@@ -215,11 +208,11 @@ static void cdDM_getVertNo(DerivedMesh *dm, int index, float no_r[3])
normal_short_to_float_v3(no_r, cddm->mvert[index].no);
}
-static ListBase *cdDM_getPolyMap(Object *ob, DerivedMesh *dm)
+static const MeshElemMap *cdDM_getPolyMap(Object *ob, DerivedMesh *dm)
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
- if(!cddm->pmap && ob->type == OB_MESH) {
+ if (!cddm->pmap && ob->type == OB_MESH) {
Mesh *me= ob->data;
create_vert_poly_map(&cddm->pmap, &cddm->pmap_mem,
@@ -246,7 +239,7 @@ static int can_pbvh_draw(Object *ob, DerivedMesh *dm)
* final DM to give final result to user */
deformed|= ob->sculpt->kb && (ob->shapeflag&OB_SHAPE_LOCK) == 0;
- if(deformed)
+ if (deformed)
return 0;
return cddm->mvert == me->mvert || ob->sculpt->kb;
@@ -256,14 +249,14 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
- if(!ob) {
+ if (!ob) {
cddm->pbvh= NULL;
return NULL;
}
- if(!ob->sculpt)
+ if (!ob->sculpt)
return NULL;
- if(ob->sculpt->pbvh) {
+ if (ob->sculpt->pbvh) {
cddm->pbvh= ob->sculpt->pbvh;
cddm->pbvh_draw = can_pbvh_draw(ob, dm);
}
@@ -271,16 +264,18 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
/* always build pbvh from original mesh, and only use it for drawing if
* this derivedmesh is just original mesh. it's the multires subsurf dm
* that this is actually for, to support a pbvh on a modified mesh */
- if(!cddm->pbvh && ob->type == OB_MESH) {
+ if (!cddm->pbvh && ob->type == OB_MESH) {
SculptSession *ss= ob->sculpt;
Mesh *me= ob->data;
cddm->pbvh = BLI_pbvh_new();
cddm->pbvh_draw = can_pbvh_draw(ob, dm);
- BLI_assert(!(me->mface == NULL && me->mpoly != NULL)); /* BMESH ONLY complain if mpoly is valid but not mface */
+
+ BKE_mesh_tessface_ensure(me);
+
BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert,
me->totface, me->totvert);
- if(ss->modifiers_active && ob->derivedDeform) {
+ if (ss->modifiers_active && ob->derivedDeform) {
DerivedMesh *deformdm= ob->derivedDeform;
float (*vertCos)[3];
int totvert;
@@ -303,7 +298,7 @@ static void cdDM_update_normals_from_pbvh(DerivedMesh *dm)
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
float (*face_nors)[3];
- if(!cddm->pbvh || !cddm->pbvh_draw || !dm->numTessFaceData)
+ if (!cddm->pbvh || !cddm->pbvh_draw || !dm->numTessFaceData)
return;
face_nors = CustomData_get_layer(&dm->faceData, CD_NORMAL);
@@ -317,16 +312,16 @@ static void cdDM_drawVerts(DerivedMesh *dm)
MVert *mv = cddm->mvert;
int i;
- if( GPU_buffer_legacy(dm) ) {
+ if ( GPU_buffer_legacy(dm) ) {
glBegin(GL_POINTS);
- for(i = 0; i < dm->numVertData; i++, mv++)
+ for (i = 0; i < dm->numVertData; i++, mv++)
glVertex3fv(mv->co);
glEnd();
}
else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
GPU_vertex_setup(dm);
- if( !GPU_buffer_legacy(dm) ) {
- if(dm->drawObject->tot_triangle_point)
+ if ( !GPU_buffer_legacy(dm) ) {
+ if (dm->drawObject->tot_triangle_point)
glDrawArrays(GL_POINTS,0, dm->drawObject->tot_triangle_point);
else
glDrawArrays(GL_POINTS,0, dm->drawObject->tot_loose_point);
@@ -342,21 +337,22 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
int i;
- if(mf) {
- if( GPU_buffer_legacy(dm) ) {
+ if (mf) {
+ if ( GPU_buffer_legacy(dm) ) {
glBegin(GL_LINES);
- for(i = 0; i < dm->numTessFaceData; i++, mf++, tf++) {
- if(!(mf->flag&ME_HIDE)) {
+ for (i = 0; i < dm->numTessFaceData; i++, mf++, tf++) {
+ if (!(mf->flag&ME_HIDE)) {
glVertex2fv(tf->uv[0]);
glVertex2fv(tf->uv[1]);
glVertex2fv(tf->uv[1]);
glVertex2fv(tf->uv[2]);
- if(!mf->v4) {
+ if (!mf->v4) {
glVertex2fv(tf->uv[2]);
glVertex2fv(tf->uv[0]);
- } else {
+ }
+ else {
glVertex2fv(tf->uv[2]);
glVertex2fv(tf->uv[3]);
@@ -374,21 +370,21 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
int curpos = 0;
GPU_uvedge_setup(dm);
- if( !GPU_buffer_legacy(dm) ) {
- for(i = 0; i < dm->numTessFaceData; i++, mf++) {
- if(!(mf->flag&ME_HIDE)) {
+ if ( !GPU_buffer_legacy(dm) ) {
+ for (i = 0; i < dm->numTessFaceData; i++, mf++) {
+ if (!(mf->flag&ME_HIDE)) {
draw = 1;
}
else {
draw = 0;
}
- if( prevdraw != draw ) {
- if( prevdraw > 0 && (curpos-prevstart) > 0) {
+ if ( prevdraw != draw ) {
+ if ( prevdraw > 0 && (curpos-prevstart) > 0) {
glDrawArrays(GL_LINES,prevstart,curpos-prevstart);
}
prevstart = curpos;
}
- if( mf->v4 ) {
+ if ( mf->v4 ) {
curpos += 8;
}
else {
@@ -396,7 +392,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
}
prevdraw = draw;
}
- if( prevdraw > 0 && (curpos-prevstart) > 0 ) {
+ if ( prevdraw > 0 && (curpos-prevstart) > 0 ) {
glDrawArrays(GL_LINES,prevstart,curpos-prevstart);
}
}
@@ -412,11 +408,11 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges
MEdge *medge = cddm->medge;
int i;
- if( GPU_buffer_legacy(dm) ) {
+ if ( GPU_buffer_legacy(dm) ) {
DEBUG_VBO( "Using legacy code. cdDM_drawEdges\n" );
glBegin(GL_LINES);
- for(i = 0; i < dm->numEdgeData; i++, medge++) {
- if((drawAllEdges || (medge->flag&ME_EDGEDRAW))
+ for (i = 0; i < dm->numEdgeData; i++, medge++) {
+ if ((drawAllEdges || (medge->flag&ME_EDGEDRAW))
&& (drawLooseEdges || !(medge->flag&ME_LOOSEEDGE))) {
glVertex3fv(mvert[medge->v1].co);
glVertex3fv(mvert[medge->v2].co);
@@ -430,25 +426,25 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges
int draw = 1;
GPU_edge_setup(dm);
- if( !GPU_buffer_legacy(dm) ) {
- for(i = 0; i < dm->numEdgeData; i++, medge++) {
- if((drawAllEdges || (medge->flag&ME_EDGEDRAW))
+ if ( !GPU_buffer_legacy(dm) ) {
+ for (i = 0; i < dm->numEdgeData; i++, medge++) {
+ if ((drawAllEdges || (medge->flag&ME_EDGEDRAW))
&& (drawLooseEdges || !(medge->flag&ME_LOOSEEDGE))) {
draw = 1;
}
else {
draw = 0;
}
- if( prevdraw != draw ) {
- if( prevdraw > 0 && (i-prevstart) > 0 ) {
- GPU_buffer_draw_elements( dm->drawObject->edges, GL_LINES, prevstart*2, (i-prevstart)*2 );
+ if ( prevdraw != draw ) {
+ if ( prevdraw > 0 && (i-prevstart) > 0 ) {
+ GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, prevstart * 2, (i - prevstart) * 2);
}
prevstart = i;
}
prevdraw = draw;
}
- if( prevdraw > 0 && (i-prevstart) > 0 ) {
- GPU_buffer_draw_elements( dm->drawObject->edges, GL_LINES, prevstart*2, (i-prevstart)*2 );
+ if ( prevdraw > 0 && (i-prevstart) > 0 ) {
+ GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, prevstart * 2, (i-prevstart) * 2);
}
}
GPU_buffer_unbind();
@@ -462,11 +458,11 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm)
MEdge *medge = cddm->medge;
int i;
- if( GPU_buffer_legacy(dm) ) {
+ if ( GPU_buffer_legacy(dm) ) {
DEBUG_VBO( "Using legacy code. cdDM_drawLooseEdges\n" );
glBegin(GL_LINES);
- for(i = 0; i < dm->numEdgeData; i++, medge++) {
- if(medge->flag&ME_LOOSEEDGE) {
+ for (i = 0; i < dm->numEdgeData; i++, medge++) {
+ if (medge->flag&ME_LOOSEEDGE) {
glVertex3fv(mvert[medge->v1].co);
glVertex3fv(mvert[medge->v2].co);
}
@@ -479,24 +475,24 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm)
int draw = 1;
GPU_edge_setup(dm);
- if( !GPU_buffer_legacy(dm) ) {
- for(i = 0; i < dm->numEdgeData; i++, medge++) {
- if(medge->flag&ME_LOOSEEDGE) {
+ if ( !GPU_buffer_legacy(dm) ) {
+ for (i = 0; i < dm->numEdgeData; i++, medge++) {
+ if (medge->flag&ME_LOOSEEDGE) {
draw = 1;
}
else {
draw = 0;
}
- if( prevdraw != draw ) {
- if( prevdraw > 0 && (i-prevstart) > 0) {
- GPU_buffer_draw_elements( dm->drawObject->edges, GL_LINES, prevstart*2, (i-prevstart)*2 );
+ if ( prevdraw != draw ) {
+ if ( prevdraw > 0 && (i-prevstart) > 0) {
+ GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, prevstart * 2, (i - prevstart) * 2);
}
prevstart = i;
}
prevdraw = draw;
}
- if( prevdraw > 0 && (i-prevstart) > 0 ) {
- GPU_buffer_draw_elements( dm->drawObject->edges, GL_LINES, prevstart*2, (i-prevstart)*2 );
+ if ( prevdraw > 0 && (i-prevstart) > 0 ) {
+ GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, prevstart * 2, (i - prevstart) * 2);
}
}
GPU_buffer_unbind();
@@ -514,15 +510,15 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
int a, glmode = -1, shademodel = -1, matnr = -1, drawCurrentMat = 1;
#define PASSVERT(index) { \
- if(shademodel == GL_SMOOTH) { \
+ if (shademodel == GL_SMOOTH) { \
short *no = mvert[index].no; \
glNormal3sv(no); \
} \
glVertex3fv(mvert[index].co); \
}
- if(cddm->pbvh && cddm->pbvh_draw) {
- if(dm->numTessFaceData) {
+ if (cddm->pbvh && cddm->pbvh_draw) {
+ if (dm->numTessFaceData) {
float (*face_nors)[3] = CustomData_get_layer(&dm->faceData, CD_NORMAL);
BLI_pbvh_draw(cddm->pbvh, partial_redraw_planes, face_nors, setMaterial);
@@ -532,17 +528,17 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
return;
}
- if( GPU_buffer_legacy(dm) ) {
+ if ( GPU_buffer_legacy(dm) ) {
DEBUG_VBO( "Using legacy code. cdDM_drawFacesSolid\n" );
glBegin(glmode = GL_QUADS);
- for(a = 0; a < dm->numTessFaceData; a++, mface++) {
+ for (a = 0; a < dm->numTessFaceData; a++, mface++) {
int new_glmode, new_matnr, new_shademodel;
new_glmode = mface->v4?GL_QUADS:GL_TRIANGLES;
new_matnr = mface->mat_nr + 1;
new_shademodel = (mface->flag & ME_SMOOTH)?GL_SMOOTH:GL_FLAT;
- if(new_glmode != glmode || new_matnr != matnr
+ if (new_glmode != glmode || new_matnr != matnr
|| new_shademodel != shademodel) {
glEnd();
@@ -552,17 +548,18 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
glBegin(glmode = new_glmode);
}
- if(drawCurrentMat) {
- if(shademodel == GL_FLAT) {
+ if (drawCurrentMat) {
+ if (shademodel == GL_FLAT) {
if (nors) {
glNormal3fv(nors);
}
else {
/* TODO make this better (cache facenormals as layer?) */
float nor[3];
- if(mface->v4) {
+ if (mface->v4) {
normal_quad_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
- } else {
+ }
+ else {
normal_tri_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
}
glNormal3fv(nor);
@@ -572,22 +569,22 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
PASSVERT(mface->v1);
PASSVERT(mface->v2);
PASSVERT(mface->v3);
- if(mface->v4) {
+ if (mface->v4) {
PASSVERT(mface->v4);
}
}
- if(nors) nors += 3;
+ if (nors) nors += 3;
}
glEnd();
}
else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
GPU_vertex_setup( dm );
GPU_normal_setup( dm );
- if( !GPU_buffer_legacy(dm) ) {
+ if ( !GPU_buffer_legacy(dm) ) {
glShadeModel(GL_SMOOTH);
- for( a = 0; a < dm->drawObject->totmaterial; a++ ) {
- if( setMaterial(dm->drawObject->materials[a].mat_nr+1, NULL) )
+ for ( a = 0; a < dm->drawObject->totmaterial; a++ ) {
+ if ( setMaterial(dm->drawObject->materials[a].mat_nr+1, NULL) )
glDrawArrays(GL_TRIANGLES, dm->drawObject->materials[a].start,
dm->drawObject->materials[a].totpoint);
}
@@ -613,47 +610,48 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
int i, j, orig, *index = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
int startFace = 0 /*, lastFlag = 0xdeadbeef */ /* UNUSED */;
- MCol *mcol = dm->getTessFaceDataArray(dm, CD_WEIGHT_MCOL);
- if(!mcol)
+ MCol *mcol = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
+ if (!mcol)
mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
cdDM_update_normals_from_pbvh(dm);
- if( GPU_buffer_legacy(dm) ) {
+ if ( GPU_buffer_legacy(dm) ) {
DEBUG_VBO( "Using legacy code. cdDM_drawFacesTex_common\n" );
- for(i = 0; i < dm->numTessFaceData; i++, mf++) {
+ for (i = 0; i < dm->numTessFaceData; i++, mf++) {
MVert *mvert;
DMDrawOption draw_option;
unsigned char *cp = NULL;
- if(drawParams) {
+ if (drawParams) {
draw_option = drawParams(tf? &tf[i]: NULL, (mcol != NULL), mf->mat_nr);
}
else {
- if(index) {
+ if (index) {
orig = *index++;
- if(orig == ORIGINDEX_NONE) { if(nors) nors += 3; continue; }
- if(drawParamsMapped) draw_option = drawParamsMapped(userData, orig);
- else { if(nors) nors += 3; continue; }
+ if (orig == ORIGINDEX_NONE) { if (nors) nors += 3; continue; }
+ if (drawParamsMapped) draw_option = drawParamsMapped(userData, orig);
+ else { if (nors) nors += 3; continue; }
}
else
- if(drawParamsMapped) draw_option = drawParamsMapped(userData, i);
- else { if(nors) nors += 3; continue; }
+ if (drawParamsMapped) draw_option = drawParamsMapped(userData, i);
+ else { if (nors) nors += 3; continue; }
}
- if(draw_option != DM_DRAW_OPTION_SKIP) {
+ if (draw_option != DM_DRAW_OPTION_SKIP) {
if (draw_option != DM_DRAW_OPTION_NO_MCOL && mcol)
cp= (unsigned char*) &mcol[i*4];
- if(!(mf->flag&ME_SMOOTH)) {
+ if (!(mf->flag&ME_SMOOTH)) {
if (nors) {
glNormal3fv(nors);
}
else {
float nor[3];
- if(mf->v4) {
+ if (mf->v4) {
normal_quad_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
- } else {
+ }
+ else {
normal_tri_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
}
glNormal3fv(nor);
@@ -661,55 +659,57 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
}
glBegin(mf->v4?GL_QUADS:GL_TRIANGLES);
- if(tf) glTexCoord2fv(tf[i].uv[0]);
- if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+ if (tf) glTexCoord2fv(tf[i].uv[0]);
+ if (cp) glColor3ub(cp[3], cp[2], cp[1]);
mvert = &mv[mf->v1];
- if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
+ if (mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
glVertex3fv(mvert->co);
- if(tf) glTexCoord2fv(tf[i].uv[1]);
- if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+ if (tf) glTexCoord2fv(tf[i].uv[1]);
+ if (cp) glColor3ub(cp[7], cp[6], cp[5]);
mvert = &mv[mf->v2];
- if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
+ if (mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
glVertex3fv(mvert->co);
- if(tf) glTexCoord2fv(tf[i].uv[2]);
- if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+ if (tf) glTexCoord2fv(tf[i].uv[2]);
+ if (cp) glColor3ub(cp[11], cp[10], cp[9]);
mvert = &mv[mf->v3];
- if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
+ if (mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
glVertex3fv(mvert->co);
- if(mf->v4) {
- if(tf) glTexCoord2fv(tf[i].uv[3]);
- if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+ if (mf->v4) {
+ if (tf) glTexCoord2fv(tf[i].uv[3]);
+ if (cp) glColor3ub(cp[15], cp[14], cp[13]);
mvert = &mv[mf->v4];
- if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
+ if (mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
glVertex3fv(mvert->co);
}
glEnd();
}
- if(nors) nors += 3;
+ if (nors) nors += 3;
}
- } else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
+ }
+ else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
MCol *col = realcol;
- if(!col)
+ if (!col)
col = mcol;
GPU_vertex_setup( dm );
GPU_normal_setup( dm );
GPU_uv_setup( dm );
- if( col != NULL ) {
+ if ( col != NULL ) {
/*if( realcol && dm->drawObject->colType == CD_TEXTURE_MCOL ) {
col = 0;
- } else if( mcol && dm->drawObject->colType == CD_MCOL ) {
+ }
+ else if ( mcol && dm->drawObject->colType == CD_MCOL ) {
col = 0;
}
- if( col != 0 ) {*/
+ if ( col != 0 ) {*/
unsigned char *colors = MEM_mallocN(dm->getNumTessFaces(dm)*4*3*sizeof(unsigned char), "cdDM_drawFacesTex_common");
- for( i=0; i < dm->getNumTessFaces(dm); i++ ) {
- for( j=0; j < 4; j++ ) {
+ for ( i=0; i < dm->getNumTessFaces(dm); i++ ) {
+ for ( j=0; j < 4; j++ ) {
/* bgr -> rgb is intentional (and stupid), but how its stored internally */
colors[i*12+j*3] = col[i*4+j].b;
colors[i*12+j*3+1] = col[i*4+j].g;
@@ -718,58 +718,58 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
}
GPU_color3_upload(dm,colors);
MEM_freeN(colors);
- if(realcol)
+ if (realcol)
dm->drawObject->colType = CD_TEXTURE_MCOL;
- else if(mcol)
+ else if (mcol)
dm->drawObject->colType = CD_MCOL;
//}
GPU_color_setup( dm );
}
- if( !GPU_buffer_legacy(dm) ) {
+ if ( !GPU_buffer_legacy(dm) ) {
int tottri = dm->drawObject->tot_triangle_point/3;
int next_actualFace= dm->drawObject->triangle_to_mface[0];
glShadeModel( GL_SMOOTH );
/* lastFlag = 0; */ /* UNUSED */
- for(i = 0; i < tottri; i++) {
+ for (i = 0; i < tottri; i++) {
int actualFace = next_actualFace;
DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL;
int flush = 0;
- if(i != tottri-1)
+ if (i != tottri-1)
next_actualFace= dm->drawObject->triangle_to_mface[i+1];
- if(drawParams) {
+ if (drawParams) {
draw_option = drawParams(tf? &tf[actualFace]: NULL, (mcol != NULL), mf[actualFace].mat_nr);
}
else {
- if(index) {
+ if (index) {
orig = index[actualFace];
- if(orig == ORIGINDEX_NONE) continue;
- if(drawParamsMapped)
+ if (orig == ORIGINDEX_NONE) continue;
+ if (drawParamsMapped)
draw_option = drawParamsMapped(userData, orig);
}
else
- if(drawParamsMapped)
+ if (drawParamsMapped)
draw_option = drawParamsMapped(userData, actualFace);
}
/* flush buffer if current triangle isn't drawable or it's last triangle */
flush= (draw_option == DM_DRAW_OPTION_SKIP) || (i == tottri - 1);
- if(!flush && compareDrawOptions) {
+ if (!flush && compareDrawOptions) {
/* also compare draw options and flush buffer if they're different
* need for face selection highlight in edit mode */
flush|= compareDrawOptions(userData, actualFace, next_actualFace) == 0;
}
- if(flush) {
+ if (flush) {
int first= startFace*3;
/* Add one to the length if we're drawing at the end of the array */
int count= (i-startFace+(draw_option != DM_DRAW_OPTION_SKIP ? 1 : 0))*3;
- if(count) {
+ if (count) {
if (col)
GPU_color_switch(1);
else
@@ -811,32 +811,32 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
int i, orig, *index = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
mc = DM_get_tessface_data_layer(dm, CD_ID_MCOL);
- if(!mc)
- mc = DM_get_tessface_data_layer(dm, CD_WEIGHT_MCOL);
- if(!mc)
+ if (!mc)
+ mc = DM_get_tessface_data_layer(dm, CD_PREVIEW_MCOL);
+ if (!mc)
mc = DM_get_tessface_data_layer(dm, CD_MCOL);
cdDM_update_normals_from_pbvh(dm);
/* back-buffer always uses legacy since VBO's would need the
* color array temporarily overwritten for drawing, then reset. */
- if( GPU_buffer_legacy(dm) || G.f & G_BACKBUFSEL) {
+ if ( GPU_buffer_legacy(dm) || G.f & G_BACKBUFSEL) {
DEBUG_VBO( "Using legacy code. cdDM_drawMappedFaces\n" );
- for(i = 0; i < dm->numTessFaceData; i++, mf++) {
+ for (i = 0; i < dm->numTessFaceData; i++, mf++) {
int drawSmooth = (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mf->flag & ME_SMOOTH);
DMDrawOption draw_option= DM_DRAW_OPTION_NORMAL;
orig= (index==NULL) ? i : *index++;
- if(orig == ORIGINDEX_NONE)
+ if (orig == ORIGINDEX_NONE)
draw_option= setMaterial(mf->mat_nr + 1, NULL);
else if (setDrawOptions != NULL)
draw_option= setDrawOptions(userData, orig);
- if(draw_option != DM_DRAW_OPTION_SKIP) {
+ if (draw_option != DM_DRAW_OPTION_SKIP) {
unsigned char *cp = NULL;
- if(useColors && mc)
+ if (useColors && mc)
cp = (unsigned char *)&mc[i * 4];
/* no need to set shading mode to flat because
@@ -850,36 +850,38 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
}
else {
float nor[3];
- if(mf->v4) {
+ if (mf->v4) {
normal_quad_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
- } else {
+ }
+ else {
normal_tri_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
}
glNormal3fv(nor);
}
- if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+ if (cp) glColor3ub(cp[3], cp[2], cp[1]);
glVertex3fv(mv[mf->v1].co);
- if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+ if (cp) glColor3ub(cp[7], cp[6], cp[5]);
glVertex3fv(mv[mf->v2].co);
- if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+ if (cp) glColor3ub(cp[11], cp[10], cp[9]);
glVertex3fv(mv[mf->v3].co);
- if(mf->v4) {
- if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+ if (mf->v4) {
+ if (cp) glColor3ub(cp[15], cp[14], cp[13]);
glVertex3fv(mv[mf->v4].co);
}
- } else {
- if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+ }
+ else {
+ if (cp) glColor3ub(cp[3], cp[2], cp[1]);
glNormal3sv(mv[mf->v1].no);
glVertex3fv(mv[mf->v1].co);
- if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+ if (cp) glColor3ub(cp[7], cp[6], cp[5]);
glNormal3sv(mv[mf->v2].no);
glVertex3fv(mv[mf->v2].co);
- if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+ if (cp) glColor3ub(cp[11], cp[10], cp[9]);
glNormal3sv(mv[mf->v3].no);
glVertex3fv(mv[mf->v3].co);
- if(mf->v4) {
- if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+ if (mf->v4) {
+ if (cp) glColor3ub(cp[15], cp[14], cp[13]);
glNormal3sv(mv[mf->v4].no);
glVertex3fv(mv[mf->v4].co);
}
@@ -895,16 +897,16 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
int prevstart = 0;
GPU_vertex_setup(dm);
GPU_normal_setup(dm);
- if( useColors && mc )
+ if ( useColors && mc )
GPU_color_setup(dm);
- if( !GPU_buffer_legacy(dm) ) {
+ if ( !GPU_buffer_legacy(dm) ) {
int tottri = dm->drawObject->tot_triangle_point/3;
glShadeModel(GL_SMOOTH);
- if(tottri == 0) {
+ if (tottri == 0) {
/* avoid buffer problems in following code */
}
- if(setDrawOptions == NULL) {
+ if (setDrawOptions == NULL) {
/* just draw the entire face array */
glDrawArrays(GL_TRIANGLES, 0, (tottri) * 3);
}
@@ -912,7 +914,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
/* we need to check if the next material changes */
int next_actualFace= dm->drawObject->triangle_to_mface[0];
- for( i = 0; i < tottri; i++ ) {
+ for ( i = 0; i < tottri; i++ ) {
//int actualFace = dm->drawObject->triangle_to_mface[i];
int actualFace = next_actualFace;
MFace *mface= mf + actualFace;
@@ -920,12 +922,12 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL;
int flush = 0;
- if(i != tottri-1)
+ if (i != tottri-1)
next_actualFace= dm->drawObject->triangle_to_mface[i+1];
orig= (index==NULL) ? actualFace : index[actualFace];
- if(orig == ORIGINDEX_NONE)
+ if (orig == ORIGINDEX_NONE)
draw_option= setMaterial(mface->mat_nr + 1, NULL);
else if (setDrawOptions != NULL)
draw_option= setDrawOptions(userData, orig);
@@ -940,16 +942,16 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
/* ... or when material setting is dissferent */
flush|= mf[actualFace].mat_nr != mf[next_actualFace].mat_nr;
- if(!flush && compareDrawOptions) {
+ if (!flush && compareDrawOptions) {
flush|= compareDrawOptions(userData, actualFace, next_actualFace) == 0;
}
- if(flush) {
+ if (flush) {
int first= prevstart*3;
/* Add one to the length if we're drawing at the end of the array */
int count= (i-prevstart+(draw_option != DM_DRAW_OPTION_SKIP ? 1 : 0))*3;
- if(count)
+ if (count)
glDrawArrays(GL_TRIANGLES, first, count);
prevstart = i + 1;
@@ -976,25 +978,25 @@ static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int
int b;
/* orco texture coordinates */
- if(attribs->totorco) {
- if(attribs->orco.glTexco)
+ if (attribs->totorco) {
+ if (attribs->orco.glTexco)
glTexCoord3fv(attribs->orco.array[index]);
else
glVertexAttrib3fvARB(attribs->orco.glIndex, attribs->orco.array[index]);
}
/* uv texture coordinates */
- for(b = 0; b < attribs->tottface; b++) {
+ for (b = 0; b < attribs->tottface; b++) {
MTFace *tf = &attribs->tface[b].array[a];
- if(attribs->tface[b].glTexco)
+ if (attribs->tface[b].glTexco)
glTexCoord2fv(tf->uv[vert]);
else
glVertexAttrib2fvARB(attribs->tface[b].glIndex, tf->uv[vert]);
}
/* vertex colors */
- for(b = 0; b < attribs->totmcol; b++) {
+ for (b = 0; b < attribs->totmcol; b++) {
MCol *cp = &attribs->mcol[b].array[a*4 + vert];
GLubyte col[4];
col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
@@ -1002,13 +1004,13 @@ static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int
}
/* tangent for normal mapping */
- if(attribs->tottang) {
+ if (attribs->tottang) {
float *tang = attribs->tang.array[a*4 + vert];
glVertexAttrib4fvARB(attribs->tang.glIndex, tang);
}
/* vertex normal */
- if(smoothnormal)
+ if (smoothnormal)
glNormal3sv(mvert[index].no);
/* vertex coordinate */
@@ -1037,52 +1039,53 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
glShadeModel(GL_SMOOTH);
- if( GPU_buffer_legacy(dm) || setDrawOptions != NULL ) {
+ if ( GPU_buffer_legacy(dm) || setDrawOptions != NULL ) {
DEBUG_VBO( "Using legacy code. cdDM_drawMappedFacesGLSL\n" );
memset(&attribs, 0, sizeof(attribs));
glBegin(GL_QUADS);
- for(a = 0; a < dm->numTessFaceData; a++, mface++) {
+ for (a = 0; a < dm->numTessFaceData; a++, mface++) {
const int smoothnormal = (mface->flag & ME_SMOOTH);
new_matnr = mface->mat_nr + 1;
- if(new_matnr != matnr) {
+ if (new_matnr != matnr) {
glEnd();
dodraw = setMaterial(matnr = new_matnr, &gattribs);
- if(dodraw)
+ if (dodraw)
DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
glBegin(GL_QUADS);
}
- if(!dodraw) {
+ if (!dodraw) {
continue;
}
- else if(setDrawOptions) {
+ else if (setDrawOptions) {
orig = (index)? index[a]: a;
- if(orig == ORIGINDEX_NONE) {
+ if (orig == ORIGINDEX_NONE) {
/* since the material is set by setMaterial(), faces with no
* origin can be assumed to be generated by a modifier */
/* continue */
}
- else if(setDrawOptions(userData, orig) == DM_DRAW_OPTION_SKIP)
+ else if (setDrawOptions(userData, orig) == DM_DRAW_OPTION_SKIP)
continue;
}
- if(!smoothnormal) {
- if(nors) {
+ if (!smoothnormal) {
+ if (nors) {
glNormal3fv(nors[a]);
}
else {
/* TODO ideally a normal layer should always be available */
float nor[3];
- if(mface->v4) {
+ if (mface->v4) {
normal_quad_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
- } else {
+ }
+ else {
normal_tri_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
}
glNormal3fv(nor);
@@ -1093,7 +1096,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v2, 1, smoothnormal);
cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal);
- if(mface->v4)
+ if (mface->v4)
cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v4, 3, smoothnormal);
else
cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal);
@@ -1114,21 +1117,21 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
GPU_vertex_setup(dm);
GPU_normal_setup(dm);
- if( !GPU_buffer_legacy(dm) ) {
- for( i = 0; i < dm->drawObject->tot_triangle_point/3; i++ ) {
+ if ( !GPU_buffer_legacy(dm) ) {
+ for ( i = 0; i < dm->drawObject->tot_triangle_point/3; i++ ) {
a = dm->drawObject->triangle_to_mface[i];
mface = mf + a;
new_matnr = mface->mat_nr + 1;
- if(new_matnr != matnr ) {
+ if (new_matnr != matnr ) {
numfaces = curface - start;
- if( numfaces > 0 ) {
+ if ( numfaces > 0 ) {
- if( dodraw ) {
+ if ( dodraw ) {
- if( numdata != 0 ) {
+ if ( numdata != 0 ) {
GPU_buffer_unlock(buffer);
@@ -1137,7 +1140,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
glDrawArrays(GL_TRIANGLES,start*3,numfaces*3);
- if( numdata != 0 ) {
+ if ( numdata != 0 ) {
GPU_buffer_free(buffer);
@@ -1150,43 +1153,43 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
start = curface;
/* prevdraw = dodraw; */ /* UNUSED */
dodraw = setMaterial(matnr = new_matnr, &gattribs);
- if(dodraw) {
+ if (dodraw) {
DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
- if(attribs.totorco) {
+ if (attribs.totorco) {
datatypes[numdata].index = attribs.orco.glIndex;
datatypes[numdata].size = 3;
datatypes[numdata].type = GL_FLOAT;
numdata++;
}
- for(b = 0; b < attribs.tottface; b++) {
+ for (b = 0; b < attribs.tottface; b++) {
datatypes[numdata].index = attribs.tface[b].glIndex;
datatypes[numdata].size = 2;
datatypes[numdata].type = GL_FLOAT;
numdata++;
}
- for(b = 0; b < attribs.totmcol; b++) {
+ for (b = 0; b < attribs.totmcol; b++) {
datatypes[numdata].index = attribs.mcol[b].glIndex;
datatypes[numdata].size = 4;
datatypes[numdata].type = GL_UNSIGNED_BYTE;
numdata++;
}
- if(attribs.tottang) {
+ if (attribs.tottang) {
datatypes[numdata].index = attribs.tang.glIndex;
datatypes[numdata].size = 4;
datatypes[numdata].type = GL_FLOAT;
numdata++;
}
- if( numdata != 0 ) {
+ if ( numdata != 0 ) {
elementsize = GPU_attrib_element_size( datatypes, numdata );
buffer = GPU_buffer_alloc( elementsize*dm->drawObject->tot_triangle_point);
- if( buffer == NULL ) {
+ if ( buffer == NULL ) {
GPU_buffer_unbind();
dm->drawObject->legacy = 1;
return;
}
varray = GPU_buffer_lock_stream(buffer);
- if( varray == NULL ) {
+ if ( varray == NULL ) {
GPU_buffer_unbind();
GPU_buffer_free(buffer);
dm->drawObject->legacy = 1;
@@ -1194,7 +1197,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
}
else {
- /* if the buffer was set, dont use it again.
+ /* if the buffer was set, don't use it again.
* prevdraw was assumed true but didnt run so set to false - [#21036] */
/* prevdraw= 0; */ /* UNUSED */
buffer= NULL;
@@ -1202,15 +1205,15 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
}
- if(dodraw && numdata != 0 ) {
+ if (dodraw && numdata != 0 ) {
offset = 0;
- if(attribs.totorco) {
+ if (attribs.totorco) {
copy_v3_v3((float *)&varray[elementsize*curface*3],(float *)attribs.orco.array[mface->v1]);
copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize],(float *)attribs.orco.array[mface->v2]);
copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize*2],(float *)attribs.orco.array[mface->v3]);
offset += sizeof(float)*3;
}
- for(b = 0; b < attribs.tottface; b++) {
+ for (b = 0; b < attribs.tottface; b++) {
MTFace *tf = &attribs.tface[b].array[a];
copy_v2_v2((float *)&varray[elementsize*curface*3+offset],tf->uv[0]);
copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize],tf->uv[1]);
@@ -1218,7 +1221,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize*2],tf->uv[2]);
offset += sizeof(float)*2;
}
- for(b = 0; b < attribs.totmcol; b++) {
+ for (b = 0; b < attribs.totmcol; b++) {
MCol *cp = &attribs.mcol[b].array[a*4 + 0];
GLubyte col[4];
col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
@@ -1231,7 +1234,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
copy_v4_v4_char((char *)&varray[elementsize*curface*3+offset+elementsize*2], (char *)col);
offset += sizeof(unsigned char)*4;
}
- if(attribs.tottang) {
+ if (attribs.tottang) {
float *tang = attribs.tang.array[a*4 + 0];
copy_v4_v4((float *)&varray[elementsize*curface*3+offset], tang);
tang = attribs.tang.array[a*4 + 1];
@@ -1243,23 +1246,23 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
(void)offset;
}
curface++;
- if(mface->v4) {
- if(dodraw && numdata != 0 ) {
+ if (mface->v4) {
+ if (dodraw && numdata != 0 ) {
offset = 0;
- if(attribs.totorco) {
+ if (attribs.totorco) {
copy_v3_v3((float *)&varray[elementsize*curface*3],(float *)attribs.orco.array[mface->v3]);
copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize],(float *)attribs.orco.array[mface->v4]);
copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize*2],(float *)attribs.orco.array[mface->v1]);
offset += sizeof(float)*3;
}
- for(b = 0; b < attribs.tottface; b++) {
+ for (b = 0; b < attribs.tottface; b++) {
MTFace *tf = &attribs.tface[b].array[a];
copy_v2_v2((float *)&varray[elementsize*curface*3+offset],tf->uv[2]);
copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize],tf->uv[3]);
copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize*2],tf->uv[0]);
offset += sizeof(float)*2;
}
- for(b = 0; b < attribs.totmcol; b++) {
+ for (b = 0; b < attribs.totmcol; b++) {
MCol *cp = &attribs.mcol[b].array[a*4 + 2];
GLubyte col[4];
col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
@@ -1272,7 +1275,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
copy_v4_v4_char((char *)&varray[elementsize*curface*3+offset+elementsize*2], (char *)col);
offset += sizeof(unsigned char)*4;
}
- if(attribs.tottang) {
+ if (attribs.tottang) {
float *tang = attribs.tang.array[a*4 + 2];
copy_v4_v4((float *)&varray[elementsize*curface*3+offset], tang);
tang = attribs.tang.array[a*4 + 3];
@@ -1288,9 +1291,9 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
}
numfaces = curface - start;
- if( numfaces > 0 ) {
- if( dodraw ) {
- if( numdata != 0 ) {
+ if ( numfaces > 0 ) {
+ if ( dodraw ) {
+ if ( numdata != 0 ) {
GPU_buffer_unlock(buffer);
GPU_interleaved_attrib_setup(buffer,datatypes,numdata);
}
@@ -1333,13 +1336,13 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
glBegin(GL_QUADS);
- for(a = 0; a < dm->numTessFaceData; a++, mf++) {
+ for (a = 0; a < dm->numTessFaceData; a++, mf++) {
const int smoothnormal = (mf->flag & ME_SMOOTH);
/* material */
new_matnr = mf->mat_nr + 1;
- if(new_matnr != matnr) {
+ if (new_matnr != matnr) {
glEnd();
setMaterial(userData, matnr = new_matnr, &gattribs);
@@ -1349,23 +1352,23 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
}
/* skipping faces */
- if(setFace) {
+ if (setFace) {
orig = (index)? index[a]: a;
- if(orig != ORIGINDEX_NONE && !setFace(userData, orig))
+ if (orig != ORIGINDEX_NONE && !setFace(userData, orig))
continue;
}
/* smooth normal */
- if(!smoothnormal) {
- if(nors) {
+ if (!smoothnormal) {
+ if (nors) {
glNormal3fv(nors[a]);
}
else {
/* TODO ideally a normal layer should always be available */
float nor[3];
- if(mf->v4)
+ if (mf->v4)
normal_quad_v3( nor,mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co, mvert[mf->v4].co);
else
normal_tri_v3( nor,mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co);
@@ -1379,7 +1382,7 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
cddm_draw_attrib_vertex(&attribs, mvert, a, mf->v2, 1, smoothnormal);
cddm_draw_attrib_vertex(&attribs, mvert, a, mf->v3, 2, smoothnormal);
- if(mf->v4)
+ if (mf->v4)
cddm_draw_attrib_vertex(&attribs, mvert, a, mf->v4, 3, smoothnormal);
else
cddm_draw_attrib_vertex(&attribs, mvert, a, mf->v3, 2, smoothnormal);
@@ -1397,15 +1400,15 @@ static void cdDM_drawMappedEdges(DerivedMesh *dm, DMSetDrawOptions setDrawOption
int i, orig, *index = DM_get_edge_data_layer(dm, CD_ORIGINDEX);
glBegin(GL_LINES);
- for(i = 0; i < dm->numEdgeData; i++, edge++) {
- if(index) {
+ for (i = 0; i < dm->numEdgeData; i++, edge++) {
+ if (index) {
orig = *index++;
- if(setDrawOptions && orig == ORIGINDEX_NONE) continue;
+ if (setDrawOptions && orig == ORIGINDEX_NONE) continue;
}
else
orig = i;
- if(!setDrawOptions || (setDrawOptions(userData, orig) != DM_DRAW_OPTION_SKIP)) {
+ if (!setDrawOptions || (setDrawOptions(userData, orig) != DM_DRAW_OPTION_SKIP)) {
glVertex3fv(vert[edge->v1].co);
glVertex3fv(vert[edge->v2].co);
}
@@ -1422,10 +1425,10 @@ static void cdDM_foreachMappedVert(
MVert *mv = CDDM_get_verts(dm);
int i, orig, *index = DM_get_vert_data_layer(dm, CD_ORIGINDEX);
- for(i = 0; i < dm->numVertData; i++, mv++) {
- if(index) {
+ for (i = 0; i < dm->numVertData; i++, mv++) {
+ if (index) {
orig = *index++;
- if(orig == ORIGINDEX_NONE) continue;
+ if (orig == ORIGINDEX_NONE) continue;
func(userData, orig, mv->co, NULL, mv->no);
}
else
@@ -1444,10 +1447,10 @@ static void cdDM_foreachMappedEdge(
MEdge *med = cddm->medge;
int i, orig, *index = DM_get_edge_data_layer(dm, CD_ORIGINDEX);
- for(i = 0; i < dm->numEdgeData; i++, med++) {
+ for (i = 0; i < dm->numEdgeData; i++, med++) {
if (index) {
orig = *index++;
- if(orig == ORIGINDEX_NONE) continue;
+ if (orig == ORIGINDEX_NONE) continue;
func(userData, orig, mv[med->v1].co, mv[med->v2].co);
}
else
@@ -1469,13 +1472,13 @@ static void cdDM_foreachMappedFaceCenter(
index = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX);
mf = cddm->mpoly;
- for(i = 0; i < dm->numPolyData; i++, mf++) {
+ for (i = 0; i < dm->numPolyData; i++, mf++) {
float cent[3];
float no[3];
if (index) {
orig = *index++;
- if(orig == ORIGINDEX_NONE) continue;
+ if (orig == ORIGINDEX_NONE) continue;
}
else
orig = i;
@@ -1491,7 +1494,8 @@ static void cdDM_foreachMappedFaceCenter(
if (j > 3) {
normal_quad_v3(no, mv[ml->v].co, mv[(ml+1)->v].co,
mv[(ml+2)->v].co, mv[(ml+3)->v].co);
- } else {
+ }
+ else {
normal_tri_v3(no, mv[ml->v].co, mv[(ml+1)->v].co, mv[(ml+2)->v].co);
}
@@ -1528,11 +1532,8 @@ void CDDM_recalc_tessellation(DerivedMesh *dm)
static void cdDM_free_internal(CDDerivedMesh *cddm)
{
- if(cddm->fmap) MEM_freeN(cddm->fmap);
- if(cddm->fmap_mem) MEM_freeN(cddm->fmap_mem);
-
- if(cddm->pmap) MEM_freeN(cddm->pmap);
- if(cddm->pmap_mem) MEM_freeN(cddm->pmap_mem);
+ if (cddm->pmap) MEM_freeN(cddm->pmap);
+ if (cddm->pmap_mem) MEM_freeN(cddm->pmap_mem);
}
static void cdDM_release(DerivedMesh *dm)
@@ -1746,7 +1747,7 @@ static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata,
MCol *mcol;
MLoopCol *mloopcol;
MLoopUV *mloopuv;
- int i, j, hasWCol = CustomData_has_layer(&bm->ldata, CD_WEIGHT_MLOOPCOL);
+ int i, j, hasPCol = CustomData_has_layer(&bm->ldata, CD_PREVIEW_MLOOPCOL);
for (i=0; i < numTex; i++) {
texface = CustomData_get_n(facedata, CD_MTFACE, cdindex, i);
@@ -1767,23 +1768,17 @@ static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata,
for (j=0; j<3; j++) {
l = l3[j];
mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPCOL, i);
- mcol[j].r = mloopcol->r;
- mcol[j].g = mloopcol->g;
- mcol[j].b = mloopcol->b;
- mcol[j].a = mloopcol->a;
+ MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
}
}
- if (hasWCol) {
- mcol = CustomData_get(facedata, cdindex, CD_WEIGHT_MCOL);
+ if (hasPCol) {
+ mcol = CustomData_get(facedata, cdindex, CD_PREVIEW_MCOL);
for (j=0; j<3; j++) {
l = l3[j];
- mloopcol = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_WEIGHT_MLOOPCOL);
- mcol[j].r = mloopcol->r;
- mcol[j].g = mloopcol->g;
- mcol[j].b = mloopcol->b;
- mcol[j].a = mloopcol->a;
+ mloopcol = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_PREVIEW_MLOOPCOL);
+ MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
}
}
}
@@ -1896,7 +1891,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis
polyindex = dm->getTessFaceDataArray(dm, CD_POLYINDEX);
index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
- for(i = 0; i < dm->numTessFaceData; i++, index++, polyindex++) {
+ for (i = 0; i < dm->numTessFaceData; i++, index++, polyindex++) {
MFace *mf = &mface[i];
BMLoop **l = em->looptris[i];
efa = l[0]->f;
@@ -1967,6 +1962,7 @@ static DerivedMesh *cddm_copy_ex(DerivedMesh *source, int faces_from_tessfaces)
DM_from_template(dm, source, DM_TYPE_CDDM, numVerts, numEdges, numTessFaces,
numLoops, numPolys);
dm->deformedOnly = source->deformedOnly;
+ dm->dirty = source->dirty;
CustomData_copy_data(&source->vertData, &dm->vertData, 0, 0, numVerts);
CustomData_copy_data(&source->edgeData, &dm->edgeData, 0, 0, numEdges);
@@ -2033,13 +2029,13 @@ DerivedMesh *CDDM_from_template(DerivedMesh *source,
CustomData_add_layer(&dm->loopData, CD_MLOOP, CD_CALLOC, NULL, numLoops);
CustomData_add_layer(&dm->polyData, CD_MPOLY, CD_CALLOC, NULL, numPolys);
- if(!CustomData_get_layer(&dm->vertData, CD_ORIGINDEX))
+ if (!CustomData_get_layer(&dm->vertData, CD_ORIGINDEX))
CustomData_add_layer(&dm->vertData, CD_ORIGINDEX, CD_CALLOC, NULL, numVerts);
- if(!CustomData_get_layer(&dm->edgeData, CD_ORIGINDEX))
+ if (!CustomData_get_layer(&dm->edgeData, CD_ORIGINDEX))
CustomData_add_layer(&dm->edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
- if(!CustomData_get_layer(&dm->faceData, CD_ORIGINDEX))
+ if (!CustomData_get_layer(&dm->faceData, CD_ORIGINDEX))
CustomData_add_layer(&dm->faceData, CD_ORIGINDEX, CD_CALLOC, NULL, numTessFaces);
- if(!CustomData_get_layer(&dm->faceData, CD_POLYINDEX))
+ if (!CustomData_get_layer(&dm->faceData, CD_POLYINDEX))
CustomData_add_layer(&dm->faceData, CD_POLYINDEX, CD_CALLOC, NULL, numTessFaces);
cddm->mvert = CustomData_get_layer(&dm->vertData, CD_MVERT);
@@ -2061,7 +2057,7 @@ void CDDM_apply_vert_coords(DerivedMesh *dm, float (*vertCoords)[3])
vert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
cddm->mvert = vert;
- for(i = 0; i < dm->numVertData; ++i, ++vert)
+ for (i = 0; i < dm->numVertData; ++i, ++vert)
copy_v3_v3(vert->co, vertCoords[i]);
}
@@ -2075,28 +2071,25 @@ void CDDM_apply_vert_normals(DerivedMesh *dm, short (*vertNormals)[3])
vert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
cddm->mvert = vert;
- for(i = 0; i < dm->numVertData; ++i, ++vert)
+ for (i = 0; i < dm->numVertData; ++i, ++vert)
copy_v3_v3_short(vert->no, vertNormals[i]);
}
-void CDDM_calc_normals_mapping(DerivedMesh *dm)
+void CDDM_calc_normals_mapping_ex(DerivedMesh *dm, const short only_face_normals)
{
CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
float (*face_nors)[3] = NULL;
- /* use this to skip calculating normals on original vert's, this may need to be changed */
- const short only_face_normals = CustomData_is_referenced_layer(&dm->vertData, CD_MVERT);
-
- if(dm->numVertData == 0) return;
+ if (dm->numVertData == 0) return;
/* now we skip calculating vertex normals for referenced layer,
* no need to duplicate verts.
* WATCH THIS, bmesh only change!,
* need to take care of the side effects here - campbell */
-#if 0
+ #if 0
/* we don't want to overwrite any referenced layers */
cddm->mvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
-#endif
+ #endif
if (dm->numTessFaceData == 0) {
@@ -2115,17 +2108,24 @@ void CDDM_calc_normals_mapping(DerivedMesh *dm)
face_nors = MEM_mallocN(sizeof(float)*3*dm->numTessFaceData, "face_nors");
-
+
/* calculate face normals */
mesh_calc_normals_mapping_ex(cddm->mvert, dm->numVertData, CDDM_get_loops(dm), CDDM_get_polys(dm),
- dm->numLoopData, dm->numPolyData, NULL, cddm->mface, dm->numTessFaceData,
- CustomData_get_layer(&dm->faceData, CD_POLYINDEX), face_nors,
- only_face_normals);
-
- CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_ASSIGN,
- face_nors, dm->numTessFaceData);
+ dm->numLoopData, dm->numPolyData, NULL, cddm->mface, dm->numTessFaceData,
+ CustomData_get_layer(&dm->faceData, CD_POLYINDEX), face_nors,
+ only_face_normals);
+
+ CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_ASSIGN,
+ face_nors, dm->numTessFaceData);
+}
+void CDDM_calc_normals_mapping(DerivedMesh *dm)
+{
+ /* use this to skip calculating normals on original vert's, this may need to be changed */
+ const short only_face_normals = CustomData_is_referenced_layer(&dm->vertData, CD_MVERT);
+
+ CDDM_calc_normals_mapping_ex(dm, only_face_normals);
}
/* bmesh note: this matches what we have in trunk */
@@ -2134,7 +2134,7 @@ void CDDM_calc_normals(DerivedMesh *dm)
CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
float (*poly_nors)[3];
- if(dm->numVertData == 0) return;
+ if (dm->numVertData == 0) return;
/* we don't want to overwrite any referenced layers */
cddm->mvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
@@ -2154,7 +2154,7 @@ void CDDM_calc_normals_tessface(DerivedMesh *dm)
CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
float (*face_nors)[3];
- if(dm->numVertData == 0) return;
+ if (dm->numVertData == 0) return;
/* we don't want to overwrite any referenced layers */
cddm->mvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
@@ -2376,7 +2376,8 @@ void CDDM_calc_edges_tessface(DerivedMesh *dm)
BLI_edgehash_insert(eh, mf->v3, mf->v4, NULL);
if (!BLI_edgehash_haskey(eh, mf->v4, mf->v1))
BLI_edgehash_insert(eh, mf->v4, mf->v1, NULL);
- } else {
+ }
+ else {
if (!BLI_edgehash_haskey(eh, mf->v3, mf->v1))
BLI_edgehash_insert(eh, mf->v3, mf->v1, NULL);
}
@@ -2392,7 +2393,7 @@ void CDDM_calc_edges_tessface(DerivedMesh *dm)
ehi = BLI_edgehashIterator_new(eh);
med = CustomData_get_layer(&edgeData, CD_MEDGE);
index = CustomData_get_layer(&edgeData, CD_ORIGINDEX);
- for(i = 0; !BLI_edgehashIterator_isDone(ehi);
+ for (i = 0; !BLI_edgehashIterator_isDone(ehi);
BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) {
BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
@@ -2455,7 +2456,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
ehi = BLI_edgehashIterator_new(eh);
med = CustomData_get_layer(&edgeData, CD_MEDGE);
index = CustomData_get_layer(&edgeData, CD_ORIGINDEX);
- for(i = 0; !BLI_edgehashIterator_isDone(ehi);
+ for (i = 0; !BLI_edgehashIterator_isDone(ehi);
BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) {
BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
j = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
@@ -2581,9 +2582,21 @@ void CDDM_tessfaces_to_faces(DerivedMesh *dm)
MEdge *me;
EdgeHash *eh = BLI_edgehash_new();
int i, totloop;
-
- /*ensure we have all the edges we need*/
+
+ /* ... on second thaughts, better comment this and assume caller knows edge state. */
+#if 0
+ /* ensure we have all the edges we need */
CDDM_calc_edges_tessface(dm);
+#else
+# ifndef NDEBUG
+ {
+ /* ensure we have correct edges on non release builds */
+ i = cddm->dm.numEdgeData;
+ CDDM_calc_edges_tessface(dm);
+ BLI_assert(cddm->dm.numEdgeData == i);
+ }
+# endif
+#endif
/*build edge hash*/
me = cddm->medge;
@@ -2622,7 +2635,7 @@ void CDDM_tessfaces_to_faces(DerivedMesh *dm)
mp = cddm->mpoly;
ml = cddm->mloop;
l = 0;
- for (i=0; i<cddm->dm.numTessFaceData; i++, mf++, mp++) {
+ for (i=0; i<cddm->dm.numTessFaceData; i++, mf++, mp++, polyindex++) {
mp->flag = mf->flag;
mp->loopstart = l;
mp->mat_nr = mf->mat_nr;
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 3aeeb265c01..0dd7687f998 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -41,6 +41,8 @@
#include "BLI_utildefines.h"
#include "BLI_linklist.h"
+#include "BLF_translation.h"
+
#include "BKE_cdderivedmesh.h"
#include "BKE_cloth.h"
#include "BKE_effect.h"
@@ -156,10 +158,10 @@ void cloth_init ( ClothModifierData *clmd )
clmd->sim_parms->goalfrict = 0.0f;
clmd->sim_parms->velocity_smooth = 0.0f;
- if(!clmd->sim_parms->effector_weights)
+ if (!clmd->sim_parms->effector_weights)
clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL);
- if(clmd->point_cache)
+ if (clmd->point_cache)
clmd->point_cache->step = 1;
}
@@ -171,25 +173,25 @@ static BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float eps
ClothVertex *verts;
float co[12];
- if(!clmd)
+ if (!clmd)
return NULL;
cloth = clmd->clothObject;
- if(!cloth)
+ if (!cloth)
return NULL;
verts = cloth->verts;
// in the moment, return zero if no faces there
- if(!cloth->numverts)
+ if (!cloth->numverts)
return NULL;
// create quadtree with k=26
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);
@@ -211,32 +213,32 @@ static BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon
MFace *mfaces;
float co[12];
- if(!clmd)
+ if (!clmd)
return NULL;
cloth = clmd->clothObject;
- if(!cloth)
+ if (!cloth)
return NULL;
verts = cloth->verts;
mfaces = cloth->mfaces;
// in the moment, return zero if no faces there
- if(!cloth->numfaces)
+ if (!cloth->numfaces)
return NULL;
// create quadtree with k=26
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);
- if(mfaces->v4)
+ if (mfaces->v4)
copy_v3_v3(&co[3*3], verts[mfaces->v4].xold);
BLI_bvhtree_insert(bvhtree, i, co, (mfaces->v4 ? 4 : 3));
@@ -258,32 +260,32 @@ void bvhtree_update_from_cloth(ClothModifierData *clmd, int moving)
float co[12], co_moving[12];
int ret = 0;
- if(!bvhtree)
+ if (!bvhtree)
return;
mfaces = cloth->mfaces;
// update vertex position in bvh tree
- if(verts && mfaces)
+ if (verts && mfaces)
{
- 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].txold);
copy_v3_v3(&co[1*3], verts[mfaces->v2].txold);
copy_v3_v3(&co[2*3], verts[mfaces->v3].txold);
- if(mfaces->v4)
+ if (mfaces->v4)
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);
copy_v3_v3(&co_moving[2*3], verts[mfaces->v3].tx);
- if(mfaces->v4)
+ if (mfaces->v4)
copy_v3_v3(&co_moving[3*3], verts[mfaces->v4].tx);
ret = BLI_bvhtree_update_node(bvhtree, i, co, co_moving, (mfaces->v4 ? 4 : 3));
@@ -293,7 +295,7 @@ void bvhtree_update_from_cloth(ClothModifierData *clmd, int moving)
}
// check if tree is already full
- if(!ret)
+ if (!ret)
break;
}
@@ -311,20 +313,20 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, int moving)
float co[12], co_moving[12];
int ret = 0;
- if(!bvhtree)
+ if (!bvhtree)
return;
mfaces = cloth->mfaces;
// update vertex position in bvh tree
- if(verts && mfaces)
+ if (verts && mfaces)
{
- for(i = 0; i < cloth->numverts; i++, verts++)
+ 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);
@@ -336,7 +338,7 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, int moving)
}
// check if tree is already full
- if(!ret)
+ if (!ret)
break;
}
@@ -351,7 +353,7 @@ void cloth_clear_cache(Object *ob, ClothModifierData *clmd, float framenr)
BKE_ptcache_id_from_cloth(&pid, ob, clmd);
// don't do anything as long as we're in editmode!
- if(pid.cache->edit && ob->mode & OB_MODE_PARTICLE_EDIT)
+ if (pid.cache->edit && ob->mode & OB_MODE_PARTICLE_EDIT)
return;
BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_AFTER, framenr);
@@ -364,13 +366,13 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
cache= clmd->point_cache;
/* initialize simulation data if it didn't exist already */
- if(clmd->clothObject == NULL) {
- if(!cloth_from_object(ob, clmd, result, framenr, 1)) {
+ if (clmd->clothObject == NULL) {
+ if (!cloth_from_object(ob, clmd, result, framenr, 1)) {
BKE_ptcache_invalidate(cache);
return 0;
}
- if(clmd->clothObject == NULL) {
+ if (clmd->clothObject == NULL) {
BKE_ptcache_invalidate(cache);
return 0;
}
@@ -398,7 +400,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
mvert = result->getVertArray(result);
/* force any pinned verts to their constrained location. */
- for(i = 0; i < clmd->clothObject->numverts; i++, verts++) {
+ for (i = 0; i < clmd->clothObject->numverts; i++, verts++) {
/* save the previous position. */
copy_v3_v3(verts->xold, verts->xconst);
copy_v3_v3(verts->txold, verts->x);
@@ -413,7 +415,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
tstart();
/* call the solver. */
- if(solvers [clmd->sim_parms->solver_type].solver)
+ if (solvers [clmd->sim_parms->solver_type].solver)
ret = solvers[clmd->sim_parms->solver_type].solver(ob, framenr, clmd, effectors);
tend();
@@ -444,7 +446,7 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
BKE_ptcache_id_time(&pid, scene, framenr, &startframe, &endframe, &timescale);
clmd->sim_parms->timescale= timescale;
- if(clmd->sim_parms->reset
+ if (clmd->sim_parms->reset
|| (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0)
|| (clmd->clothObject && dm->getNumVerts(dm) != clmd->clothObject->numverts))
{
@@ -461,11 +463,11 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
clmd->sim_parms->dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame;
/* handle continuous simulation with the play button */
- if(BKE_ptcache_get_continue_physics() || ((clmd->sim_parms->preroll > 0) && (framenr > startframe - clmd->sim_parms->preroll) && (framenr < startframe))) {
+ if (BKE_ptcache_get_continue_physics() || ((clmd->sim_parms->preroll > 0) && (framenr > startframe - clmd->sim_parms->preroll) && (framenr < startframe))) {
BKE_ptcache_invalidate(cache);
/* do simulation */
- if(!do_init_cloth(ob, clmd, dm, framenr))
+ if (!do_init_cloth(ob, clmd, dm, framenr))
return;
do_step_cloth(ob, clmd, dm, framenr);
@@ -477,19 +479,19 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
}
/* simulation is only active during a specific period */
- if(framenr < startframe) {
+ if (framenr < startframe) {
BKE_ptcache_invalidate(cache);
return;
}
- else if(framenr > endframe) {
+ else if (framenr > endframe) {
framenr= endframe;
}
/* initialize simulation data if it didn't exist already */
- if(!do_init_cloth(ob, clmd, dm, framenr))
+ if (!do_init_cloth(ob, clmd, dm, framenr))
return;
- if((framenr == startframe) && (clmd->sim_parms->preroll == 0)) {
+ if ((framenr == startframe) && (clmd->sim_parms->preroll == 0)) {
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
do_init_cloth(ob, clmd, dm, framenr);
BKE_ptcache_validate(cache, framenr);
@@ -501,33 +503,33 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
/* try to read from cache */
cache_result = BKE_ptcache_read(&pid, (float)framenr+scene->r.subframe);
- if(cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) {
+ if (cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) {
implicit_set_positions(clmd);
cloth_to_object (ob, clmd, vertexCos);
BKE_ptcache_validate(cache, framenr);
- if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
+ if (cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
BKE_ptcache_write(&pid, framenr);
clmd->clothObject->last_frame= framenr;
return;
}
- else if(cache_result==PTCACHE_READ_OLD) {
+ else if (cache_result==PTCACHE_READ_OLD) {
implicit_set_positions(clmd);
}
- else if( /*ob->id.lib ||*/ (cache->flag & PTCACHE_BAKED)) { /* 2.4x disabled lib, but this can be used in some cases, testing further - campbell */
+ else if ( /*ob->id.lib ||*/ (cache->flag & PTCACHE_BAKED)) { /* 2.4x disabled lib, but this can be used in some cases, testing further - campbell */
/* if baked and nothing in cache, do nothing */
BKE_ptcache_invalidate(cache);
return;
}
- if(framenr!=clmd->clothObject->last_frame+1)
+ if (framenr!=clmd->clothObject->last_frame+1)
return;
/* if on second frame, write cache for first frame */
- if(cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
+ if (cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
BKE_ptcache_write(&pid, startframe);
clmd->sim_parms->timescale *= framenr - cache->simframe;
@@ -535,7 +537,7 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
/* do simulation */
BKE_ptcache_validate(cache, framenr);
- if(!do_step_cloth(ob, clmd, dm, framenr)) {
+ if (!do_step_cloth(ob, clmd, dm, framenr)) {
BKE_ptcache_invalidate(cache);
}
else
@@ -575,7 +577,7 @@ void cloth_free_modifier(ClothModifierData *clmd )
if ( cloth->springs != NULL )
{
LinkNode *search = cloth->springs;
- while(search)
+ while (search)
{
ClothSpring *spring = search->link;
@@ -601,12 +603,12 @@ void cloth_free_modifier(ClothModifierData *clmd )
if ( cloth->mfaces )
MEM_freeN ( cloth->mfaces );
- if(cloth->edgehash)
+ if (cloth->edgehash)
BLI_edgehash_free ( cloth->edgehash, NULL );
/*
- if(clmd->clothObject->facemarks)
+ if (clmd->clothObject->facemarks)
MEM_freeN(clmd->clothObject->facemarks);
*/
MEM_freeN ( cloth );
@@ -618,7 +620,7 @@ void cloth_free_modifier(ClothModifierData *clmd )
void cloth_free_modifier_extern ( ClothModifierData *clmd )
{
Cloth *cloth = NULL;
- if(G.rt > 0)
+ if (G.rt > 0)
printf("cloth_free_modifier_extern\n");
if ( !clmd )
@@ -628,7 +630,7 @@ void cloth_free_modifier_extern ( ClothModifierData *clmd )
if ( cloth )
{
- if(G.rt > 0)
+ if (G.rt > 0)
printf("cloth_free_modifier_extern in\n");
// If our solver provides a free function, call it
@@ -648,7 +650,7 @@ void cloth_free_modifier_extern ( ClothModifierData *clmd )
if ( cloth->springs != NULL )
{
LinkNode *search = cloth->springs;
- while(search)
+ while (search)
{
ClothSpring *spring = search->link;
@@ -674,12 +676,12 @@ void cloth_free_modifier_extern ( ClothModifierData *clmd )
if ( cloth->mfaces )
MEM_freeN ( cloth->mfaces );
- if(cloth->edgehash)
+ if (cloth->edgehash)
BLI_edgehash_free ( cloth->edgehash, NULL );
/*
- if(clmd->clothObject->facemarks)
+ if (clmd->clothObject->facemarks)
MEM_freeN(clmd->clothObject->facemarks);
*/
MEM_freeN ( cloth );
@@ -775,20 +777,20 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING )
{
- if( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_struct-1))
+ 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;
}
}
/*
// for later
- if( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_weight-1))
+ if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_weight-1))
{
verts->mass = dvert->dw [j].weight;
}
@@ -813,7 +815,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
if ( clmd->clothObject != NULL )
{
cloth_free_modifier ( clmd );
- if(G.rt > 0)
+ if (G.rt > 0)
printf("cloth_free_modifier cloth_from_object\n");
}
@@ -827,7 +829,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
clmd->clothObject->edgehash = NULL;
}
else if (!clmd->clothObject) {
- modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject." );
+ modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject."));
return 0;
}
@@ -841,7 +843,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
clmd->clothObject->springs = NULL;
clmd->clothObject->numsprings = -1;
- if( clmd->sim_parms->shapekey_rest )
+ if ( clmd->sim_parms->shapekey_rest )
shapekey_rest = dm->getVertDataArray ( dm, CD_CLOTH_ORCO );
mvert = dm->getVertArray ( dm );
@@ -851,13 +853,13 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
// set initial values
for ( i = 0; i < dm->getNumVerts(dm); i++, verts++ )
{
- if(first)
+ if (first)
{
copy_v3_v3( verts->x, mvert[i].co );
mul_m4_v3( ob->obmat, verts->x );
- if( shapekey_rest ) {
+ if ( shapekey_rest ) {
verts->xrest= shapekey_rest[i];
mul_m4_v3( ob->obmat, verts->xrest );
}
@@ -892,14 +894,14 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
if ( !cloth_build_springs ( clmd, dm ) )
{
cloth_free_modifier ( clmd );
- modifier_setError ( & ( clmd->modifier ), "Can't build springs." );
+ 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))
+ 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);
}
@@ -910,12 +912,12 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
solvers [clmd->sim_parms->solver_type].init ( ob, clmd );
}
- if(!first)
+ if (!first)
implicit_set_positions(clmd);
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));
}
@@ -938,7 +940,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
if ( clmd->clothObject->verts == NULL )
{
cloth_free_modifier ( clmd );
- modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->verts." );
+ modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->verts."));
printf("cloth_free_modifier clmd->clothObject->verts\n");
return;
}
@@ -949,7 +951,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
if ( clmd->clothObject->mfaces == NULL )
{
cloth_free_modifier ( clmd );
- modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->mfaces." );
+ modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->mfaces."));
printf("cloth_free_modifier clmd->clothObject->mfaces\n");
return;
}
@@ -975,13 +977,13 @@ 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" );
- if(!spring)
+ if (!spring)
return 0;
spring->ij = indexA;
@@ -1007,7 +1009,7 @@ static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), Li
if ( cloth->springs != NULL )
{
LinkNode *search = cloth->springs;
- while(search)
+ while (search)
{
ClothSpring *spring = search->link;
@@ -1019,7 +1021,7 @@ static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), Li
cloth->springs = NULL;
}
- if(edgelist)
+ if (edgelist)
{
for ( i = 0; i < cloth->numverts; i++ )
{
@@ -1029,7 +1031,7 @@ static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), Li
MEM_freeN ( edgelist );
}
- if(cloth->edgehash)
+ if (cloth->edgehash)
BLI_edgehash_free ( cloth->edgehash, NULL );
}
@@ -1057,7 +1059,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
edgelist = MEM_callocN ( sizeof ( LinkNode * ) * numverts, "cloth_edgelist_alloc" );
- if(!edgelist)
+ if (!edgelist)
return 0;
for ( i = 0; i < numverts; i++ )
@@ -1099,10 +1101,10 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
}
}
- if(struct_springs > 0)
+ 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);
}
@@ -1116,7 +1118,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
spring = ( ClothSpring *) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
- if(!spring)
+ if (!spring)
{
cloth_free_errorsprings(cloth, edgehash, edgelist);
return 0;
@@ -1138,7 +1140,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
// if ( mface[i].v4 ) --> Quad face
spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
- if(!spring)
+ if (!spring)
{
cloth_free_errorsprings(cloth, edgehash, edgelist);
return 0;
@@ -1157,7 +1159,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
BLI_linklist_prepend ( &cloth->springs, spring );
}
- if(numfaces) {
+ if (numfaces) {
// bending springs
search2 = cloth->springs;
for ( i = struct_springs; i < struct_springs+shear_springs; i++ )
@@ -1179,7 +1181,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
{
spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
- if(!spring)
+ if (!spring)
{
cloth_free_errorsprings(cloth, edgehash, edgelist);
return 0;
@@ -1200,7 +1202,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
search2 = search2->next;
}
}
- else if(struct_springs > 2) {
+ else if (struct_springs > 2) {
/* bending springs for hair strands */
/* The current algorightm only goes through the edges in order of the mesh edges list */
/* and makes springs between the outer vert of edges sharing a vertice. This works just */
@@ -1210,15 +1212,15 @@ 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) {
+ 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;
@@ -1245,7 +1247,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
for ( i = 0; i < numfaces; i++ ) // edge springs
{
- if(mface[i].v4)
+ if (mface[i].v4)
{
BLI_edgehash_insert ( edgehash, MIN2(mface[i].v1, mface[i].v3), MAX2(mface[i].v3, mface[i].v1), NULL );
@@ -1268,7 +1270,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
cloth->edgehash = edgehash;
- if(G.rt>0)
+ if (G.rt>0)
printf("avg_len: %f\n",clmd->sim_parms->avg_spring_len);
return 1;
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index f19226cedf0..f6a6ef068d6 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -75,7 +75,7 @@ Collision modifier code start
***********************************/
/* step is limited from 0 (frame start position) to 1 (frame end position) */
-void collision_move_object ( CollisionModifierData *collmd, float step, float prevstep )
+void collision_move_object(CollisionModifierData *collmd, float step, float prevstep)
{
float tv[3] = {0, 0, 0};
unsigned int i = 0;
@@ -174,7 +174,7 @@ Collision modifier code end
* copied from SOLVE_CUBIC.C --> GSL
*/
-#define mySWAP(a,b) do { double tmp = b ; b = a ; a = tmp ; } while(0)
+#define mySWAP(a,b) do { double tmp = b ; b = a ; a = tmp ; } while (0)
#if 0 /* UNUSED */
static int
gsl_poly_solve_cubic (double a, double b, double c,
@@ -486,10 +486,10 @@ static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3
DO_INLINE void collision_interpolateOnTriangle ( float to[3], float v1[3], float v2[3], float v3[3], double w1, double w2, double w3 )
{
- to[0] = to[1] = to[2] = 0;
- VECADDMUL ( to, v1, w1 );
- VECADDMUL ( to, v2, w2 );
- VECADDMUL ( to, v3, w3 );
+ zero_v3(to);
+ VECADDMUL(to, v1, w1);
+ VECADDMUL(to, v2, w2);
+ VECADDMUL(to, v3, w3);
}
#ifndef WITH_ELTOPO
@@ -1021,7 +1021,8 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
result = 1;
}
- } else {
+ }
+ else {
w1 = collpair->bary[0]; w2 = collpair->bary[1]; w3 = collpair->bary[2];
// Calculate relative "velocity".
@@ -1353,7 +1354,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTree
collpair->flag = COLLISION_USE_COLLFACE;
collpair++;
- } else if (ret && j >= 3) { /*coll vert versus cloth face*/
+ }
+ else if (ret && j >= 3) { /*coll vert versus cloth face*/
collpair->ap1 = ap1; collpair->ap2 = ap2; collpair->ap3 = ap3;
collpair->collp = collp;
@@ -1547,7 +1549,7 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
sub_v3_v3v3 ( relativeVelocity, v2, v1 );
- if(sqrt(dot_v3v3(relativeVelocity, relativeVelocity)) >= distance)
+ if (sqrt(dot_v3v3(relativeVelocity, relativeVelocity)) >= distance)
{
// check for collision in the future
collpair->flag |= COLLISION_IN_FUTURE;
@@ -1789,9 +1791,9 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
CLAMP(*out_a1, 0.0, 1.0);
calculateEENormal(np11, np12, np21, np22, out_normal);
- if(*out_a1 > .5)
+ if (*out_a1 > .5)
{
- if(*out_a2 > .5)
+ if (*out_a2 > .5)
{
sub_v3_v3v3(temp, np12, np22);
}
@@ -1802,7 +1804,7 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
}
else
{
- if(*out_a2 > .5)
+ if (*out_a2 > .5)
{
sub_v3_v3v3(temp, np11, np22);
}
@@ -1920,11 +1922,11 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
cloth1 = clmd->clothObject;
verts1 = cloth1->verts;
- for(i = 0; i < 9; i++)
+ for (i = 0; i < 9; i++)
{
// 9 edge - edge possibilities
- if(i == 0) // cloth edge: 1-2; coll edge: 1-2
+ if (i == 0) // cloth edge: 1-2; coll edge: 1-2
{
edgecollpair.p11 = collpair->ap1;
edgecollpair.p12 = collpair->ap2;
@@ -1932,7 +1934,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
edgecollpair.p21 = collpair->bp1;
edgecollpair.p22 = collpair->bp2;
}
- else if(i == 1) // cloth edge: 1-2; coll edge: 2-3
+ else if (i == 1) // cloth edge: 1-2; coll edge: 2-3
{
edgecollpair.p11 = collpair->ap1;
edgecollpair.p12 = collpair->ap2;
@@ -1940,7 +1942,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
edgecollpair.p21 = collpair->bp2;
edgecollpair.p22 = collpair->bp3;
}
- else if(i == 2) // cloth edge: 1-2; coll edge: 1-3
+ else if (i == 2) // cloth edge: 1-2; coll edge: 1-3
{
edgecollpair.p11 = collpair->ap1;
edgecollpair.p12 = collpair->ap2;
@@ -1948,7 +1950,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
edgecollpair.p21 = collpair->bp1;
edgecollpair.p22 = collpair->bp3;
}
- else if(i == 3) // cloth edge: 2-3; coll edge: 1-2
+ else if (i == 3) // cloth edge: 2-3; coll edge: 1-2
{
edgecollpair.p11 = collpair->ap2;
edgecollpair.p12 = collpair->ap3;
@@ -1956,7 +1958,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
edgecollpair.p21 = collpair->bp1;
edgecollpair.p22 = collpair->bp2;
}
- else if(i == 4) // cloth edge: 2-3; coll edge: 2-3
+ else if (i == 4) // cloth edge: 2-3; coll edge: 2-3
{
edgecollpair.p11 = collpair->ap2;
edgecollpair.p12 = collpair->ap3;
@@ -1964,7 +1966,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
edgecollpair.p21 = collpair->bp2;
edgecollpair.p22 = collpair->bp3;
}
- else if(i == 5) // cloth edge: 2-3; coll edge: 1-3
+ else if (i == 5) // cloth edge: 2-3; coll edge: 1-3
{
edgecollpair.p11 = collpair->ap2;
edgecollpair.p12 = collpair->ap3;
@@ -1972,7 +1974,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
edgecollpair.p21 = collpair->bp1;
edgecollpair.p22 = collpair->bp3;
}
- else if(i ==6) // cloth edge: 1-3; coll edge: 1-2
+ else if (i ==6) // cloth edge: 1-3; coll edge: 1-2
{
edgecollpair.p11 = collpair->ap1;
edgecollpair.p12 = collpair->ap3;
@@ -1980,7 +1982,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
edgecollpair.p21 = collpair->bp1;
edgecollpair.p22 = collpair->bp2;
}
- else if(i ==7) // cloth edge: 1-3; coll edge: 2-3
+ else if (i ==7) // cloth edge: 1-3; coll edge: 2-3
{
edgecollpair.p11 = collpair->ap1;
edgecollpair.p12 = collpair->ap3;
@@ -1988,7 +1990,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
edgecollpair.p21 = collpair->bp2;
edgecollpair.p22 = collpair->bp3;
}
- else if(i == 8) // cloth edge: 1-3; coll edge: 1-3
+ else if (i == 8) // cloth edge: 1-3; coll edge: 1-3
{
edgecollpair.p11 = collpair->ap1;
edgecollpair.p12 = collpair->ap3;
@@ -1997,9 +1999,9 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
edgecollpair.p22 = collpair->bp3;
}
/*
- if((edgecollpair.p11 == 3) && (edgecollpair.p12 == 16))
+ if ((edgecollpair.p11 == 3) && (edgecollpair.p12 == 16))
printf("Ahier!\n");
- if((edgecollpair.p11 == 16) && (edgecollpair.p12 == 3))
+ if ((edgecollpair.p11 == 16) && (edgecollpair.p12 == 3))
printf("Ahier!\n");
*/
@@ -2017,9 +2019,9 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
numsolutions = cloth_get_collision_time ( x1, v1, x2, v2, x3, v3, solution );
- if((edgecollpair.p11 == 3 && edgecollpair.p12==16)|| (edgecollpair.p11==16 && edgecollpair.p12==3))
+ if ((edgecollpair.p11 == 3 && edgecollpair.p12==16)|| (edgecollpair.p11==16 && edgecollpair.p12==3))
{
- if(edgecollpair.p21==6 || edgecollpair.p22 == 6)
+ if (edgecollpair.p21==6 || edgecollpair.p22 == 6)
{
printf("dist: %f, sol[k]: %f, sol2[k]: %f\n", distance, solution[k], solution2[k]);
printf("a1: %f, a2: %f, b1: %f, b2: %f\n", x1[0], x2[0], x3[0], v1[0]);
@@ -2071,7 +2073,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
out_normalVelocity = dot_v3v3(vrel_1_to_2, out_normal);
/*
// this correction results in wrong normals sometimes?
- if(out_normalVelocity < 0.0)
+ if (out_normalVelocity < 0.0)
{
out_normalVelocity*= -1.0;
negate_v3(out_normal);
@@ -2131,20 +2133,20 @@ static int cloth_collision_moving ( ClothModifierData *clmd, CollisionModifierDa
}
#endif
-static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned int *maxobj, Object *ob, Object *self, int level)
+static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned int *maxobj, Object *ob, Object *self, int level, unsigned int modifier_type)
{
CollisionModifierData *cmd= NULL;
- if(ob == self)
+ if (ob == self)
return;
/* only get objects with collision modifier */
- if(ob->pd && ob->pd->deflect)
- cmd= (CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
+ if (((modifier_type == eModifierType_Collision) && ob->pd && ob->pd->deflect) || (modifier_type != eModifierType_Collision))
+ cmd= (CollisionModifierData *)modifiers_findByType(ob, modifier_type);
- if(cmd) {
+ if (cmd) {
/* extend array */
- if(*numobj >= *maxobj) {
+ if (*numobj >= *maxobj) {
*maxobj *= 2;
*objs= MEM_reallocN(*objs, sizeof(Object*)*(*maxobj));
}
@@ -2154,19 +2156,19 @@ static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned
}
/* objects in dupli groups, one level only for now */
- if(ob->dup_group && level == 0) {
+ if (ob->dup_group && level == 0) {
GroupObject *go;
Group *group= ob->dup_group;
/* add objects */
- for(go= group->gobject.first; go; go= go->next)
- add_collision_object(objs, numobj, maxobj, go->ob, self, level+1);
+ for (go= group->gobject.first; go; go= go->next)
+ add_collision_object(objs, numobj, maxobj, go->ob, self, level+1, modifier_type);
}
}
// return all collision objects in scene
// collision object will exclude self
-Object **get_collisionobjects(Scene *scene, Object *self, Group *group, unsigned int *numcollobj)
+Object **get_collisionobjects(Scene *scene, Object *self, Group *group, unsigned int *numcollobj, unsigned int modifier_type)
{
Base *base;
Object **objs;
@@ -2176,17 +2178,17 @@ Object **get_collisionobjects(Scene *scene, Object *self, Group *group, unsigned
objs= MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray");
/* gather all collision objects */
- if(group) {
+ if (group) {
/* use specified group */
- for(go= group->gobject.first; go; go= go->next)
- add_collision_object(&objs, &numobj, &maxobj, go->ob, self, 0);
+ for (go= group->gobject.first; go; go= go->next)
+ add_collision_object(&objs, &numobj, &maxobj, go->ob, self, 0, modifier_type);
}
else {
Scene *sce_iter;
/* add objects in same layer in scene */
- for(SETLOOPER(scene, sce_iter, base)) {
- if(base->lay & self->lay)
- add_collision_object(&objs, &numobj, &maxobj, base->object, self, 0);
+ for (SETLOOPER(scene, sce_iter, base)) {
+ if (base->lay & self->lay)
+ add_collision_object(&objs, &numobj, &maxobj, base->object, self, 0, modifier_type);
}
}
@@ -2201,14 +2203,14 @@ static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self,
CollisionModifierData *cmd= NULL;
ColliderCache *col;
- if(ob == self)
+ if (ob == self)
return;
- if(ob->pd && ob->pd->deflect)
+ if (ob->pd && ob->pd->deflect)
cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
- if(cmd && cmd->bvhtree) {
- if(*objs == NULL)
+ if (cmd && cmd->bvhtree) {
+ if (*objs == NULL)
*objs = MEM_callocN(sizeof(ListBase), "ColliderCache array");
col = MEM_callocN(sizeof(ColliderCache), "ColliderCache");
@@ -2220,12 +2222,12 @@ static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self,
}
/* objects in dupli groups, one level only for now */
- if(ob->dup_group && level == 0) {
+ if (ob->dup_group && level == 0) {
GroupObject *go;
Group *group= ob->dup_group;
/* add objects */
- for(go= group->gobject.first; go; go= go->next)
+ for (go= group->gobject.first; go; go= go->next)
add_collider_cache_object(objs, go->ob, self, level+1);
}
}
@@ -2236,8 +2238,8 @@ ListBase *get_collider_cache(Scene *scene, Object *self, Group *group)
ListBase *objs= NULL;
/* add object in same layer in scene */
- if(group) {
- for(go= group->gobject.first; go; go= go->next)
+ if (group) {
+ for (go= group->gobject.first; go; go= go->next)
add_collider_cache_object(&objs, go->ob, self, 0);
}
else {
@@ -2245,8 +2247,8 @@ ListBase *get_collider_cache(Scene *scene, Object *self, Group *group)
Base *base;
/* add objects in same layer in scene */
- for(SETLOOPER(scene, sce_iter, base)) {
- if(!self || (base->lay & self->lay))
+ for (SETLOOPER(scene, sce_iter, base)) {
+ if (!self || (base->lay & self->lay))
add_collider_cache_object(&objs, base->object, self, 0);
}
@@ -2257,7 +2259,7 @@ ListBase *get_collider_cache(Scene *scene, Object *self, Group *group)
void free_collider_cache(ListBase **colliders)
{
- if(*colliders) {
+ if (*colliders) {
BLI_freelistN(*colliders);
MEM_freeN(*colliders);
*colliders = NULL;
@@ -2385,9 +2387,9 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
bvhtree_update_from_cloth ( clmd, 1 ); // 0 means STATIC, 1 means MOVING (see later in this function)
bvhselftree_update_from_cloth ( clmd, 0 ); // 0 means STATIC, 1 means MOVING (see later in this function)
- collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj);
+ collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision);
- if(!collobjs)
+ if (!collobjs)
return 0;
do
@@ -2400,14 +2402,14 @@ 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;
unsigned int result = 0;
- if(!collmd->bvhtree)
+ if (!collmd->bvhtree)
continue;
/* move object to position (step) in time */
@@ -2418,7 +2420,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
overlap = BLI_bvhtree_overlap ( cloth_bvh, collmd->bvhtree, &result );
// go to next object if no overlap is there
- if( result && overlap ) {
+ if ( result && overlap ) {
/* check if collisions really happen (costly near check) */
cloth_bvh_objcollisions_nearcheck ( clmd, collmd, &collisions[i],
&collisions_index[i], result, overlap, dt/(float)clmd->coll_parms->loop_count);
@@ -2433,7 +2435,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
}
rounds++;
- for(i = 0; i < numcollobj; i++)
+ for (i = 0; i < numcollobj; i++)
{
if ( collisions[i] ) MEM_freeN ( collisions[i] );
}
@@ -2467,7 +2469,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
////////////////////////////////////////////////////////////
if ( clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF )
{
- for(l = 0; l < (unsigned int)clmd->coll_parms->self_loop_count; l++)
+ for (l = 0; l < (unsigned int)clmd->coll_parms->self_loop_count; l++)
{
// TODO: add coll quality rounds again
BVHTreeOverlap *overlap = NULL;
@@ -2573,7 +2575,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
}
while ( ret2 && ( clmd->coll_parms->loop_count>rounds ) );
- if(collobjs)
+ if (collobjs)
MEM_freeN(collobjs);
return 1|MIN2 ( ret, 1 );
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 4f288594dc9..8ec3ad567a2 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -64,7 +64,7 @@ CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, floa
cumap= MEM_callocN(sizeof(CurveMapping), "new curvemap");
cumap->flag= CUMA_DO_CLIP;
- if(tot==4) cumap->cur= 3; /* rhms, hack for 'col' curve? */
+ if (tot==4) cumap->cur= 3; /* rhms, hack for 'col' curve? */
clipminx = MIN2(minx, maxx);
clipminy = MIN2(miny, maxy);
@@ -77,7 +77,7 @@ CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, floa
cumap->white[0]= cumap->white[1]= cumap->white[2]= 1.0f;
cumap->bwmul[0]= cumap->bwmul[1]= cumap->bwmul[2]= 1.0f;
- for(a=0; a<tot; a++) {
+ for (a=0; a<tot; a++) {
cumap->cm[a].flag= CUMA_EXTEND_EXTRAPOLATE;
cumap->cm[a].totpoint= 2;
cumap->cm[a].curve= MEM_callocN(2*sizeof(CurveMapPoint), "curve points");
@@ -97,11 +97,11 @@ void curvemapping_free(CurveMapping *cumap)
{
int a;
- if(cumap) {
- for(a=0; a<CM_TOT; a++) {
- if(cumap->cm[a].curve) MEM_freeN(cumap->cm[a].curve);
- if(cumap->cm[a].table) MEM_freeN(cumap->cm[a].table);
- if(cumap->cm[a].premultable) MEM_freeN(cumap->cm[a].premultable);
+ if (cumap) {
+ for (a=0; a<CM_TOT; a++) {
+ if (cumap->cm[a].curve) MEM_freeN(cumap->cm[a].curve);
+ if (cumap->cm[a].table) MEM_freeN(cumap->cm[a].table);
+ if (cumap->cm[a].premultable) MEM_freeN(cumap->cm[a].premultable);
}
MEM_freeN(cumap);
}
@@ -111,14 +111,14 @@ CurveMapping *curvemapping_copy(CurveMapping *cumap)
{
int a;
- if(cumap) {
+ if (cumap) {
CurveMapping *cumapn= MEM_dupallocN(cumap);
- for(a=0; a<CM_TOT; a++) {
- if(cumap->cm[a].curve)
+ for (a=0; a<CM_TOT; a++) {
+ if (cumap->cm[a].curve)
cumapn->cm[a].curve= MEM_dupallocN(cumap->cm[a].curve);
- if(cumap->cm[a].table)
+ if (cumap->cm[a].table)
cumapn->cm[a].table= MEM_dupallocN(cumap->cm[a].table);
- if(cumap->cm[a].premultable)
+ if (cumap->cm[a].premultable)
cumapn->cm[a].premultable= MEM_dupallocN(cumap->cm[a].premultable);
}
return cumapn;
@@ -130,13 +130,13 @@ void curvemapping_set_black_white(CurveMapping *cumap, const float black[3], con
{
int a;
- if(white)
+ if (white)
copy_v3_v3(cumap->white, white);
- if(black)
+ if (black)
copy_v3_v3(cumap->black, black);
- for(a=0; a<3; a++) {
- if(cumap->white[a]==cumap->black[a])
+ for (a=0; a<3; a++) {
+ if (cumap->white[a]==cumap->black[a])
cumap->bwmul[a]= 0.0f;
else
cumap->bwmul[a]= 1.0f/(cumap->white[a] - cumap->black[a]);
@@ -154,8 +154,8 @@ void curvemap_remove(CurveMap *cuma, int flag)
/* well, lets keep the two outer points! */
cmp[0]= cuma->curve[0];
- for(a=1, b=1; a<cuma->totpoint-1; a++) {
- if(!(cuma->curve[a].flag & flag)) {
+ for (a=1, b=1; a<cuma->totpoint-1; a++) {
+ if (!(cuma->curve[a].flag & flag)) {
cmp[b]= cuma->curve[a];
b++;
}
@@ -175,8 +175,8 @@ void curvemap_insert(CurveMap *cuma, float x, float y)
/* insert fragments of the old one and the new point to the new curve */
cuma->totpoint++;
- for(a=0, b=0; a<cuma->totpoint; a++) {
- if((x < cuma->curve[a].x) && !foundloc) {
+ for (a=0, b=0; a<cuma->totpoint; a++) {
+ if ((x < cuma->curve[a].x) && !foundloc) {
cmp[a].x= x;
cmp[a].y= y;
cmp[a].flag= CUMA_SELECT;
@@ -199,7 +199,7 @@ void curvemap_insert(CurveMap *cuma, float x, float y)
void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope)
{
- if(cuma->curve)
+ if (cuma->curve)
MEM_freeN(cuma->curve);
switch(preset) {
@@ -295,7 +295,7 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope)
cuma->curve = newpoints;
}
- if(cuma->table) {
+ if (cuma->table) {
MEM_freeN(cuma->table);
cuma->table= NULL;
}
@@ -306,9 +306,9 @@ void curvemap_sethandle(CurveMap *cuma, int type)
{
int a;
- for(a=0; a<cuma->totpoint; a++) {
- if(cuma->curve[a].flag & CUMA_SELECT) {
- if(type) cuma->curve[a].flag |= CUMA_VECTOR;
+ for (a=0; a<cuma->totpoint; a++) {
+ if (cuma->curve[a].flag & CUMA_SELECT) {
+ if (type) cuma->curve[a].flag |= CUMA_VECTOR;
else cuma->curve[a].flag &= ~CUMA_VECTOR;
}
}
@@ -323,13 +323,13 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex
float len,len_a, len_b;
float dvec_a[2], dvec_b[2];
- if(bezt->h1==0 && bezt->h2==0) {
+ if (bezt->h1==0 && bezt->h2==0) {
return;
}
p2= bezt->vec[1];
- if(prev==NULL) {
+ if (prev==NULL) {
p3= next->vec[1];
pt[0]= 2.0f*p2[0] - p3[0];
pt[1]= 2.0f*p2[1] - p3[1];
@@ -339,7 +339,7 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex
p1= prev->vec[1];
}
- if(next==NULL) {
+ if (next==NULL) {
p1= prev->vec[1];
pt[0]= 2.0f*p2[0] - p1[0];
pt[1]= 2.0f*p2[1] - p1[1];
@@ -355,32 +355,32 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex
len_a= len_v2(dvec_a);
len_b= len_v2(dvec_b);
- if(len_a==0.0f) len_a=1.0f;
- if(len_b==0.0f) len_b=1.0f;
+ if (len_a==0.0f) len_a=1.0f;
+ if (len_b==0.0f) len_b=1.0f;
- if(bezt->h1==HD_AUTO || bezt->h2==HD_AUTO) { /* auto */
+ if (bezt->h1==HD_AUTO || bezt->h2==HD_AUTO) { /* auto */
float tvec[2];
tvec[0]= dvec_b[0]/len_b + dvec_a[0]/len_a;
tvec[1]= dvec_b[1]/len_b + dvec_a[1]/len_a;
len= len_v2(tvec) * 2.5614f;
- if(len!=0.0f) {
+ if (len!=0.0f) {
- if(bezt->h1==HD_AUTO) {
+ if (bezt->h1==HD_AUTO) {
len_a/=len;
madd_v2_v2v2fl(p2-3, p2, tvec, -len_a);
}
- if(bezt->h2==HD_AUTO) {
+ if (bezt->h2==HD_AUTO) {
len_b/=len;
madd_v2_v2v2fl(p2+3, p2, tvec, len_b);
}
}
}
- if(bezt->h1==HD_VECT) { /* vector */
+ if (bezt->h1==HD_VECT) { /* vector */
madd_v2_v2v2fl(p2-3, p2, dvec_a, -1.0f/3.0f);
}
- if(bezt->h2==HD_VECT) {
+ if (bezt->h2==HD_VECT) {
madd_v2_v2v2fl(p2+3, p2, dvec_b, 1.0f/3.0f);
}
}
@@ -389,25 +389,25 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex
* X is presumed to be outside first or last */
static float curvemap_calc_extend(CurveMap *cuma, float x, const float first[2], const float last[2])
{
- if(x <= first[0]) {
- if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) {
+ if (x <= first[0]) {
+ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) {
/* no extrapolate */
return first[1];
}
else {
- if(cuma->ext_in[0]==0.0f)
+ if (cuma->ext_in[0]==0.0f)
return first[1] + cuma->ext_in[1]*10000.0f;
else
return first[1] + cuma->ext_in[1]*(x - first[0])/cuma->ext_in[0];
}
}
- else if(x >= last[0]) {
- if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) {
+ else if (x >= last[0]) {
+ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) {
/* no extrapolate */
return last[1];
}
else {
- if(cuma->ext_out[0]==0.0f)
+ if (cuma->ext_out[0]==0.0f)
return last[1] - cuma->ext_out[1]*10000.0f;
else
return last[1] + cuma->ext_out[1]*(x - last[0])/cuma->ext_out[0];
@@ -424,7 +424,7 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
float *fp, *allpoints, *lastpoint, curf, range;
int a, totpoint;
- if(cuma->curve==NULL) return;
+ if (cuma->curve==NULL) return;
/* default rect also is table range */
cuma->mintable= clipr->xmin;
@@ -433,21 +433,21 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
/* hrmf... we now rely on blender ipo beziers, these are more advanced */
bezt= MEM_callocN(cuma->totpoint*sizeof(BezTriple), "beztarr");
- for(a=0; a<cuma->totpoint; a++) {
+ for (a=0; a<cuma->totpoint; a++) {
cuma->mintable= MIN2(cuma->mintable, cmp[a].x);
cuma->maxtable= MAX2(cuma->maxtable, cmp[a].x);
bezt[a].vec[1][0]= cmp[a].x;
bezt[a].vec[1][1]= cmp[a].y;
- if(cmp[a].flag & CUMA_VECTOR)
+ if (cmp[a].flag & CUMA_VECTOR)
bezt[a].h1= bezt[a].h2= HD_VECT;
else
bezt[a].h1= bezt[a].h2= HD_AUTO;
}
- for(a=0; a<cuma->totpoint; a++) {
- if(a==0)
+ for (a=0; a<cuma->totpoint; a++) {
+ if (a==0)
calchandle_curvemap(bezt, NULL, bezt+1, 0);
- else if(a==cuma->totpoint-1)
+ else if (a==cuma->totpoint-1)
calchandle_curvemap(bezt+a, bezt+a-1, NULL, 0);
else
calchandle_curvemap(bezt+a, bezt+a-1, bezt+a+1, 0);
@@ -455,37 +455,37 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
/* first and last handle need correction, instead of pointing to center of next/prev,
* we let it point to the closest handle */
- if(cuma->totpoint>2) {
+ if (cuma->totpoint>2) {
float hlen, nlen, vec[3];
- if(bezt[0].h2==HD_AUTO) {
+ if (bezt[0].h2==HD_AUTO) {
hlen= len_v3v3(bezt[0].vec[1], bezt[0].vec[2]); /* original handle length */
/* clip handle point */
copy_v3_v3(vec, bezt[1].vec[0]);
- if(vec[0] < bezt[0].vec[1][0])
+ if (vec[0] < bezt[0].vec[1][0])
vec[0]= bezt[0].vec[1][0];
sub_v3_v3(vec, bezt[0].vec[1]);
nlen= len_v3(vec);
- if(nlen>FLT_EPSILON) {
+ if (nlen>FLT_EPSILON) {
mul_v3_fl(vec, hlen/nlen);
add_v3_v3v3(bezt[0].vec[2], vec, bezt[0].vec[1]);
sub_v3_v3v3(bezt[0].vec[0], bezt[0].vec[1], vec);
}
}
a= cuma->totpoint-1;
- if(bezt[a].h2==HD_AUTO) {
+ if (bezt[a].h2==HD_AUTO) {
hlen= len_v3v3(bezt[a].vec[1], bezt[a].vec[0]); /* original handle length */
/* clip handle point */
copy_v3_v3(vec, bezt[a-1].vec[2]);
- if(vec[0] > bezt[a].vec[1][0])
+ if (vec[0] > bezt[a].vec[1][0])
vec[0]= bezt[a].vec[1][0];
sub_v3_v3(vec, bezt[a].vec[1]);
nlen= len_v3(vec);
- if(nlen>FLT_EPSILON) {
+ if (nlen>FLT_EPSILON) {
mul_v3_fl(vec, hlen/nlen);
add_v3_v3v3(bezt[a].vec[0], vec, bezt[a].vec[1]);
sub_v3_v3v3(bezt[a].vec[2], bezt[a].vec[1], vec);
@@ -493,12 +493,12 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
}
}
/* make the bezier curve */
- if(cuma->table)
+ if (cuma->table)
MEM_freeN(cuma->table);
totpoint= (cuma->totpoint-1)*CM_RESOL;
fp= allpoints= MEM_callocN(totpoint*2*sizeof(float), "table");
- for(a=0; a<cuma->totpoint-1; a++, fp += 2*CM_RESOL) {
+ for (a=0; a<cuma->totpoint-1; a++, fp += 2*CM_RESOL) {
correct_bezpart(bezt[a].vec[1], bezt[a].vec[2], bezt[a+1].vec[0], bezt[a+1].vec[1]);
forward_diff_bezier(bezt[a].vec[1][0], bezt[a].vec[2][0], bezt[a+1].vec[0][0], bezt[a+1].vec[1][0], fp, CM_RESOL-1, 2*sizeof(float));
forward_diff_bezier(bezt[a].vec[1][1], bezt[a].vec[2][1], bezt[a+1].vec[0][1], bezt[a+1].vec[1][1], fp+1, CM_RESOL-1, 2*sizeof(float));
@@ -529,20 +529,20 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
lastpoint= allpoints + 2*(totpoint-1);
cmp= MEM_callocN((CM_TABLE+1)*sizeof(CurveMapPoint), "dist table");
- for(a=0; a<=CM_TABLE; a++) {
+ for (a=0; a<=CM_TABLE; a++) {
curf= cuma->mintable + range*(float)a;
cmp[a].x= curf;
/* get the first x coordinate larger than curf */
- while(curf >= fp[0] && fp!=lastpoint) {
+ while (curf >= fp[0] && fp!=lastpoint) {
fp+=2;
}
- if(fp==allpoints || (curf >= fp[0] && fp==lastpoint))
+ if (fp==allpoints || (curf >= fp[0] && fp==lastpoint))
cmp[a].y= curvemap_calc_extend(cuma, curf, allpoints, lastpoint);
else {
float fac1= fp[0] - fp[-2];
float fac2= fp[0] - curf;
- if(fac1 > FLT_EPSILON)
+ if (fac1 > FLT_EPSILON)
fac1= fac2/fac1;
else
fac1= 0.0f;
@@ -560,9 +560,9 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore)
{
int a;
- if(restore) {
- if(cumap->flag & CUMA_PREMULLED) {
- for(a=0; a<3; a++) {
+ if (restore) {
+ if (cumap->flag & CUMA_PREMULLED) {
+ for (a=0; a<3; a++) {
MEM_freeN(cumap->cm[a].table);
cumap->cm[a].table= cumap->cm[a].premultable;
cumap->cm[a].premultable= NULL;
@@ -572,23 +572,23 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore)
}
}
else {
- if((cumap->flag & CUMA_PREMULLED)==0) {
+ if ((cumap->flag & CUMA_PREMULLED)==0) {
/* verify and copy */
- for(a=0; a<3; a++) {
- if(cumap->cm[a].table==NULL)
+ for (a=0; a<3; a++) {
+ if (cumap->cm[a].table==NULL)
curvemap_make_table(cumap->cm+a, &cumap->clipr);
cumap->cm[a].premultable= cumap->cm[a].table;
cumap->cm[a].table= MEM_mallocN((CM_TABLE+1)*sizeof(CurveMapPoint), "premul table");
memcpy(cumap->cm[a].table, cumap->cm[a].premultable, (CM_TABLE+1)*sizeof(CurveMapPoint));
}
- if(cumap->cm[3].table==NULL)
+ if (cumap->cm[3].table==NULL)
curvemap_make_table(cumap->cm+3, &cumap->clipr);
/* premul */
- for(a=0; a<3; a++) {
+ for (a=0; a<3; a++) {
int b;
- for(b=0; b<=CM_TABLE; b++) {
+ for (b=0; b<=CM_TABLE; b++) {
cumap->cm[a].table[b].y= curvemap_evaluateF(cumap->cm+3, cumap->cm[a].table[b].y);
}
}
@@ -602,8 +602,8 @@ static int sort_curvepoints(const void *a1, const void *a2)
{
const struct CurveMapPoint *x1=a1, *x2=a2;
- if( x1->x > x2->x ) return 1;
- else if( x1->x < x2->x) return -1;
+ if ( x1->x > x2->x ) return 1;
+ else if ( x1->x < x2->x) return -1;
return 0;
}
@@ -622,21 +622,21 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
cumap->changed_timestamp++;
/* clamp with clip */
- if(cumap->flag & CUMA_DO_CLIP) {
- for(a=0; a<cuma->totpoint; a++) {
- if(cmp[a].flag & CUMA_SELECT) {
- if(cmp[a].x < clipr->xmin)
+ if (cumap->flag & CUMA_DO_CLIP) {
+ for (a=0; a<cuma->totpoint; a++) {
+ if (cmp[a].flag & CUMA_SELECT) {
+ if (cmp[a].x < clipr->xmin)
dx= MIN2(dx, cmp[a].x - clipr->xmin);
- else if(cmp[a].x > clipr->xmax)
+ else if (cmp[a].x > clipr->xmax)
dx= MAX2(dx, cmp[a].x - clipr->xmax);
- if(cmp[a].y < clipr->ymin)
+ if (cmp[a].y < clipr->ymin)
dy= MIN2(dy, cmp[a].y - clipr->ymin);
- else if(cmp[a].y > clipr->ymax)
+ else if (cmp[a].y > clipr->ymax)
dy= MAX2(dy, cmp[a].y - clipr->ymax);
}
}
- for(a=0; a<cuma->totpoint; a++) {
- if(cmp[a].flag & CUMA_SELECT) {
+ for (a=0; a<cuma->totpoint; a++) {
+ if (cmp[a].flag & CUMA_SELECT) {
cmp[a].x -= dx;
cmp[a].y -= dy;
}
@@ -647,25 +647,25 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
qsort(cmp, cuma->totpoint, sizeof(CurveMapPoint), sort_curvepoints);
/* remove doubles, threshold set on 1% of default range */
- if(rem_doubles && cuma->totpoint>2) {
- for(a=0; a<cuma->totpoint-1; a++) {
+ if (rem_doubles && cuma->totpoint>2) {
+ for (a=0; a<cuma->totpoint-1; a++) {
dx= cmp[a].x - cmp[a+1].x;
dy= cmp[a].y - cmp[a+1].y;
- if( sqrtf(dx*dx + dy*dy) < thresh ) {
- if(a==0) {
+ if ( sqrtf(dx*dx + dy*dy) < thresh ) {
+ if (a==0) {
cmp[a+1].flag|= 2;
- if(cmp[a+1].flag & CUMA_SELECT)
+ if (cmp[a+1].flag & CUMA_SELECT)
cmp[a].flag |= CUMA_SELECT;
}
else {
cmp[a].flag|= 2;
- if(cmp[a].flag & CUMA_SELECT)
+ if (cmp[a].flag & CUMA_SELECT)
cmp[a+1].flag |= CUMA_SELECT;
}
break; /* we assume 1 deletion per edit is ok */
}
}
- if(a != cuma->totpoint-1)
+ if (a != cuma->totpoint-1)
curvemap_remove(cuma, 2);
}
curvemap_make_table(cuma, clipr);
@@ -682,11 +682,11 @@ float curvemap_evaluateF(CurveMap *cuma, float value)
i= (int)fi;
/* fi is table float index and should check against table range i.e. [0.0 CM_TABLE] */
- if(fi<0.0f || fi>CM_TABLE)
+ if (fi<0.0f || fi>CM_TABLE)
return curvemap_calc_extend(cuma, value, &cuma->table[0].x, &cuma->table[CM_TABLE].x);
else {
- if(i<0) return cuma->table[0].y;
- if(i>=CM_TABLE) return cuma->table[CM_TABLE].y;
+ if (i<0) return cuma->table[0].y;
+ if (i>=CM_TABLE) return cuma->table[CM_TABLE].y;
fi= fi-(float)i;
return (1.0f-fi)*cuma->table[i].y + (fi)*cuma->table[i+1].y;
@@ -699,9 +699,9 @@ float curvemapping_evaluateF(CurveMapping *cumap, int cur, float value)
CurveMap *cuma= cumap->cm+cur;
/* allocate or bail out */
- if(cuma->table==NULL) {
+ if (cuma->table==NULL) {
curvemap_make_table(cuma, &cumap->clipr);
- if(cuma->table==NULL)
+ if (cuma->table==NULL)
return 1.0f-value;
}
return curvemap_evaluateF(cuma, value);
@@ -750,11 +750,11 @@ void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
int stride= 4;
float *pix_out;
- if(ibuf==NULL)
+ if (ibuf==NULL)
return;
- if(ibuf->rect_float==NULL)
+ if (ibuf->rect_float==NULL)
IMB_float_from_rect(ibuf);
- else if(ibuf->rect==NULL)
+ else if (ibuf->rect==NULL)
imb_addrectImBuf(ibuf);
if (!ibuf->rect || !ibuf->rect_float)
@@ -769,11 +769,11 @@ void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
pix_in= ibuf->rect_float;
pix_out= tmpbuf->rect_float;
- if(ibuf->channels)
+ if (ibuf->channels)
stride= ibuf->channels;
- for(pixel= ibuf->x*ibuf->y; pixel>0; pixel--, pix_in+=stride, pix_out+=stride) {
- if(stride<3) {
+ for (pixel= ibuf->x*ibuf->y; pixel>0; pixel--, pix_in+=stride, pix_out+=stride) {
+ if (stride<3) {
col[0]= curvemap_evaluateF(cumap->cm, *pix_in);
pix_out[1]= pix_out[2]= pix_out[3]= pix_out[0]= col[0];
@@ -783,7 +783,7 @@ void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
pix_out[0]= col[0];
pix_out[1]= col[1];
pix_out[2]= col[2];
- if(stride>3)
+ if (stride>3)
pix_out[3]= pix_in[3];
else
pix_out[3]= 1.f;
@@ -801,21 +801,21 @@ int curvemapping_RGBA_does_something(CurveMapping *cumap)
{
int a;
- if(cumap->black[0]!=0.0f) return 1;
- if(cumap->black[1]!=0.0f) return 1;
- if(cumap->black[2]!=0.0f) return 1;
- if(cumap->white[0]!=1.0f) return 1;
- if(cumap->white[1]!=1.0f) return 1;
- if(cumap->white[2]!=1.0f) return 1;
+ if (cumap->black[0]!=0.0f) return 1;
+ if (cumap->black[1]!=0.0f) return 1;
+ if (cumap->black[2]!=0.0f) return 1;
+ if (cumap->white[0]!=1.0f) return 1;
+ if (cumap->white[1]!=1.0f) return 1;
+ if (cumap->white[2]!=1.0f) return 1;
- for(a=0; a<CM_TOT; a++) {
- if(cumap->cm[a].curve) {
- if(cumap->cm[a].totpoint!=2) return 1;
+ for (a=0; a<CM_TOT; a++) {
+ if (cumap->cm[a].curve) {
+ if (cumap->cm[a].totpoint!=2) return 1;
- if(cumap->cm[a].curve[0].x != 0.0f) return 1;
- if(cumap->cm[a].curve[0].y != 0.0f) return 1;
- if(cumap->cm[a].curve[1].x != 1.0f) return 1;
- if(cumap->cm[a].curve[1].y != 1.0f) return 1;
+ if (cumap->cm[a].curve[0].x != 0.0f) return 1;
+ if (cumap->cm[a].curve[0].y != 0.0f) return 1;
+ if (cumap->cm[a].curve[1].x != 1.0f) return 1;
+ if (cumap->cm[a].curve[1].y != 1.0f) return 1;
}
}
return 0;
@@ -825,10 +825,10 @@ void curvemapping_initialize(CurveMapping *cumap)
{
int a;
- if(cumap==NULL) return;
+ if (cumap==NULL) return;
- for(a=0; a<CM_TOT; a++) {
- if(cumap->cm[a].table==NULL)
+ for (a=0; a<CM_TOT; a++) {
+ if (cumap->cm[a].table==NULL)
curvemap_make_table(cumap->cm+a, &cumap->clipr);
}
}
@@ -841,14 +841,14 @@ void curvemapping_table_RGBA(CurveMapping *cumap, float **array, int *size)
*array = MEM_callocN(sizeof(float)*(*size)*4, "CurveMapping");
curvemapping_initialize(cumap);
- for(a=0; a<*size; a++) {
- if(cumap->cm[0].table)
+ for (a=0; a<*size; a++) {
+ if (cumap->cm[0].table)
(*array)[a*4+0]= cumap->cm[0].table[a].y;
- if(cumap->cm[1].table)
+ if (cumap->cm[1].table)
(*array)[a*4+1]= cumap->cm[1].table[a].y;
- if(cumap->cm[2].table)
+ if (cumap->cm[2].table)
(*array)[a*4+2]= cumap->cm[2].table[a].y;
- if(cumap->cm[3].table)
+ if (cumap->cm[3].table)
(*array)[a*4+3]= cumap->cm[3].table[a].y;
}
}
@@ -986,8 +986,11 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
for (y = 0; y < ibuf->y; y++) {
if (savedlines<scopes->sample_lines && y>=((savedlines)*ibuf->y)/(scopes->sample_lines+1)) {
- saveline=1;
- } else saveline=0;
+ saveline = 1;
+ }
+ else {
+ saveline = 0;
+ }
for (x = 0; x < ibuf->x; x++) {
if (is_float) {
@@ -1005,7 +1008,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
luma = rgb_to_luma(rgb);
/* check for min max */
- if(ycc_mode == -1 ) {
+ if (ycc_mode == -1 ) {
for (c=0; c<3; c++) {
if (rgb[c] < scopes->minmax[c][0]) scopes->minmax[c][0] = rgb[c];
if (rgb[c] > scopes->minmax[c][1]) scopes->minmax[c][1] = rgb[c];
@@ -1026,7 +1029,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
bin_lum[ get_bin_float(luma) ] += 1;
/* save sample if needed */
- if(saveline) {
+ if (saveline) {
const float fx = (float)x / (float)ibuf->x;
const int idx = 2*(ibuf->x*savedlines+x);
save_sample_line(scopes, idx, fx, rgb, ycc);
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index e0125891e86..449376a3960 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -490,7 +490,7 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat
copy_v3_v3(plane, tmat[1]);
cross_v3_v3v3(mat[0], normal, plane);
- if(len_v3(mat[0]) < 1e-3f) {
+ if (len_v3(mat[0]) < 1e-3f) {
copy_v3_v3(plane, tmat[0]);
cross_v3_v3v3(mat[0], normal, plane);
}
@@ -820,7 +820,7 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
float parmat[4][4];
/* simple matrix parenting */
- if(data->flag == CHILDOF_ALL) {
+ if (data->flag == CHILDOF_ALL) {
/* multiply target (parent matrix) by offset (parent inverse) to get
* the effect of the parent that will be exherted on the owner
@@ -2878,7 +2878,7 @@ static void minmax_new_data (void *cdata)
data->minmaxflag = TRACK_Z;
data->offset = 0.0f;
- data->cache[0] = data->cache[1] = data->cache[2] = 0.0f;
+ zero_v3(data->cache);
data->flag = 0;
}
@@ -3449,7 +3449,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
{
bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data;
- if( VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) )
+ if ( VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) )
{
int fail = FALSE;
float co[3] = {0.0f, 0.0f, 0.0f};
@@ -3471,7 +3471,7 @@ 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);
@@ -3480,12 +3480,12 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
case MOD_SHRINKWRAP_NEAREST_SURFACE:
case MOD_SHRINKWRAP_NEAREST_VERTEX:
- if(scon->shrinkType == MOD_SHRINKWRAP_NEAREST_VERTEX)
+ if (scon->shrinkType == MOD_SHRINKWRAP_NEAREST_VERTEX)
bvhtree_from_mesh_verts(&treeData, target, 0.0, 2, 6);
else
bvhtree_from_mesh_faces(&treeData, target, 0.0, 2, 6);
- if(treeData.tree == NULL)
+ if (treeData.tree == NULL)
{
fail = TRUE;
break;
@@ -3496,16 +3496,16 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
BLI_bvhtree_find_nearest(treeData.tree, co, &nearest, treeData.nearest_callback, &treeData);
dist = len_v3v3(co, nearest.co);
- if(dist != 0.0f) {
+ if (dist != 0.0f) {
interp_v3_v3v3(co, co, nearest.co, (dist - scon->dist)/dist); /* linear interpolation */
}
space_transform_invert(&transform, co);
break;
case MOD_SHRINKWRAP_PROJECT:
- if(scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) no[0] = 1.0f;
- if(scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) no[1] = 1.0f;
- if(scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS) no[2] = 1.0f;
+ if (scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) no[0] = 1.0f;
+ if (scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) no[1] = 1.0f;
+ if (scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS) no[2] = 1.0f;
if (dot_v3v3(no, no) < FLT_EPSILON) {
fail = TRUE;
@@ -3516,13 +3516,13 @@ 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;
@@ -3535,10 +3535,9 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
target->release(target);
- if(fail == TRUE)
- {
+ if (fail == TRUE) {
/* Don't move the point */
- co[0] = co[1] = co[2] = 0.0f;
+ zero_v3(co);
}
/* co is in local object coordinates, change it to global and update target position */
@@ -3893,7 +3892,7 @@ static void pivotcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t
/* correct the pivot by the rotation axis otherwise the pivot translates when it shouldnt */
mat3_to_axis_angle(axis, &angle, rotMat);
- if(angle) {
+ if (angle) {
float dvec[3];
sub_v3_v3v3(vec, pivot, cob->matrix[3]);
project_v3_v3v3(dvec, vec, axis);
@@ -3963,12 +3962,12 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
tracking= &clip->tracking;
- if(data->object[0])
+ if (data->object[0])
tracking_object= BKE_tracking_named_object(tracking, data->object);
else
tracking_object= BKE_tracking_get_camera_object(tracking);
- if(!tracking_object)
+ if (!tracking_object)
return;
track= BKE_tracking_named_track(tracking, tracking_object, data->track);
@@ -3982,7 +3981,7 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
copy_m4_m4(obmat, cob->matrix);
- if((tracking_object->flag&TRACKING_OBJECT_CAMERA)==0) {
+ if ((tracking_object->flag&TRACKING_OBJECT_CAMERA)==0) {
float imat[4][4];
copy_m4_m4(mat, camob->obmat);
@@ -4069,7 +4068,7 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
copy_v3_v3(cob->matrix[3], disp);
}
- if(data->depth_ob && data->depth_ob->derivedFinal) {
+ if (data->depth_ob && data->depth_ob->derivedFinal) {
Object *depth_ob= data->depth_ob;
BVHTreeFromMesh treeData= NULL_BVHTreeFromMesh;
BVHTreeRayHit hit;
@@ -4090,7 +4089,7 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
result= BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_nor, 0.0f, &hit, treeData.raycast_callback, &treeData);
- if(result != -1) {
+ if (result != -1) {
mul_v3_m4v3(cob->matrix[3], depth_ob->obmat, hit.co);
}
@@ -4200,7 +4199,7 @@ static void objectsolver_evaluate (bConstraint *con, bConstraintOb *cob, ListBas
if (data->flag & OBJECTSOLVER_ACTIVECLIP)
clip= scene->clip;
- if(!camob || !clip)
+ if (!camob || !clip)
return;
if (clip) {
@@ -4209,7 +4208,7 @@ static void objectsolver_evaluate (bConstraint *con, bConstraintOb *cob, ListBas
object= BKE_tracking_named_object(tracking, data->object);
- if(object) {
+ if (object) {
float mat[4][4], obmat[4][4], imat[4][4], cammat[4][4], camimat[4][4], parmat[4][4];
where_is_object_mat(scene, camob, cammat);
@@ -4575,7 +4574,7 @@ void copy_constraints (ListBase *dst, const ListBase *src, int do_extern)
if (cti->copy_data)
cti->copy_data(con, srccon);
- /* for proxies we dont want to make extern */
+ /* for proxies we don't want to make extern */
if (do_extern) {
/* go over used ID-links for this constraint to ensure that they are valid for proxies */
if (cti->id_looper)
@@ -4721,7 +4720,7 @@ void get_constraint_target_matrix (struct Scene *scene, bConstraint *con, int n,
/* only calculate the target matrix on the first target */
ct= (bConstraintTarget *)targets.first;
- while(ct && n-- > 0)
+ while (ct && n-- > 0)
ct= ct->next;
if (ct) {
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 05c56fa8101..a725b5f4c52 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -120,8 +120,8 @@ bContextStore *CTX_store_add(ListBase *contexts, const char *name, PointerRNA *p
* we have to copy the context to ensure */
ctx= contexts->last;
- if(!ctx || ctx->used) {
- if(ctx) {
+ if (!ctx || ctx->used) {
+ if (ctx) {
lastctx= ctx;
ctx= MEM_dupallocN(lastctx);
BLI_duplicatelist(&ctx->entries, &lastctx->entries);
@@ -166,7 +166,7 @@ void CTX_store_free_list(ListBase *contexts)
{
bContextStore *ctx;
- while((ctx= contexts->first)) {
+ while ((ctx= contexts->first)) {
BLI_remlink(contexts, ctx);
CTX_store_free(ctx);
}
@@ -243,127 +243,127 @@ struct ReportList *CTX_wm_reports(const bContext *C)
View3D *CTX_wm_view3d(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D)
return C->wm.area->spacedata.first;
return NULL;
}
RegionView3D *CTX_wm_region_view3d(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D)
- if(C->wm.region)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D)
+ if (C->wm.region)
return C->wm.region->regiondata;
return NULL;
}
struct SpaceText *CTX_wm_space_text(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_TEXT)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_TEXT)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceConsole *CTX_wm_space_console(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_CONSOLE)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_CONSOLE)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceImage *CTX_wm_space_image(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_IMAGE)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_IMAGE)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceButs *CTX_wm_space_buts(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_BUTS)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_BUTS)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceFile *CTX_wm_space_file(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_FILE)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_FILE)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceSeq *CTX_wm_space_seq(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_SEQ)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_SEQ)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceOops *CTX_wm_space_outliner(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_OUTLINER)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_OUTLINER)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceNla *CTX_wm_space_nla(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_NLA)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_NLA)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceTime *CTX_wm_space_time(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_TIME)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_TIME)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceNode *CTX_wm_space_node(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_NODE)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_NODE)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceLogic *CTX_wm_space_logic(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_LOGIC)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_LOGIC)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceIpo *CTX_wm_space_graph(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_IPO)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_IPO)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceAction *CTX_wm_space_action(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_ACTION)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_ACTION)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceInfo *CTX_wm_space_info(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_INFO)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_INFO)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceUserPref *CTX_wm_space_userpref(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_USERPREF)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_USERPREF)
return C->wm.area->spacedata.first;
return NULL;
}
struct SpaceClip *CTX_wm_space_clip(const bContext *C)
{
- if(C->wm.area && C->wm.area->spacetype==SPACE_CLIP)
+ if (C->wm.area && C->wm.area->spacetype==SPACE_CLIP)
return C->wm.area->spacedata.first;
return NULL;
}
@@ -381,7 +381,7 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
{
C->wm.window= win;
C->wm.screen= (win)? win->screen: NULL;
- if(C->wm.screen)
+ if (C->wm.screen)
C->data.scene= C->wm.screen->scene;
C->wm.area= NULL;
C->wm.region= NULL;
@@ -390,7 +390,7 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
void CTX_wm_screen_set(bContext *C, bScreen *screen)
{
C->wm.screen= screen;
- if(C->wm.screen)
+ if (C->wm.screen)
C->data.scene= C->wm.screen->scene;
C->wm.area= NULL;
C->wm.region= NULL;
@@ -438,7 +438,7 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
memset(result, 0, sizeof(bContextDataResult));
#ifdef WITH_PYTHON
- if(CTX_py_dict_get(C)) {
+ if (CTX_py_dict_get(C)) {
return BPY_context_member_get(C, member, result);
// if (BPY_context_member_get(C, member, result))
// return 1;
@@ -448,43 +448,43 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
* loops requesting data from ourselfs in a context callback */
/* Ok, this looks evil...
- * if(ret) done= -(-ret | -done);
+ * if (ret) done= -(-ret | -done);
*
* Values in order of importance
* (0, -1, 1) - Where 1 is highest priority
* */
- if(done!=1 && recursion < 1 && C->wm.store) {
+ if (done!=1 && recursion < 1 && C->wm.store) {
bContextStoreEntry *entry;
C->data.recursion= 1;
entry= BLI_rfindstring(&C->wm.store->entries, member, offsetof(bContextStoreEntry, name));
- if(entry) {
+ if (entry) {
result->ptr= entry->ptr;
done= 1;
}
}
- if(done!=1 && recursion < 2 && C->wm.region) {
+ if (done!=1 && recursion < 2 && C->wm.region) {
C->data.recursion= 2;
- if(C->wm.region->type && C->wm.region->type->context) {
+ if (C->wm.region->type && C->wm.region->type->context) {
ret = C->wm.region->type->context(C, member, result);
- if(ret) done= -(-ret | -done);
+ if (ret) done= -(-ret | -done);
}
}
- if(done!=1 && recursion < 3 && C->wm.area) {
+ if (done!=1 && recursion < 3 && C->wm.area) {
C->data.recursion= 3;
- if(C->wm.area->type && C->wm.area->type->context) {
+ if (C->wm.area->type && C->wm.area->type->context) {
ret = C->wm.area->type->context(C, member, result);
- if(ret) done= -(-ret | -done);
+ if (ret) done= -(-ret | -done);
}
}
- if(done!=1 && recursion < 4 && C->wm.screen) {
+ if (done!=1 && recursion < 4 && C->wm.screen) {
bContextDataCallback cb= C->wm.screen->context;
C->data.recursion= 4;
- if(cb) {
+ if (cb) {
ret = cb(C, member, result);
- if(ret) done= -(-ret | -done);
+ if (ret) done= -(-ret | -done);
}
}
@@ -497,7 +497,7 @@ static void *ctx_data_pointer_get(const bContext *C, const char *member)
{
bContextDataResult result;
- if(C && ctx_data_get((bContext*)C, member, &result)==1)
+ if (C && ctx_data_get((bContext*)C, member, &result)==1)
return result.ptr.data;
return NULL;
@@ -512,7 +512,7 @@ static int ctx_data_pointer_verify(const bContext *C, const char *member, void *
*pointer= NULL;
return 1;
}
- else if(ctx_data_get((bContext*)C, member, &result)==1) {
+ else if (ctx_data_get((bContext*)C, member, &result)==1) {
*pointer= result.ptr.data;
return 1;
}
@@ -526,7 +526,7 @@ static int ctx_data_collection_get(const bContext *C, const char *member, ListBa
{
bContextDataResult result;
- if(ctx_data_get((bContext*)C, member, &result)==1) {
+ if (ctx_data_get((bContext*)C, member, &result)==1) {
*list= result.list;
return 1;
}
@@ -541,7 +541,7 @@ PointerRNA CTX_data_pointer_get(const bContext *C, const char *member)
{
bContextDataResult result;
- if(ctx_data_get((bContext*)C, member, &result)==1)
+ if (ctx_data_get((bContext*)C, member, &result)==1)
return result.ptr;
else
return PointerRNA_NULL;
@@ -551,7 +551,7 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, Stru
{
PointerRNA ptr = CTX_data_pointer_get(C, member);
- if(ptr.data && RNA_struct_is_a(ptr.type, type))
+ if (ptr.data && RNA_struct_is_a(ptr.type, type))
return ptr;
return PointerRNA_NULL;
@@ -561,7 +561,7 @@ ListBase CTX_data_collection_get(const bContext *C, const char *member)
{
bContextDataResult result;
- if(ctx_data_get((bContext*)C, member, &result)==1) {
+ if (ctx_data_get((bContext*)C, member, &result)==1) {
return result.list;
}
else {
@@ -576,7 +576,7 @@ int CTX_data_get(const bContext *C, const char *member, PointerRNA *r_ptr, ListB
bContextDataResult result;
int ret= ctx_data_get((bContext*)C, member, &result);
- if(ret==1) {
+ if (ret==1) {
*r_ptr= result.ptr;
*r_lb= result.list;
*r_type= result.type;
@@ -594,10 +594,10 @@ static void data_dir_add(ListBase *lb, const char *member)
{
LinkData *link;
- if(strcmp(member, "scene") == 0) /* exception */
+ if (strcmp(member, "scene") == 0) /* exception */
return;
- if(BLI_findstring(lb, member, offsetof(LinkData, data)))
+ if (BLI_findstring(lb, member, offsetof(LinkData, data)))
return;
link= MEM_callocN(sizeof(LinkData), "LinkData");
@@ -613,35 +613,35 @@ ListBase CTX_data_dir_get(const bContext *C)
memset(&lb, 0, sizeof(lb));
- if(C->wm.store) {
+ if (C->wm.store) {
bContextStoreEntry *entry;
- for(entry=C->wm.store->entries.first; entry; entry=entry->next)
+ for (entry=C->wm.store->entries.first; entry; entry=entry->next)
data_dir_add(&lb, entry->name);
}
- if(C->wm.region && C->wm.region->type && C->wm.region->type->context) {
+ if (C->wm.region && C->wm.region->type && C->wm.region->type->context) {
memset(&result, 0, sizeof(result));
C->wm.region->type->context(C, "", &result);
- if(result.dir)
- for(a=0; result.dir[a]; a++)
+ if (result.dir)
+ for (a=0; result.dir[a]; a++)
data_dir_add(&lb, result.dir[a]);
}
- if(C->wm.area && C->wm.area->type && C->wm.area->type->context) {
+ if (C->wm.area && C->wm.area->type && C->wm.area->type->context) {
memset(&result, 0, sizeof(result));
C->wm.area->type->context(C, "", &result);
- if(result.dir)
- for(a=0; result.dir[a]; a++)
+ if (result.dir)
+ for (a=0; result.dir[a]; a++)
data_dir_add(&lb, result.dir[a]);
}
- if(C->wm.screen && C->wm.screen->context) {
+ if (C->wm.screen && C->wm.screen->context) {
bContextDataCallback cb= C->wm.screen->context;
memset(&result, 0, sizeof(result));
cb(C, "", &result);
- if(result.dir)
- for(a=0; result.dir[a]; a++)
+ if (result.dir)
+ for (a=0; result.dir[a]; a++)
data_dir_add(&lb, result.dir[a]);
}
@@ -692,7 +692,7 @@ int ctx_data_list_count(const bContext *C, int (*func)(const bContext*, ListBase
{
ListBase list;
- if(func(C, &list)) {
+ if (func(C, &list)) {
int tot= BLI_countlist(&list);
BLI_freelistN(&list);
return tot;
@@ -722,7 +722,7 @@ Main *CTX_data_main(const bContext *C)
{
Main *bmain;
- if(ctx_data_pointer_verify(C, "blend_data", (void*)&bmain))
+ if (ctx_data_pointer_verify(C, "blend_data", (void*)&bmain))
return bmain;
else
return C->data.main;
@@ -737,7 +737,7 @@ Scene *CTX_data_scene(const bContext *C)
{
Scene *scene;
- if(ctx_data_pointer_verify(C, "scene", (void*)&scene))
+ if (ctx_data_pointer_verify(C, "scene", (void*)&scene))
return scene;
else
return C->data.scene;
@@ -747,7 +747,7 @@ int CTX_data_mode_enum(const bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit) {
+ if (obedit) {
switch(obedit->type) {
case OB_MESH:
return CTX_MODE_EDIT_MESH;
@@ -768,13 +768,13 @@ int CTX_data_mode_enum(const bContext *C)
else {
Object *ob = CTX_data_active_object(C);
- if(ob) {
- if(ob->mode & OB_MODE_POSE) return CTX_MODE_POSE;
- else if(ob->mode & OB_MODE_SCULPT) return CTX_MODE_SCULPT;
- else if(ob->mode & OB_MODE_WEIGHT_PAINT) return CTX_MODE_PAINT_WEIGHT;
- else if(ob->mode & OB_MODE_VERTEX_PAINT) return CTX_MODE_PAINT_VERTEX;
- else if(ob->mode & OB_MODE_TEXTURE_PAINT) return CTX_MODE_PAINT_TEXTURE;
- else if(ob->mode & OB_MODE_PARTICLE_EDIT) return CTX_MODE_PARTICLE;
+ if (ob) {
+ if (ob->mode & OB_MODE_POSE) return CTX_MODE_POSE;
+ else if (ob->mode & OB_MODE_SCULPT) return CTX_MODE_SCULPT;
+ else if (ob->mode & OB_MODE_WEIGHT_PAINT) return CTX_MODE_PAINT_WEIGHT;
+ else if (ob->mode & OB_MODE_VERTEX_PAINT) return CTX_MODE_PAINT_VERTEX;
+ else if (ob->mode & OB_MODE_TEXTURE_PAINT) return CTX_MODE_PAINT_TEXTURE;
+ else if (ob->mode & OB_MODE_PARTICLE_EDIT) return CTX_MODE_PARTICLE;
}
}
@@ -815,7 +815,7 @@ ToolSettings *CTX_data_tool_settings(const bContext *C)
{
Scene *scene = CTX_data_scene(C);
- if(scene)
+ if (scene)
return scene->toolsettings;
else
return NULL;
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 5af72e6115c..7aae0d52fe7 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -74,38 +74,38 @@ void unlink_curve(Curve *cu)
{
int a;
- for(a=0; a<cu->totcol; a++) {
- if(cu->mat[a]) cu->mat[a]->id.us--;
+ for (a=0; a<cu->totcol; a++) {
+ if (cu->mat[a]) cu->mat[a]->id.us--;
cu->mat[a]= NULL;
}
- if(cu->vfont) cu->vfont->id.us--;
+ if (cu->vfont) cu->vfont->id.us--;
cu->vfont= NULL;
- if(cu->vfontb) cu->vfontb->id.us--;
+ if (cu->vfontb) cu->vfontb->id.us--;
cu->vfontb= NULL;
- if(cu->vfonti) cu->vfonti->id.us--;
+ if (cu->vfonti) cu->vfonti->id.us--;
cu->vfonti= NULL;
- if(cu->vfontbi) cu->vfontbi->id.us--;
+ if (cu->vfontbi) cu->vfontbi->id.us--;
cu->vfontbi= NULL;
- if(cu->key) cu->key->id.us--;
+ if (cu->key) cu->key->id.us--;
cu->key= NULL;
}
/* frees editcurve entirely */
void BKE_free_editfont(Curve *cu)
{
- if(cu->editfont) {
+ if (cu->editfont) {
EditFont *ef= cu->editfont;
- if(ef->oldstr) MEM_freeN(ef->oldstr);
- if(ef->oldstrinfo) MEM_freeN(ef->oldstrinfo);
- if(ef->textbuf) MEM_freeN(ef->textbuf);
- if(ef->textbufinfo) MEM_freeN(ef->textbufinfo);
- if(ef->copybuf) MEM_freeN(ef->copybuf);
- if(ef->copybufinfo) MEM_freeN(ef->copybufinfo);
+ if (ef->oldstr) MEM_freeN(ef->oldstr);
+ if (ef->oldstrinfo) MEM_freeN(ef->oldstrinfo);
+ if (ef->textbuf) MEM_freeN(ef->textbuf);
+ if (ef->textbufinfo) MEM_freeN(ef->textbufinfo);
+ if (ef->copybuf) MEM_freeN(ef->copybuf);
+ if (ef->copybufinfo) MEM_freeN(ef->copybufinfo);
MEM_freeN(ef);
cu->editfont= NULL;
@@ -123,7 +123,7 @@ void free_curve_editNurb_keyIndex(EditNurb *editnurb)
void free_curve_editNurb (Curve *cu)
{
- if(cu->editnurb) {
+ if (cu->editnurb) {
freeNurblist(&cu->editnurb->nurbs);
free_curve_editNurb_keyIndex(cu->editnurb);
MEM_freeN(cu->editnurb);
@@ -143,21 +143,20 @@ void free_curve(Curve *cu)
unlink_curve(cu);
BKE_free_animdata((ID *)cu);
- if(cu->mat) MEM_freeN(cu->mat);
- if(cu->str) MEM_freeN(cu->str);
- if(cu->strinfo) MEM_freeN(cu->strinfo);
- if(cu->bb) MEM_freeN(cu->bb);
- if(cu->path) free_path(cu->path);
- if(cu->tb) MEM_freeN(cu->tb);
+ if (cu->mat) MEM_freeN(cu->mat);
+ if (cu->str) MEM_freeN(cu->str);
+ if (cu->strinfo) MEM_freeN(cu->strinfo);
+ if (cu->bb) MEM_freeN(cu->bb);
+ if (cu->path) free_path(cu->path);
+ if (cu->tb) MEM_freeN(cu->tb);
}
Curve *add_curve(const char *name, int type)
{
Curve *cu;
- cu= alloc_libblock(&G.main->curve, ID_CU, name);
-
- cu->size[0]= cu->size[1]= cu->size[2]= 1.0;
+ cu = alloc_libblock(&G.main->curve, ID_CU, name);
+ copy_v3_fl(cu->size, 1.0f);
cu->flag= CU_FRONT|CU_BACK|CU_DEFORM_BOUNDS_OFF|CU_PATH_RADIUS;
cu->pathlen= 100;
cu->resolu= cu->resolv= (type == OB_SURF) ? 4 : 12;
@@ -173,7 +172,7 @@ Curve *add_curve(const char *name, int type)
cu->bb= unit_boundbox();
- if(type==OB_FONT) {
+ if (type==OB_FONT) {
cu->vfont= cu->vfontb= cu->vfonti= cu->vfontbi= get_builtin_font();
cu->vfont->id.us+=4;
cu->str= MEM_mallocN(12, "str");
@@ -198,7 +197,7 @@ Curve *copy_curve(Curve *cu)
duplicateNurblist( &(cun->nurb), &(cu->nurb));
cun->mat= MEM_dupallocN(cu->mat);
- for(a=0; a<cun->totcol; a++) {
+ for (a=0; a<cun->totcol; a++) {
id_us_plus((ID *)cun->mat[a]);
}
@@ -208,7 +207,7 @@ Curve *copy_curve(Curve *cu)
cun->bb= MEM_dupallocN(cu->bb);
cun->key= copy_key(cu->key);
- if(cun->key) cun->key->from= (ID *)cun;
+ if (cun->key) cun->key->from= (ID *)cun;
cun->disp.first= cun->disp.last= NULL;
cun->bev.first= cun->bev.last= NULL;
@@ -220,7 +219,7 @@ Curve *copy_curve(Curve *cu)
#if 0 // XXX old animation system
/* single user ipo too */
- if(cun->ipo) cun->ipo= copy_ipo(cun->ipo);
+ if (cun->ipo) cun->ipo= copy_ipo(cun->ipo);
#endif // XXX old animation system
id_us_plus((ID *)cun->vfont);
@@ -238,7 +237,7 @@ static void extern_local_curve(Curve *cu)
id_lib_extern((ID *)cu->vfonti);
id_lib_extern((ID *)cu->vfontbi);
- if(cu->mat) {
+ if (cu->mat) {
extern_local_matarar(cu->mat, cu->totcol);
}
}
@@ -254,34 +253,34 @@ void make_local_curve(Curve *cu)
* - mixed: do a copy
*/
- if(cu->id.lib==NULL) return;
+ if (cu->id.lib==NULL) return;
- if(cu->id.us==1) {
+ if (cu->id.us==1) {
id_clear_lib_data(bmain, &cu->id);
extern_local_curve(cu);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
- if(ob->data == cu) {
- if(ob->id.lib) is_lib= TRUE;
+ for (ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
+ if (ob->data == cu) {
+ if (ob->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
- if(is_local && is_lib == FALSE) {
+ if (is_local && is_lib == FALSE) {
id_clear_lib_data(bmain, &cu->id);
extern_local_curve(cu);
}
- else if(is_local && is_lib) {
+ else if (is_local && is_lib) {
Curve *cu_new= copy_curve(cu);
cu_new->id.us= 0;
BKE_id_lib_local_paths(bmain, cu->id.lib, &cu_new->id);
- for(ob= bmain->object.first; ob; ob= ob->id.next) {
- if(ob->data==cu) {
- if(ob->id.lib==NULL) {
+ for (ob= bmain->object.first; ob; ob= ob->id.next) {
+ if (ob->data==cu) {
+ if (ob->id.lib==NULL) {
ob->data= cu_new;
cu_new->id.us++;
cu->id.us--;
@@ -306,15 +305,15 @@ short curve_type(Curve *cu)
Nurb *nu;
int type= cu->type;
- if(cu->vfont) {
+ if (cu->vfont) {
return OB_FONT;
}
- if(!cu->type) {
+ if (!cu->type) {
type= OB_CURVE;
for (nu= cu->nurb.first; nu; nu= nu->next) {
- if(nu->pntsv>1) {
+ if (nu->pntsv>1) {
type= OB_SURF;
}
}
@@ -328,18 +327,18 @@ void update_curve_dimension(Curve *cu)
ListBase *nurbs= BKE_curve_nurbs(cu);
Nurb *nu= nurbs->first;
- if(cu->flag&CU_3D) {
- for( ; nu; nu= nu->next) {
+ if (cu->flag&CU_3D) {
+ for ( ; nu; nu= nu->next) {
nu->flag &= ~CU_2D;
}
}
else {
- for( ; nu; nu= nu->next) {
+ for ( ; nu; nu= nu->next) {
nu->flag |= CU_2D;
test2DNurb(nu);
/* since the handles are moved they need to be auto-located again */
- if(nu->type == CU_BEZIER)
+ if (nu->type == CU_BEZIER)
calchandlesNurb(nu);
}
}
@@ -349,7 +348,7 @@ void test_curve_type(Object *ob)
{
ob->type= curve_type(ob->data);
- if(ob->type==OB_CURVE)
+ if (ob->type==OB_CURVE)
update_curve_dimension((Curve *)ob->data);
}
@@ -360,51 +359,51 @@ void tex_space_curve(Curve *cu)
float *fp, min[3], max[3];
int tot, doit= 0;
- if(cu->bb==NULL) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
+ if (cu->bb==NULL) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
bb= cu->bb;
INIT_MINMAX(min, max);
dl= cu->disp.first;
- while(dl) {
+ while (dl) {
tot = ELEM(dl->type, DL_INDEX3, DL_INDEX4) ? dl->nr : dl->nr * dl->parts;
- if(tot) doit= 1;
+ if (tot) doit= 1;
fp= dl->verts;
- while(tot--) {
+ while (tot--) {
DO_MINMAX(fp, min, max);
fp += 3;
}
dl= dl->next;
}
- if(!doit) {
+ if (!doit) {
min[0] = min[1] = min[2] = -1.0f;
max[0] = max[1] = max[2] = 1.0f;
}
boundbox_set_from_min_max(bb, min, max);
- if(cu->texflag & CU_AUTOSPACE) {
+ if (cu->texflag & CU_AUTOSPACE) {
mid_v3_v3v3(cu->loc, min, max);
cu->size[0]= (max[0]-min[0])/2.0f;
cu->size[1]= (max[1]-min[1])/2.0f;
cu->size[2]= (max[2]-min[2])/2.0f;
- cu->rot[0]= cu->rot[1]= cu->rot[2]= 0.0f;
+ zero_v3(cu->rot);
- if(cu->size[0]==0.0f) cu->size[0]= 1.0f;
- else if(cu->size[0]>0.0f && cu->size[0]<0.00001f) cu->size[0]= 0.00001f;
- else if(cu->size[0]<0.0f && cu->size[0]> -0.00001f) cu->size[0]= -0.00001f;
+ if (cu->size[0]==0.0f) cu->size[0]= 1.0f;
+ else if (cu->size[0]>0.0f && cu->size[0]<0.00001f) cu->size[0]= 0.00001f;
+ else if (cu->size[0]<0.0f && cu->size[0]> -0.00001f) cu->size[0]= -0.00001f;
- if(cu->size[1]==0.0f) cu->size[1]= 1.0f;
- else if(cu->size[1]>0.0f && cu->size[1]<0.00001f) cu->size[1]= 0.00001f;
- else if(cu->size[1]<0.0f && cu->size[1]> -0.00001f) cu->size[1]= -0.00001f;
+ if (cu->size[1]==0.0f) cu->size[1]= 1.0f;
+ else if (cu->size[1]>0.0f && cu->size[1]<0.00001f) cu->size[1]= 0.00001f;
+ else if (cu->size[1]<0.0f && cu->size[1]> -0.00001f) cu->size[1]= -0.00001f;
- if(cu->size[2]==0.0f) cu->size[2]= 1.0f;
- else if(cu->size[2]>0.0f && cu->size[2]<0.00001f) cu->size[2]= 0.00001f;
- else if(cu->size[2]<0.0f && cu->size[2]> -0.00001f) cu->size[2]= -0.00001f;
+ if (cu->size[2]==0.0f) cu->size[2]= 1.0f;
+ else if (cu->size[2]>0.0f && cu->size[2]<0.00001f) cu->size[2]= 0.00001f;
+ else if (cu->size[2]<0.0f && cu->size[2]> -0.00001f) cu->size[2]= -0.00001f;
}
}
@@ -415,9 +414,9 @@ int count_curveverts(ListBase *nurb)
int tot=0;
nu= nurb->first;
- while(nu) {
- if(nu->bezt) tot+= 3*nu->pntsu;
- else if(nu->bp) tot+= nu->pntsu*nu->pntsv;
+ while (nu) {
+ if (nu->bezt) tot+= 3*nu->pntsu;
+ else if (nu->bp) tot+= nu->pntsu*nu->pntsv;
nu= nu->next;
}
@@ -430,9 +429,9 @@ int count_curveverts_without_handles(ListBase *nurb)
int tot=0;
nu= nurb->first;
- while(nu) {
- if(nu->bezt) tot+= nu->pntsu;
- else if(nu->bp) tot+= nu->pntsu*nu->pntsv;
+ while (nu) {
+ if (nu->bezt) tot+= nu->pntsu;
+ else if (nu->bp) tot+= nu->pntsu*nu->pntsv;
nu= nu->next;
}
@@ -444,17 +443,17 @@ int count_curveverts_without_handles(ListBase *nurb)
void freeNurb(Nurb *nu)
{
- if(nu==NULL) return;
+ if (nu==NULL) return;
- if(nu->bezt) MEM_freeN(nu->bezt);
+ if (nu->bezt) MEM_freeN(nu->bezt);
nu->bezt= NULL;
- if(nu->bp) MEM_freeN(nu->bp);
+ if (nu->bp) MEM_freeN(nu->bp);
nu->bp= NULL;
- if(nu->knotsu) MEM_freeN(nu->knotsu);
+ if (nu->knotsu) MEM_freeN(nu->knotsu);
nu->knotsu= NULL;
- if(nu->knotsv) MEM_freeN(nu->knotsv);
+ if (nu->knotsv) MEM_freeN(nu->knotsv);
nu->knotsv= NULL;
- /* if(nu->trim.first) freeNurblist(&(nu->trim)); */
+ /* if (nu->trim.first) freeNurblist(&(nu->trim)); */
MEM_freeN(nu);
@@ -465,10 +464,10 @@ void freeNurblist(ListBase *lb)
{
Nurb *nu, *next;
- if(lb==NULL) return;
+ if (lb==NULL) return;
nu= lb->first;
- while(nu) {
+ while (nu) {
next= nu->next;
freeNurb(nu);
nu= next;
@@ -482,10 +481,10 @@ Nurb *duplicateNurb(Nurb *nu)
int len;
newnu= (Nurb*)MEM_mallocN(sizeof(Nurb),"duplicateNurb");
- if(newnu==NULL) return NULL;
+ if (newnu==NULL) return NULL;
memcpy(newnu, nu, sizeof(Nurb));
- if(nu->bezt) {
+ if (nu->bezt) {
newnu->bezt=
(BezTriple*)MEM_mallocN((nu->pntsu)* sizeof(BezTriple),"duplicateNurb2");
memcpy(newnu->bezt, nu->bezt, nu->pntsu*sizeof(BezTriple));
@@ -498,16 +497,16 @@ Nurb *duplicateNurb(Nurb *nu)
newnu->knotsu= newnu->knotsv= NULL;
- if(nu->knotsu) {
+ if (nu->knotsu) {
len= KNOTSU(nu);
- if(len) {
+ if (len) {
newnu->knotsu= MEM_mallocN(len*sizeof(float), "duplicateNurb4");
memcpy(newnu->knotsu, nu->knotsu, sizeof(float)*len);
}
}
- if(nu->pntsv>1 && nu->knotsv) {
+ if (nu->pntsv>1 && nu->knotsv) {
len= KNOTSV(nu);
- if(len) {
+ if (len) {
newnu->knotsv= MEM_mallocN(len*sizeof(float), "duplicateNurb5");
memcpy(newnu->knotsv, nu->knotsv, sizeof(float)*len);
}
@@ -523,7 +522,7 @@ void duplicateNurblist(ListBase *lb1, ListBase *lb2)
freeNurblist(lb1);
nu= lb2->first;
- while(nu) {
+ while (nu) {
nun= duplicateNurb(nu);
BLI_addtail(lb1, nun);
@@ -537,13 +536,13 @@ void test2DNurb(Nurb *nu)
BPoint *bp;
int a;
- if((nu->flag & CU_2D)==0)
+ if ((nu->flag & CU_2D)==0)
return;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
+ while (a--) {
bezt->vec[0][2]= 0.0;
bezt->vec[1][2]= 0.0;
bezt->vec[2][2]= 0.0;
@@ -553,7 +552,7 @@ void test2DNurb(Nurb *nu)
else {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
+ while (a--) {
bp->vec[2]= 0.0;
bp++;
}
@@ -566,10 +565,10 @@ void minmaxNurb(Nurb *nu, float *min, float *max)
BPoint *bp;
int a;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
+ while (a--) {
DO_MINMAX(bezt->vec[0], min, max);
DO_MINMAX(bezt->vec[1], min, max);
DO_MINMAX(bezt->vec[2], min, max);
@@ -579,7 +578,7 @@ void minmaxNurb(Nurb *nu, float *min, float *max)
else {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
+ while (a--) {
DO_MINMAX(bp->vec, min, max);
bp++;
}
@@ -593,14 +592,14 @@ void addNurbPoints(Nurb *nu, int number)
int i;
nu->bp= (BPoint *)MEM_mallocN((nu->pntsu + number) * sizeof(BPoint), "rna_Curve_spline_points_add");
- if(tmp) {
+ if (tmp) {
memmove(nu->bp, tmp, nu->pntsu * sizeof(BPoint));
MEM_freeN(tmp);
}
memset(nu->bp + nu->pntsu, 0, number * sizeof(BPoint));
- for(i=0, tmp= nu->bp + nu->pntsu; i < number; i++, tmp++) {
+ for (i=0, tmp= nu->bp + nu->pntsu; i < number; i++, tmp++) {
tmp->radius= 1.0f;
}
@@ -613,14 +612,14 @@ void addNurbPointsBezier(Nurb *nu, int number)
int i;
nu->bezt= (BezTriple *)MEM_mallocN((nu->pntsu + number) * sizeof(BezTriple), "rna_Curve_spline_points_add");
- if(tmp) {
+ if (tmp) {
memmove(nu->bezt, tmp, nu->pntsu * sizeof(BezTriple));
MEM_freeN(tmp);
}
memset(nu->bezt + nu->pntsu, 0, number * sizeof(BezTriple));
- for(i=0, tmp= nu->bezt + nu->pntsu; i < number; i++, tmp++) {
+ for (i=0, tmp= nu->bezt + nu->pntsu; i < number; i++, tmp++) {
tmp->radius= 1.0f;
}
@@ -640,25 +639,25 @@ static void calcknots(float *knots, const short pnts, const short order, const s
switch(flag & (CU_NURB_ENDPOINT|CU_NURB_BEZIER)) {
case CU_NURB_ENDPOINT:
k= 0.0;
- for(a=1; a <= pnts_order; a++) {
+ for (a=1; a <= pnts_order; a++) {
knots[a-1]= k;
- if(a >= order && a <= pnts) k+= 1.0f;
+ if (a >= order && a <= pnts) k+= 1.0f;
}
break;
case CU_NURB_BEZIER:
/* Warning, the order MUST be 2 or 4,
* if this is not enforced, the displist will be corrupt */
- if(order==4) {
+ if (order==4) {
k= 0.34;
- for(a=0; a < pnts_order; a++) {
+ for (a=0; a < pnts_order; a++) {
knots[a]= floorf(k);
k+= (1.0f/3.0f);
}
}
- else if(order==3) {
+ else if (order==3) {
k= 0.6f;
- for(a=0; a < pnts_order; a++) {
- if(a >= order && a <= pnts) k+= 0.5f;
+ for (a=0; a < pnts_order; a++) {
+ if (a >= order && a <= pnts) k+= 0.5f;
knots[a]= floorf(k);
}
}
@@ -667,7 +666,7 @@ static void calcknots(float *knots, const short pnts, const short order, const s
}
break;
default:
- for(a=0; a < pnts_order; a++) {
+ for (a=0; a < pnts_order; a++) {
knots[a]= (float)a;
}
break;
@@ -679,22 +678,22 @@ static void makecyclicknots(float *knots, short pnts, short order)
{
int a, b, order2, c;
- if(knots==NULL) return;
+ if (knots==NULL) return;
order2=order-1;
/* do first long rows (order -1), remove identical knots at endpoints */
- if(order>2) {
+ if (order>2) {
b= pnts+order2;
- for(a=1; a<order2; a++) {
- if(knots[b]!= knots[b-a]) break;
+ for (a=1; a<order2; a++) {
+ if (knots[b]!= knots[b-a]) break;
}
- if(a==order2) knots[pnts+order-2]+= 1.0f;
+ if (a==order2) knots[pnts+order-2]+= 1.0f;
}
b= order;
c=pnts + order + order2;
- for(a=pnts+order2; a<c; a++) {
+ for (a=pnts+order2; a<c; a++) {
knots[a]= knots[a-1]+ (knots[b]-knots[b-1]);
b--;
}
@@ -704,28 +703,31 @@ static void makecyclicknots(float *knots, short pnts, short order)
static void makeknots(Nurb *nu, short uv)
{
- if(nu->type == CU_NURBS) {
- if(uv == 1) {
- if(nu->knotsu) MEM_freeN(nu->knotsu);
- if(check_valid_nurb_u(nu)) {
+ if (nu->type == CU_NURBS) {
+ if (uv == 1) {
+ if (nu->knotsu) MEM_freeN(nu->knotsu);
+ if (check_valid_nurb_u(nu)) {
nu->knotsu= MEM_callocN(4+sizeof(float)*KNOTSU(nu), "makeknots");
- if(nu->flagu & CU_NURB_CYCLIC) {
+ if (nu->flagu & CU_NURB_CYCLIC) {
calcknots(nu->knotsu, nu->pntsu, nu->orderu, 0); /* cyclic should be uniform */
makecyclicknots(nu->knotsu, nu->pntsu, nu->orderu);
- } else {
+ }
+ else {
calcknots(nu->knotsu, nu->pntsu, nu->orderu, nu->flagu);
}
}
else nu->knotsu= NULL;
- } else if(uv == 2) {
- if(nu->knotsv) MEM_freeN(nu->knotsv);
- if(check_valid_nurb_v(nu)) {
+ }
+ else if (uv == 2) {
+ if (nu->knotsv) MEM_freeN(nu->knotsv);
+ if (check_valid_nurb_v(nu)) {
nu->knotsv= MEM_callocN(4+sizeof(float)*KNOTSV(nu), "makeknots");
- if(nu->flagv & CU_NURB_CYCLIC) {
+ if (nu->flagv & CU_NURB_CYCLIC) {
calcknots(nu->knotsv, nu->pntsv, nu->orderv, 0); /* cyclic should be uniform */
makecyclicknots(nu->knotsv, nu->pntsv, nu->orderv);
- } else {
+ }
+ else {
calcknots(nu->knotsv, nu->pntsv, nu->orderv, nu->flagv);
}
}
@@ -753,19 +755,19 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
opp2 = orderpluspnts-1;
/* this is for float inaccuracy */
- if(t < knots[0]) t= knots[0];
- else if(t > knots[opp2]) t= knots[opp2];
+ if (t < knots[0]) t= knots[0];
+ else if (t > knots[opp2]) t= knots[opp2];
/* this part is order '1' */
o2 = order + 1;
- for(i=0;i<opp2;i++) {
- if(knots[i]!=knots[i+1] && t>= knots[i] && t<=knots[i+1]) {
+ for (i=0;i<opp2;i++) {
+ if (knots[i]!=knots[i+1] && t>= knots[i] && t<=knots[i+1]) {
basis[i]= 1.0;
i1= i-o2;
- if(i1<0) i1= 0;
+ if (i1<0) i1= 0;
i2= i;
i++;
- while(i<opp2) {
+ while (i<opp2) {
basis[i]= 0.0;
i++;
}
@@ -776,17 +778,17 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
basis[i]= 0.0;
/* this is order 2,3,... */
- for(j=2; j<=order; j++) {
+ for (j=2; j<=order; j++) {
- if(i2+j>= orderpluspnts) i2= opp2-j;
+ if (i2+j>= orderpluspnts) i2= opp2-j;
- for(i= i1; i<=i2; i++) {
- if(basis[i]!=0.0f)
+ for (i= i1; i<=i2; i++) {
+ if (basis[i]!=0.0f)
d= ((t-knots[i])*basis[i]) / (knots[i+j-1]-knots[i]);
else
d= 0.0f;
- if(basis[i+1] != 0.0f)
+ if (basis[i+1] != 0.0f)
e= ((knots[i+j]-t)*basis[i+1]) / (knots[i+j]-knots[i+1]);
else
e= 0.0;
@@ -798,10 +800,10 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
*start= 1000;
*end= 0;
- for(i=i1; i<=i2; i++) {
- if(basis[i] > 0.0f) {
+ for (i=i1; i<=i2; i++) {
+ if (basis[i] > 0.0f) {
*end= i;
- if(*start==1000) *start= i;
+ if (*start==1000) *start= i;
}
}
}
@@ -818,21 +820,21 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
int totu = nu->pntsu*resolu, totv = nu->pntsv*resolv;
- if(nu->knotsu==NULL || nu->knotsv==NULL) return;
- if(nu->orderu>nu->pntsu) return;
- if(nu->orderv>nu->pntsv) return;
- if(coord_array==NULL) return;
+ if (nu->knotsu==NULL || nu->knotsv==NULL) return;
+ if (nu->orderu>nu->pntsu) return;
+ if (nu->orderv>nu->pntsv) return;
+ if (coord_array==NULL) return;
/* allocate and initialize */
len = totu * totv;
- if(len==0) return;
+ if (len==0) return;
sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbfaces1");
len= totu*totv;
- if(len==0) {
+ if (len==0) {
MEM_freeN(sum);
return;
}
@@ -840,8 +842,8 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
bp= nu->bp;
i= nu->pntsu*nu->pntsv;
ratcomp=0;
- while(i--) {
- if(bp->vec[3] != 1.0f) {
+ while (i--) {
+ if (bp->vec[3] != 1.0f) {
ratcomp= 1;
break;
}
@@ -850,7 +852,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
fp= nu->knotsu;
ustart= fp[nu->orderu-1];
- if(nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
+ if (nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
else uend= fp[nu->pntsu];
ustep= (uend-ustart)/((nu->flagu & CU_NURB_CYCLIC) ? totu : totu - 1);
@@ -859,7 +861,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
fp= nu->knotsv;
vstart= fp[nu->orderv-1];
- if(nu->flagv & CU_NURB_CYCLIC) vend= fp[nu->pntsv+nu->orderv-1];
+ if (nu->flagv & CU_NURB_CYCLIC) vend= fp[nu->pntsv+nu->orderv-1];
else vend= fp[nu->pntsv];
vstep= (vend-vstart)/((nu->flagv & CU_NURB_CYCLIC) ? totv : totv - 1);
@@ -869,29 +871,29 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
jend= (int *)MEM_mallocN(sizeof(float)*totv, "makeNurbfaces5");
/* precalculation of basisv and jstart,jend */
- if(nu->flagv & CU_NURB_CYCLIC) cycl= nu->orderv-1;
+ if (nu->flagv & CU_NURB_CYCLIC) cycl= nu->orderv-1;
else cycl= 0;
v= vstart;
basis= basisv;
curv= totv;
- while(curv--) {
+ while (curv--) {
basisNurb(v, nu->orderv, (short)(nu->pntsv+cycl), nu->knotsv, basis, jstart+curv, jend+curv);
basis+= KNOTSV(nu);
v+= vstep;
}
- if(nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1;
+ if (nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1;
else cycl= 0;
in= coord_array;
u= ustart;
curu= totu;
- while(curu--) {
+ while (curu--) {
basisNurb(u, nu->orderu, (short)(nu->pntsu+cycl), nu->knotsu, basisu, &istart, &iend);
basis= basisv;
curv= totv;
- while(curv--) {
+ while (curv--) {
jsta= jstart[curv];
jen= jend[curv];
@@ -900,21 +902,21 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
sumdiv= 0.0;
fp= sum;
- for(j= jsta; j<=jen; j++) {
+ for (j= jsta; j<=jen; j++) {
- if(j>=nu->pntsv) jofs= (j - nu->pntsv);
+ if (j>=nu->pntsv) jofs= (j - nu->pntsv);
else jofs= j;
bp= nu->bp+ nu->pntsu*jofs+istart-1;
- for(i= istart; i<=iend; i++, fp++) {
+ for (i= istart; i<=iend; i++, fp++) {
- if(i>= nu->pntsu) {
+ if (i>= nu->pntsu) {
iofs= i- nu->pntsu;
bp= nu->bp+ nu->pntsu*jofs+iofs;
}
else bp++;
- if(ratcomp) {
+ if (ratcomp) {
*fp= basisu[i]*basis[j]*bp->vec[3];
sumdiv+= *fp;
}
@@ -922,10 +924,10 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
}
}
- if(ratcomp) {
+ if (ratcomp) {
fp= sum;
- for(j= jsta; j<=jen; j++) {
- for(i= istart; i<=iend; i++, fp++) {
+ for (j= jsta; j<=jen; j++) {
+ for (i= istart; i<=iend; i++, fp++) {
*fp/= sumdiv;
}
}
@@ -933,21 +935,21 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
/* one! (1.0) real point now */
fp= sum;
- for(j= jsta; j<=jen; j++) {
+ for (j= jsta; j<=jen; j++) {
- if(j>=nu->pntsv) jofs= (j - nu->pntsv);
+ if (j>=nu->pntsv) jofs= (j - nu->pntsv);
else jofs= j;
bp= nu->bp+ nu->pntsu*jofs+istart-1;
- for(i= istart; i<=iend; i++, fp++) {
+ for (i= istart; i<=iend; i++, fp++) {
- if(i>= nu->pntsu) {
+ if (i>= nu->pntsu) {
iofs= i- nu->pntsu;
bp= nu->bp+ nu->pntsu*jofs+iofs;
}
else bp++;
- if(*fp != 0.0f) {
+ if (*fp != 0.0f) {
in[0]+= (*fp) * bp->vec[0];
in[1]+= (*fp) * bp->vec[1];
in[2]+= (*fp) * bp->vec[2];
@@ -980,53 +982,53 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
float *coord_fp= coord_array, *tilt_fp= tilt_array, *radius_fp= radius_array, *weight_fp= weight_array;
int i, len, istart, iend, cycl;
- if(nu->knotsu==NULL) return;
- if(nu->orderu>nu->pntsu) return;
- if(coord_array==NULL) return;
+ if (nu->knotsu==NULL) return;
+ if (nu->orderu>nu->pntsu) return;
+ if (coord_array==NULL) return;
/* allocate and initialize */
len= nu->pntsu;
- if(len==0) return;
+ if (len==0) return;
sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
resolu= (resolu*SEGMENTSU(nu));
- if(resolu==0) {
+ if (resolu==0) {
MEM_freeN(sum);
return;
}
fp= nu->knotsu;
ustart= fp[nu->orderu-1];
- if(nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
+ if (nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
else uend= fp[nu->pntsu];
ustep= (uend-ustart)/(resolu - ((nu->flagu & CU_NURB_CYCLIC) ? 0 : 1));
basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbcurve3");
- if(nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1;
+ if (nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1;
else cycl= 0;
u= ustart;
- while(resolu--) {
+ while (resolu--) {
basisNurb(u, nu->orderu, (short)(nu->pntsu+cycl), nu->knotsu, basisu, &istart, &iend);
/* calc sum */
sumdiv= 0.0;
fp= sum;
bp= nu->bp+ istart-1;
- for(i= istart; i<=iend; i++, fp++) {
+ for (i= istart; i<=iend; i++, fp++) {
- if(i>=nu->pntsu) bp= nu->bp+(i - nu->pntsu);
+ if (i>=nu->pntsu) bp= nu->bp+(i - nu->pntsu);
else bp++;
*fp= basisu[i]*bp->vec[3];
sumdiv+= *fp;
}
- if(sumdiv != 0.0f) if(sumdiv < 0.999f || sumdiv > 1.001f) {
+ if (sumdiv != 0.0f) if (sumdiv < 0.999f || sumdiv > 1.001f) {
/* is normalizing needed? */
fp= sum;
- for(i= istart; i<=iend; i++, fp++) {
+ for (i= istart; i<=iend; i++, fp++) {
*fp/= sumdiv;
}
}
@@ -1034,12 +1036,12 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
/* one! (1.0) real point */
fp= sum;
bp= nu->bp+ istart-1;
- for(i= istart; i<=iend; i++, fp++) {
+ for (i= istart; i<=iend; i++, fp++) {
- if(i>=nu->pntsu) bp= nu->bp+(i - nu->pntsu);
+ if (i>=nu->pntsu) bp= nu->bp+(i - nu->pntsu);
else bp++;
- if(*fp != 0.0f) {
+ if (*fp != 0.0f) {
coord_fp[0]+= (*fp) * bp->vec[0];
coord_fp[1]+= (*fp) * bp->vec[1];
@@ -1090,7 +1092,7 @@ void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int i
q2= 2*rt2+6*rt3;
q3= 6*rt3;
- for(a=0; a<=it; a++) {
+ for (a=0; a<=it; a++) {
*p= q0;
p = (float *)(((char *)p)+stride);
q0+= q1;
@@ -1106,11 +1108,11 @@ static void forward_diff_bezier_cotangent(float *p0, float *p1, float *p2, float
*
* This could also be optimized like forward_diff_bezier */
int a;
- for(a=0; a<=it; a++) {
+ for (a=0; a<=it; a++) {
float t = (float)a / (float)it;
int i;
- for(i=0; i<3; i++) {
+ for (i=0; i<3; i++) {
p[i]= (-6*t + 6)*p0[i] + (18*t - 12)*p1[i] + (-18*t + 6)*p2[i] + (6*t)*p3[i];
}
normalize_v3(p);
@@ -1133,7 +1135,7 @@ float *make_orco_surf(Object *ob)
/* first calculate the size of the datablock */
nu= cu->nurb.first;
- while(nu) {
+ while (nu) {
/* as we want to avoid the seam in a cyclic nurbs
* texture wrapping, reserve extra orco data space to save these extra needed
* vertex based UV coordinates for the meridian vertices.
@@ -1150,7 +1152,7 @@ float *make_orco_surf(Object *ob)
sizev = nu->pntsv*resolv;
if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
if (nu->flagv & CU_NURB_CYCLIC) sizev++;
- if(nu->pntsv>1) tot+= sizeu * sizev;
+ if (nu->pntsv>1) tot+= sizeu * sizev;
nu= nu->next;
}
@@ -1158,24 +1160,24 @@ float *make_orco_surf(Object *ob)
fp= coord_array= MEM_callocN(3*sizeof(float)*tot, "make_orco");
nu= cu->nurb.first;
- while(nu) {
+ while (nu) {
resolu= cu->resolu_ren ? cu->resolu_ren : nu->resolu;
resolv= cu->resolv_ren ? cu->resolv_ren : nu->resolv;
- if(nu->pntsv>1) {
+ if (nu->pntsv>1) {
sizeu = nu->pntsu*resolu;
sizev = nu->pntsv*resolv;
if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
if (nu->flagv & CU_NURB_CYCLIC) sizev++;
- if(cu->flag & CU_UV_ORCO) {
- for(b=0; b< sizeu; b++) {
- for(a=0; a< sizev; a++) {
+ if (cu->flag & CU_UV_ORCO) {
+ for (b=0; b< sizeu; b++) {
+ for (a=0; a< sizev; a++) {
- if(sizev <2) fp[0]= 0.0f;
+ if (sizev <2) fp[0]= 0.0f;
else fp[0]= -1.0f + 2.0f*((float)a)/(sizev - 1);
- if(sizeu <2) fp[1]= 0.0f;
+ if (sizeu <2) fp[1]= 0.0f;
else fp[1]= -1.0f + 2.0f*((float)b)/(sizeu - 1);
fp[2]= 0.0;
@@ -1190,12 +1192,12 @@ float *make_orco_surf(Object *ob)
makeNurbfaces(nu, tdata, 0, resolu, resolv);
- for(b=0; b<sizeu; b++) {
+ for (b=0; b<sizeu; b++) {
int use_b= b;
if (b==sizeu-1 && (nu->flagu & CU_NURB_CYCLIC))
use_b= 0;
- for(a=0; a<sizev; a++) {
+ for (a=0; a<sizev; a++) {
int use_a= a;
if (a==sizev-1 && (nu->flagv & CU_NURB_CYCLIC))
use_a= 0;
@@ -1236,7 +1238,8 @@ float *make_orco_curve(Scene *scene, Object *ob)
for (dl=disp.first; dl; dl=dl->next) {
if (dl->type==DL_INDEX3) {
numVerts += dl->nr;
- } else if (dl->type==DL_SURF) {
+ }
+ else if (dl->type==DL_SURF) {
/* convertblender.c uses the Surface code for creating renderfaces when cyclic U only (closed circle beveling) */
if (dl->flag & DL_CYCL_U) {
if (dl->flag & DL_CYCL_V)
@@ -1257,7 +1260,8 @@ float *make_orco_curve(Scene *scene, Object *ob)
fp[0]= 2.0f*u/(dl->nr-1) - 1.0f;
fp[1]= 0.0;
fp[2]= 0.0;
- } else {
+ }
+ else {
copy_v3_v3(fp, &dl->verts[u*3]);
fp[0]= (fp[0]-cu->loc[0])/cu->size[0];
@@ -1265,7 +1269,8 @@ float *make_orco_curve(Scene *scene, Object *ob)
fp[2]= (fp[2]-cu->loc[2])/cu->size[2];
}
}
- } else if (dl->type==DL_SURF) {
+ }
+ else if (dl->type==DL_SURF) {
int sizeu= dl->nr, sizev= dl->parts;
/* exception as handled in convertblender.c too */
@@ -1281,7 +1286,8 @@ float *make_orco_curve(Scene *scene, Object *ob)
fp[0]= 2.0f*u/(sizev - 1) - 1.0f;
fp[1]= 2.0f*v/(sizeu - 1) - 1.0f;
fp[2]= 0.0;
- } else {
+ }
+ else {
float *vert;
int realv= v % dl->nr;
int realu= u % dl->parts;
@@ -1317,13 +1323,13 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
disp->first = disp->last = NULL;
/* if a font object is being edited, then do nothing */
-// XXX if( ob == obedit && ob->type == OB_FONT ) return;
+// XXX if ( ob == obedit && ob->type == OB_FONT ) return;
- if(cu->bevobj) {
+ if (cu->bevobj) {
if (cu->bevobj->type!=OB_CURVE) return;
bevcu= cu->bevobj->data;
- if(bevcu->ext1==0.0f && bevcu->ext2==0.0f) {
+ if (bevcu->ext1==0.0f && bevcu->ext2==0.0f) {
ListBase bevdisp= {NULL, NULL};
facx= cu->bevobj->size[0];
facy= cu->bevobj->size[1];
@@ -1331,27 +1337,28 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
if (forRender) {
makeDispListCurveTypes_forRender(scene, cu->bevobj, &bevdisp, NULL, 0);
dl= bevdisp.first;
- } else {
+ }
+ else {
dl= cu->bevobj->disp.first;
- if(dl==NULL) {
+ if (dl==NULL) {
makeDispListCurveTypes(scene, cu->bevobj, 0);
dl= cu->bevobj->disp.first;
}
}
- while(dl) {
+ while (dl) {
if ELEM(dl->type, DL_POLY, DL_SEGM) {
dlnew= MEM_mallocN(sizeof(DispList), "makebevelcurve1");
*dlnew= *dl;
dlnew->verts= MEM_mallocN(3*sizeof(float)*dl->parts*dl->nr, "makebevelcurve1");
memcpy(dlnew->verts, dl->verts, 3*sizeof(float)*dl->parts*dl->nr);
- if(dlnew->type==DL_SEGM) dlnew->flag |= (DL_FRONT_CURVE|DL_BACK_CURVE);
+ if (dlnew->type==DL_SEGM) dlnew->flag |= (DL_FRONT_CURVE|DL_BACK_CURVE);
BLI_addtail(disp, dlnew);
fp= dlnew->verts;
nr= dlnew->parts*dlnew->nr;
- while(nr--) {
+ while (nr--) {
fp[2]= fp[1]*facy;
fp[1]= -fp[0]*facx;
fp[0]= 0.0;
@@ -1364,10 +1371,10 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
freedisplist(&bevdisp);
}
}
- else if(cu->ext1==0.0f && cu->ext2==0.0f) {
+ else if (cu->ext1==0.0f && cu->ext2==0.0f) {
;
}
- else if(cu->ext2==0.0f) {
+ else if (cu->ext2==0.0f) {
dl= MEM_callocN(sizeof(DispList), "makebevelcurve2");
dl->verts= MEM_mallocN(2*3*sizeof(float), "makebevelcurve2");
BLI_addtail(disp, dl);
@@ -1382,7 +1389,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
fp[3]= fp[4]= 0.0;
fp[5]= cu->ext1;
}
- else if( (cu->flag & (CU_FRONT|CU_BACK))==0 && cu->ext1==0.0f) { // we make a full round bevel in that case
+ else if ( (cu->flag & (CU_FRONT|CU_BACK))==0 && cu->ext1==0.0f) { // we make a full round bevel in that case
nr= 4+ 2*cu->bevresol;
@@ -1399,7 +1406,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
dangle= (2.0f*(float)M_PI/(nr));
angle= -(nr-1)*dangle;
- for(a=0; a<nr; a++) {
+ for (a=0; a<nr; a++) {
fp[0]= 0.0;
fp[1]= (cosf(angle)*(cu->ext2));
fp[2]= (sinf(angle)*(cu->ext2)) - cu->ext1;
@@ -1413,9 +1420,9 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
/* bevel now in three parts, for proper vertex normals */
/* part 1, back */
- if((cu->flag & CU_BACK) || !(cu->flag & CU_FRONT)) {
+ if ((cu->flag & CU_BACK) || !(cu->flag & CU_FRONT)) {
dnr= nr= 2+ cu->bevresol;
- if( (cu->flag & (CU_FRONT|CU_BACK))==0)
+ if ( (cu->flag & (CU_FRONT|CU_BACK))==0)
nr= 3+ 2*cu->bevresol;
dl= MEM_callocN(sizeof(DispList), "makebevelcurve p1");
@@ -1431,7 +1438,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
dangle= (0.5*M_PI/(dnr-1));
angle= -(nr-1)*dangle;
- for(a=0; a<nr; a++) {
+ for (a=0; a<nr; a++) {
fp[0]= 0.0;
fp[1]= (float)(cosf(angle)*(cu->ext2));
fp[2]= (float)(sinf(angle)*(cu->ext2)) - cu->ext1;
@@ -1441,7 +1448,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
}
/* part 2, sidefaces */
- if(cu->ext1!=0.0f) {
+ if (cu->ext1!=0.0f) {
nr= 2;
dl= MEM_callocN(sizeof(DispList), "makebevelcurve p2");
@@ -1457,7 +1464,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
fp[4]= cu->ext2;
fp[5]= cu->ext1;
- if( (cu->flag & (CU_FRONT|CU_BACK))==0) {
+ if ( (cu->flag & (CU_FRONT|CU_BACK))==0) {
dl= MEM_dupallocN(dl);
dl->verts= MEM_dupallocN(dl->verts);
BLI_addtail(disp, dl);
@@ -1471,9 +1478,9 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
}
/* part 3, front */
- if((cu->flag & CU_FRONT) || !(cu->flag & CU_BACK)) {
+ if ((cu->flag & CU_FRONT) || !(cu->flag & CU_BACK)) {
dnr= nr= 2+ cu->bevresol;
- if( (cu->flag & (CU_FRONT|CU_BACK))==0)
+ if ( (cu->flag & (CU_FRONT|CU_BACK))==0)
nr= 3+ 2*cu->bevresol;
dl= MEM_callocN(sizeof(DispList), "makebevelcurve p3");
@@ -1489,7 +1496,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
angle= 0.0;
dangle= (0.5*M_PI/(dnr-1));
- for(a=0; a<nr; a++) {
+ for (a=0; a<nr; a++) {
fp[0]= 0.0;
fp[1]= (float)(cosf(angle)*(cu->ext2));
fp[2]= (float)(sinf(angle)*(cu->ext2)) + cu->ext1;
@@ -1513,23 +1520,24 @@ static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], c
float deler;
deler= (v1[cox]-v2[cox])*(v3[coy]-v4[coy])-(v3[cox]-v4[cox])*(v1[coy]-v2[coy]);
- if(deler==0.0f) return -1;
+ if (deler==0.0f) return -1;
*labda= (v1[coy]-v3[coy])*(v3[cox]-v4[cox])-(v1[cox]-v3[cox])*(v3[coy]-v4[coy]);
*labda= -(*labda/deler);
deler= v3[coy]-v4[coy];
- if(deler==0) {
+ if (deler==0) {
deler=v3[cox]-v4[cox];
*mu= -(*labda*(v2[cox]-v1[cox])+v1[cox]-v3[cox])/deler;
- } else {
+ }
+ else {
*mu= -(*labda*(v2[coy]-v1[coy])+v1[coy]-v3[coy])/deler;
}
vec[cox]= *labda*(v2[cox]-v1[cox])+v1[cox];
vec[coy]= *labda*(v2[coy]-v1[coy])+v1[coy];
- if(*labda>=0.0f && *labda<=1.0f && *mu>=0.0f && *mu<=1.0f) {
- if(*labda==0.0f || *labda==1.0f || *mu==0.0f || *mu==1.0f) return 1;
+ if (*labda>=0.0f && *labda<=1.0f && *mu>=0.0f && *mu<=1.0f) {
+ if (*labda==0.0f || *labda==1.0f || *mu==0.0f || *mu==1.0f) return 1;
return 2;
}
return 0;
@@ -1560,22 +1568,22 @@ static short bevelinside(BevList *bl1,BevList *bl2)
nr= bl1->nr;
prevbevp= bevp+(nr-1);
- while(nr--) {
+ while (nr--) {
min= prevbevp->vec[1];
max= bevp->vec[1];
- if(max<min) {
+ if (max<min) {
min= max;
max= prevbevp->vec[1];
}
- if(min!=max) {
- if(min<=hvec1[1] && max>=hvec1[1]) {
+ if (min!=max) {
+ if (min<=hvec1[1] && max>=hvec1[1]) {
/* there's a transition, calc intersection point */
mode= cu_isectLL(prevbevp->vec, bevp->vec, hvec1, hvec2, 0, 1, &lab, &mu, vec);
/* if lab==0.0 or lab==1.0 then the edge intersects exactly a transition
* only allow for one situation: we choose lab= 1.0
*/
- if(mode >= 0 && lab != 0.0f) {
- if(vec[0]<hvec1[0]) links++;
+ if (mode >= 0 && lab != 0.0f) {
+ if (vec[0]<hvec1[0]) links++;
else rechts++;
}
}
@@ -1584,7 +1592,7 @@ static short bevelinside(BevList *bl1,BevList *bl2)
bevp++;
}
- if( (links & 1) && (rechts & 1) ) return 1;
+ if ( (links & 1) && (rechts & 1) ) return 1;
return 0;
}
@@ -1599,8 +1607,8 @@ static int vergxcobev(const void *a1, const void *a2)
{
const struct bevelsort *x1=a1,*x2=a2;
- if( x1->left > x2->left ) return 1;
- else if( x1->left < x2->left) return -1;
+ if ( x1->left > x2->left ) return 1;
+ else if ( x1->left < x2->left) return -1;
return 0;
}
@@ -1612,8 +1620,8 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si
t01= (float)sqrt(x1*x1+y1*y1);
t02= (float)sqrt(x2*x2+y2*y2);
- if(t01==0.0f) t01= 1.0f;
- if(t02==0.0f) t02= 1.0f;
+ if (t01==0.0f) t01= 1.0f;
+ if (t02==0.0f) t02= 1.0f;
x1/=t01;
y1/=t01;
@@ -1621,18 +1629,19 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si
y2/=t02;
t02= x1*x2+y1*y2;
- if(fabs(t02)>=1.0) t02= .5*M_PI;
+ if (fabs(t02)>=1.0) t02= .5*M_PI;
else t02= (saacos(t02))/2.0f;
t02= (float)sin(t02);
- if(t02==0.0f) t02= 1.0f;
+ if (t02==0.0f) t02= 1.0f;
x3= x1-x2;
y3= y1-y2;
- if(x3==0 && y3==0) {
+ if (x3==0 && y3==0) {
x3= y1;
y3= -x1;
- } else {
+ }
+ else {
t01= (float)sqrt(x3*x3+y3*y3);
x3/=t01;
y3/=t01;
@@ -1649,21 +1658,21 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
float fac, dfac, t[4];
int a;
- if(tilt_array==NULL && radius_array==NULL)
+ if (tilt_array==NULL && radius_array==NULL)
return;
last= nu->bezt+(nu->pntsu-1);
/* returns a point */
- if(prevbezt==nu->bezt) {
- if(nu->flagu & CU_NURB_CYCLIC) pprev= last;
+ if (prevbezt==nu->bezt) {
+ if (nu->flagu & CU_NURB_CYCLIC) pprev= last;
else pprev= prevbezt;
}
else pprev= prevbezt-1;
/* next point */
- if(bezt==last) {
- if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
+ if (bezt==last) {
+ if (nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
else next= bezt;
}
else next= bezt+1;
@@ -1671,11 +1680,12 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
fac= 0.0;
dfac= 1.0f/(float)resolu;
- for(a=0; a<resolu; a++, fac+= dfac) {
+ for (a=0; a<resolu; a++, fac+= dfac) {
if (tilt_array) {
if (nu->tilt_interp==KEY_CU_EASE) { /* May as well support for tilt also 2.47 ease interp */
*tilt_array = prevbezt->alfa + (bezt->alfa - prevbezt->alfa)*(3.0f*fac*fac - 2.0f*fac*fac*fac);
- } else {
+ }
+ else {
key_curve_position_weights(fac, t, nu->tilt_interp);
*tilt_array= t[0]*pprev->alfa + t[1]*prevbezt->alfa + t[2]*bezt->alfa + t[3]*next->alfa;
}
@@ -1689,7 +1699,8 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
* Note! - this only takes the 2 points into account,
* giving much more localized results to changes in radius, sometimes you want that */
*radius_array = prevbezt->radius + (bezt->radius - prevbezt->radius)*(3.0f*fac*fac - 2.0f*fac*fac*fac);
- } else {
+ }
+ else {
/* reuse interpolation from tilt if we can */
if (tilt_array==NULL || nu->tilt_interp != nu->radius_interp) {
@@ -1701,7 +1712,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
radius_array = (float *)(((char *)radius_array) + stride);
}
- if(weight_array) {
+ if (weight_array) {
/* basic interpolation for now, could copy tilt interp too */
*weight_array = prevbezt->weight + (bezt->weight - prevbezt->weight)*(3.0f*fac*fac - 2.0f*fac*fac*fac);
@@ -1742,7 +1753,7 @@ static void bevel_list_calc_bisect(BevList *bl)
bevp0= bevp1-1;
nr= bl->nr;
- while(nr--) {
+ while (nr--) {
/* totally simple */
bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
@@ -1761,8 +1772,8 @@ static void bevel_list_flip_tangents(BevList *bl)
bevp0= bevp1-1;
nr= bl->nr;
- while(nr--) {
- if(RAD2DEGF(angle_v2v2(bevp0->tan, bevp1->tan)) > 90.0f)
+ while (nr--) {
+ if (RAD2DEGF(angle_v2v2(bevp0->tan, bevp1->tan)) > 90.0f)
negate_v3(bevp1->tan);
bevp0= bevp1;
@@ -1781,7 +1792,7 @@ static void bevel_list_apply_tilt(BevList *bl)
bevp1= bevp2+(bl->nr-1);
nr= bl->nr;
- while(nr--) {
+ while (nr--) {
axis_angle_to_quat(q, bevp1->dir, bevp1->alfa);
mul_qt_qtqt(bevp1->quat, q, bevp1->quat);
normalize_qt(bevp1->quat);
@@ -1800,7 +1811,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
float bevp0_quat[4];
int a;
- for(a=0; a < smooth_iter; a++) {
+ for (a=0; a < smooth_iter; a++) {
bevp2= (BevPoint *)(bl+1);
bevp1= bevp2+(bl->nr-1);
@@ -1808,7 +1819,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
nr= bl->nr;
- if(bl->poly== -1) { /* check its not cyclic */
+ if (bl->poly== -1) { /* check its not cyclic */
/* skip the first point */
/* bevp0= bevp1; */
bevp1= bevp2;
@@ -1824,7 +1835,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
copy_qt_qt(bevp0_quat, bevp0->quat);
- while(nr--) {
+ while (nr--) {
/* interpolate quats */
float zaxis[3] = {0,0,1}, cross[3], q2[4];
interp_qt_qtqt(q, bevp0_quat, bevp2->quat, 0.5);
@@ -1858,7 +1869,7 @@ static void make_bevel_list_3D_zup(BevList *bl)
bevp0= bevp1-1;
nr= bl->nr;
- while(nr--) {
+ while (nr--) {
/* totally simple */
bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
vec_to_quat( bevp1->quat,bevp1->dir, 5, 1);
@@ -1882,15 +1893,15 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
bevp0= bevp1-1;
nr= bl->nr;
- while(nr--) {
+ while (nr--) {
- if(nr+4 > bl->nr) { /* first time and second time, otherwise first point adjusts last */
+ if (nr+4 > bl->nr) { /* first time and second time, otherwise first point adjusts last */
vec_to_quat( bevp1->quat,bevp1->dir, 5, 1);
}
else {
float angle= angle_normalized_v3v3(bevp0->dir, bevp1->dir);
- if(angle > 0.0f) { /* otherwise we can keep as is */
+ if (angle > 0.0f) { /* otherwise we can keep as is */
float cross_tmp[3];
cross_v3_v3v3(cross_tmp, bevp0->dir, bevp1->dir);
axis_angle_to_quat(q, cross_tmp, angle);
@@ -1906,7 +1917,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
bevp2++;
}
- if(bl->poly != -1) { /* check for cyclic */
+ if (bl->poly != -1) { /* check for cyclic */
/* Need to correct for the start/end points not matching
* do this by calculating the tilt angle difference, then apply
@@ -1950,7 +1961,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
/* flip rotation if needs be */
cross_v3_v3v3(cross_tmp, vec_1, vec_2);
normalize_v3(cross_tmp);
- if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < DEG2RADF(90.0f))
+ if (angle_normalized_v3v3(bevp_first->dir, cross_tmp) < DEG2RADF(90.0f))
angle = -angle;
bevp2= (BevPoint *)(bl+1);
@@ -1958,7 +1969,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
bevp0= bevp1-1;
nr= bl->nr;
- while(nr--) {
+ while (nr--) {
ang_fac= angle * (1.0f-((float)nr/bl->nr)); /* also works */
axis_angle_to_quat(q, bevp1->dir, ang_fac);
@@ -1979,7 +1990,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
float bevp0_tan[3], cross_tmp[3];
bevel_list_calc_bisect(bl);
- if(bl->poly== -1) /* check its not cyclic */
+ if (bl->poly== -1) /* check its not cyclic */
bevel_list_cyclic_fix_3D(bl); // XXX - run this now so tangents will be right before doing the flipping
bevel_list_flip_tangents(bl);
@@ -1989,7 +2000,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
bevp0= bevp1-1;
nr= bl->nr;
- while(nr--) {
+ while (nr--) {
cross_v3_v3v3(cross_tmp, bevp1->tan, bevp1->dir);
cross_v3_v3v3(bevp1->tan, cross_tmp, bevp1->dir);
@@ -2009,7 +2020,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
copy_v3_v3(bevp0_tan, bevp0->tan);
nr= bl->nr;
- while(nr--) {
+ while (nr--) {
/* make perpendicular, modify tan in place, is ok */
float cross_tmp[3];
@@ -2038,10 +2049,10 @@ static void make_bevel_list_3D(BevList *bl, int smooth_iter, int twist_mode)
make_bevel_list_3D_zup(bl);
}
- if(bl->poly== -1) /* check its not cyclic */
+ if (bl->poly== -1) /* check its not cyclic */
bevel_list_cyclic_fix_3D(bl);
- if(smooth_iter)
+ if (smooth_iter)
bevel_list_smooth(bl, smooth_iter);
bevel_list_apply_tilt(bl);
@@ -2100,12 +2111,15 @@ void makeBevelList(Object *ob)
/* STEP 1: MAKE POLYS */
BLI_freelistN(&(cu->bev));
- if(cu->editnurb && ob->type!=OB_FONT) {
+ if (cu->editnurb && ob->type!=OB_FONT) {
ListBase *nurbs= curve_editnurbs(cu);
- nu= nurbs->first;
- } else nu= cu->nurb.first;
+ nu = nurbs->first;
+ }
+ else {
+ nu = cu->nurb.first;
+ }
- while(nu) {
+ while (nu) {
/* check if we will calculate tilt data */
do_tilt = CU_DO_TILT(cu, nu);
@@ -2114,29 +2128,30 @@ void makeBevelList(Object *ob)
/* check we are a single point? also check we are not a surface and that the orderu is sane,
* enforced in the UI but can go wrong possibly */
- if(!check_valid_nurb_u(nu)) {
+ if (!check_valid_nurb_u(nu)) {
bl= MEM_callocN(sizeof(BevList)+1*sizeof(BevPoint), "makeBevelList1");
BLI_addtail(&(cu->bev), bl);
bl->nr= 0;
- } else {
- if(G.rendering && cu->resolu_ren!=0)
+ }
+ else {
+ if (G.rendering && cu->resolu_ren!=0)
resolu= cu->resolu_ren;
else
resolu= nu->resolu;
- if(nu->type == CU_POLY) {
+ if (nu->type == CU_POLY) {
len= nu->pntsu;
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList2");
BLI_addtail(&(cu->bev), bl);
- if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
+ if (nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
else bl->poly= -1;
bl->nr= len;
bl->dupe_nr= 0;
bevp= (BevPoint *)(bl+1);
bp= nu->bp;
- while(len--) {
+ while (len--) {
copy_v3_v3(bevp->vec, bp->vec);
bevp->alfa= bp->alfa;
bevp->radius= bp->radius;
@@ -2146,19 +2161,19 @@ void makeBevelList(Object *ob)
bp++;
}
}
- else if(nu->type == CU_BEZIER) {
+ else if (nu->type == CU_BEZIER) {
len= resolu*(nu->pntsu+ (nu->flagu & CU_NURB_CYCLIC) -1)+1; /* in case last point is not cyclic */
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelBPoints");
BLI_addtail(&(cu->bev), bl);
- if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
+ if (nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
else bl->poly= -1;
bevp= (BevPoint *)(bl+1);
a= nu->pntsu-1;
bezt= nu->bezt;
- if(nu->flagu & CU_NURB_CYCLIC) {
+ if (nu->flagu & CU_NURB_CYCLIC) {
a++;
prevbezt= nu->bezt+(nu->pntsu-1);
}
@@ -2167,8 +2182,8 @@ void makeBevelList(Object *ob)
bezt++;
}
- while(a--) {
- if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) {
+ while (a--) {
+ if (prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) {
copy_v3_v3(bevp->vec, prevbezt->vec[1]);
bevp->alfa= prevbezt->alfa;
@@ -2185,7 +2200,7 @@ void makeBevelList(Object *ob)
int j;
/* BevPoint must stay aligned to 4 so sizeof(BevPoint)/sizeof(float) works */
- for(j=0; j<3; j++) {
+ for (j=0; j<3; j++) {
forward_diff_bezier( prevbezt->vec[1][j], prevbezt->vec[2][j],
bezt->vec[0][j], bezt->vec[1][j],
&(bevp->vec[j]), resolu, sizeof(BevPoint));
@@ -2199,7 +2214,7 @@ void makeBevelList(Object *ob)
resolu, sizeof(BevPoint));
- if(cu->twist_mode==CU_TWIST_TANGENT) {
+ if (cu->twist_mode==CU_TWIST_TANGENT) {
forward_diff_bezier_cotangent(
prevbezt->vec[1], prevbezt->vec[2],
bezt->vec[0], bezt->vec[1],
@@ -2207,12 +2222,12 @@ void makeBevelList(Object *ob)
}
/* indicate with handlecodes double points */
- if(prevbezt->h1==prevbezt->h2) {
- if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->split_tag= TRUE;
+ if (prevbezt->h1==prevbezt->h2) {
+ if (prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->split_tag= TRUE;
}
else {
- if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->split_tag= TRUE;
- else if(prevbezt->h2==0 || prevbezt->h2==HD_VECT) bevp->split_tag= TRUE;
+ if (prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->split_tag= TRUE;
+ else if (prevbezt->h2==0 || prevbezt->h2==HD_VECT) bevp->split_tag= TRUE;
}
bl->nr+= resolu;
bevp+= resolu;
@@ -2221,7 +2236,7 @@ void makeBevelList(Object *ob)
bezt++;
}
- if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic: endpoint */
+ if ((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic: endpoint */
copy_v3_v3(bevp->vec, prevbezt->vec[1]);
bevp->alfa= prevbezt->alfa;
bevp->radius= prevbezt->radius;
@@ -2229,15 +2244,15 @@ void makeBevelList(Object *ob)
bl->nr++;
}
}
- else if(nu->type == CU_NURBS) {
- if(nu->pntsv==1) {
+ else if (nu->type == CU_NURBS) {
+ if (nu->pntsv==1) {
len= (resolu*SEGMENTSU(nu));
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList3");
BLI_addtail(&(cu->bev), bl);
bl->nr= len;
bl->dupe_nr= 0;
- if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
+ if (nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
else bl->poly= -1;
bevp= (BevPoint *)(bl+1);
@@ -2254,16 +2269,16 @@ void makeBevelList(Object *ob)
/* STEP 2: DOUBLE POINTS AND AUTOMATIC RESOLUTION, REDUCE DATABLOCKS */
bl= cu->bev.first;
- while(bl) {
+ while (bl) {
if (bl->nr) { /* null bevel items come from single points */
nr= bl->nr;
bevp1= (BevPoint *)(bl+1);
bevp0= bevp1+(nr-1);
nr--;
- while(nr--) {
- if( fabs(bevp0->vec[0]-bevp1->vec[0])<0.00001 ) {
- if( fabs(bevp0->vec[1]-bevp1->vec[1])<0.00001 ) {
- if( fabs(bevp0->vec[2]-bevp1->vec[2])<0.00001 ) {
+ while (nr--) {
+ if ( fabs(bevp0->vec[0]-bevp1->vec[0])<0.00001 ) {
+ if ( fabs(bevp0->vec[1]-bevp1->vec[1])<0.00001 ) {
+ if ( fabs(bevp0->vec[2]-bevp1->vec[2])<0.00001 ) {
bevp0->dupe_tag= TRUE;
bl->dupe_nr++;
}
@@ -2276,9 +2291,9 @@ void makeBevelList(Object *ob)
bl= bl->next;
}
bl= cu->bev.first;
- while(bl) {
+ while (bl) {
blnext= bl->next;
- if(bl->nr && bl->dupe_nr) {
+ if (bl->nr && bl->dupe_nr) {
nr= bl->nr- bl->dupe_nr+1; /* +1 because vectorbezier sets flag too */
blnew= MEM_mallocN(sizeof(BevList)+nr*sizeof(BevPoint), "makeBevelList4");
memcpy(blnew, bl, sizeof(BevList));
@@ -2288,8 +2303,8 @@ void makeBevelList(Object *ob)
bevp0= (BevPoint *)(bl+1);
bevp1= (BevPoint *)(blnew+1);
nr= bl->nr;
- while(nr--) {
- if(bevp0->dupe_tag==0) {
+ while (nr--) {
+ if (bevp0->dupe_tag==0) {
memcpy(bevp1, bevp0, sizeof(BevPoint));
bevp1++;
blnew->nr++;
@@ -2305,8 +2320,8 @@ void makeBevelList(Object *ob)
/* STEP 3: POLYS COUNT AND AUTOHOLE */
bl= cu->bev.first;
poly= 0;
- while(bl) {
- if(bl->nr && bl->poly>=0) {
+ while (bl) {
+ if (bl->nr && bl->poly>=0) {
poly++;
bl->poly= poly;
bl->hole= 0;
@@ -2316,17 +2331,17 @@ void makeBevelList(Object *ob)
/* find extreme left points, also test (turning) direction */
- if(poly>0) {
+ if (poly>0) {
sd= sortdata= MEM_mallocN(sizeof(struct bevelsort)*poly, "makeBevelList5");
bl= cu->bev.first;
- while(bl) {
- if(bl->poly>0) {
+ while (bl) {
+ if (bl->poly>0) {
min= 300000.0;
bevp= (BevPoint *)(bl+1);
nr= bl->nr;
- while(nr--) {
- if(min>bevp->vec[0]) {
+ while (nr--) {
+ if (min>bevp->vec[0]) {
min= bevp->vec[0];
bevp1= bevp;
}
@@ -2336,15 +2351,15 @@ void makeBevelList(Object *ob)
sd->left= min;
bevp= (BevPoint *)(bl+1);
- if(bevp1== bevp) bevp0= bevp+ (bl->nr-1);
+ if (bevp1== bevp) bevp0= bevp+ (bl->nr-1);
else bevp0= bevp1-1;
bevp= bevp+ (bl->nr-1);
- if(bevp1== bevp) bevp2= (BevPoint *)(bl+1);
+ if (bevp1== bevp) bevp2= (BevPoint *)(bl+1);
else bevp2= bevp1+1;
inp= (bevp1->vec[0]- bevp0->vec[0]) * (bevp0->vec[1]- bevp2->vec[1]) + (bevp0->vec[1]- bevp1->vec[1]) * (bevp0->vec[0]- bevp2->vec[0]);
- if(inp > 0.0f) sd->dir= 1;
+ if (inp > 0.0f) sd->dir= 1;
else sd->dir= 0;
sd++;
@@ -2355,11 +2370,11 @@ void makeBevelList(Object *ob)
qsort(sortdata,poly,sizeof(struct bevelsort), vergxcobev);
sd= sortdata+1;
- for(a=1; a<poly; a++, sd++) {
+ for (a=1; a<poly; a++, sd++) {
bl= sd->bl; /* is bl a hole? */
sd1= sortdata+ (a-1);
- for(b=a-1; b>=0; b--, sd1--) { /* all polys to the left */
- if(bevelinside(sd1->bl, bl)) {
+ for (b=a-1; b>=0; b--, sd1--) { /* all polys to the left */
+ if (bevelinside(sd1->bl, bl)) {
bl->hole= 1- sd1->bl->hole;
break;
}
@@ -2367,15 +2382,15 @@ void makeBevelList(Object *ob)
}
/* turning direction */
- if((cu->flag & CU_3D)==0) {
+ if ((cu->flag & CU_3D)==0) {
sd= sortdata;
- for(a=0; a<poly; a++, sd++) {
- if(sd->bl->hole==sd->dir) {
+ for (a=0; a<poly; a++, sd++) {
+ if (sd->bl->hole==sd->dir) {
bl= sd->bl;
bevp1= (BevPoint *)(bl+1);
bevp2= bevp1+ (bl->nr-1);
nr= bl->nr/2;
- while(nr--) {
+ while (nr--) {
SWAP(BevPoint, *bevp1, *bevp2);
bevp1++;
bevp2--;
@@ -2387,16 +2402,16 @@ void makeBevelList(Object *ob)
}
/* STEP 4: 2D-COSINES or 3D ORIENTATION */
- if((cu->flag & CU_3D)==0) {
+ if ((cu->flag & CU_3D)==0) {
/* note: bevp->dir and bevp->quat are not needed for beveling but are
* used when making a path from a 2D curve, therefor they need to be set - Campbell */
bl= cu->bev.first;
- while(bl) {
+ while (bl) {
- if(bl->nr < 2) {
+ if (bl->nr < 2) {
/* do nothing */
}
- else if(bl->nr==2) { /* 2 pnt, treat separate */
+ else if (bl->nr==2) { /* 2 pnt, treat separate */
bevp2= (BevPoint *)(bl+1);
bevp1= bevp2+1;
@@ -2416,7 +2431,7 @@ void makeBevelList(Object *ob)
bevp0= bevp1-1;
nr= bl->nr;
- while(nr--) {
+ while (nr--) {
x1= bevp1->vec[0]- bevp0->vec[0];
x2= bevp1->vec[0]- bevp2->vec[0];
y1= bevp1->vec[1]- bevp0->vec[1];
@@ -2436,7 +2451,7 @@ void makeBevelList(Object *ob)
}
/* correct non-cyclic cases */
- if(bl->poly== -1) {
+ if (bl->poly== -1) {
bevp= (BevPoint *)(bl+1);
bevp1= bevp+1;
bevp->sina= bevp1->sina;
@@ -2456,12 +2471,12 @@ void makeBevelList(Object *ob)
}
else { /* 3D Curves */
bl= cu->bev.first;
- while(bl) {
+ while (bl) {
- if(bl->nr < 2) {
+ if (bl->nr < 2) {
/* do nothing */
}
- else if(bl->nr==2) { /* 2 pnt, treat separate */
+ else if (bl->nr==2) { /* 2 pnt, treat separate */
make_bevel_list_segment_3D(bl);
}
else {
@@ -2480,20 +2495,20 @@ void makeBevelList(Object *ob)
*/
/* mode: is not zero when FCurve, is 2 when forced horizontal for autohandles */
-void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
+static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode, int skip_align)
{
float *p1,*p2,*p3, pt[3];
float dvec_a[3], dvec_b[3];
float len, len_a, len_b;
const float eps= 1e-5;
- if(bezt->h1==0 && bezt->h2==0) {
+ if (bezt->h1==0 && bezt->h2==0) {
return;
}
p2= bezt->vec[1];
- if(prev==NULL) {
+ if (prev==NULL) {
p3= next->vec[1];
pt[0]= 2.0f*p2[0] - p3[0];
pt[1]= 2.0f*p2[1] - p3[1];
@@ -2504,7 +2519,7 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
p1= prev->vec[1];
}
- if(next==NULL) {
+ if (next==NULL) {
pt[0]= 2.0f*p2[0] - p1[0];
pt[1]= 2.0f*p2[1] - p1[1];
pt[2]= 2.0f*p2[2] - p1[2];
@@ -2526,42 +2541,42 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
len_b= len_v3(dvec_b);
}
- if(len_a==0.0f) len_a=1.0f;
- if(len_b==0.0f) len_b=1.0f;
+ if (len_a==0.0f) len_a=1.0f;
+ if (len_b==0.0f) len_b=1.0f;
- if(ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM) || ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) { /* auto */
+ if (ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM) || ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) { /* auto */
float tvec[3];
tvec[0]= dvec_b[0]/len_b + dvec_a[0]/len_a;
tvec[1]= dvec_b[1]/len_b + dvec_a[1]/len_a;
tvec[2]= dvec_b[2]/len_b + dvec_a[2]/len_a;
len= len_v3(tvec) * 2.5614f;
- if(len!=0.0f) {
+ if (len!=0.0f) {
int leftviolate=0, rightviolate=0; /* for mode==2 */
- if(len_a>5.0f*len_b) len_a= 5.0f*len_b;
- if(len_b>5.0f*len_a) len_b= 5.0f*len_a;
+ if (len_a>5.0f*len_b) len_a= 5.0f*len_b;
+ if (len_b>5.0f*len_a) len_b= 5.0f*len_a;
- if(ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM)) {
+ if (ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM)) {
len_a/=len;
madd_v3_v3v3fl(p2-3, p2, tvec, -len_a);
- if((bezt->h1==HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */
+ if ((bezt->h1==HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */
float ydiff1= prev->vec[1][1] - bezt->vec[1][1];
float ydiff2= next->vec[1][1] - bezt->vec[1][1];
- if( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) {
+ if ( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) {
bezt->vec[0][1]= bezt->vec[1][1];
}
else { /* handles should not be beyond y coord of two others */
- if(ydiff1 <= 0.0f) {
- if(prev->vec[1][1] > bezt->vec[0][1]) {
+ if (ydiff1 <= 0.0f) {
+ if (prev->vec[1][1] > bezt->vec[0][1]) {
bezt->vec[0][1]= prev->vec[1][1];
leftviolate= 1;
}
}
else {
- if(prev->vec[1][1] < bezt->vec[0][1]) {
+ if (prev->vec[1][1] < bezt->vec[0][1]) {
bezt->vec[0][1]= prev->vec[1][1];
leftviolate= 1;
}
@@ -2569,25 +2584,25 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
}
}
}
- if(ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) {
+ if (ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) {
len_b/=len;
madd_v3_v3v3fl(p2+3, p2, tvec, len_b);
- if((bezt->h2==HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */
+ if ((bezt->h2==HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */
float ydiff1= prev->vec[1][1] - bezt->vec[1][1];
float ydiff2= next->vec[1][1] - bezt->vec[1][1];
- if( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) {
+ if ( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) {
bezt->vec[2][1]= bezt->vec[1][1];
}
else { /* andles should not be beyond y coord of two others */
- if(ydiff1 <= 0.0f) {
- if(next->vec[1][1] < bezt->vec[2][1]) {
+ if (ydiff1 <= 0.0f) {
+ if (next->vec[1][1] < bezt->vec[2][1]) {
bezt->vec[2][1]= next->vec[1][1];
rightviolate= 1;
}
}
else {
- if(next->vec[1][1] > bezt->vec[2][1]) {
+ if (next->vec[1][1] > bezt->vec[2][1]) {
bezt->vec[2][1]= next->vec[1][1];
rightviolate= 1;
}
@@ -2595,7 +2610,7 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
}
}
}
- if(leftviolate || rightviolate) { /* align left handle */
+ if (leftviolate || rightviolate) { /* align left handle */
float h1[3], h2[3];
float dot;
@@ -2607,7 +2622,7 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
dot= dot_v3v3(h1, h2);
- if(leftviolate) {
+ if (leftviolate) {
mul_v3_fl(h1, dot * len_b);
sub_v3_v3v3(p2+3, p2, h1);
}
@@ -2620,29 +2635,36 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
}
}
- if(bezt->h1==HD_VECT) { /* vector */
+ if (bezt->h1==HD_VECT) { /* vector */
madd_v3_v3v3fl(p2-3, p2, dvec_a, -1.0f/3.0f);
}
- if(bezt->h2==HD_VECT) {
+ if (bezt->h2==HD_VECT) {
madd_v3_v3v3fl(p2+3, p2, dvec_b, 1.0f/3.0f);
}
+ if (skip_align) {
+ /* handles need to be updated during animation and applying stuff like hooks,
+ * but in such situatios it's quite difficult to distinguish in which order
+ * align handles should be aligned so skip them for now */
+ return;
+ }
+
len_b= len_v3v3(p2, p2+3);
len_a= len_v3v3(p2, p2-3);
- if(len_a==0.0f) len_a= 1.0f;
- if(len_b==0.0f) len_b= 1.0f;
+ if (len_a==0.0f) len_a= 1.0f;
+ if (len_b==0.0f) len_b= 1.0f;
- if(bezt->f1 & SELECT) { /* order of calculation */
- if(bezt->h2==HD_ALIGN) { /* aligned */
- if(len_a>eps) {
+ if (bezt->f1 & SELECT) { /* order of calculation */
+ if (bezt->h2==HD_ALIGN) { /* aligned */
+ if (len_a>eps) {
len= len_b/len_a;
p2[3]= p2[0]+len*(p2[0] - p2[-3]);
p2[4]= p2[1]+len*(p2[1] - p2[-2]);
p2[5]= p2[2]+len*(p2[2] - p2[-1]);
}
}
- if(bezt->h1==HD_ALIGN) {
- if(len_b>eps) {
+ if (bezt->h1==HD_ALIGN) {
+ if (len_b>eps) {
len= len_a/len_b;
p2[-3]= p2[0]+len*(p2[0] - p2[3]);
p2[-2]= p2[1]+len*(p2[1] - p2[4]);
@@ -2651,16 +2673,16 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
}
}
else {
- if(bezt->h1==HD_ALIGN) {
- if(len_b>eps) {
+ if (bezt->h1==HD_ALIGN) {
+ if (len_b>eps) {
len= len_a/len_b;
p2[-3]= p2[0]+len*(p2[0] - p2[3]);
p2[-2]= p2[1]+len*(p2[1] - p2[4]);
p2[-1]= p2[2]+len*(p2[2] - p2[5]);
}
}
- if(bezt->h2==HD_ALIGN) { /* aligned */
- if(len_a>eps) {
+ if (bezt->h2==HD_ALIGN) { /* aligned */
+ if (len_a>eps) {
len= len_b/len_a;
p2[3]= p2[0]+len*(p2[0] - p2[-3]);
p2[4]= p2[1]+len*(p2[1] - p2[-2]);
@@ -2670,25 +2692,25 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
}
}
-void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
+static void calchandlesNurb_intern(Nurb *nu, int skip_align)
{
BezTriple *bezt, *prev, *next;
short a;
- if(nu->type != CU_BEZIER) return;
- if(nu->pntsu<2) return;
+ if (nu->type != CU_BEZIER) return;
+ if (nu->pntsu<2) return;
a= nu->pntsu;
bezt= nu->bezt;
- if(nu->flagu & CU_NURB_CYCLIC) prev= bezt+(a-1);
+ if (nu->flagu & CU_NURB_CYCLIC) prev= bezt+(a-1);
else prev= NULL;
next= bezt+1;
- while(a--) {
- calchandleNurb(bezt, prev, next, 0);
+ while (a--) {
+ calchandleNurb_intern(bezt, prev, next, 0, skip_align);
prev= bezt;
- if(a==1) {
- if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
+ if (a==1) {
+ if (nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
else next= NULL;
}
else next++;
@@ -2697,6 +2719,16 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
}
}
+void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
+{
+ calchandleNurb_intern(bezt, prev, next, mode, FALSE);
+}
+
+void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
+{
+ calchandlesNurb_intern(nu, FALSE);
+}
+
void testhandlesNurb(Nurb *nu)
{
@@ -2710,29 +2742,29 @@ void testhandlesNurb(Nurb *nu)
BezTriple *bezt;
short flag, a;
- if(nu->type != CU_BEZIER) return;
+ if (nu->type != CU_BEZIER) return;
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
flag= 0;
- if(bezt->f1 & SELECT) flag++;
- if(bezt->f2 & SELECT) flag += 2;
- if(bezt->f3 & SELECT) flag += 4;
+ if (bezt->f1 & SELECT) flag++;
+ if (bezt->f2 & SELECT) flag += 2;
+ if (bezt->f3 & SELECT) flag += 4;
- if( !(flag==0 || flag==7) ) {
- if(ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) { /* auto */
+ if ( !(flag==0 || flag==7) ) {
+ if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) { /* auto */
bezt->h1= HD_ALIGN;
}
- if(ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { /* auto */
+ if (ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { /* auto */
bezt->h2= HD_ALIGN;
}
- if(bezt->h1==HD_VECT) { /* vector */
- if(flag < 4) bezt->h1= 0;
+ if (bezt->h1==HD_VECT) { /* vector */
+ if (flag < 4) bezt->h1= 0;
}
- if(bezt->h2==HD_VECT) { /* vector */
- if( flag > 3) bezt->h2= 0;
+ if (bezt->h2==HD_VECT) { /* vector */
+ if ( flag > 3) bezt->h2= 0;
}
}
bezt++;
@@ -2748,61 +2780,61 @@ void autocalchandlesNurb(Nurb *nu, int flag)
BezTriple *bezt2, *bezt1, *bezt0;
int i, align, leftsmall, rightsmall;
- if(nu==NULL || nu->bezt==NULL) return;
+ if (nu==NULL || nu->bezt==NULL) return;
bezt2 = nu->bezt;
bezt1 = bezt2 + (nu->pntsu-1);
bezt0 = bezt1 - 1;
i = nu->pntsu;
- while(i--) {
+ while (i--) {
align= leftsmall= rightsmall= 0;
/* left handle: */
- if(flag==0 || (bezt1->f1 & flag) ) {
+ if (flag==0 || (bezt1->f1 & flag) ) {
bezt1->h1= 0;
/* distance too short: vectorhandle */
- if( len_v3v3( bezt1->vec[1], bezt0->vec[1] ) < 0.0001f) {
+ if ( len_v3v3( bezt1->vec[1], bezt0->vec[1] ) < 0.0001f) {
bezt1->h1= HD_VECT;
leftsmall= 1;
}
else {
/* aligned handle? */
- if(dist_to_line_v2(bezt1->vec[1], bezt1->vec[0], bezt1->vec[2]) < 0.0001f) {
+ if (dist_to_line_v2(bezt1->vec[1], bezt1->vec[0], bezt1->vec[2]) < 0.0001f) {
align= 1;
bezt1->h1= HD_ALIGN;
}
/* or vector handle? */
- if(dist_to_line_v2(bezt1->vec[0], bezt1->vec[1], bezt0->vec[1]) < 0.0001f)
+ if (dist_to_line_v2(bezt1->vec[0], bezt1->vec[1], bezt0->vec[1]) < 0.0001f)
bezt1->h1= HD_VECT;
}
}
/* right handle: */
- if(flag==0 || (bezt1->f3 & flag) ) {
+ if (flag==0 || (bezt1->f3 & flag) ) {
bezt1->h2= 0;
/* distance too short: vectorhandle */
- if( len_v3v3( bezt1->vec[1], bezt2->vec[1] ) < 0.0001f) {
+ if ( len_v3v3( bezt1->vec[1], bezt2->vec[1] ) < 0.0001f) {
bezt1->h2= HD_VECT;
rightsmall= 1;
}
else {
/* aligned handle? */
- if(align) bezt1->h2= HD_ALIGN;
+ if (align) bezt1->h2= HD_ALIGN;
/* or vector handle? */
- if(dist_to_line_v2(bezt1->vec[2], bezt1->vec[1], bezt2->vec[1]) < 0.0001f)
+ if (dist_to_line_v2(bezt1->vec[2], bezt1->vec[1], bezt2->vec[1]) < 0.0001f)
bezt1->h2= HD_VECT;
}
}
- if(leftsmall && bezt1->h2==HD_ALIGN) bezt1->h2= 0;
- if(rightsmall && bezt1->h1==HD_ALIGN) bezt1->h1= 0;
+ if (leftsmall && bezt1->h2==HD_ALIGN) bezt1->h2= 0;
+ if (rightsmall && bezt1->h1==HD_ALIGN) bezt1->h1= 0;
/* undesired combination: */
- if(bezt1->h1==HD_ALIGN && bezt1->h2==HD_VECT) bezt1->h1= 0;
- if(bezt1->h2==HD_ALIGN && bezt1->h1==HD_VECT) bezt1->h2= 0;
+ if (bezt1->h1==HD_ALIGN && bezt1->h2==HD_VECT) bezt1->h1= 0;
+ if (bezt1->h2==HD_ALIGN && bezt1->h1==HD_VECT) bezt1->h2= 0;
bezt0= bezt1;
bezt1= bezt2;
@@ -2817,7 +2849,7 @@ void autocalchandlesNurb_all(ListBase *editnurb, int flag)
Nurb *nu;
nu= editnurb->first;
- while(nu) {
+ while (nu) {
autocalchandlesNurb(nu, flag);
nu= nu->next;
}
@@ -2835,17 +2867,17 @@ void sethandlesNurb(ListBase *editnurb, short code)
BezTriple *bezt;
short a, ok=0;
- if(code==1 || code==2) {
+ if (code==1 || code==2) {
nu= editnurb->first;
- while(nu) {
- if(nu->type == CU_BEZIER) {
+ while (nu) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
- if(bezt->f1 & SELECT) bezt->h1= code;
- if(bezt->f3 & SELECT) bezt->h2= code;
- if(bezt->h1!=bezt->h2) {
+ while (a--) {
+ if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
+ if (bezt->f1 & SELECT) bezt->h1= code;
+ if (bezt->f3 & SELECT) bezt->h2= code;
+ if (bezt->h1!=bezt->h2) {
if ELEM(bezt->h1, HD_ALIGN, HD_AUTO) bezt->h1= HD_FREE;
if ELEM(bezt->h2, HD_ALIGN, HD_AUTO) bezt->h2= HD_FREE;
}
@@ -2863,34 +2895,36 @@ void sethandlesNurb(ListBase *editnurb, short code)
nu= editnurb->first;
if (code == 5) {
ok = HD_ALIGN;
- } else if (code == 6) {
+ }
+ else if (code == 6) {
ok = HD_FREE;
- } else {
+ }
+ else {
/* Toggle */
- while(nu) {
- if(nu->type == CU_BEZIER) {
+ while (nu) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if((bezt->f1 & SELECT) && bezt->h1) ok= 1;
- if((bezt->f3 & SELECT) && bezt->h2) ok= 1;
- if(ok) break;
+ while (a--) {
+ if ((bezt->f1 & SELECT) && bezt->h1) ok= 1;
+ if ((bezt->f3 & SELECT) && bezt->h2) ok= 1;
+ if (ok) break;
bezt++;
}
}
nu= nu->next;
}
- if(ok) ok= HD_FREE;
+ if (ok) ok= HD_FREE;
else ok= HD_ALIGN;
}
nu= editnurb->first;
- while(nu) {
- if(nu->type == CU_BEZIER) {
+ while (nu) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->f1 & SELECT) bezt->h1= ok;
- if(bezt->f3 & SELECT) bezt->h2= ok;
+ while (a--) {
+ if (bezt->f1 & SELECT) bezt->h1= ok;
+ if (bezt->f3 & SELECT) bezt->h2= ok;
bezt++;
}
@@ -2904,9 +2938,9 @@ void sethandlesNurb(ListBase *editnurb, short code)
static void swapdata(void *adr1, void *adr2, int len)
{
- if(len<=0) return;
+ if (len<=0) return;
- if(len<65) {
+ if (len<65) {
char adr[64];
memcpy(adr, adr1, len);
@@ -2931,24 +2965,24 @@ void switchdirectionNurb(Nurb *nu)
float *fp1, *fp2, *tempf;
int a, b;
- if(nu->pntsu==1 && nu->pntsv==1) return;
+ if (nu->pntsu==1 && nu->pntsv==1) return;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt1= nu->bezt;
bezt2= bezt1+(a-1);
- if(a & 1) a+= 1; /* if odd, also swap middle content */
+ if (a & 1) a+= 1; /* if odd, also swap middle content */
a/= 2;
- while(a>0) {
- if(bezt1!=bezt2) SWAP(BezTriple, *bezt1, *bezt2);
+ while (a>0) {
+ if (bezt1!=bezt2) SWAP(BezTriple, *bezt1, *bezt2);
swapdata(bezt1->vec[0], bezt1->vec[2], 12);
- if(bezt1!=bezt2) swapdata(bezt2->vec[0], bezt2->vec[2], 12);
+ if (bezt1!=bezt2) swapdata(bezt2->vec[0], bezt2->vec[2], 12);
SWAP(char, bezt1->h1, bezt1->h2);
SWAP(short, bezt1->f1, bezt1->f3);
- if(bezt1!=bezt2) {
+ if (bezt1!=bezt2) {
SWAP(char, bezt2->h1, bezt2->h2);
SWAP(short, bezt2->f1, bezt2->f3);
bezt1->alfa= -bezt1->alfa;
@@ -2959,12 +2993,12 @@ void switchdirectionNurb(Nurb *nu)
bezt2--;
}
}
- else if(nu->pntsv==1) {
+ else if (nu->pntsv==1) {
a= nu->pntsu;
bp1= nu->bp;
bp2= bp1+(a-1);
a/= 2;
- while(bp1!=bp2 && a>0) {
+ while (bp1!=bp2 && a>0) {
SWAP(BPoint, *bp1, *bp2);
a--;
bp1->alfa= -bp1->alfa;
@@ -2972,15 +3006,15 @@ void switchdirectionNurb(Nurb *nu)
bp1++;
bp2--;
}
- if(nu->type == CU_NURBS) {
+ if (nu->type == CU_NURBS) {
/* no knots for too short paths */
- if(nu->knotsu) {
+ if (nu->knotsu) {
/* inverse knots */
a= KNOTSU(nu);
fp1= nu->knotsu;
fp2= fp1+(a-1);
a/= 2;
- while(fp1!=fp2 && a>0) {
+ while (fp1!=fp2 && a>0) {
SWAP(float, *fp1, *fp2);
a--;
fp1++;
@@ -2990,7 +3024,7 @@ void switchdirectionNurb(Nurb *nu)
a= KNOTSU(nu);
fp1= nu->knotsu;
fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect");
- while(a--) {
+ while (a--) {
fp2[0]= fabs(fp1[1]-fp1[0]);
fp1++;
fp2++;
@@ -3001,7 +3035,7 @@ void switchdirectionNurb(Nurb *nu)
fp2= tempf;
fp1[0]= 0.0;
fp1++;
- while(a--) {
+ while (a--) {
fp1[0]= fp1[-1]+fp2[0];
fp1++;
fp2++;
@@ -3012,14 +3046,14 @@ void switchdirectionNurb(Nurb *nu)
}
else {
- for(b=0; b<nu->pntsv; b++) {
+ for (b=0; b<nu->pntsv; b++) {
bp1= nu->bp+b*nu->pntsu;
a= nu->pntsu;
bp2= bp1+(a-1);
a/= 2;
- while(bp1!=bp2 && a>0) {
+ while (bp1!=bp2 && a>0) {
SWAP(BPoint, *bp1, *bp2);
a--;
bp1++;
@@ -3046,7 +3080,8 @@ float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3]
copy_v3_v3(co, bezt->vec[1]); co+=3;
copy_v3_v3(co, bezt->vec[2]); co+=3;
}
- } else {
+ }
+ else {
BPoint *bp = nu->bp;
for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
@@ -3073,13 +3108,16 @@ void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3]
copy_v3_v3(bezt->vec[1], co); co+=3;
copy_v3_v3(bezt->vec[2], co); co+=3;
}
- } else {
+ }
+ else {
BPoint *bp = nu->bp;
for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
copy_v3_v3(bp->vec, co); co+=3;
}
}
+
+ calchandlesNurb_intern(nu, TRUE);
}
}
@@ -3104,7 +3142,7 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
else {
BPoint *bp = nu->bp;
- for(i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
+ for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
copy_v3_v3(co, key); co+=3; key+=3;
key++; /* skip tilt */
}
@@ -3119,11 +3157,11 @@ void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key)
Nurb *nu;
int i;
- for(nu=lb->first; nu; nu=nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu=lb->first; nu; nu=nu->next) {
+ if (nu->type == CU_BEZIER) {
BezTriple *bezt = nu->bezt;
- for(i=0; i<nu->pntsu; i++,bezt++) {
+ for (i=0; i<nu->pntsu; i++,bezt++) {
key+=3*3;
bezt->alfa= *key;
key+=3;
@@ -3132,7 +3170,7 @@ void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key)
else {
BPoint *bp = nu->bp;
- for(i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
+ for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
key+=3;
bp->alfa= *key;
key++;
@@ -3151,7 +3189,8 @@ int check_valid_nurb_u( struct Nurb *nu )
if (((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) { /* Bezier U Endpoints */
if (nu->orderu==4) {
if (nu->pntsu < 5) return 0; /* bezier with 4 orderu needs 5 points */
- } else if (nu->orderu != 3) return 0; /* order must be 3 or 4 */
+ }
+ else if (nu->orderu != 3) return 0; /* order must be 3 or 4 */
}
return 1;
}
@@ -3165,7 +3204,8 @@ int check_valid_nurb_v( struct Nurb *nu)
if (((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) { /* Bezier V Endpoints */
if (nu->orderv==4) {
if (nu->pntsv < 5) return 0; /* bezier with 4 orderu needs 5 points */
- } else if (nu->orderv != 3) return 0; /* order must be 3 or 4 */
+ }
+ else if (nu->orderv != 3) return 0; /* order must be 3 or 4 */
}
return 1;
}
@@ -3173,11 +3213,11 @@ int check_valid_nurb_v( struct Nurb *nu)
int clamp_nurb_order_u( struct Nurb *nu )
{
int change = 0;
- if(nu->pntsu<nu->orderu) {
+ if (nu->pntsu<nu->orderu) {
nu->orderu= nu->pntsu;
change= 1;
}
- if(((nu->flagu & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) {
+ if (((nu->flagu & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) {
CLAMP(nu->orderu, 3,4);
change= 1;
}
@@ -3187,11 +3227,11 @@ int clamp_nurb_order_u( struct Nurb *nu )
int clamp_nurb_order_v( struct Nurb *nu)
{
int change = 0;
- if(nu->pntsv<nu->orderv) {
+ if (nu->pntsv<nu->orderv) {
nu->orderv= nu->pntsv;
change= 1;
}
- if(((nu->flagv & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) {
+ if (((nu->flagv & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) {
CLAMP(nu->orderv, 3,4);
change= 1;
}
@@ -3215,7 +3255,7 @@ int minmax_curve(Curve *cu, float min[3], float max[3])
ListBase *nurb_lb= BKE_curve_nurbs(cu);
Nurb *nu;
- for(nu= nurb_lb->first; nu; nu= nu->next)
+ for (nu= nurb_lb->first; nu; nu= nu->next)
minmaxNurb(nu, min, max);
return (nurb_lb->first != NULL);
@@ -3229,14 +3269,14 @@ int curve_center_median(Curve *cu, float cent[3])
zero_v3(cent);
- for(nu= nurb_lb->first; nu; nu= nu->next) {
+ for (nu= nurb_lb->first; nu; nu= nu->next) {
int i;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
BezTriple *bezt;
i= nu->pntsu;
total += i * 3;
- for(bezt= nu->bezt; i--; bezt++) {
+ for (bezt= nu->bezt; i--; bezt++) {
add_v3_v3(cent, bezt->vec[0]);
add_v3_v3(cent, bezt->vec[1]);
add_v3_v3(cent, bezt->vec[2]);
@@ -3246,7 +3286,7 @@ int curve_center_median(Curve *cu, float cent[3])
BPoint *bp;
i= nu->pntsu*nu->pntsv;
total += i;
- for(bp= nu->bp; i--; bp++) {
+ for (bp= nu->bp; i--; bp++) {
add_v3_v3(cent, bp->vec);
}
}
@@ -3261,7 +3301,7 @@ int curve_center_bounds(Curve *cu, float cent[3])
{
float min[3], max[3];
INIT_MINMAX(min, max);
- if(minmax_curve(cu, min, max)) {
+ if (minmax_curve(cu, min, max)) {
mid_v3_v3v3(cent, min, max);
return 1;
}
@@ -3275,13 +3315,13 @@ void curve_translate(Curve *cu, float offset[3], int do_keys)
Nurb *nu;
int i;
- for(nu= nurb_lb->first; nu; nu= nu->next) {
+ for (nu= nurb_lb->first; nu; nu= nu->next) {
BezTriple *bezt;
BPoint *bp;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
i= nu->pntsu;
- for(bezt= nu->bezt; i--; bezt++) {
+ for (bezt= nu->bezt; i--; bezt++) {
add_v3_v3(bezt->vec[0], offset);
add_v3_v3(bezt->vec[1], offset);
add_v3_v3(bezt->vec[2], offset);
@@ -3289,7 +3329,7 @@ void curve_translate(Curve *cu, float offset[3], int do_keys)
}
else {
i= nu->pntsu*nu->pntsv;
- for(bp= nu->bp; i--; bp++) {
+ for (bp= nu->bp; i--; bp++) {
add_v3_v3(bp->vec, offset);
}
}
@@ -3310,10 +3350,10 @@ void curve_delete_material_index(Curve *cu, int index)
{
const int curvetype= curve_type(cu);
- if(curvetype == OB_FONT) {
+ if (curvetype == OB_FONT) {
struct CharInfo *info= cu->strinfo;
int i;
- for(i= cu->len-1; i >= 0; i--, info++) {
+ for (i= cu->len-1; i >= 0; i--, info++) {
if (info->mat_nr && info->mat_nr>=index) {
info->mat_nr--;
}
@@ -3323,7 +3363,7 @@ void curve_delete_material_index(Curve *cu, int index)
Nurb *nu;
for (nu= cu->nurb.first; nu; nu= nu->next) {
- if(nu->mat_nr && nu->mat_nr>=index) {
+ if (nu->mat_nr && nu->mat_nr>=index) {
nu->mat_nr--;
if (curvetype == OB_CURVE) nu->charidx--;
}
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 233d0202540..301ba282cbd 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -130,10 +130,10 @@ static void layerCopy_mdeformvert(const void *source, void *dest,
memcpy(dest, source, count * size);
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
MDeformVert *dvert = (MDeformVert *)((char *)dest + i * size);
- if(dvert->totweight) {
+ if (dvert->totweight) {
MDeformWeight *dw = MEM_callocN(dvert->totweight * sizeof(*dw),
"layerCopy_mdeformvert dw");
@@ -149,10 +149,10 @@ static void layerFree_mdeformvert(void *data, int count, int size)
{
int i;
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
MDeformVert *dvert = (MDeformVert *)((char *)data + i * size);
- if(dvert->dw) {
+ if (dvert->dw) {
MEM_freeN(dvert->dw);
dvert->dw = NULL;
dvert->totweight = 0;
@@ -166,7 +166,7 @@ static void layerCopy_bmesh_elem_py_ptr(const void *UNUSED(source), void *dest,
{
int i, size = sizeof(void *);
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
void **ptr = (void **)((char *)dest + i * size);
*ptr = NULL;
}
@@ -185,7 +185,7 @@ static void layerFree_bmesh_elem_py_ptr(void *data, int count, int size)
int i;
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
void **ptr = (void *)((char *)data + i * size);
if (*ptr) {
bpy_bm_generic_invalidate(*ptr);
@@ -207,28 +207,28 @@ static void layerInterp_mdeformvert(void **sources, float *weights,
LinkNode *node;
int i, j, totweight;
- if(count <= 0) return;
+ if (count <= 0) return;
/* build a list of unique def_nrs for dest */
totweight = 0;
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
MDeformVert *source = sources[i];
float interp_weight = weights ? weights[i] : 1.0f;
- for(j = 0; j < source->totweight; ++j) {
+ for (j = 0; j < source->totweight; ++j) {
MDeformWeight *dw = &source->dw[j];
- for(node = dest_dw; node; node = node->next) {
+ for (node = dest_dw; node; node = node->next) {
MDeformWeight *tmp_dw = (MDeformWeight *)node->link;
- if(tmp_dw->def_nr == dw->def_nr) {
+ if (tmp_dw->def_nr == dw->def_nr) {
tmp_dw->weight += dw->weight * interp_weight;
break;
}
}
/* if this def_nr is not in the list, add it */
- if(!node) {
+ if (!node) {
MDeformWeight *tmp_dw = MEM_callocN(sizeof(*tmp_dw),
"layerInterp_mdeformvert tmp_dw");
tmp_dw->def_nr = dw->def_nr;
@@ -240,14 +240,14 @@ static void layerInterp_mdeformvert(void **sources, float *weights,
}
/* now we know how many unique deform weights there are, so realloc */
- if(dvert->dw) MEM_freeN(dvert->dw);
+ if (dvert->dw) MEM_freeN(dvert->dw);
- if(totweight) {
+ if (totweight) {
dvert->dw = MEM_callocN(sizeof(*dvert->dw) * totweight,
"layerInterp_mdeformvert dvert->dw");
dvert->totweight = totweight;
- for(i = 0, node = dest_dw; node; node = node->next, ++i)
+ for (i = 0, node = dest_dw; node; node = node->next, ++i)
dvert->dw[i] = *((MDeformWeight *)node->link);
}
else
@@ -265,7 +265,7 @@ static void layerInterp_msticky(void **sources, float *weights,
int i;
co[0] = co[1] = 0.0f;
- for(i = 0; i < count; i++) {
+ for (i = 0; i < count; i++) {
w = weights ? weights[i] : 1.0f;
mst = (MSticky*)sources[i];
@@ -283,7 +283,7 @@ static void layerCopy_tface(const void *source, void *dest, int count)
MTFace *dest_tf = (MTFace*)dest;
int i;
- for(i = 0; i < count; ++i)
+ for (i = 0; i < count; ++i)
dest_tf[i] = source_tf[i];
}
@@ -295,16 +295,16 @@ static void layerInterp_tface(void **sources, float *weights,
float uv[4][2] = {{0.0f}};
float *sub_weight;
- if(count <= 0) return;
+ if (count <= 0) return;
sub_weight = sub_weights;
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
float weight = weights ? weights[i] : 1;
MTFace *src = sources[i];
- for(j = 0; j < 4; ++j) {
- if(sub_weights) {
- for(k = 0; k < 4; ++k, ++sub_weight) {
+ for (j = 0; j < 4; ++j) {
+ if (sub_weights) {
+ for (k = 0; k < 4; ++k, ++sub_weight) {
madd_v2_v2fl(uv[j], src->uv[k], (*sub_weight) * weight);
}
}
@@ -330,18 +330,18 @@ static void layerSwap_tface(void *data, const int *corner_indices)
char flag = tf->flag & ~(TF_SEL1 | TF_SEL2 | TF_SEL3 | TF_SEL4);
int j;
- for(j = 0; j < 4; ++j) {
+ for (j = 0; j < 4; ++j) {
const int source_index = corner_indices[j];
copy_v2_v2(uv[j], tf->uv[source_index]);
// swap pinning flags around
- if(tf->unwrap & pin_flags[source_index]) {
+ if (tf->unwrap & pin_flags[source_index]) {
unwrap |= pin_flags[j];
}
// swap selection flags around
- if(tf->flag & sel_flags[source_index]) {
+ if (tf->flag & sel_flags[source_index]) {
flag |= sel_flags[j];
}
}
@@ -358,7 +358,7 @@ static void layerDefault_tface(void *data, int count)
MTFace *tf = (MTFace*)data;
int i;
- for(i = 0; i < count; i++)
+ for (i = 0; i < count; i++)
tf[i] = default_tf;
}
@@ -386,7 +386,7 @@ static void layerCopy_origspace_face(const void *source, void *dest, int count)
OrigSpaceFace *dest_tf = (OrigSpaceFace*)dest;
int i;
- for(i = 0; i < count; ++i)
+ for (i = 0; i < count; ++i)
dest_tf[i] = source_tf[i];
}
@@ -398,19 +398,20 @@ static void layerInterp_origspace_face(void **sources, float *weights,
float uv[4][2] = {{0.0f}};
float *sub_weight;
- if(count <= 0) return;
+ if (count <= 0) return;
sub_weight = sub_weights;
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
float weight = weights ? weights[i] : 1;
OrigSpaceFace *src = sources[i];
- for(j = 0; j < 4; ++j) {
- if(sub_weights) {
- for(k = 0; k < 4; ++k, ++sub_weight) {
+ for (j = 0; j < 4; ++j) {
+ if (sub_weights) {
+ for (k = 0; k < 4; ++k, ++sub_weight) {
madd_v2_v2fl(uv[j], src->uv[k], (*sub_weight) * weight);
}
- } else {
+ }
+ else {
madd_v2_v2fl(uv[j], src->uv[j], weight);
}
}
@@ -428,7 +429,7 @@ static void layerSwap_origspace_face(void *data, const int *corner_indices)
float uv[4][2];
int j;
- for(j = 0; j < 4; ++j) {
+ for (j = 0; j < 4; ++j) {
copy_v2_v2(uv[j], osf->uv[corner_indices[j]]);
}
memcpy(osf->uv, uv, sizeof(osf->uv));
@@ -440,7 +441,7 @@ static void layerDefault_origspace_face(void *data, int count)
OrigSpaceFace *osf = (OrigSpaceFace*)data;
int i;
- for(i = 0; i < count; i++)
+ for (i = 0; i < count; i++)
osf[i] = default_osf;
}
@@ -450,12 +451,12 @@ static void layerSwap_mdisps(void *data, const int *ci)
float (*d)[3] = NULL;
int corners, cornersize, S;
- if(s->disps) {
+ if (s->disps) {
int nverts= (ci[1] == 3) ? 4 : 3; /* silly way to know vertex count of face */
corners= multires_mdisp_corners(s);
cornersize= s->totdisp/corners;
- if(corners!=nverts) {
+ if (corners!=nverts) {
/* happens when face changed vertex count in edit mode
* if it happened, just forgot displacement */
@@ -467,7 +468,7 @@ static void layerSwap_mdisps(void *data, const int *ci)
d= MEM_callocN(sizeof(float) * 3 * s->totdisp, "mdisps swap");
- for(S = 0; S < corners; S++)
+ for (S = 0; S < corners; S++)
memcpy(d + cornersize*S, s->disps + cornersize*ci[S], cornersize*3*sizeof(float));
MEM_freeN(s->disps);
@@ -481,14 +482,18 @@ static void layerCopy_mdisps(const void *source, void *dest, int count)
const MDisps *s = source;
MDisps *d = dest;
- for(i = 0; i < count; ++i) {
- if(s[i].disps) {
+ for (i = 0; i < count; ++i) {
+ if (s[i].disps) {
d[i].disps = MEM_dupallocN(s[i].disps);
+ d[i].hidden = MEM_dupallocN(s[i].hidden);
d[i].totdisp = s[i].totdisp;
+ d[i].level = s[i].level;
}
else {
d[i].disps = NULL;
+ d[i].hidden = NULL;
d[i].totdisp = 0;
+ d[i].level = 0;
}
}
@@ -499,11 +504,15 @@ static void layerFree_mdisps(void *data, int count, int UNUSED(size))
int i;
MDisps *d = data;
- for(i = 0; i < count; ++i) {
- if(d[i].disps)
+ for (i = 0; i < count; ++i) {
+ if (d[i].disps)
MEM_freeN(d[i].disps);
+ if (d[i].hidden)
+ MEM_freeN(d[i].hidden);
d[i].disps = NULL;
+ d[i].hidden = NULL;
d[i].totdisp = 0;
+ d[i].level = 0;
}
}
@@ -512,11 +521,11 @@ static int layerRead_mdisps(CDataFile *cdf, void *data, int count)
MDisps *d = data;
int i;
- for(i = 0; i < count; ++i) {
- if(!d[i].disps)
+ for (i = 0; i < count; ++i) {
+ if (!d[i].disps)
d[i].disps = MEM_callocN(sizeof(float)*3*d[i].totdisp, "mdisps read");
- if(!cdf_read_data(cdf, d[i].totdisp*3*sizeof(float), d[i].disps)) {
+ if (!cdf_read_data(cdf, d[i].totdisp*3*sizeof(float), d[i].disps)) {
printf("failed to read multires displacement %d/%d %d\n", i, count, d[i].totdisp);
return 0;
}
@@ -530,8 +539,8 @@ static int layerWrite_mdisps(CDataFile *cdf, void *data, int count)
MDisps *d = data;
int i;
- for(i = 0; i < count; ++i) {
- if(!cdf_write_data(cdf, d[i].totdisp*3*sizeof(float), d[i].disps)) {
+ for (i = 0; i < count; ++i) {
+ if (!cdf_write_data(cdf, d[i].totdisp*3*sizeof(float), d[i].disps)) {
printf("failed to write multires displacement %d/%d %d\n", i, count, d[i].totdisp);
return 0;
}
@@ -546,7 +555,7 @@ static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), void *data, int count
size_t size = 0;
int i;
- for(i = 0; i < count; ++i)
+ for (i = 0; i < count; ++i)
size += d[i].totdisp*3*sizeof(float);
return size;
@@ -632,7 +641,7 @@ static void layerDefault_mloopcol(void *data, int count)
MLoopCol default_mloopcol = {255,255,255,255};
MLoopCol *mlcol = (MLoopCol*)data;
int i;
- for(i = 0; i < count; i++)
+ for (i = 0; i < count; i++)
mlcol[i] = default_mloopcol;
}
@@ -656,17 +665,17 @@ static void layerInterp_mloopcol(void **sources, float *weights,
float weight = weights ? weights[i] : 1;
MLoopCol *src = sources[i];
if (sub_weights) {
- col.a += src->a * (*sub_weight) * weight;
col.r += src->r * (*sub_weight) * weight;
col.g += src->g * (*sub_weight) * weight;
col.b += src->b * (*sub_weight) * weight;
+ col.a += src->a * (*sub_weight) * weight;
sub_weight++;
}
else {
- col.a += src->a * weight;
col.r += src->r * weight;
col.g += src->g * weight;
col.b += src->b * weight;
+ col.a += src->a * weight;
}
}
@@ -677,10 +686,10 @@ static void layerInterp_mloopcol(void **sources, float *weights,
CLAMP(col.g, 0.0f, 255.0f);
CLAMP(col.b, 0.0f, 255.0f);
- mc->a = (int)col.a;
mc->r = (int)col.r;
mc->g = (int)col.g;
mc->b = (int)col.b;
+ mc->a = (int)col.a;
}
static void layerCopyValue_mloopuv(void *source, void *dest)
@@ -736,7 +745,7 @@ static void layerInterp_mloopuv(void **sources, float *weights,
if (sub_weights) {
const float *sub_weight = sub_weights;
- for(i = 0; i < count; i++) {
+ for (i = 0; i < count; i++) {
float weight = weights ? weights[i] : 1.0f;
MLoopUV *src = sources[i];
madd_v2_v2fl(uv, src->uv, (*sub_weight) * weight);
@@ -744,7 +753,7 @@ static void layerInterp_mloopuv(void **sources, float *weights,
}
}
else {
- for(i = 0; i < count; i++) {
+ for (i = 0; i < count; i++) {
float weight = weights ? weights[i] : 1;
MLoopUV *src = sources[i];
madd_v2_v2fl(uv, src->uv, weight);
@@ -806,7 +815,7 @@ static void layerInterp_mloop_origspace(void **sources, float *weights,
if (sub_weights) {
const float *sub_weight = sub_weights;
- for(i = 0; i < count; i++) {
+ for (i = 0; i < count; i++) {
float weight = weights ? weights[i] : 1.0f;
OrigSpaceLoop *src = sources[i];
madd_v2_v2fl(uv, src->uv, (*sub_weight) * weight);
@@ -814,7 +823,7 @@ static void layerInterp_mloop_origspace(void **sources, float *weights,
}
}
else {
- for(i = 0; i < count; i++) {
+ for (i = 0; i < count; i++) {
float weight = weights ? weights[i] : 1;
OrigSpaceLoop *src = sources[i];
madd_v2_v2fl(uv, src->uv, weight);
@@ -837,23 +846,24 @@ static void layerInterp_mcol(void **sources, float *weights,
float *sub_weight;
- if(count <= 0) return;
+ if (count <= 0) return;
sub_weight = sub_weights;
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
float weight = weights ? weights[i] : 1;
- for(j = 0; j < 4; ++j) {
- if(sub_weights) {
+ for (j = 0; j < 4; ++j) {
+ if (sub_weights) {
MCol *src = sources[i];
- for(k = 0; k < 4; ++k, ++sub_weight, ++src) {
+ for (k = 0; k < 4; ++k, ++sub_weight, ++src) {
const float w= (*sub_weight) * weight;
col[j].a += src->a * w;
col[j].r += src->r * w;
col[j].g += src->g * w;
col[j].b += src->b * w;
}
- } else {
+ }
+ else {
MCol *src = sources[i];
col[j].a += src[j].a * weight;
col[j].r += src[j].r * weight;
@@ -863,7 +873,7 @@ static void layerInterp_mcol(void **sources, float *weights,
}
}
- for(j = 0; j < 4; ++j) {
+ for (j = 0; j < 4; ++j) {
/* Subdivide smooth or fractal can cause problems without clamping
* although weights should also not cause this situation */
@@ -885,7 +895,7 @@ static void layerSwap_mcol(void *data, const int *corner_indices)
MCol col[4];
int j;
- for(j = 0; j < 4; ++j)
+ for (j = 0; j < 4; ++j)
col[j] = mcol[corner_indices[j]];
memcpy(mcol, col, sizeof(col));
@@ -897,7 +907,7 @@ static void layerDefault_mcol(void *data, int count)
MCol *mcol = (MCol*)data;
int i;
- for(i = 0; i < 4*count; i++) {
+ for (i = 0; i < 4*count; i++) {
mcol[i] = default_mcol;
}
}
@@ -909,17 +919,17 @@ static void layerInterp_bweight(void **sources, float *weights,
float **in = (float **)sources;
int i;
- if(count <= 0) return;
+ if (count <= 0) return;
*f = 0.0f;
if (weights) {
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
*f += *in[i] * weights[i];
}
}
else {
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
*f += *in[i];
}
}
@@ -932,17 +942,17 @@ static void layerInterp_shapekey(void **sources, float *weights,
float **in = (float **)sources;
int i;
- if(count <= 0) return;
+ if (count <= 0) return;
zero_v3(co);
if (weights) {
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
madd_v3_v3fl(co, in[i], weights[i]);
}
}
else {
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
add_v3_v3(co, in[i]);
}
}
@@ -1004,8 +1014,8 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
layerFree_mdisps, NULL, layerSwap_mdisps, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
layerRead_mdisps, layerWrite_mdisps, layerFilesize_mdisps},
- /* 20: CD_WEIGHT_MCOL */
- {sizeof(MCol)*4, "MCol", 4, "WeightCol", NULL, NULL, layerInterp_mcol,
+ /* 20: CD_PREVIEW_MCOL */
+ {sizeof(MCol)*4, "MCol", 4, "PreviewCol", NULL, NULL, layerInterp_mcol,
layerSwap_mcol, layerDefault_mcol},
/* 21: CD_ID_MCOL */
{sizeof(MCol)*4, "MCol", 4, "IDCol", NULL, NULL, layerInterp_mcol,
@@ -1036,8 +1046,8 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
{sizeof(OrigSpaceLoop), "OrigSpaceLoop", 1, "OS Loop", NULL, NULL, layerInterp_mloop_origspace, NULL, NULL,
layerEqual_mloop_origspace, layerMultiply_mloop_origspace, layerInitMinMax_mloop_origspace,
layerAdd_mloop_origspace, layerDoMinMax_mloop_origspace, layerCopyValue_mloop_origspace},
- /* 32: CD_WEIGHT_MLOOPCOL */
- {sizeof(MLoopCol), "MLoopCol", 1, "WeightLoopCol", NULL, NULL, layerInterp_mloopcol, NULL,
+ /* 32: CD_PREVIEW_MLOOPCOL */
+ {sizeof(MLoopCol), "MLoopCol", 1, "PreviewLoopCol", NULL, NULL, layerInterp_mloopcol, NULL,
layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol,
layerAdd_mloopcol, layerDoMinMax_mloopcol, layerCopyValue_mloopcol},
/* 33: CD_BM_ELEM_PYPTR */
@@ -1056,12 +1066,12 @@ static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
/* 5-9 */ "CDMTFace", "CDMCol", "CDOrigIndex", "CDNormal", "CDFlags",
/* 10-14 */ "CDMFloatProperty", "CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco",
/* 15-19 */ "CDMTexPoly", "CDMLoopUV", "CDMloopCol", "CDTangent", "CDMDisps",
- /* 20-24 */"CDWeightMCol", "CDIDMCol", "CDTextureMCol", "CDClothOrco", "CDMRecast"
+ /* 20-24 */"CDPreviewMCol", "CDIDMCol", "CDTextureMCol", "CDClothOrco", "CDMRecast"
/* BMESH ONLY */
,
/* 25-29 */ "CDMPoly", "CDMLoop", "CDShapeKeyIndex", "CDShapeKey", "CDBevelWeight",
- /* 30-32 */ "CDSubSurfCrease", "CDOrigSpaceLoop", "CDWeightLoopCol"
+ /* 30-32 */ "CDSubSurfCrease", "CDOrigSpaceLoop", "CDPreviewLoopCol"
/* END BMESH ONLY */
};
@@ -1083,9 +1093,9 @@ const CustomDataMask CD_MASK_EDITMESH =
const CustomDataMask CD_MASK_DERIVEDMESH =
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE |
CD_MASK_MCOL | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_CLOTH_ORCO |
- CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY | CD_MASK_WEIGHT_MLOOPCOL |
+ CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY | CD_MASK_PREVIEW_MLOOPCOL |
CD_MASK_PROP_STR | CD_MASK_ORIGSPACE | CD_MASK_ORIGSPACE_MLOOP | CD_MASK_ORCO | CD_MASK_TANGENT |
- CD_MASK_WEIGHT_MCOL | CD_MASK_NORMAL | CD_MASK_SHAPEKEY | CD_MASK_RECAST |
+ CD_MASK_PREVIEW_MCOL | CD_MASK_NORMAL | CD_MASK_SHAPEKEY | CD_MASK_RECAST |
CD_MASK_ORIGINDEX | CD_MASK_POLYINDEX;
const CustomDataMask CD_MASK_BMESH = CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY |
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_PROP_FLT | CD_MASK_PROP_INT |
@@ -1096,14 +1106,14 @@ const CustomDataMask CD_MASK_FACECORNERS =
static const LayerTypeInfo *layerType_getInfo(int type)
{
- if(type < 0 || type >= CD_NUMTYPES) return NULL;
+ if (type < 0 || type >= CD_NUMTYPES) return NULL;
return &LAYERTYPEINFO[type];
}
static const char *layerType_getName(int type)
{
- if(type < 0 || type >= CD_NUMTYPES) return NULL;
+ if (type < 0 || type >= CD_NUMTYPES) return NULL;
return LAYERTYPENAMES[type];
}
@@ -1141,7 +1151,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
void *data;
int i, type, number = 0, lasttype = -1, lastactive = 0, lastrender = 0, lastclone = 0, lastmask = 0, lastflag = 0;
- for(i = 0; i < source->totlayer; ++i) {
+ for (i = 0; i < source->totlayer; ++i) {
layer = &source->layers[i];
/*typeInfo = layerType_getInfo(layer->type);*/ /*UNUSED*/
@@ -1159,9 +1169,9 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
else
number++;
- if(lastflag & CD_FLAG_NOCOPY) continue;
- else if(!(mask & CD_TYPE_AS_MASK(type))) continue;
- else if(number < CustomData_number_of_layers(dest, type)) continue;
+ if (lastflag & CD_FLAG_NOCOPY) continue;
+ else if (!(mask & CD_TYPE_AS_MASK(type))) continue;
+ else if (number < CustomData_number_of_layers(dest, type)) continue;
switch (alloctype) {
case CD_ASSIGN:
@@ -1174,14 +1184,14 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
break;
}
- if((alloctype == CD_ASSIGN) && (lastflag & CD_FLAG_NOFREE))
+ if ((alloctype == CD_ASSIGN) && (lastflag & CD_FLAG_NOFREE))
newlayer = customData_add_layer__internal(dest, type, CD_REFERENCE,
data, totelem, layer->name);
else
newlayer = customData_add_layer__internal(dest, type, alloctype,
data, totelem, layer->name);
- if(newlayer) {
+ if (newlayer) {
newlayer->uid = layer->uid;
newlayer->active = lastactive;
@@ -1200,7 +1210,7 @@ void CustomData_copy(const struct CustomData *source, struct CustomData *dest,
{
memset(dest, 0, sizeof(*dest));
- if(source->external)
+ if (source->external)
dest->external= MEM_dupallocN(source->external);
CustomData_merge(source, dest, mask, alloctype, totelem);
@@ -1210,20 +1220,20 @@ static void customData_free_layer__internal(CustomDataLayer *layer, int totelem)
{
const LayerTypeInfo *typeInfo;
- if(!(layer->flag & CD_FLAG_NOFREE) && layer->data) {
+ if (!(layer->flag & CD_FLAG_NOFREE) && layer->data) {
typeInfo = layerType_getInfo(layer->type);
- if(typeInfo->free)
+ if (typeInfo->free)
typeInfo->free(layer->data, totelem, typeInfo->size);
- if(layer->data)
+ if (layer->data)
MEM_freeN(layer->data);
}
}
static void CustomData_external_free(CustomData *data)
{
- if(data->external) {
+ if (data->external) {
MEM_freeN(data->external);
data->external= NULL;
}
@@ -1233,10 +1243,10 @@ void CustomData_free(CustomData *data, int totelem)
{
int i;
- for(i = 0; i < data->totlayer; ++i)
+ for (i = 0; i < data->totlayer; ++i)
customData_free_layer__internal(&data->layers[i], totelem);
- if(data->layers)
+ if (data->layers)
MEM_freeN(data->layers);
CustomData_external_free(data);
@@ -1249,7 +1259,7 @@ static void customData_update_offsets(CustomData *data)
const LayerTypeInfo *typeInfo;
int i, offset = 0;
- for(i = 0; i < data->totlayer; ++i) {
+ for (i = 0; i < data->totlayer; ++i) {
typeInfo = layerType_getInfo(data->layers[i].type);
data->layers[i].offset = offset;
@@ -1264,8 +1274,8 @@ int CustomData_get_layer_index(const CustomData *data, int type)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
return i;
return -1;
@@ -1286,8 +1296,8 @@ int CustomData_get_named_layer_index(const CustomData *data, int type, const cha
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type && strcmp(data->layers[i].name, name)==0)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type && strcmp(data->layers[i].name, name)==0)
return i;
return -1;
@@ -1309,8 +1319,8 @@ int CustomData_get_render_layer_index(const CustomData *data, int type)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
return i + data->layers[i].active_rnd;
return -1;
@@ -1320,8 +1330,8 @@ int CustomData_get_clone_layer_index(const CustomData *data, int type)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
return i + data->layers[i].active_clone;
return -1;
@@ -1331,8 +1341,8 @@ int CustomData_get_stencil_layer_index(const CustomData *data, int type)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
return i + data->layers[i].active_mask;
return -1;
@@ -1342,8 +1352,8 @@ int CustomData_get_active_layer(const CustomData *data, int type)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
return data->layers[i].active;
return -1;
@@ -1353,8 +1363,8 @@ int CustomData_get_render_layer(const CustomData *data, int type)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
return data->layers[i].active_rnd;
return -1;
@@ -1364,8 +1374,8 @@ int CustomData_get_clone_layer(const CustomData *data, int type)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
return data->layers[i].active_clone;
return -1;
@@ -1375,8 +1385,8 @@ int CustomData_get_stencil_layer(const CustomData *data, int type)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
return data->layers[i].active_mask;
return -1;
@@ -1386,8 +1396,8 @@ void CustomData_set_layer_active(CustomData *data, int type, int n)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
data->layers[i].active = n;
}
@@ -1395,8 +1405,8 @@ void CustomData_set_layer_render(CustomData *data, int type, int n)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
data->layers[i].active_rnd = n;
}
@@ -1404,8 +1414,8 @@ void CustomData_set_layer_clone(CustomData *data, int type, int n)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
data->layers[i].active_clone = n;
}
@@ -1413,8 +1423,8 @@ void CustomData_set_layer_stencil(CustomData *data, int type, int n)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
data->layers[i].active_mask = n;
}
@@ -1423,8 +1433,8 @@ void CustomData_set_layer_active_index(CustomData *data, int type, int n)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
data->layers[i].active = n-i;
}
@@ -1432,8 +1442,8 @@ void CustomData_set_layer_render_index(CustomData *data, int type, int n)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
data->layers[i].active_rnd = n-i;
}
@@ -1441,8 +1451,8 @@ void CustomData_set_layer_clone_index(CustomData *data, int type, int n)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
data->layers[i].active_clone = n-i;
}
@@ -1450,8 +1460,8 @@ void CustomData_set_layer_stencil_index(CustomData *data, int type, int n)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
data->layers[i].active_mask = n-i;
}
@@ -1459,8 +1469,8 @@ void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
{
int i;
- for(i=0; i < data->totlayer; ++i)
- if(data->layers[i].type == type)
+ for (i=0; i < data->totlayer; ++i)
+ if (data->layers[i].type == type)
data->layers[i].flag |= flag;
}
@@ -1468,7 +1478,7 @@ static int customData_resize(CustomData *data, int amount)
{
CustomDataLayer *tmp = MEM_callocN(sizeof(*tmp)*(data->maxlayer + amount),
"CustomData->layers");
- if(!tmp) return 0;
+ if (!tmp) return 0;
data->maxlayer += amount;
if (data->layers) {
@@ -1497,31 +1507,31 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
if (!typeInfo->defaultname && CustomData_has_layer(data, type))
return &data->layers[CustomData_get_layer_index(data, type)];
- if((alloctype == CD_ASSIGN) || (alloctype == CD_REFERENCE)) {
+ if ((alloctype == CD_ASSIGN) || (alloctype == CD_REFERENCE)) {
newlayerdata = layerdata;
}
else if (size > 0) {
newlayerdata = MEM_callocN(size, layerType_getName(type));
- if(!newlayerdata)
+ if (!newlayerdata)
return NULL;
}
if (alloctype == CD_DUPLICATE && layerdata) {
- if(typeInfo->copy)
+ if (typeInfo->copy)
typeInfo->copy(layerdata, newlayerdata, totelem);
else
memcpy(newlayerdata, layerdata, size);
}
else if (alloctype == CD_DEFAULT) {
- if(typeInfo->set_default)
+ if (typeInfo->set_default)
typeInfo->set_default((char*)newlayerdata, totelem);
}
else if (alloctype == CD_REFERENCE)
flag |= CD_FLAG_NOFREE;
- if(index >= data->maxlayer) {
- if(!customData_resize(data, CUSTOMDATA_GROW)) {
- if(newlayerdata != layerdata)
+ if (index >= data->maxlayer) {
+ if (!customData_resize(data, CUSTOMDATA_GROW)) {
+ if (newlayerdata != layerdata)
MEM_freeN(newlayerdata);
return NULL;
}
@@ -1530,26 +1540,27 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
data->totlayer++;
/* keep layers ordered by type */
- for( ; index > 0 && data->layers[index - 1].type > type; --index)
+ for ( ; index > 0 && data->layers[index - 1].type > type; --index)
data->layers[index] = data->layers[index - 1];
data->layers[index].type = type;
data->layers[index].flag = flag;
data->layers[index].data = newlayerdata;
- if(name || (name=typeInfo->defaultname)) {
+ if (name || (name=typeInfo->defaultname)) {
BLI_strncpy(data->layers[index].name, name, sizeof(data->layers[index].name));
CustomData_set_layer_unique_name(data, index);
}
else
data->layers[index].name[0] = '\0';
- if(index > 0 && data->layers[index-1].type == type) {
+ if (index > 0 && data->layers[index-1].type == type) {
data->layers[index].active = data->layers[index-1].active;
data->layers[index].active_rnd = data->layers[index-1].active_rnd;
data->layers[index].active_clone = data->layers[index-1].active_clone;
data->layers[index].active_mask = data->layers[index-1].active_mask;
- } else {
+ }
+ else {
data->layers[index].active = 0;
data->layers[index].active_rnd = 0;
data->layers[index].active_clone = 0;
@@ -1571,7 +1582,7 @@ void *CustomData_add_layer(CustomData *data, int type, int alloctype,
totelem, typeInfo->defaultname);
CustomData_update_typemap(data);
- if(layer)
+ if (layer)
return layer->data;
return NULL;
@@ -1587,7 +1598,7 @@ void *CustomData_add_layer_named(CustomData *data, int type, int alloctype,
totelem, name);
CustomData_update_typemap(data);
- if(layer)
+ if (layer)
return layer->data;
return NULL;
@@ -1653,8 +1664,8 @@ int CustomData_number_of_layers(const CustomData *data, int type)
{
int i, number = 0;
- for(i = 0; i < data->totlayer; i++)
- if(data->layers[i].type == type)
+ for (i = 0; i < data->totlayer; i++)
+ if (data->layers[i].type == type)
number++;
return number;
@@ -1667,7 +1678,7 @@ void *CustomData_duplicate_referenced_layer(struct CustomData *data, const int t
/* get the layer index of the first layer of type */
layer_index = CustomData_get_active_layer_index(data, type);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
layer = &data->layers[layer_index];
@@ -1678,7 +1689,7 @@ void *CustomData_duplicate_referenced_layer(struct CustomData *data, const int t
*/
const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
- if(typeInfo->copy) {
+ if (typeInfo->copy) {
char *dest_data = MEM_mallocN(typeInfo->size * totelem, "CD duplicate ref layer");
typeInfo->copy(layer->data, dest_data, totelem);
layer->data = dest_data;
@@ -1700,7 +1711,7 @@ void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
/* get the layer index of the desired layer */
layer_index = CustomData_get_named_layer_index(data, type, name);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
layer = &data->layers[layer_index];
@@ -1711,7 +1722,7 @@ void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
*/
const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
- if(typeInfo->copy) {
+ if (typeInfo->copy) {
char *dest_data = MEM_mallocN(typeInfo->size * totelem, "CD duplicate ref layer");
typeInfo->copy(layer->data, dest_data, totelem);
layer->data = dest_data;
@@ -1732,7 +1743,7 @@ int CustomData_is_referenced_layer(struct CustomData *data, int type)
/* get the layer index of the first layer of type */
layer_index = CustomData_get_active_layer_index(data, type);
- if(layer_index < 0) return 0;
+ if (layer_index < 0) return 0;
layer = &data->layers[layer_index];
@@ -1744,7 +1755,7 @@ void CustomData_free_temporary(CustomData *data, int totelem)
CustomDataLayer *layer;
int i, j;
- for(i = 0, j = 0; i < data->totlayer; ++i) {
+ for (i = 0, j = 0; i < data->totlayer; ++i) {
layer = &data->layers[i];
if (i != j)
@@ -1758,7 +1769,7 @@ void CustomData_free_temporary(CustomData *data, int totelem)
data->totlayer = j;
- if(data->totlayer <= data->maxlayer-CUSTOMDATA_GROW)
+ if (data->totlayer <= data->maxlayer-CUSTOMDATA_GROW)
customData_resize(data, -CUSTOMDATA_GROW);
customData_update_offsets(data);
@@ -1769,8 +1780,8 @@ void CustomData_set_only_copy(const struct CustomData *data,
{
int i;
- for(i = 0; i < data->totlayer; ++i)
- if(!(mask & CD_TYPE_AS_MASK(data->layers[i].type)))
+ for (i = 0; i < data->totlayer; ++i)
+ if (!(mask & CD_TYPE_AS_MASK(data->layers[i].type)))
data->layers[i].flag |= CD_FLAG_NOCOPY;
}
@@ -1794,20 +1805,20 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
/* copies a layer at a time */
dest_i = 0;
- for(src_i = 0; src_i < source->totlayer; ++src_i) {
+ for (src_i = 0; src_i < source->totlayer; ++src_i) {
/* find the first dest layer with type >= the source type
* (this should work because layers are ordered by type)
*/
- while(dest_i < dest->totlayer
+ while (dest_i < dest->totlayer
&& dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
- if(dest_i >= dest->totlayer) return;
+ if (dest_i >= dest->totlayer) return;
/* if we found a matching layer, copy the data */
- if(dest->layers[dest_i].type == source->layers[src_i].type) {
+ if (dest->layers[dest_i].type == source->layers[src_i].type) {
char *src_data = source->layers[src_i].data;
char *dest_data = dest->layers[dest_i].data;
@@ -1817,15 +1828,15 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
dest_offset = dest_index * typeInfo->size;
if (!src_data || !dest_data) {
- if (src_data != NULL && dest_data != NULL) {
- printf("%s: warning null data for %s type (%p --> %p), skipping\n",
- __func__, layerType_getName(source->layers[src_i].type),
- (void *)src_data, (void *)dest_data);
- }
+ if (src_data != NULL && dest_data != NULL) {
+ printf("%s: warning null data for %s type (%p --> %p), skipping\n",
+ __func__, layerType_getName(source->layers[src_i].type),
+ (void *)src_data, (void *)dest_data);
+ }
continue;
}
- if(typeInfo->copy)
+ if (typeInfo->copy)
typeInfo->copy(src_data + src_offset,
dest_data + dest_offset,
count);
@@ -1848,11 +1859,11 @@ void CustomData_free_elem(CustomData *data, int index, int count)
int i;
const LayerTypeInfo *typeInfo;
- for(i = 0; i < data->totlayer; ++i) {
- if(!(data->layers[i].flag & CD_FLAG_NOFREE)) {
+ for (i = 0; i < data->totlayer; ++i) {
+ if (!(data->layers[i].flag & CD_FLAG_NOFREE)) {
typeInfo = layerType_getInfo(data->layers[i].type);
- if(typeInfo->free) {
+ if (typeInfo->free) {
int offset = typeInfo->size * index;
typeInfo->free((char *)data->layers[i].data + offset,
@@ -1877,31 +1888,31 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
/* slow fallback in case we're interpolating a ridiculous number of
* elements
*/
- if(count > SOURCE_BUF_SIZE)
+ if (count > SOURCE_BUF_SIZE)
sources = MEM_callocN(sizeof(*sources) * count,
"CustomData_interp sources");
/* interpolates a layer at a time */
dest_i = 0;
- for(src_i = 0; src_i < source->totlayer; ++src_i) {
+ for (src_i = 0; src_i < source->totlayer; ++src_i) {
const LayerTypeInfo *typeInfo= layerType_getInfo(source->layers[src_i].type);
- if(!typeInfo->interp) continue;
+ if (!typeInfo->interp) continue;
/* find the first dest layer with type >= the source type
* (this should work because layers are ordered by type)
*/
- while(dest_i < dest->totlayer
+ while (dest_i < dest->totlayer
&& dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
- if(dest_i >= dest->totlayer) return;
+ if (dest_i >= dest->totlayer) return;
/* if we found a matching layer, copy the data */
- if(dest->layers[dest_i].type == source->layers[src_i].type) {
+ if (dest->layers[dest_i].type == source->layers[src_i].type) {
void *src_data = source->layers[src_i].data;
- for(j = 0; j < count; ++j)
+ for (j = 0; j < count; ++j)
sources[j] = (char *)src_data
+ typeInfo->size * src_indices[j];
@@ -1918,7 +1929,7 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
}
}
- if(count > SOURCE_BUF_SIZE) MEM_freeN(sources);
+ if (count > SOURCE_BUF_SIZE) MEM_freeN(sources);
}
void CustomData_swap(struct CustomData *data, int index, const int *corner_indices)
@@ -1926,10 +1937,10 @@ void CustomData_swap(struct CustomData *data, int index, const int *corner_indic
const LayerTypeInfo *typeInfo;
int i;
- for(i = 0; i < data->totlayer; ++i) {
+ for (i = 0; i < data->totlayer; ++i) {
typeInfo = layerType_getInfo(data->layers[i].type);
- if(typeInfo->swap) {
+ if (typeInfo->swap) {
int offset = typeInfo->size * index;
typeInfo->swap((char *)data->layers[i].data + offset, corner_indices);
@@ -1944,7 +1955,7 @@ void *CustomData_get(const CustomData *data, int index, int type)
/* get the layer index of the active layer of type */
layer_index = CustomData_get_active_layer_index(data, type);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
/* get the offset of the desired element */
offset = layerType_getInfo(type)->size * index;
@@ -1959,7 +1970,7 @@ void *CustomData_get_n(const CustomData *data, int type, int index, int n)
/* get the layer index of the first layer of type */
layer_index = data->typemap[type];
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
offset = layerType_getInfo(type)->size * index;
return (char *)data->layers[layer_index+n].data + offset;
@@ -1969,7 +1980,7 @@ void *CustomData_get_layer(const CustomData *data, int type)
{
/* get the layer index of the active layer of type */
int layer_index = CustomData_get_active_layer_index(data, type);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
return data->layers[layer_index].data;
}
@@ -1978,7 +1989,7 @@ void *CustomData_get_layer_n(const CustomData *data, int type, int n)
{
/* get the layer index of the active layer of type */
int layer_index = CustomData_get_layer_index_n(data, type, n);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
return data->layers[layer_index].data;
}
@@ -1987,7 +1998,7 @@ void *CustomData_get_layer_named(const struct CustomData *data, int type,
const char *name)
{
int layer_index = CustomData_get_named_layer_index(data, type, name);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
return data->layers[layer_index].data;
}
@@ -1998,7 +2009,7 @@ int CustomData_set_layer_name(const CustomData *data, int type, int n, const cha
/* get the layer index of the first layer of type */
int layer_index = CustomData_get_layer_index_n(data, type, n);
- if(layer_index < 0) return 0;
+ if (layer_index < 0) return 0;
if (!name) return 0;
strcpy(data->layers[layer_index].name, name);
@@ -2011,7 +2022,7 @@ void *CustomData_set_layer(const CustomData *data, int type, void *ptr)
/* get the layer index of the first layer of type */
int layer_index = CustomData_get_active_layer_index(data, type);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
data->layers[layer_index].data = ptr;
@@ -2022,7 +2033,7 @@ void *CustomData_set_layer_n(const struct CustomData *data, int type, int n, voi
{
/* get the layer index of the first layer of type */
int layer_index = CustomData_get_layer_index_n(data, type, n);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
data->layers[layer_index].data = ptr;
@@ -2034,9 +2045,9 @@ void CustomData_set(const CustomData *data, int index, int type, void *source)
void *dest = CustomData_get(data, index, type);
const LayerTypeInfo *typeInfo = layerType_getInfo(type);
- if(!dest) return;
+ if (!dest) return;
- if(typeInfo->copy)
+ if (typeInfo->copy)
typeInfo->copy(source, dest, 1);
else
memcpy(dest, source, typeInfo->size);
@@ -2048,8 +2059,8 @@ void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *l
int totloop, int totpoly)
{
int i;
- for(i=0; i < fdata->totlayer; i++) {
- if(fdata->layers[i].type == CD_MTFACE) {
+ for (i=0; i < fdata->totlayer; i++) {
+ if (fdata->layers[i].type == CD_MTFACE) {
CustomData_add_layer_named(pdata, CD_MTEXPOLY, CD_CALLOC, NULL, totpoly, fdata->layers[i].name);
CustomData_add_layer_named(ldata, CD_MLOOPUV, CD_CALLOC, NULL, totloop, fdata->layers[i].name);
}
@@ -2065,17 +2076,17 @@ void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *l
void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total)
{
int i;
- for(i=0; i < pdata->totlayer; i++) {
+ for (i=0; i < pdata->totlayer; i++) {
if (pdata->layers[i].type == CD_MTEXPOLY) {
CustomData_add_layer_named(fdata, CD_MTFACE, CD_CALLOC, NULL, total, pdata->layers[i].name);
}
}
- for(i=0; i < ldata->totlayer; i++) {
+ for (i=0; i < ldata->totlayer; i++) {
if (ldata->layers[i].type == CD_MLOOPCOL) {
CustomData_add_layer_named(fdata, CD_MCOL, CD_CALLOC, NULL, total, ldata->layers[i].name);
}
- else if (ldata->layers[i].type == CD_WEIGHT_MLOOPCOL) {
- CustomData_add_layer_named(fdata, CD_WEIGHT_MCOL, CD_CALLOC, NULL, total, ldata->layers[i].name);
+ else if (ldata->layers[i].type == CD_PREVIEW_MLOOPCOL) {
+ CustomData_add_layer_named(fdata, CD_PREVIEW_MCOL, CD_CALLOC, NULL, total, ldata->layers[i].name);
}
else if (ldata->layers[i].type == CD_ORIGSPACE_MLOOP) {
CustomData_add_layer_named(fdata, CD_ORIGSPACE, CD_CALLOC, NULL, total, ldata->layers[i].name);
@@ -2177,7 +2188,8 @@ void CustomData_bmesh_merge(CustomData *source, CustomData *dest,
CustomData_bmesh_free_block(&destold, &h->data);
h->data = tmp;
}
- } else {
+ }
+ else {
BMFace *f;
BMLoop *l;
BMIter liter;
@@ -2200,12 +2212,12 @@ void CustomData_bmesh_free_block(CustomData *data, void **block)
const LayerTypeInfo *typeInfo;
int i;
- if(!*block) return;
- for(i = 0; i < data->totlayer; ++i) {
- if(!(data->layers[i].flag & CD_FLAG_NOFREE)) {
+ if (!*block) return;
+ for (i = 0; i < data->totlayer; ++i) {
+ if (!(data->layers[i].flag & CD_FLAG_NOFREE)) {
typeInfo = layerType_getInfo(data->layers[i].type);
- if(typeInfo->free) {
+ if (typeInfo->free) {
int offset = data->layers[i].offset;
typeInfo->free((char*)*block + offset, 1, typeInfo->size);
}
@@ -2241,27 +2253,27 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
/* copies a layer at a time */
dest_i = 0;
- for(src_i = 0; src_i < source->totlayer; ++src_i) {
+ for (src_i = 0; src_i < source->totlayer; ++src_i) {
/* find the first dest layer with type >= the source type
* (this should work because layers are ordered by type)
*/
- while(dest_i < dest->totlayer
+ while (dest_i < dest->totlayer
&& dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
- if(dest_i >= dest->totlayer) return;
+ if (dest_i >= dest->totlayer) return;
/* if we found a matching layer, copy the data */
- if(dest->layers[dest_i].type == source->layers[src_i].type &&
+ if (dest->layers[dest_i].type == source->layers[src_i].type &&
strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0) {
char *src_data = (char*)src_block + source->layers[src_i].offset;
char *dest_data = (char*)*dest_block + dest->layers[dest_i].offset;
typeInfo = layerType_getInfo(source->layers[src_i].type);
- if(typeInfo->copy)
+ if (typeInfo->copy)
typeInfo->copy(src_data, dest_data, 1);
else
memcpy(dest_data, src_data, typeInfo->size);
@@ -2282,7 +2294,7 @@ void *CustomData_bmesh_get(const CustomData *data, void *block, int type)
/* get the layer index of the first layer of type */
layer_index = CustomData_get_active_layer_index(data, type);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
return (char *)block + data->layers[layer_index].offset;
}
@@ -2293,7 +2305,7 @@ void *CustomData_bmesh_get_n(const CustomData *data, void *block, int type, int
/* get the layer index of the first layer of type */
layer_index = CustomData_get_layer_index(data, type);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
return (char *)block + data->layers[layer_index+n].offset;
}
@@ -2301,14 +2313,14 @@ void *CustomData_bmesh_get_n(const CustomData *data, void *block, int type, int
/*gets from the layer at physical index n, note: doesn't check type.*/
void *CustomData_bmesh_get_layer_n(const CustomData *data, void *block, int n)
{
- if(n < 0 || n >= data->totlayer) return NULL;
+ if (n < 0 || n >= data->totlayer) return NULL;
return (char *)block + data->layers[n].offset;
}
-int CustomData_layer_has_math(struct CustomData *data, int layern)
+int CustomData_layer_has_math(struct CustomData *data, int layer_n)
{
- const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[layern].type);
+ const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[layer_n].type);
if (typeInfo->equal && typeInfo->add && typeInfo->multiply &&
typeInfo->initminmax && typeInfo->dominmax) return 1;
@@ -2322,9 +2334,9 @@ void CustomData_data_copy_value(int type, void *source, void *dest)
{
const LayerTypeInfo *typeInfo = layerType_getInfo(type);
- if(!dest) return;
+ if (!dest) return;
- if(typeInfo->copyvalue)
+ if (typeInfo->copyvalue)
typeInfo->copyvalue(source, dest);
else
memcpy(dest, source, typeInfo->size);
@@ -2379,9 +2391,9 @@ void CustomData_bmesh_set(const CustomData *data, void *block, int type, void *s
void *dest = CustomData_bmesh_get(data, block, type);
const LayerTypeInfo *typeInfo = layerType_getInfo(type);
- if(!dest) return;
+ if (!dest) return;
- if(typeInfo->copy)
+ if (typeInfo->copy)
typeInfo->copy(source, dest, 1);
else
memcpy(dest, source, typeInfo->size);
@@ -2392,9 +2404,9 @@ void CustomData_bmesh_set_n(CustomData *data, void *block, int type, int n, void
void *dest = CustomData_bmesh_get_n(data, block, type, n);
const LayerTypeInfo *typeInfo = layerType_getInfo(type);
- if(!dest) return;
+ if (!dest) return;
- if(typeInfo->copy)
+ if (typeInfo->copy)
typeInfo->copy(source, dest, 1);
else
memcpy(dest, source, typeInfo->size);
@@ -2405,9 +2417,9 @@ void CustomData_bmesh_set_layer_n(CustomData *data, void *block, int n, void *so
void *dest = CustomData_bmesh_get_layer_n(data, block, n);
const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[n].type);
- if(!dest) return;
+ if (!dest) return;
- if(typeInfo->copy)
+ if (typeInfo->copy)
typeInfo->copy(source, dest, 1);
else
memcpy(dest, source, typeInfo->size);
@@ -2423,16 +2435,16 @@ void CustomData_bmesh_interp(CustomData *data, void **src_blocks, float *weights
/* slow fallback in case we're interpolating a ridiculous number of
* elements
*/
- if(count > SOURCE_BUF_SIZE)
+ if (count > SOURCE_BUF_SIZE)
sources = MEM_callocN(sizeof(*sources) * count,
"CustomData_interp sources");
/* interpolates a layer at a time */
- for(i = 0; i < data->totlayer; ++i) {
+ for (i = 0; i < data->totlayer; ++i) {
CustomDataLayer *layer = &data->layers[i];
const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
- if(typeInfo->interp) {
- for(j = 0; j < count; ++j)
+ if (typeInfo->interp) {
+ for (j = 0; j < count; ++j)
sources[j] = (char *)src_blocks[j] + layer->offset;
typeInfo->interp(sources, weights, sub_weights, count,
@@ -2440,7 +2452,7 @@ void CustomData_bmesh_interp(CustomData *data, void **src_blocks, float *weights
}
}
- if(count > SOURCE_BUF_SIZE) MEM_freeN(sources);
+ if (count > SOURCE_BUF_SIZE) MEM_freeN(sources);
}
void CustomData_bmesh_set_default(CustomData *data, void **block)
@@ -2451,12 +2463,12 @@ void CustomData_bmesh_set_default(CustomData *data, void **block)
if (!*block)
CustomData_bmesh_alloc_block(data, block);
- for(i = 0; i < data->totlayer; ++i) {
+ for (i = 0; i < data->totlayer; ++i) {
int offset = data->layers[i].offset;
typeInfo = layerType_getInfo(data->layers[i].type);
- if(typeInfo->set_default)
+ if (typeInfo->set_default)
typeInfo->set_default((char*)*block + offset, 1);
else memset((char*)*block + offset, 0, typeInfo->size);
}
@@ -2473,20 +2485,20 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
/* copies a layer at a time */
dest_i = 0;
- for(src_i = 0; src_i < source->totlayer; ++src_i) {
+ for (src_i = 0; src_i < source->totlayer; ++src_i) {
/* find the first dest layer with type >= the source type
* (this should work because layers are ordered by type)
*/
- while(dest_i < dest->totlayer
+ while (dest_i < dest->totlayer
&& dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
- if(dest_i >= dest->totlayer) return;
+ if (dest_i >= dest->totlayer) return;
/* if we found a matching layer, copy the data */
- if(dest->layers[dest_i].type == source->layers[src_i].type) {
+ if (dest->layers[dest_i].type == source->layers[src_i].type) {
int offset = dest->layers[dest_i].offset;
char *src_data = source->layers[src_i].data;
char *dest_data = (char*)*dest_block + offset;
@@ -2494,7 +2506,7 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
typeInfo = layerType_getInfo(dest->layers[dest_i].type);
src_offset = src_index * typeInfo->size;
- if(typeInfo->copy)
+ if (typeInfo->copy)
typeInfo->copy(src_data + src_offset, dest_data, 1);
else
memcpy(dest_data, src_data + src_offset, typeInfo->size);
@@ -2516,20 +2528,20 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
/* copies a layer at a time */
dest_i = 0;
- for(src_i = 0; src_i < source->totlayer; ++src_i) {
+ for (src_i = 0; src_i < source->totlayer; ++src_i) {
/* find the first dest layer with type >= the source type
* (this should work because layers are ordered by type)
*/
- while(dest_i < dest->totlayer
+ while (dest_i < dest->totlayer
&& dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
- if(dest_i >= dest->totlayer) return;
+ if (dest_i >= dest->totlayer) return;
/* if we found a matching layer, copy the data */
- if(dest->layers[dest_i].type == source->layers[src_i].type) {
+ if (dest->layers[dest_i].type == source->layers[src_i].type) {
int offset = source->layers[src_i].offset;
char *src_data = (char*)src_block + offset;
char *dest_data = dest->layers[dest_i].data;
@@ -2537,7 +2549,7 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
typeInfo = layerType_getInfo(dest->layers[dest_i].type);
dest_offset = dest_index * typeInfo->size;
- if(typeInfo->copy)
+ if (typeInfo->copy)
typeInfo->copy(src_data, dest_data + dest_offset, 1);
else
memcpy(dest_data + dest_offset, src_data, typeInfo->size);
@@ -2574,7 +2586,7 @@ const char *CustomData_layertype_name(int type)
static int CustomData_is_property_layer(int type)
{
- if((type == CD_PROP_FLT) || (type == CD_PROP_INT) || (type == CD_PROP_STR))
+ if ((type == CD_PROP_FLT) || (type == CD_PROP_INT) || (type == CD_PROP_STR))
return 1;
return 0;
}
@@ -2583,17 +2595,17 @@ static int cd_layer_find_dupe(CustomData *data, const char *name, int type, int
{
int i;
/* see if there is a duplicate */
- for(i=0; i<data->totlayer; i++) {
- if(i != index) {
+ for (i=0; i<data->totlayer; i++) {
+ if (i != index) {
CustomDataLayer *layer= &data->layers[i];
- if(CustomData_is_property_layer(type)) {
- if(CustomData_is_property_layer(layer->type) && strcmp(layer->name, name)==0) {
+ if (CustomData_is_property_layer(type)) {
+ if (CustomData_is_property_layer(layer->type) && strcmp(layer->name, name)==0) {
return 1;
}
}
- else{
- if(i!=index && layer->type==type && strcmp(layer->name, name)==0) {
+ else {
+ if (i!=index && layer->type==type && strcmp(layer->name, name)==0) {
return 1;
}
}
@@ -2630,10 +2642,10 @@ void CustomData_validate_layer_name(const CustomData *data, int type, char *name
int index = -1;
/* if a layer name was given, try to find that layer */
- if(name[0])
+ if (name[0])
index = CustomData_get_named_layer_index(data, type, name);
- if(index < 0) {
+ if (index < 0) {
/* either no layer was specified, or the layer we want has been
* deleted, so assign the active layer to name
*/
@@ -2684,13 +2696,13 @@ void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask
const LayerTypeInfo *typeInfo;
int i;
- for(i=0; i<data->totlayer; i++) {
+ for (i=0; i<data->totlayer; i++) {
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
- if(!(mask & CD_TYPE_AS_MASK(layer->type)));
- else if((layer->flag & CD_FLAG_EXTERNAL) && (layer->flag & CD_FLAG_IN_MEMORY)) {
- if(typeInfo->free)
+ if (!(mask & CD_TYPE_AS_MASK(layer->type)));
+ else if ((layer->flag & CD_FLAG_EXTERNAL) && (layer->flag & CD_FLAG_IN_MEMORY)) {
+ if (typeInfo->free)
typeInfo->free(layer->data, totelem, typeInfo->size);
layer->flag &= ~CD_FLAG_IN_MEMORY;
}
@@ -2707,42 +2719,42 @@ void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int
const LayerTypeInfo *typeInfo;
int i, update = 0;
- if(!external)
+ if (!external)
return;
- for(i=0; i<data->totlayer; i++) {
+ for (i=0; i<data->totlayer; i++) {
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
- if(!(mask & CD_TYPE_AS_MASK(layer->type)));
- else if(layer->flag & CD_FLAG_IN_MEMORY);
- else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read)
+ if (!(mask & CD_TYPE_AS_MASK(layer->type)));
+ else if (layer->flag & CD_FLAG_IN_MEMORY);
+ else if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read)
update= 1;
}
- if(!update)
+ if (!update)
return;
customdata_external_filename(filename, id, external);
cdf= cdf_create(CDF_TYPE_MESH);
- if(!cdf_read_open(cdf, filename)) {
+ if (!cdf_read_open(cdf, filename)) {
fprintf(stderr, "Failed to read %s layer from %s.\n", layerType_getName(layer->type), filename);
return;
}
- for(i=0; i<data->totlayer; i++) {
+ for (i=0; i<data->totlayer; i++) {
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
- if(!(mask & CD_TYPE_AS_MASK(layer->type)));
- else if(layer->flag & CD_FLAG_IN_MEMORY);
- else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read) {
+ if (!(mask & CD_TYPE_AS_MASK(layer->type)));
+ else if (layer->flag & CD_FLAG_IN_MEMORY);
+ else if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read) {
blay= cdf_layer_find(cdf, layer->type, layer->name);
- if(blay) {
- if(cdf_read_layer(cdf, blay)) {
- if(typeInfo->read(cdf, layer->data, totelem));
+ if (blay) {
+ if (cdf_read_layer(cdf, blay)) {
+ if (typeInfo->read(cdf, layer->data, totelem));
else break;
layer->flag |= CD_FLAG_IN_MEMORY;
}
@@ -2766,20 +2778,20 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
int i, update = 0;
char filename[FILE_MAX];
- if(!external)
+ if (!external)
return;
/* test if there is anything to write */
- for(i=0; i<data->totlayer; i++) {
+ for (i=0; i<data->totlayer; i++) {
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
- if(!(mask & CD_TYPE_AS_MASK(layer->type)));
- else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write)
+ if (!(mask & CD_TYPE_AS_MASK(layer->type)));
+ else if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write)
update= 1;
}
- if(!update)
+ if (!update)
return;
/* make sure data is read before we try to write */
@@ -2788,12 +2800,12 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
cdf= cdf_create(CDF_TYPE_MESH);
- for(i=0; i<data->totlayer; i++) {
+ for (i=0; i<data->totlayer; i++) {
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
- if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->filesize) {
- if(layer->flag & CD_FLAG_IN_MEMORY) {
+ if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->filesize) {
+ if (layer->flag & CD_FLAG_IN_MEMORY) {
cdf_layer_add(cdf, layer->type, layer->name,
typeInfo->filesize(cdf, layer->data, totelem));
}
@@ -2804,20 +2816,20 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
}
}
- if(!cdf_write_open(cdf, filename)) {
+ if (!cdf_write_open(cdf, filename)) {
fprintf(stderr, "Failed to open %s for writing.\n", filename);
return;
}
- for(i=0; i<data->totlayer; i++) {
+ for (i=0; i<data->totlayer; i++) {
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
- if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write) {
+ if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write) {
blay= cdf_layer_find(cdf, layer->type, layer->name);
- if(cdf_write_layer(cdf, blay)) {
- if(typeInfo->write(cdf, layer->data, totelem));
+ if (cdf_write_layer(cdf, blay)) {
+ if (typeInfo->write(cdf, layer->data, totelem));
else break;
}
else
@@ -2825,19 +2837,19 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
}
}
- if(i != data->totlayer) {
+ if (i != data->totlayer) {
fprintf(stderr, "Failed to write data to %s.\n", filename);
cdf_free(cdf);
return;
}
- for(i=0; i<data->totlayer; i++) {
+ for (i=0; i<data->totlayer; i++) {
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
- if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write) {
- if(free) {
- if(typeInfo->free)
+ if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write) {
+ if (free) {
+ if (typeInfo->free)
typeInfo->free(layer->data, totelem, typeInfo->size);
layer->flag &= ~CD_FLAG_IN_MEMORY;
}
@@ -2855,14 +2867,14 @@ void CustomData_external_add(CustomData *data, ID *UNUSED(id), int type, int UNU
int layer_index;
layer_index = CustomData_get_active_layer_index(data, type);
- if(layer_index < 0) return;
+ if (layer_index < 0) return;
layer = &data->layers[layer_index];
- if(layer->flag & CD_FLAG_EXTERNAL)
+ if (layer->flag & CD_FLAG_EXTERNAL)
return;
- if(!external) {
+ if (!external) {
external= MEM_callocN(sizeof(CustomDataExternal), "CustomDataExternal");
data->external= external;
}
@@ -2879,26 +2891,26 @@ void CustomData_external_remove(CustomData *data, ID *id, int type, int totelem)
int layer_index; // i, remove_file;
layer_index = CustomData_get_active_layer_index(data, type);
- if(layer_index < 0) return;
+ if (layer_index < 0) return;
layer = &data->layers[layer_index];
- if(!external)
+ if (!external)
return;
- if(layer->flag & CD_FLAG_EXTERNAL) {
- if(!(layer->flag & CD_FLAG_IN_MEMORY))
+ if (layer->flag & CD_FLAG_EXTERNAL) {
+ if (!(layer->flag & CD_FLAG_IN_MEMORY))
CustomData_external_read(data, id, CD_TYPE_AS_MASK(layer->type), totelem);
layer->flag &= ~CD_FLAG_EXTERNAL;
#if 0
remove_file= 1;
- for(i=0; i<data->totlayer; i++)
- if(data->layers[i].flag & CD_FLAG_EXTERNAL)
+ for (i=0; i<data->totlayer; i++)
+ if (data->layers[i].flag & CD_FLAG_EXTERNAL)
remove_file= 0;
- if(remove_file) {
+ if (remove_file) {
customdata_external_filename(filename, id, external);
cdf_remove(filename);
CustomData_external_free(data);
@@ -2913,7 +2925,7 @@ int CustomData_external_test(CustomData *data, int type)
int layer_index;
layer_index = CustomData_get_active_layer_index(data, type);
- if(layer_index < 0) return 0;
+ if (layer_index < 0) return 0;
layer = &data->layers[layer_index];
return (layer->flag & CD_FLAG_EXTERNAL);
@@ -2925,7 +2937,7 @@ void CustomData_external_remove_object(CustomData *data, ID *id)
CustomDataExternal *external= data->external;
char filename[FILE_MAX];
- if(!external)
+ if (!external)
return;
customdata_external_filename(filename, id, external);
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index 4386132fc18..6d0dabede47 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -103,7 +103,7 @@ struct CDataFile {
static int cdf_endian(void)
{
- if(ENDIAN_ORDER == L_ENDIAN)
+ if (ENDIAN_ORDER == L_ENDIAN)
return CDF_ENDIAN_LITTLE;
else
return CDF_ENDIAN_BIG;
@@ -112,7 +112,7 @@ static int cdf_endian(void)
#if 0
static int cdf_data_type_size(int datatype)
{
- if(datatype == CDF_DATA_FLOAT)
+ if (datatype == CDF_DATA_FLOAT)
return sizeof(float);
return 0;
@@ -133,7 +133,7 @@ void cdf_free(CDataFile *cdf)
cdf_read_close(cdf);
cdf_write_close(cdf);
- if(cdf->layer)
+ if (cdf->layer)
MEM_freeN(cdf->layer);
MEM_freeN(cdf);
@@ -153,38 +153,38 @@ static int cdf_read_header(CDataFile *cdf)
header= &cdf->header;
- if(!fread(header, sizeof(CDataFileHeader), 1, cdf->readf))
+ if (!fread(header, sizeof(CDataFileHeader), 1, cdf->readf))
return 0;
- if(memcmp(header->ID, "BCDF", sizeof(header->ID)) != 0)
+ if (memcmp(header->ID, "BCDF", sizeof(header->ID)) != 0)
return 0;
- if(header->version > CDF_VERSION)
+ if (header->version > CDF_VERSION)
return 0;
cdf->switchendian= header->endian != cdf_endian();
header->endian= cdf_endian();
- if(cdf->switchendian) {
+ if (cdf->switchendian) {
SWITCH_INT(header->type);
SWITCH_INT(header->totlayer);
SWITCH_INT(header->structbytes);
}
- if(!ELEM(header->type, CDF_TYPE_IMAGE, CDF_TYPE_MESH))
+ if (!ELEM(header->type, CDF_TYPE_IMAGE, CDF_TYPE_MESH))
return 0;
offset += header->structbytes;
header->structbytes= sizeof(CDataFileHeader);
- if(fseek(f, offset, SEEK_SET) != 0)
+ if (fseek(f, offset, SEEK_SET) != 0)
return 0;
- if(header->type == CDF_TYPE_IMAGE) {
+ if (header->type == CDF_TYPE_IMAGE) {
image= &cdf->btype.image;
- if(!fread(image, sizeof(CDataFileImageHeader), 1, f))
+ if (!fread(image, sizeof(CDataFileImageHeader), 1, f))
return 0;
- if(cdf->switchendian) {
+ if (cdf->switchendian) {
SWITCH_INT(image->width);
SWITCH_INT(image->height);
SWITCH_INT(image->tile_size);
@@ -194,44 +194,44 @@ static int cdf_read_header(CDataFile *cdf)
offset += image->structbytes;
image->structbytes= sizeof(CDataFileImageHeader);
}
- else if(header->type == CDF_TYPE_MESH) {
+ else if (header->type == CDF_TYPE_MESH) {
mesh= &cdf->btype.mesh;
- if(!fread(mesh, sizeof(CDataFileMeshHeader), 1, f))
+ if (!fread(mesh, sizeof(CDataFileMeshHeader), 1, f))
return 0;
- if(cdf->switchendian)
+ if (cdf->switchendian)
SWITCH_INT(mesh->structbytes);
offset += mesh->structbytes;
mesh->structbytes= sizeof(CDataFileMeshHeader);
}
- if(fseek(f, offset, SEEK_SET) != 0)
+ if (fseek(f, offset, SEEK_SET) != 0)
return 0;
cdf->layer= MEM_callocN(sizeof(CDataFileLayer)*header->totlayer, "CDataFileLayer");
cdf->totlayer= header->totlayer;
- for(a=0; a<header->totlayer; a++) {
+ for (a=0; a<header->totlayer; a++) {
layer= &cdf->layer[a];
- if(!fread(layer, sizeof(CDataFileLayer), 1, f))
+ if (!fread(layer, sizeof(CDataFileLayer), 1, f))
return 0;
- if(cdf->switchendian) {
+ if (cdf->switchendian) {
SWITCH_INT(layer->type);
SWITCH_INT(layer->datatype);
SWITCH_INT64(layer->datasize);
SWITCH_INT(layer->structbytes);
}
- if(layer->datatype != CDF_DATA_FLOAT)
+ if (layer->datatype != CDF_DATA_FLOAT)
return 0;
offset += layer->structbytes;
layer->structbytes= sizeof(CDataFileLayer);
- if(fseek(f, offset, SEEK_SET) != 0)
+ if (fseek(f, offset, SEEK_SET) != 0)
return 0;
}
@@ -251,24 +251,24 @@ static int cdf_write_header(CDataFile *cdf)
header= &cdf->header;
- if(!fwrite(header, sizeof(CDataFileHeader), 1, f))
+ if (!fwrite(header, sizeof(CDataFileHeader), 1, f))
return 0;
- if(header->type == CDF_TYPE_IMAGE) {
+ if (header->type == CDF_TYPE_IMAGE) {
image= &cdf->btype.image;
- if(!fwrite(image, sizeof(CDataFileImageHeader), 1, f))
+ if (!fwrite(image, sizeof(CDataFileImageHeader), 1, f))
return 0;
}
- else if(header->type == CDF_TYPE_MESH) {
+ else if (header->type == CDF_TYPE_MESH) {
mesh= &cdf->btype.mesh;
- if(!fwrite(mesh, sizeof(CDataFileMeshHeader), 1, f))
+ if (!fwrite(mesh, sizeof(CDataFileMeshHeader), 1, f))
return 0;
}
- for(a=0; a<header->totlayer; a++) {
+ for (a=0; a<header->totlayer; a++) {
layer= &cdf->layer[a];
- if(!fwrite(layer, sizeof(CDataFileLayer), 1, f))
+ if (!fwrite(layer, sizeof(CDataFileLayer), 1, f))
return 0;
}
@@ -279,18 +279,18 @@ int cdf_read_open(CDataFile *cdf, const char *filename)
{
FILE *f;
- f= fopen(filename, "rb");
- if(!f)
+ f= BLI_fopen(filename, "rb");
+ if (!f)
return 0;
cdf->readf= f;
- if(!cdf_read_header(cdf)) {
+ if (!cdf_read_header(cdf)) {
cdf_read_close(cdf);
return 0;
}
- if(cdf->header.type != cdf->type) {
+ if (cdf->header.type != cdf->type) {
cdf_read_close(cdf);
return 0;
}
@@ -305,8 +305,8 @@ int cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay)
/* seek to right location in file */
offset= cdf->dataoffset;
- for(a=0; a<cdf->totlayer; a++) {
- if(&cdf->layer[a] == blay)
+ for (a=0; a<cdf->totlayer; a++) {
+ if (&cdf->layer[a] == blay)
break;
else
offset += cdf->layer[a].datasize;
@@ -321,15 +321,16 @@ int cdf_read_data(CDataFile *cdf, unsigned int size, void *data)
unsigned int a;
/* read data */
- if(!fread(data, size, 1, cdf->readf))
+ if (!fread(data, size, 1, cdf->readf))
return 0;
/* switch endian if necessary */
- if(cdf->switchendian) {
+ if (cdf->switchendian) {
fdata= data;
- for(a=0; a<size/sizeof(float); a++)
- SWITCH_INT(fdata[a])
+ for (a=0; a<size/sizeof(float); a++) {
+ SWITCH_INT(fdata[a]);
+ }
}
return 1;
@@ -337,7 +338,7 @@ int cdf_read_data(CDataFile *cdf, unsigned int size, void *data)
void cdf_read_close(CDataFile *cdf)
{
- if(cdf->readf) {
+ if (cdf->readf) {
fclose(cdf->readf);
cdf->readf= NULL;
}
@@ -350,8 +351,8 @@ int cdf_write_open(CDataFile *cdf, const char *filename)
CDataFileMeshHeader *mesh;
FILE *f;
- f= fopen(filename, "wb");
- if(!f)
+ f= BLI_fopen(filename, "wb");
+ if (!f)
return 0;
cdf->writef= f;
@@ -368,13 +369,13 @@ int cdf_write_open(CDataFile *cdf, const char *filename)
header->type= cdf->type;
header->totlayer= cdf->totlayer;
- if(cdf->type == CDF_TYPE_IMAGE) {
+ if (cdf->type == CDF_TYPE_IMAGE) {
/* fill image header */
image= &cdf->btype.image;
image->structbytes= sizeof(CDataFileImageHeader);
image->tile_size= CDF_TILE_SIZE;
}
- else if(cdf->type == CDF_TYPE_MESH) {
+ else if (cdf->type == CDF_TYPE_MESH) {
/* fill mesh header */
mesh= &cdf->btype.mesh;
mesh->structbytes= sizeof(CDataFileMeshHeader);
@@ -393,7 +394,7 @@ int cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay))
int cdf_write_data(CDataFile *cdf, unsigned int size, void *data)
{
/* write data */
- if(!fwrite(data, size, 1, cdf->writef))
+ if (!fwrite(data, size, 1, cdf->writef))
return 0;
return 1;
@@ -401,7 +402,7 @@ int cdf_write_data(CDataFile *cdf, unsigned int size, void *data)
void cdf_write_close(CDataFile *cdf)
{
- if(cdf->writef) {
+ if (cdf->writef) {
fclose(cdf->writef);
cdf->writef= NULL;
}
@@ -419,10 +420,10 @@ CDataFileLayer *cdf_layer_find(CDataFile *cdf, int type, const char *name)
CDataFileLayer *layer;
int a;
- for(a=0; a<cdf->totlayer; a++) {
+ for (a=0; a<cdf->totlayer; a++) {
layer= &cdf->layer[a];
- if(layer->type == type && strcmp(layer->name, name) == 0)
+ if (layer->type == type && strcmp(layer->name, name) == 0)
return layer;
}
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 6158d2f8608..186a4d41403 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -49,10 +49,10 @@ void defgroup_copy_list(ListBase *outbase, ListBase *inbase)
{
bDeformGroup *defgroup, *defgroupn;
- outbase->first= outbase->last= NULL;
+ outbase->first = outbase->last = NULL;
- for (defgroup = inbase->first; defgroup; defgroup=defgroup->next) {
- defgroupn= defgroup_duplicate(defgroup);
+ for (defgroup = inbase->first; defgroup; defgroup = defgroup->next) {
+ defgroupn = defgroup_duplicate(defgroup);
BLI_addtail(outbase, defgroupn);
}
}
@@ -64,12 +64,12 @@ bDeformGroup *defgroup_duplicate(bDeformGroup *ingroup)
if (!ingroup)
return NULL;
- outgroup=MEM_callocN(sizeof(bDeformGroup), "copy deformGroup");
+ outgroup = MEM_callocN(sizeof(bDeformGroup), "copy deformGroup");
/* For now, just copy everything over. */
- memcpy (outgroup, ingroup, sizeof(bDeformGroup));
+ memcpy(outgroup, ingroup, sizeof(bDeformGroup));
- outgroup->next=outgroup->prev=NULL;
+ outgroup->next = outgroup->prev = NULL;
return outgroup;
}
@@ -86,9 +86,9 @@ void defvert_copy(MDeformVert *dvert_dst, const MDeformVert *dvert_src)
MEM_freeN(dvert_dst->dw);
if (dvert_src->totweight)
- dvert_dst->dw= MEM_dupallocN(dvert_src->dw);
+ dvert_dst->dw = MEM_dupallocN(dvert_src->dw);
else
- dvert_dst->dw= NULL;
+ dvert_dst->dw = NULL;
dvert_dst->totweight = dvert_src->totweight;
}
@@ -102,19 +102,19 @@ void defvert_copy_index(MDeformVert *dvert_dst, const MDeformVert *dvert_src, co
{
MDeformWeight *dw_src, *dw_dst;
- dw_src= defvert_find_index(dvert_src, defgroup);
+ dw_src = defvert_find_index(dvert_src, defgroup);
if (dw_src) {
/* source is valid, verify destination */
- dw_dst= defvert_verify_index(dvert_dst, defgroup);
- dw_dst->weight= dw_src->weight;
+ dw_dst = defvert_verify_index(dvert_dst, defgroup);
+ dw_dst->weight = dw_src->weight;
}
else {
/* source was NULL, assign zero, could also remove */
- dw_dst= defvert_find_index(dvert_dst, defgroup);
+ dw_dst = defvert_find_index(dvert_dst, defgroup);
if (dw_dst) {
- dw_dst->weight= 0.0f;
+ dw_dst->weight = 0.0f;
}
}
}
@@ -127,13 +127,13 @@ void defvert_sync(MDeformVert *dvert_dst, const MDeformVert *dvert_src, int use_
if (dvert_src->totweight && dvert_dst->totweight) {
int i;
MDeformWeight *dw_src;
- for (i=0, dw_src=dvert_src->dw; i < dvert_src->totweight; i++, dw_src++) {
+ for (i = 0, dw_src = dvert_src->dw; i < dvert_src->totweight; i++, dw_src++) {
MDeformWeight *dw_dst;
- if (use_verify) dw_dst= defvert_verify_index(dvert_dst, dw_src->def_nr);
- else dw_dst= defvert_find_index(dvert_dst, dw_src->def_nr);
+ if (use_verify) dw_dst = defvert_verify_index(dvert_dst, dw_src->def_nr);
+ else dw_dst = defvert_find_index(dvert_dst, dw_src->def_nr);
if (dw_dst) {
- dw_dst->weight= dw_src->weight;
+ dw_dst->weight = dw_src->weight;
}
}
}
@@ -146,14 +146,14 @@ void defvert_sync_mapped(MDeformVert *dvert_dst, const MDeformVert *dvert_src,
if (dvert_src->totweight && dvert_dst->totweight) {
int i;
MDeformWeight *dw_src;
- for (i=0, dw_src=dvert_src->dw; i < dvert_src->totweight; i++, dw_src++) {
+ for (i = 0, dw_src = dvert_src->dw; i < dvert_src->totweight; i++, dw_src++) {
if (dw_src->def_nr < flip_map_len) {
MDeformWeight *dw_dst;
- if (use_verify) dw_dst= defvert_verify_index(dvert_dst, flip_map[dw_src->def_nr]);
- else dw_dst= defvert_find_index(dvert_dst, flip_map[dw_src->def_nr]);
+ if (use_verify) dw_dst = defvert_verify_index(dvert_dst, flip_map[dw_src->def_nr]);
+ else dw_dst = defvert_find_index(dvert_dst, flip_map[dw_src->def_nr]);
if (dw_dst) {
- dw_dst->weight= dw_src->weight;
+ dw_dst->weight = dw_src->weight;
}
}
}
@@ -163,11 +163,11 @@ void defvert_sync_mapped(MDeformVert *dvert_dst, const MDeformVert *dvert_src,
/* be sure all flip_map values are valid */
void defvert_remap(MDeformVert *dvert, int *map, const int map_len)
{
- MDeformWeight *dw= dvert->dw;
+ MDeformWeight *dw = dvert->dw;
unsigned int i;
- for (i= dvert->totweight; i != 0; i--, dw++) {
+ for (i = dvert->totweight; i != 0; i--, dw++) {
if (dw->def_nr < map_len) {
- dw->def_nr= map[dw->def_nr];
+ dw->def_nr = map[dw->def_nr];
/* just in case */
BLI_assert(dw->def_nr >= 0);
@@ -180,21 +180,21 @@ void defvert_normalize(MDeformVert *dvert)
if (dvert->totweight <= 0) {
/* nothing */
}
- else if (dvert->totweight==1) {
- dvert->dw[0].weight= 1.0f;
+ else if (dvert->totweight == 1) {
+ dvert->dw[0].weight = 1.0f;
}
else {
MDeformWeight *dw;
unsigned int i;
- float tot_weight= 0.0f;
+ float tot_weight = 0.0f;
- for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
tot_weight += dw->weight;
}
if (tot_weight > 0.0f) {
- float scalar= 1.0f / tot_weight;
- for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+ float scalar = 1.0f / tot_weight;
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
dw->weight *= scalar;
/* in case of division errors with very low weights */
@@ -209,22 +209,22 @@ void defvert_normalize_lock(MDeformVert *dvert, const int def_nr_lock)
if (dvert->totweight <= 0) {
/* nothing */
}
- else if (dvert->totweight==1) {
- dvert->dw[0].weight= 1.0f;
+ else if (dvert->totweight == 1) {
+ dvert->dw[0].weight = 1.0f;
}
else {
MDeformWeight *dw_lock = NULL;
MDeformWeight *dw;
unsigned int i;
- float tot_weight= 0.0f;
- float lock_iweight= 1.0f;
+ float tot_weight = 0.0f;
+ float lock_iweight = 1.0f;
- for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
- if(dw->def_nr != def_nr_lock) {
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
+ if (dw->def_nr != def_nr_lock) {
tot_weight += dw->weight;
}
else {
- dw_lock= dw;
+ dw_lock = dw;
lock_iweight = (1.0f - dw_lock->weight);
CLAMP(lock_iweight, 0.0f, 1.0f);
}
@@ -233,9 +233,9 @@ void defvert_normalize_lock(MDeformVert *dvert, const int def_nr_lock)
if (tot_weight > 0.0f) {
/* paranoid, should be 1.0 but in case of float error clamp anyway */
- float scalar= (1.0f / tot_weight) * lock_iweight;
- for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
- if(dw != dw_lock) {
+ float scalar = (1.0f / tot_weight) * lock_iweight;
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
+ if (dw != dw_lock) {
dw->weight *= scalar;
/* in case of division errors with very low weights */
@@ -251,15 +251,39 @@ void defvert_flip(MDeformVert *dvert, const int *flip_map, const int flip_map_le
MDeformWeight *dw;
int i;
- for (dw= dvert->dw, i=0; i<dvert->totweight; dw++, i++) {
+ for (dw = dvert->dw, i = 0; i<dvert->totweight; dw++, i++) {
if (dw->def_nr < flip_map_len) {
if (flip_map[dw->def_nr] >= 0) {
- dw->def_nr= flip_map[dw->def_nr];
+ dw->def_nr = flip_map[dw->def_nr];
}
}
}
}
+void defvert_flip_merged(MDeformVert *dvert, const int *flip_map, const int flip_map_len)
+{
+ MDeformWeight *dw, *dw_cpy;
+ float weight;
+ int i, totweight = dvert->totweight;
+
+ /* copy weights */
+ for (dw = dvert->dw, i = 0; i < totweight; dw++, i++) {
+ if (dw->def_nr < flip_map_len) {
+ if (flip_map[dw->def_nr] >= 0) {
+ /* error checkers complain of this but we'll never get NULL return */
+ dw_cpy = defvert_verify_index(dvert, flip_map[dw->def_nr]);
+ dw = &dvert->dw[i]; /* in case array got realloced */
+
+ /* distribute weights: if only one of the vertex groups was
+ * assigned this will halve the weights, otherwise it gets
+ * evened out. this keeps it proportional to other groups */
+ weight = 0.5f * (dw_cpy->weight + dw->weight);
+ dw_cpy->weight = weight;
+ dw->weight = weight;
+ }
+ }
+ }
+}
bDeformGroup *defgroup_find_name(Object *ob, const char *name)
{
@@ -268,7 +292,7 @@ bDeformGroup *defgroup_find_name(Object *ob, const char *name)
*/
bDeformGroup *curdef;
- for (curdef = ob->defbase.first; curdef; curdef=curdef->next) {
+ for (curdef = ob->defbase.first; curdef; curdef = curdef->next) {
if (!strcmp(curdef->name, name)) {
return curdef;
}
@@ -287,7 +311,7 @@ int defgroup_name_index(Object *ob, const char *name)
int def_nr;
if (name && name[0] != '\0') {
- for (curdef=ob->defbase.first, def_nr=0; curdef; curdef=curdef->next, def_nr++) {
+ for (curdef = ob->defbase.first, def_nr = 0; curdef; curdef = curdef->next, def_nr++) {
if (!strcmp(curdef->name, name))
return def_nr;
}
@@ -299,33 +323,33 @@ int defgroup_name_index(Object *ob, const char *name)
/* note, must be freed */
int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default)
{
- int defbase_tot= *flip_map_len= BLI_countlist(&ob->defbase);
+ int defbase_tot = *flip_map_len = BLI_countlist(&ob->defbase);
- if (defbase_tot==0) {
+ if (defbase_tot == 0) {
return NULL;
}
else {
bDeformGroup *dg;
char name[sizeof(dg->name)];
- int i, flip_num, *map= MEM_mallocN(defbase_tot * sizeof(int), __func__);
+ int i, flip_num, *map = MEM_mallocN(defbase_tot * sizeof(int), __func__);
- for (i=0; i < defbase_tot; i++) {
- map[i]= -1;
+ for (i = 0; i < defbase_tot; i++) {
+ map[i] = -1;
}
- for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) {
+ for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) {
if (map[i] == -1) { /* may be calculated previously */
/* in case no valid value is found, use this */
if (use_default)
- map[i]= i;
+ map[i] = i;
flip_side_name(name, dg->name, FALSE);
if (strcmp(name, dg->name)) {
- flip_num= defgroup_name_index(ob, name);
+ flip_num = defgroup_name_index(ob, name);
if (flip_num >= 0) {
- map[i]= flip_num;
- map[flip_num]= i; /* save an extra lookup */
+ map[i] = flip_num;
+ map[flip_num] = i; /* save an extra lookup */
}
}
}
@@ -337,30 +361,29 @@ int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default)
/* note, must be freed */
int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, int defgroup)
{
- int defbase_tot= *flip_map_len= BLI_countlist(&ob->defbase);
+ int defbase_tot = *flip_map_len = BLI_countlist(&ob->defbase);
- if (defbase_tot==0) {
+ if (defbase_tot == 0) {
return NULL;
}
else {
bDeformGroup *dg;
char name[sizeof(dg->name)];
- int i, flip_num, *map= MEM_mallocN(defbase_tot * sizeof(int), __func__);
+ int i, flip_num, *map = MEM_mallocN(defbase_tot * sizeof(int), __func__);
- for (i=0; i < defbase_tot; i++) {
- if (use_default) map[i]= i;
- else map[i]= -1;
+ for (i = 0; i < defbase_tot; i++) {
+ map[i] = use_default ? i : -1;
}
- dg= BLI_findlink(&ob->defbase, defgroup);
+ dg = BLI_findlink(&ob->defbase, defgroup);
flip_side_name(name, dg->name, FALSE);
if (strcmp(name, dg->name)) {
- flip_num= defgroup_name_index(ob, name);
+ flip_num = defgroup_name_index(ob, name);
if (flip_num >= 0) {
- map[defgroup]= flip_num;
- map[flip_num]= defgroup;
+ map[defgroup] = flip_num;
+ map[flip_num] = defgroup;
}
}
@@ -370,7 +393,7 @@ int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, in
int defgroup_flip_index(Object *ob, int index, int use_default)
{
- bDeformGroup *dg= BLI_findlink(&ob->defbase, index);
+ bDeformGroup *dg = BLI_findlink(&ob->defbase, index);
int flip_index = -1;
if (dg) {
@@ -378,18 +401,18 @@ int defgroup_flip_index(Object *ob, int index, int use_default)
flip_side_name(name, dg->name, 0);
if (strcmp(name, dg->name))
- flip_index= defgroup_name_index(ob, name);
+ flip_index = defgroup_name_index(ob, name);
}
- return (flip_index==-1 && use_default) ? index : flip_index;
+ return (flip_index == -1 && use_default) ? index : flip_index;
}
static int defgroup_find_name_dupe(const char *name, bDeformGroup *dg, Object *ob)
{
bDeformGroup *curdef;
- for (curdef = ob->defbase.first; curdef; curdef=curdef->next) {
- if (dg!=curdef) {
+ for (curdef = ob->defbase.first; curdef; curdef = curdef->next) {
+ if (dg != curdef) {
if (!strcmp(curdef->name, name)) {
return 1;
}
@@ -401,147 +424,149 @@ static int defgroup_find_name_dupe(const char *name, bDeformGroup *dg, Object *o
static int defgroup_unique_check(void *arg, const char *name)
{
- struct {Object *ob; void *dg;} *data= arg;
+ struct {Object *ob; void *dg;} *data = arg;
return defgroup_find_name_dupe(name, data->dg, data->ob);
}
void defgroup_unique_name(bDeformGroup *dg, Object *ob)
{
struct {Object *ob; void *dg;} data;
- data.ob= ob;
- data.dg= dg;
+ data.ob = ob;
+ data.dg = dg;
BLI_uniquename_cb(defgroup_unique_check, &data, "Group", '.', dg->name, sizeof(dg->name));
}
+BLI_INLINE int is_char_sep(const char c)
+{
+ return ELEM4(c, '.', ' ', '-', '_');
+}
+
/* finds the best possible flipped name. For renaming; check for unique names afterwards */
/* if strip_number: removes number extensions
- * note: dont use sizeof() for 'name' or 'from_name' */
+ * note: don't use sizeof() for 'name' or 'from_name' */
void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_NAME], int strip_number)
{
int len;
- char prefix[MAX_VGROUP_NAME]= ""; /* The part before the facing */
- char suffix[MAX_VGROUP_NAME]= ""; /* The part after the facing */
- char replace[MAX_VGROUP_NAME]= ""; /* The replacement string */
- char number[MAX_VGROUP_NAME]= ""; /* The number extension string */
- char *index=NULL;
+ char prefix[MAX_VGROUP_NAME] = ""; /* The part before the facing */
+ char suffix[MAX_VGROUP_NAME] = ""; /* The part after the facing */
+ char replace[MAX_VGROUP_NAME] = ""; /* The replacement string */
+ char number[MAX_VGROUP_NAME] = ""; /* The number extension string */
+ char *index = NULL;
/* always copy the name, since this can be called with an uninitialized string */
BLI_strncpy(name, from_name, MAX_VGROUP_NAME);
- len= BLI_strnlen(from_name, MAX_VGROUP_NAME);
+ len = BLI_strnlen(from_name, MAX_VGROUP_NAME);
if (len < 3) {
/* we don't do names like .R or .L */
return;
}
/* We first check the case with a .### extension, let's find the last period */
- if (isdigit(name[len-1])) {
- index= strrchr(name, '.'); // last occurrence
+ if (isdigit(name[len - 1])) {
+ index = strrchr(name, '.'); // last occurrence
if (index && isdigit(index[1]) ) { // doesnt handle case bone.1abc2 correct..., whatever!
- if (strip_number==0)
+ if (strip_number == 0) {
BLI_strncpy(number, index, sizeof(number));
- *index= 0;
- len= BLI_strnlen(name, MAX_VGROUP_NAME);
+ }
+ *index = 0;
+ len = BLI_strnlen(name, MAX_VGROUP_NAME);
}
}
BLI_strncpy(prefix, name, sizeof(prefix));
-#define IS_SEPARATOR(a) ((a)=='.' || (a)==' ' || (a)=='-' || (a)=='_')
-
/* first case; separator . - _ with extensions r R l L */
- if (IS_SEPARATOR(name[len-2]) ) {
- switch(name[len-1]) {
+ if (is_char_sep(name[len - 2]) ) {
+ switch(name[len - 1]) {
case 'l':
- prefix[len-1]= 0;
+ prefix[len - 1] = 0;
strcpy(replace, "r");
break;
case 'r':
- prefix[len-1]= 0;
+ prefix[len - 1] = 0;
strcpy(replace, "l");
break;
case 'L':
- prefix[len-1]= 0;
+ prefix[len - 1] = 0;
strcpy(replace, "R");
break;
case 'R':
- prefix[len-1]= 0;
+ prefix[len - 1] = 0;
strcpy(replace, "L");
break;
}
}
/* case; beginning with r R l L , with separator after it */
- else if (IS_SEPARATOR(name[1]) ) {
+ else if (is_char_sep(name[1]) ) {
switch(name[0]) {
case 'l':
strcpy(replace, "r");
- BLI_strncpy(suffix, name+1, sizeof(suffix));
- prefix[0]= 0;
+ BLI_strncpy(suffix, name + 1, sizeof(suffix));
+ prefix[0] = 0;
break;
case 'r':
strcpy(replace, "l");
- BLI_strncpy(suffix, name+1, sizeof(suffix));
- prefix[0]= 0;
+ BLI_strncpy(suffix, name + 1, sizeof(suffix));
+ prefix[0] = 0;
break;
case 'L':
strcpy(replace, "R");
- BLI_strncpy(suffix, name+1, sizeof(suffix));
- prefix[0]= 0;
+ BLI_strncpy(suffix, name + 1, sizeof(suffix));
+ prefix[0] = 0;
break;
case 'R':
strcpy(replace, "L");
- BLI_strncpy(suffix, name+1, sizeof(suffix));
- prefix[0]= 0;
+ BLI_strncpy(suffix, name + 1, sizeof(suffix));
+ prefix[0] = 0;
break;
}
}
else if (len > 5) {
/* hrms, why test for a separator? lets do the rule 'ultimate left or right' */
index = BLI_strcasestr(prefix, "right");
- if (index==prefix || index==prefix+len-5) {
- if (index[0]=='r')
+ if (index == prefix || index == prefix + len - 5) {
+ if (index[0] == 'r')
strcpy(replace, "left");
else {
- if (index[1]=='I')
+ if (index[1] == 'I')
strcpy(replace, "LEFT");
else
strcpy(replace, "Left");
}
- *index= 0;
- BLI_strncpy(suffix, index+5, sizeof(suffix));
+ *index = 0;
+ BLI_strncpy(suffix, index + 5, sizeof(suffix));
}
else {
index = BLI_strcasestr(prefix, "left");
- if (index==prefix || index==prefix+len-4) {
- if (index[0]=='l')
+ if (index == prefix || index == prefix + len - 4) {
+ if (index[0] == 'l')
strcpy(replace, "right");
else {
- if (index[1]=='E')
+ if (index[1] == 'E')
strcpy(replace, "RIGHT");
else
strcpy(replace, "Right");
}
- *index= 0;
+ *index = 0;
BLI_strncpy(suffix, index + 4, sizeof(suffix));
}
}
}
-#undef IS_SEPARATOR
-
BLI_snprintf (name, MAX_VGROUP_NAME, "%s%s%s%s", prefix, replace, suffix, number);
}
float defvert_find_weight(const struct MDeformVert *dvert, const int defgroup)
{
- MDeformWeight *dw= defvert_find_index(dvert, defgroup);
+ MDeformWeight *dw = defvert_find_index(dvert, defgroup);
return dw ? dw->weight : 0.0f;
}
/* take care with this the rationale is:
- * - if the object has no vertex group. act like vertex group isnt set and return 1.0,
- * - if the vertex group exists but the 'defgroup' isnt found on this vertex, _still_ return 0.0
+ * - if the object has no vertex group. act like vertex group isn't set and return 1.0,
+ * - if the vertex group exists but the 'defgroup' isn't found on this vertex, _still_ return 0.0
*
* This is a bit confusing, just saves some checks from the caller.
*/
@@ -550,7 +575,7 @@ float defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int
if (defgroup == -1 || dvert == NULL)
return 1.0f;
- return defvert_find_weight(dvert+index, defgroup);
+ return defvert_find_weight(dvert + index, defgroup);
}
@@ -560,7 +585,7 @@ MDeformWeight *defvert_find_index(const MDeformVert *dvert, const int defgroup)
MDeformWeight *dw = dvert->dw;
unsigned int i;
- for (i= dvert->totweight; i != 0; i--, dw++) {
+ for (i = dvert->totweight; i != 0; i--, dw++) {
if (dw->def_nr == defgroup) {
return dw;
}
@@ -580,19 +605,19 @@ MDeformWeight *defvert_verify_index(MDeformVert *dvert, const int defgroup)
if (!dvert || defgroup < 0)
return NULL;
- dw_new= defvert_find_index(dvert, defgroup);
+ dw_new = defvert_find_index(dvert, defgroup);
if (dw_new)
return dw_new;
- dw_new= MEM_callocN(sizeof(MDeformWeight)*(dvert->totweight+1), "deformWeight");
+ dw_new = MEM_callocN(sizeof(MDeformWeight) * (dvert->totweight + 1), "deformWeight");
if (dvert->dw) {
- memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*dvert->totweight);
+ memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
MEM_freeN(dvert->dw);
}
- dvert->dw= dw_new;
+ dvert->dw = dw_new;
dw_new += dvert->totweight;
- dw_new->weight= 0.0f;
- dw_new->def_nr= defgroup;
+ dw_new->weight = 0.0f;
+ dw_new->def_nr = defgroup;
/* Group index */
dvert->totweight++;
@@ -612,9 +637,9 @@ void defvert_add_index_notest(MDeformVert *dvert, int defgroup, const float weig
if (!dvert || defgroup < 0)
return;
- dw_new = MEM_callocN(sizeof(MDeformWeight)*(dvert->totweight+1), "defvert_add_to group, new deformWeight");
- if(dvert->dw) {
- memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*dvert->totweight);
+ dw_new = MEM_callocN(sizeof(MDeformWeight) * (dvert->totweight + 1), "defvert_add_to group, new deformWeight");
+ if (dvert->dw) {
+ memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
MEM_freeN(dvert->dw);
}
dvert->dw = dw_new;
@@ -634,7 +659,7 @@ void defvert_remove_group(MDeformVert *dvert, MDeformWeight *dw)
int i = dw - dvert->dw;
/* Security check! */
- if(i < 0 || i >= dvert->totweight) {
+ if (i < 0 || i >= dvert->totweight) {
return;
}
@@ -643,16 +668,16 @@ void defvert_remove_group(MDeformVert *dvert, MDeformWeight *dw)
* this deform weight, and reshuffle the others.
*/
if (dvert->totweight) {
- dw_new = MEM_mallocN(sizeof(MDeformWeight)*(dvert->totweight), __func__);
+ dw_new = MEM_mallocN(sizeof(MDeformWeight) * (dvert->totweight), __func__);
if (dvert->dw) {
-#if 1 /* since we dont care about order, swap this with the last, save a memcpy */
+#if 1 /* since we don't care about order, swap this with the last, save a memcpy */
if (i != dvert->totweight) {
- dvert->dw[i]= dvert->dw[dvert->totweight];
+ dvert->dw[i] = dvert->dw[dvert->totweight];
}
memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
#else
- memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*i);
- memcpy(dw_new+i, dvert->dw+i+1, sizeof(MDeformWeight)*(dvert->totweight-i));
+ memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * i);
+ memcpy(dw_new + i, dvert->dw + i + 1, sizeof(MDeformWeight) * (dvert->totweight - i));
#endif
MEM_freeN(dvert->dw);
}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index c178a4ef6ea..783652e9a75 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -169,7 +169,8 @@ void push_queue(DagNodeQueue *queue, DagNode *node)
queue->freenodes->first = NULL;
}
queue->freenodes->count--;
- } else { /* alllocating more */
+ }
+ else { /* alllocating more */
elem = MEM_mallocN(sizeof(DagNodeQueueElem),"DAG queue elem1");
elem->node = NULL;
elem->next = NULL;
@@ -213,7 +214,8 @@ void push_stack(DagNodeQueue *queue, DagNode *node)
queue->freenodes->first = NULL;
}
queue->freenodes->count--;
- } else { /* alllocating more */
+ }
+ else { /* alllocating more */
elem = MEM_mallocN(sizeof(DagNodeQueueElem),"DAG queue elem1");
elem->node = NULL;
elem->next = NULL;
@@ -263,7 +265,8 @@ DagNode * pop_queue(DagNodeQueue *queue)
elem->next = NULL;
queue->freenodes->count++;
return node;
- } else {
+ }
+ else {
fprintf(stderr,"return null \n");
return NULL;
}
@@ -346,10 +349,10 @@ static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Objec
// would be nice to have a list of colliders here
// so for now walk all objects in scene check 'same layer rule'
- for(base = scene->base.first; base; base= base->next) {
- if((base->lay & ob->lay) && base->object->pd) {
+ for (base = scene->base.first; base; base= base->next) {
+ if ((base->lay & ob->lay) && base->object->pd) {
Object *ob1= base->object;
- if((ob1->pd->deflect || ob1->pd->forcefield) && (ob1 != ob)) {
+ if ((ob1->pd->deflect || ob1->pd->forcefield) && (ob1 != ob)) {
node2 = dag_get_node(dag, ob1);
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Field Collision");
}
@@ -400,10 +403,10 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if (ct->subtarget[0]) {
dag_add_relation(dag,node3,node, DAG_RL_OB_DATA|DAG_RL_DATA_DATA, cti->name);
- if(ct->tar->type == OB_MESH)
+ if (ct->tar->type == OB_MESH)
node3->customdata_mask |= CD_MASK_MDEFORMVERT;
}
- else if(ELEM3(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_SPLINEIK))
+ else if (ELEM3(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_SPLINEIK))
dag_add_relation(dag,node3,node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, cti->name);
else
dag_add_relation(dag,node3,node, DAG_RL_OB_DATA, cti->name);
@@ -421,14 +424,14 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
/* driver dependencies, nla modifiers */
#if 0 // XXX old animation system
- if(ob->nlastrips.first) {
+ if (ob->nlastrips.first) {
bActionStrip *strip;
bActionChannel *chan;
- for(strip= ob->nlastrips.first; strip; strip= strip->next) {
- if(strip->modifiers.first) {
+ for (strip= ob->nlastrips.first; strip; strip= strip->next) {
+ if (strip->modifiers.first) {
bActionModifier *amod;
- for(amod= strip->modifiers.first; amod; amod= amod->next) {
- if(amod->ob) {
+ for (amod= strip->modifiers.first; amod; amod= amod->next) {
+ if (amod->ob) {
node2 = dag_get_node(dag, amod->ob);
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "NLA Strip Modifier");
}
@@ -447,7 +450,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if (ob->modifiers.first) {
ModifierData *md;
- for(md=ob->modifiers.first; md; md=md->next) {
+ for (md=ob->modifiers.first; md; md=md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
if (mti->updateDepgraph) mti->updateDepgraph(md, dag, scene, ob, node);
@@ -468,11 +471,11 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Bone Parent");
break;
default:
- if(ob->parent->type==OB_LATTICE)
+ if (ob->parent->type==OB_LATTICE)
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Lattice Parent");
- else if(ob->parent->type==OB_CURVE) {
+ else if (ob->parent->type==OB_CURVE) {
Curve *cu= ob->parent->data;
- if(cu->flag & CU_PATH)
+ if (cu->flag & CU_PATH)
dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Curve Parent");
else
dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Curve Parent");
@@ -481,7 +484,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Parent");
}
/* exception case: parent is duplivert */
- if(ob->type==OB_MBALL && (ob->parent->transflag & OB_DUPLIVERTS)) {
+ if (ob->type==OB_MBALL && (ob->parent->transflag & OB_DUPLIVERTS)) {
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Duplivert");
}
@@ -494,10 +497,10 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
if (ob->transflag & OB_DUPLI) {
- if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
+ if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
GroupObject *go;
- for(go= ob->dup_group->gobject.first; go; go= go->next) {
- if(go->ob) {
+ for (go= ob->dup_group->gobject.first; go; go= go->next) {
+ if (go->ob) {
node2 = dag_get_node(dag, go->ob);
/* node2 changes node1, this keeps animations updated in groups?? not logical? */
dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Dupligroup");
@@ -508,7 +511,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
/* softbody collision */
if ((ob->type==OB_MESH) || (ob->type==OB_CURVE) || (ob->type==OB_LATTICE)) {
- if(modifiers_isSoftbodyEnabled(ob) || modifiers_isClothEnabled(ob) || ob->particlesystem.first)
+ if (modifiers_isSoftbodyEnabled(ob) || modifiers_isClothEnabled(ob) || ob->particlesystem.first)
dag_add_collision_field_relation(dag, scene, ob, node); /* TODO: use effectorweight->group */
}
@@ -535,7 +538,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
{
Object *mom= find_basis_mball(scene, ob);
- if(mom!=ob) {
+ if (mom!=ob) {
node2 = dag_get_node(dag, mom);
dag_add_relation(dag,node,node2,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Metaball"); // mom depends on children!
}
@@ -546,16 +549,16 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
{
Curve *cu= ob->data;
- if(cu->bevobj) {
+ if (cu->bevobj) {
node2 = dag_get_node(dag, cu->bevobj);
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Bevel");
}
- if(cu->taperobj) {
+ if (cu->taperobj) {
node2 = dag_get_node(dag, cu->taperobj);
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Taper");
}
- if(ob->type == OB_FONT) {
- if(cu->textoncurve) {
+ if (ob->type == OB_FONT) {
+ if (cu->textoncurve) {
node2 = dag_get_node(dag, cu->textoncurve);
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Texture On Curve");
}
@@ -566,10 +569,10 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
/* particles */
psys= ob->particlesystem.first;
- if(psys) {
+ if (psys) {
GroupObject *go;
- for(; psys; psys=psys->next) {
+ for (; psys; psys=psys->next) {
BoidRule *rule = NULL;
BoidState *state = NULL;
ParticleSettings *part= psys->part;
@@ -578,32 +581,32 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
dag_add_relation(dag, node, node, DAG_RL_OB_DATA, "Particle-Object Relation");
- if(!psys_check_enabled(ob, psys))
+ if (!psys_check_enabled(ob, psys))
continue;
- if(ELEM(part->phystype,PART_PHYS_KEYED,PART_PHYS_BOIDS)) {
+ if (ELEM(part->phystype,PART_PHYS_KEYED,PART_PHYS_BOIDS)) {
ParticleTarget *pt = psys->targets.first;
- for(; pt; pt=pt->next) {
- if(pt->ob && BLI_findlink(&pt->ob->particlesystem, pt->psys-1)) {
+ for (; pt; pt=pt->next) {
+ if (pt->ob && BLI_findlink(&pt->ob->particlesystem, pt->psys-1)) {
node2 = dag_get_node(dag, pt->ob);
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Targets");
}
}
}
- if(part->ren_as == PART_DRAW_OB && part->dup_ob) {
+ if (part->ren_as == PART_DRAW_OB && part->dup_ob) {
node2 = dag_get_node(dag, part->dup_ob);
/* note that this relation actually runs in the wrong direction, the problem
* is that dupli system all have this (due to parenting), and the render
* engine instancing assumes particular ordering of objects in list */
dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Object Visualisation");
- if(part->dup_ob->type == OB_MBALL)
+ if (part->dup_ob->type == OB_MBALL)
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Object Visualisation");
}
- if(part->ren_as == PART_DRAW_GR && part->dup_group) {
- for(go=part->dup_group->gobject.first; go; go=go->next) {
+ if (part->ren_as == PART_DRAW_GR && part->dup_group) {
+ for (go=part->dup_group->gobject.first; go; go=go->next) {
node2 = dag_get_node(dag, go->ob);
dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Particle Group Visualisation");
}
@@ -611,8 +614,8 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
effectors = pdInitEffectors(scene, ob, psys, part->effector_weights);
- if(effectors) for(eff = effectors->first; eff; eff=eff->next) {
- if(eff->psys) {
+ if (effectors) for (eff = effectors->first; eff; eff=eff->next) {
+ if (eff->psys) {
node2 = dag_get_node(dag, eff->ob);
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Field");
}
@@ -620,16 +623,16 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
pdEndEffectors(&effectors);
- if(part->boids) {
- for(state = part->boids->states.first; state; state=state->next) {
- for(rule = state->rules.first; rule; rule=rule->next) {
+ if (part->boids) {
+ for (state = part->boids->states.first; state; state=state->next) {
+ for (rule = state->rules.first; rule; rule=rule->next) {
Object *ruleob = NULL;
- if(rule->type==eBoidRuleType_Avoid)
+ if (rule->type==eBoidRuleType_Avoid)
ruleob = ((BoidRuleGoalAvoid*)rule)->ob;
- else if(rule->type==eBoidRuleType_FollowLeader)
+ else if (rule->type==eBoidRuleType_FollowLeader)
ruleob = ((BoidRuleFollowLeader*)rule)->ob;
- if(ruleob) {
+ if (ruleob) {
node2 = dag_get_node(dag, ruleob);
dag_add_relation(dag, node2, node, DAG_RL_OB_DATA, "Boid Rule");
}
@@ -645,28 +648,28 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
- if(!cti)
+ if (!cti)
continue;
/* special case for camera tracking -- it doesn't use targets to define relations */
- if(ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER, CONSTRAINT_TYPE_OBJECTSOLVER)) {
+ if (ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER, CONSTRAINT_TYPE_OBJECTSOLVER)) {
int depends_on_camera= 0;
- if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
+ if (cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
bFollowTrackConstraint *data= (bFollowTrackConstraint *)con->data;
- if((data->clip || data->flag&FOLLOWTRACK_ACTIVECLIP) && data->track[0])
+ if ((data->clip || data->flag&FOLLOWTRACK_ACTIVECLIP) && data->track[0])
depends_on_camera= 1;
- if(data->depth_ob) {
+ if (data->depth_ob) {
node2 = dag_get_node(dag, data->depth_ob);
dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name);
}
}
- else if(cti->type==CONSTRAINT_TYPE_OBJECTSOLVER)
+ else if (cti->type==CONSTRAINT_TYPE_OBJECTSOLVER)
depends_on_camera= 1;
- if(depends_on_camera && scene->camera) {
+ if (depends_on_camera && scene->camera) {
node2 = dag_get_node(dag, scene->camera);
dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name);
}
@@ -733,22 +736,22 @@ struct DagForest *build_dag(Main *bmain, Scene *sce, short mask)
scenenode = dag_add_node(dag, sce);
/* add current scene objects */
- for(base = sce->base.first; base; base= base->next) {
+ for (base = sce->base.first; base; base= base->next) {
ob= base->object;
build_dag_object(dag, scenenode, sce, ob, mask);
- if(ob->proxy)
+ if (ob->proxy)
build_dag_object(dag, scenenode, sce, ob->proxy, mask);
/* handled in next loop */
- if(ob->dup_group)
+ if (ob->dup_group)
ob->dup_group->id.flag |= LIB_DOIT;
}
/* add groups used in current scene objects */
- for(group= bmain->group.first; group; group= group->id.next) {
- if(group->id.flag & LIB_DOIT) {
- for(go= group->gobject.first; go; go= go->next) {
+ for (group= bmain->group.first; group; group= group->id.next) {
+ if (group->id.flag & LIB_DOIT) {
+ for (go= group->gobject.first; go; go= go->next) {
build_dag_object(dag, scenenode, sce, go->ob, mask);
}
group->id.flag &= ~LIB_DOIT;
@@ -760,10 +763,10 @@ struct DagForest *build_dag(Main *bmain, Scene *sce, short mask)
* the relation type has to be synced. One of the parents can change, and should give same event to child */
/* nodes were callocced, so we can use node->color for temporal storage */
- for(node = sce->theDag->DagNode.first; node; node= node->next) {
- if(node->type==ID_OB) {
- for(itA = node->child; itA; itA= itA->next) {
- if(itA->node->type==ID_OB) {
+ for (node = sce->theDag->DagNode.first; node; node= node->next) {
+ if (node->type==ID_OB) {
+ for (itA = node->child; itA; itA= itA->next) {
+ if (itA->node->type==ID_OB) {
itA->node->color |= itA->type;
}
}
@@ -773,10 +776,10 @@ struct DagForest *build_dag(Main *bmain, Scene *sce, short mask)
}
}
/* now set relations equal, so that when only one parent changes, the correct recalcs are found */
- for(node = sce->theDag->DagNode.first; node; node= node->next) {
- if(node->type==ID_OB) {
- for(itA = node->child; itA; itA= itA->next) {
- if(itA->node->type==ID_OB) {
+ for (node = sce->theDag->DagNode.first; node; node= node->next) {
+ if (node->type==ID_OB) {
+ for (itA = node->child; itA; itA= itA->next) {
+ if (itA->node->type==ID_OB) {
itA->type |= itA->node->color;
}
}
@@ -827,7 +830,7 @@ void free_forest(DagForest *Dag)
DagNode * dag_find_node (DagForest *forest,void * fob)
{
- if(forest->nodeHash)
+ if (forest->nodeHash)
return BLI_ghash_lookup(forest->nodeHash, fob);
return NULL;
@@ -846,18 +849,19 @@ DagNode * dag_add_node (DagForest *forest, void * fob)
node->ob = fob;
node->color = DAG_WHITE;
- if(ugly_hack_sorry) node->type = GS(((ID *) fob)->name); // sorry, done for pose sorting
+ if (ugly_hack_sorry) node->type = GS(((ID *) fob)->name); // sorry, done for pose sorting
if (forest->numNodes) {
((DagNode *) forest->DagNode.last)->next = node;
forest->DagNode.last = node;
forest->numNodes++;
- } else {
+ }
+ else {
forest->DagNode.last = node;
forest->DagNode.first = node;
forest->numNodes = 1;
}
- if(!forest->nodeHash)
+ if (!forest->nodeHash)
forest->nodeHash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "dag_add_node gh");
BLI_ghash_insert(forest->nodeHash, fob, node);
}
@@ -890,7 +894,8 @@ DagNode * dag_get_sub_node (DagForest *forest,void * fob)
prev->next = mainchild->next;
MEM_freeN(mainchild);
break;
- } else {
+ }
+ else {
((DagNode *) forest->DagNode.first)->child = mainchild->next;
MEM_freeN(mainchild);
break;
@@ -954,9 +959,9 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel
static const char *dag_node_name(DagNode *node)
{
- if(node->ob == NULL)
+ if (node->ob == NULL)
return "null";
- else if(ugly_hack_sorry)
+ else if (ugly_hack_sorry)
return ((ID*)(node->ob))->name+2;
else
return ((bPoseChannel*)(node->ob))->name;
@@ -968,7 +973,7 @@ static void dag_node_print_dependencies(DagNode *node)
printf("%s depends on:\n", dag_node_name(node));
- for(itA= node->parent; itA; itA= itA->next)
+ for (itA= node->parent; itA; itA= itA->next)
printf(" %s through %s\n", dag_node_name(itA->node), itA->name);
printf("\n");
}
@@ -977,16 +982,16 @@ static int dag_node_print_dependency_recurs(DagNode *node, DagNode *endnode)
{
DagAdjList *itA;
- if(node->color == DAG_BLACK)
+ if (node->color == DAG_BLACK)
return 0;
node->color= DAG_BLACK;
- if(node == endnode)
+ if (node == endnode)
return 1;
- for(itA= node->parent; itA; itA= itA->next) {
- if(dag_node_print_dependency_recurs(itA->node, endnode)) {
+ for (itA= node->parent; itA; itA= itA->next) {
+ if (dag_node_print_dependency_recurs(itA->node, endnode)) {
printf(" %s depends on %s through %s.\n", dag_node_name(node), dag_node_name(itA->node), itA->name);
return 1;
}
@@ -999,7 +1004,7 @@ static void dag_node_print_dependency_cycle(DagForest *dag, DagNode *startnode,
{
DagNode *node;
- for(node = dag->DagNode.first; node; node= node->next)
+ for (node = dag->DagNode.first; node; node= node->next)
node->color= DAG_WHITE;
printf(" %s depends on %s through %s.\n", dag_node_name(endnode), dag_node_name(startnode), name);
@@ -1015,8 +1020,8 @@ static int dag_node_recurs_level(DagNode *node, int level)
node->color= DAG_BLACK; /* done */
newlevel= ++level;
- for(itA= node->parent; itA; itA= itA->next) {
- if(itA->node->color==DAG_WHITE) {
+ for (itA= node->parent; itA; itA= itA->next) {
+ if (itA->node->color==DAG_WHITE) {
itA->node->ancestor_count= dag_node_recurs_level(itA->node, level);
newlevel= MAX2(newlevel, level+itA->node->ancestor_count);
}
@@ -1033,25 +1038,25 @@ static void dag_check_cycle(DagForest *dag)
DagAdjList *itA;
/* debugging print */
- if(dag_print_dependencies)
- for(node = dag->DagNode.first; node; node= node->next)
+ if (dag_print_dependencies)
+ for (node = dag->DagNode.first; node; node= node->next)
dag_node_print_dependencies(node);
/* tag nodes unchecked */
- for(node = dag->DagNode.first; node; node= node->next)
+ for (node = dag->DagNode.first; node; node= node->next)
node->color= DAG_WHITE;
- for(node = dag->DagNode.first; node; node= node->next) {
- if(node->color==DAG_WHITE) {
+ for (node = dag->DagNode.first; node; node= node->next) {
+ if (node->color==DAG_WHITE) {
node->ancestor_count= dag_node_recurs_level(node, 0);
}
}
/* check relations, and print errors */
- for(node = dag->DagNode.first; node; node= node->next) {
- for(itA= node->parent; itA; itA= itA->next) {
- if(itA->node->ancestor_count > node->ancestor_count) {
- if(node->ob && itA->node->ob) {
+ for (node = dag->DagNode.first; node; node= node->next) {
+ for (itA= node->parent; itA; itA= itA->next) {
+ if (itA->node->ancestor_count > node->ancestor_count) {
+ if (node->ob && itA->node->ob) {
printf("Dependency cycle detected:\n");
dag_node_print_dependency_cycle(dag, itA->node, node, itA->name);
}
@@ -1060,7 +1065,7 @@ static void dag_check_cycle(DagForest *dag)
}
/* parent relations are only needed for cycle checking, so free now */
- for(node = dag->DagNode.first; node; node= node->next) {
+ for (node = dag->DagNode.first; node; node= node->next) {
while (node->parent) {
itA = node->parent->next;
MEM_freeN(node->parent);
@@ -1119,7 +1124,7 @@ void graph_bfs(void)
* dagnode.first is always the root (scene)
*/
node = MainDag->DagNode.first;
- while(node) {
+ while (node) {
node->color = DAG_WHITE;
node->BFS_dist = 9999;
node->k = 0;
@@ -1131,13 +1136,13 @@ void graph_bfs(void)
node->color = DAG_GRAY;
node->BFS_dist = 1;
push_queue(nqueue,node);
- while(nqueue->count) {
+ while (nqueue->count) {
node = pop_queue(nqueue);
minheight = pos[node->BFS_dist];
itA = node->child;
- while(itA != NULL) {
- if(itA->node->color == DAG_WHITE) {
+ while (itA != NULL) {
+ if (itA->node->color == DAG_WHITE) {
itA->node->color = DAG_GRAY;
itA->node->BFS_dist = node->BFS_dist + 1;
itA->node->k = (float) minheight;
@@ -1154,7 +1159,8 @@ void graph_bfs(void)
if (pos[node->BFS_dist] > node->k ) {
pos[node->BFS_dist] += 1;
node->k = (float) pos[node->BFS_dist];
- } else {
+ }
+ else {
pos[node->BFS_dist] = (int) node->k +1;
}
set_node_xy(node, node->BFS_dist*DEPSX*2, pos[node->BFS_dist]*DEPSY*2);
@@ -1188,7 +1194,7 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a
*/
node = dag->DagNode.first;
nqueue = queue_create(DAGQUEUEALLOC);
- while(node) {
+ while (node) {
node->color = DAG_WHITE;
node->BFS_dist = 9999;
node = node->next;
@@ -1200,12 +1206,12 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a
node->BFS_dist = 1;
pre_func(node->ob,data);
- while(nqueue->count) {
+ while (nqueue->count) {
node = pop_queue(nqueue);
itA = node->child;
- while(itA != NULL) {
- if((itA->node->color == DAG_WHITE) && (itA->type & mask)) {
+ while (itA != NULL) {
+ if ((itA->node->color == DAG_WHITE) && (itA->type & mask)) {
itA->node->color = DAG_GRAY;
itA->node->BFS_dist = node->BFS_dist + 1;
push_queue(nqueue,itA->node);
@@ -1253,7 +1259,7 @@ DagNodeQueue * graph_dfs(void)
* dagnode.first is always the root (scene)
*/
node = MainDag->DagNode.first;
- while(node) {
+ while (node) {
node->color = DAG_WHITE;
node->DFS_dist = 9999;
node->DFS_dvtm = node->DFS_fntm = 9999;
@@ -1273,7 +1279,7 @@ DagNodeQueue * graph_dfs(void)
time++;
push_stack(nqueue,node);
- while(nqueue->count) {
+ while (nqueue->count) {
//graph_print_queue(nqueue);
skip = 0;
@@ -1282,8 +1288,8 @@ DagNodeQueue * graph_dfs(void)
minheight = pos[node->DFS_dist];
itA = node->child;
- while(itA != NULL) {
- if(itA->node->color == DAG_WHITE) {
+ while (itA != NULL) {
+ if (itA->node->color == DAG_WHITE) {
itA->node->DFS_dvtm = time;
itA->node->color = DAG_GRAY;
@@ -1293,11 +1299,13 @@ DagNodeQueue * graph_dfs(void)
push_stack(nqueue,itA->node);
skip = 1;
break;
- } else {
+ }
+ else {
if (itA->node->color == DAG_GRAY) { // back edge
fprintf(stderr,"dfs back edge :%15s %15s \n",((ID *) node->ob)->name, ((ID *) itA->node->ob)->name);
/* is_cycle = 1; */ /* UNUSED */
- } else if (itA->node->color == DAG_BLACK) {
+ }
+ else if (itA->node->color == DAG_BLACK) {
;
/* already processed node but we may want later to change distance either to shorter to longer.
* DFS_dist is the first encounter
@@ -1313,7 +1321,8 @@ DagNodeQueue * graph_dfs(void)
itA->node->DFS_dvtm,
itA->node->DFS_fntm);
*/
- } else
+ }
+ else
fprintf(stderr,"dfs unknown edge \n");
}
itA = itA->next;
@@ -1330,7 +1339,8 @@ DagNodeQueue * graph_dfs(void)
if (pos[node->DFS_dist] > node->k ) {
pos[node->DFS_dist] += 1;
node->k = (float) pos[node->DFS_dist];
- } else {
+ }
+ else {
pos[node->DFS_dist] = (int) node->k +1;
}
set_node_xy(node, node->DFS_dist*DEPSX*2, pos[node->DFS_dist]*DEPSY*2);
@@ -1376,7 +1386,7 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
* dagnode.first is always the root (scene)
*/
node = dag->DagNode.first;
- while(node) {
+ while (node) {
node->color = DAG_WHITE;
node->DFS_dist = 9999;
node->DFS_dvtm = node->DFS_fntm = 9999;
@@ -1396,13 +1406,13 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
push_stack(nqueue,node);
pre_func(node->ob,data);
- while(nqueue->count) {
+ while (nqueue->count) {
skip = 0;
node = get_top_node_queue(nqueue);
itA = node->child;
- while(itA != NULL) {
- if((itA->node->color == DAG_WHITE) && (itA->type & mask) ) {
+ while (itA != NULL) {
+ if ((itA->node->color == DAG_WHITE) && (itA->type & mask) ) {
itA->node->DFS_dvtm = time;
itA->node->color = DAG_GRAY;
@@ -1413,7 +1423,8 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
skip = 1;
break;
- } else {
+ }
+ else {
if (itA->node->color == DAG_GRAY) {// back edge
retval = 1;
}
@@ -1449,20 +1460,21 @@ struct DagNodeQueue *get_obparents(struct DagForest *dag, void *ob)
DagAdjList *itA;
node = dag_find_node(dag,ob);
- if(node==NULL) {
+ if (node==NULL) {
return NULL;
}
else if (node->ancestor_count == 1) { // simple case
nqueue = queue_create(1);
push_queue(nqueue,node);
- } else { // need to go over the whole dag for adj list
+ }
+ else { /* need to go over the whole dag for adj list */
nqueue = queue_create(node->ancestor_count);
node1 = dag->DagNode.first;
do {
if (node1->DFS_fntm > node->DFS_fntm) { // a parent is finished after child. must check adj list
itA = node->child;
- while(itA != NULL) {
+ while (itA != NULL) {
if ((itA->node == node) && (itA->type == DAG_RL_DATA)) {
push_queue(nqueue,node);
}
@@ -1490,7 +1502,7 @@ struct DagNodeQueue *get_first_ancestors(struct DagForest *dag, void *ob)
do {
if (node1->DFS_fntm > node->DFS_fntm) {
itA = node->child;
- while(itA != NULL) {
+ while (itA != NULL) {
if (itA->node == node) {
push_queue(nqueue,node);
}
@@ -1517,7 +1529,7 @@ struct DagNodeQueue *get_all_childs(struct DagForest *dag, void *ob)
retqueue = queue_create(dag->numNodes); // was MainDag... why? (ton)
node = dag->DagNode.first;
- while(node) {
+ while (node) {
node->color = DAG_WHITE;
node = node->next;
}
@@ -1525,20 +1537,20 @@ struct DagNodeQueue *get_all_childs(struct DagForest *dag, void *ob)
time = 1;
node = dag_find_node(dag, ob); // could be done in loop above (ton)
- if(node) { // can be null for newly added objects
+ if (node) { // can be null for newly added objects
node->color = DAG_GRAY;
time++;
push_stack(nqueue,node);
- while(nqueue->count) {
+ while (nqueue->count) {
skip = 0;
node = get_top_node_queue(nqueue);
itA = node->child;
- while(itA != NULL) {
- if(itA->node->color == DAG_WHITE) {
+ while (itA != NULL) {
+ if (itA->node->color == DAG_WHITE) {
itA->node->DFS_dvtm = time;
itA->node->color = DAG_GRAY;
@@ -1572,8 +1584,8 @@ short are_obs_related(struct DagForest *dag, void *ob1, void *ob2)
node = dag_find_node(dag, ob1);
itA = node->child;
- while(itA != NULL) {
- if(itA->node->ob == ob2) {
+ while (itA != NULL) {
+ if (itA->node->ob == ob2) {
return itA->node->type;
}
itA = itA->next;
@@ -1600,7 +1612,7 @@ void graph_print_queue(DagNodeQueue *nqueue)
DagNodeQueueElem *queueElem;
queueElem = nqueue->first;
- while(queueElem) {
+ while (queueElem) {
fprintf(stderr,"** %s %i %i-%i ",((ID *) queueElem->node->ob)->name,queueElem->node->color,queueElem->node->DFS_dvtm,queueElem->node->DFS_fntm);
queueElem = queueElem->next;
}
@@ -1614,7 +1626,7 @@ void graph_print_queue_dist(DagNodeQueue *nqueue)
queueElem = nqueue->first;
count = 0;
- while(queueElem) {
+ while (queueElem) {
fprintf(stderr,"** %25s %2.2i-%2.2i ",((ID *) queueElem->node->ob)->name,queueElem->node->DFS_dvtm,queueElem->node->DFS_fntm);
while (count < queueElem->node->DFS_dvtm-1) { fputc(' ',stderr); count++;}
fputc('|',stderr);
@@ -1633,7 +1645,7 @@ void graph_print_adj_list(void)
DagAdjList *itA;
node = (getMainDag())->DagNode.first;
- while(node) {
+ while (node) {
fprintf(stderr,"node : %s col: %i",((ID *) node->ob)->name, node->color);
itA = node->child;
while (itA) {
@@ -1661,13 +1673,13 @@ void DAG_editors_update_cb(void (*id_func)(Main *bmain, ID *id), void (*scene_fu
static void dag_editors_id_update(Main *bmain, ID *id)
{
- if(EditorsUpdateIDCb)
+ if (EditorsUpdateIDCb)
EditorsUpdateIDCb(bmain, id);
}
static void dag_editors_scene_update(Main *bmain, Scene *scene, int updated)
{
- if(EditorsUpdateSceneCb)
+ if (EditorsUpdateSceneCb)
EditorsUpdateSceneCb(bmain, scene, updated);
}
@@ -1680,29 +1692,29 @@ static void scene_sort_groups(Main *bmain, Scene *sce)
Object *ob;
/* test; are group objects all in this scene? */
- for(ob= bmain->object.first; ob; ob= ob->id.next) {
+ for (ob= bmain->object.first; ob; ob= ob->id.next) {
ob->id.flag &= ~LIB_DOIT;
ob->id.newid= NULL; /* newid abuse for GroupObject */
}
- for(base = sce->base.first; base; base= base->next)
+ for (base = sce->base.first; base; base= base->next)
base->object->id.flag |= LIB_DOIT;
- for(group= bmain->group.first; group; group= group->id.next) {
- for(go= group->gobject.first; go; go= go->next) {
- if((go->ob->id.flag & LIB_DOIT)==0)
+ for (group= bmain->group.first; group; group= group->id.next) {
+ for (go= group->gobject.first; go; go= go->next) {
+ if ((go->ob->id.flag & LIB_DOIT)==0)
break;
}
/* this group is entirely in this scene */
- if(go==NULL) {
+ if (go==NULL) {
ListBase listb= {NULL, NULL};
- for(go= group->gobject.first; go; go= go->next)
+ for (go= group->gobject.first; go; go= go->next)
go->ob->id.newid= (ID *)go;
/* in order of sorted bases we reinsert group objects */
- for(base = sce->base.first; base; base= base->next) {
+ for (base = sce->base.first; base; base= base->next) {
- if(base->object->id.newid) {
+ if (base->object->id.newid) {
go= (GroupObject *)base->object->id.newid;
base->object->id.newid= NULL;
BLI_remlink( &group->gobject, go);
@@ -1734,7 +1746,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
nqueue = queue_create(DAGQUEUEALLOC);
- for(node = sce->theDag->DagNode.first; node; node= node->next) {
+ for (node = sce->theDag->DagNode.first; node; node= node->next) {
node->color = DAG_WHITE;
}
@@ -1745,14 +1757,14 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
time++;
push_stack(nqueue,rootnode);
- while(nqueue->count) {
+ while (nqueue->count) {
skip = 0;
node = get_top_node_queue(nqueue);
itA = node->child;
- while(itA != NULL) {
- if(itA->node->color == DAG_WHITE) {
+ while (itA != NULL) {
+ if (itA->node->color == DAG_WHITE) {
itA->node->DFS_dvtm = time;
itA->node->color = DAG_GRAY;
@@ -1775,7 +1787,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
base = sce->base.first;
while (base && base->object != node->ob)
base = base->next;
- if(base) {
+ if (base) {
BLI_remlink(&sce->base,base);
BLI_addhead(&tempbase,base);
}
@@ -1799,9 +1811,9 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
/* all groups with objects in this scene gets resorted too */
scene_sort_groups(bmain, sce);
- if(G.f & G_DEBUG) {
+ if (G.f & G_DEBUG) {
printf("\nordered\n");
- for(base = sce->base.first; base; base= base->next) {
+ for (base = sce->base.first; base; base= base->next) {
printf(" %s\n", base->object->id.name);
}
}
@@ -1833,51 +1845,51 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime)
node->lasttime= curtime;
ob= node->ob;
- if(ob && (ob->recalc & OB_RECALC_ALL)) {
+ if (ob && (ob->recalc & OB_RECALC_ALL)) {
all_layer= node->scelay;
/* got an object node that changes, now check relations */
- for(itA = node->child; itA; itA= itA->next) {
+ for (itA = node->child; itA; itA= itA->next) {
all_layer |= itA->lay;
/* the relationship is visible */
- if((itA->lay & layer)) { // XXX || (itA->node->ob == obedit)
- if(itA->node->type==ID_OB) {
+ if ((itA->lay & layer)) { // XXX || (itA->node->ob == obedit)
+ if (itA->node->type==ID_OB) {
obc= itA->node->ob;
oldflag= obc->recalc;
/* got a ob->obc relation, now check if flag needs flush */
- if(ob->recalc & OB_RECALC_OB) {
- if(itA->type & DAG_RL_OB_OB) {
+ if (ob->recalc & OB_RECALC_OB) {
+ if (itA->type & DAG_RL_OB_OB) {
//printf("ob %s changes ob %s\n", ob->id.name, obc->id.name);
obc->recalc |= OB_RECALC_OB;
lib_id_recalc_tag(bmain, &obc->id);
}
- if(itA->type & DAG_RL_OB_DATA) {
+ if (itA->type & DAG_RL_OB_DATA) {
//printf("ob %s changes obdata %s\n", ob->id.name, obc->id.name);
obc->recalc |= OB_RECALC_DATA;
lib_id_recalc_data_tag(bmain, &obc->id);
}
}
- if(ob->recalc & OB_RECALC_DATA) {
- if(itA->type & DAG_RL_DATA_OB) {
+ if (ob->recalc & OB_RECALC_DATA) {
+ if (itA->type & DAG_RL_DATA_OB) {
//printf("obdata %s changes ob %s\n", ob->id.name, obc->id.name);
obc->recalc |= OB_RECALC_OB;
lib_id_recalc_tag(bmain, &obc->id);
}
- if(itA->type & DAG_RL_DATA_DATA) {
+ if (itA->type & DAG_RL_DATA_DATA) {
//printf("obdata %s changes obdata %s\n", ob->id.name, obc->id.name);
obc->recalc |= OB_RECALC_DATA;
lib_id_recalc_data_tag(bmain, &obc->id);
}
}
- if(oldflag!=obc->recalc) changed= 1;
+ if (oldflag!=obc->recalc) changed= 1;
}
}
}
/* even nicer, we can clear recalc flags... */
- if((all_layer & layer)==0) { // XXX && (ob != obedit)) {
+ if ((all_layer & layer)==0) { // XXX && (ob != obedit)) {
/* but existing displaylists or derivedmesh should be freed */
- if(ob->recalc & OB_RECALC_DATA)
+ if (ob->recalc & OB_RECALC_DATA)
object_free_display(ob);
ob->recalc &= ~OB_RECALC_ALL;
@@ -1887,15 +1899,15 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime)
/* check case where child changes and parent forcing obdata to change */
/* should be done regardless if this ob has recalc set */
/* could merge this in with loop above...? (ton) */
- for(itA = node->child; itA; itA= itA->next) {
+ for (itA = node->child; itA; itA= itA->next) {
/* the relationship is visible */
- if((itA->lay & layer)) { // XXX || (itA->node->ob == obedit)
- if(itA->node->type==ID_OB) {
+ if ((itA->lay & layer)) { // XXX || (itA->node->ob == obedit)
+ if (itA->node->type==ID_OB) {
obc= itA->node->ob;
/* child moves */
- if((obc->recalc & OB_RECALC_ALL)==OB_RECALC_OB) {
+ if ((obc->recalc & OB_RECALC_ALL)==OB_RECALC_OB) {
/* parent has deforming info */
- if(itA->type & (DAG_RL_OB_DATA|DAG_RL_DATA_DATA)) {
+ if (itA->type & (DAG_RL_OB_DATA|DAG_RL_DATA_DATA)) {
// printf("parent %s changes ob %s\n", ob->id.name, obc->id.name);
obc->recalc |= OB_RECALC_DATA;
lib_id_recalc_data_tag(bmain, &obc->id);
@@ -1906,8 +1918,8 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime)
}
/* we only go deeper if node not checked or something changed */
- for(itA = node->child; itA; itA= itA->next) {
- if(changed || itA->node->lasttime!=curtime)
+ for (itA = node->child; itA; itA= itA->next) {
+ if (changed || itA->node->lasttime!=curtime)
flush_update_node(itA->node, layer, curtime);
}
@@ -1921,9 +1933,9 @@ static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime)
node->lasttime= curtime;
node->lay= node->scelay;
- for(itA = node->child; itA; itA= itA->next) {
- if(itA->node->type==ID_OB) {
- if(itA->node->lasttime!=curtime) {
+ for (itA = node->child; itA; itA= itA->next) {
+ if (itA->node->type==ID_OB) {
+ if (itA->node->lasttime!=curtime) {
itA->lay= flush_layer_node(sce, itA->node, curtime); // lay is only set once for each relation
}
else itA->lay= itA->node->lay;
@@ -1944,13 +1956,13 @@ static void flush_pointcache_reset(Scene *scene, DagNode *node, int curtime, int
node->lasttime= curtime;
- for(itA = node->child; itA; itA= itA->next) {
- if(itA->node->type==ID_OB) {
- if(itA->node->lasttime!=curtime) {
+ for (itA = node->child; itA; itA= itA->next) {
+ if (itA->node->type==ID_OB) {
+ if (itA->node->lasttime!=curtime) {
ob= (Object*)(itA->node->ob);
- if(reset || (ob->recalc & OB_RECALC_ALL)) {
- if(BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH)) {
+ if (reset || (ob->recalc & OB_RECALC_ALL)) {
+ if (BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH)) {
ob->recalc |= OB_RECALC_DATA;
lib_id_recalc_data_tag(bmain, &ob->id);
}
@@ -1974,14 +1986,14 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
firstnode= sce->theDag->DagNode.first; // always scene node
- for(itA = firstnode->child; itA; itA= itA->next)
+ for (itA = firstnode->child; itA; itA= itA->next)
itA->lay= 0;
sce->theDag->time++; // so we know which nodes were accessed
lasttime= sce->theDag->time;
/* update layer flags in nodes */
- for(base= sce->base.first; base; base= base->next) {
+ for (base= sce->base.first; base; base= base->next) {
node= dag_get_node(sce->theDag, base->object);
node->scelay= base->object->lay;
}
@@ -1990,7 +2002,7 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
* they ared still used for rendering or setting the camera view
*
* XXX, this wont work for local view / unlocked camera's */
- if(sce->camera) {
+ if (sce->camera) {
node= dag_get_node(sce->theDag, sce->camera);
node->scelay |= lay;
}
@@ -1999,8 +2011,8 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
{
TimeMarker *m;
- for(m= sce->markers.first; m; m= m->next) {
- if(m->camera) {
+ for (m= sce->markers.first; m; m= m->next) {
+ if (m->camera) {
node= dag_get_node(sce->theDag, m->camera);
node->scelay |= lay;
}
@@ -2009,27 +2021,27 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
#endif
/* flush layer nodes to dependencies */
- for(itA = firstnode->child; itA; itA= itA->next)
- if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB)
+ for (itA = firstnode->child; itA; itA= itA->next)
+ if (itA->node->lasttime!=lasttime && itA->node->type==ID_OB)
flush_layer_node(sce, itA->node, lasttime);
}
static void dag_tag_renderlayers(Scene *sce, unsigned int lay)
{
- if(sce->nodetree) {
+ if (sce->nodetree) {
bNode *node;
Base *base;
unsigned int lay_changed= 0;
- for(base= sce->base.first; base; base= base->next)
- if(base->lay & lay)
- if(base->object->recalc)
+ for (base= sce->base.first; base; base= base->next)
+ if (base->lay & lay)
+ if (base->object->recalc)
lay_changed |= base->lay;
- for(node= sce->nodetree->nodes.first; node; node= node->next) {
- if(node->id==(ID *)sce) {
+ for (node= sce->nodetree->nodes.first; node; node= node->next) {
+ if (node->id==(ID *)sce) {
SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
- if(srl && (srl->lay & lay_changed))
+ if (srl && (srl->lay & lay_changed))
nodeUpdate(sce->nodetree, node);
}
}
@@ -2044,7 +2056,7 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
Object *ob;
int lasttime;
- if(sce->theDag==NULL) {
+ if (sce->theDag==NULL) {
printf("DAG zero... not allowed to happen!\n");
DAG_scene_sort(bmain, sce);
}
@@ -2057,20 +2069,20 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
/* then we use the relationships + layer info to flush update events */
sce->theDag->time++; // so we know which nodes were accessed
lasttime= sce->theDag->time;
- for(itA = firstnode->child; itA; itA= itA->next)
- if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB)
+ for (itA = firstnode->child; itA; itA= itA->next)
+ if (itA->node->lasttime!=lasttime && itA->node->type==ID_OB)
flush_update_node(itA->node, lay, lasttime);
/* if update is not due to time change, do pointcache clears */
- if(!time) {
+ if (!time) {
sce->theDag->time++; // so we know which nodes were accessed
lasttime= sce->theDag->time;
- for(itA = firstnode->child; itA; itA= itA->next) {
- if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB) {
+ for (itA = firstnode->child; itA; itA= itA->next) {
+ if (itA->node->lasttime!=lasttime && itA->node->type==ID_OB) {
ob= (Object*)(itA->node->ob);
- if(ob->recalc & OB_RECALC_ALL) {
- if(BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH)) {
+ if (ob->recalc & OB_RECALC_ALL) {
+ if (BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH)) {
ob->recalc |= OB_RECALC_DATA;
lib_id_recalc_data_tag(bmain, &ob->id);
}
@@ -2130,7 +2142,7 @@ static short animdata_use_time(AnimData *adt)
{
NlaTrack *nlt;
- if(adt==NULL) return 0;
+ if (adt==NULL) return 0;
/* check action - only if assigned, and it has anim curves */
if (adt->action && adt->action->curves.first)
@@ -2164,7 +2176,7 @@ static short animdata_use_time(AnimData *adt)
static void dag_object_time_update_flags(Object *ob)
{
- if(ob->constraints.first) {
+ if (ob->constraints.first) {
bConstraint *con;
for (con = ob->constraints.first; con; con=con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
@@ -2173,7 +2185,7 @@ static void dag_object_time_update_flags(Object *ob)
if (cti) {
/* special case for camera tracking -- it doesn't use targets to define relations */
- if(ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER, CONSTRAINT_TYPE_OBJECTSOLVER)) {
+ if (ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER, CONSTRAINT_TYPE_OBJECTSOLVER)) {
ob->recalc |= OB_RECALC_OB;
}
else if (cti->get_constraint_targets) {
@@ -2194,33 +2206,33 @@ static void dag_object_time_update_flags(Object *ob)
}
}
- if(ob->parent) {
+ if (ob->parent) {
/* motion path or bone child */
- if(ob->parent->type==OB_CURVE || ob->parent->type==OB_ARMATURE) ob->recalc |= OB_RECALC_OB;
+ if (ob->parent->type==OB_CURVE || ob->parent->type==OB_ARMATURE) ob->recalc |= OB_RECALC_OB;
}
#if 0 // XXX old animation system
- if(ob->nlastrips.first) {
- if(ob->dup_group) {
+ if (ob->nlastrips.first) {
+ if (ob->dup_group) {
bActionStrip *strip;
/* this case is for groups with nla, whilst nla target has no action or nla */
- for(strip= ob->nlastrips.first; strip; strip= strip->next) {
- if(strip->object)
+ for (strip= ob->nlastrips.first; strip; strip= strip->next) {
+ if (strip->object)
strip->object->recalc |= OB_RECALC_ALL;
}
}
}
#endif // XXX old animation system
- if(animdata_use_time(ob->adt)) {
+ if (animdata_use_time(ob->adt)) {
ob->recalc |= OB_RECALC_OB;
ob->adt->recalc |= ADT_RECALC_ANIM;
}
- if((ob->adt) && (ob->type==OB_ARMATURE)) ob->recalc |= OB_RECALC_DATA;
+ if ((ob->adt) && (ob->type==OB_ARMATURE)) ob->recalc |= OB_RECALC_DATA;
- if(object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
- if((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA;
+ if (object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
+ if ((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA;
{
AnimData *adt= BKE_animdata_from_id((ID *)ob->data);
@@ -2231,51 +2243,51 @@ static void dag_object_time_update_flags(Object *ob)
switch(ob->type) {
case OB_MESH:
me= ob->data;
- if(me->key) {
- if(!(ob->shapeflag & OB_SHAPE_LOCK)) {
+ if (me->key) {
+ if (!(ob->shapeflag & OB_SHAPE_LOCK)) {
ob->recalc |= OB_RECALC_DATA;
}
}
- if(ob->particlesystem.first)
+ if (ob->particlesystem.first)
ob->recalc |= OB_RECALC_DATA;
break;
case OB_CURVE:
case OB_SURF:
cu= ob->data;
- if(cu->key) {
- if(!(ob->shapeflag & OB_SHAPE_LOCK)) {
+ if (cu->key) {
+ if (!(ob->shapeflag & OB_SHAPE_LOCK)) {
ob->recalc |= OB_RECALC_DATA;
}
}
break;
case OB_FONT:
cu= ob->data;
- if(cu->nurb.first==NULL && cu->str && cu->vfont)
+ if (cu->nurb.first==NULL && cu->str && cu->vfont)
ob->recalc |= OB_RECALC_DATA;
break;
case OB_LATTICE:
lt= ob->data;
- if(lt->key) {
- if(!(ob->shapeflag & OB_SHAPE_LOCK)) {
+ if (lt->key) {
+ if (!(ob->shapeflag & OB_SHAPE_LOCK)) {
ob->recalc |= OB_RECALC_DATA;
}
}
break;
case OB_MBALL:
- if(ob->transflag & OB_DUPLI) ob->recalc |= OB_RECALC_DATA;
+ if (ob->transflag & OB_DUPLI) ob->recalc |= OB_RECALC_DATA;
break;
}
- if(animdata_use_time(adt)) {
+ if (animdata_use_time(adt)) {
ob->recalc |= OB_RECALC_DATA;
adt->recalc |= ADT_RECALC_ANIM;
}
- if(ob->particlesystem.first) {
+ if (ob->particlesystem.first) {
ParticleSystem *psys= ob->particlesystem.first;
- for(; psys; psys=psys->next) {
- if(psys_check_enabled(ob, psys)) {
+ for (; psys; psys=psys->next) {
+ if (psys_check_enabled(ob, psys)) {
ob->recalc |= OB_RECALC_DATA;
break;
}
@@ -2283,9 +2295,9 @@ static void dag_object_time_update_flags(Object *ob)
}
}
- if(ob->recalc & OB_RECALC_OB)
+ if (ob->recalc & OB_RECALC_OB)
lib_id_recalc_tag(G.main, &ob->id);
- if(ob->recalc & OB_RECALC_DATA)
+ if (ob->recalc & OB_RECALC_DATA)
lib_id_recalc_data_tag(G.main, &ob->id);
}
@@ -2300,51 +2312,51 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const s
Scene *sce_iter;
/* set ob flags where animated systems are */
- for(SETLOOPER(scene, sce_iter, base)) {
+ for (SETLOOPER(scene, sce_iter, base)) {
ob= base->object;
- if(do_time) {
+ if (do_time) {
/* now if DagNode were part of base, the node->lay could be checked... */
/* we do all now, since the scene_flush checks layers and clears recalc flags even */
dag_object_time_update_flags(ob);
}
/* handled in next loop */
- if(ob->dup_group)
+ if (ob->dup_group)
ob->dup_group->id.flag |= LIB_DOIT;
}
- if(do_time) {
+ if (do_time) {
/* we do groups each once */
- for(group= bmain->group.first; group; group= group->id.next) {
- if(group->id.flag & LIB_DOIT) {
- for(go= group->gobject.first; go; go= go->next) {
+ for (group= bmain->group.first; group; group= group->id.next) {
+ if (group->id.flag & LIB_DOIT) {
+ for (go= group->gobject.first; go; go= go->next) {
dag_object_time_update_flags(go->ob);
}
}
}
}
- for(sce_iter= scene; sce_iter; sce_iter= sce_iter->set)
+ for (sce_iter= scene; sce_iter; sce_iter= sce_iter->set)
DAG_scene_flush_update(bmain, sce_iter, lay, 1);
- if(do_time) {
+ if (do_time) {
/* test: set time flag, to disable baked systems to update */
- for(SETLOOPER(scene, sce_iter, base)) {
+ for (SETLOOPER(scene, sce_iter, base)) {
ob= base->object;
- if(ob->recalc)
+ if (ob->recalc)
ob->recalc |= OB_RECALC_TIME;
}
/* hrmf... an exception to look at once, for invisible camera object we do it over */
- if(scene->camera)
+ if (scene->camera)
dag_object_time_update_flags(scene->camera);
}
/* and store the info in groupobject */
- for(group= bmain->group.first; group; group= group->id.next) {
- if(group->id.flag & LIB_DOIT) {
- for(go= group->gobject.first; go; go= go->next) {
+ for (group= bmain->group.first; group; group= group->id.next) {
+ if (group->id.flag & LIB_DOIT) {
+ for (go= group->gobject.first; go; go= go->next) {
go->recalc= go->ob->recalc;
// printf("ob %s recalc %d\n", go->ob->id.name, go->recalc);
}
@@ -2365,11 +2377,11 @@ static void dag_current_scene_layers(Main *bmain, Scene **sce, unsigned int *lay
*sce= NULL;
*lay= 0;
- if((wm= bmain->wm.first)) {
+ if ((wm= bmain->wm.first)) {
/* if we have a windowmanager, look into windows */
- for(win=wm->windows.first; win; win=win->next) {
- if(win->screen) {
- if(!*sce) *sce= win->screen->scene;
+ for (win=wm->windows.first; win; win=win->next) {
+ if (win->screen) {
+ if (!*sce) *sce= win->screen->scene;
*lay |= BKE_screen_visible_layers(win->screen, win->screen->scene);
}
}
@@ -2377,7 +2389,7 @@ static void dag_current_scene_layers(Main *bmain, Scene **sce, unsigned int *lay
else {
/* if not, use the first sce */
*sce= bmain->scene.first;
- if(*sce) *lay= (*sce)->lay;
+ if (*sce) *lay= (*sce)->lay;
/* XXX for background mode, we should get the scene
* from somewhere, for the -S option, but it's in
@@ -2392,7 +2404,7 @@ void DAG_ids_flush_update(Main *bmain, int time)
dag_current_scene_layers(bmain, &sce, &lay);
- if(sce)
+ if (sce)
DAG_scene_flush_update(bmain, sce, lay, time);
}
@@ -2408,7 +2420,7 @@ void DAG_on_visible_update(Main *bmain, const short do_time)
dag_current_scene_layers(bmain, &scene, &lay);
- if(scene && scene->theDag) {
+ if (scene && scene->theDag) {
Scene *sce_iter;
/* derivedmeshes and displists are not saved to file so need to be
* remade, tag them so they get remade in the scene update loop,
@@ -2416,25 +2428,25 @@ void DAG_on_visible_update(Main *bmain, const short do_time)
* require updates, so we skip those */
dag_scene_flush_layers(scene, lay);
- for(SETLOOPER(scene, sce_iter, base)) {
+ for (SETLOOPER(scene, sce_iter, base)) {
ob= base->object;
node= (sce_iter->theDag)? dag_get_node(sce_iter->theDag, ob): NULL;
oblay= (node)? node->lay: ob->lay;
- if((oblay & lay) & ~scene->lay_updated) {
- if(ELEM6(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE))
+ if ((oblay & lay) & ~scene->lay_updated) {
+ if (ELEM6(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE))
ob->recalc |= OB_RECALC_DATA;
- if(ob->dup_group)
+ if (ob->dup_group)
ob->dup_group->id.flag |= LIB_DOIT;
}
}
- for(group= bmain->group.first; group; group= group->id.next) {
- if(group->id.flag & LIB_DOIT) {
- for(go= group->gobject.first; go; go= go->next) {
- if(ELEM6(go->ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE))
+ for (group= bmain->group.first; group; group= group->id.next) {
+ if (group->id.flag & LIB_DOIT) {
+ for (go= group->gobject.first; go; go= go->next) {
+ if (ELEM6(go->ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE))
go->ob->recalc |= OB_RECALC_DATA;
- if(go->ob->proxy_from)
+ if (go->ob->proxy_from)
go->ob->recalc |= OB_RECALC_OB;
}
@@ -2455,7 +2467,7 @@ static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUS
{
struct { ID *id; int is_dependent; } *data = userData;
- if(*idpoin && GS((*idpoin)->name)==ID_TE) {
+ if (*idpoin && GS((*idpoin)->name)==ID_TE) {
if (data->id == (*idpoin))
data->is_dependent = 1;
}
@@ -2471,16 +2483,16 @@ static void dag_id_flush_update(Scene *sce, ID *id)
* due to only objects and not other datablocks being in the depsgraph */
/* set flags & pointcache for object */
- if(GS(id->name) == ID_OB) {
+ if (GS(id->name) == ID_OB) {
ob= (Object*)id;
BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH);
- if(ob->recalc & OB_RECALC_DATA) {
+ if (ob->recalc & OB_RECALC_DATA) {
/* all users of this ob->data should be checked */
id= ob->data;
/* no point in trying in this cases */
- if(id && id->us <= 1) {
+ if (id && id->us <= 1) {
dag_editors_id_update(bmain, id);
id= NULL;
}
@@ -2488,12 +2500,12 @@ static void dag_id_flush_update(Scene *sce, ID *id)
}
/* set flags & pointcache for object data */
- if(id) {
+ if (id) {
idtype= GS(id->name);
- if(ELEM8(idtype, ID_ME, ID_CU, ID_MB, ID_LA, ID_LT, ID_CA, ID_AR, ID_SPK)) {
- for(obt=bmain->object.first; obt; obt= obt->id.next) {
- if(!(ob && obt == ob) && obt->data == id) {
+ if (ELEM8(idtype, ID_ME, ID_CU, ID_MB, ID_LA, ID_LT, ID_CA, ID_AR, ID_SPK)) {
+ for (obt=bmain->object.first; obt; obt= obt->id.next) {
+ if (!(ob && obt == ob) && obt->data == id) {
obt->recalc |= OB_RECALC_DATA;
lib_id_recalc_data_tag(bmain, &obt->id);
BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
@@ -2502,8 +2514,8 @@ static void dag_id_flush_update(Scene *sce, ID *id)
}
/* set flags based on textures - can influence depgraph via modifiers */
- if(idtype == ID_TE) {
- for(obt=bmain->object.first; obt; obt= obt->id.next) {
+ if (idtype == ID_TE) {
+ for (obt=bmain->object.first; obt; obt= obt->id.next) {
struct { ID *id; int is_dependent; } data;
data.id= id;
data.is_dependent= 0;
@@ -2515,21 +2527,21 @@ static void dag_id_flush_update(Scene *sce, ID *id)
}
/* particle settings can use the texture as well */
- if(obt->particlesystem.first) {
+ if (obt->particlesystem.first) {
ParticleSystem *psys = obt->particlesystem.first;
MTex **mtexp, *mtex;
int a;
- for(; psys; psys=psys->next) {
+ for (; psys; psys=psys->next) {
mtexp = psys->part->mtex;
- for(a=0; a<MAX_MTEX; a++, mtexp++) {
+ for (a=0; a<MAX_MTEX; a++, mtexp++) {
mtex = *mtexp;
- if(mtex && mtex->tex == (Tex*)id) {
+ if (mtex && mtex->tex == (Tex*)id) {
obt->recalc |= OB_RECALC_DATA;
lib_id_recalc_data_tag(bmain, &obt->id);
- if(mtex->mapto & PAMAP_INIT)
+ if (mtex->mapto & PAMAP_INIT)
psys->recalc |= PSYS_RECALC_RESET;
- if(mtex->mapto & PAMAP_CHILD)
+ if (mtex->mapto & PAMAP_CHILD)
psys->recalc |= PSYS_RECALC_CHILD;
BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
@@ -2541,10 +2553,10 @@ static void dag_id_flush_update(Scene *sce, ID *id)
}
/* set flags based on ShapeKey */
- if(idtype == ID_KE) {
- for(obt=bmain->object.first; obt; obt= obt->id.next) {
+ if (idtype == ID_KE) {
+ for (obt=bmain->object.first; obt; obt= obt->id.next) {
Key *key= ob_get_key(obt);
- if(!(ob && obt == ob) && ((ID *)key == id)) {
+ if (!(ob && obt == ob) && ((ID *)key == id)) {
obt->flag |= (OB_RECALC_OB|OB_RECALC_DATA);
lib_id_recalc_tag(bmain, &obt->id);
lib_id_recalc_data_tag(bmain, &obt->id);
@@ -2554,20 +2566,20 @@ static void dag_id_flush_update(Scene *sce, ID *id)
}
/* set flags based on particle settings */
- if(idtype == ID_PA) {
+ if (idtype == ID_PA) {
ParticleSystem *psys;
- for(obt=bmain->object.first; obt; obt= obt->id.next)
- for(psys=obt->particlesystem.first; psys; psys=psys->next)
- if(&psys->part->id == id)
+ for (obt=bmain->object.first; obt; obt= obt->id.next)
+ for (psys=obt->particlesystem.first; psys; psys=psys->next)
+ if (&psys->part->id == id)
BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
}
- if(idtype == ID_MC) {
- for(obt=bmain->object.first; obt; obt= obt->id.next) {
+ if (idtype == ID_MC) {
+ for (obt=bmain->object.first; obt; obt= obt->id.next) {
bConstraint *con;
for (con = obt->constraints.first; con; con=con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- if(ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER,
+ if (ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER,
CONSTRAINT_TYPE_OBJECTSOLVER))
{
obt->recalc |= OB_RECALC_OB;
@@ -2576,11 +2588,11 @@ static void dag_id_flush_update(Scene *sce, ID *id)
}
}
- if(sce->nodetree) {
+ if (sce->nodetree) {
bNode *node;
- for(node= sce->nodetree->nodes.first; node; node= node->next) {
- if(node->id==id) {
+ for (node= sce->nodetree->nodes.first; node; node= node->next) {
+ if (node->id==id) {
nodeUpdate(sce->nodetree, node);
}
}
@@ -2590,10 +2602,10 @@ static void dag_id_flush_update(Scene *sce, ID *id)
/* camera's matrix is used to orient reconstructed stuff,
* so it should happen tracking-related constraints recalculation
* when camera is changing (sergey) */
- if(sce->camera && &sce->camera->id == id) {
+ if (sce->camera && &sce->camera->id == id) {
MovieClip *clip = object_get_movieclip(sce, sce->camera, 1);
- if(clip)
+ if (clip)
dag_id_flush_update(sce, &clip->id);
}
@@ -2611,21 +2623,21 @@ void DAG_ids_flush_tagged(Main *bmain)
dag_current_scene_layers(bmain, &sce, &lay);
- if(!sce || !sce->theDag)
+ if (!sce || !sce->theDag)
return;
/* loop over all ID types */
a = set_listbasepointers(bmain, lbarray);
- while(a--) {
+ while (a--) {
ListBase *lb = lbarray[a];
ID *id = lb->first;
/* we tag based on first ID type character to avoid
* looping over all ID's in case there are no tags */
- if(id && bmain->id_tag_update[id->name[0]]) {
- for(; id; id=id->next) {
- if(id->flag & (LIB_ID_RECALC|LIB_ID_RECALC_DATA)) {
+ if (id && bmain->id_tag_update[id->name[0]]) {
+ for (; id; id=id->next) {
+ if (id->flag & (LIB_ID_RECALC|LIB_ID_RECALC_DATA)) {
dag_id_flush_update(sce, id);
do_flush = 1;
}
@@ -2634,7 +2646,7 @@ void DAG_ids_flush_tagged(Main *bmain)
}
/* flush changes to other objects */
- if(do_flush)
+ if (do_flush)
DAG_scene_flush_update(bmain, sce, lay, 0);
}
@@ -2646,13 +2658,13 @@ void DAG_ids_check_recalc(Main *bmain, Scene *scene, int time)
/* loop over all ID types */
a = set_listbasepointers(bmain, lbarray);
- while(a--) {
+ while (a--) {
ListBase *lb = lbarray[a];
ID *id = lb->first;
/* we tag based on first ID type character to avoid
* looping over all ID's in case there are no tags */
- if(id && bmain->id_tag_update[id->name[0]]) {
+ if (id && bmain->id_tag_update[id->name[0]]) {
updated= 1;
break;
}
@@ -2669,15 +2681,15 @@ void DAG_ids_clear_recalc(Main *bmain)
/* loop over all ID types */
a = set_listbasepointers(bmain, lbarray);
- while(a--) {
+ while (a--) {
ListBase *lb = lbarray[a];
ID *id = lb->first;
/* we tag based on first ID type character to avoid
* looping over all ID's in case there are no tags */
- if(id && bmain->id_tag_update[id->name[0]]) {
- for(; id; id=id->next)
- if(id->flag & (LIB_ID_RECALC|LIB_ID_RECALC_DATA))
+ if (id && bmain->id_tag_update[id->name[0]]) {
+ for (; id; id=id->next)
+ if (id->flag & (LIB_ID_RECALC|LIB_ID_RECALC_DATA))
id->flag &= ~(LIB_ID_RECALC|LIB_ID_RECALC_DATA);
}
}
@@ -2689,34 +2701,34 @@ void DAG_id_tag_update(ID *id, short flag)
{
Main *bmain= G.main;
- if(id==NULL) return;
+ if (id==NULL) return;
/* tag ID for update */
- if(flag) {
- if(flag & OB_RECALC_OB)
+ if (flag) {
+ if (flag & OB_RECALC_OB)
lib_id_recalc_tag(bmain, id);
- if(flag & (OB_RECALC_DATA|PSYS_RECALC))
+ if (flag & (OB_RECALC_DATA|PSYS_RECALC))
lib_id_recalc_data_tag(bmain, id);
}
else
lib_id_recalc_tag(bmain, id);
/* flag is for objects and particle systems */
- if(flag) {
+ if (flag) {
Object *ob;
ParticleSystem *psys;
short idtype = GS(id->name);
- if(idtype == ID_OB) {
+ if (idtype == ID_OB) {
/* only quick tag */
ob = (Object*)id;
ob->recalc |= (flag & OB_RECALC_ALL);
}
- else if(idtype == ID_PA) {
+ else if (idtype == ID_PA) {
/* this is weak still, should be done delayed as well */
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
- if(&psys->part->id == id) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+ if (&psys->part->id == id) {
ob->recalc |= (flag & OB_RECALC_ALL);
psys->recalc |= (flag & PSYS_RECALC);
lib_id_recalc_tag(bmain, &ob->id);
@@ -2752,20 +2764,20 @@ static int parent_check_node(DagNode *node, int curtime)
node->lasttime= curtime;
- if(node->color==DAG_GRAY)
+ if (node->color==DAG_GRAY)
return DAG_GRAY;
- for(itA = node->child; itA; itA= itA->next) {
- if(itA->node->type==ID_OB) {
+ for (itA = node->child; itA; itA= itA->next) {
+ if (itA->node->type==ID_OB) {
- if(itA->node->color==DAG_GRAY)
+ if (itA->node->color==DAG_GRAY)
return DAG_GRAY;
/* descend if not done */
- if(itA->node->lasttime!=curtime) {
+ if (itA->node->lasttime!=curtime) {
itA->node->color= parent_check_node(itA->node, curtime);
- if(itA->node->color==DAG_GRAY)
+ if (itA->node->color==DAG_GRAY)
return DAG_GRAY;
}
}
@@ -2798,12 +2810,12 @@ void DAG_pose_sort(Object *ob)
rootnode = dag_add_node(dag, NULL); // node->ob becomes NULL
/* we add the hierarchy and the constraints */
- for(pchan = pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan = pose->chanbase.first; pchan; pchan= pchan->next) {
int addtoroot = 1;
node = dag_get_node(dag, pchan);
- if(pchan->parent) {
+ if (pchan->parent) {
node2 = dag_get_node(dag, pchan->parent);
dag_add_relation(dag, node2, node, 0, "Parent Relation");
addtoroot = 0;
@@ -2829,7 +2841,7 @@ void DAG_pose_sort(Object *ob)
int segcount= 0;
/* exclude tip from chain? */
- if(!(data->flag & CONSTRAINT_IK_TIP))
+ if (!(data->flag & CONSTRAINT_IK_TIP))
parchan= pchan->parent;
else
parchan= pchan;
@@ -2865,20 +2877,20 @@ void DAG_pose_sort(Object *ob)
nqueue = queue_create(DAGQUEUEALLOC);
/* tag nodes unchecked */
- for(node = dag->DagNode.first; node; node= node->next)
+ for (node = dag->DagNode.first; node; node= node->next)
node->color = DAG_WHITE;
rootnode->color = DAG_GRAY;
push_stack(nqueue, rootnode);
- while(nqueue->count) {
+ while (nqueue->count) {
skip = 0;
node = get_top_node_queue(nqueue);
itA = node->child;
- while(itA != NULL) {
- if(itA->node->color == DAG_WHITE) {
+ while (itA != NULL) {
+ if (itA->node->color == DAG_WHITE) {
itA->node->color = DAG_GRAY;
push_stack(nqueue,itA->node);
skip = 1;
@@ -2902,7 +2914,7 @@ void DAG_pose_sort(Object *ob)
}
// temporal correction for circular dependancies
- while(pose->chanbase.first) {
+ while (pose->chanbase.first) {
pchan= pose->chanbase.first;
BLI_remlink(&pose->chanbase, pchan);
BLI_addhead(&tempbase, pchan);
@@ -2914,7 +2926,7 @@ void DAG_pose_sort(Object *ob)
queue_delete(nqueue);
// printf("\nordered\n");
-// for(pchan = pose->chanbase.first; pchan; pchan= pchan->next) {
+// for (pchan = pose->chanbase.first; pchan; pchan= pchan->next) {
// printf(" %s\n", pchan->name);
// }
@@ -2931,7 +2943,7 @@ void DAG_print_dependencies(Main *bmain, Scene *scene, Object *ob)
/* utility for debugging dependencies */
dag_print_dependencies= 1;
- if(ob && (ob->mode & OB_MODE_POSE)) {
+ if (ob && (ob->mode & OB_MODE_POSE)) {
printf("\nDEPENDENCY RELATIONS for %s\n\n", ob->id.name+2);
DAG_pose_sort(ob);
}
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index d10c060cc7f..7a34df85bdc 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -62,19 +62,17 @@
#include "BLO_sys_types.h" // for intptr_t support
-extern Material defmaterial; /* material.c */
-
static void boundbox_displist(Object *ob);
void free_disp_elem(DispList *dl)
{
- if(dl) {
- if(dl->verts) MEM_freeN(dl->verts);
- if(dl->nors) MEM_freeN(dl->nors);
- if(dl->index) MEM_freeN(dl->index);
- if(dl->col1) MEM_freeN(dl->col1);
- if(dl->col2) MEM_freeN(dl->col2);
- if(dl->bevelSplitFlag) MEM_freeN(dl->bevelSplitFlag);
+ if (dl) {
+ if (dl->verts) MEM_freeN(dl->verts);
+ if (dl->nors) MEM_freeN(dl->nors);
+ if (dl->index) MEM_freeN(dl->index);
+ if (dl->col1) MEM_freeN(dl->col1);
+ if (dl->col2) MEM_freeN(dl->col2);
+ if (dl->bevelSplitFlag) MEM_freeN(dl->bevelSplitFlag);
MEM_freeN(dl);
}
}
@@ -84,7 +82,7 @@ void freedisplist(ListBase *lb)
DispList *dl;
dl= lb->first;
- while(dl) {
+ while (dl) {
BLI_remlink(lb, dl);
free_disp_elem(dl);
dl= lb->first;
@@ -96,8 +94,8 @@ DispList *find_displist_create(ListBase *lb, int type)
DispList *dl;
dl= lb->first;
- while(dl) {
- if(dl->type==type) return dl;
+ while (dl) {
+ if (dl->type==type) return dl;
dl= dl->next;
}
@@ -113,8 +111,8 @@ DispList *find_displist(ListBase *lb, int type)
DispList *dl;
dl= lb->first;
- while(dl) {
- if(dl->type==type) return dl;
+ while (dl) {
+ if (dl->type==type) return dl;
dl= dl->next;
}
@@ -124,7 +122,7 @@ DispList *find_displist(ListBase *lb, int type)
int displist_has_faces(ListBase *lb)
{
DispList *dl;
- for(dl= lb->first; dl; dl= dl->next) {
+ for (dl= lb->first; dl; dl= dl->next) {
if ELEM3(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)
return 1;
}
@@ -138,7 +136,7 @@ void copy_displist(ListBase *lbn, ListBase *lb)
freedisplist(lbn);
dl= lb->first;
- while(dl) {
+ while (dl) {
dln= MEM_dupallocN(dl);
BLI_addtail(lbn, dln);
@@ -148,7 +146,7 @@ void copy_displist(ListBase *lbn, ListBase *lb)
dln->col1= MEM_dupallocN(dl->col1);
dln->col2= MEM_dupallocN(dl->col2);
- if(dl->bevelSplitFlag)
+ if (dl->bevelSplitFlag)
dln->bevelSplitFlag= MEM_dupallocN(dl->bevelSplitFlag);
dl= dl->next;
@@ -166,22 +164,22 @@ void addnormalsDispList(ListBase *lb)
dl= lb->first;
- while(dl) {
- if(dl->type==DL_INDEX3) {
- if(dl->nors==NULL) {
+ while (dl) {
+ if (dl->type==DL_INDEX3) {
+ if (dl->nors==NULL) {
dl->nors= MEM_callocN(sizeof(float)*3, "dlnors");
- if(dl->verts[2] < 0.0f) dl->nors[2]= -1.0f;
+ if (dl->verts[2] < 0.0f) dl->nors[2]= -1.0f;
else dl->nors[2]= 1.0f;
}
}
- else if(dl->type==DL_SURF) {
- if(dl->nors==NULL) {
+ else if (dl->type==DL_SURF) {
+ if (dl->nors==NULL) {
dl->nors= MEM_callocN(sizeof(float)*3*dl->nr*dl->parts, "dlnors");
vdata= dl->verts;
ndata= dl->nors;
- for(a=0; a<dl->parts; a++) {
+ for (a=0; a<dl->parts; a++) {
if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
break;
@@ -195,7 +193,7 @@ void addnormalsDispList(ListBase *lb)
v4= vdata+ 3*p4;
n4= ndata+ 3*p4;
- for(; b<dl->nr; b++) {
+ for (; b<dl->nr; b++) {
normal_quad_v3( nor,v1, v3, v4, v2);
@@ -212,7 +210,7 @@ void addnormalsDispList(ListBase *lb)
}
a= dl->parts*dl->nr;
v1= ndata;
- while(a--) {
+ while (a--) {
normalize_v3(v1);
v1+= 3;
}
@@ -227,7 +225,7 @@ void count_displist(ListBase *lb, int *totvert, int *totface)
DispList *dl;
dl= lb->first;
- while(dl) {
+ while (dl) {
switch(dl->type) {
case DL_SURF:
@@ -250,17 +248,18 @@ void count_displist(ListBase *lb, int *totvert, int *totface)
int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4)
{
- if((dl->flag & DL_CYCL_V)==0 && a==(dl->parts)-1) {
+ if ((dl->flag & DL_CYCL_V)==0 && a==(dl->parts)-1) {
return 0;
}
- if(dl->flag & DL_CYCL_U) {
+ if (dl->flag & DL_CYCL_U) {
(*p1)= dl->nr*a;
(*p2)= (*p1)+ dl->nr-1;
(*p3)= (*p1)+ dl->nr;
(*p4)= (*p2)+ dl->nr;
(*b)= 0;
- } else {
+ }
+ else {
(*p2)= dl->nr*a;
(*p1)= (*p2)+1;
(*p4)= (*p2)+ dl->nr;
@@ -268,7 +267,7 @@ int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, i
(*b)= 1;
}
- if( (dl->flag & DL_CYCL_V) && a==dl->parts-1) {
+ if ( (dl->flag & DL_CYCL_V) && a==dl->parts-1) {
(*p3)-= dl->nr*dl->parts;
(*p4)-= dl->nr*dl->parts;
}
@@ -288,31 +287,31 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
int a, len, resolu;
nu= nubase->first;
- while(nu) {
- if(nu->hide==0) {
+ while (nu) {
+ if (nu->hide==0) {
- if(forRender && cu->resolu_ren!=0)
+ if (forRender && cu->resolu_ren!=0)
resolu= cu->resolu_ren;
else
resolu= nu->resolu;
- if(!check_valid_nurb_u(nu));
- else if(nu->type == CU_BEZIER) {
+ if (!check_valid_nurb_u(nu));
+ else if (nu->type == CU_BEZIER) {
/* count */
len= 0;
a= nu->pntsu-1;
- if(nu->flagu & CU_NURB_CYCLIC) a++;
+ if (nu->flagu & CU_NURB_CYCLIC) a++;
prevbezt= nu->bezt;
bezt= prevbezt+1;
- while(a--) {
- if(a==0 && (nu->flagu & CU_NURB_CYCLIC)) bezt= nu->bezt;
+ while (a--) {
+ if (a==0 && (nu->flagu & CU_NURB_CYCLIC)) bezt= nu->bezt;
- if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) len++;
+ if (prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) len++;
else len+= resolu;
- if(a==0 && (nu->flagu & CU_NURB_CYCLIC)==0) len++;
+ if (a==0 && (nu->flagu & CU_NURB_CYCLIC)==0) len++;
prevbezt= bezt;
bezt++;
@@ -329,7 +328,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
data= dl->verts;
- if(nu->flagu & CU_NURB_CYCLIC) {
+ if (nu->flagu & CU_NURB_CYCLIC) {
dl->type= DL_POLY;
a= nu->pntsu;
}
@@ -341,16 +340,16 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
prevbezt= nu->bezt;
bezt= prevbezt+1;
- while(a--) {
- if(a==0 && dl->type== DL_POLY) bezt= nu->bezt;
+ while (a--) {
+ if (a==0 && dl->type== DL_POLY) bezt= nu->bezt;
- if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) {
+ if (prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) {
copy_v3_v3(data, prevbezt->vec[1]);
data+= 3;
}
else {
int j;
- for(j=0; j<3; j++) {
+ for (j=0; j<3; j++) {
forward_diff_bezier( prevbezt->vec[1][j],
prevbezt->vec[2][j],
bezt->vec[0][j],
@@ -361,7 +360,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
data+= 3*resolu;
}
- if(a==0 && dl->type==DL_SEGM) {
+ if (a==0 && dl->type==DL_SEGM) {
copy_v3_v3(data, bezt->vec[1]);
}
@@ -369,7 +368,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
bezt++;
}
}
- else if(nu->type == CU_NURBS) {
+ else if (nu->type == CU_NURBS) {
len= (resolu*SEGMENTSU(nu));
dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
@@ -382,11 +381,11 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
dl->charidx = nu->charidx;
data= dl->verts;
- if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
+ if (nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
makeNurbcurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
}
- else if(nu->type == CU_POLY) {
+ else if (nu->type == CU_POLY) {
len= nu->pntsu;
dl= MEM_callocN(sizeof(DispList), "makeDispListpoly");
dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");
@@ -397,12 +396,12 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
dl->charidx = nu->charidx;
data= dl->verts;
- if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
+ if (nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
a= len;
bp= nu->bp;
- while(a--) {
+ while (a--) {
copy_v3_v3(data, bp->vec);
bp++;
data+= 3;
@@ -423,10 +422,10 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
int colnr=0, charidx=0, cont=1, tot, a, *index, nextcol= 0;
intptr_t totvert;
- if(dispbase==NULL) return;
- if(dispbase->first==NULL) return;
+ if (dispbase==NULL) return;
+ if (dispbase->first==NULL) return;
- while(cont) {
+ while (cont) {
cont= 0;
totvert= 0;
nextcol= 0;
@@ -434,34 +433,35 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
BLI_begin_edgefill();
dl= dispbase->first;
- while(dl) {
+ while (dl) {
- if(dl->type==DL_POLY) {
- if(charidx<dl->charidx) cont= 1;
- else if(charidx==dl->charidx) { /* character with needed index */
- if(colnr==dl->col) {
+ if (dl->type==DL_POLY) {
+ if (charidx<dl->charidx) cont= 1;
+ else if (charidx==dl->charidx) { /* character with needed index */
+ if (colnr==dl->col) {
/* make editverts and edges */
f1= dl->verts;
a= dl->nr;
eve= v1= NULL;
- while(a--) {
+ while (a--) {
vlast= eve;
eve= BLI_addfillvert(f1);
totvert++;
- if(vlast==NULL) v1= eve;
+ if (vlast==NULL) v1= eve;
else {
BLI_addfilledge(vlast, eve);
}
f1+=3;
}
- if(eve!=NULL && v1!=NULL) {
+ if (eve!=NULL && v1!=NULL) {
BLI_addfilledge(eve, v1);
}
- } else if (colnr<dl->col) {
+ }
+ else if (colnr<dl->col) {
/* got poly with next material at current char */
cont= 1;
nextcol= 1;
@@ -471,8 +471,8 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
dl= dl->next;
}
- if(totvert && (tot= BLI_edgefill(0))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
- if(tot) {
+ if (totvert && (tot= BLI_edgefill(0))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
+ if (tot) {
dlnew= MEM_callocN(sizeof(DispList), "filldisplist");
dlnew->type= DL_INDEX3;
dlnew->col= colnr;
@@ -486,7 +486,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
f1= dlnew->verts;
totvert= 0;
eve= fillvertbase.first;
- while(eve) {
+ while (eve) {
copy_v3_v3(f1, eve->co);
f1+= 3;
@@ -500,12 +500,12 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
/* index data */
efa= fillfacebase.first;
index= dlnew->index;
- while(efa) {
+ while (efa) {
index[0]= (intptr_t)efa->v1->tmp.l;
index[1]= (intptr_t)efa->v2->tmp.l;
index[2]= (intptr_t)efa->v3->tmp.l;
- if(flipnormal)
+ if (flipnormal)
SWAP(int, index[0], index[2]);
index+= 3;
@@ -518,10 +518,11 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
}
BLI_end_edgefill();
- if(nextcol) {
+ if (nextcol) {
/* stay at current char but fill polys with next material */
colnr++;
- } else {
+ }
+ else {
/* switch to next char and start filling from first material */
charidx++;
colnr= 0;
@@ -542,10 +543,10 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
front.first= front.last= back.first= back.last= NULL;
dl= dispbase->first;
- while(dl) {
- if(dl->type==DL_SURF) {
- if( (dl->flag & DL_CYCL_V) && (dl->flag & DL_CYCL_U)==0 ) {
- if( (cu->flag & CU_BACK) && (dl->flag & DL_BACK_CURVE) ) {
+ while (dl) {
+ if (dl->type==DL_SURF) {
+ if ( (dl->flag & DL_CYCL_V) && (dl->flag & DL_CYCL_U)==0 ) {
+ if ( (cu->flag & CU_BACK) && (dl->flag & DL_BACK_CURVE) ) {
dlnew= MEM_callocN(sizeof(DispList), "filldisp");
BLI_addtail(&front, dlnew);
dlnew->verts= fp1= MEM_mallocN(sizeof(float)*3*dl->parts, "filldisp1");
@@ -559,13 +560,13 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
dpoly= 3*dl->nr;
a= dl->parts;
- while(a--) {
+ while (a--) {
copy_v3_v3(fp1, fp);
fp1+= 3;
fp+= dpoly;
}
}
- if( (cu->flag & CU_FRONT) && (dl->flag & DL_FRONT_CURVE) ) {
+ if ( (cu->flag & CU_FRONT) && (dl->flag & DL_FRONT_CURVE) ) {
dlnew= MEM_callocN(sizeof(DispList), "filldisp");
BLI_addtail(&back, dlnew);
dlnew->verts= fp1= MEM_mallocN(sizeof(float)*3*dl->parts, "filldisp1");
@@ -579,7 +580,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
dpoly= 3*dl->nr;
a= dl->parts;
- while(a--) {
+ while (a--) {
copy_v3_v3(fp1, fp);
fp1+= 3;
fp+= dpoly;
@@ -602,9 +603,9 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
static void curve_to_filledpoly(Curve *cu, ListBase *UNUSED(nurb), ListBase *dispbase)
{
- if(cu->flag & CU_3D) return;
+ if (cu->flag & CU_3D) return;
- if(dispbase->first && ((DispList*) dispbase->first)->type==DL_SURF) {
+ if (dispbase->first && ((DispList*) dispbase->first)->type==DL_SURF) {
bevels_to_filledpoly(cu, dispbase);
}
else {
@@ -621,14 +622,14 @@ float calc_taper(Scene *scene, Object *taperobj, int cur, int tot)
{
DispList *dl;
- if(taperobj==NULL || taperobj->type!=OB_CURVE) return 1.0;
+ if (taperobj==NULL || taperobj->type!=OB_CURVE) return 1.0;
dl= taperobj->disp.first;
- if(dl==NULL) {
+ if (dl==NULL) {
makeDispListCurveTypes(scene, taperobj, 0);
dl= taperobj->disp.first;
}
- if(dl) {
+ if (dl) {
float fac= ((float)cur)/(float)(tot-1);
float minx, dx, *fp;
int a;
@@ -636,16 +637,16 @@ float calc_taper(Scene *scene, Object *taperobj, int cur, int tot)
/* horizontal size */
minx= dl->verts[0];
dx= dl->verts[3*(dl->nr-1)] - minx;
- if(dx > 0.0f) {
+ if (dx > 0.0f) {
fp= dl->verts;
- for(a=0; a<dl->nr; a++, fp+=3) {
- if( (fp[0]-minx)/dx >= fac) {
+ for (a=0; a<dl->nr; a++, fp+=3) {
+ if ( (fp[0]-minx)/dx >= fac) {
/* interpolate with prev */
- if(a>0) {
+ if (a>0) {
float fac1= (fp[-3]-minx)/dx;
float fac2= (fp[0]-minx)/dx;
- if(fac1!=fac2)
+ if (fac1!=fac2)
return fp[1]*(fac1-fac)/(fac1-fac2) + fp[-2]*(fac-fac2)/(fac1-fac2);
}
return fp[1];
@@ -660,16 +661,16 @@ float calc_taper(Scene *scene, Object *taperobj, int cur, int tot)
void makeDispListMBall(Scene *scene, Object *ob)
{
- if(!ob || ob->type!=OB_MBALL) return;
+ if (!ob || ob->type!=OB_MBALL) return;
// XXX: mball stuff uses plenty of global variables
// while this is unchanged updating during render is unsafe
- if(G.rendering) return;
+ if (G.rendering) return;
freedisplist(&(ob->disp));
- if(ob->type==OB_MBALL) {
- if(ob==find_basis_mball(scene, ob)) {
+ if (ob->type==OB_MBALL) {
+ if (ob==find_basis_mball(scene, ob)) {
metaball_polygonize(scene, ob, &ob->disp);
tex_space_mball(ob);
@@ -688,43 +689,44 @@ void makeDispListMBall_forRender(Scene *scene, Object *ob, ListBase *dispbase)
object_deform_mball(ob, dispbase);
}
-static ModifierData *curve_get_tesselate_point(Scene *scene, Object *ob, int forRender, int editmode)
+static ModifierData *curve_get_tessellate_point(Scene *scene, Object *ob, int forRender, int editmode)
{
ModifierData *md = modifiers_getVirtualModifierList(ob);
- ModifierData *preTesselatePoint;
+ ModifierData *pretessellatePoint;
int required_mode;
- if(forRender) required_mode = eModifierMode_Render;
+ if (forRender) required_mode = eModifierMode_Render;
else required_mode = eModifierMode_Realtime;
- if(editmode) required_mode |= eModifierMode_Editmode;
+ if (editmode) required_mode |= eModifierMode_Editmode;
- preTesselatePoint = NULL;
+ pretessellatePoint = NULL;
for (; md; md=md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
if (!modifier_isEnabled(scene, md, required_mode)) continue;
- if (mti->type == eModifierTypeType_Constructive) return preTesselatePoint;
+ if (mti->type == eModifierTypeType_Constructive) return pretessellatePoint;
if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
- preTesselatePoint = md;
+ pretessellatePoint = md;
/* this modifiers are moving point of tessellation automatically
- * (some of them even can't be applied on tesselated curve), set flag
+ * (some of them even can't be applied on tessellated curve), set flag
* for incformation button in modifier's header */
md->mode |= eModifierMode_ApplyOnSpline;
- } else if(md->mode&eModifierMode_ApplyOnSpline) {
- preTesselatePoint = md;
+ }
+ else if (md->mode&eModifierMode_ApplyOnSpline) {
+ pretessellatePoint = md;
}
}
- return preTesselatePoint;
+ return pretessellatePoint;
}
static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, float (**originalVerts_r)[3], float (**deformedVerts_r)[3], int *numVerts_r)
{
ModifierData *md = modifiers_getVirtualModifierList(ob);
- ModifierData *preTesselatePoint;
+ ModifierData *pretessellatePoint;
Curve *cu= ob->data;
ListBase *nurb= BKE_curve_nurbs(cu);
int numVerts = 0;
@@ -734,27 +736,28 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
float *keyVerts= NULL;
int required_mode;
- if(forRender) required_mode = eModifierMode_Render;
+ if (forRender) required_mode = eModifierMode_Render;
else required_mode = eModifierMode_Realtime;
- preTesselatePoint = curve_get_tesselate_point(scene, ob, forRender, editmode);
+ pretessellatePoint = curve_get_tessellate_point(scene, ob, forRender, editmode);
- if(editmode) required_mode |= eModifierMode_Editmode;
+ if (editmode) required_mode |= eModifierMode_Editmode;
- if(cu->editnurb==NULL) {
+ if (cu->editnurb==NULL) {
keyVerts= do_ob_key(scene, ob);
- if(keyVerts) {
+ if (keyVerts) {
/* split coords from key data, the latter also includes
* tilts, which is passed through in the modifier stack.
* this is also the reason curves do not use a virtual
* shape key modifier yet. */
deformedVerts= curve_getKeyVertexCos(cu, nurb, keyVerts);
originalVerts= MEM_dupallocN(deformedVerts);
+ numVerts = count_curveverts_without_handles(nurb);
}
}
- if (preTesselatePoint) {
+ if (pretessellatePoint) {
for (; md; md=md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -771,7 +774,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, forRender, editmode);
- if (md==preTesselatePoint)
+ if (md==pretessellatePoint)
break;
}
}
@@ -781,7 +784,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
if (keyVerts) /* these are not passed through modifier stack */
curve_applyKeyVertexTilts(cu, nurb, keyVerts);
- if(keyVerts)
+ if (keyVerts)
MEM_freeN(keyVerts);
*originalVerts_r = originalVerts;
@@ -827,7 +830,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
DerivedMesh **derivedFinal, int forRender, float (*originalVerts)[3], float (*deformedVerts)[3])
{
ModifierData *md = modifiers_getVirtualModifierList(ob);
- ModifierData *preTesselatePoint;
+ ModifierData *pretessellatePoint;
Curve *cu= ob->data;
ListBase *nurb= BKE_curve_nurbs(cu);
int required_mode = 0, totvert = 0;
@@ -836,15 +839,15 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
float (*vertCos)[3] = NULL;
int useCache = !forRender;
- if(forRender) required_mode = eModifierMode_Render;
+ if (forRender) required_mode = eModifierMode_Render;
else required_mode = eModifierMode_Realtime;
- preTesselatePoint = curve_get_tesselate_point(scene, ob, forRender, editmode);
+ pretessellatePoint = curve_get_tessellate_point(scene, ob, forRender, editmode);
- if(editmode) required_mode |= eModifierMode_Editmode;
+ if (editmode) required_mode |= eModifierMode_Editmode;
- if (preTesselatePoint) {
- md = preTesselatePoint->next;
+ if (pretessellatePoint) {
+ md = pretessellatePoint->next;
}
if (derivedFinal && *derivedFinal) {
@@ -869,14 +872,16 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
}
mti->deformVerts(md, ob, dm, vertCos, totvert, forRender, editmode);
- } else {
+ }
+ else {
if (!vertCos) {
vertCos= displist_get_allverts(dispbase, &totvert);
}
mti->deformVerts(md, ob, NULL, vertCos, totvert, forRender, editmode);
}
- } else {
+ }
+ else {
if (!derivedFinal) {
/* makeDisplistCurveTypes could be used for beveling, where derived mesh */
/* is totally unnecessary, so we could stop modifiers applying */
@@ -893,7 +898,8 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
CDDM_apply_vert_coords(dm, vertCos);
CDDM_calc_normals_mapping(dm);
}
- } else {
+ }
+ else {
if (vertCos) {
displist_apply_allverts(dispbase, vertCos);
}
@@ -934,7 +940,8 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
CDDM_apply_vert_coords(dm, vertCos);
CDDM_calc_normals_mapping(dm);
MEM_freeN(vertCos);
- } else {
+ }
+ else {
displist_apply_allverts(dispbase, vertCos);
MEM_freeN(vertCos);
vertCos= NULL;
@@ -962,12 +969,12 @@ static void displist_surf_indices(DispList *dl)
index=dl->index= MEM_mallocN( 4*sizeof(int)*(dl->parts+1)*(dl->nr+1), "index array nurbs");
- for(a=0; a<dl->parts; a++) {
+ for (a=0; a<dl->parts; a++) {
if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
break;
- for(; b<dl->nr; b++, index+=4) {
+ for (; b<dl->nr; b++, index+=4) {
index[0]= p1;
index[1]= p2;
index[2]= p4;
@@ -1005,10 +1012,10 @@ static void add_orco_dm(Scene *scene, Object *ob, DerivedMesh *dm, DerivedMesh *
totvert= dm->getNumVerts(dm);
- if(orcodm) {
+ if (orcodm) {
orco= MEM_callocN(sizeof(float)*3*totvert, "dm orco");
- if(orcodm->getNumVerts(orcodm) == totvert)
+ if (orcodm->getNumVerts(orcodm) == totvert)
orcodm->getVertCos(orcodm, orco);
else
dm->getVertCos(dm, orco);
@@ -1017,14 +1024,14 @@ static void add_orco_dm(Scene *scene, Object *ob, DerivedMesh *dm, DerivedMesh *
orco= (float(*)[3])make_orco_curve(scene, ob);
}
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
float *co = orco[a];
co[0] = (co[0]-cu->loc[0])/cu->size[0];
co[1] = (co[1]-cu->loc[1])/cu->size[1];
co[2] = (co[2]-cu->loc[2])/cu->size[2];
}
- if((layerorco = DM_get_vert_data_layer(dm, CD_ORCO))) {
+ if ((layerorco = DM_get_vert_data_layer(dm, CD_ORCO))) {
memcpy(layerorco, orco, sizeof(float)*totvert);
MEM_freeN(orco);
}
@@ -1038,21 +1045,21 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina
/* for displist-based objects */
ModifierData *md = modifiers_getVirtualModifierList(ob);
- ModifierData *preTesselatePoint;
+ ModifierData *pretessellatePoint;
Curve *cu= ob->data;
int required_mode;
int editmode = (!forRender && cu->editnurb);
DerivedMesh *ndm, *orcodm= NULL;
- if(forRender) required_mode = eModifierMode_Render;
+ if (forRender) required_mode = eModifierMode_Render;
else required_mode = eModifierMode_Realtime;
- preTesselatePoint = curve_get_tesselate_point(scene, ob, forRender, editmode);
+ pretessellatePoint = curve_get_tessellate_point(scene, ob, forRender, editmode);
- if(editmode) required_mode |= eModifierMode_Editmode;
+ if (editmode) required_mode |= eModifierMode_Editmode;
- if (preTesselatePoint) {
- md = preTesselatePoint->next;
+ if (pretessellatePoint) {
+ md = pretessellatePoint->next;
}
for (; md; md=md->next) {
@@ -1064,14 +1071,14 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina
if (mti->isDisabled && mti->isDisabled(md, forRender)) continue;
if (mti->type!=eModifierTypeType_Constructive) continue;
- if(!orcodm)
+ if (!orcodm)
orcodm= create_orco_dm(scene, ob);
ndm = mti->applyModifier(md, ob, orcodm, forRender, 0);
- if(ndm) {
+ if (ndm) {
/* if the modifier returned a new dm, release the old one */
- if(orcodm && orcodm != ndm) {
+ if (orcodm && orcodm != ndm) {
orcodm->release(orcodm);
}
orcodm = ndm;
@@ -1081,7 +1088,7 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina
/* add an orco layer if needed */
add_orco_dm(scene, ob, derivedFinal, orcodm);
- if(orcodm)
+ if (orcodm)
orcodm->release(orcodm);
}
@@ -1098,24 +1105,24 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
float (*originalVerts)[3];
float (*deformedVerts)[3];
- if(!forRender && cu->editnurb)
+ if (!forRender && cu->editnurb)
nubase= curve_editnurbs(cu);
else
nubase= &cu->nurb;
- if(!forOrco)
+ if (!forOrco)
curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts);
for (nu=nubase->first; nu; nu=nu->next) {
- if(forRender || nu->hide==0) {
+ if (forRender || nu->hide==0) {
int resolu= nu->resolu, resolv= nu->resolv;
- if(forRender) {
- if(cu->resolu_ren) resolu= cu->resolu_ren;
- if(cu->resolv_ren) resolv= cu->resolv_ren;
+ if (forRender) {
+ if (cu->resolu_ren) resolu= cu->resolu_ren;
+ if (cu->resolv_ren) resolv= cu->resolv_ren;
}
- if(nu->pntsv==1) {
+ if (nu->pntsv==1) {
len= SEGMENTSU(nu)*resolu;
dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
@@ -1132,7 +1139,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
dl->rt= nu->flag & ~CU_2D;
data= dl->verts;
- if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
+ if (nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
makeNurbcurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
@@ -1156,8 +1163,8 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
dl->parts= (nu->pntsu*resolu); /* in reverse, because makeNurbfaces works that way */
dl->nr= (nu->pntsv*resolv);
- if(nu->flagv & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */
- if(nu->flagu & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_V;
+ if (nu->flagv & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */
+ if (nu->flagu & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_V;
makeNurbfaces(nu, data, 0, resolu, resolv);
@@ -1176,7 +1183,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
tex_space_curve(cu);
}
- if(!forOrco)
+ if (!forOrco)
curve_calc_modifiers_post(scene, ob, dispbase, derivedFinal,
forRender, originalVerts, deformedVerts);
}
@@ -1188,7 +1195,7 @@ static void rotateBevelPiece(Curve *cu, BevPoint *bevp, DispList *dlb, float wid
fp = dlb->verts;
for (b = 0; b<dlb->nr; b++,fp += 3,data += 3) {
- if(cu->flag & CU_3D) {
+ if (cu->flag & CU_3D) {
float vec[3];
vec[0] = fp[1]+widfac;
@@ -1241,9 +1248,9 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
Curve *cu = ob->data;
/* we do allow duplis... this is only displist on curve level */
- if(!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return;
+ if (!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return;
- if(ob->type==OB_SURF) {
+ if (ob->type==OB_SURF) {
makeDispListSurf(scene, ob, dispbase, derivedFinal, forRender, forOrco);
}
else if (ELEM(ob->type, OB_CURVE, OB_FONT)) {
@@ -1257,12 +1264,12 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
BLI_freelistN(&(cu->bev));
- if(cu->path) free_path(cu->path);
+ if (cu->path) free_path(cu->path);
cu->path= NULL;
- if(ob->type==OB_FONT) BKE_text_to_curve(G.main, scene, ob, 0);
+ if (ob->type==OB_FONT) BKE_text_to_curve(G.main, scene, ob, 0);
- if(!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts);
+ if (!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts);
makeBevelList(ob);
@@ -1272,7 +1279,8 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
/* no bevel or extrude, and no width correction? */
if (!dlbev.first && cu->width==1.0f) {
curve_to_displist(cu, nubase, dispbase, forRender);
- } else {
+ }
+ else {
float widfac= cu->width - 1.0f;
BevList *bl= cu->bev.first;
Nurb *nu= nubase->first;
@@ -1286,15 +1294,15 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
if (bl->nr) { /* blank bevel lists can happen */
/* exception handling; curve without bevel or extrude, with width correction */
- if(dlbev.first==NULL) {
+ if (dlbev.first==NULL) {
dl= MEM_callocN(sizeof(DispList), "makeDispListbev");
dl->verts= MEM_callocN(3*sizeof(float)*bl->nr, "dlverts");
BLI_addtail(dispbase, dl);
- if(bl->poly!= -1) dl->type= DL_POLY;
+ if (bl->poly!= -1) dl->type= DL_POLY;
else dl->type= DL_SEGM;
- if(dl->type==DL_SEGM) dl->flag = (DL_FRONT_CURVE|DL_BACK_CURVE);
+ if (dl->type==DL_SEGM) dl->flag = (DL_FRONT_CURVE|DL_BACK_CURVE);
dl->parts= 1;
dl->nr= bl->nr;
@@ -1308,7 +1316,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
a= dl->nr;
bevp= (BevPoint *)(bl+1);
data= dl->verts;
- while(a--) {
+ while (a--) {
data[0]= bevp->vec[0]+widfac*bevp->sina;
data[1]= bevp->vec[1]+widfac*bevp->cosa;
data[2]= bevp->vec[2];
@@ -1330,8 +1338,8 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
dl->type= DL_SURF;
dl->flag= dlb->flag & (DL_FRONT_CURVE|DL_BACK_CURVE);
- if(dlb->type==DL_POLY) dl->flag |= DL_CYCL_U;
- if(bl->poly>=0) dl->flag |= DL_CYCL_V;
+ if (dlb->type==DL_POLY) dl->flag |= DL_CYCL_U;
+ if (bl->poly>=0) dl->flag |= DL_CYCL_V;
dl->parts= bl->nr;
dl->nr= dlb->nr;
@@ -1346,12 +1354,13 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
/* for each point of poly make a bevel piece */
bevp= (BevPoint *)(bl+1);
- for(a=0; a<bl->nr; a++,bevp++) {
+ for (a=0; a<bl->nr; a++,bevp++) {
float fac=1.0;
if (cu->taperobj==NULL) {
if ( (cu->bevobj!=NULL) || !((cu->flag & CU_FRONT) || (cu->flag & CU_BACK)) )
fac = bevp->radius;
- } else {
+ }
+ else {
fac = calc_taper(scene, cu->taperobj, a, bl->nr);
}
@@ -1374,7 +1383,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
displist_surf_indices(dl);
}
- if(bottom_capbase.first) {
+ if (bottom_capbase.first) {
filldisplist(&bottom_capbase, dispbase, 1);
filldisplist(&top_capbase, dispbase, 0);
freedisplist(&bottom_capbase);
@@ -1391,7 +1400,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
curve_to_filledpoly(cu, nubase, dispbase);
}
- if(cu->flag & CU_PATH) calc_curvepath(ob);
+ if (cu->flag & CU_PATH) calc_curvepath(ob);
/* make copy of 'undeformed" displist for texture space calculation
* actually, it's not totally undeformed -- pre-tessellation modifiers are
@@ -1402,7 +1411,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
tex_space_curve(cu);
}
- if(!forOrco) curve_calc_modifiers_post(scene, ob, dispbase, derivedFinal, forRender, originalVerts, deformedVerts);
+ if (!forOrco) curve_calc_modifiers_post(scene, ob, dispbase, derivedFinal, forRender, originalVerts, deformedVerts);
if (cu->flag & CU_DEFORM_FILL && !ob->derivedFinal) {
curve_to_filledpoly(cu, nubase, dispbase);
@@ -1418,7 +1427,7 @@ void makeDispListCurveTypes(Scene *scene, Object *ob, int forOrco)
/* The same check for duplis as in do_makeDispListCurveTypes.
* Happens when curve used for constraint/bevel was converted to mesh.
* check there is still needed for render displist and orco displists. */
- if(!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return;
+ if (!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return;
freedisplist(&(ob->disp));
dispbase= &(ob->disp);
@@ -1431,7 +1440,8 @@ void makeDispListCurveTypes(Scene *scene, Object *ob, int forOrco)
if (ob->derivedFinal) {
DM_set_object_boundbox (ob, ob->derivedFinal);
- } else {
+ }
+ else {
boundbox_displist (ob);
/* if there is no derivedMesh, object's boundbox is unneeded */
@@ -1467,7 +1477,7 @@ float *makeOrcoDispList(Scene *scene, Object *ob, DerivedMesh *derivedFinal, int
orco= derivedFinal->getVertDataArray(derivedFinal, CD_ORCO);
- if(orco) {
+ if (orco) {
orco= MEM_dupallocN(orco);
}
@@ -1485,21 +1495,21 @@ static void boundbox_displist(Object *ob)
INIT_MINMAX(min, max);
- if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
+ if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
Curve *cu= ob->data;
int doit= 0;
- if(cu->bb==NULL) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
+ if (cu->bb==NULL) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
bb= cu->bb;
dl= ob->disp.first;
while (dl) {
- if(dl->type==DL_INDEX3) tot= dl->nr;
+ if (dl->type==DL_INDEX3) tot= dl->nr;
else tot= dl->nr*dl->parts;
vert= dl->verts;
- for(a=0; a<tot; a++, vert+=3) {
+ for (a=0; a<tot; a++, vert+=3) {
doit= 1;
DO_MINMAX(vert, min, max);
}
@@ -1507,7 +1517,7 @@ static void boundbox_displist(Object *ob)
dl= dl->next;
}
- if(!doit) {
+ if (!doit) {
/* there's no geometry in displist, use zero-sized boundbox */
zero_v3(min);
zero_v3(max);
@@ -1515,7 +1525,7 @@ static void boundbox_displist(Object *ob)
}
- if(bb) {
+ if (bb) {
boundbox_set_from_min_max(bb, min, max);
}
}
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 2c7814a6a43..70b55356e6a 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -246,8 +246,8 @@ struct DynamicPaintSurface *get_activeSurface(DynamicPaintCanvasSettings *canvas
DynamicPaintSurface *surface = canvas->surfaces.first;
int i;
- for(i=0; surface; surface=surface->next) {
- if(i == canvas->active_sur)
+ for (i=0; surface; surface=surface->next) {
+ if (i == canvas->active_sur)
return surface;
i++;
}
@@ -260,7 +260,7 @@ void dynamicPaint_resetPreview(DynamicPaintCanvasSettings *canvas)
DynamicPaintSurface *surface = canvas->surfaces.first;
int done=0;
- for(; surface; surface=surface->next) {
+ for (; surface; surface=surface->next) {
if (!done && dynamicPaint_surfaceHasColorPreview(surface)) {
surface->flags |= MOD_DPAINT_PREVIEW;
done=1;
@@ -274,7 +274,7 @@ void dynamicPaint_resetPreview(DynamicPaintCanvasSettings *canvas)
static void dynamicPaint_setPreview(DynamicPaintSurface *t_surface)
{
DynamicPaintSurface *surface = t_surface->canvas->surfaces.first;
- for(; surface; surface=surface->next) {
+ for (; surface; surface=surface->next) {
if (surface == t_surface)
surface->flags |= MOD_DPAINT_PREVIEW;
else
@@ -310,7 +310,7 @@ static int surface_duplicateOutputExists(void *arg, const char *name)
DynamicPaintSurface *t_surface = (DynamicPaintSurface*)arg;
DynamicPaintSurface *surface = t_surface->canvas->surfaces.first;
- for(; surface; surface=surface->next) {
+ for (; surface; surface=surface->next) {
if (surface!=t_surface && surface->type==t_surface->type &&
surface->format==t_surface->format) {
if (surface->output_name[0]!='\0' && !BLI_path_cmp(name, surface->output_name)) return 1;
@@ -336,7 +336,7 @@ static int surface_duplicateNameExists(void *arg, const char *name)
DynamicPaintSurface *t_surface = (DynamicPaintSurface*)arg;
DynamicPaintSurface *surface = t_surface->canvas->surfaces.first;
- for(; surface; surface=surface->next) {
+ for (; surface; surface=surface->next) {
if (surface!=t_surface && !strcmp(name, surface->name)) return 1;
}
return 0;
@@ -455,8 +455,8 @@ static void object_cacheIgnoreClear(Object *ob, int state)
PTCacheID *pid;
BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pid->cache) {
+ for (pid=pidlist.first; pid; pid=pid->next) {
+ if (pid->cache) {
if (state)
pid->cache->flag |= PTCACHE_IGNORE_CLEAR;
else
@@ -472,7 +472,7 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, float fram
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
bConstraint *con;
- /* if other is dynamic paint canvas, dont update */
+ /* if other is dynamic paint canvas, don't update */
if (pmd && pmd->canvas)
return 1;
@@ -506,7 +506,7 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, float fram
}
}
/* for curve following objects, parented curve has to be updated too */
- if(ob->type==OB_CURVE) {
+ if (ob->type==OB_CURVE) {
Curve *cu= ob->data;
BKE_animsys_evaluate_animdata(scene, &cu->id, cu->adt, frame, ADT_RECALC_ANIM);
}
@@ -542,7 +542,7 @@ static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene)
int flags = 0;
- if(surface->brush_group)
+ if (surface->brush_group)
go = surface->brush_group->gobject.first;
else
base = scene->base.first;
@@ -552,26 +552,26 @@ static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene)
brushObj = NULL;
/* select object */
- if(surface->brush_group) {
- if(go->ob) brushObj = go->ob;
+ if (surface->brush_group) {
+ if (go->ob) brushObj = go->ob;
}
else
brushObj = base->object;
- if(!brushObj)
+ if (!brushObj)
{
- if(surface->brush_group) go = go->next;
+ if (surface->brush_group) go = go->next;
else base= base->next;
continue;
}
- if(surface->brush_group)
+ if (surface->brush_group)
go = go->next;
else
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;
@@ -832,15 +832,15 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface)
/* Free brush data */
void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd)
{
- if(pmd->brush) {
- if(pmd->brush->dm)
+ if (pmd->brush) {
+ if (pmd->brush->dm)
pmd->brush->dm->release(pmd->brush->dm);
pmd->brush->dm = NULL;
- if(pmd->brush->paint_ramp)
+ if (pmd->brush->paint_ramp)
MEM_freeN(pmd->brush->paint_ramp);
pmd->brush->paint_ramp = NULL;
- if(pmd->brush->vel_ramp)
+ if (pmd->brush->vel_ramp)
MEM_freeN(pmd->brush->vel_ramp);
pmd->brush->vel_ramp = NULL;
@@ -922,7 +922,7 @@ void dynamicPaint_freeSurface(DynamicPaintSurface *surface)
BKE_ptcache_free_list(&(surface->ptcaches));
surface->pointcache = NULL;
- if(surface->effector_weights)
+ if (surface->effector_weights)
MEM_freeN(surface->effector_weights);
surface->effector_weights = NULL;
@@ -934,7 +934,7 @@ void dynamicPaint_freeSurface(DynamicPaintSurface *surface)
/* Free canvas data */
void dynamicPaint_freeCanvas(DynamicPaintModifierData *pmd)
{
- if(pmd->canvas) {
+ if (pmd->canvas) {
/* Free surface data */
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
DynamicPaintSurface *next_surface = NULL;
@@ -958,7 +958,7 @@ void dynamicPaint_freeCanvas(DynamicPaintModifierData *pmd)
/* Free whole dp modifier */
void dynamicPaint_Modifier_free(struct DynamicPaintModifierData *pmd)
{
- if(pmd) {
+ if (pmd) {
dynamicPaint_freeCanvas(pmd);
dynamicPaint_freeBrush(pmd);
}
@@ -1047,10 +1047,10 @@ struct DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSett
*/
int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene)
{
- if(pmd) {
- if(type == MOD_DYNAMICPAINT_TYPE_CANVAS) {
+ if (pmd) {
+ if (type == MOD_DYNAMICPAINT_TYPE_CANVAS) {
DynamicPaintCanvasSettings *canvas;
- if(pmd->canvas)
+ if (pmd->canvas)
dynamicPaint_freeCanvas(pmd);
canvas = pmd->canvas = MEM_callocN(sizeof(DynamicPaintCanvasSettings), "DynamicPaint Canvas");
@@ -1064,9 +1064,9 @@ int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, stru
return 0;
}
- else if(type == MOD_DYNAMICPAINT_TYPE_BRUSH) {
+ else if (type == MOD_DYNAMICPAINT_TYPE_BRUSH) {
DynamicPaintBrushSettings *brush;
- if(pmd->brush)
+ if (pmd->brush)
dynamicPaint_freeBrush(pmd);
brush = pmd->brush = MEM_callocN(sizeof(DynamicPaintBrushSettings), "DynamicPaint Paint");
@@ -1148,8 +1148,8 @@ void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct Dyn
/* Copy data */
if (tpmd->canvas) {
tpmd->canvas->pmd = tpmd;
-
- } else if (tpmd->brush) {
+ }
+ else if (tpmd->brush) {
DynamicPaintBrushSettings *brush = pmd->brush, *t_brush = tpmd->brush;
t_brush->pmd = tpmd;
@@ -1506,7 +1506,7 @@ int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
/* free existing data */
if (surface->data) dynamicPaint_freeSurfaceData(surface);
- /* dont reallocate for image sequence types. they get handled only on bake */
+ /* don't reallocate for image sequence types. they get handled only on bake */
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) return 1;
if (numOfPoints < 1) return 0;
@@ -1574,7 +1574,7 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
{
DerivedMesh *result = CDDM_copy(dm);
- if(pmd->canvas && !(pmd->canvas->flags & MOD_DPAINT_BAKING)) {
+ if (pmd->canvas && !(pmd->canvas->flags & MOD_DPAINT_BAKING)) {
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
int update_normals = 0;
@@ -1612,17 +1612,21 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
MPoly *mp = CDDM_get_polys(result);
int totpoly = result->numPolyData;
- /* XXX We have to create a CD_WEIGHT_MCOL, else it might sigsev
+#if 0
+ /* XXX We have to create a CD_PREVIEW_MCOL, else it might sigsev
* (after a SubSurf mod, eg)... */
- if(!result->getTessFaceDataArray(result, CD_WEIGHT_MCOL)) {
+ if (!result->getTessFaceDataArray(result, CD_PREVIEW_MCOL)) {
int numFaces = result->getNumTessFaces(result);
- CustomData_add_layer(&result->faceData, CD_WEIGHT_MCOL, CD_CALLOC, NULL, numFaces);
+ CustomData_add_layer(&result->faceData, CD_PREVIEW_MCOL, CD_CALLOC, NULL, numFaces);
}
+#endif
/* Save preview results to weight layer to be
* able to share same drawing methods */
- col = CustomData_get_layer(&result->loopData, CD_WEIGHT_MLOOPCOL);
- if (!col) col = CustomData_add_layer(&result->loopData, CD_WEIGHT_MLOOPCOL, CD_CALLOC, NULL, totloop);
+ col = CustomData_get_layer(&result->loopData, CD_PREVIEW_MLOOPCOL);
+ if (!col)
+ col = CustomData_add_layer(&result->loopData, CD_PREVIEW_MLOOPCOL, CD_CALLOC,
+ NULL, totloop);
if (col) {
#pragma omp parallel for schedule(static)
@@ -1653,15 +1657,13 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
/* mix surface color */
interp_v3_v3v3(c, c, &fcolor[v_index], fcolor[v_index+3]);
- col[l_index].r = FTOCHAR(c[2]);
- col[l_index].g = FTOCHAR(c[1]);
- col[l_index].b = FTOCHAR(c[0]);
+ rgb_float_to_uchar((unsigned char *)&col[l_index].r, c);
}
else {
- col[l_index].a = 255;
col[l_index].r =
col[l_index].g =
col[l_index].b = FTOCHAR(pPoint[v_index].wetness);
+ col[l_index].a = 255;
}
}
}
@@ -1681,10 +1683,8 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
#pragma omp parallel for schedule(static)
for (i=0; i<totloop; i++) {
int index = mloop[i].v*4;
- col[i].a = FTOCHAR(fcolor[index+3]);
- col[i].r = FTOCHAR(fcolor[index+2]);
- col[i].g = FTOCHAR(fcolor[index+1]);
- col[i].b = FTOCHAR(fcolor[index]);
+ rgb_float_to_uchar((unsigned char *)&col[i].r, &fcolor[index]);
+ col[i].a = FTOCHAR(fcolor[index+3]); /* IS THIS NEEDED? */
}
}
@@ -1700,12 +1700,15 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
#pragma omp parallel for schedule(static)
for (i=0; i<totloop; i++) {
int index = mloop[i].v;
- col[i].a = 255;
col[i].r =
col[i].g =
col[i].b = FTOCHAR(pPoint[index].wetness);
+ col[i].a = 255;
}
}
+
+ /* Mark tessellated CD layers as dirty. */
+ result->dirty |= DM_DIRTY_TESS_CDLAYERS;
}
/* vertex group paint */
else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
@@ -1716,7 +1719,8 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
/* viewport preview */
if (surface->flags & MOD_DPAINT_PREVIEW) {
/* Save preview results to weight layer to be
- * able to share same drawing methods */
+ * able to share same drawing methods.
+ * Note this func also sets DM_DIRTY_TESS_CDLAYERS flag! */
DM_update_weight_mcol(ob, result, 0, weight, 0, NULL);
}
@@ -1726,7 +1730,7 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
NULL, sData->total_points, surface->output_name);
if (defgrp_index >= 0 && dvert) {
int i;
- for(i=0; i<sData->total_points; i++) {
+ for (i=0; i<sData->total_points; i++) {
MDeformVert *dv= &dvert[i];
MDeformWeight *def_weight = defvert_find_index(dv, defgrp_index);
@@ -1800,7 +1804,7 @@ void canvas_copyDerivedMesh(DynamicPaintCanvasSettings *canvas, DerivedMesh *dm)
*/
static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene, Object *ob, DerivedMesh *dm)
{
- if(pmd->canvas) {
+ if (pmd->canvas) {
DynamicPaintCanvasSettings *canvas = pmd->canvas;
DynamicPaintSurface *surface = canvas->surfaces.first;
@@ -1839,7 +1843,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
BKE_ptcache_id_time(&pid, scene, (float)scene->r.cfra, NULL, NULL, NULL);
/* reset non-baked cache at first frame */
- if((int)scene->r.cfra == surface->start_frame && !(cache->flag & PTCACHE_BAKED))
+ if ((int)scene->r.cfra == surface->start_frame && !(cache->flag & PTCACHE_BAKED))
{
cache->flag |= PTCACHE_REDO_NEEDED;
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
@@ -1847,7 +1851,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
}
/* try to read from cache */
- if(BKE_ptcache_read(&pid, (float)scene->r.cfra)) {
+ if (BKE_ptcache_read(&pid, (float)scene->r.cfra)) {
BKE_ptcache_validate(cache, (int)scene->r.cfra);
}
/* if read failed and we're on surface range do recalculate */
@@ -2335,7 +2339,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
int index = tx+w*ty;
PaintUVPoint *tPoint = (&tempPoints[index]);
- /* If point isnt't on canvas mesh */
+ /* If point isn't't on canvas mesh */
if (tPoint->face_index == -1) {
int u_min, u_max, v_min, v_max;
int u,v, ind;
@@ -2495,7 +2499,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
sData->total_points = active_points;
sData->format_data = f_data;
- for(index = 0; index < (w*h); index++) {
+ for (index = 0; index < (w*h); index++) {
if (tempPoints[index].face_index != -1) {
memcpy(&f_data->uv_p[cursor], &tempPoints[index], sizeof(PaintUVPoint));
memcpy(&f_data->barycentricWeights[cursor*aa_samples], &tempWeights[index*aa_samples], sizeof(Vec3f)*aa_samples);
@@ -2639,7 +2643,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char* filenam
}
}
- /* Set output format, png in case exr isnt supported */
+ /* Set output format, png in case exr isn't supported */
ibuf->ftype= PNG|95;
#ifdef WITH_OPENEXR
if (format == R_IMF_IMTYPE_OPENEXR) { /* OpenEXR 32-bit float */
@@ -2756,7 +2760,7 @@ static void mesh_faces_spherecast_dp(void *userdata, int index, const BVHTreeRay
{
float dist = bvhtree_ray_tri_intersection(ray, hit->dist, t0, t1, t2);
- if(dist >= 0 && dist < hit->dist)
+ if (dist >= 0 && dist < hit->dist)
{
hit->index = index;
hit->dist = dist;
@@ -2768,7 +2772,7 @@ static void mesh_faces_spherecast_dp(void *userdata, int index, const BVHTreeRay
t3 = NULL;
quad = 1;
- } while(t2);
+ } while (t2);
}
/* A modified callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_faces.
@@ -2796,7 +2800,7 @@ static void mesh_faces_nearest_point_dp(void *userdata, int index, const float *
int vertex, edge;
dist = nearest_point_in_tri_surface(t0, t1, t2, co, &vertex, &edge, nearest_tmp);
- if(dist < nearest->dist)
+ if (dist < nearest->dist)
{
nearest->index = index;
nearest->dist = dist;
@@ -2809,7 +2813,7 @@ static void mesh_faces_nearest_point_dp(void *userdata, int index, const float *
t3 = NULL;
quad = 1;
- } while(t2);
+ } while (t2);
}
@@ -3183,7 +3187,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
}
/* check bounding box collision */
- if(grid && meshBrush_boundsIntersect(&grid->grid_bounds, &mesh_bb, brush, brush_radius))
+ 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))
{
@@ -3260,7 +3264,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
/* Check volume collision */
if (brush->collision == MOD_DPAINT_COL_VOLUME || brush->collision == MOD_DPAINT_COL_VOLDIST)
- if(BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1)
+ if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1)
{
/* We hit a triangle, now check if collision point normal is facing the point */
@@ -3287,7 +3291,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData);
- if(hit.index != -1) {
+ if (hit.index != -1) {
/* Add factor on supersample filter */
volume_factor = 1.0f;
hit_found = HIT_VOLUME;
@@ -3339,7 +3343,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
hit.dist = brush_radius;
/* Do a face normal directional raycast, and use that distance */
- if(BLI_bvhtree_ray_cast(treeData.tree, ray_start, proj_ray, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1)
+ if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, proj_ray, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1)
{
proxDist = hit.dist;
madd_v3_v3v3fl(hitCo, ray_start, proj_ray, hit.dist); /* Calculate final hit coordinates */
@@ -3552,12 +3556,12 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
tree= BLI_kdtree_new(psys->totpart);
/* loop through particles and insert valid ones to the tree */
- for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++) {
+ for (p=0, pa=psys->particles; p<psys->totpart; p++, pa++) {
/* Proceed only if particle is active */
- if(pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0) continue;
- else if(pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0) continue;
- else if(pa->flag & PARS_UNEXIST) continue;
+ if (pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0) continue;
+ else if (pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0) continue;
+ else if (pa->flag & PARS_UNEXIST) continue;
/* for debug purposes check if any NAN particle proceeds
* For some reason they get past activity check, this should rule most of them out */
@@ -3664,7 +3668,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
particles = BLI_kdtree_range_search(tree, max_range, bData->realCoord[bData->s_pos[index]].v, NULL, &nearest);
/* Find particle that produces highest influence */
- for(n=0; n<particles; n++) {
+ for (n=0; n<particles; n++) {
ParticleData *pa = psys->particles + nearest[n].index;
float s_range;
@@ -4788,7 +4792,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
float scene_subframe = scene->r.subframe;
/* either from group or from all objects */
- if(surface->brush_group)
+ if (surface->brush_group)
go = surface->brush_group->gobject.first;
else
base = scene->base.first;
@@ -4797,28 +4801,28 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
{
brushObj = NULL;
/* select object */
- if(surface->brush_group) {
- if(go->ob) brushObj = go->ob;
+ if (surface->brush_group) {
+ if (go->ob) brushObj = go->ob;
}
else
brushObj = base->object;
- if(!brushObj) {
+ if (!brushObj) {
/* skip item */
- if(surface->brush_group) go = go->next;
+ if (surface->brush_group) go = go->next;
else base= base->next;
continue;
}
/* next item */
- if(surface->brush_group)
+ if (surface->brush_group)
go = go->next;
else
base= base->next;
/* 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 */
@@ -4935,7 +4939,7 @@ int dynamicPaint_calculateFrame(DynamicPaintSurface *surface, Scene *scene, Obje
/* update bake data */
dynamicPaint_generateBakeData(surface, scene, cObject);
- /* dont do substeps for first frame */
+ /* don't do substeps for first frame */
if (surface->substeps && (frame != surface->start_frame)) {
int st;
timescale = 1.0f / (surface->substeps+1);
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index ff798f5f2a1..693a155c23d 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -69,12 +69,12 @@
extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
-BMEditMesh *BMEdit_Create(BMesh *bm, int do_tesselate)
+BMEditMesh *BMEdit_Create(BMesh *bm, int do_tessellate)
{
BMEditMesh *tm = MEM_callocN(sizeof(BMEditMesh), __func__);
tm->bm = bm;
- if (do_tesselate) {
+ if (do_tessellate) {
BMEdit_RecalcTessellation(tm);
}
@@ -803,7 +803,7 @@ static void emDM_drawFacesTex_common(
luv[0] = luv[1] = luv[2] = &dummyluv;
- dummylcol.a = dummylcol.r = dummylcol.g = dummylcol.b = 255;
+ dummylcol.r = dummylcol.g = dummylcol.b = dummylcol.a = 255;
/* always use smooth shading even for flat faces, else vertex colors wont interpolate */
glShadeModel(GL_SMOOTH);
@@ -844,17 +844,17 @@ static void emDM_drawFacesTex_common(
glTexCoord2fv(luv[0]->uv);
if (lcol[0])
- glColor3ub(lcol[0]->b, lcol[0]->g, lcol[0]->r);
+ glColor3ubv((const GLubyte *)&(lcol[0]->r));
glVertex3fv(vertexCos[BM_elem_index_get(ls[0]->v)]);
glTexCoord2fv(luv[1]->uv);
if (lcol[1])
- glColor3ub(lcol[1]->b, lcol[1]->g, lcol[1]->r);
+ glColor3ubv((const GLubyte *)&(lcol[1]->r));
glVertex3fv(vertexCos[BM_elem_index_get(ls[1]->v)]);
glTexCoord2fv(luv[2]->uv);
if (lcol[2])
- glColor3ub(lcol[2]->b, lcol[2]->g, lcol[2]->r);
+ glColor3ubv((const GLubyte *)&(lcol[2]->r));
glVertex3fv(vertexCos[BM_elem_index_get(ls[2]->v)]);
}
else {
@@ -862,19 +862,19 @@ static void emDM_drawFacesTex_common(
glTexCoord2fv(luv[0]->uv);
if (lcol[0])
- glColor3ub(lcol[0]->b, lcol[0]->g, lcol[0]->r);
+ glColor3ubv((const GLubyte *)&(lcol[0]->r));
glNormal3fv(vertexNos[BM_elem_index_get(ls[0]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ls[0]->v)]);
glTexCoord2fv(luv[1]->uv);
if (lcol[1])
- glColor3ub(lcol[1]->b, lcol[1]->g, lcol[1]->r);
+ glColor3ubv((const GLubyte *)&(lcol[1]->r));
glNormal3fv(vertexNos[BM_elem_index_get(ls[1]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ls[1]->v)]);
glTexCoord2fv(luv[2]->uv);
if (lcol[2])
- glColor3ub(lcol[2]->b, lcol[2]->g, lcol[2]->r);
+ glColor3ubv((const GLubyte *)&(lcol[2]->r));
glNormal3fv(vertexNos[BM_elem_index_get(ls[2]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ls[2]->v)]);
}
@@ -917,19 +917,19 @@ static void emDM_drawFacesTex_common(
if (luv[0])
glTexCoord2fv(luv[0]->uv);
if (lcol[0])
- glColor3ub(lcol[0]->b, lcol[0]->g, lcol[0]->r);
+ glColor3ubv((const GLubyte *)&(lcol[0]->r));
glVertex3fv(ls[0]->v->co);
if (luv[1])
glTexCoord2fv(luv[1]->uv);
if (lcol[1])
- glColor3ub(lcol[1]->b, lcol[1]->g, lcol[1]->r);
+ glColor3ubv((const GLubyte *)&(lcol[1]->r));
glVertex3fv(ls[1]->v->co);
if (luv[2])
glTexCoord2fv(luv[2]->uv);
if (lcol[2])
- glColor3ub(lcol[2]->b, lcol[2]->g, lcol[2]->r);
+ glColor3ubv((const GLubyte *)&(lcol[2]->r));
glVertex3fv(ls[2]->v->co);
}
else {
@@ -938,21 +938,21 @@ static void emDM_drawFacesTex_common(
if (luv[0])
glTexCoord2fv(luv[0]->uv);
if (lcol[0])
- glColor3ub(lcol[0]->b, lcol[0]->g, lcol[0]->r);
+ glColor3ubv((const GLubyte *)&(lcol[0]->r));
glNormal3fv(ls[0]->v->no);
glVertex3fv(ls[0]->v->co);
if (luv[1])
glTexCoord2fv(luv[1]->uv);
if (lcol[1])
- glColor3ub(lcol[1]->b, lcol[1]->g, lcol[1]->r);
+ glColor3ubv((const GLubyte *)&(lcol[1]->r));
glNormal3fv(ls[1]->v->no);
glVertex3fv(ls[1]->v->co);
if (luv[2])
glTexCoord2fv(luv[2]->uv);
if (lcol[2])
- glColor3ub(lcol[2]->b, lcol[2]->g, lcol[2]->r);
+ glColor3ubv((const GLubyte *)&(lcol[2]->r));
glNormal3fv(ls[2]->v->no);
glVertex3fv(ls[2]->v->co);
}
@@ -1250,7 +1250,8 @@ static void emDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
}
}
else {
- min_r[0] = min_r[1] = min_r[2] = max_r[0] = max_r[1] = max_r[2] = 0.0;
+ zero_v3(min_r);
+ zero_v3(max_r);
}
}
static int emDM_getNumVerts(DerivedMesh *dm)
@@ -1689,7 +1690,7 @@ DerivedMesh *getEditDerivedBMesh(
i = 0;
BM_ITER(efa, &fiter, bm, BM_FACES_OF_MESH, NULL) {
BM_elem_index_set(efa, i); /* set_inline */
- BM_face_normal_update_vcos(bm, efa, bmdm->polyNos[i], vertexCos);
+ BM_face_normal_update_vcos(bm, efa, bmdm->polyNos[i], (float const (*)[3])vertexCos);
i++;
}
bm->elem_index_dirty &= ~BM_FACE;
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 117414060df..cb8220c8fb3 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -105,7 +105,7 @@ EffectorWeights *BKE_add_effector_weights(Group *group)
EffectorWeights *weights = MEM_callocN(sizeof(EffectorWeights), "EffectorWeights");
int i;
- for(i=0; i<NUM_PFIELD_TYPES; i++)
+ for (i=0; i<NUM_PFIELD_TYPES; i++)
weights->weight[i] = 1.0f;
weights->global_gravity = 1.0f;
@@ -157,13 +157,13 @@ typedef struct VeNoCo {
/* -------------------------- Effectors ------------------ */
void free_partdeflect(PartDeflect *pd)
{
- if(!pd)
+ if (!pd)
return;
- if(pd->tex)
+ if (pd->tex)
pd->tex->id.us--;
- if(pd->rng)
+ if (pd->rng)
rng_free(pd->rng);
MEM_freeN(pd);
@@ -172,34 +172,34 @@ void free_partdeflect(PartDeflect *pd)
static void precalculate_effector(EffectorCache *eff)
{
unsigned int cfra = (unsigned int)(eff->scene->r.cfra >= 0 ? eff->scene->r.cfra : -eff->scene->r.cfra);
- if(!eff->pd->rng)
+ if (!eff->pd->rng)
eff->pd->rng = rng_new(eff->pd->seed + cfra);
else
rng_srandom(eff->pd->rng, eff->pd->seed + cfra);
- if(eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type==OB_CURVE) {
+ if (eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type==OB_CURVE) {
Curve *cu= eff->ob->data;
- if(cu->flag & CU_PATH) {
- if(cu->path==NULL || cu->path->data==NULL)
+ if (cu->flag & CU_PATH) {
+ if (cu->path==NULL || cu->path->data==NULL)
makeDispListCurveTypes(eff->scene, eff->ob, 0);
- if(cu->path && cu->path->data) {
+ if (cu->path && cu->path->data) {
where_on_path(eff->ob, 0.0, eff->guide_loc, eff->guide_dir, NULL, &eff->guide_radius, NULL);
mul_m4_v3(eff->ob->obmat, eff->guide_loc);
mul_mat3_m4_v3(eff->ob->obmat, eff->guide_dir);
}
}
}
- else if(eff->pd->shape == PFIELD_SHAPE_SURFACE) {
+ else if (eff->pd->shape == PFIELD_SHAPE_SURFACE) {
eff->surmd = (SurfaceModifierData *)modifiers_findByType ( eff->ob, eModifierType_Surface );
- if(eff->ob->type == OB_CURVE)
+ if (eff->ob->type == OB_CURVE)
eff->flag |= PE_USE_NORMAL_DATA;
}
- else if(eff->psys)
+ else if (eff->psys)
psys_update_particle_tree(eff->psys, eff->scene->r.cfra);
/* Store object velocity */
- if(eff->ob) {
+ if (eff->ob) {
float old_vel[3];
where_is_object_time(eff->scene, eff->ob, cfra - 1.0f);
@@ -225,13 +225,13 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector
{
EffectorCache *eff = NULL;
- if( ob == ob_src || weights->weight[ob->pd->forcefield] == 0.0f )
+ if ( ob == ob_src || weights->weight[ob->pd->forcefield] == 0.0f )
return;
if (ob->pd->shape == PFIELD_SHAPE_POINTS && !ob->derivedFinal )
return;
- if(*effectors == NULL)
+ if (*effectors == NULL)
*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
eff = new_effector_cache(scene, ob, NULL, ob->pd);
@@ -245,21 +245,21 @@ static void add_particles_to_effectors(ListBase **effectors, Scene *scene, Effec
{
ParticleSettings *part= psys->part;
- if( !psys_check_enabled(ob, psys) )
+ if ( !psys_check_enabled(ob, psys) )
return;
- if( psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0)
+ if ( psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0)
return;
- if( part->pd && part->pd->forcefield && weights->weight[part->pd->forcefield] != 0.0f) {
- if(*effectors == NULL)
+ if ( part->pd && part->pd->forcefield && weights->weight[part->pd->forcefield] != 0.0f) {
+ if (*effectors == NULL)
*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
BLI_addtail(*effectors, new_effector_cache(scene, ob, psys, part->pd));
}
if (part->pd2 && part->pd2->forcefield && weights->weight[part->pd2->forcefield] != 0.0f) {
- if(*effectors == NULL)
+ if (*effectors == NULL)
*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
BLI_addtail(*effectors, new_effector_cache(scene, ob, psys, part->pd2));
@@ -273,33 +273,33 @@ ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *psys_src
unsigned int layer= ob_src->lay;
ListBase *effectors = NULL;
- if(weights->group) {
+ if (weights->group) {
GroupObject *go;
- for(go= weights->group->gobject.first; go; go= go->next) {
- if( (go->ob->lay & layer) ) {
- if( go->ob->pd && go->ob->pd->forcefield )
+ for (go= weights->group->gobject.first; go; go= go->next) {
+ if ( (go->ob->lay & layer) ) {
+ if ( go->ob->pd && go->ob->pd->forcefield )
add_object_to_effectors(&effectors, scene, weights, go->ob, ob_src);
- if( go->ob->particlesystem.first ) {
+ if ( go->ob->particlesystem.first ) {
ParticleSystem *psys= go->ob->particlesystem.first;
- for( ; psys; psys=psys->next )
+ for ( ; psys; psys=psys->next )
add_particles_to_effectors(&effectors, scene, weights, go->ob, psys, psys_src);
}
}
}
}
else {
- for(base = scene->base.first; base; base= base->next) {
- if( (base->lay & layer) ) {
- if( base->object->pd && base->object->pd->forcefield )
+ for (base = scene->base.first; base; base= base->next) {
+ if ( (base->lay & layer) ) {
+ if ( base->object->pd && base->object->pd->forcefield )
add_object_to_effectors(&effectors, scene, weights, base->object, ob_src);
- if( base->object->particlesystem.first ) {
+ if ( base->object->particlesystem.first ) {
ParticleSystem *psys= base->object->particlesystem.first;
- for( ; psys; psys=psys->next )
+ for ( ; psys; psys=psys->next )
add_particles_to_effectors(&effectors, scene, weights, base->object, psys, psys_src);
}
}
@@ -310,11 +310,11 @@ ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *psys_src
void pdEndEffectors(ListBase **effectors)
{
- if(*effectors) {
+ if (*effectors) {
EffectorCache *eff = (*effectors)->first;
- for(; eff; eff=eff->next) {
- if(eff->guide_data)
+ for (; eff; eff=eff->next) {
+ if (eff->guide_data)
MEM_freeN(eff->guide_data);
}
@@ -334,10 +334,10 @@ void pd_point_from_particle(ParticleSimulationData *sim, ParticleData *pa, Parti
point->size = pa->size;
point->charge = 0.0f;
- if(part->pd && part->pd->forcefield == PFIELD_CHARGE)
+ if (part->pd && part->pd->forcefield == PFIELD_CHARGE)
point->charge += part->pd->f_strength;
- if(part->pd2 && part->pd2->forcefield == PFIELD_CHARGE)
+ if (part->pd2 && part->pd2->forcefield == PFIELD_CHARGE)
point->charge += part->pd2->f_strength;
point->vel_to_sec = 1.0f;
@@ -345,7 +345,7 @@ void pd_point_from_particle(ParticleSimulationData *sim, ParticleData *pa, Parti
point->flag = 0;
- if(sim->psys->part->flag & PART_ROT_DYN) {
+ if (sim->psys->part->flag & PART_ROT_DYN) {
point->ave = state->ave;
point->rot = state->rot;
}
@@ -406,24 +406,24 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
float norm[3], len = 0.0;
float visibility = 1.0, absorption = 0.0;
- if(!(eff->pd->flag & PFIELD_VISIBILITY))
+ if (!(eff->pd->flag & PFIELD_VISIBILITY))
return visibility;
- if(!colls)
+ if (!colls)
colls = get_collider_cache(eff->scene, eff->ob, NULL);
- if(!colls)
+ if (!colls)
return visibility;
negate_v3_v3(norm, efd->vec_to_point);
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)
+ if (col->ob == eff->ob)
continue;
if (collmd->bvhtree) {
@@ -439,13 +439,13 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
// visibility is only between 0 and 1, calculated from 1-absorption
visibility *= CLAMPIS(1.0f-absorption, 0.0f, 1.0f);
- if(visibility <= 0.0f)
+ if (visibility <= 0.0f)
break;
}
}
}
- if(!colliders)
+ if (!colliders)
free_collider_cache(&colls);
return visibility;
@@ -472,13 +472,13 @@ static float wind_func(struct RNG *rng, float strength)
static float falloff_func(float fac, int usemin, float mindist, int usemax, float maxdist, float power)
{
/* first quick checks */
- if(usemax && fac > maxdist)
+ if (usemax && fac > maxdist)
return 0.0f;
- if(usemin && fac < mindist)
+ if (usemin && fac < mindist)
return 1.0f;
- if(!usemin)
+ if (!usemin)
mindist = 0.0;
return pow((double)(1.0f+fac-mindist), (double)(-power));
@@ -502,9 +502,9 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
fac = dot_v3v3(efd->nor, efd->vec_to_point2);
- if(eff->pd->zdir == PFIELD_Z_POS && fac < 0.0f)
+ if (eff->pd->zdir == PFIELD_Z_POS && fac < 0.0f)
falloff=0.0f;
- else if(eff->pd->zdir == PFIELD_Z_NEG && fac > 0.0f)
+ else if (eff->pd->zdir == PFIELD_Z_NEG && fac > 0.0f)
falloff=0.0f;
else switch(eff->pd->falloff) {
case PFIELD_FALL_SPHERE:
@@ -513,7 +513,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
case PFIELD_FALL_TUBE:
falloff*= falloff_func_dist(eff->pd, ABS(fac));
- if(falloff == 0.0f)
+ if (falloff == 0.0f)
break;
madd_v3_v3v3fl(temp, efd->vec_to_point, efd->nor, -fac);
@@ -522,7 +522,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
break;
case PFIELD_FALL_CONE:
falloff*= falloff_func_dist(eff->pd, ABS(fac));
- if(falloff == 0.0f)
+ if (falloff == 0.0f)
break;
r_fac= RAD2DEGF(saacos(fac/len_v3(efd->vec_to_point)));
@@ -543,20 +543,20 @@ int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], floa
BLI_bvhtree_find_nearest(surmd->bvhtree->tree, co, &nearest, surmd->bvhtree->nearest_callback, surmd->bvhtree);
- if(nearest.index != -1) {
+ if (nearest.index != -1) {
copy_v3_v3(surface_co, nearest.co);
- if(surface_nor) {
+ if (surface_nor) {
copy_v3_v3(surface_nor, nearest.no);
}
- if(surface_vel) {
+ if (surface_vel) {
MFace *mface = CDDM_get_tessface(surmd->dm, nearest.index);
copy_v3_v3(surface_vel, surmd->v[mface->v1].co);
add_v3_v3(surface_vel, surmd->v[mface->v2].co);
add_v3_v3(surface_vel, surmd->v[mface->v3].co);
- if(mface->v4)
+ if (mface->v4)
add_v3_v3(surface_vel, surmd->v[mface->v4].co);
mul_v3_fl(surface_vel, mface->v4 ? 0.25f : 0.333f);
@@ -571,7 +571,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
float cfra = eff->scene->r.cfra;
int ret = 0;
- if(eff->pd && eff->pd->shape==PFIELD_SHAPE_SURFACE && eff->surmd) {
+ if (eff->pd && eff->pd->shape==PFIELD_SHAPE_SURFACE && eff->surmd) {
/* closest point in the object surface is an effector */
float vec[3];
@@ -584,9 +584,9 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
efd->size = 0.0f;
}
- else if(eff->pd && eff->pd->shape==PFIELD_SHAPE_POINTS) {
+ else if (eff->pd && eff->pd->shape==PFIELD_SHAPE_POINTS) {
- if(eff->ob->derivedFinal) {
+ if (eff->ob->derivedFinal) {
DerivedMesh *dm = eff->ob->derivedFinal;
dm->getVertCo(dm, *efd->index, efd->loc);
@@ -603,12 +603,12 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
ret = 1;
}
}
- else if(eff->psys) {
+ else if (eff->psys) {
ParticleData *pa = eff->psys->particles + *efd->index;
ParticleKey state;
/* exclude the particle itself for self effecting particles */
- if(eff->psys == point->psys && *efd->index == point->index) {
+ if (eff->psys == point->psys && *efd->index == point->index) {
/* pass */
}
else {
@@ -623,7 +623,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
/* TODO */
//if(eff->pd->forcefiled == PFIELD_HARMONIC && ret==0) {
- // if(pa->dietime < eff->psys->cfra)
+ // if (pa->dietime < eff->psys->cfra)
// eff->flag |= PE_VELOCITY_TO_IMPULSE;
//}
@@ -634,7 +634,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
efd->nor[1] = efd->nor[2] = 0.f;
mul_qt_v3(state.rot, efd->nor);
- if(real_velocity)
+ if (real_velocity)
copy_v3_v3(efd->vel, state.vel);
efd->size = pa->size;
@@ -648,13 +648,13 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
/* use z-axis as normal*/
normalize_v3_v3(efd->nor, ob->obmat[2]);
- if(eff->pd && eff->pd->shape == PFIELD_SHAPE_PLANE) {
+ if (eff->pd && eff->pd->shape == PFIELD_SHAPE_PLANE) {
float temp[3], translate[3];
sub_v3_v3v3(temp, point->loc, ob->obmat[3]);
project_v3_v3v3(translate, temp, efd->nor);
/* for vortex the shape chooses between old / new force */
- if(eff->pd->forcefield == PFIELD_VORTEX)
+ if (eff->pd->forcefield == PFIELD_VORTEX)
add_v3_v3v3(efd->loc, ob->obmat[3], translate);
else /* normally efd->loc is closest point on effector xy-plane */
sub_v3_v3v3(efd->loc, point->loc, translate);
@@ -663,7 +663,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
copy_v3_v3(efd->loc, ob->obmat[3]);
}
- if(real_velocity)
+ if (real_velocity)
copy_v3_v3(efd->vel, eff->velocity);
*eff->ob = obcopy;
@@ -673,15 +673,15 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
ret = 1;
}
- if(ret) {
+ if (ret) {
sub_v3_v3v3(efd->vec_to_point, point->loc, efd->loc);
efd->distance = len_v3(efd->vec_to_point);
/* rest length for harmonic effector, will have to see later if this could be extended to other effectors */
- if(eff->pd && eff->pd->forcefield == PFIELD_HARMONIC && eff->pd->f_size)
+ if (eff->pd && eff->pd->forcefield == PFIELD_HARMONIC && eff->pd->f_size)
mul_v3_fl(efd->vec_to_point, (efd->distance-eff->pd->f_size)/efd->distance);
- if(eff->flag & PE_USE_NORMAL_DATA) {
+ if (eff->flag & PE_USE_NORMAL_DATA) {
copy_v3_v3(efd->vec_to_point2, efd->vec_to_point);
copy_v3_v3(efd->nor2, efd->nor);
}
@@ -696,24 +696,24 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
}
static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step)
{
- if(eff->pd->shape == PFIELD_SHAPE_POINTS) {
+ if (eff->pd->shape == PFIELD_SHAPE_POINTS) {
efd->index = p;
*p = 0;
*tot = eff->ob->derivedFinal ? eff->ob->derivedFinal->numVertData : 1;
- if(*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) {
+ if (*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) {
*p = point->index % *tot;
*tot = *p+1;
}
}
- else if(eff->psys) {
+ else if (eff->psys) {
efd->index = p;
*p = 0;
*tot = eff->psys->totpart;
- if(eff->pd->forcefield == PFIELD_CHARGE) {
+ if (eff->pd->forcefield == PFIELD_CHARGE) {
/* Only the charge of the effected particle is used for
* interaction, not fall-offs. If the fall-offs aren't the
* same this will be unphysical, but for animation this
@@ -722,13 +722,13 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin
*/
efd->charge = eff->pd->f_strength;
}
- else if(eff->pd->forcefield == PFIELD_HARMONIC && (eff->pd->flag & PFIELD_MULTIPLE_SPRINGS)==0) {
+ else if (eff->pd->forcefield == PFIELD_HARMONIC && (eff->pd->flag & PFIELD_MULTIPLE_SPRINGS)==0) {
/* every particle is mapped to only one harmonic effector particle */
*p= point->index % eff->psys->totpart;
*tot= *p + 1;
}
- if(eff->psys->part->effector_amount) {
+ if (eff->psys->part->effector_amount) {
int totpart = eff->psys->totpart;
int amount = eff->psys->part->effector_amount;
@@ -748,7 +748,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
int hasrgb;
short mode = eff->pd->tex_mode;
- if(!eff->pd->tex)
+ if (!eff->pd->tex)
return;
result[0].nor = result[1].nor = result[2].nor = result[3].nor = NULL;
@@ -757,18 +757,18 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
copy_v3_v3(tex_co,point->loc);
- if(eff->pd->flag & PFIELD_TEX_2D) {
+ if (eff->pd->flag & PFIELD_TEX_2D) {
float fac=-dot_v3v3(tex_co, efd->nor);
madd_v3_v3fl(tex_co, efd->nor, fac);
}
- if(eff->pd->flag & PFIELD_TEX_OBJECT) {
+ if (eff->pd->flag & PFIELD_TEX_OBJECT) {
mul_m4_v3(eff->ob->imat, tex_co);
}
hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL,NULL, 0, result);
- if(hasrgb && mode==PFIELD_TEX_RGB) {
+ if (hasrgb && mode==PFIELD_TEX_RGB) {
force[0] = (0.5f - result->tr) * strength;
force[1] = (0.5f - result->tg) * strength;
force[2] = (0.5f - result->tb) * strength;
@@ -787,7 +787,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
tex_co[2] += nabla;
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3);
- if(mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we dont have rgb fall back to grad */
+ if (mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we don't have rgb fall back to grad */
force[0] = (result[0].tin - result[1].tin) * strength;
force[1] = (result[0].tin - result[2].tin) * strength;
force[2] = (result[0].tin - result[3].tin) * strength;
@@ -808,7 +808,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
}
}
- if(eff->pd->flag & PFIELD_TEX_2D) {
+ if (eff->pd->flag & PFIELD_TEX_2D) {
float fac = -dot_v3v3(force, efd->nor);
madd_v3_v3fl(force, efd->nor, fac);
}
@@ -826,10 +826,10 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
float damp = pd->f_damp;
float noise_factor = pd->f_noise;
- if(noise_factor > 0.0f) {
+ if (noise_factor > 0.0f) {
strength += wind_func(rng, noise_factor);
- if(ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG))
+ if (ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG))
damp += wind_func(rng, noise_factor);
}
@@ -846,7 +846,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
break;
case PFIELD_VORTEX:
/* old vortex force */
- if(pd->shape == PFIELD_SHAPE_POINT) {
+ if (pd->shape == PFIELD_SHAPE_POINT) {
cross_v3_v3v3(force, efd->nor, efd->vec_to_point);
normalize_v3(force);
mul_v3_fl(force, strength * efd->distance * efd->falloff);
@@ -864,7 +864,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
}
break;
case PFIELD_MAGNET:
- if(eff->pd->shape == PFIELD_SHAPE_POINT)
+ if (eff->pd->shape == PFIELD_SHAPE_POINT)
/* magnetic field of a moving charge */
cross_v3_v3v3(temp, efd->nor, efd->vec_to_point);
else
@@ -898,7 +898,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
/* Boid field is handled completely in boids code. */
return;
case PFIELD_TURBULENCE:
- if(pd->flag & PFIELD_GLOBAL_CO) {
+ if (pd->flag & PFIELD_GLOBAL_CO) {
copy_v3_v3(temp, point->loc);
}
else {
@@ -920,20 +920,20 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
break;
}
- if(pd->flag & PFIELD_DO_LOCATION) {
+ if (pd->flag & PFIELD_DO_LOCATION) {
madd_v3_v3fl(total_force, force, 1.0f/point->vel_to_sec);
- if(ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG)==0 && pd->f_flow != 0.0f) {
+ if (ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG)==0 && pd->f_flow != 0.0f) {
madd_v3_v3fl(total_force, point->vel, -pd->f_flow * efd->falloff);
}
}
- if(pd->flag & PFIELD_DO_ROTATION && point->ave && point->rot) {
+ if (pd->flag & PFIELD_DO_ROTATION && point->ave && point->rot) {
float xvec[3] = {1.0f, 0.0f, 0.0f};
float dave[3];
mul_qt_v3(point->rot, xvec);
cross_v3_v3v3(dave, xvec, force);
- if(pd->f_flow != 0.0f) {
+ if (pd->f_flow != 0.0f) {
madd_v3_v3fl(dave, point->ave, -pd->f_flow * efd->falloff);
}
add_v3_v3(point->ave, dave);
@@ -975,21 +975,21 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
/* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */
/* Check for min distance here? (yes would be cool to add that, ton) */
- if(effectors) for(eff = effectors->first; eff; eff=eff->next) {
+ if (effectors) for (eff = effectors->first; eff; eff=eff->next) {
/* object effectors were fully checked to be OK to evaluate! */
get_effector_tot(eff, &efd, point, &tot, &p, &step);
- for(; p<tot; p+=step) {
- if(get_effector_data(eff, &efd, point, 0)) {
+ for (; p<tot; p+=step) {
+ if (get_effector_data(eff, &efd, point, 0)) {
efd.falloff= effector_falloff(eff, &efd, point, weights);
- if(efd.falloff > 0.0f)
+ if (efd.falloff > 0.0f)
efd.falloff *= eff_calc_visibility(colliders, eff, &efd, point);
- if(efd.falloff <= 0.0f)
+ if (efd.falloff <= 0.0f)
; /* don't do anything */
- else if(eff->pd->forcefield == PFIELD_TEXTURE)
+ else if (eff->pd->forcefield == PFIELD_TEXTURE)
do_texture_effector(eff, &efd, point, force);
else {
float temp1[3]={0,0,0}, temp2[3];
@@ -998,13 +998,13 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
do_physical_effector(eff, &efd, point, force);
// for softbody backward compatibility
- if(point->flag & PE_WIND_AS_SPEED && impulse) {
+ if (point->flag & PE_WIND_AS_SPEED && impulse) {
sub_v3_v3v3(temp2, force, temp1);
sub_v3_v3v3(impulse, impulse, temp2);
}
}
}
- else if(eff->flag & PE_VELOCITY_TO_IMPULSE && impulse) {
+ else if (eff->flag & PE_VELOCITY_TO_IMPULSE && impulse) {
/* special case for harmonic effector */
add_v3_v3v3(impulse, impulse, efd.vel);
}
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 59f62c43b73..97e59df3353 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -183,7 +183,7 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro
PropertyRNA *prop;
char *path;
- if(driven)
+ if (driven)
*driven = FALSE;
/* only use the current action ??? */
@@ -204,7 +204,7 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro
/* if not animated, check if driven */
if ((fcu == NULL) && (adt->drivers.first)) {
fcu= list_find_fcurve(&adt->drivers, path, index);
- if(fcu && driven)
+ if (fcu && driven)
*driven = TRUE;
fcu = NULL;
}
@@ -841,12 +841,12 @@ void testhandles_fcurve (FCurve *fcu, const short use_handle)
for (a=0, bezt=fcu->bezt; a < fcu->totvert; a++, bezt++) {
short flag= 0;
- /* flag is initialised as selection status
+ /* flag is initialized as selection status
* of beztriple control-points (labelled 0,1,2)
*/
if (bezt->f2 & SELECT) flag |= (1<<1); // == 2
- if(use_handle == FALSE) {
- if(flag & 2) {
+ if (use_handle == FALSE) {
+ if (flag & 2) {
flag |= (1<<0) | (1<<2);
}
}
@@ -1020,7 +1020,7 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar)
/* get property to read from, and get value as appropriate */
if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
- if(RNA_property_array_check(prop)) {
+ if (RNA_property_array_check(prop)) {
/* array */
if (index < RNA_property_array_length(&ptr, prop)) {
switch (RNA_property_type(prop)) {
@@ -1418,7 +1418,7 @@ void driver_free_variable (ChannelDriver *driver, DriverVar *dvar)
#ifdef WITH_PYTHON
/* since driver variables are cached, the expression needs re-compiling too */
- if(driver->type==DRIVER_TYPE_PYTHON)
+ if (driver->type==DRIVER_TYPE_PYTHON)
driver->flag |= DRIVER_FLAG_RENAMEVAR;
#endif
}
@@ -1446,7 +1446,7 @@ void driver_change_variable_type (DriverVar *dvar, int type)
/* store the flags */
dtar->flag = flags;
- /* object ID types only, or idtype not yet initialised*/
+ /* object ID types only, or idtype not yet initialized*/
if ((flags & DTAR_FLAG_ID_OB_ONLY) || (dtar->idtype == 0))
dtar->idtype= ID_OB;
}
@@ -1981,7 +1981,7 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim
/* evaltime occurs somewhere in the middle of the curve */
for (a=0; prevbezt && bezt && (a < fcu->totvert-1); a++, prevbezt=bezt, bezt++) {
/* use if the key is directly on the frame, rare cases this is needed else we get 0.0 instead. */
- if(fabsf(bezt->vec[1][0] - evaltime) < SMALL_NUMBER) {
+ if (fabsf(bezt->vec[1][0] - evaltime) < SMALL_NUMBER) {
cvalue= bezt->vec[1][1];
}
/* evaltime occurs within the interval defined by these two keyframes */
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index 587fe75031f..d3d0952f3f8 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -91,20 +91,20 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
*numVertices = totvert;
verts = MEM_callocN( totvert*3*sizeof(float), "elbeemmesh_vertices");
- for(i=0; i<totvert; i++) {
+ for (i=0; i<totvert; i++) {
copy_v3_v3(&verts[i*3], mvert[i].co);
- if(useGlobalCoords) { mul_m4_v3(ob->obmat, &verts[i*3]); }
+ if (useGlobalCoords) { mul_m4_v3(ob->obmat, &verts[i*3]); }
}
*vertices = verts;
- for(i=0; i<totface; i++) {
+ for (i=0; i<totface; i++) {
countTris++;
- if(mface[i].v4) { countTris++; }
+ if (mface[i].v4) { countTris++; }
}
*numTriangles = countTris;
tris = MEM_callocN( countTris*3*sizeof(int), "elbeemmesh_triangles");
countTris = 0;
- for(i=0; i<totface; i++) {
+ for (i=0; i<totface; i++) {
int face[4];
face[0] = mface[i].v1;
face[1] = mface[i].v2;
@@ -115,7 +115,7 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
tris[countTris*3+1] = face[1];
tris[countTris*3+2] = face[2];
countTris++;
- if(face[3]) {
+ if (face[3]) {
tris[countTris*3+0] = face[0];
tris[countTris*3+1] = face[2];
tris[countTris*3+2] = face[3];
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index ae474f9d9c3..bc587449853 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -515,7 +515,7 @@ static FModifierTypeInfo FMI_ENVELOPE = {
* NOTE: this needs to be at the start of the stack to be of use, as it needs to know the extents of the
* keyframes/sample-data.
*
- * Possible TODO - store length of cycle information that can be initialised from the extents of the
+ * Possible TODO - store length of cycle information that can be initialized from the extents of the
* keyframes/sample-data, and adjusted as appropriate.
*/
@@ -627,7 +627,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue),
/* check if 'cyclic extrapolation', and thus calculate y-offset for this cycle */
if (mode == FCM_EXTRAPOLATE_CYCLIC_OFFSET) {
- if(side < 0)
+ if (side < 0)
cycyofs = (float)floor((evaltime - ofs) / cycdx);
else
cycyofs = (float)ceil((evaltime - ofs) / cycdx);
@@ -635,10 +635,10 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue),
}
/* special case for cycle start/end */
- if(cyct == 0.0f) {
+ if (cyct == 0.0f) {
evaltime = (side == 1 ? lastkey[0] : prevkey[0]);
- if((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)cycle % 2))
+ if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)cycle % 2))
evaltime = (side == 1 ? prevkey[0] : lastkey[0]);
}
/* calculate where in the cycle we are (overwrite evaltime to reflect this) */
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 4cf47906b64..b2759f18e9b 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -68,7 +68,7 @@ void free_vfont(struct VFont *vf)
if (vf == NULL) return;
if (vf->data) {
- while(vf->data->characters.first)
+ while (vf->data->characters.first)
{
VChar *che = vf->data->characters.first;
@@ -106,7 +106,8 @@ static PackedFile *get_builtin_packedfile(void)
printf("Internal error, builtin font not loaded\n");
return NULL;
- } else {
+ }
+ else {
void *mem= MEM_mallocN(builtin_font_size, "vfd_builtin");
memcpy(mem, builtin_font_data, builtin_font_size);
@@ -119,8 +120,8 @@ void free_ttfont(void)
{
struct TmpFont *tf;
- for(tf= ttfdata.first; tf; tf= tf->next) {
- if(tf->pf) freePackedFile(tf->pf); /* NULL when the font file can't be found on disk */
+ for (tf= ttfdata.first; tf; tf= tf->next) {
+ if (tf->pf) freePackedFile(tf->pf); /* NULL when the font file can't be found on disk */
tf->pf= NULL;
tf->vfont= NULL;
}
@@ -131,13 +132,13 @@ struct TmpFont *vfont_find_tmpfont(VFont *vfont)
{
struct TmpFont *tmpfnt = NULL;
- if(vfont==NULL) return NULL;
+ if (vfont==NULL) return NULL;
// Try finding the font from font list
tmpfnt = ttfdata.first;
- while(tmpfnt)
+ while (tmpfnt)
{
- if(tmpfnt->vfont == vfont)
+ if (tmpfnt->vfont == vfont)
break;
tmpfnt = tmpfnt->next;
}
@@ -149,7 +150,7 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
struct TmpFont *tmpfnt = NULL;
PackedFile *tpf;
- if(vfont==NULL) return NULL;
+ if (vfont==NULL) return NULL;
// Try finding the font from font list
tmpfnt = vfont_find_tmpfont(vfont);
@@ -160,12 +161,13 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
if (strcmp(vfont->name, FO_BUILTIN_NAME)==0) {
pf= get_builtin_packedfile();
- } else {
+ }
+ else {
if (vfont->packedfile) {
pf= vfont->packedfile;
// We need to copy a tmp font to memory unless it is already there
- if(!tmpfnt) {
+ if (!tmpfnt) {
tpf= MEM_callocN(sizeof(*tpf), "PackedFile");
tpf->data= MEM_mallocN(pf->size, "packFile");
tpf->size= pf->size;
@@ -191,7 +193,7 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
BLI_addtail(&ttfdata, tmpfnt);
}
}
- if(!pf) {
+ if (!pf) {
printf("Font file doesn't exist: %s\n", vfont->name);
strcpy(vfont->name, FO_BUILTIN_NAME);
@@ -224,7 +226,8 @@ VFont *load_vfont(Main *bmain, const char *name)
pf= get_builtin_packedfile();
is_builtin= 1;
- } else {
+ }
+ else {
char dir[FILE_MAXDIR];
BLI_strncpy(dir, name, sizeof(dir));
@@ -304,8 +307,8 @@ static VChar *find_vfont_char(VFontData *vfd, intptr_t character)
{
VChar *che= NULL;
- for(che = vfd->characters.first; che; che = che->next) {
- if(che->index == character)
+ for (che = vfd->characters.first; che; che = che->next) {
+ if (che->index == character)
break;
}
return che; /* NULL if not found */
@@ -390,11 +393,11 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
che= find_vfont_char(vfd, character);
// Select the glyph data
- if(che)
+ if (che)
nu1 = che->nurbsbase.first;
// Create the character
- while(nu1)
+ while (nu1)
{
bezt1 = nu1->bezt;
if (bezt1) {
@@ -434,7 +437,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
bezt2++;
}
}
- if(rot != 0.0f) {
+ if (rot != 0.0f) {
bezt2= nu2->bezt;
for (i=nu2->pntsu; i > 0; i--) {
fp= bezt2->vec[0];
@@ -454,7 +457,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
}
bezt2 = nu2->bezt;
- if(info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
+ if (info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
const float sca= cu->smallcaps_scale;
for (i= nu2->pntsu; i > 0; i--) {
fp= bezt2->vec[0];
@@ -509,10 +512,10 @@ int BKE_font_getselection(Object *ob, int *start, int *end)
static float char_width(Curve *cu, VChar *che, CharInfo *info)
{
// The character wasn't found, propably ascii = 0, then the width shall be 0 as well
- if(che == NULL) {
+ if (che == NULL) {
return 0.0f;
}
- else if(info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
+ else if (info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
return che->width * cu->smallcaps_scale;
}
else {
@@ -541,14 +544,14 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
/* renark: do calculations including the trailing '\0' of a string
* because the cursor can be at that location */
- if(ob->type!=OB_FONT) return NULL;
+ if (ob->type!=OB_FONT) return NULL;
// Set font data
cu= (Curve *) ob->data;
vfont= cu->vfont;
- if(cu->str == NULL) return NULL;
- if(vfont == NULL) return NULL;
+ if (cu->str == NULL) return NULL;
+ if (vfont == NULL) return NULL;
// Create unicode string
utf8len = BLI_strlen_utf8(cu->str);
@@ -575,8 +578,8 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
vfd= vfont_get_data(bmain, vfont);
/* The VFont Data can not be found */
- if(!vfd) {
- if(mem)
+ if (!vfd) {
+ if (mem)
MEM_freeN(mem);
return NULL;
}
@@ -615,9 +618,9 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
// Characters in the list
info = &(custrinfo[i]);
ascii = mem[i];
- if(info->flag & CU_CHINFO_SMALLCAPS) {
+ if (info->flag & CU_CHINFO_SMALLCAPS) {
ascii = towupper(ascii);
- if(mem[i] != ascii) {
+ if (mem[i] != ascii) {
mem[i]= ascii;
info->flag |= CU_CHINFO_SMALLCAPS_CHECK;
}
@@ -625,7 +628,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
vfont = which_vfont(cu, info);
- if(vfont==NULL) break;
+ if (vfont==NULL) break;
che= find_vfont_char(vfd, ascii);
@@ -634,7 +637,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
* But if the font is FO_BUILTIN_NAME then do not try loading since
* whole font is in the memory already
*/
- if(che == NULL && strcmp(vfont->name, FO_BUILTIN_NAME)) {
+ if (che == NULL && strcmp(vfont->name, FO_BUILTIN_NAME)) {
BLI_vfontchar_from_freetypefont(vfont, ascii);
}
@@ -643,7 +646,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
/* No VFont found */
if (vfont==NULL) {
- if(mem)
+ if (mem)
MEM_freeN(mem);
MEM_freeN(chartransdata);
return NULL;
@@ -656,7 +659,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
/* VFont Data for VFont couldn't be found */
if (!vfd) {
- if(mem)
+ if (mem)
MEM_freeN(mem);
MEM_freeN(chartransdata);
return NULL;
@@ -665,7 +668,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
twidth = char_width(cu, che, info);
// Calculate positions
- if((tb->w != 0.0f) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w + cu->xof*cu->fsize) {
+ if ((tb->w != 0.0f) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w + cu->xof*cu->fsize) {
// fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]);
for (j=i; j && (mem[j] != '\n') && (mem[j] != '\r') && (chartransdata[j].dobreak==0); j--) {
if (mem[j]==' ' || mem[j]=='-') {
@@ -691,7 +694,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
}
}
}
- if(ascii== '\n' || ascii== '\r' || ascii==0 || ct->dobreak) {
+ if (ascii== '\n' || ascii== '\r' || ascii==0 || ct->dobreak) {
ct->xof= xof;
ct->yof= yof;
ct->linenr= lnr;
@@ -716,7 +719,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
/* XXX, has been unused for years, need to check if this is useful, r4613 r5282 - campbell */
#if 0
- if(ascii == '\n' || ascii == '\r')
+ if (ascii == '\n' || ascii == '\r')
xof = cu->xof;
else
xof= cu->xof + (tb->x/cu->fsize);
@@ -727,7 +730,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
cnr= 0;
wsnr= 0;
}
- else if(ascii==9) { /* TAB */
+ else if (ascii==9) { /* TAB */
float tabfac;
ct->xof= xof;
@@ -777,7 +780,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
tmp = mem;
for (i= 0; i<=slen; i++, tmp++, ct++) {
ascii = *tmp;
- if(ascii== '\n' || ascii== '\r' || ct->dobreak) cu->lines++;
+ if (ascii== '\n' || ascii== '\r' || ct->dobreak) cu->lines++;
}
// linedata is now: width of line
@@ -785,25 +788,27 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
// linedata3 is now: maxlen of that line
// linedata4 is now: number of whitespaces of line
- if(cu->spacemode!=CU_LEFT) {
+ if (cu->spacemode!=CU_LEFT) {
ct= chartransdata;
- if(cu->spacemode==CU_RIGHT) {
- for(i=0;i<lnr;i++) linedata[i]= linedata3[i]-linedata[i];
+ if (cu->spacemode==CU_RIGHT) {
+ for (i=0;i<lnr;i++) linedata[i]= linedata3[i]-linedata[i];
for (i=0; i<=slen; i++) {
ct->xof+= linedata[ct->linenr];
ct++;
}
- } else if(cu->spacemode==CU_MIDDLE) {
- for(i=0;i<lnr;i++) linedata[i]= (linedata3[i]-linedata[i])/2;
+ }
+ else if (cu->spacemode==CU_MIDDLE) {
+ for (i=0;i<lnr;i++) linedata[i]= (linedata3[i]-linedata[i])/2;
for (i=0; i<=slen; i++) {
ct->xof+= linedata[ct->linenr];
ct++;
}
- } else if((cu->spacemode==CU_FLUSH) &&
+ }
+ else if ((cu->spacemode==CU_FLUSH) &&
(cu->tb[0].w != 0.0f)) {
- for(i=0;i<lnr;i++)
- if(linedata2[i]>1)
+ for (i=0;i<lnr;i++)
+ if (linedata2[i]>1)
linedata[i]= (linedata3[i]-linedata[i])/(linedata2[i]-1);
for (i=0; i<=slen; i++) {
for (j=i; (!ELEM3(mem[j], '\0', '\n', '\r')) && (chartransdata[j].dobreak == 0) && (j < slen); j++) {
@@ -816,7 +821,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
ct++;
}
}
- else if((cu->spacemode==CU_JUSTIFY) && (cu->tb[0].w != 0.0f)) {
+ 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') &&
@@ -834,14 +839,14 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
/* TEXT ON CURVE */
/* Note: Only OB_CURVE objects could have a path */
- if(cu->textoncurve && cu->textoncurve->type==OB_CURVE) {
+ if (cu->textoncurve && cu->textoncurve->type==OB_CURVE) {
Curve *cucu= cu->textoncurve->data;
int oldflag= cucu->flag;
cucu->flag |= (CU_PATH+CU_FOLLOW);
- if(cucu->path==NULL) makeDispListCurveTypes(scene, cu->textoncurve, 0);
- if(cucu->path) {
+ if (cucu->path==NULL) makeDispListCurveTypes(scene, cu->textoncurve, 0);
+ if (cucu->path) {
float distfac, imat[4][4], imat3[3][3], cmat[3][3];
float minx, maxx, miny, maxy;
float timeofs, sizefac;
@@ -857,10 +862,10 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
maxx=maxy= -1.0e20f;
ct= chartransdata;
for (i=0; i<=slen; i++, ct++) {
- if(minx>ct->xof) minx= ct->xof;
- if(maxx<ct->xof) maxx= ct->xof;
- if(miny>ct->yof) miny= ct->yof;
- if(maxy<ct->yof) maxy= ct->yof;
+ if (minx>ct->xof) minx= ct->xof;
+ if (maxx<ct->xof) maxx= ct->xof;
+ if (miny>ct->yof) miny= ct->yof;
+ if (maxy<ct->yof) maxy= ct->yof;
}
/* we put the x-coordinaat exact at the curve, the y is rotated */
@@ -869,17 +874,17 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
distfac= sizefac*cucu->path->totdist/(maxx-minx);
timeofs= 0.0f;
- if(distfac > 1.0f) {
+ if (distfac > 1.0f) {
/* path longer than text: spacemode involves */
distfac= 1.0f/distfac;
- if(cu->spacemode==CU_RIGHT) {
+ if (cu->spacemode==CU_RIGHT) {
timeofs= 1.0f-distfac;
}
- else if(cu->spacemode==CU_MIDDLE) {
+ else if (cu->spacemode==CU_MIDDLE) {
timeofs= (1.0f-distfac)/2.0f;
}
- else if(cu->spacemode==CU_FLUSH) distfac= 1.0f;
+ else if (cu->spacemode==CU_FLUSH) distfac= 1.0f;
}
else distfac= 1.0;
@@ -937,13 +942,13 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
}
}
- if(mode==FO_CURSUP || mode==FO_CURSDOWN || mode==FO_PAGEUP || mode==FO_PAGEDOWN) {
+ if (mode==FO_CURSUP || mode==FO_CURSDOWN || mode==FO_PAGEUP || mode==FO_PAGEDOWN) {
/* 2: curs up
* 3: curs down */
ct= chartransdata+cu->pos;
- if((mode==FO_CURSUP || mode==FO_PAGEUP) && ct->linenr==0);
- else if((mode==FO_CURSDOWN || mode==FO_PAGEDOWN) && ct->linenr==lnr);
+ if ((mode==FO_CURSUP || mode==FO_PAGEUP) && ct->linenr==0);
+ else if ((mode==FO_CURSDOWN || mode==FO_PAGEDOWN) && ct->linenr==lnr);
else {
switch(mode) {
case FO_CURSUP: lnr= ct->linenr-1; break;
@@ -956,11 +961,11 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
cu->pos= 0;
ct= chartransdata;
for (i= 0; i<slen; i++) {
- if(ct->linenr==lnr) {
- if(ct->charnr==cnr) break;
- if( (ct+1)->charnr==0) break;
+ if (ct->linenr==lnr) {
+ if (ct->charnr==cnr) break;
+ if ( (ct+1)->charnr==0) break;
}
- else if(ct->linenr>lnr) break;
+ else if (ct->linenr>lnr) break;
cu->pos++;
ct++;
}
@@ -968,7 +973,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
}
/* cursor first */
- if(cu->editfont) {
+ if (cu->editfont) {
float si, co;
ct= chartransdata+cu->pos;
@@ -1002,7 +1007,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
return NULL;
}
- if(mode == FO_EDIT) {
+ if (mode == FO_EDIT) {
/* make nurbdata */
freeNurblist(&cu->nurb);
@@ -1016,7 +1021,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
info->mat_nr = 0;
}
// We do not want to see any character for \n or \r
- if(cha != '\n' && cha != '\r')
+ if (cha != '\n' && cha != '\r')
buildchar(bmain, cu, cha, info, ct->xof, ct->yof, ct->rot, i);
if ((info->flag & CU_CHINFO_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) {
@@ -1067,12 +1072,12 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
}
}
- if(mode==FO_DUPLI) {
+ if (mode==FO_DUPLI) {
MEM_freeN(mem);
return chartransdata;
}
- if(mem)
+ if (mem)
MEM_freeN(mem);
MEM_freeN(chartransdata);
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 00ec9ba0345..cf0538b4395 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -66,7 +66,7 @@ void free_group_objects(Group *group)
/* don't free group itself */
GroupObject *go;
- while(group->gobject.first) {
+ while (group->gobject.first) {
go= group->gobject.first;
BLI_remlink(&group->gobject, go);
free_group_object(go);
@@ -83,26 +83,26 @@ void unlink_group(Group *group)
FreestyleLineSet *lineset;
ParticleSystem *psys;
- for(ma= bmain->mat.first; ma; ma= ma->id.next) {
- if(ma->group==group)
+ for (ma= bmain->mat.first; ma; ma= ma->id.next) {
+ if (ma->group==group)
ma->group= NULL;
}
- for(ma= bmain->mat.first; ma; ma= ma->id.next) {
- if(ma->group==group)
+ for (ma= bmain->mat.first; ma; ma= ma->id.next) {
+ if (ma->group==group)
ma->group= NULL;
}
for (sce= bmain->scene.first; sce; sce= sce->id.next) {
Base *base= sce->base.first;
/* ensure objects are not in this group */
- for(; base; base= base->next) {
- if(rem_from_group(group, base->object, sce, base) && find_group(base->object, NULL)==NULL) {
+ for (; base; base= base->next) {
+ if (rem_from_group(group, base->object, sce, base) && find_group(base->object, NULL)==NULL) {
base->object->flag &= ~OB_FROMGROUP;
base->flag &= ~OB_FROMGROUP;
}
}
- for(srl= sce->r.layers.first; srl; srl= srl->next) {
+ for (srl= sce->r.layers.first; srl; srl= srl->next) {
if (srl->light_override==group)
srl->light_override= NULL;
@@ -113,27 +113,27 @@ void unlink_group(Group *group)
}
}
- for(ob= bmain->object.first; ob; ob= ob->id.next) {
+ for (ob= bmain->object.first; ob; ob= ob->id.next) {
- if(ob->dup_group==group) {
+ if (ob->dup_group==group) {
ob->dup_group= NULL;
#if 0 /* XXX OLD ANIMSYS, NLASTRIPS ARE NO LONGER USED */
{
bActionStrip *strip;
/* duplicator strips use a group object, we remove it */
- for(strip= ob->nlastrips.first; strip; strip= strip->next) {
- if(strip->object)
+ for (strip= ob->nlastrips.first; strip; strip= strip->next) {
+ if (strip->object)
strip->object= NULL;
}
}
#endif
}
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
- if(psys->part->dup_group==group)
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+ if (psys->part->dup_group==group)
psys->part->dup_group= NULL;
#if 0 /* not used anymore, only keps for readfile.c, no need to account for this */
- if(psys->part->eff_group==group)
+ if (psys->part->eff_group==group)
psys->part->eff_group= NULL;
#endif
}
@@ -168,11 +168,11 @@ static int add_to_group_internal(Group *group, Object *ob)
{
GroupObject *go;
- if(group==NULL || ob==NULL) return 0;
+ if (group==NULL || ob==NULL) return 0;
/* check if the object has been added already */
- for(go= group->gobject.first; go; go= go->next) {
- if(go->ob==ob) return 0;
+ for (go= group->gobject.first; go; go= go->next) {
+ if (go->ob==ob) return 0;
}
go= MEM_callocN(sizeof(GroupObject), "groupobject");
@@ -185,15 +185,15 @@ static int add_to_group_internal(Group *group, Object *ob)
int add_to_group(Group *group, Object *object, Scene *scene, Base *base)
{
- if(add_to_group_internal(group, object)) {
- if((object->flag & OB_FROMGROUP)==0) {
+ if (add_to_group_internal(group, object)) {
+ if ((object->flag & OB_FROMGROUP)==0) {
- if(scene && base==NULL)
+ if (scene && base==NULL)
base= object_in_scene(object, scene);
object->flag |= OB_FROMGROUP;
- if(base)
+ if (base)
base->flag |= OB_FROMGROUP;
}
return 1;
@@ -208,12 +208,12 @@ static int rem_from_group_internal(Group *group, Object *ob)
{
GroupObject *go, *gon;
int removed = 0;
- if(group==NULL) return 0;
+ if (group==NULL) return 0;
go= group->gobject.first;
- while(go) {
+ while (go) {
gon= go->next;
- if(go->ob==ob) {
+ if (go->ob==ob) {
BLI_remlink(&group->gobject, go);
free_group_object(go);
removed = 1;
@@ -226,15 +226,15 @@ static int rem_from_group_internal(Group *group, Object *ob)
int rem_from_group(Group *group, Object *object, Scene *scene, Base *base)
{
- if(rem_from_group_internal(group, object)) {
+ if (rem_from_group_internal(group, object)) {
/* object can be NULL */
- if(object && find_group(object, NULL) == NULL) {
- if(scene && base==NULL)
+ if (object && find_group(object, NULL) == NULL) {
+ if (scene && base==NULL)
base= object_in_scene(object, scene);
object->flag &= ~OB_FROMGROUP;
- if(base)
+ if (base)
base->flag &= ~OB_FROMGROUP;
}
return 1;
@@ -248,10 +248,10 @@ int object_in_group(Object *ob, Group *group)
{
GroupObject *go;
- if(group==NULL || ob==NULL) return 0;
+ if (group==NULL || ob==NULL) return 0;
- for(go= group->gobject.first; go; go= go->next) {
- if(go->ob==ob)
+ for (go= group->gobject.first; go; go= go->next) {
+ if (go->ob==ob)
return 1;
}
return 0;
@@ -264,8 +264,8 @@ Group *find_group(Object *ob, Group *group)
else
group= G.main->group.first;
- while(group) {
- if(object_in_group(ob, group))
+ while (group) {
+ if (object_in_group(ob, group))
return group;
group= group->id.next;
}
@@ -276,10 +276,10 @@ void group_tag_recalc(Group *group)
{
GroupObject *go;
- if(group==NULL) return;
+ if (group==NULL) return;
- for(go= group->gobject.first; go; go= go->next) {
- if(go->ob)
+ for (go= group->gobject.first; go; go= go->next) {
+ if (go->ob)
go->ob->recalc= go->recalc;
}
}
@@ -289,12 +289,12 @@ int group_is_animated(Object *UNUSED(parent), Group *group)
GroupObject *go;
#if 0 /* XXX OLD ANIMSYS, NLASTRIPS ARE NO LONGER USED */
- if(parent->nlastrips.first)
+ if (parent->nlastrips.first)
return 1;
#endif
- for(go= group->gobject.first; go; go= go->next)
- if(go->ob && go->ob->proxy)
+ for (go= group->gobject.first; go; go= go->next)
+ if (go->ob && go->ob->proxy)
return 1;
return 0;
@@ -310,11 +310,11 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
static int done= 0;
bActionStrip *strip, *nstrip;
- if(mode=='s') {
+ if (mode=='s') {
- for(strip= parent->nlastrips.first; strip; strip= strip->next) {
- if(strip->object==target) {
- if(done==0) {
+ for (strip= parent->nlastrips.first; strip; strip= strip->next) {
+ if (strip->object==target) {
+ if (done==0) {
/* clear nla & action from object */
nlastrips= target->nlastrips;
target->nlastrips.first= target->nlastrips.last= NULL;
@@ -328,8 +328,8 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
}
}
}
- else if(mode=='e') {
- if(done) {
+ else if (mode=='e') {
+ if (done) {
BLI_freelistN(&target->nlastrips);
target->nlastrips= nlastrips;
target->action= action;
@@ -350,21 +350,21 @@ void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group
{
GroupObject *go;
-#if 0 /* warning, isnt clearing the recalc flag on the object which causes it to run all the time,
+#if 0 /* warning, isn't clearing the recalc flag on the object which causes it to run all the time,
* not just on frame change.
- * This isnt working because the animation data is only re-evalyated on frame change so commenting for now
+ * This isn't working because the animation data is only re-evalyated on frame change so commenting for now
* but when its enabled at some point it will need to be changed so as not to update so much - campbell */
/* if animated group... */
- if(parent->nlastrips.first) {
+ if (parent->nlastrips.first) {
int cfrao;
/* switch to local time */
cfrao= scene->r.cfra;
/* we need a DAG per group... */
- for(go= group->gobject.first; go; go= go->next) {
- if(go->ob && go->recalc) {
+ for (go= group->gobject.first; go; go= go->next) {
+ if (go->ob && go->recalc) {
go->ob->recalc= go->recalc;
group_replaces_nla(parent, go->ob, 's');
@@ -383,9 +383,9 @@ void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group
#endif
{
/* only do existing tags, as set by regular depsgraph */
- for(go= group->gobject.first; go; go= go->next) {
- if(go->ob) {
- if(go->ob->recalc) {
+ for (go= group->gobject.first; go; go= go->next) {
+ if (go->ob) {
+ if (go->ob->recalc) {
object_handle_update(scene, go->ob);
}
}
@@ -398,17 +398,17 @@ Object *group_get_member_with_action(Group *group, bAction *act)
{
GroupObject *go;
- if(group==NULL || act==NULL) return NULL;
+ if (group==NULL || act==NULL) return NULL;
- for(go= group->gobject.first; go; go= go->next) {
- if(go->ob) {
- if(go->ob->action==act)
+ for (go= group->gobject.first; go; go= go->next) {
+ if (go->ob) {
+ if (go->ob->action==act)
return go->ob;
- if(go->ob->nlastrips.first) {
+ if (go->ob->nlastrips.first) {
bActionStrip *strip;
- for(strip= go->ob->nlastrips.first; strip; strip= strip->next) {
- if(strip->act==act)
+ for (strip= go->ob->nlastrips.first; strip; strip= strip->next) {
+ if (strip->act==act)
return go->ob;
}
}
@@ -425,18 +425,18 @@ void group_relink_nla_objects(Object *ob)
GroupObject *go;
bActionStrip *strip;
- if(ob==NULL || ob->dup_group==NULL) return;
+ if (ob==NULL || ob->dup_group==NULL) return;
group= ob->dup_group;
- for(strip= ob->nlastrips.first; strip; strip= strip->next) {
- if(strip->object) {
- for(go= group->gobject.first; go; go= go->next) {
- if(go->ob) {
- if(strcmp(go->ob->id.name, strip->object->id.name)==0)
+ for (strip= ob->nlastrips.first; strip; strip= strip->next) {
+ if (strip->object) {
+ for (go= group->gobject.first; go; go= go->next) {
+ if (go->ob) {
+ if (strcmp(go->ob->id.name, strip->object->id.name)==0)
break;
}
}
- if(go)
+ if (go)
strip->object= go->ob;
else
strip->object= NULL;
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 72038955c55..edde21ed7c8 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -91,7 +91,7 @@ static int get_next_free_id(void)
while (BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(startId)) && startId>=gFirstIconId)
startId++;
- /* if we found a suitable one that isnt used yet, return it */
+ /* if we found a suitable one that isn't used yet, return it */
if (startId>=gFirstIconId)
return startId;
@@ -110,7 +110,7 @@ void BKE_icons_init(int first_dyn_id)
void BKE_icons_free(void)
{
- if(gIcons)
+ if (gIcons)
BLI_ghash_free(gIcons, NULL, icon_free);
gIcons = NULL;
}
@@ -147,7 +147,7 @@ void BKE_previewimg_freefunc(void *link)
void BKE_previewimg_free(PreviewImage **prv)
{
- if(prv && (*prv)) {
+ if (prv && (*prv)) {
BKE_previewimg_freefunc(*prv);
*prv = NULL;
}
@@ -163,7 +163,8 @@ struct PreviewImage* BKE_previewimg_copy(PreviewImage *prv)
for (i=0; i < NUM_ICON_SIZES; ++i) {
if (prv->rect[i]) {
prv_img->rect[i] = MEM_dupallocN(prv->rect[i]);
- } else {
+ }
+ else {
prv_img->rect[i] = NULL;
}
}
@@ -176,19 +177,24 @@ void BKE_previewimg_free_id(ID *id)
if (GS(id->name) == ID_MA) {
Material *mat = (Material*)id;
BKE_previewimg_free(&mat->preview);
- } else if (GS(id->name) == ID_TE) {
+ }
+ else if (GS(id->name) == ID_TE) {
Tex *tex = (Tex*)id;
BKE_previewimg_free(&tex->preview);
- } else if (GS(id->name) == ID_WO) {
+ }
+ else if (GS(id->name) == ID_WO) {
World *wo = (World*)id;
BKE_previewimg_free(&wo->preview);
- } else if (GS(id->name) == ID_LA) {
+ }
+ else if (GS(id->name) == ID_LA) {
Lamp *la = (Lamp*)id;
BKE_previewimg_free(&la->preview);
- } else if (GS(id->name) == ID_IM) {
+ }
+ else if (GS(id->name) == ID_IM) {
Image *img = (Image*)id;
BKE_previewimg_free(&img->preview);
- } else if (GS(id->name) == ID_BR) {
+ }
+ else if (GS(id->name) == ID_BR) {
Brush *br = (Brush*)id;
BKE_previewimg_free(&br->preview);
}
@@ -202,23 +208,28 @@ PreviewImage* BKE_previewimg_get(ID *id)
Material *mat = (Material*)id;
if (!mat->preview) mat->preview = BKE_previewimg_create();
prv_img = mat->preview;
- } else if (GS(id->name) == ID_TE) {
+ }
+ else if (GS(id->name) == ID_TE) {
Tex *tex = (Tex*)id;
if (!tex->preview) tex->preview = BKE_previewimg_create();
prv_img = tex->preview;
- } else if (GS(id->name) == ID_WO) {
+ }
+ else if (GS(id->name) == ID_WO) {
World *wo = (World*)id;
if (!wo->preview) wo->preview = BKE_previewimg_create();
prv_img = wo->preview;
- } else if (GS(id->name) == ID_LA) {
+ }
+ else if (GS(id->name) == ID_LA) {
Lamp *la = (Lamp*)id;
if (!la->preview) la->preview = BKE_previewimg_create();
prv_img = la->preview;
- } else if (GS(id->name) == ID_IM) {
+ }
+ else if (GS(id->name) == ID_IM) {
Image *img = (Image*)id;
if (!img->preview) img->preview = BKE_previewimg_create();
prv_img = img->preview;
- } else if (GS(id->name) == ID_BR) {
+ }
+ else if (GS(id->name) == ID_BR) {
Brush *br = (Brush*)id;
if (!br->preview) br->preview = BKE_previewimg_create();
prv_img = br->preview;
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index b06cc8414a6..1fee5cfa359 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -74,7 +74,7 @@ IDProperty *IDP_NewIDPArray(const char *name)
IDProperty *IDP_CopyIDPArray(IDProperty *array)
{
- /* dont use MEM_dupallocN because this may be part of an array */
+ /* don't use MEM_dupallocN because this may be part of an array */
IDProperty *narray = MEM_mallocN(sizeof(IDProperty), "IDP_CopyIDPArray"), *tmp;
int i;
@@ -103,7 +103,7 @@ void IDP_FreeIDPArray(IDProperty *prop)
for (i=0; i<prop->len; i++)
IDP_FreeProperty(GETPROP(prop, i));
- if(prop->data.pointer)
+ if (prop->data.pointer)
MEM_freeN(prop->data.pointer);
}
@@ -139,7 +139,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
if (newlen <= prop->totallen && prop->totallen - newlen < 200) {
int i;
- for(i=newlen; i<prop->len; i++)
+ for (i=newlen; i<prop->len; i++)
IDP_FreeProperty(GETPROP(prop, i));
prop->len = newlen;
@@ -170,7 +170,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
memcpy(newarr, prop->data.pointer, newlen*sizeof(IDProperty));
}
- if(prop->data.pointer)
+ if (prop->data.pointer)
MEM_freeN(prop->data.pointer);
prop->data.pointer = newarr;
prop->len = newlen;
@@ -180,16 +180,16 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
/* ----------- Numerical Array Type ----------- */
static void idp_resize_group_array(IDProperty *prop, int newlen, void *newarr)
{
- if(prop->subtype != IDP_GROUP)
+ if (prop->subtype != IDP_GROUP)
return;
- if(newlen >= prop->len) {
+ if (newlen >= prop->len) {
/* bigger */
IDProperty **array= newarr;
IDPropertyTemplate val;
int a;
- for(a=prop->len; a<newlen; a++) {
+ for (a=prop->len; a<newlen; a++) {
val.i = 0; /* silence MSVC warning about uninitialized var when debugging */
array[a]= IDP_New(IDP_GROUP, &val, "IDP_ResizeArray group");
}
@@ -199,7 +199,7 @@ static void idp_resize_group_array(IDProperty *prop, int newlen, void *newarr)
IDProperty **array= prop->data.pointer;
int a;
- for(a=newlen; a<prop->len; a++) {
+ for (a=newlen; a<prop->len; a++) {
IDP_FreeProperty(array[a]);
MEM_freeN(array[a]);
}
@@ -277,11 +277,11 @@ static IDProperty *IDP_CopyArray(IDProperty *prop)
if (prop->data.pointer) {
newp->data.pointer = MEM_dupallocN(prop->data.pointer);
- if(prop->type == IDP_GROUP) {
+ if (prop->type == IDP_GROUP) {
IDProperty **array= newp->data.pointer;
int a;
- for(a=0; a<prop->len; a++)
+ for (a=0; a<prop->len; a++)
array[a]= IDP_CopyProperty(array[a]);
}
}
@@ -316,7 +316,7 @@ IDProperty *IDP_NewString(const char *st, const char *name, int maxlen)
else {
int stlen = strlen(st);
- if(maxlen > 0 && maxlen < stlen)
+ if (maxlen > 0 && maxlen < stlen)
stlen = maxlen;
stlen++; /* null terminator '\0' */
@@ -349,7 +349,7 @@ void IDP_AssignString(IDProperty *prop, const char *st, int maxlen)
{
int stlen = strlen(st);
- if(maxlen > 0 && maxlen < stlen)
+ if (maxlen > 0 && maxlen < stlen)
stlen= maxlen;
if (prop->subtype == IDP_STRING_SUB_BYTE) {
@@ -387,7 +387,7 @@ void IDP_ConcatString(IDProperty *str1, IDProperty *append)
void IDP_FreeString(IDProperty *prop)
{
- if(prop->data.pointer)
+ if (prop->data.pointer)
MEM_freeN(prop->data.pointer);
}
@@ -608,9 +608,9 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
if (create_if_needed) {
id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty");
id->properties->type = IDP_GROUP;
- /* dont overwrite the data's name and type
+ /* don't overwrite the data's name and type
* some functions might need this if they
- * dont have a real ID, should be named elsewhere - Campbell */
+ * don't have a real ID, should be named elsewhere - Campbell */
/* strcpy(id->name, "top_level_group");*/
}
return id->properties;
@@ -619,59 +619,59 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
int IDP_EqualsProperties(IDProperty *prop1, IDProperty *prop2)
{
- if(prop1 == NULL && prop2 == NULL)
+ if (prop1 == NULL && prop2 == NULL)
return 1;
- else if(prop1 == NULL || prop2 == NULL)
+ else if (prop1 == NULL || prop2 == NULL)
return 0;
- else if(prop1->type != prop2->type)
+ else if (prop1->type != prop2->type)
return 0;
- if(prop1->type == IDP_INT)
+ if (prop1->type == IDP_INT)
return (IDP_Int(prop1) == IDP_Int(prop2));
- else if(prop1->type == IDP_FLOAT)
+ else if (prop1->type == IDP_FLOAT)
return (IDP_Float(prop1) == IDP_Float(prop2));
- else if(prop1->type == IDP_DOUBLE)
+ else if (prop1->type == IDP_DOUBLE)
return (IDP_Double(prop1) == IDP_Double(prop2));
- else if(prop1->type == IDP_STRING)
+ else if (prop1->type == IDP_STRING)
return ((prop1->len == prop2->len) && strncmp(IDP_String(prop1), IDP_String(prop2), prop1->len) == 0);
- else if(prop1->type == IDP_ARRAY) {
- if(prop1->len == prop2->len && prop1->subtype == prop2->subtype)
+ else if (prop1->type == IDP_ARRAY) {
+ if (prop1->len == prop2->len && prop1->subtype == prop2->subtype)
return memcmp(IDP_Array(prop1), IDP_Array(prop2), idp_size_table[(int)prop1->subtype]*prop1->len);
else
return 0;
}
- else if(prop1->type == IDP_GROUP) {
+ else if (prop1->type == IDP_GROUP) {
IDProperty *link1, *link2;
- if(BLI_countlist(&prop1->data.group) != BLI_countlist(&prop2->data.group))
+ if (BLI_countlist(&prop1->data.group) != BLI_countlist(&prop2->data.group))
return 0;
- for(link1=prop1->data.group.first; link1; link1=link1->next) {
+ for (link1=prop1->data.group.first; link1; link1=link1->next) {
link2= IDP_GetPropertyFromGroup(prop2, link1->name);
- if(!IDP_EqualsProperties(link1, link2))
+ if (!IDP_EqualsProperties(link1, link2))
return 0;
}
return 1;
}
- else if(prop1->type == IDP_IDPARRAY) {
+ else if (prop1->type == IDP_IDPARRAY) {
IDProperty *array1= IDP_IDPArray(prop1);
IDProperty *array2= IDP_IDPArray(prop2);
int i;
- if(prop1->len != prop2->len)
+ if (prop1->len != prop2->len)
return 0;
- for(i=0; i<prop1->len; i++)
- if(!IDP_EqualsProperties(&array1[i], &array2[i]))
+ for (i=0; i<prop1->len; i++)
+ if (!IDP_EqualsProperties(&array1[i], &array2[i]))
return 0;
}
return 1;
}
-/* 'val' is never NULL, dont check */
+/* 'val' is never NULL, don't check */
IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name)
{
IDProperty *prop=NULL;
@@ -703,7 +703,8 @@ IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *n
prop->data.pointer = MEM_callocN(idp_size_table[val->array.type]*val->array.len, "id property array");
prop->len = prop->totallen = val->array.len;
break;
- } else {
+ }
+ else {
return NULL;
}
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 3ac95b83e74..3b91afbc126 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -160,8 +160,8 @@ static void de_interlace_st(struct ImBuf *ibuf) /* standard fields */
void image_de_interlace(Image *ima, int odd)
{
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- if(ibuf) {
- if(odd)
+ if (ibuf) {
+ if (odd)
de_interlace_st(ibuf);
else
de_interlace_ng(ibuf);
@@ -174,7 +174,7 @@ static void image_free_buffers(Image *ima)
{
ImBuf *ibuf;
- while((ibuf = ima->ibufs.first)) {
+ while ((ibuf = ima->ibufs.first)) {
BLI_remlink(&ima->ibufs, ibuf);
if (ibuf->userdata) {
@@ -184,10 +184,10 @@ static void image_free_buffers(Image *ima)
IMB_freeImBuf(ibuf);
}
- if(ima->anim) IMB_free_anim(ima->anim);
+ if (ima->anim) IMB_free_anim(ima->anim);
ima->anim= NULL;
- if(ima->rr) {
+ if (ima->rr) {
RE_FreeRenderResult(ima->rr);
ima->rr= NULL;
}
@@ -212,8 +212,8 @@ void free_image(Image *ima)
BKE_previewimg_free(&ima->preview);
- for(a=0; a<IMA_MAX_RENDER_SLOT; a++) {
- if(ima->renders[a]) {
+ for (a=0; a<IMA_MAX_RENDER_SLOT; a++) {
+ if (ima->renders[a]) {
RE_FreeRenderResult(ima->renders[a]);
ima->renders[a]= NULL;
}
@@ -226,7 +226,7 @@ static Image *image_alloc(const char *name, short source, short type)
Image *ima;
ima= alloc_libblock(&G.main->image, ID_IM, name);
- if(ima) {
+ if (ima) {
ima->ok= IMA_OK;
ima->xrep= ima->yrep= 1;
@@ -246,14 +246,14 @@ static ImBuf *image_get_ibuf(Image *ima, int index, int frame)
/* this function is intended to be thread safe. with IMA_NO_INDEX this
* should be OK, but when iterating over the list this is more tricky
* */
- if(index==IMA_NO_INDEX)
+ if (index==IMA_NO_INDEX)
return ima->ibufs.first;
else {
ImBuf *ibuf;
index= IMA_MAKE_INDEX(frame, index);
- for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next)
- if(ibuf->index==index)
+ for (ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next)
+ if (ibuf->index==index)
return ibuf;
return NULL;
@@ -263,7 +263,7 @@ static ImBuf *image_get_ibuf(Image *ima, int index, int frame)
/* no ima->ibuf anymore, but listbase */
static void image_remove_ibuf(Image *ima, ImBuf *ibuf)
{
- if(ibuf) {
+ if (ibuf) {
BLI_remlink(&ima->ibufs, ibuf);
IMB_freeImBuf(ibuf);
}
@@ -273,19 +273,19 @@ static void image_remove_ibuf(Image *ima, ImBuf *ibuf)
/* no ima->ibuf anymore, but listbase */
static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame)
{
- if(ibuf) {
+ if (ibuf) {
ImBuf *link;
- if(index!=IMA_NO_INDEX)
+ if (index!=IMA_NO_INDEX)
index= IMA_MAKE_INDEX(frame, index);
/* insert based on index */
- for(link= ima->ibufs.first; link; link= link->next)
- if(link->index>=index)
+ for (link= ima->ibufs.first; link; link= link->next)
+ if (link->index>=index)
break;
ibuf->index= index;
- if(ima->flag & IMA_CM_PREDIVIDE)
+ if (ima->flag & IMA_CM_PREDIVIDE)
ibuf->flags |= IB_cm_predivide;
else
ibuf->flags &= ~IB_cm_predivide;
@@ -294,7 +294,7 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame)
BLI_insertlinkbefore(&ima->ibufs, link, ibuf);
/* now we don't want copies? */
- if(link && ibuf->index==link->index)
+ if (link && ibuf->index==link->index)
image_remove_ibuf(ima, link);
}
}
@@ -340,42 +340,42 @@ void make_local_image(struct Image *ima)
* - mixed: make copy
*/
- if(ima->id.lib==NULL) return;
+ if (ima->id.lib==NULL) return;
/* Can't take short cut here: must check meshes at least because of bogus
* texface ID refs. - z0r */
#if 0
- if(ima->id.us==1) {
+ if (ima->id.us==1) {
id_clear_lib_data(bmain, &ima->id);
extern_local_image(ima);
return;
}
#endif
- for(tex= bmain->tex.first; tex; tex= tex->id.next) {
- if(tex->ima == ima) {
- if(tex->id.lib) is_lib= TRUE;
+ for (tex= bmain->tex.first; tex; tex= tex->id.next) {
+ if (tex->ima == ima) {
+ if (tex->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
- for(brush= bmain->brush.first; brush; brush= brush->id.next) {
- if(brush->clone.image == ima) {
- if(brush->id.lib) is_lib= TRUE;
+ for (brush= bmain->brush.first; brush; brush= brush->id.next) {
+ if (brush->clone.image == ima) {
+ if (brush->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
- for(me= bmain->mesh.first; me; me= me->id.next) {
- if(me->mtface) {
+ for (me= bmain->mesh.first; me; me= me->id.next) {
+ if (me->mtface) {
MTFace *tface;
int a, i;
- for(i=0; i<me->fdata.totlayer; i++) {
- if(me->fdata.layers[i].type == CD_MTFACE) {
+ for (i=0; i<me->fdata.totlayer; i++) {
+ if (me->fdata.layers[i].type == CD_MTFACE) {
tface= (MTFace*)me->fdata.layers[i].data;
- for(a=0; a<me->totface; a++, tface++) {
- if(tface->tpage == ima) {
- if(me->id.lib) is_lib= TRUE;
+ for (a=0; a<me->totface; a++, tface++) {
+ if (tface->tpage == ima) {
+ if (me->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
@@ -383,17 +383,17 @@ void make_local_image(struct Image *ima)
}
}
- if(me->mtpoly) {
+ if (me->mtpoly) {
MTexPoly *mtpoly;
int a, i;
- for(i=0; i<me->pdata.totlayer; i++) {
- if(me->pdata.layers[i].type == CD_MTEXPOLY) {
+ for (i=0; i<me->pdata.totlayer; i++) {
+ if (me->pdata.layers[i].type == CD_MTEXPOLY) {
mtpoly= (MTexPoly*)me->pdata.layers[i].data;
- for(a=0; a<me->totpoly; a++, mtpoly++) {
- if(mtpoly->tpage == ima) {
- if(me->id.lib) is_lib= TRUE;
+ for (a=0; a<me->totpoly; a++, mtpoly++) {
+ if (mtpoly->tpage == ima) {
+ if (me->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
@@ -403,11 +403,11 @@ void make_local_image(struct Image *ima)
}
- if(is_local && is_lib == FALSE) {
+ if (is_local && is_lib == FALSE) {
id_clear_lib_data(bmain, &ima->id);
extern_local_image(ima);
}
- else if(is_local && is_lib) {
+ else if (is_local && is_lib) {
Image *ima_new= copy_image(ima);
ima_new->id.us= 0;
@@ -416,9 +416,9 @@ void make_local_image(struct Image *ima)
BKE_id_lib_local_paths(bmain, ima->id.lib, &ima_new->id);
tex= bmain->tex.first;
- while(tex) {
- if(tex->id.lib==NULL) {
- if(tex->ima==ima) {
+ while (tex) {
+ if (tex->id.lib==NULL) {
+ if (tex->ima==ima) {
tex->ima = ima_new;
ima_new->id.us++;
ima->id.us--;
@@ -427,9 +427,9 @@ void make_local_image(struct Image *ima)
tex= tex->id.next;
}
brush= bmain->brush.first;
- while(brush) {
- if(brush->id.lib==NULL) {
- if(brush->clone.image==ima) {
+ while (brush) {
+ if (brush->id.lib==NULL) {
+ if (brush->clone.image==ima) {
brush->clone.image = ima_new;
ima_new->id.us++;
ima->id.us--;
@@ -441,19 +441,19 @@ void make_local_image(struct Image *ima)
* user count *unless* there are no other users. See
* readfile.c:lib_link_mtface. */
me= bmain->mesh.first;
- while(me) {
- if(me->mtface) {
+ while (me) {
+ if (me->mtface) {
MTFace *tface;
int a, i;
- for(i=0; i<me->fdata.totlayer; i++) {
- if(me->fdata.layers[i].type == CD_MTFACE) {
+ for (i=0; i<me->fdata.totlayer; i++) {
+ if (me->fdata.layers[i].type == CD_MTFACE) {
tface= (MTFace*)me->fdata.layers[i].data;
- for(a=0; a<me->totface; a++, tface++) {
- if(tface->tpage == ima) {
+ for (a=0; a<me->totface; a++, tface++) {
+ if (tface->tpage == ima) {
tface->tpage = ima_new;
- if(ima_new->id.us == 0) {
+ if (ima_new->id.us == 0) {
tface->tpage->id.us= 1;
}
id_lib_extern((ID*)ima_new);
@@ -463,18 +463,18 @@ void make_local_image(struct Image *ima)
}
}
- if(me->mtpoly) {
+ if (me->mtpoly) {
MTexPoly *mtpoly;
int a, i;
- for(i=0; i<me->pdata.totlayer; i++) {
- if(me->pdata.layers[i].type == CD_MTEXPOLY) {
+ for (i=0; i<me->pdata.totlayer; i++) {
+ if (me->pdata.layers[i].type == CD_MTEXPOLY) {
mtpoly= (MTexPoly*)me->pdata.layers[i].data;
- for(a=0; a<me->totpoly; a++, mtpoly++) {
- if(mtpoly->tpage == ima) {
+ for (a=0; a<me->totpoly; a++, mtpoly++) {
+ if (mtpoly->tpage == ima) {
mtpoly->tpage = ima_new;
- if(ima_new->id.us == 0) {
+ if (ima_new->id.us == 0) {
mtpoly->tpage->id.us= 1;
}
id_lib_extern((ID*)ima_new);
@@ -494,9 +494,9 @@ void BKE_image_merge(Image *dest, Image *source)
ImBuf *ibuf;
/* sanity check */
- if(dest && source && dest!=source) {
+ if (dest && source && dest!=source) {
- while((ibuf= source->ibufs.first)) {
+ while ((ibuf= source->ibufs.first)) {
BLI_remlink(&source->ibufs, ibuf);
image_assign_ibuf(dest, ibuf, IMA_INDEX_PASS(ibuf->index), IMA_INDEX_FRAME(ibuf->index));
}
@@ -521,21 +521,21 @@ Image *BKE_add_image_file(const char *name)
BLI_path_abs(str, G.main->name);
/* exists? */
- file= open(str, O_BINARY|O_RDONLY);
- if(file== -1) return NULL;
+ file= BLI_open(str, O_BINARY|O_RDONLY, 0);
+ if (file== -1) return NULL;
close(file);
/* first search an identical image */
- for(ima= G.main->image.first; ima; ima= ima->id.next) {
- if(ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) {
+ for (ima= G.main->image.first; ima; ima= ima->id.next) {
+ if (ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) {
BLI_strncpy(strtest, ima->name, sizeof(ima->name));
BLI_path_abs(strtest, G.main->name);
if (BLI_path_cmp(strtest, str)==0) {
- if(ima->anim==NULL || ima->id.us==0) {
+ if (ima->anim==NULL || ima->id.us==0) {
BLI_strncpy(ima->name, name, sizeof(ima->name)); /* for stringcode */
ima->id.us++; /* officially should not, it doesn't link here! */
- if(ima->ok==0)
+ if (ima->ok==0)
ima->ok= IMA_OK;
/* RETURN! */
return ima;
@@ -554,7 +554,7 @@ Image *BKE_add_image_file(const char *name)
ima= image_alloc(libname, IMA_SRC_FILE, IMA_TYPE_IMAGE);
BLI_strncpy(ima->name, name, sizeof(ima->name));
- if(BLI_testextensie_array(name, imb_ext_movie))
+ if (BLI_testextensie_array(name, imb_ext_movie))
ima->source= IMA_SRC_MOVIE;
return ima;
@@ -601,7 +601,7 @@ Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *n
if (ima) {
ImBuf *ibuf;
- /* BLI_strncpy(ima->name, name, FILE_MAX); */ /* dont do this, this writes in ain invalid filepath! */
+ /* BLI_strncpy(ima->name, name, FILE_MAX); */ /* don't do this, this writes in ain invalid filepath! */
ima->gen_x= width;
ima->gen_y= height;
ima->gen_type= uvtestgrid;
@@ -638,7 +638,7 @@ void BKE_image_memorypack(Image *ima)
{
ImBuf *ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
- if(ibuf==NULL)
+ if (ibuf==NULL)
return;
if (ima->packedfile) {
freePackedFile(ima->packedfile);
@@ -649,7 +649,7 @@ void BKE_image_memorypack(Image *ima)
ibuf->planes= R_IMF_PLANES_RGBA;
IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem);
- if(ibuf->encodedbuffer==NULL) {
+ if (ibuf->encodedbuffer==NULL) {
printf("memory save for pack error\n");
}
else {
@@ -662,7 +662,7 @@ void BKE_image_memorypack(Image *ima)
ibuf->encodedsize= 0;
ibuf->userflags &= ~IB_BITMAPDIRTY;
- if(ima->source==IMA_SRC_GENERATED) {
+ if (ima->source==IMA_SRC_GENERATED) {
ima->source= IMA_SRC_FILE;
ima->type= IMA_TYPE_IMAGE;
}
@@ -682,8 +682,8 @@ static void tag_all_images_time()
int ctime = (int)PIL_check_seconds_timer();
ima= G.main->image.first;
- while(ima) {
- if(ima->bindcode || ima->repbind || ima->ibufs.first) {
+ while (ima) {
+ if (ima->bindcode || ima->repbind || ima->ibufs.first) {
ima->lastused = ctime;
}
}
@@ -710,11 +710,11 @@ void free_old_images(void)
lasttime = ctime;
ima= G.main->image.first;
- while(ima) {
- if((ima->flag & IMA_NOCOLLECT)==0 && ctime - ima->lastused > U.textimeout) {
+ while (ima) {
+ if ((ima->flag & IMA_NOCOLLECT)==0 && ctime - ima->lastused > U.textimeout) {
/* If it's in GL memory, deallocate and set time tag to current time
* This gives textures a "second chance" to be used before dying. */
- if(ima->bindcode || ima->repbind) {
+ if (ima->bindcode || ima->repbind) {
GPU_free_image(ima);
ima->lastused = ctime;
}
@@ -736,18 +736,18 @@ static uintptr_t image_mem_size(Image *ima)
size= 0;
/* viewers have memory depending on other rules, has no valid rect pointer */
- if(ima->source==IMA_SRC_VIEWER)
+ if (ima->source==IMA_SRC_VIEWER)
return 0;
- for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
- if(ibuf->rect) size += MEM_allocN_len(ibuf->rect);
- else if(ibuf->rect_float) size += MEM_allocN_len(ibuf->rect_float);
+ for (ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
+ if (ibuf->rect) size += MEM_allocN_len(ibuf->rect);
+ else if (ibuf->rect_float) size += MEM_allocN_len(ibuf->rect_float);
- for(level=0; level<IB_MIPMAP_LEVELS; level++) {
+ for (level=0; level<IB_MIPMAP_LEVELS; level++) {
ibufm= ibuf->mipmap[level];
- if(ibufm) {
- if(ibufm->rect) size += MEM_allocN_len(ibufm->rect);
- else if(ibufm->rect_float) size += MEM_allocN_len(ibufm->rect_float);
+ if (ibufm) {
+ if (ibufm->rect) size += MEM_allocN_len(ibufm->rect);
+ else if (ibufm->rect_float) size += MEM_allocN_len(ibufm->rect_float);
}
}
}
@@ -760,15 +760,15 @@ void BKE_image_print_memlist(void)
Image *ima;
uintptr_t size, totsize= 0;
- for(ima= G.main->image.first; ima; ima= ima->id.next)
+ for (ima= G.main->image.first; ima; ima= ima->id.next)
totsize += image_mem_size(ima);
printf("\ntotal image memory len: %.3f MB\n", (double)totsize/(double)(1024*1024));
- for(ima= G.main->image.first; ima; ima= ima->id.next) {
+ for (ima= G.main->image.first; ima; ima= ima->id.next) {
size= image_mem_size(ima);
- if(size)
+ if (size)
printf("%s len: %.3f MB\n", ima->id.name+2, (double)size/(double)(1024*1024));
}
}
@@ -779,30 +779,30 @@ void BKE_image_free_all_textures(void)
Image *ima;
/* unsigned int totsize= 0; */
- for(ima= G.main->image.first; ima; ima= ima->id.next)
+ for (ima= G.main->image.first; ima; ima= ima->id.next)
ima->id.flag &= ~LIB_DOIT;
- for(tex= G.main->tex.first; tex; tex= tex->id.next)
- if(tex->ima)
+ for (tex= G.main->tex.first; tex; tex= tex->id.next)
+ if (tex->ima)
tex->ima->id.flag |= LIB_DOIT;
- for(ima= G.main->image.first; ima; ima= ima->id.next) {
- if(ima->ibufs.first && (ima->id.flag & LIB_DOIT)) {
+ for (ima= G.main->image.first; ima; ima= ima->id.next) {
+ if (ima->ibufs.first && (ima->id.flag & LIB_DOIT)) {
ImBuf *ibuf;
- for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
+ for (ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
/* escape when image is painted on */
- if(ibuf->userflags & IB_BITMAPDIRTY)
+ if (ibuf->userflags & IB_BITMAPDIRTY)
break;
#if 0
- if(ibuf->mipmap[0])
+ if (ibuf->mipmap[0])
totsize+= 1.33*ibuf->x*ibuf->y*4;
else
totsize+= ibuf->x*ibuf->y*4;
#endif
}
- if(ibuf==NULL)
+ if (ibuf==NULL)
image_free_buffers(ima);
}
}
@@ -814,13 +814,13 @@ void BKE_image_free_anim_ibufs(Image *ima, int except_frame)
{
ImBuf *ibuf, *nbuf;
- for(ibuf= ima->ibufs.first; ibuf; ibuf= nbuf) {
+ for (ibuf= ima->ibufs.first; ibuf; ibuf= nbuf) {
nbuf= ibuf->next;
- if(ibuf->userflags & IB_BITMAPDIRTY)
+ if (ibuf->userflags & IB_BITMAPDIRTY)
continue;
- if(ibuf->index==IMA_NO_INDEX)
+ if (ibuf->index==IMA_NO_INDEX)
continue;
- if(except_frame!=IMA_INDEX_FRAME(ibuf->index)) {
+ if (except_frame!=IMA_INDEX_FRAME(ibuf->index)) {
BLI_remlink(&ima->ibufs, ibuf);
if (ibuf->userdata) {
@@ -836,8 +836,8 @@ void BKE_image_all_free_anim_ibufs(int cfra)
{
Image *ima;
- for(ima= G.main->image.first; ima; ima= ima->id.next)
- if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
+ for (ima= G.main->image.first; ima; ima= ima->id.next)
+ if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
BKE_image_free_anim_ibufs(ima, cfra);
}
@@ -846,11 +846,11 @@ void BKE_image_all_free_anim_ibufs(int cfra)
int BKE_imtype_to_ftype(const char imtype)
{
- if(imtype==R_IMF_IMTYPE_TARGA)
+ if (imtype==R_IMF_IMTYPE_TARGA)
return TGA;
- else if(imtype==R_IMF_IMTYPE_RAWTGA)
+ else if (imtype==R_IMF_IMTYPE_RAWTGA)
return RAWTGA;
- else if(imtype== R_IMF_IMTYPE_IRIS)
+ else if (imtype== R_IMF_IMTYPE_IRIS)
return IMAGIC;
#ifdef WITH_HDR
else if (imtype==R_IMF_IMTYPE_RADHDR)
@@ -877,7 +877,7 @@ int BKE_imtype_to_ftype(const char imtype)
return DPX;
#endif
#ifdef WITH_OPENJPEG
- else if(imtype==R_IMF_IMTYPE_JP2)
+ else if (imtype==R_IMF_IMTYPE_JP2)
return JP2;
#endif
else
@@ -886,9 +886,9 @@ int BKE_imtype_to_ftype(const char imtype)
char BKE_ftype_to_imtype(const int ftype)
{
- if(ftype==0)
+ if (ftype==0)
return R_IMF_IMTYPE_TARGA;
- else if(ftype == IMAGIC)
+ else if (ftype == IMAGIC)
return R_IMF_IMTYPE_IRIS;
#ifdef WITH_HDR
else if (ftype & RADHDR)
@@ -916,10 +916,10 @@ char BKE_ftype_to_imtype(const int ftype)
#endif
else if (ftype & TGA)
return R_IMF_IMTYPE_TARGA;
- else if(ftype & RAWTGA)
+ else if (ftype & RAWTGA)
return R_IMF_IMTYPE_RAWTGA;
#ifdef WITH_OPENJPEG
- else if(ftype & JP2)
+ else if (ftype & JP2)
return R_IMF_IMTYPE_JP2;
#endif
else
@@ -1076,79 +1076,79 @@ int BKE_add_image_extension(char *string, const char imtype)
{
const char *extension= NULL;
- if(imtype== R_IMF_IMTYPE_IRIS) {
- if(!BLI_testextensie(string, ".rgb"))
+ if (imtype== R_IMF_IMTYPE_IRIS) {
+ if (!BLI_testextensie(string, ".rgb"))
extension= ".rgb";
}
- else if(imtype==R_IMF_IMTYPE_IRIZ) {
- if(!BLI_testextensie(string, ".rgb"))
+ else if (imtype==R_IMF_IMTYPE_IRIZ) {
+ if (!BLI_testextensie(string, ".rgb"))
extension= ".rgb";
}
#ifdef WITH_HDR
- else if(imtype==R_IMF_IMTYPE_RADHDR) {
- if(!BLI_testextensie(string, ".hdr"))
+ else if (imtype==R_IMF_IMTYPE_RADHDR) {
+ if (!BLI_testextensie(string, ".hdr"))
extension= ".hdr";
}
#endif
else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
- if(!BLI_testextensie(string, ".png"))
+ if (!BLI_testextensie(string, ".png"))
extension= ".png";
}
#ifdef WITH_DDS
- else if(imtype==R_IMF_IMTYPE_DDS) {
- if(!BLI_testextensie(string, ".dds"))
+ else if (imtype==R_IMF_IMTYPE_DDS) {
+ if (!BLI_testextensie(string, ".dds"))
extension= ".dds";
}
#endif
- else if(imtype==R_IMF_IMTYPE_RAWTGA) {
- if(!BLI_testextensie(string, ".tga"))
+ else if (imtype==R_IMF_IMTYPE_RAWTGA) {
+ if (!BLI_testextensie(string, ".tga"))
extension= ".tga";
}
- else if(imtype==R_IMF_IMTYPE_BMP) {
- if(!BLI_testextensie(string, ".bmp"))
+ else if (imtype==R_IMF_IMTYPE_BMP) {
+ if (!BLI_testextensie(string, ".bmp"))
extension= ".bmp";
}
#ifdef WITH_TIFF
- else if(imtype==R_IMF_IMTYPE_TIFF) {
- if(!BLI_testextensie(string, ".tif") &&
+ else if (imtype==R_IMF_IMTYPE_TIFF) {
+ if (!BLI_testextensie(string, ".tif") &&
!BLI_testextensie(string, ".tiff")) extension= ".tif";
}
#endif
#ifdef WITH_OPENEXR
- else if( ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
- if(!BLI_testextensie(string, ".exr"))
+ else if ( ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
+ if (!BLI_testextensie(string, ".exr"))
extension= ".exr";
}
#endif
#ifdef WITH_CINEON
- else if(imtype==R_IMF_IMTYPE_CINEON) {
+ else if (imtype==R_IMF_IMTYPE_CINEON) {
if (!BLI_testextensie(string, ".cin"))
extension= ".cin";
}
- else if(imtype==R_IMF_IMTYPE_DPX) {
+ else if (imtype==R_IMF_IMTYPE_DPX) {
if (!BLI_testextensie(string, ".dpx"))
extension= ".dpx";
}
#endif
- else if(imtype==R_IMF_IMTYPE_TARGA) {
- if(!BLI_testextensie(string, ".tga"))
+ else if (imtype==R_IMF_IMTYPE_TARGA) {
+ if (!BLI_testextensie(string, ".tga"))
extension= ".tga";
}
#ifdef WITH_OPENJPEG
- else if(imtype==R_IMF_IMTYPE_JP2) {
- if(!BLI_testextensie(string, ".jp2"))
+ else if (imtype==R_IMF_IMTYPE_JP2) {
+ if (!BLI_testextensie(string, ".jp2"))
extension= ".jp2";
}
#endif
else { // R_IMF_IMTYPE_AVICODEC, R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG, R_IMF_IMTYPE_JPEG90, R_IMF_IMTYPE_QUICKTIME etc
- if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
+ if (!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
extension= ".jpg";
}
- if(extension) {
+ if (extension) {
/* prefer this in many cases to avoid .png.tga, but in certain cases it breaks */
/* remove any other known image extension */
- if(BLI_testextensie_array(string, imb_ext_image)
+ if (BLI_testextensie_array(string, imb_ext_image)
|| (G.have_quicktime && BLI_testextensie_array(string, imb_ext_image_qt))) {
return BLI_replace_extension(string, FILE_MAX, extension);
}
@@ -1185,14 +1185,16 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (scene->r.stamp & R_STAMP_FILENAME) {
BLI_snprintf(stamp_data->file, sizeof(stamp_data->file), do_prefix ? "File %s":"%s", G.relbase_valid ? G.main->name:"<untitled>");
- } else {
+ }
+ else {
stamp_data->file[0] = '\0';
}
if (scene->r.stamp & R_STAMP_NOTE) {
/* Never do prefix for Note */
BLI_snprintf(stamp_data->note, sizeof(stamp_data->note), "%s", scene->r.stamp_udata);
- } else {
+ }
+ else {
stamp_data->note[0] = '\0';
}
@@ -1201,7 +1203,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
tl = localtime(&t);
BLI_snprintf(text, sizeof(text), "%04d/%02d/%02d %02d:%02d:%02d", tl->tm_year+1900, tl->tm_mon+1, tl->tm_mday, tl->tm_hour, tl->tm_min, tl->tm_sec);
BLI_snprintf(stamp_data->date, sizeof(stamp_data->date), do_prefix ? "Date %s":"%s", text);
- } else {
+ }
+ else {
stamp_data->date[0] = '\0';
}
@@ -1212,7 +1215,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
else BLI_strncpy(text, "<none>", sizeof(text));
BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), do_prefix ? "Marker %s":"%s", text);
- } else {
+ }
+ else {
stamp_data->marker[0] = '\0';
}
@@ -1238,7 +1242,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
BLI_snprintf(text, sizeof(text), "%02d:%02d:%02d.%03d", h, m, s, f);
BLI_snprintf(stamp_data->time, sizeof(stamp_data->time), do_prefix ? "Time %s":"%s", text);
- } else {
+ }
+ else {
stamp_data->time[0] = '\0';
}
@@ -1246,18 +1251,20 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
char fmtstr[32];
int digits= 1;
- if(scene->r.efra>9)
+ if (scene->r.efra>9)
digits= 1 + (int) log10(scene->r.efra);
BLI_snprintf(fmtstr, sizeof(fmtstr), do_prefix ? "Frame %%0%di":"%%0%di", digits);
BLI_snprintf (stamp_data->frame, sizeof(stamp_data->frame), fmtstr, scene->r.cfra);
- } else {
+ }
+ else {
stamp_data->frame[0] = '\0';
}
if (scene->r.stamp & R_STAMP_CAMERA) {
BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s":"%s", camera ? camera->id.name+2 : "<none>");
- } else {
+ }
+ else {
stamp_data->camera[0] = '\0';
}
@@ -1268,13 +1275,15 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
else BLI_strncpy(text, "<none>", sizeof(text));
BLI_snprintf(stamp_data->cameralens, sizeof(stamp_data->cameralens), do_prefix ? "Lens %s":"%s", text);
- } else {
+ }
+ else {
stamp_data->cameralens[0] = '\0';
}
if (scene->r.stamp & R_STAMP_SCENE) {
BLI_snprintf(stamp_data->scene, sizeof(stamp_data->scene), do_prefix ? "Scene %s":"%s", scene->id.name+2);
- } else {
+ }
+ else {
stamp_data->scene[0] = '\0';
}
@@ -1285,7 +1294,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
else BLI_strncpy(text, "<none>", sizeof(text));
BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s":"%s", text);
- } else {
+ }
+ else {
stamp_data->strip[0] = '\0';
}
@@ -1297,7 +1307,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
BLI_timestr(stats->lastframetime, text);
BLI_snprintf(stamp_data->rendertime, sizeof(stamp_data->rendertime), do_prefix ? "RenderTime %s":"%s", text);
- } else {
+ }
+ else {
stamp_data->rendertime[0] = '\0';
}
}
@@ -1320,7 +1331,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
stampdata(scene, camera, &stamp_data, 1);
/* TODO, do_versions */
- if(scene->r.stamp_font_id < 8)
+ if (scene->r.stamp_font_id < 8)
scene->r.stamp_font_id= 12;
/* set before return */
@@ -1523,18 +1534,18 @@ void BKE_stamp_info(Scene *scene, Object *camera, struct ImBuf *ibuf)
int BKE_alphatest_ibuf(ImBuf *ibuf)
{
int tot;
- if(ibuf->rect_float) {
+ if (ibuf->rect_float) {
float *buf= ibuf->rect_float;
- for(tot= ibuf->x * ibuf->y; tot--; buf+=4) {
- if(buf[3] < 1.0f) {
+ for (tot= ibuf->x * ibuf->y; tot--; buf+=4) {
+ if (buf[3] < 1.0f) {
return TRUE;
}
}
}
else if (ibuf->rect) {
unsigned char *buf= (unsigned char *)ibuf->rect;
- for(tot= ibuf->x * ibuf->y; tot--; buf+=4) {
- if(buf[3] != 255) {
+ for (tot= ibuf->x * ibuf->y; tot--; buf+=4) {
+ if (buf[3] != 255) {
return TRUE;
}
}
@@ -1553,7 +1564,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
int ok;
- if(imtype== R_IMF_IMTYPE_IRIS) {
+ if (imtype== R_IMF_IMTYPE_IRIS) {
ibuf->ftype= IMAGIC;
}
#ifdef WITH_HDR
@@ -1564,7 +1575,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
ibuf->ftype= PNG;
- if(imtype==R_IMF_IMTYPE_PNG)
+ if (imtype==R_IMF_IMTYPE_PNG)
ibuf->ftype |= compress;
}
@@ -1580,18 +1591,18 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
else if (imtype==R_IMF_IMTYPE_TIFF) {
ibuf->ftype= TIF;
- if(imf->depth == R_IMF_CHAN_DEPTH_16)
+ if (imf->depth == R_IMF_CHAN_DEPTH_16)
ibuf->ftype |= TIF_16BIT;
}
#endif
#ifdef WITH_OPENEXR
else if (imtype==R_IMF_IMTYPE_OPENEXR || imtype==R_IMF_IMTYPE_MULTILAYER) {
ibuf->ftype= OPENEXR;
- if(imf->depth == R_IMF_CHAN_DEPTH_16)
+ if (imf->depth == R_IMF_CHAN_DEPTH_16)
ibuf->ftype |= OPENEXR_HALF;
ibuf->ftype |= (imf->exr_codec & OPENEXR_COMPRESS);
- if(!(imf->flag & R_IMF_FLAG_ZBUF))
+ if (!(imf->flag & R_IMF_FLAG_ZBUF))
ibuf->zbuf_float = NULL; /* signal for exr saving */
}
@@ -1607,17 +1618,18 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
else if (imtype==R_IMF_IMTYPE_TARGA) {
ibuf->ftype= TGA;
}
- else if(imtype==R_IMF_IMTYPE_RAWTGA) {
+ else if (imtype==R_IMF_IMTYPE_RAWTGA) {
ibuf->ftype= RAWTGA;
}
#ifdef WITH_OPENJPEG
- else if(imtype==R_IMF_IMTYPE_JP2) {
- if(quality < 10) quality= 90;
+ else if (imtype==R_IMF_IMTYPE_JP2) {
+ if (quality < 10) quality= 90;
ibuf->ftype= JP2|quality;
if (imf->depth == R_IMF_CHAN_DEPTH_16) {
ibuf->ftype |= JP2_16BIT;
- } else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
+ }
+ else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
ibuf->ftype |= JP2_12BIT;
}
@@ -1634,7 +1646,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
#endif
else {
/* R_IMF_IMTYPE_JPEG90, etc. default we save jpegs */
- if(quality < 10) quality= 90;
+ if (quality < 10) quality= 90;
ibuf->ftype= JPG|quality;
}
@@ -1673,7 +1685,7 @@ int BKE_write_ibuf_as(ImBuf *ibuf, const char *name, ImageFormatData *imf,
int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, struct ImageFormatData *imf)
{
- if(scene && scene->r.stamp & R_STAMP_ALL)
+ if (scene && scene->r.stamp & R_STAMP_ALL)
BKE_stamp_info(scene, camera, ibuf);
return BKE_write_ibuf(ibuf, name, imf);
@@ -1686,10 +1698,10 @@ void BKE_makepicstring(char *string, const char *base, const char *relbase, int
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
BLI_path_abs(string, relbase);
- if(use_frames)
+ if (use_frames)
BLI_path_frame(string, frame, 4);
- if(use_ext)
+ if (use_ext)
BKE_add_image_extension(string, imtype);
}
@@ -1705,7 +1717,7 @@ struct anim *openanim(const char *name, int flags, int streamindex)
ibuf = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE);
if (ibuf == NULL) {
- if(BLI_exists(name))
+ if (BLI_exists(name))
printf("not an anim: %s\n", name);
else
printf("anim file doesn't exist: %s\n", name);
@@ -1744,16 +1756,16 @@ Image *BKE_image_verify_viewer(int type, const char *name)
{
Image *ima;
- for(ima=G.main->image.first; ima; ima= ima->id.next)
- if(ima->source==IMA_SRC_VIEWER)
- if(ima->type==type)
+ for (ima=G.main->image.first; ima; ima= ima->id.next)
+ if (ima->source==IMA_SRC_VIEWER)
+ if (ima->type==type)
break;
- if(ima==NULL)
+ if (ima==NULL)
ima= image_alloc(name, IMA_SRC_VIEWER, type);
/* happens on reload, imagewindow cannot be image user when hidden*/
- if(ima->id.us==0)
+ if (ima->id.us==0)
id_us_plus(&ima->id);
return ima;
@@ -1766,24 +1778,24 @@ void BKE_image_assign_ibuf(Image *ima, ImBuf *ibuf)
void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
{
- if(ima==NULL)
+ if (ima==NULL)
return;
switch(signal) {
case IMA_SIGNAL_FREE:
image_free_buffers(ima);
- if(iuser)
+ if (iuser)
iuser->ok= 1;
break;
case IMA_SIGNAL_SRC_CHANGE:
- if(ima->type == IMA_TYPE_UV_TEST)
- if(ima->source != IMA_SRC_GENERATED)
+ if (ima->type == IMA_TYPE_UV_TEST)
+ if (ima->source != IMA_SRC_GENERATED)
ima->type= IMA_TYPE_IMAGE;
- if(ima->source==IMA_SRC_GENERATED) {
- if(ima->gen_x==0 || ima->gen_y==0) {
+ if (ima->source==IMA_SRC_GENERATED) {
+ if (ima->gen_x==0 || ima->gen_y==0) {
ImBuf *ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
- if(ibuf) {
+ if (ibuf) {
ima->gen_x= ibuf->x;
ima->gen_y= ibuf->y;
}
@@ -1791,39 +1803,40 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
}
/* force reload on first use, but not for multilayer, that makes nodes and buttons in ui drawing fail */
- if(ima->type!=IMA_TYPE_MULTILAYER)
+ if (ima->type!=IMA_TYPE_MULTILAYER)
image_free_buffers(ima);
ima->ok= 1;
- if(iuser)
+ if (iuser)
iuser->ok= 1;
break;
case IMA_SIGNAL_RELOAD:
/* try to repack file */
- if(ima->packedfile) {
+ if (ima->packedfile) {
PackedFile *pf;
pf = newPackedFile(NULL, ima->name, ID_BLEND_PATH(G.main, &ima->id));
if (pf) {
freePackedFile(ima->packedfile);
ima->packedfile = pf;
image_free_buffers(ima);
- } else {
+ }
+ else {
printf("ERROR: Image not available. Keeping packed image\n");
}
}
else
image_free_buffers(ima);
- if(iuser)
+ if (iuser)
iuser->ok= 1;
break;
case IMA_SIGNAL_USER_NEW_IMAGE:
- if(iuser) {
+ if (iuser) {
iuser->ok= 1;
- if(ima->source==IMA_SRC_FILE || ima->source==IMA_SRC_SEQUENCE) {
- if(ima->type==IMA_TYPE_MULTILAYER) {
+ if (ima->source==IMA_SRC_FILE || ima->source==IMA_SRC_SEQUENCE) {
+ if (ima->type==IMA_TYPE_MULTILAYER) {
iuser->multi_index= 0;
iuser->layer= iuser->pass= 0;
}
@@ -1832,12 +1845,12 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
break;
}
- /* dont use notifiers because they are not 100% sure to succeeded
+ /* don't use notifiers because they are not 100% sure to succeeded
* this also makes sure all scenes are accounted for. */
{
Scene *scene;
- for(scene= G.main->scene.first; scene; scene= scene->id.next) {
- if(scene->nodetree) {
+ for (scene= G.main->scene.first; scene; scene= scene->id.next) {
+ if (scene->nodetree) {
nodeUpdateID(scene->nodetree, &ima->id);
}
}
@@ -1852,29 +1865,29 @@ RenderPass *BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
RenderLayer *rl;
RenderPass *rpass= NULL;
- if(rr==NULL)
+ if (rr==NULL)
return NULL;
- if(iuser) {
+ if (iuser) {
short index= 0, rl_index= 0, rp_index;
- for(rl= rr->layers.first; rl; rl= rl->next, rl_index++) {
+ for (rl= rr->layers.first; rl; rl= rl->next, rl_index++) {
rp_index= 0;
- for(rpass= rl->passes.first; rpass; rpass= rpass->next, index++, rp_index++)
- if(iuser->layer==rl_index && iuser->pass==rp_index)
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next, index++, rp_index++)
+ if (iuser->layer==rl_index && iuser->pass==rp_index)
break;
- if(rpass)
+ if (rpass)
break;
}
- if(rpass)
+ if (rpass)
iuser->multi_index= index;
else
iuser->multi_index= 0;
}
- if(rpass==NULL) {
+ if (rpass==NULL) {
rl= rr->layers.first;
- if(rl)
+ if (rl)
rpass= rl->passes.first;
}
@@ -1883,11 +1896,11 @@ RenderPass *BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
RenderResult *BKE_image_acquire_renderresult(Scene *scene, Image *ima)
{
- if(ima->rr) {
+ if (ima->rr) {
return ima->rr;
}
- else if(ima->type==IMA_TYPE_R_RESULT) {
- if(ima->render_slot == ima->last_render_slot)
+ else if (ima->type==IMA_TYPE_R_RESULT) {
+ if (ima->render_slot == ima->last_render_slot)
return RE_AcquireResultRead(RE_GetRender(scene->id.name));
else
return ima->renders[ima->render_slot];
@@ -1898,9 +1911,9 @@ RenderResult *BKE_image_acquire_renderresult(Scene *scene, Image *ima)
void BKE_image_release_renderresult(Scene *scene, Image *ima)
{
- if(ima->rr);
- else if(ima->type==IMA_TYPE_R_RESULT) {
- if(ima->render_slot == ima->last_render_slot)
+ if (ima->rr);
+ else if (ima->type==IMA_TYPE_R_RESULT) {
+ if (ima->render_slot == ima->last_render_slot)
RE_ReleaseResult(RE_GetRender(scene->id.name));
}
}
@@ -1912,8 +1925,8 @@ void BKE_image_backup_render(Scene *scene, Image *ima)
Render *re= RE_GetRender(scene->id.name);
int slot= ima->render_slot, last= ima->last_render_slot;
- if(slot != last) {
- if(ima->renders[slot]) {
+ if (slot != last) {
+ if (ima->renders[slot]) {
RE_FreeRenderResult(ima->renders[slot]);
ima->renders[slot]= NULL;
}
@@ -1937,7 +1950,7 @@ static void image_create_multilayer(Image *ima, ImBuf *ibuf, int framenr)
#endif
ibuf->userdata= NULL;
- if(ima->rr)
+ if (ima->rr)
ima->rr->framenr= framenr;
}
@@ -1945,12 +1958,12 @@ static void image_create_multilayer(Image *ima, ImBuf *ibuf, int framenr)
static void image_initialize_after_load(Image *ima, ImBuf *ibuf)
{
/* preview is NULL when it has never been used as an icon before */
- if(G.background==0 && ima->preview==NULL)
+ if (G.background==0 && ima->preview==NULL)
BKE_icon_changed(BKE_icon_getid(&ima->id));
/* fields */
if (ima->flag & IMA_FIELDS) {
- if(ima->flag & IMA_STD_FIELD) de_interlace_st(ibuf);
+ if (ima->flag & IMA_STD_FIELD) de_interlace_st(ibuf);
else de_interlace_ng(ibuf);
}
/* timer */
@@ -1968,7 +1981,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
int flag;
/* XXX temp stuff? */
- if(ima->lastframe != frame)
+ if (ima->lastframe != frame)
ima->tpageflag |= IMA_TPAGE_REFRESH;
ima->lastframe= frame;
@@ -1979,16 +1992,17 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
BLI_path_abs(name, ID_BLEND_PATH(G.main, &ima->id));
flag= IB_rect|IB_multilayer;
- if(ima->flag & IMA_DO_PREMUL)
+ if (ima->flag & IMA_DO_PREMUL)
flag |= IB_premul;
/* read ibuf */
ibuf = IMB_loadiffname(name, flag);
#if 0
- if(ibuf) {
+ if (ibuf) {
printf(AT" loaded %s\n", name);
- } else {
+ }
+ else {
printf(AT" missed %s\n", name);
}
#endif
@@ -2014,7 +2028,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
else
ima->ok= 0;
- if(iuser)
+ if (iuser)
iuser->ok= ima->ok;
return ibuf;
@@ -2027,32 +2041,32 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f
/* either we load from RenderResult, or we have to load a new one */
/* check for new RenderResult */
- if(ima->rr==NULL || frame!=ima->rr->framenr) {
+ if (ima->rr==NULL || frame!=ima->rr->framenr) {
/* copy to survive not found multilayer image */
RenderResult *oldrr= ima->rr;
ima->rr= NULL;
ibuf = image_load_sequence_file(ima, iuser, frame);
- if(ibuf) { /* actually an error */
+ if (ibuf) { /* actually an error */
ima->type= IMA_TYPE_IMAGE;
printf("error, multi is normal image\n");
}
// printf("loaded new result %p\n", ima->rr);
/* free result if new one found */
- if(ima->rr) {
- // if(oldrr) printf("freed previous result %p\n", oldrr);
- if(oldrr) RE_FreeRenderResult(oldrr);
+ if (ima->rr) {
+ // if (oldrr) printf("freed previous result %p\n", oldrr);
+ if (oldrr) RE_FreeRenderResult(oldrr);
}
else {
ima->rr= oldrr;
}
}
- if(ima->rr) {
+ if (ima->rr) {
RenderPass *rpass= BKE_image_multilayer_index(ima->rr, iuser);
- if(rpass) {
+ if (rpass) {
// printf("load from pass %s\n", rpass->name);
/* since we free render results, we copy the rect */
ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0);
@@ -2071,7 +2085,7 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f
else
ima->ok= 0;
- if(iuser)
+ if (iuser)
iuser->ok= ima->ok;
return ibuf;
@@ -2084,7 +2098,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
ima->lastframe= frame;
- if(ima->anim==NULL) {
+ if (ima->anim==NULL) {
char str[FILE_MAX];
BLI_strncpy(str, ima->name, FILE_MAX);
@@ -2094,24 +2108,24 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
ima->anim = openanim(str, IB_rect, 0);
/* let's initialize this user */
- if(ima->anim && iuser && iuser->frames==0)
+ if (ima->anim && iuser && iuser->frames==0)
iuser->frames= IMB_anim_get_duration(ima->anim,
IMB_TC_RECORD_RUN);
}
- if(ima->anim) {
+ if (ima->anim) {
int dur = IMB_anim_get_duration(ima->anim,
IMB_TC_RECORD_RUN);
int fra= frame-1;
- if(fra<0) fra = 0;
- if(fra>(dur-1)) fra= dur-1;
+ if (fra<0) fra = 0;
+ if (fra>(dur-1)) fra= dur-1;
ibuf = IMB_makeSingleUser(
IMB_anim_absolute(ima->anim, fra,
IMB_TC_RECORD_RUN,
IMB_PROXY_NONE));
- if(ibuf) {
+ if (ibuf) {
image_initialize_after_load(ima, ibuf);
image_assign_ibuf(ima, ibuf, 0, frame);
}
@@ -2121,7 +2135,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
else
ima->ok= 0;
- if(iuser)
+ if (iuser)
iuser->ok= ima->ok;
return ibuf;
@@ -2140,13 +2154,13 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
/* is there a PackedFile with this image ? */
if (ima->packedfile) {
flag = IB_rect|IB_multilayer;
- if(ima->flag & IMA_DO_PREMUL) flag |= IB_premul;
+ if (ima->flag & IMA_DO_PREMUL) flag |= IB_premul;
ibuf = IMB_ibImageFromMemory((unsigned char*)ima->packedfile->data, ima->packedfile->size, flag, "<packed data>");
}
else {
flag= IB_rect|IB_multilayer|IB_metadata;
- if(ima->flag & IMA_DO_PREMUL)
+ if (ima->flag & IMA_DO_PREMUL)
flag |= IB_premul;
/* get the right string */
@@ -2180,10 +2194,10 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
else
ima->ok= 0;
- if(assign)
+ if (assign)
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
- if(iuser)
+ if (iuser)
iuser->ok= ima->ok;
return ibuf;
@@ -2193,17 +2207,17 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
{
ImBuf *ibuf= NULL;
- if(ima->rr==NULL) {
+ if (ima->rr==NULL) {
ibuf = image_load_image_file(ima, iuser, 0);
- if(ibuf) { /* actually an error */
+ if (ibuf) { /* actually an error */
ima->type= IMA_TYPE_IMAGE;
return ibuf;
}
}
- if(ima->rr) {
+ if (ima->rr) {
RenderPass *rpass= BKE_image_multilayer_index(ima->rr, iuser);
- if(rpass) {
+ if (rpass) {
ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0);
image_initialize_after_load(ima, ibuf);
@@ -2217,9 +2231,9 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
}
}
- if(ibuf==NULL)
+ if (ibuf==NULL)
ima->ok= 0;
- if(iuser)
+ if (iuser)
iuser->ok= ima->ok;
return ibuf;
@@ -2240,11 +2254,11 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
ImBuf *ibuf;
int from_render= (ima->render_slot == ima->last_render_slot);
- if(!(iuser && iuser->scene))
+ if (!(iuser && iuser->scene))
return NULL;
/* if we the caller is not going to release the lock, don't give the image */
- if(!lock_r)
+ if (!lock_r)
return NULL;
re= RE_GetRender(iuser->scene->id.name);
@@ -2253,24 +2267,24 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
layer= (iuser)? iuser->layer: 0;
pass= (iuser)? iuser->pass: 0;
- if(from_render) {
+ if (from_render) {
RE_AcquireResultImage(re, &rres);
}
- else if(ima->renders[ima->render_slot]) {
+ else if (ima->renders[ima->render_slot]) {
rres= *(ima->renders[ima->render_slot]);
rres.have_combined= rres.rectf != NULL;
}
else
memset(&rres, 0, sizeof(RenderResult));
- if(!(rres.rectx > 0 && rres.recty > 0)) {
- if(from_render)
+ if (!(rres.rectx > 0 && rres.recty > 0)) {
+ if (from_render)
RE_ReleaseResultImage(re);
return NULL;
}
/* release is done in BKE_image_release_ibuf using lock_r */
- if(from_render) {
+ if (from_render) {
BLI_lock_thread(LOCK_VIEWER);
*lock_r= re;
}
@@ -2282,27 +2296,27 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
dither= iuser->scene->r.dither_intensity;
/* combined layer gets added as first layer */
- if(rres.have_combined && layer==0);
- else if(rres.layers.first) {
+ if (rres.have_combined && layer==0);
+ else if (rres.layers.first) {
RenderLayer *rl= BLI_findlink(&rres.layers, layer-(rres.have_combined?1:0));
- if(rl) {
+ if (rl) {
RenderPass *rpass;
/* there's no combined pass, is in renderlayer itself */
- if(pass==0) {
+ if (pass==0) {
rectf= rl->rectf;
}
else {
rpass= BLI_findlink(&rl->passes, pass-1);
- if(rpass) {
+ if (rpass) {
channels= rpass->channels;
rectf= rpass->rect;
dither= 0.0f; /* don't dither passes */
}
}
- for(rpass= rl->passes.first; rpass; rpass= rpass->next)
- if(rpass->passtype == SCE_PASS_Z)
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next)
+ if (rpass->passtype == SCE_PASS_Z)
rectz= rpass->rect;
}
}
@@ -2310,7 +2324,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
/* make ibuf if needed, and initialize it */
- if(ibuf==NULL) {
+ if (ibuf==NULL) {
ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
}
@@ -2321,13 +2335,13 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
/* free rect buffer if float buffer changes, so it can be recreated with
* the updated result, and also in case we got byte buffer from sequencer,
* so we don't keep reference to freed buffer */
- if(ibuf->rect_float!=rectf || rect || !rectf)
+ if (ibuf->rect_float!=rectf || rect || !rectf)
imb_freerectImBuf(ibuf);
- if(rect)
+ if (rect)
ibuf->rect= rect;
- if(rectf) {
+ if (rectf) {
ibuf->rect_float= rectf;
ibuf->flags |= IB_rectfloat;
ibuf->channels= channels;
@@ -2337,7 +2351,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
ibuf->flags &= ~IB_rectfloat;
}
- if(rectz) {
+ if (rectz) {
ibuf->zbuf_float= rectz;
ibuf->flags |= IB_zbuffloat;
}
@@ -2350,7 +2364,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
ibuf->profile= (iuser->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) ? IB_PROFILE_LINEAR_RGB : IB_PROFILE_NONE;
ibuf->dither= dither;
- if(iuser->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE) {
+ if (iuser->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE) {
ibuf->flags |= IB_cm_predivide;
ima->flag |= IMA_CM_PREDIVIDE;
}
@@ -2370,41 +2384,41 @@ static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame
int frame = 0, index = 0;
/* see if we already have an appropriate ibuf, with image source and type */
- if(ima->source==IMA_SRC_MOVIE) {
+ if (ima->source==IMA_SRC_MOVIE) {
frame= iuser?iuser->framenr:ima->lastframe;
ibuf= image_get_ibuf(ima, 0, frame);
/* XXX temp stuff? */
- if(ima->lastframe != frame)
+ if (ima->lastframe != frame)
ima->tpageflag |= IMA_TPAGE_REFRESH;
ima->lastframe = frame;
}
- else if(ima->source==IMA_SRC_SEQUENCE) {
- if(ima->type==IMA_TYPE_IMAGE) {
+ else if (ima->source==IMA_SRC_SEQUENCE) {
+ if (ima->type==IMA_TYPE_IMAGE) {
frame= iuser?iuser->framenr:ima->lastframe;
ibuf= image_get_ibuf(ima, 0, frame);
/* XXX temp stuff? */
- if(ima->lastframe != frame) {
+ if (ima->lastframe != frame) {
ima->tpageflag |= IMA_TPAGE_REFRESH;
}
ima->lastframe = frame;
}
- else if(ima->type==IMA_TYPE_MULTILAYER) {
+ else if (ima->type==IMA_TYPE_MULTILAYER) {
frame= iuser?iuser->framenr:ima->lastframe;
index= iuser?iuser->multi_index:IMA_NO_INDEX;
ibuf= image_get_ibuf(ima, index, frame);
}
}
- else if(ima->source==IMA_SRC_FILE) {
- if(ima->type==IMA_TYPE_IMAGE)
+ else if (ima->source==IMA_SRC_FILE) {
+ if (ima->type==IMA_TYPE_IMAGE)
ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
- else if(ima->type==IMA_TYPE_MULTILAYER)
+ else if (ima->type==IMA_TYPE_MULTILAYER)
ibuf= image_get_ibuf(ima, iuser?iuser->multi_index:IMA_NO_INDEX, 0);
}
- else if(ima->source == IMA_SRC_GENERATED) {
+ else if (ima->source == IMA_SRC_GENERATED) {
ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
}
- else if(ima->source == IMA_SRC_VIEWER) {
+ else if (ima->source == IMA_SRC_VIEWER) {
/* always verify entirely, not that this shouldn't happen
* as part of texture sampling in rendering anyway, so not
* a big bottleneck */
@@ -2436,87 +2450,87 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
* That means, the last two steps must be, 1) add the ibuf to the list and
* 2) set ima/iuser->ok to 0 to IMA_OK_LOADED */
- if(lock_r)
+ if (lock_r)
*lock_r= NULL;
/* quick reject tests */
- if(ima==NULL)
+ if (ima==NULL)
return NULL;
- if(iuser) {
- if(iuser->ok==0)
+ if (iuser) {
+ if (iuser->ok==0)
return NULL;
}
- else if(ima->ok==0)
+ else if (ima->ok==0)
return NULL;
/* try to get the ibuf without locking */
ibuf= image_get_ibuf_threadsafe(ima, iuser, &frame, &index);
- if(ibuf == NULL) {
+ if (ibuf == NULL) {
/* couldn't get ibuf and image is not ok, so let's lock and try to
* load the image */
BLI_lock_thread(LOCK_IMAGE);
/* need to check ok flag and loading ibuf again, because the situation
* might have changed in the meantime */
- if(iuser) {
- if(iuser->ok==0) {
+ if (iuser) {
+ if (iuser->ok==0) {
BLI_unlock_thread(LOCK_IMAGE);
return NULL;
}
}
- else if(ima->ok==0) {
+ else if (ima->ok==0) {
BLI_unlock_thread(LOCK_IMAGE);
return NULL;
}
ibuf= image_get_ibuf_threadsafe(ima, iuser, &frame, &index);
- if(ibuf == NULL) {
+ if (ibuf == NULL) {
/* we are sure we have to load the ibuf, using source and type */
- if(ima->source==IMA_SRC_MOVIE) {
+ if (ima->source==IMA_SRC_MOVIE) {
/* source is from single file, use flipbook to store ibuf */
ibuf= image_load_movie_file(ima, iuser, frame);
}
- else if(ima->source==IMA_SRC_SEQUENCE) {
- if(ima->type==IMA_TYPE_IMAGE) {
+ else if (ima->source==IMA_SRC_SEQUENCE) {
+ if (ima->type==IMA_TYPE_IMAGE) {
/* regular files, ibufs in flipbook, allows saving */
ibuf= image_load_sequence_file(ima, iuser, frame);
}
/* no else; on load the ima type can change */
- if(ima->type==IMA_TYPE_MULTILAYER) {
+ if (ima->type==IMA_TYPE_MULTILAYER) {
/* only 1 layer/pass stored in imbufs, no exrhandle anim storage, no saving */
ibuf= image_load_sequence_multilayer(ima, iuser, frame);
}
}
- else if(ima->source==IMA_SRC_FILE) {
+ else if (ima->source==IMA_SRC_FILE) {
- if(ima->type==IMA_TYPE_IMAGE)
+ if (ima->type==IMA_TYPE_IMAGE)
ibuf= image_load_image_file(ima, iuser, frame); /* cfra only for '#', this global is OK */
/* no else; on load the ima type can change */
- if(ima->type==IMA_TYPE_MULTILAYER)
+ if (ima->type==IMA_TYPE_MULTILAYER)
/* keeps render result, stores ibufs in listbase, allows saving */
ibuf= image_get_ibuf_multilayer(ima, iuser);
}
- else if(ima->source == IMA_SRC_GENERATED) {
+ else if (ima->source == IMA_SRC_GENERATED) {
/* generated is: ibuf is allocated dynamically */
/* UV testgrid or black or solid etc */
- if(ima->gen_x==0) ima->gen_x= 1024;
- if(ima->gen_y==0) ima->gen_y= 1024;
+ if (ima->gen_x==0) ima->gen_x= 1024;
+ if (ima->gen_y==0) ima->gen_y= 1024;
ibuf= add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 24, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type, color);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
ima->ok= IMA_OK_LOADED;
}
- else if(ima->source == IMA_SRC_VIEWER) {
- if(ima->type==IMA_TYPE_R_RESULT) {
+ else if (ima->source == IMA_SRC_VIEWER) {
+ if (ima->type==IMA_TYPE_R_RESULT) {
/* always verify entirely, and potentially
* returns pointer to release later */
ibuf= image_get_render_result(ima, iuser, lock_r);
}
- else if(ima->type==IMA_TYPE_COMPOSITE) {
+ else if (ima->type==IMA_TYPE_COMPOSITE) {
/* requires lock/unlock, otherwise don't return image */
- if(lock_r) {
+ if (lock_r) {
/* unlock in BKE_image_release_ibuf */
BLI_lock_thread(LOCK_VIEWER);
*lock_r= ima;
@@ -2525,7 +2539,7 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
frame= 0; // XXX iuser?iuser->framenr:0;
ibuf= image_get_ibuf(ima, 0, frame);
- if(!ibuf) {
+ if (!ibuf) {
/* Composite Viewer, all handled in compositor */
/* fake ibuf, will be filled in compositor */
ibuf= IMB_allocImBuf(256, 256, 32, IB_rect);
@@ -2547,10 +2561,10 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
void BKE_image_release_ibuf(Image *ima, void *lock)
{
/* for getting image during threaded render / compositing, need to release */
- if(lock == ima) {
+ if (lock == ima) {
BLI_unlock_thread(LOCK_VIEWER); /* viewer image */
}
- else if(lock) {
+ else if (lock) {
RE_ReleaseResultImage(lock); /* render result */
BLI_unlock_thread(LOCK_VIEWER); /* view image imbuf */
}
@@ -2567,7 +2581,7 @@ int BKE_image_user_get_frame(const ImageUser *iuser, int cfra, int fieldnr)
{
const int len= (iuser->fie_ima*iuser->frames)/2;
- if(len==0) {
+ if (len==0) {
return 0;
}
else {
@@ -2575,28 +2589,28 @@ int BKE_image_user_get_frame(const ImageUser *iuser, int cfra, int fieldnr)
cfra= cfra - iuser->sfra+1;
/* cyclic */
- if(iuser->cycl) {
+ if (iuser->cycl) {
cfra= ( (cfra) % len );
- if(cfra < 0) cfra+= len;
- if(cfra==0) cfra= len;
+ if (cfra < 0) cfra+= len;
+ if (cfra==0) cfra= len;
}
- if(cfra<0) cfra= 0;
- else if(cfra>len) cfra= len;
+ if (cfra<0) cfra= 0;
+ else if (cfra>len) cfra= len;
/* convert current frame to current field */
cfra= 2*(cfra);
- if(fieldnr) cfra++;
+ if (fieldnr) cfra++;
/* transform to images space */
framenr= (cfra+iuser->fie_ima-2)/iuser->fie_ima;
- if(framenr>iuser->frames) framenr= iuser->frames;
+ if (framenr>iuser->frames) framenr= iuser->frames;
framenr+= iuser->offset;
- if(iuser->cycl) {
+ if (iuser->cycl) {
framenr= ( (framenr) % len );
- while(framenr < 0) framenr+= len;
- if(framenr==0) framenr= len;
+ while (framenr < 0) framenr+= len;
+ if (framenr==0) framenr= len;
}
return framenr;
@@ -2608,12 +2622,12 @@ void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr)
const int framenr= BKE_image_user_get_frame(iuser, cfra, fieldnr);
/* allows image users to handle redraws */
- if(iuser->flag & IMA_ANIM_ALWAYS)
- if(framenr!=iuser->framenr)
+ if (iuser->flag & IMA_ANIM_ALWAYS)
+ if (framenr!=iuser->framenr)
iuser->flag |= IMA_ANIM_REFRESHED;
iuser->framenr= framenr;
- if(iuser->ok==0) iuser->ok= 1;
+ if (iuser->ok==0) iuser->ok= 1;
}
int BKE_image_has_alpha(struct Image *image)
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index d4185af2f98..675c0771140 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -38,22 +38,22 @@ void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width,
int x, y;
/* blank image */
- if(rect_float) {
- for(y= 0; y<height; y++) {
- for(x= 0; x<width; x++) {
+ if (rect_float) {
+ for (y= 0; y<height; y++) {
+ for (x= 0; x<width; x++) {
copy_v4_v4(rect_float, color);
rect_float+= 4;
}
}
}
- if(rect) {
+ if (rect) {
unsigned char ccol[4];
rgba_float_to_uchar(ccol, color);
- for(y= 0; y<height; y++) {
- for(x= 0; x<width; x++) {
+ for (y= 0; y<height; y++) {
+ for (x= 0; x<width; x++) {
rect[0]= ccol[0];
rect[1]= ccol[1];
@@ -81,17 +81,18 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
float h=0.0, hoffs=0.0, hue=0.0, s=0.9, v=0.9, r, g, b;
/* checkers */
- for(y= 0; y<height; y++) {
+ for (y= 0; y<height; y++) {
dark= powf(-1.0f, floorf(y / checkerwidth));
- for(x= 0; x<width; x++) {
+ for (x= 0; x<width; x++) {
if (x % checkerwidth == 0) dark= -dark;
if (rect_float) {
if (dark > 0) {
rect_float[0]= rect_float[1]= rect_float[2]= 0.25f;
rect_float[3]= 1.0f;
- } else {
+ }
+ else {
rect_float[0]= rect_float[1]= rect_float[2]= 0.58f;
rect_float[3]= 1.0f;
}
@@ -101,7 +102,8 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
if (dark > 0) {
rect[0]= rect[1]= rect[2]= 64;
rect[3]= 255;
- } else {
+ }
+ else {
rect[0]= rect[1]= rect[2]= 150;
rect[3]= 255;
}
@@ -114,10 +116,10 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
rect_float= rect_float_orig;
/* 2nd pass, colored + */
- for(y= 0; y<height; y++) {
+ for (y= 0; y<height; y++) {
hoffs= 0.125f * floorf(y / checkerwidth);
- for(x= 0; x<width; x++) {
+ for (x= 0; x<width; x++) {
h= 0.125f * floorf(x / checkerwidth);
if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 4) &&
@@ -165,13 +167,13 @@ static void checker_board_color_fill(unsigned char *rect, float *rect_float, int
sat= 1.0;
hue_step= power_of_2_max_i(width / 8);
- if(hue_step < 8) hue_step= 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);
@@ -248,8 +250,8 @@ static void checker_board_color_tint(unsigned char *rect, float *rect_float, int
static void checker_board_grid_fill(unsigned char *rect, float *rect_float, int width, int height, float blend)
{
int x, y;
- for(y= 0; y < height; y++) {
- for(x= 0; x < width; x++) {
+ for (y= 0; y < height; y++) {
+ for (x= 0; x < width; x++) {
if (((y % 32) == 0) || ((x % 32) == 0) || x == 0) {
if (rect) {
rect[0]= BLEND_CHAR(rect[0], blend);
@@ -269,8 +271,8 @@ static void checker_board_grid_fill(unsigned char *rect, float *rect_float, int
}
}
else {
- if(rect_float) rect_float += 4;
- if(rect) rect += 4;
+ if (rect_float) rect_float += 4;
+ if (rect) rect += 4;
}
}
}
@@ -289,11 +291,11 @@ 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;
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index a271513afc0..32bdac9d35e 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -57,7 +57,7 @@ static LARGE_INTEGER ifreq;
static void itstart(void)
{
static int first = 1;
- if(first) {
+ if (first) {
QueryPerformanceFrequency(&ifreq);
first = 0;
}
@@ -178,7 +178,7 @@ static void print_fvector(float m3[3])
DO_INLINE void print_lfvector(float (*fLongVector)[3], unsigned int verts)
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
print_fvector(fLongVector[i]);
}
@@ -208,7 +208,7 @@ DO_INLINE void cp_lfvector(float (*to)[3], float (*from)[3], unsigned int verts)
DO_INLINE void init_lfvector(float (*fLongVector)[3], float vector[3], unsigned int verts)
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
copy_v3_v3(fLongVector[i], vector);
}
@@ -223,7 +223,7 @@ DO_INLINE void mul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scal
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
mul_fvector_S(to[i], fLongVector[i], scalar);
}
@@ -233,7 +233,7 @@ DO_INLINE void mul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scal
DO_INLINE void submul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scalar, unsigned int verts)
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
VECSUBMUL(to[i], fLongVector[i], scalar);
}
@@ -247,8 +247,8 @@ DO_INLINE float dot_lfvector(float (*fLongVectorA)[3], float (*fLongVectorB)[3],
// due to non-commutative nature of floating point ops this makes the sim give
// different results each time you run it!
// schedule(guided, 2)
-//#pragma omp parallel for reduction(+: temp) if(verts > CLOTH_OPENMP_LIMIT)
- for(i = 0; i < (long)verts; i++) {
+//#pragma omp parallel for reduction(+: temp) if (verts > CLOTH_OPENMP_LIMIT)
+ for (i = 0; i < (long)verts; i++) {
temp += dot_v3v3(fLongVectorA[i], fLongVectorB[i]);
}
return temp;
@@ -258,7 +258,7 @@ DO_INLINE void add_lfvector_lfvector(float (*to)[3], float (*fLongVectorA)[3], f
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
VECADD(to[i], fLongVectorA[i], fLongVectorB[i]);
}
@@ -269,7 +269,7 @@ DO_INLINE void add_lfvector_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
VECADDS(to[i], fLongVectorA[i], fLongVectorB[i], bS);
@@ -280,7 +280,7 @@ DO_INLINE void add_lfvectorS_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
VECADDSS(to[i], fLongVectorA[i], aS, fLongVectorB[i], bS);
}
@@ -289,7 +289,7 @@ DO_INLINE void add_lfvectorS_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
DO_INLINE void sub_lfvector_lfvectorS(float (*to)[3], float (*fLongVectorA)[3], float (*fLongVectorB)[3], float bS, unsigned int verts)
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
VECSUBS(to[i], fLongVectorA[i], fLongVectorB[i], bS);
}
@@ -300,7 +300,7 @@ DO_INLINE void sub_lfvector_lfvector(float (*to)[3], float (*fLongVectorA)[3], f
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
sub_v3_v3v3(to[i], fLongVectorA[i], fLongVectorB[i]);
}
@@ -350,14 +350,14 @@ 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 (i=0;i<3;i++)
{
- for(j=0;j<3;j++)
+ for (j=0;j<3;j++)
{
int i1=(i+1)%3;
int i2=(i+2)%3;
@@ -366,7 +366,7 @@ DO_INLINE void inverse_fmatrix(float to[3][3], float from[3][3])
// reverse indexs i&j to take transpose
to[j][i] = (from[i1][j1]*from[i2][j2]-from[i1][j2]*from[i2][j1])/d;
/*
- if(i==j)
+ if (i==j)
to[i][j] = 1.0f / from[i][j];
else
to[i][j] = 0;
@@ -516,7 +516,7 @@ static void print_bfmatrix(fmatrix3x3 *m3)
{
unsigned int i = 0;
- for(i = 0; i < m3[0].vcount + m3[0].scount; i++)
+ for (i = 0; i < m3[0].vcount + m3[0].scount; i++)
{
print_fmatrix(m3[i].m);
}
@@ -554,7 +554,7 @@ DO_INLINE void init_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
{
unsigned int i;
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
cp_fmatrix(matrix[i].m, m3);
}
@@ -567,11 +567,11 @@ 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);
}
@@ -581,7 +581,7 @@ DO_INLINE void initdiag_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
DO_INLINE void mul_bfmatrix_S(fmatrix3x3 *matrix, float scalar)
{
unsigned int i = 0;
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
mul_fmatrix_S(matrix[i].m, scalar);
}
@@ -597,18 +597,18 @@ DO_INLINE void mul_bfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVector
zero_lfvector(to, vcount);
-#pragma omp parallel sections private(i) if(vcount > CLOTH_OPENMP_LIMIT)
+#pragma omp parallel sections private(i) if (vcount > CLOTH_OPENMP_LIMIT)
{
#pragma omp section
{
- for(i = from[0].vcount; i < from[0].vcount+from[0].scount; i++)
+ for (i = from[0].vcount; i < from[0].vcount+from[0].scount; i++)
{
muladd_fmatrix_fvector(to[from[i].c], from[i].m, fLongVector[from[i].r]);
}
}
#pragma omp section
{
- for(i = 0; i < from[0].vcount+from[0].scount; i++)
+ for (i = 0; i < from[0].vcount+from[0].scount; i++)
{
muladd_fmatrix_fvector(temp[from[i].r], from[i].m, fLongVector[from[i].c]);
}
@@ -627,7 +627,7 @@ DO_INLINE void mul_prevfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVec
{
unsigned int i = 0;
- for(i = 0; i < from[0].vcount; i++)
+ for (i = 0; i < from[0].vcount; i++)
{
mul_fmatrix_fvector(to[from[i].r], from[i].m, fLongVector[from[i].c]);
}
@@ -639,7 +639,7 @@ DO_INLINE void add_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
add_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -651,7 +651,7 @@ DO_INLINE void addadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
addadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -663,7 +663,7 @@ DO_INLINE void subadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
subadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -675,7 +675,7 @@ DO_INLINE void sub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
sub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -687,7 +687,7 @@ DO_INLINE void sub_bfmatrix_Smatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix3
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount; i++)
+ for (i = 0; i < matrix[0].vcount; i++)
{
sub_fmatrix_fmatrix(to[matrix[i].c].m, from[matrix[i].c].m, matrix[i].m);
}
@@ -699,7 +699,7 @@ DO_INLINE void addsub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
addsub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -713,7 +713,7 @@ DO_INLINE void subadd_bfmatrixS_bfmatrixS( fmatrix3x3 *to, fmatrix3x3 *from, flo
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
subadd_fmatrixS_fmatrixS(to[i].m, from[i].m, aS, matrix[i].m, bS);
}
@@ -739,7 +739,7 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
Implicit_Data *id = NULL;
LinkNode *search = NULL;
- if(G.rt > 0)
+ if (G.rt > 0)
printf("implicit_init\n");
// init memory guard
@@ -772,11 +772,11 @@ 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;
@@ -791,7 +791,7 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
// init springs
search = cloth->springs;
- for(i=0;i<cloth->numsprings;i++)
+ for (i=0;i<cloth->numsprings;i++)
{
spring = search->link;
@@ -810,7 +810,7 @@ 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);
}
@@ -823,11 +823,11 @@ 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);
@@ -874,7 +874,7 @@ DO_INLINE float fbstar(float length, float L, float kb, float cb)
float fbstar = cb * (length - L);
- if(tempfb < fbstar)
+ if (tempfb < fbstar)
return fbstar;
else
return tempfb;
@@ -886,7 +886,7 @@ 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;
}
@@ -900,7 +900,7 @@ DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
{
unsigned int i=0;
- for(i=0;i<S[0].vcount;i++)
+ for (i=0;i<S[0].vcount;i++)
{
mul_fvector_fmatrix(V[S[i].r], V[S[i].r], S[i].m);
}
@@ -936,7 +936,7 @@ 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);
@@ -978,8 +978,8 @@ DO_INLINE void BuildPPinv(fmatrix3x3 *lA, fmatrix3x3 *P, fmatrix3x3 *Pinv)
unsigned int i = 0;
// 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++)
+// #pragma omp parallel for private(i) if (lA[0].vcount > CLOTH_OPENMP_LIMIT)
+ for (i = 0; i<lA[0].vcount; i++)
{
// block diagonalizer
cp_fmatrix(P[i].m, lA[i].m);
@@ -1255,12 +1255,12 @@ 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)
+ if (length>L)
{
- if((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)
+ if ((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)
&& ((((length-L)*100.0f/L) > clmd->sim_parms->maxspringlen))) // cut spring!
{
s->flags |= CSPRING_FLAG_DEACTIVATE;
@@ -1276,9 +1276,9 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
}
// calculate force of structural + shear springs
- if((s->type & CLOTH_SPRING_TYPE_STRUCTURAL) || (s->type & CLOTH_SPRING_TYPE_SHEAR))
+ if ((s->type & CLOTH_SPRING_TYPE_STRUCTURAL) || (s->type & CLOTH_SPRING_TYPE_SHEAR))
{
- if(length > L || no_compress)
+ if (length > L || no_compress)
{
s->flags |= CLOTH_SPRING_FLAG_NEEDED;
@@ -1339,7 +1339,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
}
else // calculate force of bending springs
{
- if(length < L)
+ if (length < L)
{
s->flags |= CLOTH_SPRING_FLAG_NEEDED;
@@ -1358,9 +1358,9 @@ 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->flags & CLOTH_SPRING_FLAG_NEEDED)
{
- if(!(s->type & CLOTH_SPRING_TYPE_BENDING))
+ 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);
@@ -1369,7 +1369,7 @@ DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSp
VECADD(lF[s->ij], lF[s->ij], s->f);
- if(!(s->type & CLOTH_SPRING_TYPE_GOAL))
+ if (!(s->type & CLOTH_SPRING_TYPE_GOAL))
sub_v3_v3v3(lF[s->kl], lF[s->kl], s->f);
sub_fmatrix_fmatrix(dFdX[s->kl].m, dFdX[s->kl].m, s->dfdx);
@@ -1451,13 +1451,13 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
INIT_MINMAX(gmin, gmax);
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
DO_MINMAX(lX[i], gmin, gmax);
/* initialize grid */
- for(i = 0; i < 10; i++) {
- for(j = 0; j < 10; j++) {
- for(k = 0; k < 10; k++) {
+ for (i = 0; i < 10; i++) {
+ for (j = 0; j < 10; j++) {
+ for (k = 0; k < 10; k++) {
grid[i][j][k].velocity[0] = 0.0f;
grid[i][j][k].velocity[1] = 0.0f;
grid[i][j][k].velocity[2] = 0.0f;
@@ -1472,7 +1472,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
}
/* gather velocities & density */
- if(smoothfac > 0.0f) for(v = 0; v < numverts; v++) {
+ if (smoothfac > 0.0f) for (v = 0; v < numverts; v++) {
i = HAIR_GRID_INDEX(lX[v], gmin, gmax, 0);
j = HAIR_GRID_INDEX(lX[v], gmin, gmax, 1);
k = HAIR_GRID_INDEX(lX[v], gmin, gmax, 2);
@@ -1486,22 +1486,22 @@ 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];
- for(v=0; v<col->collmd->numverts; v++, loc0++, loc1++) {
+ for (v=0; v<col->collmd->numverts; v++, loc0++, loc1++) {
i = HAIR_GRID_INDEX(loc1->co, gmin, gmax, 0);
- if(i>=0 && i<10) {
+ if (i>=0 && i<10) {
j = HAIR_GRID_INDEX(loc1->co, gmin, gmax, 1);
- if(j>=0 && j<10) {
+ if (j>=0 && j<10) {
k = HAIR_GRID_INDEX(loc1->co, gmin, gmax, 2);
- if(k>=0 && k<10) {
+ if (k>=0 && k<10) {
sub_v3_v3v3(vel, loc1->co, loc0->co);
colg[i][j][k].velocity[0] += vel[0];
@@ -1516,18 +1516,18 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
/* divide velocity with density */
- for(i = 0; i < 10; i++) {
- for(j = 0; j < 10; j++) {
- for(k = 0; k < 10; k++) {
+ for (i = 0; i < 10; i++) {
+ for (j = 0; j < 10; j++) {
+ for (k = 0; k < 10; k++) {
density = grid[i][j][k].density;
- if(density > 0.0f) {
+ if (density > 0.0f) {
grid[i][j][k].velocity[0] /= density;
grid[i][j][k].velocity[1] /= density;
grid[i][j][k].velocity[2] /= density;
}
density = colg[i][j][k].density;
- if(density > 0.0f) {
+ if (density > 0.0f) {
colg[i][j][k].velocity[0] /= density;
colg[i][j][k].velocity[1] /= density;
colg[i][j][k].velocity[2] /= density;
@@ -1537,7 +1537,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
}
/* calculate forces */
- for(v = 0; v < numverts; v++) {
+ for (v = 0; v < numverts; v++) {
i = HAIR_GRID_INDEX(lX[v], gmin, gmax, 0);
j = HAIR_GRID_INDEX(lX[v], gmin, gmax, 1);
k = HAIR_GRID_INDEX(lX[v], gmin, gmax, 2);
@@ -1548,7 +1548,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
lF[v][1] += smoothfac * (grid[i][j][k].velocity[1] - lV[v][1]);
lF[v][2] += smoothfac * (grid[i][j][k].velocity[2] - lV[v][2]);
- if(colg[i][j][k].density > 0.0f) {
+ if (colg[i][j][k].density > 0.0f) {
lF[v][0] += collfac * (colg[i][j][k].velocity[0] - lV[v][0]);
lF[v][1] += collfac * (colg[i][j][k].velocity[1] - lV[v][1]);
lF[v][2] += collfac * (colg[i][j][k].velocity[2] - lV[v][2]);
@@ -1575,7 +1575,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
tm2[0][0]= tm2[1][1]= tm2[2][2]= -spring_air;
/* global acceleration (gravitation) */
- if(clmd->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
+ if (clmd->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
copy_v3_v3(gravity, clmd->scene->physics_settings.gravity);
mul_fvector_S(gravity, gravity, 0.001f * clmd->sim_parms->effector_weights->global_gravity); /* scale gravity force */
}
@@ -1587,13 +1587,13 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
init_lfvector(lF, gravity, numverts);
- if(clmd->sim_parms->velocity_smooth > 0.0f || clmd->sim_parms->collider_friction > 0.0f)
+ if (clmd->sim_parms->velocity_smooth > 0.0f || clmd->sim_parms->collider_friction > 0.0f)
hair_velocity_smoothing(clmd, lF, lX, lV, numverts);
/* 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]);
@@ -1603,22 +1603,22 @@ 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);
- if(!winvec)
+ if (!winvec)
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
@@ -1627,7 +1627,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
factor *= 0.02;
// calculate face normal
- if(mfaces[i].v4)
+ if (mfaces[i].v4)
CalcFloat4(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],lX[mfaces[i].v4],triunnormal);
else
CalcFloat(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],triunnormal);
@@ -1650,7 +1650,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], tmp, factor);
// add wind from v4
- if(mfaces[i].v4)
+ if (mfaces[i].v4)
{
copy_v3_v3(tmp, trinormal);
mul_v3_fl(tmp, calculateVertexWindForce(winvec[mfaces[i].v4], triunnormal));
@@ -1659,7 +1659,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
}
/* Hair has only edges */
- if(cloth->numfaces == 0) {
+ if (cloth->numfaces == 0) {
ClothSpring *spring;
float edgevec[3]={0,0,0}; //edge vector
float edgeunnormal[3]={0,0,0}; // not-normalized-edge normal
@@ -1667,10 +1667,10 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
float factor = 0.01;
search = cloth->springs;
- while(search) {
+ while (search) {
spring = search->link;
- if(spring->type == CLOTH_SPRING_TYPE_STRUCTURAL) {
+ if (spring->type == CLOTH_SPRING_TYPE_STRUCTURAL) {
sub_v3_v3v3(edgevec, (float*)lX[spring->ij], (float*)lX[spring->kl]);
project_v3_v3v3(tmp, winvec[spring->ij], edgevec);
@@ -1692,10 +1692,10 @@ 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)) {}
+ // 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);
search = search->next;
@@ -1703,10 +1703,10 @@ 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))
+ // 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);
search = search->next;
}
@@ -1765,7 +1765,8 @@ int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float
if (cv->goal == 1.0f || len_v3v3(initial_cos[i], cv->tx) != 0.0) {
masses[i] = 1e+10;
- } else {
+ }
+ else {
masses[i] = cv->mass;
}
}
@@ -1835,12 +1836,12 @@ 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 */
+ if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) /* do goal stuff */
{
- for(i = 0; i < numverts; i++)
+ 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);
@@ -1848,7 +1849,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
}
}
- while(step < tf)
+ while (step < tf)
{
// damping velocity for artistic reasons
mul_lfvectorS(id->V, id->V, clmd->sim_parms->vel_damping, numverts);
@@ -1863,11 +1864,11 @@ 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++)
+ for (i = 0; i < numverts; i++)
{
- if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL)
+ if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL)
{
- if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
+ if (verts [i].flags & CLOTH_VERT_FLAG_PINNED)
{
float tvect[3] = {.0,.0,.0};
sub_v3_v3v3(tvect, verts[i].xconst, verts[i].xold);
@@ -1880,13 +1881,13 @@ 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]);
@@ -1903,7 +1904,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
do_extra_solve = cloth_bvh_objcollision(ob, clmd, step/clmd->sim_parms->timescale, dt/clmd->sim_parms->timescale);
// copy corrected positions back to simulation
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
{
// correct velocity again, just to be sure we had to change it due to adaptive collisions
sub_v3_v3v3(verts[i].tv, verts[i].tx, id->X[i]);
@@ -1912,13 +1913,13 @@ 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))
+ if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
continue;
copy_v3_v3(id->Xnew[i], verts[i].tx);
@@ -1932,7 +1933,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
// if there were collisions, advance the velocity from v_n+1/2 to v_n+1
- if(do_extra_solve)
+ if (do_extra_solve)
{
// V = Vnew;
cp_lfvector(id->V, id->Vnew, numverts);
@@ -1958,9 +1959,9 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
step += dt;
}
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
{
- if((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
+ 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);
@@ -1986,12 +1987,12 @@ 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);
}
- if(G.rt > 0)
+ if (G.rt > 0)
printf("implicit_set_positions\n");
}
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 84939925b00..57a2dc41f74 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -1119,7 +1119,7 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c
}
/* add F-Curve to group */
- /* WARNING: this func should only need to look at the stuff we initialised, if not, things may crash */
+ /* WARNING: this func should only need to look at the stuff we initialized, if not, things may crash */
action_groups_add_channel(&tmp_act, agrp, fcu);
if (agrp->flag & AGRP_MUTED) /* flush down */
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 6c05ecb33ff..097e7a4eb5e 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -83,9 +83,9 @@ void free_key(Key *key)
BKE_free_animdata((ID *)key);
- while( (kb= key->block.first) ) {
+ while ( (kb= key->block.first) ) {
- if(kb->data) MEM_freeN(kb->data);
+ if (kb->data) MEM_freeN(kb->data);
BLI_remlink(&key->block, kb);
MEM_freeN(kb);
@@ -97,9 +97,9 @@ void free_key_nolib(Key *key)
{
KeyBlock *kb;
- while( (kb= key->block.first) ) {
+ while ( (kb= key->block.first) ) {
- if(kb->data) MEM_freeN(kb->data);
+ if (kb->data) MEM_freeN(kb->data);
BLI_remlink(&key->block, kb);
MEM_freeN(kb);
@@ -133,7 +133,7 @@ Key *add_key(ID *id) /* common function */
key->uidgen = 1;
// XXX the code here uses some defines which will soon be depreceated...
- if( GS(id->name)==ID_ME) {
+ if ( GS(id->name)==ID_ME) {
el= key->elemstr;
el[0]= 3;
@@ -142,7 +142,7 @@ Key *add_key(ID *id) /* common function */
key->elemsize= 12;
}
- else if( GS(id->name)==ID_LT) {
+ else if ( GS(id->name)==ID_LT) {
el= key->elemstr;
el[0]= 3;
@@ -151,7 +151,7 @@ Key *add_key(ID *id) /* common function */
key->elemsize= 12;
}
- else if( GS(id->name)==ID_CU) {
+ else if ( GS(id->name)==ID_CU) {
el= key->elemstr;
el[0]= 4;
@@ -169,7 +169,7 @@ Key *copy_key(Key *key)
Key *keyn;
KeyBlock *kbn, *kb;
- if(key==NULL) return NULL;
+ if (key==NULL) return NULL;
keyn= copy_libblock(&key->id);
@@ -177,10 +177,10 @@ Key *copy_key(Key *key)
kb= key->block.first;
kbn= keyn->block.first;
- while(kbn) {
+ while (kbn) {
- if(kbn->data) kbn->data= MEM_dupallocN(kbn->data);
- if(kb==key->refkey) keyn->refkey= kbn;
+ if (kbn->data) kbn->data= MEM_dupallocN(kbn->data);
+ if (kb==key->refkey) keyn->refkey= kbn;
kbn= kbn->next;
kb= kb->next;
@@ -195,7 +195,7 @@ Key *copy_key_nolib(Key *key)
Key *keyn;
KeyBlock *kbn, *kb;
- if(key==0) return 0;
+ if (key==0) return 0;
keyn= MEM_dupallocN(key);
@@ -205,10 +205,10 @@ Key *copy_key_nolib(Key *key)
kb= key->block.first;
kbn= keyn->block.first;
- while(kbn) {
+ while (kbn) {
- if(kbn->data) kbn->data= MEM_dupallocN(kbn->data);
- if(kb==key->refkey) keyn->refkey= kbn;
+ if (kbn->data) kbn->data= MEM_dupallocN(kbn->data);
+ if (kb==key->refkey) keyn->refkey= kbn;
kbn= kbn->next;
kb= kb->next;
@@ -224,7 +224,7 @@ void make_local_key(Key *key)
* - only local users: set flag
* - mixed: make copy
*/
- if(key==NULL) return;
+ if (key==NULL) return;
key->id.lib= NULL;
new_id(NULL, &key->id, NULL);
@@ -262,15 +262,15 @@ void sort_keys(Key *key)
/* if more than one Ipo curve, see if this key had a curve */
#if 0 // XXX old animation system
- if(key->ipo && key->ipo->curve.first != key->ipo->curve.last ) {
- for(icu= key->ipo->curve.first; icu; icu= icu->next) {
+ if (key->ipo && key->ipo->curve.first != key->ipo->curve.last ) {
+ for (icu= key->ipo->curve.first; icu; icu= icu->next) {
/* if we find the curve, remove it and reinsert in the
* right place */
- if(icu->adrcode==kb->adrcode) {
+ if (icu->adrcode==kb->adrcode) {
IpoCurve *icu2;
BLI_remlink(&key->ipo->curve, icu);
- for(icu2= key->ipo->curve.first; icu2; icu2= icu2->next) {
- if(icu2->adrcode >= kb2->adrcode) {
+ for (icu2= key->ipo->curve.first; icu2; icu2= icu2->next) {
+ if (icu2->adrcode >= kb2->adrcode) {
BLI_insertlink(&key->ipo->curve, icu2->prev, icu);
break;
}
@@ -287,7 +287,7 @@ void sort_keys(Key *key)
adrcode = kb2->adrcode;
for (i = kb->adrcode - adrcode; i >= 0; i--, adrcode++) {
/* if the next ipo curve matches the current key, renumber it */
- if(icu && icu->adrcode == kb->adrcode ) {
+ if (icu && icu->adrcode == kb->adrcode ) {
icu->adrcode = adrcode;
icu = icu->next;
}
@@ -308,13 +308,13 @@ void key_curve_position_weights(float t, float *data, int type)
{
float t2, t3, fc;
- if(type==KEY_LINEAR) {
+ if (type==KEY_LINEAR) {
data[0]= 0.0f;
data[1]= -t + 1.0f;
data[2]= t;
data[3]= 0.0f;
}
- else if(type==KEY_CARDINAL) {
+ else if (type==KEY_CARDINAL) {
t2= t*t;
t3= t2*t;
fc= 0.71f;
@@ -324,7 +324,7 @@ void key_curve_position_weights(float t, float *data, int type)
data[2]= (fc-2.0f)*t3 + (3.0f-2.0f*fc)*t2 + fc*t;
data[3]= fc*t3 - fc*t2;
}
- else if(type==KEY_BSPLINE) {
+ else if (type==KEY_BSPLINE) {
t2= t*t;
t3= t2*t;
@@ -340,13 +340,13 @@ void key_curve_tangent_weights(float t, float *data, int type)
{
float t2, fc;
- if(type==KEY_LINEAR) {
+ if (type==KEY_LINEAR) {
data[0]= 0.0f;
data[1]= -1.0f;
data[2]= 1.0f;
data[3]= 0.0f;
}
- else if(type==KEY_CARDINAL) {
+ else if (type==KEY_CARDINAL) {
t2= t*t;
fc= 0.71f;
@@ -355,7 +355,7 @@ void key_curve_tangent_weights(float t, float *data, int type)
data[2]= 3.0f*(fc-2.0f)*t2 +2.0f*(3.0f-2.0f*fc)*t + fc;
data[3]= 3.0f*fc*t2 -2.0f*fc*t;
}
- else if(type==KEY_BSPLINE) {
+ else if (type==KEY_BSPLINE) {
t2= t*t;
data[0]= -0.5f*t2 + t - 0.5f;
@@ -370,13 +370,13 @@ void key_curve_normal_weights(float t, float *data, int type)
{
float fc;
- if(type==KEY_LINEAR) {
+ if (type==KEY_LINEAR) {
data[0]= 0.0f;
data[1]= 0.0f;
data[2]= 0.0f;
data[3]= 0.0f;
}
- else if(type==KEY_CARDINAL) {
+ else if (type==KEY_CARDINAL) {
fc= 0.71f;
data[0]= -6.0f*fc*t + 4.0f*fc;
@@ -384,7 +384,7 @@ void key_curve_normal_weights(float t, float *data, int type)
data[2]= 6.0f*(fc-2.0f)*t + 2.0f*(3.0f-2.0f*fc);
data[3]= 6.0f*fc*t - 2.0f*fc;
}
- else if(type==KEY_BSPLINE) {
+ else if (type==KEY_BSPLINE) {
data[0]= -1.0f*t + 1.0f;
data[1]= 3.0f*t - 2.0f;
data[2]= -3.0f*t + 1.0f;
@@ -404,22 +404,22 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
lastpos= k1->pos;
dpos= lastpos - firstkey->pos;
- if(fac < firstkey->pos) fac= firstkey->pos;
- else if(fac > k1->pos) fac= k1->pos;
+ if (fac < firstkey->pos) fac= firstkey->pos;
+ else if (fac > k1->pos) fac= k1->pos;
k1=k[0]=k[1]=k[2]=k[3]= firstkey;
t[0]=t[1]=t[2]=t[3]= k1->pos;
- /* if(fac<0.0 || fac>1.0) return 1; */
+ /* if (fac<0.0 || fac>1.0) return 1; */
- if(k1->next==NULL) return 1;
+ if (k1->next==NULL) return 1;
- if(cycl) { /* pre-sort */
+ if (cycl) { /* pre-sort */
k[2]= k1->next;
k[3]= k[2]->next;
- if(k[3]==NULL) k[3]=k1;
- while(k1) {
- if(k1->next==NULL) k[0]=k1;
+ if (k[3]==NULL) k[3]=k1;
+ while (k1) {
+ if (k1->next==NULL) k[0]=k1;
k1=k1->next;
}
/* k1= k[1]; */ /* UNUSED */
@@ -429,29 +429,29 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
t[3]= k[3]->pos + dpos;
fac+= dpos;
ofs= dpos;
- if(k[3]==k[1]) {
+ if (k[3]==k[1]) {
t[3]+= dpos;
ofs= 2.0f*dpos;
}
- if(fac<t[1]) fac+= dpos;
+ if (fac<t[1]) fac+= dpos;
k1= k[3];
}
else { /* pre-sort */
k[2]= k1->next;
t[2]= k[2]->pos;
k[3]= k[2]->next;
- if(k[3]==NULL) k[3]= k[2];
+ if (k[3]==NULL) k[3]= k[2];
t[3]= k[3]->pos;
k1= k[3];
}
- while( t[2]<fac ) { /* find correct location */
- if(k1->next==NULL) {
- if(cycl) {
+ while ( t[2]<fac ) { /* find correct location */
+ if (k1->next==NULL) {
+ if (cycl) {
k1= firstkey;
ofs+= dpos;
}
- else if(t[2]==t[3]) break;
+ else if (t[2]==t[3]) break;
}
else k1= k1->next;
@@ -464,25 +464,25 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
t[3]= k1->pos+ofs;
k[3]= k1;
- if(ofs > 2.1f + lastpos) break;
+ if (ofs > 2.1f + lastpos) break;
}
bsplinetype= 0;
- if(k[1]->type==KEY_BSPLINE || k[2]->type==KEY_BSPLINE) bsplinetype= 1;
+ if (k[1]->type==KEY_BSPLINE || k[2]->type==KEY_BSPLINE) bsplinetype= 1;
- if(cycl==0) {
- if(bsplinetype==0) { /* B spline doesn't go through the control points */
- if(fac<=t[1]) { /* fac for 1st key */
+ if (cycl==0) {
+ if (bsplinetype==0) { /* B spline doesn't go through the control points */
+ if (fac<=t[1]) { /* fac for 1st key */
t[2]= t[1];
k[2]= k[1];
return 1;
}
- if(fac>=t[2] ) { /* fac after 2nd key */
+ if (fac>=t[2] ) { /* fac after 2nd key */
return 1;
}
}
- else if(fac>t[2]) { /* last key */
+ else if (fac>t[2]) { /* last key */
fac= t[2];
k[3]= k[2];
t[3]= t[2];
@@ -490,8 +490,8 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
}
d= t[2]-t[1];
- if(d == 0.0f) {
- if(bsplinetype==0) {
+ if (d == 0.0f) {
+ if (bsplinetype==0) {
return 1; /* both keys equal */
}
}
@@ -501,7 +501,7 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
key_curve_position_weights(d, t, k[1]->type);
- if(k[1]->type != k[2]->type) {
+ if (k[1]->type != k[2]->type) {
key_curve_position_weights(d, fval, k[2]->type);
temp= 1.0f-d;
@@ -519,7 +519,7 @@ static void flerp(int tot, float *in, float *f0, float *f1, float *f2, float *f3
{
int a;
- for(a=0; a<tot; a++) {
+ for (a=0; a<tot; a++) {
in[a]= t[0]*f0[a]+t[1]*f1[a]+t[2]*f2[a]+t[3]*f3[a];
}
}
@@ -528,17 +528,17 @@ static void rel_flerp(int tot, float *in, float *ref, float *out, float fac)
{
int a;
- for(a=0; a<tot; a++) {
+ for (a=0; a<tot; a++) {
in[a]-= fac*(ref[a]-out[a]);
}
}
static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char **freedata)
{
- if(kb == actkb) {
+ if (kb == actkb) {
/* this hack makes it possible to edit shape keys in
* edit mode with shape keys blending applied */
- if(GS(key->from->name) == ID_ME) {
+ if (GS(key->from->name) == ID_ME) {
Mesh *me;
BMVert *eve;
BMIter iter;
@@ -547,7 +547,7 @@ static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char **
me= (Mesh*)key->from;
- if(me->edit_btmesh && me->edit_btmesh->bm->totvert == kb->totelem) {
+ if (me->edit_btmesh && me->edit_btmesh->bm->totvert == kb->totelem) {
a= 0;
co= MEM_callocN(sizeof(float)*3*me->edit_btmesh->bm->totvert, "key_block_get_data");
@@ -570,7 +570,7 @@ static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char **
/* currently only the first value of 'ofs' may be set. */
static short key_pointer_size(const Key *key, const int mode, int *poinsize, int *ofs)
{
- if(key->from==NULL) {
+ if (key->from==NULL) {
return FALSE;
}
@@ -584,10 +584,11 @@ static short key_pointer_size(const Key *key, const int mode, int *poinsize, int
*poinsize= *ofs;
break;
case ID_CU:
- if(mode == KEY_MODE_BPOINT) {
+ if (mode == KEY_MODE_BPOINT) {
*ofs= sizeof(float)*4;
*poinsize= *ofs;
- } else {
+ }
+ else {
ofs[0]= sizeof(float)*12;
*poinsize= (*ofs) / 3;
}
@@ -611,15 +612,15 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
/* currently always 0, in future key_pointer_size may assign */
ofs[1]= 0;
- if(!key_pointer_size(key, mode, &poinsize, &ofs[0]))
+ if (!key_pointer_size(key, mode, &poinsize, &ofs[0]))
return;
- if(end>tot) end= tot;
+ if (end>tot) end= tot;
- if(tot != kb->totelem) {
+ if (tot != kb->totelem) {
ktot= 0.0;
flagflo= 1;
- if(kb->totelem) {
+ if (kb->totelem) {
kd= kb->totelem/(float)tot;
}
else return;
@@ -629,14 +630,14 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
kref= key_block_get_data(key, actkb, key->refkey, &freekref);
/* this exception is needed for slurphing */
- if(start!=0) {
+ if (start!=0) {
poin+= poinsize*start;
- if(flagflo) {
+ if (flagflo) {
ktot+= start*kd;
a= (int)floor(ktot);
- if(a) {
+ if (a) {
ktot-= a;
k1+= a*key->elemsize;
}
@@ -644,7 +645,7 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
else k1+= start*key->elemsize;
}
- if(mode == KEY_MODE_BEZTRIPLE) {
+ if (mode == KEY_MODE_BEZTRIPLE) {
elemstr[0]= 1;
elemstr[1]= IPO_BEZTRIPLE;
elemstr[2]= 0;
@@ -652,21 +653,21 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
/* just do it here, not above! */
elemsize= key->elemsize;
- if(mode == KEY_MODE_BEZTRIPLE) elemsize*= 3;
+ if (mode == KEY_MODE_BEZTRIPLE) elemsize*= 3;
- for(a=start; a<end; a++) {
+ for (a=start; a<end; a++) {
cp= key->elemstr;
- if(mode == KEY_MODE_BEZTRIPLE) cp= elemstr;
+ if (mode == KEY_MODE_BEZTRIPLE) cp= elemstr;
ofsp= ofs;
- while( cp[0] ) {
+ while ( cp[0] ) {
switch(cp[1]) {
case IPO_FLOAT:
- if(weights) {
+ if (weights) {
memcpy(poin, kref, sizeof(float)*3);
- if(*weights!=0.0f)
+ if (*weights!=0.0f)
rel_flerp(cp[0], (float *)poin, (float *)kref, (float *)k1, *weights);
weights++;
}
@@ -681,8 +682,8 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
break;
default:
/* should never happen */
- if(freek1) MEM_freeN(freek1);
- if(freekref) MEM_freeN(freekref);
+ if (freek1) MEM_freeN(freek1);
+ if (freekref) MEM_freeN(freekref);
BLI_assert(!"invalid 'cp[1]'");
return;
}
@@ -692,9 +693,9 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
}
/* are we going to be nasty? */
- if(flagflo) {
+ if (flagflo) {
ktot+= kd;
- while(ktot >= 1.0f) {
+ while (ktot >= 1.0f) {
ktot -= 1.0f;
k1+= elemsize;
kref+= elemsize;
@@ -705,11 +706,11 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
kref+= elemsize;
}
- if(mode == KEY_MODE_BEZTRIPLE) a+=2;
+ if (mode == KEY_MODE_BEZTRIPLE) a+=2;
}
- if(freek1) MEM_freeN(freek1);
- if(freekref) MEM_freeN(freekref);
+ if (freek1) MEM_freeN(freek1);
+ if (freekref) MEM_freeN(freekref);
}
static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const int start, int end, char *out, const int tot)
@@ -717,23 +718,23 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const
Nurb *nu;
int a, step, a1, a2;
- for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
- if(nu->bp) {
+ for (a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
+ if (nu->bp) {
step= nu->pntsu*nu->pntsv;
a1= MAX2(a, start);
a2= MIN2(a+step, end);
- if(a1<a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BPOINT);
+ if (a1<a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BPOINT);
}
- else if(nu->bezt) {
+ else if (nu->bezt) {
step= 3*nu->pntsu;
/* exception because keys prefer to work with complete blocks */
a1= MAX2(a, start);
a2= MIN2(a+step, end);
- if(a1<a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BEZTRIPLE);
+ if (a1<a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BEZTRIPLE);
}
else
step= 0;
@@ -751,10 +752,10 @@ void do_rel_key(const int start, int end, const int tot, char *basispoin, Key *k
/* currently always 0, in future key_pointer_size may assign */
ofs[1]= 0;
- if(!key_pointer_size(key, mode, &poinsize, &ofs[0]))
+ if (!key_pointer_size(key, mode, &poinsize, &ofs[0]))
return;
- if(end>tot) end= tot;
+ if (end>tot) end= tot;
/* in case of beztriple */
elemstr[0]= 1; /* nr of ipofloats */
@@ -763,25 +764,25 @@ void do_rel_key(const int start, int end, const int tot, char *basispoin, Key *k
/* just here, not above! */
elemsize= key->elemsize;
- if(mode == KEY_MODE_BEZTRIPLE) elemsize*= 3;
+ if (mode == KEY_MODE_BEZTRIPLE) elemsize*= 3;
/* step 1 init */
cp_key(start, end, tot, basispoin, key, actkb, key->refkey, NULL, mode);
/* step 2: do it */
- for(kb=key->block.first; kb; kb=kb->next) {
- if(kb!=key->refkey) {
+ for (kb=key->block.first; kb; kb=kb->next) {
+ if (kb!=key->refkey) {
float icuval= kb->curval;
/* only with value, and no difference allowed */
- if(!(kb->flag & KEYBLOCK_MUTE) && icuval!=0.0f && kb->totelem==tot) {
+ if (!(kb->flag & KEYBLOCK_MUTE) && icuval!=0.0f && kb->totelem==tot) {
KeyBlock *refb;
float weight, *weights= kb->weights;
/* reference now can be any block */
refb= BLI_findlink(&key->block, kb->relative);
- if(refb==NULL) continue;
+ if (refb==NULL) continue;
poin= basispoin;
from= key_block_get_data(key, actkb, kb, &freefrom);
@@ -791,19 +792,19 @@ void do_rel_key(const int start, int end, const int tot, char *basispoin, Key *k
reffrom+= key->elemsize*start; // key elemsize yes!
from+= key->elemsize*start;
- for(b=start; b<end; b++) {
+ for (b=start; b<end; b++) {
- if(weights)
+ if (weights)
weight= *weights * icuval;
else
weight= icuval;
cp= key->elemstr;
- if(mode == KEY_MODE_BEZTRIPLE) cp= elemstr;
+ if (mode == KEY_MODE_BEZTRIPLE) cp= elemstr;
ofsp= ofs;
- while( cp[0] ) { /* cp[0]==amount */
+ while ( cp[0] ) { /* cp[0]==amount */
switch(cp[1]) {
case IPO_FLOAT:
@@ -817,8 +818,8 @@ void do_rel_key(const int start, int end, const int tot, char *basispoin, Key *k
break;
default:
/* should never happen */
- if(freefrom) MEM_freeN(freefrom);
- if(freereffrom) MEM_freeN(freereffrom);
+ if (freefrom) MEM_freeN(freefrom);
+ if (freereffrom) MEM_freeN(freereffrom);
BLI_assert(!"invalid 'cp[1]'");
return;
}
@@ -832,12 +833,12 @@ void do_rel_key(const int start, int end, const int tot, char *basispoin, Key *k
reffrom+= elemsize;
from+= elemsize;
- if(mode == KEY_MODE_BEZTRIPLE) b+= 2;
- if(weights) weights++;
+ if (mode == KEY_MODE_BEZTRIPLE) b+= 2;
+ if (weights) weights++;
}
- if(freefrom) MEM_freeN(freefrom);
- if(freereffrom) MEM_freeN(freereffrom);
+ if (freefrom) MEM_freeN(freefrom);
+ if (freereffrom) MEM_freeN(freereffrom);
}
}
}
@@ -856,10 +857,10 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
/* currently always 0, in future key_pointer_size may assign */
ofs[1]= 0;
- if(!key_pointer_size(key, mode, &poinsize, &ofs[0]))
+ if (!key_pointer_size(key, mode, &poinsize, &ofs[0]))
return;
- if(end>tot) end= tot;
+ if (end>tot) end= tot;
k1= key_block_get_data(key, actkb, k[0], &freek1);
k2= key_block_get_data(key, actkb, k[1], &freek2);
@@ -867,82 +868,82 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
k4= key_block_get_data(key, actkb, k[3], &freek4);
/* test for more or less points (per key!) */
- if(tot != k[0]->totelem) {
+ if (tot != k[0]->totelem) {
k1tot= 0.0;
flagflo |= 1;
- if(k[0]->totelem) {
+ if (k[0]->totelem) {
k1d= k[0]->totelem/(float)tot;
}
else flagdo -= 1;
}
- if(tot != k[1]->totelem) {
+ if (tot != k[1]->totelem) {
k2tot= 0.0;
flagflo |= 2;
- if(k[0]->totelem) {
+ if (k[0]->totelem) {
k2d= k[1]->totelem/(float)tot;
}
else flagdo -= 2;
}
- if(tot != k[2]->totelem) {
+ if (tot != k[2]->totelem) {
k3tot= 0.0;
flagflo |= 4;
- if(k[0]->totelem) {
+ if (k[0]->totelem) {
k3d= k[2]->totelem/(float)tot;
}
else flagdo -= 4;
}
- if(tot != k[3]->totelem) {
+ if (tot != k[3]->totelem) {
k4tot= 0.0;
flagflo |= 8;
- if(k[0]->totelem) {
+ if (k[0]->totelem) {
k4d= k[3]->totelem/(float)tot;
}
else flagdo -= 8;
}
/* this exception needed for slurphing */
- if(start!=0) {
+ if (start!=0) {
poin+= poinsize*start;
- if(flagdo & 1) {
- if(flagflo & 1) {
+ if (flagdo & 1) {
+ if (flagflo & 1) {
k1tot+= start*k1d;
a= (int)floor(k1tot);
- if(a) {
+ if (a) {
k1tot-= a;
k1+= a*key->elemsize;
}
}
else k1+= start*key->elemsize;
}
- if(flagdo & 2) {
- if(flagflo & 2) {
+ if (flagdo & 2) {
+ if (flagflo & 2) {
k2tot+= start*k2d;
a= (int)floor(k2tot);
- if(a) {
+ if (a) {
k2tot-= a;
k2+= a*key->elemsize;
}
}
else k2+= start*key->elemsize;
}
- if(flagdo & 4) {
- if(flagflo & 4) {
+ if (flagdo & 4) {
+ if (flagflo & 4) {
k3tot+= start*k3d;
a= (int)floor(k3tot);
- if(a) {
+ if (a) {
k3tot-= a;
k3+= a*key->elemsize;
}
}
else k3+= start*key->elemsize;
}
- if(flagdo & 8) {
- if(flagflo & 8) {
+ if (flagdo & 8) {
+ if (flagflo & 8) {
k4tot+= start*k4d;
a= (int)floor(k4tot);
- if(a) {
+ if (a) {
k4tot-= a;
k4+= a*key->elemsize;
}
@@ -959,16 +960,16 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
/* only here, not above! */
elemsize= key->elemsize;
- if(mode == KEY_MODE_BEZTRIPLE) elemsize*= 3;
+ if (mode == KEY_MODE_BEZTRIPLE) elemsize*= 3;
- for(a=start; a<end; a++) {
+ for (a=start; a<end; a++) {
cp= key->elemstr;
- if(mode == KEY_MODE_BEZTRIPLE) cp= elemstr;
+ if (mode == KEY_MODE_BEZTRIPLE) cp= elemstr;
ofsp= ofs;
- while( cp[0] ) { /* cp[0]==amount */
+ while ( cp[0] ) { /* cp[0]==amount */
switch(cp[1]) {
case IPO_FLOAT:
@@ -982,10 +983,10 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
break;
default:
/* should never happen */
- if(freek1) MEM_freeN(freek1);
- if(freek2) MEM_freeN(freek2);
- if(freek3) MEM_freeN(freek3);
- if(freek4) MEM_freeN(freek4);
+ if (freek1) MEM_freeN(freek1);
+ if (freek2) MEM_freeN(freek2);
+ if (freek3) MEM_freeN(freek3);
+ if (freek4) MEM_freeN(freek4);
BLI_assert(!"invalid 'cp[1]'");
return;
}
@@ -995,40 +996,40 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
ofsp++;
}
/* lets do it the difficult way: when keys have a different size */
- if(flagdo & 1) {
- if(flagflo & 1) {
+ if (flagdo & 1) {
+ if (flagflo & 1) {
k1tot+= k1d;
- while(k1tot >= 1.0f) {
+ while (k1tot >= 1.0f) {
k1tot -= 1.0f;
k1+= elemsize;
}
}
else k1+= elemsize;
}
- if(flagdo & 2) {
- if(flagflo & 2) {
+ if (flagdo & 2) {
+ if (flagflo & 2) {
k2tot+= k2d;
- while(k2tot >= 1.0f) {
+ while (k2tot >= 1.0f) {
k2tot -= 1.0f;
k2+= elemsize;
}
}
else k2+= elemsize;
}
- if(flagdo & 4) {
- if(flagflo & 4) {
+ if (flagdo & 4) {
+ if (flagflo & 4) {
k3tot+= k3d;
- while(k3tot >= 1.0f) {
+ while (k3tot >= 1.0f) {
k3tot -= 1.0f;
k3+= elemsize;
}
}
else k3+= elemsize;
}
- if(flagdo & 8) {
- if(flagflo & 8) {
+ if (flagdo & 8) {
+ if (flagflo & 8) {
k4tot+= k4d;
- while(k4tot >= 1.0f) {
+ while (k4tot >= 1.0f) {
k4tot -= 1.0f;
k4+= elemsize;
}
@@ -1036,13 +1037,13 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
else k4+= elemsize;
}
- if(mode == KEY_MODE_BEZTRIPLE) a+= 2;
+ if (mode == KEY_MODE_BEZTRIPLE) a+= 2;
}
- if(freek1) MEM_freeN(freek1);
- if(freek2) MEM_freeN(freek2);
- if(freek3) MEM_freeN(freek3);
- if(freek4) MEM_freeN(freek4);
+ if (freek1) MEM_freeN(freek1);
+ if (freek2) MEM_freeN(freek2);
+ if (freek3) MEM_freeN(freek3);
+ if (freek4) MEM_freeN(freek4);
}
static float *get_weights_array(Object *ob, char *vgroup)
@@ -1054,45 +1055,45 @@ static float *get_weights_array(Object *ob, char *vgroup)
int totvert= 0, defgrp_index= 0;
/* no vgroup string set? */
- if(vgroup[0]==0) return NULL;
+ if (vgroup[0]==0) return NULL;
/* gather dvert and totvert */
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
Mesh *me= ob->data;
dvert= me->dvert;
totvert= me->totvert;
- if(me->edit_btmesh && me->edit_btmesh->bm->totvert == totvert)
+ if (me->edit_btmesh && me->edit_btmesh->bm->totvert == totvert)
em= me->edit_btmesh;
}
- else if(ob->type==OB_LATTICE) {
+ else if (ob->type==OB_LATTICE) {
Lattice *lt= ob->data;
dvert= lt->dvert;
totvert= lt->pntsu*lt->pntsv*lt->pntsw;
}
- if(dvert==NULL) return NULL;
+ if (dvert==NULL) return NULL;
/* find the group (weak loop-in-loop) */
defgrp_index= defgroup_name_index(ob, vgroup);
- if(defgrp_index >= 0) {
+ if (defgrp_index >= 0) {
float *weights;
int i;
weights= MEM_callocN(totvert*sizeof(float), "weights");
- if(em) {
+ if (em) {
eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
for (i=0; eve; eve=BM_iter_step(&iter), i++) {
dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
- if(dvert) {
+ if (dvert) {
weights[i]= defvert_find_weight(dvert, defgrp_index);
}
}
}
else {
- for(i=0; i < totvert; i++, dvert++) {
+ for (i=0; i < totvert; i++, dvert++) {
weights[i]= defvert_find_weight(dvert, defgrp_index);
}
}
@@ -1108,12 +1109,12 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int
float cfra, ctime, t[4], delta;
int a, flag = 0, step;
- if(key->slurph && key->type!=KEY_RELATIVE ) {
+ if (key->slurph && key->type!=KEY_RELATIVE ) {
delta= key->slurph;
delta/= tot;
step= 1;
- if(tot>100 && slurph_opt) {
+ if (tot>100 && slurph_opt) {
step= tot/50;
delta*= step;
/* in do_key and cp_key the case a>tot is handled */
@@ -1121,11 +1122,11 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int
cfra= (float)scene->r.cfra;
- for(a=0; a<tot; a+=step, cfra+= delta) {
+ for (a=0; a<tot; a+=step, cfra+= delta) {
ctime= BKE_curframe(scene);
#if 0 // XXX old animation system
- if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
+ if (calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
ctime /= 100.0;
CLAMP(ctime, 0.0, 1.0);
}
@@ -1136,23 +1137,23 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int
flag= setkeys(ctime, &key->block, k, t, 0);
- if(flag==0)
+ if (flag==0)
do_key(a, a+step, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
else
cp_key(a, a+step, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
}
}
else {
- if(key->type==KEY_RELATIVE) {
+ if (key->type==KEY_RELATIVE) {
KeyBlock *kb;
- for(kb= key->block.first; kb; kb= kb->next)
+ for (kb= key->block.first; kb; kb= kb->next)
kb->weights= get_weights_array(ob, kb->vgroup);
do_rel_key(0, tot, tot, (char *)out, key, actkb, KEY_MODE_DUMMY);
- for(kb= key->block.first; kb; kb= kb->next) {
- if(kb->weights) MEM_freeN(kb->weights);
+ for (kb= key->block.first; kb; kb= kb->next) {
+ if (kb->weights) MEM_freeN(kb->weights);
kb->weights= NULL;
}
}
@@ -1160,7 +1161,7 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int
ctime= BKE_curframe(scene);
#if 0 // XXX old animation system
- if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
+ if (calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
ctime /= 100.0;
CLAMP(ctime, 0.0, 1.0);
}
@@ -1171,7 +1172,7 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int
flag= setkeys(ctime, &key->block, k, t, 0);
- if(flag==0)
+ if (flag==0)
do_key(0, tot, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
else
cp_key(0, tot, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
@@ -1184,12 +1185,12 @@ static void do_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock **k, float
Nurb *nu;
int a, step;
- for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
- if(nu->bp) {
+ for (a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
+ if (nu->bp) {
step= nu->pntsu*nu->pntsv;
do_key(a, a+step, tot, out, key, actkb, k, t, KEY_MODE_BPOINT);
}
- else if(nu->bezt) {
+ else if (nu->bezt) {
step= 3*nu->pntsu;
do_key(a, a+step, tot, out, key, actkb, k, t, KEY_MODE_BEZTRIPLE);
}
@@ -1203,12 +1204,12 @@ static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, float UNUSED(cti
Nurb *nu;
int a, step;
- for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
- if(nu->bp) {
+ for (a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
+ if (nu->bp) {
step= nu->pntsu*nu->pntsv;
do_rel_key(a, a+step, tot, out, key, actkb, KEY_MODE_BPOINT);
}
- else if(nu->bezt) {
+ else if (nu->bezt) {
step= 3*nu->pntsu;
do_rel_key(a, a+step, tot, out, key, actkb, KEY_MODE_BEZTRIPLE);
}
@@ -1224,14 +1225,14 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
float cfra, ctime, t[4], delta;
int a, flag = 0, step = 0;
- if(key->slurph && key->type!=KEY_RELATIVE) {
+ if (key->slurph && key->type!=KEY_RELATIVE) {
Nurb *nu;
int mode=0, i= 0, remain= 0, estep=0, count=0;
delta= (float)key->slurph / tot;
step= 1;
- if(tot>100 && slurph_opt) {
+ if (tot>100 && slurph_opt) {
step= tot/50;
delta*= step;
/* in do_key and cp_key the case a>tot has been handled */
@@ -1239,12 +1240,12 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
cfra= (float)scene->r.cfra;
- for(nu=cu->nurb.first; nu; nu=nu->next) {
- if(nu->bp) {
+ for (nu=cu->nurb.first; nu; nu=nu->next) {
+ if (nu->bp) {
mode= KEY_MODE_BPOINT;
estep= nu->pntsu*nu->pntsv;
}
- else if(nu->bezt) {
+ else if (nu->bezt) {
mode= KEY_MODE_BEZTRIPLE;
estep= 3*nu->pntsu;
}
@@ -1269,7 +1270,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
count += 3 - count % 3;
}
- if(flag==0)
+ if (flag==0)
do_key(i, i+count, tot, (char *)out, key, actkb, k, t, mode);
else
cp_key(i, i+count, tot, (char *)out, key, actkb, k[2], NULL, mode);
@@ -1284,12 +1285,12 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
ctime= BKE_curframe(scene);
- if(key->type==KEY_RELATIVE) {
+ if (key->type==KEY_RELATIVE) {
do_rel_cu_key(cu, cu->key, actkb, ctime, out, tot);
}
else {
#if 0 // XXX old animation system
- if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
+ if (calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
ctime /= 100.0;
CLAMP(ctime, 0.0, 1.0);
}
@@ -1297,7 +1298,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
flag= setkeys(ctime, &key->block, k, t, 0);
- if(flag==0) do_cu_key(cu, key, actkb, k, t, out, tot);
+ if (flag==0) do_cu_key(cu, key, actkb, k, t, out, tot);
else cp_cu_key(cu, key, actkb, k[2], 0, tot, out, tot);
}
}
@@ -1310,17 +1311,17 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
float delta, cfra, ctime, t[4];
int a, flag;
- if(key->slurph) {
+ if (key->slurph) {
delta= key->slurph;
delta/= (float)tot;
cfra= (float)scene->r.cfra;
- for(a=0; a<tot; a++, cfra+= delta) {
+ for (a=0; a<tot; a++, cfra+= delta) {
ctime= BKE_curframe(scene);
#if 0 // XXX old animation system
- if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
+ if (calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
ctime /= 100.0;
CLAMP(ctime, 0.0, 1.0);
}
@@ -1328,23 +1329,23 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
flag= setkeys(ctime, &key->block, k, t, 0);
- if(flag==0)
+ if (flag==0)
do_key(a, a+1, tot, out, key, actkb, k, t, KEY_MODE_DUMMY);
else
cp_key(a, a+1, tot, out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
}
}
else {
- if(key->type==KEY_RELATIVE) {
+ if (key->type==KEY_RELATIVE) {
KeyBlock *kb;
- for(kb= key->block.first; kb; kb= kb->next)
+ for (kb= key->block.first; kb; kb= kb->next)
kb->weights= get_weights_array(ob, kb->vgroup);
do_rel_key(0, tot, tot, out, key, actkb, KEY_MODE_DUMMY);
- for(kb= key->block.first; kb; kb= kb->next) {
- if(kb->weights) MEM_freeN(kb->weights);
+ for (kb= key->block.first; kb; kb= kb->next) {
+ if (kb->weights) MEM_freeN(kb->weights);
kb->weights= NULL;
}
}
@@ -1352,7 +1353,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
ctime= BKE_curframe(scene);
#if 0 // XXX old animation system
- if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
+ if (calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
ctime /= 100.0;
CLAMP(ctime, 0.0, 1.0);
}
@@ -1360,14 +1361,14 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
flag= setkeys(ctime, &key->block, k, t, 0);
- if(flag==0)
+ if (flag==0)
do_key(0, tot, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
else
cp_key(0, tot, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
}
}
- if(lt->flag & LT_OUTSIDE) outside_lattice(lt);
+ if (lt->flag & LT_OUTSIDE) outside_lattice(lt);
}
/* returns key coordinates (+ tilt) when key applied, NULL otherwise */
@@ -1378,32 +1379,32 @@ float *do_ob_key(Scene *scene, Object *ob)
char *out;
int tot= 0, size= 0;
- if(key==NULL || key->block.first==NULL)
+ if (key==NULL || key->block.first==NULL)
return NULL;
/* compute size of output array */
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
Mesh *me= ob->data;
tot= me->totvert;
size= tot*3*sizeof(float);
}
- else if(ob->type == OB_LATTICE) {
+ else if (ob->type == OB_LATTICE) {
Lattice *lt= ob->data;
tot= lt->pntsu*lt->pntsv*lt->pntsw;
size= tot*3*sizeof(float);
}
- else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu= ob->data;
Nurb *nu;
- for(nu=cu->nurb.first; nu; nu=nu->next) {
- if(nu->bezt) {
+ for (nu=cu->nurb.first; nu; nu=nu->next) {
+ if (nu->bezt) {
tot += 3*nu->pntsu;
size += nu->pntsu*12*sizeof(float);
}
- else if(nu->bp) {
+ else if (nu->bp) {
tot += nu->pntsu*nu->pntsv;
size += nu->pntsu*nu->pntsv*12*sizeof(float);
}
@@ -1411,7 +1412,7 @@ float *do_ob_key(Scene *scene, Object *ob)
}
/* if nothing to interpolate, cancel */
- if(tot == 0 || size == 0)
+ if (tot == 0 || size == 0)
return NULL;
/* allocate array */
@@ -1420,14 +1421,14 @@ float *do_ob_key(Scene *scene, Object *ob)
/* prevent python from screwing this up? anyhoo, the from pointer could be dropped */
key->from= (ID *)ob->data;
- if(ob->shapeflag & OB_SHAPE_LOCK) {
+ if (ob->shapeflag & OB_SHAPE_LOCK) {
/* shape locked, copy the locked shape instead of blending */
KeyBlock *kb= BLI_findlink(&key->block, ob->shapenr-1);
- if(kb && (kb->flag & KEYBLOCK_MUTE))
+ if (kb && (kb->flag & KEYBLOCK_MUTE))
kb= key->refkey;
- if(kb==NULL) {
+ if (kb==NULL) {
kb= key->block.first;
ob->shapenr= 1;
}
@@ -1437,9 +1438,9 @@ float *do_ob_key(Scene *scene, Object *ob)
cp_key(0, tot, tot, out, key, actkb, kb, weights, 0);
- if(weights) MEM_freeN(weights);
+ if (weights) MEM_freeN(weights);
}
- else if(ELEM(ob->type, OB_CURVE, OB_SURF))
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF))
cp_cu_key(ob->data, key, actkb, kb, 0, tot, out, tot);
}
else {
@@ -1448,10 +1449,10 @@ float *do_ob_key(Scene *scene, Object *ob)
BKE_animsys_evaluate_animdata(scene, &key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
- if(ob->type==OB_MESH) do_mesh_key(scene, ob, key, out, tot);
- else if(ob->type==OB_LATTICE) do_latt_key(scene, ob, key, out, tot);
- else if(ob->type==OB_CURVE) do_curve_key(scene, ob, key, out, tot);
- else if(ob->type==OB_SURF) do_curve_key(scene, ob, key, out, tot);
+ if (ob->type==OB_MESH) do_mesh_key(scene, ob, key, out, tot);
+ else if (ob->type==OB_LATTICE) do_latt_key(scene, ob, key, out, tot);
+ else if (ob->type==OB_CURVE) do_curve_key(scene, ob, key, out, tot);
+ else if (ob->type==OB_SURF) do_curve_key(scene, ob, key, out, tot);
}
return (float*)out;
@@ -1459,9 +1460,9 @@ float *do_ob_key(Scene *scene, Object *ob)
Key *ob_get_key(Object *ob)
{
- if(ob==NULL) return NULL;
+ if (ob==NULL) return NULL;
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
Mesh *me= ob->data;
return me->key;
}
@@ -1469,7 +1470,7 @@ Key *ob_get_key(Object *ob)
Curve *cu= ob->data;
return cu->key;
}
- else if(ob->type==OB_LATTICE) {
+ else if (ob->type==OB_LATTICE) {
Lattice *lt= ob->data;
return lt->key;
}
@@ -1483,17 +1484,18 @@ KeyBlock *add_keyblock(Key *key, const char *name)
int tot;
kb= key->block.last;
- if(kb) curpos= kb->pos;
+ if (kb) curpos= kb->pos;
kb= MEM_callocN(sizeof(KeyBlock), "Keyblock");
BLI_addtail(&key->block, kb);
kb->type= KEY_CARDINAL;
tot= BLI_countlist(&key->block);
- if(name) {
+ if (name) {
BLI_strncpy(kb->name, name, sizeof(kb->name));
- } else {
- if(tot==1) BLI_strncpy(kb->name, "Basis", sizeof(kb->name));
+ }
+ else {
+ if (tot==1) BLI_strncpy(kb->name, "Basis", sizeof(kb->name));
else BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", tot-1);
}
@@ -1504,18 +1506,18 @@ KeyBlock *add_keyblock(Key *key, const char *name)
kb->uid = key->uidgen++;
key->totkey++;
- if(key->totkey==1) key->refkey= kb;
+ if (key->totkey==1) key->refkey= kb;
kb->slidermin= 0.0f;
kb->slidermax= 1.0f;
// XXX kb->pos is the confusing old horizontal-line RVK crap in old IPO Editor...
- if(key->type == KEY_RELATIVE)
+ if (key->type == KEY_RELATIVE)
kb->pos= curpos + 0.1f;
else {
#if 0 // XXX old animation system
curpos= BKE_curframe(scene);
- if(calc_ipo_spec(key->ipo, KEY_SPEED, &curpos)==0) {
+ if (calc_ipo_spec(key->ipo, KEY_SPEED, &curpos)==0) {
curpos /= 100.0;
}
kb->pos= curpos;
@@ -1610,16 +1612,16 @@ void latt_to_key(Lattice *lt, KeyBlock *kb)
int a, tot;
tot= lt->pntsu*lt->pntsv*lt->pntsw;
- if(tot==0) return;
+ if (tot==0) return;
- if(kb->data) MEM_freeN(kb->data);
+ if (kb->data) MEM_freeN(kb->data);
kb->data= MEM_callocN(lt->key->elemsize*tot, "kb->data");
kb->totelem= tot;
bp= lt->def;
fp= kb->data;
- for(a=0; a<kb->totelem; a++, fp+=3, bp++) {
+ for (a=0; a<kb->totelem; a++, fp+=3, bp++) {
copy_v3_v3(fp, bp->vec);
}
}
@@ -1636,7 +1638,7 @@ void key_to_latt(KeyBlock *kb, Lattice *lt)
tot= lt->pntsu*lt->pntsv*lt->pntsw;
tot= MIN2(kb->totelem, tot);
- for(a=0; a<tot; a++, fp+=3, bp++) {
+ for (a=0; a<tot; a++, fp+=3, bp++) {
copy_v3_v3(bp->vec, fp);
}
}
@@ -1652,21 +1654,21 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
/* count */
tot= count_curveverts(nurb);
- if(tot==0) return;
+ if (tot==0) return;
- if(kb->data) MEM_freeN(kb->data);
+ if (kb->data) MEM_freeN(kb->data);
kb->data= MEM_callocN(cu->key->elemsize*tot, "kb->data");
kb->totelem= tot;
nu= nurb->first;
fp= kb->data;
- while(nu) {
+ while (nu) {
- if(nu->bezt) {
+ if (nu->bezt) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
copy_v3_v3(fp, bezt->vec[0]);
fp+= 3;
copy_v3_v3(fp, bezt->vec[1]);
@@ -1681,7 +1683,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
+ while (a--) {
copy_v3_v3(fp, bp->vec);
fp[3]= bp->alfa;
@@ -1708,12 +1710,12 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
tot= MIN2(kb->totelem, tot);
- while(nu && tot>0) {
+ while (nu && tot>0) {
- if(nu->bezt) {
+ if (nu->bezt) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a-- && tot>0) {
+ while (a-- && tot>0) {
copy_v3_v3(bezt->vec[0], fp);
fp+= 3;
copy_v3_v3(bezt->vec[1], fp);
@@ -1730,7 +1732,7 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a-- && tot>0) {
+ while (a-- && tot>0) {
copy_v3_v3(bp->vec, fp);
bp->alfa= fp[3];
@@ -1750,16 +1752,16 @@ void mesh_to_key(Mesh *me, KeyBlock *kb)
float *fp;
int a;
- if(me->totvert==0) return;
+ if (me->totvert==0) return;
- if(kb->data) MEM_freeN(kb->data);
+ if (kb->data) MEM_freeN(kb->data);
kb->data= MEM_callocN(me->key->elemsize*me->totvert, "kb->data");
kb->totelem= me->totvert;
mvert= me->mvert;
fp= kb->data;
- for(a=0; a<kb->totelem; a++, fp+=3, mvert++) {
+ for (a=0; a<kb->totelem; a++, fp+=3, mvert++) {
copy_v3_v3(fp, mvert->co);
}
@@ -1776,7 +1778,7 @@ void key_to_mesh(KeyBlock *kb, Mesh *me)
tot= MIN2(kb->totelem, me->totvert);
- for(a=0; a<tot; a++, fp+=3, mvert++) {
+ for (a=0; a<tot; a++, fp+=3, mvert++) {
copy_v3_v3(mvert->co, fp);
}
}
@@ -1789,13 +1791,15 @@ float (*key_to_vertcos(Object *ob, KeyBlock *kb))[3]
int tot= 0, a;
/* Count of vertex coords in array */
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
Mesh *me= (Mesh*)ob->data;
tot= me->totvert;
- } else if(ob->type == OB_LATTICE) {
+ }
+ else if (ob->type == OB_LATTICE) {
Lattice *lt= (Lattice*)ob->data;
tot= lt->pntsu*lt->pntsv*lt->pntsw;
- } else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ }
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu= (Curve*)ob->data;
tot= count_curveverts(&cu->nurb);
}
@@ -1807,18 +1811,19 @@ float (*key_to_vertcos(Object *ob, KeyBlock *kb))[3]
/* Copy coords to array */
co= (float*)vertCos;
- if(ELEM(ob->type, OB_MESH, OB_LATTICE)) {
+ if (ELEM(ob->type, OB_MESH, OB_LATTICE)) {
for (a= 0; a<tot; a++, fp+=3, co+=3) {
copy_v3_v3(co, fp);
}
- } else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ }
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu= (Curve*)ob->data;
Nurb *nu= cu->nurb.first;
BezTriple *bezt;
BPoint *bp;
while (nu) {
- if(nu->bezt) {
+ if (nu->bezt) {
int i;
bezt= nu->bezt;
a= nu->pntsu;
@@ -1863,15 +1868,17 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
if (kb->data) MEM_freeN(kb->data);
/* Count of vertex coords in array */
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
Mesh *me= (Mesh*)ob->data;
tot= me->totvert;
elemsize= me->key->elemsize;
- } else if(ob->type == OB_LATTICE) {
+ }
+ else if (ob->type == OB_LATTICE) {
Lattice *lt= (Lattice*)ob->data;
tot= lt->pntsu*lt->pntsv*lt->pntsw;
elemsize= lt->key->elemsize;
- } else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ }
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu= (Curve*)ob->data;
elemsize= cu->key->elemsize;
tot= count_curveverts(&cu->nurb);
@@ -1886,18 +1893,19 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
/* Copy coords to keyblock */
- if(ELEM(ob->type, OB_MESH, OB_LATTICE)) {
+ if (ELEM(ob->type, OB_MESH, OB_LATTICE)) {
for (a= 0; a<tot; a++, fp+=3, co+=3) {
copy_v3_v3(fp, co);
}
- } else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ }
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu= (Curve*)ob->data;
Nurb *nu= cu->nurb.first;
BezTriple *bezt;
BPoint *bp;
while (nu) {
- if(nu->bezt) {
+ if (nu->bezt) {
int i;
bezt= nu->bezt;
a= nu->pntsu;
@@ -1937,18 +1945,19 @@ void offset_to_key(Object *ob, KeyBlock *kb, float (*ofs)[3])
int a;
float *co= (float*)ofs, *fp= kb->data;
- if(ELEM(ob->type, OB_MESH, OB_LATTICE)) {
+ if (ELEM(ob->type, OB_MESH, OB_LATTICE)) {
for (a= 0; a<kb->totelem; a++, fp+=3, co+=3) {
add_v3_v3(fp, co);
}
- } else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ }
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu= (Curve*)ob->data;
Nurb *nu= cu->nurb.first;
BezTriple *bezt;
BPoint *bp;
while (nu) {
- if(nu->bezt) {
+ if (nu->bezt) {
int i;
bezt= nu->bezt;
a= nu->pntsu;
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 4e4dca51e7d..e981d772df6 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -108,8 +108,8 @@ Lamp *copy_lamp(Lamp *la)
lan= copy_libblock(&la->id);
- for(a=0; a<MAX_MTEX; a++) {
- if(lan->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (lan->mtex[a]) {
lan->mtex[a]= MEM_mallocN(sizeof(MTex), "copylamptex");
memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
id_us_plus((ID *)lan->mtex[a]->tex);
@@ -118,10 +118,10 @@ Lamp *copy_lamp(Lamp *la)
lan->curfalloff = curvemapping_copy(la->curfalloff);
- if(la->nodetree)
+ if (la->nodetree)
lan->nodetree= ntreeCopyTree(la->nodetree);
- if(la->preview)
+ if (la->preview)
lan->preview = BKE_previewimg_copy(la->preview);
return lan;
@@ -135,8 +135,8 @@ Lamp *localize_lamp(Lamp *la)
lan= copy_libblock(&la->id);
BLI_remlink(&G.main->lamp, lan);
- for(a=0; a<MAX_MTEX; a++) {
- if(lan->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (lan->mtex[a]) {
lan->mtex[a]= MEM_mallocN(sizeof(MTex), "localize_lamp");
memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
/* free lamp decrements */
@@ -146,7 +146,7 @@ Lamp *localize_lamp(Lamp *la)
lan->curfalloff = curvemapping_copy(la->curfalloff);
- if(la->nodetree)
+ if (la->nodetree)
lan->nodetree= ntreeLocalize(la->nodetree);
lan->preview= NULL;
@@ -165,25 +165,25 @@ void make_local_lamp(Lamp *la)
* - mixed: make copy
*/
- if(la->id.lib==NULL) return;
- if(la->id.us==1) {
+ if (la->id.lib==NULL) return;
+ if (la->id.us==1) {
id_clear_lib_data(bmain, &la->id);
return;
}
ob= bmain->object.first;
- while(ob) {
- if(ob->data==la) {
- if(ob->id.lib) is_lib= TRUE;
+ while (ob) {
+ if (ob->data==la) {
+ if (ob->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
ob= ob->id.next;
}
- if(is_local && is_lib == FALSE) {
+ if (is_local && is_lib == FALSE) {
id_clear_lib_data(bmain, &la->id);
}
- else if(is_local && is_lib) {
+ else if (is_local && is_lib) {
Lamp *la_new= copy_lamp(la);
la_new->id.us= 0;
@@ -191,10 +191,10 @@ void make_local_lamp(Lamp *la)
BKE_id_lib_local_paths(bmain, la->id.lib, &la_new->id);
ob= bmain->object.first;
- while(ob) {
- if(ob->data==la) {
+ while (ob) {
+ if (ob->data==la) {
- if(ob->id.lib==NULL) {
+ if (ob->id.lib==NULL) {
ob->data= la_new;
la_new->id.us++;
la->id.us--;
@@ -210,10 +210,10 @@ void free_lamp(Lamp *la)
MTex *mtex;
int a;
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
mtex= la->mtex[a];
- if(mtex && mtex->tex) mtex->tex->id.us--;
- if(mtex) MEM_freeN(mtex);
+ if (mtex && mtex->tex) mtex->tex->id.us--;
+ if (mtex) MEM_freeN(mtex);
}
BKE_free_animdata((ID *)la);
@@ -221,7 +221,7 @@ void free_lamp(Lamp *la)
curvemapping_free(la->curfalloff);
/* is no lib link block, but lamp extension */
- if(la->nodetree) {
+ if (la->nodetree) {
ntreeFreeTree(la->nodetree);
MEM_freeN(la->nodetree);
}
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 0cddd978263..b1513954667 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -96,7 +96,7 @@ void resizelattice(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
lt->dvert= NULL;
}
- while(uNew*vNew*wNew > 32000) {
+ while (uNew*vNew*wNew > 32000) {
if ( uNew>=vNew && uNew>=wNew) uNew--;
else if ( vNew>=uNew && vNew>=wNew) vNew--;
else wNew--;
@@ -329,7 +329,8 @@ void init_latt_deform(Object *oblatt, Object *ob)
fp[0] = co[0] - fu;
fp[1] = co[1] - fv;
fp[2] = co[2] - fw;
- } else {
+ }
+ else {
fp[0] = bp->vec[0] - fu;
fp[1] = bp->vec[1] - fv;
fp[2] = bp->vec[2] - fw;
@@ -661,8 +662,10 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
use_vgroups = 0;
else
use_vgroups = 1;
- } else
+ }
+ else {
use_vgroups = 0;
+ }
if (vgroup && vgroup[0] && use_vgroups) {
Mesh *me= target->data;
@@ -802,8 +805,10 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
use_vgroups = 0;
else
use_vgroups = 1;
- } else
+ }
+ else {
use_vgroups = 0;
+ }
if (vgroup && vgroup[0] && use_vgroups) {
Mesh *me = target->data;
@@ -822,7 +827,8 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
calc_latt_deform(laOb, vertexCos[a], weight);
}
}
- } else {
+ }
+ else {
for (a = 0; a < numVerts; a++) {
calc_latt_deform(laOb, vertexCos[a], 1.0f);
}
@@ -841,7 +847,8 @@ int object_deform_mball(Object *ob, ListBase *dispbase)
}
return 1;
- } else {
+ }
+ else {
return 0;
}
}
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 34a9bc1d100..0cf0e8a97d1 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -27,16 +27,11 @@
/** \file blender/blenkernel/intern/library.c
* \ingroup bke
+ *
+ * Contains management of ID's and libraries
+ * allocate and free of all library data
*/
-
-/*
- * Contains management of ID's and libraries
- * allocate and free of all library data
- *
- */
-
-
#include <stdio.h>
#include <ctype.h>
#include <string.h>
@@ -149,8 +144,8 @@ void BKE_id_lib_local_paths(Main *bmain, Library *lib, ID *id)
void id_lib_extern(ID *id)
{
- if(id) {
- if(id->flag & LIB_INDIRECT) {
+ if (id) {
+ if (id->flag & LIB_INDIRECT) {
id->flag -= LIB_INDIRECT;
id->flag |= LIB_EXTERN;
}
@@ -159,9 +154,9 @@ void id_lib_extern(ID *id)
void id_us_plus(ID *id)
{
- if(id) {
+ if (id) {
id->us++;
- if(id->flag & LIB_INDIRECT) {
+ if (id->flag & LIB_INDIRECT) {
id->flag -= LIB_INDIRECT;
id->flag |= LIB_EXTERN;
}
@@ -170,10 +165,10 @@ void id_us_plus(ID *id)
void id_us_min(ID *id)
{
- if(id) {
- if(id->us<2 && (id->flag & LIB_FAKEUSER))
+ if (id) {
+ if (id->us<2 && (id->flag & LIB_FAKEUSER))
id->us= 1;
- else if(id->us<=0)
+ else if (id->us<=0)
printf("ID user decrement error: %s \n", id->name);
else
id->us--;
@@ -182,7 +177,7 @@ void id_us_min(ID *id)
int id_make_local(ID *id, int test)
{
- if(id->flag & LIB_INDIRECT)
+ if (id->flag & LIB_INDIRECT)
return 0;
switch(GS(id->name)) {
@@ -191,54 +186,54 @@ int id_make_local(ID *id, int test)
case ID_LI:
return 0; /* can't be linked */
case ID_OB:
- if(!test) make_local_object((Object*)id);
+ if (!test) make_local_object((Object*)id);
return 1;
case ID_ME:
- if(!test) {
+ if (!test) {
make_local_mesh((Mesh*)id);
make_local_key(((Mesh*)id)->key);
}
return 1;
case ID_CU:
- if(!test) {
+ if (!test) {
make_local_curve((Curve*)id);
make_local_key(((Curve*)id)->key);
}
return 1;
case ID_MB:
- if(!test) make_local_mball((MetaBall*)id);
+ if (!test) make_local_mball((MetaBall*)id);
return 1;
case ID_MA:
- if(!test) make_local_material((Material*)id);
+ if (!test) make_local_material((Material*)id);
return 1;
case ID_TE:
- if(!test) make_local_texture((Tex*)id);
+ if (!test) make_local_texture((Tex*)id);
return 1;
case ID_IM:
- if(!test) make_local_image((Image*)id);
+ if (!test) make_local_image((Image*)id);
return 1;
case ID_LT:
- if(!test) {
+ if (!test) {
make_local_lattice((Lattice*)id);
make_local_key(((Lattice*)id)->key);
}
return 1;
case ID_LA:
- if(!test) make_local_lamp((Lamp*)id);
+ if (!test) make_local_lamp((Lamp*)id);
return 1;
case ID_CA:
- if(!test) make_local_camera((Camera*)id);
+ if (!test) make_local_camera((Camera*)id);
return 1;
case ID_SPK:
- if(!test) make_local_speaker((Speaker*)id);
+ if (!test) make_local_speaker((Speaker*)id);
return 1;
case ID_IP:
return 0; /* deprecated */
case ID_KE:
- if(!test) make_local_key((Key*)id);
+ if (!test) make_local_key((Key*)id);
return 1;
case ID_WO:
- if(!test) make_local_world((World*)id);
+ if (!test) make_local_world((World*)id);
return 1;
case ID_SCR:
return 0; /* can't be linked */
@@ -253,18 +248,18 @@ int id_make_local(ID *id, int test)
case ID_GR:
return 0; /* not implemented */
case ID_AR:
- if(!test) make_local_armature((bArmature*)id);
+ if (!test) make_local_armature((bArmature*)id);
return 1;
case ID_AC:
- if(!test) make_local_action((bAction*)id);
+ if (!test) make_local_action((bAction*)id);
return 1;
case ID_NT:
return 0; /* not implemented */
case ID_BR:
- if(!test) make_local_brush((Brush*)id);
+ if (!test) make_local_brush((Brush*)id);
return 1;
case ID_PA:
- if(!test) make_local_particlesettings((ParticleSettings*)id);
+ if (!test) make_local_particlesettings((ParticleSettings*)id);
return 1;
case ID_WM:
return 0; /* can't be linked */
@@ -279,7 +274,7 @@ int id_make_local(ID *id, int test)
int id_copy(ID *id, ID **newid, int test)
{
- if(!test) *newid= NULL;
+ if (!test) *newid= NULL;
/* conventions:
* - make shallow copy, only this ID block
@@ -290,74 +285,74 @@ int id_copy(ID *id, ID **newid, int test)
case ID_LI:
return 0; /* can't be copied from here */
case ID_OB:
- if(!test) *newid= (ID*)copy_object((Object*)id);
+ if (!test) *newid= (ID*)copy_object((Object*)id);
return 1;
case ID_ME:
- if(!test) *newid= (ID*)copy_mesh((Mesh*)id);
+ if (!test) *newid= (ID*)copy_mesh((Mesh*)id);
return 1;
case ID_CU:
- if(!test) *newid= (ID*)copy_curve((Curve*)id);
+ if (!test) *newid= (ID*)copy_curve((Curve*)id);
return 1;
case ID_MB:
- if(!test) *newid= (ID*)copy_mball((MetaBall*)id);
+ if (!test) *newid= (ID*)copy_mball((MetaBall*)id);
return 1;
case ID_MA:
- if(!test) *newid= (ID*)copy_material((Material*)id);
+ if (!test) *newid= (ID*)copy_material((Material*)id);
return 1;
case ID_TE:
- if(!test) *newid= (ID*)copy_texture((Tex*)id);
+ if (!test) *newid= (ID*)copy_texture((Tex*)id);
return 1;
case ID_IM:
- if(!test) *newid= (ID*)copy_image((Image*)id);
+ if (!test) *newid= (ID*)copy_image((Image*)id);
return 1;
case ID_LT:
- if(!test) *newid= (ID*)copy_lattice((Lattice*)id);
+ if (!test) *newid= (ID*)copy_lattice((Lattice*)id);
return 1;
case ID_LA:
- if(!test) *newid= (ID*)copy_lamp((Lamp*)id);
+ if (!test) *newid= (ID*)copy_lamp((Lamp*)id);
return 1;
case ID_SPK:
- if(!test) *newid= (ID*)copy_speaker((Speaker*)id);
+ if (!test) *newid= (ID*)copy_speaker((Speaker*)id);
return 1;
case ID_CA:
- if(!test) *newid= (ID*)copy_camera((Camera*)id);
+ if (!test) *newid= (ID*)copy_camera((Camera*)id);
return 1;
case ID_IP:
return 0; /* deprecated */
case ID_KE:
- if(!test) *newid= (ID*)copy_key((Key*)id);
+ if (!test) *newid= (ID*)copy_key((Key*)id);
return 1;
case ID_WO:
- if(!test) *newid= (ID*)copy_world((World*)id);
+ if (!test) *newid= (ID*)copy_world((World*)id);
return 1;
case ID_SCR:
return 0; /* can't be copied from here */
case ID_VF:
return 0; /* not implemented */
case ID_TXT:
- if(!test) *newid= (ID*)copy_text((Text*)id);
+ if (!test) *newid= (ID*)copy_text((Text*)id);
return 1;
case ID_SCRIPT:
return 0; /* deprecated */
case ID_SO:
return 0; /* not implemented */
case ID_GR:
- if(!test) *newid= (ID*)copy_group((Group*)id);
+ if (!test) *newid= (ID*)copy_group((Group*)id);
return 1;
case ID_AR:
- if(!test) *newid= (ID*)copy_armature((bArmature*)id);
+ if (!test) *newid= (ID*)copy_armature((bArmature*)id);
return 1;
case ID_AC:
- if(!test) *newid= (ID*)copy_action((bAction*)id);
+ if (!test) *newid= (ID*)copy_action((bAction*)id);
return 1;
case ID_NT:
- if(!test) *newid= (ID*)ntreeCopyTree((bNodeTree*)id);
+ if (!test) *newid= (ID*)ntreeCopyTree((bNodeTree*)id);
return 1;
case ID_BR:
- if(!test) *newid= (ID*)copy_brush((Brush*)id);
+ if (!test) *newid= (ID*)copy_brush((Brush*)id);
return 1;
case ID_PA:
- if(!test) *newid= (ID*)psys_copy_settings((ParticleSettings*)id);
+ if (!test) *newid= (ID*)psys_copy_settings((ParticleSettings*)id);
return 1;
case ID_WM:
return 0; /* can't be copied from here */
@@ -378,21 +373,21 @@ int id_unlink(ID *id, int test)
switch(GS(id->name)) {
case ID_TXT:
- if(test) return 1;
+ if (test) return 1;
unlink_text(mainlib, (Text*)id);
break;
case ID_GR:
- if(test) return 1;
+ if (test) return 1;
unlink_group((Group*)id);
break;
case ID_OB:
- if(test) return 1;
+ if (test) return 1;
unlink_object((Object*)id);
break;
}
- if(id->us == 0) {
- if(test) return 1;
+ if (id->us == 0) {
+ if (test) return 1;
lb= which_libbase(mainlib, GS(id->name));
free_libblock(lb, id);
@@ -505,10 +500,11 @@ void flag_listbase_ids(ListBase *lb, short flag, short value)
{
ID *id;
if (value) {
- for(id= lb->first; id; id= id->next) id->flag |= flag;
- } else {
+ for (id= lb->first; id; id= id->next) id->flag |= flag;
+ }
+ else {
flag = ~flag;
- for(id= lb->first; id; id= id->next) id->flag &= flag;
+ for (id= lb->first; id; id= id->next) id->flag &= flag;
}
}
@@ -518,7 +514,7 @@ void flag_all_listbases_ids(short flag, short value)
ListBase *lbarray[MAX_LIBARRAY];
int a;
a= set_listbasepointers(G.main, lbarray);
- while(a--) flag_listbase_ids(lbarray[a], flag, value);
+ while (a--) flag_listbase_ids(lbarray[a], flag, value);
}
void recalc_all_library_objects(Main *main)
@@ -526,8 +522,8 @@ void recalc_all_library_objects(Main *main)
Object *ob;
/* flag for full recalc */
- for(ob=main->object.first; ob; ob=ob->id.next)
- if(ob->id.lib)
+ for (ob=main->object.first; ob; ob=ob->id.next)
+ if (ob->id.lib)
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
}
@@ -703,7 +699,7 @@ void *alloc_libblock(ListBase *lb, short type, const char *name)
ID *id= NULL;
id= alloc_libblock_notest(type);
- if(id) {
+ if (id) {
BLI_addtail(lb, id);
id->us= 1;
id->icon_id = 0;
@@ -749,7 +745,7 @@ void *copy_libblock(ID *id)
assert(idn != NULL);
idn_len= MEM_allocN_len(idn);
- if((int)idn_len - (int)sizeof(ID) > 0) { /* signed to allow neg result */
+ if ((int)idn_len - (int)sizeof(ID) > 0) { /* signed to allow neg result */
const char *cp= (const char *)id;
char *cpn= (char *)idn;
@@ -892,7 +888,7 @@ void free_libblock(ListBase *lb, void *idv)
psys_free_settings((ParticleSettings *)id);
break;
case ID_WM:
- if(free_windowmanager_cb)
+ if (free_windowmanager_cb)
free_windowmanager_cb(NULL, (wmWindowManager *)id);
break;
case ID_GD:
@@ -925,12 +921,12 @@ void free_libblock_us(ListBase *lb, void *idv) /* test users */
id->us--;
- if(id->us<0) {
- if(id->lib) printf("ERROR block %s %s users %d\n", id->lib->name, id->name, id->us);
+ if (id->us<0) {
+ if (id->lib) printf("ERROR block %s %s users %d\n", id->lib->name, id->name, id->us);
else printf("ERROR block %s users %d\n", id->name, id->us);
}
- if(id->us==0) {
- if( GS(id->name)==ID_OB ) unlink_object((Object *)id);
+ if (id->us==0) {
+ if ( GS(id->name)==ID_OB ) unlink_object((Object *)id);
free_libblock(lb, id);
}
@@ -944,7 +940,7 @@ void free_main(Main *mainvar)
int a;
a= set_listbasepointers(mainvar, lbarray);
- while(a--) {
+ while (a--) {
ListBase *lb= lbarray[a];
ID *id;
@@ -976,16 +972,16 @@ static void get_flags_for_id(ID *id, char *buf)
* to have that explicit, oh well - zr
*/
- if(GS(id->name)==ID_MA)
+ if (GS(id->name)==ID_MA)
isnode= ((Material *)id)->use_nodes;
- if(GS(id->name)==ID_TE)
+ if (GS(id->name)==ID_TE)
isnode= ((Tex *)id)->use_nodes;
if (id->us<0)
strcpy(buf, "-1W ");
else if (!id->lib && !isfake && id->us && !isnode)
strcpy(buf, " ");
- else if(isnode)
+ else if (isnode)
sprintf(buf, "%c%cN%c ", id->lib?'L':' ', isfake?'F':' ', (id->us==0)?'O':' ');
else
sprintf(buf, "%c%c%c ", id->lib?'L':' ', isfake?'F':' ', (id->us==0)?'O':' ');
@@ -1002,7 +998,8 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
if (nr && nids>MAX_IDPUP) {
BLI_dynstr_append(pupds, "DataBrowse %x-2");
*nr= -2;
- } else {
+ }
+ else {
ID *id;
for (i=0, id= lb->first; id; id= id->next, i++) {
@@ -1039,7 +1036,7 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
break;
}
- if(id->next)
+ if (id->next)
BLI_dynstr_append(pupds, "|");
}
}
@@ -1096,19 +1093,19 @@ static void sort_alpha_id(ListBase *lb, ID *id)
ID *idtest;
/* insert alphabetically */
- if(lb->first!=lb->last) {
+ if (lb->first!=lb->last) {
BLI_remlink(lb, id);
idtest= lb->first;
- while(idtest) {
- if(BLI_strcasecmp(idtest->name, id->name)>0 || idtest->lib) {
+ while (idtest) {
+ if (BLI_strcasecmp(idtest->name, id->name)>0 || idtest->lib) {
BLI_insertlinkbefore(lb, idtest, id);
break;
}
idtest= idtest->next;
}
/* as last */
- if(idtest==NULL) {
+ if (idtest==NULL) {
BLI_addtail(lb, id);
}
}
@@ -1123,13 +1120,13 @@ static ID *is_dupid(ListBase *lb, ID *id, const char *name)
{
ID *idtest=NULL;
- for( idtest = lb->first; idtest; idtest = idtest->next ) {
+ for ( idtest = lb->first; idtest; idtest = idtest->next ) {
/* if idtest is not a lib */
- if( id != idtest && idtest->lib == NULL ) {
+ if ( id != idtest && idtest->lib == NULL ) {
/* do not test alphabetic! */
/* optimized */
- if( idtest->name[2] == name[0] ) {
- if(strcmp(name, idtest->name+2)==0) break;
+ if ( idtest->name[2] == name[0] ) {
+ if (strcmp(name, idtest->name+2)==0) break;
}
}
}
@@ -1156,7 +1153,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
char left[MAX_ID_NAME + 8], leftest[MAX_ID_NAME + 8];
/* make sure input name is terminated properly */
- /* if( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3]= 0; */
+ /* if ( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3]= 0; */
/* removed since this is only ever called from one place - campbell */
while (1) {
@@ -1165,7 +1162,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
idtest = is_dupid(lb, id, name);
/* if there is no double, done */
- if( idtest == NULL ) return 0;
+ if ( idtest == NULL ) return 0;
/* we have a dup; need to make a new name */
/* quick check so we can reuse one of first 64 ids if vacant */
@@ -1175,33 +1172,33 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
left_len= BLI_split_name_num(left, &nr, name, '.');
/* if new name will be too long, truncate it */
- if(nr > 999 && left_len > (MAX_ID_NAME - 8)) {
+ if (nr > 999 && left_len > (MAX_ID_NAME - 8)) {
left[MAX_ID_NAME - 8]= 0;
left_len= MAX_ID_NAME - 8;
}
- else if(left_len > (MAX_ID_NAME - 7)) {
+ else if (left_len > (MAX_ID_NAME - 7)) {
left[MAX_ID_NAME - 7]= 0;
left_len= MAX_ID_NAME - 7;
}
- for(idtest= lb->first; idtest; idtest= idtest->next) {
- if( (id != idtest) &&
+ for (idtest= lb->first; idtest; idtest= idtest->next) {
+ if ( (id != idtest) &&
(idtest->lib == NULL) &&
(*name == *(idtest->name+2)) &&
(strncmp(name, idtest->name+2, left_len)==0) &&
(BLI_split_name_num(leftest, &nrtest, idtest->name+2, '.') == left_len)
) {
- if(nrtest < sizeof(in_use))
+ if (nrtest < sizeof(in_use))
in_use[nrtest]= 1; /* mark as used */
- if(nr <= nrtest)
+ if (nr <= nrtest)
nr= nrtest+1; /* track largest unused */
}
}
/* decide which value of nr to use */
- for(a=0; a < sizeof(in_use); a++) {
- if(a>=nr) break; /* stop when we've check up to biggest */
- if( in_use[a]==0 ) { /* found an unused value */
+ for (a=0; a < sizeof(in_use); a++) {
+ if (a>=nr) break; /* stop when we've check up to biggest */
+ if ( in_use[a]==0 ) { /* found an unused value */
nr = a;
break;
}
@@ -1210,7 +1207,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
/* If the original name has no numeric suffix,
* rather than just chopping and adding numbers,
* shave off the end chars until we have a unique name.
- * Check the null terminators match as well so we dont get Cube.000 -> Cube.00 */
+ * Check the null terminators match as well so we don't get Cube.000 -> Cube.00 */
if (nr==0 && name[left_len]== '\0') {
int len = left_len-1;
idtest= is_dupid(lb, id, name);
@@ -1223,10 +1220,10 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
/* otherwise just continue and use a number suffix */
}
- if(nr > 999 && left_len > (MAX_ID_NAME - 8)) {
+ if (nr > 999 && left_len > (MAX_ID_NAME - 8)) {
/* this would overflow name buffer */
left[MAX_ID_NAME - 8] = 0;
- /* left_len = MAX_ID_NAME - 8; */ /* for now this isnt used again */
+ /* left_len = MAX_ID_NAME - 8; */ /* for now this isn't used again */
memcpy(name, left, sizeof(char) * (MAX_ID_NAME - 7));
continue;
}
@@ -1250,14 +1247,14 @@ int new_id(ListBase *lb, ID *id, const char *tname)
char name[MAX_ID_NAME-2];
/* if library, don't rename */
- if(id->lib) return 0;
+ if (id->lib) return 0;
/* if no libdata given, look up based on ID */
- if(lb==NULL) lb= which_libbase(G.main, GS(id->name));
+ if (lb==NULL) lb= which_libbase(G.main, GS(id->name));
/* if no name given, use name of current ID
* else make a copy (tname args can be const) */
- if(tname==NULL)
+ if (tname==NULL)
tname= id->name+2;
strncpy(name, tname, sizeof(name)-1);
@@ -1266,13 +1263,13 @@ int new_id(ListBase *lb, ID *id, const char *tname)
* easier to assign each time then to check if its needed */
name[sizeof(name)-1]= 0;
- if(name[0] == '\0') {
+ if (name[0] == '\0') {
/* disallow empty names */
strcpy(name, ID_FALLBACK_NAME);
}
else {
/* disallow non utf8 chars,
- * the interface checks for this but new ID's based on file names dont */
+ * the interface checks for this but new ID's based on file names don't */
BLI_utf8_invalid_strip(name, strlen(name));
}
@@ -1284,7 +1281,7 @@ int new_id(ListBase *lb, ID *id, const char *tname)
* sorting should not hurt, but noting just incause it alters the way other
* functions work, so sort every time */
#if 0
- if( result )
+ if ( result )
sort_alpha_id(lb, id);
#endif
@@ -1312,9 +1309,9 @@ void clear_id_newpoins(void)
int a;
a= set_listbasepointers(G.main, lbarray);
- while(a--) {
+ while (a--) {
id= lbarray[a]->first;
- while(id) {
+ while (id) {
id->newid= NULL;
id->flag &= ~LIB_NEW;
id= id->next;
@@ -1322,21 +1319,21 @@ void clear_id_newpoins(void)
}
}
-#define LIBTAG(a) if(a && a->id.lib) {a->id.flag &=~LIB_INDIRECT; a->id.flag |= LIB_EXTERN;}
+#define LIBTAG(a) if (a && a->id.lib) {a->id.flag &=~LIB_INDIRECT; a->id.flag |= LIB_EXTERN;}
static void lib_indirect_test_id(ID *id, Library *lib)
{
- if(id->lib) {
+ if (id->lib) {
/* datablocks that were indirectly related are now direct links
* without this, appending data that has a link to other data will fail to write */
- if(lib && id->lib->parent == lib) {
+ if (lib && id->lib->parent == lib) {
id_lib_extern(id);
}
return;
}
- if(GS(id->name)==ID_OB) {
+ if (GS(id->name)==ID_OB) {
Object *ob= (Object *)id;
Mesh *me;
@@ -1355,7 +1352,7 @@ static void lib_indirect_test_id(ID *id, Library *lib)
// XXX: new animation system needs something like this?
#endif
- for(a=0; a<ob->totcol; a++) {
+ for (a=0; a<ob->totcol; a++) {
LIBTAG(ob->mat[a]);
}
@@ -1370,13 +1367,13 @@ static void lib_indirect_test_id(ID *id, Library *lib)
void tag_main_lb(ListBase *lb, const short tag)
{
ID *id;
- if(tag) {
- for(id= lb->first; id; id= id->next) {
+ if (tag) {
+ for (id= lb->first; id; id= id->next) {
id->flag |= LIB_DOIT;
}
}
else {
- for(id= lb->first; id; id= id->next) {
+ for (id= lb->first; id; id= id->next) {
id->flag &= ~LIB_DOIT;
}
}
@@ -1395,7 +1392,7 @@ void tag_main(struct Main *mainvar, const short tag)
int a;
a= set_listbasepointers(mainvar, lbarray);
- while(a--) {
+ while (a--) {
tag_main_lb(lbarray[a], tag);
}
}
@@ -1409,23 +1406,23 @@ void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only)
int a;
a= set_listbasepointers(bmain, lbarray);
- while(a--) {
+ while (a--) {
id= lbarray[a]->first;
- while(id) {
+ while (id) {
id->newid= NULL;
idn= id->next; /* id is possibly being inserted again */
/* The check on the second line (LIB_PRE_EXISTING) is done so its
- * possible to tag data you dont want to be made local, used for
+ * possible to tag data you don't want to be made local, used for
* appending data, so any libdata already linked wont become local
* (very nasty to discover all your links are lost after appending)
* */
- if(id->flag & (LIB_EXTERN|LIB_INDIRECT|LIB_NEW) &&
+ if (id->flag & (LIB_EXTERN|LIB_INDIRECT|LIB_NEW) &&
(untagged_only==0 || !(id->flag & LIB_PRE_EXISTING)))
{
- if(lib==NULL || id->lib==lib) {
- if(id->lib) {
+ if (lib==NULL || id->lib==lib) {
+ if (id->lib) {
id_clear_lib_data(bmain, id); /* sets 'id->flag' */
/* why sort alphabetically here but not in
@@ -1441,7 +1438,7 @@ void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only)
}
/* patch2: make it aphabetically */
- while( (id=tempbase.first) ) {
+ while ( (id=tempbase.first) ) {
BLI_remlink(&tempbase, id);
BLI_addtail(lbarray[a], id);
new_id(lbarray[a], id, NULL);
@@ -1450,8 +1447,8 @@ void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only)
/* patch 3: make sure library data isn't indirect falsely... */
a= set_listbasepointers(bmain, lbarray);
- while(a--) {
- for(id= lbarray[a]->first; id; id=id->next)
+ while (a--) {
+ for (id= lbarray[a]->first; id; id=id->next)
lib_indirect_test_id(id, lib);
}
}
@@ -1465,22 +1462,22 @@ void test_idbutton(char *name)
lb= which_libbase(G.main, GS(name-2) );
- if(lb==NULL) return;
+ if (lb==NULL) return;
/* search for id */
idtest= BLI_findstring(lb, name, offsetof(ID, name) + 2);
- if(idtest) if( new_id(lb, idtest, name)==0 ) sort_alpha_id(lb, idtest);
+ if (idtest) if ( new_id(lb, idtest, name)==0 ) sort_alpha_id(lb, idtest);
}
void text_idbutton(struct ID *id, char *text)
{
- if(id) {
- if(GS(id->name)==ID_SCE)
+ if (id) {
+ if (GS(id->name)==ID_SCE)
strcpy(text, "SCE: ");
- else if(GS(id->name)==ID_SCR)
+ else if (GS(id->name)==ID_SCR)
strcpy(text, "SCR: ");
- else if(GS(id->name)==ID_MA && ((Material*)id)->use_nodes)
+ else if (GS(id->name)==ID_MA && ((Material*)id)->use_nodes)
strcpy(text, "NT: ");
else {
text[0]= id->name[0];
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 8a746113035..7e6c9755ae1 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -308,7 +308,7 @@ void make_local_material(Material *ma)
* lib or local */
/* test objects */
ob= bmain->object.first;
- while(ob) {
+ while (ob) {
if (ob->mat) {
for (a=0; a<ob->totcol; a++) {
if (ob->mat[a]==ma) {
@@ -321,7 +321,7 @@ void make_local_material(Material *ma)
}
/* test meshes */
me= bmain->mesh.first;
- while(me) {
+ while (me) {
if (me->mat) {
for (a=0; a<me->totcol; a++) {
if (me->mat[a]==ma) {
@@ -334,7 +334,7 @@ void make_local_material(Material *ma)
}
/* test curves */
cu= bmain->curve.first;
- while(cu) {
+ while (cu) {
if (cu->mat) {
for (a=0; a<cu->totcol; a++) {
if (cu->mat[a]==ma) {
@@ -347,7 +347,7 @@ void make_local_material(Material *ma)
}
/* test mballs */
mb= bmain->mball.first;
- while(mb) {
+ while (mb) {
if (mb->mat) {
for (a=0; a<mb->totcol; a++) {
if (mb->mat[a]==ma) {
@@ -375,7 +375,7 @@ void make_local_material(Material *ma)
/* do objects */
ob= bmain->object.first;
- while(ob) {
+ while (ob) {
if (ob->mat) {
for (a=0; a<ob->totcol; a++) {
if (ob->mat[a]==ma) {
@@ -391,7 +391,7 @@ void make_local_material(Material *ma)
}
/* do meshes */
me= bmain->mesh.first;
- while(me) {
+ while (me) {
if (me->mat) {
for (a=0; a<me->totcol; a++) {
if (me->mat[a]==ma) {
@@ -407,7 +407,7 @@ void make_local_material(Material *ma)
}
/* do curves */
cu= bmain->curve.first;
- while(cu) {
+ while (cu) {
if (cu->mat) {
for (a=0; a<cu->totcol; a++) {
if (cu->mat[a]==ma) {
@@ -423,7 +423,7 @@ void make_local_material(Material *ma)
}
/* do mballs */
mb= bmain->mball.first;
- while(mb) {
+ while (mb) {
if (mb->mat) {
for (a=0; a<mb->totcol; a++) {
if (mb->mat[a]==ma) {
@@ -534,7 +534,7 @@ static void data_delete_material_index_id(ID *id, short index)
curve_delete_material_index((Curve *)id, index);
break;
case ID_MB:
- /* meta-elems dont have materials atm */
+ /* meta-elems don't have materials atm */
break;
}
}
@@ -841,7 +841,7 @@ void assign_matarar(struct Object *ob, struct Material ***matar, short totcol)
int actcol_orig= ob->actcol;
short i;
- while(object_remove_material_slot(ob)) {};
+ while (object_remove_material_slot(ob)) {};
/* now we have the right number of slots */
for (i=0; i<totcol; i++)
@@ -1145,7 +1145,7 @@ int object_remove_material_slot(Object *ob)
actcol= ob->actcol;
obt= G.main->object.first;
- while(obt) {
+ while (obt) {
if (obt->data==ob->data) {
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index f3225a6b6f5..da5e02c17f1 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -77,7 +77,7 @@ void unlink_mball(MetaBall *mb)
{
int a;
- for(a=0; a<mb->totcol; a++) {
+ for (a=0; a<mb->totcol; a++) {
if (mb->mat[a]) mb->mat[a]->id.us--;
mb->mat[a]= NULL;
}
@@ -125,7 +125,7 @@ MetaBall *copy_mball(MetaBall *mb)
BLI_duplicatelist(&mbn->elems, &mb->elems);
mbn->mat= MEM_dupallocN(mb->mat);
- for(a=0; a<mbn->totcol; a++) {
+ for (a=0; a<mbn->totcol; a++) {
id_us_plus((ID *)mbn->mat[a]);
}
mbn->bb= MEM_dupallocN(mb->bb);
@@ -162,7 +162,7 @@ void make_local_mball(MetaBall *mb)
return;
}
- for(ob= G.main->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
+ for (ob= G.main->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
if (ob->data == mb) {
if (ob->id.lib) is_lib= TRUE;
else is_local= TRUE;
@@ -180,7 +180,7 @@ void make_local_mball(MetaBall *mb)
/* Remap paths of new ID using old library as base. */
BKE_id_lib_local_paths(bmain, mb->id.lib, &mb_new->id);
- for(ob= G.main->object.first; ob; ob= ob->id.next) {
+ for (ob= G.main->object.first; ob; ob= ob->id.next) {
if (ob->data == mb) {
if (ob->id.lib==NULL) {
ob->data= mb_new;
@@ -262,11 +262,11 @@ void tex_space_mball(Object *ob)
(max)[0]= (max)[1]= (max)[2]= -1.0e30f;
dl= ob->disp.first;
- while(dl) {
+ while (dl) {
tot= dl->nr;
if (tot) doit= 1;
data= dl->verts;
- while(tot--) {
+ while (tot--) {
/* Also weird... but longer. From utildefines. */
DO_MINMAX(data, min, max);
data+= 3;
@@ -313,7 +313,7 @@ float *make_orco_mball(Object *ob, ListBase *dispbase)
data= dl->verts;
orco= orcodata;
a= dl->nr;
- while(a--) {
+ while (a--) {
orco[0]= (data[0]-loc[0])/size[0];
orco[1]= (data[1]-loc[1])/size[1];
orco[2]= (data[2]-loc[2])/size[2];
@@ -353,7 +353,7 @@ int is_basis_mball(Object *ob)
}
/* return nonzero if ob1 is a basis mball for ob */
-int is_mball_basis_for(Object *ob1, Object *ob2)
+int is_mball_basis_for (Object *ob1, Object *ob2)
{
int basis1nr, basis2nr;
char basis1name[MAX_ID_NAME], basis2name[MAX_ID_NAME];
@@ -386,7 +386,7 @@ void copy_mball_properties(Scene *scene, Object *active_object)
if (F_ERROR==next_object(&sce_iter, 0, NULL, NULL))
return;
- while(next_object(&sce_iter, 1, &base, &ob)) {
+ while (next_object(&sce_iter, 1, &base, &ob)) {
if (ob->type==OB_MBALL) {
if (ob != active_object) {
BLI_split_name_num(obname, &obnr, ob->id.name+2, '.');
@@ -432,7 +432,7 @@ Object *find_basis_mball(Scene *scene, Object *basis)
if (F_ERROR==next_object(&sce_iter, 0, NULL, NULL))
return NULL;
- while(next_object(&sce_iter, 1, &base, &ob)) {
+ while (next_object(&sce_iter, 1, &base, &ob)) {
if (ob->type==OB_MBALL) {
if (ob==bob) {
@@ -444,7 +444,7 @@ Object *find_basis_mball(Scene *scene, Object *basis)
/* if bob object is in object mode */
else ml= mb->elems.first;
}
- else{
+ else {
BLI_split_name_num(obname, &obnr, ob->id.name+2, '.');
/* object ob has to be in same "group" ... it means, that it has to have
@@ -617,21 +617,21 @@ octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z
else
return node;
}
- else{
+ else {
if (node->nodes[1])
return find_metaball_octal_node(node->nodes[1],x,y,z,depth--);
else
return node;
}
}
- else{
+ else {
if (x < node->x) {
if (node->nodes[3])
return find_metaball_octal_node(node->nodes[3],x,y,z,depth--);
else
return node;
}
- else{
+ else {
if (node->nodes[2])
return find_metaball_octal_node(node->nodes[2],x,y,z,depth--);
else
@@ -639,7 +639,7 @@ octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z
}
}
}
- else{
+ else {
if (y < node->y) {
if (x < node->x) {
if (node->nodes[4])
@@ -647,21 +647,21 @@ octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z
else
return node;
}
- else{
+ else {
if (node->nodes[5])
return find_metaball_octal_node(node->nodes[5],x,y,z,depth--);
else
return node;
}
}
- else{
+ else {
if (x < node->x) {
if (node->nodes[7])
return find_metaball_octal_node(node->nodes[7],x,y,z,depth--);
else
return node;
}
- else{
+ else {
if (node->nodes[6])
return find_metaball_octal_node(node->nodes[6],x,y,z,depth--);
else
@@ -686,7 +686,7 @@ float metaball(float x, float y, float z)
if (node) {
ml_p= node->elems.first;
- while(ml_p) {
+ while (ml_p) {
dens+=densfunc(ml_p->ml, x, y, z);
ml_p= ml_p->next;
}
@@ -694,14 +694,14 @@ float metaball(float x, float y, float z)
dens+= -0.5f*(metaball_tree->pos - node->pos);
dens+= 0.5f*(metaball_tree->neg - node->neg);
}
- else{
- for(a=0; a<totelem; a++) {
- dens+= densfunc( mainb[a], x, y, z);
+ else {
+ for (a=0; a<totelem; a++) {
+ dens += densfunc(mainb[a], x, y, z);
}
}
}
- else{
- dens+= densfunc( mainb[0], x, y, z);
+ else {
+ dens += densfunc(mainb[0], x, y, z);
}
return thresh - dens;
@@ -762,7 +762,7 @@ void *new_pgn_element(int size)
}
else if (size== -1) {
cur= lb.first;
- while(cur) {
+ while (cur) {
MEM_freeN(cur->data);
cur= cur->next;
}
@@ -1078,11 +1078,11 @@ void BKE_freecubetable(void)
for (i = 0; i < 256; i++) {
lists= cubetable[i];
- while(lists) {
+ while (lists) {
nlists= lists->next;
ints= lists->list;
- while(ints) {
+ while (ints) {
nints= ints->next;
MEM_freeN(ints);
ints= nints;
@@ -1387,7 +1387,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
pos.y = p->y;
pos.z = p->z;
}
- else{
+ else {
neg.x = p->x;
neg.y = p->y;
neg.z = p->z;
@@ -1404,9 +1404,9 @@ void add_cube(PROCESS *mbproc, int i, int j, int k, int count)
/* hmmm, not only one, but eight cube will be added on the stack
* ... */
- for(a=i-1; a<i+count; a++)
- for(b=j-1; b<j+count; b++)
- for(c=k-1; c<k+count; c++) {
+ for (a=i-1; a<i+count; a++)
+ for (b=j-1; b<j+count; b++)
+ for (c=k-1; c<k+count; c++) {
/* test if cube has been found before */
if ( setcenter(mbproc->centers, a, b, c)==0 ) {
/* push cube on stack: */
@@ -1451,7 +1451,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
calc_mballco(ml, (float *)&in);
in_v = mbproc->function(in.x, in.y, in.z);
- for(i=0;i<3;i++) {
+ for (i=0;i<3;i++) {
switch (ml->type) {
case MB_BALL:
OUT.x = out.x= IN.x + index[i]*ml->rad;
@@ -1464,7 +1464,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
break;
}
- for(j=0;j<3;j++) {
+ for (j=0;j<3;j++) {
switch (ml->type) {
case MB_BALL:
OUT.y = out.y= IN.y + index[j]*ml->rad;
@@ -1477,7 +1477,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
break;
}
- for(k=0;k<3;k++) {
+ for (k=0;k<3;k++) {
out.x = OUT.x;
out.y = OUT.y;
switch (ml->type) {
@@ -1514,7 +1514,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
dz = (out.z - in.z)/MAXN;
len = 0.0;
- while(len<=max_len) {
+ while (len<=max_len) {
workp.x += dx;
workp.y += dy;
workp.z += dz;
@@ -1560,7 +1560,7 @@ void polygonize(PROCESS *mbproc, MetaBall *mb)
mbproc->edges = MEM_callocN(2*HASHSIZE * sizeof(EDGELIST *), "mbproc->edges");
makecubetable();
- for(a=0; a<totelem; a++) {
+ for (a=0; a<totelem; a++) {
/* try to find 8 points on the surface for each MetaElem */
find_first_points(mbproc, mb, a);
@@ -1606,7 +1606,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
/* make main array */
next_object(&sce_iter, 0, NULL, NULL);
- while(next_object(&sce_iter, 1, &base, &bob)) {
+ while (next_object(&sce_iter, 1, &base, &bob)) {
if (bob->type==OB_MBALL) {
zero_size= 0;
@@ -1638,7 +1638,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
}
else if (bob->parent) {
struct Object *pob=bob->parent;
- while(pob) {
+ while (pob) {
if (pob->size[0]==0.0f || pob->size[1]==0.0f || pob->size[2]==0.0f) {
zero_size= 1;
break;
@@ -1649,14 +1649,14 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
if (zero_size) {
unsigned int ml_count=0;
- while(ml) {
+ while (ml) {
ml_count++;
ml= ml->next;
}
totelem -= ml_count;
}
else {
- while(ml) {
+ while (ml) {
if (!(ml->flag & MB_HIDE)) {
int i;
float temp1[4][4], temp2[4][4], temp3[4][4];
@@ -1737,11 +1737,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
mainb[a]->bb->vec[7][2]= ml->expz;
/* transformation of Metalem bb */
- for(i=0; i<8; i++)
+ for (i=0; i<8; i++)
mul_m4_v3((float ( * )[4])mat, mainb[a]->bb->vec[i]);
/* find max and min of transformed bb */
- for(i=0; i<8; i++) {
+ for (i=0; i<8; i++) {
/* find maximums */
if (mainb[a]->bb->vec[i][0] > max_x) max_x = mainb[a]->bb->vec[i][0];
if (mainb[a]->bb->vec[i][1] > max_y) max_y = mainb[a]->bb->vec[i][1];
@@ -1773,7 +1773,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
/* totsize (= 'manhattan' radius) */
totsize= 0.0;
- for(a=0; a<totelem; a++) {
+ for (a=0; a<totelem; a++) {
vec[0]= mainb[a]->x + mainb[a]->rad + mainb[a]->expx;
vec[1]= mainb[a]->y + mainb[a]->rad + mainb[a]->expy;
@@ -1802,8 +1802,8 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
if ( size > totsize ) totsize= size;
}
- for(a=0; a<totelem; a++) {
- thresh+= densfunc( mainb[a], 2.0f*totsize, 2.0f*totsize, 2.0f*totsize);
+ for (a=0; a<totelem; a++) {
+ thresh += densfunc(mainb[a], 2.0f * totsize, 2.0f * totsize, 2.0f * totsize);
}
return totsize;
@@ -1824,7 +1824,7 @@ void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i)
if (ml->flag & MB_NEGATIVE) {
node->nodes[i]->neg++;
}
- else{
+ else {
node->nodes[i]->pos++;
}
}
@@ -1852,9 +1852,9 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
int a,i;
/* create new nodes */
- for(a=0;a<8;a++) {
+ for (a=0;a<8;a++) {
node->nodes[a]= MEM_mallocN(sizeof(octal_node),"octal_node");
- for(i=0;i<8;i++)
+ for (i=0;i<8;i++)
node->nodes[a]->nodes[i]= NULL;
node->nodes[a]->parent= node;
node->nodes[a]->elems.first= NULL;
@@ -1933,7 +1933,7 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
ml_p= node->elems.first;
/* setting up references of MetaElems for new nodes */
- while(ml_p) {
+ while (ml_p) {
ml= ml_p->ml;
if (ml->bb->vec[0][2] < z) {
if (ml->bb->vec[0][1] < y) {
@@ -1982,7 +1982,7 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
}
/* vec[0][0] is in the (1)second octant */
- else{
+ else {
/* ml belong to the (1)2nd node */
fill_metaball_octal_node(node, ml, 1);
@@ -2003,7 +2003,7 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
}
}
}
- else{
+ else {
/* vec[0][0] is in the (3)4th octant */
if (ml->bb->vec[0][0] < x) {
/* ml belongs to the (3)4nd node */
@@ -2039,7 +2039,7 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
}
}
}
- else{
+ else {
if (ml->bb->vec[0][1] < y) {
/* vec[0][0] lies in (4)5th octant */
if (ml->bb->vec[0][0] < x) {
@@ -2059,7 +2059,7 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
}
}
/* vec[0][0] lies in (5)6th octant */
- else{
+ else {
fill_metaball_octal_node(node, ml, 5);
if (ml->bb->vec[6][1] >= y) {
@@ -2067,7 +2067,7 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
}
}
}
- else{
+ else {
/* vec[0][0] lies in (7)8th octant */
if (ml->bb->vec[0][0] < x) {
fill_metaball_octal_node(node, ml, 7);
@@ -2093,7 +2093,7 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
depth--;
if (depth>0) {
- for(a=0;a<8;a++) {
+ for (a=0;a<8;a++) {
if (node->nodes[a]->count > 0) /* if node is not empty, then it is subdivided */
subdivide_metaball_octal_node(node->nodes[a], size_x, size_y, size_z, depth);
}
@@ -2104,7 +2104,7 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
void free_metaball_octal_node(octal_node *node)
{
int a;
- for(a=0;a<8;a++) {
+ for (a=0;a<8;a++) {
if (node->nodes[a]!=NULL) free_metaball_octal_node(node->nodes[a]);
}
BLI_freelistN(&node->elems);
@@ -2131,14 +2131,14 @@ void init_metaball_octal_tree(int depth)
node->elems.last= NULL;
node->count=0;
- for(a=0;a<8;a++)
+ for (a=0;a<8;a++)
node->nodes[a]=NULL;
node->x_min= node->y_min= node->z_min= FLT_MAX;
node->x_max= node->y_max= node->z_max= -FLT_MAX;
/* size of octal tree scene */
- for(a=0;a<totelem;a++) {
+ for (a=0;a<totelem;a++) {
if (mainb[a]->bb->vec[0][0] < node->x_min) node->x_min= mainb[a]->bb->vec[0][0];
if (mainb[a]->bb->vec[0][1] < node->y_min) node->y_min= mainb[a]->bb->vec[0][1];
if (mainb[a]->bb->vec[0][2] < node->z_min) node->z_min= mainb[a]->bb->vec[0][2];
@@ -2155,7 +2155,7 @@ void init_metaball_octal_tree(int depth)
/* number of negative MetaElem in scene */
metaball_tree->neg++;
}
- else{
+ else {
/* number of positive MetaElem in scene */
metaball_tree->pos++;
}
@@ -2268,7 +2268,7 @@ void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
dl->verts= ve= MEM_mallocN(sizeof(float)*3*a, "mballverts");
dl->nors= no= MEM_mallocN(sizeof(float)*3*a, "mballnors");
- for(a=0; a<mbproc.vertices.count; a++, no+=3, ve+=3) {
+ for (a=0; a<mbproc.vertices.count; a++, no+=3, ve+=3) {
ve[0]= mbproc.vertices.ptr[a].position.x;
ve[1]= mbproc.vertices.ptr[a].position.y;
ve[2]= mbproc.vertices.ptr[a].position.z;
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 909a87cfd4b..ed3cf697a9e 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -305,26 +305,34 @@ const char *mesh_cmp(Mesh *me1, Mesh *me2, float thresh)
static void mesh_ensure_tessellation_customdata(Mesh *me)
{
- const int tottex_original = CustomData_number_of_layers(&me->pdata, CD_MTEXPOLY);
- const int totcol_original = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL);
+ if (UNLIKELY((me->totface != 0) && (me->totpoly == 0))) {
+ /* Pass, otherwise this function clears 'mface' before
+ * versioning 'mface -> mpoly' code kicks in [#30583]
+ *
+ * Callers could also check but safer to do here - campbell */
+ }
+ else {
+ const int tottex_original = CustomData_number_of_layers(&me->pdata, CD_MTEXPOLY);
+ const int totcol_original = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL);
- const int tottex_tessface = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
- const int totcol_tessface = CustomData_number_of_layers(&me->fdata, CD_MCOL);
+ const int tottex_tessface = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
+ const int totcol_tessface = CustomData_number_of_layers(&me->fdata, CD_MCOL);
- if (tottex_tessface != tottex_original ||
- totcol_tessface != totcol_original )
- {
- BKE_mesh_tessface_clear(me);
+ if (tottex_tessface != tottex_original ||
+ totcol_tessface != totcol_original )
+ {
+ BKE_mesh_tessface_clear(me);
- CustomData_from_bmeshpoly(&me->fdata, &me->pdata, &me->ldata, me->totface);
+ CustomData_from_bmeshpoly(&me->fdata, &me->pdata, &me->ldata, me->totface);
- /* note: this warning may be un-called for if we are inirializing the mesh for the
- * first time from bmesh, rather then giving a warning about this we could be smarter
- * and check if there was any data to begin with, for now just print the warning with
- * some info to help troubleshoot whats going on - campbell */
- printf("%s: warning! Tessellation uvs or vcol data got out of sync, "
- "had to reset!\n CD_MTFACE: %d != CD_MTEXPOLY: %d || CD_MCOL: %d != CD_MLOOPCOL: %d\n",
- __func__, tottex_tessface, tottex_original, totcol_tessface, totcol_original);
+ /* note: this warning may be un-called for if we are inirializing the mesh for the
+ * first time from bmesh, rather then giving a warning about this we could be smarter
+ * and check if there was any data to begin with, for now just print the warning with
+ * some info to help troubleshoot whats going on - campbell */
+ printf("%s: warning! Tessellation uvs or vcol data got out of sync, "
+ "had to reset!\n CD_MTFACE: %d != CD_MTEXPOLY: %d || CD_MCOL: %d != CD_MLOOPCOL: %d\n",
+ __func__, tottex_tessface, tottex_original, totcol_tessface, totcol_original);
+ }
}
}
@@ -332,7 +340,7 @@ static void mesh_ensure_tessellation_customdata(Mesh *me)
* mloopcol and mcol) have the same relative active/render/clone/mask indices.
*
* note that for undo mesh data we want to skip 'ensure_tess_cd' call since
- * we dont want to store memory for tessface when its only used for older
+ * we don't want to store memory for tessface when its only used for older
* versions of the mesh. - campbell*/
static void mesh_update_linked_customdata(Mesh *me, const short do_ensure_tess_cd)
{
@@ -546,7 +554,7 @@ BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob)
{
BMesh *bm;
- bm = BM_mesh_create(ob, &bm_mesh_allocsize_default);
+ bm = BM_mesh_create(&bm_mesh_allocsize_default);
BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", me, ob, TRUE);
@@ -1016,45 +1024,139 @@ void make_edges(Mesh *me, int old)
mesh_strip_loose_faces(me);
}
+/* We need to keep this for edge creation (for now?), and some old readfile code... */
void mesh_strip_loose_faces(Mesh *me)
{
- int a,b;
+ MFace *f;
+ int a, b;
- for (a=b=0; a<me->totface; a++) {
- if (me->mface[a].v3) {
- if (a!=b) {
- memcpy(&me->mface[b],&me->mface[a],sizeof(me->mface[b]));
+ for (a = b = 0, f = me->mface; a < me->totface; a++, f++) {
+ if (f->v3) {
+ if (a != b) {
+ memcpy(&me->mface[b], f, sizeof(me->mface[b]));
CustomData_copy_data(&me->fdata, &me->fdata, a, b, 1);
- CustomData_free_elem(&me->fdata, a, 1);
}
b++;
}
}
- me->totface = b;
+ if (a != b) {
+ CustomData_free_elem(&me->fdata, b, a - b);
+ me->totface = b;
+ }
+}
+
+/* Works on both loops and polys! */
+/* Note: It won't try to guess which loops of an invalid poly to remove!
+ * this is the work of the caller, to mark those loops...
+ * See e.g. BKE_mesh_validate_arrays(). */
+void mesh_strip_loose_polysloops(Mesh *me)
+{
+ MPoly *p;
+ MLoop *l;
+ int a, b;
+ /* New loops idx! */
+ int *new_idx = MEM_mallocN(sizeof(int) * me->totloop, "strip_loose_polysloops old2new idx mapping for polys.");
+
+ for (a = b = 0, p = me->mpoly; a < me->totpoly; a++, p++) {
+ int invalid = FALSE;
+ int i = p->loopstart;
+ int stop = i + p->totloop;
+
+ if (stop > me->totloop || stop < i) {
+ invalid = TRUE;
+ }
+ else {
+ l = &me->mloop[i];
+ i = stop - i;
+ /* If one of the poly's loops is invalid, the whole poly is invalid! */
+ for (; i--; l++) {
+ if (l->e == INVALID_LOOP_EDGE_MARKER) {
+ invalid = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (p->totloop >= 3 && !invalid) {
+ if (a != b) {
+ memcpy(&me->mpoly[b], p, sizeof(me->mpoly[b]));
+ CustomData_copy_data(&me->pdata, &me->pdata, a, b, 1);
+ }
+ b++;
+ }
+ }
+ if (a != b) {
+ CustomData_free_elem(&me->pdata, b, a - b);
+ me->totpoly = b;
+ }
+
+ /* And now, get rid of invalid loops. */
+ for (a = b = 0, l = me->mloop; a < me->totloop; a++, l++) {
+ if (l->e != INVALID_LOOP_EDGE_MARKER) {
+ if (a != b) {
+ memcpy(&me->mloop[b], l, sizeof(me->mloop[b]));
+ CustomData_copy_data(&me->ldata, &me->ldata, a, b, 1);
+ }
+ new_idx[a] = b;
+ b++;
+ }
+ else {
+ /* XXX Theorically, we should be able to not do this, as no remaining poly
+ * should use any stripped loop. But for security's sake... */
+ new_idx[a] = -a;
+ }
+ }
+ if (a != b) {
+ CustomData_free_elem(&me->ldata, b, a - b);
+ me->totloop = b;
+ }
+
+ /* And now, update polys' start loop index. */
+ /* Note: At this point, there should never be any poly using a striped loop! */
+ for (a = 0, p = me->mpoly; a < me->totpoly; a++, p++) {
+ p->loopstart = new_idx[p->loopstart];
+ }
}
void mesh_strip_loose_edges(Mesh *me)
{
- int a,b;
+ MEdge *e;
+ MLoop *l;
+ int a, b;
+ unsigned int *new_idx = MEM_mallocN(sizeof(int) * me->totedge, "strip_loose_edges old2new idx mapping for loops.");
- for (a=b=0; a<me->totedge; a++) {
- if (me->medge[a].v1!=me->medge[a].v2) {
- if (a!=b) {
- memcpy(&me->medge[b],&me->medge[a],sizeof(me->medge[b]));
+ for (a = b = 0, e = me->medge; a < me->totedge; a++, e++) {
+ if (e->v1 != e->v2) {
+ if (a != b) {
+ memcpy(&me->medge[b], e, sizeof(me->medge[b]));
CustomData_copy_data(&me->edata, &me->edata, a, b, 1);
- CustomData_free_elem(&me->edata, a, 1);
}
+ new_idx[a] = b;
b++;
}
+ else {
+ new_idx[a] = INVALID_LOOP_EDGE_MARKER;
+ }
+ }
+ if (a != b) {
+ CustomData_free_elem(&me->edata, b, a - b);
+ me->totedge = b;
+ }
+
+ /* And now, update loops' edge indices. */
+ /* XXX We hope no loop was pointing to a striped edge!
+ * Else, its e will be set to INVALID_LOOP_EDGE_MARKER :/ */
+ for (a = 0, l = me->mloop; a < me->totloop; a++, l++) {
+ l->e = new_idx[l->e];
}
- me->totedge = b;
}
void mball_to_mesh(ListBase *lb, Mesh *me)
{
DispList *dl;
MVert *mvert;
- MFace *mface;
+ MLoop *mloop, *allloop;
+ MPoly *mpoly;
float *nors, *verts;
int a, *index;
@@ -1062,13 +1164,14 @@ void mball_to_mesh(ListBase *lb, Mesh *me)
if (dl==NULL) return;
if (dl->type==DL_INDEX4) {
- me->totvert= dl->nr;
- me->totface= dl->parts;
-
mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, dl->nr);
- mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, dl->parts);
+ allloop= mloop= CustomData_add_layer(&me->ldata, CD_MLOOP, CD_CALLOC, NULL, dl->parts * 4);
+ mpoly= CustomData_add_layer(&me->pdata, CD_MPOLY, CD_CALLOC, NULL, dl->parts);
me->mvert= mvert;
- me->mface= mface;
+ me->mloop= mloop;
+ me->mpoly= mpoly;
+ me->totvert= dl->nr;
+ me->totpoly= dl->parts;
a= dl->nr;
nors= dl->nors;
@@ -1084,25 +1187,30 @@ void mball_to_mesh(ListBase *lb, Mesh *me)
a= dl->parts;
index= dl->index;
while (a--) {
- mface->v1= index[0];
- mface->v2= index[1];
- mface->v3= index[2];
- mface->v4= index[3];
- mface->flag= ME_SMOOTH;
+ int count= index[2] != index[3] ? 4 : 3;
+
+ mloop[0].v= index[0];
+ mloop[1].v= index[1];
+ mloop[2].v= index[2];
+ if (count == 4)
+ mloop[3].v= index[3];
- test_index_face(mface, NULL, 0, (mface->v3==mface->v4)? 3: 4);
+ mpoly->totloop= count;
+ mpoly->loopstart= (int)(mloop - allloop);
+ mpoly->flag= ME_SMOOTH;
- mface++;
+
+ mpoly++;
+ mloop+= count;
+ me->totloop+= count;
index+= 4;
}
- make_edges(me, 0); // all edges
-
+ mesh_update_customdata_pointers(me, TRUE);
- /* BMESH_TODO - low priority, should make polygons instead */
- convert_mfaces_to_mpolys(me);
+ mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL);
- mesh_update_customdata_pointers(me, TRUE);
+ BKE_mesh_calc_edges(me, TRUE);
}
}
@@ -1375,7 +1483,8 @@ void nurbs_to_mesh(Object *ob)
mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL);
BKE_mesh_calc_edges(me, TRUE);
- } else {
+ }
+ else {
me= add_mesh("Mesh");
DM_to_mesh(dm, me, ob);
}
@@ -1465,7 +1574,8 @@ void mesh_to_curve(Scene *scene, Object *ob)
BLI_edgehash_insert(eh, mf->v3, mf->v4, NULL);
if (!BLI_edgehash_haskey(eh, mf->v4, mf->v1))
BLI_edgehash_insert(eh, mf->v4, mf->v1, NULL);
- } else {
+ }
+ else {
if (!BLI_edgehash_haskey(eh, mf->v3, mf->v1))
BLI_edgehash_insert(eh, mf->v3, mf->v1, NULL);
}
@@ -1629,7 +1739,8 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth)
if (enableSmooth) {
mp->flag |= ME_SMOOTH;
- } else {
+ }
+ else {
mp->flag &= ~ME_SMOOTH;
}
}
@@ -1639,7 +1750,8 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth)
if (enableSmooth) {
mf->flag |= ME_SMOOTH;
- } else {
+ }
+ else {
mf->flag &= ~ME_SMOOTH;
}
}
@@ -1849,11 +1961,11 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex,
mloopcol = CustomData_get_n(&me->ldata, CD_MLOOPCOL, loopstart, i);
mcol = CustomData_get_n(&me->fdata, CD_MCOL, findex, i);
- mloopcol->r = mcol[0].r; mloopcol->g = mcol[0].g; mloopcol->b = mcol[0].b; mloopcol->a = mcol[0].a; mloopcol++;
- mloopcol->r = mcol[1].r; mloopcol->g = mcol[1].g; mloopcol->b = mcol[1].b; mloopcol->a = mcol[1].a; mloopcol++;
- mloopcol->r = mcol[2].r; mloopcol->g = mcol[2].g; mloopcol->b = mcol[2].b; mloopcol->a = mcol[2].a; mloopcol++;
+ MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[0]); mloopcol++;
+ MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[1]); mloopcol++;
+ MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[2]); mloopcol++;
if (mf->v4) {
- mloopcol->r = mcol[3].r; mloopcol->g = mcol[3].g; mloopcol->b = mcol[3].b; mloopcol->a = mcol[3].a; mloopcol++;
+ MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[3]); mloopcol++;
}
}
@@ -1877,6 +1989,7 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex,
for (i=0; i<tot; i++, disps += side*side, ld++) {
ld->totdisp = side*side;
+ ld->level = (int)(logf(side - 1.0f) / M_LN2) + 1;
if (ld->disps)
MEM_freeN(ld->disps);
@@ -1953,7 +2066,8 @@ void convert_mfaces_to_mpolys(Mesh *mesh)
if (mf->v4) {
ML(v3, v4);
ML(v4, v1);
- } else {
+ }
+ else {
ML(v3, v1);
}
@@ -1962,7 +2076,7 @@ void convert_mfaces_to_mpolys(Mesh *mesh)
bm_corners_to_loops(mesh, i, mp->loopstart, numTex, numCol);
}
- /* note, we dont convert FGons at all, these are not even real ngons,
+ /* note, we don't convert FGons at all, these are not even real ngons,
* they have their own UV's, colors etc - its more an editing feature. */
mesh_update_customdata_pointers(mesh, TRUE);
@@ -2095,25 +2209,43 @@ void free_uv_vert_map(UvVertMap *vmap)
/* Generates a map where the key is the vertex and the value is a list
* of polys that use that vertex as a corner. The lists are allocated
* from one memory pool. */
-void create_vert_poly_map(ListBase **map, IndexNode **mem,
- MPoly *mpoly, MLoop *mloop,
- const int totvert, const int totpoly, const int totloop)
+void create_vert_poly_map(MeshElemMap **map, int **mem,
+ const MPoly *mpoly, const MLoop *mloop,
+ int totvert, int totpoly, int totloop)
{
- int i,j;
- IndexNode *node = NULL;
- MPoly *mp;
- MLoop *ml;
+ int i, j;
+ int *indices;
- (*map) = MEM_callocN(sizeof(ListBase) * totvert, "vert face map");
- (*mem) = MEM_callocN(sizeof(IndexNode) * totloop, "vert poly map mem");
- node = *mem;
+ (*map) = MEM_callocN(sizeof(MeshElemMap) * totvert, "vert poly map");
+ (*mem) = MEM_mallocN(sizeof(int) * totloop, "vert poly map mem");
+ /* Count number of polys for each vertex */
+ for (i = 0; i < totpoly; i++) {
+ const MPoly *p = &mpoly[i];
+
+ for (j = 0; j < p->totloop; j++)
+ (*map)[mloop[p->loopstart + j].v].count++;
+ }
+
+ /* Assign indices mem */
+ indices = (*mem);
+ for (i = 0; i < totvert; i++) {
+ (*map)[i].indices = indices;
+ indices += (*map)[i].count;
+
+ /* Reset 'count' for use as index in last loop */
+ (*map)[i].count = 0;
+ }
+
/* Find the users */
- for (i = 0, mp = mpoly; i < totpoly; ++i, ++mp) {
- ml = &mloop[mp->loopstart];
- for (j = 0; j < mp->totloop; ++j, ++node, ++ml) {
- node->index = i;
- BLI_addtail(&(*map)[ml->v], node);
+ for (i = 0; i < totpoly; i++) {
+ const MPoly *p = &mpoly[i];
+
+ for (j = 0; j < p->totloop; j++) {
+ int v = mloop[p->loopstart + j].v;
+
+ (*map)[v].indices[(*map)[v].count] = i;
+ (*map)[v].count++;
}
}
}
@@ -2147,7 +2279,7 @@ void mesh_loops_to_mface_corners(CustomData *fdata, CustomData *ldata,
/* cache values to avoid lookups every time */
const int numTex, /* CustomData_number_of_layers(pdata, CD_MTEXPOLY) */
const int numCol, /* CustomData_number_of_layers(ldata, CD_MLOOPCOL) */
- const int hasWCol, /* CustomData_has_layer(ldata, CD_WEIGHT_MLOOPCOL) */
+ const int hasPCol, /* CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL) */
const int hasOrigSpace /* CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP) */
)
{
@@ -2175,22 +2307,16 @@ void mesh_loops_to_mface_corners(CustomData *fdata, CustomData *ldata,
for (j=0; j < mf_len; j++) {
mloopcol = CustomData_get_n(ldata, CD_MLOOPCOL, lindex[j], i);
- mcol[j].r = mloopcol->r;
- mcol[j].g = mloopcol->g;
- mcol[j].b = mloopcol->b;
- mcol[j].a = mloopcol->a;
+ MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
}
}
- if (hasWCol) {
- mcol = CustomData_get(fdata, findex, CD_WEIGHT_MCOL);
+ if (hasPCol) {
+ mcol = CustomData_get(fdata, findex, CD_PREVIEW_MCOL);
for (j=0; j < mf_len; j++) {
- mloopcol = CustomData_get(ldata, lindex[j], CD_WEIGHT_MLOOPCOL);
- mcol[j].r = mloopcol->r;
- mcol[j].g = mloopcol->g;
- mcol[j].b = mloopcol->b;
- mcol[j].a = mloopcol->a;
+ mloopcol = CustomData_get(ldata, lindex[j], CD_PREVIEW_MLOOPCOL);
+ MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
}
}
@@ -2200,8 +2326,7 @@ void mesh_loops_to_mface_corners(CustomData *fdata, CustomData *ldata,
for (j=0; j < mf_len; j++) {
lof = CustomData_get(ldata, lindex[j], CD_ORIGSPACE_MLOOP);
- of->uv[j][0] = lof->uv[0];
- of->uv[j][1] = lof->uv[1];
+ copy_v2_v2(of->uv[j], lof->uv);
}
}
}
@@ -2214,7 +2339,7 @@ int mesh_recalcTessellation(CustomData *fdata,
CustomData *ldata, CustomData *pdata,
MVert *mvert, int totface, int UNUSED(totloop),
int totpoly,
- /* when tessellating to recalcilate normals after
+ /* when tessellating to recalculate normals after
* we can skip copying here */
const int do_face_nor_cpy)
{
@@ -2244,7 +2369,7 @@ int mesh_recalcTessellation(CustomData *fdata,
const int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
- const int hasWCol = CustomData_has_layer(ldata, CD_WEIGHT_MLOOPCOL);
+ const int hasPCol = CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL);
const int hasOrigSpace = CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP);
mpoly = CustomData_get_layer(pdata, CD_MPOLY);
@@ -2394,12 +2519,12 @@ int mesh_recalcTessellation(CustomData *fdata,
CustomData_add_layer(fdata, CD_MFACE, CD_ASSIGN, mface, totface);
/* CD_POLYINDEX will contain an array of indices from tessfaces to the polygons
- * they are directly tesselated from */
+ * they are directly tessellated from */
CustomData_add_layer(fdata, CD_POLYINDEX, CD_ASSIGN, mface_to_poly_map, totface);
if (mface_orig_index) {
- /* If polys had a CD_ORIGINDEX layer, then the tesselated faces will get this
+ /* If polys had a CD_ORIGINDEX layer, then the tessellated faces will get this
* layer as well, pointing to polys from the original mesh (not the polys
- * that just got tesselated) */
+ * that just got tessellated) */
CustomData_add_layer(fdata, CD_ORIGINDEX, CD_ASSIGN, mface_orig_index, totface);
}
@@ -2467,7 +2592,7 @@ int mesh_recalcTessellation(CustomData *fdata,
#else
3,
#endif
- numTex, numCol, hasWCol, hasOrigSpace);
+ numTex, numCol, hasPCol, hasOrigSpace);
#ifdef USE_TESSFACE_QUADS
@@ -2504,7 +2629,7 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
const int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
- const int hasWCol = CustomData_has_layer(ldata, CD_WEIGHT_MLOOPCOL);
+ const int hasPCol = CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL);
const int hasOrigSpace = CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP);
mpoly = CustomData_get_layer(pdata, CD_MPOLY);
@@ -2563,7 +2688,7 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
mesh_loops_to_mface_corners(fdata, ldata, pdata,
lindex, k, i, 3,
- numTex, numCol, hasWCol, hasOrigSpace);
+ numTex, numCol, hasPCol, hasOrigSpace);
test_index_face(mf, fdata, k, 3);
}
else {
@@ -2583,7 +2708,7 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
mesh_loops_to_mface_corners(fdata, ldata, pdata,
lindex, k, i, 4,
- numTex, numCol, hasWCol, hasOrigSpace);
+ numTex, numCol, hasPCol, hasOrigSpace);
test_index_face(mf, fdata, k, 4);
}
@@ -2656,7 +2781,8 @@ static void mesh_calc_ngon_normal(MPoly *mpoly, MLoop *loopstart,
normal[2] = 1.0f;
return;
- } else l = 1.0f / l;
+ }
+ else l = 1.0f / l;
n[0] *= l;
n[1] *= l;
@@ -2734,7 +2860,10 @@ static void mesh_calc_ngon_normal_coords(MPoly *mpoly, MLoop *loopstart,
normal[2] = 1.0f;
return;
- } else l = 1.0f / l;
+ }
+ else {
+ l = 1.0f / l;
+ }
n[0] *= l;
n[1] *= l;
@@ -2876,7 +3005,7 @@ int poly_get_adj_loops_from_vert(unsigned adj_r[3], const MPoly *poly,
&mloop[poly->loopstart],
vert);
- if(corner != -1) {
+ if (corner != -1) {
const MLoop *ml = &mloop[poly->loopstart + corner];
/* vertex was found */
@@ -2888,6 +3017,33 @@ int poly_get_adj_loops_from_vert(unsigned adj_r[3], const MPoly *poly,
return corner;
}
+/* update the hide flag for edges and faces from the corresponding
+ flag in verts */
+void mesh_flush_hidden_from_verts(const MVert *mvert,
+ const MLoop *mloop,
+ MEdge *medge, int totedge,
+ MPoly *mpoly, int totpoly)
+{
+ int i, j;
+
+ for (i = 0; i < totedge; i++) {
+ MEdge *e = &medge[i];
+ if (mvert[e->v1].flag & ME_HIDE ||
+ mvert[e->v2].flag & ME_HIDE)
+ e->flag |= ME_HIDE;
+ else
+ e->flag &= ~ME_HIDE;
+ }
+ for (i = 0; i < totpoly; i++) {
+ MPoly *p = &mpoly[i];
+ p->flag &= ~ME_HIDE;
+ for (j = 0; j < p->totloop; j++) {
+ if (mvert[mloop[p->loopstart + j].v].flag & ME_HIDE)
+ p->flag |= ME_HIDE;
+ }
+ }
+}
+
/* basic vertex data functions */
int minmax_mesh(Mesh *me, float min[3], float max[3])
{
@@ -2953,7 +3109,7 @@ void BKE_mesh_ensure_navmesh(Mesh *me)
if (!CustomData_has_layer(&me->pdata, CD_RECAST)) {
int i;
int numFaces = me->totpoly;
- int* recastData;
+ int *recastData;
CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData");
recastData = (int*)CustomData_get_layer(&me->pdata, CD_RECAST);
for (i=0; i<numFaces; i++) {
@@ -2968,7 +3124,7 @@ void BKE_mesh_tessface_calc(Mesh *mesh)
mesh->totface = mesh_recalcTessellation(&mesh->fdata, &mesh->ldata, &mesh->pdata,
mesh->mvert,
mesh->totface, mesh->totloop, mesh->totpoly,
- /* calc normals right after, dont copy from polys here */
+ /* calc normals right after, don't copy from polys here */
FALSE);
mesh_update_customdata_pointers(mesh, TRUE);
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index fbd7a5fb47b..cd49002a351 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -33,111 +33,91 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
#include "BLO_sys_types.h"
-#include "BLI_utildefines.h"
#include "BLI_edgehash.h"
#include "BLI_math_base.h"
+#include "BLI_utildefines.h"
+#include "BKE_deform.h"
+#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
+#include "BKE_mesh.h"
#include "MEM_guardedalloc.h"
-#include "BKE_mesh.h"
-#include "BKE_deform.h"
-
#define SELECT 1
-typedef union {
- uint32_t verts[2];
- int64_t edval;
-} EdgeUUID;
-
-typedef struct SortFace {
-// unsigned int v[4];
- EdgeUUID es[4];
- unsigned int index;
-} SortFace;
-
-static void edge_store_assign(uint32_t verts[2], const uint32_t v1, const uint32_t v2)
+/* Used to detect polys (faces) using exactly the same vertices. */
+/* Used to detect loops used by no (disjoint) or more than one (intersect) polys. */
+typedef struct SortPoly {
+ int *verts;
+ int numverts;
+ int loopstart;
+ unsigned int index;
+ int invalid; /* Poly index. */
+} SortPoly;
+
+/* TODO check there is not some standard define of this somewhere! */
+static int int_cmp(const void *v1, const void *v2)
{
- if(v1 < v2) {
- verts[0]= v1;
- verts[1]= v2;
- }
- else {
- verts[0]= v2;
- verts[1]= v1;
- }
+ return *(int*)v1 > *(int*)v2 ? 1 : *(int*)v1 < *(int*)v2 ? -1 : 0;
}
-static void edge_store_from_mface_quad(EdgeUUID es[4], MFace *mf)
+static int search_poly_cmp(const void *v1, const void *v2)
{
- edge_store_assign(es[0].verts, mf->v1, mf->v2);
- edge_store_assign(es[1].verts, mf->v2, mf->v3);
- edge_store_assign(es[2].verts, mf->v3, mf->v4);
- edge_store_assign(es[3].verts, mf->v4, mf->v1);
+ const SortPoly *sp1 = v1, *sp2 = v2;
+ const int max_idx = sp1->numverts > sp2->numverts ? sp2->numverts : sp1->numverts;
+ int idx = 0;
+
+ /* Reject all invalid polys at end of list! */
+ if (sp1->invalid || sp2->invalid)
+ return sp1->invalid && sp2->invalid ? 0 : sp1->invalid ? 1 : -1;
+ /* Else, sort on first non-egal verts (remember verts of valid polys are sorted). */
+ while (idx < max_idx && sp1->verts[idx] == sp2->verts[idx])
+ idx++;
+ return sp1->verts[idx] > sp2->verts[idx] ? 1 : sp1->verts[idx] < sp2->verts[idx] ? -1 :
+ sp1->numverts > sp2->numverts ? 1 : sp1->numverts < sp2->numverts ? -1 : 0;
}
-static void edge_store_from_mface_tri(EdgeUUID es[4], MFace *mf)
+static int search_polyloop_cmp(const void *v1, const void *v2)
{
- edge_store_assign(es[0].verts, mf->v1, mf->v2);
- edge_store_assign(es[1].verts, mf->v2, mf->v3);
- edge_store_assign(es[2].verts, mf->v3, mf->v1);
- es[3].verts[0] = es[3].verts[1] = UINT_MAX;
-}
-
-static int int64_cmp(const void *v1, const void *v2)
-{
- const int64_t x1= *(const int64_t *)v1;
- const int64_t x2= *(const int64_t *)v2;
-
- if( x1 > x2 ) return 1;
- else if( x1 < x2 ) return -1;
- return 0;
-}
-
-static int search_face_cmp(const void *v1, const void *v2)
-{
- const SortFace *sfa= v1, *sfb= v2;
-
- if (sfa->es[0].edval > sfb->es[0].edval) return 1;
- else if (sfa->es[0].edval < sfb->es[0].edval) return -1;
-
- else if (sfa->es[1].edval > sfb->es[1].edval) return 1;
- else if (sfa->es[1].edval < sfb->es[1].edval) return -1;
-
- else if (sfa->es[2].edval > sfb->es[2].edval) return 1;
- else if (sfa->es[2].edval < sfb->es[2].edval) return -1;
-
- else if (sfa->es[3].edval > sfb->es[3].edval) return 1;
- else if (sfa->es[3].edval < sfb->es[3].edval) return -1;
- else return 0;
+ const SortPoly *sp1 = v1, *sp2 = v2;
+ /* Reject all invalid polys at end of list! */
+ if (sp1->invalid || sp2->invalid)
+ return sp1->invalid && sp2->invalid ? 0 : sp1->invalid ? 1 : -1;
+ /* Else, sort on loopstart. */
+ return sp1->loopstart > sp2->loopstart ? 1 : sp1->loopstart < sp2->loopstart ? -1 : 0;
}
-#define PRINT if(do_verbose) printf
+#define PRINT if (do_verbose) printf
-int BKE_mesh_validate_arrays( Mesh *me,
- MVert *mverts, unsigned int totvert,
- MEdge *medges, unsigned int totedge,
- MFace *mfaces, unsigned int totface,
- MDeformVert *dverts, /* assume totvert length */
- const short do_verbose, const short do_fixes)
+int BKE_mesh_validate_arrays(Mesh *mesh,
+ MVert *mverts, unsigned int totvert,
+ MEdge *medges, unsigned int totedge,
+ MLoop *mloops, unsigned int totloop,
+ MPoly *mpolys, unsigned int totpoly,
+ MDeformVert *dverts, /* assume totvert length */
+ const short do_verbose, const short do_fixes)
{
-# define REMOVE_EDGE_TAG(_med) { _med->v2= _med->v1; do_edge_free= 1; }
-# define REMOVE_FACE_TAG(_mf) { _mf->v3=0; do_face_free= 1; }
+# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; }
+# define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1)
+
+# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; }
+# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; }
-// MVert *mv;
- MEdge *med;
- MFace *mf;
- MFace *mf_prev;
- MVert *mvert= mverts;
- unsigned int i;
+ MVert *mv = mverts;
+ MEdge *me;
+ MLoop *ml;
+ MPoly *mp;
+ unsigned int i, j;
+ int *v;
- short do_face_free= FALSE;
short do_edge_free= FALSE;
+ short do_polyloop_free= FALSE; /* This regroups loops and polys! */
short verts_fixed= FALSE;
short vert_weights_fixed= FALSE;
@@ -146,189 +126,356 @@ int BKE_mesh_validate_arrays( Mesh *me,
EdgeHash *edge_hash = BLI_edgehash_new();
- SortFace *sort_faces= MEM_callocN(sizeof(SortFace) * totface, "search faces");
- SortFace *sf;
- SortFace *sf_prev;
- unsigned int totsortface= 0;
-
- BLI_assert(!(do_fixes && me == NULL));
+ BLI_assert(!(do_fixes && mesh == NULL));
- PRINT("%s: verts(%u), edges(%u), faces(%u)\n", __func__, totvert, totedge, totface);
+ PRINT("%s: verts(%u), edges(%u), loops(%u), polygons(%u)\n",
+ __func__, totvert, totedge, totloop, totpoly);
- if(totedge == 0 && totface != 0) {
- PRINT(" locical error, %u faces and 0 edges\n", totface);
- do_edge_recalc= TRUE;
+ if (totedge == 0 && totpoly != 0) {
+ PRINT(" logical error, %u polygons and 0 edges\n", totpoly);
+ do_edge_recalc = do_fixes;
}
- for(i=1; i<totvert; i++, mvert++) {
+ for (i=1; i<totvert; i++, mv++) {
int j;
int fix_normal= TRUE;
- for(j=0; j<3; j++) {
- if(!finite(mvert->co[j])) {
+ for (j=0; j<3; j++) {
+ if (!finite(mv->co[j])) {
PRINT(" vertex %u: has invalid coordinate\n", i);
if (do_fixes) {
- zero_v3(mvert->co);
+ zero_v3(mv->co);
verts_fixed= TRUE;
}
}
- if(mvert->no[j]!=0)
+ if (mv->no[j]!=0)
fix_normal= FALSE;
}
- if(fix_normal) {
+ if (fix_normal) {
PRINT(" vertex %u: has zero normal, assuming Z-up normal\n", i);
if (do_fixes) {
- mvert->no[2]= SHRT_MAX;
+ mv->no[2]= SHRT_MAX;
verts_fixed= TRUE;
}
}
}
- for(i=0, med= medges; i<totedge; i++, med++) {
+ for (i=0, me= medges; i<totedge; i++, me++) {
int remove= FALSE;
- if(med->v1 == med->v2) {
- PRINT(" edge %u: has matching verts, both %u\n", i, med->v1);
+ if (me->v1 == me->v2) {
+ PRINT(" edge %u: has matching verts, both %u\n", i, me->v1);
remove= do_fixes;
}
- if(med->v1 >= totvert) {
- PRINT(" edge %u: v1 index out of range, %u\n", i, med->v1);
+ if (me->v1 >= totvert) {
+ PRINT(" edge %u: v1 index out of range, %u\n", i, me->v1);
remove= do_fixes;
}
- if(med->v2 >= totvert) {
- PRINT(" edge %u: v2 index out of range, %u\n", i, med->v2);
+ if (me->v2 >= totvert) {
+ PRINT(" edge %u: v2 index out of range, %u\n", i, me->v2);
remove= do_fixes;
}
- if(BLI_edgehash_haskey(edge_hash, med->v1, med->v2)) {
- PRINT(" edge %u: is a duplicate of, %d\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2)));
+ if (BLI_edgehash_haskey(edge_hash, me->v1, me->v2)) {
+ PRINT(" edge %u: is a duplicate of %d\n", i,
+ GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, me->v1, me->v2)));
remove= do_fixes;
}
- if(remove == FALSE) {
- BLI_edgehash_insert(edge_hash, med->v1, med->v2, SET_INT_IN_POINTER(i));
+ if (remove == FALSE) {
+ BLI_edgehash_insert(edge_hash, me->v1, me->v2, SET_INT_IN_POINTER(i));
}
else {
- REMOVE_EDGE_TAG(med);
+ REMOVE_EDGE_TAG(me);
}
}
- for(i=0, mf=mfaces, sf=sort_faces; i<totface; i++, mf++) {
- int remove= FALSE;
- int fidx;
- unsigned int fv[4];
-
- fidx = mf->v4 ? 3:2;
- do {
- fv[fidx]= *(&(mf->v1) + fidx);
- if(fv[fidx] >= totvert) {
- PRINT(" face %u: 'v%d' index out of range, %u\n", i, fidx + 1, fv[fidx]);
- remove= do_fixes;
+ /* Checking loops and polys is a bit tricky, as they are quite intricated...
+ *
+ * Polys must have:
+ * - a valid loopstart value.
+ * - a valid totloop value (>= 3 and loopstart+totloop < me.totloop).
+ *
+ * Loops must have:
+ * - a valid v value.
+ * - a valid e value (corresponding to the edge it defines with the next loop in poly).
+ *
+ * Also, loops not used by polys can be discarded.
+ * And "intersecting" loops (i.e. loops used by more than one poly) are invalid,
+ * so be sure to leave at most one poly/loop!
+ */
+ {
+ SortPoly *sort_polys = MEM_callocN(sizeof(SortPoly) * totpoly, "mesh validate's sort_polys");
+ SortPoly *prev_sp, *sp = sort_polys;
+ int prev_end;
+ for (i = 0, mp = mpolys; i < totpoly; i++, mp++, sp++) {
+ sp->index = i;
+
+ if (mp->loopstart < 0 || mp->totloop < 3) {
+ /* Invalid loop data. */
+ PRINT(" poly %u is invalid (loopstart: %u, totloop: %u)\n", sp->index, mp->loopstart, mp->totloop);
+ sp->invalid = TRUE;
}
- } while (fidx--);
-
- if(remove == FALSE) {
- if(mf->v4) {
- if(mf->v1 == mf->v2) { PRINT(" face %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; }
- if(mf->v1 == mf->v3) { PRINT(" face %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes; }
- if(mf->v1 == mf->v4) { PRINT(" face %u: verts invalid, v1/v4 both %u\n", i, mf->v1); remove= do_fixes; }
-
- if(mf->v2 == mf->v3) { PRINT(" face %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes; }
- if(mf->v2 == mf->v4) { PRINT(" face %u: verts invalid, v2/v4 both %u\n", i, mf->v2); remove= do_fixes; }
-
- if(mf->v3 == mf->v4) { PRINT(" face %u: verts invalid, v3/v4 both %u\n", i, mf->v3); remove= do_fixes; }
+ else if (mp->loopstart + mp->totloop > totloop) {
+ /* Invalid loop data. */
+ PRINT(" poly %u uses loops out of range (loopstart: %u, loopend: %u, max nbr of loops: %u)\n",
+ sp->index, mp->loopstart, mp->loopstart + mp->totloop - 1, totloop - 1);
+ sp->invalid = TRUE;
}
else {
- if(mf->v1 == mf->v2) { PRINT(" faceT %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; }
- if(mf->v1 == mf->v3) { PRINT(" faceT %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes; }
-
- if(mf->v2 == mf->v3) { PRINT(" faceT %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes; }
- }
+ /* Poly itself is valid, for now. */
+ int v1, v2; /* v1 is prev loop vert idx, v2 is current loop one. */
+ sp->invalid = FALSE;
+ sp->verts = v = MEM_mallocN(sizeof(int) * mp->totloop, "Vert idx of SortPoly");
+ sp->numverts = mp->totloop;
+ sp->loopstart = mp->loopstart;
+
+ /* Test all poly's loops' vert idx. */
+ for (j = 0, ml = &mloops[sp->loopstart]; j < mp->totloop; j++, ml++, v++) {
+ if (ml->v >= totvert) {
+ /* Invalid vert idx. */
+ PRINT(" loop %u has invalid vert reference (%u)\n", sp->loopstart + j, ml->v);
+ sp->invalid = TRUE;
+ }
+ *v = ml->v;
+ }
- if(remove == FALSE) {
- if(totedge) {
- if(mf->v4) {
- if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %u: edge v1/v2 (%u,%u) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
- if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %u: edge v2/v3 (%u,%u) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
- if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v4)) { PRINT(" face %u: edge v3/v4 (%u,%u) is missing egde data\n", i, mf->v3, mf->v4); do_edge_recalc= TRUE; }
- if(!BLI_edgehash_haskey(edge_hash, mf->v4, mf->v1)) { PRINT(" face %u: edge v4/v1 (%u,%u) is missing egde data\n", i, mf->v4, mf->v1); do_edge_recalc= TRUE; }
+ if (sp->invalid)
+ continue;
+
+ /* Test all poly's loops. */
+ for (j = 0, ml = &mloops[sp->loopstart]; j < mp->totloop; j++, ml++) {
+ v1 = ml->v;
+ v2 = mloops[sp->loopstart + (j + 1) % mp->totloop].v;
+ if (!BLI_edgehash_haskey(edge_hash, v1, v2)) {
+ /* Edge not existing. */
+ PRINT(" poly %u needs missing edge (%u, %u)\n", sp->index, v1, v2);
+ if (do_fixes)
+ do_edge_recalc = TRUE;
+ else
+ sp->invalid = TRUE;
+ }
+ else if (ml->e >= totedge) {
+ /* Invalid edge idx.
+ * We already know from previous text that a valid edge exists, use it (if allowed)! */
+ if (do_fixes) {
+ int prev_e = ml->e;
+ ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2));
+ PRINT(" loop %u has invalid edge reference (%u), fixed using edge %u\n",
+ sp->loopstart + j, prev_e, ml->e);
+ }
+ else {
+ PRINT(" loop %u has invalid edge reference (%u)\n", sp->loopstart + j, ml->e);
+ sp->invalid = TRUE;
+ }
}
else {
- if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %u: edge v1/v2 (%u,%u) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
- if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %u: edge v2/v3 (%u,%u) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
- if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v1)) { PRINT(" face %u: edge v3/v1 (%u,%u) is missing egde data\n", i, mf->v3, mf->v1); do_edge_recalc= TRUE; }
+ me = &medges[ml->e];
+ if (IS_REMOVED_EDGE(me) || !((me->v1 == v1 && me->v2 == v2) || (me->v1 == v2 && me->v2 == v1))) {
+ /* The pointed edge is invalid (tagged as removed, or vert idx mismatch),
+ * and we already know from previous test that a valid one exists, use it (if allowed)! */
+ if (do_fixes) {
+ int prev_e = ml->e;
+ ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2));
+ PRINT(" poly %u has invalid edge reference (%u), fixed using edge %u\n",
+ sp->index, prev_e, ml->e);
+ }
+ else {
+ PRINT(" poly %u has invalid edge reference (%u)\n", sp->index, ml->e);
+ sp->invalid = TRUE;
+ }
+ }
}
}
- sf->index = i;
-
- if(mf->v4) {
- edge_store_from_mface_quad(sf->es, mf);
+ /* Now check that that poly does not use a same vertex more than once! */
+ if (!sp->invalid) {
+ int *prev_v = v = sp->verts;
+ j = sp->numverts;
+
+ qsort(sp->verts, j, sizeof(int), int_cmp);
+
+ for (j--, v++; j; j--, v++) {
+ if (*v != *prev_v) {
+ int dlt = v - prev_v;
+ if (dlt > 1) {
+ PRINT(" poly %u is invalid, it multi-uses vertex %u (%u times)\n",
+ sp->index, *prev_v, dlt);
+ sp->invalid = TRUE;
+ }
+ prev_v = v;
+ }
+ }
+ if (v - prev_v > 1) { /* Don’t forget final verts! */
+ PRINT(" poly %u is invalid, it multi-uses vertex %u (%u times)\n",
+ sp->index, *prev_v, (int)(v - prev_v));
+ sp->invalid = TRUE;
+ }
+ }
+
+ }
+ }
- qsort(sf->es, 4, sizeof(int64_t), int64_cmp);
+ /* Second check pass, testing polys using the same verts. */
+ qsort(sort_polys, totpoly, sizeof(SortPoly), search_poly_cmp);
+ sp = prev_sp = sort_polys;
+ sp++;
+
+ for (i = 1; i < totpoly; i++, sp++) {
+ int p1_nv = sp->numverts, p2_nv = prev_sp->numverts;
+ int *p1_v = sp->verts, *p2_v = prev_sp->verts;
+ short p1_sub = TRUE, p2_sub = TRUE;
+ if (sp->invalid)
+ break;
+ /* Test same polys. */
+#if 0
+ /* NOTE: This performs a sub-set test. */
+ /* XXX This (and the sort of verts list) is better than systematic
+ * search of all verts of one list into the other if lists have
+ * a fair amount of elements.
+ * Not sure however it's worth it in this case?
+ * But as we also need sorted vert list to check verts multi-used
+ * (in first pass of checks)... */
+ /* XXX If we consider only "equal" polys (i.e. using exactly same set of verts)
+ * as invalid, better to replace this by a simple memory cmp... */
+ while ((p1_nv && p2_nv) && (p1_sub || p2_sub)) {
+ if (*p1_v < *p2_v) {
+ if (p1_sub)
+ p1_sub = FALSE;
+ p1_nv--;
+ p1_v++;
+ }
+ else if (*p2_v < *p1_v) {
+ if (p2_sub)
+ p2_sub = FALSE;
+ p2_nv--;
+ p2_v++;
}
else {
- edge_store_from_mface_tri(sf->es, mf);
- qsort(sf->es, 3, sizeof(int64_t), int64_cmp);
+ /* Equality, both next verts. */
+ p1_nv--;
+ p2_nv--;
+ p1_v++;
+ p2_v++;
}
-
- totsortface++;
- sf++;
+ }
+ if (p1_nv && p1_sub)
+ p1_sub = FALSE;
+ else if (p2_nv && p2_sub)
+ p2_sub = FALSE;
+
+ if (p1_sub && p2_sub) {
+ PRINT(" polys %u and %u use same vertices, considering poly %u as invalid.\n",
+ prev_sp->index, sp->index, sp->index);
+ sp->invalid = TRUE;
+ }
+ /* XXX In fact, these might be valid? :/ */
+ else if (p1_sub) {
+ PRINT(" %u is a sub-poly of %u, considering it as invalid.\n", sp->index, prev_sp->index);
+ sp->invalid = TRUE;
+ }
+ else if (p2_sub) {
+ PRINT(" %u is a sub-poly of %u, considering it as invalid.\n", prev_sp->index, sp->index);
+ prev_sp->invalid = TRUE;
+ prev_sp = sp; /* sp is new reference poly. */
+ }
+#else
+ if (0) {
+ p1_sub += 0;
+ p2_sub += 0;
+ }
+ if ((p1_nv == p2_nv) && (memcmp(p1_v, p2_v, p1_nv * sizeof(*p1_v)) == 0)) {
+ if (do_verbose) {
+ PRINT(" polys %u and %u use same vertices (%u",
+ prev_sp->index, sp->index, *p1_v);
+ for (j = 1; j < p1_nv; j++)
+ PRINT(", %u", p1_v[j]);
+ PRINT("), considering poly %u as invalid.\n", sp->index);
+ }
+ sp->invalid = TRUE;
+ }
+#endif
+ else {
+ prev_sp = sp;
}
}
- if(remove) {
- REMOVE_FACE_TAG(mf);
- }
- }
-
- qsort(sort_faces, totsortface, sizeof(SortFace), search_face_cmp);
- sf= sort_faces;
- sf_prev= sf;
- sf++;
-
- for(i=1; i<totsortface; i++, sf++) {
- int remove= FALSE;
- /* on a valid mesh, code below will never run */
- if(memcmp(sf->es, sf_prev->es, sizeof(sf_prev->es)) == 0) {
- mf= mfaces + sf->index;
-
- if(do_verbose) {
- mf_prev= mfaces + sf_prev->index;
- if(mf->v4) {
- PRINT(" face %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4, mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4);
+ /* Third check pass, testing loops used by none or more than one poly. */
+ qsort(sort_polys, totpoly, sizeof(SortPoly), search_polyloop_cmp);
+ sp = sort_polys;
+ prev_sp = NULL;
+ prev_end = 0;
+ for (i = 0; i < totpoly; i++, sp++) {
+ /* Free this now, we don't need it anymore, and avoid us another loop! */
+ if (sp->verts)
+ MEM_freeN(sp->verts);
+
+ /* Note above prev_sp: in following code, we make sure it is always valid poly (or NULL). */
+ if (sp->invalid) {
+ if (do_fixes) {
+ REMOVE_POLY_TAG((&mpolys[sp->index]));
+ /* DO NOT REMOVE ITS LOOPS!!!
+ * As already invalid polys are at the end of the SortPoly list, the loops they
+ * were the only users have already been tagged as "to remove" during previous
+ * iterations, and we don’t want to remove some loops that may be used by
+ * another valid poly! */
+ }
+ }
+ /* Test loops users. */
+ else {
+ /* Unused loops. */
+ if (prev_end < sp->loopstart) {
+ for (j = prev_end, ml = &mloops[prev_end]; j < sp->loopstart; j++, ml++) {
+ PRINT(" loop %u is unused.\n", j);
+ if (do_fixes)
+ REMOVE_LOOP_TAG(ml);
+ }
+ prev_end = sp->loopstart + sp->numverts;
+ prev_sp = sp;
+ }
+ /* Multi-used loops. */
+ else if (prev_end > sp->loopstart) {
+ PRINT(" polys %u and %u share loops from %u to %u, considering poly %u as invalid.\n",
+ prev_sp->index, sp->index, sp->loopstart, prev_end, sp->index);
+ if (do_fixes) {
+ REMOVE_POLY_TAG((&mpolys[sp->index]));
+ /* DO NOT REMOVE ITS LOOPS!!!
+ * They might be used by some next, valid poly!
+ * Just not updating prev_end/prev_sp vars is enough to ensure the loops
+ * effectively no more needed will be marked as "to be removed"! */
+ }
}
else {
- PRINT(" face %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf_prev->v1, mf_prev->v2, mf_prev->v3);
+ prev_end = sp->loopstart + sp->numverts;
+ prev_sp = sp;
}
}
-
- remove= do_fixes;
}
- else {
- sf_prev= sf;
+ /* We may have some remaining unused loops to get rid of! */
+ if (prev_end < totloop) {
+ for (j = prev_end, ml = &mloops[prev_end]; j < totloop; j++, ml++) {
+ PRINT(" loop %u is unused.\n", j);
+ if (do_fixes)
+ REMOVE_LOOP_TAG(ml);
+ }
}
- if(remove) {
- REMOVE_FACE_TAG(mf);
- }
+ MEM_freeN(sort_polys);
}
BLI_edgehash_free(edge_hash, NULL);
- MEM_freeN(sort_faces);
-
/* fix deform verts */
if (dverts) {
MDeformVert *dv;
- for(i=0, dv= dverts; i<totvert; i++, dv++) {
+ for (i=0, dv= dverts; i<totvert; i++, dv++) {
MDeformWeight *dw;
unsigned int j;
- for(j=0, dw= dv->dw; j < dv->totweight; j++, dw++) {
+ for (j=0, dw= dv->dw; j < dv->totweight; j++, dw++) {
/* note, greater then max defgroups is accounted for in our code, but not < 0 */
if (!finite(dw->weight)) {
PRINT(" vertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight);
@@ -366,49 +513,50 @@ int BKE_mesh_validate_arrays( Mesh *me,
}
}
-
PRINT("BKE_mesh_validate: finished\n\n");
-# undef REMOVE_EDGE_TAG
-# undef REMOVE_FACE_TAG
+# undef REMOVE_EDGE_TAG
+# undef IS_REMOVED_EDGE
+# undef REMOVE_LOOP_TAG
+# undef REMOVE_POLY_TAG
- if(me) {
- if(do_face_free) {
- mesh_strip_loose_faces(me);
+ if (mesh) {
+ if (do_polyloop_free) {
+ mesh_strip_loose_polysloops(mesh);
}
if (do_edge_free) {
- mesh_strip_loose_edges(me);
+ mesh_strip_loose_edges(mesh);
}
- if(do_fixes && do_edge_recalc) {
- BKE_mesh_calc_edges(me, TRUE);
+ if (do_edge_recalc) {
+ BKE_mesh_calc_edges(mesh, TRUE);
}
}
- return (verts_fixed || vert_weights_fixed || do_face_free || do_edge_free || do_edge_recalc);
+ return (verts_fixed || vert_weights_fixed || do_polyloop_free || do_edge_free || do_edge_recalc);
}
static int mesh_validate_customdata(CustomData *data, short do_verbose, const short do_fixes)
{
int i= 0, has_fixes= 0;
- while(i<data->totlayer) {
+ while (i<data->totlayer) {
CustomDataLayer *layer= &data->layers[i];
CustomDataMask mask= CD_TYPE_AS_MASK(layer->type);
int ok= 1;
- if((mask&CD_MASK_MESH)==0) {
+ if ((mask&CD_MASK_MESH)==0) {
PRINT("CustomDataLayer type %d which isn't in CD_MASK_MESH is stored in Mehs structure\n", layer->type);
- if(do_fixes) {
+ if (do_fixes) {
CustomData_free_layer(data, layer->type, 0, i);
ok= 0;
has_fixes= 1;
}
}
- if(ok)
+ if (ok)
i++;
}
@@ -417,99 +565,85 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh
#undef PRINT
-static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata, CustomData *fdata,
+static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
+ CustomData *ldata, CustomData *pdata,
short do_verbose, const short do_fixes)
{
- int vfixed= 0, efixed= 0, ffixed= 0;
+ int vfixed= 0, efixed= 0, lfixed = 0, pfixed = 0;
vfixed= mesh_validate_customdata(vdata, do_verbose, do_fixes);
efixed= mesh_validate_customdata(edata, do_verbose, do_fixes);
- ffixed= mesh_validate_customdata(fdata, do_verbose, do_fixes);
+ lfixed= mesh_validate_customdata(ldata, do_verbose, do_fixes);
+ pfixed= mesh_validate_customdata(pdata, do_verbose, do_fixes);
- return vfixed || efixed || ffixed;
+ return vfixed || efixed || lfixed || pfixed;
}
int BKE_mesh_validate(Mesh *me, int do_verbose)
{
int layers_fixed= 0, arrays_fixed= 0;
- if(do_verbose) {
+ if (do_verbose) {
printf("MESH: %s\n", me->id.name+2);
}
- layers_fixed= BKE_mesh_validate_all_customdata(&me->vdata, &me->edata, &me->fdata, do_verbose, TRUE);
+ layers_fixed= BKE_mesh_validate_all_customdata(&me->vdata, &me->edata, &me->ldata, &me->pdata, do_verbose, TRUE);
arrays_fixed= BKE_mesh_validate_arrays(me,
me->mvert, me->totvert,
me->medge, me->totedge,
- me->mface, me->totface,
+ me->mloop, me->totloop,
+ me->mpoly, me->totpoly,
me->dvert,
do_verbose, TRUE);
- return layers_fixed || arrays_fixed;
+ if (layers_fixed || arrays_fixed) {
+ DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ return TRUE;
+ }
+ return FALSE;
}
int BKE_mesh_validate_dm(DerivedMesh *dm)
{
return BKE_mesh_validate_arrays(NULL,
- dm->getVertArray(dm), dm->getNumVerts(dm),
- dm->getEdgeArray(dm), dm->getNumEdges(dm),
- dm->getTessFaceArray(dm), dm->getNumTessFaces(dm),
- dm->getVertDataArray(dm, CD_MDEFORMVERT),
- TRUE, FALSE);
+ dm->getVertArray(dm), dm->getNumVerts(dm),
+ dm->getEdgeArray(dm), dm->getNumEdges(dm),
+ dm->getLoopArray(dm), dm->getNumLoops(dm),
+ dm->getPolyArray(dm), dm->getNumPolys(dm),
+ dm->getVertDataArray(dm, CD_MDEFORMVERT),
+ TRUE, FALSE);
}
void BKE_mesh_calc_edges(Mesh *mesh, int update)
{
CustomData edata;
EdgeHashIterator *ehi;
- MFace *mf = mesh->mface;
+ MPoly *mp = mesh->mpoly;
MEdge *med, *med_orig;
EdgeHash *eh = BLI_edgehash_new();
- int i, totedge, totface = mesh->totface;
+ int i, totedge, totpoly = mesh->totpoly;
int med_index;
- if(mesh->totedge==0)
+ if (mesh->totedge==0)
update= 0;
- if(update) {
+ if (update) {
/* assume existing edges are valid
* useful when adding more faces and generating edges from them */
med= mesh->medge;
- for(i= 0; i<mesh->totedge; i++, med++)
+ for (i= 0; i<mesh->totedge; i++, med++)
BLI_edgehash_insert(eh, med->v1, med->v2, med);
}
- if(mesh->totpoly) {
- /* mesh loops (bmesh only) */
- MPoly *mp= mesh->mpoly;
- for(i=0; i < mesh->totpoly; i++, mp++) {
- MLoop *l= &mesh->mloop[mp->loopstart];
- int j, l_prev= (l + (mp->totloop-1))->v;
- for (j=0; j < mp->totloop; j++, l++) {
- if (!BLI_edgehash_haskey(eh, l_prev, l->v)) {
- BLI_edgehash_insert(eh, l_prev, l->v, NULL);
- }
- l_prev= l->v;
- }
- }
- }
- else {
- /* regular faces (note, we could remove this for bmesh - campbell) */
- for (i = 0; i < totface; i++, mf++) {
- if (!BLI_edgehash_haskey(eh, mf->v1, mf->v2))
- BLI_edgehash_insert(eh, mf->v1, mf->v2, NULL);
- if (!BLI_edgehash_haskey(eh, mf->v2, mf->v3))
- BLI_edgehash_insert(eh, mf->v2, mf->v3, NULL);
-
- if (mf->v4) {
- if (!BLI_edgehash_haskey(eh, mf->v3, mf->v4))
- BLI_edgehash_insert(eh, mf->v3, mf->v4, NULL);
- if (!BLI_edgehash_haskey(eh, mf->v4, mf->v1))
- BLI_edgehash_insert(eh, mf->v4, mf->v1, NULL);
- } else {
- if (!BLI_edgehash_haskey(eh, mf->v3, mf->v1))
- BLI_edgehash_insert(eh, mf->v3, mf->v1, NULL);
+ /* mesh loops (bmesh only) */
+ for (i=0; i < totpoly; i++, mp++) {
+ MLoop *l= &mesh->mloop[mp->loopstart];
+ int j, l_prev= (l + (mp->totloop-1))->v;
+ for (j=0; j < mp->totloop; j++, l++) {
+ if (!BLI_edgehash_haskey(eh, l_prev, l->v)) {
+ BLI_edgehash_insert(eh, l_prev, l->v, NULL);
}
+ l_prev= l->v;
}
}
@@ -521,12 +655,13 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
ehi = BLI_edgehashIterator_new(eh);
med = CustomData_get_layer(&edata, CD_MEDGE);
- for(i = 0; !BLI_edgehashIterator_isDone(ehi);
+ for (i = 0; !BLI_edgehashIterator_isDone(ehi);
BLI_edgehashIterator_step(ehi), ++i, ++med) {
- if(update && (med_orig=BLI_edgehashIterator_getValue(ehi))) {
+ if (update && (med_orig=BLI_edgehashIterator_getValue(ehi))) {
*med= *med_orig; /* copy from the original */
- } else {
+ }
+ else {
BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
med->flag = ME_EDGEDRAW|ME_EDGERENDER|SELECT; /* select for newly created meshes which are selected [#25595] */
}
@@ -540,7 +675,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
/* second pass, iterate through all loops again and assign
* the newly created edges to them. */
MPoly *mp= mesh->mpoly;
- for(i=0; i < mesh->totpoly; i++, mp++) {
+ for (i=0; i < mesh->totpoly; i++, mp++) {
MLoop *l= &mesh->mloop[mp->loopstart];
MLoop *l_prev= (l + (mp->totloop-1));
int j;
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 2421971c53e..f5a303033a3 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -77,7 +77,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
}
/* type unsigned, no need to chech < 0 */
- if(type < NUM_MODIFIER_TYPES && types[type]->name[0] != '\0') {
+ if (type < NUM_MODIFIER_TYPES && types[type]->name[0] != '\0') {
return types[type];
}
else {
@@ -205,8 +205,8 @@ void modifiers_foreachIDLink(Object *ob, IDWalkFunc walk, void *userData)
for (; md; md=md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- if(mti->foreachIDLink) mti->foreachIDLink(md, ob, walk, userData);
- else if(mti->foreachObjectLink) {
+ if (mti->foreachIDLink) mti->foreachIDLink(md, ob, walk, userData);
+ else if (mti->foreachObjectLink) {
/* each Object can masquerade as an ID, so this should be OK */
ObjectWalkFunc fp = (ObjectWalkFunc)walk;
mti->foreachObjectLink(md, ob, fp, userData);
@@ -221,7 +221,7 @@ void modifiers_foreachTexLink(Object *ob, TexWalkFunc walk, void *userData)
for (; md; md=md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- if(mti->foreachTexLink)
+ if (mti->foreachTexLink)
mti->foreachTexLink(md, ob, walk, userData);
}
}
@@ -290,7 +290,7 @@ int modifiers_getCageIndex(struct Scene *scene, Object *ob, int *lastPossibleCag
ModifierData *md = (virtual_)? modifiers_getVirtualModifierList(ob): ob->modifiers.first;
int i, cageIndex = -1;
- if(lastPossibleCageIndex_r) {
+ if (lastPossibleCageIndex_r) {
/* ensure the value is initialized */
*lastPossibleCageIndex_r= -1;
}
@@ -346,11 +346,11 @@ int modifier_isEnabled(struct Scene *scene, ModifierData *md, int required_mode)
md->scene= scene;
- if((md->mode & required_mode) != required_mode) return 0;
- if(mti->isDisabled && mti->isDisabled(md, required_mode == eModifierMode_Render)) return 0;
- if(md->mode & eModifierMode_DisableTemporary) return 0;
- if(required_mode & eModifierMode_Editmode)
- if(!(mti->flags & eModifierTypeFlag_SupportsEditmode)) return 0;
+ if ((md->mode & required_mode) != required_mode) return 0;
+ if (mti->isDisabled && mti->isDisabled(md, required_mode == eModifierMode_Render)) return 0;
+ if (md->mode & eModifierMode_DisableTemporary) return 0;
+ if (required_mode & eModifierMode_Editmode)
+ if (!(mti->flags & eModifierTypeFlag_SupportsEditmode)) return 0;
return 1;
}
@@ -361,12 +361,12 @@ LinkNode *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData
LinkNode *curr, *prev;
/* build a list of modifier data requirements in reverse order */
- for(; md; md = md->next) {
+ for (; md; md = md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
CustomDataMask mask = 0;
- if(modifier_isEnabled(scene, md, required_mode))
- if(mti->requiredDataMask)
+ if (modifier_isEnabled(scene, md, required_mode))
+ if (mti->requiredDataMask)
mask = mti->requiredDataMask(ob, md);
BLI_linklist_prepend(&dataMasks, SET_INT_IN_POINTER(mask));
@@ -378,13 +378,14 @@ LinkNode *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData
* note the list is currently in reverse order, so "masks that follow it"
* actually means "masks that precede it" at the moment
*/
- for(curr = dataMasks, prev = NULL; curr; prev = curr, curr = curr->next) {
- if(prev) {
+ for (curr = dataMasks, prev = NULL; curr; prev = curr, curr = curr->next) {
+ if (prev) {
CustomDataMask prev_mask = (CustomDataMask)GET_INT_FROM_POINTER(prev->link);
CustomDataMask curr_mask = (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
curr->link = SET_INT_IN_POINTER(curr_mask | prev_mask);
- } else {
+ }
+ else {
CustomDataMask curr_mask = (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
curr->link = SET_INT_IN_POINTER(curr_mask | dataMask);
@@ -405,8 +406,8 @@ ModifierData *modifiers_getLastPreview(struct Scene *scene, ModifierData *md, in
return tmp_md;
/* Find the latest modifier in stack generating preview. */
- for(; md; md = md->next) {
- if(modifier_isEnabled(scene, md, required_mode) && modifier_isPreview(md))
+ for (; md; md = md->next) {
+ if (modifier_isEnabled(scene, md, required_mode) && modifier_isPreview(md))
tmp_md = md;
}
return tmp_md;
@@ -451,18 +452,20 @@ ModifierData *modifiers_getVirtualModifierList(Object *ob)
md = ob->modifiers.first;
- if(ob->parent) {
- if(ob->parent->type==OB_ARMATURE && ob->partype==PARSKEL) {
+ if (ob->parent) {
+ if (ob->parent->type==OB_ARMATURE && ob->partype==PARSKEL) {
amd.object = ob->parent;
amd.modifier.next = md;
amd.deformflag= ((bArmature *)(ob->parent->data))->deformflag;
md = &amd.modifier;
- } else if(ob->parent->type==OB_CURVE && ob->partype==PARSKEL) {
+ }
+ else if (ob->parent->type==OB_CURVE && ob->partype==PARSKEL) {
cmd.object = ob->parent;
cmd.defaxis = ob->trackflag + 1;
cmd.modifier.next = md;
md = &cmd.modifier;
- } else if(ob->parent->type==OB_LATTICE && ob->partype==PARSKEL) {
+ }
+ else if (ob->parent->type==OB_LATTICE && ob->partype==PARSKEL) {
lmd.object = ob->parent;
lmd.modifier.next = md;
md = &lmd.modifier;
@@ -470,8 +473,8 @@ ModifierData *modifiers_getVirtualModifierList(Object *ob)
}
/* shape key modifier, not yet for curves */
- if(ELEM(ob->type, OB_MESH, OB_LATTICE) && ob_get_key(ob)) {
- if(ob->type == OB_MESH && (ob->shapeflag & OB_SHAPE_EDIT_MODE))
+ if (ELEM(ob->type, OB_MESH, OB_LATTICE) && ob_get_key(ob)) {
+ if (ob->type == OB_MESH && (ob->shapeflag & OB_SHAPE_EDIT_MODE))
smd.modifier.mode |= eModifierMode_Editmode|eModifierMode_OnCage;
else
smd.modifier.mode &= ~eModifierMode_Editmode|eModifierMode_OnCage;
@@ -562,9 +565,9 @@ int modifiers_isCorrectableDeformed(Object *ob)
ModifierData *md = modifiers_getVirtualModifierList(ob);
for (; md; md=md->next) {
- if(ob->mode==OB_MODE_EDIT && (md->mode & eModifierMode_Editmode)==0);
+ if (ob->mode==OB_MODE_EDIT && (md->mode & eModifierMode_Editmode)==0);
else
- if(modifier_isCorrectableDeformed(md))
+ if (modifier_isCorrectableDeformed(md))
return 1;
}
return 0;
@@ -590,16 +593,16 @@ int modifiers_indexInObject(Object *ob, ModifierData *md_seek)
ModifierData *md;
for (md=ob->modifiers.first; (md && md_seek!=md); md=md->next, i++);
- if (!md) return -1; /* modifier isnt in the object */
+ if (!md) return -1; /* modifier isn't in the object */
return i;
}
void modifier_freeTemporaryData(ModifierData *md)
{
- if(md->type == eModifierType_Armature) {
+ if (md->type == eModifierType_Armature) {
ArmatureModifierData *amd= (ArmatureModifierData*)md;
- if(amd->prevCos) {
+ if (amd->prevCos) {
MEM_freeN(amd->prevCos);
amd->prevCos= NULL;
}
@@ -614,10 +617,10 @@ void test_object_modifiers(Object *ob)
/* just multires checked for now, since only multires
* modifies mesh data */
- if(ob->type != OB_MESH) return;
+ if (ob->type != OB_MESH) return;
- for(md = ob->modifiers.first; md; md = md->next) {
- if(md->type == eModifierType_Multires) {
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_Multires) {
MultiresModifierData *mmd = (MultiresModifierData*)md;
multiresModifier_set_levels_from_disps(mmd, ob);
@@ -634,7 +637,7 @@ void test_object_modifiers(Object *ob)
*
* - if the ID is from a library, return library path
* - else if the file has been saved return the blend file path.
- * - else if the file isn't saved and the ID isnt from a library, return the temp dir.
+ * - else if the file isn't saved and the ID isn't from a library, return the temp dir.
*/
const char *modifier_path_relbase(Object *ob)
{
diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c
index 8fe8c9cbaed..20fdd4b2b48 100644
--- a/source/blender/blenkernel/intern/modifiers_bmesh.c
+++ b/source/blender/blenkernel/intern/modifiers_bmesh.c
@@ -137,7 +137,7 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
/* converts a cddm to a BMEditMesh. if existing is non-NULL, the
* new geometry will be put in there.*/
-BMEditMesh *DM_to_editbmesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing, int do_tesselate)
+BMEditMesh *DM_to_editbmesh(DerivedMesh *dm, BMEditMesh *existing, int do_tessellate)
{
BMEditMesh *em = existing;
BMesh *bm;
@@ -146,16 +146,16 @@ BMEditMesh *DM_to_editbmesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing, i
bm = em->bm;
}
else {
- bm = BM_mesh_create(ob, &bm_mesh_allocsize_default);
+ bm = BM_mesh_create(&bm_mesh_allocsize_default);
}
DM_to_bmesh_ex(dm, bm);
if (!em) {
- em = BMEdit_Create(bm, do_tesselate);
+ em = BMEdit_Create(bm, do_tessellate);
}
else {
- if (do_tesselate) {
+ if (do_tessellate) {
BMEdit_RecalcTessellation(em);
}
}
@@ -163,11 +163,11 @@ BMEditMesh *DM_to_editbmesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing, i
return em;
}
-BMesh *DM_to_bmesh(Object *ob, DerivedMesh *dm)
+BMesh *DM_to_bmesh(DerivedMesh *dm)
{
BMesh *bm;
- bm = BM_mesh_create(ob, &bm_mesh_allocsize_default);
+ bm = BM_mesh_create(&bm_mesh_allocsize_default);
DM_to_bmesh_ex(dm, bm);
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 0af6b9dd219..0cecc09a9d7 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -91,7 +91,7 @@ static int sequence_guess_offset(const char *full_name, int head_len, int numlen
static int rendersize_to_proxy(MovieClipUser *user, int flag)
{
- if((flag&MCLIP_USE_PROXY)==0)
+ if ((flag&MCLIP_USE_PROXY)==0)
return IMB_PROXY_NONE;
switch(user->render_size) {
@@ -138,7 +138,7 @@ static int rendersize_to_number(int render_size)
static int get_timecode(MovieClip *clip, int flag)
{
- if((flag&MCLIP_USE_PROXY)==0)
+ if ((flag&MCLIP_USE_PROXY)==0)
return IMB_TC_NONE;
return clip->proxy.tc;
@@ -171,13 +171,14 @@ static void get_proxy_fname(MovieClip *clip, int proxy_render_size, int undistor
BLI_split_dirfile(clip->name, clipdir, clipfile, FILE_MAX, FILE_MAX);
- if(clip->flag&MCLIP_USE_PROXY_CUSTOM_DIR) {
+ if (clip->flag&MCLIP_USE_PROXY_CUSTOM_DIR) {
BLI_strncpy(dir, clip->proxy.dir, sizeof(dir));
- } else {
+ }
+ else {
BLI_snprintf(dir, FILE_MAX, "%s/BL_proxy", clipdir);
}
- if(undistorted)
+ if (undistorted)
BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d_undistorted/%08d", dir, clipfile, size, framenr);
else
BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d/%08d", dir, clipfile, size, framenr);
@@ -195,10 +196,11 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user,
int loadflag, use_proxy= 0;
use_proxy= (flag&MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL;
- if(use_proxy) {
+ if (use_proxy) {
int undistort= user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT;
get_proxy_fname(clip, user->render_size, undistort, framenr, name);
- } else
+ }
+ else
get_sequence_fname(clip, framenr, name);
loadflag= IB_rect|IB_multilayer;
@@ -216,15 +218,15 @@ static ImBuf *movieclip_load_movie_file(MovieClip *clip, MovieClipUser *user, in
int proxy= rendersize_to_proxy(user, flag);
char str[FILE_MAX];
- if(!clip->anim) {
+ if (!clip->anim) {
BLI_strncpy(str, clip->name, FILE_MAX);
BLI_path_abs(str, ID_BLEND_PATH(G.main, &clip->id));
/* FIXME: make several stream accessible in image editor, too */
clip->anim= openanim(str, IB_rect, 0);
- if(clip->anim) {
- if(clip->flag&MCLIP_USE_PROXY_CUSTOM_DIR) {
+ if (clip->anim) {
+ if (clip->flag&MCLIP_USE_PROXY_CUSTOM_DIR) {
char dir[FILE_MAX];
BLI_strncpy(dir, clip->proxy.dir, sizeof(dir));
BLI_path_abs(dir, G.main->name);
@@ -233,17 +235,17 @@ static ImBuf *movieclip_load_movie_file(MovieClip *clip, MovieClipUser *user, in
}
}
- if(clip->anim) {
+ if (clip->anim) {
int dur;
int fra;
dur= IMB_anim_get_duration(clip->anim, tc);
fra= framenr-1;
- if(fra<0)
+ if (fra<0)
fra= 0;
- if(fra>(dur-1))
+ if (fra>(dur-1))
fra= dur-1;
ibuf= IMB_anim_absolute(clip->anim, fra, tc, proxy);
@@ -313,26 +315,26 @@ static int moviecache_hashcmp(const void *av, const void *bv)
const MovieClipImBufCacheKey *a= (MovieClipImBufCacheKey*)av;
const MovieClipImBufCacheKey *b= (MovieClipImBufCacheKey*)bv;
- if(a->framenr<b->framenr) return -1;
- else if(a->framenr>b->framenr) return 1;
+ if (a->framenr<b->framenr) return -1;
+ else if (a->framenr>b->framenr) return 1;
- if(a->proxy<b->proxy) return -1;
- else if(a->proxy>b->proxy) return 1;
+ if (a->proxy<b->proxy) return -1;
+ else if (a->proxy>b->proxy) return 1;
- if(a->render_flag<b->render_flag) return -1;
- else if(a->render_flag>b->render_flag) return 1;
+ if (a->render_flag<b->render_flag) return -1;
+ else if (a->render_flag>b->render_flag) return 1;
return 0;
}
static ImBuf *get_imbuf_cache(MovieClip *clip, MovieClipUser *user, int flag)
{
- if(clip->cache) {
+ if (clip->cache) {
MovieClipImBufCacheKey key;
key.framenr= user->framenr;
- if(flag&MCLIP_USE_PROXY) {
+ if (flag&MCLIP_USE_PROXY) {
key.proxy= rendersize_to_proxy(user, flag);
key.render_flag= user->render_flag;
}
@@ -351,7 +353,7 @@ static void put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, i
{
MovieClipImBufCacheKey key;
- if(!clip->cache) {
+ if (!clip->cache) {
clip->cache= MEM_callocN(sizeof(MovieClipCache), "movieClipCache");
clip->cache->moviecache= IMB_moviecache_create(sizeof(MovieClipImBufCacheKey), moviecache_hashhash,
@@ -360,7 +362,7 @@ static void put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, i
key.framenr= user->framenr;
- if(flag&MCLIP_USE_PROXY) {
+ if (flag&MCLIP_USE_PROXY) {
key.proxy= rendersize_to_proxy(user, flag);
key.render_flag= user->render_flag;
}
@@ -411,16 +413,16 @@ MovieClip *BKE_add_movieclip_file(const char *name)
BLI_path_abs(str, G.main->name);
/* exists? */
- file= open(str, O_BINARY|O_RDONLY);
- if(file== -1) return NULL;
+ file= BLI_open(str, O_BINARY|O_RDONLY,0);
+ if (file== -1) return NULL;
close(file);
/* ** first search an identical clip ** */
- for(clip= G.main->movieclip.first; clip; clip= clip->id.next) {
+ for (clip= G.main->movieclip.first; clip; clip= clip->id.next) {
BLI_strncpy(strtest, clip->name, sizeof(clip->name));
BLI_path_abs(strtest, G.main->name);
- if(strcmp(strtest, str)==0) {
+ if (strcmp(strtest, str)==0) {
BLI_strncpy(clip->name, name, sizeof(clip->name)); /* for stringcode */
clip->id.us++; /* officially should not, it doesn't link here! */
@@ -439,12 +441,12 @@ MovieClip *BKE_add_movieclip_file(const char *name)
clip= movieclip_alloc(libname);
BLI_strncpy(clip->name, name, sizeof(clip->name));
- if(BLI_testextensie_array(name, imb_ext_movie)) clip->source= MCLIP_SRC_MOVIE;
+ if (BLI_testextensie_array(name, imb_ext_movie)) clip->source= MCLIP_SRC_MOVIE;
else clip->source= MCLIP_SRC_SEQUENCE;
user.framenr= 1;
BKE_movieclip_get_size(clip, &user, &width, &height);
- if(width && height) {
+ if (width && height) {
clip->tracking.camera.principal[0]= ((float)width)/2;
clip->tracking.camera.principal[1]= ((float)height)/2;
@@ -459,7 +461,7 @@ static void real_ibuf_size(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, in
*width= ibuf->x;
*height= ibuf->y;
- if(clip->flag&MCLIP_USE_PROXY) {
+ if (clip->flag&MCLIP_USE_PROXY) {
switch(user->render_size) {
case MCLIP_PROXY_RENDER_SIZE_25:
(*width)*= 4;
@@ -487,12 +489,12 @@ static ImBuf *get_undistorted_ibuf(MovieClip *clip, struct MovieDistortion *dist
* otherwise, undistorted proxy can be darker than it should */
imb_freerectfloatImBuf(ibuf);
- if(distortion)
+ if (distortion)
undistibuf= BKE_tracking_distortion_exec(distortion, &clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f, 1);
else
undistibuf= BKE_tracking_undistort(&clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f);
- if(undistibuf->userflags&IB_RECT_INVALID) {
+ if (undistibuf->userflags&IB_RECT_INVALID) {
ibuf->userflags&= ~IB_RECT_INVALID;
IMB_rect_from_float(undistibuf);
}
@@ -507,7 +509,7 @@ static int need_undistortion_postprocess(MovieClipUser *user, int flag)
int result = 0;
/* only full undistorted render can be used as on-fly undistorting image */
- if(flag & MCLIP_USE_PROXY) {
+ if (flag & MCLIP_USE_PROXY) {
result |= (user->render_size == MCLIP_PROXY_RENDER_SIZE_FULL) &&
(user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) != 0;
}
@@ -530,10 +532,10 @@ static int check_undistortion_cache_flags(MovieClip *clip)
MovieTrackingCamera *camera= &clip->tracking.camera;
/* check for distortion model changes */
- if(!equals_v2v2(camera->principal, cache->postprocessed.principal))
+ if (!equals_v2v2(camera->principal, cache->postprocessed.principal))
return 0;
- if(!equals_v3v3(&camera->k1, &cache->postprocessed.k1))
+ if (!equals_v3v3(&camera->k1, &cache->postprocessed.k1))
return 0;
return 1;
@@ -546,31 +548,31 @@ static ImBuf *get_postprocessed_cached_frame(MovieClip *clip, MovieClipUser *use
short proxy= IMB_PROXY_NONE;
int render_flag= 0;
- if(flag&MCLIP_USE_PROXY) {
+ if (flag&MCLIP_USE_PROXY) {
proxy= rendersize_to_proxy(user, flag);
render_flag= user->render_flag;
}
/* no cache or no cached postprocessed image */
- if(!clip->cache || !clip->cache->postprocessed.ibuf)
+ if (!clip->cache || !clip->cache->postprocessed.ibuf)
return NULL;
/* postprocessing happened for other frame */
- if(cache->postprocessed.framenr != framenr)
+ if (cache->postprocessed.framenr != framenr)
return NULL;
/* cached ibuf used different proxy settings */
- if(cache->postprocessed.render_flag != render_flag || cache->postprocessed.proxy != proxy)
+ if (cache->postprocessed.render_flag != render_flag || cache->postprocessed.proxy != proxy)
return NULL;
- if(cache->postprocessed.flag != postprocess_flag)
+ if (cache->postprocessed.flag != postprocess_flag)
return NULL;
- if(need_undistortion_postprocess(user, flag)) {
- if(!check_undistortion_cache_flags(clip))
+ if (need_undistortion_postprocess(user, flag)) {
+ if (!check_undistortion_cache_flags(clip))
return NULL;
}
- else if(cache->postprocessed.undistoriton_used)
+ else if (cache->postprocessed.undistoriton_used)
return NULL;
IMB_refImBuf(cache->postprocessed.ibuf);
@@ -584,13 +586,13 @@ static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *u
MovieTrackingCamera *camera= &clip->tracking.camera;
ImBuf *postproc_ibuf = NULL;
- if(cache->postprocessed.ibuf)
+ if (cache->postprocessed.ibuf)
IMB_freeImBuf(cache->postprocessed.ibuf);
cache->postprocessed.framenr= user->framenr;
cache->postprocessed.flag = postprocess_flag;
- if(flag&MCLIP_USE_PROXY) {
+ if (flag&MCLIP_USE_PROXY) {
cache->postprocessed.proxy= rendersize_to_proxy(user, flag);
cache->postprocessed.render_flag= user->render_flag;
}
@@ -599,7 +601,7 @@ static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *u
cache->postprocessed.render_flag = 0;
}
- if(need_undistortion_postprocess(user, flag)) {
+ if (need_undistortion_postprocess(user, flag)) {
copy_v2_v2(cache->postprocessed.principal, camera->principal);
copy_v3_v3(&cache->postprocessed.k1, &camera->k1);
cache->postprocessed.undistoriton_used = 1;
@@ -607,16 +609,16 @@ static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *u
}
else cache->postprocessed.undistoriton_used = 0;
- if(postprocess_flag) {
+ if (postprocess_flag) {
int disable_red = postprocess_flag & MOVIECLIP_DISABLE_RED,
disable_green = postprocess_flag & MOVIECLIP_DISABLE_GREEN,
disable_blue = postprocess_flag & MOVIECLIP_DISABLE_BLUE,
grayscale = postprocess_flag & MOVIECLIP_PREVIEW_GRAYSCALE;
- if(!postproc_ibuf)
+ if (!postproc_ibuf)
postproc_ibuf = IMB_dupImBuf(ibuf);
- if(disable_red || disable_green || disable_blue || grayscale)
+ if (disable_red || disable_green || disable_blue || grayscale)
BKE_tracking_disable_imbuf_channels(postproc_ibuf, disable_red, disable_green, disable_blue, 1);
}
@@ -624,7 +626,7 @@ static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *u
cache->postprocessed.ibuf= postproc_ibuf;
- if(cache->stabilized.ibuf) {
+ if (cache->stabilized.ibuf) {
/* force stable buffer be re-calculated */
IMB_freeImBuf(cache->stabilized.ibuf);
cache->stabilized.ibuf= NULL;
@@ -644,39 +646,39 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip *clip, MovieClipUser *u
BLI_lock_thread(LOCK_MOVIECLIP);
/* try to obtain cached postprocessed frame first */
- if(need_postprocessed_frame(user, flag, postprocess_flag)) {
+ if (need_postprocessed_frame(user, flag, postprocess_flag)) {
ibuf= get_postprocessed_cached_frame(clip, user, flag, postprocess_flag);
- if(!ibuf)
+ if (!ibuf)
need_postprocess= 1;
}
- if(!ibuf)
+ if (!ibuf)
ibuf= get_imbuf_cache(clip, user, flag);
- if(!ibuf) {
+ if (!ibuf) {
int use_sequence= 0;
/* undistorted proxies for movies should be read as image sequence */
use_sequence= (user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT) &&
(user->render_size!=MCLIP_PROXY_RENDER_SIZE_FULL);
- if(clip->source==MCLIP_SRC_SEQUENCE || use_sequence)
+ if (clip->source==MCLIP_SRC_SEQUENCE || use_sequence)
ibuf= movieclip_load_sequence_file(clip, user, framenr, flag);
else {
ibuf= movieclip_load_movie_file(clip, user, framenr, flag);
}
- if(ibuf && (cache_flag & MOVIECLIP_CACHE_SKIP) == 0)
+ if (ibuf && (cache_flag & MOVIECLIP_CACHE_SKIP) == 0)
put_imbuf_cache(clip, user, ibuf, flag);
}
- if(ibuf) {
+ if (ibuf) {
clip->lastframe= framenr;
real_ibuf_size(clip, user, ibuf, &clip->lastsize[0], &clip->lastsize[1]);
/* postprocess frame and put to cache */
- if(need_postprocess) {
+ if (need_postprocess) {
ImBuf *tmpibuf= ibuf;
ibuf= put_postprocessed_frame_to_cache(clip, user, tmpibuf, flag, postprocess_flag);
IMB_freeImBuf(tmpibuf);
@@ -712,27 +714,27 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int
short proxy = IMB_PROXY_NONE;
int render_flag = 0;
- if(clip->flag&MCLIP_USE_PROXY) {
+ if (clip->flag&MCLIP_USE_PROXY) {
proxy = rendersize_to_proxy(user, clip->flag);
render_flag = user->render_flag;
}
/* there's no cached frame or it was calculated for another frame */
- if(!cache->stabilized.ibuf || cache->stabilized.framenr != framenr)
+ if (!cache->stabilized.ibuf || cache->stabilized.framenr != framenr)
return NULL;
/* cached ibuf used different proxy settings */
- if(cache->stabilized.render_flag!=render_flag || cache->stabilized.proxy!=proxy)
+ if (cache->stabilized.render_flag!=render_flag || cache->stabilized.proxy!=proxy)
return NULL;
- if(cache->stabilized.postprocess_flag != postprocess_flag)
+ if (cache->stabilized.postprocess_flag != postprocess_flag)
return NULL;
/* stabilization also depends on pixel aspect ratio */
- if(cache->stabilized.aspect != tracking->camera.pixel_aspect)
+ if (cache->stabilized.aspect != tracking->camera.pixel_aspect)
return NULL;
- if(cache->stabilized.filter != tracking->stabilization.filter)
+ if (cache->stabilized.filter != tracking->stabilization.filter)
return NULL;
stableibuf = cache->stabilized.ibuf;
@@ -740,7 +742,7 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int
BKE_tracking_stabilization_data(&clip->tracking, framenr, stableibuf->x, stableibuf->y, tloc, &tscale, &tangle);
/* check for stabilization parameters */
- if(tscale != cache->stabilized.scale ||
+ if (tscale != cache->stabilized.scale ||
tangle != cache->stabilized.angle ||
!equals_v2v2(tloc, cache->stabilized.loc))
{
@@ -760,7 +762,7 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user
ImBuf *stableibuf;
float tloc[2], tscale, tangle;
- if(cache->stabilized.ibuf)
+ if (cache->stabilized.ibuf)
IMB_freeImBuf(cache->stabilized.ibuf);
stableibuf = BKE_tracking_stabilize(&clip->tracking, framenr, ibuf, tloc, &tscale, &tangle);
@@ -775,7 +777,7 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user
cache->stabilized.aspect = tracking->camera.pixel_aspect;
cache->stabilized.filter = tracking->stabilization.filter;
- if(clip->flag&MCLIP_USE_PROXY) {
+ if (clip->flag&MCLIP_USE_PROXY) {
cache->stabilized.proxy= rendersize_to_proxy(user, clip->flag);
cache->stabilized.render_flag= user->render_flag;
}
@@ -798,29 +800,30 @@ ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float
ibuf= BKE_movieclip_get_postprocessed_ibuf(clip, user, postprocess_flag);
- if(!ibuf)
+ if (!ibuf)
return NULL;
- if(clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) {
+ if (clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) {
MovieClipCache *cache= clip->cache;
stableibuf= get_stable_cached_frame(clip, user, framenr, postprocess_flag);
- if(!stableibuf)
+ if (!stableibuf)
stableibuf= put_stabilized_frame_to_cache(clip, user, ibuf, framenr, postprocess_flag);
- if(loc) copy_v2_v2(loc, cache->stabilized.loc);
- if(scale) *scale= cache->stabilized.scale;
- if(angle) *angle= cache->stabilized.angle;
- } else {
- if(loc) zero_v2(loc);
- if(scale) *scale= 1.0f;
- if(angle) *angle= 0.0f;
+ if (loc) copy_v2_v2(loc, cache->stabilized.loc);
+ if (scale) *scale= cache->stabilized.scale;
+ if (angle) *angle= cache->stabilized.angle;
+ }
+ else {
+ if (loc) zero_v2(loc);
+ if (scale) *scale= 1.0f;
+ if (angle) *angle= 0.0f;
stableibuf= ibuf;
}
- if(stableibuf!=ibuf) {
+ if (stableibuf!=ibuf) {
IMB_freeImBuf(ibuf);
ibuf= stableibuf;
}
@@ -833,7 +836,7 @@ int BKE_movieclip_has_frame(MovieClip *clip, MovieClipUser *user)
{
ImBuf *ibuf= BKE_movieclip_get_ibuf(clip, user);
- if(ibuf) {
+ if (ibuf) {
IMB_freeImBuf(ibuf);
return 1;
}
@@ -843,24 +846,31 @@ int BKE_movieclip_has_frame(MovieClip *clip, MovieClipUser *user)
void BKE_movieclip_get_size(MovieClip *clip, MovieClipUser *user, int *width, int *height)
{
- if(user->framenr==clip->lastframe) {
+ if (user->framenr==clip->lastframe) {
*width= clip->lastsize[0];
*height= clip->lastsize[1];
- } else {
+ }
+ else {
ImBuf *ibuf= BKE_movieclip_get_ibuf(clip, user);
- if(ibuf && ibuf->x && ibuf->y) {
+ if (ibuf && ibuf->x && ibuf->y) {
real_ibuf_size(clip, user, ibuf, width, height);
- } else {
+ }
+ else {
*width= 0;
*height= 0;
}
- if(ibuf)
+ if (ibuf)
IMB_freeImBuf(ibuf);
}
}
+int BKE_movieclip_get_duration(struct MovieClip *clip)
+{
+ return IMB_anim_get_duration(clip->anim, clip->proxy.tc);
+}
+
void BKE_movieclip_aspect(MovieClip *clip, float *aspx, float *aspy)
{
*aspx= *aspy= 1.0;
@@ -875,7 +885,7 @@ void BKE_movieclip_get_cache_segments(MovieClip *clip, MovieClipUser *user, int
*totseg_r= 0;
*points_r= NULL;
- if(clip->cache) {
+ if (clip->cache) {
int proxy= rendersize_to_proxy(user, clip->flag);
IMB_moviecache_get_cache_segments(clip->cache->moviecache, proxy, user->render_flag, totseg_r, points_r);
@@ -891,20 +901,20 @@ void BKE_movieclip_user_set_frame(MovieClipUser *iuser, int framenr)
static void free_buffers(MovieClip *clip)
{
- if(clip->cache) {
+ if (clip->cache) {
IMB_moviecache_free(clip->cache->moviecache);
- if(clip->cache->postprocessed.ibuf)
+ if (clip->cache->postprocessed.ibuf)
IMB_freeImBuf(clip->cache->postprocessed.ibuf);
- if(clip->cache->stabilized.ibuf)
+ if (clip->cache->stabilized.ibuf)
IMB_freeImBuf(clip->cache->stabilized.ibuf);
MEM_freeN(clip->cache);
clip->cache= NULL;
}
- if(clip->anim) {
+ if (clip->anim) {
IMB_free_anim(clip->anim);
clip->anim= FALSE;
}
@@ -920,16 +930,16 @@ void BKE_movieclip_reload(MovieClip *clip)
clip->tracking.stabilization.ok= 0;
/* update clip source */
- if(BLI_testextensie_array(clip->name, imb_ext_movie)) clip->source= MCLIP_SRC_MOVIE;
+ if (BLI_testextensie_array(clip->name, imb_ext_movie)) clip->source= MCLIP_SRC_MOVIE;
else clip->source= MCLIP_SRC_SEQUENCE;
}
void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClipScopes *scopes)
{
- if(scopes->ok)
+ if (scopes->ok)
return;
- if(scopes->track_preview) {
+ if (scopes->track_preview) {
IMB_freeImBuf(scopes->track_preview);
scopes->track_preview= NULL;
}
@@ -937,25 +947,26 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip
scopes->marker= NULL;
scopes->track= NULL;
- if(clip) {
+ if (clip) {
MovieTrackingTrack *act_track= BKE_tracking_active_track(&clip->tracking);
- if(act_track) {
+ if (act_track) {
MovieTrackingTrack *track= act_track;
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, user->framenr);
- if(marker->flag&MARKER_DISABLED) {
+ if (marker->flag&MARKER_DISABLED) {
scopes->track_disabled= 1;
- } else {
+ }
+ else {
ImBuf *ibuf= BKE_movieclip_get_ibuf(clip, user);
scopes->track_disabled= 0;
- if(ibuf && ibuf->rect) {
+ if (ibuf && ibuf->rect) {
ImBuf *tmpibuf;
MovieTrackingMarker undist_marker= *marker;
- if(user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
+ if (user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
int width, height;
float aspy= 1.0f/clip->tracking.camera.pixel_aspect;
@@ -974,10 +985,10 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip
tmpibuf= BKE_tracking_get_pattern_imbuf(ibuf, track, &undist_marker, 3 /* margin */,
1 /* anchor */, scopes->track_pos, NULL);
- if(tmpibuf->rect_float)
+ if (tmpibuf->rect_float)
IMB_rect_from_float(tmpibuf);
- if(tmpibuf->rect)
+ if (tmpibuf->rect)
scopes->track_preview= tmpibuf;
else
IMB_freeImBuf(tmpibuf);
@@ -986,7 +997,7 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip
IMB_freeImBuf(ibuf);
}
- if((track->flag&TRACK_LOCKED)==0) {
+ if ((track->flag&TRACK_LOCKED)==0) {
scopes->marker= marker;
scopes->track= track;
scopes->slide_scale[0]= track->pat_max[0]-track->pat_min[0];
@@ -1019,13 +1030,13 @@ static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, i
scaleibuf->ftype= JPG | quality;
/* unsupported feature only confuses other s/w */
- if(scaleibuf->planes==32)
+ if (scaleibuf->planes==32)
scaleibuf->planes= 24;
BLI_lock_thread(LOCK_MOVIECLIP);
BLI_make_existing_file(name);
- if(IMB_saveiff(scaleibuf, name, IB_rect)==0)
+ if (IMB_saveiff(scaleibuf, name, IB_rect)==0)
perror(name);
BLI_unlock_thread(LOCK_MOVIECLIP);
@@ -1045,19 +1056,19 @@ void BKE_movieclip_build_proxy_frame(MovieClip *clip, int clip_flag, struct Movi
ibuf= BKE_movieclip_get_ibuf_flag(clip, &user, clip_flag, MOVIECLIP_CACHE_SKIP);
- if(ibuf) {
+ if (ibuf) {
ImBuf *tmpibuf= ibuf;
int i;
- if(undistorted)
+ if (undistorted)
tmpibuf= get_undistorted_ibuf(clip, distortion, ibuf);
- for(i= 0; i<build_count; i++)
+ for (i= 0; i<build_count; i++)
movieclip_build_proxy_ibuf(clip, tmpibuf, cfra, build_sizes[i], undistorted);
IMB_freeImBuf(ibuf);
- if(tmpibuf!=ibuf)
+ if (tmpibuf!=ibuf)
IMB_freeImBuf(tmpibuf);
}
}
@@ -1077,21 +1088,21 @@ void unlink_movieclip(Main *bmain, MovieClip *clip)
Scene *sce;
Object *ob;
- for(scr= bmain->screen.first; scr; scr= scr->id.next) {
- for(area= scr->areabase.first; area; area= area->next) {
- for(sl= area->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_CLIP) {
+ for (scr= bmain->screen.first; scr; scr= scr->id.next) {
+ for (area= scr->areabase.first; area; area= area->next) {
+ for (sl= area->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_CLIP) {
SpaceClip *sc= (SpaceClip *) sl;
- if(sc->clip==clip)
+ if (sc->clip==clip)
sc->clip= NULL;
}
- else if(sl->spacetype==SPACE_VIEW3D) {
+ else if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *) sl;
BGpic *bgpic;
- for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
- if(bgpic->clip==clip)
+ for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
+ if (bgpic->clip==clip)
bgpic->clip= NULL;
}
}
@@ -1099,27 +1110,27 @@ void unlink_movieclip(Main *bmain, MovieClip *clip)
}
}
- for(sce= bmain->scene.first; sce; sce= sce->id.next) {
- if(sce->clip==clip)
+ for (sce= bmain->scene.first; sce; sce= sce->id.next) {
+ if (sce->clip==clip)
sce->clip= NULL;
}
- for(ob= bmain->object.first; ob; ob= ob->id.next) {
+ for (ob= bmain->object.first; ob; ob= ob->id.next) {
bConstraint *con;
- for(con= ob->constraints.first; con; con= con->next) {
+ for (con= ob->constraints.first; con; con= con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
+ if (cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
bFollowTrackConstraint *data= (bFollowTrackConstraint *) con->data;
- if(data->clip==clip)
+ if (data->clip==clip)
data->clip= NULL;
}
- else if(cti->type==CONSTRAINT_TYPE_CAMERASOLVER) {
+ else if (cti->type==CONSTRAINT_TYPE_CAMERASOLVER) {
bCameraSolverConstraint *data= (bCameraSolverConstraint *) con->data;
- if(data->clip==clip)
+ if (data->clip==clip)
data->clip= NULL;
}
}
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 06de3cbe5a6..d8117aa1344 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -40,6 +40,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "BLI_bitmap.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_pbvh.h"
@@ -76,6 +77,201 @@ typedef enum {
static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert);
static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm2, DispOp op, DMGridData **oldGridData, int totlvl);
+/** Customdata **/
+
+void multires_customdata_delete(Mesh *me)
+{
+ if (me->edit_btmesh) {
+ BMEditMesh *em= me->edit_btmesh;
+ /* CustomData_external_remove is used here only to mark layer
+ * as non-external for further free-ing, so zero element count
+ * looks safer than em->totface */
+ CustomData_external_remove(&em->bm->ldata, &me->id,
+ CD_MDISPS, 0);
+ BM_data_layer_free(em->bm, &em->bm->ldata, CD_MDISPS);
+ }
+ else {
+ CustomData_external_remove(&me->ldata, &me->id,
+ CD_MDISPS, me->totloop);
+ CustomData_free_layer_active(&me->ldata, CD_MDISPS,
+ me->totloop);
+ }
+}
+
+/** Grid hiding **/
+static BLI_bitmap multires_mdisps_upsample_hidden(BLI_bitmap lo_hidden,
+ int lo_level,
+ int hi_level,
+
+ /* assumed to be at hi_level (or
+ null) */
+ BLI_bitmap prev_hidden)
+{
+ BLI_bitmap subd;
+ int hi_gridsize = ccg_gridsize(hi_level);
+ int lo_gridsize = ccg_gridsize(lo_level);
+ int yh, xh, xl, yl, xo, yo, hi_ndx;
+ int offset, factor;
+
+ BLI_assert(lo_level <= hi_level);
+
+ /* fast case */
+ if (lo_level == hi_level)
+ return MEM_dupallocN(lo_hidden);
+
+ subd = BLI_BITMAP_NEW(hi_gridsize * hi_gridsize, "MDisps.hidden upsample");
+
+ factor = ccg_factor(lo_level, hi_level);
+ offset = 1 << (hi_level - lo_level - 1);
+
+ /* low-res blocks */
+ for (yl = 0; yl < lo_gridsize; yl++) {
+ for (xl = 0; xl < lo_gridsize; xl++) {
+ int lo_val = BLI_BITMAP_GET(lo_hidden, yl * lo_gridsize + xl);
+
+ /* high-res blocks */
+ for (yo = -offset; yo <= offset; yo++) {
+ yh = yl * factor + yo;
+ if (yh < 0 || yh >= hi_gridsize)
+ continue;
+
+ for (xo = -offset; xo <= offset; xo++) {
+ xh = xl * factor + xo;
+ if (xh < 0 || xh >= hi_gridsize)
+ continue;
+
+ hi_ndx = yh * hi_gridsize + xh;
+
+ if (prev_hidden) {
+ /* If prev_hidden is available, copy it to
+ subd, except when the equivalent element in
+ lo_hidden is different */
+ if (lo_val != prev_hidden[hi_ndx])
+ BLI_BITMAP_MODIFY(subd, hi_ndx, lo_val);
+ else
+ BLI_BITMAP_MODIFY(subd, hi_ndx, prev_hidden[hi_ndx]);
+ }
+ else {
+ BLI_BITMAP_MODIFY(subd, hi_ndx, lo_val);
+ }
+ }
+ }
+ }
+ }
+
+ return subd;
+}
+
+static BLI_bitmap multires_mdisps_downsample_hidden(BLI_bitmap old_hidden,
+ int old_level,
+ int new_level)
+{
+ BLI_bitmap new_hidden;
+ int new_gridsize = ccg_gridsize(new_level);
+ int old_gridsize = ccg_gridsize(old_level);
+ int x, y, factor, old_value;
+
+ BLI_assert(new_level <= old_level);
+ factor = ccg_factor(new_level, old_level);
+ new_hidden = BLI_BITMAP_NEW(new_gridsize * new_gridsize,
+ "downsample hidden");
+
+
+
+ for (y = 0; y < new_gridsize; y++) {
+ for (x = 0; x < new_gridsize; x++) {
+ old_value = BLI_BITMAP_GET(old_hidden,
+ factor*y*old_gridsize + x*factor);
+
+ BLI_BITMAP_MODIFY(new_hidden, y*new_gridsize + x, old_value);
+ }
+ }
+
+ return new_hidden;
+}
+
+static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm,
+ Mesh *me, int level)
+{
+ const MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
+ BLI_bitmap *grid_hidden = ccgdm->gridHidden;
+ int *gridOffset;
+ int i, j;
+
+ gridOffset = ccgdm->dm.getGridOffset(&ccgdm->dm);
+
+ for (i = 0; i < me->totpoly; i++) {
+ for (j = 0; j < me->mpoly[i].totloop; j++) {
+ int g = gridOffset[i] + j;
+ const MDisps *md = &mdisps[g];
+ BLI_bitmap gh = md->hidden;
+
+ if (gh) {
+ grid_hidden[g] =
+ multires_mdisps_downsample_hidden(gh, md->level, level);
+ }
+ }
+ }
+}
+
+/* subdivide mdisps.hidden if needed (assumes that md.level reflects
+ the current level of md.hidden) */
+static void multires_mdisps_subdivide_hidden(MDisps *md, int new_level)
+{
+ BLI_bitmap subd;
+
+ BLI_assert(md->hidden);
+
+ /* nothing to do if already subdivided enough */
+ if (md->level >= new_level)
+ return;
+
+ subd = multires_mdisps_upsample_hidden(md->hidden,
+ md->level,
+ new_level,
+ NULL);
+
+ /* swap in the subdivided data */
+ MEM_freeN(md->hidden);
+ md->hidden = subd;
+}
+
+static MDisps *multires_mdisps_initialize_hidden(Mesh *me, int level)
+{
+ MDisps *mdisps = CustomData_add_layer(&me->ldata, CD_MDISPS,
+ CD_CALLOC, 0, me->totloop);
+ int gridsize = ccg_gridsize(level);
+ int gridarea = gridsize * gridsize;
+ int i, j, k;
+
+ for (i = 0; i < me->totpoly; i++) {
+ int hide = 0;
+
+ for (j = 0; j < me->mpoly[i].totloop; j++) {
+ if (me->mvert[me->mloop[me->mpoly[i].loopstart + j].v].flag & ME_HIDE) {
+ hide = 1;
+ break;
+ }
+ }
+
+ if (!hide)
+ continue;
+
+ for (j = 0; j < me->mpoly[i].totloop; j++) {
+ MDisps *md = &mdisps[me->mpoly[i].loopstart + j];
+
+ BLI_assert(!md->hidden);
+
+ md->hidden = BLI_BITMAP_NEW(gridarea, "MDisps.hidden initialize");
+
+ for (k = 0; k < gridarea; k++)
+ BLI_BITMAP_SET(md->hidden, k);
+ }
+ }
+
+ return mdisps;
+}
+
DerivedMesh *get_multires_dm(Scene *scene, MultiresModifierData *mmd, Object *ob)
{
ModifierData *md= (ModifierData *)mmd;
@@ -156,16 +352,16 @@ static void multires_set_tot_level(Object *ob, MultiresModifierData *mmd, int lv
mmd->renderlvl = CLAMPIS(MAX2(mmd->renderlvl, lvl), 0, mmd->totlvl);
}
-static void multires_dm_mark_as_modified(DerivedMesh *dm)
+static void multires_dm_mark_as_modified(DerivedMesh *dm, MultiresModifiedFlags flags)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*)dm;
- ccgdm->multires.modified = 1;
+ ccgdm->multires.modified_flags |= flags;
}
-void multires_mark_as_modified(Object *ob)
+void multires_mark_as_modified(Object *ob, MultiresModifiedFlags flags)
{
if (ob && ob->derivedFinal)
- multires_dm_mark_as_modified(ob->derivedFinal);
+ multires_dm_mark_as_modified(ob->derivedFinal, flags);
}
void multires_force_update(Object *ob)
@@ -205,7 +401,7 @@ int multiresModifier_reshapeFromDM(Scene *scene, MultiresModifierData *mmd,
if (mrdm && srcdm && mrdm->getNumVerts(mrdm) == srcdm->getNumVerts(srcdm)) {
multires_mvert_to_ss(mrdm, srcdm->getVertArray(srcdm));
- multires_dm_mark_as_modified(mrdm);
+ multires_dm_mark_as_modified(mrdm, MULTIRES_COORDS_MODIFIED);
multires_force_update(ob);
mrdm->release(mrdm);
@@ -320,6 +516,7 @@ static void multires_set_tot_mdisps(Mesh *me, int lvl)
if (mdisps) {
for (i = 0; i < me->totloop; i++, mdisps++) {
mdisps->totdisp = multires_grid_tot[lvl];
+ mdisps->level = lvl;
}
}
}
@@ -335,9 +532,13 @@ static void multires_reallocate_mdisps(int totloop, MDisps *mdisps, int lvl)
if (mdisps[i].disps)
MEM_freeN(mdisps[i].disps);
+
+ if (mdisps[i].level && mdisps[i].hidden)
+ multires_mdisps_subdivide_hidden(&mdisps[i], lvl);
mdisps[i].disps = disps;
mdisps[i].totdisp = totdisp;
+ mdisps[i].level = lvl;
}
}
@@ -419,6 +620,14 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
hdisps = mdisp->disps;
multires_copy_grid(ndisps, hdisps, nsize, hsize);
+ if (mdisp->hidden) {
+ BLI_bitmap gh =
+ multires_mdisps_downsample_hidden(mdisp->hidden,
+ mdisp->level,
+ lvl);
+ MEM_freeN(mdisp->hidden);
+ mdisp->hidden = gh;
+ }
ndisps += nsize*nsize;
hdisps += hsize*hsize;
@@ -426,12 +635,12 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
MEM_freeN(mdisp->disps);
mdisp->disps = disps;
mdisp->totdisp = totdisp;
+ mdisp->level = lvl;
}
}
}
else {
- CustomData_external_remove(&me->ldata, &me->id, CD_MDISPS, me->totloop);
- CustomData_free_layer_active(&me->ldata, CD_MDISPS, me->totloop);
+ multires_customdata_delete(me);
}
}
@@ -469,7 +678,7 @@ static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lv
mmd.totlvl = totlvl;
mmd.simple = simple;
- return multires_dm_create_from_derived(&mmd, 1, dm, ob, 0, 0);
+ return multires_dm_create_from_derived(&mmd, 1, dm, ob, 0);
}
static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int simple, int optimal, int plain_uv)
@@ -502,9 +711,9 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
{
DerivedMesh *cddm, *dispdm, *origdm;
Mesh *me;
- ListBase *pmap;
+ const MeshElemMap *pmap;
float (*origco)[3];
- int i, j, offset, totlvl;
+ int i, j, k, offset, totlvl;
multires_force_update(ob);
@@ -538,22 +747,21 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
copy_v3_v3(origco[i], me->mvert[i].co);
for (i = 0; i < me->totvert; ++i) {
- IndexNode *n;
float avg_no[3] = {0,0,0}, center[3] = {0,0,0}, push[3];
float dist;
- int tot;
+ int tot = 0;
/* don't adjust verts not used by at least one poly */
- if (!pmap[i].first)
+ if (!pmap[i].count)
continue;
/* find center */
- for (n = pmap[i].first, tot = 0; n; n = n->next) {
- const MPoly *p = &me->mpoly[n->index];
+ for (j = 0; j < pmap[i].count; j++) {
+ const MPoly *p = &me->mpoly[pmap[i].indices[j]];
/* this double counts, not sure if that's bad or good */
- for (j = 0; j < p->totloop; ++j) {
- int vndx = me->mloop[p->loopstart + j].v;
+ for (k = 0; k < p->totloop; ++k) {
+ int vndx = me->mloop[p->loopstart + k].v;
if (vndx != i) {
add_v3_v3(center, origco[vndx]);
++tot;
@@ -563,8 +771,8 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
mul_v3_fl(center, 1.0f / tot);
/* find normal */
- for (n = pmap[i].first; n; n = n->next) {
- const MPoly *p = &me->mpoly[n->index];
+ for (j = 0; j < pmap[i].count; j++) {
+ const MPoly *p = &me->mpoly[pmap[i].indices[j]];
MPoly fake_poly;
MLoop *fake_loops;
float (*fake_co)[3];
@@ -577,15 +785,15 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
fake_loops = MEM_mallocN(sizeof(MLoop) * p->totloop, "fake_loops");
fake_co = MEM_mallocN(sizeof(float) * 3 * p->totloop, "fake_co");
- for (j = 0; j < p->totloop; ++j) {
- int vndx = me->mloop[p->loopstart + j].v;
+ for (k = 0; k < p->totloop; ++k) {
+ int vndx = me->mloop[p->loopstart + k].v;
- fake_loops[j].v = j;
+ fake_loops[k].v = k;
if (vndx == i)
- copy_v3_v3(fake_co[j], center);
+ copy_v3_v3(fake_co[k], center);
else
- copy_v3_v3(fake_co[j], origco[vndx]);
+ copy_v3_v3(fake_co[k], origco[vndx]);
}
mesh_calc_poly_normal_coords(&fake_poly, fake_loops,
@@ -634,7 +842,7 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
if (!mdisps)
- mdisps = CustomData_add_layer(&me->ldata, CD_MDISPS, CD_DEFAULT, NULL, me->totloop);
+ mdisps = multires_mdisps_initialize_hidden(me, totlvl);
if (mdisps->disps && !updateblock && totlvl > 1) {
/* upsample */
@@ -842,7 +1050,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
}
}
-static void multiresModifier_update(DerivedMesh *dm)
+void multires_modifier_update_mdisps(struct DerivedMesh *dm)
{
CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
Object *ob;
@@ -937,6 +1145,37 @@ static void multiresModifier_update(DerivedMesh *dm)
}
}
+void multires_modifier_update_hidden(DerivedMesh *dm)
+{
+ CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+ BLI_bitmap *grid_hidden= ccgdm->gridHidden;
+ Mesh *me = ccgdm->multires.ob->data;
+ MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
+ int totlvl = ccgdm->multires.totlvl;
+ int lvl = ccgdm->multires.lvl;
+
+ if (mdisps) {
+ int i;
+
+ for (i = 0; i < me->totloop; i++) {
+ MDisps *md = &mdisps[i];
+ BLI_bitmap gh = grid_hidden[i];
+
+ if (!gh && md->hidden) {
+ MEM_freeN(md->hidden);
+ md->hidden = NULL;
+ }
+ else if (gh) {
+ gh = multires_mdisps_upsample_hidden(gh, lvl, totlvl,
+ md->hidden);
+ if (md->hidden)
+ MEM_freeN(md->hidden);
+
+ md->hidden = gh;
+ }
+ }
+ }
+}
void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
{
@@ -999,6 +1238,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
/* when adding new faces in edit mode, need to allocate disps */
if (!mdisp->disps) {
mdisp->totdisp = gridSize*gridSize;
+ mdisp->level = totlvl;
mdisp->disps = MEM_callocN(sizeof(float)*3*mdisp->totdisp, "disp in multires_set_space");
}
@@ -1083,12 +1323,13 @@ void multires_stitch_grids(Object *ob)
}
}
-DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int local_mmd, DerivedMesh *dm, Object *ob,
- int useRenderParams, int UNUSED(isFinalCalc))
+DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd,
+ int local_mmd, DerivedMesh *dm,
+ Object *ob, int useRenderParams)
{
Mesh *me= ob->data;
DerivedMesh *result;
- CCGDerivedMesh *ccgdm;
+ CCGDerivedMesh *ccgdm = NULL;
DMGridData **gridData, **subGridData;
int lvl= multires_get_level(ob, mmd, useRenderParams);
int i, gridSize, numGrids;
@@ -1108,8 +1349,7 @@ DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int loca
ccgdm->multires.local_mmd = local_mmd;
ccgdm->multires.lvl = lvl;
ccgdm->multires.totlvl = mmd->totlvl;
- ccgdm->multires.modified = 0;
- ccgdm->multires.update = multiresModifier_update;
+ ccgdm->multires.modified_flags = 0;
}
numGrids = result->getNumGrids(result);
@@ -1129,6 +1369,10 @@ DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int loca
/*run displacement*/
multiresModifier_disp_run(result, ob->data, dm, APPLY_DISPLACEMENTS, subGridData, mmd->totlvl);
+ /* copy hidden elements for this level */
+ if (ccgdm)
+ multires_output_hidden_to_ccgdm(ccgdm, me, lvl);
+
for (i = 0; i < numGrids; i++)
MEM_freeN(subGridData[i]);
MEM_freeN(subGridData);
@@ -1225,6 +1469,7 @@ static void old_mdisps_convert(MFace *mface, MDisps *mdisp)
MEM_freeN(mdisp->disps);
mdisp->totdisp= newtotdisp;
+ mdisp->level= newlvl;
mdisp->disps= disps;
}
@@ -1253,6 +1498,7 @@ void multires_load_old_250(Mesh *me)
for (j=0; j < mf->v4 ? 4 : 3; j++, k++) {
mdisps2[k].disps = MEM_callocN(sizeof(float)*3*totdisp, "multires disp in conversion");
mdisps2[k].totdisp = totdisp;
+ mdisps2[k].level = mdisps[i].level;
memcpy(mdisps2[k].disps, mdisps[i].disps + totdisp*j, totdisp);
}
@@ -1744,11 +1990,11 @@ void multires_load_old(Object *ob, Mesh *me)
mmd->lvl = mmd->totlvl;
orig = CDDM_from_mesh(me, NULL);
- dm = multires_dm_create_from_derived(mmd, 0, orig, ob, 0, 0);
+ dm = multires_dm_create_from_derived(mmd, 0, orig, ob, 0);
multires_load_old_dm(dm, me, mmd->totlvl+1);
- multires_dm_mark_as_modified(dm);
+ multires_dm_mark_as_modified(dm, MULTIRES_COORDS_MODIFIED);
dm->release(dm);
orig->release(orig);
@@ -1779,10 +2025,7 @@ static void multires_sync_levels(Scene *scene, Object *ob, Object *to_ob)
* upsampled correct without modifier data.
* just remove mdisps if no multires present (nazgul) */
- Mesh *me= (Mesh*)ob->data;
-
- CustomData_external_remove(&me->ldata, &me->id, CD_MDISPS, me->totloop);
- CustomData_free_layer_active(&me->ldata, CD_MDISPS, me->totloop);
+ multires_customdata_delete(ob->data);
}
if (!mmd || !to_mmd) return;
diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c
index cdba036a6ae..27e309e9d20 100644
--- a/source/blender/blenkernel/intern/navmesh_conversion.c
+++ b/source/blender/blenkernel/intern/navmesh_conversion.c
@@ -44,12 +44,12 @@
#include "recast-capi.h"
-BM_INLINE float area2(const float* a, const float* b, const float* c)
+BLI_INLINE float area2(const float* a, const float* b, const float* c)
{
return (b[0] - a[0]) * (c[2] - a[2]) - (c[0] - a[0]) * (b[2] - a[2]);
}
-BM_INLINE int left(const float* a, const float* b, const float* c)
+BLI_INLINE int left(const float* a, const float* b, const float* c)
{
return area2(a, b, c) < 0;
}
@@ -501,7 +501,7 @@ 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;
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 8b9955dd378..cbdbf0317b4 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -55,6 +55,8 @@
#include "BLI_path_util.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_fcurve.h"
@@ -66,8 +68,6 @@
#include "BKE_utildefines.h"
#include "BKE_utildefines.h"
-#include "BLI_listbase.h"
-
#include "RNA_access.h"
#include "NOD_socket.h"
@@ -87,7 +87,7 @@ bNodeTreeType *ntreeGetType(int type)
types_init = 0;
}
- if(type >= 0 && type < NUM_NTREE_TYPES) {
+ if (type >= 0 && type < NUM_NTREE_TYPES) {
return types[type];
}
else {
@@ -98,8 +98,8 @@ bNodeTreeType *ntreeGetType(int type)
static bNodeType *node_get_type(bNodeTree *ntree, int type)
{
bNodeType *ntype = ntreeGetType(ntree->type)->node_types.first;
- for(; ntype; ntype= ntype->next)
- if(ntype->type==type)
+ for (; ntype; ntype= ntype->next)
+ if (ntype->type==type)
return ntype;
return NULL;
@@ -120,7 +120,7 @@ bNodeSocketType *ntreeGetSocketType(int type)
types_init= 0;
}
- if(type < NUM_SOCKET_TYPES) {
+ if (type < NUM_SOCKET_TYPES) {
return types[type];
}
else {
@@ -132,23 +132,23 @@ void ntreeInitTypes(bNodeTree *ntree)
{
bNode *node, *next;
- for(node= ntree->nodes.first; node; node= next) {
+ for (node= ntree->nodes.first; node; node= next) {
next= node->next;
node->typeinfo= node_get_type(ntree, node->type);
- if(node->type==NODE_DYNAMIC) {
+ if (node->type==NODE_DYNAMIC) {
/* needed info if the pynode script fails now: */
node->storage= ntree;
- if(node->id!=NULL) { /* not an empty script node */
+ if (node->id!=NULL) { /* not an empty script node */
node->custom1= 0;
node->custom1= BSET(node->custom1,NODE_DYNAMIC_ADDEXIST);
}
-// if(node->typeinfo)
+// if (node->typeinfo)
// node->typeinfo->initfunc(node);
}
- if(node->typeinfo==NULL) {
+ if (node->typeinfo==NULL) {
printf("Error: Node type %s doesn't exist anymore, removed\n", node->name);
nodeFreeNode(ntree, node);
}
@@ -204,9 +204,9 @@ void nodeRemoveSocket(bNodeTree *ntree, bNode *node, bNodeSocket *sock)
{
bNodeLink *link, *next;
- for(link= ntree->links.first; link; link= next) {
+ for (link= ntree->links.first; link; link= next) {
next= link->next;
- if(link->fromsock==sock || link->tosock==sock) {
+ if (link->fromsock==sock || link->tosock==sock) {
nodeRemLink(ntree, link);
}
}
@@ -226,9 +226,9 @@ void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node)
bNodeSocket *sock;
bNodeLink *link, *next;
- for(link= ntree->links.first; link; link= next) {
+ for (link= ntree->links.first; link; link= next) {
next= link->next;
- if(link->fromnode==node || link->tonode==node) {
+ if (link->fromnode==node || link->tonode==node) {
nodeRemLink(ntree, link);
}
}
@@ -256,28 +256,28 @@ int nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockin
bNodeSocket *tsock;
int index= 0;
- for(node= ntree->nodes.first; node; node= node->next) {
- for(index=0, tsock= node->inputs.first; tsock; tsock= tsock->next, index++) {
- if(tsock==sock) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ for (index=0, tsock= node->inputs.first; tsock; tsock= tsock->next, index++) {
+ if (tsock==sock) {
if (in_out) *in_out= SOCK_IN;
break;
}
}
- if(tsock)
+ if (tsock)
break;
- for(index=0, tsock= node->outputs.first; tsock; tsock= tsock->next, index++) {
- if(tsock==sock) {
+ for (index=0, tsock= node->outputs.first; tsock; tsock= tsock->next, index++) {
+ if (tsock==sock) {
if (in_out) *in_out= SOCK_OUT;
break;
}
}
- if(tsock)
+ if (tsock)
break;
}
- if(node) {
+ if (node) {
*nodep= node;
- if(sockindex) *sockindex= index;
+ if (sockindex) *sockindex= index;
return 1;
}
@@ -291,17 +291,17 @@ static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType
bNodeSocketTemplate *sockdef;
/* bNodeSocket *sock; */ /* UNUSED */
- if(ntype->inputs) {
+ if (ntype->inputs) {
sockdef= ntype->inputs;
- while(sockdef->type != -1) {
+ while (sockdef->type != -1) {
/* sock = */ node_add_input_from_template(ntree, node, sockdef);
sockdef++;
}
}
- if(ntype->outputs) {
+ if (ntype->outputs) {
sockdef= ntype->outputs;
- while(sockdef->type != -1) {
+ while (sockdef->type != -1) {
/* sock = */ node_add_output_from_template(ntree, node, sockdef);
sockdef++;
@@ -321,7 +321,7 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp)
bNodeType *ntype;
ntype= node_get_type(ntree, ntemp->type);
- if(ntype == NULL) {
+ if (ntype == NULL) {
printf("nodeAddNodeType() error: '%d' type invalid\n", ntemp->type);
return NULL;
}
@@ -339,7 +339,7 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp)
node_add_sockets_from_type(ntree, node, ntype);
- if(ntype->initfunc!=NULL)
+ if (ntype->initfunc!=NULL)
ntype->initfunc(ntree, node, ntemp);
/* initialize the node name with the node label */
@@ -357,14 +357,14 @@ void nodeMakeDynamicType(bNode *node)
{
/* find SH_DYNAMIC_NODE ntype */
bNodeType *ntype= ntreeGetType(NTREE_SHADER)->node_types.first;
- while(ntype) {
- if(ntype->type==NODE_DYNAMIC)
+ while (ntype) {
+ if (ntype->type==NODE_DYNAMIC)
break;
ntype= ntype->next;
}
/* make own type struct to fill */
- if(ntype) {
+ if (ntype) {
/*node->typeinfo= MEM_dupallocN(ntype);*/
bNodeType *newtype= MEM_callocN(sizeof(bNodeType), "dynamic bNodeType");
*newtype= *ntype;
@@ -387,7 +387,7 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
BLI_duplicatelist(&nnode->inputs, &node->inputs);
oldsock= node->inputs.first;
- for(sock= nnode->inputs.first; sock; sock= sock->next, oldsock= oldsock->next) {
+ for (sock= nnode->inputs.first; sock; sock= sock->next, oldsock= oldsock->next) {
oldsock->new_sock= sock;
sock->stack_index= 0;
@@ -402,7 +402,7 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
BLI_duplicatelist(&nnode->outputs, &node->outputs);
oldsock= node->outputs.first;
- for(sock= nnode->outputs.first; sock; sock= sock->next, oldsock= oldsock->next) {
+ for (sock= nnode->outputs.first; sock; sock= sock->next, oldsock= oldsock->next) {
oldsock->new_sock= sock;
sock->stack_index= 0;
@@ -417,7 +417,7 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
/* don't increase node->id users, freenode doesn't decrement either */
- if(node->typeinfo->copystoragefunc)
+ if (node->typeinfo->copystoragefunc)
node->typeinfo->copystoragefunc(node, nnode);
node->new_node= nnode;
@@ -436,67 +436,67 @@ bNodeLink *nodeAddLink(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock,
bNodeLink *link= NULL;
int from= 0, to= 0;
- if(fromnode) {
+ if (fromnode) {
/* test valid input */
- for(sock= fromnode->outputs.first; sock; sock= sock->next)
- if(sock==fromsock)
+ for (sock= fromnode->outputs.first; sock; sock= sock->next)
+ if (sock==fromsock)
break;
- if(sock)
+ if (sock)
from= 1; /* OK */
else {
- for(sock= fromnode->inputs.first; sock; sock= sock->next)
- if(sock==fromsock)
+ for (sock= fromnode->inputs.first; sock; sock= sock->next)
+ if (sock==fromsock)
break;
- if(sock)
+ if (sock)
from= -1; /* OK but flip */
}
}
else {
/* check tree sockets */
- for(sock= ntree->inputs.first; sock; sock= sock->next)
- if(sock==fromsock)
+ for (sock= ntree->inputs.first; sock; sock= sock->next)
+ if (sock==fromsock)
break;
- if(sock)
+ if (sock)
from= 1; /* OK */
else {
- for(sock= ntree->outputs.first; sock; sock= sock->next)
- if(sock==fromsock)
+ for (sock= ntree->outputs.first; sock; sock= sock->next)
+ if (sock==fromsock)
break;
- if(sock)
+ if (sock)
from= -1; /* OK but flip */
}
}
- if(tonode) {
- for(sock= tonode->inputs.first; sock; sock= sock->next)
- if(sock==tosock)
+ if (tonode) {
+ for (sock= tonode->inputs.first; sock; sock= sock->next)
+ if (sock==tosock)
break;
- if(sock)
+ if (sock)
to= 1; /* OK */
else {
- for(sock= tonode->outputs.first; sock; sock= sock->next)
- if(sock==tosock)
+ for (sock= tonode->outputs.first; sock; sock= sock->next)
+ if (sock==tosock)
break;
- if(sock)
+ if (sock)
to= -1; /* OK but flip */
}
}
else {
/* check tree sockets */
- for(sock= ntree->outputs.first; sock; sock= sock->next)
- if(sock==tosock)
+ for (sock= ntree->outputs.first; sock; sock= sock->next)
+ if (sock==tosock)
break;
- if(sock)
+ if (sock)
to= 1; /* OK */
else {
- for(sock= ntree->inputs.first; sock; sock= sock->next)
- if(sock==tosock)
+ for (sock= ntree->inputs.first; sock; sock= sock->next)
+ if (sock==tosock)
break;
- if(sock)
+ if (sock)
to= -1; /* OK but flip */
}
}
- if(from >= 0 && to >= 0) {
+ if (from >= 0 && to >= 0) {
link= MEM_callocN(sizeof(bNodeLink), "link");
BLI_addtail(&ntree->links, link);
link->fromnode= fromnode;
@@ -504,7 +504,7 @@ bNodeLink *nodeAddLink(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock,
link->tonode= tonode;
link->tosock= tosock;
}
- else if(from <= 0 && to <= 0) {
+ else if (from <= 0 && to <= 0) {
link= MEM_callocN(sizeof(bNodeLink), "link");
BLI_addtail(&ntree->links, link);
link->fromnode= tonode;
@@ -521,7 +521,7 @@ bNodeLink *nodeAddLink(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock,
void nodeRemLink(bNodeTree *ntree, bNodeLink *link)
{
BLI_remlink(&ntree->links, link);
- if(link->tosock)
+ if (link->tosock)
link->tosock->link= NULL;
MEM_freeN(link);
@@ -532,9 +532,9 @@ void nodeRemSocketLinks(bNodeTree *ntree, bNodeSocket *sock)
{
bNodeLink *link, *next;
- for(link= ntree->links.first; link; link= next) {
+ for (link= ntree->links.first; link; link= next) {
next= link->next;
- if(link->fromsock==sock || link->tosock==sock) {
+ if (link->fromsock==sock || link->tosock==sock) {
nodeRemLink(ntree, link);
}
}
@@ -660,7 +660,7 @@ bNodeTree *ntreeAddTree(const char *name, int type, int nodetype)
/* Warning: this function gets called during some rather unexpected times
* - this gets called when executing compositing updates (for threaded previews)
* - when the nodetree datablock needs to be copied (i.e. when users get copied)
- * - for scene duplication use ntreeSwapID() after so we dont have stale pointers.
+ * - for scene duplication use ntreeSwapID() after so we don't have stale pointers.
*/
bNodeTree *ntreeCopyTree(bNodeTree *ntree)
{
@@ -669,14 +669,15 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
bNodeLink *link;
bNodeSocket *gsock, *oldgsock;
- if(ntree==NULL) return NULL;
+ if (ntree==NULL) return NULL;
/* is ntree part of library? */
- for(newtree=G.main->nodetree.first; newtree; newtree= newtree->id.next)
- if(newtree==ntree) break;
- if(newtree) {
+ for (newtree=G.main->nodetree.first; newtree; newtree= newtree->id.next)
+ if (newtree==ntree) break;
+ if (newtree) {
newtree= copy_libblock(&ntree->id);
- } else {
+ }
+ else {
newtree= MEM_dupallocN(ntree);
copy_libblock_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */
}
@@ -690,7 +691,7 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
newtree->links.first= newtree->links.last= NULL;
last = ntree->nodes.last;
- for(node= ntree->nodes.first; node; node= node->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
node->new_node= NULL;
/* nnode= */ nodeCopyNode(newtree, node); /* sets node->new */
@@ -701,14 +702,14 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
/* socket definition for group usage */
BLI_duplicatelist(&newtree->inputs, &ntree->inputs);
- for(gsock= newtree->inputs.first, oldgsock= ntree->inputs.first; gsock; gsock=gsock->next, oldgsock=oldgsock->next) {
+ for (gsock= newtree->inputs.first, oldgsock= ntree->inputs.first; gsock; gsock=gsock->next, oldgsock=oldgsock->next) {
oldgsock->new_sock= gsock;
gsock->groupsock = (oldgsock->groupsock ? oldgsock->groupsock->new_sock : NULL);
gsock->default_value = node_socket_make_default_value(oldgsock->type);
node_socket_copy_default_value(oldgsock->type, gsock->default_value, oldgsock->default_value);
}
BLI_duplicatelist(&newtree->outputs, &ntree->outputs);
- for(gsock= newtree->outputs.first, oldgsock= ntree->outputs.first; gsock; gsock=gsock->next, oldgsock=oldgsock->next) {
+ for (gsock= newtree->outputs.first, oldgsock= ntree->outputs.first; gsock; gsock=gsock->next, oldgsock=oldgsock->next) {
oldgsock->new_sock= gsock;
gsock->groupsock = (oldgsock->groupsock ? oldgsock->groupsock->new_sock : NULL);
gsock->default_value = node_socket_make_default_value(oldgsock->type);
@@ -717,7 +718,7 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
/* copy links */
BLI_duplicatelist(&newtree->links, &ntree->links);
- for(link= newtree->links.first; link; link= link->next) {
+ for (link= newtree->links.first; link; link= link->next) {
link->fromnode = (link->fromnode ? link->fromnode->new_node : NULL);
link->fromsock = (link->fromsock ? link->fromsock->new_sock : NULL);
link->tonode = (link->tonode ? link->tonode->new_node : NULL);
@@ -741,8 +742,8 @@ void ntreeSwitchID(bNodeTree *ntree, ID *id_from, ID *id_to)
{
bNode *node;
/* for scene duplication only */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->id==id_from) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->id==id_from) {
node->id= id_to;
}
}
@@ -753,8 +754,8 @@ void ntreeSwitchID(bNodeTree *ntree, ID *id_from, ID *id_to)
void nodeFreePreview(bNode *node)
{
- if(node->preview) {
- if(node->preview->rect)
+ if (node->preview) {
+ if (node->preview->rect)
MEM_freeN(node->preview->rect);
MEM_freeN(node->preview);
node->preview= NULL;
@@ -764,24 +765,24 @@ void nodeFreePreview(bNode *node)
static void node_init_preview(bNode *node, int xsize, int ysize)
{
- if(node->preview==NULL) {
+ if (node->preview==NULL) {
node->preview= MEM_callocN(sizeof(bNodePreview), "node preview");
// printf("added preview %s\n", node->name);
}
/* node previews can get added with variable size this way */
- if(xsize==0 || ysize==0)
+ if (xsize==0 || ysize==0)
return;
/* sanity checks & initialize */
- if(node->preview->rect) {
- if(node->preview->xsize!=xsize && node->preview->ysize!=ysize) {
+ if (node->preview->rect) {
+ if (node->preview->xsize!=xsize && node->preview->ysize!=ysize) {
MEM_freeN(node->preview->rect);
node->preview->rect= NULL;
}
}
- if(node->preview->rect==NULL) {
+ if (node->preview->rect==NULL) {
node->preview->rect= MEM_callocN(4*xsize + xsize*ysize*sizeof(char)*4, "node preview rect");
node->preview->xsize= xsize;
node->preview->ysize= ysize;
@@ -793,20 +794,20 @@ void ntreeInitPreview(bNodeTree *ntree, int xsize, int ysize)
{
bNode *node;
- if(ntree==NULL)
+ if (ntree==NULL)
return;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->typeinfo->flag & NODE_PREVIEW) /* hrms, check for closed nodes? */
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->typeinfo->flag & NODE_PREVIEW) /* hrms, check for closed nodes? */
node_init_preview(node, xsize, ysize);
- if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
+ if (node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
ntreeInitPreview((bNodeTree *)node->id, xsize, ysize);
}
}
static void nodeClearPreview(bNode *node)
{
- if(node->preview && node->preview->rect)
+ if (node->preview && node->preview->rect)
memset(node->preview->rect, 0, MEM_allocN_len(node->preview->rect));
}
@@ -815,13 +816,13 @@ void ntreeClearPreview(bNodeTree *ntree)
{
bNode *node;
- if(ntree==NULL)
+ if (ntree==NULL)
return;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->typeinfo->flag & NODE_PREVIEW)
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->typeinfo->flag & NODE_PREVIEW)
nodeClearPreview(node);
- if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
+ if (node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
ntreeClearPreview((bNodeTree *)node->id);
}
}
@@ -832,12 +833,12 @@ void ntreeClearPreview(bNodeTree *ntree)
void nodeAddToPreview(bNode *node, float *col, int x, int y, int do_manage)
{
bNodePreview *preview= node->preview;
- if(preview) {
- if(x>=0 && y>=0) {
- if(x<preview->xsize && y<preview->ysize) {
+ if (preview) {
+ if (x>=0 && y>=0) {
+ if (x<preview->xsize && y<preview->ysize) {
unsigned char *tar= preview->rect+ 4*((preview->xsize*y) + x);
- if(do_manage) {
+ if (do_manage) {
linearrgb_to_srgb_uchar4(tar, col);
}
else {
@@ -859,25 +860,25 @@ void nodeUnlinkNode(bNodeTree *ntree, bNode *node)
bNodeSocket *sock;
ListBase *lb;
- for(link= ntree->links.first; link; link= next) {
+ for (link= ntree->links.first; link; link= next) {
next= link->next;
- if(link->fromnode==node) {
+ if (link->fromnode==node) {
lb= &node->outputs;
if (link->tonode)
link->tonode->update |= NODE_UPDATE;
}
- else if(link->tonode==node)
+ else if (link->tonode==node)
lb= &node->inputs;
else
lb= NULL;
- if(lb) {
- for(sock= lb->first; sock; sock= sock->next) {
- if(link->fromsock==sock || link->tosock==sock)
+ if (lb) {
+ for (sock= lb->first; sock; sock= sock->next) {
+ if (link->fromsock==sock || link->tosock==sock)
break;
}
- if(sock) {
+ if (sock) {
nodeRemLink(ntree, link);
}
}
@@ -909,7 +910,7 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node)
if (treetype->free_node_cache)
treetype->free_node_cache(ntree, node);
- if(node->typeinfo && node->typeinfo->freestoragefunc)
+ if (node->typeinfo && node->typeinfo->freestoragefunc)
node->typeinfo->freestoragefunc(node);
for (sock=node->inputs.first; sock; sock = nextsock) {
@@ -936,7 +937,7 @@ void ntreeFreeTree(bNodeTree *ntree)
bNode *node, *next;
bNodeSocket *sock;
- if(ntree==NULL) return;
+ if (ntree==NULL) return;
/* XXX hack! node trees should not store execution graphs at all.
* This should be removed when old tree types no longer require it.
@@ -963,7 +964,7 @@ void ntreeFreeTree(bNodeTree *ntree)
BLI_freelistN(&ntree->links); /* do first, then unlink_node goes fast */
- for(node= ntree->nodes.first; node; node= next) {
+ for (node= ntree->nodes.first; node; node= next) {
next= node->next;
nodeFreeNode(ntree, node);
}
@@ -980,7 +981,7 @@ void ntreeFreeCache(bNodeTree *ntree)
{
bNodeTreeType *treetype;
- if(ntree==NULL) return;
+ if (ntree==NULL) return;
treetype= ntreeGetType(ntree->type);
if (treetype->free_cache)
@@ -992,45 +993,45 @@ void ntreeSetOutput(bNodeTree *ntree)
bNode *node;
/* find the active outputs, might become tree type dependent handler */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
bNode *tnode;
int output= 0;
/* we need a check for which output node should be tagged like this, below an exception */
- if(node->type==CMP_NODE_OUTPUT_FILE)
+ if (node->type==CMP_NODE_OUTPUT_FILE)
continue;
/* there is more types having output class, each one is checked */
- for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) {
- if(tnode->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+ for (tnode= ntree->nodes.first; tnode; tnode= tnode->next) {
+ if (tnode->typeinfo->nclass==NODE_CLASS_OUTPUT) {
- if(ntree->type==NTREE_COMPOSIT) {
+ if (ntree->type==NTREE_COMPOSIT) {
/* same type, exception for viewer */
- if(tnode->type==node->type ||
+ if (tnode->type==node->type ||
(ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) &&
ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))) {
- if(tnode->flag & NODE_DO_OUTPUT) {
+ if (tnode->flag & NODE_DO_OUTPUT) {
output++;
- if(output>1)
+ if (output>1)
tnode->flag &= ~NODE_DO_OUTPUT;
}
}
}
else {
/* same type */
- if(tnode->type==node->type) {
- if(tnode->flag & NODE_DO_OUTPUT) {
+ if (tnode->type==node->type) {
+ if (tnode->flag & NODE_DO_OUTPUT) {
output++;
- if(output>1)
+ if (output>1)
tnode->flag &= ~NODE_DO_OUTPUT;
}
}
}
}
}
- if(output==0)
+ if (output==0)
node->flag |= NODE_DO_OUTPUT;
}
}
@@ -1051,9 +1052,9 @@ static void ntreeMakeLocal_CheckLocal(void *calldata, ID *owner_id, bNodeTree *n
bNode *node;
/* find if group is in tree */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->id == cd->group_id) {
- if(owner_id->lib) cd->lib= 1;
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->id == cd->group_id) {
+ if (owner_id->lib) cd->lib= 1;
else cd->local= 1;
}
}
@@ -1065,9 +1066,9 @@ static void ntreeMakeLocal_LinkNew(void *calldata, ID *owner_id, bNodeTree *ntre
bNode *node;
/* find if group is in tree */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->id == cd->group_id) {
- if(owner_id->lib==NULL) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->id == cd->group_id) {
+ if (owner_id->lib==NULL) {
node->id= cd->new_id;
cd->new_id->us++;
cd->group_id->us--;
@@ -1087,8 +1088,8 @@ void ntreeMakeLocal(bNodeTree *ntree)
* - mixed: make copy
*/
- if(ntree->id.lib==NULL) return;
- if(ntree->id.us==1) {
+ if (ntree->id.lib==NULL) return;
+ if (ntree->id.us==1) {
id_clear_lib_data(bmain, (ID *)ntree);
return;
}
@@ -1102,10 +1103,10 @@ void ntreeMakeLocal(bNodeTree *ntree)
treetype->foreach_nodetree(G.main, &cd, &ntreeMakeLocal_CheckLocal);
/* if all users are local, we simply make tree local */
- if(cd.local && cd.lib==0) {
+ if (cd.local && cd.lib==0) {
id_clear_lib_data(bmain, (ID *)ntree);
}
- else if(cd.local && cd.lib) {
+ else if (cd.local && cd.lib) {
/* this is the mixed case, we copy the tree and assign it to local users */
bNodeTree *newtree= ntreeCopyTree(ntree);
@@ -1120,8 +1121,8 @@ void ntreeMakeLocal(bNodeTree *ntree)
int ntreeNodeExists(bNodeTree *ntree, bNode *testnode)
{
bNode *node= ntree->nodes.first;
- for(; node; node= node->next)
- if(node==testnode)
+ for (; node; node= node->next)
+ if (node==testnode)
return 1;
return 0;
}
@@ -1129,8 +1130,8 @@ int ntreeNodeExists(bNodeTree *ntree, bNode *testnode)
int ntreeOutputExists(bNode *node, bNodeSocket *testsock)
{
bNodeSocket *sock= node->outputs.first;
- for(; sock; sock= sock->next)
- if(sock==testsock)
+ for (; sock; sock= sock->next)
+ if (sock==testsock)
return 1;
return 0;
}
@@ -1146,10 +1147,10 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
bAction *action_backup= NULL, *tmpact_backup= NULL;
/* Workaround for copying an action on each render!
- * set action to NULL so animdata actions dont get copied */
+ * set action to NULL so animdata actions don't get copied */
AnimData *adt= BKE_animdata_from_id(&ntree->id);
- if(adt) {
+ if (adt) {
action_backup= adt->action;
tmpact_backup= adt->tmpact;
@@ -1160,14 +1161,14 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
/* node copy func */
ltree= ntreeCopyTree(ntree);
- if(adt) {
+ if (adt) {
AnimData *ladt= BKE_animdata_from_id(&ltree->id);
adt->action= ladt->action= action_backup;
adt->tmpact= ladt->tmpact= tmpact_backup;
- if(action_backup) action_backup->id.us++;
- if(tmpact_backup) tmpact_backup->id.us++;
+ if (action_backup) action_backup->id.us++;
+ if (tmpact_backup) tmpact_backup->id.us++;
}
/* end animdata uglyness */
@@ -1175,7 +1176,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
/* ensures only a single output node is enabled */
ntreeSetOutput(ntree);
- for(node= ntree->nodes.first; node; node= node->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
/* store new_node pointer to original */
node->new_node->new_node= node;
}
@@ -1205,9 +1206,9 @@ void ntreeLocalMerge(bNodeTree *localtree, bNodeTree *ntree)
bNode *lnode;
/* move over the compbufs and previews */
- for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
- if(ntreeNodeExists(ntree, lnode->new_node)) {
- if(lnode->preview && lnode->preview->rect) {
+ for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+ if (ntreeNodeExists(ntree, lnode->new_node)) {
+ if (lnode->preview && lnode->preview->rect) {
nodeFreePreview(lnode->new_node);
lnode->new_node->preview= lnode->preview;
lnode->preview= NULL;
@@ -1228,9 +1229,9 @@ int ntreeHasType(bNodeTree *ntree, int type)
{
bNode *node;
- if(ntree)
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->type == type)
+ if (ntree)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->type == type)
return 1;
return 0;
}
@@ -1239,10 +1240,10 @@ bNodeLink *nodeFindLink(bNodeTree *ntree, bNodeSocket *from, bNodeSocket *to)
{
bNodeLink *link;
- for(link= ntree->links.first; link; link= link->next) {
- if(link->fromsock==from && link->tosock==to)
+ for (link= ntree->links.first; link; link= link->next) {
+ if (link->fromsock==from && link->tosock==to)
return link;
- if(link->fromsock==to && link->tosock==from) /* hrms? */
+ if (link->fromsock==to && link->tosock==from) /* hrms? */
return link;
}
return NULL;
@@ -1253,8 +1254,8 @@ int nodeCountSocketLinks(bNodeTree *ntree, bNodeSocket *sock)
bNodeLink *link;
int tot= 0;
- for(link= ntree->links.first; link; link= link->next) {
- if(link->fromsock==sock || link->tosock==sock)
+ for (link= ntree->links.first; link; link= link->next) {
+ if (link->fromsock==sock || link->tosock==sock)
tot++;
}
return tot;
@@ -1264,10 +1265,10 @@ bNode *nodeGetActive(bNodeTree *ntree)
{
bNode *node;
- if(ntree==NULL) return NULL;
+ if (ntree==NULL) return NULL;
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->flag & NODE_ACTIVE)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->flag & NODE_ACTIVE)
break;
return node;
}
@@ -1277,20 +1278,20 @@ bNode *nodeGetActiveID(bNodeTree *ntree, short idtype)
{
bNode *node;
- if(ntree==NULL) return NULL;
+ if (ntree==NULL) return NULL;
/* check for group edit */
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->flag & NODE_GROUP_EDIT)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->flag & NODE_GROUP_EDIT)
break;
- if(node)
+ if (node)
ntree= (bNodeTree*)node->id;
/* now find active node with this id */
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->id && GS(node->id->name)==idtype)
- if(node->flag & NODE_ACTIVE_ID)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->id && GS(node->id->name)==idtype)
+ if (node->flag & NODE_ACTIVE_ID)
break;
return node;
@@ -1301,23 +1302,24 @@ int nodeSetActiveID(bNodeTree *ntree, short idtype, ID *id)
bNode *node;
int ok= FALSE;
- if(ntree==NULL) return ok;
+ if (ntree==NULL) return ok;
/* check for group edit */
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->flag & NODE_GROUP_EDIT)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->flag & NODE_GROUP_EDIT)
break;
- if(node)
+ if (node)
ntree= (bNodeTree*)node->id;
/* now find active node with this id */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->id && GS(node->id->name)==idtype) {
- if(id && ok==FALSE && node->id==id) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->id && GS(node->id->name)==idtype) {
+ if (id && ok==FALSE && node->id==id) {
node->flag |= NODE_ACTIVE_ID;
ok= TRUE;
- } else {
+ }
+ else {
node->flag &= ~NODE_ACTIVE_ID;
}
}
@@ -1332,10 +1334,10 @@ void nodeClearActiveID(bNodeTree *ntree, short idtype)
{
bNode *node;
- if(ntree==NULL) return;
+ if (ntree==NULL) return;
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->id && GS(node->id->name)==idtype)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->id && GS(node->id->name)==idtype)
node->flag &= ~NODE_ACTIVE_ID;
}
@@ -1345,21 +1347,21 @@ void nodeSetActive(bNodeTree *ntree, bNode *node)
bNode *tnode;
/* make sure only one node is active, and only one per ID type */
- for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) {
+ for (tnode= ntree->nodes.first; tnode; tnode= tnode->next) {
tnode->flag &= ~NODE_ACTIVE;
- if(node->id && tnode->id) {
- if(GS(node->id->name) == GS(tnode->id->name))
+ if (node->id && tnode->id) {
+ if (GS(node->id->name) == GS(tnode->id->name))
tnode->flag &= ~NODE_ACTIVE_ID;
}
- if(node->typeinfo->nclass == NODE_CLASS_TEXTURE)
+ if (node->typeinfo->nclass == NODE_CLASS_TEXTURE)
tnode->flag &= ~NODE_ACTIVE_TEXTURE;
}
node->flag |= NODE_ACTIVE;
- if(node->id)
+ if (node->id)
node->flag |= NODE_ACTIVE_ID;
- if(node->typeinfo->nclass == NODE_CLASS_TEXTURE)
+ if (node->typeinfo->nclass == NODE_CLASS_TEXTURE)
node->flag |= NODE_ACTIVE_TEXTURE;
}
@@ -1393,10 +1395,10 @@ static int node_get_deplist_recurs(bNode *node, bNode ***nsort)
node->done= 1;
/* check linked nodes */
- for(sock= node->inputs.first; sock; sock= sock->next) {
- if(sock->link) {
+ for (sock= node->inputs.first; sock; sock= sock->next) {
+ if (sock->link) {
fromnode= sock->link->fromnode;
- if(fromnode) {
+ if (fromnode) {
if (fromnode->done==0)
fromnode->level= node_get_deplist_recurs(fromnode, nsort);
if (fromnode->level <= level)
@@ -1428,11 +1430,11 @@ void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, in
*totnodes=0;
/* first clear data */
- for(node= ntree->nodes.first; node; node= node->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
node->done= 0;
(*totnodes)++;
}
- if(*totnodes==0) {
+ if (*totnodes==0) {
*deplist = NULL;
return;
}
@@ -1440,8 +1442,8 @@ void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, in
nsort= *deplist= MEM_callocN((*totnodes)*sizeof(bNode*), "sorted node array");
/* recursive check */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->done==0) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->done==0) {
node->level= node_get_deplist_recurs(node, &nsort);
}
}
@@ -1453,13 +1455,13 @@ static void ntree_update_node_level(bNodeTree *ntree)
bNode *node;
/* first clear tag */
- for(node= ntree->nodes.first; node; node= node->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
node->done= 0;
}
/* recursive check */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->done==0) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->done==0) {
node->level= node_get_deplist_recurs(node, NULL);
}
}
@@ -1472,24 +1474,24 @@ static void ntree_update_link_pointers(bNodeTree *ntree)
bNodeLink *link;
/* first clear data */
- for(node= ntree->nodes.first; node; node= node->next) {
- for(sock= node->inputs.first; sock; sock= sock->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ for (sock= node->inputs.first; sock; sock= sock->next) {
sock->link= NULL;
sock->flag &= ~SOCK_IN_USE;
}
- for(sock= node->outputs.first; sock; sock= sock->next) {
+ for (sock= node->outputs.first; sock; sock= sock->next) {
sock->flag &= ~SOCK_IN_USE;
}
}
- for(sock= ntree->inputs.first; sock; sock= sock->next) {
+ for (sock= ntree->inputs.first; sock; sock= sock->next) {
sock->flag &= ~SOCK_IN_USE;
}
- for(sock= ntree->outputs.first; sock; sock= sock->next) {
+ for (sock= ntree->outputs.first; sock; sock= sock->next) {
sock->link= NULL;
sock->flag &= ~SOCK_IN_USE;
}
- for(link= ntree->links.first; link; link= link->next) {
+ for (link= ntree->links.first; link; link= link->next) {
link->tosock->link= link;
link->fromsock->flag |= SOCK_IN_USE;
@@ -1543,13 +1545,13 @@ void ntreeUpdateTree(bNodeTree *ntree)
bNodeTreeType *ntreetype= ntreeGetType(ntree->type);
bNode *node;
- /* set the bNodeSocket->link pointers */
- if (ntree->update & NTREE_UPDATE_LINKS)
+ if (ntree->update & (NTREE_UPDATE_LINKS|NTREE_UPDATE_NODES)) {
+ /* set the bNodeSocket->link pointers */
ntree_update_link_pointers(ntree);
-
- /* update the node level from link dependencies */
- if (ntree->update & (NTREE_UPDATE_LINKS|NTREE_UPDATE_NODES))
+
+ /* update the node level from link dependencies */
ntree_update_node_level(ntree);
+ }
/* update individual nodes */
for (node=ntree->nodes.first; node; node=node->next) {
@@ -1605,14 +1607,14 @@ int nodeUpdateID(bNodeTree *ntree, ID *id)
bNode *node;
int change = FALSE;
- if(ELEM(NULL, id, ntree))
+ if (ELEM(NULL, id, ntree))
return change;
ntreetype = ntreeGetType(ntree->type);
if (ntreetype->update_node) {
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->id==id) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->id==id) {
change = TRUE;
ntreetype->update_node(ntree, node);
/* clear update flag */
@@ -1621,8 +1623,8 @@ int nodeUpdateID(bNodeTree *ntree, ID *id)
}
}
else {
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->id==id) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->id==id) {
change = TRUE;
if (node->typeinfo->updatefunc)
node->typeinfo->updatefunc(ntree, node);
@@ -1658,7 +1660,7 @@ const char* nodeLabel(bNode *node)
else if (node->typeinfo->labelfunc)
return node->typeinfo->labelfunc(node);
else
- return node->typeinfo->name;
+ return IFACE_(node->typeinfo->name);
}
struct bNodeTree *nodeGroupEditGet(struct bNode *node)
@@ -1706,7 +1708,7 @@ void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char
ntype->flag = flag;
/* Default muting stuff. */
- if(ttype)
+ if (ttype)
ntype->internal_connect = ttype->internal_connect;
/* default size values */
@@ -1827,8 +1829,8 @@ static bNodeType *is_nodetype_registered(ListBase *typelist, int type)
{
bNodeType *ntype= typelist->first;
- for(;ntype; ntype= ntype->next )
- if(ntype->type==type)
+ for (;ntype; ntype= ntype->next )
+ if (ntype->type==type)
return ntype;
return NULL;
@@ -1839,7 +1841,7 @@ void nodeRegisterType(bNodeTreeType *ttype, bNodeType *ntype)
ListBase *typelist = &(ttype->node_types);
bNodeType *found= is_nodetype_registered(typelist, ntype->type);
- if(found==NULL)
+ if (found==NULL)
BLI_addtail(typelist, ntype);
}
@@ -1911,7 +1913,7 @@ static void registerCompositNodes(bNodeTreeType *ttype)
register_node_type_cmp_channel_matte(ttype);
register_node_type_cmp_color_spill(ttype);
register_node_type_cmp_luma_matte(ttype);
- register_node_type_cmp_doubleedgemask(ttype);
+ register_node_type_cmp_doubleedgemask(ttype);
register_node_type_cmp_translate(ttype);
register_node_type_cmp_rotate(ttype);
@@ -2048,14 +2050,14 @@ static void registerTextureNodes(bNodeTreeType *ttype)
static void free_dynamic_typeinfo(bNodeType *ntype)
{
- if(ntype->type==NODE_DYNAMIC) {
- if(ntype->inputs) {
+ if (ntype->type==NODE_DYNAMIC) {
+ if (ntype->inputs) {
MEM_freeN(ntype->inputs);
}
- if(ntype->outputs) {
+ if (ntype->outputs) {
MEM_freeN(ntype->outputs);
}
- if(ntype->name) {
+ if (ntype->name) {
MEM_freeN((void *)ntype->name);
}
}
@@ -2064,13 +2066,13 @@ static void free_dynamic_typeinfo(bNodeType *ntype)
static void free_typeinfos(ListBase *list)
{
bNodeType *ntype, *next;
- for(ntype=list->first; ntype; ntype=next) {
+ for (ntype=list->first; ntype; ntype=next) {
next = ntype->next;
- if(ntype->type==NODE_DYNAMIC)
+ if (ntype->type==NODE_DYNAMIC)
free_dynamic_typeinfo(ntype);
- if(ntype->needs_free)
+ if (ntype->needs_free)
MEM_freeN(ntype);
}
}
@@ -2099,11 +2101,11 @@ void clear_scene_in_nodes(Main *bmain, Scene *sce)
Scene *sce1;
bNode *node;
- for(sce1= bmain->scene.first; sce1; sce1=sce1->id.next) {
- if(sce1!=sce) {
- if(sce1->nodetree) {
- for(node= sce1->nodetree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS) {
+ for (sce1= bmain->scene.first; sce1; sce1=sce1->id.next) {
+ if (sce1!=sce) {
+ if (sce1->nodetree) {
+ for (node= sce1->nodetree->nodes.first; node; node= node->next) {
+ if (node->type==CMP_NODE_R_LAYERS) {
Scene *nodesce= (Scene *)node->id;
if (nodesce==sce) node->id = NULL;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 50674a7f6c0..01fbc97a4a0 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -201,16 +201,40 @@ void object_free_modifiers(Object *ob)
object_free_softbody(ob);
}
+int object_support_modifier_type(Object *ob, int modifier_type)
+{
+ ModifierTypeInfo *mti;
+
+ mti = modifierType_getInfo(modifier_type);
+
+ if (!((mti->flags & eModifierTypeFlag_AcceptsCVs) ||
+ (ob->type==OB_MESH && (mti->flags & eModifierTypeFlag_AcceptsMesh))))
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
void object_link_modifiers(struct Object *ob, struct Object *from)
{
ModifierData *md;
object_free_modifiers(ob);
+ if (!ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
+ /* only objects listed above can have modifiers and linking them to objects
+ * which doesn't have modifiers stack is quite silly */
+ return;
+ }
+
for (md=from->modifiers.first; md; md=md->next) {
ModifierData *nmd = NULL;
if (ELEM4(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_ParticleInstance, eModifierType_Collision)) continue;
+ if (!object_support_modifier_type(ob, md->type))
+ continue;
+
nmd = modifier_new(md->type);
modifier_copyData(md, nmd);
BLI_addtail(&ob->modifiers, nmd);
@@ -964,6 +988,11 @@ void copy_object_particlesystems(Object *obn, Object *ob)
ParticleSystem *psys, *npsys;
ModifierData *md;
+ if (obn->type != OB_MESH) {
+ /* currently only mesh objects can have soft body */
+ return;
+ }
+
obn->particlesystem.first= obn->particlesystem.last= NULL;
for (psys=ob->particlesystem.first; psys; psys=psys->next) {
npsys= copy_particlesystem(psys);
@@ -1374,7 +1403,7 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
ob->mat = MEM_dupallocN(target->mat);
ob->matbits = MEM_dupallocN(target->matbits);
for (i=0; i<target->totcol; i++) {
- /* dont need to run test_object_materials since we know this object is new and not used elsewhere */
+ /* don't need to run test_object_materials since we know this object is new and not used elsewhere */
id_us_plus((ID *)ob->mat[i]);
}
}
@@ -1770,9 +1799,11 @@ static void give_parvert(Object *par, int nr, float vec[3])
if (count==0) {
/* keep as 0,0,0 */
- } else if (count > 0) {
+ }
+ else if (count > 0) {
mul_v3_fl(vec, 1.0f / count);
- } else {
+ }
+ else {
/* use first index if its out of range */
dm->getVertCo(dm, 0, vec);
}
@@ -2018,7 +2049,7 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
if (simul) {
copy_v3_v3(totmat[3], par->obmat[3]);
}
- else{
+ else {
give_parvert(par, ob->par1, vec);
mul_v3_m4v3(totmat[3], par->obmat, vec);
}
@@ -2044,7 +2075,7 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
if (simul) {
}
- else{
+ else {
// external usable originmat
copy_m3_m4(originmat, tmat);
@@ -2194,8 +2225,9 @@ void object_get_dimensions(Object *ob, float vec[3])
vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
vec[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
- } else {
- vec[0] = vec[1] = vec[2] = 0.f;
+ }
+ else {
+ zero_v3(vec);
}
}
@@ -2307,7 +2339,8 @@ int minmax_object_duplis(Scene *scene, Object *ob, float min[3], float max[3])
int ok= 0;
if ((ob->transflag & OB_DUPLI)==0) {
return ok;
- } else {
+ }
+ else {
ListBase *lb;
DupliObject *dob;
@@ -2676,7 +2709,8 @@ void object_sculpt_modifiers_changed(Object *ob)
}
free_sculptsession_deformMats(ob->sculpt);
- } else {
+ }
+ else {
PBVHNode **nodes;
int n, totnode;
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 87929d6a185..ae13613fc14 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -355,7 +355,8 @@ void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u,float
if (oc->_do_chop) {
ocr->disp[0] = BILERP(oc->_disp_x);
ocr->disp[2] = BILERP(oc->_disp_z);
- } else {
+ }
+ else {
ocr->disp[0] = 0.0;
ocr->disp[2] = 0.0;
}
@@ -760,7 +761,7 @@ static void set_height_normalize_factor(struct Ocean *oc)
{
for (j = 0; j < oc->_N; ++j)
{
- if( max_h < fabsf(oc->_disp_y[i*oc->_N+j]))
+ if ( max_h < fabsf(oc->_disp_y[i*oc->_N+j]))
{
max_h = fabsf(oc->_disp_y[i*oc->_N+j]);
}
@@ -916,7 +917,7 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
void BKE_free_ocean_data(struct Ocean *oc)
{
- if(!oc) return;
+ if (!oc) return;
BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_WRITE);
@@ -963,7 +964,7 @@ void BKE_free_ocean_data(struct Ocean *oc)
if (oc->_fft_in)
MEM_freeN(oc->_fft_in);
- /* check that ocean data has been initialised */
+ /* check that ocean data has been initialized */
if (oc->_htilda) {
MEM_freeN(oc->_htilda);
MEM_freeN(oc->_k);
@@ -978,7 +979,7 @@ void BKE_free_ocean_data(struct Ocean *oc)
void BKE_free_ocean(struct Ocean *oc)
{
- if(!oc) return;
+ if (!oc) return;
BKE_free_ocean_data(oc);
BLI_rw_mutex_end(&oc->oceanmutex);
@@ -1299,18 +1300,18 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
/* write the images */
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_DISPLACE);
- if(0 == BKE_write_ibuf(ibuf_disp, string, &imf))
+ if (0 == BKE_write_ibuf(ibuf_disp, string, &imf))
printf("Cannot save Displacement File Output to %s\n", string);
if (o->_do_jacobian) {
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_FOAM);
- if(0 == BKE_write_ibuf(ibuf_foam, string, &imf))
+ if (0 == BKE_write_ibuf(ibuf_foam, string, &imf))
printf("Cannot save Foam File Output to %s\n", string);
}
if (o->_do_normals) {
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_NORMAL);
- if(0 == BKE_write_ibuf(ibuf_normal, string, &imf))
+ if (0 == BKE_write_ibuf(ibuf_normal, string, &imf))
printf("Cannot save Normal File Output to %s\n", string);
}
@@ -1389,7 +1390,7 @@ void BKE_free_ocean_data(struct Ocean *UNUSED(oc))
void BKE_free_ocean(struct Ocean *oc)
{
- if(!oc) return;
+ if (!oc) return;
MEM_freeN(oc);
}
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index aaf15d683d8..8a940e339bc 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -87,7 +87,8 @@ int seekPackedFile(PackedFile *pf, int offset, int whence)
}
if (seek < 0) {
seek = 0;
- } else if (seek > pf->size) {
+ }
+ else if (seek > pf->size) {
seek = pf->size;
}
pf->seek = seek;
@@ -110,12 +111,14 @@ int readPackedFile(PackedFile *pf, void *data, int size)
if (size > 0) {
memcpy(data, ((char *) pf->data) + pf->seek, size);
- } else {
+ }
+ else {
size = 0;
}
pf->seek += size;
- } else {
+ }
+ else {
size = -1;
}
@@ -130,16 +133,16 @@ int countPackedFiles(Main *bmain)
int count = 0;
// let's check if there are packed files...
- for(ima=bmain->image.first; ima; ima=ima->id.next)
- if(ima->packedfile)
+ for (ima=bmain->image.first; ima; ima=ima->id.next)
+ if (ima->packedfile)
count++;
- for(vf=bmain->vfont.first; vf; vf=vf->id.next)
- if(vf->packedfile)
+ for (vf=bmain->vfont.first; vf; vf=vf->id.next)
+ if (vf->packedfile)
count++;
- for(sound=bmain->sound.first; sound; sound=sound->id.next)
- if(sound->packedfile)
+ for (sound=bmain->sound.first; sound; sound=sound->id.next)
+ if (sound->packedfile)
count++;
return count;
@@ -147,7 +150,7 @@ int countPackedFiles(Main *bmain)
void freePackedFile(PackedFile *pf)
{
- if(pf) {
+ if (pf) {
MEM_freeN(pf->data);
MEM_freeN(pf);
}
@@ -173,7 +176,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
/* render result has no filename and can be ignored
* any other files with no name can be ignored too */
- if(filename[0]=='\0')
+ if (filename[0]=='\0')
return NULL;
//XXX waitcursor(1);
@@ -186,17 +189,19 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
// open the file
// and create a PackedFile structure
- file= open(name, O_BINARY|O_RDONLY);
+ file= BLI_open(name, O_BINARY|O_RDONLY,0);
if (file <= 0) {
BKE_reportf(reports, RPT_ERROR, "Unable to pack file, source path not found: \"%s\"", name);
- } else {
+ }
+ else {
filelen = BLI_file_descriptor_size(file);
if (filelen == 0) {
// MEM_mallocN complains about MEM_mallocN(0, "bla");
// we don't care....
data = MEM_mallocN(1, "packFile");
- } else {
+ }
+ else {
data = MEM_mallocN(filelen, "packFile");
}
if (read(file, data, filelen) == filelen) {
@@ -217,23 +222,23 @@ void packAll(Main *bmain, ReportList *reports)
VFont *vf;
bSound *sound;
- for(ima=bmain->image.first; ima; ima=ima->id.next) {
- if(ima->packedfile == NULL && ima->id.lib==NULL) {
- if(ima->source==IMA_SRC_FILE) {
+ for (ima=bmain->image.first; ima; ima=ima->id.next) {
+ if (ima->packedfile == NULL && ima->id.lib==NULL) {
+ if (ima->source==IMA_SRC_FILE) {
ima->packedfile = newPackedFile(reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
}
- else if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
+ else if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported.", ima->id.name+2);
}
}
}
- for(vf=bmain->vfont.first; vf; vf=vf->id.next)
- if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, FO_BUILTIN_NAME) != 0)
+ for (vf=bmain->vfont.first; vf; vf=vf->id.next)
+ if (vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, FO_BUILTIN_NAME) != 0)
vf->packedfile = newPackedFile(reports, vf->name, bmain->name);
- for(sound=bmain->sound.first; sound; sound=sound->id.next)
- if(sound->packedfile == NULL && sound->id.lib==NULL)
+ for (sound=bmain->sound.first; sound; sound=sound->id.next)
+ if (sound->packedfile == NULL && sound->id.lib==NULL)
sound->packedfile = newPackedFile(reports, sound->name, bmain->name);
}
@@ -292,14 +297,15 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
// make sure the path to the file exists...
BLI_make_existing_file(name);
- file = open(name, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666);
+ file = BLI_open(name, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666);
if (file >= 0) {
if (write(file, pf->data, pf->size) != pf->size) {
BKE_reportf(reports, RPT_ERROR, "Error writing file: %s", name);
ret_value = RET_ERROR;
}
close(file);
- } else {
+ }
+ else {
BKE_reportf(reports, RPT_ERROR, "Error creating file: %s", name);
ret_value = RET_ERROR;
}
@@ -309,14 +315,15 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
if (BLI_rename(tempname, name) != 0) {
BKE_reportf(reports, RPT_ERROR, "Error restoring tempfile. Check files: '%s' '%s'", tempname, name);
}
- } else {
+ }
+ else {
if (BLI_delete(tempname, 0, 0) != 0) {
BKE_reportf(reports, RPT_ERROR, "Error deleting '%s' (ignored)", tempname);
}
}
}
- if(guimode) {} //XXX waitcursor(0);
+ if (guimode) {} //XXX waitcursor(0);
return (ret_value);
}
@@ -342,15 +349,18 @@ int checkPackedFile(const char *filename, PackedFile *pf)
if (stat(name, &st)) {
ret_val = PF_NOFILE;
- } else if (st.st_size != pf->size) {
+ }
+ else if (st.st_size != pf->size) {
ret_val = PF_DIFFERS;
- } else {
+ }
+ else {
// we'll have to compare the two...
- file = open(name, O_BINARY | O_RDONLY);
+ file = BLI_open(name, O_BINARY | O_RDONLY, 0);
if (file < 0) {
ret_val = PF_NOFILE;
- } else {
+ }
+ else {
ret_val = PF_EQUAL;
for (i = 0; i < pf->size; i += sizeof(buf)) {
@@ -363,7 +373,8 @@ int checkPackedFile(const char *filename, PackedFile *pf)
// read error ...
ret_val = PF_DIFFERS;
break;
- } else {
+ }
+ else {
if (memcmp(buf, ((char *)pf->data) + i, len)) {
ret_val = PF_DIFFERS;
break;
@@ -497,7 +508,7 @@ int unpackImage(ReportList *reports, Image *ima, int how)
char *newname;
int ret_value = RET_ERROR;
- if (ima != NULL) {
+ if (ima != NULL && ima->name[0]) {
BLI_strncpy(localname, ima->name, sizeof(localname));
BLI_splitdirstring(localname, fi);
BLI_snprintf(localname, sizeof(localname), "//textures/%s", fi);
@@ -522,16 +533,16 @@ void unpackAll(Main *bmain, ReportList *reports, int how)
VFont *vf;
bSound *sound;
- for(ima=bmain->image.first; ima; ima=ima->id.next)
- if(ima->packedfile)
+ for (ima=bmain->image.first; ima; ima=ima->id.next)
+ if (ima->packedfile)
unpackImage(reports, ima, how);
- for(vf=bmain->vfont.first; vf; vf=vf->id.next)
- if(vf->packedfile)
+ for (vf=bmain->vfont.first; vf; vf=vf->id.next)
+ if (vf->packedfile)
unpackVFont(reports, vf, how);
- for(sound=bmain->sound.first; sound; sound=sound->id.next)
- if(sound->packedfile)
+ for (sound=bmain->sound.first; sound; sound=sound->id.next)
+ if (sound->packedfile)
unpackSound(bmain, reports, sound, how);
}
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 2b3f792f777..975602c2918 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -33,15 +33,17 @@
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_brush_types.h"
+#include "BLI_bitmap.h"
#include "BLI_utildefines.h"
-
#include "BKE_brush.h"
#include "BKE_library.h"
#include "BKE_paint.h"
+#include "BKE_subsurf.h"
#include <stdlib.h>
#include <string.h>
@@ -53,10 +55,10 @@ const char PAINT_CURSOR_TEXTURE_PAINT[3] = {255, 255, 255};
Paint *paint_get_active(Scene *sce)
{
- if(sce) {
+ if (sce) {
ToolSettings *ts = sce->toolsettings;
- if(sce->basact && sce->basact->object) {
+ if (sce->basact && sce->basact->object) {
switch(sce->basact->object->mode) {
case OB_MODE_SCULPT:
return &ts->sculpt->paint;
@@ -67,7 +69,7 @@ Paint *paint_get_active(Scene *sce)
case OB_MODE_TEXTURE_PAINT:
return &ts->imapaint.paint;
case OB_MODE_EDIT:
- if(ts->use_uv_sculpt)
+ if (ts->use_uv_sculpt)
return &ts->uvsculpt->paint;
else
return &ts->imapaint.paint;
@@ -88,7 +90,7 @@ Brush *paint_brush(Paint *p)
void paint_brush_set(Paint *p, Brush *br)
{
- if(p) {
+ if (p) {
id_us_min((ID *)p->brush);
id_us_plus((ID *)br);
p->brush= br;
@@ -123,7 +125,7 @@ void paint_init(Paint *p, const char col[3])
/* If there's no brush, create one */
brush = paint_brush(p);
- if(brush == NULL)
+ if (brush == NULL)
brush= add_brush("Brush");
paint_brush_set(p, brush);
@@ -147,3 +149,26 @@ void copy_paint(Paint *src, Paint *tar)
tar->brush= src->brush;
id_us_plus((ID *)tar->brush);
}
+
+/* returns non-zero if any of the face's vertices
+ are hidden, zero otherwise */
+int paint_is_face_hidden(const MFace *f, const MVert *mvert)
+{
+ return ((mvert[f->v1].flag & ME_HIDE) ||
+ (mvert[f->v2].flag & ME_HIDE) ||
+ (mvert[f->v3].flag & ME_HIDE) ||
+ (f->v4 && (mvert[f->v4].flag & ME_HIDE)));
+}
+
+/* returns non-zero if any of the corners of the grid
+ face whose inner corner is at (x,y) are hidden,
+ zero otherwise */
+int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
+ int gridsize, int x, int y)
+{
+ /* skip face if any of its corners are hidden */
+ return (BLI_BITMAP_GET(grid_hidden, y * gridsize + x) ||
+ BLI_BITMAP_GET(grid_hidden, y * gridsize + x+1) ||
+ BLI_BITMAP_GET(grid_hidden, (y+1) * gridsize + x+1) ||
+ BLI_BITMAP_GET(grid_hidden, (y+1) * gridsize + x));
+}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 590c307f549..dd1546d694b 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -97,8 +97,8 @@ int count_particles(ParticleSystem *psys)
int tot=0;
LOOP_SHOWN_PARTICLES {
- if(pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0);
- else if(pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0);
+ if (pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0);
+ else if (pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0);
else tot++;
}
return tot;
@@ -110,9 +110,9 @@ int count_particles_mod(ParticleSystem *psys, int totgr, int cur)
int tot=0;
LOOP_SHOWN_PARTICLES {
- if(pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0);
- else if(pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0);
- else if(p%totgr==cur) tot++;
+ if (pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0);
+ else if (pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0);
+ else if (p%totgr==cur) tot++;
}
return tot;
}
@@ -131,12 +131,12 @@ static ParticleCacheKey **psys_alloc_path_cache_buffers(ListBase *bufs, int tot,
totkey = 0;
cache = MEM_callocN(tot*sizeof(void*), "PathCacheArray");
- while(totkey < tot) {
+ while (totkey < tot) {
totbufkey= MIN2(tot-totkey, PATH_CACHE_BUF_SIZE);
buf= MEM_callocN(sizeof(LinkData), "PathCacheLinkData");
buf->data= MEM_callocN(sizeof(ParticleCacheKey)*totbufkey*steps, "ParticleCacheKey");
- for(i=0; i<totbufkey; i++)
+ for (i=0; i<totbufkey; i++)
cache[totkey+i] = ((ParticleCacheKey*)buf->data) + i*steps;
totkey += totbufkey;
@@ -150,10 +150,10 @@ static void psys_free_path_cache_buffers(ParticleCacheKey **cache, ListBase *buf
{
LinkData *buf;
- if(cache)
+ if (cache)
MEM_freeN(cache);
- for(buf= bufs->first; buf; buf=buf->next)
+ for (buf= bufs->first; buf; buf=buf->next)
MEM_freeN(buf->data);
BLI_freelistN(bufs);
}
@@ -165,10 +165,10 @@ static void psys_free_path_cache_buffers(ParticleCacheKey **cache, ListBase *buf
ParticleSystem *psys_get_current(Object *ob)
{
ParticleSystem *psys;
- if(ob==NULL) return NULL;
+ if (ob==NULL) return NULL;
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
- if(psys->flag & PSYS_CURRENT)
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+ if (psys->flag & PSYS_CURRENT)
return psys;
}
@@ -179,10 +179,10 @@ short psys_get_current_num(Object *ob)
ParticleSystem *psys;
short i;
- if(ob==NULL) return 0;
+ if (ob==NULL) return 0;
- for(psys=ob->particlesystem.first, i=0; psys; psys=psys->next, i++)
- if(psys->flag & PSYS_CURRENT)
+ for (psys=ob->particlesystem.first, i=0; psys; psys=psys->next, i++)
+ if (psys->flag & PSYS_CURRENT)
return i;
return i;
@@ -192,10 +192,10 @@ void psys_set_current_num(Object *ob, int index)
ParticleSystem *psys;
short i;
- if(ob==NULL) return;
+ if (ob==NULL) return;
- for(psys=ob->particlesystem.first, i=0; psys; psys=psys->next, i++) {
- if(i == index)
+ for (psys=ob->particlesystem.first, i=0; psys; psys=psys->next, i++) {
+ if (i == index)
psys->flag |= PSYS_CURRENT;
else
psys->flag &= ~PSYS_CURRENT;
@@ -206,9 +206,9 @@ Object *psys_find_object(Scene *scene, ParticleSystem *psys)
Base *base;
ParticleSystem *tpsys;
- for(base = scene->base.first; base; base = base->next) {
- for(tpsys = base->object->particlesystem.first; psys; psys=psys->next) {
- if(tpsys == psys)
+ for (base = scene->base.first; base; base = base->next) {
+ for (tpsys = base->object->particlesystem.first; psys; psys=psys->next) {
+ if (tpsys == psys)
return base->object;
}
}
@@ -219,18 +219,18 @@ Object *psys_get_lattice(ParticleSimulationData *sim)
{
Object *lattice=NULL;
- if(psys_in_edit_mode(sim->scene, sim->psys)==0) {
+ if (psys_in_edit_mode(sim->scene, sim->psys)==0) {
ModifierData *md = (ModifierData*)psys_get_modifier(sim->ob, sim->psys);
- for(; md; md=md->next) {
- if(md->type==eModifierType_Lattice) {
+ for (; md; md=md->next) {
+ if (md->type==eModifierType_Lattice) {
LatticeModifierData *lmd = (LatticeModifierData *)md;
lattice=lmd->object;
break;
}
}
- if(lattice)
+ if (lattice)
init_latt_deform(lattice, NULL);
}
@@ -240,14 +240,14 @@ void psys_disable_all(Object *ob)
{
ParticleSystem *psys=ob->particlesystem.first;
- for(; psys; psys=psys->next)
+ for (; psys; psys=psys->next)
psys->flag |= PSYS_DISABLED;
}
void psys_enable_all(Object *ob)
{
ParticleSystem *psys=ob->particlesystem.first;
- for(; psys; psys=psys->next)
+ for (; psys; psys=psys->next)
psys->flag &= ~PSYS_DISABLED;
}
int psys_in_edit_mode(Scene *scene, ParticleSystem *psys)
@@ -261,28 +261,28 @@ static void psys_create_frand(ParticleSystem *psys)
BLI_srandom(psys->seed);
- for(i=0; i<1024; i++, rand++)
+ for (i=0; i<1024; i++, rand++)
*rand = BLI_frand();
}
int psys_check_enabled(Object *ob, ParticleSystem *psys)
{
ParticleSystemModifierData *psmd;
- if(psys->flag & PSYS_DISABLED || psys->flag & PSYS_DELETE || !psys->part)
+ if (psys->flag & PSYS_DISABLED || psys->flag & PSYS_DELETE || !psys->part)
return 0;
psmd= psys_get_modifier(ob, psys);
- if(psys->renderdata || G.rendering) {
- if(!(psmd->modifier.mode & eModifierMode_Render))
+ if (psys->renderdata || G.rendering) {
+ if (!(psmd->modifier.mode & eModifierMode_Render))
return 0;
}
- else if(!(psmd->modifier.mode & eModifierMode_Realtime))
+ else if (!(psmd->modifier.mode & eModifierMode_Realtime))
return 0;
/* perhaps not the perfect place, but we have to be sure the rands are there before usage */
- if(!psys->frand)
+ if (!psys->frand)
psys_create_frand(psys);
- else if(psys->recalc & PSYS_RECALC_RESET) {
+ else if (psys->recalc & PSYS_RECALC_RESET) {
MEM_freeN(psys->frand);
psys_create_frand(psys);
}
@@ -292,7 +292,7 @@ int psys_check_enabled(Object *ob, ParticleSystem *psys)
int psys_check_edited(ParticleSystem *psys)
{
- if(psys->part && psys->part->type==PART_HAIR)
+ if (psys->part && psys->part->type==PART_HAIR)
return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
else
return (psys->pointcache->edit && psys->pointcache->edit->edited);
@@ -304,11 +304,11 @@ void psys_check_group_weights(ParticleSettings *part)
GroupObject *go;
int current = 0;
- if(part->ren_as == PART_DRAW_GR && part->dup_group && part->dup_group->gobject.first) {
+ if (part->ren_as == PART_DRAW_GR && part->dup_group && part->dup_group->gobject.first) {
/* first remove all weights that don't have an object in the group */
dw = part->dupliweights.first;
- while(dw) {
- if(!object_in_group(dw->ob, part->dup_group)) {
+ while (dw) {
+ if (!object_in_group(dw->ob, part->dup_group)) {
tdw = dw->next;
BLI_freelinkN(&part->dupliweights, dw);
dw = tdw;
@@ -319,12 +319,12 @@ void psys_check_group_weights(ParticleSettings *part)
/* then add objects in the group to new list */
go = part->dup_group->gobject.first;
- while(go) {
+ while (go) {
dw = part->dupliweights.first;
- while(dw && dw->ob != go->ob)
+ while (dw && dw->ob != go->ob)
dw = dw->next;
- if(!dw) {
+ if (!dw) {
dw = MEM_callocN(sizeof(ParticleDupliWeight), "ParticleDupliWeight");
dw->ob = go->ob;
dw->count = 1;
@@ -335,16 +335,16 @@ void psys_check_group_weights(ParticleSettings *part)
}
dw = part->dupliweights.first;
- for(; dw; dw=dw->next) {
- if(dw->flag & PART_DUPLIW_CURRENT) {
+ for (; dw; dw=dw->next) {
+ if (dw->flag & PART_DUPLIW_CURRENT) {
current = 1;
break;
}
}
- if(!current) {
+ if (!current) {
dw = part->dupliweights.first;
- if(dw)
+ if (dw)
dw->flag |= PART_DUPLIW_CURRENT;
}
}
@@ -361,7 +361,7 @@ int psys_uses_gravity(ParticleSimulationData *sim)
/************************************************/
static void fluid_free_settings(SPHFluidSettings *fluid)
{
- if(fluid)
+ if (fluid)
MEM_freeN(fluid);
}
@@ -373,7 +373,7 @@ void psys_free_settings(ParticleSettings *part)
free_partdeflect(part->pd);
free_partdeflect(part->pd2);
- if(part->effector_weights)
+ if (part->effector_weights)
MEM_freeN(part->effector_weights);
BLI_freelistN(&part->dupliweights);
@@ -381,10 +381,10 @@ void psys_free_settings(ParticleSettings *part)
boid_free_settings(part->boids);
fluid_free_settings(part->fluid);
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
mtex= part->mtex[a];
- if(mtex && mtex->tex) mtex->tex->id.us--;
- if(mtex) MEM_freeN(mtex);
+ if (mtex && mtex->tex) mtex->tex->id.us--;
+ if (mtex) MEM_freeN(mtex);
}
}
@@ -393,7 +393,7 @@ void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics)
PARTICLE_P;
LOOP_PARTICLES {
- if(pa->hair)
+ if (pa->hair)
MEM_freeN(pa->hair);
pa->hair = NULL;
pa->totkey = 0;
@@ -401,8 +401,8 @@ void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics)
psys->flag &= ~PSYS_HAIR_DONE;
- if(psys->clmd) {
- if(dynamics) {
+ if (psys->clmd) {
+ if (dynamics) {
BKE_ptcache_free_list(&psys->ptcaches);
psys->clmd->point_cache = psys->pointcache = NULL;
psys->clmd->ptcaches.first = psys->clmd->ptcaches.last = NULL;
@@ -417,11 +417,11 @@ void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics)
}
}
- if(psys->hair_in_dm)
+ if (psys->hair_in_dm)
psys->hair_in_dm->release(psys->hair_in_dm);
psys->hair_in_dm = NULL;
- if(psys->hair_out_dm)
+ if (psys->hair_out_dm)
psys->hair_out_dm->release(psys->hair_out_dm);
psys->hair_out_dm = NULL;
}
@@ -429,14 +429,14 @@ void free_keyed_keys(ParticleSystem *psys)
{
PARTICLE_P;
- if(psys->part->type == PART_HAIR)
+ if (psys->part->type == PART_HAIR)
return;
- if(psys->particles && psys->particles->keys) {
+ if (psys->particles && psys->particles->keys) {
MEM_freeN(psys->particles->keys);
LOOP_PARTICLES {
- if(pa->keys) {
+ if (pa->keys) {
pa->keys= NULL;
pa->totkey= 0;
}
@@ -451,12 +451,12 @@ static void free_child_path_cache(ParticleSystem *psys)
}
void psys_free_path_cache(ParticleSystem *psys, PTCacheEdit *edit)
{
- if(edit) {
+ if (edit) {
psys_free_path_cache_buffers(edit->pathcache, &edit->pathcachebufs);
edit->pathcache= NULL;
edit->totcached= 0;
}
- if(psys) {
+ if (psys) {
psys_free_path_cache_buffers(psys->pathcache, &psys->pathcachebufs);
psys->pathcache= NULL;
psys->totcached= 0;
@@ -466,7 +466,7 @@ void psys_free_path_cache(ParticleSystem *psys, PTCacheEdit *edit)
}
void psys_free_children(ParticleSystem *psys)
{
- if(psys->child) {
+ if (psys->child) {
MEM_freeN(psys->child);
psys->child= NULL;
psys->totchild=0;
@@ -478,18 +478,18 @@ void psys_free_particles(ParticleSystem *psys)
{
PARTICLE_P;
- if(psys->particles) {
- if(psys->part->type==PART_HAIR) {
+ if (psys->particles) {
+ if (psys->part->type==PART_HAIR) {
LOOP_PARTICLES {
- if(pa->hair)
+ if (pa->hair)
MEM_freeN(pa->hair);
}
}
- if(psys->particles->keys)
+ if (psys->particles->keys)
MEM_freeN(psys->particles->keys);
- if(psys->particles->boid)
+ if (psys->particles->boid)
MEM_freeN(psys->particles->boid);
MEM_freeN(psys->particles);
@@ -499,20 +499,20 @@ void psys_free_particles(ParticleSystem *psys)
}
void psys_free_pdd(ParticleSystem *psys)
{
- if(psys->pdd) {
- if(psys->pdd->cdata)
+ if (psys->pdd) {
+ if (psys->pdd->cdata)
MEM_freeN(psys->pdd->cdata);
psys->pdd->cdata = NULL;
- if(psys->pdd->vdata)
+ if (psys->pdd->vdata)
MEM_freeN(psys->pdd->vdata);
psys->pdd->vdata = NULL;
- if(psys->pdd->ndata)
+ if (psys->pdd->ndata)
MEM_freeN(psys->pdd->ndata);
psys->pdd->ndata = NULL;
- if(psys->pdd->vedata)
+ if (psys->pdd->vedata)
MEM_freeN(psys->pdd->vedata);
psys->pdd->vedata = NULL;
@@ -523,7 +523,7 @@ void psys_free_pdd(ParticleSystem *psys)
/* free everything */
void psys_free(Object *ob, ParticleSystem * psys)
{
- if(psys) {
+ if (psys) {
int nr = 0;
ParticleSystem * tpsys;
@@ -533,10 +533,10 @@ void psys_free(Object *ob, ParticleSystem * psys)
psys_free_particles(psys);
- if(psys->edit && psys->free_edit)
+ if (psys->edit && psys->free_edit)
psys->free_edit(psys->edit);
- if(psys->child) {
+ if (psys->child) {
MEM_freeN(psys->child);
psys->child = NULL;
psys->totchild = 0;
@@ -552,10 +552,10 @@ void psys_free(Object *ob, ParticleSystem * psys)
}
}
// clear do-not-draw-flag
- if(!nr)
+ if (!nr)
ob->transflag &= ~OB_DUPLIPARTS;
- if(psys->part) {
+ if (psys->part) {
psys->part->id.us--;
psys->part=NULL;
}
@@ -568,15 +568,15 @@ void psys_free(Object *ob, ParticleSystem * psys)
BLI_bvhtree_free(psys->bvhtree);
BLI_kdtree_free(psys->tree);
- if(psys->fluid_springs)
+ if (psys->fluid_springs)
MEM_freeN(psys->fluid_springs);
pdEndEffectors(&psys->effectors);
- if(psys->frand)
+ if (psys->frand)
MEM_freeN(psys->frand);
- if(psys->pdd) {
+ if (psys->pdd) {
psys_free_pdd(psys);
MEM_freeN(psys->pdd);
}
@@ -648,7 +648,7 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center
/* project point on screen */
mul_m4_v4(data->winmat, co);
- if(co[3] != 0.0f) {
+ if (co[3] != 0.0f) {
co[0]= 0.5f*data->winx*(1.0f + co[0]/co[3]);
co[1]= 0.5f*data->winy*(1.0f + co[1]/co[3]);
}
@@ -659,14 +659,14 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center
/* make smaller using fallof once over screen edge */
*viewport= 1.0f;
- if(co[0]+radius < 0.0f)
+ if (co[0]+radius < 0.0f)
*viewport *= psys_render_viewport_falloff(vprate, -(co[0]+radius), data->winx);
- else if(co[0]-radius > data->winx)
+ else if (co[0]-radius > data->winx)
*viewport *= psys_render_viewport_falloff(vprate, (co[0]-radius) - data->winx, data->winx);
- if(co[1]+radius < 0.0f)
+ if (co[1]+radius < 0.0f)
*viewport *= psys_render_viewport_falloff(vprate, -(co[1]+radius), data->winy);
- else if(co[1]-radius > data->winy)
+ else if (co[1]-radius > data->winy)
*viewport *= psys_render_viewport_falloff(vprate, (co[1]-radius) - data->winy, data->winy);
return area;
@@ -677,9 +677,9 @@ void psys_render_set(Object *ob, ParticleSystem *psys, float viewmat[][4], float
ParticleRenderData*data;
ParticleSystemModifierData *psmd= psys_get_modifier(ob, psys);
- if(!G.rendering)
+ if (!G.rendering)
return;
- if(psys->renderdata)
+ if (psys->renderdata)
return;
data= MEM_callocN(sizeof(ParticleRenderData), "ParticleRenderData");
@@ -695,7 +695,7 @@ void psys_render_set(Object *ob, ParticleSystem *psys, float viewmat[][4], float
data->childcachebufs.last = psys->childcachebufs.last;
data->totchildcache= psys->totchildcache;
- if(psmd->dm)
+ if (psmd->dm)
data->dm= CDDM_copy(psmd->dm);
data->totdmvert= psmd->totdmvert;
data->totdmedge= psmd->totdmedge;
@@ -719,7 +719,7 @@ void psys_render_set(Object *ob, ParticleSystem *psys, float viewmat[][4], float
psys->renderdata= data;
/* Hair can and has to be recalculated if everything isn't displayed. */
- if(psys->part->disp != 100 && psys->part->type == PART_HAIR)
+ if (psys->part->disp != 100 && psys->part->type == PART_HAIR)
psys->recalc |= PSYS_RECALC_RESET;
}
@@ -729,20 +729,20 @@ void psys_render_restore(Object *ob, ParticleSystem *psys)
ParticleSystemModifierData *psmd= psys_get_modifier(ob, psys);
data= psys->renderdata;
- if(!data)
+ if (!data)
return;
- if(data->elems)
+ if (data->elems)
MEM_freeN(data->elems);
- if(psmd->dm) {
+ if (psmd->dm) {
psmd->dm->needsFree= 1;
psmd->dm->release(psmd->dm);
}
psys_free_path_cache(psys, NULL);
- if(psys->child) {
+ if (psys->child) {
MEM_freeN(psys->child);
psys->child= 0;
psys->totchild= 0;
@@ -765,7 +765,7 @@ void psys_render_restore(Object *ob, ParticleSystem *psys)
psmd->totdmface= data->totdmface;
psmd->flag &= ~eParticleSystemFlag_psys_updated;
- if(psmd->dm)
+ if (psmd->dm)
psys_calc_dmcache(ob, psmd->dm, psys);
MEM_freeN(data);
@@ -789,15 +789,15 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
int *origindex, *facetotvert;
int a, b, totorigface, totface, newtot, skipped;
- if(part->ren_as!=PART_DRAW_PATH || !(part->draw & PART_DRAW_REN_STRAND))
+ if (part->ren_as!=PART_DRAW_PATH || !(part->draw & PART_DRAW_REN_STRAND))
return tot;
- if(!ctx->sim.psys->renderdata)
+ if (!ctx->sim.psys->renderdata)
return tot;
data= ctx->sim.psys->renderdata;
- if(data->timeoffset)
+ if (data->timeoffset)
return 0;
- if(!(part->simplify_flag & PART_SIMPLIFY_ENABLE))
+ if (!(part->simplify_flag & PART_SIMPLIFY_ENABLE))
return tot;
mvert= dm->getVertArray(dm);
@@ -806,7 +806,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
totface= dm->getNumTessFaces(dm);
totorigface= me->totpoly;
- if(totface == 0 || totorigface == 0)
+ if (totface == 0 || totorigface == 0)
return tot;
facearea= MEM_callocN(sizeof(float)*totorigface, "SimplifyFaceArea");
@@ -814,7 +814,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
facetotvert= MEM_callocN(sizeof(int)*totorigface, "SimplifyFaceArea");
elems= MEM_callocN(sizeof(ParticleRenderElem)*totorigface, "SimplifyFaceElem");
- if(data->elems)
+ if (data->elems)
MEM_freeN(data->elems);
data->dosimplify= 1;
@@ -822,17 +822,17 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
data->origindex= origindex;
/* compute number of children per original face */
- for(a=0; a<tot; a++) {
+ for (a=0; a<tot; a++) {
b= (origindex)? origindex[ctx->index[a]]: ctx->index[a];
- if(b != -1)
+ if (b != -1)
elems[b].totchild++;
}
/* compute areas and centers of original faces */
- for(mf=mface, a=0; a<totface; a++, mf++) {
+ for (mf=mface, a=0; a<totface; a++, mf++) {
b= (origindex)? origindex[a]: a;
- if(b != -1) {
+ if (b != -1) {
copy_v3_v3(co1, mvert[mf->v1].co);
copy_v3_v3(co2, mvert[mf->v2].co);
copy_v3_v3(co3, mvert[mf->v3].co);
@@ -841,7 +841,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
add_v3_v3(facecenter[b], co2);
add_v3_v3(facecenter[b], co3);
- if(mf->v4) {
+ if (mf->v4) {
copy_v3_v3(co4, mvert[mf->v4].co);
add_v3_v3(facecenter[b], co4);
facearea[b] += area_quad_v3(co1, co2, co3, co4);
@@ -854,8 +854,8 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
}
}
- for(a=0; a<totorigface; a++)
- if(facetotvert[a] > 0)
+ for (a=0; a<totorigface; a++)
+ if (facetotvert[a] > 0)
mul_v3_fl(facecenter[a], 1.0f/facetotvert[a]);
/* for conversion from BU area / pixel area to reference screen size */
@@ -864,17 +864,17 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
fac= fac*fac;
powrate= log(0.5f)/log(part->simplify_rate*0.5f);
- if(part->simplify_flag & PART_SIMPLIFY_VIEWPORT)
+ if (part->simplify_flag & PART_SIMPLIFY_VIEWPORT)
vprate= pow(1.0f - part->simplify_viewport, 5.0);
else
vprate= 1.0;
/* set simplification parameters per original face */
- for(a=0, elem=elems; a<totorigface; a++, elem++) {
+ for (a=0, elem=elems; a<totorigface; a++, elem++) {
area = psys_render_projected_area(ctx->sim.psys, facecenter[a], facearea[a], vprate, &viewport);
arearatio= fac*area/facearea[a];
- if((arearatio < 1.0f || viewport < 1.0f) && elem->totchild) {
+ if ((arearatio < 1.0f || viewport < 1.0f) && elem->totchild) {
/* lambda is percentage of elements to keep */
lambda= (arearatio < 1.0f)? powf(arearatio, powrate): 1.0f;
lambda *= viewport;
@@ -900,7 +900,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
/* extend lambda to include transition */
lambda= lambda + elem->t;
- if(lambda > 1.0f)
+ if (lambda > 1.0f)
lambda= 1.0f;
}
else {
@@ -925,10 +925,10 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
ctx->skip= MEM_callocN(sizeof(int)*tot, "SimplificationSkip");
skipped= 0;
- for(a=0, newtot=0; a<tot; a++) {
+ for (a=0, newtot=0; a<tot; a++) {
b= (origindex)? origindex[ctx->index[a]]: ctx->index[a];
- if(b != -1) {
- if(elems[b].curchild++ < ceil(elems[b].lambda*elems[b].totchild)) {
+ if (b != -1) {
+ if (elems[b].curchild++ < ceil(elems[b].lambda*elems[b].totchild)) {
ctx->index[newtot]= ctx->index[a];
ctx->skip[newtot]= skipped;
skipped= 0;
@@ -939,7 +939,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
else skipped++;
}
- for(a=0, elem=elems; a<totorigface; a++, elem++)
+ for (a=0, elem=elems; a<totorigface; a++, elem++)
elem->curchild= 0;
return newtot;
@@ -952,15 +952,15 @@ int psys_render_simplify_params(ParticleSystem *psys, ChildParticle *cpa, float
float x, w, scale, alpha, lambda, t, scalemin, scalemax;
int b;
- if(!(psys->renderdata && (psys->part->simplify_flag & PART_SIMPLIFY_ENABLE)))
+ if (!(psys->renderdata && (psys->part->simplify_flag & PART_SIMPLIFY_ENABLE)))
return 0;
data= psys->renderdata;
- if(!data->dosimplify)
+ if (!data->dosimplify)
return 0;
b= (data->origindex)? data->origindex[cpa->num]: cpa->num;
- if(b == -1)
+ if (b == -1)
return 0;
elem= &data->elems[b];
@@ -970,17 +970,17 @@ int psys_render_simplify_params(ParticleSystem *psys, ChildParticle *cpa, float
scalemin= elem->scalemin;
scalemax= elem->scalemax;
- if(!elem->reduce) {
+ if (!elem->reduce) {
scale= scalemin;
alpha= 1.0f;
}
else {
x= (elem->curchild+0.5f)/elem->totchild;
- if(x < lambda-t) {
+ if (x < lambda-t) {
scale= scalemax;
alpha= 1.0f;
}
- else if(x >= lambda+t) {
+ else if (x >= lambda+t) {
scale= scalemin;
alpha= 0.0f;
}
@@ -1007,7 +1007,7 @@ static float interpolate_particle_value(float v1, float v2, float v3, float v4,
float value;
value= w[0]*v1 + w[1]*v2 + w[2]*v3;
- if(four)
+ if (four)
value += w[3]*v4;
CLAMP(value, 0.f, 1.f);
@@ -1019,7 +1019,7 @@ void psys_interpolate_particle(short type, ParticleKey keys[4], float dt, Partic
{
float t[4];
- if(type<0) {
+ if (type<0) {
interp_cubic_v3( result->co, result->vel,keys[1].co, keys[1].vel, keys[2].co, keys[2].vel, dt);
}
else {
@@ -1027,15 +1027,15 @@ void psys_interpolate_particle(short type, ParticleKey keys[4], float dt, Partic
interp_v3_v3v3v3v3(result->co, keys[0].co, keys[1].co, keys[2].co, keys[3].co, t);
- if(velocity) {
+ if (velocity) {
float temp[3];
- if(dt>0.999f) {
+ if (dt>0.999f) {
key_curve_position_weights(dt-0.001f, t, type);
interp_v3_v3v3v3v3(temp, keys[0].co, keys[1].co, keys[2].co, keys[3].co, t);
sub_v3_v3v3(result->vel, result->co, temp);
}
- else{
+ else {
key_curve_position_weights(dt+0.001f, t, type);
interp_v3_v3v3v3v3(temp, keys[0].co, keys[1].co, keys[2].co, keys[3].co, t);
sub_v3_v3v3(result->vel, temp, result->co);
@@ -1071,15 +1071,15 @@ static void get_pointcache_keys_for_time(Object *UNUSED(ob), PointCache *cache,
static PTCacheMem *pm = NULL;
int index1, index2;
- if(index < 0) { /* initialize */
+ if (index < 0) { /* initialize */
*cur = cache->mem_cache.first;
- if(*cur)
+ if (*cur)
*cur = (*cur)->next;
}
else {
- if(*cur) {
- while(*cur && (*cur)->next && (float)(*cur)->frame < t)
+ if (*cur) {
+ while (*cur && (*cur)->next && (float)(*cur)->frame < t)
*cur = (*cur)->next;
pm = *cur;
@@ -1088,12 +1088,12 @@ static void get_pointcache_keys_for_time(Object *UNUSED(ob), PointCache *cache,
index1 = BKE_ptcache_mem_index_find(pm->prev, index);
BKE_ptcache_make_particle_key(key2, index2, pm->data, (float)pm->frame);
- if(index1 < 0)
+ if (index1 < 0)
copy_particle_key(key1, key2, 1);
else
BKE_ptcache_make_particle_key(key1, index1, pm->prev->data, (float)pm->prev->frame);
}
- else if(cache->mem_cache.first) {
+ else if (cache->mem_cache.first) {
pm = cache->mem_cache.first;
index2 = BKE_ptcache_mem_index_find(pm, index);
BKE_ptcache_make_particle_key(key2, index2, pm->data, (float)pm->frame);
@@ -1106,16 +1106,16 @@ static int get_pointcache_times_for_particle(PointCache *cache, int index, float
PTCacheMem *pm;
int ret = 0;
- for(pm=cache->mem_cache.first; pm; pm=pm->next) {
- if(BKE_ptcache_mem_index_find(pm, index) >= 0) {
+ for (pm=cache->mem_cache.first; pm; pm=pm->next) {
+ if (BKE_ptcache_mem_index_find(pm, index) >= 0) {
*start = pm->frame;
ret++;
break;
}
}
- for(pm=cache->mem_cache.last; pm; pm=pm->prev) {
- if(BKE_ptcache_mem_index_find(pm, index) >= 0) {
+ for (pm=cache->mem_cache.last; pm; pm=pm->prev) {
+ if (BKE_ptcache_mem_index_find(pm, index) >= 0) {
*end = pm->frame;
ret++;
break;
@@ -1130,8 +1130,8 @@ float psys_get_dietime_from_cache(PointCache *cache, int index)
PTCacheMem *pm;
int dietime = 10000000; /* some max value so that we can default to pa->time+lifetime */
- for(pm=cache->mem_cache.last; pm; pm=pm->prev) {
- if(BKE_ptcache_mem_index_find(pm, index) >= 0)
+ for (pm=cache->mem_cache.last; pm; pm=pm->prev) {
+ if (BKE_ptcache_mem_index_find(pm, index) >= 0)
return (float)pm->frame;
}
@@ -1141,7 +1141,7 @@ float psys_get_dietime_from_cache(PointCache *cache, int index)
static void init_particle_interpolation(Object *ob, ParticleSystem *psys, ParticleData *pa, ParticleInterpolationData *pind)
{
- if(pind->epoint) {
+ if (pind->epoint) {
PTCacheEditPoint *point = pind->epoint;
pind->ekey[0] = point->keys;
@@ -1150,7 +1150,7 @@ static void init_particle_interpolation(Object *ob, ParticleSystem *psys, Partic
pind->birthtime = *(point->keys->time);
pind->dietime = *((point->keys + point->totkey - 1)->time);
}
- else if(pind->keyed) {
+ else if (pind->keyed) {
ParticleKey *key = pa->keys;
pind->kkey[0] = key;
pind->kkey[1] = pa->totkey > 1 ? key + 1 : NULL;
@@ -1158,13 +1158,13 @@ static void init_particle_interpolation(Object *ob, ParticleSystem *psys, Partic
pind->birthtime = key->time;
pind->dietime = (key + pa->totkey - 1)->time;
}
- else if(pind->cache) {
+ else if (pind->cache) {
float start=0.0f, end=0.0f;
get_pointcache_keys_for_time(ob, pind->cache, &pind->pm, -1, 0.0f, NULL, NULL);
pind->birthtime = pa ? pa->time : pind->cache->startframe;
pind->dietime = pa ? pa->dietime : pind->cache->endframe;
- if(get_pointcache_times_for_particle(pind->cache, pa - psys->particles, &start, &end)) {
+ if (get_pointcache_times_for_particle(pind->cache, pa - psys->particles, &start, &end)) {
pind->birthtime = MAX2(pind->birthtime, start);
pind->dietime = MIN2(pind->dietime, end);
}
@@ -1177,7 +1177,7 @@ static void init_particle_interpolation(Object *ob, ParticleSystem *psys, Partic
pind->birthtime = key->time;
pind->dietime = (key + pa->totkey - 1)->time;
- if(pind->dm) {
+ if (pind->dm) {
pind->mvert[0] = CDDM_get_vert(pind->dm, pa->hair_index);
pind->mvert[1] = pind->mvert[0] + 1;
}
@@ -1186,7 +1186,7 @@ static void init_particle_interpolation(Object *ob, ParticleSystem *psys, Partic
static void edit_to_particle(ParticleKey *key, PTCacheEditKey *ekey)
{
copy_v3_v3(key->co, ekey->co);
- if(ekey->vel) {
+ if (ekey->vel) {
copy_v3_v3(key->vel, ekey->vel);
}
key->time = *(ekey->time);
@@ -1214,41 +1214,41 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
memset(keys, 0, sizeof(keys));
/* interpret timing and find keys */
- if(point) {
- if(result->time < 0.0f)
+ if (point) {
+ if (result->time < 0.0f)
real_t = -result->time;
else
real_t = *(pind->ekey[0]->time) + t * (*(pind->ekey[0][point->totkey-1].time) - *(pind->ekey[0]->time));
- while(*(pind->ekey[1]->time) < real_t)
+ while (*(pind->ekey[1]->time) < real_t)
pind->ekey[1]++;
pind->ekey[0] = pind->ekey[1] - 1;
}
- else if(pind->keyed) {
+ else if (pind->keyed) {
/* we have only one key, so let's use that */
- if(pind->kkey[1]==NULL) {
+ if (pind->kkey[1]==NULL) {
copy_particle_key(result, pind->kkey[0], 1);
return;
}
- if(result->time < 0.0f)
+ if (result->time < 0.0f)
real_t = -result->time;
else
real_t = pind->kkey[0]->time + t * (pind->kkey[0][pa->totkey-1].time - pind->kkey[0]->time);
- if(psys->part->phystype==PART_PHYS_KEYED && psys->flag & PSYS_KEYED_TIMING) {
+ if (psys->part->phystype==PART_PHYS_KEYED && psys->flag & PSYS_KEYED_TIMING) {
ParticleTarget *pt = psys->targets.first;
pt=pt->next;
- while(pt && pa->time + pt->time < real_t)
+ while (pt && pa->time + pt->time < real_t)
pt= pt->next;
- if(pt) {
+ if (pt) {
pt=pt->prev;
- if(pa->time + pt->time + pt->duration > real_t)
+ if (pa->time + pt->time + pt->duration > real_t)
real_t = pa->time + pt->time;
}
else
@@ -1257,24 +1257,24 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
CLAMP(real_t, pa->time, pa->dietime);
- while(pind->kkey[1]->time < real_t)
+ while (pind->kkey[1]->time < real_t)
pind->kkey[1]++;
pind->kkey[0] = pind->kkey[1] - 1;
}
- else if(pind->cache) {
- if(result->time < 0.0f) /* flag for time in frames */
+ else if (pind->cache) {
+ if (result->time < 0.0f) /* flag for time in frames */
real_t = -result->time;
else
real_t = pa->time + t * (pa->dietime - pa->time);
}
else {
- if(result->time < 0.0f)
+ if (result->time < 0.0f)
real_t = -result->time;
else
real_t = pind->hkey[0]->time + t * (pind->hkey[0][pa->totkey-1].time - pind->hkey[0]->time);
- while(pind->hkey[1]->time < real_t) {
+ while (pind->hkey[1]->time < real_t) {
pind->hkey[1]++;
pind->mvert[1]++;
}
@@ -1283,20 +1283,20 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
}
/* set actual interpolation keys */
- if(point) {
+ if (point) {
edit_to_particle(keys + 1, pind->ekey[0]);
edit_to_particle(keys + 2, pind->ekey[1]);
}
- else if(pind->dm) {
+ else if (pind->dm) {
pind->mvert[0] = pind->mvert[1] - 1;
mvert_to_particle(keys + 1, pind->mvert[0], pind->hkey[0]);
mvert_to_particle(keys + 2, pind->mvert[1], pind->hkey[1]);
}
- else if(pind->keyed) {
+ else if (pind->keyed) {
memcpy(keys + 1, pind->kkey[0], sizeof(ParticleKey));
memcpy(keys + 2, pind->kkey[1], sizeof(ParticleKey));
}
- else if(pind->cache) {
+ else if (pind->cache) {
get_pointcache_keys_for_time(NULL, pind->cache, &pind->pm, p, real_t, keys+1, keys+2);
}
else {
@@ -1305,40 +1305,40 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
}
/* set secondary interpolation keys for hair */
- if(!pind->keyed && !pind->cache && !point_vel) {
- if(point) {
- if(pind->ekey[0] != point->keys)
+ if (!pind->keyed && !pind->cache && !point_vel) {
+ if (point) {
+ if (pind->ekey[0] != point->keys)
edit_to_particle(keys, pind->ekey[0] - 1);
else
edit_to_particle(keys, pind->ekey[0]);
}
- else if(pind->dm) {
- if(pind->hkey[0] != pa->hair)
+ else if (pind->dm) {
+ if (pind->hkey[0] != pa->hair)
mvert_to_particle(keys, pind->mvert[0] - 1, pind->hkey[0] - 1);
else
mvert_to_particle(keys, pind->mvert[0], pind->hkey[0]);
}
else {
- if(pind->hkey[0] != pa->hair)
+ if (pind->hkey[0] != pa->hair)
hair_to_particle(keys, pind->hkey[0] - 1);
else
hair_to_particle(keys, pind->hkey[0]);
}
- if(point) {
- if(pind->ekey[1] != point->keys + point->totkey - 1)
+ if (point) {
+ if (pind->ekey[1] != point->keys + point->totkey - 1)
edit_to_particle(keys + 3, pind->ekey[1] + 1);
else
edit_to_particle(keys + 3, pind->ekey[1]);
}
- else if(pind->dm) {
- if(pind->hkey[1] != pa->hair + pa->totkey - 1)
+ else if (pind->dm) {
+ if (pind->hkey[1] != pa->hair + pa->totkey - 1)
mvert_to_particle(keys + 3, pind->mvert[1] + 1, pind->hkey[1] + 1);
else
mvert_to_particle(keys + 3, pind->mvert[1], pind->hkey[1]);
}
else {
- if(pind->hkey[1] != pa->hair + pa->totkey - 1)
+ if (pind->hkey[1] != pa->hair + pa->totkey - 1)
hair_to_particle(keys + 3, pind->hkey[1] + 1);
else
hair_to_particle(keys + 3, pind->hkey[1]);
@@ -1349,7 +1349,7 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
keytime = (real_t - keys[1].time) / dfra;
/* convert velocity to timestep size */
- if(pind->keyed || pind->cache || point_vel) {
+ if (pind->keyed || pind->cache || point_vel) {
invdt = dfra * 0.04f * (psys ? psys->part->timetweak : 1.f);
mul_v3_fl(keys[1].vel, invdt);
mul_v3_fl(keys[2].vel, invdt);
@@ -1362,7 +1362,7 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
,keys, keytime, result, 1);
/* the velocity needs to be converted back from cubic interpolation */
- if(pind->keyed || pind->cache || point_vel)
+ if (pind->keyed || pind->cache || point_vel)
mul_v3_fl(result->vel, 1.f/invdt);
}
@@ -1374,10 +1374,10 @@ static void interpolate_pathcache(ParticleCacheKey *first, float t, ParticleCach
/* scale the requested time to fit the entire path even if the path is cut early */
t *= (first+first->steps)->time;
- while(i<first->steps && cur->time < t)
+ while (i<first->steps && cur->time < t)
cur++;
- if(cur->time == t)
+ if (cur->time == t)
*result = *cur;
else {
float dt = (t-(cur-1)->time)/(cur->time-(cur-1)->time);
@@ -1388,7 +1388,7 @@ static void interpolate_pathcache(ParticleCacheKey *first, float t, ParticleCach
}
/* first is actual base rotation, others are incremental from first */
- if(cur==first || cur-1==first)
+ if (cur==first || cur-1==first)
copy_qt_qt(result->rot, first->rot);
else
mul_qt_qtqt(result->rot, first->rot, result->rot);
@@ -1416,14 +1416,14 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
normal_short_to_float_v3(n2, mvert[mface->v2].no);
normal_short_to_float_v3(n3, mvert[mface->v3].no);
- if(mface->v4) {
+ if (mface->v4) {
v4= mvert[mface->v4].co;
normal_short_to_float_v3(n4, mvert[mface->v4].no);
interp_v3_v3v3v3v3(vec, v1, v2, v3, v4, w);
- if(nor) {
- if(mface->flag & ME_SMOOTH)
+ if (nor) {
+ if (mface->flag & ME_SMOOTH)
interp_v3_v3v3v3v3(nor, n1, n2, n3, n4, w);
else
normal_quad_v3(nor,v1,v2,v3,v4);
@@ -1432,8 +1432,8 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
else {
interp_v3_v3v3v3(vec, v1, v2, v3, w);
- if(nor) {
- if(mface->flag & ME_SMOOTH)
+ if (nor) {
+ if (mface->flag & ME_SMOOTH)
interp_v3_v3v3v3(nor, n1, n2, n3, w);
else
normal_tri_v3(nor,v1,v2,v3);
@@ -1441,23 +1441,23 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
}
/* calculate tangent vectors */
- if(utan && vtan) {
- if(tface) {
+ if (utan && vtan) {
+ if (tface) {
uv1= tface->uv[0];
uv2= tface->uv[1];
uv3= tface->uv[2];
uv4= tface->uv[3];
}
- else{
+ else {
uv1= tuv[0]; uv2= tuv[1]; uv3= tuv[2]; uv4= tuv[3];
map_to_sphere( uv1, uv1+1,v1[0], v1[1], v1[2]);
map_to_sphere( uv2, uv2+1,v2[0], v2[1], v2[2]);
map_to_sphere( uv3, uv3+1,v3[0], v3[1], v3[2]);
- if(v4)
+ if (v4)
map_to_sphere( uv4, uv4+1,v4[0], v4[1], v4[2]);
}
- if(v4) {
+ if (v4) {
s1= uv3[0] - uv1[0];
s2= uv4[0] - uv1[0];
@@ -1467,7 +1467,7 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
sub_v3_v3v3(e1, v3, v1);
sub_v3_v3v3(e2, v4, v1);
}
- else{
+ else {
s1= uv2[0] - uv1[0];
s2= uv3[0] - uv1[0];
@@ -1487,30 +1487,30 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
utan[2] = (t1*e2[2] - t2*e1[2]);
}
- if(orco) {
- if(orcodata) {
+ if (orco) {
+ if (orcodata) {
o1= orcodata[mface->v1];
o2= orcodata[mface->v2];
o3= orcodata[mface->v3];
- if(mface->v4) {
+ if (mface->v4) {
o4= orcodata[mface->v4];
interp_v3_v3v3v3v3(orco, o1, o2, o3, o4, w);
- if(ornor)
+ if (ornor)
normal_quad_v3( ornor,o1, o2, o3, o4);
}
else {
interp_v3_v3v3v3(orco, o1, o2, o3, w);
- if(ornor)
+ if (ornor)
normal_tri_v3( ornor,o1, o2, o3);
}
}
else {
copy_v3_v3(orco, vec);
- if(ornor && nor)
+ if (ornor && nor)
copy_v3_v3(ornor, nor);
}
}
@@ -1525,7 +1525,7 @@ void psys_interpolate_uvs(const MTFace *tface, int quad, const float w[4], float
float v31= tface->uv[2][1];
float v40,v41;
- if(quad) {
+ if (quad) {
v40= tface->uv[3][0];
v41= tface->uv[3][1];
@@ -1547,7 +1547,7 @@ void psys_interpolate_mcol(const MCol *mcol, int quad, const float w[4], MCol *m
cp2= (char *)&mcol[1];
cp3= (char *)&mcol[2];
- if(quad) {
+ if (quad) {
cp4= (char *)&mcol[3];
cp[0]= (int)(w[0]*cp1[0] + w[1]*cp2[0] + w[2]*cp3[0] + w[3]*cp4[0]);
@@ -1565,7 +1565,7 @@ void psys_interpolate_mcol(const MCol *mcol, int quad, const float w[4], MCol *m
static float psys_interpolate_value_from_verts(DerivedMesh *dm, short from, int index, const float fw[4], const float *values)
{
- if(values==0 || index==-1)
+ if (values==0 || index==-1)
return 0.0;
switch(from) {
@@ -1601,7 +1601,7 @@ static void psys_origspace_to_w(OrigSpaceFace *osface, int quad, const float w[4
psys_w_to_origspace(w, co);
co[2]= 0.0f;
- if(quad) {
+ if (quad) {
v[3][0]= osface->uv[3][0]; v[3][1]= osface->uv[3][1]; v[3][2]= 0.0f;
interp_weights_poly_v3(neww, v, 4, co);
}
@@ -1628,50 +1628,51 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, const f
totface = dm->getNumTessFaces(dm);
- if(osface==NULL || origindex==NULL) {
- /* Assume we dont need osface data */
+ if (osface==NULL || origindex==NULL) {
+ /* Assume we don't need osface data */
if (index <totface) {
//printf("\tNO CD_ORIGSPACE, assuming not needed\n");
return index;
- } else {
+ }
+ else {
printf("\tNO CD_ORIGSPACE, error out of range\n");
return DMCACHE_NOTFOUND;
}
}
- else if(index >= me->totpoly)
+ else if (index >= me->totpoly)
return DMCACHE_NOTFOUND; /* index not in the original mesh */
psys_w_to_origspace(fw, uv);
- if(node) { /* we have a linked list of faces that we use, faster! */
- for(;node; node=node->next) {
+ if (node) { /* we have a linked list of faces that we use, faster! */
+ for (;node; node=node->next) {
findex= GET_INT_FROM_POINTER(node->link);
faceuv= osface[findex].uv;
quad = (mface[findex].totloop == 4);
/* check that this intersects - Its possible this misses :/ -
* could also check its not between */
- if(quad) {
- if(isect_point_quad_v2(uv, faceuv[0], faceuv[1], faceuv[2], faceuv[3]))
+ if (quad) {
+ if (isect_point_quad_v2(uv, faceuv[0], faceuv[1], faceuv[2], faceuv[3]))
return findex;
}
- else if(isect_point_tri_v2(uv, faceuv[0], faceuv[1], faceuv[2]))
+ else if (isect_point_tri_v2(uv, faceuv[0], faceuv[1], faceuv[2]))
return findex;
}
}
else { /* if we have no node, try every face */
- for(findex=0; findex<totface; findex++) {
- if(origindex[findex] == index) {
+ for (findex=0; findex<totface; findex++) {
+ if (origindex[findex] == index) {
faceuv= osface[findex].uv;
quad = (mface[findex].totloop == 4);
/* check that this intersects - Its possible this misses :/ -
* could also check its not between */
- if(quad) {
- if(isect_point_quad_v2(uv, faceuv[0], faceuv[1], faceuv[2], faceuv[3]))
+ if (quad) {
+ if (isect_point_quad_v2(uv, faceuv[0], faceuv[1], faceuv[2], faceuv[3]))
return findex;
}
- else if(isect_point_tri_v2(uv, faceuv[0], faceuv[1], faceuv[2]))
+ else if (isect_point_tri_v2(uv, faceuv[0], faceuv[1], faceuv[2]))
return findex;
}
}
@@ -1682,30 +1683,31 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, const f
static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, const float fw[4], float UNUSED(foffset), int *mapindex, float mapfw[4])
{
- if(index < 0)
+ if (index < 0)
return 0;
if (dm->deformedOnly || index_dmcache == DMCACHE_ISCHILD) {
/* for meshes that are either only defined or for child particles, the
* index and fw do not require any mapping, so we can directly use it */
- if(from == PART_FROM_VERT) {
- if(index >= dm->getNumVerts(dm))
+ if (from == PART_FROM_VERT) {
+ if (index >= dm->getNumVerts(dm))
return 0;
*mapindex = index;
}
else { /* FROM_FACE/FROM_VOLUME */
- if(index >= dm->getNumTessFaces(dm))
+ if (index >= dm->getNumTessFaces(dm))
return 0;
*mapindex = index;
copy_v4_v4(mapfw, fw);
}
- } else {
+ }
+ else {
/* for other meshes that have been modified, we try to map the particle
* to their new location, which means a different index, and for faces
* also a new face interpolation weights */
- if(from == PART_FROM_VERT) {
+ if (from == PART_FROM_VERT) {
if (index_dmcache == DMCACHE_NOTFOUND || index_dmcache > dm->getNumVerts(dm))
return 0;
@@ -1719,7 +1721,7 @@ static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_
i = index_dmcache;
- if(i== DMCACHE_NOTFOUND || i >= dm->getNumTessFaces(dm))
+ if (i== DMCACHE_NOTFOUND || i >= dm->getNumTessFaces(dm))
return 0;
*mapindex = i;
@@ -1729,7 +1731,7 @@ static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_
osface= dm->getTessFaceDataArray(dm, CD_ORIGSPACE);
mface= dm->getTessFaceData(dm, i, CD_MFACE);
- if(osface == NULL)
+ if (osface == NULL)
mapfw[0]= mapfw[1]= mapfw[2]= mapfw[3]= 0.0f;
else
psys_origspace_to_w(&osface[i], mface->v4, fw, mapfw);
@@ -1746,36 +1748,36 @@ void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache
float (*orcodata)[3];
int mapindex;
- if(!psys_map_index_on_dm(dm, from, index, index_dmcache, fw, foffset, &mapindex, mapfw)) {
- if(vec) { vec[0]=vec[1]=vec[2]=0.0; }
- if(nor) { nor[0]=nor[1]=0.0; nor[2]=1.0; }
- if(orco) { orco[0]=orco[1]=orco[2]=0.0; }
- if(ornor) { ornor[0]=ornor[1]=0.0; ornor[2]=1.0; }
- if(utan) { utan[0]=utan[1]=utan[2]=0.0; }
- if(vtan) { vtan[0]=vtan[1]=vtan[2]=0.0; }
+ if (!psys_map_index_on_dm(dm, from, index, index_dmcache, fw, foffset, &mapindex, mapfw)) {
+ if (vec) { vec[0]=vec[1]=vec[2]=0.0; }
+ if (nor) { nor[0]=nor[1]=0.0; nor[2]=1.0; }
+ if (orco) { orco[0]=orco[1]=orco[2]=0.0; }
+ if (ornor) { ornor[0]=ornor[1]=0.0; ornor[2]=1.0; }
+ if (utan) { utan[0]=utan[1]=utan[2]=0.0; }
+ if (vtan) { vtan[0]=vtan[1]=vtan[2]=0.0; }
return;
}
orcodata= dm->getVertDataArray(dm, CD_ORCO);
- if(from == PART_FROM_VERT) {
+ if (from == PART_FROM_VERT) {
dm->getVertCo(dm,mapindex,vec);
- if(nor) {
+ if (nor) {
dm->getVertNo(dm,mapindex,nor);
normalize_v3(nor);
}
- if(orco)
+ if (orco)
copy_v3_v3(orco, orcodata[mapindex]);
- if(ornor) {
+ if (ornor) {
dm->getVertNo(dm,mapindex,nor);
normalize_v3(nor);
}
- if(utan && vtan) {
+ if (utan && vtan) {
utan[0]= utan[1]= utan[2]= 0.0f;
vtan[0]= vtan[1]= vtan[2]= 0.0f;
}
@@ -1789,12 +1791,12 @@ void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache
mvert=dm->getVertDataArray(dm,CD_MVERT);
mtface=CustomData_get_layer(&dm->faceData,CD_MTFACE);
- if(mtface)
+ if (mtface)
mtface += mapindex;
- if(from==PART_FROM_VOLUME) {
+ if (from==PART_FROM_VOLUME) {
psys_interpolate_face(mvert,mface,mtface,orcodata,mapfw,vec,tmpnor,utan,vtan,orco,ornor);
- if(nor)
+ if (nor)
copy_v3_v3(nor,tmpnor);
normalize_v3(tmpnor);
@@ -1811,7 +1813,7 @@ float psys_particle_value_from_verts(DerivedMesh *dm, short from, ParticleData *
float mapfw[4];
int mapindex;
- if(!psys_map_index_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, &mapindex, mapfw))
+ if (!psys_map_index_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, &mapindex, mapfw))
return 0.0f;
return psys_interpolate_value_from_verts(dm, from, mapindex, mapfw, values);
@@ -1822,10 +1824,10 @@ ParticleSystemModifierData *psys_get_modifier(Object *ob, ParticleSystem *psys)
ModifierData *md;
ParticleSystemModifierData *psmd;
- for(md=ob->modifiers.first; md; md=md->next) {
- if(md->type==eModifierType_ParticleSystem) {
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type==eModifierType_ParticleSystem) {
psmd= (ParticleSystemModifierData*) md;
- if(psmd->psys==psys) {
+ if (psmd->psys==psys) {
return psmd;
}
}
@@ -1840,22 +1842,22 @@ static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *
{
/* TODO */
float zerovec[3]={0.0f,0.0f,0.0f};
- if(vec) {
+ if (vec) {
copy_v3_v3(vec,zerovec);
}
- if(nor) {
+ if (nor) {
copy_v3_v3(nor,zerovec);
}
- if(utan) {
+ if (utan) {
copy_v3_v3(utan,zerovec);
}
- if(vtan) {
+ if (vtan) {
copy_v3_v3(vtan,zerovec);
}
- if(orco) {
+ if (orco) {
copy_v3_v3(orco,zerovec);
}
- if(ornor) {
+ if (ornor) {
copy_v3_v3(ornor,zerovec);
}
}
@@ -1864,12 +1866,12 @@ static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *
/************************************************/
void psys_particle_on_emitter(ParticleSystemModifierData *psmd, int from, int index, int index_dmcache, float *fuv, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
{
- if(psmd) {
- if(psmd->psys->part->distr==PART_DISTR_GRID && psmd->psys->part->from != PART_FROM_VERT) {
- if(vec)
+ if (psmd) {
+ if (psmd->psys->part->distr==PART_DISTR_GRID && psmd->psys->part->from != PART_FROM_VERT) {
+ if (vec)
copy_v3_v3(vec,fuv);
- if(orco)
+ if (orco)
copy_v3_v3(orco, fuv);
return;
}
@@ -1889,13 +1891,13 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
float kink[3]={1.f,0.f,0.f}, par_vec[3], q1[4]={1.f,0.f,0.f,0.f};
float t, dt=1.f, result[3];
- if(par == NULL || type == PART_KINK_NO)
+ if (par == NULL || type == PART_KINK_NO)
return;
CLAMP(time, 0.f, 1.f);
- if(shape!=0.0f && type!=PART_KINK_BRAID) {
- if(shape<0.0f)
+ if (shape!=0.0f && type!=PART_KINK_BRAID) {
+ if (shape<0.0f)
time= (float)pow(time, 1.f+shape);
else
time= (float)pow(time, 1.f/(1.f-shape));
@@ -1903,22 +1905,22 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
t = time * freq *(float)M_PI;
- if(smooth_start) {
+ if (smooth_start) {
dt = fabs(t);
/* smooth the beginning of kink */
CLAMP(dt, 0.f, (float)M_PI);
dt = sin(dt/2.f);
}
- if(type != PART_KINK_RADIAL) {
+ if (type != PART_KINK_RADIAL) {
float temp[3];
kink[axis]=1.f;
- if(obmat)
+ if (obmat)
mul_mat3_m4_v3(obmat, kink);
- if(par_rot)
+ if (par_rot)
mul_qt_v3(par_rot, kink);
/* make sure kink is normal to strand */
@@ -1935,7 +1937,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
{
negate_v3(par_vec);
- if(flat > 0.f) {
+ if (flat > 0.f) {
float proj[3];
project_v3_v3v3(proj, par_vec, par->vel);
madd_v3_v3fl(par_vec, proj, -flat);
@@ -1951,7 +1953,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
madd_v3_v3fl(par_vec, kink, amplitude);
/* rotate kink vector around strand tangent */
- if(t!=0.f) {
+ if (t!=0.f) {
axis_angle_to_quat(q1, par->vel, t);
mul_qt_v3(q1, par_vec);
}
@@ -1961,7 +1963,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
}
case PART_KINK_RADIAL:
{
- if(flat > 0.f) {
+ if (flat > 0.f) {
float proj[3];
/* flatten along strand */
project_v3_v3v3(proj, par_vec, par->vel);
@@ -1975,7 +1977,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
{
madd_v3_v3fl(result, kink, amplitude*(float)sin(t));
- if(flat > 0.f) {
+ if (flat > 0.f) {
float proj[3];
/* flatten along wave */
project_v3_v3v3(proj, par_vec, kink);
@@ -1994,7 +1996,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
float vec_one[3], state_co[3];
float inp_y, inp_z, length;
- if(par_rot) {
+ if (par_rot) {
mul_qt_v3(par_rot, y_vec);
mul_qt_v3(par_rot, z_vec);
}
@@ -2005,20 +2007,20 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
inp_y=dot_v3v3(y_vec, vec_one);
inp_z=dot_v3v3(z_vec, vec_one);
- if(inp_y > 0.5f) {
+ if (inp_y > 0.5f) {
copy_v3_v3(state_co, y_vec);
mul_v3_fl(y_vec, amplitude*(float)cos(t));
mul_v3_fl(z_vec, amplitude/2.f*(float)sin(2.f*t));
}
- else if(inp_z > 0.0f) {
+ else if (inp_z > 0.0f) {
mul_v3_v3fl(state_co, z_vec, (float)sin((float)M_PI/3.f));
madd_v3_v3fl(state_co, y_vec, -0.5f);
mul_v3_fl(y_vec, -amplitude * (float)cos(t + (float)M_PI/3.f));
mul_v3_fl(z_vec, amplitude/2.f * (float)cos(2.f*t + (float)M_PI/6.f));
}
- else{
+ else {
mul_v3_v3fl(state_co, z_vec, -(float)sin((float)M_PI/3.f));
madd_v3_v3fl(state_co, y_vec, -0.5f);
@@ -2039,12 +2041,12 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
shape = 2.f*(float)M_PI * (1.f+shape);
- if(t<shape) {
+ if (t<shape) {
shape = t/shape;
shape = (float)sqrt((double)shape);
interp_v3_v3v3(result, result, state_co, shape);
}
- else{
+ else {
copy_v3_v3(result, state_co);
}
break;
@@ -2052,7 +2054,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
}
/* blend the start of the kink */
- if(dt < 1.f)
+ if (dt < 1.f)
interp_v3_v3v3(state->co, state->co, result, dt);
else
copy_v3_v3(state->co, result);
@@ -2062,15 +2064,15 @@ static float do_clump(ParticleKey *state, ParticleKey *par, float time, float cl
{
float clump = 0.f;
- if(par && clumpfac!=0.0f) {
+ if (par && clumpfac!=0.0f) {
float cpow;
- if(clumppow < 0.0f)
+ if (clumppow < 0.0f)
cpow=1.0f+clumppow;
else
cpow=1.0f+9.0f*clumppow;
- if(clumpfac < 0.0f) /* clump roots instead of tips */
+ if (clumpfac < 0.0f) /* clump roots instead of tips */
clump = -clumpfac*pa_clump*(float)pow(1.0-(double)time,(double)cpow);
else
clump = clumpfac*pa_clump*(float)pow((double)time,(double)cpow);
@@ -2091,7 +2093,7 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors)
GuideEffectorData *data;
PARTICLE_P;
- if(!effectors)
+ if (!effectors)
return;
LOOP_PARTICLES {
@@ -2102,11 +2104,11 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors)
pd_point_from_particle(sim, pa, &state, &point);
- for(eff = effectors->first; eff; eff=eff->next) {
- if(eff->pd->forcefield != PFIELD_GUIDE)
+ for (eff = effectors->first; eff; eff=eff->next) {
+ if (eff->pd->forcefield != PFIELD_GUIDE)
continue;
- if(!eff->guide_data)
+ if (!eff->guide_data)
eff->guide_data = MEM_callocN(sizeof(GuideEffectorData)*psys->totpart, "GuideEffectorData");
data = eff->guide_data + p;
@@ -2133,30 +2135,30 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
float guidetime, radius, weight, angle, totstrength = 0.0f;
float vec_to_point[3];
- if(effectors) for(eff = effectors->first; eff; eff=eff->next) {
+ if (effectors) for (eff = effectors->first; eff; eff=eff->next) {
pd = eff->pd;
- if(pd->forcefield != PFIELD_GUIDE)
+ if (pd->forcefield != PFIELD_GUIDE)
continue;
data = eff->guide_data + index;
- if(data->strength <= 0.0f)
+ if (data->strength <= 0.0f)
continue;
guidetime = time / (1.0f - pd->free_end);
- if(guidetime>1.0f)
+ if (guidetime>1.0f)
continue;
cu = (Curve*)eff->ob->data;
- if(pd->flag & PFIELD_GUIDE_PATH_ADD) {
- if(where_on_path(eff->ob, data->strength * guidetime, guidevec, guidedir, NULL, &radius, &weight)==0)
+ if (pd->flag & PFIELD_GUIDE_PATH_ADD) {
+ if (where_on_path(eff->ob, data->strength * guidetime, guidevec, guidedir, NULL, &radius, &weight)==0)
return 0;
}
else {
- if(where_on_path(eff->ob, guidetime, guidevec, guidedir, NULL, &radius, &weight)==0)
+ if (where_on_path(eff->ob, guidetime, guidevec, guidedir, NULL, &radius, &weight)==0)
return 0;
}
@@ -2167,7 +2169,7 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
copy_v3_v3(vec_to_point, data->vec_to_point);
- if(guidetime != 0.0f) {
+ if (guidetime != 0.0f) {
/* curve direction */
cross_v3_v3v3(temp, eff->guide_dir, guidedir);
angle = dot_v3v3(eff->guide_dir, guidedir)/(len_v3(eff->guide_dir));
@@ -2181,11 +2183,11 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
}
/* curve taper */
- if(cu->taperobj)
+ if (cu->taperobj)
mul_v3_fl(vec_to_point, calc_taper(eff->scene, cu->taperobj, (int)(data->strength*guidetime*100.0f), 100));
- else{ /* curve size*/
- if(cu->flag & CU_PATH_RADIUS) {
+ else { /* curve size*/
+ if (cu->flag & CU_PATH_RADIUS) {
mul_v3_fl(vec_to_point, radius);
}
}
@@ -2202,12 +2204,12 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
madd_v3_v3fl(veffect, guidedir, data->strength);
totstrength += data->strength;
- if(pd->flag & PFIELD_GUIDE_PATH_WEIGHT)
+ if (pd->flag & PFIELD_GUIDE_PATH_WEIGHT)
totstrength *= weight;
}
- if(totstrength != 0.0f) {
- if(totstrength > 1.0f)
+ if (totstrength != 0.0f) {
+ if (totstrength > 1.0f)
mul_v3_fl(effect, 1.0f / totstrength);
CLAMP(totstrength, 0.0f, 1.0f);
//add_v3_v3(effect,pa_zero);
@@ -2225,8 +2227,8 @@ static void do_rough(float *loc, float mat[4][4], float t, float fac, float size
float rough[3];
float rco[3];
- if(thres != 0.0f)
- if((float)fabs((float)(-1.5f+loc[0]+loc[1]+loc[2]))<1.5f*thres) return;
+ if (thres != 0.0f)
+ if ((float)fabs((float)(-1.5f+loc[0]+loc[1]+loc[2]))<1.5f*thres) return;
copy_v3_v3(rco,loc);
mul_v3_fl(rco,t);
@@ -2259,7 +2261,7 @@ static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheK
EffectedPoint epoint;
/* Don't apply effectors for dynamic hair, otherwise the effectors don't get applied twice. */
- if(sim->psys->flag & PSYS_HAIR_DYNAMICS)
+ if (sim->psys->flag & PSYS_HAIR_DYNAMICS)
return;
copy_v3_v3(eff_key.co,(ca-1)->co);
@@ -2275,17 +2277,17 @@ static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheK
normalize_v3(force);
- if(k < steps)
+ if (k < steps)
sub_v3_v3v3(vec, (ca+1)->co, ca->co);
madd_v3_v3v3fl(ca->co, (ca-1)->co, force, *length);
- if(k < steps)
+ if (k < steps)
*length = len_v3(vec);
}
static int check_path_length(int k, ParticleCacheKey *keys, ParticleCacheKey *state, float max_length, float *cur_length, float length, float *dvec)
{
- if(*cur_length + length > max_length) {
+ if (*cur_length + length > max_length) {
mul_v3_fl(dvec, (max_length - *cur_length) / length);
add_v3_v3v3(state->co, (state - 1)->co, dvec);
keys->steps = k;
@@ -2306,7 +2308,7 @@ static void offset_child(ChildParticle *cpa, ParticleKey *par, float *par_rot, P
copy_v3_v3(child->vel, par->vel);
- if(par_rot) {
+ if (par_rot) {
mul_qt_v3(par_rot, child->co);
copy_qt_qt(child->rot, par_rot);
}
@@ -2319,21 +2321,21 @@ float *psys_cache_vgroup(DerivedMesh *dm, ParticleSystem *psys, int vgroup)
{
float *vg=0;
- if(vgroup < 0) {
+ if (vgroup < 0) {
/* hair dynamics pinning vgroup */
}
- else if(psys->vgroup[vgroup]) {
+ else if (psys->vgroup[vgroup]) {
MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
- if(dvert) {
+ if (dvert) {
int totvert=dm->getNumVerts(dm), i;
vg=MEM_callocN(sizeof(float)*totvert, "vg_cache");
- if(psys->vg_neg&(1<<vgroup)) {
- for(i=0; i<totvert; i++)
+ if (psys->vg_neg&(1<<vgroup)) {
+ for (i=0; i<totvert; i++)
vg[i]= 1.0f - defvert_find_weight(&dvert[i], psys->vgroup[vgroup] - 1);
}
- else{
- for(i=0; i<totvert; i++)
+ else {
+ for (i=0; i<totvert; i++)
vg[i]= defvert_find_weight(&dvert[i], psys->vgroup[vgroup] - 1);
}
}
@@ -2350,19 +2352,19 @@ void psys_find_parents(ParticleSimulationData *sim)
int from=PART_FROM_FACE;
totparent=(int)(totchild*part->parents*0.3f);
- if(G.rendering && part->child_nbr && part->ren_child_nbr)
+ if (G.rendering && part->child_nbr && part->ren_child_nbr)
totparent*=(float)part->child_nbr/(float)part->ren_child_nbr;
tree=BLI_kdtree_new(totparent);
- for(p=0,cpa=sim->psys->child; p<totparent; p++,cpa++) {
+ for (p=0,cpa=sim->psys->child; p<totparent; p++,cpa++) {
psys_particle_on_emitter(sim->psmd,from,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
BLI_kdtree_insert(tree, p, orco, NULL);
}
BLI_kdtree_balance(tree);
- for(; p<totchild; p++,cpa++) {
+ for (; p<totchild; p++,cpa++) {
psys_particle_on_emitter(sim->psmd,from,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
cpa->parent=BLI_kdtree_find_nearest(tree, orco, NULL, NULL);
}
@@ -2374,10 +2376,10 @@ static void get_strand_normal(Material *ma, const float surfnor[3], float surfdi
{
float cross[3], nstrand[3], vnor[3], blend;
- if(!((ma->mode & MA_STR_SURFDIFF) || (ma->strand_surfnor > 0.0f)))
+ if (!((ma->mode & MA_STR_SURFDIFF) || (ma->strand_surfnor > 0.0f)))
return;
- if(ma->mode & MA_STR_SURFDIFF) {
+ if (ma->mode & MA_STR_SURFDIFF) {
cross_v3_v3v3(cross, surfnor, nor);
cross_v3_v3v3(nstrand, nor, cross);
@@ -2391,8 +2393,8 @@ static void get_strand_normal(Material *ma, const float surfnor[3], float surfdi
copy_v3_v3(vnor, nor);
}
- if(ma->strand_surfnor > 0.0f) {
- if(ma->strand_surfnor > surfdist) {
+ if (ma->strand_surfnor > 0.0f) {
+ if (ma->strand_surfnor > surfdist) {
blend= (ma->strand_surfnor - surfdist)/ma->strand_surfnor;
interp_v3_v3v3(vnor, vnor, surfnor, blend);
normalize_v3(vnor);
@@ -2415,41 +2417,41 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
int i, seed, totthread= threads[0].tot;
/*---start figuring out what is actually wanted---*/
- if(psys_in_edit_mode(scene, psys)) {
+ if (psys_in_edit_mode(scene, psys)) {
ParticleEditSettings *pset = &scene->toolsettings->particle;
- if(psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
+ if (psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
totchild=0;
steps = (int)pow(2.0, (double)pset->draw_step);
}
- if(totchild && part->childtype==PART_CHILD_FACES) {
+ if (totchild && part->childtype==PART_CHILD_FACES) {
totparent=(int)(totchild*part->parents*0.3f);
- if(G.rendering && part->child_nbr && part->ren_child_nbr)
+ if (G.rendering && part->child_nbr && part->ren_child_nbr)
totparent*=(float)part->child_nbr/(float)part->ren_child_nbr;
/* part->parents could still be 0 so we can't test with totparent */
between=1;
}
- if(psys->renderdata)
+ if (psys->renderdata)
steps=(int)pow(2.0,(double)part->ren_step);
- else{
+ else {
totchild=(int)((float)totchild*(float)part->disp/100.0f);
totparent=MIN2(totparent,totchild);
}
- if(totchild==0) return 0;
+ if (totchild==0) return 0;
/* init random number generator */
seed= 31415926 + ctx->sim.psys->seed;
- if(ctx->editupdate || totchild < 10000)
+ if (ctx->editupdate || totchild < 10000)
totthread= 1;
- for(i=0; i<totthread; i++) {
+ for (i=0; i<totthread; i++) {
threads[i].rng_path= rng_new(seed);
threads[i].tot= totthread;
}
@@ -2472,12 +2474,12 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
ctx->vg_rough1 = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_ROUGH1);
ctx->vg_rough2 = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_ROUGH2);
ctx->vg_roughe = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_ROUGHE);
- if(psys->part->flag & PART_CHILD_EFFECT)
+ if (psys->part->flag & PART_CHILD_EFFECT)
ctx->vg_effector = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_EFFECTOR);
/* set correct ipo timing */
#if 0 // XXX old animation system
- if(part->flag&PART_ABS_TIME && part->ipo) {
+ if (part->flag&PART_ABS_TIME && part->ipo) {
calc_ipo(part->ipo, cfra);
execute_ipo((ID *)part, part->ipo);
}
@@ -2504,10 +2506,10 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
int k, cpa_num;
short cpa_from;
- if(!pcache)
+ if (!pcache)
return;
- if(ctx->between) {
+ if (ctx->between) {
ParticleData *pa = psys->particles + cpa->pa[0];
int w, needupdate;
float foffset, wsum=0.f;
@@ -2517,26 +2519,26 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
/* Virtual parents don't work nicely with parting. */
float p_fac = part->parents > 0.f ? 0.f : part->parting_fac;
- if(ctx->editupdate) {
+ if (ctx->editupdate) {
needupdate= 0;
w= 0;
- while(w<4 && cpa->pa[w]>=0) {
- if(psys->edit->points[cpa->pa[w]].flag & PEP_EDIT_RECALC) {
+ while (w<4 && cpa->pa[w]>=0) {
+ if (psys->edit->points[cpa->pa[w]].flag & PEP_EDIT_RECALC) {
needupdate= 1;
break;
}
w++;
}
- if(!needupdate)
+ if (!needupdate)
return;
else
memset(child_keys, 0, sizeof(*child_keys)*(ctx->steps+1));
}
/* get parent paths */
- for(w=0; w<4; w++) {
- if(cpa->pa[w] >= 0) {
+ for (w=0; w<4; w++) {
+ if (cpa->pa[w] >= 0) {
key[w] = pcache[cpa->pa[w]];
weight[w] = cpa->w[w];
}
@@ -2547,11 +2549,11 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
}
/* modify weights to create parting */
- if(p_fac > 0.f) {
- for(w=0; w<4; w++) {
- if(w && weight[w] > 0.f) {
+ if (p_fac > 0.f) {
+ for (w=0; w<4; w++) {
+ if (w && weight[w] > 0.f) {
float d;
- if(part->flag & PART_CHILD_LONG_HAIR) {
+ if (part->flag & PART_CHILD_LONG_HAIR) {
/* For long hair use tip distance/root distance as parting factor instead of root to tip angle. */
float d1 = len_v3v3(key[0]->co, key[w]->co);
float d2 = len_v3v3((key[0]+key[0]->steps-1)->co, (key[w]+key[w]->steps-1)->co);
@@ -2568,19 +2570,19 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
d = RAD2DEGF(saacos(dot_v3v3(v1, v2)));
}
- if(p_max > p_min)
+ if (p_max > p_min)
d = (d - p_min)/(p_max - p_min);
else
d = (d - p_min) <= 0.f ? 0.f : 1.f;
CLAMP(d, 0.f, 1.f);
- if(d > 0.f)
+ if (d > 0.f)
weight[w] *= (1.f - d);
}
wsum += weight[w];
}
- for(w=0; w<4; w++)
+ for (w=0; w<4; w++)
weight[w] /= wsum;
interp_v4_v4v4(weight, cpa->w, weight, p_fac);
@@ -2597,16 +2599,16 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
mul_m4_v3(ob->obmat, co);
- for(w=0; w<4; w++)
+ for (w=0; w<4; w++)
sub_v3_v3v3(off1[w], co, key[w]->co);
psys_mat_hair_to_global(ob, ctx->sim.psmd->dm, psys->part->from, pa, hairmat);
}
- else{
+ else {
ParticleData *pa = psys->particles + cpa->parent;
float co[3];
- if(ctx->editupdate) {
- if(!(psys->edit->points[cpa->parent].flag & PEP_EDIT_RECALC))
+ if (ctx->editupdate) {
+ if (!(psys->edit->points[cpa->parent].flag & PEP_EDIT_RECALC))
return;
memset(child_keys, 0, sizeof(*child_keys)*(ctx->steps+1));
@@ -2630,26 +2632,26 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
/* get different child parameters from textures & vgroups */
get_child_modifier_parameters(part, ctx, cpa, cpa_from, cpa_num, cpa_fuv, orco, &ptex);
- if(ptex.exist < PSYS_FRAND(i + 24)) {
+ if (ptex.exist < PSYS_FRAND(i + 24)) {
child_keys->steps = -1;
return;
}
/* create the child path */
- for(k=0,child=child_keys; k<=ctx->steps; k++,child++) {
- if(ctx->between) {
+ for (k=0,child=child_keys; k<=ctx->steps; k++,child++) {
+ if (ctx->between) {
int w=0;
zero_v3(child->co);
zero_v3(child->vel);
unit_qt(child->rot);
- for(w=0; w<4; w++) {
+ for (w=0; w<4; w++) {
copy_v3_v3(off2[w], off1[w]);
- if(part->flag & PART_CHILD_LONG_HAIR) {
+ if (part->flag & PART_CHILD_LONG_HAIR) {
/* Use parent rotation (in addition to emission location) to determine child offset. */
- if(k)
+ if (k)
mul_qt_v3((key[w]+k)->rot, off2[w]);
/* Fade the effect of rotation for even lengths in the end */
@@ -2666,8 +2668,8 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
copy_qt_qt(child->rot, (key[0]+k)->rot);
}
- else{
- if(k) {
+ else {
+ if (k) {
mul_qt_qtqt(rot, (key[0]+k)->rot, key[0]->rot);
par_rot = rot;
}
@@ -2682,9 +2684,9 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
}
/* apply effectors */
- if(part->flag & PART_CHILD_EFFECT) {
- for(k=0,child=child_keys; k<=ctx->steps; k++,child++) {
- if(k) {
+ if (part->flag & PART_CHILD_EFFECT) {
+ for (k=0,child=child_keys; k<=ctx->steps; k++,child++) {
+ if (k) {
do_path_effectors(&ctx->sim, cpa->pa[0], child, k, ctx->steps, child_keys->co, ptex.effector, 0.0f, ctx->cfra, &eff_length, eff_vec);
}
else {
@@ -2694,17 +2696,17 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
}
}
- for(k=0,child=child_keys; k<=ctx->steps; k++,child++) {
+ for (k=0,child=child_keys; k<=ctx->steps; k++,child++) {
t = (float)k/(float)ctx->steps;
- if(ctx->totparent)
+ if (ctx->totparent)
/* this is now threadsafe, virtual parents are calculated before rest of children */
par = (i >= ctx->totparent) ? cache[cpa->parent] : NULL;
- else if(cpa->parent >= 0)
+ else if (cpa->parent >= 0)
par = pcache[cpa->parent];
- if(par) {
- if(k) {
+ if (par) {
+ if (k) {
mul_qt_qtqt(rot, (par+k)->rot, par->rot);
par_rot = rot;
}
@@ -2718,37 +2720,37 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
do_child_modifiers(&ctx->sim, &ptex, (ParticleKey *)par, par_rot, cpa, orco, hairmat, (ParticleKey *)child, t);
/* we have to correct velocity because of kink & clump */
- if(k>1) {
+ if (k>1) {
sub_v3_v3v3((child-1)->vel, child->co, (child-2)->co);
mul_v3_fl((child-1)->vel, 0.5);
- if(ctx->ma && (part->draw_col == PART_DRAW_COL_MAT))
+ if (ctx->ma && (part->draw_col == PART_DRAW_COL_MAT))
get_strand_normal(ctx->ma, ornor, cur_length, (child-1)->vel);
}
- if(k == ctx->steps)
+ if (k == ctx->steps)
sub_v3_v3v3(child->vel, child->co, (child-1)->co);
/* check if path needs to be cut before actual end of data points */
- if(k) {
+ if (k) {
sub_v3_v3v3(dvec, child->co, (child-1)->co);
length = 1.0f/(float)ctx->steps;
k = check_path_length(k, child_keys, child, max_length, &cur_length, length, dvec);
}
- else{
+ else {
/* initialize length calculation */
max_length = ptex.length;
cur_length = 0.0f;
}
- if(ctx->ma && (part->draw_col == PART_DRAW_COL_MAT)) {
+ if (ctx->ma && (part->draw_col == PART_DRAW_COL_MAT)) {
copy_v3_v3(child->col, &ctx->ma->r);
get_strand_normal(ctx->ma, ornor, cur_length, child->vel);
}
}
/* Hide virtual parents */
- if(i < ctx->totparent)
+ if (i < ctx->totparent)
child_keys->steps = -1;
}
@@ -2761,13 +2763,13 @@ static void *exec_child_path_cache(void *data)
ChildParticle *cpa;
int i, totchild= ctx->totchild, first= 0;
- if(thread->tot > 1) {
+ if (thread->tot > 1) {
first= ctx->parent_pass? 0 : ctx->totparent;
totchild= ctx->parent_pass? ctx->totparent : ctx->totchild;
}
cpa= psys->child + first + thread->num;
- for(i=first+thread->num; i<totchild; i+=thread->tot, cpa+=thread->tot)
+ for (i=first+thread->num; i<totchild; i+=thread->tot, cpa+=thread->tot)
psys_thread_create_path(thread, cpa, cache[i], i);
return 0;
@@ -2780,12 +2782,12 @@ void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupd
ListBase threads;
int i, totchild, totparent, totthread;
- if(sim->psys->flag & PSYS_GLOBAL_HAIR)
+ if (sim->psys->flag & PSYS_GLOBAL_HAIR)
return;
pthreads= psys_threads_create(sim);
- if(!psys_threads_init_path(pthreads, sim->scene, cfra, editupdate)) {
+ if (!psys_threads_init_path(pthreads, sim->scene, cfra, editupdate)) {
psys_threads_free(pthreads);
return;
}
@@ -2794,7 +2796,7 @@ void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupd
totchild= ctx->totchild;
totparent= ctx->totparent;
- if(editupdate && sim->psys->childcache && totchild == sim->psys->totchildcache) {
+ if (editupdate && sim->psys->childcache && totchild == sim->psys->totchildcache) {
; /* just overwrite the existing cache */
}
else {
@@ -2806,26 +2808,26 @@ void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupd
totthread= pthreads[0].tot;
- if(totthread > 1) {
+ if (totthread > 1) {
/* make virtual child parents thread safe by calculating them first */
- if(totparent) {
+ if (totparent) {
BLI_init_threads(&threads, exec_child_path_cache, totthread);
- for(i=0; i<totthread; i++) {
+ for (i=0; i<totthread; i++) {
pthreads[i].ctx->parent_pass = 1;
BLI_insert_thread(&threads, &pthreads[i]);
}
BLI_end_threads(&threads);
- for(i=0; i<totthread; i++)
+ for (i=0; i<totthread; i++)
pthreads[i].ctx->parent_pass = 0;
}
BLI_init_threads(&threads, exec_child_path_cache, totthread);
- for(i=0; i<totthread; i++)
+ for (i=0; i<totthread; i++)
BLI_insert_thread(&threads, &pthreads[i]);
BLI_end_threads(&threads);
@@ -2859,7 +2861,7 @@ static void cache_key_incremental_rotation(ParticleCacheKey *key0, ParticleCache
/* note we do the comparison on cosangle instead of
* angle, since floating point accuracy makes it give
* different results across platforms */
- if(cosangle > 0.999999f) {
+ if (cosangle > 0.999999f) {
copy_v4_v4(key1->rot, key2->rot);
}
else {
@@ -2910,11 +2912,11 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
int keyed, baked;
/* we don't have anything valid to create paths from so let's quit here */
- if((psys->flag & PSYS_HAIR_DONE || psys->flag & PSYS_KEYED || psys->pointcache)==0)
+ if ((psys->flag & PSYS_HAIR_DONE || psys->flag & PSYS_KEYED || psys->pointcache)==0)
return;
- if(psys_in_edit_mode(sim->scene, psys))
- if(psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
+ if (psys_in_edit_mode(sim->scene, psys))
+ if (psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
return;
keyed = psys->flag & PSYS_KEYED;
@@ -2926,14 +2928,14 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
psys->lattice = psys_get_lattice(sim);
ma= give_current_material(sim->ob, psys->part->omat);
- if(ma && (psys->part->draw_col == PART_DRAW_COL_MAT))
+ if (ma && (psys->part->draw_col == PART_DRAW_COL_MAT))
copy_v3_v3(col, &ma->r);
- if((psys->flag & PSYS_GLOBAL_HAIR)==0) {
- if((psys->part->flag & PART_CHILD_EFFECT)==0)
+ if ((psys->flag & PSYS_GLOBAL_HAIR)==0) {
+ if ((psys->part->flag & PART_CHILD_EFFECT)==0)
vg_effector = psys_cache_vgroup(psmd->dm, psys, PSYS_VG_EFFECTOR);
- if(!psys->totchild)
+ if (!psys->totchild)
vg_length = psys_cache_vgroup(psmd->dm, psys, PSYS_VG_LENGTH);
}
@@ -2944,10 +2946,10 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
/*---first main loop: create all actual particles' paths---*/
LOOP_SHOWN_PARTICLES {
- if(!psys->totchild) {
+ if (!psys->totchild) {
psys_get_texture(sim, pa, &ptex, PAMAP_LENGTH, 0.f);
pa_length = ptex.length * (1.0f - part->randlength * PSYS_FRAND(psys->seed + p));
- if(vg_length)
+ if (vg_length)
pa_length *= psys_particle_value_from_verts(psmd->dm,part->from,pa,vg_length);
}
@@ -2970,7 +2972,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
copy_v3_v3(rotmat[1], hairmat[1]);
copy_v3_v3(rotmat[2], hairmat[0]);
- if(part->draw & PART_ABS_PATH_TIME) {
+ if (part->draw & PART_ABS_PATH_TIME) {
birthtime = MAX2(pind.birthtime, part->path_start);
dietime = MIN2(pind.dietime, part->path_end);
}
@@ -2980,7 +2982,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
dietime = tb + part->path_end * (pind.dietime - tb);
}
- if(birthtime >= dietime) {
+ if (birthtime >= dietime) {
cache[p]->steps = -1;
continue;
}
@@ -2988,7 +2990,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
dietime = birthtime + pa_length * (dietime - birthtime);
/*--interpolate actual path from data points--*/
- for(k=0, ca=cache[p]; k<=steps; k++, ca++) {
+ for (k=0, ca=cache[p]; k<=steps; k++, ca++) {
time = (float)k / (float)steps;
t = birthtime + time * (dietime - birthtime);
result.time = -t;
@@ -2997,9 +2999,9 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
/* dynamic hair is in object space */
/* keyed and baked are already in global space */
- if(hair_dm)
+ if (hair_dm)
mul_m4_v3(sim->ob->obmat, ca->co);
- else if(!keyed && !baked && !(psys->flag & PSYS_GLOBAL_HAIR))
+ else if (!keyed && !baked && !(psys->flag & PSYS_GLOBAL_HAIR))
mul_m4_v3(hairmat, ca->co);
copy_v3_v3(ca->col, col);
@@ -3007,45 +3009,45 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
/*--modify paths and calculate rotation & velocity--*/
- if(!(psys->flag & PSYS_GLOBAL_HAIR)) {
+ if (!(psys->flag & PSYS_GLOBAL_HAIR)) {
/* apply effectors */
- if((psys->part->flag & PART_CHILD_EFFECT) == 0) {
+ if ((psys->part->flag & PART_CHILD_EFFECT) == 0) {
float effector= 1.0f;
- if(vg_effector)
+ if (vg_effector)
effector*= psys_particle_value_from_verts(psmd->dm,psys->part->from,pa,vg_effector);
sub_v3_v3v3(vec,(cache[p]+1)->co,cache[p]->co);
length = len_v3(vec);
- for(k=1, ca=cache[p]+1; k<=steps; k++, ca++)
+ for (k=1, ca=cache[p]+1; k<=steps; k++, ca++)
do_path_effectors(sim, p, ca, k, steps, cache[p]->co, effector, dfra, cfra, &length, vec);
}
/* apply guide curves to path data */
- if(sim->psys->effectors && (psys->part->flag & PART_CHILD_EFFECT)==0) {
- for(k=0, ca=cache[p]; k<=steps; k++, ca++)
+ if (sim->psys->effectors && (psys->part->flag & PART_CHILD_EFFECT)==0) {
+ for (k=0, ca=cache[p]; k<=steps; k++, ca++)
/* ca is safe to cast, since only co and vel are used */
do_guides(sim->psys->effectors, (ParticleKey*)ca, p, (float)k/(float)steps);
}
/* lattices have to be calculated separately to avoid mixups between effector calculations */
- if(psys->lattice) {
- for(k=0, ca=cache[p]; k<=steps; k++, ca++)
+ if (psys->lattice) {
+ for (k=0, ca=cache[p]; k<=steps; k++, ca++)
calc_latt_deform(psys->lattice, ca->co, 1.0f);
}
}
/* finally do rotation & velocity */
- for(k=1, ca=cache[p]+1; k<=steps; k++, ca++) {
+ for (k=1, ca=cache[p]+1; k<=steps; k++, ca++) {
cache_key_incremental_rotation(ca, ca - 1, ca - 2, prev_tangent, k);
- if(k == steps)
+ if (k == steps)
copy_qt_qt(ca->rot, (ca - 1)->rot);
/* set velocity */
sub_v3_v3v3(ca->vel, ca->co, (ca-1)->co);
- if(k==1)
+ if (k==1)
copy_v3_v3((ca-1)->vel, ca->vel);
ca->time = (float)k/(float)steps;
@@ -3062,15 +3064,15 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
psys->totcached = totpart;
- if(psys->lattice) {
+ if (psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
- if(vg_effector)
+ if (vg_effector)
MEM_freeN(vg_effector);
- if(vg_length)
+ if (vg_length)
MEM_freeN(vg_length);
}
void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cfra)
@@ -3099,23 +3101,23 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
steps = MAX2(steps, 4);
- if(!cache || edit->totpoint != edit->totcached) {
+ if (!cache || edit->totpoint != edit->totcached) {
/* clear out old and create new empty path cache */
psys_free_path_cache(edit->psys, edit);
cache= edit->pathcache= psys_alloc_path_cache_buffers(&edit->pathcachebufs, totpart, steps+1);
/* set flag for update (child particles check this too) */
- for(i=0, point=edit->points; i<totpart; i++, point++)
+ for (i=0, point=edit->points; i<totpart; i++, point++)
point->flag |= PEP_EDIT_RECALC;
recalc_set = 1;
}
/* frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f; */ /* UNUSED */
- if(pset->brushtype == PE_BRUSH_WEIGHT) {
+ if (pset->brushtype == PE_BRUSH_WEIGHT) {
;/* use weight painting colors now... */
}
- else{
+ else {
sel_col[0] = (float)edit->sel_col[0] / 255.0f;
sel_col[1] = (float)edit->sel_col[1] / 255.0f;
sel_col[2] = (float)edit->sel_col[2] / 255.0f;
@@ -3125,11 +3127,11 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
}
/*---first main loop: create all actual particles' paths---*/
- for(i=0, point=edit->points; i<totpart; i++, pa+=pa?1:0, point++) {
- if(edit->totcached && !(point->flag & PEP_EDIT_RECALC))
+ for (i=0, point=edit->points; i<totpart; i++, pa+=pa?1:0, point++) {
+ if (edit->totcached && !(point->flag & PEP_EDIT_RECALC))
continue;
- if(point->totkey == 0)
+ if (point->totkey == 0)
continue;
ekey = point->keys;
@@ -3142,7 +3144,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
/* should init_particle_interpolation set this ? */
- if(pset->brushtype==PE_BRUSH_WEIGHT) {
+ if (pset->brushtype==PE_BRUSH_WEIGHT) {
pind.hkey[0] = NULL;
/* pa != NULL since the weight brush is only available for hair */
pind.hkey[1] = pa->hair;
@@ -3156,7 +3158,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
/*--get the first data points--*/
init_particle_interpolation(ob, psys, pa, &pind);
- if(psys) {
+ if (psys) {
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
copy_v3_v3(rotmat[0], hairmat[2]);
copy_v3_v3(rotmat[1], hairmat[1]);
@@ -3166,13 +3168,13 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
birthtime = pind.birthtime;
dietime = pind.dietime;
- if(birthtime >= dietime) {
+ if (birthtime >= dietime) {
cache[i]->steps = -1;
continue;
}
/*--interpolate actual path from data points--*/
- for(k=0, ca=cache[i]; k<=steps; k++, ca++) {
+ for (k=0, ca=cache[i]; k<=steps; k++, ca++) {
time = (float)k / (float)steps;
t = birthtime + time * (dietime - birthtime);
result.time = -t;
@@ -3180,19 +3182,19 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
copy_v3_v3(ca->co, result.co);
/* non-hair points are already in global space */
- if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+ if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
mul_m4_v3(hairmat, ca->co);
- if(k) {
+ if (k) {
cache_key_incremental_rotation(ca, ca - 1, ca - 2, prev_tangent, k);
- if(k == steps)
+ if (k == steps)
copy_qt_qt(ca->rot, (ca - 1)->rot);
/* set velocity */
sub_v3_v3v3(ca->vel, ca->co, (ca - 1)->co);
- if(k==1)
+ if (k==1)
copy_v3_v3((ca - 1)->vel, ca->vel);
}
}
@@ -3202,12 +3204,13 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
}
/* selection coloring in edit mode */
- if(pset->brushtype==PE_BRUSH_WEIGHT) {
+ if (pset->brushtype==PE_BRUSH_WEIGHT) {
float t2;
- if(k==0) {
+ if (k==0) {
weight_to_rgb(ca->col, pind.hkey[1]->weight);
- } else {
+ }
+ else {
float w1[3], w2[3];
keytime = (t - (*pind.ekey[0]->time))/((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
@@ -3225,21 +3228,21 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
pind.hkey[0] = pind.hkey[1] - 1;
}
else {
- if((ekey + (pind.ekey[0] - point->keys))->flag & PEK_SELECT) {
- if((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT) {
+ if ((ekey + (pind.ekey[0] - point->keys))->flag & PEK_SELECT) {
+ if ((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT) {
copy_v3_v3(ca->col, sel_col);
}
- else{
+ else {
keytime = (t - (*pind.ekey[0]->time))/((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
interp_v3_v3v3(ca->col, sel_col, nosel_col, keytime);
}
}
- else{
- if((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT) {
+ else {
+ if ((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT) {
keytime = (t - (*pind.ekey[0]->time))/((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
interp_v3_v3v3(ca->col, nosel_col, sel_col, keytime);
}
- else{
+ else {
copy_v3_v3(ca->col, nosel_col);
}
}
@@ -3247,7 +3250,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
ca->time = t;
}
- if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+ if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
/* First rotation is based on emitting face orientation.
* This is way better than having flipping rotations resulting
* from using a global axis as a rotation pole (vec_to_quat()).
@@ -3261,7 +3264,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
edit->totcached = totpart;
- if(psys) {
+ if (psys) {
ParticleSimulationData sim= {0};
sim.scene= scene;
sim.ob= ob;
@@ -3272,8 +3275,8 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
}
/* clear recalc flag if set here */
- if(recalc_set) {
- for(i=0, point=edit->points; i<totpart; i++, point++)
+ if (recalc_set) {
+ for (i=0, point=edit->points; i<totpart; i++, point++)
point->flag &= ~PEP_EDIT_RECALC;
}
}
@@ -3282,10 +3285,10 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
/************************************************/
void copy_particle_key(ParticleKey *to, ParticleKey *from, int time)
{
- if(time) {
+ if (time) {
memcpy(to,from,sizeof(ParticleKey));
}
- else{
+ else {
float to_time=to->time;
memcpy(to,from,sizeof(ParticleKey));
to->time=to_time;
@@ -3293,10 +3296,10 @@ void copy_particle_key(ParticleKey *to, ParticleKey *from, int time)
}
void psys_get_from_key(ParticleKey *key, float *loc, float *vel, float *rot, float *time)
{
- if(loc) copy_v3_v3(loc,key->co);
- if(vel) copy_v3_v3(vel,key->vel);
- if(rot) copy_qt_qt(rot,key->rot);
- if(time) *time=key->time;
+ if (loc) copy_v3_v3(loc,key->co);
+ if (vel) copy_v3_v3(vel,key->vel);
+ if (rot) copy_qt_qt(rot,key->rot);
+ if (time) *time=key->time;
}
/*-------changing particle keys from space to another-------*/
#if 0
@@ -3326,7 +3329,7 @@ static void triatomat(float *v1, float *v2, float *v3, float (*uv)[2], float mat
normal_tri_v3( mat[2],v1, v2, v3);
/* second axis along (1, 0) in uv space */
- if(uv) {
+ if (uv) {
d1[0]= uv[1][0] - uv[0][0];
d1[1]= uv[1][1] - uv[0][1];
d2[0]= uv[2][0] - uv[0][0];
@@ -3334,7 +3337,7 @@ static void triatomat(float *v1, float *v2, float *v3, float (*uv)[2], float mat
det = d2[0]*d1[1] - d2[1]*d1[0];
- if(det != 0.0f) {
+ if (det != 0.0f) {
det= 1.0f/det;
w1= -d2[1]*det;
w2= d1[1]*det;
@@ -3370,14 +3373,14 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m
mface=dm->getTessFaceData(dm,i,CD_MFACE);
osface=dm->getTessFaceData(dm,i,CD_ORIGSPACE);
- if(orco && (orcodata=dm->getVertDataArray(dm, CD_ORCO))) {
+ if (orco && (orcodata=dm->getVertDataArray(dm, CD_ORCO))) {
copy_v3_v3(v[0], orcodata[mface->v1]);
copy_v3_v3(v[1], orcodata[mface->v2]);
copy_v3_v3(v[2], orcodata[mface->v3]);
/* ugly hack to use non-transformed orcos, since only those
* give symmetric results for mirroring in particle mode */
- if(DM_get_vert_data_layer(dm, CD_ORIGINDEX))
+ if (DM_get_vert_data_layer(dm, CD_ORIGINDEX))
transform_mesh_orco_verts(ob->data, v, 3, 1);
}
else {
@@ -3406,7 +3409,7 @@ void psys_mat_hair_to_orco(Object *ob, DerivedMesh *dm, short from, ParticleData
psys_particle_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, orco, 0);
/* see psys_face_mat for why this function is called */
- if(DM_get_vert_data_layer(dm, CD_ORIGINDEX))
+ if (DM_get_vert_data_layer(dm, CD_ORIGINDEX))
transform_mesh_orco_verts(ob->data, &orco, 1, 1);
copy_v3_v3(hairmat[3],orco);
}
@@ -3438,11 +3441,11 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
ModifierData *md;
ParticleSystemModifierData *psmd;
- if(!ob || ob->type != OB_MESH)
+ if (!ob || ob->type != OB_MESH)
return NULL;
psys = ob->particlesystem.first;
- for(; psys; psys=psys->next)
+ for (; psys; psys=psys->next)
psys->flag &= ~PSYS_CURRENT;
psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
@@ -3451,14 +3454,14 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
psys->part = psys_new_settings("ParticleSettings", NULL);
- if(BLI_countlist(&ob->particlesystem)>1)
+ if (BLI_countlist(&ob->particlesystem)>1)
BLI_snprintf(psys->name, sizeof(psys->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
else
strcpy(psys->name, "ParticleSystem");
md= modifier_new(eModifierType_ParticleSystem);
- if(name) BLI_strncpy(md->name, name, sizeof(md->name));
+ if (name) BLI_strncpy(md->name, name, sizeof(md->name));
else BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
modifier_unique_name(&ob->modifiers, md);
@@ -3481,21 +3484,21 @@ void object_remove_particle_system(Scene *scene, Object *ob)
ParticleSystemModifierData *psmd;
ModifierData *md;
- if(!psys)
+ if (!psys)
return;
/* clear all other appearances of this pointer (like on smoke flow modifier) */
if ((md = modifiers_findByType(ob, eModifierType_Smoke))) {
SmokeModifierData *smd = (SmokeModifierData *)md;
- if((smd->type == MOD_SMOKE_TYPE_FLOW) && smd->flow && smd->flow->psys)
- if(smd->flow->psys == psys)
+ if ((smd->type == MOD_SMOKE_TYPE_FLOW) && smd->flow && smd->flow->psys)
+ if (smd->flow->psys == psys)
smd->flow->psys = NULL;
}
if ((md = modifiers_findByType(ob, eModifierType_DynamicPaint))) {
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
- if(pmd->brush && pmd->brush->psys)
- if(pmd->brush->psys == psys)
+ if (pmd->brush && pmd->brush->psys)
+ if (pmd->brush->psys == psys)
pmd->brush->psys = NULL;
}
@@ -3508,7 +3511,7 @@ void object_remove_particle_system(Scene *scene, Object *ob)
BLI_remlink(&ob->particlesystem, psys);
psys_free(ob,psys);
- if(ob->particlesystem.first)
+ if (ob->particlesystem.first)
((ParticleSystem *) ob->particlesystem.first)->flag |= PSYS_CURRENT;
else
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
@@ -3557,7 +3560,7 @@ static void default_particle_settings(ParticleSettings *part)
part->childsize=1.0;
part->rotmode = PART_ROT_VEL;
- part->avemode = PART_AVE_SPIN;
+ part->avemode = PART_AVE_VELOCITY;
part->child_nbr=10;
part->ren_child_nbr=100;
@@ -3591,7 +3594,7 @@ static void default_particle_settings(ParticleSettings *part)
part->simplify_transition= 0.1f;
part->simplify_viewport= 0.8;
- if(!part->effector_weights)
+ if (!part->effector_weights)
part->effector_weights = BKE_add_effector_weights(NULL);
}
@@ -3600,7 +3603,7 @@ ParticleSettings *psys_new_settings(const char *name, Main *main)
{
ParticleSettings *part;
- if(main==NULL)
+ if (main==NULL)
main = G.main;
part= alloc_libblock(&main->particle, ID_PA, name);
@@ -3623,8 +3626,8 @@ ParticleSettings *psys_copy_settings(ParticleSettings *part)
partn->boids = boid_copy_settings(part->boids);
- for(a=0; a<MAX_MTEX; a++) {
- if(part->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (part->mtex[a]) {
partn->mtex[a]= MEM_mallocN(sizeof(MTex), "psys_copy_tex");
memcpy(partn->mtex[a], part->mtex[a], sizeof(MTex));
id_us_plus((ID *)partn->mtex[a]->tex);
@@ -3641,8 +3644,8 @@ static void expand_local_particlesettings(ParticleSettings *part)
int i;
id_lib_extern((ID *)part->dup_group);
- for(i=0; i<MAX_MTEX; i++) {
- if(part->mtex[i]) id_lib_extern((ID *)part->mtex[i]->tex);
+ for (i=0; i<MAX_MTEX; i++) {
+ if (part->mtex[i]) id_lib_extern((ID *)part->mtex[i]->tex);
}
}
@@ -3657,29 +3660,29 @@ void make_local_particlesettings(ParticleSettings *part)
* - mixed: make copy
*/
- if(part->id.lib==0) return;
- if(part->id.us==1) {
+ if (part->id.lib==0) return;
+ if (part->id.us==1) {
id_clear_lib_data(bmain, &part->id);
expand_local_particlesettings(part);
return;
}
/* test objects */
- for(ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) {
+ for (ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) {
ParticleSystem *psys=ob->particlesystem.first;
- for(; psys; psys=psys->next) {
- if(psys->part==part) {
- if(ob->id.lib) is_lib= TRUE;
+ for (; psys; psys=psys->next) {
+ if (psys->part==part) {
+ if (ob->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
}
- if(is_local && is_lib==FALSE) {
+ if (is_local && is_lib==FALSE) {
id_clear_lib_data(bmain, &part->id);
expand_local_particlesettings(part);
}
- else if(is_local && is_lib) {
+ else if (is_local && is_lib) {
ParticleSettings *part_new= psys_copy_settings(part);
part_new->id.us= 0;
@@ -3687,10 +3690,10 @@ void make_local_particlesettings(ParticleSettings *part)
BKE_id_lib_local_paths(bmain, part->id.lib, &part_new->id);
/* do objects */
- for(ob= bmain->object.first; ob; ob= ob->id.next) {
+ for (ob= bmain->object.first; ob; ob= ob->id.next) {
ParticleSystem *psys;
- for(psys= ob->particlesystem.first; psys; psys=psys->next) {
- if(psys->part==part && ob->id.lib==0) {
+ for (psys= ob->particlesystem.first; psys; psys=psys->next) {
+ if (psys->part==part && ob->id.lib==0) {
psys->part= part_new;
part_new->id.us++;
part->id.us--;
@@ -3712,15 +3715,15 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co
tf= CustomData_get_layer_named(&dm->faceData, CD_MTFACE, name);
- if(tf == NULL)
+ if (tf == NULL)
tf= CustomData_get_layer(&dm->faceData, CD_MTFACE);
- if(tf == NULL)
+ if (tf == NULL)
return 0;
- if(pa) {
+ if (pa) {
i= (pa->num_dmcache==DMCACHE_NOTFOUND)? pa->num: pa->num_dmcache;
- if(i >= dm->getNumTessFaces(dm))
+ if (i >= dm->getNumTessFaces(dm))
i = -1;
}
else
@@ -3744,9 +3747,9 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co
return 1;
}
-#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend);}
-#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if(event & type) { if(pvalue < 0.f) pvalue = 1.f+pvalue; CLAMP(pvalue, 0.0f, 1.0f); }
-#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if(event & type) { CLAMP(pvalue, -1.0f, 1.0f); }
+#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend);}
+#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if (event & type) { if (pvalue < 0.f) pvalue = 1.f+pvalue; CLAMP(pvalue, 0.0f, 1.0f); }
+#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); }
static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra)
{
@@ -3761,14 +3764,14 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
ptex->length= 1.0f - part->randlength * PSYS_FRAND(child_index + 26);
ptex->length*= part->clength_thres < PSYS_FRAND(child_index + 27) ? part->clength : 1.0f;
- for(m=0; m<MAX_MTEX; m++, mtexp++) {
+ for (m=0; m<MAX_MTEX; m++, mtexp++) {
mtex = *mtexp;
- if(mtex && mtex->mapto) {
+ if (mtex && mtex->mapto) {
float def=mtex->def_var;
short blend=mtex->blendtype;
short texco = mtex->texco;
- if(ELEM(texco, TEXCO_UV, TEXCO_ORCO) && (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME) == 0 || part->distr == PART_DISTR_GRID))
+ 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) {
@@ -3777,11 +3780,11 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
break;
case TEXCO_OBJECT:
copy_v3_v3(texvec, par->state.co);
- if(mtex->object)
+ if (mtex->object)
mul_m4_v3(mtex->object->imat, texvec);
break;
case TEXCO_UV:
- if(fw && get_particle_uv(dm, NULL, face_index, fw, mtex->uvname, texvec))
+ if (fw && get_particle_uv(dm, NULL, face_index, fw, mtex->uvname, texvec))
break;
/* no break, failed to get uv's, so let's try orco's */
case TEXCO_ORCO:
@@ -3797,7 +3800,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
externtex(mtex, texvec, &value, rgba, rgba+1, rgba+2, rgba+3, 0);
- if((event & mtex->mapto) & PAMAP_ROUGH)
+ if ((event & mtex->mapto) & PAMAP_ROUGH)
ptex->rough1= ptex->rough2= ptex->roughe= texture_value_blend(def,ptex->rough1,value,mtex->roughfac,blend);
SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac);
@@ -3829,14 +3832,14 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
ptex->time = (float)(pa - sim->psys->particles)/(float)sim->psys->totpart;
- for(m=0; m<MAX_MTEX; m++, mtexp++) {
+ for (m=0; m<MAX_MTEX; m++, mtexp++) {
mtex = *mtexp;
- if(mtex && mtex->mapto) {
+ if (mtex && mtex->mapto) {
float def=mtex->def_var;
short blend=mtex->blendtype;
short texco = mtex->texco;
- if(texco == TEXCO_UV && (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME) == 0 || part->distr == PART_DISTR_GRID))
+ if (texco == TEXCO_UV && (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME) == 0 || part->distr == PART_DISTR_GRID))
texco = TEXCO_GLOB;
switch(texco) {
@@ -3845,11 +3848,11 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
break;
case TEXCO_OBJECT:
copy_v3_v3(texvec, pa->state.co);
- if(mtex->object)
+ if (mtex->object)
mul_m4_v3(mtex->object->imat, texvec);
break;
case TEXCO_UV:
- if(get_particle_uv(sim->psmd->dm, pa, 0, pa->fuv, mtex->uvname, texvec))
+ if (get_particle_uv(sim->psmd->dm, pa, 0, pa->fuv, mtex->uvname, texvec))
break;
/* no break, failed to get uv's, so let's try orco's */
case TEXCO_ORCO:
@@ -3865,9 +3868,9 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
externtex(mtex, texvec, &value, rgba, rgba+1, rgba+2, rgba+3, 0);
- if((event & mtex->mapto) & PAMAP_TIME) {
+ if ((event & mtex->mapto) & PAMAP_TIME) {
/* the first time has to set the base value for time regardless of blend mode */
- if((setvars&MAP_PA_TIME)==0) {
+ if ((setvars&MAP_PA_TIME)==0) {
int flip= (mtex->timefac < 0.0f);
float timefac= fabsf(mtex->timefac);
ptex->time *= 1.0f - timefac;
@@ -3910,26 +3913,26 @@ float psys_get_child_time(ParticleSystem *psys, ChildParticle *cpa, float cfra,
ParticleSettings *part = psys->part;
float time, life;
- if(part->childtype==PART_CHILD_FACES) {
+ if (part->childtype==PART_CHILD_FACES) {
int w=0;
time=0.0;
- while(w<4 && cpa->pa[w]>=0) {
+ while (w<4 && cpa->pa[w]>=0) {
time+=cpa->w[w]*(psys->particles+cpa->pa[w])->time;
w++;
}
life = part->lifetime * (1.0f - part->randlife * PSYS_FRAND(cpa - psys->child + 25));
}
- else{
+ else {
ParticleData *pa = psys->particles + cpa->parent;
time = pa->time;
life = pa->lifetime;
}
- if(birthtime)
+ if (birthtime)
*birthtime = time;
- if(dietime)
+ if (dietime)
*dietime = time+life;
return (cfra-time)/life;
@@ -3939,14 +3942,14 @@ float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED
ParticleSettings *part = psys->part;
float size; // time XXX
- if(part->childtype==PART_CHILD_FACES)
+ if (part->childtype==PART_CHILD_FACES)
size=part->size;
else
size=psys->particles[cpa->parent].size;
size*=part->childsize;
- if(part->childrandsize != 0.0f)
+ if (part->childrandsize != 0.0f)
size *= 1.0f - part->childrandsize * PSYS_FRAND(cpa - psys->child + 26);
return size;
@@ -3959,22 +3962,22 @@ static void get_child_modifier_parameters(ParticleSettings *part, ParticleThread
get_cpa_texture(ctx->dm, psys, part, psys->particles + cpa->pa[0], i, cpa_num, cpa_fuv, orco, ptex, PAMAP_DENS|PAMAP_CHILD, psys->cfra);
- if(ptex->exist < PSYS_FRAND(i + 24))
+ if (ptex->exist < PSYS_FRAND(i + 24))
return;
- if(ctx->vg_length)
+ if (ctx->vg_length)
ptex->length*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_length);
- if(ctx->vg_clump)
+ if (ctx->vg_clump)
ptex->clump*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_clump);
- if(ctx->vg_kink)
+ if (ctx->vg_kink)
ptex->kink*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_kink);
- if(ctx->vg_rough1)
+ if (ctx->vg_rough1)
ptex->rough1*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_rough1);
- if(ctx->vg_rough2)
+ if (ctx->vg_rough2)
ptex->rough2*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_rough2);
- if(ctx->vg_roughe)
+ if (ctx->vg_roughe)
ptex->roughe*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_roughe);
- if(ctx->vg_effector)
+ if (ctx->vg_effector)
ptex->effector*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_effector);
}
static void do_child_modifiers(ParticleSimulationData *sim, ParticleTexture *ptex, ParticleKey *par, float *par_rot, ChildParticle *cpa, float *orco, float mat[4][4], ParticleKey *state, float t)
@@ -3988,21 +3991,21 @@ static void do_child_modifiers(ParticleSimulationData *sim, ParticleTexture *pte
float rough2 = part->rough2;
float rough_end = part->rough_end;
- if(ptex) {
+ if (ptex) {
kink_freq *= ptex->kink;
rough1 *= ptex->rough1;
rough2 *= ptex->rough2;
rough_end *= ptex->roughe;
}
- if(part->flag & PART_CHILD_EFFECT)
+ if (part->flag & PART_CHILD_EFFECT)
/* state is safe to cast, since only co and vel are used */
guided = do_guides(sim->psys->effectors, (ParticleKey*)state, cpa->parent, t);
- if(guided==0) {
+ if (guided==0) {
float clump = do_clump(state, par, t, part->clumpfac, part->clumppow, ptex ? ptex->clump : 1.f);
- if(kink_freq != 0.f) {
+ if (kink_freq != 0.f) {
float kink_amp = part->kink_amp * (1.f - part->kink_amp_clump * clump);
do_kink(state, par, par_rot, t, kink_freq, part->kink_shape,
@@ -4011,13 +4014,13 @@ static void do_child_modifiers(ParticleSimulationData *sim, ParticleTexture *pte
}
}
- if(rough1 > 0.f)
+ if (rough1 > 0.f)
do_rough(orco, mat, t, rough1, part->rough1_size, 0.0, state);
- if(rough2 > 0.f)
+ if (rough2 > 0.f)
do_rough(sim->psys->frand + ((i + 27) % (PSYS_FRAND_COUNT - 3)), mat, t, rough2, part->rough2_size, part->rough2_thres, state);
- if(rough_end > 0.f)
+ if (rough_end > 0.f)
do_rough_end(sim->psys->frand + ((i + 27) % (PSYS_FRAND_COUNT - 3)), mat, t, rough_end, part->rough_end_shape, state);
}
/* get's hair (or keyed) particles state at the "path time" specified in state->time */
@@ -4052,9 +4055,9 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
t=state->time;
CLAMP(t, 0.0f, 1.0f);
- if(p<totpart) {
+ if (p<totpart) {
/* interpolate pathcache directly if it exist */
- if(psys->pathcache) {
+ if (psys->pathcache) {
ParticleCacheKey result;
interpolate_pathcache(psys->pathcache[p], t, &result);
copy_v3_v3(state->co, result.co);
@@ -4069,38 +4072,38 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
pind.cache = cached ? psys->pointcache : NULL;
pind.epoint = NULL;
pind.bspline = (psys->part->flag & PART_HAIR_BSPLINE);
- /* pind.dm disabled in editmode means we dont get effectors taken into
+ /* pind.dm disabled in editmode means we don't get effectors taken into
* account when subdividing for instance */
pind.dm = psys_in_edit_mode(sim->scene, psys) ? NULL : psys->hair_out_dm;
init_particle_interpolation(sim->ob, psys, pa, &pind);
do_particle_interpolation(psys, p, pa, t, &pind, state);
- if(pind.dm) {
+ if (pind.dm) {
mul_m4_v3(sim->ob->obmat, state->co);
mul_mat3_m4_v3(sim->ob->obmat, state->vel);
}
- else if(!keyed && !cached && !(psys->flag & PSYS_GLOBAL_HAIR)) {
- if((pa->flag & PARS_REKEY)==0) {
+ else if (!keyed && !cached && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+ if ((pa->flag & PARS_REKEY)==0) {
psys_mat_hair_to_global(sim->ob, sim->psmd->dm, part->from, pa, hairmat);
mul_m4_v3(hairmat, state->co);
mul_mat3_m4_v3(hairmat, state->vel);
- if(sim->psys->effectors && (part->flag & PART_CHILD_GUIDE)==0) {
+ if (sim->psys->effectors && (part->flag & PART_CHILD_GUIDE)==0) {
do_guides(sim->psys->effectors, state, p, state->time);
/* TODO: proper velocity handling */
}
- if(psys->lattice && edit==0)
+ if (psys->lattice && edit==0)
calc_latt_deform(psys->lattice, state->co,1.0f);
}
}
}
}
- else if(totchild) {
+ else if (totchild) {
//invert_m4_m4(imat,ob->obmat);
/* interpolate childcache directly if it exists */
- if(psys->childcache) {
+ if (psys->childcache) {
ParticleCacheKey result;
interpolate_pathcache(psys->childcache[p-totpart], t, &result);
copy_v3_v3(state->co, result.co);
@@ -4110,19 +4113,19 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
else {
cpa=psys->child+p-totpart;
- if(state->time < 0.0f)
+ if (state->time < 0.0f)
t = psys_get_child_time(psys, cpa, -state->time, NULL, NULL);
- if(totchild && part->childtype==PART_CHILD_FACES) {
+ if (totchild && part->childtype==PART_CHILD_FACES) {
/* part->parents could still be 0 so we can't test with totparent */
between=1;
}
- if(between) {
+ if (between) {
int w = 0;
float foffset;
/* get parent states */
- while(w<4 && cpa->pa[w]>=0) {
+ while (w<4 && cpa->pa[w]>=0) {
keys[w].time = state->time;
psys_get_particle_on_path(sim, cpa->pa[w], keys+w, 1);
w++;
@@ -4144,14 +4147,14 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
pa = psys->particles + cpa->parent;
- if(part->type == PART_HAIR)
+ if (part->type == PART_HAIR)
psys_mat_hair_to_global(sim->ob, sim->psmd->dm, psys->part->from, pa, hairmat);
else
unit_m4(hairmat);
pa=0;
}
- else{
+ else {
/* get the parent state */
keys->time = state->time;
psys_get_particle_on_path(sim, cpa->parent, keys,1);
@@ -4165,7 +4168,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
- if(part->type == PART_HAIR) {
+ if (part->type == PART_HAIR) {
psys_particle_on_emitter(psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa_fuv,pa->foffset,co,0,0,0,orco,0);
psys_mat_hair_to_global(sim->ob, sim->psmd->dm, psys->part->from, pa, hairmat);
}
@@ -4177,7 +4180,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
/* correct child ipo timing */
#if 0 // XXX old animation system
- if((part->flag&PART_ABS_TIME)==0 && part->ipo) {
+ if ((part->flag&PART_ABS_TIME)==0 && part->ipo) {
calc_ipo(part->ipo, 100.0f*t);
execute_ipo((ID *)part, part->ipo);
}
@@ -4191,14 +4194,14 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
/* TODO: assign vertex groups */
get_child_modifier_parameters(part, &ctx, cpa, cpa_from, cpa_num, cpa_fuv, orco, &ptex);
- if(between) {
+ if (between) {
int w=0;
state->co[0] = state->co[1] = state->co[2] = 0.0f;
state->vel[0] = state->vel[1] = state->vel[2] = 0.0f;
/* child position is the weighted sum of parent positions */
- while(w<4 && cpa->pa[w]>=0) {
+ while (w<4 && cpa->pa[w]>=0) {
state->co[0] += cpa->w[w] * keys[w].co[0];
state->co[1] += cpa->w[w] * keys[w].co[1];
state->co[2] += cpa->w[w] * keys[w].co[2];
@@ -4211,31 +4214,31 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
/* apply offset for correct positioning */
//add_v3_v3(state->co, cpa_1st);
}
- else{
+ else {
/* offset the child from the parent position */
offset_child(cpa, keys, keys->rot, state, part->childflat, part->childrad);
}
par = keys;
- if(vel)
+ if (vel)
copy_particle_key(&tstate, state, 1);
/* apply different deformations to the child path */
do_child_modifiers(sim, &ptex, par, par->rot, cpa, orco, hairmat, state, t);
/* try to estimate correct velocity */
- if(vel) {
+ if (vel) {
ParticleKey tstate;
float length = len_v3(state->vel);
- if(t>=0.001f) {
+ if (t>=0.001f) {
tstate.time=t-0.001f;
psys_get_particle_on_path(sim,p,&tstate,0);
sub_v3_v3v3(state->vel,state->co,tstate.co);
normalize_v3(state->vel);
}
- else{
+ else {
tstate.time=t+0.001f;
psys_get_particle_on_path(sim,p,&tstate,0);
sub_v3_v3v3(state->vel,tstate.co,state->co);
@@ -4261,20 +4264,20 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
/* negative time means "use current time" */
cfra = state->time > 0 ? state->time : BKE_curframe(sim->scene);
- if(p>=totpart) {
- if(!psys->totchild)
+ if (p>=totpart) {
+ if (!psys->totchild)
return 0;
- if(part->childtype == PART_CHILD_FACES) {
- if(!(psys->flag & PSYS_KEYED))
+ if (part->childtype == PART_CHILD_FACES) {
+ if (!(psys->flag & PSYS_KEYED))
return 0;
cpa = psys->child + p - totpart;
state->time = psys_get_child_time(psys, cpa, cfra, NULL, NULL);
- if(!always)
- if((state->time < 0.0f && !(part->flag & PART_UNBORN))
+ if (!always)
+ if ((state->time < 0.0f && !(part->flag & PART_UNBORN))
|| (state->time > 1.0f && !(part->flag & PART_DIED)))
return 0;
@@ -4292,22 +4295,22 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
pa = sim->psys->particles + p;
}
- if(pa) {
- if(!always)
- if((cfra < pa->time && (part->flag & PART_UNBORN)==0)
+ if (pa) {
+ if (!always)
+ if ((cfra < pa->time && (part->flag & PART_UNBORN)==0)
|| (cfra > pa->dietime && (part->flag & PART_DIED)==0))
return 0;
cfra = MIN2(cfra, pa->dietime);
}
- if(sim->psys->flag & PSYS_KEYED) {
+ if (sim->psys->flag & PSYS_KEYED) {
state->time= -cfra;
psys_get_particle_on_path(sim, p, state,1);
return 1;
}
- else{
- if(cpa) {
+ else {
+ if (cpa) {
float mat[4][4];
ParticleKey *key1;
float t = (cfra - pa->time) / pa->lifetime;
@@ -4320,19 +4323,19 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
unit_m4(mat);
do_child_modifiers(sim, NULL, key1, key1->rot, cpa, cpa->fuv, mat, state, t);
- if(psys->lattice)
+ if (psys->lattice)
calc_latt_deform(sim->psys->lattice, state->co,1.0f);
}
- else{
- if(pa->state.time==cfra || ELEM(part->phystype,PART_PHYS_NO,PART_PHYS_KEYED))
+ else {
+ if (pa->state.time==cfra || ELEM(part->phystype,PART_PHYS_NO,PART_PHYS_KEYED))
copy_particle_key(state, &pa->state, 1);
- else if(pa->prev_state.time==cfra)
+ else if (pa->prev_state.time==cfra)
copy_particle_key(state, &pa->prev_state, 1);
else {
float dfra, frs_sec = sim->scene->r.frs_sec;
/* let's interpolate to try to be as accurate as possible */
- if(pa->state.time + 2.f >= state->time && pa->prev_state.time - 2.f <= state->time) {
- if(pa->prev_state.time >= pa->state.time || pa->prev_state.time < 0.f) {
+ if (pa->state.time + 2.f >= state->time && pa->prev_state.time - 2.f <= state->time) {
+ if (pa->prev_state.time >= pa->state.time || pa->prev_state.time < 0.f) {
/* prev_state is wrong so let's not use it, this can happen at frames 1, 0 or particle birth */
dfra = state->time - pa->state.time;
@@ -4364,7 +4367,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
interp_qt_qtqt(state->rot, keys[1].rot, keys[2].rot, keytime);
}
}
- else if(pa->state.time + 1.f >= state->time && pa->state.time - 1.f <= state->time) {
+ else if (pa->state.time + 1.f >= state->time && pa->state.time - 1.f <= state->time) {
/* linear interpolation using only pa->state */
dfra = state->time - pa->state.time;
@@ -4379,7 +4382,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
}
}
- if(sim->psys->lattice)
+ if (sim->psys->lattice)
calc_latt_deform(sim->psys->lattice, state->co,1.0f);
}
@@ -4396,10 +4399,10 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, Partic
uv[0] = uv[1] = 0.f;
- if(cpa) {
- if(part->childtype == PART_CHILD_FACES) {
+ if (cpa) {
+ if (part->childtype == PART_CHILD_FACES) {
mtface= CustomData_get_layer(&psmd->dm->faceData, CD_MTFACE);
- if(mtface) {
+ if (mtface) {
mface= psmd->dm->getTessFaceData(psmd->dm, cpa->num, CD_MFACE);
mtface += cpa->num;
psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, uv);
@@ -4413,11 +4416,11 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, Partic
}
}
- if(part->from == PART_FROM_FACE) {
+ if (part->from == PART_FROM_FACE) {
mtface= CustomData_get_layer(&psmd->dm->faceData, CD_MTFACE);
num= pa->num_dmcache;
- if(num == DMCACHE_NOTFOUND)
+ if (num == DMCACHE_NOTFOUND)
num= pa->num;
if (num >= psmd->dm->getNumTessFaces(psmd->dm)) {
@@ -4426,7 +4429,7 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, Partic
num= DMCACHE_NOTFOUND;
}
- if(mtface && num != DMCACHE_NOTFOUND) {
+ if (mtface && num != DMCACHE_NOTFOUND) {
mface= psmd->dm->getTessFaceData(psmd->dm, num, CD_MFACE);
mtface += num;
psys_interpolate_uvs(mtface, mface->v4, pa->fuv, uv);
@@ -4447,23 +4450,23 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
sub_v3_v3v3(vec, (cache+cache->steps)->co, cache->co);
len= normalize_v3(vec);
- if(pa == NULL && psys->part->childflat != PART_CHILD_FACES)
+ if (pa == NULL && psys->part->childflat != PART_CHILD_FACES)
pa = psys->particles + cpa->pa[0];
- if(pa)
+ if (pa)
psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
else
psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
- if(psys->part->rotmode == PART_ROT_VEL) {
+ if (psys->part->rotmode == PART_ROT_VEL) {
copy_m3_m4(nmat, ob->imat);
transpose_m3(nmat);
mul_m3_v3(nmat, nor);
normalize_v3(nor);
/* make sure that we get a proper side vector */
- if(fabs(dot_v3v3(nor,vec))>0.999999) {
- if(fabs(dot_v3v3(nor,xvec))>0.999999) {
+ if (fabs(dot_v3v3(nor,vec))>0.999999) {
+ if (fabs(dot_v3v3(nor,xvec))>0.999999) {
nor[0] = 0.0f;
nor[1] = 1.0f;
nor[2] = 0.0f;
@@ -4478,10 +4481,10 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
normalize_v3(side);
/* rotate side vector around vec */
- if(psys->part->phasefac != 0) {
+ if (psys->part->phasefac != 0) {
float q_phase[4];
float phasefac = psys->part->phasefac;
- if(psys->part->randphasefac != 0.0f)
+ if (psys->part->randphasefac != 0.0f)
phasefac += psys->part->randphasefac * PSYS_FRAND((pa-psys->particles) + 20);
axis_angle_to_quat( q_phase, vec, phasefac*(float)M_PI);
@@ -4512,7 +4515,7 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
/* can happen with bad pointcache or physics calculation
* since this becomes geometry, nan's and inf's crash raytrace code.
* better not allow this. */
- if( !finite(bb->vec[0]) || !finite(bb->vec[1]) || !finite(bb->vec[2]) ||
+ if ( !finite(bb->vec[0]) || !finite(bb->vec[1]) || !finite(bb->vec[2]) ||
!finite(bb->vel[0]) || !finite(bb->vel[1]) || !finite(bb->vel[2]) )
{
zero_v3(bb->vec);
@@ -4526,22 +4529,22 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
return;
}
- if(bb->align < PART_BB_VIEW)
+ if (bb->align < PART_BB_VIEW)
onevec[bb->align]=1.0f;
- if(bb->lock && (bb->align == PART_BB_VIEW)) {
+ if (bb->lock && (bb->align == PART_BB_VIEW)) {
normalize_v3_v3(xvec, bb->ob->obmat[0]);
normalize_v3_v3(yvec, bb->ob->obmat[1]);
normalize_v3_v3(zvec, bb->ob->obmat[2]);
}
- else if(bb->align == PART_BB_VEL) {
+ else if (bb->align == PART_BB_VEL) {
float temp[3];
normalize_v3_v3(temp, bb->vel);
sub_v3_v3v3(zvec, bb->ob->obmat[3], bb->vec);
- if(bb->lock) {
+ if (bb->lock) {
float fac = -dot_v3v3(zvec, temp);
madd_v3_v3fl(zvec, temp, fac);
@@ -4555,11 +4558,11 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
}
else {
sub_v3_v3v3(zvec, bb->ob->obmat[3], bb->vec);
- if(bb->lock)
+ if (bb->lock)
zvec[bb->align] = 0.0f;
normalize_v3(zvec);
- if(bb->align < PART_BB_VIEW)
+ if (bb->align < PART_BB_VIEW)
cross_v3_v3v3(xvec, onevec, zvec);
else
cross_v3_v3v3(xvec, bb->ob->obmat[1], zvec);
@@ -4596,18 +4599,18 @@ void psys_apply_hair_lattice(Scene *scene, Object *ob, ParticleSystem *psys)
psys->lattice = psys_get_lattice(&sim);
- if(psys->lattice) {
+ if (psys->lattice) {
ParticleData *pa = psys->particles;
HairKey *hkey;
int p, h;
float hairmat[4][4], imat[4][4];
- for(p=0; p<psys->totpart; p++, pa++) {
+ for (p=0; p<psys->totpart; p++, pa++) {
psys_mat_hair_to_global(sim.ob, sim.psmd->dm, psys->part->from, pa, hairmat);
invert_m4_m4(imat, hairmat);
hkey = pa->hair;
- for(h=0; h<pa->totkey; h++, hkey++) {
+ for (h=0; h<pa->totkey; h++, hkey++) {
mul_m4_v3(hairmat, hkey->co);
calc_latt_deform(psys->lattice, hkey->co, 1.0f);
mul_m4_v3(imat, hkey->co);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 8d50d3d69cf..445e34e43c7 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -113,10 +113,10 @@
static int particles_are_dynamic(ParticleSystem *psys)
{
- if(psys->pointcache->flag & PTCACHE_BAKED)
+ if (psys->pointcache->flag & PTCACHE_BAKED)
return 0;
- if(psys->part->type == PART_HAIR)
+ if (psys->part->type == PART_HAIR)
return psys->flag & PSYS_HAIR_DYNAMICS;
else
return ELEM3(psys->part->phystype, PART_PHYS_NEWTON, PART_PHYS_BOIDS, PART_PHYS_FLUID);
@@ -126,7 +126,7 @@ static int psys_get_current_display_percentage(ParticleSystem *psys)
{
ParticleSettings *part=psys->part;
- if((psys->renderdata && !particles_are_dynamic(psys)) /* non-dynamic particles can be rendered fully */
+ if ((psys->renderdata && !particles_are_dynamic(psys)) /* non-dynamic particles can be rendered fully */
|| (part->child_nbr && part->childtype) /* display percentage applies to children */
|| (psys->pointcache->flag & PTCACHE_BAKING)) /* baking is always done with full amount */
return 100;
@@ -136,9 +136,9 @@ static int psys_get_current_display_percentage(ParticleSystem *psys)
static int tot_particles(ParticleSystem *psys, PTCacheID *pid)
{
- if(pid && psys->pointcache->flag & PTCACHE_EXTERNAL)
+ if (pid && psys->pointcache->flag & PTCACHE_EXTERNAL)
return pid->cache->totpoint;
- else if(psys->part->distr == PART_DISTR_GRID && psys->part->from != PART_FROM_VERT)
+ else if (psys->part->distr == PART_DISTR_GRID && psys->part->from != PART_FROM_VERT)
return psys->part->grid_res * psys->part->grid_res * psys->part->grid_res - psys->totunexist;
else
return psys->part->totpart - psys->totunexist;
@@ -148,10 +148,10 @@ void psys_reset(ParticleSystem *psys, int mode)
{
PARTICLE_P;
- if(ELEM(mode, PSYS_RESET_ALL, PSYS_RESET_DEPSGRAPH)) {
- if(mode == PSYS_RESET_ALL || !(psys->flag & PSYS_EDITED)) {
+ if (ELEM(mode, PSYS_RESET_ALL, PSYS_RESET_DEPSGRAPH)) {
+ if (mode == PSYS_RESET_ALL || !(psys->flag & PSYS_EDITED)) {
/* don't free if not absolutely necessary */
- if(psys->totpart != tot_particles(psys, NULL)) {
+ if (psys->totpart != tot_particles(psys, NULL)) {
psys_free_particles(psys);
psys->totpart= 0;
}
@@ -159,21 +159,21 @@ void psys_reset(ParticleSystem *psys, int mode)
psys->totkeyed= 0;
psys->flag &= ~(PSYS_HAIR_DONE|PSYS_KEYED);
- if(psys->edit && psys->free_edit) {
+ if (psys->edit && psys->free_edit) {
psys->free_edit(psys->edit);
psys->edit = NULL;
psys->free_edit = NULL;
}
}
}
- else if(mode == PSYS_RESET_CACHE_MISS) {
+ else if (mode == PSYS_RESET_CACHE_MISS) {
/* set all particles to be skipped */
LOOP_PARTICLES
pa->flag |= PARS_NO_DISP;
}
/* reset children */
- if(psys->child) {
+ if (psys->child) {
MEM_freeN(psys->child);
psys->child= NULL;
}
@@ -186,7 +186,7 @@ void psys_reset(ParticleSystem *psys, int mode)
/* reset point cache */
BKE_ptcache_invalidate(psys->pointcache);
- if(psys->fluid_springs) {
+ if (psys->fluid_springs) {
MEM_freeN(psys->fluid_springs);
psys->fluid_springs = NULL;
}
@@ -203,8 +203,8 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
PARTICLE_P;
int totpart, totsaved = 0;
- if(new_totpart<0) {
- if(part->distr==PART_DISTR_GRID && part->from != PART_FROM_VERT) {
+ if (new_totpart<0) {
+ if (part->distr==PART_DISTR_GRID && part->from != PART_FROM_VERT) {
totpart= part->grid_res;
totpart*=totpart*totpart;
}
@@ -214,55 +214,55 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
else
totpart=new_totpart;
- if(totpart != psys->totpart) {
- if(psys->edit && psys->free_edit) {
+ if (totpart != psys->totpart) {
+ if (psys->edit && psys->free_edit) {
psys->free_edit(psys->edit);
psys->edit = NULL;
psys->free_edit = NULL;
}
- if(totpart) {
+ if (totpart) {
newpars= MEM_callocN(totpart*sizeof(ParticleData), "particles");
- if(newpars == NULL)
+ if (newpars == NULL)
return;
- if(psys->part->phystype == PART_PHYS_BOIDS) {
+ if (psys->part->phystype == PART_PHYS_BOIDS) {
newboids= MEM_callocN(totpart*sizeof(BoidParticle), "boid particles");
- if(newboids == NULL) {
+ if (newboids == NULL) {
/* allocation error! */
- if(newpars)
+ if (newpars)
MEM_freeN(newpars);
return;
}
}
}
- if(psys->particles) {
+ if (psys->particles) {
totsaved=MIN2(psys->totpart,totpart);
/*save old pars*/
- if(totsaved) {
+ if (totsaved) {
memcpy(newpars,psys->particles,totsaved*sizeof(ParticleData));
- if(psys->particles->boid)
+ if (psys->particles->boid)
memcpy(newboids, psys->particles->boid, totsaved*sizeof(BoidParticle));
}
- if(psys->particles->keys)
+ if (psys->particles->keys)
MEM_freeN(psys->particles->keys);
- if(psys->particles->boid)
+ if (psys->particles->boid)
MEM_freeN(psys->particles->boid);
- for(p=0, pa=newpars; p<totsaved; p++, pa++) {
- if(pa->keys) {
+ for (p=0, pa=newpars; p<totsaved; p++, pa++) {
+ if (pa->keys) {
pa->keys= NULL;
pa->totkey= 0;
}
}
- for(p=totsaved, pa=psys->particles+totsaved; p<psys->totpart; p++, pa++)
- if(pa->hair) MEM_freeN(pa->hair);
+ for (p=totsaved, pa=psys->particles+totsaved; p<psys->totpart; p++, pa++)
+ if (pa->hair) MEM_freeN(pa->hair);
MEM_freeN(psys->particles);
psys_free_pdd(psys);
@@ -271,13 +271,13 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
psys->particles=newpars;
psys->totpart=totpart;
- if(newboids) {
+ if (newboids) {
LOOP_PARTICLES
pa->boid = newboids++;
}
}
- if(psys->child) {
+ if (psys->child) {
MEM_freeN(psys->child);
psys->child=NULL;
psys->totchild=0;
@@ -288,10 +288,10 @@ static int get_psys_child_number(struct Scene *scene, ParticleSystem *psys)
{
int nbr;
- if(!psys->part->childtype)
+ if (!psys->part->childtype)
return 0;
- if(psys->renderdata)
+ if (psys->renderdata)
nbr= psys->part->ren_child_nbr;
else
nbr= psys->part->child_nbr;
@@ -306,9 +306,9 @@ static int get_psys_tot_child(struct Scene *scene, ParticleSystem *psys)
static void alloc_child_particles(ParticleSystem *psys, int tot)
{
- if(psys->child) {
+ if (psys->child) {
/* only re-allocate if we have to */
- if(psys->part->childtype && psys->totchild == tot) {
+ if (psys->part->childtype && psys->totchild == tot) {
memset(psys->child, 0, tot*sizeof(ChildParticle));
return;
}
@@ -318,9 +318,9 @@ static void alloc_child_particles(ParticleSystem *psys, int tot)
psys->totchild=0;
}
- if(psys->part->childtype) {
+ if (psys->part->childtype) {
psys->totchild= tot;
- if(psys->totchild)
+ if (psys->totchild)
psys->child= MEM_callocN(psys->totchild*sizeof(ChildParticle), "child_particles");
}
}
@@ -341,12 +341,12 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys)
PARTICLE_P;
/* CACHE LOCATIONS */
- if(!dm->deformedOnly) {
+ if (!dm->deformedOnly) {
/* Will use later to speed up subsurf/derivedmesh */
LinkNode *node, *nodedmelem, **nodearray;
int totdmelem, totelem, i, *origindex;
- if(psys->part->from == PART_FROM_VERT) {
+ if (psys->part->from == PART_FROM_VERT) {
totdmelem= dm->getNumVerts(dm);
totelem= me->totvert;
origindex= dm->getVertDataArray(dm, CD_ORIGINDEX);
@@ -360,11 +360,11 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys)
nodedmelem= MEM_callocN(sizeof(LinkNode)*totdmelem, "psys node elems");
nodearray= MEM_callocN(sizeof(LinkNode *)*totelem, "psys node array");
- for(i=0, node=nodedmelem; i<totdmelem; i++, origindex++, node++) {
+ for (i=0, node=nodedmelem; i<totdmelem; i++, origindex++, node++) {
node->link= SET_INT_IN_POINTER(i);
- if(*origindex != -1) {
- if(nodearray[*origindex]) {
+ if (*origindex != -1) {
+ if (nodearray[*origindex]) {
/* prepend */
node->next = nodearray[*origindex];
nodearray[*origindex]= node;
@@ -376,13 +376,13 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys)
/* cache the verts/faces! */
LOOP_PARTICLES {
- if(pa->num < 0) {
+ if (pa->num < 0) {
pa->num_dmcache = -1;
continue;
}
- if(psys->part->from == PART_FROM_VERT) {
- if(nodearray[pa->num])
+ if (psys->part->from == PART_FROM_VERT) {
+ if (nodearray[pa->num])
pa->num_dmcache= GET_INT_FROM_POINTER(nodearray[pa->num]->link);
}
else { /* FROM_FACE/FROM_VOLUME */
@@ -415,13 +415,13 @@ static void distribute_simple_children(Scene *scene, Object *ob, DerivedMesh *fi
alloc_child_particles(psys, totpart);
cpa = psys->child;
- for(i=0; i<child_nbr; i++) {
- for(p=0; p<psys->totpart; p++,cpa++) {
+ for (i=0; i<child_nbr; i++) {
+ for (p=0; p<psys->totpart; p++,cpa++) {
float length=2.0;
cpa->parent=p;
/* create even spherical distribution inside unit sphere */
- while(length>=1.0f) {
+ while (length>=1.0f) {
cpa->fuv[0]=2.0f*BLI_frand()-1.0f;
cpa->fuv[1]=2.0f*BLI_frand()-1.0f;
cpa->fuv[2]=2.0f*BLI_frand()-1.0f;
@@ -449,7 +449,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
copy_v3_v3(max, mv->co);
mv++;
- for(i=1; i<totvert; i++, mv++) {
+ for (i=1; i<totvert; i++, mv++) {
min[0]=MIN2(min[0],mv->co[0]);
min[1]=MIN2(min[1],mv->co[1]);
min[2]=MIN2(min[2],mv->co[2]);
@@ -483,9 +483,9 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
min[1]+= d < delta[1] ? d/2.f : delta[1]/2.f;
min[2]+= d < delta[2] ? d/2.f : delta[2]/2.f;
- for(i=0,p=0,pa=psys->particles; i<res; i++) {
- for(j=0; j<res; j++) {
- for(k=0; k<res; k++,p++,pa++) {
+ for (i=0,p=0,pa=psys->particles; i<res; i++) {
+ for (j=0; j<res; j++) {
+ for (k=0; k<res; k++,p++,pa++) {
pa->fuv[0] = min[0] + (float)i*d;
pa->fuv[1] = min[1] + (float)j*d;
pa->fuv[2] = min[2] + (float)k*d;
@@ -496,7 +496,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
}
/* enable particles near verts/edges/faces/inside surface */
- if(from==PART_FROM_VERT) {
+ if (from==PART_FROM_VERT) {
float vec[3];
pa=psys->particles;
@@ -505,7 +505,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
min[1] -= d/2.0f;
min[2] -= d/2.0f;
- for(i=0,mv=mvert; i<totvert; i++,mv++) {
+ for (i=0,mv=mvert; i<totvert; i++,mv++) {
sub_v3_v3v3(vec,mv->co,min);
vec[0]/=delta[0];
vec[1]/=delta[1];
@@ -515,7 +515,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
+(int)(vec[2]*(size[2]-1)))->flag &= ~PARS_UNEXIST;
}
}
- else if(ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
+ else if (ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
float co1[3], co2[3];
MFace *mface= NULL, *mface_array;
@@ -526,13 +526,13 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
totface=dm->getNumTessFaces(dm);
mface=mface_array=dm->getTessFaceDataArray(dm,CD_MFACE);
- for(a=0; a<amax; a++) {
- if(a==0) { a0mul=res*res; a1mul=res; a2mul=1; }
- else if(a==1) { a0mul=res; a1mul=1; a2mul=res*res; }
- else{ a0mul=1; a1mul=res*res; a2mul=res; }
+ for (a=0; a<amax; a++) {
+ if (a==0) { a0mul=res*res; a1mul=res; a2mul=1; }
+ else if (a==1) { a0mul=res; a1mul=1; a2mul=res*res; }
+ else { a0mul=1; a1mul=res*res; a2mul=res; }
- for(a1=0; a1<size[(a+1)%3]; a1++) {
- for(a2=0; a2<size[(a+2)%3]; a2++) {
+ for (a1=0; a1<size[(a+1)%3]; a1++) {
+ for (a2=0; a2<size[(a+2)%3]; a2++) {
mface= mface_array;
pa = psys->particles + a1*a1mul + a2*a2mul;
@@ -543,23 +543,23 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
co1[a] -= 0.001f*d;
/* lets intersect the faces */
- for(i=0; i<totface; i++,mface++) {
+ for (i=0; i<totface; i++,mface++) {
copy_v3_v3(v1, mvert[mface->v1].co);
copy_v3_v3(v2, mvert[mface->v2].co);
copy_v3_v3(v3, mvert[mface->v3].co);
- if(isect_axial_line_tri_v3(a, co1, co2, v2, v3, v1, &lambda)) {
- if(from==PART_FROM_FACE)
+ if (isect_axial_line_tri_v3(a, co1, co2, v2, v3, v1, &lambda)) {
+ if (from==PART_FROM_FACE)
(pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST;
else /* store number of intersections */
(pa+(int)(lambda*size[a])*a0mul)->hair_index++;
}
- if(mface->v4) {
+ if (mface->v4) {
copy_v3_v3(v4, mvert[mface->v4].co);
- if(isect_axial_line_tri_v3(a, co1, co2, v4, v1, v3, &lambda)) {
- if(from==PART_FROM_FACE)
+ if (isect_axial_line_tri_v3(a, co1, co2, v4, v1, v3, &lambda)) {
+ if (from==PART_FROM_FACE)
(pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST;
else
(pa+(int)(lambda*size[a])*a0mul)->hair_index++;
@@ -567,11 +567,11 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
}
}
- if(from==PART_FROM_VOLUME) {
+ if (from==PART_FROM_VOLUME) {
int in=pa->hair_index%2;
- if(in) pa->hair_index++;
- for(i=0; i<size[0]; i++) {
- if(in || (pa+i*a0mul)->hair_index%2)
+ if (in) pa->hair_index++;
+ for (i=0; i<size[0]; i++) {
+ if (in || (pa+i*a0mul)->hair_index%2)
(pa+i*a0mul)->flag &= ~PARS_UNEXIST;
/* odd intersections == in->out / out->in */
/* even intersections -> in stays same */
@@ -583,14 +583,14 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
}
}
- if(psys->part->flag & PART_GRID_HEXAGONAL) {
- for(i=0,p=0,pa=psys->particles; i<res; i++) {
- for(j=0; j<res; j++) {
- for(k=0; k<res; k++,p++,pa++) {
- if(j%2)
+ if (psys->part->flag & PART_GRID_HEXAGONAL) {
+ for (i=0,p=0,pa=psys->particles; i<res; i++) {
+ for (j=0; j<res; j++) {
+ for (k=0; k<res; k++,p++,pa++) {
+ if (j%2)
pa->fuv[0] += d/2.f;
- if(k%2) {
+ if (k%2) {
pa->fuv[0] += d/2.f;
pa->fuv[1] += d/2.f;
}
@@ -599,21 +599,21 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
}
}
- if(psys->part->flag & PART_GRID_INVERT) {
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
+ if (psys->part->flag & PART_GRID_INVERT) {
+ for (i=0; i<size[0]; i++) {
+ for (j=0; j<size[1]; j++) {
pa=psys->particles + res*(i*res + j);
- for(k=0; k<size[2]; k++, pa++) {
+ for (k=0; k<size[2]; k++, pa++) {
pa->flag ^= PARS_UNEXIST;
}
}
}
}
- if(psys->part->grid_rand > 0.f) {
+ if (psys->part->grid_rand > 0.f) {
float rfac = d * psys->part->grid_rand;
- for(p=0,pa=psys->particles; p<psys->totpart; p++,pa++) {
- if(pa->flag & PARS_UNEXIST)
+ for (p=0,pa=psys->particles; p<psys->totpart; p++,pa++) {
+ if (pa->flag & PARS_UNEXIST)
continue;
pa->fuv[0] += rfac * (PSYS_FRAND(p + 31) - 0.5f);
@@ -653,7 +653,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
float *jit2, x, rad1, rad2, rad3;
int i, num2;
- if(num==0) return;
+ if (num==0) return;
rad1= (float)(1.0f/sqrtf((float)num));
rad2= (float)(1.0f/((float)num));
@@ -662,7 +662,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
rng = rng_new(31415926 + num + seed2);
x= 0;
num2 = 2 * num;
- for(i=0; i<num2; i+=2) {
+ for (i=0; i<num2; i+=2) {
jit[i]= x + amount*rad1*(0.5f - rng_getFloat(rng));
jit[i+1]= i/(2.0f*num) + amount*rad1*(0.5f - rng_getFloat(rng));
@@ -689,8 +689,8 @@ static void psys_uv_to_w(float u, float v, int quad, float *w)
{
float vert[4][3], co[3];
- if(!quad) {
- if(u+v > 1.0f)
+ if (!quad) {
+ if (u+v > 1.0f)
v= 1.0f-v;
else
u= 1.0f-u;
@@ -704,7 +704,7 @@ static void psys_uv_to_w(float u, float v, int quad, float *w)
co[1]= v;
co[2]= 0.0f;
- if(quad) {
+ if (quad) {
vert[3][0]= 0.0f; vert[3][1]= 1.0f; vert[3][2]= 0.0f;
interp_weights_poly_v3( w,vert, 4, co);
}
@@ -719,18 +719,18 @@ static int distribute_binary_search(float *sum, int n, float value)
{
int mid, low=0, high=n;
- if(value == 0.f)
+ if (value == 0.f)
return 0;
- while(low <= high) {
+ while (low <= high) {
mid= (low + high)/2;
- if(sum[mid] < value && value <= sum[mid+1])
+ if (sum[mid] < value && value <= sum[mid+1])
return mid;
- if(sum[mid] >= value)
+ if (sum[mid] >= value)
high= mid - 1;
- else if(sum[mid] < value)
+ else if (sum[mid] < value)
low= mid + 1;
else
return mid;
@@ -758,14 +758,14 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
int i, intersect, tot;
int rng_skip_tot= PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */
- if(from == PART_FROM_VERT) {
+ if (from == PART_FROM_VERT) {
/* TODO_PARTICLE - use original index */
pa->num= ctx->index[p];
pa->fuv[0] = 1.0f;
pa->fuv[1] = pa->fuv[2] = pa->fuv[3] = 0.0;
#if ONLY_WORKING_WITH_PA_VERTS
- if(ctx->tree) {
+ if (ctx->tree) {
KDTreeNearest ptn[3];
int w, maxw;
@@ -773,13 +773,13 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
transform_mesh_orco_verts((Mesh*)ob->data, &orco1, 1, 1);
maxw = BLI_kdtree_find_n_nearest(ctx->tree,3,orco1,NULL,ptn);
- for(w=0; w<maxw; w++) {
+ for (w=0; w<maxw; w++) {
pa->verts[w]=ptn->num;
}
}
#endif
}
- else if(from == PART_FROM_FACE || from == PART_FROM_VOLUME) {
+ else if (from == PART_FROM_FACE || from == PART_FROM_VOLUME) {
MFace *mface;
pa->num = i = ctx->index[p];
@@ -787,8 +787,8 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
switch(distr) {
case PART_DISTR_JIT:
- if(ctx->jitlevel == 1) {
- if(mface->v4)
+ if (ctx->jitlevel == 1) {
+ if (mface->v4)
psys_uv_to_w(0.5f, 0.5f, mface->v4, pa->fuv);
else
psys_uv_to_w(0.33333f, 0.33333f, mface->v4, pa->fuv);
@@ -810,7 +810,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
pa->foffset= 0.0f;
/* experimental */
- if(from==PART_FROM_VOLUME) {
+ if (from==PART_FROM_VOLUME) {
MVert *mvert=dm->getVertDataArray(dm,CD_MVERT);
tot=dm->getNumTessFaces(dm);
@@ -825,25 +825,25 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
min_d=2.0;
intersect=0;
- for(i=0,mface=dm->getTessFaceDataArray(dm,CD_MFACE); i<tot; i++,mface++) {
- if(i==pa->num) continue;
+ for (i=0,mface=dm->getTessFaceDataArray(dm,CD_MFACE); i<tot; i++,mface++) {
+ if (i==pa->num) continue;
v1=mvert[mface->v1].co;
v2=mvert[mface->v2].co;
v3=mvert[mface->v3].co;
- if(isect_line_tri_v3(co1, co2, v2, v3, v1, &cur_d, 0)) {
- if(cur_d<min_d) {
+ if (isect_line_tri_v3(co1, co2, v2, v3, v1, &cur_d, 0)) {
+ if (cur_d<min_d) {
min_d=cur_d;
pa->foffset=cur_d*50.0f; /* to the middle of volume */
intersect=1;
}
}
- if(mface->v4) {
+ if (mface->v4) {
v4=mvert[mface->v4].co;
- if(isect_line_tri_v3(co1, co2, v4, v1, v3, &cur_d, 0)) {
- if(cur_d<min_d) {
+ if (isect_line_tri_v3(co1, co2, v4, v1, v3, &cur_d, 0)) {
+ if (cur_d<min_d) {
min_d=cur_d;
pa->foffset=cur_d*50.0f; /* to the middle of volume */
intersect=1;
@@ -851,7 +851,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
}
}
}
- if(intersect==0)
+ if (intersect==0)
pa->foffset=0.0;
else switch(distr) {
case PART_DISTR_JIT:
@@ -863,10 +863,10 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
}
}
}
- else if(from == PART_FROM_CHILD) {
+ else if (from == PART_FROM_CHILD) {
MFace *mf;
- if(ctx->index[p] < 0) {
+ if (ctx->index[p] < 0) {
cpa->num=0;
cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]=0.0f;
cpa->pa[0]=cpa->pa[1]=cpa->pa[2]=cpa->pa[3]=0;
@@ -883,7 +883,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
cpa->num = ctx->index[p];
- if(ctx->tree) {
+ if (ctx->tree) {
KDTreeNearest ptn[10];
int w,maxw;//, do_seams;
float maxd /*, mind,dd */, totw= 0.0f;
@@ -898,36 +898,36 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
/* mind=ptn[0].dist; */ /* UNUSED */
/* the weights here could be done better */
- for(w=0; w<maxw; w++) {
+ for (w=0; w<maxw; w++) {
parent[w]=ptn[w].index;
pweight[w]=(float)pow(2.0,(double)(-6.0f*ptn[w].dist/maxd));
}
- for(;w<10; w++) {
+ for (;w<10; w++) {
parent[w]=-1;
pweight[w]=0.0f;
}
- for(w=0,i=0; w<maxw && i<4; w++) {
- if(parent[w]>=0) {
+ for (w=0,i=0; w<maxw && i<4; w++) {
+ if (parent[w]>=0) {
cpa->pa[i]=parent[w];
cpa->w[i]=pweight[w];
totw+=pweight[w];
i++;
}
}
- for(;i<4; i++) {
+ for (;i<4; i++) {
cpa->pa[i]=-1;
cpa->w[i]=0.0f;
}
- if(totw>0.0f) for(w=0; w<4; w++)
+ if (totw>0.0f) for (w=0; w<4; w++)
cpa->w[w]/=totw;
cpa->parent=cpa->pa[0];
}
}
- if(rng_skip_tot > 0) /* should never be below zero */
+ if (rng_skip_tot > 0) /* should never be below zero */
rng_skip(thread->rng, rng_skip_tot);
}
@@ -939,15 +939,15 @@ static void *distribute_threads_exec_cb(void *data)
ChildParticle *cpa;
int p, totpart;
- if(thread->ctx->from == PART_FROM_CHILD) {
+ if (thread->ctx->from == PART_FROM_CHILD) {
totpart= psys->totchild;
cpa= psys->child;
- for(p=0; p<totpart; p++, cpa++) {
- if(thread->ctx->skip) /* simplification skip */
+ for (p=0; p<totpart; p++, cpa++) {
+ if (thread->ctx->skip) /* simplification skip */
rng_skip(thread->rng, PSYS_RND_DIST_SKIP * thread->ctx->skip[p]);
- if((p+thread->num) % thread->tot == 0)
+ if ((p+thread->num) % thread->tot == 0)
distribute_threads_exec(thread, NULL, cpa, p);
else /* thread skip */
rng_skip(thread->rng, PSYS_RND_DIST_SKIP);
@@ -956,7 +956,7 @@ static void *distribute_threads_exec_cb(void *data)
else {
totpart= psys->totpart;
pa= psys->particles + thread->num;
- for(p=thread->num; p<totpart; p+=thread->tot, pa+=thread->tot)
+ for (p=thread->num; p<totpart; p+=thread->tot, pa+=thread->tot)
distribute_threads_exec(thread, pa, NULL, p);
}
@@ -970,14 +970,14 @@ static int distribute_compare_orig_index(const void *p1, const void *p2)
int index1 = COMPARE_ORIG_INDEX[*(const int*)p1];
int index2 = COMPARE_ORIG_INDEX[*(const int*)p2];
- if(index1 < index2)
+ if (index1 < index2)
return -1;
- else if(index1 == index2) {
+ else if (index1 == index2) {
/* this pointer comparison appears to make qsort stable for glibc,
* and apparently on solaris too, makes the renders reproducible */
- if(p1 < p2)
+ if (p1 < p2)
return -1;
- else if(p1 == p2)
+ else if (p1 == p2)
return 0;
else
return 1;
@@ -988,12 +988,12 @@ static int distribute_compare_orig_index(const void *p1, const void *p2)
static void distribute_invalid(Scene *scene, ParticleSystem *psys, int from)
{
- if(from == PART_FROM_CHILD) {
+ if (from == PART_FROM_CHILD) {
ChildParticle *cpa;
int p, totchild = get_psys_tot_child(scene, psys);
- if(psys->child && totchild) {
- for(p=0,cpa=psys->child; p<totchild; p++,cpa++) {
+ if (psys->child && totchild) {
+ for (p=0,cpa=psys->child; p<totchild; p++,cpa++) {
cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]= 0.0;
cpa->foffset= 0.0f;
cpa->parent=0;
@@ -1032,12 +1032,12 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
float *element_weight=NULL,*element_sum=NULL,*jitter_offset=NULL, *vweight=NULL;
float cur, maxweight=0.0, tweight, totweight, inv_totweight, co[3], nor[3], orco[3], ornor[3];
- if(ELEM3(NULL, ob, psys, psys->part))
+ if (ELEM3(NULL, ob, psys, psys->part))
return 0;
part=psys->part;
totpart=psys->totpart;
- if(totpart==0)
+ if (totpart==0)
return 0;
if (!finaldm->deformedOnly && !finaldm->getTessFaceDataArray(finaldm, CD_ORIGINDEX)) {
@@ -1047,9 +1047,9 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
}
/* First handle special cases */
- if(from == PART_FROM_CHILD) {
+ if (from == PART_FROM_CHILD) {
/* Simple children */
- if(part->childtype != PART_CHILD_FACES) {
+ if (part->childtype != PART_CHILD_FACES) {
BLI_srandom(31415926 + psys->seed + psys->child_seed);
distribute_simple_children(scene, ob, finaldm, psys);
return 0;
@@ -1057,7 +1057,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
}
else {
/* Grid distribution */
- if(part->distr==PART_DISTR_GRID && from != PART_FROM_VERT) {
+ 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);
@@ -1067,7 +1067,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
}
/* Create trees and original coordinates if needed */
- if(from == PART_FROM_CHILD) {
+ if (from == PART_FROM_CHILD) {
distr=PART_DISTR_RAND;
BLI_srandom(31415926 + psys->seed + psys->child_seed);
dm= finaldm;
@@ -1079,7 +1079,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
tree=BLI_kdtree_new(totpart);
- for(p=0,pa=psys->particles; p<totpart; p++,pa++) {
+ for (p=0,pa=psys->particles; p<totpart; p++,pa++) {
psys_particle_on_dm(dm,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,orco,ornor);
transform_mesh_orco_verts((Mesh*)ob->data, &orco, 1, 1);
BLI_kdtree_insert(tree, p, orco, ornor);
@@ -1096,7 +1096,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
dm= CDDM_from_mesh((Mesh*)ob->data, ob);
- /* BMESH ONLY, for verts we dont care about tessfaces */
+ /* BMESH ONLY, for verts we don't care about tessfaces */
if (from != PART_FROM_VERT) {
DM_ensure_tessface(dm);
}
@@ -1104,15 +1104,15 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
/* we need orco for consistent distributions */
DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, get_mesh_orco_verts(ob));
- if(from == PART_FROM_VERT) {
+ if (from == PART_FROM_VERT) {
MVert *mv= dm->getVertDataArray(dm, CD_MVERT);
float (*orcodata)[3]= dm->getVertDataArray(dm, CD_ORCO);
int totvert = dm->getNumVerts(dm);
tree=BLI_kdtree_new(totvert);
- for(p=0; p<totvert; p++) {
- if(orcodata) {
+ for (p=0; p<totvert; p++) {
+ if (orcodata) {
copy_v3_v3(co,orcodata[p]);
transform_mesh_orco_verts((Mesh*)ob->data, &co, 1, 1);
}
@@ -1128,13 +1128,13 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
/* Get total number of emission elements and allocate needed arrays */
totelem = (from == PART_FROM_VERT) ? dm->getNumVerts(dm) : dm->getNumTessFaces(dm);
- if(totelem == 0) {
+ if (totelem == 0) {
distribute_invalid(scene, psys, children ? PART_FROM_CHILD : 0);
- if(G.f & G_DEBUG)
+ if (G.f & G_DEBUG)
fprintf(stderr,"Particle distribution error: Nothing to emit from!\n");
- if(dm != finaldm) dm->release(dm);
+ if (dm != finaldm) dm->release(dm);
BLI_kdtree_free(tree);
@@ -1147,24 +1147,24 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
jitter_offset = MEM_callocN(sizeof(float)*totelem, "particle_distribution_jitoff");
/* Calculate weights from face areas */
- if((part->flag&PART_EDISTR || children) && from != PART_FROM_VERT) {
+ if ((part->flag&PART_EDISTR || children) && from != PART_FROM_VERT) {
MVert *v1, *v2, *v3, *v4;
float totarea=0.f, co1[3], co2[3], co3[3], co4[3];
float (*orcodata)[3];
orcodata= dm->getVertDataArray(dm, CD_ORCO);
- for(i=0; i<totelem; i++) {
+ for (i=0; i<totelem; i++) {
MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
- if(orcodata) {
+ if (orcodata) {
copy_v3_v3(co1, orcodata[mf->v1]);
copy_v3_v3(co2, orcodata[mf->v2]);
copy_v3_v3(co3, orcodata[mf->v3]);
transform_mesh_orco_verts((Mesh*)ob->data, &co1, 1, 1);
transform_mesh_orco_verts((Mesh*)ob->data, &co2, 1, 1);
transform_mesh_orco_verts((Mesh*)ob->data, &co3, 1, 1);
- if(mf->v4) {
+ if (mf->v4) {
copy_v3_v3(co4, orcodata[mf->v4]);
transform_mesh_orco_verts((Mesh*)ob->data, &co4, 1, 1);
}
@@ -1176,7 +1176,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
copy_v3_v3(co1, v1->co);
copy_v3_v3(co2, v2->co);
copy_v3_v3(co3, v3->co);
- if(mf->v4) {
+ if (mf->v4) {
v4= (MVert*)dm->getVertData(dm,mf->v4,CD_MVERT);
copy_v3_v3(co4, v4->co);
}
@@ -1184,21 +1184,21 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
cur = mf->v4 ? area_quad_v3(co1, co2, co3, co4) : area_tri_v3(co1, co2, co3);
- if(cur > maxweight)
+ if (cur > maxweight)
maxweight = cur;
element_weight[i] = cur;
totarea += cur;
}
- for(i=0; i<totelem; i++)
+ for (i=0; i<totelem; i++)
element_weight[i] /= totarea;
maxweight /= totarea;
}
- else{
+ else {
float min=1.0f/(float)(MIN2(totelem,totpart));
- for(i=0; i<totelem; i++)
+ for (i=0; i<totelem; i++)
element_weight[i]=min;
maxweight=min;
}
@@ -1206,17 +1206,17 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
/* Calculate weights from vgroup */
vweight = psys_cache_vgroup(dm,psys,PSYS_VG_DENSITY);
- if(vweight) {
- if(from==PART_FROM_VERT) {
- for(i=0;i<totelem; i++)
+ if (vweight) {
+ if (from==PART_FROM_VERT) {
+ for (i=0;i<totelem; i++)
element_weight[i]*=vweight[i];
}
else { /* PART_FROM_FACE / PART_FROM_VOLUME */
- for(i=0;i<totelem; i++) {
+ for (i=0;i<totelem; i++) {
MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
tweight = vweight[mf->v1] + vweight[mf->v2] + vweight[mf->v3];
- if(mf->v4) {
+ if (mf->v4) {
tweight += vweight[mf->v4];
tweight /= 4.0f;
}
@@ -1232,21 +1232,21 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
/* Calculate total weight of all elements */
totweight= 0.0f;
- for(i=0;i<totelem; i++)
+ for (i=0;i<totelem; i++)
totweight += element_weight[i];
inv_totweight = (totweight > 0.f ? 1.f/totweight : 0.f);
/* Calculate cumulative weights */
element_sum[0]= 0.0f;
- for(i=0; i<totelem; i++)
+ for (i=0; i<totelem; i++)
element_sum[i+1]= element_sum[i] + element_weight[i] * inv_totweight;
/* Finally assign elements to particles */
- if((part->flag&PART_TRAND) || (part->simplify_flag&PART_SIMPLIFY_ENABLE)) {
+ if ((part->flag&PART_TRAND) || (part->simplify_flag&PART_SIMPLIFY_ENABLE)) {
float pos;
- for(p=0; p<totpart; p++) {
+ for (p=0; p<totpart; p++) {
/* In theory element_sum[totelem] should be 1.0, but due to float errors this is not necessarily always true, so scale pos accordingly. */
pos= BLI_frand() * element_sum[totelem];
particle_element[p]= distribute_binary_search(element_sum, totelem, pos);
@@ -1261,14 +1261,14 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
pos= 1e-6; /* tiny offset to avoid zero weight face */
i= 0;
- for(p=0; p<totpart; p++, pos+=step) {
- while((i < totelem) && (pos > element_sum[i+1]))
+ for (p=0; p<totpart; p++, pos+=step) {
+ while ((i < totelem) && (pos > element_sum[i+1]))
i++;
particle_element[p]= MIN2(totelem-1, i);
/* avoid zero weight face */
- if(p == totpart-1 && element_weight[particle_element[p]] == 0.0f)
+ if (p == totpart-1 && element_weight[particle_element[p]] == 0.0f)
particle_element[p]= particle_element[p-1];
jitter_offset[particle_element[p]]= pos;
@@ -1279,32 +1279,32 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
/* For hair, sort by origindex (allows optimization's in rendering), */
/* however with virtual parents the children need to be in random order. */
- if(part->type == PART_HAIR && !(part->childtype==PART_CHILD_FACES && part->parents!=0.0f)) {
+ if (part->type == PART_HAIR && !(part->childtype==PART_CHILD_FACES && part->parents!=0.0f)) {
COMPARE_ORIG_INDEX = NULL;
- if(from == PART_FROM_VERT) {
- if(dm->numVertData)
+ if (from == PART_FROM_VERT) {
+ if (dm->numVertData)
COMPARE_ORIG_INDEX= dm->getVertDataArray(dm, CD_ORIGINDEX);
}
else {
- if(dm->numTessFaceData)
+ if (dm->numTessFaceData)
COMPARE_ORIG_INDEX= dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
}
- if(COMPARE_ORIG_INDEX) {
+ if (COMPARE_ORIG_INDEX) {
qsort(particle_element, totpart, sizeof(int), distribute_compare_orig_index);
COMPARE_ORIG_INDEX = NULL;
}
}
/* Create jittering if needed */
- if(distr==PART_DISTR_JIT && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
+ if (distr==PART_DISTR_JIT && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
jitlevel= part->userjit;
- if(jitlevel == 0) {
+ if (jitlevel == 0) {
jitlevel= totpart/totelem;
- if(part->flag & PART_EDISTR) jitlevel*= 2; /* looks better in general, not very scietific */
- if(jitlevel<3) jitlevel= 3;
+ if (part->flag & PART_EDISTR) jitlevel*= 2; /* looks better in general, not very scietific */
+ if (jitlevel<3) jitlevel= 3;
}
jit= MEM_callocN((2+ jitlevel*2)*sizeof(float), "jit");
@@ -1312,7 +1312,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
/* for small amounts of particles we use regular jitter since it looks
* a bit better, for larger amounts we switch to hammersley sequence
* because it is much faster */
- if(jitlevel < 25)
+ if (jitlevel < 25)
init_mv_jit(jit, jitlevel, psys->seed, part->jitfac);
else
hammersley_create(jit, jitlevel+1, psys->seed, part->jitfac);
@@ -1336,16 +1336,16 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
ctx->dm= dm;
ctx->tpars= tpars;
- if(children) {
+ if (children) {
totpart= psys_render_simplify_distribution(ctx, totpart);
alloc_child_particles(psys, totpart);
}
- if(!children || psys->totchild < 10000)
+ if (!children || psys->totchild < 10000)
totthread= 1;
seed= 31415926 + ctx->sim.psys->seed;
- for(i=0; i<totthread; i++) {
+ for (i=0; i<totthread; i++) {
threads[i].rng= rng_new(seed);
threads[i].tot= totthread;
}
@@ -1363,16 +1363,16 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
pthreads= psys_threads_create(sim);
- if(!distribute_threads_init_data(pthreads, sim->scene, finaldm, from)) {
+ if (!distribute_threads_init_data(pthreads, sim->scene, finaldm, from)) {
psys_threads_free(pthreads);
return;
}
totthread= pthreads[0].tot;
- if(totthread > 1) {
+ if (totthread > 1) {
BLI_init_threads(&threads, distribute_threads_exec_cb, totthread);
- for(i=0; i<totthread; i++)
+ for (i=0; i<totthread; i++)
BLI_insert_thread(&threads, &pthreads[i]);
BLI_end_threads(&threads);
@@ -1383,7 +1383,7 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
psys_calc_dmcache(sim->ob, finaldm, sim->psys);
ctx= pthreads[0].ctx;
- if(ctx->dm != finaldm)
+ if (ctx->dm != finaldm)
ctx->dm->release(ctx->dm);
psys_threads_free(pthreads);
@@ -1402,8 +1402,8 @@ static void distribute_particles(ParticleSimulationData *sim, int from)
PARTICLE_PSMD;
int distr_error=0;
- if(psmd) {
- if(psmd->dm)
+ if (psmd) {
+ if (psmd->dm)
distribute_particles_on_dm(sim, from);
else
distr_error=1;
@@ -1411,7 +1411,7 @@ static void distribute_particles(ParticleSimulationData *sim, int from)
else
distribute_particles_on_shape(sim, from);
- if(distr_error) {
+ if (distr_error) {
distribute_invalid(sim->scene, sim->psys, from);
fprintf(stderr,"Particle distribution error!\n");
@@ -1425,7 +1425,7 @@ ParticleThread *psys_threads_create(ParticleSimulationData *sim)
ParticleThreadContext *ctx;
int i, totthread;
- if(sim->scene->r.mode & R_FIXED_THREADS)
+ if (sim->scene->r.mode & R_FIXED_THREADS)
totthread= sim->scene->r.threads;
else
totthread= BLI_system_thread_count();
@@ -1439,7 +1439,7 @@ ParticleThread *psys_threads_create(ParticleSimulationData *sim)
memset(threads, 0, sizeof(ParticleThread)*totthread);
- for(i=0; i<totthread; i++) {
+ for (i=0; i<totthread; i++) {
threads[i].ctx= ctx;
threads[i].num= i;
threads[i].tot= totthread;
@@ -1454,39 +1454,39 @@ void psys_threads_free(ParticleThread *threads)
int i, totthread= threads[0].tot;
/* path caching */
- if(ctx->vg_length)
+ if (ctx->vg_length)
MEM_freeN(ctx->vg_length);
- if(ctx->vg_clump)
+ if (ctx->vg_clump)
MEM_freeN(ctx->vg_clump);
- if(ctx->vg_kink)
+ if (ctx->vg_kink)
MEM_freeN(ctx->vg_kink);
- if(ctx->vg_rough1)
+ if (ctx->vg_rough1)
MEM_freeN(ctx->vg_rough1);
- if(ctx->vg_rough2)
+ if (ctx->vg_rough2)
MEM_freeN(ctx->vg_rough2);
- if(ctx->vg_roughe)
+ if (ctx->vg_roughe)
MEM_freeN(ctx->vg_roughe);
- if(ctx->sim.psys->lattice) {
+ if (ctx->sim.psys->lattice) {
end_latt_deform(ctx->sim.psys->lattice);
ctx->sim.psys->lattice= NULL;
}
/* distribution */
- if(ctx->jit) MEM_freeN(ctx->jit);
- if(ctx->jitoff) MEM_freeN(ctx->jitoff);
- if(ctx->weight) MEM_freeN(ctx->weight);
- if(ctx->index) MEM_freeN(ctx->index);
- if(ctx->skip) MEM_freeN(ctx->skip);
- if(ctx->seams) MEM_freeN(ctx->seams);
+ if (ctx->jit) MEM_freeN(ctx->jit);
+ if (ctx->jitoff) MEM_freeN(ctx->jitoff);
+ if (ctx->weight) MEM_freeN(ctx->weight);
+ if (ctx->index) MEM_freeN(ctx->index);
+ if (ctx->skip) MEM_freeN(ctx->skip);
+ if (ctx->seams) MEM_freeN(ctx->seams);
//if(ctx->vertpart) MEM_freeN(ctx->vertpart);
BLI_kdtree_free(ctx->tree);
/* threads */
- for(i=0; i<totthread; i++) {
- if(threads[i].rng)
+ for (i=0; i<totthread; i++) {
+ if (threads[i].rng)
rng_free(threads[i].rng);
- if(threads[i].rng_path)
+ if (threads[i].rng_path)
rng_free(threads[i].rng_path);
}
@@ -1503,10 +1503,10 @@ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa, int p)
pa->flag &= ~PARS_UNEXIST;
- if(part->type != PART_FLUID) {
+ if (part->type != PART_FLUID) {
psys_get_texture(sim, pa, &ptex, PAMAP_INIT, 0.f);
- if(ptex.exist < PSYS_FRAND(p+125))
+ if (ptex.exist < PSYS_FRAND(p+125))
pa->flag |= PARS_UNEXIST;
pa->time = (part->type == PART_HAIR) ? 0.f : part->sta + (part->end - part->sta)*ptex.time;
@@ -1515,7 +1515,7 @@ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa, int p)
pa->hair_index = 0;
/* we can't reset to -1 anymore since we've figured out correct index in distribute_particles */
/* usage other than straight after distribute has to handle this index by itself - jahka*/
- //pa->num_dmcache = DMCACHE_NOTFOUND; /* assume we dont have a derived mesh face */
+ //pa->num_dmcache = DMCACHE_NOTFOUND; /* assume we don't have a derived mesh face */
}
static void initialize_all_particles(ParticleSimulationData *sim)
{
@@ -1525,16 +1525,16 @@ static void initialize_all_particles(ParticleSimulationData *sim)
psys->totunexist = 0;
LOOP_PARTICLES {
- if((pa->flag & PARS_UNEXIST)==0)
+ if ((pa->flag & PARS_UNEXIST)==0)
initialize_particle(sim, pa, p);
- if(pa->flag & PARS_UNEXIST)
+ if (pa->flag & PARS_UNEXIST)
psys->totunexist++;
}
/* Free unexisting particles. */
- if(psys->totpart && psys->totunexist == psys->totpart) {
- if(psys->particles->boid)
+ if (psys->totpart && psys->totunexist == psys->totpart) {
+ if (psys->particles->boid)
MEM_freeN(psys->particles->boid);
MEM_freeN(psys->particles);
@@ -1542,26 +1542,26 @@ static void initialize_all_particles(ParticleSimulationData *sim)
psys->totpart = psys->totunexist = 0;
}
- if(psys->totunexist) {
+ if (psys->totunexist) {
int newtotpart = psys->totpart - psys->totunexist;
ParticleData *npa, *newpars;
npa = newpars = MEM_callocN(newtotpart * sizeof(ParticleData), "particles");
- for(p=0, pa=psys->particles; p<newtotpart; p++, pa++, npa++) {
- while(pa->flag & PARS_UNEXIST)
+ for (p=0, pa=psys->particles; p<newtotpart; p++, pa++, npa++) {
+ while (pa->flag & PARS_UNEXIST)
pa++;
memcpy(npa, pa, sizeof(ParticleData));
}
- if(psys->particles->boid)
+ if (psys->particles->boid)
MEM_freeN(psys->particles->boid);
MEM_freeN(psys->particles);
psys->particles = newpars;
psys->totpart -= psys->totunexist;
- if(psys->particles->boid) {
+ if (psys->particles->boid) {
BoidParticle *newboids = MEM_callocN(psys->totpart * sizeof(BoidParticle), "boid particles");
LOOP_PARTICLES
@@ -1570,6 +1570,45 @@ static void initialize_all_particles(ParticleSimulationData *sim)
}
}
}
+
+static void get_angular_velocity_vector(short avemode, ParticleKey *state, float *vec)
+{
+ switch(avemode) {
+ case PART_AVE_VELOCITY:
+ copy_v3_v3(vec, state->vel);
+ break;
+ case PART_AVE_HORIZONTAL:
+ {
+ float zvec[3];
+ zvec[0] = zvec[1] = 0;
+ zvec[2] = 1.f;
+ cross_v3_v3v3(vec, state->vel, zvec);
+ break;
+ }
+ case PART_AVE_VERTICAL:
+ {
+ float zvec[3], temp[3];
+ zvec[0] = zvec[1] = 0;
+ zvec[2] = 1.f;
+ cross_v3_v3v3(temp, state->vel, zvec);
+ cross_v3_v3v3(vec, temp, state->vel);
+ break;
+ }
+ case PART_AVE_GLOBAL_X:
+ vec[0] = 1.f;
+ vec[1] = vec[2] = 0;
+ break;
+ case PART_AVE_GLOBAL_Y:
+ vec[1] = 1.f;
+ vec[0] = vec[2] = 0;
+ break;
+ case PART_AVE_GLOBAL_Z:
+ vec[2] = 1.f;
+ vec[0] = vec[1] = 0;
+ break;
+ }
+}
+
void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, ParticleKey *state, float dtime, float cfra)
{
Object *ob = sim->ob;
@@ -1584,7 +1623,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
part=psys->part;
/* get birth location from object */
- if(part->tanfac != 0.f)
+ if (part->tanfac != 0.f)
psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,utan,vtan,0,0);
else
psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0,0);
@@ -1602,7 +1641,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
normalize_v3(nor);
/* -tangent */
- if(part->tanfac!=0.0f) {
+ if (part->tanfac!=0.0f) {
//float phase=vg_rot?2.0f*(psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_rot)-0.5f):0.0f;
float phase=0.0f;
mul_v3_fl(vtan,-cosf((float)M_PI*(part->tanphase+phase)));
@@ -1620,7 +1659,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
/* -velocity (boids need this even if there's no random velocity) */
- if(part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)) {
+ if (part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)) {
r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f);
r_vel[1] = 2.0f * (PSYS_FRAND(p + 11) - 0.5f);
r_vel[2] = 2.0f * (PSYS_FRAND(p + 12) - 0.5f);
@@ -1630,7 +1669,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
}
/* -angular velocity */
- if(part->avemode==PART_AVE_RAND) {
+ if (part->avemode==PART_AVE_RAND) {
r_ave[0] = 2.0f * (PSYS_FRAND(p + 13) - 0.5f);
r_ave[1] = 2.0f * (PSYS_FRAND(p + 14) - 0.5f);
r_ave[2] = 2.0f * (PSYS_FRAND(p + 15) - 0.5f);
@@ -1640,7 +1679,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
}
/* -rotation */
- if(part->randrotfac != 0.0f) {
+ if (part->randrotfac != 0.0f) {
r_rot[0] = 2.0f * (PSYS_FRAND(p + 16) - 0.5f);
r_rot[1] = 2.0f * (PSYS_FRAND(p + 17) - 0.5f);
r_rot[2] = 2.0f * (PSYS_FRAND(p + 18) - 0.5f);
@@ -1651,7 +1690,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
mul_qt_qtqt(r_rot,r_rot,rot);
}
- if(part->phystype==PART_PHYS_BOIDS && pa->boid) {
+ if (part->phystype==PART_PHYS_BOIDS && pa->boid) {
float dvec[3], q[4], mat[3][3];
copy_v3_v3(state->co,loc);
@@ -1660,7 +1699,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
zero_v3(state->vel);
/* boids store direction in ave */
- if(fabsf(nor[2])==1.0f) {
+ if (fabsf(nor[2])==1.0f) {
sub_v3_v3v3(state->ave, loc, ob->obmat[3]);
normalize_v3(state->ave);
}
@@ -1685,34 +1724,34 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
/* -velocity from: */
/* *reactions */
- if(dtime > 0.f) {
+ if (dtime > 0.f) {
sub_v3_v3v3(vel, pa->state.vel, pa->prev_state.vel);
}
/* *emitter velocity */
- if(dtime != 0.f && part->obfac != 0.f) {
+ if (dtime != 0.f && part->obfac != 0.f) {
sub_v3_v3v3(vel, loc, state->co);
mul_v3_fl(vel, part->obfac/dtime);
}
/* *emitter normal */
- if(part->normfac != 0.f)
+ if (part->normfac != 0.f)
madd_v3_v3fl(vel, nor, part->normfac);
/* *emitter tangent */
- if(sim->psmd && part->tanfac != 0.f)
+ if (sim->psmd && part->tanfac != 0.f)
madd_v3_v3fl(vel, vtan, part->tanfac);
/* *emitter object orientation */
- if(part->ob_vel[0] != 0.f) {
+ if (part->ob_vel[0] != 0.f) {
normalize_v3_v3(vec, ob->obmat[0]);
madd_v3_v3fl(vel, vec, part->ob_vel[0]);
}
- if(part->ob_vel[1] != 0.f) {
+ if (part->ob_vel[1] != 0.f) {
normalize_v3_v3(vec, ob->obmat[1]);
madd_v3_v3fl(vel, vec, part->ob_vel[1]);
}
- if(part->ob_vel[2] != 0.f) {
+ if (part->ob_vel[2] != 0.f) {
normalize_v3_v3(vec, ob->obmat[2]);
madd_v3_v3fl(vel, vec, part->ob_vel[2]);
}
@@ -1721,11 +1760,11 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
/* TODO */
/* *random */
- if(part->randfac != 0.f)
+ if (part->randfac != 0.f)
madd_v3_v3fl(vel, r_vel, part->randfac);
/* *particle */
- if(part->partfac != 0.f)
+ if (part->partfac != 0.f)
madd_v3_v3fl(vel, p_vel, part->partfac);
mul_v3_v3fl(state->vel, vel, ptex.ivel);
@@ -1736,7 +1775,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
/* -rotation */
unit_qt(state->rot);
- if(part->rotmode) {
+ if (part->rotmode) {
/* create vector into which rotation is aligned */
switch(part->rotmode) {
case PART_ROT_NOR:
@@ -1762,14 +1801,14 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
vec_to_quat( q2,rot_vec, OB_POSX, OB_POSZ);
/* randomize rotation quat */
- if(part->randrotfac!=0.0f)
+ if (part->randrotfac!=0.0f)
interp_qt_qtqt(rot, q2, r_rot, part->randrotfac);
else
copy_qt_qt(rot,q2);
/* rotation phase */
phasefac = part->phasefac;
- if(part->randphasefac != 0.0f)
+ if (part->randphasefac != 0.0f)
phasefac += part->randphasefac * PSYS_FRAND(p + 20);
axis_angle_to_quat( q_phase,x_vec, phasefac*(float)M_PI);
@@ -1781,15 +1820,12 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
zero_v3(state->ave);
- if(part->avemode) {
- switch(part->avemode) {
- case PART_AVE_SPIN:
- copy_v3_v3(state->ave, vel);
- break;
- case PART_AVE_RAND:
- copy_v3_v3(state->ave, r_ave);
- break;
- }
+ if (part->avemode) {
+ if (part->avemode == PART_AVE_RAND)
+ copy_v3_v3(state->ave, r_ave);
+ else
+ get_angular_velocity_vector(part->avemode, state, state->ave);
+
normalize_v3(state->ave);
mul_v3_fl(state->ave, part->avefac);
}
@@ -1806,25 +1842,27 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
part=psys->part;
/* get precise emitter matrix if particle is born */
- if(part->type!=PART_HAIR && dtime > 0.f && pa->time < cfra && pa->time >= sim->psys->cfra) {
+ if (part->type!=PART_HAIR && dtime > 0.f && pa->time < cfra && pa->time >= sim->psys->cfra) {
/* we have to force RECALC_ANIM here since where_is_objec_time only does drivers */
- while(ob) {
+ while (ob) {
BKE_animsys_evaluate_animdata(sim->scene, &ob->id, ob->adt, pa->time, ADT_RECALC_ANIM);
ob = ob->parent;
}
ob = sim->ob;
where_is_object_time(sim->scene, ob, pa->time);
+
+ psys->flag |= PSYS_OB_ANIM_RESTORE;
}
psys_get_birth_coordinates(sim, pa, &pa->state, dtime, cfra);
- if(part->phystype==PART_PHYS_BOIDS && pa->boid) {
+ if (part->phystype==PART_PHYS_BOIDS && pa->boid) {
BoidParticle *bpa = pa->boid;
/* and gravity in r_ve */
bpa->gravity[0] = bpa->gravity[1] = 0.0f;
bpa->gravity[2] = -1.0f;
- if((sim->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY)
+ if ((sim->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY)
&& sim->scene->physics_settings.gravity[2]!=0.0f)
bpa->gravity[2] = sim->scene->physics_settings.gravity[2];
@@ -1835,30 +1873,30 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
}
- if(part->type == PART_HAIR) {
+ if (part->type == PART_HAIR) {
pa->lifetime = 100.0f;
}
- else{
+ else {
/* get possible textural influence */
psys_get_texture(sim, pa, &ptex, PAMAP_LIFE, cfra);
pa->lifetime = part->lifetime * ptex.life;
- if(part->randlife != 0.0f)
+ if (part->randlife != 0.0f)
pa->lifetime *= 1.0f - part->randlife * PSYS_FRAND(p + 21);
}
pa->dietime = pa->time + pa->lifetime;
- if(sim->psys->pointcache && sim->psys->pointcache->flag & PTCACHE_BAKED &&
+ if (sim->psys->pointcache && sim->psys->pointcache->flag & PTCACHE_BAKED &&
sim->psys->pointcache->mem_cache.first) {
float dietime = psys_get_dietime_from_cache(sim->psys->pointcache, p);
pa->dietime = MIN2(pa->dietime, dietime);
}
- if(pa->time > cfra)
+ if (pa->time > cfra)
pa->alive = PARS_UNBORN;
- else if(pa->dietime <= cfra)
+ else if (pa->dietime <= cfra)
pa->alive = PARS_DEAD;
else
pa->alive = PARS_ALIVE;
@@ -1870,7 +1908,7 @@ static void reset_all_particles(ParticleSimulationData *sim, float dtime, float
ParticleData *pa;
int p, totpart=sim->psys->totpart;
- for(p=from, pa=sim->psys->particles+from; p<totpart; p++, pa++)
+ for (p=from, pa=sim->psys->particles+from; p<totpart; p++, pa++)
reset_particle(sim, pa, dtime, cfra);
}
/************************************************/
@@ -1880,12 +1918,12 @@ ParticleSystem *psys_get_target_system(Object *ob, ParticleTarget *pt)
{
ParticleSystem *psys = NULL;
- if(pt->ob == NULL || pt->ob == ob)
+ if (pt->ob == NULL || pt->ob == ob)
psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
else
psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
- if(psys)
+ if (psys)
pt->flag |= PTARGET_VALID;
else
pt->flag &= ~PTARGET_VALID;
@@ -1903,12 +1941,12 @@ void psys_count_keyed_targets(ParticleSimulationData *sim)
int keys_valid = 1;
psys->totkeyed = 0;
- for(; pt; pt=pt->next) {
+ for (; pt; pt=pt->next) {
kpsys = psys_get_target_system(sim->ob, pt);
- if(kpsys && kpsys->totpart) {
+ if (kpsys && kpsys->totpart) {
psys->totkeyed += keys_valid;
- if(psys->flag & PSYS_KEYED_TIMING && pt->duration != 0.0f)
+ if (psys->flag & PSYS_KEYED_TIMING && pt->duration != 0.0f)
psys->totkeyed += 1;
}
else {
@@ -1932,13 +1970,13 @@ static void set_keyed_keys(ParticleSimulationData *sim)
ksim.scene= sim->scene;
/* no proper targets so let's clear and bail out */
- if(psys->totkeyed==0) {
+ if (psys->totkeyed==0) {
free_keyed_keys(psys);
psys->flag &= ~PSYS_KEYED;
return;
}
- if(totpart && psys->particles->totkey != totkeys) {
+ if (totpart && psys->particles->totkey != totkeys) {
free_keyed_keys(psys);
key = MEM_callocN(totpart*totkeys*sizeof(ParticleKey), "Keyed keys");
@@ -1954,7 +1992,7 @@ static void set_keyed_keys(ParticleSimulationData *sim)
pt = psys->targets.first;
- for(k=0; k<totkeys; k++) {
+ for (k=0; k<totkeys; k++) {
ksim.ob = pt->ob ? pt->ob : sim->ob;
ksim.psys = BLI_findlink(&ksim.ob->particlesystem, pt->psys - 1);
keyed_flag = (ksim.psys->flag & PSYS_KEYED);
@@ -1966,20 +2004,20 @@ static void set_keyed_keys(ParticleSimulationData *sim)
psys_get_particle_state(&ksim, p%ksim.psys->totpart, key, 1);
- if(psys->flag & PSYS_KEYED_TIMING) {
+ if (psys->flag & PSYS_KEYED_TIMING) {
key->time = pa->time + pt->time;
- if(pt->duration != 0.0f && k+1 < totkeys) {
+ if (pt->duration != 0.0f && k+1 < totkeys) {
copy_particle_key(key+1, key, 1);
(key+1)->time = pa->time + pt->time + pt->duration;
}
}
- else if(totkeys > 1)
+ else if (totkeys > 1)
key->time = pa->time + (float)k / (float)(totkeys - 1) * pa->lifetime;
else
key->time = pa->time;
}
- if(psys->flag & PSYS_KEYED_TIMING && pt->duration!=0.0f)
+ if (psys->flag & PSYS_KEYED_TIMING && pt->duration!=0.0f)
k++;
ksim.psys->flag |= keyed_flag;
@@ -1997,7 +2035,7 @@ void psys_make_temp_pointcache(Object *ob, ParticleSystem *psys)
{
PointCache *cache = psys->pointcache;
- if(cache->flag & PTCACHE_DISK_CACHE && cache->mem_cache.first == NULL) {
+ if (cache->flag & PTCACHE_DISK_CACHE && cache->mem_cache.first == NULL) {
PTCacheID pid;
BKE_ptcache_id_from_particles(&pid, ob, psys);
cache->flag &= ~PTCACHE_DISK_CACHE;
@@ -2007,7 +2045,7 @@ void psys_make_temp_pointcache(Object *ob, ParticleSystem *psys)
}
static void psys_clear_temp_pointcache(ParticleSystem *psys)
{
- if(psys->pointcache->flag & PTCACHE_DISK_CACHE)
+ if (psys->pointcache->flag & PTCACHE_DISK_CACHE)
BKE_ptcache_free_mem(&psys->pointcache->mem_cache);
}
void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra, int *efra)
@@ -2023,11 +2061,11 @@ void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra
/************************************************/
static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra)
{
- if(psys) {
+ if (psys) {
PARTICLE_P;
int totpart = 0;
- if(!psys->bvhtree || psys->bvhtree_frame != cfra) {
+ if (!psys->bvhtree || psys->bvhtree_frame != cfra) {
LOOP_SHOWN_PARTICLES {
totpart++;
}
@@ -2036,8 +2074,8 @@ static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra)
psys->bvhtree = BLI_bvhtree_new(totpart, 0.0, 4, 6);
LOOP_SHOWN_PARTICLES {
- if(pa->alive == PARS_ALIVE) {
- if(pa->state.time == cfra)
+ if (pa->alive == PARS_ALIVE) {
+ if (pa->state.time == cfra)
BLI_bvhtree_insert(psys->bvhtree, p, pa->prev_state.co, 1);
else
BLI_bvhtree_insert(psys->bvhtree, p, pa->state.co, 1);
@@ -2051,11 +2089,11 @@ static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra)
}
void psys_update_particle_tree(ParticleSystem *psys, float cfra)
{
- if(psys) {
+ if (psys) {
PARTICLE_P;
int totpart = 0;
- if(!psys->tree || psys->tree_frame != cfra) {
+ if (!psys->tree || psys->tree_frame != cfra) {
LOOP_SHOWN_PARTICLES {
totpart++;
}
@@ -2064,8 +2102,8 @@ void psys_update_particle_tree(ParticleSystem *psys, float cfra)
psys->tree = BLI_kdtree_new(psys->totpart);
LOOP_SHOWN_PARTICLES {
- if(pa->alive == PARS_ALIVE) {
- if(pa->state.time == cfra)
+ if (pa->alive == PARS_ALIVE) {
+ if (pa->state.time == cfra)
BLI_kdtree_insert(psys->tree, p, pa->prev_state.co, NULL);
else
BLI_kdtree_insert(psys->tree, p, pa->state.co, NULL);
@@ -2096,7 +2134,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
copy_v3_v3(oldpos, pa->state.co);
/* Verlet integration behaves strangely with moving emitters, so do first step with euler. */
- if(pa->prev_state.time < 0.f && integrator == PART_INT_VERLET)
+ if (pa->prev_state.time < 0.f && integrator == PART_INT_VERLET)
integrator = PART_INT_EULER;
switch(integrator) {
@@ -2118,7 +2156,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
states->time = 0.f;
- for(i=0; i<steps; i++) {
+ for (i=0; i<steps; i++) {
zero_v3(force);
zero_v3(impulse);
@@ -2127,7 +2165,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
/* force to acceleration*/
mul_v3_v3fl(acceleration, force, 1.0f/pa_mass);
- if(external_acceleration)
+ if (external_acceleration)
add_v3_v3(acceleration, external_acceleration);
/* calculate next state */
@@ -2139,13 +2177,13 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
madd_v3_v3v3fl(pa->state.vel, states->vel, acceleration, dtime);
break;
case PART_INT_MIDPOINT:
- if(i==0) {
+ if (i==0) {
madd_v3_v3v3fl(states[1].co, states->co, states->vel, dtime*0.5f);
madd_v3_v3v3fl(states[1].vel, states->vel, acceleration, dtime*0.5f);
states[1].time = dtime*0.5f;
/*fra=sim->psys->cfra+0.5f*dfra;*/
}
- else{
+ else {
madd_v3_v3v3fl(pa->state.co, states->co, states[1].vel, dtime);
madd_v3_v3v3fl(pa->state.vel, states->vel, acceleration, dtime);
}
@@ -2230,11 +2268,11 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
static ParticleSpring *sph_spring_add(ParticleSystem *psys, ParticleSpring *spring)
{
/* Are more refs required? */
- if(psys->alloc_fluidsprings == 0 || psys->fluid_springs == NULL) {
+ if (psys->alloc_fluidsprings == 0 || psys->fluid_springs == NULL) {
psys->alloc_fluidsprings = PSYS_FLUID_SPRINGS_INITIAL_SIZE;
psys->fluid_springs = (ParticleSpring*)MEM_callocN(psys->alloc_fluidsprings * sizeof(ParticleSpring), "Particle Fluid Springs");
}
- else if(psys->tot_fluidsprings == psys->alloc_fluidsprings) {
+ else if (psys->tot_fluidsprings == psys->alloc_fluidsprings) {
/* Double the number of refs allocated */
psys->alloc_fluidsprings *= 2;
psys->fluid_springs = (ParticleSpring*)MEM_reallocN(psys->fluid_springs, psys->alloc_fluidsprings * sizeof(ParticleSpring));
@@ -2271,11 +2309,11 @@ static void sph_springs_modify(ParticleSystem *psys, float dtime)
/* scale things according to dtime */
float timefix = 25.f * dtime;
- if((fluid->flag & SPH_VISCOELASTIC_SPRINGS)==0 || fluid->spring_k == 0.f)
+ if ((fluid->flag & SPH_VISCOELASTIC_SPRINGS)==0 || fluid->spring_k == 0.f)
return;
/* Loop through the springs */
- for(i=0; i<psys->tot_fluidsprings; i++, spring++) {
+ for (i=0; i<psys->tot_fluidsprings; i++, spring++) {
pa1 = psys->particles + spring->particle_index[0];
pa2 = psys->particles + spring->particle_index[1];
@@ -2288,18 +2326,18 @@ static void sph_springs_modify(ParticleSystem *psys, float dtime)
if (rij > Lij + d) // Stretch
spring->rest_length += plasticity * (rij - Lij - d) * timefix;
- else if(rij < Lij - d) // Compress
+ else if (rij < Lij - d) // Compress
spring->rest_length -= plasticity * (Lij - d - rij) * timefix;
h = 4.f*pa1->size;
- if(spring->rest_length > h)
+ if (spring->rest_length > h)
spring->delete_flag = 1;
}
/* Loop through springs backwaqrds - for efficient delete function */
for (i=psys->tot_fluidsprings-1; i >= 0; i--) {
- if(psys->fluid_springs[i].delete_flag)
+ if (psys->fluid_springs[i].delete_flag)
sph_spring_delete(psys, i);
}
}
@@ -2311,7 +2349,7 @@ static EdgeHash *sph_springhash_build(ParticleSystem *psys)
springhash = BLI_edgehash_new();
- for(i=0, spring=psys->fluid_springs; i<psys->tot_fluidsprings; i++, spring++)
+ for (i=0, spring=psys->fluid_springs; i<psys->tot_fluidsprings; i++, spring++)
BLI_edgehash_insert(springhash, spring->particle_index[0], spring->particle_index[1], SET_INT_IN_POINTER(i+1));
return springhash;
@@ -2361,7 +2399,7 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist)
float q;
float dist;
- if(npa == pfr->pa || squared_dist < FLT_EPSILON)
+ if (npa == pfr->pa || squared_dist < FLT_EPSILON)
return;
/* Ugh! One particle has too many neighbors! If some aren't taken into
@@ -2370,7 +2408,7 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist)
* But, we have to stop somewhere, and it's not the end of the world.
* - jahka and z0r
*/
- if(pfr->tot_neighbors >= SPH_NEIGHBORS)
+ if (pfr->tot_neighbors >= SPH_NEIGHBORS)
return;
pfr->neighbors[pfr->tot_neighbors].index = index;
@@ -2380,7 +2418,7 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist)
dist = sqrtf(squared_dist);
q = (1.f - dist/pfr->h) * pfr->massfac;
- if(pfr->use_size)
+ if (pfr->use_size)
q *= npa->size;
pfr->density += q*q;
@@ -2409,7 +2447,8 @@ static void sph_particle_courant(SPHData *sphdata, SPHRangeData *pfr)
dist += sphdata->psys[0]->part->fluid->radius; // TODO: remove this? - z0r
sphdata->element_size = dist / pfr->tot_neighbors;
mul_v3_v3fl(sphdata->flow, flow, 1.0f / pfr->tot_neighbors);
- } else {
+ }
+ else {
sphdata->element_size = MAXFLOAT;
copy_v3_v3(sphdata->flow, flow);
}
@@ -2455,7 +2494,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
pfr.h = h;
pfr.pa = pa;
- for(i=0; i<10 && psys[i]; i++) {
+ for (i=0; i<10 && psys[i]; i++) {
pfr.npsys = psys[i];
pfr.massfac = psys[i]->part->mass*inv_mass;
pfr.use_size = psys[i]->part->flag & PART_SIZEMASS;
@@ -2467,7 +2506,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
near_pressure = stiffness_near_fac * pfr.near_density;
pfn = pfr.neighbors;
- for(i=0; i<pfr.tot_neighbors; i++, pfn++) {
+ for (i=0; i<pfr.tot_neighbors; i++, pfn++) {
npa = pfn->psys->particles + pfn->index;
madd_v3_v3v3fl(co, npa->prev_state.co, npa->prev_state.vel, state->time);
@@ -2477,7 +2516,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
q = (1.f - rij/h) * pfn->psys->part->mass * inv_mass;
- if(pfn->psys->part->flag & PART_SIZEMASS)
+ if (pfn->psys->part->flag & PART_SIZEMASS)
q *= npa->size;
copy_v3_v3(vel, npa->prev_state.vel);
@@ -2486,29 +2525,29 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
madd_v3_v3fl(force, vec, -(pressure + near_pressure*q)*q);
/* Viscosity */
- if(visc > 0.f || stiff_visc > 0.f) {
+ if (visc > 0.f || stiff_visc > 0.f) {
sub_v3_v3v3(dv, vel, state->vel);
u = dot_v3v3(vec, dv);
- if(u < 0.f && visc > 0.f)
+ if (u < 0.f && visc > 0.f)
madd_v3_v3fl(force, vec, 0.5f * q * visc * u );
- if(u > 0.f && stiff_visc > 0.f)
+ if (u > 0.f && stiff_visc > 0.f)
madd_v3_v3fl(force, vec, 0.5f * q * stiff_visc * u );
}
- if(spring_constant > 0.f) {
+ if (spring_constant > 0.f) {
/* Viscoelastic spring force */
if (pfn->psys == psys[0] && fluid->flag & SPH_VISCOELASTIC_SPRINGS && springhash) {
/* BLI_edgehash_lookup appears to be thread-safe. - z0r */
spring_index = GET_INT_FROM_POINTER(BLI_edgehash_lookup(springhash, index, pfn->index));
- if(spring_index) {
+ if (spring_index) {
spring = psys[0]->fluid_springs + spring_index - 1;
madd_v3_v3fl(force, vec, -10.f * spring_constant * (1.f - rij/h) * (spring->rest_length - rij));
}
- else if(fluid->spring_frames == 0 || (pa->prev_state.time-pa->time) <= fluid->spring_frames) {
+ else if (fluid->spring_frames == 0 || (pa->prev_state.time-pa->time) <= fluid->spring_frames) {
ParticleSpring temp_spring;
temp_spring.particle_index[0] = index;
temp_spring.particle_index[1] = pfn->index;
@@ -2542,7 +2581,7 @@ static void sph_solver_init(ParticleSimulationData *sim, SPHData *sphdata)
// Add other coupled particle systems.
sphdata->psys[0] = sim->psys;
- for(i=1, pt=sim->psys->targets.first; i<10; i++, pt=(pt?pt->next:NULL))
+ for (i=1, pt=sim->psys->targets.first; i<10; i++, pt=(pt?pt->next:NULL))
sphdata->psys[i] = pt ? psys_get_target_system(sim->ob, pt) : NULL;
if (psys_uses_gravity(sim))
@@ -2610,18 +2649,18 @@ static void basic_force_cb(void *efdata_v, ParticleKey *state, float *force, flo
/* add effectors */
pd_point_from_particle(efdata->sim, efdata->pa, state, &epoint);
- if(part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR)
+ if (part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR)
pdDoEffectors(sim->psys->effectors, sim->colliders, part->effector_weights, &epoint, force, impulse);
mul_v3_fl(force, efdata->ptex.field);
mul_v3_fl(impulse, efdata->ptex.field);
/* calculate air-particle interaction */
- if(part->dragfac != 0.0f)
+ if (part->dragfac != 0.0f)
madd_v3_v3fl(force, state->vel, -part->dragfac * pa->size * pa->size * len_v3(state->vel));
/* brownian force */
- if(part->brownfac != 0.0f) {
+ if (part->brownfac != 0.0f) {
force[0] += (BLI_frand()-0.5f) * part->brownfac;
force[1] += (BLI_frand()-0.5f) * part->brownfac;
force[2] += (BLI_frand()-0.5f) * part->brownfac;
@@ -2643,7 +2682,7 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
efdata.sim = sim;
/* add global acceleration (gravitation) */
- if(psys_uses_gravity(sim)
+ if (psys_uses_gravity(sim)
/* normal gravity is too strong for hair so it's disabled by default */
&& (part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR)) {
zero_v3(gr);
@@ -2657,7 +2696,7 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
integrate_particle(part, pa, dtime, gravity, basic_force_cb, &efdata);
/* damp affects final velocity */
- if(part->dampfac != 0.f)
+ if (part->dampfac != 0.f)
mul_v3_fl(pa->state.vel, 1.f - part->dampfac * efdata.ptex.damp * 25.f * dtime);
//copy_v3_v3(pa->state.ave, states->ave);
@@ -2670,8 +2709,8 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
copy_v3_v3(tkey.vel,pa->state.vel);
tkey.time=pa->state.time;
- if(part->type != PART_HAIR) {
- if(do_guides(sim->psys->effectors, &tkey, p, time)) {
+ if (part->type != PART_HAIR) {
+ if (do_guides(sim->psys->effectors, &tkey, p, time)) {
copy_v3_v3(pa->state.co,tkey.co);
/* guides don't produce valid velocity */
sub_v3_v3v3(pa->state.vel, tkey.co, pa->prev_state.co);
@@ -2684,31 +2723,37 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
{
float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep;
- if((part->flag & PART_ROT_DYN)==0) {
- if(part->avemode==PART_AVE_SPIN) {
- float angle;
- float len1 = len_v3(pa->prev_state.vel);
- float len2 = len_v3(pa->state.vel);
-
- if(len1==0.0f || len2==0.0f)
- pa->state.ave[0]=pa->state.ave[1]=pa->state.ave[2]=0.0f;
- else{
- cross_v3_v3v3(pa->state.ave,pa->prev_state.vel,pa->state.vel);
- normalize_v3(pa->state.ave);
- angle=dot_v3v3(pa->prev_state.vel,pa->state.vel)/(len1*len2);
- mul_v3_fl(pa->state.ave,saacos(angle)/dtime);
- }
+ if ((part->flag & PART_ROTATIONS)==0) {
+ pa->state.rot[0]=1.0f;
+ pa->state.rot[1]=pa->state.rot[2]=pa->state.rot[3]=0;
+ return;
+ }
+
+ if ((part->flag & PART_ROT_DYN)==0 && ELEM3(part->avemode, PART_AVE_VELOCITY, PART_AVE_HORIZONTAL, PART_AVE_VERTICAL)) {
+ float angle;
+ float len1 = len_v3(pa->prev_state.vel);
+ float len2 = len_v3(pa->state.vel);
+ float vec[3];
- axis_angle_to_quat(rot2,pa->state.vel,dtime*part->avefac);
+ if (len1==0.0f || len2==0.0f)
+ pa->state.ave[0] = pa->state.ave[1] = pa->state.ave[2] = 0.0f;
+ else {
+ cross_v3_v3v3(pa->state.ave, pa->prev_state.vel, pa->state.vel);
+ normalize_v3(pa->state.ave);
+ angle = dot_v3v3(pa->prev_state.vel, pa->state.vel) / (len1 * len2);
+ mul_v3_fl(pa->state.ave, saacos(angle) / dtime);
}
+
+ get_angular_velocity_vector(part->avemode, &pa->state, vec);
+ axis_angle_to_quat(rot2, vec, dtime*part->avefac);
}
- rotfac=len_v3(pa->state.ave);
- if(rotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */
+ rotfac = len_v3(pa->state.ave);
+ if (rotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */
rot1[0]=1.0f;
rot1[1]=rot1[2]=rot1[3]=0;
}
- else{
+ else {
axis_angle_to_quat(rot1,pa->state.ave,rotfac*dtime);
}
mul_qt_qtqt(pa->state.rot,rot1,pa->prev_state.rot);
@@ -2739,14 +2784,14 @@ static float nr_signed_distance_to_plane(float *p, float radius, ParticleCollisi
d = dot_v3v3(p0, nor);
- if(pce->inv_nor == -1) {
- if(d < 0.f)
+ if (pce->inv_nor == -1) {
+ if (d < 0.f)
pce->inv_nor = 1;
else
pce->inv_nor = 0;
}
- if(pce->inv_nor == 1) {
+ if (pce->inv_nor == 1) {
negate_v3(nor);
d = -d;
}
@@ -2776,13 +2821,13 @@ static void collision_interpolate_element(ParticleCollisionElement *pce, float t
/* the col->fac's are factors for the particle subframe step start and end during collision modifier step */
float f = fac + t*(1.f-fac);
float mul = col->fac1 + f * (col->fac2-col->fac1);
- if(pce->tot > 0) {
+ if (pce->tot > 0) {
madd_v3_v3v3fl(pce->x0, pce->x[0], pce->v[0], mul);
- if(pce->tot > 1) {
+ if (pce->tot > 1) {
madd_v3_v3v3fl(pce->x1, pce->x[1], pce->v[1], mul);
- if(pce->tot > 2)
+ if (pce->tot > 2)
madd_v3_v3v3fl(pce->x2, pce->x[2], pce->v[2], mul);
}
}
@@ -2793,11 +2838,11 @@ static void collision_point_velocity(ParticleCollisionElement *pce)
copy_v3_v3(pce->vel, pce->v[0]);
- if(pce->tot > 1) {
+ if (pce->tot > 1) {
sub_v3_v3v3(v, pce->v[1], pce->v[0]);
madd_v3_v3fl(pce->vel, v, pce->uv[0]);
- if(pce->tot > 2) {
+ if (pce->tot > 2) {
sub_v3_v3v3(v, pce->v[2], pce->v[0]);
madd_v3_v3fl(pce->vel, v, pce->uv[1]);
}
@@ -2805,7 +2850,7 @@ static void collision_point_velocity(ParticleCollisionElement *pce)
}
static float collision_point_distance_with_normal(float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *nor)
{
- if(fac >= 0.f)
+ if (fac >= 0.f)
collision_interpolate_element(pce, 0.f, fac, col);
switch(pce->tot) {
@@ -2866,7 +2911,7 @@ static void collision_point_on_surface(float p[3], ParticleCollisionElement *pce
cross_v3_v3v3(nor, e1, e2);
normalize_v3(nor);
- if(pce->inv_nor == 1)
+ if (pce->inv_nor == 1)
negate_v3(nor);
madd_v3_v3v3fl(co, pce->x0, nor, col->radius);
@@ -2891,7 +2936,7 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
t1 = 0.001f;
d1 = 0.f;
- for(iter=0; iter<10; iter++) {//, itersum++) {
+ for (iter=0; iter<10; iter++) {//, itersum++) {
/* get current location */
collision_interpolate_element(pce, t1, col->f, col);
interp_v3_v3v3(pce->p, col->co1, col->co2, t1);
@@ -2899,12 +2944,12 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
d1 = distance_func(pce->p, radius, pce, n);
/* no movement, so no collision */
- if(d1 == d0) {
+ if (d1 == d0) {
return -1.f;
}
/* particle already inside face, so report collision */
- if(iter == 0 && d0 < 0.f && d0 > -radius) {
+ if (iter == 0 && d0 < 0.f && d0 > -radius) {
copy_v3_v3(pce->p, col->co1);
copy_v3_v3(pce->nor, n);
pce->inside = 1;
@@ -2919,7 +2964,7 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
t1 -= d1*dd;
/* particle movin away from plane could also mean a strangely rotating face, so check from end */
- if(iter == 0 && t1 < 0.f) {
+ if (iter == 0 && t1 < 0.f) {
t0 = 1.f;
collision_interpolate_element(pce, t0, col->f, col);
d0 = distance_func(col->co2, radius, pce, n);
@@ -2928,12 +2973,12 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
continue;
}
- else if(iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.f))
+ else if (iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.f))
return -1.f;
- if(d1 <= COLLISION_ZERO && d1 >= -COLLISION_ZERO) {
- if(t1 >= -COLLISION_ZERO && t1 <= 1.f) {
- if(distance_func == nr_signed_distance_to_plane)
+ if (d1 <= COLLISION_ZERO && d1 >= -COLLISION_ZERO) {
+ if (t1 >= -COLLISION_ZERO && t1 <= 1.f) {
+ if (distance_func == nr_signed_distance_to_plane)
copy_v3_v3(pce->nor, n);
CLAMP(t1, 0.f, 1.f);
@@ -2956,7 +3001,7 @@ static int collision_sphere_to_tri(ParticleCollision *col, float radius, Particl
ct = collision_newton_rhapson(col, radius, pce, nr_signed_distance_to_plane);
- if(ct >= 0.f && ct < *t && (result->inside==0 || pce->inside==1) ) {
+ if (ct >= 0.f && ct < *t && (result->inside==0 || pce->inside==1) ) {
float e1[3], e2[3], p0[3];
float e1e1, e1e2, e1p0, e2e2, e2p0, inv;
@@ -2975,7 +3020,7 @@ static int collision_sphere_to_tri(ParticleCollision *col, float radius, Particl
u = (e2e2 * e1p0 - e1e2 * e2p0) * inv;
v = (e1e1 * e2p0 - e1e2 * e1p0) * inv;
- if(u>=0.f && u<=1.f && v>=0.f && u+v<=1.f) {
+ if (u>=0.f && u<=1.f && v>=0.f && u+v<=1.f) {
*result = *pce;
/* normal already calculated in pce */
@@ -2997,9 +3042,9 @@ static int collision_sphere_to_edges(ParticleCollision *col, float radius, Parti
float ct;
int i;
- for(i=0; i<3; i++) {
+ for (i=0; i<3; i++) {
/* in case of a quad, no need to check "edge" that goes through face twice */
- if((pce->x[3] && i==2))
+ if ((pce->x[3] && i==2))
continue;
cur = edge+i;
@@ -3010,14 +3055,14 @@ static int collision_sphere_to_edges(ParticleCollision *col, float radius, Parti
ct = collision_newton_rhapson(col, radius, cur, nr_distance_to_edge);
- if(ct >= 0.f && ct < *t) {
+ if (ct >= 0.f && ct < *t) {
float u, e[3], vec[3];
sub_v3_v3v3(e, cur->x1, cur->x0);
sub_v3_v3v3(vec, cur->p, cur->x0);
u = dot_v3v3(vec, e) / dot_v3v3(e, e);
- if(u < 0.f || u > 1.f)
+ if (u < 0.f || u > 1.f)
break;
*result = *cur;
@@ -3044,9 +3089,9 @@ static int collision_sphere_to_verts(ParticleCollision *col, float radius, Parti
float ct;
int i;
- for(i=0; i<3; i++) {
+ for (i=0; i<3; i++) {
/* in case of quad, only check one vert the first time */
- if(pce->x[3] && i != 1)
+ if (pce->x[3] && i != 1)
continue;
cur = vert+i;
@@ -3057,7 +3102,7 @@ static int collision_sphere_to_verts(ParticleCollision *col, float radius, Parti
ct = collision_newton_rhapson(col, radius, cur, nr_distance_to_vert);
- if(ct >= 0.f && ct < *t) {
+ if (ct >= 0.f && ct < *t) {
*result = *cur;
sub_v3_v3v3(result->nor, cur->p, cur->x0);
@@ -3097,18 +3142,18 @@ void BKE_psys_collision_neartest_cb(void *userdata, int index, const BVHTreeRay
pce.index = index;
/* don't collide with same face again */
- if(col->hit == col->current && col->pce.index == index && col->pce.tot == 3)
+ if (col->hit == col->current && col->pce.index == index && col->pce.tot == 3)
return;
do
{
collision = collision_sphere_to_tri(col, ray->radius, &pce, &t);
- if(col->pce.inside == 0) {
+ if (col->pce.inside == 0) {
collision += collision_sphere_to_edges(col, ray->radius, &pce, &t);
collision += collision_sphere_to_verts(col, ray->radius, &pce, &t);
}
- if(collision) {
+ if (collision) {
hit->dist = col->original_ray_length * t;
hit->index = index;
@@ -3125,14 +3170,14 @@ void BKE_psys_collision_neartest_cb(void *userdata, int index, const BVHTreeRay
pce.v[2] = pce.v[3];
pce.v[3] = NULL;
- } while(pce.x[2]);
+ } while (pce.x[2]);
}
static int collision_detect(ParticleData *pa, ParticleCollision *col, BVHTreeRayHit *hit, ListBase *colliders)
{
ColliderCache *coll;
float ray_dir[3];
- if(colliders->first == NULL)
+ if (colliders->first == NULL)
return 0;
sub_v3_v3v3(ray_dir, col->co2, col->co1);
@@ -3142,16 +3187,16 @@ static int collision_detect(ParticleData *pa, ParticleCollision *col, BVHTreeRay
/* even if particle is stationary we want to check for moving colliders */
/* if hit.dist is zero the bvhtree_ray_cast will just ignore everything */
- if(hit->dist == 0.0f)
+ if (hit->dist == 0.0f)
hit->dist = col->original_ray_length = 0.000001f;
- for(coll = colliders->first; coll; coll=coll->next) {
+ for (coll = colliders->first; coll; coll=coll->next) {
/* for boids: don't check with current ground object */
- if(coll->ob == col->skip)
+ if (coll->ob == col->skip)
continue;
/* particles should not collide with emitter at birth */
- if(coll->ob == col->emitter && pa->time < col->cfra && pa->time >= col->old_cfra)
+ if (coll->ob == col->emitter && pa->time < col->cfra && pa->time >= col->old_cfra)
continue;
col->current = coll->ob;
@@ -3159,7 +3204,7 @@ static int collision_detect(ParticleData *pa, ParticleCollision *col, BVHTreeRay
col->fac1 = (col->old_cfra - coll->collmd->time_x) / (coll->collmd->time_xnew - coll->collmd->time_x);
col->fac2 = (col->cfra - coll->collmd->time_x) / (coll->collmd->time_xnew - coll->collmd->time_x);
- if(col->md && col->md->bvhtree)
+ if (col->md && col->md->bvhtree)
BLI_bvhtree_ray_cast(col->md->bvhtree, col->co1, ray_dir, col->radius, hit, BKE_psys_collision_neartest_cb, col);
}
@@ -3180,7 +3225,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
interp_v3_v3v3(co, col->co1, col->co2, x);
/* particle dies in collision */
- if(through == 0 && (kill || pd->flag & PDEFLE_KILL_PART)) {
+ if (through == 0 && (kill || pd->flag & PDEFLE_KILL_PART)) {
pa->alive = PARS_DYING;
pa->dietime = col->old_cfra + (col->cfra - col->old_cfra) * f;
@@ -3221,9 +3266,9 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
madd_v3_v3v3fl(vc_tan, pce->vel, pce->nor, -vc_dot);
/* handle friction effects (tangential and angular velocity) */
- if(frict > 0.0f) {
+ if (frict > 0.0f) {
/* angular <-> linear velocity */
- if(dynamic_rotation) {
+ if (dynamic_rotation) {
float vr_tan[3], v1_tan[3], ave[3];
/* linear velocity of particle surface */
@@ -3265,9 +3310,9 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
/* stickness was possibly added before, so cancel that before calculating new normal velocity */
/* otherwise particles go flying out of the surface because of high reversed sticky velocity */
- if(v0_dot < 0.0f) {
+ if (v0_dot < 0.0f) {
v0_dot += pd->pdef_stickness;
- if(v0_dot > 0.0f)
+ if (v0_dot > 0.0f)
v0_dot = 0.0f;
}
@@ -3277,9 +3322,9 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
/* calculate normal particle velocity */
/* special case for object hitting the particle from behind */
- if(through==0 && ((vc_dot>0.0f && v0_dot>0.0f && vc_dot>v0_dot) || (vc_dot<0.0f && v0_dot<0.0f && vc_dot<v0_dot)))
+ if (through==0 && ((vc_dot>0.0f && v0_dot>0.0f && vc_dot>v0_dot) || (vc_dot<0.0f && v0_dot<0.0f && vc_dot<v0_dot)))
mul_v3_v3fl(v0_nor, pce->nor, vc_dot);
- else if(v0_dot > 0.f)
+ else if (v0_dot > 0.f)
mul_v3_v3fl(v0_nor, pce->nor, vc_dot + (through ? -1.0f : 1.0f) * v0_dot);
else
mul_v3_v3fl(v0_nor, pce->nor, vc_dot + (through ? 1.0f : -1.0f) * v0_dot);
@@ -3287,10 +3332,10 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
/* combine components together again */
add_v3_v3v3(v0, v0_nor, v0_tan);
- if(col->boid) {
+ if (col->boid) {
/* keep boids above ground */
BoidParticle *bpa = pa->boid;
- if(bpa->data.mode == eBoidMode_OnLand || co[2] <= col->boid_z) {
+ if (bpa->data.mode == eBoidMode_OnLand || co[2] <= col->boid_z) {
co[2] = col->boid_z;
v0[2] = 0.0f;
}
@@ -3302,23 +3347,23 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
madd_v3_v3v3fl(pa->state.vel, v0, col->acc, dt2);
/* make sure particle stays on the right side of the surface */
- if(!through) {
+ if (!through) {
distance = collision_point_distance_with_normal(co, pce, -1.f, col, nor);
- if(distance < col->radius + COLLISION_MIN_DISTANCE)
+ if (distance < col->radius + COLLISION_MIN_DISTANCE)
madd_v3_v3fl(co, nor, col->radius + COLLISION_MIN_DISTANCE - distance);
dot = dot_v3v3(nor, v0);
- if(dot < 0.f)
+ if (dot < 0.f)
madd_v3_v3fl(v0, nor, -dot);
distance = collision_point_distance_with_normal(pa->state.co, pce, 1.f, col, nor);
- if(distance < col->radius + COLLISION_MIN_DISTANCE)
+ if (distance < col->radius + COLLISION_MIN_DISTANCE)
madd_v3_v3fl(pa->state.co, nor, col->radius + COLLISION_MIN_DISTANCE - distance);
dot = dot_v3v3(nor, pa->state.vel);
- if(dot < 0.f)
+ if (dot < 0.f)
madd_v3_v3fl(pa->state.vel, nor, -dot);
}
@@ -3393,21 +3438,21 @@ static void collision_check(ParticleSimulationData *sim, int p, float dfra, floa
col.radius = ((part->flag & PART_SIZE_DEFL) || (part->phystype == PART_PHYS_BOIDS)) ? pa->size : COLLISION_MIN_RADIUS;
/* override for boids */
- if(part->phystype == PART_PHYS_BOIDS && part->boids->options & BOID_ALLOW_LAND) {
+ if (part->phystype == PART_PHYS_BOIDS && part->boids->options & BOID_ALLOW_LAND) {
col.boid = 1;
col.boid_z = pa->state.co[2];
col.skip = pa->boid->ground;
}
/* 10 iterations to catch multiple collisions */
- while(collision_count < COLLISION_MAX_COLLISIONS) {
- if(collision_detect(pa, &col, &hit, sim->colliders)) {
+ while (collision_count < COLLISION_MAX_COLLISIONS) {
+ if (collision_detect(pa, &col, &hit, sim->colliders)) {
collision_count++;
- if(collision_count == COLLISION_MAX_COLLISIONS)
+ if (collision_count == COLLISION_MAX_COLLISIONS)
collision_fail(pa, &col);
- else if(collision_response(pa, &col, &hit, part->flag & PART_DIE_ON_COL, part->flag & PART_ROT_DYN)==0)
+ else if (collision_response(pa, &col, &hit, part->flag & PART_DIE_ON_COL, part->flag & PART_ROT_DYN)==0)
return;
}
else
@@ -3426,22 +3471,22 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra)
Base *base;
int distr=0, alloc=0, skip=0;
- if((psys->part->childtype && psys->totchild != get_psys_tot_child(sim->scene, psys)) || psys->recalc&PSYS_RECALC_RESET)
+ if ((psys->part->childtype && psys->totchild != get_psys_tot_child(sim->scene, psys)) || psys->recalc&PSYS_RECALC_RESET)
alloc=1;
- if(alloc || psys->recalc&PSYS_RECALC_CHILD || (psys->vgroup[PSYS_VG_DENSITY] && (sim->ob && sim->ob->mode & OB_MODE_WEIGHT_PAINT)))
+ if (alloc || psys->recalc&PSYS_RECALC_CHILD || (psys->vgroup[PSYS_VG_DENSITY] && (sim->ob && sim->ob->mode & OB_MODE_WEIGHT_PAINT)))
distr=1;
- if(distr) {
- if(alloc)
+ if (distr) {
+ if (alloc)
realloc_particles(sim, sim->psys->totpart);
- if(get_psys_tot_child(sim->scene, psys)) {
+ if (get_psys_tot_child(sim->scene, psys)) {
/* don't generate children while computing the hair keys */
- if(!(psys->part->type == PART_HAIR) || (psys->flag & PSYS_HAIR_DONE)) {
+ if (!(psys->part->type == PART_HAIR) || (psys->flag & PSYS_HAIR_DONE)) {
distribute_particles(sim, PART_FROM_CHILD);
- if(part->childtype==PART_CHILD_FACES && part->parents != 0.0f)
+ if (part->childtype==PART_CHILD_FACES && part->parents != 0.0f)
psys_find_parents(sim);
}
}
@@ -3449,19 +3494,19 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra)
psys_free_children(psys);
}
- if((part->type==PART_HAIR || psys->flag&PSYS_KEYED || psys->pointcache->flag & PTCACHE_BAKED)==0)
+ if ((part->type==PART_HAIR || psys->flag&PSYS_KEYED || psys->pointcache->flag & PTCACHE_BAKED)==0)
skip = 1; /* only hair, keyed and baked stuff can have paths */
- else if(part->ren_as != PART_DRAW_PATH && !(part->type==PART_HAIR && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)))
+ else if (part->ren_as != PART_DRAW_PATH && !(part->type==PART_HAIR && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)))
skip = 1; /* particle visualization must be set as path */
- else if(!psys->renderdata) {
- if(part->draw_as != PART_DRAW_REND)
+ else if (!psys->renderdata) {
+ if (part->draw_as != PART_DRAW_REND)
skip = 1; /* draw visualization */
- else if(psys->pointcache->flag & PTCACHE_BAKING)
+ else if (psys->pointcache->flag & PTCACHE_BAKING)
skip = 1; /* no need to cache paths while baking dynamics */
- else if(psys_in_edit_mode(sim->scene, psys)) {
- if((pset->flag & PE_DRAW_PART)==0)
+ else if (psys_in_edit_mode(sim->scene, psys)) {
+ if ((pset->flag & PE_DRAW_PART)==0)
skip = 1;
- else if(part->childtype==0 && (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED)==0)
+ else if (part->childtype==0 && (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED)==0)
skip = 1; /* in edit mode paths are needed for child particles and dynamic hair */
}
}
@@ -3470,30 +3515,30 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra)
/* particle instance modifier with "path" option need cached paths even if particle system doesn't */
for (base = sim->scene->base.first; base; base= base->next) {
ModifierData *md = modifiers_findByType(base->object, eModifierType_ParticleInstance);
- if(md) {
+ if (md) {
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md;
- if(pimd->flag & eParticleInstanceFlag_Path && pimd->ob == sim->ob && pimd->psys == (psys - (ParticleSystem*)sim->ob->particlesystem.first)) {
+ if (pimd->flag & eParticleInstanceFlag_Path && pimd->ob == sim->ob && pimd->psys == (psys - (ParticleSystem*)sim->ob->particlesystem.first)) {
skip = 0;
break;
}
}
}
- if(!skip) {
+ if (!skip) {
psys_cache_paths(sim, cfra);
/* for render, child particle paths are computed on the fly */
- if(part->childtype) {
- if(!psys->totchild)
+ if (part->childtype) {
+ if (!psys->totchild)
skip = 1;
- else if(psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DONE)==0)
+ else if (psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DONE)==0)
skip = 1;
- if(!skip)
+ if (!skip)
psys_cache_child_paths(sim, cfra, 0);
}
}
- else if(psys->pathcache)
+ else if (psys->pathcache)
psys_free_path_cache(psys, NULL);
}
@@ -3512,7 +3557,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
float hairmat[4][4];
float (*deformedVerts)[3];
- if(!psys->clmd) {
+ if (!psys->clmd) {
psys->clmd = (ClothModifierData*)modifier_new(eModifierType_Cloth);
psys->clmd->sim_parms->goalspring = 0.0f;
psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL|CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS;
@@ -3526,12 +3571,12 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
totedge = totpoint;
totpoint += psys->totpart;
- if(dm && (totpoint != dm->getNumVerts(dm) || totedge != dm->getNumEdges(dm))) {
+ if (dm && (totpoint != dm->getNumVerts(dm) || totedge != dm->getNumEdges(dm))) {
dm->release(dm);
dm = psys->hair_in_dm = NULL;
}
- if(!dm) {
+ if (!dm) {
dm = psys->hair_in_dm = CDDM_new(totpoint, totedge, 0, 0, 0);
DM_add_vert_layer(dm, CD_MDEFORMVERT, CD_CALLOC, NULL);
}
@@ -3545,15 +3590,15 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
/* make vgroup for pin roots etc.. */
psys->particles->hair_index = 1;
LOOP_PARTICLES {
- if(p)
+ if (p)
pa->hair_index = (pa-1)->hair_index + (pa-1)->totkey + 1;
psys_mat_hair_to_object(sim->ob, sim->psmd->dm, psys->part->from, pa, hairmat);
- for(k=0, key=pa->hair; k<pa->totkey; k++,key++) {
+ for (k=0, key=pa->hair; k<pa->totkey; k++,key++) {
/* create fake root before actual root to resist bending */
- if(k==0) {
+ if (k==0) {
float temp[3];
sub_v3_v3v3(temp, key->co, (key+1)->co);
copy_v3_v3(mvert->co, key->co);
@@ -3565,8 +3610,8 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
medge->v2 = pa->hair_index;
medge++;
- if(dvert) {
- if(!dvert->totweight) {
+ if (dvert) {
+ if (!dvert->totweight) {
dvert->dw = MEM_callocN(sizeof(MDeformWeight), "deformWeight");
dvert->totweight = 1;
}
@@ -3580,14 +3625,14 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
mul_m4_v3(hairmat, mvert->co);
mvert++;
- if(k) {
+ if (k) {
medge->v1 = pa->hair_index + k - 1;
medge->v2 = pa->hair_index + k;
medge++;
}
- if(dvert) {
- if(!dvert->totweight) {
+ if (dvert) {
+ if (!dvert->totweight) {
dvert->dw = MEM_callocN(sizeof(MDeformWeight), "deformWeight");
dvert->totweight = 1;
}
@@ -3598,7 +3643,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
}
}
- if(psys->hair_out_dm)
+ if (psys->hair_out_dm)
psys->hair_out_dm->release(psys->hair_out_dm);
psys->clmd->point_cache = psys->pointcache;
@@ -3625,25 +3670,25 @@ static void hair_step(ParticleSimulationData *sim, float cfra)
LOOP_PARTICLES {
pa->size = part->size;
- if(part->randsize > 0.0f)
+ if (part->randsize > 0.0f)
pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
- if(PSYS_FRAND(p) > disp)
+ if (PSYS_FRAND(p) > disp)
pa->flag |= PARS_NO_DISP;
else
pa->flag &= ~PARS_NO_DISP;
}
- if(psys->recalc & PSYS_RECALC_RESET) {
+ if (psys->recalc & PSYS_RECALC_RESET) {
/* need this for changing subsurf levels */
psys_calc_dmcache(sim->ob, sim->psmd->dm, psys);
- if(psys->clmd)
+ if (psys->clmd)
cloth_free_modifier(psys->clmd);
}
/* dynamics with cloth simulation, psys->particles can be NULL with 0 particles [#25519] */
- if(psys->part->type==PART_HAIR && psys->flag & PSYS_HAIR_DYNAMICS && psys->particles)
+ if (psys->part->type==PART_HAIR && psys->flag & PSYS_HAIR_DYNAMICS && psys->particles)
do_hair_dynamics(sim);
/* following lines were removed r29079 but cause bug [#22811], see report for details */
@@ -3664,12 +3709,12 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
psys->lattice= psys_get_lattice(sim);
- if(psys->totpart==0) return;
+ if (psys->totpart==0) return;
/* save new keys for elements if needed */
LOOP_PARTICLES {
/* first time alloc */
- if(pa->totkey==0 || pa->hair==NULL) {
+ if (pa->totkey==0 || pa->hair==NULL) {
pa->hair = MEM_callocN((psys->part->hair_step + 1) * sizeof(HairKey), "HairKeys");
pa->totkey = 0;
}
@@ -3681,7 +3726,7 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
copy_v3_v3(key->co, pa->state.co);
mul_m4_v3(ob->imat, key->co);
- if(pa->totkey) {
+ if (pa->totkey) {
sub_v3_v3(key->co, root->co);
psys_vec_rot_to_face(sim->psmd->dm, pa, key->co);
}
@@ -3693,7 +3738,7 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
pa->totkey++;
/* root is always in the origin of hair space so we set it to be so after the last key is saved*/
- if(pa->totkey == psys->part->hair_step + 1)
+ if (pa->totkey == psys->part->hair_step + 1)
root->co[0] = root->co[1] = root->co[2] = 0.0f;
}
}
@@ -3762,11 +3807,11 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
timestep = psys_get_timestep(sim);
dtime= dfra*timestep;
- if(dfra < 0.0f) {
+ if (dfra < 0.0f) {
LOOP_EXISTING_PARTICLES {
psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra);
pa->size = part->size*ptex.size;
- if(part->randsize > 0.0f)
+ if (part->randsize > 0.0f)
pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
reset_particle(sim, pa, dtime, cfra);
@@ -3778,7 +3823,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
psys_update_effectors(sim);
- if(part->type != PART_HAIR)
+ if (part->type != PART_HAIR)
sim->colliders = get_collider_cache(sim->scene, sim->ob, NULL);
/* initialize physics type specific stuff */
@@ -3796,8 +3841,8 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
boids_precalc_rules(part, cfra);
- for(; pt; pt=pt->next) {
- if(pt->ob)
+ for (; pt; pt=pt->next) {
+ if (pt->ob)
psys_update_particle_tree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra);
}
break;
@@ -3807,8 +3852,8 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
ParticleTarget *pt = psys->targets.first;
psys_update_particle_bvhtree(psys, cfra);
- for(; pt; pt=pt->next) { /* Updating others systems particle tree for fluid-fluid interaction */
- if(pt->ob)
+ for (; pt; pt=pt->next) { /* Updating others systems particle tree for fluid-fluid interaction */
+ if (pt->ob)
psys_update_particle_bvhtree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra);
}
break;
@@ -3821,7 +3866,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra);
pa->size = part->size*ptex.size;
- if(part->randsize > 0.0f)
+ if (part->randsize > 0.0f)
pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
birthtime = pa->time;
@@ -3830,29 +3875,29 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
/* store this, so we can do multiple loops over particles */
pa->state.time = dfra;
- if(dietime <= cfra && psys->cfra < dietime) {
+ if (dietime <= cfra && psys->cfra < dietime) {
/* particle dies some time between this and last step */
pa->state.time = dietime - ((birthtime > psys->cfra) ? birthtime : psys->cfra);
pa->alive = PARS_DYING;
}
- else if(birthtime <= cfra && birthtime >= psys->cfra) {
+ else if (birthtime <= cfra && birthtime >= psys->cfra) {
/* particle is born some time between this and last step*/
reset_particle(sim, pa, dfra*timestep, cfra);
pa->alive = PARS_ALIVE;
pa->state.time = cfra - birthtime;
}
- else if(dietime < cfra) {
+ else if (dietime < cfra) {
/* nothing to be done when particle is dead */
}
/* only reset unborn particles if they're shown or if the particle is born soon*/
- if(pa->alive==PARS_UNBORN
+ if (pa->alive==PARS_UNBORN
&& (part->flag & PART_UNBORN || cfra + psys->pointcache->step > pa->time))
reset_particle(sim, pa, dtime, cfra);
- else if(part->phystype == PART_PHYS_NO)
+ else if (part->phystype == PART_PHYS_NO)
reset_particle(sim, pa, dtime, cfra);
- if(ELEM(pa->alive, PARS_ALIVE, PARS_DYING)==0 || (pa->flag & (PARS_UNEXIST|PARS_NO_DISP)))
+ if (ELEM(pa->alive, PARS_ALIVE, PARS_DYING)==0 || (pa->flag & (PARS_UNEXIST|PARS_NO_DISP)))
pa->state.time = -1.f;
}
@@ -3864,7 +3909,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
basic_integrate(sim, p, pa->state.time, cfra);
/* deflection */
- if(sim->colliders)
+ if (sim->colliders)
collision_check(sim, p, pa->state.time, cfra);
/* rotations */
@@ -3879,11 +3924,11 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
boid_brain(&bbd, p, pa);
- if(pa->alive != PARS_DYING) {
+ if (pa->alive != PARS_DYING) {
boid_body(&bbd, pa);
/* deflection */
- if(sim->colliders)
+ if (sim->colliders)
collision_check(sim, p, pa->state.time, cfra);
}
}
@@ -3902,7 +3947,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
/* actual fluids calculations */
sph_integrate(sim, pa, pa->state.time, &sphdata);
- if(sim->colliders)
+ if (sim->colliders)
collision_check(sim, p, pa->state.time, cfra);
/* SPH particles are not physical particles, just interpolation
@@ -3923,7 +3968,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
/* finalize particle state and time after dynamics */
LOOP_DYNAMIC_PARTICLES {
- if(pa->alive == PARS_DYING) {
+ if (pa->alive == PARS_DYING) {
pa->alive=PARS_DEAD;
pa->state.time=pa->dietime;
}
@@ -3935,11 +3980,11 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
}
static void update_children(ParticleSimulationData *sim)
{
- if((sim->psys->part->type == PART_HAIR) && (sim->psys->flag & PSYS_HAIR_DONE)==0)
+ if ((sim->psys->part->type == PART_HAIR) && (sim->psys->flag & PSYS_HAIR_DONE)==0)
/* don't generate children while growing hair - waste of time */
psys_free_children(sim->psys);
- else if(sim->psys->part->childtype) {
- if(sim->psys->totchild != get_psys_tot_child(sim->scene, sim->psys))
+ else if (sim->psys->part->childtype) {
+ if (sim->psys->totchild != get_psys_tot_child(sim->scene, sim->psys))
distribute_particles(sim, PART_FROM_CHILD);
else {
/* Children are up to date, nothing to do. */
@@ -3964,7 +4009,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
LOOP_PARTICLES {
psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra);
pa->size = part->size*ptex.size;
- if(part->randsize > 0.0f)
+ if (part->randsize > 0.0f)
pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
psys->lattice= psys_get_lattice(sim);
@@ -3972,22 +4017,22 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
dietime = pa->dietime;
/* update alive status and push events */
- if(pa->time > cfra) {
+ if (pa->time > cfra) {
pa->alive = PARS_UNBORN;
- if(part->flag & PART_UNBORN && (psys->pointcache->flag & PTCACHE_EXTERNAL) == 0)
+ if (part->flag & PART_UNBORN && (psys->pointcache->flag & PTCACHE_EXTERNAL) == 0)
reset_particle(sim, pa, 0.0f, cfra);
}
- else if(dietime <= cfra)
+ else if (dietime <= cfra)
pa->alive = PARS_DEAD;
else
pa->alive = PARS_ALIVE;
- if(psys->lattice) {
+ if (psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
- if(PSYS_FRAND(p) > disp)
+ if (PSYS_FRAND(p) > disp)
pa->flag |= PARS_NO_DISP;
else
pa->flag &= ~PARS_NO_DISP;
@@ -3997,7 +4042,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
{
ParticleSystem *psys = sim->psys;
- if(psys->particles) {
+ if (psys->particles) {
MEM_freeN(psys->particles);
psys->particles = 0;
psys->totpart = 0;
@@ -4008,7 +4053,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
{
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(sim->ob, eModifierType_Fluidsim);
- if( fluidmd && fluidmd->fss) {
+ if ( fluidmd && fluidmd->fss) {
FluidsimSettings *fss= fluidmd->fss;
ParticleSettings *part = psys->part;
ParticleData *pa=NULL;
@@ -4019,7 +4064,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
int readMask, activeParts = 0, fileParts = 0;
gzFile gzf;
-// XXX if(ob==G.obedit) // off...
+// XXX if (ob==G.obedit) // off...
// return;
// ok, start loading
@@ -4029,7 +4074,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
- gzf = gzopen(filename, "rb");
+ gzf = BLI_gzopen(filename, "rb");
if (!gzf) {
BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"readFsPartData::error - Unable to open file for reading '%s' \n", filename);
// XXX bad level call elbeemDebugOut(debugStrBuffer);
@@ -4049,24 +4094,24 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
// set up reading mask
readMask = fss->typeFlags;
- for(p=0, pa=psys->particles; p<totpart; p++, pa++) {
+ for (p=0, pa=psys->particles; p<totpart; p++, pa++) {
int ptype=0;
gzread(gzf, &ptype, sizeof( ptype ));
- if(ptype&readMask) {
+ if (ptype&readMask) {
activeParts++;
gzread(gzf, &(pa->size), sizeof( float ));
pa->size /= 10.0f;
- for(j=0; j<3; j++) {
+ for (j=0; j<3; j++) {
float wrf;
gzread(gzf, &wrf, sizeof( wrf ));
pa->state.co[j] = wrf;
//fprintf(stderr,"Rj%d ",j);
}
- for(j=0; j<3; j++) {
+ for (j=0; j<3; j++) {
float wrf;
gzread(gzf, &wrf, sizeof( wrf ));
pa->state.vel[j] = wrf;
@@ -4081,15 +4126,16 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
pa->lifetime = sim->scene->r.efra;
pa->alive = PARS_ALIVE;
//if(a<25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f \n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
- } else {
+ }
+ else {
// skip...
- for(j=0; j<2*3+1; j++) {
+ for (j=0; j<2*3+1; j++) {
float wrf; gzread(gzf, &wrf, sizeof( wrf ));
}
}
fileParts++;
}
- gzclose( gzf );
+ gzclose(gzf);
totpart = psys->totpart = activeParts;
BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d \n", psys->totpart,activeParts,fileParts,readMask);
@@ -4107,7 +4153,7 @@ static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNU
int oldtotpart = psys->totpart;
int totpart = tot_particles(psys, pid);
- if(totpart != oldtotpart)
+ if (totpart != oldtotpart)
realloc_particles(sim, totpart);
return totpart - oldtotpart;
@@ -4130,11 +4176,11 @@ static void system_step(ParticleSimulationData *sim, float cfra)
int startframe = 0, endframe = 100, oldtotpart = 0;
/* cache shouldn't be used for hair or "continue physics" */
- if(part->type != PART_HAIR && BKE_ptcache_get_continue_physics() == 0) {
+ if (part->type != PART_HAIR && BKE_ptcache_get_continue_physics() == 0) {
psys_clear_temp_pointcache(psys);
/* set suitable cache range automatically */
- if((cache->flag & (PTCACHE_BAKING|PTCACHE_BAKED))==0)
+ if ((cache->flag & (PTCACHE_BAKING|PTCACHE_BAKED))==0)
psys_get_pointcache_start_end(sim->scene, psys, &cache->startframe, &cache->endframe);
pid = &ptcacheid;
@@ -4143,7 +4189,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
BKE_ptcache_id_time(pid, sim->scene, 0.0f, &startframe, &endframe, NULL);
/* clear everythin on start frame */
- if(cfra == startframe) {
+ if (cfra == startframe) {
BKE_ptcache_id_reset(sim->scene, pid, PTCACHE_RESET_OUTDATED);
BKE_ptcache_validate(cache, startframe);
cache->flag &= ~PTCACHE_REDO_NEEDED;
@@ -4154,7 +4200,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
/* 1. emit particles and redo particles if needed */
oldtotpart = psys->totpart;
- if(emit_particles(sim, pid, cfra) || psys->recalc & PSYS_RECALC_RESET) {
+ if (emit_particles(sim, pid, cfra) || psys->recalc & PSYS_RECALC_RESET) {
distribute_particles(sim, part->from);
initialize_all_particles(sim);
/* reset only just created particles (on startframe all particles are recreated) */
@@ -4174,33 +4220,33 @@ static void system_step(ParticleSimulationData *sim, float cfra)
}
/* 2. try to read from the cache */
- if(pid) {
+ if (pid) {
int cache_result = BKE_ptcache_read(pid, cache_cfra);
- if(ELEM(cache_result, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED)) {
+ if (ELEM(cache_result, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED)) {
cached_step(sim, cfra);
update_children(sim);
psys_update_path_cache(sim, cfra);
BKE_ptcache_validate(cache, (int)cache_cfra);
- if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
+ if (cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
BKE_ptcache_write(pid, (int)cache_cfra);
return;
}
/* Cache is supposed to be baked, but no data was found so bail out */
- else if(cache->flag & PTCACHE_BAKED) {
+ else if (cache->flag & PTCACHE_BAKED) {
psys_reset(psys, PSYS_RESET_CACHE_MISS);
return;
}
- else if(cache_result == PTCACHE_READ_OLD) {
+ else if (cache_result == PTCACHE_READ_OLD) {
psys->cfra = (float)cache->simframe;
cached_step(sim, psys->cfra);
}
/* if on second frame, write cache for first frame */
- if(psys->cfra == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
+ if (psys->cfra == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
BKE_ptcache_write(pid, startframe);
}
else
@@ -4211,33 +4257,35 @@ static void system_step(ParticleSimulationData *sim, float cfra)
disp= (float)psys_get_current_display_percentage(psys)/100.0f;
LOOP_PARTICLES {
- if(PSYS_FRAND(p) > disp)
+ if (PSYS_FRAND(p) > disp)
pa->flag |= PARS_NO_DISP;
else
pa->flag &= ~PARS_NO_DISP;
}
- if(psys->totpart) {
+ if (psys->totpart) {
int dframe, totframesback = 0;
float t_frac, dt_frac;
/* handle negative frame start at the first frame by doing
* all the steps before the first frame */
- if((int)cfra == startframe && part->sta < startframe)
+ if ((int)cfra == startframe && part->sta < startframe)
totframesback = (startframe - (int)part->sta);
if (!(part->time_flag & PART_TIME_AUTOSF)) {
/* Constant time step */
psys->dt_frac = 1.0f / (float) (part->subframes + 1);
- } else if ((int)cfra == startframe) {
+ }
+ else if ((int)cfra == startframe) {
/* Variable time step; use a very conservative value at the start.
* If it doesn't need to be so small, it will quickly grow. */
psys->dt_frac = 1.0;
- } else if (psys->dt_frac < MIN_TIMESTEP) {
+ }
+ else if (psys->dt_frac < MIN_TIMESTEP) {
psys->dt_frac = MIN_TIMESTEP;
}
- for(dframe=-totframesback; dframe<=0; dframe++) {
+ for (dframe=-totframesback; dframe<=0; dframe++) {
/* simulate each subframe */
dt_frac = psys->dt_frac;
for (t_frac = dt_frac; t_frac <= 1.0f; t_frac += dt_frac) {
@@ -4254,16 +4302,16 @@ static void system_step(ParticleSimulationData *sim, float cfra)
}
/* 4. only write cache starting from second frame */
- if(pid) {
+ if (pid) {
BKE_ptcache_validate(cache, (int)cache_cfra);
- if((int)cache_cfra != startframe)
+ if ((int)cache_cfra != startframe)
BKE_ptcache_write(pid, (int)cache_cfra);
}
update_children(sim);
/* cleanup */
- if(psys->lattice) {
+ if (psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
@@ -4277,17 +4325,17 @@ static void psys_changed_type(ParticleSimulationData *sim)
BKE_ptcache_id_from_particles(&pid, sim->ob, sim->psys);
- if(part->phystype != PART_PHYS_KEYED)
+ if (part->phystype != PART_PHYS_KEYED)
sim->psys->flag &= ~PSYS_KEYED;
- if(part->type == PART_HAIR) {
- if(ELEM4(part->ren_as, PART_DRAW_NOT, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)==0)
+ if (part->type == PART_HAIR) {
+ if (ELEM4(part->ren_as, PART_DRAW_NOT, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)==0)
part->ren_as = PART_DRAW_PATH;
- if(part->distr == PART_DISTR_GRID)
+ if (part->distr == PART_DISTR_GRID)
part->distr = PART_DISTR_JIT;
- if(ELEM3(part->draw_as, PART_DRAW_NOT, PART_DRAW_REND, PART_DRAW_PATH)==0)
+ if (ELEM3(part->draw_as, PART_DRAW_NOT, PART_DRAW_REND, PART_DRAW_PATH)==0)
part->draw_as = PART_DRAW_REND;
CLAMP(part->path_start, 0.0f, 100.0f);
@@ -4311,18 +4359,18 @@ void psys_check_boid_data(ParticleSystem *psys)
pa = psys->particles;
- if(!pa)
+ if (!pa)
return;
- if(psys->part && psys->part->phystype==PART_PHYS_BOIDS) {
- if(!pa->boid) {
+ if (psys->part && psys->part->phystype==PART_PHYS_BOIDS) {
+ if (!pa->boid) {
bpa = MEM_callocN(psys->totpart * sizeof(BoidParticle), "Boid Data");
LOOP_PARTICLES
pa->boid = bpa++;
}
}
- else if(pa->boid) {
+ else if (pa->boid) {
MEM_freeN(pa->boid);
LOOP_PARTICLES
pa->boid = NULL;
@@ -4351,7 +4399,7 @@ static void psys_prepare_physics(ParticleSimulationData *sim)
{
ParticleSettings *part = sim->psys->part;
- if(ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) {
+ if (ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) {
PTCacheID pid;
BKE_ptcache_id_from_particles(&pid, sim->ob, sim->psys);
BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0);
@@ -4361,7 +4409,7 @@ static void psys_prepare_physics(ParticleSimulationData *sim)
sim->psys->flag &= ~PSYS_KEYED;
}
- if(part->phystype == PART_PHYS_BOIDS && part->boids == NULL) {
+ if (part->phystype == PART_PHYS_BOIDS && part->boids == NULL) {
BoidState *state;
part->boids = MEM_callocN(sizeof(BoidSettings), "Boid Settings");
@@ -4376,7 +4424,7 @@ static void psys_prepare_physics(ParticleSimulationData *sim)
state->flag |= BOIDSTATE_CURRENT;
BLI_addtail(&part->boids->states, state);
}
- else if(part->phystype == PART_PHYS_FLUID && part->fluid == NULL) {
+ else if (part->phystype == PART_PHYS_FLUID && part->fluid == NULL) {
part->fluid = MEM_callocN(sizeof(SPHFluidSettings), "SPH Fluid Settings");
fluid_default_settings(part);
}
@@ -4385,7 +4433,7 @@ static void psys_prepare_physics(ParticleSimulationData *sim)
}
static int hair_needs_recalc(ParticleSystem *psys)
{
- if(!(psys->flag & PSYS_EDITED) && (!psys->edit || !psys->edit->edited) &&
+ if (!(psys->flag & PSYS_EDITED) && (!psys->edit || !psys->edit->edited) &&
((psys->flag & PSYS_HAIR_DONE)==0 || psys->recalc & PSYS_RECALC_RESET || (psys->part->flag & PART_HAIR_REGROW && !psys->edit))) {
return 1;
}
@@ -4402,9 +4450,9 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
float cfra;
/* drawdata is outdated after ANY change */
- if(psys->pdd) psys->pdd->flag &= ~PARTICLE_DRAW_DATA_UPDATED;
+ if (psys->pdd) psys->pdd->flag &= ~PARTICLE_DRAW_DATA_UPDATED;
- if(!psys_check_enabled(ob, psys))
+ if (!psys_check_enabled(ob, psys))
return;
cfra= BKE_curframe(scene);
@@ -4415,14 +4463,14 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
sim.psmd= psys_get_modifier(ob, psys);
/* system was already updated from modifier stack */
- if(sim.psmd->flag & eParticleSystemFlag_psys_updated) {
+ if (sim.psmd->flag & eParticleSystemFlag_psys_updated) {
sim.psmd->flag &= ~eParticleSystemFlag_psys_updated;
/* make sure it really was updated to cfra */
- if(psys->cfra == cfra)
+ if (psys->cfra == cfra)
return;
}
- if(!sim.psmd->dm)
+ if (!sim.psmd->dm)
return;
if (part->from != PART_FROM_VERT) {
@@ -4432,10 +4480,13 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
/* execute drivers only, as animation has already been done */
BKE_animsys_evaluate_animdata(scene, &part->id, part->adt, cfra, ADT_RECALC_DRIVERS);
- if(psys->recalc & PSYS_RECALC_TYPE)
+ /* to verify if we need to restore object afterwards */
+ psys->flag &= ~PSYS_OB_ANIM_RESTORE;
+
+ if (psys->recalc & PSYS_RECALC_TYPE)
psys_changed_type(&sim);
- if(psys->recalc & PSYS_RECALC_RESET)
+ if (psys->recalc & PSYS_RECALC_RESET)
psys->totunexist = 0;
/* setup necessary physics type dependent additional data if it doesn't yet exist */
@@ -4445,19 +4496,19 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
case PART_HAIR:
{
/* nothing to do so bail out early */
- if(psys->totpart == 0 && part->totpart == 0) {
+ if (psys->totpart == 0 && part->totpart == 0) {
psys_free_path_cache(psys, NULL);
free_hair(ob, psys, 0);
psys->flag |= PSYS_HAIR_DONE;
}
/* (re-)create hair */
- else if(hair_needs_recalc(psys)) {
+ else if (hair_needs_recalc(psys)) {
float hcfra=0.0f;
int i, recalc = psys->recalc;
free_hair(ob, psys, 0);
- if(psys->edit && psys->free_edit) {
+ if (psys->edit && psys->free_edit) {
psys->free_edit(psys->edit);
psys->edit = NULL;
psys->free_edit = NULL;
@@ -4466,9 +4517,9 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
/* first step is negative so particles get killed and reset */
psys->cfra= 1.0f;
- for(i=0; i<=part->hair_step; i++) {
+ for (i=0; i<=part->hair_step; i++) {
hcfra=100.0f*(float)i/(float)psys->part->hair_step;
- if((part->flag & PART_HAIR_REGROW)==0)
+ if ((part->flag & PART_HAIR_REGROW)==0)
BKE_animsys_evaluate_animdata(scene, &part->id, part->adt, hcfra, ADT_RECALC_ANIM);
system_step(&sim, hcfra);
psys->cfra = hcfra;
@@ -4479,10 +4530,10 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
psys->flag |= PSYS_HAIR_DONE;
psys->recalc = recalc;
}
- else if(psys->flag & PSYS_EDITED)
+ else if (psys->flag & PSYS_EDITED)
psys->flag |= PSYS_HAIR_DONE;
- if(psys->flag & PSYS_HAIR_DONE)
+ if (psys->flag & PSYS_HAIR_DONE)
hair_step(&sim, cfra);
break;
}
@@ -4501,10 +4552,10 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
float disp = (float)psys_get_current_display_percentage(psys)/100.0f;
/* Particles without dynamics haven't been reset yet because they don't use pointcache */
- if(psys->recalc & PSYS_RECALC_RESET)
+ if (psys->recalc & PSYS_RECALC_RESET)
psys_reset(psys, PSYS_RESET_ALL);
- if(emit_particles(&sim, NULL, cfra) || (psys->recalc & PSYS_RECALC_RESET)) {
+ if (emit_particles(&sim, NULL, cfra) || (psys->recalc & PSYS_RECALC_RESET)) {
free_keyed_keys(psys);
distribute_particles(&sim, part->from);
initialize_all_particles(&sim);
@@ -4515,18 +4566,18 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
LOOP_EXISTING_PARTICLES {
pa->size = part->size;
- if(part->randsize > 0.0f)
+ if (part->randsize > 0.0f)
pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
reset_particle(&sim, pa, 0.0, cfra);
- if(PSYS_FRAND(p) > disp)
+ if (PSYS_FRAND(p) > disp)
pa->flag |= PARS_NO_DISP;
else
pa->flag &= ~PARS_NO_DISP;
}
- if(part->phystype == PART_PHYS_KEYED) {
+ if (part->phystype == PART_PHYS_KEYED) {
psys_count_keyed_targets(&sim);
set_keyed_keys(&sim);
psys_update_path_cache(&sim,(int)cfra);
@@ -4544,21 +4595,23 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
}
}
- if(psys->cfra < cfra) {
- /* make sure emitter is left at correct time (particle emission can change this) */
- while(ob) {
+ /* make sure emitter is left at correct time (particle emission can change this) */
+ if (psys->flag & PSYS_OB_ANIM_RESTORE) {
+ while (ob) {
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, cfra, ADT_RECALC_ANIM);
ob = ob->parent;
}
ob = sim.ob;
where_is_object_time(scene, ob, cfra);
+
+ psys->flag &= ~PSYS_OB_ANIM_RESTORE;
}
psys->cfra = cfra;
psys->recalc = 0;
/* save matrix for duplicators, at rendertime the actual dupliobject's matrix is used so don't update! */
- if(psys->renderdata==0)
+ if (psys->renderdata==0)
invert_m4_m4(psys->imat, ob->obmat);
}
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index fab3f096d3e..63135ea8641 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -97,8 +97,8 @@
#include "BLI_winstuff.h"
#endif
-#define PTCACHE_DATA_FROM(data, type, from) if(data[type]) { memcpy(data[type], from, ptcache_data_size[type]); }
-#define PTCACHE_DATA_TO(data, type, index, to) if(data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); }
+#define PTCACHE_DATA_FROM(data, type, from) if (data[type]) { memcpy(data[type], from, ptcache_data_size[type]); }
+#define PTCACHE_DATA_TO(data, type, index, to) if (data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); }
/* could be made into a pointcache option */
#define DURIAN_POINTCACHE_LIB_OK 1
@@ -131,10 +131,10 @@ static int ptcache_basic_header_read(PTCacheFile *pf)
int error=0;
/* Custom functions should read these basic elements too! */
- if(!error && !fread(&pf->totpoint, sizeof(unsigned int), 1, pf->fp))
+ if (!error && !fread(&pf->totpoint, sizeof(unsigned int), 1, pf->fp))
error = 1;
- if(!error && !fread(&pf->data_types, sizeof(unsigned int), 1, pf->fp))
+ if (!error && !fread(&pf->data_types, sizeof(unsigned int), 1, pf->fp))
error = 1;
return !error;
@@ -142,10 +142,10 @@ static int ptcache_basic_header_read(PTCacheFile *pf)
static int ptcache_basic_header_write(PTCacheFile *pf)
{
/* Custom functions should write these basic elements too! */
- if(!fwrite(&pf->totpoint, sizeof(unsigned int), 1, pf->fp))
+ if (!fwrite(&pf->totpoint, sizeof(unsigned int), 1, pf->fp))
return 0;
- if(!fwrite(&pf->data_types, sizeof(unsigned int), 1, pf->fp))
+ if (!fwrite(&pf->data_types, sizeof(unsigned int), 1, pf->fp))
return 0;
return 1;
@@ -166,7 +166,7 @@ static void ptcache_softbody_read(int index, void *soft_v, void **data, float UN
SoftBody *soft= soft_v;
BodyPoint *bp = soft->bpoint + index;
- if(old_data) {
+ if (old_data) {
memcpy(bp->pos, data, 3 * sizeof(float));
memcpy(bp->vec, data + 3, 3 * sizeof(float));
}
@@ -182,13 +182,13 @@ static void ptcache_softbody_interpolate(int index, void *soft_v, void **data, f
ParticleKey keys[4];
float dfra;
- if(cfra1 == cfra2)
+ if (cfra1 == cfra2)
return;
copy_v3_v3(keys[1].co, bp->pos);
copy_v3_v3(keys[1].vel, bp->vec);
- if(old_data) {
+ if (old_data) {
memcpy(keys[2].co, old_data, 3 * sizeof(float));
memcpy(keys[2].vel, old_data + 3, 3 * sizeof(float));
}
@@ -219,7 +219,7 @@ void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, flo
PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, index, key->vel);
/* no rotation info, so make something nice up */
- if(data[BPHYS_DATA_ROTATION]==NULL) {
+ if (data[BPHYS_DATA_ROTATION]==NULL) {
vec_to_quat( key->rot, key->vel, OB_NEGX, OB_POSZ);
}
else {
@@ -238,7 +238,7 @@ static int ptcache_particle_write(int index, void *psys_v, void **data, int cfr
int step = psys->pointcache->step;
/* No need to store unborn or died particles outside cache step bounds */
- if(data[BPHYS_DATA_INDEX] && (cfra < pa->time - step || cfra > pa->dietime + step))
+ if (data[BPHYS_DATA_INDEX] && (cfra < pa->time - step || cfra > pa->dietime + step))
return 0;
times[0]= pa->time;
@@ -253,7 +253,7 @@ static int ptcache_particle_write(int index, void *psys_v, void **data, int cfr
PTCACHE_DATA_FROM(data, BPHYS_DATA_SIZE, &pa->size);
PTCACHE_DATA_FROM(data, BPHYS_DATA_TIMES, times);
- if(boid)
+ if (boid)
PTCACHE_DATA_FROM(data, BPHYS_DATA_BOIDS, &boid->data);
/* return flag 1+1=2 for newly born particles to copy exact birth location to previously cached frame */
@@ -266,16 +266,16 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
BoidParticle *boid;
float timestep = 0.04f*psys->part->timetweak;
- if(index >= psys->totpart)
+ if (index >= psys->totpart)
return;
pa = psys->particles + index;
boid = (psys->part->phystype == PART_PHYS_BOIDS) ? pa->boid : NULL;
- if(cfra > pa->state.time)
+ if (cfra > pa->state.time)
memcpy(&pa->prev_state, &pa->state, sizeof(ParticleKey));
- if(old_data) {
+ if (old_data) {
/* old format cache */
memcpy(&pa->state, old_data, sizeof(ParticleKey));
return;
@@ -284,15 +284,15 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
BKE_ptcache_make_particle_key(&pa->state, 0, data, cfra);
/* set frames cached before birth to birth time */
- if(cfra < pa->time)
+ if (cfra < pa->time)
pa->state.time = pa->time;
- else if(cfra > pa->dietime)
+ else if (cfra > pa->dietime)
pa->state.time = pa->dietime;
- if(data[BPHYS_DATA_SIZE])
+ if (data[BPHYS_DATA_SIZE])
PTCACHE_DATA_TO(data, BPHYS_DATA_SIZE, 0, &pa->size);
- if(data[BPHYS_DATA_TIMES]) {
+ if (data[BPHYS_DATA_TIMES]) {
float times[3];
PTCACHE_DATA_TO(data, BPHYS_DATA_TIMES, 0, &times);
pa->time = times[0];
@@ -300,12 +300,12 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
pa->lifetime = times[2];
}
- if(boid)
+ if (boid)
PTCACHE_DATA_TO(data, BPHYS_DATA_BOIDS, 0, &boid->data);
/* determine velocity from previous location */
- if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) {
- if(cfra > pa->prev_state.time) {
+ if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) {
+ if (cfra > pa->prev_state.time) {
sub_v3_v3v3(pa->state.vel, pa->state.co, pa->prev_state.co);
mul_v3_fl(pa->state.vel, (cfra - pa->prev_state.time) * timestep);
}
@@ -315,9 +315,10 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
}
}
- /* determine rotation from velocity */
- if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
- vec_to_quat( pa->state.rot,pa->state.vel, OB_NEGX, OB_POSZ);
+ /* default to no rotation */
+ if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
+ pa->state.rot[0]=1.0f;
+ pa->state.rot[1]=pa->state.rot[2]=pa->state.rot[3]=0;
}
}
static void ptcache_particle_interpolate(int index, void *psys_v, void **data, float cfra, float cfra1, float cfra2, float *old_data)
@@ -327,31 +328,31 @@ static void ptcache_particle_interpolate(int index, void *psys_v, void **data, f
ParticleKey keys[4];
float dfra, timestep = 0.04f*psys->part->timetweak;
- if(index >= psys->totpart)
+ if (index >= psys->totpart)
return;
pa = psys->particles + index;
/* particle wasn't read from first cache so can't interpolate */
- if((int)cfra1 < pa->time - psys->pointcache->step || (int)cfra1 > pa->dietime + psys->pointcache->step)
+ if ((int)cfra1 < pa->time - psys->pointcache->step || (int)cfra1 > pa->dietime + psys->pointcache->step)
return;
cfra = MIN2(cfra, pa->dietime);
cfra1 = MIN2(cfra1, pa->dietime);
cfra2 = MIN2(cfra2, pa->dietime);
- if(cfra1 == cfra2)
+ if (cfra1 == cfra2)
return;
memcpy(keys+1, &pa->state, sizeof(ParticleKey));
- if(old_data)
+ if (old_data)
memcpy(keys+2, old_data, sizeof(ParticleKey));
else
BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2);
/* determine velocity from previous location */
- if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) {
- if(keys[1].time > keys[2].time) {
+ if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) {
+ if (keys[1].time > keys[2].time) {
sub_v3_v3v3(keys[2].vel, keys[1].co, keys[2].co);
mul_v3_fl(keys[2].vel, (keys[1].time - keys[2].time) * timestep);
}
@@ -362,11 +363,11 @@ static void ptcache_particle_interpolate(int index, void *psys_v, void **data, f
}
/* determine rotation from velocity */
- if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
+ if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
vec_to_quat( keys[2].rot,keys[2].vel, OB_NEGX, OB_POSZ);
}
- if(cfra > pa->time)
+ if (cfra > pa->time)
cfra1 = MAX2(cfra1, pa->time);
dfra = cfra2 - cfra1;
@@ -394,10 +395,10 @@ static int ptcache_particle_totwrite(void *psys_v, int cfra)
int p, step = psys->pointcache->step;
int totwrite = 0;
- if(cfra == 0)
+ if (cfra == 0)
return psys->totpart;
- for(p=0; p<psys->totpart; p++,pa++)
+ for (p=0; p<psys->totpart; p++,pa++)
totwrite += (cfra >= pa->time - step && cfra <= pa->dietime + step);
return totwrite;
@@ -408,7 +409,7 @@ static void ptcache_particle_extra_write(void *psys_v, PTCacheMem *pm, int UNUSE
ParticleSystem *psys = psys_v;
PTCacheExtra *extra = NULL;
- if(psys->part->phystype == PART_PHYS_FLUID &&
+ if (psys->part->phystype == PART_PHYS_FLUID &&
psys->part->fluid && psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS &&
psys->tot_fluidsprings && psys->fluid_springs) {
@@ -429,11 +430,11 @@ static void ptcache_particle_extra_read(void *psys_v, PTCacheMem *pm, float UNUS
ParticleSystem *psys = psys_v;
PTCacheExtra *extra = pm->extradata.first;
- for(; extra; extra=extra->next) {
+ for (; extra; extra=extra->next) {
switch(extra->type) {
case BPHYS_EXTRA_FLUID_SPRINGS:
{
- if(psys->fluid_springs)
+ if (psys->fluid_springs)
MEM_freeN(psys->fluid_springs);
psys->fluid_springs = MEM_dupallocN(extra->data);
@@ -463,7 +464,7 @@ static void ptcache_cloth_read(int index, void *cloth_v, void **data, float UNUS
Cloth *cloth= clmd->clothObject;
ClothVertex *vert = cloth->verts + index;
- if(old_data) {
+ if (old_data) {
memcpy(vert->x, data, 3 * sizeof(float));
memcpy(vert->xconst, data + 3, 3 * sizeof(float));
memcpy(vert->v, data + 6, 3 * sizeof(float));
@@ -482,13 +483,13 @@ static void ptcache_cloth_interpolate(int index, void *cloth_v, void **data, flo
ParticleKey keys[4];
float dfra;
- if(cfra1 == cfra2)
+ if (cfra1 == cfra2)
return;
copy_v3_v3(keys[1].co, vert->x);
copy_v3_v3(keys[1].vel, vert->v);
- if(old_data) {
+ if (old_data) {
memcpy(keys[2].co, old_data, 3 * sizeof(float));
memcpy(keys[2].vel, old_data + 6, 3 * sizeof(float));
}
@@ -523,7 +524,7 @@ static int ptcache_smoke_totpoint(void *smoke_v, int UNUSED(cfra))
SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
SmokeDomainSettings *sds = smd->domain;
- if(sds->fluid) {
+ if (sds->fluid) {
return sds->res[0]*sds->res[1]*sds->res[2];
}
else
@@ -535,7 +536,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
SmokeDomainSettings *sds = smd->domain;
int ret = 0;
- if(sds->fluid) {
+ if (sds->fluid) {
size_t res = sds->res[0]*sds->res[1]*sds->res[2];
float dt, dx, *dens, *densold, *heat, *heatold, *vx, *vy, *vz, *vxold, *vyold, *vzold;
unsigned char *obstacles;
@@ -567,7 +568,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
ret = 1;
}
- if(sds->wt) {
+ if (sds->wt) {
int res_big_array[3];
int res_big;
int res = sds->res[0]*sds->res[1]*sds->res[2];
@@ -608,7 +609,7 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
SmokeDomainSettings *sds = smd->domain;
- if(sds->fluid) {
+ if (sds->fluid) {
size_t res = sds->res[0]*sds->res[1]*sds->res[2];
float dt, dx, *dens, *densold, *heat, *heatold, *vx, *vy, *vz, *vxold, *vyold, *vzold;
unsigned char *obstacles;
@@ -631,7 +632,7 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
ptcache_file_read(pf, &dt, 1, sizeof(float));
ptcache_file_read(pf, &dx, 1, sizeof(float));
- if(pf->data_types & (1<<BPHYS_DATA_SMOKE_HIGH) && sds->wt) {
+ if (pf->data_types & (1<<BPHYS_DATA_SMOKE_HIGH) && sds->wt) {
int res = sds->res[0]*sds->res[1]*sds->res[2];
int res_big, res_big_array[3];
float *dens, *densold, *tcu, *tcv, *tcw;
@@ -679,7 +680,7 @@ static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v)
/* version header */
ptcache_file_write(pf, DPAINT_CACHE_VERSION, 1, sizeof(char)*4);
- if(surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
+ if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
int total_points=surface->data->total_points;
unsigned int in_len;
unsigned char *out;
@@ -713,7 +714,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
ptcache_file_read(pf, version, 1, sizeof(char)*4);
if (strncmp(version, DPAINT_CACHE_VERSION,4)) {printf("Dynamic Paint: Invalid cache version: %s!\n",version); return 0;}
- if(surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
+ if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
unsigned int data_len;
int surface_type;
@@ -786,7 +787,7 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p
pid->cache_ptr= &psys->pointcache;
pid->ptcaches= &psys->ptcaches;
- if(psys->part->type != PART_HAIR)
+ if (psys->part->type != PART_HAIR)
pid->flag |= PTCACHE_VEL_PER_SEC;
pid->totpoint = ptcache_particle_totpoint;
@@ -808,20 +809,21 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p
pid->data_types = (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY) | (1<<BPHYS_DATA_INDEX);
- if(psys->part->phystype == PART_PHYS_BOIDS)
+ if (psys->part->phystype == PART_PHYS_BOIDS)
pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION) | (1<<BPHYS_DATA_BOIDS);
- else if(psys->part->phystype == PART_PHYS_FLUID && psys->part->fluid && psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS) {
+ else if (psys->part->phystype == PART_PHYS_FLUID && psys->part->fluid && psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS) {
pid->write_extra_data = ptcache_particle_extra_write;
pid->read_extra_data = ptcache_particle_extra_read;
}
- if(psys->part->rotmode!=PART_ROT_VEL
- || psys->part->avemode!=PART_AVE_SPIN || psys->part->avefac!=0.0f)
- pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION);
-
- if(psys->part->flag & PART_ROT_DYN)
+ if (psys->part->flag & PART_ROTATIONS) {
pid->data_types|= (1<<BPHYS_DATA_ROTATION);
+ if (psys->part->rotmode!=PART_ROT_VEL
+ || psys->part->avemode==PART_AVE_RAND || psys->part->avefac!=0.0f)
+ pid->data_types|= (1<<BPHYS_DATA_AVELOCITY);
+ }
+
pid->info_types= (1<<BPHYS_DATA_TIMES);
pid->default_step = 10;
@@ -895,9 +897,9 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeMo
pid->data_types= 0;
pid->info_types= 0;
- if(sds->fluid)
+ if (sds->fluid)
pid->data_types |= (1<<BPHYS_DATA_SMOKE_LOW);
- if(sds->wt)
+ if (sds->wt)
pid->data_types |= (1<<BPHYS_DATA_SMOKE_HIGH);
pid->default_step = 1;
@@ -948,25 +950,25 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
lb->first= lb->last= NULL;
- if(ob->soft) {
+ if (ob->soft) {
pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
BKE_ptcache_id_from_softbody(pid, ob, ob->soft);
BLI_addtail(lb, pid);
}
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
- if(psys->part==NULL)
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+ if (psys->part==NULL)
continue;
/* check to make sure point cache is actually used by the particles */
- if(ELEM(psys->part->phystype, PART_PHYS_NO, PART_PHYS_KEYED))
+ if (ELEM(psys->part->phystype, PART_PHYS_NO, PART_PHYS_KEYED))
continue;
/* hair needs to be included in id-list for cache edit mode to work */
- /* if(psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0) */
+ /* if (psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0) */
/* continue; */
- if(psys->part->type == PART_FLUID)
+ if (psys->part->type == PART_FLUID)
continue;
pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
@@ -974,24 +976,24 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
BLI_addtail(lb, pid);
}
- for(md=ob->modifiers.first; md; md=md->next) {
- if(md->type == eModifierType_Cloth) {
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type == eModifierType_Cloth) {
pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
BKE_ptcache_id_from_cloth(pid, ob, (ClothModifierData*)md);
BLI_addtail(lb, pid);
}
- else if(md->type == eModifierType_Smoke) {
+ 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);
}
}
- else if(md->type == eModifierType_DynamicPaint) {
+ else if (md->type == eModifierType_DynamicPaint) {
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
- if(pmd->canvas)
+ if (pmd->canvas)
{
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
@@ -1004,17 +1006,17 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
}
}
- if(scene && (duplis-- > 0) && (ob->transflag & OB_DUPLI)) {
+ if (scene && (duplis-- > 0) && (ob->transflag & OB_DUPLI)) {
ListBase *lb_dupli_ob;
- if((lb_dupli_ob=object_duplilist(scene, ob))) {
+ if ((lb_dupli_ob=object_duplilist(scene, ob))) {
DupliObject *dob;
- for(dob= lb_dupli_ob->first; dob; dob= dob->next) {
- if(dob->ob != ob) { /* avoids recursive loops with dupliframes: bug 22988 */
+ for (dob= lb_dupli_ob->first; dob; dob= dob->next) {
+ if (dob->ob != ob) { /* avoids recursive loops with dupliframes: bug 22988 */
ListBase lb_dupli_pid;
BKE_ptcache_ids_from_object(&lb_dupli_pid, dob->ob, scene, duplis);
BLI_movelisttolist(lb, &lb_dupli_pid);
- if(lb_dupli_pid.first)
+ if (lb_dupli_pid.first)
printf("Adding Dupli\n");
}
}
@@ -1041,16 +1043,16 @@ static int ptcache_path(PTCacheID *pid, char *filename)
const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.main->name;
size_t i;
- if(pid->cache->flag & PTCACHE_EXTERNAL) {
+ if (pid->cache->flag & PTCACHE_EXTERNAL) {
strcpy(filename, pid->cache->path);
- if(strncmp(filename, "//", 2)==0)
+ if (strncmp(filename, "//", 2)==0)
BLI_path_abs(filename, blendfilename);
return BLI_add_slash(filename); /* new strlen() */
}
else if (G.relbase_valid || lib) {
- char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */
+ char file[MAX_PTCACHE_PATH]; /* we don't want the dir, only the file */
BLI_split_file_part(blendfilename, file, sizeof(file));
i = strlen(file);
@@ -1086,10 +1088,10 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
len = ptcache_path(pid, filename);
newname += len;
}
- if(pid->cache->name[0] == '\0' && (pid->cache->flag & PTCACHE_EXTERNAL)==0) {
+ if (pid->cache->name[0] == '\0' && (pid->cache->flag & PTCACHE_EXTERNAL)==0) {
idname = (pid->ob->id.name+2);
/* convert chars to hex so they are always a valid filename */
- while('\0' != *idname) {
+ while ('\0' != *idname) {
BLI_snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++));
newname+=2;
len += 2;
@@ -1104,11 +1106,11 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
if (do_ext) {
- if(pid->cache->index < 0)
+ if (pid->cache->index < 0)
pid->cache->index = pid->stack_index = object_insert_ptcache(pid->ob);
- if(pid->cache->flag & PTCACHE_EXTERNAL) {
- if(pid->cache->index >= 0)
+ if (pid->cache->flag & PTCACHE_EXTERNAL) {
+ if (pid->cache->index >= 0)
BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
else
BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */
@@ -1131,7 +1133,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
#ifndef DURIAN_POINTCACHE_LIB_OK
/* don't allow writing for linked objects */
- if(pid->ob->id.lib && mode == PTCACHE_FILE_WRITE)
+ if (pid->ob->id.lib && mode == PTCACHE_FILE_WRITE)
return NULL;
#endif
if (!G.relbase_valid && (pid->cache->flag & PTCACHE_EXTERNAL)==0) return NULL; /* save blend file before using disk pointcache */
@@ -1142,13 +1144,15 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
if (!BLI_exists(filename)) {
return NULL;
}
- fp = fopen(filename, "rb");
- } else if (mode==PTCACHE_FILE_WRITE) {
+ fp = BLI_fopen(filename, "rb");
+ }
+ else if (mode==PTCACHE_FILE_WRITE) {
BLI_make_existing_file(filename); /* will create the dir if needs be, same as //textures is created */
- fp = fopen(filename, "wb");
- } else if (mode==PTCACHE_FILE_UPDATE) {
+ fp = BLI_fopen(filename, "wb");
+ }
+ else if (mode==PTCACHE_FILE_UPDATE) {
BLI_make_existing_file(filename);
- fp = fopen(filename, "rb+");
+ fp = BLI_fopen(filename, "rb+");
}
if (!fp)
@@ -1163,7 +1167,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
}
static void ptcache_file_close(PTCacheFile *pf)
{
- if(pf) {
+ if (pf) {
fclose(pf->fp);
MEM_freeN(pf);
}
@@ -1181,22 +1185,22 @@ static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result,
unsigned char *props = MEM_callocN(16*sizeof(char), "tmp");
ptcache_file_read(pf, &compressed, 1, sizeof(unsigned char));
- if(compressed) {
+ if (compressed) {
unsigned int size;
ptcache_file_read(pf, &size, 1, sizeof(unsigned int));
in_len = (size_t)size;
- if(in_len==0) {
+ if (in_len==0) {
/* do nothing */
}
else {
in = (unsigned char *)MEM_callocN(sizeof(unsigned char)*in_len, "pointcache_compressed_buffer");
ptcache_file_read(pf, in, in_len, sizeof(unsigned char));
#ifdef WITH_LZO
- if(compressed == 1)
+ if (compressed == 1)
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 = out_len;
@@ -1229,7 +1233,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
#ifdef WITH_LZO
out_len= LZO_OUT_LEN(in_len);
- if(mode == 1) {
+ if (mode == 1) {
LZO_HEAP_ALLOC(wrkmem, LZO1X_MEM_COMPRESS);
r = lzo1x_1_compress(in, (lzo_uint)in_len, out, (lzo_uint *)&out_len, wrkmem);
@@ -1240,12 +1244,12 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
}
#endif
#ifdef WITH_LZMA
- if(mode == 2) {
+ if (mode == 2) {
r = LzmaCompress(out, &out_len, in, in_len,//assume sizeof(char)==1....
props, &sizeOfIt, 5, 1 << 24, 3, 0, 2, 32, 2);
- if(!(r == SZ_OK) || (out_len >= in_len))
+ if (!(r == SZ_OK) || (out_len >= in_len))
compressed = 0;
else
compressed = 2;
@@ -1253,7 +1257,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
#endif
ptcache_file_write(pf, &compressed, 1, sizeof(unsigned char));
- if(compressed) {
+ if (compressed) {
unsigned int size = out_len;
ptcache_file_write(pf, &size, 1, sizeof(unsigned int));
ptcache_file_write(pf, out, out_len, sizeof(unsigned char));
@@ -1261,7 +1265,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
else
ptcache_file_write(pf, in, in_len, sizeof(unsigned char));
- if(compressed == 2)
+ if (compressed == 2)
{
unsigned int size = sizeOfIt;
ptcache_file_write(pf, &sizeOfIt, 1, sizeof(unsigned int));
@@ -1284,8 +1288,8 @@ static int ptcache_file_data_read(PTCacheFile *pf)
{
int i;
- for(i=0; i<BPHYS_TOT_DATA; i++) {
- if((pf->data_types & (1<<i)) && !ptcache_file_read(pf, pf->cur[i], 1, ptcache_data_size[i]))
+ for (i=0; i<BPHYS_TOT_DATA; i++) {
+ if ((pf->data_types & (1<<i)) && !ptcache_file_read(pf, pf->cur[i], 1, ptcache_data_size[i]))
return 0;
}
@@ -1295,8 +1299,8 @@ static int ptcache_file_data_write(PTCacheFile *pf)
{
int i;
- for(i=0; i<BPHYS_TOT_DATA; i++) {
- if((pf->data_types & (1<<i)) && !ptcache_file_write(pf, pf->cur[i], 1, ptcache_data_size[i]))
+ for (i=0; i<BPHYS_TOT_DATA; i++) {
+ if ((pf->data_types & (1<<i)) && !ptcache_file_write(pf, pf->cur[i], 1, ptcache_data_size[i]))
return 0;
}
@@ -1310,20 +1314,20 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf)
pf->data_types = 0;
- if(fread(bphysics, sizeof(char), 8, pf->fp) != 8)
+ if (fread(bphysics, sizeof(char), 8, pf->fp) != 8)
error = 1;
- if(!error && strncmp(bphysics, "BPHYSICS", 8))
+ if (!error && strncmp(bphysics, "BPHYSICS", 8))
error = 1;
- if(!error && !fread(&typeflag, sizeof(unsigned int), 1, pf->fp))
+ if (!error && !fread(&typeflag, sizeof(unsigned int), 1, pf->fp))
error = 1;
pf->type = (typeflag & PTCACHE_TYPEFLAG_TYPEMASK);
pf->flag = (typeflag & PTCACHE_TYPEFLAG_FLAGMASK);
/* if there was an error set file as it was */
- if(error)
+ if (error)
fseek(pf->fp, 0, SEEK_SET);
return !error;
@@ -1333,10 +1337,10 @@ static int ptcache_file_header_begin_write(PTCacheFile *pf)
const char *bphysics = "BPHYSICS";
unsigned int typeflag = pf->type + pf->flag;
- if(fwrite(bphysics, sizeof(char), 8, pf->fp) != 8)
+ if (fwrite(bphysics, sizeof(char), 8, pf->fp) != 8)
return 0;
- if(!fwrite(&typeflag, sizeof(unsigned int), 1, pf->fp))
+ if (!fwrite(&typeflag, sizeof(unsigned int), 1, pf->fp))
return 0;
return 1;
@@ -1365,23 +1369,23 @@ static void ptcache_file_pointers_init(PTCacheFile *pf)
/* Check to see if point number "index" is in pm, uses binary search for index data. */
int BKE_ptcache_mem_index_find(PTCacheMem *pm, unsigned int index)
{
- if(pm->data[BPHYS_DATA_INDEX]) {
+ if (pm->data[BPHYS_DATA_INDEX]) {
unsigned int *data = pm->data[BPHYS_DATA_INDEX];
unsigned int mid, low = 0, high = pm->totpoint - 1;
- if(index < *data || index > *(data+high))
+ if (index < *data || index > *(data+high))
return -1;
/* check simple case for continuous indexes first */
- if(index-*data < high && data[index-*data] == index)
+ if (index-*data < high && data[index-*data] == index)
return index-*data;
- while(low <= high) {
+ while (low <= high) {
mid= (low + high)/2;
- if(data[mid] > index)
+ if (data[mid] > index)
high = mid - 1;
- else if(data[mid] < index)
+ else if (data[mid] < index)
low = mid + 1;
else
return mid;
@@ -1399,7 +1403,7 @@ void BKE_ptcache_mem_pointers_init(PTCacheMem *pm)
int data_types = pm->data_types;
int i;
- for(i=0; i<BPHYS_TOT_DATA; i++)
+ for (i=0; i<BPHYS_TOT_DATA; i++)
pm->cur[i] = ((data_types & (1<<i)) ? pm->data[i] : NULL);
}
@@ -1407,8 +1411,8 @@ void BKE_ptcache_mem_pointers_incr(PTCacheMem *pm)
{
int i;
- for(i=0; i<BPHYS_TOT_DATA; i++) {
- if(pm->cur[i])
+ for (i=0; i<BPHYS_TOT_DATA; i++) {
+ if (pm->cur[i])
pm->cur[i] = (char*)pm->cur[i] + ptcache_data_size[i];
}
}
@@ -1417,7 +1421,7 @@ int BKE_ptcache_mem_pointers_seek(int point_index, PTCacheMem *pm)
int data_types = pm->data_types;
int i, index = BKE_ptcache_mem_index_find(pm, point_index);
- if(index < 0) {
+ if (index < 0) {
/* Can't give proper location without reallocation, so don't give any location.
* Some points will be cached improperly, but this only happens with simulation
* steps bigger than cache->step, so the cache has to be recalculated anyways
@@ -1426,7 +1430,7 @@ int BKE_ptcache_mem_pointers_seek(int point_index, PTCacheMem *pm)
return 0;
}
- for(i=0; i<BPHYS_TOT_DATA; i++)
+ for (i=0; i<BPHYS_TOT_DATA; i++)
pm->cur[i] = data_types & (1<<i) ? (char*)pm->data[i] + index * ptcache_data_size[i] : NULL;
return 1;
@@ -1437,8 +1441,8 @@ static void ptcache_data_alloc(PTCacheMem *pm)
int totpoint = pm->totpoint;
int i;
- for(i=0; i<BPHYS_TOT_DATA; i++) {
- if(data_types & (1<<i))
+ for (i=0; i<BPHYS_TOT_DATA; i++) {
+ if (data_types & (1<<i))
pm->data[i] = MEM_callocN(totpoint * ptcache_data_size[i], "PTCache Data");
}
}
@@ -1447,18 +1451,18 @@ static void ptcache_data_free(PTCacheMem *pm)
void **data = pm->data;
int i;
- for(i=0; i<BPHYS_TOT_DATA; i++) {
- if(data[i])
+ for (i=0; i<BPHYS_TOT_DATA; i++) {
+ if (data[i])
MEM_freeN(data[i]);
}
}
static void ptcache_data_copy(void *from[], void *to[])
{
int i;
- for(i=0; i<BPHYS_TOT_DATA; i++) {
+ for (i=0; i<BPHYS_TOT_DATA; i++) {
/* note, durian file 03.4b_comp crashes if to[i] is not tested
* its NULL, not sure if this should be fixed elsewhere but for now its needed */
- if(from[i] && to[i])
+ if (from[i] && to[i])
memcpy(to[i], from[i], ptcache_data_size[i]);
}
}
@@ -1467,9 +1471,9 @@ static void ptcache_extra_free(PTCacheMem *pm)
{
PTCacheExtra *extra = pm->extradata.first;
- if(extra) {
- for(; extra; extra=extra->next) {
- if(extra->data)
+ if (extra) {
+ for (; extra; extra=extra->next) {
+ if (extra->data)
MEM_freeN(extra->data);
}
@@ -1478,11 +1482,11 @@ static void ptcache_extra_free(PTCacheMem *pm)
}
static int ptcache_old_elemsize(PTCacheID *pid)
{
- if(pid->type==PTCACHE_TYPE_SOFTBODY)
+ if (pid->type==PTCACHE_TYPE_SOFTBODY)
return 6 * sizeof(float);
- else if(pid->type==PTCACHE_TYPE_PARTICLES)
+ else if (pid->type==PTCACHE_TYPE_PARTICLES)
return sizeof(ParticleKey);
- else if(pid->type==PTCACHE_TYPE_CLOTH)
+ else if (pid->type==PTCACHE_TYPE_CLOTH)
return 9 * sizeof(float);
return 0;
@@ -1490,22 +1494,22 @@ static int ptcache_old_elemsize(PTCacheID *pid)
static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *fra1, int *fra2)
{
- if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
int cfra1=frame, cfra2=frame+1;
- while(cfra1 >= pid->cache->startframe && !BKE_ptcache_id_exist(pid, cfra1))
+ while (cfra1 >= pid->cache->startframe && !BKE_ptcache_id_exist(pid, cfra1))
cfra1--;
- if(cfra1 < pid->cache->startframe)
+ if (cfra1 < pid->cache->startframe)
cfra1 = 0;
- while(cfra2 <= pid->cache->endframe && !BKE_ptcache_id_exist(pid, cfra2))
+ while (cfra2 <= pid->cache->endframe && !BKE_ptcache_id_exist(pid, cfra2))
cfra2++;
- if(cfra2 > pid->cache->endframe)
+ if (cfra2 > pid->cache->endframe)
cfra2 = 0;
- if(cfra1 && !cfra2) {
+ if (cfra1 && !cfra2) {
*fra1 = 0;
*fra2 = cfra1;
}
@@ -1514,23 +1518,23 @@ static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *
*fra2 = cfra2;
}
}
- else if(pid->cache->mem_cache.first) {
+ else if (pid->cache->mem_cache.first) {
PTCacheMem *pm = pid->cache->mem_cache.first;
PTCacheMem *pm2 = pid->cache->mem_cache.last;
- while(pm->next && pm->next->frame <= frame)
+ while (pm->next && pm->next->frame <= frame)
pm= pm->next;
- if(pm2->frame < frame) {
+ if (pm2->frame < frame) {
pm2 = NULL;
}
else {
- while(pm2->prev && pm2->prev->frame > frame) {
+ while (pm2->prev && pm2->prev->frame > frame) {
pm2= pm2->prev;
}
}
- if(!pm2) {
+ if (!pm2) {
*fra1 = 0;
*fra2 = pm->frame;
}
@@ -1547,16 +1551,16 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
PTCacheMem *pm = NULL;
unsigned int i, error = 0;
- if(pf == NULL)
+ if (pf == NULL)
return NULL;
- if(!ptcache_file_header_begin_read(pf))
+ if (!ptcache_file_header_begin_read(pf))
error = 1;
- if(!error && (pf->type != pid->type || !pid->read_header(pf)))
+ if (!error && (pf->type != pid->type || !pid->read_header(pf)))
error = 1;
- if(!error) {
+ if (!error) {
pm = MEM_callocN(sizeof(PTCacheMem), "Pointcache mem");
pm->totpoint = pf->totpoint;
@@ -1565,10 +1569,10 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
ptcache_data_alloc(pm);
- if(pf->flag & PTCACHE_TYPEFLAG_COMPRESS) {
- for(i=0; i<BPHYS_TOT_DATA; i++) {
+ if (pf->flag & PTCACHE_TYPEFLAG_COMPRESS) {
+ for (i=0; i<BPHYS_TOT_DATA; i++) {
unsigned int out_len = pm->totpoint*ptcache_data_size[i];
- if(pf->data_types & (1<<i))
+ if (pf->data_types & (1<<i))
ptcache_file_compressed_read(pf, (unsigned char*)(pm->data[i]), out_len);
}
}
@@ -1576,8 +1580,8 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
BKE_ptcache_mem_pointers_init(pm);
ptcache_file_pointers_init(pf);
- for(i=0; i<pm->totpoint; i++) {
- if(!ptcache_file_data_read(pf)) {
+ for (i=0; i<pm->totpoint; i++) {
+ if (!ptcache_file_data_read(pf)) {
error = 1;
break;
}
@@ -1587,10 +1591,10 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
}
}
- if(!error && pf->flag & PTCACHE_TYPEFLAG_EXTRADATA) {
+ if (!error && pf->flag & PTCACHE_TYPEFLAG_EXTRADATA) {
unsigned int extratype = 0;
- while(ptcache_file_read(pf, &extratype, 1, sizeof(unsigned int))) {
+ while (ptcache_file_read(pf, &extratype, 1, sizeof(unsigned int))) {
PTCacheExtra *extra = MEM_callocN(sizeof(PTCacheExtra), "Pointcache extradata");
extra->type = extratype;
@@ -1599,7 +1603,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
extra->data = MEM_callocN(extra->totdata * ptcache_extra_datasize[extra->type], "Pointcache extradata->data");
- if(pf->flag & PTCACHE_TYPEFLAG_COMPRESS)
+ if (pf->flag & PTCACHE_TYPEFLAG_COMPRESS)
ptcache_file_compressed_read(pf, (unsigned char*)(extra->data), extra->totdata*ptcache_extra_datasize[extra->type]);
else
ptcache_file_read(pf, extra->data, extra->totdata, ptcache_extra_datasize[extra->type]);
@@ -1608,7 +1612,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
}
}
- if(error && pm) {
+ if (error && pm) {
ptcache_data_free(pm);
ptcache_extra_free(pm);
MEM_freeN(pm);
@@ -1631,7 +1635,7 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, pm->frame);
- if(pf==NULL) {
+ if (pf==NULL) {
if (G.f & G_DEBUG)
printf("Error opening disk cache file for writing\n");
return 0;
@@ -1642,19 +1646,19 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
pf->type = pid->type;
pf->flag = 0;
- if(pm->extradata.first)
+ if (pm->extradata.first)
pf->flag |= PTCACHE_TYPEFLAG_EXTRADATA;
- if(pid->cache->compression)
+ if (pid->cache->compression)
pf->flag |= PTCACHE_TYPEFLAG_COMPRESS;
- if(!ptcache_file_header_begin_write(pf) || !pid->write_header(pf))
+ if (!ptcache_file_header_begin_write(pf) || !pid->write_header(pf))
error = 1;
- if(!error) {
- if(pid->cache->compression) {
- for(i=0; i<BPHYS_TOT_DATA; i++) {
- if(pm->data[i]) {
+ if (!error) {
+ if (pid->cache->compression) {
+ for (i=0; i<BPHYS_TOT_DATA; i++) {
+ if (pm->data[i]) {
unsigned int in_len = pm->totpoint*ptcache_data_size[i];
unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len)*4, "pointcache_lzo_buffer");
ptcache_file_compressed_write(pf, (unsigned char*)(pm->data[i]), in_len, out, pid->cache->compression);
@@ -1666,9 +1670,9 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
BKE_ptcache_mem_pointers_init(pm);
ptcache_file_pointers_init(pf);
- for(i=0; i<pm->totpoint; i++) {
+ for (i=0; i<pm->totpoint; i++) {
ptcache_data_copy(pm->cur, pf->cur);
- if(!ptcache_file_data_write(pf)) {
+ if (!ptcache_file_data_write(pf)) {
error = 1;
break;
}
@@ -1677,17 +1681,17 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
}
}
- if(!error && pm->extradata.first) {
+ if (!error && pm->extradata.first) {
PTCacheExtra *extra = pm->extradata.first;
- for(; extra; extra=extra->next) {
- if(extra->data == NULL || extra->totdata == 0)
+ for (; extra; extra=extra->next) {
+ if (extra->data == NULL || extra->totdata == 0)
continue;
ptcache_file_write(pf, &extra->type, 1, sizeof(unsigned int));
ptcache_file_write(pf, &extra->totdata, 1, sizeof(unsigned int));
- if(pid->cache->compression) {
+ if (pid->cache->compression) {
unsigned int in_len = extra->totdata * ptcache_extra_datasize[extra->type];
unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len)*4, "pointcache_lzo_buffer");
ptcache_file_compressed_write(pf, (unsigned char*)(extra->data), in_len, out, pid->cache->compression);
@@ -1712,25 +1716,25 @@ static int ptcache_read_stream(PTCacheID *pid, int cfra)
PTCacheFile *pf = ptcache_file_open(pid, PTCACHE_FILE_READ, cfra);
int error = 0;
- if(pid->read_stream == NULL)
+ if (pid->read_stream == NULL)
return 0;
- if(pf == NULL) {
+ if (pf == NULL) {
if (G.f & G_DEBUG)
printf("Error opening disk cache file for reading\n");
return 0;
}
- if(!ptcache_file_header_begin_read(pf))
+ if (!ptcache_file_header_begin_read(pf))
error = 1;
- if(!error && (pf->type != pid->type || !pid->read_header(pf)))
+ if (!error && (pf->type != pid->type || !pid->read_header(pf)))
error = 1;
- if(!error && pf->totpoint != pid->totpoint(pid->calldata, cfra))
+ if (!error && pf->totpoint != pid->totpoint(pid->calldata, cfra))
error = 1;
- if(!error) {
+ if (!error) {
ptcache_file_pointers_init(pf);
// we have stream reading here
@@ -1749,27 +1753,27 @@ static int ptcache_read(PTCacheID *pid, int cfra)
int *index = &i;
/* get a memory cache to read from */
- if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
pm = ptcache_disk_frame_to_mem(pid, cfra);
}
else {
pm = pid->cache->mem_cache.first;
- while(pm && pm->frame != cfra)
+ while (pm && pm->frame != cfra)
pm = pm->next;
}
/* read the cache */
- if(pm) {
+ if (pm) {
int totpoint = pm->totpoint;
- if((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0)
+ if ((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0)
totpoint = MIN2(totpoint, pid->totpoint(pid->calldata, cfra));
BKE_ptcache_mem_pointers_init(pm);
- for(i=0; i<totpoint; i++) {
- if(pm->data_types & (1<<BPHYS_DATA_INDEX))
+ for (i=0; i<totpoint; i++) {
+ if (pm->data_types & (1<<BPHYS_DATA_INDEX))
index = pm->cur[BPHYS_DATA_INDEX];
pid->read_point(*index, pid->calldata, pm->cur, (float)pm->frame, NULL);
@@ -1777,11 +1781,11 @@ static int ptcache_read(PTCacheID *pid, int cfra)
BKE_ptcache_mem_pointers_incr(pm);
}
- if(pid->read_extra_data && pm->extradata.first)
+ if (pid->read_extra_data && pm->extradata.first)
pid->read_extra_data(pid->calldata, pm, (float)pm->frame);
/* clean up temporary memory cache */
- if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
ptcache_data_free(pm);
ptcache_extra_free(pm);
MEM_freeN(pm);
@@ -1797,38 +1801,38 @@ static int ptcache_interpolate(PTCacheID *pid, float cfra, int cfra1, int cfra2)
int *index = &i;
/* get a memory cache to read from */
- if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
pm = ptcache_disk_frame_to_mem(pid, cfra2);
}
else {
pm = pid->cache->mem_cache.first;
- while(pm && pm->frame != cfra2)
+ while (pm && pm->frame != cfra2)
pm = pm->next;
}
/* read the cache */
- if(pm) {
+ if (pm) {
int totpoint = pm->totpoint;
- if((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0)
+ if ((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0)
totpoint = MIN2(totpoint, pid->totpoint(pid->calldata, (int)cfra));
BKE_ptcache_mem_pointers_init(pm);
- for(i=0; i<totpoint; i++) {
- if(pm->data_types & (1<<BPHYS_DATA_INDEX))
+ for (i=0; i<totpoint; i++) {
+ if (pm->data_types & (1<<BPHYS_DATA_INDEX))
index = pm->cur[BPHYS_DATA_INDEX];
pid->interpolate_point(*index, pid->calldata, pm->cur, cfra, (float)cfra1, (float)cfra2, NULL);
BKE_ptcache_mem_pointers_incr(pm);
}
- if(pid->interpolate_extra_data && pm->extradata.first)
+ if (pid->interpolate_extra_data && pm->extradata.first)
pid->interpolate_extra_data(pid->calldata, pm, cfra, (float)cfra1, (float)cfra2);
/* clean up temporary memory cache */
- if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
ptcache_data_free(pm);
ptcache_extra_free(pm);
MEM_freeN(pm);
@@ -1845,70 +1849,70 @@ int BKE_ptcache_read(PTCacheID *pid, float cfra)
int ret = 0;
/* nothing to read to */
- if(pid->totpoint(pid->calldata, cfrai) == 0)
+ if (pid->totpoint(pid->calldata, cfrai) == 0)
return 0;
- if(pid->cache->flag & PTCACHE_READ_INFO) {
+ if (pid->cache->flag & PTCACHE_READ_INFO) {
pid->cache->flag &= ~PTCACHE_READ_INFO;
ptcache_read(pid, 0);
}
/* first check if we have the actual frame cached */
- if(cfra == (float)cfrai && BKE_ptcache_id_exist(pid, cfrai))
+ if (cfra == (float)cfrai && BKE_ptcache_id_exist(pid, cfrai))
cfra1 = cfrai;
/* no exact cache frame found so try to find cached frames around cfra */
- if(cfra1 == 0)
+ if (cfra1 == 0)
ptcache_find_frames_around(pid, cfrai, &cfra1, &cfra2);
- if(cfra1 == 0 && cfra2 == 0)
+ if (cfra1 == 0 && cfra2 == 0)
return 0;
/* don't read old cache if already simulated past cached frame */
- if(cfra1 == 0 && cfra2 && cfra2 <= pid->cache->simframe)
+ if (cfra1 == 0 && cfra2 && cfra2 <= pid->cache->simframe)
return 0;
- if(cfra1 && cfra1 == cfra2)
+ if (cfra1 && cfra1 == cfra2)
return 0;
- if(cfra1) {
+ if (cfra1) {
- if(pid->read_stream) {
+ if (pid->read_stream) {
if (!ptcache_read_stream(pid, cfra1))
return 0;
}
- else if(pid->read_point)
+ else if (pid->read_point)
ptcache_read(pid, cfra1);
}
- if(cfra2) {
+ if (cfra2) {
- if(pid->read_stream) {
+ if (pid->read_stream) {
if (!ptcache_read_stream(pid, cfra2))
return 0;
}
- else if(pid->read_point) {
- if(cfra1 && cfra2 && pid->interpolate_point)
+ else if (pid->read_point) {
+ if (cfra1 && cfra2 && pid->interpolate_point)
ptcache_interpolate(pid, cfra, cfra1, cfra2);
else
ptcache_read(pid, cfra2);
}
}
- if(cfra1)
+ if (cfra1)
ret = (cfra2 ? PTCACHE_READ_INTERPOLATED : PTCACHE_READ_EXACT);
- else if(cfra2) {
+ else if (cfra2) {
ret = PTCACHE_READ_OLD;
pid->cache->simframe = cfra2;
}
- if((pid->cache->flag & PTCACHE_QUICK_CACHE)==0) {
+ if ((pid->cache->flag & PTCACHE_QUICK_CACHE)==0) {
cfrai = (int)cfra;
/* clear invalid cache frames so that better stuff can be simulated */
- if(pid->cache->flag & PTCACHE_OUTDATED) {
+ if (pid->cache->flag & PTCACHE_OUTDATED) {
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, cfrai);
}
- else if(pid->cache->flag & PTCACHE_FRAMES_SKIPPED) {
- if(cfra <= pid->cache->last_exact)
+ else if (pid->cache->flag & PTCACHE_FRAMES_SKIPPED) {
+ if (cfra <= pid->cache->last_exact)
pid->cache->flag &= ~PTCACHE_FRAMES_SKIPPED;
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, MAX2(cfrai, pid->cache->last_exact));
@@ -1926,7 +1930,7 @@ static int ptcache_write_stream(PTCacheID *pid, int cfra, int totpoint)
pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, cfra);
- if(pf==NULL) {
+ if (pf==NULL) {
if (G.f & G_DEBUG)
printf("Error opening disk cache file for writing\n");
return 0;
@@ -1937,10 +1941,10 @@ static int ptcache_write_stream(PTCacheID *pid, int cfra, int totpoint)
pf->type = pid->type;
pf->flag = 0;
- if(!error && (!ptcache_file_header_begin_write(pf) || !pid->write_header(pf)))
+ if (!error && (!ptcache_file_header_begin_write(pf) || !pid->write_header(pf)))
error = 1;
- if(!error && pid->write_stream)
+ if (!error && pid->write_stream)
pid->write_stream(pf, pid->calldata);
ptcache_file_close(pf);
@@ -1965,11 +1969,11 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite)
ptcache_data_alloc(pm);
BKE_ptcache_mem_pointers_init(pm);
- if(overwrite) {
- if(cache->flag & PTCACHE_DISK_CACHE) {
+ if (overwrite) {
+ if (cache->flag & PTCACHE_DISK_CACHE) {
int fra = cfra-1;
- while(fra >= cache->startframe && !BKE_ptcache_id_exist(pid, fra))
+ while (fra >= cache->startframe && !BKE_ptcache_id_exist(pid, fra))
fra--;
pm2 = ptcache_disk_frame_to_mem(pid, fra);
@@ -1978,35 +1982,35 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite)
pm2 = cache->mem_cache.last;
}
- if(pid->write_point) {
- for(i=0; i<totpoint; i++) {
+ if (pid->write_point) {
+ for (i=0; i<totpoint; i++) {
int write = pid->write_point(i, pid->calldata, pm->cur, cfra);
- if(write) {
+ if (write) {
BKE_ptcache_mem_pointers_incr(pm);
/* newly born particles have to be copied to previous cached frame */
- if(overwrite && write == 2 && pm2 && BKE_ptcache_mem_pointers_seek(i, pm2))
+ if (overwrite && write == 2 && pm2 && BKE_ptcache_mem_pointers_seek(i, pm2))
pid->write_point(i, pid->calldata, pm2->cur, cfra);
}
}
}
- if(pid->write_extra_data)
+ if (pid->write_extra_data)
pid->write_extra_data(pid->calldata, pm, cfra);
pm->frame = cfra;
- if(cache->flag & PTCACHE_DISK_CACHE) {
+ if (cache->flag & PTCACHE_DISK_CACHE) {
error += !ptcache_mem_frame_to_disk(pid, pm);
- // if(pm) /* pm is always set */
+ // if (pm) /* pm is always set */
{
ptcache_data_free(pm);
ptcache_extra_free(pm);
MEM_freeN(pm);
}
- if(pm2) {
+ if (pm2) {
error += !ptcache_mem_frame_to_disk(pid, pm2);
ptcache_data_free(pm2);
ptcache_extra_free(pm2);
@@ -2025,40 +2029,40 @@ static int ptcache_write_needed(PTCacheID *pid, int cfra, int *overwrite)
int ofra = 0, efra = cache->endframe;
/* allways start from scratch on the first frame */
- if(cfra && cfra == cache->startframe) {
+ if (cfra && cfra == cache->startframe) {
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, cfra);
cache->flag &= ~PTCACHE_REDO_NEEDED;
return 1;
}
- if(pid->cache->flag & PTCACHE_DISK_CACHE) {
- if(cfra==0 && cache->startframe > 0)
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
+ if (cfra==0 && cache->startframe > 0)
return 1;
/* find last cached frame */
- while(efra > cache->startframe && !BKE_ptcache_id_exist(pid, efra))
+ while (efra > cache->startframe && !BKE_ptcache_id_exist(pid, efra))
efra--;
/* find second last cached frame */
ofra = efra-1;
- while(ofra > cache->startframe && !BKE_ptcache_id_exist(pid, ofra))
+ while (ofra > cache->startframe && !BKE_ptcache_id_exist(pid, ofra))
ofra--;
}
else {
PTCacheMem *pm = cache->mem_cache.last;
/* don't write info file in memory */
- if(cfra == 0)
+ if (cfra == 0)
return 0;
- if(pm == NULL)
+ if (pm == NULL)
return 1;
efra = pm->frame;
ofra = (pm->prev ? pm->prev->frame : efra - cache->step);
}
- if(efra >= cache->startframe && cfra > efra) {
- if(ofra >= cache->startframe && efra - ofra < cache->step) {
+ if (efra >= cache->startframe && cfra > efra) {
+ if (ofra >= cache->startframe && efra - ofra < cache->step) {
/* overwrite previous frame */
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, efra);
*overwrite = 1;
@@ -2075,30 +2079,30 @@ int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra)
int totpoint = pid->totpoint(pid->calldata, cfra);
int overwrite = 0, error = 0;
- if(totpoint == 0 || (cfra ? pid->data_types == 0 : pid->info_types == 0))
+ if (totpoint == 0 || (cfra ? pid->data_types == 0 : pid->info_types == 0))
return 0;
- if(ptcache_write_needed(pid, cfra, &overwrite)==0)
+ if (ptcache_write_needed(pid, cfra, &overwrite)==0)
return 0;
- if(pid->write_stream) {
+ if (pid->write_stream) {
ptcache_write_stream(pid, cfra, totpoint);
}
- else if(pid->write_point) {
+ else if (pid->write_point) {
error += ptcache_write(pid, cfra, overwrite);
}
/* Mark frames skipped if more than 1 frame forwards since last non-skipped frame. */
- if(cfra - cache->last_exact == 1 || cfra == cache->startframe) {
+ if (cfra - cache->last_exact == 1 || cfra == cache->startframe) {
cache->last_exact = cfra;
cache->flag &= ~PTCACHE_FRAMES_SKIPPED;
}
/* Don't mark skipped when writing info file (frame 0) */
- else if(cfra)
+ else if (cfra)
cache->flag |= PTCACHE_FRAMES_SKIPPED;
/* Update timeline cache display */
- if(cfra && cache->cached_frames)
+ if (cfra && cache->cached_frames)
cache->cached_frames[cfra-cache->startframe] = 1;
BKE_ptcache_update_info(pid);
@@ -2123,7 +2127,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
char path_full[MAX_PTCACHE_FILE];
char ext[MAX_PTCACHE_PATH];
- if(!pid || !pid->cache || pid->cache->flag & PTCACHE_BAKED)
+ if (!pid || !pid->cache || pid->cache->flag & PTCACHE_BAKED)
return;
if (pid->cache->flag & PTCACHE_IGNORE_CLEAR)
@@ -2134,7 +2138,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
#ifndef DURIAN_POINTCACHE_LIB_OK
/* don't allow clearing for linked objects */
- if(pid->ob->id.lib)
+ if (pid->ob->id.lib)
return;
#endif
@@ -2145,7 +2149,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
case PTCACHE_CLEAR_ALL:
case PTCACHE_CLEAR_BEFORE:
case PTCACHE_CLEAR_AFTER:
- if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
ptcache_path(pid, path);
len = ptcache_filename(pid, filename, cfra, 0, 0); /* no path */
@@ -2163,7 +2167,8 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
BLI_delete(path_full, 0, 0);
- } else {
+ }
+ else {
/* read the number of the file */
unsigned int frame, len2 = (int)strlen(de->d_name);
char num[7];
@@ -2172,12 +2177,12 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num));
frame = atoi(num);
- if((mode==PTCACHE_CLEAR_BEFORE && frame < cfra) ||
+ if ((mode==PTCACHE_CLEAR_BEFORE && frame < cfra) ||
(mode==PTCACHE_CLEAR_AFTER && frame > cfra) ) {
BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
BLI_delete(path_full, 0, 0);
- if(pid->cache->cached_frames && frame >=sta && frame <= end)
+ if (pid->cache->cached_frames && frame >=sta && frame <= end)
pid->cache->cached_frames[frame-sta] = 0;
}
}
@@ -2187,30 +2192,31 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
}
closedir(dir);
- if(mode == PTCACHE_CLEAR_ALL && pid->cache->cached_frames)
+ if (mode == PTCACHE_CLEAR_ALL && pid->cache->cached_frames)
memset(pid->cache->cached_frames, 0, MEM_allocN_len(pid->cache->cached_frames));
}
else {
PTCacheMem *pm= pid->cache->mem_cache.first;
PTCacheMem *link= NULL;
- if(mode == PTCACHE_CLEAR_ALL) {
+ if (mode == PTCACHE_CLEAR_ALL) {
/*we want startframe if the cache starts before zero*/
pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
- for(; pm; pm=pm->next) {
+ for (; pm; pm=pm->next) {
ptcache_data_free(pm);
ptcache_extra_free(pm);
}
BLI_freelistN(&pid->cache->mem_cache);
- if(pid->cache->cached_frames)
+ if (pid->cache->cached_frames)
memset(pid->cache->cached_frames, 0, MEM_allocN_len(pid->cache->cached_frames));
- } else {
- while(pm) {
- if((mode==PTCACHE_CLEAR_BEFORE && pm->frame < cfra) ||
+ }
+ else {
+ while (pm) {
+ if ((mode==PTCACHE_CLEAR_BEFORE && pm->frame < cfra) ||
(mode==PTCACHE_CLEAR_AFTER && pm->frame > cfra) ) {
link = pm;
- if(pid->cache->cached_frames && pm->frame >=sta && pm->frame <= end)
+ if (pid->cache->cached_frames && pm->frame >=sta && pm->frame <= end)
pid->cache->cached_frames[pm->frame-sta] = 0;
ptcache_data_free(pm);
ptcache_extra_free(pm);
@@ -2225,8 +2231,8 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
break;
case PTCACHE_CLEAR_FRAME:
- if(pid->cache->flag & PTCACHE_DISK_CACHE) {
- if(BKE_ptcache_id_exist(pid, cfra)) {
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
+ if (BKE_ptcache_id_exist(pid, cfra)) {
ptcache_filename(pid, filename, cfra, 1, 1); /* no path */
BLI_delete(filename, 0, 0);
}
@@ -2234,8 +2240,8 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
else {
PTCacheMem *pm = pid->cache->mem_cache.first;
- for(; pm; pm=pm->next) {
- if(pm->frame == cfra) {
+ for (; pm; pm=pm->next) {
+ if (pm->frame == cfra) {
ptcache_data_free(pm);
ptcache_extra_free(pm);
BLI_freelinkN(&pid->cache->mem_cache, pm);
@@ -2243,7 +2249,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
}
}
}
- if(pid->cache->cached_frames && cfra>=sta && cfra<=end)
+ if (pid->cache->cached_frames && cfra>=sta && cfra<=end)
pid->cache->cached_frames[cfra-sta] = 0;
break;
}
@@ -2252,16 +2258,16 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
}
int BKE_ptcache_id_exist(PTCacheID *pid, int cfra)
{
- if(!pid->cache)
+ if (!pid->cache)
return 0;
- if(cfra<pid->cache->startframe || cfra > pid->cache->endframe)
+ if (cfra<pid->cache->startframe || cfra > pid->cache->endframe)
return 0;
- if(pid->cache->cached_frames && pid->cache->cached_frames[cfra-pid->cache->startframe]==0)
+ if (pid->cache->cached_frames && pid->cache->cached_frames[cfra-pid->cache->startframe]==0)
return 0;
- if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
char filename[MAX_PTCACHE_FILE];
ptcache_filename(pid, filename, cfra, 1, 1);
@@ -2271,8 +2277,8 @@ int BKE_ptcache_id_exist(PTCacheID *pid, int cfra)
else {
PTCacheMem *pm = pid->cache->mem_cache.first;
- for(; pm; pm=pm->next) {
- if(pm->frame==cfra)
+ for (; pm; pm=pm->next) {
+ if (pm->frame==cfra)
return 1;
}
return 0;
@@ -2300,14 +2306,14 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
/* ob= pid->ob; */ /* UNUSED */
cache= pid->cache;
- if(timescale) {
+ if (timescale) {
time= BKE_curframe(scene);
nexttime= BKE_frame_to_ctime(scene, CFRA+1);
*timescale= MAX2(nexttime - time, 0.0f);
}
- if(startframe && endframe) {
+ if (startframe && endframe) {
*startframe= cache->startframe;
*endframe= cache->endframe;
@@ -2326,20 +2332,20 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
}
/* verify cached_frames array is up to date */
- if(cache->cached_frames) {
- if(MEM_allocN_len(cache->cached_frames) != sizeof(char) * (cache->endframe-cache->startframe+1)) {
+ if (cache->cached_frames) {
+ if (MEM_allocN_len(cache->cached_frames) != sizeof(char) * (cache->endframe-cache->startframe+1)) {
MEM_freeN(cache->cached_frames);
cache->cached_frames = NULL;
}
}
- if(cache->cached_frames==NULL && cache->endframe > cache->startframe) {
+ if (cache->cached_frames==NULL && cache->endframe > cache->startframe) {
unsigned int sta=cache->startframe;
unsigned int end=cache->endframe;
cache->cached_frames = MEM_callocN(sizeof(char) * (cache->endframe-cache->startframe+1), "cached frames array");
- if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
/* mode is same as fopen's modes */
DIR *dir;
struct dirent *de;
@@ -2369,7 +2375,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num));
frame = atoi(num);
- if(frame >= sta && frame <= end)
+ if (frame >= sta && frame <= end)
cache->cached_frames[frame-sta] = 1;
}
}
@@ -2380,8 +2386,8 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
else {
PTCacheMem *pm= pid->cache->mem_cache.first;
- while(pm) {
- if(pm->frame >= sta && pm->frame <= end)
+ while (pm) {
+ if (pm->frame >= sta && pm->frame <= end)
cache->cached_frames[pm->frame-sta] = 1;
pm = pm->next;
}
@@ -2393,7 +2399,7 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
PointCache *cache;
int reset, clear, after;
- if(!pid->cache)
+ if (!pid->cache)
return 0;
cache= pid->cache;
@@ -2401,9 +2407,9 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
clear= 0;
after= 0;
- if(mode == PTCACHE_RESET_DEPSGRAPH) {
- if(!(cache->flag & PTCACHE_BAKED) && !BKE_ptcache_get_continue_physics()) {
- if(cache->flag & PTCACHE_QUICK_CACHE)
+ if (mode == PTCACHE_RESET_DEPSGRAPH) {
+ if (!(cache->flag & PTCACHE_BAKED) && !BKE_ptcache_get_continue_physics()) {
+ if (cache->flag & PTCACHE_QUICK_CACHE)
clear= 1;
after= 1;
@@ -2411,43 +2417,43 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
cache->flag |= PTCACHE_OUTDATED;
}
- else if(mode == PTCACHE_RESET_BAKED) {
- if(!BKE_ptcache_get_continue_physics()) {
+ else if (mode == PTCACHE_RESET_BAKED) {
+ if (!BKE_ptcache_get_continue_physics()) {
reset= 1;
clear= 1;
}
else
cache->flag |= PTCACHE_OUTDATED;
}
- else if(mode == PTCACHE_RESET_OUTDATED) {
+ else if (mode == PTCACHE_RESET_OUTDATED) {
reset = 1;
- if(cache->flag & PTCACHE_OUTDATED && !(cache->flag & PTCACHE_BAKED)) {
+ if (cache->flag & PTCACHE_OUTDATED && !(cache->flag & PTCACHE_BAKED)) {
clear= 1;
cache->flag &= ~PTCACHE_OUTDATED;
}
}
- if(reset) {
+ if (reset) {
BKE_ptcache_invalidate(cache);
cache->flag &= ~PTCACHE_REDO_NEEDED;
- if(pid->type == PTCACHE_TYPE_CLOTH)
+ if (pid->type == PTCACHE_TYPE_CLOTH)
cloth_free_modifier(pid->calldata);
- else if(pid->type == PTCACHE_TYPE_SOFTBODY)
+ else if (pid->type == PTCACHE_TYPE_SOFTBODY)
sbFreeSimulation(pid->calldata);
- else if(pid->type == PTCACHE_TYPE_PARTICLES)
+ else if (pid->type == PTCACHE_TYPE_PARTICLES)
psys_reset(pid->calldata, PSYS_RESET_DEPSGRAPH);
- else if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
+ else if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
smokeModifier_reset(pid->calldata);
- else if(pid->type == PTCACHE_TYPE_SMOKE_HIGHRES)
+ else if (pid->type == PTCACHE_TYPE_SMOKE_HIGHRES)
smokeModifier_reset_turbulence(pid->calldata);
- else if(pid->type == PTCACHE_TYPE_DYNAMICPAINT)
+ else if (pid->type == PTCACHE_TYPE_DYNAMICPAINT)
dynamicPaint_clearSurface((DynamicPaintSurface*)pid->calldata);
}
- if(clear)
+ if (clear)
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
- else if(after)
+ else if (after)
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, CFRA);
return (reset || clear || after);
@@ -2462,47 +2468,47 @@ int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode)
reset= 0;
skip= 0;
- if(ob->soft) {
+ if (ob->soft) {
BKE_ptcache_id_from_softbody(&pid, ob, ob->soft);
reset |= BKE_ptcache_id_reset(scene, &pid, mode);
}
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
/* children or just redo can be calculated without reseting anything */
- if(psys->recalc & PSYS_RECALC_REDO || psys->recalc & PSYS_RECALC_CHILD)
+ if (psys->recalc & PSYS_RECALC_REDO || psys->recalc & PSYS_RECALC_CHILD)
skip = 1;
/* Baked cloth hair has to be checked too, because we don't want to reset */
/* particles or cloth in that case -jahka */
- else if(psys->clmd) {
+ else if (psys->clmd) {
BKE_ptcache_id_from_cloth(&pid, ob, psys->clmd);
- if(mode == PSYS_RESET_ALL || !(psys->part->type == PART_HAIR && (pid.cache->flag & PTCACHE_BAKED)))
+ if (mode == PSYS_RESET_ALL || !(psys->part->type == PART_HAIR && (pid.cache->flag & PTCACHE_BAKED)))
reset |= BKE_ptcache_id_reset(scene, &pid, mode);
else
skip = 1;
}
- if(skip == 0 && psys->part) {
+ if (skip == 0 && psys->part) {
BKE_ptcache_id_from_particles(&pid, ob, psys);
reset |= BKE_ptcache_id_reset(scene, &pid, mode);
}
}
- for(md=ob->modifiers.first; md; md=md->next) {
- if(md->type == eModifierType_Cloth) {
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type == eModifierType_Cloth) {
BKE_ptcache_id_from_cloth(&pid, ob, (ClothModifierData*)md);
reset |= BKE_ptcache_id_reset(scene, &pid, mode);
}
- if(md->type == eModifierType_Smoke) {
+ 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) {
+ if (md->type == eModifierType_DynamicPaint) {
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
- if(pmd->canvas)
+ if (pmd->canvas)
{
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
@@ -2540,18 +2546,21 @@ void BKE_ptcache_remove(void)
return;
while ((de = readdir(dir)) != NULL) {
- if( strcmp(de->d_name, ".")==0 || strcmp(de->d_name, "..")==0) {
+ if ( strcmp(de->d_name, ".")==0 || strcmp(de->d_name, "..")==0) {
/* do nothing */
- } else if (strstr(de->d_name, PTCACHE_EXT)) { /* do we have the right extension?*/
+ }
+ else if (strstr(de->d_name, PTCACHE_EXT)) { /* do we have the right extension?*/
BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
BLI_delete(path_full, 0, 0);
- } else {
- rmdir = 0; /* unknown file, dont remove the dir */
+ }
+ else {
+ rmdir = 0; /* unknown file, don't remove the dir */
}
}
closedir(dir);
- } else {
+ }
+ else {
rmdir = 0; /* path dosnt exist */
}
@@ -2568,12 +2577,12 @@ void BKE_ptcache_set_continue_physics(Main *bmain, Scene *scene, int enable)
{
Object *ob;
- if(CONTINUE_PHYSICS != enable) {
+ if (CONTINUE_PHYSICS != enable) {
CONTINUE_PHYSICS = enable;
- if(CONTINUE_PHYSICS == 0) {
- for(ob=bmain->object.first; ob; ob=ob->id.next)
- if(BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED))
+ if (CONTINUE_PHYSICS == 0) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next)
+ if (BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED))
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
}
@@ -2605,8 +2614,8 @@ void BKE_ptcache_free_mem(ListBase *mem_cache)
{
PTCacheMem *pm = mem_cache->first;
- if(pm) {
- for(; pm; pm=pm->next) {
+ if (pm) {
+ for (; pm; pm=pm->next) {
ptcache_data_free(pm);
ptcache_extra_free(pm);
}
@@ -2617,9 +2626,9 @@ void BKE_ptcache_free_mem(ListBase *mem_cache)
void BKE_ptcache_free(PointCache *cache)
{
BKE_ptcache_free_mem(&cache->mem_cache);
- if(cache->edit && cache->free_edit)
+ if (cache->edit && cache->free_edit)
cache->free_edit(cache->edit);
- if(cache->cached_frames)
+ if (cache->cached_frames)
MEM_freeN(cache->cached_frames);
MEM_freeN(cache);
}
@@ -2627,7 +2636,7 @@ void BKE_ptcache_free_list(ListBase *ptcaches)
{
PointCache *cache = ptcaches->first;
- while(cache) {
+ while (cache) {
BLI_remlink(ptcaches, cache);
BKE_ptcache_free(cache);
cache = ptcaches->first;
@@ -2658,7 +2667,7 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old
ptcaches_new->first = ptcaches_new->last = NULL;
- for(; cache; cache=cache->next)
+ for (; cache; cache=cache->next)
BLI_addtail(ptcaches_new, ptcache_copy(cache));
return ptcaches_new->first;
@@ -2700,8 +2709,8 @@ typedef struct {
static void ptcache_dt_to_str(char *str, double dtime)
{
- if(dtime > 60.0) {
- if(dtime > 3600.0)
+ if (dtime > 60.0) {
+ if (dtime > 3600.0)
sprintf(str, "%ih %im %is", (int)(dtime/3600), ((int)(dtime/60))%60, ((int)dtime) % 60);
else
sprintf(str, "%im %is", ((int)(dtime/60))%60, ((int)dtime) % 60);
@@ -2722,9 +2731,9 @@ static void *ptcache_bake_thread(void *ptr)
sfra = *data->cfra_ptr;
efra = data->endframe;
- for(; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) {
+ for (; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) {
scene_update_for_newframe(data->main, data->scene, data->scene->lay);
- if(G.background) {
+ if (G.background) {
printf("bake: frame %d :: %d\n", (int)*data->cfra_ptr, data->endframe);
}
else {
@@ -2732,7 +2741,7 @@ static void *ptcache_bake_thread(void *ptr)
fetd = (ctime-ptime)*(efra-*data->cfra_ptr)/data->step;
- if(usetimer || fetd > 60.0) {
+ if (usetimer || fetd > 60.0) {
usetimer = 1;
ptcache_dt_to_str(cur, ctime-ptime);
@@ -2745,7 +2754,7 @@ static void *ptcache_bake_thread(void *ptr)
}
}
- if(usetimer) {
+ if (usetimer) {
ptcache_dt_to_str(run, PIL_check_seconds_timer()-stime);
printf("Bake %s %s (%i frames simulated). \n", (data->break_operation ? "canceled after" : "finished in"), run, *data->cfra_ptr-sfra);
}
@@ -2782,29 +2791,29 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
G.afbreek = 0;
/* set caches to baking mode and figure out start frame */
- if(pid) {
+ if (pid) {
/* cache/bake a single object */
cache = pid->cache;
- if((cache->flag & PTCACHE_BAKED)==0) {
- if(pid->type==PTCACHE_TYPE_PARTICLES) {
+ if ((cache->flag & PTCACHE_BAKED)==0) {
+ if (pid->type==PTCACHE_TYPE_PARTICLES) {
ParticleSystem *psys= pid->calldata;
/* a bit confusing, could make this work better in the UI */
- if(psys->part->type == PART_EMITTER)
+ if (psys->part->type == PART_EMITTER)
psys_get_pointcache_start_end(scene, pid->calldata, &cache->startframe, &cache->endframe);
}
- else if(pid->type == PTCACHE_TYPE_SMOKE_HIGHRES) {
+ else if (pid->type == PTCACHE_TYPE_SMOKE_HIGHRES) {
/* get all pids from the object and search for smoke low res */
ListBase pidlist2;
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)
+ for (pid2=pidlist2.first; pid2; pid2=pid2->next) {
+ if (pid2->type == PTCACHE_TYPE_SMOKE_DOMAIN)
{
- if(pid2->cache && !(pid2->cache->flag & PTCACHE_BAKED)) {
- if(bake || pid2->cache->flag & PTCACHE_REDO_NEEDED)
+ 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);
- if(bake) {
+ if (bake) {
pid2->cache->flag |= PTCACHE_BAKING;
pid2->cache->flag &= ~PTCACHE_BAKED;
}
@@ -2814,12 +2823,12 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
BLI_freelistN(&pidlist2);
}
- if(bake || cache->flag & PTCACHE_REDO_NEEDED)
+ if (bake || cache->flag & PTCACHE_REDO_NEEDED)
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
startframe = MAX2(cache->last_exact, cache->startframe);
- if(bake) {
+ if (bake) {
thread_data.endframe = cache->endframe;
cache->flag |= PTCACHE_BAKING;
}
@@ -2830,32 +2839,32 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
cache->flag &= ~PTCACHE_BAKED;
}
}
- else for(SETLOOPER(scene, sce_iter, base)) {
+ else for (SETLOOPER(scene, sce_iter, base)) {
/* cache/bake everything in the scene */
BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
- for(pid=pidlist.first; pid; pid=pid->next) {
+ for (pid=pidlist.first; pid; pid=pid->next) {
cache = pid->cache;
- if((cache->flag & PTCACHE_BAKED)==0) {
- if(pid->type==PTCACHE_TYPE_PARTICLES) {
+ if ((cache->flag & PTCACHE_BAKED)==0) {
+ if (pid->type==PTCACHE_TYPE_PARTICLES) {
ParticleSystem *psys = (ParticleSystem*)pid->calldata;
/* skip hair & keyed particles */
- if(psys->part->type == PART_HAIR || psys->part->phystype == PART_PHYS_KEYED)
+ if (psys->part->type == PART_HAIR || psys->part->phystype == PART_PHYS_KEYED)
continue;
psys_get_pointcache_start_end(scene, pid->calldata, &cache->startframe, &cache->endframe);
}
- if((cache->flag & PTCACHE_REDO_NEEDED || (cache->flag & PTCACHE_SIMULATION_VALID)==0)
+ if ((cache->flag & PTCACHE_REDO_NEEDED || (cache->flag & PTCACHE_SIMULATION_VALID)==0)
&& ((cache->flag & PTCACHE_QUICK_CACHE)==0 || render || bake))
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
startframe = MIN2(startframe, cache->startframe);
- if(bake || render) {
+ if (bake || render) {
cache->flag |= PTCACHE_BAKING;
- if(bake)
+ if (bake)
thread_data.endframe = MAX2(thread_data.endframe, cache->endframe);
}
@@ -2874,7 +2883,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
WM_cursor_wait(1);
- if(G.background) {
+ if (G.background) {
ptcache_bake_thread((void*)&thread_data);
}
else {
@@ -2883,7 +2892,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
while (thread_data.thread_ended == FALSE) {
- if(bake)
+ if (bake)
progress = (int)(100.0f * (float)(CFRA - startframe)/(float)(thread_data.endframe-startframe));
else
progress = CFRA;
@@ -2898,7 +2907,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
PIL_sleep_ms(200);
/* NOTE: breaking baking should leave calculated frames in cache, not clear it */
- if(blender_test_break() && !thread_data.break_operation) {
+ if (blender_test_break() && !thread_data.break_operation) {
thread_data.break_operation = TRUE;
if (baker->progressend)
baker->progressend(baker->progresscontext);
@@ -2909,36 +2918,36 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
BLI_end_threads(&threads);
}
/* clear baking flag */
- if(pid) {
+ if (pid) {
cache->flag &= ~(PTCACHE_BAKING|PTCACHE_REDO_NEEDED);
cache->flag |= PTCACHE_SIMULATION_VALID;
- if(bake) {
+ if (bake) {
cache->flag |= PTCACHE_BAKED;
/* write info file */
- if(cache->flag & PTCACHE_DISK_CACHE)
+ if (cache->flag & PTCACHE_DISK_CACHE)
BKE_ptcache_write(pid, 0);
}
}
- else for(SETLOOPER(scene, sce_iter, base)) {
+ else for (SETLOOPER(scene, sce_iter, base)) {
BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
- for(pid=pidlist.first; pid; pid=pid->next) {
+ for (pid=pidlist.first; pid; pid=pid->next) {
/* skip hair particles */
- if(pid->type==PTCACHE_TYPE_PARTICLES && ((ParticleSystem*)pid->calldata)->part->type == PART_HAIR)
+ if (pid->type==PTCACHE_TYPE_PARTICLES && ((ParticleSystem*)pid->calldata)->part->type == PART_HAIR)
continue;
cache = pid->cache;
- if(thread_data.step > 1)
+ if (thread_data.step > 1)
cache->flag &= ~(PTCACHE_BAKING|PTCACHE_OUTDATED);
else
cache->flag &= ~(PTCACHE_BAKING|PTCACHE_REDO_NEEDED);
cache->flag |= PTCACHE_SIMULATION_VALID;
- if(bake) {
+ if (bake) {
cache->flag |= PTCACHE_BAKED;
- if(cache->flag & PTCACHE_DISK_CACHE)
+ if (cache->flag & PTCACHE_DISK_CACHE)
BKE_ptcache_write(pid, 0);
}
}
@@ -2948,7 +2957,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
scene->r.framelen = frameleno;
CFRA = cfrao;
- if(bake) /* already on cfra unless baking */
+ if (bake) /* already on cfra unless baking */
scene_update_for_newframe(bmain, scene, scene->lay);
if (thread_data.break_operation)
@@ -2977,10 +2986,10 @@ void BKE_ptcache_disk_to_mem(PTCacheID *pid)
/* restore possible bake flag */
cache->flag |= baked;
- for(cfra=sfra; cfra <= efra; cfra++) {
+ for (cfra=sfra; cfra <= efra; cfra++) {
pm = ptcache_disk_frame_to_mem(pid, cfra);
- if(pm)
+ if (pm)
BLI_addtail(&pid->cache->mem_cache, pm);
}
}
@@ -2999,15 +3008,15 @@ void BKE_ptcache_mem_to_disk(PTCacheID *pid)
/* restore possible bake flag */
cache->flag |= baked;
- for(; pm; pm=pm->next) {
- if(ptcache_mem_frame_to_disk(pid, pm)==0) {
+ for (; pm; pm=pm->next) {
+ if (ptcache_mem_frame_to_disk(pid, pm)==0) {
cache->flag &= ~PTCACHE_DISK_CACHE;
break;
}
}
/* write info file */
- if(cache->flag & PTCACHE_BAKED)
+ if (cache->flag & PTCACHE_BAKED)
BKE_ptcache_write(pid, 0);
}
void BKE_ptcache_toggle_disk_cache(PTCacheID *pid)
@@ -3022,12 +3031,12 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid)
return;
}
- if(cache->cached_frames) {
+ if (cache->cached_frames) {
MEM_freeN(cache->cached_frames);
cache->cached_frames=NULL;
}
- if(cache->flag & PTCACHE_DISK_CACHE)
+ if (cache->flag & PTCACHE_DISK_CACHE)
BKE_ptcache_mem_to_disk(pid);
else
BKE_ptcache_disk_to_mem(pid);
@@ -3066,7 +3075,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c
ptcache_path(pid, path);
dir = opendir(path);
- if(dir==NULL) {
+ if (dir==NULL) {
BLI_strncpy(pid->cache->name, old_name, sizeof(pid->cache->name));
return;
}
@@ -3115,7 +3124,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
char filename[MAX_PTCACHE_FILE];
char ext[MAX_PTCACHE_PATH];
- if(!cache)
+ if (!cache)
return;
ptcache_path(pid, path);
@@ -3126,7 +3135,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
if (dir==NULL)
return;
- if(cache->index >= 0)
+ if (cache->index >= 0)
BLI_snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index);
else
BLI_strncpy(ext, PTCACHE_EXT, sizeof(ext));
@@ -3142,7 +3151,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num));
frame = atoi(num);
- if(frame) {
+ if (frame) {
start = MIN2(start, frame);
end = MAX2(end, frame);
}
@@ -3154,22 +3163,22 @@ void BKE_ptcache_load_external(PTCacheID *pid)
}
closedir(dir);
- if(start != MAXFRAME) {
+ if (start != MAXFRAME) {
PTCacheFile *pf;
cache->startframe = start;
cache->endframe = end;
cache->totpoint = 0;
- if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
+ if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
; /*necessary info in every file*/
/* read totpoint from info file (frame 0) */
- else if(info) {
+ else if (info) {
pf= ptcache_file_open(pid, PTCACHE_FILE_READ, 0);
- if(pf) {
- if(ptcache_file_header_begin_read(pf)) {
- if(pf->type == pid->type && pid->read_header(pf)) {
+ if (pf) {
+ if (ptcache_file_header_begin_read(pf)) {
+ if (pf->type == pid->type && pid->read_header(pf)) {
cache->totpoint = pf->totpoint;
cache->flag |= PTCACHE_READ_INFO;
}
@@ -3186,8 +3195,8 @@ void BKE_ptcache_load_external(PTCacheID *pid)
int elemsize = ptcache_old_elemsize(pid);
pf= ptcache_file_open(pid, PTCACHE_FILE_READ, cache->startframe);
- if(pf) {
- while(ptcache_file_read(pf, old_data, 1, elemsize))
+ if (pf) {
+ while (ptcache_file_read(pf, old_data, 1, elemsize))
cache->totpoint++;
ptcache_file_close(pf);
@@ -3207,30 +3216,30 @@ void BKE_ptcache_update_info(PTCacheID *pid)
int totframes = 0;
char mem_info[64];
- if(cache->flag & PTCACHE_EXTERNAL) {
+ if (cache->flag & PTCACHE_EXTERNAL) {
int cfra = cache->startframe;
- for(; cfra<=cache->endframe; cfra++) {
- if(BKE_ptcache_id_exist(pid, cfra))
+ for (; cfra<=cache->endframe; cfra++) {
+ if (BKE_ptcache_id_exist(pid, cfra))
totframes++;
}
/* smoke doesn't use frame 0 as info frame so can't check based on totpoint */
- if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN && totframes)
+ if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN && totframes)
BLI_snprintf(cache->info, sizeof(cache->info), "%i frames found!", totframes);
- else if(totframes && cache->totpoint)
+ else if (totframes && cache->totpoint)
BLI_snprintf(cache->info, sizeof(cache->info), "%i points found!", cache->totpoint);
else
BLI_snprintf(cache->info, sizeof(cache->info), "No valid data to read!");
return;
}
- if(cache->flag & PTCACHE_DISK_CACHE) {
- if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
+ if (cache->flag & PTCACHE_DISK_CACHE) {
+ if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
{
int totpoint = pid->totpoint(pid->calldata, 0);
- if(cache->totpoint > totpoint)
+ if (cache->totpoint > totpoint)
BLI_snprintf(mem_info, sizeof(mem_info), "%i cells + High Resolution cached", totpoint);
else
BLI_snprintf(mem_info, sizeof(mem_info), "%i cells cached", totpoint);
@@ -3238,8 +3247,8 @@ void BKE_ptcache_update_info(PTCacheID *pid)
else {
int cfra = cache->startframe;
- for(; cfra<=cache->endframe; cfra++) {
- if(BKE_ptcache_id_exist(pid, cfra))
+ for (; cfra<=cache->endframe; cfra++) {
+ if (BKE_ptcache_id_exist(pid, cfra))
totframes++;
}
@@ -3251,11 +3260,11 @@ void BKE_ptcache_update_info(PTCacheID *pid)
float bytes = 0.0f;
int i, mb;
- for(; pm; pm=pm->next) {
- for(i=0; i<BPHYS_TOT_DATA; i++)
+ for (; pm; pm=pm->next) {
+ for (i=0; i<BPHYS_TOT_DATA; i++)
bytes += MEM_allocN_len(pm->data[i]);
- for(extra=pm->extradata.first; extra; extra=extra->next) {
+ for (extra=pm->extradata.first; extra; extra=extra->next) {
bytes += MEM_allocN_len(extra->data);
bytes += sizeof(PTCacheExtra);
}
@@ -3273,10 +3282,10 @@ void BKE_ptcache_update_info(PTCacheID *pid)
mb ? "Mb" : "kb");
}
- if(cache->flag & PTCACHE_OUTDATED) {
+ if (cache->flag & PTCACHE_OUTDATED) {
BLI_snprintf(cache->info, sizeof(cache->info), "%s, cache is outdated!", mem_info);
}
- else if(cache->flag & PTCACHE_FRAMES_SKIPPED) {
+ else if (cache->flag & PTCACHE_FRAMES_SKIPPED) {
BLI_snprintf(cache->info, sizeof(cache->info), "%s, not exact since frame %i.", mem_info, cache->last_exact);
}
else {
@@ -3286,14 +3295,14 @@ void BKE_ptcache_update_info(PTCacheID *pid)
void BKE_ptcache_validate(PointCache *cache, int framenr)
{
- if(cache) {
+ if (cache) {
cache->flag |= PTCACHE_SIMULATION_VALID;
cache->simframe = framenr;
}
}
void BKE_ptcache_invalidate(PointCache *cache)
{
- if(cache) {
+ if (cache) {
cache->flag &= ~PTCACHE_SIMULATION_VALID;
cache->simframe = 0;
cache->last_exact = MIN2(cache->startframe, 0);
diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c
index baf682b4cb6..066de61575d 100644
--- a/source/blender/blenkernel/intern/property.c
+++ b/source/blender/blenkernel/intern/property.c
@@ -48,7 +48,7 @@
void free_property(bProperty *prop)
{
- if(prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
+ if (prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
MEM_freeN(prop);
}
@@ -57,7 +57,7 @@ void free_properties(ListBase *lb)
{
bProperty *prop;
- while( (prop= lb->first) ) {
+ while ( (prop= lb->first) ) {
BLI_remlink(lb, prop);
free_property(prop);
}
@@ -68,7 +68,7 @@ bProperty *copy_property(bProperty *prop)
bProperty *propn;
propn= MEM_dupallocN(prop);
- if(prop->poin && prop->poin != &prop->data) {
+ if (prop->poin && prop->poin != &prop->data) {
propn->poin= MEM_dupallocN(prop->poin);
}
else propn->poin= &propn->data;
@@ -79,9 +79,9 @@ bProperty *copy_property(bProperty *prop)
void copy_properties(ListBase *lbn, ListBase *lbo)
{
bProperty *prop, *propn;
- free_properties( lbn ); /* in case we are copying to an object with props */
+ free_properties(lbn); /* in case we are copying to an object with props */
prop= lbo->first;
- while(prop) {
+ while (prop) {
propn= copy_property(prop);
BLI_addtail(lbn, propn);
prop= prop->next;
@@ -94,7 +94,7 @@ void init_property(bProperty *prop)
{
/* also use when property changes type */
- if(prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
+ if (prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
prop->poin= NULL;
prop->data= 0;
@@ -131,7 +131,7 @@ bProperty *new_property(int type)
static bProperty *get_property__internal(bProperty *first, bProperty *self, const char *name)
{
bProperty *p;
- for(p= first; p; p= p->next) {
+ for (p= first; p; p= p->next) {
if (p!=self && (strcmp(p->name, name)==0))
return p;
}
@@ -142,21 +142,22 @@ void unique_property(bProperty *first, bProperty *prop, int force)
bProperty *p;
/* set the first if its not set */
- if(first==NULL) {
+ if (first==NULL) {
first= prop;
- while(first->prev) {
+ while (first->prev) {
first= first->prev;
}
}
- if(force) {
+ if (force) {
/* change other names to make them unique */
- while((p = get_property__internal(first, prop, prop->name))) {
+ while ((p = get_property__internal(first, prop, prop->name))) {
unique_property(first, p, 0);
}
- }else {
+ }
+ else {
/* change our own name until its unique */
- if(get_property__internal(first, prop, prop->name)) {
+ if (get_property__internal(first, prop, prop->name)) {
/* there is a collision */
char new_name[sizeof(prop->name)];
char base_name[sizeof(prop->name)];
@@ -165,7 +166,7 @@ void unique_property(bProperty *first, bProperty *prop, int force)
/* strip numbers */
BLI_strncpy(base_name, prop->name, sizeof(base_name));
- for(i= strlen(base_name)-1; (i>=0 && isdigit(base_name[i])); i--) {
+ for (i= strlen(base_name)-1; (i>=0 && isdigit(base_name[i])); i--) {
base_name[i]= '\0';
}
i= 0;
@@ -174,7 +175,7 @@ void unique_property(bProperty *first, bProperty *prop, int force)
BLI_snprintf(num, sizeof(num), "%d", i++);
BLI_strncpy(new_name, base_name, sizeof(prop->name) - strlen(num));
strcat(new_name, num);
- } while(get_property__internal(first, prop, new_name));
+ } while (get_property__internal(first, prop, new_name));
BLI_strncpy(prop->name, new_name, sizeof(prop->name));
}
@@ -190,7 +191,7 @@ void set_ob_property(Object *ob, bProperty *propc)
{
bProperty *prop;
prop= get_ob_property(ob, propc->name);
- if(prop) {
+ if (prop) {
free_property(prop);
BLI_remlink(&ob->prop, prop);
}
@@ -207,12 +208,12 @@ int compare_property(bProperty *prop, const char *str)
switch(prop->type) {
case GPROP_BOOL:
- if(BLI_strcasecmp(str, "true")==0) {
- if(prop->data==1) return 0;
+ if (BLI_strcasecmp(str, "true")==0) {
+ if (prop->data==1) return 0;
else return 1;
}
- else if(BLI_strcasecmp(str, "false")==0) {
- if(prop->data==0) return 0;
+ else if (BLI_strcasecmp(str, "false")==0) {
+ if (prop->data==0) return 0;
else return 1;
}
/* no break, do GPROP_int too! */
@@ -226,8 +227,8 @@ int compare_property(bProperty *prop, const char *str)
// function isn't used currently
fvalue= *((float *)&prop->data);
ftest= (float)atof(str);
- if( fvalue > ftest) return 1;
- else if( fvalue < ftest) return -1;
+ if ( fvalue > ftest) return 1;
+ else if ( fvalue < ftest) return -1;
return 0;
case GPROP_STRING:
@@ -243,8 +244,8 @@ void set_property(bProperty *prop, const char *str)
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;
+ if (BLI_strcasecmp(str, "true")==0) prop->data= 1;
+ else if (BLI_strcasecmp(str, "false")==0) prop->data= 0;
else prop->data= (atoi(str)!=0);
break;
case GPROP_INT:
@@ -285,7 +286,7 @@ void set_property_valstr(bProperty *prop, char *str)
{
// extern int Gdfra; /* sector.c */
- if(str == NULL) return;
+ if (str == NULL) return;
switch(prop->type) {
case GPROP_BOOL:
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index ffa9e027108..b3e288dfc74 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -37,7 +37,6 @@
#include "BKE_report.h"
#include "BKE_global.h" /* G.background only */
-
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@@ -59,7 +58,7 @@ static const char *report_type_str(int type)
void BKE_reports_init(ReportList *reports, int flag)
{
- if(!reports)
+ if (!reports)
return;
memset(reports, 0, sizeof(ReportList));
@@ -73,7 +72,7 @@ void BKE_reports_clear(ReportList *reports)
{
Report *report, *report_next;
- if(!reports)
+ if (!reports)
return;
report= reports->list.first;
@@ -95,12 +94,12 @@ void BKE_report(ReportList *reports, ReportType type, const char *message)
/* in background mode always print otherwise there are cases the errors wont be displayed,
* but still add to the report list since this is used for python exception handling */
- if(G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) {
+ if (G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) {
printf("%s: %s\n", report_type_str(type), message);
fflush(stdout); /* this ensures the message is printed before a crash */
}
- if(reports && (reports->flag & RPT_STORE) && (type >= reports->storelevel)) {
+ if (reports && (reports->flag & RPT_STORE) && (type >= reports->storelevel)) {
char *message_alloc;
report= MEM_callocN(sizeof(Report), "Report");
report->type= type;
@@ -121,7 +120,7 @@ void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
Report *report;
va_list args;
- if(G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) {
+ if (G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) {
va_start(args, format);
vprintf(format, args);
va_end(args);
@@ -129,7 +128,7 @@ void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
fflush(stdout); /* this ensures the message is printed before a crash */
}
- if(reports && (reports->flag & RPT_STORE) && (type >= reports->storelevel)) {
+ if (reports && (reports->flag & RPT_STORE) && (type >= reports->storelevel)) {
report= MEM_callocN(sizeof(Report), "Report");
ds= BLI_dynstr_new();
@@ -153,10 +152,10 @@ void BKE_reports_prepend(ReportList *reports, const char *prepend)
Report *report;
DynStr *ds;
- if(!reports)
+ if (!reports)
return;
- for(report=reports->list.first; report; report=report->next) {
+ for (report=reports->list.first; report; report=report->next) {
ds= BLI_dynstr_new();
BLI_dynstr_append(ds, prepend);
@@ -176,10 +175,10 @@ void BKE_reports_prependf(ReportList *reports, const char *prepend, ...)
DynStr *ds;
va_list args;
- if(!reports)
+ if (!reports)
return;
- for(report=reports->list.first; report; report=report->next) {
+ for (report=reports->list.first; report; report=report->next) {
ds= BLI_dynstr_new();
va_start(args, prepend);
BLI_dynstr_vappendf(ds, prepend, args);
@@ -197,7 +196,7 @@ void BKE_reports_prependf(ReportList *reports, const char *prepend, ...)
ReportType BKE_report_print_level(ReportList *reports)
{
- if(!reports)
+ if (!reports)
return RPT_ERROR;
return reports->printlevel;
@@ -205,7 +204,7 @@ ReportType BKE_report_print_level(ReportList *reports)
void BKE_report_print_level_set(ReportList *reports, ReportType level)
{
- if(!reports)
+ if (!reports)
return;
reports->printlevel= level;
@@ -213,7 +212,7 @@ void BKE_report_print_level_set(ReportList *reports, ReportType level)
ReportType BKE_report_store_level(ReportList *reports)
{
- if(!reports)
+ if (!reports)
return RPT_ERROR;
return reports->storelevel;
@@ -221,7 +220,7 @@ ReportType BKE_report_store_level(ReportList *reports)
void BKE_report_store_level_set(ReportList *reports, ReportType level)
{
- if(!reports)
+ if (!reports)
return;
reports->storelevel= level;
@@ -233,12 +232,12 @@ char *BKE_reports_string(ReportList *reports, ReportType level)
DynStr *ds;
char *cstring;
- if(!reports || !reports->list.first)
+ if (!reports || !reports->list.first)
return NULL;
ds= BLI_dynstr_new();
- for(report=reports->list.first; report; report=report->next)
- if(report->type >= level)
+ for (report=reports->list.first; report; report=report->next)
+ if (report->type >= level)
BLI_dynstr_appendf(ds, "%s: %s\n", report->typestr, report->message);
if (BLI_dynstr_get_len(ds))
@@ -257,19 +256,31 @@ void BKE_reports_print(ReportList *reports, ReportType level)
if (cstring == NULL)
return;
- printf("%s", cstring);
+ puts(cstring);
fflush(stdout);
MEM_freeN(cstring);
}
Report *BKE_reports_last_displayable(ReportList *reports)
{
- Report *report=NULL;
+ Report *report;
- for (report= (Report *)reports->list.last; report; report=report->prev) {
+ for (report= reports->list.last; report; report=report->prev) {
if (ELEM3(report->type, RPT_ERROR, RPT_WARNING, RPT_INFO))
return report;
}
return NULL;
}
+
+int BKE_reports_contain(ReportList *reports, ReportType level)
+{
+ Report *report;
+ if (reports != NULL) {
+ for (report=reports->list.first; report; report=report->next)
+ if (report->type >= level)
+ return TRUE;
+ }
+ return FALSE;
+}
+
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index 30a7449be1b..8123cbf3f0b 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -54,8 +54,8 @@
void free_sensor(bSensor *sens)
{
- if(sens->links) MEM_freeN(sens->links);
- if(sens->data) MEM_freeN(sens->data);
+ if (sens->links) MEM_freeN(sens->links);
+ if (sens->data) MEM_freeN(sens->data);
MEM_freeN(sens);
}
@@ -64,7 +64,7 @@ void free_sensors(ListBase *lb)
{
bSensor *sens;
- while((sens= lb->first)) {
+ while ((sens= lb->first)) {
BLI_remlink(lb, sens);
free_sensor(sens);
}
@@ -76,11 +76,11 @@ bSensor *copy_sensor(bSensor *sens)
sensn= MEM_dupallocN(sens);
sensn->flag |= SENS_NEW;
- if(sens->data) {
+ if (sens->data) {
sensn->data= MEM_dupallocN(sens->data);
}
- if(sens->links) sensn->links= MEM_dupallocN(sens->links);
+ if (sens->links) sensn->links= MEM_dupallocN(sens->links);
return sensn;
}
@@ -91,7 +91,7 @@ void copy_sensors(ListBase *lbn, ListBase *lbo)
lbn->first= lbn->last= NULL;
sens= lbo->first;
- while(sens) {
+ while (sens) {
sensn= copy_sensor(sens);
BLI_addtail(lbn, sensn);
sens= sens->next;
@@ -106,7 +106,7 @@ void init_sensor(bSensor *sens)
bJoystickSensor *js;
bRaySensor *rs;
- if(sens->data) MEM_freeN(sens->data);
+ if (sens->data) MEM_freeN(sens->data);
sens->data= NULL;
sens->pulse = 0;
@@ -196,9 +196,9 @@ void unlink_controller(bController *cont)
/* check for controller pointers in sensors */
ob= G.main->object.first;
- while(ob) {
+ while (ob) {
sens= ob->sensors.first;
- while(sens) {
+ while (sens) {
unlink_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks);
sens= sens->next;
}
@@ -216,10 +216,10 @@ void unlink_controllers(ListBase *lb)
void free_controller(bController *cont)
{
- if(cont->links) MEM_freeN(cont->links);
+ if (cont->links) MEM_freeN(cont->links);
/* the controller itself */
- if(cont->data) MEM_freeN(cont->data);
+ if (cont->data) MEM_freeN(cont->data);
MEM_freeN(cont);
}
@@ -228,9 +228,9 @@ void free_controllers(ListBase *lb)
{
bController *cont;
- while((cont= lb->first)) {
+ while ((cont= lb->first)) {
BLI_remlink(lb, cont);
- if(cont->slinks) MEM_freeN(cont->slinks);
+ if (cont->slinks) MEM_freeN(cont->slinks);
free_controller(cont);
}
}
@@ -241,11 +241,11 @@ bController *copy_controller(bController *cont)
cont->mynew=contn= MEM_dupallocN(cont);
contn->flag |= CONT_NEW;
- if(cont->data) {
+ if (cont->data) {
contn->data= MEM_dupallocN(cont->data);
}
- if(cont->links) contn->links= MEM_dupallocN(cont->links);
+ if (cont->links) contn->links= MEM_dupallocN(cont->links);
contn->slinks= NULL;
contn->totslinks= 0;
@@ -258,7 +258,7 @@ void copy_controllers(ListBase *lbn, ListBase *lbo)
lbn->first= lbn->last= NULL;
cont= lbo->first;
- while(cont) {
+ while (cont) {
contn= copy_controller(cont);
BLI_addtail(lbn, contn);
cont= cont->next;
@@ -269,7 +269,7 @@ void init_controller(bController *cont)
{
/* also use when controller changes type, leave actuators... */
- if(cont->data) MEM_freeN(cont->data);
+ if (cont->data) MEM_freeN(cont->data);
cont->data= NULL;
switch(cont->type) {
@@ -307,9 +307,9 @@ void unlink_actuator(bActuator *act)
/* check for actuator pointers in controllers */
ob= G.main->object.first;
- while(ob) {
+ while (ob) {
cont= ob->controllers.first;
- while(cont) {
+ while (cont) {
unlink_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks);
cont= cont->next;
}
@@ -329,11 +329,11 @@ void free_actuator(bActuator *act)
{
bSoundActuator *sa;
- if(act->data) {
+ if (act->data) {
switch (act->type) {
case ACT_SOUND:
sa = (bSoundActuator *) act->data;
- if(sa->sound)
+ if (sa->sound)
id_us_min((ID *) sa->sound);
break;
}
@@ -347,7 +347,7 @@ void free_actuators(ListBase *lb)
{
bActuator *act;
- while((act= lb->first)) {
+ while ((act= lb->first)) {
BLI_remlink(lb, act);
free_actuator(act);
}
@@ -360,14 +360,14 @@ bActuator *copy_actuator(bActuator *act)
act->mynew=actn= MEM_dupallocN(act);
actn->flag |= ACT_NEW;
- if(act->data) {
+ if (act->data) {
actn->data= MEM_dupallocN(act->data);
}
switch (act->type) {
case ACT_SOUND:
sa= (bSoundActuator *)act->data;
- if(sa->sound)
+ if (sa->sound)
id_us_plus((ID *) sa->sound);
break;
}
@@ -380,7 +380,7 @@ void copy_actuators(ListBase *lbn, ListBase *lbo)
lbn->first= lbn->last= NULL;
act= lbo->first;
- while(act) {
+ while (act) {
actn= copy_actuator(act);
BLI_addtail(lbn, actn);
act= act->next;
@@ -397,7 +397,7 @@ void init_actuator(bActuator *act)
bSteeringActuator *sta;
bArmatureActuator *arma;
- if(act->data) MEM_freeN(act->data);
+ if (act->data) MEM_freeN(act->data);
act->data= NULL;
switch(act->type) {
@@ -512,18 +512,18 @@ void clear_sca_new_poins_ob(Object *ob)
bActuator *act;
sens= ob->sensors.first;
- while(sens) {
+ while (sens) {
sens->flag &= ~SENS_NEW;
sens= sens->next;
}
cont= ob->controllers.first;
- while(cont) {
+ while (cont) {
cont->mynew= NULL;
cont->flag &= ~CONT_NEW;
cont= cont->next;
}
act= ob->actuators.first;
- while(act) {
+ while (act) {
act->mynew= NULL;
act->flag &= ~ACT_NEW;
act= act->next;
@@ -535,7 +535,7 @@ void clear_sca_new_poins(void)
Object *ob;
ob= G.main->object.first;
- while(ob) {
+ while (ob) {
clear_sca_new_poins_ob(ob);
ob= ob->id.next;
}
@@ -549,10 +549,10 @@ void set_sca_new_poins_ob(Object *ob)
int a;
sens= ob->sensors.first;
- while(sens) {
- if(sens->flag & SENS_NEW) {
- for(a=0; a<sens->totlinks; a++) {
- if(sens->links[a] && sens->links[a]->mynew)
+ while (sens) {
+ if (sens->flag & SENS_NEW) {
+ for (a=0; a<sens->totlinks; a++) {
+ if (sens->links[a] && sens->links[a]->mynew)
sens->links[a]= sens->links[a]->mynew;
}
}
@@ -560,10 +560,10 @@ void set_sca_new_poins_ob(Object *ob)
}
cont= ob->controllers.first;
- while(cont) {
- if(cont->flag & CONT_NEW) {
- for(a=0; a<cont->totlinks; a++) {
- if( cont->links[a] && cont->links[a]->mynew)
+ while (cont) {
+ if (cont->flag & CONT_NEW) {
+ for (a=0; a<cont->totlinks; a++) {
+ if ( cont->links[a] && cont->links[a]->mynew)
cont->links[a]= cont->links[a]->mynew;
}
}
@@ -572,42 +572,42 @@ void set_sca_new_poins_ob(Object *ob)
act= ob->actuators.first;
- while(act) {
- if(act->flag & ACT_NEW) {
- if(act->type==ACT_EDIT_OBJECT) {
+ while (act) {
+ if (act->flag & ACT_NEW) {
+ if (act->type==ACT_EDIT_OBJECT) {
bEditObjectActuator *eoa= act->data;
ID_NEW(eoa->ob);
}
- else if(act->type==ACT_SCENE) {
+ else if (act->type==ACT_SCENE) {
bSceneActuator *sca= act->data;
ID_NEW(sca->camera);
}
- else if(act->type==ACT_CAMERA) {
+ else if (act->type==ACT_CAMERA) {
bCameraActuator *ca= act->data;
ID_NEW(ca->ob);
}
- else if(act->type==ACT_OBJECT) {
+ else if (act->type==ACT_OBJECT) {
bObjectActuator *oa= act->data;
ID_NEW(oa->reference);
}
- else if(act->type==ACT_MESSAGE) {
+ else if (act->type==ACT_MESSAGE) {
bMessageActuator *ma= act->data;
ID_NEW(ma->toObject);
}
- else if(act->type==ACT_PARENT) {
+ else if (act->type==ACT_PARENT) {
bParentActuator *para = act->data;
ID_NEW(para->ob);
}
- else if(act->type==ACT_ARMATURE) {
+ else if (act->type==ACT_ARMATURE) {
bArmatureActuator *aa = act->data;
ID_NEW(aa->target);
ID_NEW(aa->subtarget);
}
- else if(act->type==ACT_PROPERTY) {
+ else if (act->type==ACT_PROPERTY) {
bPropertyActuator *pa= act->data;
ID_NEW(pa->ob);
}
- else if(act->type==ACT_STEERING) {
+ else if (act->type==ACT_STEERING) {
bSteeringActuator *sta = act->data;
ID_NEW(sta->navmesh);
ID_NEW(sta->target);
@@ -623,7 +623,7 @@ void set_sca_new_poins(void)
Object *ob;
ob= G.main->object.first;
- while(ob) {
+ while (ob) {
set_sca_new_poins_ob(ob);
ob= ob->id.next;
}
@@ -646,41 +646,41 @@ void sca_remove_ob_poin(Object *obt, Object *ob)
sens= obt->sensors.first;
- while(sens) {
+ while (sens) {
switch(sens->type) {
case SENS_MESSAGE:
ms= sens->data;
- if(ms->fromObject==ob) ms->fromObject= NULL;
+ if (ms->fromObject==ob) ms->fromObject= NULL;
}
sens= sens->next;
}
act= obt->actuators.first;
- while(act) {
+ while (act) {
switch(act->type) {
case ACT_CAMERA:
ca= act->data;
- if(ca->ob==ob) ca->ob= NULL;
+ if (ca->ob==ob) ca->ob= NULL;
break;
case ACT_OBJECT:
oa= act->data;
- if(oa->reference==ob) oa->reference= NULL;
+ if (oa->reference==ob) oa->reference= NULL;
break;
case ACT_PROPERTY:
pa= act->data;
- if(pa->ob==ob) pa->ob= NULL;
+ if (pa->ob==ob) pa->ob= NULL;
break;
case ACT_SCENE:
sa= act->data;
- if(sa->camera==ob) sa->camera= NULL;
+ if (sa->camera==ob) sa->camera= NULL;
break;
case ACT_EDIT_OBJECT:
eoa= act->data;
- if(eoa->ob==ob) eoa->ob= NULL;
+ if (eoa->ob==ob) eoa->ob= NULL;
break;
case ACT_MESSAGE:
ma= act->data;
- if(ma->toObject==ob) ma->toObject= NULL;
+ if (ma->toObject==ob) ma->toObject= NULL;
break;
case ACT_PARENT:
para = act->data;
@@ -710,14 +710,14 @@ void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up)
/* make sure this sensor belongs to this object */
sens= ob->sensors.first;
- while(sens) {
- if(sens == sens_to_move) break;
+ while (sens) {
+ if (sens == sens_to_move) break;
sens= sens->next;
}
- if(!sens) return;
+ if (!sens) return;
/* move up */
- if( val==1 && sens->prev) {
+ if ( val==1 && sens->prev) {
for (tmp=sens->prev; tmp; tmp=tmp->prev) {
if (tmp->flag & SENS_VISIBLE)
break;
@@ -728,7 +728,7 @@ void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up)
}
}
/* move down */
- else if( val==2 && sens->next) {
+ else if ( val==2 && sens->next) {
for (tmp=sens->next; tmp; tmp=tmp->next) {
if (tmp->flag & SENS_VISIBLE)
break;
@@ -749,18 +749,18 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up)
/* make sure this controller belongs to this object */
cont= ob->controllers.first;
- while(cont) {
- if(cont == cont_to_move) break;
+ while (cont) {
+ if (cont == cont_to_move) break;
cont= cont->next;
}
- if(!cont) return;
+ if (!cont) return;
/* move up */
- if( val==1 && cont->prev) {
+ if ( val==1 && cont->prev) {
/* locate the controller that has the same state mask but is earlier in the list */
tmp = cont->prev;
- while(tmp) {
- if(tmp->state_mask & cont->state_mask)
+ while (tmp) {
+ if (tmp->state_mask & cont->state_mask)
break;
tmp = tmp->prev;
}
@@ -771,10 +771,10 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up)
}
/* move down */
- else if( val==2 && cont->next) {
+ else if ( val==2 && cont->next) {
tmp = cont->next;
- while(tmp) {
- if(tmp->state_mask & cont->state_mask)
+ while (tmp) {
+ if (tmp->state_mask & cont->state_mask)
break;
tmp = tmp->next;
}
@@ -792,14 +792,14 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up)
/* make sure this actuator belongs to this object */
act= ob->actuators.first;
- while(act) {
- if(act == act_to_move) break;
+ while (act) {
+ if (act == act_to_move) break;
act= act->next;
}
- if(!act) return;
+ if (!act) return;
/* move up */
- if( val==1 && act->prev) {
+ if ( val==1 && act->prev) {
/* locate the first visible actuators before this one */
for (tmp = act->prev; tmp; tmp=tmp->prev) {
if (tmp->flag & ACT_VISIBLE)
@@ -811,7 +811,7 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up)
}
}
/* move down */
- else if( val==2 && act->next) {
+ else if ( val==2 && act->next) {
/* locate the first visible actuators after this one */
for (tmp=act->next; tmp; tmp=tmp->next) {
if (tmp->flag & ACT_VISIBLE)
@@ -847,7 +847,7 @@ void link_logicbricks(void **poin, void ***ppoin, short *tot, short size)
}
(*ppoin)[ibrick] = *poin;
- if(old_links) MEM_freeN(old_links);
+ if (old_links) MEM_freeN(old_links);
}
else {
(*tot) = 1;
@@ -862,14 +862,14 @@ void unlink_logicbricks(void **poin, void ***ppoin, short *tot)
removed= 0;
for (ibrick=0; ibrick < *tot; ibrick++) {
- if(removed) (*ppoin)[ibrick - removed] = (*ppoin)[ibrick];
- else if((*ppoin)[ibrick] == *poin) removed = 1;
+ if (removed) (*ppoin)[ibrick - removed] = (*ppoin)[ibrick];
+ else if ((*ppoin)[ibrick] == *poin) removed = 1;
}
if (removed) {
(*tot) --;
- if(*tot == 0) {
+ if (*tot == 0) {
MEM_freeN(*ppoin);
(*ppoin)= NULL;
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index d74ae9f8e83..8e5bf71d2c6 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -403,10 +403,10 @@ Scene *add_scene(const char *name)
sce->r.simplify_shadowsamples= 16;
sce->r.simplify_aosss= 1.0f;
- sce->r.border.xmin= 0.0f;
- sce->r.border.ymin= 0.0f;
- sce->r.border.xmax= 1.0f;
- sce->r.border.ymax= 1.0f;
+ sce->r.border.xmin = 0.0f;
+ sce->r.border.ymin = 0.0f;
+ sce->r.border.xmax = 1.0f;
+ sce->r.border.ymax = 1.0f;
sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings),"Tool Settings Struct");
sce->toolsettings->cornertype=1;
@@ -1071,7 +1071,7 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
DAG_ids_flush_tagged(bmain);
/* Following 2 functions are recursive
- * so dont call within 'scene_update_tagged_recursive' */
+ * so don't call within 'scene_update_tagged_recursive' */
DAG_scene_update_flags(bmain, sce, lay, TRUE); // only stuff that moves or needs display still
/* All 'standard' (i.e. without any dependencies) animation is handled here,
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index fe4316bf8d6..158fc91c03c 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -59,15 +59,15 @@ static void spacetype_free(SpaceType *st)
PanelType *pt;
HeaderType *ht;
- for(art= st->regiontypes.first; art; art= art->next) {
+ for (art= st->regiontypes.first; art; art= art->next) {
BLI_freelistN(&art->drawcalls);
- for(pt= art->paneltypes.first; pt; pt= pt->next)
- if(pt->ext.free)
+ for (pt= art->paneltypes.first; pt; pt= pt->next)
+ if (pt->ext.free)
pt->ext.free(pt->ext.data);
- for(ht= art->headertypes.first; ht; ht= ht->next)
- if(ht->ext.free)
+ for (ht= art->headertypes.first; ht; ht= ht->next)
+ if (ht->ext.free)
ht->ext.free(ht->ext.data);
BLI_freelistN(&art->paneltypes);
@@ -83,7 +83,7 @@ void BKE_spacetypes_free(void)
{
SpaceType *st;
- for(st= spacetypes.first; st; st= st->next) {
+ for (st= spacetypes.first; st; st= st->next) {
spacetype_free(st);
}
@@ -94,8 +94,8 @@ SpaceType *BKE_spacetype_from_id(int spaceid)
{
SpaceType *st;
- for(st= spacetypes.first; st; st= st->next) {
- if(st->spaceid==spaceid)
+ for (st= spacetypes.first; st; st= st->next) {
+ if (st->spaceid==spaceid)
return st;
}
return NULL;
@@ -105,8 +105,8 @@ ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid)
{
ARegionType *art;
- for(art= st->regiontypes.first; art; art= art->next)
- if(art->regionid==regionid)
+ for (art= st->regiontypes.first; art; art= art->next)
+ if (art->regionid==regionid)
return art;
printf("Error, region type missing in - name:\"%s\", id:%d\n", st->name, st->spaceid);
@@ -125,7 +125,7 @@ void BKE_spacetype_register(SpaceType *st)
/* sanity check */
stype= BKE_spacetype_from_id(st->spaceid);
- if(stype) {
+ if (stype) {
printf("error: redefinition of spacetype %s\n", stype->name);
spacetype_free(stype);
MEM_freeN(stype);
@@ -145,12 +145,12 @@ void BKE_spacedata_freelist(ListBase *lb)
SpaceType *st= BKE_spacetype_from_id(sl->spacetype);
/* free regions for pushed spaces */
- for(ar=sl->regionbase.first; ar; ar=ar->next)
+ for (ar=sl->regionbase.first; ar; ar=ar->next)
BKE_area_region_free(st, ar);
BLI_freelistN(&sl->regionbase);
- if(st && st->free)
+ if (st && st->free)
st->free(sl);
}
@@ -168,27 +168,27 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
newar->swinid= 0;
/* use optional regiondata callback */
- if(ar->regiondata) {
+ if (ar->regiondata) {
ARegionType *art= BKE_regiontype_from_id(st, ar->regiontype);
- if(art && art->duplicate)
+ if (art && art->duplicate)
newar->regiondata= art->duplicate(ar->regiondata);
else
newar->regiondata= MEM_dupallocN(ar->regiondata);
}
- if(ar->v2d.tab_offset)
+ if (ar->v2d.tab_offset)
newar->v2d.tab_offset= MEM_dupallocN(ar->v2d.tab_offset);
newar->panels.first= newar->panels.last= NULL;
BLI_duplicatelist(&newar->panels, &ar->panels);
/* copy panel pointers */
- for(newpa= newar->panels.first; newpa; newpa= newpa->next) {
+ for (newpa= newar->panels.first; newpa; newpa= newpa->next) {
patab= newar->panels.first;
pa= ar->panels.first;
- while(patab) {
- if(newpa->paneltab == pa) {
+ while (patab) {
+ if (newpa->paneltab == pa) {
newpa->paneltab = patab;
break;
}
@@ -209,7 +209,7 @@ static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2)
/* to be sure */
lb1->first= lb1->last= NULL;
- for(ar= lb2->first; ar; ar= ar->next) {
+ for (ar= lb2->first; ar; ar= ar->next) {
ARegion *arnew= BKE_area_region_copy(st, ar);
BLI_addtail(lb1, arnew);
}
@@ -226,7 +226,7 @@ void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2)
for (sl= lb2->first; sl; sl= sl->next) {
SpaceType *st= BKE_spacetype_from_id(sl->spacetype);
- if(st && st->duplicate) {
+ if (st && st->duplicate) {
SpaceLink *slnew= st->duplicate(sl);
BLI_addtail(lb1, slnew);
@@ -243,11 +243,11 @@ void BKE_spacedata_draw_locks(int set)
{
SpaceType *st;
- for(st= spacetypes.first; st; st= st->next) {
+ for (st= spacetypes.first; st; st= st->next) {
ARegionType *art;
- for(art= st->regiontypes.first; art; art= art->next) {
- if(set)
+ for (art= st->regiontypes.first; art; art= art->next) {
+ if (set)
art->do_lock= art->lock;
else
art->do_lock= 0;
@@ -259,19 +259,19 @@ void BKE_spacedata_draw_locks(int set)
/* not region itself */
void BKE_area_region_free(SpaceType *st, ARegion *ar)
{
- if(st) {
+ if (st) {
ARegionType *art= BKE_regiontype_from_id(st, ar->regiontype);
- if(art && art->free)
+ if (art && art->free)
art->free(ar);
- if(ar->regiondata)
+ if (ar->regiondata)
printf("regiondata free error\n");
}
- else if(ar->type && ar->type->free)
+ else if (ar->type && ar->type->free)
ar->type->free(ar);
- if(ar->v2d.tab_offset) {
+ if (ar->v2d.tab_offset) {
MEM_freeN(ar->v2d.tab_offset);
ar->v2d.tab_offset= NULL;
}
@@ -285,7 +285,7 @@ void BKE_screen_area_free(ScrArea *sa)
SpaceType *st= BKE_spacetype_from_id(sa->spacetype);
ARegion *ar;
- for(ar=sa->regionbase.first; ar; ar=ar->next)
+ for (ar=sa->regionbase.first; ar; ar=ar->next)
BKE_area_region_free(st, ar);
BLI_freelistN(&sa->regionbase);
@@ -301,12 +301,12 @@ void free_screen(bScreen *sc)
ScrArea *sa, *san;
ARegion *ar;
- for(ar=sc->regionbase.first; ar; ar=ar->next)
+ for (ar=sc->regionbase.first; ar; ar=ar->next)
BKE_area_region_free(NULL, ar);
BLI_freelistN(&sc->regionbase);
- for(sa= sc->areabase.first; sa; sa= san) {
+ for (sa= sc->areabase.first; sa; sa= san) {
san= sa->next;
BKE_screen_area_free(sa);
}
@@ -322,14 +322,14 @@ unsigned int BKE_screen_visible_layers(bScreen *screen, Scene *scene)
ScrArea *sa;
unsigned int layer= 0;
- if(screen) {
+ if (screen) {
/* get all used view3d layers */
- for(sa= screen->areabase.first; sa; sa= sa->next)
- if(sa->spacetype==SPACE_VIEW3D)
+ for (sa= screen->areabase.first; sa; sa= sa->next)
+ if (sa->spacetype==SPACE_VIEW3D)
layer |= ((View3D *)sa->spacedata.first)->lay;
}
- if(!layer)
+ if (!layer)
return scene->lay;
return layer;
@@ -359,7 +359,7 @@ struct ScrArea *BKE_screen_find_big_area(struct bScreen *sc, const int spacetype
ScrArea *sa, *big= NULL;
int size, maxsize= 0;
- for(sa= sc->areabase.first; sa; sa= sa->next) {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
if ((spacetype == -1) || sa->spacetype == spacetype) {
if (min <= sa->winx && min <= sa->winy) {
size= sa->winx*sa->winy;
@@ -378,25 +378,25 @@ void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene)
{
int bit;
- if(v3d->scenelock && v3d->localvd==NULL) {
+ if (v3d->scenelock && v3d->localvd==NULL) {
v3d->lay= scene->lay;
v3d->camera= scene->camera;
- if(v3d->camera==NULL) {
+ if (v3d->camera==NULL) {
ARegion *ar;
- for(ar=v3d->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW) {
+ for (ar=v3d->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d= ar->regiondata;
- if(rv3d->persp==RV3D_CAMOB)
+ if (rv3d->persp==RV3D_CAMOB)
rv3d->persp= RV3D_PERSP;
}
}
}
- if((v3d->lay & v3d->layact) == 0) {
- for(bit= 0; bit<32; bit++) {
- if(v3d->lay & (1<<bit)) {
+ if ((v3d->lay & v3d->layact) == 0) {
+ for (bit= 0; bit<32; bit++) {
+ if (v3d->lay & (1<<bit)) {
v3d->layact= 1<<bit;
break;
}
@@ -409,10 +409,10 @@ void BKE_screen_view3d_scene_sync(bScreen *sc)
{
/* are there cameras in the views that are not in the scene? */
ScrArea *sa;
- for(sa= sc->areabase.first; sa; sa= sa->next) {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
- for(sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D*) sl;
BKE_screen_view3d_sync(v3d, sc->scene);
}
@@ -427,13 +427,13 @@ void BKE_screen_view3d_main_sync(ListBase *screen_lb, Scene *scene)
SpaceLink *sl;
/* from scene copy to the other views */
- for(sc=screen_lb->first; sc; sc=sc->id.next) {
- if(sc->scene!=scene)
+ for (sc=screen_lb->first; sc; sc=sc->id.next) {
+ if (sc->scene!=scene)
continue;
- for(sa=sc->areabase.first; sa; sa=sa->next)
- for(sl=sa->spacedata.first; sl; sl=sl->next)
- if(sl->spacetype==SPACE_VIEW3D)
+ for (sa=sc->areabase.first; sa; sa=sa->next)
+ for (sl=sa->spacedata.first; sl; sl=sl->next)
+ if (sl->spacetype==SPACE_VIEW3D)
BKE_screen_view3d_sync((View3D*)sl, scene);
}
}
diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c
index c5761dcc456..f1f3dd47d8b 100644
--- a/source/blender/blenkernel/intern/seqcache.c
+++ b/source/blender/blenkernel/intern/seqcache.c
@@ -91,13 +91,13 @@ static int seqcache_hashcmp(const void *a_, const void *b_)
void seq_stripelem_cache_destruct(void)
{
- if(moviecache)
+ if (moviecache)
IMB_moviecache_free(moviecache);
}
void seq_stripelem_cache_cleanup(void)
{
- if(moviecache) {
+ if (moviecache) {
IMB_moviecache_free(moviecache);
moviecache = IMB_moviecache_create(sizeof(seqCacheKey), seqcache_hashhash,
seqcache_hashcmp, NULL);
@@ -109,7 +109,7 @@ struct ImBuf * seq_stripelem_cache_get(
float cfra, seq_stripelem_ibuf_t type)
{
- if(moviecache && seq) {
+ if (moviecache && seq) {
seqCacheKey key;
key.seq = seq;
@@ -133,7 +133,7 @@ void seq_stripelem_cache_put(
return;
}
- if(!moviecache) {
+ if (!moviecache) {
moviecache = IMB_moviecache_create(sizeof(seqCacheKey), seqcache_hashhash,
seqcache_hashcmp, NULL);
}
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index b24b885c001..3aadfa309c5 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -85,13 +85,15 @@ static struct ImBuf * prepare_effect_imbufs(
if (!ibuf1 && !ibuf2 && !ibuf3) {
/* hmmm, global float option ? */
out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect);
- } else if ((ibuf1 && ibuf1->rect_float) ||
+ }
+ else if ((ibuf1 && ibuf1->rect_float) ||
(ibuf2 && ibuf2->rect_float) ||
(ibuf3 && ibuf3->rect_float)) {
/* if any inputs are rectfloat, output is float too */
out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat);
- } else {
+ }
+ else {
out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect);
}
@@ -139,12 +141,12 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname)
/* clear the error list */
BLI_dynlib_get_error_as_string(NULL);
- /* if(pis->handle) BLI_dynlib_close(pis->handle); */
+ /* if (pis->handle) BLI_dynlib_close(pis->handle); */
/* pis->handle= 0; */
/* open the needed object */
pis->handle= BLI_dynlib_open(pis->name);
- if(test_dlerr(pis->name, pis->name)) return;
+ if (test_dlerr(pis->name, pis->name)) return;
if (pis->handle != NULL) {
/* find the address of the version function */
@@ -159,7 +161,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname)
info_func= (int (*)(PluginInfo *))BLI_dynlib_find_symbol(pis->handle, "plugin_getinfo");
- if(info_func == NULL) error("No info func");
+ if (info_func == NULL) error("No info func");
else {
info_func(info);
@@ -176,8 +178,9 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname)
MEM_freeN(info);
cp= BLI_dynlib_find_symbol(pis->handle, "seqname");
- if(cp) BLI_strncpy(cp, seqname, SEQ_NAME_MAXSTR);
- } else {
+ if (cp) BLI_strncpy(cp, seqname, SEQ_NAME_MAXSTR);
+ }
+ else {
printf ("Plugin returned unrecognized version number\n");
return;
}
@@ -205,8 +208,8 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname)
BLI_strncpy(pis->name, str, FILE_MAX);
open_plugin_seq(pis, seqname);
- if(pis->doit==NULL) {
- if(pis->handle==NULL) error("no plugin: %s", str);
+ if (pis->doit==NULL) {
+ if (pis->handle==NULL) error("no plugin: %s", str);
else error("in plugin: %s", str);
MEM_freeN(pis);
return NULL;
@@ -214,10 +217,10 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname)
/* default values */
varstr= pis->varstr;
- for(a=0; a<pis->vars; a++, varstr++) {
- if( (varstr->type & FLO)==FLO)
+ for (a=0; a<pis->vars; a++, varstr++) {
+ if ( (varstr->type & FLO)==FLO)
pis->data[a]= varstr->def;
- else if( (varstr->type & INT)==INT)
+ else if ( (varstr->type & INT)==INT)
*((int *)(pis->data+a))= (int) varstr->def;
}
@@ -226,7 +229,7 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname)
static void free_plugin_seq(PluginSeq *pis)
{
- if(pis==NULL) return;
+ if (pis==NULL) return;
/* no BLI_dynlib_close: same plugin can be opened multiple times with 1 handle */
@@ -265,7 +268,7 @@ static void load_plugin(Sequence * seq)
static void copy_plugin(Sequence * dst, Sequence * src)
{
- if(src->plugin) {
+ if (src->plugin) {
dst->plugin= MEM_dupallocN(src->plugin);
open_plugin_seq(dst->plugin, dst->name+2);
}
@@ -295,9 +298,9 @@ static struct ImBuf * do_plugin_effect(
int x = context.rectx;
int y = context.recty;
- if(seq->plugin && seq->plugin->doit) {
+ if (seq->plugin && seq->plugin->doit) {
- if(seq->plugin->cfra)
+ if (seq->plugin->cfra)
*(seq->plugin->cfra)= cfra;
cp = BLI_dynlib_find_symbol(
@@ -306,7 +309,7 @@ static struct ImBuf * do_plugin_effect(
/* XXX: it's crappy to limit copying buffer by it's lemgth,
* but assuming plugin stuff is using correct buffer size
* it should be fine */
- if(cp) strncpy(cp, seq->name+2, sizeof(seq->name)-2);
+ if (cp) strncpy(cp, seq->name+2, sizeof(seq->name)-2);
if (seq->plugin->current_private_data) {
*seq->plugin->current_private_data
@@ -342,9 +345,9 @@ static struct ImBuf * do_plugin_effect(
}
if (seq->plugin->version<=2) {
- if(ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
- if(ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
- if(ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
+ if (ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
+ if (ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
+ if (ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
}
if (seq->plugin->version<=4) {
@@ -354,7 +357,8 @@ static struct ImBuf * do_plugin_effect(
IMB_cast_away_list(ibuf2),
IMB_cast_away_list(out),
IMB_cast_away_list(ibuf3));
- } else {
+ }
+ else {
((SeqDoit)seq->plugin->doit)(
seq->plugin->data, facf0, facf1, x, y,
ibuf1, ibuf2, out, ibuf3);
@@ -362,9 +366,9 @@ static struct ImBuf * do_plugin_effect(
if (seq->plugin->version<=2) {
if (!use_temp_bufs) {
- if(ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
- if(ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
- if(ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
+ if (ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
+ if (ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
+ if (ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
}
IMB_convert_rgba_to_abgr(out);
}
@@ -421,51 +425,51 @@ static void do_alphaover_effect_byte(float facf0, float facf1, int x, int y,
fac2= (int)(256.0f*facf0);
fac4= (int)(256.0f*facf1);
- while(y--) {
+ while (y--) {
x= xo;
- while(x--) {
+ while (x--) {
/* rt = rt1 over rt2 (alpha from rt1) */
fac= fac2;
mfac= 256 - ( (fac2*rt1[3])>>8 );
- if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
- else if(mfac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
+ if (fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+ else if (mfac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
else {
tempc= ( fac*rt1[0] + mfac*rt2[0])>>8;
- if(tempc>255) rt[0]= 255; else rt[0]= tempc;
+ if (tempc>255) rt[0]= 255; else rt[0]= tempc;
tempc= ( fac*rt1[1] + mfac*rt2[1])>>8;
- if(tempc>255) rt[1]= 255; else rt[1]= tempc;
+ if (tempc>255) rt[1]= 255; else rt[1]= tempc;
tempc= ( fac*rt1[2] + mfac*rt2[2])>>8;
- if(tempc>255) rt[2]= 255; else rt[2]= tempc;
+ if (tempc>255) rt[2]= 255; else rt[2]= tempc;
tempc= ( fac*rt1[3] + mfac*rt2[3])>>8;
- if(tempc>255) rt[3]= 255; else rt[3]= tempc;
+ if (tempc>255) rt[3]= 255; else rt[3]= tempc;
}
rt1+= 4; rt2+= 4; rt+= 4;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo;
- while(x--) {
+ while (x--) {
fac= fac4;
mfac= 256 - ( (fac4*rt1[3])>>8 );
- if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
- else if(mfac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
+ if (fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+ else if (mfac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
else {
tempc= ( fac*rt1[0] + mfac*rt2[0])>>8;
- if(tempc>255) rt[0]= 255; else rt[0]= tempc;
+ if (tempc>255) rt[0]= 255; else rt[0]= tempc;
tempc= ( fac*rt1[1] + mfac*rt2[1])>>8;
- if(tempc>255) rt[1]= 255; else rt[1]= tempc;
+ if (tempc>255) rt[1]= 255; else rt[1]= tempc;
tempc= ( fac*rt1[2] + mfac*rt2[2])>>8;
- if(tempc>255) rt[2]= 255; else rt[2]= tempc;
+ if (tempc>255) rt[2]= 255; else rt[2]= tempc;
tempc= ( fac*rt1[3] + mfac*rt2[3])>>8;
- if(tempc>255) rt[3]= 255; else rt[3]= tempc;
+ if (tempc>255) rt[3]= 255; else rt[3]= tempc;
}
rt1+= 4; rt2+= 4; rt+= 4;
}
@@ -487,21 +491,23 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
fac2= facf0;
fac4= facf1;
- while(y--) {
+ while (y--) {
x= xo;
- while(x--) {
+ while (x--) {
/* rt = rt1 over rt2 (alpha from rt1) */
fac= fac2;
mfac= 1.0f - (fac2 * rt1[3]);
- if(fac <= 0.0f) {
+ if (fac <= 0.0f) {
memcpy(rt, rt2, 4 * sizeof(float));
- } else if(mfac <=0) {
+ }
+ else if (mfac <=0) {
memcpy(rt, rt1, 4 * sizeof(float));
- } else {
+ }
+ else {
rt[0] = fac*rt1[0] + mfac*rt2[0];
rt[1] = fac*rt1[1] + mfac*rt2[1];
rt[2] = fac*rt1[2] + mfac*rt2[2];
@@ -510,20 +516,22 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
rt1+= 4; rt2+= 4; rt+= 4;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo;
- while(x--) {
+ while (x--) {
fac= fac4;
mfac= 1.0f - (fac4*rt1[3]);
- if(fac <= 0.0f) {
+ if (fac <= 0.0f) {
memcpy(rt, rt2, 4 * sizeof(float));
- } else if(mfac <= 0.0f) {
+ }
+ else if (mfac <= 0.0f) {
memcpy(rt, rt1, 4 * sizeof(float));
- } else {
+ }
+ else {
rt[0] = fac*rt1[0] + mfac*rt2[0];
rt[1] = fac*rt1[1] + mfac*rt2[1];
rt[2] = fac*rt1[2] + mfac*rt2[2];
@@ -547,7 +555,8 @@ static struct ImBuf * do_alphaover_effect(
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
- } else {
+ }
+ else {
do_alphaover_effect_byte(
facf0, facf1, context.rectx, context.recty,
(char*) ibuf1->rect, (char*) ibuf2->rect,
@@ -577,23 +586,23 @@ static void do_alphaunder_effect_byte(
fac2= (int)(256.0f*facf0);
fac4= (int)(256.0f*facf1);
- while(y--) {
+ while (y--) {
x= xo;
- while(x--) {
+ while (x--) {
/* rt = rt1 under rt2 (alpha from rt2) */
/* this complex optimalisation is because the
* 'skybuf' can be crossed in
*/
- if(rt2[3]==0 && fac2==256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
- else if(rt2[3]==255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+ if (rt2[3]==0 && fac2==256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
+ else if (rt2[3]==255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
else {
mfac= rt2[3];
fac= (fac2*(256-mfac))>>8;
- if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+ if (fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
else {
rt[0]= ( fac*rt1[0] + mfac*rt2[0])>>8;
rt[1]= ( fac*rt1[1] + mfac*rt2[1])>>8;
@@ -604,19 +613,19 @@ static void do_alphaunder_effect_byte(
rt1+= 4; rt2+= 4; rt+= 4;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo;
- while(x--) {
+ while (x--) {
- if(rt2[3]==0 && fac4==256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
- else if(rt2[3]==255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+ if (rt2[3]==0 && fac4==256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
+ else if (rt2[3]==255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
else {
mfac= rt2[3];
fac= (fac4*(256-mfac))>>8;
- if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+ if (fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
else {
rt[0]= ( fac*rt1[0] + mfac*rt2[0])>>8;
rt[1]= ( fac*rt1[1] + mfac*rt2[1])>>8;
@@ -646,27 +655,30 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
fac2= facf0;
fac4= facf1;
- while(y--) {
+ while (y--) {
x= xo;
- while(x--) {
+ while (x--) {
/* rt = rt1 under rt2 (alpha from rt2) */
/* this complex optimalisation is because the
* 'skybuf' can be crossed in
*/
- if( rt2[3]<=0 && fac2 >= 1.0f) {
+ if ( rt2[3]<=0 && fac2 >= 1.0f) {
memcpy(rt, rt1, 4 * sizeof(float));
- } else if(rt2[3] >= 1.0f) {
+ }
+ else if (rt2[3] >= 1.0f) {
memcpy(rt, rt2, 4 * sizeof(float));
- } else {
+ }
+ else {
mfac = rt2[3];
fac = fac2 * (1.0f - mfac);
- if(fac == 0) {
+ if (fac == 0) {
memcpy(rt, rt2, 4 * sizeof(float));
- } else {
+ }
+ else {
rt[0]= fac*rt1[0] + mfac*rt2[0];
rt[1]= fac*rt1[1] + mfac*rt2[1];
rt[2]= fac*rt1[2] + mfac*rt2[2];
@@ -676,24 +688,27 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
rt1+= 4; rt2+= 4; rt+= 4;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo;
- while(x--) {
+ while (x--) {
- if(rt2[3]<=0 && fac4 >= 1.0f) {
+ if (rt2[3]<=0 && fac4 >= 1.0f) {
memcpy(rt, rt1, 4 * sizeof(float));
- } else if(rt2[3]>=1.0f) {
+ }
+ else if (rt2[3]>=1.0f) {
memcpy(rt, rt2, 4 * sizeof(float));
- } else {
+ }
+ else {
mfac= rt2[3];
fac= fac4*(1.0f-mfac);
- if(fac == 0) {
+ if (fac == 0) {
memcpy(rt, rt2, 4 * sizeof(float));
- } else {
+ }
+ else {
rt[0]= fac * rt1[0] + mfac * rt2[0];
rt[1]= fac * rt1[1] + mfac * rt2[1];
rt[2]= fac * rt1[2] + mfac * rt2[2];
@@ -719,7 +734,8 @@ static struct ImBuf* do_alphaunder_effect(
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
- } else {
+ }
+ else {
do_alphaunder_effect_byte(
facf0, facf1, context.rectx, context.recty,
(char*) ibuf1->rect, (char*) ibuf2->rect,
@@ -751,10 +767,10 @@ static void do_cross_effect_byte(float facf0, float facf1, int x, int y,
fac4= (int)(256.0f*facf1);
fac3= 256-fac4;
- while(y--) {
+ while (y--) {
x= xo;
- while(x--) {
+ while (x--) {
rt[0]= (fac1*rt1[0] + fac2*rt2[0])>>8;
rt[1]= (fac1*rt1[1] + fac2*rt2[1])>>8;
@@ -764,11 +780,11 @@ static void do_cross_effect_byte(float facf0, float facf1, int x, int y,
rt1+= 4; rt2+= 4; rt+= 4;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo;
- while(x--) {
+ while (x--) {
rt[0]= (fac3*rt1[0] + fac4*rt2[0])>>8;
rt[1]= (fac3*rt1[1] + fac4*rt2[1])>>8;
@@ -798,10 +814,10 @@ static void do_cross_effect_float(float facf0, float facf1, int x, int y,
fac4= facf1;
fac3= 1.0f - fac4;
- while(y--) {
+ while (y--) {
x= xo;
- while(x--) {
+ while (x--) {
rt[0]= fac1*rt1[0] + fac2*rt2[0];
rt[1]= fac1*rt1[1] + fac2*rt2[1];
@@ -811,11 +827,11 @@ static void do_cross_effect_float(float facf0, float facf1, int x, int y,
rt1+= 4; rt2+= 4; rt+= 4;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo;
- while(x--) {
+ while (x--) {
rt[0]= fac3*rt1[0] + fac4*rt2[0];
rt[1]= fac3*rt1[1] + fac4*rt2[1];
@@ -844,7 +860,8 @@ static struct ImBuf* do_cross_effect(
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
- } else {
+ }
+ else {
do_cross_effect_byte(
facf0, facf1, context.rectx, context.recty,
(char*) ibuf1->rect, (char*) ibuf2->rect,
@@ -956,19 +973,19 @@ static void gamtabs(float gamma)
int a;
/* gamtab: in short, out short */
- for(a=0; a<65536; a++) {
+ for (a=0; a<65536; a++) {
val= a;
val/= 65535.0f;
- if(gamma==2.0f) val= sqrt(val);
- else if(gamma!=1.0f) val= pow(val, igamma);
+ if (gamma==2.0f) val= sqrt(val);
+ else if (gamma!=1.0f) val= pow(val, igamma);
gamtab[a]= (65535.99f*val);
}
/* inverse gamtab1 : in byte, out short */
- for(a=1; a<=256; a++) {
- if(gamma==2.0f) igamtab1[a-1]= a*a-1;
- else if(gamma==1.0f) igamtab1[a-1]= 256*a-1;
+ for (a=1; a<=256; a++) {
+ if (gamma==2.0f) igamtab1[a-1]= a*a-1;
+ else if (gamma==1.0f) igamtab1[a-1]= 256*a-1;
else {
val= a/256.0f;
igamtab1[a - 1]= (65535.0 * pow(val, gamma)) - 1;
@@ -1016,37 +1033,37 @@ static void do_gammacross_effect_byte(float facf0, float UNUSED(facf1),
fac2= (int)(256.0f*facf0);
fac1= 256-fac2;
- while(y--) {
+ while (y--) {
x= xo;
- while(x--) {
+ while (x--) {
col= (fac1*igamtab1[rt1[0]] + fac2*igamtab1[rt2[0]])>>8;
- if(col>65535) rt[0]= 255; else rt[0]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+ if (col>65535) rt[0]= 255; else rt[0]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
col=(fac1*igamtab1[rt1[1]] + fac2*igamtab1[rt2[1]])>>8;
- if(col>65535) rt[1]= 255; else rt[1]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+ if (col>65535) rt[1]= 255; else rt[1]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
col= (fac1*igamtab1[rt1[2]] + fac2*igamtab1[rt2[2]])>>8;
- if(col>65535) rt[2]= 255; else rt[2]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+ if (col>65535) rt[2]= 255; else rt[2]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
col= (fac1*igamtab1[rt1[3]] + fac2*igamtab1[rt2[3]])>>8;
- if(col>65535) rt[3]= 255; else rt[3]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+ if (col>65535) rt[3]= 255; else rt[3]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
rt1+= 4; rt2+= 4; rt+= 4;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo;
- while(x--) {
+ while (x--) {
col= (fac1*igamtab1[rt1[0]] + fac2*igamtab1[rt2[0]])>>8;
- if(col>65535) rt[0]= 255; else rt[0]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+ if (col>65535) rt[0]= 255; else rt[0]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
col= (fac1*igamtab1[rt1[1]] + fac2*igamtab1[rt2[1]])>>8;
- if(col>65535) rt[1]= 255; else rt[1]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+ if (col>65535) rt[1]= 255; else rt[1]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
col= (fac1*igamtab1[rt1[2]] + fac2*igamtab1[rt2[2]])>>8;
- if(col>65535) rt[2]= 255; else rt[2]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+ if (col>65535) rt[2]= 255; else rt[2]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
col= (fac1*igamtab1[rt1[3]] + fac2*igamtab1[rt2[3]])>>8;
- if(col>65535) rt[3]= 255; else rt[3]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+ if (col>65535) rt[3]= 255; else rt[3]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
rt1+= 4; rt2+= 4; rt+= 4;
}
@@ -1071,10 +1088,10 @@ static void do_gammacross_effect_float(float facf0, float UNUSED(facf1),
fac2= facf0;
fac1= 1.0f - fac2;
- while(y--) {
+ while (y--) {
x= xo * 4;
- while(x--) {
+ while (x--) {
*rt= gammaCorrect(
fac1 * invGammaCorrect(*rt1)
@@ -1082,11 +1099,11 @@ static void do_gammacross_effect_float(float facf0, float UNUSED(facf1),
rt1++; rt2++; rt++;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo * 4;
- while(x--) {
+ while (x--) {
*rt= gammaCorrect(
fac1*invGammaCorrect(*rt1)
@@ -1113,7 +1130,8 @@ static struct ImBuf * do_gammacross_effect(
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
- } else {
+ }
+ else {
do_gammacross_effect_byte(
facf0, facf1, context.rectx, context.recty,
(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
@@ -1142,37 +1160,37 @@ static void do_add_effect_byte(float facf0, float facf1, int x, int y,
fac1= (int)(256.0f*facf0);
fac3= (int)(256.0f*facf1);
- while(y--) {
+ while (y--) {
x= xo;
- while(x--) {
+ while (x--) {
col= rt1[0]+ ((fac1*rt2[0])>>8);
- if(col>255) rt[0]= 255; else rt[0]= col;
+ if (col>255) rt[0]= 255; else rt[0]= col;
col= rt1[1]+ ((fac1*rt2[1])>>8);
- if(col>255) rt[1]= 255; else rt[1]= col;
+ if (col>255) rt[1]= 255; else rt[1]= col;
col= rt1[2]+ ((fac1*rt2[2])>>8);
- if(col>255) rt[2]= 255; else rt[2]= col;
+ if (col>255) rt[2]= 255; else rt[2]= col;
col= rt1[3]+ ((fac1*rt2[3])>>8);
- if(col>255) rt[3]= 255; else rt[3]= col;
+ if (col>255) rt[3]= 255; else rt[3]= col;
rt1+= 4; rt2+= 4; rt+= 4;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo;
- while(x--) {
+ while (x--) {
col= rt1[0]+ ((fac3*rt2[0])>>8);
- if(col>255) rt[0]= 255; else rt[0]= col;
+ if (col>255) rt[0]= 255; else rt[0]= col;
col= rt1[1]+ ((fac3*rt2[1])>>8);
- if(col>255) rt[1]= 255; else rt[1]= col;
+ if (col>255) rt[1]= 255; else rt[1]= col;
col= rt1[2]+ ((fac3*rt2[2])>>8);
- if(col>255) rt[2]= 255; else rt[2]= col;
+ if (col>255) rt[2]= 255; else rt[2]= col;
col= rt1[3]+ ((fac3*rt2[3])>>8);
- if(col>255) rt[3]= 255; else rt[3]= col;
+ if (col>255) rt[3]= 255; else rt[3]= col;
rt1+= 4; rt2+= 4; rt+= 4;
}
@@ -1195,20 +1213,20 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y,
fac1= facf0;
fac3= facf1;
- while(y--) {
+ while (y--) {
x= xo * 4;
- while(x--) {
+ while (x--) {
*rt = *rt1 + fac1 * (*rt2);
rt1++; rt2++; rt++;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo * 4;
- while(x--) {
+ while (x--) {
*rt = *rt1 + fac3 * (*rt2);
rt1++; rt2++; rt++;
@@ -1229,7 +1247,8 @@ static struct ImBuf * do_add_effect(SeqRenderData context,
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
- } else {
+ }
+ else {
do_add_effect_byte(
facf0, facf1, context.rectx, context.recty,
(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
@@ -1258,37 +1277,37 @@ static void do_sub_effect_byte(float facf0, float facf1,
fac1= (int)(256.0f*facf0);
fac3= (int)(256.0f*facf1);
- while(y--) {
+ while (y--) {
x= xo;
- while(x--) {
+ while (x--) {
col= rt1[0]- ((fac1*rt2[0])>>8);
- if(col<0) rt[0]= 0; else rt[0]= col;
+ if (col<0) rt[0]= 0; else rt[0]= col;
col= rt1[1]- ((fac1*rt2[1])>>8);
- if(col<0) rt[1]= 0; else rt[1]= col;
+ if (col<0) rt[1]= 0; else rt[1]= col;
col= rt1[2]- ((fac1*rt2[2])>>8);
- if(col<0) rt[2]= 0; else rt[2]= col;
+ if (col<0) rt[2]= 0; else rt[2]= col;
col= rt1[3]- ((fac1*rt2[3])>>8);
- if(col<0) rt[3]= 0; else rt[3]= col;
+ if (col<0) rt[3]= 0; else rt[3]= col;
rt1+= 4; rt2+= 4; rt+= 4;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo;
- while(x--) {
+ while (x--) {
col= rt1[0]- ((fac3*rt2[0])>>8);
- if(col<0) rt[0]= 0; else rt[0]= col;
+ if (col<0) rt[0]= 0; else rt[0]= col;
col= rt1[1]- ((fac3*rt2[1])>>8);
- if(col<0) rt[1]= 0; else rt[1]= col;
+ if (col<0) rt[1]= 0; else rt[1]= col;
col= rt1[2]- ((fac3*rt2[2])>>8);
- if(col<0) rt[2]= 0; else rt[2]= col;
+ if (col<0) rt[2]= 0; else rt[2]= col;
col= rt1[3]- ((fac3*rt2[3])>>8);
- if(col<0) rt[3]= 0; else rt[3]= col;
+ if (col<0) rt[3]= 0; else rt[3]= col;
rt1+= 4; rt2+= 4; rt+= 4;
}
@@ -1311,20 +1330,20 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y,
fac1= facf0;
fac3= facf1;
- while(y--) {
+ while (y--) {
x= xo * 4;
- while(x--) {
+ while (x--) {
*rt = *rt1 - fac1 * (*rt2);
rt1++; rt2++; rt++;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo * 4;
- while(x--) {
+ while (x--) {
*rt = *rt1 - fac3 * (*rt2);
rt1++; rt2++; rt++;
@@ -1345,7 +1364,8 @@ static struct ImBuf * do_sub_effect(
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
- } else {
+ }
+ else {
do_sub_effect_byte(
facf0, facf1, context.rectx, context.recty,
(char*) ibuf1->rect, (char*) ibuf2->rect,
@@ -1380,7 +1400,7 @@ static void do_drop_effect_byte(float facf0, float facf1, int x, int y,
rt1= (char*) rect1i;
out= (char*) outi;
for (y=0; y<height-YOFF; y++) {
- if(field) fac= fac1;
+ if (field) fac= fac1;
else fac= fac2;
field= !field;
@@ -1421,7 +1441,7 @@ static void do_drop_effect_float(float facf0, float facf1, int x, int y,
rt1= rect1i;
out= outi;
for (y=0; y<height-YOFF; y++) {
- if(field) fac= fac1;
+ if (field) fac= fac1;
else fac= fac2;
field= !field;
@@ -1467,10 +1487,10 @@ static void do_mul_effect_byte(float facf0, float facf1, int x, int y,
* yaux= -s*px + c*py;//+centy
*/
- while(y--) {
+ while (y--) {
x= xo;
- while(x--) {
+ while (x--) {
rt[0]= rt1[0] + ((fac1*rt1[0]*(rt2[0]-256))>>16);
rt[1]= rt1[1] + ((fac1*rt1[1]*(rt2[1]-256))>>16);
@@ -1480,11 +1500,11 @@ static void do_mul_effect_byte(float facf0, float facf1, int x, int y,
rt1+= 4; rt2+= 4; rt+= 4;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo;
- while(x--) {
+ while (x--) {
rt[0]= rt1[0] + ((fac3*rt1[0]*(rt2[0]-256))>>16);
rt[1]= rt1[1] + ((fac3*rt1[1]*(rt2[1]-256))>>16);
@@ -1516,10 +1536,10 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y,
* fac*(a*b) + (1-fac)*a => fac*a*(b-1)+a
*/
- while(y--) {
+ while (y--) {
x= xo;
- while(x--) {
+ while (x--) {
rt[0]= rt1[0] + fac1*rt1[0]*(rt2[0]-1.0f);
rt[1]= rt1[1] + fac1*rt1[1]*(rt2[1]-1.0f);
@@ -1529,11 +1549,11 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y,
rt1+= 4; rt2+= 4; rt+= 4;
}
- if(y==0) break;
+ if (y==0) break;
y--;
x= xo;
- while(x--) {
+ while (x--) {
rt[0]= rt1[0] + fac3*rt1[0]*(rt2[0]-1.0f);
rt[1]= rt1[1] + fac3*rt1[1]*(rt2[1]-1.0f);
@@ -1558,7 +1578,8 @@ static struct ImBuf * do_mul_effect(
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
- } else {
+ }
+ else {
do_mul_effect_byte(
facf0, facf1, context.rectx, context.recty,
(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
@@ -1595,18 +1616,18 @@ static float in_band(float width,float dist,int side,int dir)
{
float alpha;
- if(width == 0)
+ if (width == 0)
return (float)side;
- if(width < dist)
+ if (width < dist)
return (float)side;
- if(side == 1)
+ if (side == 1)
alpha = (dist+0.5f*width) / (width);
else
alpha = (0.5f*width-dist) / (width);
- if(dir == 0)
+ if (dir == 0)
alpha = 1-alpha;
return alpha;
@@ -1627,13 +1648,14 @@ static float check_zone(WipeZone *wipezone, int x, int y,
WipeVars *wipe = (WipeVars *)seq->effectdata;
int width;
- if(wipezone->flip) x = xo - x;
+ if (wipezone->flip) x = xo - x;
angle = wipezone->angle;
- if(wipe->forward) {
+ if (wipe->forward) {
posx = facf0 * xo;
posy = facf0 * yo;
- } else{
+ }
+ else {
posx = xo - facf0 * xo;
posy = yo - facf0 * yo;
}
@@ -1642,7 +1664,7 @@ static float check_zone(WipeZone *wipezone, int x, int y,
case DO_SINGLE_WIPE:
width = wipezone->width;
- if(angle == 0.0f) {
+ if (angle == 0.0f) {
b1 = posy;
b2 = y;
hyp = fabs(y - posy);
@@ -1653,20 +1675,20 @@ static float check_zone(WipeZone *wipezone, int x, int y,
hyp = fabsf(angle*x+y+(-posy-angle*posx))*wipezone->pythangle;
}
- if(angle < 0) {
+ if (angle < 0) {
temp1 = b1;
b1 = b2;
b2 = temp1;
}
- if(wipe->forward) {
- if(b1 < b2)
+ if (wipe->forward) {
+ if (b1 < b2)
output = in_band(width,hyp,1,1);
else
output = in_band(width,hyp,0,1);
}
else {
- if(b1 < b2)
+ if (b1 < b2)
output = in_band(width,hyp,0,1);
else
output = in_band(width,hyp,1,1);
@@ -1674,7 +1696,7 @@ static float check_zone(WipeZone *wipezone, int x, int y,
break;
case DO_DOUBLE_WIPE:
- if(!wipe->forward)
+ if (!wipe->forward)
facf0 = 1.0f-facf0; // Go the other direction
width = wipezone->width; // calculate the blur width
@@ -1698,19 +1720,21 @@ static float check_zone(WipeZone *wipezone, int x, int y,
hwidth = minf(hwidth, fabsf(b3-b1)/2.0f);
- if(b2 < b1 && b2 < b3 ) {
+ if (b2 < b1 && b2 < b3 ) {
output = in_band(hwidth,hyp,0,1);
- } else if(b2 > b1 && b2 > b3 ) {
+ }
+ else if (b2 > b1 && b2 > b3 ) {
output = in_band(hwidth,hyp2,0,1);
- } else {
- if( hyp < hwidth && hyp2 > hwidth )
+ }
+ else {
+ if ( hyp < hwidth && hyp2 > hwidth )
output = in_band(hwidth,hyp,1,1);
- else if( hyp > hwidth && hyp2 < hwidth )
+ else if ( hyp > hwidth && hyp2 < hwidth )
output = in_band(hwidth,hyp2,1,1);
else
output = in_band(hwidth,hyp2,1,1) * in_band(hwidth,hyp,1,1);
}
- if(!wipe->forward)output = 1-output;
+ if (!wipe->forward)output = 1-output;
break;
case DO_CLOCK_WIPE:
/*
@@ -1723,7 +1747,7 @@ static float check_zone(WipeZone *wipezone, int x, int y,
widthf = wipe->edgeWidth*2.0f*(float)M_PI;
temp1 = 2.0f * (float)M_PI * facf0;
- if(wipe->forward) {
+ if (wipe->forward) {
temp1 = 2.0f*(float)M_PI - temp1;
}
@@ -1731,14 +1755,15 @@ static float check_zone(WipeZone *wipezone, int x, int y,
y = y - halfy;
temp2 = asin(abs(y)/sqrt(x*x + y*y));
- if(x <= 0 && y >= 0) temp2 = (float)M_PI - temp2;
- else if(x<=0 && y <= 0) temp2 += (float)M_PI;
- else if(x >= 0 && y <= 0) temp2 = 2.0f*(float)M_PI - temp2;
+ if (x <= 0 && y >= 0) temp2 = (float)M_PI - temp2;
+ else if (x<=0 && y <= 0) temp2 += (float)M_PI;
+ else if (x >= 0 && y <= 0) temp2 = 2.0f*(float)M_PI - temp2;
- if(wipe->forward) {
+ if (wipe->forward) {
temp3 = temp1-(widthf*0.5f)*facf0;
temp4 = temp1+(widthf*0.5f)*(1-facf0);
- } else{
+ }
+ else {
temp3 = temp1-(widthf*0.5f)*(1-facf0);
temp4 = temp1+(widthf*0.5f)*facf0;
}
@@ -1746,19 +1771,19 @@ static float check_zone(WipeZone *wipezone, int x, int y,
if (temp4 > 2.0f*(float)M_PI) temp4 = 2.0f*(float)M_PI;
- if(temp2 < temp3) output = 0;
+ if (temp2 < temp3) output = 0;
else if (temp2 > temp4) output = 1;
else output = (temp2-temp3)/(temp4-temp3);
- if(x == 0 && y == 0) output = 1;
- if(output != output) output = 1;
- if(wipe->forward) output = 1 - output;
+ if (x == 0 && y == 0) output = 1;
+ if (output != output) output = 1;
+ if (wipe->forward) output = 1 - output;
break;
/* BOX WIPE IS NOT WORKING YET */
/* case DO_CROSS_WIPE: */
/* BOX WIPE IS NOT WORKING YET */
/*
case DO_BOX_WIPE:
- if(invert)facf0 = 1-facf0;
+ if (invert)facf0 = 1-facf0;
width = (int)(wipe->edgeWidth*((xo+yo)/2.0));
hwidth = (float)width/2.0;
@@ -1774,22 +1799,24 @@ static float check_zone(WipeZone *wipezone, int x, int y,
temp2 = yo*(1-facf0/2)-yo*facf0/2;
pointdist = sqrt(temp1*temp1 + temp2*temp2);
- if(b2 < b1 && b2 < b3 ) {
- if(hwidth < pointdist)
+ if (b2 < b1 && b2 < b3 ) {
+ if (hwidth < pointdist)
output = in_band(wipezone,hwidth,hyp,facf0,0,1);
- } else if(b2 > b1 && b2 > b3 ) {
- if(hwidth < pointdist)
+ }
+ else if (b2 > b1 && b2 > b3 ) {
+ if (hwidth < pointdist)
output = in_band(wipezone,hwidth,hyp2,facf0,0,1);
- } else {
- if( hyp < hwidth && hyp2 > hwidth )
+ }
+ else {
+ if ( hyp < hwidth && hyp2 > hwidth )
output = in_band(wipezone,hwidth,hyp,facf0,1,1);
- else if( hyp > hwidth && hyp2 < hwidth )
+ else if ( hyp > hwidth && hyp2 < hwidth )
output = in_band(wipezone,hwidth,hyp2,facf0,1,1);
else
output = in_band(wipezone,hwidth,hyp2,facf0,1,1) * in_band(wipezone,hwidth,hyp,facf0,1,1);
}
- if(invert)facf0 = 1-facf0;
+ if (invert)facf0 = 1-facf0;
angle = -1/angle;
b1 = posy/2 - (-angle)*posx/2;
b3 = (yo-posy/2) - (-angle)*(xo-posx/2);
@@ -1798,16 +1825,18 @@ static float check_zone(WipeZone *wipezone, int x, int y,
hyp = abs(angle*x+y+(-posy/2-angle*posx/2))*wipezone->pythangle;
hyp2 = abs(angle*x+y+(-(yo-posy/2)-angle*(xo-posx/2)))*wipezone->pythangle;
- if(b2 < b1 && b2 < b3 ) {
- if(hwidth < pointdist)
+ if (b2 < b1 && b2 < b3 ) {
+ if (hwidth < pointdist)
output *= in_band(wipezone,hwidth,hyp,facf0,0,1);
- } else if(b2 > b1 && b2 > b3 ) {
- if(hwidth < pointdist)
+ }
+ else if (b2 > b1 && b2 > b3 ) {
+ if (hwidth < pointdist)
output *= in_band(wipezone,hwidth,hyp2,facf0,0,1);
- } else {
- if( hyp < hwidth && hyp2 > hwidth )
+ }
+ else {
+ if ( hyp < hwidth && hyp2 > hwidth )
output *= in_band(wipezone,hwidth,hyp,facf0,1,1);
- else if( hyp > hwidth && hyp2 < hwidth )
+ else if ( hyp > hwidth && hyp2 < hwidth )
output *= in_band(wipezone,hwidth,hyp2,facf0,1,1);
else
output *= in_band(wipezone,hwidth,hyp2,facf0,1,1) * in_band(wipezone,hwidth,hyp,facf0,1,1);
@@ -1816,10 +1845,10 @@ static float check_zone(WipeZone *wipezone, int x, int y,
break;
*/
case DO_IRIS_WIPE:
- if(xo > yo) yo = xo;
+ if (xo > yo) yo = xo;
else xo = yo;
- if(!wipe->forward) facf0 = 1-facf0;
+ if (!wipe->forward) facf0 = 1-facf0;
width = wipezone->width;
hwidth = width*0.5f;
@@ -1828,21 +1857,21 @@ static float check_zone(WipeZone *wipezone, int x, int y,
pointdist = sqrt(temp1*temp1 + temp1*temp1);
temp2 = sqrt((halfx-x)*(halfx-x) + (halfy-y)*(halfy-y));
- if(temp2 > pointdist) output = in_band(hwidth,fabs(temp2-pointdist),0,1);
+ if (temp2 > pointdist) output = in_band(hwidth,fabs(temp2-pointdist),0,1);
else output = in_band(hwidth,fabs(temp2-pointdist),1,1);
- if(!wipe->forward) output = 1-output;
+ if (!wipe->forward) output = 1-output;
break;
}
if (output < 0) output = 0;
- else if(output > 1) output = 1;
+ else if (output > 1) output = 1;
return output;
}
static void init_wipe_effect(Sequence *seq)
{
- if(seq->effectdata)MEM_freeN(seq->effectdata);
+ if (seq->effectdata)MEM_freeN(seq->effectdata);
seq->effectdata = MEM_callocN(sizeof(struct WipeVars), "wipevars");
}
@@ -1853,7 +1882,7 @@ static int num_inputs_wipe(void)
static void free_wipe_effect(Sequence *seq)
{
- if(seq->effectdata)MEM_freeN(seq->effectdata);
+ if (seq->effectdata)MEM_freeN(seq->effectdata);
seq->effectdata = NULL;
}
@@ -1880,8 +1909,8 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
xo = x;
yo = y;
- for(y=0;y<yo;y++) {
- for(x=0;x<xo;x++) {
+ for (y=0;y<yo;y++) {
+ for (x=0;x<xo;x++) {
float check = check_zone(&wipezone,x,y,seq,facf0);
if (check) {
if (rt1) {
@@ -1889,19 +1918,22 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
rt[1] = (int)(rt1[1]*check)+ (int)(rt2[1]*(1-check));
rt[2] = (int)(rt1[2]*check)+ (int)(rt2[2]*(1-check));
rt[3] = (int)(rt1[3]*check)+ (int)(rt2[3]*(1-check));
- } else {
+ }
+ else {
rt[0] = 0;
rt[1] = 0;
rt[2] = 0;
rt[3] = 255;
}
- } else {
+ }
+ else {
if (rt2) {
rt[0] = rt2[0];
rt[1] = rt2[1];
rt[2] = rt2[2];
rt[3] = rt2[3];
- } else {
+ }
+ else {
rt[0] = 0;
rt[1] = 0;
rt[2] = 0;
@@ -1910,10 +1942,10 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
}
rt+=4;
- if(rt1 !=NULL) {
+ if (rt1 !=NULL) {
rt1+=4;
}
- if(rt2 !=NULL) {
+ if (rt2 !=NULL) {
rt2+=4;
}
}
@@ -1938,8 +1970,8 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1)
xo = x;
yo = y;
- for(y=0;y<yo;y++) {
- for(x=0;x<xo;x++) {
+ for (y=0;y<yo;y++) {
+ for (x=0;x<xo;x++) {
float check = check_zone(&wipezone,x,y,seq,facf0);
if (check) {
if (rt1) {
@@ -1947,19 +1979,22 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1)
rt[1] = rt1[1]*check+ rt2[1]*(1-check);
rt[2] = rt1[2]*check+ rt2[2]*(1-check);
rt[3] = rt1[3]*check+ rt2[3]*(1-check);
- } else {
+ }
+ else {
rt[0] = 0;
rt[1] = 0;
rt[2] = 0;
rt[3] = 1.0;
}
- } else {
+ }
+ else {
if (rt2) {
rt[0] = rt2[0];
rt[1] = rt2[1];
rt[2] = rt2[2];
rt[3] = rt2[3];
- } else {
+ }
+ else {
rt[0] = 0;
rt[1] = 0;
rt[2] = 0;
@@ -1968,10 +2003,10 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1)
}
rt+=4;
- if(rt1 !=NULL) {
+ if (rt1 !=NULL) {
rt1+=4;
}
- if(rt2 !=NULL) {
+ if (rt2 !=NULL) {
rt2+=4;
}
}
@@ -1991,7 +2026,8 @@ static struct ImBuf * do_wipe_effect(
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
- } else {
+ }
+ else {
do_wipe_effect_byte(seq,
facf0, facf1, context.rectx, context.recty,
(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
@@ -2007,7 +2043,7 @@ static void init_transform_effect(Sequence *seq)
{
TransformVars *transform;
- if(seq->effectdata)MEM_freeN(seq->effectdata);
+ if (seq->effectdata)MEM_freeN(seq->effectdata);
seq->effectdata = MEM_callocN(sizeof(struct TransformVars), "transformvars");
transform = (TransformVars *)seq->effectdata;
@@ -2032,7 +2068,7 @@ static int num_inputs_transform(void)
static void free_transform_effect(Sequence *seq)
{
- if(seq->effectdata)MEM_freeN(seq->effectdata);
+ if (seq->effectdata)MEM_freeN(seq->effectdata);
seq->effectdata = NULL;
}
@@ -2100,18 +2136,20 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
// Scale
if (transform->uniform_scale) {
scale_x = scale_y = transform->ScalexIni;
- } else {
+ }
+ else {
scale_x = transform->ScalexIni;
scale_y = transform->ScaleyIni;
}
// Translate
- if(!transform->percent) {
+ if (!transform->percent) {
float rd_s = (scene->r.size/100.0f);
translate_x = transform->xIni*rd_s+(x/2.0f);
translate_y = transform->yIni*rd_s+(y/2.0f);
- }else{
+ }
+ else {
translate_x = x*(transform->xIni/100.0f)+(x/2.0f);
translate_y = y*(transform->yIni/100.0f)+(y/2.0f);
}
@@ -2205,8 +2243,8 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
for (x=0;x<halfWidth;x++) {
index=(x+y*width)*4;
fx=0;
- curColor[0]=curColor[1]=curColor[2]=0;
- curColor2[0]=curColor2[1]=curColor2[2]=0;
+ zero_v3(curColor);
+ zero_v3(curColor2);
for (i=x-halfWidth;i<x+halfWidth;i++) {
if ((i>=0)&&(i<width)) {
@@ -2236,7 +2274,7 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
for (x=halfWidth;x<width-halfWidth;x++) {
index=(x+y*width)*4;
fx=0;
- curColor[0]=curColor[1]=curColor[2]=0;
+ zero_v3(curColor);
for (i=x-halfWidth;i<x+halfWidth;i++) {
curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
@@ -2259,8 +2297,8 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
for (y=0;y<halfWidth;y++) {
index=(x+y*width)*4;
fy=0;
- curColor[0]=curColor[1]=curColor[2]=0;
- curColor2[0]=curColor2[1]=curColor2[2]=0;
+ zero_v3(curColor);
+ zero_v3(curColor2);
for (i=y-halfWidth;i<y+halfWidth;i++) {
if ((i>=0)&&(i<height)) {
/* Bottom */
@@ -2289,7 +2327,7 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
for (y=halfWidth;y<height-halfWidth;y++) {
index=(x+y*width)*4;
fy=0;
- curColor[0]=curColor[1]=curColor[2]=0;
+ zero_v3(curColor);
for (i=y-halfWidth;i<y+halfWidth;i++) {
curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
@@ -2406,7 +2444,7 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
for (x=halfWidth;x<width-halfWidth;x++) {
index=(x+y*width)*4;
fx=0;
- curColor[0]=curColor[1]=curColor[2]=0;
+ zero_v3(curColor);
for (i=x-halfWidth;i<x+halfWidth;i++) {
curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
@@ -2429,8 +2467,8 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
for (y=0;y<halfWidth;y++) {
index=(x+y*width)*4;
fy=0;
- curColor[0]=curColor[1]=curColor[2]=0;
- curColor2[0]=curColor2[1]=curColor2[2]=0;
+ zero_v3(curColor);
+ zero_v3(curColor2);
for (i=y-halfWidth;i<y+halfWidth;i++) {
if ((i>=0)&&(i<height)) {
/* Bottom */
@@ -2459,7 +2497,7 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
for (y=halfWidth;y<height-halfWidth;y++) {
index=(x+y*width)*4;
fy=0;
- curColor[0]=curColor[1]=curColor[2]=0;
+ zero_v3(curColor);
for (i=y-halfWidth;i<y+halfWidth;i++) {
curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
@@ -2527,7 +2565,7 @@ static void RVIsolateHighlights_byte (unsigned char* in, unsigned char* out,
int intensity;
- for(y=0;y< height;y++) {
+ for (y=0;y< height;y++) {
for (x=0;x< width;x++) {
index= (x+y*width)*4;
@@ -2538,7 +2576,8 @@ static void RVIsolateHighlights_byte (unsigned char* in, unsigned char* out,
out[index+GlowG]=MIN2(255*clamp, (in[index+GlowG]*boost*intensity)/255);
out[index+GlowB]=MIN2(255*clamp, (in[index+GlowB]*boost*intensity)/255);
out[index+GlowA]=MIN2(255*clamp, (in[index+GlowA]*boost*intensity)/255);
- } else{
+ }
+ else {
out[index+GlowR]=0;
out[index+GlowG]=0;
out[index+GlowB]=0;
@@ -2556,7 +2595,7 @@ static void RVIsolateHighlights_float (float* in, float* out,
float intensity;
- for(y=0;y< height;y++) {
+ for (y=0;y< height;y++) {
for (x=0;x< width;x++) {
index= (x+y*width)*4;
@@ -2567,7 +2606,8 @@ static void RVIsolateHighlights_float (float* in, float* out,
out[index+GlowG]=MIN2(clamp, (in[index+GlowG]*boost*intensity));
out[index+GlowB]=MIN2(clamp, (in[index+GlowB]*boost*intensity));
out[index+GlowA]=MIN2(clamp, (in[index+GlowA]*boost*intensity));
- } else{
+ }
+ else {
out[index+GlowR]=0;
out[index+GlowG]=0;
out[index+GlowB]=0;
@@ -2581,7 +2621,7 @@ static void init_glow_effect(Sequence *seq)
{
GlowVars *glow;
- if(seq->effectdata)MEM_freeN(seq->effectdata);
+ if (seq->effectdata)MEM_freeN(seq->effectdata);
seq->effectdata = MEM_callocN(sizeof(struct GlowVars), "glowvars");
glow = (GlowVars *)seq->effectdata;
@@ -2600,7 +2640,7 @@ static int num_inputs_glow(void)
static void free_glow_effect(Sequence *seq)
{
- if(seq->effectdata)MEM_freeN(seq->effectdata);
+ if (seq->effectdata)MEM_freeN(seq->effectdata);
seq->effectdata = NULL;
}
@@ -2654,7 +2694,8 @@ static struct ImBuf * do_glow_effect(
context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
- } else {
+ }
+ else {
do_glow_effect_byte(seq, render_size,
facf0, facf1,
context.rectx, context.recty,
@@ -2673,7 +2714,7 @@ static void init_solid_color(Sequence *seq)
{
SolidColorVars *cv;
- if(seq->effectdata)MEM_freeN(seq->effectdata);
+ if (seq->effectdata)MEM_freeN(seq->effectdata);
seq->effectdata = MEM_callocN(sizeof(struct SolidColorVars), "solidcolor");
cv = (SolidColorVars *)seq->effectdata;
@@ -2687,7 +2728,7 @@ static int num_inputs_color(void)
static void free_solid_color(Sequence *seq)
{
- if(seq->effectdata)MEM_freeN(seq->effectdata);
+ if (seq->effectdata)MEM_freeN(seq->effectdata);
seq->effectdata = NULL;
}
@@ -2731,8 +2772,8 @@ static struct ImBuf * do_solid_color(
rect = (unsigned char *)out->rect;
- for(y=0; y<out->y; y++) {
- for(x=0; x<out->x; x++, rect+=4) {
+ for (y=0; y<out->y; y++) {
+ for (x=0; x<out->x; x++, rect+=4) {
rect[0]= col0[0];
rect[1]= col0[1];
rect[2]= col0[2];
@@ -2740,7 +2781,7 @@ static struct ImBuf * do_solid_color(
}
y++;
if (y<out->y) {
- for(x=0; x<out->x; x++, rect+=4) {
+ for (x=0; x<out->x; x++, rect+=4) {
rect[0]= col1[0];
rect[1]= col1[1];
rect[2]= col1[2];
@@ -2749,7 +2790,8 @@ static struct ImBuf * do_solid_color(
}
}
- } else if (out->rect_float) {
+ }
+ else if (out->rect_float) {
float col0[3];
float col1[3];
@@ -2763,8 +2805,8 @@ static struct ImBuf * do_solid_color(
rect_float = out->rect_float;
- for(y=0; y<out->y; y++) {
- for(x=0; x<out->x; x++, rect_float+=4) {
+ for (y=0; y<out->y; y++) {
+ for (x=0; x<out->x; x++, rect_float+=4) {
rect_float[0]= col0[0];
rect_float[1]= col0[1];
rect_float[2]= col0[2];
@@ -2772,7 +2814,7 @@ static struct ImBuf * do_solid_color(
}
y++;
if (y<out->y) {
- for(x=0; x<out->x; x++, rect_float+=4) {
+ for (x=0; x<out->x; x++, rect_float+=4) {
rect_float[0]= col1[0];
rect_float[1]= col1[1];
rect_float[2]= col1[2];
@@ -2831,7 +2873,8 @@ static struct ImBuf * do_multicam(
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(i);
IMB_freeImBuf(i);
- } else {
+ }
+ else {
out = i;
}
@@ -2908,7 +2951,8 @@ static struct ImBuf * do_adjustment(
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(i);
IMB_freeImBuf(i);
- } else {
+ }
+ else {
out = i;
}
@@ -2922,7 +2966,7 @@ static void init_speed_effect(Sequence *seq)
{
SpeedControlVars * v;
- if(seq->effectdata) MEM_freeN(seq->effectdata);
+ if (seq->effectdata) MEM_freeN(seq->effectdata);
seq->effectdata = MEM_callocN(sizeof(struct SpeedControlVars),
"speedcontrolvars");
@@ -2949,8 +2993,8 @@ static int num_inputs_speed(void)
static void free_speed_effect(Sequence *seq)
{
SpeedControlVars * v = (SpeedControlVars *)seq->effectdata;
- if(v->frameMap) MEM_freeN(v->frameMap);
- if(seq->effectdata) MEM_freeN(seq->effectdata);
+ if (v->frameMap) MEM_freeN(v->frameMap);
+ if (seq->effectdata) MEM_freeN(seq->effectdata);
seq->effectdata = NULL;
}
@@ -2980,11 +3024,13 @@ static void store_icu_yrange_speed(struct Sequence * seq,
if ((v->flags & SEQ_SPEED_INTEGRATE) != 0) {
*ymin = -100.0;
*ymax = 100.0;
- } else {
+ }
+ else {
if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) {
*ymin = 0.0;
*ymax = 1.0;
- } else {
+ }
+ else {
*ymin = 0.0;
*ymax = seq->len;
}
@@ -3037,7 +3083,8 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
flags = SEQ_SPEED_INTEGRATE;
fcu = NULL;
}
- } else {
+ }
+ else {
/* if there is no fcurve, use value as simple multiplier */
if (!fcu) {
fallback_fac = seq->speed_fader; /* same as speed_factor in rna*/
@@ -3052,9 +3099,10 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
v->lastValidFrame = 0;
for (cfra = 1; cfra < v->length; cfra++) {
- if(fcu) {
+ if (fcu) {
facf = evaluate_fcurve(fcu, seq->startdisp + cfra);
- } else {
+ }
+ else {
facf = fallback_fac;
}
facf *= v->globalSpeed;
@@ -3063,20 +3111,23 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
if (cursor >= seq->seq1->len) {
v->frameMap[cfra] = seq->seq1->len - 1;
- } else {
+ }
+ else {
v->frameMap[cfra] = cursor;
v->lastValidFrame = cfra;
}
}
- } else {
+ }
+ else {
float facf;
v->lastValidFrame = 0;
for (cfra = 0; cfra < v->length; cfra++) {
- if(fcu) {
+ if (fcu) {
facf = evaluate_fcurve(fcu, seq->startdisp + cfra);
- } else {
+ }
+ else {
facf = fallback_fac;
}
@@ -3087,7 +3138,8 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
if (facf >= seq->seq1->len) {
facf = seq->seq1->len - 1;
- } else {
+ }
+ else {
v->lastValidFrame = cfra;
}
v->frameMap[cfra] = facf;
@@ -3136,7 +3188,8 @@ static int early_out_fade(struct Sequence *UNUSED(seq),
{
if (facf0 == 0.0f && facf1 == 0.0f) {
return 1;
- } else if (facf0 == 1.0f && facf1 == 1.0f) {
+ }
+ else if (facf0 == 1.0f && facf1 == 1.0f) {
return 2;
}
return 0;
@@ -3193,7 +3246,8 @@ static struct ImBuf * do_overdrop_effect(SeqRenderData context,
facf0, facf1, x, y,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
- } else {
+ }
+ else {
do_drop_effect_byte(
facf0, facf1, x, y,
(char*) ibuf1->rect,
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 8f8874d3a3c..18749d7b5a6 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -39,6 +39,7 @@
#include "MEM_CacheLimiterC-Api.h"
#include "DNA_sequence_types.h"
+#include "DNA_movieclip_types.h"
#include "DNA_scene_types.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
@@ -57,6 +58,7 @@
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_sequencer.h"
+#include "BKE_movieclip.h"
#include "BKE_fcurve.h"
#include "BKE_scene.h"
#include "BKE_utildefines.h"
@@ -103,8 +105,8 @@ void printf_strip(Sequence *seq)
int seqbase_recursive_apply(ListBase *seqbase, int (*apply_func)(Sequence *seq, void *), void *arg)
{
Sequence *iseq;
- for(iseq= seqbase->first; iseq; iseq= iseq->next) {
- if(seq_recursive_apply(iseq, apply_func, arg) == -1)
+ for (iseq= seqbase->first; iseq; iseq= iseq->next) {
+ if (seq_recursive_apply(iseq, apply_func, arg) == -1)
return -1; /* bail out */
}
return 1;
@@ -114,10 +116,10 @@ int seq_recursive_apply(Sequence *seq, int (*apply_func)(Sequence *, void *), vo
{
int ret= apply_func(seq, arg);
- if(ret == -1)
+ if (ret == -1)
return -1; /* bail out */
- if(ret && seq->seqbase.first)
+ if (ret && seq->seqbase.first)
ret = seqbase_recursive_apply(&seq->seqbase, apply_func, arg);
return ret;
@@ -127,16 +129,6 @@ int seq_recursive_apply(Sequence *seq, int (*apply_func)(Sequence *, void *), vo
* alloc / free functions
* ********************************************************************** */
-
-
-void new_tstripdata(Sequence *seq)
-{
- if(seq->strip) {
- seq->strip->len= seq->len;
- }
-}
-
-
/* free */
static void free_proxy_seq(Sequence *seq)
@@ -150,8 +142,8 @@ static void free_proxy_seq(Sequence *seq)
void seq_free_strip(Strip *strip)
{
strip->us--;
- if(strip->us>0) return;
- if(strip->us<0) {
+ if (strip->us>0) return;
+ if (strip->us<0) {
printf("error: negative users in strip\n");
return;
}
@@ -182,9 +174,9 @@ void seq_free_strip(Strip *strip)
void seq_free_sequence(Scene *scene, Sequence *seq)
{
- if(seq->strip) seq_free_strip(seq->strip);
+ if (seq->strip) seq_free_strip(seq->strip);
- if(seq->anim) IMB_free_anim(seq->anim);
+ if (seq->anim) IMB_free_anim(seq->anim);
if (seq->type & SEQ_EFFECT) {
struct SeqEffectHandle sh = get_sequence_effect(seq);
@@ -192,18 +184,18 @@ void seq_free_sequence(Scene *scene, Sequence *seq)
sh.free(seq);
}
- if(seq->sound) {
+ if (seq->sound) {
((ID *)seq->sound)->us--;
}
/* clipboard has no scene and will never have a sound handle or be active */
- if(scene) {
+ if (scene) {
Editing *ed = scene->ed;
if (ed->act_seq==seq)
ed->act_seq= NULL;
- if(seq->scene_sound && ELEM(seq->type, SEQ_SOUND, SEQ_SCENE))
+ if (seq->scene_sound && ELEM(seq->type, SEQ_SOUND, SEQ_SCENE))
sound_remove_scene_sound(scene, seq->scene_sound);
seq_free_animdata(scene, seq);
@@ -216,7 +208,7 @@ void seq_free_sequence_recurse(Scene *scene, Sequence *seq)
{
Sequence *iseq;
- for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
+ for (iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
seq_free_sequence_recurse(scene, iseq);
}
@@ -239,7 +231,7 @@ static void seq_free_clipboard_recursive(Sequence *seq_parent)
{
Sequence *seq, *nseq;
- for(seq= seq_parent->seqbase.first; seq; seq= nseq) {
+ for (seq= seq_parent->seqbase.first; seq; seq= nseq) {
nseq= seq->next;
seq_free_clipboard_recursive(seq);
}
@@ -251,7 +243,7 @@ void seq_free_clipboard(void)
{
Sequence *seq, *nseq;
- for(seq= seqbase_clipboard.first; seq; seq= nseq) {
+ for (seq= seqbase_clipboard.first; seq; seq= nseq) {
nseq= seq->next;
seq_free_clipboard_recursive(seq);
}
@@ -264,7 +256,7 @@ void seq_free_editing(Scene *scene)
MetaStack *ms;
Sequence *seq;
- if(ed==NULL)
+ if (ed==NULL)
return;
SEQ_BEGIN(ed, seq) {
@@ -272,7 +264,7 @@ void seq_free_editing(Scene *scene)
}
SEQ_END
- while((ms= ed->metastack.first)) {
+ while ((ms= ed->metastack.first)) {
BLI_remlink(&ed->metastack, ms);
MEM_freeN(ms);
}
@@ -379,10 +371,10 @@ static void seq_count(ListBase *seqbase, int *tot)
{
Sequence *seq;
- for(seq=seqbase->first; seq; seq=seq->next) {
+ for (seq=seqbase->first; seq; seq=seq->next) {
(*tot)++;
- if(seq->seqbase.first)
+ if (seq->seqbase.first)
seq_count(&seq->seqbase, tot);
}
}
@@ -391,10 +383,10 @@ static void seq_build_array(ListBase *seqbase, Sequence ***array, int depth)
{
Sequence *seq;
- for(seq=seqbase->first; seq; seq=seq->next) {
+ for (seq=seqbase->first; seq; seq=seq->next) {
seq->depth= depth;
- if(seq->seqbase.first)
+ if (seq->seqbase.first)
seq_build_array(&seq->seqbase, array, depth+1);
**array= seq;
@@ -409,19 +401,19 @@ void seq_array(Editing *ed, Sequence ***seqarray, int *tot, int use_pointer)
*seqarray= NULL;
*tot= 0;
- if(ed == NULL)
+ if (ed == NULL)
return;
- if(use_pointer)
+ if (use_pointer)
seq_count(ed->seqbasep, tot);
else
seq_count(&ed->seqbase, tot);
- if(*tot == 0)
+ if (*tot == 0)
return;
*seqarray= array= MEM_mallocN(sizeof(Sequence *)*(*tot), "SeqArray");
- if(use_pointer)
+ if (use_pointer)
seq_build_array(ed->seqbasep, &array, 0);
else
seq_build_array(&ed->seqbase, &array, 0);
@@ -432,7 +424,7 @@ void seq_begin(Editing *ed, SeqIterator *iter, int use_pointer)
memset(iter, 0, sizeof(*iter));
seq_array(ed, &iter->array, &iter->tot, use_pointer);
- if(iter->tot) {
+ if (iter->tot) {
iter->cur= 0;
iter->seq= iter->array[iter->cur];
iter->valid= 1;
@@ -441,7 +433,7 @@ void seq_begin(Editing *ed, SeqIterator *iter, int use_pointer)
void seq_next(SeqIterator *iter)
{
- if(++iter->cur < iter->tot)
+ if (++iter->cur < iter->tot)
iter->seq= iter->array[iter->cur];
else
iter->valid= 0;
@@ -449,7 +441,7 @@ void seq_next(SeqIterator *iter)
void seq_end(SeqIterator *iter)
{
- if(iter->array)
+ if (iter->array)
MEM_freeN(iter->array);
iter->valid= 0;
@@ -470,12 +462,12 @@ static void do_seq_count_cb(ListBase *seqbase, int *totseq,
Sequence *seq;
seq= seqbase->first;
- while(seq) {
+ while (seq) {
int test = test_func(seq);
if (test & BUILD_SEQAR_COUNT_CURRENT) {
(*totseq)++;
}
- if(seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
+ if (seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
do_seq_count_cb(&seq->seqbase, totseq, test_func);
}
seq= seq->next;
@@ -488,11 +480,11 @@ static void do_build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int depth,
Sequence *seq;
seq= seqbase->first;
- while(seq) {
+ while (seq) {
int test = test_func(seq);
seq->depth= depth;
- if(seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
+ if (seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
do_build_seqar_cb(&seq->seqbase, seqar, depth+1, test_func);
}
if (test & BUILD_SEQAR_COUNT_CURRENT) {
@@ -511,7 +503,7 @@ void build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int *totseq,
*totseq= 0;
do_seq_count_cb(seqbase, totseq, test_func);
- if(*totseq==0) {
+ if (*totseq==0) {
*seqar= NULL;
return;
}
@@ -529,18 +521,18 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
/* for sound we go over full meta tree to update bounds of the sound strips,
* since sound is played outside of evaluating the imbufs, */
- for(seq=metaseq->seqbase.first; seq; seq=seq->next) {
- if(seq->type == SEQ_META) {
+ for (seq=metaseq->seqbase.first; seq; seq=seq->next) {
+ if (seq->type == SEQ_META) {
seq_update_sound_bounds_recursive(scene, seq);
}
- else if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
- if(seq->scene_sound) {
+ else if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
+ if (seq->scene_sound) {
int startofs = seq->startofs;
int endofs = seq->endofs;
- if(seq->startofs + seq->start < metaseq->start + metaseq->startofs)
+ if (seq->startofs + seq->start < metaseq->start + metaseq->startofs)
startofs = metaseq->start + metaseq->startofs - seq->start;
- if(seq->start + seq->len - seq->endofs > metaseq->start + metaseq->len - metaseq->endofs)
+ if (seq->start + seq->len - seq->endofs > metaseq->start + metaseq->len - metaseq->endofs)
endofs = seq->start + seq->len - metaseq->start - metaseq->len + metaseq->endofs;
sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start+seq->len - endofs, startofs);
}
@@ -550,24 +542,24 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
void calc_sequence_disp(Scene *scene, Sequence *seq)
{
- if(seq->startofs && seq->startstill) seq->startstill= 0;
- if(seq->endofs && seq->endstill) seq->endstill= 0;
+ if (seq->startofs && seq->startstill) seq->startstill= 0;
+ if (seq->endofs && seq->endstill) seq->endstill= 0;
seq->startdisp= seq->start + seq->startofs - seq->startstill;
seq->enddisp= seq->start+seq->len - seq->endofs + seq->endstill;
seq->handsize= 10.0; /* 10 frames */
- if( seq->enddisp-seq->startdisp < 10 ) {
+ if ( seq->enddisp-seq->startdisp < 10 ) {
seq->handsize= (float)(0.5*(seq->enddisp-seq->startdisp));
}
- else if(seq->enddisp-seq->startdisp > 250) {
+ else if (seq->enddisp-seq->startdisp > 250) {
seq->handsize= (float)((seq->enddisp-seq->startdisp)/25);
}
- if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
+ if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
seq_update_sound_bounds(scene, seq);
}
- else if(seq->type == SEQ_META)
+ else if (seq->type == SEQ_META)
seq_update_sound_bounds_recursive(scene, seq);
}
@@ -578,17 +570,17 @@ void calc_sequence(Scene *scene, Sequence *seq)
/* check all metas recursively */
seqm= seq->seqbase.first;
- while(seqm) {
- if(seqm->seqbase.first) calc_sequence(scene, seqm);
+ while (seqm) {
+ if (seqm->seqbase.first) calc_sequence(scene, seqm);
seqm= seqm->next;
}
/* effects and meta: automatic start and end */
- if(seq->type & SEQ_EFFECT) {
+ if (seq->type & SEQ_EFFECT) {
/* pointers */
- if(seq->seq2==NULL) seq->seq2= seq->seq1;
- if(seq->seq3==NULL) seq->seq3= seq->seq1;
+ if (seq->seq2==NULL) seq->seq2= seq->seq1;
+ if (seq->seq3==NULL) seq->seq3= seq->seq1;
/* effecten go from seq1 -> seq2: test */
@@ -605,7 +597,7 @@ void calc_sequence(Scene *scene, Sequence *seq)
seq->enddisp= MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp);
/* we cant help if strips don't overlap, it wont give useful results.
* but at least ensure 'len' is never negative which causes bad bugs elsewhere. */
- if(seq->enddisp < seq->startdisp) {
+ if (seq->enddisp < seq->startdisp) {
/* simple start/end swap */
seq->start= seq->enddisp;
seq->enddisp = seq->startdisp;
@@ -621,31 +613,22 @@ void calc_sequence(Scene *scene, Sequence *seq)
else {
calc_sequence_disp(scene, seq);
}
-
- if(seq->strip && seq->len!=seq->strip->len) {
- new_tstripdata(seq);
- }
-
}
else {
- if(seq->type==SEQ_META) {
+ if (seq->type==SEQ_META) {
seqm= seq->seqbase.first;
- if(seqm) {
+ if (seqm) {
min= MAXFRAME * 2;
max= -MAXFRAME * 2;
- while(seqm) {
- if(seqm->startdisp < min) min= seqm->startdisp;
- if(seqm->enddisp > max) max= seqm->enddisp;
+ while (seqm) {
+ if (seqm->startdisp < min) min= seqm->startdisp;
+ if (seqm->enddisp > max) max= seqm->enddisp;
seqm= seqm->next;
}
seq->start= min + seq->anim_startofs;
seq->len = max-min;
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
-
- if(seq->strip && seq->len!=seq->strip->len) {
- new_tstripdata(seq);
- }
}
seq_update_sound_bounds_recursive(scene, seq);
}
@@ -658,27 +641,19 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
{
char str[FILE_MAX];
int prev_startdisp=0, prev_enddisp=0;
- /* note: dont rename the strip, will break animation curves */
+ /* note: don't rename the strip, will break animation curves */
if (ELEM5(seq->type, SEQ_MOVIE, SEQ_IMAGE, SEQ_SOUND, SEQ_SCENE, SEQ_META)==0) {
return;
}
- if(lock_range) {
- /* keep so we dont have to move the actual start and end points (only the data) */
+ if (lock_range) {
+ /* keep so we don't have to move the actual start and end points (only the data) */
calc_sequence_disp(scene, seq);
prev_startdisp= seq->startdisp;
prev_enddisp= seq->enddisp;
}
-
- new_tstripdata(seq);
-
- if (ELEM3(seq->type, SEQ_SCENE, SEQ_META, SEQ_IMAGE)==0) {
- BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name);
- BLI_path_abs(str, G.main->name);
- }
-
switch(seq->type) {
case SEQ_IMAGE:
{
@@ -691,11 +666,14 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
if (seq->len < 0) {
seq->len = 0;
}
- seq->strip->len = seq->len;
break;
}
case SEQ_MOVIE:
- if(seq->anim) IMB_free_anim(seq->anim);
+ BLI_join_dirfile(str, sizeof(str), seq->strip->dir,
+ seq->strip->stripdata->name);
+ BLI_path_abs(str, G.main->name);
+
+ if (seq->anim) IMB_free_anim(seq->anim);
seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex);
if (!seq->anim) {
@@ -714,11 +692,10 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
if (seq->len < 0) {
seq->len = 0;
}
- seq->strip->len = seq->len;
break;
case SEQ_SOUND:
#ifdef WITH_AUDASPACE
- if(!seq->sound)
+ if (!seq->sound)
return;
seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS);
seq->len -= seq->anim_startofs;
@@ -726,43 +703,25 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
if (seq->len < 0) {
seq->len = 0;
}
- seq->strip->len = seq->len;
#else
return;
#endif
break;
case SEQ_SCENE:
{
- /* 'seq->scenenr' should be replaced with something more reliable */
- Scene * sce = G.main->scene.first;
- int nr = 1;
-
- while(sce) {
- if(nr == seq->scenenr) {
- break;
- }
- nr++;
- sce= sce->id.next;
- }
-
- if (sce) {
- seq->scene = sce;
- }
-
seq->len= (seq->scene)? seq->scene->r.efra - seq->scene->r.sfra + 1: 0;
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
seq->len = 0;
}
- seq->strip->len = seq->len;
break;
}
}
free_proxy_seq(seq);
- if(lock_range) {
+ if (lock_range) {
seq_tx_set_final_left(seq, prev_startdisp);
seq_tx_set_final_right(seq, prev_enddisp);
seq_single_fix(seq);
@@ -779,35 +738,35 @@ void sort_seq(Scene *scene)
Sequence *seq, *seqt;
- if(ed==NULL) return;
+ if (ed==NULL) return;
seqbase.first= seqbase.last= NULL;
effbase.first= effbase.last= NULL;
- while( (seq= ed->seqbasep->first) ) {
+ while ( (seq= ed->seqbasep->first) ) {
BLI_remlink(ed->seqbasep, seq);
- if(seq->type & SEQ_EFFECT) {
+ if (seq->type & SEQ_EFFECT) {
seqt= effbase.first;
- while(seqt) {
- if(seqt->machine>=seq->machine) {
+ while (seqt) {
+ if (seqt->machine>=seq->machine) {
BLI_insertlinkbefore(&effbase, seqt, seq);
break;
}
seqt= seqt->next;
}
- if(seqt==NULL) BLI_addtail(&effbase, seq);
+ if (seqt==NULL) BLI_addtail(&effbase, seq);
}
else {
seqt= seqbase.first;
- while(seqt) {
- if(seqt->machine>=seq->machine) {
+ while (seqt) {
+ if (seqt->machine>=seq->machine) {
BLI_insertlinkbefore(&seqbase, seqt, seq);
break;
}
seqt= seqt->next;
}
- if(seqt==NULL) BLI_addtail(&seqbase, seq);
+ if (seqt==NULL) BLI_addtail(&seqbase, seq);
}
}
@@ -818,7 +777,7 @@ void sort_seq(Scene *scene)
static int clear_scene_in_allseqs_cb(Sequence *seq, void *arg_pt)
{
- if(seq->scene==(Scene *)arg_pt)
+ if (seq->scene==(Scene *)arg_pt)
seq->scene= NULL;
return 1;
}
@@ -828,8 +787,8 @@ void clear_scene_in_allseqs(Main *bmain, Scene *scene)
Scene *scene_iter;
/* when a scene is deleted: test all seqs */
- for(scene_iter= bmain->scene.first; scene_iter; scene_iter= scene_iter->id.next) {
- if(scene_iter != scene && scene_iter->ed) {
+ for (scene_iter= bmain->scene.first; scene_iter; scene_iter= scene_iter->id.next) {
+ if (scene_iter != scene && scene_iter->ed) {
seqbase_recursive_apply(&scene_iter->ed->seqbase, clear_scene_in_allseqs_cb, scene);
}
}
@@ -852,7 +811,7 @@ static void seqbase_unique_name(ListBase *seqbasep, Sequence *seq)
static void seqbase_unique_name(ListBase *seqbasep, SeqUniqueInfo *sui)
{
Sequence *seq;
- for(seq=seqbasep->first; seq; seq= seq->next) {
+ for (seq=seqbasep->first; seq; seq= seq->next) {
if (sui->seq != seq && strcmp(sui->name_dest, seq->name+2)==0) {
/* SEQ_NAME_MAXSTR - 2 for prefix, -1 for \0, -4 for the number */
BLI_snprintf(sui->name_dest, sizeof(sui->name_dest), "%.59s.%03d", sui->name_src, sui->count++);
@@ -863,7 +822,7 @@ static void seqbase_unique_name(ListBase *seqbasep, SeqUniqueInfo *sui)
static int seqbase_unique_name_recursive_cb(Sequence *seq, void *arg_pt)
{
- if(seq->seqbase.first)
+ if (seq->seqbase.first)
seqbase_unique_name(&seq->seqbase, (SeqUniqueInfo *)arg_pt);
return 1;
}
@@ -884,11 +843,11 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq)
*dot= '\0';
dot++;
- if(*dot)
+ if (*dot)
sui.count= atoi(dot) + 1;
}
- while(sui.match) {
+ while (sui.match) {
sui.match= 0;
seqbase_unique_name(seqbasep, &sui);
seqbase_recursive_apply(seqbasep, seqbase_unique_name_recursive_cb, &sui);
@@ -904,6 +863,7 @@ static const char *give_seqname_by_type(int type)
case SEQ_IMAGE: return "Image";
case SEQ_SCENE: return "Scene";
case SEQ_MOVIE: return "Movie";
+ case SEQ_MOVIECLIP: return "Clip";
case SEQ_SOUND: return "Audio";
case SEQ_CROSS: return "Cross";
case SEQ_GAMCROSS: return "Gamma Cross";
@@ -930,16 +890,19 @@ const char *give_seqname(Sequence *seq)
const char *name = give_seqname_by_type(seq->type);
if (!name) {
- if(seq->type<SEQ_EFFECT) {
+ if (seq->type<SEQ_EFFECT) {
return seq->strip->dir;
- } else if(seq->type==SEQ_PLUGIN) {
- if(!(seq->flag & SEQ_EFFECT_NOT_LOADED) &&
+ }
+ else if (seq->type==SEQ_PLUGIN) {
+ if (!(seq->flag & SEQ_EFFECT_NOT_LOADED) &&
seq->plugin && seq->plugin->doit) {
return seq->plugin->pname;
- } else {
+ }
+ else {
return "Plugin";
}
- } else {
+ }
+ else {
return "Effect";
}
}
@@ -954,7 +917,7 @@ static void make_black_ibuf(ImBuf *ibuf)
float *rect_float;
int tot;
- if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) return;
+ if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) return;
tot= ibuf->x*ibuf->y;
@@ -983,23 +946,23 @@ static void multibuf(ImBuf *ibuf, float fmul)
if (rt) {
a= ibuf->x*ibuf->y;
- while(a--) {
+ while (a--) {
icol= (mul*rt[0])>>8;
- if(icol>254) rt[0]= 255; else rt[0]= icol;
+ if (icol>254) rt[0]= 255; else rt[0]= icol;
icol= (mul*rt[1])>>8;
- if(icol>254) rt[1]= 255; else rt[1]= icol;
+ if (icol>254) rt[1]= 255; else rt[1]= icol;
icol= (mul*rt[2])>>8;
- if(icol>254) rt[2]= 255; else rt[2]= icol;
+ if (icol>254) rt[2]= 255; else rt[2]= icol;
icol= (mul*rt[3])>>8;
- if(icol>254) rt[3]= 255; else rt[3]= icol;
+ if (icol>254) rt[3]= 255; else rt[3]= icol;
rt+= 4;
}
}
if (rt_float) {
a= ibuf->x*ibuf->y;
- while(a--) {
+ while (a--) {
rt_float[0] *= fmul;
rt_float[1] *= fmul;
rt_float[2] *= fmul;
@@ -1020,18 +983,19 @@ static float give_stripelem_index(Sequence *seq, float cfra)
end = seq->enddisp;
}
- if(end < sta) {
+ if (end < sta) {
return -1;
}
- if(seq->flag&SEQ_REVERSE_FRAMES) {
+ if (seq->flag&SEQ_REVERSE_FRAMES) {
/*reverse frame in this sequence */
- if(cfra <= sta) nr= end - sta;
- else if(cfra >= end) nr= 0;
+ if (cfra <= sta) nr= end - sta;
+ else if (cfra >= end) nr= 0;
else nr= end - cfra;
- } else {
- if(cfra <= sta) nr= 0;
- else if(cfra >= end) nr= end - sta;
+ }
+ else {
+ if (cfra <= sta) nr= 0;
+ else if (cfra >= end) nr= end - sta;
else nr= cfra - sta;
}
@@ -1048,7 +1012,7 @@ StripElem *give_stripelem(Sequence *seq, int cfra)
{
StripElem *se= seq->strip->stripdata;
- if(seq->type == SEQ_IMAGE) { /* only
+ if (seq->type == SEQ_IMAGE) { /* only
* IMAGE strips use the whole array,
* MOVIE strips use only
* the first element, all other strips
@@ -1070,8 +1034,8 @@ static int evaluate_seq_frame_gen(Sequence ** seq_arr, ListBase *seqbase, int cf
memset(seq_arr, 0, sizeof(Sequence*) * (MAXSEQ+1));
seq= seqbase->first;
- while(seq) {
- if(seq->startdisp <=cfra && seq->enddisp > cfra) {
+ while (seq) {
+ if (seq->startdisp <=cfra && seq->enddisp > cfra) {
seq_arr[seq->machine]= seq;
totseq++;
}
@@ -1086,7 +1050,7 @@ int evaluate_seq_frame(Scene *scene, int cfra)
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq_arr[MAXSEQ+1];
- if(ed==NULL) return 0;
+ if (ed==NULL) return 0;
return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra);
}
@@ -1105,7 +1069,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se
return 0;
}
- if(evaluate_seq_frame_gen(seq_arr, seqbasep, cfra)) {
+ if (evaluate_seq_frame_gen(seq_arr, seqbasep, cfra)) {
if (b == 0) {
b = MAXSEQ;
}
@@ -1171,12 +1135,26 @@ static IMB_Proxy_Size seq_rendersize_to_proxysize(int size)
return IMB_PROXY_25;
}
+static double seq_rendersize_to_scale_factor(int size)
+{
+ if (size >= 99) {
+ return 1.0;
+ }
+ if (size >= 75) {
+ return 0.75;
+ }
+ if (size >= 50) {
+ return 0.50;
+ }
+ return 0.25;
+}
+
static void seq_open_anim_file(Sequence * seq)
{
char name[FILE_MAX];
StripProxy * proxy;
- if(seq->anim != NULL) {
+ if (seq->anim != NULL) {
return;
}
@@ -1223,9 +1201,11 @@ static int seq_proxy_get_fname(Sequence * seq, int cfra, int render_size, char *
if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) {
BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir));
- } else if (seq->type == SEQ_IMAGE) {
+ }
+ else if (seq->type == SEQ_IMAGE) {
BLI_snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir);
- } else {
+ }
+ else {
return FALSE;
}
@@ -1244,7 +1224,8 @@ static int seq_proxy_get_fname(Sequence * seq, int cfra, int render_size, char *
render_size,
give_stripelem(seq, cfra)->name);
frameno = 1;
- } else {
+ }
+ else {
frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs;
BLI_snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir,
render_size);
@@ -1310,7 +1291,8 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int
if (BLI_exists(name)) {
return IMB_loadiffname(name, IB_rect);
- } else {
+ }
+ else {
return NULL;
}
}
@@ -1344,7 +1326,7 @@ static void seq_proxy_build_frame(SeqRenderData context,
ibuf->ftype= JPG | quality;
/* unsupported feature only confuses other s/w */
- if(ibuf->planes==32)
+ if (ibuf->planes==32)
ibuf->planes= 24;
BLI_make_existing_file(name);
@@ -1446,7 +1428,7 @@ void seq_proxy_rebuild(SeqIndexBuildContext *context, short *stop, short *do_upd
- seq->startdisp + seq->startstill);
*do_update= 1;
- if(*stop || G.afbreek)
+ if (*stop || G.afbreek)
break;
}
}
@@ -1477,11 +1459,11 @@ static StripColorBalance calc_cb(StripColorBalance * cb_)
cb.lift[c] = 2.0f - cb.lift[c];
}
- if(cb.flag & SEQ_COLOR_BALANCE_INVERSE_LIFT) {
+ if (cb.flag & SEQ_COLOR_BALANCE_INVERSE_LIFT) {
for (c = 0; c < 3; c++) {
/* tweak to give more subtle results
* values above 1.0 are scaled */
- if(cb.lift[c] > 1.0f)
+ if (cb.lift[c] > 1.0f)
cb.lift[c] = pow(cb.lift[c] - 1.0f, 2.0) + 1.0;
cb.lift[c] = 2.0f - cb.lift[c];
@@ -1492,7 +1474,8 @@ static StripColorBalance calc_cb(StripColorBalance * cb_)
for (c = 0; c < 3; c++) {
if (cb.gain[c] != 0.0f) {
cb.gain[c] = 1.0f / cb.gain[c];
- } else {
+ }
+ else {
cb.gain[c] = 1000000; /* should be enough :) */
}
}
@@ -1502,7 +1485,8 @@ static StripColorBalance calc_cb(StripColorBalance * cb_)
for (c = 0; c < 3; c++) {
if (cb.gamma[c] != 0.0f) {
cb.gamma[c] = 1.0f/cb.gamma[c];
- } else {
+ }
+ else {
cb.gamma[c] = 1000000; /* should be enough :) */
}
}
@@ -1620,15 +1604,17 @@ static void color_balance(Sequence * seq, ImBuf* ibuf, float mul)
{
if (ibuf->rect_float) {
color_balance_float_float(seq, ibuf, mul);
- } else if(seq->flag & SEQ_MAKE_FLOAT) {
+ }
+ else if (seq->flag & SEQ_MAKE_FLOAT) {
color_balance_byte_float(seq, ibuf, mul);
- } else {
+ }
+ else {
color_balance_byte_byte(seq, ibuf, mul);
}
}
/*
- * input preprocessing for SEQ_IMAGE, SEQ_MOVIE and SEQ_SCENE
+ * input preprocessing for SEQ_IMAGE, SEQ_MOVIE, SEQ_MOVIECLIP and SEQ_SCENE
*
* Do all the things you can't really do afterwards using sequence effects
* (read: before rescaling to render resolution has been done)
@@ -1657,7 +1643,7 @@ int input_have_to_preprocess(
mul = seq->mul;
- if(seq->blend_mode == SEQ_BLEND_REPLACE) {
+ if (seq->blend_mode == SEQ_BLEND_REPLACE) {
mul *= seq->blend_opacity / 100.0f;
}
@@ -1673,45 +1659,81 @@ int input_have_to_preprocess(
}
static ImBuf * input_preprocess(
- SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf * ibuf)
+ SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf * ibuf,
+ int is_proxy_image, int is_preprocessed)
{
float mul;
ibuf = IMB_makeSingleUser(ibuf);
- if((seq->flag & SEQ_FILTERY) && seq->type != SEQ_MOVIE) {
+ if ((seq->flag & SEQ_FILTERY)
+ && !ELEM(seq->type, SEQ_MOVIE, SEQ_MOVIECLIP)) {
IMB_filtery(ibuf);
}
- if(seq->flag & (SEQ_USE_CROP|SEQ_USE_TRANSFORM)) {
+ if (seq->flag & (SEQ_USE_CROP|SEQ_USE_TRANSFORM)) {
StripCrop c= {0};
StripTransform t= {0};
int sx,sy,dx,dy;
+ double xscale = 1.0;
+ double yscale = 1.0;
+
+ if (is_proxy_image) {
+ double f = seq_rendersize_to_scale_factor(
+ context.preview_render_size);
+
+ if (f != 1.0) {
+ IMB_scalefastImBuf(
+ ibuf, ibuf->x / f, ibuf->y / f);
+ }
+ }
- if(seq->flag & SEQ_USE_CROP && seq->strip->crop) {
+ if (seq->flag & SEQ_USE_CROP && seq->strip->crop) {
c = *seq->strip->crop;
}
- if(seq->flag & SEQ_USE_TRANSFORM && seq->strip->transform) {
+ if (seq->flag & SEQ_USE_TRANSFORM && seq->strip->transform) {
t = *seq->strip->transform;
}
+ xscale = context.scene->r.xsch ?
+ ((double) context.rectx /
+ (double) context.scene->r.xsch) : 1.0;
+ yscale = context.scene->r.ysch ?
+ ((double) context.recty /
+ (double) context.scene->r.ysch) : 1.0;
+
+ c.left *= xscale; c.right *= xscale;
+ c.top *= yscale; c.bottom *= yscale;
+
+ t.xofs *= xscale; t.yofs *= yscale;
+
sx = ibuf->x - c.left - c.right;
sy = ibuf->y - c.top - c.bottom;
dx = sx;
dy = sy;
if (seq->flag & SEQ_USE_TRANSFORM) {
- dx = context.scene->r.xsch;
- dy = context.scene->r.ysch;
+ if (is_preprocessed) {
+ dx = context.rectx;
+ dy = context.recty;
+ }
+ else {
+ dx = context.scene->r.xsch;
+ dy = context.scene->r.ysch;
+ }
}
- if (c.top + c.bottom >= ibuf->y || c.left + c.right >= ibuf->x ||
- t.xofs >= dx || t.yofs >= dy) {
+ if (c.top+c.bottom >= ibuf->y || c.left+c.right >= ibuf->x ||
+ t.xofs >= dx || t.yofs >= dy) {
make_black_ibuf(ibuf);
- } else {
- ImBuf * i = IMB_allocImBuf(dx, dy,32, ibuf->rect_float ? IB_rectfloat : IB_rect);
+ }
+ else {
+ ImBuf * i = IMB_allocImBuf(
+ dx, dy, 32,
+ ibuf->rect_float ? IB_rectfloat : IB_rect);
- IMB_rectcpy(i, ibuf, t.xofs, t.yofs, c.left, c.bottom, sx, sy);
+ IMB_rectcpy(i, ibuf,
+ t.xofs, t.yofs, c.left, c.bottom, sx, sy);
IMB_freeImBuf(ibuf);
@@ -1719,52 +1741,30 @@ static ImBuf * input_preprocess(
}
}
- if(seq->flag & SEQ_FLIPX) {
+ if (seq->flag & SEQ_FLIPX) {
IMB_flipx(ibuf);
}
- if(seq->flag & SEQ_FLIPY) {
+ if (seq->flag & SEQ_FLIPY) {
IMB_flipy(ibuf);
}
- if(seq->sat != 1.0f) {
- /* inline for now, could become an imbuf function */
- int i;
- unsigned char *rct= (unsigned char *)ibuf->rect;
- float *rctf= ibuf->rect_float;
- const float sat= seq->sat;
- float hsv[3];
-
- if(rct) {
- float rgb[3];
- for (i = ibuf->x * ibuf->y; i > 0; i--, rct+=4) {
- rgb_uchar_to_float(rgb, rct);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
- hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rgb, rgb+1, rgb+2);
- rgb_float_to_uchar(rct, rgb);
- }
- }
-
- if(rctf) {
- for (i = ibuf->x * ibuf->y; i > 0; i--, rctf+=4) {
- rgb_to_hsv(rctf[0], rctf[1], rctf[2], hsv, hsv+1, hsv+2);
- hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rctf, rctf+1, rctf+2);
- }
- }
+ if (seq->sat != 1.0f) {
+ IMB_saturation(ibuf, seq->sat);
}
mul = seq->mul;
- if(seq->blend_mode == SEQ_BLEND_REPLACE) {
+ if (seq->blend_mode == SEQ_BLEND_REPLACE) {
mul *= seq->blend_opacity / 100.0f;
}
- if(seq->flag & SEQ_USE_COLOR_BALANCE && seq->strip->color_balance) {
+ if (seq->flag & SEQ_USE_COLOR_BALANCE && seq->strip->color_balance) {
color_balance(seq, ibuf, mul);
mul = 1.0;
}
- if(seq->flag & SEQ_MAKE_FLOAT) {
+ if (seq->flag & SEQ_MAKE_FLOAT) {
if (!ibuf->rect_float)
IMB_float_from_rect_simple(ibuf);
@@ -1773,21 +1773,22 @@ static ImBuf * input_preprocess(
}
}
- if(mul != 1.0f) {
+ if (mul != 1.0f) {
multibuf(ibuf, mul);
}
- if(seq->flag & SEQ_MAKE_PREMUL) {
- if(ibuf->planes == 32 && ibuf->zbuf == NULL) {
+ if (seq->flag & SEQ_MAKE_PREMUL) {
+ if (ibuf->planes == 32 && ibuf->zbuf == NULL) {
IMB_premultiply_alpha(ibuf);
}
}
- if(ibuf->x != context.rectx || ibuf->y != context.recty ) {
- if(context.scene->r.mode & R_OSA) {
+ if (ibuf->x != context.rectx || ibuf->y != context.recty ) {
+ if (context.scene->r.mode & R_OSA) {
IMB_scaleImBuf(ibuf, (short)context.rectx, (short)context.recty);
- } else {
+ }
+ else {
IMB_scalefastImBuf(ibuf, (short)context.rectx, (short)context.recty);
}
}
@@ -1804,7 +1805,8 @@ static ImBuf * copy_from_ibuf_still(SeqRenderData context, Sequence * seq,
ibuf = seq_stripelem_cache_get(
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_STARTSTILL);
- } else if (nr == seq->len - 1) {
+ }
+ else if (nr == seq->len - 1) {
ibuf = seq_stripelem_cache_get(
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_ENDSTILL);
@@ -1886,10 +1888,11 @@ static ImBuf* seq_render_effect_strip_impl(
fcu = id_data_find_fcurve(&context.scene->id, seq, &RNA_Sequence, "effect_fader", 0, NULL);
if (fcu) {
fac = facf = evaluate_fcurve(fcu, cfra);
- if( context.scene->r.mode & R_FIELDS ) {
+ if ( context.scene->r.mode & R_FIELDS ) {
facf = evaluate_fcurve(fcu, cfra + 0.5f);
}
- } else {
+ }
+ else {
fac = facf = seq->effect_fader;
}
}
@@ -1902,8 +1905,8 @@ static ImBuf* seq_render_effect_strip_impl(
NULL, NULL, NULL);
break;
case EARLY_DO_EFFECT:
- for(i=0; i<3; i++) {
- if(input[i])
+ for (i=0; i<3; i++) {
+ if (input[i])
ibuf[i] = seq_render_strip(
context, input[i], cfra);
}
@@ -1920,7 +1923,8 @@ static ImBuf* seq_render_effect_strip_impl(
if (ibuf[0]) {
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(ibuf[0]);
- } else {
+ }
+ else {
out = ibuf[0];
IMB_refImBuf(out);
}
@@ -1933,7 +1937,8 @@ static ImBuf* seq_render_effect_strip_impl(
if (ibuf[1]) {
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(ibuf[1]);
- } else {
+ }
+ else {
out = ibuf[1];
IMB_refImBuf(out);
}
@@ -1952,12 +1957,63 @@ static ImBuf* seq_render_effect_strip_impl(
return out;
}
+static ImBuf * seq_render_movieclip_strip(
+ SeqRenderData context, Sequence * seq, float nr)
+{
+ ImBuf * ibuf = NULL;
+ MovieClipUser user;
+ float tloc[2], tscale, tangle;
+
+ if (!seq->clip) {
+ return NULL;
+ }
+
+ memset(&user, 0, sizeof(MovieClipUser));
+
+ BKE_movieclip_user_set_frame(&user, nr + seq->anim_startofs);
+
+ user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
+
+ switch (seq_rendersize_to_proxysize(context.preview_render_size)) {
+ case IMB_PROXY_NONE:
+ user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
+ break;
+ case IMB_PROXY_100:
+ user.render_size = MCLIP_PROXY_RENDER_SIZE_100;
+ break;
+ case IMB_PROXY_75:
+ user.render_size = MCLIP_PROXY_RENDER_SIZE_75;
+ break;
+ case IMB_PROXY_50:
+ user.render_size = MCLIP_PROXY_RENDER_SIZE_50;
+ break;
+ case IMB_PROXY_25:
+ user.render_size = MCLIP_PROXY_RENDER_SIZE_25;
+ break;
+ }
+
+ if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_UNDISTORTED) {
+ user.render_flag = MCLIP_PROXY_RENDER_UNDISTORT;
+ }
-static ImBuf * seq_render_scene_strip_impl(
+ if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_STABILIZED) {
+ ibuf = BKE_movieclip_get_stable_ibuf(
+ seq->clip, &user, tloc, &tscale, &tangle,
+ 0);
+ }
+ else {
+ ibuf = BKE_movieclip_get_ibuf_flag(
+ seq->clip, &user, 0, MOVIECLIP_CACHE_SKIP);
+ }
+
+ return ibuf;
+}
+
+static ImBuf * seq_render_scene_strip(
SeqRenderData context, Sequence * seq, float nr)
{
ImBuf * ibuf = NULL;
- float frame= seq->sfra + nr + seq->anim_startofs;
+ float frame;
float oldcfra;
Object *camera;
ListBase oldmarkers;
@@ -1999,26 +2055,27 @@ static ImBuf * seq_render_scene_strip_impl(
int have_seq= FALSE;
Scene *scene;
- /* dont refer to seq->scene above this point!, it can be NULL */
- if(seq->scene == NULL) {
+ /* don't refer to seq->scene above this point!, it can be NULL */
+ if (seq->scene == NULL) {
return NULL;
}
scene= seq->scene;
+ frame= scene->r.sfra + nr + seq->anim_startofs;
have_seq= (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first;
oldcfra= scene->r.cfra;
scene->r.cfra= frame;
- if(seq->scene_camera)
+ if (seq->scene_camera)
camera= seq->scene_camera;
else {
scene_camera_switch_update(scene);
camera= scene->camera;
}
- if(have_seq==FALSE && camera==NULL) {
+ if (have_seq==FALSE && camera==NULL) {
scene->r.cfra= oldcfra;
return NULL;
}
@@ -2035,18 +2092,18 @@ static ImBuf * seq_render_scene_strip_impl(
(void)oldmarkers;
#endif
- if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq==0) && camera) {
+ if (sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq==0) && camera) {
char err_out[256]= "unknown";
/* for old scened this can be uninitialized, should probably be added to do_versions at some point if the functionality stays */
- if(context.scene->r.seq_prev_type==0)
+ if (context.scene->r.seq_prev_type==0)
context.scene->r.seq_prev_type = 3 /* ==OB_SOLID */;
/* opengl offscreen render */
scene_update_for_newframe(context.bmain, scene, scene->lay);
ibuf = sequencer_view3d_cb(scene, camera, context.rectx, context.recty,
IB_rect, context.scene->r.seq_prev_type, TRUE, err_out);
- if(ibuf == NULL) {
- fprintf(stderr, "seq_render_scene_strip_impl failed to get opengl buffer: %s\n", err_out);
+ if (ibuf == NULL) {
+ fprintf(stderr, "seq_render_scene_strip failed to get opengl buffer: %s\n", err_out);
}
}
else {
@@ -2054,8 +2111,8 @@ static ImBuf * seq_render_scene_strip_impl(
RenderResult rres;
/* XXX: this if can be removed when sequence preview rendering uses the job system */
- if(rendering || context.scene != scene) {
- if(re==NULL)
+ if (rendering || context.scene != scene) {
+ if (re==NULL)
re= RE_NewRender(scene->id.name);
RE_BlenderFrame(re, context.bmain, scene, NULL, camera, scene->lay, frame, FALSE);
@@ -2066,16 +2123,16 @@ static ImBuf * seq_render_scene_strip_impl(
RE_AcquireResultImage(re, &rres);
- if(rres.rectf) {
+ if (rres.rectf) {
ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat);
memcpy(ibuf->rect_float, rres.rectf, 4*sizeof(float)*rres.rectx*rres.recty);
- if(rres.rectz) {
+ if (rres.rectz) {
addzbuffloatImBuf(ibuf);
memcpy(ibuf->zbuf_float, rres.rectz, sizeof(float)*rres.rectx*rres.recty);
}
/* float buffers in the sequencer are not linear */
- if(scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+ if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
ibuf->profile= IB_PROFILE_LINEAR_RGB;
else
ibuf->profile= IB_PROFILE_NONE;
@@ -2096,7 +2153,7 @@ static ImBuf * seq_render_scene_strip_impl(
scene->r.cfra = oldcfra;
- if(frame != oldcfra)
+ if (frame != oldcfra)
scene_update_for_newframe(context.bmain, scene, scene->lay);
#ifdef DURIAN_CAMERA_SWITCH
@@ -2112,9 +2169,11 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
ImBuf * ibuf = NULL;
char name[FILE_MAX];
int use_preprocess = input_have_to_preprocess(context, seq, cfra);
+ int is_proxy_image = FALSE;
float nr = give_stripelem_index(seq, cfra);
/* all effects are handled similarly with the exception of speed effect */
int type = (seq->type & SEQ_EFFECT && seq->type != SEQ_SPEED) ? SEQ_EFFECT : seq->type;
+ int is_preprocessed = !ELEM3(type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SCENE);
ibuf = seq_stripelem_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF);
@@ -2126,22 +2185,25 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
if (ibuf == NULL)
ibuf = copy_from_ibuf_still(context, seq, nr);
- if (ibuf == NULL)
+ /* MOVIECLIPs have their own proxy management */
+ if (ibuf == NULL && seq->type != SEQ_MOVIECLIP) {
ibuf = seq_proxy_fetch(context, seq, cfra);
+ is_proxy_image = (ibuf != NULL);
+ }
- if(ibuf == NULL) switch(type) {
+ if (ibuf == NULL) switch(type) {
case SEQ_META:
{
ImBuf * meta_ibuf = NULL;
- if(seq->seqbase.first)
+ if (seq->seqbase.first)
meta_ibuf = seq_render_strip_stack(
context, &seq->seqbase,
seq->start + nr, 0);
- if(meta_ibuf) {
+ if (meta_ibuf) {
ibuf = meta_ibuf;
- if(ibuf && use_preprocess) {
+ if (ibuf && use_preprocess) {
struct ImBuf * i = IMB_dupImBuf(ibuf);
IMB_freeImBuf(ibuf);
@@ -2149,6 +2211,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
ibuf = i;
}
}
+
break;
}
case SEQ_SPEED:
@@ -2167,7 +2230,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
if (child_ibuf) {
ibuf = child_ibuf;
- if(ibuf && use_preprocess) {
+ if (ibuf && use_preprocess) {
struct ImBuf * i = IMB_dupImBuf(ibuf);
IMB_freeImBuf(ibuf);
@@ -2198,7 +2261,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
imb_freerectImBuf(ibuf);
/* all sequencer color is done in SRGB space, linear gives odd crossfades */
- if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
+ if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
IMB_convert_profile(ibuf, IB_PROFILE_NONE);
copy_to_ibuf_still(context, seq, nr, ibuf);
@@ -2212,7 +2275,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
{
seq_open_anim_file(seq);
- if(seq->anim) {
+ if (seq->anim) {
IMB_anim_set_preseek(seq->anim,
seq->anim_preseek);
@@ -2237,7 +2300,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
}
case SEQ_SCENE:
{ // scene can be NULL after deletions
- ibuf = seq_render_scene_strip_impl(context, seq, nr);
+ ibuf = seq_render_scene_strip(context, seq, nr);
/* Scene strips update all animation, so we need to restore original state.*/
BKE_animsys_evaluate_all_animation(context.bmain, context.scene, cfra);
@@ -2245,6 +2308,21 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
copy_to_ibuf_still(context, seq, nr, ibuf);
break;
}
+ case SEQ_MOVIECLIP:
+ {
+ ibuf = seq_render_movieclip_strip(context, seq, nr);
+
+ if (ibuf && use_preprocess) {
+ struct ImBuf * i = IMB_dupImBuf(ibuf);
+
+ IMB_freeImBuf(ibuf);
+
+ ibuf = i;
+ }
+
+ copy_to_ibuf_still(context, seq, nr, ibuf);
+ break;
+ }
}
if (ibuf == NULL)
@@ -2254,7 +2332,8 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
use_preprocess = TRUE;
if (use_preprocess)
- ibuf = input_preprocess(context, seq, cfra, ibuf);
+ ibuf = input_preprocess(context, seq, cfra, ibuf,
+ is_proxy_image, is_preprocessed);
seq_stripelem_cache_put(context, seq, cfra, SEQ_STRIPELEM_IBUF, ibuf);
@@ -2292,7 +2371,8 @@ static int seq_get_early_out_for_blend_mode(Sequence * seq)
if (seq_must_swap_input_in_blend_mode(seq)) {
if (early_out == EARLY_USE_INPUT_2) {
return EARLY_USE_INPUT_1;
- } else if (early_out == EARLY_USE_INPUT_1) {
+ }
+ else if (early_out == EARLY_USE_INPUT_1) {
return EARLY_USE_INPUT_2;
}
}
@@ -2314,7 +2394,7 @@ static ImBuf* seq_render_strip_stack(
}
#if 0 /* commentind since this breaks keyframing, since it resets the value on draw */
- if(scene->r.cfra != cfra) {
+ if (scene->r.cfra != cfra) {
// XXX for prefetch and overlay offset!..., very bad!!!
AnimData *adt= BKE_animdata_from_id(&scene->id);
BKE_animsys_evaluate_animdata(scene, &scene->id, adt, cfra, ADT_RECALC_ANIM);
@@ -2328,7 +2408,7 @@ static ImBuf* seq_render_strip_stack(
return out;
}
- if(count == 1) {
+ if (count == 1) {
out = seq_render_strip(context, seq_arr[0], cfra);
seq_stripelem_cache_put(context, seq_arr[0], cfra,
SEQ_STRIPELEM_IBUF_COMP, out);
@@ -2397,7 +2477,8 @@ static ImBuf* seq_render_strip_stack(
out = sh.execute(context, seq, cfra,
facf, facf,
ibuf2, ibuf1, NULL);
- } else {
+ }
+ else {
out = sh.execute(context, seq, cfra,
facf, facf,
ibuf1, ibuf2, NULL);
@@ -2425,13 +2506,14 @@ ImBuf *give_ibuf_seq(SeqRenderData context, float cfra, int chanshown)
int count;
ListBase *seqbasep;
- if(ed==NULL) return NULL;
+ if (ed==NULL) return NULL;
count = BLI_countlist(&ed->metastack);
- if((chanshown < 0) && (count > 0)) {
+ if ((chanshown < 0) && (count > 0)) {
count = MAX2(count + chanshown, 0);
seqbasep= ((MetaStack*)BLI_findlink(&ed->metastack, count))->oldbasep;
- } else {
+ }
+ else {
seqbasep= ed->seqbasep;
}
@@ -2455,7 +2537,8 @@ static int seq_can_blend(Sequence *seq)
{
if (ELEM4(seq->type, SEQ_IMAGE, SEQ_META, SEQ_SCENE, SEQ_MOVIE)) {
return 1;
- } else {
+ }
+ else {
return 0;
}
}
@@ -2628,7 +2711,7 @@ static void seq_stop_threads()
pthread_cond_broadcast(&wakeup_cond);
pthread_mutex_unlock(&wakeup_lock);
- for(tslot = running_threads.first; tslot; tslot= tslot->next) {
+ for (tslot = running_threads.first; tslot; tslot= tslot->next) {
pthread_join(tslot->pthread, NULL);
}
@@ -2687,8 +2770,8 @@ static void seq_wait_for_prefetch_ready()
pthread_mutex_lock(&prefetch_ready_lock);
- for(;;) {
- for(tslot = running_threads.first; tslot; tslot= tslot->next) {
+ for (;;) {
+ for (tslot = running_threads.first; tslot; tslot= tslot->next) {
if (tslot->running) {
break;
}
@@ -2793,7 +2876,7 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
static void free_anim_seq(Sequence *seq)
{
- if(seq->anim) {
+ if (seq->anim) {
IMB_free_anim(seq->anim);
seq->anim = NULL;
}
@@ -2830,18 +2913,18 @@ void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage,
seq_stripelem_cache_cleanup();
- for(seq= seqbase->first; seq; seq= seq->next) {
- if(seq->strip) {
- if(seq->type==SEQ_MOVIE && !keep_file_handles)
+ for (seq= seqbase->first; seq; seq= seq->next) {
+ if (seq->strip) {
+ if (seq->type==SEQ_MOVIE && !keep_file_handles)
free_anim_seq(seq);
- if(seq->type==SEQ_SPEED) {
+ if (seq->type==SEQ_SPEED) {
sequence_effect_speed_rebuild_map(scene, seq, 1);
}
}
- if(seq->type==SEQ_META) {
+ if (seq->type==SEQ_META) {
free_imbuf_seq(scene, &seq->seqbase, FALSE, keep_file_handles);
}
- if(seq->type==SEQ_SCENE) {
+ if (seq->type==SEQ_SCENE) {
/* FIXME: recurs downwards,
but do recurs protection somehow! */
}
@@ -2856,36 +2939,36 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan
/* recurs downwards to see if this seq depends on the changed seq */
- if(seq == NULL)
+ if (seq == NULL)
return 0;
- if(seq == changed_seq)
+ if (seq == changed_seq)
free_imbuf = 1;
- for(subseq=seq->seqbase.first; subseq; subseq=subseq->next)
- if(update_changed_seq_recurs(scene, subseq, changed_seq, len_change, ibuf_change))
+ for (subseq=seq->seqbase.first; subseq; subseq=subseq->next)
+ if (update_changed_seq_recurs(scene, subseq, changed_seq, len_change, ibuf_change))
free_imbuf = TRUE;
- if(seq->seq1)
- if(update_changed_seq_recurs(scene, seq->seq1, changed_seq, len_change, ibuf_change))
+ if (seq->seq1)
+ if (update_changed_seq_recurs(scene, seq->seq1, changed_seq, len_change, ibuf_change))
free_imbuf = TRUE;
- if(seq->seq2 && (seq->seq2 != seq->seq1))
- if(update_changed_seq_recurs(scene, seq->seq2, changed_seq, len_change, ibuf_change))
+ if (seq->seq2 && (seq->seq2 != seq->seq1))
+ if (update_changed_seq_recurs(scene, seq->seq2, changed_seq, len_change, ibuf_change))
free_imbuf = TRUE;
- if(seq->seq3 && (seq->seq3 != seq->seq1) && (seq->seq3 != seq->seq2))
- if(update_changed_seq_recurs(scene, seq->seq3, changed_seq, len_change, ibuf_change))
+ if (seq->seq3 && (seq->seq3 != seq->seq1) && (seq->seq3 != seq->seq2))
+ if (update_changed_seq_recurs(scene, seq->seq3, changed_seq, len_change, ibuf_change))
free_imbuf = TRUE;
- if(free_imbuf) {
- if(ibuf_change) {
- if(seq->type == SEQ_MOVIE)
+ if (free_imbuf) {
+ if (ibuf_change) {
+ if (seq->type == SEQ_MOVIE)
free_anim_seq(seq);
- if(seq->type == SEQ_SPEED) {
+ if (seq->type == SEQ_SPEED) {
sequence_effect_speed_rebuild_map(scene, seq, 1);
}
}
- if(len_change)
+ if (len_change)
calc_sequence(scene, seq);
}
@@ -2923,7 +3006,8 @@ int seq_tx_get_final_left(Sequence *seq, int metaclip)
if (metaclip && seq->tmp) {
/* return the range clipped by the parents range */
return MAX2( seq_tx_get_final_left(seq, 0), seq_tx_get_final_left((Sequence *)seq->tmp, 1) );
- } else {
+ }
+ else {
return (seq->start - seq->startstill) + seq->startofs;
}
@@ -2933,7 +3017,8 @@ int seq_tx_get_final_right(Sequence *seq, int metaclip)
if (metaclip && seq->tmp) {
/* return the range clipped by the parents range */
return MIN2( seq_tx_get_final_right(seq, 0), seq_tx_get_final_right((Sequence *)seq->tmp, 1) );
- } else {
+ }
+ else {
return ((seq->start+seq->len) + seq->endstill) - seq->endofs;
}
}
@@ -2943,7 +3028,8 @@ void seq_tx_set_final_left(Sequence *seq, int val)
if (val < (seq)->start) {
seq->startstill = abs(val - (seq)->start);
seq->startofs = 0;
- } else {
+ }
+ else {
seq->startofs = abs(val - (seq)->start);
seq->startstill = 0;
}
@@ -2954,7 +3040,8 @@ void seq_tx_set_final_right(Sequence *seq, int val)
if (val > (seq)->start + (seq)->len) {
seq->endstill = abs(val - (seq->start + (seq)->len));
seq->endofs = 0;
- } else {
+ }
+ else {
seq->endofs = abs(val - ((seq)->start + (seq)->len));
seq->endstill = 0;
}
@@ -2977,29 +3064,29 @@ int seqbase_isolated_sel_check(ListBase *seqbase)
/* is there more than 1 select */
int ok= FALSE;
- for(seq= seqbase->first; seq; seq= seq->next) {
- if(seq->flag & SELECT) {
+ for (seq= seqbase->first; seq; seq= seq->next) {
+ if (seq->flag & SELECT) {
ok= TRUE;
break;
}
}
- if(ok == FALSE)
+ if (ok == FALSE)
return FALSE;
/* test relationships */
- for(seq= seqbase->first; seq; seq= seq->next) {
- if((seq->type & SEQ_EFFECT)==0)
+ for (seq= seqbase->first; seq; seq= seq->next) {
+ if ((seq->type & SEQ_EFFECT)==0)
continue;
- if(seq->flag & SELECT) {
- if( (seq->seq1 && (seq->seq1->flag & SELECT)==0) ||
+ if (seq->flag & SELECT) {
+ 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)) ||
+ if ( (seq->seq1 && (seq->seq1->flag & SELECT)) ||
(seq->seq2 && (seq->seq2->flag & SELECT)) ||
(seq->seq3 && (seq->seq3->flag & SELECT)) )
return FALSE;
@@ -3009,11 +3096,11 @@ int seqbase_isolated_sel_check(ListBase *seqbase)
return TRUE;
}
-/* use to impose limits when dragging/extending - so impossible situations dont happen
+/* use to impose limits when dragging/extending - so impossible situations don't happen
* Cant use the SEQ_LEFTSEL and SEQ_LEFTSEL directly because the strip may be in a metastrip */
void seq_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag)
{
- if(leftflag) {
+ if (leftflag) {
if (seq_tx_get_final_left(seq, 0) >= seq_tx_get_final_right(seq, 0)) {
seq_tx_set_final_left(seq, seq_tx_get_final_right(seq, 0)-1);
}
@@ -3035,7 +3122,7 @@ void seq_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag)
}
}
- if(rightflag) {
+ if (rightflag) {
if (seq_tx_get_final_right(seq, 0) <= seq_tx_get_final_left(seq, 0)) {
seq_tx_set_final_right(seq, seq_tx_get_final_left(seq, 0)+1);
}
@@ -3088,8 +3175,8 @@ int seq_test_overlap(ListBase * seqbasep, Sequence *test)
Sequence *seq;
seq= seqbasep->first;
- while(seq) {
- if(seq_overlap(test, seq))
+ while (seq) {
+ if (seq_overlap(test, seq))
return 1;
seq= seq->next;
@@ -3103,9 +3190,9 @@ void seq_translate(Scene *evil_scene, Sequence *seq, int delta)
seq_offset_animdata(evil_scene, seq, delta);
seq->start += delta;
- if(seq->type==SEQ_META) {
+ if (seq->type==SEQ_META) {
Sequence *seq_child;
- for(seq_child= seq->seqbase.first; seq_child; seq_child= seq_child->next) {
+ for (seq_child= seq->seqbase.first; seq_child; seq_child= seq_child->next) {
seq_translate(evil_scene, seq_child, delta);
}
}
@@ -3115,17 +3202,17 @@ void seq_translate(Scene *evil_scene, Sequence *seq, int delta)
void seq_sound_init(Scene *scene, Sequence *seq)
{
- if(seq->type==SEQ_META) {
+ if (seq->type==SEQ_META) {
Sequence *seq_child;
- for(seq_child= seq->seqbase.first; seq_child; seq_child= seq_child->next) {
+ for (seq_child= seq->seqbase.first; seq_child; seq_child= seq_child->next) {
seq_sound_init(scene, seq_child);
}
}
else {
- if(seq->sound) {
+ if (seq->sound) {
seq->scene_sound = sound_add_scene_sound_defaults(scene, seq);
}
- if(seq->scene) {
+ if (seq->scene) {
sound_scene_add_scene_sound_defaults(scene, seq);
}
}
@@ -3137,10 +3224,10 @@ Sequence *seq_foreground_frame_get(Scene *scene, int frame)
Sequence *seq, *best_seq=NULL;
int best_machine = -1;
- if(!ed) return NULL;
+ if (!ed) return NULL;
for (seq=ed->seqbasep->first; seq; seq= seq->next) {
- if(seq->flag & SEQ_MUTE || seq->startdisp > frame || seq->enddisp <= frame)
+ if (seq->flag & SEQ_MUTE || seq->startdisp > frame || seq->enddisp <= frame)
continue;
/* only use elements you can see - not */
if (ELEM5(seq->type, SEQ_IMAGE, SEQ_META, SEQ_SCENE, SEQ_MOVIE, SEQ_COLOR)) {
@@ -3159,23 +3246,23 @@ int shuffle_seq(ListBase * seqbasep, Sequence *test, Scene *evil_scene)
int orig_machine= test->machine;
test->machine++;
calc_sequence(evil_scene, test);
- while( seq_test_overlap(seqbasep, test) ) {
- if(test->machine >= MAXSEQ) {
+ while ( seq_test_overlap(seqbasep, test) ) {
+ if (test->machine >= MAXSEQ) {
break;
}
test->machine++;
- calc_sequence(evil_scene, test); // XXX - I dont think this is needed since were only moving vertically, Campbell.
+ calc_sequence(evil_scene, test); // XXX - I don't think this is needed since were only moving vertically, Campbell.
}
- if(test->machine >= MAXSEQ) {
+ if (test->machine >= MAXSEQ) {
/* Blender 2.4x would remove the strip.
* nicer to move it to the end */
Sequence *seq;
int new_frame= test->enddisp;
- for(seq= seqbasep->first; seq; seq= seq->next) {
+ for (seq= seqbasep->first; seq; seq= seq->next) {
if (seq->machine == orig_machine)
new_frame = MAX2(new_frame, seq->enddisp);
}
@@ -3186,7 +3273,8 @@ int shuffle_seq(ListBase * seqbasep, Sequence *test, Scene *evil_scene)
calc_sequence(evil_scene, test);
return 0;
- } else {
+ }
+ else {
return 1;
}
}
@@ -3196,11 +3284,11 @@ static int shuffle_seq_time_offset_test(ListBase * seqbasep, char dir)
int offset= 0;
Sequence *seq, *seq_other;
- for(seq= seqbasep->first; seq; seq= seq->next) {
- if(seq->tmp) {
- for(seq_other= seqbasep->first; seq_other; seq_other= seq_other->next) {
- if(!seq_other->tmp && seq_overlap(seq, seq_other)) {
- if(dir=='L') {
+ for (seq= seqbasep->first; seq; seq= seq->next) {
+ if (seq->tmp) {
+ for (seq_other= seqbasep->first; seq_other; seq_other= seq_other->next) {
+ if (!seq_other->tmp && seq_overlap(seq, seq_other)) {
+ if (dir=='L') {
offset= MIN2(offset, seq_other->startdisp - seq->enddisp);
}
else {
@@ -3218,9 +3306,9 @@ static int shuffle_seq_time_offset(Scene* scene, ListBase * seqbasep, char dir)
int ofs= 0;
int tot_ofs= 0;
Sequence *seq;
- while( (ofs= shuffle_seq_time_offset_test(seqbasep, dir)) ) {
- for(seq= seqbasep->first; seq; seq= seq->next) {
- if(seq->tmp) {
+ while ( (ofs= shuffle_seq_time_offset_test(seqbasep, dir)) ) {
+ for (seq= seqbasep->first; seq; seq= seq->next) {
+ if (seq->tmp) {
/* seq_test_overlap only tests display values */
seq->startdisp += ofs;
seq->enddisp += ofs;
@@ -3230,8 +3318,8 @@ static int shuffle_seq_time_offset(Scene* scene, ListBase * seqbasep, char dir)
tot_ofs+= ofs;
}
- for(seq= seqbasep->first; seq; seq= seq->next) {
- if(seq->tmp)
+ for (seq= seqbasep->first; seq; seq= seq->next) {
+ if (seq->tmp)
calc_sequence_disp(scene, seq); /* corrects dummy startdisp/enddisp values */
}
@@ -3248,9 +3336,9 @@ int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene)
int offset_r = shuffle_seq_time_offset(evil_scene, seqbasep, 'R');
int offset = (-offset_l < offset_r) ? offset_l:offset_r;
- if(offset) {
- for(seq= seqbasep->first; seq; seq= seq->next) {
- if(seq->tmp) {
+ if (offset) {
+ for (seq= seqbasep->first; seq; seq= seq->next) {
+ if (seq->tmp) {
seq_translate(evil_scene, seq, offset);
seq->flag &= ~SEQ_OVERLAP;
}
@@ -3264,14 +3352,14 @@ void seq_update_sound_bounds_all(Scene *scene)
{
Editing *ed = scene->ed;
- if(ed) {
+ if (ed) {
Sequence *seq;
- for(seq = ed->seqbase.first; seq; seq = seq->next) {
- if(seq->type == SEQ_META) {
+ for (seq = ed->seqbase.first; seq; seq = seq->next) {
+ if (seq->type == SEQ_META) {
seq_update_sound_bounds_recursive(scene, seq);
}
- else if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
+ else if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
seq_update_sound_bounds(scene, seq);
}
}
@@ -3291,19 +3379,19 @@ static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, i
/* for sound we go over full meta tree to update muted state,
* since sound is played outside of evaluating the imbufs, */
- for(seq=seqbasep->first; seq; seq=seq->next) {
+ for (seq=seqbasep->first; seq; seq=seq->next) {
seqmute= (mute || (seq->flag & SEQ_MUTE));
- if(seq->type == SEQ_META) {
+ if (seq->type == SEQ_META) {
/* if this is the current meta sequence, unmute because
* all sequences above this were set to mute */
- if(seq == metaseq)
+ if (seq == metaseq)
seqmute= 0;
seq_update_muting_recursive(&seq->seqbase, metaseq, seqmute);
}
- else if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
- if(seq->scene_sound) {
+ else if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
+ if (seq->scene_sound) {
sound_mute_scene_sound(seq->scene_sound, seqmute);
}
}
@@ -3312,11 +3400,11 @@ static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, i
void seq_update_muting(Editing *ed)
{
- if(ed) {
+ if (ed) {
/* mute all sounds up to current metastack list */
MetaStack *ms= ed->metastack.last;
- if(ms)
+ if (ms)
seq_update_muting_recursive(&ed->seqbase, ms->parseq, 1);
else
seq_update_muting_recursive(&ed->seqbase, NULL, 0);
@@ -3327,12 +3415,12 @@ static void seq_update_sound_recursive(Scene *scene, ListBase *seqbasep, bSound
{
Sequence *seq;
- for(seq=seqbasep->first; seq; seq=seq->next) {
- if(seq->type == SEQ_META) {
+ for (seq=seqbasep->first; seq; seq=seq->next) {
+ if (seq->type == SEQ_META) {
seq_update_sound_recursive(scene, &seq->seqbase, sound);
}
- else if(seq->type == SEQ_SOUND) {
- if(seq->scene_sound && sound == seq->sound) {
+ else if (seq->type == SEQ_SOUND) {
+ if (seq->scene_sound && sound == seq->sound) {
sound_update_scene_sound(seq->scene_sound, sound);
}
}
@@ -3341,7 +3429,7 @@ static void seq_update_sound_recursive(Scene *scene, ListBase *seqbasep, bSound
void seq_update_sound(struct Scene *scene, struct bSound *sound)
{
- if(scene->ed) {
+ if (scene->ed) {
seq_update_sound_recursive(scene, &scene->ed->seqbase, sound);
}
}
@@ -3352,11 +3440,11 @@ ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq)
Sequence *iseq;
ListBase *lb= NULL;
- for(iseq= seqbase->first; iseq; iseq= iseq->next) {
- if(seq==iseq) {
+ for (iseq= seqbase->first; iseq; iseq= iseq->next) {
+ if (seq==iseq) {
return seqbase;
}
- else if(iseq->seqbase.first && (lb= seq_seqbase(&iseq->seqbase, seq))) {
+ else if (iseq->seqbase.first && (lb= seq_seqbase(&iseq->seqbase, seq))) {
return lb;
}
}
@@ -3368,12 +3456,13 @@ Sequence *seq_metastrip(ListBase * seqbase, Sequence * meta, Sequence *seq)
{
Sequence * iseq;
- for(iseq = seqbase->first; iseq; iseq = iseq->next) {
+ for (iseq = seqbase->first; iseq; iseq = iseq->next) {
Sequence * rval;
if (seq == iseq) {
return meta;
- } else if(iseq->seqbase.first &&
+ }
+ else if (iseq->seqbase.first &&
(rval = seq_metastrip(&iseq->seqbase, iseq, seq))) {
return rval;
}
@@ -3386,26 +3475,26 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
{
char name[sizeof(seq_a->name)];
- if(seq_a->len != seq_b->len) {
+ if (seq_a->len != seq_b->len) {
*error_str= "Strips must be the same length";
return 0;
}
/* type checking, could be more advanced but disalow sound vs non-sound copy */
- if(seq_a->type != seq_b->type) {
- if(seq_a->type == SEQ_SOUND || seq_b->type == SEQ_SOUND) {
+ if (seq_a->type != seq_b->type) {
+ if (seq_a->type == SEQ_SOUND || seq_b->type == SEQ_SOUND) {
*error_str= "Strips were not compatible";
return 0;
}
/* disallow effects to swap with non-effects strips */
- if((seq_a->type & SEQ_EFFECT) != (seq_b->type & SEQ_EFFECT)) {
+ if ((seq_a->type & SEQ_EFFECT) != (seq_b->type & SEQ_EFFECT)) {
*error_str= "Strips were not compatible";
return 0;
}
- if((seq_a->type & SEQ_EFFECT) && (seq_b->type & SEQ_EFFECT)) {
- if(get_sequence_effect_num_inputs(seq_a->type) != get_sequence_effect_num_inputs(seq_b->type)) {
+ if ((seq_a->type & SEQ_EFFECT) && (seq_b->type & SEQ_EFFECT)) {
+ if (get_sequence_effect_num_inputs(seq_a->type) != get_sequence_effect_num_inputs(seq_b->type)) {
*error_str= "Strips must have the same number of inputs";
return 0;
}
@@ -3414,7 +3503,7 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
SWAP(Sequence, *seq_a, *seq_b);
- /* swap back names so animation fcurves dont get swapped */
+ /* swap back names so animation fcurves don't get swapped */
BLI_strncpy(name, seq_a->name+2, sizeof(name));
BLI_strncpy(seq_a->name+2, seq_b->name+2, sizeof(seq_b->name)-2);
BLI_strncpy(seq_b->name+2, name, sizeof(seq_b->name)-2);
@@ -3444,13 +3533,13 @@ void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
char str[SEQ_NAME_MAXSTR+3];
FCurve *fcu;
- if(scene->adt==NULL || ofs==0 || scene->adt->action==NULL)
+ if (scene->adt==NULL || ofs==0 || scene->adt->action==NULL)
return;
BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2);
for (fcu= scene->adt->action->curves.first; fcu; fcu= fcu->next) {
- if(strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
+ if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
unsigned int i;
for (i = 0; i < fcu->totvert; i++) {
BezTriple *bezt= &fcu->bezt[i];
@@ -3470,7 +3559,7 @@ void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
FCurve *fcu_cpy;
ListBase lb= {NULL, NULL};
- if(scene->adt==NULL || scene->adt->action==NULL)
+ if (scene->adt==NULL || scene->adt->action==NULL)
return;
BLI_snprintf(str_from, sizeof(str_from), "[\"%s\"]", name_src);
@@ -3478,7 +3567,7 @@ void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
fcu_last= scene->adt->action->curves.last;
for (fcu= scene->adt->action->curves.first; fcu && fcu->prev != fcu_last; fcu= fcu->next) {
- if(strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str_from)) {
+ if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str_from)) {
fcu_cpy= copy_fcurve(fcu);
BLI_addtail(&lb, fcu_cpy);
}
@@ -3497,7 +3586,7 @@ static void seq_free_animdata(Scene *scene, Sequence *seq)
char str[SEQ_NAME_MAXSTR+3];
FCurve *fcu;
- if(scene->adt==NULL || scene->adt->action==NULL)
+ if (scene->adt==NULL || scene->adt->action==NULL)
return;
BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2);
@@ -3505,14 +3594,15 @@ static void seq_free_animdata(Scene *scene, Sequence *seq)
fcu= scene->adt->action->curves.first;
while (fcu) {
- if(strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
+ if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
FCurve *next_fcu = fcu->next;
BLI_remlink(&scene->adt->action->curves, fcu);
free_fcurve(fcu);
fcu = next_fcu;
- } else {
+ }
+ else {
fcu = fcu->next;
}
}
@@ -3527,7 +3617,7 @@ Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive)
for (iseq=seqbase->first; iseq; iseq=iseq->next) {
if (strcmp(name, iseq->name+2) == 0)
return iseq;
- else if(recursive && (iseq->seqbase.first) && (rseq=get_seq_by_name(&iseq->seqbase, name, 1))) {
+ else if (recursive && (iseq->seqbase.first) && (rseq=get_seq_by_name(&iseq->seqbase, name, 1))) {
return rseq;
}
}
@@ -3539,14 +3629,14 @@ Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive)
Sequence *seq_active_get(Scene *scene)
{
Editing *ed= seq_give_editing(scene, FALSE);
- if(ed==NULL) return NULL;
+ if (ed==NULL) return NULL;
return ed->act_seq;
}
void seq_active_set(Scene *scene, Sequence *seq)
{
Editing *ed= seq_give_editing(scene, FALSE);
- if(ed==NULL) return;
+ if (ed==NULL) return;
ed->act_seq= seq;
}
@@ -3557,7 +3647,7 @@ int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other)
*seq_act= seq_active_get(scene);
- if(*seq_act == NULL) {
+ if (*seq_act == NULL) {
return 0;
}
else {
@@ -3565,9 +3655,9 @@ int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other)
*seq_other= NULL;
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
- if(seq->flag & SELECT && (seq != (*seq_act))) {
- if(*seq_other) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if (seq->flag & SELECT && (seq != (*seq_act))) {
+ if (*seq_other) {
return 0;
}
else {
@@ -3584,21 +3674,21 @@ int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other)
void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
{
- if(seq) {
+ if (seq) {
BLI_strncpy(seq->name+2, seq_load->name, sizeof(seq->name)-2);
seqbase_unique_name_recursive(&scene->ed->seqbase, seq);
- if(seq_load->flag & SEQ_LOAD_FRAME_ADVANCE) {
+ if (seq_load->flag & SEQ_LOAD_FRAME_ADVANCE) {
seq_load->start_frame += (seq->enddisp - seq->startdisp);
}
- if(seq_load->flag & SEQ_LOAD_REPLACE_SEL) {
+ if (seq_load->flag & SEQ_LOAD_REPLACE_SEL) {
seq_load->flag |= SELECT;
seq_active_set(scene, seq);
}
- if(seq_load->flag & SEQ_LOAD_SOUND_CACHE) {
- if(seq->sound)
+ if (seq_load->flag & SEQ_LOAD_SOUND_CACHE) {
+ if (seq->sound)
sound_cache(seq->sound);
}
@@ -3646,7 +3736,7 @@ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len = seq->len = seq_load->len ? seq_load->len : 1;
+ seq->len = seq_load->len ? seq_load->len : 1;
strip->us= 1;
strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
BLI_strncpy(strip->dir, seq_load->path, sizeof(strip->dir));
@@ -3696,7 +3786,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len = seq->len = ceil(info.length * FPS);
+ seq->len = ceil(info.length * FPS);
strip->us= 1;
/* we only need 1 element to store the filename */
@@ -3704,7 +3794,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
- seq->scene_sound = sound_add_scene_sound(scene, seq, seq_load->start_frame, seq_load->start_frame + strip->len, 0);
+ seq->scene_sound = sound_add_scene_sound(scene, seq, seq_load->start_frame, seq_load->start_frame + seq->len, 0);
calc_sequence_disp(scene, seq);
@@ -3741,7 +3831,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
an = openanim(path, IB_rect, 0);
- if(an==NULL)
+ if (an==NULL)
return NULL;
seq = alloc_sequence(seqbasep, seq_load->start_frame, seq_load->channel);
@@ -3755,7 +3845,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len = seq->len = IMB_anim_get_duration( an, IMB_TC_RECORD_RUN );
+ seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN);
strip->us= 1;
/* we only need 1 element for MOVIE strips */
@@ -3766,7 +3856,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
calc_sequence_disp(scene, seq);
- if(seq_load->flag & SEQ_LOAD_MOVIE_SOUND) {
+ if (seq_load->flag & SEQ_LOAD_MOVIE_SOUND) {
int start_frame_back= seq_load->start_frame;
seq_load->channel++;
@@ -3776,7 +3866,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
seq_load->channel--;
}
- if(seq_load->name[0] == '\0')
+ if (seq_load->name[0] == '\0')
BLI_strncpy(seq_load->name, se->name, sizeof(seq_load->name));
/* can be NULL */
@@ -3814,54 +3904,60 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence
= MEM_dupallocN(seq->strip->color_balance);
}
- if(seq->type==SEQ_META) {
+ if (seq->type==SEQ_META) {
seqn->strip->stripdata = NULL;
seqn->seqbase.first= seqn->seqbase.last= NULL;
/* WATCH OUT!!! - This metastrip is not recursively duplicated here - do this after!!! */
/* - seq_dupli_recursive(&seq->seqbase,&seqn->seqbase);*/
- } else if(seq->type == SEQ_SCENE) {
+ }
+ else if (seq->type == SEQ_SCENE) {
seqn->strip->stripdata = NULL;
- if(seq->scene_sound)
+ if (seq->scene_sound)
seqn->scene_sound = sound_scene_add_scene_sound_defaults(sce_audio, seqn);
- } else if(seq->type == SEQ_MOVIE) {
+ }
+ else if (seq->type == SEQ_MOVIE) {
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
seqn->anim= NULL;
- } else if(seq->type == SEQ_SOUND) {
+ }
+ else if (seq->type == SEQ_SOUND) {
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
- if(seq->scene_sound)
+ if (seq->scene_sound)
seqn->scene_sound = sound_add_scene_sound_defaults(sce_audio, seqn);
seqn->sound->id.us++;
- } else if(seq->type == SEQ_IMAGE) {
+ }
+ else if (seq->type == SEQ_IMAGE) {
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
- } else if(seq->type >= SEQ_EFFECT) {
- if(seq->seq1 && seq->seq1->tmp) seqn->seq1= seq->seq1->tmp;
- if(seq->seq2 && seq->seq2->tmp) seqn->seq2= seq->seq2->tmp;
- if(seq->seq3 && seq->seq3->tmp) seqn->seq3= seq->seq3->tmp;
+ }
+ else if (seq->type >= SEQ_EFFECT) {
+ if (seq->seq1 && seq->seq1->tmp) seqn->seq1= seq->seq1->tmp;
+ if (seq->seq2 && seq->seq2->tmp) seqn->seq2= seq->seq2->tmp;
+ if (seq->seq3 && seq->seq3->tmp) seqn->seq3= seq->seq3->tmp;
if (seq->type & SEQ_EFFECT) {
struct SeqEffectHandle sh;
sh = get_sequence_effect(seq);
- if(sh.copy)
+ if (sh.copy)
sh.copy(seq, seqn);
}
seqn->strip->stripdata = NULL;
- } else {
+ }
+ else {
fprintf(stderr, "Aiiiiekkk! sequence type not "
"handled in duplicate!\nExpect a crash"
" now...\n");
}
- if(dupe_flag & SEQ_DUPE_UNIQUE_NAME)
+ if (dupe_flag & SEQ_DUPE_UNIQUE_NAME)
seqbase_unique_name_recursive(&scene->ed->seqbase, seqn);
- if(dupe_flag & SEQ_DUPE_ANIM)
+ if (dupe_flag & SEQ_DUPE_ANIM)
seq_dupe_animdata(scene, seq->name+2, seqn->name+2);
return seqn;
@@ -3872,7 +3968,7 @@ Sequence * seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, Sequ
Sequence * seqn = seq_dupli(scene, scene_to, seq, dupe_flag);
if (seq->type == SEQ_META) {
Sequence *s;
- for(s= seq->seqbase.first; s; s = s->next) {
+ for (s= seq->seqbase.first; s; s = s->next) {
Sequence *n = seq_dupli_recursive(scene, scene_to, s, dupe_flag);
if (n) {
BLI_addtail(&seqn->seqbase, n);
@@ -3888,21 +3984,21 @@ void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase,
Sequence *seqn = NULL;
Sequence *last_seq = seq_active_get(scene);
- for(seq= seqbase->first; seq; seq= seq->next) {
+ for (seq= seqbase->first; seq; seq= seq->next) {
seq->tmp= NULL;
- if((seq->flag & SELECT) || (dupe_flag & SEQ_DUPE_ALL)) {
+ if ((seq->flag & SELECT) || (dupe_flag & SEQ_DUPE_ALL)) {
seqn = seq_dupli(scene, scene_to, seq, dupe_flag);
if (seqn) { /*should never fail */
- if(dupe_flag & SEQ_DUPE_CONTEXT) {
+ if (dupe_flag & SEQ_DUPE_CONTEXT) {
seq->flag &= ~SEQ_ALLSEL;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL+SEQ_LOCK);
}
BLI_addtail(nseqbase, seqn);
- if(seq->type==SEQ_META)
+ if (seq->type==SEQ_META)
seqbase_dupli_recursive(scene, scene_to, &seqn->seqbase, &seq->seqbase, dupe_flag);
- if(dupe_flag & SEQ_DUPE_CONTEXT) {
+ if (dupe_flag & SEQ_DUPE_CONTEXT) {
if (seq == last_seq) {
seq_active_set(scene, seqn);
}
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index dab945c44f3..6513399c962 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -75,7 +75,7 @@
_t1 = ( double ) _tstart.tv_sec + ( double ) _tstart.tv_usec/ ( 1000*1000 ); \
_t2 = ( double ) _tend.tv_sec + ( double ) _tend.tv_usec/ ( 1000*1000 ); \
printf("%s: %fs (real) %fs (cpu)\n", #a, _t2-_t1, (float)(clock()-_clock_init)/CLOCKS_PER_SEC);\
- } while(0)
+ } while (0)
#else
@@ -92,7 +92,7 @@ DerivedMesh *object_get_derived_final(Object *ob)
Mesh *me= ob->data;
BMEditMesh *em = me->edit_btmesh;
- if(em) {
+ if (em) {
DerivedMesh *dm = em->derivedFinal;
return dm;
}
@@ -146,7 +146,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
BENCH(bvhtree_from_mesh_verts(&treeData, calc->target, 0.0, 2, 6));
- if(treeData.tree == NULL)
+ if (treeData.tree == NULL)
{
OUT_OF_MEMORY();
return;
@@ -158,16 +158,16 @@ 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);
- if(weight == 0.0f) continue;
+ if (weight == 0.0f) continue;
//Convert the vertex to tree coordinates
- if(calc->vert) {
+ if (calc->vert) {
copy_v3_v3(tmp_co, calc->vert[i].co);
}
else {
@@ -180,7 +180,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
//If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex
//so we can initiate the "nearest.dist" with the expected value to that last hit.
//This will lead in prunning of the search tree.
- if(nearest.index != -1)
+ if (nearest.index != -1)
nearest.dist = len_squared_v3v3(tmp_co, nearest.co);
else
nearest.dist = FLT_MAX;
@@ -189,11 +189,11 @@ 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;
+ if (dist > FLT_EPSILON) weight *= (dist - calc->keepDist)/dist;
//Convert the coordinates back to mesh coordinates
copy_v3_v3(tmp_co, nearest.co);
@@ -224,7 +224,7 @@ 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 );
@@ -245,23 +245,23 @@ int normal_projection_project_vertex(char options, const float *vert, const floa
BLI_bvhtree_ray_cast(tree, co, no, 0.0f, &hit_tmp, callback, userdata);
- if(hit_tmp.index != -1) {
+ if (hit_tmp.index != -1) {
/* invert the normal first so face culling works on rotated objects */
- if(transf) {
+ if (transf) {
space_transform_invert_normal(transf, hit_tmp.no);
}
if (options & (MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE|MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) {
/* apply backface */
const float dot= dot_v3v3(dir, hit_tmp.no);
- if( ((options & MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE) && dot <= 0.0f) ||
+ if ( ((options & MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE) && dot <= 0.0f) ||
((options & MOD_SHRINKWRAP_CULL_TARGET_BACKFACE) && dot >= 0.0f)
) {
return FALSE; /* Ignore hit */
}
}
- if(transf) {
+ if (transf) {
/* Inverting space transform (TODO make coeherent with the initial dist readjust) */
space_transform_invert(transf, hit_tmp.co);
hit_tmp.dist = len_v3v3((float *)vert, hit_tmp.co);
@@ -293,62 +293,63 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
//If the user doesn't allows to project in any direction of projection axis
//then theres nothing todo.
- if((use_normal & (MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR | MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR)) == 0)
+ if ((use_normal & (MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR | MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR)) == 0)
return;
//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;
+ if (calc->vert == NULL) return;
}
else {
//The code supports any axis that is a combination of X,Y,Z
//although currently UI only allows to set the 3 different axis
- if(calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) proj_axis[0] = 1.0f;
- if(calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) proj_axis[1] = 1.0f;
- if(calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS) proj_axis[2] = 1.0f;
+ if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) proj_axis[0] = 1.0f;
+ if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) proj_axis[1] = 1.0f;
+ if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS) proj_axis[2] = 1.0f;
normalize_v3(proj_axis);
//Invalid projection direction
- if(dot_v3v3(proj_axis, proj_axis) < FLT_EPSILON)
+ if (dot_v3v3(proj_axis, proj_axis) < FLT_EPSILON)
return;
}
- if(calc->smd->auxTarget)
+ if (calc->smd->auxTarget)
{
auxMesh = object_get_derived_final(calc->smd->auxTarget);
- if(!auxMesh)
+ if (!auxMesh)
return;
space_transform_setup( &local2aux, calc->ob, calc->smd->auxTarget);
}
//After sucessufuly build the trees, start projection vertexs
- if( bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 4, 6)
+ if ( bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 4, 6)
&& (auxMesh == NULL || bvhtree_from_mesh_faces(&auxData, auxMesh, 0.0, 4, 6)))
{
#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 (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 */
- if(calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) {
+ if (calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) {
copy_v3_v3(tmp_co, calc->vert[i].co);
normal_short_to_float_v3(tmp_no, calc->vert[i].no);
- } else {
+ }
+ else {
copy_v3_v3(tmp_co, co);
copy_v3_v3(tmp_no, proj_axis);
}
@@ -360,32 +361,32 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
hit.index = -1;
- hit.dist = 10000.0f; //TODO: we should use FLT_MAX here, but sweepsphere code isnt prepared for that
+ 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)
+ if (auxData.tree)
normal_projection_project_vertex(0, tmp_co, tmp_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData);
normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, tmp_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData);
}
//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);
- if(auxData.tree)
+ if (auxData.tree)
normal_projection_project_vertex(0, tmp_co, inv_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData);
normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, inv_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData);
}
- 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);
@@ -413,7 +414,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
//Create a bvh-tree of the given target
BENCH(bvhtree_from_mesh_faces( &treeData, calc->target, 0.0, 2, 6));
- if(treeData.tree == NULL)
+ if (treeData.tree == NULL)
{
OUT_OF_MEMORY();
return;
@@ -428,15 +429,15 @@ 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);
- if(weight == 0.0f) continue;
+ if (weight == 0.0f) continue;
//Convert the vertex to tree coordinates
- if(calc->vert) {
+ if (calc->vert) {
copy_v3_v3(tmp_co, calc->vert[i].co);
}
else {
@@ -449,7 +450,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
//If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex
//so we can initiate the "nearest.dist" with the expected value to that last hit.
//This will lead in prunning of the search tree.
- if(nearest.index != -1)
+ if (nearest.index != -1)
nearest.dist = len_squared_v3v3(tmp_co, nearest.co);
else
nearest.dist = FLT_MAX;
@@ -457,9 +458,9 @@ 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 (nearest.index != -1)
{
- if(calc->smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE)
+ 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);
@@ -467,7 +468,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
else {
//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)
+ if (dist > FLT_EPSILON)
interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist)/dist); //linear interpolation
else
copy_v3_v3( tmp_co, nearest.co );
@@ -490,8 +491,8 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
ShrinkwrapCalcData calc = NULL_ShrinkwrapCalcData;
//remove loop dependencies on derived meshs (TODO should this be done elsewhere?)
- if(smd->target == ob) smd->target = NULL;
- if(smd->auxTarget == ob) smd->auxTarget = NULL;
+ if (smd->target == ob) smd->target = NULL;
+ if (smd->auxTarget == ob) smd->auxTarget = NULL;
//Configure Shrinkwrap calc data
@@ -502,7 +503,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
//DeformVertex
calc.vgroup = defgroup_name_index(calc.ob, calc.smd->vgroup_name);
- if(dm) {
+ if (dm) {
calc.dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
}
else if (calc.ob->type == OB_LATTICE) {
@@ -510,7 +511,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
}
- if(smd->target)
+ if (smd->target)
{
calc.target = object_get_derived_final(smd->target);
@@ -527,14 +528,14 @@ 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
@@ -542,10 +543,10 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
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)
+ 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.
@@ -578,7 +579,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
}
//free memory
- if(ss_mesh)
+ if (ss_mesh)
ss_mesh->release(ss_mesh);
}
diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c
index 90d530cb239..71ea85de716 100644
--- a/source/blender/blenkernel/intern/sketch.c
+++ b/source/blender/blenkernel/intern/sketch.c
@@ -414,7 +414,7 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
float max_dist = 16; /* more than 4 pixels */
/* find the next marked point */
- while(marked[le] == 0)
+ while (marked[le] == 0)
{
le++;
}
@@ -424,7 +424,7 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
v1[0] = old_points[ls].p2d[1] - old_points[le].p2d[1];
- for( i = ls + 1; i < le; i++ )
+ for ( i = ls + 1; i < le; i++ )
{
float mul;
float dist;
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index bffd4703ce4..96194ff5b09 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -159,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};
@@ -171,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];
@@ -198,12 +198,12 @@ 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;
@@ -220,7 +220,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
}
}
else {
- if(size[1] > size[2])
+ if (size[1] > size[2])
{
scale = res / size[1];
smd->domain->dx = size[1] / res;
@@ -246,7 +246,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
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);
@@ -257,19 +257,19 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
// printf("(smd->domain->flags & MOD_SMOKE_HIGHRES)\n");
}
- if(!smd->domain->shadow)
+ if (!smd->domain->shadow)
smd->domain->shadow = MEM_callocN(sizeof(float) * smd->domain->res[0] * smd->domain->res[1] * smd->domain->res[2], "SmokeDomainShadow");
smoke_initBlenderRNA(smd->domain->fluid, &(smd->domain->alpha), &(smd->domain->beta), &(smd->domain->time_scale), &(smd->domain->vorticity), &(smd->domain->border_collisions));
- if(smd->domain->wt)
+ if (smd->domain->wt)
{
smoke_initWaveletBlenderRNA(smd->domain->wt, &(smd->domain->strength));
// printf("smoke_initWaveletBlenderRNA\n");
}
return 1;
}
- else if((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
+ else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
{
// handle flow object here
// XXX TODO
@@ -279,7 +279,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
// update particle lifetime to be one frame
// smd->flow->psys->part->lifetime = scene->r.efra + 1;
/*
- if(!smd->flow->bvh)
+ if (!smd->flow->bvh)
{
// smd->flow->bvh = MEM_callocN(sizeof(BVHTreeFromMesh), "smoke_bvhfromfaces");
// bvhtree_from_mesh_faces(smd->flow->bvh, dm, 0.0, 2, 6);
@@ -292,15 +292,15 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
return 1;
}
- else if((smd->type & MOD_SMOKE_TYPE_COLL))
+ else if ((smd->type & MOD_SMOKE_TYPE_COLL))
{
smd->time = scene->r.cfra;
// todo: delete this when loading colls work -dg
- if(!smd->coll)
+ if (!smd->coll)
smokeModifier_createType(smd);
- if(!smd->coll->points)
+ if (!smd->coll->points)
{
// init collision points
SmokeCollSettings *scs = smd->coll;
@@ -309,10 +309,11 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
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);
}
- 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 );
}
@@ -333,16 +334,16 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
int quads = 0, facecounter = 0;
// count quads
- for(i = 0; i < dm->getNumTessFaces(dm); i++)
+ for (i = 0; i < dm->getNumTessFaces(dm); i++)
{
- if(mface[i].v4)
+ if (mface[i].v4)
quads++;
}
calcTriangleDivs(ob, mvert, dm->getNumVerts(dm), mface, dm->getNumTessFaces(dm), dm->getNumTessFaces(dm) + quads, &tridivs, cell_len);
// count triangle divisions
- for(i = 0; i < dm->getNumTessFaces(dm) + quads; i++)
+ for (i = 0; i < dm->getNumTessFaces(dm) + quads; i++)
{
divs += (tridivs[3 * i] + 1) * (tridivs[3 * i + 1] + 1) * (tridivs[3 * i + 2] + 1);
}
@@ -351,7 +352,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
scs->points = MEM_callocN(sizeof(float) * (dm->getNumVerts(dm) + divs) * 3, "SmokeCollPoints");
- 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);
@@ -359,7 +360,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
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
@@ -370,7 +371,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
//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);
@@ -385,23 +386,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);
@@ -418,7 +419,7 @@ 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);
@@ -427,7 +428,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
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);
@@ -439,14 +440,14 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
}
}
- if(again == 0 && mface[i].v4)
+ if (again == 0 && mface[i].v4)
again++;
else
again = 0;
facecounter++;
- } while(again!=0);
+ } while (again!=0);
}
scs->numpoints = dm->getNumVerts(dm) + newdivs;
@@ -466,18 +467,18 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa
float maxpart = ABS(maxscale[0]);
float scaleFac = 0;
float fsTri = 0;
- if(ABS(maxscale[1])>maxpart) maxpart = ABS(maxscale[1]);
- if(ABS(maxscale[2])>maxpart) maxpart = ABS(maxscale[2]);
+ if (ABS(maxscale[1])>maxpart) maxpart = ABS(maxscale[1]);
+ if (ABS(maxscale[2])>maxpart) maxpart = ABS(maxscale[2]);
scaleFac = 1.0 / maxpart;
// featureSize = mLevel[mMaxRefine].nodeSize
fsTri = cell_len * 0.5 * scaleFac;
- 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];
@@ -496,19 +497,19 @@ 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);
*/
}
@@ -518,7 +519,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;
@@ -535,12 +536,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);
@@ -558,19 +559,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;
@@ -584,10 +585,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);
@@ -601,22 +602,22 @@ static void smokeModifier_freeFlow(SmokeModifierData *smd)
static void smokeModifier_freeCollision(SmokeModifierData *smd)
{
- if(smd->coll)
+ if (smd->coll)
{
- if(smd->coll->points)
+ if (smd->coll->points)
{
MEM_freeN(smd->coll->points);
smd->coll->points = NULL;
}
- if(smd->coll->bvhtree)
+ if (smd->coll->bvhtree)
{
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
@@ -628,7 +629,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;
@@ -637,15 +638,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;
@@ -657,10 +658,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);
@@ -668,22 +669,22 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
smd->flow->bvh = NULL;
*/
}
- else if(smd->coll)
+ else if (smd->coll)
{
- if(smd->coll->points)
+ if (smd->coll->points)
{
MEM_freeN(smd->coll->points);
smd->coll->points = NULL;
}
- if(smd->coll->bvhtree)
+ if (smd->coll->bvhtree)
{
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
@@ -694,7 +695,7 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
void smokeModifier_free (SmokeModifierData *smd)
{
- if(smd)
+ if (smd)
{
smokeModifier_freeDomain(smd);
smokeModifier_freeFlow(smd);
@@ -704,11 +705,11 @@ void smokeModifier_free (SmokeModifierData *smd)
void smokeModifier_createType(struct SmokeModifierData *smd)
{
- if(smd)
+ if (smd)
{
- if(smd->type & MOD_SMOKE_TYPE_DOMAIN)
+ if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
{
- if(smd->domain)
+ if (smd->domain)
smokeModifier_freeDomain(smd);
smd->domain = MEM_callocN(sizeof(SmokeDomainSettings), "SmokeDomain");
@@ -745,9 +746,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");
@@ -763,9 +764,9 @@ 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");
@@ -808,16 +809,18 @@ 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) {
+ }
+ else if (tsmd->flow) {
tsmd->flow->density = smd->flow->density;
tsmd->flow->temp = smd->flow->temp;
tsmd->flow->psys = smd->flow->psys;
tsmd->flow->type = smd->flow->type;
tsmd->flow->flags = smd->flow->flags;
tsmd->flow->vel_multi = smd->flow->vel_multi;
- } else if (tsmd->coll) {
+ }
+ else if (tsmd->coll) {
;
- /* leave it as initialised, collision settings is mostly caches */
+ /* leave it as initialized, collision settings is mostly caches */
}
}
@@ -833,15 +836,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;
}
@@ -858,29 +861,29 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
Base *base = NULL;
// do collisions, needs to be done before emission, so that smoke isn't emitted inside collision cells
- if(1)
+ if (1)
{
Object *otherobj = NULL;
ModifierData *md = NULL;
- if(sds->coll_group) // we use groups since we have 2 domains
+ if (sds->coll_group) // we use groups since we have 2 domains
go = sds->coll_group->gobject.first;
else
base = scene->base.first;
- while(base || go)
+ while (base || go)
{
otherobj = NULL;
- if(sds->coll_group)
+ if (sds->coll_group)
{
- if(go->ob)
+ if (go->ob)
otherobj = go->ob;
}
else
otherobj = base->object;
- if(!otherobj)
+ if (!otherobj)
{
- if(sds->coll_group)
+ if (sds->coll_group)
go = go->next;
else
base= base->next;
@@ -889,18 +892,18 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
md = modifiers_findByType(otherobj, eModifierType_Smoke);
// check for active smoke modifier
- if(md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
+ if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
{
SmokeModifierData *smd2 = (SmokeModifierData *)md;
- if((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll && smd2->coll->points)
+ if ((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll && smd2->coll->points)
{
// we got nice collision object
SmokeCollSettings *scs = smd2->coll;
size_t i, j;
unsigned char *obstacles = smoke_get_obstacle(smd->domain->fluid);
- for(i = 0; i < scs->numpoints; i++)
+ for (i = 0; i < scs->numpoints; i++)
{
int badcell = 0;
size_t index = 0;
@@ -910,14 +913,14 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
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))
+ for (j = 0; j < 3; j++)
+ if ((cell[j] > sds->res[j] - 1) || (cell[j] < 0))
{
badcell = 1;
break;
}
- if(badcell)
+ 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]);
@@ -934,11 +937,11 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
{
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) {
+ if (usqr>maxusqr) {
// cutoff at maxVelVal
- for(int jj=0; jj<3; jj++) {
- if(objvel[jj]>0.) objvel[jj] = maxVelVal;
- if(objvel[jj]<0.) objvel[jj] = -maxVelVal;
+ for (int jj=0; jj<3; jj++) {
+ if (objvel[jj]>0.) objvel[jj] = maxVelVal;
+ if (objvel[jj]<0.) objvel[jj] = -maxVelVal;
}
}
}
@@ -950,7 +953,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
}
}
- if(sds->coll_group)
+ if (sds->coll_group)
go = go->next;
else
base= base->next;
@@ -958,27 +961,27 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
}
// do flows and fluids
- if(1)
+ if (1)
{
Object *otherobj = NULL;
ModifierData *md = NULL;
- if(sds->fluid_group) // we use groups since we have 2 domains
+ 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)
+ while (base || go)
{
otherobj = NULL;
- if(sds->fluid_group)
+ if (sds->fluid_group)
{
- if(go->ob)
+ if (go->ob)
otherobj = go->ob;
}
else
otherobj = base->object;
- if(!otherobj)
+ if (!otherobj)
{
- if(sds->fluid_group)
+ if (sds->fluid_group)
go = go->next;
else
base= base->next;
@@ -989,17 +992,17 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
md = modifiers_findByType(otherobj, eModifierType_Smoke);
// check for active smoke modifier
- if(md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
+ if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
{
SmokeModifierData *smd2 = (SmokeModifierData *)md;
// check for initialized smoke object
- if((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
+ 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 (sfs && sfs->psys && sfs->psys->part && sfs->psys->part->type==PART_EMITTER) // is particle system selected
{
ParticleSimulationData sim;
ParticleSystem *psys = sfs->psys;
@@ -1028,7 +1031,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
sim.psys = psys;
// initialize temp emission map
- if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW))
+ 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");
@@ -1039,10 +1042,10 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
}
// mostly copied from particle code
- if(psys->part->type==PART_HAIR)
+ if (psys->part->type==PART_HAIR)
{
/*
- if(psys->childcache)
+ if (psys->childcache)
{
totchild = psys->totchildcache;
}
@@ -1055,7 +1058,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
else
totchild=psys->totchild*psys->part->disp/100;
- for(p=0; p<totpart+totchild; p++)
+ for (p=0; p<totpart+totchild; p++)
{
int cell[3];
size_t i = 0;
@@ -1063,21 +1066,21 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
int badcell = 0;
ParticleKey state;
- if(p < totpart)
+ if (p < totpart)
{
- if(psys->particles[p].flag & (PARS_NO_DISP|PARS_UNEXIST))
+ 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))
+ if (psys->particles[cpa->parent].flag & (PARS_NO_DISP|PARS_UNEXIST))
continue;
}
state.time = smd->time;
- if(psys_get_particle_state(&sim, p, &state, 0) == 0)
+ if (psys_get_particle_state(&sim, p, &state, 0) == 0)
continue;
// copy_v3_v3(pos, pa->state.co);
@@ -1085,19 +1088,19 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
// 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++)
+ for (i = 0; i < 3; i++)
{
- if((cell[i] > sds->res[i] - 1) || (cell[i] < 0))
+ if ((cell[i] > sds->res[i] - 1) || (cell[i] < 0))
{
badcell = 1;
break;
}
}
- if(badcell)
+ 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
+ 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;
@@ -1107,14 +1110,14 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
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 (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY && (psys->part->phystype != PART_PHYS_NO))
{
velocity_x[index] = state.vel[0]*sfs->vel_multi;
velocity_y[index] = state.vel[1]*sfs->vel_multi;
velocity_z[index] = state.vel[2]*sfs->vel_multi;
}
}
- else if(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) // outflow
+ else if (sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) // outflow
{
heat[index] = 0.f;
density[index] = 0.f;
@@ -1122,15 +1125,15 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
velocity_y[index] = 0.f;
velocity_z[index] = 0.f;
// we need different handling for the high-res feature
- if(bigdensity)
+ if (bigdensity)
{
// 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++)
+ 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;
@@ -1141,7 +1144,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
// apply emission values
- if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW)) {
+ if (!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW)) {
// initialize variables
int ii, jj, kk, x, y, z, block_size;
@@ -1152,9 +1155,9 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
// 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++)
+ for (x = 0; x < sds->res[0]; x++)
+ for (y = 0; y < sds->res[1]; y++)
+ for (z = 0; z < sds->res[2]; z++)
{
// neighbor cell emission densities (for high resolution smoke smooth interpolation)
@@ -1190,9 +1193,9 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
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++)
+ 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;
@@ -1268,7 +1271,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
}
else {
/*
- for()
+ for ()
{
// no psys
BVHTreeNearest nearest;
@@ -1280,7 +1283,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
}
}
}
- if(sds->fluid_group)
+ if (sds->fluid_group)
go = go->next;
else
base= base->next;
@@ -1291,7 +1294,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
{
ListBase *effectors = pdInitEffectors(scene, ob, NULL, sds->effector_weights);
- if(effectors)
+ if (effectors)
{
float *density = smoke_get_density(sds->fluid);
float *force_x = smoke_get_force_x(sds->fluid);
@@ -1303,15 +1306,15 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
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++)
+ 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)
+ if (density[index] < FLT_EPSILON)
continue;
vel[0] = velocity_x[index];
@@ -1338,12 +1341,12 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
}
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;
@@ -1354,24 +1357,24 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
copy_m4_m4(smd->flow->mat, ob->obmat);
*/
}
- else if(scene->r.cfra < smd->time)
+ else if (scene->r.cfra < smd->time)
{
smd->time = scene->r.cfra;
smokeModifier_reset(smd);
}
}
- else if(smd->type & MOD_SMOKE_TYPE_COLL)
+ else if (smd->type & MOD_SMOKE_TYPE_COLL)
{
- if(scene->r.cfra >= smd->time)
+ 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;
#ifdef USE_SMOKE_COLLISION_DM
- if(smd->coll->dm)
+ if (smd->coll->dm)
smd->coll->dm->release(smd->coll->dm);
smd->coll->dm = CDDM_copy_from_tessface(dm);
@@ -1381,13 +1384,13 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
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];
@@ -1404,14 +1407,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;
@@ -1424,21 +1427,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 */
@@ -1450,14 +1453,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);
}
@@ -1474,26 +1477,26 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// simulate the actual smoke (c++ code in intern/smoke)
// DG: interesting commenting this line + deactivating loading of noise files
- if(framenr!=startframe)
+ if (framenr!=startframe)
{
- if(sds->flags & MOD_SMOKE_DISSOLVE)
+ if (sds->flags & MOD_SMOKE_DISSOLVE)
smoke_dissolve(sds->fluid, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG);
smoke_step(sds->fluid, smd->time, scene->r.frs_sec / scene->r.frs_sec_base);
}
// 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();
@@ -1508,7 +1511,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;
@@ -1562,7 +1565,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;
@@ -1576,11 +1579,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)) {
+ }
+ 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;
@@ -1594,11 +1598,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 {
+ }
+ 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;
@@ -1640,7 +1645,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];
@@ -1653,27 +1658,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 b0075f5c121..4206c9921df 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -1055,7 +1055,7 @@ static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int
(aabbmin[0] > ccdm->bbmax[0]) ||
(aabbmin[1] > ccdm->bbmax[1]) ||
(aabbmin[2] > ccdm->bbmax[2]) ) {
- /* boxes dont intersect */
+ /* boxes don't intersect */
BLI_ghashIterator_step(ihash);
continue;
}
@@ -1065,7 +1065,7 @@ static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int
deflected = 2;
}
- else{
+ else {
/*aye that should be cached*/
printf("missing cache error \n");
BLI_ghashIterator_step(ihash);
@@ -1126,13 +1126,13 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
(aabbmin[0] > ccdm->bbmax[0]) ||
(aabbmin[1] > ccdm->bbmax[1]) ||
(aabbmin[2] > ccdm->bbmax[2]) ) {
- /* boxes dont intersect */
+ /* boxes don't intersect */
BLI_ghashIterator_step(ihash);
continue;
}
}
- else{
+ else {
/*aye that should be cached*/
printf("missing cache error \n");
BLI_ghashIterator_step(ihash);
@@ -1142,7 +1142,7 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
/* use mesh*/
if (mvert) {
- while(a) {
+ while (a) {
copy_v3_v3(nv1,mvert[a-1].co);
if (mprevvert) {
mul_v3_fl(nv1,time);
@@ -1169,7 +1169,7 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
}
}
a--;
- }/* while(a)*/
+ }/* while (a)*/
} /* if (mvert) */
} /* if (ob->pd && ob->pd->deflect) */
BLI_ghashIterator_step(ihash);
@@ -1221,13 +1221,13 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
(aabbmin[0] > ccdm->bbmax[0]) ||
(aabbmin[1] > ccdm->bbmax[1]) ||
(aabbmin[2] > ccdm->bbmax[2]) ) {
- /* boxes dont intersect */
+ /* boxes don't intersect */
BLI_ghashIterator_step(ihash);
continue;
}
}
- else{
+ else {
/*aye that should be cached*/
printf("missing cache error \n");
BLI_ghashIterator_step(ihash);
@@ -1449,13 +1449,13 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
(aabbmin[0] > ccdm->bbmax[0]) ||
(aabbmin[1] > ccdm->bbmax[1]) ||
(aabbmin[2] > ccdm->bbmax[2]) ) {
- /* boxes dont intersect */
+ /* boxes don't intersect */
BLI_ghashIterator_step(ihash);
continue;
}
}
- else{
+ else {
/*aye that should be cached*/
printf("missing cache error \n");
BLI_ghashIterator_step(ihash);
@@ -1601,7 +1601,7 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
add_v3_v3(vel, speed);
}
/* media in rest */
- else{
+ else {
add_v3_v3v3(vel, sb->bpoint[bs->v1].vec , sb->bpoint[bs->v2].vec);
}
f = normalize_v3(vel);
@@ -1617,7 +1617,7 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
normalize_v3(sp);
Vec3PlusStVec(bs->ext_force,f*(1.0f-ABS(dot_v3v3(vel,sp))),vel);
}
- else{
+ else {
Vec3PlusStVec(bs->ext_force,f,vel); // to keep compatible with 2.45 release files
}
}
@@ -1792,7 +1792,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
continue;
}
}
- else{
+ else {
/*aye that should be cached*/
printf("missing cache error \n");
BLI_ghashIterator_step(ihash);
@@ -2048,7 +2048,7 @@ static void dfdx_spring(int ia, int ic, int op, float dir[3],float L,float len,f
nlMatrixAdd(ia+i,op+ic+j,m);
}
}
- else{
+ else {
for (i=0;i<3;i++)
for (j=0;j<3;j++) {
m=factor*dir[i]*dir[j];
@@ -2097,7 +2097,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
ic =3*bs->v1;
#endif
}
- else{
+ else {
/* TODO make this debug option */
/**/
printf("bodypoint <bpi> is not attached to spring <*bs> --> sb_spring_force()\n");
@@ -2217,7 +2217,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
compare = (obp->colball + bp->colball);
sub_v3_v3v3(def, bp->pos, obp->pos);
/* rather check the AABBoxes before ever calulating the real distance */
- /* mathematically it is completly nuts, but performace is pretty much (3) times faster */
+ /* mathematically it is completly nuts, but performance is pretty much (3) times faster */
if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue;
distance = normalize_v3(def);
if (distance < compare ) {
@@ -2490,7 +2490,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
softbody_calc_forcesEx(scene, ob, forcetime, timenow, nl_flags);
return;
}
- else{
+ else {
/* so the following will die */
/* |||||||||||||||||||||||||| */
/* VVVVVVVVVVVVVVVVVVVVVVVVVV */
@@ -2588,7 +2588,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
sub_v3_v3v3(def, bp->pos, obp->pos);
/* rather check the AABBoxes before ever calulating the real distance */
- /* mathematically it is completly nuts, but performace is pretty much (3) times faster */
+ /* mathematically it is completly nuts, but performance is pretty much (3) times faster */
if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue;
distance = normalize_v3(def);
@@ -2762,7 +2762,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
*/
Vec3PlusStVec(bp->pos,-intrusion,facenormal);
}
- else{
+ else {
sub_v3_v3v3(cfforce,bp->vec,vel);
Vec3PlusStVec(bp->force,-cf*50.0f,cfforce);
@@ -2773,7 +2773,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
bp->loc_flag |= SBF_DOFUZZY;
bp->choke = sb->choke*0.01f;
}
- else{
+ else {
sub_v3_v3v3(cfforce,bp->vec,vel);
Vec3PlusStVec(bp->force,-cf*50.0f,cfforce);
}
@@ -2873,7 +2873,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
}
*/
}
- else{
+ else {
printf("Matrix inversion failed \n");
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
copy_v3_v3(bp->impdv,bp->force);
@@ -2963,7 +2963,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
if ((dot_v3v3(dx,dx)<freezeloc )&&(dot_v3v3(bp->force,bp->force)<freezeforce )) {
bp->frozen /=2;
}
- else{
+ else {
bp->frozen = MIN2(bp->frozen*1.05f,1.0f);
}
mul_v3_fl(dx,bp->frozen);
@@ -3295,7 +3295,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
/* should be fixed for meshes */
// bp->goal= sb->mingoal + bp->goal*goalfac; /* do not do here jow_go_for2_5 */
}
- else{
+ else {
/* in consequence if no group was set .. but we want to animate it laters */
/* logically attach to goal with default first */
if (ob->softflag & OB_SB_GOAL) {bp->goal = sb->defgoal;}
@@ -3610,13 +3610,13 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
bs->v1= curindex;
bs->v2= curindex+1;
bs->springtype=SB_HANDLE;
- bs->len= globallen( bezt->vec[0], bezt->vec[1], ob );
+ bs->len= globallen(bezt->vec[0], bezt->vec[1], ob);
bs++;
bs->v1= curindex+1;
bs->v2= curindex+2;
bs->springtype=SB_HANDLE;
- bs->len= globallen( bezt->vec[1], bezt->vec[2], ob );
+ bs->len= globallen(bezt->vec[1], bezt->vec[2], ob);
bs++;
}
}
@@ -4032,7 +4032,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
//removed
}/*SOLVER SELECT*/
- else{
+ else {
printf("softbody no valid solver ID!");
}/*SOLVER SELECT*/
if (sb->plastic) { apply_spring_memory(ob);}
@@ -4132,7 +4132,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
}
/* try to read from cache */
- cache_result = BKE_ptcache_read(&pid, framenr);
+ cache_result = BKE_ptcache_read(&pid, (float)framenr+scene->r.subframe);
if (cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) {
softbody_to_object(ob, vertexCos, numVerts, sb->local);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index a41e765695e..c2dbb518837 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -86,7 +86,7 @@ struct bSound* sound_new_file(struct Main *bmain, const char *filename)
BLI_path_abs(str, path);
len = strlen(filename);
- while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
+ while (len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
len--;
sound = alloc_libblock(&bmain->sound, ID_SO, filename+len);
@@ -141,7 +141,7 @@ static void sound_sync_callback(void* data, int mode, float time)
struct Scene* scene;
scene = bmain->scene.first;
- while(scene)
+ while (scene)
{
if (scene->audio.flag & AUDIO_SYNC)
{
@@ -351,7 +351,7 @@ void sound_load(struct Main *bmain, struct bSound* sound)
/* load sound */
PackedFile* pf = sound->packedfile;
- /* dont modify soundact->sound->name, only change a copy */
+ /* don't modify soundact->sound->name, only change a copy */
BLI_strncpy(fullpath, sound->name, sizeof(fullpath));
BLI_path_abs(fullpath, ID_BLEND_PATH(bmain, &sound->id));
@@ -765,7 +765,7 @@ 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);
}
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index a5d24c79bba..5466630f621 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -70,7 +70,7 @@ Speaker *copy_speaker(Speaker *spk)
Speaker *spkn;
spkn= copy_libblock(&spk->id);
- if(spkn->sound)
+ if (spkn->sound)
spkn->sound->id.us++;
return spkn;
@@ -87,25 +87,25 @@ void make_local_speaker(Speaker *spk)
* - mixed: make copy
*/
- if(spk->id.lib==NULL) return;
- if(spk->id.us==1) {
+ if (spk->id.lib==NULL) return;
+ if (spk->id.us==1) {
id_clear_lib_data(bmain, &spk->id);
return;
}
ob= bmain->object.first;
- while(ob) {
- if(ob->data==spk) {
- if(ob->id.lib) is_lib= TRUE;
+ while (ob) {
+ if (ob->data==spk) {
+ if (ob->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
ob= ob->id.next;
}
- if(is_local && is_lib == FALSE) {
+ if (is_local && is_lib == FALSE) {
id_clear_lib_data(bmain, &spk->id);
}
- else if(is_local && is_lib) {
+ else if (is_local && is_lib) {
Speaker *spk_new= copy_speaker(spk);
spk_new->id.us= 0;
@@ -113,10 +113,10 @@ void make_local_speaker(Speaker *spk)
BKE_id_lib_local_paths(bmain, spk->id.lib, &spk_new->id);
ob= bmain->object.first;
- while(ob) {
- if(ob->data==spk) {
+ while (ob) {
+ if (ob->data==spk) {
- if(ob->id.lib==NULL) {
+ if (ob->id.lib==NULL) {
ob->data= spk_new;
spk_new->id.us++;
spk->id.us--;
@@ -129,7 +129,7 @@ void make_local_speaker(Speaker *spk)
void free_speaker(Speaker *spk)
{
- if(spk->sound)
+ if (spk->sound)
spk->sound->id.us--;
BKE_free_animdata((ID *)spk);
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 2f79c9cdd9f..06773bd4696 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -45,6 +45,7 @@
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
+#include "BLI_bitmap.h"
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
#include "BLI_math.h"
@@ -55,6 +56,7 @@
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
+#include "BKE_multires.h"
#include "BKE_paint.h"
#include "BKE_scene.h"
#include "BKE_subsurf.h"
@@ -128,7 +130,8 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags fl
if (oldUseAging!=useAging) {
ccgSubSurf_free(prevSS);
- } else {
+ }
+ else {
ccgSubSurf_setSubdivisionLevels(prevSS, subdivLevels);
return prevSS;
@@ -137,7 +140,8 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags fl
if (useAging) {
ifc.vertUserSize = ifc.edgeUserSize = ifc.faceUserSize = 12;
- } else {
+ }
+ else {
ifc.vertUserSize = ifc.edgeUserSize = ifc.faceUserSize = 8;
}
ifc.vertDataSize = sizeof(float) * (flags & CCG_CALC_NORMALS ? 6 : 3);
@@ -152,7 +156,8 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags fl
allocatorIFC.release = arena_release;
ccgSS = ccgSubSurf_new(&ifc, subdivLevels, &allocatorIFC, allocator);
- } else {
+ }
+ else {
ccgSS = ccgSubSurf_new(&ifc, subdivLevels, NULL, NULL);
}
@@ -178,9 +183,11 @@ static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize)
if (x==0) {
return v0idx;
- } else if (x==edgeSize-1) {
+ }
+ else if (x==edgeSize-1) {
return v1idx;
- } else {
+ }
+ else {
return edgeBase + x-1;
}
}
@@ -193,32 +200,40 @@ static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edg
if (x==gridSize-1 && y==gridSize-1) {
CCGVert *v = ccgSubSurf_getFaceVert(f, S);
return *((int*) ccgSubSurf_getVertUserData(ss, v));
- } else if (x==gridSize-1) {
+ }
+ else if (x==gridSize-1) {
CCGVert *v = ccgSubSurf_getFaceVert(f, S);
CCGEdge *e = ccgSubSurf_getFaceEdge(f, S);
int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e));
if (v==ccgSubSurf_getEdgeVert0(e)) {
return edgeBase + (gridSize-1-y)-1;
- } else {
+ }
+ else {
return edgeBase + (edgeSize-2-1)-((gridSize-1-y)-1);
}
- } else if (y==gridSize-1) {
+ }
+ else if (y==gridSize-1) {
CCGVert *v = ccgSubSurf_getFaceVert(f, S);
CCGEdge *e = ccgSubSurf_getFaceEdge(f, (S+numVerts-1)%numVerts);
int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e));
if (v==ccgSubSurf_getEdgeVert0(e)) {
return edgeBase + (gridSize-1-x)-1;
- } else {
+ }
+ else {
return edgeBase + (edgeSize-2-1)-((gridSize-1-x)-1);
}
- } else if (x==0 && y==0) {
+ }
+ else if (x==0 && y==0) {
return faceBase;
- } else if (x==0) {
+ }
+ else if (x==0) {
S = (S+numVerts-1)%numVerts;
return faceBase + 1 + (gridSize-2)*S + (y-1);
- } else if (y==0) {
+ }
+ else if (y==0) {
return faceBase + 1 + (gridSize-2)*S + (x-1);
- } else {
+ }
+ else {
return faceBase + 1 + (gridSize-2)*numVerts + S*(gridSize-2)*(gridSize-2) + (y-1)*(gridSize-2) + (x-1);
}
}
@@ -362,13 +377,13 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
MTFace *tface = CustomData_get_layer_n(&result->faceData, CD_MTFACE, n);
MLoopUV *mloopuv = CustomData_get_layer_n(&result->loopData, CD_MLOOPUV, n);
- if(!dmloopuv || (!tface && !mloopuv))
+ if (!dmloopuv || (!tface && !mloopuv))
return;
/* create a CCGSubSurf from uv's */
uvss = _getSubSurf(NULL, ccgSubSurf_getSubdivisionLevels(ss), CCG_USE_ARENA);
- if(!ss_sync_from_uv(uvss, ss, dm, dmloopuv)) {
+ if (!ss_sync_from_uv(uvss, ss, dm, dmloopuv)) {
ccgSubSurf_free(uvss);
return;
}
@@ -383,7 +398,7 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
faceMap = MEM_mallocN(totface*sizeof(*faceMap), "facemapuv");
fi = ccgSubSurf_getFaceIterator(uvss);
- for(; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
+ for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f;
}
@@ -393,36 +408,36 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
tf= tface;
mluv= mloopuv;
- for(index = 0; index < totface; index++) {
+ for (index = 0; index < totface; index++) {
CCGFace *f = faceMap[index];
int numVerts = ccgSubSurf_getFaceNumVerts(f);
for (S=0; S<numVerts; S++) {
float (*faceGridData)[3]= ccgSubSurf_getFaceGridDataArray(uvss, f, S);
- for(y = 0; y < gridFaces; y++) {
- for(x = 0; x < gridFaces; x++) {
+ for (y = 0; y < gridFaces; y++) {
+ for (x = 0; x < gridFaces; x++) {
float *a = faceGridData[(y + 0)*gridSize + x + 0];
float *b = faceGridData[(y + 0)*gridSize + x + 1];
float *c = faceGridData[(y + 1)*gridSize + x + 1];
float *d = faceGridData[(y + 1)*gridSize + x + 0];
- if (tface) {
- tf->uv[0][0] = a[0]; tf->uv[0][1] = a[1];
- tf->uv[1][0] = d[0]; tf->uv[1][1] = d[1];
- tf->uv[2][0] = c[0]; tf->uv[2][1] = c[1];
- tf->uv[3][0] = b[0]; tf->uv[3][1] = b[1];
+ if (tf) {
+ copy_v2_v2(tf->uv[0], a);
+ copy_v2_v2(tf->uv[1], d);
+ copy_v2_v2(tf->uv[2], c);
+ copy_v2_v2(tf->uv[3], b);
+ tf++;
}
- if (mloopuv) {
- mluv[0].uv[0] = a[0]; mluv[0].uv[1] = a[1];
- mluv[1].uv[0] = d[0]; mluv[1].uv[1] = d[1];
- mluv[2].uv[0] = c[0]; mluv[2].uv[1] = c[1];
- mluv[3].uv[0] = b[0]; mluv[3].uv[1] = b[1];
+ if (mluv) {
+ copy_v2_v2(mluv[0].uv, a);
+ copy_v2_v2(mluv[1].uv, d);
+ copy_v2_v2(mluv[2].uv, c);
+ copy_v2_v2(mluv[3].uv, b);
+ mluv += 4;
}
- tf++;
- mluv+=4;
}
}
}
@@ -533,12 +548,13 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
mv = mvert;
index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX);
- for(i = 0; i < totvert; i++, mv++) {
+ for (i = 0; i < totvert; i++, mv++) {
CCGVert *v;
- if(vertexCos) {
+ if (vertexCos) {
ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), vertexCos[i], 0, &v);
- } else {
+ }
+ else {
ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), mv->co, 0, &v);
}
@@ -547,7 +563,7 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
me = medge;
index = (int *)dm->getEdgeDataArray(dm, CD_ORIGINDEX);
- for(i = 0; i < totedge; i++, me++) {
+ for (i = 0; i < totedge; i++, me++) {
CCGEdge *e;
float crease;
@@ -577,11 +593,11 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
* it is not really possible to continue without modifying
* other parts of code significantly to handle missing faces.
* since this really shouldn't even be possible we just bail.*/
- if(ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), mp->totloop,
+ if (ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), mp->totloop,
fVerts, &f) == eCCGError_InvalidValue) {
static int hasGivenError = 0;
- if(!hasGivenError) {
+ if (!hasGivenError) {
//XXX error("Unrecoverable error in SubSurf calculation,"
// " mesh is inconsistent.");
@@ -700,7 +716,7 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
memset(mv, 0, sizeof(*mv));
- if((vertNum < ccgdm->edgeMap[0].startVert) && (ccgSubSurf_getNumFaces(ss) > 0)) {
+ if ((vertNum < ccgdm->edgeMap[0].startVert) && (ccgSubSurf_getNumFaces(ss) > 0)) {
/* this vert comes from face data */
int lastface = ccgSubSurf_getNumFaces(ss) - 1;
CCGFace *f;
@@ -713,7 +729,7 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
int gridInternalEnd;
i = 0;
- while(i < lastface && vertNum >= ccgdm->faceMap[i + 1].startVert)
+ while (i < lastface && vertNum >= ccgdm->faceMap[i + 1].startVert)
++i;
f = ccgdm->faceMap[i].face;
@@ -726,18 +742,20 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
gridInternalEnd = gridSideEnd + numVerts * gridInternalVerts;
offset = vertNum - ccgdm->faceMap[i].startVert;
- if(offset < 1) {
+ if (offset < 1) {
vd = ccgSubSurf_getFaceCenterData(f);
copy_v3_v3(mv->co, vd->co);
normal_float_to_short_v3(mv->no, vd->no);
- } else if(offset < gridSideEnd) {
+ }
+ else if (offset < gridSideEnd) {
offset -= 1;
grid = offset / gridSideVerts;
x = offset % gridSideVerts + 1;
vd = ccgSubSurf_getFaceGridEdgeData(ss, f, grid, x);
copy_v3_v3(mv->co, vd->co);
normal_float_to_short_v3(mv->no, vd->no);
- } else if(offset < gridInternalEnd) {
+ }
+ else if (offset < gridInternalEnd) {
offset -= gridSideEnd;
grid = offset / gridInternalVerts;
offset %= gridInternalVerts;
@@ -747,14 +765,15 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
copy_v3_v3(mv->co, vd->co);
normal_float_to_short_v3(mv->no, vd->no);
}
- } else if((vertNum < ccgdm->vertMap[0].startVert) && (ccgSubSurf_getNumEdges(ss) > 0)) {
+ }
+ else if ((vertNum < ccgdm->vertMap[0].startVert) && (ccgSubSurf_getNumEdges(ss) > 0)) {
/* this vert comes from edge data */
CCGEdge *e;
int lastedge = ccgSubSurf_getNumEdges(ss) - 1;
int x;
i = 0;
- while(i < lastedge && vertNum >= ccgdm->edgeMap[i + 1].startVert)
+ while (i < lastedge && vertNum >= ccgdm->edgeMap[i + 1].startVert)
++i;
e = ccgdm->edgeMap[i].edge;
@@ -763,7 +782,8 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
vd = ccgSubSurf_getEdgeData(ss, e, x);
copy_v3_v3(mv->co, vd->co);
normal_float_to_short_v3(mv->no, vd->no);
- } else {
+ }
+ else {
/* this vert comes from vert data */
CCGVert *v;
i = vertNum - ccgdm->vertMap[0].startVert;
@@ -799,7 +819,7 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
memset(med, 0, sizeof(*med));
- if(edgeNum < ccgdm->edgeMap[0].startEdge) {
+ if (edgeNum < ccgdm->edgeMap[0].startEdge) {
/* this edge comes from face data */
int lastface = ccgSubSurf_getNumFaces(ss) - 1;
CCGFace *f;
@@ -819,9 +839,11 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
previ = i;
if (ccgdm->faceMap[i].startEdge >= edgeNum) {
i -= fabsf(i-lasti)/2.0f;
- } else if (ccgdm->faceMap[i].startEdge < edgeNum) {
+ }
+ else if (ccgdm->faceMap[i].startEdge < edgeNum) {
i += fabsf(i-lasti)/2.0f;
- } else {
+ }
+ else {
break;
}
@@ -846,7 +868,7 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
#endif
i = 0;
- while(i < lastface && edgeNum >= ccgdm->faceMap[i + 1].startEdge)
+ while (i < lastface && edgeNum >= ccgdm->faceMap[i + 1].startEdge)
++i;
f = ccgdm->faceMap[i].face;
@@ -859,23 +881,26 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
grid = offset / (gridSideEdges + gridInternalEdges);
offset %= (gridSideEdges + gridInternalEdges);
- if(offset < gridSideEdges) {
+ if (offset < gridSideEdges) {
x = offset;
med->v1 = getFaceIndex(ss, f, grid, x, 0, edgeSize, gridSize);
med->v2 = getFaceIndex(ss, f, grid, x+1, 0, edgeSize, gridSize);
- } else {
+ }
+ else {
offset -= gridSideEdges;
x = (offset / 2) / gridSideEdges + 1;
y = (offset / 2) % gridSideEdges;
- if(offset % 2 == 0) {
+ if (offset % 2 == 0) {
med->v1 = getFaceIndex(ss, f, grid, x, y, edgeSize, gridSize);
med->v2 = getFaceIndex(ss, f, grid, x, y+1, edgeSize, gridSize);
- } else {
+ }
+ else {
med->v1 = getFaceIndex(ss, f, grid, y, x, edgeSize, gridSize);
med->v2 = getFaceIndex(ss, f, grid, y+1, x, edgeSize, gridSize);
}
}
- } else {
+ }
+ else {
/* this vert comes from edge data */
CCGEdge *e;
int edgeSize = ccgSubSurf_getEdgeSize(ss);
@@ -887,7 +912,7 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
e = ccgdm->edgeMap[i].edge;
- if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE;
+ if (!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE;
x = edgeNum - ccgdm->edgeMap[i].startEdge;
@@ -895,7 +920,7 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
med->v2 = getEdgeIndex(ss, e, x+1, edgeSize);
edgeFlag = (ccgdm->edgeFlags)? &ccgdm->edgeFlags[i]: NULL;
- if(edgeFlag)
+ if (edgeFlag)
flags |= (*edgeFlag & (ME_SEAM | ME_SHARP | ME_FREESTYLE_EDGE))
| ME_EDGEDRAW | ME_EDGERENDER;
else
@@ -942,13 +967,51 @@ static void ccgDM_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf)
mf->v3 = getFaceIndex(ss, f, grid, x+1, y+1, edgeSize, gridSize);
mf->v4 = getFaceIndex(ss, f, grid, x+1, y+0, edgeSize, gridSize);
- if(faceFlags) {
+ if (faceFlags) {
mf->flag = faceFlags[i].flag;
mf->mat_nr = faceFlags[i].mat_nr;
}
else mf->flag = ME_SMOOTH;
}
+/* Translate GridHidden into the ME_HIDE flag for MVerts. Assumes
+ vertices are in the order output by ccgDM_copyFinalVertArray. */
+void subsurf_copy_grid_hidden(DerivedMesh *dm, const MPoly *mpoly,
+ MVert *mvert, const MDisps *mdisps)
+{
+ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*)dm;
+ CCGSubSurf *ss = ccgdm->ss;
+ int level = ccgSubSurf_getSubdivisionLevels(ss);
+ int gridSize = ccgSubSurf_getGridSize(ss);
+ int edgeSize = ccgSubSurf_getEdgeSize(ss);
+ int totface = ccgSubSurf_getNumFaces(ss);
+ int i, j, x, y;
+
+ for (i = 0; i < totface; i++) {
+ CCGFace *f = ccgdm->faceMap[i].face;
+
+ for (j = 0; j < mpoly[i].totloop; j++) {
+ const MDisps *md = &mdisps[mpoly[i].loopstart + j];
+ int hidden_gridsize = ccg_gridsize(md->level);
+ int factor = ccg_factor(level, md->level);
+
+ if (!md->hidden)
+ continue;
+
+ for (y = 0; y < gridSize; y++) {
+ for (x = 0; x < gridSize; x++) {
+ int vndx, offset;
+
+ vndx = getFaceIndex(ss, f, j, x, y, edgeSize, gridSize);
+ offset = (y*factor) * hidden_gridsize + (x*factor);
+ if (BLI_BITMAP_GET(md->hidden, offset))
+ mvert[vndx].flag |= ME_HIDE;
+ }
+ }
+ }
+ }
+}
+
static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
@@ -961,7 +1024,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
int i = 0;
totface = ccgSubSurf_getNumFaces(ss);
- for(index = 0; index < totface; index++) {
+ for (index = 0; index < totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
@@ -970,17 +1033,17 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
normal_float_to_short_v3(mvert[i].no, vd->no);
i++;
- for(S = 0; S < numVerts; S++) {
- for(x = 1; x < gridSize - 1; x++, i++) {
+ for (S = 0; S < numVerts; S++) {
+ for (x = 1; x < gridSize - 1; x++, i++) {
vd= ccgSubSurf_getFaceGridEdgeData(ss, f, S, x);
copy_v3_v3(mvert[i].co, vd->co);
normal_float_to_short_v3(mvert[i].no, vd->no);
}
}
- for(S = 0; S < numVerts; S++) {
- for(y = 1; y < gridSize - 1; y++) {
- for(x = 1; x < gridSize - 1; x++, i++) {
+ for (S = 0; S < numVerts; S++) {
+ for (y = 1; y < gridSize - 1; y++) {
+ for (x = 1; x < gridSize - 1; x++, i++) {
vd= ccgSubSurf_getFaceGridData(ss, f, S, x, y);
copy_v3_v3(mvert[i].co, vd->co);
normal_float_to_short_v3(mvert[i].no, vd->no);
@@ -990,15 +1053,15 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
}
totedge = ccgSubSurf_getNumEdges(ss);
- for(index = 0; index < totedge; index++) {
+ for (index = 0; index < totedge; index++) {
CCGEdge *e = ccgdm->edgeMap[index].edge;
int x;
- for(x = 1; x < edgeSize - 1; x++, i++) {
+ for (x = 1; x < edgeSize - 1; x++, i++) {
vd= ccgSubSurf_getEdgeData(ss, e, x);
copy_v3_v3(mvert[i].co, vd->co);
/* This gives errors with -debug-fpe
- * the normals dont seem to be unit length.
+ * the normals don't seem to be unit length.
* this is most likely caused by edges with no
* faces which are now zerod out, see comment in:
* ccgSubSurf__calcVertNormals(), - campbell */
@@ -1007,7 +1070,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
}
totvert = ccgSubSurf_getNumVerts(ss);
- for(index = 0; index < totvert; index++) {
+ for (index = 0; index < totvert; index++) {
CCGVert *v = ccgdm->vertMap[index].vert;
vd= ccgSubSurf_getVertData(ss, v);
@@ -1029,27 +1092,27 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
short *edgeFlags = ccgdm->edgeFlags;
totface = ccgSubSurf_getNumFaces(ss);
- for(index = 0; index < totface; index++) {
+ for (index = 0; index < totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
- for(S = 0; S < numVerts; S++) {
- for(x = 0; x < gridSize - 1; x++) {
+ for (S = 0; S < numVerts; S++) {
+ for (x = 0; x < gridSize - 1; x++) {
MEdge *med = &medge[i];
- if(ccgdm->drawInteriorEdges)
+ if (ccgdm->drawInteriorEdges)
med->flag = ME_EDGEDRAW | ME_EDGERENDER;
med->v1 = getFaceIndex(ss, f, S, x, 0, edgeSize, gridSize);
med->v2 = getFaceIndex(ss, f, S, x + 1, 0, edgeSize, gridSize);
i++;
}
- for(x = 1; x < gridSize - 1; x++) {
- for(y = 0; y < gridSize - 1; y++) {
+ for (x = 1; x < gridSize - 1; x++) {
+ for (y = 0; y < gridSize - 1; y++) {
MEdge *med;
med = &medge[i];
- if(ccgdm->drawInteriorEdges)
+ if (ccgdm->drawInteriorEdges)
med->flag = ME_EDGEDRAW | ME_EDGERENDER;
med->v1 = getFaceIndex(ss, f, S, x, y,
edgeSize, gridSize);
@@ -1058,7 +1121,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
i++;
med = &medge[i];
- if(ccgdm->drawInteriorEdges)
+ if (ccgdm->drawInteriorEdges)
med->flag = ME_EDGEDRAW | ME_EDGERENDER;
med->v1 = getFaceIndex(ss, f, S, y, x,
edgeSize, gridSize);
@@ -1071,24 +1134,25 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
}
totedge = ccgSubSurf_getNumEdges(ss);
- for(index = 0; index < totedge; index++) {
+ for (index = 0; index < totedge; index++) {
CCGEdge *e = ccgdm->edgeMap[index].edge;
unsigned int flags = 0;
int x;
int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
- if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE;
+ if (!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE;
- if(edgeFlags) {
- if(edgeIdx != -1) {
+ if (edgeFlags) {
+ if (edgeIdx != -1) {
flags |= (edgeFlags[index] & (ME_SEAM | ME_SHARP | ME_FREESTYLE_EDGE))
| ME_EDGEDRAW | ME_EDGERENDER;
}
- } else {
+ }
+ else {
flags |= ME_EDGEDRAW | ME_EDGERENDER;
}
- for(x = 0; x < edgeSize - 1; x++) {
+ for (x = 0; x < edgeSize - 1; x++) {
MEdge *med = &medge[i];
med->v1 = getEdgeIndex(ss, e, x, edgeSize);
med->v2 = getEdgeIndex(ss, e, x + 1, edgeSize);
@@ -1110,16 +1174,16 @@ static void ccgDM_copyFinalFaceArray(DerivedMesh *dm, MFace *mface)
DMFlagMat *faceFlags = ccgdm->faceFlags;
totface = ccgSubSurf_getNumFaces(ss);
- for(index = 0; index < totface; index++) {
+ for (index = 0; index < totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
/* keep types in sync with MFace, avoid many conversions */
char flag = (faceFlags)? faceFlags[index].flag: ME_SMOOTH;
short mat_nr = (faceFlags)? faceFlags[index].mat_nr: 0;
- for(S = 0; S < numVerts; S++) {
- for(y = 0; y < gridSize - 1; y++) {
- for(x = 0; x < gridSize - 1; x++) {
+ for (S = 0; S < numVerts; S++) {
+ for (y = 0; y < gridSize - 1; y++) {
+ for (x = 0; x < gridSize - 1; x++) {
MFace *mf = &mface[i];
mf->v1 = getFaceIndex(ss, f, S, x + 0, y + 0,
edgeSize, gridSize);
@@ -1164,15 +1228,15 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, MLoop *mloop)
totface = ccgSubSurf_getNumFaces(ss);
mv = mloop;
- for(index = 0; index < totface; index++) {
+ for (index = 0; index < totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
/* int flag = (faceFlags)? faceFlags[index*2]: ME_SMOOTH; */ /* UNUSED */
/* int mat_nr = (faceFlags)? faceFlags[index*2+1]: 0; */ /* UNUSED */
- for(S = 0; S < numVerts; S++) {
- for(y = 0; y < gridSize - 1; y++) {
- for(x = 0; x < gridSize - 1; x++) {
+ for (S = 0; S < numVerts; S++) {
+ for (y = 0; y < gridSize - 1; y++) {
+ for (x = 0; x < gridSize - 1; x++) {
int v1, v2, v3, v4;
v1 = getFaceIndex(ss, f, S, x + 0, y + 0,
@@ -1218,15 +1282,15 @@ static void ccgDM_copyFinalPolyArray(DerivedMesh *dm, MPoly *mface)
DMFlagMat *faceFlags = ccgdm->faceFlags;
totface = ccgSubSurf_getNumFaces(ss);
- for(index = 0; index < totface; index++) {
+ for (index = 0; index < totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
int flag = (faceFlags)? faceFlags[index].flag: ME_SMOOTH;
int mat_nr = (faceFlags)? faceFlags[index].mat_nr: 0;
- for(S = 0; S < numVerts; S++) {
- for(y = 0; y < gridSize - 1; y++) {
- for(x = 0; x < gridSize - 1; x++) {
+ for (S = 0; S < numVerts; S++) {
+ for (y = 0; y < gridSize - 1; y++) {
+ for (x = 0; x < gridSize - 1; x++) {
MPoly *mf = &mface[i];
mf->mat_nr = mat_nr;
@@ -1413,12 +1477,12 @@ static void ccgDM_drawVerts(DerivedMesh *dm)
static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
{
- if(ccgdm->pbvh && ccgDM_use_grid_pbvh(ccgdm)) {
+ if (ccgdm->pbvh && ccgDM_use_grid_pbvh(ccgdm)) {
CCGFace **faces;
int totface;
BLI_pbvh_get_grid_updates(ccgdm->pbvh, 1, (void***)&faces, &totface);
- if(totface) {
+ if (totface) {
ccgSubSurf_updateFromFaces(ccgdm->ss, 0, faces, totface);
ccgSubSurf_updateNormals(ccgdm->ss, faces, totface);
MEM_freeN(faces);
@@ -1446,7 +1510,7 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(e))
continue;
- if(ccgdm->edgeFlags && !(ccgdm->edgeFlags[j] & ME_EDGEDRAW))
+ if (ccgdm->edgeFlags && !(ccgdm->edgeFlags[j] & ME_EDGEDRAW))
continue;
if (useAging && !(G.f&G_BACKBUFSEL)) {
@@ -1469,7 +1533,7 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
if (ccgdm->drawInteriorEdges) {
int totface = ccgSubSurf_getNumFaces(ss);
- for(j = 0; j < totface; j++) {
+ for (j = 0; j < totface; j++) {
CCGFace *f = ccgdm->faceMap[j].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
@@ -1546,8 +1610,8 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
ccgdm_pbvh_update(ccgdm);
- if(ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
- if(dm->numTessFaceData) {
+ if (ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
+ if (dm->numTessFaceData) {
BLI_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL, setMaterial);
glShadeModel(GL_FLAT);
}
@@ -1555,13 +1619,13 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
return;
}
- for(i = 0; i < totface; i++) {
+ for (i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
int new_matnr, new_shademodel;
- if(faceFlags) {
+ if (faceFlags) {
new_shademodel = (faceFlags[index].flag & ME_SMOOTH)? GL_SMOOTH: GL_FLAT;
new_matnr= faceFlags[index].mat_nr;
}
@@ -1570,7 +1634,7 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
new_matnr= 0;
}
- if(shademodel != new_shademodel || matnr != new_matnr) {
+ if (shademodel != new_shademodel || matnr != new_matnr) {
matnr= new_matnr;
shademodel= new_shademodel;
@@ -1579,7 +1643,7 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
glShadeModel(shademodel);
}
- if(!drawcurrent)
+ if (!drawcurrent)
continue;
for (S=0; S<numVerts; S++) {
@@ -1599,7 +1663,8 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
}
glEnd();
}
- } else {
+ }
+ else {
glBegin(GL_QUADS);
for (y=0; y<gridSize-1; y+=step) {
for (x=0; x<gridSize-1; x+=step) {
@@ -1645,28 +1710,28 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
matnr = -1;
#define PASSATTRIB(dx, dy, vert) { \
- if(attribs.totorco) { \
+ if (attribs.totorco) { \
index = getFaceIndex(ss, f, S, x+dx, y+dy, edgeSize, gridSize); \
glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]); \
} \
- for(b = 0; b < attribs.tottface; b++) { \
+ for (b = 0; b < attribs.tottface; b++) { \
MTFace *tf = &attribs.tface[b].array[a]; \
glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \
} \
- for(b = 0; b < attribs.totmcol; b++) { \
+ for (b = 0; b < attribs.totmcol; b++) { \
MCol *cp = &attribs.mcol[b].array[a*4 + vert]; \
GLubyte col[4]; \
col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; \
glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col); \
} \
- if(attribs.tottang) { \
+ if (attribs.tottang) { \
float *tang = attribs.tang.array[a*4 + vert]; \
glVertexAttrib4fvARB(attribs.tang.glIndex, tang); \
} \
}
totface = ccgSubSurf_getNumFaces(ss);
- for(a = 0, i = 0; i < totface; i++) {
+ for (a = 0, i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, drawSmooth;
int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
@@ -1674,7 +1739,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
numVerts = ccgSubSurf_getFaceNumVerts(f);
- if(faceFlags) {
+ if (faceFlags) {
drawSmooth = (faceFlags[index].flag & ME_SMOOTH);
new_matnr= faceFlags[index].mat_nr + 1;
}
@@ -1683,13 +1748,13 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
new_matnr= 1;
}
- if(new_matnr != matnr) {
+ if (new_matnr != matnr) {
doDraw = setMaterial(matnr = new_matnr, &gattribs);
- if(doDraw)
+ if (doDraw)
DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
}
- if(!doDraw || (setDrawOptions && (origIndex != ORIGINDEX_NONE) &&
+ if (!doDraw || (setDrawOptions && (origIndex != ORIGINDEX_NONE) &&
(setDrawOptions(userData, origIndex) == DM_DRAW_OPTION_SKIP))) {
a += gridFaces*gridFaces*numVerts;
continue;
@@ -1715,7 +1780,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
glNormal3fv(vdb->no);
glVertex3fv(vdb->co);
- if(x != gridFaces-1)
+ if (x != gridFaces-1)
a++;
}
@@ -1734,7 +1799,8 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
a++;
}
- } else {
+ }
+ else {
glBegin(GL_QUADS);
for (y=0; y<gridFaces; y++) {
for (x=0; x<gridFaces; x++) {
@@ -1788,34 +1854,34 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
matnr = -1;
#define PASSATTRIB(dx, dy, vert) { \
- if(attribs.totorco) { \
+ if (attribs.totorco) { \
index = getFaceIndex(ss, f, S, x+dx, y+dy, edgeSize, gridSize); \
- if(attribs.orco.glTexco) \
+ if (attribs.orco.glTexco) \
glTexCoord3fv(attribs.orco.array[index]); \
else \
glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]); \
} \
- for(b = 0; b < attribs.tottface; b++) { \
+ for (b = 0; b < attribs.tottface; b++) { \
MTFace *tf = &attribs.tface[b].array[a]; \
- if(attribs.tface[b].glTexco) \
+ if (attribs.tface[b].glTexco) \
glTexCoord2fv(tf->uv[vert]); \
else \
glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \
} \
- for(b = 0; b < attribs.totmcol; b++) { \
+ for (b = 0; b < attribs.totmcol; b++) { \
MCol *cp = &attribs.mcol[b].array[a*4 + vert]; \
GLubyte col[4]; \
col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; \
glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col); \
} \
- if(attribs.tottang) { \
+ if (attribs.tottang) { \
float *tang = attribs.tang.array[a*4 + vert]; \
glVertexAttrib4fvARB(attribs.tang.glIndex, tang); \
} \
}
totface = ccgSubSurf_getNumFaces(ss);
- for(a = 0, i = 0; i < totface; i++) {
+ for (a = 0, i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, drawSmooth;
int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
@@ -1824,7 +1890,7 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
numVerts = ccgSubSurf_getFaceNumVerts(f);
/* get flags */
- if(faceFlags) {
+ if (faceFlags) {
drawSmooth = (faceFlags[index].flag & ME_SMOOTH);
new_matnr= faceFlags[index].mat_nr + 1;
}
@@ -1834,13 +1900,13 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
}
/* material */
- if(new_matnr != matnr) {
+ if (new_matnr != matnr) {
setMaterial(userData, matnr = new_matnr, &gattribs);
DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
}
/* face hiding */
- if((setFace && (origIndex != ORIGINDEX_NONE) && !setFace(userData, origIndex))) {
+ if ((setFace && (origIndex != ORIGINDEX_NONE) && !setFace(userData, origIndex))) {
a += gridFaces*gridFaces*numVerts;
continue;
}
@@ -1866,7 +1932,7 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
glNormal3fv(vdb->no);
glVertex3fv(vdb->co);
- if(x != gridFaces-1)
+ if (x != gridFaces-1)
a++;
}
@@ -1885,7 +1951,8 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
a++;
}
- } else {
+ }
+ else {
glBegin(GL_QUADS);
for (y=0; y<gridFaces; y++) {
for (x=0; x<gridFaces; x++) {
@@ -1924,7 +1991,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
- MCol *mcol = dm->getTessFaceDataArray(dm, CD_WEIGHT_MCOL);
+ MCol *mcol = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
DMFlagMat *faceFlags = ccgdm->faceFlags;
DMDrawOption draw_option;
@@ -1935,14 +2002,14 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
ccgdm_pbvh_update(ccgdm);
- if(!mcol)
+ if (!mcol)
mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
- if(!mcol)
+ if (!mcol)
mcol = dm->getTessFaceDataArray(dm, CD_TEXTURE_MCOL);
totface = ccgSubSurf_getNumFaces(ss);
- for(i = 0; i < totface; i++) {
+ for (i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
int drawSmooth, index = ccgDM_getFaceMapIndex(ss, f);
@@ -1950,7 +2017,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
unsigned char *cp= NULL;
int mat_nr;
- if(faceFlags) {
+ if (faceFlags) {
drawSmooth = (faceFlags[origIndex].flag & ME_SMOOTH);
mat_nr= faceFlags[origIndex].mat_nr;
}
@@ -1959,7 +2026,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
mat_nr= 0;
}
- if(drawParams)
+ if (drawParams)
draw_option = drawParams(tf, (mcol != NULL), mat_nr);
else if (index != ORIGINDEX_NONE)
draw_option= (drawParamsMapped)? drawParamsMapped(userData, index): DM_DRAW_OPTION_NORMAL;
@@ -1968,14 +2035,14 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
if (draw_option == DM_DRAW_OPTION_SKIP) {
- if(tf) tf += gridFaces*gridFaces*numVerts;
- if(mcol) mcol += gridFaces*gridFaces*numVerts*4;
+ if (tf) tf += gridFaces*gridFaces*numVerts;
+ if (mcol) mcol += gridFaces*gridFaces*numVerts*4;
continue;
}
/* flag 1 == use vertex colors */
- if(mcol) {
- if(draw_option != DM_DRAW_OPTION_NO_MCOL)
+ if (mcol) {
+ if (draw_option != DM_DRAW_OPTION_NO_MCOL)
cp= (unsigned char*)mcol;
mcol += gridFaces*gridFaces*numVerts*4;
}
@@ -1992,41 +2059,42 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
a = &faceGridData[(y+0)*gridSize + x];
b = &faceGridData[(y+1)*gridSize + x];
- if(tf) glTexCoord2fv(tf->uv[0]);
- if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+ if (tf) glTexCoord2fv(tf->uv[0]);
+ if (cp) glColor3ub(cp[3], cp[2], cp[1]);
glNormal3fv(a->no);
glVertex3fv(a->co);
- if(tf) glTexCoord2fv(tf->uv[1]);
- if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+ if (tf) glTexCoord2fv(tf->uv[1]);
+ if (cp) glColor3ub(cp[7], cp[6], cp[5]);
glNormal3fv(b->no);
glVertex3fv(b->co);
- if(x != gridFaces-1) {
- if(tf) tf++;
- if(cp) cp += 16;
+ if (x != gridFaces-1) {
+ if (tf) tf++;
+ if (cp) cp += 16;
}
}
a = &faceGridData[(y+0)*gridSize + x];
b = &faceGridData[(y+1)*gridSize + x];
- if(tf) glTexCoord2fv(tf->uv[3]);
- if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+ if (tf) glTexCoord2fv(tf->uv[3]);
+ if (cp) glColor3ub(cp[15], cp[14], cp[13]);
glNormal3fv(a->no);
glVertex3fv(a->co);
- if(tf) glTexCoord2fv(tf->uv[2]);
- if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+ if (tf) glTexCoord2fv(tf->uv[2]);
+ if (cp) glColor3ub(cp[11], cp[10], cp[9]);
glNormal3fv(b->no);
glVertex3fv(b->co);
- if(tf) tf++;
- if(cp) cp += 16;
+ if (tf) tf++;
+ if (cp) cp += 16;
glEnd();
}
- } else {
+ }
+ else {
glShadeModel(GL_FLAT);
glBegin(GL_QUADS);
for (y=0; y<gridFaces; y++) {
@@ -2038,24 +2106,24 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
ccgDM_glNormalFast(a_co, b_co, c_co, d_co);
- if(tf) glTexCoord2fv(tf->uv[1]);
- if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+ if (tf) glTexCoord2fv(tf->uv[1]);
+ if (cp) glColor3ub(cp[7], cp[6], cp[5]);
glVertex3fv(d_co);
- if(tf) glTexCoord2fv(tf->uv[2]);
- if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+ if (tf) glTexCoord2fv(tf->uv[2]);
+ if (cp) glColor3ub(cp[11], cp[10], cp[9]);
glVertex3fv(c_co);
- if(tf) glTexCoord2fv(tf->uv[3]);
- if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+ if (tf) glTexCoord2fv(tf->uv[3]);
+ if (cp) glColor3ub(cp[15], cp[14], cp[13]);
glVertex3fv(b_co);
- if(tf) glTexCoord2fv(tf->uv[0]);
- if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+ if (tf) glTexCoord2fv(tf->uv[0]);
+ if (cp) glColor3ub(cp[3], cp[2], cp[1]);
glVertex3fv(a_co);
- if(tf) tf++;
- if(cp) cp += 16;
+ if (tf) tf++;
+ if (cp) cp += 16;
}
}
glEnd();
@@ -2089,18 +2157,19 @@ static void ccgDM_drawUVEdges(DerivedMesh *dm)
if (tf) {
glBegin(GL_LINES);
- for(i = 0; i < dm->numTessFaceData; i++, mf++, tf++) {
- if(!(mf->flag&ME_HIDE)) {
+ for (i = 0; i < dm->numTessFaceData; i++, mf++, tf++) {
+ if (!(mf->flag&ME_HIDE)) {
glVertex2fv(tf->uv[0]);
glVertex2fv(tf->uv[1]);
glVertex2fv(tf->uv[1]);
glVertex2fv(tf->uv[2]);
- if(!mf->v4) {
+ if (!mf->v4) {
glVertex2fv(tf->uv[2]);
glVertex2fv(tf->uv[0]);
- } else {
+ }
+ else {
glVertex2fv(tf->uv[2]);
glVertex2fv(tf->uv[3]);
@@ -2130,14 +2199,14 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
/* currently unused -- each original face is handled separately */
(void)compareDrawOptions;
- if(useColors) {
- mcol = dm->getTessFaceDataArray(dm, CD_WEIGHT_MCOL);
- if(!mcol)
+ if (useColors) {
+ mcol = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
+ if (!mcol)
mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
}
totface = ccgSubSurf_getNumFaces(ss);
- for(i = 0; i < totface; i++) {
+ for (i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
int drawSmooth, index = ccgDM_getFaceMapIndex(ss, f);
@@ -2146,11 +2215,11 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
- if(flag & DM_DRAW_ALWAYS_SMOOTH) drawSmooth = 1;
- else if(faceFlags) drawSmooth = (faceFlags[origIndex].flag & ME_SMOOTH);
+ if (flag & DM_DRAW_ALWAYS_SMOOTH) drawSmooth = 1;
+ else if (faceFlags) drawSmooth = (faceFlags[origIndex].flag & ME_SMOOTH);
else drawSmooth = 1;
- if(mcol) {
+ if (mcol) {
cp= (unsigned char*)mcol;
mcol += gridFaces*gridFaces*numVerts*4;
}
@@ -2158,7 +2227,7 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
{
DMDrawOption draw_option= DM_DRAW_OPTION_NORMAL;
- if(index == ORIGINDEX_NONE)
+ if (index == ORIGINDEX_NONE)
draw_option= setMaterial(faceFlags ? faceFlags[origIndex].mat_nr + 1: 1, NULL); /* XXX, no faceFlags no material */
else if (setDrawOptions)
draw_option= setDrawOptions(userData, index);
@@ -2183,33 +2252,34 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
a = &faceGridData[(y+0)*gridSize + x];
b = &faceGridData[(y+1)*gridSize + x];
- if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+ if (cp) glColor3ub(cp[3], cp[2], cp[1]);
glNormal3fv(a->no);
glVertex3fv(a->co);
- if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+ if (cp) glColor3ub(cp[7], cp[6], cp[5]);
glNormal3fv(b->no);
glVertex3fv(b->co);
- if(x != gridFaces-1) {
- if(cp) cp += 16;
+ if (x != gridFaces-1) {
+ if (cp) cp += 16;
}
}
a = &faceGridData[(y+0)*gridSize + x];
b = &faceGridData[(y+1)*gridSize + x];
- if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+ if (cp) glColor3ub(cp[15], cp[14], cp[13]);
glNormal3fv(a->no);
glVertex3fv(a->co);
- if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+ if (cp) glColor3ub(cp[11], cp[10], cp[9]);
glNormal3fv(b->no);
glVertex3fv(b->co);
- if(cp) cp += 16;
+ if (cp) cp += 16;
glEnd();
}
- } else {
+ }
+ else {
glBegin(GL_QUADS);
for (y=0; y<gridFaces; y++) {
for (x=0; x<gridFaces; x++) {
@@ -2220,16 +2290,16 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
ccgDM_glNormalFast(a, b, c, d);
- if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+ if (cp) glColor3ub(cp[7], cp[6], cp[5]);
glVertex3fv(d);
- if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+ if (cp) glColor3ub(cp[11], cp[10], cp[9]);
glVertex3fv(c);
- if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+ if (cp) glColor3ub(cp[15], cp[14], cp[13]);
glVertex3fv(b);
- if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+ if (cp) glColor3ub(cp[3], cp[2], cp[1]);
glVertex3fv(a);
- if(cp) cp += 16;
+ if (cp) cp += 16;
}
}
glEnd();
@@ -2339,28 +2409,40 @@ static void ccgDM_release(DerivedMesh *dm)
if (DM_release(dm)) {
/* Before freeing, need to update the displacement map */
- if(ccgdm->multires.modified) {
+ if (ccgdm->multires.modified_flags) {
/* Check that mmd still exists */
- if(!ccgdm->multires.local_mmd && BLI_findindex(&ccgdm->multires.ob->modifiers, ccgdm->multires.mmd) < 0)
+ if (!ccgdm->multires.local_mmd &&
+ BLI_findindex(&ccgdm->multires.ob->modifiers, ccgdm->multires.mmd) < 0)
ccgdm->multires.mmd = NULL;
- if(ccgdm->multires.mmd)
- ccgdm->multires.update(dm);
+
+ if (ccgdm->multires.mmd) {
+ if (ccgdm->multires.modified_flags & MULTIRES_COORDS_MODIFIED)
+ multires_modifier_update_mdisps(dm);
+ if (ccgdm->multires.modified_flags & MULTIRES_HIDDEN_MODIFIED)
+ multires_modifier_update_hidden(dm);
+ }
}
if (ccgdm->ehash)
BLI_edgehash_free(ccgdm->ehash, NULL);
- if(ccgdm->reverseFaceMap) MEM_freeN(ccgdm->reverseFaceMap);
- if(ccgdm->gridFaces) MEM_freeN(ccgdm->gridFaces);
- if(ccgdm->gridData) MEM_freeN(ccgdm->gridData);
- if(ccgdm->gridAdjacency) MEM_freeN(ccgdm->gridAdjacency);
- if(ccgdm->gridOffset) MEM_freeN(ccgdm->gridOffset);
- if(ccgdm->gridFlagMats) MEM_freeN(ccgdm->gridFlagMats);
- if(ccgdm->freeSS) ccgSubSurf_free(ccgdm->ss);
- if(ccgdm->fmap) MEM_freeN(ccgdm->fmap);
- if(ccgdm->fmap_mem) MEM_freeN(ccgdm->fmap_mem);
- if(ccgdm->pmap) MEM_freeN(ccgdm->pmap);
- if(ccgdm->pmap_mem) MEM_freeN(ccgdm->pmap_mem);
+ if (ccgdm->reverseFaceMap) MEM_freeN(ccgdm->reverseFaceMap);
+ if (ccgdm->gridFaces) MEM_freeN(ccgdm->gridFaces);
+ if (ccgdm->gridData) MEM_freeN(ccgdm->gridData);
+ if (ccgdm->gridAdjacency) MEM_freeN(ccgdm->gridAdjacency);
+ if (ccgdm->gridOffset) MEM_freeN(ccgdm->gridOffset);
+ if (ccgdm->gridFlagMats) MEM_freeN(ccgdm->gridFlagMats);
+ if (ccgdm->gridHidden) {
+ int i, numGrids = dm->getNumGrids(dm);
+ for (i = 0; i < numGrids; i++) {
+ if (ccgdm->gridHidden[i])
+ MEM_freeN(ccgdm->gridHidden[i]);
+ }
+ MEM_freeN(ccgdm->gridHidden);
+ }
+ if (ccgdm->freeSS) ccgSubSurf_free(ccgdm->ss);
+ if (ccgdm->pmap) MEM_freeN(ccgdm->pmap);
+ if (ccgdm->pmap_mem) MEM_freeN(ccgdm->pmap_mem);
MEM_freeN(ccgdm->edgeFlags);
MEM_freeN(ccgdm->faceFlags);
MEM_freeN(ccgdm->vertMap);
@@ -2372,7 +2454,7 @@ static void ccgDM_release(DerivedMesh *dm)
static void ccg_loops_to_corners(CustomData *fdata, CustomData *ldata,
CustomData *pdata, int loopstart, int findex, int polyindex,
- const int numTex, const int numCol, const int hasWCol, const int hasOrigSpace)
+ const int numTex, const int numCol, const int hasPCol, const int hasOrigSpace)
{
MTFace *texface;
MTexPoly *texpoly;
@@ -2381,7 +2463,7 @@ static void ccg_loops_to_corners(CustomData *fdata, CustomData *ldata,
MLoopUV *mloopuv;
int i, j;
- for(i=0; i < numTex; i++) {
+ for (i=0; i < numTex; i++) {
texface = CustomData_get_n(fdata, CD_MTFACE, findex, i);
texpoly = CustomData_get_n(pdata, CD_MTEXPOLY, polyindex, i);
@@ -2393,27 +2475,21 @@ static void ccg_loops_to_corners(CustomData *fdata, CustomData *ldata,
}
}
- for(i=0; i < numCol; i++) {
+ for (i=0; i < numCol; i++) {
mloopcol = CustomData_get_n(ldata, CD_MLOOPCOL, loopstart, i);
mcol = CustomData_get_n(fdata, CD_MCOL, findex, i);
for (j=0; j<4; j++, mloopcol++) {
- mcol[j].r = mloopcol->r;
- mcol[j].g = mloopcol->g;
- mcol[j].b = mloopcol->b;
- mcol[j].a = mloopcol->a;
+ MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
}
}
- if (hasWCol) {
- mloopcol = CustomData_get(ldata, loopstart, CD_WEIGHT_MLOOPCOL);
- mcol = CustomData_get(fdata, findex, CD_WEIGHT_MCOL);
+ if (hasPCol) {
+ mloopcol = CustomData_get(ldata, loopstart, CD_PREVIEW_MLOOPCOL);
+ mcol = CustomData_get(fdata, findex, CD_PREVIEW_MCOL);
for (j=0; j<4; j++, mloopcol++) {
- mcol[j].r = mloopcol->r;
- mcol[j].g = mloopcol->g;
- mcol[j].b = mloopcol->b;
- mcol[j].a = mloopcol->a;
+ MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
}
}
@@ -2430,7 +2506,7 @@ static void ccg_loops_to_corners(CustomData *fdata, CustomData *ldata,
static void *ccgDM_get_vert_data_layer(DerivedMesh *dm, int type)
{
- if(type == CD_ORIGINDEX) {
+ if (type == CD_ORIGINDEX) {
/* create origindex on demand to save memory */
CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
CCGSubSurf *ss= ccgdm->ss;
@@ -2450,10 +2526,10 @@ static void *ccgDM_get_vert_data_layer(DerivedMesh *dm, int type)
totnone= dm->numVertData - totorig;
/* original vertices are at the end */
- for(a=0; a<totnone; a++)
+ for (a=0; a<totnone; a++)
origindex[a]= ORIGINDEX_NONE;
- for(index=0; index<totorig; index++, a++) {
+ for (index=0; index<totorig; index++, a++) {
CCGVert *v = ccgdm->vertMap[index].vert;
origindex[a] = ccgDM_getVertMapIndex(ccgdm->ss, v);
}
@@ -2466,7 +2542,7 @@ static void *ccgDM_get_vert_data_layer(DerivedMesh *dm, int type)
static void *ccgDM_get_edge_data_layer(DerivedMesh *dm, int type)
{
- if(type == CD_ORIGINDEX) {
+ if (type == CD_ORIGINDEX) {
/* create origindex on demand to save memory */
CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
CCGSubSurf *ss= ccgdm->ss;
@@ -2488,14 +2564,14 @@ static void *ccgDM_get_edge_data_layer(DerivedMesh *dm, int type)
totnone= dm->numEdgeData - totorig;
/* original edges are at the end */
- for(a=0; a<totnone; a++)
+ for (a=0; a<totnone; a++)
origindex[a]= ORIGINDEX_NONE;
- for(index=0; index<totedge; index++) {
+ for (index=0; index<totedge; index++) {
CCGEdge *e= ccgdm->edgeMap[index].edge;
int mapIndex= ccgDM_getEdgeMapIndex(ss, e);
- for(i = 0; i < edgeSize - 1; i++, a++)
+ for (i = 0; i < edgeSize - 1; i++, a++)
origindex[a]= mapIndex;
}
@@ -2507,7 +2583,7 @@ static void *ccgDM_get_edge_data_layer(DerivedMesh *dm, int type)
static void *ccgDM_get_tessface_data_layer(DerivedMesh *dm, int type)
{
- if(type == CD_ORIGINDEX) {
+ if (type == CD_ORIGINDEX) {
/* create origindex on demand to save memory */
CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
CCGSubSurf *ss= ccgdm->ss;
@@ -2526,12 +2602,12 @@ static void *ccgDM_get_tessface_data_layer(DerivedMesh *dm, int type)
totface= ccgSubSurf_getNumFaces(ss);
- for(a=0, index=0; index<totface; index++) {
+ for (a=0, index=0; index<totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
int numVerts = ccgSubSurf_getFaceNumVerts(f);
int mapIndex = ccgDM_getFaceMapIndex(ss, f);
- for(i=0; i<gridFaces*gridFaces*numVerts; i++, a++)
+ for (i=0; i<gridFaces*gridFaces*numVerts; i++, a++)
origindex[a]= mapIndex;
}
@@ -2579,7 +2655,7 @@ static int ccgDM_getNumGrids(DerivedMesh *dm)
numFaces= ccgSubSurf_getNumFaces(ccgdm->ss);
numGrids= 0;
- for(index=0; index<numFaces; index++) {
+ for (index=0; index<numFaces; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
numGrids += ccgSubSurf_getFaceNumVerts(f);
}
@@ -2602,24 +2678,24 @@ static int ccgdm_adjacent_grid(int *gridOffset, CCGFace *f, int S, int offset)
e = ccgSubSurf_getFaceEdge(f, S);
numFaces = ccgSubSurf_getEdgeNumFaces(e);
- if(numFaces != 2)
+ if (numFaces != 2)
return -1;
- for(i = 0; i < numFaces; i++) {
+ for (i = 0; i < numFaces; i++) {
adjf = ccgSubSurf_getEdgeFace(e, i);
- if(adjf != f) {
+ if (adjf != f) {
numEdges = ccgSubSurf_getFaceNumVerts(adjf);
- for(j = 0; j < numEdges; j++)
- if(ccgSubSurf_getFaceEdge(adjf, j) == e)
+ for (j = 0; j < numEdges; j++)
+ if (ccgSubSurf_getFaceEdge(adjf, j) == e)
break;
- if(j != numEdges)
+ if (j != numEdges)
break;
}
}
- if(numEdges == 0)
+ if (numEdges == 0)
return -1;
fIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(adjf));
@@ -2638,7 +2714,7 @@ static void ccgdm_create_grids(DerivedMesh *dm)
int *gridOffset;
int index, numFaces, numGrids, S, gIndex /*, gridSize*/;
- if(ccgdm->gridData)
+ if (ccgdm->gridData)
return;
numGrids = ccgDM_getNumGrids(dm);
@@ -2648,7 +2724,7 @@ static void ccgdm_create_grids(DerivedMesh *dm)
/* compute offset into grid array for each face */
gridOffset = MEM_mallocN(sizeof(int)*numFaces, "ccgdm.gridOffset");
- for(gIndex = 0, index = 0; index < numFaces; index++) {
+ for (gIndex = 0, index = 0; index < numFaces; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
int numVerts = ccgSubSurf_getFaceNumVerts(f);
@@ -2662,11 +2738,13 @@ static void ccgdm_create_grids(DerivedMesh *dm)
gridFaces = MEM_mallocN(sizeof(CCGFace*)*numGrids, "ccgdm.gridFaces");
gridFlagMats = MEM_mallocN(sizeof(DMFlagMat)*numGrids, "ccgdm.gridFlagMats");
- for(gIndex = 0, index = 0; index < numFaces; index++) {
+ ccgdm->gridHidden = MEM_callocN(sizeof(BLI_bitmap)*numGrids, "ccgdm.gridHidden");
+
+ for (gIndex = 0, index = 0; index < numFaces; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
int numVerts = ccgSubSurf_getFaceNumVerts(f);
- for(S = 0; S < numVerts; S++, gIndex++) {
+ for (S = 0; S < numVerts; S++, gIndex++) {
int prevS = (S - 1 + numVerts) % numVerts;
int nextS = (S + 1 + numVerts) % numVerts;
@@ -2726,11 +2804,19 @@ static DMFlagMat *ccgDM_getGridFlagMats(DerivedMesh *dm)
return ccgdm->gridFlagMats;
}
-static ListBase *ccgDM_getPolyMap(Object *ob, DerivedMesh *dm)
+static BLI_bitmap *ccgDM_getGridHidden(DerivedMesh *dm)
{
CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+
+ ccgdm_create_grids(dm);
+ return ccgdm->gridHidden;
+}
- if(!ccgdm->multires.mmd && !ccgdm->pmap && ob->type == OB_MESH) {
+static const MeshElemMap *ccgDM_getPolyMap(Object *ob, DerivedMesh *dm)
+{
+ CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+
+ if (!ccgdm->multires.mmd && !ccgdm->pmap && ob->type == OB_MESH) {
Mesh *me= ob->data;
create_vert_poly_map(&ccgdm->pmap, &ccgdm->pmap_mem,
@@ -2747,7 +2833,7 @@ static int ccgDM_use_grid_pbvh(CCGDerivedMesh *ccgdm)
/* both of multires and subsurf modifiers are CCG, but
* grids should only be used when sculpting on multires */
- if(!mmd)
+ if (!mmd)
return 0;
return 1;
@@ -2758,18 +2844,18 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
int gridSize, numGrids, grid_pbvh;
- if(!ob) {
+ if (!ob) {
ccgdm->pbvh= NULL;
return NULL;
}
- if(!ob->sculpt)
+ if (!ob->sculpt)
return NULL;
grid_pbvh= ccgDM_use_grid_pbvh(ccgdm);
- if(ob->sculpt->pbvh) {
- if(grid_pbvh) {
+ if (ob->sculpt->pbvh) {
+ if (grid_pbvh) {
/* pbvh's grids, gridadj and gridfaces points to data inside ccgdm
* but this can be freed on ccgdm release, this updates the pointers
* when the ccgdm gets remade, the assumption is that the topology
@@ -2781,13 +2867,13 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
ccgdm->pbvh = ob->sculpt->pbvh;
}
- if(ccgdm->pbvh)
+ if (ccgdm->pbvh)
return ccgdm->pbvh;
/* no pbvh exists yet, we need to create one. only in case of multires
* we build a pbvh over the modified mesh, in other cases the base mesh
* is being sculpted, so we build a pbvh from that. */
- if(grid_pbvh) {
+ if (grid_pbvh) {
ccgdm_create_grids(dm);
gridSize = ccgDM_getGridSize(dm);
@@ -2795,8 +2881,9 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
ob->sculpt->pbvh= ccgdm->pbvh = BLI_pbvh_new();
BLI_pbvh_build_grids(ccgdm->pbvh, ccgdm->gridData, ccgdm->gridAdjacency,
- numGrids, gridSize, (void**)ccgdm->gridFaces, ccgdm->gridFlagMats);
- } else if(ob->type == OB_MESH) {
+ numGrids, gridSize, (void**)ccgdm->gridFaces, ccgdm->gridFlagMats, ccgdm->gridHidden);
+ }
+ else if (ob->type == OB_MESH) {
Mesh *me= ob->data;
ob->sculpt->pbvh= ccgdm->pbvh = BLI_pbvh_new();
BLI_assert(!(me->mface == NULL && me->mpoly != NULL)); /* BMESH ONLY complain if mpoly is valid but not mface */
@@ -2832,7 +2919,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
int *vertOrigIndex, *faceOrigIndex, *polyOrigIndex, *base_polyOrigIndex; /* *edgeOrigIndex - as yet, unused */
short *edgeFlags;
DMFlagMat *faceFlags;
- int *loopidx = NULL, *vertidx = NULL;
+ int *loopidx = NULL, *vertidx = NULL, *polyidx = NULL;
BLI_array_declare(loopidx);
BLI_array_declare(vertidx);
int loopindex, loopindex2;
@@ -2842,7 +2929,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
/*int gridSideVerts;*/
int gridSideEdges;
int numTex, numCol;
- int hasWCol, hasOrigSpace;
+ int hasPCol, hasOrigSpace;
int gridInternalEdges;
float *w = NULL;
WeightTable wtable = {0};
@@ -2860,12 +2947,13 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
numTex = CustomData_number_of_layers(&ccgdm->dm.loopData, CD_MLOOPUV);
numCol = CustomData_number_of_layers(&ccgdm->dm.loopData, CD_MLOOPCOL);
- hasWCol = CustomData_has_layer(&ccgdm->dm.loopData, CD_WEIGHT_MLOOPCOL);
+ hasPCol = CustomData_has_layer(&ccgdm->dm.loopData, CD_PREVIEW_MLOOPCOL);
hasOrigSpace = CustomData_has_layer(&ccgdm->dm.loopData, CD_ORIGSPACE_MLOOP);
if (
(numTex && CustomData_number_of_layers(&ccgdm->dm.faceData, CD_MTFACE) != numTex) ||
(numCol && CustomData_number_of_layers(&ccgdm->dm.faceData, CD_MCOL) != numCol) ||
+ (hasPCol && !CustomData_has_layer(&ccgdm->dm.faceData, CD_PREVIEW_MCOL)) ||
(hasOrigSpace && !CustomData_has_layer(&ccgdm->dm.faceData, CD_ORIGSPACE)) )
{
CustomData_from_bmeshpoly(&ccgdm->dm.faceData,
@@ -2874,6 +2962,10 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
ccgSubSurf_getNumFinalFaces(ss));
}
+ /* We absolutely need that layer, else it's no valid tessellated data! */
+ polyidx = CustomData_add_layer(&ccgdm->dm.faceData, CD_POLYINDEX, CD_CALLOC,
+ NULL, ccgSubSurf_getNumFinalFaces(ss));
+
ccgdm->dm.getMinMax = ccgDM_getMinMax;
ccgdm->dm.getNumVerts = ccgDM_getNumVerts;
ccgdm->dm.getNumEdges = ccgDM_getNumEdges;
@@ -2908,6 +3000,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
ccgdm->dm.getGridAdjacency = ccgDM_getGridAdjacency;
ccgdm->dm.getGridOffset = ccgDM_getGridOffset;
ccgdm->dm.getGridFlagMats = ccgDM_getGridFlagMats;
+ ccgdm->dm.getGridHidden = ccgDM_getGridHidden;
ccgdm->dm.getPolyMap = ccgDM_getPolyMap;
ccgdm->dm.getPBVH = ccgDM_getPBVH;
@@ -2948,7 +3041,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
totvert = ccgSubSurf_getNumVerts(ss);
ccgdm->vertMap = MEM_mallocN(totvert * sizeof(*ccgdm->vertMap), "vertMap");
vi = ccgSubSurf_getVertIterator(ss);
- for(; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) {
+ for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) {
CCGVert *v = ccgVertIterator_getCurrent(vi);
ccgdm->vertMap[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))].vert = v;
@@ -2958,7 +3051,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
totedge = ccgSubSurf_getNumEdges(ss);
ccgdm->edgeMap = MEM_mallocN(totedge * sizeof(*ccgdm->edgeMap), "edgeMap");
ei = ccgSubSurf_getEdgeIterator(ss);
- for(; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
+ for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
ccgdm->edgeMap[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))].edge = e;
@@ -2967,7 +3060,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
totface = ccgSubSurf_getNumFaces(ss);
ccgdm->faceMap = MEM_mallocN(totface * sizeof(*ccgdm->faceMap), "faceMap");
fi = ccgSubSurf_getFaceIterator(ss);
- for(; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
+ for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
ccgdm->faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))].face = f;
@@ -3007,7 +3100,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
#if 0
/* this is not in trunk, can gives problems because colors initialize
- * as black, just dont do it!, it works fine - campbell */
+ * as black, just don't do it!, it works fine - campbell */
if (!CustomData_has_layer(&ccgdm->dm.faceData, CD_MCOL))
DM_add_tessface_layer(&ccgdm->dm, CD_MCOL, CD_CALLOC, NULL);
mcol = DM_get_tessface_data_layer(&ccgdm->dm, CD_MCOL);
@@ -3067,8 +3160,8 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
++vertNum;
/*interpolate per-vert data*/
- for(s = 0; s < numVerts; s++) {
- for(x = 1; x < gridFaces; x++) {
+ for (s = 0; s < numVerts; s++) {
+ for (x = 1; x < gridFaces; x++) {
w2 = w + s*numVerts*g2_wid*g2_wid + x*numVerts;
DM_interp_vert_data(dm, &ccgdm->dm, vertidx, w2,
numVerts, vertNum);
@@ -3083,9 +3176,9 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
}
/*interpolate per-vert data*/
- for(s = 0; s < numVerts; s++) {
- for(y = 1; y < gridFaces; y++) {
- for(x = 1; x < gridFaces; x++) {
+ for (s = 0; s < numVerts; s++) {
+ for (y = 1; y < gridFaces; y++) {
+ for (x = 1; x < gridFaces; x++) {
w2 = w + s*numVerts*g2_wid*g2_wid + (y*g2_wid+x)*numVerts;
DM_interp_vert_data(dm, &ccgdm->dm, vertidx, w2,
numVerts, vertNum);
@@ -3101,7 +3194,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
}
if (has_edge_origindex) {
- for(i = 0; i < numFinalEdges; ++i)
+ for (i = 0; i < numFinalEdges; ++i)
*(int *)DM_get_edge_data(&ccgdm->dm, edgeNum + i,
CD_ORIGINDEX) = ORIGINDEX_NONE;
}
@@ -3133,10 +3226,10 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
/*copy over poly data, e.g. mtexpoly*/
CustomData_copy_data(&dm->polyData, &ccgdm->dm.polyData, origIndex, faceNum, 1);
- /*generate tesselated face data used for drawing*/
+ /*generate tessellated face data used for drawing*/
ccg_loops_to_corners(&ccgdm->dm.faceData, &ccgdm->dm.loopData,
&ccgdm->dm.polyData, loopindex2-4, faceNum, faceNum,
- numTex, numCol, hasWCol, hasOrigSpace);
+ numTex, numCol, hasPCol, hasOrigSpace);
/*set original index data*/
if (faceOrigIndex) {
@@ -3150,6 +3243,9 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
ccgdm->reverseFaceMap[faceNum] = index;
+ /* This is a simple one to one mapping, here... */
+ polyidx[faceNum] = faceNum;
+
faceNum++;
}
}
@@ -3158,7 +3254,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
edgeNum += numFinalEdges;
}
- for(index = 0; index < totedge; ++index) {
+ for (index = 0; index < totedge; ++index) {
CCGEdge *e = ccgdm->edgeMap[index].edge;
int numFinalEdges = edgeSize - 1;
int mapIndex = ccgDM_getEdgeMapIndex(ss, e);
@@ -3175,13 +3271,13 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
ccgdm->edgeMap[index].startVert = vertNum;
ccgdm->edgeMap[index].startEdge = edgeNum;
- if(edgeIdx >= 0 && edgeFlags)
+ if (edgeIdx >= 0 && edgeFlags)
edgeFlags[edgeIdx] = medge[edgeIdx].flag;
/* set the edge base vert */
*((int*)ccgSubSurf_getEdgeUserData(ss, e)) = vertNum;
- for(x = 1; x < edgeSize - 1; x++) {
+ for (x = 1; x < edgeSize - 1; x++) {
float w[2];
w[1] = (float) x / (edgeSize - 1);
w[0] = 1 - w[1];
@@ -3193,7 +3289,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
++vertNum;
}
- for(i = 0; i < numFinalEdges; ++i) {
+ for (i = 0; i < numFinalEdges; ++i) {
if (has_edge_origindex) {
*(int *)DM_get_edge_data(&ccgdm->dm, edgeNum + i,
CD_ORIGINDEX) = mapIndex;
@@ -3203,7 +3299,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
edgeNum += numFinalEdges;
}
- if(useSubsurfUv) {
+ if (useSubsurfUv) {
CustomData *ldata = &ccgdm->dm.loopData;
CustomData *dmldata = &dm->loopData;
int numlayer = CustomData_number_of_layers(ldata, CD_MLOOPUV);
@@ -3213,7 +3309,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
set_subsurf_uv(ss, dm, &ccgdm->dm, i);
}
- for(index = 0; index < totvert; ++index) {
+ for (index = 0; index < totvert; ++index) {
CCGVert *v = ccgdm->vertMap[index].vert;
int mapIndex = ccgDM_getVertMapIndex(ccgdm->ss, v);
int vertIdx;
@@ -3240,6 +3336,9 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
ccgdm->dm.numLoopData = loopindex2;
ccgdm->dm.numPolyData = faceNum;
+ /* All tessellated CD layers were updated! */
+ ccgdm->dm.dirty &= ~DM_DIRTY_TESS_CDLAYERS;
+
BLI_array_free(vertidx);
BLI_array_free(loopidx);
free_ss_weights(&wtable);
@@ -3261,7 +3360,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
int drawInteriorEdges = !(smd->flags & eSubsurfModifierFlag_ControlEdges);
CCGDerivedMesh *result;
- if(forEditMode) {
+ if (forEditMode) {
int levels= (smd->modifier.scene)? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels): smd->levels;
smd->emCache = _getSubSurf(smd->emCache, levels, useAging|CCG_CALC_NORMALS);
@@ -3270,12 +3369,13 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
result = getCCGDerivedMesh(smd->emCache,
drawInteriorEdges,
useSubsurfUv, dm);
- } else if(useRenderParams) {
+ }
+ else if (useRenderParams) {
/* Do not use cache in render mode. */
CCGSubSurf *ss;
int levels= (smd->modifier.scene)? get_render_subsurf_level(&smd->modifier.scene->r, smd->renderLevels): smd->renderLevels;
- if(levels == 0)
+ if (levels == 0)
return dm;
ss = _getSubSurf(NULL, levels, CCG_USE_ARENA|CCG_CALC_NORMALS);
@@ -3286,7 +3386,8 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
drawInteriorEdges, useSubsurfUv, dm);
result->freeSS = 1;
- } else {
+ }
+ else {
int useIncremental = (smd->flags & eSubsurfModifierFlag_Incremental);
int levels= (smd->modifier.scene)? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels): smd->levels;
CCGSubSurf *ss;
@@ -3302,12 +3403,12 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
* Addendum: we can't really ensure that this is never called in edit
* mode, so now we have a parameter to verify it. - brecht
*/
- if(!inEditMode && smd->emCache) {
+ if (!inEditMode && smd->emCache) {
ccgSubSurf_free(smd->emCache);
smd->emCache = NULL;
}
- if(useIncremental && isFinalCalc) {
+ if (useIncremental && isFinalCalc) {
smd->mCache = ss = _getSubSurf(smd->mCache, levels, useAging|CCG_CALC_NORMALS);
ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
@@ -3315,7 +3416,8 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
result = getCCGDerivedMesh(smd->mCache,
drawInteriorEdges,
useSubsurfUv, dm);
- } else {
+ }
+ else {
if (smd->mCache && isFinalCalc) {
ccgSubSurf_free(smd->mCache);
smd->mCache = NULL;
@@ -3326,7 +3428,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
result = getCCGDerivedMesh(ss, drawInteriorEdges, useSubsurfUv, dm);
- if(isFinalCalc)
+ if (isFinalCalc)
smd->mCache = ss;
else
result->freeSS = 1;
@@ -3373,7 +3475,7 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
/* ad-hoc correction for boundary vertices, to at least avoid them
* moving completely out of place (brecht) */
- if(numFaces && numFaces != N)
+ if (numFaces && numFaces != N)
mul_v3_fl(face_sum, (float)N/(float)numFaces);
co = ccgSubSurf_getVertData(ss, v);
@@ -3387,4 +3489,3 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
dm->release(dm);
}
-
diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c
index e1e872c42b6..8b3138066d3 100644
--- a/source/blender/blenkernel/intern/suggestions.c
+++ b/source/blender/blenkernel/intern/suggestions.c
@@ -132,7 +132,8 @@ void texttool_suggest_add(const char *name, char type)
/* Perform simple linear search for ordered storage */
if (!suggestions.first || !suggestions.last) {
suggestions.first = suggestions.last = newitem;
- } else {
+ }
+ else {
cmp = -1;
for (item=suggestions.last; item; item=item->prev) {
cmp = txttl_cmp(name, item->name, len);
@@ -182,7 +183,8 @@ void texttool_suggest_prefix(const char *prefix)
first = match;
suggestions.top = top;
}
- } else if (cmp<0) {
+ }
+ else if (cmp<0) {
if (!last) {
last = match->prev;
break;
@@ -195,7 +197,8 @@ void texttool_suggest_prefix(const char *prefix)
suggestions.firstmatch = first;
suggestions.lastmatch = last;
suggestions.selected = first;
- } else {
+ }
+ else {
suggestions.firstmatch = NULL;
suggestions.lastmatch = NULL;
suggestions.selected = NULL;
@@ -255,7 +258,8 @@ void texttool_docs_show(const char *docs)
documentation = MEM_mallocN(len+2, "Documentation");
strncpy(documentation, docs, len);
documentation[len++] = '\n';
- } else {
+ }
+ else {
documentation = MEM_mallocN(len+1, "Documentation");
strncpy(documentation, docs, len);
}
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 3f382cc5543..9715058c51f 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -44,6 +44,7 @@
#include "BLI_string_utf8.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLI_fileops.h"
#include "DNA_constraint_types.h"
#include "DNA_controller_types.h"
@@ -172,7 +173,7 @@ void free_text(Text *text)
BLI_freelistN(&text->lines);
BLI_freelistN(&text->markers);
- if(text->name) MEM_freeN(text->name);
+ if (text->name) MEM_freeN(text->name);
MEM_freeN(text->undo_buf);
#ifdef WITH_PYTHON
if (text->compiled) BPY_text_free_code(text);
@@ -194,7 +195,7 @@ Text *add_empty_text(const char *name)
ta->nlines=1;
ta->flags= TXT_ISDIRTY | TXT_ISMEM;
- if((U.flag & USER_TXT_TABSTOSPACES_DISABLE)==0)
+ if ((U.flag & USER_TXT_TABSTOSPACES_DISABLE)==0)
ta->flags |= TXT_TABSTOSPACES;
ta->lines.first= ta->lines.last= NULL;
@@ -228,7 +229,7 @@ int txt_extended_ascii_as_utf8(char **str)
int length = strlen(*str);
while ((*str)[i]) {
- if((bad_char= BLI_utf8_invalid_byte(*str+i, length-i)) == -1)
+ if ((bad_char= BLI_utf8_invalid_byte(*str+i, length-i)) == -1)
break;
added++;
@@ -241,7 +242,7 @@ int txt_extended_ascii_as_utf8(char **str)
i= 0;
while ((*str)[i]) {
- if((bad_char= BLI_utf8_invalid_byte((*str)+i, length-i)) == -1) {
+ if ((bad_char= BLI_utf8_invalid_byte((*str)+i, length-i)) == -1) {
memcpy(newstr+mi, (*str)+i, length - i + 1);
break;
}
@@ -291,8 +292,8 @@ int reopen_text(Text *text)
BLI_strncpy(str, text->name, FILE_MAX);
BLI_path_abs(str, G.main->name);
- fp= fopen(str, "r");
- if(fp==NULL) return 0;
+ fp= BLI_fopen(str, "r");
+ if (fp==NULL) return 0;
/* free memory: */
@@ -328,13 +329,13 @@ int reopen_text(Text *text)
text->nlines=0;
llen=0;
- for(i=0; i<len; i++) {
+ for (i=0; i<len; i++) {
if (buffer[i]=='\n') {
tmp= (TextLine*) MEM_mallocN(sizeof(TextLine), "textline");
tmp->line= (char*) MEM_mallocN(llen+1, "textline_string");
tmp->format= NULL;
- if(llen) memcpy(tmp->line, &buffer[i-llen], llen);
+ if (llen) memcpy(tmp->line, &buffer[i-llen], llen);
tmp->line[llen]=0;
tmp->len= llen;
@@ -354,7 +355,7 @@ int reopen_text(Text *text)
tmp->line= (char*) MEM_mallocN(llen+1, "textline_string");
tmp->format= NULL;
- if(llen) memcpy(tmp->line, &buffer[i-llen], llen);
+ if (llen) memcpy(tmp->line, &buffer[i-llen], llen);
tmp->line[llen]=0;
tmp->len= llen;
@@ -387,8 +388,8 @@ Text *add_text(const char *file, const char *relpath)
if (relpath) /* can be NULL (bg mode) */
BLI_path_abs(str, relpath);
- fp= fopen(str, "r");
- if(fp==NULL) return NULL;
+ fp= BLI_fopen(str, "r");
+ if (fp==NULL) return NULL;
ta= alloc_libblock(&bmain->text, ID_TXT, BLI_path_basename(str));
ta->id.us= 1;
@@ -397,7 +398,7 @@ Text *add_text(const char *file, const char *relpath)
ta->markers.first= ta->markers.last= NULL;
ta->curl= ta->sell= NULL;
- if((U.flag & USER_TXT_TABSTOSPACES_DISABLE)==0)
+ if ((U.flag & USER_TXT_TABSTOSPACES_DISABLE)==0)
ta->flags= TXT_TABSTOSPACES;
fseek(fp, 0L, SEEK_END);
@@ -421,13 +422,13 @@ Text *add_text(const char *file, const char *relpath)
ta->nlines=0;
llen=0;
- for(i=0; i<len; i++) {
+ for (i=0; i<len; i++) {
if (buffer[i]=='\n') {
tmp= (TextLine*) MEM_mallocN(sizeof(TextLine), "textline");
tmp->line= (char*) MEM_mallocN(llen+1, "textline_string");
tmp->format= NULL;
- if(llen) memcpy(tmp->line, &buffer[i-llen], llen);
+ if (llen) memcpy(tmp->line, &buffer[i-llen], llen);
tmp->line[llen]=0;
tmp->len= llen;
@@ -453,7 +454,7 @@ Text *add_text(const char *file, const char *relpath)
tmp->line= (char*) MEM_mallocN(llen+1, "textline_string");
tmp->format= NULL;
- if(llen) memcpy(tmp->line, &buffer[i-llen], llen);
+ if (llen) memcpy(tmp->line, &buffer[i-llen], llen);
tmp->line[llen]=0;
tmp->len= llen;
@@ -480,7 +481,7 @@ Text *copy_text(Text *ta)
tan= copy_libblock(&ta->id);
/* file name can be NULL */
- if(ta->name) {
+ if (ta->name) {
tan->name= MEM_mallocN(strlen(ta->name)+1, "text_name");
strcpy(tan->name, ta->name);
}
@@ -530,25 +531,25 @@ void unlink_text(Main *bmain, Text *text)
bConstraint *con;
short update;
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
/* game controllers */
- for(cont=ob->controllers.first; cont; cont=cont->next) {
- if(cont->type==CONT_PYTHON) {
+ for (cont=ob->controllers.first; cont; cont=cont->next) {
+ if (cont->type==CONT_PYTHON) {
bPythonCont *pc;
pc= cont->data;
- if(pc->text==text) pc->text= NULL;
+ if (pc->text==text) pc->text= NULL;
}
}
/* pyconstraints */
update = 0;
- if(ob->type==OB_ARMATURE && ob->pose) {
+ if (ob->type==OB_ARMATURE && ob->pose) {
bPoseChannel *pchan;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- for(con = pchan->constraints.first; con; con=con->next) {
- if(con->type==CONSTRAINT_TYPE_PYTHON) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (con = pchan->constraints.first; con; con=con->next) {
+ if (con->type==CONSTRAINT_TYPE_PYTHON) {
bPythonConstraint *data = con->data;
if (data->text==text) data->text = NULL;
update = 1;
@@ -558,15 +559,15 @@ void unlink_text(Main *bmain, Text *text)
}
}
- for(con = ob->constraints.first; con; con=con->next) {
- if(con->type==CONSTRAINT_TYPE_PYTHON) {
+ for (con = ob->constraints.first; con; con=con->next) {
+ if (con->type==CONSTRAINT_TYPE_PYTHON) {
bPythonConstraint *data = con->data;
if (data->text==text) data->text = NULL;
update = 1;
}
}
- if(update)
+ if (update)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
@@ -574,13 +575,13 @@ void unlink_text(Main *bmain, Text *text)
// XXX nodeDynamicUnlinkText(&text->id);
/* text space */
- for(scr= bmain->screen.first; scr; scr= scr->id.next) {
- for(area= scr->areabase.first; area; area= area->next) {
- for(sl= area->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_TEXT) {
+ for (scr= bmain->screen.first; scr; scr= scr->id.next) {
+ for (area= scr->areabase.first; area; area= area->next) {
+ for (sl= area->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_TEXT) {
SpaceText *st= (SpaceText*) sl;
- if(st->text==text) {
+ if (st->text==text) {
st->text= NULL;
st->top= 0;
}
@@ -600,7 +601,7 @@ void clear_text(Text *text) /* called directly from rna */
txt_set_undostate( 1 );
txt_sel_all( text );
txt_delete_sel(text);
- txt_set_undostate( oldstate );
+ txt_set_undostate(oldstate);
txt_make_dirty(text);
}
@@ -609,10 +610,10 @@ void write_text(Text *text, const char *str) /* called directly from rna */
{
int oldstate;
- oldstate = txt_get_undostate( );
- txt_insert_buf( text, str );
- txt_move_eof( text, 0 );
- txt_set_undostate( oldstate );
+ oldstate = txt_get_undostate();
+ txt_insert_buf(text, str);
+ txt_move_eof(text, 0);
+ txt_set_undostate(oldstate);
txt_make_dirty(text);
}
@@ -635,7 +636,7 @@ static TextLine *txt_new_line(const char *str)
{
TextLine *tmp;
- if(!str) str= "";
+ if (!str) str= "";
tmp= (TextLine *) MEM_mallocN(sizeof(TextLine), "textline");
tmp->line= MEM_mallocN(strlen(str)+1, "textline_string");
@@ -684,13 +685,13 @@ void txt_clean_text (Text *text)
while ((*top)->prev) *top= (*top)->prev;
while ((*bot)->next) *bot= (*bot)->next;
- if(!text->curl) {
- if(text->sell) text->curl= text->sell;
+ if (!text->curl) {
+ if (text->sell) text->curl= text->sell;
else text->curl= text->lines.first;
text->curc= 0;
}
- if(!text->sell) {
+ if (!text->sell) {
text->sell= text->curl;
text->selc= 0;
}
@@ -715,12 +716,12 @@ int txt_get_span (TextLine *from, TextLine *to)
if (!tmp) {
tmp= from;
ret=0;
- while(tmp) {
+ while (tmp) {
if (tmp == to) break;
ret--;
tmp= tmp->prev;
}
- if(!tmp) ret=0;
+ if (!tmp) ret=0;
}
return ret;
@@ -754,10 +755,12 @@ static void txt_curs_first (Text *text, TextLine **linep, int *charp)
*linep= text->curl;
if (text->curc<text->selc) *charp= text->curc;
else *charp= text->selc;
- } else if (txt_get_span(text->lines.first, text->curl)<txt_get_span(text->lines.first, text->sell)) {
+ }
+ else if (txt_get_span(text->lines.first, text->curl)<txt_get_span(text->lines.first, text->sell)) {
*linep= text->curl;
*charp= text->curc;
- } else {
+ }
+ else {
*linep= text->sell;
*charp= text->selc;
}
@@ -807,24 +810,25 @@ void txt_move_up(Text *text, short sel)
/* int old; */ /* UNUSED */
if (!text) return;
- if(sel) txt_curs_sel(text, &linep, &charp);
+ if (sel) txt_curs_sel(text, &linep, &charp);
else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); }
if (!*linep) return;
/* old= *charp; */ /* UNUSED */
- if((*linep)->prev) {
+ if ((*linep)->prev) {
int index = txt_utf8_offset_to_index((*linep)->line, *charp);
*linep= (*linep)->prev;
if (index > txt_utf8_len((*linep)->line)) *charp= (*linep)->len;
else *charp= txt_utf8_index_to_offset((*linep)->line, index);
- if(!undoing)
+ if (!undoing)
txt_undo_add_op(text, sel?UNDO_SUP:UNDO_CUP);
- } else {
+ }
+ else {
txt_move_bol(text, sel);
}
- if(!sel) txt_pop_sel(text);
+ if (!sel) txt_pop_sel(text);
}
void txt_move_down(Text *text, short sel)
@@ -834,24 +838,25 @@ void txt_move_down(Text *text, short sel)
/* int old; */ /* UNUSED */
if (!text) return;
- if(sel) txt_curs_sel(text, &linep, &charp);
+ if (sel) txt_curs_sel(text, &linep, &charp);
else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
if (!*linep) return;
/* old= *charp; */ /* UNUSED */
- if((*linep)->next) {
+ if ((*linep)->next) {
int index = txt_utf8_offset_to_index((*linep)->line, *charp);
*linep= (*linep)->next;
if (index > txt_utf8_len((*linep)->line)) *charp= (*linep)->len;
else *charp= txt_utf8_index_to_offset((*linep)->line, index);
- if(!undoing)
+ if (!undoing)
txt_undo_add_op(text, sel?UNDO_SDOWN:UNDO_CDOWN);
- } else {
+ }
+ else {
txt_move_eol(text, sel);
}
- if(!sel) txt_pop_sel(text);
+ if (!sel) txt_pop_sel(text);
}
void txt_move_left(Text *text, short sel)
@@ -861,7 +866,7 @@ void txt_move_left(Text *text, short sel)
int tabsize= 0, i= 0;
if (!text) return;
- if(sel) txt_curs_sel(text, &linep, &charp);
+ if (sel) txt_curs_sel(text, &linep, &charp);
else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); }
if (!*linep) return;
@@ -899,9 +904,9 @@ void txt_move_left(Text *text, short sel)
}
undoing= oundoing;
- if(!undoing) txt_undo_add_op(text, sel?UNDO_SLEFT:UNDO_CLEFT);
+ if (!undoing) txt_undo_add_op(text, sel?UNDO_SLEFT:UNDO_CLEFT);
- if(!sel) txt_pop_sel(text);
+ if (!sel) txt_pop_sel(text);
}
void txt_move_right(Text *text, short sel)
@@ -910,7 +915,7 @@ void txt_move_right(Text *text, short sel)
int *charp, oundoing= undoing, do_tab= 0, i;
if (!text) return;
- if(sel) txt_curs_sel(text, &linep, &charp);
+ if (sel) txt_curs_sel(text, &linep, &charp);
else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
if (!*linep) return;
@@ -944,9 +949,9 @@ void txt_move_right(Text *text, short sel)
}
undoing= oundoing;
- if(!undoing) txt_undo_add_op(text, sel?UNDO_SRIGHT:UNDO_CRIGHT);
+ if (!undoing) txt_undo_add_op(text, sel?UNDO_SRIGHT:UNDO_CRIGHT);
- if(!sel) txt_pop_sel(text);
+ if (!sel) txt_pop_sel(text);
}
void txt_jump_left(Text *text, short sel)
@@ -957,7 +962,7 @@ void txt_jump_left(Text *text, short sel)
int pos;
if (!text) return;
- if(sel) txt_curs_sel(text, &linep, &charp);
+ if (sel) txt_curs_sel(text, &linep, &charp);
else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); }
if (!*linep) return;
@@ -980,7 +985,7 @@ void txt_jump_left(Text *text, short sel)
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);
+ 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)
@@ -991,7 +996,7 @@ void txt_jump_right(Text *text, short sel)
int pos;
if (!text) return;
- if(sel) txt_curs_sel(text, &linep, &charp);
+ if (sel) txt_curs_sel(text, &linep, &charp);
else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
if (!*linep) return;
@@ -1014,7 +1019,7 @@ void txt_jump_right(Text *text, short sel)
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);
+ 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)
@@ -1023,15 +1028,15 @@ void txt_move_bol (Text *text, short sel)
int *charp, old;
if (!text) return;
- if(sel) txt_curs_sel(text, &linep, &charp);
+ if (sel) txt_curs_sel(text, &linep, &charp);
else txt_curs_cur(text, &linep, &charp);
if (!*linep) return;
old= *charp;
*charp= 0;
- if(!sel) txt_pop_sel(text);
- if(!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
+ if (!sel) txt_pop_sel(text);
+ if (!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
}
void txt_move_eol (Text *text, short sel)
@@ -1040,15 +1045,15 @@ void txt_move_eol (Text *text, short sel)
int *charp, old;
if (!text) return;
- if(sel) txt_curs_sel(text, &linep, &charp);
+ if (sel) txt_curs_sel(text, &linep, &charp);
else txt_curs_cur(text, &linep, &charp);
if (!*linep) return;
old= *charp;
*charp= (*linep)->len;
- if(!sel) txt_pop_sel(text);
- if(!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
+ if (!sel) txt_pop_sel(text);
+ if (!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
}
void txt_move_bof (Text *text, short sel)
@@ -1057,7 +1062,7 @@ void txt_move_bof (Text *text, short sel)
int *charp, old;
if (!text) return;
- if(sel) txt_curs_sel(text, &linep, &charp);
+ if (sel) txt_curs_sel(text, &linep, &charp);
else txt_curs_cur(text, &linep, &charp);
if (!*linep) return;
old= *charp;
@@ -1065,8 +1070,8 @@ void txt_move_bof (Text *text, short sel)
*linep= text->lines.first;
*charp= 0;
- if(!sel) txt_pop_sel(text);
- if(!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
+ if (!sel) txt_pop_sel(text);
+ if (!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
}
void txt_move_eof (Text *text, short sel)
@@ -1075,7 +1080,7 @@ void txt_move_eof (Text *text, short sel)
int *charp, old;
if (!text) return;
- if(sel) txt_curs_sel(text, &linep, &charp);
+ if (sel) txt_curs_sel(text, &linep, &charp);
else txt_curs_cur(text, &linep, &charp);
if (!*linep) return;
old= *charp;
@@ -1083,8 +1088,8 @@ void txt_move_eof (Text *text, short sel)
*linep= text->lines.last;
*charp= (*linep)->len;
- if(!sel) txt_pop_sel(text);
- if(!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
+ if (!sel) txt_pop_sel(text);
+ if (!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
}
void txt_move_toline (Text *text, unsigned int line, short sel)
@@ -1100,7 +1105,7 @@ void txt_move_to (Text *text, unsigned int line, unsigned int ch, short sel)
unsigned int i;
if (!text) return;
- if(sel) txt_curs_sel(text, &linep, &charp);
+ if (sel) txt_curs_sel(text, &linep, &charp);
else txt_curs_cur(text, &linep, &charp);
if (!*linep) return;
oldc= *charp;
@@ -1115,8 +1120,8 @@ void txt_move_to (Text *text, unsigned int line, unsigned int ch, short sel)
ch= (unsigned int)((*linep)->len);
*charp= ch;
- if(!sel) txt_pop_sel(text);
- 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);
+ if (!sel) txt_pop_sel(text);
+ 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);
}
/****************************/
@@ -1136,7 +1141,7 @@ static void txt_curs_swap (Text *text)
text->curc= text->selc;
text->selc= tmpc;
- if(!undoing) txt_undo_add_op(text, UNDO_SWAP);
+ if (!undoing) txt_undo_add_op(text, UNDO_SWAP);
}
static void txt_pop_first (Text *text)
@@ -1147,7 +1152,7 @@ static void txt_pop_first (Text *text)
txt_curs_swap(text);
}
- if(!undoing) txt_undo_add_toop(text, UNDO_STO,
+ if (!undoing) txt_undo_add_toop(text, UNDO_STO,
txt_get_span(text->lines.first, text->sell),
text->selc,
txt_get_span(text->lines.first, text->curl),
@@ -1163,7 +1168,7 @@ static void txt_pop_last (Text *text)
txt_curs_swap(text);
}
- if(!undoing) txt_undo_add_toop(text, UNDO_STO,
+ if (!undoing) txt_undo_add_toop(text, UNDO_STO,
txt_get_span(text->lines.first, text->sell),
text->selc,
txt_get_span(text->lines.first, text->curl),
@@ -1213,7 +1218,7 @@ static void txt_delete_sel (Text *text)
txt_order_cursors(text);
- if(!undoing) {
+ if (!undoing) {
buf= txt_sel_to_buf(text);
txt_undo_add_block(text, UNDO_DBLOCK, buf);
MEM_freeN(buf);
@@ -1224,7 +1229,8 @@ static void txt_delete_sel (Text *text)
if (text->curl != text->sell) {
txt_clear_marker_region(text, text->curl, text->curc, text->curl->len, 0, 0);
move= txt_get_span(text->curl, text->sell);
- } else {
+ }
+ else {
mrk= txt_find_marker_region(text, text->curl, text->curc, text->selc, 0, 0);
if (mrk && (mrk->start > text->curc || mrk->end < text->selc))
txt_clear_marker_region(text, text->curl, text->curc, text->selc, 0, 0);
@@ -1310,7 +1316,8 @@ char *txt_to_buf (Text *text)
BLI_strncpy(buf, linef->line + charf, length+1);
buf[length]=0;
- } else {
+ }
+ else {
length= linef->len - charf;
length+= charl;
length+= 2; /* For the 2 '\n' */
@@ -1359,7 +1366,7 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
tl= startl= text->sell;
- if(match_case) s= strstr(&tl->line[text->selc], findstr);
+ if (match_case) s= strstr(&tl->line[text->selc], findstr);
else s= BLI_strcasestr(&tl->line[text->selc], findstr);
while (!s) {
tl= tl->next;
@@ -1370,7 +1377,7 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
break;
}
- if(match_case) s= strstr(tl->line, findstr);
+ if (match_case) s= strstr(tl->line, findstr);
else s= BLI_strcasestr(tl->line, findstr);
if (tl==startl)
break;
@@ -1382,7 +1389,8 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
txt_move_to(text, newl, newc, 0);
txt_move_to(text, newl, newc + strlen(findstr), 1);
return 1;
- } else
+ }
+ else
return 0;
}
@@ -1403,17 +1411,20 @@ char *txt_sel_to_buf (Text *text)
if (text->curc < text->selc) {
charf= text->curc;
charl= text->selc;
- } else{
+ }
+ else {
charf= text->selc;
charl= text->curc;
}
- } else if (txt_get_span(text->curl, text->sell)<0) {
+ }
+ else if (txt_get_span(text->curl, text->sell)<0) {
linef= text->sell;
linel= text->curl;
charf= text->selc;
charl= text->curc;
- } else {
+ }
+ else {
linef= text->curl;
linel= text->sell;
@@ -1427,7 +1438,8 @@ char *txt_sel_to_buf (Text *text)
buf= MEM_mallocN(length+1, "sel buffer");
BLI_strncpy(buf, linef->line + charf, length+1);
- } else {
+ }
+ else {
length+= linef->len - charf;
length+= charl;
length++; /* For the '\n' */
@@ -1489,7 +1501,7 @@ void txt_insert_buf(Text *text, const char *in_buffer)
buffer= BLI_strdupn(in_buffer, len);
len+= txt_extended_ascii_as_utf8(&buffer);
- if(!undoing) txt_undo_add_block(text, UNDO_IBLOCK, buffer);
+ if (!undoing) txt_undo_add_block(text, UNDO_IBLOCK, buffer);
u= undoing;
undoing= 1;
@@ -1512,13 +1524,14 @@ void txt_insert_buf(Text *text, const char *in_buffer)
i++; l++;
}
- if(buffer[i]=='\n') {
+ if (buffer[i]=='\n') {
add= txt_new_linen(buffer +(i-l), l);
BLI_insertlinkbefore(&text->lines, text->curl, add);
i++;
count++;
- } else {
- if(count) {
+ }
+ else {
+ if (count) {
txt_shift_markers(text, lineno, count);
count= 0;
}
@@ -1531,7 +1544,7 @@ void txt_insert_buf(Text *text, const char *in_buffer)
MEM_freeN(buffer);
- if(count) {
+ if (count) {
txt_shift_markers(text, lineno, count);
}
@@ -1545,12 +1558,13 @@ void txt_insert_buf(Text *text, const char *in_buffer)
static int max_undo_test(Text *text, int x)
{
while (text->undo_pos+x >= text->undo_len) {
- if(text->undo_len*2 > TXT_MAX_UNDO) {
+ if (text->undo_len*2 > TXT_MAX_UNDO) {
/* XXX error("Undo limit reached, buffer cleared\n"); */
MEM_freeN(text->undo_buf);
init_undo_text(text);
return 0;
- } else {
+ }
+ else {
void *tmp= text->undo_buf;
text->undo_buf= MEM_callocN(text->undo_len*2, "undo buf");
memcpy(text->undo_buf, tmp, text->undo_len);
@@ -1587,63 +1601,92 @@ void txt_print_undo(Text *text)
if (op==UNDO_CLEFT) {
ops= "Cursor left";
- } else if (op==UNDO_CRIGHT) {
+ }
+ else if (op==UNDO_CRIGHT) {
ops= "Cursor right";
- } else if (op==UNDO_CUP) {
+ }
+ else if (op==UNDO_CUP) {
ops= "Cursor up";
- } else if (op==UNDO_CDOWN) {
+ }
+ else if (op==UNDO_CDOWN) {
ops= "Cursor down";
- } else if (op==UNDO_SLEFT) {
+ }
+ else if (op==UNDO_SLEFT) {
ops= "Selection left";
- } else if (op==UNDO_SRIGHT) {
+ }
+ else if (op==UNDO_SRIGHT) {
ops= "Selection right";
- } else if (op==UNDO_SUP) {
+ }
+ else if (op==UNDO_SUP) {
ops= "Selection up";
- } else if (op==UNDO_SDOWN) {
+ }
+ else if (op==UNDO_SDOWN) {
ops= "Selection down";
- } else if (op==UNDO_STO) {
+ }
+ else if (op==UNDO_STO) {
ops= "Selection ";
- } else if (op==UNDO_CTO) {
+ }
+ else if (op==UNDO_CTO) {
ops= "Cursor ";
- } else if (op==UNDO_INSERT_1) {
+ }
+ else if (op==UNDO_INSERT_1) {
ops= "Insert ascii ";
- } else if (op==UNDO_INSERT_2) {
+ }
+ else if (op==UNDO_INSERT_2) {
ops= "Insert 2 bytes ";
- } else if (op==UNDO_INSERT_3) {
+ }
+ else if (op==UNDO_INSERT_3) {
ops= "Insert 3 bytes ";
- } else if (op==UNDO_INSERT_4) {
+ }
+ else if (op==UNDO_INSERT_4) {
ops= "Insert unicode ";
- } else if (op==UNDO_BS_1) {
+ }
+ else if (op==UNDO_BS_1) {
ops= "Backspace for ascii ";
- } else if (op==UNDO_BS_2) {
+ }
+ else if (op==UNDO_BS_2) {
ops= "Backspace for 2 bytes ";
- } else if (op==UNDO_BS_3) {
+ }
+ else if (op==UNDO_BS_3) {
ops= "Backspace for 3 bytes ";
- } else if (op==UNDO_BS_4) {
+ }
+ else if (op==UNDO_BS_4) {
ops= "Backspace for unicode ";
- } else if (op==UNDO_DEL_1) {
+ }
+ else if (op==UNDO_DEL_1) {
ops= "Delete ascii ";
- } else if (op==UNDO_DEL_2) {
+ }
+ else if (op==UNDO_DEL_2) {
ops= "Delete 2 bytes ";
- } else if (op==UNDO_DEL_3) {
+ }
+ else if (op==UNDO_DEL_3) {
ops= "Delete 3 bytes ";
- } else if (op==UNDO_DEL_4) {
+ }
+ else if (op==UNDO_DEL_4) {
ops= "Delete unicode ";
- } else if (op==UNDO_SWAP) {
+ }
+ else if (op==UNDO_SWAP) {
ops= "Cursor swap";
- } else if (op==UNDO_DBLOCK) {
+ }
+ else if (op==UNDO_DBLOCK) {
ops= "Delete text block";
- } else if (op==UNDO_IBLOCK) {
+ }
+ else if (op==UNDO_IBLOCK) {
ops= "Insert text block";
- } else if (op==UNDO_INDENT) {
+ }
+ else if (op==UNDO_INDENT) {
ops= "Indent ";
- } else if (op==UNDO_UNINDENT) {
+ }
+ else if (op==UNDO_UNINDENT) {
ops= "Unindent ";
- } else if (op==UNDO_COMMENT) {
+ }
+ else if (op==UNDO_COMMENT) {
ops= "Comment ";
- } else if (op==UNDO_UNCOMMENT) {
+ }
+ else if (op==UNDO_UNCOMMENT) {
ops= "Uncomment ";
- } else {
+ }
+ else {
ops= "Unknown";
}
@@ -1674,10 +1717,11 @@ void txt_print_undo(Text *text)
uc= uc+(text->undo_buf[i]<<24); i++;
c_len= BLI_str_utf8_from_unicode(uc, c);
c[c_len]= '\0';
- printf ("%s", c);
+ puts(c);
}
}
- } else if (op==UNDO_STO || op==UNDO_CTO) {
+ }
+ else if (op==UNDO_STO || op==UNDO_CTO) {
i++;
charp= text->undo_buf[i]; i++;
@@ -1699,7 +1743,8 @@ void txt_print_undo(Text *text)
linep= linep+(text->undo_buf[i]<<24); i++;
printf ("from <%d, %d>", linep, charp);
- } else if (op==UNDO_DBLOCK || op==UNDO_IBLOCK) {
+ }
+ else if (op==UNDO_DBLOCK || op==UNDO_IBLOCK) {
i++;
linep= text->undo_buf[i]; i++;
@@ -1719,7 +1764,8 @@ void txt_print_undo(Text *text)
linep= linep+(text->undo_buf[i]<<16); i++;
linep= linep+(text->undo_buf[i]<<24); i++;
printf ("> (%d)", linep);
- } else if (op==UNDO_INDENT || op==UNDO_UNINDENT) {
+ }
+ else if (op==UNDO_INDENT || op==UNDO_UNINDENT) {
i++;
charp= text->undo_buf[i]; i++;
@@ -1750,7 +1796,7 @@ void txt_print_undo(Text *text)
static void txt_undo_add_op(Text *text, int op)
{
- if(!max_undo_test(text, 2))
+ if (!max_undo_test(text, 2))
return;
text->undo_pos++;
@@ -1782,7 +1828,7 @@ static void txt_undo_add_block(Text *text, int op, const char *buf)
{
unsigned int length= strlen(buf);
- if(!max_undo_test(text, length+11))
+ if (!max_undo_test(text, length+11))
return;
text->undo_pos++;
@@ -1802,7 +1848,7 @@ static void txt_undo_add_block(Text *text, int op, const char *buf)
void txt_undo_add_toop(Text *text, int op, unsigned int froml, unsigned short fromc, unsigned int tol, unsigned short toc)
{
- if(!max_undo_test(text, 15))
+ if (!max_undo_test(text, 15))
return;
if (froml==tol && fromc==toc) return;
@@ -1827,7 +1873,7 @@ static void txt_undo_add_charop(Text *text, int op_start, unsigned int c)
char utf8[BLI_UTF8_MAX];
size_t i, utf8_size = BLI_str_utf8_from_unicode(c, utf8);
- if(!max_undo_test(text, 3 + utf8_size))
+ if (!max_undo_test(text, 3 + utf8_size))
return;
text->undo_pos++;
@@ -1842,7 +1888,8 @@ static void txt_undo_add_charop(Text *text, int op_start, unsigned int c)
}
text->undo_buf[text->undo_pos]= op_start + utf8_size - 1;
- } else {
+ }
+ else {
text->undo_buf[text->undo_pos]= op_start + 3;
text->undo_pos++;
txt_undo_store_uint32(text->undo_buf, &text->undo_pos, c);
@@ -2021,7 +2068,8 @@ void txt_do_undo(Text *text)
txt_move_toline(text, linep, 0);
text->curc= charp;
txt_pop_sel(text);
- } else {
+ }
+ else {
txt_move_toline(text, linep, 1);
text->selc= charp;
}
@@ -2070,7 +2118,7 @@ void txt_do_undo(Text *text)
text->curl= text->lines.first;
while (holdln>0) {
- if(text->curl->next)
+ if (text->curl->next)
text->curl= text->curl->next;
holdln--;
@@ -2144,11 +2192,14 @@ void txt_do_undo(Text *text)
if (op==UNDO_INDENT) {
txt_unindent(text);
- } else if (op== UNDO_UNINDENT) {
+ }
+ else if (op== UNDO_UNINDENT) {
txt_indent(text);
- } else if (op == UNDO_COMMENT) {
+ }
+ else if (op == UNDO_COMMENT) {
txt_uncomment(text);
- } else if (op == UNDO_UNCOMMENT) {
+ }
+ else if (op == UNDO_UNCOMMENT) {
txt_comment(text);
}
@@ -2269,7 +2320,8 @@ void txt_do_redo(Text *text)
txt_move_toline(text, linep, 0);
text->curc= charp;
txt_pop_sel(text);
- } else {
+ }
+ else {
txt_move_toline(text, linep, 1);
text->selc= charp;
}
@@ -2339,11 +2391,14 @@ void txt_do_redo(Text *text)
if (op==UNDO_INDENT) {
txt_indent(text);
- } else if (op== UNDO_UNINDENT) {
+ }
+ else if (op== UNDO_UNINDENT) {
txt_unindent(text);
- } else if (op == UNDO_COMMENT) {
+ }
+ else if (op == UNDO_COMMENT) {
txt_comment(text);
- } else if (op == UNDO_UNCOMMENT) {
+ }
+ else if (op == UNDO_UNCOMMENT) {
txt_uncomment(text);
}
break;
@@ -2382,7 +2437,8 @@ void txt_split_curline (Text *text)
mrk->lineno++;
mrk->start -= text->curc;
mrk->end -= text->curc;
- } else if (mrk->lineno > lineno) {
+ }
+ else if (mrk->lineno > lineno) {
mrk->lineno++;
}
mrk= mrk->next;
@@ -2419,7 +2475,7 @@ void txt_split_curline (Text *text)
txt_clean_text(text);
txt_pop_sel(text);
- if(!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, '\n');
+ if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, '\n');
}
static void txt_delete_line (Text *text, TextLine *line)
@@ -2460,7 +2516,7 @@ static void txt_combine_lines (Text *text, TextLine *linea, TextLine *lineb)
if (!text) return;
- if(!linea || !lineb) return;
+ if (!linea || !lineb) return;
mrk= txt_find_marker_region(text, lineb, 0, lineb->len, 0, 0);
if (mrk) {
@@ -2504,7 +2560,8 @@ void txt_delete_char(Text *text)
txt_combine_lines(text, text->curl, text->curl->next);
txt_pop_sel(text);
}
- } else { /* Just deleting a char */
+ }
+ else { /* Just deleting a char */
size_t c_len = 0;
TextMarker *mrk;
c= BLI_str_utf8_as_unicode_and_size(text->curl->line + text->curc, &c_len);
@@ -2515,7 +2572,8 @@ void txt_delete_char(Text *text)
if (mrk->end==text->curc) {
if ((mrk->flags & TMARK_TEMP) && !(mrk->flags & TMARK_EDITALL)) {
txt_clear_markers(text, mrk->group, TMARK_TEMP);
- } else {
+ }
+ else {
BLI_freelinkN(&text->markers, mrk);
}
return;
@@ -2537,7 +2595,7 @@ void txt_delete_char(Text *text)
txt_make_dirty(text);
txt_clean_text(text);
- if(!undoing) txt_undo_add_charop(text, UNDO_DEL_1, c);
+ if (!undoing) txt_undo_add_charop(text, UNDO_DEL_1, c);
}
void txt_delete_word (Text *text)
@@ -2579,7 +2637,8 @@ void txt_backspace_char (Text *text)
if (mrk->start==text->curc) {
if ((mrk->flags & TMARK_TEMP) && !(mrk->flags & TMARK_EDITALL)) {
txt_clear_markers(text, mrk->group, TMARK_TEMP);
- } else {
+ }
+ else {
BLI_freelinkN(&text->markers, mrk);
}
return;
@@ -2602,7 +2661,7 @@ void txt_backspace_char (Text *text)
txt_make_dirty(text);
txt_clean_text(text);
- if(!undoing) txt_undo_add_charop(text, UNDO_BS_1, c);
+ if (!undoing) txt_undo_add_charop(text, UNDO_BS_1, c);
}
void txt_backspace_word (Text *text)
@@ -2675,7 +2734,7 @@ static int txt_add_char_intern (Text *text, unsigned int add, int replace_tabs)
txt_make_dirty(text);
txt_clean_text(text);
- if(!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, add);
+ if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, add);
return 1;
}
@@ -2721,7 +2780,8 @@ int txt_replace_char (Text *text, unsigned int add)
memcpy(tmp+text->curc+add_size, text->curl->line+text->curc+del_size, text->curl->len-text->curc-del_size+1);
MEM_freeN(text->curl->line);
text->curl->line = tmp;
- } else if (add_size < del_size) {
+ }
+ else if (add_size < del_size) {
char *tmp= text->curl->line;
memmove(tmp+text->curc+add_size, tmp+text->curc+del_size, text->curl->len-text->curc-del_size+1);
}
@@ -2734,7 +2794,7 @@ int txt_replace_char (Text *text, unsigned int add)
txt_clean_text(text);
/* Should probably create a new op for this */
- if(!undoing) {
+ if (!undoing) {
txt_undo_add_charop(text, UNDO_DEL_1, del);
txt_undo_add_charop(text, UNDO_INSERT_1, add);
}
@@ -2772,11 +2832,11 @@ void txt_indent(Text *text)
tmp= MEM_mallocN(text->curl->len+indentlen+1, "textline_string");
text->curc = 0;
- if(text->curc) memcpy(tmp, text->curl->line, text->curc); /* XXX never true, check prev line */
+ if (text->curc) memcpy(tmp, text->curl->line, text->curc); /* XXX never true, check prev line */
memcpy(tmp+text->curc, add, indentlen);
len= text->curl->len - text->curc;
- if(len>0) memcpy(tmp+text->curc+indentlen, text->curl->line+text->curc, len);
+ if (len>0) memcpy(tmp+text->curc+indentlen, text->curl->line+text->curc, len);
tmp[text->curl->len+indentlen]= 0;
make_new_line(text->curl, tmp);
@@ -2786,23 +2846,24 @@ 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;
- } else {
+ }
+ else {
text->curl = text->curl->next;
num++;
}
}
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);
}
@@ -2827,13 +2888,13 @@ void txt_unindent(Text *text)
indent = spaceslen;
}
- while(TRUE)
+ while (TRUE)
{
int i = 0;
if (BLI_strncasecmp(text->curl->line, remove, indent) == 0)
{
- while(i< text->curl->len) {
+ while (i< text->curl->len) {
text->curl->line[i]= text->curl->line[i+indent];
i++;
}
@@ -2843,24 +2904,25 @@ 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;
- } else {
+ }
+ else {
text->curl = text->curl->next;
num++;
}
}
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);
}
@@ -2882,11 +2944,11 @@ void txt_comment(Text *text)
tmp= MEM_mallocN(text->curl->len+2, "textline_string");
text->curc = 0;
- if(text->curc) memcpy(tmp, text->curl->line, text->curc);
+ if (text->curc) memcpy(tmp, text->curl->line, text->curc);
tmp[text->curc]= add;
len= text->curl->len - text->curc;
- if(len>0) memcpy(tmp+text->curc+1, text->curl->line+text->curc, len);
+ if (len>0) memcpy(tmp+text->curc+1, text->curl->line+text->curc, len);
tmp[text->curl->len+1]=0;
make_new_line(text->curl, tmp);
@@ -2896,23 +2958,24 @@ 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;
- } else {
+ }
+ else {
text->curl = text->curl->next;
num++;
}
}
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);
}
@@ -2927,13 +2990,13 @@ 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)
{
- while(i< text->curl->len) {
+ while (i< text->curl->len) {
text->curl->line[i]= text->curl->line[i+1];
i++;
}
@@ -2944,24 +3007,25 @@ 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;
- } else {
+ }
+ else {
text->curl = text->curl->next;
num++;
}
}
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);
}
@@ -2984,11 +3048,12 @@ int setcurr_tab_spaces (Text *text, int space)
if (i == text->curc)
{
return i;
- } else {
+ }
+ 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
@@ -2996,14 +3061,16 @@ int setcurr_tab_spaces (Text *text, int space)
* 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;
- } else if (ch==':') {
+ }
+ else if (ch==':') {
is_indent = 1;
- } else if (ch!=' ' && ch!='\t') {
+ }
+ else if (ch!=' ' && ch!='\t') {
is_indent = 0;
}
}
@@ -3012,12 +3079,12 @@ 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 (strstr(text->curl->line, back_words[test]) && i > 0)
{
- if(strcspn(text->curl->line, back_words[test]) < strcspn(text->curl->line, comm))
+ if (strcspn(text->curl->line, back_words[test]) < strcspn(text->curl->line, comm))
{
i -= space;
}
@@ -3183,10 +3250,10 @@ int text_check_bracket(char ch)
char opens[] = "([{";
char close[] = ")]}";
- for(a=0; a<(sizeof(opens)-1); a++) {
- if(ch==opens[a])
+ for (a=0; a<(sizeof(opens)-1); a++) {
+ if (ch==opens[a])
return a+1;
- else if(ch==close[a])
+ else if (ch==close[a])
return -(a+1);
}
return 0;
@@ -3197,8 +3264,8 @@ int text_check_delim(char ch)
int a;
char delims[] = "():\"\' ~!%^&*-+=[]{};/<>|.#\t,";
- for(a=0; a<(sizeof(delims)-1); a++) {
- if(ch==delims[a])
+ for (a=0; a<(sizeof(delims)-1); a++) {
+ if (ch==delims[a])
return 1;
}
return 0;
@@ -3206,25 +3273,25 @@ int text_check_delim(char ch)
int text_check_digit(char ch)
{
- if(ch < '0') return 0;
- if(ch <= '9') return 1;
+ if (ch < '0') return 0;
+ if (ch <= '9') return 1;
return 0;
}
int text_check_identifier(char ch)
{
- if(ch < '0') return 0;
- if(ch <= '9') return 1;
- if(ch < 'A') return 0;
- if(ch <= 'Z' || ch == '_') return 1;
- if(ch < 'a') return 0;
- if(ch <= 'z') return 1;
+ if (ch < '0') return 0;
+ if (ch <= '9') return 1;
+ if (ch < 'A') return 0;
+ if (ch <= 'Z' || ch == '_') return 1;
+ if (ch < 'a') return 0;
+ if (ch <= 'z') return 1;
return 0;
}
int text_check_whitespace(char ch)
{
- if(ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
+ if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
return 1;
return 0;
}
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 23a30b6522b..3f40c2bd429 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -81,7 +81,7 @@ int test_dlerr(const char *name, const char *symbol)
char *err;
err= BLI_dynlib_get_error_as_string(NULL);
- if(err) {
+ if (err) {
printf("var1: %s, var2: %s, var3: %s\n", name, symbol, err);
return 1;
}
@@ -109,12 +109,12 @@ void open_plugin_tex(PluginTex *pit)
BLI_dynlib_get_error_as_string(NULL);
/* no BLI_dynlib_close! multiple opened plugins... */
- /* if(pit->handle) BLI_dynlib_close(pit->handle); */
+ /* if (pit->handle) BLI_dynlib_close(pit->handle); */
/* pit->handle= 0; */
/* open the needed object */
pit->handle= BLI_dynlib_open(pit->name);
- if(test_dlerr(pit->name, pit->name)) return;
+ if (test_dlerr(pit->name, pit->name)) return;
if (pit->handle != NULL) {
/* find the address of the version function */
@@ -123,7 +123,7 @@ void open_plugin_tex(PluginTex *pit)
if (version != NULL) {
pit->version= version();
- if( pit->version >= 2 && pit->version <=6) {
+ if ( pit->version >= 2 && pit->version <=6) {
int (*info_func)(PluginInfo *);
PluginInfo *info= (PluginInfo*) MEM_mallocN(sizeof(PluginInfo), "plugin_info");
@@ -146,7 +146,8 @@ void open_plugin_tex(PluginTex *pit)
if (info->init) info->init();
}
MEM_freeN(info);
- } else {
+ }
+ else {
printf ("Plugin returned unrecognized version number\n");
return;
}
@@ -171,18 +172,18 @@ PluginTex *add_plugin_tex(char *str)
BLI_strncpy(pit->name, str, sizeof(pit->name));
open_plugin_tex(pit);
- if(pit->doit==NULL) {
- if(pit->handle==NULL) {;} //XXX error("no plugin: %s", str);
+ if (pit->doit==NULL) {
+ if (pit->handle==NULL) {;} //XXX error("no plugin: %s", str);
else {;} //XXX error("in plugin: %s", str);
MEM_freeN(pit);
return NULL;
}
varstr= pit->varstr;
- for(a=0; a<pit->vars; a++, varstr++) {
- if( (varstr->type & FLO)==FLO)
+ for (a=0; a<pit->vars; a++, varstr++) {
+ if ( (varstr->type & FLO)==FLO)
pit->data[a]= varstr->def;
- else if( (varstr->type & INT)==INT)
+ else if ( (varstr->type & INT)==INT)
*((int *)(pit->data+a))= (int) varstr->def;
}
@@ -196,7 +197,7 @@ PluginTex *add_plugin_tex(char *str)
void free_plugin_tex(PluginTex *pit)
{
- if(pit==NULL) return;
+ if (pit==NULL) return;
/* no BLI_dynlib_close: same plugin can be opened multiple times, 1 handle */
MEM_freeN(pit);
@@ -231,7 +232,7 @@ void init_tex_mapping(TexMapping *texmap)
{
float smat[3][3], rmat[3][3], mat[3][3], proj[3][3];
- if(texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z &&
+ if (texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z &&
is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size)) {
unit_m4(texmap->mat);
@@ -241,11 +242,11 @@ void init_tex_mapping(TexMapping *texmap)
/* axis projection */
zero_m3(proj);
- if(texmap->projx != PROJ_N)
+ if (texmap->projx != PROJ_N)
proj[texmap->projx-1][0]= 1.0f;
- if(texmap->projy != PROJ_N)
+ if (texmap->projy != PROJ_N)
proj[texmap->projy-1][1]= 1.0f;
- if(texmap->projz != PROJ_N)
+ if (texmap->projz != PROJ_N)
proj[texmap->projz-1][2]= 1.0f;
/* scale */
@@ -302,7 +303,7 @@ void init_colorband(ColorBand *coba, int rangetype)
coba->data[0].pos= 0.0;
coba->data[1].pos= 1.0;
- if(rangetype==0) {
+ if (rangetype==0) {
coba->data[0].r= 0.0;
coba->data[0].g= 0.0;
coba->data[0].b= 0.0;
@@ -325,7 +326,7 @@ void init_colorband(ColorBand *coba, int rangetype)
coba->data[1].a= 1.0;
}
- for(a=2; a<MAXCOLORBAND; a++) {
+ for (a=2; a<MAXCOLORBAND; a++) {
coba->data[a].r= 0.5;
coba->data[a].g= 0.5;
coba->data[a].b= 0.5;
@@ -355,17 +356,17 @@ int do_colorband(const ColorBand *coba, float in, float out[4])
float fac, mfac, t[4];
int a;
- if(coba==NULL || coba->tot==0) return 0;
+ if (coba==NULL || coba->tot==0) return 0;
cbd1= coba->data;
- if(coba->tot==1) {
+ if (coba->tot==1) {
out[0]= cbd1->r;
out[1]= cbd1->g;
out[2]= cbd1->b;
out[3]= cbd1->a;
}
else {
- if(in <= cbd1->pos && coba->ipotype<2) {
+ if (in <= cbd1->pos && coba->ipotype<2) {
out[0]= cbd1->r;
out[1]= cbd1->g;
out[2]= cbd1->b;
@@ -375,22 +376,22 @@ int do_colorband(const ColorBand *coba, float in, float out[4])
CBData left, right;
/* we're looking for first pos > in */
- for(a=0; a<coba->tot; a++, cbd1++) if(cbd1->pos > in) break;
+ for (a=0; a<coba->tot; a++, cbd1++) if (cbd1->pos > in) break;
- if(a==coba->tot) {
+ if (a==coba->tot) {
cbd2= cbd1-1;
right= *cbd2;
right.pos= 1.0f;
cbd1= &right;
}
- else if(a==0) {
+ else if (a==0) {
left= *cbd1;
left.pos= 0.0f;
cbd2= &left;
}
else cbd2= cbd1-1;
- if(in >= cbd1->pos && coba->ipotype<2) {
+ if (in >= cbd1->pos && coba->ipotype<2) {
out[0]= cbd1->r;
out[1]= cbd1->g;
out[2]= cbd1->b;
@@ -398,7 +399,7 @@ int do_colorband(const ColorBand *coba, float in, float out[4])
}
else {
- if(cbd2->pos!=cbd1->pos)
+ if (cbd2->pos!=cbd1->pos)
fac= (in-cbd1->pos)/(cbd2->pos-cbd1->pos);
else {
/* was setting to 0.0 in 2.56 & previous, but this
@@ -415,17 +416,17 @@ int do_colorband(const ColorBand *coba, float in, float out[4])
return 1;
}
- if(coba->ipotype>=2) {
+ if (coba->ipotype>=2) {
/* ipo from right to left: 3 2 1 0 */
- if(a>=coba->tot-1) cbd0= cbd1;
+ if (a>=coba->tot-1) cbd0= cbd1;
else cbd0= cbd1+1;
- if(a<2) cbd3= cbd2;
+ if (a<2) cbd3= cbd2;
else cbd3= cbd2-1;
CLAMP(fac, 0.0f, 1.0f);
- if(coba->ipotype==3)
+ if (coba->ipotype==3)
key_curve_position_weights(fac, t, KEY_CARDINAL);
else
key_curve_position_weights(fac, t, KEY_BSPLINE);
@@ -441,7 +442,7 @@ int do_colorband(const ColorBand *coba, float in, float out[4])
}
else {
- if(coba->ipotype==1) { /* EASE */
+ if (coba->ipotype==1) { /* EASE */
mfac= fac*fac;
fac= 3.0f*mfac-2.0f*mfac*fac;
}
@@ -465,7 +466,7 @@ void colorband_table_RGBA(ColorBand *coba, float **array, int *size)
*size = CM_TABLE+1;
*array = MEM_callocN(sizeof(float)*(*size)*4, "ColorBand");
- for(a=0; a<*size; a++)
+ for (a=0; a<*size; a++)
do_colorband(coba, (float)a/(float)CM_TABLE, &(*array)[a*4]);
}
@@ -473,8 +474,8 @@ int vergcband(const void *a1, const void *a2)
{
const CBData *x1=a1, *x2=a2;
- if( x1->pos > x2->pos ) return 1;
- else if( x1->pos < x2->pos) return -1;
+ if ( x1->pos > x2->pos ) return 1;
+ else if ( x1->pos < x2->pos) return -1;
return 0;
}
@@ -482,16 +483,16 @@ void colorband_update_sort(ColorBand *coba)
{
int a;
- if(coba->tot<2)
+ if (coba->tot<2)
return;
- for(a=0; a<coba->tot; a++)
+ for (a=0; a<coba->tot; a++)
coba->data[a].cur= a;
qsort(coba->data, coba->tot, sizeof(CBData), vergcband);
- for(a=0; a<coba->tot; a++) {
- if(coba->data[a].cur==coba->cur) {
+ for (a=0; a<coba->tot; a++) {
+ if (coba->data[a].cur==coba->cur) {
coba->cur= a;
break;
}
@@ -500,10 +501,10 @@ void colorband_update_sort(ColorBand *coba)
CBData *colorband_element_add(struct ColorBand *coba, float position)
{
- if(coba->tot==MAXCOLORBAND) {
+ if (coba->tot==MAXCOLORBAND) {
return NULL;
}
- else if(coba->tot > 0) {
+ else if (coba->tot > 0) {
CBData *xnew;
float col[4];
@@ -530,16 +531,16 @@ int colorband_element_remove(struct ColorBand *coba, int index)
{
int a;
- if(coba->tot < 2)
+ if (coba->tot < 2)
return 0;
- if(index < 0 || index >= coba->tot)
+ if (index < 0 || index >= coba->tot)
return 0;
- for(a = index; a < coba->tot; a++) {
+ for (a = index; a < coba->tot; a++) {
coba->data[a] = coba->data[a + 1];
}
- if(coba->cur) coba->cur--;
+ if (coba->cur) coba->cur--;
coba->tot--;
return 1;
}
@@ -550,18 +551,18 @@ void free_texture(Tex *tex)
{
free_plugin_tex(tex->plugin);
- if(tex->coba) MEM_freeN(tex->coba);
- if(tex->env) BKE_free_envmap(tex->env);
- if(tex->pd) BKE_free_pointdensity(tex->pd);
- if(tex->vd) BKE_free_voxeldata(tex->vd);
- if(tex->ot) BKE_free_oceantex(tex->ot);
+ if (tex->coba) MEM_freeN(tex->coba);
+ if (tex->env) BKE_free_envmap(tex->env);
+ if (tex->pd) BKE_free_pointdensity(tex->pd);
+ if (tex->vd) BKE_free_voxeldata(tex->vd);
+ if (tex->ot) BKE_free_oceantex(tex->ot);
BKE_free_animdata((struct ID *)tex);
BKE_previewimg_free(&tex->preview);
BKE_icon_delete((struct ID*)tex);
tex->id.icon_id = 0;
- if(tex->nodetree) {
+ if (tex->nodetree) {
ntreeFreeTree(tex->nodetree);
MEM_freeN(tex->nodetree);
}
@@ -645,8 +646,8 @@ void default_tex(Tex *tex)
pit = tex->plugin;
if (pit) {
varstr= pit->varstr;
- if(varstr) {
- for(a=0; a<pit->vars; a++, varstr++) {
+ if (varstr) {
+ for (a=0; a<pit->vars; a++, varstr++) {
pit->data[a] = varstr->def;
}
}
@@ -786,11 +787,11 @@ MTex *add_mtex_id(ID *id, int slot)
give_active_mtex(id, &mtex_ar, &act);
- if(mtex_ar==NULL) {
+ if (mtex_ar==NULL) {
return NULL;
}
- if(slot==-1) {
+ if (slot==-1) {
/* find first free */
int i;
for (i= 0; i < MAX_MTEX; i++) {
@@ -799,13 +800,13 @@ MTex *add_mtex_id(ID *id, int slot)
break;
}
}
- if(slot == -1) {
+ if (slot == -1) {
return NULL;
}
}
else {
/* make sure slot is valid */
- if(slot < 0 || slot >= MAX_MTEX) {
+ if (slot < 0 || slot >= MAX_MTEX) {
return NULL;
}
}
@@ -828,22 +829,22 @@ Tex *copy_texture(Tex *tex)
Tex *texn;
texn= copy_libblock(&tex->id);
- if(texn->type==TEX_IMAGE) id_us_plus((ID *)texn->ima);
+ if (texn->type==TEX_IMAGE) id_us_plus((ID *)texn->ima);
else texn->ima= NULL;
- if(texn->plugin) {
+ if (texn->plugin) {
texn->plugin= MEM_dupallocN(texn->plugin);
open_plugin_tex(texn->plugin);
}
- if(texn->coba) texn->coba= MEM_dupallocN(texn->coba);
- if(texn->env) texn->env= BKE_copy_envmap(texn->env);
- if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
- if(texn->vd) texn->vd= MEM_dupallocN(texn->vd);
- if(texn->ot) texn->ot= BKE_copy_oceantex(texn->ot);
- if(tex->preview) texn->preview = BKE_previewimg_copy(tex->preview);
+ if (texn->coba) texn->coba= MEM_dupallocN(texn->coba);
+ if (texn->env) texn->env= BKE_copy_envmap(texn->env);
+ if (texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
+ if (texn->vd) texn->vd= MEM_dupallocN(texn->vd);
+ if (texn->ot) texn->ot= BKE_copy_oceantex(texn->ot);
+ if (tex->preview) texn->preview = BKE_previewimg_copy(tex->preview);
- if(tex->nodetree) {
+ if (tex->nodetree) {
if (tex->nodetree->execdata) {
ntreeTexEndExecTree(tex->nodetree->execdata, 1);
}
@@ -863,29 +864,29 @@ Tex *localize_texture(Tex *tex)
/* image texture: free_texture also doesn't decrease */
- if(texn->plugin) {
+ if (texn->plugin) {
texn->plugin= MEM_dupallocN(texn->plugin);
open_plugin_tex(texn->plugin);
}
- if(texn->coba) texn->coba= MEM_dupallocN(texn->coba);
- if(texn->env) {
+ if (texn->coba) texn->coba= MEM_dupallocN(texn->coba);
+ if (texn->env) {
texn->env= BKE_copy_envmap(texn->env);
id_us_min(&texn->env->ima->id);
}
- if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
- if(texn->vd) {
+ if (texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
+ if (texn->vd) {
texn->vd= MEM_dupallocN(texn->vd);
- if(texn->vd->dataset)
+ if (texn->vd->dataset)
texn->vd->dataset= MEM_dupallocN(texn->vd->dataset);
}
- if(texn->ot) {
+ if (texn->ot) {
texn->ot= BKE_copy_oceantex(tex->ot);
}
texn->preview = NULL;
- if(tex->nodetree) {
+ if (tex->nodetree) {
texn->nodetree= ntreeLocalize(tex->nodetree);
}
@@ -915,68 +916,68 @@ void make_local_texture(Tex *tex)
* - mixed: make copy
*/
- if(tex->id.lib==NULL) return;
+ if (tex->id.lib==NULL) return;
- if(tex->id.us==1) {
+ if (tex->id.us==1) {
id_clear_lib_data(bmain, &tex->id);
extern_local_texture(tex);
return;
}
ma= bmain->mat.first;
- while(ma) {
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a] && ma->mtex[a]->tex==tex) {
- if(ma->id.lib) is_lib= TRUE;
+ while (ma) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a] && ma->mtex[a]->tex==tex) {
+ if (ma->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
ma= ma->id.next;
}
la= bmain->lamp.first;
- while(la) {
- for(a=0; a<MAX_MTEX; a++) {
- if(la->mtex[a] && la->mtex[a]->tex==tex) {
- if(la->id.lib) is_lib= TRUE;
+ while (la) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (la->mtex[a] && la->mtex[a]->tex==tex) {
+ if (la->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
la= la->id.next;
}
wrld= bmain->world.first;
- while(wrld) {
- for(a=0; a<MAX_MTEX; a++) {
- if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
- if(wrld->id.lib) is_lib= TRUE;
+ while (wrld) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
+ if (wrld->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
wrld= wrld->id.next;
}
br= bmain->brush.first;
- while(br) {
- if(br->mtex.tex==tex) {
- if(br->id.lib) is_lib= TRUE;
+ while (br) {
+ if (br->mtex.tex==tex) {
+ if (br->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
br= br->id.next;
}
pa= bmain->particle.first;
- while(pa) {
- for(a=0; a<MAX_MTEX; a++) {
- if(pa->mtex[a] && pa->mtex[a]->tex==tex) {
- if(pa->id.lib) is_lib= TRUE;
+ while (pa) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (pa->mtex[a] && pa->mtex[a]->tex==tex) {
+ if (pa->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
pa= pa->id.next;
}
- if(is_local && is_lib == FALSE) {
+ if (is_local && is_lib == FALSE) {
id_clear_lib_data(bmain, &tex->id);
extern_local_texture(tex);
}
- else if(is_local && is_lib) {
+ else if (is_local && is_lib) {
Tex *tex_new= copy_texture(tex);
tex_new->id.us= 0;
@@ -985,10 +986,10 @@ void make_local_texture(Tex *tex)
BKE_id_lib_local_paths(bmain, tex->id.lib, &tex_new->id);
ma= bmain->mat.first;
- while(ma) {
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a] && ma->mtex[a]->tex==tex) {
- if(ma->id.lib==NULL) {
+ while (ma) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a] && ma->mtex[a]->tex==tex) {
+ if (ma->id.lib==NULL) {
ma->mtex[a]->tex= tex_new;
tex_new->id.us++;
tex->id.us--;
@@ -998,10 +999,10 @@ void make_local_texture(Tex *tex)
ma= ma->id.next;
}
la= bmain->lamp.first;
- while(la) {
- for(a=0; a<MAX_MTEX; a++) {
- if(la->mtex[a] && la->mtex[a]->tex==tex) {
- if(la->id.lib==NULL) {
+ while (la) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (la->mtex[a] && la->mtex[a]->tex==tex) {
+ if (la->id.lib==NULL) {
la->mtex[a]->tex= tex_new;
tex_new->id.us++;
tex->id.us--;
@@ -1011,10 +1012,10 @@ void make_local_texture(Tex *tex)
la= la->id.next;
}
wrld= bmain->world.first;
- while(wrld) {
- for(a=0; a<MAX_MTEX; a++) {
- if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
- if(wrld->id.lib==NULL) {
+ while (wrld) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
+ if (wrld->id.lib==NULL) {
wrld->mtex[a]->tex= tex_new;
tex_new->id.us++;
tex->id.us--;
@@ -1024,9 +1025,9 @@ void make_local_texture(Tex *tex)
wrld= wrld->id.next;
}
br= bmain->brush.first;
- while(br) {
- if(br->mtex.tex==tex) {
- if(br->id.lib==NULL) {
+ while (br) {
+ if (br->mtex.tex==tex) {
+ if (br->id.lib==NULL) {
br->mtex.tex= tex_new;
tex_new->id.us++;
tex->id.us--;
@@ -1035,10 +1036,10 @@ void make_local_texture(Tex *tex)
br= br->id.next;
}
pa= bmain->particle.first;
- while(pa) {
- for(a=0; a<MAX_MTEX; a++) {
- if(pa->mtex[a] && pa->mtex[a]->tex==tex) {
- if(pa->id.lib==NULL) {
+ while (pa) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (pa->mtex[a] && pa->mtex[a]->tex==tex) {
+ if (pa->id.lib==NULL) {
pa->mtex[a]->tex= tex_new;
tex_new->id.us++;
tex->id.us--;
@@ -1061,14 +1062,14 @@ void autotexname(Tex *tex)
Image *ima;
char di[FILE_MAXDIR], fi[FILE_MAXFILE];
- if(tex) {
- if(tex->use_nodes) {
+ if (tex) {
+ if (tex->use_nodes) {
new_id(&bmain->tex, (ID *)tex, "Noddy");
}
else
- if(tex->type==TEX_IMAGE) {
+ if (tex->type==TEX_IMAGE) {
ima= tex->ima;
- if(ima) {
+ if (ima) {
BLI_strncpy(di, ima->name, sizeof(di));
BLI_splitdirstring(di, fi);
strcpy(di, "I.");
@@ -1077,7 +1078,7 @@ void autotexname(Tex *tex)
}
else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]);
}
- else if(tex->type==TEX_PLUGIN && tex->plugin) new_id(&bmain->tex, (ID *)tex, tex->plugin->pname);
+ else if (tex->type==TEX_PLUGIN && tex->plugin) new_id(&bmain->tex, (ID *)tex, tex->plugin->pname);
else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]);
}
}
@@ -1089,15 +1090,16 @@ Tex *give_current_object_texture(Object *ob)
Material *ma, *node_ma;
Tex *tex= NULL;
- if(ob==NULL) return NULL;
- if(ob->totcol==0 && !(ob->type==OB_LAMP)) return NULL;
+ if (ob==NULL) return NULL;
+ if (ob->totcol==0 && !(ob->type==OB_LAMP)) return NULL;
- if(ob->type==OB_LAMP) {
+ if (ob->type==OB_LAMP) {
tex= give_current_lamp_texture(ob->data);
- } else {
+ }
+ else {
ma= give_current_material(ob, ob->actcol);
- if((node_ma=give_node_material(ma)))
+ if ((node_ma=give_node_material(ma)))
ma= node_ma;
tex= give_current_material_texture(ma);
@@ -1111,9 +1113,9 @@ Tex *give_current_lamp_texture(Lamp *la)
MTex *mtex= NULL;
Tex *tex= NULL;
- if(la) {
+ if (la) {
mtex= la->mtex[(int)(la->texact)];
- if(mtex) tex= mtex->tex;
+ if (mtex) tex= mtex->tex;
}
return tex;
@@ -1123,11 +1125,11 @@ void set_current_lamp_texture(Lamp *la, Tex *newtex)
{
int act= la->texact;
- if(la->mtex[act] && la->mtex[act]->tex)
+ if (la->mtex[act] && la->mtex[act]->tex)
id_us_min(&la->mtex[act]->tex->id);
- if(newtex) {
- if(!la->mtex[act]) {
+ if (newtex) {
+ if (!la->mtex[act]) {
la->mtex[act]= add_mtex();
la->mtex[act]->texco= TEXCO_GLOB;
}
@@ -1135,7 +1137,7 @@ void set_current_lamp_texture(Lamp *la, Tex *newtex)
la->mtex[act]->tex= newtex;
id_us_plus(&newtex->id);
}
- else if(la->mtex[act]) {
+ else if (la->mtex[act]) {
MEM_freeN(la->mtex[act]);
la->mtex[act]= NULL;
}
@@ -1143,7 +1145,7 @@ void set_current_lamp_texture(Lamp *la, Tex *newtex)
bNode *give_current_material_texture_node(Material *ma)
{
- if(ma && ma->use_nodes && ma->nodetree)
+ if (ma && ma->use_nodes && ma->nodetree)
return nodeGetActiveID(ma->nodetree, ID_TE);
return NULL;
@@ -1155,21 +1157,21 @@ Tex *give_current_material_texture(Material *ma)
Tex *tex= NULL;
bNode *node;
- if(ma && ma->use_nodes && ma->nodetree) {
+ if (ma && ma->use_nodes && ma->nodetree) {
/* first check texture, then material, this works together
* with a hack that clears the active ID flag for textures on
* making a material node active */
node= nodeGetActiveID(ma->nodetree, ID_TE);
- if(node) {
+ if (node) {
tex= (Tex *)node->id;
ma= NULL;
}
}
- if(ma) {
+ if (ma) {
mtex= ma->mtex[(int)(ma->texact)];
- if(mtex) tex= mtex->tex;
+ if (mtex) tex= mtex->tex;
}
return tex;
@@ -1180,23 +1182,23 @@ int give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
switch(GS(id->name)) {
case ID_MA:
*mtex_ar= ((Material *)id)->mtex;
- if(act) *act= (((Material *)id)->texact);
+ if (act) *act= (((Material *)id)->texact);
break;
case ID_WO:
*mtex_ar= ((World *)id)->mtex;
- if(act) *act= (((World *)id)->texact);
+ if (act) *act= (((World *)id)->texact);
break;
case ID_LA:
*mtex_ar= ((Lamp *)id)->mtex;
- if(act) *act= (((Lamp *)id)->texact);
+ if (act) *act= (((Lamp *)id)->texact);
break;
case ID_PA:
*mtex_ar= ((ParticleSettings *)id)->mtex;
- if(act) *act= (((ParticleSettings *)id)->texact);
+ if (act) *act= (((ParticleSettings *)id)->texact);
break;
default:
*mtex_ar = NULL;
- if(act) *act= 0;
+ if (act) *act= 0;
return FALSE;
}
@@ -1205,8 +1207,8 @@ int give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
void set_active_mtex(ID *id, short act)
{
- if(act<0) act= 0;
- else if(act>=MAX_MTEX) act= MAX_MTEX-1;
+ if (act<0) act= 0;
+ else if (act>=MAX_MTEX) act= MAX_MTEX-1;
switch(GS(id->name)) {
case ID_MA:
@@ -1229,10 +1231,10 @@ void set_current_material_texture(Material *ma, Tex *newtex)
Tex *tex= NULL;
bNode *node;
- if(ma && ma->use_nodes && ma->nodetree) {
+ if (ma && ma->use_nodes && ma->nodetree) {
node= nodeGetActiveID(ma->nodetree, ID_TE);
- if(node) {
+ if (node) {
tex= (Tex *)node->id;
id_us_min(&tex->id);
node->id= &newtex->id;
@@ -1240,20 +1242,20 @@ void set_current_material_texture(Material *ma, Tex *newtex)
ma= NULL;
}
}
- if(ma) {
+ if (ma) {
int act= (int)ma->texact;
tex= (ma->mtex[act])? ma->mtex[act]->tex: NULL;
id_us_min(&tex->id);
- if(newtex) {
- if(!ma->mtex[act])
+ if (newtex) {
+ if (!ma->mtex[act])
ma->mtex[act]= add_mtex();
ma->mtex[act]->tex= newtex;
id_us_plus(&newtex->id);
}
- else if(ma->mtex[act]) {
+ else if (ma->mtex[act]) {
MEM_freeN(ma->mtex[act]);
ma->mtex[act]= NULL;
}
@@ -1264,10 +1266,10 @@ int has_current_material_texture(Material *ma)
{
bNode *node;
- if(ma && ma->use_nodes && ma->nodetree) {
+ if (ma && ma->use_nodes && ma->nodetree) {
node= nodeGetActiveID(ma->nodetree, ID_TE);
- if(node)
+ if (node)
return 1;
}
@@ -1279,10 +1281,10 @@ Tex *give_current_world_texture(World *world)
MTex *mtex= NULL;
Tex *tex= NULL;
- if(!world) return NULL;
+ if (!world) return NULL;
mtex= world->mtex[(int)(world->texact)];
- if(mtex) tex= mtex->tex;
+ if (mtex) tex= mtex->tex;
return tex;
}
@@ -1291,11 +1293,11 @@ void set_current_world_texture(World *wo, Tex *newtex)
{
int act= wo->texact;
- if(wo->mtex[act] && wo->mtex[act]->tex)
+ if (wo->mtex[act] && wo->mtex[act]->tex)
id_us_min(&wo->mtex[act]->tex->id);
- if(newtex) {
- if(!wo->mtex[act]) {
+ if (newtex) {
+ if (!wo->mtex[act]) {
wo->mtex[act]= add_mtex();
wo->mtex[act]->texco= TEXCO_VIEW;
}
@@ -1303,7 +1305,7 @@ void set_current_world_texture(World *wo, Tex *newtex)
wo->mtex[act]->tex= newtex;
id_us_plus(&newtex->id);
}
- else if(wo->mtex[act]) {
+ else if (wo->mtex[act]) {
MEM_freeN(wo->mtex[act]);
wo->mtex[act]= NULL;
}
@@ -1316,10 +1318,10 @@ Tex *give_current_brush_texture(Brush *br)
void set_current_brush_texture(Brush *br, Tex *newtex)
{
- if(br->mtex.tex)
+ if (br->mtex.tex)
id_us_min(&br->mtex.tex->id);
- if(newtex) {
+ if (newtex) {
br->mtex.tex= newtex;
id_us_plus(&newtex->id);
}
@@ -1330,10 +1332,10 @@ Tex *give_current_particle_texture(ParticleSettings *part)
MTex *mtex= NULL;
Tex *tex= NULL;
- if(!part) return NULL;
+ if (!part) return NULL;
mtex= part->mtex[(int)(part->texact)];
- if(mtex) tex= mtex->tex;
+ if (mtex) tex= mtex->tex;
return tex;
}
@@ -1342,11 +1344,11 @@ void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
{
int act= part->texact;
- if(part->mtex[act] && part->mtex[act]->tex)
+ if (part->mtex[act] && part->mtex[act]->tex)
id_us_min(&part->mtex[act]->tex->id);
- if(newtex) {
- if(!part->mtex[act]) {
+ if (newtex) {
+ if (!part->mtex[act]) {
part->mtex[act]= add_mtex();
part->mtex[act]->texco= TEXCO_ORCO;
part->mtex[act]->blendtype= MTEX_MUL;
@@ -1355,7 +1357,7 @@ void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
part->mtex[act]->tex= newtex;
id_us_plus(&newtex->id);
}
- else if(part->mtex[act]) {
+ else if (part->mtex[act]) {
MEM_freeN(part->mtex[act]);
part->mtex[act]= NULL;
}
@@ -1387,8 +1389,8 @@ EnvMap *BKE_copy_envmap(EnvMap *env)
envn= MEM_dupallocN(env);
envn->ok= 0;
- for(a=0; a<6; a++) envn->cube[a]= NULL;
- if(envn->ima) id_us_plus((ID *)envn->ima);
+ for (a=0; a<6; a++) envn->cube[a]= NULL;
+ if (envn->ima) id_us_plus((ID *)envn->ima);
return envn;
}
@@ -1399,8 +1401,8 @@ void BKE_free_envmapdata(EnvMap *env)
{
unsigned int part;
- for(part=0; part<6; part++) {
- if(env->cube[part])
+ for (part=0; part<6; part++) {
+ if (env->cube[part])
IMB_freeImBuf(env->cube[part]);
env->cube[part]= NULL;
}
@@ -1458,7 +1460,7 @@ PointDensity *BKE_copy_pointdensity(PointDensity *pd)
pdn= MEM_dupallocN(pd);
pdn->point_tree = NULL;
pdn->point_data = NULL;
- if(pdn->coba) pdn->coba= MEM_dupallocN(pdn->coba);
+ if (pdn->coba) pdn->coba= MEM_dupallocN(pdn->coba);
pdn->falloff_curve = curvemapping_copy(pdn->falloff_curve); /* can be NULL */
return pdn;
}
@@ -1473,7 +1475,7 @@ void BKE_free_pointdensitydata(PointDensity *pd)
MEM_freeN(pd->point_data);
pd->point_data = NULL;
}
- if(pd->coba) {
+ if (pd->coba) {
MEM_freeN(pd->coba);
pd->coba = NULL;
}
@@ -1561,19 +1563,19 @@ void BKE_free_oceantex(struct OceanTex *ot)
/* ------------------------------------------------------------------------- */
int BKE_texture_dependsOnTime(const struct Tex *texture)
{
- if(texture->plugin) {
+ if (texture->plugin) {
// assume all plugins depend on time
return 1;
}
- else if( texture->ima &&
+ else if ( texture->ima &&
ELEM(texture->ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
return 1;
}
- else if(texture->adt) {
+ else if (texture->adt) {
// assume anything in adt means the texture is animated
return 1;
}
- else if(texture->type == TEX_NOISE) {
+ else if (texture->type == TEX_NOISE) {
// noise always varies with time
return 1;
}
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 1d275cfdb28..bdecc6884ea 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -112,68 +112,68 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
}
/* sort */
- for(a= 0; a<2; a++) {
- if(track->pat_min[a]>track->pat_max[a])
+ for (a= 0; a<2; a++) {
+ if (track->pat_min[a]>track->pat_max[a])
SWAP(float, track->pat_min[a], track->pat_max[a]);
- if(track->search_min[a]>track->search_max[a])
+ if (track->search_min[a]>track->search_max[a])
SWAP(float, track->search_min[a], track->search_max[a]);
}
/* compute the effective pattern size, which differs from the fine resolution
* pattern size for the pyramid KLT tracker */
- for(a= 0; a<2; a++) {
+ for (a= 0; a<2; a++) {
pat_min[a] = max_pyramid_level_factor * track->pat_min[a];
pat_max[a] = max_pyramid_level_factor * track->pat_max[a];
}
- if(event==CLAMP_PAT_DIM) {
- for(a= 0; a<2; a++) {
+ if (event==CLAMP_PAT_DIM) {
+ for (a= 0; a<2; a++) {
/* search shouldn't be resized smaller than pattern */
track->search_min[a]= MIN2(pat_min[a], track->search_min[a]);
track->search_max[a]= MAX2(pat_max[a], track->search_max[a]);
}
}
- else if(event==CLAMP_PAT_POS) {
+ else if (event==CLAMP_PAT_POS) {
float dim[2];
sub_v2_v2v2(dim, track->pat_max, track->pat_min);
- for(a= 0; a<2; a++) {
+ for (a= 0; a<2; a++) {
/* pattern shouldn't be moved outside of search */
- if(pat_min[a] < track->search_min[a]) {
+ if (pat_min[a] < track->search_min[a]) {
track->pat_min[a]= track->search_min[a] - (pat_min[a] - track->pat_min[a]);
track->pat_max[a]= track->pat_min[a] + dim[a];
}
- if(track->pat_max[a] > track->search_max[a]) {
+ if (track->pat_max[a] > track->search_max[a]) {
track->pat_max[a]= track->search_max[a] - (pat_max[a] - track->pat_max[a]);
track->pat_min[a]= track->pat_max[a] - dim[a];
}
}
}
- else if(event==CLAMP_SEARCH_DIM) {
- for(a= 0; a<2; a++) {
+ else if (event==CLAMP_SEARCH_DIM) {
+ for (a= 0; a<2; a++) {
/* search shouldn't be resized smaller than pattern */
track->search_min[a]= MIN2(pat_min[a], track->search_min[a]);
track->search_max[a]= MAX2(pat_max[a], track->search_max[a]);
}
}
- else if(event==CLAMP_SEARCH_POS) {
+ else if (event==CLAMP_SEARCH_POS) {
float dim[2];
sub_v2_v2v2(dim, track->search_max, track->search_min);
- for(a= 0; a<2; a++) {
+ for (a= 0; a<2; a++) {
/* search shouldn't be moved inside pattern */
- if(track->search_min[a] > pat_min[a]) {
+ if (track->search_min[a] > pat_min[a]) {
track->search_min[a]= pat_min[a];
track->search_max[a]= track->search_min[a]+dim[a];
}
- if(track->search_max[a] < pat_max[a]) {
+ if (track->search_max[a] < pat_max[a]) {
track->search_max[a]= pat_max[a];
track->search_min[a]= track->search_max[a]-dim[a];
}
}
}
- else if(event==CLAMP_PYRAMID_LEVELS || (event==CLAMP_SEARCH_DIM && track->tracker == TRACKER_KLT)) {
+ else if (event==CLAMP_PYRAMID_LEVELS || (event==CLAMP_SEARCH_DIM && track->tracker == TRACKER_KLT)) {
float dim[2];
sub_v2_v2v2(dim, track->pat_max, track->pat_min);
{
@@ -181,7 +181,7 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
/* resize the search area to something sensible based
* on the number of pyramid levels */
- for(a= 0; a<2; a++) {
+ for (a= 0; a<2; a++) {
track->search_min[a]= search_ratio * track->pat_min[a];
track->search_max[a]= search_ratio * track->pat_max[a];
}
@@ -189,11 +189,11 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
}
/* marker's center should be in center of pattern */
- if(event==CLAMP_PAT_DIM || event==CLAMP_PAT_POS) {
+ if (event==CLAMP_PAT_DIM || event==CLAMP_PAT_POS) {
float dim[2];
sub_v2_v2v2(dim, track->pat_max, track->pat_min);
- for(a= 0; a<2; a++) {
+ for (a= 0; a<2; a++) {
track->pat_min[a]= -dim[a]/2.0f;
track->pat_max[a]= dim[a]/2.0f;
}
@@ -202,17 +202,18 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
void BKE_tracking_track_flag(MovieTrackingTrack *track, int area, int flag, int clear)
{
- if(area==TRACK_AREA_NONE)
+ if (area==TRACK_AREA_NONE)
return;
- if(clear) {
- if(area&TRACK_AREA_POINT) track->flag&= ~flag;
- if(area&TRACK_AREA_PAT) track->pat_flag&= ~flag;
- if(area&TRACK_AREA_SEARCH) track->search_flag&= ~flag;
- } else {
- if(area&TRACK_AREA_POINT) track->flag|= flag;
- if(area&TRACK_AREA_PAT) track->pat_flag|= flag;
- if(area&TRACK_AREA_SEARCH) track->search_flag|= flag;
+ if (clear) {
+ if (area&TRACK_AREA_POINT) track->flag&= ~flag;
+ if (area&TRACK_AREA_PAT) track->pat_flag&= ~flag;
+ if (area&TRACK_AREA_SEARCH) track->search_flag&= ~flag;
+ }
+ else {
+ if (area&TRACK_AREA_POINT) track->flag|= flag;
+ if (area&TRACK_AREA_PAT) track->pat_flag|= flag;
+ if (area&TRACK_AREA_SEARCH) track->search_flag|= flag;
}
}
@@ -257,7 +258,7 @@ MovieTrackingTrack *BKE_tracking_add_track(MovieTracking *tracking, ListBase *tr
BKE_tracking_insert_marker(track, &marker);
- if(track->tracker == TRACKER_KLT)
+ if (track->tracker == TRACKER_KLT)
BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
BLI_addtail(tracksbase, track);
@@ -270,24 +271,25 @@ MovieTrackingMarker *BKE_tracking_insert_marker(MovieTrackingTrack *track, Movie
{
MovieTrackingMarker *old_marker= NULL;
- if(track->markersnr)
+ if (track->markersnr)
old_marker= BKE_tracking_exact_marker(track, marker->framenr);
- if(old_marker) {
+ if (old_marker) {
*old_marker= *marker;
return old_marker;
- } else {
+ }
+ else {
int a= track->markersnr;
- while(a--) {
- if(track->markers[a].framenr<marker->framenr)
+ while (a--) {
+ if (track->markers[a].framenr<marker->framenr)
break;
}
track->markersnr++;
- if(track->markers) track->markers= MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
+ if (track->markers) track->markers= MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
else track->markers= MEM_callocN(sizeof(MovieTrackingMarker), "MovieTracking markers");
memmove(track->markers+a+2, track->markers+a+1, (track->markersnr-a-2)*sizeof(MovieTrackingMarker));
@@ -303,13 +305,14 @@ void BKE_tracking_delete_marker(MovieTrackingTrack *track, int framenr)
{
int a= 0;
- while(a<track->markersnr) {
- if(track->markers[a].framenr==framenr) {
- if(track->markersnr>1) {
+ while (a<track->markersnr) {
+ if (track->markers[a].framenr==framenr) {
+ if (track->markersnr>1) {
memmove(track->markers+a, track->markers+a+1, (track->markersnr-a-1)*sizeof(MovieTrackingMarker));
track->markersnr--;
track->markers= MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
- } else {
+ }
+ else {
MEM_freeN(track->markers);
track->markers= NULL;
track->markersnr= 0;
@@ -326,19 +329,19 @@ MovieTrackingMarker *BKE_tracking_get_marker(MovieTrackingTrack *track, int fram
{
int a= track->markersnr-1;
- if(!track->markersnr)
+ if (!track->markersnr)
return NULL;
/* approximate pre-first framenr marker with first marker */
- if(framenr<track->markers[0].framenr)
+ if (framenr<track->markers[0].framenr)
return &track->markers[0];
- if(track->last_marker<track->markersnr)
+ if (track->last_marker<track->markersnr)
a= track->last_marker;
- if(track->markers[a].framenr<=framenr) {
- while(a<track->markersnr && track->markers[a].framenr<=framenr) {
- if(track->markers[a].framenr==framenr) {
+ if (track->markers[a].framenr<=framenr) {
+ while (a<track->markersnr && track->markers[a].framenr<=framenr) {
+ if (track->markers[a].framenr==framenr) {
track->last_marker= a;
return &track->markers[a];
}
@@ -347,9 +350,10 @@ MovieTrackingMarker *BKE_tracking_get_marker(MovieTrackingTrack *track, int fram
/* if there's no marker for exact position, use nearest marker from left side */
return &track->markers[a-1];
- } else {
- while(a>=0 && track->markers[a].framenr>=framenr) {
- if(track->markers[a].framenr==framenr) {
+ }
+ else {
+ while (a>=0 && track->markers[a].framenr>=framenr) {
+ if (track->markers[a].framenr==framenr) {
track->last_marker= a;
return &track->markers[a];
}
@@ -368,7 +372,7 @@ MovieTrackingMarker *BKE_tracking_ensure_marker(MovieTrackingTrack *track, int f
{
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
- if(marker->framenr!=framenr) {
+ if (marker->framenr!=framenr) {
MovieTrackingMarker marker_new;
marker_new= *marker;
@@ -385,7 +389,7 @@ MovieTrackingMarker *BKE_tracking_exact_marker(MovieTrackingTrack *track, int fr
{
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
- if(marker->framenr!=framenr)
+ if (marker->framenr!=framenr)
return NULL;
return marker;
@@ -405,7 +409,7 @@ int BKE_tracking_has_enabled_marker(MovieTrackingTrack *track, int framenr)
void BKE_tracking_free_track(MovieTrackingTrack *track)
{
- if(track->markers) MEM_freeN(track->markers);
+ if (track->markers) MEM_freeN(track->markers);
}
static void put_disabled_marker(MovieTrackingTrack *track, MovieTrackingMarker *ref_marker, int before, int overwrite)
@@ -416,10 +420,10 @@ static void put_disabled_marker(MovieTrackingTrack *track, MovieTrackingMarker *
marker_new.flag&= ~MARKER_TRACKED;
marker_new.flag|= MARKER_DISABLED;
- if(before) marker_new.framenr--;
+ if (before) marker_new.framenr--;
else marker_new.framenr++;
- if(!BKE_tracking_has_marker(track, marker_new.framenr) || overwrite)
+ if (!BKE_tracking_has_marker(track, marker_new.framenr) || overwrite)
BKE_tracking_insert_marker(track, &marker_new);
}
@@ -427,10 +431,10 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
{
int a;
- if(action==TRACK_CLEAR_REMAINED) {
+ if (action==TRACK_CLEAR_REMAINED) {
a= 1;
- while(a<track->markersnr) {
- if(track->markers[a].framenr>ref_frame) {
+ while (a<track->markersnr) {
+ if (track->markers[a].framenr>ref_frame) {
track->markersnr= a;
track->markers= MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
@@ -440,12 +444,13 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
a++;
}
- if(track->markersnr)
+ if (track->markersnr)
put_disabled_marker(track, &track->markers[track->markersnr-1], 0, 1);
- } else if(action==TRACK_CLEAR_UPTO) {
+ }
+ else if (action==TRACK_CLEAR_UPTO) {
a= track->markersnr-1;
- while(a>=0) {
- if(track->markers[a].framenr<=ref_frame) {
+ while (a>=0) {
+ if (track->markers[a].framenr<=ref_frame) {
memmove(track->markers, track->markers+a, (track->markersnr-a)*sizeof(MovieTrackingMarker));
track->markersnr= track->markersnr-a;
@@ -457,9 +462,10 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
a--;
}
- if(track->markersnr)
+ if (track->markersnr)
put_disabled_marker(track, &track->markers[0], 1, 1);
- } else if(action==TRACK_CLEAR_ALL) {
+ }
+ else if (action==TRACK_CLEAR_ALL) {
MovieTrackingMarker *marker, marker_new;
marker= BKE_tracking_get_marker(track, ref_frame);
@@ -476,79 +482,108 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
}
}
-int BKE_tracking_test_join_tracks(MovieTrackingTrack *dst_track, MovieTrackingTrack *src_track)
-{
- int a= 0, b= 0;
- int count= 0;
-
- while(a<src_track->markersnr || b<dst_track->markersnr) {
- if(b>=dst_track->markersnr) {
- a++;
- count++;
- }
- else if(a>=src_track->markersnr) {
- b++;
- count++;
- }
- else if(src_track->markers[a].framenr<dst_track->markers[b].framenr) {
- a++;
- count++;
- } else if(src_track->markers[a].framenr>dst_track->markers[b].framenr) {
- b++;
- count++;
- } else {
- if((src_track->markers[a].flag&MARKER_DISABLED)==0 && (dst_track->markers[b].flag&MARKER_DISABLED)==0)
- return 0;
-
- a++;
- b++;
- count++;
- }
- }
-
- return count;
-}
-
void BKE_tracking_join_tracks(MovieTrackingTrack *dst_track, MovieTrackingTrack *src_track)
{
- int i, a= 0, b= 0, tot;
+ int i= 0, a= 0, b= 0;
MovieTrackingMarker *markers;
- tot= BKE_tracking_test_join_tracks(dst_track, src_track);
+ markers= MEM_callocN((dst_track->markersnr+src_track->markersnr)*sizeof(MovieTrackingMarker), "tmp tracking joined tracks");
- markers= MEM_callocN(tot*sizeof(MovieTrackingMarker), "tracking joined tracks");
-
- for(i= 0; i<tot; i++) {
- if(b>=dst_track->markersnr) {
+ while (a < src_track->markersnr || b < dst_track->markersnr) {
+ if (b>=dst_track->markersnr) {
markers[i]= src_track->markers[a++];
}
- else if(a>=src_track->markersnr) {
+ else if (a>=src_track->markersnr) {
markers[i]= dst_track->markers[b++];
}
- else if(src_track->markers[a].framenr<dst_track->markers[b].framenr) {
+ else if (src_track->markers[a].framenr<dst_track->markers[b].framenr) {
markers[i]= src_track->markers[a++];
- } else if(src_track->markers[a].framenr>dst_track->markers[b].framenr) {
+ }
+ else if (src_track->markers[a].framenr>dst_track->markers[b].framenr) {
markers[i]= dst_track->markers[b++];
- } else {
- if((src_track->markers[a].flag&MARKER_DISABLED)) markers[i]= dst_track->markers[b];
- else markers[i]= src_track->markers[a++];
+ }
+ else {
+ if ((src_track->markers[a].flag&MARKER_DISABLED)==0) {
+ if ((dst_track->markers[b].flag&MARKER_DISABLED)==0) {
+ /* both tracks are enabled on this frame, so find the whole segment
+ * on which tracks are intersecting and blend tracks using linear
+ * interpolation to prevent jumps */
+
+ MovieTrackingMarker *marker_a, *marker_b;
+ int start_a = a, start_b = b, len = 0, frame = src_track->markers[a].framenr;
+ int j, inverse = 0;
+
+ inverse = (b == 0) ||
+ (dst_track->markers[b-1].flag & MARKER_DISABLED) ||
+ (dst_track->markers[b-1].framenr != frame - 1);
+
+ while (a < src_track->markersnr && b < dst_track->markersnr) {
+ marker_a = &src_track->markers[a];
+ marker_b = &dst_track->markers[b];
+
+ if (marker_a->flag & MARKER_DISABLED || marker_b->flag & MARKER_DISABLED)
+ break;
+
+ if (marker_a->framenr != frame || marker_b->framenr != frame)
+ break;
+
+ frame++;
+ len++;
+ a++;
+ b++;
+ }
+
+ a = start_a;
+ b = start_b;
+
+ for (j = 0; j < len; j++) {
+ float fac = 0.5f;
+
+ if (len > 1)
+ fac = 1.0f / (len - 1) * j;
+
+ if (inverse)
+ fac = 1.0f - fac;
+
+ marker_a = &src_track->markers[a];
+ marker_b = &dst_track->markers[b];
+
+ markers[i]= dst_track->markers[b];
+ interp_v2_v2v2(markers[i].pos, marker_b->pos, marker_a->pos, fac);
+ a++;
+ b++;
+ i++;
+ }
+
+ /* this values will be incremented at the end of the loop cycle */
+ a--; b--; i--;
+ }
+ else markers[i]= src_track->markers[a];
+ }
+ else markers[i]= dst_track->markers[b];
a++;
b++;
}
+
+ i++;
}
MEM_freeN(dst_track->markers);
- dst_track->markers= markers;
- dst_track->markersnr= tot;
+ dst_track->markers= MEM_callocN(i*sizeof(MovieTrackingMarker), "tracking joined tracks");
+ memcpy(dst_track->markers, markers, i*sizeof(MovieTrackingMarker));
+
+ dst_track->markersnr= i;
+
+ MEM_freeN(markers);
}
static void tracking_tracks_free(ListBase *tracks)
{
MovieTrackingTrack *track;
- for(track= tracks->first; track; track= track->next) {
+ for (track= tracks->first; track; track= track->next) {
BKE_tracking_free_track(track);
}
@@ -557,7 +592,7 @@ static void tracking_tracks_free(ListBase *tracks)
static void tracking_reconstruction_free(MovieTrackingReconstruction *reconstruction)
{
- if(reconstruction->cameras)
+ if (reconstruction->cameras)
MEM_freeN(reconstruction->cameras);
}
@@ -571,7 +606,7 @@ static void tracking_objects_free(ListBase *objects)
{
MovieTrackingObject *object;
- for(object= objects->first; object; object= object->next)
+ for (object= objects->first; object; object= object->next)
tracking_object_free(object);
BLI_freelistN(objects);
@@ -583,10 +618,10 @@ void BKE_tracking_free(MovieTracking *tracking)
tracking_reconstruction_free(&tracking->reconstruction);
tracking_objects_free(&tracking->objects);
- if(tracking->stabilization.scaleibuf)
+ if (tracking->stabilization.scaleibuf)
IMB_freeImBuf(tracking->stabilization.scaleibuf);
- if(tracking->camera.intrinsics)
+ if (tracking->camera.intrinsics)
BKE_tracking_distortion_destroy(tracking->camera.intrinsics);
}
@@ -685,7 +720,7 @@ static TracksMap *tracks_map_new(const char *object_name, int is_camera, int num
map->tracks= MEM_callocN(sizeof(MovieTrackingTrack)*num_tracks, "TrackingsMap tracks");
- if(customdata_size)
+ if (customdata_size)
map->customdata= MEM_callocN(customdata_size*num_tracks, "TracksMap customdata");
map->hash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "TracksMap hash");
@@ -702,7 +737,7 @@ static void tracks_map_get(TracksMap *map, int index, MovieTrackingTrack **track
{
*track= &map->tracks[index];
- if(map->customdata)
+ if (map->customdata)
*customdata= &map->customdata[index*map->customdata_size];
}
@@ -714,7 +749,7 @@ static void tracks_map_insert(TracksMap *map, MovieTrackingTrack *track, void *c
map->tracks[map->ptr]= new_track;
- if(customdata)
+ if (customdata)
memcpy(&map->customdata[map->ptr*map->customdata_size], customdata, map->customdata_size);
BLI_ghash_insert(map->hash, &map->tracks[map->ptr], track);
@@ -731,12 +766,13 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
ListBase *old_tracks;
int a;
- if(map->is_camera) {
+ if (map->is_camera) {
old_tracks= &tracking->tracks;
- } else {
+ }
+ else {
MovieTrackingObject *object= BKE_tracking_named_object(tracking, map->object_name);
- if(!object) {
+ if (!object) {
/* object was deleted by user, create new one */
object= BKE_tracking_new_object(tracking, map->object_name);
}
@@ -747,7 +783,7 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
/* duplicate currently operating tracks to temporary list.
* this is needed to keep names in unique state and it's faster to change names
* of currently operating tracks (if needed) */
- for(a= 0; a<map->num_tracks; a++) {
+ for (a= 0; a<map->num_tracks; a++) {
int replace_sel= 0, replace_rot= 0;
MovieTrackingTrack *new_track, *old;
@@ -755,21 +791,21 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
/* find original of operating track in list of previously displayed tracks */
old= BLI_ghash_lookup(map->hash, track);
- if(old) {
+ if (old) {
MovieTrackingTrack *cur= old_tracks->first;
- while(cur) {
- if(cur==old)
+ while (cur) {
+ if (cur==old)
break;
cur= cur->next;
}
/* original track was found, re-use flags and remove this track */
- if(cur) {
- if(cur==act_track)
+ if (cur) {
+ if (cur==act_track)
replace_sel= 1;
- if(cur==rot_track)
+ if (cur==rot_track)
replace_rot= 1;
track->flag= cur->flag;
@@ -786,10 +822,10 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
BLI_ghash_remove(map->hash, track, NULL, NULL); /* XXX: are we actually need this */
BLI_ghash_insert(map->hash, track, new_track);
- if(replace_sel) /* update current selection in clip */
+ if (replace_sel) /* update current selection in clip */
tracking->act_track= new_track;
- if(replace_rot) /* update track used for rotation stabilization */
+ if (replace_rot) /* update track used for rotation stabilization */
tracking->stabilization.rot_track= new_track;
BLI_addtail(&tracks, new_track);
@@ -797,7 +833,7 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
/* move all tracks, which aren't operating */
track= old_tracks->first;
- while(track) {
+ while (track) {
MovieTrackingTrack *next= track->next;
track->next= track->prev= NULL;
@@ -808,7 +844,7 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
/* now move all tracks which are currently operating and keep their names unique */
track= tracks.first;
- while(track) {
+ while (track) {
MovieTrackingTrack *next= track->next;
BLI_remlink(&tracks, track);
@@ -830,14 +866,14 @@ static void tracks_map_free(TracksMap *map, void (*customdata_free) (void *custo
BLI_ghash_free(map->hash, NULL, NULL);
- for(i= 0; i<map->num_tracks; i++) {
- if(map->customdata && customdata_free)
+ for (i= 0; i<map->num_tracks; i++) {
+ if (map->customdata && customdata_free)
customdata_free(&map->customdata[i*map->customdata_size]);
BKE_tracking_free_track(&map->tracks[i]);
}
- if(map->customdata)
+ if (map->customdata)
MEM_freeN(map->customdata);
MEM_freeN(map->tracks);
@@ -895,18 +931,18 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
/* count */
track= tracksbase->first;
- while(track) {
- if(TRACK_SELECTED(track) && (track->flag & (TRACK_LOCKED | TRACK_HIDDEN))==0) {
+ while (track) {
+ if (TRACK_SELECTED(track) && (track->flag & (TRACK_LOCKED | TRACK_HIDDEN))==0) {
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, user->framenr);
- if((marker->flag&MARKER_DISABLED)==0)
+ if ((marker->flag&MARKER_DISABLED)==0)
num_tracks++;
}
track= track->next;
}
- if(num_tracks) {
+ if (num_tracks) {
int width, height;
context->tracks_map= tracks_map_new(object->name, object->flag & TRACKING_OBJECT_CAMERA,
@@ -916,11 +952,11 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
/* create tracking data */
track= tracksbase->first;
- while(track) {
- if(TRACK_SELECTED(track) && (track->flag & (TRACK_HIDDEN | TRACK_LOCKED))==0) {
+ while (track) {
+ if (TRACK_SELECTED(track) && (track->flag & (TRACK_HIDDEN | TRACK_LOCKED))==0) {
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, user->framenr);
- if((marker->flag&MARKER_DISABLED)==0) {
+ if ((marker->flag&MARKER_DISABLED)==0) {
TrackContext track_context;
memset(&track_context, 0, sizeof(TrackContext));
@@ -931,7 +967,7 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
patx= (int)((track->pat_max[0]-track->pat_min[0])*width);
paty= (int)((track->pat_max[1]-track->pat_min[1])*height);
- if(ELEM(track->tracker, TRACKER_KLT, TRACKER_HYBRID)) {
+ if (ELEM(track->tracker, TRACKER_KLT, TRACKER_HYBRID)) {
float search_size_x= (track->search_max[0]-track->search_min[0])*width;
float search_size_y= (track->search_max[1]-track->search_min[1])*height;
float pattern_size_x= (track->pat_max[0]-track->pat_min[0])*width;
@@ -949,12 +985,12 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
* than the search size */
int level= MIN2(track->pyramid_levels, max_pyramid_levels);
- if(track->tracker==TRACKER_KLT)
+ if (track->tracker==TRACKER_KLT)
track_context.region_tracker= libmv_pyramidRegionTrackerNew(100, level, MAX2(wndx, wndy), track->minimum_correlation);
else
track_context.region_tracker= libmv_hybridRegionTrackerNew(100, MAX2(wndx, wndy), track->minimum_correlation);
}
- else if(track->tracker==TRACKER_SAD) {
+ else if (track->tracker==TRACKER_SAD) {
track_context.pattern_size= MAX2(patx, paty);
}
}
@@ -984,7 +1020,7 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
context->user.render_size= MCLIP_PROXY_RENDER_SIZE_FULL;
context->user.render_flag= 0;
- if(!sequence)
+ if (!sequence)
BLI_begin_threaded_malloc();
return context;
@@ -995,16 +1031,16 @@ static void track_context_free(void *customdata)
TrackContext *track_context= (TrackContext *)customdata;
#if WITH_LIBMV
- if(track_context->region_tracker)
+ if (track_context->region_tracker)
libmv_regionTrackerDestroy(track_context->region_tracker);
- if(track_context->patch)
+ if (track_context->patch)
MEM_freeN(track_context->patch);
- if(track_context->pattern)
+ if (track_context->pattern)
MEM_freeN(track_context->pattern);
- if(track_context->warped)
+ if (track_context->warped)
MEM_freeN(track_context->warped);
#else
(void) track_context;
@@ -1013,7 +1049,7 @@ static void track_context_free(void *customdata)
void BKE_tracking_context_free(MovieTrackingContext *context)
{
- if(!context->sequence)
+ if (!context->sequence)
BLI_end_threaded_malloc();
tracks_map_free(context->tracks_map, track_context_free);
@@ -1029,7 +1065,7 @@ void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disab
int x, y;
float scale;
- if(!disable_red && !disable_green && !disable_blue && !grayscale)
+ if (!disable_red && !disable_green && !disable_blue && !grayscale)
return;
/* If only some components are selected, it's important to rescale the result
@@ -1038,11 +1074,11 @@ void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disab
(disable_green ? 0.0f : 0.7152f) +
(disable_blue ? 0.0f : 0.0722f);
- for(y= 0; y<ibuf->y; y++) {
+ for (y= 0; y<ibuf->y; y++) {
for (x= 0; x<ibuf->x; x++) {
int pixel= ibuf->x*y + x;
- if(ibuf->rect_float) {
+ if (ibuf->rect_float) {
float *rrgbf= ibuf->rect_float + pixel*4;
float r = disable_red ? 0.0f : rrgbf[0];
float g = disable_green ? 0.0f : rrgbf[1];
@@ -1050,12 +1086,14 @@ void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disab
if (grayscale) {
float gray = (0.2126f*r + 0.7152f*g + 0.0722f*b) / scale;
rrgbf[0] = rrgbf[1] = rrgbf[2] = gray;
- } else {
+ }
+ else {
rrgbf[0] = r;
rrgbf[1] = g;
rrgbf[2] = b;
}
- } else {
+ }
+ else {
char *rrgb= (char*)ibuf->rect + pixel*4;
char r = disable_red ? 0 : rrgb[0];
char g = disable_green ? 0 : rrgb[1];
@@ -1063,7 +1101,8 @@ void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disab
if (grayscale) {
float gray = (0.2126f*r + 0.7152f*g + 0.0722f*b) / scale;
rrgb[0] = rrgb[1] = rrgb[2] = gray;
- } else {
+ }
+ else {
rrgb[0] = r;
rrgb[1] = g;
rrgb[2] = b;
@@ -1088,10 +1127,10 @@ static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTracki
float mpos[2];
copy_v2_v2(mpos, marker->pos);
- if(anchored)
+ if (anchored)
add_v2_v2(mpos, track->offset);
- if(pos)
+ if (pos)
zero_v2(pos);
x= mpos[0]*ibuf->x;
@@ -1110,17 +1149,17 @@ static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTracki
tmpibuf= IMB_allocImBuf(w+margin*2, h+margin*2, 32, IB_rect);
IMB_rectcpy(tmpibuf, ibuf, 0, 0, x1-margin, y1-margin, w+margin*2, h+margin*2);
- if(pos != NULL) {
+ if (pos != NULL) {
pos[0]= mpos[0]*ibuf->x-x1+margin;
pos[1]= mpos[1]*ibuf->y-y1+margin;
}
- if(origin != NULL) {
+ if (origin != NULL) {
origin[0]= x1-margin;
origin[1]= y1-margin;
}
- if((track->flag & TRACK_PREVIEW_GRAYSCALE) ||
+ if ((track->flag & TRACK_PREVIEW_GRAYSCALE) ||
(track->flag & TRACK_DISABLE_RED) ||
(track->flag & TRACK_DISABLE_GREEN) ||
(track->flag & TRACK_DISABLE_BLUE))
@@ -1161,14 +1200,15 @@ static float *get_search_floatbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieT
*height_r= height;
fp= pixels= MEM_callocN(width*height*sizeof(float), "tracking floatBuf");
- for(y= 0; y<(int)height; y++) {
+ for (y= 0; y<(int)height; y++) {
for (x= 0; x<(int)width; x++) {
int pixel= tmpibuf->x*y + x;
- if(tmpibuf->rect_float) {
+ if (tmpibuf->rect_float) {
float *rrgbf= tmpibuf->rect_float + pixel*4;
*fp= 0.2126*rrgbf[0] + 0.7152*rrgbf[1] + 0.0722*rrgbf[2];
- } else {
+ }
+ else {
unsigned char *rrgb= (unsigned char*)tmpibuf->rect + pixel*4;
*fp= (0.2126*rrgb[0] + 0.7152*rrgb[1] + 0.0722*rrgb[2])/255.0f;
}
@@ -1187,15 +1227,16 @@ static unsigned char *get_ucharbuf(ImBuf *ibuf)
unsigned char *pixels, *cp;
cp= pixels= MEM_callocN(ibuf->x*ibuf->y*sizeof(unsigned char), "tracking ucharBuf");
- for(y= 0; y<ibuf->y; y++) {
+ for (y= 0; y<ibuf->y; y++) {
for (x= 0; x<ibuf->x; x++) {
int pixel= ibuf->x*y + x;
- if(ibuf->rect_float) {
+ if (ibuf->rect_float) {
const float *rrgbf= ibuf->rect_float + pixel*4;
const float grey_f= 0.2126f*rrgbf[0] + 0.7152f*rrgbf[1] + 0.0722f*rrgbf[2];
*cp= FTOCHAR(grey_f);
- } else {
+ }
+ else {
const unsigned char *rrgb= (unsigned char*)ibuf->rect + pixel*4;
*cp= 0.2126f*rrgb[0] + 0.7152f*rrgb[1] + 0.0722f*rrgb[2];
}
@@ -1245,22 +1286,22 @@ static ImBuf *get_keyframed_ibuf(MovieTrackingContext *context, MovieTrackingTra
*marker_keyed= marker;
- while(a>=0 && a<track->markersnr) {
+ while (a>=0 && a<track->markersnr) {
int next= (context->backwards) ? a+1 : a-1;
int is_keyframed= 0;
MovieTrackingMarker *cur_marker= &track->markers[a];
MovieTrackingMarker *next_marker= NULL;
- if(next>=0 && next<track->markersnr)
+ if (next>=0 && next<track->markersnr)
next_marker= &track->markers[next];
/* if next mrker is disabled, stop searching keyframe and use current frame as keyframe */
- if(next_marker && next_marker->flag&MARKER_DISABLED)
+ if (next_marker && next_marker->flag&MARKER_DISABLED)
is_keyframed= 1;
is_keyframed|= (cur_marker->flag&MARKER_TRACKED)==0;
- if(is_keyframed) {
+ if (is_keyframed) {
framenr= cur_marker->framenr;
*marker_keyed= cur_marker;
break;
@@ -1277,9 +1318,10 @@ static ImBuf *get_adjust_ibuf(MovieTrackingContext *context, MovieTrackingTrack
{
ImBuf *ibuf= NULL;
- if(track->pattern_match == TRACK_MATCH_KEYFRAME) {
+ if (track->pattern_match == TRACK_MATCH_KEYFRAME) {
ibuf= get_keyframed_ibuf(context, track, marker, marker_keyed);
- } else {
+ }
+ else {
ibuf= get_frame_ibuf(context, curfra);
/* use current marker as keyframed position */
@@ -1293,8 +1335,8 @@ static void get_warped(TrackContext *track_context, int x, int y, int width, uns
{
int i, j;
- for(i=0; i<track_context->pattern_size; i++) {
- for(j=0; j<track_context->pattern_size; j++) {
+ for (i=0; i<track_context->pattern_size; i++) {
+ for (j=0; j<track_context->pattern_size; j++) {
track_context->warped[i*track_context->pattern_size+j]=
image[(y+i-track_context->pattern_size/2)*width+x+j-track_context->pattern_size/2];
}
@@ -1310,7 +1352,7 @@ void BKE_tracking_sync(MovieTrackingContext *context)
tracks_map_merge(context->tracks_map, tracking);
- if(context->backwards) newframe= context->user.framenr+1;
+ if (context->backwards) newframe= context->user.framenr+1;
else newframe= context->user.framenr-1;
context->sync_frame= newframe;
@@ -1330,18 +1372,18 @@ int BKE_tracking_next(MovieTrackingContext *context)
map_size= tracks_map_size(context->tracks_map);
/* nothing to track, avoid unneeded frames reading to save time and memory */
- if(!map_size)
+ if (!map_size)
return 0;
- if(context->backwards) context->user.framenr--;
+ if (context->backwards) context->user.framenr--;
else context->user.framenr++;
ibuf_new= BKE_movieclip_get_ibuf_flag(context->clip, &context->user, context->clip_flag, MOVIECLIP_CACHE_SKIP);
- if(!ibuf_new)
+ if (!ibuf_new)
return 0;
- #pragma omp parallel for private(a) shared(ibuf_new, ok) if(map_size>1)
- for(a= 0; a<map_size; a++) {
+ #pragma omp parallel for private(a) shared(ibuf_new, ok) if (map_size>1)
+ for (a= 0; a<map_size; a++) {
TrackContext *track_context = NULL;
MovieTrackingTrack *track;
MovieTrackingMarker *marker;
@@ -1350,7 +1392,7 @@ int BKE_tracking_next(MovieTrackingContext *context)
marker= BKE_tracking_exact_marker(track, curfra);
- if(marker && (marker->flag&MARKER_DISABLED)==0) {
+ if (marker && (marker->flag&MARKER_DISABLED)==0) {
#ifdef WITH_LIBMV
int width, height, origin[2], tracked= 0, need_readjust= 0;
float pos[2], margin[2], dim[2];
@@ -1359,12 +1401,12 @@ int BKE_tracking_next(MovieTrackingContext *context)
MovieTrackingMarker marker_new, *marker_keyed;
int onbound= 0, nextfra;
- if(track->pattern_match==TRACK_MATCH_KEYFRAME)
+ if (track->pattern_match==TRACK_MATCH_KEYFRAME)
need_readjust= context->first_time;
else
need_readjust= 1;
- if(context->backwards) nextfra= curfra-1;
+ if (context->backwards) nextfra= curfra-1;
else nextfra= curfra+1;
/* margin from frame boundaries */
@@ -1375,18 +1417,18 @@ int BKE_tracking_next(MovieTrackingContext *context)
margin[1]= MAX2(margin[1], (float)track->margin / ibuf_new->y);
/* do not track markers which are too close to boundary */
- if(marker->pos[0]<margin[0] || marker->pos[0]>1.0f-margin[0] ||
+ if (marker->pos[0]<margin[0] || marker->pos[0]>1.0f-margin[0] ||
marker->pos[1]<margin[1] || marker->pos[1]>1.0f-margin[1]) {
onbound= 1;
}
- else if(ELEM(track->tracker, TRACKER_KLT, TRACKER_HYBRID)) {
+ else if (ELEM(track->tracker, TRACKER_KLT, TRACKER_HYBRID)) {
float *patch_new;
- if(need_readjust) {
+ if (need_readjust) {
/* calculate patch for keyframed position */
ibuf= get_adjust_ibuf(context, track, marker, curfra, &marker_keyed);
- if(track_context->patch)
+ if (track_context->patch)
MEM_freeN(track_context->patch);
track_context->patch= get_search_floatbuf(ibuf, track, marker_keyed, &width, &height, track_context->keyframed_pos, origin);
@@ -1407,12 +1449,12 @@ int BKE_tracking_next(MovieTrackingContext *context)
MEM_freeN(patch_new);
}
- else if(track->tracker==TRACKER_SAD) {
+ else if (track->tracker==TRACKER_SAD) {
unsigned char *image_new;
float correlation;
float warp[3][2]={{0}};
- if(need_readjust) {
+ if (need_readjust) {
unsigned char *image;
/* calculate pattern for keyframed position */
@@ -1426,7 +1468,7 @@ int BKE_tracking_next(MovieTrackingContext *context)
warp[2][0]= pos[0];
warp[2][1]= pos[1];
- if(!track_context->pattern) {
+ if (!track_context->pattern) {
int square= track_context->pattern_size*track_context->pattern_size;
track_context->pattern= MEM_callocN(sizeof(unsigned char)*square, "trackking pattern");
}
@@ -1439,12 +1481,12 @@ int BKE_tracking_next(MovieTrackingContext *context)
image_new= get_search_bytebuf(ibuf_new, track, marker, &width, &height, pos, origin);
- if(track_context->warped==NULL) {
+ if (track_context->warped==NULL) {
unsigned char *image_old;
ibuf= get_frame_ibuf(context, curfra);
- if(track_context->warped==NULL) {
+ if (track_context->warped==NULL) {
int square= track_context->pattern_size*track_context->pattern_size;
track_context->warped= MEM_callocN(sizeof(unsigned char)*square, "trackking warped");
}
@@ -1469,14 +1511,14 @@ int BKE_tracking_next(MovieTrackingContext *context)
tracked= track->minimum_correlation < correlation;
- if(tracked)
+ if (tracked)
get_warped(track_context, x2, y2, width, image_new);
MEM_freeN(image_new);
}
- if(tracked && !onbound && finite(x2) && finite(y2)) {
- if(context->first_time) {
+ if (tracked && !onbound && finite(x2) && finite(y2)) {
+ if (context->first_time) {
#pragma omp critical
{
/* check if there's no keyframe/tracked markers before tracking marker.
@@ -1487,10 +1529,11 @@ int BKE_tracking_next(MovieTrackingContext *context)
memset(&marker_new, 0, sizeof(marker_new));
- if(!onbound) {
+ if (!onbound) {
marker_new.pos[0]= (origin[0]+x2)/ibuf_new->x;
marker_new.pos[1]= (origin[1]+y2)/ibuf_new->y;
- } else {
+ }
+ else {
copy_v2_v2(marker_new.pos, marker->pos);
}
@@ -1507,7 +1550,8 @@ int BKE_tracking_next(MovieTrackingContext *context)
{
put_disabled_marker(track, &marker_new, context->backwards, 0);
}
- } else {
+ }
+ else {
marker_new= *marker;
marker_new.framenr= nextfra;
@@ -1572,13 +1616,13 @@ static struct libmv_Tracks *create_libmv_tracks(ListBase *tracksbase, int width,
struct libmv_Tracks *tracks= libmv_tracksNew();
track= tracksbase->first;
- while(track) {
+ while (track) {
int a= 0;
- for(a= 0; a<track->markersnr; a++) {
+ for (a= 0; a<track->markersnr; a++) {
MovieTrackingMarker *marker= &track->markers[a];
- if((marker->flag&MARKER_DISABLED)==0)
+ if ((marker->flag&MARKER_DISABLED)==0)
libmv_tracksInsert(tracks, marker->framenr, tracknr,
marker->pos[0]*width, marker->pos[1]*height);
}
@@ -1623,7 +1667,7 @@ static int retrieve_libmv_reconstruct_tracks(MovieReconstructContext *context, M
int sfra= context->sfra, efra= context->efra;
float imat[4][4];
- if(context->is_camera) {
+ if (context->is_camera) {
tracksbase= &tracking->tracks;
reconstruction= &tracking->reconstruction;
}
@@ -1637,17 +1681,18 @@ static int retrieve_libmv_reconstruct_tracks(MovieReconstructContext *context, M
unit_m4(imat);
track= tracksbase->first;
- while(track) {
+ while (track) {
double pos[3];
- if(libmv_reporojectionPointForTrack(libmv_reconstruction, tracknr, pos)) {
+ if (libmv_reporojectionPointForTrack(libmv_reconstruction, tracknr, pos)) {
track->bundle_pos[0]= pos[0];
track->bundle_pos[1]= pos[1];
track->bundle_pos[2]= pos[2];
track->flag|= TRACK_HAS_BUNDLE;
track->error= libmv_reporojectionErrorForTrack(libmv_reconstruction, tracknr);
- } else {
+ }
+ else {
track->flag&= ~TRACK_HAS_BUNDLE;
ok= 0;
@@ -1658,53 +1703,54 @@ static int retrieve_libmv_reconstruct_tracks(MovieReconstructContext *context, M
tracknr++;
}
- if(reconstruction->cameras)
+ if (reconstruction->cameras)
MEM_freeN(reconstruction->cameras);
reconstruction->camnr= 0;
reconstruction->cameras= NULL;
reconstructed= MEM_callocN((efra-sfra+1)*sizeof(MovieReconstructedCamera), "temp reconstructed camera");
- for(a= sfra; a<=efra; a++) {
+ for (a= sfra; a<=efra; a++) {
double matd[4][4];
- if(libmv_reporojectionCameraForImage(libmv_reconstruction, a, matd)) {
+ if (libmv_reporojectionCameraForImage(libmv_reconstruction, a, matd)) {
int i, j;
float mat[4][4];
float error= libmv_reporojectionErrorForImage(libmv_reconstruction, a);
- for(i=0; i<4; i++)
- for(j= 0; j<4; j++)
+ for (i=0; i<4; i++)
+ for (j= 0; j<4; j++)
mat[i][j]= matd[i][j];
- if(!origin_set) {
+ if (!origin_set) {
copy_m4_m4(imat, mat);
invert_m4(imat);
origin_set= 1;
}
- if(origin_set)
+ if (origin_set)
mult_m4_m4m4(mat, imat, mat);
copy_m4_m4(reconstructed[reconstruction->camnr].mat, mat);
reconstructed[reconstruction->camnr].framenr= a;
reconstructed[reconstruction->camnr].error= error;
reconstruction->camnr++;
- } else {
+ }
+ else {
ok= 0;
printf("No camera for frame %d\n", a);
}
}
- if(reconstruction->camnr) {
+ if (reconstruction->camnr) {
reconstruction->cameras= MEM_callocN(reconstruction->camnr*sizeof(MovieReconstructedCamera), "reconstructed camera");
memcpy(reconstruction->cameras, reconstructed, reconstruction->camnr*sizeof(MovieReconstructedCamera));
}
- if(origin_set) {
+ if (origin_set) {
track= tracksbase->first;
- while(track) {
- if(track->flag&TRACK_HAS_BUNDLE)
+ while (track) {
+ if (track->flag&TRACK_HAS_BUNDLE)
mul_v3_m4v3(track->bundle_pos, imat, track->bundle_pos);
track= track->next;
@@ -1729,19 +1775,19 @@ static int get_refine_intrinsics_flags(MovieTracking *tracking, MovieTrackingObj
int refine= tracking->settings.refine_camera_intrinsics;
int flags= 0;
- if((object->flag&TRACKING_OBJECT_CAMERA)==0)
+ if ((object->flag&TRACKING_OBJECT_CAMERA)==0)
return 0;
- if(refine&REFINE_FOCAL_LENGTH)
+ if (refine&REFINE_FOCAL_LENGTH)
flags|= LIBMV_REFINE_FOCAL_LENGTH;
- if(refine&REFINE_PRINCIPAL_POINT)
+ if (refine&REFINE_PRINCIPAL_POINT)
flags|= LIBMV_REFINE_PRINCIPAL_POINT;
- if(refine&REFINE_RADIAL_DISTORTION_K1)
+ if (refine&REFINE_RADIAL_DISTORTION_K1)
flags|= REFINE_RADIAL_DISTORTION_K1;
- if(refine&REFINE_RADIAL_DISTORTION_K2)
+ if (refine&REFINE_RADIAL_DISTORTION_K2)
flags|= REFINE_RADIAL_DISTORTION_K2;
return flags;
@@ -1754,9 +1800,9 @@ static int count_tracks_on_both_keyframes(MovieTracking *tracking, ListBase *tra
MovieTrackingTrack *track;
track= tracksbase->first;
- while(track) {
- if(BKE_tracking_has_enabled_marker(track, frame1))
- if(BKE_tracking_has_enabled_marker(track, frame2))
+ while (track) {
+ if (BKE_tracking_has_enabled_marker(track, frame1))
+ if (BKE_tracking_has_enabled_marker(track, frame2))
tot++;
track= track->next;
@@ -1771,7 +1817,7 @@ int BKE_tracking_can_reconstruct(MovieTracking *tracking, MovieTrackingObject *o
#if WITH_LIBMV
ListBase *tracksbase= BKE_tracking_object_tracks(tracking, object);
- if(count_tracks_on_both_keyframes(tracking, tracksbase)<8) {
+ if (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 0;
}
@@ -1803,27 +1849,27 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
context->tracks_map= tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
track= tracksbase->first;
- while(track) {
+ while (track) {
int first= 0, last= track->markersnr-1;
MovieTrackingMarker *first_marker= &track->markers[0];
MovieTrackingMarker *last_marker= &track->markers[track->markersnr-1];
/* find first not-disabled marker */
- while(first<=track->markersnr-1 && first_marker->flag&MARKER_DISABLED) {
+ while (first<=track->markersnr-1 && first_marker->flag&MARKER_DISABLED) {
first++;
first_marker++;
}
/* find last not-disabled marker */
- while(last>=0 && last_marker->flag&MARKER_DISABLED) {
+ while (last>=0 && last_marker->flag&MARKER_DISABLED) {
last--;
last_marker--;
}
- if(first<track->markersnr-1)
+ if (first<track->markersnr-1)
sfra= MIN2(sfra, first_marker->framenr);
- if(last>=0)
+ if (last>=0)
efra= MAX2(efra, last_marker->framenr);
tracks_map_insert(context->tracks_map, track, NULL);
@@ -1860,7 +1906,7 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
void BKE_tracking_reconstruction_context_free(MovieReconstructContext *context)
{
#ifdef WITH_LIBMV
- if(context->reconstruction)
+ if (context->reconstruction)
libmv_destroyReconstruction(context->reconstruction);
libmv_tracksDestroy(context->tracks);
@@ -1876,7 +1922,7 @@ static void solve_reconstruction_update_cb(void *customdata, double progress, co
{
ReconstructProgressData *progressdata= customdata;
- if(progressdata->progress) {
+ if (progressdata->progress) {
*progressdata->progress= progress;
*progressdata->do_update= 1;
}
@@ -1891,7 +1937,7 @@ static int solve_reconstruction_testbreak_cb(void *customdata)
{
ReconstructProgressData *progressdata= customdata;
- if(progressdata->stop && *progressdata->stop)
+ if (progressdata->stop && *progressdata->stop)
return 1;
return G.afbreek;
@@ -1939,7 +1985,7 @@ int BKE_tracking_finish_reconstruction(MovieReconstructContext *context, MovieTr
tracks_map_merge(context->tracks_map, tracking);
- if(context->is_camera) {
+ if (context->is_camera) {
reconstruction= &tracking->reconstruction;
}
else {
@@ -1953,7 +1999,7 @@ int BKE_tracking_finish_reconstruction(MovieReconstructContext *context, MovieTr
reconstruction->flag|= TRACKING_RECONSTRUCTED;
#ifdef WITH_LIBMV
- if(!retrieve_libmv_reconstruct(context, tracking))
+ if (!retrieve_libmv_reconstruct(context, tracking))
return 0;
#endif
@@ -1970,8 +2016,8 @@ MovieTrackingTrack *BKE_tracking_named_track(MovieTracking *tracking, MovieTrack
ListBase *tracksbase= BKE_tracking_object_tracks(tracking, object);
MovieTrackingTrack *track= tracksbase->first;
- while(track) {
- if(!strcmp(track->name, name))
+ while (track) {
+ if (!strcmp(track->name, name))
return track;
track= track->next;
@@ -1985,43 +2031,43 @@ static int reconstruction_camera_index(MovieTrackingReconstruction *reconstructi
MovieReconstructedCamera *cameras= reconstruction->cameras;
int a= 0, d= 1;
- if(!reconstruction->camnr)
+ if (!reconstruction->camnr)
return -1;
- if(framenr<cameras[0].framenr) {
- if(nearest) return 0;
+ if (framenr<cameras[0].framenr) {
+ if (nearest) return 0;
else return -1;
}
- if(framenr>cameras[reconstruction->camnr-1].framenr) {
- if(nearest) return reconstruction->camnr-1;
+ if (framenr>cameras[reconstruction->camnr-1].framenr) {
+ if (nearest) return reconstruction->camnr-1;
else return -1;
}
- if(reconstruction->last_camera<reconstruction->camnr)
+ if (reconstruction->last_camera<reconstruction->camnr)
a= reconstruction->last_camera;
- if(cameras[a].framenr>=framenr)
+ if (cameras[a].framenr>=framenr)
d= -1;
- while(a>=0 && a<reconstruction->camnr) {
+ while (a>=0 && a<reconstruction->camnr) {
int cfra= cameras[a].framenr;
/* check if needed framenr was "skipped" -- no data for requested frame */
- if(d>0 && cfra>framenr) {
+ if (d>0 && cfra>framenr) {
/* interpolate with previous position */
- if(nearest) return a-1;
+ if (nearest) return a-1;
else break;
}
- if(d<0 && cfra<framenr) {
+ if (d<0 && cfra<framenr) {
/* interpolate with next position */
- if(nearest) return a;
+ if (nearest) return a;
else break;
}
- if(cfra==framenr) {
+ if (cfra==framenr) {
reconstruction->last_camera= a;
return a;
@@ -2035,7 +2081,7 @@ static int reconstruction_camera_index(MovieTrackingReconstruction *reconstructi
static void scale_reconstructed_camera(MovieTrackingObject *object, float mat[4][4])
{
- if((object->flag&TRACKING_OBJECT_CAMERA)==0) {
+ if ((object->flag&TRACKING_OBJECT_CAMERA)==0) {
float smat[4][4];
scale_m4_fl(smat, 1.0f/object->scale);
@@ -2052,7 +2098,7 @@ MovieReconstructedCamera *BKE_tracking_get_reconstructed_camera(MovieTracking *t
reconstruction= BKE_tracking_object_reconstruction(tracking, object);
a= reconstruction_camera_index(reconstruction, framenr, 0);
- if(a==-1)
+ if (a==-1)
return NULL;
return &reconstruction->cameras[a];
@@ -2069,16 +2115,17 @@ void BKE_tracking_get_interpolated_camera(MovieTracking *tracking, MovieTracking
cameras= reconstruction->cameras;
a= reconstruction_camera_index(reconstruction, framenr, 1);
- if(a==-1) {
+ if (a==-1) {
unit_m4(mat);
return;
}
- if(cameras[a].framenr!=framenr && a>0 && a<reconstruction->camnr-1) {
+ if (cameras[a].framenr!=framenr && a>0 && a<reconstruction->camnr-1) {
float t= ((float)framenr-cameras[a].framenr) / (cameras[a+1].framenr-cameras[a].framenr);
blend_m4_m4m4(mat, cameras[a].mat, cameras[a+1].mat, t);
- } else {
+ }
+ else {
copy_m4_m4(mat, cameras[a].mat);
}
@@ -2087,12 +2134,12 @@ void BKE_tracking_get_interpolated_camera(MovieTracking *tracking, MovieTracking
void BKE_get_tracking_mat(Scene *scene, Object *ob, float mat[4][4])
{
- if(!ob) {
- if(scene->camera) ob= scene->camera;
+ if (!ob) {
+ if (scene->camera) ob= scene->camera;
else ob= scene_find_camera(scene);
}
- if(ob)
+ if (ob)
where_is_object_mat(scene, ob, mat);
else
unit_m4(mat);
@@ -2136,7 +2183,7 @@ void BKE_tracking_projection_matrix(MovieTracking *tracking, MovieTrackingObject
clipsta= 0.1f;
clipend= 1000.0f;
- if(winx >= winy)
+ if (winx >= winy)
viewfac= (lens*winx)/tracking->camera.sensor_width;
else
viewfac= (ycor*lens*winy)/tracking->camera.sensor_width;
@@ -2157,19 +2204,20 @@ void BKE_tracking_projection_matrix(MovieTracking *tracking, MovieTrackingObject
camera= BKE_tracking_get_reconstructed_camera(tracking, object, framenr);
- if(camera) {
+ if (camera) {
float imat[4][4];
invert_m4_m4(imat, camera->mat);
mult_m4_m4m4(mat, winmat, imat);
- } else copy_m4_m4(mat, winmat);
+ }
+ else copy_m4_m4(mat, winmat);
}
ListBase *BKE_tracking_get_tracks(MovieTracking *tracking)
{
MovieTrackingObject *object= BKE_tracking_active_object(tracking);
- if(object && (object->flag & TRACKING_OBJECT_CAMERA) == 0) {
+ if (object && (object->flag & TRACKING_OBJECT_CAMERA) == 0) {
return &object->tracks;
}
@@ -2180,13 +2228,13 @@ MovieTrackingTrack *BKE_tracking_active_track(MovieTracking *tracking)
{
ListBase *tracksbase;
- if(!tracking->act_track)
+ if (!tracking->act_track)
return NULL;
tracksbase= BKE_tracking_get_tracks(tracking);
/* check that active track is in current tracks list */
- if(BLI_findindex(tracksbase, tracking->act_track) >= 0)
+ if (BLI_findindex(tracksbase, tracking->act_track) >= 0)
return tracking->act_track;
return NULL;
@@ -2201,8 +2249,8 @@ MovieTrackingObject *BKE_tracking_get_camera_object(MovieTracking *tracking)
{
MovieTrackingObject *object= tracking->objects.first;
- while(object) {
- if(object->flag & TRACKING_OBJECT_CAMERA)
+ while (object) {
+ if (object->flag & TRACKING_OBJECT_CAMERA)
return object;
object= object->next;
@@ -2213,7 +2261,7 @@ MovieTrackingObject *BKE_tracking_get_camera_object(MovieTracking *tracking)
ListBase *BKE_tracking_object_tracks(MovieTracking *tracking, MovieTrackingObject *object)
{
- if(object->flag & TRACKING_OBJECT_CAMERA) {
+ if (object->flag & TRACKING_OBJECT_CAMERA) {
return &tracking->tracks;
}
@@ -2222,7 +2270,7 @@ ListBase *BKE_tracking_object_tracks(MovieTracking *tracking, MovieTrackingObjec
MovieTrackingReconstruction *BKE_tracking_object_reconstruction(MovieTracking *tracking, MovieTrackingObject *object)
{
- if(object->flag & TRACKING_OBJECT_CAMERA) {
+ if (object->flag & TRACKING_OBJECT_CAMERA) {
return &tracking->reconstruction;
}
@@ -2290,8 +2338,8 @@ static int point_in_stroke(bGPDstroke *stroke, float x, float y)
prev= stroke->totpoints-1;
- for(i= 0; i<stroke->totpoints; i++) {
- if((points[i].y<y && points[prev].y>=y) || (points[prev].y<y && points[i].y>=y)) {
+ for (i= 0; i<stroke->totpoints; i++) {
+ if ((points[i].y<y && points[prev].y>=y) || (points[prev].y<y && points[i].y>=y)) {
float fac= (y-points[i].y)/(points[prev].y-points[i].y);
if (points[i].x+fac*(points[prev].x-points[i].x)<x)
@@ -2308,10 +2356,10 @@ static int point_in_layer(bGPDlayer *layer, float x, float y)
{
bGPDframe *frame= layer->frames.first;
- while(frame) {
+ while (frame) {
bGPDstroke *stroke= frame->strokes.first;
- while(stroke) {
- if(point_in_stroke(stroke, x, y))
+ while (stroke) {
+ if (point_in_stroke(stroke, x, y))
return 1;
stroke= stroke->next;
@@ -2329,7 +2377,7 @@ static void retrieve_libmv_features(MovieTracking *tracking, ListBase *tracksbas
int a;
a= libmv_countFeatures(features);
- while(a--) {
+ while (a--) {
MovieTrackingTrack *track;
double x, y, size, score;
int ok= 1;
@@ -2340,10 +2388,10 @@ static void retrieve_libmv_features(MovieTracking *tracking, ListBase *tracksbas
xu= x/width;
yu= y/height;
- if(layer)
+ if (layer)
ok= point_in_layer(layer, xu, yu)!=place_outside_layer;
- if(ok) {
+ if (ok) {
track= BKE_tracking_add_track(tracking, tracksbase, xu, yu, framenr, width, height);
track->flag|= SELECT;
track->pat_flag|= SELECT;
@@ -2389,13 +2437,13 @@ MovieTrackingTrack *BKE_tracking_indexed_track(MovieTracking *tracking, int trac
int cur= 1;
object= tracking->objects.first;
- while(object) {
+ while (object) {
ListBase *tracksbase= BKE_tracking_object_tracks(tracking, object);
MovieTrackingTrack *track= tracksbase->first;
- while(track) {
- if(track->flag&TRACK_HAS_BUNDLE) {
- if(cur==tracknr) {
+ while (track) {
+ if (track->flag&TRACK_HAS_BUNDLE) {
+ if (cur==tracknr) {
*tracksbase_r= tracksbase;
return track;
}
@@ -2425,8 +2473,8 @@ static int stabilization_median_point(MovieTracking *tracking, int framenr, floa
(void) tracking;
track= tracking->tracks.first;
- while(track) {
- if(track->flag&TRACK_USE_2D_STAB) {
+ while (track) {
+ if (track->flag&TRACK_USE_2D_STAB) {
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
DO_MINMAX2(marker->pos, min, max);
@@ -2456,7 +2504,7 @@ static void calculate_stabdata(MovieTracking *tracking, int framenr, float width
mul_v2_fl(loc, stab->locinf);
- if((stab->flag&TRACKING_STABILIZE_ROTATION) && stab->rot_track && stab->rotinf) {
+ if ((stab->flag&TRACKING_STABILIZE_ROTATION) && stab->rot_track && stab->rotinf) {
MovieTrackingMarker *marker;
float a[2], b[2];
float x0= (float)width/2.0f, y0= (float)height/2.0f;
@@ -2487,10 +2535,10 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
MovieTrackingStabilization *stab= &tracking->stabilization;
float aspect= tracking->camera.pixel_aspect;
- if(stab->ok)
+ if (stab->ok)
return stab->scale;
- if(stabilization_median_point(tracking, 1, firstmedian)) {
+ if (stabilization_median_point(tracking, 1, firstmedian)) {
int sfra= INT_MAX, efra= INT_MIN, cfra;
float scale= 1.0f;
MovieTrackingTrack *track;
@@ -2498,8 +2546,8 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
stab->scale= 1.0f;
track= tracking->tracks.first;
- while(track) {
- if(track->flag&TRACK_USE_2D_STAB ||
+ while (track) {
+ if (track->flag&TRACK_USE_2D_STAB ||
((stab->flag&TRACKING_STABILIZE_ROTATION) && track==stab->rot_track)) {
sfra= MIN2(sfra, track->markers[0].framenr);
efra= MAX2(efra, track->markers[track->markersnr-1].framenr);
@@ -2508,7 +2556,7 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
track= track->next;
}
- for(cfra=sfra; cfra<=efra; cfra++) {
+ for (cfra=sfra; cfra<=efra; cfra++) {
float median[2];
float loc[2], angle, tmp_scale;
int i;
@@ -2525,7 +2573,7 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
si = sin(angle);
co = cos(angle);
- for(i= 0; i<4; i++) {
+ for (i= 0; i<4; i++) {
int j;
float a[3]= {0.0f, 0.0f, 0.0f}, b[3]= {0.0f, 0.0f, 0.0f};
@@ -2535,14 +2583,14 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
mul_m4_v3(mat, a);
mul_m4_v3(mat, b);
- for(j= 0; j<4; j++) {
+ for (j= 0; j<4; j++) {
float point[3]= {points[j][0], points[j][1], 0.0f};
float v1[3], v2[3];
sub_v3_v3v3(v1, b, a);
sub_v3_v3v3(v2, point, a);
- if(cross_v2v2(v1, v2) >= 0.0f) {
+ if (cross_v2v2(v1, v2) >= 0.0f) {
const float rotDx[4][2] = {{1.0f, 0.0f}, {0.0f, -1.0f}, {-1.0f, 0.0f}, {0.0f, 1.0f}};
const float rotDy[4][2] = {{0.0f, 1.0f}, {1.0f, 0.0f}, {0.0f, -1.0f}, {-1.0f, 0.0f}};
@@ -2551,7 +2599,7 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
float w, h, E, F, G, H, I, J, K, S;
- if(j % 2) {
+ if (j % 2) {
w = (float)height / 2.0f;
h = (float)width / 2.0f;
}
@@ -2586,9 +2634,10 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
stab->scale= scale;
- if(stab->maxscale>0.0f)
+ if (stab->maxscale>0.0f)
stab->scale= MIN2(stab->scale, stab->maxscale);
- } else {
+ }
+ else {
stab->scale= 1.0f;
}
@@ -2601,18 +2650,18 @@ static ImBuf* stabilize_alloc_ibuf(ImBuf *cacheibuf, ImBuf *srcibuf, int fill)
{
int flags;
- if(cacheibuf && (cacheibuf->x != srcibuf->x || cacheibuf->y != srcibuf->y)) {
+ if (cacheibuf && (cacheibuf->x != srcibuf->x || cacheibuf->y != srcibuf->y)) {
IMB_freeImBuf(cacheibuf);
cacheibuf= NULL;
}
flags= IB_rect;
- if(srcibuf->rect_float)
+ if (srcibuf->rect_float)
flags|= IB_rectfloat;
- if(cacheibuf) {
- if(fill) {
+ if (cacheibuf) {
+ if (fill) {
float col[4]= {0.0f, 0.0f, 0.0f, 0.0f};
IMB_rectfill(cacheibuf, col);
}
@@ -2630,7 +2679,7 @@ void BKE_tracking_stabilization_data(MovieTracking *tracking, int framenr, int w
float firstmedian[2], median[2];
MovieTrackingStabilization *stab= &tracking->stabilization;
- if((stab->flag&TRACKING_2D_STABILIZATION)==0) {
+ if ((stab->flag&TRACKING_2D_STABILIZATION)==0) {
zero_v2(loc);
*scale= 1.0f;
*angle= 0.0f;
@@ -2638,23 +2687,25 @@ void BKE_tracking_stabilization_data(MovieTracking *tracking, int framenr, int w
return;
}
- if(stabilization_median_point(tracking, 1, firstmedian)) {
+ if (stabilization_median_point(tracking, 1, firstmedian)) {
stabilization_median_point(tracking, framenr, median);
- if((stab->flag&TRACKING_AUTOSCALE)==0)
+ if ((stab->flag&TRACKING_AUTOSCALE)==0)
stab->scale= 1.0f;
- if(!stab->ok) {
- if(stab->flag&TRACKING_AUTOSCALE)
+ if (!stab->ok) {
+ if (stab->flag&TRACKING_AUTOSCALE)
stabilization_auto_scale_factor(tracking, width, height);
calculate_stabdata(tracking, framenr, width, height, firstmedian, median, loc, scale, angle);
stab->ok= 1;
- } else {
+ }
+ else {
calculate_stabdata(tracking, framenr, width, height, firstmedian, median, loc, scale, angle);
}
- } else {
+ }
+ else {
zero_v2(loc);
*scale= 1.0f;
*angle= 0.0f;
@@ -2669,12 +2720,12 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf,
float width= ibuf->x, height= ibuf->y;
float aspect= tracking->camera.pixel_aspect;
- if(loc) copy_v2_v2(tloc, loc);
- if(scale) tscale= *scale;
+ if (loc) copy_v2_v2(tloc, loc);
+ if (scale) tscale= *scale;
- if((stab->flag&TRACKING_2D_STABILIZATION)==0) {
- if(loc) zero_v2(loc);
- if(scale) *scale= 1.0f;
+ if ((stab->flag&TRACKING_2D_STABILIZATION)==0) {
+ if (loc) zero_v2(loc);
+ if (scale) *scale= 1.0f;
return ibuf;
}
@@ -2684,7 +2735,7 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf,
tmpibuf= stabilize_alloc_ibuf(NULL, ibuf, 1);
/* scale would be handled by matrix transformation when angle is non-zero */
- if(tscale!=1.0f && tangle==0.0f) {
+ if (tscale!=1.0f && tangle==0.0f) {
ImBuf *scaleibuf;
stabilization_auto_scale_factor(tracking, width, height);
@@ -2698,11 +2749,12 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf,
ibuf= scaleibuf;
}
- if(tangle==0.0f) {
+ if (tangle==0.0f) {
/* if angle is zero, then it's much faster to use rect copy
* but could be issues with subpixel precisions */
IMB_rectcpy(tmpibuf, ibuf, tloc[0]-(tscale-1.0f)*width/2.0f, tloc[1]-(tscale-1.0f)*height/2.0f, 0, 0, ibuf->x, ibuf->y);
- } else {
+ }
+ else {
float mat[4][4];
int i, j, filter= tracking->stabilization.filter;
void (*interpolation) (struct ImBuf*, struct ImBuf*, float, float, int, int) = NULL;
@@ -2710,15 +2762,18 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf,
BKE_tracking_stabdata_to_mat4(ibuf->x, ibuf->y, aspect, tloc, tscale, tangle, mat);
invert_m4(mat);
- if(filter == TRACKING_FILTER_NEAREAST)
+ if (filter == TRACKING_FILTER_NEAREAST)
interpolation = neareast_interpolation;
- else if(filter == TRACKING_FILTER_BILINEAR)
+ else if (filter == TRACKING_FILTER_BILINEAR)
interpolation = bilinear_interpolation;
- else if(filter == TRACKING_FILTER_BICUBIC)
+ else if (filter == TRACKING_FILTER_BICUBIC)
interpolation = bicubic_interpolation;
+ else
+ /* fallback to default interpolation method */
+ interpolation = neareast_interpolation;
- for(j=0; j<tmpibuf->y; j++) {
- for(i=0; i<tmpibuf->x;i++) {
+ for (j=0; j<tmpibuf->y; j++) {
+ for (i=0; i<tmpibuf->x;i++) {
float vec[3]= {i, j, 0};
mul_v3_m4v3(vec, mat, vec);
@@ -2730,12 +2785,12 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf,
tmpibuf->userflags|= IB_MIPMAP_INVALID;
- if(tmpibuf->rect_float)
+ if (tmpibuf->rect_float)
tmpibuf->userflags|= IB_RECT_INVALID;
- if(loc) copy_v2_v2(loc, tloc);
- if(scale) *scale= tscale;
- if(angle) *angle= tangle;
+ if (loc) copy_v2_v2(loc, tloc);
+ if (scale) *scale= tscale;
+ if (angle) *angle= tangle;
return tmpibuf;
}
@@ -2798,11 +2853,12 @@ void BKE_tracking_distortion_update(MovieDistortion *distortion, MovieTracking *
float aspy= 1.0f/tracking->camera.pixel_aspect;
#ifdef WITH_LIBMV
- if(!distortion->intrinsics) {
+ if (!distortion->intrinsics) {
distortion->intrinsics= libmv_CameraIntrinsicsNew(camera->focal,
camera->principal[0], camera->principal[1] * aspy,
camera->k1, camera->k2, camera->k3, width, height * aspy);
- } else {
+ }
+ else {
libmv_CameraIntrinsicsUpdate(distortion->intrinsics, camera->focal,
camera->principal[0], camera->principal[1] * aspy,
camera->k1, camera->k2, camera->k3, width, height * aspy);
@@ -2825,13 +2881,14 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
resibuf= IMB_dupImBuf(ibuf);
- if(ibuf->rect_float) {
+ if (ibuf->rect_float) {
#ifdef WITH_LIBMV
- if(undistort) {
+ if (undistort) {
libmv_CameraIntrinsicsUndistortFloat(distortion->intrinsics,
ibuf->rect_float, resibuf->rect_float,
ibuf->x, ibuf->y, overscan, ibuf->channels);
- } else {
+ }
+ else {
libmv_CameraIntrinsicsDistortFloat(distortion->intrinsics,
ibuf->rect_float, resibuf->rect_float,
ibuf->x, ibuf->y, overscan, ibuf->channels);
@@ -2839,13 +2896,15 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
#endif
ibuf->userflags|= IB_RECT_INVALID;
- } else {
+ }
+ else {
#ifdef WITH_LIBMV
- if(undistort) {
+ if (undistort) {
libmv_CameraIntrinsicsUndistortByte(distortion->intrinsics,
(unsigned char*)ibuf->rect, (unsigned char*)resibuf->rect,
ibuf->x, ibuf->y, overscan, ibuf->channels);
- } else {
+ }
+ else {
libmv_CameraIntrinsicsDistortByte(distortion->intrinsics,
(unsigned char*)ibuf->rect, (unsigned char*)resibuf->rect,
ibuf->x, ibuf->y, overscan, ibuf->channels);
@@ -2874,7 +2933,7 @@ ImBuf *BKE_tracking_undistort(MovieTracking *tracking, ImBuf *ibuf, int width, i
{
MovieTrackingCamera *camera= &tracking->camera;
- if(camera->intrinsics == NULL)
+ if (camera->intrinsics == NULL)
camera->intrinsics= BKE_tracking_distortion_create();
return BKE_tracking_distortion_exec(camera->intrinsics, tracking, ibuf, width, height, overscan, 1);
@@ -2884,7 +2943,7 @@ ImBuf *BKE_tracking_distort(MovieTracking *tracking, ImBuf *ibuf, int width, int
{
MovieTrackingCamera *camera= &tracking->camera;
- if(camera->intrinsics == NULL)
+ if (camera->intrinsics == NULL)
camera->intrinsics= BKE_tracking_distortion_create();
return BKE_tracking_distortion_exec(camera->intrinsics, tracking, ibuf, width, height, overscan, 0);
@@ -2893,14 +2952,15 @@ ImBuf *BKE_tracking_distort(MovieTracking *tracking, ImBuf *ibuf, int width, int
/* area - which part of marker should be selected. see TRACK_AREA_* constants */
void BKE_tracking_select_track(ListBase *tracksbase, MovieTrackingTrack *track, int area, int extend)
{
- if(extend) {
+ if (extend) {
BKE_tracking_track_flag(track, area, SELECT, 0);
- } else {
+ }
+ else {
MovieTrackingTrack *cur= tracksbase->first;
- while(cur) {
+ while (cur) {
if ((cur->flag & TRACK_HIDDEN) == 0) {
- if(cur==track) {
+ if (cur==track) {
BKE_tracking_track_flag(cur, TRACK_AREA_ALL, SELECT, 1);
BKE_tracking_track_flag(cur, area, SELECT, 0);
}
@@ -2923,7 +2983,7 @@ MovieTrackingObject *BKE_tracking_new_object(MovieTracking *tracking, const char
{
MovieTrackingObject *object= MEM_callocN(sizeof(MovieTrackingObject), "tracking object");
- if(tracking->tot_object==0) {
+ if (tracking->tot_object==0) {
/* first object is always camera */
BLI_strncpy(object->name, "Camera", sizeof(object->name));
@@ -2938,6 +2998,8 @@ MovieTrackingObject *BKE_tracking_new_object(MovieTracking *tracking, const char
tracking->tot_object++;
tracking->objectnr= BLI_countlist(&tracking->objects) - 1;
+ object->scale= 1.0f;
+
BKE_tracking_object_unique_name(tracking, object);
return object;
@@ -2948,17 +3010,17 @@ void BKE_tracking_remove_object(MovieTracking *tracking, MovieTrackingObject *ob
MovieTrackingTrack *track;
int index= BLI_findindex(&tracking->objects, object);
- if(index<0)
+ if (index<0)
return;
- if(object->flag & TRACKING_OBJECT_CAMERA) {
+ if (object->flag & TRACKING_OBJECT_CAMERA) {
/* object used for camera solving can't be deleted */
return;
}
track= object->tracks.first;
- while(track) {
- if(track==tracking->act_track)
+ while (track) {
+ if (track==tracking->act_track)
tracking->act_track= NULL;
track= track->next;
@@ -2969,7 +3031,7 @@ void BKE_tracking_remove_object(MovieTracking *tracking, MovieTrackingObject *ob
tracking->tot_object--;
- if(index>0)
+ if (index>0)
tracking->objectnr= index-1;
else
tracking->objectnr= 0;
@@ -2984,8 +3046,8 @@ MovieTrackingObject *BKE_tracking_named_object(MovieTracking *tracking, const ch
{
MovieTrackingObject *object= tracking->objects.first;
- while(object) {
- if(!strcmp(object->name, name))
+ while (object) {
+ if (!strcmp(object->name, name))
return object;
object= object->next;
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index a4fc4c7bfe3..07a83da3d8c 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -56,17 +56,17 @@ void free_world(World *wrld)
MTex *mtex;
int a;
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
mtex= wrld->mtex[a];
- if(mtex && mtex->tex) mtex->tex->id.us--;
- if(mtex) MEM_freeN(mtex);
+ if (mtex && mtex->tex) mtex->tex->id.us--;
+ if (mtex) MEM_freeN(mtex);
}
BKE_previewimg_free(&wrld->preview);
BKE_free_animdata((ID *)wrld);
/* is no lib link block, but world extension */
- if(wrld->nodetree) {
+ if (wrld->nodetree) {
ntreeFreeTree(wrld->nodetree);
MEM_freeN(wrld->nodetree);
}
@@ -120,18 +120,18 @@ World *copy_world(World *wrld)
wrldn= copy_libblock(&wrld->id);
- for(a=0; a<MAX_MTEX; a++) {
- if(wrld->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (wrld->mtex[a]) {
wrldn->mtex[a]= MEM_mallocN(sizeof(MTex), "copy_world");
memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex));
id_us_plus((ID *)wrldn->mtex[a]->tex);
}
}
- if(wrld->nodetree)
+ if (wrld->nodetree)
wrldn->nodetree= ntreeCopyTree(wrld->nodetree);
- if(wrld->preview)
+ if (wrld->preview)
wrldn->preview = BKE_previewimg_copy(wrld->preview);
return wrldn;
@@ -145,8 +145,8 @@ World *localize_world(World *wrld)
wrldn= copy_libblock(&wrld->id);
BLI_remlink(&G.main->world, wrldn);
- for(a=0; a<MAX_MTEX; a++) {
- if(wrld->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (wrld->mtex[a]) {
wrldn->mtex[a]= MEM_mallocN(sizeof(MTex), "localize_world");
memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex));
/* free world decrements */
@@ -154,7 +154,7 @@ World *localize_world(World *wrld)
}
}
- if(wrld->nodetree)
+ if (wrld->nodetree)
wrldn->nodetree= ntreeLocalize(wrld->nodetree);
wrldn->preview= NULL;
@@ -173,32 +173,32 @@ void make_local_world(World *wrld)
* - mixed: make copy
*/
- if(wrld->id.lib==NULL) return;
- if(wrld->id.us==1) {
+ if (wrld->id.lib==NULL) return;
+ if (wrld->id.us==1) {
id_clear_lib_data(bmain, &wrld->id);
return;
}
- for(sce= bmain->scene.first; sce && ELEM(FALSE, is_lib, is_local); sce= sce->id.next) {
- if(sce->world == wrld) {
- if(sce->id.lib) is_lib= TRUE;
+ for (sce= bmain->scene.first; sce && ELEM(FALSE, is_lib, is_local); sce= sce->id.next) {
+ if (sce->world == wrld) {
+ if (sce->id.lib) is_lib= TRUE;
else is_local= TRUE;
}
}
- if(is_local && is_lib==FALSE) {
+ if (is_local && is_lib==FALSE) {
id_clear_lib_data(bmain, &wrld->id);
}
- else if(is_local && is_lib) {
+ else if (is_local && is_lib) {
World *wrld_new= copy_world(wrld);
wrld_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
BKE_id_lib_local_paths(bmain, wrld->id.lib, &wrld_new->id);
- for(sce= bmain->scene.first; sce; sce= sce->id.next) {
- if(sce->world == wrld) {
- if(sce->id.lib==NULL) {
+ for (sce= bmain->scene.first; sce; sce= sce->id.next) {
+ if (sce->world == wrld) {
+ if (sce->id.lib==NULL) {
sce->world= wrld_new;
wrld_new->id.us++;
wrld->id.us--;
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 50212522d3a..ba8a46256c5 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -201,7 +201,7 @@ static int append_avi(RenderData *UNUSED(rd), int start_frame, int frame, int *p
memcpy (rt1, rt2, rectx*sizeof(int));
cp= (char *)rt1;
- for(x= rectx; x>0; x--) {
+ for (x= rectx; x>0; x--) {
rt= cp[0];
cp[0]= cp[3];
cp[3]= rt;
@@ -231,7 +231,7 @@ static void end_avi(void)
void BKE_makeanimstring(char *string, RenderData *rd)
{
bMovieHandle *mh= BKE_get_movie_handle(rd->im_format.imtype);
- if(mh->get_movie_path)
+ if (mh->get_movie_path)
mh->get_movie_path(string, rd);
else
string[0]= '\0';
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index bca7f6ff7bb..740deb5c7db 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -123,7 +123,7 @@ static int write_audio_frame(void)
audio_outbuf_size,
(short*) audio_input_buffer);
- if(pkt.size < 0)
+ if (pkt.size < 0)
{
// XXX error("Error writing audio packet");
return -1;
@@ -131,7 +131,7 @@ static int write_audio_frame(void)
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);
@@ -262,7 +262,8 @@ static int write_video_frame(RenderData *rd, int cfra, AVFrame* frame, ReportLis
c->time_base,
video_stream->time_base);
fprintf(stderr, "Video Frame PTS: %d\n", (int)packet.pts);
- } else {
+ }
+ else {
fprintf(stderr, "Video Frame PTS: not set\n");
}
if (c->coded_frame->key_frame)
@@ -272,7 +273,8 @@ static int write_video_frame(RenderData *rd, int cfra, AVFrame* frame, ReportLis
packet.size = outsize;
ret = av_interleaved_write_frame(outfile, &packet);
success = (ret == 0);
- } else if (outsize < 0) {
+ }
+ else if (outsize < 0) {
success = 0;
}
@@ -298,7 +300,8 @@ static AVFrame* generate_video_frame(uint8_t* pixels, ReportList *reports)
BKE_report(reports, RPT_ERROR, "Couldn't allocate temporary frame.");
return NULL;
}
- } else {
+ }
+ else {
rgb_frame = current_frame;
}
@@ -324,7 +327,8 @@ static AVFrame* generate_video_frame(uint8_t* pixels, ReportList *reports)
src += 4;
}
}
- } else {
+ }
+ else {
int y;
for (y = 0; y < height; y++) {
uint8_t* target = rgb_frame->data[0]
@@ -383,10 +387,12 @@ static void set_ffmpeg_property_option(AVCodecContext* c, IDProperty * prop)
if (param) {
if (IDP_Int(prop)) {
av_set_string3(c, name, param, 1, &rv);
- } else {
+ }
+ else {
return;
}
- } else {
+ }
+ else {
rv = av_set_int(c, prop->name, IDP_Int(prop));
}
break;
@@ -402,8 +408,8 @@ static int ffmpeg_proprty_valid(AVCodecContext *c, const char *prop_name, IDProp
{
int valid= 1;
- if(strcmp(prop_name, "video")==0) {
- if(strcmp(curr->name, "bf")==0) {
+ if (strcmp(prop_name, "video")==0) {
+ if (strcmp(curr->name, "bf")==0) {
/* flash codec doesn't support b frames */
valid&= c->codec_id!=CODEC_ID_FLV1;
}
@@ -430,7 +436,7 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char
iter = IDP_GetGroupIterator(prop);
while ((curr = IDP_GroupIterNext(iter)) != NULL) {
- if(ffmpeg_proprty_valid(c, prop_name, curr))
+ if (ffmpeg_proprty_valid(c, prop_name, curr))
set_ffmpeg_property_option(c, curr);
}
}
@@ -462,11 +468,13 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
if (ffmpeg_type == FFMPEG_DV && rd->frs_sec != 25) {
c->time_base.den = 2997;
c->time_base.num = 100;
- } else if ((double) ((int) rd->frs_sec_base) ==
+ }
+ else if ((double) ((int) rd->frs_sec_base) ==
rd->frs_sec_base) {
c->time_base.den = rd->frs_sec;
c->time_base.num = (int) rd->frs_sec_base;
- } else {
+ }
+ else {
c->time_base.den = rd->frs_sec * 100000;
c->time_base.num = ((double) rd->frs_sec_base) * 100000;
}
@@ -488,7 +496,8 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
if (codec->pix_fmts) {
c->pix_fmt = codec->pix_fmts[0];
- } else {
+ }
+ else {
/* makes HuffYUV happy ... */
c->pix_fmt = PIX_FMT_YUV422P;
}
@@ -625,11 +634,11 @@ static AVStream* alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
audio_outbuf_size = FF_MIN_BUFFER_SIZE;
- if((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD))
+ if ((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD))
audio_input_samples = audio_outbuf_size * 8 / c->bits_per_coded_sample / c->channels;
else {
audio_input_samples = c->frame_size;
- if(c->frame_size * c->channels * sizeof(int16_t) * 4 > audio_outbuf_size)
+ if (c->frame_size * c->channels * sizeof(int16_t) * 4 > audio_outbuf_size)
audio_outbuf_size = c->frame_size * c->channels * sizeof(int16_t) * 4;
}
@@ -696,7 +705,8 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
of->packet_size= rd->ffcodecdata.mux_packet_size;
if (ffmpeg_audio_codec != CODEC_ID_NONE) {
of->mux_rate = rd->ffcodecdata.mux_rate;
- } else {
+ }
+ else {
of->mux_rate = 0;
}
@@ -846,7 +856,8 @@ void flush_ffmpeg(void)
c->time_base,
video_stream->time_base);
fprintf(stderr, "Video Frame PTS: %d\n", (int)packet.pts);
- } else {
+ }
+ else {
fprintf(stderr, "Video Frame PTS: not set\n");
}
if (c->coded_frame->key_frame) {
@@ -902,7 +913,8 @@ void filepath_ffmpeg(char* string, RenderData* rd)
BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
strcat(string, *exts);
- } else {
+ }
+ else {
*(string + strlen(string) - strlen(*fe)) = 0;
strcat(string, autosplit);
strcat(string, *fe);
@@ -917,7 +929,7 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
success = start_ffmpeg_impl(rd, rectx, recty, reports);
#ifdef WITH_AUDASPACE
- if(audio_stream)
+ if (audio_stream)
{
AVCodecContext* c = audio_stream->codec;
AUD_DeviceSpecs specs;
@@ -942,7 +954,7 @@ static void write_audio_frames(double to_pts)
int finished = 0;
while (audio_stream && !finished) {
- if((audio_time >= to_pts) ||
+ if ((audio_time >= to_pts) ||
(write_audio_frame())) {
finished = 1;
}
@@ -962,7 +974,7 @@ int append_ffmpeg(RenderData *rd, int start_frame, int frame, int *pixels, int r
// why is this done before writing the video frame and again at end_ffmpeg?
// write_audio_frames(frame / (((double)rd->frs_sec) / rd->frs_sec_base));
- if(video_stream)
+ if (video_stream)
{
avframe= generate_video_frame((unsigned char*) pixels, reports);
success= (avframe && write_video_frame(rd, frame - start_frame, avframe, reports));
@@ -1109,7 +1121,8 @@ IDProperty *ffmpeg_property_add(RenderData *rd, const char *type, int opt_index,
if (parent_index) {
BLI_snprintf(name, sizeof(name), "%s:%s", parent->name, o->name);
- } else {
+ }
+ else {
BLI_strncpy(name, o->name, sizeof(name));
}
@@ -1158,8 +1171,8 @@ static const AVOption *my_av_find_opt(void *v, const char *name,
AVClass *c= *(AVClass**)v;
const AVOption *o= c->option;
- for(;o && o->name; o++) {
- if(!strcmp(o->name, name) &&
+ for (;o && o->name; o++) {
+ if (!strcmp(o->name, name) &&
(!unit || (o->unit && !strcmp(o->unit, unit))) &&
(o->flags & mask) == flags )
return o;
@@ -1206,7 +1219,8 @@ int ffmpeg_property_add_string(RenderData *rd, const char * type, const char * s
prop = ffmpeg_property_add(rd,
(char*) type, p - c.av_class->option,
o - c.av_class->option);
- } else {
+ }
+ else {
prop = ffmpeg_property_add(rd,
(char*) type, o - c.av_class->option, 0);
}
@@ -1236,10 +1250,10 @@ static void ffmpeg_set_expert_options(RenderData *rd)
{
int codec_id = rd->ffcodecdata.codec;
- if(rd->ffcodecdata.properties)
+ if (rd->ffcodecdata.properties)
IDP_FreeProperty(rd->ffcodecdata.properties);
- if(codec_id == CODEC_ID_H264) {
+ if (codec_id == CODEC_ID_H264) {
/*
* All options here are for x264, but must be set via ffmpeg.
* The names are therefore different - Search for "x264 to FFmpeg option mapping"
@@ -1279,12 +1293,12 @@ static void ffmpeg_set_expert_options(RenderData *rd)
ffmpeg_property_add_string(rd, "video", "flags2:fastpskip");
ffmpeg_property_add_string(rd, "video", "wpredp:2");
- if(rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
+ if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
ffmpeg_property_add_string(rd, "video", "cqp:0");
}
#if 0 /* disabled for after release */
- else if(codec_id == CODEC_ID_DNXHD) {
- if(rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
+ else if (codec_id == CODEC_ID_DNXHD) {
+ if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
ffmpeg_property_add_string(rd, "video", "mbd:rd");
}
#endif
@@ -1294,7 +1308,7 @@ void ffmpeg_set_preset(RenderData *rd, int preset)
{
int isntsc = (rd->frs_sec != 25);
- if(rd->ffcodecdata.properties)
+ if (rd->ffcodecdata.properties)
IDP_FreeProperty(rd->ffcodecdata.properties);
switch (preset) {
@@ -1361,11 +1375,11 @@ void ffmpeg_set_preset(RenderData *rd, int preset)
case FFMPEG_PRESET_THEORA:
case FFMPEG_PRESET_XVID:
- if(preset == FFMPEG_PRESET_XVID) {
+ if (preset == FFMPEG_PRESET_XVID) {
rd->ffcodecdata.type = FFMPEG_AVI;
rd->ffcodecdata.codec = CODEC_ID_MPEG4;
}
- else if(preset == FFMPEG_PRESET_THEORA) {
+ else if (preset == FFMPEG_PRESET_THEORA) {
rd->ffcodecdata.type = FFMPEG_OGG; // XXX broken
rd->ffcodecdata.codec = CODEC_ID_THEORA;
}
@@ -1388,8 +1402,8 @@ void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
{
int audio= 0;
- if(imf->imtype == R_IMF_IMTYPE_FFMPEG) {
- if(rd->ffcodecdata.type <= 0 ||
+ if (imf->imtype == R_IMF_IMTYPE_FFMPEG) {
+ if (rd->ffcodecdata.type <= 0 ||
rd->ffcodecdata.codec <= 0 ||
rd->ffcodecdata.audio_codec <= 0 ||
rd->ffcodecdata.video_bitrate <= 1) {
@@ -1398,32 +1412,32 @@ void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
ffmpeg_set_preset(rd, FFMPEG_PRESET_DVD);
}
- if(rd->ffcodecdata.type == FFMPEG_OGG) {
+ if (rd->ffcodecdata.type == FFMPEG_OGG) {
rd->ffcodecdata.type = FFMPEG_MPEG2;
}
audio= 1;
}
- else if(imf->imtype == R_IMF_IMTYPE_H264) {
- if(rd->ffcodecdata.codec != CODEC_ID_H264) {
+ else if (imf->imtype == R_IMF_IMTYPE_H264) {
+ if (rd->ffcodecdata.codec != CODEC_ID_H264) {
ffmpeg_set_preset(rd, FFMPEG_PRESET_H264);
audio= 1;
}
}
- else if(imf->imtype == R_IMF_IMTYPE_XVID) {
- if(rd->ffcodecdata.codec != CODEC_ID_MPEG4) {
+ else if (imf->imtype == R_IMF_IMTYPE_XVID) {
+ if (rd->ffcodecdata.codec != CODEC_ID_MPEG4) {
ffmpeg_set_preset(rd, FFMPEG_PRESET_XVID);
audio= 1;
}
}
- else if(imf->imtype == R_IMF_IMTYPE_THEORA) {
- if(rd->ffcodecdata.codec != CODEC_ID_THEORA) {
+ else if (imf->imtype == R_IMF_IMTYPE_THEORA) {
+ if (rd->ffcodecdata.codec != CODEC_ID_THEORA) {
ffmpeg_set_preset(rd, FFMPEG_PRESET_THEORA);
audio= 1;
}
}
- if(audio && rd->ffcodecdata.audio_codec < 0) {
+ if (audio && rd->ffcodecdata.audio_codec < 0) {
rd->ffcodecdata.audio_codec = CODEC_ID_NONE;
rd->ffcodecdata.audio_bitrate = 128;
}
diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c
index c163155c8fb..4bb9c497980 100644
--- a/source/blender/blenkernel/intern/writeframeserver.c
+++ b/source/blender/blenkernel/intern/writeframeserver.c
@@ -301,9 +301,11 @@ int frameserver_loop(RenderData *rd, ReportList *UNUSED(reports))
rval = select(connsock + 1, &readfds, NULL, NULL, &tv);
if (rval > 0) {
break;
- } else if (rval == 0) {
+ }
+ else if (rval == 0) {
return -1;
- } else if (rval < 0) {
+ }
+ else if (rval < 0) {
if (!select_was_interrupted_by_signal()) {
return -1;
}
diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h
index a0f253d9ad4..91252d3beb5 100644
--- a/source/blender/blenlib/BLI_bpath.h
+++ b/source/blender/blenlib/BLI_bpath.h
@@ -28,7 +28,7 @@
/** \file BLI_bpath.h
* \ingroup bli
* \attention Based on ghash, difference is ghash is not a fixed size,
- * so for BPath we dont need to malloc
+ * so for BPath we don't need to malloc
*/
#ifndef __BLI_BPATH_H__
diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h
index f4f92a0cbee..b32a1e272c8 100644
--- a/source/blender/blenlib/BLI_callbacks.h
+++ b/source/blender/blenlib/BLI_callbacks.h
@@ -42,6 +42,8 @@ typedef enum {
BLI_CB_EVT_RENDER_PRE,
BLI_CB_EVT_RENDER_POST,
BLI_CB_EVT_RENDER_STATS,
+ BLI_CB_EVT_RENDER_COMPLETE,
+ BLI_CB_EVT_RENDER_CANCEL,
BLI_CB_EVT_LOAD_PRE,
BLI_CB_EVT_LOAD_POST,
BLI_CB_EVT_SAVE_PRE,
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index 8fe8456e845..73220cbd739 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -33,6 +33,9 @@
#ifndef __BLI_FILEOPS_H__
#define __BLI_FILEOPS_H__
+#include <stdio.h>
+
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -42,6 +45,8 @@ extern "C" {
/* for size_t (needed on windows) */
#include <stddef.h>
+struct gzFile;
+
/* Common */
int BLI_exists(const char *path);
@@ -65,6 +70,10 @@ unsigned int BLI_dir_contents(const char *dir, struct direntry **filelist);
/* Files */
+FILE *BLI_fopen(const char *filename, const char *mode);
+void *BLI_gzopen(const char *filename, const char *mode);
+int BLI_open(const char *filename, int oflag, int pmode);
+
int BLI_file_is_writable(const char *file);
int BLI_file_touch(const char *file);
diff --git a/source/blender/blenlib/BLI_gsqueue.h b/source/blender/blenlib/BLI_gsqueue.h
index 0265cf9b639..29c31c19047 100644
--- a/source/blender/blenlib/BLI_gsqueue.h
+++ b/source/blender/blenlib/BLI_gsqueue.h
@@ -58,7 +58,7 @@ int BLI_gsqueue_size(GSQueue *gq);
* Access the item at the head of the queue
* without removing it.
*
- * \param item_r A pointer to an appropriatly
+ * \param item_r A pointer to an appropriately
* sized structure (the size passed to BLI_gsqueue_new)
*/
void BLI_gsqueue_peek (GSQueue *gq, void *item_r);
@@ -67,7 +67,7 @@ void BLI_gsqueue_peek (GSQueue *gq, void *item_r);
* Access the item at the head of the queue
* and remove it.
*
- * \param item_r A pointer to an appropriatly
+ * \param item_r A pointer to an appropriately
* sized structure (the size passed to BLI_gsqueue_new).
* Can be NULL if desired.
*/
@@ -76,7 +76,7 @@ void BLI_gsqueue_pop (GSQueue *gq, void *item_r);
/**
* Push an element onto the tail of the queue.
*
- * \param item A pointer to an appropriatly
+ * \param item A pointer to an appropriately
* sized structure (the size passed to BLI_gsqueue_new).
*/
void BLI_gsqueue_push (GSQueue *gq, void *item);
@@ -85,7 +85,7 @@ void BLI_gsqueue_push (GSQueue *gq, void *item);
* Push an element back onto the head of the queue (so
* it would be returned from the next call to BLI_gsqueue_pop).
*
- * \param item A pointer to an appropriatly
+ * \param item A pointer to an appropriately
* sized structure (the size passed to BLI_gsqueue_new).
*/
void BLI_gsqueue_pushback (GSQueue *gq, void *item);
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index d0a1311f2bc..7e5f1f2a72a 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -167,7 +167,7 @@ MINLINE float signf(float f);
MINLINE float power_of_2(float f);
-/* these dont really fit anywhere but were being copied about a lot */
+/* these don't really fit anywhere but were being copied about a lot */
MINLINE int is_power_of_2_i(int n);
MINLINE int power_of_2_max_i(int n);
MINLINE int power_of_2_min_i(int n);
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index a725a3ff4c1..9b5e3638609 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -54,7 +54,7 @@ float area_tri_v3(const float a[3], const float b[3], const float c[3]);
float area_quad_v3(const float a[3], const float b[3], const float c[3], const float d[3]);
float area_poly_v3(int nr, float verts[][3], const float normal[3]);
-int is_quad_convex_v3(const float *v1, const float *v2, const float *v3, const float *v4);
+int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]);
/********************************* Distance **********************************/
@@ -73,6 +73,7 @@ void closest_to_plane_v3(float r[3], const float plane_co[3], const float plane
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3]);
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2]);
+void limit_dist_v3(float v1[3], float v2[3], const float dist);
/******************************* Intersection ********************************/
diff --git a/source/blender/blenlib/BLI_math_inline.h b/source/blender/blenlib/BLI_math_inline.h
index fcc5fb744bb..ce43d5fb941 100644
--- a/source/blender/blenlib/BLI_math_inline.h
+++ b/source/blender/blenlib/BLI_math_inline.h
@@ -38,21 +38,21 @@ extern "C" {
#define __BLI_MATH_INLINE_H__
#ifdef __BLI_MATH_INLINE_H__
-#ifdef _MSC_VER
-#define MINLINE static __forceinline
-#define MALWAYS_INLINE MINLINE
+# ifdef _MSC_VER
+# define MINLINE static __forceinline
+# define MALWAYS_INLINE MINLINE
+# else
+# define MINLINE static inline
+# if (defined(__APPLE__) && defined(__ppc__))
+ /* static inline __attribute__ here breaks osx ppc gcc42 build */
+# define MALWAYS_INLINE static __attribute__((always_inline))
+# else
+# define MALWAYS_INLINE static inline __attribute__((always_inline))
+# endif
+# endif
#else
-#define MINLINE static inline
-#if (defined(__APPLE__) && defined(__ppc__))
-/* static inline __attribute__ here breaks osx ppc gcc42 build */
-#define MALWAYS_INLINE static __attribute__((always_inline))
-#else
-#define MALWAYS_INLINE static inline __attribute__((always_inline))
-#endif
-#endif
-#else
-#define MINLINE
-#define MALWAYS_INLINE
+# define MINLINE
+# define MALWAYS_INLINE
#endif
#ifdef __cplusplus
@@ -60,4 +60,3 @@ extern "C" {
#endif
#endif /* __BLI_MATH_INLINE_H__ */
-
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 1a24acfe1a5..b8b53f1ba7c 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -176,6 +176,7 @@ MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const flo
/* - angle_normalized_* is faster equivalent if vectors are normalized */
float angle_v2v2(const float a[2], const float b[2]);
+float angle_signed_v2v2(const float v1[2], const float v2[2]);
float angle_v2v2v2(const float a[2], const float b[2], const float c[2]);
float angle_normalized_v2v2(const float a[2], const float b[2]);
float angle_v3v3(const float a[3], const float b[3]);
diff --git a/source/blender/blenlib/BLI_pbvh.h b/source/blender/blenlib/BLI_pbvh.h
index f0d56a3cf52..210238efcfd 100644
--- a/source/blender/blenlib/BLI_pbvh.h
+++ b/source/blender/blenlib/BLI_pbvh.h
@@ -26,6 +26,8 @@
* \brief A BVH for high poly meshes.
*/
+#include "BLI_bitmap.h"
+
struct DMFlagMat;
struct DMGridAdjacency;
struct DMGridData;
@@ -57,7 +59,8 @@ void BLI_pbvh_build_mesh(PBVH *bvh, struct MFace *faces, struct MVert *verts,
int totface, int totvert);
void BLI_pbvh_build_grids(PBVH *bvh, struct DMGridData **grids,
struct DMGridAdjacency *gridadj, int totgrid,
- int gridsize, void **gridfaces, struct DMFlagMat *flagmats);
+ int gridsize, void **gridfaces, struct DMFlagMat *flagmats,
+ unsigned int **grid_hidden);
void BLI_pbvh_free(PBVH *bvh);
/* Hierarchical Search in the BVH, two methods:
@@ -85,10 +88,20 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
/* Drawing */
void BLI_pbvh_node_draw(PBVHNode *node, void *data);
-int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data);
void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
int (*setMaterial)(int, void *attribs));
+/* PBVH Access */
+typedef enum {
+ PBVH_FACES,
+ PBVH_GRIDS,
+} PBVHType;
+
+PBVHType BLI_pbvh_type(const PBVH *bvh);
+
+/* multires hidden data, only valid for type == PBVH_GRIDS */
+unsigned int **BLI_pbvh_grid_hidden(const PBVH *bvh);
+
/* Node Access */
typedef enum {
@@ -98,10 +111,15 @@ typedef enum {
PBVH_UpdateBB = 4,
PBVH_UpdateOriginalBB = 8,
PBVH_UpdateDrawBuffers = 16,
- PBVH_UpdateRedraw = 32
+ PBVH_UpdateRedraw = 32,
+
+ PBVH_RebuildDrawBuffers = 64,
+ PBVH_FullyHidden = 128
} PBVHNodeFlags;
void BLI_pbvh_node_mark_update(PBVHNode *node);
+void BLI_pbvh_node_mark_rebuild_draw(PBVHNode *node);
+void BLI_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden);
void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node,
int **grid_indices, int *totgrid, int *maxgrid, int *gridsize,
@@ -116,6 +134,11 @@ void BLI_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max
float BLI_pbvh_node_get_tmin(PBVHNode* node);
+/* test if AABB is at least partially inside the planes' volume */
+int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data);
+/* test if AABB is at least partially outside the planes' volume */
+int BLI_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data);
+
/* Update Normals/Bounding Box/Draw Buffers/Redraw and clear flags */
void BLI_pbvh_update(PBVH *bvh, int flags, float (*face_nors)[3]);
@@ -136,6 +159,8 @@ int BLI_pbvh_isDeformed(struct PBVH *pbvh);
* - allow the compiler to eliminate dead code and variables
* - spend most of the time in the relatively simple inner loop */
+/* note: PBVH_ITER_ALL does not skip hidden vertices,
+ PBVH_ITER_UNIQUE does */
#define PBVH_ITER_ALL 0
#define PBVH_ITER_UNIQUE 1
@@ -151,6 +176,7 @@ typedef struct PBVHVertexIter {
/* grid */
struct DMGridData **grids;
struct DMGridData *grid;
+ BLI_bitmap *grid_hidden, gh;
int *grid_indices;
int totgrid;
int gridsize;
@@ -183,6 +209,8 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
vi.width= vi.gridsize; \
vi.height= vi.gridsize; \
vi.grid= vi.grids[vi.grid_indices[vi.g]]; \
+ if(mode == PBVH_ITER_UNIQUE) \
+ vi.gh= vi.grid_hidden[vi.grid_indices[vi.g]]; \
} \
else { \
vi.width= vi.totvert; \
@@ -195,9 +223,15 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
vi.co= vi.grid->co; \
vi.fno= vi.grid->no; \
vi.grid++; \
+ if(vi.gh) { \
+ if(BLI_BITMAP_GET(vi.gh, vi.gy * vi.gridsize + vi.gx)) \
+ continue; \
+ } \
} \
else { \
vi.mvert= &vi.mverts[vi.vert_indices[vi.gx]]; \
+ if(mode == PBVH_ITER_UNIQUE && vi.mvert->flag & ME_HIDE) \
+ continue; \
vi.co= vi.mvert->co; \
vi.no= vi.mvert->no; \
} \
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 06de3ff05fc..4fa0438a9ea 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -53,8 +53,21 @@
#define ELEM11(a, b, c, d, e, f, g, h, i, j, k, l) ( ELEM4(a, b, c, d, e) || ELEM7(a, f, g, h, i, j, k, l) )
/* shift around elements */
-#define SHIFT3(type, a, b, c) { type tmp; tmp = a; a = c; c = b; b = tmp; }
-#define SHIFT4(type, a, b, c, d) { type tmp; tmp = a; a = d; d = c; c = b; b = tmp; }
+#define SHIFT3(type, a, b, c) { \
+ type tmp; \
+ tmp = a; \
+ a = c; \
+ c = b; \
+ b = tmp; \
+ } (void)0
+#define SHIFT4(type, a, b, c, d) { \
+ type tmp; \
+ tmp = a; \
+ a = d; \
+ d = c; \
+ c = b; \
+ b = tmp; \
+ } (void)0
/* min/max */
#define MIN2(x,y) ( (x)<(y) ? (x) : (y) )
@@ -72,17 +85,17 @@
#define INIT_MINMAX2(min, max) { \
(min)[0]= (min)[1]= 1.0e30f; \
(max)[0]= (max)[1]= -1.0e30f; \
- }
+ } (void)0
#define DO_MIN(vec, min) { \
if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \
if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \
if( (min)[2]>(vec)[2] ) (min)[2]= (vec)[2]; \
- }
+ } (void)0
#define DO_MAX(vec, max) { \
if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \
if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \
if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2]; \
- }
+ } (void)0
#define DO_MINMAX(vec, min, max) { \
if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \
if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \
@@ -90,13 +103,13 @@
if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \
if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \
if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2]; \
- }
+ } (void)0
#define DO_MINMAX2(vec, min, max) { \
if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \
if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \
if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \
if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \
- }
+ } (void)0
/* some math and copy defines */
@@ -113,59 +126,65 @@
(v1)[0]= FTOCHAR((v2[0])); \
(v1)[1]= FTOCHAR((v2[1])); \
(v1)[2]= FTOCHAR((v2[2])); \
- }
+ } (void)0
#define F3TOCHAR4(v2, v1) { \
(v1)[0]= FTOCHAR((v2[0])); \
(v1)[1]= FTOCHAR((v2[1])); \
(v1)[2]= FTOCHAR((v2[2])); \
(v1)[3]= 255; \
- }
+ } (void)0
#define F4TOCHAR4(v2, v1) { \
(v1)[0]= FTOCHAR((v2[0])); \
(v1)[1]= FTOCHAR((v2[1])); \
(v1)[2]= FTOCHAR((v2[2])); \
(v1)[3]= FTOCHAR((v2[3])); \
- }
+ } (void)0
#define VECCOPY(v1, v2) { \
*(v1)= *(v2); \
*(v1+1)= *(v2+1); \
*(v1+2)= *(v2+2); \
- }
+ } (void)0
#define VECCOPY2D(v1, v2) { \
*(v1)= *(v2); \
*(v1+1)= *(v2+1); \
- }
+ } (void)0
#define VECADD(v1,v2,v3) { \
*(v1)= *(v2) + *(v3); \
*(v1+1)= *(v2+1) + *(v3+1); \
*(v1+2)= *(v2+2) + *(v3+2); \
- }
+ } (void)0
#define VECSUB(v1,v2,v3) { \
*(v1)= *(v2) - *(v3); \
*(v1+1)= *(v2+1) - *(v3+1); \
*(v1+2)= *(v2+2) - *(v3+2); \
- }
+ } (void)0
#define VECSUB2D(v1,v2,v3) { \
*(v1)= *(v2) - *(v3); \
*(v1+1)= *(v2+1) - *(v3+1); \
- }
+ } (void)0
#define VECADDFAC(v1,v2,v3,fac) { \
*(v1)= *(v2) + *(v3)*(fac); \
*(v1+1)= *(v2+1) + *(v3+1)*(fac); \
*(v1+2)= *(v2+2) + *(v3+2)*(fac); \
- }
+ } (void)0
#define VECSUBFAC(v1,v2,v3,fac) { \
*(v1)= *(v2) - *(v3)*(fac); \
*(v1+1)= *(v2+1) - *(v3+1)*(fac); \
*(v1+2)= *(v2+2) - *(v3+2)*(fac); \
- }
+ } (void)0
#define INPR(v1, v2) ( (v1)[0]*(v2)[0] + (v1)[1]*(v2)[1] + (v1)[2]*(v2)[2] )
/* some misc stuff.... */
#define CLAMP(a, b, c) if((a)<(b)) (a)=(b); else if((a)>(c)) (a)=(c)
#define CLAMPIS(a, b, c) ((a)<(b) ? (b) : (a)>(c) ? (c) : (a))
-#define CLAMPTEST(a, b, c) if((b)<(c)) {CLAMP(a, b, c);} else {CLAMP(a, c, b);}
+#define CLAMPTEST(a, b, c) \
+ if ((b) < (c)) { \
+ CLAMP(a, b, c); \
+ } \
+ else { \
+ CLAMP(a, c, b); \
+ } (void)
#define IS_EQ(a,b) ((fabs((double)(a)-(b)) >= (double) FLT_EPSILON) ? 0 : 1)
#define IS_EQF(a,b) ((fabsf((float)(a)-(b)) >= (float) FLT_EPSILON) ? 0 : 1)
@@ -191,26 +210,26 @@
s_i= p_i[1]; p_i[1]= p_i[6]; p_i[6]= s_i; \
s_i= p_i[2]; p_i[2]= p_i[5]; p_i[5]= s_i; \
s_i= p_i[3]; p_i[3]= p_i[4]; p_i[4]= s_i; \
- }
+ } (void)0
#define SWITCH_INT(a) { \
char s_i, *p_i; \
p_i= (char *)&(a); \
s_i= p_i[0]; p_i[0]= p_i[3]; p_i[3]= s_i; \
s_i= p_i[1]; p_i[1]= p_i[2]; p_i[2]= s_i; \
- }
+ } (void)0
#define SWITCH_SHORT(a) { \
char s_i, *p_i; \
p_i= (char *)&(a); \
s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i; \
- }
+ } (void)0
/* Warning-free macros for storing ints in pointers. Use these _only_
* for storing an int in a pointer, not a pointer in an int (64bit)! */
-#define SET_INT_IN_POINTER(i) ((void*)(intptr_t)(i))
-#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i))
+#define SET_INT_IN_POINTER(i) ((void *)(intptr_t)(i))
+#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i))
/* Macro to convert a value to string in the preprocessor
* STRINGIFY_ARG: gives the argument as a string
@@ -251,12 +270,12 @@
/*little macro so inline keyword works*/
#if defined(_MSC_VER)
-# define BM_INLINE static __forceinline
+# define BLI_INLINE static __forceinline
#elif defined(__GNUC__)
-# define BM_INLINE static inline __attribute((always_inline))
+# define BLI_INLINE static inline __attribute((always_inline))
#else
/* #warning "MSC/GNUC defines not found, inline non-functional" */
-# define BM_INLINE static
+# define BLI_INLINE static
#endif
diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h
index d939882b105..c393b219785 100644
--- a/source/blender/blenlib/BLI_winstuff.h
+++ b/source/blender/blenlib/BLI_winstuff.h
@@ -124,7 +124,7 @@ struct dirent {
typedef struct _DIR {
HANDLE handle;
- WIN32_FIND_DATA data;
+ WIN32_FIND_DATAW data;
char path[MAX_PATH];
long dd_loc;
long dd_size;
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 9af1e2d0387..3388daed28a 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -161,4 +161,10 @@ if(WITH_XDG_USER_DIRS)
add_definitions(-DWITH_XDG_USER_DIRS)
endif()
+if(WIN32)
+ list(APPEND INC
+ ../../../intern/utfconv
+ )
+endif()
+
blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/blenlib/SConscript b/source/blender/blenlib/SConscript
index dda8303eea7..ea51e5b6ab5 100644
--- a/source/blender/blenlib/SConscript
+++ b/source/blender/blenlib/SConscript
@@ -18,6 +18,7 @@ if env['WITH_BF_BINRELOC']:
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
+ incs += ' ../../../intern/utfconv'
if env['OURPLATFORM'] == 'linuxcross':
if env['WITH_BF_OPENMP']:
diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c
index 3d137641889..cd904030bb9 100644
--- a/source/blender/blenlib/intern/BLI_args.c
+++ b/source/blender/blenlib/intern/BLI_args.c
@@ -103,7 +103,8 @@ static int keycmp(const void *a, const void *b)
return BLI_strcasecmp(ka->arg, kb->arg);
else
return strcmp(ka->arg, kb->arg);
- } else {
+ }
+ else {
return BLI_ghashutil_intcmp((const void*)ka->pass, (const void*)kb->pass);
}
}
@@ -261,7 +262,7 @@ void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *
{
int i = 0;
- for( i = 1; i < ba->argc; i++) { /* skip argv[0] */
+ for ( i = 1; i < ba->argc; i++) { /* skip argv[0] */
if (ba->passes[i] == 0) {
/* -1 signal what side of the comparison it is */
bArgument *a = lookUp(ba, ba->argv[i], pass, -1);
@@ -271,7 +272,8 @@ void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *
if (a) {
func = a->func;
data = a->data;
- } else {
+ }
+ else {
func = default_cb;
data = default_data;
}
diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c
index ad52de180aa..ed049a573d9 100644
--- a/source/blender/blenlib/intern/BLI_dynstr.c
+++ b/source/blender/blenlib/intern/BLI_dynstr.c
@@ -119,9 +119,9 @@ void BLI_dynstr_vappendf(DynStr *ds, const char *format, va_list args)
const int maxlen= 65536;
int retval;
- while(1) {
+ while (1) {
va_list args_cpy;
- if(len == sizeof(fixedmessage))
+ if (len == sizeof(fixedmessage))
message= fixedmessage;
else
message= MEM_callocN(sizeof(char) * len, "BLI_dynstr_appendf");
@@ -131,22 +131,22 @@ void BLI_dynstr_vappendf(DynStr *ds, const char *format, va_list args)
retval= vsnprintf(message, len, format, args_cpy);
va_end(args_cpy);
- if(retval == -1) {
+ if (retval == -1) {
/* -1 means not enough space, but on windows it may also mean
* there is a formatting error, so we impose a maximum length */
- if(message != fixedmessage)
+ if (message != fixedmessage)
MEM_freeN(message);
message= NULL;
len *= 2;
- if(len > maxlen) {
+ if (len > maxlen) {
fprintf(stderr, "BLI_dynstr_append text too long or format error.\n");
break;
}
}
- else if(retval >= len) {
+ else if (retval >= len) {
/* in C99 the actual length required is returned */
- if(message != fixedmessage)
+ if (message != fixedmessage)
MEM_freeN(message);
message= NULL;
@@ -157,10 +157,10 @@ void BLI_dynstr_vappendf(DynStr *ds, const char *format, va_list args)
break;
}
- if(message) {
+ if (message) {
BLI_dynstr_append(ds, message);
- if(message != fixedmessage)
+ if (message != fixedmessage)
MEM_freeN(message);
}
}
@@ -177,8 +177,8 @@ void BLI_dynstr_appendf(DynStr *ds, const char *format, ...)
* and avoid code duplication, that crashes on some system because
* va_start/va_end have to be called for each vsnprintf call */
- while(1) {
- if(len == sizeof(fixedmessage))
+ while (1) {
+ if (len == sizeof(fixedmessage))
message= fixedmessage;
else
message= MEM_callocN(sizeof(char)*(len), "BLI_dynstr_appendf");
@@ -187,22 +187,22 @@ void BLI_dynstr_appendf(DynStr *ds, const char *format, ...)
retval= vsnprintf(message, len, format, args);
va_end(args);
- if(retval == -1) {
+ if (retval == -1) {
/* -1 means not enough space, but on windows it may also mean
* there is a formatting error, so we impose a maximum length */
- if(message != fixedmessage)
+ if (message != fixedmessage)
MEM_freeN(message);
message= NULL;
len *= 2;
- if(len > maxlen) {
+ if (len > maxlen) {
fprintf(stderr, "BLI_dynstr_append text too long or format error.\n");
break;
}
}
- else if(retval >= len) {
+ else if (retval >= len) {
/* in C99 the actual length required is returned */
- if(message != fixedmessage)
+ if (message != fixedmessage)
MEM_freeN(message);
message= NULL;
@@ -213,10 +213,10 @@ void BLI_dynstr_appendf(DynStr *ds, const char *format, ...)
break;
}
- if(message) {
+ if (message) {
BLI_dynstr_append(ds, message);
- if(message != fixedmessage)
+ if (message != fixedmessage)
MEM_freeN(message);
}
}
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index b05a1c00d0f..28b4794ed1b 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -33,11 +33,8 @@
#include <string.h>
#include <stdlib.h>
-
#include "MEM_guardedalloc.h"
-
-
// #include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@@ -47,7 +44,7 @@
#include "BLO_sys_types.h" // for intptr_t support
/***/
-unsigned int hashsizes[]= {
+unsigned int hashsizes[] = {
5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209,
16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169,
4194319, 8388617, 16777259, 33554467, 67108879, 134217757,
@@ -58,18 +55,18 @@ unsigned int hashsizes[]= {
GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info)
{
- GHash *gh= MEM_mallocN(sizeof(*gh), info);
- gh->hashfp= hashfp;
- gh->cmpfp= cmpfp;
+ GHash *gh = MEM_mallocN(sizeof(*gh), info);
+ gh->hashfp = hashfp;
+ gh->cmpfp = cmpfp;
gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, 0);
- gh->cursize= 0;
- gh->nentries= 0;
- gh->nbuckets= hashsizes[gh->cursize];
-
- gh->buckets= MEM_mallocN(gh->nbuckets*sizeof(*gh->buckets), "buckets");
- memset(gh->buckets, 0, gh->nbuckets*sizeof(*gh->buckets));
-
+ gh->cursize = 0;
+ gh->nentries = 0;
+ gh->nbuckets = hashsizes[gh->cursize];
+
+ gh->buckets = MEM_mallocN(gh->nbuckets * sizeof(*gh->buckets), "buckets");
+ memset(gh->buckets, 0, gh->nbuckets * sizeof(*gh->buckets));
+
return gh;
}
@@ -80,31 +77,31 @@ int BLI_ghash_size(GHash *gh)
void BLI_ghash_insert(GHash *gh, void *key, void *val)
{
- unsigned int hash= gh->hashfp(key)%gh->nbuckets;
- Entry *e= (Entry*) BLI_mempool_alloc(gh->entrypool);
+ unsigned int hash = gh->hashfp(key) % gh->nbuckets;
+ Entry *e = (Entry*)BLI_mempool_alloc(gh->entrypool);
- e->key= key;
- e->val= val;
- e->next= gh->buckets[hash];
- gh->buckets[hash]= e;
+ e->key = key;
+ e->val = val;
+ e->next = gh->buckets[hash];
+ gh->buckets[hash] = e;
- if (++gh->nentries>(float)gh->nbuckets/2) {
- Entry **old= gh->buckets;
- int i, nold= gh->nbuckets;
+ if (++gh->nentries > (float)gh->nbuckets / 2) {
+ Entry **old = gh->buckets;
+ int i, nold = gh->nbuckets;
- gh->nbuckets= hashsizes[++gh->cursize];
- gh->buckets= (Entry**)MEM_mallocN(gh->nbuckets*sizeof(*gh->buckets), "buckets");
- memset(gh->buckets, 0, gh->nbuckets*sizeof(*gh->buckets));
+ gh->nbuckets = hashsizes[++gh->cursize];
+ gh->buckets = (Entry**)MEM_mallocN(gh->nbuckets * sizeof(*gh->buckets), "buckets");
+ memset(gh->buckets, 0, gh->nbuckets * sizeof(*gh->buckets));
- for (i=0; i<nold; i++) {
- for (e= old[i]; e;) {
- Entry *n= e->next;
+ for (i = 0; i < nold; i++) {
+ for (e = old[i]; e;) {
+ Entry *n = e->next;
- hash= gh->hashfp(e->key)%gh->nbuckets;
- e->next= gh->buckets[hash];
- gh->buckets[hash]= e;
+ hash = gh->hashfp(e->key) % gh->nbuckets;
+ e->next = gh->buckets[hash];
+ gh->buckets[hash] = e;
- e= n;
+ e = n;
}
}
@@ -114,33 +111,35 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val)
void *BLI_ghash_lookup(GHash *gh, const void *key)
{
- if(gh) {
- unsigned int hash= gh->hashfp(key)%gh->nbuckets;
+ if (gh) {
+ unsigned int hash = gh->hashfp(key) % gh->nbuckets;
Entry *e;
- for (e= gh->buckets[hash]; e; e= e->next)
- if (gh->cmpfp(key, e->key)==0)
+ for (e = gh->buckets[hash]; e; e = e->next)
+ if (gh->cmpfp(key, e->key) == 0)
return e->val;
}
return NULL;
}
-int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
+int BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
{
- unsigned int hash= gh->hashfp(key)%gh->nbuckets;
+ unsigned int hash = gh->hashfp(key) % gh->nbuckets;
Entry *e;
Entry *p = NULL;
- for (e= gh->buckets[hash]; e; e= e->next) {
- if (gh->cmpfp(key, e->key)==0) {
- Entry *n= e->next;
+ for (e = gh->buckets[hash]; e; e = e->next) {
+ if (gh->cmpfp(key, e->key) == 0) {
+ Entry *n = e->next;
- if (keyfreefp) keyfreefp(e->key);
- if (valfreefp) valfreefp(e->val);
+ if (keyfreefp)
+ keyfreefp(e->key);
+ if (valfreefp)
+ valfreefp(e->val);
BLI_mempool_free(gh->entrypool, e);
- /* correct but 'e' isnt used before return */
- /* e= n; */ /*UNUSED*/
+ /* correct but 'e' isn't used before return */
+ /* e= n; *//*UNUSED*/
if (p)
p->next = n;
else
@@ -157,11 +156,11 @@ int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr
int BLI_ghash_haskey(GHash *gh, void *key)
{
- unsigned int hash= gh->hashfp(key)%gh->nbuckets;
+ unsigned int hash = gh->hashfp(key) % gh->nbuckets;
Entry *e;
- for (e= gh->buckets[hash]; e; e= e->next)
- if (gh->cmpfp(key, e->key)==0)
+ for (e = gh->buckets[hash]; e; e = e->next)
+ if (gh->cmpfp(key, e->key) == 0)
return 1;
return 0;
@@ -170,22 +169,22 @@ int BLI_ghash_haskey(GHash *gh, void *key)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
{
int i;
-
+
if (keyfreefp || valfreefp) {
- for (i=0; i<gh->nbuckets; i++) {
+ for (i = 0; i < gh->nbuckets; i++) {
Entry *e;
-
- for (e= gh->buckets[i]; e; ) {
- Entry *n= e->next;
-
+
+ for (e = gh->buckets[i]; e;) {
+ Entry *n = e->next;
+
if (keyfreefp) keyfreefp(e->key);
if (valfreefp) valfreefp(e->val);
- e= n;
+ e = n;
}
}
}
-
+
MEM_freeN(gh->buckets);
BLI_mempool_destroy(gh->entrypool);
gh->buckets = NULL;
@@ -198,28 +197,28 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef
GHashIterator *BLI_ghashIterator_new(GHash *gh)
{
- GHashIterator *ghi= MEM_mallocN(sizeof(*ghi), "ghash iterator");
- ghi->gh= gh;
- ghi->curEntry= NULL;
- ghi->curBucket= -1;
+ GHashIterator *ghi = MEM_mallocN(sizeof(*ghi), "ghash iterator");
+ ghi->gh = gh;
+ ghi->curEntry = NULL;
+ ghi->curBucket = -1;
while (!ghi->curEntry) {
ghi->curBucket++;
- if (ghi->curBucket==ghi->gh->nbuckets)
+ if (ghi->curBucket == ghi->gh->nbuckets)
break;
- ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
+ ghi->curEntry = ghi->gh->buckets[ghi->curBucket];
}
return ghi;
}
void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
{
- ghi->gh= gh;
- ghi->curEntry= NULL;
- ghi->curBucket= -1;
+ ghi->gh = gh;
+ ghi->curEntry = NULL;
+ ghi->curBucket = -1;
while (!ghi->curEntry) {
ghi->curBucket++;
- if (ghi->curBucket==ghi->gh->nbuckets)
+ if (ghi->curBucket == ghi->gh->nbuckets)
break;
- ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
+ ghi->curEntry = ghi->gh->buckets[ghi->curBucket];
}
}
void BLI_ghashIterator_free(GHashIterator *ghi)
@@ -229,22 +228,22 @@ void BLI_ghashIterator_free(GHashIterator *ghi)
void *BLI_ghashIterator_getKey(GHashIterator *ghi)
{
- return ghi->curEntry?ghi->curEntry->key:NULL;
+ return ghi->curEntry ? ghi->curEntry->key : NULL;
}
void *BLI_ghashIterator_getValue(GHashIterator *ghi)
{
- return ghi->curEntry?ghi->curEntry->val:NULL;
+ return ghi->curEntry ? ghi->curEntry->val : NULL;
}
void BLI_ghashIterator_step(GHashIterator *ghi)
{
if (ghi->curEntry) {
- ghi->curEntry= ghi->curEntry->next;
+ ghi->curEntry = ghi->curEntry->next;
while (!ghi->curEntry) {
ghi->curBucket++;
- if (ghi->curBucket==ghi->gh->nbuckets)
+ if (ghi->curBucket == ghi->gh->nbuckets)
break;
- ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
+ ghi->curEntry = ghi->gh->buckets[ghi->curBucket];
}
}
}
@@ -261,10 +260,10 @@ unsigned int BLI_ghashutil_ptrhash(const void *key)
}
int BLI_ghashutil_ptrcmp(const void *a, const void *b)
{
- if (a==b)
+ if (a == b)
return 0;
else
- return (a<b)?-1:1;
+ return (a < b) ? -1 : 1;
}
unsigned int BLI_ghashutil_inthash(const void *ptr)
@@ -283,21 +282,22 @@ unsigned int BLI_ghashutil_inthash(const void *ptr)
int BLI_ghashutil_intcmp(const void *a, const void *b)
{
- if (a==b)
+ if (a == b)
return 0;
else
- return (a<b)?-1:1;
+ return (a < b) ? -1 : 1;
}
unsigned int BLI_ghashutil_strhash(const void *ptr)
{
- const char *s= ptr;
- unsigned int i= 0;
+ const char *s = ptr;
+ unsigned int i = 0;
unsigned char c;
-
- while ( (c= *s++) )
- i= i*37 + c;
-
+
+ while ((c = *s++)) {
+ i = i * 37 + c;
+ }
+
return i;
}
int BLI_ghashutil_strcmp(const void *a, const void *b)
@@ -326,7 +326,7 @@ int BLI_ghashutil_paircmp(const void *a, const void *b)
const GHashPair *B = b;
int cmp = BLI_ghashutil_ptrcmp(A->first, B->first);
- if(cmp == 0)
+ if (cmp == 0)
return BLI_ghashutil_intcmp(SET_INT_IN_POINTER(A->second), SET_INT_IN_POINTER(B->second));
return cmp;
}
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c
index 62a38e7933a..fa7b91b8539 100644
--- a/source/blender/blenlib/intern/BLI_heap.c
+++ b/source/blender/blenlib/intern/BLI_heap.c
@@ -30,12 +30,12 @@
* \ingroup bli
*/
-
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_memarena.h"
#include "BLI_heap.h"
+#include "BLI_utildefines.h"
/***/
@@ -54,27 +54,25 @@ struct Heap {
HeapNode **tree;
};
-#define SWAP(type, a, b) \
- { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; }
-#define HEAP_PARENT(i) ((i-1)>>1)
-#define HEAP_LEFT(i) ((i<<1)+1)
-#define HEAP_RIGHT(i) ((i<<1)+2)
+#define HEAP_PARENT(i) ((i - 1) >> 1)
+#define HEAP_LEFT(i) ((i << 1) + 1)
+#define HEAP_RIGHT(i) ((i << 1) + 2)
#define HEAP_COMPARE(a, b) (a->value < b->value)
#define HEAP_EQUALS(a, b) (a->value == b->value)
#define HEAP_SWAP(heap, i, j) \
{ \
SWAP(int, heap->tree[i]->index, heap->tree[j]->index); \
- SWAP(HeapNode*, heap->tree[i], heap->tree[j]); \
+ SWAP(HeapNode *, heap->tree[i], heap->tree[j]); \
}
/***/
Heap *BLI_heap_new(void)
{
- Heap *heap = (Heap*)MEM_callocN(sizeof(Heap), "BLIHeap");
+ Heap *heap = (Heap *)MEM_callocN(sizeof(Heap), __func__);
heap->bufsize = 1;
- heap->tree = (HeapNode**)MEM_mallocN(sizeof(HeapNode*), "BLIHeapTree");
- heap->arena = BLI_memarena_new(1<<16, "heap arena");
+ heap->tree = (HeapNode **)MEM_mallocN(sizeof(HeapNode *), "BLIHeapTree");
+ heap->arena = BLI_memarena_new(1 << 16, "heap arena");
return heap;
}
@@ -86,7 +84,7 @@ void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp)
if (ptrfreefp)
for (i = 0; i < heap->size; i++)
ptrfreefp(heap->tree[i]->ptr);
-
+
MEM_freeN(heap->tree);
BLI_memarena_free(heap->arena);
MEM_freeN(heap);
@@ -99,11 +97,11 @@ static void BLI_heap_down(Heap *heap, int i)
int l = HEAP_LEFT(i);
int r = HEAP_RIGHT(i);
- smallest = ((l < size) && HEAP_COMPARE(heap->tree[l], heap->tree[i]))? l: i;
+ smallest = ((l < size) && HEAP_COMPARE(heap->tree[l], heap->tree[i])) ? l : i;
if ((r < size) && HEAP_COMPARE(heap->tree[r], heap->tree[smallest]))
smallest = r;
-
+
if (smallest == i)
break;
@@ -130,11 +128,11 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
HeapNode *node;
if ((heap->size + 1) > heap->bufsize) {
- int newsize = heap->bufsize*2;
+ int newsize = heap->bufsize * 2;
HeapNode **newtree;
- newtree = (HeapNode**)MEM_mallocN(newsize*sizeof(*newtree), "BLIHeapTree");
- memcpy(newtree, heap->tree, sizeof(HeapNode*)*heap->size);
+ newtree = (HeapNode **)MEM_mallocN(newsize * sizeof(*newtree), __func__);
+ memcpy(newtree, heap->tree, sizeof(HeapNode *) * heap->size);
MEM_freeN(heap->tree);
heap->tree = newtree;
@@ -143,10 +141,10 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
if (heap->freenodes) {
node = heap->freenodes;
- heap->freenodes = (HeapNode*)(((HeapNode*)heap->freenodes)->ptr);
+ heap->freenodes = (HeapNode *)(((HeapNode *)heap->freenodes)->ptr);
}
else
- node = (HeapNode*)BLI_memarena_alloc(heap->arena, sizeof *node);
+ node = (HeapNode *)BLI_memarena_alloc(heap->arena, sizeof *node);
node->value = value;
node->ptr = ptr;
@@ -156,7 +154,7 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
heap->size++;
- BLI_heap_up(heap, heap->size-1);
+ BLI_heap_up(heap, heap->size - 1);
return node;
}
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index b992d518b49..cc05a8a2628 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -133,10 +133,10 @@ static float KDOP_AXES[13][3] =
{ \
HEAP_TYPE element = heap[heap_size-1]; \
int child = heap_size-1; \
- while(child != 0) \
+ while (child != 0) \
{ \
int parent = (child-1) / 2; \
- if(PRIORITY(element, heap[parent])) \
+ if (PRIORITY(element, heap[parent])) \
{ \
heap[child] = heap[parent]; \
child = parent; \
@@ -150,13 +150,13 @@ static float KDOP_AXES[13][3] =
{ \
HEAP_TYPE element = heap[heap_size-1]; \
int parent = 0; \
- while(parent < (heap_size-1)/2 ) \
+ while (parent < (heap_size-1)/2 ) \
{ \
int child2 = (parent+1)*2; \
- if(PRIORITY(heap[child2-1], heap[child2])) \
+ if (PRIORITY(heap[child2-1], heap[child2])) \
--child2; \
\
- if(PRIORITY(element, heap[child2])) \
+ if (PRIORITY(element, heap[child2])) \
break; \
\
heap[parent] = heap[child2]; \
@@ -171,10 +171,10 @@ static int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, in
int new_max_size = *max_size * 2;
void *new_memblock = NULL;
- if(new_size <= *max_size)
+ if (new_size <= *max_size)
return TRUE;
- if(*memblock == local_memblock)
+ if (*memblock == local_memblock)
{
new_memblock = malloc( size_per_item * new_max_size );
memcpy( new_memblock, *memblock, size_per_item * *max_size );
@@ -182,7 +182,7 @@ static int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, in
else
new_memblock = realloc(*memblock, size_per_item * new_max_size );
- if(new_memblock)
+ if (new_memblock)
{
*memblock = new_memblock;
*max_size = new_max_size;
@@ -221,7 +221,7 @@ static void bvh_insertionsort(BVHNode **a, int lo, int hi, int axis)
{
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--;
@@ -238,7 +238,7 @@ static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode * x, int axis)
while ((a[i])->bv[axis] < x->bv[axis]) i++;
j--;
while (x->bv[axis] < (a[j])->bv[axis]) j--;
- if(!(i < j))
+ if (!(i < j))
return i;
SWAP( BVHNode* , a[i], a[j]);
i++;
@@ -354,10 +354,10 @@ 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)
+ if (cut <= n)
begin = cut;
else
end = cut;
@@ -377,7 +377,7 @@ static void build_skip_links(BVHTree *tree, BVHNode *node, BVHNode *left, BVHNod
for (i = 0; i < node->totnode; i++)
{
- if(i+1 < node->totnode)
+ if (i+1 < node->totnode)
build_skip_links(tree, node->children[i], left, node->children[i+1] );
else
build_skip_links(tree, node->children[i], left, right );
@@ -396,7 +396,7 @@ 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)
+ if (!moving)
{
for (i = tree->start_axis; i < tree->stop_axis; i++)
{
@@ -405,7 +405,7 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int
}
}
- for(k = 0; k < numpoints; k++)
+ for (k = 0; k < numpoints; k++)
{
// for all Axes.
for (i = tree->start_axis; i < tree->stop_axis; i++)
@@ -514,14 +514,14 @@ static void node_join(BVHTree *tree, BVHNode *node)
static void bvhtree_print_tree(BVHTree *tree, BVHNode *node, int depth)
{
int i;
- for(i=0; i<depth; i++) printf(" ");
+ for (i=0; i<depth; i++) printf(" ");
printf(" - %d (%ld): ", node->index, node - tree->nodearray);
- for(i=2*tree->start_axis; i<2*tree->stop_axis; i++)
+ for (i=2*tree->start_axis; i<2*tree->stop_axis; i++)
printf("%.3f ", node->bv[i]);
printf("\n");
- for(i=0; i<tree->tree_type; i++)
- if(node->children[i])
+ for (i=0; i<tree->tree_type; i++)
+ if (node->children[i])
bvhtree_print_tree(tree, node->children[i], depth+1);
}
@@ -552,18 +552,18 @@ static void verify_tree(BVHTree *tree)
int i, j, check = 0;
// check the pointer list
- for(i = 0; i < tree->totleaf; i++)
+ for (i = 0; i < tree->totleaf; i++)
{
- if(tree->nodes[i]->parent == NULL)
+ if (tree->nodes[i]->parent == NULL)
printf("Leaf has no parent: %d\n", i);
else
{
- for(j = 0; j < tree->tree_type; j++)
+ for (j = 0; j < tree->tree_type; j++)
{
- if(tree->nodes[i]->parent->children[j] == tree->nodes[i])
+ if (tree->nodes[i]->parent->children[j] == tree->nodes[i])
check = 1;
}
- if(!check)
+ if (!check)
{
printf("Parent child relationship doesn't match: %d\n", i);
}
@@ -572,18 +572,18 @@ static void verify_tree(BVHTree *tree)
}
// check the leaf list
- for(i = 0; i < tree->totleaf; i++)
+ for (i = 0; i < tree->totleaf; i++)
{
- if(tree->nodearray[i].parent == NULL)
+ if (tree->nodearray[i].parent == NULL)
printf("Leaf has no parent: %d\n", i);
else
{
- for(j = 0; j < tree->tree_type; j++)
+ for (j = 0; j < tree->tree_type; j++)
{
- if(tree->nodearray[i].parent->children[j] == &tree->nodearray[i])
+ if (tree->nodearray[i].parent->children[j] == &tree->nodearray[i])
check = 1;
}
- if(!check)
+ if (!check)
{
printf("Parent child relationship doesn't match: %d\n", i);
}
@@ -619,7 +619,7 @@ 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(
+ for (
data->leafs_per_child[0] = 1;
data->leafs_per_child[0] < data->totleafs;
data->leafs_per_child[0] *= data->tree_type
@@ -628,7 +628,7 @@ static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data)
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;
@@ -643,9 +643,9 @@ static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data)
static int implicit_leafs_index(BVHBuildHelper *data, int depth, int child_index)
{
int min_leaf_index = child_index * data->leafs_per_child[depth-1];
- if(min_leaf_index <= data->remain_leafs)
+ if (min_leaf_index <= data->remain_leafs)
return min_leaf_index;
- else if(data->leafs_per_child[depth])
+ else if (data->leafs_per_child[depth])
return data->totleafs - (data->branches_on_level[depth-1] - child_index) * data->leafs_per_child[depth];
else
return data->remain_leafs;
@@ -700,9 +700,9 @@ 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])
+ if (nth[i] >= nth[partitions])
break;
partition_nth_element(leafs_array, nth[i], nth[partitions], nth[i+1], split_axis);
@@ -742,7 +742,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
//Most of bvhtree code relies on 1-leaf trees having at least one branch
//We handle that special case here
- if(num_leafs == 1)
+ if (num_leafs == 1)
{
BVHNode *root = branches_array+0;
refit_kdop_hull(tree, root, 0, num_leafs);
@@ -758,7 +758,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
build_implicit_tree_helper(tree, &data);
//Loop tree levels (log N) loops
- for(i=1, depth = 1; i <= num_branches; i = i*tree_type + tree_offset, depth++)
+ for (i=1, depth = 1; i <= num_branches; i = i*tree_type + tree_offset, depth++)
{
const int first_of_next_level = i*tree_type + tree_offset;
const int end_j = MIN2(first_of_next_level, num_branches + 1); //index of last branch on this level
@@ -766,7 +766,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
//Loop all branches on this level
#pragma omp parallel for private(j) schedule(static)
- for(j = i; j < end_j; j++) {
+ for (j = i; j < end_j; j++) {
int k;
const int parent_level_index= j-i;
BVHNode* parent = branches_array + j;
@@ -836,10 +836,10 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
int numnodes, i;
// theres not support for trees below binary-trees :P
- if(tree_type < 2)
+ if (tree_type < 2)
return NULL;
- if(tree_type > MAX_TREETYPE)
+ if (tree_type > MAX_TREETYPE)
return NULL;
tree = (BVHTree *)MEM_callocN(sizeof(BVHTree), "BVHTree");
@@ -849,7 +849,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
//this bug would show up when casting a ray aligned with a kdop-axis and with an edge of 2 faces
epsilon = MAX2(FLT_EPSILON, epsilon);
- if(tree) {
+ if (tree) {
tree->epsilon = epsilon;
tree->tree_type = tree_type;
tree->axis = axis;
@@ -885,21 +885,21 @@ 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);
@@ -908,7 +908,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
tree->nodearray = (BVHNode *)MEM_callocN(sizeof(BVHNode)* numnodes, "BVHNodeArray");
- if(!tree->nodearray)
+ if (!tree->nodearray)
{
MEM_freeN(tree->nodechild);
MEM_freeN(tree->nodebv);
@@ -918,7 +918,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
}
//link the dynamic bv and child links
- for(i=0; i< numnodes; i++)
+ for (i=0; i< numnodes; i++)
{
tree->nodearray[i].bv = tree->nodebv + i * axis;
tree->nodearray[i].children = tree->nodechild + i * tree_type;
@@ -931,7 +931,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
void BLI_bvhtree_free(BVHTree *tree)
{
- if(tree)
+ if (tree)
{
MEM_freeN(tree->nodes);
MEM_freeN(tree->nodearray);
@@ -957,7 +957,7 @@ void BLI_bvhtree_balance(BVHTree *tree)
//current code expects the branches to be linked to the nodes array
//we perform that linkage here
tree->totbranch = implicit_needed_branches(tree->tree_type, tree->totleaf);
- for(i = 0; i < tree->totbranch; i++)
+ for (i = 0; i < tree->totbranch; i++)
tree->nodes[tree->totleaf + i] = branches_array + i;
build_skip_links(tree, tree->nodes[tree->totleaf], NULL, NULL);
@@ -970,10 +970,10 @@ int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints)
BVHNode *node = NULL;
// insert should only possible as long as tree->totbranch is 0
- if(tree->totbranch > 0)
+ if (tree->totbranch > 0)
return 0;
- if(tree->totleaf+1 >= MEM_allocN_len(tree->nodes)/sizeof(*(tree->nodes)))
+ if (tree->totleaf+1 >= MEM_allocN_len(tree->nodes)/sizeof(*(tree->nodes)))
return 0;
// TODO check if have enough nodes in array
@@ -1002,14 +1002,14 @@ int BLI_bvhtree_update_node(BVHTree *tree, int index, const float *co, const flo
BVHNode *node= NULL;
// check if index exists
- if(index > tree->totleaf)
+ if (index > tree->totleaf)
return 0;
node = tree->nodearray + index;
create_kdop_hull(tree, node, co, numpoints, 0);
- if(co_moving)
+ if (co_moving)
create_kdop_hull(tree, node, co_moving, numpoints, 1);
// inflate the bv with some epsilon
@@ -1070,26 +1070,26 @@ 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;
@@ -1105,9 +1105,9 @@ static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2)
}
else
{
- for(j = 0; j < data->tree2->tree_type; j++)
+ for (j = 0; j < data->tree2->tree_type; j++)
{
- if(node2->children[j])
+ if (node2->children[j])
traverse(data, node1, node2->children[j]);
}
}
@@ -1115,9 +1115,9 @@ static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2)
else
{
- for(j = 0; j < data->tree2->tree_type; j++)
+ for (j = 0; j < data->tree2->tree_type; j++)
{
- if(node1->children[j])
+ if (node1->children[j])
traverse(data, node1->children[j], node2);
}
}
@@ -1133,16 +1133,16 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
BVHOverlapData **data;
// check for compatibility of both trees (can't compare 14-DOP with 18-DOP)
- if((tree1->axis != tree2->axis) && (tree1->axis == 14 || tree2->axis == 14) && (tree1->axis == 18 || tree2->axis == 18))
+ if ((tree1->axis != tree2->axis) && (tree1->axis == 14 || tree2->axis == 14) && (tree1->axis == 18 || tree2->axis == 18))
return NULL;
// fast check root nodes for collision before doing big splitting + traversal
- if(!tree_overlap(tree1->nodes[tree1->totleaf], tree2->nodes[tree2->totleaf], MIN2(tree1->start_axis, tree2->start_axis), MIN2(tree1->stop_axis, tree2->stop_axis)))
+ if (!tree_overlap(tree1->nodes[tree1->totleaf], tree2->nodes[tree2->totleaf], MIN2(tree1->start_axis, tree2->start_axis), MIN2(tree1->stop_axis, tree2->stop_axis)))
return NULL;
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");
@@ -1157,23 +1157,23 @@ 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]);
}
- for(j = 0; j < tree1->tree_type; j++)
+ for (j = 0; j < tree1->tree_type; j++)
total += data[j]->i;
to = overlap = (BVHTreeOverlap *)MEM_callocN(sizeof(BVHTreeOverlap)*total, "BVHTreeOverlap");
- for(j = 0; j < tree1->tree_type; j++)
+ for (j = 0; j < tree1->tree_type; j++)
{
memcpy(to, data[j]->overlap, data[j]->i*sizeof(BVHTreeOverlap));
to+=data[j]->i;
}
- for(j = 0; j < tree1->tree_type; j++)
+ for (j = 0; j < tree1->tree_type; j++)
{
free(data[j]->overlap);
MEM_freeN(data[j]);
@@ -1191,11 +1191,11 @@ 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])
+ if (bv[0] > proj[i])
nearest[i] = bv[0];
- else if(bv[1] < proj[i])
+ else if (bv[1] < proj[i])
nearest[i] = bv[1];
else
nearest[i] = proj[i];
@@ -1204,16 +1204,16 @@ static float calc_nearest_point(const float proj[3], BVHNode *node, float *neare
#if 0
//nearest on a general hull
copy_v3_v3(nearest, data->co);
- for(i = data->tree->start_axis; i != data->tree->stop_axis; i++, bv+=2)
+ for (i = data->tree->start_axis; i != data->tree->stop_axis; i++, bv+=2)
{
float proj = dot_v3v3( nearest, KDOP_AXES[i]);
float dl = bv[0] - proj;
float du = bv[1] - proj;
- if(dl > 0) {
+ if (dl > 0) {
madd_v3_v3fl(nearest, KDOP_AXES[i], dl);
}
- else if(du < 0) {
+ else if (du < 0) {
madd_v3_v3fl(nearest, KDOP_AXES[i], du);
}
}
@@ -1235,9 +1235,9 @@ 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)
+ if (data->callback)
data->callback(data->userdata , node->index, data->co, &data->nearest);
else
{
@@ -1251,20 +1251,20 @@ static void dfs_find_nearest_dfs(BVHNearestData *data, BVHNode *node)
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;
+ 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--)
+ for (i=node->totnode-1; i >= 0 ; i--)
{
- if( calc_nearest_point(data->proj, node->children[i], nearest) >= data->nearest.dist) continue;
+ if ( calc_nearest_point(data->proj, node->children[i], nearest) >= data->nearest.dist) continue;
dfs_find_nearest_dfs(data, node->children[i]);
}
}
@@ -1275,7 +1275,7 @@ static void dfs_find_nearest_begin(BVHNearestData *data, BVHNode *node)
{
float nearest[3], sdist;
sdist = calc_nearest_point(data->proj, node, nearest);
- if(sdist >= data->nearest.dist) return;
+ if (sdist >= data->nearest.dist) return;
dfs_find_nearest_dfs(data, node);
}
@@ -1305,7 +1305,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
int callbacks = 0, push_heaps = 0;
- if(node->totnode == 0)
+ if (node->totnode == 0)
{
dfs_find_nearest_dfs(data, node);
return;
@@ -1314,13 +1314,13 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
current.node = node;
current.dist = calc_nearest_point(data->proj, node, nearest);
- while(current.dist < data->nearest.dist)
+ while (current.dist < data->nearest.dist)
{
// printf("%f : %f\n", current.dist, data->nearest.dist);
- for(i=0; i< current.node->totnode; i++)
+ for (i=0; i< current.node->totnode; i++)
{
BVHNode *child = current.node->children[i];
- if(child->totnode == 0)
+ if (child->totnode == 0)
{
callbacks++;
dfs_find_nearest_dfs(data, child);
@@ -1328,12 +1328,12 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
else
{
//adjust heap size
- if(heap_size >= max_heap_size
+ if (heap_size >= max_heap_size
&& ADJUST_MEMORY(default_heap, (void**)&heap, heap_size+1, &max_heap_size, sizeof(heap[0])) == FALSE)
{
printf("WARNING: bvh_find_nearest got out of memory\n");
- if(heap != default_heap)
+ if (heap != default_heap)
free(heap);
return;
@@ -1342,7 +1342,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
heap[heap_size].node = current.node->children[i];
heap[heap_size].dist = calc_nearest_point(data->proj, current.node->children[i], nearest);
- if(heap[heap_size].dist >= data->nearest.dist) continue;
+ if (heap[heap_size].dist >= data->nearest.dist) continue;
heap_size++;
NodeDistance_push_heap(heap, heap_size);
@@ -1351,7 +1351,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
}
}
- if(heap_size == 0) break;
+ if (heap_size == 0) break;
current = heap[0];
NodeDistance_pop_heap(heap, heap_size);
@@ -1361,7 +1361,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
// printf("hsize=%d, callbacks=%d, pushs=%d\n", heap_size, callbacks, push_heaps);
- if(heap != default_heap)
+ if (heap != default_heap)
free(heap);
}
#endif
@@ -1381,12 +1381,12 @@ 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) );
}
@@ -1397,11 +1397,11 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
}
//dfs search
- if(root)
+ if (root)
dfs_find_nearest_begin(&data, root);
//copy back results
- if(nearest)
+ if (nearest)
{
memcpy(nearest, &data.nearest, sizeof(*nearest));
}
@@ -1424,12 +1424,12 @@ static float ray_nearest_hit(BVHRayCastData *data, float *bv)
float low = 0, upper = data->hit.dist;
- for(i=0; i != 3; i++, bv += 2)
+ for (i=0; i != 3; i++, bv += 2)
{
- if(data->ray_dot_axis[i] == 0.0f)
+ if (data->ray_dot_axis[i] == 0.0f)
{
//axis aligned ray
- if(data->ray.origin[i] < bv[0] - data->ray.radius
+ if (data->ray.origin[i] < bv[0] - data->ray.radius
|| data->ray.origin[i] > bv[1] + data->ray.radius)
return FLT_MAX;
}
@@ -1438,18 +1438,18 @@ static float ray_nearest_hit(BVHRayCastData *data, float *bv)
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;
+ if (ll > low) low = ll;
+ if (lu < upper) upper = lu;
}
else
{
- if(lu > low) low = lu;
- if(ll < upper) upper = ll;
+ if (lu > low) low = lu;
+ if (ll < upper) upper = ll;
}
- if(low > upper) return FLT_MAX;
+ if (low > upper) return FLT_MAX;
}
}
return low;
@@ -1472,9 +1472,9 @@ static float fast_ray_nearest_hit(const BVHRayCastData *data, const BVHNode *nod
float t1z = (bv[data->index[4]] - data->ray.origin[2]) * data->idot_axis[2];
float t2z = (bv[data->index[5]] - data->ray.origin[2]) * data->idot_axis[2];
- if(t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return FLT_MAX;
- if(t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return FLT_MAX;
- if(t1x > data->hit.dist || t1y > data->hit.dist || t1z > data->hit.dist) return FLT_MAX;
+ if (t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return FLT_MAX;
+ if (t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return FLT_MAX;
+ if (t1x > data->hit.dist || t1y > data->hit.dist || t1z > data->hit.dist) return FLT_MAX;
dist = t1x;
if (t1y > dist) dist = t1y;
@@ -1490,11 +1490,11 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node)
//before calling the ray-primitive functions
/* XXX: temporary solution for particles until fast_ray_nearest_hit supports ray.radius */
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 (dist >= data->hit.dist) return;
- if(node->totnode == 0)
+ if (node->totnode == 0)
{
- if(data->callback)
+ if (data->callback)
data->callback(data->userdata, node->index, &data->ray, &data->hit);
else
{
@@ -1506,16 +1506,16 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node)
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)
+ if (data->ray_dot_axis[ (int)node->main_axis ] > 0.0f)
{
- for(i=0; i != node->totnode; i++)
+ for (i=0; i != node->totnode; i++)
{
dfs_raycast(data, node->children[i]);
}
}
else
{
- for(i=node->totnode-1; i >= 0; i--)
+ for (i=node->totnode-1; i >= 0; i--)
{
dfs_raycast(data, node->children[i]);
}
@@ -1526,18 +1526,18 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node)
#if 0
static void iterative_raycast(BVHRayCastData *data, BVHNode *node)
{
- while(node)
+ while (node)
{
float dist = fast_ray_nearest_hit(data, node);
- if(dist >= data->hit.dist)
+ if (dist >= data->hit.dist)
{
node = node->skip[1];
continue;
}
- if(node->totnode == 0)
+ if (node->totnode == 0)
{
- if(data->callback)
+ if (data->callback)
data->callback(data->userdata, node->index, &data->ray, &data->hit);
else
{
@@ -1573,12 +1573,12 @@ 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;
}
@@ -1589,7 +1589,7 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], f
}
- if(hit)
+ if (hit)
memcpy( &data.hit, hit, sizeof(*hit) );
else
{
@@ -1597,14 +1597,14 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], f
data.hit.dist = FLT_MAX;
}
- if(root)
+ if (root)
{
dfs_raycast(&data, root);
// iterative_raycast(&data, root);
}
- if(hit)
+ if (hit)
memcpy( hit, &data.hit, sizeof(*hit) );
return data.hit.index;
@@ -1633,7 +1633,7 @@ float BLI_bvhtree_bb_raycast(float *bv, const float light_start[3], const float
dist = ray_nearest_hit(&data, bv);
- if(dist > 0.0f)
+ if (dist > 0.0f)
{
madd_v3_v3v3fl(pos, light_start, data.ray.direction, dist);
}
@@ -1664,7 +1664,7 @@ typedef struct RangeQueryData
static void dfs_range_query(RangeQueryData *data, BVHNode *node)
{
- if(node->totnode == 0)
+ if (node->totnode == 0)
{
#if 0 /*UNUSED*/
//Calculate the node min-coords (if the node was a point then this is the point coordinates)
@@ -1677,17 +1677,17 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node)
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 );
+ data->callback(data->userdata, node->children[i]->index, dist);
}
else
dfs_range_query( data, node->children[i] );
@@ -1709,17 +1709,17 @@ int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius, BVHT
data.callback = callback;
data.userdata = userdata;
- if(root != NULL)
+ if (root != NULL)
{
float nearest[3];
float dist = calc_nearest_point(data.center, root, nearest);
- if(dist < data.radius)
+ if (dist < data.radius)
{
//Its a leaf.. call the callback
- if(root->totnode == 0)
+ if (root->totnode == 0)
{
data.hits++;
- data.callback( data.userdata, root->index, dist );
+ data.callback(data.userdata, root->index, dist);
}
else
dfs_range_query( &data, root );
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c
index 6db21ec14a6..388c61ec9dd 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -67,7 +67,7 @@ KDTree *BLI_kdtree_new(int maxsize)
void BLI_kdtree_free(KDTree *tree)
{
- if(tree) {
+ if (tree) {
MEM_freeN(tree->nodes);
MEM_freeN(tree);
}
@@ -79,7 +79,7 @@ void BLI_kdtree_insert(KDTree *tree, int index, float *co, float *nor)
node->index= index;
copy_v3_v3(node->co, co);
- if(nor) copy_v3_v3(node->nor, nor);
+ if (nor) copy_v3_v3(node->nor, nor);
}
static KDTreeNode *kdtree_balance(KDTreeNode *nodes, int totnode, int axis)
@@ -88,9 +88,9 @@ static KDTreeNode *kdtree_balance(KDTreeNode *nodes, int totnode, int axis)
float co;
int left, right, median, i, j;
- if(totnode <= 0)
+ if (totnode <= 0)
return NULL;
- else if(totnode == 1)
+ else if (totnode == 1)
return nodes;
/* quicksort style sorting around median */
@@ -98,23 +98,23 @@ static KDTreeNode *kdtree_balance(KDTreeNode *nodes, int totnode, int axis)
right= totnode-1;
median= totnode/2;
- while(right > left) {
+ while (right > left) {
co= nodes[right].co[axis];
i= left-1;
j= right;
- while(1) {
- while(nodes[++i].co[axis] < co);
- while(nodes[--j].co[axis] > co && j>left);
+ while (1) {
+ while (nodes[++i].co[axis] < co);
+ while (nodes[--j].co[axis] > co && j>left);
- if(i >= j) break;
+ if (i >= j) break;
SWAP(KDTreeNode, nodes[i], nodes[j]);
}
SWAP(KDTreeNode, nodes[i], nodes[right]);
- if(i >= median)
+ if (i >= median)
right= i-1;
- if(i <= median)
+ if (i <= median)
left= i+1;
}
@@ -145,7 +145,7 @@ static float squared_distance(const float v2[3], const float v1[3], float *UNUSE
//if(n1 && n2 && (dot_v3v3(n1, n2) < 0.0f))
/* can someone explain why this is done?*/
- if(n2 && (dot_v3v3(d, n2) < 0.0f)) {
+ if (n2 && (dot_v3v3(d, n2) < 0.0f)) {
dist *= 10.0f;
}
@@ -159,7 +159,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *
float min_dist, cur_dist;
int totstack, cur=0;
- if(!tree->root)
+ if (!tree->root)
return -1;
stack= defaultstack;
@@ -169,71 +169,71 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *
min_node= root;
min_dist= squared_distance(root->co,co,root->nor,nor);
- if(co[root->d] < root->co[root->d]) {
- if(root->right)
+ if (co[root->d] < root->co[root->d]) {
+ if (root->right)
stack[cur++]=root->right;
- if(root->left)
+ if (root->left)
stack[cur++]=root->left;
}
else {
- if(root->left)
+ if (root->left)
stack[cur++]=root->left;
- if(root->right)
+ if (root->right)
stack[cur++]=root->right;
}
- while(cur--) {
+ while (cur--) {
node=stack[cur];
cur_dist = node->co[node->d] - co[node->d];
- if(cur_dist<0.0f) {
+ if (cur_dist<0.0f) {
cur_dist= -cur_dist*cur_dist;
- if(-cur_dist<min_dist) {
+ if (-cur_dist<min_dist) {
cur_dist=squared_distance(node->co,co,node->nor,nor);
- if(cur_dist<min_dist) {
+ if (cur_dist<min_dist) {
min_dist=cur_dist;
min_node=node;
}
- if(node->left)
+ if (node->left)
stack[cur++]=node->left;
}
- if(node->right)
+ if (node->right)
stack[cur++]=node->right;
}
- else{
+ else {
cur_dist= cur_dist*cur_dist;
- if(cur_dist<min_dist) {
+ if (cur_dist<min_dist) {
cur_dist=squared_distance(node->co,co,node->nor,nor);
- if(cur_dist<min_dist) {
+ if (cur_dist<min_dist) {
min_dist=cur_dist;
min_node=node;
}
- if(node->right)
+ if (node->right)
stack[cur++]=node->right;
}
- if(node->left)
+ if (node->left)
stack[cur++]=node->left;
}
- if(cur+3 > totstack) {
+ if (cur+3 > totstack) {
KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack");
memcpy(temp,stack,totstack*sizeof(KDTreeNode*));
- if(stack != defaultstack)
+ if (stack != defaultstack)
MEM_freeN(stack);
stack=temp;
totstack+=100;
}
}
- if(nearest) {
+ if (nearest) {
nearest->index= min_node->index;
nearest->dist= sqrt(min_dist);
copy_v3_v3(nearest->co, min_node->co);
}
- if(stack != defaultstack)
+ if (stack != defaultstack)
MEM_freeN(stack);
return min_node->index;
@@ -243,10 +243,10 @@ static void add_nearest(KDTreeNearest *ptn, int *found, int n, int index, float
{
int i;
- if(*found<n) (*found)++;
+ if (*found<n) (*found)++;
- for(i=*found-1; i>0; i--) {
- if(dist >= ptn[i-1].dist)
+ for (i=*found-1; i>0; i--) {
+ if (dist >= ptn[i-1].dist)
break;
else
ptn[i]= ptn[i-1];
@@ -265,7 +265,7 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree
float cur_dist;
int i, totstack, cur=0, found=0;
- if(!tree->root)
+ if (!tree->root)
return 0;
stack= defaultstack;
@@ -276,67 +276,67 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree
cur_dist= squared_distance(root->co,co,root->nor,nor);
add_nearest(nearest,&found,n,root->index,cur_dist,root->co);
- if(co[root->d] < root->co[root->d]) {
- if(root->right)
+ if (co[root->d] < root->co[root->d]) {
+ if (root->right)
stack[cur++]=root->right;
- if(root->left)
+ if (root->left)
stack[cur++]=root->left;
}
else {
- if(root->left)
+ if (root->left)
stack[cur++]=root->left;
- if(root->right)
+ if (root->right)
stack[cur++]=root->right;
}
- while(cur--) {
+ while (cur--) {
node=stack[cur];
cur_dist = node->co[node->d] - co[node->d];
- if(cur_dist<0.0f) {
+ if (cur_dist<0.0f) {
cur_dist= -cur_dist*cur_dist;
- if(found<n || -cur_dist<nearest[found-1].dist) {
+ if (found<n || -cur_dist<nearest[found-1].dist) {
cur_dist=squared_distance(node->co,co,node->nor,nor);
- if(found<n || cur_dist<nearest[found-1].dist)
+ if (found<n || cur_dist<nearest[found-1].dist)
add_nearest(nearest,&found,n,node->index,cur_dist,node->co);
- if(node->left)
+ if (node->left)
stack[cur++]=node->left;
}
- if(node->right)
+ if (node->right)
stack[cur++]=node->right;
}
- else{
+ else {
cur_dist= cur_dist*cur_dist;
- if(found<n || cur_dist<nearest[found-1].dist) {
+ if (found<n || cur_dist<nearest[found-1].dist) {
cur_dist=squared_distance(node->co,co,node->nor,nor);
- if(found<n || cur_dist<nearest[found-1].dist)
+ if (found<n || cur_dist<nearest[found-1].dist)
add_nearest(nearest,&found,n,node->index,cur_dist,node->co);
- if(node->right)
+ if (node->right)
stack[cur++]=node->right;
}
- if(node->left)
+ if (node->left)
stack[cur++]=node->left;
}
- if(cur+3 > totstack) {
+ if (cur+3 > totstack) {
KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack");
memcpy(temp,stack,totstack*sizeof(KDTreeNode*));
- if(stack != defaultstack)
+ if (stack != defaultstack)
MEM_freeN(stack);
stack=temp;
totstack+=100;
}
}
- for(i=0; i<found; i++)
+ for (i=0; i<found; i++)
nearest[i].dist= sqrt(nearest[i].dist);
- if(stack != defaultstack)
+ if (stack != defaultstack)
MEM_freeN(stack);
return found;
@@ -347,9 +347,9 @@ static int range_compare(const void * a, const void * b)
const KDTreeNearest *kda = a;
const KDTreeNearest *kdb = b;
- if(kda->dist < kdb->dist)
+ if (kda->dist < kdb->dist)
return -1;
- else if(kda->dist > kdb->dist)
+ else if (kda->dist > kdb->dist)
return 1;
else
return 0;
@@ -358,10 +358,10 @@ static void add_in_range(KDTreeNearest **ptn, int found, int *totfoundstack, int
{
KDTreeNearest *to;
- if(found+1 > *totfoundstack) {
+ if (found+1 > *totfoundstack) {
KDTreeNearest *temp=MEM_callocN((*totfoundstack+50)*sizeof(KDTreeNode), "psys_treefoundstack");
memcpy(temp, *ptn, *totfoundstack * sizeof(KDTreeNearest));
- if(*ptn)
+ if (*ptn)
MEM_freeN(*ptn);
*ptn = temp;
*totfoundstack+=50;
@@ -381,7 +381,7 @@ int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KD
float range2 = range*range, dist2;
int totstack, cur=0, found=0, totfoundstack=0;
- if(!tree || !tree->root)
+ if (!tree || !tree->root)
return 0;
stack= defaultstack;
@@ -389,61 +389,61 @@ int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KD
root= tree->root;
- if(co[root->d] + range < root->co[root->d]) {
- if(root->left)
+ if (co[root->d] + range < root->co[root->d]) {
+ if (root->left)
stack[cur++]=root->left;
}
- else if(co[root->d] - range > root->co[root->d]) {
- if(root->right)
+ else if (co[root->d] - range > root->co[root->d]) {
+ if (root->right)
stack[cur++]=root->right;
}
else {
dist2 = squared_distance(root->co, co, root->nor, nor);
- if(dist2 <= range2)
+ if (dist2 <= range2)
add_in_range(&foundstack, found++, &totfoundstack, root->index, dist2, root->co);
- if(root->left)
+ if (root->left)
stack[cur++]=root->left;
- if(root->right)
+ if (root->right)
stack[cur++]=root->right;
}
- while(cur--) {
+ while (cur--) {
node=stack[cur];
- if(co[node->d] + range < node->co[node->d]) {
- if(node->left)
+ if (co[node->d] + range < node->co[node->d]) {
+ if (node->left)
stack[cur++]=node->left;
}
- else if(co[node->d] - range > node->co[node->d]) {
- if(node->right)
+ else if (co[node->d] - range > node->co[node->d]) {
+ if (node->right)
stack[cur++]=node->right;
}
else {
dist2 = squared_distance(node->co, co, node->nor, nor);
- if(dist2 <= range2)
+ if (dist2 <= range2)
add_in_range(&foundstack, found++, &totfoundstack, node->index, dist2, node->co);
- if(node->left)
+ if (node->left)
stack[cur++]=node->left;
- if(node->right)
+ if (node->right)
stack[cur++]=node->right;
}
- if(cur+3 > totstack) {
+ if (cur+3 > totstack) {
KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack");
memcpy(temp,stack,totstack*sizeof(KDTreeNode*));
- if(stack != defaultstack)
+ if (stack != defaultstack)
MEM_freeN(stack);
stack=temp;
totstack+=100;
}
}
- if(stack != defaultstack)
+ if (stack != defaultstack)
MEM_freeN(stack);
- if(found)
+ if (found)
qsort(foundstack, found, sizeof(KDTreeNearest), range_compare);
*nearest = foundstack;
diff --git a/source/blender/blenlib/intern/BLI_linklist.c b/source/blender/blenlib/intern/BLI_linklist.c
index 7529904c1ea..5c7d7089825 100644
--- a/source/blender/blenlib/intern/BLI_linklist.c
+++ b/source/blender/blenlib/intern/BLI_linklist.c
@@ -39,7 +39,8 @@ int BLI_linklist_length(LinkNode *list)
{
if (0) {
return list?(1+BLI_linklist_length(list->next)):0;
- } else {
+ }
+ else {
int len;
for (len=0; list; list= list->next)
@@ -131,7 +132,7 @@ void BLI_linklist_insert_after(LinkNode **listp, void *ptr)
nlink->link = ptr;
- if(node) {
+ if (node) {
nlink->next = node->next;
node->next = nlink;
}
diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c
index 72f312ba6e4..95a007db43e 100644
--- a/source/blender/blenlib/intern/BLI_memarena.c
+++ b/source/blender/blenlib/intern/BLI_memarena.c
@@ -30,8 +30,6 @@
* \ingroup bli
*/
-
-
#include "MEM_guardedalloc.h"
#include "BLI_memarena.h"
@@ -41,31 +39,31 @@ struct MemArena {
unsigned char *curbuf;
int bufsize, cursize;
const char *name;
-
- int use_calloc;
+
+ int use_calloc;
int align;
-
+
LinkNode *bufs;
};
MemArena *BLI_memarena_new(int bufsize, const char *name)
{
- MemArena *ma= MEM_callocN(sizeof(*ma), "memarena");
- ma->bufsize= bufsize;
+ MemArena *ma = MEM_callocN(sizeof(*ma), "memarena");
+ ma->bufsize = bufsize;
ma->align = 8;
- ma->name= name;
-
+ ma->name = name;
+
return ma;
}
void BLI_memarena_use_calloc(MemArena *ma)
{
- ma->use_calloc= 1;
+ ma->use_calloc = 1;
}
void BLI_memarena_use_malloc(MemArena *ma)
{
- ma->use_calloc= 0;
+ ma->use_calloc = 0;
}
void BLI_memarena_use_align(struct MemArena *ma, int align)
@@ -76,46 +74,47 @@ void BLI_memarena_use_align(struct MemArena *ma, int align)
void BLI_memarena_free(MemArena *ma)
{
- BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN);
+ BLI_linklist_free(ma->bufs, (void(*)(void *))MEM_freeN);
MEM_freeN(ma);
}
- /* amt must be power of two */
-#define PADUP(num, amt) ((num+(amt-1))&~(amt-1))
+/* amt must be power of two */
+#define PADUP(num, amt) ((num + (amt - 1)) &~ (amt-1))
void *BLI_memarena_alloc(MemArena *ma, int size)
{
void *ptr;
- /* ensure proper alignment by rounding
- * size up to multiple of 8 */
- size= PADUP(size, ma->align);
-
- if (size>ma->cursize) {
+ /* ensure proper alignment by rounding
+ * size up to multiple of 8 */
+ size = PADUP(size, ma->align);
+
+ if (size > ma->cursize) {
unsigned char *tmp;
-
- if(size > ma->bufsize - (ma->align - 1)) {
+
+ if (size > ma->bufsize - (ma->align - 1)) {
ma->cursize = PADUP(size+1, ma->align);
}
- else ma->cursize = ma->bufsize;
+ else
+ ma->cursize = ma->bufsize;
- if(ma->use_calloc)
- ma->curbuf= MEM_callocN(ma->cursize, ma->name);
+ if (ma->use_calloc)
+ ma->curbuf = MEM_callocN(ma->cursize, ma->name);
else
- ma->curbuf= MEM_mallocN(ma->cursize, ma->name);
-
+ ma->curbuf = MEM_mallocN(ma->cursize, ma->name);
+
BLI_linklist_prepend(&ma->bufs, ma->curbuf);
/* align alloc'ed memory (needed if align > 8) */
tmp = (unsigned char*)PADUP( (intptr_t) ma->curbuf, ma->align);
ma->cursize -= (tmp - ma->curbuf);
- ma->curbuf = tmp;
+ ma->curbuf = tmp;
}
-
- ptr= ma->curbuf;
- ma->curbuf+= size;
- ma->cursize-= size;
-
+
+ ptr = ma->curbuf;
+ ma->curbuf += size;
+ ma->cursize -= size;
+
return ptr;
}
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index d5df882ba29..3d16b3af4de 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -45,7 +45,7 @@
#include <string.h>
#include <stdlib.h>
-/* note: copied from BKE_utildefines.h, dont use here because we're in BLI */
+/* note: copied from BKE_utildefines.h, don't use here because we're in BLI */
#ifdef __BIG_ENDIAN__
/* Big Endian */
# define MAKE_ID(a,b,c,d) ( (int)(a)<<24 | (int)(b)<<16 | (c)<<8 | (d) )
@@ -74,7 +74,7 @@ struct BLI_mempool {
int flag;
/* keeps aligned to 16 bits */
- BLI_freenode *free; /* free element list. Interleaved into chunk datas. */
+ BLI_freenode *free; /* free element list. Interleaved into chunk datas. */
int totalloc, totused; /* total number of elements allocated in total,
* and currently in use */
};
@@ -83,9 +83,9 @@ struct BLI_mempool {
BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
{
- BLI_mempool *pool = NULL;
+ BLI_mempool *pool = NULL;
BLI_freenode *lasttail = NULL, *curnode = NULL;
- int i,j, maxchunks;
+ int i, j, maxchunks;
char *addr;
/* allocate the pool structure */
@@ -113,7 +113,7 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
pool->csize = esize * pchunk;
pool->chunks.first = pool->chunks.last = NULL;
pool->totused = 0;
-
+
maxchunks = totelem / pchunk + 1;
if (maxchunks == 0) {
maxchunks = 1;
@@ -124,17 +124,17 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
BLI_mempool_chunk *mpchunk;
if (flag & BLI_MEMPOOL_SYSMALLOC) {
- mpchunk = malloc(sizeof(BLI_mempool_chunk));
+ mpchunk = malloc(sizeof(BLI_mempool_chunk));
mpchunk->data = malloc(pool->csize);
}
else {
- mpchunk = MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk");
+ mpchunk = MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk");
mpchunk->data = MEM_mallocN(pool->csize, "BLI Mempool Chunk Data");
}
mpchunk->next = mpchunk->prev = NULL;
BLI_addtail(&(pool->chunks), mpchunk);
-
+
if (i == 0) {
pool->free = mpchunk->data; /* start of the list */
if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
@@ -237,7 +237,7 @@ void *BLI_mempool_calloc(BLI_mempool *pool)
return retval;
}
-/* doesnt protect against double frees, dont be stupid! */
+/* doesnt protect against double frees, don't be stupid! */
void BLI_mempool_free(BLI_mempool *pool, void *addr)
{
BLI_freenode *newhead = addr;
@@ -304,7 +304,9 @@ void *BLI_mempool_findelem(BLI_mempool *pool, int index)
BLI_mempool_iter iter;
void *elem;
BLI_mempool_iternew(pool, &iter);
- for (elem = BLI_mempool_iterstep(&iter); index-- != 0; elem = BLI_mempool_iterstep(&iter)) { };
+ for (elem = BLI_mempool_iterstep(&iter); index-- != 0; elem = BLI_mempool_iterstep(&iter)) {
+ /* do nothing */
+ };
return elem;
}
@@ -317,10 +319,10 @@ void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
fprintf(stderr, "%s: Error! you can't iterate over this mempool!\n", __func__);
iter->curchunk = NULL;
iter->curindex = 0;
-
+
return;
}
-
+
iter->pool = pool;
iter->curchunk = pool->chunks.first;
iter->curindex = 0;
@@ -332,29 +334,29 @@ void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
static void *bli_mempool_iternext(BLI_mempool_iter *iter)
{
void *ret = NULL;
-
+
if (!iter->curchunk || !iter->pool->totused) return NULL;
-
+
ret = ((char *)iter->curchunk->data) + iter->pool->esize * iter->curindex;
-
+
iter->curindex++;
-
+
if (iter->curindex >= iter->pool->pchunk) {
iter->curchunk = iter->curchunk->next;
iter->curindex = 0;
}
-
+
return ret;
}
void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
{
BLI_freenode *ret;
-
+
do {
ret = bli_mempool_iternext(iter);
} while (ret && ret->freeword == FREEWORD);
-
+
return ret;
}
@@ -383,7 +385,7 @@ void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
iter->curchunk = iter->curchunk->next;
}
} while (ret->freeword == FREEWORD);
-
+
return ret;
}
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index 84519a90477..81d596550de 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -30,10 +30,10 @@
*/
/* TODO,
- * currently there are some cases we dont support.
+ * currently there are some cases we don't support.
* - passing output paths to the visitor?, like render out.
* - passing sequence strips with many images.
- * - passing directory paths - visitors dont know which path is a dir or a file.
+ * - passing directory paths - visitors don't know which path is a dir or a file.
* */
#include <sys/stat.h>
@@ -41,13 +41,13 @@
#include <string.h>
#include <assert.h>
-/* path/file handeling stuff */
+/* path/file handling stuff */
#ifndef WIN32
- #include <dirent.h>
- #include <unistd.h>
+# include <dirent.h>
+# include <unistd.h>
#else
- #include <io.h>
- #include "BLI_winstuff.h"
+# include <io.h>
+# include "BLI_winstuff.h"
#endif
#include "MEM_guardedalloc.h"
@@ -83,7 +83,7 @@
static int checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src)
{
- ReportList *reports= (ReportList *)userdata;
+ ReportList *reports = (ReportList *)userdata;
if (!BLI_exists(path_src)) {
BKE_reportf(reports, RPT_WARNING, "Path Not Found \"%s\"", path_src);
@@ -98,8 +98,7 @@ void checkMissingFiles(Main *bmain, ReportList *reports)
bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BPATH_TRAVERSE_ABS, reports);
}
-typedef struct BPathRemap_Data
-{
+typedef struct BPathRemap_Data {
const char *basedir;
ReportList *reports;
@@ -110,17 +109,17 @@ typedef struct BPathRemap_Data
static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char *path_src)
{
- BPathRemap_Data *data= (BPathRemap_Data *)userdata;
+ BPathRemap_Data *data = (BPathRemap_Data *)userdata;
data->count_tot++;
- if(strncmp(path_src, "//", 2)==0) {
+ if (strncmp(path_src, "//", 2) == 0) {
return FALSE; /* already relative */
}
else {
strcpy(path_dst, path_src);
BLI_path_rel(path_dst, data->basedir);
- if (strncmp(path_dst, "//", 2)==0) {
+ if (strncmp(path_dst, "//", 2) == 0) {
data->count_changed++;
}
else {
@@ -133,15 +132,15 @@ static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char
void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports)
{
- BPathRemap_Data data= {NULL};
+ BPathRemap_Data data = {NULL};
- if(basedir[0] == '\0') {
+ if (basedir[0] == '\0') {
printf("%s: basedir='', this is a bug\n", __func__);
return;
}
- data.basedir= basedir;
- data.reports= reports;
+ data.basedir = basedir;
+ data.reports = reports;
bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data);
@@ -152,17 +151,17 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports)
static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char *path_src)
{
- BPathRemap_Data *data= (BPathRemap_Data *)userdata;
+ BPathRemap_Data *data = (BPathRemap_Data *)userdata;
data->count_tot++;
- if(strncmp(path_src, "//", 2)!=0) {
+ if (strncmp(path_src, "//", 2) != 0) {
return FALSE; /* already absolute */
}
else {
strcpy(path_dst, path_src);
BLI_path_abs(path_dst, data->basedir);
- if (strncmp(path_dst, "//", 2)!=0) {
+ if (strncmp(path_dst, "//", 2) != 0) {
data->count_changed++;
}
else {
@@ -176,15 +175,15 @@ static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char
/* similar to makeFilesRelative - keep in sync! */
void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
{
- BPathRemap_Data data= {NULL};
+ BPathRemap_Data data = {NULL};
- if(basedir[0] == '\0') {
+ if (basedir[0] == '\0') {
printf("%s: basedir='', this is a bug\n", __func__);
return;
}
- data.basedir= basedir;
- data.reports= reports;
+ data.basedir = basedir;
+ data.reports = reports;
bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data);
@@ -193,8 +192,7 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
data.count_tot, data.count_changed, data.count_failed);
}
-
-/* find this file recursively, use the biggest file so thumbnails dont get used by mistake
+/* find this file recursively, use the biggest file so thumbnails don't get used by mistake
* - dir: subdir to search
* - filename: set this filename
* - filesize: filesize for the file
@@ -218,30 +216,30 @@ static int findFileRecursive(char *filename_new,
filename_new[0] = '\0';
- dir= opendir(dirname);
+ dir = opendir(dirname);
- if (dir==NULL)
+ if (dir == NULL)
return found;
if (*filesize == -1)
- *filesize= 0; /* dir opened fine */
+ *filesize = 0; /* dir opened fine */
- while ((de= readdir(dir)) != NULL) {
+ while ((de = readdir(dir)) != NULL) {
- if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0)
+ if (strcmp(".", de->d_name) == 0 || strcmp("..", de->d_name) == 0)
continue;
BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
if (stat(path, &status) != 0)
- continue; /* cant stat, dont bother with this file, could print debug info here */
+ continue; /* cant stat, don't bother with this file, could print debug info here */
if (S_ISREG(status.st_mode)) { /* is file */
- if (strncmp(filename, de->d_name, FILE_MAX)==0) { /* name matches */
+ if (strncmp(filename, de->d_name, FILE_MAX) == 0) { /* name matches */
/* open the file to read its size */
- size= status.st_size;
+ size = status.st_size;
if ((size > 0) && (size > *filesize)) { /* find the biggest file */
- *filesize= size;
+ *filesize = size;
BLI_strncpy(filename_new, path, FILE_MAX);
found = TRUE;
}
@@ -259,8 +257,7 @@ static int findFileRecursive(char *filename_new,
return found;
}
-typedef struct BPathFind_Data
-{
+typedef struct BPathFind_Data {
const char *basedir;
char searchdir[FILE_MAX];
ReportList *reports;
@@ -268,11 +265,11 @@ typedef struct BPathFind_Data
static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char *path_src)
{
- BPathFind_Data *data= (BPathFind_Data *)userdata;
+ BPathFind_Data *data = (BPathFind_Data *)userdata;
char filename_new[FILE_MAX];
- int filesize= -1;
- int recur_depth= 0;
+ int filesize = -1;
+ int recur_depth = 0;
int found;
found = findFileRecursive(filename_new,
@@ -299,9 +296,9 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char
void findMissingFiles(Main *bmain, const char *searchpath, ReportList *reports)
{
- struct BPathFind_Data data= {NULL};
+ struct BPathFind_Data data = {NULL};
- data.reports= reports;
+ data.reports = reports;
BLI_split_dir_part(searchpath, data.searchdir, sizeof(data.searchdir));
bpath_traverse_main(bmain, findMissingFiles_visit_cb, 0, (void *)&data);
@@ -317,10 +314,10 @@ static int rewrite_path_fixed(char *path, BPathVisitor visit_cb, const char *abs
if (absbase) {
BLI_strncpy(path_src_buf, path, sizeof(path_src_buf));
BLI_path_abs(path_src_buf, absbase);
- path_src= path_src_buf;
+ path_src = path_src_buf;
}
else {
- path_src= path;
+ path_src = path;
}
if (visit_cb(userdata, path_dst, path_src)) {
@@ -365,15 +362,15 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab
if (absbase) {
BLI_strncpy(path_src_buf, *path, sizeof(path_src_buf));
BLI_path_abs(path_src_buf, absbase);
- path_src= path_src_buf;
+ path_src = path_src_buf;
}
else {
- path_src= *path;
+ path_src = *path;
}
if (visit_cb(userdata, path_dst, path_src)) {
MEM_freeN((*path));
- (*path)= BLI_strdup(path_dst);
+ (*path) = BLI_strdup(path_dst);
return TRUE;
}
else {
@@ -385,7 +382,7 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab
void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
{
Image *ima;
- const char *absbase= (flag & BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL;
+ const char *absbase = (flag & BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL;
if ((flag & BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) {
return;
@@ -413,8 +410,8 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
#define BPATH_TRAVERSE_POINTCACHE(ptcaches) \
{ \
PointCache *cache; \
- for(cache= (ptcaches).first; cache; cache= cache->next) { \
- if(cache->flag & PTCACHE_DISK_CACHE) { \
+ for (cache= (ptcaches).first; cache; cache= cache->next) { \
+ if (cache->flag & PTCACHE_DISK_CACHE) { \
rewrite_path_fixed(cache->path, \
visit_cb, \
absbase, \
@@ -429,7 +426,6 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
ModifierData *md;
ParticleSystem *psys;
-
/* do via modifiers instead */
#if 0
if (ob->fluidsimSettings) {
@@ -446,7 +442,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
}
else if (md->type == eModifierType_Smoke) {
SmokeModifierData *smd= (SmokeModifierData *)md;
- if(smd->type & MOD_SMOKE_TYPE_DOMAIN) {
+ if (smd->type & MOD_SMOKE_TYPE_DOMAIN) {
BPATH_TRAVERSE_POINTCACHE(smd->domain->ptcaches[0]);
}
}
@@ -533,7 +529,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
len= MIN2(1, len);
}
- for(i= 0; i < len; i++, se++) {
+ for (i= 0; i < len; i++, se++) {
rewrite_path_fixed_dirfile(seq->strip->dir, se->name,
visit_cb, absbase, bpath_user_data);
}
@@ -569,7 +565,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
case ID_LI:
{
Library *lib= (Library *)id;
- if(rewrite_path_fixed(lib->name, visit_cb, absbase, bpath_user_data)) {
+ if (rewrite_path_fixed(lib->name, visit_cb, absbase, bpath_user_data)) {
BKE_library_filepath_set(lib, lib->name);
}
}
@@ -589,7 +585,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
void bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
{
ID *id;
- for(id= lb->first; id; id= id->next) {
+ for (id = lb->first; id; id = id->next) {
bpath_traverse_id(bmain, id, visit_cb, flag, bpath_user_data);
}
}
@@ -597,8 +593,10 @@ void bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, co
void bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
{
ListBase *lbarray[MAX_LIBARRAY];
- int a= set_listbasepointers(bmain, lbarray);
- while(a--) bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
+ int a = set_listbasepointers(bmain, lbarray);
+ while (a--) {
+ bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
+ }
}
/* Rewrites a relative path to be relative to the main file - unless the path is
@@ -607,8 +605,8 @@ int bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_sr
{
/* be sure there is low chance of the path being too short */
char filepath[(FILE_MAXDIR * 2) + FILE_MAXFILE];
- const char *base_new= ((char **)pathbase_v)[0];
- const char *base_old= ((char **)pathbase_v)[1];
+ const char *base_new = ((char **)pathbase_v)[0];
+ const char *base_old = ((char **)pathbase_v)[1];
if (strncmp(base_old, "//", 2) == 0) {
printf("%s: error, old base path '%s' is not absolute.\n",
diff --git a/source/blender/blenlib/intern/callbacks.c b/source/blender/blenlib/intern/callbacks.c
index 7e063bc1a18..0cb986d9090 100644
--- a/source/blender/blenlib/intern/callbacks.c
+++ b/source/blender/blenlib/intern/callbacks.c
@@ -33,7 +33,7 @@ void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt)
ListBase *lb= &callback_slots[evt];
bCallbackFuncStore *funcstore;
- for(funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= (bCallbackFuncStore *)funcstore->next) {
+ for (funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= (bCallbackFuncStore *)funcstore->next) {
funcstore->func(main, self, funcstore->arg);
}
}
@@ -53,14 +53,14 @@ void BLI_cb_init(void)
void BLI_cb_finalize(void)
{
eCbEvent evt;
- for(evt= 0; evt < BLI_CB_EVT_TOT; evt++) {
+ for (evt= 0; evt < BLI_CB_EVT_TOT; evt++) {
ListBase *lb= &callback_slots[evt];
bCallbackFuncStore *funcstore;
bCallbackFuncStore *funcstore_next;
- for(funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= funcstore_next) {
+ for (funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= funcstore_next) {
funcstore_next= (bCallbackFuncStore *)funcstore->next;
BLI_remlink(lb, funcstore);
- if(funcstore->alloc) {
+ if (funcstore->alloc) {
MEM_freeN(funcstore);
}
}
diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c
index 0bfa5e79eb8..e300d09ffbc 100644
--- a/source/blender/blenlib/intern/dynlib.c
+++ b/source/blender/blenlib/intern/dynlib.c
@@ -44,13 +44,19 @@ struct DynamicLibrary {
#ifdef WIN32
#include <windows.h>
+#include "utf_winfunc.h"
+#include "utfconv.h"
DynamicLibrary *BLI_dynlib_open(char *name)
{
DynamicLibrary *lib;
- void *handle= LoadLibrary(name);
+ void *handle;
+
+ UTF16_ENCODE(name);
+ handle= LoadLibraryW(name_16);
+ UTF16_UN_ENCODE(name);
- if(!handle)
+ if (!handle)
return NULL;
lib= MEM_callocN(sizeof(*lib), "Dynamic Library");
@@ -70,13 +76,13 @@ char *BLI_dynlib_get_error_as_string(DynamicLibrary *lib)
/* if lib is NULL reset the last error code */
err= GetLastError();
- if(!lib)
+ if (!lib)
SetLastError(ERROR_SUCCESS);
- if(err) {
+ if (err) {
static char buf[1024];
- if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
+ if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buf, sizeof(buf), NULL))
return buf;
@@ -100,7 +106,7 @@ DynamicLibrary *BLI_dynlib_open(char *name)
DynamicLibrary *lib;
void *handle= dlopen(name, RTLD_LAZY);
- if(!handle)
+ if (!handle)
return NULL;
lib= MEM_callocN(sizeof(*lib), "Dynamic Library");
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index a868cf8ea96..edb2daf2d62 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -45,14 +45,20 @@
#include <io.h>
#include "BLI_winstuff.h"
#include "BLI_callbacks.h"
+#include "utf_winfunc.h"
+#include "utfconv.h"
#else
#include <unistd.h> // for read close
#include <sys/param.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/stat.h>
#endif
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_utildefines.h"
@@ -73,26 +79,25 @@ int BLI_file_gzip(const char *from, const char *to)
/* level 1 is very close to 3 (the default) in terms of file size,
* but about twice as fast, best use for speedy saving - campbell */
- gzfile = gzopen(to, "wb1");
- if(gzfile == NULL)
+ gzfile = BLI_gzopen(to, "wb1");
+ if (gzfile == NULL)
return -1;
-
- file = open(from, O_BINARY|O_RDONLY);
- if(file < 0)
+ file = BLI_open(from, O_BINARY|O_RDONLY,0);
+ if (file < 0)
return -2;
- while(1) {
+ while (1) {
readsize = read(file, buffer, sizeof(buffer));
- if(readsize < 0) {
+ if (readsize < 0) {
rval= -2; /* error happened in reading */
fprintf(stderr, "Error reading file %s: %s.\n", from, strerror(errno));
break;
}
- else if(readsize == 0)
+ else if (readsize == 0)
break; /* done reading */
- if(gzwrite(gzfile, buffer, readsize) <= 0) {
+ if (gzwrite(gzfile, buffer, readsize) <= 0) {
rval= -1; /* error happened in writing */
fprintf(stderr, "Error writing gz file %s: %s.\n", to, gzerror(gzfile, &err));
break;
@@ -117,29 +122,29 @@ char *BLI_file_ungzip_to_mem(const char *from_file, int *size_r)
size= 0;
- gzfile = gzopen( from_file, "rb" );
-
- for(;;) {
- if(mem==NULL) {
+ gzfile = BLI_gzopen( from_file, "rb" );
+ for (;;) {
+ if (mem==NULL) {
mem= MEM_callocN(chunk_size, "BLI_ungzip_to_mem");
alloc_size= chunk_size;
- } else {
+ }
+ else {
mem= MEM_reallocN(mem, size+chunk_size);
alloc_size+= chunk_size;
}
readsize= gzread(gzfile, mem+size, chunk_size);
- if(readsize>0) {
+ if (readsize>0) {
size+= readsize;
}
else break;
}
- if(size==0) {
+ if (size==0) {
MEM_freeN(mem);
mem= NULL;
}
- else if(alloc_size!=size)
+ else if (alloc_size!=size)
mem= MEM_reallocN(mem, size);
*size_r= size;
@@ -154,14 +159,14 @@ int BLI_file_is_writable(const char *filename)
int file;
/* first try to open without creating */
- file = open(filename, O_BINARY | O_RDWR, 0666);
+ file = BLI_open(filename, O_BINARY | O_RDWR, 0666);
if (file < 0) {
/* now try to open and create. a test without actually
* creating a file would be nice, but how? */
- file = open(filename, O_BINARY | O_RDWR | O_CREAT, 0666);
+ file = BLI_open(filename, O_BINARY | O_RDWR | O_CREAT, 0666);
- if(file < 0) {
+ if (file < 0) {
return 0;
}
else {
@@ -179,13 +184,14 @@ int BLI_file_is_writable(const char *filename)
int BLI_file_touch(const char *file)
{
- FILE *f = fopen(file,"r+b");
+ FILE *f = BLI_fopen(file,"r+b");
if (f != NULL) {
char c = getc(f);
rewind(f);
putc(c,f);
- } else {
- f = fopen(file,"wb");
+ }
+ else {
+ f = BLI_fopen(file,"wb");
}
if (f) {
fclose(f);
@@ -198,21 +204,65 @@ int BLI_file_touch(const char *file)
static char str[MAXPATHLEN+12];
+FILE *BLI_fopen(const char *filename, const char *mode)
+{
+ return ufopen(filename, mode);
+}
+
+gzFile BLI_gzopen(const char *filename, const char *mode)
+{
+ gzFile gzfile;
+ int fi;
+
+ if (!filename || !mode) {return 0;}
+ else
+
+ {
+
+ wchar_t short_name_16 [256];
+ char short_name [256];
+ int i=0;
+ UTF16_ENCODE(filename);
+
+ GetShortPathNameW(filename_16,short_name_16,256);
+
+ for (i=0;i<256;i++) {short_name[i]=short_name_16[i];};
+
+
+ gzfile = gzopen(short_name,mode);
+
+ UTF16_UN_ENCODE(filename);
+
+ }
+ return gzfile;
+}
+
+int BLI_open(const char *filename, int oflag, int pmode)
+{
+ return uopen(filename, oflag, pmode);
+}
+
int BLI_delete(const char *file, int dir, int recursive)
{
int err;
+
+ UTF16_ENCODE(file)
if (recursive) {
callLocalErrorCallBack("Recursive delete is unsupported on Windows");
err= 1;
- } else if (dir) {
- err= !RemoveDirectory(file);
+ }
+ else if (dir) {
+ err= !RemoveDirectoryW(file_16);
if (err) printf ("Unable to remove directory");
- } else {
- err= !DeleteFile(file);
+ }
+ else {
+ err= !DeleteFileW(file_16);
if (err) callLocalErrorCallBack("Unable to delete file");
}
+ UTF16_UN_ENCODE(file)
+
return err;
}
@@ -231,8 +281,13 @@ int BLI_move(const char *file, const char *to)
strcat(str, BLI_last_slash(file) + 1);
}
}
+
+ UTF16_ENCODE(file)
+ UTF16_ENCODE(str)
+ err= !MoveFileW(file_16, str_16);
+ UTF16_UN_ENCODE(str)
+ UTF16_UN_ENCODE(file)
- err= !MoveFile(file, str);
if (err) {
callLocalErrorCallBack("Unable to move file");
printf(" Move from '%s' to '%s' failed\n", file, str);
@@ -258,8 +313,12 @@ int BLI_copy(const char *file, const char *to)
}
}
- err= !CopyFile(file,str,FALSE);
-
+ UTF16_ENCODE(file)
+ UTF16_ENCODE(str)
+ err= !CopyFileW(file_16,str_16,FALSE);
+ UTF16_UN_ENCODE(str)
+ UTF16_UN_ENCODE(file)
+
if (err) {
callLocalErrorCallBack("Unable to copy file!");
printf(" Copy from '%s' to '%s' failed\n", file, str);
@@ -288,7 +347,7 @@ void BLI_dir_create_recursive(const char *dirname)
BLI_strncpy(tmp, dirname, sizeof(tmp));
lslash= BLI_last_slash(tmp);
-
+
if (lslash == tmp + strlen(tmp) - 1) {
*lslash = 0;
}
@@ -302,9 +361,9 @@ void BLI_dir_create_recursive(const char *dirname)
BLI_dir_create_recursive(tmp);
}
- if(dirname[0]) /* patch, this recursive loop tries to create a nameless directory */
- if (!CreateDirectory(dirname, NULL))
- callLocalErrorCallBack("Unable to create directory\n");
+ if (dirname[0]) /* patch, this recursive loop tries to create a nameless directory */
+ if (umkdir(dirname)==-1)
+ printf("Unable to create directory %s\n",dirname);
}
int BLI_rename(const char *from, const char *to)
@@ -313,33 +372,214 @@ int BLI_rename(const char *from, const char *to)
/* make sure the filenames are different (case insensitive) before removing */
if (BLI_exists(to) && BLI_strcasecmp(from, to))
- if(BLI_delete(to, 0, 0)) return 1;
-
- return rename(from, to);
+ if (BLI_delete(to, 0, 0)) return 1;
+
+ return urename(from, to);
}
#else /* The UNIX world */
-/*
- * but the UNIX world is tied to the interface, and the system
- * timer, and... We implement a callback mechanism. The system will
- * have to initialize the callback before the functions will work!
- * */
-static char str[12 + (MAXPATHLEN * 2)];
+enum {
+ /* operation succeeded succeeded */
+ recursiveOp_Callback_OK = 0,
+
+ /* operation requested not to perform recursive digging for current path */
+ recursiveOp_Callback_StopRecurs = 1,
+
+ /* error occured in callback and recursive walking should stop immediately */
+ recursiveOp_Callback_Error = 2
+} recuresiveOp_Callback_Result;
+
+typedef int (*recursiveOp_Callback) (const char *from, const char *to);
+
+/* appending of filename to dir (ensures for buffer size before appending) */
+static void join_dirfile_alloc(char **dst, size_t *alloc_len, const char *dir, const char *file)
+{
+ size_t len = strlen(dir) + strlen(file) + 1;
+
+ if (!*dst)
+ *dst = MEM_callocN(len + 1, "join_dirfile_alloc path");
+ else if (*alloc_len < len)
+ *dst = MEM_reallocN(*dst, len + 1);
+
+ *alloc_len = len;
+
+ BLI_join_dirfile(*dst, len + 1, dir, file);
+}
+
+static char *strip_last_slash(const char *dir)
+{
+ char *result = BLI_strdup(dir);
+ BLI_del_slash(result);
+
+ return result;
+}
+
+static int recursive_operation(const char *startfrom, const char *startto, recursiveOp_Callback callback_dir_pre,
+ recursiveOp_Callback callback_file, recursiveOp_Callback callback_dir_post)
+{
+ struct dirent **dirlist;
+ struct stat st;
+ char *from = NULL, *to = NULL;
+ char *from_path = NULL, *to_path = NULL;
+ size_t from_alloc_len = -1, to_alloc_len = -1;
+ int i, n, ret = 0;
+
+ /* ensure there's no trailing slash in file path */
+ from = strip_last_slash(startfrom);
+ if (startto)
+ to = strip_last_slash(startto);
+
+ ret = lstat(from, &st);
+ if (ret < 0) {
+ /* source wasn't found, nothing to operate with */
+ return ret;
+ }
+
+ if (!S_ISDIR(st.st_mode)) {
+ /* source isn't a directory, can't do recursive walking for it,
+ * so just call file callback and leave */
+ if (callback_file) {
+ ret = callback_file(from, to);
+
+ if (ret != recursiveOp_Callback_OK)
+ ret = -1;
+ }
+
+ MEM_freeN(from);
+ if (to) MEM_freeN(to);
+
+ return ret;
+ }
+
+
+ n = scandir(startfrom, &dirlist, 0, alphasort);
+ if (n < 0) {
+ /* error opening directory for listing */
+ perror("scandir");
+
+ MEM_freeN(from);
+ if (to) MEM_freeN(to);
+
+ return -1;
+ }
+
+ if (callback_dir_pre) {
+ /* call pre-recursive walking directory callback */
+ ret = callback_dir_pre(from, to);
+
+ if (ret != recursiveOp_Callback_OK) {
+ MEM_freeN(from);
+ if (to) free(to);
+
+ if (ret == recursiveOp_Callback_StopRecurs) {
+ /* callback requested not to perform recursive walking, not an error */
+ return 0;
+ }
+
+ return -1;
+ }
+ }
+
+ for (i = 0; i < n; i++) {
+ struct dirent *dirent = dirlist[i];
+
+ if (!strcmp(dirent->d_name, ".") || !strcmp(dirent->d_name, "..")) {
+ free(dirent);
+ continue;
+ }
+
+ join_dirfile_alloc(&from_path, &from_alloc_len, from, dirent->d_name);
+
+ if (to)
+ join_dirfile_alloc(&to_path, &to_alloc_len, to, dirent->d_name);
+
+ if (dirent->d_type == DT_DIR) {
+ /* recursively dig into a folder */
+ ret = recursive_operation(from_path, to_path, callback_dir_pre, callback_file, callback_dir_post);
+ }
+ else if (callback_file) {
+ /* call file callback for current path */
+ ret = callback_file(from_path, to_path);
+ if (ret != recursiveOp_Callback_OK)
+ ret = -1;
+ }
+
+ if (ret != 0) {
+ while (i < n)
+ free(dirlist[i]);
+ break;
+ }
+ }
+
+ free(dirlist);
+
+ if (ret == 0) {
+ if (callback_dir_post) {
+ /* call post-recursive directory callback */
+ ret = callback_dir_post(from, to);
+ if (ret != recursiveOp_Callback_OK)
+ ret = -1;
+ }
+ }
+
+ if (from_path) MEM_freeN(from_path);
+ if (to_path) MEM_freeN(to_path);
+
+ MEM_freeN(from);
+ if (to) MEM_freeN(to);
+
+ return ret;
+}
+
+static int delete_callback_post(const char *from, const char *UNUSED(to))
+{
+ if (rmdir(from)) {
+ perror("rmdir");
+
+ return recursiveOp_Callback_Error;
+ }
+
+ return recursiveOp_Callback_OK;
+}
+
+static int delete_single_file(const char *from, const char *UNUSED(to))
+{
+ if (unlink(from)) {
+ perror("unlink");
+
+ return recursiveOp_Callback_Error;
+ }
+
+ return recursiveOp_Callback_OK;
+}
+
+FILE *BLI_fopen(const char *filename, const char *mode)
+{
+ return fopen(filename, mode);
+}
+
+void *BLI_gzopen(const char *filename, const char *mode)
+{
+ return gzopen(filename, mode);
+}
+
+int BLI_open(const char *filename, int oflag, int pmode)
+{
+ return open(filename, oflag, pmode);
+}
int BLI_delete(const char *file, int dir, int recursive)
{
- if(strchr(file, '"')) {
+ if (strchr(file, '"')) {
printf("Error: not deleted file %s because of quote!\n", file);
}
else {
if (recursive) {
- BLI_snprintf(str, sizeof(str), "/bin/rm -rf \"%s\"", file);
- return system(str);
+ return recursive_operation(file, NULL, NULL, delete_single_file, delete_callback_post);
}
else if (dir) {
- BLI_snprintf(str, sizeof(str), "/bin/rmdir \"%s\"", file);
- return system(str);
+ return rmdir(file);
}
else {
return remove(file); //BLI_snprintf(str, sizeof(str), "/bin/rm -f \"%s\"", file);
@@ -348,35 +588,272 @@ int BLI_delete(const char *file, int dir, int recursive)
return -1;
}
+static int check_the_same(const char *path_a, const char *path_b)
+{
+ struct stat st_a, st_b;
+
+ if (lstat(path_a, &st_a))
+ return 0;
+
+ if (lstat(path_b, &st_b))
+ return 0;
+
+ return st_a.st_dev == st_b.st_dev && st_a.st_ino == st_b.st_ino;
+}
+
+static int set_permissions(const char *file, struct stat *st)
+{
+ if (chown(file, st->st_uid, st->st_gid)) {
+ perror("chown");
+ return -1;
+ }
+
+ if (chmod(file, st->st_mode)) {
+ perror("chmod");
+ return -1;
+ }
+
+ return 0;
+}
+
+/* pre-recursive callback for copying operation
+ * creates a destination directory where all source content fill be copied to */
+static int copy_callback_pre(const char *from, const char *to)
+{
+ struct stat st;
+
+ if (check_the_same(from, to)) {
+ fprintf(stderr, "%s: '%s' is the same as '%s'\n", __func__, from, to);
+ return recursiveOp_Callback_Error;
+ }
+
+ if (lstat(from, &st)) {
+ perror("stat");
+ return recursiveOp_Callback_Error;
+ }
+
+ /* create a directory */
+ if (mkdir(to, st.st_mode)) {
+ perror("mkdir");
+ return recursiveOp_Callback_Error;
+ }
+
+ /* set proper owner and group on new directory */
+ if (chown(to, st.st_uid, st.st_gid)) {
+ perror("chown");
+ return recursiveOp_Callback_Error;
+ }
+
+ return recursiveOp_Callback_OK;
+}
+
+static int copy_single_file(const char *from, const char *to)
+{
+ FILE *from_stream, *to_stream;
+ struct stat st;
+ char buf[4096];
+ size_t len;
+
+ if (check_the_same(from, to)) {
+ fprintf(stderr, "%s: '%s' is the same as '%s'\n", __func__, from, to);
+ return recursiveOp_Callback_Error;
+ }
+
+ if (lstat(from, &st)) {
+ perror("lstat");
+ return recursiveOp_Callback_Error;
+ }
+
+ if (S_ISLNK(st.st_mode)) {
+ /* symbolic links should be copied in special way */
+ char *link_buffer;
+ int need_free;
+ ssize_t link_len;
+
+ /* get large enough buffer to read link content */
+ if (st.st_size < sizeof(buf)) {
+ link_buffer = buf;
+ need_free = 0;
+ }
+ else {
+ link_buffer = MEM_callocN(st.st_size+2, "copy_single_file link_buffer");
+ need_free = 1;
+ }
+
+ link_len = readlink(from, link_buffer, st.st_size+1);
+ if (link_len < 0) {
+ perror("readlink");
+
+ if (need_free) MEM_freeN(link_buffer);
+
+ return recursiveOp_Callback_Error;
+ }
+
+ link_buffer[link_len] = 0;
+
+ if (symlink(link_buffer, to)) {
+ perror("symlink");
+ if (need_free) MEM_freeN(link_buffer);
+ return recursiveOp_Callback_Error;
+ }
+
+ if (need_free)
+ MEM_freeN(link_buffer);
+
+ return recursiveOp_Callback_OK;
+ }
+ else if (S_ISCHR (st.st_mode) ||
+ S_ISBLK (st.st_mode) ||
+ S_ISFIFO (st.st_mode) ||
+ S_ISSOCK (st.st_mode))
+ {
+ /* copy special type of file */
+ if (mknod(to, st.st_mode, st.st_rdev)) {
+ perror("mknod");
+ return recursiveOp_Callback_Error;
+ }
+
+ if (set_permissions(to, &st))
+ return recursiveOp_Callback_Error;
+
+ return recursiveOp_Callback_OK;
+ }
+ else if (!S_ISREG(st.st_mode)) {
+ fprintf(stderr, "Copying of this kind of files isn't supported yet\n");
+ return recursiveOp_Callback_Error;
+ }
+
+ from_stream = fopen(from, "rb");
+ if (!from_stream) {
+ perror("fopen");
+ return recursiveOp_Callback_Error;
+ }
+
+ to_stream = fopen(to, "wb");
+ if (!to_stream) {
+ perror("fopen");
+ fclose(from_stream);
+ return recursiveOp_Callback_Error;
+ }
+
+ while ((len = fread(buf, 1, sizeof(buf), from_stream)) > 0) {
+ fwrite(buf, 1, len, to_stream);
+ }
+
+ fclose(to_stream);
+ fclose(from_stream);
+
+ if (set_permissions(to, &st))
+ return recursiveOp_Callback_Error;
+
+ return recursiveOp_Callback_OK;
+}
+
+static int move_callback_pre(const char *from, const char *to)
+{
+ int ret = rename(from, to);
+
+ if (ret)
+ return copy_callback_pre(from, to);
+
+ return recursiveOp_Callback_StopRecurs;
+}
+
+static int move_single_file(const char *from, const char *to)
+{
+ int ret = rename(from, to);
+
+ if (ret)
+ return copy_single_file(from, to);
+
+ return recursiveOp_Callback_OK;
+}
+
int BLI_move(const char *file, const char *to)
{
- BLI_snprintf(str, sizeof(str), "/bin/mv -f \"%s\" \"%s\"", file, to);
+ int ret = recursive_operation(file, to, move_callback_pre, move_single_file, NULL);
- return system(str);
+ if (ret) {
+ return recursive_operation(file, NULL, NULL, delete_single_file, delete_callback_post);
+ }
+
+ return ret;
+}
+
+static char *check_destination(const char *file, const char *to)
+{
+ struct stat st;
+
+ if (!stat(to, &st)) {
+ if (S_ISDIR(st.st_mode)) {
+ char *str, *filename, *path;
+ size_t len = 0;
+
+ str = strip_last_slash(file);
+ filename = BLI_last_slash(str);
+
+ if (!filename) {
+ MEM_freeN(str);
+ return (char*)to;
+ }
+
+ /* skip slash */
+ filename += 1;
+
+ len = strlen(to) + strlen(filename) + 1;
+ path = MEM_callocN(len + 1, "check_destination path");
+ BLI_join_dirfile(path, len + 1, to, filename);
+
+ MEM_freeN(str);
+
+ return path;
+ }
+ }
+
+ return (char*)to;
}
int BLI_copy(const char *file, const char *to)
{
- BLI_snprintf(str, sizeof(str), "/bin/cp -rf \"%s\" \"%s\"", file, to);
+ char *actual_to = check_destination(file, to);
+ int ret;
+
+ ret = recursive_operation(file, actual_to, copy_callback_pre, copy_single_file, NULL);
- return system(str);
+ if (actual_to!=to)
+ MEM_freeN(actual_to);
+
+ return ret;
}
int BLI_create_symlink(const char *file, const char *to)
{
- BLI_snprintf(str, sizeof(str), "/bin/ln -f \"%s\" \"%s\"", file, to);
-
- return system(str);
+ return symlink(to, file);
}
void BLI_dir_create_recursive(const char *dirname)
{
char *lslash;
- char tmp[MAXPATHLEN];
-
+ size_t size;
+#ifdef MAXPATHLEN
+ char static_buf[MAXPATHLEN];
+#endif
+ char *tmp;
+ int needs_free;
+
if (BLI_exists(dirname)) return;
- BLI_strncpy(tmp, dirname, sizeof(tmp));
+#ifdef MAXPATHLEN
+ size = MAXPATHLEN;
+ tmp = static_buf;
+ needs_free = 0;
+#else
+ size = strlen(dirname)+1;
+ tmp = MEM_callocN(size, "BLI_dir_create_recursive tmp");
+ needs_free = 1;
+#endif
+
+ BLI_strncpy(tmp, dirname, size);
lslash= BLI_last_slash(tmp);
if (lslash) {
@@ -385,6 +862,9 @@ void BLI_dir_create_recursive(const char *dirname)
BLI_dir_create_recursive(tmp);
}
+ if (needs_free)
+ MEM_freeN(tmp);
+
mkdir(dirname, 0777);
}
@@ -392,7 +872,8 @@ int BLI_rename(const char *from, const char *to)
{
if (!BLI_exists(from)) return 0;
- if (BLI_exists(to)) if(BLI_delete(to, 0, 0)) return 1;
+ if (BLI_exists(to))
+ if (BLI_delete(to, 0, 0)) return 1;
return rename(from, to);
}
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index f55ebf915e2..a9a1f2bc57e 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -86,7 +86,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
// adjust font size
height= ((double) face->bbox.yMax - (double) face->bbox.yMin);
- if(height != 0.0f)
+ if (height != 0.0f)
scale = 1.0f / height;
else
scale = 1.0f / 1000.0f;
@@ -99,7 +99,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
err= FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP);
// If loading succeeded, convert the FT glyph to the internal format
- if(!err) {
+ if (!err) {
int *npoints;
int *onpoints;
@@ -120,29 +120,29 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
onpoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int),"onpoints");
// calculate total points of each contour
- for(j = 0; j < ftoutline.n_contours; j++) {
- if(j == 0)
+ for (j = 0; j < ftoutline.n_contours; j++) {
+ if (j == 0)
npoints[j] = ftoutline.contours[j] + 1;
else
npoints[j] = ftoutline.contours[j] - ftoutline.contours[j - 1];
}
// get number of on-curve points for beziertriples (including conic virtual on-points)
- for(j = 0; j < ftoutline.n_contours; j++) {
- for(k = 0; k < npoints[j]; k++) {
- if(j > 0) l = k + ftoutline.contours[j - 1] + 1; else l = k;
- if(ftoutline.tags[l] == FT_Curve_Tag_On)
+ for (j = 0; j < ftoutline.n_contours; j++) {
+ for (k = 0; k < npoints[j]; k++) {
+ if (j > 0) l = k + ftoutline.contours[j - 1] + 1; else l = k;
+ if (ftoutline.tags[l] == FT_Curve_Tag_On)
onpoints[j]++;
- if(k < npoints[j] - 1 )
- if( ftoutline.tags[l] == FT_Curve_Tag_Conic &&
+ if (k < npoints[j] - 1 )
+ if ( ftoutline.tags[l] == FT_Curve_Tag_Conic &&
ftoutline.tags[l+1] == FT_Curve_Tag_Conic)
onpoints[j]++;
}
}
//contour loop, bezier & conic styles merged
- for(j = 0; j < ftoutline.n_contours; j++) {
+ for (j = 0; j < ftoutline.n_contours; j++) {
// add new curve
nu = (Nurb *)MEM_callocN(sizeof(struct Nurb), "objfnt_nurb");
bezt = (BezTriple *)MEM_callocN((onpoints[j]) * sizeof(BezTriple), "objfnt_bezt");
@@ -156,9 +156,9 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
nu->bezt = bezt;
//individual curve loop, start-end
- for(k = 0; k < npoints[j]; k++) {
- if(j > 0) l = k + ftoutline.contours[j - 1] + 1; else l = k;
- if(k == 0) m = l;
+ for (k = 0; k < npoints[j]; k++) {
+ if (j > 0) l = k + ftoutline.contours[j - 1] + 1; else l = k;
+ if (k == 0) m = l;
//virtual conic on-curve points
if (k < npoints[j] - 1) {
@@ -185,32 +185,37 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
}
//on-curve points
- if(ftoutline.tags[l] == FT_Curve_Tag_On) {
+ if (ftoutline.tags[l] == FT_Curve_Tag_On) {
//left handle
- if(k > 0) {
- if(ftoutline.tags[l - 1] == FT_Curve_Tag_Cubic) {
+ if (k > 0) {
+ if (ftoutline.tags[l - 1] == FT_Curve_Tag_Cubic) {
bezt->vec[0][0] = ftoutline.points[l-1].x* scale;
bezt->vec[0][1] = ftoutline.points[l-1].y* scale;
bezt->h1= HD_FREE;
- } else if(ftoutline.tags[l - 1] == FT_Curve_Tag_Conic) {
+ }
+ else if (ftoutline.tags[l - 1] == FT_Curve_Tag_Conic) {
bezt->vec[0][0] = (ftoutline.points[l].x + (2 * ftoutline.points[l - 1].x))* scale / 3.0f;
bezt->vec[0][1] = (ftoutline.points[l].y + (2 * ftoutline.points[l - 1].y))* scale / 3.0f;
bezt->h1= HD_FREE;
- } else {
+ }
+ else {
bezt->vec[0][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[l-1].x)* scale / 3.0f;
bezt->vec[0][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[l-1].y)* scale / 3.0f;
bezt->h1= HD_VECT;
}
- } else { //first point on curve
- if(ftoutline.tags[ftoutline.contours[j]] == FT_Curve_Tag_Cubic) {
+ }
+ else { //first point on curve
+ if (ftoutline.tags[ftoutline.contours[j]] == FT_Curve_Tag_Cubic) {
bezt->vec[0][0] = ftoutline.points[ftoutline.contours[j]].x * scale;
bezt->vec[0][1] = ftoutline.points[ftoutline.contours[j]].y * scale;
bezt->h1= HD_FREE;
- } else if(ftoutline.tags[ftoutline.contours[j]] == FT_Curve_Tag_Conic) {
+ }
+ else if (ftoutline.tags[ftoutline.contours[j]] == FT_Curve_Tag_Conic) {
bezt->vec[0][0] = (ftoutline.points[l].x + (2 * ftoutline.points[ftoutline.contours[j]].x))* scale / 3.0f;
bezt->vec[0][1] = (ftoutline.points[l].y + (2 * ftoutline.points[ftoutline.contours[j]].y))* scale / 3.0f;
bezt->h1= HD_FREE;
- } else {
+ }
+ else {
bezt->vec[0][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[ftoutline.contours[j]].x)* scale / 3.0f;
bezt->vec[0][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[ftoutline.contours[j]].y)* scale / 3.0f;
bezt->h1= HD_VECT;
@@ -222,30 +227,35 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
bezt->vec[1][1] = ftoutline.points[l].y* scale;
//right handle
- if(k < (npoints[j] - 1)) {
- if(ftoutline.tags[l+1] == FT_Curve_Tag_Cubic) {
+ if (k < (npoints[j] - 1)) {
+ if (ftoutline.tags[l+1] == FT_Curve_Tag_Cubic) {
bezt->vec[2][0] = ftoutline.points[l+1].x* scale;
bezt->vec[2][1] = ftoutline.points[l+1].y* scale;
bezt->h2= HD_FREE;
- } else if(ftoutline.tags[l+1] == FT_Curve_Tag_Conic) {
+ }
+ else if (ftoutline.tags[l+1] == FT_Curve_Tag_Conic) {
bezt->vec[2][0] = (ftoutline.points[l].x + (2 * ftoutline.points[l+1].x))* scale / 3.0f;
bezt->vec[2][1] = (ftoutline.points[l].y + (2 * ftoutline.points[l+1].y))* scale / 3.0f;
bezt->h2= HD_FREE;
- } else {
+ }
+ else {
bezt->vec[2][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[l+1].x)* scale / 3.0f;
bezt->vec[2][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[l+1].y)* scale / 3.0f;
bezt->h2= HD_VECT;
}
- } else { //last point on curve
- if(ftoutline.tags[m] == FT_Curve_Tag_Cubic) {
+ }
+ else { //last point on curve
+ if (ftoutline.tags[m] == FT_Curve_Tag_Cubic) {
bezt->vec[2][0] = ftoutline.points[m].x* scale;
bezt->vec[2][1] = ftoutline.points[m].y* scale;
bezt->h2= HD_FREE;
- } else if(ftoutline.tags[m] == FT_Curve_Tag_Conic) {
+ }
+ else if (ftoutline.tags[m] == FT_Curve_Tag_Conic) {
bezt->vec[2][0] = (ftoutline.points[l].x + (2 * ftoutline.points[m].x))* scale / 3.0f;
bezt->vec[2][1] = (ftoutline.points[l].y + (2 * ftoutline.points[m].y))* scale / 3.0f;
bezt->h2= HD_FREE;
- } else {
+ }
+ else {
bezt->vec[2][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[m].x)* scale / 3.0f;
bezt->vec[2][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[m].y)* scale / 3.0f;
bezt->h2= HD_VECT;
@@ -257,7 +267,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
// len_squared_v2v2, see if there's a distance between the three points
// len_squared_v2v2 again, to check the angle between the handles
// finally, check if one of them is a vector handle
- if((dist_to_line_v2(bezt->vec[0],bezt->vec[1],bezt->vec[2]) < 0.001f) &&
+ if ((dist_to_line_v2(bezt->vec[0],bezt->vec[1],bezt->vec[2]) < 0.001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[1]) > 0.0001f*0.0001f) &&
(len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001f*0.0001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002f*0.0001f) &&
@@ -271,8 +281,8 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
}
}
}
- if(npoints) MEM_freeN(npoints);
- if(onpoints) MEM_freeN(onpoints);
+ if (npoints) MEM_freeN(npoints);
+ if (onpoints) MEM_freeN(onpoints);
}
}
@@ -286,7 +296,7 @@ static int objchr_to_ftvfontdata(VFont *vfont, FT_ULong charcode)
tf= vfont_find_tmpfont(vfont);
// What, no font found. Something strange here
- if(!tf) return FALSE;
+ if (!tf) return FALSE;
// Load the font to memory
if (tf->pf) {
@@ -334,7 +344,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
0,
&face );
- if(err) return NULL;
+ if (err) return NULL;
#if 0
for ( n = 0; n < face->num_charmaps; n++ )
@@ -381,14 +391,14 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
err = FT_Set_Charmap( face, found );
- if( err )
+ if ( err )
return NULL;
lcode= charcode= FT_Get_First_Char(face, &glyph_index);
}
// Load characters
- while(charcode < 256)
+ while (charcode < 256)
{
// Generate the font data
freetypechar_to_vchar(face, charcode, vfd);
@@ -397,7 +407,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
charcode = FT_Get_Next_Char(face, charcode, &glyph_index);
// Check that we won't start infinite loop
- if(charcode <= lcode)
+ if (charcode <= lcode)
break;
lcode = charcode;
}
@@ -425,7 +435,7 @@ static int check_freetypefont(PackedFile * pf)
pf->size,
0,
&face );
- if(err) {
+ if (err) {
success = 0;
//XXX error("This is not a valid font");
}
@@ -449,12 +459,13 @@ static int check_freetypefont(PackedFile * pf)
glyph_index = FT_Get_Char_Index( face, 'A' );
err = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP);
- if(err) success = 0;
+ if (err) success = 0;
else {
glyph = face->glyph;
if (glyph->format == ft_glyph_format_outline ) {
success = 1;
- } else {
+ }
+ else {
//XXX error("Selected Font has no outline data");
success = 0;
}
@@ -472,7 +483,7 @@ VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf)
//init Freetype
err = FT_Init_FreeType( &library);
- if(err) {
+ if (err) {
//XXX error("Failed to load the Freetype font library");
return NULL;
}
@@ -493,18 +504,18 @@ int BLI_vfontchar_from_freetypefont(VFont *vfont, unsigned long character)
{
int success = FALSE;
- if(!vfont) return FALSE;
+ if (!vfont) return FALSE;
// Init Freetype
err = FT_Init_FreeType(&library);
- if(err) {
+ if (err) {
//XXX error("Failed to load the Freetype font library");
return 0;
}
// Load the character
success = objchr_to_ftvfontdata(vfont, character);
- if(success == FALSE) return FALSE;
+ if (success == FALSE) return FALSE;
// Free Freetype
FT_Done_FreeType(library);
@@ -527,8 +538,7 @@ typedef struct FT_Outline_
short* contours; /* the contour end points */
int flags; /* outline masks */
-
- } FT_Outline;
+} FT_Outline;
#endif
diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c
index 967c4411903..75131f81ade 100644
--- a/source/blender/blenlib/intern/graph.c
+++ b/source/blender/blenlib/intern/graph.c
@@ -82,7 +82,7 @@ void BLI_flagNodes(BGraph *graph, int flag)
{
BNode *node;
- for(node = graph->nodes.first; node; node = node->next)
+ for (node = graph->nodes.first; node; node = node->next)
{
node->flag = flag;
}
@@ -92,7 +92,7 @@ void BLI_flagArcs(BGraph *graph, int flag)
{
BArc *arc;
- for(arc = graph->arcs.first; arc; arc = arc->next)
+ for (arc = graph->arcs.first; arc; arc = arc->next)
{
arc->flag = flag;
}
@@ -109,7 +109,7 @@ void BLI_buildAdjacencyList(BGraph *graph)
BNode *node;
BArc *arc;
- for(node = graph->nodes.first; node; node = node->next)
+ for (node = graph->nodes.first; node; node = node->next)
{
if (node->arcs != NULL)
{
@@ -122,13 +122,13 @@ void BLI_buildAdjacencyList(BGraph *graph)
node->flag = 0;
}
- for(arc = graph->arcs.first; arc; arc= arc->next)
+ for (arc = graph->arcs.first; arc; arc= arc->next)
{
addArcToNodeAdjacencyList(arc->head, arc);
addArcToNodeAdjacencyList(arc->tail, arc);
}
- for(node = graph->nodes.first; node; node = node->next)
+ for (node = graph->nodes.first; node; node = node->next)
{
if (node->degree != node->flag)
{
@@ -151,7 +151,7 @@ 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)
+ for (arc = graph->arcs.first; arc; arc= arc->next)
{
if (arc->head == node)
{
@@ -173,7 +173,7 @@ void BLI_freeAdjacencyList(BGraph *graph)
{
BNode *node;
- for(node = graph->nodes.first; node; node = node->next)
+ for (node = graph->nodes.first; node; node = node->next)
{
if (node->arcs != NULL)
{
@@ -187,7 +187,7 @@ int BLI_hasAdjacencyList(BGraph *graph)
{
BNode *node;
- for(node = graph->nodes.first; node; node = node->next)
+ for (node = graph->nodes.first; node; node = node->next)
{
if (node->arcs == NULL)
{
@@ -267,9 +267,9 @@ void BLI_removeDoubleNodes(BGraph *graph, float limit)
{
BNode *node_src, *node_replaced;
- for(node_src = graph->nodes.first; node_src; node_src = node_src->next)
+ for (node_src = graph->nodes.first; node_src; node_src = node_src->next)
{
- for(node_replaced = graph->nodes.first; node_replaced; node_replaced = node_replaced->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)
{
@@ -285,7 +285,7 @@ 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))
@@ -308,7 +308,7 @@ static void flagSubgraph(BNode *node, int subgraph)
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);
@@ -326,7 +326,7 @@ int BLI_FlagSubgraphs(BGraph *graph)
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;
}
@@ -369,7 +369,7 @@ static int detectCycle(BNode *node, BArc *src_arc)
/* 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];
@@ -399,7 +399,7 @@ 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)
@@ -415,7 +415,7 @@ BArc * BLI_findConnectedArc(BGraph *graph, BArc *arc, BNode *v)
{
BArc *nextArc;
- for(nextArc = graph->arcs.first; nextArc; nextArc = nextArc->next)
+ for (nextArc = graph->arcs.first; nextArc; nextArc = nextArc->next)
{
if (arc != nextArc && (nextArc->head == v || nextArc->tail == v))
{
@@ -450,7 +450,7 @@ static int subtreeShape(BNode *node, BArc *rootArc, int include_root)
{
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);
@@ -480,7 +480,7 @@ 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);
diff --git a/source/blender/blenlib/intern/gsqueue.c b/source/blender/blenlib/intern/gsqueue.c
index c0fa81475c0..2aa51387c48 100644
--- a/source/blender/blenlib/intern/gsqueue.c
+++ b/source/blender/blenlib/intern/gsqueue.c
@@ -64,7 +64,7 @@ int BLI_gsqueue_size(GSQueue *gq)
GSQueueElem *elem;
int size= 0;
- for(elem=gq->head; elem; elem=elem->next)
+ for (elem=gq->head; elem; elem=elem->next)
size++;
return size;
@@ -79,7 +79,8 @@ void BLI_gsqueue_pop(GSQueue *gq, void *item_r)
GSQueueElem *elem= gq->head;
if (elem==gq->tail) {
gq->head= gq->tail= NULL;
- } else {
+ }
+ else {
gq->head= gq->head->next;
}
@@ -92,7 +93,7 @@ void BLI_gsqueue_push(GSQueue *gq, void *item)
/* compare: prevent events added double in row */
if (!BLI_gsqueue_is_empty(gq)) {
- if(0==memcmp(item, &gq->head[1], gq->elem_size))
+ if (0==memcmp(item, &gq->head[1], gq->elem_size))
return;
}
elem= MEM_mallocN(sizeof(*elem)+gq->elem_size, "gqueue_push");
@@ -101,7 +102,8 @@ void BLI_gsqueue_push(GSQueue *gq, void *item)
if (BLI_gsqueue_is_empty(gq)) {
gq->tail= gq->head= elem;
- } else {
+ }
+ else {
gq->tail= gq->tail->next= elem;
}
}
@@ -113,7 +115,8 @@ void BLI_gsqueue_pushback(GSQueue *gq, void *item)
if (BLI_gsqueue_is_empty(gq)) {
gq->head= gq->tail= elem;
- } else {
+ }
+ else {
gq->head= elem;
}
}
diff --git a/source/blender/blenlib/intern/jitter.c b/source/blender/blenlib/intern/jitter.c
index 52733b092d3..fbdf698cc87 100644
--- a/source/blender/blenlib/intern/jitter.c
+++ b/source/blender/blenlib/intern/jitter.c
@@ -55,9 +55,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
vecx = jit1[j] - x - 1.0f;
vecy = jit1[j+1] - y - 1.0f;
for (k = 3; k>0 ; k--) {
- if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
+ if ( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
len= sqrt(vecx*vecx + vecy*vecy);
- if(len>0 && len<rad1) {
+ if (len>0 && len<rad1) {
len= len/rad1;
dvecx += vecx/len;
dvecy += vecy/len;
@@ -65,9 +65,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
}
vecx += 1.0f;
- if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
+ if ( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
len= sqrt(vecx*vecx + vecy*vecy);
- if(len>0 && len<rad1) {
+ if (len>0 && len<rad1) {
len= len/rad1;
dvecx += vecx/len;
dvecy += vecy/len;
@@ -75,9 +75,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
}
vecx += 1.0f;
- if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
+ if ( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
len= sqrt(vecx*vecx + vecy*vecy);
- if(len>0 && len<rad1) {
+ if (len>0 && len<rad1) {
len= len/rad1;
dvecx += vecx/len;
dvecy += vecy/len;
@@ -113,17 +113,17 @@ void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2)
vecx = jit1[j] - x - 1.0f;
vecy = jit1[j+1] - y - 1.0f;
- if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
+ if ( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
vecx += 1.0f;
- if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
+ if ( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
vecx += 1.0f;
- if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
+ if ( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
- if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
+ if ( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
vecy += 1.0f;
- if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
+ if ( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
vecy += 1.0f;
- if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
+ if ( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
}
}
@@ -144,7 +144,7 @@ void BLI_initjit(float *jitarr, int num)
float *jit2, x, rad1, rad2, rad3;
int i;
- if(num==0) return;
+ if (num==0) return;
jit2= MEM_mallocN(12 + 2*sizeof(float)*num, "initjit");
rad1= 1.0f/sqrtf((float)num);
@@ -153,7 +153,7 @@ void BLI_initjit(float *jitarr, int num)
BLI_srand(31415926 + num);
x= 0;
- for(i=0; i<2*num; i+=2) {
+ for (i=0; i<2*num; i+=2) {
jitarr[i]= x+ rad1*(float)(0.5-BLI_drand());
jitarr[i+1]= ((float)i/2)/num +rad1*(float)(0.5-BLI_drand());
x+= rad3;
@@ -169,7 +169,7 @@ void BLI_initjit(float *jitarr, int num)
MEM_freeN(jit2);
/* finally, move jittertab to be centered around (0,0) */
- for(i=0; i<2*num; i+=2) {
+ for (i=0; i<2*num; i+=2) {
jitarr[i] -= 0.5f;
jitarr[i+1] -= 0.5f;
}
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index 71077f8e467..fecaa507b5c 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -114,7 +114,7 @@ void BLI_remlink(ListBase *listbase, void *vlink)
int BLI_remlink_safe(ListBase *listbase, void *vlink)
{
- if(BLI_findindex(listbase, vlink) != -1) {
+ if (BLI_findindex(listbase, vlink) != -1) {
BLI_remlink(listbase, vlink);
return 1;
}
@@ -189,7 +189,7 @@ void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *))
BLI_remlink(listbase, current);
- while(previous && cmp(previous, current) == 1)
+ while (previous && cmp(previous, current) == 1)
{
previous = previous->prev;
}
@@ -457,7 +457,7 @@ int BLI_findstringindex(const ListBase *listbase, const char *id, const int offs
while (link) {
id_iter= ((const char *)link) + offset;
- if(id[0] == id_iter[0] && strcmp(id, id_iter)==0)
+ if (id[0] == id_iter[0] && strcmp(id, id_iter)==0)
return i;
i++;
link= link->next;
@@ -474,7 +474,7 @@ void BLI_duplicatelist(ListBase *dst, const ListBase *src)
src_link= src->first;
dst->first= dst->last= NULL;
- while(src_link) {
+ while (src_link) {
dst_link= MEM_dupallocN(src_link);
BLI_addtail(dst, dst_link);
diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c
index 67c2a989582..f2df36202fe 100644
--- a/source/blender/blenlib/intern/math_base.c
+++ b/source/blender/blenlib/intern/math_base.c
@@ -40,7 +40,8 @@ double copysign(double x, double y)
/* use atan2 to distinguish -0. from 0. */
if (y > 0. || (y == 0. && atan2(y, -1.) > 0.)) {
return fabs(x);
- } else {
+ }
+ else {
return -fabs(x);
}
}
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 74c7b67beed..d706f28e722 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -43,55 +43,55 @@
MINLINE float sqrt3f(float f)
{
- if(f==0.0f) return 0.0f;
- if(f<0) return (float)(-exp(log(-f)/3));
+ if (f==0.0f) return 0.0f;
+ if (f<0) return (float)(-exp(log(-f)/3));
else return (float)(exp(log(f)/3));
}
MINLINE double sqrt3d(double d)
{
- if(d==0.0) return 0;
- if(d<0) return -exp(log(-d)/3);
+ if (d==0.0) return 0;
+ if (d<0) return -exp(log(-d)/3);
else return exp(log(d)/3);
}
MINLINE float saacos(float fac)
{
- if(fac<= -1.0f) return (float)M_PI;
- else if(fac>=1.0f) return 0.0;
+ if (fac<= -1.0f) return (float)M_PI;
+ else if (fac>=1.0f) return 0.0;
else return (float)acos(fac);
}
MINLINE float saasin(float fac)
{
- if(fac<= -1.0f) return (float)-M_PI/2.0f;
- else if(fac>=1.0f) return (float)M_PI/2.0f;
+ if (fac<= -1.0f) return (float)-M_PI/2.0f;
+ else if (fac>=1.0f) return (float)M_PI/2.0f;
else return (float)asin(fac);
}
MINLINE float sasqrt(float fac)
{
- if(fac<=0.0f) return 0.0f;
+ if (fac<=0.0f) return 0.0f;
return (float)sqrt(fac);
}
MINLINE float saacosf(float fac)
{
- if(fac<= -1.0f) return (float)M_PI;
- else if(fac>=1.0f) return 0.0f;
+ if (fac<= -1.0f) return (float)M_PI;
+ else if (fac>=1.0f) return 0.0f;
else return (float)acosf(fac);
}
MINLINE float saasinf(float fac)
{
- if(fac<= -1.0f) return (float)-M_PI/2.0f;
- else if(fac>=1.0f) return (float)M_PI/2.0f;
+ if (fac<= -1.0f) return (float)-M_PI/2.0f;
+ else if (fac>=1.0f) return (float)M_PI/2.0f;
else return (float)asinf(fac);
}
MINLINE float sasqrtf(float fac)
{
- if(fac<=0.0f) return 0.0f;
+ if (fac<=0.0f) return 0.0f;
return (float)sqrtf(fac);
}
@@ -125,7 +125,7 @@ MINLINE int power_of_2_max_i(int n)
if (is_power_of_2_i(n))
return n;
- while(!is_power_of_2_i(n))
+ while (!is_power_of_2_i(n))
n = n & (n - 1);
return n * 2;
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 96600b6665f..bef5b9e538b 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -41,7 +41,7 @@ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b)
int i;
float f, p, q, t;
- if(s==0.0f) {
+ if (s==0.0f) {
*r = v;
*g = v;
*b = v;
@@ -242,7 +242,7 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv)
*ls = s;
*lh = h / 360.0f;
- if(*lh < 0.0f) *lh= 0.0f;
+ if (*lh < 0.0f) *lh= 0.0f;
*lv = v;
}
@@ -253,7 +253,7 @@ void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *l
rgb_to_hsv(r, g, b, lh, ls, lv);
- if(*lv <= 0.0f) {
+ if (*lv <= 0.0f) {
*lh= orig_h;
*ls= orig_s;
}
@@ -261,7 +261,7 @@ void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *l
*lh= orig_h;
}
- if(*lh==0.0f && orig_h >= 1.0f) {
+ if (*lh==0.0f && orig_h >= 1.0f) {
*lh= 1.0f;
}
}
@@ -315,11 +315,11 @@ unsigned int rgb_to_cpack(float r, float g, float b)
int ir, ig, ib;
ir= (int)floor(255.0f*r);
- if(ir<0) ir= 0; else if(ir>255) ir= 255;
+ if (ir<0) ir= 0; else if (ir>255) ir= 255;
ig= (int)floor(255.0f*g);
- if(ig<0) ig= 0; else if(ig>255) ig= 255;
+ if (ig<0) ig= 0; else if (ig>255) ig= 255;
ib= (int)floor(255.0f*b);
- if(ib<0) ib= 0; else if(ib>255) ib= 255;
+ if (ib<0) ib= 0; else if (ib>255) ib= 255;
return (ir+ (ig*256) + (ib*256*256));
}
@@ -404,12 +404,12 @@ float linearrgb_to_srgb(float c)
void minmax_rgb(short c[])
{
- if(c[0]>255) c[0]=255;
- else if(c[0]<0) c[0]=0;
- if(c[1]>255) c[1]=255;
- else if(c[1]<0) c[1]=0;
- if(c[2]>255) c[2]=255;
- else if(c[2]<0) c[2]=0;
+ if (c[0]>255) c[0]=255;
+ else if (c[0]<0) c[0]=0;
+ if (c[1]>255) c[1]=255;
+ else if (c[1]<0) c[1]=0;
+ if (c[2]>255) c[2]=255;
+ else if (c[2]<0) c[2]=0;
}
/*If the requested RGB shade contains a negative weight for
@@ -464,10 +464,10 @@ unsigned char rgb_to_luma_byte(const unsigned char rgb[3])
void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power)
{
int c;
- for(c=0; c<3; c++) {
+ for (c=0; c<3; c++) {
offset[c]= lift[c]*gain[c];
slope[c]= gain[c]*(1.0f-lift[c]);
- if(gamma[c] == 0)
+ if (gamma[c] == 0)
power[c]= FLT_MAX;
else
power[c]= 1.0f/gamma[c];
@@ -484,8 +484,8 @@ void rgb_float_set_hue_float_offset(float rgb[3], float hue_offset)
rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
hsv[0]+= hue_offset;
- if(hsv[0] > 1.0f) hsv[0] -= 1.0f;
- else if(hsv[0] < 0.0f) hsv[0] += 1.0f;
+ if (hsv[0] > 1.0f) hsv[0] -= 1.0f;
+ else if (hsv[0] < 0.0f) hsv[0] += 1.0f;
hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
}
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c
index 47ee54d6215..4f7a197e79b 100644
--- a/source/blender/blenlib/intern/math_color_inline.c
+++ b/source/blender/blenlib/intern/math_color_inline.c
@@ -87,7 +87,7 @@ MINLINE void srgb_to_linearrgb_predivide_v4(float linear[4], const float srgb[4]
{
float alpha, inv_alpha;
- if(srgb[3] == 1.0f || srgb[3] == 0.0f) {
+ if (srgb[3] == 1.0f || srgb[3] == 0.0f) {
alpha = 1.0f;
inv_alpha = 1.0f;
}
@@ -106,7 +106,7 @@ MINLINE void linearrgb_to_srgb_predivide_v4(float srgb[4], const float linear[4]
{
float alpha, inv_alpha;
- if(linear[3] == 1.0f || linear[3] == 0.0f) {
+ if (linear[3] == 1.0f || linear[3] == 0.0f) {
alpha = 1.0f;
inv_alpha = 1.0f;
}
@@ -153,7 +153,7 @@ MINLINE void linearrgb_to_srgb_ushort4_predivide(unsigned short srgb[4], const f
float alpha, inv_alpha, t;
int i;
- if(linear[3] == 1.0f || linear[3] == 0.0f) {
+ if (linear[3] == 1.0f || linear[3] == 0.0f) {
linearrgb_to_srgb_ushort4(srgb, linear);
return;
}
@@ -161,7 +161,7 @@ MINLINE void linearrgb_to_srgb_ushort4_predivide(unsigned short srgb[4], const f
alpha = linear[3];
inv_alpha = 1.0f/alpha;
- for(i=0; i<3; ++i) {
+ for (i=0; i<3; ++i) {
t = linear[i] * inv_alpha;
srgb[i] = (t < 1.0f)? (unsigned short)(to_srgb_table_lookup(t) * alpha) : FTOUSHORT(linearrgb_to_srgb(t) * alpha);
}
@@ -182,7 +182,7 @@ MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned
float fsrgb[4];
int i;
- if(srgb[3] == 255 || srgb[3] == 0) {
+ if (srgb[3] == 255 || srgb[3] == 0) {
srgb_to_linearrgb_uchar4(linear, srgb);
return;
}
@@ -193,4 +193,25 @@ MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned
srgb_to_linearrgb_predivide_v4(linear, fsrgb);
}
+/* color macros for themes */
+#define rgba_char_args_set_fl(col, r, g, b, a) rgba_char_args_set(col, r * 255, g * 255, b * 255, a * 255)
+
+MINLINE void rgba_char_args_set(char col[4], const char r, const char g, const char b, const char a)
+{
+ col[0] = r;
+ col[1] = g;
+ col[2] = b;
+ col[3] = a;
+}
+
+MINLINE void rgba_char_args_test_set(char col[4], const char r, const char g, const char b, const char a)
+{
+ if (col[3] == 0) {
+ col[0] = r;
+ col[1] = g;
+ col[2] = b;
+ col[3] = a;
+ }
+}
+
#endif /* __MATH_COLOR_INLINE_C__ */
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 8217439b7be..aa62df5ae3e 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -139,8 +139,8 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3])
y= fabsf(normal[1]);
z= fabsf(normal[2]);
max = MAX3(x, y, z);
- if(max==y) py=2;
- else if(max==x) {
+ if (max==y) py=2;
+ else if (max==x) {
px=1;
py= 2;
}
@@ -149,7 +149,7 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3])
prev= verts[nr-1];
cur= verts[0];
area= 0;
- for(a=0; a<nr; a++) {
+ for (a=0; a<nr; a++) {
area+= (cur[px]-prev[px])*(cur[py]+prev[py]);
prev= verts[a];
cur= verts[a+1];
@@ -169,7 +169,7 @@ float dist_to_line_v2(const float v1[2], const float v2[2], const float v3[2])
a[0]= v2[1]-v3[1];
a[1]= v3[0]-v2[0];
deler= (float)sqrt(a[0]*a[0]+a[1]*a[1]);
- if(deler== 0.0f) return 0;
+ if (deler== 0.0f) return 0;
return fabsf((v1[0]-v2[0])*a[0]+(v1[1]-v2[1])*a[1])/deler;
@@ -183,18 +183,18 @@ float dist_to_line_segment_v2(const float v1[2], const float v2[2], const float
rc[0]= v3[0]-v2[0];
rc[1]= v3[1]-v2[1];
len= rc[0]*rc[0]+ rc[1]*rc[1];
- if(len==0.0f) {
+ if (len==0.0f) {
rc[0]= v1[0]-v2[0];
rc[1]= v1[1]-v2[1];
return (float)(sqrt(rc[0]*rc[0]+ rc[1]*rc[1]));
}
labda= (rc[0]*(v1[0]-v2[0]) + rc[1]*(v1[1]-v2[1]))/len;
- if(labda <= 0.0f) {
+ if (labda <= 0.0f) {
pt[0]= v2[0];
pt[1]= v2[1];
}
- else if(labda >= 1.0f) {
+ else if (labda >= 1.0f) {
pt[0]= v3[0];
pt[1]= v3[1];
}
@@ -215,9 +215,9 @@ void closest_to_line_segment_v2(float close_r[2], const float p[2], const float
lambda= closest_to_line_v2(cp,p, l1, l2);
- if(lambda <= 0.0f)
+ if (lambda <= 0.0f)
copy_v2_v2(close_r, l1);
- else if(lambda >= 1.0f)
+ else if (lambda >= 1.0f)
copy_v2_v2(close_r, l2);
else
copy_v2_v2(close_r, cp);
@@ -230,9 +230,9 @@ void closest_to_line_segment_v3(float close_r[3], const float v1[3], const float
lambda= closest_to_line_v3(cp,v1, v2, v3);
- if(lambda <= 0.0f)
+ if (lambda <= 0.0f)
copy_v3_v3(close_r, v2);
- else if(lambda >= 1.0f)
+ else if (lambda >= 1.0f)
copy_v3_v3(close_r, v3);
else
copy_v3_v3(close_r, cp);
@@ -298,14 +298,14 @@ int isect_line_line_v2_int(const int v1[2], const int v2[2], const int v3[2], co
float div, labda, mu;
div= (float)((v2[0]-v1[0])*(v4[1]-v3[1])-(v2[1]-v1[1])*(v4[0]-v3[0]));
- if(div==0.0f) return ISECT_LINE_LINE_COLINEAR;
+ if (div==0.0f) return ISECT_LINE_LINE_COLINEAR;
labda= ((float)(v1[1]-v3[1])*(v4[0]-v3[0])-(v1[0]-v3[0])*(v4[1]-v3[1]))/div;
mu= ((float)(v1[1]-v3[1])*(v2[0]-v1[0])-(v1[0]-v3[0])*(v2[1]-v1[1]))/div;
- if(labda>=0.0f && labda<=1.0f && mu>=0.0f && mu<=1.0f) {
- if(labda==0.0f || labda==1.0f || mu==0.0f || mu==1.0f) return ISECT_LINE_LINE_EXACT;
+ if (labda>=0.0f && labda<=1.0f && mu>=0.0f && mu<=1.0f) {
+ if (labda==0.0f || labda==1.0f || mu==0.0f || mu==1.0f) return ISECT_LINE_LINE_EXACT;
return ISECT_LINE_LINE_CROSS;
}
return ISECT_LINE_LINE_NONE;
@@ -317,14 +317,14 @@ int isect_line_line_v2(const float v1[2], const float v2[2], const float v3[2],
float div, labda, mu;
div= (v2[0]-v1[0])*(v4[1]-v3[1])-(v2[1]-v1[1])*(v4[0]-v3[0]);
- if(div==0.0f) return ISECT_LINE_LINE_COLINEAR;
+ if (div==0.0f) return ISECT_LINE_LINE_COLINEAR;
labda= ((float)(v1[1]-v3[1])*(v4[0]-v3[0])-(v1[0]-v3[0])*(v4[1]-v3[1]))/div;
mu= ((float)(v1[1]-v3[1])*(v2[0]-v1[0])-(v1[0]-v3[0])*(v2[1]-v1[1]))/div;
- if(labda>=0.0f && labda<=1.0f && mu>=0.0f && mu<=1.0f) {
- if(labda==0.0f || labda==1.0f || mu==0.0f || mu==1.0f) return ISECT_LINE_LINE_EXACT;
+ if (labda>=0.0f && labda<=1.0f && mu>=0.0f && mu<=1.0f) {
+ if (labda==0.0f || labda==1.0f || mu==0.0f || mu==1.0f) return ISECT_LINE_LINE_EXACT;
return ISECT_LINE_LINE_CROSS;
}
return ISECT_LINE_LINE_NONE;
@@ -350,18 +350,19 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[
d= a1*b2-a2*b1;
- if(d==0) {
- if(a1*c2-a2*c1==0.0f && b1*c2-b2*c1==0.0f) { /* equal lines */
+ if (d==0) {
+ if (a1*c2-a2*c1==0.0f && b1*c2-b2*c1==0.0f) { /* equal lines */
float a[2], b[2], c[2];
float u2;
- if(len_v2v2(v1, v2)==0.0f) {
- if(len_v2v2(v3, v4)>eps) {
+ if (len_v2v2(v1, v2)==0.0f) {
+ if (len_v2v2(v3, v4)>eps) {
/* use non-point segment as basis */
SWAP(const float *, v1, v3);
SWAP(const float *, v2, v4);
- } else { /* both of segments are points */
- if(equals_v2v2(v1, v3)) { /* points are equal */
+ }
+ else { /* both of segments are points */
+ if (equals_v2v2(v1, v3)) { /* points are equal */
copy_v2_v2(vi, v1);
return 1;
}
@@ -379,10 +380,10 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[
sub_v2_v2v2(a, v4, v1);
u2= dot_v2v2(a, b) / dot_v2v2(c, c);
- if(u>u2) SWAP(float, u, u2);
+ if (u>u2) SWAP(float, u, u2);
- if(u>1.0f+eps || u2<-eps) return -1; /* non-ovlerlapping segments */
- else if(maxf(0.0f, u) == minf(1.0f, u2)) { /* one common point: can return result */
+ if (u>1.0f+eps || u2<-eps) return -1; /* non-ovlerlapping segments */
+ else if (maxf(0.0f, u) == minf(1.0f, u2)) { /* one common point: can return result */
interp_v2_v2v2(vi, v1, v2, maxf(0, u));
return 1;
}
@@ -395,7 +396,7 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[
u= (c2*b1-b2*c1)/d;
v= (c1*a2-a1*c2)/d;
- if(u>=-eps && u<=1.0f+eps && v>=-eps && v<=1.0f+eps) { /* intersection */
+ if (u>=-eps && u<=1.0f+eps && v>=-eps && v<=1.0f+eps) { /* intersection */
interp_v2_v2v2(vi, v1, v2, u);
return 1;
}
@@ -594,7 +595,8 @@ int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2],
return 1;
}
}
- } else {
+ }
+ else {
if (! (line_point_side_v2(v2,v3,pt)>=0.0f)) {
if (! (line_point_side_v2(v3,v1,pt)>=0.0f)) {
return -1;
@@ -615,7 +617,8 @@ int isect_point_quad_v2(const float pt[2], const float v1[2], const float v2[2],
}
}
}
- } else {
+ }
+ else {
if (! (line_point_side_v2(v2,v3,pt)>=0.0f)) {
if (! (line_point_side_v2(v3,v4,pt)>=0.0f)) {
if (! (line_point_side_v2(v4,v1,pt)>=0.0f)) {
@@ -662,7 +665,7 @@ int isect_line_tri_v3(const float p1[3], const float p2[3],
*r_lambda = f * dot_v3v3(e2, q);
if ((*r_lambda < 0.0f)||(*r_lambda > 1.0f)) return 0;
- if(r_uv) {
+ if (r_uv) {
r_uv[0]= u;
r_uv[1]= v;
}
@@ -703,7 +706,7 @@ int isect_ray_tri_v3(const float p1[3], const float d[3],
*r_lambda = f * dot_v3v3(e2, q);
if ((*r_lambda < 0.0f)) return 0;
- if(r_uv) {
+ if (r_uv) {
r_uv[0]= u;
r_uv[1]= v;
}
@@ -771,7 +774,7 @@ int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3],
*r_lambda = f * dot_v3v3(e2, q);
if ((*r_lambda < 0.0f)) return 0;
- if(uv) {
+ if (uv) {
uv[0]= u;
uv[1]= v;
}
@@ -821,7 +824,7 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
return 0;
}
- if(r_uv) {
+ if (r_uv) {
r_uv[0]= u;
r_uv[1]= v;
}
@@ -841,7 +844,7 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons
normalize_v3_v3(p_no, plane_no);
dot= dot_v3v3(l_vec, p_no);
- if(dot == 0.0f) {
+ if (dot == 0.0f) {
return 0;
}
else {
@@ -850,7 +853,7 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons
/* for predictable flipping since the plane is only used to
* define a direction, ignore its flipping and aligned with 'l_vec' */
- if(dot < 0.0f) {
+ if (dot < 0.0f) {
dot= -dot;
negate_v3(p_no);
}
@@ -860,7 +863,7 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons
dist = line_point_factor_v3(plane_co, l1, l1_plane);
/* treat line like a ray, when 'no_flip' is set */
- if(no_flip && dist < 0.0f) {
+ if (no_flip && dist < 0.0f) {
dist= -dist;
}
@@ -872,7 +875,7 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons
}
}
-/* note: return normal isnt unit length */
+/* note: return normal isn't unit length */
void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
const float plane_a_co[3], const float plane_a_no[3],
const float plane_b_co[3], const float plane_b_no[3])
@@ -941,13 +944,13 @@ int isect_sweeping_sphere_tri_v3(
normalize_v3(nor);
/* flip normal */
- if(dot_v3v3(nor,vel)>0.0f) negate_v3(nor);
+ if (dot_v3v3(nor,vel)>0.0f) negate_v3(nor);
a=dot_v3v3(p1,nor)-dot_v3v3(v0,nor);
nordotv=dot_v3v3(nor,vel);
if (fabsf(nordotv) < 0.000001f) {
- if(fabsf(a) >= radius) {
+ if (fabsf(a) >= radius) {
return 0;
}
}
@@ -955,10 +958,10 @@ int isect_sweeping_sphere_tri_v3(
float t0=(-a+radius)/nordotv;
float t1=(-a-radius)/nordotv;
- if(t0>t1)
+ if (t0>t1)
SWAP(float, t0, t1);
- if(t0>1.0f || t1<0.0f) return 0;
+ if (t0>1.0f || t1<0.0f) return 0;
/* clamp to [0,1] */
CLAMP(t0, 0.0f, 1.0f);
@@ -1005,7 +1008,7 @@ int isect_sweeping_sphere_tri_v3(
b=2.0f*dot_v3v3(vel,temp);
c=dot_v3v3(temp,temp)-radius2;
- if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) {
+ if (getLowestRoot(a, b, c, *r_lambda, r_lambda)) {
copy_v3_v3(ipoint,v0);
found_by_sweep=1;
}
@@ -1025,7 +1028,7 @@ int isect_sweeping_sphere_tri_v3(
b=2.0f*dot_v3v3(vel,temp);
c=dot_v3v3(temp,temp)-radius2;
- if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) {
+ if (getLowestRoot(a, b, c, *r_lambda, r_lambda)) {
copy_v3_v3(ipoint,v2);
found_by_sweep=1;
}
@@ -1137,9 +1140,9 @@ int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3]
if ((v < 0.0f)||(v > 1.0f)) return 0;
f= e1[a1];
- if((f > -0.000001f) && (f < 0.000001f)) {
+ if ((f > -0.000001f) && (f < 0.000001f)) {
f= e1[a2];
- if((f > -0.000001f) && (f < 0.000001f)) return 0;
+ if ((f > -0.000001f) && (f < 0.000001f)) return 0;
u= (-p[a2]-v*e2[a2])/f;
}
else
@@ -1320,6 +1323,25 @@ float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2
return(dot_v2v2(u, h)/dot_v2v2(u, u));
}
+/* ensyre the distance between these points is no greater then 'dist'
+ * if it is, scale then both into the center */
+void limit_dist_v3(float v1[3], float v2[3], const float dist)
+{
+ const float dist_old = len_v3v3(v1, v2);
+
+ if (dist_old > dist) {
+ float v1_old[3];
+ float v2_old[3];
+ float fac = (dist / dist_old) * 0.5f;
+
+ copy_v3_v3(v1_old, v1);
+ copy_v3_v3(v2_old, v2);
+
+ interp_v3_v3v3(v1, v1_old, v2_old, 0.5f - fac);
+ interp_v3_v3v3(v2, v1_old, v2_old, 0.5f + fac);
+ }
+}
+
/* Similar to LineIntersectsTriangleUV, except it operates on a quad and in 2d, assumes point is in quad */
void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2])
{
@@ -1347,7 +1369,8 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2
/*w1 = w1/wtot;*/
/*w2 = w2/wtot;*/
r_uv[0] = w1/wtot;
- } else {
+ }
+ else {
/* lines are parallel, lambda_cp_line_ex is 3d grrr */
/*printf("\tparallel1\n");*/
pt3d[0] = pt[0];
@@ -1387,7 +1410,8 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2
w2 = len_v2(v2d);
wtot = w1+w2;
r_uv[1] = w1/wtot;
- } else {
+ }
+ else {
/* lines are parallel, lambda_cp_line_ex is 3d grrr */
/*printf("\tparallel2\n");*/
pt3d[0] = pt[0];
@@ -1455,8 +1479,8 @@ int isect_point_tri_v2(float pt[2], float v1[2], float v2[2], float v3[2])
inp2= (v3[0]-v2[0])*(v2[1]-pt[1]) + (v2[1]-v3[1])*(v2[0]-pt[0]);
inp3= (v1[0]-v3[0])*(v3[1]-pt[1]) + (v3[1]-v1[1])*(v3[0]-pt[0]);
- if(inp1<=0.0f && inp2<=0.0f && inp3<=0.0f) return 1;
- if(inp1>=0.0f && inp2>=0.0f && inp3>=0.0f) return 1;
+ if (inp1<=0.0f && inp2<=0.0f && inp3<=0.0f) return 1;
+ if (inp1>=0.0f && inp2>=0.0f && inp3>=0.0f) return 1;
return 0;
}
@@ -1568,9 +1592,9 @@ static int point_in_slice_m(float p[3],float origin[3],float normal[3],float lns
int isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3])
{
- if(!point_in_slice(p,v1,v2,v3)) return 0;
- if(!point_in_slice(p,v2,v3,v1)) return 0;
- if(!point_in_slice(p,v3,v1,v2)) return 0;
+ if (!point_in_slice(p,v1,v2,v3)) return 0;
+ if (!point_in_slice(p,v2,v3,v1)) return 0;
+ if (!point_in_slice(p,v3,v1,v2)) return 0;
return 1;
}
@@ -1582,21 +1606,21 @@ int clip_line_plane(float p1[3], float p2[3], const float plane[4])
sub_v3_v3v3(dp, p2, p1);
div= dot_v3v3(dp, n);
- if(div == 0.0f) /* parallel */
+ if (div == 0.0f) /* parallel */
return 1;
t= -(dot_v3v3(p1, n) + plane[3])/div;
- if(div > 0.0f) {
+ if (div > 0.0f) {
/* behind plane, completely clipped */
- if(t >= 1.0f) {
+ if (t >= 1.0f) {
zero_v3(p1);
zero_v3(p2);
return 0;
}
/* intersect plane */
- if(t > 0.0f) {
+ if (t > 0.0f) {
madd_v3_v3v3fl(pc, p1, dp, t);
copy_v3_v3(p1, pc);
return 1;
@@ -1606,14 +1630,14 @@ int clip_line_plane(float p1[3], float p2[3], const float plane[4])
}
else {
/* behind plane, completely clipped */
- if(t <= 0.0f) {
+ if (t <= 0.0f) {
zero_v3(p1);
zero_v3(p2);
return 0;
}
/* intersect plane */
- if(t < 1.0f) {
+ if (t < 1.0f) {
madd_v3_v3v3fl(pc, p1, dp, t);
copy_v3_v3(p2, pc);
return 1;
@@ -1638,7 +1662,7 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
int delta_x = (x2 > x1?(ix = 1, x2 - x1):(ix = -1, x1 - x2)) << 1;
int delta_y = (y2 > y1?(iy = 1, y2 - y1):(iy = -1, y1 - y2)) << 1;
- if(callback(x1, y1, userData) == 0) {
+ if (callback(x1, y1, userData) == 0) {
return;
}
@@ -1681,7 +1705,7 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
y1 += iy;
error += delta_x;
- if(callback(x1, y1, userData) == 0) {
+ if (callback(x1, y1, userData) == 0) {
return;
}
}
@@ -1707,31 +1731,29 @@ static float tri_signed_area(const float v1[3], const float v2[3], const float v
return 0.5f*((v1[i]-v2[i])*(v2[j]-v3[j]) + (v1[j]-v2[j])*(v3[i]-v2[i]));
}
+/* return 1 when degenerate */
static int barycentric_weights(const float v1[3], const float v2[3], const float v3[3], const float co[3], const float n[3], float w[3])
{
- float a1, a2, a3, asum;
+ float wtot;
int i, j;
axis_dominant_v3(&i, &j, n);
- a1= tri_signed_area(v2, v3, co, i, j);
- a2= tri_signed_area(v3, v1, co, i, j);
- a3= tri_signed_area(v1, v2, co, i, j);
+ w[0] = tri_signed_area(v2, v3, co, i, j);
+ w[1] = tri_signed_area(v3, v1, co, i, j);
+ w[2] = tri_signed_area(v1, v2, co, i, j);
- asum= a1 + a2 + a3;
+ wtot = w[0] + w[1] + w[2];
- if (fabsf(asum) < FLT_EPSILON) {
+ if (fabsf(wtot) > FLT_EPSILON) {
+ mul_v3_fl(w, 1.0f / wtot);
+ return 0;
+ }
+ else {
/* zero area triangle */
- w[0]= w[1]= w[2]= 1.0f/3.0f;
+ copy_v3_fl(w, 1.0f / 3.0f);
return 1;
}
-
- asum= 1.0f/asum;
- w[0]= a1*asum;
- w[1]= a2*asum;
- w[2]= a3*asum;
-
- return 0;
}
void interp_weights_face_v3(float w[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float co[3])
@@ -1741,13 +1763,13 @@ void interp_weights_face_v3(float w[4], const float v1[3], const float v2[3], co
w[0]= w[1]= w[2]= w[3]= 0.0f;
/* first check for exact match */
- if(equals_v3v3(co, v1))
+ if (equals_v3v3(co, v1))
w[0]= 1.0f;
- else if(equals_v3v3(co, v2))
+ else if (equals_v3v3(co, v2))
w[1]= 1.0f;
- else if(equals_v3v3(co, v3))
+ else if (equals_v3v3(co, v3))
w[2]= 1.0f;
- else if(v4 && equals_v3v3(co, v4))
+ else if (v4 && equals_v3v3(co, v4))
w[3]= 1.0f;
else {
/* otherwise compute barycentric interpolation weights */
@@ -1768,12 +1790,12 @@ void interp_weights_face_v3(float w[4], const float v1[3], const float v2[3], co
degenerate= barycentric_weights(v1, v2, v4, co, n, w);
SWAP(float, w[2], w[3]);
- if(degenerate || (w[0] < 0.0f)) {
+ if (degenerate || (w[0] < 0.0f)) {
/* if w[1] is negative, co is on the other side of the v1-v3 edge,
* so we interpolate using the other triangle */
degenerate= barycentric_weights(v2, v3, v4, co, n, w2);
- if(!degenerate) {
+ if (!degenerate) {
w[0]= 0.0f;
w[1]= w2[0];
w[2]= w2[1];
@@ -1790,22 +1812,19 @@ void interp_weights_face_v3(float w[4], const float v1[3], const float v2[3], co
* note: using area_tri_signed_v2 means locations outside the triangle are correctly weighted */
void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3])
{
- float wtot_inv, wtot;
+ float wtot;
w[0] = area_tri_signed_v2(v2, v3, co);
w[1] = area_tri_signed_v2(v3, v1, co);
w[2] = area_tri_signed_v2(v1, v2, co);
- wtot = w[0]+w[1]+w[2];
+ wtot = w[0] + w[1] + w[2];
if (wtot != 0.0f) {
- wtot_inv = 1.0f/wtot;
-
- w[0] = w[0]*wtot_inv;
- w[1] = w[1]*wtot_inv;
- w[2] = w[2]*wtot_inv;
+ mul_v3_fl(w, 1.0f / wtot);
+ }
+ else { /* dummy values for zero area face */
+ copy_v3_fl(w, 1.0f / 3.0f);
}
- else /* dummy values for zero area face */
- w[0] = w[1] = w[2] = 1.0f/3.0f;
}
/* given 2 triangles in 3D space, and a point in relation to the first triangle.
@@ -1865,13 +1884,13 @@ int interp_sparse_array(float *array, int const list_size, const float skipval)
int i;
for (i=0; i < list_size; i++) {
- if(array[i] == skipval)
+ if (array[i] == skipval)
found_invalid= 1;
else
found_valid= 1;
}
- if(found_valid==0) {
+ if (found_valid==0) {
return -1;
}
else if (found_invalid==0) {
@@ -1889,7 +1908,7 @@ int interp_sparse_array(float *array, int const list_size, const float skipval)
int *ofs_tot_down= MEM_callocN(sizeof(int) * list_size, "interp_sparse_array tdown");
for (i=0; i < list_size; i++) {
- if(array[i] == skipval) {
+ if (array[i] == skipval) {
array_up[i]= valid_last;
ofs_tot_up[i]= ++valid_ofs;
}
@@ -1903,7 +1922,7 @@ int interp_sparse_array(float *array, int const list_size, const float skipval)
valid_ofs= 0;
for (i=list_size-1; i >= 0; i--) {
- if(array[i] == skipval) {
+ if (array[i] == skipval) {
array_down[i]= valid_last;
ofs_tot_down[i]= ++valid_ofs;
}
@@ -1915,12 +1934,14 @@ int interp_sparse_array(float *array, int const list_size, const float skipval)
/* now blend */
for (i=0; i < list_size; i++) {
- if(array[i] == skipval) {
- if(array_up[i] != skipval && array_down[i] != skipval) {
+ if (array[i] == skipval) {
+ if (array_up[i] != skipval && array_down[i] != skipval) {
array[i]= ((array_up[i] * ofs_tot_down[i]) + (array_down[i] * ofs_tot_up[i])) / (float)(ofs_tot_down[i] + ofs_tot_up[i]);
- } else if (array_up[i] != skipval) {
+ }
+ else if (array_up[i] != skipval) {
array[i]= array_up[i];
- } else if (array_down[i] != skipval) {
+ }
+ else if (array_down[i] != skipval) {
array[i]= array_down[i];
}
}
@@ -1950,7 +1971,7 @@ static float mean_value_half_tan(const float v1[3], const float v2[3], const flo
dot= dot_v3v3(d2, d3);
len= len_v3(d2)*len_v3(d3);
- if(area == 0.0f)
+ if (area == 0.0f)
return 0.0f;
else
return (len - dot)/area;
@@ -1963,7 +1984,7 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
totweight= 0.0f;
- for(i=0; i<n; i++) {
+ for (i=0; i<n; i++) {
vmid= v[i];
vprev= (i == 0)? v[n-1]: v[i-1];
vnext= (i == n-1)? v[0]: v[i+1];
@@ -1976,8 +1997,8 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
totweight += w[i];
}
- if(totweight != 0.0f)
- for(i=0; i<n; i++)
+ if (totweight != 0.0f)
+ for (i=0; i<n; i++)
w[i] /= totweight;
}
@@ -2020,12 +2041,13 @@ void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const
const double c= st0[1]-st2[1], d= st1[1]-st2[1];
const double det= a*d - c*b;
- if(IS_ZERO(det)==0) { /* det should never be zero since the determinant is the signed ST area of the triangle. */
+ if (IS_ZERO(det)==0) { /* det should never be zero since the determinant is the signed ST area of the triangle. */
const double x[]= {st[0]-st2[0], st[1]-st2[1]};
r_uv[0]= (float)((d*x[0] - b*x[1])/det);
r_uv[1]= (float)(((-c)*x[0] + a*x[1])/det);
- } else zero_v2(r_uv);
+ }
+ else zero_v2(r_uv);
}
/* bilinear reverse */
@@ -2049,11 +2071,12 @@ void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const
// clear outputs
zero_v2(r_uv);
- if(IS_ZERO(denom)!=0) {
+ if (IS_ZERO(denom)!=0) {
const double fDen= a-fC;
- if(IS_ZERO(fDen)==0)
+ if (IS_ZERO(fDen)==0)
r_uv[0]= (float)(a / fDen);
- } else {
+ }
+ else {
const double desc_sq= b*b - a*fC;
const double desc= sqrt(desc_sq<0.0?0.0:desc_sq);
const double s= signed_area>0 ? (-1.0) : 1.0;
@@ -2068,12 +2091,12 @@ void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const
const double denom_t= (1-r_uv[0])*(st0[1]-st3[1]) + r_uv[0]*(st1[1]-st2[1]);
int i= 0; double denom= denom_s;
- if(fabs(denom_s)<fabs(denom_t)) {
+ if (fabs(denom_s)<fabs(denom_t)) {
i= 1;
denom=denom_t;
}
- if(IS_ZERO(denom)==0)
+ if (IS_ZERO(denom)==0)
r_uv[1]= (float) (( (1.0f-r_uv[0])*(st0[i]-st[i]) + r_uv[0]*(st1[i]-st[i]) ) / denom);
}
}
@@ -2128,7 +2151,7 @@ void perspective_m4(float mat[4][4], const float left, const float right, const
/* translate a matrix created by orthographic_m4 or perspective_m4 in XY coords (used to jitter the view) */
void window_translate_m4(float winmat[][4], float perspmat[][4], const float x, const float y)
{
- if(winmat[2][3] == -1.0f) {
+ if (winmat[2][3] == -1.0f) {
/* in the case of a win-matrix, this means perspective always */
float v1[3];
float v2[3];
@@ -2159,8 +2182,8 @@ static void i_multmatrix(float icand[][4], float Vm[][4])
int row, col;
float temp[4][4];
- for(row=0 ; row<4 ; row++)
- for(col=0 ; col<4 ; col++)
+ for (row=0 ; row<4 ; row++)
+ for (col=0 ; col<4 ; col++)
temp[row][col] = icand[row][0] * Vm[0][col]
+ icand[row][1] * Vm[1][col]
+ icand[row][2] * Vm[2][col]
@@ -2199,7 +2222,8 @@ void lookat_m4(float mat[][4],float vx, float vy, float vz, float px, float py,
if (hyp1 != 0.0f) { /* rotate X */
sine = -dy / hyp1;
cosine = hyp /hyp1;
- } else {
+ }
+ else {
sine = 0;
cosine = 1.0f;
}
@@ -2217,7 +2241,8 @@ void lookat_m4(float mat[][4],float vx, float vy, float vz, float px, float py,
if (hyp != 0.0f) { /* rotate Y */
sine = dx / hyp;
cosine = -dz / hyp;
- } else {
+ }
+ else {
sine = 0;
cosine = 1.0f;
}
@@ -2237,7 +2262,7 @@ int box_clip_bounds_m4(float boundbox[2][3], const float bounds[4], float winmat
copy_m4_m4(mat, winmat);
- for(a=0; a<8; a++) {
+ for (a=0; a<8; a++) {
vec[0]= (a & 1)? boundbox[0][0]: boundbox[1][0];
vec[1]= (a & 2)? boundbox[0][1]: boundbox[1][1];
vec[2]= (a & 4)? boundbox[0][2]: boundbox[1][2];
@@ -2245,23 +2270,23 @@ int box_clip_bounds_m4(float boundbox[2][3], const float bounds[4], float winmat
mul_m4_v4(mat, vec);
fl= 0;
- if(bounds) {
- if(vec[0] > bounds[1]*vec[3]) fl |= 1;
- if(vec[0]< bounds[0]*vec[3]) fl |= 2;
- if(vec[1] > bounds[3]*vec[3]) fl |= 4;
- if(vec[1]< bounds[2]*vec[3]) fl |= 8;
+ if (bounds) {
+ if (vec[0] > bounds[1]*vec[3]) fl |= 1;
+ if (vec[0]< bounds[0]*vec[3]) fl |= 2;
+ if (vec[1] > bounds[3]*vec[3]) fl |= 4;
+ if (vec[1]< bounds[2]*vec[3]) fl |= 8;
}
else {
- if(vec[0] < -vec[3]) fl |= 1;
- if(vec[0] > vec[3]) fl |= 2;
- if(vec[1] < -vec[3]) fl |= 4;
- if(vec[1] > vec[3]) fl |= 8;
+ if (vec[0] < -vec[3]) fl |= 1;
+ if (vec[0] > vec[3]) fl |= 2;
+ if (vec[1] < -vec[3]) fl |= 4;
+ if (vec[1] > vec[3]) fl |= 8;
}
- if(vec[2] < -vec[3]) fl |= 16;
- if(vec[2] > vec[3]) fl |= 32;
+ if (vec[2] < -vec[3]) fl |= 16;
+ if (vec[2] > vec[3]) fl |= 32;
flag &= fl;
- if(flag==0) return 0;
+ if (flag==0) return 0;
}
return flag;
@@ -2275,7 +2300,7 @@ void box_minmax_bounds_m4(float min[3], float max[3], float boundbox[2][3], floa
copy_v3_v3(mn, min);
copy_v3_v3(mx, max);
- for(a=0; a<8; a++) {
+ for (a=0; a<8; a++) {
vec[0]= (a & 1)? boundbox[0][0]: boundbox[1][0];
vec[1]= (a & 2)? boundbox[0][1]: boundbox[1][1];
vec[2]= (a & 4)? boundbox[0][2]: boundbox[1][2];
@@ -2297,7 +2322,7 @@ void map_to_tube(float *r_u, float *r_v, const float x, const float y, const flo
*r_v = (z + 1.0f) / 2.0f;
len = sqrtf(x * x + y * y);
- if(len > 0.0f) {
+ if (len > 0.0f) {
*r_u = (float)((1.0 - (atan2(x/len,y/len) / M_PI)) / 2.0);
}
else {
@@ -2310,8 +2335,8 @@ void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const f
float len;
len = sqrtf(x * x + y * y + z * z);
- if(len > 0.0f) {
- if(x==0.0f && y==0.0f) *r_u= 0.0f; /* othwise domain error */
+ if (len > 0.0f) {
+ if (x==0.0f && y==0.0f) *r_u= 0.0f; /* othwise domain error */
else *r_u = (1.0f - atan2f(x,y) / (float)M_PI) / 2.0f;
*r_v = 1.0f - (float)saacos(z/len)/(float)M_PI;
@@ -2334,7 +2359,7 @@ void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
sub_v3_v3v3(vdiffs[0], co2, co1);
sub_v3_v3v3(vdiffs[1], co3, co2);
- if(nverts==3) {
+ if (nverts==3) {
sub_v3_v3v3(vdiffs[2], co1, co3);
}
else {
@@ -2353,7 +2378,7 @@ void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
const float *prev_edge = vdiffs[nverts-1];
int i;
- for(i=0; i<nverts; i++) {
+ for (i=0; i<nverts; i++) {
const float *cur_edge= vdiffs[i];
const float fac= saacos(-dot_v3v3(cur_edge, prev_edge));
@@ -2382,7 +2407,7 @@ void accumulate_vertex_normals_poly(float **vertnos, float polyno[3],
const float *prev_edge = vdiffs[nverts-1];
int i;
- for(i=0; i<nverts; i++) {
+ for (i=0; i<nverts; i++) {
const float *cur_edge = vdiffs[i];
/* calculate angle between the two poly edges incident on
@@ -2412,8 +2437,8 @@ void sum_or_add_vertex_tangent(void *arena, VertexTangent **vtang, const float t
VertexTangent *vt;
/* find a tangent with connected uvs */
- for(vt= *vtang; vt; vt=vt->next) {
- if(fabsf(uv[0]-vt->uv[0]) < STD_UV_CONNECT_LIMIT && fabsf(uv[1]-vt->uv[1]) < STD_UV_CONNECT_LIMIT) {
+ for (vt= *vtang; vt; vt=vt->next) {
+ if (fabsf(uv[0]-vt->uv[0]) < STD_UV_CONNECT_LIMIT && fabsf(uv[1]-vt->uv[1]) < STD_UV_CONNECT_LIMIT) {
add_v3_v3(vt->tang, tang);
return;
}
@@ -2425,7 +2450,7 @@ void sum_or_add_vertex_tangent(void *arena, VertexTangent **vtang, const float t
vt->uv[0]= uv[0];
vt->uv[1]= uv[1];
- if(*vtang)
+ if (*vtang)
vt->next= *vtang;
*vtang= vt;
}
@@ -2435,8 +2460,8 @@ float *find_vertex_tangent(VertexTangent *vtang, const float uv[2])
VertexTangent *vt;
static float nulltang[3] = {0.0f, 0.0f, 0.0f};
- for(vt= vtang; vt; vt=vt->next)
- if(fabsf(uv[0]-vt->uv[0]) < STD_UV_CONNECT_LIMIT && fabsf(uv[1]-vt->uv[1]) < STD_UV_CONNECT_LIMIT)
+ for (vt= vtang; vt; vt=vt->next)
+ if (fabsf(uv[0]-vt->uv[0]) < STD_UV_CONNECT_LIMIT && fabsf(uv[1]-vt->uv[1]) < STD_UV_CONNECT_LIMIT)
return vt->tang;
return nulltang; /* shouldn't happen, except for nan or so */
@@ -2450,7 +2475,7 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], flo
float t2= uv3[1] - uv1[1];
float det= (s1 * t2 - s2 * t1);
- if(det != 0.0f) { /* otherwise 'tang' becomes nan */
+ if (det != 0.0f) { /* otherwise 'tang' becomes nan */
float tangv[3], ct[3], e1[3], e2[3];
det= 1.0f/det;
@@ -2529,7 +2554,7 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,flo
/* do com for both clouds */
if (pos && rpos && (list_size > 0)) { /* paranoya check */
/* do com for both clouds */
- for(a=0; a<list_size; a++) {
+ for (a=0; a<list_size; a++) {
if (weight) {
float v[3];
copy_v3_v3(v,pos[a]);
@@ -2568,7 +2593,7 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,flo
zero_m3(mr);
/* build 'projection' matrix */
- for(a=0; a<list_size; a++) {
+ for (a=0; a<list_size; a++) {
sub_v3_v3v3(va,rpos[a],accu_rcom);
/* mul_v3_fl(va,bp->mass); mass needs renormalzation here ?? */
sub_v3_v3v3(vb,pos[a],accu_com);
@@ -2609,7 +2634,7 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,flo
/* without the far case ... but seems to work here pretty neat */
odet = 0.f;
ndet = _det_m3(q);
- while((odet-ndet)*(odet-ndet) > eps && i<imax) {
+ while ((odet-ndet)*(odet-ndet) > eps && i<imax) {
invert_m3_m3(qi,q);
transpose_m3(qi);
add_m3_m3m3(q,q,qi);
@@ -2622,12 +2647,12 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,flo
if (i) {
float scale[3][3];
float irot[3][3];
- if(lrot) copy_m3_m3(lrot,q);
+ if (lrot) copy_m3_m3(lrot,q);
invert_m3_m3(irot,q);
invert_m3_m3(qi,mr);
mul_m3_m3m3(q,m,qi);
mul_m3_m3m3(scale,irot,q);
- if(lscale) copy_m3_m3(lscale,scale);
+ if (lscale) copy_m3_m3(lscale,scale);
}
}
@@ -2655,20 +2680,20 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
sd[1]= dot_v3v3(n, v1) - c;
sd[2]= dot_v3v3(n, v2) - c;
- if(fabsf(sd[0]) < epsilon) sd[0] = 0.0f;
- if(fabsf(sd[1]) < epsilon) sd[1] = 0.0f;
- if(fabsf(sd[2]) < epsilon) sd[2] = 0.0f;
+ if (fabsf(sd[0]) < epsilon) sd[0] = 0.0f;
+ if (fabsf(sd[1]) < epsilon) sd[1] = 0.0f;
+ if (fabsf(sd[2]) < epsilon) sd[2] = 0.0f;
- if(sd[0] > 0) {
- if(sd[1] > 0) {
- if(sd[2] > 0) {
+ if (sd[0] > 0) {
+ if (sd[1] > 0) {
+ if (sd[2] > 0) {
// +++
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// ++-
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
@@ -2683,15 +2708,15 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
copy_v3_v3(q3, q2);
}
}
- else if(sd[1] < 0) {
- if(sd[2] > 0) {
+ else if (sd[1] < 0) {
+ if (sd[2] > 0) {
// +-+
copy_v3_v3(q0, v0);
vec_add_dir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
vec_add_dir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
copy_v3_v3(q3, v2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// +--
copy_v3_v3(q0, v0);
vec_add_dir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
@@ -2707,14 +2732,14 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
}
}
else {
- if(sd[2] > 0) {
+ if (sd[2] > 0) {
// +0+
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// +0-
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
@@ -2730,16 +2755,16 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
}
}
}
- else if(sd[0] < 0) {
- if(sd[1] > 0) {
- if(sd[2] > 0) {
+ else if (sd[0] < 0) {
+ if (sd[1] > 0) {
+ if (sd[2] > 0) {
// -++
vec_add_dir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
vec_add_dir(q3, v0, v2, (sd[0]/(sd[0]-sd[2])));
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// -+-
vec_add_dir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
copy_v3_v3(q1, v1);
@@ -2754,15 +2779,15 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
copy_v3_v3(q3, q2);
}
}
- else if(sd[1] < 0) {
- if(sd[2] > 0) {
+ else if (sd[1] < 0) {
+ if (sd[2] > 0) {
// --+
vec_add_dir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
vec_add_dir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// ---
return 0;
}
@@ -2772,14 +2797,14 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
}
}
else {
- if(sd[2] > 0) {
+ if (sd[2] > 0) {
// -0+
vec_add_dir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// -0-
return 0;
}
@@ -2790,15 +2815,15 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
}
}
else {
- if(sd[1] > 0) {
- if(sd[2] > 0) {
+ if (sd[1] > 0) {
+ if (sd[2] > 0) {
// 0++
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// 0+-
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
@@ -2813,15 +2838,15 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
copy_v3_v3(q3, q2);
}
}
- else if(sd[1] < 0) {
- if(sd[2] > 0) {
+ else if (sd[1] < 0) {
+ if (sd[2] > 0) {
// 0-+
copy_v3_v3(q0, v0);
vec_add_dir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// 0--
return 0;
}
@@ -2831,14 +2856,14 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
}
}
else {
- if(sd[2] > 0) {
+ if (sd[2] > 0) {
// 00+
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// 00-
return 0;
}
@@ -2993,7 +3018,7 @@ static void ff_normalize(float n[3])
d= dot_v3v3(n, n);
- if(d > 1.0e-35F) {
+ if (d > 1.0e-35F) {
d= 1.0f/sqrtf(d);
n[0] *= d;
@@ -3044,24 +3069,35 @@ float form_factor_hemi_poly(float p[3], float n[3], float v1[3], float v2[3], fl
* covered by a quad or triangle, cosine weighted */
float q0[3], q1[3], q2[3], q3[3], contrib= 0.0f;
- if(ff_visible_quad(p, n, v1, v2, v3, q0, q1, q2, q3))
+ if (ff_visible_quad(p, n, v1, v2, v3, q0, q1, q2, q3))
contrib += ff_quad_form_factor(p, n, q0, q1, q2, q3);
- if(v4 && ff_visible_quad(p, n, v1, v3, v4, q0, q1, q2, q3))
+ if (v4 && ff_visible_quad(p, n, v1, v3, v4, q0, q1, q2, q3))
contrib += ff_quad_form_factor(p, n, q0, q1, q2, q3);
return contrib;
}
/* evaluate if entire quad is a proper convex quad */
- int is_quad_convex_v3(const float *v1, const float *v2, const float *v3, const float *v4)
+ int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
{
float nor[3], nor1[3], nor2[3], vec[4][2];
int axis_a, axis_b;
-
+
/* define projection, do both trias apart, quad is undefined! */
+
normal_tri_v3(nor1, v1, v2, v3);
normal_tri_v3(nor2, v1, v3, v4);
+
+ /* when the face is folded over as 2 tris we probably don't want to create
+ * a quad from it, but go ahead with the intersection test since this
+ * isn't a function for degenerate faces */
+ if (UNLIKELY(dot_v3v3(nor1, nor2) < 0.0f)) {
+ /* flip so adding normals in the opposite direction
+ * doesnt give a zero length vector */
+ negate_v3(nor2);
+ }
+
add_v3_v3v3(nor, nor1, nor2);
axis_dominant_v3(&axis_a, &axis_b, nor);
@@ -3071,7 +3107,7 @@ float form_factor_hemi_poly(float p[3], float n[3], float v1[3], float v2[3], fl
vec[2][0]= v3[axis_a]; vec[2][1]= v3[axis_b];
vec[3][0]= v4[axis_a]; vec[3][1]= v4[axis_b];
-
+
/* linetests, the 2 diagonals have to instersect to be convex */
- return (isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0) ? 1 : 0;
+ return (isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0) ? TRUE : FALSE;
}
diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c
index 9031d52cf4c..634e68d0ccf 100644
--- a/source/blender/blenlib/intern/math_geom_inline.c
+++ b/source/blender/blenlib/intern/math_geom_inline.c
@@ -49,7 +49,7 @@ MINLINE void mul_sh_fl(float r[9], const float f)
{
int i;
- for(i=0; i<9; i++)
+ for (i=0; i<9; i++)
r[i] *= f;
}
@@ -57,7 +57,7 @@ MINLINE void add_sh_shsh(float r[9], const float a[9], const float b[9])
{
int i;
- for(i=0; i<9; i++)
+ for (i=0; i<9; i++)
r[i]= a[i] + b[i];
}
@@ -66,7 +66,7 @@ MINLINE float dot_shsh(float a[9], float b[9])
float r= 0.0f;
int i;
- for(i=0; i<9; i++)
+ for (i=0; i<9; i++)
r += a[i]*b[i];
return r;
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index b777b394005..fd49012491e 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -117,7 +117,7 @@ void swap_m3m3(float m1[][3], float m2[][3])
float t;
int i, j;
- for(i = 0; i < 3; i++) {
+ for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
t = m1[i][j];
m1[i][j] = m2[i][j];
@@ -131,7 +131,7 @@ void swap_m4m4(float m1[][4], float m2[][4])
float t;
int i, j;
- for(i = 0; i < 4; i++) {
+ for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
t = m1[i][j];
m1[i][j] = m2[i][j];
@@ -251,20 +251,20 @@ void mul_serie_m3(float answ[][3],
{
float temp[3][3];
- if(m1==NULL || m2==NULL) return;
+ if (m1==NULL || m2==NULL) return;
mul_m3_m3m3(answ, m2, m1);
- if(m3) {
+ if (m3) {
mul_m3_m3m3(temp, m3, answ);
- if(m4) {
+ if (m4) {
mul_m3_m3m3(answ, m4, temp);
- if(m5) {
+ if (m5) {
mul_m3_m3m3(temp, m5, answ);
- if(m6) {
+ if (m6) {
mul_m3_m3m3(answ, m6, temp);
- if(m7) {
+ if (m7) {
mul_m3_m3m3(temp, m7, answ);
- if(m8) {
+ if (m8) {
mul_m3_m3m3(answ, m8, temp);
}
else copy_m3_m3(answ, temp);
@@ -284,20 +284,20 @@ void mul_serie_m4(float answ[][4], float m1[][4],
{
float temp[4][4];
- if(m1==NULL || m2==NULL) return;
+ if (m1==NULL || m2==NULL) return;
mult_m4_m4m4(answ, m1, m2);
- if(m3) {
+ if (m3) {
mult_m4_m4m4(temp, answ, m3);
- if(m4) {
+ if (m4) {
mult_m4_m4m4(answ, temp, m4);
- if(m5) {
+ if (m5) {
mult_m4_m4m4(temp, answ, m5);
- if(m6) {
+ if (m6) {
mult_m4_m4m4(answ, temp, m6);
- if(m7) {
+ if (m7) {
mult_m4_m4m4(temp, answ, m7);
- if(m8) {
+ if (m8) {
mult_m4_m4m4(answ, temp, m8);
}
else copy_m4_m4(answ, temp);
@@ -422,8 +422,8 @@ void mul_m3_fl(float m[3][3], float f)
{
int i, j;
- for(i=0;i<3;i++)
- for(j=0;j<3;j++)
+ for (i=0;i<3;i++)
+ for (j=0;j<3;j++)
m[i][j] *= f;
}
@@ -431,8 +431,8 @@ void mul_m4_fl(float m[4][4], float f)
{
int i, j;
- for(i=0;i<4;i++)
- for(j=0;j<4;j++)
+ for (i=0;i<4;i++)
+ for (j=0;j<4;j++)
m[i][j] *= f;
}
@@ -440,8 +440,8 @@ void mul_mat3_m4_fl(float m[4][4], float f)
{
int i, j;
- for(i=0; i<3; i++)
- for(j=0; j<3; j++)
+ for (i=0; i<3; i++)
+ for (j=0; j<3; j++)
m[i][j] *= f;
}
@@ -460,8 +460,8 @@ void add_m3_m3m3(float m1[][3], float m2[][3], float m3[][3])
{
int i, j;
- for(i=0;i<3;i++)
- for(j=0;j<3;j++)
+ for (i=0;i<3;i++)
+ for (j=0;j<3;j++)
m1[i][j]= m2[i][j] + m3[i][j];
}
@@ -469,8 +469,8 @@ void add_m4_m4m4(float m1[][4], float m2[][4], float m3[][4])
{
int i, j;
- for(i=0;i<4;i++)
- for(j=0;j<4;j++)
+ for (i=0;i<4;i++)
+ for (j=0;j<4;j++)
m1[i][j]= m2[i][j] + m3[i][j];
}
@@ -478,8 +478,8 @@ void sub_m3_m3m3(float m1[][3], float m2[][3], float m3[][3])
{
int i, j;
- for(i=0;i<3;i++)
- for(j=0;j<3;j++)
+ for (i=0;i<3;i++)
+ for (j=0;j<3;j++)
m1[i][j]= m2[i][j] - m3[i][j];
}
@@ -487,8 +487,8 @@ void sub_m4_m4m4(float m1[][4], float m2[][4], float m3[][4])
{
int i, j;
- for(i=0;i<4;i++)
- for(j=0;j<4;j++)
+ for (i=0;i<4;i++)
+ for (j=0;j<4;j++)
m1[i][j]= m2[i][j] - m3[i][j];
}
@@ -518,10 +518,10 @@ int invert_m3_m3(float m1[3][3], float m2[3][3])
success= (det != 0);
- if(det==0) det=1;
+ if (det==0) det=1;
det= 1/det;
- for(a=0;a<3;a++) {
- for(b=0;b<3;b++) {
+ for (a=0;a<3;a++) {
+ for (b=0;b<3;b++) {
m1[a][b]*=det;
}
}
@@ -565,23 +565,23 @@ int invert_m4_m4(float inverse[4][4], float mat[4][4])
inverse[i][i] = 1;
/* Copy original matrix so we don't mess it up */
- for(i = 0; i < 4; i++)
- for(j = 0; j <4; j++)
+ for (i = 0; i < 4; i++)
+ for (j = 0; j <4; j++)
tempmat[i][j] = mat[i][j];
- for(i = 0; i < 4; i++) {
+ for (i = 0; i < 4; i++) {
/* Look for row with max pivot */
max = fabs(tempmat[i][i]);
maxj = i;
- for(j = i + 1; j < 4; j++) {
- if(fabsf(tempmat[j][i]) > max) {
+ for (j = i + 1; j < 4; j++) {
+ if (fabsf(tempmat[j][i]) > max) {
max = fabs(tempmat[j][i]);
maxj = j;
}
}
/* Swap rows if necessary */
if (maxj != i) {
- for(k = 0; k < 4; k++) {
+ for (k = 0; k < 4; k++) {
SWAP(float, tempmat[i][k], tempmat[maxj][k]);
SWAP(float, inverse[i][k], inverse[maxj][k]);
}
@@ -590,14 +590,14 @@ int invert_m4_m4(float inverse[4][4], float mat[4][4])
temp = tempmat[i][i];
if (temp == 0)
return 0; /* No non-zero pivot */
- for(k = 0; k < 4; k++) {
+ for (k = 0; k < 4; k++) {
tempmat[i][k] = (float)(tempmat[i][k]/temp);
inverse[i][k] = (float)(inverse[i][k]/temp);
}
- for(j = 0; j < 4; j++) {
- if(j != i) {
+ for (j = 0; j < 4; j++) {
+ if (j != i) {
temp = tempmat[j][i];
- for(k = 0; k < 4; k++) {
+ for (k = 0; k < 4; k++) {
tempmat[j][k] -= (float)(tempmat[i][k]*temp);
inverse[j][k] -= (float)(inverse[i][k]*temp);
}
@@ -662,11 +662,13 @@ void orthogonalize_m3(float mat[][3], int axis)
cross_v3_v3v3(mat[2], mat[0], mat[1]);
normalize_v3(mat[2]);
cross_v3_v3v3(mat[1], mat[2], mat[0]);
- } else if (dot_v3v3(mat[0], mat[2]) < 1) {
+ }
+ else if (dot_v3v3(mat[0], mat[2]) < 1) {
cross_v3_v3v3(mat[1], mat[2], mat[0]);
normalize_v3(mat[1]);
cross_v3_v3v3(mat[2], mat[0], mat[1]);
- } else {
+ }
+ else {
float vec[3];
vec[0]= mat[0][1];
@@ -682,11 +684,13 @@ void orthogonalize_m3(float mat[][3], int axis)
cross_v3_v3v3(mat[2], mat[0], mat[1]);
normalize_v3(mat[2]);
cross_v3_v3v3(mat[0], mat[1], mat[2]);
- } else if (dot_v3v3(mat[0], mat[2]) < 1) {
+ }
+ else if (dot_v3v3(mat[0], mat[2]) < 1) {
cross_v3_v3v3(mat[0], mat[1], mat[2]);
normalize_v3(mat[0]);
cross_v3_v3v3(mat[2], mat[0], mat[1]);
- } else {
+ }
+ else {
float vec[3];
vec[0]= mat[1][1];
@@ -702,11 +706,13 @@ void orthogonalize_m3(float mat[][3], int axis)
cross_v3_v3v3(mat[1], mat[2], mat[0]);
normalize_v3(mat[1]);
cross_v3_v3v3(mat[0], mat[1], mat[2]);
- } else if (dot_v3v3(mat[2], mat[1]) < 1) {
+ }
+ else if (dot_v3v3(mat[2], mat[1]) < 1) {
cross_v3_v3v3(mat[0], mat[1], mat[2]);
normalize_v3(mat[0]);
cross_v3_v3v3(mat[1], mat[2], mat[0]);
- } else {
+ }
+ else {
float vec[3];
vec[0]= mat[2][1];
@@ -735,11 +741,13 @@ void orthogonalize_m4(float mat[][4], int axis)
cross_v3_v3v3(mat[2], mat[0], mat[1]);
normalize_v3(mat[2]);
cross_v3_v3v3(mat[1], mat[2], mat[0]);
- } else if (dot_v3v3(mat[0], mat[2]) < 1) {
+ }
+ else if (dot_v3v3(mat[0], mat[2]) < 1) {
cross_v3_v3v3(mat[1], mat[2], mat[0]);
normalize_v3(mat[1]);
cross_v3_v3v3(mat[2], mat[0], mat[1]);
- } else {
+ }
+ else {
float vec[3];
vec[0]= mat[0][1];
@@ -756,11 +764,13 @@ void orthogonalize_m4(float mat[][4], int axis)
cross_v3_v3v3(mat[2], mat[0], mat[1]);
normalize_v3(mat[2]);
cross_v3_v3v3(mat[0], mat[1], mat[2]);
- } else if (dot_v3v3(mat[0], mat[2]) < 1) {
+ }
+ else if (dot_v3v3(mat[0], mat[2]) < 1) {
cross_v3_v3v3(mat[0], mat[1], mat[2]);
normalize_v3(mat[0]);
cross_v3_v3v3(mat[2], mat[0], mat[1]);
- } else {
+ }
+ else {
float vec[3];
vec[0]= mat[1][1];
@@ -776,11 +786,13 @@ void orthogonalize_m4(float mat[][4], int axis)
cross_v3_v3v3(mat[1], mat[2], mat[0]);
normalize_v3(mat[1]);
cross_v3_v3v3(mat[0], mat[1], mat[2]);
- } else if (dot_v3v3(mat[2], mat[1]) < 1) {
+ }
+ else if (dot_v3v3(mat[2], mat[1]) < 1) {
cross_v3_v3v3(mat[0], mat[1], mat[2]);
normalize_v3(mat[0]);
cross_v3_v3v3(mat[1], mat[2], mat[0]);
- } else {
+ }
+ else {
float vec[3];
vec[0]= mat[2][1];
@@ -799,36 +811,36 @@ void orthogonalize_m4(float mat[][4], int axis)
int is_orthogonal_m3(float m[][3])
{
- int i, j;
+ int i, j;
- for (i = 0; i < 3; i++) {
- for (j = 0; j < i; j++) {
- if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON)
- return 0;
- }
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < i; j++) {
+ if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON)
+ return 0;
+ }
- if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
- return 0;
- }
+ if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
+ return 0;
+ }
- return 1;
+ return 1;
}
int is_orthogonal_m4(float m[][4])
{
- int i, j;
+ int i, j;
- for (i = 0; i < 4; i++) {
- for (j = 0; j < i; j++) {
- if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON)
- return 0;
- }
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < i; j++) {
+ if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON)
+ return 0;
+ }
- if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON)
- return 0;
- }
+ if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON)
+ return 0;
+ }
- return 1;
+ return 1;
}
void normalize_m3(float mat[][3])
@@ -851,11 +863,11 @@ void normalize_m4(float mat[][4])
float len;
len= normalize_v3(mat[0]);
- if(len!=0.0f) mat[0][3]/= len;
+ if (len!=0.0f) mat[0][3]/= len;
len= normalize_v3(mat[1]);
- if(len!=0.0f) mat[1][3]/= len;
+ if (len!=0.0f) mat[1][3]/= len;
len= normalize_v3(mat[2]);
- if(len!=0.0f) mat[2][3]/= len;
+ if (len!=0.0f) mat[2][3]/= len;
}
void normalize_m4_m4(float rmat[][4], float mat[][4])
@@ -863,11 +875,11 @@ void normalize_m4_m4(float rmat[][4], float mat[][4])
float len;
len= normalize_v3_v3(rmat[0], mat[0]);
- if(len!=0.0f) rmat[0][3]= mat[0][3] / len;
+ if (len!=0.0f) rmat[0][3]= mat[0][3] / len;
len= normalize_v3_v3(rmat[1], mat[1]);
- if(len!=0.0f) rmat[1][3]= mat[1][3] / len;
+ if (len!=0.0f) rmat[1][3]= mat[1][3] / len;
len= normalize_v3_v3(rmat[2], mat[2]);
- if(len!=0.0f) rmat[2][3]= mat[2][3] / len;
+ if (len!=0.0f) rmat[2][3]= mat[2][3] / len;
}
void adjoint_m3_m3(float m1[][3], float m[][3])
@@ -1052,7 +1064,7 @@ void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3])
/* so scale doesnt interfear with rotation [#24291] */
/* note: this is a workaround for negative matrix not working for rotation conversion, FIXME */
normalize_m3_m3(mat3_n, mat3);
- if(is_negative_m3(mat3)) {
+ if (is_negative_m3(mat3)) {
negate_v3(mat3_n[0]);
negate_v3(mat3_n[1]);
negate_v3(mat3_n[2]);
@@ -1120,27 +1132,27 @@ void rotate_m4(float mat[][4], const char axis, const float angle)
sine = (float)sin(angle);
switch (axis) {
case 'X':
- for(col=0 ; col<4 ; col++)
+ for (col=0 ; col<4 ; col++)
temp[col] = cosine*mat[1][col] + sine*mat[2][col];
- for(col=0 ; col<4 ; col++) {
+ for (col=0 ; col<4 ; col++) {
mat[2][col] = - sine*mat[1][col] + cosine*mat[2][col];
mat[1][col] = temp[col];
}
break;
case 'Y':
- for(col=0 ; col<4 ; col++)
+ for (col=0 ; col<4 ; col++)
temp[col] = cosine*mat[0][col] - sine*mat[2][col];
- for(col=0 ; col<4 ; col++) {
+ for (col=0 ; col<4 ; col++) {
mat[2][col] = sine*mat[0][col] + cosine*mat[2][col];
mat[0][col] = temp[col];
}
break;
case 'Z':
- for(col=0 ; col<4 ; col++)
+ for (col=0 ; col<4 ; col++)
temp[col] = cosine*mat[0][col] + sine*mat[1][col];
- for(col=0 ; col<4 ; col++) {
+ for (col=0 ; col<4 ; col++) {
mat[1][col] = - sine*mat[0][col] + cosine*mat[1][col];
mat[0][col] = temp[col];
}
@@ -1485,7 +1497,8 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
for (i = 0; i < k-1; i++) {
U[i][k] = 0.0f;
}
- } else {
+ }
+ else {
for (i = 0; i < m; i++) {
U[i][k] = 0.0f;
}
@@ -1523,7 +1536,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
int kase=0;
// Test for maximum iterations to avoid infinite loop
- if(maxiter == 0)
+ if (maxiter == 0)
break;
maxiter--;
@@ -1548,7 +1561,8 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
}
if (k == p-2) {
kase = 4;
- } else {
+ }
+ else {
int ks;
for (ks = p-1; ks >= k; ks--) {
float t;
@@ -1564,9 +1578,11 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
}
if (ks == k) {
kase = 3;
- } else if (ks == p-1) {
+ }
+ else if (ks == p-1) {
kase = 1;
- } else {
+ }
+ else {
kase = 2;
k = ks;
}
@@ -1753,7 +1769,7 @@ void pseudoinverse_m4_m4(float Ainv[4][4], float A[4][4], float epsilon)
transpose_m4(V);
zero_m4(Wm);
- for(i=0; i<4; i++)
+ for (i=0; i<4; i++)
Wm[i][i]= (W[i] < epsilon)? 0.0f: 1.0f/W[i];
transpose_m4(V);
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 4e85d033cf7..5ae226bf6d5 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -198,7 +198,7 @@ void quat_to_mat3(float m[][3], const float q[4])
{
#ifdef DEBUG
float f;
- if(!((f=dot_qtqt(q, q))==0.0f || (fabsf(f-1.0f) < (float)QUAT_EPSILON))) {
+ if (!((f=dot_qtqt(q, q))==0.0f || (fabsf(f-1.0f) < (float)QUAT_EPSILON))) {
fprintf(stderr, "Warning! quat_to_mat3() called with non-normalized: size %.8f *** report a bug ***\n", f);
}
#endif
@@ -211,7 +211,7 @@ void quat_to_mat4(float m[][4], const float q[4])
double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc;
#ifdef DEBUG
- if(!((q0=dot_qtqt(q, q))==0.0f || (fabsf(q0-1.0) < QUAT_EPSILON))) {
+ if (!((q0=dot_qtqt(q, q))==0.0f || (fabsf(q0-1.0) < QUAT_EPSILON))) {
fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0);
}
#endif
@@ -261,7 +261,7 @@ void mat3_to_quat(float *q, float wmat[][3])
tr= 0.25* (double)(1.0f+mat[0][0]+mat[1][1]+mat[2][2]);
- if(tr>(double)FLT_EPSILON) {
+ if (tr>(double)FLT_EPSILON) {
s= sqrt(tr);
q[0]= (float)s;
s= 1.0/(4.0*s);
@@ -270,7 +270,7 @@ void mat3_to_quat(float *q, float wmat[][3])
q[3]= (float)((mat[0][1]-mat[1][0])*s);
}
else {
- if(mat[0][0] > mat[1][1] && mat[0][0] > mat[2][2]) {
+ if (mat[0][0] > mat[1][1] && mat[0][0] > mat[2][2]) {
s= 2.0f*sqrtf(1.0f + mat[0][0] - mat[1][1] - mat[2][2]);
q[1]= (float)(0.25*s);
@@ -279,7 +279,7 @@ void mat3_to_quat(float *q, float wmat[][3])
q[2]= (float)((double)(mat[1][0] + mat[0][1])*s);
q[3]= (float)((double)(mat[2][0] + mat[0][2])*s);
}
- else if(mat[1][1] > mat[2][2]) {
+ else if (mat[1][1] > mat[2][2]) {
s= 2.0f*sqrtf(1.0f + mat[1][1] - mat[0][0] - mat[2][2]);
q[2]= (float)(0.25*s);
@@ -359,7 +359,7 @@ float normalize_qt(float *q)
float len;
len= (float)sqrt(dot_qtqt(q, q));
- if(len!=0.0f) {
+ if (len!=0.0f) {
mul_qt_fl(q, 1.0f/len);
}
else {
@@ -399,7 +399,7 @@ void rotation_between_quats_to_quat(float *q, const float q1[4], const float q2[
conjugate_qt(tquat);
dot = 1.0f / dot_qtqt(tquat, tquat);
- for(x = 0; x < 4; x++)
+ for (x = 0; x < 4; x++)
tquat[x] *= dot;
mul_qt_qtqt(q, tquat, q2);
@@ -414,7 +414,7 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
assert(upflag >= 0 && upflag <= 2);
/* first rotate to axis */
- if(axis>2) {
+ if (axis>2) {
x2= vec[0] ; y2= vec[1] ; z2= vec[2];
axis-= 3;
}
@@ -426,28 +426,28 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
q[1]=q[2]=q[3]= 0.0;
len1= (float)sqrt(x2*x2+y2*y2+z2*z2);
- if(len1 == 0.0f) return;
+ if (len1 == 0.0f) return;
/* nasty! I need a good routine for this...
* problem is a rotation of an Y axis to the negative Y-axis for example.
*/
- if(axis==0) { /* x-axis */
+ if (axis==0) { /* x-axis */
nor[0]= 0.0;
nor[1]= -z2;
nor[2]= y2;
- if(fabs(y2)+fabs(z2)<0.0001)
+ if (fabs(y2)+fabs(z2)<0.0001)
nor[1]= 1.0;
co= x2;
}
- else if(axis==1) { /* y-axis */
+ else if (axis==1) { /* y-axis */
nor[0]= z2;
nor[1]= 0.0;
nor[2]= -x2;
- if(fabs(x2)+fabs(z2)<0.0001)
+ if (fabs(x2)+fabs(z2)<0.0001)
nor[2]= 1.0;
co= y2;
@@ -457,7 +457,7 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
nor[1]= x2;
nor[2]= 0.0;
- if(fabs(x2)+fabs(y2)<0.0001)
+ if (fabs(x2)+fabs(y2)<0.0001)
nor[0]= 1.0;
co= z2;
@@ -473,20 +473,20 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
q[2]= nor[1]*si;
q[3]= nor[2]*si;
- if(axis!=upflag) {
+ if (axis!=upflag) {
quat_to_mat3(mat,q);
fp= mat[2];
- if(axis==0) {
- if(upflag==1) angle= (float)(0.5*atan2(fp[2], fp[1]));
+ if (axis==0) {
+ if (upflag==1) angle= (float)(0.5*atan2(fp[2], fp[1]));
else angle= (float)(-0.5*atan2(fp[1], fp[2]));
}
- else if(axis==1) {
- if(upflag==0) angle= (float)(-0.5*atan2(fp[2], fp[0]));
+ else if (axis==1) {
+ if (upflag==0) angle= (float)(-0.5*atan2(fp[2], fp[0]));
else angle= (float)(0.5*atan2(fp[0], fp[2]));
}
else {
- if(upflag==0) angle= (float)(0.5*atan2(-fp[1], -fp[0]));
+ if (upflag==0) angle= (float)(0.5*atan2(-fp[1], -fp[0]));
else angle= (float)(-0.5*atan2(-fp[0], -fp[1]));
}
@@ -570,7 +570,8 @@ void interp_qt_qtqt(float result[4], const float quat1[4], const float quat2[4],
sinom = (float)sin(omega);
sc1 = (float)sin((1 - t) * omega) / sinom;
sc2 = (float)sin(t * omega) / sinom;
- } else {
+ }
+ else {
sc1= 1.0f - t;
sc2= t;
}
@@ -602,7 +603,7 @@ void tri_to_quat(float quat[4], const float v1[3], const float v2[3], const floa
n[2]= 0.0f;
normalize_v3(n);
- if(n[0]==0.0f && n[1]==0.0f) n[0]= 1.0f;
+ if (n[0]==0.0f && n[1]==0.0f) n[0]= 1.0f;
angle= -0.5f*(float)saacos(vec[2]);
co= (float)cos(angle);
@@ -646,7 +647,7 @@ void axis_angle_to_quat(float q[4], const float axis[3], float angle)
float nor[3];
float si;
- if(normalize_v3_v3(nor, axis) == 0.0f) {
+ if (normalize_v3_v3(nor, axis) == 0.0f) {
unit_qt(q);
return;
}
@@ -665,7 +666,7 @@ void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
float ha, si;
#ifdef DEBUG
- if(!((ha=dot_qtqt(q, q))==0.0f || (fabsf(ha-1.0f) < (float)QUAT_EPSILON))) {
+ if (!((ha=dot_qtqt(q, q))==0.0f || (fabsf(ha-1.0f) < (float)QUAT_EPSILON))) {
fprintf(stderr, "Warning! quat_to_axis_angle() called with non-normalized: size %.8f *** report a bug ***\n", ha);
}
#endif
@@ -712,7 +713,7 @@ void axis_angle_to_mat3(float mat[3][3], const float axis[3], const float angle)
float nor[3], nsi[3], co, si, ico;
/* normalize the axis first (to remove unwanted scaling) */
- if(normalize_v3_v3(nor, axis) == 0.0f) {
+ if (normalize_v3_v3(nor, axis) == 0.0f) {
unit_m3(mat);
return;
}
@@ -864,7 +865,7 @@ void vec_rot_to_quat(float *quat, const float vec[3], const float phi)
quat[2]= vec[1];
quat[3]= vec[2];
- if(normalize_v3(quat+1) == 0.0f) {
+ if (normalize_v3(quat+1) == 0.0f) {
unit_qt(quat);
}
else {
@@ -960,7 +961,8 @@ static void mat3_to_eul2(float tmat[][3], float eul1[3], float eul2[3])
eul2[1] = (float)atan2(-mat[0][2], -cy);
eul2[2] = (float)atan2(-mat[0][1], -mat[0][0]);
- } else {
+ }
+ else {
eul1[0] = (float)atan2(-mat[2][1], mat[1][1]);
eul1[1] = (float)atan2(-mat[0][2], cy);
eul1[2] = 0.0f;
@@ -977,7 +979,7 @@ void mat3_to_eul(float *eul,float tmat[][3])
mat3_to_eul2(tmat, eul1, eul2);
/* return best, which is just the one with lowest values it in */
- if(fabs(eul1[0])+fabs(eul1[1])+fabs(eul1[2]) > fabs(eul2[0])+fabs(eul2[1])+fabs(eul2[2])) {
+ if (fabs(eul1[0])+fabs(eul1[1])+fabs(eul1[2]) > fabs(eul2[0])+fabs(eul2[1])+fabs(eul2[2])) {
copy_v3_v3(eul, eul2);
}
else {
@@ -1028,8 +1030,8 @@ void rotate_eul(float *beul, const char axis, const float ang)
assert(axis >= 'X' && axis <= 'Z');
eul[0]= eul[1]= eul[2]= 0.0f;
- if(axis=='X') eul[0]= ang;
- else if(axis=='Y') eul[1]= ang;
+ if (axis=='X') eul[0]= ang;
+ else if (axis=='Y') eul[1]= ang;
else eul[2]= ang;
eul_to_mat3(mat1,eul);
@@ -1052,28 +1054,28 @@ void compatible_eul(float eul[3], const float oldrot[3])
dy= eul[1] - oldrot[1];
dz= eul[2] - oldrot[2];
- while(fabs(dx) > 5.1) {
- if(dx > 0.0f) eul[0] -= 2.0f*(float)M_PI; else eul[0]+= 2.0f*(float)M_PI;
+ while (fabs(dx) > 5.1) {
+ if (dx > 0.0f) eul[0] -= 2.0f*(float)M_PI; else eul[0]+= 2.0f*(float)M_PI;
dx= eul[0] - oldrot[0];
}
- while(fabs(dy) > 5.1) {
- if(dy > 0.0f) eul[1] -= 2.0f*(float)M_PI; else eul[1]+= 2.0f*(float)M_PI;
+ while (fabs(dy) > 5.1) {
+ if (dy > 0.0f) eul[1] -= 2.0f*(float)M_PI; else eul[1]+= 2.0f*(float)M_PI;
dy= eul[1] - oldrot[1];
}
- while(fabs(dz) > 5.1) {
- if(dz > 0.0f) eul[2] -= 2.0f*(float)M_PI; else eul[2]+= 2.0f*(float)M_PI;
+ while (fabs(dz) > 5.1) {
+ if (dz > 0.0f) eul[2] -= 2.0f*(float)M_PI; else eul[2]+= 2.0f*(float)M_PI;
dz= eul[2] - oldrot[2];
}
/* is 1 of the axis rotations larger than 180 degrees and the other small? NO ELSE IF!! */
- if(fabs(dx) > 3.2 && fabs(dy)<1.6 && fabs(dz)<1.6) {
- if(dx > 0.0f) eul[0] -= 2.0f*(float)M_PI; else eul[0]+= 2.0f*(float)M_PI;
+ if (fabs(dx) > 3.2 && fabs(dy)<1.6 && fabs(dz)<1.6) {
+ if (dx > 0.0f) eul[0] -= 2.0f*(float)M_PI; else eul[0]+= 2.0f*(float)M_PI;
}
- if(fabs(dy) > 3.2 && fabs(dz)<1.6 && fabs(dx)<1.6) {
- if(dy > 0.0f) eul[1] -= 2.0f*(float)M_PI; else eul[1]+= 2.0f*(float)M_PI;
+ if (fabs(dy) > 3.2 && fabs(dz)<1.6 && fabs(dx)<1.6) {
+ if (dy > 0.0f) eul[1] -= 2.0f*(float)M_PI; else eul[1]+= 2.0f*(float)M_PI;
}
- if(fabs(dz) > 3.2 && fabs(dx)<1.6 && fabs(dy)<1.6) {
- if(dz > 0.0f) eul[2] -= 2.0f*(float)M_PI; else eul[2]+= 2.0f*(float)M_PI;
+ if (fabs(dz) > 3.2 && fabs(dx)<1.6 && fabs(dy)<1.6) {
+ if (dz > 0.0f) eul[2] -= 2.0f*(float)M_PI; else eul[2]+= 2.0f*(float)M_PI;
}
/* the method below was there from ancient days... but why! probably because the code sucks :)
@@ -1086,21 +1088,21 @@ void compatible_eul(float eul[3], const float oldrot[3])
/* special case, tested for x-z */
- if((fabs(dx) > 3.1 && fabs(dz) > 1.5) || (fabs(dx) > 1.5 && fabs(dz) > 3.1)) {
- if(dx > 0.0) eul[0] -= M_PI; else eul[0]+= M_PI;
- if(eul[1] > 0.0) eul[1]= M_PI - eul[1]; else eul[1]= -M_PI - eul[1];
- if(dz > 0.0) eul[2] -= M_PI; else eul[2]+= M_PI;
+ if ((fabs(dx) > 3.1 && fabs(dz) > 1.5) || (fabs(dx) > 1.5 && fabs(dz) > 3.1)) {
+ if (dx > 0.0) eul[0] -= M_PI; else eul[0]+= M_PI;
+ if (eul[1] > 0.0) eul[1]= M_PI - eul[1]; else eul[1]= -M_PI - eul[1];
+ if (dz > 0.0) eul[2] -= M_PI; else eul[2]+= M_PI;
}
- else if((fabs(dx) > 3.1 && fabs(dy) > 1.5) || (fabs(dx) > 1.5 && fabs(dy) > 3.1)) {
- if(dx > 0.0) eul[0] -= M_PI; else eul[0]+= M_PI;
- if(dy > 0.0) eul[1] -= M_PI; else eul[1]+= M_PI;
- if(eul[2] > 0.0) eul[2]= M_PI - eul[2]; else eul[2]= -M_PI - eul[2];
+ else if ((fabs(dx) > 3.1 && fabs(dy) > 1.5) || (fabs(dx) > 1.5 && fabs(dy) > 3.1)) {
+ if (dx > 0.0) eul[0] -= M_PI; else eul[0]+= M_PI;
+ if (dy > 0.0) eul[1] -= M_PI; else eul[1]+= M_PI;
+ if (eul[2] > 0.0) eul[2]= M_PI - eul[2]; else eul[2]= -M_PI - eul[2];
}
- else if((fabs(dy) > 3.1 && fabs(dz) > 1.5) || (fabs(dy) > 1.5 && fabs(dz) > 3.1)) {
- if(eul[0] > 0.0) eul[0]= M_PI - eul[0]; else eul[0]= -M_PI - eul[0];
- if(dy > 0.0) eul[1] -= M_PI; else eul[1]+= M_PI;
- if(dz > 0.0) eul[2] -= M_PI; else eul[2]+= M_PI;
+ else if ((fabs(dy) > 3.1 && fabs(dz) > 1.5) || (fabs(dy) > 1.5 && fabs(dz) > 3.1)) {
+ if (eul[0] > 0.0) eul[0]= M_PI - eul[0]; else eul[0]= -M_PI - eul[0];
+ if (dy > 0.0) eul[1] -= M_PI; else eul[1]+= M_PI;
+ if (dz > 0.0) eul[2] -= M_PI; else eul[2]+= M_PI;
}
#endif
}
@@ -1121,7 +1123,7 @@ void mat3_to_compatible_eul(float eul[3], const float oldrot[3], float mat[][3])
d2= (float)fabs(eul2[0]-oldrot[0]) + (float)fabs(eul2[1]-oldrot[1]) + (float)fabs(eul2[2]-oldrot[2]);
/* return best, which is just the one with lowest difference */
- if(d1 > d2) {
+ if (d1 > d2) {
copy_v3_v3(eul, eul2);
}
else {
@@ -1292,7 +1294,7 @@ void mat3_to_eulO(float eul[3], const short order,float M[3][3])
mat3_to_eulo2(M, eul1, eul2, order);
/* return best, which is just the one with lowest values it in */
- if(fabs(eul1[0])+fabs(eul1[1])+fabs(eul1[2]) > fabs(eul2[0])+fabs(eul2[1])+fabs(eul2[2])) {
+ if (fabs(eul1[0])+fabs(eul1[1])+fabs(eul1[2]) > fabs(eul2[0])+fabs(eul2[1])+fabs(eul2[2])) {
copy_v3_v3(eul, eul2);
}
else {
@@ -1439,7 +1441,7 @@ void mat4_to_dquat(DualQuat *dq,float basemat[][4], float mat[][4])
copy_v3_v3(dscale, scale);
dscale[0] -= 1.0f; dscale[1] -= 1.0f; dscale[2] -= 1.0f;
- if((determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4f) {
+ if ((determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4f) {
/* extract R and S */
float tmp[4][4];
@@ -1488,7 +1490,7 @@ void dquat_to_mat4(float mat[][4], DualQuat *dq)
/* normalize */
len= (float)sqrt(dot_qtqt(q0, q0));
- if(len != 0.0f)
+ if (len != 0.0f)
mul_qt_fl(q0, 1.0f/len);
/* rotation */
@@ -1528,7 +1530,7 @@ void add_weighted_dq_dq(DualQuat *dqsum, DualQuat *dq, float weight)
if (dq->scale_weight) {
float wmat[4][4];
- if(flipped) /* we don't want negative weights for scaling */
+ if (flipped) /* we don't want negative weights for scaling */
weight= -weight;
copy_m4_m4(wmat, dq->scale);
@@ -1545,10 +1547,10 @@ void normalize_dq(DualQuat *dq, float totweight)
mul_qt_fl(dq->quat, scale);
mul_qt_fl(dq->trans, scale);
- if(dq->scale_weight) {
+ if (dq->scale_weight) {
float addweight= totweight - dq->scale_weight;
- if(addweight) {
+ if (addweight) {
dq->scale[0][0] += addweight;
dq->scale[1][1] += addweight;
dq->scale[2][2] += addweight;
@@ -1580,7 +1582,7 @@ void mul_v3m3_dq(float *co, float mat[][3],DualQuat *dq)
M[2][2]= w*w + z*z - x*x - y*y;
len2= dot_qtqt(dq->quat, dq->quat);
- if(len2 > 0.0f)
+ if (len2 > 0.0f)
len2= 1.0f/len2;
/* translation */
@@ -1589,7 +1591,7 @@ void mul_v3m3_dq(float *co, float mat[][3],DualQuat *dq)
t[2]= 2*(-t0*z + x*t2 + w*t3 - t1*y);
/* apply scaling */
- if(dq->scale_weight)
+ if (dq->scale_weight)
mul_m4_v3(dq->scale, co);
/* apply rotation and translation */
@@ -1599,8 +1601,8 @@ void mul_v3m3_dq(float *co, float mat[][3],DualQuat *dq)
co[2]= (co[2] + t[2])*len2;
/* compute crazyspace correction mat */
- if(mat) {
- if(dq->scale_weight) {
+ if (mat) {
+ if (dq->scale_weight) {
copy_m3_m4(scalemat, dq->scale);
mul_m3_m3m3(mat, M, scalemat);
}
@@ -1631,13 +1633,13 @@ void quat_apply_track(float quat[4], short axis, short upflag)
mul_qt_qtqt(quat, quat, quat_track[axis]);
- if(axis>2)
+ if (axis>2)
axis= axis-3;
/* there are 2 possible up-axis for each axis used, the 'quat_track' applies so the first
* up axis is used X->Y, Y->X, Z->X, if this first up axis isn used then rotate 90d
* the strange bit shift below just find the low axis {X:Y, Y:X, Z:X} */
- if(upflag != (2-axis)>>1) {
+ if (upflag != (2-axis)>>1) {
float q[4]= {0.70710676908493, 0.0, 0.0, 0.0}; /* assign 90d rotation axis */
q[axis+1] = ((axis==1)) ? 0.70710676908493 : -0.70710676908493; /* flip non Y axis */
mul_qt_qtqt(quat, quat, q);
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 01ba62bc741..63094d9cfd0 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -174,6 +174,12 @@ float angle_v2v2(const float v1[2], const float v2[2])
return angle_normalized_v2v2(vec1, vec2);
}
+float angle_signed_v2v2(const float v1[2], const float v2[2])
+{
+ const float perp_dot = (v1[1] * v2[0]) - (v1[0] * v2[1]);
+ return atan2f(perp_dot, dot_v2v2(v1, v2));
+}
+
float angle_normalized_v3v3(const float v1[3], const float v2[3])
{
/* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
@@ -384,13 +390,13 @@ void print_v4(const char *str, const float v[4])
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
{
- if(min[0]>vec[0]) min[0]= vec[0];
- if(min[1]>vec[1]) min[1]= vec[1];
- if(min[2]>vec[2]) min[2]= vec[2];
+ if (min[0]>vec[0]) min[0]= vec[0];
+ if (min[1]>vec[1]) min[1]= vec[1];
+ if (min[2]>vec[2]) min[2]= vec[2];
- if(max[0]<vec[0]) max[0]= vec[0];
- if(max[1]<vec[1]) max[1]= vec[1];
- if(max[2]<vec[2]) max[2]= vec[2];
+ if (max[0]<vec[0]) max[0]= vec[0];
+ if (max[1]<vec[1]) max[1]= vec[1];
+ if (max[2]<vec[2]) max[2]= vec[2];
}
@@ -402,7 +408,7 @@ double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int s
const float *array_pt_a= array_src_a + (size-1);
const float *array_pt_b= array_src_b + (size-1);
int i= size;
- while(i--) { d += *(array_pt_a--) * *(array_pt_b--); }
+ while (i--) { d += *(array_pt_a--) * *(array_pt_b--); }
return d;
}
@@ -431,14 +437,14 @@ void range_vn_i(int *array_tar, const int size, const int start)
int *array_pt= array_tar + (size-1);
int j= start + (size-1);
int i= size;
- while(i--) { *(array_pt--) = j--; }
+ while (i--) { *(array_pt--) = j--; }
}
void range_vn_fl(float *array_tar, const int size, const float start, const float step)
{
float *array_pt= array_tar + (size-1);
int i= size;
- while(i--) {
+ while (i--) {
*(array_pt--) = start + step * (float)(i);
}
}
@@ -447,7 +453,7 @@ void negate_vn(float *array_tar, const int size)
{
float *array_pt= array_tar + (size-1);
int i= size;
- while(i--) { *(array_pt--) *= -1.0f; }
+ while (i--) { *(array_pt--) *= -1.0f; }
}
void negate_vn_vn(float *array_tar, const float *array_src, const int size)
@@ -455,14 +461,14 @@ void negate_vn_vn(float *array_tar, const float *array_src, const int size)
float *tar= array_tar + (size-1);
const float *src= array_src + (size-1);
int i= size;
- while(i--) { *(tar--) = - *(src--); }
+ while (i--) { *(tar--) = - *(src--); }
}
void mul_vn_fl(float *array_tar, const int size, const float f)
{
float *array_pt= array_tar + (size-1);
int i= size;
- while(i--) { *(array_pt--) *= f; }
+ while (i--) { *(array_pt--) *= f; }
}
void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f)
@@ -470,7 +476,7 @@ void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, cons
float *tar= array_tar + (size-1);
const float *src= array_src + (size-1);
int i= size;
- while(i--) { *(tar--) = *(src--) * f; }
+ while (i--) { *(tar--) = *(src--) * f; }
}
void add_vn_vn(float *array_tar, const float *array_src, const int size)
@@ -478,7 +484,7 @@ void add_vn_vn(float *array_tar, const float *array_src, const int size)
float *tar= array_tar + (size-1);
const float *src= array_src + (size-1);
int i= size;
- while(i--) { *(tar--) += *(src--); }
+ while (i--) { *(tar--) += *(src--); }
}
void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size)
@@ -487,7 +493,7 @@ void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_
const float *src_a= array_src_a + (size-1);
const float *src_b= array_src_b + (size-1);
int i= size;
- while(i--) { *(tar--) = *(src_a--) + *(src_b--); }
+ while (i--) { *(tar--) = *(src_a--) + *(src_b--); }
}
void sub_vn_vn(float *array_tar, const float *array_src, const int size)
@@ -495,7 +501,7 @@ void sub_vn_vn(float *array_tar, const float *array_src, const int size)
float *tar= array_tar + (size-1);
const float *src= array_src + (size-1);
int i= size;
- while(i--) { *(tar--) -= *(src--); }
+ while (i--) { *(tar--) -= *(src--); }
}
void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size)
@@ -504,19 +510,19 @@ void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_
const float *src_a= array_src_a + (size-1);
const float *src_b= array_src_b + (size-1);
int i= size;
- while(i--) { *(tar--) = *(src_a--) - *(src_b--); }
+ while (i--) { *(tar--) = *(src_a--) - *(src_b--); }
}
void fill_vn_i(int *array_tar, const int size, const int val)
{
int *tar= array_tar + (size-1);
int i= size;
- while(i--) { *(tar--) = val; }
+ while (i--) { *(tar--) = val; }
}
void fill_vn_fl(float *array_tar, const int size, const float val)
{
float *tar= array_tar + (size-1);
int i= size;
- while(i--) { *(tar--) = val; }
+ while (i--) { *(tar--) = val; }
}
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 6414245fb3e..9c26c1ee79a 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -547,10 +547,11 @@ MINLINE float normalize_v2_v2(float r[2], const float a[2])
{
float d= dot_v2v2(a, a);
- if(d > 1.0e-35f) {
+ if (d > 1.0e-35f) {
d= sqrtf(d);
mul_v2_v2fl(r, a, 1.0f/d);
- } else {
+ }
+ else {
zero_v2(r);
d= 0.0f;
}
@@ -569,7 +570,7 @@ MINLINE float normalize_v3_v3(float r[3], const float a[3])
/* a larger value causes normalize errors in a
* scaled down models with camera xtreme close */
- if(d > 1.0e-35f) {
+ if (d > 1.0e-35f) {
d= sqrtf(d);
mul_v3_v3fl(r, a, 1.0f/d);
}
@@ -587,7 +588,7 @@ MINLINE double normalize_v3_d(double n[3])
/* a larger value causes normalize errors in a
* scaled down models with camera xtreme close */
- if(d > 1.0e-35) {
+ if (d > 1.0e-35) {
double mul;
d= sqrt(d);
@@ -596,7 +597,8 @@ MINLINE double normalize_v3_d(double n[3])
n[0] *= mul;
n[1] *= mul;
n[2] *= mul;
- } else {
+ }
+ else {
n[0] = n[1] = n[2] = 0;
d= 0.0;
}
@@ -625,6 +627,12 @@ MINLINE void normal_float_to_short_v3(short out[3], const float in[3])
/********************************* Comparison ********************************/
+
+MINLINE int is_zero_v2(const float v[3])
+{
+ return (v[0] == 0 && v[1] == 0);
+}
+
MINLINE int is_zero_v3(const float v[3])
{
return (v[0] == 0 && v[1] == 0 && v[2] == 0);
@@ -657,9 +665,9 @@ MINLINE int equals_v4v4(const float v1[4], const float v2[4])
MINLINE int compare_v3v3(const float v1[3], const float v2[3], const float limit)
{
- if(fabsf(v1[0]-v2[0])<limit)
- if(fabsf(v1[1]-v2[1])<limit)
- if(fabsf(v1[2]-v2[2])<limit)
+ if (fabsf(v1[0]-v2[0])<limit)
+ if (fabsf(v1[1]-v2[1])<limit)
+ if (fabsf(v1[2]-v2[2])<limit)
return 1;
return 0;
@@ -678,10 +686,10 @@ MINLINE int compare_len_v3v3(const float v1[3], const float v2[3], const float l
MINLINE int compare_v4v4(const float v1[4], const float v2[4], const float limit)
{
- if(fabsf(v1[0]-v2[0])<limit)
- if(fabsf(v1[1]-v2[1])<limit)
- if(fabsf(v1[2]-v2[2])<limit)
- if(fabsf(v1[3]-v2[3])<limit)
+ if (fabsf(v1[0]-v2[0])<limit)
+ if (fabsf(v1[1]-v2[1])<limit)
+ if (fabsf(v1[2]-v2[2])<limit)
+ if (fabsf(v1[3]-v2[3])<limit)
return 1;
return 0;
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index ddf165662fc..93c1a696f03 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -332,7 +332,7 @@ static float orgBlenderNoise(float x, float y, float z)
h=hashvectf+ 3*hash[b21+b11];
n+= i*(h[0]*jx+h[1]*jy+h[2]*jz);
- if(n<0.0f) n=0.0f; else if(n>1.0f) n=1.0f;
+ if (n<0.0f) n=0.0f; else if (n>1.0f) n=1.0f;
return n;
}
@@ -345,7 +345,7 @@ static float orgBlenderNoiseS(float x, float y, float z)
/* separated from orgBlenderNoise above, with scaling */
float BLI_hnoise(float noisesize, float x, float y, float z)
{
- if(noisesize==0.0f) return 0.0f;
+ if (noisesize==0.0f) return 0.0f;
x= (1.0f+x)/noisesize;
y= (1.0f+y)/noisesize;
z= (1.0f+z)/noisesize;
@@ -360,7 +360,7 @@ float BLI_turbulence(float noisesize, float x, float y, float z, int nr)
s= BLI_hnoise(noisesize, x, y, z);
- while(nr>0) {
+ while (nr>0) {
s+= d*BLI_hnoise(noisesize*d, x, y, z);
div+= d;
@@ -377,7 +377,7 @@ float BLI_turbulence1(float noisesize, float x, float y, float z, int nr)
s= fabsf( (-1.0f+2.0f*BLI_hnoise(noisesize, x, y, z)));
- while(nr>0) {
+ while (nr>0) {
s+= fabsf(d* (-1.0f+2.0f*BLI_hnoise(noisesize*d, x, y, z)));
div+= d;
@@ -1771,7 +1771,7 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity
result = signal;
- for( i=1; i<(int)octaves; i++ ) {
+ for ( i=1; i<(int)octaves; i++ ) {
x *= lacunarity;
y *= lacunarity;
z *= lacunarity;
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index a512ac746f9..2bbc4517da1 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -62,6 +62,7 @@
#endif
#ifdef WIN32
+#include "utf_winfunc.h"
# include <io.h>
# ifdef _WIN32_IE
# undef _WIN32_IE
@@ -110,18 +111,18 @@ int BLI_stringdec(const char *string, char *head, char *tail, unsigned short *nu
short i, found = 0;
char *lslash = BLI_last_slash(string);
len2 = len = strlen(string);
- if(lslash)
+ if (lslash)
lenlslash= (int)(lslash - string);
- while(len > lenlslash && string[--len] != '.') {};
- if(len == lenlslash && string[len] != '.') len = len2;
+ while (len > lenlslash && string[--len] != '.') {};
+ if (len == lenlslash && string[len] != '.') len = len2;
for (i = len - 1; i >= lenlslash; i--) {
if (isdigit(string[i])) {
if (found) {
nums = i;
}
- else{
+ else {
nume = i;
nums = i;
found = 1;
@@ -153,7 +154,7 @@ int BLI_stringdec(const char *string, char *head, char *tail, unsigned short *nu
void BLI_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic)
{
char fmtstr[16]="";
- if(pic < 0) pic= 0;
+ if (pic < 0) pic= 0;
sprintf(fmtstr, "%%s%%.%dd%%s", numlen);
sprintf(string, fmtstr, head, pic, tail);
}
@@ -168,23 +169,23 @@ int BLI_split_name_num(char *left, int *nr, const char *name, const char delim)
a= strlen(name);
memcpy(left, name, (a + 1) * sizeof(char));
- if(a>1 && name[a-1]==delim) return a;
+ if (a>1 && name[a-1]==delim) return a;
- while(a--) {
- if( name[a]==delim ) {
+ while (a--) {
+ if ( name[a]==delim ) {
left[a]= 0;
*nr= atol(name+a+1);
/* casting down to an int, can overflow for large numbers */
- if(*nr < 0)
+ if (*nr < 0)
*nr= 0;
return a;
}
- if( isdigit(name[a])==0 ) break;
+ if ( isdigit(name[a])==0 ) break;
left[a]= 0;
}
- for(a= 0; name[a]; a++)
+ for (a= 0; name[a]; a++)
left[a]= name[a];
return a;
@@ -216,11 +217,11 @@ void BLI_newname(char *name, int add)
int BLI_uniquename_cb(int (*unique_check)(void *, const char *), void *arg, const char defname[], char delim, char *name, short name_len)
{
- if(name[0] == '\0') {
+ if (name[0] == '\0') {
BLI_strncpy(name, defname, name_len);
}
- if(unique_check(arg, name)) {
+ if (unique_check(arg, name)) {
char numstr[16];
char tempname[UNIQUE_NAME_MAX];
char left[UNIQUE_NAME_MAX];
@@ -241,7 +242,7 @@ int BLI_uniquename_cb(int (*unique_check)(void *, const char *), void *arg, cons
tempname_buf = BLI_strncat_utf8(tempname, left, name_len - numlen);
memcpy(tempname_buf, numstr, numlen + 1);
}
- } while(unique_check(arg, tempname));
+ } while (unique_check(arg, tempname));
BLI_strncpy(name, tempname, name_len);
@@ -321,7 +322,8 @@ void BLI_cleanup_path(const char *relabase, char *dir)
char *start, *eind;
if (relabase) {
BLI_path_abs(dir, relabase);
- } else {
+ }
+ else {
if (dir[0]=='/' && dir[1]=='/') {
if (dir[2]== '\0') {
return; /* path is "//" - cant clean it */
@@ -331,7 +333,7 @@ void BLI_cleanup_path(const char *relabase, char *dir)
}
/* Note
- * memmove( start, eind, strlen(eind)+1 );
+ * memmove(start, eind, strlen(eind) + 1);
* is the same as
* strcpy( start, eind );
* except strcpy should not be used because there is overlap,
@@ -342,7 +344,7 @@ void BLI_cleanup_path(const char *relabase, char *dir)
/* Note, this should really be moved to the file selector,
* since this function is used in many areas */
- if(strcmp(dir, ".")==0) { /* happens for example in FILE_MAIN */
+ if (strcmp(dir, ".")==0) { /* happens for example in FILE_MAIN */
get_default_root(dir);
return;
}
@@ -356,22 +358,23 @@ void BLI_cleanup_path(const char *relabase, char *dir)
}
if (a<0) {
break;
- } else {
- memmove( dir+a, eind, strlen(eind)+1 );
+ }
+ else {
+ memmove(dir + a, eind, strlen(eind) + 1);
}
}
while ( (start = strstr(dir,"\\.\\")) ) {
eind = start + strlen("\\.\\") - 1;
- memmove( start, eind, strlen(eind)+1 );
+ memmove(start, eind, strlen(eind) + 1);
}
while ( (start = strstr(dir,"\\\\" )) ) {
eind = start + strlen("\\\\") - 1;
- memmove( start, eind, strlen(eind)+1 );
+ memmove(start, eind, strlen(eind) + 1);
}
#else
- if(dir[0]=='.') { /* happens, for example in FILE_MAIN */
+ if (dir[0]=='.') { /* happens, for example in FILE_MAIN */
dir[0]= '/';
dir[1]= 0;
return;
@@ -380,8 +383,8 @@ void BLI_cleanup_path(const char *relabase, char *dir)
/* support for odd paths: eg /../home/me --> /home/me
* this is a valid path in blender but we cant handle this the usual way below
* simply strip this prefix then evaluate the path as usual. pythons os.path.normpath() does this */
- while((strncmp(dir, "/../", 4)==0)) {
- memmove( dir, dir + 4, strlen(dir + 4) + 1 );
+ while ((strncmp(dir, "/../", 4)==0)) {
+ memmove(dir, dir + 4, strlen(dir + 4) + 1);
}
while ( (start = strstr(dir, "/../")) ) {
@@ -393,19 +396,20 @@ void BLI_cleanup_path(const char *relabase, char *dir)
}
if (a<0) {
break;
- } else {
- memmove( dir+a, eind, strlen(eind)+1 );
+ }
+ else {
+ memmove(dir+a, eind, strlen(eind) + 1);
}
}
while ( (start = strstr(dir,"/./")) ) {
eind = start + (3 - 1) /* strlen("/./") - 1 */;
- memmove( start, eind, strlen(eind)+1 );
+ memmove(start, eind, strlen(eind) + 1);
}
while ( (start = strstr(dir,"//" )) ) {
eind = start + (2 - 1) /* strlen("//") - 1 */;
- memmove( start, eind, strlen(eind)+1 );
+ memmove(start, eind, strlen(eind) + 1);
}
#endif
}
@@ -430,7 +434,7 @@ void BLI_path_rel(char *file, const char *relfile)
char res[FILE_MAX];
/* if file is already relative, bail out */
- if(file[0]=='/' && file[1]=='/') return;
+ if (file[0]=='/' && file[1]=='/') return;
/* also bail out if relative path is not set */
if (relfile[0] == 0) return;
@@ -446,7 +450,8 @@ void BLI_path_rel(char *file, const char *relfile)
ptemp++;
}
BLI_strncpy(ptemp, relfile, FILE_MAX-3);
- } else {
+ }
+ else {
BLI_strncpy(temp, relfile, FILE_MAX);
}
@@ -481,7 +486,7 @@ void BLI_path_rel(char *file, const char *relfile)
#endif
{
++p; ++q;
- /* dont search beyond the end of the string
+ /* don't search beyond the end of the string
* in the rare case they match */
if ((*p=='\0') || (*q=='\0')) {
break;
@@ -547,7 +552,8 @@ int BLI_parent_dir(char *path)
if (!BLI_testextensie(tmp, parent_dir)) {
BLI_strncpy(path, tmp, sizeof(tmp));
return 1;
- } else {
+ }
+ else {
return 0;
}
}
@@ -559,8 +565,9 @@ static int stringframe_chars(char *path, int *char_start, int *char_end)
ch_sta = ch_end = 0;
for (i = 0; path[i] != '\0'; i++) {
if (path[i] == '\\' || path[i] == '/') {
- ch_end = 0; /* this is a directory name, dont use any hashes we found */
- } else if (path[i] == '#') {
+ ch_end = 0; /* this is a directory name, don't use any hashes we found */
+ }
+ else if (path[i] == '#') {
ch_sta = i;
ch_end = ch_sta+1;
while (path[ch_end] == '#') {
@@ -568,11 +575,11 @@ static int stringframe_chars(char *path, int *char_start, int *char_end)
}
i = ch_end-1; /* keep searching */
- /* dont break, there may be a slash after this that invalidates the previous #'s */
+ /* don't break, there may be a slash after this that invalidates the previous #'s */
}
}
- if(ch_end) {
+ if (ch_end) {
*char_start= ch_sta;
*char_end= ch_end;
return 1;
@@ -588,13 +595,13 @@ static void ensure_digits(char *path, int digits)
{
char *file= BLI_last_slash(path);
- if(file==NULL)
+ if (file==NULL)
file= path;
- if(strrchr(file, '#') == NULL) {
+ if (strrchr(file, '#') == NULL) {
int len= strlen(file);
- while(digits--) {
+ while (digits--) {
file[len++]= '#';
}
file[len]= '\0';
@@ -605,7 +612,7 @@ int BLI_path_frame(char *path, int frame, int digits)
{
int ch_sta, ch_end;
- if(digits)
+ if (digits)
ensure_digits(path, digits);
if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */
@@ -621,7 +628,7 @@ int BLI_path_frame_range(char *path, int sta, int end, int digits)
{
int ch_sta, ch_end;
- if(digits)
+ if (digits)
ensure_digits(path, digits);
if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */
@@ -680,7 +687,7 @@ int BLI_path_abs(char *path, const char *basepath)
BLI_strncpy(base, basepath, sizeof(base));
- /* file component is ignored, so dont bother with the trailing slash */
+ /* file component is ignored, so don't bother with the trailing slash */
BLI_cleanup_path(NULL, base);
/* push slashes into unix mode - strings entering this part are
@@ -693,7 +700,7 @@ int BLI_path_abs(char *path, const char *basepath)
BLI_char_switch(base, '\\', '/');
/* Paths starting with // will get the blend file as their base,
- * this isnt standard in any os but is used in blender all over the place */
+ * this isn't standard in any os but is used in blender all over the place */
if (wasrelative) {
char *lslash= BLI_last_slash(base);
if (lslash) {
@@ -704,10 +711,12 @@ int BLI_path_abs(char *path, const char *basepath)
memcpy(tmp, base, baselen);
BLI_strncpy(tmp+baselen, path, sizeof(tmp)-baselen);
BLI_strncpy(path, tmp, FILE_MAX);
- } else {
+ }
+ else {
BLI_strncpy(path, tmp+2, FILE_MAX);
}
- } else {
+ }
+ else {
BLI_strncpy(path, tmp, FILE_MAX);
}
@@ -746,16 +755,17 @@ int BLI_path_cwd(char *path)
if (wasrelative==1) {
char cwd[FILE_MAX]= "";
- BLI_current_working_dir(cwd, sizeof(cwd)); /* in case the full path to the blend isnt used */
+ BLI_current_working_dir(cwd, sizeof(cwd)); /* in case the full path to the blend isn't used */
if (cwd[0] == '\0') {
printf( "Could not get the current working directory - $PWD for an unknown reason.");
- } else {
+ }
+ else {
/* uses the blend path relative to cwd important for loading relative linked files.
*
* cwd should contain c:\ etc on win32 so the relbase can be NULL
* relbase being NULL also prevents // being misunderstood as relative to the current
- * blend file which isnt a feature we want to use in this case since were dealing
+ * blend file which isn't a feature we want to use in this case since were dealing
* with a path from the command line, rather than from inside Blender */
char origpath[FILE_MAX];
@@ -777,7 +787,8 @@ void BLI_splitdirstring(char *di, char *fi)
if (lslash) {
BLI_strncpy(fi, lslash+1, FILE_MAXFILE);
*(lslash+1)=0;
- } else {
+ }
+ else {
BLI_strncpy(fi, di, FILE_MAXFILE);
di[0]= 0;
}
@@ -797,7 +808,8 @@ void BLI_getlastdir(const char* dir, char *last, const size_t maxlen)
}
if (prevslash) {
BLI_strncpy(last, prevslash+1, maxlen);
- } else {
+ }
+ else {
BLI_strncpy(last, dir, maxlen);
}
}
@@ -824,10 +836,8 @@ const char *BLI_getDefaultDocumentFolder(void)
HRESULT hResult;
/* Check for %HOME% env var */
-
- ret = getenv("HOME");
- if(ret) {
- if (BLI_is_dir(ret)) return ret;
+ if (uput_getenv("HOME",documentfolder,MAXPATHLEN)) {
+ if (BLI_is_dir(documentfolder)) return documentfolder;
}
/* add user profile support for WIN 2K / NT.
@@ -862,11 +872,11 @@ static int test_path(char *targetpath, const char *path_base, const char *path_s
{
char tmppath[FILE_MAX];
- if(path_sep) BLI_join_dirfile(tmppath, sizeof(tmppath), path_base, path_sep);
+ if (path_sep) BLI_join_dirfile(tmppath, sizeof(tmppath), path_base, path_sep);
else BLI_strncpy(tmppath, path_base, sizeof(tmppath));
/* rare cases folder_name is omitted (when looking for ~/.blender/2.xx dir only) */
- if(folder_name)
+ if (folder_name)
BLI_make_file_string("/", targetpath, tmppath, folder_name);
else
BLI_strncpy(targetpath, tmppath, sizeof(tmppath));
@@ -894,7 +904,8 @@ static int test_env_path(char *path, const char *envvar)
if (BLI_is_dir(env)) {
BLI_strncpy(path, env, FILE_MAX);
return 1;
- } else {
+ }
+ else {
path[0] = '\0';
return 0;
}
@@ -908,10 +919,11 @@ static int get_path_local(char *targetpath, const char *folder_name, const char
printf("get_path_local...\n");
#endif
- if(folder_name) {
+ if (folder_name) {
if (subfolder_name) {
BLI_join_dirfile(relfolder, sizeof(relfolder), folder_name, subfolder_name);
- } else {
+ }
+ else {
BLI_strncpy(relfolder, folder_name, sizeof(relfolder));
}
}
@@ -920,7 +932,7 @@ static int get_path_local(char *targetpath, const char *folder_name, const char
}
/* try EXECUTABLE_DIR/2.5x/folder_name - new default directory for local blender installed files */
- if(test_path(targetpath, bprogdir, blender_version_decimal(ver), relfolder))
+ if (test_path(targetpath, bprogdir, blender_version_decimal(ver), relfolder))
return 1;
return 0;
@@ -949,7 +961,8 @@ static int get_path_user(char *targetpath, const char *folder_name, const char *
if (test_env_path(user_path, envvar)) {
if (subfolder_name) {
return test_path(targetpath, user_path, NULL, subfolder_name);
- } else {
+ }
+ else {
BLI_strncpy(targetpath, user_path, FILE_MAX);
return 1;
}
@@ -960,7 +973,7 @@ static int get_path_user(char *targetpath, const char *folder_name, const char *
BLI_snprintf(user_path, FILE_MAX, BLENDER_USER_FORMAT, user_base_path, blender_version_decimal(ver));
}
- if(!user_path[0])
+ if (!user_path[0])
return 0;
#ifdef PATH_DEBUG2
@@ -970,7 +983,8 @@ static int get_path_user(char *targetpath, const char *folder_name, const char *
if (subfolder_name) {
/* try $HOME/folder_name/subfolder_name */
return test_path(targetpath, user_path, folder_name, subfolder_name);
- } else {
+ }
+ else {
/* try $HOME/folder_name */
return test_path(targetpath, user_path, NULL, folder_name);
}
@@ -987,10 +1001,11 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
char cwd[FILE_MAX];
char relfolder[FILE_MAX];
- if(folder_name) {
+ if (folder_name) {
if (subfolder_name) {
BLI_join_dirfile(relfolder, sizeof(relfolder), folder_name, subfolder_name);
- } else {
+ }
+ else {
BLI_strncpy(relfolder, folder_name, sizeof(relfolder));
}
}
@@ -999,14 +1014,14 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
}
/* try CWD/release/folder_name */
- if(BLI_current_working_dir(cwd, sizeof(cwd))) {
- if(test_path(targetpath, cwd, "release", relfolder)) {
+ if (BLI_current_working_dir(cwd, sizeof(cwd))) {
+ if (test_path(targetpath, cwd, "release", relfolder)) {
return 1;
}
}
/* try EXECUTABLE_DIR/release/folder_name */
- if(test_path(targetpath, bprogdir, "release", relfolder))
+ if (test_path(targetpath, bprogdir, "release", relfolder))
return 1;
/* end developer overrides */
@@ -1017,7 +1032,8 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
if (test_env_path(system_path, envvar)) {
if (subfolder_name) {
return test_path(targetpath, system_path, NULL, subfolder_name);
- } else {
+ }
+ else {
BLI_strncpy(targetpath, system_path, FILE_MAX);
return 1;
}
@@ -1028,7 +1044,7 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
BLI_snprintf(system_path, FILE_MAX, BLENDER_SYSTEM_FORMAT, system_base_path, blender_version_decimal(ver));
}
- if(!system_path[0])
+ if (!system_path[0])
return 0;
#ifdef PATH_DEBUG2
@@ -1038,7 +1054,8 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
if (subfolder_name) {
/* try $BLENDERPATH/folder_name/subfolder_name */
return test_path(targetpath, system_path, folder_name, subfolder_name);
- } else {
+ }
+ else {
/* try $BLENDERPATH/folder_name */
return test_path(targetpath, system_path, NULL, folder_name);
}
@@ -1156,7 +1173,7 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check)
BLI_assert(!"incorrect ID");
}
- if((ok == FALSE) && do_check) {
+ if ((ok == FALSE) && do_check) {
return NULL;
}
@@ -1185,7 +1202,9 @@ void BLI_setenv(const char *env, const char*val)
/* non-free windows */
#elif (defined(WIN32) || defined(WIN64)) /* not free windows */
- _putenv_s(env, val);
+ uputenv(env, val);
+
+
#else
/* linux/osx/bsd */
setenv(env, val, 1);
@@ -1199,17 +1218,17 @@ void BLI_setenv(const char *env, const char*val)
*/
void BLI_setenv_if_new(const char *env, const char* val)
{
- if(getenv(env) == NULL)
+ if (getenv(env) == NULL)
BLI_setenv(env, val);
}
void BLI_clean(char *path)
{
- if(path==NULL) return;
+ if (path==NULL) return;
#ifdef WIN32
- if(path && BLI_strnlen(path, 3) > 2) {
+ if (path && BLI_strnlen(path, 3) > 2) {
BLI_char_switch(path+2, '/', '\\');
}
#else
@@ -1219,7 +1238,7 @@ void BLI_clean(char *path)
void BLI_char_switch(char *string, char from, char to)
{
- if(string==NULL) return;
+ if (string==NULL) return;
while (*string != 0) {
if (*string == from) *string = to;
string++;
@@ -1302,7 +1321,7 @@ void BLI_make_file_string(const char *relabase, char *string, const char *dir,
strcpy(string, relabase);
lslash= BLI_last_slash(string);
- if(lslash) *(lslash+1)= 0;
+ if (lslash) *(lslash+1)= 0;
dir+=2; /* Skip over the relative reference */
}
@@ -1358,11 +1377,13 @@ int BLI_testextensie(const char *str, const char *ext)
a= strlen(str);
b= strlen(ext);
- if(a==0 || b==0 || b>=a) {
+ if (a==0 || b==0 || b>=a) {
retval = 0;
- } else if (BLI_strcasecmp(ext, str + a - b)) {
+ }
+ else if (BLI_strcasecmp(ext, str + a - b)) {
retval = 0;
- } else {
+ }
+ else {
retval = 1;
}
@@ -1372,8 +1393,8 @@ int BLI_testextensie(const char *str, const char *ext)
int BLI_testextensie_array(const char *str, const char **ext_array)
{
int i=0;
- while(ext_array[i]) {
- if(BLI_testextensie(str, ext_array[i])) {
+ while (ext_array[i]) {
+ if (BLI_testextensie(str, ext_array[i])) {
return 1;
}
@@ -1389,11 +1410,11 @@ int BLI_testextensie_glob(const char *str, const char *ext_fnmatch)
const char *ext_step= ext_fnmatch;
char pattern[16];
- while(ext_step[0]) {
+ while (ext_step[0]) {
char *ext_next;
int len_ext;
- if((ext_next=strchr(ext_step, ';'))) {
+ if ((ext_next=strchr(ext_step, ';'))) {
len_ext= (int)(ext_next - ext_step) + 1;
}
else {
@@ -1402,7 +1423,7 @@ int BLI_testextensie_glob(const char *str, const char *ext_fnmatch)
BLI_strncpy(pattern, ext_step, len_ext);
- if(fnmatch(pattern, str, FNM_CASEFOLD)==0) {
+ if (fnmatch(pattern, str, FNM_CASEFOLD)==0) {
return 1;
}
ext_step += len_ext;
@@ -1418,7 +1439,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext)
size_t ext_len= strlen(ext);
ssize_t a;
- for(a= path_len - 1; a >= 0; a--) {
+ for (a= path_len - 1; a >= 0; a--) {
if (ELEM3(path[a], '.', '/', '\\')) {
break;
}
@@ -1428,7 +1449,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext)
a= path_len;
}
- if(a + ext_len >= maxlen)
+ if (a + ext_len >= maxlen)
return 0;
memcpy(path+a, ext, ext_len + 1);
@@ -1449,7 +1470,7 @@ int BLI_ensure_extension(char *path, size_t maxlen, const char *ext)
return 1;
}
- for(a= path_len - 1; a >= 0; a--) {
+ for (a= path_len - 1; a >= 0; a--) {
if (path[a] == '.') {
path[a]= '\0';
}
@@ -1459,7 +1480,7 @@ int BLI_ensure_extension(char *path, size_t maxlen, const char *ext)
}
a++;
- if(a + ext_len >= maxlen)
+ if (a + ext_len >= maxlen)
return 0;
memcpy(path+a, ext, ext_len + 1);
@@ -1479,7 +1500,7 @@ void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t d
if (dir) {
if (lslash) {
- BLI_strncpy( dir, string, MIN2(dirlen, lslash + 1)); /* +1 to include the slash and the last char */
+ BLI_strncpy(dir, string, MIN2(dirlen, lslash + 1)); /* +1 to include the slash and the last char */
}
else {
dir[0] = '\0';
@@ -1507,7 +1528,7 @@ void BLI_join_dirfile(char *dst, const size_t maxlen, const char *dir, const cha
size_t dirlen= BLI_strnlen(dir, maxlen);
if (dst != dir) {
- if(dirlen == maxlen) {
+ if (dirlen == maxlen) {
memcpy(dst, dir, dirlen);
dst[dirlen - 1]= '\0';
return; /* dir fills the path */
@@ -1522,9 +1543,9 @@ void BLI_join_dirfile(char *dst, const size_t maxlen, const char *dir, const cha
}
/* inline BLI_add_slash */
- if (dst[dirlen - 1] != SEP) {
- dst[dirlen++]= SEP;
- dst[dirlen ]= '\0';
+ if ((dirlen > 0) && (dst[dirlen - 1] != SEP)) {
+ dst[dirlen++] = SEP;
+ dst[dirlen ] = '\0';
}
if (dirlen >= maxlen) {
@@ -1671,7 +1692,7 @@ char *BLI_last_slash(const char *string)
else return lfslash;
}
-/* adds a slash if there isnt one there already */
+/* adds a slash if there isn't one there already */
int BLI_add_slash(char *string)
{
int len = strlen(string);
@@ -1691,7 +1712,8 @@ void BLI_del_slash(char *string)
if (string[len-1] == SEP) {
string[len-1] = '\0';
len--;
- } else {
+ }
+ else {
break;
}
}
@@ -1718,7 +1740,8 @@ static int add_win32_extension(char *name)
ext[temp - extensions] = 0;
extensions = temp + 1;
strcat(filename, ext);
- } else {
+ }
+ else {
strcat(filename, extensions);
}
@@ -1731,7 +1754,8 @@ static int add_win32_extension(char *name)
} while (temp);
}
#endif
- } else {
+ }
+ else {
retval = 1;
}
@@ -1773,24 +1797,30 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name
#endif
#ifdef _WIN32
- if(GetModuleFileName(0, fullname, maxlen)) {
- if(!BLI_exists(fullname)) {
+ wchar_t * fullname_16 = MEM_mallocN(maxlen*sizeof(wchar_t), "ProgramPath");
+ if (GetModuleFileNameW(0, fullname_16, maxlen)) {
+ conv_utf_16_to_8(fullname_16,fullname, maxlen);
+ if (!BLI_exists(fullname)) {
printf("path can't be found: \"%.*s\"\n", maxlen, fullname);
MessageBox(NULL, "path contains invalid characters or is too long (see console)", "Error", MB_OK);
}
+ MEM_freeN(fullname_16);
return;
}
+
+ MEM_freeN(fullname_16);
#endif
/* unix and non linux */
if (name && name[0]) {
+
BLI_strncpy(fullname, name, maxlen);
if (name[0] == '.') {
char wdir[FILE_MAX]= "";
BLI_current_working_dir(wdir, sizeof(wdir)); /* backup cwd to restore after */
// not needed but avoids annoying /./ in name
- if(name[1]==SEP)
+ if (name[1]==SEP)
BLI_join_dirfile(fullname, maxlen, wdir, name+2);
else
BLI_join_dirfile(fullname, maxlen, wdir, name);
@@ -1801,7 +1831,8 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name
// full path
BLI_strncpy(fullname, name, maxlen);
add_win32_extension(fullname);
- } else {
+ }
+ else {
// search for binary in $PATH
path = getenv("PATH");
if (path) {
@@ -1811,7 +1842,8 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name
strncpy(filename, path, temp - path);
filename[temp - path] = 0;
path = temp + 1;
- } else {
+ }
+ else {
strncpy(filename, path, sizeof(filename));
}
BLI_join_dirfile(fullname, maxlen, fullname, name);
@@ -1891,11 +1923,12 @@ static void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir
if (fullname[0] == '\0') {
BLI_strncpy(fullname, "/tmp/", maxlen);
- } else {
+ }
+ else {
/* add a trailing slash if needed */
BLI_add_slash(fullname);
#ifdef WIN32
- if(userdir && userdir != fullname) {
+ if (userdir && userdir != fullname) {
BLI_strncpy(userdir, fullname, maxlen); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */
}
#endif
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index dcf03590808..e1b7ff120f9 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -37,6 +37,8 @@
#include "BKE_DerivedMesh.h"
#include "BKE_mesh.h" /* for mesh_calc_normals */
#include "BKE_global.h" /* for mesh_calc_normals */
+#include "BKE_paint.h"
+#include "BKE_subsurf.h"
#include "GPU_buffers.h"
@@ -119,6 +121,8 @@ struct PBVHNode {
};
struct PBVH {
+ PBVHType type;
+
PBVHNode *nodes;
int node_mem_count, totnode;
@@ -139,6 +143,7 @@ struct PBVH {
const DMFlagMat *grid_flag_mats;
int totgrid;
int gridsize;
+ BLI_bitmap *grid_hidden;
/* Only used during BVH build and update,
* don't need to remain valid after */
@@ -181,7 +186,7 @@ static void BB_reset(BB *bb)
static void BB_expand(BB *bb, float co[3])
{
int i;
- for(i = 0; i < 3; ++i) {
+ for (i = 0; i < 3; ++i) {
bb->bmin[i] = MIN2(bb->bmin[i], co[i]);
bb->bmax[i] = MAX2(bb->bmax[i], co[i]);
}
@@ -191,7 +196,7 @@ static void BB_expand(BB *bb, float co[3])
static void BB_expand_with_bb(BB *bb, BB *bb2)
{
int i;
- for(i = 0; i < 3; ++i) {
+ for (i = 0; i < 3; ++i) {
bb->bmin[i] = MIN2(bb->bmin[i], bb2->bmin[i]);
bb->bmax[i] = MAX2(bb->bmax[i], bb2->bmax[i]);
}
@@ -203,17 +208,17 @@ static int BB_widest_axis(BB *bb)
float dim[3];
int i;
- for(i = 0; i < 3; ++i)
+ for (i = 0; i < 3; ++i)
dim[i] = bb->bmax[i] - bb->bmin[i];
- if(dim[0] > dim[1]) {
- if(dim[0] > dim[2])
+ if (dim[0] > dim[1]) {
+ if (dim[0] > dim[2])
return 0;
else
return 2;
}
else {
- if(dim[1] > dim[2])
+ if (dim[1] > dim[2])
return 1;
else
return 2;
@@ -223,7 +228,7 @@ static int BB_widest_axis(BB *bb)
static void BBC_update_centroid(BBC *bbc)
{
int i;
- for(i = 0; i < 3; ++i)
+ for (i = 0; i < 3; ++i)
bbc->bcentroid[i] = (bbc->bmin[i] + bbc->bmax[i]) * 0.5f;
}
@@ -234,7 +239,7 @@ static void update_node_vb(PBVH *bvh, PBVHNode *node)
BB_reset(&vb);
- if(node->flag & PBVH_Leaf) {
+ if (node->flag & PBVH_Leaf) {
PBVHVertexIter vd;
BLI_pbvh_vertex_iter_begin(bvh, node, vd, PBVH_ITER_ALL) {
@@ -280,11 +285,11 @@ static int partition_indices(int *prim_indices, int lo, int hi, int axis,
float mid, BBC *prim_bbc)
{
int i=lo, j=hi;
- for(;;) {
- for(; prim_bbc[prim_indices[i]].bcentroid[axis] < mid; i++);
- for(; mid < prim_bbc[prim_indices[j]].bcentroid[axis]; j--);
+ for (;;) {
+ for (; prim_bbc[prim_indices[i]].bcentroid[axis] < mid; i++);
+ for (; mid < prim_bbc[prim_indices[j]].bcentroid[axis]; j--);
- if(!(i < j))
+ if (!(i < j))
return i;
SWAP(int, prim_indices[i], prim_indices[j]);
@@ -301,22 +306,22 @@ static int partition_indices_material(PBVH *bvh, int lo, int hi)
const void *first;
int i=lo, j=hi;
- if(bvh->faces)
+ if (bvh->faces)
first = &faces[bvh->prim_indices[lo]];
else
first = &flagmats[bvh->prim_indices[lo]];
- for(;;) {
- if(bvh->faces) {
- for(; face_materials_match(first, &faces[indices[i]]); i++);
- for(; !face_materials_match(first, &faces[indices[j]]); j--);
+ for (;;) {
+ if (bvh->faces) {
+ for (; face_materials_match(first, &faces[indices[i]]); i++);
+ for (; !face_materials_match(first, &faces[indices[j]]); j--);
}
else {
- for(; grid_materials_match(first, &flagmats[indices[i]]); i++);
- for(; !grid_materials_match(first, &flagmats[indices[j]]); j--);
+ for (; grid_materials_match(first, &flagmats[indices[i]]); i++);
+ for (; !grid_materials_match(first, &flagmats[indices[j]]); j--);
}
- if(!(i < j))
+ if (!(i < j))
return i;
SWAP(int, bvh->prim_indices[i], bvh->prim_indices[j]);
@@ -326,10 +331,10 @@ static int partition_indices_material(PBVH *bvh, int lo, int hi)
static void grow_nodes(PBVH *bvh, int totnode)
{
- if(totnode > bvh->node_mem_count) {
+ if (totnode > bvh->node_mem_count) {
PBVHNode *prev = bvh->nodes;
bvh->node_mem_count *= 1.33;
- if(bvh->node_mem_count < totnode)
+ if (bvh->node_mem_count < totnode)
bvh->node_mem_count = totnode;
bvh->nodes = MEM_callocN(sizeof(PBVHNode) * bvh->node_mem_count,
"bvh nodes");
@@ -348,8 +353,8 @@ static int map_insert_vert(PBVH *bvh, GHash *map,
{
void *value, *key = SET_INT_IN_POINTER(vertex);
- if(!BLI_ghash_haskey(map, key)) {
- if(BLI_BITMAP_GET(bvh->vert_bitmap, vertex)) {
+ if (!BLI_ghash_haskey(map, key)) {
+ if (BLI_BITMAP_GET(bvh->vert_bitmap, vertex)) {
value = SET_INT_IN_POINTER(~(*face_verts));
++(*face_verts);
}
@@ -381,11 +386,11 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
node->face_vert_indices = MEM_callocN(sizeof(int) * 4*totface,
"bvh node face vert indices");
- for(i = 0; i < totface; ++i) {
+ for (i = 0; i < totface; ++i) {
MFace *f = bvh->faces + node->prim_indices[i];
int sides = f->v4 ? 4 : 3;
- for(j = 0; j < sides; ++j) {
+ for (j = 0; j < sides; ++j) {
node->face_vert_indices[i][j]=
map_insert_vert(bvh, map, &node->face_verts,
&node->uniq_verts, (&f->v1)[j]);
@@ -397,13 +402,13 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
"bvh node vert indices");
/* Build the vertex list, unique verts first */
- for(iter = BLI_ghashIterator_new(map), i = 0;
+ for (iter = BLI_ghashIterator_new(map), i = 0;
!BLI_ghashIterator_isDone(iter);
BLI_ghashIterator_step(iter), ++i) {
void *value = BLI_ghashIterator_getValue(iter);
int ndx = GET_INT_FROM_POINTER(value);
- if(ndx < 0)
+ if (ndx < 0)
ndx = -ndx + node->uniq_verts - 1;
node->vert_indices[ndx] =
@@ -412,22 +417,22 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
BLI_ghashIterator_free(iter);
- for(i = 0; i < totface; ++i) {
+ for (i = 0; i < totface; ++i) {
MFace *f = bvh->faces + node->prim_indices[i];
int sides = f->v4 ? 4 : 3;
- for(j = 0; j < sides; ++j) {
- if(node->face_vert_indices[i][j] < 0)
+ for (j = 0; j < sides; ++j) {
+ if (node->face_vert_indices[i][j] < 0)
node->face_vert_indices[i][j]=
-node->face_vert_indices[i][j] +
node->uniq_verts - 1;
}
}
- if(!G.background) {
+ if (!G.background) {
node->draw_buffers =
GPU_build_mesh_buffers(node->face_vert_indices,
- bvh->faces,
+ bvh->faces, bvh->verts,
node->prim_indices,
node->totprim);
}
@@ -439,9 +444,10 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
static void build_grids_leaf_node(PBVH *bvh, PBVHNode *node)
{
- if(!G.background) {
+ if (!G.background) {
node->draw_buffers =
- GPU_build_grid_buffers(node->totprim, bvh->gridsize);
+ GPU_build_grid_buffers(node->prim_indices,
+ node->totprim, bvh->grid_hidden, bvh->gridsize);
}
node->flag |= PBVH_UpdateDrawBuffers;
}
@@ -452,7 +458,7 @@ static void update_vb(PBVH *bvh, PBVHNode *node, BBC *prim_bbc,
int i;
BB_reset(&node->vb);
- for(i = offset + count - 1; i >= offset; --i) {
+ for (i = offset + count - 1; i >= offset; --i) {
BB_expand_with_bb(&node->vb, (BB*)(&prim_bbc[bvh->prim_indices[i]]));
}
node->orig_vb = node->vb;
@@ -469,7 +475,7 @@ static void build_leaf(PBVH *bvh, int node_index, BBC *prim_bbc,
/* Still need vb for searches */
update_vb(bvh, &bvh->nodes[node_index], prim_bbc, offset, count);
- if(bvh->faces)
+ if (bvh->faces)
build_mesh_leaf_node(bvh, bvh->nodes + node_index);
else
build_grids_leaf_node(bvh, bvh->nodes + node_index);
@@ -481,24 +487,24 @@ int leaf_needs_material_split(PBVH *bvh, int offset, int count)
{
int i, prim;
- if(count <= 1)
+ if (count <= 1)
return 0;
- if(bvh->faces) {
+ if (bvh->faces) {
const MFace *first = &bvh->faces[bvh->prim_indices[offset]];
- for(i = offset + count - 1; i > offset; --i) {
+ for (i = offset + count - 1; i > offset; --i) {
prim = bvh->prim_indices[i];
- if(!face_materials_match(first, &bvh->faces[prim]))
+ if (!face_materials_match(first, &bvh->faces[prim]))
return 1;
}
}
else {
const DMFlagMat *first = &bvh->grid_flag_mats[bvh->prim_indices[offset]];
- for(i = offset + count - 1; i > offset; --i) {
+ for (i = offset + count - 1; i > offset; --i) {
prim = bvh->prim_indices[i];
- if(!grid_materials_match(first, &bvh->grid_flag_mats[prim]))
+ if (!grid_materials_match(first, &bvh->grid_flag_mats[prim]))
return 1;
}
}
@@ -526,8 +532,8 @@ static void build_sub(PBVH *bvh, int node_index, BB *cb, BBC *prim_bbc,
/* Decide whether this is a leaf or not */
below_leaf_limit = count <= bvh->leaf_limit;
- if(below_leaf_limit) {
- if(!leaf_needs_material_split(bvh, offset, count)) {
+ if (below_leaf_limit) {
+ if (!leaf_needs_material_split(bvh, offset, count)) {
build_leaf(bvh, node_index, prim_bbc, offset, count);
return;
}
@@ -540,12 +546,12 @@ static void build_sub(PBVH *bvh, int node_index, BB *cb, BBC *prim_bbc,
/* Update parent node bounding box */
update_vb(bvh, &bvh->nodes[node_index], prim_bbc, offset, count);
- if(!below_leaf_limit) {
+ if (!below_leaf_limit) {
/* Find axis with widest range of primitive centroids */
- if(!cb) {
+ if (!cb) {
cb = &cb_backing;
BB_reset(cb);
- for(i = offset + count - 1; i >= offset; --i)
+ for (i = offset + count - 1; i >= offset; --i)
BB_expand(cb, prim_bbc[bvh->prim_indices[i]].bcentroid);
}
axis = BB_widest_axis(cb);
@@ -573,16 +579,16 @@ static void pbvh_build(PBVH *bvh, BB *cb, BBC *prim_bbc, int totprim)
{
int i;
- if(totprim != bvh->totprim) {
+ if (totprim != bvh->totprim) {
bvh->totprim = totprim;
- if(bvh->nodes) MEM_freeN(bvh->nodes);
- if(bvh->prim_indices) MEM_freeN(bvh->prim_indices);
+ if (bvh->nodes) MEM_freeN(bvh->nodes);
+ if (bvh->prim_indices) MEM_freeN(bvh->prim_indices);
bvh->prim_indices = MEM_callocN(sizeof(int) * totprim,
"bvh prim indices");
- for(i = 0; i < totprim; ++i)
+ for (i = 0; i < totprim; ++i)
bvh->prim_indices[i] = i;
bvh->totnode = 0;
- if(bvh->node_mem_count < 100) {
+ if (bvh->node_mem_count < 100) {
bvh->node_mem_count = 100;
bvh->nodes = MEM_callocN(sizeof(PBVHNode) *
bvh->node_mem_count,
@@ -601,6 +607,7 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
BB cb;
int i, j;
+ bvh->type = PBVH_FACES;
bvh->faces = faces;
bvh->verts = verts;
bvh->vert_bitmap = BLI_BITMAP_NEW(totvert, "bvh->vert_bitmap");
@@ -612,14 +619,14 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
/* For each face, store the AABB and the AABB centroid */
prim_bbc = MEM_mallocN(sizeof(BBC) * totface, "prim_bbc");
- for(i = 0; i < totface; ++i) {
+ for (i = 0; i < totface; ++i) {
MFace *f = faces + i;
const int sides = f->v4 ? 4 : 3;
BBC *bbc = prim_bbc + i;
BB_reset((BB*)bbc);
- for(j = 0; j < sides; ++j)
+ for (j = 0; j < sides; ++j)
BB_expand((BB*)bbc, verts[(&f->v1)[j]].co);
BBC_update_centroid(bbc);
@@ -627,7 +634,7 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
BB_expand(&cb, bbc->bcentroid);
}
- if(totface)
+ if (totface)
pbvh_build(bvh, &cb, prim_bbc, totface);
MEM_freeN(prim_bbc);
@@ -636,18 +643,20 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
/* Do a full rebuild with on Grids data structure */
void BLI_pbvh_build_grids(PBVH *bvh, DMGridData **grids, DMGridAdjacency *gridadj,
- int totgrid, int gridsize, void **gridfaces, DMFlagMat *flagmats)
+ int totgrid, int gridsize, void **gridfaces, DMFlagMat *flagmats, BLI_bitmap *grid_hidden)
{
BBC *prim_bbc = NULL;
BB cb;
int i, j;
+ bvh->type = PBVH_GRIDS;
bvh->grids= grids;
bvh->gridadj= gridadj;
bvh->gridfaces= gridfaces;
bvh->grid_flag_mats= flagmats;
bvh->totgrid= totgrid;
bvh->gridsize= gridsize;
+ bvh->grid_hidden= grid_hidden;
bvh->leaf_limit = MAX2(LEAF_LIMIT/((gridsize-1)*(gridsize-1)), 1);
BB_reset(&cb);
@@ -655,13 +664,13 @@ void BLI_pbvh_build_grids(PBVH *bvh, DMGridData **grids, DMGridAdjacency *gridad
/* For each grid, store the AABB and the AABB centroid */
prim_bbc = MEM_mallocN(sizeof(BBC) * totgrid, "prim_bbc");
- for(i = 0; i < totgrid; ++i) {
+ for (i = 0; i < totgrid; ++i) {
DMGridData *grid= grids[i];
BBC *bbc = prim_bbc + i;
BB_reset((BB*)bbc);
- for(j = 0; j < gridsize*gridsize; ++j)
+ for (j = 0; j < gridsize*gridsize; ++j)
BB_expand((BB*)bbc, grid[j].co);
BBC_update_centroid(bbc);
@@ -669,7 +678,7 @@ void BLI_pbvh_build_grids(PBVH *bvh, DMGridData **grids, DMGridAdjacency *gridad
BB_expand(&cb, bbc->bcentroid);
}
- if(totgrid)
+ if (totgrid)
pbvh_build(bvh, &cb, prim_bbc, totgrid);
MEM_freeN(prim_bbc);
@@ -687,15 +696,15 @@ void BLI_pbvh_free(PBVH *bvh)
PBVHNode *node;
int i;
- for(i = 0; i < bvh->totnode; ++i) {
+ for (i = 0; i < bvh->totnode; ++i) {
node= &bvh->nodes[i];
- if(node->flag & PBVH_Leaf) {
- if(node->draw_buffers)
+ if (node->flag & PBVH_Leaf) {
+ if (node->draw_buffers)
GPU_free_buffers(node->draw_buffers);
- if(node->vert_indices)
+ if (node->vert_indices)
MEM_freeN(node->vert_indices);
- if(node->face_vert_indices)
+ if (node->face_vert_indices)
MEM_freeN(node->face_vert_indices);
}
}
@@ -705,15 +714,15 @@ void BLI_pbvh_free(PBVH *bvh)
/* if pbvh was deformed, new memory was allocated for verts/faces -- free it */
MEM_freeN(bvh->verts);
- if(bvh->faces)
+ if (bvh->faces)
MEM_freeN(bvh->faces);
}
}
- if(bvh->nodes)
+ if (bvh->nodes)
MEM_freeN(bvh->nodes);
- if(bvh->prim_indices)
+ if (bvh->prim_indices)
MEM_freeN(bvh->prim_indices);
MEM_freeN(bvh);
@@ -735,20 +744,20 @@ static void pbvh_iter_begin(PBVHIter *iter, PBVH *bvh, BLI_pbvh_SearchCallback s
static void pbvh_iter_end(PBVHIter *iter)
{
- if(iter->stackspace > STACK_FIXED_DEPTH)
+ if (iter->stackspace > STACK_FIXED_DEPTH)
MEM_freeN(iter->stack);
}
static void pbvh_stack_push(PBVHIter *iter, PBVHNode *node, int revisiting)
{
- if(iter->stacksize == iter->stackspace) {
+ if (iter->stacksize == iter->stackspace) {
PBVHStack *newstack;
iter->stackspace *= 2;
newstack= MEM_callocN(sizeof(PBVHStack)*iter->stackspace, "PBVHStack");
memcpy(newstack, iter->stack, sizeof(PBVHStack)*iter->stacksize);
- if(iter->stackspace > STACK_FIXED_DEPTH)
+ if (iter->stackspace > STACK_FIXED_DEPTH)
MEM_freeN(iter->stack);
iter->stack= newstack;
}
@@ -766,26 +775,26 @@ static PBVHNode *pbvh_iter_next(PBVHIter *iter)
/* purpose here is to traverse tree, visiting child nodes before their
* parents, this order is necessary for e.g. computing bounding boxes */
- while(iter->stacksize) {
+ while (iter->stacksize) {
/* pop node */
iter->stacksize--;
node= iter->stack[iter->stacksize].node;
/* on a mesh with no faces this can happen
* can remove this check if we know meshes have at least 1 face */
- if(node==NULL)
+ if (node==NULL)
return NULL;
revisiting= iter->stack[iter->stacksize].revisiting;
/* revisiting node already checked */
- if(revisiting)
+ if (revisiting)
return node;
- if(iter->scb && !iter->scb(node, iter->search_data))
+ if (iter->scb && !iter->scb(node, iter->search_data))
continue; /* don't traverse, outside of search zone */
- if(node->flag & PBVH_Leaf) {
+ if (node->flag & PBVH_Leaf) {
/* immediately hit leaf node */
return node;
}
@@ -806,18 +815,18 @@ static PBVHNode *pbvh_iter_next_occluded(PBVHIter *iter)
{
PBVHNode *node;
- while(iter->stacksize) {
+ while (iter->stacksize) {
/* pop node */
iter->stacksize--;
node= iter->stack[iter->stacksize].node;
/* on a mesh with no faces this can happen
* can remove this check if we know meshes have at least 1 face */
- if(node==NULL) return NULL;
+ if (node==NULL) return NULL;
- if(iter->scb && !iter->scb(node, iter->search_data)) continue; /* don't traverse, outside of search zone */
+ if (iter->scb && !iter->scb(node, iter->search_data)) continue; /* don't traverse, outside of search zone */
- if(node->flag & PBVH_Leaf) {
+ if (node->flag & PBVH_Leaf) {
/* immediately hit leaf node */
return node;
}
@@ -840,14 +849,14 @@ void BLI_pbvh_search_gather(PBVH *bvh,
pbvh_iter_begin(&iter, bvh, scb, search_data);
- while((node=pbvh_iter_next(&iter))) {
- if(node->flag & PBVH_Leaf) {
- if(tot == space) {
+ while ((node=pbvh_iter_next(&iter))) {
+ if (node->flag & PBVH_Leaf) {
+ if (tot == space) {
/* resize array if needed */
space= (tot == 0)? 32: space*2;
newarray= MEM_callocN(sizeof(PBVHNode)*space, "PBVHNodeSearch");
- if(array) {
+ if (array) {
memcpy(newarray, array, sizeof(PBVHNode)*tot);
MEM_freeN(array);
}
@@ -862,7 +871,7 @@ void BLI_pbvh_search_gather(PBVH *bvh,
pbvh_iter_end(&iter);
- if(tot == 0 && array) {
+ if (tot == 0 && array) {
MEM_freeN(array);
array= NULL;
}
@@ -880,7 +889,7 @@ void BLI_pbvh_search_callback(PBVH *bvh,
pbvh_iter_begin(&iter, bvh, scb, search_data);
- while((node=pbvh_iter_next(&iter)))
+ while ((node=pbvh_iter_next(&iter)))
if (node->flag & PBVH_Leaf)
hcb(node, hit_data);
@@ -953,8 +962,8 @@ static void BLI_pbvh_search_callback_occluded(PBVH *bvh,
pbvh_iter_begin(&iter, bvh, scb, search_data);
- while((node=pbvh_iter_next_occluded(&iter))) {
- if(node->flag & PBVH_Leaf) {
+ while ((node=pbvh_iter_next_occluded(&iter))) {
+ if (node->flag & PBVH_Leaf) {
node_tree* new_node = malloc(sizeof(node_tree));
new_node->data = node;
@@ -984,7 +993,7 @@ static int update_search_cb(PBVHNode *node, void *data_v)
{
int flag= GET_INT_FROM_POINTER(data_v);
- if(node->flag & PBVH_Leaf)
+ if (node->flag & PBVH_Leaf)
return (node->flag & flag);
return 1;
@@ -996,7 +1005,7 @@ static void pbvh_update_normals(PBVH *bvh, PBVHNode **nodes,
float (*vnor)[3];
int n;
- if(bvh->grids)
+ if (bvh->type != PBVH_FACES)
return;
/* could be per node to save some memory, but also means
@@ -1014,32 +1023,32 @@ static void pbvh_update_normals(PBVH *bvh, PBVHNode **nodes,
*/
#pragma omp parallel for private(n) schedule(static)
- for(n = 0; n < totnode; n++) {
+ for (n = 0; n < totnode; n++) {
PBVHNode *node= nodes[n];
- if((node->flag & PBVH_UpdateNormals)) {
+ if ((node->flag & PBVH_UpdateNormals)) {
int i, j, totface, *faces;
faces= node->prim_indices;
totface= node->totprim;
- for(i = 0; i < totface; ++i) {
+ for (i = 0; i < totface; ++i) {
MFace *f= bvh->faces + faces[i];
float fn[3];
unsigned int *fv = &f->v1;
int sides= (f->v4)? 4: 3;
- if(f->v4)
+ if (f->v4)
normal_quad_v3(fn, bvh->verts[f->v1].co, bvh->verts[f->v2].co,
bvh->verts[f->v3].co, bvh->verts[f->v4].co);
else
normal_tri_v3(fn, bvh->verts[f->v1].co, bvh->verts[f->v2].co,
bvh->verts[f->v3].co);
- for(j = 0; j < sides; ++j) {
+ for (j = 0; j < sides; ++j) {
int v= fv[j];
- if(bvh->verts[v].flag & ME_VERT_PBVH_UPDATE) {
+ if (bvh->verts[v].flag & ME_VERT_PBVH_UPDATE) {
/* this seems like it could be very slow but profile
* does not show this, so just leave it for now? */
#pragma omp atomic
@@ -1051,27 +1060,27 @@ static void pbvh_update_normals(PBVH *bvh, PBVHNode **nodes,
}
}
- if(face_nors)
+ if (face_nors)
copy_v3_v3(face_nors[faces[i]], fn);
}
}
}
#pragma omp parallel for private(n) schedule(static)
- for(n = 0; n < totnode; n++) {
+ for (n = 0; n < totnode; n++) {
PBVHNode *node= nodes[n];
- if(node->flag & PBVH_UpdateNormals) {
+ if (node->flag & PBVH_UpdateNormals) {
int i, *verts, totvert;
verts= node->vert_indices;
totvert= node->uniq_verts;
- for(i = 0; i < totvert; ++i) {
+ for (i = 0; i < totvert; ++i) {
const int v = verts[i];
MVert *mvert= &bvh->verts[v];
- if(mvert->flag & ME_VERT_PBVH_UPDATE) {
+ if (mvert->flag & ME_VERT_PBVH_UPDATE) {
float no[3];
copy_v3_v3(no, vnor[v]);
@@ -1099,17 +1108,17 @@ static void pbvh_update_BB_redraw(PBVH *bvh, PBVHNode **nodes,
/* update BB, redraw flag */
#pragma omp parallel for private(n) schedule(static)
- for(n = 0; n < totnode; n++) {
+ for (n = 0; n < totnode; n++) {
PBVHNode *node= nodes[n];
- if((flag & PBVH_UpdateBB) && (node->flag & PBVH_UpdateBB))
+ if ((flag & PBVH_UpdateBB) && (node->flag & PBVH_UpdateBB))
/* don't clear flag yet, leave it for flushing later */
update_node_vb(bvh, node);
- if((flag & PBVH_UpdateOriginalBB) && (node->flag & PBVH_UpdateOriginalBB))
+ if ((flag & PBVH_UpdateOriginalBB) && (node->flag & PBVH_UpdateOriginalBB))
node->orig_vb= node->vb;
- if((flag & PBVH_UpdateRedraw) && (node->flag & PBVH_UpdateRedraw))
+ if ((flag & PBVH_UpdateRedraw) && (node->flag & PBVH_UpdateRedraw))
node->flag &= ~PBVH_UpdateRedraw;
}
}
@@ -1120,24 +1129,44 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
int n;
/* can't be done in parallel with OpenGL */
- for(n = 0; n < totnode; n++) {
+ for (n = 0; n < totnode; n++) {
node= nodes[n];
- if(node->flag & PBVH_UpdateDrawBuffers) {
- if(bvh->grids) {
+ if (node->flag & PBVH_RebuildDrawBuffers) {
+ GPU_free_buffers(node->draw_buffers);
+ if (bvh->grids) {
+ node->draw_buffers =
+ GPU_build_grid_buffers(node->prim_indices,
+ node->totprim, bvh->grid_hidden, bvh->gridsize);
+ }
+ else {
+ node->draw_buffers =
+ GPU_build_mesh_buffers(node->face_vert_indices,
+ bvh->faces, bvh->verts,
+ node->prim_indices,
+ node->totprim);
+ }
+
+ node->flag &= ~PBVH_RebuildDrawBuffers;
+ }
+
+ if (node->flag & PBVH_UpdateDrawBuffers) {
+ switch(bvh->type) {
+ case PBVH_GRIDS:
GPU_update_grid_buffers(node->draw_buffers,
bvh->grids,
bvh->grid_flag_mats,
node->prim_indices,
node->totprim,
bvh->gridsize);
- }
- else {
+ break;
+ case PBVH_FACES:
GPU_update_mesh_buffers(node->draw_buffers,
bvh->verts,
node->vert_indices,
node->uniq_verts +
node->face_verts);
+ break;
}
node->flag &= ~PBVH_UpdateDrawBuffers;
@@ -1150,13 +1179,13 @@ static int pbvh_flush_bb(PBVH *bvh, PBVHNode *node, int flag)
int update= 0;
/* difficult to multithread well, we just do single threaded recursive */
- if(node->flag & PBVH_Leaf) {
- if(flag & PBVH_UpdateBB) {
+ if (node->flag & PBVH_Leaf) {
+ if (flag & PBVH_UpdateBB) {
update |= (node->flag & PBVH_UpdateBB);
node->flag &= ~PBVH_UpdateBB;
}
- if(flag & PBVH_UpdateOriginalBB) {
+ if (flag & PBVH_UpdateOriginalBB) {
update |= (node->flag & PBVH_UpdateOriginalBB);
node->flag &= ~PBVH_UpdateOriginalBB;
}
@@ -1167,9 +1196,9 @@ static int pbvh_flush_bb(PBVH *bvh, PBVHNode *node, int flag)
update |= pbvh_flush_bb(bvh, bvh->nodes + node->children_offset, flag);
update |= pbvh_flush_bb(bvh, bvh->nodes + node->children_offset + 1, flag);
- if(update & PBVH_UpdateBB)
+ if (update & PBVH_UpdateBB)
update_node_vb(bvh, node);
- if(update & PBVH_UpdateOriginalBB)
+ if (update & PBVH_UpdateOriginalBB)
node->orig_vb= node->vb;
}
@@ -1181,22 +1210,22 @@ void BLI_pbvh_update(PBVH *bvh, int flag, float (*face_nors)[3])
PBVHNode **nodes;
int totnode;
- if(!bvh->nodes)
+ if (!bvh->nodes)
return;
BLI_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(flag),
&nodes, &totnode);
- if(flag & PBVH_UpdateNormals)
+ if (flag & PBVH_UpdateNormals)
pbvh_update_normals(bvh, nodes, totnode, face_nors);
- if(flag & (PBVH_UpdateBB|PBVH_UpdateOriginalBB|PBVH_UpdateRedraw))
+ if (flag & (PBVH_UpdateBB|PBVH_UpdateOriginalBB|PBVH_UpdateRedraw))
pbvh_update_BB_redraw(bvh, nodes, totnode, flag);
- if(flag & (PBVH_UpdateBB|PBVH_UpdateOriginalBB))
+ if (flag & (PBVH_UpdateBB|PBVH_UpdateOriginalBB))
pbvh_flush_bb(bvh, bvh->nodes, flag);
- if(nodes) MEM_freeN(nodes);
+ if (nodes) MEM_freeN(nodes);
}
void BLI_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3])
@@ -1209,8 +1238,8 @@ void BLI_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3])
pbvh_iter_begin(&iter, bvh, NULL, NULL);
- while((node=pbvh_iter_next(&iter)))
- if(node->flag & PBVH_UpdateRedraw)
+ while ((node=pbvh_iter_next(&iter)))
+ if (node->flag & PBVH_UpdateRedraw)
BB_expand_with_bb(&bb, &node->vb);
pbvh_iter_end(&iter);
@@ -1233,15 +1262,15 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot
pbvh_iter_begin(&iter, bvh, NULL, NULL);
- while((node=pbvh_iter_next(&iter))) {
- if(node->flag & PBVH_UpdateNormals) {
- for(i = 0; i < node->totprim; ++i) {
+ while ((node=pbvh_iter_next(&iter))) {
+ if (node->flag & PBVH_UpdateNormals) {
+ for (i = 0; i < node->totprim; ++i) {
face= bvh->gridfaces[node->prim_indices[i]];
- if(!BLI_ghash_lookup(map, face))
+ if (!BLI_ghash_lookup(map, face))
BLI_ghash_insert(map, face, face);
}
- if(clear)
+ if (clear)
node->flag &= ~PBVH_UpdateNormals;
}
}
@@ -1249,7 +1278,7 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot
pbvh_iter_end(&iter);
tot= BLI_ghash_size(map);
- if(tot == 0) {
+ if (tot == 0) {
*totface= 0;
*gridfaces= NULL;
BLI_ghash_free(map, NULL, NULL);
@@ -1258,7 +1287,7 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot
faces= MEM_callocN(sizeof(void*)*tot, "PBVH Grid Faces");
- for(hiter = BLI_ghashIterator_new(map), i = 0;
+ for (hiter = BLI_ghashIterator_new(map), i = 0;
!BLI_ghashIterator_isDone(hiter);
BLI_ghashIterator_step(hiter), ++i)
faces[i]= BLI_ghashIterator_getKey(hiter);
@@ -1271,6 +1300,19 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot
*gridfaces= faces;
}
+/***************************** PBVH Access ***********************************/
+
+PBVHType BLI_pbvh_type(const PBVH *bvh)
+{
+ return bvh->type;
+}
+
+BLI_bitmap *BLI_pbvh_grid_hidden(const PBVH *bvh)
+{
+ BLI_assert(bvh->type == PBVH_GRIDS);
+ return bvh->grid_hidden;
+}
+
/***************************** Node Access ***********************************/
void BLI_pbvh_node_mark_update(PBVHNode *node)
@@ -1278,42 +1320,63 @@ void BLI_pbvh_node_mark_update(PBVHNode *node)
node->flag |= PBVH_UpdateNormals|PBVH_UpdateBB|PBVH_UpdateOriginalBB|PBVH_UpdateDrawBuffers|PBVH_UpdateRedraw;
}
+void BLI_pbvh_node_mark_rebuild_draw(PBVHNode *node)
+{
+ node->flag |= PBVH_RebuildDrawBuffers|PBVH_UpdateDrawBuffers|PBVH_UpdateRedraw;
+}
+
+void BLI_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden)
+{
+ BLI_assert(node->flag & PBVH_Leaf);
+
+ if (fully_hidden)
+ node->flag |= PBVH_FullyHidden;
+ else
+ node->flag &= ~PBVH_FullyHidden;
+}
+
void BLI_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node, int **vert_indices, MVert **verts)
{
- if(vert_indices) *vert_indices= node->vert_indices;
- if(verts) *verts= bvh->verts;
+ if (vert_indices) *vert_indices= node->vert_indices;
+ if (verts) *verts= bvh->verts;
}
void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, int *uniquevert, int *totvert)
{
- if(bvh->grids) {
- const int tot= node->totprim*bvh->gridsize*bvh->gridsize;
- if(totvert) *totvert= tot;
- if(uniquevert) *uniquevert= tot;
- }
- else {
- if(totvert) *totvert= node->uniq_verts + node->face_verts;
- if(uniquevert) *uniquevert= node->uniq_verts;
+ int tot;
+
+ switch(bvh->type) {
+ case PBVH_GRIDS:
+ tot= node->totprim*bvh->gridsize*bvh->gridsize;
+ if (totvert) *totvert= tot;
+ if (uniquevert) *uniquevert= tot;
+ break;
+ case PBVH_FACES:
+ if (totvert) *totvert= node->uniq_verts + node->face_verts;
+ if (uniquevert) *uniquevert= node->uniq_verts;
+ break;
}
}
void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node, int **grid_indices, int *totgrid, int *maxgrid, int *gridsize, DMGridData ***griddata, DMGridAdjacency **gridadj)
{
- if(bvh->grids) {
- if(grid_indices) *grid_indices= node->prim_indices;
- if(totgrid) *totgrid= node->totprim;
- if(maxgrid) *maxgrid= bvh->totgrid;
- if(gridsize) *gridsize= bvh->gridsize;
- if(griddata) *griddata= bvh->grids;
- if(gridadj) *gridadj= bvh->gridadj;
- }
- else {
- if(grid_indices) *grid_indices= NULL;
- if(totgrid) *totgrid= 0;
- if(maxgrid) *maxgrid= 0;
- if(gridsize) *gridsize= 0;
- if(griddata) *griddata= NULL;
- if(gridadj) *gridadj= NULL;
+ switch(bvh->type) {
+ case PBVH_GRIDS:
+ if (grid_indices) *grid_indices= node->prim_indices;
+ if (totgrid) *totgrid= node->totprim;
+ if (maxgrid) *maxgrid= bvh->totgrid;
+ if (gridsize) *gridsize= bvh->gridsize;
+ if (griddata) *griddata= bvh->grids;
+ if (gridadj) *gridadj= bvh->gridadj;
+ break;
+ case PBVH_FACES:
+ if (grid_indices) *grid_indices= NULL;
+ if (totgrid) *totgrid= 0;
+ if (maxgrid) *maxgrid= 0;
+ if (gridsize) *gridsize= 0;
+ if (griddata) *griddata= NULL;
+ if (gridadj) *gridadj= NULL;
+ break;
}
}
@@ -1358,7 +1421,7 @@ static int ray_aabb_intersect(PBVHNode *node, void *data_v)
float bbox[2][3];
float tmin, tmax, tymin, tymax, tzmin, tzmax;
- if(ray->original)
+ if (ray->original)
BLI_pbvh_node_get_original_BB(node, bbox[0], bbox[1]);
else
BLI_pbvh_node_get_BB(node, bbox[0], bbox[1]);
@@ -1369,22 +1432,22 @@ static int ray_aabb_intersect(PBVHNode *node, void *data_v)
tymin = (bbox[ray->sign[1]][1] - ray->start[1]) * ray->inv_dir[1];
tymax = (bbox[1-ray->sign[1]][1] - ray->start[1]) * ray->inv_dir[1];
- if((tmin > tymax) || (tymin > tmax))
+ if ((tmin > tymax) || (tymin > tmax))
return 0;
- if(tymin > tmin)
+ if (tymin > tmin)
tmin = tymin;
- if(tymax < tmax)
+ if (tymax < tmax)
tmax = tymax;
tzmin = (bbox[ray->sign[2]][2] - ray->start[2]) * ray->inv_dir[2];
tzmax = (bbox[1-ray->sign[2]][2] - ray->start[2]) * ray->inv_dir[2];
- if((tmin > tzmax) || (tzmin > tmax))
+ if ((tmin > tzmax) || (tzmin > tmax))
return 0;
- if(tzmin > tmin)
+ if (tzmin > tmin)
tmin = tzmin;
// XXX jwilkins: tmax does not need to be updated since we don't use it
@@ -1433,19 +1496,28 @@ static int ray_face_intersection(float ray_start[3], float ray_normal[3],
int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
float ray_start[3], float ray_normal[3], float *dist)
{
- int hit= 0;
+ MVert *vert;
+ BLI_bitmap gh;
+ int *faces, totface, gridsize, totgrid;
+ int i, x, y, hit= 0;
- if(bvh->faces) {
- MVert *vert = bvh->verts;
- int *faces= node->prim_indices;
- int totface= node->totprim;
- int i;
+ if (node->flag & PBVH_FullyHidden)
+ return 0;
+
+ switch(bvh->type) {
+ case PBVH_FACES:
+ vert = bvh->verts;
+ faces= node->prim_indices;
+ totface= node->totprim;
- for(i = 0; i < totface; ++i) {
- MFace *f = bvh->faces + faces[i];
+ for (i = 0; i < totface; ++i) {
+ const MFace *f = bvh->faces + faces[i];
int *face_verts = node->face_vert_indices[i];
- if(origco) {
+ if (paint_is_face_hidden(f, vert))
+ continue;
+
+ if (origco) {
/* intersect with backuped original coordinates */
hit |= ray_face_intersection(ray_start, ray_normal,
origco[face_verts[0]],
@@ -1464,20 +1536,27 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
dist);
}
}
- }
- else {
- int totgrid= node->totprim;
- int gridsize= bvh->gridsize;
- int i, x, y;
+ break;
+ case PBVH_GRIDS:
+ totgrid= node->totprim;
+ gridsize= bvh->gridsize;
- for(i = 0; i < totgrid; ++i) {
+ for (i = 0; i < totgrid; ++i) {
DMGridData *grid= bvh->grids[node->prim_indices[i]];
if (!grid)
continue;
- for(y = 0; y < gridsize-1; ++y) {
- for(x = 0; x < gridsize-1; ++x) {
- if(origco) {
+ gh= bvh->grid_hidden[node->prim_indices[i]];
+
+ for (y = 0; y < gridsize-1; ++y) {
+ for (x = 0; x < gridsize-1; ++x) {
+ /* check if grid face is hidden */
+ if (gh) {
+ if (paint_is_grid_face_hidden(gh, gridsize, x, y))
+ continue;
+ }
+
+ if (origco) {
hit |= ray_face_intersection(ray_start, ray_normal,
origco[y*gridsize + x],
origco[y*gridsize + x+1],
@@ -1496,9 +1575,10 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
}
}
- if(origco)
+ if (origco)
origco += gridsize*gridsize;
}
+ break;
}
return hit;
@@ -1512,51 +1592,77 @@ void BLI_pbvh_node_draw(PBVHNode *node, void *setMaterial)
/* XXX: Just some quick code to show leaf nodes in different colors */
float col[3]; int i;
- if(0) { //is_partial) {
+ if (0) { //is_partial) {
col[0] = (rand() / (float)RAND_MAX); col[1] = col[2] = 0.6;
}
else {
srand((long long)node);
- for(i = 0; i < 3; ++i)
+ for (i = 0; i < 3; ++i)
col[i] = (rand() / (float)RAND_MAX) * 0.3 + 0.7;
}
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, col);
glColor3f(1, 0, 0);
#endif
- GPU_draw_buffers(node->draw_buffers, setMaterial);
+
+ if (!(node->flag & PBVH_FullyHidden))
+ GPU_draw_buffers(node->draw_buffers, setMaterial);
}
+typedef enum {
+ ISECT_INSIDE,
+ ISECT_OUTSIDE,
+ ISECT_INTERSECT
+} PlaneAABBIsect;
+
/* Adapted from:
* http://www.gamedev.net/community/forums/topic.asp?topic_id=512123
* Returns true if the AABB is at least partially within the frustum
* (ok, not a real frustum), false otherwise.
*/
-int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data)
+static PlaneAABBIsect test_planes_aabb(const float bb_min[3],
+ const float bb_max[3],
+ const float (*planes)[4])
{
- float (*planes)[4] = data;
+ float vmin[3], vmax[3];
+ PlaneAABBIsect ret = ISECT_INSIDE;
int i, axis;
- float vmin[3] /*, vmax[3]*/, bb_min[3], bb_max[3];
-
- BLI_pbvh_node_get_BB(node, bb_min, bb_max);
-
- for(i = 0; i < 4; ++i) {
- for(axis = 0; axis < 3; ++axis) {
- if(planes[i][axis] > 0) {
+
+ for (i = 0; i < 4; ++i) {
+ for (axis = 0; axis < 3; ++axis) {
+ if (planes[i][axis] > 0) {
vmin[axis] = bb_min[axis];
- /*vmax[axis] = bb_max[axis];*/ /*UNUSED*/
+ vmax[axis] = bb_max[axis];
}
else {
vmin[axis] = bb_max[axis];
- /*vmax[axis] = bb_min[axis];*/ /*UNUSED*/
+ vmax[axis] = bb_min[axis];
}
}
- if(dot_v3v3(planes[i], vmin) + planes[i][3] > 0)
- return 0;
+ if (dot_v3v3(planes[i], vmin) + planes[i][3] > 0)
+ return ISECT_OUTSIDE;
+ else if (dot_v3v3(planes[i], vmax) + planes[i][3] >= 0)
+ ret = ISECT_INTERSECT;
}
- return 1;
+ return ret;
+}
+
+int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data)
+{
+ float bb_min[3], bb_max[3];
+
+ BLI_pbvh_node_get_BB(node, bb_min, bb_max);
+ return test_planes_aabb(bb_min, bb_max, data) != ISECT_OUTSIDE;
+}
+
+int BLI_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data)
+{
+ float bb_min[3], bb_max[3];
+
+ BLI_pbvh_node_get_BB(node, bb_min, bb_max);
+ return test_planes_aabb(bb_min, bb_max, data) != ISECT_INSIDE;
}
void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
@@ -1571,9 +1677,9 @@ void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
pbvh_update_normals(bvh, nodes, totnode, face_nors);
pbvh_update_draw_buffers(bvh, nodes, totnode);
- if(nodes) MEM_freeN(nodes);
+ if (nodes) MEM_freeN(nodes);
- if(planes) {
+ if (planes) {
BLI_pbvh_search_callback(bvh, BLI_pbvh_node_planes_contain_AABB,
planes, BLI_pbvh_node_draw, setMaterial);
}
@@ -1706,8 +1812,8 @@ void BLI_pbvh_gather_proxies(PBVH* pbvh, PBVHNode*** r_array, int* r_tot)
for (n= 0; n < pbvh->totnode; n++) {
node = pbvh->nodes + n;
- if(node->proxy_count > 0) {
- if(tot == space) {
+ if (node->proxy_count > 0) {
+ if (tot == space) {
/* resize array if needed */
space= (tot == 0)? 32: space*2;
newarray= MEM_callocN(sizeof(PBVHNode)*space, "BLI_pbvh_gather_proxies");
@@ -1725,7 +1831,7 @@ void BLI_pbvh_gather_proxies(PBVH* pbvh, PBVHNode*** r_array, int* r_tot)
}
}
- if(tot == 0 && array) {
+ if (tot == 0 && array) {
MEM_freeN(array);
array= NULL;
}
@@ -1756,10 +1862,14 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
vi->totgrid= (grids)? totgrid: 1;
vi->gridsize= gridsize;
- if(mode == PBVH_ITER_ALL)
+ if (mode == PBVH_ITER_ALL)
vi->totvert = totvert;
else
vi->totvert= uniq_verts;
vi->vert_indices= vert_indices;
vi->mverts= verts;
+
+ vi->gh= NULL;
+ if (vi->grids && mode == PBVH_ITER_UNIQUE)
+ vi->grid_hidden= bvh->grid_hidden;
}
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c
index 28dc5a696d5..20f0a11f75f 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -111,11 +111,17 @@ float rng_getFloat(RNG *rng)
void rng_shuffleArray(RNG *rng, void *data, int elemSize, int numElems)
{
int i = numElems;
- void *temp = malloc(elemSize);
+ void *temp;
+
+ if (numElems <= 0) {
+ return;
+ }
+
+ temp = malloc(elemSize);
while (--i) {
int j = rng_getInt(rng)%numElems;
- if(i!=j) {
+ if (i!=j) {
void *iElem = (unsigned char*)data + i*elemSize;
void *jElem = (unsigned char*)data + j*elemSize;
memcpy(temp, iElem, elemSize);
@@ -131,7 +137,7 @@ void rng_skip(RNG *rng, int n)
{
int i;
- for(i=0; i<n; i++)
+ for (i=0; i<n; i++)
rng_getInt(rng);
}
@@ -189,7 +195,7 @@ static RNG rng_tab[BLENDER_MAX_THREADS];
void BLI_thread_srandom(int thread, unsigned int seed)
{
- if(thread >= BLENDER_MAX_THREADS)
+ if (thread >= BLENDER_MAX_THREADS)
thread= 0;
rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 3b9fd2e07f6..d3bb5a1b17f 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -1,12 +1,4 @@
/*
- *
- * rct.c
- *
- * april 95
- *
- *
- * A minimalist lib for functions doing stuff with rectangle structs.
- *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -36,6 +28,8 @@
/** \file blender/blenlib/intern/rct.c
* \ingroup bli
+ *
+ * A minimalist lib for functions doing stuff with rectangle structs.
*/
#include <stdio.h>
@@ -46,91 +40,85 @@
int BLI_rcti_is_empty(rcti * rect)
{
- return ((rect->xmax<=rect->xmin) ||
- (rect->ymax<=rect->ymin));
+ return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
}
int BLI_rctf_is_empty(rctf * rect)
{
- return ((rect->xmax<=rect->xmin) ||
- (rect->ymax<=rect->ymin));
+ return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
}
int BLI_in_rcti(rcti * rect, int x, int y)
{
-
- if(x<rect->xmin) return 0;
- if(x>rect->xmax) return 0;
- if(y<rect->ymin) return 0;
- if(y>rect->ymax) return 0;
+ if (x < rect->xmin) return 0;
+ if (x > rect->xmax) return 0;
+ if (y < rect->ymin) return 0;
+ if (y > rect->ymax) return 0;
return 1;
}
int BLI_in_rctf(rctf *rect, float x, float y)
{
-
- if(x<rect->xmin) return 0;
- if(x>rect->xmax) return 0;
- if(y<rect->ymin) return 0;
- if(y>rect->ymax) return 0;
+ if (x < rect->xmin) return 0;
+ if (x > rect->xmax) return 0;
+ if (y < rect->ymin) return 0;
+ if (y > rect->ymax) return 0;
return 1;
}
void BLI_union_rctf(rctf *rct1, rctf *rct2)
{
-
- if(rct1->xmin>rct2->xmin) rct1->xmin= rct2->xmin;
- if(rct1->xmax<rct2->xmax) rct1->xmax= rct2->xmax;
- if(rct1->ymin>rct2->ymin) rct1->ymin= rct2->ymin;
- if(rct1->ymax<rct2->ymax) rct1->ymax= rct2->ymax;
+ if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
+ if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
+ if (rct1->ymin > rct2->ymin) rct1->ymin = rct2->ymin;
+ if (rct1->ymax < rct2->ymax) rct1->ymax = rct2->ymax;
}
void BLI_union_rcti(rcti *rct1, rcti *rct2)
{
-
- if(rct1->xmin>rct2->xmin) rct1->xmin= rct2->xmin;
- if(rct1->xmax<rct2->xmax) rct1->xmax= rct2->xmax;
- if(rct1->ymin>rct2->ymin) rct1->ymin= rct2->ymin;
- if(rct1->ymax<rct2->ymax) rct1->ymax= rct2->ymax;
+ if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
+ if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
+ if (rct1->ymin > rct2->ymin) rct1->ymin = rct2->ymin;
+ if (rct1->ymax < rct2->ymax) rct1->ymax = rct2->ymax;
}
void BLI_init_rctf(rctf *rect, float xmin, float xmax, float ymin, float ymax)
{
- if(xmin <= xmax) {
- rect->xmin= xmin;
- rect->xmax= xmax;
+ if (xmin <= xmax) {
+ rect->xmin = xmin;
+ rect->xmax = xmax;
}
else {
- rect->xmax= xmin;
- rect->xmin= xmax;
+ rect->xmax = xmin;
+ rect->xmin = xmax;
}
- if(ymin <= ymax) {
- rect->ymin= ymin;
- rect->ymax= ymax;
+ if (ymin <= ymax) {
+ rect->ymin = ymin;
+ rect->ymax = ymax;
}
else {
- rect->ymax= ymin;
- rect->ymin= ymax;
+ rect->ymax = ymin;
+ rect->ymin = ymax;
}
}
void BLI_init_rcti(rcti *rect, int xmin, int xmax, int ymin, int ymax)
{
- if(xmin <= xmax) {
- rect->xmin= xmin;
- rect->xmax= xmax;
+ if (xmin <= xmax) {
+ rect->xmin = xmin;
+ rect->xmax = xmax;
}
else {
- rect->xmax= xmin;
- rect->xmin= xmax;
+ rect->xmax = xmin;
+ rect->xmin = xmax;
}
- if(ymin <= ymax) {
- rect->ymin= ymin;
- rect->ymax= ymax;
+ if (ymin <= ymax) {
+ rect->ymin = ymin;
+ rect->ymax = ymax;
}
else {
- rect->ymax= ymin;
- rect->ymin= ymax;
+ rect->ymax = ymin;
+ rect->ymin = ymax;
}
}
@@ -152,22 +140,22 @@ void BLI_translate_rctf(rctf *rect, float x, float y)
/* change width & height around the central location */
void BLI_resize_rcti(rcti *rect, int x, int y)
{
- rect->xmin= rect->xmax= (rect->xmax + rect->xmin) / 2;
- rect->ymin= rect->ymax= (rect->ymax + rect->ymin) / 2;
+ rect->xmin = rect->xmax = (rect->xmax + rect->xmin) / 2;
+ rect->ymin = rect->ymax = (rect->ymax + rect->ymin) / 2;
rect->xmin -= x / 2;
rect->ymin -= y / 2;
- rect->xmax= rect->xmin + x;
- rect->ymax= rect->ymin + y;
+ rect->xmax = rect->xmin + x;
+ rect->ymax = rect->ymin + y;
}
void BLI_resize_rctf(rctf *rect, float x, float y)
{
- rect->xmin= rect->xmax= (rect->xmax + rect->xmin) * 0.5f;
- rect->ymin= rect->ymax= (rect->ymax + rect->ymin) * 0.5f;
+ rect->xmin = rect->xmax = (rect->xmax + rect->xmin) * 0.5f;
+ rect->ymin = rect->ymax = (rect->ymax + rect->ymin) * 0.5f;
rect->xmin -= x * 0.5f;
rect->ymin -= y * 0.5f;
- rect->xmax= rect->xmin + x;
- rect->ymax= rect->ymin + y;
+ rect->xmax = rect->xmin + x;
+ rect->ymax = rect->ymin + y;
}
int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
@@ -179,9 +167,9 @@ int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
xmax = (src1->xmax) < (src2->xmax) ? (src1->xmax) : (src2->xmax);
ymin = (src1->ymin) > (src2->ymin) ? (src1->ymin) : (src2->ymin);
ymax = (src1->ymax) < (src2->ymax) ? (src1->ymax) : (src2->ymax);
-
- if(xmax>=xmin && ymax>=ymin) {
- if(dest) {
+
+ if (xmax >= xmin && ymax >= ymin) {
+ if (dest) {
dest->xmin = xmin;
dest->xmax = xmax;
dest->ymin = ymin;
@@ -190,7 +178,7 @@ int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
return 1;
}
else {
- if(dest) {
+ if (dest) {
dest->xmin = 0;
dest->xmax = 0;
dest->ymin = 0;
@@ -204,14 +192,14 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
{
int xmin, xmax;
int ymin, ymax;
-
+
xmin = (src1->xmin) > (src2->xmin) ? (src1->xmin) : (src2->xmin);
xmax = (src1->xmax) < (src2->xmax) ? (src1->xmax) : (src2->xmax);
ymin = (src1->ymin) > (src2->ymin) ? (src1->ymin) : (src2->ymin);
ymax = (src1->ymax) < (src2->ymax) ? (src1->ymax) : (src2->ymax);
-
- if(xmax>=xmin && ymax>=ymin) {
- if(dest) {
+
+ if (xmax >= xmin && ymax >= ymin) {
+ if (dest) {
dest->xmin = xmin;
dest->xmax = xmax;
dest->ymin = ymin;
@@ -220,7 +208,7 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
return 1;
}
else {
- if(dest) {
+ if (dest) {
dest->xmin = 0;
dest->xmax = 0;
dest->ymin = 0;
@@ -232,18 +220,20 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
{
- tar->xmin= floor(src->xmin + 0.5f);
- tar->xmax= floor((src->xmax - src->xmin) + 0.5f);
- tar->ymin= floor(src->ymin + 0.5f);
- tar->ymax= floor((src->ymax - src->ymin) + 0.5f);
+ tar->xmin = floor(src->xmin + 0.5f);
+ tar->xmax = floor((src->xmax - src->xmin) + 0.5f);
+ tar->ymin = floor(src->ymin + 0.5f);
+ tar->ymax = floor((src->ymax - src->ymin) + 0.5f);
}
void print_rctf(const char *str, rctf *rect)
{
- printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
+ printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str,
+ rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
}
void print_rcti(const char *str, rcti *rect)
{
- printf("%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
+ printf("%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n", str,
+ rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
}
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 6a20d858214..641d0373a64 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -72,7 +72,8 @@ static int callLocalInterruptCallBack(void)
{
if (BLI_localInterruptCallBack) {
return BLI_localInterruptCallBack();
- } else {
+ }
+ else {
return 0;
}
}
@@ -110,10 +111,10 @@ static int vergscdata(const void *a1, const void *a2)
{
const ScanFillVertLink *x1=a1,*x2=a2;
- if( x1->v1->co[coy] < x2->v1->co[coy] ) return 1;
- else if( x1->v1->co[coy] > x2->v1->co[coy]) return -1;
- else if( x1->v1->co[cox] > x2->v1->co[cox] ) return 1;
- else if( x1->v1->co[cox] < x2->v1->co[cox]) return -1;
+ if ( x1->v1->co[coy] < x2->v1->co[coy] ) return 1;
+ else if ( x1->v1->co[coy] > x2->v1->co[coy]) return -1;
+ else if ( x1->v1->co[cox] > x2->v1->co[cox] ) return 1;
+ else if ( x1->v1->co[cox] < x2->v1->co[cox]) return -1;
return 0;
}
@@ -122,10 +123,10 @@ static int vergpoly(const void *a1, const void *a2)
{
const PolyFill *x1=a1, *x2=a2;
- if( x1->min[cox] > x2->min[cox] ) return 1;
- else if( x1->min[cox] < x2->min[cox] ) return -1;
- else if( x1->min[coy] > x2->min[coy] ) return 1;
- else if( x1->min[coy] < x2->min[coy] ) return -1;
+ if ( x1->min[cox] > x2->min[cox] ) return 1;
+ else if ( x1->min[cox] < x2->min[cox] ) return -1;
+ else if ( x1->min[coy] > x2->min[coy] ) return 1;
+ else if ( x1->min[coy] < x2->min[coy] ) return -1;
return 0;
}
@@ -153,7 +154,7 @@ static void *mem_element_new(int size)
size = (size + 3 ) & ~3; /* allocate in units of 4 */
- if(melem__cur && (size + melem__offs < MEM_ELEM_BLOCKSIZE)) {
+ if (melem__cur && (size + melem__offs < MEM_ELEM_BLOCKSIZE)) {
void *adr= (void *) (melem__cur->data+melem__offs);
melem__offs+= size;
return adr;
@@ -171,13 +172,13 @@ static void mem_element_reset(int keep_first)
{
struct mem_elements *first;
- if((first= melem__lb.first)) { /* can be false if first fill fails */
+ if ((first= melem__lb.first)) { /* can be false if first fill fails */
if (keep_first) {
BLI_remlink(&melem__lb, first);
}
melem__cur= melem__lb.first;
- while(melem__cur) {
+ while (melem__cur) {
MEM_freeN(melem__cur->data);
melem__cur= melem__cur->next;
}
@@ -261,20 +262,20 @@ static int boundisect(PolyFill *pf2, PolyFill *pf1)
/* has pf2 been touched (intersected) by pf1 ? with bounding box */
/* test first if polys exist */
- if(pf1->edges==0 || pf2->edges==0) return 0;
+ if (pf1->edges==0 || pf2->edges==0) return 0;
- if(pf2->max[cox] < pf1->min[cox] ) return 0;
- if(pf2->max[coy] < pf1->min[coy] ) return 0;
+ if (pf2->max[cox] < pf1->min[cox] ) return 0;
+ if (pf2->max[coy] < pf1->min[coy] ) return 0;
- if(pf2->min[cox] > pf1->max[cox] ) return 0;
- if(pf2->min[coy] > pf1->max[coy] ) return 0;
+ if (pf2->min[cox] > pf1->max[cox] ) return 0;
+ if (pf2->min[coy] > pf1->max[coy] ) return 0;
/* join */
- if(pf2->max[cox]<pf1->max[cox]) pf2->max[cox]= pf1->max[cox];
- if(pf2->max[coy]<pf1->max[coy]) pf2->max[coy]= pf1->max[coy];
+ if (pf2->max[cox]<pf1->max[cox]) pf2->max[cox]= pf1->max[cox];
+ if (pf2->max[coy]<pf1->max[coy]) pf2->max[coy]= pf1->max[coy];
- if(pf2->min[cox]>pf1->min[cox]) pf2->min[cox]= pf1->min[cox];
- if(pf2->min[coy]>pf1->min[coy]) pf2->min[coy]= pf1->min[coy];
+ if (pf2->min[cox]>pf1->min[cox]) pf2->min[cox]= pf1->min[cox];
+ if (pf2->min[coy]>pf1->min[coy]) pf2->min[coy]= pf1->min[coy];
return 1;
}
@@ -287,12 +288,12 @@ static void mergepolysSimp(PolyFill *pf1, PolyFill *pf2) /* add pf2 to pf1 */
/* replace old poly numbers */
eve= fillvertbase.first;
- while(eve) {
- if(eve->poly_nr == pf2->nr) eve->poly_nr = pf1->nr;
+ while (eve) {
+ if (eve->poly_nr == pf2->nr) eve->poly_nr = pf1->nr;
eve= eve->next;
}
eed= filledgebase.first;
- while(eed) {
+ while (eed) {
if (eed->poly_nr == pf2->nr) eed->poly_nr = pf1->nr;
eed= eed->next;
}
@@ -311,10 +312,10 @@ static short testedgeside(const float v1[3], const float v2[3], const float v3[3
inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy])
+(v1[coy]-v2[coy])*(v1[cox]-v3[cox]);
- if(inp < 0.0f) return 0;
- else if(inp==0) {
- if(v1[cox]==v3[cox] && v1[coy]==v3[coy]) return 0;
- if(v2[cox]==v3[cox] && v2[coy]==v3[coy]) return 0;
+ if (inp < 0.0f) return 0;
+ else if (inp==0) {
+ if (v1[cox]==v3[cox] && v1[coy]==v3[coy]) return 0;
+ if (v2[cox]==v3[cox] && v2[coy]==v3[coy]) return 0;
}
return 1;
}
@@ -325,7 +326,7 @@ static short addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
ScanFillEdge *ed;
float fac,fac1,x,y;
- if(sc->first==0) {
+ if (sc->first==0) {
sc->first= sc->last= eed;
eed->prev= eed->next=0;
return 1;
@@ -335,28 +336,28 @@ static short addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
y= eed->v1->co[coy];
fac1= eed->v2->co[coy]-y;
- if(fac1==0.0f) {
+ if (fac1==0.0f) {
fac1= 1.0e10f*(eed->v2->co[cox]-x);
}
else fac1= (x-eed->v2->co[cox])/fac1;
ed= sc->first;
- while(ed) {
+ while (ed) {
- if(ed->v2==eed->v2) return 0;
+ if (ed->v2==eed->v2) return 0;
fac= ed->v2->co[coy]-y;
- if(fac==0.0f) {
+ if (fac==0.0f) {
fac= 1.0e10f*(ed->v2->co[cox]-x);
}
else fac= (x-ed->v2->co[cox])/fac;
- if(fac>fac1) break;
+ if (fac>fac1) break;
ed= ed->next;
}
- if(ed) BLI_insertlinkbefore((ListBase *)&(sc->first), ed, eed);
+ if (ed) BLI_insertlinkbefore((ListBase *)&(sc->first), ed, eed);
else BLI_addtail((ListBase *)&(sc->first),eed);
return 1;
@@ -371,14 +372,14 @@ static ScanFillVertLink *addedgetoscanlist(ScanFillEdge *eed, int len)
ScanFillVert *eve;
/* which vert is left-top? */
- if(eed->v1->co[coy] == eed->v2->co[coy]) {
- if(eed->v1->co[cox] > eed->v2->co[cox]) {
+ if (eed->v1->co[coy] == eed->v2->co[coy]) {
+ if (eed->v1->co[cox] > eed->v2->co[cox]) {
eve= eed->v1;
eed->v1= eed->v2;
eed->v2= eve;
}
}
- else if(eed->v1->co[coy] < eed->v2->co[coy]) {
+ else if (eed->v1->co[coy] < eed->v2->co[coy]) {
eve= eed->v1;
eed->v1= eed->v2;
eed->v2= eve;
@@ -388,8 +389,8 @@ static ScanFillVertLink *addedgetoscanlist(ScanFillEdge *eed, int len)
sc= (ScanFillVertLink *)bsearch(&scsearch,scdata,len,
sizeof(ScanFillVertLink), vergscdata);
- if(sc==0) printf("Error in search edge: %p\n", (void *)eed);
- else if(addedgetoscanvert(sc,eed)==0) return sc;
+ if (sc==0) printf("Error in search edge: %p\n", (void *)eed);
+ else if (addedgetoscanvert(sc,eed)==0) return sc;
return 0;
}
@@ -399,22 +400,24 @@ static short boundinsideEV(ScanFillEdge *eed, ScanFillVert *eve)
{
float minx,maxx,miny,maxy;
- if(eed->v1->co[cox]<eed->v2->co[cox]) {
+ if (eed->v1->co[cox]<eed->v2->co[cox]) {
minx= eed->v1->co[cox];
maxx= eed->v2->co[cox];
- } else {
+ }
+ else {
minx= eed->v2->co[cox];
maxx= eed->v1->co[cox];
}
- if(eve->co[cox]>=minx && eve->co[cox]<=maxx) {
- if(eed->v1->co[coy]<eed->v2->co[coy]) {
+ if (eve->co[cox]>=minx && eve->co[cox]<=maxx) {
+ if (eed->v1->co[coy]<eed->v2->co[coy]) {
miny= eed->v1->co[coy];
maxy= eed->v2->co[coy];
- } else {
+ }
+ else {
miny= eed->v2->co[coy];
maxy= eed->v1->co[coy];
}
- if(eve->co[coy]>=miny && eve->co[coy]<=maxy) return 1;
+ if (eve->co[coy]>=miny && eve->co[coy]<=maxy) return 1;
}
return 0;
}
@@ -430,30 +433,30 @@ static void testvertexnearedge(void)
float dist,vec1[2],vec2[2],vec3[2];
eve= fillvertbase.first;
- while(eve) {
- if(eve->h==1) {
+ while (eve) {
+ if (eve->h==1) {
vec3[0]= eve->co[cox];
vec3[1]= eve->co[coy];
/* find the edge which has vertex eve */
ed1= filledgebase.first;
- while(ed1) {
- if(ed1->v1==eve || ed1->v2==eve) break;
+ while (ed1) {
+ if (ed1->v1==eve || ed1->v2==eve) break;
ed1= ed1->next;
}
- if(ed1->v1==eve) {
+ if (ed1->v1==eve) {
ed1->v1= ed1->v2;
ed1->v2= eve;
}
eed= filledgebase.first;
- while(eed) {
+ while (eed) {
if (eve != eed->v1 && eve != eed->v2 && eve->poly_nr == eed->poly_nr) {
- if(compare_v3v3(eve->co,eed->v1->co, COMPLIMIT)) {
+ if (compare_v3v3(eve->co,eed->v1->co, COMPLIMIT)) {
ed1->v2= eed->v1;
eed->v1->h++;
eve->h= 0;
break;
}
- else if(compare_v3v3(eve->co,eed->v2->co, COMPLIMIT)) {
+ else if (compare_v3v3(eve->co,eed->v2->co, COMPLIMIT)) {
ed1->v2= eed->v2;
eed->v2->h++;
eve->h= 0;
@@ -464,9 +467,9 @@ static void testvertexnearedge(void)
vec1[1]= eed->v1->co[coy];
vec2[0]= eed->v2->co[cox];
vec2[1]= eed->v2->co[coy];
- if(boundinsideEV(eed,eve)) {
+ if (boundinsideEV(eed,eve)) {
dist= dist_to_line_v2(vec1,vec2,vec3);
- if(dist<(float)COMPLIMIT) {
+ if (dist<(float)COMPLIMIT) {
/* new edge */
ed1= BLI_addfilledge(eed->v1, eve);
@@ -497,7 +500,7 @@ static void splitlist(ListBase *tempve, ListBase *temped, short nr)
BLI_movelisttolist(temped,&filledgebase);
eve= tempve->first;
- while(eve) {
+ while (eve) {
nextve= eve->next;
if (eve->poly_nr == nr) {
BLI_remlink(tempve,eve);
@@ -506,9 +509,9 @@ static void splitlist(ListBase *tempve, ListBase *temped, short nr)
eve= nextve;
}
eed= temped->first;
- while(eed) {
+ while (eed) {
nexted= eed->next;
- if(eed->poly_nr==nr) {
+ if (eed->poly_nr==nr) {
BLI_remlink(temped,eed);
BLI_addtail(&filledgebase,eed);
}
@@ -532,12 +535,12 @@ static int scanfill(PolyFill *pf)
#if 0
verts= pf->verts;
eve= fillvertbase.first;
- while(eve) {
+ while (eve) {
printf("vert: %x co: %f %f\n",eve,eve->co[cox],eve->co[coy]);
eve= eve->next;
}
eed= filledgebase.first;
- while(eed) {
+ while (eed) {
printf("edge: %x verts: %x %x\n",eed,eed->v1,eed->v2);
eed= eed->next;
}
@@ -545,18 +548,18 @@ static int scanfill(PolyFill *pf)
/* STEP 0: remove zero sized edges */
eed= filledgebase.first;
- while(eed) {
- if(eed->v1->co[cox]==eed->v2->co[cox]) {
- if(eed->v1->co[coy]==eed->v2->co[coy]) {
- if(eed->v1->f==255 && eed->v2->f!=255) {
+ while (eed) {
+ if (eed->v1->co[cox]==eed->v2->co[cox]) {
+ if (eed->v1->co[coy]==eed->v2->co[coy]) {
+ if (eed->v1->f==255 && eed->v2->f!=255) {
eed->v2->f= 255;
eed->v2->tmp.v= eed->v1->tmp.v;
}
- else if(eed->v2->f==255 && eed->v1->f!=255) {
+ else if (eed->v2->f==255 && eed->v1->f!=255) {
eed->v1->f= 255;
eed->v1->tmp.v= eed->v2->tmp.v;
}
- else if(eed->v2->f==255 && eed->v1->f==255) {
+ else if (eed->v2->f==255 && eed->v1->f==255) {
eed->v1->tmp.v= eed->v2->tmp.v;
}
else {
@@ -574,7 +577,7 @@ static int scanfill(PolyFill *pf)
sc= scdata= (ScanFillVertLink *)MEM_callocN(pf->verts*sizeof(ScanFillVertLink),"Scanfill1");
eve= fillvertbase.first;
verts= 0;
- while(eve) {
+ while (eve) {
if (eve->poly_nr == nr) {
if (eve->f != 255) {
verts++;
@@ -589,7 +592,7 @@ static int scanfill(PolyFill *pf)
qsort(scdata, verts, sizeof(ScanFillVertLink), vergscdata);
eed= filledgebase.first;
- while(eed) {
+ while (eed) {
nexted= eed->next;
BLI_remlink(&filledgebase,eed);
/* This code is for handling zero-length edges that get
@@ -597,26 +600,26 @@ static int scanfill(PolyFill *pf)
* fix trunk bug #4544, so if that comes back, this code
* may need some work, or there will have to be a better
* fix to #4544. */
- if(eed->v1->f==255) {
+ if (eed->v1->f==255) {
v1= eed->v1;
- while((eed->v1->f == 255) && (eed->v1->tmp.v != v1))
+ while ((eed->v1->f == 255) && (eed->v1->tmp.v != v1))
eed->v1 = eed->v1->tmp.v;
}
- if(eed->v2->f==255) {
+ if (eed->v2->f==255) {
v2= eed->v2;
- while((eed->v2->f == 255) && (eed->v2->tmp.v != v2))
+ while ((eed->v2->f == 255) && (eed->v2->tmp.v != v2))
eed->v2 = eed->v2->tmp.v;
}
- if(eed->v1!=eed->v2) addedgetoscanlist(eed,verts);
+ if (eed->v1!=eed->v2) addedgetoscanlist(eed,verts);
eed= nexted;
}
#if 0
sc= scdata;
- for(a=0;a<verts;a++) {
+ for (a=0;a<verts;a++) {
printf("\nscvert: %x\n",sc->v1);
eed= sc->first;
- while(eed) {
+ while (eed) {
printf(" ed %x %x %x\n",eed,eed->v1,eed->v2);
eed= eed->next;
}
@@ -627,66 +630,67 @@ static int scanfill(PolyFill *pf)
/* STEP 2: FILL LOOP */
- if(pf->f==0) twoconnected= 1;
+ if (pf->f==0) twoconnected= 1;
/* (temporal) security: never much more faces than vertices */
totface= 0;
maxface= 2*verts; /* 2*verts: based at a filled circle within a triangle */
sc= scdata;
- for(a=0;a<verts;a++) {
+ for (a=0;a<verts;a++) {
/* printf("VERTEX %d %x\n",a,sc->v1); */
ed1= sc->first;
- while(ed1) { /* set connectflags */
+ while (ed1) { /* set connectflags */
nexted= ed1->next;
- if(ed1->v1->h==1 || ed1->v2->h==1) {
+ if (ed1->v1->h==1 || ed1->v2->h==1) {
BLI_remlink((ListBase *)&(sc->first),ed1);
BLI_addtail(&filledgebase,ed1);
- if(ed1->v1->h>1) ed1->v1->h--;
- if(ed1->v2->h>1) ed1->v2->h--;
+ if (ed1->v1->h>1) ed1->v1->h--;
+ if (ed1->v2->h>1) ed1->v2->h--;
}
else ed1->v2->f= 1;
ed1= nexted;
}
- while(sc->first) { /* for as long there are edges */
+ while (sc->first) { /* for as long there are edges */
ed1= sc->first;
ed2= ed1->next;
/* commented out... the ESC here delivers corrupted memory (and doesnt work during grab) */
- /* if(callLocalInterruptCallBack()) break; */
- if(totface>maxface) {
+ /* if (callLocalInterruptCallBack()) break; */
+ if (totface>maxface) {
/* printf("Fill error: endless loop. Escaped at vert %d, tot: %d.\n", a, verts); */
a= verts;
break;
}
- if(ed2==0) {
+ if (ed2==0) {
sc->first=sc->last= 0;
/* printf("just 1 edge to vert\n"); */
BLI_addtail(&filledgebase,ed1);
ed1->v2->f= 0;
ed1->v1->h--;
ed1->v2->h--;
- } else {
+ }
+ else {
/* test rest of vertices */
v1= ed1->v2;
v2= ed1->v1;
v3= ed2->v2;
/* this happens with a serial of overlapping edges */
- if(v1==v2 || v2==v3) break;
+ if (v1==v2 || v2==v3) break;
/* printf("test verts %x %x %x\n",v1,v2,v3); */
miny = ( (v1->co[coy])<(v3->co[coy]) ? (v1->co[coy]) : (v3->co[coy]) );
/* miny= MIN2(v1->co[coy],v3->co[coy]); */
sc1= sc+1;
test= 0;
- for(b=a+1;b<verts;b++) {
- if(sc1->v1->f==0) {
- if(sc1->v1->co[coy] <= miny) break;
+ for (b=a+1;b<verts;b++) {
+ if (sc1->v1->f==0) {
+ if (sc1->v1->co[coy] <= miny) break;
- if(testedgeside(v1->co,v2->co,sc1->v1->co))
- if(testedgeside(v2->co,v3->co,sc1->v1->co))
- if(testedgeside(v3->co,v1->co,sc1->v1->co)) {
+ if (testedgeside(v1->co,v2->co,sc1->v1->co))
+ if (testedgeside(v2->co,v3->co,sc1->v1->co))
+ if (testedgeside(v3->co,v1->co,sc1->v1->co)) {
/* point in triangle */
test= 1;
@@ -695,7 +699,7 @@ static int scanfill(PolyFill *pf)
}
sc1++;
}
- if(test) {
+ if (test) {
/* make new edge, and start over */
/* printf("add new edge %x %x and start again\n",v2,sc1->v1); */
@@ -718,7 +722,7 @@ static int scanfill(PolyFill *pf)
ed1->v1->h--;
ed1->v2->h--;
/* ed2 can be removed when it's a boundary edge */
- if((ed2->f == 0 && twoconnected) || (ed2->f == FILLBOUNDARY)) {
+ if ((ed2->f == 0 && twoconnected) || (ed2->f == FILLBOUNDARY)) {
BLI_remlink((ListBase *)&(sc->first),ed2);
BLI_addtail(&filledgebase,ed2);
ed2->v2->f= 0;
@@ -736,14 +740,14 @@ static int scanfill(PolyFill *pf)
/* printf("add new edge %x %x\n",v1,v3); */
sc1= addedgetoscanlist(ed3, verts);
- if(sc1) { /* ed3 already exists: remove if a boundary */
+ if (sc1) { /* ed3 already exists: remove if a boundary */
/* printf("Edge exists\n"); */
ed3->v1->h--;
ed3->v2->h--;
ed3= sc1->first;
- while(ed3) {
- if( (ed3->v1==v1 && ed3->v2==v3) || (ed3->v1==v3 && ed3->v2==v1) ) {
+ while (ed3) {
+ if ( (ed3->v1==v1 && ed3->v2==v3) || (ed3->v1==v3 && ed3->v2==v1) ) {
if (twoconnected || ed3->f==FILLBOUNDARY) {
BLI_remlink((ListBase *)&(sc1->first),ed3);
BLI_addtail(&filledgebase,ed3);
@@ -760,13 +764,13 @@ static int scanfill(PolyFill *pf)
}
/* test for loose edges */
ed1= sc->first;
- while(ed1) {
+ while (ed1) {
nexted= ed1->next;
- if(ed1->v1->h<2 || ed1->v2->h<2) {
+ if (ed1->v1->h<2 || ed1->v2->h<2) {
BLI_remlink((ListBase *)&(sc->first),ed1);
BLI_addtail(&filledgebase,ed1);
- if(ed1->v1->h>1) ed1->v1->h--;
- if(ed1->v2->h>1) ed1->v2->h--;
+ if (ed1->v1->h>1) ed1->v1->h--;
+ if (ed1->v2->h>1) ed1->v2->h--;
}
ed1= nexted;
@@ -809,7 +813,7 @@ int BLI_edgefill(short mat_nr)
/* reset variables */
eve= fillvertbase.first;
a = 0;
- while(eve) {
+ while (eve) {
eve->f= 0;
eve->poly_nr= 0;
eve->h= 0;
@@ -822,7 +826,8 @@ int BLI_edgefill(short mat_nr)
addfillface(eve, eve->next, eve->next->next);
return 1;
- } else if (a == 4 && (mat_nr & 2)) {
+ }
+ else if (a == 4 && (mat_nr & 2)) {
float vec1[3], vec2[3];
eve = fillvertbase.first;
@@ -835,11 +840,13 @@ int BLI_edgefill(short mat_nr)
if (dot_v3v3(vec1, vec1) < dot_v3v3(vec2, vec2)) {
addfillface(eve, eve->next, eve->next->next);
addfillface(eve->next->next, eve->next->next->next, eve);
- } else{
+ }
+ else {
addfillface(eve->next, eve->next->next, eve->next->next->next);
addfillface(eve->next->next->next, eve, eve->next);
}
- } else {
+ }
+ else {
addfillface(eve, eve->next, eve->next->next);
addfillface(eve->next->next, eve->next->next->next, eve);
}
@@ -849,7 +856,7 @@ int BLI_edgefill(short mat_nr)
/* first test vertices if they are in edges */
/* including resetting of flags */
eed= filledgebase.first;
- while(eed) {
+ while (eed) {
eed->poly_nr= 0;
eed->v1->f= 1;
eed->v2->f= 1;
@@ -858,54 +865,53 @@ int BLI_edgefill(short mat_nr)
}
eve= fillvertbase.first;
- while(eve) {
- if(eve->f & 1) {
+ while (eve) {
+ if (eve->f & 1) {
ok=1;
break;
}
eve= eve->next;
}
- if(ok==0) return 0;
+ if (ok==0) return 0;
/* NEW NEW! define projection: with 'best' normal */
/* just use the first three different vertices */
/* THIS PART STILL IS PRETTY WEAK! (ton) */
-
+
eve= fillvertbase.last;
len= 0.0;
v1= eve->co;
v2= 0;
eve= fillvertbase.first;
- limit = a < 5 ? FLT_EPSILON*200 : M_PI/24.0;
- while(eve) {
- if(v2) {
- if( compare_v3v3(v2, eve->co, COMPLIMIT)==0) {
+ limit = 1e-8f;
+
+ while (eve) {
+ if (v2) {
+ if (!compare_v3v3(v2, eve->co, COMPLIMIT)) {
float inner = angle_v3v3v3(v1, v2, eve->co);
-
- if (fabsf(inner-M_PI) < limit || fabsf(inner) < limit) {
- eve = eve->next;
- continue;
- }
+ inner = MIN2(fabsf(inner), fabsf(M_PI - inner));
- len= normal_tri_v3( norm,v1, v2, eve->co);
- if(len != 0.0f) break;
+ if (inner > limit) {
+ limit = inner;
+ len= normal_tri_v3(norm, v1, v2, eve->co);
+ }
}
}
- else if(compare_v3v3(v1, eve->co, COMPLIMIT)==0) {
+ else if (!compare_v3v3(v1, eve->co, COMPLIMIT))
v2= eve->co;
- }
+
eve= eve->next;
}
- if(len==0.0f) return 0; /* no fill possible */
+ if (len==0.0f) return 0; /* no fill possible */
axis_dominant_v3(&cox, &coy, norm);
/* STEP 1: COUNT POLYS */
eve= fillvertbase.first;
- while(eve) {
+ while (eve) {
/* get first vertex with no poly number */
if (eve->poly_nr==0) {
poly++;
@@ -913,14 +919,14 @@ int BLI_edgefill(short mat_nr)
ok= 1;
eve->poly_nr = poly;
- while(ok) {
+ while (ok) {
ok= 0;
toggle++;
- if(toggle & 1) eed= filledgebase.first;
+ if (toggle & 1) eed= filledgebase.first;
else eed= filledgebase.last;
- while(eed) {
+ while (eed) {
if (eed->v1->poly_nr == 0 && eed->v2->poly_nr == poly) {
eed->v1->poly_nr = poly;
eed->poly_nr= poly;
@@ -937,7 +943,7 @@ int BLI_edgefill(short mat_nr)
ok= 1;
}
}
- if(toggle & 1) eed= eed->next;
+ if (toggle & 1) eed= eed->next;
else eed= eed->prev;
}
}
@@ -948,12 +954,12 @@ int BLI_edgefill(short mat_nr)
/* STEP 2: remove loose edges and strings of edges */
eed= filledgebase.first;
- while(eed) {
- if(eed->v1->h++ >250) break;
- if(eed->v2->h++ >250) break;
+ while (eed) {
+ if (eed->v1->h++ >250) break;
+ if (eed->v2->h++ >250) break;
eed= eed->next;
}
- if(eed) {
+ if (eed) {
/* otherwise it's impossible to be sure you can clear vertices */
callLocalErrorCallBack("No vertices with 250 edges allowed!");
return 0;
@@ -963,21 +969,21 @@ int BLI_edgefill(short mat_nr)
testvertexnearedge();
ok= 1;
- while(ok) {
+ while (ok) {
ok= 0;
toggle++;
- if(toggle & 1) eed= filledgebase.first;
+ if (toggle & 1) eed= filledgebase.first;
else eed= filledgebase.last;
- while(eed) {
- if(toggle & 1) nexted= eed->next;
+ while (eed) {
+ if (toggle & 1) nexted= eed->next;
else nexted= eed->prev;
- if(eed->v1->h==1) {
+ if (eed->v1->h==1) {
eed->v2->h--;
BLI_remlink(&fillvertbase,eed->v1);
BLI_remlink(&filledgebase,eed);
ok= 1;
}
- else if(eed->v2->h==1) {
+ else if (eed->v2->h==1) {
eed->v1->h--;
BLI_remlink(&fillvertbase,eed->v2);
BLI_remlink(&filledgebase,eed);
@@ -986,7 +992,7 @@ int BLI_edgefill(short mat_nr)
eed= nexted;
}
}
- if(filledgebase.first==0) {
+ if (filledgebase.first==0) {
/* printf("All edges removed\n"); */
return 0;
}
@@ -1006,20 +1012,20 @@ int BLI_edgefill(short mat_nr)
/* STEP 3: MAKE POLYFILL STRUCT */
pflist= (PolyFill *)MEM_callocN(poly*sizeof(PolyFill),"edgefill");
pf= pflist;
- for(a=1;a<=poly;a++) {
+ for (a=1;a<=poly;a++) {
pf->nr= a;
pf->min[0]=pf->min[1]=pf->min[2]= 1.0e20;
pf->max[0]=pf->max[1]=pf->max[2]= -1.0e20;
pf++;
}
eed= filledgebase.first;
- while(eed) {
+ while (eed) {
pflist[eed->poly_nr-1].edges++;
eed= eed->next;
}
eve= fillvertbase.first;
- while(eve) {
+ while (eve) {
pflist[eve->poly_nr-1].verts++;
minp= pflist[eve->poly_nr-1].min;
maxp= pflist[eve->poly_nr-1].max;
@@ -1028,7 +1034,7 @@ int BLI_edgefill(short mat_nr)
minp[coy]= (minp[coy])<(eve->co[coy]) ? (minp[coy]) : (eve->co[coy]);
maxp[cox]= (maxp[cox])>(eve->co[cox]) ? (maxp[cox]) : (eve->co[cox]);
maxp[coy]= (maxp[coy])>(eve->co[coy]) ? (maxp[coy]) : (eve->co[coy]);
- if(eve->h > 2) pflist[eve->poly_nr-1].f = 1;
+ if (eve->h > 2) pflist[eve->poly_nr-1].f = 1;
eve= eve->next;
}
@@ -1038,7 +1044,7 @@ int BLI_edgefill(short mat_nr)
* the edgefill itself has good auto-hole detection)
* WATCH IT: ONLY WORKS WITH SORTED POLYS!!! */
- if(poly>1) {
+ if (poly>1) {
short *polycache, *pc;
/* so, sort first */
@@ -1046,7 +1052,7 @@ int BLI_edgefill(short mat_nr)
#if 0
pf= pflist;
- for(a=1;a<=poly;a++) {
+ for (a=1;a<=poly;a++) {
printf("poly:%d edges:%d verts:%d flag: %d\n",a,pf->edges,pf->verts,pf->f);
PRINT2(f, f, pf->min[0], pf->min[1]);
pf++;
@@ -1055,21 +1061,21 @@ int BLI_edgefill(short mat_nr)
polycache= pc= MEM_callocN(sizeof(short)*poly, "polycache");
pf= pflist;
- for(a=0; a<poly; a++, pf++) {
- for(c=a+1;c<poly;c++) {
+ for (a=0; a<poly; a++, pf++) {
+ for (c=a+1;c<poly;c++) {
/* if 'a' inside 'c': join (bbox too)
* Careful: 'a' can also be inside another poly.
*/
- if(boundisect(pf, pflist+c)) {
+ if (boundisect(pf, pflist+c)) {
*pc= c;
pc++;
}
/* only for optimize! */
- /* else if(pf->max[cox] < (pflist+c)->min[cox]) break; */
+ /* else if (pf->max[cox] < (pflist+c)->min[cox]) break; */
}
- while(pc!=polycache) {
+ while (pc!=polycache) {
pc--;
mergepolysSimp(pf, pflist+ *pc);
}
@@ -1080,7 +1086,7 @@ int BLI_edgefill(short mat_nr)
#if 0
printf("after merge\n");
pf= pflist;
- for(a=1;a<=poly;a++) {
+ for (a=1;a<=poly;a++) {
printf("poly:%d edges:%d verts:%d flag: %d\n",a,pf->edges,pf->verts,pf->f);
pf++;
}
@@ -1096,8 +1102,8 @@ int BLI_edgefill(short mat_nr)
filledgebase.first=filledgebase.last= 0;
pf= pflist;
- for(a=0;a<poly;a++) {
- if(pf->edges>1) {
+ for (a=0;a<poly;a++) {
+ if (pf->edges>1) {
splitlist(&tempve,&temped,pf->nr);
totfaces += scanfill(pf);
}
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 29f11ee0550..01ebd1dce57 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -78,6 +78,7 @@
#include <io.h>
#include <direct.h>
#include "BLI_winstuff.h"
+#include "utfconv.h"
#endif
@@ -86,10 +87,13 @@
#include "DNA_listBase.h"
-#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_linklist.h"
+#include "BLI_fileops.h"
+
+#include "BLI_fileops_types.h"
#include "BLI_string.h"
+#include "BLI_fileops.h"
#include "BKE_utildefines.h"
@@ -119,22 +123,24 @@ static int bli_compare(struct direntry *entry1, struct direntry *entry2)
if (S_ISDIR(entry1->type)) {
if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
+ }
+ else {
if (S_ISDIR(entry2->type)) return (1);
}
if (S_ISREG(entry1->type)) {
if (S_ISREG(entry2->type)==0) return (-1);
- } else{
+ }
+ else {
if (S_ISREG(entry2->type)) return (1);
}
if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
/* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
- if( strcmp(entry2->relname, "..")==0 ) return (1);
+ if ( strcmp(entry1->relname, ".")==0 ) return (-1);
+ if ( strcmp(entry2->relname, ".")==0 ) return (1);
+ if ( strcmp(entry1->relname, "..")==0 ) return (-1);
+ if ( strcmp(entry2->relname, "..")==0 ) return (1);
return (BLI_natstrcmp(entry1->relname,entry2->relname));
}
@@ -150,7 +156,8 @@ double BLI_dir_free_space(const char *dir)
if (dir[0]=='/' || dir[0]=='\\') {
tmp[0]='\\';
tmp[1]=0;
- } else if (dir[1]==':') {
+ }
+ else if (dir[1]==':') {
tmp[0]=dir[0];
tmp[1]=':';
tmp[2]='\\';
@@ -175,10 +182,11 @@ double BLI_dir_free_space(const char *dir)
strcpy(name,dir);
- if(len) {
+ if (len) {
slash = strrchr(name,'/');
if (slash) slash[1] = 0;
- } else strcpy(name,"/");
+ }
+ else strcpy(name,"/");
#if defined (__FreeBSD__) || defined (linux) || defined (__OpenBSD__) || defined (__APPLE__) || defined(__GNU__) || defined(__GLIBC__)
if (statfs(name, &disk)) return(-1);
@@ -210,12 +218,21 @@ static void bli_builddir(const char *dirname, const char *relname)
buf[rellen]='/';
rellen++;
}
-
+#ifndef WIN32
if (chdir(dirname) == -1) {
perror(dirname);
return;
}
+#else
+ UTF16_ENCODE(dirname)
+ if (!SetCurrentDirectoryW(dirname_16)) {
+ perror(dirname);
+ free(dirname_16);
+ return;
+ }
+ UTF16_UN_ENCODE(dirname)
+#endif
if ( (dir = (DIR *)opendir(".")) ) {
while ((fname = (struct dirent*) readdir(dir)) != NULL) {
dlink = (struct dirlink *)malloc(sizeof(struct dirlink));
@@ -229,9 +246,9 @@ static void bli_builddir(const char *dirname, const char *relname)
if (newnum) {
- if(files) {
+ if (files) {
void *tmp= realloc(files, (totnum+newnum) * sizeof(struct direntry));
- if(tmp) {
+ if (tmp) {
files= (struct direntry *)tmp;
}
else { /* realloc fail */
@@ -240,21 +257,26 @@ static void bli_builddir(const char *dirname, const char *relname)
}
}
- if(files==NULL)
+ if (files==NULL)
files=(struct direntry *)malloc(newnum * sizeof(struct direntry));
if (files) {
dlink = (struct dirlink *) dirbase->first;
- while(dlink) {
+ while (dlink) {
memset(&files[actnum], 0 , sizeof(struct direntry));
files[actnum].relname = dlink->name;
files[actnum].path = BLI_strdupcat(dirname, dlink->name);
// use 64 bit file size, only needed for WIN32 and WIN64.
-// Excluding other than current MSVC compiler until able to test.
+// Excluding other than current MSVC compiler until able to test
+#ifdef WIN32
+ {wchar_t * name_16 = alloc_utf16_from_8(dlink->name,0);
#if (defined(WIN32) || defined(WIN64)) && (_MSC_VER>=1500)
- _stat64(dlink->name,&files[actnum].s);
+ _wstat64(name_16,&files[actnum].s);
#elif defined(__MINGW32__)
_stati64(dlink->name,&files[actnum].s);
+#endif
+ free(name_16);};
+
#else
stat(dlink->name,&files[actnum].s);
#endif
@@ -264,19 +286,22 @@ static void bli_builddir(const char *dirname, const char *relname)
actnum++;
dlink = dlink->next;
}
- } else{
+ }
+ else {
printf("Couldn't get memory for dir\n");
exit(1);
}
BLI_freelist(dirbase);
if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *,const void*))bli_compare);
- } else {
+ }
+ else {
printf("%s empty directory\n",dirname);
}
closedir(dir);
- } else {
+ }
+ else {
printf("%s non-existant directory\n",dirname);
}
}
@@ -298,7 +323,7 @@ static void bli_adddirstrings(void)
struct tm *tm;
time_t zero= 0;
- for(num=0, file= files; num<actnum; num++, file++) {
+ for (num=0, file= files; num<actnum; num++, file++) {
#ifdef WIN32
mode = 0;
BLI_strncpy(file->mode1, types[0], sizeof(file->mode1));
@@ -334,7 +359,8 @@ static void bli_adddirstrings(void)
pwuser = getpwuid(file->s.st_uid);
if ( pwuser ) {
BLI_strncpy(file->owner, pwuser->pw_name, sizeof(file->owner));
- } else {
+ }
+ else {
BLI_snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid);
}
}
@@ -342,7 +368,7 @@ static void bli_adddirstrings(void)
tm= localtime(&file->s.st_mtime);
// prevent impossible dates in windows
- if(tm==NULL) tm= localtime(&zero);
+ if (tm==NULL) tm= localtime(&zero);
strftime(file->time, sizeof(file->time), "%H:%M", tm);
strftime(file->date, sizeof(file->date), "%d-%b-%y", tm);
@@ -408,7 +434,8 @@ unsigned int BLI_dir_contents(const char *dirname, struct direntry **filelist)
if (files) {
*(filelist) = files;
- } else {
+ }
+ else {
// keep blender happy. Blender stores this in a variable
// where 0 has special meaning.....
*(filelist) = files = malloc(sizeof(struct direntry));
@@ -423,13 +450,13 @@ size_t BLI_file_descriptor_size(int file)
struct stat buf;
if (file <= 0) return (-1);
- fstat(file, &buf);
+ fstat(file, &buf);//CHANGE
return (buf.st_size);
}
size_t BLI_file_size(const char *path)
{
- int size, file = open(path, O_BINARY|O_RDONLY);
+ int size, file = BLI_open(path, O_BINARY|O_RDONLY, 0);
if (file == -1)
return -1;
@@ -442,27 +469,26 @@ size_t BLI_file_size(const char *path)
int BLI_exists(const char *name)
{
-#if defined(WIN32) && !defined(__MINGW32__)
+#if defined(WIN32)
+#ifndef __MINGW32__
struct _stat64i32 st;
- /* in Windows stat doesn't recognize dir ending on a slash
- * To not break code where the ending slash is expected we
- * don't mess with the argument name directly here - elubie */
- char tmp[FILE_MAX];
- int len, res;
- BLI_strncpy(tmp, name, FILE_MAX);
- len = strlen(tmp);
- if (len > 3 && ( tmp[len-1]=='\\' || tmp[len-1]=='/') ) tmp[len-1] = '\0';
- res = _stat(tmp, &st);
- if (res == -1) return(0);
-#elif defined(__MINGW32__)
+#else
struct _stati64 st;
- char tmp[FILE_MAX];
+#endif
+ /* in Windows stat doesn't recognize dir ending on a slash
+ To not break code where the ending slash is expected we
+ don't mess with the argument name directly here - elubie */
+ wchar_t * tmp_16 = alloc_utf16_from_8(name, 0);
int len, res;
- BLI_strncpy(tmp, name, FILE_MAX);
- len = strlen(tmp);
- if (len > 3 && ( tmp[len-1]=='\\' || tmp[len-1]=='/') ) tmp[len-1] = '\0';
- res = _stati64(tmp, &st);
- if (res) return(0);
+ len = wcslen(tmp_16);
+ if (len > 3 && ( tmp_16[len-1]==L'\\' || tmp_16[len-1]==L'/') ) tmp_16[len-1] = '\0';
+#ifndef __MINGW32__
+ res = _wstat(tmp_16, &st);
+#else
+ res = _wstati64(tmp_16, &st);
+#endif
+ free(tmp_16);
+ if (res == -1) return(0);
#else
struct stat st;
if (stat(name,&st)) return(0);
@@ -484,7 +510,7 @@ int BLI_is_file(const char *path)
LinkNode *BLI_file_read_as_lines(const char *name)
{
- FILE *fp= fopen(name, "r");
+ FILE *fp= BLI_fopen(name, "r");
LinkNode *lines= NULL;
char *buf;
size_t size;
@@ -530,11 +556,23 @@ void BLI_file_free_lines(LinkNode *lines)
int BLI_file_older(const char *file1, const char *file2)
{
- struct stat st1, st2;
+#if WIN32
+ struct _stat st1, st2;
- if(stat(file1, &st1)) return 0;
- if(stat(file2, &st2)) return 0;
+ UTF16_ENCODE(file1)
+ UTF16_ENCODE(file2)
+
+ if (_wstat(file1_16, &st1)) return 0;
+ if (_wstat(file2_16, &st2)) return 0;
+ UTF16_UN_ENCODE(file2)
+ UTF16_UN_ENCODE(file1)
+#else
+ struct stat st1, st2;
+
+ if (stat(file1, &st1)) return 0;
+ if (stat(file2, &st2)) return 0;
+#endif
return (st1.st_mtime < st2.st_mtime);
}
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 80f1606414c..4c92a872ed7 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -124,7 +124,7 @@ char *BLI_sprintfN(const char *format, ...)
size_t BLI_strescape(char *dst, const char *src, const size_t maxlen)
{
size_t len= 0;
- while(len < maxlen) {
+ while (len < maxlen) {
switch(*src) {
case '\0':
goto escape_finish;
@@ -135,7 +135,7 @@ size_t BLI_strescape(char *dst, const char *src, const size_t maxlen)
case '\t':
case '\n':
case '\r':
- if(len + 1 < maxlen) {
+ if (len + 1 < maxlen) {
*dst++ = '\\';
len++;
}
@@ -292,9 +292,11 @@ int BLI_strcasecmp(const char *s1, const char *s2)
if (c1<c2) {
return -1;
- } else if (c1>c2) {
+ }
+ else if (c1>c2) {
return 1;
- } else if (c1==0) {
+ }
+ else if (c1==0) {
break;
}
}
@@ -312,9 +314,11 @@ int BLI_strncasecmp(const char *s1, const char *s2, size_t len)
if (c1<c2) {
return -1;
- } else if (c1>c2) {
+ }
+ else if (c1>c2) {
return 1;
- } else if (c1==0) {
+ }
+ else if (c1==0) {
break;
}
}
@@ -331,11 +335,11 @@ int BLI_natstrcmp(const char *s1, const char *s2)
* then increase string deltas as long they are
* numeric, else do a tolower and char compare */
- while(1) {
+ while (1) {
char c1 = tolower(s1[d1]);
char c2 = tolower(s2[d2]);
- if( isdigit(c1) && isdigit(c2) ) {
+ if ( isdigit(c1) && isdigit(c2) ) {
int val1, val2;
val1= (int)strtol(s1+d1, (char **)NULL, 10);
@@ -343,14 +347,15 @@ int BLI_natstrcmp(const char *s1, const char *s2)
if (val1<val2) {
return -1;
- } else if (val1>val2) {
+ }
+ else if (val1>val2) {
return 1;
}
d1++;
- while( isdigit(s1[d1]) )
+ while ( isdigit(s1[d1]) )
d1++;
d2++;
- while( isdigit(s2[d2]) )
+ while ( isdigit(s2[d2]) )
d2++;
c1 = tolower(s1[d1]);
@@ -358,15 +363,17 @@ int BLI_natstrcmp(const char *s1, const char *s2)
}
/* first check for '.' so "foo.bar" comes before "foo 1.bar" */
- if(c1=='.' && c2!='.')
+ if (c1=='.' && c2!='.')
return -1;
- if(c1!='.' && c2=='.')
+ if (c1!='.' && c2=='.')
return 1;
else if (c1<c2) {
return -1;
- } else if (c1>c2) {
+ }
+ else if (c1>c2) {
return 1;
- } else if (c1==0) {
+ }
+ else if (c1==0) {
break;
}
d1++;
@@ -385,7 +392,8 @@ void BLI_timestr(double _time, char *str)
if (hr) {
sprintf(str, "%.2d:%.2d:%.2d.%.2d",hr,min,sec,hun);
- } else {
+ }
+ else {
sprintf(str, "%.2d:%.2d.%.2d",min,sec,hun);
}
@@ -403,8 +411,8 @@ void BLI_ascii_strtolower(char *str, int len)
{
int i;
- for(i=0; i<len; i++)
- if(str[i] >= 'A' && str[i] <= 'Z')
+ for (i=0; i<len; i++)
+ if (str[i] >= 'A' && str[i] <= 'Z')
str[i] += 'a' - 'A';
}
@@ -412,8 +420,8 @@ void BLI_ascii_strtoupper(char *str, int len)
{
int i;
- for(i=0; i<len; i++)
- if(str[i] >= 'a' && str[i] <= 'z')
+ for (i=0; i<len; i++)
+ if (str[i] >= 'a' && str[i] <= 'z')
str[i] -= 'a' - 'A';
}
diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c
index 56998cfd927..97559d6ba10 100644
--- a/source/blender/blenlib/intern/string_cursor_utf8.c
+++ b/source/blender/blenlib/intern/string_cursor_utf8.c
@@ -48,19 +48,21 @@ typedef enum strCursorDelimType {
} strCursorDelimType;
/* return 1 if char ch is special character, otherwise return 0 */
-static strCursorDelimType test_special_char(const char ch)
+static strCursorDelimType test_special_char(const char *ch_utf8)
{
- /* TODO - use BLI_str_utf8_as_unicode rather then assuming ascii */
+ /* for full unicode support we really need to have large lookup tables to figure
+ * out whats what in every possible char set - and python, glib both have these. */
+ unsigned int uch = BLI_str_utf8_as_unicode(ch_utf8);
- if ((ch >= 'a' && ch <= 'z') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch == '_') /* not quite correct but allow for python, could become configurable */
+ if ((uch >= 'a' && uch <= 'z') ||
+ (uch >= 'A' && uch <= 'Z') ||
+ (uch == '_') /* not quite correct but allow for python, could become configurable */
)
{
return STRCUR_DELIM_ALPHA;
}
- switch (ch) {
+ switch (uch) {
case ',':
case '.':
return STRCUR_DELIM_PUNCT;
@@ -101,7 +103,7 @@ static strCursorDelimType test_special_char(const char ch)
case ':':
case ';':
case '?':
- /* case '_': */ /* special case, for python */
+ /* case '_': *//* special case, for python */
return STRCUR_DELIM_OTHER;
default:
@@ -112,12 +114,14 @@ static strCursorDelimType test_special_char(const char ch)
int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos)
{
- const char *str_end= str + (maxlen + 1);
- const char *str_pos= str + (*pos);
- const char *str_next= BLI_str_find_next_char_utf8(str_pos, str_end);
+ const char *str_end = str + (maxlen + 1);
+ const char *str_pos = str + (*pos);
+ const char *str_next = BLI_str_find_next_char_utf8(str_pos, str_end);
if (str_next) {
(*pos) += (str_next - str_pos);
- if((*pos) > maxlen) (*pos)= maxlen;
+ if ((*pos) > maxlen) {
+ (*pos) = maxlen;
+ }
return TRUE;
}
@@ -126,9 +130,9 @@ int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos)
int BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int *pos)
{
- if((*pos) > 0) {
- const char *str_pos= str + (*pos);
- const char *str_prev= BLI_str_find_prev_char_utf8(str, str_pos);
+ if ((*pos) > 0) {
+ const char *str_pos = str + (*pos);
+ const char *str_prev = BLI_str_find_prev_char_utf8(str, str_pos);
if (str_prev) {
(*pos) -= (str_pos - str_prev);
return TRUE;
@@ -142,19 +146,20 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
int *pos, strCursorJumpDirection direction,
strCursorJumpType jump)
{
- const short pos_prev= *pos;
+ const short pos_prev = *pos;
if (direction == STRCUR_DIR_NEXT) {
BLI_str_cursor_step_next_utf8(str, maxlen, pos);
if (jump != STRCUR_JUMP_NONE) {
- const strCursorDelimType is_special= (*pos) < maxlen ? test_special_char(str[(*pos)]) : STRCUR_DELIM_NONE;
+ const strCursorDelimType is_special = (*pos) < maxlen ? test_special_char(&str[*pos]) : STRCUR_DELIM_NONE;
/* jump between special characters (/,\,_,-, etc.),
* look at function test_special_char() for complete
* list of special character, ctr -> */
while ((*pos) < maxlen) {
if (BLI_str_cursor_step_next_utf8(str, maxlen, pos)) {
- if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(str[(*pos)]))) break;
+ if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(&str[*pos])))
+ break;
}
else {
break; /* unlikely but just in case */
@@ -165,14 +170,15 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
else if (direction == STRCUR_DIR_PREV) {
BLI_str_cursor_step_prev_utf8(str, maxlen, pos);
- if(jump != STRCUR_JUMP_NONE) {
- const strCursorDelimType is_special= (*pos) > 1 ? test_special_char(str[(*pos) - 1]) : STRCUR_DELIM_NONE;
+ if (jump != STRCUR_JUMP_NONE) {
+ const strCursorDelimType is_special = (*pos) > 1 ? test_special_char(&str[(*pos) - 1]) : STRCUR_DELIM_NONE;
/* jump between special characters (/,\,_,-, etc.),
* look at function test_special_char() for complete
* list of special character, ctr -> */
while ((*pos) > 0) {
if (BLI_str_cursor_step_prev_utf8(str, maxlen, pos)) {
- if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(str[(*pos)]))) break;
+ if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(&str[*pos])))
+ break;
}
else {
break;
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index c60df413161..aede08be7f9 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -126,11 +126,11 @@ int BLI_utf8_invalid_strip(char *str, int length)
{
int bad_char, tot= 0;
- while((bad_char= BLI_utf8_invalid_byte(str, length)) != -1) {
+ while ((bad_char= BLI_utf8_invalid_byte(str, length)) != -1) {
str += bad_char;
length -= bad_char;
- if(length == 0) {
+ if (length == 0) {
/* last character bad, strip it */
*str= '\0';
tot++;
@@ -166,7 +166,7 @@ static const size_t utf8_skip_data[256] = {
#define BLI_STR_UTF8_CPY(dst, src, maxncpy) \
{ \
size_t utf8_size; \
- while(*src != '\0' && (utf8_size= utf8_skip_data[*src]) < maxncpy) { \
+ while (*src != '\0' && (utf8_size= utf8_skip_data[*src]) < maxncpy) { \
maxncpy -= utf8_size; \
switch(utf8_size) { \
case 6: *dst ++ = *src ++; \
@@ -184,7 +184,7 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
{
char *dst_r= dst;
- /* note: currently we dont attempt to deal with invalid utf8 chars */
+ /* note: currently we don't attempt to deal with invalid utf8 chars */
BLI_STR_UTF8_CPY(dst, src, maxncpy)
return dst_r;
@@ -210,7 +210,7 @@ char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy)
size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy)
{
size_t len = 0;
- while(*src && len < maxcpy) { /* XXX can still run over the buffer because utf8 size isnt known :| */
+ while (*src && len < maxcpy) { /* XXX can still run over the buffer because utf8 size isn't known :| */
len += BLI_str_utf8_from_unicode(*src++, dst+len);
}
@@ -224,7 +224,7 @@ size_t BLI_wstrlen_utf8(const wchar_t *src)
{
size_t len = 0;
- while(*src) {
+ while (*src) {
len += BLI_str_utf8_from_unicode(*src++, NULL);
}
@@ -236,15 +236,17 @@ size_t BLI_strlen_utf8(const char *strc)
{
int len=0;
- while(*strc) {
+ while (*strc) {
if ((*strc & 0xe0) == 0xc0) {
- if((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00)
+ if ((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00)
strc++;
- } else if ((*strc & 0xf0) == 0xe0) {
- if((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00)
+ }
+ else if ((*strc & 0xf0) == 0xe0) {
+ if ((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00)
strc += 2;
- } else if ((*strc & 0xf8) == 0xf0) {
- if((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00)
+ }
+ else if ((*strc & 0xf8) == 0xf0) {
+ if ((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00)
strc += 3;
}
@@ -259,9 +261,9 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size
{
int len=0;
- if(dst_w==NULL || src_c==NULL) return(0);
+ if (dst_w==NULL || src_c==NULL) return(0);
- while(*src_c && len < maxcpy) {
+ while (*src_c && len < maxcpy) {
size_t step= 0;
unsigned int unicode= BLI_str_utf8_as_unicode_and_size(src_c, &step);
if (unicode != BLI_UTF8_ERR) {
@@ -284,7 +286,7 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size
/* copied from glib's gutf8.c */
/* note, glib uses unsigned int for unicode, best we do the same,
- * though we dont typedef it - campbell */
+ * though we don't typedef it - campbell */
#define UTF8_COMPUTE(Char, Mask, Len) \
if (Char < 128) { \
@@ -357,16 +359,16 @@ int BLI_str_utf8_size(const char *p)
**/
unsigned int BLI_str_utf8_as_unicode(const char *p)
{
- int i, mask = 0, len;
- unsigned int result;
- unsigned char c = (unsigned char) *p;
+ int i, mask = 0, len;
+ unsigned int result;
+ unsigned char c = (unsigned char) *p;
- UTF8_COMPUTE (c, mask, len);
- if (len == -1)
- return BLI_UTF8_ERR;
- UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
+ UTF8_COMPUTE (c, mask, len);
+ if (len == -1)
+ return BLI_UTF8_ERR;
+ UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
- return result;
+ return result;
}
/* variant that increments the length */
@@ -415,7 +417,7 @@ unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index)
* this is added for text drawing because some filepaths can have latin1
* characters */
UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
- if(result == BLI_UTF8_ERR) {
+ if (result == BLI_UTF8_ERR) {
len= 1;
result= *p;
}
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 3894a6a0b8e..19d9c2a9c65 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -78,8 +78,8 @@ static void *thread_tls_data;
*
* BLI_init_threads(&lb, do_something_func, maxthreads);
*
- * while(cont) {
- * if(BLI_available_threads(&lb) && !(escape loop event)) {
+ * while (cont) {
+ * if (BLI_available_threads(&lb) && !(escape loop event)) {
* // get new job (data pointer)
* // tag job 'processed
* BLI_insert_thread(&lb, job);
@@ -88,17 +88,17 @@ static void *thread_tls_data;
*
* // find if a job is ready, this the do_something_func() should write in job somewhere
* cont= 0;
- * for(go over all jobs)
- * if(job is ready) {
- * if(job was not removed) {
+ * for (go over all jobs)
+ * if (job is ready) {
+ * if (job was not removed) {
* BLI_remove_thread(&lb, job);
* }
* }
* else cont= 1;
* }
* // conditions to exit loop
- * if(if escape loop event) {
- * if(BLI_available_threadslots(&lb)==maxthreads)
+ * if (if escape loop event) {
+ * if (BLI_available_threadslots(&lb)==maxthreads)
* break;
* }
* }
@@ -153,13 +153,13 @@ void BLI_init_threads(ListBase *threadbase, void *(*do_thread)(void *), int tot)
{
int a;
- if(threadbase != NULL && tot > 0) {
+ if (threadbase != NULL && tot > 0) {
threadbase->first= threadbase->last= NULL;
- if(tot>RE_MAX_THREAD) tot= RE_MAX_THREAD;
- else if(tot<1) tot= 1;
+ if (tot>RE_MAX_THREAD) tot= RE_MAX_THREAD;
+ else if (tot<1) tot= 1;
- for(a=0; a<tot; a++) {
+ for (a=0; a<tot; a++) {
ThreadSlot *tslot= MEM_callocN(sizeof(ThreadSlot), "threadslot");
BLI_addtail(threadbase, tslot);
tslot->do_thread= do_thread;
@@ -167,7 +167,7 @@ void BLI_init_threads(ListBase *threadbase, void *(*do_thread)(void *), int tot)
}
}
- if(thread_levels == 0) {
+ if (thread_levels == 0) {
MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
@@ -187,8 +187,8 @@ int BLI_available_threads(ListBase *threadbase)
ThreadSlot *tslot;
int counter=0;
- for(tslot= threadbase->first; tslot; tslot= tslot->next) {
- if(tslot->avail)
+ for (tslot= threadbase->first; tslot; tslot= tslot->next) {
+ if (tslot->avail)
counter++;
}
return counter;
@@ -200,8 +200,8 @@ int BLI_available_thread_index(ListBase *threadbase)
ThreadSlot *tslot;
int counter=0;
- for(tslot= threadbase->first; tslot; tslot= tslot->next, counter++) {
- if(tslot->avail)
+ for (tslot= threadbase->first; tslot; tslot= tslot->next, counter++) {
+ if (tslot->avail)
return counter;
}
return 0;
@@ -229,8 +229,8 @@ void BLI_insert_thread(ListBase *threadbase, void *callerdata)
{
ThreadSlot *tslot;
- for(tslot= threadbase->first; tslot; tslot= tslot->next) {
- if(tslot->avail) {
+ for (tslot= threadbase->first; tslot; tslot= tslot->next) {
+ if (tslot->avail) {
tslot->avail= 0;
tslot->callerdata= callerdata;
pthread_create(&tslot->pthread, NULL, tslot_thread_start, tslot);
@@ -244,8 +244,8 @@ void BLI_remove_thread(ListBase *threadbase, void *callerdata)
{
ThreadSlot *tslot;
- for(tslot= threadbase->first; tslot; tslot= tslot->next) {
- if(tslot->callerdata==callerdata) {
+ for (tslot= threadbase->first; tslot; tslot= tslot->next) {
+ if (tslot->callerdata==callerdata) {
pthread_join(tslot->pthread, NULL);
tslot->callerdata= NULL;
tslot->avail= 1;
@@ -258,7 +258,7 @@ void BLI_remove_thread_index(ListBase *threadbase, int index)
ThreadSlot *tslot;
int counter=0;
- for(tslot = threadbase->first; tslot; tslot = tslot->next, counter++) {
+ for (tslot = threadbase->first; tslot; tslot = tslot->next, counter++) {
if (counter == index && tslot->avail == 0) {
pthread_join(tslot->pthread, NULL);
tslot->callerdata = NULL;
@@ -272,7 +272,7 @@ void BLI_remove_threads(ListBase *threadbase)
{
ThreadSlot *tslot;
- for(tslot = threadbase->first; tslot; tslot = tslot->next) {
+ for (tslot = threadbase->first; tslot; tslot = tslot->next) {
if (tslot->avail == 0) {
pthread_join(tslot->pthread, NULL);
tslot->callerdata = NULL;
@@ -289,8 +289,8 @@ void BLI_end_threads(ListBase *threadbase)
* this way we don't end up decrementing thread_levels on an empty threadbase
* */
if (threadbase && threadbase->first != NULL) {
- for(tslot= threadbase->first; tslot; tslot= tslot->next) {
- if(tslot->avail==0) {
+ for (tslot= threadbase->first; tslot; tslot= tslot->next) {
+ if (tslot->avail==0) {
pthread_join(tslot->pthread, NULL);
}
}
@@ -298,7 +298,7 @@ void BLI_end_threads(ListBase *threadbase)
}
thread_levels--;
- if(thread_levels==0)
+ if (thread_levels==0)
MEM_set_lock_callback(NULL, NULL);
}
@@ -366,17 +366,17 @@ void BLI_unlock_thread(int type)
pthread_mutex_unlock(&_preview_lock);
else if (type==LOCK_VIEWER)
pthread_mutex_unlock(&_viewer_lock);
- else if(type==LOCK_CUSTOM1)
+ else if (type==LOCK_CUSTOM1)
pthread_mutex_unlock(&_custom1_lock);
- else if(type==LOCK_RCACHE)
+ else if (type==LOCK_RCACHE)
pthread_mutex_unlock(&_rcache_lock);
- else if(type==LOCK_OPENGL)
+ else if (type==LOCK_OPENGL)
pthread_mutex_unlock(&_opengl_lock);
- else if(type==LOCK_NODES)
+ else if (type==LOCK_NODES)
pthread_mutex_unlock(&_nodes_lock);
- else if(type==LOCK_MOVIECLIP)
+ else if (type==LOCK_MOVIECLIP)
pthread_mutex_unlock(&_movieclip_lock);
- else if(type == LOCK_SCANFILL)
+ else if (type == LOCK_SCANFILL)
pthread_mutex_unlock(&_scanfill_lock);
}
@@ -411,7 +411,7 @@ void BLI_rw_mutex_init(ThreadRWMutex *mutex)
void BLI_rw_mutex_lock(ThreadRWMutex *mutex, int mode)
{
- if(mode == THREAD_LOCK_READ)
+ if (mode == THREAD_LOCK_READ)
pthread_rwlock_rdlock(mutex);
else
pthread_rwlock_wrlock(mutex);
@@ -498,7 +498,7 @@ void BLI_insert_work(ThreadedWorker *worker, void *param)
if (BLI_available_threads(&worker->threadbase) == 0) {
index = worker->total;
- while(index == worker->total) {
+ while (index == worker->total) {
PIL_sleep_ms(worker->sleep_time);
for (index = 0; index < worker->total; index++) {
@@ -571,11 +571,11 @@ void *BLI_thread_queue_pop(ThreadQueue *queue)
/* wait until there is work */
pthread_mutex_lock(&queue->mutex);
- while(BLI_gsqueue_is_empty(queue->queue) && !queue->nowait)
+ while (BLI_gsqueue_is_empty(queue->queue) && !queue->nowait)
pthread_cond_wait(&queue->cond, &queue->mutex);
/* if we have something, pop it */
- if(!BLI_gsqueue_is_empty(queue->queue))
+ if (!BLI_gsqueue_is_empty(queue->queue))
BLI_gsqueue_pop(queue->queue, &work);
pthread_mutex_unlock(&queue->mutex);
@@ -629,15 +629,15 @@ void *BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms)
/* wait until there is work */
pthread_mutex_lock(&queue->mutex);
- while(BLI_gsqueue_is_empty(queue->queue) && !queue->nowait) {
- if(pthread_cond_timedwait(&queue->cond, &queue->mutex, &timeout) == ETIMEDOUT)
+ while (BLI_gsqueue_is_empty(queue->queue) && !queue->nowait) {
+ if (pthread_cond_timedwait(&queue->cond, &queue->mutex, &timeout) == ETIMEDOUT)
break;
- else if(PIL_check_seconds_timer() - t >= ms*0.001)
+ else if (PIL_check_seconds_timer() - t >= ms*0.001)
break;
}
/* if we have something, pop it */
- if(!BLI_gsqueue_is_empty(queue->queue))
+ if (!BLI_gsqueue_is_empty(queue->queue))
BLI_gsqueue_pop(queue->queue, &work);
pthread_mutex_unlock(&queue->mutex);
@@ -669,7 +669,7 @@ void BLI_thread_queue_nowait(ThreadQueue *queue)
void BLI_begin_threaded_malloc(void)
{
- if(thread_levels == 0) {
+ if (thread_levels == 0) {
MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
}
thread_levels++;
@@ -678,6 +678,6 @@ void BLI_begin_threaded_malloc(void)
void BLI_end_threaded_malloc(void)
{
thread_levels--;
- if(thread_levels==0)
+ if (thread_levels==0)
MEM_set_lock_callback(NULL, NULL);
}
diff --git a/source/blender/blenlib/intern/time.c b/source/blender/blenlib/intern/time.c
index d86d68f6195..2f53aa38e77 100644
--- a/source/blender/blenlib/intern/time.c
+++ b/source/blender/blenlib/intern/time.c
@@ -52,14 +52,16 @@ double PIL_check_seconds_timer(void)
QueryPerformanceCounter((LARGE_INTEGER*) &count);
return count/perffreq;
- } else {
+ }
+ else {
static double accum= 0.0;
static int ltick= 0;
int ntick= GetTickCount();
if (ntick<ltick) {
accum+= (0xFFFFFFFF-ltick+ntick)/1000.0;
- } else {
+ }
+ else {
accum+= (ntick-ltick)/1000.0;
}
diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c
index 8b00d8e48a6..89621cdf48d 100644
--- a/source/blender/blenlib/intern/uvproject.c
+++ b/source/blender/blenlib/intern/uvproject.c
@@ -22,7 +22,6 @@
* \ingroup bli
*/
-
#include <math.h>
#include "MEM_guardedalloc.h"
@@ -48,45 +47,46 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci)
float pv4[4];
copy_v3_v3(pv4, source);
- pv4[3]= 1.0;
+ pv4[3] = 1.0;
/* rotmat is the object matrix in this case */
- if(uci->do_rotmat)
+ if (uci->do_rotmat)
mul_m4_v4(uci->rotmat, pv4);
/* caminv is the inverse camera matrix */
mul_m4_v4(uci->caminv, pv4);
- if(uci->do_pano) {
- float angle= atan2f(pv4[0], -pv4[2]) / ((float)M_PI * 2.0f); /* angle around the camera */
- if (uci->do_persp==0) {
- target[0]= angle; /* no correct method here, just map to 0-1 */
- target[1]= pv4[1] / uci->camsize;
+ if (uci->do_pano) {
+ float angle = atan2f(pv4[0], -pv4[2]) / ((float)M_PI * 2.0f); /* angle around the camera */
+ if (uci->do_persp == 0) {
+ target[0] = angle; /* no correct method here, just map to 0-1 */
+ target[1] = pv4[1] / uci->camsize;
}
else {
float vec2d[2]; /* 2D position from the camera */
- vec2d[0]= pv4[0];
- vec2d[1]= pv4[2];
- target[0]= angle * ((float)M_PI / uci->camangle);
- target[1]= pv4[1] / (len_v2(vec2d) * (uci->camsize * 2.0f));
+ vec2d[0] = pv4[0];
+ vec2d[1] = pv4[2];
+ target[0] = angle * ((float)M_PI / uci->camangle);
+ target[1] = pv4[1] / (len_v2(vec2d) * (uci->camsize * 2.0f));
}
}
else {
- if (pv4[2]==0.0f) pv4[2]= 0.00001f; /* don't allow div by 0 */
+ if (pv4[2] == 0.0f)
+ pv4[2] = 0.00001f; /* don't allow div by 0 */
- if (uci->do_persp==0) {
- target[0]= (pv4[0]/uci->camsize);
- target[1]= (pv4[1]/uci->camsize);
+ if (uci->do_persp == 0) {
+ target[0] = (pv4[0] / uci->camsize);
+ target[1] = (pv4[1] / uci->camsize);
}
else {
- target[0]= (-pv4[0]*((1.0f/uci->camsize)/pv4[2])) / 2.0f;
- target[1]= (-pv4[1]*((1.0f/uci->camsize)/pv4[2])) / 2.0f;
+ target[0] = (-pv4[0] * ((1.0f / uci->camsize) / pv4[2])) / 2.0f;
+ target[1] = (-pv4[1] * ((1.0f / uci->camsize) / pv4[2])) / 2.0f;
}
}
target[0] *= uci->xasp;
target[1] *= uci->yasp;
-
+
/* adds camera shift + 0.5 */
target[0] += uci->shiftx;
target[1] += uci->shifty;
@@ -95,54 +95,54 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci)
/* could rv3d->persmat */
void project_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], float winx, float winy)
{
- float pv[3], pv4[4], x= 0.0, y= 0.0;
+ float pv[3], pv4[4], x = 0.0, y = 0.0;
mul_v3_m4v3(pv, rotmat, source);
copy_v3_v3(pv4, source);
- pv4[3]= 1.0;
+ pv4[3] = 1.0;
/* rotmat is the object matrix in this case */
- mul_m4_v4(rotmat, pv4);
+ mul_m4_v4(rotmat, pv4);
/* almost project_short */
mul_m4_v4(persmat, pv4);
- if(fabsf(pv4[3]) > 0.00001f) { /* avoid division by zero */
- target[0] = winx/2.0f + (winx/2.0f) * pv4[0] / pv4[3];
- target[1] = winy/2.0f + (winy/2.0f) * pv4[1] / pv4[3];
+ if (fabsf(pv4[3]) > 0.00001f) { /* avoid division by zero */
+ target[0] = winx / 2.0f + (winx / 2.0f) * pv4[0] / pv4[3];
+ target[1] = winy / 2.0f + (winy / 2.0f) * pv4[1] / pv4[3];
}
else {
/* scaling is lost but give a valid result */
- target[0] = winx/2.0f + (winx/2.0f) * pv4[0];
- target[1] = winy/2.0f + (winy/2.0f) * pv4[1];
+ target[0] = winx / 2.0f + (winx / 2.0f) * pv4[0];
+ target[1] = winy / 2.0f + (winy / 2.0f) * pv4[1];
}
- /* v3d->persmat seems to do this funky scaling */
- if(winx > winy) {
- y= (winx - winy)/2.0f;
+ /* v3d->persmat seems to do this funky scaling */
+ if (winx > winy) {
+ y = (winx - winy) / 2.0f;
winy = winx;
}
else {
- x= (winy - winx)/2.0f;
+ x = (winy - winx) / 2.0f;
winx = winy;
}
- target[0]= (x + target[0]) / winx;
- target[1]= (y + target[1]) / winy;
+ target[0] = (x + target[0]) / winx;
+ target[1] = (y + target[1]) / winy;
}
/* 'rotmat' can be obedit->obmat when uv project is used.
- * 'winx' and 'winy' can be from scene->r.xsch/ysch */
-UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, float winy)
+ * 'winx' and 'winy' can be from scene->r.xsch/ysch */
+UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, float winy)
{
UvCameraInfo uci;
- Camera *camera= ob->data;
+ Camera *camera = ob->data;
uci.do_pano = (camera->flag & CAM_PANORAMA);
- uci.do_persp = (camera->type==CAM_PERSP);
+ uci.do_persp = (camera->type == CAM_PERSP);
- uci.camangle= focallength_to_fov(camera->lens, camera->sensor_x) / 2.0f;
- uci.camsize= uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale;
+ uci.camangle = focallength_to_fov(camera->lens, camera->sensor_x) / 2.0f;
+ uci.camsize = uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale;
/* account for scaled cameras */
copy_m4_m4(uci.caminv, ob->obmat);
@@ -152,30 +152,30 @@ UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, fl
UvCameraInfo *uci_pt;
/* normal projection */
- if(rotmat) {
+ if (rotmat) {
copy_m4_m4(uci.rotmat, rotmat);
- uci.do_rotmat= 1;
+ uci.do_rotmat = 1;
}
else {
- uci.do_rotmat= 0;
+ uci.do_rotmat = 0;
}
/* also make aspect ratio adjustment factors */
if (winx > winy) {
- uci.xasp= 1.0f;
- uci.yasp= winx / winy;
+ uci.xasp = 1.0f;
+ uci.yasp = winx / winy;
}
else {
- uci.xasp= winy / winx;
- uci.yasp= 1.0f;
+ uci.xasp = winy / winx;
+ uci.yasp = 1.0f;
}
-
+
/* include 0.5f here to move the UVs into the center */
uci.shiftx = 0.5f - (camera->shiftx * uci.xasp);
uci.shifty = 0.5f - (camera->shifty * uci.yasp);
-
- uci_pt= MEM_mallocN(sizeof(UvCameraInfo), "UvCameraInfo");
- *uci_pt= uci;
+
+ uci_pt = MEM_mallocN(sizeof(UvCameraInfo), "UvCameraInfo");
+ *uci_pt = uci;
return uci_pt;
}
@@ -193,7 +193,6 @@ void project_from_view_ortho(float target[2], float source[3], float rotmat[4][4
target[1] = pv[2];
}
-
void project_camera_info_scale(UvCameraInfo *uci, float scale_x, float scale_y)
{
uci->xasp *= scale_x;
diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c
index dd56988fd90..34862c724e1 100644
--- a/source/blender/blenlib/intern/voxel.c
+++ b/source/blender/blenlib/intern/voxel.c
@@ -35,7 +35,7 @@
-BM_INLINE float D(float *data, const int res[3], int x, int y, int z)
+BLI_INLINE float D(float *data, const int res[3], int x, int y, int z)
{
CLAMP(x, 0, res[0]-1);
CLAMP(y, 0, res[1]-1);
@@ -57,7 +57,7 @@ float voxel_sample_nearest(float *data, const int res[3], const float co[3])
}
// returns highest integer <= x as integer (slightly faster than floor())
-BM_INLINE int FLOORI(float x)
+BLI_INLINE int FLOORI(float x)
{
const int r = (int)x;
return ((x >= 0.f) || (float)r == x) ? r : (r - 1);
@@ -65,7 +65,7 @@ BM_INLINE int FLOORI(float x)
// clamp function, cannot use the CLAMPIS macro, it sometimes returns unwanted results apparently related to gcc optimization flag -fstrict-overflow which is enabled at -O2
// this causes the test (x + 2) < 0 with int x == 2147483647 to return false (x being an integer, x + 2 should wrap around to -2147483647 so the test < 0 should return true, which it doesn't)
-BM_INLINE int _clamp(int a, int b, int c)
+BLI_INLINE int _clamp(int a, int b, int c)
{
return (a < b) ? b : ((a > c) ? c : a);
}
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index 4665b08b202..d2c98b7aaf3 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -47,17 +47,20 @@
#define WIN32_SKIP_HKEY_PROTECTION // need to use HKEY
#include "BLI_winstuff.h"
- /* FILE_MAX */
+#include "utf_winfunc.h"
+#include "utfconv.h"
+
+ /* FILE_MAXDIR + FILE_MAXFILE */
int BLI_getInstallationDir( char * str )
{
char dir[FILE_MAXDIR];
int a;
-
+ /*change to utf support*/
GetModuleFileName(NULL,str,FILE_MAX);
BLI_split_dir_part(str, dir, sizeof(dir)); /* shouldn't be relative */
a = strlen(dir);
- if(dir[a-1] == '\\') dir[a-1]=0;
+ if (dir[a-1] == '\\') dir[a-1]=0;
strcpy(str,dir);
@@ -169,7 +172,9 @@ void RegisterBlendExtension(void)
DIR *opendir (const char *path)
{
- if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) {
+ wchar_t * path_16 = alloc_utf16_from_8(path, 0);
+
+ if (GetFileAttributesW(path_16) & FILE_ATTRIBUTE_DIRECTORY) {
DIR *newd= MEM_mallocN(sizeof(DIR), "opendir");
newd->handle = INVALID_HANDLE_VALUE;
@@ -180,32 +185,62 @@ DIR *opendir (const char *path)
newd->direntry.d_reclen= 0;
newd->direntry.d_name= NULL;
+ free(path_16);
return newd;
- } else {
+ }
+ else {
+ free(path_16);
return NULL;
}
}
-struct dirent *readdir(DIR *dp)
+static char * BLI_alloc_utf_8_from_16(wchar_t * in16, size_t add)
{
+ size_t bsize = count_utf_8_from_16(in16);
+ char * out8 = NULL;
+ if (!bsize) return NULL;
+ out8 = (char*)MEM_mallocN(sizeof(char) * (bsize + add),"UTF-8 String");
+ conv_utf_16_to_8(in16,out8, bsize);
+ return out8;
+}
+
+static wchar_t * BLI_alloc_utf16_from_8(char * in8, size_t add)
+{
+ size_t bsize = count_utf_16_from_8(in8);
+ wchar_t * out16 = NULL;
+ if (!bsize) return NULL;
+ out16 =(wchar_t*) MEM_mallocN(sizeof(wchar_t) * (bsize + add), "UTF-16 String");
+ conv_utf_8_to_16(in8,out16, bsize);
+ return out16;
+}
+
+
+
+struct dirent *readdir(DIR *dp) {
+ char * FileName;
+ size_t size;
if (dp->direntry.d_name) {
MEM_freeN(dp->direntry.d_name);
dp->direntry.d_name= NULL;
}
if (dp->handle==INVALID_HANDLE_VALUE) {
- dp->handle= FindFirstFile(dp->path, &(dp->data));
+ wchar_t * path_16 = alloc_utf16_from_8(dp->path, 0);
+ dp->handle= FindFirstFileW(path_16, &(dp->data));
+ free(path_16);
if (dp->handle==INVALID_HANDLE_VALUE)
return NULL;
- dp->direntry.d_name= BLI_strdup(dp->data.cFileName);
-
+ dp->direntry.d_name= BLI_alloc_utf_8_from_16(dp->data.cFileName, 0);
+
return &dp->direntry;
- } else if (FindNextFile (dp->handle, &(dp->data))) {
- dp->direntry.d_name= BLI_strdup(dp->data.cFileName);
+ }
+ else if (FindNextFileW (dp->handle, &(dp->data))) {
+ dp->direntry.d_name= BLI_alloc_utf_8_from_16(dp->data.cFileName,0);
return &dp->direntry;
- } else {
+ }
+ else {
return NULL;
}
}
@@ -232,7 +267,8 @@ void get_default_root(char* root)
root[1] = ':';
root[2] = '\\';
root[3] = '\0';
- } else {
+ }
+ else {
/* if GetWindowsDirectory fails, something has probably gone wrong,
* we are trying the blender install dir though */
if (GetModuleFileName(NULL,str,MAX_PATH+1)) {
@@ -241,7 +277,8 @@ void get_default_root(char* root)
root[1] = ':';
root[2] = '\\';
root[3] = '\0';
- } else {
+ }
+ else {
DWORD tmp;
int i;
int rc = 0;
@@ -301,15 +338,15 @@ int check_file_chars(char *filename)
char* dirname(char *path)
{
char *p;
- if( path == NULL || *path == '\0' )
+ if ( path == NULL || *path == '\0' )
return ".";
p = path + strlen(path) - 1;
- while( *p == '/' ) {
- if( p == path )
+ while ( *p == '/' ) {
+ if ( p == path )
return path;
*p-- = '\0';
}
- while( p >= path && *p != '/' )
+ while ( p >= path && *p != '/' )
p--;
return
p < path ? "." :
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index ffac9a2a88f..bddaa5f67d6 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -235,7 +235,7 @@ struct ID *BLO_library_append_named_part(struct Main *mainl, BlendHandle** bh, c
* Link/Append a named datablock from an external blend file.
* optionally instance the object in the scene when the flags are set.
*
- * \param C The context, when NULL instancing object in the scene isnt done.
+ * \param C The context, when NULL instancing object in the scene isn't done.
* \param mainl The main database to link from (not the active one).
* \param bh The blender file handle.
* \param idname The name of the datablock (without the 2 char ID prefix)
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 6e4dcb66bfb..6f138d5df23 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -134,7 +134,8 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype,
BLI_linklist_prepend(&names, strdup(idname+2));
tot++;
- } else if (bhead->code==ENDB)
+ }
+ else if (bhead->code==ENDB)
break;
}
@@ -170,7 +171,8 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
default:
break;
}
- } else if (bhead->code==DATA) {
+ }
+ else if (bhead->code==DATA) {
if (looking) {
if (bhead->SDNAnr == DNA_struct_find_nr(fd->filesdna, "PreviewImage") ) {
prv = BLO_library_read_struct(fd, bhead, "PreviewImage");
@@ -182,7 +184,8 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
bhead= blo_nextbhead(fd, bhead);
rect = (unsigned int*)(bhead+1);
memcpy(new_prv->rect[0], rect, bhead->len);
- } else {
+ }
+ else {
new_prv->rect[0] = NULL;
}
@@ -192,16 +195,19 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
bhead= blo_nextbhead(fd, bhead);
rect = (unsigned int*)(bhead+1);
memcpy(new_prv->rect[1], rect, bhead->len);
- } else {
+ }
+ else {
new_prv->rect[1] = NULL;
}
MEM_freeN(prv);
}
}
}
- } else if (bhead->code==ENDB) {
+ }
+ else if (bhead->code==ENDB) {
break;
- } else {
+ }
+ else {
looking = 0;
new_prv = NULL;
prv = NULL;
@@ -223,7 +229,8 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
if (bhead->code==ENDB) {
break;
- } else if (BKE_idcode_is_valid(bhead->code)) {
+ }
+ else if (BKE_idcode_is_valid(bhead->code)) {
if (BKE_idcode_is_linkable(bhead->code)) {
const char *str= BKE_idcode_to_name(bhead->code);
@@ -313,7 +320,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
blo_end_movieclip_pointer_map(fd, oldmain);
/* move libraries from old main to new main */
- if(bfd && mainlist.first!=mainlist.last) {
+ if (bfd && mainlist.first!=mainlist.last) {
/* Library structs themselves */
bfd->main->library= oldmain->library;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 22da276fcad..4771f04cc6a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -273,7 +273,7 @@ static void BKE_reportf_wrap(ReportList *reports, ReportType type, const char *f
BKE_report(reports, type, fixed_buf);
- if(G.background==0) {
+ if (G.background==0) {
printf("%s\n", fixed_buf);
}
}
@@ -292,8 +292,8 @@ static int verg_oldnewmap(const void *v1, const void *v2)
{
const struct OldNew *x1=v1, *x2=v2;
- if( x1->old > x2->old) return 1;
- else if( x1->old < x2->old) return -1;
+ if ( x1->old > x2->old) return 1;
+ else if ( x1->old < x2->old) return -1;
return 0;
}
@@ -309,7 +309,7 @@ static void oldnewmap_insert(OldNewMap *onm, void *oldaddr, void *newaddr, int n
{
OldNew *entry;
- if(oldaddr==NULL || newaddr==NULL) return;
+ if (oldaddr==NULL || newaddr==NULL) return;
if (onm->nentries==onm->entriessize) {
int osize= onm->entriessize;
@@ -332,7 +332,7 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, void *addr)
{
int i;
- if(addr==NULL) return NULL;
+ if (addr==NULL) return NULL;
if (onm->lasthit<onm->nentries-1) {
OldNew *entry= &onm->entries[++onm->lasthit];
@@ -362,16 +362,16 @@ static void *oldnewmap_liblookup(OldNewMap *onm, void *addr, void *lib)
{
int i;
- if(addr==NULL) return NULL;
+ if (addr==NULL) return NULL;
/* lasthit works fine for non-libdata, linking there is done in same sequence as writing */
- if(onm->sorted) {
+ if (onm->sorted) {
OldNew entry_s, *entry;
entry_s.old= addr;
entry= bsearch(&entry_s, onm->entries, onm->nentries, sizeof(OldNew), verg_oldnewmap);
- if(entry) {
+ if (entry) {
ID *id= entry->newp;
if (id && (!lib || id->lib)) {
@@ -433,7 +433,7 @@ static void add_main_to_main(Main *mainvar, Main *from)
set_listbasepointers(mainvar, lbarray);
a= set_listbasepointers(from, fromarray);
- while(a--) {
+ while (a--) {
BLI_movelisttolist(lbarray[a], fromarray[a]);
}
}
@@ -458,12 +458,12 @@ static void split_libdata(ListBase *lb, Main *first)
Main *mainvar;
id= lb->first;
- while(id) {
+ while (id) {
idnext= id->next;
- if(id->lib) {
+ if (id->lib) {
mainvar= first;
- while(mainvar) {
- if(mainvar->curlib==id->lib) {
+ while (mainvar) {
+ if (mainvar->curlib==id->lib) {
lbn= which_libbase(mainvar, GS(id->name));
BLI_remlink(lb, id);
BLI_addtail(lbn, id);
@@ -471,7 +471,7 @@ static void split_libdata(ListBase *lb, Main *first)
}
mainvar= mainvar->next;
}
- if(mainvar==NULL) printf("error split_libdata\n");
+ if (mainvar==NULL) printf("error split_libdata\n");
}
id= idnext;
}
@@ -486,7 +486,7 @@ void blo_split_main(ListBase *mainlist, Main *main)
mainlist->first= mainlist->last= main;
main->next= NULL;
- if(main->library.first==NULL)
+ if (main->library.first==NULL)
return;
for (lib= main->library.first; lib; lib= lib->id.next) {
@@ -496,7 +496,7 @@ void blo_split_main(ListBase *mainlist, Main *main)
}
i= set_listbasepointers(main, lbarray);
- while(i--)
+ while (i--)
split_libdata(lbarray[i], main->next);
}
@@ -517,7 +517,7 @@ static void read_file_version(FileData *fd, Main *main)
for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
if (bhead->code==GLOB) {
FileGlobal *fg= read_struct(fd, bhead, "Global");
- if(fg) {
+ if (fg) {
main->subversionfile= fg->subversion;
main->minversionfile= fg->minversion;
main->minsubversionfile= fg->minsubversion;
@@ -545,7 +545,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat
char *libname= (m->curlib)?m->curlib->filepath:m->name;
if (BLI_path_cmp(name1, libname) == 0) {
- if(G.f & G_DEBUG) printf("blo_find_main: found library %s\n", libname);
+ if (G.f & G_DEBUG) printf("blo_find_main: found library %s\n", libname);
return m;
}
}
@@ -561,7 +561,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat
read_file_version(fd, m);
- if(G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", filepath);
+ if (G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", filepath);
return m;
}
@@ -571,7 +571,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat
static void switch_endian_bh4(BHead4 *bhead)
{
/* the ID_.. codes */
- if((bhead->code & 0xFFFF)==0) bhead->code >>=16;
+ if ((bhead->code & 0xFFFF)==0) bhead->code >>=16;
if (bhead->code != ENDB) {
SWITCH_INT(bhead->len);
@@ -583,7 +583,7 @@ static void switch_endian_bh4(BHead4 *bhead)
static void switch_endian_bh8(BHead8 *bhead)
{
/* the ID_.. codes */
- if((bhead->code & 0xFFFF)==0) bhead->code >>=16;
+ if ((bhead->code & 0xFFFF)==0) bhead->code >>=16;
if (bhead->code != ENDB) {
SWITCH_INT(bhead->len);
@@ -667,14 +667,17 @@ static BHeadN *get_bhead(FileData *fd)
if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) {
bh8_from_bh4(&bhead, &bhead4);
- } else {
+ }
+ else {
memcpy(&bhead, &bhead4, sizeof(bhead));
}
- } else {
+ }
+ else {
fd->eof = 1;
bhead.len= 0;
}
- } else {
+ }
+ else {
bhead8.code = DATA;
readsize = fd->read(fd, &bhead8, sizeof(bhead8));
@@ -685,10 +688,12 @@ static BHeadN *get_bhead(FileData *fd)
if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) {
bh4_from_bh8(&bhead, &bhead8, (fd->flags & FD_FLAGS_SWITCH_ENDIAN));
- } else {
+ }
+ else {
memcpy(&bhead, &bhead8, sizeof(bhead));
}
- } else {
+ }
+ else {
fd->eof = 1;
bhead.len= 0;
}
@@ -713,7 +718,8 @@ static BHeadN *get_bhead(FileData *fd)
MEM_freeN(new_bhead);
new_bhead = NULL;
}
- } else {
+ }
+ else {
fd->eof = 1;
}
}
@@ -793,18 +799,19 @@ static void decode_blender_header(FileData *fd)
readsize = fd->read(fd, header, sizeof(header));
if (readsize == sizeof(header)) {
- if(strncmp(header, "BLENDER", 7) == 0) {
+ if (strncmp(header, "BLENDER", 7) == 0) {
int remove_this_endian_test= 1;
fd->flags |= FD_FLAGS_FILE_OK;
// what size are pointers in the file ?
- if(header[7]=='_') {
+ if (header[7]=='_') {
fd->flags |= FD_FLAGS_FILE_POINTSIZE_IS_4;
if (sizeof(void *) != 4) {
fd->flags |= FD_FLAGS_POINTSIZE_DIFFERS;
}
- } else {
+ }
+ else {
if (sizeof(void *) != 8) {
fd->flags |= FD_FLAGS_POINTSIZE_DIFFERS;
}
@@ -842,7 +849,8 @@ static int read_file_dna(FileData *fd)
}
return 1;
- } else if (bhead->code==ENDB)
+ }
+ else if (bhead->code==ENDB)
break;
}
@@ -855,7 +863,8 @@ static int fd_read_from_file(FileData *filedata, void *buffer, unsigned int size
if (readsize < 0) {
readsize = EOF;
- } else {
+ }
+ else {
filedata->seek += readsize;
}
@@ -868,7 +877,8 @@ static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int
if (readsize < 0) {
readsize = EOF;
- } else {
+ }
+ else {
filedata->seek += readsize;
}
@@ -893,14 +903,14 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s
static MemFileChunk *chunk=NULL;
unsigned int chunkoffset, readsize, totread;
- if(size==0) return 0;
+ if (size==0) return 0;
- if(seek != (unsigned int)filedata->seek) {
+ if (seek != (unsigned int)filedata->seek) {
chunk= filedata->memfile->chunks.first;
seek= 0;
- while(chunk) {
- if(seek + chunk->size > (unsigned) filedata->seek) break;
+ while (chunk) {
+ if (seek + chunk->size > (unsigned) filedata->seek) break;
seek+= chunk->size;
chunk= chunk->next;
}
@@ -908,18 +918,18 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s
seek= filedata->seek;
}
- if(chunk) {
+ if (chunk) {
totread= 0;
do {
/* first check if it's on the end if current chunk */
- if(seek-offset == chunk->size) {
+ if (seek-offset == chunk->size) {
offset+= chunk->size;
chunk= chunk->next;
}
/* debug, should never happen */
- if(chunk==NULL) {
+ if (chunk==NULL) {
printf("illegal read, chunk zero\n");
return 0;
}
@@ -930,14 +940,14 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s
/* data can be spread over multiple chunks, so clamp size
* to within this chunk, and then it will read further in
* the next chunk */
- if(chunkoffset+readsize > chunk->size)
+ if (chunkoffset+readsize > chunk->size)
readsize= chunk->size-chunkoffset;
memcpy((char*)buffer+totread, chunk->buf+chunkoffset, readsize);
totread += readsize;
filedata->seek += readsize;
seek += readsize;
- } while(totread < size);
+ } while (totread < size);
return totread;
}
@@ -991,12 +1001,13 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports)
{
gzFile gzfile;
errno= 0;
- gzfile= gzopen(filepath, "rb");
+ gzfile= BLI_gzopen(filepath, "rb");
if (gzfile == (gzFile)Z_NULL) {
BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", filepath, errno ? strerror(errno) : "Unknown error reading file");
return NULL;
- } else {
+ }
+ else {
FileData *fd = filedata_new();
fd->gzfiledes = gzfile;
fd->read = fd_read_gzip_from_file;
@@ -1013,7 +1024,8 @@ FileData *blo_openblendermemory(void *mem, int memsize, ReportList *reports)
if (!mem || memsize<SIZEOFBLENDERHEADER) {
BKE_report(reports, RPT_ERROR, (mem)? "Unable to read": "Unable to open");
return NULL;
- } else {
+ }
+ else {
FileData *fd= filedata_new();
fd->buffer= mem;
fd->buffersize= memsize;
@@ -1029,7 +1041,8 @@ FileData *blo_openblendermemfile(MemFile *memfile, ReportList *reports)
if (!memfile) {
BKE_report(reports, RPT_ERROR, "Unable to open blend <memory>");
return NULL;
- } else {
+ }
+ else {
FileData *fd= filedata_new();
fd->memfile= memfile;
@@ -1103,8 +1116,8 @@ int BLO_is_a_library(const char *path, char *dir, char *group)
strcpy(dir, path);
len= strlen(dir);
- if(len<7) return 0;
- if( dir[len-1] != '/' && dir[len-1] != '\\') return 0;
+ if (len<7) return 0;
+ if ( dir[len-1] != '/' && dir[len-1] != '\\') return 0;
group[0]= 0;
dir[len-1]= 0;
@@ -1112,9 +1125,9 @@ int BLO_is_a_library(const char *path, char *dir, char *group)
/* Find the last slash */
fd= BLI_last_slash(dir);
- if(fd==NULL) return 0;
+ if (fd==NULL) return 0;
*fd= 0;
- if(BLO_has_bfile_extension(fd+1)) {
+ if (BLO_has_bfile_extension(fd+1)) {
/* the last part of the dir is a .blend file, no group follows */
*fd= '/'; /* put back the removed slash separating the dir and the .blend file name */
}
@@ -1147,14 +1160,14 @@ static void *newglobadr(FileData *fd, void *adr) /* direct datablocks with glob
static void *newimaadr(FileData *fd, void *adr) /* used to restore image data after undo */
{
- if(fd->imamap && adr)
+ if (fd->imamap && adr)
return oldnewmap_lookup_and_inc(fd->imamap, adr);
return NULL;
}
static void *newmclipadr(FileData *fd, void *adr) /* used to restore movie clip data after undo */
{
- if(fd->movieclipmap && adr)
+ if (fd->movieclipmap && adr)
return oldnewmap_lookup_and_inc(fd->movieclipmap, adr);
return NULL;
}
@@ -1169,7 +1182,7 @@ static void *newlibadr_us(FileData *fd, void *lib, void *adr) /* increases user
{
ID *id= newlibadr(fd, lib, adr);
- if(id)
+ if (id)
id->us++;
return id;
@@ -1184,7 +1197,7 @@ static void change_idid_adr_fd(FileData *fd, void *old, void *new)
if (old==entry->newp && entry->nr==ID_ID) {
entry->newp= new;
- if(new) entry->nr= GS( ((ID *)new)->name );
+ if (new) entry->nr= GS( ((ID *)new)->name );
break;
}
}
@@ -1194,13 +1207,13 @@ static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, voi
{
Main *mainptr;
- for(mainptr= mainlist->first; mainptr; mainptr= mainptr->next) {
+ for (mainptr= mainlist->first; mainptr; mainptr= mainptr->next) {
FileData *fd;
- if(mainptr->curlib) fd= mainptr->curlib->filedata;
+ if (mainptr->curlib) fd= mainptr->curlib->filedata;
else fd= basefd;
- if(fd) {
+ if (fd) {
change_idid_adr_fd(fd, old, new);
}
}
@@ -1214,8 +1227,8 @@ void blo_clear_proxy_pointers_from_lib(Main *oldmain)
{
Object *ob= oldmain->object.first;
- for(;ob; ob= ob->id.next)
- if(ob->id.lib)
+ for (;ob; ob= ob->id.next)
+ if (ob->id.lib)
ob->proxy_from= NULL;
}
@@ -1227,20 +1240,20 @@ void blo_make_image_pointer_map(FileData *fd, Main *oldmain)
fd->imamap= oldnewmap_new();
- for(;ima; ima= ima->id.next) {
+ for (;ima; ima= ima->id.next) {
Link *ibuf= ima->ibufs.first;
- for(; ibuf; ibuf= ibuf->next)
+ for (; ibuf; ibuf= ibuf->next)
oldnewmap_insert(fd->imamap, ibuf, ibuf, 0);
- if(ima->gputexture)
+ if (ima->gputexture)
oldnewmap_insert(fd->imamap, ima->gputexture, ima->gputexture, 0);
- for(a=0; a<IMA_MAX_RENDER_SLOT; a++)
- if(ima->renders[a])
+ for (a=0; a<IMA_MAX_RENDER_SLOT; a++)
+ if (ima->renders[a])
oldnewmap_insert(fd->imamap, ima->renders[a], ima->renders[a], 0);
}
- for(; sce; sce= sce->id.next) {
- if(sce->nodetree) {
+ for (; sce; sce= sce->id.next) {
+ if (sce->nodetree) {
bNode *node;
- for(node= sce->nodetree->nodes.first; node; node= node->next)
+ for (node= sce->nodetree->nodes.first; node; node= node->next)
oldnewmap_insert(fd->imamap, node->preview, node->preview, 0);
}
}
@@ -1261,27 +1274,27 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain)
entry->newp= NULL;
}
- for(;ima; ima= ima->id.next) {
+ for (;ima; ima= ima->id.next) {
Link *ibuf, *next;
/* this mirrors direct_link_image */
- for(ibuf= ima->ibufs.first; ibuf; ibuf= next) {
+ for (ibuf= ima->ibufs.first; ibuf; ibuf= next) {
next= ibuf->next;
- if(NULL==newimaadr(fd, ibuf)) { /* so was restored */
+ if (NULL==newimaadr(fd, ibuf)) { /* so was restored */
BLI_remlink(&ima->ibufs, ibuf);
ima->bindcode= 0;
ima->gputexture= NULL;
}
}
- for(i=0; i<IMA_MAX_RENDER_SLOT; i++)
+ for (i=0; i<IMA_MAX_RENDER_SLOT; i++)
ima->renders[i]= newimaadr(fd, ima->renders[i]);
ima->gputexture= newimaadr(fd, ima->gputexture);
}
- for(; sce; sce= sce->id.next) {
- if(sce->nodetree) {
+ for (; sce; sce= sce->id.next) {
+ if (sce->nodetree) {
bNode *node;
- for(node= sce->nodetree->nodes.first; node; node= node->next)
+ for (node= sce->nodetree->nodes.first; node; node= node->next)
node->preview= newimaadr(fd, node->preview);
}
}
@@ -1294,19 +1307,19 @@ void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain)
fd->movieclipmap= oldnewmap_new();
- for(;clip; clip= clip->id.next) {
- if(clip->cache)
+ for (;clip; clip= clip->id.next) {
+ if (clip->cache)
oldnewmap_insert(fd->movieclipmap, clip->cache, clip->cache, 0);
- if(clip->tracking.camera.intrinsics)
+ if (clip->tracking.camera.intrinsics)
oldnewmap_insert(fd->movieclipmap, clip->tracking.camera.intrinsics, clip->tracking.camera.intrinsics, 0);
}
- for(; sce; sce= sce->id.next) {
- if(sce->nodetree) {
+ for (; sce; sce= sce->id.next) {
+ if (sce->nodetree) {
bNode *node;
- for(node= sce->nodetree->nodes.first; node; node= node->next)
- if(node->type==CMP_NODE_MOVIEDISTORTION)
+ for (node= sce->nodetree->nodes.first; node; node= node->next)
+ if (node->type==CMP_NODE_MOVIEDISTORTION)
oldnewmap_insert(fd->movieclipmap, node->storage, node->storage, 0);
}
}
@@ -1327,16 +1340,16 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain)
entry->newp= NULL;
}
- for(;clip; clip= clip->id.next) {
+ for (;clip; clip= clip->id.next) {
clip->cache= newmclipadr(fd, clip->cache);
clip->tracking.camera.intrinsics= newmclipadr(fd, clip->tracking.camera.intrinsics);
}
- for(; sce; sce= sce->id.next) {
- if(sce->nodetree) {
+ for (; sce; sce= sce->id.next) {
+ if (sce->nodetree) {
bNode *node;
- for(node= sce->nodetree->nodes.first; node; node= node->next)
- if(node->type==CMP_NODE_MOVIEDISTORTION)
+ for (node= sce->nodetree->nodes.first; node; node= node->next)
+ if (node->type==CMP_NODE_MOVIEDISTORTION)
node->storage= newmclipadr(fd, node->storage);
}
}
@@ -1349,11 +1362,11 @@ void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd)
Main *ptr= mainlist->first;
ListBase *lbarray[MAX_LIBARRAY];
- for(ptr= ptr->next; ptr; ptr= ptr->next) {
+ for (ptr= ptr->next; ptr; ptr= ptr->next) {
int i= set_listbasepointers(ptr, lbarray);
- while(i--) {
+ while (i--) {
ID *id;
- for(id= lbarray[i]->first; id; id= id->next)
+ for (id= lbarray[i]->first; id; id= id->next)
oldnewmap_insert(fd->libmap, id, id, GS(id->name));
}
}
@@ -1372,7 +1385,7 @@ static void switch_endian_structs(struct SDNA *filesdna, BHead *bhead)
blocksize= filesdna->typelens[ filesdna->structs[bhead->SDNAnr][0] ];
nblocks= bhead->nr;
- while(nblocks--) {
+ while (nblocks--) {
DNA_struct_switch_endian(filesdna, bhead->SDNAnr, data);
data+= blocksize;
@@ -1389,9 +1402,10 @@ static void *read_struct(FileData *fd, BHead *bh, const char *blockname)
switch_endian_structs(fd->filesdna, bh);
if (fd->compflags[bh->SDNAnr]) { /* flag==0: doesn't exist anymore */
- if(fd->compflags[bh->SDNAnr]==2) {
+ if (fd->compflags[bh->SDNAnr]==2) {
temp= DNA_struct_reconstruct(fd->memsdna, fd->filesdna, fd->compflags, bh->SDNAnr, bh->nr, (bh+1));
- } else {
+ }
+ else {
temp= MEM_mallocN(bh->len, blockname);
memcpy(temp, (bh+1), bh->len);
}
@@ -1405,12 +1419,12 @@ static void link_list(FileData *fd, ListBase *lb) /* only direct data */
{
Link *ln, *prev;
- if(lb->first==NULL) return;
+ if (lb->first==NULL) return;
lb->first= newdataadr(fd, lb->first);
ln= lb->first;
prev= NULL;
- while(ln) {
+ while (ln) {
ln->next= newdataadr(fd, ln->next);
ln->prev= prev;
prev= ln;
@@ -1424,18 +1438,18 @@ static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */
Link *ln, *prev;
void *poin;
- if(lb->first==NULL) return;
+ if (lb->first==NULL) return;
poin= newdataadr(fd, lb->first);
- if(lb->first) {
+ if (lb->first) {
oldnewmap_insert(fd->globmap, lb->first, poin, 0);
}
lb->first= poin;
ln= lb->first;
prev= NULL;
- while(ln) {
+ while (ln) {
poin= newdataadr(fd, ln->next);
- if(ln->next) {
+ if (ln->next) {
oldnewmap_insert(fd->globmap, ln->next, poin, 0);
}
ln->next= poin;
@@ -1460,15 +1474,15 @@ static void test_pointer_array(FileData *fd, void **mat)
* the old dna format to a pointer array in
* the new dna format.
*/
- if(*mat) {
+ if (*mat) {
len= MEM_allocN_len(*mat)/fd->filesdna->pointerlen;
- if(fd->filesdna->pointerlen==8 && fd->memsdna->pointerlen==4) {
+ if (fd->filesdna->pointerlen==8 && fd->memsdna->pointerlen==4) {
ipoin=imat= MEM_mallocN( len*4, "newmatar");
lpoin= *mat;
- while(len-- > 0) {
- if((fd->flags & FD_FLAGS_SWITCH_ENDIAN))
+ while (len-- > 0) {
+ if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN))
SWITCH_LONGINT(*lpoin);
*ipoin= (int) ((*lpoin) >> 3);
ipoin++;
@@ -1478,11 +1492,11 @@ static void test_pointer_array(FileData *fd, void **mat)
*mat= imat;
}
- if(fd->filesdna->pointerlen==4 && fd->memsdna->pointerlen==8) {
+ if (fd->filesdna->pointerlen==4 && fd->memsdna->pointerlen==8) {
lpoin=lmat= MEM_mallocN( len*8, "newmatar");
ipoin= *mat;
- while(len-- > 0) {
+ while (len-- > 0) {
*lpoin= *ipoin;
ipoin++;
lpoin++;
@@ -1510,14 +1524,14 @@ static void IDP_DirectLinkIDPArray(IDProperty *prop, int switch_endian, FileData
array= (IDProperty*) prop->data.pointer;
/* note!, idp-arrays didn't exist in 2.4x, so the pointer will be cleared
- * theres not really anything we can do to correct this, at least dont crash */
- if(array==NULL) {
+ * theres not really anything we can do to correct this, at least don't crash */
+ if (array==NULL) {
prop->len= 0;
prop->totallen= 0;
}
- for(i=0; i<prop->len; i++)
+ for (i=0; i<prop->len; i++)
IDP_DirectLinkProperty(&array[i], switch_endian, fd);
}
@@ -1530,14 +1544,14 @@ static void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, FileData *f
prop->totallen = prop->len;
prop->data.pointer = newdataadr(fd, prop->data.pointer);
- if(prop->subtype == IDP_GROUP) {
+ if (prop->subtype == IDP_GROUP) {
test_pointer_array(fd, prop->data.pointer);
array= prop->data.pointer;
- for(i=0; i<prop->len; i++)
+ for (i=0; i<prop->len; i++)
IDP_DirectLinkProperty(array[i], switch_endian, fd);
}
- else if(prop->subtype == IDP_DOUBLE) {
+ else if (prop->subtype == IDP_DOUBLE) {
if (switch_endian) {
for (i=0; i<prop->len; i++) {
SWITCH_LONGINT(((double*)prop->data.pointer)[i]);
@@ -1624,7 +1638,7 @@ static void direct_link_curvemapping(FileData *fd, CurveMapping *cumap)
/* flag seems to be able to hang? Maybe old files... not bad to clear anyway */
cumap->flag &= ~CUMA_PREMULLED;
- for(a=0; a<CM_TOT; a++) {
+ for (a=0; a<CM_TOT; a++) {
cumap->cm[a].curve= newdataadr(fd, cumap->cm[a].curve);
cumap->cm[a].table= NULL;
cumap->cm[a].premultable= NULL;
@@ -1638,8 +1652,8 @@ static void lib_link_brush(FileData *fd, Main *main)
Brush *brush;
/* only link ID pointers */
- for(brush= main->brush.first; brush; brush= brush->id.next) {
- if(brush->id.flag & LIB_NEEDLINK) {
+ for (brush= main->brush.first; brush; brush= brush->id.next) {
+ if (brush->id.flag & LIB_NEEDLINK) {
brush->id.flag -= LIB_NEEDLINK;
brush->mtex.tex= newlibadr_us(fd, brush->id.lib, brush->mtex.tex);
@@ -1654,7 +1668,7 @@ static void direct_link_brush(FileData *fd, Brush *brush)
/* fallof curve */
brush->curve= newdataadr(fd, brush->curve);
- if(brush->curve)
+ if (brush->curve)
direct_link_curvemapping(fd, brush->curve);
else
brush_curve_preset(brush, CURVE_PRESET_SHARP);
@@ -1711,11 +1725,11 @@ static void lib_link_ipo(FileData *fd, Main *main)
Ipo *ipo;
ipo= main->ipo.first;
- while(ipo) {
- if(ipo->id.flag & LIB_NEEDLINK) {
+ while (ipo) {
+ if (ipo->id.flag & LIB_NEEDLINK) {
IpoCurve *icu;
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->driver)
+ for (icu= ipo->curve.first; icu; icu= icu->next) {
+ if (icu->driver)
icu->driver->ob= newlibadr(fd, ipo->id.lib, icu->driver->ob);
}
ipo->id.flag -= LIB_NEEDLINK;
@@ -1731,7 +1745,7 @@ static void direct_link_ipo(FileData *fd, Ipo *ipo)
link_list(fd, &(ipo->curve));
icu= ipo->curve.first;
- while(icu) {
+ while (icu) {
icu->bezt= newdataadr(fd, icu->bezt);
icu->bp= newdataadr(fd, icu->bp);
icu->driver= newdataadr(fd, icu->driver);
@@ -1745,11 +1759,11 @@ static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist)
bActionStrip *strip;
bActionModifier *amod;
- for (strip=striplist->first; strip; strip=strip->next){
+ for (strip=striplist->first; strip; strip=strip->next) {
strip->object = newlibadr(fd, id->lib, strip->object);
strip->act = newlibadr_us(fd, id->lib, strip->act);
strip->ipo = newlibadr(fd, id->lib, strip->ipo);
- for(amod= strip->modifiers.first; amod; amod= amod->next)
+ for (amod= strip->modifiers.first; amod; amod= amod->next)
amod->ob= newlibadr(fd, id->lib, amod->ob);
}
}
@@ -1761,7 +1775,7 @@ static void direct_link_nlastrips(FileData *fd, ListBase *strips)
link_list(fd, strips);
- for(strip= strips->first; strip; strip= strip->next)
+ for (strip= strips->first; strip; strip= strip->next)
link_list(fd, &strip->modifiers);
}
@@ -1770,7 +1784,7 @@ static void lib_link_constraint_channels(FileData *fd, ID *id, ListBase *chanbas
{
bConstraintChannel *chan;
- for (chan=chanbase->first; chan; chan=chan->next){
+ for (chan=chanbase->first; chan; chan=chan->next) {
chan->ipo = newlibadr_us(fd, id->lib, chan->ipo);
}
}
@@ -1845,9 +1859,9 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list)
data->coefficients= newdataadr(fd, data->coefficients);
- if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
+ if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
unsigned int a;
- for(a = 0; a < data->arraysize; a++)
+ for (a = 0; a < data->arraysize; a++)
SWITCH_INT(data->coefficients[a]);
}
}
@@ -2136,11 +2150,11 @@ static void lib_link_ntree(FileData *fd, ID *id, bNodeTree *ntree)
{
bNode *node;
- if(ntree->adt) lib_link_animdata(fd, &ntree->id, ntree->adt);
+ if (ntree->adt) lib_link_animdata(fd, &ntree->id, ntree->adt);
ntree->gpd= newlibadr_us(fd, id->lib, ntree->gpd);
- for(node= ntree->nodes.first; node; node= node->next)
+ for (node= ntree->nodes.first; node; node= node->next)
node->id= newlibadr_us(fd, id->lib, node->id);
}
@@ -2150,8 +2164,8 @@ static void lib_link_nodetree(FileData *fd, Main *main)
bNodeTree *ntree;
/* only link ID pointers */
- for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
- if(ntree->id.flag & LIB_NEEDLINK) {
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
+ if (ntree->id.flag & LIB_NEEDLINK) {
ntree->id.flag -= LIB_NEEDLINK;
lib_link_ntree(fd, &ntree->id, ntree);
}
@@ -2285,7 +2299,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
bNodeTreeType *ntreetype;
/* this crashes blender on undo/redo
- if(open==1) {
+ if (open==1) {
reinit_nodesystem();
}*/
@@ -2295,7 +2309,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
if (ntreetype && ntreetype->foreach_nodetree)
ntreetype->foreach_nodetree(main, NULL, lib_nodetree_init_types_cb);
}
- for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
lib_nodetree_init_types_cb(NULL, NULL, ntree);
{
@@ -2305,7 +2319,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
* we have set the NTREE_DO_VERSIONS flag, so at this point we can do the
* actual group node updates.
*/
- for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
if (ntree->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE) {
/* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */
node_group_expose_all_sockets(ntree);
@@ -2321,18 +2335,18 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
}
}
- for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
ntree->flag &= ~NTREE_DO_VERSIONS_GROUP_EXPOSE;
}
/* verify all group user nodes */
- for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
ntreeVerifyNodes(main, &ntree->id);
}
/* make update calls where necessary */
{
- for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
if (ntree->update)
ntreeUpdateTree(ntree);
@@ -2368,8 +2382,8 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
direct_link_animdata(fd, ntree->adt);
link_list(fd, &ntree->nodes);
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type == NODE_DYNAMIC) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type == NODE_DYNAMIC) {
node->custom1= 0;
node->custom1= BSET(node->custom1, NODE_DYNAMIC_LOADED);
}
@@ -2379,25 +2393,26 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
link_list(fd, &node->inputs);
link_list(fd, &node->outputs);
- if(node->type == CMP_NODE_MOVIEDISTORTION) {
+ if (node->type == CMP_NODE_MOVIEDISTORTION) {
node->storage= newmclipadr(fd, node->storage);
- } else
+ }
+ else
node->storage= newdataadr(fd, node->storage);
- if(node->storage) {
+ if (node->storage) {
/* could be handlerized at some point */
- if(ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
+ if (ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
direct_link_curvemapping(fd, node->storage);
- else if(ntree->type==NTREE_COMPOSIT) {
- if( ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
+ else if (ntree->type==NTREE_COMPOSIT) {
+ if ( ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
direct_link_curvemapping(fd, node->storage);
- else if(ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+ else if (ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
((ImageUser *)node->storage)->ok= 1;
}
- else if( ntree->type==NTREE_TEXTURE) {
- if(node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME)
+ else if ( ntree->type==NTREE_TEXTURE) {
+ if (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME)
direct_link_curvemapping(fd, node->storage);
- else if(node->type==TEX_NODE_IMAGE)
+ else if (node->type==TEX_NODE_IMAGE)
((ImageUser *)node->storage)->ok= 1;
}
}
@@ -2409,22 +2424,22 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
link_list(fd, &ntree->outputs);
/* and we connect the rest */
- for(node= ntree->nodes.first; node; node= node->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
node->parent = newdataadr(fd, node->parent);
node->preview= newimaadr(fd, node->preview);
node->lasty= 0;
- for(sock= node->inputs.first; sock; sock= sock->next)
+ for (sock= node->inputs.first; sock; sock= sock->next)
direct_link_node_socket(fd, sock);
- for(sock= node->outputs.first; sock; sock= sock->next)
+ for (sock= node->outputs.first; sock; sock= sock->next)
direct_link_node_socket(fd, sock);
}
- for(sock= ntree->inputs.first; sock; sock= sock->next)
+ for (sock= ntree->inputs.first; sock; sock= sock->next)
direct_link_node_socket(fd, sock);
- for(sock= ntree->outputs.first; sock; sock= sock->next)
+ for (sock= ntree->outputs.first; sock; sock= sock->next)
direct_link_node_socket(fd, sock);
- for(link= ntree->links.first; link; link= link->next) {
+ for (link= ntree->links.first; link; link= link->next) {
link->fromnode= newdataadr(fd, link->fromnode);
link->tonode= newdataadr(fd, link->tonode);
link->fromsock= newdataadr(fd, link->fromsock);
@@ -2457,7 +2472,7 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist)
for (con = conlist->first; con; con=con->next) {
/* patch for error introduced by changing constraints (dunno how) */
/* if con->data type changes, dna cannot resolve the pointer! (ton) */
- if(con->data==NULL) {
+ if (con->data==NULL) {
con->type= CONSTRAINT_TYPE_NULL;
}
/* own ipo, all constraints have it */
@@ -2506,7 +2521,7 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
case CONSTRAINT_TYPE_CHILDOF:
{
/* XXX version patch, in older code this flag wasn't always set, and is inherent to type */
- if(con->ownspace == CONSTRAINT_SPACE_POSE)
+ if (con->ownspace == CONSTRAINT_SPACE_POSE)
con->flag |= CONSTRAINT_SPACEONCE;
}
break;
@@ -2527,13 +2542,13 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
/* always rebuild to match proxy or lib changes */
rebuild= ob->proxy || (ob->id.lib==NULL && arm->id.lib);
- if(ob->proxy) {
+ if (ob->proxy) {
/* sync proxy layer */
- if(pose->proxy_layer)
+ if (pose->proxy_layer)
arm->layer = pose->proxy_layer;
/* sync proxy active bone */
- if(pose->proxy_act_bone[0]) {
+ if (pose->proxy_act_bone[0]) {
Bone *bone = get_named_bone(arm, pose->proxy_act_bone);
if (bone)
arm->act_bone = bone;
@@ -2547,16 +2562,16 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
pchan->bone= get_named_bone(arm, pchan->name);
pchan->custom= newlibadr_us(fd, arm->id.lib, pchan->custom);
- if(pchan->bone==NULL)
+ if (pchan->bone==NULL)
rebuild= 1;
- else if(ob->id.lib==NULL && arm->id.lib) {
+ else if (ob->id.lib==NULL && arm->id.lib) {
/* local pose selection copied to armature, bit hackish */
pchan->bone->flag &= ~BONE_SELECTED;
pchan->bone->flag |= pchan->selectflag;
}
}
- if(rebuild) {
+ if (rebuild) {
ob->recalc= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
pose->flag |= POSE_RECALC;
}
@@ -2568,8 +2583,8 @@ static void lib_link_armature(FileData *fd, Main *main)
arm= main->armature.first;
- while(arm) {
- if(arm->id.flag & LIB_NEEDLINK) {
+ while (arm) {
+ if (arm->id.flag & LIB_NEEDLINK) {
if (arm->adt) lib_link_animdata(fd, &arm->id, arm->adt);
arm->id.flag -= LIB_NEEDLINK;
}
@@ -2583,14 +2598,14 @@ static void direct_link_bones(FileData *fd, Bone* bone)
bone->parent= newdataadr(fd, bone->parent);
bone->prop= newdataadr(fd, bone->prop);
- if(bone->prop)
+ if (bone->prop)
IDP_DirectLinkProperty(bone->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
bone->flag &= ~BONE_DRAW_ACTIVE;
link_list(fd, &bone->childbase);
- for(child=bone->childbase.first; child; child=child->next)
+ for (child=bone->childbase.first; child; child=child->next)
direct_link_bones(fd, child);
}
@@ -2622,8 +2637,8 @@ static void lib_link_camera(FileData *fd, Main *main)
Camera *ca;
ca= main->camera.first;
- while(ca) {
- if(ca->id.flag & LIB_NEEDLINK) {
+ while (ca) {
+ if (ca->id.flag & LIB_NEEDLINK) {
if (ca->adt) lib_link_animdata(fd, &ca->id, ca->adt);
ca->ipo= newlibadr_us(fd, ca->id.lib, ca->ipo); // XXX depreceated - old animation system
@@ -2652,13 +2667,13 @@ static void lib_link_lamp(FileData *fd, Main *main)
int a;
la= main->lamp.first;
- while(la) {
- if(la->id.flag & LIB_NEEDLINK) {
+ while (la) {
+ if (la->id.flag & LIB_NEEDLINK) {
if (la->adt) lib_link_animdata(fd, &la->id, la->adt);
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
mtex= la->mtex[a];
- if(mtex) {
+ if (mtex) {
mtex->tex= newlibadr_us(fd, la->id.lib, mtex->tex);
mtex->object= newlibadr(fd, la->id.lib, mtex->object);
}
@@ -2666,7 +2681,7 @@ static void lib_link_lamp(FileData *fd, Main *main)
la->ipo= newlibadr_us(fd, la->id.lib, la->ipo); // XXX depreceated - old animation system
- if(la->nodetree)
+ if (la->nodetree)
lib_link_ntree(fd, &la->id, la->nodetree);
la->id.flag -= LIB_NEEDLINK;
@@ -2682,16 +2697,16 @@ static void direct_link_lamp(FileData *fd, Lamp *la)
la->adt= newdataadr(fd, la->adt);
direct_link_animdata(fd, la->adt);
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
la->mtex[a]= newdataadr(fd, la->mtex[a]);
}
la->curfalloff= newdataadr(fd, la->curfalloff);
- if(la->curfalloff)
+ if (la->curfalloff)
direct_link_curvemapping(fd, la->curfalloff);
la->nodetree= newdataadr(fd, la->nodetree);
- if(la->nodetree)
+ if (la->nodetree)
direct_link_nodetree(fd, la->nodetree);
la->preview = direct_link_preview_image(fd, la->preview);
@@ -2704,7 +2719,7 @@ static void lib_link_key(FileData *fd, Main *main)
Key *key;
key= main->key.first;
- while(key) {
+ while (key) {
/*check if we need to generate unique ids for the shapekeys*/
if (!key->uidgen) {
KeyBlock *block;
@@ -2715,8 +2730,8 @@ static void lib_link_key(FileData *fd, Main *main)
}
}
- if(key->id.flag & LIB_NEEDLINK) {
- if(key->adt) lib_link_animdata(fd, &key->id, key->adt);
+ if (key->id.flag & LIB_NEEDLINK) {
+ if (key->adt) lib_link_animdata(fd, &key->id, key->adt);
key->ipo= newlibadr_us(fd, key->id.lib, key->ipo); // XXX depreceated - old animation system
key->from= newlibadr(fd, key->id.lib, key->from);
@@ -2735,19 +2750,19 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb)
elemsize= key->elemsize;
data= kb->data;
- for(a=0; a<kb->totelem; a++) {
+ for (a=0; a<kb->totelem; a++) {
cp= key->elemstr;
poin= data;
- while( cp[0] ) { /* cp[0]==amount */
+ while ( cp[0] ) { /* cp[0]==amount */
switch(cp[1]) { /* cp[1]= type */
case IPO_FLOAT:
case IPO_BPOINT:
case IPO_BEZTRIPLE:
b= cp[0];
- while(b--) {
+ while (b--) {
SWITCH_INT((*poin));
poin+= 4;
}
@@ -2773,11 +2788,11 @@ static void direct_link_key(FileData *fd, Key *key)
key->refkey= newdataadr(fd, key->refkey);
kb= key->block.first;
- while(kb) {
+ while (kb) {
kb->data= newdataadr(fd, kb->data);
- if(fd->flags & FD_FLAGS_SWITCH_ENDIAN)
+ if (fd->flags & FD_FLAGS_SWITCH_ENDIAN)
switch_endian_keyblock(key, kb);
kb= kb->next;
@@ -2792,11 +2807,11 @@ static void lib_link_mball(FileData *fd, Main *main)
int a;
mb= main->mball.first;
- while(mb) {
- if(mb->id.flag & LIB_NEEDLINK) {
+ while (mb) {
+ if (mb->id.flag & LIB_NEEDLINK) {
if (mb->adt) lib_link_animdata(fd, &mb->id, mb->adt);
- for(a=0; a<mb->totcol; a++) mb->mat[a]= newlibadr_us(fd, mb->id.lib, mb->mat[a]);
+ for (a=0; a<mb->totcol; a++) mb->mat[a]= newlibadr_us(fd, mb->id.lib, mb->mat[a]);
mb->ipo= newlibadr_us(fd, mb->id.lib, mb->ipo); // XXX depreceated - old animation system
@@ -2832,21 +2847,21 @@ static void lib_link_world(FileData *fd, Main *main)
int a;
wrld= main->world.first;
- while(wrld) {
- if(wrld->id.flag & LIB_NEEDLINK) {
+ while (wrld) {
+ if (wrld->id.flag & LIB_NEEDLINK) {
if (wrld->adt) lib_link_animdata(fd, &wrld->id, wrld->adt);
wrld->ipo= newlibadr_us(fd, wrld->id.lib, wrld->ipo); // XXX depreceated - old animation system
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
mtex= wrld->mtex[a];
- if(mtex) {
+ if (mtex) {
mtex->tex= newlibadr_us(fd, wrld->id.lib, mtex->tex);
mtex->object= newlibadr(fd, wrld->id.lib, mtex->object);
}
}
- if(wrld->nodetree)
+ if (wrld->nodetree)
lib_link_ntree(fd, &wrld->id, wrld->nodetree);
wrld->id.flag -= LIB_NEEDLINK;
@@ -2862,12 +2877,12 @@ static void direct_link_world(FileData *fd, World *wrld)
wrld->adt= newdataadr(fd, wrld->adt);
direct_link_animdata(fd, wrld->adt);
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
wrld->mtex[a]= newdataadr(fd, wrld->mtex[a]);
}
wrld->nodetree= newdataadr(fd, wrld->nodetree);
- if(wrld->nodetree)
+ if (wrld->nodetree)
direct_link_nodetree(fd, wrld->nodetree);
wrld->preview = direct_link_preview_image(fd, wrld->preview);
@@ -2881,8 +2896,8 @@ static void lib_link_vfont(FileData *UNUSED(fd), Main *main)
VFont *vf;
vf= main->vfont.first;
- while(vf) {
- if(vf->id.flag & LIB_NEEDLINK) {
+ while (vf) {
+ if (vf->id.flag & LIB_NEEDLINK) {
vf->id.flag -= LIB_NEEDLINK;
}
vf= vf->id.next;
@@ -2902,8 +2917,8 @@ static void lib_link_text(FileData *UNUSED(fd), Main *main)
Text *text;
text= main->text.first;
- while(text) {
- if(text->id.flag & LIB_NEEDLINK) {
+ while (text) {
+ if (text->id.flag & LIB_NEEDLINK) {
text->id.flag -= LIB_NEEDLINK;
}
text= text->id.next;
@@ -2923,9 +2938,10 @@ static void direct_link_text(FileData *fd, Text *text)
text->compiled= NULL;
/*
- if(text->flags & TXT_ISEXT) {
+ if (text->flags & TXT_ISEXT) {
reopen_text(text);
- } else {
+ }
+ else {
*/
link_list(fd, &text->lines);
@@ -2935,7 +2951,7 @@ static void direct_link_text(FileData *fd, Text *text)
text->sell= newdataadr(fd, text->sell);
ln= text->lines.first;
- while(ln) {
+ while (ln) {
ln->line= newdataadr(fd, ln->line);
ln->format= NULL;
@@ -2960,7 +2976,7 @@ static void lib_link_image(FileData *fd, Main *main)
ima= main->image.first;
while (ima) {
- if(ima->id.flag & LIB_NEEDLINK) {
+ if (ima->id.flag & LIB_NEEDLINK) {
if (ima->id.properties) IDP_LibLinkProperty(ima->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
ima->id.flag -= LIB_NEEDLINK;
@@ -2973,12 +2989,12 @@ static void link_ibuf_list(FileData *fd, ListBase *lb)
{
Link *ln, *prev;
- if(lb->first==NULL) return;
+ if (lb->first==NULL) return;
lb->first= newimaadr(fd, lb->first);
ln= lb->first;
prev= NULL;
- while(ln) {
+ while (ln) {
ln->next= newimaadr(fd, ln->next);
ln->prev= prev;
prev= ln;
@@ -2990,13 +3006,13 @@ static void link_ibuf_list(FileData *fd, ListBase *lb)
static void direct_link_image(FileData *fd, Image *ima)
{
/* for undo system, pointers could be restored */
- if(fd->imamap)
+ if (fd->imamap)
link_ibuf_list(fd, &ima->ibufs);
else
ima->ibufs.first= ima->ibufs.last= NULL;
/* if not restored, we keep the binded opengl index */
- if(ima->ibufs.first==NULL) {
+ if (ima->ibufs.first==NULL) {
ima->bindcode= 0;
ima->gputexture= NULL;
}
@@ -3006,10 +3022,10 @@ static void direct_link_image(FileData *fd, Image *ima)
ima->repbind= NULL;
/* undo system, try to restore render buffers */
- if(fd->imamap) {
+ if (fd->imamap) {
int a;
- for(a=0; a<IMA_MAX_RENDER_SLOT; a++)
+ for (a=0; a<IMA_MAX_RENDER_SLOT; a++)
ima->renders[a]= newimaadr(fd, ima->renders[a]);
}
else {
@@ -3031,11 +3047,11 @@ static void lib_link_curve(FileData *fd, Main *main)
int a;
cu= main->curve.first;
- while(cu) {
- if(cu->id.flag & LIB_NEEDLINK) {
- if(cu->adt) lib_link_animdata(fd, &cu->id, cu->adt);
+ while (cu) {
+ if (cu->id.flag & LIB_NEEDLINK) {
+ if (cu->adt) lib_link_animdata(fd, &cu->id, cu->adt);
- for(a=0; a<cu->totcol; a++) cu->mat[a]= newlibadr_us(fd, cu->id.lib, cu->mat[a]);
+ for (a=0; a<cu->totcol; a++) cu->mat[a]= newlibadr_us(fd, cu->id.lib, cu->mat[a]);
cu->bevobj= newlibadr(fd, cu->id.lib, cu->bevobj);
cu->taperobj= newlibadr(fd, cu->id.lib, cu->taperobj);
@@ -3059,15 +3075,15 @@ static void switch_endian_knots(Nurb *nu)
{
int len;
- if(nu->knotsu) {
+ if (nu->knotsu) {
len= KNOTSU(nu);
- while(len--) {
+ while (len--) {
SWITCH_INT(nu->knotsu[len]);
}
}
- if(nu->knotsv) {
+ if (nu->knotsv) {
len= KNOTSV(nu);
- while(len--) {
+ while (len--) {
SWITCH_INT(nu->knotsv[len]);
}
}
@@ -3087,7 +3103,7 @@ static void direct_link_curve(FileData *fd, Curve *cu)
cu->strinfo= newdataadr(fd, cu->strinfo);
cu->tb= newdataadr(fd, cu->tb);
- if(cu->vfont == NULL) link_list(fd, &(cu->nurb));
+ if (cu->vfont == NULL) link_list(fd, &(cu->nurb));
else {
cu->nurb.first=cu->nurb.last= NULL;
@@ -3096,7 +3112,8 @@ static void direct_link_curve(FileData *fd, Curve *cu)
memcpy(tb, cu->tb, cu->totbox*sizeof(TextBox));
MEM_freeN(cu->tb);
cu->tb= tb;
- } else {
+ }
+ else {
cu->totbox = 1;
cu->actbox = 1;
cu->tb = tb;
@@ -3113,14 +3130,14 @@ static void direct_link_curve(FileData *fd, Curve *cu)
cu->editfont= NULL;
nu= cu->nurb.first;
- while(nu) {
+ while (nu) {
nu->bezt= newdataadr(fd, nu->bezt);
nu->bp= newdataadr(fd, nu->bp);
nu->knotsu= newdataadr(fd, nu->knotsu);
nu->knotsv= newdataadr(fd, nu->knotsv);
if (cu->vfont == NULL) nu->charidx= nu->mat_nr;
- if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
+ if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
switch_endian_knots(nu);
}
@@ -3136,20 +3153,20 @@ static void lib_link_texture(FileData *fd, Main *main)
Tex *tex;
tex= main->tex.first;
- while(tex) {
- if(tex->id.flag & LIB_NEEDLINK) {
- if(tex->adt) lib_link_animdata(fd, &tex->id, tex->adt);
+ while (tex) {
+ if (tex->id.flag & LIB_NEEDLINK) {
+ if (tex->adt) lib_link_animdata(fd, &tex->id, tex->adt);
tex->ima= newlibadr_us(fd, tex->id.lib, tex->ima);
tex->ipo= newlibadr_us(fd, tex->id.lib, tex->ipo);
- if(tex->env) tex->env->object= newlibadr(fd, tex->id.lib, tex->env->object);
- if(tex->pd)
+ if (tex->env) tex->env->object= newlibadr(fd, tex->id.lib, tex->env->object);
+ if (tex->pd)
tex->pd->object= newlibadr(fd, tex->id.lib, tex->pd->object);
- if(tex->vd) tex->vd->object= newlibadr(fd, tex->id.lib, tex->vd->object);
- if(tex->ot) tex->ot->object= newlibadr(fd, tex->id.lib, tex->ot->object);
+ if (tex->vd) tex->vd->object= newlibadr(fd, tex->id.lib, tex->vd->object);
+ if (tex->ot) tex->ot->object= newlibadr(fd, tex->id.lib, tex->ot->object);
- if(tex->nodetree)
+ if (tex->nodetree)
lib_link_ntree(fd, &tex->id, tex->nodetree);
tex->id.flag -= LIB_NEEDLINK;
@@ -3164,7 +3181,7 @@ static void direct_link_texture(FileData *fd, Tex *tex)
direct_link_animdata(fd, tex->adt);
tex->plugin= newdataadr(fd, tex->plugin);
- if(tex->plugin) {
+ if (tex->plugin) {
tex->plugin->handle= NULL;
open_plugin_tex(tex->plugin);
/* initialize data for this instance, if an initialization
@@ -3175,34 +3192,35 @@ static void direct_link_texture(FileData *fd, Tex *tex)
}
tex->coba= newdataadr(fd, tex->coba);
tex->env= newdataadr(fd, tex->env);
- if(tex->env) {
+ if (tex->env) {
tex->env->ima= NULL;
memset(tex->env->cube, 0, 6*sizeof(void *));
tex->env->ok= 0;
}
tex->pd= newdataadr(fd, tex->pd);
- if(tex->pd) {
+ if (tex->pd) {
tex->pd->point_tree = NULL;
tex->pd->coba= newdataadr(fd, tex->pd->coba);
tex->pd->falloff_curve= newdataadr(fd, tex->pd->falloff_curve);
- if(tex->pd->falloff_curve) {
+ if (tex->pd->falloff_curve) {
direct_link_curvemapping(fd, tex->pd->falloff_curve);
}
}
tex->vd= newdataadr(fd, tex->vd);
- if(tex->vd) {
+ if (tex->vd) {
tex->vd->dataset = NULL;
tex->vd->ok = 0;
- } else {
- if(tex->type == TEX_VOXELDATA)
+ }
+ else {
+ if (tex->type == TEX_VOXELDATA)
tex->vd= MEM_callocN(sizeof(VoxelData), "direct_link_texture VoxelData");
}
tex->ot= newdataadr(fd, tex->ot);
tex->nodetree= newdataadr(fd, tex->nodetree);
- if(tex->nodetree)
+ if (tex->nodetree)
direct_link_nodetree(fd, tex->nodetree);
tex->preview = direct_link_preview_image(fd, tex->preview);
@@ -3221,9 +3239,9 @@ static void lib_link_material(FileData *fd, Main *main)
int a;
ma= main->mat.first;
- while(ma) {
- if(ma->id.flag & LIB_NEEDLINK) {
- if(ma->adt) lib_link_animdata(fd, &ma->id, ma->adt);
+ while (ma) {
+ if (ma->id.flag & LIB_NEEDLINK) {
+ if (ma->adt) lib_link_animdata(fd, &ma->id, ma->adt);
/*Link ID Properties -- and copy this comment EXACTLY for easy finding
of library blocks that implement this.*/
@@ -3232,15 +3250,15 @@ static void lib_link_material(FileData *fd, Main *main)
ma->ipo= newlibadr_us(fd, ma->id.lib, ma->ipo);
ma->group= newlibadr_us(fd, ma->id.lib, ma->group);
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
mtex= ma->mtex[a];
- if(mtex) {
+ if (mtex) {
mtex->tex= newlibadr_us(fd, ma->id.lib, mtex->tex);
mtex->object= newlibadr(fd, ma->id.lib, mtex->object);
}
}
- if(ma->nodetree)
+ if (ma->nodetree)
lib_link_ntree(fd, &ma->id, ma->nodetree);
ma->id.flag -= LIB_NEEDLINK;
@@ -3256,7 +3274,7 @@ static void direct_link_material(FileData *fd, Material *ma)
ma->adt= newdataadr(fd, ma->adt);
direct_link_animdata(fd, ma->adt);
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
ma->mtex[a]= newdataadr(fd, ma->mtex[a]);
}
@@ -3264,7 +3282,7 @@ static void direct_link_material(FileData *fd, Material *ma)
ma->ramp_spec= newdataadr(fd, ma->ramp_spec);
ma->nodetree= newdataadr(fd, ma->nodetree);
- if(ma->nodetree)
+ if (ma->nodetree)
direct_link_nodetree(fd, ma->nodetree);
ma->preview = direct_link_preview_image(fd, ma->preview);
@@ -3285,7 +3303,7 @@ static const char *ptcache_data_struct[] = {
};
static void direct_link_pointcache(FileData *fd, PointCache *cache)
{
- if((cache->flag & PTCACHE_DISK_CACHE)==0) {
+ if ((cache->flag & PTCACHE_DISK_CACHE)==0) {
PTCacheMem *pm;
PTCacheExtra *extra;
int i;
@@ -3294,23 +3312,23 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache)
pm = cache->mem_cache.first;
- for(; pm; pm=pm->next) {
- for(i=0; i<BPHYS_TOT_DATA; i++) {
+ for (; pm; pm=pm->next) {
+ for (i=0; i<BPHYS_TOT_DATA; i++) {
pm->data[i] = newdataadr(fd, pm->data[i]);
/* the cache saves non-struct data without DNA */
- if(pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
+ if (pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
int j, tot= (BKE_ptcache_data_size (i) * pm->totpoint)/4; /* data_size returns bytes */
int *poin= pm->data[i];
- for(j= 0; j<tot; j++)
+ for (j= 0; j<tot; j++)
SWITCH_INT(poin[j]);
}
}
link_list(fd, &pm->extradata);
- for(extra=pm->extradata.first; extra; extra=extra->next)
+ for (extra=pm->extradata.first; extra; extra=extra->next)
extra->data = newdataadr(fd, extra->data);
}
}
@@ -3326,12 +3344,12 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache)
static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointCache **ocache, int force_disk)
{
- if(ptcaches->first) {
+ if (ptcaches->first) {
PointCache *cache= NULL;
link_list(fd, ptcaches);
- for(cache=ptcaches->first; cache; cache=cache->next) {
+ for (cache=ptcaches->first; cache; cache=cache->next) {
direct_link_pointcache(fd, cache);
- if(force_disk) {
+ if (force_disk) {
cache->flag |= PTCACHE_DISK_CACHE;
cache->step = 1;
}
@@ -3339,11 +3357,11 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC
*ocache = newdataadr(fd, *ocache);
}
- else if(*ocache) {
+ else if (*ocache) {
/* old "single" caches need to be linked too */
*ocache = newdataadr(fd, *ocache);
direct_link_pointcache(fd, *ocache);
- if(force_disk) {
+ if (force_disk) {
(*ocache)->flag |= PTCACHE_DISK_CACHE;
(*ocache)->step = 1;
}
@@ -3354,7 +3372,7 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC
static void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd)
{
- if(pd && pd->tex)
+ if (pd && pd->tex)
pd->tex=newlibadr_us(fd, id->lib, pd->tex);
}
@@ -3366,8 +3384,8 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
int a;
part= main->particle.first;
- while(part) {
- if(part->id.flag & LIB_NEEDLINK) {
+ while (part) {
+ if (part->id.flag & LIB_NEEDLINK) {
if (part->adt) lib_link_animdata(fd, &part->id, part->adt);
part->ipo= newlibadr_us(fd, part->id.lib, part->ipo); // XXX depreceated - old animation system
@@ -3379,37 +3397,37 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
lib_link_partdeflect(fd, &part->id, part->pd);
lib_link_partdeflect(fd, &part->id, part->pd2);
- if(part->effector_weights)
+ if (part->effector_weights)
part->effector_weights->group = newlibadr(fd, part->id.lib, part->effector_weights->group);
- if(part->dupliweights.first && part->dup_group) {
+ if (part->dupliweights.first && part->dup_group) {
int index_ok = 0;
/* check for old files without indices (all indexes 0) */
dw = part->dupliweights.first;
- if(part->dupliweights.first == part->dupliweights.last) {
+ if (part->dupliweights.first == part->dupliweights.last) {
/* special case for only one object in the group */
index_ok = 1;
}
else {
- for(; dw; dw=dw->next) {
- if(dw->index > 0) {
+ for (; dw; dw=dw->next) {
+ if (dw->index > 0) {
index_ok = 1;
break;
}
}
}
- if(index_ok) {
+ if (index_ok) {
/* if we have indexes, let's use them */
dw = part->dupliweights.first;
- for(; dw; dw=dw->next) {
+ for (; dw; dw=dw->next) {
GroupObject *go = (GroupObject *)BLI_findlink(&part->dup_group->gobject, dw->index);
dw->ob = go ? go->ob : NULL;
}
}
else {
/* otherwise try to get objects from own library (won't work on library linked groups) */
- for(; dw; dw=dw->next)
+ for (; dw; dw=dw->next)
dw->ob = newlibadr(fd, part->id.lib, dw->ob);
}
}
@@ -3417,12 +3435,12 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
part->dupliweights.first = part->dupliweights.last = NULL;
}
- if(part->boids) {
+ if (part->boids) {
BoidState *state = part->boids->states.first;
BoidRule *rule;
- for(; state; state=state->next) {
+ for (; state; state=state->next) {
rule = state->rules.first;
- for(; rule; rule=rule->next)
+ for (; rule; rule=rule->next)
switch(rule->type) {
case eBoidRuleType_Goal:
case eBoidRuleType_Avoid:
@@ -3441,9 +3459,9 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
}
}
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
mtex= part->mtex[a];
- if(mtex) {
+ if (mtex) {
mtex->tex = newlibadr_us(fd, part->id.lib, mtex->tex);
mtex->object = newlibadr(fd, part->id.lib, mtex->object);
}
@@ -3457,7 +3475,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
static void direct_link_partdeflect(PartDeflect *pd)
{
- if(pd) pd->rng=NULL;
+ if (pd) pd->rng=NULL;
}
static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
@@ -3472,7 +3490,7 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
direct_link_partdeflect(part->pd2);
part->effector_weights = newdataadr(fd, part->effector_weights);
- if(!part->effector_weights)
+ if (!part->effector_weights)
part->effector_weights = BKE_add_effector_weights(part->eff_group);
link_list(fd, &part->dupliweights);
@@ -3480,17 +3498,17 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
part->boids= newdataadr(fd, part->boids);
part->fluid= newdataadr(fd, part->fluid);
- if(part->boids) {
+ if (part->boids) {
BoidState *state;
link_list(fd, &part->boids->states);
- for(state=part->boids->states.first; state; state=state->next) {
+ for (state=part->boids->states.first; state; state=state->next) {
link_list(fd, &state->rules);
link_list(fd, &state->conditions);
link_list(fd, &state->actions);
}
}
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
part->mtex[a]= newdataadr(fd, part->mtex[a]);
}
}
@@ -3499,20 +3517,20 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase
{
ParticleSystem *psys, *psysnext;
- for(psys=particles->first; psys; psys=psysnext){
+ for (psys=particles->first; psys; psys=psysnext) {
psysnext= psys->next;
psys->part = newlibadr_us(fd, id->lib, psys->part);
- if(psys->part) {
+ if (psys->part) {
ParticleTarget *pt = psys->targets.first;
- for(; pt; pt=pt->next)
+ for (; pt; pt=pt->next)
pt->ob=newlibadr(fd, id->lib, pt->ob);
psys->parent= newlibadr_us(fd, id->lib, psys->parent);
psys->target_ob = newlibadr(fd, id->lib, psys->target_ob);
- if(psys->clmd) {
+ if (psys->clmd) {
/* XXX - from reading existing code this seems correct but intended usage of
* pointcache should /w cloth should be added in 'ParticleSystem' - campbell */
psys->clmd->point_cache= psys->pointcache;
@@ -3537,16 +3555,16 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
ParticleData *pa;
int a;
- for(psys=particles->first; psys; psys=psys->next) {
+ for (psys=particles->first; psys; psys=psys->next) {
psys->particles=newdataadr(fd,psys->particles);
- if(psys->particles && psys->particles->hair){
- for(a=0,pa=psys->particles; a<psys->totpart; a++, pa++)
+ if (psys->particles && psys->particles->hair) {
+ for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++)
pa->hair=newdataadr(fd,pa->hair);
}
- if(psys->particles && psys->particles->keys){
- for(a=0,pa=psys->particles; a<psys->totpart; a++, pa++) {
+ if (psys->particles && psys->particles->keys) {
+ for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++) {
pa->keys= NULL;
pa->totkey= 0;
}
@@ -3554,14 +3572,14 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
psys->flag &= ~PSYS_KEYED;
}
- if(psys->particles && psys->particles->boid) {
+ if (psys->particles && psys->particles->boid) {
pa = psys->particles;
pa->boid = newdataadr(fd, pa->boid);
- for(a=1,pa++; a<psys->totpart; a++, pa++)
+ for (a=1,pa++; a<psys->totpart; a++, pa++)
pa->boid = (pa-1)->boid + 1;
}
- else if(psys->particles) {
- for(a=0,pa=psys->particles; a<psys->totpart; a++, pa++)
+ else if (psys->particles) {
+ for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++)
pa->boid = NULL;
}
@@ -3584,7 +3602,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
direct_link_pointcache_list(fd, &psys->ptcaches, &psys->pointcache, 0);
- if(psys->clmd) {
+ if (psys->clmd) {
psys->clmd = newdataadr(fd, psys->clmd);
psys->clmd->clothObject = NULL;
@@ -3592,8 +3610,8 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
psys->clmd->sim_parms->effector_weights = NULL;
psys->clmd->coll_parms= newdataadr(fd, psys->clmd->coll_parms);
- if(psys->clmd->sim_parms) {
- if(psys->clmd->sim_parms->presets > 10)
+ if (psys->clmd->sim_parms) {
+ if (psys->clmd->sim_parms->presets > 10)
psys->clmd->sim_parms->presets = 0;
}
@@ -3620,7 +3638,7 @@ static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface)
* to each image it used. - z0r */
for (i=0; i<totface; i++, tf++) {
tf->tpage= newlibadr(fd, me->id.lib, tf->tpage);
- if(tf->tpage && tf->tpage->id.us==0)
+ if (tf->tpage && tf->tpage->id.us==0)
tf->tpage->id.us= 1;
}
}
@@ -3628,10 +3646,10 @@ static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface)
static void lib_link_customdata_mtface(FileData *fd, Mesh *me, CustomData *fdata, int totface)
{
int i;
- for(i=0; i<fdata->totlayer; i++) {
+ for (i=0; i<fdata->totlayer; i++) {
CustomDataLayer *layer = &fdata->layers[i];
- if(layer->type == CD_MTFACE)
+ if (layer->type == CD_MTFACE)
lib_link_mtface(fd, me, layer->data, totface);
}
@@ -3641,16 +3659,16 @@ static void lib_link_customdata_mtpoly(FileData *fd, Mesh *me, CustomData *pdata
{
int i;
- for(i=0; i<pdata->totlayer; i++) {
+ for (i=0; i<pdata->totlayer; i++) {
CustomDataLayer *layer = &pdata->layers[i];
- if(layer->type == CD_MTEXPOLY) {
+ if (layer->type == CD_MTEXPOLY) {
MTexPoly *tf= layer->data;
int i;
for (i=0; i<totface; i++, tf++) {
tf->tpage= newlibadr(fd, me->id.lib, tf->tpage);
- if(tf->tpage && tf->tpage->id.us==0)
+ if (tf->tpage && tf->tpage->id.us==0)
tf->tpage->id.us= 1;
}
}
@@ -3662,8 +3680,8 @@ static void lib_link_mesh(FileData *fd, Main *main)
Mesh *me;
me= main->mesh.first;
- while(me) {
- if(me->id.flag & LIB_NEEDLINK) {
+ while (me) {
+ if (me->id.flag & LIB_NEEDLINK) {
int i;
/*Link ID Properties -- and copy this comment EXACTLY for easy finding
@@ -3672,8 +3690,8 @@ static void lib_link_mesh(FileData *fd, Main *main)
if (me->adt) lib_link_animdata(fd, &me->id, me->adt);
/* this check added for python created meshes */
- if(me->mat) {
- for(i=0; i<me->totcol; i++) {
+ if (me->mat) {
+ for (i=0; i<me->totcol; i++) {
me->mat[i]= newlibadr_us(fd, me->id.lib, me->mat[i]);
}
}
@@ -3685,7 +3703,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
lib_link_customdata_mtface(fd, me, &me->fdata, me->totface);
lib_link_customdata_mtpoly(fd, me, &me->pdata, me->totpoly);
- if(me->mr && me->mr->levels.first)
+ if (me->mr && me->mr->levels.first)
lib_link_customdata_mtface(fd, me, &me->mr->fdata,
((MultiresLevel*)me->mr->levels.first)->totface);
@@ -3695,7 +3713,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
}
/*
- * Re-tesselate, even if the polys were just created from tessfaces, this
+ * Re-tessellate, even if the polys were just created from tessfaces, this
* is important because it:
* - fill the CD_POLYINDEX layer
* - gives consistency of tessface between loading from a file and
@@ -3730,7 +3748,7 @@ static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts)
for (i= count; i > 0; i--, mdverts++) {
/*convert to vgroup allocation system*/
MDeformWeight *dw;
- if(mdverts->dw && (dw= newdataadr(fd, mdverts->dw))) {
+ if (mdverts->dw && (dw= newdataadr(fd, mdverts->dw))) {
const ssize_t dw_len= mdverts->totweight * sizeof(MDeformWeight);
void *dw_tmp= MEM_mallocN(dw_len, "direct_link_dverts");
memcpy(dw_tmp, dw, dw_len);
@@ -3746,23 +3764,33 @@ static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts)
static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int external)
{
- if(mdisps) {
+ if (mdisps) {
int i;
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
mdisps[i].disps = newdataadr(fd, mdisps[i].disps);
+ mdisps[i].hidden = newdataadr(fd, mdisps[i].hidden);
+
+ if (mdisps[i].totdisp && !mdisps[i].level) {
+ /* this calculation is only correct for loop mdisps;
+ if loading pre-BMesh face mdisps this will be
+ overwritten with the correct value in
+ bm_corners_to_loops() */
+ float gridsize = sqrtf(mdisps[i].totdisp);
+ mdisps[i].level = (int)(logf(gridsize - 1.0f) / M_LN2) + 1;
+ }
- if( (fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps) ) {
+ if ( (fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps) ) {
/* DNA_struct_switch_endian doesn't do endian swap for (*disps)[] */
/* this does swap for data written at write_mdisps() - readfile.c */
int x;
float *tmpdisps= *mdisps[i].disps;
- for(x=0;x<mdisps[i].totdisp*3;x++) {
+ for (x=0;x<mdisps[i].totdisp*3;x++) {
SWITCH_INT(*tmpdisps);
tmpdisps++;
}
}
- if(!external && !mdisps[i].disps)
+ if (!external && !mdisps[i].disps)
mdisps[i].totdisp = 0;
}
}
@@ -3779,12 +3807,12 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count)
while (i < data->totlayer) {
CustomDataLayer *layer = &data->layers[i];
- if(layer->flag & CD_FLAG_EXTERNAL)
+ if (layer->flag & CD_FLAG_EXTERNAL)
layer->flag &= ~CD_FLAG_IN_MEMORY;
if (CustomData_verify_versions(data, i)) {
layer->data = newdataadr(fd, layer->data);
- if(layer->type == CD_MDISPS)
+ if (layer->type == CD_MDISPS)
direct_link_mdisps(fd, count, layer->data, layer->flag & CD_FLAG_EXTERNAL);
i++;
}
@@ -3862,7 +3890,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
/* Multires data */
mesh->mr= newdataadr(fd, mesh->mr);
- if(mesh->mr) {
+ if (mesh->mr) {
MultiresLevel *lvl;
link_list(fd, &mesh->mr->levels);
@@ -3883,13 +3911,13 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
because some saved files either do not have a verts
array, or the verts array contains out-of-date
data. */
- if(mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert) {
- if(mesh->mr->verts)
+ if (mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert) {
+ if (mesh->mr->verts)
MEM_freeN(mesh->mr->verts);
mesh->mr->verts = MEM_dupallocN(mesh->mvert);
}
- for(; lvl; lvl= lvl->next) {
+ for (; lvl; lvl= lvl->next) {
lvl->verts= newdataadr(fd, lvl->verts);
lvl->faces= newdataadr(fd, lvl->faces);
lvl->edges= newdataadr(fd, lvl->edges);
@@ -3899,12 +3927,12 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
/* if multires is present but has no valid vertex data,
* there's no way to recover it; silently remove multires */
- if(mesh->mr && !mesh->mr->verts) {
+ if (mesh->mr && !mesh->mr->verts) {
multires_free(mesh->mr);
mesh->mr = NULL;
}
- if((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) {
+ if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) {
TFace *tf= mesh->tface;
int i;
@@ -3924,9 +3952,9 @@ static void lib_link_latt(FileData *fd, Main *main)
Lattice *lt;
lt= main->latt.first;
- while(lt) {
- if(lt->id.flag & LIB_NEEDLINK) {
- if(lt->adt) lib_link_animdata(fd, &lt->id, lt->adt);
+ while (lt) {
+ if (lt->id.flag & LIB_NEEDLINK) {
+ if (lt->adt) lib_link_animdata(fd, &lt->id, lt->adt);
lt->ipo= newlibadr_us(fd, lt->id.lib, lt->ipo); // XXX depreceated - old animation system
lt->key= newlibadr_us(fd, lt->id.lib, lt->key);
@@ -3960,7 +3988,7 @@ static void lib_link_modifiers__linkModifiers(void *userData, Object *ob,
*idpoin = newlibadr(fd, ob->id.lib, *idpoin);
/* hardcoded bad exception; non-object modifier data gets user count (texture, displace) */
- if(*idpoin && GS((*idpoin)->name)!=ID_OB)
+ if (*idpoin && GS((*idpoin)->name)!=ID_OB)
(*idpoin)->us++;
}
static void lib_link_modifiers(FileData *fd, Object *ob)
@@ -3979,8 +4007,8 @@ static void lib_link_object(FileData *fd, Main *main)
int warn=0, a;
ob= main->object.first;
- while(ob) {
- if(ob->id.flag & LIB_NEEDLINK) {
+ while (ob) {
+ if (ob->id.flag & LIB_NEEDLINK) {
if (ob->id.properties) IDP_LibLinkProperty(ob->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
if (ob->adt) lib_link_animdata(fd, &ob->id, ob->adt);
@@ -3995,9 +4023,9 @@ static void lib_link_object(FileData *fd, Main *main)
ob->dup_group= newlibadr_us(fd, ob->id.lib, ob->dup_group);
ob->proxy= newlibadr_us(fd, ob->id.lib, ob->proxy);
- if(ob->proxy) {
+ if (ob->proxy) {
/* paranoia check, actually a proxy_from pointer should never be written... */
- if(ob->proxy->id.lib==NULL) {
+ if (ob->proxy->id.lib==NULL) {
ob->proxy->proxy_from= NULL;
ob->proxy= NULL;
@@ -4018,8 +4046,8 @@ static void lib_link_object(FileData *fd, Main *main)
poin= ob->data;
ob->data= newlibadr_us(fd, ob->id.lib, ob->data);
- if(ob->data==NULL && poin!=NULL) {
- if(ob->id.lib)
+ if (ob->data==NULL && poin!=NULL) {
+ if (ob->id.lib)
printf("Can't find obdata of %s lib %s\n", ob->id.name+2, ob->id.lib->name);
else
printf("Object %s lost data.\n", ob->id.name+2);
@@ -4027,20 +4055,20 @@ static void lib_link_object(FileData *fd, Main *main)
ob->type= OB_EMPTY;
warn= 1;
- if(ob->pose) {
+ if (ob->pose) {
free_pose(ob->pose);
ob->pose= NULL;
ob->mode &= ~OB_MODE_POSE;
}
}
- for(a=0; a<ob->totcol; a++) ob->mat[a]= newlibadr_us(fd, ob->id.lib, ob->mat[a]);
+ for (a=0; a<ob->totcol; a++) ob->mat[a]= newlibadr_us(fd, ob->id.lib, ob->mat[a]);
/* When the object is local and the data is library its possible
* the material list size gets out of sync. [#22663] */
- if(ob->data && ob->id.lib != ((ID *)ob->data)->lib) {
+ if (ob->data && ob->id.lib != ((ID *)ob->data)->lib) {
short *totcol_data= give_totcolp(ob);
/* Only expand so as not to loose any object materials that might be set. */
- if(totcol_data && *totcol_data > ob->totcol) {
+ if (totcol_data && *totcol_data > ob->totcol) {
/* printf("'%s' %d -> %d\n", ob->id.name, ob->totcol, *totcol_data); */
resize_object_material(ob, *totcol_data);
}
@@ -4061,22 +4089,22 @@ static void lib_link_object(FileData *fd, Main *main)
lib_link_nlastrips(fd, &ob->id, &ob->nlastrips);
// >>> XXX depreceated - old animation system
- for(paf= ob->effect.first; paf; paf= paf->next) {
- if(paf->type==EFF_PARTICLE) {
+ for (paf= ob->effect.first; paf; paf= paf->next) {
+ if (paf->type==EFF_PARTICLE) {
paf->group= newlibadr_us(fd, ob->id.lib, paf->group);
}
}
sens= ob->sensors.first;
- while(sens) {
- for(a=0; a<sens->totlinks; a++)
+ while (sens) {
+ for (a=0; a<sens->totlinks; a++)
sens->links[a]= newglobadr(fd, sens->links[a]);
- if(sens->type==SENS_TOUCH) {
+ if (sens->type==SENS_TOUCH) {
bTouchSensor *ts= sens->data;
ts->ma= newlibadr(fd, ob->id.lib, ts->ma);
}
- else if(sens->type==SENS_MESSAGE) {
+ else if (sens->type==SENS_MESSAGE) {
bMessageSensor *ms= sens->data;
ms->fromObject=
newlibadr(fd, ob->id.lib, ms->fromObject);
@@ -4085,11 +4113,11 @@ static void lib_link_object(FileData *fd, Main *main)
}
cont= ob->controllers.first;
- while(cont) {
- for(a=0; a<cont->totlinks; a++)
+ while (cont) {
+ for (a=0; a<cont->totlinks; a++)
cont->links[a]= newglobadr(fd, cont->links[a]);
- if(cont->type==CONT_PYTHON) {
+ if (cont->type==CONT_PYTHON) {
bPythonCont *pc= cont->data;
pc->text= newlibadr(fd, ob->id.lib, pc->text);
}
@@ -4100,35 +4128,35 @@ static void lib_link_object(FileData *fd, Main *main)
}
act= ob->actuators.first;
- while(act) {
- if(act->type==ACT_SOUND) {
+ while (act) {
+ if (act->type==ACT_SOUND) {
bSoundActuator *sa= act->data;
sa->sound= newlibadr_us(fd, ob->id.lib, sa->sound);
}
- else if(act->type==ACT_GAME) {
+ else if (act->type==ACT_GAME) {
/* bGameActuator *ga= act->data; */
}
- else if(act->type==ACT_CAMERA) {
+ else if (act->type==ACT_CAMERA) {
bCameraActuator *ca= act->data;
ca->ob= newlibadr(fd, ob->id.lib, ca->ob);
}
/* leave this one, it's obsolete but necessary to read for conversion */
- else if(act->type==ACT_ADD_OBJECT) {
+ else if (act->type==ACT_ADD_OBJECT) {
bAddObjectActuator *eoa= act->data;
- if(eoa) eoa->ob= newlibadr(fd, ob->id.lib, eoa->ob);
+ if (eoa) eoa->ob= newlibadr(fd, ob->id.lib, eoa->ob);
}
- else if(act->type==ACT_OBJECT) {
+ else if (act->type==ACT_OBJECT) {
bObjectActuator *oa= act->data;
- if(oa==NULL) {
+ if (oa==NULL) {
init_actuator(act);
}
else {
oa->reference= newlibadr(fd, ob->id.lib, oa->reference);
}
}
- else if(act->type==ACT_EDIT_OBJECT) {
+ else if (act->type==ACT_EDIT_OBJECT) {
bEditObjectActuator *eoa= act->data;
- if(eoa==NULL) {
+ if (eoa==NULL) {
init_actuator(act);
}
else {
@@ -4136,44 +4164,44 @@ static void lib_link_object(FileData *fd, Main *main)
eoa->me= newlibadr(fd, ob->id.lib, eoa->me);
}
}
- else if(act->type==ACT_SCENE) {
+ else if (act->type==ACT_SCENE) {
bSceneActuator *sa= act->data;
sa->camera= newlibadr(fd, ob->id.lib, sa->camera);
sa->scene= newlibadr(fd, ob->id.lib, sa->scene);
}
- else if(act->type==ACT_ACTION) {
+ else if (act->type==ACT_ACTION) {
bActionActuator *aa= act->data;
aa->act= newlibadr(fd, ob->id.lib, aa->act);
}
- else if(act->type==ACT_SHAPEACTION) {
+ else if (act->type==ACT_SHAPEACTION) {
bActionActuator *aa= act->data;
aa->act= newlibadr(fd, ob->id.lib, aa->act);
}
- else if(act->type==ACT_PROPERTY) {
+ else if (act->type==ACT_PROPERTY) {
bPropertyActuator *pa= act->data;
pa->ob= newlibadr(fd, ob->id.lib, pa->ob);
}
- else if(act->type==ACT_MESSAGE) {
+ else if (act->type==ACT_MESSAGE) {
bMessageActuator *ma= act->data;
ma->toObject= newlibadr(fd, ob->id.lib, ma->toObject);
}
- else if(act->type==ACT_2DFILTER){
+ else if (act->type==ACT_2DFILTER) {
bTwoDFilterActuator *_2dfa = act->data;
_2dfa->text= newlibadr(fd, ob->id.lib, _2dfa->text);
}
- else if(act->type==ACT_PARENT) {
+ else if (act->type==ACT_PARENT) {
bParentActuator *parenta = act->data;
parenta->ob = newlibadr(fd, ob->id.lib, parenta->ob);
}
- else if(act->type==ACT_STATE) {
+ else if (act->type==ACT_STATE) {
/* bStateActuator *statea = act->data; */
}
- else if(act->type==ACT_ARMATURE) {
+ else if (act->type==ACT_ARMATURE) {
bArmatureActuator *arma= act->data;
arma->target= newlibadr(fd, ob->id.lib, arma->target);
arma->subtarget= newlibadr(fd, ob->id.lib, arma->subtarget);
}
- else if(act->type==ACT_STEERING) {
+ else if (act->type==ACT_STEERING) {
bSteeringActuator *steeringa = act->data;
steeringa->target = newlibadr(fd, ob->id.lib, steeringa->target);
steeringa->navmesh = newlibadr(fd, ob->id.lib, steeringa->navmesh);
@@ -4184,24 +4212,24 @@ static void lib_link_object(FileData *fd, Main *main)
{
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
- if(fluidmd && fluidmd->fss)
+ if (fluidmd && fluidmd->fss)
fluidmd->fss->ipo = newlibadr_us(fd, ob->id.lib, fluidmd->fss->ipo);
}
{
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 */
}
}
/* texture field */
- if(ob->pd)
+ if (ob->pd)
lib_link_partdeflect(fd, &ob->id, ob->pd);
- if(ob->soft)
+ if (ob->soft)
ob->soft->effector_weights->group = newlibadr(fd, ob->id.lib, ob->soft->effector_weights->group);
lib_link_particlesystems(fd, ob, &ob->id, &ob->particlesystem);
@@ -4210,7 +4238,7 @@ static void lib_link_object(FileData *fd, Main *main)
ob= ob->id.next;
}
- if(warn) {
+ if (warn) {
BKE_report(fd->reports, RPT_WARNING, "Warning in console");
}
}
@@ -4267,7 +4295,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
md->scene = NULL;
/* if modifiers disappear, or for upward compatibility */
- if(NULL==modifierType_getInfo(md->type))
+ if (NULL==modifierType_getInfo(md->type))
md->type= eModifierType_None;
if (md->type==eModifierType_Subsurf) {
@@ -4290,15 +4318,15 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
direct_link_pointcache_list(fd, &clmd->ptcaches, &clmd->point_cache, 0);
- if(clmd->sim_parms) {
- if(clmd->sim_parms->presets > 10)
+ if (clmd->sim_parms) {
+ if (clmd->sim_parms->presets > 10)
clmd->sim_parms->presets = 0;
clmd->sim_parms->reset = 0;
clmd->sim_parms->effector_weights = newdataadr(fd, clmd->sim_parms->effector_weights);
- if(!clmd->sim_parms->effector_weights) {
+ if (!clmd->sim_parms->effector_weights) {
clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL);
}
}
@@ -4307,7 +4335,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
fluidmd->fss= newdataadr(fd, fluidmd->fss);
- if(fluidmd->fss) {
+ if (fluidmd->fss) {
fluidmd->fss->fmd= fluidmd;
fluidmd->fss->meshVelocities = NULL;
}
@@ -4315,7 +4343,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
else if (md->type==eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData*) md;
- if(smd->type==MOD_SMOKE_TYPE_DOMAIN)
+ if (smd->type==MOD_SMOKE_TYPE_DOMAIN)
{
smd->flow = NULL;
smd->coll = NULL;
@@ -4330,16 +4358,16 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
smd->domain->tex_wt = NULL;
smd->domain->effector_weights = newdataadr(fd, smd->domain->effector_weights);
- if(!smd->domain->effector_weights)
+ if (!smd->domain->effector_weights)
smd->domain->effector_weights = BKE_add_effector_weights(NULL);
direct_link_pointcache_list(fd, &(smd->domain->ptcaches[0]), &(smd->domain->point_cache[0]), 1);
/* Smoke uses only one cache from now on, so store pointer convert */
- if(smd->domain->ptcaches[1].first || smd->domain->point_cache[1]) {
- if(smd->domain->point_cache[1]) {
+ if (smd->domain->ptcaches[1].first || smd->domain->point_cache[1]) {
+ if (smd->domain->point_cache[1]) {
PointCache *cache = newdataadr(fd, smd->domain->point_cache[1]);
- if(cache->flag & PTCACHE_FAKE_SMOKE)
+ if (cache->flag & PTCACHE_FAKE_SMOKE)
; /* Smoke was already saved in "new format" and this cache is a fake one. */
else
printf("High resolution smoke cache not available due to pointcache update. Please reset the simulation.\n");
@@ -4361,7 +4389,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
smd->flow = NULL;
smd->domain = NULL;
smd->coll = newdataadr(fd, smd->coll);
- if(smd->coll)
+ if (smd->coll)
{
smd->coll->points = NULL;
smd->coll->numpoints = 0;
@@ -4374,7 +4402,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
else if (md->type==eModifierType_DynamicPaint) {
DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
- if(pmd->canvas)
+ if (pmd->canvas)
{
pmd->canvas = newdataadr(fd, pmd->canvas);
pmd->canvas->pmd = pmd;
@@ -4390,12 +4418,12 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
surface->data = NULL;
direct_link_pointcache_list(fd, &(surface->ptcaches), &(surface->pointcache), 1);
- if(!(surface->effector_weights = newdataadr(fd, surface->effector_weights)))
+ if (!(surface->effector_weights = newdataadr(fd, surface->effector_weights)))
surface->effector_weights = BKE_add_effector_weights(NULL);
}
}
}
- if(pmd->brush)
+ if (pmd->brush)
{
pmd->brush = newdataadr(fd, pmd->brush);
pmd->brush->pmd = pmd;
@@ -4444,20 +4472,22 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
HookModifierData *hmd = (HookModifierData*) md;
hmd->indexar= newdataadr(fd, hmd->indexar);
- if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
+ if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
int a;
- for(a=0; a<hmd->totindex; a++) {
+ for (a=0; a<hmd->totindex; a++) {
SWITCH_INT(hmd->indexar[a]);
}
}
- } else if (md->type==eModifierType_ParticleSystem) {
+ }
+ else if (md->type==eModifierType_ParticleSystem) {
ParticleSystemModifierData *psmd = (ParticleSystemModifierData*) md;
psmd->dm= NULL;
psmd->psys= newdataadr(fd, psmd->psys);
psmd->flag &= ~eParticleSystemFlag_psys_updated;
psmd->flag |= eParticleSystemFlag_file_loaded;
- } else if (md->type==eModifierType_Explode) {
+ }
+ else if (md->type==eModifierType_Explode) {
ExplodeModifierData *psmd = (ExplodeModifierData*) md;
psmd->facepa=NULL;
@@ -4475,25 +4505,25 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
mmd->bindweights= newdataadr(fd, mmd->bindweights);
mmd->bindcos= newdataadr(fd, mmd->bindcos);
- if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
+ if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
int a;
- if(mmd->bindoffsets)
- for(a=0; a<mmd->totvert+1; a++)
- SWITCH_INT(mmd->bindoffsets[a])
- if(mmd->bindcagecos)
- for(a=0; a<mmd->totcagevert*3; a++)
- SWITCH_INT(mmd->bindcagecos[a])
- if(mmd->dynverts)
- for(a=0; a<mmd->totvert; a++)
- SWITCH_INT(mmd->dynverts[a])
+ if (mmd->bindoffsets)
+ for (a=0; a<mmd->totvert+1; a++)
+ SWITCH_INT(mmd->bindoffsets[a]);
+ if (mmd->bindcagecos)
+ for (a=0; a<mmd->totcagevert*3; a++)
+ SWITCH_INT(mmd->bindcagecos[a]);
+ if (mmd->dynverts)
+ for (a=0; a<mmd->totvert; a++)
+ SWITCH_INT(mmd->dynverts[a]);
- if(mmd->bindweights)
- for(a=0; a<mmd->totcagevert*mmd->totvert; a++)
- SWITCH_INT(mmd->bindweights[a])
- if(mmd->bindcos)
- for(a=0; a<mmd->totcagevert*3; a++)
- SWITCH_INT(mmd->bindcos[a])
+ if (mmd->bindweights)
+ for (a=0; a<mmd->totcagevert*mmd->totvert; a++)
+ SWITCH_INT(mmd->bindweights[a]);
+ if (mmd->bindcos)
+ for (a=0; a<mmd->totcagevert*3; a++)
+ SWITCH_INT(mmd->bindcos[a]);
}
}
else if (md->type==eModifierType_Ocean) {
@@ -4506,14 +4536,14 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
WarpModifierData *tmd = (WarpModifierData *) md;
tmd->curfalloff= newdataadr(fd, tmd->curfalloff);
- if(tmd->curfalloff)
+ if (tmd->curfalloff)
direct_link_curvemapping(fd, tmd->curfalloff);
}
else if (md->type==eModifierType_WeightVGEdit) {
WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
wmd->cmap_curve = newdataadr(fd, wmd->cmap_curve);
- if(wmd->cmap_curve)
+ if (wmd->cmap_curve)
direct_link_curvemapping(fd, wmd->cmap_curve);
}
}
@@ -4532,7 +4562,7 @@ static void direct_link_object(FileData *fd, Object *ob)
/* loading saved files with editmode enabled works, but for undo we like
to stay in object mode during undo presses so keep editmode disabled */
- if(fd->memfile)
+ if (fd->memfile)
ob->mode &= ~(OB_MODE_EDIT|OB_MODE_PARTICLE_EDIT);
ob->disp.first=ob->disp.last= NULL;
@@ -4562,11 +4592,11 @@ static void direct_link_object(FileData *fd, Object *ob)
link_list(fd, &ob->effect);
paf= ob->effect.first;
- while(paf) {
- if(paf->type==EFF_PARTICLE) {
+ while (paf) {
+ if (paf->type==EFF_PARTICLE) {
paf->keys= NULL;
}
- if(paf->type==EFF_WAVE) {
+ if (paf->type==EFF_WAVE) {
WaveEff *wav = (WaveEff*) paf;
PartEff *next = paf->next;
WaveModifierData *wmd = (WaveModifierData*) modifier_new(eModifierType_Wave);
@@ -4590,7 +4620,7 @@ static void direct_link_object(FileData *fd, Object *ob)
paf = next;
continue;
}
- if(paf->type==EFF_BUILD) {
+ if (paf->type==EFF_BUILD) {
BuildEff *baf = (BuildEff*) paf;
PartEff *next = paf->next;
BuildModifierData *bmd = (BuildModifierData*) modifier_new(eModifierType_Build);
@@ -4614,7 +4644,7 @@ static void direct_link_object(FileData *fd, Object *ob)
ob->pd= newdataadr(fd, ob->pd);
direct_link_partdeflect(ob->pd);
ob->soft= newdataadr(fd, ob->soft);
- if(ob->soft) {
+ if (ob->soft) {
SoftBody *sb= ob->soft;
sb->bpoint= NULL; // init pointers so it gets rebuilt nicely
@@ -4624,15 +4654,15 @@ static void direct_link_object(FileData *fd, Object *ob)
/* still have to be loaded to be compatible with old files */
sb->keys= newdataadr(fd, sb->keys);
test_pointer_array(fd, (void **)&sb->keys);
- if(sb->keys) {
+ if (sb->keys) {
int a;
- for(a=0; a<sb->totkey; a++) {
+ for (a=0; a<sb->totkey; a++) {
sb->keys[a]= newdataadr(fd, sb->keys[a]);
}
}
sb->effector_weights = newdataadr(fd, sb->effector_weights);
- if(!sb->effector_weights)
+ if (!sb->effector_weights)
sb->effector_weights = BKE_add_effector_weights(NULL);
direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, 0);
@@ -4645,15 +4675,15 @@ static void direct_link_object(FileData *fd, Object *ob)
link_list(fd, &ob->prop);
prop= ob->prop.first;
- while(prop) {
+ while (prop) {
prop->poin= newdataadr(fd, prop->poin);
- if(prop->poin==NULL) prop->poin= &prop->data;
+ if (prop->poin==NULL) prop->poin= &prop->data;
prop= prop->next;
}
link_list(fd, &ob->sensors);
sens= ob->sensors.first;
- while(sens) {
+ while (sens) {
sens->data= newdataadr(fd, sens->data);
sens->links= newdataadr(fd, sens->links);
test_pointer_array(fd, (void **)&sens->links);
@@ -4666,11 +4696,12 @@ static void direct_link_object(FileData *fd, Object *ob)
if (ob->init_state) {
/* if a known first state is specified, set it so that the game will start ok */
ob->state = ob->init_state;
- } else if (!ob->state) {
+ }
+ else if (!ob->state) {
ob->state = 1;
}
cont= ob->controllers.first;
- while(cont) {
+ while (cont) {
cont->data= newdataadr(fd, cont->data);
cont->links= newdataadr(fd, cont->links);
test_pointer_array(fd, (void **)&cont->links);
@@ -4681,7 +4712,7 @@ static void direct_link_object(FileData *fd, Object *ob)
link_glob_list(fd, &ob->actuators);
act= ob->actuators.first;
- while(act) {
+ while (act) {
act->data= newdataadr(fd, act->data);
act= act->next;
}
@@ -4692,9 +4723,9 @@ static void direct_link_object(FileData *fd, Object *ob)
HookModifierData *hmd = (HookModifierData*) modifier_new(eModifierType_Hook);
hook->indexar= newdataadr(fd, hook->indexar);
- if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
+ if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
int a;
- for(a=0; a<hook->totindex; a++) {
+ for (a=0; a<hook->totindex; a++) {
SWITCH_INT(hook->indexar[a]);
}
}
@@ -4729,7 +4760,7 @@ static void direct_link_object(FileData *fd, Object *ob)
/* in case this value changes in future, clamp else we get undefined behavior */
CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
- if(ob->sculpt) {
+ if (ob->sculpt) {
ob->sculpt= MEM_callocN(sizeof(SculptSession), "reload sculpt session");
}
}
@@ -4741,14 +4772,14 @@ static void composite_patch(bNodeTree *ntree, Scene *scene)
{
bNode *node;
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->id==NULL && ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE))
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->id==NULL && ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE))
node->id= &scene->id;
}
static void link_paint(FileData *fd, Scene *sce, Paint *p)
{
- if(p) {
+ if (p) {
p->brush= newlibadr_us(fd, sce->id.lib, p->brush);
p->paint_cursor= NULL;
}
@@ -4764,8 +4795,8 @@ static void lib_link_scene(FileData *fd, Main *main)
TimeMarker *marker;
sce= main->scene.first;
- while(sce) {
- if(sce->id.flag & LIB_NEEDLINK) {
+ while (sce) {
+ if (sce->id.flag & LIB_NEEDLINK) {
/*Link ID Properties -- and copy this comment EXACTLY for easy finding
of library blocks that implement this.*/
if (sce->id.properties) IDP_LibLinkProperty(sce->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
@@ -4785,35 +4816,38 @@ static void lib_link_scene(FileData *fd, Main *main)
link_paint(fd, sce, &sce->toolsettings->uvsculpt->paint);
sce->toolsettings->skgen_template = newlibadr(fd, sce->id.lib, sce->toolsettings->skgen_template);
- for(base= sce->base.first; base; base= next) {
+ for (base= sce->base.first; base; base= next) {
next= base->next;
/* base->object= newlibadr_us(fd, sce->id.lib, base->object); */
base->object= newlibadr_us(fd, sce->id.lib, base->object);
- if(base->object==NULL) {
+ if (base->object==NULL) {
BKE_reportf_wrap(fd->reports, RPT_ERROR,
"LIB ERROR: Object lost from scene:'%s\'\n",
sce->id.name+2);
BLI_remlink(&sce->base, base);
- if(base==sce->basact) sce->basact= NULL;
+ if (base==sce->basact) sce->basact= NULL;
MEM_freeN(base);
}
}
SEQ_BEGIN(sce->ed, seq) {
- if(seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo);
+ if (seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo);
seq->scene_sound = NULL;
- if(seq->scene) {
+ if (seq->scene) {
seq->scene= newlibadr(fd, sce->id.lib, seq->scene);
- if(seq->scene) {
+ if (seq->scene) {
seq->scene_sound = sound_scene_add_scene_sound_defaults(sce, seq);
}
}
- if(seq->scene_camera) seq->scene_camera= newlibadr(fd, sce->id.lib, seq->scene_camera);
- if(seq->sound) {
+ if (seq->clip) {
+ seq->clip = newlibadr(fd, sce->id.lib, seq->clip);
+ }
+ if (seq->scene_camera) seq->scene_camera= newlibadr(fd, sce->id.lib, seq->scene_camera);
+ if (seq->sound) {
seq->scene_sound = NULL;
- if(seq->type == SEQ_HD_SOUND)
+ if (seq->type == SEQ_HD_SOUND)
seq->type = SEQ_SOUND;
else
seq->sound= newlibadr(fd, sce->id.lib, seq->sound);
@@ -4827,8 +4861,8 @@ static void lib_link_scene(FileData *fd, Main *main)
SEQ_END
#ifdef DURIAN_CAMERA_SWITCH
- for(marker= sce->markers.first; marker; marker= marker->next) {
- if(marker->camera) {
+ for (marker= sce->markers.first; marker; marker= marker->next) {
+ if (marker->camera) {
marker->camera= newlibadr(fd, sce->id.lib, marker->camera);
}
}
@@ -4839,12 +4873,12 @@ static void lib_link_scene(FileData *fd, Main *main)
seq_update_muting(sce->ed);
seq_update_sound_bounds_all(sce);
- if(sce->nodetree) {
+ if (sce->nodetree) {
lib_link_ntree(fd, &sce->id, sce->nodetree);
composite_patch(sce->nodetree, sce);
}
- for(srl= sce->r.layers.first; srl; srl= srl->next) {
+ for (srl= sce->r.layers.first; srl; srl= srl->next) {
srl->mat_override= newlibadr_us(fd, sce->id.lib, srl->mat_override);
srl->light_override= newlibadr_us(fd, sce->id.lib, srl->light_override);
for(fls=srl->freestyleConfig.linesets.first; fls; fls= fls->next) {
@@ -4871,8 +4905,8 @@ static void link_recurs_seq(FileData *fd, ListBase *lb)
link_list(fd, lb);
- for(seq=lb->first; seq; seq=seq->next)
- if(seq->seqbase.first)
+ for (seq=lb->first; seq; seq=seq->next)
+ if (seq->seqbase.first)
link_recurs_seq(fd, &seq->seqbase);
}
@@ -4913,7 +4947,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->basact= newdataadr(fd, sce->basact);
sce->toolsettings= newdataadr(fd, sce->toolsettings);
- if(sce->toolsettings) {
+ if (sce->toolsettings) {
direct_link_paint(fd, (Paint**)&sce->toolsettings->sculpt);
direct_link_paint(fd, (Paint**)&sce->toolsettings->vpaint);
direct_link_paint(fd, (Paint**)&sce->toolsettings->wpaint);
@@ -4923,7 +4957,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->toolsettings->particle.paintcursor= NULL;
}
- if(sce->ed) {
+ if (sce->ed) {
ListBase *old_seqbasep= &((Editing *)sce->ed)->seqbase;
ed= sce->ed= newdataadr(fd, sce->ed);
@@ -4938,55 +4972,60 @@ static void direct_link_scene(FileData *fd, Scene *sce)
seq->seq2= newdataadr(fd, seq->seq2);
seq->seq3= newdataadr(fd, seq->seq3);
/* a patch: after introduction of effects with 3 input strips */
- if(seq->seq3==NULL) seq->seq3= seq->seq2;
+ if (seq->seq3==NULL) seq->seq3= seq->seq2;
seq->plugin= newdataadr(fd, seq->plugin);
seq->effectdata= newdataadr(fd, seq->effectdata);
- if(seq->type & SEQ_EFFECT)
+ if (seq->type & SEQ_EFFECT)
seq->flag |= SEQ_EFFECT_NOT_LOADED;
- if(seq->type == SEQ_SPEED) {
+ if (seq->type == SEQ_SPEED) {
SpeedControlVars *s= seq->effectdata;
s->frameMap= NULL;
}
seq->strip= newdataadr(fd, seq->strip);
- if(seq->strip && seq->strip->done==0) {
+ if (seq->strip && seq->strip->done==0) {
seq->strip->done= 1;
- if(seq->type == SEQ_IMAGE ||
+ if (seq->type == SEQ_IMAGE ||
seq->type == SEQ_MOVIE ||
seq->type == SEQ_RAM_SOUND ||
seq->type == SEQ_HD_SOUND) {
seq->strip->stripdata = newdataadr(
fd, seq->strip->stripdata);
- } else {
+ }
+ else {
seq->strip->stripdata = NULL;
}
if (seq->flag & SEQ_USE_CROP) {
seq->strip->crop = newdataadr(
fd, seq->strip->crop);
- } else {
+ }
+ else {
seq->strip->crop = NULL;
}
if (seq->flag & SEQ_USE_TRANSFORM) {
seq->strip->transform = newdataadr(
fd, seq->strip->transform);
- } else {
+ }
+ else {
seq->strip->transform = NULL;
}
if (seq->flag & SEQ_USE_PROXY) {
seq->strip->proxy = newdataadr(
fd, seq->strip->proxy);
seq->strip->proxy->anim = NULL;
- } else {
+ }
+ else {
seq->strip->proxy = NULL;
}
if (seq->flag & SEQ_USE_COLOR_BALANCE) {
seq->strip->color_balance = newdataadr(
fd, seq->strip->color_balance);
- } else {
+ }
+ else {
seq->strip->color_balance = NULL;
}
if (seq->strip->color_balance) {
@@ -5005,7 +5044,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
offset= ((intptr_t)&(temp.seqbase)) - ((intptr_t)&temp);
/* root pointer */
- if(ed->seqbasep == old_seqbasep) {
+ if (ed->seqbasep == old_seqbasep) {
ed->seqbasep= &ed->seqbase;
}
else {
@@ -5014,22 +5053,22 @@ static void direct_link_scene(FileData *fd, Scene *sce)
poin -= offset;
poin= newdataadr(fd, poin);
- if(poin) ed->seqbasep= (ListBase *)(poin+offset);
+ if (poin) ed->seqbasep= (ListBase *)(poin+offset);
else ed->seqbasep= &ed->seqbase;
}
/* stack */
link_list(fd, &(ed->metastack));
- for(ms= ed->metastack.first; ms; ms= ms->next) {
+ for (ms= ed->metastack.first; ms; ms= ms->next) {
ms->parseq= newdataadr(fd, ms->parseq);
- if(ms->oldbasep == old_seqbasep)
+ if (ms->oldbasep == old_seqbasep)
ms->oldbasep= &ed->seqbase;
else {
poin= (char *)ms->oldbasep;
poin -= offset;
poin= newdataadr(fd, poin);
- if(poin) ms->oldbasep= (ListBase *)(poin+offset);
+ if (poin) ms->oldbasep= (ListBase *)(poin+offset);
else ms->oldbasep= &ed->seqbase;
}
}
@@ -5068,7 +5107,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
}
sce->nodetree= newdataadr(fd, sce->nodetree);
- if(sce->nodetree)
+ if (sce->nodetree)
direct_link_nodetree(fd, sce->nodetree);
}
@@ -5081,7 +5120,7 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
wm->id.us= 1;
link_list(fd, &(wm->windows));
- for(win= wm->windows.first; win; win= win->next) {
+ for (win= wm->windows.first; win; win= win->next) {
win->ghostwin= NULL;
win->eventstate= NULL;
win->curswin= NULL;
@@ -5123,9 +5162,9 @@ static void lib_link_windowmanager(FileData *fd, Main *main)
wmWindowManager *wm;
wmWindow *win;
- for(wm= main->wm.first; wm; wm= wm->id.next) {
- if(wm->id.flag & LIB_NEEDLINK) {
- for(win= wm->windows.first; win; win= win->next)
+ for (wm= main->wm.first; wm; wm= wm->id.next) {
+ if (wm->id.flag & LIB_NEEDLINK) {
+ for (win= wm->windows.first; win; win= win->next)
win->screen= newlibadr(fd, NULL, win->screen);
wm->id.flag -= LIB_NEEDLINK;
@@ -5169,10 +5208,10 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
static void butspace_version_132(SpaceButs *buts)
{
- buts->v2d.tot.xmin= 0.0f;
- buts->v2d.tot.ymin= 0.0f;
- buts->v2d.tot.xmax= 1279.0f;
- buts->v2d.tot.ymax= 228.0f;
+ buts->v2d.tot.xmin = 0.0f;
+ buts->v2d.tot.ymin = 0.0f;
+ buts->v2d.tot.xmax = 1279.0f;
+ buts->v2d.tot.ymax = 228.0f;
buts->v2d.min[0]= 256.0f;
buts->v2d.min[1]= 42.0f;
@@ -5195,20 +5234,20 @@ static void lib_link_screen(FileData *fd, Main *main)
bScreen *sc;
ScrArea *sa;
- for(sc= main->screen.first; sc; sc= sc->id.next) {
- if(sc->id.flag & LIB_NEEDLINK) {
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ if (sc->id.flag & LIB_NEEDLINK) {
sc->id.us= 1;
sc->scene= newlibadr(fd, sc->id.lib, sc->scene);
sc->animtimer= NULL; /* saved in rare cases */
sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
SpaceLink *sl;
sa->full= newlibadr(fd, sc->id.lib, sa->full);
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D*) sl;
BGpic *bgpic = NULL;
@@ -5216,21 +5255,21 @@ static void lib_link_screen(FileData *fd, Main *main)
v3d->ob_centre= newlibadr(fd, sc->id.lib, v3d->ob_centre);
/* should be do_versions but not easy adding into the listbase */
- if(v3d->bgpic) {
+ if (v3d->bgpic) {
v3d->bgpic= newlibadr(fd, sc->id.lib, v3d->bgpic);
BLI_addtail(&v3d->bgpicbase, bgpic);
v3d->bgpic= NULL;
}
- for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
+ for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
bgpic->ima= newlibadr_us(fd, sc->id.lib, bgpic->ima);
bgpic->clip= newlibadr_us(fd, sc->id.lib, bgpic->clip);
}
- if(v3d->localvd) {
+ if (v3d->localvd) {
v3d->localvd->camera= newlibadr(fd, sc->id.lib, v3d->localvd->camera);
}
}
- else if(sl->spacetype==SPACE_IPO) {
+ else if (sl->spacetype==SPACE_IPO) {
SpaceIpo *sipo= (SpaceIpo *)sl;
bDopeSheet *ads= sipo->ads;
@@ -5239,15 +5278,15 @@ static void lib_link_screen(FileData *fd, Main *main)
ads->filter_grp= newlibadr(fd, sc->id.lib, ads->filter_grp);
}
}
- else if(sl->spacetype==SPACE_BUTS) {
+ else if (sl->spacetype==SPACE_BUTS) {
SpaceButs *sbuts= (SpaceButs *)sl;
sbuts->pinid= newlibadr(fd, sc->id.lib, sbuts->pinid);
sbuts->mainbo= sbuts->mainb;
sbuts->mainbuser= sbuts->mainb;
- if(main->versionfile<132)
+ if (main->versionfile<132)
butspace_version_132(sbuts);
}
- else if(sl->spacetype==SPACE_FILE) {
+ else if (sl->spacetype==SPACE_FILE) {
SpaceFile *sfile= (SpaceFile *)sl;
sfile->files= NULL;
sfile->op= NULL;
@@ -5255,7 +5294,7 @@ static void lib_link_screen(FileData *fd, Main *main)
sfile->folders_prev= NULL;
sfile->folders_next= NULL;
}
- else if(sl->spacetype==SPACE_ACTION) {
+ else if (sl->spacetype==SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)sl;
bDopeSheet *ads= &saction->ads;
@@ -5266,7 +5305,7 @@ static void lib_link_screen(FileData *fd, Main *main)
saction->action = newlibadr(fd, sc->id.lib, saction->action);
}
- else if(sl->spacetype==SPACE_IMAGE) {
+ else if (sl->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sl;
sima->image= newlibadr_us(fd, sc->id.lib, sima->image);
@@ -5276,7 +5315,7 @@ static void lib_link_screen(FileData *fd, Main *main)
*/
sima->gpd= newlibadr_us(fd, sc->id.lib, sima->gpd);
}
- else if(sl->spacetype==SPACE_NLA){
+ else if (sl->spacetype==SPACE_NLA) {
SpaceNla *snla= (SpaceNla *)sl;
bDopeSheet *ads= snla->ads;
@@ -5285,14 +5324,14 @@ static void lib_link_screen(FileData *fd, Main *main)
ads->filter_grp= newlibadr(fd, sc->id.lib, ads->filter_grp);
}
}
- else if(sl->spacetype==SPACE_TEXT) {
+ else if (sl->spacetype==SPACE_TEXT) {
SpaceText *st= (SpaceText *)sl;
st->text= newlibadr(fd, sc->id.lib, st->text);
st->drawcache= NULL;
}
- else if(sl->spacetype==SPACE_SCRIPT) {
+ else if (sl->spacetype==SPACE_SCRIPT) {
SpaceScript *scpt= (SpaceScript *)sl;
/*scpt->script = NULL; - 2.45 set to null, better re-run the script */
@@ -5303,7 +5342,7 @@ static void lib_link_screen(FileData *fd, Main *main)
}
}
}
- else if(sl->spacetype==SPACE_OUTLINER) {
+ else if (sl->spacetype==SPACE_OUTLINER) {
SpaceOops *so= (SpaceOops *)sl;
TreeStoreElem *tselem;
int a;
@@ -5311,14 +5350,14 @@ static void lib_link_screen(FileData *fd, Main *main)
so->tree.first= so->tree.last= NULL;
so->search_tse.id= newlibadr(fd, NULL, so->search_tse.id);
- if(so->treestore) {
+ if (so->treestore) {
tselem= so->treestore->data;
- for(a=0; a<so->treestore->usedelem; a++, tselem++) {
+ for (a=0; a<so->treestore->usedelem; a++, tselem++) {
tselem->id= newlibadr(fd, NULL, tselem->id);
}
}
}
- else if(sl->spacetype==SPACE_NODE) {
+ else if (sl->spacetype==SPACE_NODE) {
SpaceNode *snode= (SpaceNode *)sl;
snode->id= newlibadr(fd, sc->id.lib, snode->id);
@@ -5327,16 +5366,16 @@ static void lib_link_screen(FileData *fd, Main *main)
if (ELEM3(snode->treetype, NTREE_COMPOSIT, NTREE_SHADER, NTREE_TEXTURE)) {
/* internal data, a bit patchy */
snode->nodetree= NULL;
- if(snode->id) {
- if(GS(snode->id->name)==ID_MA)
+ if (snode->id) {
+ if (GS(snode->id->name)==ID_MA)
snode->nodetree= ((Material *)snode->id)->nodetree;
- else if(GS(snode->id->name)==ID_WO)
+ else if (GS(snode->id->name)==ID_WO)
snode->nodetree= ((World *)snode->id)->nodetree;
- else if(GS(snode->id->name)==ID_LA)
+ else if (GS(snode->id->name)==ID_LA)
snode->nodetree= ((Lamp *)snode->id)->nodetree;
- else if(GS(snode->id->name)==ID_SCE)
+ else if (GS(snode->id->name)==ID_SCE)
snode->nodetree= ((Scene *)snode->id)->nodetree;
- else if(GS(snode->id->name)==ID_TE)
+ else if (GS(snode->id->name)==ID_TE)
snode->nodetree= ((Tex *)snode->id)->nodetree;
}
}
@@ -5346,7 +5385,7 @@ static void lib_link_screen(FileData *fd, Main *main)
snode->linkdrag.first = snode->linkdrag.last = NULL;
}
- else if(sl->spacetype==SPACE_CLIP) {
+ else if (sl->spacetype==SPACE_CLIP) {
SpaceClip *sclip= (SpaceClip *)sl;
sclip->clip= newlibadr_us(fd, sc->id.lib, sclip->clip);
@@ -5366,17 +5405,17 @@ static void lib_link_screen(FileData *fd, Main *main)
static void *restore_pointer_by_name(Main *mainp, ID *id, int user)
{
- if(id) {
+ if (id) {
ListBase *lb= which_libbase(mainp, GS(id->name));
- if(lb) { // there's still risk of checking corrupt mem (freed Ids in oops)
+ if (lb) { // there's still risk of checking corrupt mem (freed Ids in oops)
ID *idn= lb->first;
char *name= id->name+2;
- while(idn) {
- if(idn->name[2]==name[0] && strcmp(idn->name+2, name)==0) {
- if(idn->lib==id->lib) {
- if(user && idn->us==0) idn->us++;
+ while (idn) {
+ if (idn->name[2]==name[0] && strcmp(idn->name+2, name)==0) {
+ if (idn->lib==id->lib) {
+ if (user && idn->us==0) idn->us++;
break;
}
}
@@ -5392,15 +5431,15 @@ static int lib_link_seq_clipboard_cb(Sequence *seq, void *arg_pt)
{
Main *newmain = (Main *)arg_pt;
- if(seq->sound) {
+ if (seq->sound) {
seq->sound = restore_pointer_by_name(newmain, (ID *)seq->sound, 0);
seq->sound->id.us++;
}
- if(seq->scene)
+ if (seq->scene)
seq->scene = restore_pointer_by_name(newmain, (ID *)seq->scene, 1);
- if(seq->scene_camera)
+ if (seq->scene_camera)
seq->scene_camera = restore_pointer_by_name(newmain, (ID *)seq->scene_camera, 1);
return 1;
@@ -5423,11 +5462,11 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
ScrArea *sa;
/* first windowmanager */
- for(wm= newmain->wm.first; wm; wm= wm->id.next) {
- for(win= wm->windows.first; win; win= win->next) {
+ for (wm= newmain->wm.first; wm; wm= wm->id.next) {
+ for (win= wm->windows.first; win; win= win->next) {
win->screen= restore_pointer_by_name(newmain, (ID *)win->screen, 1);
- if(win->screen==NULL)
+ if (win->screen==NULL)
win->screen= curscreen;
win->screen->winid= win->winid;
@@ -5435,49 +5474,49 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
}
- for(sc= newmain->screen.first; sc; sc= sc->id.next) {
+ for (sc= newmain->screen.first; sc; sc= sc->id.next) {
Scene *oldscene= sc->scene;
sc->scene= restore_pointer_by_name(newmain, (ID *)sc->scene, 1);
- if(sc->scene==NULL)
+ if (sc->scene==NULL)
sc->scene= curscene;
/* keep cursor location through undo */
copy_v3_v3(sc->scene->cursor, oldscene->cursor);
sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D*) sl;
BGpic *bgpic;
ARegion *ar;
- if(v3d->scenelock)
+ if (v3d->scenelock)
v3d->camera= NULL; /* always get from scene */
else
v3d->camera= restore_pointer_by_name(newmain, (ID *)v3d->camera, 1);
- if(v3d->camera==NULL)
+ if (v3d->camera==NULL)
v3d->camera= sc->scene->camera;
v3d->ob_centre= restore_pointer_by_name(newmain, (ID *)v3d->ob_centre, 1);
- for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
+ for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
bgpic->ima= restore_pointer_by_name(newmain, (ID *)bgpic->ima, 1);
bgpic->clip= restore_pointer_by_name(newmain, (ID *)bgpic->clip, 1);
}
- if(v3d->localvd) {
+ if (v3d->localvd) {
/*Base *base;*/
v3d->localvd->camera= sc->scene->camera;
/* localview can become invalid during undo/redo steps, so we exit it when no could be found */
/* XXX regionlocalview ?
- for(base= sc->scene->base.first; base; base= base->next) {
- if(base->lay & v3d->lay) break;
+ for (base= sc->scene->base.first; base; base= base->next) {
+ if (base->lay & v3d->lay) break;
}
- if(base==NULL) {
+ if (base==NULL) {
v3d->lay= v3d->localvd->lay;
v3d->layact= v3d->localvd->layact;
MEM_freeN(v3d->localvd);
@@ -5485,22 +5524,22 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
}
*/
}
- else if(v3d->scenelock) v3d->lay= sc->scene->lay;
+ else if (v3d->scenelock) v3d->lay= sc->scene->lay;
/* not very nice, but could help */
- if((v3d->layact & v3d->lay)==0) v3d->layact= v3d->lay;
+ if ((v3d->layact & v3d->lay)==0) v3d->layact= v3d->lay;
/* free render engines for now */
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
RegionView3D *rv3d= ar->regiondata;
- if(rv3d && rv3d->render_engine) {
+ if (rv3d && rv3d->render_engine) {
RE_engine_free(rv3d->render_engine);
rv3d->render_engine= NULL;
}
}
}
- else if(sl->spacetype==SPACE_IPO) {
+ else if (sl->spacetype==SPACE_IPO) {
SpaceIpo *sipo= (SpaceIpo *)sl;
bDopeSheet *ads= sipo->ads;
@@ -5511,17 +5550,17 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
ads->filter_grp= restore_pointer_by_name(newmain, (ID *)ads->filter_grp, 0);
}
}
- else if(sl->spacetype==SPACE_BUTS) {
+ else if (sl->spacetype==SPACE_BUTS) {
SpaceButs *sbuts= (SpaceButs *)sl;
sbuts->pinid = restore_pointer_by_name(newmain, sbuts->pinid, 0);
//XXX if (sbuts->ri) sbuts->ri->curtile = 0;
}
- else if(sl->spacetype==SPACE_FILE) {
+ else if (sl->spacetype==SPACE_FILE) {
SpaceFile *sfile= (SpaceFile *)sl;
sfile->op= NULL;
}
- else if(sl->spacetype==SPACE_ACTION) {
+ else if (sl->spacetype==SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)sl;
saction->action = restore_pointer_by_name(newmain, (ID *)saction->action, 1);
@@ -5530,7 +5569,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
if (saction->ads.filter_grp)
saction->ads.filter_grp= restore_pointer_by_name(newmain, (ID *)saction->ads.filter_grp, 0);
}
- else if(sl->spacetype==SPACE_IMAGE) {
+ else if (sl->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sl;
sima->image= restore_pointer_by_name(newmain, (ID *)sima->image, 1);
@@ -5546,7 +5585,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
*/
sima->gpd= restore_pointer_by_name(newmain, (ID *)sima->gpd, 1);
}
- else if(sl->spacetype==SPACE_NLA){
+ else if (sl->spacetype==SPACE_NLA) {
SpaceNla *snla= (SpaceNla *)sl;
bDopeSheet *ads= snla->ads;
@@ -5557,13 +5596,13 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
ads->filter_grp= restore_pointer_by_name(newmain, (ID *)ads->filter_grp, 0);
}
}
- else if(sl->spacetype==SPACE_TEXT) {
+ else if (sl->spacetype==SPACE_TEXT) {
SpaceText *st= (SpaceText *)sl;
st->text= restore_pointer_by_name(newmain, (ID *)st->text, 1);
- if(st->text==NULL) st->text= newmain->text.first;
+ if (st->text==NULL) st->text= newmain->text.first;
}
- else if(sl->spacetype==SPACE_SCRIPT) {
+ else if (sl->spacetype==SPACE_SCRIPT) {
SpaceScript *scpt= (SpaceScript *)sl;
scpt->script= restore_pointer_by_name(newmain, (ID *)scpt->script, 1);
@@ -5573,21 +5612,21 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
SCRIPT_SET_NULL(scpt->script)
}
}
- else if(sl->spacetype==SPACE_OUTLINER) {
+ else if (sl->spacetype==SPACE_OUTLINER) {
SpaceOops *so= (SpaceOops *)sl;
int a;
so->search_tse.id= restore_pointer_by_name(newmain, so->search_tse.id, 0);
- if(so->treestore) {
+ if (so->treestore) {
TreeStore *ts= so->treestore;
TreeStoreElem *tselem=ts->data;
- for(a=0; a<ts->usedelem; a++, tselem++) {
+ for (a=0; a<ts->usedelem; a++, tselem++) {
tselem->id= restore_pointer_by_name(newmain, tselem->id, 0);
}
}
}
- else if(sl->spacetype==SPACE_NODE) {
+ else if (sl->spacetype==SPACE_NODE) {
SpaceNode *snode= (SpaceNode *)sl;
snode->id= restore_pointer_by_name(newmain, snode->id, 1);
@@ -5595,12 +5634,12 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
if (ELEM3(snode->treetype, NTREE_COMPOSIT, NTREE_SHADER, NTREE_TEXTURE)) {
snode->nodetree= NULL;
- if(snode->id) {
- if(GS(snode->id->name)==ID_MA)
+ if (snode->id) {
+ if (GS(snode->id->name)==ID_MA)
snode->nodetree= ((Material *)snode->id)->nodetree;
- else if(GS(snode->id->name)==ID_SCE)
+ else if (GS(snode->id->name)==ID_SCE)
snode->nodetree= ((Scene *)snode->id)->nodetree;
- else if(GS(snode->id->name)==ID_TE)
+ else if (GS(snode->id->name)==ID_TE)
snode->nodetree= ((Tex *)snode->id)->nodetree;
}
}
@@ -5608,7 +5647,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
snode->nodetree= restore_pointer_by_name(newmain, &snode->nodetree->id, 1);
}
}
- else if(sl->spacetype==SPACE_CLIP) {
+ else if (sl->spacetype==SPACE_CLIP) {
SpaceClip *sclip= (SpaceClip *)sl;
sclip->clip= restore_pointer_by_name(newmain, (ID *)sclip->clip, 1);
@@ -5630,7 +5669,7 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
link_list(fd, &(ar->panels));
- for(pa= ar->panels.first; pa; pa=pa->next) {
+ for (pa= ar->panels.first; pa; pa=pa->next) {
pa->paneltab= newdataadr(fd, pa->paneltab);
pa->runtime_flag= 0;
pa->activedata= NULL;
@@ -5638,8 +5677,8 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
}
ar->regiondata= newdataadr(fd, ar->regiondata);
- if(ar->regiondata) {
- if(spacetype==SPACE_VIEW3D) {
+ if (ar->regiondata) {
+ if (spacetype==SPACE_VIEW3D) {
RegionView3D *rv3d= ar->regiondata;
rv3d->localvd= newdataadr(fd, rv3d->localvd);
@@ -5672,8 +5711,8 @@ static void view3d_split_250(View3D *v3d, ListBase *regions)
{
ARegion *ar;
- for(ar= regions->first; ar; ar= ar->next) {
- if(ar->regiontype==RGN_TYPE_WINDOW && ar->regiondata==NULL) {
+ for (ar= regions->first; ar; ar= ar->next) {
+ if (ar->regiontype==RGN_TYPE_WINDOW && ar->regiondata==NULL) {
RegionView3D *rv3d;
rv3d= ar->regiondata= MEM_callocN(sizeof(RegionView3D), "region v3d patch");
@@ -5686,7 +5725,7 @@ static void view3d_split_250(View3D *v3d, ListBase *regions)
}
/* this was not initialized correct always */
- if(v3d->twtype == 0)
+ if (v3d->twtype == 0)
v3d->twtype= V3D_MANIP_TRANSLATE;
}
@@ -5708,31 +5747,31 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
/* hacky patch... but people have been saving files with the verse-blender,
causing the handler to keep running for ever, with no means to disable it */
- for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
- if( sc->handler[a]==SCREEN_HANDLER_VERSE) {
+ for (a=0; a<SCREEN_MAXHANDLER; a+=2) {
+ if ( sc->handler[a]==SCREEN_HANDLER_VERSE) {
sc->handler[a]= 0;
break;
}
}
/* edges */
- for(se= sc->edgebase.first; se; se= se->next) {
+ for (se= sc->edgebase.first; se; se= se->next) {
se->v1= newdataadr(fd, se->v1);
se->v2= newdataadr(fd, se->v2);
- if( (intptr_t)se->v1 > (intptr_t)se->v2) {
+ if ( (intptr_t)se->v1 > (intptr_t)se->v2) {
sv= se->v1;
se->v1= se->v2;
se->v2= sv;
}
- if(se->v1==NULL) {
+ if (se->v1==NULL) {
printf("error reading screen... file corrupt\n");
se->v1= se->v2;
}
}
/* areas */
- for(sa= sc->areabase.first; sa; sa= sa->next) {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
ARegion *ar;
@@ -5742,24 +5781,24 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
sa->handlers.first= sa->handlers.last= NULL;
sa->type= NULL; /* spacetype callbacks */
- for(ar= sa->regionbase.first; ar; ar= ar->next)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
direct_link_region(fd, ar, sa->spacetype);
/* accident can happen when read/save new file with older version */
/* 2.50: we now always add spacedata for info */
- if(sa->spacedata.first==NULL) {
+ if (sa->spacedata.first==NULL) {
SpaceInfo *sinfo= MEM_callocN(sizeof(SpaceInfo), "spaceinfo");
sa->spacetype= sinfo->spacetype= SPACE_INFO;
BLI_addtail(&sa->spacedata, sinfo);
}
/* add local view3d too */
- else if(sa->spacetype==SPACE_VIEW3D)
+ else if (sa->spacetype==SPACE_VIEW3D)
view3d_split_250(sa->spacedata.first, &sa->regionbase);
for (sl= sa->spacedata.first; sl; sl= sl->next) {
link_list(fd, &(sl->regionbase));
- for(ar= sl->regionbase.first; ar; ar= ar->next)
+ for (ar= sl->regionbase.first; ar; ar= ar->next)
direct_link_region(fd, ar, sl->spacetype);
if (sl->spacetype==SPACE_VIEW3D) {
@@ -5771,16 +5810,16 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
link_list(fd, &(v3d->bgpicbase));
/* should be do_versions except this doesnt fit well there */
- if(v3d->bgpic) {
+ if (v3d->bgpic) {
bgpic= newdataadr(fd, v3d->bgpic);
BLI_addtail(&v3d->bgpicbase, bgpic);
v3d->bgpic= NULL;
}
- for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
+ for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
bgpic->iuser.ok= 1;
- if(v3d->gpd) {
+ if (v3d->gpd) {
v3d->gpd= newdataadr(fd, v3d->gpd);
direct_link_gpencil(fd, v3d->gpd);
}
@@ -5791,7 +5830,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
v3d->properties_storage= NULL;
/* render can be quite heavy, set to wire on load */
- if(v3d->drawtype == OB_RENDER)
+ if (v3d->drawtype == OB_RENDER)
v3d->drawtype = OB_WIRE;
view3d_split_250(v3d, &sl->regionbase);
@@ -5811,18 +5850,18 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
SpaceOops *soops= (SpaceOops*) sl;
soops->treestore= newdataadr(fd, soops->treestore);
- if(soops->treestore) {
+ if (soops->treestore) {
soops->treestore->data= newdataadr(fd, soops->treestore->data);
/* we only saved what was used */
soops->treestore->totelem= soops->treestore->usedelem;
soops->storeflag |= SO_TREESTORE_CLEANUP; // at first draw
}
}
- else if(sl->spacetype==SPACE_IMAGE) {
+ else if (sl->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sl;
sima->cumap= newdataadr(fd, sima->cumap);
- if(sima->cumap)
+ if (sima->cumap)
direct_link_curvemapping(fd, sima->cumap);
sima->iuser.scene= NULL;
@@ -5842,52 +5881,52 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
direct_link_gpencil(fd, sima->gpd);
#endif
}
- else if(sl->spacetype==SPACE_NODE) {
+ else if (sl->spacetype==SPACE_NODE) {
SpaceNode *snode= (SpaceNode *)sl;
- if(snode->gpd) {
+ if (snode->gpd) {
snode->gpd= newdataadr(fd, snode->gpd);
direct_link_gpencil(fd, snode->gpd);
}
}
- else if(sl->spacetype==SPACE_TIME) {
+ else if (sl->spacetype==SPACE_TIME) {
SpaceTime *stime= (SpaceTime *)sl;
stime->caches.first= stime->caches.last= NULL;
}
- else if(sl->spacetype==SPACE_LOGIC) {
+ else if (sl->spacetype==SPACE_LOGIC) {
SpaceLogic *slogic= (SpaceLogic *)sl;
- if(slogic->gpd) {
+ if (slogic->gpd) {
slogic->gpd= newdataadr(fd, slogic->gpd);
direct_link_gpencil(fd, slogic->gpd);
}
}
- else if(sl->spacetype==SPACE_SEQ) {
+ else if (sl->spacetype==SPACE_SEQ) {
SpaceSeq *sseq= (SpaceSeq *)sl;
- if(sseq->gpd) {
+ if (sseq->gpd) {
sseq->gpd= newdataadr(fd, sseq->gpd);
direct_link_gpencil(fd, sseq->gpd);
}
}
- else if(sl->spacetype==SPACE_BUTS) {
+ else if (sl->spacetype==SPACE_BUTS) {
SpaceButs *sbuts= (SpaceButs *)sl;
sbuts->path= NULL;
sbuts->texuser= NULL;
}
- else if(sl->spacetype==SPACE_CONSOLE) {
+ else if (sl->spacetype==SPACE_CONSOLE) {
SpaceConsole *sconsole= (SpaceConsole *)sl;
ConsoleLine *cl, *cl_next;
link_list(fd, &sconsole->scrollback);
link_list(fd, &sconsole->history);
- //for(cl= sconsole->scrollback.first; cl; cl= cl->next)
+ //for (cl= sconsole->scrollback.first; cl; cl= cl->next)
// cl->line= newdataadr(fd, cl->line);
/*comma expressions, (e.g. expr1, expr2, expr3) evalutate each expression,
from left to right. the right-most expression sets the result of the comma
expression as a whole*/
- for(cl= sconsole->history.first; cl; cl= cl_next) {
+ for (cl= sconsole->history.first; cl; cl= cl_next) {
cl_next= cl->next;
cl->line= newdataadr(fd, cl->line);
if (cl->line) {
@@ -5900,7 +5939,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
}
}
}
- else if(sl->spacetype==SPACE_FILE) {
+ else if (sl->spacetype==SPACE_FILE) {
SpaceFile *sfile= (SpaceFile *)sl;
/* this sort of info is probably irrelevant for reloading...
@@ -5930,9 +5969,9 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
{
Main *newmain;
- for(newmain= fd->mainlist.first; newmain; newmain= newmain->next) {
- if(newmain->curlib) {
- if(BLI_path_cmp(newmain->curlib->filepath, lib->filepath) == 0) {
+ for (newmain= fd->mainlist.first; newmain; newmain= newmain->next) {
+ if (newmain->curlib) {
+ if (BLI_path_cmp(newmain->curlib->filepath, lib->filepath) == 0) {
BKE_reportf_wrap(fd->reports, RPT_WARNING,
"Library '%s', '%s' had multiple instances, save and reload!",
lib->name, lib->filepath);
@@ -5966,7 +6005,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
static void lib_link_library(FileData *UNUSED(fd), Main *main)
{
Library *lib;
- for(lib= main->library.first; lib; lib= lib->id.next) {
+ for (lib= main->library.first; lib; lib= lib->id.next) {
lib->id.us= 1;
}
}
@@ -5977,7 +6016,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
Library *lib;
/* BLO_read_from_memory uses a blank filename */
if (basepath==NULL || basepath[0] == '\0') {
- for(lib= main->library.first; lib; lib= lib->id.next) {
+ for (lib= main->library.first; lib; lib= lib->id.next) {
/* when loading a linked lib into a file which has not been saved,
* there is nothing we can be relative to, so instead we need to make
* it absolute. This can happen when appending an object with a relative
@@ -5989,7 +6028,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
}
}
else {
- for(lib= main->library.first; lib; lib= lib->id.next) {
+ for (lib= main->library.first; lib; lib= lib->id.next) {
/* Libraries store both relative and abs paths, recreate relative paths,
* relative to the blend file since indirectly linked libs will be relative to their direct linked library */
if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */
@@ -6007,8 +6046,8 @@ static void lib_link_speaker(FileData *fd, Main *main)
Speaker *spk;
spk= main->speaker.first;
- while(spk) {
- if(spk->id.flag & LIB_NEEDLINK) {
+ while (spk) {
+ if (spk->id.flag & LIB_NEEDLINK) {
if (spk->adt) lib_link_animdata(fd, &spk->id, spk->adt);
spk->sound= newlibadr(fd, spk->id.lib, spk->sound);
@@ -6040,7 +6079,7 @@ static void direct_link_sound(FileData *fd, bSound *sound)
sound->waveform = NULL;
// versioning stuff, if there was a cache, then we enable caching:
- if(sound->cache)
+ if (sound->cache)
{
sound->flags |= SOUND_FLAGS_CACHING;
sound->cache = NULL;
@@ -6055,8 +6094,8 @@ static void lib_link_sound(FileData *fd, Main *main)
bSound *sound;
sound= main->sound.first;
- while(sound) {
- if(sound->id.flag & LIB_NEEDLINK) {
+ while (sound) {
+ if (sound->id.flag & LIB_NEEDLINK) {
sound->id.flag -= LIB_NEEDLINK;
sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system
@@ -6078,25 +6117,25 @@ static void lib_link_group(FileData *fd, Main *main)
GroupObject *go;
int add_us;
- while(group) {
- if(group->id.flag & LIB_NEEDLINK) {
+ while (group) {
+ if (group->id.flag & LIB_NEEDLINK) {
group->id.flag -= LIB_NEEDLINK;
add_us= 0;
go= group->gobject.first;
- while(go) {
+ while (go) {
go->ob= newlibadr(fd, group->id.lib, go->ob);
- if(go->ob) {
+ if (go->ob) {
go->ob->flag |= OB_FROMGROUP;
/* if group has an object, it increments user... */
add_us= 1;
- if(go->ob->id.us==0)
+ if (go->ob->id.us==0)
go->ob->id.us= 1;
}
go= go->next;
}
- if(add_us) group->id.us++;
+ if (add_us) group->id.us++;
rem_from_group(group, NULL, NULL, NULL); /* removes NULL entries */
}
group= group->id.next;
@@ -6117,7 +6156,7 @@ static void direct_link_movieTracks(FileData *fd, ListBase *tracksbase)
link_list(fd, tracksbase);
track= tracksbase->first;
- while(track) {
+ while (track) {
track->markers= newdataadr(fd, track->markers);
track= track->next;
@@ -6131,10 +6170,10 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
clip->adt= newdataadr(fd, clip->adt);
- if(fd->movieclipmap) clip->cache= newmclipadr(fd, clip->cache);
+ if (fd->movieclipmap) clip->cache= newmclipadr(fd, clip->cache);
else clip->cache= NULL;
- if(fd->movieclipmap) clip->tracking.camera.intrinsics= newmclipadr(fd, clip->tracking.camera.intrinsics);
+ if (fd->movieclipmap) clip->tracking.camera.intrinsics= newmclipadr(fd, clip->tracking.camera.intrinsics);
else clip->tracking.camera.intrinsics= NULL;
direct_link_movieTracks(fd, &tracking->tracks);
@@ -6153,7 +6192,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
link_list(fd, &tracking->objects);
object= tracking->objects.first;
- while(object) {
+ while (object) {
direct_link_movieTracks(fd, &object->tracks);
direct_link_movieReconstruction(fd, &object->reconstruction);
@@ -6166,8 +6205,8 @@ static void lib_link_movieclip(FileData *fd, Main *main)
MovieClip *clip;
clip= main->movieclip.first;
- while(clip) {
- if(clip->id.flag & LIB_NEEDLINK) {
+ while (clip) {
+ if (clip->id.flag & LIB_NEEDLINK) {
if (clip->adt)
lib_link_animdata(fd, &clip->id, clip->adt);
@@ -6395,7 +6434,7 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, const char *a
{
bhead = blo_nextbhead(fd, bhead);
- while(bhead && bhead->code==DATA) {
+ while (bhead && bhead->code==DATA) {
void *data;
#if 0
/* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */
@@ -6438,7 +6477,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code); /* for ID_ID check */
/* do after read_struct, for dna reconstruct */
- if(bhead->code==ID_ID) {
+ if (bhead->code==ID_ID) {
lb= which_libbase(main, GS(id->name));
}
else {
@@ -6450,13 +6489,13 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
/* clear first 8 bits */
id->flag= (id->flag & 0xFF00) | flag | LIB_NEEDLINK;
id->lib= main->curlib;
- if(id->flag & LIB_FAKEUSER) id->us= 1;
+ if (id->flag & LIB_FAKEUSER) id->us= 1;
else id->us= 0;
id->icon_id = 0;
id->flag &= ~(LIB_ID_RECALC|LIB_ID_RECALC_DATA);
/* this case cannot be direct_linked: it's just the ID part */
- if(bhead->code==ID_ID) {
+ if (bhead->code==ID_ID) {
return blo_nextbhead(fd, bhead);
}
@@ -6595,7 +6634,7 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
bfd->globalf= fg->globalf;
BLI_strncpy(bfd->filename, fg->filename, sizeof(bfd->filename));
- if(G.fileflags & G_FILE_RECOVER)
+ if (G.fileflags & G_FILE_RECOVER)
BLI_strncpy(fd->relabase, fg->filename, sizeof(fd->relabase));
bfd->curscreen= fg->curscreen;
@@ -6616,8 +6655,8 @@ static void link_global(FileData *fd, BlendFileData *bfd)
bfd->curscreen= newlibadr(fd, NULL, bfd->curscreen);
bfd->curscene= newlibadr(fd, NULL, bfd->curscene);
// this happens in files older than 2.35
- if(bfd->curscene==NULL) {
- if(bfd->curscreen) bfd->curscene= bfd->curscreen->scene;
+ if (bfd->curscene==NULL) {
+ if (bfd->curscreen) bfd->curscene= bfd->curscreen->scene;
}
}
@@ -6627,12 +6666,12 @@ static void vcol_to_fcol(Mesh *me)
unsigned int *mcol, *mcoln, *mcolmain;
int a;
- if(me->totface==0 || me->mcol==NULL) return;
+ if (me->totface==0 || me->mcol==NULL) return;
mcoln= mcolmain= MEM_mallocN(4*sizeof(int)*me->totface, "mcoln");
mcol = (unsigned int *)me->mcol;
mface= me->mface;
- for(a=me->totface; a>0; a--, mface++) {
+ for (a=me->totface; a>0; a--, mface++) {
mcoln[0]= mcol[mface->v1];
mcoln[1]= mcol[mface->v2];
mcoln[2]= mcol[mface->v3];
@@ -6676,7 +6715,7 @@ static void do_version_bone_head_tail_237(Bone *bone)
mul_v3_fl(vec, bone->length);
add_v3_v3v3(bone->arm_tail, bone->arm_head, vec);
- for(child= bone->childbase.first; child; child= child->next)
+ for (child= bone->childbase.first; child; child= child->next)
do_version_bone_head_tail_237(child);
}
@@ -6684,13 +6723,13 @@ static void bone_version_238(ListBase *lb)
{
Bone *bone;
- for(bone= lb->first; bone; bone= bone->next) {
- if(bone->rad_tail==0.0f && bone->rad_head==0.0f) {
+ for (bone= lb->first; bone; bone= bone->next) {
+ if (bone->rad_tail==0.0f && bone->rad_head==0.0f) {
bone->rad_head= 0.25f*bone->length;
bone->rad_tail= 0.1f*bone->length;
bone->dist-= bone->rad_head;
- if(bone->dist<=0.0f) bone->dist= 0.0f;
+ if (bone->dist<=0.0f) bone->dist= 0.0f;
}
bone_version_238(&bone->childbase);
}
@@ -6700,8 +6739,8 @@ static void bone_version_239(ListBase *lb)
{
Bone *bone;
- for(bone= lb->first; bone; bone= bone->next) {
- if(bone->layer==0)
+ for (bone= lb->first; bone; bone= bone->next) {
+ if (bone->layer==0)
bone->layer= 1;
bone_version_239(&bone->childbase);
}
@@ -6711,10 +6750,10 @@ static void ntree_version_241(bNodeTree *ntree)
{
bNode *node;
- if(ntree->type==NTREE_COMPOSIT) {
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_BLUR) {
- if(node->storage==NULL) {
+ if (ntree->type==NTREE_COMPOSIT) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type==CMP_NODE_BLUR) {
+ if (node->storage==NULL) {
NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur patch");
nbd->sizex= node->custom1;
nbd->sizey= node->custom2;
@@ -6722,8 +6761,8 @@ static void ntree_version_241(bNodeTree *ntree)
node->storage= nbd;
}
}
- else if(node->type==CMP_NODE_VECBLUR) {
- if(node->storage==NULL) {
+ else if (node->type==CMP_NODE_VECBLUR) {
+ if (node->storage==NULL) {
NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur patch");
nbd->samples= node->custom1;
nbd->maxspeed= node->custom2;
@@ -6739,19 +6778,19 @@ static void ntree_version_242(bNodeTree *ntree)
{
bNode *node;
- if(ntree->type==NTREE_COMPOSIT) {
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_HUE_SAT) {
- if(node->storage) {
+ if (ntree->type==NTREE_COMPOSIT) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type==CMP_NODE_HUE_SAT) {
+ if (node->storage) {
NodeHueSat *nhs= node->storage;
- if(nhs->val==0.0f) nhs->val= 1.0f;
+ if (nhs->val==0.0f) nhs->val= 1.0f;
}
}
}
}
- else if(ntree->type==NTREE_SHADER) {
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->type == SH_NODE_GEOMETRY && node->storage == NULL)
+ else if (ntree->type==NTREE_SHADER) {
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->type == SH_NODE_GEOMETRY && node->storage == NULL)
node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry");
}
@@ -6765,11 +6804,11 @@ static void sort_shape_fix(Main *main)
KeyBlock *kb;
int sorted= 0;
- while(sorted==0) {
+ while (sorted==0) {
sorted= 1;
- for(key= main->key.first; key; key= key->id.next) {
- for(kb= key->block.first; kb; kb= kb->next) {
- if(kb->next && kb->adrcode>kb->next->adrcode) {
+ for (key= main->key.first; key; key= key->id.next) {
+ for (kb= key->block.first; kb; kb= kb->next) {
+ if (kb->next && kb->adrcode>kb->next->adrcode) {
KeyBlock *next= kb->next;
BLI_remlink(&key->block, kb);
BLI_insertlink(&key->block, next, kb);
@@ -6778,7 +6817,7 @@ static void sort_shape_fix(Main *main)
}
}
}
- if(sorted==0) printf("warning, shape keys were sorted incorrect, fixed it!\n");
+ if (sorted==0) printf("warning, shape keys were sorted incorrect, fixed it!\n");
}
}
@@ -6880,11 +6919,11 @@ static void do_version_ntree_242_2(bNodeTree *ntree)
{
bNode *node;
- if(ntree->type==NTREE_COMPOSIT) {
- for(node= ntree->nodes.first; node; node= node->next) {
- if(ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+ if (ntree->type==NTREE_COMPOSIT) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
/* only image had storage */
- if(node->storage) {
+ if (node->storage) {
NodeImageAnim *nia= node->storage;
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "ima user node");
@@ -6917,27 +6956,27 @@ static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
Image *image;
ImageUser *iuser;
- if(ntree->type==NTREE_COMPOSIT) {
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type == CMP_NODE_ALPHAOVER) {
- if(!node->storage) {
+ if (ntree->type==NTREE_COMPOSIT) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type == CMP_NODE_ALPHAOVER) {
+ if (!node->storage) {
ntf= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
node->storage= ntf;
- if(node->custom1)
+ if (node->custom1)
ntf->x= 1.0f;
}
}
/* fix for temporary flag changes during 245 cycle */
nodeid= newlibadr(fd, lib, node->id);
- if(node->storage && nodeid && GS(nodeid->name) == ID_IM) {
+ if (node->storage && nodeid && GS(nodeid->name) == ID_IM) {
image= (Image*)nodeid;
iuser= node->storage;
- if(iuser->flag & IMA_OLD_PREMUL) {
+ if (iuser->flag & IMA_OLD_PREMUL) {
iuser->flag &= ~IMA_OLD_PREMUL;
iuser->flag |= IMA_DO_PREMUL;
}
- if(iuser->flag & IMA_DO_PREMUL) {
+ if (iuser->flag & IMA_DO_PREMUL) {
image->flag &= ~IMA_OLD_PREMUL;
image->flag |= IMA_DO_PREMUL;
}
@@ -6980,27 +7019,27 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me)
int a, b, texalpha;
/* verify we have a tface layer */
- for(b=0; b<me->fdata.totlayer; b++)
- if(me->fdata.layers[b].type == CD_MTFACE)
+ for (b=0; b<me->fdata.totlayer; b++)
+ if (me->fdata.layers[b].type == CD_MTFACE)
break;
- if(b == me->fdata.totlayer)
+ if (b == me->fdata.totlayer)
return;
/* if we do, set alpha sort if the game engine did it before */
- for(a=0, mf=me->mface; a<me->totface; a++, mf++) {
- if(mf->mat_nr < me->totcol) {
+ for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
+ if (mf->mat_nr < me->totcol) {
ma= newlibadr(fd, lib, me->mat[mf->mat_nr]);
texalpha = 0;
/* we can't read from this if it comes from a library,
* because direct_link might not have happened on it,
* so ma->mtex is not pointing to valid memory yet */
- if(ma && ma->id.lib)
+ if (ma && ma->id.lib)
ma= NULL;
- for(b=0; ma && b<MAX_MTEX; b++)
- if(ma->mtex && ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA)
+ for (b=0; ma && b<MAX_MTEX; b++)
+ if (ma->mtex && ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA)
texalpha = 1;
}
else {
@@ -7008,13 +7047,13 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me)
texalpha = 0;
}
- for(b=0; b<me->fdata.totlayer; b++) {
- if(me->fdata.layers[b].type == CD_MTFACE) {
+ for (b=0; b<me->fdata.totlayer; b++) {
+ if (me->fdata.layers[b].type == CD_MTFACE) {
tf = ((MTFace*)me->fdata.layers[b].data) + a;
tf->mode &= ~TF_ALPHASORT;
- if(ma && (ma->mode & MA_ZTRANSP))
- if(ELEM(tf->transp, TF_ALPHA, TF_ADD) || (texalpha && (tf->transp != TF_CLIP)))
+ if (ma && (ma->mode & MA_ZTRANSP))
+ if (ELEM(tf->transp, TF_ALPHA, TF_ADD) || (texalpha && (tf->transp != TF_CLIP)))
tf->mode |= TF_ALPHASORT;
}
}
@@ -7028,7 +7067,7 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb)
BLI_addtail(lb, ar);
ar->regiontype= RGN_TYPE_HEADER;
- if(sa->headertype==HEADERDOWN)
+ if (sa->headertype==HEADERDOWN)
ar->alignment= RGN_ALIGN_BOTTOM;
else
ar->alignment= RGN_ALIGN_TOP;
@@ -7052,10 +7091,10 @@ static void sequencer_init_preview_region(ARegion* ar)
ar->v2d.keepzoom= V2D_KEEPASPECT | V2D_KEEPZOOM;
ar->v2d.minzoom= 0.00001f;
ar->v2d.maxzoom= 100000.0f;
- ar->v2d.tot.xmin= -960.0f; /* 1920 width centered */
- ar->v2d.tot.ymin= -540.0f; /* 1080 height centered */
- ar->v2d.tot.xmax= 960.0f;
- ar->v2d.tot.ymax= 540.0f;
+ ar->v2d.tot.xmin = -960.0f; /* 1920 width centered */
+ ar->v2d.tot.ymin = -540.0f; /* 1080 height centered */
+ ar->v2d.tot.xmax = 960.0f;
+ ar->v2d.tot.ymax = 540.0f;
ar->v2d.min[0]= 0.0f;
ar->v2d.min[1]= 0.0f;
ar->v2d.max[0]= 12000.0f;
@@ -7071,7 +7110,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ARegion *ar;
ARegion *ar_main;
- if(sl) {
+ if (sl) {
/* first channels for ipo action nla... */
switch(sl->spacetype) {
case SPACE_IPO:
@@ -7192,7 +7231,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->regiontype= RGN_TYPE_WINDOW;
- if(sl) {
+ if (sl) {
/* if active spacetype has view2d data, copy that over to main region */
/* and we split view3d */
switch(sl->spacetype) {
@@ -7224,7 +7263,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.align |= V2D_ALIGN_NO_NEG_Y;
ar->v2d.keepofs |= V2D_LOCKOFS_Y;
ar->v2d.keepzoom |= V2D_LOCKZOOM_Y;
- ar->v2d.tot.ymin= ar->v2d.cur.ymin= -10.0;
+ ar->v2d.tot.ymin = ar->v2d.cur.ymin = -10.0;
ar->v2d.min[1]= ar->v2d.max[1]= 20.0;
}
break;
@@ -7251,8 +7290,8 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
SpaceNla *snla= (SpaceNla *)sl;
memcpy(&ar->v2d, &snla->v2d, sizeof(View2D));
- ar->v2d.tot.ymin= (float)(-sa->winy)/3.0f;
- ar->v2d.tot.ymax= 0.0f;
+ ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
+ ar->v2d.tot.ymax = 0.0f;
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
@@ -7265,10 +7304,10 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
SpaceAction *saction= (SpaceAction *)sl;
/* we totally reinit the view for the Action Editor, as some old instances had some weird cruft set */
- ar->v2d.tot.xmin= -20.0f;
- ar->v2d.tot.ymin= (float)(-sa->winy)/3.0f;
- ar->v2d.tot.xmax= (float)((sa->winx > 120)? (sa->winx) : 120);
- ar->v2d.tot.ymax= 0.0f;
+ ar->v2d.tot.xmin = -20.0f;
+ ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
+ ar->v2d.tot.xmax = (float)((sa->winx > 120)? (sa->winx) : 120);
+ ar->v2d.tot.ymax = 0.0f;
ar->v2d.cur= ar->v2d.tot;
@@ -7353,23 +7392,23 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
SpaceLink *sl;
/* add regions */
- for(sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
/* we keep headertype variable to convert old files only */
- if(sa->headertype)
+ if (sa->headertype)
area_add_header_region(sa, &sa->regionbase);
area_add_window_regions(sa, sa->spacedata.first, &sa->regionbase);
/* space imageselect is deprecated */
- for(sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_IMASEL)
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_IMASEL)
sl->spacetype= SPACE_EMPTY; /* spacedata then matches */
}
/* space sound is deprecated */
- for(sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_SOUND)
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_SOUND)
sl->spacetype= SPACE_EMPTY; /* spacedata then matches */
}
@@ -7377,10 +7416,10 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
sa->butspacetype= sa->spacetype;
/* pushed back spaces also need regions! */
- if(sa->spacedata.first) {
+ if (sa->spacedata.first) {
sl= sa->spacedata.first;
- for(sl= sl->next; sl; sl= sl->next) {
- if(sa->headertype)
+ for (sl= sl->next; sl; sl= sl->next) {
+ if (sa->headertype)
area_add_header_region(sa, &sl->regionbase);
area_add_window_regions(sa, sl, &sl->regionbase);
}
@@ -7399,7 +7438,7 @@ static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name)
new_id(lb, id, name);
/* alphabetic insterion: is in new_id */
- if(G.f & G_DEBUG)
+ if (G.f & G_DEBUG)
printf("Converted GPencil to ID: %s\n", id->name+2);
}
@@ -7409,25 +7448,25 @@ static void do_versions_gpencil_2_50(Main *main, bScreen *screen)
SpaceLink *sl;
/* add regions */
- for(sa= screen->areabase.first; sa; sa= sa->next) {
- for(sl= sa->spacedata.first; sl; sl= sl->next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D*) sl;
- if(v3d->gpd) {
+ if (v3d->gpd) {
versions_gpencil_add_main(&main->gpencil, (ID *)v3d->gpd, "GPencil View3D");
v3d->gpd= NULL;
}
}
else if (sl->spacetype==SPACE_NODE) {
SpaceNode *snode= (SpaceNode *)sl;
- if(snode->gpd) {
+ if (snode->gpd) {
versions_gpencil_add_main(&main->gpencil, (ID *)snode->gpd, "GPencil Node");
snode->gpd= NULL;
}
}
else if (sl->spacetype==SPACE_SEQ) {
SpaceSeq *sseq= (SpaceSeq *)sl;
- if(sseq->gpd) {
+ if (sseq->gpd) {
versions_gpencil_add_main(&main->gpencil, (ID *)sseq->gpd, "GPencil Node");
sseq->gpd= NULL;
}
@@ -7435,7 +7474,7 @@ static void do_versions_gpencil_2_50(Main *main, bScreen *screen)
else if (sl->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sl;
#if 0 /* see comment on r28002 */
- if(sima->gpd) {
+ if (sima->gpd) {
versions_gpencil_add_main(&main->gpencil, (ID *)sima->gpd, "GPencil Image");
sima->gpd= NULL;
}
@@ -7453,8 +7492,8 @@ static PartEff *do_version_give_parteff_245(Object *ob)
PartEff *paf;
paf= ob->effect.first;
- while(paf) {
- if(paf->type==EFF_PARTICLE) return paf;
+ while (paf) {
+ if (paf->type==EFF_PARTICLE) return paf;
paf= paf->next;
}
return NULL;
@@ -7463,9 +7502,9 @@ static void do_version_free_effect_245(Effect *eff)
{
PartEff *paf;
- if(eff->type==EFF_PARTICLE) {
+ if (eff->type==EFF_PARTICLE) {
paf= (PartEff *)eff;
- if(paf->keys) MEM_freeN(paf->keys);
+ if (paf->keys) MEM_freeN(paf->keys);
}
MEM_freeN(eff);
}
@@ -7474,7 +7513,7 @@ static void do_version_free_effects_245(ListBase *lb)
Effect *eff;
eff= lb->first;
- while(eff) {
+ while (eff) {
BLI_remlink(lb, eff);
do_version_free_effect_245(eff);
eff= lb->first;
@@ -7487,20 +7526,20 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype)
float varfac, colfac;
int a, neg;
- if(!mtex_array)
+ if (!mtex_array)
return;
- for(a=0; a<MAX_MTEX; a++) {
- if(mtex_array[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (mtex_array[a]) {
mtex= mtex_array[a];
neg= mtex->maptoneg;
varfac= mtex->varfac;
colfac= mtex->colfac;
- if(neg & MAP_DISP) mtex->dispfac= -mtex->dispfac;
- if(neg & MAP_NORM) mtex->norfac= -mtex->norfac;
- if(neg & MAP_WARP) mtex->warpfac= -mtex->warpfac;
+ if (neg & MAP_DISP) mtex->dispfac= -mtex->dispfac;
+ if (neg & MAP_NORM) mtex->norfac= -mtex->norfac;
+ if (neg & MAP_WARP) mtex->warpfac= -mtex->warpfac;
mtex->colspecfac= (neg & MAP_COLSPEC)? -colfac: colfac;
mtex->mirrfac= (neg & MAP_COLMIR)? -colfac: colfac;
@@ -7535,11 +7574,11 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype)
mtex->zendownfac= (neg & WOMAP_ZENDOWN)? -colfac: colfac;
mtex->blendfac= (neg & WOMAP_BLEND)? -varfac: varfac;
- if(idtype == ID_MA)
+ if (idtype == ID_MA)
mtex->colfac= (neg & MAP_COL)? -colfac: colfac;
- else if(idtype == ID_LA)
+ else if (idtype == ID_LA)
mtex->colfac= (neg & LAMAP_COL)? -colfac: colfac;
- else if(idtype == ID_WO)
+ else if (idtype == ID_WO)
mtex->colfac= (neg & WOMAP_HORIZ)? -colfac: colfac;
}
}
@@ -7551,12 +7590,12 @@ static void do_version_mdef_250(Main *main)
ModifierData *md;
MeshDeformModifierData *mmd;
- for(ob= main->object.first; ob; ob=ob->id.next) {
- for(md=ob->modifiers.first; md; md=md->next) {
- if(md->type == eModifierType_MeshDeform) {
+ for (ob= main->object.first; ob; ob=ob->id.next) {
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type == eModifierType_MeshDeform) {
mmd= (MeshDeformModifierData*)md;
- if(mmd->bindcos) {
+ if (mmd->bindcos) {
/* make bindcos NULL in order to trick older versions
into thinking that the mesh was not bound yet */
mmd->bindcagecos= mmd->bindcos;
@@ -7574,17 +7613,17 @@ static void do_version_constraints_radians_degrees_250(ListBase *lb)
bConstraint *con;
for (con=lb->first; con; con=con->next) {
- if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) {
+ if (con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) {
bRigidBodyJointConstraint *data = con->data;
data->axX *= (float)(M_PI/180.0);
data->axY *= (float)(M_PI/180.0);
data->axZ *= (float)(M_PI/180.0);
}
- else if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ else if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data = con->data;
data->poleangle *= (float)(M_PI/180.0);
}
- else if(con->type==CONSTRAINT_TYPE_ROTLIMIT) {
+ else if (con->type==CONSTRAINT_TYPE_ROTLIMIT) {
bRotLimitConstraint *data = con->data;
data->xmin *= (float)(M_PI/180.0);
@@ -7621,7 +7660,7 @@ static void do_versions_seq_unique_name_all_strips(
{
Sequence * seq = seqbasep->first;
- while(seq) {
+ while (seq) {
seqbase_unique_name_recursive(&sce->ed->seqbase, seq);
if (seq->seqbase.first) {
do_versions_seq_unique_name_all_strips(
@@ -7640,7 +7679,7 @@ static void do_version_bone_roll_256(Bone *bone)
copy_m3_m4(submat, bone->arm_mat);
mat3_to_vec_roll(submat, NULL, &bone->arm_roll);
- for(child = bone->childbase.first; child; child = child->next)
+ for (child = bone->childbase.first; child; child = child->next)
do_version_bone_roll_256(child);
}
@@ -7665,7 +7704,7 @@ void convert_tface_mt(FileData *fd, Main *main)
gmain = G.main;
G.main = main;
- if(!(do_version_tface(main, 1))) {
+ if (!(do_version_tface(main, 1))) {
BKE_report(fd->reports, RPT_WARNING, "Texface conversion problem. Error in console");
}
@@ -7691,8 +7730,8 @@ static void do_version_ntree_tex_mapping_260(void *UNUSED(data), ID *UNUSED(id),
{
bNode *node;
- for(node=ntree->nodes.first; node; node=node->next) {
- if(node->type == SH_NODE_MAPPING) {
+ for (node=ntree->nodes.first; node; node=node->next) {
+ if (node->type == SH_NODE_MAPPING) {
TexMapping *tex_mapping;
tex_mapping= node->storage;
@@ -7847,15 +7886,15 @@ static void do_versions_nodetree_socket_auto_hidden_flags_2_62(bNodeTree *ntree)
if (sock->link==NULL)
sock->flag |= SOCK_AUTO_HIDDEN;
}
- for(sock=node->outputs.first; sock; sock= sock->next) {
- if(nodeCountSocketLinks(ntree, sock)==0)
+ for (sock=node->outputs.first; sock; sock= sock->next) {
+ if (nodeCountSocketLinks(ntree, sock)==0)
sock->flag |= SOCK_AUTO_HIDDEN;
}
}
else {
- for(sock=node->inputs.first; sock; sock= sock->next)
+ for (sock=node->inputs.first; sock; sock= sock->next)
sock->flag &= ~SOCK_AUTO_HIDDEN;
- for(sock=node->outputs.first; sock; sock= sock->next)
+ for (sock=node->outputs.first; sock; sock= sock->next)
sock->flag &= ~SOCK_AUTO_HIDDEN;
}
}
@@ -7932,21 +7971,41 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo
}
}
+/* blue and red are swapped pre 2.62.1, be sane (red == red) now! */
+static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *me)
+{
+ CustomDataLayer *layer;
+ MLoopCol *mloopcol;
+ int a;
+ int i;
+
+ for (a = 0; a < me->ldata.totlayer; a++) {
+ layer = &me->ldata.layers[a];
+
+ if (layer->type == CD_MLOOPCOL) {
+ mloopcol = (MLoopCol *)layer->data;
+ for (i = 0; i < me->totloop; i++, mloopcol++) {
+ SWAP(char, mloopcol->r, mloopcol->b);
+ }
+ }
+ }
+}
+
static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
- if(G.f & G_DEBUG)
+ if (G.f & G_DEBUG)
printf("read file %s\n Version %d sub %d svn r%d\n", fd->relabase, main->versionfile, main->subversionfile, main->revision);
- if(main->versionfile == 100) {
+ if (main->versionfile == 100) {
/* tex->extend and tex->imageflag have changed: */
Tex *tex = main->tex.first;
- while(tex) {
- if(tex->id.flag & LIB_NEEDLINK) {
+ while (tex) {
+ if (tex->id.flag & LIB_NEEDLINK) {
- if(tex->extend==0) {
- if(tex->xrepeat || tex->yrepeat) tex->extend= TEX_REPEAT;
+ if (tex->extend==0) {
+ if (tex->xrepeat || tex->yrepeat) tex->extend= TEX_REPEAT;
else {
tex->extend= TEX_EXTEND;
tex->xrepeat= tex->yrepeat= 1;
@@ -7957,87 +8016,87 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
tex= tex->id.next;
}
}
- if(main->versionfile <= 101) {
+ if (main->versionfile <= 101) {
/* frame mapping */
Scene *sce = main->scene.first;
- while(sce) {
+ while (sce) {
sce->r.framapto= 100;
sce->r.images= 100;
sce->r.framelen= 1.0;
sce= sce->id.next;
}
}
- if(main->versionfile <= 102) {
+ if (main->versionfile <= 102) {
/* init halo's at 1.0 */
Material *ma = main->mat.first;
- while(ma) {
+ while (ma) {
ma->add= 1.0;
ma= ma->id.next;
}
}
- if(main->versionfile <= 103) {
+ if (main->versionfile <= 103) {
/* new variable in object: colbits */
Object *ob = main->object.first;
int a;
- while(ob) {
+ while (ob) {
ob->colbits= 0;
- if(ob->totcol) {
- for(a=0; a<ob->totcol; a++) {
- if(ob->mat[a]) ob->colbits |= (1<<a);
+ if (ob->totcol) {
+ for (a=0; a<ob->totcol; a++) {
+ if (ob->mat[a]) ob->colbits |= (1<<a);
}
}
ob= ob->id.next;
}
}
- if(main->versionfile <= 104) {
+ if (main->versionfile <= 104) {
/* timeoffs moved */
Object *ob = main->object.first;
- while(ob) {
- if(ob->transflag & 1) {
+ while (ob) {
+ if (ob->transflag & 1) {
ob->transflag -= 1;
//ob->ipoflag |= OB_OFFS_OB;
}
ob= ob->id.next;
}
}
- if(main->versionfile <= 105) {
+ if (main->versionfile <= 105) {
Object *ob = main->object.first;
- while(ob) {
+ while (ob) {
ob->dupon= 1; ob->dupoff= 0;
ob->dupsta= 1; ob->dupend= 100;
ob= ob->id.next;
}
}
- if(main->versionfile <= 106) {
+ if (main->versionfile <= 106) {
/* mcol changed */
Mesh *me = main->mesh.first;
- while(me) {
- if(me->mcol) vcol_to_fcol(me);
+ while (me) {
+ if (me->mcol) vcol_to_fcol(me);
me= me->id.next;
}
}
- if(main->versionfile <= 107) {
+ if (main->versionfile <= 107) {
Object *ob;
Scene *sce = main->scene.first;
- while(sce) {
+ while (sce) {
sce->r.mode |= R_GAMMA;
sce= sce->id.next;
}
ob= main->object.first;
- while(ob) {
+ while (ob) {
//ob->ipoflag |= OB_OFFS_PARENT;
- if(ob->dt==0) ob->dt= OB_SOLID;
+ if (ob->dt==0) ob->dt= OB_SOLID;
ob= ob->id.next;
}
}
- if(main->versionfile <= 109) {
+ if (main->versionfile <= 109) {
/* new variable: gridlines */
bScreen *sc = main->screen.first;
- while(sc) {
+ while (sc) {
ScrArea *sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
SpaceLink *sl= sa->spacedata.first;
while (sl) {
if (sl->spacetype==SPACE_VIEW3D) {
@@ -8052,17 +8111,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
sc= sc->id.next;
}
}
- if(main->versionfile <= 113) {
+ if (main->versionfile <= 113) {
Material *ma = main->mat.first;
- while(ma) {
- if(ma->flaresize==0.0f) ma->flaresize= 1.0f;
+ while (ma) {
+ if (ma->flaresize==0.0f) ma->flaresize= 1.0f;
ma->subsize= 1.0f;
ma->flareboost= 1.0f;
ma= ma->id.next;
}
}
- if(main->versionfile <= 134) {
+ if (main->versionfile <= 134) {
Tex *tex = main->tex.first;
while (tex) {
if ((tex->rfac == 0.0f) &&
@@ -8076,7 +8135,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
tex = tex->id.next;
}
}
- if(main->versionfile <= 140) {
+ if (main->versionfile <= 140) {
/* r-g-b-fac in texture */
Tex *tex = main->tex.first;
while (tex) {
@@ -8091,54 +8150,54 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
tex = tex->id.next;
}
}
- if(main->versionfile <= 153) {
+ if (main->versionfile <= 153) {
Scene *sce = main->scene.first;
- while(sce) {
- if(sce->r.blurfac==0.0f) sce->r.blurfac= 1.0f;
+ while (sce) {
+ if (sce->r.blurfac==0.0f) sce->r.blurfac= 1.0f;
sce= sce->id.next;
}
}
- if(main->versionfile <= 163) {
+ if (main->versionfile <= 163) {
Scene *sce = main->scene.first;
- while(sce) {
- if(sce->r.frs_sec==0) sce->r.frs_sec= 25;
+ while (sce) {
+ if (sce->r.frs_sec==0) sce->r.frs_sec= 25;
sce= sce->id.next;
}
}
- if(main->versionfile <= 164) {
+ if (main->versionfile <= 164) {
Mesh *me= main->mesh.first;
- while(me) {
+ while (me) {
me->smoothresh= 30;
me= me->id.next;
}
}
- if(main->versionfile <= 165) {
+ if (main->versionfile <= 165) {
Mesh *me= main->mesh.first;
TFace *tface;
int nr;
char *cp;
- while(me) {
- if(me->tface) {
+ while (me) {
+ if (me->tface) {
nr= me->totface;
tface= me->tface;
- while(nr--) {
+ while (nr--) {
cp= (char *)&tface->col[0];
- if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
- if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
- if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
+ if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+ if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+ if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
cp= (char *)&tface->col[1];
- if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
- if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
- if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
+ if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+ if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+ if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
cp= (char *)&tface->col[2];
- if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
- if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
- if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
+ if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+ if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+ if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
cp= (char *)&tface->col[3];
- if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
- if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
- if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
+ if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+ if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+ if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
tface++;
}
@@ -8147,22 +8206,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 169) {
+ if (main->versionfile <= 169) {
Mesh *me= main->mesh.first;
- while(me) {
- if(me->subdiv==0) me->subdiv= 1;
+ while (me) {
+ if (me->subdiv==0) me->subdiv= 1;
me= me->id.next;
}
}
- if(main->versionfile <= 169) {
+ if (main->versionfile <= 169) {
bScreen *sc= main->screen.first;
- while(sc) {
+ while (sc) {
ScrArea *sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- if(sl->spacetype==SPACE_IPO) {
+ while (sl) {
+ if (sl->spacetype==SPACE_IPO) {
SpaceIpo *sipo= (SpaceIpo*) sl;
sipo->v2d.max[0]= 15000.0;
}
@@ -8174,7 +8233,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 170) {
+ if (main->versionfile <= 170) {
Object *ob = main->object.first;
PartEff *paf;
while (ob) {
@@ -8188,14 +8247,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 171) {
+ if (main->versionfile <= 171) {
bScreen *sc= main->screen.first;
- while(sc) {
+ while (sc) {
ScrArea *sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- if(sl->spacetype==SPACE_TEXT) {
+ while (sl) {
+ if (sl->spacetype==SPACE_TEXT) {
SpaceText *st= (SpaceText*) sl;
st->lheight= 12;
}
@@ -8207,14 +8266,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 173) {
+ if (main->versionfile <= 173) {
int a, b;
Mesh *me= main->mesh.first;
- while(me) {
- if(me->tface) {
+ while (me) {
+ if (me->tface) {
TFace *tface= me->tface;
- for(a=0; a<me->totface; a++, tface++) {
- for(b=0; b<4; b++) {
+ for (a=0; a<me->totface; a++, tface++) {
+ for (b=0; b<4; b++) {
tface->uv[b][0]/= 32767.0f;
tface->uv[b][1]/= 32767.0f;
}
@@ -8224,17 +8283,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 191) {
+ if (main->versionfile <= 191) {
Object *ob= main->object.first;
Material *ma = main->mat.first;
/* let faces have default add factor of 0.0 */
- while(ma) {
+ while (ma) {
if (!(ma->mode & MA_HALO)) ma->add = 0.0;
ma = ma->id.next;
}
- while(ob) {
+ while (ob) {
ob->mass= 1.0f;
ob->damping= 0.1f;
/*ob->quat[1]= 1.0f;*/ /* quats arnt used yet */
@@ -8242,23 +8301,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 193) {
+ if (main->versionfile <= 193) {
Object *ob= main->object.first;
- while(ob) {
+ while (ob) {
ob->inertia= 1.0f;
ob->rdamping= 0.1f;
ob= ob->id.next;
}
}
- if(main->versionfile <= 196) {
+ if (main->versionfile <= 196) {
Mesh *me= main->mesh.first;
int a, b;
- while(me) {
- if(me->tface) {
+ while (me) {
+ if (me->tface) {
TFace *tface= me->tface;
- for(a=0; a<me->totface; a++, tface++) {
- for(b=0; b<4; b++) {
+ for (a=0; a<me->totface; a++, tface++) {
+ for (b=0; b<4; b++) {
tface->mode |= TF_DYNAMIC;
tface->mode &= ~TF_INVISIBLE;
}
@@ -8268,9 +8327,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 200) {
+ if (main->versionfile <= 200) {
Object *ob= main->object.first;
- while(ob) {
+ while (ob) {
ob->scaflag = ob->gameflag & (OB_DO_FH|OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
/* 64 is do_fh */
ob->gameflag &= ~(OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
@@ -8278,7 +8337,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 201) {
+ if (main->versionfile <= 201) {
/* add-object + end-object are joined to edit-object actuator */
Object *ob = main->object.first;
bProperty *prop;
@@ -8289,14 +8348,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
while (ob) {
act = ob->actuators.first;
while (act) {
- if(act->type==ACT_IPO) {
+ if (act->type==ACT_IPO) {
ia= act->data;
prop= get_ob_property(ob, ia->name);
- if(prop) {
+ if (prop) {
ia->type= ACT_IPO_FROM_PROP;
}
}
- else if(act->type==ACT_ADD_OBJECT) {
+ else if (act->type==ACT_ADD_OBJECT) {
aoa= act->data;
eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act");
eoa->type= ACT_EDOB_ADD_OBJECT;
@@ -8306,7 +8365,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
act->data= eoa;
act->type= act->otype= ACT_EDIT_OBJECT;
}
- else if(act->type==ACT_END_OBJECT) {
+ else if (act->type==ACT_END_OBJECT) {
eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act");
eoa->type= ACT_EDOB_END_OBJECT;
act->data= eoa;
@@ -8318,16 +8377,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 202) {
+ if (main->versionfile <= 202) {
/* add-object and end-object are joined to edit-object
* actuator */
Object *ob= main->object.first;
bActuator *act;
bObjectActuator *oa;
- while(ob) {
+ while (ob) {
act= ob->actuators.first;
- while(act) {
- if(act->type==ACT_OBJECT) {
+ while (act) {
+ if (act->type==ACT_OBJECT) {
oa= act->data;
oa->flag &= ~(ACT_TORQUE_LOCAL|ACT_DROT_LOCAL); /* this actuator didn't do local/glob rot before */
}
@@ -8337,20 +8396,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 204) {
+ if (main->versionfile <= 204) {
/* patches for new physics */
Object *ob= main->object.first;
bActuator *act;
bObjectActuator *oa;
bSound *sound;
- while(ob) {
+ while (ob) {
/* please check this for demo20 files like
* original Egypt levels etc. converted
* rotation factor of 50 is not workable */
act= ob->actuators.first;
- while(act) {
- if(act->type==ACT_OBJECT) {
+ while (act) {
+ if (act->type==ACT_OBJECT) {
oa= act->data;
oa->forceloc[0]*= 25.0f;
@@ -8375,7 +8434,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 205) {
+ if (main->versionfile <= 205) {
/* patches for new physics */
Object *ob= main->object.first;
bActuator *act;
@@ -8383,7 +8442,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bEditObjectActuator *oa;
bRaySensor *rs;
bCollisionSensor *cs;
- while(ob) {
+ while (ob) {
/* Set anisotropic friction off for old objects,
* values to 1.0. */
ob->gameflag &= ~OB_ANISOTROPIC_FRICTION;
@@ -8392,8 +8451,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ob->anisotropicFriction[2] = 1.0;
act= ob->actuators.first;
- while(act) {
- if(act->type==ACT_EDIT_OBJECT) {
+ while (act) {
+ if (act->type==ACT_EDIT_OBJECT) {
/* Zero initial velocity for newly
* added objects */
oa= act->data;
@@ -8408,16 +8467,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
sens= ob->sensors.first;
while (sens) {
/* Extra fields for radar sensors. */
- if(sens->type == SENS_RADAR) {
+ if (sens->type == SENS_RADAR) {
bRadarSensor *s = sens->data;
s->range = 10000.0;
}
/* Pulsing: defaults for new sensors. */
- if(sens->type != SENS_ALWAYS) {
+ if (sens->type != SENS_ALWAYS) {
sens->pulse = 0;
sens->freq = 0;
- } else {
+ }
+ else {
sens->pulse = 1;
}
@@ -8427,11 +8487,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* Collision and ray: default = trigger
* on property. The material field can
* remain empty. */
- if(sens->type == SENS_COLLISION) {
+ if (sens->type == SENS_COLLISION) {
cs = (bCollisionSensor*) sens->data;
cs->mode = 0;
}
- if(sens->type == SENS_RAY) {
+ if (sens->type == SENS_RAY) {
rs = (bRaySensor*) sens->data;
rs->mode = 0;
}
@@ -8442,7 +8502,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* have to check the exact multiplier */
}
- if(main->versionfile <= 211) {
+ if (main->versionfile <= 211) {
/* Render setting: per scene, the applicable gamma value
* can be set. Default is 1.0, which means no
* correction. */
@@ -8452,16 +8512,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* added alpha in obcolor */
ob= main->object.first;
- while(ob) {
+ while (ob) {
ob->col[3]= 1.0;
ob= ob->id.next;
}
/* added alpha in obcolor */
ob= main->object.first;
- while(ob) {
+ while (ob) {
act= ob->actuators.first;
- while(act) {
+ while (act) {
if (act->type==ACT_OBJECT) {
/* multiply velocity with 50 in old files */
oa= act->data;
@@ -8484,7 +8544,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 212) {
+ if (main->versionfile <= 212) {
bSound* sound;
bProperty *prop;
@@ -8510,7 +8570,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
while (ob) {
prop= ob->prop.first;
- while(prop) {
+ while (prop) {
if (prop->type == GPROP_TIME) {
// convert old GPROP_TIME values from int to float
*((float *)&prop->data) = (float) prop->data;
@@ -8532,7 +8592,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
me->flag|= ME_SUBSURF;
me->subdiv= 1;
- } else {
+ }
+ else {
if (me->subdiv<2)
me->subdiv= 1;
else
@@ -8541,7 +8602,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 220) {
+ if (main->versionfile <= 220) {
Object *ob;
Mesh *me;
@@ -8590,11 +8651,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
- if(main->versionfile <= 221) {
+ if (main->versionfile <= 221) {
Scene *sce= main->scene.first;
// new variables for std-alone player and runtime
- while(sce) {
+ while (sce) {
sce->r.xplay= 640;
sce->r.yplay= 480;
@@ -8604,11 +8665,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 222) {
+ if (main->versionfile <= 222) {
Scene *sce= main->scene.first;
// new variables for std-alone player and runtime
- while(sce) {
+ while (sce) {
sce->r.depth= 32;
@@ -8617,7 +8678,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
- if(main->versionfile <= 223) {
+ if (main->versionfile <= 223) {
VFont *vf;
Image *ima;
Object *ob;
@@ -8629,7 +8690,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* Old textures animate at 25 FPS */
- for (ima = main->image.first; ima; ima=ima->id.next){
+ for (ima = main->image.first; ima; ima=ima->id.next) {
ima->animspeed = 25;
}
@@ -8648,7 +8709,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
- if(main->versionfile <= 224) {
+ if (main->versionfile <= 224) {
bSound* sound;
Scene *sce;
Mesh *me;
@@ -8663,7 +8724,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
/* Make sure that old subsurf meshes don't have zero subdivision level for rendering */
- for (me=main->mesh.first; me; me=me->id.next){
+ for (me=main->mesh.first; me; me=me->id.next) {
if ((me->flag & ME_SUBSURF) && (me->subdivr==0))
me->subdivr=me->subdiv;
}
@@ -8691,7 +8752,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
- if(main->versionfile <= 225) {
+ if (main->versionfile <= 225) {
World *wo;
/* Use Sumo for old games */
for (wo = main->world.first; wo; wo= wo->id.next) {
@@ -8699,7 +8760,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->versionfile <= 227) {
+ if (main->versionfile <= 227) {
Scene *sce;
Material *ma;
bScreen *sc;
@@ -8717,10 +8778,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* check for already existing TrackTo constraint
set their track and up flag correctly */
- if (list){
+ if (list) {
bConstraint *curcon;
- for (curcon = list->first; curcon; curcon=curcon->next){
- if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
+ for (curcon = list->first; curcon; curcon=curcon->next) {
+ if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
bTrackToConstraint *data = curcon->data;
data->reserved1 = ob->trackflag;
data->reserved2 = ob->upflag;
@@ -8729,14 +8790,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
if (ob->type == OB_ARMATURE) {
- if (ob->pose){
+ if (ob->pose) {
bConstraint *curcon;
bPoseChannel *pchan;
for (pchan = ob->pose->chanbase.first;
- pchan; pchan=pchan->next){
+ pchan; pchan=pchan->next) {
for (curcon = pchan->constraints.first;
- curcon; curcon=curcon->next){
- if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
+ curcon; curcon=curcon->next) {
+ if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
bTrackToConstraint *data = curcon->data;
data->reserved1 = ob->trackflag;
data->reserved2 = ob->upflag;
@@ -8787,7 +8848,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
- if(main->versionfile <= 228) {
+ if (main->versionfile <= 228) {
Scene *sce;
bScreen *sc;
Object *ob;
@@ -8804,10 +8865,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* check for already existing TrackTo constraint
set their track and up flag correctly */
- if (list){
+ if (list) {
bConstraint *curcon;
- for (curcon = list->first; curcon; curcon=curcon->next){
- if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
+ for (curcon = list->first; curcon; curcon=curcon->next) {
+ if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
bTrackToConstraint *data = curcon->data;
data->reserved1 = ob->trackflag;
data->reserved2 = ob->upflag;
@@ -8816,14 +8877,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
if (ob->type == OB_ARMATURE) {
- if (ob->pose){
+ if (ob->pose) {
bConstraint *curcon;
bPoseChannel *pchan;
for (pchan = ob->pose->chanbase.first;
- pchan; pchan=pchan->next){
+ pchan; pchan=pchan->next) {
for (curcon = pchan->constraints.first;
- curcon; curcon=curcon->next){
- if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
+ curcon; curcon=curcon->next) {
+ if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
bTrackToConstraint *data = curcon->data;
data->reserved1 = ob->trackflag;
data->reserved2 = ob->upflag;
@@ -8854,46 +8915,46 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
sbuts->v2d.maxzoom= 1.2f;
sbuts->align= 1; /* horizontal default */
- if(sbuts->mainb==BUTS_LAMP) {
+ if (sbuts->mainb==BUTS_LAMP) {
sbuts->mainb= CONTEXT_SHADING;
//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
}
- else if(sbuts->mainb==BUTS_MAT) {
+ else if (sbuts->mainb==BUTS_MAT) {
sbuts->mainb= CONTEXT_SHADING;
//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
}
- else if(sbuts->mainb==BUTS_TEX) {
+ else if (sbuts->mainb==BUTS_TEX) {
sbuts->mainb= CONTEXT_SHADING;
//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
}
- else if(sbuts->mainb==BUTS_ANIM) {
+ else if (sbuts->mainb==BUTS_ANIM) {
sbuts->mainb= CONTEXT_OBJECT;
}
- else if(sbuts->mainb==BUTS_WORLD) {
+ else if (sbuts->mainb==BUTS_WORLD) {
sbuts->mainb= CONTEXT_SCENE;
//sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
}
- else if(sbuts->mainb==BUTS_RENDER) {
+ else if (sbuts->mainb==BUTS_RENDER) {
sbuts->mainb= CONTEXT_SCENE;
//sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
}
- else if(sbuts->mainb==BUTS_GAME) {
+ else if (sbuts->mainb==BUTS_GAME) {
sbuts->mainb= CONTEXT_LOGIC;
}
- else if(sbuts->mainb==BUTS_FPAINT) {
+ else if (sbuts->mainb==BUTS_FPAINT) {
sbuts->mainb= CONTEXT_EDITING;
}
- else if(sbuts->mainb==BUTS_RADIO) {
+ else if (sbuts->mainb==BUTS_RADIO) {
sbuts->mainb= CONTEXT_SHADING;
//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
}
- else if(sbuts->mainb==BUTS_CONSTRAINT) {
+ else if (sbuts->mainb==BUTS_CONSTRAINT) {
sbuts->mainb= CONTEXT_OBJECT;
}
- else if(sbuts->mainb==BUTS_SCRIPT) {
+ else if (sbuts->mainb==BUTS_SCRIPT) {
sbuts->mainb= CONTEXT_OBJECT;
}
- else if(sbuts->mainb==BUTS_EDIT) {
+ else if (sbuts->mainb==BUTS_EDIT) {
sbuts->mainb= CONTEXT_EDITING;
}
else sbuts->mainb= CONTEXT_SCENE;
@@ -8907,7 +8968,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
nevertheless, we might need to think over a fitness (initialize)
check apart from the do_versions() */
- if(main->versionfile <= 230) {
+ if (main->versionfile <= 230) {
bScreen *sc;
// new variable blockscale, for panels in any area
@@ -8918,9 +8979,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->blockscale==0.0f) sl->blockscale= 0.7f;
+ if (sl->blockscale==0.0f) sl->blockscale= 0.7f;
/* added: 5x better zoom in for action */
- if(sl->spacetype==SPACE_ACTION) {
+ if (sl->spacetype==SPACE_ACTION) {
SpaceAction *sac= (SpaceAction *)sl;
sac->v2d.maxzoom= 50;
}
@@ -8928,12 +8989,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
- if(main->versionfile <= 231) {
+ if (main->versionfile <= 231) {
/* new bit flags for showing/hiding grid floor and axes */
bScreen *sc = main->screen.first;
- while(sc) {
+ while (sc) {
ScrArea *sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
SpaceLink *sl= sa->spacedata.first;
while (sl) {
if (sl->spacetype==SPACE_VIEW3D) {
@@ -8953,7 +9014,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
sc= sc->id.next;
}
}
- if(main->versionfile <= 231) {
+ if (main->versionfile <= 231) {
Material *ma= main->mat.first;
bScreen *sc = main->screen.first;
Scene *sce;
@@ -8961,9 +9022,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
World *wrld;
/* introduction of raytrace */
- while(ma) {
- if(ma->fresnel_tra_i==0.0f) ma->fresnel_tra_i= 1.25f;
- if(ma->fresnel_mir_i==0.0f) ma->fresnel_mir_i= 1.25f;
+ while (ma) {
+ if (ma->fresnel_tra_i==0.0f) ma->fresnel_tra_i= 1.25f;
+ if (ma->fresnel_mir_i==0.0f) ma->fresnel_mir_i= 1.25f;
ma->ang= 1.0;
ma->ray_depth= 2;
@@ -8974,24 +9035,24 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ma= ma->id.next;
}
sce= main->scene.first;
- while(sce) {
- if(sce->r.gauss==0.0f) sce->r.gauss= 1.0f;
+ while (sce) {
+ if (sce->r.gauss==0.0f) sce->r.gauss= 1.0f;
sce= sce->id.next;
}
la= main->lamp.first;
- while(la) {
- if(la->k==0.0f) la->k= 1.0;
- if(la->ray_samp==0) la->ray_samp= 1;
- if(la->ray_sampy==0) la->ray_sampy= 1;
- if(la->ray_sampz==0) la->ray_sampz= 1;
- if(la->area_size==0.0f) la->area_size= 1.0f;
- if(la->area_sizey==0.0f) la->area_sizey= 1.0f;
- if(la->area_sizez==0.0f) la->area_sizez= 1.0f;
+ while (la) {
+ if (la->k==0.0f) la->k= 1.0;
+ if (la->ray_samp==0) la->ray_samp= 1;
+ if (la->ray_sampy==0) la->ray_sampy= 1;
+ if (la->ray_sampz==0) la->ray_sampz= 1;
+ if (la->area_size==0.0f) la->area_size= 1.0f;
+ if (la->area_sizey==0.0f) la->area_sizey= 1.0f;
+ if (la->area_sizez==0.0f) la->area_sizez= 1.0f;
la= la->id.next;
}
wrld= main->world.first;
- while(wrld) {
- if(wrld->range==0.0f) {
+ while (wrld) {
+ if (wrld->range==0.0f) {
wrld->range= 1.0f/wrld->exposure;
}
wrld= wrld->id.next;
@@ -8999,9 +9060,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* new bit flags for showing/hiding grid floor and axes */
- while(sc) {
+ while (sc) {
ScrArea *sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
SpaceLink *sl= sa->spacedata.first;
while (sl) {
if (sl->spacetype==SPACE_VIEW3D) {
@@ -9021,18 +9082,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
sc= sc->id.next;
}
}
- if(main->versionfile <= 232) {
+ if (main->versionfile <= 232) {
Tex *tex= main->tex.first;
World *wrld= main->world.first;
bScreen *sc;
Scene *sce;
- while(tex) {
- if((tex->flag & (TEX_CHECKER_ODD+TEX_CHECKER_EVEN))==0) {
+ while (tex) {
+ if ((tex->flag & (TEX_CHECKER_ODD+TEX_CHECKER_EVEN))==0) {
tex->flag |= TEX_CHECKER_ODD;
}
/* copied from kernel texture.c */
- if(tex->ns_outscale==0.0f) {
+ if (tex->ns_outscale==0.0f) {
/* musgrave */
tex->mg_H = 1.0f;
tex->mg_lacunarity = 2.0f;
@@ -9049,13 +9110,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
tex= tex->id.next;
}
- while(wrld) {
- if(wrld->aodist==0.0f) {
+ while (wrld) {
+ if (wrld->aodist==0.0f) {
wrld->aodist= 10.0f;
wrld->aobias= 0.05f;
}
- if(wrld->aosamp==0) wrld->aosamp= 5;
- if(wrld->aoenergy==0.0f) wrld->aoenergy= 1.0f;
+ if (wrld->aosamp==0) wrld->aosamp= 5;
+ if (wrld->aoenergy==0.0f) wrld->aoenergy= 1.0f;
wrld= wrld->id.next;
}
@@ -9067,10 +9128,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->blockscale==0.0f) sl->blockscale= 0.7f;
+ if (sl->blockscale==0.0f) sl->blockscale= 0.7f;
/* added: 5x better zoom in for nla */
- if(sl->spacetype==SPACE_NLA) {
+ if (sl->spacetype==SPACE_NLA) {
SpaceNla *snla= (SpaceNla *)sl;
snla->v2d.maxzoom= 50;
}
@@ -9078,28 +9139,28 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
sce= main->scene.first;
- while(sce) {
- if(sce->r.ocres==0) sce->r.ocres= 64;
+ while (sce) {
+ if (sce->r.ocres==0) sce->r.ocres= 64;
sce= sce->id.next;
}
}
- if(main->versionfile <= 233) {
+ if (main->versionfile <= 233) {
bScreen *sc;
Material *ma= main->mat.first;
/* Object *ob= main->object.first; */
- while(ma) {
- if(ma->rampfac_col==0.0f) ma->rampfac_col= 1.0;
- if(ma->rampfac_spec==0.0f) ma->rampfac_spec= 1.0;
- if(ma->pr_lamp==0) ma->pr_lamp= 3;
+ while (ma) {
+ if (ma->rampfac_col==0.0f) ma->rampfac_col= 1.0;
+ if (ma->rampfac_spec==0.0f) ma->rampfac_spec= 1.0;
+ if (ma->pr_lamp==0) ma->pr_lamp= 3;
ma= ma->id.next;
}
/* this should have been done loooong before! */
#if 0 /* deprecated in 2.5+ */
- while(ob) {
- if(ob->ipowin==0) ob->ipowin= ID_OB;
+ while (ob) {
+ if (ob->ipowin==0) ob->ipowin= ID_OB;
ob= ob->id.next;
}
#endif
@@ -9108,7 +9169,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *)sl;
v3d->flag |= V3D_SELECT_OUTLINE;
}
@@ -9120,13 +9181,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
- if(main->versionfile <= 234) {
+ if (main->versionfile <= 234) {
World *wo;
bScreen *sc;
// force sumo engine to be active
for (wo = main->world.first; wo; wo= wo->id.next) {
- if(wo->physicsEngine==0) wo->physicsEngine = 2;
+ if (wo->physicsEngine==0) wo->physicsEngine = 2;
}
for (sc= main->screen.first; sc; sc= sc->id.next) {
@@ -9134,33 +9195,33 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *)sl;
v3d->flag |= V3D_ZBUF_SELECT;
}
- else if(sl->spacetype==SPACE_TEXT) {
+ else if (sl->spacetype==SPACE_TEXT) {
SpaceText *st= (SpaceText *)sl;
- if(st->tabnumber==0) st->tabnumber= 2;
+ if (st->tabnumber==0) st->tabnumber= 2;
}
}
}
}
}
- if(main->versionfile <= 235) {
+ if (main->versionfile <= 235) {
Tex *tex= main->tex.first;
Scene *sce= main->scene.first;
Sequence *seq;
Editing *ed;
- while(tex) {
- if(tex->nabla==0.0f) tex->nabla= 0.025f;
+ while (tex) {
+ if (tex->nabla==0.0f) tex->nabla= 0.025f;
tex= tex->id.next;
}
- while(sce) {
+ while (sce) {
ed= sce->ed;
- if(ed) {
+ if (ed) {
SEQ_BEGIN(sce->ed, seq) {
- if(seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE)
+ if (seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE)
seq->flag |= SEQ_MAKE_PREMUL;
}
SEQ_END
@@ -9169,16 +9230,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
sce= sce->id.next;
}
}
- if(main->versionfile <= 236) {
+ if (main->versionfile <= 236) {
Object *ob;
Camera *cam= main->camera.first;
Material *ma;
bScreen *sc;
- while(cam) {
- if(cam->ortho_scale==0.0f) {
+ while (cam) {
+ if (cam->ortho_scale==0.0f) {
cam->ortho_scale= 256.0f/cam->lens;
- if(cam->type==CAM_ORTHO) printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
+ if (cam->type==CAM_ORTHO) printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
}
cam= cam->id.next;
}
@@ -9190,34 +9251,34 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *)sl;
- if(v3d->twtype==0) v3d->twtype= V3D_MANIP_TRANSLATE;
+ if (v3d->twtype==0) v3d->twtype= V3D_MANIP_TRANSLATE;
}
}
}
}
// init new shader vars
for (ma= main->mat.first; ma; ma= ma->id.next) {
- if(ma->darkness==0.0f) {
+ if (ma->darkness==0.0f) {
ma->rms=0.1f;
ma->darkness=1.0f;
}
}
/* softbody init new vars */
- for(ob= main->object.first; ob; ob= ob->id.next) {
- if(ob->soft) {
- if(ob->soft->defgoal==0.0f) ob->soft->defgoal= 0.7f;
- if(ob->soft->physics_speed==0.0f) ob->soft->physics_speed= 1.0f;
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ if (ob->soft) {
+ if (ob->soft->defgoal==0.0f) ob->soft->defgoal= 0.7f;
+ if (ob->soft->physics_speed==0.0f) ob->soft->physics_speed= 1.0f;
- if(ob->soft->interval==0) {
+ if (ob->soft->interval==0) {
ob->soft->interval= 2;
ob->soft->sfra= 1;
ob->soft->efra= 100;
}
}
- if(ob->soft && ob->soft->vertgroup==0) {
+ if (ob->soft && ob->soft->vertgroup==0) {
bDeformGroup *locGroup = defgroup_find_name(ob, "SOFTGOAL");
if (locGroup) {
/* retrieve index for that group */
@@ -9226,38 +9287,39 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
- if(main->versionfile <= 237) {
+ if (main->versionfile <= 237) {
bArmature *arm;
bConstraint *con;
Object *ob;
Bone *bone;
// armature recode checks
- for(arm= main->armature.first; arm; arm= arm->id.next) {
+ for (arm= main->armature.first; arm; arm= arm->id.next) {
where_is_armature(arm);
- for(bone= arm->bonebase.first; bone; bone= bone->next)
+ for (bone= arm->bonebase.first; bone; bone= bone->next)
do_version_bone_head_tail_237(bone);
}
- for(ob= main->object.first; ob; ob= ob->id.next) {
- if(ob->parent) {
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ if (ob->parent) {
Object *parent= newlibadr(fd, lib, ob->parent);
if (parent && parent->type==OB_LATTICE)
ob->partype = PARSKEL;
}
// btw. armature_rebuild_pose is further only called on leave editmode
- if(ob->type==OB_ARMATURE) {
- if(ob->pose)
+ if (ob->type==OB_ARMATURE) {
+ if (ob->pose)
ob->pose->flag |= POSE_RECALC;
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; // cannot call stuff now (pointers!), done in setup_app_data
/* new generic xray option */
arm= newlibadr(fd, lib, ob->data);
- if(arm->flag & ARM_DRAWXRAY) {
+ if (arm->flag & ARM_DRAWXRAY) {
ob->dtx |= OB_DRAWXRAY;
}
- } else if (ob->type==OB_MESH) {
+ }
+ else if (ob->type==OB_MESH) {
Mesh *me = newlibadr(fd, lib, ob->data);
if ((me->flag&ME_SUBSURF)) {
@@ -9282,20 +9344,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
// follow path constraint needs to set the 'path' option in curves...
- for(con=ob->constraints.first; con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_FOLLOWPATH) {
+ for (con=ob->constraints.first; con; con= con->next) {
+ if (con->type==CONSTRAINT_TYPE_FOLLOWPATH) {
bFollowPathConstraint *data = con->data;
Object *obc= newlibadr(fd, lib, data->tar);
- if(obc && obc->type==OB_CURVE) {
+ if (obc && obc->type==OB_CURVE) {
Curve *cu= newlibadr(fd, lib, obc->data);
- if(cu) cu->flag |= CU_PATH;
+ if (cu) cu->flag |= CU_PATH;
}
}
}
}
}
- if(main->versionfile <= 238) {
+ if (main->versionfile <= 238) {
Lattice *lt;
Object *ob;
bArmature *arm;
@@ -9303,8 +9365,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Key *key;
Scene *sce= main->scene.first;
- while(sce){
- if(sce->toolsettings == NULL){
+ while (sce) {
+ if (sce->toolsettings == NULL) {
sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings),"Tool Settings Struct");
sce->toolsettings->cornertype=0;
sce->toolsettings->degr = 90;
@@ -9328,7 +9390,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- for(ob=main->object.first; ob; ob= ob->id.next) {
+ for (ob=main->object.first; ob; ob= ob->id.next) {
ModifierData *md;
PartEff *paf;
@@ -9349,23 +9411,24 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(eModifierType_Softbody));
- } else {
+ }
+ else {
BLI_addhead(&ob->modifiers, modifier_new(eModifierType_Softbody));
}
ob->softflag &= ~OB_SB_ENABLE;
}
- if(ob->pose) {
+ if (ob->pose) {
bPoseChannel *pchan;
bConstraint *con;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
// note, pchan->bone is also lib-link stuff
if (pchan->limitmin[0] == 0.0f && pchan->limitmax[0] == 0.0f) {
pchan->limitmin[0]= pchan->limitmin[1]= pchan->limitmin[2]= -180.0f;
pchan->limitmax[0]= pchan->limitmax[1]= pchan->limitmax[2]= 180.0f;
- for(con= pchan->constraints.first; con; con= con->next) {
- if(con->type == CONSTRAINT_TYPE_KINEMATIC) {
+ for (con= pchan->constraints.first; con; con= con->next) {
+ if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data = (bKinematicConstraint*)con->data;
data->weight = 1.0f;
data->orientweight = 1.0f;
@@ -9384,40 +9447,41 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
paf = do_version_give_parteff_245(ob);
if (paf) {
- if(paf->disp == 0)
+ if (paf->disp == 0)
paf->disp = 100;
- if(paf->speedtex == 0)
+ if (paf->speedtex == 0)
paf->speedtex = 8;
- if(paf->omat == 0)
+ if (paf->omat == 0)
paf->omat = 1;
}
}
- for(arm=main->armature.first; arm; arm= arm->id.next) {
+ for (arm=main->armature.first; arm; arm= arm->id.next) {
bone_version_238(&arm->bonebase);
arm->deformflag |= ARM_DEF_VGROUP;
}
- for(me=main->mesh.first; me; me= me->id.next) {
+ for (me=main->mesh.first; me; me= me->id.next) {
if (!me->medge) {
make_edges(me, 1); /* 1 = use mface->edcode */
- } else {
+ }
+ else {
mesh_strip_loose_faces(me);
}
}
- for(key= main->key.first; key; key= key->id.next) {
+ for (key= main->key.first; key; key= key->id.next) {
KeyBlock *kb;
int index= 1;
/* trick to find out if we already introduced adrcode */
- for(kb= key->block.first; kb; kb= kb->next)
- if(kb->adrcode) break;
+ for (kb= key->block.first; kb; kb= kb->next)
+ if (kb->adrcode) break;
- if(kb==NULL) {
- for(kb= key->block.first; kb; kb= kb->next) {
- if(kb==key->refkey) {
- if(kb->name[0]==0)
+ if (kb==NULL) {
+ for (kb= key->block.first; kb; kb= kb->next) {
+ if (kb==key->refkey) {
+ if (kb->name[0]==0)
strcpy(kb->name, "Basis");
}
else {
@@ -9430,7 +9494,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
- if(main->versionfile <= 239) {
+ if (main->versionfile <= 239) {
bArmature *arm;
Object *ob;
Scene *sce= main->scene.first;
@@ -9439,13 +9503,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
int set_passepartout= 0;
/* deformflag is local in modifier now */
- for(ob=main->object.first; ob; ob= ob->id.next) {
+ for (ob=main->object.first; ob; ob= ob->id.next) {
ModifierData *md;
for (md=ob->modifiers.first; md; md=md->next) {
if (md->type==eModifierType_Armature) {
ArmatureModifierData *amd = (ArmatureModifierData*) md;
- if(amd->object && amd->deformflag==0) {
+ if (amd->object && amd->deformflag==0) {
Object *oba= newlibadr(fd, lib, amd->object);
arm= newlibadr(fd, lib, oba->data);
amd->deformflag= arm->deformflag;
@@ -9455,29 +9519,29 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* updating stepsize for ghost drawing */
- for(arm= main->armature.first; arm; arm= arm->id.next) {
+ for (arm= main->armature.first; arm; arm= arm->id.next) {
if (arm->ghostsize==0) arm->ghostsize=1;
bone_version_239(&arm->bonebase);
- if(arm->layer==0) arm->layer= 1;
+ if (arm->layer==0) arm->layer= 1;
}
- for(;sce;sce= sce->id.next) {
+ for (;sce;sce= sce->id.next) {
/* make 'innervert' the default subdivide type, for backwards compat */
sce->toolsettings->cornertype=1;
- if(sce->r.scemode & R_PASSEPARTOUT) {
+ if (sce->r.scemode & R_PASSEPARTOUT) {
set_passepartout= 1;
sce->r.scemode &= ~R_PASSEPARTOUT;
}
/* gauss is filter variable now */
- if(sce->r.mode & R_GAUSS) {
+ if (sce->r.mode & R_GAUSS) {
sce->r.filtertype= R_FILTER_GAUSS;
sce->r.mode &= ~R_GAUSS;
}
}
- for(;cam; cam= cam->id.next) {
- if(set_passepartout)
+ for (;cam; cam= cam->id.next) {
+ if (set_passepartout)
cam->flag |= CAM_SHOWPASSEPARTOUT;
/* make sure old cameras have title safe on */
@@ -9488,16 +9552,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (!(cam->passepartalpha)) cam->passepartalpha = 0.2f;
}
- for(; ma; ma= ma->id.next) {
- if(ma->strand_sta==0.0f) {
+ for (; ma; ma= ma->id.next) {
+ if (ma->strand_sta==0.0f) {
ma->strand_sta= ma->strand_end= 1.0f;
ma->mode |= MA_TANGENT_STR;
}
- if(ma->mode & MA_TRACEBLE) ma->mode |= MA_SHADBUF;
+ if (ma->mode & MA_TRACEBLE) ma->mode |= MA_SHADBUF;
}
}
- if(main->versionfile <= 241) {
+ if (main->versionfile <= 241) {
Object *ob;
Tex *tex;
Scene *sce;
@@ -9510,37 +9574,37 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (wo = main->world.first; wo; wo= wo->id.next) {
/* Migrate to Bullet for games, except for the NaN versions */
/* People can still explicitly choose for Sumo (after 2.42 is out) */
- if(main->versionfile > 225)
+ if (main->versionfile > 225)
wo->physicsEngine = WOPHY_BULLET;
- if(WO_AODIST == wo->aomode)
+ if (WO_AODIST == wo->aomode)
wo->aocolor= WO_AOPLAIN;
}
/* updating layers still */
- for(arm= main->armature.first; arm; arm= arm->id.next) {
+ for (arm= main->armature.first; arm; arm= arm->id.next) {
bone_version_239(&arm->bonebase);
- if(arm->layer==0) arm->layer= 1;
+ if (arm->layer==0) arm->layer= 1;
}
- for(sce= main->scene.first; sce; sce= sce->id.next) {
- if(sce->audio.mixrate==0) sce->audio.mixrate= 44100;
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->audio.mixrate==0) sce->audio.mixrate= 44100;
- if(sce->r.xparts<2) sce->r.xparts= 4;
- if(sce->r.yparts<2) sce->r.yparts= 4;
+ if (sce->r.xparts<2) sce->r.xparts= 4;
+ if (sce->r.yparts<2) sce->r.yparts= 4;
/* adds default layer */
- if(sce->r.layers.first==NULL)
+ if (sce->r.layers.first==NULL)
scene_add_render_layer(sce, NULL);
else {
SceneRenderLayer *srl;
/* new layer flag for sky, was default for solid */
- for(srl= sce->r.layers.first; srl; srl= srl->next) {
- if(srl->layflag & SCE_LAY_SOLID)
+ for (srl= sce->r.layers.first; srl; srl= srl->next) {
+ if (srl->layflag & SCE_LAY_SOLID)
srl->layflag |= SCE_LAY_SKY;
srl->passflag &= (SCE_PASS_COMBINED|SCE_PASS_Z|SCE_PASS_NORMAL|SCE_PASS_VECTOR);
}
}
/* node version changes */
- if(sce->nodetree)
+ if (sce->nodetree)
ntree_version_241(sce->nodetree);
/* uv calculation options moved to toolsettings */
@@ -9553,13 +9617,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
sce->toolsettings->unwrapper = 1;
}
- if(sce->r.mode & R_PANORAMA) {
+ if (sce->r.mode & R_PANORAMA) {
/* all these checks to ensure saved files with svn version keep working... */
- if(sce->r.xsch < sce->r.ysch) {
+ if (sce->r.xsch < sce->r.ysch) {
Object *obc= newlibadr(fd, lib, sce->camera);
- if(obc && obc->type==OB_CAMERA) {
+ if (obc && obc->type==OB_CAMERA) {
Camera *cam= newlibadr(fd, lib, obc->data);
- if(cam->lens>=10.0f) {
+ if (cam->lens>=10.0f) {
sce->r.xsch*= sce->r.xparts;
cam->lens*= (float)sce->r.ysch/(float)sce->r.xsch;
}
@@ -9568,53 +9632,53 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
ntree_version_241(ntree);
- for(la= main->lamp.first; la; la= la->id.next)
- if(la->buffers==0)
+ for (la= main->lamp.first; la; la= la->id.next)
+ if (la->buffers==0)
la->buffers= 1;
- for(tex= main->tex.first; tex; tex= tex->id.next) {
- if(tex->env && tex->env->viewscale==0.0f)
+ for (tex= main->tex.first; tex; tex= tex->id.next) {
+ if (tex->env && tex->env->viewscale==0.0f)
tex->env->viewscale= 1.0f;
// tex->imaflag |= TEX_GAUSS_MIP;
}
/* for empty drawsize and drawtype */
- for(ob=main->object.first; ob; ob= ob->id.next) {
- if(ob->empty_drawsize==0.0f) {
+ for (ob=main->object.first; ob; ob= ob->id.next) {
+ if (ob->empty_drawsize==0.0f) {
ob->empty_drawtype = OB_ARROWS;
ob->empty_drawsize = 1.0;
}
}
- for(ma= main->mat.first; ma; ma= ma->id.next) {
+ for (ma= main->mat.first; ma; ma= ma->id.next) {
/* stucci returns intensity from now on */
int a;
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a] && ma->mtex[a]->tex) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a] && ma->mtex[a]->tex) {
tex= newlibadr(fd, lib, ma->mtex[a]->tex);
- if(tex && tex->type==TEX_STUCCI)
+ if (tex && tex->type==TEX_STUCCI)
ma->mtex[a]->mapto &= ~(MAP_COL|MAP_SPEC|MAP_REF);
}
}
/* transmissivity defaults */
- if(ma->tx_falloff==0.0f) ma->tx_falloff= 1.0f;
+ if (ma->tx_falloff==0.0f) ma->tx_falloff= 1.0f;
}
/* during 2.41 images with this name were used for viewer node output, lets fix that */
- if(main->versionfile == 241) {
+ if (main->versionfile == 241) {
Image *ima;
- for(ima= main->image.first; ima; ima= ima->id.next)
- if(strcmp(ima->name, "Compositor")==0) {
+ for (ima= main->image.first; ima; ima= ima->id.next)
+ if (strcmp(ima->name, "Compositor")==0) {
strcpy(ima->id.name+2, "Viewer Node");
strcpy(ima->name, "Viewer Node");
}
}
}
- if(main->versionfile <= 242) {
+ if (main->versionfile <= 242) {
Scene *sce;
bScreen *sc;
Object *ob;
@@ -9628,14 +9692,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bNodeTree *ntree;
int a;
- for(sc= main->screen.first; sc; sc= sc->id.next) {
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
ScrArea *sa;
sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D*) sl;
if (v3d->gridsubdiv == 0)
v3d->gridsubdiv = 10;
@@ -9645,7 +9709,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- for(sce= main->scene.first; sce; sce= sce->id.next) {
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
if (sce->toolsettings->select_thresh == 0.0f)
sce->toolsettings->select_thresh= 0.01f;
if (sce->toolsettings->clean_thresh == 0.0f)
@@ -9657,32 +9721,32 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
else
sce->r.threads= 1;
}
- if(sce->nodetree)
+ if (sce->nodetree)
ntree_version_242(sce->nodetree);
}
- for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
ntree_version_242(ntree);
/* add default radius values to old curve points */
- for(cu= main->curve.first; cu; cu= cu->id.next) {
- for(nu= cu->nurb.first; nu; nu= nu->next) {
+ for (cu= main->curve.first; cu; cu= cu->id.next) {
+ for (nu= cu->nurb.first; nu; nu= nu->next) {
if (nu) {
- if(nu->bezt) {
- for(bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
+ if (nu->bezt) {
+ for (bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
if (!bezt->radius) bezt->radius= 1.0;
}
}
- else if(nu->bp) {
- for(bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
- if(!bp->radius) bp->radius= 1.0;
+ else if (nu->bp) {
+ for (bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
+ if (!bp->radius) bp->radius= 1.0;
}
}
}
}
}
- for(ob = main->object.first; ob; ob= ob->id.next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
ModifierData *md;
ListBase *list;
list = &ob->constraints;
@@ -9690,9 +9754,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* check for already existing MinMax (floor) constraint
and update the sticky flagging */
- if (list){
+ if (list) {
bConstraint *curcon;
- for (curcon = list->first; curcon; curcon=curcon->next){
+ for (curcon = list->first; curcon; curcon=curcon->next) {
switch (curcon->type) {
case CONSTRAINT_TYPE_MINMAX:
{
@@ -9708,7 +9772,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bRotateLikeConstraint *data = curcon->data;
/* version patch from buttons_object.c */
- if(data->flag==0)
+ if (data->flag==0)
data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z;
}
break;
@@ -9717,11 +9781,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
if (ob->type == OB_ARMATURE) {
- if (ob->pose){
+ if (ob->pose) {
bConstraint *curcon;
bPoseChannel *pchan;
- for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next){
- for (curcon = pchan->constraints.first; curcon; curcon=curcon->next){
+ for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
+ for (curcon = pchan->constraints.first; curcon; curcon=curcon->next) {
switch (curcon->type) {
case CONSTRAINT_TYPE_MINMAX:
{
@@ -9746,7 +9810,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bRotateLikeConstraint *data = curcon->data;
/* version patch from buttons_object.c */
- if(data->flag==0)
+ if (data->flag==0)
data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z;
}
break;
@@ -9767,54 +9831,54 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
- for(ma = main->mat.first; ma; ma= ma->id.next) {
- if(ma->shad_alpha==0.0f)
+ for (ma = main->mat.first; ma; ma= ma->id.next) {
+ if (ma->shad_alpha==0.0f)
ma->shad_alpha= 1.0f;
- if(ma->nodetree)
+ if (ma->nodetree)
ntree_version_242(ma->nodetree);
}
- for(me=main->mesh.first; me; me=me->id.next)
+ for (me=main->mesh.first; me; me=me->id.next)
customdata_version_242(me);
- for(group= main->group.first; group; group= group->id.next)
- if(group->layer==0)
+ for (group= main->group.first; group; group= group->id.next)
+ if (group->layer==0)
group->layer= (1<<20)-1;
/* History fix (python?), shape key adrcode numbers have to be sorted */
sort_shape_fix(main);
/* now, subversion control! */
- if(main->subversionfile < 3) {
+ if (main->subversionfile < 3) {
Image *ima;
Tex *tex;
/* Image refactor initialize */
- for(ima= main->image.first; ima; ima= ima->id.next) {
+ for (ima= main->image.first; ima; ima= ima->id.next) {
ima->source= IMA_SRC_FILE;
ima->type= IMA_TYPE_IMAGE;
ima->gen_x= 256; ima->gen_y= 256;
ima->gen_type= 1;
- if(0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name)-2)) {
+ if (0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name)-2)) {
ima->source= IMA_SRC_VIEWER;
ima->type= IMA_TYPE_COMPOSITE;
}
- if(0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name)-2)) {
+ if (0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name)-2)) {
ima->source= IMA_SRC_VIEWER;
ima->type= IMA_TYPE_R_RESULT;
}
}
- for(tex= main->tex.first; tex; tex= tex->id.next) {
- if(tex->type==TEX_IMAGE && tex->ima) {
+ for (tex= main->tex.first; tex; tex= tex->id.next) {
+ if (tex->type==TEX_IMAGE && tex->ima) {
ima= newlibadr(fd, lib, tex->ima);
- if(tex->imaflag & TEX_ANIM5_)
+ if (tex->imaflag & TEX_ANIM5_)
ima->source= IMA_SRC_MOVIE;
- if(tex->imaflag & TEX_FIELDS_)
+ if (tex->imaflag & TEX_FIELDS_)
ima->flag |= IMA_FIELDS;
- if(tex->imaflag & TEX_STD_FIELD_)
+ if (tex->imaflag & TEX_STD_FIELD_)
ima->flag |= IMA_STD_FIELD;
}
tex->iuser.frames= tex->frames;
@@ -9823,27 +9887,27 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
tex->iuser.sfra= tex->sfra;
tex->iuser.cycl= (tex->imaflag & TEX_ANIMCYCLIC_)!=0;
}
- for(sce= main->scene.first; sce; sce= sce->id.next) {
- if(sce->nodetree)
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->nodetree)
do_version_ntree_242_2(sce->nodetree);
}
- for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
do_version_ntree_242_2(ntree);
- for(ma = main->mat.first; ma; ma= ma->id.next)
- if(ma->nodetree)
+ for (ma = main->mat.first; ma; ma= ma->id.next)
+ if (ma->nodetree)
do_version_ntree_242_2(ma->nodetree);
- for(sc= main->screen.first; sc; sc= sc->id.next) {
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
ScrArea *sa;
- for(sa= sc->areabase.first; sa; sa= sa->next) {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_IMAGE)
+ if (sl->spacetype==SPACE_IMAGE)
((SpaceImage *)sl)->iuser.fie_ima= 2;
- else if(sl->spacetype==SPACE_VIEW3D) {
+ else if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *)sl;
BGpic *bgpic;
- for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
+ for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
bgpic->iuser.fie_ima= 2;
}
}
@@ -9851,8 +9915,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->subversionfile < 4) {
- for(sce= main->scene.first; sce; sce= sce->id.next) {
+ if (main->subversionfile < 4) {
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
sce->r.bake_mode= 1; /* prevent to include render stuff here */
sce->r.bake_filter= 2;
sce->r.bake_osa= 5;
@@ -9860,20 +9924,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(main->subversionfile < 5) {
- for(sce= main->scene.first; sce; sce= sce->id.next) {
+ if (main->subversionfile < 5) {
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
/* improved triangle to quad conversion settings */
- if(sce->toolsettings->jointrilimit==0.0f)
+ if (sce->toolsettings->jointrilimit==0.0f)
sce->toolsettings->jointrilimit= 0.8f;
}
}
}
- if(main->versionfile <= 243) {
+ if (main->versionfile <= 243) {
Object *ob= main->object.first;
Material *ma;
- for(ma=main->mat.first; ma; ma= ma->id.next) {
- if(ma->sss_scale==0.0f) {
+ for (ma=main->mat.first; ma; ma= ma->id.next) {
+ if (ma->sss_scale==0.0f) {
ma->sss_radius[0]= 1.0f;
ma->sss_radius[1]= 1.0f;
ma->sss_radius[2]= 1.0f;
@@ -9886,28 +9950,28 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ma->sss_colfac= 1.0f;
ma->sss_texfac= 0.0f;
}
- if(ma->sss_front==0 && ma->sss_back==0) {
+ if (ma->sss_front==0 && ma->sss_back==0) {
ma->sss_front= 1.0f;
ma->sss_back= 1.0f;
}
- if(ma->sss_col[0]==0 && ma->sss_col[1]==0 && ma->sss_col[2]==0) {
+ if (ma->sss_col[0]==0 && ma->sss_col[1]==0 && ma->sss_col[2]==0) {
ma->sss_col[0]= ma->r;
ma->sss_col[1]= ma->g;
ma->sss_col[2]= ma->b;
}
}
- for(; ob; ob= ob->id.next) {
+ for (; ob; ob= ob->id.next) {
bDeformGroup *curdef;
- for(curdef= ob->defbase.first; curdef; curdef=curdef->next) {
+ for (curdef= ob->defbase.first; curdef; curdef=curdef->next) {
/* replace an empty-string name with unique name */
if (curdef->name[0] == '\0') {
defgroup_unique_name(curdef, ob);
}
}
- if(main->versionfile < 243 || main->subversionfile < 1) {
+ if (main->versionfile < 243 || main->subversionfile < 1) {
ModifierData *md;
/* translate old mirror modifier axis values to new flags */
@@ -9935,40 +9999,40 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* render layer added, this is not the active layer */
- if(main->versionfile <= 243 || main->subversionfile < 2) {
+ if (main->versionfile <= 243 || main->subversionfile < 2) {
Mesh *me;
- for(me=main->mesh.first; me; me=me->id.next)
+ for (me=main->mesh.first; me; me=me->id.next)
customdata_version_243(me);
}
}
- if(main->versionfile <= 244) {
+ if (main->versionfile <= 244) {
Scene *sce;
bScreen *sc;
Lamp *la;
World *wrld;
- if(main->versionfile != 244 || main->subversionfile < 2) {
- for(sce= main->scene.first; sce; sce= sce->id.next)
+ if (main->versionfile != 244 || main->subversionfile < 2) {
+ for (sce= main->scene.first; sce; sce= sce->id.next)
sce->r.mode |= R_SSS;
/* correct older action editors - incorrect scrolling */
- for(sc= main->screen.first; sc; sc= sc->id.next) {
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
ScrArea *sa;
sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_ACTION) {
+ if (sl->spacetype==SPACE_ACTION) {
SpaceAction *saction= (SpaceAction*) sl;
- saction->v2d.tot.ymin= -1000.0;
- saction->v2d.tot.ymax= 0.0;
+ saction->v2d.tot.ymin = -1000.0;
+ saction->v2d.tot.ymax = 0.0;
- saction->v2d.cur.ymin= -75.0;
- saction->v2d.cur.ymax= 5.0;
+ saction->v2d.cur.ymin = -75.0;
+ saction->v2d.cur.ymax = 5.0;
}
}
sa = sa->next;
@@ -9979,7 +10043,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* constraints recode version patch used to be here. Moved to 245 now... */
- for(wrld=main->world.first; wrld; wrld= wrld->id.next) {
+ for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
if (wrld->mode & WO_AMB_OCC)
wrld->ao_samp_method = WO_AOSAMP_CONSTANT;
else
@@ -9988,7 +10052,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
wrld->ao_adapt_thresh = 0.005f;
}
- for(la=main->lamp.first; la; la= la->id.next) {
+ for (la=main->lamp.first; la; la= la->id.next) {
if (la->type == LA_AREA)
la->ray_samp_method = LA_SAMP_CONSTANT;
else
@@ -9998,7 +10062,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
- if(main->versionfile <= 245) {
+ if (main->versionfile <= 245) {
Scene *sce;
Object *ob;
Image *ima;
@@ -10086,19 +10150,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (main->versionfile != 245) {
/* repair preview from 242 - 244*/
- for(ima= main->image.first; ima; ima= ima->id.next) {
+ for (ima= main->image.first; ima; ima= ima->id.next) {
ima->preview = NULL;
}
}
/* add point caches */
- for(ob=main->object.first; ob; ob=ob->id.next) {
- if(ob->soft && !ob->soft->pointcache)
+ for (ob=main->object.first; ob; ob=ob->id.next) {
+ if (ob->soft && !ob->soft->pointcache)
ob->soft->pointcache= BKE_ptcache_add(&ob->soft->ptcaches);
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
- if(psys->pointcache) {
- if(psys->pointcache->flag & PTCACHE_BAKED && (psys->pointcache->flag & PTCACHE_DISK_CACHE)==0) {
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+ if (psys->pointcache) {
+ if (psys->pointcache->flag & PTCACHE_BAKED && (psys->pointcache->flag & PTCACHE_DISK_CACHE)==0) {
printf("Old memory cache isn't supported for particles, so re-bake the simulation!\n");
psys->pointcache->flag &= ~PTCACHE_BAKED;
}
@@ -10107,10 +10171,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
psys->pointcache= BKE_ptcache_add(&psys->ptcaches);
}
- for(md=ob->modifiers.first; md; md=md->next) {
- if(md->type==eModifierType_Cloth) {
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type==eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData*) md;
- if(!clmd->point_cache)
+ if (!clmd->point_cache)
clmd->point_cache= BKE_ptcache_add(&clmd->ptcaches);
}
}
@@ -10118,14 +10182,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* Copy over old per-level multires vertex data
into a single vertex array in struct Multires */
- for(me = main->mesh.first; me; me=me->id.next) {
- if(me->mr && !me->mr->verts) {
+ for (me = main->mesh.first; me; me=me->id.next) {
+ if (me->mr && !me->mr->verts) {
MultiresLevel *lvl = me->mr->levels.last;
- if(lvl) {
+ if (lvl) {
me->mr->verts = lvl->verts;
lvl->verts = NULL;
/* Don't need the other vert arrays */
- for(lvl = lvl->prev; lvl; lvl = lvl->prev) {
+ for (lvl = lvl->prev; lvl; lvl = lvl->prev) {
MEM_freeN(lvl->verts);
lvl->verts = NULL;
}
@@ -10134,7 +10198,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
if (main->versionfile != 245 || main->subversionfile < 1) {
- for(la=main->lamp.first; la; la= la->id.next) {
+ for (la=main->lamp.first; la; la= la->id.next) {
if (la->mode & LA_QUAD) la->falloff_type = LA_FALLOFF_SLIDERS;
else la->falloff_type = LA_FALLOFF_INVLINEAR;
@@ -10145,8 +10209,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- for(ma=main->mat.first; ma; ma= ma->id.next) {
- if(ma->samp_gloss_mir == 0) {
+ for (ma=main->mat.first; ma; ma= ma->id.next) {
+ if (ma->samp_gloss_mir == 0) {
ma->gloss_mir = ma->gloss_tra= 1.0f;
ma->aniso_gloss_mir = 1.0f;
ma->samp_gloss_mir = ma->samp_gloss_tra= 18;
@@ -10155,15 +10219,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ma->fadeto_mir = MA_RAYMIR_FADETOSKY;
}
- if(ma->strand_min == 0.0f)
+ if (ma->strand_min == 0.0f)
ma->strand_min= 1.0f;
}
- for(part=main->particle.first; part; part=part->id.next) {
- if(part->ren_child_nbr==0)
+ for (part=main->particle.first; part; part=part->id.next) {
+ if (part->ren_child_nbr==0)
part->ren_child_nbr= part->child_nbr;
- if(part->simplify_refsize==0) {
+ if (part->simplify_refsize==0) {
part->simplify_refsize= 1920;
part->simplify_rate= 1.0f;
part->simplify_transition= 0.1f;
@@ -10171,49 +10235,49 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- for(wrld=main->world.first; wrld; wrld= wrld->id.next) {
- if(wrld->ao_approx_error == 0.0f)
+ for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
+ if (wrld->ao_approx_error == 0.0f)
wrld->ao_approx_error= 0.25f;
}
- for(sce= main->scene.first; sce; sce= sce->id.next) {
- if(sce->nodetree)
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->nodetree)
ntree_version_245(fd, lib, sce->nodetree);
- if(sce->r.simplify_shadowsamples == 0) {
+ if (sce->r.simplify_shadowsamples == 0) {
sce->r.simplify_subsurf= 6;
sce->r.simplify_particles= 1.0f;
sce->r.simplify_shadowsamples= 16;
sce->r.simplify_aosss= 1.0f;
}
- if(sce->r.cineongamma == 0) {
+ if (sce->r.cineongamma == 0) {
sce->r.cineonblack= 95;
sce->r.cineonwhite= 685;
sce->r.cineongamma= 1.7f;
}
}
- for(ntree=main->nodetree.first; ntree; ntree= ntree->id.next)
+ for (ntree=main->nodetree.first; ntree; ntree= ntree->id.next)
ntree_version_245(fd, lib, ntree);
/* fix for temporary flag changes during 245 cycle */
- for(ima= main->image.first; ima; ima= ima->id.next) {
- if(ima->flag & IMA_OLD_PREMUL) {
+ for (ima= main->image.first; ima; ima= ima->id.next) {
+ if (ima->flag & IMA_OLD_PREMUL) {
ima->flag &= ~IMA_OLD_PREMUL;
ima->flag |= IMA_DO_PREMUL;
}
}
- for(tex=main->tex.first; tex; tex=tex->id.next) {
- if(tex->iuser.flag & IMA_OLD_PREMUL) {
+ for (tex=main->tex.first; tex; tex=tex->id.next) {
+ if (tex->iuser.flag & IMA_OLD_PREMUL) {
tex->iuser.flag &= ~IMA_OLD_PREMUL;
tex->iuser.flag |= IMA_DO_PREMUL;
}
ima= newlibadr(fd, lib, tex->ima);
- if(ima && (tex->iuser.flag & IMA_DO_PREMUL)) {
+ if (ima && (tex->iuser.flag & IMA_DO_PREMUL)) {
ima->flag &= ~IMA_OLD_PREMUL;
ima->flag |= IMA_DO_PREMUL;
}
@@ -10224,7 +10288,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
* */
{
Scene *sce;
- for(sce=main->scene.first; sce; sce = sce->id.next)
+ for (sce=main->scene.first; sce; sce = sce->id.next)
{
if (sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[1] ||
sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[2] ||
@@ -10242,7 +10306,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Image *ima;
/* initialize 1:1 Aspect */
- for(ima= main->image.first; ima; ima= ima->id.next) {
+ for (ima= main->image.first; ima; ima= ima->id.next) {
ima->aspx = ima->aspy = 1.0f;
}
@@ -10253,12 +10317,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ModifierData *md;
Object *ob;
- for(arm= main->armature.first; arm; arm= arm->id.next)
+ for (arm= main->armature.first; arm; arm= arm->id.next)
arm->deformflag |= ARM_DEF_B_BONE_REST;
- for(ob = main->object.first; ob; ob= ob->id.next) {
- for(md=ob->modifiers.first; md; md=md->next) {
- if(md->type==eModifierType_Armature)
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type==eModifierType_Armature)
((ArmatureModifierData*)md)->deformflag |= ARM_DEF_B_BONE_REST;
}
}
@@ -10267,9 +10331,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 5)) {
/* foreground color needs to be something other then black */
Scene *sce;
- for(sce= main->scene.first; sce; sce=sce->id.next) {
+ for (sce= main->scene.first; sce; sce=sce->id.next) {
sce->r.fg_stamp[0] = sce->r.fg_stamp[1] = sce->r.fg_stamp[2] = 0.8f;
- sce->r.fg_stamp[3] = 1.0f; /* dont use text alpha yet */
+ sce->r.fg_stamp[3] = 1.0f; /* don't use text alpha yet */
sce->r.bg_stamp[3] = 0.25f; /* make sure the background has full alpha */
}
}
@@ -10278,7 +10342,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 6)) {
Scene *sce;
/* fix frs_sec_base */
- for(sce= main->scene.first; sce; sce= sce->id.next) {
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
if (sce->r.frs_sec_base == 0) {
sce->r.frs_sec_base = 1;
}
@@ -10352,12 +10416,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if(ob->soft && ob->soft->keys) {
+ if (ob->soft && ob->soft->keys) {
SoftBody *sb = ob->soft;
int k;
- for(k=0; k<sb->totkey; k++) {
- if(sb->keys[k])
+ for (k=0; k<sb->totkey; k++) {
+ if (sb->keys[k])
MEM_freeN(sb->keys[k]);
}
@@ -10374,13 +10438,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Object *ob;
PartEff *paf=NULL;
- for(ob = main->object.first; ob; ob= ob->id.next) {
- if(ob->soft && ob->soft->keys) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ if (ob->soft && ob->soft->keys) {
SoftBody *sb = ob->soft;
int k;
- for(k=0; k<sb->totkey; k++) {
- if(sb->keys[k])
+ for (k=0; k<sb->totkey; k++) {
+ if (sb->keys[k])
MEM_freeN(sb->keys[k]);
}
@@ -10391,7 +10455,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* convert old particles to new system */
- if((paf = do_version_give_parteff_245(ob))) {
+ if ((paf = do_version_give_parteff_245(ob))) {
ParticleSystem *psys;
ModifierData *md;
ParticleSystemModifierData *psmd;
@@ -10446,8 +10510,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
copy_v3_v3(part->acc, paf->force);
/* flags */
- if(paf->stype & PAF_VECT) {
- if(paf->flag & PAF_STATIC) {
+ if (paf->stype & PAF_VECT) {
+ if (paf->flag & PAF_STATIC) {
/* new hair lifetime is always 100.0f */
float fac = paf->lifetime / 100.0f;
@@ -10480,11 +10544,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
psys->vgroup[PSYS_VG_LENGTH] = paf->vertgroup_v;
/* dupliobjects */
- if(ob->transflag & OB_DUPLIVERTS) {
+ if (ob->transflag & OB_DUPLIVERTS) {
Object *dup = main->object.first;
- for(; dup; dup= dup->id.next) {
- if(ob == newlibadr(fd, lib, dup->parent)) {
+ for (; dup; dup= dup->id.next) {
+ if (ob == newlibadr(fd, lib, dup->parent)) {
part->dup_ob = dup;
ob->transflag |= OB_DUPLIPARTS;
ob->transflag &= ~OB_DUPLIVERTS;
@@ -10500,7 +10564,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
- if(fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE)
+ if (fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE)
part->type = PART_FLUID;
}
@@ -10510,18 +10574,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- for(sce= main->scene.first; sce; sce=sce->id.next) {
+ for (sce= main->scene.first; sce; sce=sce->id.next) {
ParticleEditSettings *pset= &sce->toolsettings->particle;
int a;
- if(pset->brush[0].size == 0) {
+ if (pset->brush[0].size == 0) {
pset->flag= PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER;
pset->emitterdist= 0.25f;
pset->totrekey= 5;
pset->totaddkey= 5;
pset->brushtype= PE_BRUSH_NONE;
- for(a=0; a<PE_TOT_BRUSH; a++) {
+ for (a=0; a<PE_TOT_BRUSH; a++) {
pset->brush[a].strength= 50;
pset->brush[a].size= 50;
pset->brush[a].step= 10;
@@ -10535,10 +10599,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Material *ma;
int a;
- for(ma=main->mat.first; ma; ma= ma->id.next)
- if(ma->mode & MA_NORMAP_TANG)
- for(a=0; a<MAX_MTEX; a++)
- if(ma->mtex[a] && ma->mtex[a]->tex)
+ for (ma=main->mat.first; ma; ma= ma->id.next)
+ if (ma->mode & MA_NORMAP_TANG)
+ for (a=0; a<MAX_MTEX; a++)
+ if (ma->mtex[a] && ma->mtex[a]->tex)
ma->mtex[a]->normapspace = MTEX_NSPACE_TANGENT;
}
@@ -10546,7 +10610,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Object *ob;
/* dupliface scale */
- for(ob= main->object.first; ob; ob= ob->id.next)
+ for (ob= main->object.first; ob; ob= ob->id.next)
ob->dupfacesca = 1.0f;
}
@@ -10571,7 +10635,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
strip->scale = length / (repeat * actlength);
if (strip->scale == 0.0f) strip->scale= 1.0f;
}
- if(ob->soft){
+ if (ob->soft) {
ob->soft->inpush = ob->soft->inspring;
ob->soft->shearstiff = 1.0f;
}
@@ -10582,7 +10646,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Scene *sce;
Sequence *seq;
- for(sce=main->scene.first; sce; sce=sce->id.next) {
+ for (sce=main->scene.first; sce; sce=sce->id.next) {
SEQ_BEGIN(sce->ed, seq) {
if (seq->blend_mode == 0)
seq->blend_opacity = 100.0f;
@@ -10622,13 +10686,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* sun/sky */
- if(main->versionfile < 246) {
+ if (main->versionfile < 246) {
Object *ob;
bActuator *act;
/* dRot actuator change direction in 2.46 */
- for(ob = main->object.first; ob; ob= ob->id.next) {
- for(act= ob->actuators.first; act; act= act->next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (act= ob->actuators.first; act; act= act->next) {
if (act->type == ACT_OBJECT) {
bObjectActuator *ba= act->data;
@@ -10641,12 +10705,12 @@ 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)
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ if (ob->fluidsimSettings)
{
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifier_new(eModifierType_Fluidsim);
BLI_addhead(&ob->modifiers, (ModifierData *)fluidmd);
@@ -10664,32 +10728,32 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
- if(main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
+ if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
Mesh *me;
- for(me=main->mesh.first; me; me= me->id.next)
+ for (me=main->mesh.first; me; me= me->id.next)
alphasort_version_246(fd, lib, me);
}
- 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->pd && (ob->pd->forcefield == PFIELD_WIND))
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ if (ob->pd && (ob->pd->forcefield == PFIELD_WIND))
ob->pd->f_noise = 0.0f;
}
}
- if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 2)){
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 2)) {
Object *ob;
- for(ob = main->object.first; ob; ob= ob->id.next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
ob->gameflag |= OB_COLLISION;
ob->margin = 0.06f;
}
}
- if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)){
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)) {
Object *ob;
- for(ob = main->object.first; ob; ob= ob->id.next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
// Starting from subversion 3, ACTOR is a separate feature.
// Before it was conditioning all the other dynamic flags
if (!(ob->gameflag & OB_ACTOR))
@@ -10700,7 +10764,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 5)) {
Lamp *la= main->lamp.first;
- for(; la; la= la->id.next) {
+ for (; la; la= la->id.next) {
la->skyblendtype= MA_RAMP_ADD;
la->skyblendfac= 1.0f;
}
@@ -10711,8 +10775,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Curve *cu;
Nurb *nu;
- for(cu= main->curve.first; cu; cu= cu->id.next) {
- for(nu= cu->nurb.first; nu; nu= nu->next) {
+ for (cu= main->curve.first; cu; cu= cu->id.next) {
+ for (nu= cu->nurb.first; nu; nu= nu->next) {
if (nu) {
nu->radius_interp = 3;
@@ -10733,8 +10797,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bActuator *act;
Object *ob;
- for(ob = main->object.first; ob; ob= ob->id.next) {
- for(act= ob->actuators.first; act; act= act->next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (act= ob->actuators.first; act; act= act->next) {
if (act->type == ACT_CONSTRAINT) {
bConstraintActuator *coa = act->data;
if (coa->type == ACT_CONST_TYPE_DIST) {
@@ -10747,7 +10811,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 9)) {
Lamp *la= main->lamp.first;
- for(; la; la= la->id.next) {
+ for (; la; la= la->id.next) {
la->sky_exposure= 1.0f;
}
}
@@ -10757,14 +10821,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bActuator *act;
Object *ob;
- for(ob = main->object.first; ob; ob= ob->id.next) {
- for(act= ob->actuators.first; act; act= act->next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (act= ob->actuators.first; act; act= act->next) {
if (act->type == ACT_MESSAGE) {
bMessageActuator *msgAct = (bMessageActuator *) act->data;
if (BLI_strnlen(msgAct->toPropName, 3) > 2) {
/* strip first 2 chars, would have only worked if these were OB anyway */
- memmove( msgAct->toPropName, msgAct->toPropName+2, sizeof(msgAct->toPropName)-2 );
- } else {
+ memmove(msgAct->toPropName, msgAct->toPropName + 2, sizeof(msgAct->toPropName) - 2);
+ }
+ else {
msgAct->toPropName[0] = '\0';
}
}
@@ -10775,8 +10840,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (main->versionfile < 248) {
Lamp *la;
- for(la=main->lamp.first; la; la= la->id.next) {
- if(la->atm_turbidity == 0.0f) {
+ for (la=main->lamp.first; la; la= la->id.next) {
+ if (la->atm_turbidity == 0.0f) {
la->sun_effect_type = 0;
la->horizon_brightness = 1.0f;
la->spread = 1.0f;
@@ -10868,7 +10933,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Object *ob;
/* Adjustments needed after Bullets update */
- for(ob = main->object.first; ob; ob= ob->id.next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
ob->damping *= 0.635f;
ob->rdamping = 0.1f + (0.8f * ob->rdamping);
}
@@ -10887,7 +10952,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
sce->r.dometilt = 0;
}
/* DBVT culling by default */
- for(wrld=main->world.first; wrld; wrld= wrld->id.next) {
+ for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
wrld->mode |= WO_DBVT_CULLING;
wrld->occlusionRes = 128;
}
@@ -10896,22 +10961,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 5)) {
Object *ob;
World *wrld;
- for(ob = main->object.first; ob; ob= ob->id.next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
ob->m_contactProcessingThreshold = 1.; //pad3 is used for m_contactProcessingThreshold
- if(ob->parent) {
+ if (ob->parent) {
/* check if top parent has compound shape set and if yes, set this object
to compound shaper as well (was the behavior before, now it's optional) */
Object *parent= newlibadr(fd, lib, ob->parent);
while (parent && parent != ob && parent->parent != NULL) {
parent = newlibadr(fd, lib, parent->parent);
}
- if(parent) {
+ if (parent) {
if (parent->gameflag & OB_CHILD)
ob->gameflag |= OB_CHILD;
}
}
}
- for(wrld=main->world.first; wrld; wrld= wrld->id.next) {
+ for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
wrld->ticrate = 60;
wrld->maxlogicstep = 5;
wrld->physubstep = 1;
@@ -10922,8 +10987,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
// correct introduce of seed for wind force
if (main->versionfile < 249 && main->subversionfile < 1) {
Object *ob;
- for(ob = main->object.first; ob; ob= ob->id.next) {
- if(ob->pd)
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ if (ob->pd)
ob->pd->seed = ((unsigned int)(ceil(PIL_check_seconds_timer()))+1) % 128;
}
@@ -10934,11 +10999,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Sequence *seq;
Editing *ed;
- while(sce) {
+ while (sce) {
ed= sce->ed;
- if(ed) {
+ if (ed) {
SEQP_BEGIN(ed, seq) {
- if (seq->strip && seq->strip->proxy){
+ if (seq->strip && seq->strip->proxy) {
seq->strip->proxy->quality =90;
}
}
@@ -10970,20 +11035,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bActuator *act;
int a;
- for(sound = main->sound.first; sound; sound = sound->id.next)
+ for (sound = main->sound.first; sound; sound = sound->id.next)
{
- if(sound->newpackedfile)
+ if (sound->newpackedfile)
{
sound->packedfile = sound->newpackedfile;
sound->newpackedfile = NULL;
}
}
- for(ob = main->object.first; ob; ob= ob->id.next) {
- for(act= ob->actuators.first; act; act= act->next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ 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;
@@ -11007,12 +11072,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- for(scene = main->scene.first; scene; scene = scene->id.next)
+ for (scene = main->scene.first; scene; scene = scene->id.next)
{
- if(scene->ed && scene->ed->seqbasep)
+ if (scene->ed && scene->ed->seqbasep)
{
SEQ_BEGIN(scene->ed, seq) {
- if(seq->type == SEQ_HD_SOUND)
+ if (seq->type == SEQ_HD_SOUND)
{
char str[FILE_MAX];
BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name);
@@ -11022,7 +11087,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* don't know, if anybody used that
this way, but just in case, upgrade
to new way... */
- if((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) &&
+ if ((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) &&
!(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR))
{
@@ -11035,7 +11100,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- for(screen= main->screen.first; screen; screen= screen->id.next) {
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
do_versions_windowmanager_2_50(screen);
do_versions_gpencil_2_50(main, screen);
}
@@ -11043,30 +11108,30 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* shader, composite and texture node trees have id.name empty, put something in
* to have them show in RNA viewer and accessible otherwise.
*/
- for(ma= main->mat.first; ma; ma= ma->id.next) {
- if(ma->nodetree && ma->nodetree->id.name[0] == '\0')
+ for (ma= main->mat.first; ma; ma= ma->id.next) {
+ if (ma->nodetree && ma->nodetree->id.name[0] == '\0')
strcpy(ma->nodetree->id.name, "NTShader Nodetree");
/* which_output 0 is now "not specified" */
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a]) {
tx= newlibadr(fd, lib, ma->mtex[a]->tex);
- if(tx && tx->use_nodes)
+ if (tx && tx->use_nodes)
ma->mtex[a]->which_output++;
}
}
}
/* and composite trees */
- for(sce= main->scene.first; sce; sce= sce->id.next) {
- if(sce->nodetree && sce->nodetree->id.name[0] == '\0')
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->nodetree && sce->nodetree->id.name[0] == '\0')
strcpy(sce->nodetree->id.name, "NTCompositing Nodetree");
/* move to cameras */
- if(sce->r.mode & R_PANORAMA) {
- for(base=sce->base.first; base; base=base->next) {
+ if (sce->r.mode & R_PANORAMA) {
+ for (base=sce->base.first; base; base=base->next) {
ob= newlibadr(fd, lib, base->object);
- if(ob->type == OB_CAMERA && !ob->id.lib) {
+ if (ob->type == OB_CAMERA && !ob->id.lib) {
cam= newlibadr(fd, lib, ob->data);
cam->flag |= CAM_PANORAMA;
}
@@ -11076,33 +11141,33 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
/* and texture trees */
- for(tx= main->tex.first; tx; tx= tx->id.next) {
+ for (tx= main->tex.first; tx; tx= tx->id.next) {
bNode *node;
- if(tx->nodetree) {
- if(tx->nodetree->id.name[0] == '\0')
+ if (tx->nodetree) {
+ if (tx->nodetree->id.name[0] == '\0')
strcpy(tx->nodetree->id.name, "NTTexture Nodetree");
/* which_output 0 is now "not specified" */
- for(node=tx->nodetree->nodes.first; node; node=node->next)
- if(node->type == TEX_NODE_OUTPUT)
+ for (node=tx->nodetree->nodes.first; node; node=node->next)
+ if (node->type == TEX_NODE_OUTPUT)
node->custom1++;
}
}
/* copy standard draw flag to meshes(used to be global, is not available here) */
- for(me= main->mesh.first; me; me= me->id.next) {
+ for (me= main->mesh.first; me; me= me->id.next) {
me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
}
/* particle draw and render types */
- for(part= main->particle.first; part; part= part->id.next) {
- if(part->draw_as) {
- if(part->draw_as == PART_DRAW_DOT) {
+ for (part= main->particle.first; part; part= part->id.next) {
+ if (part->draw_as) {
+ if (part->draw_as == PART_DRAW_DOT) {
part->ren_as = PART_DRAW_HALO;
part->draw_as = PART_DRAW_REND;
}
- else if(part->draw_as <= PART_DRAW_AXIS) {
+ else if (part->draw_as <= PART_DRAW_AXIS) {
part->ren_as = PART_DRAW_HALO;
}
else {
@@ -11114,21 +11179,21 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
part->clength = 1.0f;
}
/* set old pointcaches to have disk cache flag */
- for(ob = main->object.first; ob; ob= ob->id.next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
//BKE_ptcache_ids_from_object(&pidlist, ob);
- //for(pid=pidlist.first; pid; pid=pid->next)
+ //for (pid=pidlist.first; pid; pid=pid->next)
// pid->cache->flag |= PTCACHE_DISK_CACHE;
//BLI_freelistN(&pidlist);
}
/* type was a mixed flag & enum. move the 2d flag elsewhere */
- for(cu = main->curve.first; cu; cu= cu->id.next) {
+ for (cu = main->curve.first; cu; cu= cu->id.next) {
Nurb *nu;
- for(nu= cu->nurb.first; nu; nu= nu->next) {
+ for (nu= cu->nurb.first; nu; nu= nu->next) {
nu->flag |= (nu->type & CU_2D);
nu->type &= CU_TYPE;
}
@@ -11144,57 +11209,57 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
//PTCacheID *pid;
//ListBase pidlist;
- for(ob = main->object.first; ob; ob = ob->id.next) {
+ for (ob = main->object.first; ob; ob = ob->id.next) {
//BKE_ptcache_ids_from_object(&pidlist, ob);
- //for(pid=pidlist.first; pid; pid=pid->next) {
- // if(pid->ptcaches->first == NULL)
+ //for (pid=pidlist.first; pid; pid=pid->next) {
+ // if (pid->ptcaches->first == NULL)
// pid->ptcaches->first = pid->ptcaches->last = pid->cache;
//}
//BLI_freelistN(&pidlist);
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
Mesh *me = newlibadr(fd, lib, ob->data);
void *olddata = ob->data;
ob->data = me;
/* XXX - library meshes crash on loading most yoFrankie levels,
* the multires pointer gets invalid - Campbell */
- if(me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) {
+ if (me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) {
multires_load_old(ob, me);
}
ob->data = olddata;
}
- if(ob->totcol && ob->matbits == NULL) {
+ if (ob->totcol && ob->matbits == NULL) {
int a;
ob->matbits= MEM_callocN(sizeof(char)*ob->totcol, "ob->matbits");
- for(a=0; a<ob->totcol; a++)
+ for (a=0; a<ob->totcol; a++)
ob->matbits[a]= ob->colbits & (1<<a);
}
}
/* texture filter */
- for(tex = main->tex.first; tex; tex = tex->id.next) {
- if(tex->afmax == 0)
+ for (tex = main->tex.first; tex; tex = tex->id.next) {
+ if (tex->afmax == 0)
tex->afmax= 8;
}
- for(ma = main->mat.first; ma; ma = ma->id.next) {
+ for (ma = main->mat.first; ma; ma = ma->id.next) {
int a;
- if(ma->mode & MA_WIRE) {
+ if (ma->mode & MA_WIRE) {
ma->material_type= MA_TYPE_WIRE;
ma->mode &= ~MA_WIRE;
}
- if(ma->mode & MA_HALO) {
+ if (ma->mode & MA_HALO) {
ma->material_type= MA_TYPE_HALO;
ma->mode &= ~MA_HALO;
}
- if(ma->mode & (MA_ZTRANSP|MA_RAYTRANSP)) {
+ if (ma->mode & (MA_ZTRANSP|MA_RAYTRANSP)) {
ma->mode |= MA_TRANSP;
}
else {
@@ -11203,15 +11268,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* set new bump for unused slots */
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a]) {
tex= ma->mtex[a]->tex;
- if(!tex) {
+ if (!tex) {
ma->mtex[a]->texflag |= MTEX_3TAP_BUMP;
ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE;
- } else {
+ }
+ else {
tex= (Tex*)newlibadr(fd, ma->id.lib, tex);
- if(tex && tex->type == 0) { /* invalid type */
+ if (tex && tex->type == 0) { /* invalid type */
ma->mtex[a]->texflag |= MTEX_3TAP_BUMP;
ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE;
}
@@ -11235,9 +11301,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- for(sce = main->scene.first; sce; sce = sce->id.next) {
+ for (sce = main->scene.first; sce; sce = sce->id.next) {
ts= sce->toolsettings;
- if(ts->normalsize == 0.0f || !ts->uv_selectmode || ts->vgroup_weight == 0.0f) {
+ if (ts->normalsize == 0.0f || !ts->uv_selectmode || ts->vgroup_weight == 0.0f) {
ts->normalsize= 0.1f;
ts->selectmode= SCE_SELECT_VERTEX;
@@ -11272,11 +11338,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
//Stereo
sce->gm.stereomode = sce->r.stereomode;
/* reassigning stereomode NO_STEREO and DOME to a separeted flag*/
- if (sce->gm.stereomode == 1){ //1 = STEREO_NOSTEREO
+ if (sce->gm.stereomode == 1) { //1 = STEREO_NOSTEREO
sce->gm.stereoflag = STEREO_NOSTEREO;
sce->gm.stereomode = STEREO_ANAGLYPH;
}
- else if(sce->gm.stereomode == 8){ //8 = STEREO_DOME
+ else if (sce->gm.stereomode == 8) { //8 = STEREO_DOME
sce->gm.stereoflag = STEREO_DOME;
sce->gm.stereomode = STEREO_ANAGLYPH;
}
@@ -11306,31 +11372,31 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Scene *sce;
Object *ob;
- for(sce = main->scene.first; sce; sce = sce->id.next) {
- if(fd->fileflags & G_FILE_ENABLE_ALL_FRAMES)
+ for (sce = main->scene.first; sce; sce = sce->id.next) {
+ if (fd->fileflags & G_FILE_ENABLE_ALL_FRAMES)
sce->gm.flag |= GAME_ENABLE_ALL_FRAMES;
- if(fd->fileflags & G_FILE_SHOW_DEBUG_PROPS)
+ if (fd->fileflags & G_FILE_SHOW_DEBUG_PROPS)
sce->gm.flag |= GAME_SHOW_DEBUG_PROPS;
- if(fd->fileflags & G_FILE_SHOW_FRAMERATE)
+ if (fd->fileflags & G_FILE_SHOW_FRAMERATE)
sce->gm.flag |= GAME_SHOW_FRAMERATE;
- if(fd->fileflags & G_FILE_SHOW_PHYSICS)
+ if (fd->fileflags & G_FILE_SHOW_PHYSICS)
sce->gm.flag |= GAME_SHOW_PHYSICS;
- if(fd->fileflags & G_FILE_GLSL_NO_SHADOWS)
+ if (fd->fileflags & G_FILE_GLSL_NO_SHADOWS)
sce->gm.flag |= GAME_GLSL_NO_SHADOWS;
- if(fd->fileflags & G_FILE_GLSL_NO_SHADERS)
+ if (fd->fileflags & G_FILE_GLSL_NO_SHADERS)
sce->gm.flag |= GAME_GLSL_NO_SHADERS;
- if(fd->fileflags & G_FILE_GLSL_NO_RAMPS)
+ if (fd->fileflags & G_FILE_GLSL_NO_RAMPS)
sce->gm.flag |= GAME_GLSL_NO_RAMPS;
- if(fd->fileflags & G_FILE_GLSL_NO_NODES)
+ if (fd->fileflags & G_FILE_GLSL_NO_NODES)
sce->gm.flag |= GAME_GLSL_NO_NODES;
- if(fd->fileflags & G_FILE_GLSL_NO_EXTRA_TEX)
+ if (fd->fileflags & G_FILE_GLSL_NO_EXTRA_TEX)
sce->gm.flag |= GAME_GLSL_NO_EXTRA_TEX;
- if(fd->fileflags & G_FILE_IGNORE_DEPRECATION_WARNINGS)
+ if (fd->fileflags & G_FILE_IGNORE_DEPRECATION_WARNINGS)
sce->gm.flag |= GAME_IGNORE_DEPRECATION_WARNINGS;
- if(fd->fileflags & G_FILE_GAME_MAT_GLSL)
+ if (fd->fileflags & G_FILE_GAME_MAT_GLSL)
sce->gm.matmode= GAME_MAT_GLSL;
- else if(fd->fileflags & G_FILE_GAME_MAT)
+ else if (fd->fileflags & G_FILE_GAME_MAT)
sce->gm.matmode= GAME_MAT_MULTITEX;
else
sce->gm.matmode= GAME_MAT_TEXFACE;
@@ -11338,8 +11404,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
sce->gm.flag |= GAME_DISPLAY_LISTS;
}
- for(ob = main->object.first; ob; ob = ob->id.next) {
- if(ob->flag & 8192) // OB_POSEMODE = 8192
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ if (ob->flag & 8192) // OB_POSEMODE = 8192
ob->mode |= OB_MODE_POSE;
}
}
@@ -11354,11 +11420,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ParticleSettings *part;
int do_gravity = 0;
- for(sce = main->scene.first; sce; sce = sce->id.next)
- if(sce->unit.scale_length == 0.0f)
+ for (sce = main->scene.first; sce; sce = sce->id.next)
+ if (sce->unit.scale_length == 0.0f)
sce->unit.scale_length= 1.0f;
- for(ob = main->object.first; ob; ob = ob->id.next) {
+ for (ob = main->object.first; ob; ob = ob->id.next) {
/* fluid-sim stuff */
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
if (fluidmd) fluidmd->fss->fmd = fluidmd;
@@ -11367,8 +11433,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ob->rotmode= ROT_MODE_EUL;
}
- for(ma = main->mat.first; ma; ma=ma->id.next) {
- if(ma->vol.reflection == 0.f) {
+ for (ma = main->mat.first; ma; ma=ma->id.next) {
+ if (ma->vol.reflection == 0.f) {
ma->vol.reflection = 1.f;
ma->vol.transmission_col[0] = ma->vol.transmission_col[1] = ma->vol.transmission_col[2] = 1.0f;
ma->vol.reflection_col[0] = ma->vol.reflection_col[1] = ma->vol.reflection_col[2] = 1.0f;
@@ -11377,20 +11443,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
do_version_mtex_factor_2_50(ma->mtex, ID_MA);
}
- for(la = main->lamp.first; la; la=la->id.next)
+ for (la = main->lamp.first; la; la=la->id.next)
do_version_mtex_factor_2_50(la->mtex, ID_LA);
- for(wo = main->world.first; wo; wo=wo->id.next)
+ for (wo = main->world.first; wo; wo=wo->id.next)
do_version_mtex_factor_2_50(wo->mtex, ID_WO);
- for(tex = main->tex.first; tex; tex=tex->id.next)
- if(tex->vd)
- if(tex->vd->extend == 0)
+ for (tex = main->tex.first; tex; tex=tex->id.next)
+ if (tex->vd)
+ 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)
+ if (sce->audio.main == 0.0f)
sce->audio.main = 1.0f;
sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate;
@@ -11401,8 +11467,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* Add default gravity to scenes */
- for(sce= main->scene.first; sce; sce= sce->id.next) {
- if((sce->physics_settings.flag & PHYS_GLOBAL_GRAVITY) == 0
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if ((sce->physics_settings.flag & PHYS_GLOBAL_GRAVITY) == 0
&& len_v3(sce->physics_settings.gravity) == 0.0f) {
sce->physics_settings.gravity[0] = sce->physics_settings.gravity[1] = 0.0f;
@@ -11413,31 +11479,31 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* Assign proper global gravity weights for dynamics (only z-coordinate is taken into account) */
- if(do_gravity) for(part= main->particle.first; part; part= part->id.next)
+ if (do_gravity) for (part= main->particle.first; part; part= part->id.next)
part->effector_weights->global_gravity = part->acc[2]/-9.81f;
- for(ob = main->object.first; ob; ob = ob->id.next) {
+ for (ob = main->object.first; ob; ob = ob->id.next) {
ModifierData *md;
- if(do_gravity) {
- for(md= ob->modifiers.first; md; md= md->next) {
+ if (do_gravity) {
+ for (md= ob->modifiers.first; md; md= md->next) {
ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
- if(clmd)
+ if (clmd)
clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2]/-9.81f;
}
- if(ob->soft)
+ if (ob->soft)
ob->soft->effector_weights->global_gravity = ob->soft->grav/9.81f;
}
/* Normal wind shape is plane */
- if(ob->pd) {
- if(ob->pd->forcefield == PFIELD_WIND)
+ if (ob->pd) {
+ if (ob->pd->forcefield == PFIELD_WIND)
ob->pd->shape = PFIELD_SHAPE_PLANE;
- if(ob->pd->flag & PFIELD_PLANAR)
+ if (ob->pd->flag & PFIELD_PLANAR)
ob->pd->shape = PFIELD_SHAPE_PLANE;
- else if(ob->pd->flag & PFIELD_SURFACE)
+ else if (ob->pd->flag & PFIELD_SURFACE)
ob->pd->shape = PFIELD_SHAPE_SURFACE;
ob->pd->flag |= PFIELD_DO_LOCATION;
@@ -11466,7 +11532,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- for(la = main->lamp.first; la; la=la->id.next)
+ for (la = main->lamp.first; la; la=la->id.next)
la->compressthresh= 0.05f;
}
@@ -11483,45 +11549,45 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
to the derivedmesh/displist, so here we ensure that the basis
shape key is always set in the mesh coordinates. */
- for(me= main->mesh.first; me; me= me->id.next) {
- if((key = newlibadr(fd, lib, me->key)) && key->refkey) {
+ for (me= main->mesh.first; me; me= me->id.next) {
+ if ((key = newlibadr(fd, lib, me->key)) && key->refkey) {
data= key->refkey->data;
tot= MIN2(me->totvert, key->refkey->totelem);
- for(a=0; a<tot; a++, data+=3)
+ for (a=0; a<tot; a++, data+=3)
copy_v3_v3(me->mvert[a].co, data);
}
}
- for(lt= main->latt.first; lt; lt= lt->id.next) {
- if((key = newlibadr(fd, lib, lt->key)) && key->refkey) {
+ for (lt= main->latt.first; lt; lt= lt->id.next) {
+ if ((key = newlibadr(fd, lib, lt->key)) && key->refkey) {
data= key->refkey->data;
tot= MIN2(lt->pntsu*lt->pntsv*lt->pntsw, key->refkey->totelem);
- for(a=0; a<tot; a++, data+=3)
+ for (a=0; a<tot; a++, data+=3)
copy_v3_v3(lt->def[a].vec, data);
}
}
- for(cu= main->curve.first; cu; cu= cu->id.next) {
- if((key = newlibadr(fd, lib, cu->key)) && key->refkey) {
+ for (cu= main->curve.first; cu; cu= cu->id.next) {
+ if ((key = newlibadr(fd, lib, cu->key)) && key->refkey) {
data= key->refkey->data;
- for(nu=cu->nurb.first; nu; nu=nu->next) {
- if(nu->bezt) {
+ for (nu=cu->nurb.first; nu; nu=nu->next) {
+ if (nu->bezt) {
BezTriple *bezt = nu->bezt;
- for(a=0; a<nu->pntsu; a++, bezt++) {
+ for (a=0; a<nu->pntsu; a++, bezt++) {
copy_v3_v3(bezt->vec[0], data); data+=3;
copy_v3_v3(bezt->vec[1], data); data+=3;
copy_v3_v3(bezt->vec[2], data); data+=3;
bezt->alfa= *data; data++;
}
}
- else if(nu->bp) {
+ else if (nu->bp) {
BPoint *bp = nu->bp;
- for(a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
+ for (a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
copy_v3_v3(bp->vec, data); data+=3;
bp->alfa= *data; data++;
}
@@ -11535,8 +11601,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
{
Scene *sce= main->scene.first;
- while(sce) {
- if(sce->r.frame_step==0)
+ while (sce) {
+ if (sce->r.frame_step==0)
sce->r.frame_step= 1;
if (sce->r.mblur_samples==0)
sce->r.mblur_samples = sce->r.osa;
@@ -11552,10 +11618,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* ensure all nodes have unique names */
bNodeTree *ntree= main->nodetree.first;
- while(ntree) {
+ while (ntree) {
bNode *node=ntree->nodes.first;
- while(node) {
+ while (node) {
nodeUniqueName(ntree, node);
node= node->next;
}
@@ -11577,10 +11643,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ScrArea *sa;
SpaceLink *sl;
- for(screen= main->screen.first; screen; screen= screen->id.next) {
- for(sa= screen->areabase.first; sa; sa= sa->next) {
- for(sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
if (v3d->drawtype == OB_MATERIAL) v3d->drawtype = OB_SOLID;
}
@@ -11604,13 +11670,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* don't know what scene is active, so we'll convert if any scene has it enabled... */
while (sce) {
- if(sce->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+ if (sce->r.color_mgt_flag & R_COLOR_MANAGEMENT)
convert=1;
sce=sce->id.next;
}
if (convert) {
- while(ma) {
+ while (ma) {
if (ma->ramp_col) {
ColorBand *band = (ColorBand *)ma->ramp_col;
for (i=0; i<band->tot; i++) {
@@ -11633,7 +11699,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ma=ma->id.next;
}
- while(tex) {
+ while (tex) {
if (tex->coba) {
ColorBand *band = (ColorBand *)tex->coba;
for (i=0; i<band->tot; i++) {
@@ -11644,7 +11710,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
tex=tex->id.next;
}
- while(wo) {
+ while (wo) {
srgb_to_linearrgb_v3_v3(&wo->ambr, &wo->ambr);
srgb_to_linearrgb_v3_v3(&wo->horr, &wo->horr);
srgb_to_linearrgb_v3_v3(&wo->zenr, &wo->zenr);
@@ -11660,18 +11726,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Mesh *me;
Object *ob;
- for(sce=main->scene.first; sce; sce=sce->id.next)
- if(!sce->toolsettings->particle.selectmode)
+ for (sce=main->scene.first; sce; sce=sce->id.next)
+ if (!sce->toolsettings->particle.selectmode)
sce->toolsettings->particle.selectmode= SCE_SELECT_PATH;
if (main->versionfile == 250 && main->subversionfile > 1) {
- for(me=main->mesh.first; me; me=me->id.next)
+ for (me=main->mesh.first; me; me=me->id.next)
multires_load_old_250(me);
- for(ob=main->object.first; ob; ob=ob->id.next) {
+ for (ob=main->object.first; ob; ob=ob->id.next) {
MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType(ob, eModifierType_Multires);
- if(mmd) {
+ if (mmd) {
mmd->totlvl--;
mmd->lvl--;
mmd->sculptlvl= mmd->lvl;
@@ -11686,9 +11752,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Object *ob;
/* properly initialize hair clothsim data on old files */
- for(ob = main->object.first; ob; ob = ob->id.next) {
+ for (ob = main->object.first; ob; ob = ob->id.next) {
ModifierData *md;
- for(md= ob->modifiers.first; md; md= md->next) {
+ for (md= ob->modifiers.first; md; md= md->next) {
if (md->type == eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData *)md;
if (clmd->sim_parms->velocity_smooth < 0.01f)
@@ -11708,21 +11774,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* remove all preview window in wrong spaces */
- for(screen= main->screen.first; screen; screen= screen->id.next) {
- for(sa= screen->areabase.first; sa; sa= sa->next) {
- for(sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype!=SPACE_SEQ) {
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype!=SPACE_SEQ) {
ARegion *ar;
ListBase *regionbase;
if (sl == sa->spacedata.first) {
regionbase = &sa->regionbase;
- } else {
+ }
+ else {
regionbase = &sl->regionbase;
}
- for( ar = regionbase->first; ar; ar = ar->next) {
+ for ( ar = regionbase->first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_PREVIEW)
break;
}
@@ -11747,10 +11814,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
SpaceLink *sl;
- for(screen= main->screen.first; screen; screen= screen->id.next) {
- for(sa= screen->areabase.first; sa; sa= sa->next) {
- for(sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_SEQ) {
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_SEQ) {
ARegion *ar;
ARegion *ar_main;
ListBase *regionbase;
@@ -11758,7 +11825,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (sl == sa->spacedata.first) {
regionbase = &sa->regionbase;
- } else {
+ }
+ else {
regionbase = &sl->regionbase;
}
@@ -11788,7 +11856,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Material *ma;
/* game engine changes */
- for(sce = main->scene.first; sce; sce = sce->id.next) {
+ for (sce = main->scene.first; sce; sce = sce->id.next) {
sce->gm.eyeseparation = 0.10f;
}
@@ -11802,7 +11870,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
*/
if (ob->pose && ob->data) {
bArmature *arm= newlibadr(fd, lib, ob->data);
- if(arm) { /* XXX - why does this fail in some cases? */
+ if (arm) { /* XXX - why does this fail in some cases? */
bAnimVizSettings *avs= &ob->pose->avs;
/* ghosting settings ---------------- */
@@ -11927,8 +11995,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) {
for (ar = (ARegion*)regionbase->first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) {
- ar->v2d.cur.ymax= ar->v2d.tot.ymax= 0.0f;
- ar->v2d.cur.ymin= ar->v2d.tot.ymin= (float)(-sa->winy) / 3.0f;
+ ar->v2d.cur.ymax = ar->v2d.tot.ymax = 0.0f;
+ ar->v2d.cur.ymin = ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
}
}
}
@@ -11942,22 +12010,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Material *ma;
/* ambient default from 0.5f to 1.0f */
- for(ma= main->mat.first; ma; ma=ma->id.next)
+ for (ma= main->mat.first; ma; ma=ma->id.next)
ma->amb *= 2.0f;
- for(wo= main->world.first; wo; wo=wo->id.next) {
+ for (wo= main->world.first; wo; wo=wo->id.next) {
/* ao splitting into ao/env/indirect */
wo->ao_env_energy= wo->aoenergy;
wo->aoenergy= 1.0f;
- if(wo->ao_indirect_bounces == 0)
+ if (wo->ao_indirect_bounces == 0)
wo->ao_indirect_bounces= 1;
else
wo->mode |= WO_INDIRECT_LIGHT;
- if(wo->aomix == WO_AOSUB)
+ if (wo->aomix == WO_AOSUB)
wo->ao_env_energy= -wo->ao_env_energy;
- else if(wo->aomix == WO_AOADDSUB)
+ else if (wo->aomix == WO_AOADDSUB)
wo->mode |= WO_AMB_OCC;
wo->aomix= WO_AOMUL;
@@ -11974,16 +12042,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Material *ma;
/* initialize to sane default so toggling on border shows something */
- for(sce = main->scene.first; sce; sce = sce->id.next) {
- if(sce->r.border.xmin == 0.0f && sce->r.border.ymin == 0.0f &&
+ for (sce = main->scene.first; sce; sce = sce->id.next) {
+ if (sce->r.border.xmin == 0.0f && sce->r.border.ymin == 0.0f &&
sce->r.border.xmax == 0.0f && sce->r.border.ymax == 0.0f) {
- sce->r.border.xmin= 0.0f;
- sce->r.border.ymin= 0.0f;
- sce->r.border.xmax= 1.0f;
- sce->r.border.ymax= 1.0f;
+ sce->r.border.xmin = 0.0f;
+ sce->r.border.ymin = 0.0f;
+ sce->r.border.xmax = 1.0f;
+ sce->r.border.ymax = 1.0f;
}
- if((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0)
+ if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0)
sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE
SEQ_BEGIN(sce->ed, seq) {
@@ -11993,16 +12061,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* particle brush strength factor was changed from int to float */
- for(sce= main->scene.first; sce; sce=sce->id.next) {
+ for (sce= main->scene.first; sce; sce=sce->id.next) {
ParticleEditSettings *pset= &sce->toolsettings->particle;
int a;
- for(a=0; a<PE_TOT_BRUSH; a++)
+ for (a=0; a<PE_TOT_BRUSH; a++)
pset->brush[a].strength /= 100.0f;
}
- for(ma = main->mat.first; ma; ma=ma->id.next)
- if(ma->mode & MA_TRACEBLE)
+ for (ma = main->mat.first; ma; ma=ma->id.next)
+ if (ma->mode & MA_TRACEBLE)
ma->shade_flag |= MA_APPROX_OCCLUSION;
/* sequencer changes */
@@ -12011,16 +12079,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ScrArea *sa;
SpaceLink *sl;
- for(screen= main->screen.first; screen; screen= screen->id.next) {
- for(sa= screen->areabase.first; sa; sa= sa->next) {
- for(sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_SEQ) {
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_SEQ) {
ARegion *ar_preview;
ListBase *regionbase;
if (sl == sa->spacedata.first) {
regionbase = &sa->regionbase;
- } else {
+ }
+ else {
regionbase = &sl->regionbase;
}
@@ -12046,12 +12115,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
* This bit was used in the past for V3D_TRANSFORM_SNAP, which is now deprecated.
* Here we clear it for old files so they don't come in with V3D_RENDER_OVERRIDE set,
* which would cause cameras, lamps, etc to become invisible */
- for(sc= main->screen.first; sc; sc= sc->id.next) {
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
ScrArea *sa;
- for(sa= sc->areabase.first; sa; sa= sa->next) {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D* v3d = (View3D *)sl;
v3d->flag2 &= ~V3D_RENDER_OVERRIDE;
}
@@ -12071,9 +12140,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* properly initialize active flag for fluidsim modifiers */
- for(ob = main->object.first; ob; ob = ob->id.next) {
+ for (ob = main->object.first; ob; ob = ob->id.next) {
ModifierData *md;
- for(md= ob->modifiers.first; md; md= md->next) {
+ for (md= ob->modifiers.first; md; md= md->next) {
if (md->type == eModifierType_Fluidsim) {
FluidsimModifierData *fmd = (FluidsimModifierData *)md;
fmd->fss->flag |= OB_FLUIDSIM_ACTIVE;
@@ -12083,11 +12152,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* adjustment to color balance node values */
- for(scene= main->scene.first; scene; scene= scene->id.next) {
- if(scene->nodetree) {
+ for (scene= main->scene.first; scene; scene= scene->id.next) {
+ if (scene->nodetree) {
bNode *node=scene->nodetree->nodes.first;
- while(node) {
+ while (node) {
if (node->type == CMP_NODE_COLORBALANCE) {
NodeColorBalance *n= (NodeColorBalance *)node->storage;
n->lift[0] += 1.f;
@@ -12102,7 +12171,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (ntree= main->nodetree.first; ntree; ntree=ntree->id.next) {
bNode *node=ntree->nodes.first;
- while(node) {
+ while (node) {
if (node->type == CMP_NODE_COLORBALANCE) {
NodeColorBalance *n= (NodeColorBalance *)node->storage;
n->lift[0] += 1.f;
@@ -12126,12 +12195,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bScreen *sc;
/* Image editor scopes */
- for(sc= main->screen.first; sc; sc= sc->id.next) {
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
ScrArea *sa;
- for(sa= sc->areabase.first; sa; sa= sa->next) {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_IMAGE) {
+ if (sl->spacetype==SPACE_IMAGE) {
SpaceImage *sima = (SpaceImage *)sl;
scopes_new(&sima->scopes);
}
@@ -12193,11 +12262,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
do_version_mdef_250(main);
/* parent type to modifier */
- for(ob = main->object.first; ob; ob = ob->id.next) {
- if(ob->parent) {
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ if (ob->parent) {
Object *parent= (Object *)newlibadr(fd, lib, ob->parent);
- if(parent) { /* parent may not be in group */
- if(parent->type==OB_ARMATURE && ob->partype==PARSKEL) {
+ if (parent) { /* parent may not be in group */
+ if (parent->type==OB_ARMATURE && ob->partype==PARSKEL) {
ArmatureModifierData *amd;
bArmature *arm= (bArmature *)newlibadr(fd, lib, parent->data);
@@ -12207,7 +12276,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
amd->deformflag= arm->deformflag;
ob->partype = PAROBJECT;
}
- else if(parent->type==OB_LATTICE && ob->partype==PARSKEL) {
+ else if (parent->type==OB_LATTICE && ob->partype==PARSKEL) {
LatticeModifierData *lmd;
lmd = (LatticeModifierData*) modifier_new(eModifierType_Lattice);
@@ -12215,7 +12284,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
BLI_addtail((ListBase*)&ob->modifiers, lmd);
ob->partype = PAROBJECT;
}
- else if(parent->type==OB_CURVE && ob->partype==PARCURVE) {
+ else if (parent->type==OB_CURVE && ob->partype==PARCURVE) {
CurveModifierData *cmd;
cmd = (CurveModifierData*) modifier_new(eModifierType_Curve);
@@ -12230,33 +12299,33 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* initialize scene active layer */
for (scene= main->scene.first; scene; scene=scene->id.next) {
int i;
- for(i=0; i<20; i++) {
- if(scene->lay & (1<<i)) {
+ for (i=0; i<20; i++) {
+ if (scene->lay & (1<<i)) {
scene->layact= 1<<i;
break;
}
}
}
- for(tex= main->tex.first; tex; tex= tex->id.next) {
+ for (tex= main->tex.first; tex; tex= tex->id.next) {
/* if youre picky, this isn't correct until we do a version bump
* since you could set saturation to be 0.0*/
- if(tex->saturation==0.0f)
+ if (tex->saturation==0.0f)
tex->saturation= 1.0f;
}
{
Curve *cu;
- for(cu= main->curve.first; cu; cu= cu->id.next) {
+ for (cu= main->curve.first; cu; cu= cu->id.next) {
cu->smallcaps_scale= 0.75f;
}
}
for (scene= main->scene.first; scene; scene=scene->id.next) {
- if(scene) {
+ if (scene) {
Sequence *seq;
SEQ_BEGIN(scene->ed, seq) {
- if(seq->sat==0.0f) {
+ if (seq->sat==0.0f) {
seq->sat= 1.0f;
}
}
@@ -12357,18 +12426,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
Object *ob;
- for(ob = main->object.first; ob; ob = ob->id.next) {
+ for (ob = main->object.first; ob; ob = ob->id.next) {
ModifierData *md;
- for(md= ob->modifiers.first; md; md= md->next) {
+ for (md= ob->modifiers.first; md; md= md->next) {
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;
- if(!(smd->domain->flags & (1<<4)))
+ if (!(smd->domain->flags & (1<<4)))
continue;
/* delete old MOD_SMOKE_INITVELOCITY flag */
@@ -12377,13 +12446,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* for now just add it to all flow objects in the scene */
{
Object *ob2;
- for(ob2 = main->object.first; ob2; ob2 = ob2->id.next) {
+ for (ob2 = main->object.first; ob2; ob2 = ob2->id.next) {
ModifierData *md2;
- for(md2= ob2->modifiers.first; md2; md2= md2->next) {
+ for (md2= ob2->modifiers.first; md2; md2= md2->next) {
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;
}
@@ -12408,13 +12477,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bScreen *sc;
Object *ob;
- for(br= main->brush.first; br; br= br->id.next) {
- if(br->ob_mode==0)
+ for (br= main->brush.first; br; br= br->id.next) {
+ if (br->ob_mode==0)
br->ob_mode= OB_MODE_ALL_PAINT;
}
- for(part = main->particle.first; part; part = part->id.next) {
- if(part->boids)
+ for (part = main->particle.first; part; part = part->id.next) {
+ if (part->boids)
part->boids->pitch = 1.0f;
part->flag &= ~PART_HAIR_REGROW; /* this was a deprecated flag before */
@@ -12449,9 +12518,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* fix rotation actuators for objects so they use real angles (radians)
* since before blender went opensource this strange scalar was used: (1 / 0.02) * 2 * math.pi/360 */
- for(ob= main->object.first; ob; ob= ob->id.next) {
+ for (ob= main->object.first; ob; ob= ob->id.next) {
bActuator *act= ob->actuators.first;
- while(act) {
+ while (act) {
if (act->type==ACT_OBJECT) {
/* multiply velocity with 50 in old files */
bObjectActuator *oa= act->data;
@@ -12465,10 +12534,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
// init facing axis property of steering actuators
{
Object *ob;
- for(ob = main->object.first; ob; ob = ob->id.next) {
+ for (ob = main->object.first; ob; ob = ob->id.next) {
bActuator *act;
- for(act= ob->actuators.first; act; act= act->next) {
- if(act->type==ACT_STEERING) {
+ for (act= ob->actuators.first; act; act= act->next) {
+ if (act->type==ACT_STEERING) {
bSteeringActuator* stact = act->data;
if (stact->facingaxis==0)
{
@@ -12483,9 +12552,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Object *ob;
/* ocean res is now squared, reset old ones - will be massive */
- for(ob = main->object.first; ob; ob = ob->id.next) {
+ for (ob = main->object.first; ob; ob = ob->id.next) {
ModifierData *md;
- for(md= ob->modifiers.first; md; md= md->next) {
+ for (md= ob->modifiers.first; md; md= md->next) {
if (md->type == eModifierType_Ocean) {
OceanModifierData *omd = (OceanModifierData *)md;
omd->resolution = 7;
@@ -12501,12 +12570,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Key *key;
/* Fix for sample line scope initializing with no height */
- for(sc= main->screen.first; sc; sc= sc->id.next) {
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_IMAGE) {
+ if (sl->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sl;
if (sima->sample_line_hist.height == 0 )
sima->sample_line_hist.height = 100;
@@ -12542,11 +12611,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* fix for objects which have zero dquat's
* since this is multiplied with the quat rather than added */
- for(ob= main->object.first; ob; ob= ob->id.next) {
- if(is_zero_v4(ob->dquat)) {
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ if (is_zero_v4(ob->dquat)) {
unit_qt(ob->dquat);
}
- if(is_zero_v3(ob->drotAxis) && ob->drotAngle == 0.0f) {
+ if (is_zero_v3(ob->drotAxis) && ob->drotAngle == 0.0f) {
unit_axis_angle(ob->drotAxis, &ob->drotAngle);
}
}
@@ -12567,7 +12636,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)){
+ if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)) {
bScreen *sc;
Brush *brush;
Object *ob;
@@ -12575,18 +12644,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Material *mat;
int tex_nr, transp_tex;
- for(mat = main->mat.first; mat; mat = mat->id.next){
- if(!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)){
+ for (mat = main->mat.first; mat; mat = mat->id.next) {
+ if (!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)) {
transp_tex= 0;
- for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++){
- if(!mat->mtex[tex_nr]) continue;
- if(mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1;
+ for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+ if (!mat->mtex[tex_nr]) continue;
+ if (mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1;
}
/* weak! material alpha could be animated */
- if(mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex){
+ if (mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex) {
mat->mode |= MA_TRANSP;
mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP);
}
@@ -12603,17 +12672,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
for (brush= main->brush.first; brush; brush= brush->id.next) {
- if(brush->height == 0)
+ if (brush->height == 0)
brush->height= 0.4f;
}
/* replace 'rim material' option for in offset*/
- for(ob = main->object.first; ob; ob = ob->id.next) {
+ for (ob = main->object.first; ob; ob = ob->id.next) {
ModifierData *md;
- for(md= ob->modifiers.first; md; md= md->next) {
+ for (md= ob->modifiers.first; md; md= md->next) {
if (md->type == eModifierType_Solidify) {
SolidifyModifierData *smd = (SolidifyModifierData *)md;
- if(smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) {
+ if (smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) {
smd->mat_ofs_rim= 1;
smd->flag &= ~MOD_SOLIDIFY_RIM_MATERIAL;
}
@@ -12622,20 +12691,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* particle draw color from material */
- for(part = main->particle.first; part; part = part->id.next) {
- if(part->draw & PART_DRAW_MAT_COL)
+ for (part = main->particle.first; part; part = part->id.next) {
+ if (part->draw & PART_DRAW_MAT_COL)
part->draw_col = PART_DRAW_COL_MAT;
}
}
- if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 6)){
+ if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 6)) {
Mesh *me;
- for(me= main->mesh.first; me; me= me->id.next)
+ for (me= main->mesh.first; me; me= me->id.next)
mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL);
}
- if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)){
+ if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) {
/* update blur area sizes from 0..1 range to 0..100 percentage */
Scene *scene;
bNode *node;
@@ -12649,30 +12718,30 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 258 || (main->versionfile == 258 && main->subversionfile < 1)){
+ if (main->versionfile < 258 || (main->versionfile == 258 && main->subversionfile < 1)) {
/* screen view2d settings were not properly initialized [#27164]
* v2d->scroll caused the bug but best reset other values too which are in old blend files only.
* need to make less ugly - possibly an iterator? */
bScreen *screen;
- for(screen= main->screen.first; screen; screen= screen->id.next) {
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
ScrArea *sa;
/* add regions */
- for(sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
SpaceLink *sl= sa->spacedata.first;
- if(sl->spacetype==SPACE_IMAGE) {
+ if (sl->spacetype==SPACE_IMAGE) {
ARegion *ar;
for (ar=sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
View2D *v2d= &ar->v2d;
v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
}
}
}
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_IMAGE) {
+ if (sl->spacetype==SPACE_IMAGE) {
ARegion *ar;
for (ar=sl->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
View2D *v2d= &ar->v2d;
v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
}
@@ -12685,8 +12754,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* Initialize texture point density curve falloff */
Tex *tex;
- for(tex= main->tex.first; tex; tex= tex->id.next) {
- if(tex->pd) {
+ for (tex= main->tex.first; tex; tex= tex->id.next) {
+ if (tex->pd) {
if (tex->pd->falloff_speed_scale == 0.0f)
tex->pd->falloff_speed_scale = 100.0f;
@@ -12706,8 +12775,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* add default value for behind strength of camera actuator */
Object *ob;
bActuator *act;
- for(ob = main->object.first; ob; ob= ob->id.next) {
- for(act= ob->actuators.first; act; act= act->next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (act= ob->actuators.first; act; act= act->next) {
if (act->type == ACT_CAMERA) {
bCameraActuator *ba= act->data;
@@ -12719,14 +12788,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
ParticleSettings *part;
- for(part = main->particle.first; part; part = part->id.next) {
+ for (part = main->particle.first; part; part = part->id.next) {
/* Initialize particle billboard scale */
part->bb_size[0] = part->bb_size[1] = 1.0f;
}
}
}
- if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 1)){
+ if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 1)) {
{
Scene *scene;
Sequence *seq;
@@ -12743,26 +12812,26 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
{
bScreen *screen;
- for(screen= main->screen.first; screen; screen= screen->id.next) {
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
ScrArea *sa;
/* add regions */
- for(sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
SpaceLink *sl= sa->spacedata.first;
- if(sl->spacetype==SPACE_SEQ) {
+ if (sl->spacetype==SPACE_SEQ) {
ARegion *ar;
for (ar=sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW) {
- if(ar->v2d.min[1] == 4.0f)
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (ar->v2d.min[1] == 4.0f)
ar->v2d.min[1]= 0.5f;
}
}
}
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_SEQ) {
+ if (sl->spacetype==SPACE_SEQ) {
ARegion *ar;
for (ar=sl->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW) {
- if(ar->v2d.min[1] == 4.0f)
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (ar->v2d.min[1] == 4.0f)
ar->v2d.min[1]= 0.5f;
}
}
@@ -12843,7 +12912,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 2)){
+ if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 2)) {
{
/* Convert default socket values from bNodeStack */
Scene *sce;
@@ -12893,7 +12962,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 4)){
+ if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 4)) {
{
/* Adaptive time step for particle systems */
ParticleSettings *part;
@@ -12906,42 +12975,42 @@ 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;
- if(sce->gm.recastData.cellsize == 0.0f)
+ if (sce->gm.recastData.cellsize == 0.0f)
sce->gm.recastData.cellsize = 0.3f;
- if(sce->gm.recastData.cellheight == 0.0f)
+ if (sce->gm.recastData.cellheight == 0.0f)
sce->gm.recastData.cellheight = 0.2f;
- if(sce->gm.recastData.agentmaxslope == 0.0f)
+ if (sce->gm.recastData.agentmaxslope == 0.0f)
sce->gm.recastData.agentmaxslope = (float)M_PI/4;
- if(sce->gm.recastData.agentmaxclimb == 0.0f)
+ if (sce->gm.recastData.agentmaxclimb == 0.0f)
sce->gm.recastData.agentmaxclimb = 0.9f;
- if(sce->gm.recastData.agentheight == 0.0f)
+ if (sce->gm.recastData.agentheight == 0.0f)
sce->gm.recastData.agentheight = 2.0f;
- if(sce->gm.recastData.agentradius == 0.0f)
+ if (sce->gm.recastData.agentradius == 0.0f)
sce->gm.recastData.agentradius = 0.6f;
- if(sce->gm.recastData.edgemaxlen == 0.0f)
+ if (sce->gm.recastData.edgemaxlen == 0.0f)
sce->gm.recastData.edgemaxlen = 12.0f;
- if(sce->gm.recastData.edgemaxerror == 0.0f)
+ if (sce->gm.recastData.edgemaxerror == 0.0f)
sce->gm.recastData.edgemaxerror = 1.3f;
- if(sce->gm.recastData.regionminsize == 0.0f)
+ if (sce->gm.recastData.regionminsize == 0.0f)
sce->gm.recastData.regionminsize = 8.f;
- if(sce->gm.recastData.regionmergesize == 0.0f)
+ if (sce->gm.recastData.regionmergesize == 0.0f)
sce->gm.recastData.regionmergesize = 20.f;
- if(sce->gm.recastData.vertsperpoly<3)
+ if (sce->gm.recastData.vertsperpoly<3)
sce->gm.recastData.vertsperpoly = 6;
- if(sce->gm.recastData.detailsampledist == 0.0f)
+ if (sce->gm.recastData.detailsampledist == 0.0f)
sce->gm.recastData.detailsampledist = 6.0f;
- if(sce->gm.recastData.detailsamplemaxerror == 0.0f)
+ if (sce->gm.recastData.detailsamplemaxerror == 0.0f)
sce->gm.recastData.detailsamplemaxerror = 1.0f;
}
}
}
- if (main->versionfile < 260){
+ if (main->versionfile < 260) {
{
/* set default alpha value of Image outputs in image and render layer nodes to 0 */
Scene *sce;
@@ -12950,7 +13019,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (sce=main->scene.first; sce; sce=sce->id.next) {
/* there are files with invalid audio_channels value, the real cause
is unknown, but we fix it here anyway to avoid crashes */
- if(sce->r.ffcodecdata.audio_channels == 0)
+ if (sce->r.ffcodecdata.audio_channels == 0)
sce->r.ffcodecdata.audio_channels = 2;
if (sce->nodetree)
@@ -12966,17 +13035,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ParticleSettings *part;
for (part=main->particle.first; part; part=part->id.next) {
- if(ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
+ if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
part->draw |= PART_DRAW_ROTATE_OB;
- if(part->rotmode == 0)
+ if (part->rotmode == 0)
part->rotmode = PART_ROT_VEL;
}
}
}
}
- if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 1)){
+ if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 1)) {
Object *ob;
for (ob= main->object.first; ob; ob= ob->id.next) {
@@ -12985,7 +13054,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
Camera *cam;
- for(cam= main->camera.first; cam; cam= cam->id.next) {
+ for (cam= main->camera.first; cam; cam= cam->id.next) {
if (cam->sensor_x < 0.01f)
cam->sensor_x = DEFAULT_SENSOR_WIDTH;
@@ -12998,11 +13067,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 2)) {
bNodeTreeType *ntreetype= ntreeGetType(NTREE_SHADER);
- if(ntreetype && ntreetype->foreach_nodetree)
+ if (ntreetype && ntreetype->foreach_nodetree)
ntreetype->foreach_nodetree(main, NULL, do_version_ntree_tex_mapping_260);
}
- if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 4)){
+ if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 4)) {
{
/* Convert node angles to radians! */
Scene *sce;
@@ -13033,19 +13102,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *)sl;
- if(v3d->bundle_size==0.0f) {
+ if (v3d->bundle_size==0.0f) {
v3d->bundle_size= 0.2f;
v3d->flag2 |= V3D_SHOW_RECONSTRUCTION;
}
- else if(sl->spacetype==SPACE_CLIP) {
+ else if (sl->spacetype==SPACE_CLIP) {
SpaceClip *sc= (SpaceClip *)sl;
- if(sc->scopes.track_preview_height==0)
+ if (sc->scopes.track_preview_height==0)
sc->scopes.track_preview_height= 120;
}
- if(v3d->bundle_drawtype==0)
+ if (v3d->bundle_drawtype==0)
v3d->bundle_drawtype= OB_PLAINAXES;
}
}
@@ -13055,7 +13124,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (clip= main->movieclip.first; clip; clip= clip->id.next) {
MovieTrackingTrack *track;
- if(clip->aspx<1.0f) {
+ if (clip->aspx<1.0f) {
clip->aspx= 1.0f;
clip->aspy= 1.0f;
}
@@ -13064,21 +13133,21 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
IMB_TC_FREE_RUN |
IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN;
- if(clip->proxy.build_size_flag==0)
+ if (clip->proxy.build_size_flag==0)
clip->proxy.build_size_flag= IMB_PROXY_25;
- if(clip->proxy.quality==0)
+ if (clip->proxy.quality==0)
clip->proxy.quality= 90;
- if(clip->tracking.camera.pixel_aspect<0.01f)
+ if (clip->tracking.camera.pixel_aspect<0.01f)
clip->tracking.camera.pixel_aspect= 1.f;
track= clip->tracking.tracks.first;
- while(track) {
- if(track->pyramid_levels==0)
+ while (track) {
+ if (track->pyramid_levels==0)
track->pyramid_levels= 2;
- if(track->minimum_correlation==0.0f)
+ if (track->minimum_correlation==0.0f)
track->minimum_correlation= 0.75f;
track= track->next;
@@ -13093,14 +13162,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
MovieClip *clip;
bScreen *sc;
- for(sce = main->scene.first; sce; sce = sce->id.next) {
+ for (sce = main->scene.first; sce; sce = sce->id.next) {
do_versions_image_settings_2_60(sce);
}
for (clip= main->movieclip.first; clip; clip= clip->id.next) {
MovieTrackingSettings *settings= &clip->tracking.settings;
- if(settings->default_pyramid_levels==0) {
+ if (settings->default_pyramid_levels==0) {
settings->default_tracker= TRACKER_KLT;
settings->default_pyramid_levels= 2;
settings->default_minimum_correlation= 0.75;
@@ -13114,7 +13183,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *)sl;
v3d->flag2&= ~V3D_RENDER_SHADOW;
}
@@ -13199,7 +13268,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* Initialize BGE exit key to esc key */
Scene *scene;
- for(scene= main->scene.first; scene; scene= scene->id.next) {
+ for (scene= main->scene.first; scene; scene= scene->id.next) {
if (!scene->gm.exitkey)
scene->gm.exitkey = 218; // Blender key code for ESC
}
@@ -13214,14 +13283,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
clip->proxy.build_tc_flag|= IMB_TC_RECORD_RUN_NO_GAPS;
- if(!tracking->settings.object_distance)
+ if (!tracking->settings.object_distance)
tracking->settings.object_distance= 1.0f;
- if(tracking->objects.first == NULL)
+ if (tracking->objects.first == NULL)
BKE_tracking_new_object(tracking, "Camera");
- while(tracking_object) {
- if(!tracking_object->scale)
+ while (tracking_object) {
+ if (!tracking_object->scale)
tracking_object->scale= 1.0f;
tracking_object= tracking_object->next;
@@ -13233,13 +13302,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (con= ob->constraints.first; con; con=con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- if(!cti)
+ if (!cti)
continue;
- if(cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
+ if (cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
bObjectSolverConstraint *data= (bObjectSolverConstraint *)con->data;
- if(data->invmat[3][3]==0.0f)
+ if (data->invmat[3][3]==0.0f)
unit_m4(data->invmat);
}
}
@@ -13302,12 +13371,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* convert Camera Actuator values to defines */
Object *ob;
bActuator *act;
- for(ob = main->object.first; ob; ob= ob->id.next) {
- for(act= ob->actuators.first; act; act= act->next) {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (act= ob->actuators.first; act; act= act->next) {
if (act->type == ACT_CAMERA) {
bCameraActuator *ba= act->data;
- if(ba->axis==(float) 'x') ba->axis=OB_POSX;
+ if (ba->axis==(float) 'x') ba->axis=OB_POSX;
else if (ba->axis==(float)'y') ba->axis=OB_POSY;
/* don't do an if/else to avoid imediate subversion bump*/
// ba->axis=((ba->axis == (float) 'x')?OB_POSX_X:OB_POSY);
@@ -13320,7 +13389,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* convert deprecated sculpt_paint_unified_* fields to
UnifiedPaintSettings */
Scene *scene;
- for(scene= main->scene.first; scene; scene= scene->id.next) {
+ for (scene= main->scene.first; scene; scene= scene->id.next) {
ToolSettings *ts= scene->toolsettings;
UnifiedPaintSettings *ups= &ts->unified_paint_settings;
ups->size= ts->sculpt_paint_unified_size;
@@ -13337,7 +13406,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* convert extended ascii to utf-8 for text editor */
Text *text;
for (text= main->text.first; text; text= text->id.next)
- if(!(text->flags & TXT_ISEXT)) {
+ if (!(text->flags & TXT_ISEXT)) {
TextLine *tl;
for (tl= text->lines.first; tl; tl= tl->next) {
@@ -13353,12 +13422,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* set new dynamic paint values */
Object *ob;
- for(ob = main->object.first; ob; ob = ob->id.next) {
+ for (ob = main->object.first; ob; ob = ob->id.next) {
ModifierData *md;
- for(md= ob->modifiers.first; md; md= md->next) {
+ 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) {
@@ -13377,13 +13446,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (main->versionfile < 262)
{
Object *ob;
- for(ob=main->object.first; ob; ob= ob->id.next) {
+ for (ob=main->object.first; ob; ob= ob->id.next) {
ModifierData *md;
for (md=ob->modifiers.first; md; md=md->next) {
if (md->type==eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData*) md;
- if(clmd->sim_parms)
+ if (clmd->sim_parms)
clmd->sim_parms->vel_damping = 1.0f;
}
}
@@ -13401,7 +13470,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Fluidsim) {
FluidsimModifierData *fmd = (FluidsimModifierData *)md;
- if(fmd->fss->animRate == 0.0f)
+ if (fmd->fss->animRate == 0.0f)
fmd->fss->animRate = 1.0f;
}
}
@@ -13423,7 +13492,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
do_versions_nodetree_multi_file_output_format_2_62_1(NULL, ntree);
}
- /* put compatibility code here until next subversion bump */
+ /* only swap for pre-release bmesh merge which had MLoopCol red/blue swap */
+ if (main->versionfile == 262 && main->subversionfile == 1)
+ {
+ {
+ Mesh *me;
+ for (me = main->mesh.first; me; me = me->id.next) {
+ do_versions_mesh_mloopcol_swap_2_62_1(me);
+ }
+ }
+
+ }
+
+ if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 2))
{
{
/* Set new idname of keyingsets from their now "label-only" name. */
@@ -13438,6 +13519,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
+ {
+ /* Default for old files is to save particle rotations to pointcache */
+ ParticleSettings *part;
+ for (part = main->particle.first; part; part = part->id.next)
+ part->flag |= PART_ROTATIONS;
+ }
+
+ /* put compatibility code here until next subversion bump */
+ {
+
+ }
+
/* default values in Freestyle settings */
{
Scene *sce;
@@ -13470,7 +13563,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
static void do_versions_after_linking(FileData *fd, Library *lib, Main *main)
{
/* old Animation System (using IPO's) needs to be converted to the new Animato system */
- if(main->versionfile < 250)
+ if (main->versionfile < 250)
do_versions_ipos_to_animato(main);
}
#endif
@@ -13515,7 +13608,7 @@ static void lib_link_all(FileData *fd, Main *main)
static void direct_link_keymapitem(FileData *fd, wmKeyMapItem *kmi)
{
kmi->properties= newdataadr(fd, kmi->properties);
- if(kmi->properties)
+ if (kmi->properties)
IDP_DirectLinkProperty(kmi->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
kmi->ptr= NULL;
kmi->flag &= ~KMI_UPDATE;
@@ -13533,7 +13626,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
/* read all data into fd->datamap */
bhead= read_data_into_oldnewmap(fd, bhead, "user def");
- if(user->keymaps.first) {
+ if (user->keymaps.first) {
/* backwards compatibility */
user->user_keymaps= user->keymaps;
user->keymaps.first= user->keymaps.last= NULL;
@@ -13543,25 +13636,25 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
link_list(fd, &user->user_keymaps);
link_list(fd, &user->addons);
- for(keymap=user->user_keymaps.first; keymap; keymap=keymap->next) {
+ for (keymap=user->user_keymaps.first; keymap; keymap=keymap->next) {
keymap->modal_items= NULL;
- keymap->poll= NULL;
+ keymap->poll = NULL;
keymap->flag &= ~KEYMAP_UPDATE;
link_list(fd, &keymap->diff_items);
link_list(fd, &keymap->items);
- for(kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
+ for (kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
kmdi->remove_item= newdataadr(fd, kmdi->remove_item);
kmdi->add_item= newdataadr(fd, kmdi->add_item);
- if(kmdi->remove_item)
+ if (kmdi->remove_item)
direct_link_keymapitem(fd, kmdi->remove_item);
- if(kmdi->add_item)
+ if (kmdi->add_item)
direct_link_keymapitem(fd, kmdi->add_item);
}
- for(kmi=keymap->items.first; kmi; kmi=kmi->next)
+ for (kmi=keymap->items.first; kmi; kmi=kmi->next)
direct_link_keymapitem(fd, kmi);
}
@@ -13591,7 +13684,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
bfd->type= BLENFILETYPE_BLEND;
BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name));
- while(bhead) {
+ while (bhead) {
switch(bhead->code) {
case DATA:
case DNA1:
@@ -13615,14 +13708,14 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
overwriting the libraries from the memory file. previously
it did not save ID_LI/ID_ID blocks in this case, but they are
needed to make quit.blend recover them correctly. */
- if(fd->memfile)
+ if (fd->memfile)
bhead= blo_nextbhead(fd, bhead);
else
bhead= read_libblock(fd, bfd->main, bhead, LIB_LOCAL, NULL);
break;
case ID_ID:
/* same as above */
- if(fd->memfile)
+ if (fd->memfile)
bhead= blo_nextbhead(fd, bhead);
else
/* always adds to the most recently loaded
@@ -13641,7 +13734,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
}
/* do before read_libraries, but skip undo case */
-// if(fd->memfile==NULL) (the mesh shuffle hacks don't work yet? ton)
+// if (fd->memfile==NULL) (the mesh shuffle hacks don't work yet? ton)
do_versions(fd, NULL, bfd->main);
read_libraries(fd, &fd->mainlist);
@@ -13669,8 +13762,8 @@ static int verg_bheadsort(const void *v1, const void *v2)
{
const struct bheadsort *x1=v1, *x2=v2;
- if( x1->old > x2->old) return 1;
- else if( x1->old < x2->old) return -1;
+ if ( x1->old > x2->old) return 1;
+ else if ( x1->old < x2->old) return -1;
return 0;
}
@@ -13684,7 +13777,7 @@ static void sort_bhead_old_map(FileData *fd)
tot++;
fd->tot_bheadmap= tot;
- if(tot==0) return;
+ if (tot==0) return;
bhs= fd->bheadmap= MEM_mallocN(tot*sizeof(struct bheadsort), "bheadsort");
@@ -13700,7 +13793,7 @@ static void sort_bhead_old_map(FileData *fd)
static BHead *find_previous_lib(FileData *fd, BHead *bhead)
{
/* skip library datablocks in undo, see comment in read_libblock */
- if(fd->memfile)
+ if (fd->memfile)
return NULL;
for (; bhead; bhead= blo_prevbhead(fd, bhead))
@@ -13726,7 +13819,7 @@ static BHead *find_bhead(FileData *fd, void *old)
bhs_s.old= old;
bhs= bsearch(&bhs_s, fd->bheadmap, fd->tot_bheadmap, sizeof(struct bheadsort), verg_bheadsort);
- if(bhs)
+ if (bhs)
return bhs->bhead;
#if 0
@@ -13756,21 +13849,21 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
ID *id;
bhead= find_bhead(fd, old);
- if(bhead) {
+ if (bhead) {
/* from another library? */
- if(bhead->code==ID_ID) {
+ if (bhead->code==ID_ID) {
BHead *bheadlib= find_previous_lib(fd, bhead);
- if(bheadlib) {
+ if (bheadlib) {
Library *lib= read_struct(fd, bheadlib, "Library");
Main *ptr= blo_find_main(fd, &fd->mainlist, lib->name, fd->relabase);
id= is_yet_read(fd, ptr, bhead);
- if(id==NULL) {
+ if (id==NULL) {
read_libblock(fd, ptr, bhead, LIB_READ+LIB_INDIRECT, NULL);
// commented because this can print way too much
- // if(G.f & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name);
+ // if (G.f & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name);
/* for outliner dependency only */
ptr->curlib->parent= mainvar->curlib;
@@ -13785,12 +13878,12 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
/* Update: the issue is that in file reading, the oldnewmap is OK, but for existing data, it has to be
inserted in the map to be found! */
- if(id->flag & LIB_PRE_EXISTING)
+ if (id->flag & LIB_PRE_EXISTING)
oldnewmap_insert(fd->libmap, bhead->old, id, 1);
change_idid_adr_fd(fd, bhead->old, id);
// commented because this can print way too much
- // if(G.f & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name);
+ // if (G.f & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name);
}
MEM_freeN(lib);
@@ -13798,7 +13891,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
}
else {
id= is_yet_read(fd, mainvar, bhead);
- if(id==NULL) {
+ if (id==NULL) {
read_libblock(fd, mainvar, bhead, LIB_TESTIND, NULL);
}
else {
@@ -13806,7 +13899,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
happens which invokes same ID... in that case the lookup table needs this entry */
oldnewmap_insert(fd->libmap, bhead->old, id, 1);
// commented because this can print way too much
- // if(G.f & G_DEBUG) printf("expand: already read %s\n", id->name);
+ // if (G.f & G_DEBUG) printf("expand: already read %s\n", id->name);
}
}
}
@@ -13818,8 +13911,8 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
static void expand_ipo(FileData *fd, Main *mainvar, Ipo *ipo)
{
IpoCurve *icu;
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->driver)
+ for (icu= ipo->curve.first; icu; icu= icu->next) {
+ if (icu->driver)
expand_doit(fd, mainvar, icu->driver->ob);
}
}
@@ -13948,11 +14041,11 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting
expand_doit(fd, mainvar, part->eff_group);
expand_doit(fd, mainvar, part->bb_ob);
- if(part->adt)
+ if (part->adt)
expand_animdata(fd, mainvar, part->adt);
- for(a=0; a<MAX_MTEX; a++) {
- if(part->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (part->mtex[a]) {
expand_doit(fd, mainvar, part->mtex[a]->tex);
expand_doit(fd, mainvar, part->mtex[a]->object);
}
@@ -13963,7 +14056,7 @@ static void expand_group(FileData *fd, Main *mainvar, Group *group)
{
GroupObject *go;
- for(go= group->gobject.first; go; go= go->next) {
+ for (go= group->gobject.first; go; go= go->next) {
expand_doit(fd, mainvar, go->ob);
}
}
@@ -13972,7 +14065,7 @@ static void expand_key(FileData *fd, Main *mainvar, Key *key)
{
expand_doit(fd, mainvar, key->ipo); // XXX depreceated - old animation system
- if(key->adt)
+ if (key->adt)
expand_animdata(fd, mainvar, key->adt);
}
@@ -13980,14 +14073,14 @@ static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree)
{
bNode *node;
- if(ntree->adt)
+ if (ntree->adt)
expand_animdata(fd, mainvar, ntree->adt);
- if(ntree->gpd)
+ if (ntree->gpd)
expand_doit(fd, mainvar, ntree->gpd);
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->id && node->type!=CMP_NODE_R_LAYERS)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->id && node->type!=CMP_NODE_R_LAYERS)
expand_doit(fd, mainvar, node->id);
}
@@ -13997,10 +14090,10 @@ static void expand_texture(FileData *fd, Main *mainvar, Tex *tex)
expand_doit(fd, mainvar, tex->ima);
expand_doit(fd, mainvar, tex->ipo); // XXX depreceated - old animation system
- if(tex->adt)
+ if (tex->adt)
expand_animdata(fd, mainvar, tex->adt);
- if(tex->nodetree)
+ if (tex->nodetree)
expand_nodetree(fd, mainvar, tex->nodetree);
}
@@ -14014,8 +14107,8 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma)
{
int a;
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a]) {
expand_doit(fd, mainvar, ma->mtex[a]->tex);
expand_doit(fd, mainvar, ma->mtex[a]->object);
}
@@ -14023,13 +14116,13 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma)
expand_doit(fd, mainvar, ma->ipo); // XXX depreceated - old animation system
- if(ma->adt)
+ if (ma->adt)
expand_animdata(fd, mainvar, ma->adt);
- if(ma->nodetree)
+ if (ma->nodetree)
expand_nodetree(fd, mainvar, ma->nodetree);
- if(ma->group)
+ if (ma->group)
expand_doit(fd, mainvar, ma->group);
}
@@ -14037,8 +14130,8 @@ static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)
{
int a;
- for(a=0; a<MAX_MTEX; a++) {
- if(la->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (la->mtex[a]) {
expand_doit(fd, mainvar, la->mtex[a]->tex);
expand_doit(fd, mainvar, la->mtex[a]->object);
}
@@ -14049,7 +14142,7 @@ static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)
if (la->adt)
expand_animdata(fd, mainvar, la->adt);
- if(la->nodetree)
+ if (la->nodetree)
expand_nodetree(fd, mainvar, la->nodetree);
}
@@ -14067,8 +14160,8 @@ static void expand_world(FileData *fd, Main *mainvar, World *wrld)
{
int a;
- for(a=0; a<MAX_MTEX; a++) {
- if(wrld->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (wrld->mtex[a]) {
expand_doit(fd, mainvar, wrld->mtex[a]->tex);
expand_doit(fd, mainvar, wrld->mtex[a]->object);
}
@@ -14079,7 +14172,7 @@ static void expand_world(FileData *fd, Main *mainvar, World *wrld)
if (wrld->adt)
expand_animdata(fd, mainvar, wrld->adt);
- if(wrld->nodetree)
+ if (wrld->nodetree)
expand_nodetree(fd, mainvar, wrld->nodetree);
}
@@ -14088,11 +14181,11 @@ static void expand_mball(FileData *fd, Main *mainvar, MetaBall *mb)
{
int a;
- for(a=0; a<mb->totcol; a++) {
+ for (a=0; a<mb->totcol; a++) {
expand_doit(fd, mainvar, mb->mat[a]);
}
- if(mb->adt)
+ if (mb->adt)
expand_animdata(fd, mainvar, mb->adt);
}
@@ -14100,7 +14193,7 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu)
{
int a;
- for(a=0; a<cu->totcol; a++) {
+ for (a=0; a<cu->totcol; a++) {
expand_doit(fd, mainvar, cu->mat[a]);
}
@@ -14114,7 +14207,7 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu)
expand_doit(fd, mainvar, cu->taperobj);
expand_doit(fd, mainvar, cu->textoncurve);
- if(cu->adt)
+ if (cu->adt)
expand_animdata(fd, mainvar, cu->adt);
}
@@ -14125,30 +14218,30 @@ static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
TFace *tf;
int a, i;
- if(me->adt)
+ if (me->adt)
expand_animdata(fd, mainvar, me->adt);
- for(a=0; a<me->totcol; a++) {
+ for (a=0; a<me->totcol; a++) {
expand_doit(fd, mainvar, me->mat[a]);
}
expand_doit(fd, mainvar, me->key);
expand_doit(fd, mainvar, me->texcomesh);
- if(me->tface) {
+ if (me->tface) {
tf= me->tface;
- for(i=0; i<me->totface; i++, tf++)
- if(tf->tpage)
+ for (i=0; i<me->totface; i++, tf++)
+ if (tf->tpage)
expand_doit(fd, mainvar, tf->tpage);
}
- for(a=0; a<me->fdata.totlayer; a++) {
+ for (a=0; a<me->fdata.totlayer; a++) {
layer= &me->fdata.layers[a];
- if(layer->type == CD_MTFACE) {
+ if (layer->type == CD_MTFACE) {
mtf= (MTFace*)layer->data;
- for(i=0; i<me->totface; i++, mtf++)
- if(mtf->tpage)
+ for (i=0; i<me->totface; i++, mtf++)
+ if (mtf->tpage)
expand_doit(fd, mainvar, mtf->tpage);
}
}
@@ -14211,7 +14304,7 @@ static void expand_armature(FileData *fd, Main *mainvar, bArmature *arm)
{
Bone *curBone;
- if(arm->adt)
+ if (arm->adt)
expand_animdata(fd, mainvar, arm->adt);
for (curBone = arm->bonebase.first; curBone; curBone=curBone->next) {
@@ -14243,7 +14336,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
expand_doit(fd, mainvar, ob->data);
/* expand_object_expandModifier() */
- if(ob->modifiers.first) {
+ if (ob->modifiers.first) {
struct { FileData *fd; Main *mainvar; } data;
data.fd= fd;
data.mainvar= mainvar;
@@ -14263,17 +14356,17 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
expand_constraint_channels(fd, mainvar, &ob->constraintChannels);
- for (strip=ob->nlastrips.first; strip; strip=strip->next){
+ for (strip=ob->nlastrips.first; strip; strip=strip->next) {
expand_doit(fd, mainvar, strip->object);
expand_doit(fd, mainvar, strip->act);
expand_doit(fd, mainvar, strip->ipo);
}
// XXX depreceated - old animation system (for version patching only)
- if(ob->adt)
+ if (ob->adt)
expand_animdata(fd, mainvar, ob->adt);
- for(a=0; a<ob->totcol; a++) {
+ for (a=0; a<ob->totcol; a++) {
expand_doit(fd, mainvar, ob->mat[a]);
}
@@ -14281,24 +14374,24 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
if (paf && paf->group)
expand_doit(fd, mainvar, paf->group);
- if(ob->dup_group)
+ if (ob->dup_group)
expand_doit(fd, mainvar, ob->dup_group);
- if(ob->proxy)
+ if (ob->proxy)
expand_doit(fd, mainvar, ob->proxy);
- if(ob->proxy_group)
+ if (ob->proxy_group)
expand_doit(fd, mainvar, ob->proxy_group);
- for(psys=ob->particlesystem.first; psys; psys=psys->next)
+ for (psys=ob->particlesystem.first; psys; psys=psys->next)
expand_doit(fd, mainvar, psys->part);
sens= ob->sensors.first;
- while(sens) {
- if(sens->type==SENS_TOUCH) {
+ while (sens) {
+ if (sens->type==SENS_TOUCH) {
bTouchSensor *ts= sens->data;
expand_doit(fd, mainvar, ts->ma);
}
- else if(sens->type==SENS_MESSAGE) {
+ else if (sens->type==SENS_MESSAGE) {
bMessageSensor *ms= sens->data;
expand_doit(fd, mainvar, ms->fromObject);
}
@@ -14306,8 +14399,8 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
}
cont= ob->controllers.first;
- while(cont) {
- if(cont->type==CONT_PYTHON) {
+ while (cont) {
+ if (cont->type==CONT_PYTHON) {
bPythonCont *pc= cont->data;
expand_doit(fd, mainvar, pc->text);
}
@@ -14315,64 +14408,64 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
}
act= ob->actuators.first;
- while(act) {
- if(act->type==ACT_SOUND) {
+ while (act) {
+ if (act->type==ACT_SOUND) {
bSoundActuator *sa= act->data;
expand_doit(fd, mainvar, sa->sound);
}
- else if(act->type==ACT_CAMERA) {
+ else if (act->type==ACT_CAMERA) {
bCameraActuator *ca= act->data;
expand_doit(fd, mainvar, ca->ob);
}
- else if(act->type==ACT_EDIT_OBJECT) {
+ else if (act->type==ACT_EDIT_OBJECT) {
bEditObjectActuator *eoa= act->data;
- if(eoa) {
+ if (eoa) {
expand_doit(fd, mainvar, eoa->ob);
expand_doit(fd, mainvar, eoa->me);
}
}
- else if(act->type==ACT_OBJECT) {
+ else if (act->type==ACT_OBJECT) {
bObjectActuator *oa= act->data;
expand_doit(fd, mainvar, oa->reference);
}
- else if(act->type==ACT_ADD_OBJECT) {
+ else if (act->type==ACT_ADD_OBJECT) {
bAddObjectActuator *aoa= act->data;
expand_doit(fd, mainvar, aoa->ob);
}
- else if(act->type==ACT_SCENE) {
+ else if (act->type==ACT_SCENE) {
bSceneActuator *sa= act->data;
expand_doit(fd, mainvar, sa->camera);
expand_doit(fd, mainvar, sa->scene);
}
- else if(act->type==ACT_2DFILTER) {
+ else if (act->type==ACT_2DFILTER) {
bTwoDFilterActuator *tdfa= act->data;
expand_doit(fd, mainvar, tdfa->text);
}
- else if(act->type==ACT_ACTION) {
+ else if (act->type==ACT_ACTION) {
bActionActuator *aa= act->data;
expand_doit(fd, mainvar, aa->act);
}
- else if(act->type==ACT_SHAPEACTION) {
+ else if (act->type==ACT_SHAPEACTION) {
bActionActuator *aa= act->data;
expand_doit(fd, mainvar, aa->act);
}
- else if(act->type==ACT_PROPERTY) {
+ else if (act->type==ACT_PROPERTY) {
bPropertyActuator *pa= act->data;
expand_doit(fd, mainvar, pa->ob);
}
- else if(act->type==ACT_MESSAGE) {
+ else if (act->type==ACT_MESSAGE) {
bMessageActuator *ma= act->data;
expand_doit(fd, mainvar, ma->toObject);
}
- else if(act->type==ACT_PARENT) {
+ else if (act->type==ACT_PARENT) {
bParentActuator *pa= act->data;
expand_doit(fd, mainvar, pa->ob);
}
- else if(act->type==ACT_ARMATURE) {
+ else if (act->type==ACT_ARMATURE) {
bArmatureActuator *arma= act->data;
expand_doit(fd, mainvar, arma->target);
}
- else if(act->type==ACT_STEERING) {
+ else if (act->type==ACT_STEERING) {
bSteeringActuator *sta= act->data;
expand_doit(fd, mainvar, sta->target);
expand_doit(fd, mainvar, sta->navmesh);
@@ -14380,7 +14473,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
act= act->next;
}
- if(ob->pd && ob->pd->tex)
+ if (ob->pd && ob->pd->tex)
expand_doit(fd, mainvar, ob->pd->tex);
}
@@ -14391,23 +14484,23 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
SceneRenderLayer *srl;
FreestyleLineSet *lineset;
- for(base= sce->base.first; base; base= base->next) {
+ for (base= sce->base.first; base; base= base->next) {
expand_doit(fd, mainvar, base->object);
}
expand_doit(fd, mainvar, sce->camera);
expand_doit(fd, mainvar, sce->world);
- if(sce->adt)
+ if (sce->adt)
expand_animdata(fd, mainvar, sce->adt);
expand_keyingsets(fd, mainvar, &sce->keyingsets);
- if(sce->set)
+ if (sce->set)
expand_doit(fd, mainvar, sce->set);
- if(sce->nodetree)
+ if (sce->nodetree)
expand_nodetree(fd, mainvar, sce->nodetree);
- for(srl= sce->r.layers.first; srl; srl= srl->next) {
+ for (srl= sce->r.layers.first; srl; srl= srl->next) {
expand_doit(fd, mainvar, srl->mat_override);
expand_doit(fd, mainvar, srl->light_override);
@@ -14418,19 +14511,19 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
}
}
- if(sce->r.dometext)
+ if (sce->r.dometext)
expand_doit(fd, mainvar, sce->gm.dome.warptext);
- if(sce->gpd)
+ if (sce->gpd)
expand_doit(fd, mainvar, sce->gpd);
- if(sce->ed) {
+ if (sce->ed) {
Sequence *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);
+ 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);
}
SEQ_END
}
@@ -14439,8 +14532,8 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
{
TimeMarker *marker;
- for(marker= sce->markers.first; marker; marker= marker->next) {
- if(marker->camera) {
+ for (marker= sce->markers.first; marker; marker= marker->next) {
+ if (marker->camera) {
expand_doit(fd, mainvar, marker->camera);
}
}
@@ -14452,7 +14545,7 @@ static void expand_camera(FileData *fd, Main *mainvar, Camera *ca)
{
expand_doit(fd, mainvar, ca->ipo); // XXX depreceated - old animation system
- if(ca->adt)
+ if (ca->adt)
expand_animdata(fd, mainvar, ca->adt);
}
@@ -14500,17 +14593,17 @@ static void expand_main(FileData *fd, Main *mainvar)
ID *id;
int a, doit= 1;
- if(fd==NULL) return;
+ if (fd==NULL) return;
- while(doit) {
+ while (doit) {
doit= 0;
a= set_listbasepointers(mainvar, lbarray);
- while(a--) {
+ while (a--) {
id= lbarray[a]->first;
- while(id) {
- if(id->flag & LIB_TEST) {
+ while (id) {
+ if (id->flag & LIB_TEST) {
switch(GS(id->name)) {
@@ -14599,8 +14692,8 @@ static int object_in_any_scene(Main *mainvar, Object *ob)
{
Scene *sce;
- for(sce= mainvar->scene.first; sce; sce= sce->id.next)
- if(object_in_scene(ob, sce))
+ for (sce= mainvar->scene.first; sce; sce= sce->id.next)
+ if (object_in_scene(ob, sce))
return 1;
return 0;
}
@@ -14612,9 +14705,9 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const
const short is_group_append= (is_link==FALSE && idcode==ID_GR);
/* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */
- for(ob= mainvar->object.first; ob; ob= ob->id.next) {
+ for (ob= mainvar->object.first; ob; ob= ob->id.next) {
- if( ob->id.flag & LIB_INDIRECT ) {
+ if ( ob->id.flag & LIB_INDIRECT ) {
/* IF below is quite confusing!
if we are appending, but this object wasnt just added along with a group,
@@ -14625,12 +14718,12 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const
int do_it= 0;
- if(ob->id.us==0) {
+ if (ob->id.us==0) {
do_it= 1;
}
- else if(idcode==ID_GR) {
- if(ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) {
- if((ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) {
+ else if (idcode==ID_GR) {
+ if (ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) {
+ if ((ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) {
do_it= 1;
}
}
@@ -14638,20 +14731,20 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const
else {
/* when appending, make sure any indirectly loaded objects
* get a base else they cant be accessed at all [#27437] */
- if(ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) {
+ if (ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) {
/* we may be appending from a scene where we already
* have a linked object which is not in any scene [#27616] */
- if((ob->id.flag & LIB_PRE_EXISTING)==0) {
+ if ((ob->id.flag & LIB_PRE_EXISTING)==0) {
- if(object_in_any_scene(mainvar, ob)==0) {
+ if (object_in_any_scene(mainvar, ob)==0) {
do_it= 1;
}
}
}
}
- if(do_it) {
+ if (do_it) {
base= MEM_callocN( sizeof(Base), "add_ext_base");
BLI_addtail(&(sce->base), base);
base->lay= ob->lay;
@@ -14672,8 +14765,8 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
Group *group;
/* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */
- for(group= mainvar->group.first; group; group= group->id.next) {
- if(((group->id.flag & LIB_INDIRECT)==0 && (group->id.flag & LIB_PRE_EXISTING)==0)) {
+ for (group= mainvar->group.first; group; group= group->id.next) {
+ if (((group->id.flag & LIB_INDIRECT)==0 && (group->id.flag & LIB_PRE_EXISTING)==0)) {
Base *base;
/* add_object(...) messes with the selection */
@@ -14705,20 +14798,20 @@ static ID *append_named_part(Main *mainl, FileData *fd, const char *idname, cons
ID *id= NULL;
int found=0;
- for(bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
- if(bhead->code==idcode) {
+ for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
+ if (bhead->code==idcode) {
const char *idname_test= bhead_id_name(fd, bhead);
- if(strcmp(idname_test + 2, idname)==0) {
+ if (strcmp(idname_test + 2, idname)==0) {
found= 1;
id= is_yet_read(fd, mainl, bhead);
- if(id==NULL) {
+ if (id==NULL) {
read_libblock(fd, mainl, bhead, LIB_TESTEXT, &id);
}
else {
printf("append: already linked\n");
oldnewmap_insert(fd->libmap, bhead->old, id, 1);
- if(id->flag & LIB_INDIRECT) {
+ if (id->flag & LIB_INDIRECT) {
id->flag -= LIB_INDIRECT;
id->flag |= LIB_EXTERN;
}
@@ -14727,7 +14820,7 @@ static ID *append_named_part(Main *mainl, FileData *fd, const char *idname, cons
break;
}
}
- else if(bhead->code==ENDB) {
+ else if (bhead->code==ENDB) {
break;
}
}
@@ -14742,9 +14835,9 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co
{
ID *id= append_named_part(mainl, fd, idname, idcode);
- if(id && (GS(id->name) == ID_OB)) { /* loose object: give a base */
+ if (id && (GS(id->name) == ID_OB)) { /* loose object: give a base */
Scene *scene= CTX_data_scene(C); /* can be NULL */
- if(scene) {
+ if (scene) {
Base *base;
Object *ob;
@@ -14754,7 +14847,7 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co
ob= (Object *)id;
/* link at active layer (view3d->lay if in context, else scene->lay */
- if((flag & FILE_ACTIVELAY)) {
+ if ((flag & FILE_ACTIVELAY)) {
View3D *v3d = CTX_wm_view3d(C);
ob->lay = v3d ? v3d->layact : scene->lay;
}
@@ -14764,7 +14857,7 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co
base->object= ob;
ob->id.us++;
- if(flag & FILE_AUTOSELECT) {
+ if (flag & FILE_AUTOSELECT) {
base->flag |= SELECT;
base->object->flag = base->flag;
/* do NOT make base active here! screws up GUI stuff, if you want it do it on src/ level */
@@ -14802,7 +14895,8 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r)
break;
}
- } else if (bhead->code==ENDB)
+ }
+ else if (bhead->code==ENDB)
break;
}
}
@@ -14848,7 +14942,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
curlib= mainl->curlib;
/* make the lib path relative if required */
- if(flag & FILE_RELPATH) {
+ if (flag & FILE_RELPATH) {
/* use the full path, this could have been read by other library even */
BLI_strncpy(curlib->name, curlib->filepath, sizeof(curlib->name));
@@ -14865,14 +14959,14 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
lib_verify_nodetree(mainvar, FALSE);
fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */
- if(C) {
+ if (C) {
Scene *scene= CTX_data_scene(C);
/* give a base to loose objects. If group append, do it for objects too */
- if(scene) {
+ if (scene) {
const short is_link= (flag & FILE_LINK) != 0;
- if(idcode==ID_SCE) {
- /* dont instance anything when linking in scenes, assume the scene its self instances the data */
+ if (idcode==ID_SCE) {
+ /* don't instance anything when linking in scenes, assume the scene its self instances the data */
}
else {
give_base_to_objects(mainvar, scene, curlib, idcode, is_link);
@@ -14891,7 +14985,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
/* 20041208: put back. It only linked direct, not indirect objects (ton) */
/* patch to prevent switch_endian happens twice */
- if((*fd)->flags & FD_FLAGS_SWITCH_ENDIAN) {
+ if ((*fd)->flags & FD_FLAGS_SWITCH_ENDIAN) {
blo_freefiledata( *fd );
*fd = NULL;
}
@@ -14917,7 +15011,7 @@ static int mainvar_count_libread_blocks(Main *mainvar)
int a, tot= 0;
a= set_listbasepointers(mainvar, lbarray);
- while(a--) {
+ while (a--) {
ID *id;
for (id= lbarray[a]->first; id; id= id->next)
@@ -14934,19 +15028,19 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
ListBase *lbarray[MAX_LIBARRAY];
int a, doit= 1;
- while(doit) {
+ while (doit) {
doit= 0;
/* test 1: read libdata */
mainptr= mainl->next;
- while(mainptr) {
+ while (mainptr) {
int tot= mainvar_count_libread_blocks(mainptr);
// printf("found LIB_READ %s\n", mainptr->curlib->name);
- if(tot) {
+ if (tot) {
FileData *fd= mainptr->curlib->filedata;
- if(fd==NULL) {
+ if (fd==NULL) {
/* printf and reports for now... its important users know this */
BKE_reportf_wrap(basefd->reports, RPT_INFO,
@@ -14956,8 +15050,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
/* allow typing in a new lib path */
- if(G.rt==-666) {
- while(fd==NULL) {
+ if (G.rt==-666) {
+ while (fd==NULL) {
char newlib_path[FILE_MAX] = { 0 };
printf("Missing library...'\n");
printf(" current file: %s\n", G.main->name);
@@ -14965,14 +15059,14 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
printf(" relative lib: %s\n", mainptr->curlib->name);
printf(" enter a new path:\n");
- if(scanf("%s", newlib_path) > 0) {
+ if (scanf("%s", newlib_path) > 0) {
BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name));
BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath));
cleanup_path(G.main->name, mainptr->curlib->filepath);
fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
- if(fd) {
+ if (fd) {
printf("found: '%s', party on macuno!\n", mainptr->curlib->filepath);
}
}
@@ -15001,15 +15095,15 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
mainptr->curlib->filepath);
}
}
- if(fd) {
+ if (fd) {
doit= 1;
a= set_listbasepointers(mainptr, lbarray);
- while(a--) {
+ while (a--) {
ID *id= lbarray[a]->first;
- while(id) {
+ while (id) {
ID *idn= id->next;
- if(id->flag & LIB_READ) {
+ if (id->flag & LIB_READ) {
ID *realid= NULL;
BLI_remlink(lbarray[a], id);
@@ -15033,7 +15127,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
/* dang FileData... now new libraries need to be appended to original filedata,
* it is not a good replacement for the old global (ton) */
- while( fd->mainlist.first ) {
+ while ( fd->mainlist.first ) {
Main *mp= fd->mainlist.first;
BLI_remlink(&fd->mainlist, mp);
BLI_addtail(&basefd->mainlist, mp);
@@ -15046,13 +15140,13 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
}
/* test if there are unread libblocks */
- for(mainptr= mainl->next; mainptr; mainptr= mainptr->next) {
+ for (mainptr= mainl->next; mainptr; mainptr= mainptr->next) {
a= set_listbasepointers(mainptr, lbarray);
- while(a--) {
+ while (a--) {
ID *id= lbarray[a]->first;
- while(id) {
+ while (id) {
ID *idn= id->next;
- if(id->flag & LIB_READ) {
+ if (id->flag & LIB_READ) {
BLI_remlink(lbarray[a], id);
BKE_reportf_wrap(basefd->reports, RPT_ERROR,
"LIB ERROR: %s:'%s' unread libblock missing from '%s'\n",
@@ -15067,20 +15161,20 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
}
/* do versions, link, and free */
- for(mainptr= mainl->next; mainptr; mainptr= mainptr->next) {
+ for (mainptr= mainl->next; mainptr; mainptr= mainptr->next) {
/* some mains still have to be read, then
* versionfile is still zero! */
- if(mainptr->versionfile) {
- if(mainptr->curlib->filedata) // can be zero... with shift+f1 append
+ if (mainptr->versionfile) {
+ if (mainptr->curlib->filedata) // can be zero... with shift+f1 append
do_versions(mainptr->curlib->filedata, mainptr->curlib, mainptr);
else
do_versions(basefd, NULL, mainptr);
}
- if(mainptr->curlib->filedata)
+ if (mainptr->curlib->filedata)
lib_link_all(mainptr->curlib->filedata, mainptr);
- if(mainptr->curlib->filedata) blo_freefiledata(mainptr->curlib->filedata);
+ if (mainptr->curlib->filedata) blo_freefiledata(mainptr->curlib->filedata);
mainptr->curlib->filedata= NULL;
}
}
diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c
index 3f8a9807f18..814061b7318 100644
--- a/source/blender/blenloader/intern/runtime.c
+++ b/source/blender/blenloader/intern/runtime.c
@@ -60,7 +60,7 @@ static int handle_read_msb_int(int handle)
{
unsigned char buf[4];
- if(read(handle, buf, 4) != 4)
+ if (read(handle, buf, 4) != 4)
return -1;
return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0);
@@ -68,28 +68,28 @@ static int handle_read_msb_int(int handle)
int BLO_is_a_runtime(const char *path)
{
- int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0);
+ int res= 0, fd= BLI_open(path, O_BINARY|O_RDONLY, 0);
int datastart;
char buf[8];
- if(fd==-1)
+ if (fd==-1)
goto cleanup;
lseek(fd, -12, SEEK_END);
datastart= handle_read_msb_int(fd);
- if(datastart==-1)
+ if (datastart==-1)
goto cleanup;
- else if(read(fd, buf, 8)!=8)
+ else if (read(fd, buf, 8)!=8)
goto cleanup;
- else if(memcmp(buf, "BRUNTIME", 8)!=0)
+ else if (memcmp(buf, "BRUNTIME", 8)!=0)
goto cleanup;
else
res= 1;
cleanup:
- if(fd!=-1)
+ if (fd!=-1)
close(fd);
return res;
@@ -102,9 +102,9 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
int fd, datastart;
char buf[8];
- fd= open(path, O_BINARY|O_RDONLY, 0);
+ fd= BLI_open(path, O_BINARY|O_RDONLY, 0);
- if(fd==-1) {
+ if (fd==-1) {
BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", path, strerror(errno));
goto cleanup;
}
@@ -115,15 +115,15 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
datastart= handle_read_msb_int(fd);
- if(datastart==-1) {
+ if (datastart==-1) {
BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (problem seeking)", path);
goto cleanup;
}
- else if(read(fd, buf, 8)!=8) {
+ else if (read(fd, buf, 8)!=8) {
BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (truncated header)", path);
goto cleanup;
}
- else if(memcmp(buf, "BRUNTIME", 8)!=0) {
+ else if (memcmp(buf, "BRUNTIME", 8)!=0) {
BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (not a blend file)", path);
goto cleanup;
}
@@ -135,7 +135,7 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
}
cleanup:
- if(fd!=-1)
+ if (fd!=-1)
close(fd);
return bfd;
diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c
index 03c5070c8f3..eeeaae937b1 100644
--- a/source/blender/blenloader/intern/undofile.c
+++ b/source/blender/blenloader/intern/undofile.c
@@ -55,8 +55,8 @@ void BLO_free_memfile(MemFile *memfile)
{
MemFileChunk *chunk;
- while( (chunk = (memfile->chunks.first) ) ) {
- if(chunk->ident==0) MEM_freeN(chunk->buf);
+ while ( (chunk = (memfile->chunks.first) ) ) {
+ if (chunk->ident==0) MEM_freeN(chunk->buf);
BLI_remlink(&memfile->chunks, chunk);
MEM_freeN(chunk);
}
@@ -72,14 +72,14 @@ void BLO_merge_memfile(MemFile *first, MemFile *second)
fc= first->chunks.first;
sc= second->chunks.first;
while (fc || sc) {
- if(fc && sc) {
- if(sc->ident) {
+ if (fc && sc) {
+ if (sc->ident) {
sc->ident= 0;
fc->ident= 1;
}
}
- if(fc) fc= fc->next;
- if(sc) sc= sc->next;
+ if (fc) fc= fc->next;
+ if (sc) sc= sc->next;
}
BLO_free_memfile(first);
@@ -89,8 +89,8 @@ static int my_memcmp(int *mem1, int *mem2, int len)
{
register int a= len, *mema= mem1, *memb= mem2;
- while(a--) {
- if( *mema != *memb) return 1;
+ while (a--) {
+ if ( *mema != *memb) return 1;
mema++;
memb++;
}
@@ -103,11 +103,11 @@ void add_memfilechunk(MemFile *compare, MemFile *current, char *buf, unsigned in
MemFileChunk *curchunk;
/* this function inits when compare != NULL or when current==NULL */
- if(compare) {
+ if (compare) {
compchunk= compare->chunks.first;
return;
}
- if(current==NULL) {
+ if (current==NULL) {
compchunk= NULL;
return;
}
@@ -119,9 +119,9 @@ void add_memfilechunk(MemFile *compare, MemFile *current, char *buf, unsigned in
BLI_addtail(&current->chunks, curchunk);
/* we compare compchunk with buf */
- if(compchunk) {
- if(compchunk->size == curchunk->size) {
- if( my_memcmp((int *)compchunk->buf, (int *)buf, size/4)==0) {
+ if (compchunk) {
+ if (compchunk->size == curchunk->size) {
+ if ( my_memcmp((int *)compchunk->buf, (int *)buf, size/4)==0) {
curchunk->buf= compchunk->buf;
curchunk->ident= 1;
}
@@ -130,7 +130,7 @@ void add_memfilechunk(MemFile *compare, MemFile *current, char *buf, unsigned in
}
/* not equal... */
- if(curchunk->buf==NULL) {
+ if (curchunk->buf==NULL) {
curchunk->buf= MEM_mallocN(size, "Chunk buffer");
memcpy(curchunk->buf, buf, size);
current->size += size;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index d7ecd9eac44..c1eab70a3ee 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -136,6 +136,7 @@ Any case: direct data is ALWAYS after the lib block
#include "DNA_movieclip_types.h"
#include "MEM_guardedalloc.h" // MEM_freeN
+#include "BLI_bitmap.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
#include "BLI_bpath.h"
@@ -210,7 +211,7 @@ static void writedata_do_write(WriteData *wd, void *mem, int memlen)
if (wd->error) return;
/* memory based save */
- if(wd->current) {
+ if (wd->current) {
add_memfilechunk(NULL, wd->current, mem, memlen);
}
else {
@@ -244,8 +245,8 @@ static void mywrite( WriteData *wd, void *adr, int len)
if (wd->error) return;
/* flush helps compression for undo-save */
- if(adr==MYWRITE_FLUSH) {
- if(wd->count) {
+ if (adr==MYWRITE_FLUSH) {
+ if (wd->count) {
writedata_do_write(wd, wd->buf, wd->count);
wd->count= 0;
}
@@ -256,8 +257,8 @@ static void mywrite( WriteData *wd, void *adr, int len)
/* if we have a single big chunk, write existing data in
* buffer and write out big chunk in smaller pieces */
- if(len>MYWRITE_MAX_CHUNK) {
- if(wd->count) {
+ if (len>MYWRITE_MAX_CHUNK) {
+ if (wd->count) {
writedata_do_write(wd, wd->buf, wd->count);
wd->count= 0;
}
@@ -267,13 +268,13 @@ static void mywrite( WriteData *wd, void *adr, int len)
writedata_do_write(wd, adr, writelen);
adr = (char*)adr + writelen;
len -= writelen;
- } while(len > 0);
+ } while (len > 0);
return;
}
/* if data would overflow buffer, write out the buffer */
- if(len+wd->count>MYWRITE_BUFFER_SIZE-1) {
+ if (len+wd->count>MYWRITE_BUFFER_SIZE-1) {
writedata_do_write(wd, wd->buf, wd->count);
wd->count= 0;
}
@@ -332,7 +333,7 @@ static void writestruct(WriteData *wd, int filecode, const char *structname, int
BHead bh;
short *sp;
- if(adr==NULL || nr==0) return;
+ if (adr==NULL || nr==0) return;
/* init BHead */
bh.code= filecode;
@@ -340,7 +341,7 @@ static void writestruct(WriteData *wd, int filecode, const char *structname, int
bh.nr= nr;
bh.SDNAnr= DNA_struct_find_nr(wd->sdna, structname);
- if(bh.SDNAnr== -1) {
+ if (bh.SDNAnr== -1) {
printf("error: can't find SDNA code <%s>\n", structname);
return;
}
@@ -348,7 +349,7 @@ static void writestruct(WriteData *wd, int filecode, const char *structname, int
bh.len= nr*wd->sdna->typelens[sp[0]];
- if(bh.len==0) return;
+ if (bh.len==0) return;
mywrite(wd, &bh, sizeof(BHead));
mywrite(wd, adr, bh.len);
@@ -358,8 +359,8 @@ static void writedata(WriteData *wd, int filecode, int len, void *adr) /* do not
{
BHead bh;
- if(adr==NULL) return;
- if(len==0) return;
+ if (adr==NULL) return;
+ if (len==0) return;
len+= 3;
len-= ( len % 4);
@@ -372,7 +373,7 @@ static void writedata(WriteData *wd, int filecode, int len, void *adr) /* do not
bh.len= len;
mywrite(wd, &bh, sizeof(BHead));
- if(len) mywrite(wd, adr, len);
+ if (len) mywrite(wd, adr, len);
}
/* *************** writing some direct data structs used in more code parts **************** */
@@ -386,11 +387,11 @@ static void IDP_WriteArray(IDProperty *prop, void *wd)
if (prop->data.pointer) {
writedata(wd, DATA, MEM_allocN_len(prop->data.pointer), prop->data.pointer);
- if(prop->subtype == IDP_GROUP) {
+ if (prop->subtype == IDP_GROUP) {
IDProperty **array= prop->data.pointer;
int a;
- for(a=0; a<prop->len; a++)
+ for (a=0; a<prop->len; a++)
IDP_WriteProperty(array[a], wd);
}
}
@@ -405,7 +406,7 @@ static void IDP_WriteIDPArray(IDProperty *prop, void *wd)
writestruct(wd, DATA, "IDProperty", prop->len, array);
- for(a=0; a<prop->len; a++)
+ for (a=0; a<prop->len; a++)
IDP_WriteProperty_OnlyData(&array[a], wd);
}
}
@@ -548,7 +549,7 @@ static void write_actions(WriteData *wd, ListBase *idbase)
bActionGroup *grp;
TimeMarker *marker;
- for(act=idbase->first; act; act= act->id.next) {
+ for (act=idbase->first; act; act= act->id.next) {
if (act->id.us>0 || wd->current) {
writestruct(wd, ID_AC, "bAction", 1, act);
if (act->id.properties) IDP_WriteProperty(act->id.properties, wd);
@@ -649,7 +650,7 @@ static void write_curvemapping(WriteData *wd, CurveMapping *cumap)
int a;
writestruct(wd, DATA, "CurveMapping", 1, cumap);
- for(a=0; a<CM_TOT; a++)
+ for (a=0; a<CM_TOT; a++)
writestruct(wd, DATA, "CurveMapPoint", cumap->cm[a].totpoint, cumap->cm[a].curve);
}
@@ -660,7 +661,7 @@ static void write_node_socket(WriteData *wd, bNodeSocket *sock)
/* forward compatibility code, so older blenders still open */
sock->stack_type = 1;
- if(sock->default_value) {
+ if (sock->default_value) {
bNodeSocketValueFloat *valfloat;
bNodeSocketValueVector *valvector;
bNodeSocketValueRGBA *valrgba;
@@ -702,27 +703,27 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
/* for link_list() speed, we write per list */
- if(ntree->adt) write_animdata(wd, ntree->adt);
+ if (ntree->adt) write_animdata(wd, ntree->adt);
- for(node= ntree->nodes.first; node; node= node->next)
+ for (node= ntree->nodes.first; node; node= node->next)
writestruct(wd, DATA, "bNode", 1, node);
- for(node= ntree->nodes.first; node; node= node->next) {
- for(sock= node->inputs.first; sock; sock= sock->next)
+ for (node= ntree->nodes.first; node; node= node->next) {
+ for (sock= node->inputs.first; sock; sock= sock->next)
write_node_socket(wd, sock);
- for(sock= node->outputs.first; sock; sock= sock->next)
+ for (sock= node->outputs.first; sock; sock= sock->next)
write_node_socket(wd, sock);
- if(node->storage && node->type!=NODE_DYNAMIC) {
+ if (node->storage && node->type!=NODE_DYNAMIC) {
/* could be handlerized at some point, now only 1 exception still */
- if(ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
+ if (ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
write_curvemapping(wd, node->storage);
- else if(ntree->type==NTREE_COMPOSIT && ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
+ else if (ntree->type==NTREE_COMPOSIT && ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
write_curvemapping(wd, node->storage);
- else if(ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) )
+ else if (ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) )
write_curvemapping(wd, node->storage);
- else if(ntree->type==NTREE_COMPOSIT && node->type==CMP_NODE_MOVIEDISTORTION)
+ else if (ntree->type==NTREE_COMPOSIT && node->type==CMP_NODE_MOVIEDISTORTION)
/* pass */;
else
writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
@@ -735,13 +736,13 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
}
}
- for(link= ntree->links.first; link; link= link->next)
+ for (link= ntree->links.first; link; link= link->next)
writestruct(wd, DATA, "bNodeLink", 1, link);
/* external sockets */
- for(sock= ntree->inputs.first; sock; sock= sock->next)
+ for (sock= ntree->inputs.first; sock; sock= sock->next)
write_node_socket(wd, sock);
- for(sock= ntree->outputs.first; sock; sock= sock->next)
+ for (sock= ntree->outputs.first; sock; sock= sock->next)
write_node_socket(wd, sock);
}
@@ -766,8 +767,8 @@ static void write_renderinfo(WriteData *wd, Main *mainvar) /* for renderdeamon
/* XXX in future, handle multiple windows with multiple screnes? */
current_screen_compat(mainvar, &curscreen);
- for(sce= mainvar->scene.first; sce; sce= sce->id.next) {
- if(sce->id.lib==NULL && ( sce==curscreen->scene || (sce->r.scemode & R_BG_RENDER)) ) {
+ for (sce= mainvar->scene.first; sce; sce= sce->id.next) {
+ if (sce->id.lib==NULL && ( sce==curscreen->scene || (sce->r.scemode & R_BG_RENDER)) ) {
data[0]= sce->r.sfra;
data[1]= sce->r.efra;
@@ -782,7 +783,7 @@ static void write_renderinfo(WriteData *wd, Main *mainvar) /* for renderdeamon
static void write_keymapitem(WriteData *wd, wmKeyMapItem *kmi)
{
writestruct(wd, DATA, "wmKeyMapItem", 1, kmi);
- if(kmi->properties)
+ if (kmi->properties)
IDP_WriteProperty(kmi->properties, wd);
}
@@ -797,28 +798,28 @@ static void write_userdef(WriteData *wd)
writestruct(wd, USER, "UserDef", 1, &U);
- for(btheme= U.themes.first; btheme; btheme=btheme->next)
+ for (btheme= U.themes.first; btheme; btheme=btheme->next)
writestruct(wd, DATA, "bTheme", 1, btheme);
- for(keymap= U.user_keymaps.first; keymap; keymap=keymap->next) {
+ for (keymap= U.user_keymaps.first; keymap; keymap=keymap->next) {
writestruct(wd, DATA, "wmKeyMap", 1, keymap);
- for(kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
+ for (kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
writestruct(wd, DATA, "wmKeyMapDiffItem", 1, kmdi);
- if(kmdi->remove_item)
+ if (kmdi->remove_item)
write_keymapitem(wd, kmdi->remove_item);
- if(kmdi->add_item)
+ if (kmdi->add_item)
write_keymapitem(wd, kmdi->add_item);
}
- for(kmi=keymap->items.first; kmi; kmi=kmi->next)
+ for (kmi=keymap->items.first; kmi; kmi=kmi->next)
write_keymapitem(wd, kmi);
}
- for(bext= U.addons.first; bext; bext=bext->next)
+ for (bext= U.addons.first; bext; bext=bext->next)
writestruct(wd, DATA, "bAddon", 1, bext);
- for(style= U.uistyles.first; style; style= style->next) {
+ for (style= U.uistyles.first; style; style= style->next) {
writestruct(wd, DATA, "uiStyle", 1, style);
}
}
@@ -830,7 +831,7 @@ static void write_boid_state(WriteData *wd, BoidState *state)
writestruct(wd, DATA, "BoidState", 1, state);
- for(; rule; rule=rule->next) {
+ for (; rule; rule=rule->next) {
switch(rule->type) {
case eBoidRuleType_Goal:
case eBoidRuleType_Avoid:
@@ -853,7 +854,7 @@ static void write_boid_state(WriteData *wd, BoidState *state)
break;
}
}
- //for(; cond; cond=cond->next)
+ //for (; cond; cond=cond->next)
// writestruct(wd, DATA, "BoidCondition", 1, cond);
}
@@ -877,28 +878,28 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches)
PointCache *cache = ptcaches->first;
int i;
- for(; cache; cache=cache->next) {
+ for (; cache; cache=cache->next) {
writestruct(wd, DATA, "PointCache", 1, cache);
- if((cache->flag & PTCACHE_DISK_CACHE)==0) {
+ if ((cache->flag & PTCACHE_DISK_CACHE)==0) {
PTCacheMem *pm = cache->mem_cache.first;
- for(; pm; pm=pm->next) {
+ for (; pm; pm=pm->next) {
PTCacheExtra *extra = pm->extradata.first;
writestruct(wd, DATA, "PTCacheMem", 1, pm);
- for(i=0; i<BPHYS_TOT_DATA; i++) {
- if(pm->data[i] && pm->data_types & (1<<i)) {
- if(ptcache_data_struct[i][0]=='\0')
+ for (i=0; i<BPHYS_TOT_DATA; i++) {
+ if (pm->data[i] && pm->data_types & (1<<i)) {
+ if (ptcache_data_struct[i][0]=='\0')
writedata(wd, DATA, MEM_allocN_len(pm->data[i]), pm->data[i]);
else
writestruct(wd, DATA, ptcache_data_struct[i], pm->totpoint, pm->data[i]);
}
}
- for(; extra; extra=extra->next) {
- if(ptcache_extra_struct[extra->type][0]=='\0')
+ for (; extra; extra=extra->next) {
+ if (ptcache_extra_struct[extra->type][0]=='\0')
continue;
writestruct(wd, DATA, "PTCacheExtra", 1, extra);
writestruct(wd, DATA, ptcache_extra_struct[extra->type], extra->totdata, extra->data);
@@ -915,8 +916,8 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
int a;
part= idbase->first;
- while(part) {
- if(part->id.us>0 || wd->current) {
+ while (part) {
+ if (part->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_PA, "ParticleSettings", 1, part);
if (part->id.properties) IDP_WriteProperty(part->id.properties, wd);
@@ -926,12 +927,12 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
writestruct(wd, DATA, "EffectorWeights", 1, part->effector_weights);
dw = part->dupliweights.first;
- for(; dw; dw=dw->next) {
+ for (; dw; dw=dw->next) {
/* update indices */
dw->index = 0;
- if(part->dup_group) { /* can be NULL if lining fails or set to None */
+ if (part->dup_group) { /* can be NULL if lining fails or set to None */
go = part->dup_group->gobject.first;
- while(go && go->ob != dw->ob) {
+ while (go && go->ob != dw->ob) {
go=go->next;
dw->index++;
}
@@ -939,20 +940,20 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
writestruct(wd, DATA, "ParticleDupliWeight", 1, dw);
}
- if(part->boids && part->phystype == PART_PHYS_BOIDS) {
+ if (part->boids && part->phystype == PART_PHYS_BOIDS) {
BoidState *state = part->boids->states.first;
writestruct(wd, DATA, "BoidSettings", 1, part->boids);
- for(; state; state=state->next)
+ for (; state; state=state->next)
write_boid_state(wd, state);
}
- if(part->fluid && part->phystype == PART_PHYS_FLUID){
+ if (part->fluid && part->phystype == PART_PHYS_FLUID) {
writestruct(wd, DATA, "SPHFluidSettings", 1, part->fluid);
}
- for(a=0; a<MAX_MTEX; a++) {
- if(part->mtex[a]) writestruct(wd, DATA, "MTex", 1, part->mtex[a]);
+ for (a=0; a<MAX_MTEX; a++) {
+ if (part->mtex[a]) writestruct(wd, DATA, "MTex", 1, part->mtex[a]);
}
}
part= part->id.next;
@@ -964,32 +965,32 @@ static void write_particlesystems(WriteData *wd, ListBase *particles)
ParticleTarget *pt;
int a;
- for(; psys; psys=psys->next) {
+ for (; psys; psys=psys->next) {
writestruct(wd, DATA, "ParticleSystem", 1, psys);
- if(psys->particles) {
+ if (psys->particles) {
writestruct(wd, DATA, "ParticleData", psys->totpart ,psys->particles);
- if(psys->particles->hair) {
+ if (psys->particles->hair) {
ParticleData *pa = psys->particles;
- for(a=0; a<psys->totpart; a++, pa++)
+ for (a=0; a<psys->totpart; a++, pa++)
writestruct(wd, DATA, "HairKey", pa->totkey, pa->hair);
}
- if(psys->particles->boid && psys->part->phystype == PART_PHYS_BOIDS)
+ if (psys->particles->boid && psys->part->phystype == PART_PHYS_BOIDS)
writestruct(wd, DATA, "BoidParticle", psys->totpart, psys->particles->boid);
- if(psys->part->fluid && psys->part->phystype == PART_PHYS_FLUID && (psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS))
+ if (psys->part->fluid && psys->part->phystype == PART_PHYS_FLUID && (psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS))
writestruct(wd, DATA, "ParticleSpring", psys->tot_fluidsprings, psys->fluid_springs);
}
pt = psys->targets.first;
- for(; pt; pt=pt->next)
+ for (; pt; pt=pt->next)
writestruct(wd, DATA, "ParticleTarget", 1, pt);
- if(psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild ,psys->child);
+ if (psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild ,psys->child);
- if(psys->clmd) {
+ if (psys->clmd) {
writestruct(wd, DATA, "ClothModifierData", 1, psys->clmd);
writestruct(wd, DATA, "ClothSimSettings", 1, psys->clmd->sim_parms);
writestruct(wd, DATA, "ClothCollSettings", 1, psys->clmd->coll_parms);
@@ -1004,10 +1005,10 @@ static void write_properties(WriteData *wd, ListBase *lb)
bProperty *prop;
prop= lb->first;
- while(prop) {
+ while (prop) {
writestruct(wd, DATA, "bProperty", 1, prop);
- if(prop->poin && prop->poin != &prop->data)
+ if (prop->poin && prop->poin != &prop->data)
writedata(wd, DATA, MEM_allocN_len(prop->poin), prop->poin);
prop= prop->next;
@@ -1019,7 +1020,7 @@ static void write_sensors(WriteData *wd, ListBase *lb)
bSensor *sens;
sens= lb->first;
- while(sens) {
+ while (sens) {
writestruct(wd, DATA, "bSensor", 1, sens);
writedata(wd, DATA, sizeof(void *)*sens->totlinks, sens->links);
@@ -1080,7 +1081,7 @@ static void write_controllers(WriteData *wd, ListBase *lb)
bController *cont;
cont= lb->first;
- while(cont) {
+ while (cont) {
writestruct(wd, DATA, "bController", 1, cont);
writedata(wd, DATA, sizeof(void *)*cont->totlinks, cont->links);
@@ -1105,7 +1106,7 @@ static void write_actuators(WriteData *wd, ListBase *lb)
bActuator *act;
act= lb->first;
- while(act) {
+ while (act) {
writestruct(wd, DATA, "bActuator", 1, act);
switch(act->type) {
@@ -1299,7 +1300,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writedata(wd, DATA, sizeof(int)*hmd->totindex, hmd->indexar);
}
- else if(md->type==eModifierType_Cloth) {
+ else if (md->type==eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData*) md;
writestruct(wd, DATA, "ClothSimSettings", 1, clmd->sim_parms);
@@ -1307,12 +1308,12 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writestruct(wd, DATA, "EffectorWeights", 1, clmd->sim_parms->effector_weights);
write_pointcaches(wd, &clmd->ptcaches);
}
- else if(md->type==eModifierType_Smoke) {
+ else if (md->type==eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData*) md;
- if(smd->type & MOD_SMOKE_TYPE_DOMAIN)
+ if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
{
- if(smd->domain)
+ if (smd->domain)
{
write_pointcaches(wd, &(smd->domain->ptcaches[0]));
@@ -1326,7 +1327,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writestruct(wd, DATA, "SmokeDomainSettings", 1, smd->domain);
- if(smd->domain) {
+ if (smd->domain) {
/* cleanup the fake pointcache */
BKE_ptcache_free_list(&smd->domain->ptcaches[1]);
smd->domain->point_cache[1] = NULL;
@@ -1334,20 +1335,20 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writestruct(wd, DATA, "EffectorWeights", 1, smd->domain->effector_weights);
}
}
- else if(smd->type & MOD_SMOKE_TYPE_FLOW)
+ else if (smd->type & MOD_SMOKE_TYPE_FLOW)
writestruct(wd, DATA, "SmokeFlowSettings", 1, smd->flow);
- else if(smd->type & MOD_SMOKE_TYPE_COLL)
+ else if (smd->type & MOD_SMOKE_TYPE_COLL)
writestruct(wd, DATA, "SmokeCollSettings", 1, smd->coll);
}
- else if(md->type==eModifierType_Fluidsim) {
+ else if (md->type==eModifierType_Fluidsim) {
FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
writestruct(wd, DATA, "FluidsimSettings", 1, fluidmd->fss);
}
- else if(md->type==eModifierType_DynamicPaint) {
+ 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);
@@ -1362,7 +1363,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writestruct(wd, DATA, "EffectorWeights", 1, surface->effector_weights);
}
}
- if(pmd->brush)
+ if (pmd->brush)
{
writestruct(wd, DATA, "DynamicPaintBrushSettings", 1, pmd->brush);
writestruct(wd, DATA, "ColorBand", 1, pmd->brush->paint_ramp);
@@ -1394,7 +1395,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
}
else if (md->type==eModifierType_Warp) {
WarpModifierData *tmd = (WarpModifierData*) md;
- if(tmd->curfalloff) {
+ if (tmd->curfalloff) {
write_curvemapping(wd, tmd->curfalloff);
}
}
@@ -1412,8 +1413,8 @@ static void write_objects(WriteData *wd, ListBase *idbase)
Object *ob;
ob= idbase->first;
- while(ob) {
- if(ob->id.us>0 || wd->current) {
+ while (ob) {
+ if (ob->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_OB, "Object", 1, ob);
@@ -1446,7 +1447,7 @@ static void write_objects(WriteData *wd, ListBase *idbase)
writestruct(wd, DATA, "PartDeflect", 1, ob->pd);
writestruct(wd, DATA, "SoftBody", 1, ob->soft);
- if(ob->soft) {
+ if (ob->soft) {
write_pointcaches(wd, &ob->soft->ptcaches);
writestruct(wd, DATA, "EffectorWeights", 1, ob->soft->effector_weights);
}
@@ -1469,8 +1470,8 @@ static void write_vfonts(WriteData *wd, ListBase *idbase)
PackedFile * pf;
vf= idbase->first;
- while(vf) {
- if(vf->id.us>0 || wd->current) {
+ while (vf) {
+ if (vf->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_VF, "VFont", 1, vf);
if (vf->id.properties) IDP_WriteProperty(vf->id.properties, wd);
@@ -1495,8 +1496,8 @@ static void write_keys(WriteData *wd, ListBase *idbase)
KeyBlock *kb;
key= idbase->first;
- while(key) {
- if(key->id.us>0 || wd->current) {
+ while (key) {
+ if (key->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_KE, "Key", 1, key);
if (key->id.properties) IDP_WriteProperty(key->id.properties, wd);
@@ -1505,9 +1506,9 @@ static void write_keys(WriteData *wd, ListBase *idbase)
/* direct data */
kb= key->block.first;
- while(kb) {
+ while (kb) {
writestruct(wd, DATA, "KeyBlock", 1, kb);
- if(kb->data) writedata(wd, DATA, kb->totelem*key->elemsize, kb->data);
+ if (kb->data) writedata(wd, DATA, kb->totelem*key->elemsize, kb->data);
kb= kb->next;
}
}
@@ -1523,8 +1524,8 @@ static void write_cameras(WriteData *wd, ListBase *idbase)
Camera *cam;
cam= idbase->first;
- while(cam) {
- if(cam->id.us>0 || wd->current) {
+ while (cam) {
+ if (cam->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_CA, "Camera", 1, cam);
if (cam->id.properties) IDP_WriteProperty(cam->id.properties, wd);
@@ -1542,8 +1543,8 @@ static void write_mballs(WriteData *wd, ListBase *idbase)
MetaElem *ml;
mb= idbase->first;
- while(mb) {
- if(mb->id.us>0 || wd->current) {
+ while (mb) {
+ if (mb->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_MB, "MetaBall", 1, mb);
if (mb->id.properties) IDP_WriteProperty(mb->id.properties, wd);
@@ -1553,7 +1554,7 @@ static void write_mballs(WriteData *wd, ListBase *idbase)
if (mb->adt) write_animdata(wd, mb->adt);
ml= mb->elems.first;
- while(ml) {
+ while (ml) {
writestruct(wd, DATA, "MetaElem", 1, ml);
ml= ml->next;
}
@@ -1575,8 +1576,8 @@ static void write_curves(WriteData *wd, ListBase *idbase)
Nurb *nu;
cu= idbase->first;
- while(cu) {
- if(cu->id.us>0 || wd->current) {
+ while (cu) {
+ if (cu->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_CU, "Curve", 1, cu);
@@ -1585,7 +1586,7 @@ static void write_curves(WriteData *wd, ListBase *idbase)
if (cu->id.properties) IDP_WriteProperty(cu->id.properties, wd);
if (cu->adt) write_animdata(wd, cu->adt);
- if(cu->vfont) {
+ if (cu->vfont) {
writedata(wd, DATA, amount_of_chars(cu->str)+1, cu->str);
writestruct(wd, DATA, "CharInfo", cu->len+1, cu->strinfo);
writestruct(wd, DATA, "TextBox", cu->totbox, cu->tb);
@@ -1593,18 +1594,18 @@ static void write_curves(WriteData *wd, ListBase *idbase)
else {
/* is also the order of reading */
nu= cu->nurb.first;
- while(nu) {
+ while (nu) {
writestruct(wd, DATA, "Nurb", 1, nu);
nu= nu->next;
}
nu= cu->nurb.first;
- while(nu) {
- if(nu->type == CU_BEZIER)
+ while (nu) {
+ if (nu->type == CU_BEZIER)
writestruct(wd, DATA, "BezTriple", nu->pntsu, nu->bezt);
else {
writestruct(wd, DATA, "BPoint", nu->pntsu*nu->pntsv, nu->bp);
- if(nu->knotsu) writedata(wd, DATA, KNOTSU(nu)*sizeof(float), nu->knotsu);
- if(nu->knotsv) writedata(wd, DATA, KNOTSV(nu)*sizeof(float), nu->knotsv);
+ if (nu->knotsu) writedata(wd, DATA, KNOTSU(nu)*sizeof(float), nu->knotsu);
+ if (nu->knotsv) writedata(wd, DATA, KNOTSV(nu)*sizeof(float), nu->knotsv);
}
nu= nu->next;
}
@@ -1635,15 +1636,19 @@ static void write_dverts(WriteData *wd, int count, MDeformVert *dvlist)
static void write_mdisps(WriteData *wd, int count, MDisps *mdlist, int external)
{
- if(mdlist) {
+ if (mdlist) {
int i;
writestruct(wd, DATA, "MDisps", count, mdlist);
- if(!external) {
- for(i = 0; i < count; ++i) {
- if(mdlist[i].disps)
- writedata(wd, DATA, sizeof(float)*3*mdlist[i].totdisp, mdlist[i].disps);
+ for (i = 0; i < count; ++i) {
+ MDisps *md = &mdlist[i];
+ if (md->disps) {
+ if (!external)
+ writedata(wd, DATA, sizeof(float)*3*md->totdisp, md->disps);
}
+
+ if (md->hidden)
+ writedata(wd, DATA, BLI_BITMAP_SIZE(md->totdisp), md->hidden);
}
}
}
@@ -1653,7 +1658,7 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
int i;
/* write external customdata (not for undo) */
- if(data->external && !wd->current)
+ if (data->external && !wd->current)
CustomData_external_write(data, id, CD_MASK_MESH, count, 0);
writestruct(wd, DATA, "CustomDataLayer", data->maxlayer, data->layers);
@@ -1687,7 +1692,7 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
}
}
- if(data->external)
+ if (data->external)
writestruct(wd, DATA, "CustomDataExternal", 1, data->external);
}
@@ -1701,14 +1706,14 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
#endif
mesh= idbase->first;
- while(mesh) {
- if(mesh->id.us>0 || wd->current) {
+ while (mesh) {
+ if (mesh->id.us>0 || wd->current) {
/* write LibData */
if (!save_for_old_blender) {
#ifdef USE_BMESH_SAVE_WITHOUT_MFACE
Mesh backup_mesh = {{0}};
- /* cache only - dont write */
+ /* cache only - don't write */
backup_mesh.mface = mesh->mface;
mesh->mface = NULL;
/* -- */
@@ -1733,7 +1738,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
write_customdata(wd, &mesh->id, mesh->totpoly, &mesh->pdata, -1, 0);
#ifdef USE_BMESH_SAVE_WITHOUT_MFACE
- /* cache only - dont write */
+ /* cache only - don't write */
mesh->mface = backup_mesh.mface;
/* -- */
mesh->totface = backup_mesh.totface;
@@ -1833,8 +1838,8 @@ static void write_lattices(WriteData *wd, ListBase *idbase)
Lattice *lt;
lt= idbase->first;
- while(lt) {
- if(lt->id.us>0 || wd->current) {
+ while (lt) {
+ if (lt->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_LT, "Lattice", 1, lt);
if (lt->id.properties) IDP_WriteProperty(lt->id.properties, wd);
@@ -1884,8 +1889,8 @@ static void write_images(WriteData *wd, ListBase *idbase)
ima= idbase->first;
- while(ima) {
- if(ima->id.us>0 || wd->current) {
+ while (ima) {
+ if (ima->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_IM, "Image", 1, ima);
if (ima->id.properties) IDP_WriteProperty(ima->id.properties, wd);
@@ -1909,8 +1914,8 @@ static void write_textures(WriteData *wd, ListBase *idbase)
Tex *tex;
tex= idbase->first;
- while(tex) {
- if(tex->id.us>0 || wd->current) {
+ while (tex) {
+ if (tex->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_TE, "Tex", 1, tex);
if (tex->id.properties) IDP_WriteProperty(tex->id.properties, wd);
@@ -1918,19 +1923,19 @@ static void write_textures(WriteData *wd, ListBase *idbase)
if (tex->adt) write_animdata(wd, tex->adt);
/* direct data */
- if(tex->type == TEX_PLUGIN && tex->plugin) writestruct(wd, DATA, "PluginTex", 1, tex->plugin);
- if(tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
- if(tex->type == TEX_ENVMAP && tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
- if(tex->type == TEX_POINTDENSITY && tex->pd) {
+ if (tex->type == TEX_PLUGIN && tex->plugin) writestruct(wd, DATA, "PluginTex", 1, tex->plugin);
+ if (tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
+ if (tex->type == TEX_ENVMAP && tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
+ if (tex->type == TEX_POINTDENSITY && tex->pd) {
writestruct(wd, DATA, "PointDensity", 1, tex->pd);
- if(tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba);
- if(tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve);
+ if (tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba);
+ if (tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve);
}
- if(tex->type == TEX_VOXELDATA) writestruct(wd, DATA, "VoxelData", 1, tex->vd);
- if(tex->type == TEX_OCEAN && tex->ot) writestruct(wd, DATA, "OceanTex", 1, tex->ot);
+ if (tex->type == TEX_VOXELDATA) writestruct(wd, DATA, "VoxelData", 1, tex->vd);
+ if (tex->type == TEX_OCEAN && tex->ot) writestruct(wd, DATA, "OceanTex", 1, tex->ot);
/* nodetree is integral part of texture, no libdata */
- if(tex->nodetree) {
+ if (tex->nodetree) {
writestruct(wd, DATA, "bNodeTree", 1, tex->nodetree);
write_nodetree(wd, tex->nodetree);
}
@@ -1950,8 +1955,8 @@ static void write_materials(WriteData *wd, ListBase *idbase)
int a;
ma= idbase->first;
- while(ma) {
- if(ma->id.us>0 || wd->current) {
+ while (ma) {
+ if (ma->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_MA, "Material", 1, ma);
@@ -1963,15 +1968,15 @@ static void write_materials(WriteData *wd, ListBase *idbase)
if (ma->adt) write_animdata(wd, ma->adt);
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) writestruct(wd, DATA, "MTex", 1, ma->mtex[a]);
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a]) writestruct(wd, DATA, "MTex", 1, ma->mtex[a]);
}
- if(ma->ramp_col) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_col);
- if(ma->ramp_spec) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_spec);
+ if (ma->ramp_col) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_col);
+ if (ma->ramp_spec) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_spec);
/* nodetree is integral part of material, no libdata */
- if(ma->nodetree) {
+ if (ma->nodetree) {
writestruct(wd, DATA, "bNodeTree", 1, ma->nodetree);
write_nodetree(wd, ma->nodetree);
}
@@ -1988,20 +1993,20 @@ static void write_worlds(WriteData *wd, ListBase *idbase)
int a;
wrld= idbase->first;
- while(wrld) {
- if(wrld->id.us>0 || wd->current) {
+ while (wrld) {
+ if (wrld->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_WO, "World", 1, wrld);
if (wrld->id.properties) IDP_WriteProperty(wrld->id.properties, wd);
if (wrld->adt) write_animdata(wd, wrld->adt);
- for(a=0; a<MAX_MTEX; a++) {
- if(wrld->mtex[a]) writestruct(wd, DATA, "MTex", 1, wrld->mtex[a]);
+ for (a=0; a<MAX_MTEX; a++) {
+ if (wrld->mtex[a]) writestruct(wd, DATA, "MTex", 1, wrld->mtex[a]);
}
/* nodetree is integral part of lamps, no libdata */
- if(wrld->nodetree) {
+ if (wrld->nodetree) {
writestruct(wd, DATA, "bNodeTree", 1, wrld->nodetree);
write_nodetree(wd, wrld->nodetree);
}
@@ -2018,8 +2023,8 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
int a;
la= idbase->first;
- while(la) {
- if(la->id.us>0 || wd->current) {
+ while (la) {
+ if (la->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_LA, "Lamp", 1, la);
if (la->id.properties) IDP_WriteProperty(la->id.properties, wd);
@@ -2027,15 +2032,15 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
if (la->adt) write_animdata(wd, la->adt);
/* direct data */
- for(a=0; a<MAX_MTEX; a++) {
- if(la->mtex[a]) writestruct(wd, DATA, "MTex", 1, la->mtex[a]);
+ for (a=0; a<MAX_MTEX; a++) {
+ if (la->mtex[a]) writestruct(wd, DATA, "MTex", 1, la->mtex[a]);
}
- if(la->curfalloff)
+ if (la->curfalloff)
write_curvemapping(wd, la->curfalloff);
/* nodetree is integral part of lamps, no libdata */
- if(la->nodetree) {
+ if (la->nodetree) {
writestruct(wd, DATA, "bNodeTree", 1, la->nodetree);
write_nodetree(wd, la->nodetree);
}
@@ -2064,7 +2069,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
ToolSettings *tos;
sce= scebase->first;
- while(sce) {
+ while (sce) {
/* write LibData */
writestruct(wd, ID_SCE, "Scene", 1, sce);
if (sce->id.properties) IDP_WriteProperty(sce->id.properties, wd);
@@ -2074,47 +2079,47 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
/* direct data */
base= sce->base.first;
- while(base) {
+ while (base) {
writestruct(wd, DATA, "Base", 1, base);
base= base->next;
}
tos = sce->toolsettings;
writestruct(wd, DATA, "ToolSettings", 1, tos);
- if(tos->vpaint) {
+ if (tos->vpaint) {
writestruct(wd, DATA, "VPaint", 1, tos->vpaint);
}
- if(tos->wpaint) {
+ if (tos->wpaint) {
writestruct(wd, DATA, "VPaint", 1, tos->wpaint);
}
- if(tos->sculpt) {
+ if (tos->sculpt) {
writestruct(wd, DATA, "Sculpt", 1, tos->sculpt);
}
- if(tos->uvsculpt) {
+ if (tos->uvsculpt) {
writestruct(wd, DATA, "UvSculpt", 1, tos->uvsculpt);
}
// write_paint(wd, &tos->imapaint.paint);
ed= sce->ed;
- if(ed) {
+ if (ed) {
writestruct(wd, DATA, "Editing", 1, ed);
/* reset write flags too */
SEQ_BEGIN(ed, seq) {
- if(seq->strip) seq->strip->done= 0;
+ if (seq->strip) seq->strip->done= 0;
writestruct(wd, DATA, "Sequence", 1, seq);
}
SEQ_END
SEQ_BEGIN(ed, seq) {
- if(seq->strip && seq->strip->done==0) {
+ 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){
+ if (seq->plugin) writestruct(wd, DATA, "PluginSeq", 1, seq->plugin);
+ if (seq->effectdata) {
+ switch(seq->type) {
case SEQ_COLOR:
writestruct(wd, DATA, "SolidColorVars", 1, seq->effectdata);
break;
@@ -2135,21 +2140,21 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
strip= seq->strip;
writestruct(wd, DATA, "Strip", 1, strip);
- if(seq->flag & SEQ_USE_CROP && strip->crop) {
+ if (seq->flag & SEQ_USE_CROP && strip->crop) {
writestruct(wd, DATA, "StripCrop", 1, strip->crop);
}
- if(seq->flag & SEQ_USE_TRANSFORM && strip->transform) {
+ if (seq->flag & SEQ_USE_TRANSFORM && strip->transform) {
writestruct(wd, DATA, "StripTransform", 1, strip->transform);
}
- if(seq->flag & SEQ_USE_PROXY && strip->proxy) {
+ if (seq->flag & SEQ_USE_PROXY && strip->proxy) {
writestruct(wd, DATA, "StripProxy", 1, strip->proxy);
}
- if(seq->flag & SEQ_USE_COLOR_BALANCE && strip->color_balance) {
+ if (seq->flag & SEQ_USE_COLOR_BALANCE && strip->color_balance) {
writestruct(wd, DATA, "StripColorBalance", 1, strip->color_balance);
}
- if(seq->type==SEQ_IMAGE)
+ if (seq->type==SEQ_IMAGE)
writestruct(wd, DATA, "StripElem", MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem), strip->stripdata);
- else if(seq->type==SEQ_MOVIE || seq->type==SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND)
+ else if (seq->type==SEQ_MOVIE || seq->type==SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND)
writestruct(wd, DATA, "StripElem", 1, strip->stripdata);
strip->done= 1;
@@ -2158,7 +2163,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
SEQ_END
/* new; meta stack too, even when its nasty restore code */
- for(ms= ed->metastack.first; ms; ms= ms->next) {
+ for (ms= ed->metastack.first; ms; ms= ms->next) {
writestruct(wd, DATA, "MetaStack", 1, ms);
}
}
@@ -2178,14 +2183,14 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
}
/* writing dynamic list of TimeMarkers to the blend file */
- for(marker= sce->markers.first; marker; marker= marker->next)
+ for (marker= sce->markers.first; marker; marker= marker->next)
writestruct(wd, DATA, "TimeMarker", 1, marker);
/* writing dynamic list of TransformOrientations to the blend file */
- for(ts = sce->transform_spaces.first; ts; ts = ts->next)
+ for (ts = sce->transform_spaces.first; ts; ts = ts->next)
writestruct(wd, DATA, "TransformOrientation", 1, ts);
- for(srl= sce->r.layers.first; srl; srl= srl->next) {
+ for (srl= sce->r.layers.first; srl; srl= srl->next) {
writestruct(wd, DATA, "SceneRenderLayer", 1, srl);
for(fmc= srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) {
@@ -2198,7 +2203,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
}
- if(sce->nodetree) {
+ if (sce->nodetree) {
writestruct(wd, DATA, "bNodeTree", 1, sce->nodetree);
write_nodetree(wd, sce->nodetree);
}
@@ -2245,10 +2250,10 @@ static void write_windowmanagers(WriteData *wd, ListBase *lb)
wmWindowManager *wm;
wmWindow *win;
- for(wm= lb->first; wm; wm= wm->id.next) {
+ for (wm= lb->first; wm; wm= wm->id.next) {
writestruct(wd, ID_WM, "wmWindowManager", 1, wm);
- for(win= wm->windows.first; win; win= win->next)
+ for (win= wm->windows.first; win; win= win->next)
writestruct(wd, DATA, "wmWindow", 1, win);
}
}
@@ -2257,16 +2262,16 @@ static void write_region(WriteData *wd, ARegion *ar, int spacetype)
{
writestruct(wd, DATA, "ARegion", 1, ar);
- if(ar->regiondata) {
+ if (ar->regiondata) {
switch(spacetype) {
case SPACE_VIEW3D:
- if(ar->regiontype==RGN_TYPE_WINDOW) {
+ if (ar->regiontype==RGN_TYPE_WINDOW) {
RegionView3D *rv3d= ar->regiondata;
writestruct(wd, DATA, "RegionView3D", 1, rv3d);
- if(rv3d->localvd)
+ if (rv3d->localvd)
writestruct(wd, DATA, "RegionView3D", 1, rv3d->localvd);
- if(rv3d->clipbb)
+ if (rv3d->clipbb)
writestruct(wd, DATA, "BoundBox", 1, rv3d->clipbb);
}
@@ -2287,7 +2292,7 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
ScrEdge *se;
sc= scrbase->first;
- while(sc) {
+ while (sc) {
/* write LibData */
/* in 2.50+ files, the file identifier for screens is patched, forward compatibility */
@@ -2296,40 +2301,40 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
IDP_WriteProperty(sc->id.properties, wd);
/* direct data */
- for(sv= sc->vertbase.first; sv; sv= sv->next)
+ for (sv= sc->vertbase.first; sv; sv= sv->next)
writestruct(wd, DATA, "ScrVert", 1, sv);
- for(se= sc->edgebase.first; se; se= se->next)
+ for (se= sc->edgebase.first; se; se= se->next)
writestruct(wd, DATA, "ScrEdge", 1, se);
- for(sa= sc->areabase.first; sa; sa= sa->next) {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
Panel *pa;
ARegion *ar;
writestruct(wd, DATA, "ScrArea", 1, sa);
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
write_region(wd, ar, sa->spacetype);
- for(pa= ar->panels.first; pa; pa= pa->next)
+ for (pa= ar->panels.first; pa; pa= pa->next)
writestruct(wd, DATA, "Panel", 1, pa);
}
sl= sa->spacedata.first;
- while(sl) {
- for(ar= sl->regionbase.first; ar; ar= ar->next)
+ while (sl) {
+ for (ar= sl->regionbase.first; ar; ar= ar->next)
write_region(wd, ar, sl->spacetype);
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *) sl;
BGpic *bgpic;
writestruct(wd, DATA, "View3D", 1, v3d);
for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
writestruct(wd, DATA, "BGpic", 1, bgpic);
- if(v3d->localvd) writestruct(wd, DATA, "View3D", 1, v3d->localvd);
+ if (v3d->localvd) writestruct(wd, DATA, "View3D", 1, v3d->localvd);
}
- else if(sl->spacetype==SPACE_IPO) {
+ else if (sl->spacetype==SPACE_IPO) {
SpaceIpo *sipo= (SpaceIpo *)sl;
ListBase tmpGhosts = sipo->ghostCurves;
@@ -2337,70 +2342,70 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
sipo->ghostCurves.first= sipo->ghostCurves.last= NULL;
writestruct(wd, DATA, "SpaceIpo", 1, sl);
- if(sipo->ads) writestruct(wd, DATA, "bDopeSheet", 1, sipo->ads);
+ if (sipo->ads) writestruct(wd, DATA, "bDopeSheet", 1, sipo->ads);
/* reenable ghost curves */
sipo->ghostCurves= tmpGhosts;
}
- else if(sl->spacetype==SPACE_BUTS) {
+ else if (sl->spacetype==SPACE_BUTS) {
writestruct(wd, DATA, "SpaceButs", 1, sl);
}
- else if(sl->spacetype==SPACE_FILE) {
+ else if (sl->spacetype==SPACE_FILE) {
SpaceFile *sfile= (SpaceFile *)sl;
writestruct(wd, DATA, "SpaceFile", 1, sl);
- if(sfile->params)
+ if (sfile->params)
writestruct(wd, DATA, "FileSelectParams", 1, sfile->params);
}
- else if(sl->spacetype==SPACE_SEQ) {
+ else if (sl->spacetype==SPACE_SEQ) {
writestruct(wd, DATA, "SpaceSeq", 1, sl);
}
- else if(sl->spacetype==SPACE_OUTLINER) {
+ else if (sl->spacetype==SPACE_OUTLINER) {
SpaceOops *so= (SpaceOops *)sl;
writestruct(wd, DATA, "SpaceOops", 1, so);
/* outliner */
- if(so->treestore) {
+ if (so->treestore) {
writestruct(wd, DATA, "TreeStore", 1, so->treestore);
- if(so->treestore->data)
+ if (so->treestore->data)
writestruct(wd, DATA, "TreeStoreElem", so->treestore->usedelem, so->treestore->data);
}
}
- else if(sl->spacetype==SPACE_IMAGE) {
+ else if (sl->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sl;
writestruct(wd, DATA, "SpaceImage", 1, sl);
- if(sima->cumap)
+ if (sima->cumap)
write_curvemapping(wd, sima->cumap);
}
- else if(sl->spacetype==SPACE_TEXT) {
+ else if (sl->spacetype==SPACE_TEXT) {
writestruct(wd, DATA, "SpaceText", 1, sl);
}
- else if(sl->spacetype==SPACE_SCRIPT) {
+ else if (sl->spacetype==SPACE_SCRIPT) {
SpaceScript *scr = (SpaceScript*)sl;
scr->but_refs = NULL;
writestruct(wd, DATA, "SpaceScript", 1, sl);
}
- else if(sl->spacetype==SPACE_ACTION) {
+ else if (sl->spacetype==SPACE_ACTION) {
writestruct(wd, DATA, "SpaceAction", 1, sl);
}
- else if(sl->spacetype==SPACE_NLA){
+ else if (sl->spacetype==SPACE_NLA) {
SpaceNla *snla= (SpaceNla *)sl;
writestruct(wd, DATA, "SpaceNla", 1, snla);
- if(snla->ads) writestruct(wd, DATA, "bDopeSheet", 1, snla->ads);
+ if (snla->ads) writestruct(wd, DATA, "bDopeSheet", 1, snla->ads);
}
- else if(sl->spacetype==SPACE_TIME){
+ else if (sl->spacetype==SPACE_TIME) {
writestruct(wd, DATA, "SpaceTime", 1, sl);
}
- else if(sl->spacetype==SPACE_NODE){
+ else if (sl->spacetype==SPACE_NODE) {
writestruct(wd, DATA, "SpaceNode", 1, sl);
}
- else if(sl->spacetype==SPACE_LOGIC){
+ else if (sl->spacetype==SPACE_LOGIC) {
writestruct(wd, DATA, "SpaceLogic", 1, sl);
}
- else if(sl->spacetype==SPACE_CONSOLE) {
+ else if (sl->spacetype==SPACE_CONSOLE) {
SpaceConsole *con = (SpaceConsole*)sl;
ConsoleLine *cl;
@@ -2412,10 +2417,10 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
writestruct(wd, DATA, "SpaceConsole", 1, sl);
}
- else if(sl->spacetype==SPACE_USERPREF) {
+ else if (sl->spacetype==SPACE_USERPREF) {
writestruct(wd, DATA, "SpaceUserPref", 1, sl);
}
- else if(sl->spacetype==SPACE_CLIP) {
+ else if (sl->spacetype==SPACE_CLIP) {
writestruct(wd, DATA, "SpaceClip", 1, sl);
}
@@ -2433,28 +2438,28 @@ static void write_libraries(WriteData *wd, Main *main)
ID *id;
int a, tot, foundone;
- for(; main; main= main->next) {
+ for (; main; main= main->next) {
a=tot= set_listbasepointers(main, lbarray);
/* test: is lib being used */
foundone= 0;
- while(tot--) {
- for(id= lbarray[tot]->first; id; id= id->next) {
- if(id->us>0 && (id->flag & LIB_EXTERN)) {
+ while (tot--) {
+ for (id= lbarray[tot]->first; id; id= id->next) {
+ if (id->us>0 && (id->flag & LIB_EXTERN)) {
foundone= 1;
break;
}
}
- if(foundone) break;
+ if (foundone) break;
}
- if(foundone) {
+ if (foundone) {
writestruct(wd, ID_LI, "Library", 1, main->curlib);
- while(a--) {
- for(id= lbarray[a]->first; id; id= id->next) {
- if(id->us>0 && (id->flag & LIB_EXTERN)) {
+ while (a--) {
+ for (id= lbarray[a]->first; id; id= id->next) {
+ if (id->us>0 && (id->flag & LIB_EXTERN)) {
writestruct(wd, ID_ID, "ID", 1, id);
}
}
@@ -2480,7 +2485,7 @@ static void write_bone(WriteData *wd, Bone* bone)
// Write Children
cbone= bone->childbase.first;
- while(cbone) {
+ while (cbone) {
write_bone(wd, cbone);
cbone= cbone->next;
}
@@ -2501,7 +2506,7 @@ static void write_armatures(WriteData *wd, ListBase *idbase)
/* Direct data */
bone= arm->bonebase.first;
- while(bone) {
+ while (bone) {
write_bone(wd, bone);
bone=bone->next;
}
@@ -2520,15 +2525,15 @@ static void write_texts(WriteData *wd, ListBase *idbase)
TextMarker *mrk;
text= idbase->first;
- while(text) {
+ while (text) {
if ( (text->flags & TXT_ISMEM) && (text->flags & TXT_ISEXT)) text->flags &= ~TXT_ISEXT;
/* write LibData */
writestruct(wd, ID_TXT, "Text", 1, text);
- if(text->name) writedata(wd, DATA, strlen(text->name)+1, text->name);
+ if (text->name) writedata(wd, DATA, strlen(text->name)+1, text->name);
if (text->id.properties) IDP_WriteProperty(text->id.properties, wd);
- if(!(text->flags & TXT_ISEXT)) {
+ if (!(text->flags & TXT_ISEXT)) {
/* now write the text data, in two steps for optimization in the readfunction */
tmp= text->lines.first;
while (tmp) {
@@ -2563,8 +2568,8 @@ static void write_speakers(WriteData *wd, ListBase *idbase)
Speaker *spk;
spk= idbase->first;
- while(spk) {
- if(spk->id.us>0 || wd->current) {
+ while (spk) {
+ if (spk->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_SPK, "Speaker", 1, spk);
if (spk->id.properties) IDP_WriteProperty(spk->id.properties, wd);
@@ -2582,8 +2587,8 @@ static void write_sounds(WriteData *wd, ListBase *idbase)
PackedFile * pf;
sound= idbase->first;
- while(sound) {
- if(sound->id.us>0 || wd->current) {
+ while (sound) {
+ if (sound->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_SO, "bSound", 1, sound);
if (sound->id.properties) IDP_WriteProperty(sound->id.properties, wd);
@@ -2606,14 +2611,14 @@ static void write_groups(WriteData *wd, ListBase *idbase)
Group *group;
GroupObject *go;
- for(group= idbase->first; group; group= group->id.next) {
- if(group->id.us>0 || wd->current) {
+ for (group= idbase->first; group; group= group->id.next) {
+ if (group->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_GR, "Group", 1, group);
if (group->id.properties) IDP_WriteProperty(group->id.properties, wd);
go= group->gobject.first;
- while(go) {
+ while (go) {
writestruct(wd, DATA, "GroupObject", 1, go);
go= go->next;
}
@@ -2625,7 +2630,7 @@ static void write_nodetrees(WriteData *wd, ListBase *idbase)
{
bNodeTree *ntree;
- for(ntree=idbase->first; ntree; ntree= ntree->id.next) {
+ for (ntree=idbase->first; ntree; ntree= ntree->id.next) {
if (ntree->id.us>0 || wd->current) {
writestruct(wd, ID_NT, "bNodeTree", 1, ntree);
write_nodetree(wd, ntree);
@@ -2641,14 +2646,14 @@ static void write_brushes(WriteData *wd, ListBase *idbase)
{
Brush *brush;
- for(brush=idbase->first; brush; brush= brush->id.next) {
- if(brush->id.us>0 || wd->current) {
+ for (brush=idbase->first; brush; brush= brush->id.next) {
+ if (brush->id.us>0 || wd->current) {
writestruct(wd, ID_BR, "Brush", 1, brush);
if (brush->id.properties) IDP_WriteProperty(brush->id.properties, wd);
writestruct(wd, DATA, "MTex", 1, &brush->mtex);
- if(brush->curve)
+ if (brush->curve)
write_curvemapping(wd, brush->curve);
}
}
@@ -2658,8 +2663,8 @@ static void write_scripts(WriteData *wd, ListBase *idbase)
{
Script *script;
- for(script=idbase->first; script; script= script->id.next) {
- if(script->id.us>0 || wd->current) {
+ for (script=idbase->first; script; script= script->id.next) {
+ if (script->id.us>0 || wd->current) {
writestruct(wd, ID_SCRIPT, "Script", 1, script);
if (script->id.properties) IDP_WriteProperty(script->id.properties, wd);
}
@@ -2671,10 +2676,10 @@ static void write_movieTracks(WriteData *wd, ListBase *tracks)
MovieTrackingTrack *track;
track= tracks->first;
- while(track) {
+ while (track) {
writestruct(wd, DATA, "MovieTrackingTrack", 1, track);
- if(track->markers)
+ if (track->markers)
writestruct(wd, DATA, "MovieTrackingMarker", track->markersnr, track->markers);
track= track->next;
@@ -2683,7 +2688,7 @@ static void write_movieTracks(WriteData *wd, ListBase *tracks)
static void write_movieReconstruction(WriteData *wd, MovieTrackingReconstruction *reconstruction)
{
- if(reconstruction->camnr)
+ if (reconstruction->camnr)
writestruct(wd, DATA, "MovieReconstructedCamera", reconstruction->camnr, reconstruction->cameras);
}
@@ -2692,20 +2697,20 @@ static void write_movieclips(WriteData *wd, ListBase *idbase)
MovieClip *clip;
clip= idbase->first;
- while(clip) {
- if(clip->id.us>0 || wd->current) {
+ while (clip) {
+ if (clip->id.us>0 || wd->current) {
MovieTracking *tracking= &clip->tracking;
MovieTrackingObject *object;
writestruct(wd, ID_MC, "MovieClip", 1, clip);
- if(clip->adt)
+ if (clip->adt)
write_animdata(wd, clip->adt);
write_movieTracks(wd, &tracking->tracks);
write_movieReconstruction(wd, &tracking->reconstruction);
object= tracking->objects.first;
- while(object) {
+ while (object) {
writestruct(wd, DATA, "MovieTrackingObject", 1, object);
write_movieTracks(wd, &object->tracks);
@@ -2971,7 +2976,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
*/
static void write_thumb(WriteData *wd, int *img)
{
- if(img)
+ if (img)
writedata(wd, TEST, (2 + img[0] * img[1]) * sizeof(int), img);
}
@@ -3000,7 +3005,7 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
write_global(wd, write_flags, mainvar);
/* no UI save in undo */
- if(current==NULL) {
+ if (current==NULL) {
write_windowmanagers(wd, &mainvar->wm);
write_screens (wd, &mainvar->screen);
}
@@ -3057,17 +3062,17 @@ static int do_history(const char *name, ReportList *reports)
char tempname1[FILE_MAX], tempname2[FILE_MAX];
int hisnr= U.versions;
- if(U.versions==0) return 0;
- if(strlen(name)<2) {
+ if (U.versions==0) return 0;
+ if (strlen(name)<2) {
BKE_report(reports, RPT_ERROR, "Unable to make version backup: filename too short");
return 1;
}
- while(hisnr > 1) {
+ while (hisnr > 1) {
BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr-1);
BLI_snprintf(tempname2, sizeof(tempname2), "%s%d", name, hisnr);
- if(BLI_rename(tempname1, tempname2)) {
+ if (BLI_rename(tempname1, tempname2)) {
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
return 1;
}
@@ -3077,7 +3082,7 @@ static int do_history(const char *name, ReportList *reports)
/* is needed when hisnr==1 */
BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr);
- if(BLI_rename(name, tempname1)) {
+ if (BLI_rename(name, tempname1)) {
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
return 1;
}
@@ -3095,14 +3100,14 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
/* open temporary file, so we preserve the original in case we crash */
BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath);
- file = open(tempname,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
- if(file == -1) {
+ file = BLI_open(tempname,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
+ if (file == -1) {
BKE_reportf(reports, RPT_ERROR, "Can't open file %s for writing: %s.", tempname, strerror(errno));
return 0;
}
/* remapping of relative paths to new file location */
- if(write_flags & G_FILE_RELATIVE_REMAP) {
+ if (write_flags & G_FILE_RELATIVE_REMAP) {
char dir1[FILE_MAX];
char dir2[FILE_MAX];
BLI_split_dir_part(filepath, dir1, sizeof(dir1));
@@ -3112,15 +3117,15 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
BLI_cleanup_dir(mainvar->name, dir1);
BLI_cleanup_dir(mainvar->name, dir2);
- if(BLI_path_cmp(dir1, dir2)==0) {
+ if (BLI_path_cmp(dir1, dir2)==0) {
write_flags &= ~G_FILE_RELATIVE_REMAP;
}
else {
- if(G.relbase_valid) {
+ if (G.relbase_valid) {
/* blend may not have been saved before. Tn this case
* we should not have any relative paths, but if there
* is somehow, an invalid or empty G.main->name it will
- * print an error, dont try make the absolute in this case. */
+ * print an error, don't try make the absolute in this case. */
makeFilesAbsolute(mainvar, G.main->name, NULL);
}
}
@@ -3129,7 +3134,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
write_user_block= (BLI_path_cmp(filepath, userfilename) == 0);
- if(write_flags & G_FILE_RELATIVE_REMAP)
+ if (write_flags & G_FILE_RELATIVE_REMAP)
makeFilesRelative(mainvar, filepath, NULL); /* note, making relative to something OTHER then G.main->name */
/* actual file writing */
@@ -3153,7 +3158,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
}
}
- if(write_flags & G_FILE_COMPRESS) {
+ if (write_flags & G_FILE_COMPRESS) {
/* compressed files have the same ending as regular files... only from 2.4!!! */
char gzname[FILE_MAX+4];
int ret;
@@ -3162,25 +3167,25 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", filepath);
ret = BLI_file_gzip(tempname, gzname);
- if(0==ret) {
+ if (0==ret) {
/* now rename to real file name, and delete temp @ file too */
- if(BLI_rename(gzname, filepath) != 0) {
+ if (BLI_rename(gzname, filepath) != 0) {
BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @.");
return 0;
}
BLI_delete(tempname, 0, 0);
}
- else if(-1==ret) {
+ else if (-1==ret) {
BKE_report(reports, RPT_ERROR, "Failed opening .gz file.");
return 0;
}
- else if(-2==ret) {
+ else if (-2==ret) {
BKE_report(reports, RPT_ERROR, "Failed opening .blend file for compression.");
return 0;
}
}
- else if(BLI_rename(tempname, filepath) != 0) {
+ else if (BLI_rename(tempname, filepath) != 0) {
BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @");
return 0;
}
@@ -3195,6 +3200,6 @@ int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int wr
err= write_file_handle(mainvar, 0, compare, current, 0, write_flags, NULL);
- if(err==0) return 1;
+ if (err==0) return 1;
return 0;
}
diff --git a/source/blender/blenpluginapi/intern/pluginapi.c b/source/blender/blenpluginapi/intern/pluginapi.c
index aac20a96f08..02166c466fa 100644
--- a/source/blender/blenpluginapi/intern/pluginapi.c
+++ b/source/blender/blenpluginapi/intern/pluginapi.c
@@ -186,7 +186,7 @@ LIBEXPORT int ispic(char * name)
}
/* still the same name */
-/* void (*ditherfunc)(struct ImBuf *, short, short){} */
+/* void (*ditherfunc)(struct ImBuf *, short, short) {} */
LIBEXPORT struct ImBuf *scaleImBuf(struct ImBuf *ib,
short nx,
@@ -220,7 +220,7 @@ LIBEXPORT void de_interlace(struct ImBuf *ib)
/* stuff from plugin.h */
/* -------------------------------------------------------------------------- */
-/* These three need to be defined in the plugion itself. The plugin
+/* These three need to be defined in the plugin itself. The plugin
* loader looks for these functions to check whether it can use the
* plugin. For sequences, something similar exists. */
/* int plugin_tex_getversion(void); */
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
index b9a63f439f1..3dc10c5f97f 100644
--- a/source/blender/bmesh/CMakeLists.txt
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -41,6 +41,7 @@ set(SRC
operators/bmo_dupe.c
operators/bmo_edgesplit.c
operators/bmo_extrude.c
+ operators/bmo_inset.c
operators/bmo_join_triangles.c
operators/bmo_mesh_conv.c
operators/bmo_mirror.c
@@ -55,22 +56,24 @@ set(SRC
intern/bmesh_construct.h
intern/bmesh_core.c
intern/bmesh_core.h
- intern/bmesh_inline.c
+ intern/bmesh_inline.h
intern/bmesh_interp.c
intern/bmesh_interp.h
intern/bmesh_iterators.c
intern/bmesh_iterators.h
- intern/bmesh_iterators_inline.c
+ intern/bmesh_iterators_inline.h
intern/bmesh_marking.c
intern/bmesh_marking.h
intern/bmesh_mesh.c
intern/bmesh_mesh.h
intern/bmesh_mesh_conv.c
- intern/bmesh_mesh_conv.h
+ intern/bmesh_mesh_conv.h
+ intern/bmesh_mesh_validate.c
+ intern/bmesh_mesh_validate.h
intern/bmesh_mods.c
intern/bmesh_mods.h
intern/bmesh_opdefines.c
- intern/bmesh_operator_api_inline.c
+ intern/bmesh_operator_api_inline.h
intern/bmesh_operators.c
intern/bmesh_operators.h
intern/bmesh_operators_private.h
@@ -86,12 +89,13 @@ set(SRC
intern/bmesh_walkers_impl.c
intern/bmesh_walkers_private.h
+ intern/bmesh_operator_api.h
+ intern/bmesh_error.h
+
tools/BME_bevel.c
bmesh.h
bmesh_class.h
- bmesh_error.h
- bmesh_operator_api.h
)
if(MSVC)
diff --git a/source/blender/bmesh/SConscript b/source/blender/bmesh/SConscript
index e545dd64b02..e06f43bd85d 100644
--- a/source/blender/bmesh/SConscript
+++ b/source/blender/bmesh/SConscript
@@ -5,6 +5,7 @@ cflags=''
sources = env.Glob('intern/*.c')
sources += env.Glob('operators/*.c')
+sources += env.Glob('tools/*.c')
incs = [
'#/intern/guardedalloc',
diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h
index 7f9982c07cf..81bd164fbdf 100644
--- a/source/blender/bmesh/bmesh.h
+++ b/source/blender/bmesh/bmesh.h
@@ -198,87 +198,17 @@
extern "C" {
#endif
-#include "DNA_listBase.h"
-#include "DNA_customdata_types.h"
+#include "DNA_listBase.h" /* selection history uses */
+#include "DNA_customdata_types.h" /* BMesh struct in bmesh_class.h uses */
#include <stdlib.h>
-#include "BLI_utildefines.h"
+// #include "BLI_utildefines.h"
#include "bmesh_class.h"
-/*forward declarations*/
-
-/* ------------------------------------------------------------------------- */
-/* bmesh_inline.c */
-
-/* stuff for dealing with header flags */
-#define BM_elem_flag_test( ele, hflag) _bm_elem_flag_test (&(ele)->head, hflag)
-#define BM_elem_flag_enable( ele, hflag) _bm_elem_flag_enable (&(ele)->head, hflag)
-#define BM_elem_flag_disable(ele, hflag) _bm_elem_flag_disable (&(ele)->head, hflag)
-#define BM_elem_flag_set( ele, hflag, val) _bm_elem_flag_set (&(ele)->head, hflag, val)
-#define BM_elem_flag_toggle( ele, hflag) _bm_elem_flag_toggle (&(ele)->head, hflag)
-#define BM_elem_flag_merge( ele_a, ele_b) _bm_elem_flag_merge (&(ele_a)->head, &(ele_b)->head)
-
-BM_INLINE char _bm_elem_flag_test(const BMHeader *head, const char hflag);
-BM_INLINE void _bm_elem_flag_enable(BMHeader *head, const char hflag);
-BM_INLINE void _bm_elem_flag_disable(BMHeader *head, const char hflag);
-BM_INLINE void _bm_elem_flag_set(BMHeader *head, const char hflag, const int val);
-BM_INLINE void _bm_elem_flag_toggle(BMHeader *head, const char hflag);
-BM_INLINE void _bm_elem_flag_merge(BMHeader *head_a, BMHeader *head_b);
-
-/* notes on BM_elem_index_set(...) usage,
- * Set index is sometimes abused as temp storage, other times we cant be
- * sure if the index values are valid because certain operations have modified
- * the mesh structure.
- *
- * To set the elements to valid indices 'BM_mesh_elem_index_ensure' should be used
- * rather then adding inline loops, however there are cases where we still
- * set the index directly
- *
- * In an attempt to manage this, here are 3 tags Im adding to uses of
- * 'BM_elem_index_set'
- *
- * - 'set_inline' -- since the data is already being looped over set to a
- * valid value inline.
- *
- * - 'set_dirty!' -- intentionally sets the index to an invalid value,
- * flagging 'bm->elem_index_dirty' so we dont use it.
- *
- * - 'set_ok' -- this is valid use since the part of the code is low level.
- *
- * - 'set_ok_invalid' -- set to -1 on purpose since this should not be
- * used without a full array re-index, do this on
- * adding new vert/edge/faces since they may be added at
- * the end of the array.
- *
- * - 'set_loop' -- currently loop index values are not used used much so
- * assume each case they are dirty.
- * - campbell */
-
-#define BM_elem_index_get(ele) _bm_elem_index_get(&(ele)->head)
-#define BM_elem_index_set(ele, index) _bm_elem_index_set(&(ele)->head, index)
-BM_INLINE int _bm_elem_index_get(const BMHeader *ele);
-BM_INLINE void _bm_elem_index_set(BMHeader *ele, const int index);
-
-#ifdef USE_BMESH_HOLES
-# define BM_FACE_FIRST_LOOP(p) (((BMLoopList *)((p)->loops.first))->first)
-#else
-# define BM_FACE_FIRST_LOOP(p) ((p)->l_first)
-#endif
-
-/* size to use for static arrays when dealing with NGons,
- * alloc after this limit is reached.
- * this value is rather arbitrary */
-#define BM_NGON_STACK_SIZE 32
-
-/* avoid inf loop, this value is arbtrary
- * but should not error on valid cases */
-#define BM_LOOP_RADIAL_MAX 10000
-#define BM_NGON_MAX 100000
-
/* include the rest of the API */
-#include "bmesh_operator_api.h"
-#include "bmesh_error.h"
+#include "intern/bmesh_operator_api.h"
+#include "intern/bmesh_error.h"
#include "intern/bmesh_construct.h"
#include "intern/bmesh_core.h"
@@ -287,15 +217,14 @@ BM_INLINE void _bm_elem_index_set(BMHeader *ele, const int index);
#include "intern/bmesh_marking.h"
#include "intern/bmesh_mesh.h"
#include "intern/bmesh_mesh_conv.h"
+#include "intern/bmesh_mesh_validate.h"
#include "intern/bmesh_mods.h"
#include "intern/bmesh_operators.h"
#include "intern/bmesh_polygon.h"
#include "intern/bmesh_queries.h"
#include "intern/bmesh_walkers.h"
-#include "intern/bmesh_walkers.h"
-#include "intern/bmesh_inline.c"
-#include "intern/bmesh_operator_api_inline.c"
+#include "intern/bmesh_inline.h"
#ifdef __cplusplus
}
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 394ae66c84b..0afc65c08ac 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -55,7 +55,7 @@ struct Object;
* hold several types of data
*
* 1: The type of the element (vert, edge, loop or face)
- * 2: Persistant "header" flags/markings (smooth, seam, select, hidden, ect)
+ * 2: Persistent "header" flags/markings (smooth, seam, select, hidden, ect)
* note that this is different from the "tool" flags.
* 3: Unique ID in the bmesh.
* 4: some elements for internal record keeping.
@@ -110,6 +110,8 @@ typedef struct BMLoop {
struct BMEdge *e; /* edge, using verts (v, next->v) */
struct BMFace *f;
+ /* circular linked list of loops which all use the same edge as this one '->e',
+ * but not necessarily the same vertex (can be either v1 or v2 of our own '->e') */
struct BMLoop *radial_next, *radial_prev;
/* these were originally commented as private but are used all over the code */
@@ -117,7 +119,7 @@ typedef struct BMLoop {
struct BMLoop *next, *prev; /* next/prev verts around the face */
} BMLoop;
-/* can cast BMFace/BMEdge/BMVert, but NOT BMLoop, since these dont have a flag layer */
+/* can cast BMFace/BMEdge/BMVert, but NOT BMLoop, since these don't have a flag layer */
typedef struct BMElemF {
BMHeader head;
struct BMFlagLayer *oflags; /* keep after header, an array of flags, mostly used by the operator stack */
@@ -162,7 +164,7 @@ typedef struct BMesh {
/* flag index arrays as being dirty so we can check if they are clean and
* avoid looping over the entire vert/edge/face array in those cases.
* valid flags are - BM_VERT | BM_EDGE | BM_FACE.
- * BM_LOOP isnt handled so far. */
+ * BM_LOOP isn't handled so far. */
char elem_index_dirty;
/*element pools*/
@@ -181,7 +183,7 @@ typedef struct BMesh {
/* should be copy of scene select mode */
/* stored in BMEditMesh too, this is a bit confusing,
- * make sure the're in sync!
+ * make sure they're in sync!
* Only use when the edit mesh cant be accessed - campbell */
short selectmode;
@@ -194,8 +196,7 @@ typedef struct BMesh {
BMFace *act_face;
ListBase errorstack;
- struct Object *ob; /* owner object */
-
+
void *py_handle;
int opflag; /* current operator flag */
@@ -236,4 +237,24 @@ enum {
* not have functions clobber them */
};
+/* defines */
+
+/*forward declarations*/
+
+#ifdef USE_BMESH_HOLES
+# define BM_FACE_FIRST_LOOP(p) (((BMLoopList *)((p)->loops.first))->first)
+#else
+# define BM_FACE_FIRST_LOOP(p) ((p)->l_first)
+#endif
+
+/* size to use for static arrays when dealing with NGons,
+ * alloc after this limit is reached.
+ * this value is rather arbitrary */
+#define BM_NGON_STACK_SIZE 32
+
+/* avoid inf loop, this value is arbitrary
+ * but should not error on valid cases */
+#define BM_LOOP_RADIAL_MAX 10000
+#define BM_NGON_MAX 100000
+
#endif /* __BMESH_CLASS_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index d903d939452..d539b6d8c5b 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -76,6 +76,27 @@ BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFa
BMFace *f = NULL;
int is_overlap = FALSE;
+ /* sanity check - debug mode only */
+ if (len == 3) {
+ BLI_assert(verts[0] != verts[1]);
+ BLI_assert(verts[0] != verts[2]);
+ BLI_assert(verts[1] != verts[2]);
+ }
+ else if (len == 4) {
+ BLI_assert(verts[0] != verts[1]);
+ BLI_assert(verts[0] != verts[2]);
+ BLI_assert(verts[0] != verts[3]);
+
+ BLI_assert(verts[1] != verts[2]);
+ BLI_assert(verts[1] != verts[3]);
+
+ BLI_assert(verts[2] != verts[3]);
+ }
+ else {
+ BLI_assert(0);
+ }
+
+
if (nodouble) {
/* check if face exists or overlaps */
is_overlap = BM_face_exists(bm, verts, len, &f);
@@ -263,9 +284,197 @@ err:
return NULL;
}
+typedef struct AngleIndexPair {
+ float angle;
+ int index;
+} AngleIndexPair;
+
+static int angle_index_pair_cmp(const void *e1, const void *e2)
+{
+ const AngleIndexPair *p1 = e1, *p2 = e2;
+ if (p1->angle > p2->angle) return 1;
+ else if (p1->angle < p2->angle) return -1;
+ else return 0;
+}
+
+/**
+ * Makes an NGon from an un-ordered set of verts
+ *
+ * assumes...
+ * - that verts are only once in the list.
+ * - that the verts have roughly planer bounds
+ * - that the verts are roughly circular
+ * there can be concave areas but overlapping folds from the center point will fail.
+ *
+ * a brief explanation of the method used
+ * - find the center point
+ * - find the normal of the vcloud
+ * - order the verts around the face based on their angle to the normal vector at the center point.
+ *
+ * \note Since this is a vcloud there is no direction.
+ */
+BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int totv, int nodouble)
+{
+ BMFace *f;
+
+ float totv_inv = 1.0f / (float)totv;
+ int i = 0;
+
+ float cent[3], nor[3];
+
+ float *far = NULL, *far_cross = NULL;
+
+ float far_vec[3];
+ float far_cross_vec[3];
+ float sign_vec[3]; /* work out if we are pos/neg angle */
+
+ float far_dist, far_best;
+ float far_cross_dist, far_cross_best = 0.0f;
+
+ AngleIndexPair *vang;
+
+ BMVert **vert_arr_map;
+ BMEdge **edge_arr;
+ int i_prev;
+
+ unsigned int winding[2] = {0, 0};
+
+ /* get the center point and collect vector array since we loop over these a lot */
+ zero_v3(cent);
+ for (i = 0; i < totv; i++) {
+ madd_v3_v3fl(cent, vert_arr[i]->co, totv_inv);
+ }
+
+
+ /* find the far point from cent */
+ far_best = 0.0f;
+ for (i = 0; i < totv; i++) {
+ far_dist = len_squared_v3v3(vert_arr[i]->co, cent);
+ if (far_dist > far_best || far == NULL) {
+ far = vert_arr[i]->co;
+ far_best = far_dist;
+ }
+ }
+
+ sub_v3_v3v3(far_vec, far, cent);
+ far_dist = len_v3(far_vec); /* real dist */
+
+ /* --- */
+
+ /* find a point 90deg about to compare with */
+ far_cross_best = 0.0f;
+ for (i = 0; i < totv; i++) {
+
+ if (far == vert_arr[i]->co) {
+ continue;
+ }
+
+ sub_v3_v3v3(far_cross_vec, vert_arr[i]->co, cent);
+ far_cross_dist = normalize_v3(far_cross_vec);
+
+ /* more of a weight then a distance */
+ far_cross_dist = (/* first we want to have a value close to zero mapped to 1 */
+ 1.0 - fabsf(dot_v3v3(far_vec, far_cross_vec)) *
+
+ /* second we multiply by the distance
+ * so points close to the center are not preferred */
+ far_cross_dist);
+
+ if (far_cross_dist > far_cross_best || far_cross == NULL) {
+ far_cross = vert_arr[i]->co;
+ far_cross_best = far_cross_dist;
+ }
+ }
+
+ sub_v3_v3v3(far_cross_vec, far_cross, cent);
+
+ /* --- */
+
+ /* now we have 2 vectors we can have a cross product */
+ cross_v3_v3v3(nor, far_vec, far_cross_vec);
+ normalize_v3(nor);
+ cross_v3_v3v3(sign_vec, far_vec, nor); /* this vector should match 'far_cross_vec' closely */
+
+ /* --- */
+
+ /* now calcualte every points angle around the normal (signed) */
+ vang = MEM_mallocN(sizeof(AngleIndexPair) * totv, __func__);
+
+ for (i = 0; i < totv; i++) {
+ float co[3];
+ float proj_vec[3];
+ float angle;
+
+ /* center relative vec */
+ sub_v3_v3v3(co, vert_arr[i]->co, cent);
+
+ /* align to plane */
+ project_v3_v3v3(proj_vec, co, nor);
+ sub_v3_v3(co, proj_vec);
+
+ /* now 'co' is valid - we can compare its angle against the far vec */
+ angle = angle_v3v3(far_vec, co);
+
+ if (dot_v3v3(co, sign_vec) < 0.0f) {
+ angle = -angle;
+ }
+
+ vang[i].angle = angle;
+ vang[i].index = i;
+ }
+
+ /* sort by angle and magic! - we have our ngon */
+ qsort(vang, totv, sizeof(AngleIndexPair), angle_index_pair_cmp);
+
+ /* --- */
+
+ /* create edges and find the winding (if faces are attached to any existing edges) */
+ vert_arr_map = MEM_mallocN(sizeof(BMVert **) * totv, __func__);
+ edge_arr = MEM_mallocN(sizeof(BMEdge **) * totv, __func__);
+
+ for (i = 0; i < totv; i++) {
+ vert_arr_map[i] = vert_arr[vang[i].index];
+ }
+ MEM_freeN(vang);
+
+ i_prev = totv - 1;
+ for (i = 0; i < totv; i++) {
+ edge_arr[i] = BM_edge_create(bm, vert_arr_map[i_prev], vert_arr_map[i], NULL, TRUE);
+
+ /* the edge may exist already and be attached to a face
+ * in this case we can find the best winding to use for the new face */
+ if (edge_arr[i]->l) {
+ BMVert *test_v1, *test_v2;
+ /* we want to use the reverse winding to the existing order */
+ BM_edge_ordered_verts(edge_arr[i], &test_v2, &test_v1);
+ winding[(vert_arr_map[i_prev] == test_v2)]++;
-/* bmesh_make_face_from_face(BMesh *bm, BMFace *source, BMFace *target) */
+ }
+
+ i_prev = i;
+ }
+ /* --- */
+
+ if (winding[0] < winding[1]) {
+ winding[0] = 1;
+ winding[1] = 0;
+ }
+ else {
+ winding[0] = 0;
+ winding[1] = 1;
+ }
+
+ /* --- */
+
+ /* create the face */
+ f = BM_face_create_ngon(bm, vert_arr_map[winding[0]], vert_arr_map[winding[1]], edge_arr, totv, nodouble);
+
+ MEM_freeN(edge_arr);
+ MEM_freeN(vert_arr_map);
+
+ return f;
+}
/**
* Called by operators to remove elements that they have marked for
@@ -312,7 +521,7 @@ void BMO_remove_tagged_verts(BMesh *bm, const short oflag)
* api functions that take a filter callback.....
* and this new filter type will be for opstack flags.
* This is because the BM_remove_taggedXXX functions bypass iterator API.
- * - Ops dont care about 'UI' considerations like selection state, hide state, ect.
+ * - Ops don't care about 'UI' considerations like selection state, hide state, ect.
* If you want to work on unhidden selections for instance,
* copy output from a 'select context' operator to another operator....
*/
@@ -593,7 +802,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
bm_old->totface};
/* allocate a bmesh */
- bm_new = BM_mesh_create(bm_old->ob, &allocsize);
+ bm_new = BM_mesh_create(&allocsize);
CustomData_copy(&bm_old->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&bm_old->edata, &bm_new->edata, CD_MASK_BMESH, CD_CALLOC, 0);
@@ -760,7 +969,7 @@ short BM_edge_flag_to_mflag(BMEdge *eed)
((hflag & BM_ELEM_SMOOTH) == 0 ? ME_SHARP : 0) |
((hflag & BM_ELEM_HIDDEN) ? ME_HIDE : 0) |
((hflag & BM_ELEM_FREESTYLE) ? ME_FREESTYLE_EDGE : 0) |
- ((BM_edge_is_wire(NULL, eed)) ? ME_LOOSEEDGE : 0) | /* not typical */
+ ((BM_edge_is_wire(eed)) ? ME_LOOSEEDGE : 0) | /* not typical */
(ME_EDGEDRAW | ME_EDGERENDER)
);
}
diff --git a/source/blender/bmesh/intern/bmesh_construct.h b/source/blender/bmesh/intern/bmesh_construct.h
index 5c4101c9cde..29b84046884 100644
--- a/source/blender/bmesh/intern/bmesh_construct.h
+++ b/source/blender/bmesh/intern/bmesh_construct.h
@@ -38,6 +38,8 @@ void BM_face_copy_shared(BMesh *bm, BMFace *f);
BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, int len, int nodouble);
+BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len, int nodouble);
+
void BMO_remove_tagged_faces(BMesh *bm, const short oflag);
void BMO_remove_tagged_edges(BMesh *bm, const short oflag);
void BMO_remove_tagged_verts(BMesh *bm, const short oflag);
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index 133e446f891..d9973550440 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -240,7 +240,7 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short co
* only create the face, since this calloc's the length is initialized to 0,
* leave adding loops to the caller.
*/
-BM_INLINE BMFace *bm_face_create__internal(BMesh *bm)
+BLI_INLINE BMFace *bm_face_create__internal(BMesh *bm)
{
BMFace *f;
@@ -1161,7 +1161,7 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
#endif
/* validate both loop */
- /* I dont know how many loops are supposed to be in each face at this point! FIXME */
+ /* I don't know how many loops are supposed to be in each face at this point! FIXME */
/* go through all of f2's loops and make sure they point to it properly */
l_iter = l_first = BM_FACE_FIRST_LOOP(f2);
@@ -1704,7 +1704,7 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
*
* \return Success
*/
-static int bm_vert_splice(BMesh *bm, BMVert *v, BMVert *vtarget)
+int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *vtarget)
{
BMEdge *e;
BMLoop *l;
@@ -1743,6 +1743,7 @@ static int bm_vert_splice(BMesh *bm, BMVert *v, BMVert *vtarget)
* vertex for each region. returns an array of all resulting vertices.
*
* \note this is a low level function, bm_edge_separate needs to run on edges first
+ * or, the faces sharing verts must not be sharing edges for them to split at least.
*
* \return Success
*/
@@ -1793,7 +1794,12 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
}
/* Replace v with the new verts in each group */
+#if 0
BM_ITER(l, &liter, bm, BM_LOOPS_OF_VERT, v) {
+ /* call first since its faster then a hash lookup */
+ if (l->v != v) {
+ continue;
+ }
i = GET_INT_FROM_POINTER(BLI_ghash_lookup(visithash, l->e));
if (i == 0) {
continue;
@@ -1805,10 +1811,28 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
* towards vertex v, and another for the loop heading out from
* vertex v. Only need to swap the vertex on one of those times,
* on the outgoing loop. */
- if (l->v == v) {
- l->v = verts[i];
+
+ /* XXX - because this clobbers the iterator, this *whole* block is commented, see below */
+ l->v = verts[i];
+ }
+#else
+ /* note: this is the same as the commented code above *except* that it doesnt break iterator
+ * by modifying data it loops over [#30632], this re-uses the 'stack' variable which is a bit
+ * bad practice but save alloc'ing a new array - note, the comment above is useful, keep it
+ * if you are tidying up code - campbell */
+ BLI_array_empty(stack);
+ BM_ITER(l, &liter, bm, BM_LOOPS_OF_VERT, v) {
+ if ((l->v == v) && (i = GET_INT_FROM_POINTER(BLI_ghash_lookup(visithash, l->e)))) {
+ BM_elem_index_set(l, i); /* would be nice to assign vert here but cant, so assign the vert index */
+ BLI_array_append(stack, (BMEdge *)l);
}
}
+ while ((l = (BMLoop *)(BLI_array_pop(stack)))) {
+ l->v = verts[BM_elem_index_get(l)];
+ }
+#endif
+
+ BLI_array_free(stack);
BM_ITER(e, &eiter, bm, BM_EDGES_OF_VERT, v) {
i = GET_INT_FROM_POINTER(BLI_ghash_lookup(visithash, e));
@@ -1823,7 +1847,6 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
}
BLI_ghash_free(visithash, NULL, NULL);
- BLI_array_free(stack);
for (i = 0; i < maxindex; i++) {
BM_CHECK_ELEMENT(bm, verts[i]);
@@ -2006,7 +2029,7 @@ BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *sl)
/* And then glue the rest back together */
for (i = 1; i < len - 1; i++) {
- bm_vert_splice(bm, vtar[i], vtar[0]);
+ BM_vert_splice(bm, vtar[i], vtar[0]);
}
}
}
diff --git a/source/blender/bmesh/intern/bmesh_core.h b/source/blender/bmesh/intern/bmesh_core.h
index e10222dc29a..34947923572 100644
--- a/source/blender/bmesh/intern/bmesh_core.h
+++ b/source/blender/bmesh/intern/bmesh_core.h
@@ -40,8 +40,9 @@ void BM_face_kill(BMesh *bm, BMFace *f);
void BM_edge_kill(BMesh *bm, BMEdge *e);
void BM_vert_kill(BMesh *bm, BMVert *v);
-int BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *etarget);
int bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep);
+int BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *etarget);
+int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *vtarget);
int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len);
diff --git a/source/blender/bmesh/bmesh_error.h b/source/blender/bmesh/intern/bmesh_error.h
index b88b1ff890f..84065fe88f6 100644
--- a/source/blender/bmesh/bmesh_error.h
+++ b/source/blender/bmesh/intern/bmesh_error.h
@@ -49,7 +49,7 @@ void BMO_error_clear(BMesh *bm);
* errorcode is either the errorcode, or BMERR_ALL for any
* error.*/
-/* not yet implimented.
+/* not yet implemented.
* int BMO_error_catch_op(BMesh *bm, BMOperator *catchop, int errorcode, char **msg);
*/
diff --git a/source/blender/bmesh/intern/bmesh_inline.c b/source/blender/bmesh/intern/bmesh_inline.c
deleted file mode 100644
index f7a0fb5c45c..00000000000
--- a/source/blender/bmesh/intern/bmesh_inline.c
+++ /dev/null
@@ -1,76 +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.
- *
- * Contributor(s): Joseph Eagar, Geoffrey Bantle, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/bmesh/intern/bmesh_inline.c
- * \ingroup bmesh
- *
- * BM Inline functions.
- */
-
-#ifndef __BMESH_INLINE_C__
-#define __BMESH_INLINE_C__
-
-#include "bmesh.h"
-
-BM_INLINE char _bm_elem_flag_test(const BMHeader *head, const char hflag)
-{
- return head->hflag & hflag;
-}
-
-BM_INLINE void _bm_elem_flag_enable(BMHeader *head, const char hflag)
-{
- head->hflag |= hflag;
-}
-
-BM_INLINE void _bm_elem_flag_disable(BMHeader *head, const char hflag)
-{
- head->hflag &= ~hflag;
-}
-
-BM_INLINE void _bm_elem_flag_set(BMHeader *head, const char hflag, const int val)
-{
- if (val) _bm_elem_flag_enable(head, hflag);
- else _bm_elem_flag_disable(head, hflag);
-}
-
-BM_INLINE void _bm_elem_flag_toggle(BMHeader *head, const char hflag)
-{
- head->hflag ^= hflag;
-}
-
-BM_INLINE void _bm_elem_flag_merge(BMHeader *head_a, BMHeader *head_b)
-{
- head_a->hflag = head_b->hflag = head_a->hflag | head_b->hflag;
-}
-
-
-BM_INLINE void _bm_elem_index_set(BMHeader *head, const int index)
-{
- head->index = index;
-}
-
-BM_INLINE int _bm_elem_index_get(const BMHeader *head)
-{
- return head->index;
-}
-
-#endif /* __BMESH_INLINE_C__ */
diff --git a/source/blender/bmesh/intern/bmesh_inline.h b/source/blender/bmesh/intern/bmesh_inline.h
new file mode 100644
index 00000000000..2cfaf49d51e
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_inline.h
@@ -0,0 +1,115 @@
+/*
+ * ***** 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.
+ *
+ * Contributor(s): Joseph Eagar, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_inline.h
+ * \ingroup bmesh
+ *
+ * BM Inline functions.
+ */
+
+#ifndef __BMESH_INLINE_H__
+#define __BMESH_INLINE_H__
+
+/* stuff for dealing with header flags */
+#define BM_elem_flag_test( ele, hflag) _bm_elem_flag_test (&(ele)->head, hflag)
+#define BM_elem_flag_enable( ele, hflag) _bm_elem_flag_enable (&(ele)->head, hflag)
+#define BM_elem_flag_disable(ele, hflag) _bm_elem_flag_disable (&(ele)->head, hflag)
+#define BM_elem_flag_set( ele, hflag, val) _bm_elem_flag_set (&(ele)->head, hflag, val)
+#define BM_elem_flag_toggle( ele, hflag) _bm_elem_flag_toggle (&(ele)->head, hflag)
+#define BM_elem_flag_merge( ele_a, ele_b) _bm_elem_flag_merge (&(ele_a)->head, &(ele_b)->head)
+
+BLI_INLINE char _bm_elem_flag_test(const BMHeader *head, const char hflag)
+{
+ return head->hflag & hflag;
+}
+
+BLI_INLINE void _bm_elem_flag_enable(BMHeader *head, const char hflag)
+{
+ head->hflag |= hflag;
+}
+
+BLI_INLINE void _bm_elem_flag_disable(BMHeader *head, const char hflag)
+{
+ head->hflag &= ~hflag;
+}
+
+BLI_INLINE void _bm_elem_flag_set(BMHeader *head, const char hflag, const int val)
+{
+ if (val) _bm_elem_flag_enable(head, hflag);
+ else _bm_elem_flag_disable(head, hflag);
+}
+
+BLI_INLINE void _bm_elem_flag_toggle(BMHeader *head, const char hflag)
+{
+ head->hflag ^= hflag;
+}
+
+BLI_INLINE void _bm_elem_flag_merge(BMHeader *head_a, BMHeader *head_b)
+{
+ head_a->hflag = head_b->hflag = head_a->hflag | head_b->hflag;
+}
+
+/**
+ * notes on #BM_elem_index_set(...) usage,
+ * Set index is sometimes abused as temp storage, other times we cant be
+ * sure if the index values are valid because certain operations have modified
+ * the mesh structure.
+ *
+ * To set the elements to valid indices 'BM_mesh_elem_index_ensure' should be used
+ * rather then adding inline loops, however there are cases where we still
+ * set the index directly
+ *
+ * In an attempt to manage this,
+ * here are 5 tags I'm adding to uses of #BM_elem_index_set
+ *
+ * - 'set_inline' -- since the data is already being looped over set to a
+ * valid value inline.
+ *
+ * - 'set_dirty!' -- intentionally sets the index to an invalid value,
+ * flagging 'bm->elem_index_dirty' so we don't use it.
+ *
+ * - 'set_ok' -- this is valid use since the part of the code is low level.
+ *
+ * - 'set_ok_invalid' -- set to -1 on purpose since this should not be
+ * used without a full array re-index, do this on
+ * adding new vert/edge/faces since they may be added at
+ * the end of the array.
+ *
+ * - 'set_loop' -- currently loop index values are not used used much so
+ * assume each case they are dirty.
+ *
+ * - campbell */
+
+#define BM_elem_index_get(ele) _bm_elem_index_get(&(ele)->head)
+#define BM_elem_index_set(ele, index) _bm_elem_index_set(&(ele)->head, index)
+
+BLI_INLINE void _bm_elem_index_set(BMHeader *head, const int index)
+{
+ head->index = index;
+}
+
+BLI_INLINE int _bm_elem_index_get(const BMHeader *head)
+{
+ return head->index;
+}
+
+#endif /* __BMESH_INLINE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index 7074adc324f..2a3242d87c1 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -426,6 +426,7 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source)
MDisps *md2 = CustomData_bmesh_get(&bm->ldata, BM_FACE_FIRST_LOOP(source)->head.data, CD_MDISPS);
mdisps->totdisp = md2->totdisp;
+ mdisps->level = md2->level;
if (mdisps->totdisp) {
mdisps->disps = MEM_callocN(sizeof(float) * 3 * mdisps->totdisp,
"mdisp->disps in bmesh_loop_intern_mdisps");
@@ -632,7 +633,7 @@ void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
axis_dominant_v3(&ax, &ay, source->no);
- /* scale source face coordinates a bit, so points sitting directonly on an
+ /* scale source face coordinates a bit, so points sitting directly on an
* edge will work. */
mul_v3_fl(cent, 1.0f / (float)source->len);
for (i = 0; i < source->len; i++) {
@@ -695,7 +696,7 @@ void BM_vert_interp_from_face(BMesh *bm, BMVert *v, BMFace *source)
i++;
} while ((l_iter = l_iter->next) != l_first);
- /* scale source face coordinates a bit, so points sitting directonly on an
+ /* scale source face coordinates a bit, so points sitting directly on an
* edge will work. */
mul_v3_fl(cent, 1.0f / (float)source->len);
for (i = 0; i < source->len; i++) {
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
index e58e989c41f..b53896ae722 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.c
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -28,6 +28,7 @@
* See: bmesh_iterators_inlin.c too, some functions are here for speed reasons.
*/
+#include "BLI_utildefines.h"
#include "bmesh.h"
#include "intern/bmesh_private.h"
diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h
index 7b13d2de723..d3566d8aead 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.h
+++ b/source/blender/bmesh/intern/bmesh_iterators.h
@@ -143,6 +143,6 @@ void *bmiter__edge_of_face_step(struct BMIter *iter);
void bmiter__loop_of_face_begin(struct BMIter *iter);
void *bmiter__loop_of_face_step(struct BMIter *iter);
-#include "intern/bmesh_iterators_inline.c"
+#include "intern/bmesh_iterators_inline.h"
#endif /* __BMESH_ITERATORS_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.c b/source/blender/bmesh/intern/bmesh_iterators_inline.h
index ed65b0e7fac..57f0da4081b 100644
--- a/source/blender/bmesh/intern/bmesh_iterators_inline.c
+++ b/source/blender/bmesh/intern/bmesh_iterators_inline.h
@@ -20,16 +20,14 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_iterators_inline.c
+/** \file blender/bmesh/intern/bmesh_iterators_inline.h
* \ingroup bmesh
*
* BMesh inline iterator functions.
*/
-#ifndef __BMESH_ITERATORS_INLINE_C__
-#define __BMESH_ITERATORS_INLINE_C__
-
-#include "bmesh.h"
+#ifndef __BMESH_ITERATORS_INLINE_H__
+#define __BMESH_ITERATORS_INLINE_H__
/* inline here optimizes out the switch statement when called with
* constant values (which is very common), nicer for loop-in-loop situations */
@@ -39,7 +37,7 @@
*
* Calls an iterators step fucntion to return the next element.
*/
-BM_INLINE void *BM_iter_step(BMIter *iter)
+BLI_INLINE void *BM_iter_step(BMIter *iter)
{
return iter->step(iter);
}
@@ -52,7 +50,7 @@ BM_INLINE void *BM_iter_step(BMIter *iter)
* it with the appropriate function pointers based
* upon its type.
*/
-BM_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *data)
+BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *data)
{
/* int argtype; */
iter->itype = itype;
@@ -179,7 +177,7 @@ BM_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *data
* to return the first element of the iterator.
*
*/
-BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *data)
+BLI_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *data)
{
if (LIKELY(BM_iter_init(iter, bm, itype, data))) {
return BM_iter_step(iter);
@@ -189,4 +187,4 @@ BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *dat
}
}
-#endif /* __BMESH_ITERATORS_INLINE_C__ */
+#endif /* __BMESH_ITERATORS_INLINE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c
index f05a75e74bf..0318fd94b92 100644
--- a/source/blender/bmesh/intern/bmesh_marking.c
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -288,9 +288,9 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, int select)
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) bm->totedgesel -= 1;
BM_elem_flag_disable(e, BM_ELEM_SELECT);
- if ( bm->selectmode == SCE_SELECT_EDGE ||
- bm->selectmode == SCE_SELECT_FACE ||
- bm->selectmode == (SCE_SELECT_EDGE | SCE_SELECT_FACE))
+ if (bm->selectmode == SCE_SELECT_EDGE ||
+ bm->selectmode == SCE_SELECT_FACE ||
+ bm->selectmode == (SCE_SELECT_EDGE | SCE_SELECT_FACE))
{
BMIter iter;
@@ -312,9 +312,9 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, int select)
}
}
- if (deselect) {
- BM_vert_select_set(bm, verts[i], FALSE);
- }
+ if (deselect) {
+ BM_vert_select_set(bm, verts[i], FALSE);
+ }
}
}
else {
@@ -606,10 +606,10 @@ void BM_editselection_plane(BMesh *bm, float r_plane[3], BMEditSelection *ese)
/* make a fake plane thats at rightangles to the normal
* we cant make a crossvec from a vec thats the same as the vec
* unlikely but possible, so make sure if the normal is (0, 0, 1)
- * that vec isnt the same or in the same direction even. */
- if (eve->no[0] < 0.5f) vec[0] = 1.0f;
- else if (eve->no[1] < 0.5f) vec[1] = 1.0f;
- else vec[2] = 1.0f;
+ * that vec isn't the same or in the same direction even. */
+ if (eve->no[0] < 0.5f) vec[0] = 1.0f;
+ else if (eve->no[1] < 0.5f) vec[1] = 1.0f;
+ else vec[2] = 1.0f;
cross_v3_v3v3(r_plane, eve->no, vec);
}
}
@@ -638,7 +638,7 @@ void BM_editselection_plane(BMesh *bm, float r_plane[3], BMEditSelection *ese)
/* make a fake plane thats at rightangles to the normal
* we cant make a crossvec from a vec thats the same as the vec
* unlikely but possible, so make sure if the normal is (0, 0, 1)
- * that vec isnt the same or in the same direction even. */
+ * that vec isn't the same or in the same direction even. */
if (efa->len < 3) {
/* crappy fallback method */
if (efa->no[0] < 0.5f) vec[0] = 1.0f;
@@ -701,15 +701,17 @@ int BM_select_history_check(BMesh *bm, const BMElem *ele)
return FALSE;
}
-void BM_select_history_remove(BMesh *bm, BMElem *ele)
+int BM_select_history_remove(BMesh *bm, BMElem *ele)
{
BMEditSelection *ese;
for (ese = bm->selected.first; ese; ese = ese->next) {
if (ese->ele == ele) {
BLI_freelinkN(&(bm->selected), ese);
- break;
+ return TRUE;
}
}
+
+ return FALSE;
}
void BM_select_history_clear(BMesh *bm)
@@ -718,14 +720,18 @@ void BM_select_history_clear(BMesh *bm)
bm->selected.first = bm->selected.last = NULL;
}
+void BM_select_history_store_notest(BMesh *bm, BMElem *ele)
+{
+ BMEditSelection *ese = (BMEditSelection *) MEM_callocN(sizeof(BMEditSelection), "BMEdit Selection");
+ ese->htype = ((BMHeader *)ele)->htype;
+ ese->ele = ele;
+ BLI_addtail(&(bm->selected), ese);
+}
+
void BM_select_history_store(BMesh *bm, BMElem *ele)
{
- BMEditSelection *ese;
if (!BM_select_history_check(bm, ele)) {
- ese = (BMEditSelection *) MEM_callocN(sizeof(BMEditSelection), "BMEdit Selection");
- ese->htype = ((BMHeader *)ele)->htype;
- ese->ele = ele;
- BLI_addtail(&(bm->selected), ese);
+ BM_select_history_store_notest(bm, ele);
}
}
@@ -749,6 +755,9 @@ void BM_mesh_elem_flag_disable_all(BMesh *bm, const char htype, const char hflag
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,
BM_FACES_OF_MESH};
+
+ const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE};
+
BMIter iter;
BMElem *ele;
int i;
@@ -770,7 +779,7 @@ void BM_mesh_elem_flag_disable_all(BMesh *bm, const char htype, const char hflag
}
else {
for (i = 0; i < 3; i++) {
- if (htype & iter_types[i]) {
+ if (htype & flag_types[i]) {
ele = BM_iter_new(&iter, bm, iter_types[i], NULL);
for ( ; ele; ele = BM_iter_step(&iter)) {
if (hflag & BM_ELEM_SELECT) {
@@ -788,6 +797,9 @@ void BM_mesh_elem_flag_enable_all(BMesh *bm, const char htype, const char hflag)
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,
BM_FACES_OF_MESH};
+
+ const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE};
+
BMIter iter;
BMElem *ele;
int i;
@@ -801,7 +813,7 @@ void BM_mesh_elem_flag_enable_all(BMesh *bm, const char htype, const char hflag)
* we could ofcourse check for no hiddent faces and then use quicker method but its not worth it. */
for (i = 0; i < 3; i++) {
- if (htype & iter_types[i]) {
+ if (htype & flag_types[i]) {
ele = BM_iter_new(&iter, bm, iter_types[i], NULL);
for ( ; ele; ele = BM_iter_step(&iter)) {
if (hflag & BM_ELEM_SELECT) {
diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h
index 598cc02126a..f0e81b1dd9f 100644
--- a/source/blender/bmesh/intern/bmesh_marking.h
+++ b/source/blender/bmesh/intern/bmesh_marking.h
@@ -70,7 +70,8 @@ void BM_editselection_normal(float r_normal[3], BMEditSelection *ese);
void BM_editselection_plane(BMesh *bm, float r_plane[3], BMEditSelection *ese);
int BM_select_history_check(BMesh *bm, const BMElem *ele);
-void BM_select_history_remove(BMesh *bm, BMElem *ele);
+int BM_select_history_remove(BMesh *bm, BMElem *ele);
+void BM_select_history_store_notest(BMesh *bm, BMElem *ele);
void BM_select_history_store(BMesh *bm, BMElem *ele);
void BM_select_history_validate(BMesh *bm);
void BM_select_history_clear(BMesh *em);
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 63719e778f7..f69a46e7d8c 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -58,7 +58,7 @@ static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize)
bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), allocsize[3], allocsize[3], FALSE, FALSE);
#endif
- /* allocate one flag pool that we dont get rid of. */
+ /* allocate one flag pool that we don't get rid of. */
bm->toolflagpool = BLI_mempool_create(sizeof(BMFlagLayer), 512, 512, 0);
}
@@ -71,17 +71,15 @@ static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize)
*
* \note ob is needed by multires
*/
-BMesh *BM_mesh_create(struct Object *ob, BMAllocTemplate *allocsize)
+BMesh *BM_mesh_create(BMAllocTemplate *allocsize)
{
/* allocate the structure */
BMesh *bm = MEM_callocN(sizeof(BMesh), __func__);
-
- bm->ob = ob;
/* allocate the memory pools for the mesh elements */
bm_mempool_init(bm, allocsize);
- /* allocate one flag pool that we dont get rid of. */
+ /* allocate one flag pool that we don't get rid of. */
bm->stackdepth = 1;
bm->totflags = 1;
@@ -154,13 +152,6 @@ void BM_mesh_data_free(BMesh *bm)
BLI_freelistN(&bm->selected);
- if (bm->py_handle) {
- extern void bpy_bm_generic_invalidate(void *self);
-
- bpy_bm_generic_invalidate(bm->py_handle);
- bm->py_handle = NULL;
- }
-
BMO_error_clear(bm);
}
@@ -171,15 +162,10 @@ void BM_mesh_data_free(BMesh *bm)
*/
void BM_mesh_clear(BMesh *bm)
{
- Object *ob = bm->ob;
-
/* free old mesh */
BM_mesh_data_free(bm);
memset(bm, 0, sizeof(BMesh));
-
- /* re-initialize mesh */
- bm->ob = ob;
-
+
/* allocate the memory pools for the mesh elements */
bm_mempool_init(bm, &bm_mesh_allocsize_default);
@@ -195,6 +181,16 @@ void BM_mesh_clear(BMesh *bm)
void BM_mesh_free(BMesh *bm)
{
BM_mesh_data_free(bm);
+
+ if (bm->py_handle) {
+ /* keep this out of 'BM_mesh_data_free' because we wan't python
+ * to be able to clear the mesh and maintain access. */
+ extern void bpy_bm_generic_invalidate(void *self);
+
+ bpy_bm_generic_invalidate(bm->py_handle);
+ bm->py_handle = NULL;
+ }
+
MEM_freeN(bm);
}
@@ -225,7 +221,7 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden)
continue;
#endif
- bmesh_face_normal_update(bm, f, f->no);
+ BM_face_normal_update(bm, f);
}
/* Zero out vertex normals */
@@ -341,11 +337,10 @@ static void bm_rationalize_normals(BMesh *bm, int undo)
BMO_op_finish(bm, &bmop);
}
-static void UNUSED_FUNCTION(bm_mdisps_space_set)(BMesh *bm, int from, int to)
+static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from, int to)
{
/* switch multires data out of tangent space */
if (CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
- Object *ob = bm->ob;
BMEditMesh *em = BMEdit_Create(bm, FALSE);
DerivedMesh *dm = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE);
MDisps *mdisps;
@@ -376,6 +371,7 @@ static void UNUSED_FUNCTION(bm_mdisps_space_set)(BMesh *bm, int from, int to)
lmd->disps = MEM_dupallocN(mdisps->disps);
lmd->totdisp = mdisps->totdisp;
+ lmd->level = mdisps->level;
}
mdisps++;
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index d045cd8be90..f48cc09af3b 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -29,7 +29,7 @@
struct BMAllocTemplate;
-BMesh *BM_mesh_create(struct Object *ob, struct BMAllocTemplate *allocsize);
+BMesh *BM_mesh_create(struct BMAllocTemplate *allocsize);
void BM_mesh_free(BMesh *bm);
void BM_mesh_data_free(BMesh *bm);
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index 7b0a59d2ca1..1e478b9b4a8 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -26,16 +26,14 @@
* BM mesh conversion functions.
*/
-
-#include "bmesh.h"
-#include "intern/bmesh_private.h" /* for element checking */
-
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_modifier_types.h"
#include "DNA_key_types.h"
+#include "MEM_guardedalloc.h"
+
#include "BLI_listbase.h"
#include "BLI_array.h"
#include "BLI_math_vector.h"
@@ -46,10 +44,11 @@
#include "BKE_global.h" /* ugh - for looping over all objects */
#include "BKE_main.h"
-#include "MEM_guardedalloc.h"
+#include "bmesh.h"
+#include "intern/bmesh_private.h" /* for element checking */
/* Mesh -> BMesh */
-void BM_mesh_to_bmesh(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
+void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
{
MVert *mvert;
BLI_array_declare(verts);
@@ -251,7 +250,7 @@ void BM_mesh_to_bmesh(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
continue;
}
- /* dont use 'i' since we may have skipped the face */
+ /* don't use 'i' since we may have skipped the face */
BM_elem_index_set(f, bm->totface - 1); /* set_ok */
/* transfer flag */
@@ -374,7 +373,7 @@ static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int ototvert)
/* caller needs to ensure this */
BLI_assert(ototvert > 0);
- vertMap = MEM_callocN(sizeof(*vertMap)*ototvert, "vertMap");
+ vertMap = MEM_callocN(sizeof(*vertMap) * ototvert, "vertMap");
if (CustomData_has_layer(&bm->vdata, CD_SHAPE_KEYINDEX)) {
int *keyi;
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
@@ -407,7 +406,7 @@ static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int ototvert)
return vertMap;
}
-BM_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
+BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
{
/* this is a cheap way to set the edge draw, its not precise and will
* pick the first 2 faces an edge uses */
@@ -421,7 +420,7 @@ BM_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
}
}
-void BM_mesh_from_bmesh(BMesh *bm, Mesh *me, int dotess)
+void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
{
MLoop *mloop;
MPoly *mpoly;
@@ -582,7 +581,7 @@ void BM_mesh_from_bmesh(BMesh *bm, Mesh *me, int dotess)
int i, j;
for (ob = G.main->object.first; ob; ob = ob->id.next) {
- if (ob->parent == bm->ob && ELEM(ob->partype, PARVERT1, PARVERT3)) {
+ if ((ob->parent) && (ob->parent->data == me) && ELEM(ob->partype, PARVERT1, PARVERT3)) {
if (vertMap == NULL) {
vertMap = bm_to_mesh_vertex_map(bm, ototvert);
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.h b/source/blender/bmesh/intern/bmesh_mesh_conv.h
index f1b820767d4..f9c51584081 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.h
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.h
@@ -34,7 +34,7 @@
struct Mesh;
-void BM_mesh_to_bmesh(BMesh *bm, struct Mesh *me, int set_key, int act_key_nr);
-void BM_mesh_from_bmesh(BMesh *bm, struct Mesh *me, int dotess);
+void BM_mesh_bm_from_me(BMesh *bm, struct Mesh *me, int set_key, int act_key_nr);
+void BM_mesh_bm_to_me(BMesh *bm, struct Mesh *me, int dotess);
#endif /* __BMESH_MESH_CONV_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.c b/source/blender/bmesh/intern/bmesh_mesh_validate.c
new file mode 100644
index 00000000000..0ec13f1df8f
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_mesh_validate.c
@@ -0,0 +1,174 @@
+/*
+ * ***** 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) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_mesh_validate.c
+ * \ingroup bmesh
+ *
+ * BM mesh validation function.
+ */
+
+/* debug builds only */
+#ifdef DEBUG
+
+#include "BLI_utildefines.h"
+
+#include "bmesh.h"
+
+#include "bmesh_mesh_validate.h"
+
+
+/* macro which inserts the function name */
+#if defined __GNUC__ || defined __sun
+# define ERRMSG(format, args...) { fprintf(stderr, "%s: " format ", " AT "\n", __func__, ##args); errtot++; } (void)0
+#else
+# define ERRMSG(format, ...) { fprintf(stderr, "%s: " format ", " AT "\n", __func__, __VA_ARGS__); errtot++; } (void)0
+#endif
+
+/**
+ * Check of this BMesh is valid, this function can be slow since its intended to help with debugging.
+ *
+ * \return TRUE when the mesh is valid.
+ */
+int BM_mesh_validate(BMesh *bm)
+{
+ int errtot;
+
+ BMIter iter;
+ BMVert *v;
+ BMEdge *e;
+ BMFace *f;
+
+ int i, j;
+
+ errtot = -1;
+ fprintf(stderr, "\n");
+ ERRMSG("This is a debugging function and not intended for general use, running slow test!");
+
+ /* force recalc, even if tagged as valid, since this mesh is suspect! */
+ bm->elem_index_dirty |= BM_ALL;
+ BM_mesh_elem_index_ensure(bm, BM_ALL);
+
+ BM_ITER_INDEX(v, &iter, bm, BM_VERTS_OF_MESH, NULL, i) {
+ if (v->e) {
+ if (!BM_vert_in_edge(v->e, v)) {
+ ERRMSG("vert: %d - is not in its referenced edge: %d", i, BM_elem_index_get(v->e));
+ }
+ }
+ }
+
+ /* check edges */
+ BM_ITER_INDEX(e, &iter, bm, BM_EDGES_OF_MESH, NULL, i) {
+ if (e->v1 == e->v2)
+ ERRMSG("edge %d: duplicate index: %d", i, BM_elem_index_get(e->v1));
+ }
+
+ /* edge radial structure */
+ BM_ITER_INDEX(e, &iter, bm, BM_EDGES_OF_MESH, NULL, i) {
+ if (e->l) {
+ BMLoop *l_iter;
+ BMLoop *l_first;
+
+ j = 0;
+
+ l_iter = l_first = e->l;
+ /* we could do more checks here, but save for face checks */
+ do {
+ if (l_iter->e != e) {
+ ERRMSG("edge %d: has invalid loop, loop is of face %d", i, BM_elem_index_get(l_iter->f));
+ }
+ else if (BM_vert_in_edge(e, l_iter->v) == FALSE) {
+ ERRMSG("edge %d: has invalid loop with vert not in edge, loop is of face %d", i, BM_elem_index_get(l_iter->f));
+ }
+ else if (BM_vert_in_edge(e, l_iter->next->v) == FALSE) {
+ ERRMSG("edge %d: has invalid loop with next vert not in edge, loop is of face %d", i, BM_elem_index_get(l_iter->f));
+ }
+ } while ((l_iter = l_iter->radial_next) != l_first);
+ }
+ }
+
+ /* face structure */
+ BM_ITER_INDEX(f, &iter, bm, BM_FACES_OF_MESH, NULL, i) {
+ BMLoop *l_iter;
+ BMLoop *l_first;
+
+ l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+
+ do {
+ BM_elem_flag_disable(l_iter, BM_ELEM_INTERNAL_TAG);
+ BM_elem_flag_disable(l_iter->v, BM_ELEM_INTERNAL_TAG);
+ BM_elem_flag_disable(l_iter->e, BM_ELEM_INTERNAL_TAG);
+ } while ((l_iter = l_iter->next) != l_first);
+
+ j = 0;
+
+ l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+ do {
+ if (BM_elem_flag_test(l_iter, BM_ELEM_INTERNAL_TAG)) {
+ ERRMSG("face %d: has duplicate loop at corner: %d", i, j);
+ }
+ if (BM_elem_flag_test(l_iter->v, BM_ELEM_INTERNAL_TAG)) {
+ ERRMSG("face %d: has duplicate vert: %d, at corner: %d", i, BM_elem_index_get(l_iter->v), j);
+ }
+ if (BM_elem_flag_test(l_iter->e, BM_ELEM_INTERNAL_TAG)) {
+ ERRMSG("face %d: has duplicate edge: %d, at corner: %d", i, BM_elem_index_get(l_iter->e), j);
+ }
+
+ /* adjacent data checks */
+ if (l_iter->f != f) {
+ ERRMSG("face %d: has loop that points to face: %d at corner: %d", i, BM_elem_index_get(l_iter->f), j);
+ }
+ if (l_iter != l_iter->prev->next) {
+ ERRMSG("face %d: has invalid 'prev/next' at corner: %d", i, j);
+ }
+ if (l_iter != l_iter->next->prev) {
+ ERRMSG("face %d: has invalid 'next/prev' at corner: %d", i, j);
+ }
+ if (l_iter != l_iter->radial_prev->radial_next) {
+ ERRMSG("face %d: has invalid 'radial_prev/radial_next' at corner: %d", i, j);
+ }
+ if (l_iter != l_iter->radial_next->radial_prev) {
+ ERRMSG("face %d: has invalid 'radial_next/radial_prev' at corner: %d", i, j);
+ }
+
+ BM_elem_flag_enable(l_iter, BM_ELEM_INTERNAL_TAG);
+ BM_elem_flag_enable(l_iter->v, BM_ELEM_INTERNAL_TAG);
+ BM_elem_flag_enable(l_iter->e, BM_ELEM_INTERNAL_TAG);
+ j++;
+ } while ((l_iter = l_iter->next) != l_first);
+
+ if (j != f->len) {
+ ERRMSG("face %d: has length if %d but should be %d", i, f->len, j);
+ }
+ }
+
+
+
+ ERRMSG("Finished - errors %d", errtot);
+
+ return TRUE;
+}
+
+
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.h b/source/blender/bmesh/intern/bmesh_mesh_validate.h
new file mode 100644
index 00000000000..6839dc74d25
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_mesh_validate.h
@@ -0,0 +1,35 @@
+/*
+ * ***** 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) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_MESH_VALIDATE_H__
+#define __BMESH_MESH_VALIDATE_H__
+
+/** \file blender/bmesh/intern/bmesh_mesh_validate.h
+ * \ingroup bmesh
+ */
+
+int BM_mesh_validate(BMesh *bm);
+
+#endif /* __BMESH_MESH_VALIDATE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index 72f6814dc89..da936079dc8 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -71,7 +71,7 @@ int BM_vert_dissolve(BMesh *bm, BMVert *v)
BM_vert_kill(bm, v); /* will kill edges too */
return TRUE;
}
- else if (!BM_vert_is_manifold(bm, v)) {
+ else if (!BM_vert_is_manifold(v)) {
if (!v->e) {
BM_vert_kill(bm, v);
return TRUE;
@@ -91,7 +91,7 @@ int BM_vert_dissolve(BMesh *bm, BMVert *v)
}
}
else if (len == 2 && BM_vert_face_count(v) == 1) {
- /* boundry vertex on a face */
+ /* boundary vertex on a face */
return (BM_vert_collapse_edge(bm, v->e, v, TRUE) != NULL);
}
else {
@@ -108,7 +108,7 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
BMEdge *e, *keepedge = NULL, *baseedge = NULL;
int len = 0;
- if (!BM_vert_is_manifold(bm, v)) {
+ if (!BM_vert_is_manifold(v)) {
return FALSE;
}
@@ -429,7 +429,7 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, float cos[
/* interpolate the loop data for the loops with v==newv, using orig face */
for (j = 0; j < 2; j++) {
- BMEdge *e_iter = (j==0)? e : newe;
+ BMEdge *e_iter = (j == 0) ? e : newe;
BMLoop *l_iter = e_iter->l;
do {
if (l_iter->v == newv) {
@@ -540,7 +540,7 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
else {
/* single face or no faces */
/* same as BM_vert_collapse_edge() however we already
- * have vars to perform this operation so dont call. */
+ * have vars to perform this operation so don't call. */
ne = bmesh_jekv(bm, ke, kv, TRUE);
/* ne = BM_edge_exists(tv, tv2); */ /* same as return above */
@@ -801,7 +801,7 @@ int BM_face_validate(BMesh *bm, BMFace *face, FILE *err)
*
* Examples:
* - the newly formed edge already exists
- * - the new face would be degenerate (zero area / concav / bow-tie)
+ * - the new face would be degenerate (zero area / concave / bow-tie)
* - may want to measure if the new edge gives improved results topology.
* over the old one, as with beauty fill.
*
@@ -824,8 +824,8 @@ void BM_edge_rotate_calc(BMesh *bm, BMEdge *e, int ccw,
BM_edge_ordered_verts(e, &v1, &v2);
/* we could swap the verts _or_ the faces, swapping faces
- * gives more pradictable resuts since that way the next vert
- * just sitches from face fa / fb */
+ * gives more predictable results since that way the next vert
+ * just stitches from face fa / fb */
if (ccw) {
SWAP(BMFace *, fa, fb);
}
@@ -833,7 +833,7 @@ void BM_edge_rotate_calc(BMesh *bm, BMEdge *e, int ccw,
*r_l1 = BM_face_other_vert_loop(fb, v2, v1);
*r_l2 = BM_face_other_vert_loop(fa, v1, v2);
- /* when assert isnt used */
+ /* when assert isn't used */
(void)bm;
}
@@ -852,7 +852,7 @@ int BM_edge_rotate_check(BMesh *UNUSED(bm), BMEdge *e)
la = BM_face_other_vert_loop(fa, e->v2, e->v1);
lb = BM_face_other_vert_loop(fb, e->v2, e->v1);
- /* check that the next vert in both faces isnt the same
+ /* check that the next vert in both faces isn't the same
* (ie - the next edge doesnt share the same faces).
* since we can't rotate usefully in this case. */
if (la->v == lb->v) {
@@ -879,7 +879,7 @@ int BM_edge_rotate_check(BMesh *UNUSED(bm), BMEdge *e)
*
* Check 2 cases
* 1) does the newly forms edge form a flipped face (compare with previous cross product)
- * 2) does the newly formed edge caise a zero area corner (or close enough to be almost zero)
+ * 2) does the newly formed edge cause a zero area corner (or close enough to be almost zero)
*
* \param l1,l2 are the loops of the proposed verts to rotate too and should
* be the result of calling #BM_edge_rotate_calc
@@ -972,7 +972,7 @@ int BM_edge_rotate_check_degenerate(BMesh *bm, BMEdge *e,
return TRUE;
- /* when assert isnt used */
+ /* when assert isn't used */
(void)bm;
}
@@ -1006,6 +1006,8 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_
BMLoop *l1, *l2;
BMFace *f;
BMEdge *e_new = NULL;
+ char f_hflag_prev_1;
+ char f_hflag_prev_2;
if (!BM_edge_rotate_check(bm, e)) {
return NULL;
@@ -1017,8 +1019,6 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_
v1 = l1->v;
v2 = l2->v;
-
-
/* --------------------------------------- */
/* Checking Code - make sure we can rotate */
@@ -1053,6 +1053,9 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_
* if splice if disabled, always add in a new edge even if theres one there. */
e_new = BM_edge_create(bm, v1, v2, e, (check_flag & BM_EDGEROT_CHECK_SPLICE)!=0);
+ f_hflag_prev_1 = l1->f->head.hflag;
+ f_hflag_prev_2 = l2->f->head.hflag;
+
/* don't delete the edge, manually remove the egde after so we can copy its attributes */
f = BM_faces_join_pair(bm, l1->f, l2->f, NULL);
@@ -1066,6 +1069,16 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_
if (!BM_face_split(bm, f, v1, v2, NULL, NULL, TRUE)) {
return NULL;
}
+ else {
+ /* we should really be able to know the faces some other way,
+ * rather then fetching them back from the edge, but this is predictable
+ * where using the return values from face split isn't. - campbell */
+ BMFace *fa, *fb;
+ if (BM_edge_face_pair(e_new, &fa, &fb)) {
+ fa->head.hflag = f_hflag_prev_1;
+ fb->head.hflag = f_hflag_prev_2;
+ }
+ }
return e_new;
}
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index f2dcaded8ca..5162932ea1b 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -54,6 +54,8 @@
*
*/
+#include "BLI_utildefines.h"
+
#include "bmesh.h"
#include "intern/bmesh_private.h"
@@ -93,7 +95,7 @@
/*
* Vertex Smooth
*
- * Smoothes vertices by using a basic vertex averaging scheme.
+ * Smooths vertices by using a basic vertex averaging scheme.
*/
static BMOpDefine bmo_vertexsmooth_def = {
"vertexsmooth",
@@ -700,7 +702,7 @@ static BMOpDefine bmo_esubd_def = {
{BMO_OP_SLOT_INT, "quadcornertype"}, //quad corner type, see bmesh_operators.h
{BMO_OP_SLOT_BOOL, "gridfill"}, //fill in fully-selected faces with a grid
- {BMO_OP_SLOT_BOOL, "singleedge"}, //tesselate the case of one edge selected in a quad or triangle
+ {BMO_OP_SLOT_BOOL, "singleedge"}, //tessellate the case of one edge selected in a quad or triangle
{0} /* null-terminating sentine */,
},
@@ -740,7 +742,7 @@ static BMOpDefine bmo_split_def = {
{BMO_OP_SLOT_MAPPING, "boundarymap"},
{BMO_OP_SLOT_MAPPING, "isovertmap"},
{BMO_OP_SLOT_PNT, "dest"}, /* destination bmesh, if NULL will use current on */
- {BMO_OP_SLOT_BOOL, "use_only_faces"}, /* when enabled. dont duplicate loose verts/edges */
+ {BMO_OP_SLOT_BOOL, "use_only_faces"}, /* when enabled. don't duplicate loose verts/edges */
{0} /* null-terminating sentine */},
bmo_split_exec,
0
@@ -1076,6 +1078,25 @@ static BMOpDefine bmo_solidify_def = {
0
};
+/*
+ * Face Inset
+ *
+ * Extrudes faces individually.
+ */
+static BMOpDefine bmo_inset_def = {
+ "inset",
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+ {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
+ {BMO_OP_SLOT_BOOL, "use_boundary"},
+ {BMO_OP_SLOT_BOOL, "use_even_offset"},
+ {BMO_OP_SLOT_BOOL, "use_relative_offset"},
+ {BMO_OP_SLOT_FLT, "thickness"},
+ {BMO_OP_SLOT_BOOL, "use_outset"},
+ {0} /* null-terminating sentine */},
+ bmo_inset_exec,
+ 0
+};
+
BMOpDefine *opdefines[] = {
&bmo_split_def,
&bmo_spin_def,
@@ -1142,6 +1163,7 @@ BMOpDefine *opdefines[] = {
&bmo_triangle_fill_def,
&bmo_bridge_loops_def,
&bmo_solidify_def,
+ &bmo_inset_def,
};
int bmesh_total_ops = (sizeof(opdefines) / sizeof(void *));
diff --git a/source/blender/bmesh/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index beb601878c8..1b4e119ad92 100644
--- a/source/blender/bmesh/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -43,7 +43,7 @@ extern "C" {
* when it's executed. tool flags are allocated in layers, one per operator
* execution, and are used for all internal flagging a tool needs to do.
*
- * each operator has a series of "slots," which can be of the following types:
+ * each operator has a series of "slots" which can be of the following types:
* - simple numerical types
* - arrays of elements (e.g. arrays of faces).
* - hash mappings.
@@ -81,11 +81,11 @@ struct GHashIterator;
#define BMO_elem_flag_set( bm, ele, oflag, val) _bmo_elem_flag_set (bm, (ele)->oflags, oflag, val)
#define BMO_elem_flag_toggle( bm, ele, oflag) _bmo_elem_flag_toggle (bm, (ele)->oflags, oflag)
-BM_INLINE short _bmo_elem_flag_test(BMesh *bm, BMFlagLayer *oflags, const short oflag);
-BM_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, const short oflag);
-BM_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, const short oflag);
-BM_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val);
-BM_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const short oflag);
+BLI_INLINE short _bmo_elem_flag_test(BMesh *bm, BMFlagLayer *oflags, const short oflag);
+BLI_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, const short oflag);
+BLI_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, const short oflag);
+BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val);
+BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const short oflag);
/* slot type arrays are terminated by the last member
* having a slot type of 0.*/
@@ -184,7 +184,7 @@ void BMO_op_finish(BMesh *bm, BMOperator *op);
/* count the number of elements with a specific flag.
* type can be a bitmask of BM_FACE, BM_EDGE, or BM_FACE. */
-int BMO_mesh_flag_count(BMesh *bm, const short oflag, const char htype);
+int BMO_mesh_flag_count(BMesh *bm, const char htype, const short oflag);
/*---------formatted operator initialization/execution-----------*/
/*
@@ -292,27 +292,27 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *op, const char htype, cons
/* puts every element of type type (which is a bitmask) with tool flag flag,
* into a slot. */
void BMO_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slotname,
- const short oflag, const char htype);
+ const char htype, const short oflag);
/* tool-flags all elements inside an element slot array with flag flag. */
void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slotname,
- const short oflag, const char htype);
+ const char htype, const short oflag);
/* clears tool-flag flag from all elements inside a slot array. */
void BMO_slot_buffer_flag_disable(BMesh *bm, BMOperator *op, const char *slotname,
- const short oflag, const char htype);
+ const char htype, const short oflag);
/* tool-flags all elements inside an element slot array with flag flag. */
void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slotname,
- const char hflag, const char htype, char do_flush_select);
+ const char htype, const char hflag, const char do_flush);
/* clears tool-flag flag from all elements inside a slot array. */
void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOperator *op, const char *slotname,
- const char hflag, const char htype, char do_flush_select);
+ const char htype, const char hflag, const char do_flush);
/* puts every element of type type (which is a bitmask) with header flag
* flag, into a slot. note: ignores hidden elements (e.g. elements with
* header flag BM_ELEM_HIDDEN set).*/
void BMO_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *slotname,
- const char hflag, const char htype);
+ const char htype, const char hflag);
/* counts number of elements inside a slot array. */
int BMO_slot_buffer_count(BMesh *bm, BMOperator *op, const char *slotname);
@@ -328,7 +328,7 @@ int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag);
/* flags all elements in a mapping. note that the mapping must only have
* bmesh elements in it.*/
void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slotname,
- const short oflag, const char hflag);
+ const char hflag, const short oflag);
/* this part of the API is used to iterate over element buffer or
* mapping slots.
@@ -339,7 +339,7 @@ void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slotname,
* BMFace *f;
*
* f = BMO_iter_new(&oiter, bm, some_operator, "slotname", BM_FACE);
- * for (; f; f=BMO_iter_step(&oiter)) {
+ * for (; f; f = BMO_iter_step(&oiter)) {
* /do something with the face
* }
*
@@ -349,7 +349,7 @@ void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slotname,
* void *val;
*
* key = BMO_iter_new(&oiter, bm, some_operator, "slotname", 0);
- * for (; key; key=BMO_iter_step(&oiter)) {
+ * for (; key; key = BMO_iter_step(&oiter)) {
* val = BMO_iter_map_value(&oiter);
* //do something with the key/val pair
* //note that val is a pointer to the val data,
@@ -389,7 +389,7 @@ float BMO_iter_map_value_f(BMOIter *iter);
#define BMO_ITER(ele, iter, bm, op, slotname, restrict) \
ele = BMO_iter_new(iter, bm, op, slotname, restrict); \
- for ( ; ele; ele=BMO_iter_step(iter))
+ for ( ; ele; ele = BMO_iter_step(iter))
/******************* Inlined Functions********************/
typedef void (*opexec)(BMesh *bm, BMOperator *op);
diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.c b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
index 5b88d9f1b96..268736cfe0e 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api_inline.c
+++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
@@ -20,17 +20,14 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_operator_api_inline.c
+/** \file blender/bmesh/intern/bmesh_operator_api_inline.h
* \ingroup bmesh
*
* BMesh inline operator functions.
*/
-#ifndef __BMESH_OPERATOR_API_INLINE_C__
-#define __BMESH_OPERATOR_API_INLINE_C__
-
-#include "bmesh.h"
-
+#ifndef __BMESH_OPERATOR_API_INLINE_H__
+#define __BMESH_OPERATOR_API_INLINE_H__
/* tool flag API. never, ever ever should tool code put junk in
* header flags (element->head.flag), nor should they use
@@ -41,39 +38,39 @@
* ghash or a mapping slot to do it. */
/* flags 15 and 16 (1 << 14 and 1 << 15) are reserved for bmesh api use */
-BM_INLINE short _bmo_elem_flag_test(BMesh *bm, BMFlagLayer *oflags, const short oflag)
+BLI_INLINE short _bmo_elem_flag_test(BMesh *bm, BMFlagLayer *oflags, const short oflag)
{
return oflags[bm->stackdepth - 1].f & oflag;
}
-BM_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, const short oflag)
+BLI_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, const short oflag)
{
oflags[bm->stackdepth - 1].f |= oflag;
}
-BM_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, const short oflag)
+BLI_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, const short oflag)
{
oflags[bm->stackdepth - 1].f &= ~oflag;
}
-BM_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val)
+BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val)
{
if (val) oflags[bm->stackdepth - 1].f |= oflag;
else oflags[bm->stackdepth - 1].f &= ~oflag;
}
-BM_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const short oflag)
+BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const short oflag)
{
oflags[bm->stackdepth - 1].f ^= oflag;
}
-BM_INLINE void BMO_slot_map_int_insert(BMesh *bm, BMOperator *op, const char *slotname,
+BLI_INLINE void BMO_slot_map_int_insert(BMesh *bm, BMOperator *op, const char *slotname,
void *element, int val)
{
BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(int));
}
-BM_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char *slotname,
+BLI_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char *slotname,
void *element, float val)
{
BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(float));
@@ -85,13 +82,13 @@ BM_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char *
* do NOT use these for non-operator-api-allocated memory! instead
* use BMO_slot_map_data_get and BMO_slot_map_insert, which copies the data. */
-BM_INLINE void BMO_slot_map_ptr_insert(BMesh *bm, BMOperator *op, const char *slotname,
+BLI_INLINE void BMO_slot_map_ptr_insert(BMesh *bm, BMOperator *op, const char *slotname,
void *element, void *val)
{
BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(void *));
}
-BM_INLINE int BMO_slot_map_contains(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, void *element)
+BLI_INLINE int BMO_slot_map_contains(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, void *element)
{
BMOpSlot *slot = BMO_slot_get(op, slotname);
BLI_assert(slot->slottype == BMO_OP_SLOT_MAPPING);
@@ -102,7 +99,7 @@ BM_INLINE int BMO_slot_map_contains(BMesh *UNUSED(bm), BMOperator *op, const cha
return BLI_ghash_haskey(slot->data.ghash, element);
}
-BM_INLINE void *BMO_slot_map_data_get(BMesh *UNUSED(bm), BMOperator *op, const char *slotname,
+BLI_INLINE void *BMO_slot_map_data_get(BMesh *UNUSED(bm), BMOperator *op, const char *slotname,
void *element)
{
BMOElemMapping *mapping;
@@ -119,7 +116,7 @@ BM_INLINE void *BMO_slot_map_data_get(BMesh *UNUSED(bm), BMOperator *op, const c
return mapping + 1;
}
-BM_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *slotname,
+BLI_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *slotname,
void *element)
{
float *val = (float *) BMO_slot_map_data_get(bm, op, slotname, element);
@@ -128,7 +125,7 @@ BM_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *sl
return 0.0f;
}
-BM_INLINE int BMO_slot_map_int_get(BMesh *bm, BMOperator *op, const char *slotname,
+BLI_INLINE int BMO_slot_map_int_get(BMesh *bm, BMOperator *op, const char *slotname,
void *element)
{
int *val = (int *) BMO_slot_map_data_get(bm, op, slotname, element);
@@ -137,7 +134,7 @@ BM_INLINE int BMO_slot_map_int_get(BMesh *bm, BMOperator *op, const char *slotna
return 0;
}
-BM_INLINE void *BMO_slot_map_ptr_get(BMesh *bm, BMOperator *op, const char *slotname,
+BLI_INLINE void *BMO_slot_map_ptr_get(BMesh *bm, BMOperator *op, const char *slotname,
void *element)
{
void **val = (void **) BMO_slot_map_data_get(bm, op, slotname, element);
@@ -146,4 +143,4 @@ BM_INLINE void *BMO_slot_map_ptr_get(BMesh *bm, BMOperator *op, const char *slot
return NULL;
}
-#endif /* __BMESH_OPERATOR_API_INLINE_C__ */
+#endif /* __BMESH_OPERATOR_API_INLINE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index eb83d5f6b35..4c38ccacb31 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -455,7 +455,7 @@ void BMO_slot_vec_get(BMOperator *op, const char *slotname, float r_vec[3])
*
*/
-int BMO_mesh_flag_count(BMesh *bm, const short oflag, const char htype)
+int BMO_mesh_flag_count(BMesh *bm, const char htype, const short oflag)
{
BMIter elements;
int count = 0;
@@ -596,7 +596,7 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slotcode, int totadd)
#endif
void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slotname,
- const short oflag, const char htype)
+ const char htype, const short oflag)
{
GHashIterator it;
BMOpSlot *slot = BMO_slot_get(op, slotname);
@@ -679,7 +679,7 @@ static void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot
* into a slot for an operator.
*/
void BMO_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *slotname,
- const char hflag, const char htype)
+ const char htype, const char hflag)
{
BMIter elements;
BMElem *ele;
@@ -730,11 +730,11 @@ void BMO_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *slotname,
* into an output slot for an operator.
*/
void BMO_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slotname,
- const short oflag, const char htype)
+ const char htype, const short oflag)
{
BMIter elements;
BMOpSlot *slot = BMO_slot_get(op, slotname);
- int totelement = BMO_mesh_flag_count(bm, oflag, htype), i = 0;
+ int totelement = BMO_mesh_flag_count(bm, htype, oflag), i = 0;
BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
@@ -785,26 +785,29 @@ void BMO_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slotname,
* using the selection API where appropriate.
*/
void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slotname,
- const char hflag, const char htype, char do_flush_select)
+ const char htype, const char hflag, const char do_flush)
{
BMOpSlot *slot = BMO_slot_get(op, slotname);
BMElem **data = slot->data.p;
int i;
+ const char do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
+ const char do_flush_hide = (do_flush && (hflag & BM_ELEM_HIDDEN));
BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
- if (!(hflag & BM_ELEM_SELECT)) {
- do_flush_select = FALSE;
- }
-
- for (i = 0; i < slot->len; i++) {
- if (!(htype & data[i]->head.htype))
+ for (i = 0; i < slot->len; i++, data++) {
+ if (!(htype & (*data)->head.htype))
continue;
if (do_flush_select) {
- BM_elem_select_set(bm, data[i], TRUE);
+ BM_elem_select_set(bm, *data, TRUE);
}
- BM_elem_flag_enable(data[i], hflag);
+
+ if (do_flush_hide) {
+ BM_elem_hide_set(bm, *data, FALSE);
+ }
+
+ BM_elem_flag_enable(*data, hflag);
}
}
@@ -815,29 +818,32 @@ void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slotnam
* using the selection API where appropriate.
*/
void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOperator *op, const char *slotname,
- const char hflag, const char htype, char do_flush_select)
+ const char htype, const char hflag, const char do_flush)
{
BMOpSlot *slot = BMO_slot_get(op, slotname);
BMElem **data = slot->data.p;
int i;
+ const char do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
+ const char do_flush_hide = (do_flush && (hflag & BM_ELEM_HIDDEN));
BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
- if (!(hflag & BM_ELEM_SELECT)) {
- do_flush_select = FALSE;
- }
-
- for (i = 0; i < slot->len; i++) {
- if (!(htype & data[i]->head.htype))
+ for (i = 0; i < slot->len; i++, data++) {
+ if (!(htype & (*data)->head.htype))
continue;
if (do_flush_select) {
- BM_elem_select_set(bm, data[i], FALSE);
+ BM_elem_select_set(bm, *data, FALSE);
+ }
+
+ if (do_flush_hide) {
+ BM_elem_hide_set(bm, *data, FALSE);
}
- BM_elem_flag_disable(data[i], hflag);
+ BM_elem_flag_disable(*data, hflag);
}
}
+
int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag)
{
int count = 0;
@@ -863,7 +869,7 @@ int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag)
* Flags elements in a slots buffer
*/
void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slotname,
- const short oflag, const char htype)
+ const char htype, const short oflag)
{
BMOpSlot *slot = BMO_slot_get(op, slotname);
BMHeader **data = slot->data.p;
@@ -885,7 +891,7 @@ void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slotname
* Removes flags from elements in a slots buffer
*/
void BMO_slot_buffer_flag_disable(BMesh *bm, BMOperator *op, const char *slotname,
- const short oflag, const char htype)
+ const char htype, const short oflag)
{
BMOpSlot *slot = BMO_slot_get(op, slotname);
BMHeader **data = slot->data.p;
@@ -1239,14 +1245,21 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
BMOpDefine *def;
char *opname, *ofmt, *fmt;
char slotname[64] = {0};
- int i /*, n = strlen(fmt) */, stop /*, slotcode = -1 */, ret, type, state;
+ int i /*, n = strlen(fmt) */, stop /*, slotcode = -1 */, type, state;
+ char htype;
int noslot = 0;
/* basic useful info to help find where bmop formatting strings fail */
+ const char *err_reason = "Unknown";
int lineno = -1;
-# define GOTO_ERROR { lineno = __LINE__; goto error; }
+#define GOTO_ERROR(reason) \
+ { \
+ err_reason = reason; \
+ lineno = __LINE__; \
+ goto error; \
+ } (void)0
/* we muck around in here, so dup i */
fmt = ofmt = BLI_strdup(_fmt);
@@ -1287,11 +1300,15 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
* a little flexible, allowing "slot=%f",
* "slot %f", "slot%f", and "slot\t%f". */
i = strcspn(fmt, "= \t%");
- if (!fmt[i]) GOTO_ERROR;
+ if (!fmt[i]) {
+ GOTO_ERROR("could not match end of slot name");
+ }
fmt[i] = 0;
- if (bmo_name_to_slotcode_check(def, fmt) < 0) GOTO_ERROR;
+ if (bmo_name_to_slotcode_check(def, fmt) < 0) {
+ GOTO_ERROR("name to slot code check failed");
+ }
BLI_strncpy(slotname, fmt, sizeof(slotname));
@@ -1311,9 +1328,9 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
c = NEXT_CHAR(fmt);
fmt++;
- if (c == '3') size = 3;
+ if (c == '3') size = 3;
else if (c == '4') size = 4;
- else GOTO_ERROR;
+ else GOTO_ERROR("matrix size was not 3 or 4");
BMO_slot_mat_set(op, slotname, va_arg(vlist, void *), size);
state = 1;
@@ -1364,13 +1381,13 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
BMO_slot_float_set(op, slotname, va_arg(vlist, double));
}
else {
- ret = 0;
+ htype = 0;
stop = 0;
while (1) {
switch (NEXT_CHAR(fmt)) {
- case 'f': ret |= BM_FACE; break;
- case 'e': ret |= BM_EDGE; break;
- case 'v': ret |= BM_VERT; break;
+ case 'f': htype |= BM_FACE; break;
+ case 'e': htype |= BM_EDGE; break;
+ case 'v': htype |= BM_VERT; break;
default:
stop = 1;
break;
@@ -1383,13 +1400,13 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
}
if (type == 'h') {
- BMO_slot_buffer_from_hflag(bm, op, slotname, va_arg(vlist, int), ret);
+ BMO_slot_buffer_from_hflag(bm, op, slotname, htype, va_arg(vlist, int));
}
else if (type == 'a') {
- BMO_slot_buffer_from_all(bm, op, slotname, ret);
+ BMO_slot_buffer_from_all(bm, op, slotname, htype);
}
else {
- BMO_slot_buffer_from_flag(bm, op, slotname, va_arg(vlist, int), ret);
+ BMO_slot_buffer_from_flag(bm, op, slotname, htype, va_arg(vlist, int));
}
}
@@ -1410,9 +1427,24 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
error:
/* non urgent todo - explain exactly what is failing */
- fprintf(stderr,
- "%s: error parsing formatting string, %d in '%s'\n see - %s:%d\n",
- __func__, (int)(fmt - ofmt), _fmt, __FILE__, lineno);
+ fprintf(stderr, "%s: error parsing formatting string\n", __func__);
+
+ fprintf(stderr, "string: '%s', position %d\n", _fmt, (int)(fmt - ofmt));
+ fprintf(stderr, " ");
+ {
+ int pos = (int)(fmt - ofmt);
+ int i;
+ for (i = 0; i < pos; i++) {
+ fprintf(stderr, " ");
+ }
+ fprintf(stderr, "^\n");
+ }
+
+ fprintf(stderr, "source code: %s:%d\n", __FILE__, lineno);
+
+ fprintf(stderr, "reason: %s\n", err_reason);
+
+
MEM_freeN(ofmt);
BMO_op_finish(bm, op);
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index e88f8900923..eadfcde81d3 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -96,4 +96,6 @@ void BM_mesh_esubdivideflag(struct Object *obedit, BMesh *bm, int flag, float sm
float fractal, int beauty, int numcuts, int seltype,
int cornertype, int singleedge, int gridfill, int seed);
+#include "intern/bmesh_operator_api_inline.h"
+
#endif /* __BMESH_OPERATORS_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_operators_private.h b/source/blender/bmesh/intern/bmesh_operators_private.h
index 53df0902d59..0e228148918 100644
--- a/source/blender/bmesh/intern/bmesh_operators_private.h
+++ b/source/blender/bmesh/intern/bmesh_operators_private.h
@@ -98,5 +98,6 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op);
void bmo_create_circle_exec(BMesh *bm, BMOperator *op);
void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op);
void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op);
+void bmo_inset_exec(BMesh *bm, BMOperator *op);
#endif /* __BMESH_OPERATORS_PRIVATE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 54063c28ea5..bdecdfee850 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -75,15 +75,13 @@ static short testedgesidef(const float v1[2], const float v2[2], const float v3[
* polygon See Graphics Gems for
* computing newell normal.
*/
-static void compute_poly_normal(float normal[3], float (*verts)[3], int nverts)
+static void compute_poly_normal(float normal[3], float const (* verts)[3], int nverts)
{
float const *v_prev = verts[nverts - 1];
float const *v_curr = verts[0];
float n[3] = {0.0f};
int i;
- verts[0][0] = 1;
-
/* Newell's Method */
for (i = 0; i < nverts; v_prev = v_curr, v_curr = verts[++i]) {
n[0] += (v_prev[1] - v_curr[1]) * (v_prev[2] + v_curr[2]);
@@ -132,14 +130,15 @@ static void bm_face_compute_poly_normal(BMFace *f)
* Same as #compute_poly_normal and #bm_face_compute_poly_normal
* but takes an array of vertex locations.
*/
-static void bm_face_compute_poly_normal_vcos(BMFace *f, float (*vertexCos)[3])
+static void bm_face_compute_poly_normal_vertex_cos(BMFace *f, float n[3],
+ float const (*vertexCos)[3])
{
BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
BMLoop *l_iter = l_first;
float const *v_prev = vertexCos[BM_elem_index_get(l_first->prev->v)];
float const *v_curr = vertexCos[BM_elem_index_get(l_first->v)];
- float n[3] = {0.0f};
+ zero_v3(n);
/* Newell's Method */
do {
@@ -152,8 +151,8 @@ static void bm_face_compute_poly_normal_vcos(BMFace *f, float (*vertexCos)[3])
v_curr = vertexCos[BM_elem_index_get(l_iter->v)];
} while (l_iter != l_first);
- if (UNLIKELY(normalize_v3_v3(f->no, n) == 0.0f)) {
- f->no[2] = 1.0f; /* other axis set to 0.0 */
+ if (UNLIKELY(normalize_v3(n) == 0.0f)) {
+ n[2] = 1.0f; /* other axis set to 0.0 */
}
}
@@ -164,7 +163,7 @@ static void bm_face_compute_poly_normal_vcos(BMFace *f, float (*vertexCos)[3])
* area of a polygon in the X/Y
* plane.
*/
-static int compute_poly_center(float center[3], float *r_area, float (*verts)[3], int nverts)
+static int compute_poly_center(float center[3], float *r_area, float (* const verts)[3], int nverts)
{
int i, j;
float atmp = 0.0f, xtmp = 0.0f, ytmp = 0.0f, ai;
@@ -360,25 +359,6 @@ void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nvert
}
/**
- * \brief BMESH UPDATE FACE NORMAL
- *
- * Updates the stored normal for the
- * given face. Requires that a buffer
- * of sufficient length to store projected
- * coordinates for all of the face's vertices
- * is passed in as well.
- */
-void BM_face_normal_update(BMesh *bm, BMFace *f)
-{
- bmesh_face_normal_update(bm, f, f->no);
-}
-/* same as BM_face_normal_update but takes vertex coords */
-void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], float (*vertexCos)[3])
-{
- bmesh_face_normal_update_vertex_cos(bm, f, no, vertexCos);
-}
-
-/**
* updates face and vertex normals incident on an edge
*/
void BM_edge_normals_update(BMesh *bm, BMEdge *e)
@@ -440,7 +420,17 @@ void BM_vert_normal_update_all(BMesh *bm, BMVert *v)
BM_vert_normal_update(bm, v);
}
-void bmesh_face_normal_update(BMesh *UNUSED(bm), BMFace *f, float no[3])
+/**
+ * \brief BMESH UPDATE FACE NORMAL
+ *
+ * Updates the stored normal for the
+ * given face. Requires that a buffer
+ * of sufficient length to store projected
+ * coordinates for all of the face's vertices
+ * is passed in as well.
+ */
+
+void BM_face_normal_update(BMesh *UNUSED(bm), BMFace *f)
{
BMLoop *l;
@@ -453,7 +443,7 @@ void bmesh_face_normal_update(BMesh *UNUSED(bm), BMFace *f, float no[3])
const float *co3 = (l = l->next)->v->co;
const float *co4 = (l->next)->v->co;
- normal_quad_v3(no, co1, co2, co3, co4);
+ normal_quad_v3(f->no, co1, co2, co3, co4);
break;
}
case 3:
@@ -462,12 +452,12 @@ void bmesh_face_normal_update(BMesh *UNUSED(bm), BMFace *f, float no[3])
const float *co2 = (l = l->next)->v->co;
const float *co3 = (l->next)->v->co;
- normal_tri_v3(no, co1, co2, co3);
+ normal_tri_v3(f->no, co1, co2, co3);
break;
}
case 0:
{
- zero_v3(no);
+ zero_v3(f->no);
break;
}
default:
@@ -478,8 +468,8 @@ void bmesh_face_normal_update(BMesh *UNUSED(bm), BMFace *f, float no[3])
}
}
/* exact same as 'bmesh_face_normal_update' but accepts vertex coords */
-void bmesh_face_normal_update_vertex_cos(BMesh *bm, BMFace *f, float no[3],
- float (*vertexCos)[3])
+void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3],
+ float const (*vertexCos)[3])
{
BMLoop *l;
@@ -514,7 +504,7 @@ void bmesh_face_normal_update_vertex_cos(BMesh *bm, BMFace *f, float no[3],
}
default:
{
- bm_face_compute_poly_normal_vcos(f, vertexCos);
+ bm_face_compute_poly_normal_vertex_cos(f, no, vertexCos);
break;
}
}
@@ -634,7 +624,7 @@ int BM_face_point_inside_test(BMesh *bm, BMFace *f, const float co[3])
return crosses % 2 != 0;
}
-static int goodline(float (*projectverts)[3], BMFace *f, int v1i,
+static int goodline(float const (*projectverts)[3], BMFace *f, int v1i,
int v2i, int v3i, int UNUSED(nvert))
{
BMLoop *l_iter;
@@ -720,7 +710,7 @@ static BMLoop *find_ear(BMesh *UNUSED(bm), BMFace *f, float (*verts)[3], const i
if (BM_edge_exists(v1, v3)) {
isear = 0;
}
- else if (!goodline(verts, f, BM_elem_index_get(v1), BM_elem_index_get(v2), BM_elem_index_get(v3), nvert)) {
+ else if (!goodline((float const (*)[3])verts, f, BM_elem_index_get(v1), BM_elem_index_get(v2), BM_elem_index_get(v3), nvert)) {
isear = 0;
}
@@ -785,7 +775,7 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3],
///bmesh_face_normal_update(bm, f, f->no, projectverts);
- compute_poly_normal(f->no, projectverts, f->len);
+ compute_poly_normal(f->no, (float const (*)[3])projectverts, f->len);
poly_rotate_plane(f->no, projectverts, i);
nvert = f->len;
@@ -899,7 +889,7 @@ void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len)
a++;
}
- compute_poly_normal(no, projverts, f->len);
+ compute_poly_normal(no, (float const (*)[3])projverts, f->len);
poly_rotate_plane(no, projverts, f->len);
poly_rotate_plane(no, edgeverts, len * 2);
diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h
index 49fe2d7a809..3c8f3dc3339 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.h
+++ b/source/blender/bmesh/intern/bmesh_polygon.h
@@ -32,7 +32,8 @@ void BM_face_center_bounds_calc(BMesh *bm, BMFace *f, float center[3]);
void BM_face_center_mean_calc(BMesh *bm, BMFace *f, float center[3]);
void BM_face_normal_update(BMesh *bm, BMFace *f);
-void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], float (*vertexCos)[3]);
+void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3],
+ float const (*vertexCos)[3]);
void BM_edge_normals_update(BMesh *bm, BMEdge *e);
diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h
index d44eaba039b..3f67deb7997 100644
--- a/source/blender/bmesh/intern/bmesh_private.h
+++ b/source/blender/bmesh/intern/bmesh_private.h
@@ -65,10 +65,6 @@ int bmesh_disk_count(BMVert *v);
#define BM_ELEM_API_FLAG_DISABLE(element, f) ((element)->oflags[0].pflag &= ~(f))
#define BM_ELEM_API_FLAG_TEST(element, f) ((element)->oflags[0].pflag & (f))
-void bmesh_face_normal_update(BMesh *bm, BMFace *f, float no[3]);
-void bmesh_face_normal_update_vertex_cos(BMesh *bm, BMFace *f, float no[3],
- float (*vertexCos)[3]);
-
void compute_poly_plane(float (*verts)[3], int nverts);
void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nverts);
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index e6dc1e1dd80..8f1568119f8 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -259,6 +259,14 @@ BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v)
}
/**
+ * Returms edge length
+ */
+float BM_edge_length_calc(BMEdge *e)
+{
+ return len_v3v3(e->v1->co, e->v2->co);
+}
+
+/**
* Utility function, since enough times we have an edge
* and want to access 2 connected faces.
*
@@ -284,6 +292,31 @@ int BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb)
}
/**
+ * Utility function, since enough times we have an edge
+ * and want to access 2 connected loops.
+ *
+ * \return TRUE when only 2 faces are found.
+ */
+int BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
+{
+ BMLoop *la, *lb;
+
+ if ((la = e->l) &&
+ (lb = la->radial_next) &&
+ (lb->radial_next == la))
+ {
+ *r_la = la;
+ *r_lb = lb;
+ return TRUE;
+ }
+ else {
+ *r_la = NULL;
+ *r_lb = NULL;
+ return FALSE;
+ }
+}
+
+/**
* Returns the number of edges around this vertex.
*/
int BM_vert_edge_count(BMVert *v)
@@ -291,6 +324,18 @@ int BM_vert_edge_count(BMVert *v)
return bmesh_disk_count(v);
}
+int BM_vert_edge_count_nonwire(BMVert *v)
+{
+ int count = 0;
+ BMIter eiter;
+ BMEdge *edge;
+ BM_ITER(edge, &eiter, NULL, BM_EDGES_OF_VERT, v) {
+ if (edge->l) {
+ count++;
+ }
+ }
+ return count;
+}
/**
* Returns the number of faces around this edge
*/
@@ -344,7 +389,7 @@ int BM_vert_face_count(BMVert *v)
* Tests whether or not the vertex is part of a wire edge.
* (ie: has no faces attached to it)
*/
-int BM_vert_is_wire(BMesh *UNUSED(bm), BMVert *v)
+int BM_vert_is_wire(BMVert *v)
{
BMEdge *curedge;
@@ -368,7 +413,7 @@ int BM_vert_is_wire(BMesh *UNUSED(bm), BMVert *v)
* Tests whether or not the edge is part of a wire.
* (ie: has no faces attached to it)
*/
-int BM_edge_is_wire(BMesh *UNUSED(bm), BMEdge *e)
+int BM_edge_is_wire(BMEdge *e)
{
return (e->l) ? FALSE : TRUE;
}
@@ -380,7 +425,7 @@ int BM_edge_is_wire(BMesh *UNUSED(bm), BMEdge *e)
* 3: Is part of a non-manifold edge (edge with more than 2 faces)
* 4: Is part of a wire edge
*/
-int BM_vert_is_manifold(BMesh *UNUSED(bm), BMVert *v)
+int BM_vert_is_manifold(BMVert *v)
{
BMEdge *e, *oe;
BMLoop *l;
@@ -446,14 +491,14 @@ int BM_vert_is_manifold(BMesh *UNUSED(bm), BMVert *v)
*/
#if 1 /* fast path for checking manifold */
-int BM_edge_is_manifold(BMesh *UNUSED(bm), BMEdge *e)
+int BM_edge_is_manifold(BMEdge *e)
{
const BMLoop *l = e->l;
return (l && ((l->radial_next == l) || /* 1 face user */
(l->radial_next->radial_next == l))); /* 2 face users */
}
#else
-int BM_edge_is_manifold(BMesh *UNUSED(bm), BMEdge *e)
+int BM_edge_is_manifold(BMEdge *e)
{
int count = BM_edge_face_count(e);
if (count == 2 || count == 1) {
@@ -470,7 +515,7 @@ int BM_edge_is_manifold(BMesh *UNUSED(bm), BMEdge *e)
* of a shell (has one face associated with it)
*/
-#if 1 /* fast path for checking boundry */
+#if 1 /* fast path for checking boundary */
int BM_edge_is_boundary(BMEdge *e)
{
const BMLoop *l = e->l;
@@ -583,15 +628,18 @@ BMLoop *BM_face_vert_share_loop(BMFace *f, BMVert *v)
* Returns the verts of an edge as used in a face
* if used in a face at all, otherwise just assign as used in the edge.
*
- * Useful to get a determanistic winding order when calling
+ * Useful to get a deterministic winding order when calling
* BM_face_create_ngon() on an arbitrary array of verts,
* though be sure to pick an edge which has a face.
*/
-void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
+void BM_edge_ordered_verts_ex(BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
+ BMLoop *edge_loop)
{
- if ((edge->l == NULL) ||
- (((edge->l->prev->v == edge->v1) && (edge->l->v == edge->v2)) ||
- ((edge->l->v == edge->v1) && (edge->l->next->v == edge->v2)))
+ BLI_assert(edge_loop->e == edge);
+
+ if ((edge_loop == NULL) ||
+ (((edge_loop->prev->v == edge->v1) && (edge_loop->v == edge->v2)) ||
+ ((edge_loop->v == edge->v1) && (edge_loop->next->v == edge->v2)))
)
{
*r_v1 = edge->v1;
@@ -603,13 +651,18 @@ void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
}
}
+void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
+{
+ BM_edge_ordered_verts_ex(edge, r_v1, r_v2, edge->l);
+}
+
/**
* Calculates the angle between the previous and next loops
* (angle at this loops face corner).
*
* \return angle in radians
*/
-float BM_loop_face_angle(BMesh *UNUSED(bm), BMLoop *l)
+float BM_loop_face_angle(BMLoop *l)
{
return angle_v3v3v3(l->prev->v->co,
l->v->co,
@@ -617,6 +670,65 @@ float BM_loop_face_angle(BMesh *UNUSED(bm), BMLoop *l)
}
/**
+ * \brief BM_loop_face_normal
+ *
+ * Calculate the normal at this loop corner or fallback to the face normal on straignt lines.
+ *
+ * \param bm The BMesh
+ * \param l The loop to calculate the normal at
+ * \param r_normal Resulting normal
+ */
+void BM_loop_face_normal(BMLoop *l, float r_normal[3])
+{
+ if (normal_tri_v3(r_normal,
+ l->prev->v->co,
+ l->v->co,
+ l->next->v->co) != 0.0f)
+ {
+ return;
+ }
+ else {
+ copy_v3_v3(r_normal, l->f->no);
+ }
+}
+
+/**
+ * \brief BM_loop_face_tangent
+ *
+ * Calculate the tangent at this loop corner or fallback to the face normal on straignt lines.
+ * This vector always points inward into the face.
+ *
+ * \param bm The BMesh
+ * \param l The loop to calculate the tangent at
+ * \param r_tangent Resulting tangent
+ */
+void BM_loop_face_tangent(BMLoop *l, float r_tangent[3])
+{
+ float v_prev[3];
+ float v_next[3];
+
+ sub_v3_v3v3(v_prev, l->prev->v->co, l->v->co);
+ sub_v3_v3v3(v_next, l->v->co, l->next->v->co);
+
+ normalize_v3(v_prev);
+ normalize_v3(v_next);
+
+ if (compare_v3v3(v_prev, v_next, FLT_EPSILON) == FALSE) {
+ float dir[3];
+ float nor[3]; /* for this purpose doesnt need to be normalized */
+ add_v3_v3v3(dir, v_prev, v_next);
+ cross_v3_v3v3(nor, v_prev, v_next);
+ cross_v3_v3v3(r_tangent, dir, nor);
+ }
+ else {
+ /* prev/next are the same - compare with face normal since we don't have one */
+ cross_v3_v3v3(r_tangent, v_next, l->f->no);
+ }
+
+ normalize_v3(r_tangent);
+}
+
+/**
* \brief BMESH EDGE/FACE ANGLE
*
* Calculates the angle between two faces.
@@ -624,7 +736,7 @@ float BM_loop_face_angle(BMesh *UNUSED(bm), BMLoop *l)
*
* \return angle in radians
*/
-float BM_edge_face_angle(BMesh *UNUSED(bm), BMEdge *e)
+float BM_edge_face_angle(BMEdge *e)
{
if (BM_edge_face_count(e) == 2) {
BMLoop *l1 = e->l;
@@ -643,7 +755,7 @@ float BM_edge_face_angle(BMesh *UNUSED(bm), BMEdge *e)
*
* \returns the angle in radians
*/
-float BM_vert_edge_angle(BMesh *UNUSED(bm), BMVert *v)
+float BM_vert_edge_angle(BMVert *v)
{
BMEdge *e1, *e2;
@@ -790,7 +902,7 @@ int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len)
}
}
- /* now tag all verts and edges in the boundry array as true so
+ /* now tag all verts and edges in the boundary array as true so
* we can know if a face-vert is from our array */
for (i = 0; i < len; i++) {
BM_elem_flag_enable(varr[i], BM_ELEM_INTERNAL_TAG);
@@ -798,10 +910,10 @@ int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len)
}
- /* so! boundry is tagged, everything else cleared */
+ /* so! boundary is tagged, everything else cleared */
- /* 1) tag all faces connected to edges - if all their verts are boundry */
+ /* 1) tag all faces connected to edges - if all their verts are boundary */
tot_tag = 0;
for (i = 0; i < len; i++) {
BM_ITER(f, &fiter, bm, BM_FACES_OF_EDGE, earr[i]) {
@@ -815,7 +927,7 @@ int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len)
}
if (ok) {
- /* we only use boundry verts */
+ /* we only use boundary verts */
BM_elem_flag_enable(f, BM_ELEM_INTERNAL_TAG);
tot_tag++;
}
@@ -827,19 +939,19 @@ int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len)
}
if (tot_tag == 0) {
- /* no faces use only boundry verts, quit early */
+ /* no faces use only boundary verts, quit early */
return FALSE;
}
- /* 2) loop over non-boundry edges that use boundry verts,
+ /* 2) loop over non-boundary edges that use boundary verts,
* check each have 2 tagges faces connected (faces that only use 'varr' verts) */
ok = TRUE;
for (i = 0; i < len; i++) {
BM_ITER(e, &fiter, bm, BM_EDGES_OF_VERT, varr[i]) {
- if (/* non-boundry edge */
+ if (/* non-boundary edge */
BM_elem_flag_test(e, BM_ELEM_INTERNAL_TAG) == FALSE &&
- /* ...using boundry verts */
+ /* ...using boundary verts */
BM_elem_flag_test(e->v1, BM_ELEM_INTERNAL_TAG) == TRUE &&
BM_elem_flag_test(e->v2, BM_ELEM_INTERNAL_TAG) == TRUE)
{
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h
index a394999d439..c2a718b49ce 100644
--- a/source/blender/bmesh/intern/bmesh_queries.h
+++ b/source/blender/bmesh/intern/bmesh_queries.h
@@ -37,26 +37,31 @@ int BM_edge_in_face(BMFace *f, BMEdge *e);
int BM_vert_in_edge(BMEdge *e, BMVert *v);
int BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e);
+float BM_edge_length_calc(BMEdge *e);
int BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb);
+int BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb);
BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v);
BMLoop *BM_face_other_edge_loop(BMFace *f, BMEdge *e, BMVert *v);
BMLoop *BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v);
+int BM_vert_edge_count_nonwire(BMVert *v);
int BM_vert_edge_count(BMVert *v);
int BM_edge_face_count(BMEdge *e);
int BM_vert_face_count(BMVert *v);
-int BM_vert_is_wire(BMesh *bm, BMVert *v);
-int BM_edge_is_wire(BMesh *bm, BMEdge *e);
+int BM_vert_is_wire(BMVert *v);
+int BM_edge_is_wire(BMEdge *e);
-int BM_vert_is_manifold(BMesh *bm, BMVert *v);
-int BM_edge_is_manifold(BMesh *bm, BMEdge *e);
+int BM_vert_is_manifold(BMVert *v);
+int BM_edge_is_manifold(BMEdge *e);
int BM_edge_is_boundary(BMEdge *e);
-float BM_loop_face_angle(BMesh *bm, BMLoop *l);
+float BM_loop_face_angle(BMLoop *l);
+void BM_loop_face_normal(BMLoop *l, float r_normal[3]);
+void BM_loop_face_tangent(BMLoop *l, float r_tangent[3]);
-float BM_edge_face_angle(BMesh *bm, BMEdge *e);
-float BM_vert_edge_angle(BMesh *bm, BMVert *v);
+float BM_edge_face_angle(BMEdge *e);
+float BM_vert_edge_angle(BMVert *v);
BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);
@@ -75,5 +80,7 @@ BMVert *BM_edge_share_vert(BMEdge *e1, BMEdge *e2);
BMLoop *BM_face_vert_share_loop(BMFace *f, BMVert *v);
void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2);
+void BM_edge_ordered_verts_ex(BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
+ BMLoop *edge_loop);
#endif /* __BMESH_QUERIES_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c
index eca90e8e7f2..27815551a87 100644
--- a/source/blender/bmesh/intern/bmesh_structure.c
+++ b/source/blender/bmesh/intern/bmesh_structure.c
@@ -31,11 +31,11 @@
* Low level routines for manipulating the BM structure.
*/
+#include "BLI_utildefines.h"
+
#include "bmesh.h"
#include "intern/bmesh_private.h"
-#include <stdlib.h>
-
/**
* MISC utility functions.
*/
diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c
index 029bc35f2e7..69ab7a91232 100644
--- a/source/blender/bmesh/intern/bmesh_walkers.c
+++ b/source/blender/bmesh/intern/bmesh_walkers.c
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <string.h> /* for memcpy */
+#include "BLI_utildefines.h"
#include "BLI_listbase.h"
#include "bmesh.h"
@@ -86,7 +87,8 @@ void BMW_init(BMWalker *walker, BMesh *bm, int type,
walker->mask_face = mask_face;
walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 1");
-
+ walker->secvisithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers sec 1");
+
if (UNLIKELY(type >= BMW_MAXWALKERS || type < 0)) {
fprintf(stderr,
"Invalid walker type in BMW_init; type: %d, "
@@ -125,6 +127,7 @@ void BMW_end(BMWalker *walker)
{
BLI_mempool_destroy(walker->worklist);
BLI_ghash_free(walker->visithash, NULL, NULL);
+ BLI_ghash_free(walker->secvisithash, NULL, NULL);
}
@@ -251,5 +254,7 @@ void BMW_reset(BMWalker *walker)
}
walker->depth = 0;
BLI_ghash_free(walker->visithash, NULL, NULL);
+ BLI_ghash_free(walker->secvisithash, NULL, NULL);
walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 1");
+ walker->secvisithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers sec 1");
}
diff --git a/source/blender/bmesh/intern/bmesh_walkers.h b/source/blender/bmesh/intern/bmesh_walkers.h
index 9ea9e332c5f..1d548a0d4c7 100644
--- a/source/blender/bmesh/intern/bmesh_walkers.h
+++ b/source/blender/bmesh/intern/bmesh_walkers.h
@@ -61,6 +61,7 @@ typedef struct BMWalker {
short mask_face;
GHash *visithash;
+ GHash *secvisithash;
int depth;
} BMWalker;
@@ -121,7 +122,7 @@ enum {
/* walk over an island of flagged faces. note, that this doesn't work on
* non-manifold geometry. it might be better to rewrite this to extract
* boundary info from the island walker, rather then directly walking
- * over the boundary. raises an error if it encouters nonmanifold
+ * over the boundary. raises an error if it encounters nonmanifold
* geometry. */
BMW_ISLANDBOUND,
/* walk over all faces in an island of tool flagged faces. */
diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
index 30bbc9e9b2a..493be46c976 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -26,11 +26,13 @@
* BMesh Walker Code.
*/
+#include "BLI_utildefines.h"
+
#include "BKE_customdata.h"
#include "bmesh.h"
#include "intern/bmesh_private.h"
-#include "bmesh_walkers_private.h"
+#include "intern/bmesh_walkers_private.h"
/**
* Shell Walker:
@@ -256,10 +258,9 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker)
owalk = *iwalk;
- if (iwalk->lastv == e->v1) v = e->v2;
- else v = e->v1;
+ v = BM_edge_other_vert(e, iwalk->lastv);
- if (!BM_vert_is_manifold(walker->bm, v)) {
+ if (!BM_vert_is_manifold(v)) {
BMW_reset(walker);
BMO_error_raise(walker->bm, NULL, BMERR_WALKER_FAILED,
"Non-manifold vert "
@@ -350,7 +351,7 @@ static void *bmw_IslandWalker_step(BMWalker *walker)
l = BM_iter_new(&liter, walker->bm, BM_LOOPS_OF_FACE, iwalk->cur);
for ( ; l; l = BM_iter_step(&liter)) {
- /* could skip loop here too, but dont add unless we need it */
+ /* could skip loop here too, but don't add unless we need it */
if (walker->mask_edge && !BMO_elem_flag_test(walker->bm, l->e, walker->mask_edge)) {
continue;
}
@@ -386,21 +387,48 @@ static void bmw_LoopWalker_begin(BMWalker *walker, void *data)
BMwLoopWalker *lwalk = NULL, owalk;
BMEdge *e = data;
BMVert *v;
- /* int found = 1, val; */ /* UNUSED */
+ int vert_edge_count[2] = {BM_vert_edge_count_nonwire(e->v1),
+ BM_vert_edge_count_nonwire(e->v2)};
v = e->v1;
- /* val = BM_vert_edge_count(v); */ /* UNUSED */
-
lwalk = BMW_state_add(walker);
BLI_ghash_insert(walker->visithash, e, NULL);
lwalk->cur = lwalk->start = e;
lwalk->lastv = lwalk->startv = v;
- lwalk->stage2 = 0;
- lwalk->startrad = BM_edge_face_count(e);
+ lwalk->is_boundary = BM_edge_is_boundary(e);
+ lwalk->is_single = (vert_edge_count[0] == 2 && vert_edge_count[1] == 2);
- /* rewin */
+ /* could also check that vertex*/
+ if ((lwalk->is_boundary == FALSE) &&
+ (vert_edge_count[0] == 3 || vert_edge_count[1] == 3))
+ {
+ BMIter iter;
+ BMFace *f_iter;
+ BMFace *f_best = NULL;
+
+ BM_ITER(f_iter, &iter, walker->bm, BM_FACES_OF_EDGE, e) {
+ if (f_best == NULL || f_best->len < f_iter->len) {
+ f_best = f_iter;
+ }
+ }
+
+ if (f_best) {
+ /* only use hub selection for 5+ sides else this could
+ * conflict with normal edge loop selection. */
+ lwalk->f_hub = f_best->len > 4 ? f_best : NULL;
+ }
+ else {
+ /* edge doesn't have any faces connected to it */
+ lwalk->f_hub = NULL;
+ }
+ }
+ else {
+ lwalk->f_hub = NULL;
+ }
+
+ /* rewind */
while (BMW_current_state(walker)) {
owalk = *((BMwLoopWalker *)BMW_current_state(walker));
BMW_walk(walker);
@@ -409,10 +437,7 @@ static void bmw_LoopWalker_begin(BMWalker *walker, void *data)
lwalk = BMW_state_add(walker);
*lwalk = owalk;
- if (lwalk->lastv == owalk.cur->v1) lwalk->lastv = owalk.cur->v2;
- else lwalk->lastv = owalk.cur->v1;
-
- lwalk->startv = lwalk->lastv;
+ lwalk->lastv = lwalk->startv = BM_edge_other_vert(owalk.cur, lwalk->lastv);
BLI_ghash_free(walker->visithash, NULL, NULL);
walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 2");
@@ -429,78 +454,124 @@ static void *bmw_LoopWalker_yield(BMWalker *walker)
static void *bmw_LoopWalker_step(BMWalker *walker)
{
BMwLoopWalker *lwalk = BMW_current_state(walker), owalk;
- BMIter eiter;
BMEdge *e = lwalk->cur, *nexte = NULL;
- BMLoop *l, *l2;
+ BMLoop *l;
BMVert *v;
- int val, rlen /* , found = 0 */, i = 0, stopi;
+ int i;
owalk = *lwalk;
BMW_state_remove(walker);
l = e->l;
- /* handle wire edge case */
- if (!l) {
+ if (owalk.f_hub) { /* NGON EDGE */
+ int vert_edge_tot;
- /* match trunk: mark all connected wire edges */
- for (i = 0; i < 2; i++) {
- v = i ? e->v2 : e->v1;
+ v = BM_edge_other_vert(e, lwalk->lastv);
- BM_ITER(nexte, &eiter, walker->bm, BM_EDGES_OF_VERT, v) {
- if ((nexte->l == NULL) && !BLI_ghash_haskey(walker->visithash, nexte)) {
- lwalk = BMW_state_add(walker);
- lwalk->cur = nexte;
- lwalk->lastv = v;
- lwalk->startrad = owalk.startrad;
+ vert_edge_tot = BM_vert_edge_count_nonwire(v);
- BLI_ghash_insert(walker->visithash, nexte, NULL);
- }
+ if (vert_edge_tot == 3) {
+ l = BM_face_other_vert_loop(owalk.f_hub, lwalk->lastv, v);
+ nexte = BM_edge_exists(v, l->v);
+
+ if (!BLI_ghash_haskey(walker->visithash, nexte)) {
+ lwalk = BMW_state_add(walker);
+ lwalk->cur = nexte;
+ lwalk->lastv = v;
+
+ lwalk->is_boundary = owalk.is_boundary;
+ lwalk->is_single = owalk.is_single;
+ lwalk->f_hub = owalk.f_hub;
+
+ BLI_ghash_insert(walker->visithash, nexte, NULL);
}
}
-
- return owalk.cur;
}
+ else if (l) { /* NORMAL EDGE WITH FACES */
+ int vert_edge_tot;
+ int stopi;
- v = (e->v1 == lwalk->lastv) ? e->v2 : e->v1;
+ v = BM_edge_other_vert(e, lwalk->lastv);
- val = BM_vert_edge_count(v);
+ vert_edge_tot = BM_vert_edge_count_nonwire(v);
- rlen = owalk.startrad;
+ if (/* check if we should step, this is fairly involved */
- if (val == 4 || val == 2 || rlen == 1) {
- i = 0;
- stopi = val / 2;
- while (1) {
- if (rlen != 1 && i == stopi) break;
+ /* typical loopiong over edges in the middle of a mesh */
+ /* however, why use 2 here at all? I guess for internal ngon loops it can be useful. Antony R. */
+ ((vert_edge_tot == 4 || vert_edge_tot == 2) && owalk.is_boundary == FALSE) ||
- l = BM_face_other_edge_loop(l->f, l->e, v);
+ /* walk over boundary of faces but stop at corners */
+ (owalk.is_boundary == TRUE && owalk.is_single == FALSE && vert_edge_tot > 2) ||
- if (!l)
- break;
+ /* initial edge was a boundary, so is this edge and vertex is only apart of this face
+ * this lets us walk over the the boundary of an ngon which is handy */
+ (owalk.is_boundary == TRUE && owalk.is_single == TRUE && vert_edge_tot == 2 && BM_edge_is_boundary(e)))
+ {
+ i = 0;
+ stopi = vert_edge_tot / 2;
+ while (1) {
+ if ((owalk.is_boundary == FALSE) && (i == stopi)) {
+ break;
+ }
- l2 = l->radial_next;
+ l = BM_face_other_edge_loop(l->f, l->e, v);
- if (l2 == l) {
- break;
+ if (l == NULL) {
+ break;
+ }
+ else {
+ BMLoop *l_next;
+
+ l_next = l->radial_next;
+
+ if ((l_next == l) || (l_next == NULL)) {
+ break;
+ }
+
+ l = l_next;
+ i++;
+ }
}
+ }
+
+ if (l != NULL) {
+ if (l != e->l && !BLI_ghash_haskey(walker->visithash, l->e)) {
+ if (!(owalk.is_boundary == FALSE && i != stopi)) {
+ lwalk = BMW_state_add(walker);
+ lwalk->cur = l->e;
+ lwalk->lastv = v;
- l = l2;
- i += 1;
+ lwalk->is_boundary = owalk.is_boundary;
+ lwalk->is_single = owalk.is_single;
+ lwalk->f_hub = owalk.f_hub;
+
+ BLI_ghash_insert(walker->visithash, l->e, NULL);
+ }
+ }
}
}
+ else { /* WIRE EDGE */
+ BMIter eiter;
- if (!l) {
- return owalk.cur;
- }
+ /* match trunk: mark all connected wire edges */
+ for (i = 0; i < 2; i++) {
+ v = i ? e->v2 : e->v1;
+
+ BM_ITER(nexte, &eiter, walker->bm, BM_EDGES_OF_VERT, v) {
+ if ((nexte->l == NULL) && !BLI_ghash_haskey(walker->visithash, nexte)) {
+ lwalk = BMW_state_add(walker);
+ lwalk->cur = nexte;
+ lwalk->lastv = v;
- if (l != e->l && !BLI_ghash_haskey(walker->visithash, l->e)) {
- if (!(rlen != 1 && i != stopi)) {
- lwalk = BMW_state_add(walker);
- lwalk->cur = l->e;
- lwalk->lastv = v;
- lwalk->startrad = owalk.startrad;
- BLI_ghash_insert(walker->visithash, l->e, NULL);
+ lwalk->is_boundary = owalk.is_boundary;
+ lwalk->is_single = owalk.is_single;
+ lwalk->f_hub = owalk.f_hub;
+
+ BLI_ghash_insert(walker->visithash, nexte, NULL);
+ }
+ }
}
}
@@ -525,7 +596,7 @@ static int bmw_FaceLoopWalker_include_face(BMWalker *walker, BMLoop *l)
}
/* the face must not have been already visite */
- if (BLI_ghash_haskey(walker->visithash, l->f)) {
+ if (BLI_ghash_haskey(walker->visithash, l->f) && BLI_ghash_haskey(walker->secvisithash, l->e)) {
return FALSE;
}
@@ -535,10 +606,8 @@ static int bmw_FaceLoopWalker_include_face(BMWalker *walker, BMLoop *l)
/* Check whether the face loop can start from the given edge */
static int bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e)
{
- BMesh *bm = walker->bm;
-
/* There is no face loop starting from a wire edge */
- if (BM_edge_is_wire(bm, e)) {
+ if (BM_edge_is_wire(e)) {
return FALSE;
}
@@ -551,7 +620,7 @@ static int bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e)
}
/* Don't start a face loop from non-manifold edges */
- if (!BM_edge_is_manifold(bm, e)) {
+ if (!BM_edge_is_manifold(e)) {
return FALSE;
}
@@ -583,6 +652,10 @@ static void bmw_FaceLoopWalker_begin(BMWalker *walker, void *data)
*lwalk = owalk;
lwalk->nocalc = 0;
+ BLI_ghash_free(walker->secvisithash, NULL, NULL);
+ walker->secvisithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 3");
+ BLI_ghash_insert(walker->visithash, lwalk->l->e, NULL);
+
BLI_ghash_free(walker->visithash, NULL, NULL);
walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 3");
BLI_ghash_insert(walker->visithash, lwalk->l->f, NULL);
@@ -609,8 +682,9 @@ static void *bmw_FaceLoopWalker_step(BMWalker *walker)
l = l->radial_next;
- if (lwalk->nocalc)
+ if (lwalk->nocalc) {
return f;
+ }
if (!bmw_FaceLoopWalker_include_face(walker, l)) {
l = lwalk->l;
@@ -633,6 +707,7 @@ static void *bmw_FaceLoopWalker_step(BMWalker *walker)
lwalk->nocalc = 0;
}
+ BLI_ghash_insert(walker->secvisithash, l->e, NULL);
BLI_ghash_insert(walker->visithash, l->f, NULL);
}
@@ -710,7 +785,6 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker)
BMwEdgeringWalker *lwalk = BMW_current_state(walker);
BMEdge *e;
BMLoop *l = lwalk->l /* , *origl = lwalk->l */;
- BMesh *bm = walker->bm;
#ifdef BMW_EDGERING_NGON
int i, len;
#endif
@@ -721,7 +795,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker)
return lwalk->wireedge;
e = l->e;
- if (!BM_edge_is_manifold(bm, e)) {
+ if (!BM_edge_is_manifold(e)) {
/* walker won't traverse to a non-manifold edge, but may
* be started on one, and should not traverse *away* from
* a non-manfold edge (non-manifold edges are never in an
@@ -738,7 +812,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker)
i -= 2;
}
- if ((len <= 0) || (len % 2 != 0) || !BM_edge_is_manifold(bm, l->e)) {
+ if ((len <= 0) || (len % 2 != 0) || !BM_edge_is_manifold(l->e)) {
l = lwalk->l;
i = len;
while (i > 0) {
@@ -747,7 +821,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker)
}
}
/* only walk to manifold edge */
- if ((l->f->len % 2 == 0) && BM_edge_is_manifold(bm, l->e) &&
+ if ((l->f->len % 2 == 0) && BM_edge_is_manifold(l->e) &&
!BLI_ghash_haskey(walker->visithash, l->e))
#else
@@ -755,11 +829,11 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker)
l = l->radial_next;
l = l->next->next;
- if ((l->f->len != 4) || !BM_edge_is_manifold(bm, l->e)) {
+ if ((l->f->len != 4) || !BM_edge_is_manifold(l->e)) {
l = lwalk->l->next->next;
}
/* only walk to manifold edge */
- if ((l->f->len == 4) && BM_edge_is_manifold(bm, l->e) &&
+ if ((l->f->len == 4) && BM_edge_is_manifold(l->e) &&
!BLI_ghash_haskey(walker->visithash, l->e))
#endif
{
diff --git a/source/blender/bmesh/intern/bmesh_walkers_private.h b/source/blender/bmesh/intern/bmesh_walkers_private.h
index b1447b52d1a..fc563932c3c 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_private.h
+++ b/source/blender/bmesh/intern/bmesh_walkers_private.h
@@ -61,7 +61,9 @@ typedef struct BMwLoopWalker {
BMwGenericWalker header;
BMEdge *cur, *start;
BMVert *lastv, *startv;
- int startrad, stage2;
+ BMFace *f_hub;
+ short is_boundary; /* boundary looping changes behavior */
+ short is_single; /* single means the edge verts are only connected to 1 face */
} BMwLoopWalker;
typedef struct BMwFaceLoopWalker {
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index e881e1e277a..3be3000e4ae 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -59,7 +59,7 @@ static void calc_corner_co(BMesh *bm, BMLoop *l, const float fac, float r_co[3],
copy_v3_v3(l_co, l->v->co);
copy_v3_v3(l_co_next, l->next->v->co);
- /* calculate norma */
+ /* calculate normal */
sub_v3_v3v3(l_vec_prev, l_co_prev, l_co);
sub_v3_v3v3(l_vec_next, l_co_next, l_co);
@@ -551,7 +551,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
/* set edge lengths of cross edges as the average of the cross edges they're based o */
if (has_elens) {
- /* angle happens not to be used. why? - not sure it just isnt - campbell.
+ /* angle happens not to be used. why? - not sure it just isn't - campbell.
* leave this in in case we need to use it later */
#if 0
float ang;
@@ -877,6 +877,6 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
BLI_array_free(edges);
BLI_array_free(faces);
- BMO_slot_buffer_from_flag(bm, op, "face_spans", FACE_SPAN, BM_FACE);
- BMO_slot_buffer_from_flag(bm, op, "face_holes", FACE_HOLE, BM_FACE);
+ BMO_slot_buffer_from_flag(bm, op, "face_spans", BM_FACE, FACE_SPAN);
+ BMO_slot_buffer_from_flag(bm, op, "face_holes", BM_FACE, FACE_HOLE);
}
diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index af930d6647a..e135473fc7e 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -22,11 +22,11 @@
#include "MEM_guardedalloc.h"
-
-#include "bmesh.h"
-
#include "BLI_math.h"
#include "BLI_array.h"
+#include "BLI_utildefines.h"
+
+#include "bmesh.h"
#define VERT_INPUT 1
#define EDGE_OUT 1
@@ -45,7 +45,7 @@ void bmo_connectverts_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(verts);
int i;
- BMO_slot_buffer_flag_enable(bm, op, "verts", VERT_INPUT, BM_VERT);
+ BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_INPUT);
for (f = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); f; f = BM_iter_step(&iter)) {
BLI_array_empty(loops);
@@ -116,7 +116,7 @@ void bmo_connectverts_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_flag(bm, op, "edgeout", EDGE_OUT, BM_EDGE);
+ BMO_slot_buffer_from_flag(bm, op, "edgeout", BM_EDGE, EDGE_OUT);
BLI_array_free(loops);
BLI_array_free(verts);
@@ -208,7 +208,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
BMEdge *e, *nexte;
int c = 0, cl1 = 0, cl2 = 0;
- BMO_slot_buffer_flag_enable(bm, op, "edges", EDGE_MARK, BM_EDGE);
+ BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
BMO_ITER(e, &siter, bm, op, "edges", BM_EDGE) {
if (!BMO_elem_flag_test(bm, e, EDGE_DONE)) {
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index 2dfd1867379..a761520dabb 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -68,7 +68,7 @@ typedef struct EdgeData {
typedef struct VertData {
BMEdge *e;
- float no[3], offco[3], sco[3]; /* offco is vertex coordinate slightly offset randoml */
+ float no[3], offco[3], sco[3]; /* offco is vertex coordinate slightly offset randomly */
int tag;
} VertData;
@@ -76,7 +76,7 @@ static int count_edge_faces(BMesh *bm, BMEdge *e);
/**** rotation system code * */
-BM_INLINE BMDiskLink *rs_edge_link_get(BMEdge *e, BMVert *v, EdgeData *e_data)
+BLI_INLINE BMDiskLink *rs_edge_link_get(BMEdge *e, BMVert *v, EdgeData *e_data)
{
return v == ((BMEdge *)e)->v1 ? &(((EdgeData *)e_data)->v1_disk_link) :
&(((EdgeData *)e_data)->v2_disk_link) ;
@@ -234,7 +234,7 @@ static int UNUSED_FUNCTION(rotsys_fill_faces)(BMesh *bm, EdgeData *edata, VertDa
continue;
}
- /* do two passes, going forward then backwar */
+ /* do two passes, going forward then backward */
for (i = 0; i < 2; i++) {
BLI_smallhash_init(hash);
@@ -401,7 +401,7 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
normalize_v3(no);
}
- /* generate plane-flattened coordinate */
+ /* generate plane-flattened coordinates */
for (i = 0; i < totedge; i++) {
BMEdge *e1;
BMVert *v2;
@@ -466,7 +466,7 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
copy_v3_v3(cent, v->co);
for (j = 0; j < 3; j++) {
- float fac = (BLI_frand() - 0.5f)*size;
+ float fac = (BLI_frand() - 0.5f) * size;
cent[j] += fac;
}
@@ -495,7 +495,6 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
BMVert *v1, *v2, *v3;
VertData *vd1, *vd2, *vd3;
float vec1[3], vec2[3], vec3[3], n1[3], n2[3], n3[3];
- int s1, s2, s3;
e1 = edges[(i + totedge - 1) % totedge];
e2 = edges[i];
@@ -517,17 +516,26 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
cross_v3_v3v3(n2, vec2, vec3);
cross_v3_v3v3(n3, vec1, vec3);
+ /* this case happens often enough and probably not worth bothering users with,
+ * maybe enable for debugging code but not for everyday use - campbell */
+#if 0
/* Other way to determine if two vectors approach are (nearly) parallel: the
* cross product of the two vectors will approach zero */
- s1 = (dot_v3v3(n1, n1) < (0.0f + FLT_EPSILON * 10));
- s2 = (dot_v3v3(n2, n2) < (0.0f + FLT_EPSILON * 10));
- s3 = (totedge < 3) ? 0 : (dot_v3v3(n3, n3) < (0.0f + FLT_EPSILON * 10));
+ {
+ int s1, s2, s3;
+ s1 = (dot_v3v3(n1, n1) < (0.0f + FLT_EPSILON * 10));
+ s2 = (dot_v3v3(n2, n2) < (0.0f + FLT_EPSILON * 10));
+ s3 = (totedge < 3) ? 0 : (dot_v3v3(n3, n3) < (0.0f + FLT_EPSILON * 10));
- normalize_v3(n1); normalize_v3(n2); normalize_v3(n3);
-
- if (s1 || s2 || s3) {
- fprintf(stderr, "%s: s1: %d, s2: %d, s3: %dx (bmesh internal error)\n", __func__, s1, s2, s3);
+ if (s1 || s2 || s3) {
+ fprintf(stderr, "%s: s1: %d, s2: %d, s3: %dx (bmesh internal error)\n", __func__, s1, s2, s3);
+ }
}
+#endif
+
+ normalize_v3(n1); normalize_v3(n2); normalize_v3(n3);
+
+
if (dot_v3v3(n1, n2) < 0.0f) {
if (dot_v3v3(n1, n3) >= 0.0f + FLT_EPSILON * 10) {
SWAP(BMEdge *, edges[i], edges[(i + 1) % totedge]);
@@ -749,7 +757,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
v1 = last->v;
if (v1 == endv) {
- /* make sure this path loop doesn't already exist */
+ /* make sure this path loop doesn't already exists */
i = 0;
BLI_array_empty(verts);
for (i = 0, node = path->nodes.first; node; node = node->next, i++) {
@@ -814,7 +822,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
continue;
}
- /* add path back into hea */
+ /* add path back into heap */
BLI_heap_insert(heap, path->weight, path);
/* put v2 in gh ma */
@@ -858,7 +866,7 @@ static int count_edge_faces(BMesh *bm, BMEdge *e)
return i;
}
-BM_INLINE void vote_on_winding(BMEdge *edge, EPathNode *node, unsigned int winding[2])
+BLI_INLINE void vote_on_winding(BMEdge *edge, EPathNode *node, unsigned int winding[2])
{
BMVert *test_v1, *test_v2;
/* we want to use the reverse winding to the existing order */
@@ -896,8 +904,8 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
edata = MEM_callocN(sizeof(EdgeData) * bm->totedge, "EdgeData");
vdata = MEM_callocN(sizeof(VertData) * bm->totvert, "VertData");
- BMO_slot_buffer_flag_enable(bm, op, "edges", EDGE_MARK, BM_EDGE);
- BMO_slot_buffer_flag_enable(bm, op, "excludefaces", FACE_IGNORE, BM_FACE);
+ BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
+ BMO_slot_buffer_flag_enable(bm, op, "excludefaces", BM_FACE, FACE_IGNORE);
BM_mesh_elem_index_ensure(bm, BM_VERT);
@@ -1045,7 +1053,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
edge_free_path(pathbase, path);
}
- BMO_slot_buffer_from_flag(bm, op, "faceout", FACE_NEW, BM_FACE);
+ BMO_slot_buffer_from_flag(bm, op, "faceout", BM_FACE, FACE_NEW);
BLI_array_free(edges);
BLI_array_free(verts);
@@ -1085,7 +1093,7 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
int ok = 1;
int i, count;
- BMO_slot_buffer_flag_enable(bm, op, "edges", EDGE_MARK, BM_EDGE);
+ BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
/* validate that each edge has at most one other tagged edge in the
* disk cycle around each of it's vertices */
@@ -1242,14 +1250,14 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_flag(bm, op, "edgeout", ELE_NEW, BM_EDGE);
+ BMO_slot_buffer_from_flag(bm, op, "edgeout", BM_EDGE, ELE_NEW);
BLI_array_free(edges1);
BLI_array_free(edges2);
}
/* This is what runs when pressing the F key
- * doing the best thing here isnt always easy create vs dissolve, its nice to support
+ * doing the best thing here isn't always easy create vs dissolve, its nice to support
* but it it _really_ gives issues we might have to not call dissolve. - campbell
*/
void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
@@ -1343,16 +1351,16 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
/* --- end special case support, continue as normal --- */
/* call edgenet create */
- /* call edgenet prepare op so additional face creation cases wor */
+ /* call edgenet prepare op so additional face creation cases wore */
BMO_op_initf(bm, &op2, "edgenet_prepare edges=%fe", ELE_NEW);
BMO_op_exec(bm, &op2);
- BMO_slot_buffer_flag_enable(bm, &op2, "edgeout", ELE_NEW, BM_EDGE);
+ BMO_slot_buffer_flag_enable(bm, &op2, "edgeout", BM_EDGE, ELE_NEW);
BMO_op_finish(bm, &op2);
BMO_op_initf(bm, &op2, "edgenet_fill edges=%fe use_fill_check=%b", ELE_NEW, TRUE);
BMO_op_exec(bm, &op2);
- /* return if edge net create did somethin */
+ /* return if edge net create did something */
if (BMO_slot_buffer_count(bm, &op2, "faceout")) {
BMO_slot_copy(&op2, op, "faceout", "faceout");
BMO_op_finish(bm, &op2);
@@ -1374,7 +1382,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMO_op_finish(bm, &op2);
- /* now, count how many verts we hav */
+ /* now, count how many verts we have */
amount = 0;
BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
if (BMO_elem_flag_test(bm, v, ELE_NEW)) {
@@ -1386,46 +1394,74 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
}
if (amount == 2) {
- /* create edg */
+ /* create edge */
e = BM_edge_create(bm, verts[0], verts[1], NULL, TRUE);
BMO_elem_flag_enable(bm, e, ELE_OUT);
}
- else if (amount == 3) {
- /* create triangl */
- f = BM_face_create_quad_tri(bm, verts[0], verts[1], verts[2], NULL, NULL, TRUE);
+ else if (0) { /* nice feature but perhaps it should be a different tool? */
+
+ /* tricky feature for making a line/edge from selection history...
+ *
+ * Rather then do nothing, when 5+ verts are selected, check if they are in our history,
+ * when this is so, we can make edges from them, but _not_ a face,
+ * if it is the intention to make a face the user can just hit F again since there will be edges next
+ * time around.
+ *
+ * if all history verts have ELE_NEW flagged and the total number of history verts == totv,
+ * then we know the history contains all verts here and we can continue...
+ */
+
+ BMEditSelection *ese;
+ int tot_ese_v = 0;
+
+ for (ese = bm->selected.first; ese; ese = ese->next) {
+ if (ese->htype == BM_VERT) {
+ if (BMO_elem_flag_test(bm, (BMElemF *)ese->ele, ELE_NEW)) {
+ tot_ese_v++;
+ }
+ else {
+ /* unflagged vert means we are not in sync */
+ tot_ese_v = -1;
+ break;
+ }
+ }
+ }
- if (f) {
- BMO_elem_flag_enable(bm, f, ELE_OUT);
+ if (tot_ese_v == totv) {
+ BMVert *v_prev = NULL;
+ /* yes, all select-history verts are accounted for, now make edges */
+
+ for (ese = bm->selected.first; ese; ese = ese->next) {
+ if (ese->htype == BM_VERT) {
+ v = (BMVert *)ese->ele;
+ if (v_prev) {
+ e = BM_edge_create(bm, v, v_prev, NULL, TRUE);
+ BMO_elem_flag_enable(bm, e, ELE_OUT);
+ }
+ v_prev = v;
+ }
+ }
}
+ /* done creating edges */
}
- else if (amount == 4) {
- f = NULL;
+ else if (amount > 2) {
+ /* TODO, all these verts may be connected by edges.
+ * we should check on this before assuming they are a random set of verts */
- /* the order of vertices can be anything, 6 cases to check */
- if (is_quad_convex_v3(verts[0]->co, verts[1]->co, verts[2]->co, verts[3]->co)) {
- f = BM_face_create_quad_tri(bm, verts[0], verts[1], verts[2], verts[3], NULL, TRUE);
- }
- else if (is_quad_convex_v3(verts[0]->co, verts[2]->co, verts[3]->co, verts[1]->co)) {
- f = BM_face_create_quad_tri(bm, verts[0], verts[2], verts[3], verts[1], NULL, TRUE);
- }
- else if (is_quad_convex_v3(verts[0]->co, verts[2]->co, verts[1]->co, verts[3]->co)) {
- f = BM_face_create_quad_tri(bm, verts[0], verts[2], verts[1], verts[3], NULL, TRUE);
- }
- else if (is_quad_convex_v3(verts[0]->co, verts[1]->co, verts[3]->co, verts[2]->co)) {
- f = BM_face_create_quad_tri(bm, verts[0], verts[1], verts[3], verts[2], NULL, TRUE);
- }
- else if (is_quad_convex_v3(verts[0]->co, verts[3]->co, verts[2]->co, verts[1]->co)) {
- f = BM_face_create_quad_tri(bm, verts[0], verts[3], verts[2], verts[1], NULL, TRUE);
- }
- else if (is_quad_convex_v3(verts[0]->co, verts[3]->co, verts[1]->co, verts[2]->co)) {
- f = BM_face_create_quad_tri(bm, verts[0], verts[3], verts[1], verts[2], NULL, TRUE);
- }
- else {
- printf("cannot find nice quad from concave set of vertices\n");
+ BMVert **vert_arr = MEM_mallocN(sizeof(BMVert **) * totv, __func__);
+ int i = 0;
+
+ BMO_ITER(v, &oiter, bm, op, "geom", BM_VERT) {
+ vert_arr[i] = v;
+ i++;
}
+ f = BM_face_create_ngon_vcloud(bm, vert_arr, totv, TRUE);
+
if (f) {
BMO_elem_flag_enable(bm, f, ELE_OUT);
}
+
+ MEM_freeN(vert_arr);
}
}
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 3f17c7040b3..76180355304 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -92,7 +92,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_flag_enable(bm, op, "faces", FACE_MARK, BM_FACE);
+ BMO_slot_buffer_flag_enable(bm, op, "faces", BM_FACE, FACE_MARK);
/* collect region */
BMO_ITER(f, &oiter, bm, op, "faces", BM_FACE) {
@@ -178,7 +178,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
goto cleanup;
}
- BMO_slot_buffer_from_flag(bm, op, "regionout", FACE_NEW, BM_FACE);
+ BMO_slot_buffer_from_flag(bm, op, "regionout", BM_FACE, FACE_NEW);
cleanup:
/* free/cleanup */
@@ -327,7 +327,7 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
BMFace *f;
/* int i; */
- BMO_slot_buffer_flag_enable(bm, op, "verts", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_MARK);
for (v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); v; v = BM_iter_step(&iter)) {
if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
@@ -437,7 +437,8 @@ void dummy_exec(BMesh *bm, BMOperator *op)
BM_face_kill(bm, f);
BM_edge_kill(bm, fe);
}
- } /* else if (f->len == 3) {
+ }
+ /* else if (f->len == 3) {
BMEdge *ed[3];
BMVert *vt[3];
BMLoop *lp[3];
@@ -493,7 +494,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
/* go through and split edge */
for (i = 0, tot_found = 0; i < einput->len; i++) {
BMEdge *e = ((BMEdge **)einput->data.p)[i];
- const float angle = BM_edge_face_angle(bm, e);
+ const float angle = BM_edge_face_angle(e);
if (angle < angle_limit) {
weight_elems[i].ele = (BMHeader *)e;
@@ -512,12 +513,12 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
for (i = 0; i < tot_found; i++) {
BMEdge *e = (BMEdge *)weight_elems[i].ele;
/* check twice because cumulative effect could disolve over angle limit */
- if (BM_edge_face_angle(bm, e) < angle_limit) {
+ if (BM_edge_face_angle(e) < angle_limit) {
BMFace *nf = BM_faces_join_pair(bm, e->l->f,
e->l->radial_next->f,
e); /* join faces */
- /* there may be some errors, we dont mind, just move on */
+ /* there may be some errors, we don't mind, just move on */
if (nf == NULL) {
BMO_error_clear(bm);
}
@@ -528,7 +529,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
/* --- 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_angle(bm, v);
+ const float angle = BM_vert_edge_angle(v);
if (angle < angle_limit) {
weight_elems[i].ele = (BMHeader *)v;
@@ -547,7 +548,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
for (i = 0; i < tot_found; i++) {
BMVert *v = (BMVert *)weight_elems[i].ele;
/* check twice because cumulative effect could disolve over angle limit */
- if (BM_vert_edge_angle(bm, v) < angle_limit) {
+ if (BM_vert_edge_angle(v) < angle_limit) {
BM_vert_collapse_edge(bm, v->e, v, TRUE); /* join edges */
}
}
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c
index 5c800ba083a..9a87acbb84f 100644
--- a/source/blender/bmesh/operators/bmo_dupe.c
+++ b/source/blender/bmesh/operators/bmo_dupe.c
@@ -198,7 +198,7 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
GHash *vhash;
GHash *ehash;
- /* initialize pointer hashe */
+ /* initialize pointer hashes */
vhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops v");
ehash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops e");
@@ -235,12 +235,12 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
}
}
- /* now we dupe all the edge */
+ /* now we dupe all the edges */
for (e = BM_iter_new(&edges, source, BM_EDGES_OF_MESH, source); e; e = BM_iter_step(&edges)) {
if ( BMO_elem_flag_test(source, e, DUPE_INPUT) &&
!BMO_elem_flag_test(source, e, DUPE_DONE))
{
- /* make sure that verts are copie */
+ /* make sure that verts are copied */
if (!BMO_elem_flag_test(source, e->v1, DUPE_DONE)) {
copy_vertex(source, e->v1, target, vhash);
BMO_elem_flag_enable(source, e->v1, DUPE_DONE);
@@ -249,13 +249,13 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
copy_vertex(source, e->v2, target, vhash);
BMO_elem_flag_enable(source, e->v2, DUPE_DONE);
}
- /* now copy the actual edg */
+ /* now copy the actual edge*/
copy_edge(op, source, e, target, vhash, ehash);
BMO_elem_flag_enable(source, e, DUPE_DONE);
}
}
- /* first we dupe all flagged faces and their elements from sourc */
+ /* first we dupe all flagged faces and their elements from source */
for (f = BM_iter_new(&faces, source, BM_FACES_OF_MESH, source); f; f = BM_iter_step(&faces)) {
if (BMO_elem_flag_test(source, f, DUPE_INPUT)) {
/* vertex pas */
@@ -266,7 +266,7 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
}
}
- /* edge pas */
+ /* edge pass */
for (e = BM_iter_new(&edges, source, BM_EDGES_OF_FACE, f); e; e = BM_iter_step(&edges)) {
if (!BMO_elem_flag_test(source, e, DUPE_DONE)) {
copy_edge(op, source, e, target, vhash, ehash);
@@ -286,7 +286,7 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
}
}
- /* free pointer hashe */
+ /* free pointer hashes */
BLI_ghash_free(vhash, NULL, NULL);
BLI_ghash_free(ehash, NULL, NULL);
@@ -325,17 +325,17 @@ void bmo_dupe_exec(BMesh *bm, BMOperator *op)
bm2 = bm;
/* flag inpu */
- BMO_slot_buffer_flag_enable(bm, dupeop, "geom", DUPE_INPUT, BM_ALL);
+ BMO_slot_buffer_flag_enable(bm, dupeop, "geom", BM_ALL, DUPE_INPUT);
- /* use the internal copy functio */
+ /* use the internal copy function */
copy_mesh(dupeop, bm, bm2);
/* Outpu */
- /* First copy the input buffers to output buffers - original dat */
+ /* First copy the input buffers to output buffers - original data */
BMO_slot_copy(dupeop, dupeop, "geom", "origout");
- /* Now alloc the new output buffer */
- BMO_slot_buffer_from_flag(bm, dupeop, "newout", DUPE_NEW, BM_ALL);
+ /* Now alloc the new output buffers */
+ BMO_slot_buffer_from_flag(bm, dupeop, "newout", BM_ALL, DUPE_NEW);
}
#if 0 /* UNUSED */
@@ -343,12 +343,12 @@ void bmo_dupe_exec(BMesh *bm, BMOperator *op)
* type flag etypeflag and header flag flag to it. note,
* to get more useful information (such as the mapping from
* original to new elements) you should run the dupe op manually */
-void BMO_dupe_from_flag(BMesh *bm, int etypeflag, const char hflag)
+void BMO_dupe_from_flag(BMesh *bm, int htype, const char hflag)
{
BMOperator dupeop;
BMO_op_init(bm, &dupeop, "dupe");
- BMO_slot_buffer_from_hflag(bm, &dupeop, "geom", hflag, etypeflag);
+ BMO_slot_buffer_from_hflag(bm, &dupeop, "geom", htype, hflag);
BMO_op_exec(bm, &dupeop);
BMO_op_finish(bm, &dupeop);
@@ -388,7 +388,7 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
BMO_slot_copy(splitop, &dupeop, "geom", "geom");
BMO_op_exec(bm, &dupeop);
- BMO_slot_buffer_flag_enable(bm, splitop, "geom", SPLIT_INPUT, BM_ALL);
+ BMO_slot_buffer_flag_enable(bm, splitop, "geom", BM_ALL, SPLIT_INPUT);
if (use_only_faces) {
BMVert *v;
@@ -427,9 +427,9 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
}
}
- /* connect outputs of dupe to delete, exluding keep geometr */
+ /* connect outputs of dupe to delete, exluding keep geometry */
BMO_slot_int_set(&delop, "context", DEL_FACES);
- BMO_slot_buffer_from_flag(bm, &delop, "geom", SPLIT_INPUT, BM_ALL);
+ BMO_slot_buffer_from_flag(bm, &delop, "geom", BM_ALL, SPLIT_INPUT);
BMO_op_exec(bm, &delop);
@@ -453,7 +453,7 @@ void bmo_del_exec(BMesh *bm, BMOperator *op)
BMOperator *delop = op;
/* Mark Buffer */
- BMO_slot_buffer_flag_enable(bm, delop, "geom", DEL_INPUT, BM_ALL);
+ BMO_slot_buffer_flag_enable(bm, delop, "geom", BM_ALL, DEL_INPUT);
BMO_remove_tagged_context(bm, DEL_INPUT, BMO_slot_int_get(op, "context"));
@@ -486,11 +486,12 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op)
phi = BMO_slot_float_get(op, "ang") * (float)M_PI / (360.0f * steps);
do_dupli = BMO_slot_bool_get(op, "do_dupli");
+ /* BMESH_TODO - can replace this with BLI_math? */
si = (float)sin(phi);
q[0] = (float)cos(phi);
- q[1] = axis[0]*si;
- q[2] = axis[1]*si;
- q[3] = axis[2]*si;
+ q[1] = axis[0] * si;
+ q[2] = axis[1] * si;
+ q[3] = axis[2] * si;
quat_to_mat3(rmat, q);
BMO_slot_copy(op, op, "geom", "lastout");
diff --git a/source/blender/bmesh/operators/bmo_edgesplit.c b/source/blender/bmesh/operators/bmo_edgesplit.c
index 44d0ad4ff94..0da44dcf9d4 100644
--- a/source/blender/bmesh/operators/bmo_edgesplit.c
+++ b/source/blender/bmesh/operators/bmo_edgesplit.c
@@ -22,6 +22,8 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
#include "bmesh.h"
#include "intern/bmesh_operators_private.h" /* own include */
@@ -34,7 +36,7 @@ enum {
* Remove the EDGE_SEAM flag for edges we cant split
*
* un-tag edges not connected to other tagged edges,
- * unless they are on a boundry
+ * unless they are on a boundary
*/
static void bm_edgesplit_validate_seams(BMesh *bm, BMOperator *op)
{
@@ -49,7 +51,7 @@ static void bm_edgesplit_validate_seams(BMesh *bm, BMOperator *op)
vtouch = MEM_callocN(sizeof(char) * bm->totvert, __func__);
- /* tag all boundry verts so as not to untag an edge which is inbetween only 2 faces [] */
+ /* tag all boundary verts so as not to untag an edge which is inbetween only 2 faces [] */
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
/* unrelated to flag assignment in this function - since this is the
@@ -60,7 +62,7 @@ static void bm_edgesplit_validate_seams(BMesh *bm, BMOperator *op)
vt = &vtouch[BM_elem_index_get(e->v1)]; if (*vt < 2) (*vt)++;
vt = &vtouch[BM_elem_index_get(e->v2)]; if (*vt < 2) (*vt)++;
- /* while the boundry verts need to be tagged,
+ /* while the boundary verts need to be tagged,
* the edge its self can't be split */
BMO_elem_flag_disable(bm, e, EDGE_SEAM);
}
@@ -69,7 +71,7 @@ static void bm_edgesplit_validate_seams(BMesh *bm, BMOperator *op)
/* single marked edges unconnected to any other marked edges
* are illegal, go through and unmark them */
BMO_ITER(e, &siter, bm, op, "edges", BM_EDGE) {
- /* lame, but we dont want the count to exceed 255,
+ /* lame, but we don't want the count to exceed 255,
* so just count to 2, its all we need */
unsigned char *vt;
vt = &vtouch[BM_elem_index_get(e->v1)]; if (*vt < 2) (*vt)++;
@@ -91,7 +93,7 @@ void bmo_edgesplit_exec(BMesh *bm, BMOperator *op)
BMOIter siter;
BMEdge *e;
- BMO_slot_buffer_flag_enable(bm, op, "edges", EDGE_SEAM, BM_EDGE);
+ BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_SEAM);
bm_edgesplit_validate_seams(bm, op);
@@ -119,5 +121,5 @@ void bmo_edgesplit_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_hflag(bm, op, "edgeout", BM_ELEM_INTERNAL_TAG, BM_EDGE);
+ BMO_slot_buffer_from_hflag(bm, op, "edgeout", BM_EDGE, BM_ELEM_INTERNAL_TAG);
}
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index 595502586b9..3048be925d9 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -110,7 +110,55 @@ void bmo_extrude_face_indiv_exec(BMesh *bm, BMOperator *op)
BLI_array_free(edges);
BMO_op_callf(bm, "del geom=%ff context=%i", EXT_DEL, DEL_ONLYFACES);
- BMO_slot_buffer_from_flag(bm, op, "faceout", EXT_KEEP, BM_FACE);
+ BMO_slot_buffer_from_flag(bm, op, "faceout", BM_FACE, EXT_KEEP);
+}
+
+static void bm_extrude_copy_face_loop_attributes(BMesh *bm, BMFace *f, BMEdge *e, BMEdge *newedge)
+{
+ BMIter iter;
+ BMLoop *l, *l2;
+
+ /* copy attribute */
+ l = BM_iter_new(&iter, bm, BM_LOOPS_OF_FACE, f);
+ for ( ; l; l = BM_iter_step(&iter)) {
+
+ if (l->e != e && l->e != newedge) {
+ continue;
+ }
+
+ l2 = l->radial_next;
+
+ if (l2 == l) {
+ l2 = newedge->l;
+
+ if (l2 != l) {
+ BM_elem_attrs_copy(bm, bm, l2->f, l->f);
+
+ BM_elem_attrs_copy(bm, bm, l2, l);
+ l2 = l2->next;
+ l = l->next;
+ BM_elem_attrs_copy(bm, bm, l2, l);
+ }
+ }
+ else {
+ BM_elem_attrs_copy(bm, bm, l2->f, l->f);
+
+ /* copy dat */
+ if (l2->v == l->v) {
+ BM_elem_attrs_copy(bm, bm, l2, l);
+ l2 = l2->next;
+ l = l->next;
+ BM_elem_attrs_copy(bm, bm, l2, l);
+ }
+ else {
+ l2 = l2->next;
+ BM_elem_attrs_copy(bm, bm, l2, l);
+ l2 = l2->prev;
+ l = l->next;
+ BM_elem_attrs_copy(bm, bm, l2, l);
+ }
+ }
+ }
}
void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
@@ -147,8 +195,9 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
v3 = e->v2;
v4 = e->v1;
}
- /* not sure what to do about example face, pass NULL for now */
+ /* not sure what to do about example face, pass NULL for now */
f = BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, FALSE);
+ bm_extrude_copy_face_loop_attributes(bm, f, e, e2);
if (BMO_elem_flag_test(bm, e, EXT_INPUT))
e = e2;
@@ -162,7 +211,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
BMO_op_finish(bm, &dupeop);
- BMO_slot_buffer_from_flag(bm, op, "geomout", EXT_KEEP, BM_ALL);
+ BMO_slot_buffer_from_flag(bm, op, "geomout", BM_ALL, EXT_KEEP);
}
void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
@@ -181,8 +230,8 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, dupev, EXT_KEEP);
}
- BMO_slot_buffer_from_flag(bm, op, "vertout", EXT_KEEP, BM_VERT);
- BMO_slot_buffer_from_flag(bm, op, "edgeout", EXT_KEEP, BM_EDGE);
+ BMO_slot_buffer_from_flag(bm, op, "vertout", BM_VERT, EXT_KEEP);
+ BMO_slot_buffer_from_flag(bm, op, "edgeout", BM_EDGE, EXT_KEEP);
}
void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
@@ -191,7 +240,6 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
BMOIter siter;
BMIter iter, fiter, viter;
BMEdge *e, *newedge;
- BMLoop *l, *l2;
BMVert *verts[4], *v, *v2;
BMFace *f;
int found, fwd, delorig = FALSE;
@@ -199,9 +247,9 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
/* initialize our sub-operators */
BMO_op_init(bm, &dupeop, "dupe");
- BMO_slot_buffer_flag_enable(bm, op, "edgefacein", EXT_INPUT, BM_EDGE|BM_FACE);
+ BMO_slot_buffer_flag_enable(bm, op, "edgefacein", BM_EDGE|BM_FACE, EXT_INPUT);
- /* if one flagged face is bordered by an unflagged face, then we delete
+ /* if one flagged face is bordered by an un-flagged face, then we delete
* original geometry unless caller explicitly asked to keep it. */
if (!BMO_slot_bool_get(op, "alwayskeeporig")) {
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
@@ -226,13 +274,13 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
}
if ((edge_face_tot > 1) && (found == FALSE)) {
- /* edge has a face user, that face isnt extrude input */
+ /* edge has a face user, that face isn't extrude input */
BMO_elem_flag_enable(bm, e, EXT_DEL);
}
}
}
- /* calculate verts to delet */
+ /* calculate verts to delete */
BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
found = FALSE;
@@ -293,7 +341,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
for ( ; e; e = BMO_iter_step(&siter)) {
/* this should always be wire, so this is mainly a speedup to avoid map lookup */
- if (BM_edge_is_wire(bm, e) && BMO_slot_map_contains(bm, op, "exclude", e)) {
+ if (BM_edge_is_wire(e) && BMO_slot_map_contains(bm, op, "exclude", e)) {
/* The original edge was excluded,
* this would result in a standalone wire edge - see [#30399] */
BM_edge_kill(bm, e);
@@ -331,45 +379,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
/* not sure what to do about example face, pass NULL for now */
f = BM_face_create_quad_tri_v(bm, verts, 4, NULL, FALSE);
-
- /* copy attribute */
- l = BM_iter_new(&iter, bm, BM_LOOPS_OF_FACE, f);
- for ( ; l; l = BM_iter_step(&iter)) {
-
- if (l->e != e && l->e != newedge) {
- continue;
- }
-
- l2 = l->radial_next;
-
- if (l2 == l) {
- l2 = newedge->l;
- BM_elem_attrs_copy(bm, bm, l2->f, l->f);
-
- BM_elem_attrs_copy(bm, bm, l2, l);
- l2 = l2->next;
- l = l->next;
- BM_elem_attrs_copy(bm, bm, l2, l);
- }
- else {
- BM_elem_attrs_copy(bm, bm, l2->f, l->f);
-
- /* copy dat */
- if (l2->v == l->v) {
- BM_elem_attrs_copy(bm, bm, l2, l);
- l2 = l2->next;
- l = l->next;
- BM_elem_attrs_copy(bm, bm, l2, l);
- }
- else {
- l2 = l2->next;
- BM_elem_attrs_copy(bm, bm, l2, l);
- l2 = l2->prev;
- l = l->next;
- BM_elem_attrs_copy(bm, bm, l2, l);
- }
- }
- }
+ bm_extrude_copy_face_loop_attributes(bm, f, e, newedge);
}
/* link isolated vert */
@@ -440,10 +450,10 @@ static void calc_solidify_normals(BMesh *bm)
}
}
MEM_freeN(edge_face_count);
- edge_face_count = NULL; /* dont re-use */
+ edge_face_count = NULL; /* don't re-use */
BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) {
- if (!BM_vert_is_manifold(bm, v)) {
+ if (!BM_vert_is_manifold(v)) {
BMO_elem_flag_enable(bm, v, VERT_NONMAN);
continue;
}
@@ -614,7 +624,7 @@ void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op)
BMO_op_exec(bm, &extrudeop);
/* Push the verts of the extruded faces inward to create thickness */
- BMO_slot_buffer_flag_enable(bm, &extrudeop, "geomout", FACE_MARK, BM_FACE);
+ BMO_slot_buffer_flag_enable(bm, &extrudeop, "geomout", BM_FACE, FACE_MARK);
calc_solidify_normals(bm);
solidify_add_thickness(bm, thickness);
diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c
new file mode 100644
index 00000000000..d64edada06d
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_inset.c
@@ -0,0 +1,444 @@
+/*
+ * ***** 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.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+#define ELE_NEW 1
+
+typedef struct SplitEdgeInfo {
+ float no[3];
+ float length;
+ BMEdge *e_old;
+ BMEdge *e_new;
+ BMLoop *l;
+} SplitEdgeInfo;
+
+static void edge_loop_tangent(BMEdge *e, BMLoop *e_loop, float r_no[3])
+{
+ float tvec[3];
+ BMVert *v1, *v2;
+ BM_edge_ordered_verts_ex(e, &v1, &v2, e_loop);
+
+ sub_v3_v3v3(tvec, v1->co, v2->co); /* use for temp storage */
+ cross_v3_v3v3(r_no, tvec, e_loop->f->no);
+ normalize_v3(r_no);
+}
+
+/**
+ * return the tag loop where there is...
+ * - only 1 tagged face attached to this edge.
+ * - 1 or more untagged faces.
+ *
+ * \note this function looks to be expensive
+ * but in most cases it will only do 2 iterations.
+ */
+static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l)
+{
+ if (LIKELY(l != NULL)) {
+ int tot_tag = 0;
+ int tot_untag = 0;
+ BMLoop *l_iter;
+ BMLoop *l_tag = NULL;
+ l_iter = l;
+ do {
+ if (BM_elem_flag_test(l_iter->f, BM_ELEM_TAG)) {
+ /* more then one tagged face - bail out early! */
+ if (tot_tag == 1) {
+ return NULL;
+ }
+ l_tag = l_iter;
+ tot_tag++;
+ }
+ else {
+ tot_untag++;
+ }
+
+ } while ((l_iter = l_iter->radial_next) != l);
+
+ return ((tot_tag == 1) && (tot_untag >= 1)) ? l_tag : NULL;
+ }
+ else {
+ return NULL;
+ }
+}
+
+
+/**
+ * implementation is as follows...
+ *
+ * - set all faces as tagged/untagged based on selection.
+ * - find all edges that have 1 tagged, 1 untagged face.
+ * - separate these edges and tag vertices, set their index to point to the original edge.
+ * - build faces between old/new edges.
+ * - inset the new edges into their faces.
+ */
+
+void bmo_inset_exec(BMesh *bm, BMOperator *op)
+{
+ const int use_outset = BMO_slot_bool_get(op, "use_outset");
+ const int use_boundary = BMO_slot_bool_get(op, "use_boundary") && (use_outset == FALSE);
+ const int use_even_offset = BMO_slot_bool_get(op, "use_even_offset");
+ const int use_even_boundry = use_even_offset; /* could make own option */
+ const int use_relative_offset = BMO_slot_bool_get(op, "use_relative_offset");
+ const float thickness = BMO_slot_float_get(op, "thickness");
+
+ int edge_info_len = 0;
+
+ BMIter iter;
+ SplitEdgeInfo *edge_info;
+ SplitEdgeInfo *es;
+
+ BMVert *v;
+ BMEdge *e;
+ BMFace *f;
+ int i, j, k;
+
+ if (use_outset == FALSE) {
+ BM_mesh_elem_flag_disable_all(bm, BM_FACE, BM_ELEM_TAG);
+ BMO_slot_buffer_hflag_enable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+ }
+ else {
+ BM_mesh_elem_flag_enable_all(bm, BM_FACE, BM_ELEM_TAG);
+ BMO_slot_buffer_hflag_disable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+ }
+
+ /* first count all inset edges we will split */
+ /* fill in array and initialize tagging */
+ BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
+ if (
+ /* tag if boundary is enabled */
+ (use_boundary && BM_edge_is_boundary(e) && BM_elem_flag_test(e->l->f, BM_ELEM_TAG)) ||
+
+ /* tag if edge is an interior edge inbetween a tagged and untagged face */
+ (bm_edge_is_mixed_face_tag(e->l)))
+ {
+ /* tag */
+ BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
+ BM_elem_flag_enable(e->v2, BM_ELEM_TAG);
+ BM_elem_flag_enable(e, BM_ELEM_TAG);
+
+ BM_elem_index_set(e, edge_info_len); /* set_dirty! */
+ edge_info_len++;
+ }
+ else {
+ BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
+ BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
+ BM_elem_flag_disable(e, BM_ELEM_TAG);
+
+ BM_elem_index_set(e, -1); /* set_dirty! */
+ }
+ }
+ bm->elem_index_dirty |= BM_EDGE;
+
+ edge_info = MEM_mallocN(edge_info_len * sizeof(SplitEdgeInfo), __func__);
+
+ /* fill in array and initialize tagging */
+ es = edge_info;
+ BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
+ i = BM_elem_index_get(e);
+ if (i != -1) {
+ /* calc edge-split info */
+ es->length = BM_edge_length_calc(e);
+ es->e_old = e;
+ es++;
+ /* initialize no and e_new after */
+ }
+ }
+
+ for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+ if ((es->l = bm_edge_is_mixed_face_tag(es->e_old->l))) {
+ /* do nothing */
+ }
+ else {
+ es->l = es->e_old->l; /* must be a boundary */
+ }
+
+
+ /* run the separate arg */
+ bmesh_edge_separate(bm, es->e_old, es->l);
+
+ /* calc edge-split info */
+ es->e_new = es->l->e;
+ edge_loop_tangent(es->e_new, es->l, es->no);
+
+ if (es->e_new == es->e_old) { /* happens on boundary edges */
+ es->e_old = BM_edge_create(bm, es->e_new->v1, es->e_new->v2, es->e_new, FALSE);
+ }
+
+ /* store index back to original in 'edge_info' */
+ BM_elem_index_set(es->e_new, i);
+ BM_elem_flag_enable(es->e_new, BM_ELEM_TAG);
+
+ /* important to tag again here */
+ BM_elem_flag_enable(es->e_new->v1, BM_ELEM_TAG);
+ BM_elem_flag_enable(es->e_new->v2, BM_ELEM_TAG);
+ }
+
+
+ /* show edge normals for debugging */
+#if 0
+ for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+ float tvec[3];
+ BMVert *v1, *v2;
+
+ mid_v3_v3v3(tvec, es->e_new->v1->co, es->e_new->v2->co);
+
+ v1 = BM_vert_create(bm, tvec, NULL);
+ v2 = BM_vert_create(bm, tvec, NULL);
+ madd_v3_v3fl(v2->co, es->no, 0.1f);
+ BM_edge_create(bm, v1, v2, NULL, FALSE);
+ }
+#endif
+
+ /* execute the split and position verts, it would be most obvious to loop over verts
+ * here but don't do this since we will be splitting them off (iterating stuff you modify is bad juju)
+ * instead loop over edges then their verts */
+ for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+ for (j = 0; j < 2; j++) {
+ v = (j == 0) ? es->e_new->v1 : es->e_new->v2;
+
+ /* end confusing part - just pretend this is a typical loop on verts */
+
+ /* only split of tagged verts - used by separated edges */
+
+ /* comment the first part because we know this verts in a tagged face */
+ if (/* v->e && */BM_elem_flag_test(v, BM_ELEM_TAG)) {
+ BMVert **vout;
+ int r_vout_len;
+ BMVert *v_glue = NULL;
+
+ /* disable touching twice, this _will_ happen if the flags not disabled */
+ BM_elem_flag_disable(v, BM_ELEM_TAG);
+
+ bmesh_vert_separate(bm, v, &vout, &r_vout_len);
+ v = NULL; /* don't use again */
+
+ /* in some cases the edge doesnt split off */
+ if (r_vout_len == 1) {
+ MEM_freeN(vout);
+ continue;
+ }
+
+ for (k = 0; k < r_vout_len; k++) {
+ BMVert *v_split = vout[k]; /* only to avoid vout[k] all over */
+
+ /* need to check if this vertex is from a */
+ int vert_edge_tag_tot = 0;
+ int vecpair[2];
+
+ /* find adjacent */
+ BM_ITER(e, &iter, bm, BM_EDGES_OF_VERT, v_split) {
+ if (BM_elem_flag_test(e, BM_ELEM_TAG) &&
+ BM_elem_flag_test(e->l->f, BM_ELEM_TAG))
+ {
+ if (vert_edge_tag_tot < 2) {
+ vecpair[vert_edge_tag_tot] = BM_elem_index_get(e);
+ BLI_assert(vecpair[vert_edge_tag_tot] != -1);
+ }
+
+ vert_edge_tag_tot++;
+ }
+ }
+
+ if (vert_edge_tag_tot != 0) {
+ float tvec[3];
+
+ if (vert_edge_tag_tot >= 2) { /* 2 edge users - common case */
+ const float *e_no_a = edge_info[vecpair[0]].no;
+ const float *e_no_b = edge_info[vecpair[1]].no;
+
+ add_v3_v3v3(tvec, e_no_a, e_no_b);
+ normalize_v3(tvec);
+
+ /* scale by edge angle */
+ if (use_even_offset) {
+ mul_v3_fl(tvec, shell_angle_to_dist(angle_normalized_v3v3(e_no_a, e_no_b) / 2.0f));
+ }
+
+ /* scale relative to edge lengths */
+ if (use_relative_offset) {
+ mul_v3_fl(tvec, (edge_info[vecpair[0]].length + edge_info[vecpair[1]].length) / 2.0f);
+ }
+ }
+ else if (vert_edge_tag_tot == 1) { /* 1 edge user - boundary vert, not so common */
+ const float *e_no_a = edge_info[vecpair[0]].no;
+
+ if (use_even_boundry) {
+
+ /* This case where only one edge attached to v_split
+ * is used - ei - the face to inset is on a boundary.
+ *
+ * We want the inset to align flush with the
+ * boundary edge, not the normal of the interior
+ * <--- edge which would give an unsightly bump.
+ * --+-------------------------+---------------+--
+ * |^v_other ^e_other /^v_split |
+ * | / |
+ * | / |
+ * | / <- tag split edge |
+ * | / |
+ * | / |
+ * | / |
+ * --+-----------------+-----------------------+--
+ * | |
+ * | |
+ *
+ * note, the fact we are doing location comparisons on verts that are moved about
+ * doesn’t matter because the direction will remain the same in this case.
+ */
+
+ BMEdge *e_other;
+ BMVert *v_other;
+ /* loop will always be either next of prev */
+ BMLoop *l = v_split->e->l;
+ if (l->prev->v == v_split) {
+ l = l->prev;
+ }
+ else if (l->next->v == v_split) {
+ l = l->next;
+ }
+ else if (l->v == v_split) {
+ /* pass */
+ }
+ else {
+ /* should never happen */
+ BLI_assert(0);
+ }
+
+ /* find the edge which is _not_ being split here */
+ if (!BM_elem_flag_test(l->e, BM_ELEM_TAG)) {
+ e_other = l->e;
+ }
+ else if (!BM_elem_flag_test(l->prev->e, BM_ELEM_TAG)) {
+ e_other = l->prev->e;
+ }
+ else {
+ BLI_assert(0);
+ e_other = NULL;
+ }
+
+ v_other = BM_edge_other_vert(e_other, v_split);
+ sub_v3_v3v3(tvec, v_other->co, v_split->co);
+ normalize_v3(tvec);
+
+ if (use_even_offset) {
+ mul_v3_fl(tvec, shell_angle_to_dist(angle_normalized_v3v3(e_no_a, tvec)));
+ }
+ }
+ else {
+ copy_v3_v3(tvec, e_no_a);
+ }
+
+ /* use_even_offset - doesn't apply here */
+
+ /* scale relative to edge length */
+ if (use_relative_offset) {
+ mul_v3_fl(tvec, edge_info[vecpair[0]].length);
+ }
+ }
+ else {
+ /* should never happen */
+ BLI_assert(0);
+ zero_v3(tvec);
+ }
+
+ /* apply the offset */
+ madd_v3_v3fl(v_split->co, tvec, thickness);
+ }
+
+ /* this saves expensive/slow glue check for common cases */
+ if (r_vout_len > 2) {
+ int ok = TRUE;
+ /* last step, NULL this vertex if has a tagged face */
+ BM_ITER(f, &iter, bm, BM_FACES_OF_VERT, v_split) {
+ if (BM_elem_flag_test(f, BM_ELEM_TAG)) {
+ ok = FALSE;
+ break;
+ }
+ }
+
+ if (ok) {
+ if (v_glue == NULL) {
+ v_glue = v_split;
+ }
+ else {
+ BM_vert_splice(bm, v_split, v_glue);
+ }
+ }
+ }
+ /* end glue */
+
+ }
+ MEM_freeN(vout);
+ }
+ }
+ }
+
+ /* create faces */
+ for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+ BMVert *varr[4] = {NULL};
+ /* get the verts in the correct order */
+ BM_edge_ordered_verts_ex(es->e_new, &varr[1], &varr[0], es->l);
+#if 0
+ if (varr[0] == es->e_new->v1) {
+ varr[2] = es->e_old->v2;
+ varr[3] = es->e_old->v1;
+ }
+ else {
+ varr[2] = es->e_old->v1;
+ varr[3] = es->e_old->v2;
+ }
+ j = 4;
+#else
+ /* slightly trickier check - since we can't assume the verts are split */
+ j = 2; /* 2 edges are set */
+ if (varr[0] == es->e_new->v1) {
+ if (es->e_old->v2 != es->e_new->v2) { varr[j++] = es->e_old->v2; }
+ if (es->e_old->v1 != es->e_new->v1) { varr[j++] = es->e_old->v1; }
+ }
+ else {
+ if (es->e_old->v1 != es->e_new->v1) { varr[j++] = es->e_old->v1; }
+ if (es->e_old->v2 != es->e_new->v2) { varr[j++] = es->e_old->v2; }
+ }
+
+ if (j == 2) {
+ /* can't make face! */
+ continue;
+ }
+#endif
+ /* no need to check doubles, we KNOW there won't be any */
+ /* yes - reverse face is correct in this case */
+ f = BM_face_create_quad_tri_v(bm, varr, j, es->l->f, FALSE);
+ BMO_elem_flag_enable(bm, f, ELE_NEW);
+ }
+
+ MEM_freeN(edge_info);
+
+ /* we could flag new edges/verts too, is it useful? */
+ BMO_slot_buffer_from_flag(bm, op, "faceout", BM_FACE, ELE_NEW);
+}
diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c
index 1d8b77e9300..dda3e144220 100644
--- a/source/blender/bmesh/operators/bmo_join_triangles.c
+++ b/source/blender/bmesh/operators/bmo_join_triangles.c
@@ -50,13 +50,13 @@
static float measure_facepair(BMesh *UNUSED(bm), BMVert *v1, BMVert *v2,
BMVert *v3, BMVert *v4, float limit)
{
- /* gives a 'weight' to a pair of triangles that join an edge to decide how good a join they would mak */
+ /* gives a 'weight' to a pair of triangles that join an edge to decide how good a join they would make */
/* Note: this is more complicated than it needs to be and should be cleaned up.. */
float n1[3], n2[3], measure = 0.0f, angle1, angle2, diff;
float edgeVec1[3], edgeVec2[3], edgeVec3[3], edgeVec4[3];
float minarea, maxarea, areaA, areaB;
- /* First Test: Normal differenc */
+ /* First Test: Normal difference */
normal_tri_v3(n1, v1->co, v2->co, v3->co);
normal_tri_v3(n2, v1->co, v3->co, v4->co);
@@ -74,7 +74,7 @@ static float measure_facepair(BMesh *UNUSED(bm), BMVert *v1, BMVert *v2,
return measure;
}
- /* Second test: Colinearit */
+ /* Second test: Colinearity */
sub_v3_v3v3(edgeVec1, v1->co, v2->co);
sub_v3_v3v3(edgeVec2, v2->co, v3->co);
sub_v3_v3v3(edgeVec3, v3->co, v4->co);
@@ -95,7 +95,7 @@ static float measure_facepair(BMesh *UNUSED(bm), BMVert *v1, BMVert *v2,
return measure;
}
- /* Third test: Concavit */
+ /* Third test: Concavity */
areaA = area_tri_v3(v1->co, v2->co, v3->co) + area_tri_v3(v1->co, v3->co, v4->co);
areaB = area_tri_v3(v2->co, v3->co, v4->co) + area_tri_v3(v4->co, v1->co, v2->co);
@@ -176,7 +176,9 @@ static int compareFaceAttribs(BMesh *bm, BMEdge *e, int douvs, int dovcols)
/* do UV */
if (luv1 && douvs) {
- if (tp1->tpage != tp2->tpage); /* do nothin */
+ if (tp1->tpage != tp2->tpage) {
+ /* do nothing */
+ }
else {
int i;
diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c
index 3e0fc881bfa..4578270d571 100644
--- a/source/blender/bmesh/operators/bmo_mesh_conv.c
+++ b/source/blender/bmesh/operators/bmo_mesh_conv.c
@@ -57,7 +57,7 @@ void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
Mesh *me = BMO_slot_ptr_get(op, "mesh");
int set_key = BMO_slot_bool_get(op, "set_shapekey");
- BM_mesh_to_bmesh(bm, me, set_key, ob->shapenr - 1);
+ BM_mesh_bm_from_me(bm, me, set_key, ob->shapenr);
if (me->key && ob->shapenr > me->key->totkey) {
ob->shapenr = me->key->totkey - 1;
@@ -79,5 +79,5 @@ void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
/* Object *ob = BMO_slot_ptr_get(op, "object"); */
int dotess = !BMO_slot_bool_get(op, "notessellation");
- BM_mesh_from_bmesh(bm, me, dotess);
+ BM_mesh_bm_to_me(bm, me, dotess);
}
diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c
index 761222f8714..268009dc9af 100644
--- a/source/blender/bmesh/operators/bmo_mirror.c
+++ b/source/blender/bmesh/operators/bmo_mirror.c
@@ -48,7 +48,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
float scale[3] = {1.0f, 1.0f, 1.0f};
float dist = BMO_slot_float_get(op, "mergedist");
int i, ototvert /*, ototedge */;
- int axis = BMO_slot_int_get(op, "axis");
+ int axis = BMO_slot_int_get(op, "axis");
int mirroru = BMO_slot_bool_get(op, "mirror_u");
int mirrorv = BMO_slot_bool_get(op, "mirror_v");
@@ -61,7 +61,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
BMO_op_initf(bm, &dupeop, "dupe geom=%s", op, "geom");
BMO_op_exec(bm, &dupeop);
- BMO_slot_buffer_flag_enable(bm, &dupeop, "newout", ELE_NEW, BM_ALL);
+ BMO_slot_buffer_flag_enable(bm, &dupeop, "newout", BM_ALL, ELE_NEW);
/* create old -> new mappin */
i = 0;
@@ -120,7 +120,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
BMO_op_finish(bm, &weldop);
BMO_op_finish(bm, &dupeop);
- BMO_slot_buffer_from_flag(bm, op, "newout", ELE_NEW, BM_ALL);
+ BMO_slot_buffer_from_flag(bm, op, "newout", BM_ALL, ELE_NEW);
BLI_array_free(vmap);
BLI_array_free(emap);
diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c
index 48a25214b54..837fe46b65b 100644
--- a/source/blender/bmesh/operators/bmo_primitive.c
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -268,12 +268,12 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
BMO_op_exec(bm, &bmop);
BMO_op_finish(bm, &prevop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
}
else {
BMO_op_initf(bm, &bmop, "extrude_edge_only edges=%fe", EDGE_ORIG);
BMO_op_exec(bm, &bmop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
}
BMO_op_callf(bm, "translate vec=%v verts=%s", vec, &bmop, "geomout");
@@ -283,7 +283,7 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
if (a)
BMO_op_finish(bm, &bmop);
- BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_from_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
}
void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
@@ -339,7 +339,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
BMO_op_exec(bm, &bmop);
}
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
BMO_op_callf(bm, "rotate cent=%v mat=%m3 verts=%s", vec, cmat, &bmop, "geomout");
prevop = bmop;
@@ -372,7 +372,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_from_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
}
void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
@@ -427,25 +427,25 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
"esubd edges=%fe smooth=%f numcuts=%i gridfill=%b beauty=%i",
EDGE_MARK, dia, 1, TRUE, B_SPHERE);
BMO_op_exec(bm, &bmop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", VERT_MARK, BM_VERT);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", EDGE_MARK, BM_EDGE);
+ BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_EDGE, EDGE_MARK);
BMO_op_finish(bm, &bmop);
}
- /* must transform after becayse of sphere subdivision */
+ /* must transform after because of sphere subdivision */
BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) {
if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
mul_m4_v3(mat, v->co);
}
}
- BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_from_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
}
void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
{
BMVert *eve;
- BMVert **tv = MEM_mallocN(sizeof(*tv)*monkeynv * 2, "tv");
+ BMVert **tv = MEM_mallocN(sizeof(*tv) * monkeynv * 2, "tv");
float mat[4][4];
int i;
@@ -486,7 +486,7 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
MEM_freeN(tv);
- BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_from_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
}
@@ -558,7 +558,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
BMO_op_callf(bm, "dissolve_faces faces=%ff", FACE_NEW);
}
- BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_from_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
}
void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
@@ -654,7 +654,7 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, FALSE);
BMO_op_callf(bm, "removedoubles verts=%fv dist=%f", VERT_MARK, 0.000001);
- BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_from_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
}
void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
@@ -732,5 +732,5 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, FALSE);
BM_face_create_quad_tri(bm, v8, v7, v6, v5, NULL, FALSE);
- BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_from_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
}
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index 8d657e7b677..a97ed6d9dfd 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -368,7 +368,7 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
BMO_op_callf(bm, "collapse_uvs edges=%s", op, "edges");
BMO_op_init(bm, &weldop, "weldverts");
- BMO_slot_buffer_flag_enable(bm, op, "edges", EDGE_MARK, BM_EDGE);
+ BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
BMW_init(&walker, bm, BMW_SHELL,
BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP, BMW_MASK_NOP,
@@ -427,7 +427,7 @@ static void bmo_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer)
/* clear all short flags */
BMO_mesh_flag_disable_all(bm, op, BM_ALL, (1 << 16) - 1);
- BMO_slot_buffer_flag_enable(bm, op, "edges", EDGE_MARK, BM_EDGE);
+ BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
BMW_init(&walker, bm, BMW_LOOPDATA_ISLAND,
BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP, BMW_MASK_NOP,
@@ -504,7 +504,7 @@ void bmesh_finddoubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, c
/* Flag keepverts */
if (keepvert) {
- BMO_slot_buffer_flag_enable(bm, op, "keepverts", VERT_KEEP, BM_VERT);
+ BMO_slot_buffer_flag_enable(bm, op, "keepverts", BM_VERT, VERT_KEEP);
}
len = BLI_array_count(verts);
@@ -571,7 +571,7 @@ void bmo_automerge_exec(BMesh *bm, BMOperator *op)
/* The "verts" input sent to this op is the set of verts that
* can be merged away into any other verts. Mark all other verts
* as VERT_KEEP. */
- BMO_slot_buffer_flag_enable(bm, op, "verts", VERT_IN, BM_VERT);
+ BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_IN);
BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) {
if (!BMO_elem_flag_test(bm, v, VERT_IN)) {
BMO_elem_flag_enable(bm, v, VERT_KEEP);
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index 9a6d9e7b836..f97f5225169 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -75,7 +75,7 @@ static BMEdge *connect_smallest_face(BMesh *bm, BMVert *v1, BMVert *v2, BMFace *
/* this isn't the best thing in the world. it doesn't handle cases where there's
* multiple faces yet. that might require a convexity test to figure out which
- * face is "best," and who knows what for non-manifold conditions. */
+ * face is "best" and who knows what for non-manifold conditions. */
for (face = BM_iter_new(&iter, bm, BM_FACES_OF_VERT, v1); face; face = BM_iter_step(&iter)) {
for (v = BM_iter_new(&iter2, bm, BM_VERTS_OF_FACE, face); v; v = BM_iter_step(&iter2)) {
if (v == v2) {
@@ -290,7 +290,7 @@ static void quad_1edge_split(BMesh *bm, BMFace *UNUSED(face),
add = 2;
for (i = 0; i < numcuts; i++) {
connect_smallest_face(bm, verts[i], verts[numcuts + add], &nf);
- if (i == numcuts/2) {
+ if (i == numcuts / 2) {
add -= 1;
connect_smallest_face(bm, verts[i], verts[numcuts + add], &nf);
}
@@ -487,8 +487,8 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts
BMO_elem_flag_enable(bm, nf, ELE_INNER);
- v1 = lines[(i + 1)*s] = verts[a];
- v2 = lines[(i + 1)*s + s - 1] = verts[b];
+ v1 = lines[(i + 1) * s] = verts[a];
+ v2 = lines[(i + 1) * s + s - 1] = verts[b];
temp = *e;
for (a = 0; a < numcuts; a++) {
@@ -657,7 +657,7 @@ static SubDPattern *patterns[] = {
NULL,
};
-#define PLEN (sizeof(patterns) / sizeof(void *))
+#define PLEN (sizeof(patterns) / sizeof(void *))
typedef struct SubDFaceData {
BMVert *start; SubDPattern *pat;
@@ -685,7 +685,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op)
int beauty, cornertype, singleedge, gridfill;
int skey, seed, i, j, matched, a, b, numcuts, totesel;
- BMO_slot_buffer_flag_enable(bmesh, op, "edges", SUBD_SPLIT, BM_EDGE);
+ BMO_slot_buffer_flag_enable(bmesh, op, "edges", BM_EDGE, SUBD_SPLIT);
numcuts = BMO_slot_int_get(op, "numcuts");
seed = BMO_slot_int_get(op, "seed");
@@ -740,7 +740,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op)
}
/* first go through and tag edge */
- BMO_slot_buffer_from_flag(bmesh, op, "edges", SUBD_SPLIT, BM_EDGE);
+ BMO_slot_buffer_from_flag(bmesh, op, "edges", BM_EDGE, SUBD_SPLIT);
params.numcuts = numcuts;
params.op = op;
@@ -754,10 +754,10 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op)
params.off[2] = (float)BLI_drand() * 200.0f;
BMO_slot_map_to_flag(bmesh, op, "custompatterns",
- FACE_CUSTOMFILL, BM_FACE);
+ BM_FACE, FACE_CUSTOMFILL);
BMO_slot_map_to_flag(bmesh, op, "edgepercents",
- EDGE_PERCENT, BM_EDGE);
+ BM_EDGE, EDGE_PERCENT);
for (face = BM_iter_new(&fiter, bmesh, BM_FACES_OF_MESH, NULL);
face;
@@ -949,7 +949,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op)
a = (a + 1) % vlen;
}
- //BM_face_legal_splits(bmesh, face, splits, BLI_array_count(splits)/2);
+ //BM_face_legal_splits(bmesh, face, splits, BLI_array_count(splits) / 2);
for (j = 0; j < BLI_array_count(splits) / 2; j++) {
if (splits[j * 2]) {
@@ -1005,10 +1005,10 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op)
BLI_array_free(splits);
BLI_array_free(loops);
- BMO_slot_buffer_from_flag(bmesh, op, "outinner", ELE_INNER, BM_ALL);
- BMO_slot_buffer_from_flag(bmesh, op, "outsplit", ELE_SPLIT, BM_ALL);
+ BMO_slot_buffer_from_flag(bmesh, op, "outinner", BM_ALL, ELE_INNER);
+ BMO_slot_buffer_from_flag(bmesh, op, "outsplit", BM_ALL, ELE_SPLIT);
- BMO_slot_buffer_from_flag(bmesh, op, "geomout", ELE_INNER|ELE_SPLIT|SUBD_SPLIT, BM_ALL);
+ BMO_slot_buffer_from_flag(bmesh, op, "geomout", BM_ALL, ELE_INNER|ELE_SPLIT|SUBD_SPLIT);
}
/* editmesh-emulating functio */
@@ -1080,10 +1080,10 @@ void bmo_edgebisect_exec(BMesh *bm, BMOperator *op)
{
BMOIter siter;
BMEdge *e;
- SubDParams params;
+ SubDParams params = {0};
int skey;
- params.numcuts = BMO_slot_get(op, "numcuts")->data.i;
+ params.numcuts = BMO_slot_int_get(op, "numcuts");
params.op = op;
BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
@@ -1096,7 +1096,7 @@ void bmo_edgebisect_exec(BMesh *bm, BMOperator *op)
bm_subdivide_multicut(bm, e, &params, e->v1, e->v2);
}
- BMO_slot_buffer_from_flag(bm, op, "outsplit", ELE_SPLIT, BM_ALL);
+ BMO_slot_buffer_from_flag(bm, op, "outsplit", BM_ALL, ELE_SPLIT);
BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, skey);
}
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 42e43494a74..679efdcf030 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -72,8 +72,8 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_flag(bm, op, "edgeout", EDGE_NEW, BM_EDGE);
- BMO_slot_buffer_from_flag(bm, op, "faceout", FACE_NEW, BM_FACE);
+ BMO_slot_buffer_from_flag(bm, op, "edgeout", BM_EDGE, EDGE_NEW);
+ BMO_slot_buffer_from_flag(bm, op, "faceout", BM_FACE, FACE_NEW);
BLI_array_free(projectverts);
BLI_array_free(newfaces);
@@ -87,7 +87,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
BMEdge *e;
int stop = 0;
- BMO_slot_buffer_flag_enable(bm, op, "constrain_edges", EDGE_MARK, BM_EDGE);
+ BMO_slot_buffer_flag_enable(bm, op, "constrain_edges", BM_EDGE, EDGE_MARK);
BMO_ITER(f, &siter, bm, op, "faces", BM_FACE) {
if (f->len == 3) {
@@ -152,7 +152,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_flag(bm, op, "geomout", ELE_NEW, BM_EDGE|BM_FACE);
+ BMO_slot_buffer_from_flag(bm, op, "geomout", BM_EDGE|BM_FACE, ELE_NEW);
}
void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
@@ -213,8 +213,8 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
/* clean up fill */
BMO_op_initf(bm, &bmop, "beautify_fill faces=%ff constrain_edges=%fe", ELE_NEW, EDGE_MARK);
BMO_op_exec(bm, &bmop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", ELE_NEW, BM_FACE|BM_EDGE);
+ BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE|BM_EDGE, ELE_NEW);
BMO_op_finish(bm, &bmop);
- BMO_slot_buffer_from_flag(bm, op, "geomout", ELE_NEW, BM_EDGE|BM_FACE);
+ BMO_slot_buffer_from_flag(bm, op, "geomout", BM_EDGE|BM_FACE, ELE_NEW);
}
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index de82bb4f573..c9658b37022 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -49,7 +49,7 @@ void bmo_makevert_exec(BMesh *bm, BMOperator *op)
BMO_slot_vec_get(op, "co", vec);
BMO_elem_flag_enable(bm, BM_vert_create(bm, vec, NULL), 1);
- BMO_slot_buffer_from_flag(bm, op, "newvertout", 1, BM_VERT);
+ BMO_slot_buffer_from_flag(bm, op, "newvertout", BM_VERT, 1);
}
void bmo_transform_exec(BMesh *bm, BMOperator *op)
@@ -155,7 +155,7 @@ void bmo_edgerotate_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, e2, EDGE_OUT);
- /* dont touch again */
+ /* don't touch again */
BMO_elem_flag_enable(bm, fa, FACE_TAINT);
BMO_elem_flag_enable(bm, fb, FACE_TAINT);
}
@@ -163,7 +163,7 @@ void bmo_edgerotate_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_flag(bm, op, "edgeout", EDGE_OUT, BM_EDGE);
+ BMO_slot_buffer_from_flag(bm, op, "edgeout", BM_EDGE, EDGE_OUT);
#undef EDGE_OUT
#undef FACE_TAINT
@@ -259,14 +259,14 @@ void bmo_regionextend_exec(BMesh *bm, BMOperator *op)
int use_faces = BMO_slot_bool_get(op, "use_faces");
int constrict = BMO_slot_bool_get(op, "constrict");
- BMO_slot_buffer_flag_enable(bm, op, "geom", SEL_ORIG, BM_ALL);
+ BMO_slot_buffer_flag_enable(bm, op, "geom", BM_ALL, SEL_ORIG);
if (constrict)
bmo_regionextend_constrict(bm, op, use_faces);
else
bmo_regionextend_extend(bm, op, use_faces);
- BMO_slot_buffer_from_flag(bm, op, "geomout", SEL_FLAG, BM_ALL);
+ BMO_slot_buffer_from_flag(bm, op, "geomout", BM_ALL, SEL_FLAG);
}
/********* righthand faces implementation ****** */
@@ -310,7 +310,7 @@ void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op)
startf = NULL;
maxx = -1.0e10;
- BMO_slot_buffer_flag_enable(bm, op, "faces", FACE_FLAG, BM_FACE);
+ BMO_slot_buffer_flag_enable(bm, op, "faces", BM_FACE, FACE_FLAG);
/* find a starting face */
BMO_ITER(f, &siter, bm, op, "faces", BM_FACE) {
@@ -466,11 +466,11 @@ void bmo_vertexsmooth_exec(BMesh *bm, BMOperator *op)
*/
static float ngon_perimeter(BMesh *bm, BMFace *f)
{
- BMIter liter;
- BMLoop *l;
- int num_verts = 0;
- float v[3], sv[3];
- float perimeter = 0.0f;
+ BMIter liter;
+ BMLoop *l;
+ int num_verts = 0;
+ float v[3], sv[3];
+ float perimeter = 0.0f;
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
if (num_verts == 0) {
@@ -498,11 +498,11 @@ static float ngon_perimeter(BMesh *bm, BMFace *f)
*/
static float ngon_fake_area(BMesh *bm, BMFace *f)
{
- BMIter liter;
- BMLoop *l;
- int num_verts = 0;
- float v[3], sv[3], c[3];
- float area = 0.0f;
+ BMIter liter;
+ BMLoop *l;
+ int num_verts = 0;
+ float v[3], sv[3], c[3];
+ float area = 0.0f;
BM_face_center_mean_calc(bm, f, c);
@@ -528,13 +528,13 @@ static float ngon_fake_area(BMesh *bm, BMFace *f)
* extra face data (computed data)
*/
typedef struct SimSel_FaceExt {
- BMFace *f; /* the face */
- float c[3]; /* center */
+ BMFace *f; /* the face */
+ float c[3]; /* center */
union {
- float area; /* area */
- float perim; /* perimeter */
- float d; /* 4th component of plane (the first three being the normal) */
- struct Image *t; /* image pointer */
+ float area; /* area */
+ float perim; /* perimeter */
+ float d; /* 4th component of plane (the first three being the normal) */
+ struct Image *t; /* image pointer */
};
} SimSel_FaceExt;
@@ -572,7 +572,7 @@ void bmo_similarfaces_exec(BMesh *bm, BMOperator *op)
}
/* allocate memory for the selected faces indices and for all temporary faces */
- indices = (int *)MEM_callocN(sizeof(int) * num_sels, "face indices util.c");
+ indices = (int *)MEM_callocN(sizeof(int) * num_sels, "face indices util.c");
f_ext = (SimSel_FaceExt *)MEM_callocN(sizeof(SimSel_FaceExt) * num_total, "f_ext util.c");
/* loop through all the faces and fill the faces/indices structure */
@@ -693,23 +693,23 @@ void bmo_similarfaces_exec(BMesh *bm, BMOperator *op)
MEM_freeN(indices);
/* transfer all marked faces to the output slot */
- BMO_slot_buffer_from_flag(bm, op, "faceout", FACE_MARK, BM_FACE);
+ BMO_slot_buffer_from_flag(bm, op, "faceout", BM_FACE, FACE_MARK);
}
/**************************************************************************** *
* Similar Edges
**************************************************************************** */
-#define EDGE_MARK 1
+#define EDGE_MARK 1
/*
* compute the angle of an edge (i.e. the angle between two faces)
*/
static float edge_angle(BMesh *bm, BMEdge *e)
{
- BMIter fiter;
- BMFace *f, *f_prev = NULL;
+ BMIter fiter;
+ BMFace *f, *f_prev = NULL;
- /* first edge faces, dont account for 3+ */
+ /* first edge faces, don't account for 3+ */
BM_ITER(f, &fiter, bm, BM_FACES_OF_EDGE, e) {
if (f_prev == NULL) {
@@ -726,15 +726,15 @@ static float edge_angle(BMesh *bm, BMEdge *e)
* extra edge information
*/
typedef struct SimSel_EdgeExt {
- BMEdge *e;
+ BMEdge *e;
union {
- float dir[3];
- float angle; /* angle between the face */
+ float dir[3];
+ float angle; /* angle between the face */
};
union {
- float length; /* edge length */
- int faces; /* faces count */
+ float length; /* edge length */
+ int faces; /* faces count */
};
} SimSel_EdgeExt;
@@ -745,9 +745,9 @@ typedef struct SimSel_EdgeExt {
void bmo_similaredges_exec(BMesh *bm, BMOperator *op)
{
BMOIter es_iter; /* selected edges iterator */
- BMIter e_iter; /* mesh edges iterator */
- BMEdge *es; /* selected edge */
- BMEdge *e; /* mesh edge */
+ BMIter e_iter; /* mesh edges iterator */
+ BMEdge *es; /* selected edge */
+ BMEdge *e; /* mesh edge */
int idx = 0, i = 0 /* , f = 0 */;
int *indices = NULL;
SimSel_EdgeExt *e_ext = NULL;
@@ -767,7 +767,7 @@ void bmo_similaredges_exec(BMesh *bm, BMOperator *op)
}
/* allocate memory for the selected edges indices and for all temporary edges */
- indices = (int *)MEM_callocN(sizeof(int) * num_sels, "indices util.c");
+ indices = (int *)MEM_callocN(sizeof(int) * num_sels, "indices util.c");
e_ext = (SimSel_EdgeExt *)MEM_callocN(sizeof(SimSel_EdgeExt) * num_total, "e_ext util.c");
/* loop through all the edges and fill the edges/indices structure */
@@ -785,7 +785,7 @@ void bmo_similaredges_exec(BMesh *bm, BMOperator *op)
for (i = 0; i < num_total; i++) {
switch (type) {
case SIMEDGE_LENGTH: /* compute the length of the edge */
- e_ext[i].length = len_v3v3(e_ext[i].e->v1->co, e_ext[i].e->v2->co);
+ e_ext[i].length = len_v3v3(e_ext[i].e->v1->co, e_ext[i].e->v2->co);
break;
case SIMEDGE_DIR: /* compute the direction */
@@ -793,11 +793,11 @@ void bmo_similaredges_exec(BMesh *bm, BMOperator *op)
break;
case SIMEDGE_FACE: /* count the faces around the edge */
- e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
+ e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
break;
case SIMEDGE_FACE_ANGLE:
- e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
+ e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
if (e_ext[i].faces == 2)
e_ext[i].angle = edge_angle(bm, e_ext[i].e);
break;
@@ -897,7 +897,7 @@ void bmo_similaredges_exec(BMesh *bm, BMOperator *op)
MEM_freeN(indices);
/* transfer all marked edges to the output slot */
- BMO_slot_buffer_from_flag(bm, op, "edgeout", EDGE_MARK, BM_EDGE);
+ BMO_slot_buffer_from_flag(bm, op, "edgeout", BM_EDGE, EDGE_MARK);
}
/**************************************************************************** *
@@ -938,7 +938,7 @@ void bmo_similarverts_exec(BMesh *bm, BMOperator *op)
}
/* allocate memory for the selected vertices indices and for all temporary vertices */
- indices = (int *)MEM_mallocN(sizeof(int) * num_sels, "vertex indices");
+ indices = (int *)MEM_mallocN(sizeof(int) * num_sels, "vertex indices");
v_ext = (SimSel_VertExt *)MEM_mallocN(sizeof(SimSel_VertExt) * num_total, "vertex extra");
/* loop through all the vertices and fill the vertices/indices structure */
@@ -952,7 +952,7 @@ void bmo_similarverts_exec(BMesh *bm, BMOperator *op)
switch (type) {
case SIMVERT_FACE:
/* calling BM_vert_face_count every time is time consumming, so call it only once per vertex */
- v_ext[i].num_faces = BM_vert_face_count(v);
+ v_ext[i].num_faces = BM_vert_face_count(v);
break;
case SIMVERT_VGROUP:
@@ -1013,7 +1013,7 @@ void bmo_similarverts_exec(BMesh *bm, BMOperator *op)
MEM_freeN(indices);
MEM_freeN(v_ext);
- BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_from_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
}
/**************************************************************************** *
@@ -1341,5 +1341,5 @@ void bmo_vertexshortestpath_exec(BMesh *bm, BMOperator *op)
BLI_heap_free(h, NULL);
MEM_freeN(vert_list);
- BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT);
+ BMO_slot_buffer_from_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
}
diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c
index 1bed4898166..3b8337f46ae 100644
--- a/source/blender/bmesh/tools/BME_bevel.c
+++ b/source/blender/bmesh/tools/BME_bevel.c
@@ -33,14 +33,15 @@
#include "DNA_meshdata_types.h"
#include "DNA_mesh_types.h"
-#include "BKE_utildefines.h"
-#include "BKE_tessmesh.h"
-#include "BKE_bmesh.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
#include "BLI_memarena.h"
+#include "BKE_utildefines.h"
+#include "BKE_tessmesh.h"
+#include "BKE_bmesh.h"
+
#include "bmesh.h"
#include "intern/bmesh_private.h"
@@ -151,7 +152,7 @@ static int BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v)
BMEdge *e, *elast;
BMLoop *l1, *l2;
- if (!BM_vert_is_manifold(bm, v)) {
+ if (!BM_vert_is_manifold(v)) {
return 0;
}
@@ -166,7 +167,18 @@ static int BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v)
e = v->e;
l1 = e->l;
l2 = l1->radial_next;
- bmesh_jfke(bm, l1->f, l2->f, e);
+ if (l1->v == l2->v) {
+ /* faces have incompatible directions; need to reverse one */
+ if (!bmesh_loop_reverse(bm, l2->f)) {
+ BLI_assert(!"bevel dissolve disk cannot reverse loop");
+ return 0;
+ }
+ l2 = l1->radial_next;
+ }
+ if (!bmesh_jfke(bm, l1->f, l2->f, e)) {
+ BLI_assert(!"bevel dissolve disk cannot join faces");
+ return 0;
+ }
}
e = v->e;
@@ -178,6 +190,14 @@ static int BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v)
l1 = elast->l;
l2 = l1->radial_next;
+ if (l1->v == l2->v) {
+ /* faces have incompatible directions */
+ if (!bmesh_loop_reverse(bm, l2->f)) {
+ BLI_assert(!"bevel dissolve disk cannot reverse loop");
+ return 0;
+ }
+ l2 = l1->radial_next;
+ }
bmesh_jfke(bm, l1->f, l2->f, elast);
}
@@ -281,6 +301,9 @@ static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l,
float maxfactor, scale, len, dis, vec1[3], vec2[3], t_up_vec[3];
int is_edge, forward, is_split_vert;
+ /* ov, vtd2, and is_split_vert are set but UNUSED */
+ (void)ov, (void)vtd2, (void)is_split_vert;
+
if (l == NULL) {
/* what you call operator overloading in C :)
* I wanted to use the same function for both wire edges and poly loops
@@ -627,7 +650,7 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(opti
static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td)
{
BMVert *v1, *v2;
- BMFace *f;
+ /* BMFace *f; */ /* UNUSED */
/* get/make the first vert to be used in SFME */
/* may need to split the previous edge */
@@ -640,7 +663,7 @@ static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int UNUSED(opti
l = l->next->next;
/* "cut off" this corner */
- f = BM_face_split(bm, l->f, v2, v1, NULL, l->e, FALSE);
+ /* f = */ BM_face_split(bm, l->f, v2, v1, NULL, l->e, FALSE);
return l;
}
@@ -824,17 +847,17 @@ static void bevel_init_edges(BMesh *bm, int options, BME_TransData_Head *td)
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
weight = 0.0;
if (!BMO_elem_flag_test(bm, e, BME_BEVEL_NONMAN)) {
- if(options & BME_BEVEL_SELECT) {
- if(BM_elem_flag_test(e, BM_ELEM_SELECT)) weight = 1.0;
+ if (options & BME_BEVEL_SELECT) {
+ if (BM_elem_flag_test(e, BM_ELEM_SELECT)) weight = 1.0;
}
- else if(options & BME_BEVEL_WEIGHT) {
+ else if (options & BME_BEVEL_WEIGHT) {
weight = BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT);
}
else {
weight = 1.0;
}
- if(weight > 0.0) {
+ if (weight > 0.0) {
BMO_elem_flag_enable(bm, e, BME_BEVEL_BEVEL);
BMO_elem_flag_enable(bm, e->v1, BME_BEVEL_BEVEL);
BMO_elem_flag_enable(bm, e->v2, BME_BEVEL_BEVEL);
@@ -846,9 +869,9 @@ static void bevel_init_edges(BMesh *bm, int options, BME_TransData_Head *td)
/* clean up edges with 2 faces that share more than one edg */
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
- if(BMO_elem_flag_test(bm, e, BME_BEVEL_BEVEL)) {
+ if (BMO_elem_flag_test(bm, e, BME_BEVEL_BEVEL)) {
count = BM_face_share_edge_count(e->l->f, e->l->radial_next->f);
- if(count > 1) BMO_elem_flag_disable(bm, e, BME_BEVEL_BEVEL);
+ if (count > 1) BMO_elem_flag_disable(bm, e, BME_BEVEL_BEVEL);
}
}
}
@@ -864,15 +887,15 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind
/* tag non-manifold geometr */
BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
BMO_elem_flag_enable(bm, v, BME_BEVEL_ORIG);
- if(v->e) {
+ if (v->e) {
BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL);
- if (!BM_vert_is_manifold(bm, v)) {
+ if (!BM_vert_is_manifold(v)) {
BMO_elem_flag_enable(bm, v, BME_BEVEL_NONMAN);
}
/* test wire ver */
len = BM_vert_edge_count(v);
- if (len == 2 && BM_vert_is_wire(bm, v))
+ if (len == 2 && BM_vert_is_wire(v))
BMO_elem_flag_disable(bm, v, BME_BEVEL_NONMAN);
}
else {
@@ -882,12 +905,12 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
BMO_elem_flag_enable(bm, e, BME_BEVEL_ORIG);
- if (!BM_edge_is_manifold(bm, e)) {
+ if (!BM_edge_is_manifold(e)) {
BMO_elem_flag_enable(bm, e->v1, BME_BEVEL_NONMAN);
BMO_elem_flag_enable(bm, e->v2, BME_BEVEL_NONMAN);
BMO_elem_flag_enable(bm, e, BME_BEVEL_NONMAN);
}
- if(BMO_elem_flag_test(bm, e->v1, BME_BEVEL_NONMAN) || BMO_elem_flag_test(bm, e->v2, BME_BEVEL_NONMAN)) {
+ if (BMO_elem_flag_test(bm, e->v1, BME_BEVEL_NONMAN) || BMO_elem_flag_test(bm, e->v2, BME_BEVEL_NONMAN)) {
BMO_elem_flag_enable(bm, e, BME_BEVEL_NONMAN);
}
}
@@ -896,7 +919,7 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind
BMO_elem_flag_enable(bm, f, BME_BEVEL_ORIG);
}
- if(options & BME_BEVEL_VERT) {
+ if (options & BME_BEVEL_VERT) {
bevel_init_verts(bm, options, td);
}
else {
@@ -957,40 +980,40 @@ static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int option
/* bevel poly */
BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
- if(BMO_elem_flag_test(bm, f, BME_BEVEL_ORIG)) {
+ if (BMO_elem_flag_test(bm, f, BME_BEVEL_ORIG)) {
BME_bevel_poly(bm, f, value, options, td);
}
}
/* get rid of beveled edge */
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
- if(BMO_elem_flag_test(bm, e, BME_BEVEL_BEVEL) && BMO_elem_flag_test(bm, e, BME_BEVEL_ORIG)) {
+ if (BMO_elem_flag_test(bm, e, BME_BEVEL_BEVEL) && BMO_elem_flag_test(bm, e, BME_BEVEL_ORIG)) {
BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e);
}
}
/* link up corners and cli */
BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
- if(BMO_elem_flag_test(bm, v, BME_BEVEL_ORIG) && BMO_elem_flag_test(bm, v, BME_BEVEL_BEVEL)) {
+ if (BMO_elem_flag_test(bm, v, BME_BEVEL_ORIG) && BMO_elem_flag_test(bm, v, BME_BEVEL_BEVEL)) {
curedge = v->e;
- do{
+ do {
l = curedge->l;
l2 = l->radial_next;
- if(l->v != v) l = l->next;
- if(l2->v != v) l2 = l2->next;
- if(l->f->len > 3)
+ if (l->v != v) l = l->next;
+ if (l2->v != v) l2 = l2->next;
+ if (l->f->len > 3)
BM_face_split(bm, l->f, l->next->v, l->prev->v, &l, l->e, FALSE); /* clip this corner off */
- if(l2->f->len > 3)
+ if (l2->f->len > 3)
BM_face_split(bm, l2->f, l2->next->v, l2->prev->v, &l, l2->e, FALSE); /* clip this corner off */
curedge = bmesh_disk_edge_next(curedge, v);
- } while(curedge != v->e);
+ } while (curedge != v->e);
BME_Bevel_Dissolve_Disk(bm, v);
}
}
/* Debug print, remov */
BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
- if(f->len == 2) {
+ if (f->len == 2) {
printf("warning");
}
}
@@ -998,7 +1021,8 @@ static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int option
return bm;
}
-BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_index, float angle, BME_TransData_Head **rtd)
+BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_index, float angle,
+ BME_TransData_Head **rtd, int do_tessface)
{
BMesh *bm = em->bm;
BMVert *v;
@@ -1027,7 +1051,11 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i
BMO_pop(bm);
}
- BMEdit_RecalcTessellation(em);
+ /* possibly needed when running as a tool (which is no longer functional)
+ * but keep as an optioin for now */
+ if (do_tessface) {
+ BMEdit_RecalcTessellation(em);
+ }
/* interactive preview? */
if (rtd) {
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 5b1ad604b50..5f8ceeeebb3 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -40,7 +40,7 @@ void forEachObjectInScene(Scene *sce, Functor &f)
void AnimationExporter::exportAnimations(Scene *sce)
{
- if(hasAnimations(sce)) {
+ if (hasAnimations(sce)) {
this->scene = sce;
openLibrary();
@@ -59,7 +59,7 @@ 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;
@@ -88,7 +88,7 @@ void AnimationExporter::operator() (Object *ob)
}
//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) {
@@ -102,7 +102,7 @@ void AnimationExporter::operator() (Object *ob)
}
//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) {
@@ -117,11 +117,11 @@ void AnimationExporter::operator() (Object *ob)
}
//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;
@@ -152,7 +152,7 @@ float * AnimationExporter::get_eul_source_for_quat(Object *ob )
{
char * transformName = extract_transform_name( fcu->rna_path );
- if( !strcmp(transformName, "rotation_quaternion") ) {
+ if ( !strcmp(transformName, "rotation_quaternion") ) {
for ( int i = 0 ; i < fcu->totvert ; i++){
*(quat + ( i * 4 ) + fcu->array_index) = fcu->bezt[i].vec[1][1];
}
@@ -184,7 +184,7 @@ std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu )
char* boneName = strtok((char *)rna_path.c_str(), "\"");
boneName = strtok(NULL,"\"");
- if( boneName != NULL )
+ if ( boneName != NULL )
return /*id_name(ob) + "_" +*/ std::string(boneName);
else
return id_name(ob);
@@ -257,7 +257,7 @@ 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)
+ if (quatRotation)
{
float * eul = get_eul_source_for_quat(ob);
float * eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values");
@@ -317,7 +317,7 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
target = get_camera_id(ob)
+ "/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true);
- if( ma )
+ if ( ma )
target = translate_id(id_name(ma)) + "-effect"
+"/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true);
}
@@ -348,7 +348,7 @@ bool AnimationExporter::is_bone_deform_group(Bone * bone)
{
bool is_def;
//Check if current bone is deform
- if((bone->flag & BONE_NO_DEFORM) == 0 ) return true;
+ if ((bone->flag & BONE_NO_DEFORM) == 0 ) return true;
//Check child bones
else
{
@@ -374,11 +374,11 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
{
std::string bone_name = getObjectBoneName(ob_arm,fcu);
int val = BLI_strcasecmp((char*)bone_name.c_str(),bone->name);
- if(val==0) break;
+ if (val==0) break;
fcu = fcu->next;
}
- if(!(fcu)) return;
+ if (!(fcu)) return;
bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name);
if (!pchan)
return;
@@ -548,7 +548,8 @@ void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNa
if ( transform )
{
param.push_back("TRANSFORM");
- }else{ //assumes if axis isn't specified all axises are added
+ }
+ else { //assumes if axis isn't specified all axises are added
param.push_back("X");
param.push_back("Y");
param.push_back("Z");
@@ -592,7 +593,8 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
}
else if (rotation) {
values[1] = RAD2DEGF(bezt->vec[0][1]);
- } else {
+ }
+ else {
values[1] = bezt->vec[0][1];
}
break;
@@ -607,7 +609,8 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
}
else if (rotation) {
values[1] = RAD2DEGF(bezt->vec[2][1]);
- } else {
+ }
+ else {
values[1] = bezt->vec[2][1];
}
break;
@@ -776,7 +779,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob
// SECOND_LIFE_COMPATIBILITY
// AFAIK animation to second life is via BVH, but no
// reason to not have the collada-animation be correct
- if(export_settings->second_life)
+ if (export_settings->second_life)
{
float temp[4][4];
copy_m4_m4(temp, bone->arm_mat);
@@ -785,7 +788,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob
mult_m4_m4m4(mat, mat, temp);
- if(bone->parent)
+ if (bone->parent)
{
copy_m4_m4(temp, bone->parent->arm_mat);
temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
@@ -858,9 +861,11 @@ std::string AnimationExporter::create_interpolation_source(FCurve *fcu, const st
if (fcu->bezt[i].ipo==BEZT_IPO_BEZ) {
source.appendValues(BEZIER_NAME);
*has_tangents = true;
- } else if (fcu->bezt[i].ipo==BEZT_IPO_CONST) {
+ }
+ else if (fcu->bezt[i].ipo==BEZT_IPO_CONST) {
source.appendValues(STEP_NAME);
- } else { // BEZT_IPO_LIN
+ }
+ else { // BEZT_IPO_LIN
source.appendValues(LINEAR_NAME);
}
}
@@ -1129,21 +1134,21 @@ bool AnimationExporter::hasAnimations(Scene *sce)
FCurve *fcu = 0;
//Check for object transform animations
- if(ob->adt && ob->adt->action)
+ if (ob->adt && ob->adt->action)
fcu = (FCurve*)ob->adt->action->curves.first;
//Check for Lamp parameter animations
- else if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action )
+ else if ( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action )
fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first);
//Check for Camera parameter animations
- else if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action )
+ else if ( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action )
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 097e9902de5..0e66a292e94 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -119,7 +119,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
bez.vec[1][1] = bc_get_float_value(output, j * dim + i);
- if( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER ||
+ if ( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER ||
curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP)
{
COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues();
@@ -132,7 +132,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
// outtangent
bez.vec[2][0] = bc_get_float_value(outtan, (j * 2 * dim ) + (2 * i)) * fps;
bez.vec[2][1] = bc_get_float_value(outtan, (j * 2 * dim )+ (2 * i) + 1);
- if(curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER)
+ if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER)
bez.ipo = BEZT_IPO_BEZ;
else
bez.ipo = BEZT_IPO_CONST;
@@ -964,25 +964,25 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
if (ef != NULL) { /* can be NULL [#28909] */
const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects();
COLLADAFW::EffectCommon *efc = commonEffects[0];
- if((animType->material & MATERIAL_SHININESS) != 0){
+ if ((animType->material & MATERIAL_SHININESS) != 0){
const COLLADAFW::FloatOrParam *shin = &(efc->getShininess());
const COLLADAFW::UniqueId& listid = shin->getAnimationList();
Assign_float_animations( listid, AnimCurves , "specular_hardness" );
}
- if((animType->material & MATERIAL_IOR) != 0){
+ if ((animType->material & MATERIAL_IOR) != 0){
const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction());
const COLLADAFW::UniqueId& listid = ior->getAnimationList();
Assign_float_animations( listid, AnimCurves , "raytrace_transparency.ior" );
}
- if((animType->material & MATERIAL_SPEC_COLOR) != 0){
+ if ((animType->material & MATERIAL_SPEC_COLOR) != 0){
const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular());
const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList();
Assign_color_animations( listid, AnimCurves , "specular_color" );
}
- if((animType->material & MATERIAL_DIFF_COLOR) != 0){
+ if ((animType->material & MATERIAL_DIFF_COLOR) != 0){
const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse());
const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList();
Assign_color_animations( listid, AnimCurves , "diffuse_color" );
@@ -1185,7 +1185,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]);
if (ef != NULL) { /* can be NULL [#28909] */
const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects();
- if(!commonEffects.empty()) {
+ if (!commonEffects.empty()) {
COLLADAFW::EffectCommon *efc = commonEffects[0];
types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS);
types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR);
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 47d41a9680f..743d3c2a158 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -193,7 +193,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce,
while( i != child_objects.end() )
{
- if((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name)))
+ if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name)))
{
float backup_parinv[4][4];
copy_m4_m4(backup_parinv, (*i)->parentinv);
@@ -210,7 +210,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce,
// TODO: when such objects are animated as
// single matrix the tweak must be applied
// to the result.
- if(export_settings->second_life)
+ if (export_settings->second_life)
{
// tweak objects parentinverse to match compatibility
float temp[4][4];
@@ -274,7 +274,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
}
// SECOND_LIFE_COMPATIBILITY
- if(export_settings->second_life)
+ if (export_settings->second_life)
{
// Remove rotations vs armature from transform
// parent_rest_rot * mat * irest_rot
@@ -285,7 +285,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
mult_m4_m4m4(mat, mat, temp);
- if(bone->parent)
+ if (bone->parent)
{
copy_m4_m4(temp, bone->parent->arm_mat);
temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
@@ -370,18 +370,18 @@ 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);
@@ -502,7 +502,7 @@ 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];
@@ -560,7 +560,7 @@ std::string ArmatureExporter::add_weights_source(Mesh *me, const std::string& co
source.prepareToAppendValues();
- for(std::list<float>::const_iterator i = weights.begin(); i != weights.end(); ++i) {
+ for (std::list<float>::const_iterator i = weights.begin(); i != weights.end(); ++i) {
source.appendValues(*i);
}
@@ -597,7 +597,7 @@ void ArmatureExporter::add_vertex_weights_element(const std::string& weights_sou
// write deformer index - weight index pairs
int weight_index = 0;
- for(std::list<int>::const_iterator i = joints.begin(); i != joints.end(); ++i)
+ for (std::list<int>::const_iterator i = joints.begin(); i != joints.end(); ++i)
{
weightselem.appendValues(*i, weight_index++);
}
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 11a48fd3cfd..50ec2985552 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -278,7 +278,7 @@ 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;
@@ -306,7 +306,7 @@ void ArmatureImporter::fix_leaf_bones( )
float vec[3] = {0.0f, 0.0f, 0.1f};
// if parent: take parent length and direction
- if(leaf.bone->parent) sub_v3_v3v3(vec, leaf.bone->parent->tail, leaf.bone->parent->head);
+ if (leaf.bone->parent) sub_v3_v3v3(vec, leaf.bone->parent->tail, leaf.bone->parent->head);
copy_v3_v3(leaf.bone->tail, leaf.bone->head);
add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
@@ -574,7 +574,7 @@ void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node
{
char * bone_name = (char *) bc_get_joint_name ( root_node);
float mat[4][4];
- float obmat[4][4];
+ float obmat[4][4];
float ax[3];
float angle = 0.0f;
@@ -767,7 +767,7 @@ Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node)
std::map<COLLADAFW::UniqueId, Object*>::iterator arm;
for (arm = unskinned_armature_map.begin(); arm != unskinned_armature_map.end(); arm++) {
- if(arm->first == node->getUniqueId() )
+ if (arm->first == node->getUniqueId() )
return arm->second;
}
return NULL;
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 6e04a1773bb..647a871e5b1 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -130,7 +130,7 @@ extern char build_rev[];
char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n)
{
int layer_index = CustomData_get_layer_index(data, type);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
return data->layers[layer_index+n].name;
}
@@ -139,7 +139,7 @@ char *bc_CustomData_get_active_layer_name(const CustomData *data, int type)
{
/* get the layer index of the active layer of type */
int layer_index = CustomData_get_active_layer_index(data, type);
- if(layer_index < 0) return NULL;
+ if (layer_index < 0) return NULL;
return data->layers[layer_index].name;
}
@@ -178,30 +178,30 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
switch(RNA_property_enum_get(&unit_settings, system)) {
case USER_UNIT_NONE:
case USER_UNIT_METRIC:
- if(linearmeasure == 0.001f) {
+ if (linearmeasure == 0.001f) {
unitname = "millimeter";
}
- else if(linearmeasure == 0.01f) {
+ else if (linearmeasure == 0.01f) {
unitname = "centimeter";
}
- else if(linearmeasure == 0.1f) {
+ else if (linearmeasure == 0.1f) {
unitname = "decimeter";
}
- else if(linearmeasure == 1.0f) {
+ else if (linearmeasure == 1.0f) {
unitname = "meter";
}
- else if(linearmeasure == 1000.0f) {
+ else if (linearmeasure == 1000.0f) {
unitname = "kilometer";
}
break;
case USER_UNIT_IMPERIAL:
- if(linearmeasure == 0.0254f) {
+ if (linearmeasure == 0.0254f) {
unitname = "inch";
}
- else if(linearmeasure == 0.3048f) {
+ else if (linearmeasure == 0.3048f) {
unitname = "foot";
}
- else if(linearmeasure == 0.9144f) {
+ else if (linearmeasure == 0.9144f) {
unitname = "yard";
}
break;
@@ -211,7 +211,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
asset.setUnit(unitname, linearmeasure);
asset.setUpAxisType(COLLADASW::Asset::Z_UP);
- if(U.author[0] != '\0') {
+ if (U.author[0] != '\0') {
asset.getContributor().mAuthor = U.author;
}
else {
@@ -227,13 +227,13 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
asset.add();
// <library_cameras>
- if(has_object_type(sce, OB_CAMERA)) {
+ if (has_object_type(sce, OB_CAMERA)) {
CamerasExporter ce(&sw, this->export_settings);
ce.exportCameras(sce);
}
// <library_lights>
- if(has_object_type(sce, OB_LAMP)) {
+ if (has_object_type(sce, OB_LAMP)) {
LightsExporter le(&sw, this->export_settings);
le.exportLights(sce);
}
@@ -251,7 +251,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
me.exportMaterials(sce);
// <library_geometries>
- if(has_object_type(sce, OB_MESH)) {
+ if (has_object_type(sce, OB_MESH)) {
GeometryExporter ge(&sw, this->export_settings);
ge.exportGeom(sce);
}
@@ -262,7 +262,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
// <library_controllers>
ArmatureExporter arm_exporter(&sw, this->export_settings);
- if(has_object_type(sce, OB_ARMATURE)) {
+ if (has_object_type(sce, OB_ARMATURE)) {
arm_exporter.export_controllers(sce);
}
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 90c74d8b226..9e604978f64 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -121,10 +121,12 @@ bool DocumentImporter::import()
loader.registerExtraDataCallbackHandler(ehandler);
- if (!root.loadDocument(mFilename))
+ if (!root.loadDocument(mFilename)) {
+ fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 1st pass\n");
return false;
+ }
- if(errorHandler.hasError())
+ if (errorHandler.hasError())
return false;
/** TODO set up scene graph and such here */
@@ -134,8 +136,10 @@ bool DocumentImporter::import()
COLLADASaxFWL::Loader loader2;
COLLADAFW::Root root2(&loader2, this);
- if (!root2.loadDocument(mFilename))
+ if (!root2.loadDocument(mFilename)) {
+ fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 2nd pass\n");
return false;
+ }
delete ehandler;
@@ -157,7 +161,7 @@ void DocumentImporter::start(){}
void DocumentImporter::finish()
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return;
/** TODO Break up and put into 2-pass parsing of DAE */
@@ -235,7 +239,15 @@ void DocumentImporter::finish()
void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW::Node *par = NULL, Object *parob = NULL)
{
- if (par && par->getType() == COLLADAFW::Node::JOINT) {
+
+ // The split in #29246, rootmap must point at actual root when
+ // calculating bones in apply_curves_as_matrix.
+ // This has to do with inverse bind poses being world space
+ // (the sources for skinned bones' restposes) and the way
+ // non-skinning nodes have their "restpose" recursively calculated.
+ // XXX TODO: design issue, how to support unrelated joints taking
+ // part in skinning.
+ if (par) { // && par->getType() == COLLADAFW::Node::JOINT) {
// par is root if there's no corresp. key in root_map
if (root_map.find(par->getUniqueId()) == root_map.end())
root_map[node->getUniqueId()] = par;
@@ -313,8 +325,10 @@ Object* DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Sce
return ob;
}
-Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Node *source_node, COLLADAFW::Node *instance_node, Scene *sce, Object *par_ob, bool is_library_node)
+Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Node *source_node, COLLADAFW::Node *instance_node, Scene *sce, bool is_library_node)
{
+ fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL);
+
Object *obn = copy_object(source_ob);
obn->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
scene_add_base(sce, obn);
@@ -325,7 +339,7 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
// transformation matrix and apply it to the newly instantiated
// object to account for node hierarchy transforms in
// .dae
- if(source_node) {
+ if (source_node) {
COLLADABU::Math::Matrix4 mat4 = source_node->getTransformationMatrix();
COLLADABU::Math::Matrix4 bmat4 = mat4.transpose(); // transpose to get blender row-major order
float mat[4][4];
@@ -357,10 +371,10 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
Object *new_child = NULL;
if (inodes.getCount()) { // \todo loop through instance nodes
const COLLADAFW::UniqueId& id = inodes[0]->getInstanciatedObjectId();
- new_child = create_instance_node(object_map[id], node_map[id], child_node, sce, NULL, is_library_node);
+ new_child = create_instance_node(object_map[id], node_map[id], child_node, sce, is_library_node);
}
else {
- new_child = create_instance_node(object_map[child_id], child_node, NULL, sce, NULL, is_library_node);
+ new_child = create_instance_node(object_map[child_id], child_node, NULL, sce, is_library_node);
}
bc_set_parent(new_child, obn, mContext, true);
@@ -369,21 +383,14 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
}
}
- // when we have an instance_node, don't return the object, because otherwise
- // its correct location gets overwritten in write_node(). Fixes bug #26012.
- if(instance_node) {
- if (par_ob && obn)
- bc_set_parent(obn, par_ob, mContext);
- return NULL;
- }
-
- else return obn;
+ return obn;
}
void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *parent_node, Scene *sce, Object *par, bool is_library_node)
{
Object *ob = NULL;
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
+ bool read_transform = true;
if (is_joint) {
if ( par ) {
@@ -432,16 +439,18 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
while (inst_done < inst_node.getCount()) {
const COLLADAFW::UniqueId& node_id = inst_node[inst_done]->getInstanciatedObjectId();
if (object_map.find(node_id) == object_map.end()) {
- fprintf(stderr, "Cannot find node to instanciate.\n");
+ fprintf(stderr, "Cannot find object for node referenced by <instance_node name=\"%s\">.\n", inst_node[inst_done]->getName().c_str());
ob = NULL;
}
else {
Object *source_ob = object_map[node_id];
COLLADAFW::Node *source_node = node_map[node_id];
- ob = create_instance_node(source_ob, source_node, node, sce, par, is_library_node);
+ ob = create_instance_node(source_ob, source_node, node, sce, is_library_node);
}
++inst_done;
+
+ read_transform = false;
}
// if node is empty - create empty object
// XXX empty node may not mean it is empty object, not sure about this
@@ -449,7 +458,8 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
ob = add_object(sce, OB_EMPTY);
}
- // check if object is not NULL
+ // XXX: if there're multiple instances, only one is stored
+
if (!ob) return;
std::string nodename = node->getName().size() ? node->getName() : node->getOriginalId();
@@ -462,7 +472,8 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
libnode_ob.push_back(ob);
}
- anim_importer.read_node_transform(node, ob); // overwrites location set earlier
+ if (read_transform)
+ anim_importer.read_node_transform(node, ob); // overwrites location set earlier
if (!is_joint) {
// if par was given make this object child of the previous
@@ -481,7 +492,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
\return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualScene )
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return true;
// this method called on post process after writeGeometry, writeMaterial, etc.
@@ -504,7 +515,7 @@ bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualSc
\return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes )
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return true;
Scene *sce = CTX_data_scene(mContext);
@@ -522,7 +533,7 @@ bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* librar
\return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeGeometry ( const COLLADAFW::Geometry* geom )
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return true;
return mesh_importer.write_geometry(geom);
@@ -532,7 +543,7 @@ bool DocumentImporter::writeGeometry ( const COLLADAFW::Geometry* geom )
\return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeMaterial( const COLLADAFW::Material* cmat )
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return true;
const std::string& str_mat_id = cmat->getName().size() ? cmat->getName() : cmat->getOriginalId();
@@ -688,10 +699,10 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
}
}
- if(ef->getOpacity().isTexture()) {
+ if (ef->getOpacity().isTexture()) {
COLLADAFW::Texture ctex = ef->getOpacity().getTexture();
mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map);
- if(mtex != NULL) {
+ if (mtex != NULL) {
mtex->mapto = MAP_ALPHA;
mtex->tex->imaflag |= TEX_USEALPHA;
i++;
@@ -721,7 +732,7 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect )
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return true;
const COLLADAFW::UniqueId& uid = effect->getUniqueId();
@@ -733,7 +744,7 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect )
Material *ma = uid_effect_map[uid];
std::map<COLLADAFW::UniqueId, Material*>::iterator iter;
- for(iter = uid_material_map.begin(); iter != uid_material_map.end() ; iter++ )
+ for (iter = uid_material_map.begin(); iter != uid_material_map.end() ; iter++ )
{
if ( iter->second == ma ) {
this->FW_object_map[iter->first] = effect;
@@ -759,7 +770,7 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect )
\return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return true;
Camera *cam = NULL;
@@ -875,7 +886,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
\return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeImage( const COLLADAFW::Image* image )
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return true;
// XXX maybe it is necessary to check if the path is absolute or relative
@@ -900,7 +911,7 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image )
\return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return true;
Lamp *lamp = NULL;
@@ -909,7 +920,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
TagsMap::iterator etit;
ExtraTags *et = 0;
etit = uid_tags_map.find(light->getUniqueId().toAscii());
- if(etit != uid_tags_map.end())
+ if (etit != uid_tags_map.end())
et = etit->second;
la_id = light->getOriginalId();
@@ -923,7 +934,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
}
// if we find an ExtraTags for this, use that instead.
- if(et && et->isProfile("blender")) {
+ if (et && et->isProfile("blender")) {
et->setData("type", &(lamp->type));
et->setData("flag", &(lamp->flag));
et->setData("mode", &(lamp->mode));
@@ -996,17 +1007,19 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
lamp->b = col.getBlue();
}
- if(IS_EQ(linatt, 0.0f) && quadatt > 0.0f) {
+ if (IS_EQ(linatt, 0.0f) && quadatt > 0.0f) {
att2 = quadatt;
d = sqrt(1.0f/quadatt);
}
// linear light
- else if(IS_EQ(quadatt, 0.0f) && linatt > 0.0f) {
+ else if (IS_EQ(quadatt, 0.0f) && linatt > 0.0f) {
att1 = linatt;
d = (1.0f/linatt);
- } else if (IS_EQ(constatt, 1.0f)) {
+ }
+ else if (IS_EQ(constatt, 1.0f)) {
att1 = 1.0f;
- } else {
+ }
+ else {
// assuming point light (const att = 1.0);
att1 = 1.0f;
}
@@ -1028,9 +1041,9 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
lamp->type = LA_SPOT;
lamp->att1 = att1;
lamp->att2 = att2;
- if(IS_EQ(att1, 0.0f) && att2 > 0)
+ if (IS_EQ(att1, 0.0f) && att2 > 0)
lamp->falloff_type = LA_FALLOFF_INVSQUARE;
- if(IS_EQ(att2, 0.0f) && att1 > 0)
+ if (IS_EQ(att2, 0.0f) && att1 > 0)
lamp->falloff_type = LA_FALLOFF_INVLINEAR;
lamp->spotsize = light->getFallOffAngle().getValue();
lamp->spotblend = light->getFallOffExponent().getValue();
@@ -1048,9 +1061,9 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
lamp->type = LA_LOCAL;
lamp->att1 = att1;
lamp->att2 = att2;
- if(IS_EQ(att1, 0.0f) && att2 > 0)
+ if (IS_EQ(att1, 0.0f) && att2 > 0)
lamp->falloff_type = LA_FALLOFF_INVSQUARE;
- if(IS_EQ(att2, 0.0f) && att1 > 0)
+ if (IS_EQ(att2, 0.0f) && att1 > 0)
lamp->falloff_type = LA_FALLOFF_INVLINEAR;
}
break;
@@ -1071,7 +1084,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
// this function is called only for animations that pass COLLADAFW::validate
bool DocumentImporter::writeAnimation( const COLLADAFW::Animation* anim )
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return true;
// return true;
@@ -1081,7 +1094,7 @@ bool DocumentImporter::writeAnimation( const COLLADAFW::Animation* anim )
// called on post-process stage after writeVisualScenes
bool DocumentImporter::writeAnimationList( const COLLADAFW::AnimationList* animationList )
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return true;
// return true;
@@ -1098,7 +1111,7 @@ bool DocumentImporter::writeSkinControllerData( const COLLADAFW::SkinControllerD
// this is called on postprocess, before writeVisualScenes
bool DocumentImporter::writeController( const COLLADAFW::Controller* controller )
{
- if(mImportStage!=General)
+ if (mImportStage!=General)
return true;
return armature_importer.write_controller(controller);
@@ -1116,7 +1129,7 @@ bool DocumentImporter::writeKinematicsScene( const COLLADAFW::KinematicsScene* k
ExtraTags* DocumentImporter::getExtraTags(const COLLADAFW::UniqueId &uid)
{
- if(uid_tags_map.find(uid.toAscii())==uid_tags_map.end()) {
+ if (uid_tags_map.find(uid.toAscii())==uid_tags_map.end()) {
return NULL;
}
return uid_tags_map[uid.toAscii()];
diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h
index 179461ba59d..606218b644d 100644
--- a/source/blender/collada/DocumentImporter.h
+++ b/source/blender/collada/DocumentImporter.h
@@ -72,7 +72,7 @@ public:
/** these should not be here */
Object* create_camera_object(COLLADAFW::InstanceCamera*, Scene*);
Object* create_lamp_object(COLLADAFW::InstanceLight*, Scene*);
- Object* create_instance_node(Object*, COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
+ Object* create_instance_node(Object*, COLLADAFW::Node*, COLLADAFW::Node*, Scene*, bool);
void write_node(COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
MTex* create_texture(COLLADAFW::EffectCommon*, COLLADAFW::Texture&, Material*, int, TexIndexTextureArrayMap&);
void write_profile_COMMON(COLLADAFW::EffectCommon*, Material*);
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index 7ada149cde9..dd20e7b85b0 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -63,7 +63,7 @@ bool EffectsExporter::hasEffects(Scene *sce)
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);
@@ -79,7 +79,7 @@ bool EffectsExporter::hasEffects(Scene *sce)
void EffectsExporter::exportEffects(Scene *sce)
{
- if(hasEffects(sce)) {
+ if (hasEffects(sce)) {
this->scene = sce;
openLibrary();
MaterialFunctor mf;
@@ -129,7 +129,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
ep.setProfileType(COLLADASW::EffectProfile::COMMON);
ep.openProfile();
// set shader type - one of three blinn, phong or lambert
- if(ma->spec>0.0f) {
+ if (ma->spec>0.0f) {
if (ma->spec_shader == MA_SPEC_BLINN) {
writeBlinn(ep, ma);
}
@@ -138,8 +138,9 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// for now set phong in case spec shader is not blinn
writePhong(ep, ma);
}
- } else {
- if(ma->diff_shader == MA_DIFF_LAMBERT) {
+ }
+ else {
+ if (ma->diff_shader == MA_DIFF_LAMBERT) {
writeLambert(ep, ma);
}
else {
@@ -176,7 +177,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// ambient
/* ma->ambX is calculated only on render, so lets do it here manually and not rely on ma->ambX. */
- if(this->scene->world)
+ if (this->scene->world)
cot = getcol(this->scene->world->ambr*ma->amb, this->scene->world->ambg*ma->amb, this->scene->world->ambb*ma->amb, 1.0f);
else
cot = getcol(ma->amb, ma->amb, ma->amb, 1.0f);
@@ -219,7 +220,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
Image *ima = t->tex->ima;
// Image not set for texture
- if(!ima) continue;
+ if (!ima) continue;
std::string key(id_name(ima));
key = translate_id(key);
@@ -265,7 +266,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
Image *ima = t->tex->ima;
// Image not set for texture
- if(!ima) continue;
+ if (!ima) continue;
// we assume map input is always TEXCO_UV
diff --git a/source/blender/collada/ErrorHandler.cpp b/source/blender/collada/ErrorHandler.cpp
index 9ed8034a9a0..1c0f40d2185 100644
--- a/source/blender/collada/ErrorHandler.cpp
+++ b/source/blender/collada/ErrorHandler.cpp
@@ -83,5 +83,9 @@ bool ErrorHandler::handleError( const COLLADASaxFWL::IError* error )
COLLADASaxFWL::SaxFWLError* saxFWLError = (COLLADASaxFWL::SaxFWLError*) error;
std::cout << "Sax FWL Error: " << saxFWLError->getErrorMessage() << std::endl;
}
+ else {
+ std::cout << "opencollada error: " << error->getFullErrorMessage() << std::endl;
+ }
+
return false;
}
diff --git a/source/blender/collada/ExtraHandler.cpp b/source/blender/collada/ExtraHandler.cpp
index d6d3aa87cfd..6606fe1a27b 100644
--- a/source/blender/collada/ExtraHandler.cpp
+++ b/source/blender/collada/ExtraHandler.cpp
@@ -54,7 +54,7 @@ bool ExtraHandler::textData(const char* text, size_t textLength)
{
char buf[1024];
- if(currentElement.length() == 0 || currentExtraTags == 0) return false;
+ if (currentElement.length() == 0 || currentExtraTags == 0) return false;
BLI_snprintf(buf, textLength+1, "%s", text);
currentExtraTags->addTag(currentElement, std::string(buf));
@@ -65,11 +65,11 @@ bool ExtraHandler::parseElement (
const char* profileName,
const unsigned long& elementHash,
const COLLADAFW::UniqueId& uniqueId ) {
- if(BLI_strcaseeq(profileName, "blender")) {
+ if (BLI_strcaseeq(profileName, "blender")) {
//printf("In parseElement for supported profile %s for id %s\n", profileName, uniqueId.toAscii().c_str());
currentUid = uniqueId;
ExtraTags *et = dimp->getExtraTags(uniqueId);
- if(!et) {
+ if (!et) {
et = new ExtraTags(std::string(profileName));
dimp->addExtraTags(uniqueId, et);
}
diff --git a/source/blender/collada/ExtraTags.cpp b/source/blender/collada/ExtraTags.cpp
index b1b1936e254..c5a126894cb 100644
--- a/source/blender/collada/ExtraTags.cpp
+++ b/source/blender/collada/ExtraTags.cpp
@@ -56,7 +56,7 @@ bool ExtraTags::addTag( std::string tag, std::string data)
int ExtraTags::asInt( std::string tag, bool *ok)
{
- if(tags.find(tag) == tags.end()) {
+ if (tags.find(tag) == tags.end()) {
*ok = false;
return -1;
}
@@ -66,7 +66,7 @@ int ExtraTags::asInt( std::string tag, bool *ok)
float ExtraTags::asFloat( std::string tag, bool *ok)
{
- if(tags.find(tag) == tags.end()) {
+ if (tags.find(tag) == tags.end()) {
*ok = false;
return -1.0f;
}
@@ -76,7 +76,7 @@ float ExtraTags::asFloat( std::string tag, bool *ok)
std::string ExtraTags::asString( std::string tag, bool *ok)
{
- if(tags.find(tag) == tags.end()) {
+ if (tags.find(tag) == tags.end()) {
*ok = false;
return "";
}
@@ -89,28 +89,28 @@ void ExtraTags::setData(std::string tag, short *data)
{
bool ok = false;
int tmp = asInt(tag, &ok);
- if(ok)
+ if (ok)
*data = (short)tmp;
}
void ExtraTags::setData(std::string tag, int *data)
{
bool ok = false;
int tmp = asInt(tag, &ok);
- if(ok)
+ if (ok)
*data = tmp;
}
void ExtraTags::setData(std::string tag, float *data)
{
bool ok = false;
float tmp = asFloat(tag, &ok);
- if(ok)
+ if (ok)
*data = tmp;
}
void ExtraTags::setData(std::string tag, char *data)
{
bool ok = false;
int tmp = asInt(tag, &ok);
- if(ok)
+ if (ok)
*data = (char)tmp;
}
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 2af1df90f51..ca112abc0af 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -109,7 +109,7 @@ void GeometryExporter::operator()(Object *ob)
// XXX slow
if (ob->totcol) {
- for(int a = 0; a < ob->totcol; a++) {
+ for (int a = 0; a < ob->totcol; a++) {
createPolylist(a, has_uvs, has_color, ob, geom_id, norind);
}
}
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index 3926cb48253..3775a63c71d 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -51,7 +51,7 @@ bool ImagesExporter::hasImages(Scene *sce)
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);
@@ -71,7 +71,7 @@ bool ImagesExporter::hasImages(Scene *sce)
void ImagesExporter::exportImages(Scene *sce)
{
- if(hasImages(sce)) {
+ if (hasImages(sce)) {
openLibrary();
MaterialFunctor mf;
mf.forEachMaterialInScene<ImagesExporter>(sce, *this, this->export_settings->selected);
diff --git a/source/blender/collada/InstanceWriter.cpp b/source/blender/collada/InstanceWriter.cpp
index 40ca1bc3b0e..a605bdeefcc 100644
--- a/source/blender/collada/InstanceWriter.cpp
+++ b/source/blender/collada/InstanceWriter.cpp
@@ -43,7 +43,7 @@
void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob)
{
- for(int a = 0; a < ob->totcol; a++) {
+ for (int a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a+1);
COLLADASW::InstanceMaterialList& iml = bind_material.getInstanceMaterialList();
diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp
index d74a1d1033d..51242b36b64 100644
--- a/source/blender/collada/LightExporter.cpp
+++ b/source/blender/collada/LightExporter.cpp
@@ -73,7 +73,7 @@ void LightsExporter::operator()(Object *ob)
constatt = 1.0f;
- if(la->falloff_type==LA_FALLOFF_INVLINEAR) {
+ if (la->falloff_type==LA_FALLOFF_INVLINEAR) {
linatt = 1.0f / d;
quadatt = 0.0f;
}
diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp
index b66779953ef..1e3358c9216 100644
--- a/source/blender/collada/MaterialExporter.cpp
+++ b/source/blender/collada/MaterialExporter.cpp
@@ -35,7 +35,7 @@ MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw, const ExportSe
void MaterialsExporter::exportMaterials(Scene *sce)
{
- if(hasMaterials(sce)) {
+ if (hasMaterials(sce)) {
openLibrary();
MaterialFunctor mf;
@@ -53,7 +53,7 @@ bool MaterialsExporter::hasMaterials(Scene *sce)
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);
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index 10fae7e2c1b..e50005634ba 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -145,7 +145,7 @@ void WVDataWrapper::print()
void UVDataWrapper::getUV(int uv_index, float *uv)
{
int stride = mVData->getStride(0);
- if(stride==0) stride = 2;
+ if (stride==0) stride = 2;
switch(mVData->getType()) {
case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
@@ -281,7 +281,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has sup
COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp;
COLLADAFW::Polygons::VertexCountArray& vca = mpvc->getGroupedVerticesVertexCountArray();
- for(unsigned int j = 0; j < vca.getCount(); j++){
+ for (unsigned int j = 0; j < vca.getCount(); j++){
int count = vca[j];
if (count < 3) {
fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n",
@@ -291,7 +291,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has sup
}
}
- else if(type != COLLADAFW::MeshPrimitive::TRIANGLES && type!= COLLADAFW::MeshPrimitive::TRIANGLE_FANS) {
+ else if (type != COLLADAFW::MeshPrimitive::TRIANGLES && type!= COLLADAFW::MeshPrimitive::TRIANGLE_FANS) {
fprintf(stderr, "Primitive type %s is not supported.\n", type_str);
return false;
}
@@ -310,7 +310,7 @@ void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me)
// vertices
COLLADAFW::MeshVertexData& pos = mesh->getPositions();
int stride = pos.getStride(0);
- if(stride==0) stride = 3;
+ if (stride==0) stride = 3;
me->totvert = mesh->getPositions().getFloatValues()->getCount() / stride;
me->mvert = (MVert*)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert);
@@ -742,12 +742,12 @@ MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBindi
size_t setindex = ctexture.getSetIndex();
std::string uvname = ctexture.getSemantic();
- if(setindex==-1) return NULL;
+ if (setindex==-1) return NULL;
const CustomData *data = &me->fdata;
int layer_index = CustomData_get_layer_index(data, CD_MTFACE);
- if(layer_index == -1) return NULL;
+ if (layer_index == -1) return NULL;
CustomDataLayer *cdl = &data->layers[layer_index+setindex];
@@ -798,7 +798,7 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
std::multimap<COLLADAFW::UniqueId, COLLADAFW::UniqueId>::iterator it;
it=materials_mapped_to_geom.find(*geom_uid);
while(it!=materials_mapped_to_geom.end()) {
- if(it->second == ma_uid && it->first == *geom_uid) return NULL; // do nothing if already found
+ if (it->second == ma_uid && it->first == *geom_uid) return NULL; // do nothing if already found
it++;
}
// first time we get geom_uid, ma_uid pair. Save for later check.
@@ -913,11 +913,12 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
// loop through geom's materials
for (unsigned int i = 0; i < mat_array.getCount(); i++) {
- if(mat_array[i].getReferencedMaterial().isValid()) {
+ if (mat_array[i].getReferencedMaterial().isValid()) {
texture_face = assign_material_to_geom(mat_array[i], uid_material_map, ob, geom_uid,
&color_texture, layername, texture_face,
material_texture_mapping_map, i);
- } else {
+ }
+ else {
fprintf(stderr, "invalid referenced material for %s\n", mat_array[i].getName().c_str());
}
}
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index b6be8a57f7a..9010fd5062a 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -47,7 +47,7 @@ void SceneExporter::exportHierarchy(Scene *sce)
Object *ob = base->object;
if (!ob->parent) {
- if(sce->lay & ob->lay) {
+ if (sce->lay & ob->lay) {
switch(ob->type) {
case OB_MESH:
case OB_CAMERA:
@@ -144,17 +144,17 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
// empty object
else if (ob->type == OB_EMPTY) { // TODO: handle groups (OB_DUPLIGROUP
- if((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) {
+ if ((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) {
GroupObject *go = NULL;
Group *gr = ob->dup_group;
/* printf("group detected '%s'\n", gr->id.name+2); */
- for(go = (GroupObject*)(gr->gobject.first); go; go=go->next) {
+ for (go = (GroupObject*)(gr->gobject.first); go; go=go->next) {
printf("\t%s\n", go->ob->id.name);
}
}
}
- 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/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp
index 10a965308b1..f441833233c 100644
--- a/source/blender/collada/TransformWriter.cpp
+++ b/source/blender/collada/TransformWriter.cpp
@@ -95,18 +95,18 @@ 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;
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index 39114f6543b..70bf0556b5b 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -44,7 +44,7 @@ extern "C"
int collada_import(bContext *C, const char *filepath)
{
DocumentImporter imp (C, filepath);
- if(imp.import()) return 1;
+ if (imp.import()) return 1;
return 0;
}
@@ -58,9 +58,9 @@ extern "C"
export_settings.filepath = (char *)filepath;
/* annoying, collada crashes if file cant be created! [#27162] */
- if(!BLI_exists(filepath)) {
+ if (!BLI_exists(filepath)) {
BLI_make_existing_file(filepath); /* makes the dir if its not there */
- if(BLI_file_touch(filepath) == 0) {
+ if (BLI_file_touch(filepath) == 0) {
return 0;
}
}
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index d7263e07eb8..fc4093bd795 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -206,7 +206,7 @@ std::string translate_id(const std::string &id)
{
id_translated[i] = translate_name_map[(unsigned int)id_translated[i]];
}
- // It's so much workload now, the if() should speed up things.
+ // It's so much workload now, the if () should speed up things.
if (id_translated != id)
{
// Search duplicates
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index c3aa73510d1..4aed29defbc 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -61,8 +61,8 @@ int bc_test_parent_loop(Object *par, Object *ob)
{
/* test if 'ob' is a parent somewhere in par's parents */
- if(par == NULL) return 0;
- if(ob == par) return 1;
+ if (par == NULL) return 0;
+ if (ob == par) return 1;
return bc_test_parent_loop(par->parent, ob);
}
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt
index 2549358f285..9e1e44e411d 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -54,4 +54,8 @@ set(SRC
anim_intern.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/animation/SConscript b/source/blender/editors/animation/SConscript
index 120000fedc4..658ad2794a1 100644
--- a/source/blender/editors/animation/SConscript
+++ b/source/blender/editors/animation/SConscript
@@ -6,4 +6,9 @@ sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf ../../blenfont'
incs += ' ../../bmesh ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../blenloader'
-env.BlenderLib ( 'bf_editors_animation', sources, Split(incs), [], libtype=['core'], priority=[125] )
+defs = []
+
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_animation', sources, Split(incs), defs, libtype=['core'], priority=[125] )
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index bdeea9402ba..29d5604089d 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -88,12 +88,9 @@
#define ANIM_CHAN_NAME_SIZE 256
/* macros used for type defines */
- /* get the pointer used for some flag */
-#define GET_ACF_FLAG_PTR(ptr) \
- { \
- *type= sizeof((ptr)); \
- return &(ptr); \
- }
+
+/* get the pointer used for some flag and return */
+#define GET_ACF_FLAG_PTR(ptr, type) ((*(type) = sizeof((ptr))), &(ptr))
/* *********************************************** */
@@ -454,7 +451,7 @@ static void *acf_summary_setting_ptr(bAnimListElem *ale, int setting, short *typ
bDopeSheet *ads= &saction->ads;
/* return pointer to DopeSheet's flag */
- GET_ACF_FLAG_PTR(ads->flag);
+ return GET_ACF_FLAG_PTR(ads->flag, type);
}
else {
/* can't return anything useful - unsupported */
@@ -548,15 +545,15 @@ static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type)
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
- GET_ACF_FLAG_PTR(scene->flag);
+ return GET_ACF_FLAG_PTR(scene->flag, type);
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(scene->flag);
+ return GET_ACF_FLAG_PTR(scene->flag, type);
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (scene->adt)
- GET_ACF_FLAG_PTR(scene->adt->flag)
+ return GET_ACF_FLAG_PTR(scene->adt->flag, type);
else
return NULL;
@@ -695,15 +692,15 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
- GET_ACF_FLAG_PTR(ob->flag);
+ return GET_ACF_FLAG_PTR(ob->flag, type);
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(ob->nlaflag); // xxx
+ return GET_ACF_FLAG_PTR(ob->nlaflag, type); // xxx
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (ob->adt)
- GET_ACF_FLAG_PTR(ob->adt->flag)
+ return GET_ACF_FLAG_PTR(ob->adt->flag, type);
else
return NULL;
@@ -836,7 +833,7 @@ static void *acf_group_setting_ptr(bAnimListElem *ale, int UNUSED(setting), shor
bActionGroup *agrp= (bActionGroup *)ale->data;
/* all flags are just in agrp->flag for now... */
- GET_ACF_FLAG_PTR(agrp->flag);
+ return GET_ACF_FLAG_PTR(agrp->flag, type);
}
/* group type define */
@@ -923,7 +920,7 @@ static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int UNUSED(setting), sho
FCurve *fcu= (FCurve *)ale->data;
/* all flags are just in agrp->flag for now... */
- GET_ACF_FLAG_PTR(fcu->flag);
+ return GET_ACF_FLAG_PTR(fcu->flag, type);
}
/* fcurve type define */
@@ -998,13 +995,13 @@ static void *acf_fillactd_setting_ptr(bAnimListElem *ale, int setting, short *ty
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
if (adt) {
- GET_ACF_FLAG_PTR(adt->flag);
+ return GET_ACF_FLAG_PTR(adt->flag, type);
}
else
return NULL;
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(act->flag);
+ return GET_ACF_FLAG_PTR(act->flag, type);
default: /* unsupported */
return NULL;
@@ -1083,7 +1080,7 @@ static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, int setting, short
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(adt->flag);
+ return GET_ACF_FLAG_PTR(adt->flag, type);
default: /* unsupported */
return NULL;
@@ -1153,13 +1150,13 @@ static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type)
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(ma->flag);
+ return GET_ACF_FLAG_PTR(ma->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (ma->adt)
- GET_ACF_FLAG_PTR(ma->adt->flag)
+ return GET_ACF_FLAG_PTR(ma->adt->flag, type);
else
return NULL;
@@ -1230,13 +1227,13 @@ static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type)
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(la->flag);
+ return GET_ACF_FLAG_PTR(la->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (la->adt)
- GET_ACF_FLAG_PTR(la->adt->flag)
+ return GET_ACF_FLAG_PTR(la->adt->flag, type);
else
return NULL;
@@ -1314,13 +1311,13 @@ static void *acf_dstex_setting_ptr(bAnimListElem *ale, int setting, short *type)
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(tex->flag);
+ return GET_ACF_FLAG_PTR(tex->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (tex->adt)
- GET_ACF_FLAG_PTR(tex->adt->flag)
+ return GET_ACF_FLAG_PTR(tex->adt->flag, type);
else
return NULL;
@@ -1391,13 +1388,13 @@ static void *acf_dscam_setting_ptr(bAnimListElem *ale, int setting, short *type)
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(ca->flag);
+ return GET_ACF_FLAG_PTR(ca->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (ca->adt)
- GET_ACF_FLAG_PTR(ca->adt->flag)
+ return GET_ACF_FLAG_PTR(ca->adt->flag, type);
else
return NULL;
@@ -1478,13 +1475,13 @@ static void *acf_dscur_setting_ptr(bAnimListElem *ale, int setting, short *type)
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(cu->flag);
+ return GET_ACF_FLAG_PTR(cu->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (cu->adt)
- GET_ACF_FLAG_PTR(cu->adt->flag)
+ return GET_ACF_FLAG_PTR(cu->adt->flag, type);
else
return NULL;
@@ -1555,13 +1552,13 @@ static void *acf_dsskey_setting_ptr(bAnimListElem *ale, int setting, short *type
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(key->flag);
+ return GET_ACF_FLAG_PTR(key->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (key->adt)
- GET_ACF_FLAG_PTR(key->adt->flag)
+ return GET_ACF_FLAG_PTR(key->adt->flag, type);
else
return NULL;
@@ -1632,13 +1629,13 @@ static void *acf_dswor_setting_ptr(bAnimListElem *ale, int setting, short *type)
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(wo->flag);
+ return GET_ACF_FLAG_PTR(wo->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (wo->adt)
- GET_ACF_FLAG_PTR(wo->adt->flag)
+ return GET_ACF_FLAG_PTR(wo->adt->flag, type);
else
return NULL;
@@ -1709,13 +1706,13 @@ static void *acf_dspart_setting_ptr(bAnimListElem *ale, int setting, short *type
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(part->flag);
+ return GET_ACF_FLAG_PTR(part->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (part->adt)
- GET_ACF_FLAG_PTR(part->adt->flag)
+ return GET_ACF_FLAG_PTR(part->adt->flag, type);
else
return NULL;
@@ -1786,13 +1783,13 @@ static void *acf_dsmball_setting_ptr(bAnimListElem *ale, int setting, short *typ
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(mb->flag);
+ return GET_ACF_FLAG_PTR(mb->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (mb->adt)
- GET_ACF_FLAG_PTR(mb->adt->flag)
+ return GET_ACF_FLAG_PTR(mb->adt->flag, type);
else
return NULL;
@@ -1863,13 +1860,13 @@ static void *acf_dsarm_setting_ptr(bAnimListElem *ale, int setting, short *type)
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(arm->flag);
+ return GET_ACF_FLAG_PTR(arm->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (arm->adt)
- GET_ACF_FLAG_PTR(arm->adt->flag)
+ return GET_ACF_FLAG_PTR(arm->adt->flag, type);
else
return NULL;
@@ -1951,13 +1948,13 @@ static void *acf_dsntree_setting_ptr(bAnimListElem *ale, int setting, short *typ
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(ntree->flag);
+ return GET_ACF_FLAG_PTR(ntree->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (ntree->adt)
- GET_ACF_FLAG_PTR(ntree->adt->flag)
+ return GET_ACF_FLAG_PTR(ntree->adt->flag, type);
else
return NULL;
@@ -2028,13 +2025,13 @@ static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, int setting, short
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(linestyle->flag);
+ return GET_ACF_FLAG_PTR(linestyle->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (linestyle->adt)
- GET_ACF_FLAG_PTR(linestyle->adt->flag)
+ return GET_ACF_FLAG_PTR(linestyle->adt->flag, type);
else
return NULL;
@@ -2105,13 +2102,13 @@ static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, int setting, short *type
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(me->flag);
+ return GET_ACF_FLAG_PTR(me->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (me->adt)
- GET_ACF_FLAG_PTR(me->adt->flag)
+ return GET_ACF_FLAG_PTR(me->adt->flag, type);
else
return NULL;
@@ -2182,13 +2179,13 @@ static void *acf_dslat_setting_ptr(bAnimListElem *ale, int setting, short *type)
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(lt->flag);
+ return GET_ACF_FLAG_PTR(lt->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (lt->adt)
- GET_ACF_FLAG_PTR(lt->adt->flag)
+ return GET_ACF_FLAG_PTR(lt->adt->flag, type);
else
return NULL;
@@ -2259,13 +2256,13 @@ static void *acf_dsspk_setting_ptr(bAnimListElem *ale, int setting, short *type)
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(spk->flag);
+ return GET_ACF_FLAG_PTR(spk->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (spk->adt)
- GET_ACF_FLAG_PTR(spk->adt->flag)
+ return GET_ACF_FLAG_PTR(spk->adt->flag, type);
else
return NULL;
@@ -2374,7 +2371,7 @@ static void *acf_shapekey_setting_ptr(bAnimListElem *ale, int setting, short *ty
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted */
case ACHANNEL_SETTING_PROTECT: /* protected */
- GET_ACF_FLAG_PTR(kb->flag)
+ return GET_ACF_FLAG_PTR(kb->flag, type);
default: /* unsupported */
return NULL;
@@ -2453,7 +2450,7 @@ static void *acf_gpd_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short
bGPdata *gpd= (bGPdata *)ale->data;
/* all flags are just in gpd->flag for now... */
- GET_ACF_FLAG_PTR(gpd->flag);
+ return GET_ACF_FLAG_PTR(gpd->flag, type);
}
/* gpencil datablock type define */
@@ -2542,7 +2539,7 @@ static void *acf_gpl_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short
bGPDlayer *gpl= (bGPDlayer *)ale->data;
/* all flags are just in agrp->flag for now... */
- GET_ACF_FLAG_PTR(gpl->flag);
+ return GET_ACF_FLAG_PTR(gpl->flag, type);
}
/* grease pencil layer type define */
@@ -3197,17 +3194,17 @@ static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChan
if (ptr && flag) {
switch (ptrsize) {
case sizeof(int): /* integer pointer for setting */
- but= uiDefIconButBitI(block, butType, flag, 0, icon,
+ but = uiDefIconButBitI(block, butType, flag, 0, icon,
xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
break;
case sizeof(short): /* short pointer for setting */
- but= uiDefIconButBitS(block, butType, flag, 0, icon,
+ but = uiDefIconButBitS(block, butType, flag, 0, icon,
xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
break;
case sizeof(char): /* char pointer for setting */
- but= uiDefIconButBitC(block, butType, flag, 0, icon,
+ but = uiDefIconButBitC(block, butType, flag, 0, icon,
xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
break;
}
@@ -3402,7 +3399,7 @@ void ANIM_channel_draw_widgets (bContext *C, bAnimContext *ac, bAnimListElem *al
uiBut *but;
/* create the slider button, and assign relevant callback to ensure keyframes are inserted... */
- but= uiDefAutoButR(block, &ptr, prop, array_index, "", ICON_NONE, (int)v2d->cur.xmax-offset, ymid, SLIDER_WIDTH, (int)ymaxc-yminc);
+ but = uiDefAutoButR(block, &ptr, prop, array_index, "", ICON_NONE, (int)v2d->cur.xmax-offset, ymid, SLIDER_WIDTH, (int)ymaxc-yminc);
/* assign keyframing function according to slider type */
if (ale->type == ANIMTYPE_SHAPEKEY)
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 83755cbcce3..1a2400d7216 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -1108,19 +1108,19 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
static void ANIM_OT_channels_move (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Channels";
- ot->idname= "ANIM_OT_channels_move";
+ ot->name = "Move Channels";
+ ot->idname = "ANIM_OT_channels_move";
ot->description = "Rearrange selected animation channels";
/* api callbacks */
- ot->exec= animchannels_rearrange_exec;
- ot->poll= animedit_poll_channels_nla_tweakmode_off;
+ ot->exec = animchannels_rearrange_exec;
+ ot->poll = animedit_poll_channels_nla_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- ot->prop= RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", "");
+ ot->prop = RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", "");
}
/* ******************** Delete Channel Operator *********************** */
@@ -1224,16 +1224,16 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
static void ANIM_OT_channels_delete (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Channels";
- ot->idname= "ANIM_OT_channels_delete";
- ot->description= "Delete all selected animation channels";
+ ot->name = "Delete Channels";
+ ot->idname = "ANIM_OT_channels_delete";
+ ot->description = "Delete all selected animation channels";
/* api callbacks */
- ot->exec= animchannels_delete_exec;
- ot->poll= animedit_poll_channels_active;
+ ot->exec = animchannels_delete_exec;
+ ot->poll = animedit_poll_channels_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Set Channel Visibility Operator *********************** */
@@ -1316,16 +1316,16 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
static void ANIM_OT_channels_visibility_set (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Visibility";
- ot->idname= "ANIM_OT_channels_visibility_set";
- ot->description= "Make only the selected animation channels visible in the Graph Editor";
+ ot->name = "Set Visibility";
+ ot->idname = "ANIM_OT_channels_visibility_set";
+ ot->description = "Make only the selected animation channels visible in the Graph Editor";
/* api callbacks */
- ot->exec= animchannels_visibility_set_exec;
- ot->poll= ED_operator_graphedit_active;
+ ot->exec = animchannels_visibility_set_exec;
+ ot->poll = ED_operator_graphedit_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1393,16 +1393,16 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(o
static void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Visibility";
- ot->idname= "ANIM_OT_channels_visibility_toggle";
- ot->description= "Toggle visibility in Graph Editor of all selected animation channels";
+ ot->name = "Toggle Visibility";
+ ot->idname = "ANIM_OT_channels_visibility_toggle";
+ ot->description = "Toggle visibility in Graph Editor of all selected animation channels";
/* api callbacks */
- ot->exec= animchannels_visibility_toggle_exec;
- ot->poll= ED_operator_graphedit_active;
+ ot->exec = animchannels_visibility_toggle_exec;
+ ot->poll = ED_operator_graphedit_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ********************** Set Flags Operator *********************** */
@@ -1536,82 +1536,82 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op)
static void ANIM_OT_channels_setting_enable (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Enable Channel Setting";
- ot->idname= "ANIM_OT_channels_setting_enable";
- ot->description= "Enable specified setting on all selected animation channels";
+ ot->name = "Enable Channel Setting";
+ ot->idname = "ANIM_OT_channels_setting_enable";
+ ot->description = "Enable specified setting on all selected animation channels";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= animchannels_setflag_exec;
- ot->poll= animedit_poll_channels_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = animchannels_setflag_exec;
+ ot->poll = animedit_poll_channels_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
/* flag-setting mode */
RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_ADD, "Mode", "");
/* setting to set */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
}
/* duplicate of 'ANIM_OT_channels_setting_toggle' for menu title only, weak! */
static void ANIM_OT_channels_setting_disable (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Disable Channel Setting";
- ot->idname= "ANIM_OT_channels_setting_disable";
- ot->description= "Disable specified setting on all selected animation channels";
+ ot->name = "Disable Channel Setting";
+ ot->idname = "ANIM_OT_channels_setting_disable";
+ ot->description = "Disable specified setting on all selected animation channels";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= animchannels_setflag_exec;
- ot->poll= animedit_poll_channels_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = animchannels_setflag_exec;
+ ot->poll = animedit_poll_channels_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
/* flag-setting mode */
RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_CLEAR, "Mode", "");
/* setting to set */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
}
static void ANIM_OT_channels_setting_toggle (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Channel Setting";
- ot->idname= "ANIM_OT_channels_setting_toggle";
- ot->description= "Toggle specified setting on all selected animation channels";
+ ot->name = "Toggle Channel Setting";
+ ot->idname = "ANIM_OT_channels_setting_toggle";
+ ot->description = "Toggle specified setting on all selected animation channels";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= animchannels_setflag_exec;
- ot->poll= animedit_poll_channels_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = animchannels_setflag_exec;
+ ot->poll = animedit_poll_channels_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
/* flag-setting mode */
RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
/* setting to set */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
}
static void ANIM_OT_channels_editable_toggle (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Channel Editability";
- ot->idname= "ANIM_OT_channels_editable_toggle";
- ot->description= "Toggle editability of selected channels";
+ ot->name = "Toggle Channel Editability";
+ ot->idname = "ANIM_OT_channels_editable_toggle";
+ ot->description = "Toggle editability of selected channels";
/* api callbacks */
- ot->exec= animchannels_setflag_exec;
- ot->poll= animedit_poll_channels_active;
+ ot->exec = animchannels_setflag_exec;
+ ot->poll = animedit_poll_channels_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
/* flag-setting mode */
@@ -1647,19 +1647,19 @@ static int animchannels_expand_exec (bContext *C, wmOperator *op)
static void ANIM_OT_channels_expand (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Expand Channels";
- ot->idname= "ANIM_OT_channels_expand";
- ot->description= "Expand (i.e. open) all selected expandable animation channels";
+ ot->name = "Expand Channels";
+ ot->idname = "ANIM_OT_channels_expand";
+ ot->description = "Expand (i.e. open) all selected expandable animation channels";
/* api callbacks */
- ot->exec= animchannels_expand_exec;
- ot->poll= animedit_poll_channels_active;
+ ot->exec = animchannels_expand_exec;
+ ot->poll = animedit_poll_channels_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- ot->prop= RNA_def_boolean(ot->srna, "all", 1, "All", "Expand all channels (not just selected ones)");
+ ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All", "Expand all channels (not just selected ones)");
}
/* ********************** Collapse Channels Operator *********************** */
@@ -1689,19 +1689,19 @@ static int animchannels_collapse_exec (bContext *C, wmOperator *op)
static void ANIM_OT_channels_collapse (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Collapse Channels";
- ot->idname= "ANIM_OT_channels_collapse";
- ot->description= "Collapse (i.e. close) all selected expandable animation channels";
+ ot->name = "Collapse Channels";
+ ot->idname = "ANIM_OT_channels_collapse";
+ ot->description = "Collapse (i.e. close) all selected expandable animation channels";
/* api callbacks */
- ot->exec= animchannels_collapse_exec;
- ot->poll= animedit_poll_channels_active;
+ ot->exec = animchannels_collapse_exec;
+ ot->poll = animedit_poll_channels_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- ot->prop= RNA_def_boolean(ot->srna, "all", 1, "All", "Collapse all channels (not just selected ones)");
+ ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All", "Collapse all channels (not just selected ones)");
}
/* ******************* Reenable Disabled Operator ******************* */
@@ -1765,16 +1765,16 @@ static int animchannels_enable_exec (bContext *C, wmOperator *UNUSED(op))
static void ANIM_OT_channels_fcurves_enable (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Revive Disabled F-Curves";
- ot->idname= "ANIM_OT_channels_fcurves_enable";
- ot->description= "Clears 'disabled' tag from all F-Curves to get broken F-Curves working again";
+ ot->name = "Revive Disabled F-Curves";
+ ot->idname = "ANIM_OT_channels_fcurves_enable";
+ ot->description = "Clears 'disabled' tag from all F-Curves to get broken F-Curves working again";
/* api callbacks */
- ot->exec= animchannels_enable_exec;
- ot->poll= animchannels_enable_poll;
+ ot->exec = animchannels_enable_exec;
+ ot->poll = animchannels_enable_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ********************** Select All Operator *********************** */
@@ -1802,19 +1802,19 @@ static int animchannels_deselectall_exec (bContext *C, wmOperator *op)
static void ANIM_OT_channels_select_all_toggle (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select All";
- ot->idname= "ANIM_OT_channels_select_all_toggle";
- ot->description= "Toggle selection of all animation channels";
+ ot->name = "Select All";
+ ot->idname = "ANIM_OT_channels_select_all_toggle";
+ ot->description = "Toggle selection of all animation channels";
/* api callbacks */
- ot->exec= animchannels_deselectall_exec;
- ot->poll= animedit_poll_channels_nla_tweakmode_off;
+ ot->exec = animchannels_deselectall_exec;
+ ot->poll = animedit_poll_channels_nla_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+ ot->prop = RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
}
/* ******************** Borderselect Operator *********************** */
@@ -1905,15 +1905,15 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get settings from operator */
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
extend= RNA_boolean_get(op->ptr, "extend");
- if(!extend)
+ if (!extend)
ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 1, ACHANNEL_SETFLAG_CLEAR);
if (gesture_mode == GESTURE_MODAL_SELECT)
@@ -1933,20 +1933,20 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
static void ANIM_OT_channels_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Select";
- ot->idname= "ANIM_OT_channels_select_border";
- ot->description= "Select all animation channels within the specified region";
+ ot->name = "Border Select";
+ ot->idname = "ANIM_OT_channels_select_border";
+ ot->description = "Select all animation channels within the specified region";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= animchannels_borderselect_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = animchannels_borderselect_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= animedit_poll_channels_nla_tweakmode_off;
+ ot->poll = animedit_poll_channels_nla_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, TRUE);
@@ -2044,13 +2044,13 @@ static int animchannels_rename_invoke (bContext *C, wmOperator *UNUSED(op), wmEv
static void ANIM_OT_channels_rename (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Rename Channels";
- ot->idname= "ANIM_OT_channels_rename";
- ot->description= "Rename animation channel under mouse";
+ ot->name = "Rename Channels";
+ ot->idname = "ANIM_OT_channels_rename";
+ ot->description = "Rename animation channel under mouse";
/* api callbacks */
- ot->invoke= animchannels_rename_invoke;
- ot->poll= animedit_poll_channels_active;
+ ot->invoke = animchannels_rename_invoke;
+ ot->poll = animedit_poll_channels_active;
}
/* ******************** Mouse-Click Operator *********************** */
@@ -2354,16 +2354,16 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
static void ANIM_OT_channels_click (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mouse Click on Channels";
- ot->idname= "ANIM_OT_channels_click";
- ot->description= "Handle mouse-clicks over animation channels";
+ ot->name = "Mouse Click on Channels";
+ ot->idname = "ANIM_OT_channels_click";
+ ot->description = "Handle mouse-clicks over animation channels";
/* api callbacks */
- ot->invoke= animchannels_mouseclick_invoke;
- ot->poll= animedit_poll_channels_active;
+ ot->invoke = animchannels_mouseclick_invoke;
+ ot->poll = animedit_poll_channels_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index be66edb8dc9..3f0e1b1be14 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -88,7 +88,7 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
RNA_id_pointer_create(id, &id_ptr);
- if(RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop))
+ if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop))
RNA_property_update_main(G.main, scene, &ptr, prop);
}
else {
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 1ef02f46000..bab341ae70b 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -51,9 +51,6 @@
#include "UI_resources.h"
#include "UI_view2d.h"
-/* XXX */
-extern void ui_rasterpos_safe(float x, float y, float aspect);
-
/* *************************************************** */
/* TIME CODE FORMATTING */
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 95cb7dad9a4..76217a7592f 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1202,7 +1202,7 @@ static size_t animfilter_block_data (bAnimContext *ac, ListBase *anim_data, bDop
size_t items = 0;
/* image object datablocks have no anim-data so check for NULL */
- if(adt) {
+ if (adt) {
IdAdtTemplate *iat = (IdAdtTemplate*)id;
/* NOTE: this macro is used instead of inlining the logic here, since this sort of filtering is still needed
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 803516e211b..86e3c8050c2 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -410,7 +410,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
}
else {
UI_ThemeColor(TH_TEXT);
- if((marker->frame <= cfra) && (marker->frame+5 > cfra)) {
+ if ((marker->frame <= cfra) && (marker->frame+5 > cfra)) {
x= xpos*xscale + 4.0f;
y= (ypixels <= 39.0f)? (ypixels - 10.0f) : 29.0f;
}
@@ -421,7 +421,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
}
#ifdef DURIAN_CAMERA_SWITCH
- if(marker->camera && (marker->camera->restrictflag & OB_RESTRICT_RENDER)) {
+ if (marker->camera && (marker->camera->restrictflag & OB_RESTRICT_RENDER)) {
float col[4];
glGetFloatv(GL_CURRENT_COLOR, col);
col[3]= 0.4;
@@ -582,17 +582,17 @@ static int ed_marker_add(bContext *C, wmOperator *UNUSED(op))
static void MARKER_OT_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Time Marker";
- ot->description= "Add a new time marker";
- ot->idname= "MARKER_OT_add";
+ ot->name = "Add Time Marker";
+ ot->description = "Add a new time marker";
+ ot->idname = "MARKER_OT_add";
/* api callbacks */
- ot->exec= ed_marker_add;
+ ot->exec = ed_marker_add;
ot->invoke = ed_markers_opwrap_invoke;
- ot->poll= ED_operator_animview_active;
+ ot->poll = ED_operator_animview_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************** transform markers *************************** */
@@ -638,7 +638,7 @@ static int ed_marker_move_init(bContext *C, wmOperator *op)
int totmark=0;
int a;
- if(markers == NULL) return 0;
+ if (markers == NULL) return 0;
for (marker= markers->first; marker; marker= marker->next)
if (marker->flag & SELECT) totmark++;
@@ -681,7 +681,7 @@ static void ed_marker_move_exit(bContext *C, wmOperator *op)
static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt)
{
- if(ed_marker_move_init(C, op)) {
+ if (ed_marker_move_init(C, op)) {
MarkerMove *mm= op->customdata;
mm->evtx= evt->x;
@@ -872,7 +872,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
static int ed_marker_move_exec(bContext *C, wmOperator *op)
{
- if(ed_marker_move_init(C, op)) {
+ if (ed_marker_move_init(C, op)) {
ed_marker_move_apply(op);
ed_marker_move_exit(C, op);
return OPERATOR_FINISHED;
@@ -883,19 +883,19 @@ static int ed_marker_move_exec(bContext *C, wmOperator *op)
static void MARKER_OT_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Time Marker";
- ot->description= "Move selected time marker(s)";
- ot->idname= "MARKER_OT_move";
+ ot->name = "Move Time Marker";
+ ot->description = "Move selected time marker(s)";
+ ot->idname = "MARKER_OT_move";
/* api callbacks */
- ot->exec= ed_marker_move_exec;
- ot->invoke= ed_marker_move_invoke_wrapper;
- ot->modal= ed_marker_move_modal;
- ot->poll= ed_markers_poll_selected_markers;
- ot->cancel= ed_marker_move_cancel;
+ ot->exec = ed_marker_move_exec;
+ ot->invoke = ed_marker_move_invoke_wrapper;
+ ot->modal = ed_marker_move_modal;
+ ot->poll = ed_markers_poll_selected_markers;
+ ot->cancel = ed_marker_move_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
/* rna storage */
RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
@@ -976,19 +976,19 @@ static int ed_marker_duplicate_invoke_wrapper(bContext *C, wmOperator *op, wmEve
static void MARKER_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Duplicate Time Marker";
- ot->description= "Duplicate selected time marker(s)";
- ot->idname= "MARKER_OT_duplicate";
+ ot->name = "Duplicate Time Marker";
+ ot->description = "Duplicate selected time marker(s)";
+ ot->idname = "MARKER_OT_duplicate";
/* api callbacks */
- ot->exec= ed_marker_duplicate_exec;
- ot->invoke= ed_marker_duplicate_invoke_wrapper;
- ot->modal= ed_marker_move_modal;
- ot->poll= ed_markers_poll_selected_markers;
- ot->cancel= ed_marker_move_cancel;
+ ot->exec = ed_marker_duplicate_exec;
+ ot->invoke = ed_marker_duplicate_invoke_wrapper;
+ ot->modal = ed_marker_move_modal;
+ ot->poll = ed_markers_poll_selected_markers;
+ ot->cancel = ed_marker_move_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna storage */
RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
@@ -1051,7 +1051,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
scene_deselect_all(scene);
for (marker= markers->first; marker; marker= marker->next) {
- if(marker->frame==cfra) {
+ if (marker->frame==cfra) {
sel= (marker->flag & SELECT);
break;
}
@@ -1063,7 +1063,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
base= object_in_scene(marker->camera, scene);
if (base) {
ED_base_object_select(base, sel);
- if(sel)
+ if (sel)
ED_base_object_activate(C, base);
}
}
@@ -1101,16 +1101,16 @@ static int ed_marker_select_invoke_wrapper(bContext *C, wmOperator *op, wmEvent
static void MARKER_OT_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Time Marker";
- ot->description= "Select time marker(s)";
- ot->idname= "MARKER_OT_select";
+ ot->name = "Select Time Marker";
+ ot->description = "Select time marker(s)";
+ ot->idname = "MARKER_OT_select";
/* api callbacks */
- ot->invoke= ed_marker_select_invoke_wrapper;
- ot->poll= ed_markers_poll_markers_exist;
+ ot->invoke = ed_marker_select_invoke_wrapper;
+ ot->poll = ed_markers_poll_markers_exist;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
#ifdef DURIAN_CAMERA_SWITCH
@@ -1189,20 +1189,20 @@ static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, w
static void MARKER_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Marker Border select";
- ot->description= "Select all time markers using border selection";
- ot->idname= "MARKER_OT_select_border";
+ ot->name = "Marker Border select";
+ ot->description = "Select all time markers using border selection";
+ ot->idname = "MARKER_OT_select_border";
/* api callbacks */
- ot->exec= ed_marker_border_select_exec;
- ot->invoke= ed_marker_select_border_invoke_wrapper;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->exec = ed_marker_border_select_exec;
+ ot->invoke = ed_marker_select_border_invoke_wrapper;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= ed_markers_poll_markers_exist;
+ ot->poll = ed_markers_poll_markers_exist;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, TRUE);
@@ -1223,7 +1223,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
action = (ED_markers_get_first_selected(markers) != NULL) ? SEL_DESELECT : SEL_SELECT;
}
- for(marker= markers->first; marker; marker= marker->next) {
+ for (marker= markers->first; marker; marker= marker->next) {
switch (action) {
case SEL_SELECT:
marker->flag |= SELECT;
@@ -1246,17 +1246,17 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
static void MARKER_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "(De)select all markers";
- ot->description= "Change selection of all time markers";
- ot->idname= "MARKER_OT_select_all";
+ ot->name = "(De)select all markers";
+ ot->description = "Change selection of all time markers";
+ ot->idname = "MARKER_OT_select_all";
/* api callbacks */
- ot->exec= ed_marker_select_all_exec;
+ ot->exec = ed_marker_select_all_exec;
ot->invoke = ed_markers_opwrap_invoke;
- ot->poll= ed_markers_poll_markers_exist;
+ ot->poll = ed_markers_poll_markers_exist;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_select_all(ot);
@@ -1299,17 +1299,17 @@ static int ed_marker_delete_invoke_wrapper(bContext *C, wmOperator *op, wmEvent
static void MARKER_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Markers";
- ot->description= "Delete selected time marker(s)";
- ot->idname= "MARKER_OT_delete";
+ ot->name = "Delete Markers";
+ ot->description = "Delete selected time marker(s)";
+ ot->idname = "MARKER_OT_delete";
/* api callbacks */
- ot->invoke= ed_marker_delete_invoke_wrapper;
- ot->exec= ed_marker_delete_exec;
- ot->poll= ed_markers_poll_selected_markers;
+ ot->invoke = ed_marker_delete_invoke_wrapper;
+ ot->exec = ed_marker_delete_exec;
+ ot->poll = ed_markers_poll_selected_markers;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1347,17 +1347,17 @@ static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, wmEvent
static void MARKER_OT_rename(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Rename Marker";
- ot->description= "Rename first selected time marker";
- ot->idname= "MARKER_OT_rename";
+ ot->name = "Rename Marker";
+ ot->description = "Rename first selected time marker";
+ ot->idname = "MARKER_OT_rename";
/* api callbacks */
- ot->invoke= ed_marker_rename_invoke_wrapper;
- ot->exec= ed_marker_rename_exec;
- ot->poll= ed_markers_poll_selected_markers;
+ ot->invoke = ed_marker_rename_invoke_wrapper;
+ ot->exec = ed_marker_rename_exec;
+ ot->poll = ed_markers_poll_selected_markers;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_string(ot->srna, "name", "RenamedMarker", sizeof(((TimeMarker *)NULL)->name), "Name", "New name for marker");
@@ -1400,22 +1400,22 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Make Links to Scene";
- ot->description= "Copy selected markers to another scene";
- ot->idname= "MARKER_OT_make_links_scene";
+ ot->name = "Make Links to Scene";
+ ot->description = "Copy selected markers to another scene";
+ ot->idname = "MARKER_OT_make_links_scene";
/* api callbacks */
- ot->exec= ed_marker_make_links_scene_exec;
+ ot->exec = ed_marker_make_links_scene_exec;
ot->invoke = ed_markers_opwrap_invoke;
- ot->poll= ed_markers_poll_selected_markers;
+ ot->poll = ed_markers_poll_selected_markers;
/* 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", "");
RNA_def_enum_funcs(prop, RNA_scene_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
@@ -1431,7 +1431,7 @@ static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op))
TimeMarker *marker;
marker= ED_markers_get_first_selected(markers);
- if(marker == NULL)
+ if (marker == NULL)
return OPERATOR_CANCELLED;
marker->camera= ob;
@@ -1450,17 +1450,17 @@ static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op))
static void MARKER_OT_camera_bind(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Bind Camera to Markers";
- ot->description= "Bind the active camera to selected markers(s)";
- ot->idname= "MARKER_OT_camera_bind";
+ ot->name = "Bind Camera to Markers";
+ ot->description = "Bind the active camera to selected markers(s)";
+ ot->idname = "MARKER_OT_camera_bind";
/* api callbacks */
- ot->exec= ed_marker_camera_bind_exec;
+ ot->exec = ed_marker_camera_bind_exec;
ot->invoke = ed_markers_opwrap_invoke;
- ot->poll= ed_markers_poll_selected_markers;
+ ot->poll = ed_markers_poll_selected_markers;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
#endif
@@ -1486,7 +1486,7 @@ void ED_operatortypes_marker(void)
/* called in screen_ops.c:ED_keymap_screen() */
void ED_marker_keymap(wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Markers", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Markers", 0, 0);
wmKeyMapItem *kmi;
WM_keymap_verify_item(keymap, "MARKER_OT_add", MKEY, KM_PRESS, 0, 0);
@@ -1497,11 +1497,11 @@ void ED_marker_keymap(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "extend", TRUE);
#ifdef DURIAN_CAMERA_SWITCH
- kmi= WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "camera", TRUE);
- kmi= WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "camera", TRUE);
#else
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 5b246e63a20..8286e81b792 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -65,7 +65,7 @@ static int change_frame_poll(bContext *C)
ScrArea *curarea= CTX_wm_area(C);
/* XXX temp? prevent changes during render */
- if(G.rendering) return 0;
+ if (G.rendering) return 0;
/* as long as there is an active area, and it isn't a Graph Editor
* (since the Graph Editor has its own version which does extra stuff),
@@ -161,18 +161,18 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
static void ANIM_OT_change_frame(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change frame";
- ot->idname= "ANIM_OT_change_frame";
- ot->description= "Interactively change the current frame number";
+ ot->name = "Change frame";
+ ot->idname = "ANIM_OT_change_frame";
+ ot->description = "Interactively change the current frame number";
/* api callbacks */
- ot->exec= change_frame_exec;
- ot->invoke= change_frame_invoke;
- ot->modal= change_frame_modal;
- ot->poll= change_frame_poll;
+ ot->exec = change_frame_exec;
+ ot->invoke = change_frame_invoke;
+ ot->modal = change_frame_modal;
+ ot->poll = change_frame_poll;
/* flags */
- ot->flag= OPTYPE_BLOCKING|OPTYPE_UNDO;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_UNDO;
/* rna */
RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
@@ -216,20 +216,20 @@ static int previewrange_define_exec(bContext *C, wmOperator *op)
static void ANIM_OT_previewrange_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Preview Range";
- ot->idname= "ANIM_OT_previewrange_set";
- ot->description= "Interactively define frame range used for playback";
+ ot->name = "Set Preview Range";
+ ot->idname = "ANIM_OT_previewrange_set";
+ ot->description = "Interactively define frame range used for playback";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= previewrange_define_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = previewrange_define_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= ED_operator_animview_active;
+ ot->poll = ED_operator_animview_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
/* used to define frame range */
@@ -264,17 +264,17 @@ static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op))
static void ANIM_OT_previewrange_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Preview Range";
- ot->idname= "ANIM_OT_previewrange_clear";
- ot->description= "Clear Preview Range";
+ ot->name = "Clear Preview Range";
+ ot->idname = "ANIM_OT_previewrange_clear";
+ ot->description = "Clear Preview Range";
/* api callbacks */
- ot->exec= previewrange_clear_exec;
+ ot->exec = previewrange_clear_exec;
- ot->poll= ED_operator_animview_active;
+ ot->poll = ED_operator_animview_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************** registration **********************************/
@@ -315,7 +315,7 @@ void ED_operatortypes_anim(void)
void ED_keymap_anim(wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Animation", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Animation", 0, 0);
wmKeyMapItem *kmi;
/* frame management */
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 6af95b35ba8..881de2904f7 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -515,16 +515,16 @@ static int add_driver_button_exec (bContext *C, wmOperator *op)
void ANIM_OT_driver_button_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Driver";
- ot->idname= "ANIM_OT_driver_button_add";
- ot->description= "Add driver(s) for the property(s) connected represented by the highlighted button";
+ ot->name = "Add Driver";
+ ot->idname = "ANIM_OT_driver_button_add";
+ ot->description = "Add driver(s) for the property(s) connected represented by the highlighted button";
/* callbacks */
- ot->exec= add_driver_button_exec;
+ ot->exec = add_driver_button_exec;
//op->poll= ??? // TODO: need to have some animatable property to do this
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Create drivers for all elements of the array");
@@ -567,16 +567,16 @@ static int remove_driver_button_exec (bContext *C, wmOperator *op)
void ANIM_OT_driver_button_remove (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Driver";
- ot->idname= "ANIM_OT_driver_button_remove";
- ot->description= "Remove the driver(s) for the property(s) connected represented by the highlighted button";
+ ot->name = "Remove Driver";
+ ot->idname = "ANIM_OT_driver_button_remove";
+ ot->description = "Remove the driver(s) for the property(s) connected represented by the highlighted button";
/* callbacks */
- ot->exec= remove_driver_button_exec;
+ ot->exec = remove_driver_button_exec;
//op->poll= ??? // TODO: need to have some driver to be able to do this...
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Delete drivers for all elements of the array");
@@ -614,16 +614,16 @@ static int copy_driver_button_exec (bContext *C, wmOperator *op)
void ANIM_OT_copy_driver_button (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Driver";
- ot->idname= "ANIM_OT_copy_driver_button";
- ot->description= "Copy the driver for the highlighted button";
+ ot->name = "Copy Driver";
+ ot->idname = "ANIM_OT_copy_driver_button";
+ ot->description = "Copy the driver for the highlighted button";
/* callbacks */
- ot->exec= copy_driver_button_exec;
+ ot->exec = copy_driver_button_exec;
//op->poll= ??? // TODO: need to have some driver to be able to do this...
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* Paste Driver Button Operator ------------------------ */
@@ -658,16 +658,16 @@ static int paste_driver_button_exec (bContext *C, wmOperator *op)
void ANIM_OT_paste_driver_button (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste Driver";
- ot->idname= "ANIM_OT_paste_driver_button";
- ot->description= "Paste the driver in the copy/paste buffer for the highlighted button";
+ ot->name = "Paste Driver";
+ ot->idname = "ANIM_OT_paste_driver_button";
+ ot->description = "Paste the driver in the copy/paste buffer for the highlighted button";
/* callbacks */
- ot->exec= paste_driver_button_exec;
+ ot->exec = paste_driver_button_exec;
//op->poll= ??? // TODO: need to have some driver to be able to do this...
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************************************** */
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index de0af2d8f8f..9b3e481d118 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -126,7 +126,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
/* col= uiLayoutColumn(layout, 1); */ /* UNUSED */
block= uiLayoutGetBlock(layout);
uiBlockBeginAlign(block);
- but= uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, width-30, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL);
+ but = uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, width-30, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL);
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
uiDefButR(block, TOG, B_FMODIFIER_REDRAW, NULL, 0, 0, width-30, UI_UNIT_Y, &ptr, "use_additive", -1, 0, 0, -1, -1, NULL);
@@ -143,7 +143,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
/* draw polynomial order selector */
row= uiLayoutRow(layout, 0);
block= uiLayoutGetBlock(row);
- but= uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 10, 0, width-30, 19,
+ but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 10, 0, width-30, 19,
&data->poly_order, 1, 100, 0, 0,
TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
@@ -196,7 +196,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
/* draw polynomial order selector */
row= uiLayoutRow(layout, 0);
block= uiLayoutGetBlock(row);
- but= uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0, 0, width-30, 19,
+ but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0, 0, width-30, 19,
&data->poly_order, 1, 100, 0, 0,
TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
@@ -515,7 +515,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
uiDefBut(block, LABEL, 1, IFACE_("Control Points:"), 0, 0, 150, 20, NULL, 0.0, 0.0, 0, 0, "");
- but= uiDefBut(block, BUT, B_FMODIFIER_REDRAW, IFACE_("Add Point"), 0, 0, 150, 19,
+ but = uiDefBut(block, BUT, B_FMODIFIER_REDRAW, IFACE_("Add Point"), 0, 0, 150, 19,
NULL, 0, 0, 0, 0, TIP_("Add a new control-point to the envelope on the current frame"));
uiButSetFunc(but, fmod_envelope_addpoint_cb, env, NULL);
@@ -535,7 +535,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Max:"), 0, 0, 100, 20,
&fed->max, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Maximum bound of envelope at this point"));
- but= uiDefIconBut(block, BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 18, 20,
+ but = uiDefIconBut(block, BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 18, 20,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete envelope control point"));
uiButSetFunc(but, fmod_envelope_deletepoint_cb, env, SET_INT_IN_POINTER(i));
uiBlockBeginAlign(block);
@@ -674,7 +674,7 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie
uiBlockSetEmboss(block, UI_EMBOSSN);
/* delete button */
- but= uiDefIconBut(block, BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ but = uiDefIconBut(block, BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete F-Curve Modifier"));
uiButSetFunc(but, delete_fmodifier_cb, modifiers, fcm);
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 8b93688f4cb..1c0bb9beaa1 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -269,7 +269,7 @@ static void nupdate_abk_bezt (void *node, void *data)
if (abk->numBezts >= MAX_ABK_BUFSIZE) {
// TODO: need to allocate new array to cater...
//bezts_extra= MEM_callocN(...);
- if(G.f & G_DEBUG)
+ if (G.f & G_DEBUG)
printf("FIXME: nupdate_abk_bezt() missing case for too many overlapping BezTriples \n");
}
else {
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index f140c408e68..c6aed3133e2 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -751,7 +751,6 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type)
return mirror_bezier_value;
default: /* just in case */
return mirror_bezier_yaxis;
- break;
}
}
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index 9ce148bc083..5d6d02bef63 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -853,7 +853,7 @@ short paste_animedit_keys (bAnimContext *ac, ListBase *anim_data,
}
}
- /* dont continue if some fcurves were pasted */
+ /* don't continue if some fcurves were pasted */
if (totmatch)
break;
}
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index e82f234d2b6..71e70536d15 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -317,9 +317,9 @@ int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
/* use default interpolation mode, with exceptions for int/discrete values */
beztr.ipo= U.ipo_new;
- if(fcu->flag & FCURVE_DISCRETE_VALUES)
+ if (fcu->flag & FCURVE_DISCRETE_VALUES)
beztr.ipo = BEZT_IPO_CONST;
- else if(beztr.ipo == BEZT_IPO_BEZ && (fcu->flag & FCURVE_INT_VALUES))
+ else if (beztr.ipo == BEZT_IPO_BEZ && (fcu->flag & FCURVE_INT_VALUES))
beztr.ipo = BEZT_IPO_LIN;
/* add temp beztriple to keyframes */
@@ -573,7 +573,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
return 0;
/* location or rotation identifiers only... */
- if(identifier == NULL) {
+ if (identifier == NULL) {
printf("%s failed: NULL identifier\n", __func__);
return 0;
}
@@ -1158,22 +1158,22 @@ void ANIM_OT_keyframe_insert (wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Insert Keyframe";
- ot->idname= "ANIM_OT_keyframe_insert";
- ot->description= "Insert keyframes on the current frame for all properties in the specified Keying Set";
+ ot->name = "Insert Keyframe";
+ ot->idname = "ANIM_OT_keyframe_insert";
+ ot->description = "Insert keyframes on the current frame for all properties in the specified Keying Set";
/* callbacks */
- ot->exec= insert_key_exec;
- ot->poll= modify_key_op_poll;
+ ot->exec = insert_key_exec;
+ ot->poll = modify_key_op_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* keyingset to use (dynamic enum) */
prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
- ot->prop= prop;
+ ot->prop = prop;
/* confirm whether a keyframe was added by showing a popup
* - by default, this is enabled, since this operator is assumed to be called independently
@@ -1219,23 +1219,23 @@ void ANIM_OT_keyframe_insert_menu (wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Insert Keyframe Menu";
- ot->idname= "ANIM_OT_keyframe_insert_menu";
- ot->description= "Insert Keyframes for specified Keying Set, with menu of available Keying Sets if undefined";
+ ot->name = "Insert Keyframe Menu";
+ ot->idname = "ANIM_OT_keyframe_insert_menu";
+ ot->description = "Insert Keyframes for specified Keying Set, with menu of available Keying Sets if undefined";
/* callbacks */
- ot->invoke= insert_key_menu_invoke;
- ot->exec= insert_key_exec;
- ot->poll= ED_operator_areaactive;
+ ot->invoke = insert_key_menu_invoke;
+ ot->exec = insert_key_exec;
+ ot->poll = ED_operator_areaactive;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* keyingset to use (dynamic enum) */
prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
- ot->prop= prop;
+ ot->prop = prop;
/* confirm whether a keyframe was added by showing a popup
* - by default, this is disabled so that if a menu is shown, this doesn't come up too
@@ -1314,22 +1314,22 @@ void ANIM_OT_keyframe_delete (wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Delete Keying-Set Keyframe";
- ot->idname= "ANIM_OT_keyframe_delete";
- ot->description= "Delete keyframes on the current frame for all properties in the specified Keying Set";
+ ot->name = "Delete Keying-Set Keyframe";
+ ot->idname = "ANIM_OT_keyframe_delete";
+ ot->description = "Delete keyframes on the current frame for all properties in the specified Keying Set";
/* callbacks */
- ot->exec= delete_key_exec;
- ot->poll= modify_key_op_poll;
+ ot->exec = delete_key_exec;
+ ot->poll = modify_key_op_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* keyingset to use (dynamic enum) */
prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
- ot->prop= prop;
+ ot->prop = prop;
/* confirm whether a keyframe was added by showing a popup
* - by default, this is enabled, since this operator is assumed to be called independently
@@ -1387,18 +1387,18 @@ static int delete_key_v3d_exec (bContext *C, wmOperator *op)
void ANIM_OT_keyframe_delete_v3d (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Keyframe";
- ot->description= "Remove keyframes on current frame for selected object";
- ot->idname= "ANIM_OT_keyframe_delete_v3d";
+ ot->name = "Delete Keyframe";
+ ot->description = "Remove keyframes on current frame for selected object";
+ ot->idname = "ANIM_OT_keyframe_delete_v3d";
/* callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= delete_key_v3d_exec;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = delete_key_v3d_exec;
- ot->poll= ED_operator_areaactive;
+ ot->poll = ED_operator_areaactive;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1429,7 +1429,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
if (all) {
length= RNA_property_array_length(&ptr, prop);
- if(length) index= 0;
+ if (length) index= 0;
else length= 1;
}
else
@@ -1477,15 +1477,15 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
void ANIM_OT_keyframe_insert_button (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Insert Keyframe (Buttons)";
- ot->idname= "ANIM_OT_keyframe_insert_button";
+ ot->name = "Insert Keyframe (Buttons)";
+ ot->idname = "ANIM_OT_keyframe_insert_button";
/* callbacks */
- ot->exec= insert_key_button_exec;
- ot->poll= modify_key_op_poll;
+ ot->exec = insert_key_button_exec;
+ ot->poll = modify_key_op_poll;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Insert a keyframe for all element of the array");
@@ -1549,15 +1549,15 @@ static int delete_key_button_exec (bContext *C, wmOperator *op)
void ANIM_OT_keyframe_delete_button (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Keyframe (Buttons)";
- ot->idname= "ANIM_OT_keyframe_delete_button";
+ ot->name = "Delete Keyframe (Buttons)";
+ ot->idname = "ANIM_OT_keyframe_delete_button";
/* callbacks */
- ot->exec= delete_key_button_exec;
- ot->poll= modify_key_op_poll;
+ ot->exec = delete_key_button_exec;
+ ot->poll = modify_key_op_poll;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Delete keyfames from all elements of the array");
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index bc066b074ea..f66aa31f3f4 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -140,13 +140,13 @@ static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op))
void ANIM_OT_keying_set_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Empty Keying Set";
- ot->idname= "ANIM_OT_keying_set_add";
- ot->description= "Add a new (empty) Keying Set to the active Scene";
+ ot->name = "Add Empty Keying Set";
+ ot->idname = "ANIM_OT_keying_set_add";
+ ot->description = "Add a new (empty) Keying Set to the active Scene";
/* callbacks */
- ot->exec= add_default_keyingset_exec;
- ot->poll= keyingset_poll_default_add;
+ ot->exec = add_default_keyingset_exec;
+ ot->poll = keyingset_poll_default_add;
}
/* Remove 'Active' Keying Set ------------------------- */
@@ -187,13 +187,13 @@ static int remove_active_keyingset_exec (bContext *C, wmOperator *op)
void ANIM_OT_keying_set_remove (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Removed Active Keying Set";
- ot->idname= "ANIM_OT_keying_set_remove";
- ot->description= "Remove the active Keying Set";
+ ot->name = "Remove Active Keying Set";
+ ot->idname = "ANIM_OT_keying_set_remove";
+ ot->description = "Remove the active Keying Set";
/* callbacks */
- ot->exec= remove_active_keyingset_exec;
- ot->poll= keyingset_poll_active_edit;
+ ot->exec = remove_active_keyingset_exec;
+ ot->poll = keyingset_poll_active_edit;
}
/* Add Empty Keying Set Path ------------------------- */
@@ -230,13 +230,13 @@ static int add_empty_ks_path_exec (bContext *C, wmOperator *op)
void ANIM_OT_keying_set_path_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Empty Keying Set Path";
- ot->idname= "ANIM_OT_keying_set_path_add";
- ot->description= "Add empty path to active Keying Set";
+ ot->name = "Add Empty Keying Set Path";
+ ot->idname = "ANIM_OT_keying_set_path_add";
+ ot->description = "Add empty path to active Keying Set";
/* callbacks */
- ot->exec= add_empty_ks_path_exec;
- ot->poll= keyingset_poll_active_edit;
+ ot->exec = add_empty_ks_path_exec;
+ ot->poll = keyingset_poll_active_edit;
}
/* Remove Active Keying Set Path ------------------------- */
@@ -273,13 +273,13 @@ static int remove_active_ks_path_exec (bContext *C, wmOperator *op)
void ANIM_OT_keying_set_path_remove (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Active Keying Set Path";
- ot->idname= "ANIM_OT_keying_set_path_remove";
- ot->description= "Remove active Path from active Keying Set";
+ ot->name = "Remove Active Keying Set Path";
+ ot->idname = "ANIM_OT_keying_set_path_remove";
+ ot->description = "Remove active Path from active Keying Set";
/* callbacks */
- ot->exec= remove_active_ks_path_exec;
- ot->poll= keyingset_poll_activePath_edit;
+ ot->exec = remove_active_ks_path_exec;
+ ot->poll = keyingset_poll_activePath_edit;
}
/* ************************************************** */
@@ -371,15 +371,15 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op)
void ANIM_OT_keyingset_button_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add to Keying Set";
- ot->idname= "ANIM_OT_keyingset_button_add";
+ ot->name = "Add to Keying Set";
+ ot->idname = "ANIM_OT_keyingset_button_add";
/* callbacks */
- ot->exec= add_keyingset_button_exec;
+ ot->exec = add_keyingset_button_exec;
//op->poll= ???
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Add all elements of the array to a Keying Set");
@@ -450,15 +450,15 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
void ANIM_OT_keyingset_button_remove (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove from Keying Set";
- ot->idname= "ANIM_OT_keyingset_button_remove";
+ ot->name = "Remove from Keying Set";
+ ot->idname = "ANIM_OT_keyingset_button_remove";
/* callbacks */
- ot->exec= remove_keyingset_button_exec;
+ ot->exec = remove_keyingset_button_exec;
//op->poll= ???
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************************************* */
@@ -499,16 +499,16 @@ void ANIM_OT_keying_set_active_set (wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Set Active Keying Set";
- ot->idname= "ANIM_OT_keying_set_active_set";
+ ot->name = "Set Active Keying Set";
+ ot->idname = "ANIM_OT_keying_set_active_set";
/* callbacks */
- ot->invoke= keyingset_active_menu_invoke;
- ot->exec= keyingset_active_menu_exec;
- ot->poll= ED_operator_areaactive;
+ ot->invoke = keyingset_active_menu_invoke;
+ ot->exec = keyingset_active_menu_exec;
+ ot->poll = ED_operator_areaactive;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* keyingset to use (dynamic enum) */
prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
@@ -607,7 +607,7 @@ void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi)
BKE_keyingset_free(ks);
BLI_remlink(&builtin_keyingsets, ks);
- for(scene= bmain->scene.first; scene; scene= scene->id.next)
+ for (scene= bmain->scene.first; scene; scene= scene->id.next)
BLI_remlink_safe(&scene->keyingsets, ks);
MEM_freeN(ks);
diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt
index 8c1243ee300..2bd9956ef5a 100644
--- a/source/blender/editors/armature/CMakeLists.txt
+++ b/source/blender/editors/armature/CMakeLists.txt
@@ -55,4 +55,8 @@ set(SRC
reeb.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_armature "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/armature/SConscript b/source/blender/editors/armature/SConscript
index b85a13ced85..e5c96d3530f 100644
--- a/source/blender/editors/armature/SConscript
+++ b/source/blender/editors/armature/SConscript
@@ -8,6 +8,8 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../render/extern/include ../../bmesh'
incs += ' ../../gpu ../../makesrna #/intern/opennl/extern'
+defs = []
+
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'
@@ -15,4 +17,7 @@ if env['OURPLATFORM'] == 'linux':
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
-env.BlenderLib ( 'bf_editors_armature', sources, Split(incs), [], libtype=['core'], priority=[44] )
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_armature', sources, Split(incs), defs, libtype=['core'], priority=[44] )
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index ad52f4e61cb..21b97188522 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -170,31 +170,31 @@ void ED_operatormacros_armature(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot= WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
- if(ot) {
- ot->description= "Make copies of the selected bones within the same armature and move them";
+ ot = WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+ if (ot) {
+ ot->description = "Make copies of the selected bones within the same armature and move them";
WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
}
- ot= WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
- if(ot) {
- ot->description= "Create new bones from the selected joints and move them";
+ ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
+ if (ot) {
+ ot->description = "Create new bones from the selected joints and move them";
otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
RNA_boolean_set(otmacro->ptr, "forked", FALSE);
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
}
// XXX would it be nicer to just be able to have standard extrude_move, but set the forked property separate?
// that would require fixing a properties bug 19733
- ot= WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked", OPTYPE_UNDO|OPTYPE_REGISTER);
- if(ot) {
- ot->description= "Create new bones from the selected joints and move them";
+ ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked", OPTYPE_UNDO|OPTYPE_REGISTER);
+ if (ot) {
+ ot->description = "Create new bones from the selected joints and move them";
otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
RNA_boolean_set(otmacro->ptr, "forked", TRUE);
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
}
}
@@ -205,8 +205,8 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
wmKeyMapItem *kmi;
/* Armature ------------------------ */
- keymap= WM_keymap_find(keyconf, "Armature", 0, 0);
- keymap->poll= ED_operator_editarmature;
+ keymap = WM_keymap_find(keyconf, "Armature", 0, 0);
+ keymap->poll = ED_operator_editarmature;
/* Armature -> Etch-A-Ton ------------------------ */
WM_keymap_add_item(keymap, "SKETCH_OT_delete", XKEY, KM_PRESS, 0, 0);
@@ -228,7 +228,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
/* only set in editmode armature, by space_view3d listener */
kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "unselected", FALSE);
- kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "unselected", TRUE);
WM_keymap_add_item(keymap, "ARMATURE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
@@ -247,17 +247,17 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
- kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
- kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
- kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
- kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
@@ -286,10 +286,10 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
/* special transforms: */
/* 1) envelope/b-bone size */
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
/* 2) set roll */
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_BONE_ROLL);
/* menus */
@@ -297,8 +297,8 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
/* Pose ------------------------ */
/* only set in posemode, by space_view3d listener */
- keymap= WM_keymap_find(keyconf, "Pose", 0, 0);
- keymap->poll= ED_operator_posemode;
+ keymap = WM_keymap_find(keyconf, "Pose", 0, 0);
+ keymap->poll = ED_operator_posemode;
/* set parent and add object are object-based operators, but we make them
* available here because it's useful to do in pose mode too */
@@ -327,7 +327,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "flipped", FALSE);
- kmi= WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "flipped", TRUE);
kmi = WM_keymap_add_item(keymap, "POSE_OT_select_all", AKEY, KM_PRESS, 0, 0);
@@ -337,17 +337,17 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "POSE_OT_select_parent", PKEY, KM_PRESS, KM_SHIFT, 0);
- kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
- kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
- kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
- kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
@@ -374,7 +374,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
/* special transforms: */
/* 1) envelope/b-bone size */
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
/* keyframes management */
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 2a9436fdb41..4090fc1acaa 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -123,18 +123,18 @@ void ED_armature_validate_active(struct bArmature *arm)
{
EditBone *ebone= arm->act_edbone;
- if(ebone) {
- if(ebone->flag & BONE_HIDDEN_A)
+ if (ebone) {
+ if (ebone->flag & BONE_HIDDEN_A)
arm->act_edbone= NULL;
}
}
static void bone_free(bArmature *arm, EditBone *bone)
{
- if(arm->act_edbone==bone)
+ if (arm->act_edbone==bone)
arm->act_edbone= NULL;
- if(bone->prop) {
+ if (bone->prop) {
IDP_FreeProperty(bone->prop);
MEM_freeN(bone->prop);
}
@@ -275,9 +275,9 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
else {
/* if the bone is not selected, but connected to its parent
* copy the parents tip selection state */
- if(eBone->parent && (eBone->flag & BONE_CONNECTED)) {
+ if (eBone->parent && (eBone->flag & BONE_CONNECTED)) {
/* selecting with the mouse gives this behavior */
- if(eBone->parent->flag & BONE_TIPSEL) {
+ if (eBone->parent->flag & BONE_TIPSEL) {
eBone->flag |= BONE_ROOTSEL;
}
else {
@@ -306,7 +306,7 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
eBone->segments = curBone->segments;
eBone->layer = curBone->layer;
- if(curBone->prop)
+ if (curBone->prop)
eBone->prop= IDP_CopyProperty(curBone->prop);
BLI_addtail(edbo, eBone);
@@ -314,11 +314,11 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
/* Add children if necessary */
if (curBone->childbase.first) {
eBoneTest= make_boneList(edbo, &curBone->childbase, eBone, actBone);
- if(eBoneTest)
+ if (eBoneTest)
eBoneAct= eBoneTest;
}
- if(curBone==actBone)
+ if (curBone==actBone)
eBoneAct= eBone;
}
@@ -434,7 +434,7 @@ void ED_armature_from_edit(Object *obedit)
newBone->segments= eBone->segments;
newBone->layer = eBone->layer;
- if(eBone->prop)
+ if (eBone->prop)
newBone->prop= IDP_CopyProperty(eBone->prop);
}
@@ -542,7 +542,7 @@ void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermod
float cent[3];
/* Put the armature into editmode */
- if(ob != obedit) {
+ if (ob != obedit) {
ED_armature_to_edit(ob);
obedit= NULL; /* we cant use this so behave as if there is no obedit */
}
@@ -554,7 +554,7 @@ void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermod
mul_m4_v3(ob->imat, cent);
}
else {
- if(around==V3D_CENTROID) {
+ if (around==V3D_CENTROID) {
int total= 0;
zero_v3(cent);
for (ebone= arm->edbo->first; ebone; ebone=ebone->next) {
@@ -582,13 +582,13 @@ void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermod
}
/* Turn the list into an armature */
- if(obedit==NULL) {
+ if (obedit==NULL) {
ED_armature_from_edit(ob);
ED_armature_edit_free(ob);
}
/* Adjust object location for new centerpoint */
- if(centermode && obedit==NULL) {
+ if (centermode && obedit==NULL) {
mul_mat3_m4_v3(ob->obmat, cent); /* ommit translation part */
add_v3_v3(ob->loc, cent);
}
@@ -729,16 +729,16 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
void POSE_OT_armature_apply (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Apply Pose as Rest Pose";
- ot->idname= "POSE_OT_armature_apply";
- ot->description= "Apply the current pose as the new rest pose";
+ ot->name = "Apply Pose as Rest Pose";
+ ot->idname = "POSE_OT_armature_apply";
+ ot->description = "Apply the current pose as the new rest pose";
/* callbacks */
- ot->exec= apply_armature_pose2bones_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = apply_armature_pose2bones_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -780,16 +780,16 @@ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)
void POSE_OT_visual_transform_apply (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Apply Visual Transform to Pose";
- ot->idname= "POSE_OT_visual_transform_apply";
- ot->description= "Apply final constrained position of pose bones to their transform";
+ ot->name = "Apply Visual Transform to Pose";
+ ot->idname = "POSE_OT_visual_transform_apply";
+ ot->description = "Apply final constrained position of pose bones to their transform";
/* callbacks */
- ot->exec= pose_visual_transform_apply_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_visual_transform_apply_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ---------------------- */
@@ -1043,12 +1043,12 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
*/
if (ct->subtarget[0] != 0) {
if (ct->tar == origArm) {
- if(BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+ if (BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= newArm;
}
}
else if (ct->tar == newArm) {
- if(BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+ if (BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= origArm;
}
}
@@ -1079,14 +1079,14 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
* - the target isn't origArm/newArm itself
* - the target is one that can be found in newArm/origArm
*/
- if(ct->subtarget[0] != '\0') {
+ if (ct->subtarget[0] != '\0') {
if (ct->tar == origArm) {
- if(BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+ if (BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= newArm;
}
}
else if (ct->tar == newArm) {
- if(BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+ if (BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= origArm;
}
}
@@ -1104,7 +1104,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
if (ob->parent && (ob->parent == origArm)) {
/* Is object parented to a bone of this src armature? */
if ((ob->partype == PARBONE) && (ob->parsubstr[0] != '\0')) {
- if(BLI_findstring(npchans, ob->parsubstr, offsetof(bPoseChannel, name))) {
+ if (BLI_findstring(npchans, ob->parsubstr, offsetof(bPoseChannel, name))) {
ob->parent= newArm;
}
}
@@ -1243,17 +1243,17 @@ static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op))
void ARMATURE_OT_separate (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Separate Bones";
- ot->idname= "ARMATURE_OT_separate";
- ot->description= "Isolate selected bones into a separate armature";
+ ot->name = "Separate Bones";
+ ot->idname = "ARMATURE_OT_separate";
+ ot->description = "Isolate selected bones into a separate armature";
/* callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= separate_armature_exec;
- ot->poll= ED_operator_editarmature;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = separate_armature_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* **************** END tools on Editmode Armature **************** */
@@ -1263,7 +1263,7 @@ void ARMATURE_OT_separate (wmOperatorType *ot)
Bone *get_indexed_bone (Object *ob, int index)
{
bPoseChannel *pchan;
- if(ob->pose==NULL) return NULL;
+ if (ob->pose==NULL) return NULL;
index>>=16; // bone selection codes use left 2 bytes
pchan= BLI_findlink(&ob->pose->chanbase, index);
@@ -1281,17 +1281,17 @@ static void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *
unsigned int hitresult;
short i, takeNext=0, sel;
- for (i=0; i< hits; i++){
+ for (i=0; i< hits; i++) {
hitresult = buffer[3+(i*4)];
if (!(hitresult & BONESEL_NOSEL)) { // -1
- if(hitresult & BONESEL_ANY) { // to avoid including objects in selection
+ if (hitresult & BONESEL_ANY) { // to avoid including objects in selection
hitresult &= ~(BONESEL_ANY);
/* Determine what the current bone is */
if (obedit==NULL || base->object!=obedit) {
/* no singular posemode, so check for correct object */
- if(base->selcol == (hitresult & 0xFFFF)) {
+ if (base->selcol == (hitresult & 0xFFFF)) {
bone = get_indexed_bone(base->object, hitresult);
if (findunsel)
@@ -1306,7 +1306,7 @@ static void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *
sel= 0;
}
}
- else{
+ else {
bArmature *arm= obedit->data;
ebone = BLI_findlink(arm->edbo, hitresult);
@@ -1318,9 +1318,9 @@ static void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *
data = ebone;
}
- if(data) {
+ if (data) {
if (sel) {
- if(!firstSel) firstSel= data;
+ if (!firstSel) firstSel= data;
takeNext=1;
}
else {
@@ -1354,9 +1354,9 @@ static void *get_nearest_bone (bContext *C, short findunsel, int x, int y)
view3d_set_viewcontext(C, &vc);
- // rect.xmin= ... mouseco!
- rect.xmin= rect.xmax= x;
- rect.ymin= rect.ymax= y;
+ // rect.xmin = ... mouseco!
+ rect.xmin = rect.xmax = x;
+ rect.ymin = rect.ymax = y;
glInitNames();
hits= view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
@@ -1430,7 +1430,7 @@ static int pose_select_connected_invoke(bContext *C, wmOperator *op, wmEvent *ev
return OPERATOR_CANCELLED;
/* Select parents */
- for (curBone=bone; curBone; curBone=next){
+ for (curBone=bone; curBone; curBone=next) {
/* ignore bone if cannot be selected */
if ((curBone->flag & BONE_UNSELECTABLE) == 0) {
// XXX old cruft! use notifiers instead
@@ -1467,17 +1467,17 @@ static int pose_select_linked_poll(bContext *C)
void POSE_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Connected";
- ot->idname= "POSE_OT_select_linked";
- ot->description= "Select bones related to selected ones by parent/child relationships";
+ ot->name = "Select Connected";
+ ot->idname = "POSE_OT_select_linked";
+ ot->description = "Select bones related to selected ones by parent/child relationships";
/* api callbacks */
- ot->exec= NULL;
- ot->invoke= pose_select_connected_invoke;
- ot->poll= pose_select_linked_poll;
+ ot->exec = NULL;
+ ot->invoke = pose_select_connected_invoke;
+ ot->poll = pose_select_linked_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -1512,7 +1512,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, wmEvent *e
if (extend) {
curBone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
}
- else{
+ else {
curBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
}
}
@@ -1561,17 +1561,17 @@ static int armature_select_linked_poll(bContext *C)
void ARMATURE_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Connected";
- ot->idname= "ARMATURE_OT_select_linked";
- ot->description= "Select bones related to selected ones by parent/child relationships";
+ ot->name = "Select Connected";
+ ot->idname = "ARMATURE_OT_select_linked";
+ ot->description = "Select bones related to selected ones by parent/child relationships";
/* api callbacks */
- ot->exec= NULL;
- ot->invoke= armature_select_linked_invoke;
- ot->poll= armature_select_linked_poll;
+ ot->exec = NULL;
+ ot->invoke = armature_select_linked_invoke;
+ ot->poll = armature_select_linked_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties s*/
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -1590,23 +1590,23 @@ static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2],
glInitNames();
- rect.xmin= mval[0]-5;
- rect.xmax= mval[0]+5;
- rect.ymin= mval[1]-5;
- rect.ymax= mval[1]+5;
+ rect.xmin = mval[0]-5;
+ rect.xmax = mval[0]+5;
+ rect.ymin = mval[1]-5;
+ rect.ymax = mval[1]+5;
hits= view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
- if(hits==0) {
- rect.xmin= mval[0]-12;
- rect.xmax= mval[0]+12;
- rect.ymin= mval[1]-12;
- rect.ymax= mval[1]+12;
+ if (hits==0) {
+ rect.xmin = mval[0]-12;
+ rect.xmax = mval[0]+12;
+ rect.ymin = mval[1]-12;
+ rect.ymax = mval[1]+12;
hits= view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
}
/* See if there are any selected bones in this group */
if (hits>0) {
- if(hits==1) {
+ if (hits==1) {
if (!(buffer[3] & BONESEL_NOSEL))
besthitresult= buffer[3];
}
@@ -1619,12 +1619,12 @@ static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2],
ebone = BLI_findlink(edbo, hitresult & ~BONESEL_ANY);
/* clicks on bone points get advantage */
- if( hitresult & (BONESEL_ROOT|BONESEL_TIP)) {
+ if ( hitresult & (BONESEL_ROOT|BONESEL_TIP)) {
/* but also the unselected one */
- if(findunsel) {
- if( (hitresult & BONESEL_ROOT) && (ebone->flag & BONE_ROOTSEL)==0)
+ if (findunsel) {
+ if ( (hitresult & BONESEL_ROOT) && (ebone->flag & BONE_ROOTSEL)==0)
dep= 1;
- else if( (hitresult & BONESEL_TIP) && (ebone->flag & BONE_TIPSEL)==0)
+ else if ( (hitresult & BONESEL_TIP) && (ebone->flag & BONE_TIPSEL)==0)
dep= 1;
else
dep= 2;
@@ -1633,15 +1633,15 @@ static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2],
}
else {
/* bone found */
- if(findunsel) {
- if((ebone->flag & BONE_SELECTED)==0)
+ if (findunsel) {
+ if ((ebone->flag & BONE_SELECTED)==0)
dep= 2;
else
dep= 3;
}
else dep= 3;
}
- if(dep < mindep) {
+ if (dep < mindep) {
mindep= dep;
besthitresult= hitresult;
}
@@ -1729,7 +1729,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
ebone_next= curBone->next;
if (arm->layer & curBone->layer) {
if (curBone->flag & BONE_SELECTED) {
- if(curBone==arm->act_edbone) arm->act_edbone= NULL;
+ if (curBone==arm->act_edbone) arm->act_edbone= NULL;
ED_armature_edit_bone_remove(arm, curBone);
}
}
@@ -1746,9 +1746,9 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
void ARMATURE_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Selected Bone(s)";
- ot->idname= "ARMATURE_OT_delete";
- ot->description= "Remove selected bones from the armature";
+ ot->name = "Delete Selected Bone(s)";
+ ot->idname = "ARMATURE_OT_delete";
+ ot->description = "Remove selected bones from the armature";
/* api callbacks */
ot->invoke = WM_operator_confirm;
@@ -1756,7 +1756,7 @@ void ARMATURE_OT_delete(wmOperatorType *ot)
ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* toggle==0: deselect
@@ -1769,12 +1769,12 @@ void ED_armature_deselect_all(Object *obedit, int toggle)
EditBone *eBone;
int sel=1;
- if(toggle==1) {
+ if (toggle==1) {
/* Determine if there are any selected bones
* and therefore whether we are selecting or deselecting */
- for (eBone=arm->edbo->first;eBone;eBone=eBone->next){
- // if(arm->layer & eBone->layer) {
- if (eBone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)){
+ for (eBone=arm->edbo->first;eBone;eBone=eBone->next) {
+ // if (arm->layer & eBone->layer) {
+ if (eBone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)) {
sel=0;
break;
}
@@ -1787,24 +1787,24 @@ void ED_armature_deselect_all(Object *obedit, int toggle)
for (eBone=arm->edbo->first;eBone;eBone=eBone->next) {
if (sel==2) {
/* invert selection of bone */
- if(EBONE_VISIBLE(arm, eBone)) {
+ if (EBONE_VISIBLE(arm, eBone)) {
eBone->flag ^= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- if(arm->act_edbone==eBone)
+ if (arm->act_edbone==eBone)
arm->act_edbone= NULL;
}
}
else if (sel==1) {
/* select bone */
- if(EBONE_VISIBLE(arm, eBone)) {
+ if (EBONE_VISIBLE(arm, eBone)) {
eBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- if(eBone->parent)
+ if (eBone->parent)
eBone->parent->flag |= (BONE_TIPSEL);
}
}
else {
/* deselect bone */
eBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- if(arm->act_edbone==eBone)
+ if (arm->act_edbone==eBone)
arm->act_edbone= NULL;
}
}
@@ -1830,7 +1830,7 @@ void ED_armature_deselect_all_visible(Object *obedit)
/* accounts for connected parents */
static int ebone_select_flag(EditBone *ebone)
{
- if(ebone->parent && (ebone->flag & BONE_CONNECTED)) {
+ if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
return ((ebone->parent->flag & BONE_TIPSEL) ? BONE_ROOTSEL : 0) | (ebone->flag & (BONE_SELECTED|BONE_TIPSEL));
}
else {
@@ -1860,16 +1860,16 @@ int mouse_armature(bContext *C, const int mval[2], int extend)
/* by definition the non-root connected bones have no root point drawn,
* so a root selection needs to be delivered to the parent tip */
- if(selmask & BONE_SELECTED) {
- if(nearBone->parent && (nearBone->flag & BONE_CONNECTED)) {
+ if (selmask & BONE_SELECTED) {
+ if (nearBone->parent && (nearBone->flag & BONE_CONNECTED)) {
/* click in a chain */
- if(extend) {
+ if (extend) {
/* hold shift inverts this bone's selection */
- if(nearBone->flag & BONE_SELECTED) {
+ if (nearBone->flag & BONE_SELECTED) {
/* deselect this bone */
nearBone->flag &= ~(BONE_TIPSEL|BONE_SELECTED);
/* only deselect parent tip if it is not selected */
- if(!(nearBone->parent->flag & BONE_SELECTED))
+ if (!(nearBone->parent->flag & BONE_SELECTED))
nearBone->parent->flag &= ~BONE_TIPSEL;
}
else {
@@ -1885,9 +1885,9 @@ int mouse_armature(bContext *C, const int mval[2], int extend)
}
}
else {
- if(extend) {
+ if (extend) {
/* hold shift inverts this bone's selection */
- if(nearBone->flag & BONE_SELECTED)
+ if (nearBone->flag & BONE_SELECTED)
nearBone->flag &= ~(BONE_TIPSEL|BONE_ROOTSEL);
else
nearBone->flag |= (BONE_TIPSEL|BONE_ROOTSEL);
@@ -1904,9 +1904,9 @@ int mouse_armature(bContext *C, const int mval[2], int extend)
ED_armature_sync_selection(arm->edbo);
- if(nearBone) {
+ if (nearBone) {
/* then now check for active status */
- if(ebone_select_flag(nearBone)) {
+ if (ebone_select_flag(nearBone)) {
arm->act_edbone= nearBone;
}
}
@@ -1965,16 +1965,16 @@ float ED_rollBoneToVector(EditBone *bone, const float align_axis[3], const short
sub_v3_v3v3(nor, bone->tail, bone->head);
vec_roll_to_mat3(nor, 0.0f, mat);
- /* check the bone isnt aligned with the axis */
- if(!is_zero_v3(align_axis) && angle_v3v3(align_axis, mat[2]) > FLT_EPSILON) {
+ /* check the bone isn't aligned with the axis */
+ if (!is_zero_v3(align_axis) && angle_v3v3(align_axis, mat[2]) > FLT_EPSILON) {
float vec[3], align_axis_proj[3], roll;
/* project the new_up_axis along the normal */
project_v3_v3v3(vec, align_axis, nor);
sub_v3_v3v3(align_axis_proj, align_axis, vec);
- if(axis_only) {
- if(angle_v3v3(align_axis_proj, mat[2]) > (float)(M_PI/2.0)) {
+ if (axis_only) {
+ if (angle_v3v3(align_axis_proj, mat[2]) > (float)(M_PI/2.0)) {
negate_v3(align_axis_proj);
}
}
@@ -2020,7 +2020,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
copy_m3_m4(imat, ob->obmat);
invert_m3(imat);
- if(type==7) { /* Cursor */
+ if (type==7) { /* Cursor */
Scene *scene= CTX_data_scene(C);
View3D *v3d= CTX_wm_view3d(C); /* can be NULL */
float cursor_local[3];
@@ -2031,20 +2031,20 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
mul_m3_v3(imat, cursor_local);
/* cursor */
- for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
- if(EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
+ for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
float cursor_rel[3];
sub_v3_v3v3(cursor_rel, cursor_local, ebone->head);
- if(axis_flip) negate_v3(cursor_rel);
+ if (axis_flip) negate_v3(cursor_rel);
ebone->roll= ED_rollBoneToVector(ebone, cursor_rel, axis_only);
}
}
}
else {
float vec[3]= {0.0f, 0.0f, 0.0f};
- if(type==6) { /* View */
+ if (type==6) { /* View */
RegionView3D *rv3d= CTX_wm_region_view3d(C);
- if(rv3d==NULL) {
+ if (rv3d==NULL) {
BKE_report(op->reports, RPT_ERROR, "No region view3d available");
return OPERATOR_CANCELLED;
}
@@ -2055,7 +2055,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
else if (type==5) {
float mat[3][3], nor[3];
ebone= (EditBone *)arm->act_edbone;
- if(ebone==NULL) {
+ if (ebone==NULL) {
BKE_report(op->reports, RPT_ERROR, "No active bone set");
return OPERATOR_CANCELLED;
}
@@ -2066,15 +2066,15 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
}
else { /* Axis */
assert(type >= 0 && type <= 5);
- if(type<3) vec[type]= 1.0f;
+ if (type<3) vec[type]= 1.0f;
else vec[type-2]= -1.0f;
mul_m3_v3(imat, vec);
}
- if(axis_flip) negate_v3(vec);
+ if (axis_flip) negate_v3(vec);
- for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
- if(EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
+ for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
/* roll func is a callback which assumes that all is well */
ebone->roll= ED_rollBoneToVector(ebone, vec, axis_only);
}
@@ -2082,8 +2082,8 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
}
if (arm->flag & ARM_MIRROR_EDIT) {
- for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
- if((EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) {
+ for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+ if ((EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) {
EditBone *ebone_mirr= ED_armature_bone_get_mirrored(arm->edbo, ebone);
if (ebone_mirr && (EBONE_VISIBLE(arm, ebone_mirr) && EBONE_EDITABLE(ebone_mirr))) {
ebone->roll= -ebone_mirr->roll;
@@ -2101,9 +2101,9 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
void ARMATURE_OT_calculate_roll(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Recalculate Roll";
- ot->idname= "ARMATURE_OT_calculate_roll";
- ot->description= "Automatically fix alignment of select bones' axes";
+ ot->name = "Recalculate Roll";
+ ot->idname = "ARMATURE_OT_calculate_roll";
+ ot->description = "Automatically fix alignment of select bones' axes";
/* api callbacks */
ot->invoke = WM_menu_invoke;
@@ -2111,10 +2111,10 @@ void ARMATURE_OT_calculate_roll(wmOperatorType *ot)
ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_calc_roll_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_calc_roll_types, 0, "Type", "");
RNA_def_boolean(ot->srna, "axis_flip", 0, "Flip Axis", "Negate the alignment axis");
RNA_def_boolean(ot->srna, "axis_only", 0, "Shortest Rotation", "Ignore the axis direction, use the shortest rotation to align");
}
@@ -2135,14 +2135,14 @@ static void undoBones_to_editBones(void *uarmv, void *armv, void *UNUSED(data))
BLI_freelistN(arm->edbo);
/* copy */
- for(ebo= uarm->lb.first; ebo; ebo= ebo->next) {
+ for (ebo= uarm->lb.first; ebo; ebo= ebo->next) {
newebo= MEM_dupallocN(ebo);
ebo->temp= newebo;
BLI_addtail(arm->edbo, newebo);
}
/* active bone */
- if(uarm->act_edbone) {
+ if (uarm->act_edbone) {
ebo= uarm->act_edbone;
arm->act_edbone= ebo->temp;
}
@@ -2150,11 +2150,11 @@ static void undoBones_to_editBones(void *uarmv, void *armv, void *UNUSED(data))
arm->act_edbone= NULL;
/* set pointers */
- for(newebo= arm->edbo->first; newebo; newebo= newebo->next) {
- if(newebo->parent) newebo->parent= newebo->parent->temp;
+ for (newebo= arm->edbo->first; newebo; newebo= newebo->next) {
+ if (newebo->parent) newebo->parent= newebo->parent->temp;
}
- /* be sure they dont hang ever */
- for(newebo= arm->edbo->first; newebo; newebo= newebo->next) {
+ /* be sure they don't hang ever */
+ for (newebo= arm->edbo->first; newebo; newebo= newebo->next) {
newebo->temp= NULL;
}
}
@@ -2168,21 +2168,21 @@ static void *editBones_to_undoBones(void *armv, void *UNUSED(obdata))
uarm= MEM_callocN(sizeof(UndoArmature), "listbase undo");
/* copy */
- for(ebo= arm->edbo->first; ebo; ebo= ebo->next) {
+ for (ebo= arm->edbo->first; ebo; ebo= ebo->next) {
newebo= MEM_dupallocN(ebo);
ebo->temp= newebo;
BLI_addtail(&uarm->lb, newebo);
}
/* active bone */
- if(arm->act_edbone) {
+ if (arm->act_edbone) {
ebo= arm->act_edbone;
uarm->act_edbone= ebo->temp;
}
/* set pointers */
- for(newebo= uarm->lb.first; newebo; newebo= newebo->next) {
- if(newebo->parent) newebo->parent= newebo->parent->temp;
+ for (newebo= uarm->lb.first; newebo; newebo= newebo->next) {
+ if (newebo->parent) newebo->parent= newebo->parent->temp;
}
return uarm;
@@ -2199,7 +2199,7 @@ static void free_undoBones(void *uarmv)
static void *get_armature_edit(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_ARMATURE) {
+ if (obedit && obedit->type==OB_ARMATURE) {
return obedit->data;
}
return NULL;
@@ -2408,9 +2408,9 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e
void ARMATURE_OT_click_extrude(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Click-Extrude";
- ot->idname= "ARMATURE_OT_click_extrude";
- ot->description= "Create a new bone going from the last selected joint to the mouse position";
+ ot->name = "Click-Extrude";
+ ot->idname = "ARMATURE_OT_click_extrude";
+ ot->description = "Create a new bone going from the last selected joint to the mouse position";
/* api callbacks */
ot->invoke = armature_click_extrude_invoke;
@@ -2418,7 +2418,7 @@ void ARMATURE_OT_click_extrude(wmOperatorType *ot)
ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
}
@@ -2541,7 +2541,7 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, const char *name, ListBase
BLI_addtail(editbones, eBone);
/* copy the ID property */
- if(curBone->prop)
+ if (curBone->prop)
eBone->prop= IDP_CopyProperty(curBone->prop);
/* Lets duplicate the list of constraints that the
@@ -2557,7 +2557,7 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, const char *name, ListBase
*/
channew= verify_pose_channel(dst_ob->pose, eBone->name);
- if(channew) {
+ if (channew) {
duplicate_pose_channel_data(channew, chanold);
}
}
@@ -2653,9 +2653,9 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op))
}
/* correct the active bone */
- if(arm->act_edbone) {
+ if (arm->act_edbone) {
eBone= arm->act_edbone;
- if(eBone->temp)
+ if (eBone->temp)
arm->act_edbone= eBone->temp;
}
@@ -2676,16 +2676,16 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op))
void ARMATURE_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Duplicate Selected Bone(s)";
- ot->idname= "ARMATURE_OT_duplicate";
- ot->description= "Make copies of the selected bones within the same armature";
+ ot->name = "Duplicate Selected Bone(s)";
+ ot->idname = "ARMATURE_OT_duplicate";
+ ot->description = "Make copies of the selected bones within the same armature";
/* api callbacks */
ot->exec = armature_duplicate_selected_exec;
ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -2950,16 +2950,16 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
void ARMATURE_OT_fill (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Fill Between Joints";
- ot->idname= "ARMATURE_OT_fill";
- ot->description= "Add bone between selected joint(s) and/or 3D-Cursor";
+ ot->name = "Fill Between Joints";
+ ot->idname = "ARMATURE_OT_fill";
+ ot->description = "Add bone between selected joint(s) and/or 3D-Cursor";
/* callbacks */
- ot->exec= armature_fill_bones_exec;
- ot->poll= ED_operator_editarmature;
+ ot->exec = armature_fill_bones_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* --------------------- */
@@ -3134,20 +3134,20 @@ void ARMATURE_OT_merge (wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Merge Bones";
- ot->idname= "ARMATURE_OT_merge";
- ot->description= "Merge continuous chains of selected bones";
+ ot->name = "Merge Bones";
+ ot->idname = "ARMATURE_OT_merge";
+ ot->description = "Merge continuous chains of selected bones";
/* callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= armature_merge_exec;
- ot->poll= ED_operator_editarmature;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = armature_merge_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= RNA_def_enum(ot->srna, "type", merge_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", merge_types, 0, "Type", "");
}
/* ************** END Add/Remove stuff in editmode ************ */
@@ -3183,16 +3183,16 @@ static int armature_hide_exec(bContext *C, wmOperator *op)
void ARMATURE_OT_hide(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Hide Selected Bones";
- ot->idname= "ARMATURE_OT_hide";
- ot->description= "Tag selected bones to not be visible in Edit Mode";
+ ot->name = "Hide Selected Bones";
+ ot->idname = "ARMATURE_OT_hide";
+ ot->description = "Tag selected bones to not be visible in Edit Mode";
/* api callbacks */
- ot->exec= armature_hide_exec;
- ot->poll= ED_operator_editarmature;
+ ot->exec = armature_hide_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
@@ -3205,7 +3205,7 @@ static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op))
EditBone *ebone;
for (ebone = arm->edbo->first; ebone; ebone=ebone->next) {
- if(arm->layer & ebone->layer) {
+ if (arm->layer & ebone->layer) {
if (ebone->flag & BONE_HIDDEN_A) {
ebone->flag |= (BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL);
ebone->flag &= ~BONE_HIDDEN_A;
@@ -3223,16 +3223,16 @@ static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op))
void ARMATURE_OT_reveal(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reveal Bones";
- ot->idname= "ARMATURE_OT_reveal";
- ot->description= "Unhide all bones that have been tagged to be hidden in Edit Mode";
+ ot->name = "Reveal Bones";
+ ot->idname = "ARMATURE_OT_reveal";
+ ot->description = "Unhide all bones that have been tagged to be hidden in Edit Mode";
/* api callbacks */
- ot->exec= armature_reveal_exec;
- ot->poll= ED_operator_editarmature;
+ ot->exec = armature_reveal_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
#if 0 // remove this?
@@ -3281,7 +3281,7 @@ void show_all_armature_bones(Scene *scene)
EditBone *ebone;
for (ebone = arm->edbo->first; ebone; ebone=ebone->next) {
- if(arm->layer & ebone->layer) {
+ if (arm->layer & ebone->layer) {
if (ebone->flag & BONE_HIDDEN_A) {
ebone->flag |= (BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL);
ebone->flag &= ~BONE_HIDDEN_A;
@@ -3386,7 +3386,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
newbone->zwidth= ebone->zwidth;
newbone->ease1= ebone->ease1;
newbone->ease2= ebone->ease2;
- newbone->rad_head= ebone->rad_tail; // dont copy entire bone...
+ newbone->rad_head= ebone->rad_tail; // don't copy entire bone...
newbone->rad_tail= ebone->rad_tail;
newbone->segments= 1;
newbone->layer= ebone->layer;
@@ -3432,16 +3432,16 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
void ARMATURE_OT_extrude(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Extrude";
- ot->idname= "ARMATURE_OT_extrude";
- ot->description= "Create new bones from the selected joints";
+ ot->name = "Extrude";
+ ot->idname = "ARMATURE_OT_extrude";
+ ot->description = "Create new bones from the selected joints";
/* api callbacks */
- ot->exec= armature_extrude_exec;
- ot->poll= ED_operator_editarmature;
+ ot->exec = armature_extrude_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_boolean(ot->srna, "forked", 0, "Forked", "");
@@ -3481,7 +3481,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
copy_v3_v3(bone->head, curs);
- if(rv3d && (U.flag & USER_ADD_VIEWALIGNED))
+ if (rv3d && (U.flag & USER_ADD_VIEWALIGNED))
add_v3_v3v3(bone->tail, bone->head, imat[1]); // bone with unit length 1
else
add_v3_v3v3(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z
@@ -3495,16 +3495,16 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
void ARMATURE_OT_bone_primitive_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Bone";
- ot->idname= "ARMATURE_OT_bone_primitive_add";
- ot->description= "Add a new bone located at the 3D-Cursor";
+ ot->name = "Add Bone";
+ ot->idname = "ARMATURE_OT_bone_primitive_add";
+ ot->description = "Add a new bone located at the 3D-Cursor";
/* api callbacks */
ot->exec = armature_bone_primitive_add_exec;
ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_string(ot->srna, "name", "Bone", MAXBONENAME, "Name", "Name of the newly created bone");
@@ -3584,20 +3584,24 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op)
void ARMATURE_OT_subdivide(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
- ot->name= "Subdivide Multi";
- ot->idname= "ARMATURE_OT_subdivide";
- ot->description= "Break selected bones into chains of smaller bones";
+ ot->name = "Subdivide Multi";
+ ot->idname = "ARMATURE_OT_subdivide";
+ ot->description = "Break selected bones into chains of smaller bones";
/* api callbacks */
ot->exec = armature_subdivide_exec;
ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* Properties */
- RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
+ prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
+ /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ----------- */
@@ -3687,16 +3691,16 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
void ARMATURE_OT_switch_direction(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Switch Direction";
- ot->idname= "ARMATURE_OT_switch_direction";
- ot->description= "Change the direction that a chain of bones points in (head <-> tail swap)";
+ ot->name = "Switch Direction";
+ ot->idname = "ARMATURE_OT_switch_direction";
+ ot->description = "Change the direction that a chain of bones points in (head <-> tail swap)";
/* api callbacks */
ot->exec = armature_switch_direction_exec;
ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ***************** Parenting *********************** */
@@ -3862,9 +3866,9 @@ static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEve
void ARMATURE_OT_parent_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Parent";
- ot->idname= "ARMATURE_OT_parent_set";
- ot->description= "Set the active bone as the parent of the selected bones";
+ ot->name = "Make Parent";
+ ot->idname = "ARMATURE_OT_parent_set";
+ ot->description = "Set the active bone as the parent of the selected bones";
/* api callbacks */
ot->invoke = armature_parent_set_invoke;
@@ -3872,7 +3876,7 @@ void ARMATURE_OT_parent_set(wmOperatorType *ot)
ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", prop_editarm_make_parent_types, 0, "ParentType", "Type of parenting");
}
@@ -3916,9 +3920,9 @@ static int armature_parent_clear_exec(bContext *C, wmOperator *op)
void ARMATURE_OT_parent_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Parent";
- ot->idname= "ARMATURE_OT_parent_clear";
- ot->description= "Remove the parent-child relationship between selected bones and their parents";
+ ot->name = "Clear Parent";
+ ot->idname = "ARMATURE_OT_parent_clear";
+ ot->description = "Remove the parent-child relationship between selected bones and their parents";
/* api callbacks */
ot->invoke = WM_menu_invoke;
@@ -3926,9 +3930,9 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot)
ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
- ot->prop= RNA_def_enum(ot->srna, "type", prop_editarm_clear_parent_types, 0, "ClearType", "What way to clear parenting");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_editarm_clear_parent_types, 0, "ClearType", "What way to clear parenting");
}
/* **************** Selections ******************/
@@ -3953,16 +3957,16 @@ static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
void ARMATURE_OT_select_inverse(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Inverse";
- ot->idname= "ARMATURE_OT_select_inverse";
- ot->description= "Flip the selection status of bones (selected -> unselected, unselected -> selected)";
+ ot->name = "Select Inverse";
+ ot->idname = "ARMATURE_OT_select_inverse";
+ ot->description = "Flip the selection status of bones (selected -> unselected, unselected -> selected)";
/* api callbacks */
- ot->exec= armature_select_inverse_exec;
- ot->poll= ED_operator_editarmature;
+ ot->exec = armature_select_inverse_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int armature_de_select_all_exec(bContext *C, wmOperator *op)
@@ -3984,7 +3988,7 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
switch (action) {
case SEL_SELECT:
ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- if(ebone->parent)
+ if (ebone->parent)
ebone->parent->flag |= (BONE_TIPSEL);
break;
case SEL_DESELECT:
@@ -3996,7 +4000,7 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
}
else {
ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- if(ebone->parent)
+ if (ebone->parent)
ebone->parent->flag |= (BONE_TIPSEL);
}
break;
@@ -4013,16 +4017,16 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
void ARMATURE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect All";
- ot->idname= "ARMATURE_OT_select_all";
- ot->description= "Toggle selection status of all bones";
+ ot->name = "(De)select All";
+ ot->idname = "ARMATURE_OT_select_all";
+ ot->description = "Toggle selection status of all bones";
/* api callbacks */
- ot->exec= armature_de_select_all_exec;
- ot->poll= ED_operator_editarmature;
+ ot->exec = armature_de_select_all_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -4094,16 +4098,16 @@ void ARMATURE_OT_select_hierarchy(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Select Hierarchy";
- ot->idname= "ARMATURE_OT_select_hierarchy";
- ot->description= "Select immediate parent/children of selected bones";
+ ot->name = "Select Hierarchy";
+ ot->idname = "ARMATURE_OT_select_hierarchy";
+ ot->description = "Select immediate parent/children of selected bones";
/* api callbacks */
- ot->exec= armature_select_hierarchy_exec;
- ot->poll= ED_operator_editarmature;
+ ot->exec = armature_select_hierarchy_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_enum(ot->srna, "direction", direction_items,
@@ -4233,9 +4237,9 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op)
void ARMATURE_OT_align(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Align Bones";
- ot->idname= "ARMATURE_OT_align";
- ot->description= "Align selected bones to the active bone (or to their parent)";
+ ot->name = "Align Bones";
+ ot->idname = "ARMATURE_OT_align";
+ ot->description = "Align selected bones to the active bone (or to their parent)";
/* api callbacks */
ot->invoke = WM_operator_confirm;
@@ -4243,7 +4247,7 @@ void ARMATURE_OT_align(wmOperatorType *ot)
ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ***************** Pose tools ********************* */
@@ -4308,7 +4312,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
else {
if (nearBone->flag & BONE_SELECTED) {
/* if not active, we make it active */
- if(nearBone != arm->act_bone) {
+ if (nearBone != arm->act_bone) {
arm->act_bone= nearBone;
}
else {
@@ -4412,7 +4416,7 @@ static int bone_skinnable_cb(Object *ob, Bone *bone, void *datap)
int a, segments;
struct { Object *armob; void *list; int heat; } *data = datap;
- if(!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) {
+ if (!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) {
if (!(bone->flag & BONE_NO_DEFORM)) {
if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name))
segments = bone->segments;
@@ -4486,7 +4490,7 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap)
else
segments = 1;
- if(!wpmode || ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED)))
+ if (!wpmode || ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED)))
if (!(defgroup = defgroup_find_name(ob, bone->name)))
defgroup = ED_vgroup_add_name(ob, bone->name);
@@ -4706,7 +4710,7 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob,
heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip,
root, tip, selected, &error);
- if(error) {
+ if (error) {
BKE_report(reports, RPT_WARNING, error);
}
}
@@ -4735,7 +4739,7 @@ void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob,
*/
bArmature *arm= par->data;
- if(mode == ARM_GROUPS_NAME) {
+ if (mode == ARM_GROUPS_NAME) {
/* Traverse the bone list, trying to create empty vertex
* groups corresponding to the bone.
*/
@@ -4744,7 +4748,7 @@ void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob,
if (ob->type == OB_MESH)
ED_vgroup_data_create(ob->data);
}
- else if(mode == ARM_GROUPS_ENVELOPE || mode == ARM_GROUPS_AUTO) {
+ else if (mode == ARM_GROUPS_ENVELOPE || mode == ARM_GROUPS_AUTO) {
/* Traverse the bone list, trying to create vertex groups
* that are populated with the vertices for which the
* bone is closest.
@@ -4953,8 +4957,8 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *op)
void POSE_OT_scale_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Pose Scale";
- ot->idname= "POSE_OT_scale_clear";
+ ot->name = "Clear Pose Scale";
+ ot->idname = "POSE_OT_scale_clear";
ot->description = "Reset scaling of selected bones to their default values";
/* api callbacks */
@@ -4962,7 +4966,7 @@ void POSE_OT_scale_clear(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -4974,8 +4978,8 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
void POSE_OT_rot_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Pose Rotation";
- ot->idname= "POSE_OT_rot_clear";
+ ot->name = "Clear Pose Rotation";
+ ot->idname = "POSE_OT_rot_clear";
ot->description = "Reset rotations of selected bones to their default values";
/* api callbacks */
@@ -4983,7 +4987,7 @@ void POSE_OT_rot_clear(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -4995,8 +4999,8 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *op)
void POSE_OT_loc_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Pose Location";
- ot->idname= "POSE_OT_loc_clear";
+ ot->name = "Clear Pose Location";
+ ot->idname = "POSE_OT_loc_clear";
ot->description = "Reset locations of selected bones to their default values";
/* api callbacks */
@@ -5004,7 +5008,7 @@ void POSE_OT_loc_clear(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -5016,8 +5020,8 @@ static int pose_clear_transforms_exec(bContext *C, wmOperator *op)
void POSE_OT_transforms_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Pose Transforms";
- ot->idname= "POSE_OT_transforms_clear";
+ ot->name = "Clear Pose Transforms";
+ ot->idname = "POSE_OT_transforms_clear";
ot->description = "Reset location, rotation, and scaling of selected bones to their default values";
/* api callbacks */
@@ -5025,7 +5029,7 @@ void POSE_OT_transforms_clear(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ***************** selections ********************** */
@@ -5077,16 +5081,16 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op)
void POSE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect All";
- ot->idname= "POSE_OT_select_all";
- ot->description= "Toggle selection status of all bones";
+ ot->name = "(De)select All";
+ ot->idname = "POSE_OT_select_all";
+ ot->description = "Toggle selection status of all bones";
/* api callbacks */
- ot->exec= pose_de_select_all_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_de_select_all_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -5121,16 +5125,16 @@ static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op))
void POSE_OT_select_parent(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Parent Bone";
- ot->idname= "POSE_OT_select_parent";
- ot->description= "Select bones that are parents of the currently selected bones";
+ ot->name = "Select Parent Bone";
+ ot->idname = "POSE_OT_select_parent";
+ ot->description = "Select bones that are parents of the currently selected bones";
/* api callbacks */
- ot->exec= pose_select_parent_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_select_parent_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -5144,7 +5148,7 @@ static int hide_selected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
if (bone->flag & BONE_SELECTED) {
bone->flag |= BONE_HIDDEN_P;
bone->flag &= ~BONE_SELECTED;
- if(arm->act_bone==bone)
+ if (arm->act_bone==bone)
arm->act_bone= NULL;
}
}
@@ -5159,7 +5163,7 @@ static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr
// hrm... typo here?
if ((bone->flag & BONE_SELECTED)==0) {
bone->flag |= BONE_HIDDEN_P;
- if(arm->act_bone==bone)
+ if (arm->act_bone==bone)
arm->act_bone= NULL;
}
}
@@ -5172,7 +5176,7 @@ static int pose_hide_exec(bContext *C, wmOperator *op)
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm= ob->data;
- if(RNA_boolean_get(op->ptr, "unselected"))
+ if (RNA_boolean_get(op->ptr, "unselected"))
bone_looper(ob, arm->bonebase.first, NULL, hide_unselected_pose_bone_cb);
else
bone_looper(ob, arm->bonebase.first, NULL, hide_selected_pose_bone_cb);
@@ -5186,16 +5190,16 @@ static int pose_hide_exec(bContext *C, wmOperator *op)
void POSE_OT_hide(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Hide Selected";
- ot->idname= "POSE_OT_hide";
- ot->description= "Tag selected bones to not be visible in Pose Mode";
+ ot->name = "Hide Selected";
+ ot->idname = "POSE_OT_hide";
+ ot->description = "Tag selected bones to not be visible in Pose Mode";
/* api callbacks */
- ot->exec= pose_hide_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_hide_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "");
@@ -5232,16 +5236,16 @@ static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op))
void POSE_OT_reveal(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reveal Selected";
- ot->idname= "POSE_OT_reveal";
- ot->description= "Unhide all bones that have been tagged to be hidden in Pose Mode";
+ ot->name = "Reveal Selected";
+ ot->idname = "POSE_OT_reveal";
+ ot->description = "Unhide all bones that have been tagged to be hidden in Pose Mode";
/* api callbacks */
- ot->exec= pose_reveal_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_reveal_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************* RENAMING DISASTERS ************ */
@@ -5292,7 +5296,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
char oldname[MAXBONENAME];
/* names better differ! */
- if(strncmp(oldnamep, newnamep, MAXBONENAME)) {
+ if (strncmp(oldnamep, newnamep, MAXBONENAME)) {
/* we alter newname string... so make copy */
BLI_strncpy(newname, newnamep, MAXBONENAME);
@@ -5367,7 +5371,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
if (modifiers_usesArmature(ob, arm)) {
bDeformGroup *dg= defgroup_find_name(ob, oldname);
- if(dg) {
+ if (dg) {
BLI_strncpy(dg->name, newname, MAXBONENAME);
}
}
@@ -5394,15 +5398,15 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
/* correct view locking */
{
bScreen *screen;
- for(screen= G.main->screen.first; screen; screen= screen->id.next) {
+ for (screen= G.main->screen.first; screen; screen= screen->id.next) {
ScrArea *sa;
/* add regions */
- for(sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *)sl;
- if(v3d->ob_centre && v3d->ob_centre->data == arm) {
+ if (v3d->ob_centre && v3d->ob_centre->data == arm) {
if (!strcmp(v3d->ob_centre_bone, oldname)) {
BLI_strncpy(v3d->ob_centre_bone, newname, MAXBONENAME);
}
@@ -5447,16 +5451,16 @@ static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
void ARMATURE_OT_flip_names (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Flip Names";
- ot->idname= "ARMATURE_OT_flip_names";
- ot->description= "Flips (and corrects) the axis suffixes of the names of selected bones";
+ ot->name = "Flip Names";
+ ot->idname = "ARMATURE_OT_flip_names";
+ ot->description = "Flips (and corrects) the axis suffixes of the names of selected bones";
/* api callbacks */
- ot->exec= armature_flip_names_exec;
- ot->poll= ED_operator_editarmature;
+ ot->exec = armature_flip_names_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -5476,7 +5480,7 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
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]))
+ if (bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis]))
ED_armature_bone_rename(arm, ebone->name, newname);
}
CTX_DATA_END;
@@ -5499,20 +5503,20 @@ void ARMATURE_OT_autoside_names (wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "AutoName by Axis";
- ot->idname= "ARMATURE_OT_autoside_names";
- ot->description= "Automatically renames the selected bones according to which side of the target axis they fall on";
+ ot->name = "AutoName by Axis";
+ ot->idname = "ARMATURE_OT_autoside_names";
+ ot->description = "Automatically renames the selected bones according to which side of the target axis they fall on";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= armature_autoside_names_exec;
- ot->poll= ED_operator_editarmature;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = armature_autoside_names_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* settings */
- ot->prop= RNA_def_enum(ot->srna, "type", axis_items, 0, "Axis", "Axis tag names with");
+ ot->prop = RNA_def_enum(ot->srna, "type", axis_items, 0, "Axis", "Axis tag names with");
}
@@ -5638,7 +5642,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode
* to let subsequent subdivision methods do their thing.
* */
if (parent == root) {
- if(parent==arm->act_edbone) arm->act_edbone= NULL;
+ if (parent==arm->act_edbone) arm->act_edbone= NULL;
ED_armature_edit_bone_remove(arm, parent);
parent = NULL;
}
@@ -5858,7 +5862,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
EditBone *childBone = BLI_ghash_lookup(arcBoneMap, arc);
/* find the root bone */
- while(childBone->parent != NULL)
+ while (childBone->parent != NULL)
{
childBone = childBone->parent;
}
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 375184d3229..261018329ab 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -323,7 +323,7 @@ static RigGraph *newRigGraph(void)
rg->free_node = NULL;
#ifdef USE_THREADS
-// if(G.scene->r.mode & R_FIXED_THREADS)
+// if (G.scene->r.mode & R_FIXED_THREADS)
// {
// totthread = G.scene->r.threads;
// }
@@ -1008,7 +1008,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
/* 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);
@@ -1298,7 +1298,7 @@ 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;
@@ -1550,7 +1550,7 @@ RigGraph *RIG_graphFromArmature(const bContext *C, Object *ob, bArmature *arm)
rg->ob = ob;
/* Do the rotations */
- for (ebone = rg->editbones->first; ebone; ebone=ebone->next){
+ for (ebone = rg->editbones->first; ebone; ebone=ebone->next) {
if (ebone->parent == NULL)
{
RIG_arcFromBoneChain(rg, rg->editbones, ebone, NULL, 0);
@@ -1602,7 +1602,7 @@ static RigGraph *armatureSelectedToGraph(bContext *C, Object *ob, bArmature *arm
rg->ob = ob;
/* Do the rotations */
- for (ebone = rg->editbones->first; ebone; ebone=ebone->next){
+ for (ebone = rg->editbones->first; ebone; ebone=ebone->next) {
if (ebone->parent == NULL)
{
RIG_arcFromBoneChain(rg, rg->editbones, ebone, NULL, 1);
@@ -2488,7 +2488,7 @@ 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];
@@ -2593,7 +2593,7 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
// RIG_printArcBones(next_iarc);
// }
- for(i = 0; i < enode->degree; i++)
+ for (i = 0; i < enode->degree; i++)
{
next_earc = (ReebArc*)enode->arcs[i];
@@ -2644,14 +2644,14 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
// printf("flag %i -- level %i -- flag %i -- group %i\n", ARC_FREE, symmetry_level, symmetry_flag, symmetry_group);
//
// printf("CANDIDATES\n");
-// for(i = 0; i < enode->degree; i++)
+// for (i = 0; i < enode->degree; i++)
// {
// next_earc = (ReebArc*)enode->arcs[i];
// 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);
// }
/* Emergency matching */
- for(i = 0; i < enode->degree; i++)
+ for (i = 0; i < enode->degree; i++)
{
next_earc = (ReebArc*)enode->arcs[i];
@@ -2687,7 +2687,7 @@ 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];
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 9ea731150e8..81b020a4cf9 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -1079,7 +1079,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
mvalf[0]= dd->mval[0];
mvalf[1]= dd->mval[1];
- peelObjectsContext(C, &sketch->depth_peels, mvalf);
+ peelObjectsContext(C, &sketch->depth_peels, mvalf, SNAP_ALL);
if (stk->nb_points > 0 && stk->points[stk->nb_points - 1].type == PT_CONTINUOUS)
{
@@ -1870,7 +1870,7 @@ int sk_detectCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
SK_Intersection *isect, *self_isect;
/* get the the last intersection of the first pair */
- for( isect = gest->intersections.first; isect; isect = isect->next )
+ for ( isect = gest->intersections.first; isect; isect = isect->next )
{
if (isect->stroke == isect->next->stroke)
{
@@ -1897,7 +1897,7 @@ void sk_applyCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
// XXX
// command = pupmenu("Action %t|Flatten %x1|Straighten %x2|Polygonize %x3");
- if(command < 1) return;
+ if (command < 1) return;
for (isect = gest->intersections.first; isect; isect = isect->next)
{
@@ -2166,10 +2166,10 @@ static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], in
view3d_set_viewcontext(C, &vc);
- rect.xmin= mval[0]-5;
- rect.xmax= mval[0]+5;
- rect.ymin= mval[1]-5;
- rect.ymax= mval[1]+5;
+ rect.xmin = mval[0]-5;
+ rect.xmax = mval[0]+5;
+ rect.ymin = mval[1]-5;
+ rect.ymax = mval[1]+5;
hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
@@ -2177,7 +2177,7 @@ static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], in
{
int besthitresult = -1;
- if(hits == 1) {
+ if (hits == 1) {
besthitresult = buffer[3];
}
else {
@@ -2839,130 +2839,130 @@ int ED_operator_sketch_mode(const bContext *C)
void SKETCH_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete";
- ot->idname= "SKETCH_OT_delete";
+ ot->name = "Delete";
+ ot->idname = "SKETCH_OT_delete";
/* api callbacks */
- ot->invoke= sketch_delete;
+ ot->invoke = sketch_delete;
- ot->poll= ED_operator_sketch_full_mode;
+ ot->poll = ED_operator_sketch_full_mode;
/* flags */
-// ot->flag= OPTYPE_UNDO;
+// ot->flag = OPTYPE_UNDO;
}
void SKETCH_OT_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select";
- ot->idname= "SKETCH_OT_select";
+ ot->name = "Select";
+ ot->idname = "SKETCH_OT_select";
/* api callbacks */
- ot->invoke= sketch_select;
+ ot->invoke = sketch_select;
- ot->poll= ED_operator_sketch_full_mode;
+ ot->poll = ED_operator_sketch_full_mode;
/* flags */
-// ot->flag= OPTYPE_UNDO;
+// ot->flag = OPTYPE_UNDO;
}
void SKETCH_OT_cancel_stroke(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Cancel Stroke";
- ot->idname= "SKETCH_OT_cancel_stroke";
+ ot->name = "Cancel Stroke";
+ ot->idname = "SKETCH_OT_cancel_stroke";
/* api callbacks */
- ot->invoke= sketch_cancel;
+ ot->invoke = sketch_cancel;
- ot->poll= ED_operator_sketch_mode_active_stroke;
+ ot->poll = ED_operator_sketch_mode_active_stroke;
/* flags */
-// ot->flag= OPTYPE_UNDO;
+// ot->flag = OPTYPE_UNDO;
}
void SKETCH_OT_convert(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Convert";
- ot->idname= "SKETCH_OT_convert";
+ ot->name = "Convert";
+ ot->idname = "SKETCH_OT_convert";
/* api callbacks */
- ot->invoke= sketch_convert;
+ ot->invoke = sketch_convert;
- ot->poll= ED_operator_sketch_full_mode;
+ ot->poll = ED_operator_sketch_full_mode;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
}
void SKETCH_OT_finish_stroke(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "End Stroke";
- ot->idname= "SKETCH_OT_finish_stroke";
+ ot->name = "End Stroke";
+ ot->idname = "SKETCH_OT_finish_stroke";
/* api callbacks */
- ot->invoke= sketch_finish;
+ ot->invoke = sketch_finish;
- ot->poll= ED_operator_sketch_mode_active_stroke;
+ ot->poll = ED_operator_sketch_mode_active_stroke;
/* flags */
-// ot->flag= OPTYPE_UNDO;
+// ot->flag = OPTYPE_UNDO;
}
void SKETCH_OT_draw_preview(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Draw Preview";
- ot->idname= "SKETCH_OT_draw_preview";
+ ot->name = "Draw Preview";
+ ot->idname = "SKETCH_OT_draw_preview";
/* api callbacks */
- ot->invoke= sketch_draw_preview;
+ ot->invoke = sketch_draw_preview;
- ot->poll= ED_operator_sketch_mode_active_stroke;
+ ot->poll = ED_operator_sketch_mode_active_stroke;
RNA_def_boolean(ot->srna, "snap", 0, "Snap", "");
/* flags */
-// ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+// ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
void SKETCH_OT_draw_stroke(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Draw Stroke";
- ot->idname= "SKETCH_OT_draw_stroke";
+ ot->name = "Draw Stroke";
+ ot->idname = "SKETCH_OT_draw_stroke";
/* api callbacks */
ot->invoke = sketch_draw_stroke;
ot->modal = sketch_draw_stroke_modal;
ot->cancel = sketch_draw_stroke_cancel;
- ot->poll= (int (*)(bContext *))ED_operator_sketch_mode;
+ ot->poll = (int (*)(bContext *))ED_operator_sketch_mode;
RNA_def_boolean(ot->srna, "snap", 0, "Snap", "");
/* flags */
- ot->flag= OPTYPE_BLOCKING; // OPTYPE_REGISTER|OPTYPE_UNDO
+ ot->flag = OPTYPE_BLOCKING; // OPTYPE_REGISTER|OPTYPE_UNDO
}
void SKETCH_OT_gesture(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Gesture";
- ot->idname= "SKETCH_OT_gesture";
+ ot->name = "Gesture";
+ ot->idname = "SKETCH_OT_gesture";
/* api callbacks */
ot->invoke = sketch_draw_gesture;
ot->modal = sketch_draw_gesture_modal;
ot->cancel = sketch_draw_gesture_cancel;
- ot->poll= ED_operator_sketch_mode_gesture;
+ ot->poll = ED_operator_sketch_mode_gesture;
RNA_def_boolean(ot->srna, "snap", 0, "Snap", "");
/* flags */
- ot->flag= OPTYPE_BLOCKING; // OPTYPE_UNDO
+ ot->flag = OPTYPE_BLOCKING; // OPTYPE_UNDO
}
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index eb707119263..4c1315e847e 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -47,6 +47,8 @@
#include "BLI_memarena.h"
#include "BLI_string.h"
+#include "BLF_translation.h"
+
#include "BKE_DerivedMesh.h"
#include "BKE_modifier.h"
#include "BKE_mesh.h"
@@ -140,7 +142,7 @@ static void laplacian_increase_edge_count(EdgeHash *edgehash, int v1, int v2)
{
void **p = BLI_edgehash_lookup_p(edgehash, v1, v2);
- if(p)
+ if (p)
*p = (void*)((intptr_t)*p + (intptr_t)1);
else
BLI_edgehash_insert(edgehash, v1, v2, (void*)(intptr_t)1);
@@ -182,8 +184,8 @@ static void laplacian_triangle_area(LaplacianSystem *sys, int i1, int i2, int i3
t3= cotan_weight(v3, v1, v2);
if (angle_v3v3v3(v2, v1, v3) > DEG2RADF(90.0f)) obtuse= 1;
- else if(angle_v3v3v3(v1, v2, v3) > DEG2RADF(90.0f)) obtuse= 2;
- else if(angle_v3v3v3(v1, v3, v2) > DEG2RADF(90.0f)) obtuse= 3;
+ else if (angle_v3v3v3(v1, v2, v3) > DEG2RADF(90.0f)) obtuse= 2;
+ else if (angle_v3v3v3(v1, v3, v2) > DEG2RADF(90.0f)) obtuse= 3;
if (obtuse > 0) {
area= area_tri_v3(v1, v2, v3);
@@ -235,7 +237,7 @@ static void laplacian_triangle_weights(LaplacianSystem *sys, int f, int i1, int
nlMatrixAdd(i3, i1, -t2*varea[i3]);
nlMatrixAdd(i1, i3, -t2*varea[i1]);
- if(sys->storeweights) {
+ if (sys->storeweights) {
sys->fweights[f][0]= t1*varea[i1];
sys->fweights[f][1]= t2*varea[i2];
sys->fweights[f][2]= t3*varea[i3];
@@ -261,7 +263,7 @@ static LaplacianSystem *laplacian_system_construct_begin(int totvert, int totfac
/* create opennl context */
nlNewContext();
nlSolverParameteri(NL_NB_VARIABLES, totvert);
- if(lsq)
+ if (lsq)
nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);
sys->context= nlGetCurrent();
@@ -294,39 +296,39 @@ static void laplacian_system_construct_end(LaplacianSystem *sys)
sys->varea= MEM_callocN(sizeof(float)*totvert, "LaplacianSystemVarea");
sys->edgehash= BLI_edgehash_new();
- for(a=0, face=sys->faces; a<sys->totface; a++, face++) {
+ for (a=0, face=sys->faces; a<sys->totface; a++, face++) {
laplacian_increase_edge_count(sys->edgehash, (*face)[0], (*face)[1]);
laplacian_increase_edge_count(sys->edgehash, (*face)[1], (*face)[2]);
laplacian_increase_edge_count(sys->edgehash, (*face)[2], (*face)[0]);
}
- if(sys->areaweights)
- for(a=0, face=sys->faces; a<sys->totface; a++, face++)
+ if (sys->areaweights)
+ for (a=0, face=sys->faces; a<sys->totface; a++, face++)
laplacian_triangle_area(sys, (*face)[0], (*face)[1], (*face)[2]);
- for(a=0; a<totvert; a++) {
- if(sys->areaweights) {
- if(sys->varea[a] != 0.0f)
+ for (a=0; a<totvert; a++) {
+ if (sys->areaweights) {
+ if (sys->varea[a] != 0.0f)
sys->varea[a]= 0.5f/sys->varea[a];
}
else
sys->varea[a]= 1.0f;
/* for heat weighting */
- if(sys->heat.H)
+ if (sys->heat.H)
nlMatrixAdd(a, a, sys->heat.H[a]);
}
- if(sys->storeweights)
+ if (sys->storeweights)
sys->fweights= MEM_callocN(sizeof(float)*3*totface, "LaplacianFWeight");
- for(a=0, face=sys->faces; a<totface; a++, face++)
+ for (a=0, face=sys->faces; a<totface; a++, face++)
laplacian_triangle_weights(sys, a, (*face)[0], (*face)[1], (*face)[2]);
MEM_freeN(sys->faces);
sys->faces= NULL;
- if(sys->varea) {
+ if (sys->varea) {
MEM_freeN(sys->varea);
sys->varea= NULL;
}
@@ -337,11 +339,11 @@ static void laplacian_system_construct_end(LaplacianSystem *sys)
static void laplacian_system_delete(LaplacianSystem *sys)
{
- if(sys->verts) MEM_freeN(sys->verts);
- if(sys->varea) MEM_freeN(sys->varea);
- if(sys->vpinned) MEM_freeN(sys->vpinned);
- if(sys->faces) MEM_freeN(sys->faces);
- if(sys->fweights) MEM_freeN(sys->fweights);
+ if (sys->verts) MEM_freeN(sys->verts);
+ if (sys->varea) MEM_freeN(sys->varea);
+ if (sys->vpinned) MEM_freeN(sys->vpinned);
+ if (sys->faces) MEM_freeN(sys->faces);
+ if (sys->fweights) MEM_freeN(sys->fweights);
nlDeleteContext(sys->context);
MEM_freeN(sys);
@@ -354,9 +356,9 @@ void laplacian_begin_solve(LaplacianSystem *sys, int index)
if (!sys->nlbegun) {
nlBegin(NL_SYSTEM);
- if(index >= 0) {
- for(a=0; a<sys->totvert; a++) {
- if(sys->vpinned[a]) {
+ if (index >= 0) {
+ for (a=0; a<sys->totvert; a++) {
+ if (sys->vpinned[a]) {
nlSetVariable(0, a, sys->verts[a][index]);
nlLockVariable(a);
}
@@ -413,9 +415,9 @@ static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray
mul_v3_v3fl(dir, data->vec, hit->dist);
- if(isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v2], verts[mf->v3], &lambda, uv)) {
+ if (isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v2], verts[mf->v3], &lambda, uv)) {
normal_tri_v3(n, verts[mf->v1], verts[mf->v2], verts[mf->v3]);
- if(lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
+ if (lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
hit->index = index;
hit->dist *= lambda;
}
@@ -423,9 +425,9 @@ static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray
mul_v3_v3fl(dir, data->vec, hit->dist);
- if(isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v3], verts[mf->v4], &lambda, uv)) {
+ if (isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v3], verts[mf->v4], &lambda, uv)) {
normal_tri_v3(n, verts[mf->v1], verts[mf->v3], verts[mf->v4]);
- if(lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
+ if (lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
hit->index = index;
hit->dist *= lambda;
}
@@ -444,7 +446,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
sys->heat.bvhtree = BLI_bvhtree_new(totface, 0.0f, 4, 6);
sys->heat.vface = MEM_callocN(sizeof(MFace*)*totvert, "HeatVFaces");
- for(a=0; a<totface; a++) {
+ for (a=0; a<totface; a++) {
MFace *mf = mface+a;
float bb[6];
@@ -452,7 +454,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
DO_MINMAX(verts[mf->v1], bb, bb+3);
DO_MINMAX(verts[mf->v2], bb, bb+3);
DO_MINMAX(verts[mf->v3], bb, bb+3);
- if(mf->v4) {
+ if (mf->v4) {
DO_MINMAX(verts[mf->v4], bb, bb+3);
}
@@ -462,7 +464,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
sys->heat.vface[mf->v1]= mf;
sys->heat.vface[mf->v2]= mf;
sys->heat.vface[mf->v3]= mf;
- if(mf->v4) sys->heat.vface[mf->v4]= mf;
+ if (mf->v4) sys->heat.vface[mf->v4]= mf;
}
BLI_bvhtree_balance(sys->heat.bvhtree);
@@ -477,13 +479,13 @@ static int heat_ray_source_visible(LaplacianSystem *sys, int vertex, int source)
int visible;
mface= sys->heat.vface[vertex];
- if(!mface)
+ if (!mface)
return 1;
data.sys= sys;
copy_v3_v3(data.start, sys->heat.verts[vertex]);
- if(sys->heat.root) /* bone */
+ if (sys->heat.root) /* bone */
closest_to_line_segment_v3(end, data.start,
sys->heat.root[source], sys->heat.tip[source]);
else /* vertex */
@@ -507,7 +509,7 @@ static float heat_source_distance(LaplacianSystem *sys, int vertex, int source)
float closest[3], d[3], dist, cosine;
/* compute euclidian distance */
- if(sys->heat.root) /* bone */
+ if (sys->heat.root) /* bone */
closest_to_line_segment_v3(closest, sys->heat.verts[vertex],
sys->heat.root[source], sys->heat.tip[source]);
else /* vertex */
@@ -528,8 +530,8 @@ static int heat_source_closest(LaplacianSystem *sys, int vertex, int source)
dist= heat_source_distance(sys, vertex, source);
- if(dist <= sys->heat.mindist[vertex]*(1.0f + DISTANCE_EPSILON))
- if(heat_ray_source_visible(sys, vertex, source))
+ if (dist <= sys->heat.mindist[vertex]*(1.0f + DISTANCE_EPSILON))
+ if (heat_ray_source_visible(sys, vertex, source))
return 1;
return 0;
@@ -543,24 +545,24 @@ static void heat_set_H(LaplacianSystem *sys, int vertex)
mindist= 1e10;
/* compute minimum distance */
- for(j=0; j<sys->heat.numsource; j++) {
+ for (j=0; j<sys->heat.numsource; j++) {
dist= heat_source_distance(sys, vertex, j);
- if(dist < mindist)
+ if (dist < mindist)
mindist= dist;
}
sys->heat.mindist[vertex]= mindist;
/* count number of sources with approximately this minimum distance */
- for(j=0; j<sys->heat.numsource; j++)
- if(heat_source_closest(sys, vertex, j))
+ for (j=0; j<sys->heat.numsource; j++)
+ if (heat_source_closest(sys, vertex, j))
numclosest++;
sys->heat.p[vertex]= (numclosest > 0)? 1.0f/numclosest: 0.0f;
/* compute H entry */
- if(numclosest > 0) {
+ if (numclosest > 0) {
mindist= maxf(mindist, 1e-4f);
h= numclosest*C_WEIGHT/(mindist*mindist);
}
@@ -577,7 +579,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
sys->heat.vnors= MEM_callocN(sizeof(float)*3*sys->totvert, "HeatVNors");
- for(a=0, face=sys->faces; a<sys->totface; a++, face++) {
+ for (a=0, face=sys->faces; a<sys->totface; a++, face++) {
v1= (*face)[0];
v2= (*face)[1];
v3= (*face)[2];
@@ -589,7 +591,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
add_v3_v3(sys->heat.vnors[v3], fnor);
}
- for(a=0; a<sys->totvert; a++)
+ for (a=0; a<sys->totvert; a++)
normalize_v3(sys->heat.vnors[a]);
}
@@ -606,19 +608,19 @@ static void heat_laplacian_create(LaplacianSystem *sys)
sys->heat.p= MEM_callocN(sizeof(float)*totvert, "HeatP");
/* add verts and faces to laplacian */
- for(a=0; a<totvert; a++)
+ for (a=0; a<totvert; a++)
laplacian_add_vertex(sys, sys->heat.verts[a], 0);
- for(a=0, mf=mface; a<totface; a++, mf++) {
+ for (a=0, mf=mface; a<totface; a++, mf++) {
laplacian_add_triangle(sys, mf->v1, mf->v2, mf->v3);
- if(mf->v4)
+ if (mf->v4)
laplacian_add_triangle(sys, mf->v1, mf->v3, mf->v4);
}
/* for distance computation in set_H */
heat_calc_vnormals(sys);
- for(a=0; a<totvert; a++)
+ for (a=0; a<totvert; a++)
heat_set_H(sys, a);
}
@@ -637,10 +639,10 @@ static float heat_limit_weight(float weight)
{
float t;
- if(weight < WEIGHT_LIMIT_END) {
+ if (weight < WEIGHT_LIMIT_END) {
return 0.0f;
}
- else if(weight < WEIGHT_LIMIT_START) {
+ else if (weight < WEIGHT_LIMIT_START) {
t= (weight - WEIGHT_LIMIT_END)/(WEIGHT_LIMIT_START - WEIGHT_LIMIT_END);
return t*WEIGHT_LIMIT_START;
}
@@ -665,15 +667,15 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
*err_str= NULL;
/* count triangles and create mask */
- if( (use_face_sel= (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
+ if ( (use_face_sel= (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
(use_vert_sel= ((me->editflag & ME_EDIT_VERT_SEL) != 0)))
{
mask= MEM_callocN(sizeof(int)*me->totvert, "heat_bone_weighting mask");
}
- for(a = 0, mp=me->mpoly; a < me->totpoly; mp++, a++) {
+ for (a = 0, mp=me->mpoly; a < me->totpoly; mp++, a++) {
/* (added selectedVerts content for vertex mask, they used to just equal 1) */
- if(use_vert_sel) {
+ if (use_vert_sel) {
for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
if (use_vert_sel) {
mask[ml->v] = (mvert[ml->v].flag & SELECT) != 0;
@@ -692,9 +694,9 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
/* bone heat needs triangulated faces */
BKE_mesh_tessface_ensure(me);
- for(tottri = 0, a = 0, mf = me->mface; a < me->totface; mf++, a++) {
+ for (tottri = 0, a = 0, mf = me->mface; a < me->totface; mf++, a++) {
tottri++;
- if(mf->v4) tottri++;
+ if (mf->v4) tottri++;
}
/* create laplacian */
@@ -713,15 +715,15 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
laplacian_system_construct_end(sys);
- if(dgroupflip) {
+ if (dgroupflip) {
vertsflipped = MEM_callocN(sizeof(int)*me->totvert, "vertsflipped");
- for(a=0; a<me->totvert; a++)
+ for (a=0; a<me->totvert; a++)
vertsflipped[a] = mesh_get_x_mirror_vert(ob, a);
}
/* compute weights per bone */
- for(j=0; j<numsource; j++) {
- if(!selected[j])
+ for (j=0; j<numsource; j++) {
+ if (!selected[j])
continue;
firstsegment= (j == 0 || dgrouplist[j-1] != dgrouplist[j]);
@@ -729,13 +731,13 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
bbone= !(firstsegment && lastsegment);
/* clear weights */
- if(bbone && firstsegment) {
- for(a=0; a<me->totvert; a++) {
- if(mask && !mask[a])
+ if (bbone && firstsegment) {
+ for (a=0; a<me->totvert; a++) {
+ if (mask && !mask[a])
continue;
ED_vgroup_vert_remove(ob, dgrouplist[j], a);
- if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0)
+ if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0)
ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
}
}
@@ -743,28 +745,28 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
/* fill right hand side */
laplacian_begin_solve(sys, -1);
- for(a=0; a<me->totvert; a++)
- if(heat_source_closest(sys, a, j))
+ for (a=0; a<me->totvert; a++)
+ if (heat_source_closest(sys, a, j))
laplacian_add_right_hand_side(sys, a,
sys->heat.H[a]*sys->heat.p[a]);
/* solve */
- if(laplacian_system_solve(sys)) {
+ if (laplacian_system_solve(sys)) {
/* load solution into vertex groups */
- for(a=0; a<me->totvert; a++) {
- if(mask && !mask[a])
+ for (a=0; a<me->totvert; a++) {
+ if (mask && !mask[a])
continue;
solution= laplacian_system_get_solution(a);
- if(bbone) {
- if(solution > 0.0f)
+ if (bbone) {
+ if (solution > 0.0f)
ED_vgroup_vert_add(ob, dgrouplist[j], a, solution,
WEIGHT_ADD);
}
else {
weight= heat_limit_weight(solution);
- if(weight > 0.0f)
+ if (weight > 0.0f)
ED_vgroup_vert_add(ob, dgrouplist[j], a, weight,
WEIGHT_REPLACE);
else
@@ -772,15 +774,15 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
}
/* do same for mirror */
- if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
- if(bbone) {
- if(solution > 0.0f)
+ if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
+ if (bbone) {
+ if (solution > 0.0f)
ED_vgroup_vert_add(ob, dgroupflip[j], vertsflipped[a],
solution, WEIGHT_ADD);
}
else {
weight= heat_limit_weight(solution);
- if(weight > 0.0f)
+ if (weight > 0.0f)
ED_vgroup_vert_add(ob, dgroupflip[j], vertsflipped[a],
weight, WEIGHT_REPLACE);
else
@@ -789,26 +791,26 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
}
}
}
- else if(*err_str == NULL) {
+ else if (*err_str == NULL) {
*err_str= "Bone Heat Weighting: failed to find solution for one or more bones";
break;
}
/* remove too small vertex weights */
- if(bbone && lastsegment) {
- for(a=0; a<me->totvert; a++) {
- if(mask && !mask[a])
+ if (bbone && lastsegment) {
+ for (a=0; a<me->totvert; a++) {
+ if (mask && !mask[a])
continue;
weight= ED_vgroup_vert_weight(ob, dgrouplist[j], a);
weight= heat_limit_weight(weight);
- if(weight <= 0.0f)
+ if (weight <= 0.0f)
ED_vgroup_vert_remove(ob, dgrouplist[j], a);
- if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
+ if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
weight= ED_vgroup_vert_weight(ob, dgroupflip[j], vertsflipped[a]);
weight= heat_limit_weight(weight);
- if(weight <= 0.0f)
+ if (weight <= 0.0f)
ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
}
}
@@ -816,8 +818,8 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
}
/* free */
- if(vertsflipped) MEM_freeN(vertsflipped);
- if(mask) MEM_freeN(mask);
+ if (vertsflipped) MEM_freeN(vertsflipped);
+ if (mask) MEM_freeN(mask);
heat_system_free(sys);
@@ -901,7 +903,7 @@ void rigid_deform_iteration()
EditFace *efa;
int a, i;
- if(!sys)
+ if (!sys)
return;
nlMakeCurrent(sys->context);
@@ -911,12 +913,12 @@ void rigid_deform_iteration()
memset(sys->rigid.R, 0, sizeof(float)*3*3*sys->totvert);
memset(sys->rigid.rhs, 0, sizeof(float)*3*sys->totvert);
- for(a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
+ for (a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
rigid_add_edge_to_R(sys, efa->v1, efa->v2, sys->fweights[a][2]);
rigid_add_edge_to_R(sys, efa->v2, efa->v3, sys->fweights[a][0]);
rigid_add_edge_to_R(sys, efa->v3, efa->v1, sys->fweights[a][1]);
- if(efa->v4) {
+ if (efa->v4) {
a++;
rigid_add_edge_to_R(sys, efa->v1, efa->v3, sys->fweights[a][2]);
rigid_add_edge_to_R(sys, efa->v3, efa->v4, sys->fweights[a][0]);
@@ -924,18 +926,18 @@ void rigid_deform_iteration()
}
}
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
+ for (a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
rigid_orthogonalize_R(sys->rigid.R[a]);
eve->tmp.l= a;
}
/* compute right hand sides for solving */
- for(a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
+ for (a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
rigid_add_edge_to_rhs(sys, efa->v1, efa->v2, sys->fweights[a][2]);
rigid_add_edge_to_rhs(sys, efa->v2, efa->v3, sys->fweights[a][0]);
rigid_add_edge_to_rhs(sys, efa->v3, efa->v1, sys->fweights[a][1]);
- if(efa->v4) {
+ if (efa->v4) {
a++;
rigid_add_edge_to_rhs(sys, efa->v1, efa->v3, sys->fweights[a][2]);
rigid_add_edge_to_rhs(sys, efa->v3, efa->v4, sys->fweights[a][0]);
@@ -944,19 +946,19 @@ void rigid_deform_iteration()
}
/* solve for positions, for X,Y and Z separately */
- for(i=0; i<3; i++) {
+ for (i=0; i<3; i++) {
laplacian_begin_solve(sys, i);
- for(a=0; a<sys->totvert; a++)
- if(!sys->vpinned[a])
+ for (a=0; a<sys->totvert; a++)
+ if (!sys->vpinned[a])
laplacian_add_right_hand_side(sys, a, sys->rigid.rhs[a][i]);
- if(laplacian_system_solve(sys)) {
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
+ if (laplacian_system_solve(sys)) {
+ for (a=0, eve=em->verts.first; eve; eve=eve->next, a++)
eve->co[i]= laplacian_system_get_solution(a);
}
else {
- if(!sys->rigid.thrownerror) {
+ if (!sys->rigid.thrownerror) {
error("RigidDeform: failed to find solution");
sys->rigid.thrownerror= 1;
}
@@ -973,15 +975,15 @@ static void rigid_laplacian_create(LaplacianSystem *sys)
int a;
/* add verts and faces to laplacian */
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
+ for (a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
laplacian_add_vertex(sys, eve->co, eve->pinned);
eve->tmp.l= a;
}
- for(efa=em->faces.first; efa; efa=efa->next) {
+ for (efa=em->faces.first; efa; efa=efa->next) {
laplacian_add_triangle(sys,
efa->v1->tmp.l, efa->v2->tmp.l, efa->v3->tmp.l);
- if(efa->v4)
+ if (efa->v4)
laplacian_add_triangle(sys,
efa->v1->tmp.l, efa->v3->tmp.l, efa->v4->tmp.l);
}
@@ -995,12 +997,12 @@ void rigid_deform_begin(EditMesh *em)
int a, totvert, totface;
/* count vertices, triangles */
- for(totvert=0, eve=em->verts.first; eve; eve=eve->next)
+ for (totvert=0, eve=em->verts.first; eve; eve=eve->next)
totvert++;
- for(totface=0, efa=em->faces.first; efa; efa=efa->next) {
+ for (totface=0, efa=em->faces.first; efa; efa=efa->next) {
totface++;
- if(efa->v4) totface++;
+ if (efa->v4) totface++;
}
/* create laplacian */
@@ -1011,7 +1013,7 @@ void rigid_deform_begin(EditMesh *em)
sys->rigid.rhs = MEM_callocN(sizeof(float)*3*totvert, "RigidDeformRHS");
sys->rigid.origco = MEM_callocN(sizeof(float)*3*totvert, "RigidDeformCo");
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
+ for (a=0, eve=em->verts.first; eve; eve=eve->next, a++)
copy_v3_v3(sys->rigid.origco[a], eve->co);
sys->areaweights= 0;
@@ -1028,19 +1030,19 @@ void rigid_deform_end(int cancel)
{
LaplacianSystem *sys = RigidDeformSystem;
- if(sys) {
+ if (sys) {
EditMesh *em = sys->rigid.mesh;
EditVert *eve;
int a;
- if(cancel)
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
- if(!eve->pinned)
+ if (cancel)
+ for (a=0, eve=em->verts.first; eve; eve=eve->next, a++)
+ if (!eve->pinned)
copy_v3_v3(eve->co, sys->rigid.origco[a]);
- if(sys->rigid.R) MEM_freeN(sys->rigid.R);
- if(sys->rigid.rhs) MEM_freeN(sys->rigid.rhs);
- if(sys->rigid.origco) MEM_freeN(sys->rigid.origco);
+ if (sys->rigid.R) MEM_freeN(sys->rigid.R);
+ if (sys->rigid.rhs) MEM_freeN(sys->rigid.rhs);
+ if (sys->rigid.origco) MEM_freeN(sys->rigid.origco);
/* free */
laplacian_system_delete(sys);
@@ -1174,10 +1176,10 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
/* check if it is within the length of the line segment */
sub_v3_v3v3(isectdir, isectco, orig);
- if(dot_v3v3(dir, isectdir) < -EPSILON)
+ if (dot_v3v3(dir, isectdir) < -EPSILON)
return 0;
- if(dot_v3v3(dir, dir) + EPSILON < dot_v3v3(isectdir, isectdir))
+ if (dot_v3v3(dir, dir) + EPSILON < dot_v3v3(isectdir, isectdir))
return 0;
return 1;
@@ -1196,16 +1198,16 @@ static int meshdeform_intersect(MeshDeformBind *mdb, MeshDeformIsect *isec)
add_v3_v3v3(end, isec->start, isec->vec);
- for(f=0; f<totface; f++, mface++) {
+ for (f=0; f<totface; f++, mface++) {
copy_v3_v3(face[0], mdb->cagecos[mface->v1]);
copy_v3_v3(face[1], mdb->cagecos[mface->v2]);
copy_v3_v3(face[2], mdb->cagecos[mface->v3]);
- if(mface->v4) {
+ if (mface->v4) {
copy_v3_v3(face[3], mdb->cagecos[mface->v4]);
hit = meshdeform_tri_intersect(isec->start, end, face[0], face[1], face[2], co, uvw);
- if(hit) {
+ if (hit) {
normal_tri_v3( nor,face[0], face[1], face[2]);
}
else {
@@ -1218,9 +1220,9 @@ static int meshdeform_intersect(MeshDeformBind *mdb, MeshDeformIsect *isec)
normal_tri_v3( nor,face[0], face[1], face[2]);
}
- if(hit) {
+ if (hit) {
len= len_v3v3(isec->start, co)/len_v3v3(isec->start, end);
- if(len < isec->labda) {
+ if (len < isec->labda) {
isec->labda= len;
isec->face = mface;
isec->isect= (dot_v3v3(isec->vec, nor) <= 0.0f);
@@ -1249,7 +1251,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
add_v3_v3v3(end, co2, epsilon);
sub_v3_v3v3(isec.vec, end, isec.start);
- if(meshdeform_intersect(mdb, &isec)) {
+ if (meshdeform_intersect(mdb, &isec)) {
len= isec.labda;
mface=(MFace*)isec.face;
@@ -1262,7 +1264,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
isect->co[2]= co1[2] + isec.vec[2]*len;
isect->len= len_v3v3(co1, isect->co);
- if(isect->len < MESHDEFORM_LEN_THRESHOLD)
+ if (isect->len < MESHDEFORM_LEN_THRESHOLD)
isect->len= MESHDEFORM_LEN_THRESHOLD;
isect->v[0]= mface->v1;
@@ -1278,7 +1280,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
copy_v3_v3(vert[0], cagecos[mface->v1]);
copy_v3_v3(vert[1], cagecos[mface->v2]);
copy_v3_v3(vert[2], cagecos[mface->v3]);
- if(mface->v4) copy_v3_v3(vert[3], cagecos[mface->v4]);
+ if (mface->v4) copy_v3_v3(vert[3], cagecos[mface->v4]);
interp_weights_poly_v3( isect->uvw,vert, isect->nvert, isect->co);
return isect;
@@ -1293,7 +1295,7 @@ static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
float outside[3], start[3], dir[3];
int i;
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
outside[0] = co[0] + (mdb->max[0] - mdb->min[0] + 1.0f)*MESHDEFORM_OFFSET[i][0];
outside[1] = co[1] + (mdb->max[1] - mdb->min[1] + 1.0f)*MESHDEFORM_OFFSET[i][1];
outside[2] = co[2] + (mdb->max[2] - mdb->min[2] + 1.0f)*MESHDEFORM_OFFSET[i][2];
@@ -1303,7 +1305,7 @@ static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
normalize_v3(dir);
isect = meshdeform_ray_tree_intersect(mdb, start, outside);
- if(isect && !isect->facing)
+ if (isect && !isect->facing)
return 1;
}
@@ -1320,11 +1322,11 @@ static int meshdeform_index(MeshDeformBind *mdb, int x, int y, int z, int n)
y += MESHDEFORM_OFFSET[n][1];
z += MESHDEFORM_OFFSET[n][2];
- if(x < 0 || x >= mdb->size)
+ if (x < 0 || x >= mdb->size)
return -1;
- if(y < 0 || y >= mdb->size)
+ if (y < 0 || y >= mdb->size)
return -1;
- if(z < 0 || z >= mdb->size)
+ if (z < 0 || z >= mdb->size)
return -1;
return x + y*size + z*size*size;
@@ -1351,14 +1353,14 @@ static void meshdeform_add_intersections(MeshDeformBind *mdb, int x, int y, int
meshdeform_cell_center(mdb, x, y, z, 0, center);
/* check each outgoing edge for intersection */
- for(i=1; i<=6; i++) {
- if(meshdeform_index(mdb, x, y, z, i) == -1)
+ for (i=1; i<=6; i++) {
+ if (meshdeform_index(mdb, x, y, z, i) == -1)
continue;
meshdeform_cell_center(mdb, x, y, z, i, ncenter);
isect= meshdeform_ray_tree_intersect(mdb, center, ncenter);
- if(isect) {
+ if (isect) {
mdb->boundisect[a][i-1]= isect;
mdb->tag[a]= MESHDEFORM_TAG_BOUNDARY;
}
@@ -1378,18 +1380,18 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb)
stacksize= 1;
/* floodfill exterior tag */
- while(stacksize > 0) {
+ while (stacksize > 0) {
a= stack[--stacksize];
xyz[2]= a/(size*size);
xyz[1]= (a - xyz[2]*size*size)/size;
xyz[0]= a - xyz[1]*size - xyz[2]*size*size;
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
b= meshdeform_index(mdb, xyz[0], xyz[1], xyz[2], i);
- if(b != -1) {
- if(tag[b] == MESHDEFORM_TAG_UNTYPED ||
+ if (b != -1) {
+ if (tag[b] == MESHDEFORM_TAG_UNTYPED ||
(tag[b] == MESHDEFORM_TAG_BOUNDARY && !mdb->boundisect[a][i-1])) {
tag[b]= MESHDEFORM_TAG_EXTERIOR;
stack[stacksize++]= b;
@@ -1399,23 +1401,23 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb)
}
/* other cells are interior */
- for(a=0; a<size*size*size; a++)
- if(tag[a]==MESHDEFORM_TAG_UNTYPED)
+ for (a=0; a<size*size*size; a++)
+ if (tag[a]==MESHDEFORM_TAG_UNTYPED)
tag[a]= MESHDEFORM_TAG_INTERIOR;
#if 0
{
int tb, ti, te, ts;
tb= ti= te= ts= 0;
- for(a=0; a<size*size*size; a++)
- if(tag[a]==MESHDEFORM_TAG_BOUNDARY)
+ for (a=0; a<size*size*size; a++)
+ if (tag[a]==MESHDEFORM_TAG_BOUNDARY)
tb++;
- else if(tag[a]==MESHDEFORM_TAG_INTERIOR)
+ else if (tag[a]==MESHDEFORM_TAG_INTERIOR)
ti++;
- else if(tag[a]==MESHDEFORM_TAG_EXTERIOR) {
+ else if (tag[a]==MESHDEFORM_TAG_EXTERIOR) {
te++;
- if(mdb->semibound[a])
+ if (mdb->semibound[a])
ts++;
}
@@ -1430,8 +1432,8 @@ static float meshdeform_boundary_phi(MeshDeformBind *UNUSED(mdb), MDefBoundIsect
{
int a;
- for(a=0; a<isect->nvert; a++)
- if(isect->v[a] == cagevert)
+ for (a=0; a<isect->nvert; a++)
+ if (isect->v[a] == cagevert)
return isect->uvw[a];
return 0.0f;
@@ -1443,19 +1445,19 @@ static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *UNU
float weight, totweight= 0.0f;
int i, a, x, y, z;
- for(i=0; i<3; i++) {
+ for (i=0; i<3; i++) {
ivec[i]= (int)gridvec[i];
dvec[i]= gridvec[i] - ivec[i];
}
- for(i=0; i<8; i++) {
- if(i & 1) { x= ivec[0]+1; wx= dvec[0]; }
+ for (i=0; i<8; i++) {
+ if (i & 1) { x= ivec[0]+1; wx= dvec[0]; }
else { x= ivec[0]; wx= 1.0f-dvec[0]; }
- if(i & 2) { y= ivec[1]+1; wy= dvec[1]; }
+ if (i & 2) { y= ivec[1]+1; wy= dvec[1]; }
else { y= ivec[1]; wy= 1.0f-dvec[1]; }
- if(i & 4) { z= ivec[2]+1; wz= dvec[2]; }
+ if (i & 4) { z= ivec[2]+1; wz= dvec[2]; }
else { z= ivec[2]; wz= 1.0f-dvec[2]; }
CLAMP(x, 0, mdb->size-1);
@@ -1468,7 +1470,7 @@ static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *UNU
totweight += weight;
}
- if(totweight > 0.0f)
+ if (totweight > 0.0f)
result /= totweight;
return result;
@@ -1479,11 +1481,11 @@ static void meshdeform_check_semibound(MeshDeformBind *mdb, int x, int y, int z)
int i, a;
a= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[a] != MESHDEFORM_TAG_EXTERIOR)
+ if (mdb->tag[a] != MESHDEFORM_TAG_EXTERIOR)
return;
- for(i=1; i<=6; i++)
- if(mdb->boundisect[a][i-1])
+ for (i=1; i<=6; i++)
+ if (mdb->boundisect[a][i-1])
mdb->semibound[a]= 1;
}
@@ -1495,13 +1497,13 @@ static float meshdeform_boundary_total_weight(MeshDeformBind *mdb, int x, int y,
a= meshdeform_index(mdb, x, y, z, 0);
/* count weight for neighbor cells */
- for(i=1; i<=6; i++) {
- if(meshdeform_index(mdb, x, y, z, i) == -1)
+ for (i=1; i<=6; i++) {
+ if (meshdeform_index(mdb, x, y, z, i) == -1)
continue;
- if(mdb->boundisect[a][i-1])
+ if (mdb->boundisect[a][i-1])
weight= 1.0f/mdb->boundisect[a][i-1]->len;
- else if(!mdb->semibound[a])
+ else if (!mdb->semibound[a])
weight= 1.0f/mdb->width[0];
else
weight= 0.0f;
@@ -1519,15 +1521,15 @@ static void meshdeform_matrix_add_cell(MeshDeformBind *mdb, int x, int y, int z)
int i, a, acenter;
acenter= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
+ if (mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
return;
nlMatrixAdd(mdb->varidx[acenter], mdb->varidx[acenter], 1.0f);
totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
a= meshdeform_index(mdb, x, y, z, i);
- if(a == -1 || mdb->tag[a] == MESHDEFORM_TAG_EXTERIOR)
+ if (a == -1 || mdb->tag[a] == MESHDEFORM_TAG_EXTERIOR)
continue;
isect= mdb->boundisect[acenter][i-1];
@@ -1545,13 +1547,13 @@ static void meshdeform_matrix_add_rhs(MeshDeformBind *mdb, int x, int y, int z,
int i, a, acenter;
acenter= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
+ if (mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
return;
totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
a= meshdeform_index(mdb, x, y, z, i);
- if(a == -1)
+ if (a == -1)
continue;
isect= mdb->boundisect[acenter][i-1];
@@ -1571,13 +1573,13 @@ static void meshdeform_matrix_add_semibound_phi(MeshDeformBind *mdb, int x, int
int i, a;
a= meshdeform_index(mdb, x, y, z, 0);
- if(!mdb->semibound[a])
+ if (!mdb->semibound[a])
return;
mdb->phi[a]= 0.0f;
totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
isect= mdb->boundisect[a][i-1];
if (isect) {
@@ -1594,21 +1596,21 @@ static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y
int i, a, acenter;
acenter= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[acenter] != MESHDEFORM_TAG_EXTERIOR || mdb->semibound[acenter])
+ if (mdb->tag[acenter] != MESHDEFORM_TAG_EXTERIOR || mdb->semibound[acenter])
return;
phi= 0.0f;
totweight= 0.0f;
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
a= meshdeform_index(mdb, x, y, z, i);
- if(a != -1 && mdb->semibound[a]) {
+ if (a != -1 && mdb->semibound[a]) {
phi += mdb->phi[a];
totweight += 1.0f;
}
}
- if(totweight != 0.0f)
+ if (totweight != 0.0f)
mdb->phi[acenter]= phi/totweight;
}
@@ -1621,10 +1623,10 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
/* setup variable indices */
mdb->varidx= MEM_callocN(sizeof(int)*mdb->size3, "MeshDeformDSvaridx");
- for(a=0, totvar=0; a<mdb->size3; a++)
+ for (a=0, totvar=0; a<mdb->size3; a++)
mdb->varidx[a]= (mdb->tag[a] == MESHDEFORM_TAG_EXTERIOR)? -1: totvar++;
- if(totvar == 0) {
+ if (totvar == 0) {
MEM_freeN(mdb->varidx);
return;
}
@@ -1643,22 +1645,22 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
nlBegin(NL_MATRIX);
/* build matrix */
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_matrix_add_cell(mdb, x, y, z);
/* solve for each cage vert */
- for(a=0; a<mdb->totcagevert; a++) {
- if(a != 0) {
+ for (a=0; a<mdb->totcagevert; a++) {
+ if (a != 0) {
nlBegin(NL_SYSTEM);
nlBegin(NL_MATRIX);
}
/* fill in right hand side and solve */
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_matrix_add_rhs(mdb, x, y, z, a);
nlEnd(NL_MATRIX);
@@ -1668,27 +1670,27 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
nlPrintMatrix();
#endif
- if(nlSolveAdvanced(NULL, NL_TRUE)) {
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ if (nlSolveAdvanced(NULL, NL_TRUE)) {
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_matrix_add_semibound_phi(mdb, x, y, z, a);
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_matrix_add_exterior_phi(mdb, x, y, z, a);
- for(b=0; b<mdb->size3; b++) {
- if(mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
+ for (b=0; b<mdb->size3; b++) {
+ if (mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
mdb->phi[b]= nlGetVariable(0, mdb->varidx[b]);
mdb->totalphi[b] += mdb->phi[b];
}
- if(mdb->weights) {
+ if (mdb->weights) {
/* static bind : compute weights for each vertex */
- for(b=0; b<mdb->totvert; b++) {
- if(mdb->inside[b]) {
+ for (b=0; b<mdb->totvert; b++) {
+ if (mdb->inside[b]) {
copy_v3_v3(vec, mdb->vertexcos[b]);
gridvec[0]= (vec[0] - mdb->min[0] - mdb->halfwidth[0])/mdb->width[0];
gridvec[1]= (vec[1] - mdb->min[1] - mdb->halfwidth[1])/mdb->width[1];
@@ -1702,8 +1704,8 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
MDefBindInfluence *inf;
/* dynamic bind */
- for(b=0; b<mdb->size3; b++) {
- if(mdb->phi[b] >= MESHDEFORM_MIN_INFLUENCE) {
+ for (b=0; b<mdb->size3; b++) {
+ if (mdb->phi[b] >= MESHDEFORM_MIN_INFLUENCE) {
inf= BLI_memarena_alloc(mdb->memarena, sizeof(*inf));
inf->vertex= a;
inf->weight= mdb->phi[b];
@@ -1714,7 +1716,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
}
}
else {
- modifier_setError(&mmd->modifier, "Failed to find bind solution (increase precision?).");
+ modifier_setError(&mmd->modifier, "%s", TIP_("Failed to find bind solution (increase precision?)."));
error("Mesh Deform: failed to find bind solution.");
break;
}
@@ -1725,9 +1727,9 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
#if 0
/* sanity check */
- for(b=0; b<mdb->size3; b++)
- if(mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
- if(fabs(mdb->totalphi[b] - 1.0f) > 1e-4)
+ for (b=0; b<mdb->size3; b++)
+ if (mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
+ if (fabs(mdb->totalphi[b] - 1.0f) > 1e-4)
printf("totalphi deficiency [%s|%d] %d: %.10f\n",
(mdb->tag[b] == MESHDEFORM_TAG_INTERIOR)? "interior": "boundary", mdb->semibound[b], mdb->varidx[b], mdb->totalphi[b]);
#endif
@@ -1749,7 +1751,7 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
/* compute bounding box of the cage mesh */
INIT_MINMAX(mdb->min, mdb->max);
- for(a=0; a<mdb->totcagevert; a++)
+ for (a=0; a<mdb->totcagevert; a++)
DO_MINMAX(mdb->cagecos[a], mdb->min, mdb->max);
/* allocate memory */
@@ -1763,7 +1765,7 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
mdb->inside= MEM_callocN(sizeof(int)*mdb->totvert, "MDefInside");
- if(mmd->flag & MOD_MDEF_DYNAMIC_BIND)
+ if (mmd->flag & MOD_MDEF_DYNAMIC_BIND)
mdb->dyngrid= MEM_callocN(sizeof(MDefBindInfluence*)*mdb->size3, "MDefDynGrid");
else
mdb->weights= MEM_callocN(sizeof(float)*mdb->totvert*mdb->totcagevert, "MDefWeights");
@@ -1774,11 +1776,11 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
/* make bounding box equal size in all directions, add padding, and compute
* width of the cells */
maxwidth = -1.0f;
- for(a=0; a<3; a++)
- if(mdb->max[a]-mdb->min[a] > maxwidth)
+ for (a=0; a<3; a++)
+ if (mdb->max[a]-mdb->min[a] > maxwidth)
maxwidth= mdb->max[a]-mdb->min[a];
- for(a=0; a<3; a++) {
+ for (a=0; a<3; a++) {
center[a]= (mdb->min[a]+mdb->max[a])*0.5f;
mdb->min[a]= center[a] - maxwidth*0.5f;
mdb->max[a]= center[a] + maxwidth*0.5f;
@@ -1794,10 +1796,10 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
progress_bar(0, "Setting up mesh deform system");
totinside= 0;
- for(a=0; a<mdb->totvert; a++) {
+ for (a=0; a<mdb->totvert; a++) {
copy_v3_v3(vec, mdb->vertexcos[a]);
mdb->inside[a]= meshdeform_inside_cage(mdb, vec);
- if(mdb->inside[a])
+ if (mdb->inside[a])
totinside++;
}
@@ -1806,53 +1808,53 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
mdb->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "harmonic coords arena");
/* start with all cells untyped */
- for(a=0; a<mdb->size3; a++)
+ for (a=0; a<mdb->size3; a++)
mdb->tag[a]= MESHDEFORM_TAG_UNTYPED;
/* detect intersections and tag boundary cells */
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_add_intersections(mdb, x, y, z);
/* compute exterior and interior tags */
meshdeform_bind_floodfill(mdb);
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_check_semibound(mdb, x, y, z);
/* solve */
meshdeform_matrix_solve(mmd, mdb);
/* assign results */
- if(mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
+ if (mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
mmd->totinfluence= 0;
- for(a=0; a<mdb->size3; a++)
- for(inf=mdb->dyngrid[a]; inf; inf=inf->next)
+ for (a=0; a<mdb->size3; a++)
+ for (inf=mdb->dyngrid[a]; inf; inf=inf->next)
mmd->totinfluence++;
/* convert MDefBindInfluences to smaller MDefInfluences */
mmd->dyngrid= MEM_callocN(sizeof(MDefCell)*mdb->size3, "MDefDynGrid");
mmd->dyninfluences= MEM_callocN(sizeof(MDefInfluence)*mmd->totinfluence, "MDefInfluence");
offset= 0;
- for(a=0; a<mdb->size3; a++) {
+ for (a=0; a<mdb->size3; a++) {
cell= &mmd->dyngrid[a];
cell->offset= offset;
totweight= 0.0f;
mdinf= mmd->dyninfluences + cell->offset;
- for(inf=mdb->dyngrid[a]; inf; inf=inf->next, mdinf++) {
+ for (inf=mdb->dyngrid[a]; inf; inf=inf->next, mdinf++) {
mdinf->weight= inf->weight;
mdinf->vertex= inf->vertex;
totweight += mdinf->weight;
cell->totinfluence++;
}
- if(totweight > 0.0f) {
+ if (totweight > 0.0f) {
mdinf= mmd->dyninfluences + cell->offset;
- for(b=0; b<cell->totinfluence; b++, mdinf++)
+ for (b=0; b<cell->totinfluence; b++, mdinf++)
mdinf->weight /= totweight;
}
@@ -1891,9 +1893,9 @@ static void heat_weighting_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifie
mdb->weights= MEM_callocN(sizeof(float)*mdb->totvert*mdb->totcagevert, "MDefWeights");
/* count triangles */
- for(tottri=0, a=0, mf=mface; a<totface; a++, mf++) {
+ for (tottri=0, a=0, mf=mface; a<totface; a++, mf++) {
tottri++;
- if(mf->v4) tottri++;
+ if (mf->v4) tottri++;
}
/* create laplacian */
@@ -1912,27 +1914,27 @@ static void heat_weighting_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifie
laplacian_system_construct_end(sys);
/* compute weights per bone */
- for(j=0; j<mdb->totcagevert; j++) {
+ for (j=0; j<mdb->totcagevert; j++) {
/* fill right hand side */
laplacian_begin_solve(sys, -1);
- for(a=0; a<totvert; a++)
- if(heat_source_closest(sys, a, j))
+ for (a=0; a<totvert; a++)
+ if (heat_source_closest(sys, a, j))
laplacian_add_right_hand_side(sys, a,
sys->heat.H[a]*sys->heat.p[a]);
/* solve */
- if(laplacian_system_solve(sys)) {
+ if (laplacian_system_solve(sys)) {
/* load solution into vertex groups */
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
solution= laplacian_system_get_solution(a);
weight= heat_limit_weight(solution);
- if(weight > 0.0f)
+ if (weight > 0.0f)
mdb->weights[a*mdb->totcagevert + j] = weight;
}
}
- else if(!thrownerror) {
+ else if (!thrownerror) {
error("Mesh Deform Heat Weighting:"
" failed to find solution for one or more vertices");
thrownerror= 1;
@@ -1969,14 +1971,14 @@ void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexco
copy_m4_m4(mdb.cagemat, cagemat);
mvert= mdb.cagedm->getVertArray(mdb.cagedm);
- for(a=0; a<mdb.totcagevert; a++)
+ for (a=0; a<mdb.totcagevert; a++)
copy_v3_v3(mdb.cagecos[a], mvert[a].co);
- for(a=0; a<mdb.totvert; a++)
+ for (a=0; a<mdb.totvert; a++)
mul_v3_m4v3(mdb.vertexcos[a], mdb.cagemat, vertexcos + a*3);
/* solve */
#if 0
- if(mmd->mode == MOD_MDEF_VOLUME)
+ if (mmd->mode == MOD_MDEF_VOLUME)
harmonic_coordinates_bind(scene, mmd, &mdb);
else
heat_weighting_bind(scene, dm, mmd, &mdb);
@@ -1991,7 +1993,7 @@ void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexco
copy_m4_m4(mmd->bindmat, mmd->object->obmat);
/* transform bindcagecos to world space */
- for(a=0; a<mdb.totcagevert; a++)
+ for (a=0; a<mdb.totcagevert; a++)
mul_m4_v3(mmd->object->obmat, mmd->bindcagecos+a*3);
/* free */
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index adabf7405d6..be520d1e8a0 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -762,19 +762,19 @@ static int pose_slide_push_exec (bContext *C, wmOperator *op)
void POSE_OT_push (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Push Pose";
- ot->idname= "POSE_OT_push";
- ot->description= "Exaggerate the current pose";
+ ot->name = "Push Pose";
+ ot->idname = "POSE_OT_push";
+ ot->description = "Exaggerate the current pose";
/* callbacks */
- ot->exec= pose_slide_push_exec;
- ot->invoke= pose_slide_push_invoke;
- ot->modal= pose_slide_modal;
- ot->cancel= pose_slide_cancel;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_slide_push_exec;
+ ot->invoke = pose_slide_push_invoke;
+ ot->modal = pose_slide_modal;
+ ot->cancel = pose_slide_cancel;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* Properties */
pose_slide_opdef_properties(ot);
@@ -819,19 +819,19 @@ static int pose_slide_relax_exec (bContext *C, wmOperator *op)
void POSE_OT_relax (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Relax Pose";
- ot->idname= "POSE_OT_relax";
- ot->description= "Make the current pose more similar to its surrounding ones";
+ ot->name = "Relax Pose";
+ ot->idname = "POSE_OT_relax";
+ ot->description = "Make the current pose more similar to its surrounding ones";
/* callbacks */
- ot->exec= pose_slide_relax_exec;
- ot->invoke= pose_slide_relax_invoke;
- ot->modal= pose_slide_modal;
- ot->cancel= pose_slide_cancel;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_slide_relax_exec;
+ ot->invoke = pose_slide_relax_invoke;
+ ot->modal = pose_slide_modal;
+ ot->cancel = pose_slide_cancel;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* Properties */
pose_slide_opdef_properties(ot);
@@ -876,19 +876,19 @@ static int pose_slide_breakdown_exec (bContext *C, wmOperator *op)
void POSE_OT_breakdown (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Pose Breakdowner";
- ot->idname= "POSE_OT_breakdown";
- ot->description= "Create a suitable breakdown pose on the current frame";
+ ot->name = "Pose Breakdowner";
+ ot->idname = "POSE_OT_breakdown";
+ ot->description = "Create a suitable breakdown pose on the current frame";
/* callbacks */
- ot->exec= pose_slide_breakdown_exec;
- ot->invoke= pose_slide_breakdown_invoke;
- ot->modal= pose_slide_modal;
- ot->cancel= pose_slide_cancel;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_slide_breakdown_exec;
+ ot->invoke = pose_slide_breakdown_invoke;
+ ot->modal = pose_slide_modal;
+ ot->cancel = pose_slide_cancel;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* Properties */
pose_slide_opdef_properties(ot);
@@ -1102,7 +1102,7 @@ static void pose_propagate_fcurve (wmOperator *op, Object *ob, FCurve *fcu,
* doesn't need to firstly keyframe the pose (though this doesn't mean that
* they can't either)
*/
- if( !pose_propagate_get_refVal(ob, fcu, &refVal))
+ if ( !pose_propagate_get_refVal(ob, fcu, &refVal))
return;
/* find the first keyframe to start propagating from
@@ -1240,20 +1240,20 @@ void POSE_OT_propagate (wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Propagate Pose";
- ot->idname= "POSE_OT_propagate";
- ot->description= "Copy selected aspects of the current pose to subsequent poses already keyframed";
+ ot->name = "Propagate Pose";
+ ot->idname = "POSE_OT_propagate";
+ ot->description = "Copy selected aspects of the current pose to subsequent poses already keyframed";
/* callbacks */
- ot->exec= pose_propagate_exec;
- ot->poll= ED_operator_posemode; // XXX: needs selected bones!
+ ot->exec = pose_propagate_exec;
+ ot->poll = ED_operator_posemode; // XXX: needs selected bones!
/* flag */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
// TODO: add "fade out" control for tapering off amount of propagation as time goes by?
- ot->prop= RNA_def_enum(ot->srna, "mode", terminate_items, POSE_PROPAGATE_SMART_HOLDS, "Terminate Mode", "Method used to determine when to stop propagating pose to keyframes");
+ ot->prop = RNA_def_enum(ot->srna, "mode", terminate_items, POSE_PROPAGATE_SMART_HOLDS, "Terminate Mode", "Method used to determine when to stop propagating pose to keyframes");
RNA_def_float(ot->srna, "end_frame", 250.0, FLT_MIN, FLT_MAX, "End Frame", "Frame to stop propagating frames to (for 'Before Frame' mode)", 1.0, 250.0);
}
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index ef01b895f38..fbe05d7ef49 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -241,10 +241,10 @@ void POSELIB_OT_new (wmOperatorType *ot)
/* callbacks */
ot->exec = poselib_new_exec;
- ot->poll= ED_operator_posemode;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ------------------------------------------------ */
@@ -276,10 +276,10 @@ void POSELIB_OT_unlink (wmOperatorType *ot)
/* callbacks */
ot->exec = poselib_unlink_exec;
- ot->poll= has_poselib_pose_data_poll;
+ ot->poll = has_poselib_pose_data_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************************************************* */
@@ -365,7 +365,7 @@ void POSELIB_OT_action_sanitise (wmOperatorType *ot)
ot->poll = has_poselib_pose_data_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ------------------------------------------ */
@@ -486,17 +486,17 @@ static int poselib_add_exec (bContext *C, wmOperator *op)
void POSELIB_OT_pose_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "PoseLib Add Pose";
- ot->idname= "POSELIB_OT_pose_add";
- ot->description= "Add the current Pose to the active Pose Library";
+ ot->name = "PoseLib Add Pose";
+ ot->idname = "POSELIB_OT_pose_add";
+ ot->description = "Add the current Pose to the active Pose Library";
/* api callbacks */
- ot->invoke= poselib_add_menu_invoke;
- ot->exec= poselib_add_exec;
- ot->poll= ED_operator_posemode;
+ ot->invoke = poselib_add_menu_invoke;
+ ot->exec = poselib_add_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_int(ot->srna, "frame", 1, 0, INT_MAX, "Frame", "Frame to store pose on", 0, INT_MAX);
@@ -592,22 +592,22 @@ void POSELIB_OT_pose_remove (wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "PoseLib Remove Pose";
- ot->idname= "POSELIB_OT_pose_remove";
- ot->description= "Remove nth pose from the active Pose Library";
+ ot->name = "PoseLib Remove Pose";
+ ot->idname = "POSELIB_OT_pose_remove";
+ ot->description = "Remove nth pose from the active Pose Library";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= poselib_remove_exec;
- ot->poll= has_poselib_pose_data_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = poselib_remove_exec;
+ ot->poll = has_poselib_pose_data_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
prop= RNA_def_enum(ot->srna, "pose", DummyRNA_DEFAULT_items, 0, "Pose", "The pose to remove");
RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
static int poselib_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt)
@@ -682,21 +682,21 @@ void POSELIB_OT_pose_rename (wmOperatorType *ot)
};
/* identifiers */
- ot->name= "PoseLib Rename Pose";
- ot->idname= "POSELIB_OT_pose_rename";
- ot->description= "Rename specified pose from the active Pose Library";
+ ot->name = "PoseLib Rename Pose";
+ ot->idname = "POSELIB_OT_pose_rename";
+ ot->description = "Rename specified pose from the active Pose Library";
/* api callbacks */
- ot->invoke= poselib_rename_invoke;
- ot->exec= poselib_rename_exec;
- ot->poll= has_poselib_pose_data_poll;
+ ot->invoke = poselib_rename_invoke;
+ ot->exec = poselib_rename_exec;
+ ot->poll = has_poselib_pose_data_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
/* NOTE: name not pose is the operator's "main" property, so that it will get activated in the popup for easy renaming */
- ot->prop= RNA_def_string(ot->srna, "name", "RenamedPose", 64, "New Pose Name", "New name for pose");
+ ot->prop = RNA_def_string(ot->srna, "name", "RenamedPose", 64, "New Pose Name", "New name for pose");
prop= RNA_def_enum(ot->srna, "pose", prop_poses_dummy_types, 0, "Pose", "The pose to rename");
RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
}
@@ -1613,23 +1613,23 @@ static int poselib_preview_exec (bContext *C, wmOperator *op)
void POSELIB_OT_browse_interactive (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "PoseLib Browse Poses";
- ot->idname= "POSELIB_OT_browse_interactive";
- ot->description= "Interactively browse poses in 3D-View";
+ ot->name = "PoseLib Browse Poses";
+ ot->idname = "POSELIB_OT_browse_interactive";
+ ot->description = "Interactively browse poses in 3D-View";
/* callbacks */
- ot->invoke= poselib_preview_invoke;
- ot->modal= poselib_preview_modal;
- ot->cancel= poselib_preview_cancel;
- ot->exec= poselib_preview_exec;
- ot->poll= has_poselib_pose_data_poll;
+ ot->invoke = poselib_preview_invoke;
+ ot->modal = poselib_preview_modal;
+ ot->cancel = poselib_preview_cancel;
+ ot->exec = poselib_preview_exec;
+ ot->poll = has_poselib_pose_data_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* properties */
// TODO: make the pose_index into a proper enum instead of a cryptic int...
- ot->prop= RNA_def_int(ot->srna, "pose_index", -1, -2, INT_MAX, "Pose", "Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose)", 0, INT_MAX);
+ ot->prop = RNA_def_int(ot->srna, "pose_index", -1, -2, INT_MAX, "Pose", "Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose)", 0, INT_MAX);
// XXX: percentage vs factor?
/* not used yet */
@@ -1644,13 +1644,13 @@ void POSELIB_OT_apply_pose (wmOperatorType *ot)
ot->description = "Apply specified Pose Library pose to the rig";
/* callbacks */
- ot->exec= poselib_preview_exec;
- ot->poll= has_poselib_pose_data_poll;
+ ot->exec = poselib_preview_exec;
+ ot->poll = has_poselib_pose_data_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
// TODO: make the pose_index into a proper enum instead of a cryptic int...
- ot->prop= RNA_def_int(ot->srna, "pose_index", -1, -2, INT_MAX, "Pose", "Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose)", 0, INT_MAX);
+ ot->prop = RNA_def_int(ot->srna, "pose_index", -1, -2, INT_MAX, "Pose", "Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose)", 0, INT_MAX);
}
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 282519896c7..3d33930fa49 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -109,7 +109,7 @@ void ED_armature_enter_posemode(bContext *C, Base *base)
void ED_armature_exit_posemode(bContext *C, Base *base)
{
- if(base) {
+ if (base) {
Object *ob= base->object;
ob->restore_mode = ob->mode;
@@ -154,18 +154,18 @@ static int pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan, int level)
/* No need to check if constraint is active (has influence),
* since all constraints with CONSTRAINT_IK_AUTO are active */
- for(con= pchan->constraints.first; con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ for (con= pchan->constraints.first; con; con= con->next) {
+ if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data= con->data;
- if(data->rootbone == 0 || data->rootbone > level) {
- if((data->flag & CONSTRAINT_IK_AUTO)==0)
+ if (data->rootbone == 0 || data->rootbone > level) {
+ if ((data->flag & CONSTRAINT_IK_AUTO)==0)
return 1;
}
}
}
- for(bone= pchan->bone->childbase.first; bone; bone= bone->next) {
+ for (bone= pchan->bone->childbase.first; bone; bone= bone->next) {
pchan= get_pose_channel(ob->pose, bone->name);
- if(pchan && pose_channel_in_IK_chain(ob, pchan, level + 1))
+ if (pchan && pose_channel_in_IK_chain(ob, pchan, level + 1))
return 1;
}
return 0;
@@ -236,16 +236,16 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
void POSE_OT_paths_calculate (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Calculate Bone Paths";
- ot->idname= "POSE_OT_paths_calculate";
- ot->description= "Calculate paths for the selected bones";
+ ot->name = "Calculate Bone Paths";
+ ot->idname = "POSE_OT_paths_calculate";
+ ot->description = "Calculate paths for the selected bones";
/* api callbacks */
- ot->exec= pose_calculate_paths_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_calculate_paths_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* --------- */
@@ -304,13 +304,13 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
void POSE_OT_paths_clear (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Bone Paths";
- ot->idname= "POSE_OT_paths_clear";
- ot->description= "Clear path caches for selected bones";
+ ot->name = "Clear Bone Paths";
+ ot->idname = "POSE_OT_paths_clear";
+ ot->description = "Clear path caches for selected bones";
/* api callbacks */
- ot->exec= pose_clear_paths_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_clear_paths_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -338,7 +338,7 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
for (ct= targets.first; ct; ct= ct->next) {
if ((ct->tar == ob) && (ct->subtarget[0])) {
bPoseChannel *pchanc= get_pose_channel(ob->pose, ct->subtarget);
- if((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) {
+ if ((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) {
pchanc->bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
found= 1;
}
@@ -364,16 +364,16 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
void POSE_OT_select_constraint_target(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Constraint Target";
- ot->idname= "POSE_OT_select_constraint_target";
- ot->description= "Select bones used as targets for the currently selected bones";
+ ot->name = "Select Constraint Target";
+ ot->idname = "POSE_OT_select_constraint_target";
+ ot->description = "Select bones used as targets for the currently selected bones";
/* api callbacks */
- ot->exec= pose_select_constraint_target_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_select_constraint_target_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************* select hierarchy operator ************* */
@@ -441,19 +441,19 @@ void POSE_OT_select_hierarchy(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Select Hierarchy";
- ot->idname= "POSE_OT_select_hierarchy";
- ot->description= "Select immediate parent/children of selected bones";
+ ot->name = "Select Hierarchy";
+ ot->idname = "POSE_OT_select_hierarchy";
+ ot->description = "Select immediate parent/children of selected bones";
/* api callbacks */
- ot->exec= pose_select_hierarchy_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_select_hierarchy_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- ot->prop= RNA_def_enum(ot->srna, "direction", direction_items, BONE_SELECT_PARENT, "Direction", "");
+ ot->prop = RNA_def_enum(ot->srna, "direction", direction_items, BONE_SELECT_PARENT, "Direction", "");
RNA_def_boolean(ot->srna, "extend", 0, "Add to Selection", "");
}
@@ -661,21 +661,21 @@ void POSE_OT_select_grouped (wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Select Grouped";
+ ot->name = "Select Grouped";
ot->description = "Select all visible bones grouped by similar properties";
- ot->idname= "POSE_OT_select_grouped";
+ ot->idname = "POSE_OT_select_grouped";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= pose_select_grouped_exec;
- ot->poll= ED_operator_posemode;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = pose_select_grouped_exec;
+ ot->poll = ED_operator_posemode;
/* 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");
- ot->prop= RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
}
@@ -687,23 +687,23 @@ static int pose_bone_flip_active_exec (bContext *C, wmOperator *UNUSED(op))
Object *ob_act= CTX_data_active_object(C);
Object *ob= object_pose_armature_get(ob_act);
- if(ob && (ob->mode & OB_MODE_POSE)) {
+ if (ob && (ob->mode & OB_MODE_POSE)) {
bArmature *arm= ob->data;
- if(arm->act_bone) {
+ if (arm->act_bone) {
bPoseChannel *pchanf;
char name[MAXBONENAME];
flip_side_name(name, arm->act_bone->name, TRUE);
pchanf= get_pose_channel(ob->pose, name);
- if(pchanf && pchanf->bone != arm->act_bone) {
+ if (pchanf && pchanf->bone != arm->act_bone) {
arm->act_bone->flag &= ~BONE_SELECTED;
pchanf->bone->flag |= BONE_SELECTED;
arm->act_bone= pchanf->bone;
/* in weightpaint we select the associated vertex group too */
- if(ob_act->mode & OB_MODE_WEIGHT_PAINT) {
+ if (ob_act->mode & OB_MODE_WEIGHT_PAINT) {
ED_vgroup_select_by_name(ob_act, name);
DAG_id_tag_update(&ob_act->id, OB_RECALC_DATA);
}
@@ -721,13 +721,13 @@ static int pose_bone_flip_active_exec (bContext *C, wmOperator *UNUSED(op))
void POSE_OT_select_flip_active(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Flip Selected Active Bone";
- ot->idname= "POSE_OT_select_flip_active";
- ot->description= "Activate the bone with a flipped name";
+ ot->name = "Flip Selected Active Bone";
+ ot->idname = "POSE_OT_select_flip_active";
+ ot->description = "Activate the bone with a flipped name";
/* api callbacks */
- ot->exec= pose_bone_flip_active_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_bone_flip_active_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -876,7 +876,7 @@ static void pose_copy_menu(Scene *scene)
BLI_duplicatelist(&const_copy, &(pchanact->constraints));
/* build the puplist of constraints */
- for (con = pchanact->constraints.first, i=0; con; con=con->next, i++){
+ for (con = pchanact->constraints.first, i=0; con; con=con->next, i++) {
const_toggle[i]= 1;
// add_numbut(i, TOG|INT, con->name, 0, 0, &(const_toggle[i]), "");
}
@@ -946,7 +946,7 @@ void free_posebuf(void)
bPoseChannel *pchan;
for (pchan= g_posebuf->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->prop) {
+ if (pchan->prop) {
IDP_FreeProperty(pchan->prop);
MEM_freeN(pchan->prop);
}
@@ -968,8 +968,8 @@ static void set_pose_keys (Object *ob)
bArmature *arm= ob->data;
bPoseChannel *chan;
- if (ob->pose){
- for (chan=ob->pose->chanbase.first; chan; chan=chan->next){
+ if (ob->pose) {
+ for (chan=ob->pose->chanbase.first; chan; chan=chan->next) {
Bone *bone= chan->bone;
if ((bone) && (bone->flag & BONE_SELECTED) && (arm->layer & bone->layer))
chan->flag |= POSE_KEY;
@@ -1129,16 +1129,16 @@ static int pose_copy_exec (bContext *C, wmOperator *op)
void POSE_OT_copy (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Pose";
- ot->idname= "POSE_OT_copy";
- ot->description= "Copies the current pose of the selected bones to copy/paste buffer";
+ ot->name = "Copy Pose";
+ ot->idname = "POSE_OT_copy";
+ ot->description = "Copies the current pose of the selected bones to copy/paste buffer";
/* api callbacks */
- ot->exec= pose_copy_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_copy_exec;
+ ot->poll = ED_operator_posemode;
/* flag */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
/* ---- */
@@ -1196,16 +1196,16 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
void POSE_OT_paste (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste Pose";
- ot->idname= "POSE_OT_paste";
- ot->description= "Paste the stored pose on to the current pose";
+ ot->name = "Paste Pose";
+ ot->idname = "POSE_OT_paste";
+ ot->description = "Paste the stored pose on to the current pose";
/* api callbacks */
- ot->exec= pose_paste_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_paste_exec;
+ ot->poll = ED_operator_posemode;
/* flag */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "flipped", FALSE, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose");
@@ -1242,13 +1242,13 @@ static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op))
void POSE_OT_group_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Bone Group";
- ot->idname= "POSE_OT_group_add";
- ot->description= "Add a new bone group";
+ ot->name = "Add Bone Group";
+ ot->idname = "POSE_OT_group_add";
+ ot->description = "Add a new bone group";
/* api callbacks */
- ot->exec= pose_group_add_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_group_add_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1282,13 +1282,13 @@ static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op))
void POSE_OT_group_remove (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Bone Group";
- ot->idname= "POSE_OT_group_remove";
- ot->description= "Removes the active bone group";
+ ot->name = "Remove Bone Group";
+ ot->idname = "POSE_OT_group_remove";
+ ot->description = "Removes the active bone group";
/* api callbacks */
- ot->exec= pose_group_remove_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_group_remove_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1397,14 +1397,14 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op)
void POSE_OT_group_assign (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Selected to Bone Group";
- ot->idname= "POSE_OT_group_assign";
- ot->description= "Add selected bones to the chosen bone group";
+ ot->name = "Add Selected to Bone Group";
+ ot->idname = "POSE_OT_group_assign";
+ ot->description = "Add selected bones to the chosen bone group";
/* api callbacks */
- ot->invoke= pose_groups_menu_invoke;
- ot->exec= pose_group_assign_exec;
- ot->poll= ED_operator_posemode;
+ ot->invoke = pose_groups_menu_invoke;
+ ot->exec = pose_group_assign_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1453,13 +1453,13 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op))
void POSE_OT_group_unassign (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Selected from Bone Groups";
- ot->idname= "POSE_OT_group_unassign";
- ot->description= "Remove selected bones from all bone groups";
+ ot->name = "Remove Selected from Bone Groups";
+ ot->idname = "POSE_OT_group_unassign";
+ ot->description = "Remove selected bones from all bone groups";
/* api callbacks */
- ot->exec= pose_group_unassign_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_group_unassign_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1534,16 +1534,16 @@ void POSE_OT_group_move(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Move Bone Group";
- ot->idname= "POSE_OT_group_move";
- ot->description= "Change position of active Bone Group in list of Bone Groups";
+ ot->name = "Move Bone Group";
+ ot->idname = "POSE_OT_group_move";
+ ot->description = "Change position of active Bone Group in list of Bone Groups";
/* api callbacks */
- ot->exec= group_move_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = group_move_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_enum(ot->srna, "direction", group_slot_move, 0, "Direction", "Direction to move, UP or DOWN");
}
@@ -1618,16 +1618,16 @@ static int group_sort_exec(bContext *C, wmOperator *UNUSED(op))
void POSE_OT_group_sort(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Sort Bone Groups";
- ot->idname= "POSE_OT_group_sort";
- ot->description= "Sort Bone Groups by their names in ascending order";
+ ot->name = "Sort Bone Groups";
+ ot->idname = "POSE_OT_group_sort";
+ ot->description = "Sort Bone Groups by their names in ascending order";
/* api callbacks */
- ot->exec= group_sort_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = group_sort_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static void pose_group_select(bContext *C, Object *ob, int select)
@@ -1676,13 +1676,13 @@ static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op))
void POSE_OT_group_select (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Bones of Bone Group";
- ot->idname= "POSE_OT_group_select";
- ot->description= "Select bones in active Bone Group";
+ ot->name = "Select Bones of Bone Group";
+ ot->idname = "POSE_OT_group_select";
+ ot->description = "Select bones in active Bone Group";
/* api callbacks */
- ot->exec= pose_group_select_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_group_select_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1714,13 +1714,13 @@ static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op))
void POSE_OT_group_deselect (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Deselect Bone Group";
- ot->idname= "POSE_OT_group_deselect";
- ot->description= "Deselect bones of active Bone Group";
+ ot->name = "Deselect Bone Group";
+ ot->idname = "POSE_OT_group_deselect";
+ ot->description = "Deselect bones of active Bone Group";
/* api callbacks */
- ot->exec= pose_group_deselect_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_group_deselect_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1759,16 +1759,16 @@ static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
void POSE_OT_flip_names (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Flip Names";
- ot->idname= "POSE_OT_flip_names";
- ot->description= "Flips (and corrects) the axis suffixes of the the names of selected bones";
+ ot->name = "Flip Names";
+ ot->idname = "POSE_OT_flip_names";
+ ot->description = "Flips (and corrects) the axis suffixes of the the names of selected bones";
/* api callbacks */
- ot->exec= pose_flip_names_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_flip_names_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ------------------ */
@@ -1789,7 +1789,7 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
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]))
+ if (bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]))
ED_armature_bone_rename(arm, pchan->name, newname);
}
CTX_DATA_END;
@@ -1812,20 +1812,20 @@ void POSE_OT_autoside_names (wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "AutoName by Axis";
- ot->idname= "POSE_OT_autoside_names";
- ot->description= "Automatically renames the selected bones according to which side of the target axis they fall on";
+ ot->name = "AutoName by Axis";
+ ot->idname = "POSE_OT_autoside_names";
+ ot->description = "Automatically renames the selected bones according to which side of the target axis they fall on";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= pose_autoside_names_exec;
- ot->poll= ED_operator_posemode;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = pose_autoside_names_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* settings */
- ot->prop= RNA_def_enum(ot->srna, "axis", axis_items, 0, "Axis", "Axis tag names with");
+ ot->prop = RNA_def_enum(ot->srna, "axis", axis_items, 0, "Axis", "Axis tag names with");
}
/* ********************************************** */
@@ -1852,20 +1852,20 @@ static int pose_bone_rotmode_exec (bContext *C, wmOperator *op)
void POSE_OT_rotation_mode_set (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Rotation Mode";
- ot->idname= "POSE_OT_rotation_mode_set";
- ot->description= "Set the rotation representation used by selected bones";
+ ot->name = "Set Rotation Mode";
+ ot->idname = "POSE_OT_rotation_mode_set";
+ ot->description = "Set the rotation representation used by selected bones";
/* callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= pose_bone_rotmode_exec;
- ot->poll= ED_operator_posemode;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = pose_bone_rotmode_exec;
+ 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", posebone_rotmode_items, 0, "Rotation Mode", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", posebone_rotmode_items, 0, "Rotation Mode", "");
}
/* ********************************************** */
@@ -1911,16 +1911,16 @@ static int pose_armature_layers_showall_exec (bContext *C, wmOperator *op)
void ARMATURE_OT_layers_show_all (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Show All Layers";
- ot->idname= "ARMATURE_OT_layers_show_all";
- ot->description= "Make all armature layers visible";
+ ot->name = "Show All Layers";
+ ot->idname = "ARMATURE_OT_layers_show_all";
+ ot->description = "Make all armature layers visible";
/* callbacks */
- ot->exec= pose_armature_layers_showall_exec;
- ot->poll= pose_armature_layers_showall_poll;
+ ot->exec = pose_armature_layers_showall_exec;
+ ot->poll = pose_armature_layers_showall_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All Layers", "Enable all layers or just the first 16 (top row)");
@@ -1977,17 +1977,17 @@ static int pose_armature_layers_exec (bContext *C, wmOperator *op)
void POSE_OT_armature_layers (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change Armature Layers";
- ot->idname= "POSE_OT_armature_layers";
- ot->description= "Change the visible armature layers";
+ ot->name = "Change Armature Layers";
+ ot->idname = "POSE_OT_armature_layers";
+ ot->description = "Change the visible armature layers";
/* callbacks */
- ot->invoke= pose_armature_layers_invoke;
- ot->exec= pose_armature_layers_exec;
- ot->poll= ED_operator_posemode;
+ ot->invoke = pose_armature_layers_invoke;
+ ot->exec = pose_armature_layers_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible");
@@ -1996,17 +1996,17 @@ void POSE_OT_armature_layers (wmOperatorType *ot)
void ARMATURE_OT_armature_layers (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change Armature Layers";
- ot->idname= "ARMATURE_OT_armature_layers";
- ot->description= "Change the visible armature layers";
+ ot->name = "Change Armature Layers";
+ ot->idname = "ARMATURE_OT_armature_layers";
+ ot->description = "Change the visible armature layers";
/* callbacks */
- ot->invoke= pose_armature_layers_invoke;
- ot->exec= pose_armature_layers_exec;
- ot->poll= ED_operator_editarmature;
+ ot->invoke = pose_armature_layers_invoke;
+ ot->exec = pose_armature_layers_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible");
@@ -2046,7 +2046,7 @@ static int pose_bone_layers_exec (bContext *C, wmOperator *op)
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
- if(ob==NULL || ob->data==NULL) {
+ if (ob==NULL || ob->data==NULL) {
return OPERATOR_CANCELLED;
}
@@ -2071,17 +2071,17 @@ static int pose_bone_layers_exec (bContext *C, wmOperator *op)
void POSE_OT_bone_layers (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change Bone Layers";
- ot->idname= "POSE_OT_bone_layers";
- ot->description= "Change the layers that the selected bones belong to";
+ ot->name = "Change Bone Layers";
+ ot->idname = "POSE_OT_bone_layers";
+ ot->description = "Change the layers that the selected bones belong to";
/* callbacks */
- ot->invoke= pose_bone_layers_invoke;
- ot->exec= pose_bone_layers_exec;
- ot->poll= ED_operator_posemode;
+ ot->invoke = pose_bone_layers_invoke;
+ ot->exec = pose_bone_layers_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to");
@@ -2143,17 +2143,17 @@ static int armature_bone_layers_exec (bContext *C, wmOperator *op)
void ARMATURE_OT_bone_layers (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change Bone Layers";
- ot->idname= "ARMATURE_OT_bone_layers";
- ot->description= "Change the layers that the selected bones belong to";
+ ot->name = "Change Bone Layers";
+ ot->idname = "ARMATURE_OT_bone_layers";
+ ot->description = "Change the layers that the selected bones belong to";
/* callbacks */
- ot->invoke= armature_bone_layers_invoke;
- ot->exec= armature_bone_layers_exec;
- ot->poll= ED_operator_editarmature;
+ ot->invoke = armature_bone_layers_invoke;
+ ot->exec = armature_bone_layers_exec;
+ ot->poll = ED_operator_editarmature;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to");
@@ -2192,15 +2192,15 @@ void POSE_OT_quaternions_flip (wmOperatorType *ot)
{
/* identifiers */
ot->name = "Flip Quats";
- ot->idname= "POSE_OT_quaternions_flip";
- ot->description= "Flip quaternion values to achieve desired rotations, while maintaining the same orientations";
+ ot->idname = "POSE_OT_quaternions_flip";
+ ot->description = "Flip quaternion values to achieve desired rotations, while maintaining the same orientations";
/* callbacks */
- ot->exec= pose_flip_quats_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_flip_quats_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ********************************************** */
@@ -2268,14 +2268,14 @@ void POSE_OT_user_transforms_clear (wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear User Transforms";
- ot->idname= "POSE_OT_user_transforms_clear";
- ot->description= "Reset pose on selected bones to keyframed state";
+ ot->idname = "POSE_OT_user_transforms_clear";
+ ot->description = "Reset pose on selected bones to keyframed state";
/* callbacks */
- ot->exec= pose_clear_user_transforms_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_clear_user_transforms_exec;
+ ot->poll = ED_operator_posemode;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index 97113109981..30f929c9603 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -115,6 +115,7 @@ void flipArcBuckets(ReebArc *arc);
/***************************************** UTILS **********************************************/
+#if 0 /* UNUSED */
static VertexData *allocVertexData(EditMesh *em)
{
VertexData *data;
@@ -125,7 +126,7 @@ static VertexData *allocVertexData(EditMesh *em)
data = MEM_callocN(sizeof(VertexData) * totvert, "VertexData");
- for(index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
+ for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
{
data[index].i = index;
data[index].w = 0;
@@ -160,6 +161,8 @@ static void nodeSetData(EditVert *eve, ReebNode *n)
((VertexData*)eve->tmp.p)->n = n;
}
+#endif
+
void REEB_freeArc(BArc *barc)
{
ReebArc *arc = (ReebArc*)barc;
@@ -180,7 +183,7 @@ 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);
}
@@ -188,7 +191,7 @@ void REEB_freeGraph(ReebGraph *rg)
// free arcs
arc = rg->arcs.first;
- while( arc )
+ while ( arc )
{
ReebArc *next = arc->next;
REEB_freeArc((BArc*)arc);
@@ -232,6 +235,7 @@ void BIF_flagMultiArcs(ReebGraph *rg, int flag)
}
}
+#if 0 /* UNUSED */
static ReebNode * addNode(ReebGraph *rg, EditVert *eve)
{
float weight;
@@ -300,6 +304,7 @@ static void relinkNodes(ReebGraph *low_rg, ReebGraph *high_rg)
}
}
}
+#endif
ReebNode *BIF_otherNodeFromIndex(ReebArc *arc, ReebNode *node)
{
@@ -321,6 +326,7 @@ ReebNode *BIF_lowestLevelNode(ReebNode *node)
return node;
}
+#if 0 /* UNUSED */
static ReebArc * copyArc(ReebGraph *rg, ReebArc *arc)
{
ReebArc *cp_arc;
@@ -395,12 +401,13 @@ static ReebGraph * copyReebGraph(ReebGraph *rg, int level)
return cp_rg;
}
+#endif
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;
}
@@ -408,6 +415,7 @@ ReebGraph *BIF_graphForMultiNode(ReebGraph *rg, ReebNode *node)
return multi_rg;
}
+#if 0 /* UNUSED */
static ReebEdge * copyEdge(ReebEdge *edge)
{
ReebEdge *newEdge = NULL;
@@ -428,7 +436,7 @@ static void printArc(ReebArc *arc)
ReebNode *tail = (ReebNode*)arc->tail;
printf("arc: (%i) %f -> (%i) %f\n", head->index, head->weight, tail->index, tail->weight);
- for(edge = arc->edges.first; edge ; edge = edge->next)
+ for (edge = arc->edges.first; edge ; edge = edge->next)
{
printf("\tedge (%i, %i)\n", edge->v1->index, edge->v2->index);
}
@@ -476,12 +484,12 @@ void repositionNodes(ReebGraph *rg)
BNode *node = NULL;
// Reset node positions
- for(node = rg->nodes.first; node; node = node->next)
+ for (node = rg->nodes.first; node; node = node->next)
{
node->p[0] = node->p[1] = node->p[2] = 0;
}
- for(arc = rg->arcs.first; arc; arc = arc->next)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
if (((ReebArc*)arc)->bcount > 0)
{
@@ -504,10 +512,10 @@ 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)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
if (arc->head == node || arc->tail == node)
{
@@ -534,7 +542,7 @@ static void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc)
if (arc->bcount > 0)
{
int i;
- for(i = 0; i < arc->bcount; i++)
+ for (i = 0; i < arc->bcount; i++)
{
if (arc->buckets[i].nv == 0)
{
@@ -560,7 +568,7 @@ void verifyBuckets(ReebGraph *rg)
{
#ifdef DEBUG_REEB
ReebArc *arc = NULL;
- for(arc = rg->arcs.first; arc; arc = arc->next)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
verifyBucketsArc(rg, arc);
}
@@ -572,7 +580,7 @@ void verifyFaces(ReebGraph *rg)
#ifdef DEBUG_REEB
int total = 0;
ReebArc *arc = NULL;
- for(arc = rg->arcs.first; arc; arc = arc->next)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
total += BLI_ghash_size(arc->faces);
}
@@ -659,17 +667,17 @@ static void mergeArcBuckets(ReebArc *aDst, ReebArc *aSrc, float start, float end
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++;
}
- for( ; indexDst < aDst->bcount &&
+ for ( ; indexDst < aDst->bcount &&
indexSrc < aSrc->bcount &&
aDst->buckets[indexDst].val <= end &&
aSrc->buckets[indexSrc].val <= end
@@ -710,7 +718,7 @@ static void allocArcBuckets(ReebArc *arc)
{
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;
}
@@ -771,7 +779,7 @@ static void reweightBuckets(ReebArc *arc)
if (arc->bcount > 0)
{
- for(i = 0; i < arc->bcount; i++)
+ for (i = 0; i < arc->bcount; i++)
{
arc->buckets[i].val = start + i;
}
@@ -802,7 +810,7 @@ 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;
@@ -954,6 +962,7 @@ static void calculateGraphLength(ReebGraph *rg)
calculateArcLength(arc);
}
}
+#endif
/**************************************** SYMMETRY HANDLING ******************************************/
@@ -1004,12 +1013,12 @@ 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);
}
@@ -1066,12 +1075,12 @@ 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);
}
@@ -1127,12 +1136,12 @@ 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);
}
@@ -1160,6 +1169,7 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
/****************************************** SMOOTHING **************************************************/
+#if 0 /* UNUSED */
void postprocessGraph(ReebGraph *rg, char mode)
{
ReebArc *arc;
@@ -1184,13 +1194,13 @@ void postprocessGraph(ReebGraph *rg, char mode)
return;
}
- for(arc = rg->arcs.first; arc; arc = arc->next)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
EmbedBucket *buckets = arc->buckets;
int bcount = arc->bcount;
int index;
- for(index = 1; index < bcount - 1; index++)
+ for (index = 1; index < bcount - 1; index++)
{
interp_v3_v3v3(buckets[index].p, buckets[index].p, buckets[index - 1].p, fac1 / (fac1 + fac2));
interp_v3_v3v3(buckets[index].p, buckets[index].p, buckets[index + 1].p, fac3 / (fac1 + fac2 + fac3));
@@ -1501,7 +1511,7 @@ static void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, R
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)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
if (arc->head == srcArc->head && arc->tail == srcArc->tail && arc != srcArc)
{
@@ -1514,7 +1524,7 @@ 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;
@@ -1577,7 +1587,7 @@ 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
@@ -1739,14 +1749,14 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
#ifdef DEBUG_REEB
{
EditFace *efa;
- for(efa=G.editMesh->faces.first; efa; efa=efa->next) {
+ for (efa=G.editMesh->faces.first; efa; efa=efa->next) {
efa->tmp.fp = -1;
}
}
#endif
arc = rg->arcs.first;
- while(arc)
+ while (arc)
{
nextArc = arc->next;
@@ -1762,7 +1772,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
float avg_angle = 0;
float avg_vec[3] = {0,0,0};
- for(BLI_ghashIterator_init(&ghi, arc->faces);
+ for (BLI_ghashIterator_init(&ghi, arc->faces);
!BLI_ghashIterator_isDone(&ghi);
BLI_ghashIterator_step(&ghi))
{
@@ -1953,7 +1963,7 @@ static void finalizeGraph(ReebGraph *rg, char passes, char method)
sortArcs(rg);
- for(i = 0; i < passes; i++)
+ for (i = 0; i < passes; i++)
{
postprocessGraph(rg, method);
}
@@ -1991,17 +2001,17 @@ 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];
@@ -2041,16 +2051,16 @@ void REEB_exportGraph(ReebGraph *rg, int count)
else {
sprintf(filename, "test%05i.txt", count);
}
- f = fopen(filename, "w");
+ 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]);
}
@@ -2088,7 +2098,7 @@ 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;
@@ -2166,7 +2176,7 @@ 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;
@@ -2188,7 +2198,7 @@ void mergeArcFaces(ReebGraph *UNUSED(rg), ReebArc *aDst, ReebArc *aSrc)
{
GHashIterator ghi;
- for(BLI_ghashIterator_init(&ghi, aSrc->faces);
+ for (BLI_ghashIterator_init(&ghi, aSrc->faces);
!BLI_ghashIterator_isDone(&ghi);
BLI_ghashIterator_step(&ghi))
{
@@ -2203,7 +2213,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
if (direction == MERGE_APPEND)
{
- for(e = aSrc->edges.first; e; e = e->next)
+ for (e = aSrc->edges.first; e; e = e->next)
{
e->arc = aDst; // Edge is stolen by new arc
}
@@ -2212,7 +2222,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
}
else
{
- for(e = aSrc->edges.first; e; e = e->next)
+ for (e = aSrc->edges.first; e; e = e->next)
{
ReebEdge *newEdge = copyEdge(e);
@@ -2236,7 +2246,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
{
ReebEdge *previous = (ReebEdge*)*p;
- while(previous->nextEdge != e)
+ while (previous->nextEdge != e)
{
previous = previous->nextEdge;
}
@@ -2487,7 +2497,7 @@ static ReebEdge * createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
addVertToBucket(&(arc->buckets[arc->bcount - 1]), arc->tail->co);
}
#else
- for(i = 0; i < arc->bcount; i++)
+ for (i = 0; i < arc->bcount; i++)
{
float co[3];
float f = (arc->buckets[i].val - offset) / len;
@@ -2585,7 +2595,7 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
renormalizeWeight(em, (float)rg->resolution);
/* Adding vertice */
- for(index = 0, eve = em->verts.first; eve; eve = eve->next)
+ for (index = 0, eve = em->verts.first; eve; eve = eve->next)
{
if (eve->h == 0)
{
@@ -2596,7 +2606,7 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
}
/* Adding face, edge per edge */
- for(efa = em->faces.first; efa; efa = efa->next)
+ for (efa = em->faces.first; efa; efa = efa->next)
{
if (efa->h == 0)
{
@@ -2646,7 +2656,7 @@ void renormalizeWeight(EditMesh *em, float newmax)
eve = em->verts.first;
minimum = weightData(eve);
maximum = minimum;
- for(; eve; eve = eve->next)
+ for (; eve; eve = eve->next)
{
maximum = MAX2(maximum, weightData(eve));
minimum = MIN2(minimum, weightData(eve));
@@ -2655,7 +2665,7 @@ void renormalizeWeight(EditMesh *em, float newmax)
range = maximum - minimum;
/* Normalize weights */
- for(eve = em->verts.first; eve; eve = eve->next)
+ for (eve = em->verts.first; eve; eve = eve->next)
{
float weight = (weightData(eve) - minimum) / range * newmax;
weightSetData(eve, weight);
@@ -2671,7 +2681,7 @@ int weightFromLoc(EditMesh *em, int axis)
return 0;
/* Copy coordinate in weight */
- for(eve = em->verts.first; eve; eve = eve->next)
+ for (eve = em->verts.first; eve; eve = eve->next)
{
weightSetData(eve, eve->co[axis]);
}
@@ -2735,7 +2745,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
int rval;
/* Find local extrema */
- for(eve = em->verts.first; eve; eve = eve->next)
+ for (eve = em->verts.first; eve; eve = eve->next)
{
totvert++;
}
@@ -2749,7 +2759,7 @@ 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)
+ for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
{
if (eve->h == 0)
{
@@ -2758,7 +2768,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
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;
@@ -2803,13 +2813,13 @@ 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)
+ for (efa = em->faces.first; efa; efa = efa->next)
{
if (efa->h == 0)
{
@@ -2825,7 +2835,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
}
/* Add faces angle to the edge weight */
- for(efa = em->faces.first; efa; efa = efa->next)
+ for (efa = em->faces.first; efa; efa = efa->next)
{
if (efa->h == 0)
{
@@ -2850,7 +2860,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
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));
}
@@ -2906,7 +2916,7 @@ 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;
}
@@ -2919,7 +2929,7 @@ static void shortestPathsFromVert(EditMesh *em, EditVert *starting_vert, EdgeInd
/* 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)))
+ for (eed = NextEdgeForVert(indexed_edges, indexData(current_eve)); eed; eed = NextEdgeForVert(indexed_edges, indexData(current_eve)))
{
if (eed->f1 == 0)
{
@@ -2973,7 +2983,7 @@ 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)
+ for (eed = em->edges.first; eed; eed = eed->next)
{
if (eed->v1->h == 0 && eed->v2->h == 0)
{
@@ -2988,7 +2998,7 @@ 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)
+ for (eve = em->verts.first; eve; eve = eve->next)
{
if (eve->h == 0)
{
@@ -2999,7 +3009,7 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
}
/* adding edges in array */
- for(eed = em->edges.first; eed; eed= eed->next)
+ for (eed = em->edges.first; eed; eed= eed->next)
{
if (eed->v1->h == 0 && eed->v2->h == 0)
{
@@ -3047,7 +3057,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
}
/* 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)
@@ -3066,7 +3076,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
int allDone = 0;
/* Calculate edge weight */
- for(eed = em->edges.first; eed; eed= eed->next)
+ for (eed = em->edges.first; eed; eed= eed->next)
{
if (eed->v1->h == 0 && eed->v2->h == 0)
{
@@ -3075,7 +3085,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
}
/* Apply dijkstra spf for each selected vert */
- for(eve = em->verts.first; eve; eve = eve->next)
+ for (eve = em->verts.first; eve; eve = eve->next)
{
if (eve->f & SELECT)
{
@@ -3127,7 +3137,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
}
}
- for(eve = em->verts.first; eve && vCount == 0; eve = eve->next)
+ for (eve = em->verts.first; eve && vCount == 0; eve = eve->next)
{
if (eve->f1 == 0)
{
@@ -3138,6 +3148,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
return 1;
}
+#endif
/****************************************** BUCKET ITERATOR **************************************************/
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index b213f797d47..94ec7c7ce93 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -140,17 +140,17 @@ void ED_operatormacros_curve(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot= WM_operatortype_append_macro("CURVE_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("CURVE_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Duplicate curve and move";
WM_operatortype_macro_define(ot, "CURVE_OT_duplicate");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
- ot= WM_operatortype_append_macro("CURVE_OT_extrude_move", "Extrude Curve and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("CURVE_OT_extrude_move", "Extrude Curve and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Extrude curve and move result";
WM_operatortype_macro_define(ot, "CURVE_OT_extrude");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
}
@@ -160,8 +160,8 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
wmKeyMap *keymap;
wmKeyMapItem *kmi;
- keymap= WM_keymap_find(keyconf, "Font", 0, 0);
- keymap->poll= ED_operator_editfont;
+ keymap = WM_keymap_find(keyconf, "Font", 0, 0);
+ keymap->poll = ED_operator_editfont;
/* only set in editmode font, by space_view3d listener */
RNA_enum_set(WM_keymap_add_item(keymap, "FONT_OT_style_toggle", BKEY, KM_PRESS, KM_CTRL, 0)->ptr, "style", CU_CHINFO_BOLD);
@@ -214,8 +214,8 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "accent", TRUE); /* accented characters */
/* only set in editmode curve, by space_view3d listener */
- keymap= WM_keymap_find(keyconf, "Curve", 0, 0);
- keymap->poll= ED_operator_editsurfcurve;
+ keymap = WM_keymap_find(keyconf, "Curve", 0, 0);
+ keymap->poll = ED_operator_editsurfcurve;
WM_keymap_add_menu(keymap, "INFO_MT_edit_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index aa8dad08ac2..aeab4f27179 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -117,7 +117,7 @@ static float nurbcircle[8][2]= {
ListBase *object_editcurve_get(Object *ob)
{
- if(ob && ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ if (ob && ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu= ob->data;
return &cu->editnurb->nurbs;
}
@@ -129,7 +129,7 @@ static void set_actNurb(Object *obedit, Nurb *nu)
{
Curve *cu= obedit->data;
- if(nu==NULL)
+ if (nu==NULL)
cu->actnu = -1;
else {
ListBase *nurbs= curve_editnurbs(cu);
@@ -157,9 +157,9 @@ static Nurb *get_actNurb(Object *obedit)
/* returns 1 in case (de)selection was successful */
static short select_beztriple(BezTriple *bezt, short selstatus, short flag, short hidden)
{
- if(bezt) {
- if((bezt->hide==0) || (hidden==1)) {
- if(selstatus==1) { /* selects */
+ if (bezt) {
+ if ((bezt->hide==0) || (hidden==1)) {
+ if (selstatus==1) { /* selects */
bezt->f1 |= flag;
bezt->f2 |= flag;
bezt->f3 |= flag;
@@ -180,9 +180,9 @@ static short select_beztriple(BezTriple *bezt, short selstatus, short flag, shor
/* returns 1 in case (de)selection was successful */
static short select_bpoint(BPoint *bp, short selstatus, short flag, short hidden)
{
- if(bp) {
- if((bp->hide==0) || (hidden==1)) {
- if(selstatus==1) {
+ if (bp) {
+ if ((bp->hide==0) || (hidden==1)) {
+ if (selstatus==1) {
bp->f1 |= flag;
return 1;
}
@@ -198,7 +198,7 @@ static short select_bpoint(BPoint *bp, short selstatus, short flag, short hidden
static short swap_selection_beztriple(BezTriple *bezt)
{
- if(bezt->f2 & SELECT)
+ if (bezt->f2 & SELECT)
return select_beztriple(bezt, DESELECT, 1, VISIBLE);
else
return select_beztriple(bezt, SELECT, 1, VISIBLE);
@@ -206,7 +206,7 @@ static short swap_selection_beztriple(BezTriple *bezt)
static short swap_selection_bpoint(BPoint *bp)
{
- if(bp->f1 & SELECT)
+ if (bp->f1 & SELECT)
return select_bpoint(bp, DESELECT, 1, VISIBLE);
else
return select_bpoint(bp, SELECT, 1, VISIBLE);
@@ -218,19 +218,19 @@ int isNurbsel(Nurb *nu)
BPoint *bp;
int a;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if( (bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT) ) return 1;
+ while (a--) {
+ if ( (bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT) ) return 1;
bezt++;
}
}
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if( (bp->f1 & SELECT) ) return 1;
+ while (a--) {
+ if ( (bp->f1 & SELECT) ) return 1;
bp++;
}
}
@@ -243,10 +243,10 @@ static int isNurbsel_count(Curve *cu, Nurb *nu)
BPoint *bp;
int a, sel=0;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) sel++;
bezt++;
}
@@ -254,8 +254,8 @@ static int isNurbsel_count(Curve *cu, Nurb *nu)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if( (bp->f1 & SELECT) ) sel++;
+ while (a--) {
+ if ( (bp->f1 & SELECT) ) sel++;
bp++;
}
}
@@ -270,15 +270,15 @@ void printknots(Object *obedit)
Nurb *nu;
int a, num;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(isNurbsel(nu) && nu->type == CU_NURBS) {
- if(nu->knotsu) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (isNurbsel(nu) && nu->type == CU_NURBS) {
+ if (nu->knotsu) {
num= KNOTSU(nu);
- for(a=0;a<num;a++) printf("knotu %d: %f\n", a, nu->knotsu[a]);
+ for (a=0;a<num;a++) printf("knotu %d: %f\n", a, nu->knotsu[a]);
}
- if(nu->knotsv) {
+ if (nu->knotsv) {
num= KNOTSV(nu);
- for(a=0;a<num;a++) printf("knotv %d: %f\n", a, nu->knotsv[a]);
+ for (a=0;a<num;a++) printf("knotv %d: %f\n", a, nu->knotsv[a]);
}
}
}
@@ -310,7 +310,7 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
CVKeyIndex *keyIndex;
int a, key_index= 0, nu_index= 0, pt_index= 0;
- if(editnurb->keyindex) return;
+ if (editnurb->keyindex) return;
gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "editNurb keyIndex");
@@ -328,7 +328,8 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
origbezt++;
pt_index++;
}
- } else {
+ }
+ else {
a= orignu->pntsu * orignu->pntsv;
bp= nu->bp;
origbp= orignu->bp;
@@ -424,7 +425,8 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
BLI_ghash_remove(editnurb->keyindex, bezt, NULL, (GHashValFreeFP)MEM_freeN);
++bezt;
}
- } else {
+ }
+ else {
BPoint *bp= nu->bp;
a= nu->pntsu * nu->pntsv;
@@ -487,7 +489,8 @@ static void keyIndex_updateNurb(EditNurb *editnurb, Nurb *nu, Nurb *newnu)
{
if (nu->bezt) {
keyIndex_updateBezt(editnurb, nu->bezt, newnu->bezt, newnu->pntsu);
- } else {
+ }
+ else {
keyIndex_updateBP(editnurb, nu->bp, newnu->bp, newnu->pntsu * newnu->pntsv);
}
}
@@ -500,8 +503,8 @@ static void keyIndex_swap(EditNurb *editnurb, void *a, void *b)
BLI_ghash_remove(editnurb->keyindex, a, NULL, NULL);
BLI_ghash_remove(editnurb->keyindex, b, NULL, NULL);
- if(index2) BLI_ghash_insert(editnurb->keyindex, a, index2);
- if(index1) BLI_ghash_insert(editnurb->keyindex, b, index1);
+ if (index2) BLI_ghash_insert(editnurb->keyindex, a, index2);
+ if (index1) BLI_ghash_insert(editnurb->keyindex, b, index1);
}
static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
@@ -525,18 +528,19 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
index1= getCVKeyIndex(editnurb, bezt1);
index2= getCVKeyIndex(editnurb, bezt2);
- if(index1) index1->switched= !index1->switched;
+ if (index1) index1->switched= !index1->switched;
if (bezt1 != bezt2) {
keyIndex_swap(editnurb, bezt1, bezt2);
- if(index2) index2->switched= !index2->switched;
+ if (index2) index2->switched= !index2->switched;
}
bezt1++;
bezt2--;
}
- } else {
+ }
+ else {
BPoint *bp1, *bp2;
if (nu->pntsv == 1) {
@@ -544,14 +548,14 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
bp1= nu->bp;
bp2= bp1+(a-1);
a/= 2;
- while(bp1!=bp2 && a>0) {
+ while (bp1!=bp2 && a>0) {
index1= getCVKeyIndex(editnurb, bp1);
index2= getCVKeyIndex(editnurb, bp2);
- if(index1) index1->switched= !index1->switched;
+ if (index1) index1->switched= !index1->switched;
if (bp1 != bp2) {
- if(index2) index2->switched= !index2->switched;
+ if (index2) index2->switched= !index2->switched;
keyIndex_swap(editnurb, bp1, bp2);
}
@@ -560,24 +564,25 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
bp1++;
bp2--;
}
- } else {
+ }
+ else {
int b;
- for(b=0; b<nu->pntsv; b++) {
+ for (b=0; b<nu->pntsv; b++) {
bp1= nu->bp+b*nu->pntsu;
a= nu->pntsu;
bp2= bp1+(a-1);
a/= 2;
- while(bp1!=bp2 && a>0) {
+ while (bp1!=bp2 && a>0) {
index1= getCVKeyIndex(editnurb, bp1);
index2= getCVKeyIndex(editnurb, bp2);
- if(index1) index1->switched= !index1->switched;
+ if (index1) index1->switched= !index1->switched;
if (bp1 != bp2) {
- if(index2) index2->switched= !index2->switched;
+ if (index2) index2->switched= !index2->switched;
keyIndex_swap(editnurb, bp1, bp2);
}
@@ -602,7 +607,7 @@ static void switch_keys_direction(Curve *cu, Nurb *actnu)
int a;
currkey = cu->key->block.first;
- while(currkey) {
+ while (currkey) {
fp= currkey->data;
nu= nubase->first;
@@ -612,26 +617,29 @@ static void switch_keys_direction(Curve *cu, Nurb *actnu)
a= nu->pntsu;
if (nu == actnu) {
while (a--) {
- if(getKeyIndexOrig_bezt(editnurb, bezt)) {
+ if (getKeyIndexOrig_bezt(editnurb, bezt)) {
swap_v3_v3(fp, fp + 6);
*(fp+9) = -*(fp+9);
fp += 12;
}
bezt++;
}
- } else fp += a * 12;
- } else {
+ }
+ else fp += a * 12;
+ }
+ else {
BPoint *bp= nu->bp;
a= nu->pntsu * nu->pntsv;
if (nu == actnu) {
while (a--) {
- if(getKeyIndexOrig_bp(editnurb, bp)) {
+ if (getKeyIndexOrig_bp(editnurb, bp)) {
*(fp+3) = -*(fp+3);
fp += 4;
}
bp++;
}
- } else fp += a * 4;
+ }
+ else fp += a * 4;
}
nu= nu->next;
@@ -651,7 +659,7 @@ static void keyData_switchDirectionNurb(Curve *cu, Nurb *nu)
}
keyIndex_switchDirection(editnurb, nu);
- if(cu->key)
+ if (cu->key)
switch_keys_direction(cu, nu);
}
@@ -662,7 +670,7 @@ static GHash *dupli_keyIndexHash(GHash *keyindex)
gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "dupli_keyIndex gh");
- for(hashIter = BLI_ghashIterator_new(keyindex);
+ for (hashIter = BLI_ghashIterator_new(keyindex);
!BLI_ghashIterator_isDone(hashIter);
BLI_ghashIterator_step(hashIter)) {
void *cv = BLI_ghashIterator_getKey(hashIter);
@@ -710,10 +718,11 @@ static void calc_keyHandles(ListBase *nurb, float *key)
a= nu->pntsu;
startfp= fp;
- if(nu->flagu & CU_NURB_CYCLIC) {
+ if (nu->flagu & CU_NURB_CYCLIC) {
prevp= bezt+(a-1);
prevfp= fp+(12 * (a-1));
- } else {
+ }
+ else {
prevp= NULL;
prevfp= NULL;
}
@@ -732,11 +741,12 @@ static void calc_keyHandles(ListBase *nurb, float *key)
prevp= bezt;
prevfp= fp;
- if(a==1) {
- if(nu->flagu & CU_NURB_CYCLIC) {
+ if (a==1) {
+ if (nu->flagu & CU_NURB_CYCLIC) {
nextp= nu->bezt;
nextfp= startfp;
- } else {
+ }
+ else {
nextp= NULL;
nextfp= NULL;
}
@@ -749,7 +759,8 @@ static void calc_keyHandles(ListBase *nurb, float *key)
++bezt;
fp += 12;
}
- } else {
+ }
+ else {
a= nu->pntsu * nu->pntsv;
fp += a * 4;
}
@@ -763,7 +774,7 @@ static void calc_shapeKeys(Object *obedit)
Curve *cu= (Curve*)obedit->data;
/* are there keys? */
- if(cu->key) {
+ if (cu->key) {
int a, i;
EditNurb *editnurb= cu->editnurb;
KeyBlock *currkey;
@@ -777,26 +788,27 @@ static void calc_shapeKeys(Object *obedit)
float *oldkey, *newkey, *ofp;
/* editing the base key should update others */
- if(cu->key->type==KEY_RELATIVE) {
+ if (cu->key->type==KEY_RELATIVE) {
int act_is_basis = 0;
/* find if this key is a basis for any others */
- for(currkey = cu->key->block.first; currkey; currkey= currkey->next) {
- if(editnurb->shapenr-1 == currkey->relative) {
+ for (currkey = cu->key->block.first; currkey; currkey= currkey->next) {
+ if (editnurb->shapenr-1 == currkey->relative) {
act_is_basis = 1;
break;
}
}
- if(act_is_basis) { /* active key is a base */
+ if (act_is_basis) { /* active key is a base */
int totvec= 0;
/* Calculate needed memory to store offset */
nu= editnurb->nurbs.first;
- while(nu) {
+ while (nu) {
if (nu->bezt) {
/* Three vects to store handles and one for alfa */
totvec+= nu->pntsu * 4;
- } else {
+ }
+ else {
totvec+= 2 * nu->pntsu * nu->pntsv;
}
@@ -806,11 +818,11 @@ static void calc_shapeKeys(Object *obedit)
ofs= MEM_callocN(sizeof(float) * 3 * totvec, "currkey->data");
nu= editnurb->nurbs.first;
i= 0;
- while(nu) {
- if(nu->bezt) {
+ while (nu) {
+ if (nu->bezt) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
oldbezt= getKeyIndexOrig_bezt(editnurb, bezt);
if (oldbezt) {
@@ -820,7 +832,8 @@ static void calc_shapeKeys(Object *obedit)
i++;
}
ofs[i++][0]= bezt->alfa - oldbezt->alfa;
- } else {
+ }
+ else {
i += 4;
}
bezt++;
@@ -829,7 +842,7 @@ static void calc_shapeKeys(Object *obedit)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
+ while (a--) {
oldbp= getKeyIndexOrig_bp(editnurb, bp);
if (oldbp) {
sub_v3_v3v3(ofs[i], bp->vec, oldbp->vec);
@@ -846,7 +859,7 @@ static void calc_shapeKeys(Object *obedit)
}
currkey = cu->key->block.first;
- while(currkey) {
+ while (currkey) {
int apply_offset = (ofs && (currkey != actkey) && (editnurb->shapenr-1 == currkey->relative));
float *fp= newkey= MEM_callocN(cu->key->elemsize * totvert, "currkey->data");
@@ -854,14 +867,14 @@ static void calc_shapeKeys(Object *obedit)
nu= editnurb->nurbs.first;
i = 0;
- while(nu) {
- if(currkey == actkey) {
+ while (nu) {
+ if (currkey == actkey) {
int restore= actkey != cu->key->refkey;
- if(nu->bezt) {
+ if (nu->bezt) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
int j;
oldbezt= getKeyIndexOrig_bezt(editnurb, bezt);
@@ -876,7 +889,7 @@ static void calc_shapeKeys(Object *obedit)
}
fp[0]= bezt->alfa;
- if(restore && oldbezt) {
+ if (restore && oldbezt) {
bezt->alfa= oldbezt->alfa;
}
@@ -887,14 +900,14 @@ static void calc_shapeKeys(Object *obedit)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
+ while (a--) {
oldbp= getKeyIndexOrig_bp(editnurb, bp);
copy_v3_v3(fp, bp->vec);
fp[3]= bp->alfa;
- if(restore && oldbp) {
+ if (restore && oldbp) {
copy_v3_v3(bp->vec, oldbp->vec);
bp->alfa= oldbp->alfa;
}
@@ -909,12 +922,12 @@ static void calc_shapeKeys(Object *obedit)
int index;
float *curofp;
- if(oldkey) {
- if(nu->bezt) {
+ if (oldkey) {
+ if (nu->bezt) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
index= getKeyIndexOrig_keyIndex(editnurb, bezt);
if (index >= 0) {
int j;
@@ -923,7 +936,7 @@ static void calc_shapeKeys(Object *obedit)
for (j= 0; j < 3; ++j, ++i) {
copy_v3_v3(fp, curofp);
- if(apply_offset) {
+ if (apply_offset) {
add_v3_v3(fp, ofs[i]);
}
@@ -931,14 +944,15 @@ static void calc_shapeKeys(Object *obedit)
}
fp[0]= curofp[0];
- if(apply_offset) {
+ if (apply_offset) {
/* apply alfa offsets */
add_v3_v3(fp, ofs[i]);
++i;
}
fp+= 3; /* alphas */
- } else {
+ }
+ else {
int j;
for (j= 0; j < 3; ++j, ++i) {
copy_v3_v3(fp, bezt->vec[j]);
@@ -954,7 +968,7 @@ static void calc_shapeKeys(Object *obedit)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
+ while (a--) {
index= getKeyIndexOrig_keyIndex(editnurb, bp);
if (index >= 0) {
@@ -962,11 +976,12 @@ static void calc_shapeKeys(Object *obedit)
copy_v3_v3(fp, curofp);
fp[3]= curofp[3];
- if(apply_offset) {
+ if (apply_offset) {
add_v3_v3(fp, ofs[i]);
fp[3]+=ofs[i+1][0];
}
- } else {
+ }
+ else {
copy_v3_v3(fp, bp->vec);
fp[3]= bp->alfa;
}
@@ -988,13 +1003,13 @@ static void calc_shapeKeys(Object *obedit)
}
currkey->totelem= totvert;
- if(currkey->data) MEM_freeN(currkey->data);
+ if (currkey->data) MEM_freeN(currkey->data);
currkey->data = newkey;
currkey= currkey->next;
}
- if(ofs) MEM_freeN(ofs);
+ if (ofs) MEM_freeN(ofs);
}
}
@@ -1016,7 +1031,7 @@ static void fcurve_path_rename(AnimData *ad, char *orig_rna_path, char *rna_path
fcu= orig_curves->first;
while (fcu) {
nextfcu= fcu->next;
- if(!strncmp(fcu->rna_path, orig_rna_path, len)) {
+ if (!strncmp(fcu->rna_path, orig_rna_path, len)) {
char *spath, *suffix= fcu->rna_path + len;
nfcu= copy_fcurve(fcu);
spath= nfcu->rna_path;
@@ -1042,7 +1057,7 @@ static void fcurve_path_rename(AnimData *ad, char *orig_rna_path, char *rna_path
static void fcurve_remove(AnimData *ad, ListBase *orig_curves, FCurve *fcu)
{
- if(orig_curves==&ad->drivers) BLI_remlink(&ad->drivers, fcu);
+ if (orig_curves==&ad->drivers) BLI_remlink(&ad->drivers, fcu);
else action_groups_remove_channel(ad->action, fcu);
free_fcurve(fcu);
@@ -1060,19 +1075,19 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
ListBase curves= {NULL, NULL};
FCurve *fcu, *next;
- while(nu) {
- if(nu->bezt) {
+ while (nu) {
+ if (nu->bezt) {
BezTriple *bezt= nu->bezt;
a= nu->pntsu;
pt_index= 0;
while (a--) {
keyIndex= getCVKeyIndex(editnurb, bezt);
- if(keyIndex) {
+ if (keyIndex) {
BLI_snprintf(rna_path, sizeof(rna_path), "splines[%d].bezier_points[%d]", nu_index, pt_index);
BLI_snprintf(orig_rna_path, sizeof(orig_rna_path), "splines[%d].bezier_points[%d]", keyIndex->nu_index, keyIndex->pt_index);
- if(keyIndex->switched) {
+ if (keyIndex->switched) {
char handle_path[64], orig_handle_path[64];
BLI_snprintf(orig_handle_path, sizeof(orig_rna_path), "%s.handle_left", orig_rna_path);
BLI_snprintf(handle_path, sizeof(rna_path), "%s.handle_right", rna_path);
@@ -1092,14 +1107,15 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
bezt++;
pt_index++;
}
- } else {
+ }
+ else {
BPoint *bp= nu->bp;
a= nu->pntsu * nu->pntsv;
pt_index= 0;
while (a--) {
keyIndex= getCVKeyIndex(editnurb, bp);
- if(keyIndex) {
+ if (keyIndex) {
BLI_snprintf(rna_path, sizeof(rna_path), "splines[%d].points[%d]", nu_index, pt_index);
BLI_snprintf(orig_rna_path, sizeof(orig_rna_path), "splines[%d].points[%d]", keyIndex->nu_index, keyIndex->pt_index);
fcurve_path_rename(ad, orig_rna_path, rna_path, orig_curves, &curves);
@@ -1119,10 +1135,10 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
/* remove paths for removed control points
* need this to make further step with copying non-cv related curves copying
* not touching cv's f-curves */
- for(fcu= orig_curves->first; fcu; fcu= next) {
+ for (fcu= orig_curves->first; fcu; fcu= next) {
next= fcu->next;
- if(!strncmp(fcu->rna_path, "splines", 7)) {
+ if (!strncmp(fcu->rna_path, "splines", 7)) {
char *ch= strchr(fcu->rna_path, '.');
if (ch && (!strncmp(ch, ".bezier_points", 14) || !strncmp(ch, ".points", 7)))
@@ -1132,14 +1148,14 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
nu_index= 0;
nu= editnurb->nurbs.first;
- while(nu) {
+ while (nu) {
keyIndex= NULL;
- if(nu->pntsu) {
- if(nu->bezt) keyIndex= getCVKeyIndex(editnurb, &nu->bezt[0]);
+ if (nu->pntsu) {
+ if (nu->bezt) keyIndex= getCVKeyIndex(editnurb, &nu->bezt[0]);
else keyIndex= getCVKeyIndex(editnurb, &nu->bp[0]);
}
- if(keyIndex) {
+ if (keyIndex) {
BLI_snprintf(rna_path, sizeof(rna_path), "splines[%d]", nu_index);
BLI_snprintf(orig_rna_path, sizeof(orig_rna_path), "splines[%d]", keyIndex->nu_index);
fcurve_path_rename(ad, orig_rna_path, rna_path, orig_curves, &curves);
@@ -1151,10 +1167,10 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
/* the remainders in orig_curves can be copied back (like follow path) */
/* (if it's not path to spline) */
- for(fcu= orig_curves->first; fcu; fcu= next) {
+ for (fcu= orig_curves->first; fcu; fcu= next) {
next= fcu->next;
- if(!strncmp(fcu->rna_path, "splines", 7)) fcurve_remove(ad, orig_curves, fcu);
+ if (!strncmp(fcu->rna_path, "splines", 7)) fcurve_remove(ad, orig_curves, fcu);
else BLI_addtail(&curves, fcu);
}
@@ -1167,9 +1183,9 @@ int ED_curve_updateAnimPaths(Object *obedit)
Curve *cu= (Curve*)obedit->data;
AnimData *ad= BKE_animdata_from_id(&cu->id);
- if(!curve_is_animated(obedit)) return 0;
+ if (!curve_is_animated(obedit)) return 0;
- if(ad->action)
+ if (ad->action)
curve_rename_fcurves(obedit, &ad->action->curves);
curve_rename_fcurves(obedit, &ad->drivers);
@@ -1184,7 +1200,7 @@ void load_editNurb(Object *obedit)
{
ListBase *editnurb= object_editcurve_get(obedit);
- if(obedit==NULL) return;
+ if (obedit==NULL) return;
set_actNurb(obedit, NULL);
@@ -1193,11 +1209,11 @@ void load_editNurb(Object *obedit)
Nurb *nu, *newnu;
ListBase newnurb= {NULL, NULL}, oldnurb= cu->nurb;
- for(nu= editnurb->first; nu; nu= nu->next) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
newnu= duplicateNurb(nu);
BLI_addtail(&newnurb, newnu);
- if(nu->type == CU_NURBS) {
+ if (nu->type == CU_NURBS) {
clamp_nurb_order_u(nu);
}
}
@@ -1227,17 +1243,18 @@ void make_editNurb(Object *obedit)
if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
actkey= ob_get_keyblock(obedit);
- if(actkey) {
+ if (actkey) {
// XXX strcpy(G.editModeTitleExtra, "(Key) ");
undo_editmode_clear();
key_to_curve(actkey, cu, &cu->nurb);
}
- if(editnurb) {
+ if (editnurb) {
freeNurblist(&editnurb->nurbs);
free_curve_editNurb_keyIndex(editnurb);
editnurb->keyindex= NULL;
- } else {
+ }
+ else {
editnurb= MEM_callocN(sizeof(EditNurb), "editnurb");
cu->editnurb= editnurb;
}
@@ -1245,7 +1262,7 @@ void make_editNurb(Object *obedit)
nu= cu->nurb.first;
cu->lastsel= NULL; /* for select row */
- while(nu) {
+ while (nu) {
newnu= duplicateNurb(nu);
test2DNurb(newnu); // after join, or any other creation of curve
BLI_addtail(&editnurb->nurbs, newnu);
@@ -1258,7 +1275,7 @@ void make_editNurb(Object *obedit)
nu= nu->next;
}
- if(actkey)
+ if (actkey)
editnurb->shapenr= obedit->shapenr;
/* animation could be added in editmode even if there was no animdata i
@@ -1307,14 +1324,14 @@ void CU_select_swap(Object *obedit)
cu->lastsel= NULL;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->hide==0) {
+ while (a--) {
+ if (bezt->hide==0) {
bezt->f2 ^= SELECT; /* always do the center point */
- if((cu->drawflag & CU_HIDE_HANDLES)==0) {
+ if ((cu->drawflag & CU_HIDE_HANDLES)==0) {
bezt->f1 ^= SELECT;
bezt->f3 ^= SELECT;
}
@@ -1325,7 +1342,7 @@ void CU_select_swap(Object *obedit)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
+ while (a--) {
swap_selection_bpoint(bp);
bp++;
}
@@ -1351,7 +1368,7 @@ static int separate_exec(bContext *C, wmOperator *op)
oldcu= oldob->data;
oldedit= oldcu->editnurb;
- if(oldcu->key) {
+ if (oldcu->key) {
BKE_report(op->reports, RPT_ERROR, "Can't separate a curve with vertex keys");
return OPERATOR_CANCELLED;
}
@@ -1374,10 +1391,10 @@ static int separate_exec(bContext *C, wmOperator *op)
free_curve_editNurb_keyIndex(newedit);
/* 3. move over parts from old object */
- for(nu= oldedit->nurbs.first; nu; nu=nu1) {
+ for (nu= oldedit->nurbs.first; nu; nu=nu1) {
nu1= nu->next;
- if(isNurbsel(nu)) {
+ if (isNurbsel(nu)) {
BLI_remlink(&oldedit->nurbs, nu);
BLI_addtail(&newedit->nurbs, nu);
}
@@ -1400,15 +1417,15 @@ static int separate_exec(bContext *C, wmOperator *op)
void CURVE_OT_separate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Separate";
- ot->idname= "CURVE_OT_separate";
+ ot->name = "Separate";
+ ot->idname = "CURVE_OT_separate";
/* api callbacks */
- ot->exec= separate_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = separate_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************* FLAGS ********************* */
@@ -1424,33 +1441,33 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag)
*u= *v= -1;
bp= nu->bp;
- for(b=0; b<nu->pntsv; b++) {
+ for (b=0; b<nu->pntsv; b++) {
sel= 0;
- for(a=0; a<nu->pntsu; a++, bp++) {
- if(bp->f1 & flag) sel++;
+ for (a=0; a<nu->pntsu; a++, bp++) {
+ if (bp->f1 & flag) sel++;
}
- if(sel==nu->pntsu) {
- if(*u== -1) *u= b;
+ if (sel==nu->pntsu) {
+ if (*u== -1) *u= b;
else return 0;
}
- else if(sel>1) return 0; /* because sel==1 is still ok */
+ else if (sel>1) return 0; /* because sel==1 is still ok */
}
- for(a=0; a<nu->pntsu; a++) {
+ for (a=0; a<nu->pntsu; a++) {
sel= 0;
bp= nu->bp+a;
- for(b=0; b<nu->pntsv; b++, bp+=nu->pntsu) {
- if(bp->f1 & flag) sel++;
+ for (b=0; b<nu->pntsv; b++, bp+=nu->pntsu) {
+ if (bp->f1 & flag) sel++;
}
- if(sel==nu->pntsv) {
- if(*v== -1) *v= a;
+ if (sel==nu->pntsv) {
+ if (*v== -1) *v= a;
else return 0;
}
- else if(sel>1) return 0;
+ else if (sel>1) return 0;
}
- if(*u==-1 && *v>-1) return 1;
- if(*v==-1 && *u>-1) return 1;
+ if (*u==-1 && *v>-1) return 1;
+ if (*v==-1 && *u>-1) return 1;
return 0;
}
@@ -1461,11 +1478,11 @@ static void setflagsNurb(ListBase *editnurb, short flag)
BPoint *bp;
int a;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
+ while (a--) {
bezt->f1= bezt->f2= bezt->f3= flag;
bezt++;
}
@@ -1473,7 +1490,7 @@ static void setflagsNurb(ListBase *editnurb, short flag)
else {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
+ while (a--) {
bp->f1= flag;
bp++;
}
@@ -1488,13 +1505,13 @@ static void rotateflagNurb(ListBase *editnurb, short flag, float *cent, float ro
BPoint *bp;
int a;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_NURBS) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_NURBS) {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & flag) {
+ while (a--) {
+ if (bp->f1 & flag) {
sub_v3_v3(bp->vec, cent);
mul_m3_v3(rotmat, bp->vec);
add_v3_v3(bp->vec, cent);
@@ -1513,22 +1530,22 @@ static void translateflagNurb(ListBase *editnurb, short flag, const float vec[3]
BPoint *bp;
int a;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
- if(bezt->f1 & flag) add_v3_v3(bezt->vec[0], vec);
- if(bezt->f2 & flag) add_v3_v3(bezt->vec[1], vec);
- if(bezt->f3 & flag) add_v3_v3(bezt->vec[2], vec);
+ while (a--) {
+ if (bezt->f1 & flag) add_v3_v3(bezt->vec[0], vec);
+ if (bezt->f2 & flag) add_v3_v3(bezt->vec[1], vec);
+ if (bezt->f3 & flag) add_v3_v3(bezt->vec[2], vec);
bezt++;
}
}
else {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
- if(bp->f1 & flag) add_v3_v3(bp->vec, vec);
+ while (a--) {
+ if (bp->f1 & flag) add_v3_v3(bp->vec, vec);
bp++;
}
}
@@ -1543,12 +1560,12 @@ static void weightflagNurb(ListBase *editnurb, short flag, float w)
BPoint *bp;
int a;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_NURBS) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_NURBS) {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
- if(bp->f1 & flag) {
+ while (a--) {
+ if (bp->f1 & flag) {
/* a mode used to exist for replace/multiple but is was unused */
bp->vec[3]*= w;
}
@@ -1567,25 +1584,25 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
BPoint *bp, *bpn, *newbp;
int a, b, newu, newv, sel;
- if(obedit->type==OB_SURF);
+ if (obedit->type==OB_SURF);
else return OPERATOR_CANCELLED;
cu->lastsel= NULL;
nu= editnurb->first;
- while(nu) {
+ while (nu) {
next= nu->next;
/* is entire nurb selected */
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a) {
+ while (a) {
a--;
- if(bp->f1 & flag);
+ if (bp->f1 & flag);
else break;
bp++;
}
- if(a==0) {
+ if (a==0) {
BLI_remlink(editnurb, nu);
keyIndex_delNurb(cu->editnurb, nu);
freeNurb(nu); nu=NULL;
@@ -1594,30 +1611,31 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
/* is nurb in U direction selected */
newv= nu->pntsv;
bp= nu->bp;
- for(b=0; b<nu->pntsv; b++) {
+ for (b=0; b<nu->pntsv; b++) {
sel= 0;
- for(a=0; a<nu->pntsu; a++, bp++) {
- if(bp->f1 & flag) sel++;
+ for (a=0; a<nu->pntsu; a++, bp++) {
+ if (bp->f1 & flag) sel++;
}
- if(sel==nu->pntsu) {
+ if (sel==nu->pntsu) {
newv--;
}
- else if(sel>=1) {
+ else if (sel>=1) {
/* don't delete */
break;
}
}
- if(newv!=nu->pntsv && b==nu->pntsv) {
+ if (newv!=nu->pntsv && b==nu->pntsv) {
/* delete */
bp= nu->bp;
bpn = newbp =
(BPoint*) MEM_mallocN(newv * nu->pntsu * sizeof(BPoint), "deleteNurb");
- for(b=0; b<nu->pntsv; b++) {
- if((bp->f1 & flag)==0) {
+ for (b=0; b<nu->pntsv; b++) {
+ if ((bp->f1 & flag)==0) {
memcpy(bpn, bp, nu->pntsu*sizeof(BPoint));
keyIndex_updateBP(cu->editnurb, bp, bpn, nu->pntsu);
bpn+= nu->pntsu;
- } else {
+ }
+ else {
keyIndex_delBP(cu->editnurb, bp);
}
bp+= nu->pntsu;
@@ -1632,44 +1650,45 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
else {
/* is the nurb in V direction selected */
newu= nu->pntsu;
- for(a=0; a<nu->pntsu; a++) {
+ for (a=0; a<nu->pntsu; a++) {
bp= nu->bp+a;
sel= 0;
- for(b=0; b<nu->pntsv; b++, bp+=nu->pntsu) {
- if(bp->f1 & flag) sel++;
+ for (b=0; b<nu->pntsv; b++, bp+=nu->pntsu) {
+ if (bp->f1 & flag) sel++;
}
- if(sel==nu->pntsv) {
+ if (sel==nu->pntsv) {
newu--;
}
- else if(sel>=1) {
+ else if (sel>=1) {
/* don't delete */
break;
}
}
- if(newu!=nu->pntsu && a==nu->pntsu) {
+ if (newu!=nu->pntsu && a==nu->pntsu) {
/* delete */
bp= nu->bp;
bpn = newbp =
(BPoint*) MEM_mallocN(newu * nu->pntsv * sizeof(BPoint), "deleteNurb");
- for(b=0; b<nu->pntsv; b++) {
- for(a=0; a<nu->pntsu; a++, bp++) {
- if((bp->f1 & flag)==0) {
+ for (b=0; b<nu->pntsv; b++) {
+ for (a=0; a<nu->pntsu; a++, bp++) {
+ if ((bp->f1 & flag)==0) {
*bpn= *bp;
keyIndex_updateBP(cu->editnurb, bp, bpn, 1);
bpn++;
- } else {
+ }
+ else {
keyIndex_delBP(cu->editnurb, bp);
}
}
}
MEM_freeN(nu->bp);
nu->bp= newbp;
- if(newu==1 && nu->pntsv>1) { /* make a U spline */
+ if (newu==1 && nu->pntsv>1) { /* make a U spline */
nu->pntsu= nu->pntsv;
nu->pntsv= 1;
SWAP(short, nu->orderu, nu->orderv);
clamp_nurb_order_u(nu);
- if(nu->knotsv) MEM_freeN(nu->knotsv);
+ if (nu->knotsv) MEM_freeN(nu->knotsv);
nu->knotsv= NULL;
}
else {
@@ -1683,7 +1702,7 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
nu= next;
}
- if(ED_curve_updateAnimPaths(obedit))
+ if (ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
return OPERATOR_FINISHED;
@@ -1697,18 +1716,18 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
int ok= 0, a, u, v, len;
nu= editnurb->nurbs.first;
- while(nu) {
+ while (nu) {
- if(nu->pntsv==1) {
+ if (nu->pntsv==1) {
bp= nu->bp;
a= nu->pntsu;
- while(a) {
- if(bp->f1 & flag);
+ while (a) {
+ if (bp->f1 & flag);
else break;
bp++;
a--;
}
- if(a==0) {
+ if (a==0) {
ok= 1;
newbp =
(BPoint*)MEM_mallocN(2 * nu->pntsu * sizeof(BPoint), "extrudeNurb1");
@@ -1718,7 +1737,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
MEM_freeN(nu->bp);
nu->bp= newbp;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
select_bpoint(bp, SELECT, flag, HIDDEN);
select_bpoint(newbp, DESELECT, flag, HIDDEN);
bp++;
@@ -1733,22 +1752,22 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
else {
/* which row or column is selected */
- if( isNurbselUV(nu, &u, &v, flag) ) {
+ if ( isNurbselUV(nu, &u, &v, flag) ) {
/* deselect all */
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
+ while (a--) {
select_bpoint(bp, DESELECT, flag, HIDDEN);
bp++;
}
- if(u==0 || u== nu->pntsv-1) { /* row in u-direction selected */
+ if (u==0 || u== nu->pntsv-1) { /* row in u-direction selected */
ok= 1;
newbp =
(BPoint*) MEM_mallocN(nu->pntsu*(nu->pntsv + 1)
* sizeof(BPoint), "extrudeNurb1");
- if(u==0) {
+ if (u==0) {
len= nu->pntsv*nu->pntsu;
ED_curve_bpcpy(editnurb, newbp+nu->pntsu, nu->bp, len);
ED_curve_bpcpy(editnurb, newbp, nu->bp, nu->pntsu);
@@ -1762,7 +1781,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
}
a= nu->pntsu;
- while(a--) {
+ while (a--) {
select_bpoint(bp, SELECT, flag, HIDDEN);
bp++;
}
@@ -1772,14 +1791,14 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
nu->pntsv++;
nurbs_knot_calc_v(nu);
}
- else if(v==0 || v== nu->pntsu-1) { /* column in v-direction selected */
+ else if (v==0 || v== nu->pntsu-1) { /* column in v-direction selected */
ok= 1;
bpn = newbp =
(BPoint*) MEM_mallocN((nu->pntsu + 1) * nu->pntsv * sizeof(BPoint), "extrudeNurb1");
bp= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- if(v==0) {
+ for (a=0; a<nu->pntsv; a++) {
+ if (v==0) {
*bpn= *bp;
bpn->f1 |= flag;
bpn++;
@@ -1787,7 +1806,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
ED_curve_bpcpy(editnurb, bpn, bp, nu->pntsu);
bp+= nu->pntsu;
bpn+= nu->pntsu;
- if(v== nu->pntsu-1) {
+ if (v== nu->pntsu-1) {
*bpn= *(bp-1);
bpn->f1 |= flag;
bpn++;
@@ -1820,20 +1839,20 @@ static void adduplicateflagNurb(Object *obedit, short flag)
cu->lastsel= NULL;
nu= editnurb->last;
- while(nu) {
- if(nu->type == CU_BEZIER) {
+ while (nu) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
- for(a=0; a<nu->pntsu; a++) {
+ for (a=0; a<nu->pntsu; a++) {
enda= -1;
starta= a;
- while( (bezt->f1 & flag) || (bezt->f2 & flag) || (bezt->f3 & flag) ) {
+ while ( (bezt->f1 & flag) || (bezt->f2 & flag) || (bezt->f3 & flag) ) {
select_beztriple(bezt, DESELECT, flag, HIDDEN);
enda=a;
- if(a>=nu->pntsu-1) break;
+ if (a>=nu->pntsu-1) break;
a++;
bezt++;
}
- if(enda>=starta) {
+ if (enda>=starta) {
newnu = (Nurb*)MEM_mallocN(sizeof(Nurb), "adduplicateN");
memcpy(newnu, nu, sizeof(Nurb));
BLI_addtail(editnurb, newnu);
@@ -1845,13 +1864,13 @@ static void adduplicateflagNurb(Object *obedit, short flag)
b= newnu->pntsu;
bezt1= newnu->bezt;
- while(b--) {
+ while (b--) {
select_beztriple(bezt1, SELECT, flag, HIDDEN);
bezt1++;
}
- if(nu->flagu & CU_NURB_CYCLIC) {
- if(starta!=0 || enda!=nu->pntsu-1) {
+ if (nu->flagu & CU_NURB_CYCLIC) {
+ if (starta!=0 || enda!=nu->pntsu-1) {
newnu->flagu &= ~CU_NURB_CYCLIC;
}
}
@@ -1859,19 +1878,19 @@ static void adduplicateflagNurb(Object *obedit, short flag)
bezt++;
}
}
- else if(nu->pntsv==1) { /* because UV Nurb has a different method for dupli */
+ else if (nu->pntsv==1) { /* because UV Nurb has a different method for dupli */
bp= nu->bp;
- for(a=0; a<nu->pntsu; a++) {
+ for (a=0; a<nu->pntsu; a++) {
enda= -1;
starta= a;
- while(bp->f1 & flag) {
+ while (bp->f1 & flag) {
select_bpoint(bp, DESELECT, flag, HIDDEN);
enda= a;
- if(a>=nu->pntsu-1) break;
+ if (a>=nu->pntsu-1) break;
a++;
bp++;
}
- if(enda>=starta) {
+ if (enda>=starta) {
newnu = (Nurb*)MEM_mallocN(sizeof(Nurb), "adduplicateN3");
memcpy(newnu, nu, sizeof(Nurb));
set_actNurb(obedit, newnu);
@@ -1882,13 +1901,13 @@ static void adduplicateflagNurb(Object *obedit, short flag)
b= newnu->pntsu;
bp1= newnu->bp;
- while(b--) {
+ while (b--) {
select_bpoint(bp1, SELECT, flag, HIDDEN);
bp1++;
}
- if(nu->flagu & CU_NURB_CYCLIC) {
- if(starta!=0 || enda!=nu->pntsu-1) {
+ if (nu->flagu & CU_NURB_CYCLIC) {
+ if (starta!=0 || enda!=nu->pntsu-1) {
newnu->flagu &= ~CU_NURB_CYCLIC;
}
}
@@ -1902,19 +1921,19 @@ static void adduplicateflagNurb(Object *obedit, short flag)
}
else {
/* a rectangular area in nurb has to be selected */
- if(isNurbsel(nu)) {
+ if (isNurbsel(nu)) {
usel= MEM_callocN(nu->pntsu, "adduplicateN4");
bp= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++, bp++) {
- if(bp->f1 & flag) usel[b]++;
+ for (a=0; a<nu->pntsv; a++) {
+ for (b=0; b<nu->pntsu; b++, bp++) {
+ if (bp->f1 & flag) usel[b]++;
}
}
newu= 0;
newv= 0;
- for(a=0; a<nu->pntsu; a++) {
- if(usel[a]) {
- if(newv==0 || usel[a]==newv) {
+ for (a=0; a<nu->pntsu; a++) {
+ if (usel[a]) {
+ if (newv==0 || usel[a]==newv) {
newv= usel[a];
newu++;
}
@@ -1924,13 +1943,13 @@ static void adduplicateflagNurb(Object *obedit, short flag)
}
}
}
- if(newu==0 || newv==0) {
+ if (newu==0 || newv==0) {
if (G.f & G_DEBUG)
printf("Can't duplicate Nurb\n");
}
else {
- if(newu==1) SWAP(short, newu, newv);
+ if (newu==1) SWAP(short, newu, newv);
newnu = (Nurb*)MEM_mallocN(sizeof(Nurb), "adduplicateN5");
memcpy(newnu, nu, sizeof(Nurb));
@@ -1947,9 +1966,9 @@ static void adduplicateflagNurb(Object *obedit, short flag)
bp= newnu->bp;
bp1= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++, bp1++) {
- if(bp1->f1 & flag) {
+ for (a=0; a<nu->pntsv; a++) {
+ for (b=0; b<nu->pntsu; b++, bp1++) {
+ if (bp1->f1 & flag) {
memcpy(bp, bp1, sizeof(BPoint));
select_bpoint(bp1, DESELECT, flag, HIDDEN);
bp++;
@@ -1957,16 +1976,18 @@ static void adduplicateflagNurb(Object *obedit, short flag)
}
}
if (check_valid_nurb_u(newnu)) {
- if(nu->pntsu==newnu->pntsu && nu->knotsu) {
+ if (nu->pntsu==newnu->pntsu && nu->knotsu) {
newnu->knotsu= MEM_dupallocN( nu->knotsu );
- } else {
+ }
+ else {
nurbs_knot_calc_u(newnu);
}
}
if (check_valid_nurb_v(newnu)) {
- if(nu->pntsv==newnu->pntsv && nu->knotsv) {
+ if (nu->pntsv==newnu->pntsv && nu->knotsv) {
newnu->knotsv= MEM_dupallocN( nu->knotsv );
- } else {
+ }
+ else {
nurbs_knot_calc_v(newnu);
}
}
@@ -1990,13 +2011,13 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
EditNurb *editnurb= cu->editnurb;
Nurb *nu;
- for(nu= editnurb->nurbs.first; nu; nu= nu->next)
- if(isNurbsel(nu)) {
+ for (nu= editnurb->nurbs.first; nu; nu= nu->next)
+ if (isNurbsel(nu)) {
switchdirectionNurb(nu);
keyData_switchDirectionNurb(cu, nu);
}
- if(ED_curve_updateAnimPaths(obedit))
+ if (ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
DAG_id_tag_update(obedit->data, 0);
@@ -2008,16 +2029,16 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_switch_direction(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Switch Direction";
- ot->description= "Switch direction of selected splines";
- ot->idname= "CURVE_OT_switch_direction";
+ ot->name = "Switch Direction";
+ ot->description = "Switch direction of selected splines";
+ ot->idname = "CURVE_OT_switch_direction";
/* api callbacks */
- ot->exec= switch_direction_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = switch_direction_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/****************** set weight operator *******************/
@@ -2032,16 +2053,16 @@ static int set_goal_weight_exec(bContext *C, wmOperator *op)
float weight= RNA_float_get(op->ptr, "weight");
int a;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->bezt) {
- for(bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
- if(bezt->f2 & SELECT)
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->bezt) {
+ for (bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
+ if (bezt->f2 & SELECT)
bezt->weight= weight;
}
}
- else if(nu->bp) {
- for(bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
- if(bp->f1 & SELECT)
+ else if (nu->bp) {
+ for (bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
+ if (bp->f1 & SELECT)
bp->weight= weight;
}
}
@@ -2056,17 +2077,17 @@ static int set_goal_weight_exec(bContext *C, wmOperator *op)
void CURVE_OT_spline_weight_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Goal Weight";
- ot->description= "Set softbody goal weight for selected points";
- ot->idname= "CURVE_OT_spline_weight_set";
+ ot->name = "Set Goal Weight";
+ ot->description = "Set softbody goal weight for selected points";
+ ot->idname = "CURVE_OT_spline_weight_set";
/* api callbacks */
- ot->exec= set_goal_weight_exec;
- ot->invoke= WM_operator_props_popup;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = set_goal_weight_exec;
+ ot->invoke = WM_operator_props_popup;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_float_factor(ot->srna, "weight", 1.0f, 0.0f, 1.0f, "Weight", "", 0.0f, 1.0f);
@@ -2084,16 +2105,16 @@ static int set_radius_exec(bContext *C, wmOperator *op)
float radius= RNA_float_get(op->ptr, "radius");
int a;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->bezt) {
- for(bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
- if(bezt->f2 & SELECT)
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->bezt) {
+ for (bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
+ if (bezt->f2 & SELECT)
bezt->radius= radius;
}
}
- else if(nu->bp) {
- for(bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
- if(bp->f1 & SELECT)
+ else if (nu->bp) {
+ for (bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
+ if (bp->f1 & SELECT)
bp->radius= radius;
}
}
@@ -2108,17 +2129,17 @@ static int set_radius_exec(bContext *C, wmOperator *op)
void CURVE_OT_radius_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Curve Radius";
- ot->description= "Set per-point radius which is used for bevel tapering";
- ot->idname= "CURVE_OT_radius_set";
+ ot->name = "Set Curve Radius";
+ ot->description = "Set per-point radius which is used for bevel tapering";
+ ot->idname = "CURVE_OT_radius_set";
/* api callbacks */
- ot->exec= set_radius_exec;
- ot->invoke= WM_operator_props_popup;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = set_radius_exec;
+ ot->invoke = WM_operator_props_popup;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_float(ot->srna, "radius", 1.0f, 0.0f, FLT_MAX, "Radius", "", 0.0001f, 10.0f);
@@ -2136,13 +2157,13 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
float val, newval, offset;
int a, i, change = 0;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->bezt) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->bezt) {
change = 0;
beztOrig = MEM_dupallocN( nu->bezt );
- for(bezt=nu->bezt+1, a=1; a<nu->pntsu-1; a++, bezt++) {
- if(bezt->f2 & SELECT) {
- for(i=0; i<3; i++) {
+ for (bezt=nu->bezt+1, a=1; a<nu->pntsu-1; a++, bezt++) {
+ if (bezt->f2 & SELECT) {
+ for (i=0; i<3; i++) {
val = bezt->vec[1][i];
newval = ((beztOrig+(a-1))->vec[1][i] * 0.5f) + ((beztOrig+(a+1))->vec[1][i] * 0.5f);
offset = (val*((1.0f/6.0f)*5.0f)) + (newval*(1.0f/6.0f)) - val;
@@ -2157,12 +2178,13 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
MEM_freeN(beztOrig);
if (change)
calchandlesNurb(nu);
- } else if (nu->bp) {
+ }
+ else if (nu->bp) {
bpOrig = MEM_dupallocN( nu->bp );
/* Same as above, keep these the same! */
- for(bp=nu->bp+1, a=1; a<nu->pntsu-1; a++, bp++) {
- if(bp->f1 & SELECT) {
- for(i=0; i<3; i++) {
+ for (bp=nu->bp+1, a=1; a<nu->pntsu-1; a++, bp++) {
+ if (bp->f1 & SELECT) {
+ for (i=0; i<3; i++) {
val = bp->vec[i];
newval = ((bpOrig+(a-1))->vec[i] * 0.5f) + ((bpOrig+(a+1))->vec[i] * 0.5f);
offset = (val*((1.0f/6.0f)*5.0f)) + (newval*(1.0f/6.0f)) - val;
@@ -2184,16 +2206,16 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_smooth(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Smooth";
- ot->description= "Flatten angles of selected points";
- ot->idname= "CURVE_OT_smooth";
+ ot->name = "Smooth";
+ ot->description = "Flatten angles of selected points";
+ ot->idname = "CURVE_OT_smooth";
/* api callbacks */
- ot->exec= smooth_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = smooth_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/**************** smooth curve radius operator *************/
@@ -2213,24 +2235,24 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
int start_sel, end_sel; /* selection indices, inclusive */
float start_rad, end_rad, fac, range;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->bezt) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->bezt) {
for (last_sel=0; last_sel < nu->pntsu; last_sel++) {
/* loop over selection segments of a curve, smooth each */
/* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */
start_sel = -1;
- for(bezt=nu->bezt+last_sel, a=last_sel; a<nu->pntsu; a++, bezt++) {
- if(bezt->f2 & SELECT) {
+ for (bezt=nu->bezt+last_sel, a=last_sel; a<nu->pntsu; a++, bezt++) {
+ if (bezt->f2 & SELECT) {
start_sel = a;
break;
}
}
/* in case there are no other selected verts */
end_sel = start_sel;
- for(bezt=nu->bezt+(start_sel+1), a=start_sel+1; a<nu->pntsu; a++, bezt++) {
- if((bezt->f2 & SELECT)==0) {
+ for (bezt=nu->bezt+(start_sel+1), a=start_sel+1; a<nu->pntsu; a++, bezt++) {
+ if ((bezt->f2 & SELECT)==0) {
break;
}
end_sel = a;
@@ -2238,7 +2260,8 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
if (start_sel == -1) {
last_sel = nu->pntsu; /* next... */
- } else {
+ }
+ else {
last_sel = end_sel; /* before we modify it */
/* now blend between start and end sel */
@@ -2252,47 +2275,51 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
if (start_rad >= 0.0f && end_rad >= 0.0f) (nu->bezt+start_sel)->radius = (start_rad + end_rad)/2;
else if (start_rad >= 0.0f) (nu->bezt+start_sel)->radius = start_rad;
else if (end_rad >= 0.0f) (nu->bezt+start_sel)->radius = end_rad;
- } else {
+ }
+ else {
/* if endpoints selected, then use them */
if (start_sel==0) {
start_rad = (nu->bezt+start_sel)->radius;
- start_sel++; /* we dont want to edit the selected endpoint */
- } else {
+ start_sel++; /* we don't want to edit the selected endpoint */
+ }
+ else {
start_rad = (nu->bezt+start_sel-1)->radius;
}
if (end_sel==nu->pntsu-1) {
end_rad = (nu->bezt+end_sel)->radius;
- end_sel--; /* we dont want to edit the selected endpoint */
- } else {
+ end_sel--; /* we don't want to edit the selected endpoint */
+ }
+ else {
end_rad = (nu->bezt+end_sel+1)->radius;
}
/* Now Blend between the points */
range = (float)(end_sel - start_sel) + 2.0f;
- for(bezt=nu->bezt+start_sel, a=start_sel; a<=end_sel; a++, bezt++) {
+ for (bezt=nu->bezt+start_sel, a=start_sel; a<=end_sel; a++, bezt++) {
fac = (float)(1+a-start_sel) / range;
bezt->radius = start_rad*(1.0f-fac) + end_rad*fac;
}
}
}
}
- } else if (nu->bp) {
+ }
+ else if (nu->bp) {
/* Same as above, keep these the same! */
for (last_sel=0; last_sel < nu->pntsu; last_sel++) {
/* loop over selection segments of a curve, smooth each */
/* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */
start_sel = -1;
- for(bp=nu->bp+last_sel, a=last_sel; a<nu->pntsu; a++, bp++) {
- if(bp->f1 & SELECT) {
+ for (bp=nu->bp+last_sel, a=last_sel; a<nu->pntsu; a++, bp++) {
+ if (bp->f1 & SELECT) {
start_sel = a;
break;
}
}
/* in case there are no other selected verts */
end_sel = start_sel;
- for(bp=nu->bp+(start_sel+1), a=start_sel+1; a<nu->pntsu; a++, bp++) {
- if((bp->f1 & SELECT)==0) {
+ for (bp=nu->bp+(start_sel+1), a=start_sel+1; a<nu->pntsu; a++, bp++) {
+ if ((bp->f1 & SELECT)==0) {
break;
}
end_sel = a;
@@ -2300,7 +2327,8 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
if (start_sel == -1) {
last_sel = nu->pntsu; /* next... */
- } else {
+ }
+ else {
last_sel = end_sel; /* before we modify it */
/* now blend between start and end sel */
@@ -2314,24 +2342,27 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
if (start_rad >= 0.0f && end_rad >= 0.0f) (nu->bp+start_sel)->radius = (start_rad + end_rad)/2;
else if (start_rad >= 0.0f) (nu->bp+start_sel)->radius = start_rad;
else if (end_rad >= 0.0f) (nu->bp+start_sel)->radius = end_rad;
- } else {
+ }
+ else {
/* if endpoints selected, then use them */
if (start_sel==0) {
start_rad = (nu->bp+start_sel)->radius;
- start_sel++; /* we dont want to edit the selected endpoint */
- } else {
+ start_sel++; /* we don't want to edit the selected endpoint */
+ }
+ else {
start_rad = (nu->bp+start_sel-1)->radius;
}
if (end_sel==nu->pntsu-1) {
end_rad = (nu->bp+end_sel)->radius;
- end_sel--; /* we dont want to edit the selected endpoint */
- } else {
+ end_sel--; /* we don't want to edit the selected endpoint */
+ }
+ else {
end_rad = (nu->bp+end_sel+1)->radius;
}
/* Now Blend between the points */
range = (float)(end_sel - start_sel) + 2.0f;
- for(bp=nu->bp+start_sel, a=start_sel; a<=end_sel; a++, bp++) {
+ for (bp=nu->bp+start_sel, a=start_sel; a<=end_sel; a++, bp++) {
fac = (float)(1+a-start_sel) / range;
bp->radius = start_rad*(1.0f-fac) + end_rad*fac;
}
@@ -2350,16 +2381,16 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_smooth_radius(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Smooth Curve Radius";
- ot->description= "Flatten radiuses of selected points";
- ot->idname= "CURVE_OT_smooth_radius";
+ ot->name = "Smooth Curve Radius";
+ ot->description = "Flatten radiuses of selected points";
+ ot->idname = "CURVE_OT_smooth_radius";
/* api clastbacks */
- ot->exec= smooth_radius_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = smooth_radius_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/***************** selection utility *************************/
@@ -2376,21 +2407,21 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short
int a;
short lastsel= 0;
- if(next==0) return;
+ if (next==0) return;
- for(nu= editnurb->first; nu; nu= nu->next) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
lastsel=0;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt= nu->bezt;
- if(next < 0) bezt= (nu->bezt + (a-1));
- while(a--) {
- if(a-abs(next) < 0) break;
- if((lastsel==0) && (bezt->hide==0) && ((bezt->f2 & SELECT) || (selstatus==0))) {
+ if (next < 0) bezt= (nu->bezt + (a-1));
+ while (a--) {
+ if (a-abs(next) < 0) break;
+ if ((lastsel==0) && (bezt->hide==0) && ((bezt->f2 & SELECT) || (selstatus==0))) {
bezt+=next;
- if(!(bezt->f2 & SELECT) || (selstatus==0)) {
+ if (!(bezt->f2 & SELECT) || (selstatus==0)) {
short sel= select_beztriple(bezt, selstatus, 1, VISIBLE);
- if((sel==1) && (cont==0)) lastsel= 1;
+ if ((sel==1) && (cont==0)) lastsel= 1;
}
}
else {
@@ -2404,14 +2435,14 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short
else {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- if(next < 0) bp= (nu->bp + (a-1));
- while(a--) {
- if(a-abs(next) < 0) break;
- if((lastsel==0) && (bp->hide==0) && ((bp->f1 & SELECT) || (selstatus==0))) {
+ if (next < 0) bp= (nu->bp + (a-1));
+ while (a--) {
+ if (a-abs(next) < 0) break;
+ if ((lastsel==0) && (bp->hide==0) && ((bp->f1 & SELECT) || (selstatus==0))) {
bp+=next;
- if(!(bp->f1 & SELECT) || (selstatus==0)) {
+ if (!(bp->f1 & SELECT) || (selstatus==0)) {
short sel= select_bpoint(bp, selstatus, 1, VISIBLE);
- if((sel==1) && (cont==0)) lastsel= 1;
+ if ((sel==1) && (cont==0)) lastsel= 1;
}
}
else {
@@ -2440,49 +2471,49 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu
Curve *cu;
int a;
- if(obedit==NULL) return;
+ if (obedit==NULL) return;
cu= (Curve*)obedit->data;
cu->lastsel= NULL;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
a= nu->pntsu;
/* which point? */
- if(selfirst==0) { /* select last */
+ if (selfirst==0) { /* select last */
bezt= (nu->bezt + (a-1));
}
else { /* select first */
bezt= nu->bezt;
}
- while(a--) {
+ while (a--) {
short sel;
- if(doswap) sel= swap_selection_beztriple(bezt);
+ if (doswap) sel= swap_selection_beztriple(bezt);
else sel= select_beztriple(bezt, selstatus, 1, VISIBLE);
- if(sel==1) break;
+ if (sel==1) break;
}
}
else {
a= nu->pntsu*nu->pntsv;
/* which point? */
- if(selfirst==0) { /* select last */
+ if (selfirst==0) { /* select last */
bp= (nu->bp + (a-1));
}
- else{ /* select first */
+ else { /* select first */
bp= nu->bp;
}
- while(a--) {
+ while (a--) {
if (bp->hide == 0) {
short sel;
- if(doswap) sel= swap_selection_bpoint(bp);
+ if (doswap) sel= swap_selection_bpoint(bp);
else sel= select_bpoint(bp, selstatus, 1, VISIBLE);
- if(sel==1) break;
+ if (sel==1) break;
}
}
}
@@ -2502,15 +2533,15 @@ static int de_select_first_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_de_select_first(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect First";
- ot->idname= "CURVE_OT_de_select_first";
+ ot->name = "(De)select First";
+ ot->idname = "CURVE_OT_de_select_first";
/* api cfirstbacks */
- ot->exec= de_select_first_exec;
- ot->poll= ED_operator_editcurve;
+ ot->exec = de_select_first_exec;
+ ot->poll = ED_operator_editcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int de_select_last_exec(bContext *C, wmOperator *UNUSED(op))
@@ -2526,15 +2557,15 @@ static int de_select_last_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_de_select_last(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect Last";
- ot->idname= "CURVE_OT_de_select_last";
+ ot->name = "(De)select Last";
+ ot->idname = "CURVE_OT_de_select_last";
/* api clastbacks */
- ot->exec= de_select_last_exec;
- ot->poll= ED_operator_editcurve;
+ ot->exec = de_select_last_exec;
+ ot->poll = ED_operator_editcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/******************* de select all operator ***************/
@@ -2546,13 +2577,13 @@ static short nurb_has_selected_cps(ListBase *editnurb)
BPoint *bp;
int a;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
- if(bezt->hide==0) {
- if((bezt->f1 & SELECT)
+ while (a--) {
+ if (bezt->hide==0) {
+ if ((bezt->f1 & SELECT)
|| (bezt->f2 & SELECT)
|| (bezt->f3 & SELECT)) return 1;
}
@@ -2562,8 +2593,8 @@ static short nurb_has_selected_cps(ListBase *editnurb)
else {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
- if((bp->hide==0) && (bp->f1 & SELECT)) return 1;
+ while (a--) {
+ if ((bp->hide==0) && (bp->f1 & SELECT)) return 1;
bp++;
}
}
@@ -2580,7 +2611,7 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
- if(nurb_has_selected_cps(editnurb))
+ if (nurb_has_selected_cps(editnurb))
action = SEL_DESELECT;
}
@@ -2604,15 +2635,15 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
void CURVE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect All";
- ot->idname= "CURVE_OT_select_all";
+ ot->name = "(De)select All";
+ ot->idname = "CURVE_OT_select_all";
/* api callbacks */
- ot->exec= de_select_all_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = de_select_all_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_select_all(ot);
@@ -2630,42 +2661,42 @@ static int hide_exec(bContext *C, wmOperator *op)
BezTriple *bezt;
int a, sel, invert= RNA_boolean_get(op->ptr, "unselected");
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
sel= 0;
- while(a--) {
- if(invert == 0 && BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
+ while (a--) {
+ if (invert == 0 && BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
select_beztriple(bezt, DESELECT, 1, HIDDEN);
bezt->hide= 1;
}
- else if(invert && !BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
+ else if (invert && !BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
select_beztriple(bezt, DESELECT, 1, HIDDEN);
bezt->hide= 1;
}
- if(bezt->hide) sel++;
+ if (bezt->hide) sel++;
bezt++;
}
- if(sel==nu->pntsu) nu->hide= 1;
+ if (sel==nu->pntsu) nu->hide= 1;
}
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
sel= 0;
- while(a--) {
- if(invert==0 && (bp->f1 & SELECT)) {
+ while (a--) {
+ if (invert==0 && (bp->f1 & SELECT)) {
select_bpoint(bp, DESELECT, 1, HIDDEN);
bp->hide= 1;
}
- else if(invert && (bp->f1 & SELECT)==0) {
+ else if (invert && (bp->f1 & SELECT)==0) {
select_bpoint(bp, DESELECT, 1, HIDDEN);
bp->hide= 1;
}
- if(bp->hide) sel++;
+ if (bp->hide) sel++;
bp++;
}
- if(sel==nu->pntsu*nu->pntsv) nu->hide= 1;
+ if (sel==nu->pntsu*nu->pntsv) nu->hide= 1;
}
}
@@ -2678,15 +2709,15 @@ static int hide_exec(bContext *C, wmOperator *op)
void CURVE_OT_hide(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Hide Selected";
- ot->idname= "CURVE_OT_hide";
+ ot->name = "Hide Selected";
+ ot->idname = "CURVE_OT_hide";
/* api callbacks */
- ot->exec= hide_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = hide_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
@@ -2703,13 +2734,13 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
BezTriple *bezt;
int a;
- for(nu= editnurb->first; nu; nu= nu->next) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
nu->hide= 0;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->hide) {
+ while (a--) {
+ if (bezt->hide) {
select_beztriple(bezt, SELECT, 1, HIDDEN);
bezt->hide= 0;
}
@@ -2719,8 +2750,8 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->hide) {
+ while (a--) {
+ if (bp->hide) {
select_bpoint(bp, SELECT, 1, HIDDEN);
bp->hide= 0;
}
@@ -2738,15 +2769,15 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_reveal(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reveal Hidden";
- ot->idname= "CURVE_OT_reveal";
+ ot->name = "Reveal Hidden";
+ ot->idname = "CURVE_OT_reveal";
/* api callbacks */
- ot->exec= reveal_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = reveal_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** subdivide operator *********************/
@@ -2768,16 +2799,16 @@ static void subdividenurb(Object *obedit, int number_cuts)
// printf("*** subdivideNurb: entering subdivide\n");
- for(nu= editnurb->nurbs.first; nu; nu= nu->next) {
+ for (nu= editnurb->nurbs.first; nu; nu= nu->next) {
amount= 0;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
/*
* Insert a point into a 2D Bezier curve.
* Endpoints are preserved. Otherwise, all selected and inserted points are
* newly created. Old points are discarded.
*/
/* count */
- if(nu->flagu & CU_NURB_CYCLIC) {
+ if (nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bezt= nu->bezt;
prevbezt= bezt+(a-1);
@@ -2787,18 +2818,18 @@ static void subdividenurb(Object *obedit, int number_cuts)
prevbezt= nu->bezt;
bezt= prevbezt+1;
}
- while(a--) {
- if( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) amount+=number_cuts;
+ while (a--) {
+ if ( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) amount+=number_cuts;
prevbezt= bezt;
bezt++;
}
- if(amount) {
+ if (amount) {
/* insert */
beztnew =
(BezTriple*)MEM_mallocN((amount + nu->pntsu) * sizeof(BezTriple), "subdivNurb");
beztn= beztnew;
- if(nu->flagu & CU_NURB_CYCLIC) {
+ if (nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bezt= nu->bezt;
prevbezt= bezt+(a-1);
@@ -2808,12 +2839,12 @@ static void subdividenurb(Object *obedit, int number_cuts)
prevbezt= nu->bezt;
bezt= prevbezt+1;
}
- while(a--) {
+ while (a--) {
memcpy(beztn, prevbezt, sizeof(BezTriple));
keyIndex_updateBezt(editnurb, prevbezt, beztn, 1);
beztn++;
- if( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
+ if ( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
float prevvec[3][3];
memcpy(prevvec, prevbezt->vec, sizeof(float) * 9);
@@ -2838,7 +2869,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
interp_v3_v3v3(beztn->vec[1], vec+9, vec+12, factor);
copy_v3_v3(beztn->vec[2], vec+12);
/* handle of next bezt */
- if(a==0 && i == number_cuts - 1 && (nu->flagu & CU_NURB_CYCLIC)) {copy_v3_v3(beztnew->vec[0], vec+6);}
+ if (a==0 && i == number_cuts - 1 && (nu->flagu & CU_NURB_CYCLIC)) {copy_v3_v3(beztnew->vec[0], vec+6);}
else {copy_v3_v3(bezt->vec[0], vec+6);}
beztn->radius = (prevbezt->radius + bezt->radius)/2;
@@ -2853,7 +2884,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
bezt++;
}
/* last point */
- if((nu->flagu & CU_NURB_CYCLIC)==0) {
+ if ((nu->flagu & CU_NURB_CYCLIC)==0) {
memcpy(beztn, prevbezt, sizeof(BezTriple));
keyIndex_updateBezt(editnurb, prevbezt, beztn, 1);
}
@@ -2873,7 +2904,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
* stable... nzc 30-5-'00
*/
/* count */
- if(nu->flagu & CU_NURB_CYCLIC) {
+ if (nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bp= nu->bp;
prevbp= bp+(a-1);
@@ -2883,19 +2914,19 @@ static void subdividenurb(Object *obedit, int number_cuts)
prevbp= nu->bp;
bp= prevbp+1;
}
- while(a--) {
- if( (bp->f1 & SELECT) && (prevbp->f1 & SELECT) ) amount+=number_cuts;
+ while (a--) {
+ if ( (bp->f1 & SELECT) && (prevbp->f1 & SELECT) ) amount+=number_cuts;
prevbp= bp;
bp++;
}
- if(amount) {
+ if (amount) {
/* insert */
bpnew =
(BPoint*)MEM_mallocN((amount + nu->pntsu) * sizeof(BPoint), "subdivNurb2");
bpn= bpnew;
- if(nu->flagu & CU_NURB_CYCLIC) {
+ if (nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bp= nu->bp;
prevbp= bp+(a-1);
@@ -2905,12 +2936,12 @@ static void subdividenurb(Object *obedit, int number_cuts)
prevbp= nu->bp;
bp= prevbp+1;
}
- while(a--) {
+ while (a--) {
memcpy(bpn, prevbp, sizeof(BPoint));
keyIndex_updateBP(editnurb, prevbp, bpn, 1);
bpn++;
- if( (bp->f1 & SELECT) && (prevbp->f1 & SELECT) ) {
+ if ( (bp->f1 & SELECT) && (prevbp->f1 & SELECT) ) {
// printf("*** subdivideNurb: insert 'linear' point\n");
for (i = 0; i < number_cuts; i++) {
factor = (float)(i + 1) / (number_cuts + 1);
@@ -2924,7 +2955,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
prevbp= bp;
bp++;
}
- if((nu->flagu & CU_NURB_CYCLIC)==0) { /* last point */
+ if ((nu->flagu & CU_NURB_CYCLIC)==0) { /* last point */
memcpy(bpn, prevbp, sizeof(BPoint));
keyIndex_updateBP(editnurb, prevbp, bpn, 1);
}
@@ -2933,12 +2964,12 @@ static void subdividenurb(Object *obedit, int number_cuts)
nu->bp= bpnew;
nu->pntsu+= amount;
- if(nu->type & CU_NURBS) {
+ if (nu->type & CU_NURBS) {
nurbs_knot_calc_u(nu);
}
}
- } /* End of 'else if(nu->pntsv==1)' */
- else if(nu->type == CU_NURBS) {
+ } /* End of 'else if (nu->pntsv==1)' */
+ else if (nu->type == CU_NURBS) {
/* This is a very strange test ... */
/**
* Subdivide NURB surfaces - nzc 30-5-'00 -
@@ -2988,9 +3019,9 @@ static void subdividenurb(Object *obedit, int number_cuts)
/* Count the number of selected points. */
bp= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++) {
- if(bp->f1 & SELECT) {
+ for (a=0; a<nu->pntsv; a++) {
+ for (b=0; b<nu->pntsu; b++) {
+ if (bp->f1 & SELECT) {
usel[b]++;
vsel[a]++;
sel++;
@@ -2998,7 +3029,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
bp++;
}
}
- if( sel == (nu->pntsu*nu->pntsv) ) { /* subdivide entire nurb */
+ if ( sel == (nu->pntsu*nu->pntsv) ) { /* subdivide entire nurb */
/* Global subdivision is a special case of partial
* subdivision. Strange it is considered separately... */
@@ -3011,13 +3042,13 @@ static void subdividenurb(Object *obedit, int number_cuts)
bpn=bpnew= MEM_mallocN( tot*sizeof(BPoint), "subdivideNurb4");
bp= nu->bp;
/* first subdivide rows */
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++) {
+ for (a=0; a<nu->pntsv; a++) {
+ for (b=0; b<nu->pntsu; b++) {
*bpn= *bp;
keyIndex_updateBP(editnurb, bp, bpn, 1);
bpn++;
bp++;
- if(b<nu->pntsu-1) {
+ if (b<nu->pntsu-1) {
prevbp= bp-1;
for (i = 0; i < number_cuts; i++) {
factor = (float)(i + 1) / (number_cuts + 1);
@@ -3033,9 +3064,9 @@ static void subdividenurb(Object *obedit, int number_cuts)
bpn= bpnew+((number_cuts+1)*nu->pntsu - number_cuts);
bp= bpnew+(number_cuts+1)*((number_cuts+1)*nu->pntsu-number_cuts);
prevbp= bpnew;
- for(a=1; a<nu->pntsv; a++) {
+ for (a=1; a<nu->pntsv; a++) {
- for(b=0; b<(number_cuts+1)*nu->pntsu-number_cuts; b++) {
+ for (b=0; b<(number_cuts+1)*nu->pntsu-number_cuts; b++) {
BPoint *tmp= bpn;
for (i = 0; i < number_cuts; i++) {
factor = (float)(i + 1) / (number_cuts + 1);
@@ -3061,25 +3092,25 @@ static void subdividenurb(Object *obedit, int number_cuts)
else {
/* subdivide in v direction? */
sel= 0;
- for(a=0; a<nu->pntsv-1; a++) {
- if(vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu) sel+=number_cuts;
+ for (a=0; a<nu->pntsv-1; a++) {
+ if (vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu) sel+=number_cuts;
}
- if(sel) { /* V ! */
+ if (sel) { /* V ! */
bpn=bpnew= MEM_mallocN( (sel+nu->pntsv)*nu->pntsu*sizeof(BPoint), "subdivideNurb4");
bp= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++) {
+ for (a=0; a<nu->pntsv; a++) {
+ for (b=0; b<nu->pntsu; b++) {
*bpn= *bp;
keyIndex_updateBP(editnurb, bp, bpn, 1);
bpn++;
bp++;
}
- if( (a<nu->pntsv-1) && vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu ) {
+ if ( (a<nu->pntsv-1) && vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu ) {
for (i = 0; i < number_cuts; i++) {
factor = (float)(i + 1) / (number_cuts + 1);
prevbp= bp- nu->pntsu;
- for(b=0; b<nu->pntsu; b++) {
+ for (b=0; b<nu->pntsu; b++) {
/*
* This simple bisection must be replaces by a
* subtle resampling of a number of points. Our
@@ -3106,22 +3137,22 @@ static void subdividenurb(Object *obedit, int number_cuts)
else {
/* or in u direction? */
sel= 0;
- for(a=0; a<nu->pntsu-1; a++) {
- if(usel[a]==nu->pntsv && usel[a+1]==nu->pntsv) sel+=number_cuts;
+ for (a=0; a<nu->pntsu-1; a++) {
+ if (usel[a]==nu->pntsv && usel[a+1]==nu->pntsv) sel+=number_cuts;
}
- if(sel) { /* U ! */
+ if (sel) { /* U ! */
/* Inserting U points is sort of 'default' Flat curves only get */
/* U points inserted in them. */
bpn=bpnew= MEM_mallocN( (sel+nu->pntsu)*nu->pntsv*sizeof(BPoint), "subdivideNurb4");
bp= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++) {
+ for (a=0; a<nu->pntsv; a++) {
+ for (b=0; b<nu->pntsu; b++) {
*bpn= *bp;
keyIndex_updateBP(editnurb, bp, bpn, 1);
bpn++;
bp++;
- if( (b<nu->pntsu-1) && usel[b]==nu->pntsv && usel[b+1]==nu->pntsv ) {
+ if ( (b<nu->pntsu-1) && usel[b]==nu->pntsv && usel[b+1]==nu->pntsv ) {
/*
* One thing that bugs me here is that the
* orders of things are not the same as in
@@ -3160,7 +3191,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
subdividenurb(obedit, number_cuts);
- if(ED_curve_updateAnimPaths(obedit))
+ if (ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -3171,19 +3202,23 @@ static int subdivide_exec(bContext *C, wmOperator *op)
void CURVE_OT_subdivide(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
- ot->name= "Subdivide";
- ot->description= "Subdivide selected segments";
- ot->idname= "CURVE_OT_subdivide";
+ ot->name = "Subdivide";
+ ot->description = "Subdivide selected segments";
+ ot->idname = "CURVE_OT_subdivide";
/* api callbacks */
- ot->exec= subdivide_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = subdivide_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
- RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of cuts", "", 1, 10);
+ prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of cuts", "", 1, 10);
+ /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/******************** find nearest ************************/
@@ -3197,12 +3232,15 @@ static void findnearestNurbvert__doClosest(void *userData, Nurb *nu, BPoint *bp,
if (bp) {
flag = bp->f1;
- } else {
+ }
+ else {
if (beztindex==0) {
flag = bezt->f1;
- } else if (beztindex==1) {
+ }
+ else if (beztindex==1) {
flag = bezt->f2;
- } else {
+ }
+ else {
flag = bezt->f3;
}
}
@@ -3256,19 +3294,19 @@ static void findselectedNurbvert(ListBase *editnurb, Nurb **nu, BezTriple **bezt
*nu= NULL;
*bezt= NULL;
*bp= NULL;
- for(nu1= editnurb->first; nu1; nu1= nu1->next) {
- if(nu1->type == CU_BEZIER) {
+ for (nu1= editnurb->first; nu1; nu1= nu1->next) {
+ if (nu1->type == CU_BEZIER) {
bezt1= nu1->bezt;
a= nu1->pntsu;
- while(a--) {
- if( (bezt1->f1 & SELECT) || (bezt1->f2 & SELECT) || (bezt1->f3 & SELECT) ) {
- if(*nu != NULL && *nu != nu1) {
+ while (a--) {
+ if ( (bezt1->f1 & SELECT) || (bezt1->f2 & SELECT) || (bezt1->f3 & SELECT) ) {
+ if (*nu != NULL && *nu != nu1) {
*nu= NULL;
*bp= NULL;
*bezt= NULL;
return;
}
- else if(*bezt || *bp) {
+ else if (*bezt || *bp) {
*bp= NULL;
*bezt= NULL;
}
@@ -3283,15 +3321,15 @@ static void findselectedNurbvert(ListBase *editnurb, Nurb **nu, BezTriple **bezt
else {
bp1= nu1->bp;
a= nu1->pntsu*nu1->pntsv;
- while(a--) {
- if( bp1->f1 & 1 ) {
- if(*nu != NULL && *nu != nu1) {
+ while (a--) {
+ if ( bp1->f1 & 1 ) {
+ if (*nu != NULL && *nu != nu1) {
*bp= NULL;
*bezt= NULL;
*nu= NULL;
return;
}
- else if(*bezt || *bp) {
+ else if (*bezt || *bp) {
*bp= NULL;
*bezt= NULL;
}
@@ -3314,15 +3352,15 @@ static int convertspline(short type, Nurb *nu)
BPoint *bp;
int a, c, nr;
- if(nu->type == CU_POLY) {
- if(type==CU_BEZIER) { /* to Bezier with vecthandles */
+ if (nu->type == CU_POLY) {
+ if (type==CU_BEZIER) { /* to Bezier with vecthandles */
nr= nu->pntsu;
bezt =
(BezTriple*)MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
nu->bezt= bezt;
a= nr;
bp= nu->bp;
- while(a--) {
+ while (a--) {
copy_v3_v3(bezt->vec[1], bp->vec);
bezt->f1=bezt->f2=bezt->f3= bp->f1;
bezt->h1= bezt->h2= HD_VECT;
@@ -3337,28 +3375,28 @@ static int convertspline(short type, Nurb *nu)
nu->type = CU_BEZIER;
calchandlesNurb(nu);
}
- else if(type==CU_NURBS) {
+ else if (type==CU_NURBS) {
nu->type = CU_NURBS;
nu->orderu= 4;
nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
nurbs_knot_calc_u(nu);
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
+ while (a--) {
bp->vec[3]= 1.0;
bp++;
}
}
}
- else if(nu->type == CU_BEZIER) { /* Bezier */
- if(type==CU_POLY || type==CU_NURBS) {
+ else if (nu->type == CU_BEZIER) { /* Bezier */
+ if (type==CU_POLY || type==CU_NURBS) {
nr= 3*nu->pntsu;
nu->bp = MEM_callocN(nr * sizeof(BPoint), "setsplinetype");
a= nu->pntsu;
bezt= nu->bezt;
bp= nu->bp;
- while(a--) {
- if(type==CU_POLY && bezt->h1==HD_VECT && bezt->h2==HD_VECT) {
+ while (a--) {
+ if (type==CU_POLY && bezt->h1==HD_VECT && bezt->h2==HD_VECT) {
/* vector handle becomes 1 poly vertice */
copy_v3_v3(bp->vec, bezt->vec[1]);
bp->vec[3]= 1.0;
@@ -3369,11 +3407,11 @@ static int convertspline(short type, Nurb *nu)
bp++;
}
else {
- for(c=0;c<3;c++) {
+ for (c=0;c<3;c++) {
copy_v3_v3(bp->vec, bezt->vec[c]);
bp->vec[3]= 1.0;
- if(c==0) bp->f1= bezt->f1;
- else if(c==1) bp->f1= bezt->f2;
+ if (c==0) bp->f1= bezt->f1;
+ else if (c==1) bp->f1= bezt->f2;
else bp->f1= bezt->f3;
bp->radius= bezt->radius;
bp->weight= bezt->weight;
@@ -3391,36 +3429,36 @@ static int convertspline(short type, Nurb *nu)
nu->type = type;
#if 0 /* UNUSED */
- if(nu->flagu & CU_NURB_CYCLIC) c= nu->orderu-1;
+ if (nu->flagu & CU_NURB_CYCLIC) c= nu->orderu-1;
else c= 0;
#endif
- if(type== CU_NURBS) {
+ if (type== CU_NURBS) {
nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
nu->flagu |= CU_NURB_BEZIER;
nurbs_knot_calc_u(nu);
}
}
}
- else if(nu->type == CU_NURBS) {
- if(type==CU_POLY) {
+ else if (nu->type == CU_NURBS) {
+ if (type==CU_POLY) {
nu->type = CU_POLY;
- if(nu->knotsu) MEM_freeN(nu->knotsu); /* python created nurbs have a knotsu of zero */
+ if (nu->knotsu) MEM_freeN(nu->knotsu); /* python created nurbs have a knotsu of zero */
nu->knotsu= NULL;
- if(nu->knotsv) MEM_freeN(nu->knotsv);
+ if (nu->knotsv) MEM_freeN(nu->knotsv);
nu->knotsv= NULL;
}
- else if(type==CU_BEZIER) { /* to Bezier */
+ else if (type==CU_BEZIER) { /* to Bezier */
nr= nu->pntsu/3;
- if(nr<2)
+ if (nr<2)
return 1; /* conversion impossible */
else {
bezt = MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
nu->bezt= bezt;
a= nr;
bp= nu->bp;
- while(a--) {
+ while (a--) {
copy_v3_v3(bezt->vec[0], bp->vec);
bezt->f1= bp->f1;
bp++;
@@ -3459,22 +3497,22 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
Nurb *nu;
int changed=0, type= RNA_enum_get(op->ptr, "type");
- if(type==CU_CARDINAL || type==CU_BSPLINE) {
+ if (type==CU_CARDINAL || type==CU_BSPLINE) {
BKE_report(op->reports, RPT_ERROR, "Not implemented yet");
return OPERATOR_CANCELLED;
}
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(isNurbsel(nu)) {
- if(convertspline(type, nu))
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (isNurbsel(nu)) {
+ if (convertspline(type, nu))
BKE_report(op->reports, RPT_ERROR, "No conversion possible");
else
changed= 1;
}
}
- if(changed) {
- if(ED_curve_updateAnimPaths(obedit))
+ if (changed) {
+ if (ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
DAG_id_tag_update(obedit->data, 0);
@@ -3498,20 +3536,20 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Set Spline Type";
+ ot->name = "Set Spline Type";
ot->description = "Set type of active spline";
- ot->idname= "CURVE_OT_spline_type_set";
+ ot->idname = "CURVE_OT_spline_type_set";
/* api callbacks */
- ot->exec= set_spline_type_exec;
- ot->invoke= WM_menu_invoke;
- ot->poll= ED_operator_editcurve;
+ ot->exec = set_spline_type_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->poll = ED_operator_editcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= RNA_def_enum(ot->srna, "type", type_items, CU_POLY, "Type", "Spline type");
+ ot->prop = RNA_def_enum(ot->srna, "type", type_items, CU_POLY, "Type", "Spline type");
}
/***************** set handle type operator *******************/
@@ -3541,20 +3579,20 @@ void CURVE_OT_handle_type_set(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Set Handle Type";
+ ot->name = "Set Handle Type";
ot->description = "Set type of handles for selected control points";
- ot->idname= "CURVE_OT_handle_type_set";
+ ot->idname = "CURVE_OT_handle_type_set";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= set_handle_type_exec;
- ot->poll= ED_operator_editcurve;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = set_handle_type_exec;
+ ot->poll = ED_operator_editcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= RNA_def_enum(ot->srna, "type", editcurve_handle_type_items, 1, "Type", "Spline type");
+ ot->prop = RNA_def_enum(ot->srna, "type", editcurve_handle_type_items, 1, "Type", "Spline type");
}
/***************** make segment operator **********************/
@@ -3566,14 +3604,14 @@ static void switchdirection_knots(float *base, int tot)
float *fp1, *fp2, *tempf;
int a;
- if(base==NULL || tot==0) return;
+ if (base==NULL || tot==0) return;
/* reverse knots */
a= tot;
fp1= base;
fp2= fp1+(a-1);
a/= 2;
- while(fp1!=fp2 && a>0) {
+ while (fp1!=fp2 && a>0) {
SWAP(float, *fp1, *fp2);
a--;
fp1++;
@@ -3583,7 +3621,7 @@ static void switchdirection_knots(float *base, int tot)
a= tot;
fp1= base;
fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect");
- while(a--) {
+ while (a--) {
fp2[0]= fabs(fp1[1]-fp1[0]);
fp1++;
fp2++;
@@ -3594,7 +3632,7 @@ static void switchdirection_knots(float *base, int tot)
fp2= tempf;
fp1[0]= 0.0;
fp1++;
- while(a--) {
+ while (a--) {
fp1[0]= fp1[-1]+fp2[0];
fp1++;
fp2++;
@@ -3617,8 +3655,8 @@ static void rotate_direction_nurb(Nurb *nu)
temp= MEM_dupallocN(nu->bp);
bp1= nu->bp;
- for(v=0; v<nu->pntsv; v++) {
- for(u=0; u<nu->pntsu; u++, bp1++) {
+ for (v=0; v<nu->pntsv; v++) {
+ for (u=0; u<nu->pntsu; u++, bp1++) {
bp2= temp + (nu->pntsu-u-1)*(nu->pntsv) + v;
*bp1= *bp2;
}
@@ -3634,8 +3672,8 @@ static int is_u_selected(Nurb *nu, int u)
/* what about resolu == 2? */
bp= nu->bp+u;
- for(v=0; v<nu->pntsv-1; v++, bp+=nu->pntsu) {
- if(v) if(bp->f1 & SELECT) return 1;
+ for (v=0; v<nu->pntsv-1; v++, bp+=nu->pntsu) {
+ if (v) if (bp->f1 & SELECT) return 1;
}
return 0;
@@ -3659,8 +3697,8 @@ static void make_selection_list_nurb(ListBase *editnurb)
float dist, headdist, taildist;
int a;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if( isNurbsel(nu) ) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if ( isNurbsel(nu) ) {
nus = (NurbSort*)MEM_callocN(sizeof(NurbSort), "sort");
BLI_addhead(&nbase, nus);
@@ -3668,7 +3706,7 @@ static void make_selection_list_nurb(ListBase *editnurb)
bp= nu->bp;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
add_v3_v3(nus->vec, bp->vec);
bp++;
}
@@ -3684,29 +3722,29 @@ static void make_selection_list_nurb(ListBase *editnurb)
BLI_addtail( &nsortbase, nus);
/* now add, either at head or tail, the closest one */
- while(nbase.first) {
+ while (nbase.first) {
headdist= taildist= 1.0e30;
headdo= taildo= NULL;
nustest= nbase.first;
- while(nustest) {
+ while (nustest) {
dist= len_v3v3(nustest->vec, ((NurbSort *)nsortbase.first)->vec);
- if(dist<headdist) {
+ if (dist<headdist) {
headdist= dist;
headdo= nustest;
}
dist= len_v3v3(nustest->vec, ((NurbSort *)nsortbase.last)->vec);
- if(dist<taildist) {
+ if (dist<taildist) {
taildist= dist;
taildo= nustest;
}
nustest= nustest->next;
}
- if(headdist<taildist) {
+ if (headdist<taildist) {
BLI_remlink(&nbase, headdo);
BLI_addhead(&nsortbase, headdo);
}
@@ -3728,23 +3766,23 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
/* first nurbs: u = resolu-1 selected */
- if( is_u_selected(nu1, nu1->pntsu-1) );
+ if ( is_u_selected(nu1, nu1->pntsu-1) );
else {
/* For 2D curves blender uses orderv=0. It doesn't make any sense mathematically. */
/* but after rotating orderu=0 will be confusing. */
if (nu1->orderv == 0) nu1->orderv= 1;
rotate_direction_nurb(nu1);
- if( is_u_selected(nu1, nu1->pntsu-1) );
+ if ( is_u_selected(nu1, nu1->pntsu-1) );
else {
rotate_direction_nurb(nu1);
- if( is_u_selected(nu1, nu1->pntsu-1) );
+ if ( is_u_selected(nu1, nu1->pntsu-1) );
else {
rotate_direction_nurb(nu1);
- if( is_u_selected(nu1, nu1->pntsu-1) );
+ if ( is_u_selected(nu1, nu1->pntsu-1) );
else {
/* rotate again, now its OK! */
- if(nu1->pntsv!=1) rotate_direction_nurb(nu1);
+ if (nu1->pntsv!=1) rotate_direction_nurb(nu1);
return;
}
}
@@ -3752,28 +3790,28 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
}
/* 2nd nurbs: u = 0 selected */
- if( is_u_selected(nu2, 0) );
+ if ( is_u_selected(nu2, 0) );
else {
if (nu2->orderv == 0) nu2->orderv= 1;
rotate_direction_nurb(nu2);
- if( is_u_selected(nu2, 0) );
+ if ( is_u_selected(nu2, 0) );
else {
rotate_direction_nurb(nu2);
- if( is_u_selected(nu2, 0) );
+ if ( is_u_selected(nu2, 0) );
else {
rotate_direction_nurb(nu2);
- if( is_u_selected(nu2, 0) );
+ if ( is_u_selected(nu2, 0) );
else {
/* rotate again, now its OK! */
- if(nu1->pntsu==1) rotate_direction_nurb(nu1);
- if(nu2->pntsv!=1) rotate_direction_nurb(nu2);
+ if (nu1->pntsu==1) rotate_direction_nurb(nu1);
+ if (nu2->pntsv!=1) rotate_direction_nurb(nu2);
return;
}
}
}
}
- if( nu1->pntsv != nu2->pntsv ) {
+ if ( nu1->pntsv != nu2->pntsv ) {
BKE_report(op->reports, RPT_ERROR, "Resolution doesn't match");
return;
}
@@ -3785,7 +3823,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
bp2= nu2->bp;
len1= 0.0;
- for(v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2+=nu2->pntsu) {
+ for (v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2+=nu2->pntsu) {
len1+= len_v3v3(bp1->vec, bp2->vec);
}
@@ -3793,29 +3831,29 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
bp2= nu2->bp + nu2->pntsu*(nu2->pntsv-1);
len2= 0.0;
- for(v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2-=nu2->pntsu) {
+ for (v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2-=nu2->pntsu) {
len2+= len_v3v3(bp1->vec, bp2->vec);
}
/* merge */
origu= nu1->pntsu;
nu1->pntsu+= nu2->pntsu;
- if(nu1->orderu<3 && nu1->orderu<nu1->pntsu) nu1->orderu++;
- if(nu1->orderv<3 && nu1->orderv<nu1->pntsv) nu1->orderv++;
+ if (nu1->orderu<3 && nu1->orderu<nu1->pntsu) nu1->orderu++;
+ if (nu1->orderv<3 && nu1->orderv<nu1->pntsv) nu1->orderv++;
temp= nu1->bp;
nu1->bp= MEM_mallocN(nu1->pntsu*nu1->pntsv*sizeof(BPoint), "mergeBP");
bp= nu1->bp;
bp1= temp;
- for(v=0; v<nu1->pntsv; v++) {
+ for (v=0; v<nu1->pntsv; v++) {
/* switch direction? */
- if(len1<len2) bp2= nu2->bp + v*nu2->pntsu;
+ if (len1<len2) bp2= nu2->bp + v*nu2->pntsu;
else bp2= nu2->bp + (nu1->pntsv-v-1)*nu2->pntsu;
- for(u=0; u<nu1->pntsu; u++, bp++) {
- if(u<origu) {
+ for (u=0; u<nu1->pntsu; u++, bp++) {
+ if (u<origu) {
*bp= *bp1; bp1++;
select_bpoint(bp, SELECT, 1, HIDDEN);
}
@@ -3825,7 +3863,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
}
}
- if(nu1->type == CU_NURBS) {
+ if (nu1->type == CU_NURBS) {
/* merge knots */
nurbs_knot_calc_u(nu1);
@@ -3847,7 +3885,7 @@ static int merge_nurb(bContext *C, wmOperator *op)
make_selection_list_nurb(editnurb);
- if(nsortbase.first == nsortbase.last) {
+ if (nsortbase.first == nsortbase.last) {
BLI_freelistN(&nsortbase);
BKE_report(op->reports, RPT_ERROR, "Too few selections to merge");
return OPERATOR_CANCELLED;
@@ -3857,27 +3895,27 @@ static int merge_nurb(bContext *C, wmOperator *op)
nus2= nus1->next;
/* resolution match, to avoid uv rotations */
- if(nus1->nu->pntsv==1) {
- if(nus1->nu->pntsu==nus2->nu->pntsu || nus1->nu->pntsu==nus2->nu->pntsv);
+ if (nus1->nu->pntsv==1) {
+ if (nus1->nu->pntsu==nus2->nu->pntsu || nus1->nu->pntsu==nus2->nu->pntsv);
else ok= 0;
}
- else if(nus2->nu->pntsv==1) {
- if(nus2->nu->pntsu==nus1->nu->pntsu || nus2->nu->pntsu==nus1->nu->pntsv);
+ else if (nus2->nu->pntsv==1) {
+ if (nus2->nu->pntsu==nus1->nu->pntsu || nus2->nu->pntsu==nus1->nu->pntsv);
else ok= 0;
}
- else if( nus1->nu->pntsu==nus2->nu->pntsu || nus1->nu->pntsv==nus2->nu->pntsv);
- else if( nus1->nu->pntsu==nus2->nu->pntsv || nus1->nu->pntsv==nus2->nu->pntsu);
+ else if ( nus1->nu->pntsu==nus2->nu->pntsu || nus1->nu->pntsv==nus2->nu->pntsv);
+ else if ( nus1->nu->pntsu==nus2->nu->pntsv || nus1->nu->pntsv==nus2->nu->pntsu);
else {
ok= 0;
}
- if(ok==0) {
+ if (ok==0) {
BKE_report(op->reports, RPT_ERROR, "Resolution doesn't match");
BLI_freelistN(&nsortbase);
return OPERATOR_CANCELLED;
}
- while(nus2) {
+ while (nus2) {
merge_2_nurb(op, editnurb, nus1->nu, nus2->nu);
nus2= nus2->next;
}
@@ -3904,18 +3942,18 @@ static int make_segment_exec(bContext *C, wmOperator *op)
int a, ok= 0;
/* first decide if this is a surface merge! */
- if(obedit->type==OB_SURF) nu= nubase->first;
+ if (obedit->type==OB_SURF) nu= nubase->first;
else nu= NULL;
- while(nu) {
- if( isNurbsel(nu) ) {
+ while (nu) {
+ if ( isNurbsel(nu) ) {
- if(nu->pntsu>1 && nu->pntsv>1) break;
- if(isNurbsel_count(cu, nu)>1) break;
- if(isNurbsel_count(cu, nu)==1) {
+ if (nu->pntsu>1 && nu->pntsv>1) break;
+ if (isNurbsel_count(cu, nu)>1) break;
+ if (isNurbsel_count(cu, nu)==1) {
/* only 1 selected, not first or last, a little complex, but intuitive */
- if(nu->pntsv==1) {
- if( (nu->bp->f1 & SELECT) || ((nu->bp+nu->pntsu-1)->f1 & SELECT));
+ if (nu->pntsv==1) {
+ if ( (nu->bp->f1 & SELECT) || ((nu->bp+nu->pntsu-1)->f1 & SELECT));
else break;
}
}
@@ -3923,62 +3961,62 @@ static int make_segment_exec(bContext *C, wmOperator *op)
nu= nu->next;
}
- if(nu)
+ if (nu)
return merge_nurb(C, op);
/* find both nurbs and points, nu1 will be put behind nu2 */
- for(nu= nubase->first; nu; nu= nu->next) {
- if(nu->pntsu == 1)
+ for (nu= nubase->first; nu; nu= nu->next) {
+ if (nu->pntsu == 1)
nu->flagu&= ~CU_NURB_CYCLIC;
- if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic */
- if(nu->type == CU_BEZIER) {
- if(nu1==NULL) {
- if( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) nu1= nu;
+ if ((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic */
+ if (nu->type == CU_BEZIER) {
+ if (nu1==NULL) {
+ if ( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) nu1= nu;
else {
- if( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
+ if ( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
nu1= nu;
switchdirectionNurb(nu);
keyData_switchDirectionNurb(cu, nu);
}
}
}
- else if(nu2==NULL) {
- if( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) {
+ else if (nu2==NULL) {
+ if ( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) {
nu2= nu;
switchdirectionNurb(nu);
keyData_switchDirectionNurb(cu, nu);
}
else {
- if( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
+ if ( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
nu2= nu;
}
}
}
else break;
}
- else if(nu->pntsv==1) {
+ else if (nu->pntsv==1) {
bp= nu->bp;
- if(nu1==NULL) {
- if( bp->f1 & SELECT) nu1= nu;
+ if (nu1==NULL) {
+ if ( bp->f1 & SELECT) nu1= nu;
else {
bp= bp+(nu->pntsu-1);
- if( bp->f1 & SELECT ) {
+ if ( bp->f1 & SELECT ) {
nu1= nu;
switchdirectionNurb(nu);
keyData_switchDirectionNurb(cu, nu);
}
}
}
- else if(nu2==NULL) {
- if( bp->f1 & SELECT ) {
+ else if (nu2==NULL) {
+ if ( bp->f1 & SELECT ) {
nu2= nu;
switchdirectionNurb(nu);
keyData_switchDirectionNurb(cu, nu);
}
else {
bp= bp+(nu->pntsu-1);
- if( bp->f1 & SELECT ) {
+ if ( bp->f1 & SELECT ) {
nu2= nu;
}
}
@@ -3988,9 +4026,9 @@ static int make_segment_exec(bContext *C, wmOperator *op)
}
}
- if((nu1 && nu2) && (nu1!=nu2)) {
- if( nu1->type==nu2->type) {
- if(nu1->type == CU_BEZIER) {
+ if ((nu1 && nu2) && (nu1!=nu2)) {
+ if ( nu1->type==nu2->type) {
+ if (nu1->type == CU_BEZIER) {
BezTriple *bezt =
(BezTriple*)MEM_mallocN((nu1->pntsu+nu2->pntsu) * sizeof(BezTriple), "addsegmentN");
ED_curve_beztcpy(cu->editnurb, bezt, nu2->bezt, nu2->pntsu);
@@ -4017,8 +4055,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
BLI_remlink(nubase, nu2);
/* now join the knots */
- if(nu1->type == CU_NURBS) {
- if(nu1->knotsu==NULL) {
+ if (nu1->type == CU_NURBS) {
+ if (nu1->knotsu==NULL) {
nurbs_knot_calc_u(nu1);
}
else {
@@ -4030,8 +4068,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
offset= nu1->knotsu[a-1] + 1.0f;
fp= nu1->knotsu+a;
- for(a=0; a<nu2->pntsu; a++, fp++) {
- if(nu2->knotsu)
+ for (a=0; a<nu2->pntsu; a++, fp++) {
+ if (nu2->knotsu)
*fp= offset+nu2->knotsu[a+1];
else
*fp = offset;
@@ -4044,14 +4082,16 @@ static int make_segment_exec(bContext *C, wmOperator *op)
set_actNurb(obedit, nu1); /* for selected */
ok= 1;
}
- } else if(nu1 && !nu2) {
- if(!(nu1->flagu & CU_NURB_CYCLIC) && nu1->pntsu>1) {
+ }
+ else if (nu1 && !nu2) {
+ if (!(nu1->flagu & CU_NURB_CYCLIC) && nu1->pntsu>1) {
if (nu1->type == CU_BEZIER && BEZSELECTED_HIDDENHANDLES(cu, nu1->bezt) &&
BEZSELECTED_HIDDENHANDLES(cu, nu1->bezt+(nu1->pntsu-1))) {
nu1->flagu|= CU_NURB_CYCLIC;
calchandlesNurb(nu1);
ok= 1;
- } else if (nu1->type == CU_NURBS && nu1->bp->f1&SELECT && (nu1->bp+(nu1->pntsu-1))->f1&SELECT) {
+ }
+ else if (nu1->type == CU_NURBS && nu1->bp->f1&SELECT && (nu1->bp+(nu1->pntsu-1))->f1&SELECT) {
nu1->flagu|= CU_NURB_CYCLIC;
nurbs_knot_calc_u(nu1);
ok= 1;
@@ -4059,12 +4099,12 @@ static int make_segment_exec(bContext *C, wmOperator *op)
}
}
- if(!ok) {
+ if (!ok) {
BKE_report(op->reports, RPT_ERROR, "Can't make segment");
return OPERATOR_CANCELLED;
}
- if(ED_curve_updateAnimPaths(obedit))
+ if (ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4076,15 +4116,15 @@ static int make_segment_exec(bContext *C, wmOperator *op)
void CURVE_OT_make_segment(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Segment";
- ot->idname= "CURVE_OT_make_segment";
+ ot->name = "Make Segment";
+ ot->idname = "CURVE_OT_make_segment";
/* api callbacks */
- ot->exec= make_segment_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = make_segment_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/***************** pick select from 3d view **********************/
@@ -4108,18 +4148,19 @@ int mouse_nurb(bContext *C, const int mval[2], int extend)
location[1]= mval[1];
hand= findnearestNurbvert(&vc, 1, location, &nu, &bezt, &bp);
- if(bezt || bp) {
- if(extend==0) {
+ if (bezt || bp) {
+ if (extend==0) {
setflagsNurb(editnurb, 0);
- if(bezt) {
+ if (bezt) {
- if(hand==1) {
+ if (hand==1) {
select_beztriple(bezt, SELECT, 1, HIDDEN);
cu->lastsel= bezt;
- } else {
- if(hand==0) bezt->f1|= SELECT;
+ }
+ else {
+ if (hand==0) bezt->f1|= SELECT;
else bezt->f3|= SELECT;
cu->lastsel= NULL;
@@ -4132,26 +4173,30 @@ int mouse_nurb(bContext *C, const int mval[2], int extend)
}
else {
- if(bezt) {
- if(hand==1) {
- if(bezt->f2 & SELECT) {
+ if (bezt) {
+ if (hand==1) {
+ if (bezt->f2 & SELECT) {
select_beztriple(bezt, DESELECT, 1, HIDDEN);
if (bezt == cu->lastsel) cu->lastsel = NULL;
- } else {
+ }
+ else {
select_beztriple(bezt, SELECT, 1, HIDDEN);
cu->lastsel= bezt;
}
- } else if(hand==0) {
+ }
+ else if (hand==0) {
bezt->f1 ^= SELECT;
- } else {
+ }
+ else {
bezt->f3 ^= SELECT;
}
}
else {
- if(bp->f1 & SELECT) {
+ if (bp->f1 & SELECT) {
select_bpoint(bp, DESELECT, 1, HIDDEN);
if (cu->lastsel == bp) cu->lastsel = NULL;
- } else {
+ }
+ else {
select_bpoint(bp, SELECT, 1, HIDDEN);
cu->lastsel= bp;
}
@@ -4159,7 +4204,7 @@ int mouse_nurb(bContext *C, const int mval[2], int extend)
}
- if(nu!=get_actNurb(obedit))
+ if (nu!=get_actNurb(obedit))
set_actNurb(obedit, nu);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
@@ -4223,17 +4268,17 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
ok= 1;
- for(a=0;a<7;a++) {
+ for (a=0;a<7;a++) {
ok= extrudeflagNurb(cu->editnurb, 1);
- if(ok==0)
+ if (ok==0)
return changed;
changed= 1;
rotateflagNurb(editnurb, SELECT, cent, rotmat);
- if( (a & SELECT)==0 ) {
+ if ( (a & SELECT)==0 ) {
rotateflagNurb(editnurb, SELECT, cent, scalemat1);
weightflagNurb(editnurb, SELECT, 0.25*M_SQRT2);
}
@@ -4243,9 +4288,9 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
}
}
- if(ok) {
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(isNurbsel(nu)) {
+ if (ok) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (isNurbsel(nu)) {
nu->orderv= 4;
nu->flagv |= CU_NURB_CYCLIC;
nurbs_knot_calc_v(nu);
@@ -4268,17 +4313,17 @@ static int spin_exec(bContext *C, wmOperator *op)
invert_m4_m4(obedit->imat, obedit->obmat);
mul_m4_v3(obedit->imat, cent);
- if(rv3d)
+ if (rv3d)
copy_m4_m4(viewmat, rv3d->viewmat);
else
unit_m4(viewmat);
- if(!spin_nurb(viewmat, obedit, axis, cent)) {
+ if (!spin_nurb(viewmat, obedit, axis, cent)) {
BKE_report(op->reports, RPT_ERROR, "Can't spin");
return OPERATOR_CANCELLED;
}
- if(ED_curve_updateAnimPaths(obedit))
+ if (ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4294,7 +4339,7 @@ static int spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
RegionView3D *rv3d= ED_view3d_context_rv3d(C);
float axis[3]= {0.0f, 0.0f, 1.0f};
- if(rv3d)
+ if (rv3d)
copy_v3_v3(axis, rv3d->viewinv[2]);
RNA_float_set_array(op->ptr, "center", give_cursor(scene, v3d));
@@ -4306,16 +4351,16 @@ static int spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
void CURVE_OT_spin(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Spin";
- ot->idname= "CURVE_OT_spin";
+ ot->name = "Spin";
+ ot->idname = "CURVE_OT_spin";
/* api callbacks */
- ot->exec= spin_exec;
+ ot->exec = spin_exec;
ot->invoke = spin_invoke;
- ot->poll= ED_operator_editsurf;
+ ot->poll = ED_operator_editsurf;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_float_vector_xyz(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX, "Center", "Center in global view space", -FLT_MAX, FLT_MAX);
RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f, "Axis", "Axis in global view space", -FLT_MAX, FLT_MAX);
@@ -4339,11 +4384,11 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
findselectedNurbvert(&editnurb->nurbs, &nu, &bezt, &bp);
if ((nu == NULL) || (nu->type==CU_BEZIER && bezt==NULL) || (nu->type!=CU_BEZIER && bp==NULL)) {
- if(mode!='e') {
- if(cu->actnu >= 0)
+ if (mode!='e') {
+ if (cu->actnu >= 0)
nu= BLI_findlink(&editnurb->nurbs, cu->actnu);
- if(!nu || nu->type==CU_BEZIER) {
+ if (!nu || nu->type==CU_BEZIER) {
newbezt= (BezTriple*)MEM_callocN(sizeof(BezTriple), "addvert_Nurb");
newbezt->radius= 1;
newbezt->alfa= 0;
@@ -4351,14 +4396,15 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
newbezt->h2= newbezt->h1= HD_AUTO;
newnu= (Nurb*)MEM_callocN(sizeof(Nurb), "addvert_Nurb newnu");
- if(!nu) {
+ if (!nu) {
/* no selected sement -- create new one which is BEZIER tpye
* type couldn't be determined from Curve bt could be changed
* in the future, so shouldn't make much headache */
newnu->type= CU_BEZIER;
newnu->resolu= cu->resolu;
newnu->flag |= CU_SMOOTH;
- } else memcpy(newnu, nu, sizeof(Nurb));
+ }
+ else memcpy(newnu, nu, sizeof(Nurb));
BLI_addtail(&editnurb->nurbs, newnu);
set_actNurb(obedit, newnu);
@@ -4379,7 +4425,8 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
ok= 1;
nu= newnu;
- } else if(nu->pntsv == 1) {
+ }
+ else if (nu->pntsv == 1) {
newbp= (BPoint*)MEM_callocN(sizeof(BPoint), "addvert_Nurb5");
newbp->radius= 1;
newbp->alfa= 0;
@@ -4406,13 +4453,13 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
}
- if(!ok)
+ if (!ok)
return OPERATOR_CANCELLED;
}
- if(!ok && nu->type == CU_BEZIER) {
+ if (!ok && nu->type == CU_BEZIER) {
/* which bezpoint? */
- if(bezt== (nu->bezt+nu->pntsu-1)) { /* last */
+ if (bezt== (nu->bezt+nu->pntsu-1)) { /* last */
BEZ_DESEL(bezt);
newbezt =
(BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb");
@@ -4428,7 +4475,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
bezt= nu->bezt+nu->pntsu-1;
ok= 1;
}
- else if(bezt== nu->bezt) { /* first */
+ else if (bezt== nu->bezt) { /* first */
BEZ_DESEL(bezt);
newbezt =
(BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb");
@@ -4443,7 +4490,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
bezt= newbezt+1;
ok= 1;
}
- else if(mode!='e') {
+ else if (mode!='e') {
BEZ_DESEL(bezt);
newbezt= (BezTriple*)MEM_callocN(sizeof(BezTriple), "addvert_Nurb");
*newbezt= *bezt;
@@ -4465,10 +4512,10 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
}
else bezt= NULL;
- if(bezt) {
- if(!newnu) nu->pntsu++;
+ if (bezt) {
+ if (!newnu) nu->pntsu++;
- if(mode=='e') {
+ if (mode=='e') {
copy_v3_v3(newbezt->vec[0], bezt->vec[0]);
copy_v3_v3(newbezt->vec[1], bezt->vec[1]);
copy_v3_v3(newbezt->vec[2], bezt->vec[2]);
@@ -4479,14 +4526,14 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
add_v3_v3v3(newbezt->vec[0], bezt->vec[0],temp);
add_v3_v3v3(newbezt->vec[2], bezt->vec[2],temp);
- if(newnu) calchandlesNurb(newnu);
+ if (newnu) calchandlesNurb(newnu);
else calchandlesNurb(nu);
}
}
}
- else if(!ok && nu->pntsv==1) {
+ else if (!ok && nu->pntsv==1) {
/* which b-point? */
- if(bp== (nu->bp+nu->pntsu-1)) { /* last */
+ if (bp== (nu->bp+nu->pntsu-1)) { /* last */
bp->f1= 0;
newbp =
(BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb4");
@@ -4500,7 +4547,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
bp= newbp - 1;
ok= 1;
}
- else if(bp== nu->bp) { /* first */
+ else if (bp== nu->bp) { /* first */
bp->f1= 0;
newbp =
(BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb3");
@@ -4513,7 +4560,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
bp= newbp + 1;
ok= 1;
}
- else if(mode!='e') {
+ else if (mode!='e') {
bp->f1= 0;
newbp= (BPoint*)MEM_callocN(sizeof(BPoint), "addvert_Nurb5");
*newbp= *bp;
@@ -4534,29 +4581,30 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
}
else bp= NULL;
- if(bp) {
- if(mode=='e') {
+ if (bp) {
+ if (mode=='e') {
copy_v3_v3(newbp->vec, bp->vec);
}
else {
mul_v3_m4v3(newbp->vec, imat, location);
newbp->vec[3]= 1.0;
- if(!newnu && nu->orderu<4 && nu->orderu<=nu->pntsu)
+ if (!newnu && nu->orderu<4 && nu->orderu<=nu->pntsu)
nu->orderu++;
}
- if(!newnu) {
+ if (!newnu) {
nu->pntsu++;
nurbs_knot_calc_u(nu);
- } else nurbs_knot_calc_u(newnu);
+ }
+ else nurbs_knot_calc_u(newnu);
}
}
- if(ok) {
+ if (ok) {
test2DNurb(nu);
- if(ED_curve_updateAnimPaths(obedit))
+ if (ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4580,7 +4628,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
RegionView3D *rv3d= CTX_wm_region_view3d(C);
- if(rv3d && !RNA_struct_property_is_set(op->ptr, "location")) {
+ if (rv3d && !RNA_struct_property_is_set(op->ptr, "location")) {
Curve *cu;
ViewContext vc;
float location[3];
@@ -4595,7 +4643,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
findselectedNurbvert(&cu->editnurb->nurbs, &nu, &bezt, &bp);
- if(bezt) {
+ if (bezt) {
mul_v3_m4v3(location, vc.obedit->obmat, bezt->vec[1]);
}
else if (bp) {
@@ -4615,16 +4663,16 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
void CURVE_OT_vertex_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Vertex";
- ot->idname= "CURVE_OT_vertex_add";
+ ot->name = "Add Vertex";
+ ot->idname = "CURVE_OT_vertex_add";
/* api callbacks */
- ot->exec= add_vertex_exec;
- ot->invoke= add_vertex_invoke;
- ot->poll= ED_operator_editcurve;
+ ot->exec = add_vertex_exec;
+ ot->invoke = add_vertex_invoke;
+ ot->poll = ED_operator_editcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location to add new vertex at", -1e4, 1e4);
@@ -4640,16 +4688,16 @@ static int extrude_exec(bContext *C, wmOperator *UNUSED(op))
Nurb *nu;
/* first test: curve? */
- for(nu= editnurb->nurbs.first; nu; nu= nu->next)
- if(nu->pntsv==1 && isNurbsel_count(cu, nu)==1)
+ for (nu= editnurb->nurbs.first; nu; nu= nu->next)
+ if (nu->pntsv==1 && isNurbsel_count(cu, nu)==1)
break;
- if(obedit->type==OB_CURVE || nu) {
+ if (obedit->type==OB_CURVE || nu) {
addvert_Nurb(C, 'e', NULL);
}
else {
- if(extrudeflagNurb(editnurb, 1)) { /* '1'= flag */
- if(ED_curve_updateAnimPaths(obedit))
+ if (extrudeflagNurb(editnurb, 1)) { /* '1'= flag */
+ if (ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4663,16 +4711,16 @@ static int extrude_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_extrude(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Extrude";
+ ot->name = "Extrude";
ot->description = "Extrude selected control point(s) and move";
- ot->idname= "CURVE_OT_extrude";
+ ot->idname = "CURVE_OT_extrude";
/* api callbacks */
- ot->exec= extrude_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = extrude_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* to give to transform */
RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -4690,24 +4738,24 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
BPoint *bp;
int a, direction= RNA_enum_get(op->ptr, "direction");
- for(nu= editnurb->first; nu; nu= nu->next) {
- if( nu->pntsu>1 || nu->pntsv>1) {
- if(nu->type == CU_POLY) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if ( nu->pntsu>1 || nu->pntsv>1) {
+ if (nu->type == CU_POLY) {
a= nu->pntsu;
bp= nu->bp;
- while(a--) {
- if( bp->f1 & SELECT ) {
+ while (a--) {
+ if ( bp->f1 & SELECT ) {
nu->flagu ^= CU_NURB_CYCLIC;
break;
}
bp++;
}
}
- else if(nu->type == CU_BEZIER) {
+ else if (nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
- if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
+ while (a--) {
+ if ( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
nu->flagu ^= CU_NURB_CYCLIC;
break;
}
@@ -4715,12 +4763,12 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
}
calchandlesNurb(nu);
}
- else if(nu->pntsv==1 && nu->type == CU_NURBS) {
+ else if (nu->pntsv==1 && nu->type == CU_NURBS) {
if (nu->knotsu) { /* if check_valid_nurb_u fails the knotsu can be NULL */
a= nu->pntsu;
bp= nu->bp;
- while(a--) {
- if( bp->f1 & SELECT ) {
+ while (a--) {
+ if ( bp->f1 & SELECT ) {
nu->flagu ^= CU_NURB_CYCLIC;
nurbs_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
break;
@@ -4729,17 +4777,17 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
}
}
}
- else if(nu->type==CU_NURBS) {
+ else if (nu->type==CU_NURBS) {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
+ while (a--) {
- if( bp->f1 & SELECT) {
- if(direction==0 && nu->pntsu>1) {
+ if ( bp->f1 & SELECT) {
+ if (direction==0 && nu->pntsu>1) {
nu->flagu ^= CU_NURB_CYCLIC;
nurbs_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
}
- if(direction==1 && nu->pntsv>1) {
+ if (direction==1 && nu->pntsv>1) {
nu->flagv ^= CU_NURB_CYCLIC;
nurbs_knot_calc_v(nu); /* 2==v type is ignored for cyclic curves */
}
@@ -4766,10 +4814,10 @@ static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
uiLayout *layout;
Nurb *nu;
- if(obedit->type == OB_SURF) {
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->pntsu>1 || nu->pntsv>1) {
- if(nu->type==CU_NURBS) {
+ if (obedit->type == OB_SURF) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->pntsu>1 || nu->pntsv>1) {
+ if (nu->type==CU_NURBS) {
pup= uiPupMenuBegin(C, "Direction", ICON_NONE);
layout= uiPupMenuLayout(pup);
uiItemsEnumO(layout, op->type->idname, "direction");
@@ -4791,17 +4839,17 @@ void CURVE_OT_cyclic_toggle(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Toggle Cyclic";
+ ot->name = "Toggle Cyclic";
ot->description = "Make active spline closed/opened loop";
- ot->idname= "CURVE_OT_cyclic_toggle";
+ ot->idname = "CURVE_OT_cyclic_toggle";
/* api callbacks */
- ot->exec= toggle_cyclic_exec;
- ot->invoke= toggle_cyclic_invoke;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = toggle_cyclic_exec;
+ ot->invoke = toggle_cyclic_invoke;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to make surface cyclic in");
@@ -4820,15 +4868,15 @@ static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
BPoint *bp;
int a;
- for(nu= nurbs->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= nurbs->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if( (bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT) ) {
+ while (a--) {
+ if ( (bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT) ) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
+ while (a--) {
select_beztriple(bezt, SELECT, 1, VISIBLE);
bezt++;
}
@@ -4840,11 +4888,11 @@ static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if( bp->f1 & 1 ) {
+ while (a--) {
+ if ( bp->f1 & 1 ) {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
+ while (a--) {
select_bpoint(bp, SELECT, 1, VISIBLE);
bp++;
}
@@ -4868,16 +4916,16 @@ static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
void CURVE_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Linked All";
- ot->idname= "CURVE_OT_select_linked";
+ ot->name = "Select Linked All";
+ ot->idname = "CURVE_OT_select_linked";
/* api callbacks */
- ot->exec= select_linked_exec;
- ot->invoke= select_linked_invoke;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = select_linked_exec;
+ ot->invoke = select_linked_invoke;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
}
@@ -4901,20 +4949,20 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
findnearestNurbvert(&vc, 1, event->mval, &nu, &bezt, &bp);
- if(bezt) {
+ if (bezt) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
- if(deselect) select_beztriple(bezt, DESELECT, 1, VISIBLE);
+ while (a--) {
+ if (deselect) select_beztriple(bezt, DESELECT, 1, VISIBLE);
else select_beztriple(bezt, SELECT, 1, VISIBLE);
bezt++;
}
}
- else if(bp) {
+ else if (bp) {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
- if(deselect) select_bpoint(bp, DESELECT, 1, VISIBLE);
+ while (a--) {
+ if (deselect) select_bpoint(bp, DESELECT, 1, VISIBLE);
else select_bpoint(bp, SELECT, 1, VISIBLE);
bp++;
}
@@ -4928,15 +4976,15 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
void CURVE_OT_select_linked_pick(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Linked";
- ot->idname= "CURVE_OT_select_linked_pick";
+ ot->name = "Select Linked";
+ ot->idname = "CURVE_OT_select_linked_pick";
/* api callbacks */
- ot->invoke= select_linked_pick_invoke;
- ot->poll= ED_operator_editsurfcurve_region_view3d;
+ ot->invoke = select_linked_pick_invoke;
+ ot->poll = ED_operator_editsurfcurve_region_view3d;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect linked control points rather than selecting them");
@@ -4955,41 +5003,41 @@ static int select_row_exec(bContext *C, wmOperator *UNUSED(op))
BPoint *bp;
int u = 0, v = 0, a, b, ok=0;
- if(editnurb->first == NULL)
+ if (editnurb->first == NULL)
return OPERATOR_CANCELLED;
- if(cu->lastsel==NULL)
+ if (cu->lastsel==NULL)
return OPERATOR_CANCELLED;
/* find the correct nurb and toggle with u of v */
- for(nu= editnurb->first; nu; nu= nu->next) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
bp= nu->bp;
- for(v=0; v<nu->pntsv; v++) {
- for(u=0; u<nu->pntsu; u++, bp++) {
- if(bp==cu->lastsel) {
- if(bp->f1 & SELECT) {
+ for (v=0; v<nu->pntsv; v++) {
+ for (u=0; u<nu->pntsu; u++, bp++) {
+ if (bp==cu->lastsel) {
+ if (bp->f1 & SELECT) {
ok= 1;
break;
}
}
}
- if(ok) break;
+ if (ok) break;
}
- if(ok) {
- if(last==cu->lastsel) {
+ if (ok) {
+ if (last==cu->lastsel) {
direction= 1-direction;
setflagsNurb(editnurb, 0);
}
last= cu->lastsel;
bp= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++, bp++) {
- if(direction) {
- if(a==v) select_bpoint(bp, SELECT, 1, VISIBLE);
+ for (a=0; a<nu->pntsv; a++) {
+ for (b=0; b<nu->pntsu; b++, bp++) {
+ if (direction) {
+ if (a==v) select_bpoint(bp, SELECT, 1, VISIBLE);
}
else {
- if(b==u) select_bpoint(bp, SELECT, 1, VISIBLE);
+ if (b==u) select_bpoint(bp, SELECT, 1, VISIBLE);
}
}
}
@@ -5006,15 +5054,15 @@ static int select_row_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_select_row(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Control Point Row";
- ot->idname= "CURVE_OT_select_row";
+ ot->name = "Select Control Point Row";
+ ot->idname = "CURVE_OT_select_row";
/* api callbacks */
- ot->exec= select_row_exec;
- ot->poll= ED_operator_editsurf;
+ ot->exec = select_row_exec;
+ ot->poll = ED_operator_editsurf;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/***************** select next operator **********************/
@@ -5033,15 +5081,15 @@ static int select_next_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_select_next(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Next";
- ot->idname= "CURVE_OT_select_next";
+ ot->name = "Select Next";
+ ot->idname = "CURVE_OT_select_next";
/* api callbacks */
- ot->exec= select_next_exec;
- ot->poll= ED_operator_editcurve;
+ ot->exec = select_next_exec;
+ ot->poll = ED_operator_editcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/***************** select previous operator **********************/
@@ -5060,15 +5108,15 @@ static int select_previous_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_select_previous(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Previous";
- ot->idname= "CURVE_OT_select_previous";
+ ot->name = "Select Previous";
+ ot->idname = "CURVE_OT_select_previous";
/* api callbacks */
- ot->exec= select_previous_exec;
- ot->poll= ED_operator_editcurve;
+ ot->exec = select_previous_exec;
+ ot->poll = ED_operator_editcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/***************** select more operator **********************/
@@ -5087,40 +5135,40 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
/* the behavior of "select more" of mesh tools. */
/* The algorithm is designed to work in planar cases so it */
/* may not be optimal always (example: end of NURBS sphere) */
- if(obedit->type==OB_SURF) {
- for(nu= editnurb->first; nu; nu= nu->next) {
+ if (obedit->type==OB_SURF) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
selbpoints= MEM_callocN(sizeof(short)*a-nu->pntsu, "selectlist");
- while(a > 0) {
- if((selbpoints[a]!=1) && (bp->hide==0) && (bp->f1 & SELECT)) {
+ while (a > 0) {
+ if ((selbpoints[a]!=1) && (bp->hide==0) && (bp->f1 & SELECT)) {
/* upper control point */
- if(a%nu->pntsu != 0) {
+ if (a%nu->pntsu != 0) {
tempbp= bp-1;
- if(!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, 1, VISIBLE);
+ if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, 1, VISIBLE);
}
/* left control point. select only if it is not selected already */
- if(a-nu->pntsu > 0) {
+ if (a-nu->pntsu > 0) {
sel= 0;
tempbp= bp+nu->pntsu;
- if(!(tempbp->f1 & SELECT)) sel= select_bpoint(tempbp, SELECT, 1, VISIBLE);
+ if (!(tempbp->f1 & SELECT)) sel= select_bpoint(tempbp, SELECT, 1, VISIBLE);
/* make sure selected bpoint is discarded */
- if(sel == 1) selbpoints[a-nu->pntsu]= 1;
+ if (sel == 1) selbpoints[a-nu->pntsu]= 1;
}
/* right control point */
- if(a+nu->pntsu < nu->pntsu*nu->pntsv) {
+ if (a+nu->pntsu < nu->pntsu*nu->pntsv) {
tempbp= bp-nu->pntsu;
- if(!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, 1, VISIBLE);
+ if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, 1, VISIBLE);
}
/* lower control point. skip next bp in case selection was made */
- if(a%nu->pntsu != 1) {
+ if (a%nu->pntsu != 1) {
sel= 0;
tempbp= bp+1;
- if(!(tempbp->f1 & 1)) sel= select_bpoint(tempbp, SELECT, 1, VISIBLE);
- if(sel) {
+ if (!(tempbp->f1 & 1)) sel= select_bpoint(tempbp, SELECT, 1, VISIBLE);
+ if (sel) {
bp++;
a--;
}
@@ -5147,15 +5195,15 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_select_more(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select More";
- ot->idname= "CURVE_OT_select_more";
+ ot->name = "Select More";
+ ot->idname = "CURVE_OT_select_more";
/* api callbacks */
- ot->exec= select_more_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = select_more_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/******************** select less operator *****************/
@@ -5172,46 +5220,46 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
short sel= 0, lastsel= 0;
short *selbpoints;
- if(obedit->type==OB_SURF) {
- for(nu= editnurb->first; nu; nu= nu->next) {
+ if (obedit->type==OB_SURF) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
selbpoints= MEM_callocN(sizeof(short)*a, "selectlist");
- while(a--) {
- if((bp->hide==0) && (bp->f1 & SELECT)) {
+ while (a--) {
+ if ((bp->hide==0) && (bp->f1 & SELECT)) {
sel= 0;
/* check if neighbors have been selected */
/* edges of surface are an exception */
- if((a+1)%nu->pntsu==0) sel++;
+ if ((a+1)%nu->pntsu==0) sel++;
else {
bp--;
- if((selbpoints[a+1]==1) || ((bp->hide==0) && (bp->f1 & SELECT))) sel++;
+ if ((selbpoints[a+1]==1) || ((bp->hide==0) && (bp->f1 & SELECT))) sel++;
bp++;
}
- if((a+1)%nu->pntsu==1) sel++;
+ if ((a+1)%nu->pntsu==1) sel++;
else {
bp++;
- if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
+ if ((bp->hide==0) && (bp->f1 & SELECT)) sel++;
bp--;
}
- if(a+1 > nu->pntsu*nu->pntsv-nu->pntsu) sel++;
+ if (a+1 > nu->pntsu*nu->pntsv-nu->pntsu) sel++;
else {
bp-=nu->pntsu;
- if((selbpoints[a+nu->pntsu]==1) || ((bp->hide==0) && (bp->f1 & SELECT))) sel++;
+ if ((selbpoints[a+nu->pntsu]==1) || ((bp->hide==0) && (bp->f1 & SELECT))) sel++;
bp+=nu->pntsu;
}
- if(a < nu->pntsu) sel++;
+ if (a < nu->pntsu) sel++;
else {
bp+=nu->pntsu;
- if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
+ if ((bp->hide==0) && (bp->f1 & SELECT)) sel++;
bp-=nu->pntsu;
}
- if(sel!=4) {
+ if (sel!=4) {
select_bpoint(bp, DESELECT, 1, VISIBLE);
selbpoints[a]= 1;
}
@@ -5225,34 +5273,34 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
}
}
else {
- for(nu= editnurb->first; nu; nu= nu->next) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
lastsel=0;
/* check what type of curve/nurb it is */
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
- if((bezt->hide==0) && (bezt->f2 & SELECT)) {
- if(lastsel==1) sel= 1;
+ while (a--) {
+ if ((bezt->hide==0) && (bezt->f2 & SELECT)) {
+ if (lastsel==1) sel= 1;
else sel= 0;
/* check if neighbors have been selected */
/* first and last are exceptions */
- if(a==nu->pntsu-1) sel++;
+ if (a==nu->pntsu-1) sel++;
else {
bezt--;
- if((bezt->hide==0) && (bezt->f2 & SELECT)) sel++;
+ if ((bezt->hide==0) && (bezt->f2 & SELECT)) sel++;
bezt++;
}
- if(a==0) sel++;
+ if (a==0) sel++;
else {
bezt++;
- if((bezt->hide==0) && (bezt->f2 & SELECT)) sel++;
+ if ((bezt->hide==0) && (bezt->f2 & SELECT)) sel++;
bezt--;
}
- if(sel!=2) {
+ if (sel!=2) {
select_beztriple(bezt, DESELECT, 1, VISIBLE);
lastsel= 1;
}
@@ -5266,27 +5314,27 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
else {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
- if((lastsel==0) && (bp->hide==0) && (bp->f1 & SELECT)) {
- if(lastsel!=0) sel= 1;
+ while (a--) {
+ if ((lastsel==0) && (bp->hide==0) && (bp->f1 & SELECT)) {
+ if (lastsel!=0) sel= 1;
else sel= 0;
/* first and last are exceptions */
- if(a==nu->pntsu*nu->pntsv-1) sel++;
+ if (a==nu->pntsu*nu->pntsv-1) sel++;
else {
bp--;
- if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
+ if ((bp->hide==0) && (bp->f1 & SELECT)) sel++;
bp++;
}
- if(a==0) sel++;
+ if (a==0) sel++;
else {
bp++;
- if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
+ if ((bp->hide==0) && (bp->f1 & SELECT)) sel++;
bp--;
}
- if(sel!=2) {
+ if (sel!=2) {
select_bpoint(bp, DESELECT, 1, VISIBLE);
lastsel= 1;
}
@@ -5308,15 +5356,15 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_select_less(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Less";
- ot->idname= "CURVE_OT_select_less";
+ ot->name = "Select Less";
+ ot->idname = "CURVE_OT_select_less";
/* api callbacks */
- ot->exec= select_less_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = select_less_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** select random *********************/
@@ -5330,11 +5378,11 @@ static void selectrandom_curve(ListBase *editnurb, float randfac)
BLI_srand( BLI_rand() ); /* random seed */
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
if (BLI_frand() < randfac)
select_beztriple(bezt, SELECT, 1, VISIBLE);
bezt++;
@@ -5344,7 +5392,7 @@ static void selectrandom_curve(ListBase *editnurb, float randfac)
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
+ while (a--) {
if (BLI_frand() < randfac)
select_bpoint(bp, SELECT, 1, VISIBLE);
bp++;
@@ -5358,7 +5406,7 @@ static int select_random_exec(bContext *C, wmOperator *op)
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= object_editcurve_get(obedit);
- if(!RNA_boolean_get(op->ptr, "extend"))
+ if (!RNA_boolean_get(op->ptr, "extend"))
CU_deselect_all(obedit);
selectrandom_curve(editnurb, RNA_float_get(op->ptr, "percent")/100.0f);
@@ -5371,15 +5419,15 @@ static int select_random_exec(bContext *C, wmOperator *op)
void CURVE_OT_select_random(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Random";
- ot->idname= "CURVE_OT_select_random";
+ ot->name = "Select Random";
+ ot->idname = "CURVE_OT_select_random";
/* api callbacks */
- ot->exec= select_random_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = select_random_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* 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 elements to select randomly", 0.f, 100.0f);
@@ -5393,7 +5441,8 @@ static int point_on_nurb(Nurb *nu, void *point)
if (nu->bezt) {
BezTriple *bezt= (BezTriple*)point;
return bezt >= nu->bezt && bezt < nu->bezt + nu->pntsu;
- } else {
+ }
+ else {
BPoint *bp= (BPoint*)point;
return bp >= nu->bp && bp < nu->bp + nu->pntsu * nu->pntsv;
}
@@ -5404,7 +5453,7 @@ static Nurb *get_lastsel_nurb(Curve *cu)
ListBase *nubase= curve_editnurbs(cu);
Nurb *nu= nubase->first;
- if(!cu->lastsel)
+ if (!cu->lastsel)
return NULL;
while (nu) {
@@ -5474,7 +5523,8 @@ int CU_select_nth(Object *obedit, int nth)
if (nu->bezt) {
select_nth_bezt(nu, cu->lastsel, nth);
- } else {
+ }
+ else {
select_nth_bp(nu, cu->lastsel, nth);
}
@@ -5489,7 +5539,8 @@ static int select_nth_exec(bContext *C, wmOperator *op)
if (!CU_select_nth(obedit, nth)) {
if (obedit->type == OB_SURF) {
BKE_report(op->reports, RPT_ERROR, "Surface hasn't got active point");
- } else {
+ }
+ else {
BKE_report(op->reports, RPT_ERROR, "Curve hasn't got active point");
}
@@ -5504,16 +5555,16 @@ static int select_nth_exec(bContext *C, wmOperator *op)
void CURVE_OT_select_nth(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Nth";
- ot->description= "";
- ot->idname= "CURVE_OT_select_nth";
+ ot->name = "Select Nth";
+ ot->description = "";
+ ot->idname = "CURVE_OT_select_nth";
/* api callbacks */
- ot->exec= select_nth_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = select_nth_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_int(ot->srna, "nth", 2, 2, 100, "Nth Selection", "", 1, INT_MAX);
}
@@ -5533,16 +5584,16 @@ static int duplicate_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Duplicate Curve";
+ ot->name = "Duplicate Curve";
ot->description = "Duplicate selected control points and segments between them";
- ot->idname= "CURVE_OT_duplicate";
+ ot->idname = "CURVE_OT_duplicate";
/* api callbacks */
- ot->exec= duplicate_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = duplicate_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** delete operator *********************/
@@ -5559,14 +5610,15 @@ static int delete_exec(bContext *C, wmOperator *op)
int a, cut= 0, type= RNA_enum_get(op->ptr, "type");
int nuindex= 0;
- if(obedit->type==OB_SURF) {
- if(type==0) {
+ if (obedit->type==OB_SURF) {
+ if (type==0) {
deleteflagNurb(C, op, 1);
- } else {
+ }
+ else {
keyIndex_delNurbList(editnurb, nubase);
freeNurblist(nubase);
- if(ED_curve_updateAnimPaths(obedit))
+ if (ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
}
@@ -5576,24 +5628,24 @@ static int delete_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- if(type==0) {
+ if (type==0) {
/* first loop, can we remove entire pieces? */
Nurb *next;
nu= nubase->first;
- while(nu) {
+ while (nu) {
next= nu->next;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- if(a) {
- while(a) {
- if( BEZSELECTED_HIDDENHANDLES(cu, bezt) );
+ if (a) {
+ while (a) {
+ if ( BEZSELECTED_HIDDENHANDLES(cu, bezt) );
else break;
a--;
bezt++;
}
- if(a==0) {
- if(cu->actnu == nuindex)
+ if (a==0) {
+ if (cu->actnu == nuindex)
cu->actnu= -1;
BLI_remlink(nubase, nu);
@@ -5605,15 +5657,15 @@ static int delete_exec(bContext *C, wmOperator *op)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- if(a) {
- while(a) {
- if(bp->f1 & SELECT);
+ if (a) {
+ while (a) {
+ if (bp->f1 & SELECT);
else break;
a--;
bp++;
}
- if(a==0) {
- if(cu->actnu == nuindex)
+ if (a==0) {
+ if (cu->actnu == nuindex)
cu->actnu= -1;
BLI_remlink(nubase, nu);
@@ -5635,14 +5687,14 @@ static int delete_exec(bContext *C, wmOperator *op)
}
/* 2nd loop, delete small pieces: just for curves */
nu= nubase->first;
- while(nu) {
+ while (nu) {
next= nu->next;
type= 0;
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
int delta= 0;
bezt= nu->bezt;
- for(a=0;a<nu->pntsu;a++) {
- if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
+ for (a=0;a<nu->pntsu;a++) {
+ if ( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
memmove(bezt, bezt+1, (nu->pntsu-a-1)*sizeof(BezTriple));
keyIndex_delBezt(editnurb, bezt + delta);
keyIndex_updateBezt(editnurb, bezt + 1, bezt, nu->pntsu-a-1);
@@ -5653,7 +5705,7 @@ static int delete_exec(bContext *C, wmOperator *op)
}
else bezt++;
}
- if(type) {
+ if (type) {
bezt1 =
(BezTriple*)MEM_mallocN((nu->pntsu) * sizeof(BezTriple), "delNurb");
memcpy(bezt1, nu->bezt, (nu->pntsu)*sizeof(BezTriple) );
@@ -5663,12 +5715,12 @@ static int delete_exec(bContext *C, wmOperator *op)
calchandlesNurb(nu);
}
}
- else if(nu->pntsv==1) {
+ else if (nu->pntsv==1) {
int delta= 0;
bp= nu->bp;
- for(a=0;a<nu->pntsu;a++) {
- if( bp->f1 & SELECT ) {
+ for (a=0;a<nu->pntsu;a++) {
+ if ( bp->f1 & SELECT ) {
memmove(bp, bp+1, (nu->pntsu-a-1)*sizeof(BPoint));
keyIndex_delBP(editnurb, bp + delta);
keyIndex_updateBP(editnurb, bp+1, bp, nu->pntsu-a-1);
@@ -5681,7 +5733,7 @@ static int delete_exec(bContext *C, wmOperator *op)
bp++;
}
}
- if(type) {
+ if (type) {
bp1 = (BPoint*)MEM_mallocN(nu->pntsu * sizeof(BPoint), "delNurb2");
memcpy(bp1, nu->bp, (nu->pntsu)*sizeof(BPoint) );
keyIndex_updateBP(editnurb, nu->bp, bp1, nu->pntsu);
@@ -5702,26 +5754,26 @@ static int delete_exec(bContext *C, wmOperator *op)
nu= next;
}
}
- else if(type==1) { /* erase segment */
+ else if (type==1) { /* erase segment */
/* find the 2 selected points */
bezt1= bezt2= NULL;
bp1= bp2= NULL;
nu1= NULL;
nuindex= 0;
- for(nu= nubase->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= nubase->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
- for(a=0; a<nu->pntsu-1; a++) {
- if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
+ for (a=0; a<nu->pntsu-1; a++) {
+ if ( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
bezt1= bezt;
bezt2= bezt+1;
if ((bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT)) {
/* pass */
}
else { /* maybe do not make cyclic */
- if(a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
+ if (a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
bezt2= bezt+(nu->pntsu-1);
- if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) {
+ if ( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) {
nu->flagu &= ~CU_NURB_CYCLIC;
calchandlesNurb(nu);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -5738,19 +5790,19 @@ static int delete_exec(bContext *C, wmOperator *op)
bezt++;
}
}
- else if(nu->pntsv==1) {
+ else if (nu->pntsv==1) {
bp= nu->bp;
- for(a=0; a<nu->pntsu-1; a++) {
- if( bp->f1 & SELECT ) {
+ for (a=0; a<nu->pntsu-1; a++) {
+ if ( bp->f1 & SELECT ) {
bp1= bp;
bp2= bp+1;
if (bp2->f1 & 1) {
/* pass */
}
else { /* maybe do not make cyclic */
- if(a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
+ if (a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
bp2= bp+(nu->pntsu-1);
- if( bp2->f1 & SELECT ) {
+ if ( bp2->f1 & SELECT ) {
nu->flagu &= ~CU_NURB_CYCLIC;
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_tag_update(obedit->data, 0);
@@ -5766,19 +5818,19 @@ static int delete_exec(bContext *C, wmOperator *op)
bp++;
}
}
- if(nu1) break;
+ if (nu1) break;
nuindex++;
}
- if(nu1) {
- if(bezt1) {
- if(nu1->pntsu==2) { /* remove completely */
- if(cu->actnu == nuindex)
+ if (nu1) {
+ if (bezt1) {
+ if (nu1->pntsu==2) { /* remove completely */
+ if (cu->actnu == nuindex)
cu->actnu= -1;
BLI_remlink(nubase, nu);
freeNurb(nu); nu = NULL;
}
- else if(nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
+ else if (nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
bezt =
(BezTriple*)MEM_mallocN((cut+1) * sizeof(BezTriple), "delNurb1");
ED_curve_beztcpy(editnurb, bezt, nu1->bezt, cut+1);
@@ -5816,15 +5868,15 @@ static int delete_exec(bContext *C, wmOperator *op)
calchandlesNurb(nu1);
}
}
- else if(bp1) {
- if(nu1->pntsu==2) { /* remove completely */
- if(cu->actnu == nuindex)
+ else if (bp1) {
+ if (nu1->pntsu==2) { /* remove completely */
+ if (cu->actnu == nuindex)
cu->actnu= -1;
BLI_remlink(nubase, nu);
freeNurb(nu); nu= NULL;
}
- else if(nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
+ else if (nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
bp =
(BPoint*)MEM_mallocN((cut+1) * sizeof(BPoint), "delNurb5");
ED_curve_bpcpy(editnurb, bp, nu1->bp, cut+1);
@@ -5861,13 +5913,13 @@ static int delete_exec(bContext *C, wmOperator *op)
}
}
}
- else if(type==2) {
+ else if (type==2) {
cu->actnu= -1;
keyIndex_delNurbList(editnurb, nubase);
freeNurblist(nubase);
}
- if(ED_curve_updateAnimPaths(obedit))
+ if (ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -5882,7 +5934,7 @@ static int delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
uiPopupMenu *pup;
uiLayout *layout;
- if(obedit->type==OB_SURF) {
+ if (obedit->type==OB_SURF) {
pup= uiPupMenuBegin(C, "Delete", ICON_NONE);
layout= uiPupMenuLayout(pup);
uiItemEnumO_ptr(layout, op->type, NULL, 0, "type", 0);
@@ -5908,17 +5960,17 @@ void CURVE_OT_delete(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Delete";
+ ot->name = "Delete";
ot->description = "Delete selected control points or segments";
- ot->idname= "CURVE_OT_delete";
+ ot->idname = "CURVE_OT_delete";
/* api callbacks */
- ot->exec= delete_exec;
- ot->invoke= delete_invoke;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = delete_exec;
+ ot->invoke = delete_invoke;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "Which elements to delete");
@@ -5933,12 +5985,12 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
Nurb *nu;
int clear= (strcmp(op->idname, "CURVE_OT_shade_flat") == 0);
- if(obedit->type != OB_CURVE)
+ if (obedit->type != OB_CURVE)
return OPERATOR_CANCELLED;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(isNurbsel(nu)) {
- if(!clear) nu->flag |= CU_SMOOTH;
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (isNurbsel(nu)) {
+ if (!clear) nu->flag |= CU_SMOOTH;
else nu->flag &= ~CU_SMOOTH;
}
}
@@ -5952,29 +6004,29 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
void CURVE_OT_shade_smooth(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Shade Smooth";
- ot->idname= "CURVE_OT_shade_smooth";
+ ot->name = "Shade Smooth";
+ ot->idname = "CURVE_OT_shade_smooth";
/* api callbacks */
- ot->exec= shade_smooth_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = shade_smooth_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
void CURVE_OT_shade_flat(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Shade Flat";
- ot->idname= "CURVE_OT_shade_flat";
+ ot->name = "Shade Flat";
+ ot->idname = "CURVE_OT_shade_flat";
/* api callbacks */
- ot->exec= shade_smooth_exec;
- ot->poll= ED_operator_editsurfcurve;
+ ot->exec = shade_smooth_exec;
+ ot->poll = ED_operator_editsurfcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************** join operator, to be used externally? ****************/
@@ -5998,26 +6050,27 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
invert_m4_m4(imat, ob->obmat);
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- if(base->object->type==ob->type) {
- if(base->object != ob) {
+ if (base->object->type==ob->type) {
+ if (base->object != ob) {
cu= base->object->data;
- if(cu->nurb.first) {
+ if (cu->nurb.first) {
/* watch it: switch order here really goes wrong */
mult_m4_m4m4(cmat, imat, base->object->obmat);
nu= cu->nurb.first;
- while(nu) {
+ while (nu) {
newnu= duplicateNurb(nu);
- if(ob->totcol) { /* TODO, merge material lists */
+ if (ob->totcol) { /* TODO, merge material lists */
CLAMP(newnu->mat_nr, 0, ob->totcol-1);
- } else newnu->mat_nr= 0;
+ }
+ else newnu->mat_nr= 0;
BLI_addtail(&tempbase, newnu);
- if( (bezt= newnu->bezt) ) {
+ if ( (bezt= newnu->bezt) ) {
a= newnu->pntsu;
- while(a--) {
+ while (a--) {
mul_m4_v3(cmat, bezt->vec[0]);
mul_m4_v3(cmat, bezt->vec[1]);
mul_m4_v3(cmat, bezt->vec[2]);
@@ -6025,9 +6078,9 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
}
calchandlesNurb(newnu);
}
- if( (bp= newnu->bp) ) {
+ if ( (bp= newnu->bp) ) {
a= newnu->pntsu*nu->pntsv;
- while(a--) {
+ while (a--) {
mul_m4_v3(cmat, bp->vec);
bp++;
}
@@ -6061,7 +6114,7 @@ static const char *get_curve_defname(int type)
{
int stype= type & CU_PRIMITIVE;
- if((type & CU_TYPE)==CU_BEZIER) {
+ if ((type & CU_TYPE)==CU_BEZIER) {
switch (stype) {
case CU_PRIM_CURVE: return "BezierCurve";
case CU_PRIM_CIRCLE: return "BezierCircle";
@@ -6117,7 +6170,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
const int stype= (type & CU_PRIMITIVE);
const int force_3d = ((Curve *)obedit->data)->flag & CU_3D; /* could be adding to an existing 3D curve */
- if(rv3d) {
+ if (rv3d) {
copy_m4_m4(viewmat, rv3d->viewmat);
copy_v3_v3(zvec, rv3d->viewinv[2]);
}
@@ -6135,7 +6188,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
switch(stype) {
case CU_PRIM_CURVE: /* curve */
nu->resolu= cu->resolu;
- if(cutype==CU_BEZIER) {
+ if (cutype==CU_BEZIER) {
if (!force_3d) nu->flag |= CU_2D;
nu->pntsu= 2;
nu->bezt =
@@ -6150,7 +6203,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bezt->vec[0][1]+= -0.5f*grid;
bezt->vec[2][0]+= -0.5f*grid;
bezt->vec[2][1]+= 0.5f*grid;
- for(a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
bezt++;
bezt->h1= bezt->h2= HD_ALIGN;
@@ -6163,7 +6216,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bezt->vec[1][1] = 0;
bezt->vec[2][0] = grid*2;
bezt->vec[2][1] = 0;
- for(a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
calchandlesNurb(nu);
}
@@ -6175,7 +6228,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
nu->bp= callocstructN(BPoint, 4, "addNurbprim3");
bp= nu->bp;
- for(a=0;a<4;a++, bp++) {
+ for (a=0;a<4;a++, bp++) {
bp->vec[3]= 1.0;
bp->f1= SELECT;
bp->radius = bp->weight = 1.0;
@@ -6193,9 +6246,9 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bp->vec[0]+= 1.5f*grid;
bp= nu->bp;
- for(a=0;a<4;a++, bp++) mul_m4_v3(mat,bp->vec);
+ for (a=0;a<4;a++, bp++) mul_m4_v3(mat,bp->vec);
- if(cutype==CU_NURBS) {
+ if (cutype==CU_NURBS) {
nu->knotsu= NULL; /* nurbs_knot_calc_u allocates */
nurbs_knot_calc_u(nu);
}
@@ -6211,7 +6264,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
nu->bp= callocstructN(BPoint, 5, "addNurbprim3");
bp= nu->bp;
- for(a=0;a<5;a++, bp++) {
+ for (a=0;a<5;a++, bp++) {
bp->vec[3]= 1.0;
bp->f1= SELECT;
bp->radius = bp->weight = 1.0;
@@ -6227,9 +6280,9 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bp->vec[0]+= 2.0f*grid;
bp= nu->bp;
- for(a=0;a<5;a++, bp++) mul_m4_v3(mat,bp->vec);
+ for (a=0;a<5;a++, bp++) mul_m4_v3(mat,bp->vec);
- if(cutype==CU_NURBS) {
+ if (cutype==CU_NURBS) {
nu->knotsu= NULL; /* nurbs_knot_calc_u allocates */
nurbs_knot_calc_u(nu);
}
@@ -6238,7 +6291,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
case CU_PRIM_CIRCLE: /* circle */
nu->resolu= cu->resolu;
- if(cutype==CU_BEZIER) {
+ if (cutype==CU_BEZIER) {
if (!force_3d) nu->flag |= CU_2D;
nu->pntsu= 4;
nu->bezt= callocstructN(BezTriple, 4, "addNurbprim1");
@@ -6248,33 +6301,33 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][0]+= -grid;
- for(a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][1]+= grid;
- for(a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][0]+= grid;
- for(a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][1]+= -grid;
- for(a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
calchandlesNurb(nu);
}
- else if( cutype==CU_NURBS ) { /* nurb */
+ else if ( cutype==CU_NURBS ) { /* nurb */
nu->pntsu= 8;
nu->pntsv= 1;
nu->orderu= 4;
@@ -6282,9 +6335,9 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
nu->flagu= CU_NURB_CYCLIC;
bp= nu->bp;
- for(a=0; a<8; a++) {
+ for (a=0; a<8; a++) {
bp->f1= SELECT;
- if(xzproj==0) {
+ if (xzproj==0) {
bp->vec[0]+= nurbcircle[a][0]*grid;
bp->vec[1]+= nurbcircle[a][1]*grid;
}
@@ -6292,7 +6345,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bp->vec[0]+= 0.25f*nurbcircle[a][0]*grid-0.75f*grid;
bp->vec[2]+= 0.25f*nurbcircle[a][1]*grid;
}
- if(a & 1) bp->vec[3]= 0.25*M_SQRT2;
+ if (a & 1) bp->vec[3]= 0.25*M_SQRT2;
else bp->vec[3]= 1.0;
mul_m4_v3(mat,bp->vec);
bp->radius = bp->weight = 1.0;
@@ -6304,7 +6357,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
}
break;
case CU_PRIM_PATCH: /* 4x4 patch */
- if( cutype==CU_NURBS ) { /* nurb */
+ if ( cutype==CU_NURBS ) { /* nurb */
nu->pntsu= 4;
nu->pntsv= 4;
@@ -6316,14 +6369,14 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
nu->flagv= 0;
bp= nu->bp;
- for(a=0; a<4; a++) {
- for(b=0; b<4; b++) {
+ for (a=0; a<4; a++) {
+ for (b=0; b<4; b++) {
bp->f1= SELECT;
fac= (float)a -1.5f;
bp->vec[0]+= fac*grid;
fac= (float)b -1.5f;
bp->vec[1]+= fac*grid;
- if(a==1 || a==2) if(b==1 || b==2) {
+ if (a==1 || a==2) if (b==1 || b==2) {
bp->vec[2]+= grid;
}
mul_m4_v3(mat,bp->vec);
@@ -6337,7 +6390,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
}
break;
case CU_PRIM_TUBE: /* Cylinder */
- if( cutype==CU_NURBS ) {
+ if ( cutype==CU_NURBS ) {
nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */
nu->resolu= cu->resolu;
nu->flag= CU_SMOOTH;
@@ -6345,7 +6398,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
vec[0]=vec[1]= 0.0;
vec[2]= -grid;
- if(newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) {
+ if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) {
/* pass */
}
else {
@@ -6363,14 +6416,14 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a-- >0) {
+ while (a-- >0) {
bp->f1 |= SELECT;
bp++;
}
}
break;
case CU_PRIM_SPHERE: /* sphere */
- if( cutype==CU_NURBS ) {
+ if ( cutype==CU_NURBS ) {
float tmp_cent[3] = {0.f, 0.f, 0.f};
float tmp_vec[3] = {0.f, 0.f, 1.f};
@@ -6384,11 +6437,11 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
nu->flagu= 0;
bp= nu->bp;
- for(a=0; a<5; a++) {
+ for (a=0; a<5; a++) {
bp->f1= SELECT;
bp->vec[0]+= nurbcircle[a][0]*grid;
bp->vec[2]+= nurbcircle[a][1]*grid;
- if(a & 1) bp->vec[3]= 0.5*M_SQRT2;
+ if (a & 1) bp->vec[3]= 0.5*M_SQRT2;
else bp->vec[3]= 1.0;
mul_m4_v3(mat,bp->vec);
bp++;
@@ -6398,7 +6451,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
BLI_addtail(editnurb, nu); /* temporal for spin */
- if(newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) spin_nurb(umat, obedit, tmp_vec, tmp_cent);
+ if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) spin_nurb(umat, obedit, tmp_vec, tmp_cent);
else if ((U.flag & USER_ADD_VIEWALIGNED)) spin_nurb(viewmat, obedit, zvec, mat[3]);
else spin_nurb(umat, obedit, tmp_vec, mat[3]);
@@ -6406,7 +6459,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a-- >0) {
+ while (a-- >0) {
bp->f1 |= SELECT;
bp++;
}
@@ -6414,7 +6467,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
}
break;
case CU_PRIM_DONUT: /* torus */
- if( cutype==CU_NURBS ) {
+ if ( cutype==CU_NURBS ) {
float tmp_cent[3] = {0.f, 0.f, 0.f};
float tmp_vec[3] = {0.f, 0.f, 1.f};
@@ -6427,7 +6480,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
BLI_addtail(editnurb, nu); /* temporal for spin */
/* same as above */
- if(newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) spin_nurb(umat, obedit, tmp_vec, tmp_cent);
+ if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) spin_nurb(umat, obedit, tmp_vec, tmp_cent);
else if ((U.flag & USER_ADD_VIEWALIGNED)) spin_nurb(viewmat, obedit, zvec, mat[3]);
else spin_nurb(umat, obedit, tmp_vec, mat[3]);
@@ -6436,7 +6489,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a-- >0) {
+ while (a-- >0) {
bp->f1 |= SELECT;
bp++;
}
@@ -6451,7 +6504,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
BLI_assert(nu != NULL);
- if(nu) { /* should always be set */
+ if (nu) { /* should always be set */
nu->flag |= CU_SMOOTH;
test2DNurb(nu);
@@ -6471,11 +6524,11 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
float loc[3], rot[3];
float mat[4][4];
- if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, &is_aligned))
+ if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, &is_aligned))
return OPERATOR_CANCELLED;
if (!isSurf) { /* adding curve */
- if(obedit==NULL || obedit->type!=OB_CURVE) {
+ if (obedit==NULL || obedit->type!=OB_CURVE) {
Curve *cu;
obedit= ED_object_add_type(C, OB_CURVE, loc, rot, TRUE, layer);
@@ -6484,13 +6537,13 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
cu= (Curve*)obedit->data;
cu->flag |= CU_DEFORM_FILL;
- if(type & CU_PRIM_PATH)
+ if (type & CU_PRIM_PATH)
cu->flag |= CU_PATH|CU_3D;
}
else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
}
else { /* adding surface */
- if(obedit==NULL || obedit->type!=OB_SURF) {
+ if (obedit==NULL || obedit->type!=OB_SURF) {
obedit= ED_object_add_type(C, OB_SURF, loc, rot, TRUE, layer);
newob = 1;
}
@@ -6498,9 +6551,9 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
}
/* rename here, the undo stack checks name for valid undo pushes */
- if(newob) {
+ if (newob) {
- if(obedit->type==OB_CURVE) {
+ if (obedit->type==OB_CURVE) {
rename_id((ID *)obedit, get_curve_defname(type));
rename_id((ID *)obedit->data, get_curve_defname(type));
}
@@ -6511,7 +6564,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
}
/* ED_object_add_type doesnt do an undo, is needed for redo operator on primitive */
- if(newob && enter_editmode)
+ if (newob && enter_editmode)
ED_undo_push(C, "Enter Editmode");
ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);
@@ -6550,17 +6603,17 @@ static int add_primitive_bezier_exec(bContext *C, wmOperator *op)
void CURVE_OT_primitive_bezier_curve_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Bezier";
- ot->description= "Construct a Bezier Curve";
- ot->idname= "CURVE_OT_primitive_bezier_curve_add";
+ ot->name = "Add Bezier";
+ ot->description = "Construct a Bezier Curve";
+ ot->idname = "CURVE_OT_primitive_bezier_curve_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_bezier_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_bezier_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -6573,17 +6626,17 @@ static int add_primitive_bezier_circle_exec(bContext *C, wmOperator *op)
void CURVE_OT_primitive_bezier_circle_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Bezier Circle";
- ot->description= "Construct a Bezier Circle";
- ot->idname= "CURVE_OT_primitive_bezier_circle_add";
+ ot->name = "Add Bezier Circle";
+ ot->description = "Construct a Bezier Circle";
+ ot->idname = "CURVE_OT_primitive_bezier_circle_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_bezier_circle_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_bezier_circle_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -6596,17 +6649,17 @@ static int add_primitive_nurbs_curve_exec(bContext *C, wmOperator *op)
void CURVE_OT_primitive_nurbs_curve_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Nurbs Curve";
- ot->description= "Construct a Nurbs Curve";
- ot->idname= "CURVE_OT_primitive_nurbs_curve_add";
+ ot->name = "Add Nurbs Curve";
+ ot->description = "Construct a Nurbs Curve";
+ ot->idname = "CURVE_OT_primitive_nurbs_curve_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_curve_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_nurbs_curve_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -6619,17 +6672,17 @@ static int add_primitive_nurbs_circle_exec(bContext *C, wmOperator *op)
void CURVE_OT_primitive_nurbs_circle_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Nurbs Circle";
- ot->description= "Construct a Nurbs Circle";
- ot->idname= "CURVE_OT_primitive_nurbs_circle_add";
+ ot->name = "Add Nurbs Circle";
+ ot->description = "Construct a Nurbs Circle";
+ ot->idname = "CURVE_OT_primitive_nurbs_circle_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_circle_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_nurbs_circle_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -6642,17 +6695,17 @@ static int add_primitive_curve_path_exec(bContext *C, wmOperator *op)
void CURVE_OT_primitive_nurbs_path_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Path";
- ot->description= "Construct a Path";
- ot->idname= "CURVE_OT_primitive_nurbs_path_add";
+ ot->name = "Add Path";
+ ot->description = "Construct a Path";
+ ot->idname = "CURVE_OT_primitive_nurbs_path_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_curve_path_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_curve_path_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -6666,17 +6719,17 @@ static int add_primitive_nurbs_surface_curve_exec(bContext *C, wmOperator *op)
void SURFACE_OT_primitive_nurbs_surface_curve_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Surface Curve";
- ot->description= "Construct a Nurbs surface Curve";
- ot->idname= "SURFACE_OT_primitive_nurbs_surface_curve_add";
+ ot->name = "Add Surface Curve";
+ ot->description = "Construct a Nurbs surface Curve";
+ ot->idname = "SURFACE_OT_primitive_nurbs_surface_curve_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_surface_curve_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_nurbs_surface_curve_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -6689,17 +6742,17 @@ static int add_primitive_nurbs_surface_circle_exec(bContext *C, wmOperator *op)
void SURFACE_OT_primitive_nurbs_surface_circle_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Surface Circle";
- ot->description= "Construct a Nurbs surface Circle";
- ot->idname= "SURFACE_OT_primitive_nurbs_surface_circle_add";
+ ot->name = "Add Surface Circle";
+ ot->description = "Construct a Nurbs surface Circle";
+ ot->idname = "SURFACE_OT_primitive_nurbs_surface_circle_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_surface_circle_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_nurbs_surface_circle_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -6712,17 +6765,17 @@ static int add_primitive_nurbs_surface_surface_exec(bContext *C, wmOperator *op)
void SURFACE_OT_primitive_nurbs_surface_surface_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Surface Patch";
- ot->description= "Construct a Nurbs surface Patch";
- ot->idname= "SURFACE_OT_primitive_nurbs_surface_surface_add";
+ ot->name = "Add Surface Patch";
+ ot->description = "Construct a Nurbs surface Patch";
+ ot->idname = "SURFACE_OT_primitive_nurbs_surface_surface_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_surface_surface_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_nurbs_surface_surface_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -6735,17 +6788,17 @@ static int add_primitive_nurbs_surface_cylinder_exec(bContext *C, wmOperator *op
void SURFACE_OT_primitive_nurbs_surface_cylinder_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Surface Cylinder";
- ot->description= "Construct a Nurbs surface Cylinder";
- ot->idname= "SURFACE_OT_primitive_nurbs_surface_cylinder_add";
+ ot->name = "Add Surface Cylinder";
+ ot->description = "Construct a Nurbs surface Cylinder";
+ ot->idname = "SURFACE_OT_primitive_nurbs_surface_cylinder_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_surface_cylinder_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_nurbs_surface_cylinder_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -6758,17 +6811,17 @@ static int add_primitive_nurbs_surface_sphere_exec(bContext *C, wmOperator *op)
void SURFACE_OT_primitive_nurbs_surface_sphere_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Surface Sphere";
- ot->description= "Construct a Nurbs surface Sphere";
- ot->idname= "SURFACE_OT_primitive_nurbs_surface_sphere_add";
+ ot->name = "Add Surface Sphere";
+ ot->description = "Construct a Nurbs surface Sphere";
+ ot->idname = "SURFACE_OT_primitive_nurbs_surface_sphere_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_surface_sphere_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_nurbs_surface_sphere_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -6781,17 +6834,17 @@ static int add_primitive_nurbs_surface_torus_exec(bContext *C, wmOperator *op)
void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Surface Torus";
- ot->description= "Construct a Nurbs surface Torus";
- ot->idname= "SURFACE_OT_primitive_nurbs_surface_torus_add";
+ ot->name = "Add Surface Torus";
+ ot->description = "Construct a Nurbs surface Torus";
+ ot->idname = "SURFACE_OT_primitive_nurbs_surface_torus_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_surface_torus_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_nurbs_surface_torus_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -6808,20 +6861,20 @@ static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
BPoint *bp;
int a;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if( nu->bezt ) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if ( nu->bezt ) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(BEZSELECTED_HIDDENHANDLES(cu, bezt)) bezt->alfa= 0.0;
+ while (a--) {
+ if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) bezt->alfa= 0.0;
bezt++;
}
}
- else if(nu->bp) {
+ else if (nu->bp) {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) bp->alfa= 0.0;
+ while (a--) {
+ if (bp->f1 & SELECT) bp->alfa= 0.0;
bp++;
}
}
@@ -6836,15 +6889,15 @@ static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
void CURVE_OT_tilt_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Tilt";
- ot->idname= "CURVE_OT_tilt_clear";
+ ot->name = "Clear Tilt";
+ ot->idname = "CURVE_OT_tilt_clear";
/* api callbacks */
- ot->exec= clear_tilt_exec;
- ot->poll= ED_operator_editcurve;
+ ot->exec = clear_tilt_exec;
+ ot->poll = ED_operator_editcurve;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/****************** undo for curves ****************/
@@ -6856,7 +6909,8 @@ static void *undo_check_lastsel(void *lastsel, Nurb *nu, Nurb *newnu)
if (lastbezt >= nu->bezt && lastbezt < nu->bezt + nu->pntsu) {
return newnu->bezt + (lastbezt - nu->bezt);
}
- } else {
+ }
+ else {
BPoint *lastbp= (BPoint*)lastsel;
if (lastbp >= nu->bp && lastbp < nu->bp + nu->pntsu*nu->pntsv) {
return newnu->bp + (lastbp - nu->bp);
@@ -6884,8 +6938,8 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *cu_v)
editnurb->keyindex= dupli_keyIndexHash(undoCurve->undoIndex);
}
- if(ad) {
- if(ad->action) {
+ if (ad) {
+ if (ad->action) {
free_fcurves(&ad->action->curves);
copy_fcurves(&ad->action->curves, &undoCurve->fcurves);
}
@@ -6895,7 +6949,7 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *cu_v)
}
/* copy */
- for(nu= undobase->first; nu; nu= nu->next) {
+ for (nu= undobase->first; nu; nu= nu->next) {
newnu= duplicateNurb(nu);
if (lastsel == NULL) {
@@ -6934,15 +6988,15 @@ static void *editCurve_to_undoCurve(void *UNUSED(edata), void *cu_v)
tmpEditnurb.keyindex= undoCurve->undoIndex;
}
- if(ad) {
- if(ad->action)
+ if (ad) {
+ if (ad->action)
copy_fcurves(&undoCurve->fcurves, &ad->action->curves);
copy_fcurves(&undoCurve->drivers, &ad->drivers);
}
/* copy */
- for(nu= nubase->first; nu; nu= nu->next) {
+ for (nu= nubase->first; nu; nu= nu->next) {
newnu= duplicateNurb(nu);
if (lastsel == NULL) {
@@ -6968,7 +7022,7 @@ static void free_undoCurve(void *ucv)
freeNurblist(&undoCurve->nubase);
- if(undoCurve->undoIndex)
+ if (undoCurve->undoIndex)
BLI_ghash_free(undoCurve->undoIndex, NULL, (GHashValFreeFP)MEM_freeN);
free_fcurves(&undoCurve->fcurves);
@@ -7005,10 +7059,10 @@ int ED_curve_actSelection(Curve *cu, float center[3])
{
Nurb *nu= get_lastsel_nurb(cu);
- if(!nu)
+ if (!nu)
return 0;
- if(nu->bezt) {
+ if (nu->bezt) {
BezTriple *bezt= cu->lastsel;
copy_v3_v3(center, bezt->vec[1]);
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index efde93b4ad7..1f1d1495276 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -82,130 +82,130 @@ static char findaccent(char char1, unsigned int code)
{
char new= 0;
- if(char1=='a') {
- if(code=='`') new= 224;
- else if(code==39) new= 225;
- else if(code=='^') new= 226;
- else if(code=='~') new= 227;
- else if(code=='"') new= 228;
- else if(code=='o') new= 229;
- else if(code=='e') new= 230;
- else if(code=='-') new= 170;
+ if (char1=='a') {
+ if (code=='`') new= 224;
+ else if (code==39) new= 225;
+ else if (code=='^') new= 226;
+ else if (code=='~') new= 227;
+ else if (code=='"') new= 228;
+ else if (code=='o') new= 229;
+ else if (code=='e') new= 230;
+ else if (code=='-') new= 170;
}
- else if(char1=='c') {
- if(code==',') new= 231;
- if(code=='|') new= 162;
+ else if (char1=='c') {
+ if (code==',') new= 231;
+ if (code=='|') new= 162;
}
- else if(char1=='e') {
- if(code=='`') new= 232;
- else if(code==39) new= 233;
- else if(code=='^') new= 234;
- else if(code=='"') new= 235;
+ else if (char1=='e') {
+ if (code=='`') new= 232;
+ else if (code==39) new= 233;
+ else if (code=='^') new= 234;
+ else if (code=='"') new= 235;
}
- else if(char1=='i') {
- if(code=='`') new= 236;
- else if(code==39) new= 237;
- else if(code=='^') new= 238;
- else if(code=='"') new= 239;
+ else if (char1=='i') {
+ if (code=='`') new= 236;
+ else if (code==39) new= 237;
+ else if (code=='^') new= 238;
+ else if (code=='"') new= 239;
}
- else if(char1=='n') {
- if(code=='~') new= 241;
+ else if (char1=='n') {
+ if (code=='~') new= 241;
}
- else if(char1=='o') {
- if(code=='`') new= 242;
- else if(code==39) new= 243;
- else if(code=='^') new= 244;
- else if(code=='~') new= 245;
- else if(code=='"') new= 246;
- else if(code=='/') new= 248;
- else if(code=='-') new= 186;
- else if(code=='e') new= 143;
+ else if (char1=='o') {
+ if (code=='`') new= 242;
+ else if (code==39) new= 243;
+ else if (code=='^') new= 244;
+ else if (code=='~') new= 245;
+ else if (code=='"') new= 246;
+ else if (code=='/') new= 248;
+ else if (code=='-') new= 186;
+ else if (code=='e') new= 143;
}
- else if(char1=='s') {
- if(code=='s') new= 167;
+ else if (char1=='s') {
+ if (code=='s') new= 167;
}
- else if(char1=='u') {
- if(code=='`') new= 249;
- else if(code==39) new= 250;
- else if(code=='^') new= 251;
- else if(code=='"') new= 252;
+ else if (char1=='u') {
+ if (code=='`') new= 249;
+ else if (code==39) new= 250;
+ else if (code=='^') new= 251;
+ else if (code=='"') new= 252;
}
- else if(char1=='y') {
- if(code==39) new= 253;
- else if(code=='"') new= 255;
+ else if (char1=='y') {
+ if (code==39) new= 253;
+ else if (code=='"') new= 255;
}
- else if(char1=='A') {
- if(code=='`') new= 192;
- else if(code==39) new= 193;
- else if(code=='^') new= 194;
- else if(code=='~') new= 195;
- else if(code=='"') new= 196;
- else if(code=='o') new= 197;
- else if(code=='e') new= 198;
+ else if (char1=='A') {
+ if (code=='`') new= 192;
+ else if (code==39) new= 193;
+ else if (code=='^') new= 194;
+ else if (code=='~') new= 195;
+ else if (code=='"') new= 196;
+ else if (code=='o') new= 197;
+ else if (code=='e') new= 198;
}
- else if(char1=='C') {
- if(code==',') new= 199;
+ else if (char1=='C') {
+ if (code==',') new= 199;
}
- else if(char1=='E') {
- if(code=='`') new= 200;
- else if(code==39) new= 201;
- else if(code=='^') new= 202;
- else if(code=='"') new= 203;
+ else if (char1=='E') {
+ if (code=='`') new= 200;
+ else if (code==39) new= 201;
+ else if (code=='^') new= 202;
+ else if (code=='"') new= 203;
}
- else if(char1=='I') {
- if(code=='`') new= 204;
- else if(code==39) new= 205;
- else if(code=='^') new= 206;
- else if(code=='"') new= 207;
+ else if (char1=='I') {
+ if (code=='`') new= 204;
+ else if (code==39) new= 205;
+ else if (code=='^') new= 206;
+ else if (code=='"') new= 207;
}
- else if(char1=='N') {
- if(code=='~') new= 209;
+ else if (char1=='N') {
+ if (code=='~') new= 209;
}
- else if(char1=='O') {
- if(code=='`') new= 210;
- else if(code==39) new= 211;
- else if(code=='^') new= 212;
- else if(code=='~') new= 213;
- else if(code=='"') new= 214;
- else if(code=='/') new= 216;
- else if(code=='e') new= 141;
+ else if (char1=='O') {
+ if (code=='`') new= 210;
+ else if (code==39) new= 211;
+ else if (code=='^') new= 212;
+ else if (code=='~') new= 213;
+ else if (code=='"') new= 214;
+ else if (code=='/') new= 216;
+ else if (code=='e') new= 141;
}
- else if(char1=='U') {
- if(code=='`') new= 217;
- else if(code==39) new= 218;
- else if(code=='^') new= 219;
- else if(code=='"') new= 220;
+ else if (char1=='U') {
+ if (code=='`') new= 217;
+ else if (code==39) new= 218;
+ else if (code=='^') new= 219;
+ else if (code=='"') new= 220;
}
- else if(char1=='Y') {
- if(code==39) new= 221;
+ else if (char1=='Y') {
+ if (code==39) new= 221;
}
- else if(char1=='1') {
- if(code=='4') new= 188;
- if(code=='2') new= 189;
+ else if (char1=='1') {
+ if (code=='4') new= 188;
+ if (code=='2') new= 189;
}
- else if(char1=='3') {
- if(code=='4') new= 190;
+ else if (char1=='3') {
+ if (code=='4') new= 190;
}
- else if(char1==':') {
- if(code=='-') new= 247;
+ else if (char1==':') {
+ if (code=='-') new= 247;
}
- else if(char1=='-') {
- if(code==':') new= 247;
- if(code=='|') new= 135;
- if(code=='+') new= 177;
+ else if (char1=='-') {
+ if (code==':') new= 247;
+ if (code=='|') new= 135;
+ if (code=='+') new= 177;
}
- else if(char1=='|') {
- if(code=='-') new= 135;
- if(code=='=') new= 136;
+ else if (char1=='|') {
+ if (code=='-') new= 135;
+ if (code=='=') new= 136;
}
- else if(char1=='=') {
- if(code=='|') new= 136;
+ else if (char1=='=') {
+ if (code=='|') new= 136;
}
- else if(char1=='+') {
- if(code=='-') new= 177;
+ else if (char1=='+') {
+ if (code=='-') new= 177;
}
- if(new) return new;
+ if (new) return new;
else return char1;
}
@@ -232,12 +232,12 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c)
{
Curve *cu= obedit->data;
- if(cu->len<MAXTEXT-1) {
+ if (cu->len<MAXTEXT-1) {
EditFont *ef= cu->editfont;
int x;
- for(x= cu->len; x>cu->pos; x--) ef->textbuf[x]= ef->textbuf[x-1];
- for(x= cu->len; x>cu->pos; x--) ef->textbufinfo[x]= ef->textbufinfo[x-1];
+ for (x= cu->len; x>cu->pos; x--) ef->textbuf[x]= ef->textbuf[x-1];
+ for (x= cu->len; x>cu->pos; x--) ef->textbufinfo[x]= ef->textbufinfo[x-1];
ef->textbuf[cu->pos]= c;
ef->textbufinfo[cu->pos] = cu->curinfo;
ef->textbufinfo[cu->pos].kern = 0;
@@ -262,7 +262,7 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re
EditFont *ef= cu->editfont;
cu->curinfo = ef->textbufinfo[cu->pos?cu->pos-1:0];
- if(obedit->totcol > 0) {
+ if (obedit->totcol > 0) {
obedit->actcol= ef->textbufinfo[cu->pos?cu->pos-1:0].mat_nr;
/* since this array is calloc'd, it can be 0 even though we try ensure
@@ -272,12 +272,12 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re
}
}
- if(mode == FO_EDIT)
+ if (mode == FO_EDIT)
update_string(cu);
BKE_text_to_curve(bmain, scene, obedit, mode);
- if(recalc)
+ if (recalc)
DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
}
@@ -291,22 +291,22 @@ static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op))
int i;
static const char *lastlorem;
- if(lastlorem)
+ if (lastlorem)
p= lastlorem;
else
p= ED_lorem;
i= rand()/(RAND_MAX/6)+4;
- for(p2=p; *p2 && i; p2++) {
+ for (p2=p; *p2 && i; p2++) {
insert_into_textbuf(obedit, *p2);
- if(*p2=='.')
+ if (*p2=='.')
i--;
}
lastlorem = p2+1;
- if(strlen(lastlorem)<5)
+ if (strlen(lastlorem)<5)
lastlorem = ED_lorem;
insert_into_textbuf(obedit, '\n');
@@ -321,16 +321,16 @@ static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op))
void FONT_OT_insert_lorem(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Insert Lorem";
- ot->description= "Insert placeholder text";
- ot->idname= "FONT_OT_insert_lorem";
+ ot->name = "Insert Lorem";
+ ot->description = "Insert placeholder text";
+ ot->idname = "FONT_OT_insert_lorem";
/* api callbacks */
- ot->exec= insert_lorem_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = insert_lorem_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/******************* paste file operator ********************/
@@ -348,10 +348,10 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename)
int filelen;
char *strp;
- fp= fopen(filename, "r");
+ fp= BLI_fopen(filename, "r");
- if(!fp) {
- if(reports)
+ if (!fp) {
+ if (reports)
BKE_reportf(reports, RPT_ERROR, "Failed to open file %s", filename);
return OPERATOR_CANCELLED;
}
@@ -368,7 +368,7 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename)
fclose(fp);
strp[filelen]= 0;
- if(cu->len+filelen<MAXTEXT) {
+ if (cu->len+filelen<MAXTEXT) {
int tmplen;
wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary");
tmplen = BLI_strncpy_wchar_from_utf8(mem, strp, filelen + 1);
@@ -398,7 +398,7 @@ static int paste_file_exec(bContext *C, wmOperator *op)
static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return paste_file_exec(C, op);
WM_event_add_fileselect(C, op);
@@ -409,17 +409,17 @@ static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
void FONT_OT_file_paste(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste File";
- ot->description= "Paste contents from file";
- ot->idname= "FONT_OT_file_paste";
+ ot->name = "Paste File";
+ ot->description = "Paste contents from file";
+ ot->idname = "FONT_OT_file_paste";
/* api callbacks */
- ot->exec= paste_file_exec;
- ot->invoke= paste_file_invoke;
- ot->poll= ED_operator_editfont;
+ ot->exec = paste_file_exec;
+ ot->invoke = paste_file_invoke;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -452,11 +452,11 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float
cu->vfont= get_builtin_font();
cu->vfont->id.us++;
- for(tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++)
+ for (tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++)
nchars += strlen(tmp->line) + 1;
- if(cu->str) MEM_freeN(cu->str);
- if(cu->strinfo) MEM_freeN(cu->strinfo);
+ if (cu->str) MEM_freeN(cu->str);
+ if (cu->strinfo) MEM_freeN(cu->strinfo);
cu->str= MEM_callocN(nchars+4, "str");
cu->strinfo= MEM_callocN((nchars+4)*sizeof(CharInfo), "strinfo");
@@ -465,11 +465,11 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float
cu->len= 0;
cu->pos= 0;
- for(tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++) {
+ for (tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++) {
strcat(cu->str, tmp->line);
cu->len+= strlen(tmp->line);
- if(tmp->next) {
+ if (tmp->next) {
strcat(cu->str, "\n");
cu->len++;
}
@@ -487,12 +487,12 @@ void ED_text_to_object(bContext *C, Text *text, int split_lines)
float offset[3];
int linenum= 0;
- if(!text || !text->lines.first) return;
+ if (!text || !text->lines.first) return;
- if(split_lines) {
- for(line=text->lines.first; line; line=line->next) {
+ if (split_lines) {
+ for (line=text->lines.first; line; line=line->next) {
/* skip lines with no text, but still make space for them */
- if(line->line[0] == '\0') {
+ if (line->line[0] == '\0') {
linenum++;
continue;
}
@@ -502,7 +502,7 @@ void ED_text_to_object(bContext *C, Text *text, int split_lines)
offset[1] = -linenum;
offset[2] = 0;
- if(rv3d)
+ if (rv3d)
mul_mat3_m4_v3(rv3d->viewinv, offset);
txt_add_object(C, line, 1, offset);
@@ -524,19 +524,19 @@ void ED_text_to_object(bContext *C, Text *text, int split_lines)
static short next_word(Curve *cu)
{
short s;
- for(s=cu->pos; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
+ 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);
+ if (cu->str[s]) return(s+1); else return(s);
}
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') &&
+ if (cu->pos==0) return(0);
+ for (s=cu->pos-2; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
(cu->str[s]!=1) && (cu->str[s]!='\r'); s--);
- if(cu->str[s]) return(s+1); else return(s);
+ if (cu->str[s]) return(s+1); else return(s);
}
static int kill_selection(Object *obedit, int ins) /* 1 == new character */
@@ -548,16 +548,16 @@ static int kill_selection(Object *obedit, int ins) /* 1 == new character */
int getfrom;
direction = BKE_font_getselection(obedit, &selstart, &selend);
- if(direction) {
+ if (direction) {
int size;
- if(ins) offset = 1;
- if(cu->pos >= selstart) cu->pos = selstart+offset;
- if((direction == -1) && ins) {
+ if (ins) offset = 1;
+ if (cu->pos >= selstart) cu->pos = selstart+offset;
+ if ((direction == -1) && ins) {
selstart++;
selend++;
}
getfrom = selend+offset;
- if(ins==0) getfrom++;
+ if (ins==0) getfrom++;
size = (cu->len * sizeof(wchar_t)) - (selstart * sizeof(wchar_t)) + (offset*sizeof(wchar_t));
memmove(ef->textbuf+selstart, ef->textbuf+getfrom, size);
memmove(ef->textbufinfo+selstart, ef->textbufinfo+getfrom, ((cu->len-selstart)+offset)*sizeof(CharInfo));
@@ -584,11 +584,11 @@ static int set_style(bContext *C, const int style, const int clear)
EditFont *ef= cu->editfont;
int i, selstart, selend;
- if(!BKE_font_getselection(obedit, &selstart, &selend))
+ if (!BKE_font_getselection(obedit, &selstart, &selend))
return OPERATOR_CANCELLED;
- for(i=selstart; i<=selend; i++) {
- if(clear)
+ for (i=selstart; i<=selend; i++) {
+ if (clear)
ef->textbufinfo[i].flag &= ~style;
else
ef->textbufinfo[i].flag |= style;
@@ -611,16 +611,16 @@ static int set_style_exec(bContext *C, wmOperator *op)
void FONT_OT_style_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Style";
- ot->description= "Set font style";
- ot->idname= "FONT_OT_style_set";
+ ot->name = "Set Style";
+ ot->description = "Set font style";
+ ot->idname = "FONT_OT_style_set";
/* api callbacks */
- ot->exec= set_style_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = set_style_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "style", style_items, CU_CHINFO_BOLD, "Style", "Style to set selection to");
@@ -635,7 +635,7 @@ static int toggle_style_exec(bContext *C, wmOperator *op)
Curve *cu= obedit->data;
int style, clear, selstart, selend;
- if(!BKE_font_getselection(obedit, &selstart, &selend))
+ if (!BKE_font_getselection(obedit, &selstart, &selend))
return OPERATOR_CANCELLED;
style= RNA_enum_get(op->ptr, "style");
@@ -649,16 +649,16 @@ static int toggle_style_exec(bContext *C, wmOperator *op)
void FONT_OT_style_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Style";
- ot->description= "Toggle font style";
- ot->idname= "FONT_OT_style_toggle";
+ ot->name = "Toggle Style";
+ ot->description = "Toggle font style";
+ ot->idname = "FONT_OT_style_toggle";
/* api callbacks */
- ot->exec= toggle_style_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = toggle_style_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "style", style_items, CU_CHINFO_BOLD, "Style", "Style to set selection to");
@@ -670,7 +670,7 @@ static void copy_selection(Object *obedit)
{
int selstart, selend;
- if(BKE_font_getselection(obedit, &selstart, &selend)) {
+ if (BKE_font_getselection(obedit, &selstart, &selend)) {
Curve *cu= obedit->data;
EditFont *ef= cu->editfont;
@@ -692,13 +692,13 @@ static int copy_text_exec(bContext *C, wmOperator *UNUSED(op))
void FONT_OT_text_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Text";
- ot->description= "Copy selected text to clipboard";
- ot->idname= "FONT_OT_text_copy";
+ ot->name = "Copy Text";
+ ot->description = "Copy selected text to clipboard";
+ ot->idname = "FONT_OT_text_copy";
/* api callbacks */
- ot->exec= copy_text_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = copy_text_exec;
+ ot->poll = ED_operator_editfont;
}
/******************* cut text operator ********************/
@@ -709,7 +709,7 @@ static int cut_text_exec(bContext *C, wmOperator *UNUSED(op))
Object *obedit= CTX_data_edit_object(C);
int selstart, selend;
- if(!BKE_font_getselection(obedit, &selstart, &selend))
+ if (!BKE_font_getselection(obedit, &selstart, &selend))
return OPERATOR_CANCELLED;
copy_selection(obedit);
@@ -723,16 +723,16 @@ static int cut_text_exec(bContext *C, wmOperator *UNUSED(op))
void FONT_OT_text_cut(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Cut Text";
- ot->description= "Cut selected text to clipboard";
- ot->idname= "FONT_OT_text_cut";
+ ot->name = "Cut Text";
+ ot->description = "Cut selected text to clipboard";
+ ot->idname = "FONT_OT_text_cut";
/* api callbacks */
- ot->exec= cut_text_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = cut_text_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/******************* paste text operator ********************/
@@ -744,8 +744,8 @@ static int paste_selection(Object *obedit, ReportList *reports)
int len= wcslen(ef->copybuf);
// Verify that the copy buffer => [copy buffer len] + cu->len < MAXTEXT
- if(cu->len + len <= MAXTEXT) {
- if(len) {
+ if (cu->len + len <= MAXTEXT) {
+ if (len) {
int size = (cu->len * sizeof(wchar_t)) - (cu->pos*sizeof(wchar_t)) + sizeof(wchar_t);
memmove(ef->textbuf+cu->pos+len, ef->textbuf+cu->pos, size);
memcpy(ef->textbuf+cu->pos, ef->copybuf, len * sizeof(wchar_t));
@@ -770,7 +770,7 @@ static int paste_text_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
- if(!paste_selection(obedit, op->reports))
+ if (!paste_selection(obedit, op->reports))
return OPERATOR_CANCELLED;
text_update_edited(C, scene, obedit, 1, FO_EDIT);
@@ -781,16 +781,16 @@ static int paste_text_exec(bContext *C, wmOperator *op)
void FONT_OT_text_paste(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste Text";
- ot->description= "Paste text from clipboard";
- ot->idname= "FONT_OT_text_paste";
+ ot->name = "Paste Text";
+ ot->description = "Paste text from clipboard";
+ ot->idname = "FONT_OT_text_paste";
/* api callbacks */
- ot->exec= paste_text_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = paste_text_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ move operator ************************/
@@ -818,77 +818,77 @@ static int move_cursor(bContext *C, int type, int select)
switch(type) {
case LINE_BEGIN:
- if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- while(cu->pos>0) {
- if(ef->textbuf[cu->pos-1]=='\n') break;
- if(ef->textbufinfo[cu->pos-1].flag & CU_CHINFO_WRAP) break;
+ if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ while (cu->pos>0) {
+ if (ef->textbuf[cu->pos-1]=='\n') break;
+ if (ef->textbufinfo[cu->pos-1].flag & CU_CHINFO_WRAP) break;
cu->pos--;
}
cursmove=FO_CURS;
break;
case LINE_END:
- if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- while(cu->pos<cu->len) {
- if(ef->textbuf[cu->pos]==0) break;
- if(ef->textbuf[cu->pos]=='\n') break;
- if(ef->textbufinfo[cu->pos].flag & CU_CHINFO_WRAP ) break;
+ if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ while (cu->pos<cu->len) {
+ if (ef->textbuf[cu->pos]==0) break;
+ if (ef->textbuf[cu->pos]=='\n') break;
+ if (ef->textbufinfo[cu->pos].flag & CU_CHINFO_WRAP ) break;
cu->pos++;
}
cursmove=FO_CURS;
break;
case PREV_WORD:
- if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
cu->pos= prev_word(cu);
cursmove= FO_CURS;
break;
case NEXT_WORD:
- if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
cu->pos= next_word(cu);
cursmove= FO_CURS;
break;
case PREV_CHAR:
- if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
cu->pos--;
cursmove=FO_CURS;
break;
case NEXT_CHAR:
- if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
cu->pos++;
cursmove= FO_CURS;
break;
case PREV_LINE:
- if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
cursmove=FO_CURSUP;
break;
case NEXT_LINE:
- if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
cursmove= FO_CURSDOWN;
break;
case PREV_PAGE:
- if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
cursmove=FO_PAGEUP;
break;
case NEXT_PAGE:
- if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
cursmove=FO_PAGEDOWN;
break;
}
- if(cursmove == -1)
+ if (cursmove == -1)
return OPERATOR_CANCELLED;
- if(select == 0) {
- if(cu->selstart) {
+ if (select == 0) {
+ if (cu->selstart) {
struct Main *bmain= CTX_data_main(C);
cu->selstart = cu->selend = 0;
update_string(cu);
@@ -896,13 +896,13 @@ static int move_cursor(bContext *C, int type, int select)
}
}
- if(cu->pos>cu->len) cu->pos= cu->len;
- else if(cu->pos>=MAXTEXT) cu->pos= MAXTEXT;
- else if(cu->pos<0) cu->pos= 0;
+ if (cu->pos>cu->len) cu->pos= cu->len;
+ else if (cu->pos>=MAXTEXT) cu->pos= MAXTEXT;
+ else if (cu->pos<0) cu->pos= 0;
text_update_edited(C, scene, obedit, select, cursmove);
- if(select)
+ if (select)
cu->selend = cu->pos;
return OPERATOR_FINISHED;
@@ -918,16 +918,16 @@ static int move_exec(bContext *C, wmOperator *op)
void FONT_OT_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Cursor";
- ot->description= "Move cursor to position type";
- ot->idname= "FONT_OT_move";
+ ot->name = "Move Cursor";
+ ot->description = "Move cursor to position type";
+ ot->idname = "FONT_OT_move";
/* api callbacks */
- ot->exec= move_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = move_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to");
@@ -945,16 +945,16 @@ static int move_select_exec(bContext *C, wmOperator *op)
void FONT_OT_move_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Select";
- ot->description= "Make selection from current cursor position to new cursor position type";
- ot->idname= "FONT_OT_move_select";
+ ot->name = "Move Select";
+ ot->description = "Make selection from current cursor position to new cursor position type";
+ ot->idname = "FONT_OT_move_select";
/* api callbacks */
- ot->exec= move_select_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = move_select_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to, to make a selection");
@@ -974,7 +974,7 @@ static int change_spacing_exec(bContext *C, wmOperator *op)
kern += delta;
CLAMP(kern, -20, 20);
- if(ef->textbufinfo[cu->pos-1].kern == kern)
+ if (ef->textbufinfo[cu->pos-1].kern == kern)
return OPERATOR_CANCELLED;
ef->textbufinfo[cu->pos-1].kern = kern;
@@ -987,16 +987,16 @@ static int change_spacing_exec(bContext *C, wmOperator *op)
void FONT_OT_change_spacing(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change Spacing";
- ot->description= "Change font spacing";
- ot->idname= "FONT_OT_change_spacing";
+ ot->name = "Change Spacing";
+ ot->description = "Change font spacing";
+ ot->idname = "FONT_OT_change_spacing";
/* api callbacks */
- ot->exec= change_spacing_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = change_spacing_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_int(ot->srna, "delta", 1, -20, 20, "Delta", "Amount to decrease or increase character spacing with", -20, 20);
@@ -1012,14 +1012,14 @@ static int change_character_exec(bContext *C, wmOperator *op)
EditFont *ef= cu->editfont;
int character, delta= RNA_int_get(op->ptr, "delta");
- if(cu->pos <= 0)
+ if (cu->pos <= 0)
return OPERATOR_CANCELLED;
character= ef->textbuf[cu->pos - 1];
character += delta;
CLAMP(character, 0, 255);
- if(character == ef->textbuf[cu->pos - 1])
+ if (character == ef->textbuf[cu->pos - 1])
return OPERATOR_CANCELLED;
ef->textbuf[cu->pos - 1]= character;
@@ -1032,16 +1032,16 @@ static int change_character_exec(bContext *C, wmOperator *op)
void FONT_OT_change_character(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change Character";
- ot->description= "Change font character code";
- ot->idname= "FONT_OT_change_character";
+ ot->name = "Change Character";
+ ot->description = "Change font character code";
+ ot->idname = "FONT_OT_change_character";
/* api callbacks */
- ot->exec= change_character_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = change_character_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_int(ot->srna, "delta", 1, -255, 255, "Delta", "Number to increase or decrease character code with", -255, 255);
@@ -1057,9 +1057,9 @@ static int line_break_exec(bContext *C, wmOperator *op)
EditFont *ef= cu->editfont;
const int ctrl= RNA_boolean_get(op->ptr, "ctrl");
- if(ctrl) {
+ if (ctrl) {
insert_into_textbuf(obedit, 1);
- if(ef->textbuf[cu->pos]!='\n')
+ if (ef->textbuf[cu->pos]!='\n')
insert_into_textbuf(obedit, '\n');
}
else
@@ -1075,16 +1075,16 @@ static int line_break_exec(bContext *C, wmOperator *op)
void FONT_OT_line_break(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Line Break";
- ot->description= "Insert line break at cursor position";
- ot->idname= "FONT_OT_line_break";
+ ot->name = "Line Break";
+ ot->description = "Insert line break at cursor position";
+ ot->idname = "FONT_OT_line_break";
/* api callbacks */
- ot->exec= line_break_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = line_break_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "ctrl", 0, "Ctrl", ""); // XXX what is this?
@@ -1109,16 +1109,16 @@ static int delete_exec(bContext *C, wmOperator *op)
EditFont *ef= cu->editfont;
int x, selstart, selend, type= RNA_enum_get(op->ptr, "type");
- if(cu->len == 0)
+ if (cu->len == 0)
return OPERATOR_CANCELLED;
- if(BKE_font_getselection(obedit, &selstart, &selend)) {
- if(type == DEL_NEXT_SEL) type= DEL_SELECTION;
- else if(type == DEL_PREV_SEL) type= DEL_SELECTION;
+ if (BKE_font_getselection(obedit, &selstart, &selend)) {
+ if (type == DEL_NEXT_SEL) type= DEL_SELECTION;
+ else if (type == DEL_PREV_SEL) type= DEL_SELECTION;
}
else {
- if(type == DEL_NEXT_SEL) type= DEL_NEXT_CHAR;
- else if(type == DEL_PREV_SEL) type= DEL_PREV_CHAR;
+ if (type == DEL_NEXT_SEL) type= DEL_NEXT_CHAR;
+ else if (type == DEL_PREV_SEL) type= DEL_PREV_CHAR;
}
switch(type) {
@@ -1127,28 +1127,28 @@ static int delete_exec(bContext *C, wmOperator *op)
ef->textbuf[0]= 0;
break;
case DEL_SELECTION:
- if(!kill_selection(obedit, 0))
+ if (!kill_selection(obedit, 0))
return OPERATOR_CANCELLED;
break;
case DEL_PREV_CHAR:
- if(cu->pos<=0)
+ if (cu->pos<=0)
return OPERATOR_CANCELLED;
- for(x=cu->pos;x<=cu->len;x++)
+ for (x=cu->pos;x<=cu->len;x++)
ef->textbuf[x-1]= ef->textbuf[x];
- for(x=cu->pos;x<=cu->len;x++)
+ for (x=cu->pos;x<=cu->len;x++)
ef->textbufinfo[x-1]= ef->textbufinfo[x];
cu->pos--;
ef->textbuf[--cu->len]='\0';
break;
case DEL_NEXT_CHAR:
- if(cu->pos>=cu->len)
+ if (cu->pos>=cu->len)
return OPERATOR_CANCELLED;
- for(x=cu->pos;x<cu->len;x++)
+ for (x=cu->pos;x<cu->len;x++)
ef->textbuf[x]= ef->textbuf[x+1];
- for(x=cu->pos;x<cu->len;x++)
+ for (x=cu->pos;x<cu->len;x++)
ef->textbufinfo[x]= ef->textbufinfo[x+1];
ef->textbuf[--cu->len]='\0';
@@ -1165,16 +1165,16 @@ static int delete_exec(bContext *C, wmOperator *op)
void FONT_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete";
- ot->description= "Delete text by cursor position";
- ot->idname= "FONT_OT_delete";
+ ot->name = "Delete";
+ ot->description = "Delete text by cursor position";
+ ot->idname = "FONT_OT_delete";
/* api callbacks */
- ot->exec= delete_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = delete_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "type", delete_type_items, DEL_ALL, "Type", "Which part of the text to delete");
@@ -1190,7 +1190,7 @@ static int insert_text_exec(bContext *C, wmOperator *op)
wchar_t *inserted_text;
int a, len;
- if(!RNA_struct_property_is_set(op->ptr, "text"))
+ if (!RNA_struct_property_is_set(op->ptr, "text"))
return OPERATOR_CANCELLED;
inserted_utf8= RNA_string_get_alloc(op->ptr, "text", NULL, 0);
@@ -1199,7 +1199,7 @@ static int insert_text_exec(bContext *C, wmOperator *op)
inserted_text= MEM_callocN(sizeof(wchar_t)*(len+1), "FONT_insert_text");
BLI_strncpy_wchar_from_utf8(inserted_text, inserted_utf8, len+1);
- for(a=0; a<len; a++)
+ for (a=0; a<len; a++)
insert_into_textbuf(obedit, inserted_text[a]);
MEM_freeN(inserted_text);
@@ -1223,28 +1223,28 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
int event= evt->type, val= evt->val;
wchar_t inserted_text[2]= {0};
- if(RNA_struct_property_is_set(op->ptr, "text"))
+ if (RNA_struct_property_is_set(op->ptr, "text"))
return insert_text_exec(C, op);
- if(RNA_struct_property_is_set(op->ptr, "accent")) {
- if(cu->len!=0 && cu->pos>0)
+ if (RNA_struct_property_is_set(op->ptr, "accent")) {
+ if (cu->len!=0 && cu->pos>0)
accentcode= 1;
return OPERATOR_FINISHED;
}
/* tab should exit editmode, but we allow it to be typed using modifier keys */
- if(event==TABKEY) {
- if((alt||ctrl||shift) == 0)
+ if (event==TABKEY) {
+ if ((alt||ctrl||shift) == 0)
return OPERATOR_PASS_THROUGH;
else
ascii= 9;
}
- else if(event==BACKSPACEKEY)
+ else if (event==BACKSPACEKEY)
ascii= 0;
- if(val && (ascii || evt->utf8_buf[0])) {
+ if (val && (ascii || evt->utf8_buf[0])) {
/* handle case like TAB (== 9) */
- if( (ascii > 31 && ascii < 254 && ascii != 127) ||
+ if ( (ascii > 31 && ascii < 254 && ascii != 127) ||
(ascii==13) ||
(ascii==10) ||
(ascii==8) ||
@@ -1257,34 +1257,34 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
insert_into_textbuf(obedit, ascii);
accentcode= 0;
}
- else if(accentcode) {
- if(cu->pos>0) {
+ else if (accentcode) {
+ if (cu->pos>0) {
inserted_text[0]= findaccent(ef->textbuf[cu->pos-1], ascii);
ef->textbuf[cu->pos-1]= inserted_text[0];
}
accentcode= 0;
}
- else if(cu->len<MAXTEXT-1) {
- if(alt) {
+ else if (cu->len<MAXTEXT-1) {
+ if (alt) {
/* might become obsolete, apple has default values for this, other OS's too? */
- if(ascii=='t') ascii= 137;
- else if(ascii=='c') ascii= 169;
- else if(ascii=='f') ascii= 164;
- else if(ascii=='g') ascii= 176;
- else if(ascii=='l') ascii= 163;
- else if(ascii=='r') ascii= 174;
- else if(ascii=='s') ascii= 223;
- else if(ascii=='y') ascii= 165;
- else if(ascii=='.') ascii= 138;
- else if(ascii=='1') ascii= 185;
- else if(ascii=='2') ascii= 178;
- else if(ascii=='3') ascii= 179;
- else if(ascii=='%') ascii= 139;
- else if(ascii=='?') ascii= 191;
- else if(ascii=='!') ascii= 161;
- else if(ascii=='x') ascii= 215;
- else if(ascii=='>') ascii= 187;
- else if(ascii=='<') ascii= 171;
+ if (ascii=='t') ascii= 137;
+ else if (ascii=='c') ascii= 169;
+ else if (ascii=='f') ascii= 164;
+ else if (ascii=='g') ascii= 176;
+ else if (ascii=='l') ascii= 163;
+ else if (ascii=='r') ascii= 174;
+ else if (ascii=='s') ascii= 223;
+ else if (ascii=='y') ascii= 165;
+ else if (ascii=='.') ascii= 138;
+ else if (ascii=='1') ascii= 185;
+ else if (ascii=='2') ascii= 178;
+ else if (ascii=='3') ascii= 179;
+ else if (ascii=='%') ascii= 139;
+ else if (ascii=='?') ascii= 191;
+ else if (ascii=='!') ascii= 161;
+ else if (ascii=='x') ascii= 215;
+ else if (ascii=='>') ascii= 187;
+ else if (ascii=='<') ascii= 171;
}
inserted_text[0]= ascii;
@@ -1300,8 +1300,8 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
text_update_edited(C, scene, obedit, 1, FO_EDIT);
}
}
- else if(val && event == BACKSPACEKEY) {
- if(alt && cu->len!=0 && cu->pos>0)
+ else if (val && event == BACKSPACEKEY) {
+ if (alt && cu->len!=0 && cu->pos>0)
accentcode= 1;
return OPERATOR_PASS_THROUGH;
@@ -1309,7 +1309,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
else
return OPERATOR_PASS_THROUGH;
- if(inserted_text[0]) {
+ if (inserted_text[0]) {
/* store as utf8 in RNA string */
char inserted_utf8[8] = {0};
@@ -1326,17 +1326,17 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
void FONT_OT_text_insert(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Insert Text";
- ot->description= "Insert text at cursor position";
- ot->idname= "FONT_OT_text_insert";
+ ot->name = "Insert Text";
+ ot->description = "Insert text at cursor position";
+ ot->idname = "FONT_OT_text_insert";
/* api callbacks */
- ot->exec= insert_text_exec;
- ot->invoke= insert_text_invoke;
- ot->poll= ED_operator_editfont;
+ ot->exec = insert_text_exec;
+ ot->invoke = insert_text_invoke;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
@@ -1365,16 +1365,16 @@ static int textbox_add_exec(bContext *C, wmOperator *UNUSED(op))
void FONT_OT_textbox_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Textbox";
- ot->description= "Add a new text box";
- ot->idname= "FONT_OT_textbox_add";
+ ot->name = "Add Textbox";
+ ot->description = "Add a new text box";
+ ot->idname = "FONT_OT_textbox_add";
/* api callbacks */
- ot->exec= textbox_add_exec;
- ot->poll= ED_operator_object_active_editable_font;
+ ot->exec = textbox_add_exec;
+ ot->poll = ED_operator_object_active_editable_font;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1408,16 +1408,16 @@ static int textbox_remove_exec(bContext *C, wmOperator *op)
void FONT_OT_textbox_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Textbox";
- ot->description= "Remove the textbox";
- ot->idname= "FONT_OT_textbox_remove";
+ ot->name = "Remove Textbox";
+ ot->description = "Remove the textbox";
+ ot->idname = "FONT_OT_textbox_remove";
/* api callbacks */
- ot->exec= textbox_remove_exec;
- ot->poll= ED_operator_object_active_editable_font;
+ ot->exec = textbox_remove_exec;
+ ot->poll = ED_operator_object_active_editable_font;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "The current text box", 0, INT_MAX);
}
@@ -1431,7 +1431,7 @@ void make_editText(Object *obedit)
Curve *cu= obedit->data;
EditFont *ef= cu->editfont;
- if(ef==NULL) {
+ if (ef==NULL) {
ef= cu->editfont= MEM_callocN(sizeof(EditFont), "editfont");
ef->textbuf= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "texteditbuf");
@@ -1451,9 +1451,9 @@ void make_editText(Object *obedit)
memcpy(ef->textbufinfo, cu->strinfo, (cu->len)*sizeof(CharInfo));
memcpy(ef->oldstrinfo, cu->strinfo, (cu->len)*sizeof(CharInfo));
- if(cu->pos>cu->len) cu->pos= cu->len;
+ if (cu->pos>cu->len) cu->pos= cu->len;
- if(cu->pos)
+ if (cu->pos)
cu->curinfo = ef->textbufinfo[cu->pos-1];
else
cu->curinfo = ef->textbufinfo[0];
@@ -1474,7 +1474,7 @@ void load_editText(Object *obedit)
update_string(cu);
- if(cu->strinfo)
+ if (cu->strinfo)
MEM_freeN(cu->strinfo);
cu->strinfo= MEM_callocN((cu->len+4)*sizeof(CharInfo), "texteditinfo");
memcpy(cu->strinfo, ef->textbufinfo, (cu->len)*sizeof(CharInfo));
@@ -1483,7 +1483,7 @@ void load_editText(Object *obedit)
/* this memory system is weak... */
- if(cu->selboxes) {
+ if (cu->selboxes) {
MEM_freeN(cu->selboxes);
cu->selboxes= NULL;
}
@@ -1512,18 +1512,18 @@ static int set_case(bContext *C, int ccase)
len= wcslen(ef->textbuf);
str= ef->textbuf;
- while(len) {
- if(*str>='a' && *str<='z')
+ while (len) {
+ if (*str>='a' && *str<='z')
*str-= 32;
len--;
str++;
}
- if(ccase == CASE_LOWER) {
+ if (ccase == CASE_LOWER) {
len= wcslen(ef->textbuf);
str= ef->textbuf;
- while(len) {
- if(*str>='A' && *str<='Z') {
+ while (len) {
+ if (*str>='A' && *str<='Z') {
*str+= 32;
}
len--;
@@ -1544,16 +1544,16 @@ static int set_case_exec(bContext *C, wmOperator *op)
void FONT_OT_case_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Case";
- ot->description= "Set font case";
- ot->idname= "FONT_OT_case_set";
+ ot->name = "Set Case";
+ ot->description = "Set font case";
+ ot->idname = "FONT_OT_case_set";
/* api callbacks */
- ot->exec= set_case_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = set_case_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "case", case_items, CASE_LOWER, "Case", "Lower or upper case");
@@ -1571,8 +1571,8 @@ static int toggle_case_exec(bContext *C, wmOperator *UNUSED(op))
len= wcslen(ef->textbuf);
str= ef->textbuf;
- while(len) {
- if(*str>='a' && *str<='z') {
+ while (len) {
+ if (*str>='a' && *str<='z') {
ccase= CASE_LOWER;
break;
}
@@ -1587,16 +1587,16 @@ static int toggle_case_exec(bContext *C, wmOperator *UNUSED(op))
void FONT_OT_case_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Case";
- ot->description= "Toggle font case";
- ot->idname= "FONT_OT_case_toggle";
+ ot->name = "Toggle Case";
+ ot->description = "Toggle font case";
+ ot->idname = "FONT_OT_case_toggle";
/* api callbacks */
- ot->exec= toggle_case_exec;
- ot->poll= ED_operator_editfont;
+ ot->exec = toggle_case_exec;
+ ot->poll = ED_operator_editfont;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* **************** Open Font ************** */
@@ -1627,18 +1627,18 @@ static int font_open_exec(bContext *C, wmOperator *op)
font= load_vfont(bmain, filepath);
- if(!font) {
- if(op->customdata) MEM_freeN(op->customdata);
+ if (!font) {
+ if (op->customdata) MEM_freeN(op->customdata);
return OPERATOR_CANCELLED;
}
- if(!op->customdata)
+ if (!op->customdata)
font_ui_template_init(C, op);
/* hook into UI */
pprop= op->customdata;
- if(pprop->prop) {
+ if (pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
font->id.us--;
@@ -1666,14 +1666,14 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
/* hook into UI */
pprop= op->customdata;
- if(pprop->prop) {
+ if (pprop->prop) {
idptr= RNA_property_pointer_get((PointerRNA *)pprop, pprop->prop);
font= idptr.id.data;
}
path = (font && strcmp(font->name, FO_BUILTIN_NAME) != 0)? font->name: U.fontdir;
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return font_open_exec(C, op);
RNA_string_set(op->ptr, "filepath", path);
@@ -1685,16 +1685,16 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
void FONT_OT_open(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Open Font";
- ot->idname= "FONT_OT_open";
+ ot->name = "Open Font";
+ ot->idname = "FONT_OT_open";
/* api callbacks */
- ot->exec= font_open_exec;
- ot->invoke= open_invoke;
- ot->cancel= font_open_cancel;
+ ot->exec = font_open_exec;
+ ot->invoke = open_invoke;
+ ot->cancel = font_open_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|FTFONTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -1711,7 +1711,7 @@ static int font_unlink_exec(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop.ptr, &pprop.prop);
- if(pprop.prop==NULL) {
+ if (pprop.prop==NULL) {
BKE_report(op->reports, RPT_ERROR, "Incorrect context for running font unlink");
return OPERATOR_CANCELLED;
}
@@ -1728,12 +1728,12 @@ static int font_unlink_exec(bContext *C, wmOperator *op)
void FONT_OT_unlink(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Unlink";
- ot->idname= "FONT_OT_unlink";
- ot->description= "Unlink active font data block";
+ ot->name = "Unlink";
+ ot->idname = "FONT_OT_unlink";
+ ot->description = "Unlink active font data block";
/* api callbacks */
- ot->exec= font_unlink_exec;
+ ot->exec = font_unlink_exec;
}
@@ -1783,7 +1783,7 @@ static void free_undoFont(void *strv)
static void *get_undoFont(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_FONT) {
+ if (obedit && obedit->type==OB_FONT) {
return obedit->data;
}
return NULL;
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index 946e1c66ad7..b27901c2667 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -74,6 +74,7 @@ if(WITH_BLENDER)
smooth.png.c
snake_hook.png.c
soften.png.c
+ claystrips.png.c
subtract.png.c
texdraw.png.c
thumb.png.c
diff --git a/source/blender/editors/datafiles/blender_icons.png.c b/source/blender/editors/datafiles/blender_icons.png.c
index d7582a118ca..85e469717de 100644
--- a/source/blender/editors/datafiles/blender_icons.png.c
+++ b/source/blender/editors/datafiles/blender_icons.png.c
@@ -1,6865 +1,7089 @@
/* DataToC output of file <blender_icons_png> */
-int datatoc_blender_icons_png_size= 219467;
+int datatoc_blender_icons_png_size= 226647;
char datatoc_blender_icons_png[]= {
-137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0,
- 13, 73, 72, 68, 82, 0, 0, 2, 90, 0, 0, 2,128, 8, 6, 0, 0, 0, 68,254,214,163, 0, 0, 10, 79,105, 67, 67, 80, 80,104,
-111,116,111,115,104,111,112, 32, 73, 67, 67, 32,112,114,111,102,105,108,101, 0, 0,120,218,157, 83,103, 84, 83,233, 22, 61,247,
-222,244, 66, 75,136,128,148, 75,111, 82, 21, 8, 32, 82, 66,139,128, 20,145, 38, 42, 33, 9, 16, 74,136, 33,161,217, 21, 81,193,
- 17, 69, 69, 4, 27,200,160,136, 3,142,142,128,140, 21, 81, 44, 12,138, 10,216, 7,228, 33,162,142,131,163,136,138,202,251,225,
-123,163,107,214,188,247,230,205,254,181,215, 62,231,172,243,157,179,207, 7,192, 8, 12,150, 72, 51, 81, 53,128, 12,169, 66, 30,
- 17,224,131,199,196,198,225,228, 46, 64,129, 10, 36,112, 0, 16, 8,179,100, 33,115,253, 35, 1, 0,248,126, 60, 60, 43, 34,192,
- 7,190, 0, 1,120,211, 11, 8, 0,192, 77,155,192, 48, 28,135,255, 15,234, 66,153, 92, 1,128,132, 1,192,116,145, 56, 75, 8,
-128, 20, 0, 64,122,142, 66,166, 0, 64, 70, 1,128,157,152, 38, 83, 0,160, 4, 0, 96,203, 99, 98,227, 0, 80, 45, 0, 96, 39,
-127,230,211, 0,128,157,248,153,123, 1, 0, 91,148, 33, 21, 1,160,145, 0, 32, 19,101,136, 68, 0,104, 59, 0,172,207, 86,138,
- 69, 0, 88, 48, 0, 20,102, 75,196, 57, 0,216, 45, 0, 48, 73, 87,102, 72, 0,176,183, 0,192,206, 16, 11,178, 0, 8, 12, 0,
- 48, 81,136,133, 41, 0, 4,123, 0, 96,200, 35, 35,120, 0,132,153, 0, 20, 70,242, 87, 60,241, 43,174, 16,231, 42, 0, 0,120,
-153,178, 60,185, 36, 57, 69,129, 91, 8, 45,113, 7, 87, 87, 46, 30, 40,206, 73, 23, 43, 20, 54, 97, 2, 97,154, 64, 46,194,121,
-153, 25, 50,129, 52, 15,224,243,204, 0, 0,160,145, 21, 17,224,131,243,253,120,206, 14,174,206,206, 54,142,182, 14, 95, 45,234,
-191, 6,255, 34, 98, 98,227,254,229,207,171,112, 64, 0, 0,225,116,126,209,254, 44, 47,179, 26,128, 59, 6,128,109,254,162, 37,
-238, 4,104, 94, 11,160,117,247,139,102,178, 15, 64,181, 0,160,233,218, 87,243,112,248,126, 60, 60, 69,161,144,185,217,217,229,
-228,228,216, 74,196, 66, 91, 97,202, 87,125,254,103,194, 95,192, 87,253,108,249,126, 60,252,247,245,224,190,226, 36,129, 50, 93,
-129, 71, 4,248,224,194,204,244, 76,165, 28,207,146, 9,132, 98,220,230,143, 71,252,183, 11,255,252, 29,211, 34,196, 73, 98,185,
- 88, 42, 20,227, 81, 18,113,142, 68,154,140,243, 50,165, 34,137, 66,146, 41,197, 37,210,255,100,226,223, 44,251, 3, 62,223, 53,
- 0,176,106, 62, 1,123,145, 45,168, 93, 99, 3,246, 75, 39, 16, 88,116,192,226,247, 0, 0,242,187,111,193,212, 40, 8, 3,128,
-104,131,225,207,119,255,239, 63,253, 71,160, 37, 0,128,102, 73,146,113, 0, 0, 94, 68, 36, 46, 84,202,179, 63,199, 8, 0, 0,
- 68,160,129, 42,176, 65, 27,244,193, 24, 44,192, 6, 28,193, 5,220,193, 11,252, 96, 54,132, 66, 36,196,194, 66, 16, 66, 10,100,
-128, 28,114, 96, 41,172,130, 66, 40,134,205,176, 29, 42, 96, 47,212, 64, 29, 52,192, 81,104,134,147,112, 14, 46,194, 85,184, 14,
- 61,112, 15,250, 97, 8,158,193, 40,188,129, 9, 4, 65,200, 8, 19, 97, 33,218,136, 1, 98,138, 88, 35,142, 8, 23,153,133,248,
- 33,193, 72, 4, 18,139, 36, 32,201,136, 20, 81, 34, 75,145, 53, 72, 49, 82,138, 84, 32, 85, 72, 29,242, 61,114, 2, 57,135, 92,
- 70,186,145, 59,200, 0, 50,130,252,134,188, 71, 49,148,129,178, 81, 61,212, 12,181, 67,185,168, 55, 26,132, 70,162, 11,208,100,
-116, 49,154,143, 22,160,155,208,114,180, 26, 61,140, 54,161,231,208,171,104, 15,218,143, 62, 67,199, 48,192,232, 24, 7, 51,196,
-108, 48, 46,198,195, 66,177, 56, 44, 9,147, 99,203,177, 34,172, 12,171,198, 26,176, 86,172, 3,187,137,245, 99,207,177,119, 4,
- 18,129, 69,192, 9, 54, 4,119, 66, 32, 97, 30, 65, 72, 88, 76, 88, 78,216, 72,168, 32, 28, 36, 52, 17,218, 9, 55, 9, 3,132,
- 81,194, 39, 34,147,168, 75,180, 38,186, 17,249,196, 24, 98, 50, 49,135, 88, 72, 44, 35,214, 18,143, 19, 47, 16,123,136, 67,196,
- 55, 36, 18,137, 67, 50, 39,185,144, 2, 73,177,164, 84,210, 18,210, 70,210,110, 82, 35,233, 44,169,155, 52, 72, 26, 35,147,201,
-218,100,107,178, 7, 57,148, 44, 32, 43,200,133,228,157,228,195,228, 51,228, 27,228, 33,242, 91, 10,157, 98, 64,113,164,248, 83,
-226, 40, 82,202,106, 74, 25,229, 16,229, 52,229, 6,101,152, 50, 65, 85,163,154, 82,221,168,161, 84, 17, 53,143, 90, 66,173,161,
-182, 82,175, 81,135,168, 19, 52,117,154, 57,205,131, 22, 73, 75,165,173,162,149,211, 26,104, 23,104,247,105,175,232,116,186, 17,
-221,149, 30, 78,151,208, 87,210,203,233, 71,232,151,232, 3,244,119, 12, 13,134, 21,131,199,136,103, 40, 25,155, 24, 7, 24,103,
- 25,119, 24,175,152, 76,166, 25,211,139, 25,199, 84, 48, 55, 49,235,152,231,153, 15,153,111, 85, 88, 42,182, 42,124, 21,145,202,
- 10,149, 74,149, 38,149, 27, 42, 47, 84,169,170,166,170,222,170, 11, 85,243, 85,203, 84,143,169, 94, 83,125,174, 70, 85, 51, 83,
-227,169, 9,212,150,171, 85,170,157, 80,235, 83, 27, 83,103,169, 59,168,135,170,103,168,111, 84, 63,164,126, 89,253,137, 6, 89,
-195, 76,195, 79, 67,164, 81,160,177, 95,227,188,198, 32, 11, 99, 25,179,120, 44, 33,107, 13,171,134,117,129, 53,196, 38,177,205,
-217,124,118, 42,187,152,253, 29,187,139, 61,170,169,161, 57, 67, 51, 74, 51, 87,179, 82,243,148,102, 63, 7,227,152,113,248,156,
-116, 78, 9,231, 40,167,151,243,126,138,222, 20,239, 41,226, 41, 27,166, 52, 76,185, 49,101, 92,107,170,150,151,150, 88,171, 72,
-171, 81,171, 71,235,189, 54,174,237,167,157,166,189, 69,187, 89,251,129, 14, 65,199, 74, 39, 92, 39, 71,103,143,206, 5,157,231,
- 83,217, 83,221,167, 10,167, 22, 77, 61, 58,245,174, 46,170,107,165, 27,161,187, 68,119,191,110,167,238,152,158,190, 94,128,158,
- 76,111,167,222,121,189,231,250, 28,125, 47,253, 84,253,109,250,167,245, 71, 12, 88, 6,179, 12, 36, 6,219, 12,206, 24, 60,197,
- 53,113,111, 60, 29, 47,199,219,241, 81, 67, 93,195, 64, 67,165, 97,149, 97,151,225,132,145,185,209, 60,163,213, 70,141, 70, 15,
-140,105,198, 92,227, 36,227,109,198,109,198,163, 38, 6, 38, 33, 38, 75, 77,234, 77,238,154, 82, 77,185,166, 41,166, 59, 76, 59,
- 76,199,205,204,205,162,205,214,153, 53,155, 61, 49,215, 50,231,155,231,155,215,155,223,183, 96, 90,120, 90, 44,182,168,182,184,
-101, 73,178,228, 90,166, 89,238,182,188,110,133, 90, 57, 89,165, 88, 85, 90, 93,179, 70,173,157,173, 37,214,187,173,187,167, 17,
-167,185, 78,147, 78,171,158,214,103,195,176,241,182,201,182,169,183, 25,176,229,216, 6,219,174,182,109,182,125, 97,103, 98, 23,
-103,183,197,174,195,238,147,189,147,125,186,125,141,253, 61, 7, 13,135,217, 14,171, 29, 90, 29,126,115,180,114, 20, 58, 86, 58,
-222,154,206,156,238, 63,125,197,244,150,233, 47,103, 88,207, 16,207,216, 51,227,182, 19,203, 41,196,105,157, 83,155,211, 71,103,
- 23,103,185,115,131,243,136,139,137, 75,130,203, 46,151, 62, 46,155, 27,198,221,200,189,228, 74,116,245,113, 93,225,122,210,245,
-157,155,179,155,194,237,168,219,175,238, 54,238,105,238,135,220,159,204, 52,159, 41,158, 89, 51,115,208,195,200, 67,224, 81,229,
-209, 63, 11,159,149, 48,107,223,172,126, 79, 67, 79,129,103,181,231, 35, 47, 99, 47,145, 87,173,215,176,183,165,119,170,247, 97,
-239, 23, 62,246, 62,114,159,227, 62,227, 60, 55,222, 50,222, 89, 95,204, 55,192,183,200,183,203, 79,195,111,158, 95,133,223, 67,
-127, 35,255,100,255,122,255,209, 0,167,128, 37, 1,103, 3,137,129, 65,129, 91, 2,251,248,122,124, 33,191,142, 63, 58,219,101,
-246,178,217,237, 65,140,160,185, 65, 21, 65,143,130,173,130,229,193,173, 33,104,200,236,144,173, 33,247,231,152,206,145,206,105,
- 14,133, 80,126,232,214,208, 7, 97,230, 97,139,195,126, 12, 39,133,135,133, 87,134, 63,142,112,136, 88, 26,209, 49,151, 53,119,
-209,220, 67,115,223, 68,250, 68,150, 68,222,155,103, 49, 79, 57,175, 45, 74, 53, 42, 62,170, 46,106, 60,218, 55,186, 52,186, 63,
-198, 46,102, 89,204,213, 88,157, 88, 73,108, 75, 28, 57, 46, 42,174, 54,110,108,190,223,252,237,243,135,226,157,226, 11,227,123,
- 23,152, 47,200, 93,112,121,161,206,194,244,133,167, 22,169, 46, 18, 44, 58,150, 64, 76,136, 78, 56,148,240, 65, 16, 42,168, 22,
-140, 37,242, 19,119, 37,142, 10,121,194, 29,194,103, 34, 47,209, 54,209,136,216, 67, 92, 42, 30, 78,242, 72, 42, 77,122,146,236,
-145,188, 53,121, 36,197, 51,165, 44,229,185,132, 39,169,144,188, 76, 13, 76,221,155, 58,158, 22,154,118, 32,109, 50, 61, 58,189,
- 49,131,146,145,144,113, 66,170, 33, 77,147,182,103,234,103,230,102,118,203,172,101,133,178,254,197,110,139,183, 47, 30,149, 7,
-201,107,179,144,172, 5, 89, 45, 10,182, 66,166,232, 84, 90, 40,215, 42, 7,178,103,101, 87,102,191,205,137,202, 57,150,171,158,
- 43,205,237,204,179,202,219,144, 55,156,239,159,255,237, 18,194, 18,225,146,182,165,134, 75, 87, 45, 29, 88,230,189,172,106, 57,
-178, 60,113,121,219, 10,227, 21, 5, 43,134, 86, 6,172, 60,184,138,182, 42,109,213, 79,171,237, 87,151,174,126,189, 38,122, 77,
-107,129, 94,193,202,130,193,181, 1,107,235, 11, 85, 10,229,133,125,235,220,215,237, 93, 79, 88, 47, 89,223,181, 97,250,134,157,
- 27, 62, 21,137,138,174, 20,219, 23,151, 21,127,216, 40,220,120,229, 27,135,111,202,191,153,220,148,180,169,171,196,185,100,207,
-102,210,102,233,230,222, 45,158, 91, 14,150,170,151,230,151, 14,110, 13,217,218,180, 13,223, 86,180,237,245,246, 69,219, 47,151,
-205, 40,219,187,131,182, 67,185,163,191, 60,184,188,101,167,201,206,205, 59, 63, 84,164, 84,244, 84,250, 84, 54,238,210,221,181,
- 97,215,248,110,209,238, 27,123,188,246, 52,236,213,219, 91,188,247,253, 62,201,190,219, 85, 1, 85, 77,213,102,213,101,251, 73,
-251,179,247, 63,174,137,170,233,248,150,251,109, 93,173, 78,109,113,237,199, 3,210, 3,253, 7, 35, 14,182,215,185,212,213, 29,
-210, 61, 84, 82,143,214, 43,235, 71, 14,199, 31,190,254,157,239,119, 45, 13, 54, 13, 85,141,156,198,226, 35,112, 68,121,228,233,
-247, 9,223,247, 30, 13, 58,218,118,140,123,172,225, 7,211, 31,118, 29,103, 29, 47,106, 66,154,242,154, 70,155, 83,154,251, 91,
- 98, 91,186, 79,204, 62,209,214,234,222,122,252, 71,219, 31, 15,156, 52, 60, 89,121, 74,243, 84,201,105,218,233,130,211,147,103,
-242,207,140,157,149,157,125,126, 46,249,220, 96,219,162,182,123,231, 99,206,223,106, 15,111,239,186, 16,116,225,210, 69,255,139,
-231, 59,188, 59,206, 92,242,184,116,242,178,219,229, 19, 87,184, 87,154,175, 58, 95,109,234,116,234, 60,254,147,211, 79,199,187,
-156,187,154,174,185, 92,107,185,238,122,189,181,123,102,247,233, 27,158, 55,206,221,244,189,121,241, 22,255,214,213,158, 57, 61,
-221,189,243,122,111,247,197,247,245,223, 22,221,126,114, 39,253,206,203,187,217,119, 39,238,173,188, 79,188, 95,244, 64,237, 65,
-217, 67,221,135,213, 63, 91,254,220,216,239,220,127,106,192,119,160,243,209,220, 71,247, 6,133,131,207,254,145,245,143, 15, 67,
- 5,143,153,143,203,134, 13,134,235,158, 56, 62, 57, 57,226, 63,114,253,233,252,167, 67,207,100,207, 38,158, 23,254,162,254,203,
-174, 23, 22, 47,126,248,213,235,215,206,209,152,209,161,151,242,151,147,191,109,124,165,253,234,192,235, 25,175,219,198,194,198,
- 30,190,201,120, 51, 49, 94,244, 86,251,237,193,119,220,119, 29,239,163,223, 15, 79,228,124, 32,127, 40,255,104,249,177,245, 83,
-208,167,251,147, 25,147,147,255, 4, 3,152,243,252, 99, 51, 45,219, 0, 0, 0, 6, 98, 75, 71, 68, 0,255, 0,255, 0,255,160,
-189,167,147, 0, 0, 0, 9,112, 72, 89,115, 0, 0, 13,213, 0, 0, 13,213, 1, 61,214, 88,241, 0, 0, 0, 7,116, 73, 77, 69,
- 7,220, 2, 12, 19, 45, 40,146,193,117, 16, 0, 0, 32, 0, 73, 68, 65, 84,120,218,236, 93,119,120, 20,213,226, 61, 51, 59,179,
-187,217,146, 77, 35, 61,144, 66, 9, 96, 0, 67, 81,130, 84, 65, 80,140,138, 10, 86,132,167,207,103,197,134, 5, 84, 68, 68, 32,
- 54, 64,240, 39,242,208,167,128,160,128, 5, 4,164, 68, 74,232, 29,233, 9,144, 4, 18, 66, 58,201, 38,219,203,220,223, 31,217,
- 89, 55,203,182, 64, 98,129,123,190,111,190,221,157,157, 57,115,239,157,123,239,156, 57,183, 1, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,215, 52, 86,175, 94, 77,154,112,248,144, 64, 57, 29,219,128,191, 59,103, 11,198,157, 52,
- 35,231, 0, 7,231,187,255,144,112, 14,248,187,114,138,241,109, 2,239,144,166,228,163,230, 74, 79,151,112,146,230, 14,103, 75,
-113, 54, 87, 57,242, 16, 78,210, 2,247,253,221,127, 72, 56, 7,252,221, 56,221,243, 79,128,188, 77,226, 12, 48, 79, 53, 53,156,
-164,185,195,217, 82,156, 87, 91,142,124,132,147, 92,109, 94,242,114,239,223,197,117, 4,174, 5, 69, 86,192,200,204,204,100, 92,
-248,153,191, 43,167,107, 58,136,252,205, 25,214,102,196,150,230,230,116, 75,207,230,194,187,153,153,153,204,234,213,171,183, 2,
- 24,208,156,113,111,142,251,238, 22,215,102,225,189, 2,145,213, 36,206,230,202,247, 45,205,217, 92,101,201,157,179, 57,242,189,
-167,251,222,130,247,168,185,194,217, 44,101,169, 37,242,188,135,252,115,213,188,238,156,205, 81,150,220, 57,155, 35,223,255, 25,
-156,205, 81,150, 60,113, 54, 71,190,247,118,239,175, 55,131,138,253,139, 5,129,123, 1, 31,248,119, 22, 68, 45, 37, 54,155,224,
-192,252,229,156,205,124,143,222,117,112, 54,231,219,205,192,230,186, 71, 45,145,223, 93, 57,155,139,223,157,167, 57,238,147, 39,
-206,171, 13,175,151,112, 54,123,220,175, 54,223,255, 89,156,205,124,143,154,165, 44,185,113, 14,108,230,151,129,129, 46,191,223,
-109, 78,206,230, 42, 75, 30,194,121,213,247,201, 19,231,213,134,215, 75, 56,155, 61,238,205,241, 12,105, 41,222,107, 26, 45,213,
-124,214,220,156, 77,228,190,166, 56,155,216, 60, 51,164, 5,238,253, 95, 26,206,230,228,116, 15, 99,115, 54,247,180,100, 56,155,
-147,179, 9, 97,189,230, 56,255,105,247,253,239,152,158,222,248,174,166, 89,202,155, 59,218, 18,225,108, 78,206, 0,185,175, 9,
-206,171,184,247,215, 28,184,191, 75, 64,196,132,111,230, 55, 19, 52,179, 3,211,146,194,181, 57,195, 57,176, 37, 28,194, 22, 64,
-179,135,211,241,166, 60,185, 5,226,254, 79, 73, 83, 90,150,104, 89,250,219,149, 37,183, 60, 57,176, 25,157,162,102,117,158,221,
- 57,155,227, 26,174, 28,205,149, 71, 91, 58,238,205, 89,150, 90,226,222, 83, 92,133, 11, 65, 57, 41, 39,229,164,156,148,147,114,
- 82,206,235,150,243,154, 4, 75,147,128,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,226, 31, 5,175,237,187,
-113,113,113,171,149, 74,101, 59,111,255,235,116,186,139, 23, 47, 94, 28, 68,147,240,175, 3,189, 71, 20,255, 32,176,248,195, 65,
- 23, 0, 16,199, 70, 65, 65, 65,113, 77,195,107,103,120,185, 92,158,114,242,228,201, 14,130, 32,192,110,183,195,102,179, 57, 63,
-205,102, 51,250,247,239,223,228,142,244,209,209,209, 57, 18,137, 36,169, 41,231,216,237,246,243,101,101,101,125,125, 28,178, 19,
- 64, 10,195,252,161, 25,197,239,222, 62, 1,148, 88,173,214,238,190, 56, 25,134, 73,113,231,243,194, 37,126,247,201, 25, 18, 18,
-178,159,227,184, 4, 79, 92,222,190, 11,130,144, 95, 81, 81,209,231,207,188, 71,215, 51,162,163,163,115, 56,142,107,114,254, 44,
- 45, 45,245,154, 63, 99, 99, 99, 15,177, 44, 27,215, 4, 74,137, 32, 8,185, 23, 47, 94,236,235, 67,136,236, 4,144,226,243, 13,
-202, 45, 63, 49, 12, 83,108,183,219,123,250, 43, 71,190,184, 60,228, 81,127,156, 78,145,197,113, 92, 86, 84, 84,212, 51,122,189,
-222, 8,128, 72, 36, 18,226, 18, 54, 0,128,205,102,171,168,169,169,233, 66,115, 34, 5, 5,197,117, 33,180, 4, 65, 96, 77, 38,
- 19,242,242,242, 64,136,199,250,222,126, 5,215,235,112,224,183,141, 81,193, 81,209,176, 89, 44, 80,181,138,116,114,151,157, 56,
- 6,155,213, 2,155,217,140, 54,189,122,139, 97, 64,231,206,157, 37,126, 56, 19, 62,248,224,131,168,224,224, 96, 24,141, 70, 24,
-141, 70,152, 76, 38, 24,141, 70,152,205,102,152,205,102, 88, 44, 22, 88, 44, 22,216,108, 54,152, 76, 38,100,103,103,219,173, 86,
-171, 79,206,105,211,166, 69,105, 52, 26, 39,159,184,137,156, 34,175,213,106,133,209,104,196,166, 77,155,124,114,114, 28,151, 80,
- 82, 82, 18, 37,149, 74, 65, 8,129, 32, 8, 32,132, 52,218,220,209,182,109, 91,139,175, 64,182,208, 61,186,158,209, 97,218,210,
- 53, 81, 33, 10, 57,108,130,128,204,110,109,157,127,228,127,185, 28,196,102,135, 96,179,161,253,243,163,157,251, 59,117,234,228,
- 51,127, 18, 66, 18,167, 45, 93, 19, 26, 40,103, 85, 85,149,161, 99,199,142, 37,104,112,155,189, 9,173, 4,131,193, 16,229,224,
-191, 76, 16,177, 44,219,104, 91,191,126, 61, 50, 51, 51,253,197, 61,225,229,151, 95,142,178, 90,173, 48,155,205, 48,153, 76,176,
- 90,173,176,217,108,206,205,110,183, 59, 55,179,217,140, 61,123,246, 4,234,100,125,112,219,109,183, 61,190,102,205, 26,213,207,
- 63,255,172, 74, 74, 74,130, 84, 42,133, 68, 34,129, 68, 34, 1,203,178,224, 56, 14, 55,223,124, 51, 67,179, 32, 5, 5,197,117,
- 35,180, 76, 38, 83, 65,122,122, 58,113,124,143,151,203,229, 82,183,183,220,184,246,237,219,231,186,159,231,175,185, 42, 56, 42,
- 26, 19, 91,135, 3, 0,222, 57, 87,229,124, 64,124,216,231, 70,231, 49,239, 93,168, 5, 0, 40, 20, 10, 48,174,175,209, 94,160,
- 82,169,112,219,109,183, 65, 38,147,161,103,207,158,224,121,222,227, 38,149, 74,193,243,188,223, 68, 97, 24, 6,106,181, 26, 83,
-166, 76, 17, 69, 18, 84, 65,114,140,235,211, 19, 65, 32,248,239,177,211, 48, 11, 4, 28,199, 57,183, 64, 56,165, 82, 41,142, 30,
- 61, 10,142,227, 32,145, 72,156,159,226,247, 85,171, 86, 97,228,200,145,224, 56, 14, 10,133, 2,240, 51,115,176,235, 61, 50,155,
-205,177, 50,153,204, 2, 64, 20,103, 82,134, 97, 98,174,228, 30, 93,207, 8, 81,200, 49,102,222, 79, 0,128,162, 89,207, 59,239,
-221,158,103,223,113, 30,147,248,159, 7,192, 48, 12,120,158, 7,203,178,205,198, 89, 93, 93,109,120,232,161,135,182, 7, 7, 7,
-175,215,106,181,240, 35,224, 80, 84, 84, 4,142,227,188,230,119,150,101, 49,115,230, 76,156, 57,115, 38,160,184, 27,141, 70, 44,
- 88,176, 0,118,187,189, 17,175,248,221,125, 95,128, 34,235,253,161, 67,135,142, 94,179,102, 77, 24,195, 48,248,236,179,207, 32,
-149, 74, 49,124,248,112, 68, 68, 68, 96,195,134, 13,144, 74,165,120,253,245,215,105,230,163,160,160,240, 85,231,241, 0,110, 4,
- 16,233, 48, 17,234, 0,132,186, 28, 82,225,248,140, 20,127, 51, 12,179,207, 3, 79, 47,199, 49, 21, 12,195,236,115,249,109, 6,
- 32,243,176,191, 10,128,194,177,153,208,224,254,167,185, 92, 71, 60, 15,222,174,203, 1, 13,235, 15, 1,216, 2, 96, 96,102,102,
-230, 86, 0, 40, 45, 45,189,163,180,180, 20, 0,144,146,146,114, 50, 55, 55,183,163,168,121, 28,205, 83, 82,155,205,214, 65,108,
-170, 18,221,162, 33, 67,134,248,124,195,183, 89, 44,151, 9, 16, 79, 90,202, 83,115,133, 55, 1, 99,177, 88,240,192, 3, 15, 0,
-128,215,135,142,235, 22,128,118,131,217,108, 6,199,113, 72,109, 29,137, 73,195,210,113, 19,177, 66, 87,207,192, 86,171,195, 61,
-106, 43, 78,118,238,142,249,231, 43,112, 78, 91, 15,142,227, 2,226, 20, 4,193,171,200,146, 72, 36,152, 55,111, 30, 30,122,232,
- 33, 72, 36,146,128,248, 92,239, 81,114,114,242,154,220,220,220, 8,134, 97, 76,142,123, 36,183,217,108, 26,155,205, 22, 97,183,
-219, 35,154,114,143,174,103,216, 4,193, 99, 62,244,150,103, 3,185, 79,129,112, 86, 87, 87, 27, 50, 51, 51,119,203,229,242,133,
-209,209,209, 37,197,197,197,126,133,150,187,248,113,127,169,248,228,147, 79, 48,103,206, 28, 12, 26, 52, 40,160,112,154, 76, 38,
- 48, 12,131,249,243,231, 95,246,223,212,169, 83, 47,187,158, 31, 78, 6, 0, 27, 23, 23,247,236,186,117,235, 52,226,177,173, 90,
-181, 2,207,243,232,210,165, 11,130,131,131,177,125,251,118,216,237,246,128,203, 37, 5, 5,197,181, 11, 79, 90,196, 5,253, 39,
- 78,156,216, 51, 43, 43,107,122, 70, 70,198,119, 59,119,238, 92,202, 48,204,106,151, 58, 49,211, 81,191,174, 22,127, 19, 66,122,
-185,138, 30,135, 88,139,100, 24,102,181,120,188,235,111,241,147, 16, 50, 4,128, 76,252, 61,113,226,196,180,172,172,172,233, 19,
- 38, 76,120,115,198,140, 25,210,137, 19, 39,118,205,202,202,154, 46, 94,199, 83, 56, 60, 57, 90, 62,215,158, 18,155,168, 78,157,
- 58,229,173,137,202,245, 1,224,179,182, 84,181,138,116, 58, 89,239, 37, 70, 56,247, 79, 41,174,113, 62,192,230,246,104, 7,149,
- 74,133, 97,239,125, 20,144, 83,100, 54,155, 81, 94, 94,238,116, 25,252,109,129,114, 42, 21, 65,200,126,185, 11,138,170,100,120,
-119, 87, 53,214, 28, 62, 3,158,231,113,123,231, 46,184, 67, 26,140,183, 19,101,120,249,116, 33,172, 36,176, 62,189,132, 16,143,
- 2, 75,252, 46, 54,161, 4, 42,180,220,238, 81,145,209,104,172,202,203,203, 51, 8, 13, 15,118, 5, 33, 36,140, 97,152, 58,135,
-203, 21, 27,232, 61,186,158,145,217,173,173,211,117,218, 19, 60,216,185,127,164,238,168,243,158,140,159,247, 33, 0, 96, 80,247,
-155,253,150,135, 64, 56,171,170,170, 12,125, 7, 15,220,106, 55,152,191, 25, 61,122,116,193,230,205,155, 21,129,132,213,147,208,
- 18, 93, 91, 81,100,113, 28, 7,179,217, 28, 80,220,205,102,179,215,242, 33,149, 74,175,196,209,130, 78,167, 51,175, 92,185, 18,
-115,231,206, 69, 68, 68, 4,134, 14, 29,138,216,216, 88, 44, 95,190, 28,132, 16, 60,255,252,243, 80, 40, 20,162,123, 77, 51, 32,
- 5,197,245, 13, 95, 90, 68,158,149,149, 53,221, 93,200,184,254,118, 21, 80,110, 98,202, 85,172,165,249,121,254,175,118, 23, 79,
-226,117, 25,134, 89, 61, 99,198,140, 76, 63,225,168,240, 38,180,124, 78,137,111, 50,153, 10,186,117,235, 22,144,154,208,235,245,
-165,254,196,134,167,183,122, 87,151, 64,173, 86, 67,165, 81,131, 13,176,222,181, 90,173, 78,161,178,113,227, 70, 40, 20, 10, 12,
- 31, 62,252,170, 28, 45,139,197, 2,153,148, 7,219, 42, 26, 99,102,109, 70, 85,157,193,249,128,217,146, 95,128,131,101,229,120,
- 57, 99, 48, 84,138,114,212,155,205, 1, 57,111,130, 32, 92, 38,178, 56,142,195, 3, 15, 60,224,116, 19, 92,251,173,192, 71,211,
- 97, 68, 68,196,126,142,227, 18, 92,238, 81, 80, 74, 74, 10,240, 71,191, 30, 70, 16,132,250,208,208,208, 31, 1,196, 17, 66, 18,
- 0, 4, 7,114,143, 40, 60,231, 79,247,253,130,155, 83,117, 37,156, 85, 85, 85,134,204,204,204,221,118,131,249,155, 11, 23, 46,
-236, 6, 16,116,211, 77, 55, 53, 89,104,137, 2,139,231,121,204,156, 57, 19,115,230,204,113,254, 31,168,208,178,217,108,141, 4,
-212,233,211,167, 27, 93,203, 93,216,249,105, 54, 37,104, 24, 93, 40,164,164,164, 56,207,137,137,137, 65,104,104, 40, 4, 65,128,
- 32, 8, 8, 10, 10,130, 66,161,128, 84, 42,165,153,142,130,130,194,151, 22, 49, 76,152, 48,225, 77,134, 97, 86, 59,156,165, 99,
- 62, 4,149, 39,237,209,203, 77,172, 85,120, 57, 46,211,147,216,114,253, 46, 98,226,196,137,105,238,225,240,212, 92,233,172, 85,
-221,166,221,111, 4,215, 38,170,230,122,136,249,122,144,169, 67, 53, 80,168, 84,144, 72, 88, 48, 12, 67,252,113, 89, 44, 22,103,
-197,255,204, 51,207,248,236,183, 18,104,127, 42,139,197, 2,150,147,224, 98, 76, 50,236,236, 54,231,185,226,198,114, 60,206,197,
-116,132,228,212, 33,240, 1, 62,112,221, 29,173,231,159,127, 30, 11, 22, 44, 0,203,178,206, 52,225, 56, 14,237,219,183, 71, 65,
- 65,129, 79, 46,142,227, 18,206,157, 59, 23,229,154,142,162,136, 37,132,192,110,183,163,109,219,182,198,188,188,188, 23,105,209,
-189, 58,145,229,109,191,221, 46, 4,236,194,120, 58,174,170,170,202, 48,106,212,168,173,181,181,181,223,220,112,195, 13,167,209,
-120, 10, 4,191,124, 28,199, 53, 18, 88,162,200,250,244,211, 79, 27,137, 34,171,213, 26,208,139,128,213,106,189, 76,240,124,252,
-241,199,141, 62, 1,160, 79,159, 62, 1, 57,195, 0, 8,203,178, 68, 42,149,226,182,219,110, 67,215,174, 93,241,243,207, 63, 67,
- 16, 4, 60,247,220,115, 80, 40, 20,152, 61,123, 54,108, 54, 27, 62,248,224, 3,234,104, 81, 80, 80,248,210, 34,166, 25, 51,102,
- 28,155, 49, 99,134,211, 89,114,119,180,188, 60,119,239,116,136,170, 72, 81,164, 1, 48,121, 18, 68,158, 92, 50,119, 1,230,186,
- 47, 43, 43,107,186,123, 56,220,155, 43, 27, 9,173, 63, 11,165,199,143,226,163, 91,210, 1, 52,110, 46,156,119,115, 71,168,212,
- 42,168,130,213, 24,181,106, 27, 0, 56, 42,253, 9, 1, 57, 90,162,208,170,170,170,242, 41,178,154,226,104,177, 50, 14, 43, 18,
- 46,129,200,120,112,102,107, 35,161, 37,225,120, 20, 69, 36,131,229,165,224,236,182,128, 56, 9, 33,151, 53, 21,142, 29, 59, 22,
- 12,195, 56, 71,136,117,235,214,205,149,139,241,247,112,124, 45,188,161, 15,158,123,115,236, 7,149, 70, 90, 98,175, 36,127,238,
-255, 18, 39,127,120, 22, 0,208, 87,167,115,222,139,105,221,254, 24, 59, 48,235,232, 86,167,251,248, 30, 94,189, 34,206,170,170,
- 42,195, 77,157,210,118, 75,195, 67,190, 57,127,254,252,110, 0,236,131, 15, 62, 24,218,173, 91,183,128,202,164, 56,184,194, 93,
-100,185, 58, 89,226,167,159, 17,182, 46,194,209, 30,144,128, 18,155, 17, 3,200,243, 68,204,219, 26,141, 6,106,181,218, 57,226,
- 54, 40, 40, 8, 74,165,210,217,191, 51, 64,225, 70, 65, 65,113,253, 34, 76, 20, 58, 14,177,212,200,105,114,244,173,202,116,253,
-237,201,241,114, 56, 80, 57,126,234,215, 53, 14,129,230, 17,162,179,230,118,206,106,111, 34,141, 19, 21,164,235,103, 76, 76,204,
-175,106,181, 58, 57,208,216, 55,101, 20,155,221,106,185,204,217, 98, 24, 6,234, 96, 53, 20,106, 21, 20,193,106,175,174,151, 47,
-161, 37, 58, 69,226, 67,103,225,194,133, 80,171,213,248,215,191,254,213,228, 62, 90, 78,161, 37,101,177, 65,190, 9, 18, 25,215,
- 72,100,113, 28, 7, 9,207,163, 84, 29, 11,150,231,193,217, 2,115,201,106,107,107,193,113, 28, 38, 77,154,228,124,131,119, 21,
- 89, 77,137,179, 47,176, 12, 35,186, 91,242,118,237,218,189,202, 48, 76, 34,128, 36,157, 78, 39,191,120,241,226,173,180,188,250,
- 80, 6,118,235,101, 46,148, 55,247,245, 74, 57, 69, 39, 75, 26, 30,242, 77,199,142, 29,157, 78,150, 82,169, 20, 71,155,250,191,
-199, 44,235, 81,100,185,143, 16,228, 56,174, 33, 47,251, 25, 29,233,234,104,205,152, 49,195,201,235,234,100,137,104, 74, 57, 18,
-195,186,117,235, 86, 28, 60,120, 16,207, 60,243, 12, 20, 10, 5,230,204,153, 3,155,205,134,169, 83,167, 66,161, 80, 64, 38,147,
-209,204, 71, 65, 65,221,172, 70, 90,196, 13, 21,110,253,160, 24, 55, 81, 83,225, 73, 96,185, 54, 19,138,223, 25,134,177,122,224,
- 53,187, 53, 41,186,239, 23, 63,171,102,204,152,177, 89,116,178, 92,246, 55, 10,135, 95, 71, 75, 46,151, 39,231,229,229, 57, 39,
-194,244,245,105, 54,155, 49,104,208,160,128,157, 49,113,212, 33,199, 73, 26, 9, 11,101,176, 26, 74, 77, 48, 20,106,181,187,224,
- 96,252, 85,226,226, 27,177,171,208,154, 60,121, 50, 56,142,195,130, 5, 11, 0, 0,175,190,250,106,192,125,180, 68, 78,216, 25,
- 20,147,179, 72,159, 53, 18,230,111,173, 40,219,241, 59, 56,142, 67, 84,239, 59, 32,220, 52, 18,122,133, 26,156,221, 22,240,168,
-195,234,234,106, 20, 20, 20, 64, 34,145,224,149, 87, 94,105, 52,215,145,251, 72,182,141, 27, 55,250,141,187, 39, 39,107,242,249,
-106, 39,143, 66,161, 96,127,255,253,247,100, 65, 16, 82, 12, 6, 67,187, 62,125,250, 8,180, 40,251, 17, 69,130, 45, 32, 81, 21,
-104,254,116,231, 20,251,100,213,214,214,126,115,254,252,249, 61, 0,216,209,163, 71,135, 42,149, 74,124,245,213, 87,122, 0,178,
-229,203,151, 43,252,137, 34, 49,223,248, 19, 89, 60,207, 55,228,229, 64,226, 78, 26, 79, 89,226,175, 99,124, 32,121, 94, 12, 43,
-195, 48,176,219,237, 80, 40, 20,141,156,172,160,160, 32,200,229,114,154,241, 40, 40, 40,252,213, 37,251, 2,174,199, 9,233,229,
- 34,170,246, 93, 9,111, 83,174,231, 15,156, 55,161, 97, 50,153,112,226,196,137, 64,121, 2,158, 24,179,117,207,155,241,222,133,
- 90, 48, 12,131,255,246,185, 1, 42,141, 26, 74,149, 10,247,255,188,213, 89,113, 31,157,254, 42,228, 42, 53,226,250, 13, 13,168,
- 34, 23,155, 14, 93,133, 86, 77, 77, 13,120,158,199,251,239,191, 15,150,101,241,193, 7, 31, 32, 62, 62, 30, 23, 47, 94,196,242,
-229,203, 3,114,180, 36,118, 9, 98, 31,235, 4,229,216, 16,104, 30,235,143,176,219, 38,227,130,153,195, 78,163, 18,253,141,199,
- 33,219,240, 41,204,130, 61,224, 17, 88, 54,155, 13, 91,183,110,117,239,240,238,236, 83,101,179,217, 96,181, 90, 97,177, 88,240,
-193, 7, 31, 4, 50,194,243,178,251, 38,166,161, 99, 18, 84, 73,110,110,110, 36, 33, 36, 28, 64, 8,128, 74, 90, 92,125, 35,182,
-247,243,136,236,249, 52, 0, 96,213,140, 39,156,251, 39, 29,253, 35,127,206,252,182, 97, 1,128,142, 73, 67,155,196, 89, 85, 85,
-101,184,125, 80,159, 28,163,192,127,221,165, 75,151, 70, 78, 86, 80, 80, 16,227,248, 29,144, 93,198,178, 44, 36, 18,201,101,205,
-133,222,196, 86, 32,125,180,108, 54,155,115, 34, 81, 95,253, 25,175,196,209,122,226,137, 39, 16, 27, 27,235,116,178,222,123,239,
- 61, 40, 20, 10, 76,156, 56, 17, 86,171, 21,159,126,250, 41,205,124, 20, 20, 20,127,186, 40,251, 51,224,177, 38, 53, 26,141,133,
- 93,187,118,133,151,255,226,131,130,130,120,183, 72,197,181,111,223, 62,215, 67, 19,226, 16, 0,217,158, 42,117,134, 97, 16,172,
- 9, 70,144, 90, 5,165,155,139, 21, 20,172,129, 92,173, 6, 43,245, 88,153, 95,198, 41,246, 45,113, 21, 90,226, 86, 91, 91, 11,
-158,231, 49,119,238, 92,104, 52, 26,152, 76, 38,191,156,226, 67, 71, 34,145, 64, 95, 84,135,147,211,179, 33, 11,218,137,118, 67,
- 31, 66, 44,175,128,116,251,143, 48,216,173,254, 38, 44,189,140,179, 67,135, 14,120,231,157,119, 46,155,214,193, 27,226,227,227,
-253,198,221,221,201,154,121, 67, 27, 72,101, 82,140, 63, 94, 4,147,201,196, 60,244,208, 67, 2, 0, 3,128, 10,131,193,112, 62,
-144,244,108, 6,252,227, 57,125,141,138, 21, 33, 16,187, 39, 1,227,145, 83,116,178,140, 2,255,117, 65, 65,129,232,100,133, 40,
-149, 74,124,241,197, 23,122, 0,236,212,169, 83,149,137,137,137,146, 64,242,146, 68, 34,193,172, 89,179, 60,246,201,242, 36,186,
-154, 82,142, 92,207, 29, 48, 96,128,199, 9, 75,189,136,183,203, 56,197,176, 70, 68, 68, 56,157, 44,187,221,238, 28,109, 40,206,
- 62,239,227,165,130,230, 79,202, 73, 57,175, 31,206,107, 18, 30,107,224,139, 23, 47,222,238,237,132,182,109,219,230,229,229,229,
-181, 23,151,226,112, 84,156, 82,163,209,216,161, 79,159, 62,126,173, 29, 65, 16, 32,151,203, 65, 8,193,173,239,100,129, 97, 1,
- 22,141, 31, 98, 81,183, 12,134, 68,194, 65,104, 88,234,195,239,168, 67,131,193,208,232,225,224,105,171,175,175,135,201,100, 10,
-120, 54,111,163,209,216,104, 10, 6,134, 8, 56,247,219,178,203, 70, 31,138, 91,160,253,118,130,130,130, 26, 53,253,248,113,172,
-152, 64, 28, 45,215,166, 71,169, 76, 10, 78,202,139,142, 86,221,233,211,167, 71,209,108, 30, 56,196, 1, 11, 0,144,218,103, 56,
- 4,193, 14, 98,183, 55, 90, 38,169, 83,242,237, 16,136, 29, 22,171, 30, 38,147,201,223,180, 39, 76,101,101,165, 97,212,168, 81,
- 91, 1,252,239,158,123,238,201, 69,195,236,194, 68,173, 86,203,121,158, 23, 0, 84, 3, 32,151, 46, 93, 10,185,112,225,130, 96,
- 52, 26,219,248, 11,231,154, 53,107,112,226,196, 9,244,235,215,175,209,114, 80,162, 43,234, 58,187,123, 32,249, 83,108, 46,247,
- 52, 35,188, 55, 33, 23, 40, 36, 18, 9, 66, 66, 66, 32,149, 74,241,254,251,239, 67, 42,149, 66,169, 84, 2, 0, 62,253,244, 83,
-231,228,171, 20, 20, 20, 20,215,141,208,242, 87,111,250,104, 86,244,217,132,104,179,217,138, 19, 19, 19,155,116, 49,187,221, 94,
-230, 71,184, 21, 47, 95,190, 92,234,234, 66,248,251, 36,132,148,249,121,216, 22,175, 90,181, 74,234,201,221,240,182,192,180, 63,
- 78,187,221, 94,156,148,148,228,213, 49,241, 4,171,213,122,193,159,104,205,170, 48, 52, 18, 9,227,143, 23,121, 93, 59,145,194,
-111, 94,243,145, 63,223,186,210,252,121, 58, 53, 53,245, 66,104,104,232,218,232,232,232,170, 29, 59,118, 68,244,234,213, 43,194,
-245,152, 94,189,122,197,186,157,102,134,247,117, 14,193, 48, 76,241, 61,247,220,227, 49,207,139,162,201, 67,254, 44,246,151,231,
-247,238,221, 43,117, 61,223, 27,191, 75, 57, 42, 14, 64,184,158, 75, 79, 79,103, 93,121,188,229,125,171,213, 90, 65,115, 33, 5,
- 5,197,117, 47,180, 12, 6, 67, 81,215,174, 93,109, 94,254, 59,239,235,220,170,170,170,158,205, 29, 1,171,213,218,231,159,192,
- 89, 89, 89,217,172,113,183,217,108,197,142, 9, 74,125, 30, 67,179,248, 95,119,143, 0,160,188,188,252, 38, 0,208,233,116,240,
-183,172, 78, 19, 4, 97,179,231, 79,155,205,214,167, 37,210,180,186,186, 58,131,230, 44, 10, 10, 10, 42,180,154, 0,186, 24,241,
-223, 3, 45, 33, 90, 41, 40, 40, 40, 40, 40, 40,154, 23, 44, 77, 2, 10, 10, 10, 10, 10, 10, 10,138,150, 1,131,134,145, 3,158,
-208,148,209, 4, 67,174,224,218,217,148,147,114, 82, 78,202, 73, 57, 41, 39,229,188,238, 56,253,113,211,209,140, 45, 44,192, 40,
- 39,229,164,156,148,147,114, 82, 78,202,121,253,113, 94,147,160, 77,135, 20, 20, 20, 20, 20, 20, 20, 20, 45, 4,142, 38,193, 95,
- 6, 9,154, 48,163,190, 63, 16, 66,194, 0,120, 91, 48,206,204, 48,204,165, 43,224,100, 0, 72, 29,155, 56,209,145, 21,128, 5,
-128,133, 97, 24,226,159,227, 93,182,164, 36, 44,141,216,249, 94,132, 97,120, 65,192,225, 54,109, 90, 31, 98,152, 59,204, 0,160,
-138,238,212, 89,173, 82, 12, 49, 89,204,201,114, 94,118,162, 70, 87,191,209, 84,158, 87, 72,179, 7, 5,197, 95,130,187, 0, 76,
- 65, 67,183,146, 25, 0,150,209, 36,161,160,104, 33,161,165, 86,171,247,179, 44,155,224,111,126, 30, 17,142,181,204,138, 47, 93,
-186,212,179, 9,215, 30,165, 86,171, 7,241, 60,127, 11, 0, 88,173,214, 29,245,245,245,155, 1, 44, 7, 96,187,194, 56,105, 0,
- 60, 0,224, 17,199,239, 37,142,202, 66,123,133,124, 93, 67, 66, 66,126,224,121,158, 84, 86, 86,246, 6,128,136,136,136,221, 86,
-171,149,209,106,181,247, 3, 56,210, 68, 62,150,231,249,153,189,123,247,238,191,109,219,182,255, 1,152,219, 76,247, 82,206,178,
-172, 71,129, 34, 8, 66,210, 21,136, 44, 41,128,144,185,115,231, 70, 44, 94,188, 56,189,184,184,184, 11, 0, 36, 36, 36, 28, 29,
- 61,122,244,161,113,227,198, 85, 17, 66,106, 25,134,177,248,226, 41, 41, 9, 75, 43, 47,205,127,166,172,252,196, 3, 0, 16, 19,
-219,101,153, 68,194, 74, 9, 57,176, 75,217,234,145, 86,237,219, 37, 61,253,221, 87,115,165, 73,201,173,177,105,231,193, 27,199,
-189,248,102,218, 5,224, 19, 42,182,254, 60, 4, 7, 7,239,103, 89, 54,193, 87, 25,247, 84,230,237,118,123,113,117,117,117, 79,
-111,156, 28,199, 37,248,170, 47, 60,237, 19, 4, 33,191,178,178,210,227, 84, 19, 26,141,102, 23,199,113,201,129,114,137,159, 54,
-155,173,216,219, 40, 93,141, 70,179, 95, 34,145, 36,248,138,167,167,255, 4, 65,200,175,168,168,240, 22,206,203,226,222, 28,225,
-188, 18, 78, 95,225, 20,235, 35, 0,159, 70, 68, 68,220, 92, 85, 85,245, 40,128, 55,181, 90,109, 55,137, 68,130,240,240,240, 55,
-205,102,243,153,144,144,144, 47,107,107,107,119, 2,120, 17, 0, 93, 47,149,130,162,185,160,209,104,202,234,235,235,137, 8, 65,
- 16,136,213,106, 37, 38,147,137, 24, 12, 6,162,211,233, 72,125,125, 61,209,106,181,164,182,182,150, 84, 85, 85,145,200,200, 72,
-247,201, 27,189,181,225,118,209,104, 52,121, 89, 89, 89,166,130,130, 2, 98,177, 88,136,197, 98, 33,133,133,133,228,163,143, 62,
- 50,105, 52,154, 60, 0, 93,188,156, 59,196, 75,101,113, 27,128,165,233,233,233,230, 53,107,214, 16,163,209, 72,116, 58, 29, 89,
-182,108, 25,185,225,134, 27,204, 0,150, 58,142, 97, 3,228, 4,128,190, 49, 49, 49,197,103,207,158,181,111,220,184,209, 18, 18,
- 18,146, 29, 18, 18,146, 93, 88, 88,104, 63,123,246,172,208,170, 85,171, 98, 0,125,155, 16, 78, 0, 24, 57,126,252,248,178,194,
-194, 66, 50, 96,192,128,195, 46,251, 25,248, 95,231,110,136, 39, 39,139, 16, 18, 67, 8,137, 69,195, 36,151,151,109,132,144, 88,
-199, 49, 97, 1,114,170,242,243,243, 91, 71, 71, 71,103, 49, 12, 99,118,231, 99, 24,198, 28, 29, 29,157,149,159,159,223,154, 16,
-162,242,197, 89,124,126,222,147,107,215, 12,174,209, 93, 58, 69,116,151, 78,145,255,125, 61, 80,251,212,184, 71,151,198,182,237,
-190, 32, 52, 33,109,238,137, 83,167,231, 19, 66,230,111,222,151, 55,127,242,231,191,206,191,119,220,236, 47, 34, 18,211,159,106,
- 66,122, 94, 13, 40, 39,128,208,208,208, 82,157, 78, 71, 8, 33,196,110,183, 19,139,197, 66, 76, 38, 19,209,235,245,164,190,190,
-158,212,213,213, 57,203,121,109,109,173,243,123, 84, 84,148,215,242, 30, 22, 22, 86,102, 48, 24, 26,213, 29,102,179,217, 89,127,
-232,245,122,162,215,235,137, 78,167,115,110,245,245,245, 36, 46, 46,174,200, 71, 56, 47,138,225, 20, 4,129,216,108, 54, 98,177,
- 88,156,188, 70,163,177,209,102, 50,153,136,201,100, 34,137,137,137, 1,135, 51, 16, 78,163,209, 72, 18, 18, 18, 74,188,113,134,
-135,135,151, 25,141,198, 70,156,174,241,119,231, 21,127,199,196,196,148, 54,133, 51,144,112,250, 74, 79, 7,230,230,230,230, 18,
-131,193, 64,226,227,227,171,238,191,255,126,171,221,110, 39,107,214,172, 33,233,233,233,194,192,129, 3, 45,149,149,149,228, 95,
-255,250, 23,241,241, 82, 72,203, 17,229,164,184, 18, 71,139, 97, 24,168, 84, 42,124,255,253,247, 94,151,227,112,253,222,166, 77,
-155, 64,175,217, 51, 57, 57,121,235,246,237,219, 21,177,177,127, 76,136,109, 54,155, 17, 22, 22,134,231,158,123, 78,118,215, 93,
-119,181, 31, 58,116,232,238,115,231,206, 13, 0,176,223, 15,223,125,145,145,145,159, 77,154, 52, 41,250,193, 7, 31, 68, 68, 68,
-163, 73,183, 49,106,212, 40,220,127,255,253,210,220,220,220,135, 22, 46, 92,248,208,188,121,243, 74,235,235,235,199, 1,248,209,
- 23,169, 66,161,184, 39, 46, 46,238,139,237,219,183, 71, 69, 69, 69, 33, 37, 37,133,125,253,245,215,219,119,232,208, 65,145,144,
-144,192, 94,188,120, 17, 63,255,252,115,252,195, 15, 63,188,162,172,172,236,105,139,197,178, 50,128,184,203, 34, 34, 34,222,124,
-250,233,167, 91,105,181, 90,219,129, 3, 7,242,196,253, 50,153,108,106, 70, 70, 70,175, 45, 91,182,124, 11,224,203, 43,113,178,
- 8, 33, 90,252,209,196, 39,194, 42,254, 31,136,179, 69, 8,145, 29, 62,124, 56, 60, 35, 35,227, 71,147,201,212,253,153,103,158,
- 57, 63,125,250,116,133, 70,163,209, 0, 96,180, 90,237,165, 41, 83,166,152,103,207,158,253, 70,231,206,157, 7,239,218,181,235,
- 62, 66,136,213, 33,200, 46,231, 99, 24,103,120,138, 46, 84, 96,235, 78, 65,246,206,196, 87, 19, 62,156,150,124,110,223,241, 34,
-129, 83,104,240, 75,206, 49,148, 85,213,227,215, 93,199, 17, 19, 17,204, 72,229,124, 90, 72,252, 13, 3,106, 47, 28,207,129,143,
- 25,210, 41,154, 7, 12,195, 64,169, 84,226,151, 95,126,185,108,233, 42, 79,203, 90,113, 28,135,208,208, 80,191,171, 27, 4, 5,
- 5, 97,227,198,141, 30,215, 94,244,180,164, 79, 72, 72, 8,124,189,108, 48, 12,131,160,160, 32,236,216,177, 3, 44,203,122, 92,
- 26,200,125,159, 74,165, 2,235, 99,173, 43,145, 51, 39, 39,199, 47,151,248,169, 86,171,129,134,166,127,239,133, 82, 46,199,246,
-237,219,189,198,217,253,187,218,177,222,171, 63,206, 29, 59,118, 52, 90,250,203,125, 73, 48,215,223, 42,149, 10,140, 31,210,176,
-176,176,222, 9, 9, 9,216,187,119, 47,150, 47, 95, 30,158,150,150,134,211,167, 79,131, 97, 24, 76,159, 62,157,185,225,134, 27,
-248,210,210, 82,244,235,215, 15, 63,253,244, 83, 31,173, 86, 75, 11, 12,197, 95, 2, 66, 8, 15,224, 70, 0,145,104,232,118, 83,
- 7, 32, 20, 13, 43,105,200, 0, 84, 1, 80, 56, 54, 19,128,122, 0,173, 28,167, 87, 58,234, 22, 87,129, 80,225,186,248, 52, 33,
-164,151,131, 91, 92,161, 34,210,229, 88,241, 26,238,191,221, 63, 61,114,115, 0,176,122,245,106,241, 97, 54, 48, 51, 51,115,171,
-107,228, 2, 17, 89,226, 58,101, 30,202,180,251, 16, 77,185, 74,165,250, 97,247,238,221,138,200,200, 63,226, 96, 50,153, 80, 87,
- 87,135,250,250,122,212,213,213, 33, 56, 56, 24,203,151, 47, 87, 12, 30, 60,248,135,186,186,186, 14,142, 68,243,198, 57,235,226,
-197,139,209, 54,155, 13, 50,153,231, 46, 74, 44,203,162, 83,167, 78,120,243,205, 55, 49,108,216,176,152, 65,131, 6,205,114, 19,
- 90,151, 13, 37, 85, 42,149, 95, 28, 56,112, 32, 74,169, 84, 34, 47, 47, 15,197,197,197, 24, 63,126,124,107, 65, 16, 80, 84, 84,
-132,211,167, 79,227,194,133, 11, 88,184,112, 97,212,136, 17, 35,190,240, 32,180, 60, 13, 79,125,230,229,151, 95,238, 24, 22, 22,
-198,126,244,209, 71, 53, 58,157,238,255, 28,251,223,153, 51,103,206, 99,253,251,247,143,250,247,191,255, 77,118,236,216,177,216,
-113,227,188,166,167,107,159, 44, 71, 51, 31, 28,153,239,164,219, 57,157, 92,254, 7, 33, 36, 6,128,137, 97,152, 26, 15,156, 12,
-128,144,161, 67,135,190, 98, 50,153,186,111,223,190,253,204, 45,183,220,146, 8,224,162,152,249, 66, 66, 66, 84,179,102,205,138,
-206,204,204,204,189,245,214, 91,187, 15, 29, 58,244,149,138,138,138,233,132,144, 10,151, 62, 91, 78, 78, 65,192,225,152,216, 46,
-203,114,118,141,123, 96,203, 14,179,244,213, 23, 39,159,111,211, 58,169,246,112, 94,181,253,120,126, 5,234, 12, 54,220,123,107,
-195, 2,230,189,187,180,193,103,223,111,199,115, 47,189,197,255,184,108,209,253,103, 8, 84,245, 37,199,215,248, 72,207,171, 5,
-229,132,179,137, 9, 60,207,227,142, 59,238, 0,195, 48,151,173,229,201,243, 60,118,237,218,133, 91,111,189, 21, 60,207,227,137,
- 39,158, 8,136,147,227, 56, 12, 29, 58,212,185,142,162, 43,159,187,104,240,162, 9,178,221, 42, 91,112, 28, 7,150,101,189, 46,
-164,237,206,233,175, 94, 18,195,233,139,203,245, 63,127,225,116, 44,121, 20,176,200, 10,148, 83, 12, 39,199,113,232,211,167, 15,
- 14, 29, 58,228, 83,116,121,209,151,141,226,126,233,210,165, 49, 29, 58,116,200,153, 59,119,110, 56, 0, 84, 85, 85, 57, 23,188,
-151, 72, 36, 56,117,234, 20,204,102, 51,222,125,247, 93,139, 86,171,253, 55, 45, 71,148,179, 37, 57,125,105, 17, 0,253, 39, 78,
-156,216, 51, 43, 43,107,122, 70, 70,198,119, 59,119,238, 92,202, 48,204,106, 66, 72,166,248, 57,113,226,196,180,172,172,172,233,
- 19, 38, 76,120,115,198,140, 25,199, 24,134, 89, 13, 0,238,191, 29,117, 73,166,155,136,139, 20,121, 28,101,174,209,177,158,126,
-187,127,122,226,110,228,104,101,102,102, 50,142, 72, 50,174,149, 90,160, 66, 43,144,181,251, 56,142,123,126,250,244,233,209,190,
- 68, 86,125,125, 61, 74, 74, 74,144,152,152,136, 39,158,120, 34,122,238,220,185,207,219,108,182,143,125,208, 74, 37, 18, 9,246,
-238,221,139,242,242,114,116,237,218, 21,201,201,201,141, 14, 56,123,246, 44,214,174, 93,139,154,154, 26,244,232,209, 3,104,232,
-220,237, 17,221,186,117,123,183, 83,167, 78, 67, 89,150,181, 41, 20, 10, 28, 62,124, 24,221,187,119,199,247,223,127,143, 54,109,
-218, 64,169, 84, 34, 55, 55, 23, 93,187,118,197,214,173, 91, 17, 25, 25,137,244,244,116,155, 86,171,221, 86, 93, 93,189,249,220,
-185,115,239,122, 11,103,124,124,252,228,167,158,122, 74, 86, 82, 82, 34,124,243,205, 55,219, 1,108, 7,240,252, 91,111,189,245,
-248,176, 97,195,162, 14, 30, 60, 88,187,111,223,190, 61, 94, 68, 86, 32, 78,150,205,253,161,100,183,219, 77, 6,131,193,108, 50,
-153,172, 44,203, 22, 50, 12, 99,182,219,237, 29,188,153, 16, 99,199,142,109, 91, 89, 89,249,220, 75, 47,189, 84,224, 16, 89,167,
-208,208, 1, 30, 0, 96,179,217, 76,245,245,245,218,140,140,140,196,135, 31,126,248,204,210,165, 75,159, 27, 59,118,236,242,111,
-190,249,166, 30,128,193,157,176, 77,155,214,135, 36, 18, 86,170,171, 11,207, 95,177,252,203,151,215,174,122,190,117, 81,209,133,
-246, 17,173, 34,117, 82,117,100,201,242, 37, 95,239, 7, 96, 46,169,208,226,200,217, 82,240,188, 4, 39,138,106,209,255,246, 81,
-252,153,188,105,125, 1,172,161,239,114, 45,255,178, 40, 46, 66,189,101,203, 22,159,142,214,174, 93,187,192,243, 60, 20, 10, 5,
-102,207,158,237,147, 84, 20, 6,162, 91,228, 79,204,136,139,163,251,114,159, 4, 65,112, 46,244,238,190,253,223,255,253, 31, 94,
-122,233,165, 70,215,112,136, 13,198, 31,167,183,240, 37, 38, 37,161,188,172,172,209,190, 64, 22,165,183,219,237,224,121, 30, 11,
- 22, 44, 64,102,102, 38, 86,175, 94,237,243,243,142, 59,238, 0,203,178, 36,144,244,236,211,167, 15, 44, 22,139, 51,204,167, 78,
-157,242,200, 59,111,222, 60,127,193,188, 11,192,148,238,221,187,107, 6, 13, 26,132,156,156, 28,220,127,255,253, 38,139,197,146,
- 7, 0,119,222,121,103,234,220,185,115,101, 7, 14, 28, 64, 68, 68, 4,127,254,252,249,255,129,118,144,167,104, 97,120,210, 34,
-226, 51, 47, 43, 43,107,186,187,136,113,133,248, 63,195, 48,171,103,204,152,145,233, 42,138, 92,127,139,174,147,155,136, 75,115,
-117,164, 92, 69,148, 55, 1,229,246,188,117, 61,190,194,163,208,114, 68,108,160,171, 11, 36, 86,190,254, 68,150,143, 55,199, 70,
- 8, 9, 9, 25,126,239,189,247, 58, 69,142,209,104,116, 10, 44, 81,100,137,191,115,115,115,209,179,103, 79,105, 72, 72,200,240,
-170,170,170,143, 3, 16,113,136,139,139, 67,101,101, 37,142, 30, 61,138,196,196, 68, 88,173, 86,172, 95,191, 30,181,181,181,224,
-121, 30, 82,169, 20, 22,139,207,190,219,232,212,169,211, 29,139, 23, 47,238,185,104,209,162, 75,226, 27,221,146, 37, 75, 64, 8,
- 65,100,100, 36,244,122, 61,202,202,202,176,121,243,102,216,108, 54,168,213,106,164,164,164,200,238,185,231,158,190, 83,166, 76,
-225,125, 8,173, 62,247,223,127,127,136, 70,163,193,139, 47,190, 72, 44, 22,203, 12,199,190,201,227,198,141,139, 40, 44, 44, 52,
- 63,249,228,147,123, 45, 22,203, 71,162,153,232, 42,112,188,220, 88,175, 78,150,213,106, 21,211,180,160,190,190, 30,173, 90,181,
- 74,116,117,182,188,137,193, 29, 59,118,244, 1, 32,153, 58,117,106, 16,128, 50,215, 48,152,205,102,212,215,215, 67,167,211, 89,
-107,107,107,203, 95,123,237, 53,219,210,165, 75, 37,142,115, 78,120, 18, 90, 12,115,135, 89,163, 81,202, 8,145,188, 53,127,254,
-124,245,176, 97,195, 88,181, 90,141,186,186, 58,205,175,235,214,169, 7, 15,234,155, 50, 61,235,195, 13,154,132,174,101, 59, 14,
-231,227, 66,105, 45,204, 86, 43, 82, 98, 67, 26,252, 48,138, 22,135, 99, 32,139,211,209,114, 21, 21, 57, 57, 57,184,253,246,219,
-157,101, 93, 42,149, 54,114,190,252,113,114, 28,135,219,111,191,253, 50,135,103,203,150, 45, 30,221, 39,127,112, 21, 69,238,226,
-200,147, 0, 99, 89,214,239, 2,235,162,155,231, 73,108,185,186,250,110,226,205, 95, 51, 7, 56,142,195,184,113,227,192,243, 60,
- 94,127,253,117,112, 28,135,244,244,116,112, 28,135,140,140, 12,240, 60,143, 91,111,189,181,201,113,223,189,123, 55,186,119,239,
-238, 12, 83,122,122, 58,122,245,234, 5,142,227,208,175, 95, 63,240, 60,143,161, 67,135, 6,194,249,102, 93, 93, 93, 55,181, 90,
-141,220,220, 92, 72, 36, 18, 48, 12,115, 26, 64, 55, 0,136,141,141, 61,163, 6,111,130,189, 0, 0, 32, 0, 73, 68, 65, 84,215,
-235,219, 26,141, 70, 60,245,212, 83,140,217,108,238,250,250,235,175,191,101, 52, 26,169,208,162,104, 49,184,107, 17, 23, 24, 38,
- 76,152,240, 38,195, 48,171, 69,135,202,221,121,242,244,219, 67,221, 36, 58, 80,251, 28,101,181,151,155,136,171, 96, 24,102, 31,
- 33,228, 78,111,231, 2, 48,187, 9,171, 70, 77,135,174,205,134,126, 29, 45,177,242, 13, 84,104,249,131,209,104,188, 49, 42, 42,
-202,171,200,114,253, 52,155,205, 72, 78, 78,134,209,104,188,177,169, 15,141,216,216, 88, 88, 44, 22,124,249,229,151,144, 74,165,
-144, 74,255,208, 23,102,179,111,179,232,248,241,227, 5,187,119,239,238,222,163, 71,143,176,159,126,250,169, 98,192,128, 1,145,
-195,134, 13,131, 66,161,128,193, 96,128,213,106, 69,239,222,189,209,169, 83, 39, 20, 23, 23,227,215, 95,127,173,236,208,161, 67,
-171, 61,123,246, 8,165,165,165,231,124, 80,223, 54,120,240, 96, 48, 12,131,117,235,214, 85, 2,216, 39,151,203,215, 78,155, 54,
- 45,204,108, 54, 11,163, 71,143, 62, 95, 93, 93,253, 18, 0,139, 76, 38,155, 51, 96,192,128,140,236,236,236,111, 5, 65,152,221,
-212,140,234,158,182, 58,157, 14, 65, 65, 65,129, 76, 37,193, 87, 87, 87,119, 1, 0,149, 74, 21, 14,224,140, 51,135, 27, 12,141,
-196,176,217,108, 54,134,135,135,171, 0,192,113, 14,239,133, 51,210,102,195,138,115,231,242,131, 93,251,207,133,134,134,226,145,
-135, 31,102,111,233,211, 71,214,237,198, 27,135,190,253,201,162,239,227, 34, 52,230,148,184, 8, 88,237, 86,100,111, 88, 47, 16,
-193,186,129, 86, 59,127,142,208, 18,197,134,187,163,197,243, 60,182,110,221,122,217, 62,169, 84,138,255,254,247,191, 1, 9, 3,
- 81, 84,121,107, 58,115,107,234, 98,252, 9, 24,158,231, 33,145, 72,176, 96,193, 2, 8,130,128,151, 95,126,185, 81,115,162, 43,
-127, 64,118,158,139, 8,236, 52, 89, 0, 96, 70,241, 76,185,243,124,247,240, 58,206, 9,200, 37,155, 59,119,110, 64,142,214,157,
-119,222,233, 87,184,186,182, 48,184,134,235,208,161, 67, 30,121,231,207,159,239, 55, 61,237,118, 59,214,172, 89,227, 20,169, 34,
-222,126,251,237,167,100, 50, 89,244,182,109,219, 80, 90, 90, 10,157, 78,135,250,250,122,244,238,221, 59,133,101,217,195,165,165,
-165,133, 39, 78,156,184,151,150, 30,138, 63,209,209, 50,205,152, 49,227,216,140, 25, 51, 60, 58, 86,238,206,146, 47,231, 73, 20,
- 88, 14, 65, 20, 41,138, 55, 52,116,171,217,231,239, 92, 0, 50,247,166, 67,159, 70,144,155,138,156,226,169,242, 13,164,249, 48,
- 64, 59,157, 99, 24, 6, 70,163,209,163,192,114, 21, 7, 22,139, 5,213,213,213,176,219,237, 87, 60,215,151,167, 55, 89,127, 66,
-235,232,209,163,255,122,252,241,199, 75, 66, 66, 66,186, 85, 84, 84,148, 11,130,112,235,174, 93,187, 34, 57,142,131, 70,163,129,
- 70,163,193,218,181,107,161, 84, 42, 49,110,220,184,114,187,221,158, 19, 28, 28, 28, 97, 48, 24,126, 47, 45, 45,125,219,171,130,
-225,249,161,253,250,245,195,129, 3, 7,112,233,210,165,141, 0,210, 31,125,244,209,219, 91,183,110,205, 76,155, 54,205,120,246,
-236,217,217, 0,202, 85, 42,213,226,197,139, 23, 15,234,209,163, 71,240,232,209,163,177,117,235,214,249, 0,140,129,198, 89,167,
-211, 53, 18, 88, 90,173, 22,117,117,117, 80,169, 84,182, 0,211,140,199, 31, 35, 12, 65, 8,113,222, 27,135,155, 37,222, 31,194,
-113,156, 56,170,209,155,200,130, 74,165,154,186,104,209, 34,133,251, 32, 5,187,221,142,178,178, 50,104, 52, 26, 76,122,251,109,
-233,123,227,255,221, 93,162,142,222,197,178, 12,204, 22, 82, 67, 4,243,122, 93,217,131,219,128,119,105,205,243, 39, 64, 20, 6,
-119,223,125,247,101,205,133, 82,169, 20, 27, 55,110,196,136, 17, 35,156, 47, 46, 61,122,244,240,251,114, 37, 10,131,187,238,186,
-203,233, 12,173, 95,191,222, 99,179,159,232, 72, 5, 34, 8,197, 99, 95,120,225, 5,112, 28,135,207, 62,251, 12,175,188,242, 10,
- 88,150,197,204,153, 51,193,178, 44,222,121,231,157,128, 69,166,171,128, 41,252,176,225, 51,225, 21, 45,170,230, 69, 3, 0,130,
- 53, 26, 49, 66, 77,170,123, 56,142,115, 58, 89, 55,222,120, 35,120,158, 71, 70, 70, 6, 56,142,115, 58, 89,195,135, 15,119, 77,
- 71, 18, 8, 39,199,113,200,203,203,115,134, 57, 35, 35,163,145,147,197,113, 28,238,188,243,206, 64,130, 57, 61, 52, 52,116, 74,
-167, 78,157, 58,207,154, 53,139,151, 72, 36, 24, 60,120,112,106, 76, 76,204, 57,155,205, 22, 49,117,234, 84,165,135,115, 20, 0,
-186,117,238,220, 89, 69, 75, 13, 69, 11, 58, 90, 83, 60,252, 21,230,218,231,170, 9, 47,146,171, 93,143, 23, 57,220,197,145,195,
- 33,203,241,199,229,233, 92,127,224, 68, 5,233,203, 82, 15, 68,104, 57,108,103,159, 23, 83, 42,149, 71,202,203,203, 51, 20, 10,
- 69, 35,145,229, 73,112, 73, 36, 18,148,150,150, 66,169, 84, 30, 49,153, 76,205,118, 19,253, 53, 29, 2, 48,158, 62,125,122,188,
-203,239, 33,195,135, 15,255,102,227,198,141,177,217,217,217,216,179,103, 15, 34, 35, 35, 49,119,238,220,139,101,101,101,255, 2,
-176,177,178,178,210,239,117,219,182,109,219, 69,173, 86, 99,199,142, 29, 0,176, 21,192,191,159,123,238, 57,198,106,181, 98,222,
-188,121, 58, 0,235, 66, 67, 67,215, 44, 95,190,188,123,183,110,221,100,217,217,217,218, 61,123,246,252, 22,160,200,178, 11,130,
-112,153,192,114, 77,211,224,224,224, 64, 28, 45,107, 72, 72,200, 81,173, 86, 59,202, 96, 48,104,229,114,121,176, 86,171, 53,185,
- 10, 44,145,159,227, 56, 62, 47, 47,175, 4, 64, 74, 72, 72,200, 81,120,105,230,228, 56,110,240,224,193,131, 57,247,123, 80, 86,
- 86,134,210,210, 82, 88, 44, 22,244,232,209,131,145, 48, 86,201,165,162, 35,110,211, 58, 80,145,245, 39, 57, 90, 68, 44,235,226,
- 40, 65, 79, 35, 13,215,175, 95,239,252,205,178, 44,190,254,250,235,128, 68,209,198,141, 27,125,118, 88,119,107, 58,244,107,141,
-139,199,127,254,249,231, 32,132, 56,157, 44,150,101, 49, 97,194, 4,200,229,114, 76,155, 54, 13, 19, 38, 76, 0,199,113,126,155,
- 14, 93, 5, 76,210,235,122,215,151,163,134, 66,225,232, 15,197, 48,140,171,216, 98, 2, 21,111,190,220,188, 64, 90, 2, 92, 57,
-197,243,130,130,130,188,118,132,119,227,244,117,129, 95, 0,228,199,198,198,238,200,200,200, 8,217,191,127, 63,102,206,156, 41,
- 53,153, 76,109,178,179,179,157,215,245,148, 94, 58,157, 78, 65, 75, 14, 69, 75,184, 89, 62,254,174,112,235, 95,197,184, 54,227,
-249,248,116, 63, 30, 46,251, 92,121, 43, 24,134,177,122,184, 94,133, 7,113,229,126, 13,215, 99, 42,188, 58, 90,254, 42, 11,127,
-130, 43, 16, 71, 75,175,215,255,182,110,221,186, 94, 15, 63,252, 48,231,171,217, 80,167,211, 33, 58, 58, 26,199,142, 29,179,233,
-245,250,223, 2,112,202,154, 83,104,185, 35,187,188,188, 92, 98,181, 90,209,190,125,123,196,199,199,195,104, 52,162,166,166, 70,
- 2, 96, 99,128, 28, 82,149, 74, 37, 1,128,154,154, 26,160, 97,168,105,106,135, 14, 29,112,224,192, 1, 84, 87, 87,255, 8, 96,
-216,148, 41, 83,122,244,238,221, 91,250,253,247,223,235,159,121,230,153, 31,173, 86,107, 64, 74, 67, 16, 4,179,205,102, 75,102,
- 89,214, 82, 83, 83,115,193, 53, 61,163,163,163,195, 85, 42, 21, 83, 86, 86,102, 13, 68,104,117,235,214,109,239,249,243,231, 49,
-117,234,212,138,233,211,167,119,168,171,171,187, 84, 91, 91,107,115, 21, 91, 70,163,145,109,213,170,149,124,222,188,121, 10, 0,
-232,214,173,219, 94,111, 66, 75,167,211,181, 86, 42,255,120, 49, 54,153, 76, 40, 45, 45, 69,105,105, 41,202,202,202, 80, 87, 87,
-135,148,148, 20,232,245,250, 68, 90,205,252,101, 66,171, 81,243,153,107,249,118,125,144, 55,165,172,187, 10,152,187,239,190,219,
-217,183, 75,116,200,196,109,197,138, 21,238, 29,204, 3, 18, 90,159,127,254, 57, 94,120,225, 5, 4, 5, 5, 97,214,172, 89,141,
-154, 14,221,197,129, 32, 8, 76, 32,113, 79,126,195,128,210, 57,225,224,121, 30, 17,207,148, 53,106,162,243, 32, 56, 2, 10,231,
-244,233,211,155,165,233,208,149, 51, 49,177,161,168, 44, 88,176, 0,163, 70,141,194,182,109,219,174,184,233, 48, 45, 45,109,201,
-234,213,171, 67,142, 31, 63, 14,173, 86,139,138,138, 10,152, 76, 38, 20, 23, 23,123,109, 21,112,212,229, 65,180,228, 80,252,201,
-245,212,190, 63,147,183, 57,175,199,249,121,128, 7, 44,180, 2,113,180, 76, 38,211,172, 23, 95,124,241,185, 33, 67,134,132, 7,
- 7, 7,163,164,164,228, 50,145, 85, 95, 95, 15,181, 90, 13,131,193,128, 85,171, 86,105, 77, 38,211, 44,127,226,192,106,181, 34,
- 42, 42, 10,149,149,149, 16,188,244,159,102, 89, 22, 10,133, 2,245,245,245,128,159, 78,230,158, 30, 24, 22,139, 5, 86,171, 21,
- 86,171, 21, 22,139,197,239, 91,178,187,153,167, 82,169, 68,225, 1, 0,186,184,184,184,246, 65, 65, 65, 40, 40, 40, 0, 26, 70,
-246, 13,185,253,246,219,249,170,170, 42,242,228,147, 79,110, 39,132, 60, 5,223,179,227,155,115,114,114,146, 1, 64,161, 80,228,
- 2, 64,113,113,177,181,166,166,166,145, 83,168, 84, 42,201,136, 17, 35, 98, 9, 33,200,201,201, 73,150, 74,165, 4,222, 71, 53,
- 26, 87,174, 92,121, 60, 36, 36,100,105, 86, 86,214,195,153,153,153,199,186,116,233,146,172,211,233,202, 13, 6,131,193,104, 52,
- 18,137, 68, 34, 13, 11, 11, 11,218,176, 97,195,153, 93,187,118, 13,209,104, 52, 75, 87,174, 92,121,220,155,243,166, 82,169,138,
-245,122,125,146,120, 79, 93, 69, 86,105,105, 41, 8, 33,200,207,207,135, 82,169, 60,239,175, 89,151,162,229, 32,190, 84,185, 59,
- 47,238,251, 2, 21, 89,174,194, 96,195,134, 13, 62,231,208, 10,148,211, 85, 20,189,242,202, 43,152, 51,103,206,101,142,214,180,
-105,211, 0, 0,111,191,253,118,192,125,180, 68,247,170,116, 78, 56, 98, 94,168,110, 20,118, 0, 96,196,240, 53,173,204,131,227,
- 56, 76,157, 58,245,178, 78,234,174, 77,123, 1, 54,241, 53, 10,103,121,121, 57, 56,142, 67,120,120, 56, 30,121,228, 17, 12, 29,
- 58,212,217, 4,217, 84,222,147, 39, 79,238,120,227,141, 55,186,166,165,165,225,253,247,223,175, 14, 13, 13, 13,254,207,127,254,
-195,213,212,212, 48,190, 28, 45, 42,180, 40, 40,154, 65,104,137, 5, 44,208, 81,135, 94, 42,203, 33,104, 60,215, 70,173, 94,175,
-127,228,182,219,110,251,105,217,178,101,138,182,109,219,226,228,201,147,168,174,174,134,217,108,134, 84, 42, 69,108,108, 44,106,
-106,106,240,245,215, 95, 27,244,122,253, 35, 0,106,253,112,190,213,179,103,207, 47, 62,254,248,227,160,244,244,116, 84, 87, 87,
-163,190,190,222, 41,132, 24,134,129, 70,163,129, 66,161,192,222,189,123,177,126,253,122, 3,128,183,252,112,122, 82,115,176, 88,
- 44, 78,193, 21,128,208,114,229, 84,137,174,142, 94,175, 7, 0,107,235,214,173, 99, 0, 32, 63, 63, 31, 0, 10, 83, 82, 82,166,
-180,109,219,150, 89,188,120, 49, 33,132,172,247, 34,178,156,156, 12,195, 84, 19, 66, 46, 1,136, 49,155,205, 82, 0,168,173,173,
-181,180,106,213, 42, 74, 46,151, 11, 10,133, 66, 8, 10, 10, 18, 74, 74, 74,108, 54,155, 77, 10, 0,253,250,245, 51, 3, 40,117,
- 91,163,208,149, 83, 32,132,104,231,207,159, 63,101,244,232,209, 25,125,250,244, 73,123,246,217,103,143, 62,249,228,147,108,124,
-124,124, 88, 93, 93,157,241,244,233,211,151, 62,249,228,147,186,221,187,119, 15,225,121,254,220,252,249,243,167, 0,208, 50, 12,
- 35,120,226,180,217,108,191,101,103,103,255, 43, 51, 51,147,187,112,225, 2,202,202,202,156, 34,171,172,172, 12,157, 58,117,194,
-174, 93,187,236, 22,139, 37,187, 9,233,217, 92,160,156, 13, 47, 33, 68, 44,235,222, 4,150,248, 50, 21, 40,167,171, 40, 26, 53,
-106, 84, 35, 23, 75, 42,149,226,135, 31,126,240, 88,111,120, 40, 87,141,226,238, 58,199,215, 27,111,188,209, 72,180, 77,154, 52,
-201,107,117,230, 47, 61, 69,158,218, 5,241,141, 71, 29,122, 41,231,190,194, 41,214,157, 60,207, 99,210,164, 73, 1, 59, 90,184,
-188,143,214,101,156, 98,220, 7, 12, 24, 0,189, 94,239, 20,178,222, 28, 45,127,233,105,183,219, 95,152, 51,103, 14,209,104, 52,
- 55,107,181,218, 71,207,159, 63,191, 80,175,215,223, 84, 91, 91,235,211,209, 50,153, 76,114, 90,142, 40, 39, 90,102,126,174,235,
- 71,104, 57, 30,146,104,221,186,117,163,181,179, 88,150,109,180, 53,165,159,129, 3, 27,242,242,242,238,187,229,150, 91,190,125,
-225,133, 23,130,211,211,211,249,164,164, 36,232,116, 58, 20, 20, 20,224,216,177, 99,182,149, 43, 87,106,245,122,253,163, 0, 2,
- 25,117,182,232,248,241,227,235,135, 13, 27,246, 78,239,222,189,159,158, 60,121,178, 36, 53, 53, 21,181,181,181, 8, 11, 11, 67,
- 84, 84, 20, 78,157, 58,133, 85,171, 86,217, 43, 43, 43,191, 0,240, 30, 60,180,161,250,123,225,183, 88, 44,120,232,161,135, 32,
- 8, 2,102,207,158,141, 64, 22, 84,118,129,197, 98,177, 16, 0,140,163, 63,151,222, 49,187, 52, 78,159, 62, 13, 0,231,146,147,
-147,131, 1, 32, 59, 59,155, 65,195,252, 90,129,188,225, 19, 66,136,211,217,234,212,169, 83,129,123,229, 40, 58, 89,162, 11,230,
- 47,220, 12,195, 24, 9, 33,229,122,189,126,216, 43,175,188,242,206,231,159,127,254,240,231,159,127,126,217,113, 26,141,102,233,
-204,153, 51,223,123,224,129, 7,202, 25,134,241,218,143, 76,167,211,189, 61,102,204,152, 7,142, 28, 57, 18, 28, 20, 20, 4,157,
- 78,135,170,170, 42, 88, 44, 22,164,164,164,160,188,188, 28,139, 22, 45,170, 51, 24, 12,239,210,226,248,215,192, 85, 24,120,115,
-181, 2, 16, 89, 94, 93,157, 95,126,249,197,227, 28, 85, 77,229,116, 23, 27,129,206,109,229,235,165, 72,156,150,198,211,148, 17,
- 77,172,215, 46,227,229, 56, 14, 31,125,244,145,115,210, 86, 79, 78, 86, 83, 28, 45,145, 51, 60, 60,188,193, 38, 87, 42, 33, 8,
- 2,238,188,243,206,171,225, 21, 0,140,115,153,241,125,250,107,175,189, 54,165, 83,167, 78,169, 0,228,174,105,208, 68, 23,159,
-130,130,194,159,208,178,219,237,197, 29, 59,118,108, 84,193,249, 91,204,212,106,181, 22, 7,120,221,245, 58,157, 46,101,230,204,
-153, 47,170, 84,170, 33,122,189,190,171,163,226, 56,162,211,233,178, 77, 38,211,167,104,218, 34,208, 21, 0,158,223,189,123,247,
-236, 97,195,134, 77,187,245,214, 91, 71,142, 31, 63,158, 33,132, 96,222,188,121,228,236,217,179, 43, 28, 46,214,217, 43, 73,164,
-240,240,240,227, 95,127,253,117,244, 79, 63,253, 4,171,213,138, 79, 63,253, 20,193,193,193,199,171,171,171, 3,165, 40,223,180,
-105,211, 55,125,250,244,121,108,215,174, 93,139, 0,252,190,117,235,214,133,125,251,246, 29,179,107,215,174, 37, 0,142,109,222,
-188,121, 97,239,222,189,199,236,219,183,111, 57,128, 67, 77,168,124,157,206,150,205,230,185,165,209,139,147,229,139, 83, 75, 8,
-177, 60,254,248,227,227, 31,120,224,129, 47,247,237,219,119, 83, 77, 77, 77, 87, 0, 8, 13, 13, 61,210,171, 87,175,189,203,150,
- 45, 59,229,112,178,252,117,214,175,208,233,116, 35,186,118,237,250,227,251,239,191,175, 74, 75, 75,227,218,183,111,143,194,194,
- 66, 28, 61,122,212,246,191,255,253,175,222, 96, 48,220, 13,224, 18, 45,142,127,157,208, 34,132, 32, 52, 52,180,209, 75,148, 56,
-228,191,169,205,133,174, 15,102,113,169, 30,119, 94,111,156,190,166, 77, 16,161, 86,171,157,147,155, 6,210,101, 65, 16,124,207,
-199, 70, 8,113,114,138, 91, 0, 34,203,239, 8, 65,199, 18, 56, 1,115, 6, 50,189,131, 74,165,130,213,106,117,242, 6, 48,242,
-179,169,106,241, 23, 0,191, 88,173,214,211, 0,218, 81,113, 69, 65,209,130, 66,235,210,165, 75, 61, 91,248,218, 90,147,201,244,
-158,201,100,122, 79,220, 97, 52, 26,175,150,243, 44,128, 7, 54,109,218,244,241,166, 77,155,196,118,132,169,240,191, 94,162, 79,
-156, 60,121, 50,147,231,249,255, 46, 93,186,180, 55, 33, 4, 33, 33, 33,187, 11, 11, 11,255,211, 20, 14,187,221,254,248,174, 93,
-187,158,131,163, 47,147,197, 98,121,124,199,142, 29, 47,162, 97, 61, 38,216,237,246,199,247,236,217,227,252,221,196, 7, 37, 33,
-132,152, 8, 33,113, 94, 14, 49, 53,209,129, 19,157, 45,243,178,101,203,234, 1, 28,198, 31,243,100, 89, 29,155,209,173,185,208,
- 23, 54,235,116,186,246,147, 38, 77,154, 46,145, 72, 6,235,116,186,120,149, 74, 85,100,179,217,126,211,235,245,111,161, 97,141,
- 42,138,191, 8,102,179,249, 66,199,142, 29, 57, 79, 47, 80,190, 30,228,190, 94,172,236,118,123,113,135, 14, 29,252,190,156,121,
-224,188,224, 67, 52,156, 75, 73, 73, 97, 3,229, 18, 97,177, 88,202,125,133, 51, 37, 37, 5, 77,229,244, 23,247,228,228,100,143,
-113,247, 35, 8,189,198,221,102,179, 93, 17,167,175,244,244, 5,131,193,112, 41, 50, 50,178,222,104, 52,242, 38,147,137,183,217,
-108,141,236, 71,133, 66, 81, 97, 48, 24,104,225,161,160,184, 26,161,245, 15,199,126, 52, 44, 47,209, 92, 48, 29, 57,114,228, 49,
-167, 61, 85, 94,126,165, 60,238, 74,178,222,207,239,166, 8,163,102,119,132, 28, 66, 74,223, 76,116,149,245,245,245, 79,138, 63,
-196, 62, 32, 20,127, 61,170,170,170,110,110,110,206,234,234,234,102,127, 81,171,172,172,204,104,129,184,247,188, 94, 57,125,161,
-164,164,228,102, 63, 66,140, 22, 28, 10,138, 0,193,210, 36,160,160,160,160,160,160,160,160,104, 25, 48,104, 24, 57,224, 9, 77,
- 25, 77, 48,228, 10,174,157, 77, 57, 41, 39,229,164,156,148,147,114, 82,206,235,142,211, 31, 55, 29,205,216,194, 2,140,114, 82,
- 78,202, 73, 57, 41, 39,229,164,156,215, 31,231, 53, 9,218,116, 72, 65, 65, 65, 65, 65, 65, 65, 65,133, 22, 5, 5, 5, 5, 5,
- 5, 5, 5, 21, 90, 20, 20, 20, 20,174, 72,109,221,186,245,137,212,212,212, 11, 0,198,182,240,181, 30,233,221,187,119,149, 92,
- 46,223, 0, 32,149, 38, 61, 5, 5, 5, 21, 90, 20, 20, 20,215,180,200,234,218,181,235,246,147, 39, 79,118,202,206,206,142,139,
-143,143,255,176, 37, 47,214,179,103,207, 15,182,109,219, 22,190,110,221,186,219, 98, 98, 98,114,174, 80,108,165,182,105,211,230,
- 68,106,106,106, 49,128, 71,154, 57,136, 99, 51, 50, 50,170,101, 50,217,122, 42, 4, 41,174, 3,116, 1,208,149, 10, 45, 10, 10,
- 10,138, 22, 20, 89, 59,119,238,140, 48, 26,141, 56,121,242, 36, 42, 42, 42, 14,181,228, 5,115,115,115, 47,237,220,185, 19, 9,
- 9, 9, 88,178,100, 73,100,114,114,242,182, 38, 10,154,212,174, 93,187,110, 63,113,226, 68,167,236,236,236,248,168,168,168, 79,
-154, 51,124, 55,221,116,211,180,109,219,182,133,109,216,176, 97,104,100,100,228,149, 10, 65, 10,138,191, 51,228, 0, 30, 99, 24,
-102,111,151, 46, 93,142,164,165,165,253,206, 48,204, 46, 0,163,112,237,206,221, 25, 24, 86,175, 94,189,117,245,234,213, 91,105,
- 30,161,160,160,104, 6,164,165,165,165,233,116, 58, 29,169,168,168, 32,159,125,246, 25, 9, 15, 15,183, 0,248, 13,192, 74, 15,
-219,155, 0, 52, 1,114,107, 28,199,123,226,249, 45, 60, 60,220,242,217,103,159,145,252,252,124,114,252,248,113,146,154,154,106,
- 8, 80,208,164,118,237,218,181, 82, 12,243,218,181,107, 9,199,113,235,155, 51, 81, 52, 26,205,177,156,156, 28,114,246,236, 89,
-178, 97,195, 6, 18, 29, 29, 93, 78,197, 22,197, 53,130, 36, 0, 31,168,213,234,234,187,238,186,139,124,245,213, 87,100,213,170,
- 85,228,199, 31,127, 36,179,102,205, 34,131, 6, 13, 34, 50,153,236, 2,128,215, 1,132, 94, 79, 90,132,113, 68,140, 0, 24, 8,
- 0,153,153,153, 84,108, 81, 80, 80, 92, 45,118,234,245,250, 12,189, 94,143,186,186, 58,180,110,221, 26, 60,207,123, 60,176,188,
-188, 28, 59,118,236,192,184,113,227,142,151,150,150,246,135,239,117, 47,195,186,119,239,190,115,243,230,205,169,193,193,193,206,
-157,130, 32,192, 98,177,192,106,181,194, 98,177,192,100, 50,193,100, 50, 65, 38,147, 65,161, 80, 32, 60, 60,252, 40,124, 55, 97,
- 56,221, 55,131,193,128,131, 7, 15, 98,244,232,209, 21, 85, 85, 85,253, 1,228, 54, 99,186,164, 70, 69, 69,229, 44, 90,180, 40,
- 50, 37, 37, 5,231,207,159,199, 19, 79, 60, 81,121,238,220,185,126,205,124, 29, 10,138, 63, 19, 19,238,187,239,190,105,209,209,
-209,108,151, 46, 93, 16, 27, 27, 11,147,201, 4,131,193, 0, 66, 8, 56,142, 3, 33, 4,181,181,181,200,201,201,193,230,205,155,
- 77,151, 46, 93,250, 26,192,167, 0,242, 92, 68,214, 53,169, 69,156, 66, 43, 51, 51,147,161,121,133,130,130,162,153,112,164,182,
-182,182,139,201,100,130, 78,167, 11,232,132,252,252,124,140, 29, 59,246,120,105,105,233, 45,240,188,168,188,166,123,247,238,123,
-114,114,114, 82,141, 70, 35,180, 90,255,235,206,203,100, 50, 4, 5, 5, 33, 34, 34, 98, 23,128, 62,222,222,196,187,116,233,178,
-127,215,174, 93,225, 6,131, 1,135, 14, 29,194, 35,143, 60, 98,169,174,174,222, 14,192, 91,224,171,209,176,142,234, 57, 15,255,
- 37, 2,120,209,241,134,239, 9,170,200,200,200,190,139, 23, 47,150,182,109,219, 22,122,189, 30,163, 70,141,170,206,205,205,237,
- 5,160,128,102, 29,138,127, 32,114, 79,158, 60,217,193,110,183,163,178,178, 18, 38,147, 9,122,189,222, 41,180, 36, 18, 9, 8,
- 33,176,217,108,206, 23,163, 3, 7, 14, 32, 59, 59,155,228,231,231, 79,118,148,165,107, 86,139, 80,161, 69, 65, 65,209, 18, 72,
-237,208,161,195,161, 95,127,253, 53, 72, 42,149, 98,213,170, 85,152, 60,121,178,181,186,186,122,155,187,120,137,142,142, 78, 91,
-184,112, 97,114, 74, 74, 10,126,255,253,119,220,127,255,253,111, 1,152,238,129,243, 77,173, 86, 59,205, 98,177,224,208,161, 67,
- 24, 51,102, 76, 65, 89, 89,217, 49,119, 17,147,156,156,220,239,147, 79, 62,225,123,244,232, 1,173, 86,139,145, 35, 71,234, 79,
-157, 58,213, 27,192, 49, 47, 97,253,164,186,186,250, 21,187,221,142,186,186, 58, 36, 36, 36, 64, 42,149,250,140,156,193, 96, 64,
- 82, 82,210,174,138,138,138,203,196, 91, 68, 68,196,166,243,231,207, 15, 82, 40, 20, 62, 57, 44, 22, 11,138,139,139, 33,147,201,
- 96, 50,153,208,174, 93,187,175, 1, 60, 78,179, 14,197, 63, 81,104, 29, 62,124,184,195,119,223,125,135,238,221,187,163,115,231,
-206,168,175,175,119,138, 46,179,217, 12,171,213,122,217, 73, 90,173, 22, 47,191,252,114, 30, 28,205,231,215,170, 22, 17, 59,166,
- 77, 17,219, 68, 51, 51, 51, 7,208, 60, 67, 65, 65,113,181, 21,111, 94, 94, 94,250,144, 33, 67,182,173, 88,177,162,213,240,225,
-195,209,174, 93, 59,254,222,123,239,141,212,235,245,131, 93, 15, 44, 43, 43, 11, 27, 51,102,204,254,162,162,162,100,199,174, 94,
- 94, 56,123, 5, 7, 7, 35, 63, 63, 95, 20, 89, 61,225,214,204, 40,147,201,214, 31, 62,124,152,151,201,100,216,183,111, 31,198,
-142, 29, 91, 89, 80, 80,224,175, 89, 46,212,108, 54, 67, 34,145, 0, 0,138,139,139,253, 70,238,252,249,243, 16, 4,193,228,233,
- 63,150,101,229, 7, 14, 28, 64, 92, 92,156, 79, 14,150,101,221, 5, 93, 13,205, 54, 20,255, 80, 88,205,102, 51,122,246,236,137,
-130,130, 2, 28, 56,112,192, 41,184, 42, 43, 43, 81, 82, 82,210,232,224,189,123,247,226,224,193,131,232,223,191,191, 59,207, 53,
-169, 69,156,202,113,245,234,213, 3, 28,145,219, 74,243, 12, 5, 5, 69, 51, 33, 53, 46, 46, 46,103,209,162, 69,145,177,177,177,
- 24, 52,104, 80, 81,105,105,105, 27, 15,199,173, 36,132,220,157,159,159,143,182,109,219,174, 2,112,207,149, 28,147,152,152, 88,
-177,111,223,190, 86,199,143, 31,199, 35,143, 60, 82,225,232,243,229,175,239, 83,114,167, 78,157,246,109,216,176, 33,156,101, 89,
- 28, 59,118, 44,144,166,195, 66, 52,244, 47, 57,231,225,191, 68, 0,147, 0,132,123, 57, 87,213,161, 67,135,190,251,247,239,151,
- 50, 12,131,194,194, 66,177,233,176,167,131,151,130,226,159,134, 17,113,113,113,255,123,238,185,231, 66,122,247,238,141,226,226,
- 98, 92,184,112, 1,151, 46, 93, 66,122,122, 58,210,210,210,112,246,236, 89,172, 95,191, 30, 7, 15, 30,132, 92, 46, 71, 66, 66,
- 2,212, 75,191,195,127, 25, 28, 7,144, 70,181, 8, 5, 5, 5,197, 85,136, 45,169, 84,186, 62, 62, 62,190, 28,158,231,165, 10,
- 27, 57,114,100,137,221,110, 39,103,207,158, 37,104, 24, 61, 8, 47, 66,139,156, 61,123,150, 68, 71, 71,231, 3, 8,243,112,204,
-216,152,152,152, 34,165, 82,121, 20, 77,156,214,161,125,251,246, 21,167, 78,157, 34, 69, 69, 69,100,221,186,117, 36, 34, 34,162,
- 37, 70, 4,166,118,236,216,177,178,174,174,142, 24,141, 70,146,147,147, 67, 18, 19, 19, 43, 64, 71, 30, 82,252,243, 17, 12, 96,
-106, 74, 74,138,241,227,143, 63, 38,235,215,175, 39, 11, 22, 44, 32,211,166, 77, 35,227,199,143, 39, 25, 25, 25, 36, 35, 35,131,
-140, 26, 53,138,188,242,202, 43,228,246,219,111, 39,106,181,186, 22,192,189, 52,233, 40, 40, 40, 40,154, 23,137, 0,102, 57, 4,
-213,202,145, 35, 71,150,152, 76, 38,114,225,194, 5,242,195, 15, 63, 16, 52, 76,221,224, 9,111,150,150,150,146,210,210, 82,113,
-106,132,124,252, 49,173,195, 87, 14,222,171, 18, 65, 73, 73, 73, 21,251,247,239, 39,133,133,133,100,237,218,181,196, 33,216,154,
- 13, 10,133, 98,131, 86,171, 37, 70,163,145,108,218,180,137, 78,239, 64,113, 45, 34, 10,192,220, 27,110,184,193, 58,123,246,108,
-178,114,229, 74,242,217,103,159,145, 17, 35, 70,144,215, 95,127,157, 60,248,224,131, 36, 50, 50,210, 4, 32, 11, 64, 8, 77,174,
-171, 7, 93,217,156,114, 82, 78,202,233,142,245,199,143, 31, 39, 34,236,118, 59,185,112,225, 2,217,176, 97, 3,137,137,137, 57,
-134,198,243,105,185,114,106, 58,119,238,124,242,212,169, 83,228,252,249,243,196, 98,177, 56, 57, 78,158, 60, 73, 0,108,109,134,
-112,166,198,199,199,151,111,217,178,133,156, 58,117,138,196,196,196, 20, 53,103,220,147,146,146,202, 43, 42, 42,200,166, 77,155,
- 72,100,100,164, 63,145, 69,243, 18,229,252, 39,115, 38, 1, 88,220,163, 71, 15,251,156, 57,115,200,211, 79, 63, 77, 18, 19, 19,
-237,142,151,162,248,235, 73, 8, 93,223,179,180, 82, 80, 80,252, 21,144,239,222,189, 27,114,185,220,185,227,247,223,127,119,157,
- 71,203,219,188, 13,218, 19, 39, 78,220, 50,124,248,240,109,115,230,204,233,236, 58,138,105,203,150, 45, 0, 96,106,134,176,229,
- 94,184,112,161,255,176, 97,195, 62,141,136,136,184,177,180,180,244,157,230,140,120, 97, 97,225, 43, 93,187,118,157, 94, 87, 87,
-167,213,235,245,163, 64,231,206,162,184,118, 81, 8, 96,244,129, 3, 7, 62, 60,112,224,192, 91, 0, 8,128,247, 1,156,184,222,
- 18,130, 10, 45, 10, 10,138, 63, 27, 99,159,124,242, 73,247,206,226,251, 0,252,159, 15,145, 37,226, 82, 65, 65, 65,159, 59,239,
-188,243, 57, 52, 30,157, 40,118, 78,111, 14,228,154,205,230,161,238, 35,165,154, 9, 75, 74, 75, 75,151,208, 44, 64,113, 29,225,
- 24,128, 7,175,231, 4,160, 66,139,130,130,226,207,198, 57, 0, 79, 92,197,249, 90,120,158,103,139,130,130,130,226,111, 7,186,
-168, 52, 5, 5, 5, 5, 5, 5, 5, 5, 21, 90, 20, 20, 20, 20, 20, 20, 20, 20,255, 44, 48,240, 62,114, 32,187, 9, 60, 87, 50,
-162, 33,155,114, 82, 78,202, 73, 57, 41, 39,229,164,156,215, 29,167, 63,238,108, 80,180,168, 0,163,156,148,147,114, 82, 78,202,
-249,207,230,100, 28, 27,235,216,196,223,127,231,184, 51,127,227,184, 95, 47,156,215, 36,254,170,206,240,226,141, 16,208, 48,228,
-147,226,239, 7,215, 2, 66,232,125,162,160,160,104, 98,221, 33,113,121,216,218, 29, 27,254,134,117,137,171, 40, 16,174,242,185,
-212, 18,113,191,158, 57,175,121,161,117,163, 74,165,154, 44,147,201, 82, 24,134,177,235,116,186, 35, 38,147,105, 62,128, 93, 87,
-121,205,175,162,163,163,199, 86, 85, 85, 9, 44,203,130,101, 89, 48, 12, 3,150,101,193,243,188,161,182,182, 86,115, 37,164,145,
- 93, 70,188,202, 49,204, 11,118, 98,159, 95,126,116,213, 52,127,251, 41,124, 23, 24,169, 84,122, 95,120,120,120,104, 69, 69, 5,
- 97,217,134,174,124, 18,137, 68, 92, 8,215, 86, 91, 91,251, 77,160,100, 97, 97, 97,123,195,195,195, 67,197,243, 25,134, 65, 85,
- 85, 85, 77,121,121,249, 77, 0, 16, 20, 20,180, 67,165, 82, 69,112, 28, 7,137, 68, 2,137, 68, 2,189, 94, 95, 85, 85, 85,117,
- 11,189, 21,255, 76, 44, 95,190, 92, 50, 44,254,137,118, 28, 49,116, 99, 89, 18, 34, 8, 76,173,141, 81,252,190,254,194, 87,103,
- 2, 57,127,212,168, 81,118,154,138,127, 30,100, 50,217,236,232,232,232,127,215,215,215,235, 25,134, 33, 12,195,128, 97, 26,222,
-179,220, 63,237,118,123,113, 85, 85, 85, 79, 63, 15, 91, 94, 38,147,205,140,137,137, 25,163,215,235,245, 14, 62,143,188, 0, 96,
-181, 90,139, 43, 43, 43,123, 6, 84,215, 71, 70,206, 87, 40, 20,143,234,245,122, 29,195, 48,130,235,127,132, 16,215,135,249,217,
-202,202,202,126,254,132,129, 76, 38,251, 52, 58, 58,250, 95,142,184, 59,195,121,181,113,143,142,142, 30,163,211,233, 2,226,244,
- 17,247,203, 56, 91, 34,156,127, 83,206,107, 95,104,165,167,167,127,183,103,207,158, 14, 60,207, 3, 0,140, 70, 99,215,185,115,
-231, 62,246,198, 27,111,100, 1,152,120,133,215, 91,216,175, 95,191,135,114,114,114,216,149, 43, 87,178,189,122,245, 2,195, 48,
-176,219,237,176,219,237,232,210,165,139,226, 74, 35, 18,162, 82, 78, 56,184,241,191, 65, 55, 14,121,242,133,114, 96,154,191,253,
-190, 4, 38,128,183, 1,164, 52, 49, 8, 21,142,116, 57,232, 69,108,236,100, 89,182, 73,156,130, 32,228, 95,186,116,169,143, 15,
- 1,211,236,156, 14,145,117,127,191,126,253, 66,178,179,179,153,162,162, 34, 70,161, 80, 64, 16, 4,216,237,118, 88,173, 86,220,
-112,195, 13, 77,114, 66, 67, 67, 67, 53, 19, 38, 76,104,119,199, 29,119,224,135, 31,126,192, 99,143, 61,134,190,125,251,230,149,
-151,151, 3, 0, 84, 42, 85,196,241,227,199, 59,132,135,135, 67,175,215,163,182,182, 22,183,221,118, 27,170,170,170,254,209,133,
-235,230,244,132,247, 25,150,113,206, 21, 69,108,246,234, 61,191,151,188,125,181,188,225,225,225, 7,229,114,121,180, 95,181,236,
-242, 32, 51, 26,141,101,213,213,213,221,253,156,146, 4,224, 46,137, 68,210,158,227,184,142, 0,146,108, 54, 91, 52, 0, 72,165,
-210, 50,137, 68, 82,104,181, 90, 79,153,205,230,211, 0,126,129,143, 5,144,135,197, 63,209,142,177,233, 71,214,153,132,225,202,
-182, 89,169,250,179, 19,114,149,114,253,218, 97,241, 79,172, 8, 84,108,253,133, 72, 5,176, 12, 13, 11, 74, 63,141,134,121,128,
-174, 6,241, 0,238, 70,195,154,143,201, 22,139,165, 18,192, 1, 52,244, 67,201, 3,144, 24, 25, 25,185, 68, 16, 4, 83, 85, 85,
-213, 19,240,176, 80,117,239, 30,173,247,179, 44,155, 32,122, 2, 2,177, 23,239, 62, 80,220, 44, 15, 40,150,101, 63,205,204,204,
-252,215,138, 21, 43,148, 7, 14, 28, 80,118,238,220,217,249, 66, 36, 8, 2, 26,107, 23, 32, 57, 57,217,159,171,193,177, 44, 59,
-123,228,200,145, 15, 47, 94,188, 88,121,238,220, 57,101, 92, 92,156,147,211, 85,108,137,136,139,139, 11, 52,239,127, 53,116,232,
-208,209,139, 22, 45,226, 87,173, 90,165,104,213,170, 21, 34, 34, 34, 32,149, 74, 47, 59,246,150, 91,110, 17,252, 71,157,253,244,
-158,123,238, 25,253,253,247,223, 43,247,236,217,163,236,210,165, 11, 36, 18,201, 85,199,125,196,136, 17, 15,127,247,221,119,202,
- 35, 71,142, 40,219,183,111, 15,209, 84,112,231, 99, 89, 22,173, 91,183, 14,136,243,238,187,239,126,120,217,178,101,202,131, 7,
- 15, 42, 59,118,236,232, 76, 79, 66,200, 21,135,243,111,206,121, 93, 56, 90, 50,139,197,130,173, 91,183,130,101, 89,132,135,135,
- 99,236,216,177,216,184,113,227,132, 77,155, 54,173,190, 2,103,235, 43,135,200,226, 1,224,199, 71, 71, 32,159, 7,198,149,155,
- 33,149, 74,113,246,236, 89, 72, 36,146, 38, 91,139,114,185,124, 12, 33,100,146,254,194, 62,185,193, 96,133,177,100,191, 82,161,
- 80, 56, 31, 0,250, 18,199,254,139,251,149, 10,133,226,172, 68, 34,153, 90, 95, 95,191,208, 27, 95,251,246,237,191, 61,118,236,
- 88, 39, 79, 5,215, 23,244,122, 61,218,180,105,147, 88, 93, 93,221,222,211,255, 60,207, 39,156, 59,119, 46, 74, 38,147,129, 16,
-226, 44,196,238,159,226,119,139,197,130, 27,110,184,193,226,235,154,190, 56,109, 54, 27,130,130,130, 32,186, 81,102,179, 25,245,
-245,245,254, 56, 25,169, 84,122,159, 40,178, 0, 96,233,210,165,136,137,137, 65, 84, 84, 20, 84, 42, 21, 20, 10,133,147, 51, 80,
- 72, 36, 18, 12, 27, 54, 12,239,190,251, 46,178,178,178,240,218,107,175, 53,170,104,121,158, 71,120,120, 56,214,173, 91, 7,141,
- 70,131,196,196, 68,136, 2,255, 31,109, 11,178, 76,248,174,253,231,157, 14,237,237,183,118,226,110,238,206,125,238,120, 84,130,
-101, 1, 65,104,120,116, 50, 12,136,205, 42, 92,218,127,164,228,157, 0,210, 51,174,176,176, 48, 42,208, 52,178,217,108,136,139,
-139,147,248, 57,108,120, 90, 90,218,143,207, 62,251,172,180,125,251,246,140, 84, 42, 5,199,113,224, 56, 78, 20,232,137,132,144,
- 68, 65, 16, 6,150,149,149,145,185,115,231,126,184,101,203,150,123, 1,172,245, 88,177, 16, 67,183, 58,147, 48,124,219, 33,220,
- 52,114,200, 27, 88,183,124,194, 77,253,210, 5, 4, 43, 13,103, 0,252,157,133, 86,106, 90, 90,218,161, 61,123,246, 4, 89, 44,
- 22,244,238,221,123,119,110,110,110, 15, 92,217, 12,238, 97, 0, 62,153, 56,113,226,232,103,159,125, 86, 18, 26, 26, 10,153, 76,
-134,186,186, 58,156, 57,115,102,204, 55,223,124, 67,190,248,226,139,255, 3, 16, 92, 88, 88,152,177,119,239, 94, 12, 26, 52,232,
- 69, 0, 47, 95,174, 8, 36, 9, 59,246, 22, 68,137,191,239, 30,214, 85,154,209,147, 45,107,112,113,220,143, 38, 16,236, 66,241,
-222,195, 23, 2, 17, 98, 31,142, 24, 49,226,145, 21, 43, 86,168, 1, 96,222,188,121,184,239,190,251, 16, 30, 30, 14,165, 82, 9,
-169, 84, 10,158,231, 27,125,250,121,216, 74, 0,124,248,224,131, 15,142, 92,188,120,113, 48, 0, 44, 94,188, 24, 35, 70,140, 64,
- 68, 68, 4,130,131,131, 33,147,201, 32,145, 72,154,156,152,225,225,225, 95,245,189,233,166,199, 23, 45, 90, 4, 0,120,235,165,
-151,112,199,205, 55, 67,173, 84, 64,169,144, 65, 76, 11,153,132,199,237,227, 94,240,171, 47, 1,124,124,223,125,247, 61,240,253,
-247,223, 7, 3,192,129, 3, 7, 80, 94, 94,142,232,232,104, 40, 20, 10,200,100, 50,103,156, 25,134,129, 66,161, 8, 40,238,247,
-221,119,223,200,239,190,251, 46, 24, 0, 22, 46, 92,136, 97,195,134, 57,227, 46,151,203, 33,149, 74, 27,109,238,162,211, 19,231,
-189,247,222, 59,114,217,178,101,193, 0,240,205, 55,223, 96,200,144, 33, 8, 11, 11,115,166,167,200,213,148,123,244, 55,231,188,
- 62,132,214,161, 67,135,238, 87,169, 84, 51, 0, 68,202,100,178,208,135, 31,126,184,245,227,143, 63,142, 7, 31,124, 16,155, 54,
-109,122,170,137, 66,139,137,142,142, 30,155,147,147,227,124, 66,155,201,101,130,169,201, 15,112, 7, 38,237,127,234,169,152,172,
- 51,245,216,189,247, 20,130,192, 50,123, 63,254, 56,210,120,250, 52,236,102, 51,222, 59, 91,215,176,223, 70,152,173,175,140,139,
-185,113,246,255, 77, 2,176,208,135, 11, 32, 55,153, 76,200,203,203,107, 82, 32,138,138,138, 32, 8,130,201,151,187, 32,149, 74,
-113,244,232,209,203, 84,189, 39, 36, 38, 38,250, 42,128,126, 57,215,175, 95,143,241,227,199,227,212,169, 83, 16,151, 42, 9,128,
-147, 9, 15, 15, 15, 21, 69,150, 40,130, 20, 10, 5,120,158,103, 56,142, 99,196,166, 61, 71,225, 10, 72, 24,179, 44,139,111,191,
-253, 22, 31,124,240, 1, 94,127,253,117,204,159, 63, 31,221,186,117,251, 35, 19,114, 28,180, 90, 45,194,194,194, 16, 22, 22,214,
- 72, 32,254,147,225,126,155,103,206,154,163,132, 64, 26, 58,129, 16, 1, 16, 0, 2, 2,129, 8, 40,187,112, 6,147,223,253, 40,
-224,167, 15,207,243, 56,125,250,180, 51, 31,136,206,176, 40,140, 92, 93,131,164,164, 36,191,121, 73, 42,149, 78,249,249,231,159,
-101,223,126,251, 45,190,255,254,123, 48, 12, 3,185, 92, 14,149, 74,133,208,208, 80, 68, 68, 68, 56,183,132,132, 4,230,127, 61,
-184,254,121, 0, 0, 32, 0, 73, 68, 65, 84,255,251,159,180, 91,183,110, 83,180, 90,237, 90,207,247,156,132, 40,219,102,165,142,
- 28,242, 6, 0, 96,228, 27, 4,151,242,166,221,200,214,188,243,119, 94, 68, 54,181,107,215,174,219,119,238,220, 25,164,215,235,
- 33, 8, 2,214,174, 93,171, 28, 50,100,200,182,130,130,130,126, 77, 21, 91, 73, 73, 73,171,118,238,220,121, 75,100,100, 36,106,
-107,107,161,213,106, 97,181, 90, 33,145, 72,144,152,152,136, 15, 63,252,144,185,231,158,123,158, 31, 51,102,140, 81,161, 80,136,
-206, 70,146,231,188,212, 56, 51,205,253,236,243, 80, 66, 26,242, 15, 17, 72,163,207,234,242, 66,188,244,202,228,128,194,216,186,
-117,235,167,127,248,225, 7,181,171,179,228, 42, 2, 92, 69,150,184,249, 17, 6,108,155, 54,109, 30, 95,178,100,137,147,179, 85,
-171, 86,224, 56, 14, 60,207,131,227, 56,176, 44,139,109,219,182, 97,198,148,137, 8,139,140,195,156,207,230,249, 13,103,100,100,
-228,252, 97,195,134, 61,186,112,225, 31, 85,119,215,182,109,113,231, 45, 55, 35,170,149, 6,173,194,130, 27,210, 73, 96,240,251,
-169, 2,191,207, 35, 0,108,235,214,173,159, 88,190,124,185,218,245,133, 80,140,171,248,242, 44,186,248,102,179, 25, 61,123,246,
- 12, 40,238,174,156,162,219, 38,138, 54, 49, 61,197,235,136,229,213, 79, 56, 31, 23,133,176, 67,112, 54,226,224,121, 30,203,215,
- 45,242,234,102, 95, 41,103, 83,239,187, 59,103, 97, 97, 33,166, 79,159, 14,241,165,205,181,171, 80,124,124, 60,230,204,153,227,
-183, 94,114, 43, 3,189, 0, 68,186,236, 50, 3,144,185,124, 86, 48, 12,179,207,195,113,226,126,222,209, 98, 21,137,134,126, 99,
-117, 0, 66, 61,240,121,227,169,116, 60,243, 34,221,142,111,116, 29,175, 66,107,245,234,213, 98, 41, 30,152,153,153,185,213,241,
-189, 70, 46,151, 23, 41,149,202, 24, 0,117,107,215,174,197,127,254,243, 31, 56,172,213,187, 67, 66, 66,142,121,112,117, 14,153,
- 76,166, 55, 0,148, 57,118,137, 67, 52,217,234,234,106, 97,227,198,141,236,226,123,135,194, 76,128,244, 73, 51, 48, 44, 51, 19,
-235,227,101,144, 0,184,233,100, 37,148, 74, 37,167,213,106,173,174,253,182, 60,244,221,202,118,203, 80,146, 32,142, 67,239,237,
-107, 48,126,251, 26,220,164,146,161,106,197, 50,212,237,200, 1,203, 50,232,175,106,133,215, 30,217,136, 62, 26, 57,100, 38, 29,
- 88,150,245,148,179,157,156,121,121,121,163, 52, 26,205, 12,183, 4, 14, 4,249,104, 88,199, 9, 94,194, 9, 66, 8,186,117,235,
- 6,134, 97,156,110,129,184,137,133, 78,220, 14, 30,244,216, 2,233,149,211,209, 4, 7,149, 74,133,223,126,251,205,121,204,224,
-193,131, 97, 52, 26, 17, 30, 30, 30, 16,103, 69, 69, 5, 41, 41, 41, 97, 22, 47, 94, 12,158,231, 17, 17, 17, 1,165, 82,201, 44,
- 90,180,104,162, 84, 42, 77, 48, 26,141,130,217,108,134, 76, 38,155, 35,222, 31,142,227,116, 90,173, 54,194, 27,167, 68, 34,193,
-179,207, 62,139, 87, 95,125, 21,243,231,207,199, 83, 79, 61,117,153,227,101, 52, 26,209,170, 85, 43,167,216,242, 80, 0, 91, 98,
-184,111,203,114, 10, 4,199, 14,174,199,241, 35,217, 16,236, 2,236, 2, 1, 33,118, 8, 54,224,192,198,221, 29, 46,230,151,196,
- 19,144,134,174,183, 0,228,181,245,182, 1, 17,178,142, 0, 86,110,173, 50,207,246, 23, 78,142,227, 96, 52, 26,241,243,207, 63,
-227,228,201,147, 88,187,118, 45, 12, 6, 3, 90,181,106,133,208,208, 80,220,124,243,205, 24, 51,102, 12,146,146,146,252,198,157,
- 16,178,176,168,168, 40,189,111,223,190, 76, 77, 77, 13,106,106,106, 96, 48, 24, 96,183,219, 97,179,217,192,113, 28,130,130,130,
-160, 80, 40, 16, 29, 29, 13,163,209, 72, 76, 38,211, 66,111,156,130,192,212,234,207, 78,200, 93,183,124,194, 77, 35,223, 32, 88,
-241, 1,131,118,109,228,250,223,246, 7, 63,190,114,251,107,183, 1, 32, 2,113, 90, 11,196,106, 23, 42, 95,157,248,201,243,127,
-250, 61,186, 92,100, 69, 24, 12, 6,212,213,213, 53,216,250, 50, 25, 86,172, 88,209,234,174,187,238,202, 41, 41, 41,233,239, 67,
-108, 93,198, 25, 28, 28,156, 40,145, 72,112,244,232, 81,124,241,197, 23,248,237,183,223, 80, 86, 86,118, 41, 46, 46, 46,100,224,
-192,129,236, 75, 47,189,132,244,244,116,124,253,245,215, 65,254, 56, 9, 33, 40,204,219,134,194,211,219, 33, 8, 13,174,117,195,
-230,249, 59, 9, 48,238, 58,157,206,120,232,208, 33,245,151, 95,126,137,168,168, 40, 36, 39, 39, 67,169, 84, 34, 40, 40,168,209,
- 67,214,245,193,235,175,108, 26, 12, 6, 99, 97, 97,161,250,187,239,190, 67, 68, 68, 4,146,146,146,160, 84, 42, 33,147,201,192,
-113, 28, 24,134,193,226,197,139,177,244,221, 71, 80,120,234, 8, 70,220,121,155,223,112, 42,149,202, 71, 23, 46, 92,216,200, 2,
-137, 14, 11, 3,199,179,144,240, 12,194, 6,223, 11, 0,184,180,233, 39, 95,179, 67,186,114, 50,117,117,117,198, 61,123,246,168,
-247,239,223, 15, 65, 16,144,148,148, 4,189, 94, 15,141, 70,227,140,255,198,141, 27,113,207, 61,247,224,219,111,191, 69, 70, 70,
-134,223,184,215,215,215, 27,143, 28, 57,162, 94,178,100, 9,194,195,195,209,186,117,107,103,220,197,141,231,121, 72, 36, 18,164,
-164,164,160,182,182, 22,106,181,218,239, 61, 58,112,224,128,122,201,146, 37, 8, 11, 11, 67, 66, 66,130,211,113, 19,197,209, 7,
-159,191,219,136, 32,136,137,189,106,206,166,222,119,119,206, 17, 35, 70,160, 93,187,118,208,104, 52, 80,169, 84, 78,110, 95,156,
- 94,180,136, 83,111, 51, 12,179,218,165, 76,100, 50, 12,179,218,245,211,219,113,142,175,253, 39, 78,156,216, 51, 43, 43,107,122,
- 70, 70,198,119, 59,119,238, 92,234,141,207, 27,207,196,137, 19,211,178,178,178,166,187, 30,239,225, 58,222, 29,173,204,204, 76,
-198, 17, 73, 6, 64,114,143, 30, 61,246,109,218,180, 41, 60, 56, 56,216,121,240,249,243,231, 81, 83, 83,131,224,224, 96,205,204,
-153, 51, 53, 3, 7, 14, 68,116,116,180,243, 13, 32, 47, 47,239,134,212,212, 84, 45, 0,119,223, 86, 96, 89, 22,125,250,244,193,
- 49, 71,107,199,176,204, 76, 36, 36, 36, 56, 59,121, 4, 5, 5,225,249,231,159,103,198,143, 31,207,137,110, 6, 33, 4, 6,131,
- 1,177,177,177, 10, 95,174, 14, 0,164, 25, 42,241,211,192,254, 96, 25, 64,127,112, 47,164, 50, 6,172,132, 65,119, 82,133, 95,
- 7,245, 7, 3,192,124,120, 23, 2,112, 97, 14, 2,184,173,101, 28, 14,130, 51,103,206, 4,228,104, 57,226,197, 92, 41,167,232,
-104,236,220,185, 19,118,187, 61, 80, 78,194,178, 44, 84, 42, 21, 98, 98, 98,160, 80, 40,160, 84, 42,153,239,190,251,238,237,228,
-228,228,216,241,227,199,179, 90,173,150,237,211,167, 15,238,187,239, 62, 78,108,226, 76, 75, 75,243, 27,151,173, 91,183,226,139,
- 47,190,192, 83, 79, 61,229,209,209, 98, 24, 6,145,145,145,208,104, 52,184, 86, 32, 0,176,216,172,208,215, 27,156, 77,186,118,
-187, 29, 71,182, 28,238,144,127, 56, 47,109,245,119,223,242, 0, 96,220,242,147,235,105,177,247,125,190, 44,117, 64, 24,191,103,
-235, 37,235, 30, 95,121,158,227, 56,140, 29, 59, 22, 89, 89, 89,120,244,209, 71,177,118,237, 90,188,243,206, 59,248,247,191,255,
-125,153,171,229,239,205,209,106,181,254,247,177,199, 30,123,106,197,138, 21, 29,223,120,227, 13, 86,116,180,148, 74, 37, 24,134,
-129,209,104,132,201,100,130,193, 96,192,169, 83,167,132, 39,159,124, 50,215,108, 54,255,215,107,115, 37,163,248, 93, 41,215,175,
-109,155,192,182,211, 21,124, 20,220,247,230, 36, 3,163,232, 81,123,111,234, 16, 50,124,108, 82, 24, 8, 1, 17, 0,129, 0, 38,
-147, 14,207, 63,255,162,228, 47,188, 85, 78,145,101, 52, 26,113,232,208, 33, 12, 26, 52, 8, 69, 69, 69, 56,113,226, 4, 58,116,
-232,128, 69,139, 22, 69, 62,252,240,195, 57,229,229,229,253, 3,117,182,142, 28, 57, 50,241,198, 27,111,252,180,190,190,190,186,
-190,190,254, 83, 0, 75, 1,212,156, 57,115,166,243,153, 51,103,230,174, 95,191,190,223,228,201,147, 37,110,125,116, 36,222,236,
- 81,171,213, 6,131,193,228, 83, 96,137,191, 9, 17, 2,138, 56,195, 48,164, 99,199,142,184,235,174,187,192,243, 60,148, 74, 37,
-212,106,117,163,102, 51,119,193,229,171,254, 0, 32, 48, 12,131,184,184, 56, 12, 31, 62, 28, 82,169,180, 17,167,152, 15,135, 15,
- 31,142, 23,222,155,132,255,190,112, 43,190,120,172, 3,134,188, 95,230, 51,156,122,189,190,126,243,230,205,138, 87,159,122, 10,
- 55,182,111,143, 86, 26, 13,218, 68, 71, 66, 33,151, 65,234, 26, 38, 38, 32,147,157, 0, 16, 36, 18, 9,186,116,233,130,178,178,
- 50, 20, 20, 20,160,160,160, 0, 44,203,162,111,223,190, 78, 23,230,244,233,211,120,239,189,247, 96, 50,153, 2,142,123,251,246,
-237,113,235,173,183, 66, 38,147, 65,169, 84, 54,106, 50, 20,211,180,174,174, 14,237,218,181,195,202,149, 43,145,154,154,234,151,
-179, 83,167, 78, 24, 48, 96, 64,163,244, 84, 40, 20, 78, 81, 4, 0, 69,123,234,157,215,136,143,143,111, 18,231,134,189,231,241,
-229,198,205, 48,153, 5,104,245,214, 70, 39,196,182,210, 96,251,146, 55, 2,138,187,200,185, 96,193, 2,212,212,212, 56,141, 3,
-241,165, 92, 52, 81, 90,183,110,141,121,243, 60, 59,153,110, 90,196,211, 51, 47, 51,192,231,173,120,156,152,185,228, 89, 89, 89,
-211,221,207,247,199,231,250,191,219,249,102, 55,113, 86,214,164,166, 67,185, 92,254,230,230,205,155,195,107,107,107,113,250,244,
-105,176, 44,235,108, 83,231, 56, 14, 22,139, 5,103,207,158, 69,120,120, 56,202,203,203, 33,151,203, 33,145, 72, 96, 54,155, 1,
-160,187,183, 7, 56, 33, 4, 47, 84, 52,116, 17, 90, 23, 39, 69, 33,128, 59, 43, 26, 10,134,216, 33,254,135, 31,126,128, 90,173,
- 70,112,112,176,243,211, 95, 51,210,145,130, 51, 40,227, 25,176,187,182,129, 97, 1,150, 1, 24, 9,192,178, 4, 44,195,128,221,
-149, 3,134, 1, 84, 17, 97, 77,173,128,253,117,140,247,217, 1,222,155,251,228,201,197,114,255,190,101,203, 22, 4,202,217,174,
- 93, 59,168,213,106,231,182,126,253,250, 70,142,150,221,110, 71, 68, 68, 68, 32,156,164,193,141, 16, 16, 21, 21, 5,158,231,153,
- 69,139, 22, 77, 76,249,127,246,174, 59, 60,138,106,125,191, 51,219,119,147,108, 54, 61, 33, 33,148, 0, 82, 34, 77,225,194,165,
-151, 0, 66,104, 34, 69, 46, 4, 17, 81,138,168, 40, 17,129, 31, 42, 32,161, 73,147, 42,200, 37, 32, 72,151, 46, 69,164,131, 5,
- 20, 36,129, 64, 8, 9,164,111,234,246, 50,237,247, 71,118,227,102,179, 73, 54, 33,194, 5,231,125,158,121,118,167,189,115,206,
-156, 51,103,222,243,157,239,124,211,176, 97,200,244,233,211, 73,129, 64,128,235,215,175, 35, 33, 33, 1,245,235,215,119,219,103,
-171,168,168, 40,235,147, 79, 62, 97, 62,249,164,100, 14, 69,100,100, 36,138,138,138,114,237,251, 53, 26, 77,126,159, 62,125,202,
-248,109,228,229,229, 61,219,158,240,182,251, 72, 91,105, 24, 76, 38,232,180,134, 82,235, 80,110,102,142,234,227, 15, 63, 16, 45,
-155,250, 6, 0,224,195,149,107,160,221,248, 87, 67,118,224,195, 81,129, 67,191,220, 53, 19,192,224,202,248,117, 58, 29, 76, 38,
- 19, 34, 34, 34,112,249,242,101,104,181, 90,244,235,215, 15, 4, 65,148,206, 16,173, 6, 44, 25, 25, 25,157,162,163,163,127, 93,
-177, 98, 69, 68,243,230,205, 9,189, 94, 15,131,193, 0,199,223,155, 55,111,114, 59,119,238, 76, 49, 24, 12,255,182,153,206, 93,
-226, 68,198, 55,201,125, 67,223,220,251,227,117, 65,116, 96,163, 36,101, 70, 97, 4,157,159, 33,213,107,140,119, 76, 12,151, 0,
-142, 1, 24,176,224,104, 22,140,109,216,235,105, 65, 46,151,127,117,241,226, 69, 63,147,201,132,107,215,174, 97,204,152, 49,150,
-188,188, 60, 9, 0,252,231, 63,255,177,108,223,190, 93,210,168, 81, 35,108,219,182, 45,224,213, 87, 95,221,163,215,235, 95,116,
-147,250,219,172,172,172,111,157, 55,250,249,249,173,126,248,240, 97,119, 71,159, 31,154,166, 75,147,227,242,193,100, 1,138,162,
- 96, 52,154, 81, 92,172,133,197, 74,217,218, 76, 22, 12, 67,219,126, 89,208,182,118, 84, 34, 22,122,181,125, 49, 88,199,113, 28,
- 72,130, 40,186,246,103,118,221,202, 68,187,171, 33, 46, 55,173, 89,206, 96,236,179,204,252,252,252, 32, 18,137,240,237,183,223,
-226,198,165, 19,144, 8, 56, 48, 52, 5,154,178,130,161, 44, 16, 9, 4,248,241,250, 3, 68, 53,243,114, 75, 16,250,251,251, 99,
- 64,199,142,136,238,216,177,100,122,155, 80, 8, 79,169, 20, 10,177,172,196,146, 5,128, 99, 72,119,131, 8,176,246,116, 6, 5,
- 5,225,183,223,126,195,180,105,211,176,120,241, 98,200,229,242,210,217,207,183,111,223,198,238,221,187, 17, 21, 21, 85,237,188,
-219, 45,120, 51,103,206, 68,102,102, 38, 86,174, 92,137,151, 94,122, 9, 34,145, 8, 69, 69, 69,248,247,191,255,141,156,156, 28,
-183, 56, 29,135,247, 36, 18, 73, 25,235,147, 93, 0, 86,183,140, 28, 57,223, 24, 18,130, 67,151,118,130, 0,129,171, 59, 62, 40,
- 35, 10,215,239,186, 80,109,206,185,115,231,150, 73,167, 59,214, 44,119,225,100,117,170,242, 56,130, 32,174,217,141,173, 51,103,
-206,156, 69, 16,196,145,153, 51,103,206,138,139,139,187,229, 14,159,171,253, 4, 65, 28,181,137,176, 1, 14,219,174, 85, 75,104,
- 41, 20,138,246,158,158,158,184,119,239, 30,250,245,235,103,201,207,207, 79, 18,137, 68, 77,242,242,242,164,185,185,185, 48, 24,
- 12,186,249,243,231, 63, 0, 32,239,208,161, 67,163, 31,127,252, 17,143, 30, 61,194,246,237,219, 1,224,128,107,159, 13, 18, 44,
-203,150, 86, 10,231,110,155, 64, 32,192,149, 43, 87,112,229, 74, 89,215,175,205,155, 55, 87,249,194,120,245,251,195,184,126,253,
- 58, 28,195, 3,216,255, 59,110,147,201,100, 64,229, 51, 60,202,160, 42,199,248,170, 28,224, 93,193, 93,223, 47, 87, 51,115, 42,
- 66, 70, 70, 70,133,231, 95,185,114,165,140, 69,171, 42, 78,129, 64, 0,134, 97, 32,151,203, 9,177, 88, 76,136,197,226, 48,187,
-200, 18, 8, 4,165, 15,140, 84, 42,133, 84, 42, 45,211, 75,173, 8,153,153,153, 61, 50, 51, 51, 43,220,175, 86,171, 59,169,213,
-106, 60,143,176, 82, 20,140, 6, 11,180, 58, 35, 62,143,251,111,201,198,207,241, 51,128,159, 59,189, 51, 13,147,251, 70,245,172,
-238, 48,181,253,126, 7, 6, 6,226,220,185,115, 32, 8, 2,123,246,236,129,183,183, 55,250,246,237, 11,165, 82,137,153, 51,103,
- 98,248,240,225,213,109,204,138,243,243,243, 59,189,255,254,251,191, 46, 93,186, 52,188,110,221,186,176, 88, 44,176, 90,173,176,
- 88, 44, 72, 78, 78,198,206,157, 59, 31, 25, 12,134, 78, 0,138,171, 34, 59,145,241, 77,242,254,243, 31,102,246, 30,249,170,241,
-118,206, 15,200,206,206, 7, 77,103,128,101,104, 88,105,166,196,194, 71,211,160,105, 6, 98,177, 64,185,244,139, 15, 78,177,224,
- 64,146,132, 5,192, 43, 79,170,140, 84, 42, 85,164, 90,173,198,221,187,119, 17, 19, 19,147,157,159,159,159, 8,160, 23, 0,228,
-231,231, 95, 28, 51,102, 76,243,248,248,248,224, 6, 13, 26,192,211,211, 83,169,215,235,171,162,244, 4, 48, 25, 64, 31,148,248,
-129,216, 81, 0, 96, 62, 73,146,210,107,215,174,149,155,105,119,254,252,121, 0,248,217,117, 15,200,102,209, 50,153,160,206, 47,
-196,132,119,230,252,213, 51, 2, 87, 70, 92,112,224, 48,233, 93,200, 0, 32, 47, 39, 25,111, 76,152, 38,173,170, 67,224,234, 69,
- 88, 13, 31,157, 50, 29, 53,123, 29,245,244,244, 44, 25,126, 59,184, 19, 71,191,124, 7, 96,172,224, 40, 35, 96, 53, 0, 86, 29,
- 88,139, 1,132, 88, 14, 80, 70,183,132,150,167,167, 39, 60,229,114, 4,170, 84,224, 56, 14, 66,129, 0, 34,145, 16, 44, 5, 16,
- 12, 81, 42, 72, 89,247, 2,131,148,118, 42,229,114, 57, 82, 83, 83, 49,121,242,100, 88,173, 86, 12, 25, 50, 4, 22,139, 5, 38,
-147, 9, 70,163, 17, 13, 27, 54,132,193, 96,112,139,207, 62, 91,209,211,211, 19, 98,177, 24, 31,124,240, 1, 94,126,249,101,204,
-155, 55, 15,177,177,177,104,216,176, 33, 38, 77,154,132,157, 59,119, 34, 50, 50,178, 42, 94,206,177,140,236,247,211, 46,182, 28,
-135,248, 0, 84,187,140,156, 57, 9,130, 44, 35,216,236,203,123, 99,123, 85,155,115,209,162, 69, 80,171,213,229, 44, 89,246,255,
-161,161,161, 88,183,110, 93, 77, 71,134,236,214,163, 32, 23,251, 6, 56, 91,162, 56,142,107,103,243,157, 50,199,197,197,221,138,
-139,139,139, 38, 8,226, 72, 92, 92, 92,116, 69, 22, 45, 87, 60, 46,246,187,253,210, 18, 58,141,141,118,119,220,105,191,209,190,
-190,190,130,240,240,112, 82,169, 84,162,168,168, 8, 1, 1, 1,156, 90,173, 30,169, 80, 40, 62,251,238,187,239, 26,233,116, 58,
-220,190,125, 27,171, 87,175,254, 25,192,170,202,132,214,177, 0,155,233,216,102,201,114, 92, 31, 56,112, 32, 26, 52,104, 80,198,
-154, 37,151,203, 43,173, 60,246,125,118,139,144, 64, 32,192, 11, 47,188, 32, 79, 73, 73, 49,138,197, 98,132,133,133,201,179,179,
-179,141, 98,177,184,218, 51, 93,170,114,140,175,202, 1,222,149,240,105,215,174, 93, 25, 11,150,227,175,227,255, 67,135, 14, 85,
- 57,116,104,231,108,222,188,121,233,253,242,242,242,178,159, 11, 0,232,215,175, 31, 88,150,133,191,191,191, 91,156,118, 81,107,
-115,128,135,201,100, 98,181, 90, 45,121,237,218, 53, 72, 36, 18,120,121,121,149,250,234,200,100,178, 82,107, 38, 15, 87, 13, 2,
- 11, 11, 69,193,104, 52, 66,167,211, 1, 0,146,255,220, 87, 86,136,153, 53, 53,230,183, 55,176, 5, 5, 5, 56,113,226, 4,126,
-248,225, 7,188,252,242,203, 46, 69,117, 53, 4,151,186,160,160,160,243,140, 25, 51,174, 46, 88,176,160,142,175,175, 47,172, 86,
- 43, 30, 62,124,136, 45, 91,182,100, 26, 12,134,206,213,105, 96,192, 1, 20, 69,195,100, 48,163, 88,163,197,103, 95,108,173,176,
-234, 1, 64, 65,238, 29, 12, 28, 52, 92,242, 36,203, 41, 51, 51,115,122,231,206,157,191,208,106,181, 69, 6,131, 97, 56,128,101,
-142,253,169,252,252,252, 46,131, 6, 13, 90,225,235,235,251, 82,110,110,238, 44, 55, 40,103,166,166,166,206,170, 87,175, 94,153,
-141,102,179, 25,245,234,213,123, 33, 55, 55,119,116,215,174, 93,255, 15,128,175,195,110, 47, 0, 39, 1,172,171,168, 46,217,135,
- 14,117, 58, 35,148,170, 16,100, 60, 56, 87,101, 66,196, 2, 19, 56,150,173,180, 13,177,119,128, 43, 90,170,152, 25, 87, 46,169,
-246, 99,237, 47,236, 87,134,141,197, 43,147, 23, 65, 33, 2, 22,190,209, 9, 13, 85, 0,228,190, 16,119,253, 24,132,202,118,143,
- 38, 31,118,139, 60,118,195, 6, 92,183,181,199, 97, 1, 1,152, 49,114, 36, 56, 10,184,156,144,128, 93, 63,253,132,145, 61,122,
- 64, 33,147,185,221, 97, 97, 89, 22, 98,177, 24,201,201,201,184,124,249, 50,154, 53,107,134,123,247,238,149, 9, 67,193,113,156,
-187,249, 47,205,187, 84, 42,133, 72, 36, 66,118,118, 54,162,163,163, 33, 22,139,177,117,235, 86,156, 59,119, 14, 51,102,204,192,
-248,241,227,209,189,123,119, 36, 38, 38,186,197,201,113, 92,185,217,138,206,195,185,213, 45, 35,103, 78,231,247,126, 77,202,221,
-206,185, 96,193, 2,151, 19, 42,220,225,116,165, 69, 92,148,221, 53, 71, 49,100,183, 60, 57, 10, 35,231,117, 0, 62,246,109, 51,
-103,206,156,229,238,121,142,235,118,139, 88,117,134, 48, 75,133, 86,116,116,116,153,156, 23, 20, 20, 92,189,122,245,106, 11, 15,
- 15, 15,220,185,115, 71,162, 84, 42, 91,216, 27,116,146, 36,177,103,207, 30,175,254,253,251,159, 90,182,108, 89, 24,203,178,200,
-201,201,193, 71, 31,125,164,163,105,122, 20, 0,186,162, 23,120, 85,150,169,195,135,203, 63,108, 7, 15, 30,116,107, 8,196, 46,
-164,132, 66, 33,124,124,124,140, 70,163, 17, 10,133, 2, 62, 62, 62, 70,131,193, 0, 15, 15, 15,251, 88, 49,137,191,102, 42, 84,
-101,125,170,202, 49,222,217, 1,190, 74, 36, 36, 36,184,117,156,109,168,213,173, 90,158,154,154, 90, 97, 67,114,238,220, 57,176,
-182,134,214, 93, 78, 91, 47,143,179, 11, 63,133, 66, 1, 95, 95, 95, 72,165, 82,200,229,242, 50, 34, 75, 42,149, 86,249,224, 84,
- 21,144, 84, 38,147,253,226,225,225,161,178,239, 23,137, 68,208,106,181, 69, 5, 5, 5,237,159,233,161, 67,112,160,173, 52,140,
- 70, 19,116, 90, 99,173,243, 91, 44, 22, 72,165, 82,236,220,185, 19,157, 58,117, 66,135, 14, 29,202,137,172, 26,154,231,211, 11,
- 10, 10,186,175, 90,181,234,231,229,203,151,251,232,116, 58,252,247,191,255, 45,214,233,116,221, 1,164, 87, 75,108,178, 28, 40,
-171, 21, 6,147, 25,122, 93,201, 61,184,127,107,223,255, 90, 81,237,204,206,206,222, 89,201,254,251, 52, 77, 71,219,227,190,185,
-129,127,213,171, 87, 15,217,217,217,101, 54,166,165,165,129, 97, 24, 51, 74,226,100,189,233,104, 72,198, 95,209,179, 43,234,197,
-151, 88, 71,141,102,232,116, 37, 86, 16,147, 62,175,118,234,169, 77,108, 84,228,147, 85,147, 58, 68, 16, 68,169,211,247,212,169,
- 83,113,243,198, 13,244,170,163, 65,195, 96, 47,112,154, 12,136,123,126,138, 63,212,114, 44, 91,113,172,218,220,187, 29, 92, 32,
-150,237,222,237,114,223,253,193,131,171,149,247,164,164, 36,200,229,114, 48, 12, 83,238,125, 83,221,252, 59, 10,152, 21, 43, 86,
- 96,198,140, 25,216,186,117, 43,110,222,188,137,214,173, 91,163,119,239,222,200,205,205,197,141, 27, 55, 96, 54,155,221, 78,167,
-163,223, 92, 82, 74, 2, 78, 95, 62,142,180,244, 7,200,204,126, 84,227,114,119,228,116, 22, 90,251, 79,255,142, 97, 81,109,107,
-196,249,217,103,159, 33, 55, 55,183,140, 37,203,177, 93,170,200,162,229,172, 69,156,144,231,228, 11,101, 95,183, 56,137, 30,231,
-117,231,227, 1, 32, 23,128,160,138,243,156,215,243,226,226,226,206,218, 45, 97, 54, 94, 65, 85,254, 89,101, 44, 90, 78, 88, 52,
-120,240,224, 65,171, 87,175, 14,144,201,100,165, 51,144,102,206,156,137, 25, 51,102, 32, 34, 34, 2,254,254,254,161, 42,149, 10,
-249,249,249, 88,188,120, 49, 82, 83, 83, 39,194, 69,160, 61,103,161,213, 37, 69, 11,137,228,175, 14,171,221,178, 5, 0,227,199,
-143, 47,103,209,178, 23, 80,101,160, 40, 10,126,126,126, 48, 24, 12, 16, 8, 4, 24, 50,100,136,224,207, 63,255,100,250,246,237,
-139,161, 67,135, 10,110,220,184,193, 12, 24, 48, 0, 2,129, 0, 61,123,246,212,236,223,191,255, 67, 0, 95,186, 33,182,106,205,
- 49,222, 94,201,220,141,125,228,142,184,172,140,147, 32, 8, 24, 12, 6, 8,133,194, 82, 71,121,119, 56,237, 67,135,142, 15, 32,
- 73,146, 80,169, 84,165,141,135,221,162,101, 23, 90, 85,241, 86, 21,144, 84,161, 80, 40,239,220,185,211,200, 62,241, 34, 47, 47,
- 15, 61,123,246,188, 91, 80, 80,240,108,155,180, 88,192, 74, 51,208, 25, 77,208, 25, 13,181, 70,107,127, 30, 54,110,220,136,196,
-196, 68,152, 76, 38,124,245,213, 87,165,147, 10, 28, 69,214, 99, 8,174,100,185, 92,206,246,235,215, 15, 87,175, 94,133, 84, 42,
-165, 80,131,248, 87, 44,199,194, 74,211, 48, 25,141,208, 85, 61,228,246,188,160, 84, 85, 39, 38, 38,194, 98,177, 96,222,188,121,
-204,175,191,254,122, 22, 37, 1, 80,237, 22,188,209,221,186,117,155,239,225,225,161, 58,122,244,232,123, 0,182, 86,246,242,166,
-104,155,104,175,197,251,232, 56, 34,224,202, 39,171, 38, 97, 86, 28, 95,172, 44,203, 98,226, 91,111,161,119, 29, 13,134,190, 20,
- 0,125,214, 93, 40,188, 3, 64,168,234, 99,217,138, 99,184,149,226,182, 43, 38, 7, 0,253,186, 13, 70,171,102,229,195,131,117,
-238, 85,210, 39,187,248,227, 47,200,201,203,172,118,222,245,122,125,133,150,171,106, 88,180, 74,159, 57,251,253,107,211,166, 13,
-154, 52,105,130,179,103,207,162,109,219,182,184,119,239, 30,238,221,187,135,212,212, 84,220,188,121, 19,133,133,133,213, 46,163,
-239, 79,238, 66,161,182, 0, 18,177, 4, 5, 69,121, 72,203,120,128, 32,191,224,199, 46,119, 59,154, 14,248, 12, 0, 80, 39,192,
-187, 90, 66,203,145,115,201,146, 37,229,196,251,227,134,236, 33, 8,226,151,202,214,171,123,254,147, 68, 69, 66,235,129, 90,173,
-238, 48,114,228,200,153, 0,218,217,182, 21, 3,216,125,234,212,169,193,129,129,129, 61, 58,118,236, 40,148, 72, 36,184,124,249,
- 50,246,239,223,191, 21,192,174,202, 46, 36,145, 72,140,245,235,215,151,219, 43,162,253, 65, 84, 42,149,130,197,139, 23, 19,155,
- 55,111,174,208,202, 85, 85, 1, 21, 23, 23, 67,175,215,195,219,219, 27, 86,171, 21,253,250,245, 99, 18, 19, 19, 33, 22,139, 49,
-104,208, 32, 38, 33, 33,161,180,160, 55,109,218, 20,102, 52, 26,255,253,195, 15, 63,244, 1,208,181, 26,247,202,238, 24,239, 9,
- 55, 29,224, 43,234,229,185, 3,119,135,227, 42,226,156, 54,109, 90,141, 56,197, 98, 49,109,143,252, 78,146, 36,172, 86, 43,218,
-182,109,139,220,220,220,210,135,198,195,195,163, 84,100,185, 35,180,170, 10, 72, 42, 20, 10, 97,177, 88,208,181,107, 87, 16, 4,
-129, 53,107,214, 60, 31,195,145, 44, 75,120,122,250,161, 78,157, 23, 16, 16,104, 2,203,214,238, 87,101, 98, 99, 99,203,136, 41,
- 87,145,151,237,247,191, 38,176,115,185, 51, 75,182,178,183,163,125,200, 75,175, 55, 61,115, 69, 24, 24, 24,216, 33, 55, 55,247,
-160,211,230, 2, 0,243, 43,233, 88,150, 22,244,163, 71,143,208,183,111, 95, 28, 63,126, 92,112,224,192,129, 94,135, 14, 29, 74,
-184,123,247,238,163,182,109,219,214,125,251,237,183,165, 93,187,118, 69, 94, 94, 30, 94,122,233,165,207, 51, 50, 50, 42, 17, 90,
-182,251,104, 50, 67,175,175,125,235,168, 43,107,214,227,188, 24,237,117,114,238,220,255, 67,239,144, 34, 12,105,237,141,248, 35,
-151, 48,186,141, 28,176, 72,171,205,103, 79,139,111,157, 6,168, 31,217,161,220,126,169,178, 36,150,107,253,200, 14, 32, 31,221,
-171,118,222, 29,211,236, 44,170,106, 98,209,115,188,159, 19, 38, 76,192,199, 31,127,140, 62,125,250,224,222,189,123, 56,127,254,
- 60,238,221,187,135,105,211,166, 33, 50, 50, 18,173, 91,183,174, 22,231,161,211,123,161,209, 21,131, 36, 72, 20, 20,231,195,100,
- 54, 34,118,210,220,199, 46,247,210,151,255,233, 56, 0,192,190, 83,215,107,204, 57,123,246,108,100,103,103,151,177,100, 61,142,
- 95,214,179,142,202,162,165, 61, 0, 48,209,121,163,197, 98,241,154, 55,111, 94,148,191,191, 63, 8,130,192,138, 21, 43,224,235,
-235,219, 9,192, 45,139,197,146,167,215,235,103, 56,136,144,222,176,197,218,200,201,201,113, 57,111, 95,175,215, 91,163,162,162,
- 68, 33, 33, 33,101,102, 27,122,120,120, 84,100,221, 41,229,180,239,163,105, 26,177,177,177, 88,184,112, 33,194,195,195, 49, 96,
-192, 0, 68, 71, 71,131, 32, 8,244,235,215, 15, 3, 6,252, 53,148,171, 82,169,196,199,143, 31,239, 70,146,100,130,195, 11,164,
- 12,167, 43,216, 29,227, 41,138,114,215, 1,190, 12,167,189,178, 77,155, 54, 13, 11, 23, 46,196,172, 89,149,187,122,108,216,176,
- 1, 40,239, 79,245,183,115, 22, 20, 20,148,105,236, 21, 10,197,154,161, 67,135, 10, 31, 61,122, 84, 70, 92, 57, 46, 46, 26,162,
- 50,156, 85, 5, 36, 21, 8, 4, 8, 10, 10,194,130, 5, 11,224,231,231,135,224,224, 96, 87,129,252,170, 44,163, 26,224,111,229,
-100, 56,246,218,210, 69,255,215,249,191,219, 15,137,164, 18,224,202,249,125,208, 20,150, 29, 78, 50, 91,255,154, 74, 45,105,219,
- 11,150,235, 63,186, 85,151,236, 98,250,179,207, 62,195,103,159,125, 86,105,130, 54,110,220,248,216,121,119, 83,108,149,231,100,
- 57, 66,225,225, 3,153, 71, 29,180,136,244, 1,203,209,255, 83,101, 84, 1,126,253,229,151, 95, 6,249,249,249, 33, 61, 61, 61,
- 64, 36, 18, 13, 42, 99,174, 50, 26, 81,191,126,253, 23,212,106,245,191,171,226,156, 54,109,154,121,206,156, 57,210, 81,163, 70,
- 97,232,208,161, 24, 53,106,148, 84, 44, 22, 55,230, 56, 14, 86,171, 21,233,233,233,248,241,199, 31,161, 86,171,111, 87,150, 78,
-150,227, 8,185, 66, 5,153, 71, 8, 90,188,168, 2,203,210,181,146,119, 71,171,184,163, 53,171,154, 34,203,101,253, 4,128, 95,
-127, 60,136,185, 31,188,136,173, 71,127,198,234, 95,128, 86,170, 92,180, 8, 80,131, 85,223,198, 71,163, 95,198,178, 29,191, 1,
- 0,206,159,171,178,140,184,202,234,160,201,104,125,172,188, 59, 90,174, 28,175,227,134,143, 86, 57, 78,123, 39, 81,171,213,162,
-168,168, 8,241,241,241,120,227,141, 55,144,155,155,139,212,212, 84,220,189,123, 23,223,125,247, 29, 20, 10, 69,141,202,232,195,
-183,102, 99,206,178,233,224,192,161,105,163, 22,152, 57,249, 51,180,107,213,241,177,203,221, 25,110, 88,179, 42,228, 92,185,114,
-101, 77,235,210, 63, 78,104,185,132,191,191,255,168,110,221,186,193,100, 50, 33, 32, 32, 0,169,169,169, 32, 73, 50, 2, 40, 25,
-194, 11, 13, 13,221,173, 86,171, 35,220,229, 19, 8, 4,160,105,186,212,247,199,190, 0,192,192,129, 3,113,248,240,225, 42,123,
- 20,193,193,193,168, 91,183, 46,222,127,255,253,114,179, 28, 28,103, 58,200,229,114, 28, 61,122, 52,187,160,160,160,128,227,184,
-106, 77,115,179, 59,198, 95,188,120,209,109, 7,120, 71, 88,173,214, 71,119,239,222, 13,217,184,113,163,160,146,151, 95, 41,206,
-159, 63, 79,163,138,161,154,191,131,211, 85,207,148,227,184, 10, 69,150, 59, 97, 4,170, 10, 72, 42, 20, 10,145,148,148,132,185,
-115,231,130, 32, 8,236,219,183,239,185,120,184,254,188,147,191,153, 36, 73,159,129,175,116,110, 9,130,128,213, 82,126,164,218,
-179, 80, 87, 42,178,134,126,185, 11, 7, 62, 28,233,142,232, 73,190,112,225,130,239,198,141, 27,133,238,148,251,133, 11, 23,104,
-142,227,170, 61,236,103,127,225, 88,173, 86, 24,141, 53,179,162,112, 28,119, 57,238,139, 57, 81,219,190, 61, 38, 34, 8, 11,174,
-156,219,135,226, 34,215,238, 12, 18,145, 16,155,227,247,211, 98,145,224,209, 83, 46,186,181, 67,134, 12, 25,245,213, 87, 95,181,
-112,181,211,141, 73, 48,169, 38,147, 9, 25, 25, 25, 48, 24, 12,123, 63,249,228, 19,235,177, 99,199,222,124,245,213, 87,209,186,
-117,107,132,132,132, 32, 43, 43, 11,201,201,201,136,143,143,231, 46, 93,186,180, 23,192,148, 42,238,227,193, 69, 95,204,137,137,
-223,113, 76, 66, 18, 86, 92, 57,191, 15,197, 78,162,189,188,117, 90,132,111,182,238,183,138,197,162, 59, 85, 89,139, 28,173, 89,
-181,249, 98, 28, 52,102, 50,134,174, 90,141,136,118,125,177,104,113,111,124,243,197,112, 44,239, 39,134,117,207,104,180,122,109,
- 27,118,206,235, 15, 0,168,243,141,155,214, 18,161, 24, 15, 93, 88,172,138,138,101, 54,113, 83, 61,171,169, 61,239,149, 89,174,
-170,107,209, 34, 73, 18, 13, 26, 52, 64, 68, 68, 4, 58,117,234,132,182,109,219,162, 71,143, 30,184,113,227, 6,110,220,184,129,
-105,211,166, 85, 38,178,170, 44,163,238,255,142,194,207, 93,238, 60,118,217, 56,151,123,109,192,157,186, 52,121,242,100, 0,248,
- 71, 89,183,170, 45,180, 52, 26,205, 13,150,101, 91,122,123,123,219, 45, 82,165,251,210,210,210,192,178,172,161,186, 5, 99,177,
- 88,236,193, 49,203,196,101,178, 59,199, 87,246,224,115, 28,199, 20, 20, 20,160, 91,183,110,232,210,165, 75,233,240,137,227,226,
- 32, 76,112,224,192, 1,112, 28, 87,109, 39,107, 7,199,120, 29,170,233, 0, 15, 0,185,185,185,125,187,118,237,122, 74, 40, 20,
-186,245, 21, 77,150,101, 83,115,114,114, 94,121,210,156,174,202,135,101,217, 10, 69,150, 59, 13, 81, 85, 1, 73,133, 66, 33, 60,
- 60, 60,240,253,247,223,195,223,223,255,185,122,192,110, 36,170,151, 84,182,191,155,159,228, 28,128,128,161, 95,238,122,120, 46,
-223, 90,111,232,151,187,210, 14,124, 56, 50,188,178,115,178,179,179,251,140, 28, 57,242,184,187,229, 78,211,244,131,236,236,236,
-106,135, 75,224, 56, 14,119,238,220, 97, 39, 76,152,144,167, 86,171,135,215, 36,255, 51,231,174, 94,190,240,243,169,126,253,162,
- 58,180, 3, 9, 88, 42,118,254,229, 8,128, 19,138, 4,143,102,204, 90,249,214,240,225,195,159,102,177,105,178,179,179, 59, 13,
- 27, 54,108, 10,254,114,157, 40, 35,164, 80,193,236,106, 27, 86,213,173, 91,247, 69,129, 64, 32, 5, 48, 23, 64,218,165, 75,151,
-214, 94,186,116,169, 15,128,127, 9, 4,130, 16,134, 97, 50,108,157,158, 93, 0,254,168,186, 30,229,190, 13,142, 13,235,215,251,
- 95,125, 65, 16,156,197, 98,174,162,131, 4, 14, 28,199,137,197,162, 59,191,222,200,106, 85, 89, 71,202,225, 11, 28,181, 62,100,
- 63,101,202, 20, 76,153, 50,165,180, 62,173, 89,211, 5,123,255,188,136,215, 90,165,195,252,117,103, 16,202,112,183, 59,124, 0,
- 48,251,255, 38,212, 90,218, 28,243,238,104,209,114,245, 28, 84,199, 71, 75, 32, 16, 32, 47, 47, 15, 73, 73, 73,200,201,201,129,
-193, 96, 64, 98, 98, 34,172, 86, 43, 10, 11, 11,241,226,139, 47,214, 56,157,181, 85, 70, 79,147,243,159, 56,124, 88,109,161,101,
-181, 90, 63,109,208,160,129, 72, 38,147,181, 96, 24, 6, 28,199,129, 97, 24,206, 38,106,170, 61, 11, 79, 36, 18,153,154, 52,105,
- 66,184,154,157, 96,255,239,225,225, 97,172,196, 90, 18, 87,191,126,253, 79, 8,130, 16, 84,212, 11,177,255,103, 89,150, 17, 10,
-133,113, 53,188, 87,143,235, 24,175, 87,171,213, 29,107,185,252,254, 14, 78,231,242,209, 55,107,214,172,244,139,246,206, 49, 81,
-108, 31, 91,213, 87, 33,206, 43, 13, 72,170,215,235,179,250,246,237,203, 56,238,119, 12,104,250, 92,131,224,210,250,143,122,179,
-222,185,124,107, 61, 0,176,139, 45,112, 92, 90, 37,103, 25,179,179,179,187,253,221, 73, 75, 73, 73,177,252,235, 95,255,250, 86,
-171,213, 78, 6, 80, 99,111,254, 89,159,174,153,245, 12,150,140, 6,192,194, 26,158,155,150,159,159,223,211,105,219, 31,118, 65,
-101,143,107, 87,109,209,126, 59,175,214, 99,139,209, 52,157, 30, 17, 17, 81, 45,203, 13, 69, 81,233, 85,237,119,142, 17,230,136,
- 91,240,198,172,171, 64,201,228,239,124,183, 56, 77, 38, 83, 65,199,142, 29, 69,213,204, 91,174,187,121, 15, 9, 9, 65,157, 58,
-117, 74,127,237,112,222, 94, 85, 58,105,154, 78, 15, 11, 11,131,191,191,127,133, 17,223,157,125,178,220,225,172,237, 50,170,140,
-179, 78,157,109,181,206, 89,211,116,242,112, 15,189,121, 78,158,147,231,124,102, 57, 5,252,253,228, 57,121, 78,158,243, 9,114,
- 62,151,224,189,212,120,240,224, 81, 17, 24,254, 22,240,224,193,131,199,227,129,168, 68,149, 86,103,166, 79, 77,148,237,105,158,
-147,231,228, 57,121, 78,158,147,231,228, 57,255,113,156, 85,113,215,246, 76,227,231, 26,188, 89,149,231,228, 57,121, 78,158,147,
-231,228, 57,121,206,127, 44,248,161, 67, 30, 60,120,240,224,193,131, 7, 15, 94,104,241,224,193,131, 7, 15, 30, 60,120,240, 66,
-139, 7, 15, 30, 60,120,240,224,193,131, 7, 47,180,120,240,224,193,131, 7, 15, 30, 60,120,161,197,131, 7, 15, 30, 60,120,240,
-224,193,131, 7, 15, 30, 60,120,240,224,193,131, 71, 9, 8, 0, 56,114,228, 72,233, 7, 1,163,163,163, 9,254,182,240,224,193,
-131, 7, 15, 30, 60,158, 36,158,107, 45,226,152, 57, 30, 60,120,240,224,193,131, 7, 15, 94,139,212, 14, 72, 94,108,241,224,193,
-131, 7, 15, 30, 60,120,177,197,103,140, 7, 15, 30, 60,120,240,224,193,139,172,103, 10,101, 44, 90,188,224,226,193,131, 7, 15,
- 30, 60,120, 60, 77,177,245,140,106, 17,206,182, 56,174,243,224,193,131, 7, 15, 30, 60,120,240,120, 76,129, 85,217, 47, 15, 30,
- 60,120,240,224,193,131, 7,143, 90, 18, 92,246,255, 79, 76,104,241, 95, 54,231, 57,121, 78,158,147,231,228, 57,121, 78,158,243,
- 31, 11, 33,127, 11,120,240,224,193,131, 7, 15, 30, 60, 30, 27,142, 86, 44,130, 23, 90, 60,120,240,224,193,131, 7, 15, 30,181,
- 39,178, 8, 87,235,252,183, 14,121,240,224,193,131, 7, 15, 30, 60,254, 38,240, 22, 45, 30, 60,120,240,224,193,131, 7,143,199,
- 3, 1,126,232,144, 7, 15, 30, 60,120,240,224,193,227,111, 21, 91, 46, 55, 86, 52,115,224,116, 53,200,107, 50,251,224, 52,207,
-201,115,242,156, 60, 39,207,201,115,242,156,255, 56,206,170,184, 79,227,217, 67, 55, 0,103, 1,116,183,253, 86, 40,188,106, 27,
-252,212, 87,158,147,231,228, 57,121, 78,158,147,231,228, 57,159,119, 84, 24,168,148,119,134,231, 81, 21,132,168,124,136,185,170,
-253, 60,120,240,224,193,131,199, 63, 77,108, 17,225, 72,218, 0, 0, 32, 0, 73, 68, 65, 84,113,142, 47, 73, 87,104, 12, 96, 22,
- 0,111,135,109,191, 0,136,115, 58,110, 7, 0,133,195,186, 30,192, 60, 0,247,170, 76, 13,199,137,109,252, 82,219,194, 2, 48,
- 1, 48, 3,208, 18, 4, 65,241,101,246,212,209, 17, 64,180,237,255, 17, 0, 87,170,185,255,185, 66, 72, 72,136,220,199,199,167,
-207,245,235,215, 37,137,137,137,184,112,225, 2,183,121,243,102,107, 97, 97,225,201,172,172, 44, 35, 95, 93,158, 11,244, 5, 48,
-211,246,127, 17,128, 19,143,201, 71, 40, 20,138,105, 30, 30, 30,253,165, 82,105, 29,154,166, 9,131,193,144,169,215,235, 79,209,
- 52,253,165,173,221,171, 46, 6,251,250,250,190,217,180,105,211,198,169,169,169, 25,153,153,153, 59, 0,236, 1, 48,188, 78,157,
- 58,163,235,215,175, 31,122,231,206,157,123, 5, 5, 5,223, 0, 56,248, 20,211,201,131,199, 63, 9, 68,101,214, 8, 87,152,203,
-113,220,232, 50, 12, 68,121,142,158, 61,123, 14, 58,121,242,164,130,101, 89,216, 23,185, 92, 78, 3, 24, 87,133,200,242,187,124,
-249,114,189,201,147, 39, 15,205,204,204,124, 89,171,213,182, 7, 0,133, 66,241,115, 96, 96,224,175,171, 86,173,250,142,227,184,
-116,130, 32,180,213,204,168, 80, 36, 18,189,225,227,227,211,159,166,233,182, 28,199, 65, 36, 18, 93, 47, 44, 44, 60, 65, 81,212,
- 55, 0,106, 34,222, 36, 66,161,112,138, 84, 42,237, 75,211,116, 75, 0, 16, 10,133, 55,205,102,243, 9,154,166,215, 2,176,212,
-128, 83, 38,145, 72,166, 40,149,202, 40,139,197,210, 18, 0, 36, 18,201, 77,141, 70,115,202, 98,177,172,181, 9,206,167, 13, 33,
-128,104,142,227, 68, 0, 32, 16, 8, 6,183,111,223,190, 30, 65, 16, 44, 65, 16, 28,199,113,196,207, 63,255,220,134, 97, 24,210,
- 86, 63,162, 1,252, 10,128,126, 22,159, 16,127,127,255,133, 44,203,214,169,180,208,100,178,151,175, 95,191,222,116,247,238,221,
-204,215, 95,127, 93, 52,126,252,120,207,201,147, 39, 11,215,172, 89,179, 54, 43, 43,235, 61,231,227,253,252,252,150,147, 36,233,
-239,206,245, 89,150,205,203,207,207,159,254,180,242, 31, 19, 99, 42, 99,238,142,143,151, 53, 2,144, 94,195,250,253,247,113,154,
- 98, 56, 0,136,151,197, 55,138, 49,197, 36,219,255, 63, 46,175, 3,102,174, 59,173,237,202,113,192,148, 40, 47,242,113,133, 86,
-104,104,104,124, 76, 76,204,168,150, 45, 91, 10, 57,142, 3, 69, 81, 48,155,205, 77,175, 92,185,210,125,223,190,125, 47,107,181,
-218,225,213,164,124,235,227,143, 63, 94, 48,127,254,124,127,145, 72, 68, 80, 20,213,104,247,238,221,109,223,126,251,237,247, 55,
-110,220, 88,119,196,136, 17, 94,246,237,115,231,206,109,183,104,209,162,134, 0,190,124, 10,233,228,193,227,159,134,110, 40,235,
-163,245, 57,128,207, 42, 19, 90, 30,182,151,103,142,205,146, 5,135,223, 82,156, 57,115,230,144, 80, 40,180, 91,180,218,235,245,
-250, 32, 39, 43,152, 43,145, 85,127,204,152, 49, 29,247,238,221,187,112,196,136, 17,217, 10,133,162,201,171,175,190,170, 37, 8,
- 66,176,123,247,238, 54, 17, 17, 17,242,129, 3, 7,142,233,217,179,231,135, 28,199, 93, 32, 8, 66,237,102, 38, 91,248,250,250,
-238, 95,178,100, 73,189,190,125,251,138,253,253,253,193,113, 28, 50, 51, 51, 67,143, 30, 61,218,239,243,207, 63,255,176,160,160,
- 96, 8,128,132,106,220,184,118,114,185,124,239,231,159,127, 30,210,175, 95, 63, 97,112,112, 48, 76, 38, 19, 18, 19, 19,123,159,
- 56,113,162,235,198,141, 27,223, 51, 26,141,175,217, 4,134,187,104,239,237,237,189,239,191, 31,127, 28,212,225,141, 55,132,190,
-190,190,224, 56, 14,106,181,186,247,197,109,219,186, 79, 90,178,228,189,226,226,226, 97,174,238,247,211,132, 68, 34, 33,183,111,
-223,222, 90, 34,145, 0, 0, 44, 22, 11, 34, 35, 35,137,231,229, 9, 33, 8, 34, 44, 51, 51,211, 91, 44, 22,187,220,207, 48, 12,
-186,118,237,218, 64, 44, 22,227,203, 47,191,164,242,242,242,218,124,245,213, 87,215,119,238,220,233,191,118,237,218,215, 0,148,
- 19, 90, 36, 73,250,167,167,167,187,228,100, 24, 6, 86,171, 21, 52, 77,195, 98,177,160,121,243,230, 79, 53,255,241,241,178, 48,
- 0,211, 99, 98, 76, 31,216, 54,125, 9,224, 67, 0, 41,168,225, 55,187,254, 6, 78,199,250,182,220,225,255, 99,167,213, 1,245,
- 0,224,216, 13, 19, 0,248, 62,238,125,245,240,240,104,246,250,235,175, 11,213,106, 53, 68, 34, 17,172, 86, 43,178,179,179, 17,
- 25, 25, 41,248,246,219,111, 95,168, 46, 95,163, 70,141,198, 47, 90,180, 40,224,216,177, 99,214,237,219,183, 91,162,162,162, 68,
-227,199,143, 87,118,237,218,181,121, 88, 88, 24,185,101,203, 22,243,169, 83,167,168, 49, 99,198, 72,226,226,226, 2,142, 30, 61,
- 58, 48, 33, 33,225,203, 39,157, 78, 30, 60,254,129, 56,139,191, 66, 60,216,127, 43, 21, 90,112, 16, 87,131, 1, 64, 36, 18,181,
- 9, 10, 10,138,167,105, 58,216,102,213,201,206,201,201,249,146,162,168,223,109,199, 30,100, 89,118, 80, 85,150,172, 49, 99,198,
-116, 60,126,252,248,178, 43, 87,174, 20,231,231,231, 7, 31, 58,116,200,244,225,135, 31,166, 2, 64, 74, 74, 74,195,129, 3, 7,
-134, 78,157, 58, 53,189, 79,159, 62,171,122,244,232,241, 46,199,113,167, 8,130,208, 87, 37,178, 34, 35, 35, 47,159, 63,127,222,
- 75,165, 82,149,217, 81,191,126,125,188,251,238,187,226, 65,131, 6, 69,244,234,213,235, 82,114,114,114, 23, 0,127,186, 35,136,
- 26, 55,110,124,250,204,153, 51,158, 62, 62, 62, 40, 42, 42, 66,118,118, 54, 12, 6, 3,148, 74, 37, 70,140, 24, 33,238,214,185,
- 83,221,169,211,222, 59,157,158,145,209,219, 77,177,213,190, 83,139, 22,167,119,198,197,121, 82, 15, 31, 66, 46,151, 67,167,211,
- 1, 0,188,188,188,240,114,131, 6,194,223,182,109, 11, 29, 29, 27,123,250,215,164,164,222, 79, 73,108, 73,109,191,102, 0, 71,
- 4, 2,193, 96,137, 68, 66, 14, 30, 60, 24,167, 79,159, 38, 76, 38,147,208,102,221,161, 7, 15, 30, 12,185, 92, 14,139,197,194,
-162,100,232,144,126,150,159, 18,137, 68,130,228,228,228, 50,219,180, 90, 45,212,106, 53,242,243,243, 97, 54,155, 81, 84, 84, 4,
-150,101, 9,185, 92,174,102, 89, 22, 36, 73, 58, 11,128, 50, 16,139,197, 72, 74, 74, 42,179,141,166,105,232,245,122,152,205,102,
- 88,173, 86,104,181, 90,185,151,151, 87, 99,127,127,255,116, 0, 7, 11, 10, 10,190,204,201,201, 73,123,194,217,207,179, 11,162,
-248,120,217,125, 0,146,255, 69, 78, 7, 75, 86,168,109,253,143, 90, 74,171, 29, 15,143,252,110, 10,183, 89,199, 30,212, 2, 31,
- 11, 0, 23, 46, 92, 64, 78, 78, 14,242,242,242,160, 86,171, 17, 22, 22, 6,142,227,170, 61, 28,151,156,156,188,238,197, 23, 95,
- 36,110,221,186,117, 2,192,154,221,187,119,143, 43, 40, 40,152, 57, 99,198, 12,223,165, 75,151, 22,196,198,198, 46, 2,176,117,
-247,238,221,239, 52,107,214,172,255,237,219,183, 55, 62,141,116,242,224, 81,219,224, 56,174, 29,128, 0,123,219, 98,107,119,253,
- 28,214,111, 16, 4, 97,113, 56,206, 98,107, 27,156,127,237,176,175,171, 9,130,248,213,225, 60, 53, 65, 16,191,214, 52,153, 78,
-191, 37,157,110, 0, 56,114,228, 8,103, 95, 92,157, 25, 24, 24, 56,173,103,207,158,203,174, 93,187,214, 60, 43, 43,203, 39, 43,
- 43,203,231,218,181,107,205,123,246,236,185, 44, 48, 48,112,154,195,141,112, 62,245,180,195, 62,241,229,203,151,235,237,223,191,
-127,209,233,211,167,139,219,180,105, 99, 57,115,230, 12,221,167, 79,159, 92,219, 11,154,238,211,167, 79,238, 79, 63,253,196,116,
-232,208, 65,126,252,248,241, 71,151, 46, 93, 90,190,119,239,222, 32,142,227, 4,174, 56,109, 16,169, 84,170,239,207,157, 59, 87,
- 78,100, 57,162,110,221,186, 56,114,228,136, 82,165, 82, 29, 4, 32,174, 40,157, 54,200,100, 50,217,190,159,126,250,201,211,203,
-203, 11,185,185,185, 16,137, 68, 8, 12, 12, 68,113,113, 49,178,179,178,144,118,247, 46, 72,139, 5, 43,190,152,239, 37,151,203,
-247,186,104,236,203,113,122,123,123,239,219,185,112,161,103,254,233,211,248, 99,193, 2, 88,173,214,210, 33, 87,171,213,138, 75,
-147, 39, 67,253,227,143,216, 50,119,174,167,183,183,247, 62, 0,178, 42, 56,107, 3,142,156,147, 1, 20,216,150,201, 0,174, 68,
- 70, 70, 94, 75, 76, 76, 68,151, 46, 93,176,103,207,158, 86, 51,102,204,152, 60, 99,198,140,201,123,246,236,105,213,165, 75, 23,
- 36, 38, 38, 34, 50, 50,242, 26,202,250,103,253,221,233,252,219, 56, 25,134, 41,179,176,236, 95,239,152, 58,117,234,228,238,223,
-191, 31, 35, 70,140, 32, 37, 18, 73,214,200,145, 35,165, 23, 47, 94,228,108, 34,211,237,116,154, 76, 38, 24,141, 70,232,245,122,
-164,164,164,200,151, 44, 89,210,249,179,207, 62,107,116,250,244,233,208, 89,179,102, 77, 10, 8, 8,184, 30, 20, 20, 84,239, 9,
-231,221,234,244,127, 5,128,140,106, 90,136,254,110, 78,206,118, 62, 98, 76, 49,173, 29, 26,216,234,242, 86,118, 63,179,109,105,
-213, 3, 72,123,156,186,212,179,103,207, 23, 27, 53,106, 20,180,251,150, 15, 10,197, 77,193,138, 85, 96,197, 42, 48,126,237,144,
- 44,121, 5,225,225,225, 65,158,158,158, 29,171,153,206,237,183,110,221,250,151,173,167,156, 15, 96, 89,108,108,236,231, 4, 65,
- 92,136,141,141,157, 15, 96,153,109,251,130,219,183,111,119, 0,176,243, 41,165,243,153,120,222,121,206,255, 45,206, 42,180, 72,
- 0, 65, 16, 71, 8,130, 56,242,201, 39,159,244, 0,224,231,180,254,111,199,227, 0, 72, 92,253,218, 23,135,237, 1, 28,199, 13,
-112, 56, 47,160,134,201, 39, 92, 44,127, 9, 45, 0,136,142,142, 38,162,163,163,237, 59,126, 33, 8,226, 16,128, 95, 68, 34, 81,
-155,214,173, 91, 15,254,225,135, 31,188, 2, 2,254,186,126, 64, 64, 0,246,238,221,235,213,162, 69,139,193, 34,145,168, 13,128,
- 95,148, 74,229,161, 74,172, 48,170,201,147, 39, 15, 29, 59,118,172,166, 77,155, 54, 0, 80,148,144,144,160,232,208,161,131,158,
-166,105,130,166,105,162, 67,135, 14,250,132,132, 4, 5, 69, 81,218,118,237,218,121,244,234,213, 43,117,250,244,233, 99, 92, 8,
- 14, 71,188,190,120,241,226, 48, 31, 31,159,202,148, 48,180, 90, 45,130,130,130, 48,121,242,228, 96,145, 72,244,102,101,119, 75,
- 40, 20, 78, 89,188,120,113,160, 74,165, 66, 97, 97, 33,194,194,194, 96,177, 88,144,148,148, 4,147, 94, 7, 74,171, 1,165, 41,
-130,250,254, 61,168, 68, 66,140, 25, 20, 29, 36, 20, 10,167, 84, 97, 45,153,242, 77,108,108,144, 37, 53, 21, 41,123,246,128,161,
-203, 27,127,104,171, 21, 55, 55,109,130, 41, 61, 29,139, 38, 76, 8,146, 72, 36, 83,158,176, 37,107, 41,199,113,114,142,227,228,
- 4, 65,172,234,216,177,227,183,114,185,124,114, 92, 92, 92,223,147, 39, 79,246, 59,127,254,124,119,154,166, 69, 52, 77,139, 46,
- 92,184,208,197,100, 50, 9,165, 82, 41,132, 66, 33,135,231, 20, 34,145, 8, 98,177, 24,114,185, 28,157, 59,119,190,191,121,243,
-102, 42, 44, 44, 76,180,111,223, 62,159, 58,117,234,120,172, 89,179,166, 72,171,213, 46,118,151,207,106,181,194,108, 54,195,104,
- 52,194,100, 50,225,204,153, 51, 13,166, 78,157, 42, 52,153, 76,204,192,129, 3, 11, 40,138, 50,199,198,198, 42,125,125,125, 63,
-124,146,249,140,137, 49,177, 54,203,211,109,155,104,121,128,199,244,121,250, 59, 56, 1, 88,108, 62, 89,118,248,219,184, 45,181,
-116, 43,104, 0, 58,155,208, 50, 59, 61, 31, 45, 29, 44,190, 85,162,168,168,104,227, 55,223,124, 19, 70, 74, 85,184,104,233,143,
-239,216,207,113,210,123, 13,114,235,125,132,192,176, 70, 24, 53,106, 84, 32,199,113,107,106, 33,205, 95, 1,232, 10, 96, 85, 77,
- 78,126, 2,233,172,231,225,225,177,199,203,203,235,162,135,135,199, 30,216,134,103, 31, 7, 81,141,208,123, 80, 51, 50, 61, 42,
- 2,220,160,102,100,122, 84, 35, 62,212,192,243, 2, 39, 45,226, 8, 53,199,113,209, 28,199, 69, 47, 90,180,104,161,195,251,221,
-190, 46,119,211, 50, 22,205,113, 92,116, 25,133, 84, 34,176, 30,219,232,230, 98, 41,209, 20,142, 74,210, 33,115,165,179, 11,131,
-130,130,226,227,227,227,189,156, 25,179,178,178,160,209,104, 48,103,206, 28,175,177, 99,199,190,151,158,158, 30, 83, 69, 34, 36,
-217,217,217,109, 71,143, 30, 45,179, 90,173,133, 44,203,146, 26,141, 70,232,237,237,205,216, 15,240,246,246,102,138,139,139, 69,
-122,189, 94,192, 48,140,121,236,216,177,146, 9, 19, 38,188, 12, 64, 80, 17,105, 64, 64, 64, 84,255,254,253, 43, 28, 58,160, 40,
- 10,122,189, 30,122,189, 30, 86,171, 21,157, 59,119,150,110,222,188,185, 79,110,110,238,250, 10, 21,135, 84, 26, 21, 21, 21, 37,
- 42, 40, 40,128,183,183, 55,210,210,210,240,224,193, 3,152,117, 58, 88,117, 26, 88,117, 90,208, 90, 13, 56, 77, 49,242,239,221,
- 65,135,102, 77,197, 59,164,210,190,122,189,126,121, 69,156, 74,165, 50,170,195,184,113, 66, 15, 15, 15,116, 31, 93, 50,207,224,
-120,179,102,224, 24, 6, 44,195,128,161,105,244, 77, 74, 2, 69, 81, 32, 73, 18,237, 10, 10,132,202,109,219,162,212,106,245,178,
-167, 81,217,165, 82,169,112,251,246,237,175, 75, 36, 18,112, 28, 71, 88, 44, 22,156, 60,121,242, 31,247,208, 75, 36, 18,200,100,
- 50, 88,173, 86,212,175, 95,223, 56,122,244,232,203, 95,124,241, 69, 56, 73,146, 30, 98,177,248,135,252,252,252,133, 89, 89, 89,
- 41,238,242, 81, 20, 5,139,197, 2,139,197, 2,163,209,136,251,247,239, 7, 55,104,208,128,152, 60,121, 50, 99, 48, 24, 26,174,
- 94,189, 58,249,228,201,147,138,197,139, 23,191, 10,224,221, 39,157,223,152, 24, 83, 51, 0,205,226,227,101, 98,155,229,215,242,
- 63,198,201,161,196,241, 29,241,178,248, 68, 0,234, 90, 20, 89, 18, 0,222,225,126, 66,189, 72, 0, 29, 0, 47,155, 40,120,149,
- 32,136, 14,205,155, 55,247, 73, 76, 76, 44,228, 56,238, 42,128,239, 0,100, 85, 70,198,178, 44,193,178, 44,222,110, 95,132,201,
- 29, 5,160,168, 98, 20, 23, 23, 35, 45, 45, 13, 9, 9, 9,248,249,231,132,154, 62,155,111,122,122,122,246,145,201,100,245,105,
-154, 38,117, 58, 93,154,193, 96, 56,205,178,236, 70,212,192, 71,237,239, 74,167, 29, 30, 30, 30, 75,102,205,154,213,201,219,219,
- 27,191,255,254,123,195, 93,187,118, 45,209,235,245,143,229, 92, 47, 19,145, 91,150,175, 92, 19, 26, 26,168,194,141,243,135, 67,
- 23,110,216,189, 5, 96,195,120,153,242,236,195, 73,139, 56,138,161, 95, 57,142, 27, 64, 16,196, 17,103,161, 84, 45,179,211, 99,
-158, 95,133, 69,203,249,195,210,101,133, 86, 5, 10, 18, 52, 77, 7, 59, 90,178, 56,142, 67, 86, 86, 22, 50, 50, 50,160, 86,171,
-225,227,227, 3,171,213, 26,236, 78,251,160,213,106,219,251,249,249, 25, 68, 34,145,217,104, 52, 66,161, 80,176, 34,145,136,179,
- 93,135,176,205, 90,100,204,102, 51, 33, 20, 10, 41, 47, 47, 47, 79,179,217,220, 20,149,248,146,113, 28,215,222,207,207,207,229,
- 62,179,217, 12,157, 78, 7,189, 94, 15,157, 78, 7,179,217,140,160,160, 32,208, 52,221,182,210, 46, 45, 77,183, 12, 8, 8, 64,
-102,102, 38,228,114, 57,210,211,211, 97,209,105, 97,213,106, 65,235, 53, 96,138,139,193,106, 52, 96,245, 26, 80, 22, 3, 66,155,
- 52,131,125, 70, 98,133,221,112,139,165,165,159,159, 31,244,250,191,220,205, 56,155,192,162,105, 26,180,205, 57,218, 62,156,232,
-239,239, 15,251,140,196, 39, 4, 51,128, 25, 36, 73,174,146, 74,165,194, 73,147, 38, 33, 43, 43,171, 76,157,152, 52,105, 82,169,
- 79, 86,215,174, 93, 47,200,100, 50, 90,173, 86,195,108, 54,139,158,215,135,158, 32, 8, 16, 4, 81, 82, 70, 52, 13,127,127,127,
-125, 94, 94,222,207, 69, 69, 69,175,215,132,143,162, 40,251,140, 46, 24,141, 70,112, 28,135,223,127,255, 29, 50,153, 76,196, 48,
-204, 45,154,166, 21, 34,145, 8,164,205,249,235, 73,193, 54, 35,240, 75, 0, 97, 54, 11,209,155, 40,113, 56,207,112,209,144,184,
-117,235,220,228,172,190,112, 51,197,216, 45, 77, 25,168,217,112,164, 43,116,111,170,146, 44,143,235, 16,168,106, 61,208, 67,175,
-144, 8,244,108, 90,235,250,255, 93,154,176,107,236,152, 55,189,230,205,155, 87,207,223,223, 95,150,156,156,108,154, 63,127,126,
-131,237,219,183, 19, 40, 25,166,171, 16, 15, 31, 62, 60, 48,107,214, 44,223,254,253,251, 55,148, 74,165, 68,113,113, 49,212,106,
- 53,114,114,114,240,224,193, 3,238,198,141, 27,247,205,102,243,158,234, 36, 50, 36, 36,100,243,235,175,191, 62,246,165,151, 94,
- 18,217, 45,164,122,189,190,205,185,115,231, 6, 29, 63,126,188,139, 94,175,175,118,189,124,244,232,209,158,217,179,103,123,188,
-242,202, 43, 77,165, 82, 41, 89, 27,233,116, 4, 73,146, 65,158,158,158, 56,125,250, 52, 84, 42, 21, 72,146, 12,122,220,250,106,
-178,178,161,117,130,253, 96,186,180, 28, 77, 3,234,193,100,101, 67,121,137,242,252, 88,180, 42,120,215,183,179, 91,164,170, 16,
- 75,198,153, 51,103,206, 34, 8,226,200,204,153, 51,103,185,178,104,217,254, 50,142,199, 57, 28,111,174,109,177, 85,173, 64,147,
- 44,203, 34, 35, 35, 3,153,153,153,200,200,200, 64,126,126, 62, 72,146, 4,199,113,238,204, 62,227, 8,130, 96, 79,157, 58,229,
-115,249,242,101,125,187,118,237,138,236,254, 47, 52, 77, 19, 20, 69, 17, 54,191, 24, 34, 45, 45, 77,124,241,226, 69,213,237,219,
-183,131,108,189, 85,182, 10, 83, 96,185,109,118,129,229,184,152, 76, 38,200,100, 50,247, 84,135,237, 69,248,251,181,107, 37, 34,
- 75,167,181, 13, 25, 22,131,209, 20,131,211,107, 33, 97, 40, 72,192,129, 48, 25,220,190,127,142,176,139, 44,171, 77,104, 89, 44,
- 22, 80, 20, 5,150,101, 65,211, 79,197,175,124, 93,171, 86,173,218, 30, 56,112, 96,124, 70, 70,249,119,225,144, 33, 67,240,238,
-187,239, 98,234,212,169,183, 7, 12, 24,112,227,240,225,195,152, 50,101, 10, 88,150,109, 13,160, 24,192,241,231,237,161, 55,155,
-205,165, 22, 40,147,201, 4,171,213, 10, 84,227,179, 10,206,117,211, 94,182, 52, 77,219,185,137, 3, 7,246,227,194,133, 11,100,
- 66,194,173,176, 73,147, 38,219, 29,238,159,116, 86,211, 81, 50,115, 79, 98,107, 40, 44, 40,241,127,170, 40,164, 66, 4, 42, 31,
-178,227, 42,227,124, 28,180,218,208,106,196, 7, 31,124, 16,133,146, 25,206, 41,143,105,209,122, 69, 66, 18, 95, 79,107,233, 43,
-251,176,149,159, 94, 34, 36,116, 73, 95,207,210, 61, 8, 87,234,131,234, 42, 44, 97, 13, 84,117, 22, 46,252, 34,228,246,237, 59,
-230, 57,115,230, 36,142, 28, 57, 50,240,195, 15, 63,108,190,111,223,190, 46, 38,147,233, 27, 0, 69, 21, 25, 93, 6, 13, 26,116,
- 53, 48, 48,176,193,134, 13, 27,114, 31, 61,122,228, 67, 81,148,135,213,106,101,245,122,253, 3,163,209,120,218,106,181,158, 6,
-112,173, 58,137,245,242,242,106, 53,110,220, 56, 81, 81, 81, 17,132, 66, 33,172, 86, 43,114,115,115,209,169, 83, 39,193,161, 67,
-135, 90,212,228, 6, 20, 22, 22, 46,255,230,155,111,206,238,220,185,179,143, 82,169,124, 73, 42,149, 6, 3, 96,180, 90,109,142,
- 94,175,255,163, 38,233, 44,211,206, 49, 76,206,181,107,215, 34,148, 74, 37, 30, 62,124, 8,134, 97,114, 30,183, 14,200,196,228,
-163,155,231, 15,213,109,230,223, 0, 23, 47, 95,133, 76, 76, 62,226, 67,125, 61,247,176,251, 80,193, 81, 64,185, 16, 72,151,227,
-226,226,228,139, 22, 45, 66, 92, 92,220, 45, 87, 22, 45,187,224,138,139,139,187,101, 63,206,225,248,243,143,145,198,138, 45, 90,
- 21, 41, 72,160,100,118,161, 90,173,246, 81,169, 84,165, 2, 43, 51, 51, 19,153,153,153,144, 72, 36, 72, 75, 75,131, 68, 34,201,
-114,167, 19, 34,151,203,127,107,211,166,205, 11, 41, 41, 41,226,249,243,231,215,189,118,237,154,178, 83,167, 78, 47,202,229,114,
-134,227, 56,152, 76, 38, 50, 49, 49,209,115,217,178,101,161,237,219,183,183,180,111,223,254,250,238,221,187,141,168, 36,254, 21,
- 65, 16,191,100,101,101, 53,172, 95,191,190, 93,180,149, 17, 87,142,130, 11, 40, 25,242, 20, 10,133,215, 43, 75,168, 80, 40,188,
-153,148,148,212, 91, 33,147,194,162,213,192,170,211,128,214,106,193,104,139,193, 20, 23, 3,122, 13, 36, 52, 13, 17, 67, 65, 46,
-147, 33, 35, 61, 29, 66,161,240,102,101,156, 18,137,228,102, 78, 78, 78,111,149, 74, 85,250, 18,165,104,186,100, 97, 24, 88,104,
-186,212,162, 37, 18,137,240,232,209, 35, 72, 36,146,155, 79,186, 38,147, 36,201,216, 67, 56, 84,144, 15, 4, 5, 5,177, 29, 58,
-116,192,148, 41, 83,192, 48,140,173, 24,136,238, 0, 46,162,196,191,229,153,132, 43,113,107,119, 90, 55, 26,141,208,233,116, 40,
- 44, 44, 20,202,229,242, 23, 66, 67, 67,175, 90, 44,150, 61, 52, 77,111,121,240,224,129,166, 34, 78,155, 48, 43, 21, 93, 44,203,
-130,227, 56, 48, 12, 3,138,162, 32, 22,139,217,115,231,206, 99,217,138, 37,136,223,178,157, 27, 52,104, 16,113,232,208, 33,176,
- 44,155,254,132,179,111,177,137,150,202, 26, 13,231,144, 10, 31,161,242,144, 10, 21,113, 58,246,254, 28,183, 17, 46,142, 41,135,
- 15, 62,248,224, 4, 74,134, 12,243,108, 98,238,113, 56,191, 44,250,238, 11, 25,104, 70,111, 62,183, 83,247,237, 93,141,126,222,
-183, 43,127,179, 72, 4,154,151,187, 5,181,108,216,224, 5,129, 74,229, 67,174,223,184, 42,127,199,246,189,201, 15, 31, 62,212,
-172, 93,187,182,227, 11, 47,188,224,253,199, 31,127,132, 86, 36,180, 20, 10, 69,227, 55,223,124,115, 92, 97, 97,161, 56, 62, 62,
-126,119, 86, 86,214,111, 40, 9, 45,227, 56,131,122, 0,128,173, 54, 33, 26,100,107,231, 46, 2,152, 95, 89,127,141, 32, 8,252,
-244,211, 79,229,102, 7,178,143,167,206, 85,141, 26, 53, 26,145,146,146,114, 33, 39, 39,103,152,243, 78,177, 88, 60,175, 73,147,
- 38,125,111,221,186,245, 57,128, 99,213, 33, 54, 24, 12,177,123,247,238, 93, 42, 16, 8,234, 48, 12,147,105, 52, 26, 99, 31,219,
-162, 69,177, 19,226,214,239,218,100,180, 48,225,114,137,224,161,137, 98,223,226,117,200,243,107,205,178, 65,237, 96,141, 82, 3,
- 32,156,214,255,176,189,140, 44, 28,199,217,143, 85, 59, 88,177, 44, 78, 86, 48, 87,251,212,143, 17, 44,157,171,168,141,171,200,
-162,245, 9,128,246, 0,126,201,201,201, 89, 53,118,236,216,101, 59,118,236,240,210,104, 52,200,201,201, 65,110,110, 46,132, 66,
- 33,148, 74, 37,214,173, 91,103,204,201,201, 89,229,120, 14,202, 71,144, 7, 0,147,191,191,255,111,219,183,111, 15,254,250,235,
-175,133, 49, 49, 49,105, 3, 6, 12,104,186,110,221,186, 20,177, 88,204, 49, 12, 67,152,205,102,226,237,183,223,142, 88,177, 98,
- 69,170, 64, 32, 80,140, 24, 49,130,240,240,240,248, 5,149,132, 13, 80,171,213,167,190,255,254,251,161,211,167, 79,151, 90, 44,
- 22,151,150, 44,251, 54,149, 74,133, 75,151, 46, 89, 10, 11, 11, 79, 86, 97,197, 56,245,195,177,163, 93,255, 51,114,164,152,210,
-106, 64,105, 53,160, 53, 26, 48,218, 34, 16, 58, 13, 68, 12, 13,185,152, 69,112,152, 12,180,209, 19, 71,127,253,131, 50,155,205,
-149, 6, 54,212,104, 52,167, 46,198,199,119,111, 95,175,158,240,210,180,105,176, 82, 20, 94, 73, 74, 42, 21, 87, 86,171, 21, 7,
- 91,182, 4, 67, 16,104, 61,113, 34,238,209, 52,173,209,104, 78,253, 47, 62, 12, 55,110,220,200, 29, 61,122,244, 53,150,101,219,
-226, 9,125, 52,243, 73,128,162,168,114,214, 40,134, 97, 74,172,142, 37,150, 3,201,209,163, 71,187, 38, 38, 38,138,255,252,243,
- 79, 92,184,112,161,245,142, 29, 59, 62, 9, 15, 15,111,249,240,225,195,236,170,196,155,171,160,191,176,249, 31,238,222,185, 7,
-239,188,243, 14,145,157,157,141,239,190,251, 14, 85, 5, 79,253, 59, 16, 19, 99, 98,227,227,101,117,225,228,247,228, 34,164,194,
-239,112, 51,164, 66, 69,156,166,152, 18, 43,153, 44,190, 36,216,168, 41,166,100, 56, 80, 22, 95,165,165, 12, 49,166, 24,141,205,
- 33, 62,171, 22, 56,245,160, 25,185,229,220, 78,221,128, 99, 15,181, 87,178,140,243, 1,156,128,137,225,238, 93,231,110,188,244,
-146,143, 63, 0,152, 77, 76,112,227,198,141,187, 9,133, 66, 9, 0,120,122,122,190,228,231,231,183, 46, 63, 63,191,179,171, 50,
-141,142,142,238, 16, 24, 24,216,230,248,241,227,127,100,101,101,221, 2,240,179,243, 65, 17, 17, 17,115,110,223,190,221, 78, 36,
- 18, 17, 85,212, 17, 0, 64,183,110,221, 94,144, 74,165,126,199,238,122, 67, 35,110, 4, 78, 80, 12, 8,101, 96, 84,173,144, 38,
-110,142,176,176,171,126,133,133,133,173,139,139,139,255,168,102,209,247, 24, 58,116,232,150,248,248,248,176,110,221,186,113,215,
-175, 95, 39,157, 71, 17, 34, 34, 34,250, 92,185,114,165,237, 91,111,189,181, 97,215,174, 93,147, 81,118,166,109, 85, 72,179,197,
- 27,172, 53,156, 74,198,105,128,169,103,179,153,241, 10,229, 31,128,234,132, 92,120,140,240, 12,143,149,196, 10, 13, 24, 21,108,
-111,111,139,137,213,158,162,168,223,111,220,184,113,112,196,136, 17,186,252,252,124,248,249,249,161,126,253,250, 32, 8, 2,235,
-214,173, 51, 62,120,240, 96,159, 45,150, 86,251,204,204,204, 65, 54,177,229, 10,218,213,171, 87,239,218,182,109,155,234,218,181,
-107, 2,154,166,149, 77,155, 54, 53, 92,190,124,217, 83, 36, 18,113, 98,177,152,189,118,237,154, 34, 34, 34,194, 68, 16,132,244,
-199, 31,127,204,191,122,245,106,248,140, 25, 51,190, 65,217,105,226,206,216,185, 96,193,130,140,148,148, 20,152,205,102,104, 52,
- 26, 20, 23, 23,151, 46, 69, 69, 69, 40, 46, 46,134, 72, 36, 66,118,118, 54,246,239,223,159,101,139, 18, 95,153,101, 99,237,154,
-117,235,213, 89, 15,211,160, 84,200, 65,107,138,192, 20,231, 3,218, 98, 72, 40, 43, 60, 68, 12,234, 54,146, 67,166, 80, 34, 71,
-163, 67,252,229, 95,179,109, 81,226, 43, 54, 23, 88, 44,107,223, 93,177, 34,135, 22,139, 81,111,248,112, 88,109, 67,133,142, 66,
-139, 33, 8,132,247,234, 5,210,219, 27, 11,247,237,203,177, 69,137,127,162, 96, 89, 86, 96,177, 88, 42,203, 7, 88,150, 77, 79,
- 76, 76,220, 5,224, 44, 65, 16, 28, 65, 16, 28, 74,130,181,233,158,229, 7,153,162, 40,204,157, 59, 23, 98,177, 24,115,231,206,
-197,167,159,126,138,101,203,150, 97,253,250,245,248,246,219,111,113,244,232,209, 6, 23, 47, 94, 20,159, 63,127,158,139,139,139,
-203,139,136,136, 16, 76,156, 56, 81, 37,151,203, 63,168,140, 51, 54, 54, 22, 94, 94, 94,136,141,141,197,146, 37, 75,176,121,243,
-102, 28, 60,120, 16,151, 46, 93,130, 64, 32, 96,211,211, 31,193,100, 50,113,171, 87,175,206, 56,120,240,160,113,213,170, 85, 16,
- 10,133,196, 83,106, 36, 62,176, 9, 42, 71, 75,144,115, 72,133,124, 0, 43, 81,181,111, 84, 69,156,144,197,199,215,181,137,163,
-100, 7, 65,116, 24,192,116, 84, 62,189,218,206, 49, 25, 64,112, 45,112,206,150,143,254,191, 68,213,166, 59,247,175,100, 25,103,
- 3,248,193,158, 39,165, 82, 41, 63,112,224,123, 33, 0,236,219,187, 95,148,148,148,228,253,253,247,223,203, 2, 3, 3,241,237,
-183,223,202,228,114,121, 96, 5,156,204,193,131, 7,205, 18,137,196,111,194,132, 9,253,218,181,107,247,190,173, 35,218, 11, 64,
- 11,148,204, 94,140,186,127,255,126,130,191,191,255,221,147, 39, 79,234,221, 41, 32,173, 86,251,205,214,173, 91,235, 23, 48,190,
- 56,166, 31,138,120,118, 41,142,170,182, 32,173,222,167, 80,212,121, 25,175,191,254,122, 29,134, 97, 54, 85,179,220, 95, 31, 50,
-100,200,214,248,248,248,176, 9, 19, 38,100, 95,191,126, 61, 7, 64, 60,128,237,142,203,237,219,183,243,198,142, 29,155,181,105,
-211,166,144, 17, 35, 70,172, 7, 48,140,127,245,243,224, 81,182, 47,132,170,102, 29,186,120,225,150,254,207,205,205, 93, 93, 88,
- 88,120,233,222,189,123,239, 89, 44,150, 16,130, 32, 56,177, 88,156,157,147,147,179,202, 33, 96,169, 43,191,146,222,176,197,218,
- 32, 8,130,226, 56, 46,189, 71,143, 30, 31,244,234,213,235,171, 35, 71,142,152,186,119,239,142,189,123,247,250,247,232,209,195,
-192,178, 44,119,236,216, 49,255,190,125,251, 26,206,158, 61,171,127,251,237,183,155, 54,105,210,100, 98,108,108,172,154, 32, 8,
-214, 21,167,253, 93, 86, 84, 84, 52,164, 95,191,126,151,246,237,219,167, 84,169, 84,160,105, 26, 6,131, 1, 6,131, 1, 28,199,
-193,219,219, 27,106,181, 26,243,231,207,215, 20, 23, 23, 15,118, 33,220,156, 57, 77, 38,147,105,216,228,247,167,159, 90,245,249,
- 92,175,240, 6, 13,144,127,199, 4,218,100,128,136, 35, 81,247, 5,111,136, 37,114,220, 75,210,226,163, 93, 7,180, 70,147,233,
- 53, 23,189,229,114,156,197,197,197,195, 98, 62,253,244,244,134, 25, 51, 60,219, 4, 5, 65, 32, 16,192,108, 54,131, 97, 24,136,
- 68, 34, 68,198,196, 64, 28, 16,128, 57,187,118,233, 53, 26,205, 48,148,255, 20,143, 51,103,109,192,145,115,242,141, 27, 55,198,
- 54,107,214, 12,147, 38, 77,194,144, 33, 67,202, 28,248,253,247,223, 99,253,250,245, 48,155,205, 99, 1, 92, 7,176, 14, 37, 67,
- 29,112, 18, 89,127,119, 58,107,157,147, 97,152,194,164,164, 36,229,210,165, 75, 9,171,213,138,207, 63,255, 28,118,193,105,175,
-215, 83,166, 76,169,227,229,229,133,207, 62,251,204,146,151,151,215,115,201,146, 37,103,182,111,223,238,255,205, 55,223,188, 14,
- 32,214,153,147,101,217,220,155, 55,111,122,109,216,176,129,164,105, 26,203,151, 47, 47, 55, 60, 57,126,252,120, 88,173, 20, 4,
- 2,161,197,100, 50,183,144,203,229,201,126,126,126,114,174,172,115,215,147,188,159,161, 40, 9, 97,224,232,248,110,113,244,207,
- 66,197, 33, 21,170,195,169,150,197,199,119, 55,197,196,156,181, 9,162, 68,219, 49,123,237, 38,253,106,112,218, 5, 97, 77, 56,
- 79,217,150, 42, 97, 50,153,160, 86,171,145,151,151, 7,149, 74, 5,129, 64, 64, 84,148, 78,179,217,252,231, 71, 31,125,116, 99,
-211,166, 77,189,175, 92,185, 50,240,252,249,243, 61, 78,159, 62,109, 74, 75, 75,163, 41,138,226, 66, 66, 66,132,157, 59,119,150,
-245,239,223,223, 67, 42,149,146,179,103,207,206,251,226,139, 47,252, 81,214,135,205, 57,239, 2,130, 32,240, 97, 87, 45, 98,123,
- 8, 96,177, 88, 81, 84, 84,132,140,140,116, 36, 36, 36,224,202,149, 59,224, 56,142,172, 70,185,251, 1,152,253,221,119,223,133,
- 74, 36, 18, 98,215,174, 93,117,118,237,218, 85,165, 37,117,199,142, 29,117,118,239,222, 61,207, 54,122,145,254, 44, 62,239, 60,
-231,255, 44,231,179, 12,231,200,240,168, 82,104,217,218,249,246,176,125,148,148,162,168, 95, 92,132,112,248, 4,192, 92, 7, 43,
- 88, 85,230, 60, 13,199,113, 23,122,247,238, 61,165, 87,175, 94, 43,250,244,233,147,149,149,149,213,112,249,242,229, 97, 52, 77,
- 91, 19, 18, 18,200,228,228,228,180,223,126,251,173, 81,147, 38, 77, 38,222,190,125,251, 28, 65, 16, 86, 55, 50,152,144,156,156,
-220,169, 71,143, 30,251, 39, 78,156, 24,222,161, 67, 7,137, 74,165,130, 80, 40, 68, 74, 74, 10,254,248,227, 15,203,238,221,187,
-211,139,138,138,170,243, 9,158, 95, 82, 51, 50,162, 70, 76,125,111,223,196, 33, 3,253,255,213,244, 5, 73, 72, 72, 8, 96, 52,
-226,206,195,108, 92,189,243,135,117,243,133,171,106,179,217, 60, 12,238,127,130,231,151,223,238,221,235,221,115,198,140,125,243,
-254,243,159, 32,100,101, 9, 67, 66, 66, 32,145, 72,240,224,193, 3, 36,179, 44,189,120,227,198, 28,155,200,122,210, 81,225,165,
- 0,150,178, 44, 43, 4, 0,185, 92,142,119,223,125, 23,142,159,220, 89,191,126, 61,140, 70, 35, 0, 8, 9,130, 88, 10, 96,203,
-179,110,197,178,163,160,160, 96,206, 43,175,188, 18, 39, 20, 10, 43,140,122,235,227,227, 3,173, 86, 11,154,166,153,140,140,140,
- 59, 62, 62, 62, 16,137, 68,224, 56,206,229,115,148,159,159, 63,103,216,176, 97, 11, 72,146,172,200,242, 1,165, 82,153,118,230,
-204,153,198,111,189,245, 22,249,223,255,254, 55,101,194,132, 9,210, 51,103,206, 48, 28,199,237,127,210,247,160, 75,151,157,192,
-134,152,215, 0,188, 6,148,115,120,207,176,109,171, 86, 72,133, 46, 93,118, 98, 3,254,226,116, 28,198,179, 11, 34,155, 21,170,
-185, 44, 62,126, 5, 74,252, 44, 42,229,238,178,179, 11, 54,196,160, 86, 57,221,129,163,246,213,235,245, 96, 24,166, 50,107,222,
-239,123,247,238, 93,241,219,111,191, 5, 76,153, 50,165,225,127,254,243, 31,101,143, 30, 61, 60, 29, 15, 48, 26,141,236,225,195,
-135,245,235,215,175, 47,190,112,225, 66,234,248,241,227, 59, 84,150,206,135, 15, 31, 30, 93,184,112,161,119,255,254,253,155, 0,
- 40,245,207, 82,171,213, 72, 75, 75,195,159,127,254,153,102,181, 90, 15, 85, 35, 75,249, 0,230,141, 26, 53,106,233,182,109,219,
-234, 76,152, 48, 33,123,247,238,221,127,162, 36, 96,177, 51, 84, 67,134, 12,105,185,109,219,182,144, 9, 19, 38,100,163,196,143,
- 44, 29, 60,120,240,176,163, 59,202,251,105, 85, 58, 50,177,213, 98,177,112, 38,147,137, 51, 24, 12,156, 78,167,227,224,250, 43,
-240, 7, 51, 51, 51,185,244,244,116,238,225,195,135, 92,106,106, 42, 7,224, 91, 39,197,235,170,193,242,216,177, 99, 71,163,208,
-208,208,207, 21, 10,197, 9,129, 64,160, 17, 8, 4, 26,169, 84,250,131,159,159,223,167,139, 23, 47, 14,229, 56, 78, 92,137,138,
-174, 8, 66,145, 72,244, 86, 96, 96,224, 65, 95, 95,223,116, 31, 31,159,244,192,192,192,131, 34,145,232, 29, 0,162, 42,148,121,
- 69,144, 9,133,194,143, 60, 60, 60, 78, 73,165,210, 92,169, 84,154,235,225,225,113, 74, 40, 20,126,132,202, 3,169, 86,202, 41,
-145, 72, 62, 10, 8, 8, 56,165, 84, 42,115,149, 74,101,110, 64, 64,192, 41,137, 68,242, 56,156,143,211, 43,177, 11, 45, 3,103,
- 3, 65, 16, 84,235,214,173, 55,180,109,219,118, 93,219,182,109,215,181,106,213,234,107,155, 85,146,179, 89, 91, 12,168, 56,120,
-227,223,153,206,167,198, 25, 25, 25,185,125,219,182,109,236,156, 57,115, 52, 77,154, 52, 41,152, 51,103,142,102,219,182,109,108,
-100,100,228,246,154,114, 6, 5, 5,213,139,140,140, 44,216,180,105, 19,157,148,148,196,109,218,180,137,142,140,140, 44,112,138,
- 12,255, 36,242, 78, 0,136,176, 89,127, 14, 1,216,131, 18,231,247, 80, 0, 68,140, 41,134,179,205, 62, 60, 1,160, 79, 5,101,
-239, 46,103,152, 41, 38,134,179,249, 84,157, 4,144,232,176,222, 13,101,253,191,158, 4,167, 75,180,104,209,226, 30,231, 0,139,
-197,194,169,213,106, 46, 41, 41,137,187,112,225, 2, 23, 22, 22,118,207, 13, 78, 63, 0,111, 3, 56, 28, 28, 28,124,187, 99,199,
-142, 15, 59,117,234,244,176, 94,189,122, 41, 34,145,232, 10, 74, 34,188, 71,218,150,165, 0,154, 84,193,217, 81,165, 82, 45, 12,
- 11, 11, 59,212,184,113,227, 75,245,235,215,191,226,235,235,123, 68, 38,147, 45,194, 95,145,177,171, 91,231,123, 12, 29, 58, 52,
- 77,167,211, 49, 47,189,244,210,109, 87, 39, 53,107,214,236,162, 78,167, 99, 70,142, 28,153, 14, 32,250,159,240,188,243,156, 79,
-133,243, 31,133,198, 54,193,116,208, 97,249,196,197,113,159, 56, 29,179,213,118,110,149, 5,193,113,156,128,227, 56, 15,142,227,
-188, 57,142,243,229, 56, 78,197,113,156, 39,199,113,210, 42,204,223,124,197,254,251, 56, 39,219, 4,148,193,246,223, 25, 85,237,
-127,174,239,103,104,104,168, 79,187,118,237,166, 30, 56,112,224,163,251,247,239,127,116,224,192,129,143,218,181,107, 55, 53, 52,
- 52,212,231,113,210, 25, 20, 20, 84,175,121,243,230, 95, 53,107,214, 44,189,121,243,230, 95, 57,137,172, 39,153,119,137, 77,196,
- 52,179, 45, 13,109,219, 8,148,196,194, 90,107, 19, 54, 17, 21,244,212,170,195,105,231, 59, 4,160,175,109, 57,100,219, 22,246,
- 20, 56,203,161, 65,131, 6,199, 91,182,108,121,175, 85,171, 86,201,173, 90,181,186,215,162, 69,139,123, 77,155, 54,189, 23, 17,
- 17,113,175,110,221,186,247,252,253,253,143,215,160,140,124, 1,132,160,252,103,192,158,118,157,239, 30, 25, 25,121, 85, 38,147,
-185,140, 13, 38, 20, 10,231,181,106,213,234, 38, 74,102, 74,242,237, 39,207,201, 11,173,255, 33,240,149,240,217,227,148,162,242,
-207,140, 84,181,159,191,159,207, 54,167,203,111,117,217,132, 76, 67,155,192,145,212, 2,167, 35,159,189, 78, 69, 56,136,166,167,
-193,201,215, 37,158,147,231,228,133, 86,173, 67,200,223, 2, 30, 78, 48, 63,230,126, 30,207,197,104, 60,126, 0, 0, 32, 0, 73,
- 68, 65, 84, 54,170, 19, 19,235,113, 56, 93,241,221,127,202,156, 60,120,240,224, 81, 91,109,103,119, 0,231,236,189,194,138, 84,
-105,117,102, 19,212, 68,217,158,230, 57,121, 78,158,147,231,228, 57,121, 78,158,243, 31,199,105,199,138, 10,182,223,113, 90,255,
-250, 25, 21, 94, 79, 36, 76, 15,111, 86,229, 57,121, 78,158,147,231,228, 57,121, 78,158,179,166,152,248,140,138,172,110,246, 21,
-126,232,144, 7, 15, 30, 60,120,240,224,193,163,246, 80,117, 28,173, 61,123,246, 8,236,255, 71,141, 26, 53,158, 97,152,169,246,
-117,129, 64,176,230,187,239,190,219, 82,217, 21,134, 15, 31,206, 84,198,233, 10, 85, 93,199, 21,103,139, 38,202, 73,126,222,138,
-247,138,138, 13, 43, 83, 50,153, 11, 38,147,169,185,125,159, 76, 38, 75,220,178,101,203,221,218, 78,231,248,241,227,155, 56, 95,
-167,126,152,168,187,175,151,236,221,130, 34,221,242, 91,247,116, 95,243,117,236,169,192, 31, 64,180,151, 76, 60,168,133, 74,220,
-241,207,124,211,101,189,149, 57,140,146,217,176,133,207, 99,134,131,131,131,155, 42,149,202, 49, 0, 90, 24, 12,134, 64,133, 66,
-145, 11, 32, 65,163,209,108,207,206,206,190,227, 46, 79,183,250, 72, 3, 16,110, 91,125,120, 46, 21,245,220,217, 87, 21,250, 68,
-192,196, 1, 82,130,128,245,100,242, 95,206,232,125, 27,193,196,114,229,183,247,105, 4, 11,199, 65, 76, 0,230,147,247, 33,123,
-142,138, 74, 9, 32, 10, 37, 33, 28,110,160, 36,252,132,129,127,100,121,240,120,174,224, 60, 84, 88,186, 46,172, 64, 76,116, 21,
- 11,137,175, 56,112, 42,128,243, 51,155,205, 34,137, 68, 2,139,197, 2,133, 66,190,246,237, 9,227, 63, 7,137, 34,138,198,187,
- 91,182,108,169,241,151,174,171,115, 29, 0, 63, 57,159,239,163,148, 47, 56,123,248, 99,159,174, 3, 22, 47,178, 60,200,139,213,
-106,181,164, 84, 42,133,217,108,134,183,183,119,167, 73, 19, 39,190, 68,138, 56,139, 88,236,113,121,197,138, 21,217, 53, 77,231,
- 7, 31,124, 16,108,181,154,254,205,178,172,196, 98,177, 72,157,175,227,173,240, 88,124,246,240,199,138,110,209,139, 62, 7,120,
-161,245, 20, 32,169,231,227,113,110,229,168,238,205, 58,182,104, 12, 54,225, 60, 76, 22,235,160,179,233,186, 65,159, 94,201,156,
-158,174,179,182, 69, 45, 4,172,252, 31,130,160, 97,195,134, 83, 2, 2, 2, 70,110,220,184, 81,220,176, 97, 67,200,100, 50, 24,
-141,198,144,251,247,239,135, 76,154, 52,169,155, 92, 46,223,149,146,146,178, 22,238,125, 8, 46,252,236,214,255, 3, 0,116, 26,
- 51, 63, 28, 37, 31,139, 54, 56,239,235, 62,110,126, 56,128, 25, 40,251, 97,228, 44,148,132, 80,112,213,234, 72,142,108, 91,134,
- 65, 99, 63, 18, 2,152, 84,154,120, 18,248,225,219, 85,232, 55,234,189, 50,219, 9, 14,194,195,219,150, 33,122,236, 71, 21,126,
- 71,177,111, 99,130, 98, 89,174, 66, 75, 60, 73, 18,244,137,123,156,171, 15, 12,231,160, 36, 6, 88, 57, 74,148,124,208,217,229,
-241, 3,154, 10,114,172, 20,227, 50,224,172, 88, 36,200, 61,122,135, 41,119,110, 76, 27, 80, 20, 83,210,182,138,133, 96, 14,166,
-120,159,157, 61,123,182, 48, 58, 58, 26,155, 55,111,238,252,245,215, 95, 79,212,106,181, 63,218,238, 91, 50,255,248,242,224,241,
- 92, 11, 46,215, 66, 75, 40,192,134, 67,251,182, 52,202,201,205, 67,204, 91, 31, 98,231,206,157, 40, 44, 44,132,143,143, 15, 36,
- 98,177,104,229,210,255, 11, 86, 42, 61,130, 99, 38,198,110, 0,208,180,166,169,169,230,117, 26, 59,159, 79,216, 62,165, 35, 20,
-144, 34,137, 68, 66,238,218,181, 11, 69, 69, 69, 80,169, 84,144, 72, 68,228,138, 69,159,200,149, 74, 79,249,155,147,103,118, 70,
- 73,252,159, 26,193, 98,209,117, 62,176,115,139, 82,173, 86, 99,220, 59,177,112,190,142, 88, 44,102,236, 47, 22,190,142, 61, 21,
-204,222,248,238,216,102, 47,122, 1,214, 91,151, 32, 18, 8,160,240,246, 65,148, 80, 0, 1,129,230, 49, 39, 82,103, 1,248,244,
-121,201,108,195,134, 13,167, 12, 31, 62,124,228,130, 5, 11,196, 36, 89, 18,114, 78,175,215,195,104, 52, 34, 52, 52, 20,103,207,
-158, 21,207,153, 51,103,228,247,223,127,143,148,148,148,213,213,229,191,117,235, 86,253,240,240,112, 19, 0, 12,108,233,229,188,
-175,158,125, 31, 0,120,121,121, 85,201,231,167,242, 48,223,186,117,181,133,253,188, 41,189, 66,153, 10,182,155, 0, 40, 42,227,
- 98, 89, 78,120,242,171, 73, 21,238,127,107,193, 14,250,198,158, 11, 77, 27, 54,108,104,116,220,238,233,233, 89,209, 41, 65, 58,
-157, 46,220,121,163,253,120, 43,197, 4, 86,116,189, 62,239,174,119, 41,192, 40, 6,194, 29, 59,118, 0, 0,190,252,104,180, 96,
-211,207,121, 66,161,176,164,169, 93,186,116, 41,230,205,155, 39, 57,113,226, 68,255,109,219,182,245, 63,120,240,224,202,138,132,
- 42, 15, 30, 60,158, 73,145,229,248, 91,177,208, 34, 9,194, 75,233,229,137,215, 94,127, 27,199,143,255,128,174, 93,187,150,238,
-107,208,160, 1,134, 15, 27,140,239,182,174, 0, 0,175,199, 73,209,227, 94,167,176, 88,255,105,191,145, 95,205,127,152,173,187,
-114,228,200, 17,116,233,210,165,204,249,175,143,120, 13,223,126,179, 20,149, 68,153,119, 11, 4, 71,138,189,148, 30, 24, 21,243,
- 14, 92, 93,103,226,184, 33, 71,250, 14, 95,213, 59, 39, 95,191,130,175,103, 79, 30,141,130,253,250,180,108,214, 20,133,251,215,
-226,143, 34, 19,142,103,154,240,102,212,191, 16,233, 43, 71, 23,154, 65,176,135,168,103,182,158,122, 46,132, 86,112,112,112,211,
-128,128,128, 50, 34, 75,171,213, 66,167,211, 65,163,209, 64,171,213,130, 36, 73,196,198,198,138,207,157, 59, 55, 50, 56, 56,248,
-180, 27,195,136, 15,109,150, 44, 64, 32,210,205,157, 59,215, 28, 24, 24,104, 86, 40, 20,156, 80, 44,213,118, 31, 55,223, 11, 0,
- 72,161, 88,187,114,229, 74, 75,104,104,168, 73, 40, 20, 74,222,123,239, 61,210,157, 52,155,205,102,206,145,211, 98, 49,151,110,
- 95,188,120,177, 37, 40, 40,200,172, 80, 40, 56,171,213,125,163,227,205, 7, 5,144,138, 5,144,138, 5,144, 73, 68,240,170,223,
- 14,210,194, 63, 65,211, 52,150, 44, 89, 98, 13, 14, 14,182, 40, 20, 10, 78, 34,145,136,167, 77,155, 86,101, 58,199,143, 31,207,
-169, 84, 42,171, 66,161, 16,207,155, 55,175,220, 76,161, 51, 55, 50, 32,151,136,160,144, 10,209,184, 65, 24,164,156,209,237,180,
- 10, 4,101,189, 17,164, 82, 41, 58,119,238,140, 22, 45, 90,224,224,193,131,221,121,161,197,131,199,115,129, 10,103, 24, 10, 1,
-224,200,145, 35,221, 80,242, 65, 68, 68, 71, 71, 19, 37,103,112,152, 49,101, 24,222, 28, 55, 10, 12,195,150,126,231,139, 32, 9,
- 76,126,163, 63, 88,214,157, 17,137,170,167,120,214,224, 58,165,156, 28, 65, 10, 0,160, 81,189, 16,110,226,155,255, 1,195,178,
-127, 13,148, 8,128,183,199,245, 43,217, 86, 11,233, 20,128,193,135,147, 94,133,171,235, 52,109, 84,135,164,173, 38, 16,101, 63,
-246,248,119,124,108,147,231,116,129, 22,117, 67, 34, 40,163, 17, 38, 19,133,248, 59, 5,198, 83, 25,250, 64, 82,149,170, 94,245,
- 90, 7,153, 64,157,137,122, 94,146,198,217,122,234,185,200,187, 82,169, 28,179,113,227,198,114, 34, 43, 39, 39,135,212,233,116,
-176, 90,173,172, 86,171, 5,195, 48,152, 57,115,166,104,206,156, 57, 99,178,179,179,231,217, 53,143, 43, 78,155,223,213,140, 91,
-183,110,213,155, 61,123,182,181,103,207,158, 15, 27, 52,104,160, 23, 8, 4, 8, 9, 9, 89, 21, 21, 21,229,187, 96,193, 2,107,
-255,254,253, 83, 5, 2, 1, 26, 55,110,172,255,243,207, 63,235, 1,144,187,155,119, 71,206, 45,103,214,112, 0, 64, 16, 4,162,
-162,162,210, 26, 55,110,172, 23, 8, 4,184,123,120, 49,231,238,253, 20, 9, 73, 52, 9,245,182, 53, 34, 4, 32,247, 44,245,196,
-139,138,138, 74,111,218,180,169,142, 36, 73,220,188,121, 51, 12,229, 63,107, 85,142, 83, 46,151, 83,175,191,254,250,195, 59,119,
-238,184, 58, 30, 66, 1,137, 14, 77,109, 6,172,208,182, 64,250,197, 10,211, 41, 18,128,158, 51,101,180, 80, 37, 3,164, 94,254,
-102,141, 70, 3,165, 82, 89, 98, 33,179, 90,241,251,239,191,163, 99,199,142,221,246,236,217,115,142,127,222,121, 78,158,243, 47,
-184,210, 34,207,160, 53,203,241, 67,247,101,124,180,206, 58,103,138, 97,104, 52, 8, 15,194,226,255, 27, 15,134, 97,193, 48, 12,
-104,219, 47,195, 48,160,172,214, 90, 73,217,227, 92,199, 71, 41, 95,240,195,174,119,125,122, 14, 89,218, 43,110,246,184, 83, 12,
- 3,176, 44, 5,138, 2, 24,150, 2,203, 48,160,168,218,113,205,161, 88, 22,245,194,130, 17, 55,123, 28,156,175,179,253,187, 61,
- 3,207, 28,138, 85,116,141, 94,244,225,221, 52,195, 18, 94,216, 63, 89,200,196, 82, 33, 39,148,193, 98,161,161,181,176, 22, 0,
-122, 19,197, 90, 57, 15,127, 25, 0, 8, 73,226,121,154, 93,219,162, 97,195,134,101, 68,214,178,101,203,252,215,173, 91, 23, 10,
- 0,195,134, 13,203,232,213,171, 87, 94, 82, 82, 18, 66, 66, 66,136,188,188,188, 1, 0,222,179,157, 59, 3,192,186, 10,120,245,
-225,225,225,166,128,128, 0,179, 93, 16,145, 36, 9,161, 80,136,240,240,112, 83, 96, 96,160,185,113,227,198,122,177, 88, 12,146,
- 36, 97, 23,122,110,117,243, 8, 2, 2,129, 0,118, 78,103,107,143,157,179, 58, 16, 9,201,242,205,155, 3, 39, 73,146, 46,175,
- 87, 97, 29,146,201, 56, 0, 21, 30, 47, 32, 29,154, 71, 97,229, 30, 2,241,191, 67, 4,224, 44,199,113,184,126,253, 58, 82, 82,
- 82, 32, 22,139, 17, 28, 28,140,121,243,230,193,108, 46,209,187,195,135, 15,239, 6,224, 38,255, 4,243,224, 81,138,179,207,160,
-192,114,182,106, 85,238,163,117,228,200,145,110,209,209,209,231,236, 2,168, 68,236,184, 16, 63, 20, 13,138,178, 2, 28, 87, 43,
- 66,171,162,235, 48, 12, 91,233,117,236, 62, 90, 44,203, 9, 93,138, 44,150, 5, 77, 81,181,114,247, 88,134, 2,203, 82,112,117,
- 29,130, 32, 25, 91,131, 47,230,159,147, 39,143,224,240,122, 36, 21,222, 0, 23,104, 19, 66,253,164, 18,228, 25,209,240,133,102,
-130,223, 13, 20, 46,221, 72,132,191,167,242,185, 41, 23,131,193, 16, 40,147,201,160,215,235, 75, 45, 89,235,214,173, 11,181, 88,
- 44, 36, 0, 8,133,162, 48, 53, 27, 42, 99, 88,192, 91,153,133,194,194, 98, 63,142,227, 8,155,224, 89, 10, 96, 11, 42,137,238,
- 47, 22,139, 75, 5,138,163, 0,146, 74,165, 53, 18, 48,118,216,197,153, 88, 44,118,185,221,121,120,173, 42,136, 29,133, 22,184,
- 18,171,150,147,216, 18, 8, 4,176,251, 70, 85, 5,137, 68, 82,154,119, 87, 16, 10, 28,174, 39,168,190, 43,166,213,106,133, 78,
-167, 67, 81, 81, 17,100,178, 18,131, 25,199,113, 32, 8,226, 61, 0,239,243, 79, 49, 15, 30,174,181,200, 51, 44,182, 92, 11, 45,
-148,152,236, 8, 0,160, 41,171, 75,241,179,231,240, 37, 60,204,214, 35,216,255, 23,112,213,140,122, 58,114,228,200,173, 33, 33,
- 33, 29,236,235, 82,185,167,223,196,119, 63, 3, 77, 91,225, 37, 39,241,214,152,126,101, 68, 86,137, 69,203, 82,225, 55, 65, 10,
-139,245,159,246, 27,190,122,190,183,210,239,138,179,248,137,139,191,246, 90,161,198, 28, 70,146,191,162,144, 8, 97,134,191,253,
-217,120,135,198,253,198,174,245,115,167,187,109, 15, 36, 72,209,107,147, 86, 77,228,132,158,205, 21,164,246,252,199,227,254,117,
-192, 81,204,249,250,250, 30,233,243,218,202,222, 57, 5,188,143,214,211,128,151,183,138, 12,123,185, 59, 94,126,239, 43,156,249,
-228, 99, 14, 40,132, 95, 72, 40,217, 99,202, 23,240,124,121, 32,174,190, 53,134, 5, 10,158,139,188, 42, 20,138, 92,131,193, 16,
- 98, 52, 26,161,209,104,160,209,104,202, 10, 2,145,136,152,248,206, 84,127,145, 88, 2,202,106,193,241,237, 95, 84,201,105, 15,
-225, 48,176,165, 23, 4, 34,137, 54,161, 97,195, 85, 66,161, 16, 36, 73,226,240,218,143,223,219,191,252, 93, 47, 0,184,113,100,
-173,102, 84,236,154,213, 36, 73,194,108, 54, 75,171,147,238, 71,143, 30,133,153,205,102,147, 77,160,217,133, 31, 30, 60,120, 80,
-215,108, 54, 27, 29,183,187, 3,185,194, 11, 80, 53, 0, 20,129,229,172,103,169,169,169,117, 40,138, 50, 8,133, 66, 88, 44, 22,
-183, 84, 17, 73,146,226,155, 55,111,134,177, 44,235,242,248, 22, 17,117,128,224,150,128,196,219,237, 60,115,110,116, 68,109, 98,
-235,137, 69,144,230,193,227, 89,177,108, 61,131,207, 4, 81,193,255, 82,161,213,253,200,145, 35,156, 99, 15,145,166, 40,155,200,
-250, 75,244, 48, 12,139, 76,181, 9, 73, 73,119,177,114,229, 74, 92,186,250,145,247,130, 5, 11,164,115,230,204, 49,143, 28, 57,
-114, 57,203,178,173, 72,146,188,129,191,134, 42,202, 90,133, 88,182,238,181,107,215, 26,218,215, 41,138,130,151,151, 23,188,188,
-188,208,180,113, 88, 57,145,197, 48, 12,172,149, 12, 29,218,125,180, 8,142,229, 40,138, 1,195,178,165,226,167, 80, 99, 14, 59,
-116,250,122, 35,135,195, 95,176,255,233,220,174,121,197, 98,112,210,188,210,124,236, 90, 63,119,250,130,205,155,165,133, 76,192,
-180, 81,175,189, 25, 57,124,212, 24,188,254,234, 43,221,204, 22,203, 65, 1,201,177, 84,233,245, 64,130,131,179,143, 22,143, 39,
-132,228, 34, 61, 37,146,202,225, 25, 92, 31,119,117,140, 88, 32, 16,252,114,191,200, 32, 38, 5, 66,144, 66, 49, 18, 10, 77,212,
-115,148,221,132,228,228,228,144,186,117,235, 66,163,209,128,166,105,118,216,176, 97, 25, 66,161, 40, 76, 40, 18, 17,209,163,166,
-178,217,217,153, 20, 73, 10,192,113, 12, 94, 25, 62,137,144,202,228, 98,171,197, 66,163,100,232,208,149, 53,203, 49,132,131, 87,
- 84, 84,148,175,125, 38,224,254,229,239,122, 57,236, 83,190,244,210, 75,190,142,179, 14,221,180, 22, 17, 35, 71,142,148,135,135,
-135, 19, 0,240,235,246,217,118,235, 25, 49,112,224, 64, 89,120,120,137, 31,254,143,107,223,117,155,211, 95,193, 1,197, 15,128,
-226,212,114,150,172,129, 3, 7, 74, 27, 54,108, 88,173,103,209,230, 0, 95, 97,236, 46, 15, 33, 13,100, 95,119,139, 43,166, 13,
-168, 80, 79, 8,151,191, 66, 66,226,233,103,238,240,241,137,159,121,177,197,131,135, 91,112,210, 34,207, 20,186,217, 4, 98,119,
-219,111,169,224, 18, 2,128,205, 68, 71, 56,232, 44, 80,180,181,156,200, 98, 24, 6, 34,194,140,149, 43, 87,226,253,247,223, 7,
- 0,241,244,233,211, 15, 44, 88,176, 96, 40,203,178,173, 56,142,235, 66, 16, 68,101,189,198,179, 33, 33, 33, 57, 28,199,137, 72,
-146,236,178,118,237, 90,223,254,253,251,195,203,203, 11, 28,203,149, 19, 89, 12,195,194,106,181, 84,248,153, 91, 31,165,124,193,
- 15,123,166,249,244, 28,188,180, 23,195,178,167,236, 34,139,101, 24,128, 45, 57, 41, 63, 55, 3, 39,143, 31,196,134,245, 27, 10,
- 65,112,183,193,129,181,137, 65, 84, 32, 6, 91, 93,252, 53,177, 75,231,118,205,177, 96,243,102,233,173,107, 89, 7,166,126, 48,
- 43,114,248,168, 49,216,243,221,118,144,116,209,117, 71,145,197, 80, 44,138, 11,243, 6,254,196,251,104, 61, 45,248,158, 60,117,
-138, 24, 51,102, 12,171,213,106, 33,150, 72, 88,138,162, 4,255,254,247,191,153,247,223,127,159,204,206,206,134, 70,171, 19, 2,
-240,197,115, 96,214,210,104, 52,219, 39, 77,154,212,237,252,249,243, 98,146, 36,161,209,104,208,163, 71,143, 60, 53, 27, 42,155,
-248,206, 84,255,204,204, 12, 90, 41, 23,154,197, 98, 17,114,115,115,217,110,253, 71, 27, 71,141,127,191,206,251,179,227, 54,102,
- 93, 94,191,206,157,107, 56,206, 4,116,222,183,105,211, 38, 75,104,104,168, 73, 42,149, 74,198,141, 27,231,214,248,161,197, 98,
-225, 22, 47, 94,108,118,158, 93,104,177, 88,184,149, 43, 87, 90,194,194,194,204,114,185,156,163,168,170,253, 62, 73,146,160,223,
- 90,176,131,166,105,186,140, 21,203, 46,178, 40,150,208,125,245,213, 87,214,176,176, 48,139, 66,161,224,164, 82,169,216,157,116,
- 78,157, 58,149,243,241,241,177,122,120,120,136, 99, 99, 99, 31,107,214, 33,197, 64,184, 96,109,105,120, 7,169,151,151, 23,180,
- 90,109,105, 90, 67, 66, 66,120,177,197,131,135, 11,148,211, 34,207,166, 21,206,189, 56, 90, 44,160,203,201,205, 11,244, 15,170,
- 15,154,166,109, 11, 5,154,162, 48,237,237, 81, 88,190,254, 43, 0,176,139,173,168,233,211,167, 31, 0, 80,101, 99,182,107,215,
-174,249,211,167, 79, 87,230,228,228,156,216,186,117,171,239,232,209,163, 49, 99,198, 12, 44, 93,186, 20, 34,137, 12,190, 1,117,
- 75,175, 99,191,110,158,186, 0, 28, 56, 93, 5,118, 58,107, 73, 35, 5,161, 95, 64, 61, 80, 12, 5,150,162, 64, 81, 20, 8, 65,
- 73,214, 78, 30, 63,136,209,111, 76,133, 72,170,244, 89,179,114,137, 49,242,229,144,161,115, 38, 76, 48,187, 97, 4, 36,111, 93,
-203, 58, 48,245,253,216, 40,187,200,218,183,125,253,237, 47,103, 14,222, 41,149, 8, 75,175, 67,177, 44, 72, 82,192,251,104, 61,
- 37,145, 37,149, 74,247, 30, 59,118,236, 94,219,182,109, 9,189, 94, 15,138,162,144,151,151,135, 3, 7, 14, 36,112, 28, 7, 31,
- 31, 31, 28, 59,118,140, 29, 61,122,244, 94,179,217,252,218,179, 46,182,178,179,179,239,200,229,242, 93,179,102,205, 26, 53,115,
-230, 76, 17,203,178, 72, 74, 74, 2, 8,130, 19,137, 37, 32, 73, 18, 34,145, 16,197,197, 26, 86,225,169,202,178,114, 2,133, 72,
- 44, 1, 41, 16, 87, 54, 77,248,161, 45, 24, 41, 72,161, 88,107,159, 9, 40, 22,139,113,117,207, 50, 77,247,113,243,149, 0, 32,
-150,202, 11,251,244,233,147,214,188,121,115,253,111,191,253, 86, 15,229,103, 29, 58, 63,159,244,144,113,177, 2,133, 92,166,143,
-138,138,122,104,231, 76, 61,181, 70, 51,102,242,108,130, 16, 72,244,209,209,209,105,145,145,145,122,129, 64,128,196,131, 75, 52,
- 67,198,197,202,136, 74,130,172,158,184,199,189,117, 99,207,133,166, 95,124,241, 5,213,191,127,255, 71,118,127,177,212,212,212,
- 58, 3, 6, 12,144,174, 88,177,130, 26, 48, 96, 64,250,139,255,207,222,117,199, 53,113,254,225,231, 46,155,189, 71, 16, 68, 69,
- 81, 20,112,139, 11,197, 58,107, 29,173,226,194,189, 71,157,173,179, 14,220, 74,221,168,117,214, 90,220, 84,171,162,214, 81, 23,
- 42, 46, 16, 7, 67, 69, 1, 25, 97, 67,128,144,157,187,223, 31, 36, 52, 32, 35, 65, 91,107,127,121, 62,159,124,146,220,189,247,
-220,123,251,185,239,251, 29, 94, 94,197, 36, 73, 34, 50, 50,210,185, 58, 75,149, 6, 70, 70, 70,138, 9, 19, 38,188,123,254,252,
-121,109,163, 14,171,133,139,139, 11, 40,138, 66,183,110,221, 32,145, 72, 12,150, 45, 3, 12,248,111,162, 98, 30,173,170, 51,195,
- 43,148,138,111,167,204, 94,185, 19, 32, 76,181,238, 2,127, 25,150,104, 16,223,127,255,157, 9, 0, 35,141,216,154, 59,119,110,
-141,101, 78,180, 68, 86,155,128,128, 0, 44, 94,188, 24,155, 55,111, 86,253,248,227,143,140,248, 87,137,242,177,211, 87, 20, 84,
- 88, 15,104,208,197,148,130,250,182, 50,190,124,161,104,133,239, 87, 27, 86,166,101,150,220, 25, 59,109,105,217,221, 75, 5,160,
-144,224,171, 0, 96,207, 79, 63,137, 88, 92,115,147, 33,195, 71, 1, 64,207,157,219,130,206,172,193,129,154,197, 22, 77,120,124,
- 59,119,129,149, 70,100,237,218,186,246,185, 5,145, 25, 60,243,187, 24,133,246,122, 0,192,218, 12,103,124,191,218,208, 59, 43,
- 79,180,221,112,158,253,115,224,112, 56,171,175, 95,191,110,226,237,237, 77,228,230,230, 66,165, 42, 61, 34,114,185, 28, 66,161,
- 16, 69, 69, 69,144, 74,165,104,221,186, 53,185, 99,199, 14,147,153, 51,103,174,150,201,100,211, 63,247,237,126,251,246,237,174,
-115,231,206,225,214,173, 91,195, 22, 45, 90,196,114,116,116, 36, 44, 44, 50, 9,133, 92, 6,128,166,179,179,179, 41, 99, 83, 75,
-129,173,131,243,187,244,140, 44, 15,133, 92, 6, 74, 37,175,210,219, 92,157,222,225,251, 23, 47, 94,212,219,180,105,147, 76, 59,
- 18,112,248,130,157, 59, 90,183,110,109, 29, 28, 28, 44,235,215,175, 95,178,198,121, 93, 23,103,248, 43,111, 48,251,197,139,103,
-205, 42,114,250, 77,222,116, 80,195,169, 29,141,216,255,187,189, 7, 27, 53,106,100,237,233,233,153, 92, 29,111,131, 6, 13,196,
-124, 62, 95,214,164, 73,147, 98, 22,139, 85,106,201, 82, 40, 74, 26, 52,104, 64, 57, 56, 56,200,154, 54,109, 90,172,175,211,190,
-145,145, 17,173,177,138, 85, 6,125,162, 14, 89, 12, 40, 3, 2, 2,202, 50,195,127,223,168,145, 96,212,168, 81,252,121,243,230,
-225,224,193,131,184,123,247,238,123, 98,191,107,215,174,184,125,251,246, 74,252,135, 18,235, 26, 96,192,255, 25,170,207,163, 85,
- 17,135, 14,133,252, 9, 45,159,166,202,176,102,205, 26,174,218,146,213,115,206,156, 57, 16,139,197, 86,149, 52,235, 1,117,174,
-141,202, 68, 86, 80, 80,208, 49,154,166,157, 1,116, 86,169,168, 7,251, 15, 28,234, 86,213,250,134, 12, 25,242, 30, 39, 77,144,
- 12,146, 36,138, 57, 44,250,201, 79,251, 14, 30, 41,215,190,212,249,189, 49, 8, 60,221,185, 45, 72, 12,160,103, 69,177,133,191,
-202,140,148,113,106, 48,117,218,212, 50,145,181,115, 91,208, 85,207, 54,117,191, 89, 58,113,117,165,226,108,245,138, 41, 38, 36,
- 73,116,172,224,163,245, 30,231, 71,128,129,243, 47,116, 11, 8, 8,104,238,227,227, 67,106,139, 44,153, 76, 86,150,184, 83,227,
- 44,158,150,150,134,174, 93,187,146,205,155, 55,247,122,248,240, 97, 55,252, 85,206,233,115,221,118,213,219,183,111,119, 56, 58,
- 58, 94, 91,190,124,249,168,156,156,156,175,242,243, 11,108,194, 14,173, 70,159, 33,211,136,174,125, 71,136,100, 52,147,151, 42,
-200,108,114,243,226, 81,235, 75, 39,118, 65, 46,147, 77, 1, 16,135,191,210, 59, 84,228, 44,209,164,113,104,210,164,137, 72, 91,
-168,212,173, 91, 87,226,228,228, 36,245,244,244, 44,155, 94, 69, 52,223,123,219,174, 47,167,218,255, 75, 84,211,254,212,136,182,
-138,105, 35,140,141,141,161, 17, 95,250,244, 83, 59,218,178,210, 27,101,205, 81,135,101,156,234,244, 14,229,116, 90, 72, 72, 72,
-143,144,144,144, 54, 0,158,160,180,214,161, 2, 40, 29, 74,212,114,154, 15, 84,127, 12,215,187,129,243,255,149,243,115, 70, 87,
-252,229,155, 5,148,250,106,221,170, 82,104,213, 4,141,227, 59, 0,114,238,220,185,249, 98,177,216,106,212,168, 81,213, 46,147,
-145,145,113,240,240,225,195,229, 68,214,160, 65,131,198,133,134,134, 94,203,202,202,170,213, 86, 89,153, 27,173,185,117,126,161,
- 85,215,126, 27,230, 0,248,177, 10, 67, 30,229,217,134,255,205,206,109, 65,103, 42,136,173, 95, 1, 12,170, 74,149,246,250,114,
- 32,142, 30,218,169,241,237, 50,122,254, 56,237,210,176,168, 85,149, 70, 43, 90,154,114, 87,169,251, 49,207,224,163,245,207,128,
-205,102,251, 45, 90,180,136, 45, 18,137,222, 19, 89, 21,133, 86, 97, 97, 33,158, 62,125,138,177, 99,199,114,163,163,163,253,228,
-114,249,141,255,194, 62,200,200,200,136, 87, 39, 35,157,173, 73,225,192,229, 25,177, 71,140,159,227, 92, 22,117,120, 98, 23,164,
- 18, 49, 0, 48,117, 73,239,192,100, 50,217,209,209,209,174, 26,171,149, 92, 46,231,106,166, 63,126,252,216, 85,147, 91, 75, 34,
-145,232, 28,117,248,119,113, 62,123,246,204, 89, 19, 29,169,137, 46,100, 50,153,236,200,200, 72,103, 13,167, 84, 42,213, 41,234,
-144,195,225,176,163,163,163,157, 85, 42,213, 71,139, 58,212, 22,198, 40,173,179, 88,174,214,162,218,183,140, 32, 8,130, 54, 12,
- 27, 26, 96,192,103,143,138,145,146,213, 23,149,174, 9, 26,199,119, 61, 22, 97,186,184,184,244, 26, 62,124,120, 57,145,229,239,
-239,175, 58,125,250,244, 77, 62,159,159, 73,146,100,188,190,253, 40,243,209,194,123,111,144, 32, 73,242,105,231,182, 77, 65,146,
-228,211,165, 19, 39, 74,215,224, 64, 57,177,117,246,204,201,222,169,249, 49,149, 75, 51, 0, 54,246,117, 16, 48,238, 91, 4,140,
-251,214, 10, 64, 39,160,234,104,197,234,250, 97,192,223, 3,130, 32, 56, 78, 78, 78,207, 37, 18, 9, 8,130,128, 84, 42, 45, 19,
- 88, 69, 69, 69, 16, 10,133,101,255,229,114, 57,178,179,179, 81,183,110, 93, 16, 4,241,159,246,163,147,203,229,202, 69, 43, 55,
- 29,102, 48,217, 74,138,146, 19,114,185,124,188, 62,215,249,162, 69,139, 72, 84,226,123, 53,115,230,204, 74,167,127, 42,206, 37,
- 75,150, 84, 26, 37, 56,115,230,204,106,163, 7,171,194,119,223,125,247,209,162, 14,117,191,125, 25, 96,128, 1,255, 49, 84, 26,
-186, 87, 43,161, 69,146,228,211, 74,162, 11, 9, 0, 52, 73,146, 79, 43,201,114,160,124,247,238,221, 74, 75, 75,203, 41, 34,145,
-232,143, 65,131, 6,205,245,247,247, 87, 1,165, 14,242,181,221,162,124,161,104,133, 95,255,141,243, 10,138,165,193, 21,231, 85,
-180, 60,105,196,214,174,237, 65,187,207,132, 30,247,207, 72, 79,221, 93,213,182, 85, 37,168,170,138, 86, 20, 22,138, 87,250,245,
-223, 56, 39,191, 80,108,240,209,250,135,160, 82,169,174, 24, 25, 25, 17,154, 98,202,218,214,171,194,194, 66,148,148,148, 64, 93,
-146, 6, 0, 80, 92, 92, 12, 11, 11, 11,168, 84, 42,250, 63,182, 43,164, 0,230,171,173, 85, 0, 48, 63,241,230, 14,237,115,251,
-153,246,188,106,172, 89, 2, 93, 10, 68, 87,182, 92,117,243,254, 6,206,204,106, 10, 68, 87,135, 76, 61,249, 50, 1,128,205, 98,
-100, 85, 85, 60,154,205, 98,100, 85,227,183,175,231,123, 3, 65, 3, 88,105,184,178, 13, 48,224,243,125,255,255, 84, 43,238, 97,
-224, 52,112, 26, 56,255, 17, 78,174,250,163,235, 60,195,254, 52,112, 26, 56, 13,156,255, 54,206,202, 48,249, 51, 17, 90,116, 37,
- 31, 0,181,180,104, 25, 96,128, 1,255, 58, 72,107, 57,207, 0, 3, 12, 48,192,128, 15,199,123,197,164,181,103, 84,165, 74,245,
-137, 38,168,141,178,189,102,224, 52,112, 26, 56, 13,156, 6, 78, 3,167,129,243,255,142,179, 38,110,237,229, 39, 3,216,247,153,
-136,173, 79, 18,208, 98, 48,171, 26, 56, 13,156, 6, 78, 3,167,129,211,192,105,224,172, 45, 12, 67,135, 6, 24, 96,128, 1, 6,
- 24, 96,128, 1,255,231,208, 47, 97,169, 1,149,160,238,192,165,160,176, 68,189, 59,131,144,114, 54,240,191,182,137,254,254,254,
- 12,125,218, 39, 38, 90,146, 81,224,111, 54, 55, 97,247, 47, 22, 41, 54, 83, 81, 43,130,107, 58, 17,109, 27,180, 26,109,204, 51,
-158, 46,147,201,234,155,154,153,101,229,229,102,239,201,123,247,108,151, 86, 27,243, 7, 15, 30,240,125,124,124,210, 1, 20,105,
-189, 41, 24, 96,128, 1, 31, 19,150, 77, 93, 64, 16,227, 1,250,175,176, 75,138,142,129, 48,238, 80,185,118, 22, 30,227, 64, 18,
-205,180,166,136, 65, 99, 63, 10, 98, 83,106,120,224, 88, 38, 36, 36,184, 54,108,216, 48, 25, 64, 65,197,181, 87, 50,207,112,157,
- 27,240, 57,163, 43,202, 39, 44, 45,187, 22, 62, 92,104, 53, 26, 84, 31, 74,114, 12,104,140, 4,129,104, 36,134, 14,174, 21,143,
-219, 55,117, 64, 49,219, 1,104, 5,208,173, 76,140,120, 45,197, 50,121, 22, 69,211,163,241,230,228, 19,189,249,234,251, 79, 67,
-213,229, 44, 86, 34, 49,244, 39,189,248, 40,250,135, 71,183, 79,115, 45,141, 9, 52,108, 61,104, 1,202,103,112,174, 45, 56, 0,
-124, 73,146,108,102,108,108,204, 47, 41, 41,201,166, 40, 42, 5,165,227,211,249,181,228, 36, 1, 76, 48, 53, 49,233,227,106,198,
-105,245, 46, 71,152, 86,164, 80,133,163, 52,161,107,254,199, 58,163, 74, 69,150,227,190, 57, 35,124,198, 6,205,234, 1, 75,191,
-141, 11, 74,128,234,132, 22,225,220,184,227,217, 97,195,135,248,205,152, 60,214,180,142,157, 41, 4, 57, 34,155,159, 14,134,108,
- 10, 9, 57,218,111,226,176,158,125, 0, 96,245,234,213, 95,187,184,184,212, 99, 48, 24,137,203,150, 45,251,117,197,138, 21, 52,
- 81,117,165,114,190,250, 28,214,220,240, 77, 0,120, 2,104, 0,224, 45,128, 23, 40,159,101,188, 54,248, 44, 56,235,212,169,227,
- 68, 81,212, 68, 7, 7,135,175, 50, 51, 51, 47,144, 36,121, 32, 45, 45, 45,253, 83,222,117,104,154,222, 75, 16,196,100,154,166,
-247,233,241, 61, 69,159,117,240,120,188, 76,137, 68, 98,175,254,157, 37,145, 72, 28,254,174,237,249, 39,215,245, 15,189,127, 79,
-186,114,231, 69, 31,237, 73,189, 58, 55,171,228,142, 66, 52,187,114, 39,166, 75,249,118,158,170, 42,238,129, 4, 77,211, 88,185,
-114, 37,177,106,213,170,113,110,110,110,141, 72,146,124,185,124,249,242,114,169,111, 42,206,211,186,206, 13, 98,203,128,207, 21,
-250, 21,149,174, 17, 77,253, 77, 32,161,253, 1, 98,108,215,182, 45, 59, 79, 25,221,159,160, 25, 60,140,152,180, 80,169, 55,151,
-235, 88, 46, 24,226, 53,222,205, 26,207, 29,210,191, 7,217,198,179, 30,248,118, 22, 0,201,194,222,139, 73, 54,193, 65,203,118,
- 3,240,169, 69, 47, 87,188,137, 56,102, 47, 40, 80,129, 32, 0,130, 0, 72, 2, 40,150, 80,232,245,245,152, 21, 0,126,210,243,
-174, 68, 90, 26, 19,152,123, 76, 2, 0,140,143,112, 80,234,217,217,217,141,155, 61,123,182,137,167,167,167, 37,143,199,227, 72,
- 36, 18,135,132,132, 4,187,101,203,150,121,138,197,226,243, 0, 30,233,201, 89,183,161,179,211,201,224,185, 19,218, 53,111,224,
- 10,150,172, 24,148, 84,228,242, 42,225,117,135,169,187, 79, 77,138,201,147, 12, 71, 45, 74, 38,228,228,228, 16, 0, 96,107,107,
- 75,151, 23, 89,237,199,110,157,215, 11,115,183, 92, 65,137, 68,118,164, 58, 14,235,122, 45, 70,125,243,205, 64,191,181, 63,204,
- 52, 77,203,149, 35, 58, 81, 12,107, 83, 54, 86,204,159,198,145, 74, 21, 29,118,255, 26, 50,121,231,134,133,251, 85, 42,213, 23,
- 0,218,168, 84,170,199, 0,126, 93,185,114,101, 85, 55,223, 85, 0,150,168, 79,232,163, 12, 6,227,106,183,110,221,234, 79,156,
- 56,145,104,221,186, 53, 34, 35, 35, 27, 28, 59,118,172,199,133, 11, 23, 18, 85, 42,213, 51, 0, 47,161, 46,123,162, 3, 88, 0,
- 26, 51, 24, 12,239,127, 51, 39,159,207, 55,146,201,100, 99,156,157,157, 39,119,236,216,209,187,127,255,254, 68,227,198,141, 17,
- 31, 31,223,250,210,165, 75, 43,194,195,195,159,165,166,166,238,227,112, 56,135, 5, 2,129,248, 31,127,142, 19,196,100, 0, 78,
-106,157,188, 82,135,239,116,148,230,146, 18,232,186, 14,137, 68, 98,175, 41, 97, 67, 16,132,253,223,185, 61,122,174, 43,150, 32,
- 8,107,117, 91, 84,247, 77,146, 36,148, 74,165, 72,165, 82,185,213,192,217, 88,253, 34,165,179,214, 5, 80, 93, 34,104, 35, 0,
-232,213,169, 89, 30, 8,196,148, 89,180,222,127,201,140, 41, 19, 96, 52,154, 93,185, 27, 99, 93,206, 10, 86,241, 45,118,229, 74,
- 98,197,138, 21, 8, 12, 12,236, 15,192,151,162,168,112, 15, 15,143, 29,229, 40, 41,170,108,222,138, 21, 43,182, 87,115,157, 27,
- 96,192,231, 2, 63,232, 83, 84,186,202,247, 31,183,193, 93,160,194, 88, 87, 27,123,255, 89, 19,135, 26,121,122, 52,132, 4,166,
- 72,202, 81,225, 98,216, 37, 0, 56,161,159,213,105,104, 27, 38, 83,114, 56, 40,112,126, 19,223,118,158,120,158,166,192,227, 52,
- 21, 74, 18, 21, 96,144, 10,168, 40, 26,160, 33,169,237, 86,167,230, 43,113,231,165, 12, 36, 1, 48, 72,128, 36, 9, 48,200, 90,
-146, 81,178, 87,171, 15, 69,121,230,100, 82, 0, 37,123,245,129, 7,164,153,187,187,251,168, 85,171, 86, 89,102,100,100,152, 68,
- 70, 70,130,203,229,194,202,202,138,193,231,243,157,182,108,217, 34,158, 53,107,214, 87,114,185, 60, 9, 64,142,142,156, 30,125,
-219,120,223,219, 23,180,218, 66,241,224, 18, 10,142,255, 6, 6, 73,131,109, 98,138,250, 70, 70,184,244, 77, 67,107,255,176,196,
-211, 15, 51, 69, 30, 0,210,106, 34,139,139,139, 99, 72,165,210,225,230,230,230,237, 89, 44,150, 3,207,170, 30,149,206,108,147,
-155, 77, 52,120,155,101, 95,210,101, 94, 15,135, 62,155,231,116,195,220, 45, 87,176,237,216,253, 95, 90, 33, 99,121,117,121,179,
-141,141, 77,167,204,154, 62,209, 52, 53, 71,142, 53,167,115,112,232,118, 33,198,248,154, 97,238,151, 22, 8, 24, 49,204,228,212,
-111,161, 83, 0,236,215, 90, 36,222,195,195,131,136,139,139,171,236,230,107, 5, 96,161, 76, 38, 35,217,108, 54,193,227,241, 70,
-173, 93,187, 86, 62, 98,196,136, 84, 77, 3, 95, 95, 95,248,250,250, 18, 69, 69, 69, 13,110,220,184,209, 32, 36, 36, 68, 25, 17,
- 17, 17, 11,224,108,213, 22, 11,163,119, 18,137,216,133,103,100, 84,242,211,238,221,155,187,116,233, 66,113,185,127,165,159,170,
- 13, 39, 0, 88, 88, 88,236,183,183,183, 39, 22, 47, 94,156,254,177, 56,235,213,171,119,165, 93,187,118,221,122,245,234,197,236,
-212,169, 19,156,156,156,202,230,217,218,218,194,215,215,151, 72, 73, 73,105, 30, 30, 30,190,251,202,149, 43, 59,158, 60,121,114,
- 35, 41, 41,169,215, 63,108,209,218,167, 22, 19, 2, 61,219,127,246, 32, 8,194,116,239,222,189,246,154,154,140, 10,133, 2, 42,
-149,170,236, 91,243,161, 40, 10, 42,149, 10,107,215,174, 85,137, 68, 34, 93,246,145, 72,235,173, 89,243,161, 42,251,230,112, 56,
-182,154,132,189, 53,220,217, 99,248,220,130,166, 38, 38, 38,174, 0,250,194,174,209,194,242, 13, 74,223,159, 69, 34, 81,178, 64,
-106, 25, 3,160, 75, 53,108,150,171, 86,173, 26, 19, 24, 24, 56, 80,203, 74,235, 61,100,200,144,138,101,175,188,213,223, 34,130,
- 32,110,146, 36,121, 30,192, 33,124, 68,171,187, 1,255, 45,208, 52,221, 22,128,157,214, 36, 25, 74, 71,133,160,126, 78, 18, 0,
-108, 42, 76,215,110,167,249,206, 86, 79,183, 83, 47, 71,107,241,102, 19, 4,241,168,150, 93,188,133, 42,252,180,152, 0, 16, 22,
- 22, 70,247,235,215,143,208,124, 87, 46,138,252, 47, 78, 24, 49,160,207, 87,221, 59,130,228, 89,225, 85, 22, 16,241,142, 6,147,
- 84,128, 4,141, 7,119,111,208, 96, 82,135, 43, 44, 85,181,245,164,222,224,239,188, 61, 61, 54, 30, 8,154,205,136,205, 98,226,
- 80,120, 9,228,146, 98,100,103,188, 67, 86,122, 50, 4,169,111,145,246,238,237, 51,128, 88,161, 51,231,123, 7, 6, 80, 81,234,
-119, 64, 10,168, 38,242,178,102, 78,185, 40,174, 65, 99, 79,207,124,142, 10,144,139,226,116, 88,125, 85,156, 94,141, 26, 53, 26,
-241,195, 15, 63, 88,191,120,241,194,168,164,164, 68,122,233,210,165,248,164,164, 36,115, 62,159,159, 55,109,218,180, 70, 78, 78,
- 78,230,131, 6, 13,226, 28, 63,126,252,107,148, 15,107,173,138,211,115, 64,251,150, 17, 7,119,108, 53,201, 61, 21, 12, 89,194,
- 83, 92, 20,136,112, 55,179,132,110, 96,193, 37,190,109,110, 7, 83, 46, 19,171, 59, 57,153,246, 61,147,176, 81, 65, 81, 1,213,
-113,222,187,119,143,111,108,108,188,101,228,200,145,252,153, 51,103,114, 85, 76, 75,102,104, 68,174,197,194,221, 17, 78, 37, 82,
- 57, 99, 68,183,122,152, 55,210, 27,243,182, 93,215,136,172,201,245,235, 23, 80, 81, 81, 85,115, 42,228,242,250,206,246,230,136,
- 78, 18,227,208,237, 66,252,249,131, 19,186,175, 77,199,160, 86, 76,120,212, 53,133, 82,174,104, 60,100,200,144,195,234,183,246,
- 71, 0,190, 30, 50,100, 72, 19, 6,131,113, 29,192,239, 53, 29, 35, 30,175,242,234, 41, 86, 86, 86,232,218,181, 43, 60, 60, 60,
-152, 93,186,116,241,174, 32, 96,202,113,202,229, 50, 62, 69,209, 48, 51, 51, 51,178,177,177,177, 50, 51, 51,203,173,236, 65,165,
- 15, 39, 0, 88, 91, 91, 15,238,218,181, 43,243,216,177, 99, 57,137,137,137, 15, 70,140, 24,241,214,220,220,188,156,245,215,196,
-196, 4,141, 26, 53,194,178,101,203,152,125,250,244,169,145,211,193,193,161,103, 72, 72, 8, 8,130, 40,123,104,191,103, 44,118,
-117,133,163,163, 35,250,246,237,203, 28, 60,120,112,207,164,164,164, 90, 93, 71,122,224, 90, 37, 22,173,149, 21,142, 83,149,195,
-111,149,181,215,225,184,103,105,172, 75,106, 62,124,192,181, 89,237,112, 39,143,199, 43,179, 66, 85,178,174,247, 56, 73,146,196,
-210,165, 75, 65, 16, 4, 88, 44, 22,216,108,118,165,223,126,126,126,250,246, 51,133, 32, 8,146,205,102, 47,100, 50,153, 19,165,
- 82,169, 51,143,199, 75, 87,169, 84,191, 72,165,210,181, 0, 20, 52, 77, 91, 86, 33,178, 42,229, 52, 49, 49,113,125,245,234,149,
-123, 85, 29,145, 74,165,240,246,246, 6,164,136,173,142, 51, 33, 33,193,213,205,205,173, 49, 0, 77,137,182,219, 52, 77,119,209,
-250,175,141,219, 52, 77,127,169,254,253,242,205,155, 55,174, 13, 27, 54,204,255,167,206, 79, 3,231,191,143,179, 6, 45, 98, 71,
- 16, 68,152,113, 48, 25,151, 0, 0, 32, 0, 73, 68, 65, 84,214,181,218, 79,243,127,209,162, 69, 75,214,175, 95,255,130, 32,136,
- 48,237,233,218,237,180,191,213,247,155, 48,154,166,251, 45, 94,188,216,115,195,134, 13,235, 52,109,255, 14,145,168,143, 69,203,
- 60, 91, 98,130,240,119,230, 96, 50, 84, 96,146, 4,152, 12, 0, 52,129,228,164, 4, 20, 21, 22,220, 65,226,233, 68,221, 44, 89,
-254,157, 90,180,240, 10, 58,186,109, 1,249,115,120, 9, 10, 68, 18,196, 61,185,137, 71, 55,127,207, 80, 41, 85,191,131,160, 31,
- 3,100, 36,222, 82,241, 64,104,237,106, 92, 16, 52,179, 84,104,169,197, 85, 57,177,245,201,208,188, 73,147, 38,195,150, 45, 91,
-102, 27, 21, 21,197, 19, 10,133, 69, 71,143, 30, 77,151, 74,165, 73, 0, 46, 39, 39, 39, 55,217,190,125, 59, 39, 40, 40,200,203,
-203,203,139,127,242,228, 73, 89, 37,229,140,222,227,156, 63, 54, 32, 98,226,172, 57,188,216,147,187,192,137,141,196,210,167, 57,
-170, 63, 5, 37, 63, 0,216,134,148,226, 78,217, 18,229,213,173, 93, 93,200,122,102,108, 52,180,228,248,197,229, 73,170,181,100,
- 25, 27, 27,111, 9, 9, 9,113,109,219,182, 45, 9, 0,225, 47,149,220,133,187, 35,156, 46,175,239, 68,116,106,102,131,172, 2,
- 41,102,239,138,198,165,136,172, 63, 52, 34,171,166, 78,154,153,153,101,167,102, 21, 58,216,152,242, 48,186,179, 41,186,175, 77,
-135,127, 27, 46,184,108, 2,241,137, 25,104,232, 86,143,136,190,115,182,141, 90,100,181, 21, 8, 4, 0,208, 6, 64, 98, 74, 74,
- 10,223,199,199, 71,168, 69,151, 15, 96, 35,135,195, 89, 74, 16, 4,221,182,109,219,104, 47, 47,175, 98, 43, 43, 43,136,197, 98,
- 72,165, 82,176,217,108,136,197, 98, 36, 39, 39,227,193,131, 7,176,178,178,210,235, 64, 21, 23, 23,195,204,204, 12, 20, 69,125,
- 48,167, 74,165, 34,246,236,217, 99,242,226,197, 11,147,208,208, 80,135,185,115,231,230, 54,109,218,244,241,176, 97,195, 94,219,
-219,219, 75,159, 62,125,138,123,247,238, 33, 63, 63, 31,237,219,183,215,137, 83, 38,147,129,201,100, 66, 44, 22,131,203,229,130,
-201,100, 66,169, 84,130,162,168, 50,241, 85, 92, 92,140,188,188, 60,176,217,108,200,100,178, 79,241, 6,250,158,133,170,186,225,
-183,218, 88,180,180,133,154,142, 34,171, 38, 75, 84,149,195,157, 5, 5, 5, 70,150,150,150, 11, 1, 8,106, 90, 23, 65, 16, 96,
- 48, 24, 96,179,217, 32, 8, 2, 93,186,116,193,132, 9, 19,208,170, 85, 43, 36, 36, 36,224,248,241,227,120,244,232, 17, 88, 44,
- 86, 89,123,157,199, 39,252,252, 24, 60, 30,239,222,128, 1, 3, 60,127,248,225, 7, 94,189,122,245, 16, 27, 27, 91,119,195,134,
- 13, 11,175, 93,187, 54, 80, 36, 18,181,209,220,237,170,183,210,171,135, 4, 75,135, 11,251, 74,165, 82,196,198,198,234,179,204,
-123,104,216,176, 97, 50, 73,146,175, 41,138, 10, 7,224, 77,211,116, 23,130, 32, 46,161,212, 47, 81, 27, 34,154,166,191, 36, 8,
-162, 16,192, 51,146, 36, 95, 82, 20,149,108,176,219, 24,160,195,125,165, 95,197,255, 4, 65,132,173, 95,191,190, 95,101,226,170,
-146,107,179,220,244, 13, 27, 54,172,211,250,255, 33, 22,213,174, 40,239, 12,239,167,182,114,253, 37,180,194,194,194,170, 87, 32,
- 20, 6,133,157, 62,118,191,187, 28,174,158,173,125,181,172, 67, 52, 34, 31,220, 3, 64,255,162, 83, 87,248,253,140, 72, 6,243,
-151, 61,235,102,146,123,111,150, 32, 37, 61, 11,247, 46,254,130,108, 65,210, 33,128,158,139,196,208,194, 15, 62, 18,245, 6,121,
-217,219,216, 90, 74,228, 52, 40, 26,192,123, 98,235,147,160, 85,227,198,141, 7, 71, 68, 68,216, 74, 36, 18,222,157, 59,119, 74,
- 66, 66, 66, 50,228,114,249, 77, 0,119,213,109,162,178,179,179,135,168,133, 9,131,201,100,114,228,114,121,117,190, 11,173,230,
- 79, 28,115,103,227,158,131,188,215,207,163,177, 61,244, 34, 10, 74, 74, 84, 55,179,196, 95, 3,208, 40,250,235, 81, 57,226, 52,
- 26,180, 11,139, 36,192, 55, 97, 57,198,229, 73,120, 64,229, 67,178, 82,169,116,196,200,145, 35,249, 26,145, 5, 0, 57, 69, 10,
-102,137, 84,193,232,212,204, 6,173,187, 13, 65,228,141, 83, 56,121, 59, 13,110,118,198,183,235,155, 20,232,180, 71,179,179, 4,
-123,182, 6,239,221,186,113,229,124,206,188,190, 22,240,111,195, 2,143, 77,192,220,152,133,181, 59,246, 43,162, 30,220,126,202,
-231,243,195, 0,124, 45, 16, 8,192,231,243,139, 1,188,100, 48, 24,137, 42,149,170, 50,167,238,229, 0, 28, 14, 31, 62, 76, 42,
- 20,138,226,132,132, 4, 56, 58, 58,194,193,193, 1, 22, 22, 22,136,139,139,195,159,127,254,137,248,248,120, 80, 20,133, 22, 45,
- 90,232,117,176,114,115,115,241,244,233, 83,244,237,251,213,220,236,236, 44,115, 43,107, 27,209,157,240,219,155,106,195, 73, 81,
- 20, 1, 0,158,158,158,240,244,244,228,165,165,165, 57,135,133,133,217,175, 89,179,230,157,171,171,235, 81,177, 88, 92,206,114,
-160,171,208,210,136, 11,141, 8,228,241,120, 96,179,217, 40, 44, 44, 68,102,102, 38,138,138, 74,131, 54, 45, 45, 45, 63,137,208,
-170,194, 66,245,209,218,255,205,226,240,189,225, 78, 75, 75,203,145, 0, 22,234,184, 45, 80, 42,149, 96,179,217,240,241,241, 65,
-112,112, 48, 30, 61,122,132,223,127,255, 29,117,235,214,197,216,177, 99, 65,146, 36, 94,188,120,161,111, 23,169,136,136,136,133,
- 95,127,253,181,231,225,195,135,121,201,201,201,136,143,143,135,165,165, 37,130,131,131,185,147, 39, 79,110,120,227,198,141,229,
- 40, 13,126,169, 30, 90,209,133, 34, 35,254, 80,111,111,239,247,154, 56, 58, 58, 90, 92,190,124,217,190, 76,128, 85,140, 72,124,
- 31, 5,203,151, 47,223,234,225,225,177, 77, 61, 92,232, 11,192,132,166,105,191,208,208, 80, 2, 0,252,253,253,105,130, 32, 52,
- 15,164,103,167, 78,157,234, 22, 23, 23, 71, 7, 6, 6, 26,124,180, 12,168, 74,139, 76,214, 92,147, 85, 9, 40,125,132,154,182,
-197, 75,131,197,139, 23,123,174, 95,191,254,225, 7,138, 44,237, 55, 38, 90, 35,182,202, 30,166, 85, 14, 25,150,217,190, 72,190,
-163,189,141,245,162,177,157, 64, 81,128, 82, 5, 40, 85, 52, 68, 37, 98,196, 62,127, 84, 2, 30, 17,170, 83,119,184,156,160, 53,
- 63,204,105, 16,157, 74, 34, 61, 95,142, 91,103,247,210,217,130,164,193, 72, 60, 53,254,227,136,172,161,222,142, 14,246,183,142,
-237, 93, 77, 62,122, 43,131,138, 42,213, 89, 20, 69,151,253,254, 4,112,180,179,179, 11,184,127,255,190, 29,151,203,229,189,122,
-245,138, 58,117,234, 84,190, 92, 46,191,166, 37,178, 0,160, 83,155, 54,109,148,166,166,166, 16,137, 68,114,185, 92, 46,169, 70,
-100, 57,251,181,106,126,123,227,158,131, 60,137, 76, 6,161, 88, 10,134,141,125, 69,145, 5, 0, 29,187,185,215,169, 67,240,204,
- 64, 3, 72, 42,148,167, 87, 37,178, 0,128,203,229,246,152, 57,115,102,185,186,120,182,102, 44,165, 49,151,165,186, 27,147, 67,
- 69,222, 56,133,240, 23, 57, 20,143,205, 80,217,209,111, 27,232,186, 3, 10, 82, 99,246,252,126, 46,236,234,119,203,130,138, 75,
- 68, 69,112,115, 50, 66,113,145, 16,107,215,111, 84, 68, 68,132,223, 92, 56,119,106,135, 83,167, 78,109, 64,169, 51, 56, 0,188,
- 60,117,234,212,152,101,203,150,253,138,191,210, 60, 84, 68,122, 64, 64, 64,106,179,102,205,132, 30, 30, 30,194,220,220, 92,196,
-196,196, 32, 63, 63, 31,219,183,111, 71,108,108, 44, 52, 22, 65,157,124, 85,222, 23, 72,200,207,207, 51,165,105, 26,249,121,185,
- 38, 63,252,240,131, 69,109, 56, 85, 42, 85,185,107,171, 78,157, 58,152, 54,109, 26,187,164,164,196,242,221,187,119,230,218,243,
-116,229,148,201,100,208, 88,134,104,154,134, 76, 38,131, 80, 40,132, 76, 38,195,235,215,175,203, 68,150,122,253,159,204,162,165,
-249,205,227,241, 50, 53,231,178,102, 8,142,199,227,101, 85,213,254, 67,160,181, 46, 90,253, 91, 95,113, 88,227,246,232,120,220,
-193,102,179, 49, 97,194, 4, 60,124,248, 16, 9, 9, 9, 96, 48, 24, 16,137, 68, 40, 41, 41, 65,207,158, 61,193,225,112,244,181,
-104,209,108, 54,123,228,146, 37, 75,120,137,137,137,200,201,201,209, 56,211, 67,165, 82, 97,238,220,185, 70, 92, 46,119,164,190,
-166,123,129, 64,208,251,245,235,215,141, 43,126, 50, 50, 50,132,218, 62,133,181, 69,104,104, 40,225,239,239, 79,251,251,251,211,
- 26,193,101,128, 1,149,161, 10, 45,178,175, 42,139,214,199,176,138,105, 44, 91, 80, 7,136,212, 2, 26,145,213, 85, 75,120, 17,
- 26, 11,151,110, 67,135,110, 67, 91, 58,216, 88,223, 56,188,107,149,105,216,115, 2,169, 41, 73,200, 22, 36,163, 77, 7, 63,196,
- 62,143, 6,165, 80,157,198,235,208,154, 61, 57,235,249,187,123,120, 52,157,222,181,131, 23,130,194,138,241, 42,242, 50, 10,178,
- 5, 59,145,116,234,244, 71, 57, 66,174,254,205, 29,236,173,111,252,186,107,149,229,165, 24, 18, 41, 41, 73, 56,251,235, 86, 90,
- 33,151, 22,160,124, 36,151,222,111,205, 70,148,140, 83, 92,144, 9, 89,145, 10, 60,178,132,167,231, 32, 69, 6,128,240,173, 91,
-183,118,111,223,190, 61, 39, 32, 32, 32, 35, 63, 63,255, 44,128,251, 90,109,154,185,187,187,247, 13, 14, 14,118, 72, 73, 73,193,
-181,107,215, 50, 80, 26,250, 95, 21, 82,111, 71, 63,223,253,231,175,251,231, 27, 53,104,130,237, 75,190, 83,134, 62,138, 25, 0,
-224,146, 86, 27,143, 30,222,238, 97,107,190,159, 65, 82, 81,127,224,105,114, 38,222, 10,165,127, 86, 69,152,147,147, 67,148,148,
-148,184, 90, 90, 90,106,159,144,224,155,136,164, 11,134,186,167,247, 92,120,199, 73, 34, 87,129,203, 34,233,217, 3, 93,211, 31,
-158, 13,181,201,145,228, 16,154,104,196,154, 48,105, 88,143,129,187, 66,206,140, 14, 11,187, 48, 93, 46,149,120, 53,105,210,152,
-126, 28,113,227,233,194,185, 83,251,212,242,136,155, 62,124,248,144,100, 48, 24,229, 4,186,182,133, 72, 95, 75,145, 62,208,149,
-179,162,208,210, 64,169, 84, 18,181,229,148, 74,165,101, 66,171,226,195,189, 50,193,248,119,108,191, 62, 22, 42,237, 33, 67,141,
- 63,157, 68, 34,177, 87,251,108, 57,124, 76,139,214,135, 68, 34, 86, 55,124,169, 79,255, 72,146, 4, 69, 81, 96,179,217,104,209,
-162, 5,194,194,194, 96,109,109, 13,115,115,115,152,155,155,195,200,200, 8, 54, 54, 54,101, 66,139, 36,117,142,210,161,165, 82,
-105,221,186,117,235,226,245,235,215,224,241,120,101, 31, 46,151, 11, 79, 79, 79,136, 68,162, 58,248,148,182,123, 3, 12,248,123,
-239, 43, 97,218, 98,137, 32,136,176, 69,139, 22, 45,169, 45,223,162, 69,139,150, 84,102,225,250, 64,193, 85,206,186,197,212, 86,
-144,149, 42, 73,181,200, 58,180,115,165,249,153, 39, 64,106,106, 34,174,158,220, 81,164,144,203,242, 41, 74,225,250, 54, 62, 26,
- 32,241,139, 78, 93, 32,233,118, 3,251,118, 35,174,190,144,161,176, 32, 27, 47, 31, 95, 78,130,152,179,248,163,137, 44, 7,219,
- 27,135,119,173,180, 60,255,156, 64, 74, 74, 18, 46, 29,219, 94,168,144,203,123, 32, 49,244,241,135, 80,143,100,179, 7,178, 93,
-222,245,155,232,155, 14, 21,161,194,200,216,184, 47,179, 50, 48, 80,112,167,250,200, 48,109,100,103,103,159,221,186,117, 43,241,
-227,143, 63,118,149, 72, 36,191, 1,208, 54, 81,122,185,185,185, 13,223,183,111,159,117, 74, 74, 10,235,206,157, 59,162, 27, 55,
-110,208, 0,206,215, 96,113, 89,208,115,252, 52, 70,171,122,117,102, 70, 37,165, 13, 0,240,135,214,108,207,126,173,155,221, 61,
-184,126,185,153,226,110, 40,138, 5, 41, 88,124, 55,181, 16,128,206,251, 91,161, 80, 64, 40, 20, 66, 81,156,171,108,195, 23, 9,
- 3,135,216, 75, 51,243, 37, 76, 22, 85,162,244, 48,207,146,222,200,125,203, 48, 54, 54,214,107, 95,238, 90, 63, 63, 4, 64,200,
-144, 33, 67, 14, 63,139,184,208,134,207,231, 95,240,240,240, 32, 0,160,138, 8,195,170,176, 10,192,220,142, 29, 59, 18, 62, 62,
- 62, 15,182,109,219,118,165, 58,177, 82, 27,139, 86, 77,208,149,147,162, 40,178,138,253, 75,212,150, 83,219,162, 85,147,208,250,
-148, 22,173,202, 68,139,182, 72,212, 22, 66,255,134,168,195,234,196,148, 62,253,211,248,201,177,217,108, 68, 71, 71,195,197,197,
- 5,114,185, 28,102,102,102, 48, 51, 51,131,169,169, 41,138,138,138,192, 98,177,160,231, 54, 83, 60, 30,239, 93, 76, 76, 76, 99,
- 59, 59, 59,168, 84,170,114, 98,235,213,171, 87, 48, 49, 49, 73,211,215,162,197,231,243, 47,171,163, 14,203,193,209,209,209,226,
- 99,236, 87,109, 75,150,191,191,191, 97,136,208,128,106,173, 89, 85, 88,181,178, 43, 88,162,100, 90,255,179, 81,154,195,173,159,
-250, 55, 42,249, 45,171,100, 90,238,250,245,235,111,104,249,119,101,127,224, 38,104, 82, 60,148,139,112, 97,214,100,201,178,183,
-182,186,113, 96,123,160,249,201, 72, 32, 45, 37, 17,183, 78, 7, 11,149, 42,249, 23,160,104, 65,196,181,211,161, 32, 80,130,183,
-161,183,116,187, 69,160, 85,171,166,174,248,253,133, 2,217,169,175, 64,211,212, 33,100,133,148,124,240,209,113, 27,212,194,222,
-218,246,198,161,224, 64,139, 51,209, 4, 82, 83, 18,113,245,100,112,161, 82, 81,210, 29,137,167, 35,107, 75, 59, 1,176, 98,152,
-240,118, 15,246,107, 53,212,213,205, 25, 20,173, 0,197,166, 49,104,129, 45,243,101, 84,201,239,225, 60,225, 73,170,152,154,158,
-118, 95, 55, 7,186,226,226,226,223, 1, 60, 70,249,244, 10,205, 27, 53,106, 52,116,247,238,221,118,169,169,169,188,168,168, 40,
-241,222,189,123,179, 40,138, 58, 3, 64,151,161,212,239,162,146,210, 14,160,124,190,156,230,243,199, 7, 68, 4,140,155,200, 75,
-188, 22, 2,171,196, 88,124,127, 55, 93,245, 50, 95, 54, 66,109, 93,171, 20,182,182,182,116, 78, 78, 78,114, 65, 65, 65, 99, 19,
- 19, 19,228,230,230, 34, 47, 47, 15, 66,161, 16,210,194, 60,165,141,170, 64, 68, 40,243,192, 98,177,144,149,162,128, 74,165,202,
-208,213,154, 5,192,106,213,170, 85,147, 40,138,210,100, 68, 44, 23, 93,168,213, 78,115, 62, 52, 30, 50,100,200, 97,173,168, 67,
-109,103,120, 77,122, 7, 66,157,222,161,253, 31,127,252, 17,215,167, 79,159,212,202,196, 10,151,203,213,219, 81,186,170, 40,198,
-218,112, 86,101,209,170, 56, 93, 31, 78,205,240,165,198, 9,190,226,116, 13, 24, 12, 6, 40,138,130, 14, 65, 21,127,171,104,209,
-142, 14,172,141,200,169,112,108,170, 77, 28, 90,203, 72,196,143,106,209,210, 28, 11, 54,155,141,115,231,206, 97,220,184,113, 80,
-169, 84, 48, 54, 54,134,169,169, 41, 76, 76, 76,112,250,244,105,104,210, 63,232,163, 95, 21, 10,197,145,245,235,215, 47,217,179,
-103,143, 17, 77,211,224,112, 56,101, 66, 43, 48, 48, 80, 44,151,203,143,232, 36,180, 52, 25,223, 41, 58,198,196, 68, 89,109,212,
- 97,101,203, 84,225,175,101,185,106,213,170, 49, 20, 69, 13, 68,133, 20, 14, 21,218,149, 75,253, 96, 72,239, 96,128, 14,247,147,
- 71,255,226,238,105, 4, 22,161,101,201, 42, 19, 92,100,117,226,197,206,202,242,198,254,237,129,230, 71, 31, 17, 72,124,251, 22,
- 55,127,219, 81, 42,178,222,156,124,130,228,208, 76, 36,134,118,198,219,208,222, 58,191, 61, 17, 68, 43, 39,123, 75,228,137, 40,
- 20,230,188, 3,104, 68,125, 12,145,101,103,101,119,227,231,224, 64,139, 83, 79, 72, 36, 38, 38,226,234,201, 29, 66,165, 82,242,
-197,135,136,172,145,108,246,192, 70,238,206, 9, 75, 39, 13, 28,234,211,208, 17, 54,239,226,112,126,236, 80,172, 62,254, 13,204,
-236, 24,104,215,215, 12, 19,214, 58, 14,229,123,114, 95,243, 59, 99,160, 30,212,218, 34,171, 85,253,250,245,135,222,191,127,223,
-214,219,219,155, 23, 31, 31, 47,217,187,119,111,150, 88, 44,190, 2, 32, 90, 15, 78,109,145,213,106,209,228,177, 17, 27,247, 31,
-230,145,108, 14,130,142,156,199,172,219,169,170, 11,201,133, 67, 80,126, 88,177, 82, 72,165,210,107,193,193,193, 82,146, 36,145,
-151,151,135,156,156, 28,100,101,101,149,125, 23, 20, 20,128,193, 96,224,250,245,235,178,194,194,194,251,186,118,240,222,189,123,
-245,211,210,210, 60, 4, 2, 65, 27,245, 39, 30,165,209,133,166, 90,211,218, 8, 4,130,174, 0, 30,105,166,167,166,166,214,123,
-240,224, 1,191, 38,126, 51, 51, 51,176,217,236,114, 22, 45, 46,151, 11, 7, 7, 7, 40,149, 74,156, 56,113, 2, 0,242,170,227,
- 96,179, 57, 2,146, 36, 64,209,148,148,199,227, 81,124, 62,191, 82,129,165, 15,167, 26,169, 95,126,249,165, 36, 50, 50,178, 82,
-139, 86,109, 56,105,154, 46,233,213,171, 23,210,211,211,193,227,241,202, 30,214, 26, 65, 69,146, 36,184, 92, 46, 50, 50, 50, 48,
-101,202, 20,208, 52, 93,242, 79,223,121,180,125,154,212, 98,136, 0, 64,168,133,208,123,126, 90,186,250, 64,105,134, 6,105,154,
-134, 70,112, 85,152, 95,182, 46, 93,178,183, 87,240,233,154, 92, 80, 80,176,177,180, 59,244,222, 10,223,251,244,120, 40,148, 9,
-173,216,216, 88, 28, 62,124, 24, 5, 5, 5,224,112, 56,200,207,207,199,193,131, 7, 17, 19, 19, 3, 14,135, 3,205,190,208, 85,
-191,249,248,248,108, 12, 15, 15,143, 25, 49, 98,132, 56, 58, 58, 26, 98,177, 24,209,209,209,232,221,187,183,228,238,221,187, 9,
- 98,177,120, 21,116, 25, 58,212,100,124, 87,151,215,145, 74,165,136,138,138,170,244, 83,213, 50, 21,145,144,144,224,170, 82,169,
- 26,211, 52,237, 75,211,180, 57,212, 41, 28,212,255,181, 63, 95,170,231,153,211, 52,237,171, 82,169, 26, 37, 36, 36,184, 26,228,
-132, 1,159, 41,110,105,137, 45, 90, 75,100,221,170,222,162, 69,145,193, 7,118,172, 52, 63,242,144, 68, 74,114, 2, 30, 95,220,
- 45, 84, 81,138, 47,244, 44,135,211, 3, 90,185, 54,120, 70, 38, 94, 20, 81, 26,206, 92,152,147, 2,208,140,218, 8,173,114,156,
-160,200,224,131, 59, 2, 45,142, 61, 38,144,158,242, 6,119,207,238, 18, 42,149,210,238,120, 27, 26, 85, 27,206,145,108,246, 50,
- 22,131, 88,218,171, 83, 75,118,231,150,238, 48,201, 74, 66, 70,106, 58, 78,196,102,231, 37,228, 75, 39,222, 37,228, 72,126, 35,
- 61,208,119,146,181,181,149, 35, 11,253,166,218, 88,223, 63, 95,248, 59,193, 18,201,105, 57,189, 94,112,183,172, 44, 69,249,126,
-190, 15, 71, 51, 51,179, 17,143, 31, 63, 54,231,241,120, 70,143, 31, 63,166,246,238,221,155, 43, 22,139, 47, 2,136,208,105,219,
-223,135,115, 91,119,183, 91,235,118,237,231, 21,139, 74, 32,146,201,193,117,224,171,206, 68, 60, 31,140,170, 19, 96,150,227,228,
-114,185,199,142, 29, 59,214,183, 75,151, 46,174, 94, 94, 94,100, 94, 94, 30,138,139,139,203,156,171,237,236,236, 16, 27, 27, 75,
- 37, 38, 38,166,115,185,220,227,186,246,179, 99,199,142,137, 36, 73,198,171,135,209,226, 81, 33,186, 80,171,105, 99,129, 64,208,
-150,207,231,223, 2, 96,172, 21,117,168,205,169, 73,239,176, 4, 0, 73, 16,196,163,232,232,232,226, 62,125,250,192,200,200, 8,
- 34,145, 8,117,235,214,133, 82,169,196,197,139, 23, 17, 25, 25, 41,162, 40,234, 86, 37,226,181, 92, 63, 37, 18,113, 93, 0,164,
-184,164,164,197,152, 49, 99,186,206,155, 55,175, 92, 72,186,189,189, 61,172,173,173,245,226, 4,128,188,188,188,166,127,252,241,
-199,156,232,232,232,239,250,246,237,107,177,100,201, 18,110,253,250,245,161, 82,169,200,218,114,230,231,231, 91, 68, 69, 69,109,
-234,220,185,243,140, 62,125,250, 48,215,173, 91, 7, 11, 11, 11,168, 84, 42, 24, 25, 25,161,176,176, 16,171, 86,173,194,157, 59,
-119,148, 52, 77,239, 18, 10,133,223,235,121, 46,225, 67,175,205,170, 44, 64, 85,165,100,168,162,253,223,222,207, 10, 62, 93, 80,
-167,112, 88, 88, 69, 6,123,232,122,206,107,132, 22,131,193, 64, 82, 82, 18,246,238,221,251, 94, 30, 45, 77,250,135, 42,184, 43,
-219,118,250,230,205,155, 42,130, 32, 58, 60,126,252,120,225,232,209,163, 39,138, 68, 34,103, 19, 19,147,116,133, 66,241,139, 88,
- 44, 94,139, 82,127, 84,182, 62,247, 16,145, 72,148, 92, 89,212, 97,197, 54,128,101,181,156, 21,210, 59,148, 75,225, 80, 97,153,
-114,169, 31, 42, 73,239,240,183, 31,119, 3,231,191,146,243,115, 23, 91, 85, 39, 44,125, 15,173, 38,179, 88, 98,133,119,120, 2,
-241, 33, 34,235,125,107,137,164, 36, 97,249,177,119, 45,101, 82, 9, 68,194,204,151, 72, 58,145,245, 65,155,165,238,231,237, 4,
- 2, 73,137,111,240, 48,108, 87,105, 63,223,134,214,186,159, 4,176,248,167, 75,161,108,194,194, 26, 79,231,140, 67,122,129, 8,
-151,222,230,159,164, 75,164,211,143, 0,249,184, 3,144, 74,105,248,193, 31, 50,118,251, 14,178, 24,106, 91,135,133, 45,243,127,
- 1,111,145, 13,187, 93,247, 46,250,212, 64,204,224,241,120,225,219,183,111,239,225,235,235,203, 29, 50,100, 72,101, 14,242,250,
- 34,245,209,171, 55, 63, 93,216,179,121,190,141,119,123,236, 92,182, 64,117, 44,226,121,197, 40,196,106,225,225,225,161,186,119,
-239,222,188, 41, 83,166,108,233,209,163,135,211,128, 1, 3, 56,117,235,214, 5,151,203,197,155, 55,111, 16, 30, 30, 46,123,251,
-246,109,122, 73, 73,201,188,230,205,155,235,147,227, 44,127,249,242,229, 27,213,235, 32,212,195,133,109,160,142, 46,212, 52, 82,
- 39, 45,109, 3,192, 56, 48, 48,112, 52, 0, 84, 17,246,189, 28,192, 30, 0, 76,154,166, 51, 66, 66, 66, 58,156, 61,123,182,195,
-220,185,115,217,125,251,246,197,253,251,247,113,245,234, 85,185, 92, 46,143, 80, 11, 87, 93, 75,229, 80, 0,162,148, 74,229,243,
-160,160,160, 14, 12, 6, 99,185,102, 70, 76, 76, 12, 14, 29, 58, 84, 27, 78, 37,128, 77,153,153,153, 63,133,132,132, 44,191,118,
-237,218,248, 49, 99,198,152, 43, 20, 10,196,198,198,226,231,159,127,174, 21,167, 80, 40,156, 99,107,107,187,244,226,197,139,191,
- 92,185,114,229,235, 81,163, 70,145,179,102,205, 66,112,112, 48,126,251,237, 55, 74,165, 82,157,101,177, 88, 99,114,114,114, 68,
-159,226,174,163, 30,134, 75,215,179,214, 97,141,188, 31, 50, 52,168, 35, 4, 31, 74,160,217, 14, 63, 63,191, 50, 43,163,198, 10,
-167,221,134, 32, 8,189,135, 14, 1, 88,210, 52, 77, 1,216,133,210,250,162,218, 89,225, 25,248, 43,115,188,174,140,205, 4, 82,
-203, 24, 72, 17, 91,125, 81,105, 75,128, 70,179, 26,216, 10,150, 47, 95,190,117,197,138, 21, 91, 43,166,112,208,110, 84, 49,245,
-195,202,149, 43, 97, 72,239, 96,192,127, 21,149, 11,173,168,125, 10, 69,131,193, 75,182,175, 91,176, 66,169,144, 9,105,200,253,
-241,230,116,244,135,174,140,166,232, 69,215,143, 6, 6,131, 70, 62,173, 82, 46,252,224,222,255, 77,253, 36, 44,172, 81,180,106,
- 26,126,123,145, 78,103,136, 20,223, 28,145,203,203, 89,131, 74,125,178,168, 97, 55, 36,249, 39,172,156, 88,103,230,124, 97, 67,
- 92,200, 27,173,247,122,178,178,178,206,109,221,186,149,220,188,121,115,215,146,146,146,138, 14,242,181,197,130,254, 51, 23, 49,
-218, 53,114,157,249,240,117,242, 64,232, 48, 92, 88, 17, 29, 59,118, 20,196,197,197, 5, 92,185,114,101,196,237,219,183,123,136,
- 68, 34, 87,130, 32, 96,108,108,156, 44,149, 74,175,113,185,220, 99,122,138, 44, 0,192,138, 21, 43,232,149, 43, 87, 18,113,113,
-113, 52,131,193,248, 19, 64, 34,131,193, 72,210,118,130,215,158,174, 89, 38, 48, 48, 80,151, 7,226,237,226,226,226,200, 85,171,
- 86,117, 89,181,106, 85, 11,181, 85,232, 54,254,242,249,210, 23, 10, 0,183,217,108, 78, 58, 65, 16,206,108, 14, 87,116,239,222,
-189,107, 31,200, 89, 34,151,203, 23,166,164,164,108,217,178,101,203, 90, 19, 19,147,182, 49, 49, 49,127,126, 8,167, 90, 68, 13,
-182,182,182,118, 58,124,248,240,169,131, 7, 15,182,103, 50,153,247, 9,130, 24, 34, 20, 10, 63,105, 81,105,117,129,232,149,122,
-212, 58,212,137,247, 99, 39, 41,253, 59,132,155, 74,165, 42, 94,186,116,105, 86, 69,225, 85,209,122,165,249,175, 78,229,162,203,
- 62,213, 39,138,178, 6,225, 66, 20, 3, 64,105,237,194,210,178, 58,186, 22,149, 6, 32,174,233, 58, 39, 73,242, 44,128,151, 36,
- 73,190,174, 24,232,162, 61,111,229,202,149, 53, 93,231, 6, 24,240, 89, 67,135, 59, 91, 32, 9, 4,214,214,147,246, 31, 52, 87,
-126,156,126, 6,176,217, 43, 73, 96, 62, 0,130, 6,182, 28,145,203,127,168,110, 65,199,142, 88, 75, 19,152,171,222,153,235, 50,
-238, 98, 77, 45,182,189, 14,116,168, 63,168, 39,103, 19, 84, 95, 80,246, 61, 78,127,127,127, 70, 21, 15,243,114, 69,165,171, 66,
-104,104, 89, 22,255,170,250,169,125,190,153, 61,120,240,192,201,199,199, 71,128,242, 78,255,149, 77,167,245,220,118, 6, 0,213,
- 71,222,159,159, 5,167,155,155, 27,231,205,155, 55,178,127,215,181,105,224,252, 87,114, 90, 54,117, 1,129, 73,208,206, 29, 84,
-173, 69, 75, 75,160,209,244,207, 40,136, 77,169,162,159,154,235,220, 50, 33, 33,193,181, 97,195,134,201, 0, 10, 42,244,163,178,
-121,180,225, 24,253,223,115, 86,134,201, 40, 95,138,206,128, 74, 14,132,129,211,192,105,224, 52,112, 26, 56, 13,156, 6, 78, 3,
-103,109,133,214,103, 13, 18, 6, 24, 96,128, 1, 6, 24, 96,128, 1, 6,252, 45, 32,170, 81,165,250,152, 4,107,163,108,175, 25,
- 56, 13,156, 6, 78, 3,167,129,211,192,105,224,252,191,227,172,137, 91,123,249,207,117,232,240, 31,235,183,193,172,106,224, 52,
-112, 26, 56, 13,156, 6, 78, 3,167,129,243, 67, 4,203,103, 13, 38, 12, 48,192, 0, 3, 12, 48,192,128,207, 6, 61,220,193,103,
-170, 64,254,241, 70,167, 32,170, 26,209,199, 13,117, 0,224, 99,241,253,159,130, 15,224, 43,173,255, 23,160,142,140, 55, 8,173,
-207, 23,141, 0, 44, 1,160, 93,139,236, 33,128,245, 21,218, 29, 5,160, 93,144, 80,132,210, 58,129,175,245, 89, 25, 73,146,235,
-187,116,233, 50,253,206,157, 59,155,149, 74,229,170, 90,244,215,149,207,231,111, 36, 8,162, 53, 0, 22, 65, 16,111, 50, 51, 51,
-215, 43,149,202, 15,137, 90,105,224,232,232,184, 1, 64, 75,146, 36, 89, 4, 65, 36,100,102,102,174, 81, 42,149, 55, 63,128,211,
-204,193,193,161, 19, 77,211,142, 0, 24, 44, 22, 43, 55, 45, 45,237, 1,106,153, 91,201, 63, 48,150, 93, 40, 82,178, 0,192,220,
-132,169, 8, 13,108, 42,215,117,154,225, 20, 55,192,128,255,111,208,165,145,201,229,208,219, 13,107,105, 37,190, 87, 1, 68,175,
-250,216,113, 57, 17,223, 87,181, 60, 81, 73, 84,115, 69,206,222,110, 88,171,162, 75, 57,122,185, 97,211,229, 55,168, 54,210, 94,
- 23, 78, 13,246, 1,228,100, 29,170, 20, 16,186, 69, 95,255,219,241, 21,202, 15, 21,150, 13, 29, 86, 43,180,134,185,131,175, 98,
-130, 25, 26, 11, 77, 24,175, 25,128, 22,234,135,252,107,148,230, 42, 42,250,192,206,125, 46,156,255, 54, 44,167,105, 58,160,220,
-201, 90, 73, 30,162, 47,190,248, 98,192,149, 43, 87,140, 53,245,238, 40,138,130,145,145,145, 18,192, 88, 61,214,101, 63,108,216,
-176, 69, 7, 14, 28,192,208,161, 67,151,134,133,133,109, 5, 80,172,235,194, 86, 86, 86,254,150,150,150,193,251,247,239,183,107,
-223,190, 3,193,225,112,240,230, 77,130,243,148, 41, 83,188,226,226,226,206,102,101,101, 77,212,119,227,173,173,173, 71, 90, 90,
- 90,110,217,187,119,175,109,231,206,157, 65, 16, 4, 34, 35, 35,157,231,204,153,211,226,221,187,119,199, 51, 51, 51,103,232,203,
-105, 99, 99,227,110, 97, 97,209,109,231,206,157, 70,157, 58,117, 2,143,199, 67,116,116,180,233,212,169, 83, 29,211,210,210, 98,
- 51, 51, 51,111,233, 43,178,158, 69,158,255, 90, 41,151, 6, 1, 0,147,205, 93,208,126, 75,196,249,103, 55,206,247,175,105,154,
-127, 96,236,239, 6,177,101,128, 1, 6,104, 99,164, 19, 28,105, 26,243,175,252,188,140, 4,128, 94,227, 87,207, 26,233,132,205,
- 71,210,171,174, 97,171, 39,223,247, 99,234, 32,248,112, 26, 50, 63,164,159,251, 0,114, 14,147, 57,171,157,143,143,237,183,119,
-239, 38,200,129, 95,254, 79, 14, 81,165,195,156, 85, 10,173,193, 77,177, 74, 89,106, 49, 33,250, 52,196,241,171,137,140,240, 47,
-190,248,162,225,132, 9, 19,136, 86,173, 90, 33, 50, 50,210,253,248,241,227, 95, 93,184,112, 33, 65,165, 82, 69, 2,120, 1,221,
-179, 90,179, 0,120, 50, 24,140,214,255,114,206,127, 51, 76,212,226, 42, 19,127, 37, 58,125, 47,225,233,245,235,215,207, 49,153,
- 76,141, 69,171,157, 72, 36,114,168, 96, 5,211, 5,245, 20, 10, 5,226,227,227, 65,146, 36, 11, 64,125,188, 95, 82,163, 42, 56,
- 27, 27, 27,239,142,120, 24,105, 67, 48,141,144, 47, 1, 32,145,131, 99,234,128, 3,135, 66,172,231,205,158, 49,248,230,205,155,
-225, 69, 69, 69,191,234,209,159,250, 38, 38, 38, 91,159, 62,125,106, 99,108,108, 12,138,162, 80, 84, 84, 4, 71, 71, 71,236,223,
-191,223,114,222,188,121, 1,133,133,133, 55, 37, 18,201,111,250,136,115, 11, 11,139,110,207,159, 63, 55,210, 20,148,150,201,100,
-112,118,118,198,209,163, 71,185,179,102,205,106, 90, 80, 80,144, 42,147,201,222,234, 74, 88, 40, 82,178,148,114,105,208,225, 93,
-129, 46, 0, 48,102, 70, 96, 16,167,200,252,162, 46,211, 10, 69,202, 11, 0, 12, 66,203,128,127, 26,173,109,109,109, 67,115,114,
-114,110, 1,152,136,143, 99,105,112,231,241,120,205, 41,138,114, 36, 73, 18, 12, 6, 35, 67, 36, 18, 61, 5,240,170,182,132, 54,
-110,126,253,193, 53, 30, 7,154,106, 65, 2, 32, 72, 50, 90, 37, 47, 57,148,251,234,230,249, 15,226,228, 24,141, 7,232, 22, 36,
- 64, 17, 36,249,148, 82,150,236,207,137,191,121,233,223,114,112,238, 11,209,216,205, 81,247,194,152, 31,131,111,120, 3,240, 73,
- 10,228,209, 36,221,135, 21,103, 2,125,103,207,158,237, 56, 99,250,116, 98,220,216,177,141,110,221,185, 67,116,213,167, 90,193,
-231,137, 42, 29,223, 43, 21, 90,254, 77, 97, 69, 3, 11,143, 7, 47, 33,153, 12, 6, 49, 98,246,250,128,131,187, 54,145, 61,251,
- 15, 41, 27, 62,241,245,245,133,175,175, 47, 17, 20, 20,212,232,207, 63,255,108,116,244,232, 81,101, 68, 68,196, 83, 0, 39,170,
- 90, 89,111, 55,136, 41,128,199,102, 49, 69, 35,150,253,186,215,199,199, 7, 92, 46, 23, 31,194, 9, 0, 61, 27,146,111, 89,214,
- 13,158,142,152,185, 60,185,125,251,142,244,199,224,252,140,240, 16, 40, 43,106,109,229,226,226,210, 73,169, 84,242, 0,128,201,
-100, 74, 82, 82, 82,102,162,180, 54, 32, 0,156,165, 40,106,128, 30,220, 36,128, 21, 3, 6, 12, 88,250,237,183,223,162,110,221,
-186,152, 53,107, 22, 20, 10, 69,228,165, 75,151,150, 3,216,128, 26, 46, 30,123,123,251,229,187,119,239,182,102,114, 76,208,106,
- 97, 34, 4, 5, 74, 0,128, 41, 23, 56, 55,141,198,172, 89,179,204, 31, 63,126,188, 70, 31,161,101,111,111,191,106,255,254,253,
-214,198,198,198,160,105,186,172, 22, 99,113,113, 49,138,139,139, 49, 99,198, 12,243,216,216,216,141,250, 8, 45, 7, 7,135, 78,
- 59,119,238, 52,226,241,120, 40, 46, 46,102,203,229,114,162,168,168, 8, 37, 37, 37,180, 76, 38,147,207,156, 57,147,251,226,197,
- 11, 63,129, 64,240, 22, 6,252, 91,192, 0,240, 13,139,197, 26,212,176, 97,195, 54,175, 95,191,126,162, 84, 42, 79, 3, 56,253,
- 17, 94,166,186, 59, 57, 57,173, 77, 79, 79,223, 9, 32,228,255,101,135, 58, 56, 56,156,190,119,239,158,203,238,221,187,199,110,
-222,188,249, 34,128,223, 62,128,142,205,102,179, 7,119,237,218,213,101,204,152, 49, 28, 7, 7, 7, 72,165, 82, 36, 38, 38,154,
-159, 60,121,210, 53, 58, 58, 58, 85, 93, 17, 67,231, 23, 10, 27,247,142,166, 96,154, 31,239,208,177, 83,231,161,131,191, 49,115,
-176,177,128, 88,166,194,235,100, 65,221, 63, 46,158,235, 26,199, 54,186, 39,151, 11,135,231,190,186, 87,172, 47,103,183,110,221,
- 59,247,232,222,221,204,194,210, 2, 66,145, 28,111,146,210, 92,111, 92, 61,239,203,100, 26,221,166, 8,197,168,172,231, 87, 75,
- 62,229,177,153, 5, 48, 69, 60,155,230, 45, 58,182,122,220,107,194,154, 54, 52, 77,131,164,177,163,162, 53,107, 22,192,220, 81,
- 90,246, 75, 47, 62,208, 52, 77, 16,216,164,109,205,234,237,134,181, 52,141,239, 65,130,232, 93,195, 48,165, 6,189, 0,174,165,
-181,181,207,212,201,147,137,162,194, 66, 68, 71, 71,151, 84, 20, 89, 91,235,128,125,155, 68,189,179, 41,181, 23,219,255, 82,107,
- 86,165, 67,135, 58,231,209, 50, 54, 54,174,116,186,133,133, 5,186,117,235,134,245,235,215, 51, 1,180,174, 48,187,124,145, 85,
-128, 27,182,103, 49, 44, 76,184,100,221,186,117,205,204,205,205, 63,152, 19, 0, 64, 83,245, 59,214,165,191,124,244,235,146,177,
-215,142,110,241, 20, 21, 21,176, 42, 54, 49, 53, 53, 69,227,198,141,177,116,233, 82,221, 56, 63, 28,255, 40,167,163,163, 99, 19,
- 95, 95,223,214,215,111,221,178, 76, 79, 79,231,166,167,167,115,175, 92,191,110,217,161, 67,135,214,142,142,142, 77,202,118, 21,
- 77,235,211,207,213,187,118,237, 90,126,246,236, 89,210,215,215, 23, 86, 86, 86,232,214,173, 27, 46, 94,188,200,220,188,121,243,
- 58, 0, 75,107,234, 39, 73,146,157,125,125,125, 9,208, 52, 50,132, 74, 60, 88,223, 4,209,155, 60, 80, 36,161,145, 39, 44,132,
- 88, 44,129,177,177, 49, 15,165,195,189,186,110,123,199, 14, 29, 58, 16, 0,202,196, 85, 81, 81,233,167,184, 88, 4,153, 76, 14,
- 46,151,107, 6,128,167, 43, 39, 77,211,142,157, 58,117, 2, 0,200,229,242,178, 55,188,130,130, 2, 66, 40, 20, 66, 38,147,129,
-197, 98,177, 81,179, 95, 99, 25,167,185, 9, 83,193,100,115, 23,140,153, 17,152, 50,102, 70, 96, 10,147,205, 93, 32, 51, 43, 84,
-233, 50,205,220,132,169,248,196,231,167, 29, 73,146, 63,187,185,185,197,146, 36,121, 24,128,227, 7,114,182, 5,176,206,200,200,
-232,154,135,135, 71,138,177,177,241,117,181, 80,239, 80, 75, 78,142,177,177,241,245,117,235,214,157,122,242,228,201,208, 63,255,
-252,179,254,179,103,207, 6, 7, 5, 5, 29, 55, 53, 53, 13, 71,121,191, 68,189,175,205,250,245,235, 31,124,240,224, 65,219,142,
- 29, 59, 30, 0,192,253, 72,215, 59, 3, 64, 75,232, 84,145,227,147, 28,119,167, 86,173, 90,185,240,120, 60,244,232,209, 3, 0,
-252, 62,132,147,205,102, 15, 94,186,116,169,219,178,101,203, 56, 2,129, 0,215,175, 95,199,195,135, 15,161, 84, 42, 49,109,218,
- 52,238,152, 49, 99, 26,152,153,153, 13,214,171,159, 76,243,227,179,231,204,237, 51,127,214, 36,179,167,239,228, 56,116,237, 29,
-126,143, 16, 32,171,132,131,254,131,199, 88,244, 30, 56,172, 55,135,107,113, 92, 95,206, 69, 11, 23,246,153, 60, 62,192, 44, 70,
- 64,225,220,253, 12,220,143, 23, 66,201,178, 68,223,193, 19,173, 90,116,234,243, 21, 19,172, 95, 62,245, 49,218, 15,180,159, 61,
-123,182,221,130, 77, 71,238, 58,181,253,102, 71,118, 62,124,181,133,143, 59, 96,105,109, 98,242, 77,124,215,174,147,140, 74,235,
-197, 86,203, 89,142,175,245,192,224,172,124,116,209,246,207,234, 98,141, 70,234, 97, 69,198,149,159,151,145, 52,129, 89, 35,157,
-202,221, 7, 42,237,231, 77, 96,232,236,185,115, 89, 22, 86, 86,216,181,107, 23,164, 34, 81, 57,159,217,238, 46,232,115,205,152,
-153,218,192,195, 57,182,155, 43, 17,254, 31,124, 95,153, 92,165, 69, 43, 44, 44,140,238,215,175, 31, 1, 0,161,177,200, 31,220,
- 20, 27,135,125,187,110, 41, 65, 18,116, 61,207,142, 49,117,220,154,137,108,108,108, 80, 82, 82, 2,169, 84, 10, 54,155, 13,137,
- 68,130,119,239,222,225,254,253,251,176,178,178,210,171, 39,133,133,133, 48, 53, 53,133,169,169,233, 71,225, 92, 60,182, 7,247,
- 77, 74, 54,247,242,253,155, 93,183, 79,255,173,189, 91, 75,191,103,221,135,205,122,110,110,231, 36,121,246,236, 25,238,221,187,
-135,252,252,124,248,248,248,252, 87, 14,230, 67,181, 79,214, 67, 0, 86, 13, 27, 54,116,190,124,237,182, 85,177,132, 50, 79,202,
- 84,176, 40,138,130,177, 49, 95,121, 34,244,156,112,232,224,254, 68, 70, 70, 70, 22,128,135,106,113, 91, 83, 77, 69, 30,128, 38,
-254,254,254,139,166, 79,159,142,132,132, 4, 76,154, 52, 73,252,240,225,195,220,142, 29, 59,218,236,223,191,223,104,222,188,121,
-184,117,235,214,138,176,176,176, 51, 0, 18, 1, 84, 90,171,141,166,105, 54,155,205,134, 82, 45, 27,228, 42,170, 76,223, 23, 22,
- 22,130, 22,231,131,205,102, 51, 0,216, 65, 71, 63, 58,138,162,216, 44, 22,171, 76,100,189,203, 44,196,187,172, 18, 20, 22,203,
- 32, 22, 43, 33, 19,211, 96, 24,219, 48,129, 36, 7, 0, 73, 80,170, 87, 0, 0, 0, 32, 0, 73, 68, 65, 84,186, 90, 71,120, 60,
- 30,148, 74, 37,138,138, 74,187,161,177,148,201,100, 50, 8,133, 66, 48, 24, 12, 83, 0,230, 0,242,116, 33, 84, 59,185,255,174,
- 30, 6,196,163, 35, 3,108, 95, 95, 88, 92,110,154,185, 9, 83, 17, 58,175, 41,195,198,185,197,157,150, 67,127,241, 40,155,246,
-105,253,179,184,118,118,118, 55, 78,157, 58,213,180, 81,163, 70, 72, 76, 76,244, 24, 50,100,136,143, 64, 32,104, 9,253,107, 50,
- 26,147, 36,185,113,204,152, 49,211, 71,140, 24, 65,184,187,187,131,201,100, 66,169, 84, 58, 39, 36, 36,116, 59,121,242,228,194,
-131, 7, 15,238, 87,169, 84,223, 65,119,191, 63,146,195,225,156,216,187,119,111, 23, 31, 31, 31, 28, 62,124, 24, 15, 31, 62,164,
-218,182,109, 75,142, 30, 61, 26,174,174,174, 62,163, 71,143,254, 93, 42,149,246,173,165,101,203,181, 67,135, 14, 46, 12, 6, 3,
- 29, 59,118,100,223,187,119,175, 21,128,123, 31,184, 79, 77,157,157,157,111,249,249,249,181,188,118,237, 90, 84, 70, 70,134,159,
- 30,219, 11, 0, 3,157,156,156,130, 44, 44, 44,172,244,184,199,150,164,165,165,125, 15, 32, 84,199, 69,218,183,110,221, 26,201,
-201,201,104,210,164, 9,216,108,118, 7,185, 92, 62, 5, 64, 31, 0, 63, 0,136,213,163,191,238,221,187,119,119,241,243,243, 35,
- 66, 67, 67,203,252, 67, 73,146,132, 82,169, 4,155,205, 70,251,246,237,201,200,200,200, 58,143, 30, 61,114,135, 14,195,136, 54,
-110,126,253, 59,118,238,218,185,139, 79,115,114,115,232,107,168, 40, 21, 24,132, 18, 76,130, 2,165,224,130,203,102,192,221,179,
- 13, 35,254,197, 83, 31,153, 84,222, 63,247,213,181,243,186,112,246,233,213,211,183,105, 19,119,114,251,239,111, 80,144, 22,171,
- 74,139,187,157, 67, 50, 72, 52,109,253,133,173,123,179,150,140,150, 62,126,172,244,196, 23,221, 36,146, 46, 61,242, 19,110, 95,
-251, 20, 23,228, 74,128,225, 92,199,246,155,126, 61,253,216,130,244,116,209,201,208,243,207, 75, 20,184, 15, 0,183, 0,162, 47,
-208,220,187, 93,187,174,251, 55,108,176,225,243,249,172, 81, 35, 70, 40,247, 69, 69, 69,161,138,161,223,149, 0,195,214,209,177,
-199,212,169, 83, 25,130,244,116,250,228,233, 11,207, 52,124, 40,125, 75,241,110,238,236,209, 15,162,120,189,134, 41,251, 3, 28,
- 7, 71,199,166, 83,166, 76, 65, 70,122, 58, 14,135,132, 20, 75,128, 8,141, 21,235, 28, 3, 59,155,185, 57,142, 91, 48,113, 0,
-225,194,183,197,212, 21,251, 58,116,147,103,185, 65,240,215,241,215,214, 34,159,177,200,154, 92,169,208,170,136,223, 98,177,220,
-140,141,250, 39, 79, 30, 35,179,139,228,162,132,132, 4,216,218,218,130,207,231,195,194,194, 2, 49, 49, 49,184,126,253, 58, 94,
-190,124, 9,138,162,208,162, 69, 11,189,122,147,147,147,131,167, 79,159,194,202,202,234,163,113,186,185,216,225, 91, 23, 59,118,
-102,110, 33,251,218,195,151, 62,251, 22, 15,110, 70,122, 12, 62,168, 93, 36, 86, 38,147,225, 63,130,178,232, 66, 23, 23,151, 78,
-135, 14, 29, 98, 75,149, 48,115,159, 18,241,163, 72,162, 50, 1, 0, 19, 30, 67, 20, 25,212,248,187,213,171, 87,139,198,143, 31,
-239,145,146,146,178, 94, 7, 91,255,218,238,221,187,207,167,105,154, 53,123,246,108, 0,192,152, 49, 99, 10,239,223,191,239, 14,
- 32,235,250,245,235, 78, 19, 38, 76,120,117,227,198, 13,227,185,115,231, 50,148, 74,101, 12,147,201,164,195,194,194, 86, 1, 8,
-124,239,137, 72,146,143,163,162,162,234, 57,185, 54,134,171, 13, 9,223,165, 47, 75,111,112,198, 20, 82,147,222, 32,238,217, 67,
- 56, 58, 58, 90,240,249,252,216,212,212, 84,121, 90, 90,218, 66,145, 72,180,187,134, 62, 70, 71, 70, 70,242, 93, 93, 93, 81, 92,
- 92,140,212,236, 18,204, 58,109,140, 66,113,169, 17,131, 5, 49, 90,186, 52, 54, 51, 34,101, 15,179,178,178,228, 50,153,108,153,
- 80, 40, 60, 84, 29, 39,139,197,202,125,246,236,153,105,221,186,117, 33,145, 72,232,188,188, 60, 66, 36, 18,161,168,168,136,184,
-112,225,194,215, 2,129,160,109,253,250,245, 9,103,103,231, 85, 2,129, 64,156,150,150, 54, 73,151,161, 73,181, 96, 82, 49,153,
-204,205,147, 39, 79, 30,122,230,204,153,199,161,129, 77, 7,106, 13,151, 88,120,122,122, 94,110,222,188,153, 83,200, 38,239, 29,
- 0,126,252, 23,156, 91,227,150, 44, 89,210,212,218,218, 26, 83,167, 78,197,202,149, 43,177,124,249,242, 70, 83,167, 78,157, 12,
- 96,171, 30, 60, 70,142,142,142,143,182,111,223,238,209,169, 83, 39, 92,188,120, 17,199,142, 29,195,219,183,111,149,245,235,215,
-103,250,248,248, 96,197,138, 21,232,221,187,247,164,153, 51,103,118, 77, 79, 79,111,165,163,248, 24,191, 98,197,138,129,157, 59,
-119,198,216,177, 99,165, 55,111,222, 28, 10,224,202,213,171, 87,191,184,117,235, 86,232,145, 35, 71,140,214,173, 91,215, 99,222,
-188,121, 83, 1, 4,215, 98,251,191,238,210,165,180,134,114,231,206,157, 17, 20, 20,212,251, 3,133, 22,199,198,198,230,194,225,
-195,135, 91, 54,110,220, 24,163, 70,141,106, 53,116,232,208, 11,249,249,249, 61, 1,232,116, 67,170, 83,167,206,198,179,103,207,
- 54,172,106,100,161, 50, 72,165, 82,235,111,190,249,102, 67, 82, 82,146, 94, 66,235,232,209,163,248,254,251,239,209,162, 69,139,
-230,237,219,183,223, 51,101,202, 20,248,251,251,119,143,137,137,113, 64,105,212,114,141,224,241,120,205,135, 15, 31,206,121,240,
-224, 1, 0,192,211,211, 19, 45, 91,182, 68,114,114, 50, 30, 63,126, 12,169, 84, 10, 7, 7, 7, 12, 26, 52,136,151,148,148,212,
- 60, 39, 39,167, 70,161, 69,114,141,199, 13,236,215,215,236,220,125, 1, 84,148, 18,109, 26,154,195,199,195, 30,241,169,133,136,
-140, 77,133, 74,198,134,185,181, 13, 58,116,237,101,157,145,246,118, 92, 46, 80,179,191, 22,215,120,220,160,129, 95,153,158,139,
- 72, 71, 65,122, 28,253,250,225,153,235, 10,137,104, 18, 0, 60,254,243,248, 30, 71, 27,163,158,238,173,219, 48,252,122, 14,176,
- 58,125, 44, 99, 92,254, 63, 83,219,239, 61,220,114,193, 94, 87, 86,206,152, 5, 1,190, 52,203,202,249,161,153, 66,177, 83, 51,
-175, 55,208,107,225,146, 37,237, 39, 78,158,204,163, 40, 10, 71,126,253,181,240,105, 84, 84,252,100,128,154, 82, 5,223, 78,192,
-117,232,192,129, 92, 51,115,115,204,153, 53, 11,102, 10,197,141,178, 93, 2,116,159, 51,127,126,167, 25, 51,102, 24,237, 89, 53,
-253,113,239, 9,107, 90, 83, 52, 77,104,134, 41,143, 86,111,138,107, 59, 97,224, 64,152,153,155, 99,246,236,217, 32,228,242,203,
-101, 2,138,137, 27,227,191,246,245, 9,232,223, 25, 4, 8, 28, 11,187,131,215,201,217,207,110, 8,240,230,115, 85, 85, 21, 80,
-165,143, 86,181, 67,135, 69,114,100,118,255,106,176,192,221,221,189,168, 81,163, 70, 69,185,185,185,120,254,252, 57,242,243,243,
- 17, 28, 28,140,184,184, 56, 80, 20, 85,107, 1, 67, 81, 20, 62, 54, 39, 0, 56,216,152, 99, 84,223,118, 76,169, 68,196,203,206,
-206, 46, 55,124,244, 31, 18, 90,101, 80, 42,149,188,250,245,235,131, 4, 8, 97,137,194, 52,227,104, 23, 34,227,104, 23, 66, 88,
-162, 48,149,201,100,164,169,169, 41,164, 82, 41, 79, 7, 42,214,151, 95,126, 57,255,204,153, 51,172,181,107,215,194,203,203, 11,
-114,185, 28,247,239,223, 79, 5,144,165,110,147,126,251,246,237,116,141, 16, 94,191,126, 61, 78,159, 62, 77,244,232,209, 99, 97,
-101,231,147, 64, 32,216, 56,101,202,148,188,146,162, 60,236, 29, 38, 70,232,168,108,252, 60,240, 45, 70,216,156, 66, 94,230, 59,
-236,219,183, 15, 87,175, 94, 35,174, 92,185,202,190,121,243,166,201, 87, 95,125,181,163, 78,157, 58, 97,213,117, 50, 61, 61,125,
-237,140, 25, 51, 10,138,138,138, 80, 84, 84, 4,177, 88,130, 60, 17,240,108, 75, 83, 60,219,210, 20, 18,202, 8,187,118,238, 38,
-159, 61,123,102,251,246,237, 91,167,254,253,251,111,225,243,249, 7,171,227, 76, 75, 75,123,240,237,183,223, 74, 10, 11, 11, 33,
-147,201,228, 42,149, 74, 38, 22,139, 21,199,143, 31,159,107, 99, 99,211,225,226,197,139,172,171, 87,175, 49,111,222,188,197,190,
-126,253,186, 69,183,110,221, 78, 56, 56, 56,252,162,139,165,140,193, 96,108, 11, 9, 9, 25,183,107,215, 46, 7, 31, 31,159,102,
- 21,134,162,248, 61,123,246,172,247,235,175,191,214, 9, 10, 10, 90,136,210, 0,148, 79, 10, 91, 91,219,153, 3, 7, 14,196,174,
- 93,187,112,254,252,249,121, 59,118,236,192,151, 95,126, 9, 39, 39,167,111,161,251,176, 23, 0,252,184,117,235, 86, 15, 15, 15,
- 15,140, 25, 51, 70, 54,105,210,164,239, 14, 29, 58, 84, 63, 60, 60,156,253,203, 47,191,212,155, 58,117,234,236,128,128, 0, 73,
-131, 6, 13, 16, 28, 28,220,144, 36,201,109, 58, 93,223, 14, 14,115, 71,140, 24,129, 77,155, 54,225,230,205,155,131, 81,250, 64,
-149, 1,184,116,247,238,221,254,235,214,173,195,224,193,131,225,236,236, 60,187, 54,150,167,166, 77,155, 46,235,211,167, 15,194,
-195,195,209,170, 85, 43,116,232,208, 97, 30, 0,219, 90,238, 78,210,212,212,244,196,161, 67,135,124,235,213,171,135, 53,107,214,
-192,205,205, 13, 7, 15, 30,244, 53, 49, 49, 57, 1, 29,221, 55, 44, 44, 44, 76,141,141,141,177,112,225, 66,122,240,224,193,121,
- 53,125,230,205,155, 71,115,185, 92, 88, 89, 89,233, 26,248, 98,196,227,241, 58,122,121,121,225,254,253,251,184,122,245, 42,150,
- 46, 93,138,185,115,231, 34, 59, 59, 27,195,135, 15, 55, 6,224,175,199,118,219,219,217,217,161,176,176,180, 46,188,151,151, 23,
-158, 60,121,130,236,236,108, 56, 59, 59, 35, 35, 35, 3, 54, 54, 54,104,220,184, 49, 40,138,178,215,141,146,246,178,181,182, 64,
- 86,190, 20, 76, 40,209,218,221, 22, 55,158,231,226, 93,182, 12,246, 54,150,200,200,202, 70, 29, 27, 30, 92, 92,234,130,166, 41,
- 47,157, 20, 48,131,108,205,229, 25, 33,175, 72,142,180,216,155,185,114,149,116, 74, 65,226,221,148,130,196,187, 41,114,169,100,
-202,227, 59, 87,115,235, 57, 24,193,197,197, 5, 4, 77,181,251, 20,215,227,144,186,112, 49, 49, 98,142,185,250,243, 50, 34,108,
-255, 98, 66,154,251,174,109, 31,135, 82,203,178, 29, 80,127,200,240,225, 29,191,251,238, 59, 94,102,102, 38, 21, 48,108, 88,222,
-218,192,192,107,127,212,240, 98, 80, 12, 52,234,217,179, 39, 72, 0,127, 92,185, 34,202, 0, 82, 1,192, 1,112, 25,240,205, 55,
- 93,150, 44, 90,100,148,147,155, 75,221, 79, 40, 62, 23,151, 69, 15,178, 86,161,190, 46,254, 89, 42,192, 91,195,123,249,242,101,
- 90, 12, 60, 6, 0, 63, 23,124,219,171,147,167,207,232,129, 93, 32,200,202,199,236,181, 63, 99,207,201, 91,151, 45, 20,244, 23,
-255,161, 71,241,228, 90, 9, 45,245,208,207,123,211, 74, 74,222, 31, 61,248, 80, 1,243,119,112, 86,134,255,162,208,210, 64,161,
- 40, 29, 37,145, 41, 40,200, 20,148,230,173, 22, 98,177, 88,103,138,203,151, 47, 31,158, 53,107, 22,182,108,217,130, 87,175, 94,
-129,205,102,195,203,203,139, 15,192, 84,115,207,111,221,186,181, 61, 73,146,136,143,143,199,230,205,155, 49,126,252,120,250,222,
-189,123, 7, 81,121,190,148, 39,121,121,121, 59,167, 76, 26, 95,144,159,249, 14, 10,113, 62,178,210,222, 64, 42, 42,192,154,245,
- 27, 81,162, 96, 34, 67, 40, 71,134, 80, 14,146,107,141, 61,251, 15, 49,154, 54,109,218,135,193, 96,244,171,166,159,247, 51, 51,
- 51,247, 79,155, 54,173, 32, 35, 35,163,108,251,100, 10, 26, 50, 69,249,243,213,216,216, 24,219,182,109,179,112,119,119, 31,200,
-100, 50,187, 85,195, 41, 72, 73, 73,137,155, 54,109,154, 44, 51, 51, 19, 66,161, 16,231,206,157,235, 95,175, 94, 61,171, 13, 63,
-110, 33, 68,114, 38, 50, 10,228,200, 40,144,131, 99,106,143, 19,161,103, 24,141, 27, 55, 14, 96, 50,153, 29,106, 18, 89, 71,142,
- 28, 25, 61,108,216, 48,179, 31,127,252, 49,239,236,217,179,187, 0,104, 31,144,248,109,219,182,157, 60,113,226, 68,209,252,249,
-243,173,131,130,130,230,125, 98,177,213,109,216,176, 97, 77, 40,138,194,169, 83,167,158, 1,216,122,230,204,153, 71, 82,169, 20,
-195,135, 15,175,175, 30, 70,210, 5,109, 3, 2, 2,166,251,250,250, 98,206,156, 57,242,107,215,174,181, 6,176, 5,165, 67,185,
- 52,128,100, 0, 59,110,221,186,213, 98,230,204,153,210,118,237,218, 97,236,216,177,227, 1,248,214,192,219,113,196,136, 17, 30,
- 20, 69,225,248,241,227, 79, 1, 92,172, 48,255,122,104,104,232,125,153, 76,134,145, 35, 71, 54, 0,160,207,141,156,205,229,114,
- 79,173, 94,189,218, 50, 45, 45, 13,163, 71,143,150,198,199,199, 35, 48, 48,208,200,194,194,226,162,214, 53,160, 51,184, 92,238,
-190,159,126,250,105,160,183,183, 55,166, 77,155, 38,219,189,123,247,172,233,211,167,203, 90,183,110,141, 93,187,118, 13,228,112,
- 56,122,149,232, 72, 79, 79, 47,136,141,141,181,169,233,147,154,154,170,107,120,190,177,169,169,105,132,167,167,103,161,151,151,
- 87, 27,165, 82,137,152,152,152, 55,135, 15, 31,166,188,188,188,176,115,231, 78, 4, 5, 5,161, 95,191,126, 96, 48, 24, 58, 11,
- 45, 6,131, 1,185, 92, 14, 99, 99, 99, 48,153, 76,188,121,243, 70,147, 90, 6,108, 54, 27, 0, 96, 98, 98, 2, 35, 35, 35,144,
- 36,169, 83, 52, 26, 65,128, 46, 44, 81,128,197, 34,193, 36, 41,196, 37, 11, 33, 87, 80,224,177, 25, 96, 49, 9,128,166, 96,105,
-194, 2,143,195, 0, 73, 16,148,142,156, 16,138,228,224,176, 73,176,216, 28,130, 84,170,140,202, 30,142, 76,149,145,145, 17,135,
-176, 53,231,130,199,254, 23,149, 5, 38, 74, 29,203,199, 1, 44,147,186,117,135,110,218,188,153, 83, 88, 92,140,193,131, 7,231,
- 37, 61,122, 20, 34, 6, 30,117,173, 33, 72,137,100, 50,221,253,186,118, 69,100, 84, 20,138,242,243, 95, 3,165,206,241, 28, 39,
-167, 97,219,182,109,227,136, 37, 18, 12, 30, 52,168,224,213,157, 59, 71, 82,138, 17,118, 60,185, 84,136,213,120,220,217,108, 71,
- 13,175, 48, 63, 63, 31, 40, 77, 33,225, 96,103,186, 97, 70, 64,111, 20,149, 72,176, 96, 99, 8, 21, 21, 39,248, 54, 60, 21, 95,
-157, 73,135,240, 63,246, 24,158, 92,225, 3, 64,135,132,165, 26,235, 82, 77, 98, 69, 42,149,126,116, 1,244,161,156,149,137,196,
- 15,229,252, 55,130,201,100, 74, 94,190,124,201, 49,183,113,162,108,204, 88,249,245,198,223,177, 0, 0,107, 83,166, 80,174, 82,
- 80,233,233,233,224,114,185, 18, 29,135, 27, 38,237,219,183,111, 13,128,102, 76, 38, 51,236,208,161, 67, 68, 72, 72,136,213,136,
- 17, 35, 18, 98, 99, 99,211, 60, 61, 61, 93, 15, 29, 58,100, 14, 0, 59,118,236,160, 79,156, 56,209, 27,165, 41, 51,170,204,227,
-146,153,153, 25,152,155,155,123,111,198,140, 25,193, 28, 14,199,202,196,196,196, 38, 60, 60,156,144,200,105,180, 93,146, 92, 22,
-137,104,110, 68,226,246, 98,115, 76,158, 60,153, 17, 27, 27,187, 62, 45, 45, 45,172, 26,206,133, 5, 5, 5,225,175, 94,189,218,
- 98,225,220,210,206,196,117,137,133,207,226,120, 0,128,171, 45, 11,164,250,190, 88, 80, 80,128,236,236,108, 76,159, 62,221, 42,
- 33, 33, 97, 97, 90, 90,218,141,106,172, 90,183,114,114,114, 82, 95,188,120,225,199, 98,177, 56, 38, 38, 38,109, 35, 34, 34, 8,
-137,140, 66,243,133,201,200, 43, 46,237,167,181, 41, 19,143, 87, 59,224,219,111,191,101,190,126,253,122,163, 64, 32,232, 92,233,
-205,140, 36,131,180, 69,214,130, 5, 11,162, 1, 52, 0, 80,110,104, 84,165, 82, 17, 35, 71,142,124, 14,192,107,254,252,249,214,
- 52, 77,207, 91,184,112, 97, 30,128,189,255,244,185,100,110,110,190, 97,202,148, 41, 56,113,226, 4,242,243,243,183, 1, 64, 97,
- 97,225,214,163, 71,143, 30,159, 52,105, 18,126,253,245,215, 13,217,217,217,127,160,230, 80,237, 47,135, 15, 31,142, 75,151, 46,
-225,207, 63,255, 92, 6, 32,166,138,118,175,194,195,195, 23,158, 61,123,118,251,136, 17, 35,240,243,207, 63,247, 1, 80,157,131,
-108,207,222,189,123,227,226,197,139,200,205,205,221, 85, 89,131,130,130,130,221,231,206,157,107,223,187,119,111,172, 95,191,190,
- 39,128,235, 58,108,186,135,133,133,197,161,237,219,183,183,245,246,246, 70, 64, 64,128, 68, 46,151,247,153, 63,127,254,249, 99,
-199,142,153, 29, 62,124,184,205,228,201,147, 31,168,115,190,221,215,201,148, 69,146,235, 54,111,222, 60,193,207,207, 15,243,230,
-205, 83, 94,190,124,121, 0,128, 43,127,252,241, 71,194,130, 5, 11, 46,108,222,188,153,177,105,211,166, 9,179,103,207,206,166,
- 40,234, 83,137,235,213, 59,118,236,104,223,171, 87, 47,188,121,243, 6,247,239,223,135, 92, 46,255, 53, 34, 34,226,118,163, 70,
-141, 86,203,100,178,243, 38, 38, 38, 99,204,204,204, 60, 91,182,108,249,197,227,199,143,141,161,155,159, 94,102, 98, 98,162,165,
-133,133, 5,148, 74, 37,158, 61,123,134,186,117,235, 66, 46,151,227,237,219,183,240,246,246, 6,155,205, 70,102,102, 38,180,172,
-229, 53,136, 34,242, 89, 66, 82,122, 3,107, 51, 19, 64,197,195,147,248, 84,216,217, 90, 65, 69,144,200,200, 16,160,101, 19,103,
- 16, 4,129,130,220, 12, 16, 4,241, 92, 23, 78, 21, 77, 69,190, 75,207,170, 99, 99,198,133,119,251, 94, 54, 17,127,100,135,152,
- 55,232, 52,153,201, 32, 24, 28,174,233,222, 9, 99,199,218, 82, 20,141,130,220, 76, 48, 73,242,225,167, 56, 64,167,222, 33,165,
-171, 27,239, 73,175, 9,107, 90, 18, 52,104,177, 28,135,127,206, 68,190, 49,208,114,199, 15, 63, 88,218,216,218, 34, 32, 32,128,
-202, 77, 75,187, 86,162, 99, 98,229, 6,141, 26, 57,152,154,153,225,238,221,187, 96,148,250,216,226, 32,224, 17,180, 96,129,141,
-189,163, 35,198, 79,152, 64,101,190,123,119, 93, 12,164,235,211,215, 6,110,110, 44, 13, 47,169,230, 21, 48, 48,107,254, 0, 95,
-174,137, 17, 23,235,246,156, 65, 74,142,232,120,132, 0,123,254,163,246,142,125,213, 90,180,170,114, 62, 43,117,170, 54,174, 86,
-172,240,120,188, 50,107,138, 30,111,122, 31,157,179, 38,252, 29,156,159, 16,139, 1,156, 5,176, 56, 37, 37, 37,110,194,132, 9,
-114,165, 92, 90,116,111, 77,131, 69, 81,235,235, 77,139, 8,228, 79,251,125,150,197,162, 18, 97, 94,209,142, 29, 59, 20, 41, 41,
- 41,113,218,203,212,192,253, 14,192,197, 95,126,249,101,247,169, 83,167,224,229,229,133,152,152, 24,123,145, 72,212,234,249,243,
-231,214, 30, 30, 30, 8, 9, 9,193,137, 19, 39,182, 0,184, 90,157,200,210, 64,169, 84, 94,203,200,200,104,156,156,156,220,208,
-210,210, 82, 97,105,105,137,138,145,136,133, 98, 10,185, 5, 66, 88, 91,219,192,220,220,188,190, 14,226,252, 98, 70, 70,134, 59,
-101,213,164,139,123,206, 54, 97,228, 58, 23, 68,174,115,193,197,133, 78,224, 91,114,144,159,159,143,236,236,108,100,103,103,131,
- 32, 8, 40, 20,138,166, 58,112,190, 21, 8, 4, 7,222,189,123,119,214,193,193, 1,102,102,102,160, 1,100, 20, 40, 16,189,201,
- 3,209,155, 60,144, 81,160, 64, 97, 81, 17,234,213,171, 7, 51, 51,179,170,134, 40,200, 58,117,234,244, 29, 54,108,152, 25, 0,
-168, 5, 84,119,154,166,167, 85,242,153,170, 84, 42, 59,105,218,126,255,253,247,214, 0,122,255,195,231, 19, 3,192,140, 73,147,
- 38,181,225,241,120,216,185,115,231, 91, 0, 71, 52,247,250,221,187,119,199, 3,192,172, 89,179, 60, 1,204, 67, 21,153,160,203,
- 76, 67,108,118,235,166, 77,155, 34, 34, 34, 2, 0,206,212,176,238,208,123,247,238,161, 81,163, 70,224,241,120,109,107,104, 91,
-223,197,197, 5,241,241,241, 0,240,164,138, 54, 79,226,227,227, 75,135,123, 8,162,190, 14,219, 62,176, 87,175, 94,207,110,220,
-184,209,182, 99,199,142,152, 48, 97,130,236,193,131, 7,125, 1,220,126,242,228, 73,183,145, 35, 71,138,220,221,221,113,235,214,
- 45,143,145, 35, 71,222, 35, 73,114,141, 14,156,227, 87,173, 90,181,248,235,175,191,198,170, 85,171,232,147, 39, 79, 6, 0,184,
-162,158,119,249,248,241,227,163,215,174, 93, 75, 15, 26, 52, 8, 43, 87,174, 92, 12, 96, 90,117,100, 34,145, 72,168, 82,169, 32,
- 18,137,116, 50,201,235,218,222,214,214,246,203, 94,189,122, 97,233,210,165,168, 83,167, 14,206,159, 63, 79, 3, 8, 3, 16, 46,
-147,201,186, 0,216, 44, 18,137,126,143,136,136, 64,207,158, 61,217, 40, 95, 98,164,186,245, 63, 59,122,244,168,212,194,194, 2,
-174,174,174,104,208,160, 1, 50, 50, 50,144,148,148, 4,111,111,111,180,110,221, 26, 74,165, 18, 7, 14, 28,144, 20, 21, 21,233,
-148,147, 79, 41, 19, 29,190,122,225,180,208,198,140, 11,103,123, 11,212,171, 99,141,226,130, 28,100,103,164,163,117,211,186,232,
-218,186, 30,114,132, 50, 92, 14, 59,157, 95, 84, 84,114, 88, 39, 19,190,180,228,208,181, 63,206, 11,173,204,216,104,220,196, 19,
- 35, 39,204,106,217,178,149,207,213,118,237, 58, 93,254,113,195,186,230,221, 59, 52, 37, 82,115, 36,184, 20,118, 38, 95, 88, 88,
-120,232, 83,220,232, 87, 2, 12,137,133,251,237, 93,103, 35, 15, 52,235, 51,233, 64, 92, 42,182, 1,128,130,193,240,232,251,229,
-151, 72, 77, 77,197,233, 83,167, 4, 37,192, 83, 93,249,140,140,140, 72, 0, 16, 10,133,224,170,253,238,148, 64,147,175,190,250,
- 10,217, 57, 57, 56,122,228, 72,246, 37, 32, 74,159,126,246, 7, 56,198, 70,165, 6, 65,161, 80, 8, 2, 40, 4, 0,130,137,190,
-237,188, 26, 33, 59,175, 16, 55, 30,198, 21,215, 19, 99,122,117, 60,159,177, 35,124,237,124,180, 0,228,204,155, 55, 15, 92, 46,
- 23,124, 62,191, 76, 28,105,196, 10,135,195, 1,159,207,135, 82,169,196,241,227,199, 1, 32,167,218, 55, 60, 64, 58, 96,218,122,
- 74,170,160, 75, 88, 44,214, 71,225, 84,191, 57, 74, 7, 47,248,153,250,227, 94,229, 65, 49,181,225,252, 12,208, 78,157, 19,171,
- 29,128,252,164,164,164,212,161,131, 7, 8,147, 19, 94,100,136, 10,210, 5,133,185, 41,130,148,183,207, 51,150, 44,156, 39, 76,
- 77, 77, 77, 65,105, 46,173,118,233,233,233,154,101,116,193,188,161, 67,135,254, 52,105,210, 36, 58, 58, 58, 26, 0, 16, 25, 25,
-137,177, 99,199,210,163, 71,143,222, 6, 96, 81, 45,250, 45, 18,139,197,229,172, 33,114, 21, 85, 54,228, 87, 88, 88,136,244,244,
-116,200,100, 50,157, 21,241,171,203,155, 94,230, 37, 61, 86,120,186,154,192,211,213, 4, 30, 46,198, 32,148,197,101, 34, 43, 59,
- 59, 91,243,230, 44,209,163,159,133, 82,169,180, 92, 63,181,135, 38, 11, 11, 11,145,145,145, 1,149, 74, 85,213,131,140, 74, 75,
- 75,187,124,226,196,137, 34, 0,248,241,199, 31,243, 8,130,248,147, 32,136,159, 42,249,236, 97, 50,153,119, 53,109, 55,109,218,
-148,135,247,135,196,254, 78,124,237,237,237,157,191,120,241,226,157,179,103,207,198,158, 61,123, 32, 16, 8, 22,225,175, 92, 60,
- 84, 78, 78,206,130, 93,187,118, 97,220,184,113, 88,190,124,249,166, 86,173, 90, 21, 2, 24, 89, 21,161,157,157,157, 51,147,201,
- 68, 84, 84, 84, 33,128, 55, 53,172, 63, 35, 42, 42, 42,147, 32, 8,240,249,124,183,234, 26, 90, 91, 91, 55, 52, 51, 51, 67, 90,
- 90, 26,160,126, 99,174, 4, 73,233,233,233, 52,135,195,129,147,147, 83,163,154, 54,222,202,202,106,193,129, 3, 7,152, 47, 94,
-188, 64,247,238,221, 83,111,221,186,213, 19,128, 38, 36, 61, 42, 50, 50,210,183, 91,183,110, 47,175, 94,189,138,141, 27, 55, 18,
- 45, 90,180,152, 86, 19,167,171,171,235,212,241,227,199, 35, 56, 56, 24,123,247,238,157, 6,224, 84,133, 38,199,118,237,218, 53,
-107,239,222,189,152, 48, 97, 2,234,215,175, 63,178, 58,190,228,228,228,133,126,126,126,145,175, 94,189,210,169,226,129,142,237,
-187,249,248,248, 52, 20,139,197, 56,116,232,208,155,134, 13, 27, 62, 58,117,234,212, 60,188,255,192,254,253,244,233,211, 24, 53,
-106, 20, 90,180,104,113, 8,192, 8, 93, 46,203,216,216,216,148,235,215,175, 83,108, 54, 27,174,174,174,232,215,175, 31, 2, 2,
- 2,208,188,121,115,200,229,114,156, 62,125,154,122,254,252,121,170, 76, 38,211, 41,151, 82,238,171,155,231, 19, 19,255,199,222,
-121,135, 55, 85,253,127,252,125,179,119,210,180,105,210, 69, 75,129,210, 77,161, 64,217,163, 80,138, 64,153,162,136, 40, 34, 10,
-200, 16, 21, 21, 84,134, 32, 75,217, 32,171,130,130, 8, 10,136,128,148,165,226, 23,100,211, 2,165,133,178,186,103,210,189,146,
-102,159,223, 31,180,252, 74,237, 72, 90,220,247,245, 60,247, 73,114,110,238, 59,231,174,115,223,249,156,117,239,194,245, 43,231,
- 76, 44, 38, 3,158,174,142, 24, 29,209, 9,175,141,237,133,206,254,238, 72,215,232,112,230,204, 79,166,212,212,228, 75,182,244,
- 56,172,209, 76,186, 29,127, 49,241,250,121, 51,155, 69,193,223,175, 61,230,127,248,190,124,217,162,185, 14,237,219,122, 34, 62,
-165, 20, 63,157, 62, 97,202,201,202,252,245,175,234,113,120, 22,224,136,121,148,136,201, 96,192,194,224, 85, 50,171, 59,210, 4,
- 7, 6,250,170, 92, 92, 16, 19, 19, 3,134, 29, 61, 66,207, 2, 28,177,248, 81, 45,120, 69, 69, 5,106,244,218,249,249,249,121,
-122,121,225,120, 76, 12,152, 86,235,157,126,118, 14, 48,122,247, 81, 53,244, 99, 93, 10,168,154,222, 10,146,118,173,148,126,114,
-153, 8, 87,226, 31, 64,111, 34, 87,191, 41,198, 95, 58, 30,217, 31,200, 20, 52,179,234,112,213,182,109,219,194,118,236,216, 49,
-232,157,119,222, 17, 79,156, 56, 17,124, 62, 31, 90,173, 22, 30, 30, 30,176, 88, 44, 56,121,242, 36, 98, 99, 99, 43,172, 86,235,
- 79,248,253,176, 1, 17,168,213, 75,227, 84, 50, 4,143,252,150, 54,236,200,115,207, 61, 21, 77, 0, 16, 63,176, 74, 11, 91, 27,
-246,108, 60,112,126,204,222, 83,215,169,183,198,247, 99,116,246,107, 5, 0, 80,169, 84,144, 74,165,118,107, 62, 5,254,112,205,
-218,213,186,121,121,121,119,243,242,242, 52,175,191,254,186,127, 77,195,119, 30,143, 87, 85, 29,201, 42,174,111, 27, 27,242,105,
- 4, 48,125,199,142, 29, 71, 75, 75, 75, 79,189,247,222,123, 88,182,108, 25,126,252,241,199, 62, 0, 46, 52,115,223, 45,197,197,
-197, 37, 87,175, 94, 85,249, 4,132,162,141,146,141,190, 11,238,131, 16, 2, 39, 33, 65,121, 73, 17,110,220,184,142,242,242,242,
- 43,246,228,211,104, 52,150,104, 52, 26,133, 82,169, 68, 81, 81, 17, 10, 10, 10, 30,155,172,226,226, 98, 20, 21, 21, 17,138,250,
-221,152, 45,141,105, 86,106, 52, 26,109, 82, 82, 18, 87,213,202, 7,109,149, 28,116,251,240, 46, 64, 8, 60, 29, 25, 40, 47, 43,
-193,165, 75,151, 80, 90, 90,250,191,134, 52,173, 86,235,156, 9, 19, 38, 48, 1,188,252,222,123,239, 57, 2,232,248,254,251,239,
-255,132, 58, 61, 11, 89, 44,214,186, 61,123,246, 4,215, 84, 49,206,157, 59,119, 45,128, 29,127,214,181,228,228,228, 52, 39, 38,
- 38, 70, 98, 52, 26,177,113,227, 70,172, 93,187,118, 39,126, 63, 80,101,204,231,159,127,190,153,193, 96,204,152, 57,115, 38,166,
- 78,157, 42,236,210,165,203, 59,185,185,185,223,212,167,153,157,157, 61,191,115,231,206, 11, 53, 26,205,114,155,204,242,253,251,
- 83, 58,119,238, 60, 95,163,209,124,214,216, 57, 18,137, 68, 34,139,197,130,212,212,212, 98,160,193,246, 29, 85,169,169,169,217,
- 22,139,197, 67, 40, 20, 58, 54,117,125, 22, 23, 23, 47,239,210,165,203,199,106,181,250, 52,128,165,245, 24,242,155,185,185,185,
- 65,179,103,207,158,181,114,229,202, 49,121,121,121,223, 54,165,153,158,158,190, 60, 60, 60,124,193,189,123,247,118,161,225, 42,
-224,207, 23, 47, 94,108,220,179,103,207, 27,169,169,169, 43,154,208, 60, 86, 80, 80,112,204,142,243,219,208,247, 31,107, 50,153,
-204,247, 87,174, 92,201,216,182,109, 27, 8, 33,171, 45, 22, 75, 67,249,140, 63,124,248,240,238, 94,189,122, 77, 60,112,224, 0,
- 63, 40, 40,104,170, 94,175,223,215,212,245,169,213,106, 15, 29, 56,112, 96, 76,124,124,188,199,196,137, 19,249,190,190,190, 48,
- 26,141,200,205,205,197,182,109,219,170, 18, 18, 18,178, 74, 74, 74, 14,217, 83,134,152, 13,101,227, 47,158, 57,178, 47,237,126,
- 66,143,254,207,140,148, 27,140, 30,224, 21, 50, 81, 82,152,135,147,199, 14, 21,167,166, 38, 95,210,106, 75,198,219,163,105,212,
-151,190,112,233,215,163,223,102,165, 38,117,239, 27, 62, 84, 94,101,240, 2,143,195, 64,161, 58, 27, 39, 99,142, 20,165,166,166,
-252, 86,101,210,191,242, 87,149,243, 76,111, 44,101,230,197,190, 62,109,120, 39, 8,228, 30, 55,216,192,198, 94,128, 64,161, 82,
-113,170,239, 29,136, 31,181,121,180, 73, 83, 13,112,125,170,107,169,180, 90, 45,216,128, 97, 18,192,118,118,118, 22, 0,192,189,
-123,247, 32,124, 84,171, 97, 87, 62, 43, 0,145,176,150, 46, 3,208, 22,178,224,222, 78, 42,162, 0, 32, 43,175, 16, 6, 83,163,
-207,141,127, 58,209,181, 12, 87,116,115, 4, 56, 0, 34,196, 98,241,178,133, 11, 23,174,190,114,229,202,234,168,168,168,213, 60,
- 30,111, 89,245,193,230, 52,114, 34,254, 52,205,174,110,112, 12,111, 75,157,139,108, 71, 89,167,245,145, 91, 94,233, 38, 50, 12,
- 24, 48, 96,115, 11,243,217,146,155,229,143,212, 60, 98, 50,153, 8, 30, 85,219, 29, 65,195, 85,130, 31,212, 90,159,151,145,145,
- 65,170,223,219,147, 79,197,184,113,227,172,229,229,229,228,249,231,159, 39,104,122, 10,159, 70, 53,121, 60, 94,120,223,190,125,
- 77,234,252, 34,114, 55, 37,155, 92,142,187, 77, 78,157,185, 72,190, 61, 20, 67, 54,109,222, 78, 66, 66, 66, 12, 0,188,236,209,
-100,177, 88, 3,194,195,195, 11,213,106, 53, 73, 74, 74, 34,231,206,157, 35, 7, 15, 30, 36,219,183,111, 39, 91,183,110, 37,173,
- 90,181, 82, 3, 80,217,163, 41, 16, 8, 70, 14, 25, 50,196, 84, 82,166, 37,169,217,133,228, 86, 82, 42,185,112,245, 22, 57,121,
-230, 2,249,102,223, 1, 18, 24, 24, 88,101,131, 38,147,201,100,110,250,246,219,111,203, 8, 33,100,228,200,145, 89,120,114, 32,
-213, 54,115,230,204,209, 16, 66,200,103,159,125, 86,136,250, 27,194,255,209,215,210, 51,238,238,238,119, 57, 28, 78, 12,128,151,
-155,216,238, 5, 22,139,245,163,139,139,203, 53, 0,163,255,130,251, 40, 74,169, 84, 94, 6,208,212, 12, 7, 53,223, 27,245, 47,
-185,223,255, 8,205, 1, 44, 22,235, 28,208,248, 36,194,181,202,235, 79,152, 76,230,113, 0, 3,237,204,103,123,133, 66,241,188,
- 92, 46,127, 75, 46,151,191,165, 84, 42,159,231,114,185,237, 91,178,239, 78,237, 35,134,123,134,142, 56,220,170,227,176,116,207,
- 78, 81,233,222,157, 71, 30,118,106, 31, 49,188,165,154, 94,157, 71, 30,241,236, 20,149,225,217,105,120, 90,155,174, 35, 15, 43,
-252, 34,134,252,149,231,232,101,119,184, 13,106, 3, 51, 57,183,128,144,115, 11, 72, 68, 27, 88,123, 56, 32, 48, 12,144, 12,142,
-136, 88, 67, 44,150, 53, 99, 70,141, 90,227, 3, 56, 17,128, 89,119,169, 79, 51, 20,144, 62,222,118,228,200, 53,109, 1,197, 32,
- 64,216,175, 79,159,213,196, 98, 89, 51,225,133, 23,214,120, 2, 46,245,233, 53,164, 73, 0,166, 59,224, 86, 91, 87, 1,180, 27,
-235,141,160, 15,134,123, 19,114,110, 1, 89,252,156, 47,233,172,194,203, 77,104, 54, 20, 41,250, 71, 71,180,236, 69, 84, 93,184,
-174,168,126, 21, 61,133,139,240,169,107,118,119,133,111, 68, 59, 42,105,168, 31,171, 8,143,186, 36,139,254,133,133,228, 46,131,
-193, 64,170,170,170,136, 86,171, 37, 21, 21, 21,117, 13,212, 99, 67,150,147,147, 67,178,178,178, 72, 70, 70, 6, 73, 75, 75, 35,
-248,255,182, 55, 54,231, 83, 42,149,238,120,238,185,231, 44,108, 54,123,211,211,216,119, 71, 71,199, 21,221,186,117, 51,110,216,
-176,129, 28, 62,124,152,124,241,197, 23,100,230,204,153, 36, 56, 56, 88,239,224,224, 48,190, 57,154, 46, 46, 46,243,253,252,252,
- 10,119,238,220, 73,190,249,230, 27,178,126,253,122,242,209, 71, 31, 89, 60, 60, 60,242, 36, 18,201,224,230,104, 42,149,202,232,
-222,189,123, 27,163,163,163,201, 79, 63,253, 68,246,238,221, 75,230,204,153, 67,252,253,253,245, 34,145,232, 89, 27, 53,153, 44,
- 22,107,205,180,105,211,242,220,220,220, 98,234,172, 19, 6, 6, 6, 94,155, 48, 97, 66, 14,128,185,255,162,235,147,214,164, 53,
-105,205, 63,192,104,189,232, 6,119, 2, 48,133, 28,206, 11,253,250,244, 89,205, 1, 94,176,215, 20,241,153,204,177,189,186,117,
- 91,205, 1,198,215,124,151,207,100,142,237,215,167,207,106, 54,147,249, 82, 67,122,141,105, 18,128,201, 97,177,230,246,234,209,
- 99, 13, 11,248,176, 38,109, 64, 27,234,206,156,103, 90,145, 62, 94,212,131,151,148, 16,254,139,141,214, 83,135,245, 7, 92,132,
-255, 20,205,191,203, 77,237, 83,109,152,142,216, 17,209, 58,130, 71,179,168,251, 52, 51,159,130,167,188,239, 29, 20, 10,197, 9,
- 31, 31,159,252,214,173, 91,231,200,229,242,125, 0, 60, 90,168, 25,228,226,226,242,181, 74,165,186,239,234,234, 26,175, 80, 40,
-214,225,209,168,243,205,214,100,179,217,221, 84, 42,213,255,188,189,189, 75,188,188,188,212, 10,133,226,219,122, 34, 89,182,104,
-186,162,254, 66,133, 83,189,142,126,232,208,154,180, 38,173,249,132,129,137,108,139,149,131,218,192, 60,168, 13, 44,145,222, 88,
- 87,219,160, 68, 1,130,230,154,162, 87, 0, 94,221,239, 55,165,215,148, 38, 1,152, 61, 1,113,221,109,134,122, 32,208, 70,205,
-127,122, 68,171,166,156,183,111,120,135, 6, 48,255, 1,153,252,167,104,254, 93,120,128, 70, 26, 35,215, 98,197, 83,252, 77,221,
- 83,222,135, 91, 5, 5, 5, 67, 10, 10,158,106,223,132,196,188,188,188,151,159,166,160,201,100,186,162, 86,171,251, 63, 5,169,
-134,186, 94, 27, 97, 99,183,108, 26, 26,154,255, 14, 20, 96, 65, 50,230, 69,180,199, 70,150, 5,140,147, 41,200,174,211, 37, 79,
- 71, 53, 71,243, 17,150, 93,245,148,241, 84,115,243,249,255, 84,252, 78, 35, 11,183,169,255,206,105,203,197,163, 54, 90, 45, 54,
- 90, 52, 52, 52, 52, 52, 52, 52,127, 2, 63,223,167,255,136,253, 3,136,193,147,209,183,152, 90, 70,180,193,208,167, 61, 61, 41,
-154, 19, 62,253,153,214,164, 53,105, 77, 90,147,214,164, 53,105,205,255,156,102, 13, 13,205,157,122,183,206,231,102,245,226,251,
-175, 64,215,179,211,154,180, 38,173, 73,107,210,154,180, 38,173,249,111,167,217,227,104,209,208,208,208,208,208,208,208,208, 52,
- 78,131, 81, 55,218,104,209,208,208,208,208,208,208,208,180, 12, 87, 60,154,162, 42, 6,255, 63, 85, 85, 52,208,244, 20, 60, 79,
-176,114,229, 74,134,143,143,143,152,203,229, 6, 39, 39, 39, 51,166, 79,159,222,226,142, 4,171,215,109, 98,120,121,121,137, 1,
- 4, 23, 22,151, 51, 94,125,237, 61,138, 62, 95, 52, 52, 52, 52, 52, 52, 52,255, 32,134, 85, 27,171,154,215,199, 17, 46,187,140,
-214,210,165, 75,145,145,145, 33, 2, 48, 46, 40, 40,136,187,101,203, 22,178,127,255,254, 22, 25,163, 15,231,206, 65,122,122,186,
- 8,192, 56,165,194,129,251,229,142, 85,228,192,143,231,159,186,217, 82, 40, 20, 78,127,230,118, 52, 52, 52, 52, 52, 52, 52,255,
- 41,166,212,122,157,210, 44,163,197, 98,177,152, 92, 46,183, 45,131,193, 24,194,231,243,187, 2, 64,245,148, 44,205,134,197, 98,
- 49,185, 60, 94, 91, 38,147, 57,132,199,123,164,249,220,240,222, 45,213, 28, 40, 18,137, 50,133, 66, 97, 44, 0,129, 68, 34,185,
-110, 52, 26,111, 75, 36,146,139,246,232, 72, 36,146,139,213,219, 93, 7, 32, 16, 10,133,177, 34,145, 40,147,197, 98, 13,164,175,
- 39, 26, 26, 26, 26, 26, 26,154,106,162,235, 89,126,207,177, 99,199, 26, 52, 56, 92, 46,151, 17, 20, 20,212,219,203,203,235, 66,
- 64, 64,128,193,195,195,227,160, 80, 40, 20,181, 48, 99, 12, 31, 95,255,222,110,174,170, 11,157,218,186, 26,148, 74,229, 65, 54,
-155,221, 18, 77,166, 68, 34, 89, 31, 25, 25, 89,122,225,194, 5, 34,149, 74,213, 0, 28,156,157,157,115, 8, 33,196,197,197,197,
-106,143,152,139,139,139,149, 16, 66,156,157,157,115, 0, 56, 72,165, 82,245,133, 11, 23, 72,100,100,100,169, 68, 34, 89,143,166,
- 71,180,165,161,161,161,161,161,161,177,131,198,188,200,223,152,154, 40,150,107,179,119,142,203,229,134, 42, 20,138,132,183,223,
-126,219, 18, 29, 29, 77,188,188,188,174, 42,149,202, 30, 10,133,226,137, 6,245,147, 38, 77,178,167,218, 47, 84, 34,149, 37,236,
-154,253,140, 69,247,229, 72,226,238,170,188,234,224,224,208, 67, 42,149, 62,161, 57,225,213,169,182,104,186,156, 17,217,210, 0,
- 0, 32, 0, 73, 68, 65, 84,201,100,178,248,149, 43, 87, 86,149,148,148, 16, 66, 8,145,201,100,106, 0,114,149, 74,149,147,146,
-146, 66, 20, 10, 5,129,237, 81, 60,134, 66,161, 32, 41, 41, 41, 68,165, 82,229, 0,144,203,100, 50, 53, 33,132,148,148,148,144,
-149, 43, 87, 86,201,100,178,120, 0,110,244,109, 65, 67, 67, 67, 67, 67,243,159, 54, 90,117, 13,151,109, 85,135, 93,187,118,229,
-169, 84,170, 30, 18,137,100,148, 88, 44,222, 60, 98,196,136,160, 49, 99,198, 48,244,122,189, 37, 40, 40,200,205,219,219,123,150,
- 92, 46,127,153,207,231,135,112,185,220,151,164, 82,169,235,190,125,251,124, 26,211,236,208,177, 11,207,193, 65,222,131,203,229,
-141, 18,139, 37,155,167,141, 29, 16,244,242, 59,207, 50, 56,134, 52,203,128, 16, 79,183,224,182,174,179, 92,228,162,151, 89, 76,
- 70, 8, 69, 81, 47,241,249,124,215,111,190,220,238,211,196,142,181,117,115,115,187,190,111,223,190,224,113,227,198,241,146,146,
-146, 0, 0, 22,139,133, 11,192,196,100, 50,193,227,241, 96, 52, 26,139, 1,216,122, 2,137,209,104, 44,230,241,120, 96, 50,153,
- 0, 96,170,214, 67, 82, 82, 18,198,141, 27,199,219,183,111, 95,176,155,155,219,117, 0,109,233, 91,131,134,134,134,134,134,230,
- 63, 75,141,185,138, 65,157,170, 67, 86,141,123,140,138,138,122, 34,106,196,229,114,183,220,187,119,175,151,163,163, 99, 91, 54,
-155,109,121,225,133, 23,120, 19, 38, 76, 64,126,126,190,181,162,162,130, 25, 26, 26,170,186,118,237,218, 16,179,217,220,199,193,
-193, 65, 91, 82, 82,162,208,235,245, 15, 0,204,106, 36, 35, 91,238,223, 77,232,229, 36,119,108,203,101, 51, 45, 51, 39, 79,224,
-125, 56,247, 25, 80,250, 56,171, 69, 83,200,252,164,179,131,106,221,197,202, 33,247,140,150, 62,149, 50,190, 54,175, 84,223,164,
-166, 66,161,232,204,225,112, 98, 79,156, 56, 1,161, 80,136,210,210, 82,112,185, 92, 0, 64, 69, 69,133, 12, 0,139,162, 40,112,
-185, 92,148,149,149,201,237, 57,106,101,101,101,114, 46,151, 11,138,162, 0,128, 85,173, 7, 46,151,139,210,210, 82,248,248,248,
- 80, 39, 78,156, 80, 14, 25, 50,228,161,209,104,236, 82, 80, 80, 16, 71, 95,107, 52, 52, 52, 52, 52, 52,246, 83,159, 23,249, 7,
-209,228, 56, 90,253,171, 67,117,181, 39,206,221,237,236,236,236, 34, 22,139, 3,166, 76,153,194, 80, 40, 20,136,141,141,181, 86,
- 86, 86, 50,216,108, 54,216,108, 54,115,192,128, 1, 98,179,217, 44, 60,126,252, 56,245,240,225,195,124,147,201,244, 73, 97, 97,
-225,181, 70, 50,178,187,157, 3,207, 69,224,192, 13,248,241,189,190, 12,103,159, 66,224,212, 98, 43,169,208, 48, 88, 86, 2,133,
-200,202, 92,211,135, 18,231,201,188,133, 51,191,205,167,126,123, 88,146,111, 50,153, 62, 41, 47, 47,111, 76, 51, 27, 0,170,243,
- 4,169, 84, 10,139,165,246,252,150, 32, 12, 6, 3, 60, 30,175, 89, 71,142,199,227,129,193, 96, 0,181, 34, 97, 50,153, 12, 76,
- 38, 19, 12, 6, 3,108, 54,251,137,124,208,208,208,208,208,208,208, 52,139,250,188,200, 63,133,218,227,104,217, 54, 55,165, 74,
-165,162,164, 82,169,107,199,142, 29, 63,142,140,140, 76, 25, 61,122,180,118,195,134, 13,100,237,218,181,100,205,154, 53,100,231,
-206,157,150, 95,127,253,213,244,218,107,175, 85,181,111,223,254,193,230,205,155, 3, 0, 96,232,208,161, 13, 86, 71, 58,200, 29,
- 41, 49,151,229, 26, 24,208,225,227, 23,251, 7,167, 44, 24,229,171, 53,238, 10, 37,214,133,173,136,101,147, 55,177, 28, 24,104,
- 33,247, 86,153,150,191, 62,176,170,181, 87,235, 7, 91,119,126, 23, 0, 0, 17,145, 67, 27,173,226, 84, 40, 20, 93, 61, 60, 60,
-212,167, 79,159,182, 22, 23, 23,147,194,194,194,154, 54, 90, 37, 0,100, 94, 94, 94, 57,102,179,153,200,229,242, 34,123,142,154,
- 92, 46, 47, 50,155,205,196,203,203, 43,231,145,191,146,149, 16, 66, 72, 97, 97, 33, 41, 46, 46, 38,167, 79,159,182,122,120,120,
-168, 21, 10, 69, 87,250,254,160,161,161,161,161,161,249,207, 50,165,206,107,211,244,234,213,139,146, 74,165,140, 14, 29, 58,136,
-221,220,220,186,187,185,185, 93, 89,183,110, 29, 89,187,118,173,121,219,182,109,228,235,175,191, 54,191,242,202, 43,101, 34,145,
- 40,134,203,229,202, 1,192,219,219,187,209,144, 95,215,238, 61, 40, 1,159,199,240,243, 11, 20, 43,156,156,186, 59, 59, 57, 94,
- 49,174, 13, 38,100,177,187,153,236,232, 68,200,129,103,204,171,158, 15, 43, 99,179, 57, 49, 0,228, 0,224,225,230,106,107, 24,
-209, 77,169, 84,198, 47, 94,188,184,210,104, 52,146,234, 94,134,106, 0, 14, 94, 94, 94, 57,132, 16,226,225,225,145, 9, 64, 97,
-163,158,194,195,195, 35,147, 16, 82, 99,180, 28, 92, 92, 92,212,132, 16, 98, 52, 26,201,226,197,139, 43,149, 74, 37,221, 24,158,
-134,134,134,134,134,134,166,193,185, 14, 27,140, 20, 93,184,112,129,148,149,149, 89,179,179,179, 45, 21, 21, 21,210,208,208, 80,
- 57,147,201,132, 74,165, 98, 50,153, 76,107,101,101, 37, 83,161, 80,228,176,217,236,111, 12, 6, 67,241,168, 81,163,168,212,212,
-212, 70, 27,154, 95,187,124,137,232,170,244,214,172,172, 76,139,182,162, 76,250,114,136,163,156,101, 54,194, 26,218,139, 89, 38,
-104,111,181,234,138,153,254,174,188, 28, 14,135,253, 13,128,226,209, 81,195,168,172,156, 92, 91, 27,175,231,104, 52,154,208, 45,
- 91,182,236,232,219,183,111,177, 86,171,173,105, 91, 85,119, 8, 6, 7, 27,245,234,126,143, 73, 81, 20,180, 90, 45,250,246,237,
- 91,188,101,203,150, 29, 26,141, 38, 20, 64, 14,125,125,209,208,208,208,208,208,252,167,105,112, 28,173, 38,135, 58,208,106,181,
-114, 14,135, 19, 17, 22, 22,214,186,178,178,210,186,116,233,210,204, 13, 27, 54,236,121,240,224,129,201,193,193,161,173, 64, 32,
-120,107,220,184,113,138,195,135, 15,147, 62,125,250,212,141, 62,213, 59,187,183, 78, 87, 33,231,113,216, 17,111,117,147,180,206,
- 52,202,173, 1,111, 93,205,236,183,240,226,158, 31, 18, 89,166, 14,142,186,182,142, 92,234,173,113,227,158, 87,252,112, 44,134,
-244,232,209,221, 38,205,106, 44, 26,141,230,173,216,216,216,231,219,180,105,147,101, 50,153,178, 0, 20,234,116, 58,181,155,155,
-155,198,104, 52,102, 1, 48,214,179, 93,125,154, 70,163,209,152,229,230,230,166,209,233,116,106, 0,133, 38,147, 41,171, 77,155,
- 54, 89,177,177,177,207,107, 52,154,183, 0, 88, 26,201, 11, 61,171, 59,173, 73,107,210,154,180, 38,173, 73,107,254,119,248, 93,
- 52, 11,176, 97, 82,105, 30,143,215,215,211,211,179,119, 98, 98,162,229,210,165, 75,165, 12, 6, 99,235,208,161, 67, 15, 30, 58,
-116,168,155,163,163,163,178, 85,171, 86,170, 95,126,249, 37, 28,192,254,223,126,251,205,166,232,147,128,199,233,219,201, 67,214,
- 59,250, 38,177,124, 25,123,191,212,194,228,109, 29,240,236,179, 7,223,220,179,183,155,155, 66,162,236,228, 42, 85, 29, 63,126,
- 50, 28,192,254, 75,151, 46,219, 61,158,134,217,108,254, 69,163,209,180,170,249,156,159,159, 31,170, 80, 40, 2,240, 40,250, 84,
-106,163, 76,186,213,106, 29,106,181, 90,221, 10, 10, 10,238, 0, 64, 65, 65, 65, 23,250, 58,162,161,161,161,161,161,161,169,199,
-100, 69,215,247,185,209,136, 22,151,203,117,103, 50,153,129, 89, 89, 89,233,199,143, 31, 79,236,218,181,235,144,244,244,244,149,
-132,144, 52,161, 80, 56, 37, 51, 51,243,126,102,102,166, 65,167,211, 77,179, 35, 51,238, 96,112, 2, 99,115,116,233,159,254,114,
- 59,177, 67,143,193, 67,242,242,114, 86, 90, 8, 73,227, 10,165, 83,238,101,228,223,191,172,209, 27,170,170,236,210,108,146,130,
-130,130, 59, 5, 5, 5,165,118,110, 83, 90, 99,178,104,104,104,104,104,104,104,104,236,165,169,136,150,209, 98,177,172,210,235,
-245,242, 31,126,248, 33, 59, 50, 50, 82, 15, 0, 91,182,108,177, 78,158, 60,249,124,114,114,242,192, 59,119,238, 12,113,113,113,
- 57, 3,128, 74, 73, 73,177, 37,250,100,180, 90, 45,171, 12, 6,189,252,151, 95,227,178,251,246,238,160, 7,128,109,159,111,180,
-190, 48,101,246,249,228,164,196,129,247, 18,174, 15,113,113,113, 57, 99, 49,179,168,220,188, 52, 66,159, 38, 26, 26, 26, 26, 26,
- 26,154,191, 49,209,120,178,202, 48,218, 38,163,101, 48, 24,242, 13, 6, 3, 0, 20, 71, 70, 70, 62,177,110,231,206,157, 4, 64,
- 37,128, 3,133,133,133,246,100, 38, 95,167,211, 1, 64,113,223,222, 29,158, 88,241,109,244,134,199,154, 21,229,101,244,105,163,
-161,161,161,161,161,161,249, 39,153,173,223,193,160,143, 11, 13, 13, 13, 13, 13, 13, 13, 77,139,152,210,208,103, 10, 13,247, 28,
-248,217,142, 31,104, 78,239,131,159,105, 77, 90,147,214,164, 53,105, 77, 90,147,214,252,207,105, 54,165,253, 51,254,121, 52,216,
- 24,254,143,134,238,250, 74,107,210,154,180, 38,173, 73,107,210,154,180,230,191, 29, 87, 60, 57,188,131,107,205, 10, 22,125,108,
-104,104,254,217,144, 3, 96,162,216,207, 27,132,184,129,201,205, 69,238,173,100,234, 99, 88, 91,172,169, 14,244,130,192,164,130,
-153,159, 15,117,124, 74, 75, 53,105,104,104,254,125,184,244,156, 62,154, 98, 48,183, 82,196, 10,157, 58,137,199,209,165, 9, 53,
-185,233,255, 69,111,145,139, 6, 34, 88,180,209,162,161,249,167,147,239,239, 11, 22, 86,128, 1, 87, 16,227, 67, 56, 7,174, 0,
-110, 39,180, 88,147, 99, 93, 10, 11,195, 3,196,120, 15, 74,191,149,192,221,219,244,193,254,247, 49,107,230, 27,228, 78,194, 21,
-100,100,228,160,109, 59, 87,248,250,247,196,134,141,155, 41,250,200,208,216,246,175,140,138,142, 24, 62,193, 81, 32,148, 0, 0,
-172,102, 19,118,190,211,233, 39,179,217,188, 27,192, 97, 0,186,255,250, 33,250,211, 27,195,179,217,108, 53, 0, 43,159,207, 63,
-132, 90,161, 53, 26,154, 63, 0,215,234,235,204, 90,125,221,217,131,152,197, 98, 45, 20, 10,133,191,242,120, 60, 13,143,199,211,
-136, 68,162, 95, 89, 44,214, 66, 0,226,191, 77, 25,247,117,176, 16, 12,203, 16,131,201,234,126,242, 86,137, 82,171,183,248,130,
- 97, 30, 74,118,182, 23,183, 72,147, 69, 69, 86, 25,173,158,223, 92,213,170, 42, 13,230, 0, 16,180, 72,179, 22, 14, 28, 14,231,
- 36,108,159,115,148,230, 15, 38, 61, 37, 1,199,143,173,193,210, 37, 19,241, 85,244, 52,220,189,115,185, 69,122, 1, 64,151, 46,
- 44,214,187,254,192, 0, 60,106, 7, 76,243,111,134, 34, 83,126,254,241,155,252, 31,247,125,158,255,221,154,105,228,200,138, 40,
-108,220,184, 49, 98,226,196,137,223,120,122,122,230, 3,120,142, 54, 90,127, 50, 38,147, 73, 89, 80, 80, 64,237,222,189,123,132,
- 76, 38,123,200, 98,177, 62, 0,192,249,175, 28,112,177, 88,124, 81, 42,149,170,101, 50,153, 90, 42,149, 94,111, 42,253, 95,138,
-175,179,179,115,186,163,163,227,189,218,137,206, 33,163,123,250,244,122,121,145, 83,224,200,126, 45,212,231,176, 88,172, 15,100,
- 50,217,195,221,187,119,143,200,206,206,166, 76, 38,147,210,142,237,251,202,229,242, 59, 87,174, 92, 89, 80, 80, 80,208, 47,243,
-242, 78,231,188, 43,219,157,211,255,183,166,127,236,241, 77, 11, 28, 28,100,183, 1,244,253, 91, 28,201, 42,171, 10, 12,102,120,
- 98,174, 86,152, 91,102, 82,197,165,105, 37, 0,179, 63, 12, 45,248, 19, 83,106, 85, 1,100,192,205, 44,157,232, 98,145,179,234,
-183,100,189, 20, 12, 70, 56,170, 40,151, 22, 23, 56, 12,198, 27, 86,171,117, 16,135,195,121,139,126, 66,253, 61,224,241, 56, 0,
- 33, 16,139,248, 0, 8, 24, 45,180, 70, 92, 6,163,215,197, 17, 35,150,206, 13, 9,153,229, 15, 12,111,192,108, 81, 0,222,244,
-247,247, 63, 1,224,133,167,184, 59,159,250,249,249,101, 3,152,253,180,202,165,206,157, 59,247, 12, 15, 15, 95,212,169, 83,167,
-126, 79, 75,243,223, 68,222,197, 45, 63,228,158,223,164,204,185,176, 89, 89,146,114,238, 77, 87,149,220,154,146,146,130, 97,195,
-134,225,243,207, 63, 23, 6, 5, 5,237, 1,224,246, 31,184,149, 66,107,254,224,163, 78, 27, 45,155,141,214, 88,111,244, 26,223,
- 6,103,159,247, 70,249,184, 54,168,120,169, 13,206, 63,235,141, 1,205,201,141,147,147, 19,250,246,237,203,204,206,206, 22,204,
-153, 51,103, 17,159,207, 79, 5, 48,184, 57, 90, 2,129, 32, 86, 40, 20,102,178, 88,172, 39,242, 34, 20, 10, 99, 69, 34, 81, 38,
-139,197, 26, 88, 59, 93, 34,145, 92,148, 74,165,106,137, 68,114,189, 1, 35, 20, 43,149, 74,213, 98,177, 56,182,118, 58,139,197,
- 26, 40, 22,139,179, 36, 18, 73,221,244, 1, 18,137, 36,179,110,122, 67,176,217,108,143,204,204, 76,101, 86, 86,150,146,203,229,
-170,106,167,103,100,100, 40, 51, 51, 51,159, 72,183, 7, 22,139, 53, 64, 36, 18,101, 10,133,194,216,250,210,235,238, 83, 67,212,
- 58,118, 3,108, 73,183,183,224,137,140,140, 60,159,155,155,235,233,224,224,240,196,196,221,142, 50,135,193, 95,239,220,252,206,
-200,161,145,111, 56, 7,140,234,208, 76,253,193,124, 62, 63,117,206,156, 57,139,178,179,179, 5, 61,122,244, 96, 50, 24,118,253,
-159,136, 24, 57,114,228, 17,181, 90,237,222,177, 99, 71,166,217,108, 70,226,209,133, 16,198,191, 5,126,234, 54,180, 18,228,179,
- 30,254,180,210, 35,178,127,151, 35,248,139, 27,131,146, 3, 1, 28, 80,214,190, 86, 66,156,239,100, 87, 57, 15, 27,241, 28,235,
- 70,166,206,217,100,177, 56, 2,204,254,228, 43, 47, 94,179, 52, 89,166, 62, 86, 66, 84,191,164,177,157,195,159,159,197, 60,147,
-198,114, 54, 89, 44, 78, 96,160, 95,115, 52,107, 95,254, 76, 38,243,157, 53,107,214, 48, 0,204, 4,192,253, 47, 25,154, 48, 55,
-184, 15,104,199,188, 26,234,138, 94, 79, 81, 54,168,250,126,247,109,169,208,142,175, 78, 96,242,212,104,180,247,239,222, 34, 29,
-131,213,122,247,219,148,148, 83, 47,181,107, 23, 53, 55, 36,100, 82, 61,102,139, 2, 48,119,229,202,149, 47, 39, 38, 38, 58,183,
-105,211,102,234, 83,250,211,191,126,229,202,149,239, 39, 38, 38,186,121,123,123, 47,182, 83,179,193,114, 73, 46,151, 15,222,177,
- 99,199, 59,195,134, 13,123,163,115,231,206, 29,158,134,230,191,152,207,111,222,188,233,185,102,205,154,121,147, 39, 79, 46, 3,
-128,129, 3, 7,114, 0,244,104,113,121, 71, 8,151, 16, 18, 78, 8, 25, 70, 8, 25, 72, 8, 9,171,126,223,181,122, 25, 70, 8,
-137,168,243,218,181,122,219,154,245,221, 26,208, 24, 86,119,187, 90,219,212,253,252,196,251,122,140,214, 48, 60,106,171, 53,236,
-137, 29, 56,118,236, 24,169,253, 90,151,113,222,248,120, 86, 79,119,237,157, 31,247,146,138,204, 20, 82,156,116,131,220,136, 94,
- 78,102,117,117,214,190,216, 6,159,218,127,188, 8,185,112,225, 2, 73, 76, 76, 36, 21, 21, 21,228,254,253,251,164, 91,183,110,
- 58,161, 80,248, 11, 0,111,123,196, 36, 18,137,250,151, 95,126, 33,145,145,145,165, 98,177,120,117,205,205, 37,149, 74,213, 23,
- 46, 92, 32,145,145,145,165, 18,137,100, 61, 0, 38, 0, 60,251,236,179, 26, 66, 8,113,118,118,206,169, 79,111,228,200,145,197,
-132, 16, 34,147,201,106,170,154,152, 18,137,100,253,140, 25, 51, 42,174, 93,187, 70,228,114,121, 77, 58, 67, 42,149,174,158, 57,
-115,102, 69, 92, 92, 92,237,244, 70,113,116,116,204,180, 88, 44,228,199, 31,127, 36, 74,165, 50,167,214,205,156,105,177, 88,200,
-145, 35, 71, 26,204, 91, 99,129, 2,177, 88,188,234,165,151, 94, 42, 79, 75, 75, 35, 78, 78, 78,234, 90,233,171, 39, 78,156, 88,
-158,145,145, 65, 20, 10,133, 77,121,116,114,114, 82, 95,188,120,145,140, 25, 51,166,172,246, 49,117,114,114, 82, 95,186,116,169,
- 38,125,149, 45, 5,153,155,155,219, 84,165, 82,153,163, 84, 42,115, 28, 28, 28,150,185,186,186,230,229,231,231, 19, 66, 8,105,
-219,182,173,166,118, 36, 75, 25, 52,226,237,109, 7, 46, 93, 57,151, 80,152, 31, 50,232,141, 85,178,144,145, 50, 59,142,129,183,
- 80, 40,252,165, 95,191,126,186,204,204, 76, 82, 89, 89, 73,226,227,227,201,133, 11, 23,200,131, 7, 15, 8, 0, 91,102, 24,144,
-136,197,226,108,189, 94,111,213,235,245,214,252,252,124,139, 70,163,177, 36,173,118, 37,228, 75,246,227,165,228,200,112,146,119,
-110,133, 85, 42, 22,102, 1,144,252,101, 70,107,115,160, 7,217,238,247,237,237,133,158, 73,231, 86, 62, 99, 34,105,103,200,222,
- 73,206,166,179,111,187, 63, 36, 91,253,191, 39,219, 3, 90, 53, 75,115,107,192,222,248,143, 60,239,110, 90,252,166, 41, 61, 61,
-157,188, 59,241, 25,243,233, 89,238,201,100,155,255,129,230,104,214, 98,252,232,209,163, 43, 50, 50, 50, 72, 96, 96, 96, 37,147,
-201,156,252, 95, 50, 89, 17,190,220,236,248,111,222,181, 14, 15, 18, 22, 62, 37,179, 21,164, 84, 42, 11,118,237,218, 69, 36, 18,
-137,166,185,102,107,236,168,254, 68, 87,250, 11, 25, 21, 21,214,232, 61,242,252,243,207,147,240,240,112, 50,107,214,172,166,238,
- 37,202, 31, 24,177, 59, 36,228,136,117,236, 88,203,238,144,144, 35,254,192,136,106,131, 69, 1,152,247,217,103,159,197,153, 76,
-166,184,175,190,250, 42,110,196,136, 17,113, 0,222,109,225,177,216,240,233,167,159, 18,147,201, 68,190,250,234, 43, 50, 98,196,
- 8, 2, 96, 99, 75,202,165,154, 72, 86,104,104,232,219,135, 15, 31,190,114,247,238,221,252,168,168,168, 85, 33, 33, 33,178,230,
-106,254, 29, 17,139,197, 62, 29, 58,116,216, 19, 24, 24,152,209,177, 99, 71, 67, 64, 64, 64,149,175,175,111, 90, 80, 80,208, 46,
- 30,143,231,221, 76,217,238,189,122,245,178,156, 61,123,150,140, 30, 61,154,212, 50, 33,141,210,152, 23, 33,132,132,205,155, 55,
-239, 3, 0,100,222,188,121, 31, 16, 66,134, 85,251,137, 97,181,223,215,125,173, 49, 79, 53,159,235,211,168, 89,234,211,172,239,
- 55,234,252, 14, 26,136,100, 77,249,221,206, 29, 59,118,172,223,177, 99,199,206,214,221,185,231,218,160,231,172,158,238, 58, 93,
-126, 46, 73, 88,254, 22,249, 53,220,131, 92,232,239, 66,238,189, 51,154,228,126,179,158, 76,239, 36,215,142,109,131,112,123,141,
- 86, 92, 92, 28,137,139,139, 35,215,175, 95, 39,169,169,169,164,180,180,148,124,247,221,119, 22, 39, 39, 39, 29,143,199, 91, 9,
- 64, 96,139,152, 84, 42, 85, 19, 66,136, 94,175, 39,203,150, 45,171,170,142, 84,169,100, 50,153,154, 16, 66, 74, 74, 74,200,202,
-149, 43,171,100, 50, 89, 60, 0, 55,133, 66,145,153,146,146, 66, 84, 42, 85,189,102, 70, 46,151,171,239,222,189, 91, 99,156,220,
-229,114,121,194,209,163, 71,141,132, 16,146,149,149, 69, 28, 29, 29,213, 0, 84, 78, 78, 78, 55,142, 29, 59,102, 36,132,144,156,
-156,156,154,116,155,140,150, 78,167, 35,167, 79,159,126, 34, 15, 53,233, 39, 78,156,120,194,128,217,128, 74, 38,147,197,125,247,
-221,119, 6,139,197, 66, 18, 18, 18,106, 76,162,202,193,193,225,250,129, 3, 7, 12, 22,139,133, 36, 37, 37,217,108, 6, 91,183,
-110,173, 33,132, 16,179,217, 76,182,109,219,166,175, 57,166, 53,233, 6,131,129,108,217,178, 69, 47,149, 74,227, 0, 52, 26,125,
- 83, 40, 20, 57, 6,131,129,148,148,148,144,110,221,186, 85, 92,184,112,129,148,149,149, 17, 66, 8,105,221,186,181, 6, 0,252,
-250, 77,254,228,202,253,138,178, 87,223,223,188,223, 59,236,197,229,167,174,102,103,237, 56, 28, 27,167, 8, 26,249,140, 45, 65,
- 77, 30,143,183,210,213,213,181,234,183,223,126,179, 24,141, 70,146,145,145, 65,174, 95,191,254,248, 26,187,117,235,150, 77, 70,
-139,197, 98, 45,188,114,229,138,209, 98,177, 88, 11, 10, 10, 44, 26,141,198,162,209,104,204,117,141, 22,249,146, 77, 10, 78,188,
- 78, 98,162,103, 27, 56, 28,206,194,191, 38,154, 5, 38,217,238, 55,146,108,247,139,219,245,146,162,160,252,250, 62, 66,126,154,
- 77,146, 63,105, 67, 22, 62, 35, 41,183,110,247,139, 35,219,253,199,146,143,251,177,236,210,140, 14, 24, 78,182,251,197,125,250,
-156, 87,225,141,184,107,228,236,217,179,100,203,250,207,200,172, 8,247, 74,235,118,191, 56,178, 53, 96,140, 61,154,181,225,241,
-120,247,207,159, 63, 79,206,157, 59, 71, 22, 47, 94, 76,132, 66, 97,198,211,136,234,145,173,190, 94,228, 11,223,126,100,103,123,
- 87,242,191,126,127,187, 14, 62, 97,110,112, 31,228,203,205, 42,184,113,152,144,162, 7, 36,111,117, 32,121,198,143,221, 82,179,
- 21,164, 84, 42,243,211,210,210, 72, 94, 94, 30, 89,187,118, 45,145, 74,165,205, 50, 91, 99, 71,245, 39,186,146,159, 27, 53, 90,
- 35, 71,142, 36,235,214,173, 35, 38,147,137,116,239,222,221,150, 63, 45,191, 51, 91,126,192, 72, 0, 31,172, 90,181,234,177,201,
-218,188,121,115,220,173, 91,183,226, 60, 61, 61,143,183,224, 88,108, 92,181,106,213, 99,147,181,121,243,102,114,235,214, 45,226,
-229,229,149,217,146,114,105,208,160, 65,159,164,166,166,150,205,159, 63,127,127,223,190,125,151,223,184,113, 35, 43, 38, 38, 38,
- 46, 52, 52,244,153,230,106, 62,133,168, 14,171, 58,178,195, 37,132,176, 9, 33, 53,230,149, 5,128, 93, 19, 80,176,133,151, 94,
-122, 73,216,179,103,207,184, 9, 19, 38,104,119,237,218, 69,210,210,210, 72,124,124, 60, 89,181,106, 21, 89,180,104, 17,249,242,
-203, 47,201,152, 49, 99, 42,187,117,235,118,101,236,216,177,124, 59,178, 25,232,237,237, 93,122,228,200, 17,178,119,239, 94,194,
-225,112, 98,108,221,176, 49, 47,210,144,153,106,200, 96,213, 93,215,136, 17,107,212,176,217,240,123,191, 55, 85,117, 35, 33,181,
-222,255, 47, 42, 42,170,223,239, 30, 62, 4, 75,166,204,249,132,159,186,107, 45,212,223,125, 14,102,137, 26,236,242, 66,232,207,
-199,192,116,254, 40, 94,238,209, 67, 32,160,168,165,246, 94, 48, 92, 46, 23, 92, 46, 23, 28, 14, 7, 90,173, 22, 57, 57, 57,232,
-221,187, 55,227,250,245,235,252,169, 83,167,206, 22, 8, 4, 25, 0, 70, 53,121, 55, 83,143, 34,210, 23, 47, 94,196,235,175,191,
-206,219,179,103, 79, 71,103,103,231,155, 22,139,133, 11, 0, 73, 73, 73, 24, 55,110, 28,111,223,190,125,193,110,110,110,215,141,
- 70,163,144,199,227,129,201,100, 54,168,199,229,114, 97, 50,153,120,237,219,183,143,191,121,243,102, 80, 84, 84, 20, 59, 61, 61,
- 29, 41, 41, 41, 48,153, 76, 92, 95, 95,223, 91,215,175, 95,239, 56,108,216, 48,118,102,102, 38,210,211,211, 31,231,195,150,252,
- 26, 12, 6,240,120, 60,212,174,210,162, 40, 10,122,189, 30, 92, 46,215,102, 45, 22,139, 53,192,223,223,255,214,205,155, 55, 67,
- 71,142, 28,201,185,118,237, 26,178,178,178, 96,177, 88,184, 1, 1, 1,183,110,222,188,217,105,196,136, 17,156,248,248,120,168,
-213,106,216, 90,133, 86,243,189,155, 55,111, 98,194,132, 9,220,147, 39, 79,118,114,117,117,141, 55,155,205, 92, 0,184,117,235,
- 22,198,141, 27,199, 61,117,234, 84,104,171, 86,173,226,155,168, 74,100, 2,128,201,100,194,212,169, 83, 69, 82,169, 20,153,153,
-153,176, 90,173,176, 88, 44, 0,128,194,226,194, 91, 55,111, 37, 36,189, 60,254,185,126, 58,163, 94,127,233,106,236,157,182,173,
-189, 60, 40,138,180,110, 34,171,163, 68, 34, 81,198,234,213,171,223, 78, 75, 75,227,249,251,251, 51,146,147,147, 81, 94, 94, 14,
- 14,135,243,248, 26,179,117,191,185, 92,110,255,192,192, 64, 86, 85, 85, 21,172, 86, 43, 0, 16, 6,163,254, 22, 43,252,146,243,
- 8, 80,153,217, 2,129,160,255, 95,242,244, 46, 11,116,130, 21,131,210,243, 13, 60,158,131,135, 68,236,234, 11,100,156, 67, 27,
-103, 30,152, 12, 38,255, 90,138, 86, 4,144, 65,240, 44,112,178, 79,211, 58, 40, 69, 99,224,153, 28,131,197,110, 30,158, 40, 44,
- 44, 68,171,182,254,168,226, 58,115, 47, 62,168, 20,131,178, 83,243,255,233,211,190,125,123, 23, 31, 31, 31, 20, 20, 20, 32, 52,
- 52, 20,114,185, 92, 14, 96, 80,179, 31, 58, 95,121,241, 80,134, 94, 0, 99, 53, 44,212, 98,152, 88, 43,240, 32, 63,148,108, 15,
-101,255,157, 76,150, 84,204,189,188,239,219,239,220,157, 60, 3,128,152, 87,161,114,224, 97,231, 27,161,142,206, 50,222,145,102,
-154,173, 32,149, 74,117,230,202,149, 43, 10, 62,159,143,235,215,175, 35, 48, 48, 16,107,215,174,117,150,203,229,231,154, 23,217,
- 34, 32, 84,195, 38,171,111,223,190,152, 57,115, 38,246,236,217, 3, 71, 71, 71, 76,152, 48,161, 41,179, 69,146,128, 31, 63,141,
-143,255,106,207,195,135,199, 94,106,215, 46,106,130,175,239,178,105, 47,188, 48,249,205, 55,223,196,103,159,125,134, 35, 71,142,
-160, 87,175, 94,152, 50,101,138, 41, 35, 35, 99,119,115,171,170, 86,175, 94, 61,107,246,236,217,117, 53,141,233,233,233,159,182,
-168, 92, 42, 44,188, 21, 31, 31,159, 52,126,252,248,126, 85, 85, 85,250,171, 87,175,222,241,246,246,246, 0,208,186,185,154, 45,
- 48, 88, 20, 33,132, 15, 64, 88,189,136, 0, 8,247,237,219, 39, 27, 57,114,164,180, 58, 77, 80,189, 52, 89,189, 31, 24, 24,232,
-113,255,254,253,236,119,222,121, 39,116,207,158, 61, 2,161, 80,136,146,146, 18,124,241,197, 23,248,224,131, 15, 64, 81, 20, 8,
- 33,248,242,203, 47,133,147, 38, 77, 10,123,248,240, 97,182,151,151,151, 45, 77, 90,120, 98,177,248,192,178,101,203,164, 86,171,
- 21,115,231,206, 45, 48, 26,141, 51,171,215,205,119,112,112,184,140, 71,134,187, 49,234,245, 34,181,158,149,199,234, 28,155,168,
-186,105,117,215, 17, 66,162, 26,211,176,243, 92,212,247,123, 49,141,153,173,218, 79,160,254,245,186, 72, 32,196,197,219, 15,165,
- 63, 29,128,128, 69, 65,192,172, 94, 88, 20, 24,201,183,208,138,207,134,137,144,160,230, 26,173,154,133,205,102, 67,171,213,194,
- 98,177,224,131, 15, 62,224,157, 62,125,218,137,193, 96,124,223,148, 78,109,195,116,239,222, 61, 4, 4, 4, 80, 63,254,248,163,
-106,230,204,153,130,154,223, 41, 45, 45,133,143,143, 15,117,226,196, 9,229, 71, 31,125, 36,110,204,204, 80, 20, 5, 14,135,131,
-217,179,103, 11,174, 94,189,234,232,230,230,134,228,228,100, 20, 21, 21, 65, 44, 22, 99,246,236,217,130, 43, 87,174, 56,187,185,
-185, 33, 45, 45, 13,165,165,165, 16,139,197,118, 27, 45, 14,135,243,196, 54, 20, 69,193,104, 52,218,101, 12,100, 50,217,222,184,
-184, 56,103,153, 76,134,248,248,120,152,205,102,200,100, 50,204,154, 53, 75, 16, 23, 23,231,236,224,224,128,164,164, 36, 16, 66,
- 32,149, 74,237,202, 35, 0, 88,173, 86, 36, 37, 37,161,117,235,214, 56,119,238,156,114,218,180,105,252,154,244, 7, 15, 30,192,
-195,195, 3,231,206,157, 83,138, 68,162,189, 13,105, 89,173, 86,228,230,230, 34, 49, 49, 17,201,201,201,200,207,207, 71, 65, 65,
- 1,202,203,203, 97, 54,155, 1, 0,194,242,178,152,125,251,127,188, 41, 16, 8,132,129,190,237, 61,111, 37,220,214, 8, 4, 2,
-161,151,167,167, 47,240, 49,163, 17, 67,248,125,122,122,186,211,164, 73,147, 56,121,121,121, 40, 46, 46, 6,139,197,250,221,181,
-197,229,218,214, 20,200,108, 54, 7,240,249,124,202,104, 52, 62,142,128,113,185, 92,188,189, 87,139,192,133,120, 98,121, 97,189,
- 6,196, 98,130,193, 96, 8,248,211,163, 89, 0, 5,202,208, 30, 20, 21,122, 57,185,210,177, 79,212,120, 14, 82, 78, 2, 86, 19,
-192, 96,161,127,136, 7,235,200,173, 74, 21, 8, 66,160,135, 63, 33, 77,247,252, 34, 0, 5, 24,125, 0,170,203,233,251,102,167,
- 94,163,223,224,100,103,103,131,195,225,128,199,227, 33,116,192,179,172,125, 55, 77, 46,160,208, 17, 70,248,217,162,249, 68,216,
- 81, 32, 88,176,104,209, 34, 81,109,205,201,147, 39,139,100, 50,217,162,102,155,172, 74, 97, 15,152,201,236,196,108,109,235,101,
- 49,121, 1, 15, 53, 58, 63, 16,242, 14, 96,234,244, 20,204, 86,127, 30,143,151, 2,160,119,139, 76,150,132,123,233,219,111,191,
-115,119,108,245,200,100,193, 92, 5,176, 5,112,113,118,192,206,183,195, 29,157, 29, 4,246,154,173, 32,149, 74,245,203,229,203,
-151, 21,124, 62, 31,113,113,113,224,112, 56,224,243,249,232,208,161, 3,182,111,223,238,236,232,232,104,183,217, 34, 32,245,198,
-124, 71,141, 26, 69,250,246,237,139, 25, 51,102, 96,247,238,221, 48, 24, 12, 88,182,108, 25,210,211,211,109,146, 77, 2,126, 92,
- 25, 31,191,107, 69, 98,226,189,121, 65, 65,254,163, 68, 34,199, 25, 19, 38,200, 62,250,232,163, 99, 71,143, 30,253,106,216,176,
- 97, 5, 87,175, 94, 93, 7,224,128,157,135,151, 2,176,121,205,154, 53, 51,106,140,219, 71, 31,125,244,229,209,163, 71, 87, 12,
- 27, 54, 44,247,234,213,171,239, 0,216,220,146,114,201,106,181,198,124,255,253,247, 55, 5, 2,129,208,207,207,207, 51, 33, 33,
- 65, 35, 16, 8,132,158,158,158,190,253,250,245, 99, 52, 71,179, 57, 40,149,202,129,151, 47, 95, 14,196,163, 78, 99,188, 26,163,
-149,144,144,224, 80, 86, 86,230, 32, 22,139, 29, 92, 93, 93, 37, 53,102,107,244,232,209, 14, 44, 22,171,209,235,182,162,162,226,
-232,252,249,243,101,163, 71,143,174,249,140,243,231,207, 99,247,238,221, 16,137, 68, 79,124,119,196,136, 17,120,253,245,215,229,
- 6,131,225,123, 27,178, 59,113,234,212,169,126, 42,149, 10, 11, 22, 44,208,103,103,103, 15, 4,144, 14, 64, 22, 17, 17,241, 73,
- 66, 66, 66,183,176,176,176,253, 0, 58, 55,118,239,213,231, 69,106, 27, 29, 91,210,154,251,125, 91,205, 86,157,164, 6,199,208,
-122,194,104, 69, 69, 69,157, 69, 3, 61,169,140, 69,106,240, 96,129,128, 73, 65,200,172,101,182, 96, 5,171, 84, 3,170, 25,189,
- 84,234,123, 24,114,185, 92, 48,153, 76, 24, 12, 6,216, 58, 81,117,141, 41,144, 74,165, 16,139,197,208,233,116, 48,155,205,224,
-243,249, 53,102, 4, 82,169, 20,108, 54, 27,108, 54, 27,124, 62,255,119,209,164,186,209, 28, 14,135, 3,145, 72,132,220,220, 92,
-164,167,167,195,106,181, 66, 44, 22, 67, 36, 18,129,203,229, 34, 39, 39, 7, 57, 57, 57, 32,132, 64, 36, 18, 65, 36, 18,193,158,
- 6,215, 22,139,165,222,135,191,201,100,178, 43,162,101, 54,155,113,231,206, 29,100,100,100,128,207,231, 63,222, 87, 30,143,135,
- 7, 15, 30, 32, 47, 47, 15, 66,161, 16, 82,169, 20, 50,153,204,102,221,154,125,145, 72, 36, 16, 8, 4, 40, 46, 46,134, 86,171,
-125,124, 76,165, 82, 41, 68, 34, 17, 74, 75, 75,161,209,104, 26,221,119,139,197,130,156,156, 28,228,231,231, 35, 51, 51, 19, 5,
- 5, 5,143, 11,160,234,168, 81,203, 2, 59,101,101, 40, 44, 44,124, 28,137,108,104,177, 5,171,213,138,242,242,114, 92,190,124,
-153,178, 90,173, 40, 41, 41,177,230,231,229, 89,166,231,112,113,228,227,173,228,187,147, 55,170,246, 29,143,211, 29,250, 37, 81,
-183,249,208, 45, 29,191,219, 98, 51,254, 10,182, 4,201, 96, 98, 71, 22, 84,152,120,249, 70,142, 76, 21, 20, 1,164,156, 0, 24,
- 44,128, 47, 71,247,224, 54, 72, 47,182,136,238,170, 13,124, 80, 24,140,205,190,114,155, 52, 45,236, 65,249,229, 38, 94,154,209,
- 89, 26, 16,210, 25,106,181, 26, 60, 30, 15, 60, 30, 15, 93,122, 69, 32,165,208, 34,188,157,173, 19,130, 32,210, 38,205,255,167,
-173, 88, 44,238,209,187,119,111,170,182,230,208,161, 67, 65, 81, 84, 7, 0,254,118, 21,114, 27,219,114, 97, 20,118, 7,139,204,
-190,157,171,117, 59,146, 80,229, 59,124,212,179,142, 27,126,214, 4,220,201,211,123,131,152,230,128, 24, 59,183,192,108,245,147,
- 72, 36,199, 54,109,218,228,205,231,243, 79, 0,232,211, 28, 17,177,128,185,109,193,140,241,238,242, 26,147,101,210, 2, 44, 1,
-192, 22, 0, 44, 1, 92,148, 10, 44,125,125,144,163,144,207, 62,100,135, 97,221,183,121,243,102,231,186, 38,171,102, 9, 13, 13,
-197,194,133, 11,157, 29, 29, 29,247,218,162,183,122,213,103,164,164,180, 20, 32, 64, 89, 89, 5, 86,175,250,172,184,102,221,232,
-209,163, 73,159, 62,125, 48, 99,198, 12,172, 88,177, 2,199,143, 31, 71,247,238,221, 49,101,202, 20,132,133,133, 53, 37, 29, 41,
-147,201,246, 68, 68, 68, 92,206,145, 72, 94,207,237,220,153,251,139, 76, 86, 58,176,180, 84,230,149,144, 96,244, 3,110, 1,216,
-146,149,149,245,140, 29, 38,235, 5,169, 84, 26, 55,112,224, 64,163, 68, 34,201, 88,187,118,237,244,153, 51,103,226,179,207, 62,
-195,252,249,243,191, 0,240, 26,128, 15,179,178,178,220, 26, 51, 89,127, 84,185,244, 71,149,117, 22,139, 37,243,192,129, 3, 97,
- 70,163,209,163,186,122,144, 87, 82, 82, 34, 45, 42, 42,146, 24,141, 70,145,213,106, 21, 57, 56, 56,136, 1, 8, 95,126,249,101,
-214,237,219,183, 3,204,102,115,118, 99,154,121,121,121, 47,206,157, 59,183,160,160,160, 0, 0,208,161, 67, 7,148,148,148,224,
-221,119,223,197, 91,111, 61,234, 16,220,169, 83, 39, 16, 66,160, 86,171,177,122,245,106,117, 94, 94,222, 43, 54,100,183, 93,251,
-246,237,145,144,144,128, 59,119,238,252, 12,192,138, 71,237, 88, 75,111,220,184,113, 51, 63, 63, 31,123,247,238,229,184,187,187,
- 31, 69, 3, 67,188, 52,230, 69,154, 3, 69, 81, 49,205,217,174, 38,114, 85, 95, 68,172, 1, 26,143,104, 69, 69, 69, 81,181, 95,
-159,136, 24, 81,136,207,136, 61, 7,199,160,206, 79, 68,179,132, 76, 10, 2,169, 12, 41,153,233,224,128, 74,124, 90, 70,171,184,
-184, 24,211,167, 79,215,189,248,226,139,133, 86,171,245, 89, 91, 77,129, 76, 38,131, 76, 38,195,237,219,183,201,152, 49, 99,212,
-107,215,174,213,213, 54, 90,247,238,221, 35,145,145,145,154, 69,139, 22, 85, 52,102,180,106, 34, 90, 43, 87,174,212,245,239,223,
- 63, 63, 49, 49,145,212,152, 41,177, 88,140,213,171, 87,235,194,195,195,213,215,174, 93, 35, 53,105,246, 68,180, 24, 12,198, 99,
-163, 85,123, 27, 6,131, 1,171,213,106,151,209,170,172,172,124,113,216,176, 97,234,164,164, 36, 82,179,159, 50,153, 12,107,215,
-174,213, 13, 26, 52, 72,157,152,152, 72,106,210,164, 82,169,205,102,176,230,247, 37, 18, 9,164, 82, 41,110,223,190, 77, 34, 35,
- 35,213, 27, 55,110,172,170,157,126,231,206, 29, 50, 98,196, 8,117,121,121,249,139,141,153,151,154,234, 60,179,217,140,170,170,
- 42, 20, 20, 20, 32, 51, 51,243,113, 56, 93, 39,146, 62, 51,254,249,225, 29,117, 58,157,246,246,189,251, 25, 29,130, 3,149, 58,
-157, 78,155,158,145,113, 15,248,216,218,136,246,179, 65, 65, 65,133,211,167, 79,215, 21, 23, 23,183,216,104,113,185,220, 36, 22,
-139, 69,250,244,233, 67, 12, 6, 3,201,204,204, 52, 21, 20, 23,155,253,151, 47, 39,137,111,191, 77, 9, 98, 99,121, 98,177,152,
-170,214,100, 36, 39, 39, 91, 5, 2, 65,210,159,110,180, 24, 86, 23, 80,164,247,111,247, 43, 28, 6, 13, 31,199,165,242,174, 2,
-198, 10,128, 39, 7,120,114,176, 68, 78, 24,210,167, 19,115,215,229, 50, 23, 16,107, 79,112,120, 30, 77,106,178,137, 10,176,246,
-249,233, 94,149,188,247,216, 89,220,162,162, 34, 48,153,204,199,166, 72, 40, 18, 97,224,168,151, 25, 95, 94,213,187, 0,164, 23,
- 40,166,135, 29,247,250,251, 11, 22, 44,224, 20, 23, 23,131,193, 96,252,191,166, 80,136,105,211,166,241,164, 82,233,124,155, 11,
-191, 3, 1, 28,176,121,221, 1,242,214,221,188, 42,183,163,183,116,126,115, 86,238, 20, 4,117, 10,195,212,254, 74,193,202, 24,
- 77,208,205, 76, 93, 27,192,242, 54,204,134, 46,205, 48, 91,125, 36, 18, 73, 76,108,108,172,112,232,208,161, 88,189,122,181, 72,
- 32, 16,156,104, 78,193, 95, 89, 97,153,185,100,227,215,234,248,117,131, 1, 99,229, 35,131, 85,107,209, 84, 88,177,112,231,153,
- 82,147,137,140,183, 85, 83,167,211, 77,124,237,181,215, 10, 15, 29, 58,244, 59,147,197,231,243,145,154,154,138,101,203,150, 21,
- 21, 21, 21, 53,249, 80, 92,187,102,117, 92,194,205, 95,241,229, 23, 75, 0, 16,108, 90,251, 6, 46,253,246,173, 67,255,126,125,
- 73,235,214,173, 73, 88, 88, 24,166, 79,159,142,165, 75,151,226,238,221,187, 80, 40, 20,120,227,141, 55,208,175, 95, 63,172, 89,
-179,166,177, 66, 42,114,230,204,153,203,178,178,178,252,126,250,233, 39, 86,126,126,190,114,205,142, 29,165, 7, 75, 75,139, 86,
- 36, 36,220,253, 48, 56,184,253,188,144,144, 87, 26, 25,250,161, 94,147, 53, 99,198,140,125, 89, 89, 89,161, 63,255,252, 51, 59,
- 63, 63,223, 99,198,140, 25, 88,181,106, 21,230,207,159,191, 29,192, 84,216,214,225,197,230,114,137,201,100, 62,243,236,179,207,
-118,212,233,116,218,187,119,239,102, 4, 7, 7, 43,117, 58,157, 54, 35, 35,227,222,217,179,103,173,205,209,108, 14,133,133,133,
- 15,247,238,221,123,111,214,106, 89,229, 44, 0, 0, 32, 0, 73, 68, 65, 84,172, 89,161, 89, 89, 89, 1, 0,156,202,203,203, 69,
-229,229,229, 60,131,193, 32,144,203,229,242, 78,157, 58, 41,166, 76,153, 34,190,113,227, 70, 64, 86, 86, 86, 69,117, 20,169, 65,
-140, 70,227,221,226,226,226,168,193,131, 7,151, 20, 23, 23, 35, 36, 36, 4,195,135, 15,135,139,139, 11,220,220,220, 48,114,228,
- 72,248,250,250,162,176,176, 16,227,199,143, 47,202,207,207, 31, 12, 32,217,134,236, 62,204,203,203, 67,207,158, 61,177,100,201,
-146,168,231,158,123, 46,177, 79,159, 62,101,193,193,193, 90, 15, 15, 15,255, 13, 27, 54,192,221,221, 29, 7, 14, 28,112,229,241,
-120,123,235, 49, 89, 13,122, 17, 0,249,213,134,199, 80,231, 53,191,137,117,182,110, 91,239,123, 27,190, 87,215,108,213, 94,126,
- 87,117, 88,255, 9, 1, 22,238, 62,176,171,138,235,233, 3,153, 95, 71, 8,249,124, 8,184, 92, 8,228, 78,208, 91,173,216,145,
-154,167,173, 36,100,190,189, 23, 79,221, 7, 33, 69, 81,248,252,243,207,205, 61,122,244,168, 58,115,230,204, 38,157, 78,231,137,
- 71,163,202,218,108, 10, 54,110,220,168,157, 61,123,246, 77,141, 70,211,145,207,231, 27,106,210, 55,109,218,164,125,249,229,151,
- 19,178,178,178, 66,133, 66,161,182,161,246, 89,181,141, 22,143,199,211,107, 52,154,176,201,147, 39, 39,109,217,178,165, 82, 40,
- 20, 66, 36, 18,129,199,227, 25, 52, 26, 77,199,233,211,167,223, 92,181,106,149, 86, 32, 16, 64, 36, 18,217, 85, 45, 71, 8,249,
-157,161,170,157,110, 43,102,179,249,140, 70,163,233, 56,123,246,236, 27, 27, 54,108,168,172, 49, 64,181,243,184,102,205, 26,173,
- 88, 44,182, 43,162, 85,243, 61,145, 72,132,245,235,215,107,103,205,154,117, 83,163,209,116,228,241,120,134, 90,233,149, 51,103,
-206,188,161,209,104, 58,154,205,230, 51,141,252, 27,179,148,149,149,129,197, 98, 33, 33, 33, 65,207,225,112,192, 96, 48,240,224,
-193,131,199,133,143,163,163, 99, 96,199, 14,193,254, 95,239, 59,112, 86,192,225,241,122,132,117, 9, 72, 78, 75,207, 34,132, 74,
-107, 34,171,135,117, 58,157,231,153, 51,103, 54,245,232,209,163,234,243,207, 63, 55, 55, 20,217,178, 5,189, 94,127,246,250,245,
-235, 38, 62,159, 79,229,230,230,154,153, 76, 38, 44, 22, 11,209,135,133,233, 59,108,216, 64,110,207,155, 71, 73, 69, 34, 22,135,
-195,129, 80, 40,164, 78,158, 60,105,208,106,181,103,255,124,163, 5, 33, 40, 8,238,107,244, 18, 62,195, 76,225,222,225, 71, 38,
-139,239, 0,240,229, 0, 95, 14,119,119, 15, 92, 77,213, 74,192, 0, 23, 22, 27,198, 16, 35, 68, 4, 10,194, 4, 53, 36,108,174,
-128,202,203,203,123,108,136,106, 22,111,159, 0, 92, 79,175, 16,131, 34, 60, 48, 97,207, 16, 36, 81, 78, 78, 78,172,220,220,220,
-223,105, 6, 6, 6, 50, 77, 38,147,237, 67,187,228, 88, 92, 1,235,140,123,121, 85,174, 63,220,172,244,123,123,197,151, 2,129,
-165, 4,136,221,136,160,182,110,120,123,108, 39,238, 71, 71,243,131,174,165,105,219,130, 73,166,194, 90,225,108, 71, 62,123, 75,
- 36,146, 19,215,174, 93, 19, 74, 36, 18, 36, 39, 39, 35, 44, 44, 12,209,209,209, 66,161, 80,120, 28,128, 93,237,241,174,168,145,
- 94, 81,110,233,241,254,129,140,188,248, 92,243, 19, 38, 43,191,146,224,181, 79,143,150, 20,151, 85, 61,123, 57,179,225,251,167,
- 30,110,148,148,148, 68,206,159, 63,191, 48, 63, 63,255, 9,147,149,158,158, 94,243, 80,236, 15,160,201, 63,191,255,251,245, 84,
-232,242,165,179,113, 45, 54, 17, 67,162,222,194,245,248,135,248,112,238, 40, 56, 72, 5, 56,115,230, 12, 70,143, 30,141, 37, 75,
-150,224,193,131, 7,248,238,187,239,168,232,232,104,234,242,229,203,212,167,159,126, 74, 53,209,164, 97,194,138, 21, 43,112,237,
-218, 53, 12, 29, 58, 20,231,206,157, 67, 81, 81, 17,190, 61,113,226,254,222,251,247, 63,172,105,179,213,192,208, 15,245, 34,149,
- 74,231,172, 88,177, 2,177,177,177,143, 53, 11, 11, 11,177, 98,197,138, 44, 0,111,216, 99,178,236, 41,151, 66, 66, 66,252,247,
-237,219,119,150,207,231,243,194,194,194, 2, 82, 83, 83,179, 0,164, 53, 67,179,172, 37, 53, 85, 5, 5, 5, 23,163,163,163, 47,
- 15, 24, 48, 64, 56,113,226, 68,231, 35, 71,142, 56,105,181, 90, 55, 30,143,167, 52, 24, 12,220, 59,119,238, 48, 15, 30, 60,232,
-114,251,246,237,212,170,170,170,171,182, 28, 15,141, 70,115,245,238,221,187,131, 67, 66, 66,238,108,218,180, 41,203,213,213,213,
- 58,101,202, 20,188,246,218,107,112,118,118,182,172, 95,191, 62,163, 79,159, 62, 9, 15, 31, 62,140,208,106,181,183,108,204,235,
- 87,203,151, 47,191,176,111,223, 62, 12, 31, 62, 28,159,126,250, 41,190,253,246, 91,252,250,235,175,130,223,126,251,141, 27, 29,
- 29, 13, 14,135,131,238,221,187, 35, 50, 50,114, 96,117,117,167,173,207,165,107, 20, 69,197, 80, 20,245,115,157,215,107,141,173,
-179, 99,219,134,222, 55,250,189, 58,217,140,174,179,216,206,132,182,248,120, 90,176, 68,123,241,165,238, 36,111, 74,111,162, 30,
- 23, 64,206,247,115, 36,147,219, 81,149, 19,155, 57,188,131, 78,167,123,188, 28, 58,116,136,184,184,184, 84, 74, 36, 18,187,135,
-119,112,113,113, 81,151,149,149,145,174, 93,187, 22, 57, 59, 59, 63, 30,138,192,213,213, 85, 93, 89, 89, 73,186,119,239, 94,164,
- 84, 42, 31, 15,239,224,225,225,145, 73, 8, 33, 94, 94, 94, 57, 13,233,153,205,102,226,226,226, 82,211, 67,143,237,232,232,184,
-181, 91,183,110, 69,106,181,154,184,186,186, 62, 30, 58,193,217,217,121,117, 88, 88, 88,221,244,166,242,155,153,149,149, 69,178,
-178,178, 72,171, 86,173,114,106,167,167,167,167,147,244,244,116,226,225,225, 97,247,240, 14,206,206,206,171,234,201, 75,179,242,
-232,233,233,169,214,233,116,164,103,207,158, 79, 28, 83, 79, 79, 79,117, 85, 85, 85, 77,186, 77,195, 59, 8, 4,130,169,124, 62,
- 63,135,207,231,231,240,120,188,101,173, 91,183,214,236,223,191,159,172, 95,191,190,166, 75, 58,156, 3, 71,244,240,233,249,202,
-135,206,129, 35,231,180,100,120, 7,137, 68,242,139,139,139, 75,229,161, 67,135,158,184,190,116, 58,157,205,195, 59, 8, 4,130,
-172,138,138, 10,171, 90,173, 54, 93,184,112, 65, 27, 27, 27,171, 77, 72, 72,208,166,166,166,234, 10, 53, 26,163, 90,173,214,149,
-150,150,234,111,222,188,169, 23, 10,255,154,225, 29, 72,180,175, 15,217,234,127,244,225, 18,239,219,179,251, 10,171,110, 45,237,
- 72,200,247,163, 9, 57,254, 26, 33,103,222, 39, 87,183, 79, 33, 61,189,121,150, 11,239,182,186, 71,182,249,253, 96,203,144, 12,
- 36,186,131, 15,217,234,127,252,254, 98,239,219, 19,251,184, 85,237,216,178,158, 92,185,114,133, 36, 36, 36,144,228,228,100,114,
-252,240,126,210,179,173,240,145,230, 86,255,163,118, 14,243,208,139,199,227, 85,172, 93,187,150, 92,190,124,249,177,230,209,163,
- 71,137, 80, 40,212, 2,182,245, 90, 38, 0, 69,182, 6,142, 50,111,241,251,237,163, 65,226,242,194, 99,239, 19,114,107, 23, 33,
-209, 65,132,124,213,141,144,253,195, 8,249,241, 21,114,121,253, 88,210,203,155, 99, 34,219,252,206,145,237,129, 54, 55,182,103,
-179,217,101,135, 14, 29, 34, 57, 57, 57,228,220,185,115, 36, 54, 54,150, 36, 37, 37,145,140,140, 12, 18, 19, 19, 67,216,108,118,
- 21,154, 49,109, 89, 55, 21,188, 34,218,115,114,111,174,236, 69,200,145,241, 36,127,239, 4, 18, 21, 44, 41,234,222,170, 69,227,
-209,117,114,114,114, 42,136,137,137, 33,169,169,169,228,236,217,179, 68,169, 84, 22, 0,176,185,189,108,212,144, 62,132, 24,110,
-146,240,190,193, 36, 36, 36,152,244,235,213,158,100, 63,220, 72,194, 58,183, 38, 91,183,110, 37,106,181,154,180,110,221,154,216,
-155,177,136,136,136, 43,132,144,184,161, 67,135,198, 1, 56, 25, 17, 17, 17,151,146,146, 18, 23, 22, 22,118, 25,141, 15,253,208,
- 32, 3, 7, 14, 52, 18, 66,200,208,161, 67, 9,128,156,136,136, 8,146,146,146, 66,194,194,194, 12,205, 57,120,182,148, 75,161,
-161,161, 61, 6, 12, 24,240, 97,104,104,232, 28, 91,134,119,104, 66,243,105, 13, 66,205,196,163,193, 63, 3, 1,116,169, 94, 2,
-170,211,152, 45,208,124,133,205,102,239,112,116,116,252, 85, 46,151,159, 97, 50,153,209, 0, 94, 66,243,198, 55, 99, 84, 71, 24,
- 79, 59, 59, 59, 63, 8, 9, 9,209, 13, 30, 60,152, 12, 25, 50,132,204,152, 49,131, 88,173, 86,178,127,255,126,178,100,201, 18,
-210,206,201,201,188, 30, 40,216, 6, 76, 2,205,163, 1, 75, 39,181,165,206,190,216, 6,229,227,219,160,226,213,118,148, 45, 3,
-150, 70, 52,100,180,172, 86, 43,185,119,239, 30, 9, 15, 15,175, 20,137, 68,217,176,125,192,210, 39, 52, 21, 10, 69,172, 82,169,
-252,221, 32,154,181,210,159, 24,176, 84,169, 84, 94,116,117,117, 85, 59, 59, 59, 95,175, 79, 83,161, 80,196,186,186,186,170, 21,
- 10,197, 19,131,123, 50,153,204,161, 10,133, 34,187,110, 58,139,197, 26,160, 84, 42, 51,235,166, 55,176,239,112,113,113,201,204,
-201,201, 33,249,249,249,196,211,211, 51,167,174, 1,203,203,203,123,194,128,217,162,217, 84, 94, 26,201, 99,189,154, 54, 28,211,
-230,156,247, 26,124,221,221,221, 53,107,214,172, 33, 98,177,248,137, 46,207,126,125, 95, 93,112,229,126, 69,217,107,115,183,238,
-175,103,192, 82, 91, 7, 7, 29, 44, 18,137,178,195,195,195, 43,239,221,187, 71,172, 86, 43,177, 90,173, 13, 25,173,250, 52,159,
-233,210,165, 75, 97, 65, 65,129,165,188,188,220,156,153,153,169, 79, 73, 73,209, 45, 93,186,212,152,159,159, 95, 85, 81, 81, 97,
-136,143,143,215,187,186,186,230, 3,120,198,222,115,212, 76, 34,234, 86,159,145,237, 1,189,200,182,128,152,164, 69, 94,119, 94,
-233, 38,210,199,173, 25, 74,200,153,247,201,229,173,175,145, 30,222,220, 71,134,104,187,255, 9,242,165,111, 95,178,177, 45,215,
- 38,205, 29,237,250,144,237,254, 39,110, 47,244,186, 51,186,179,179, 97,223,174,237,228,193,131, 7,228,232,193,189,164,123,155,
-106,147,181, 45,224, 52,217, 26, 16,110,139,102,125,102,107,231,206,157,228,193,131, 7,228,135, 31,126,176,213,100, 69,212,103,
-180, 62,136, 16,151,188,214,141,175, 31,223,137,107, 24, 25,196, 49, 70,250,112,204, 61,189, 88,150,142,174, 12,107,128, 51, 72,
-164,159, 64, 79,182,249,157, 35,219, 2, 6,219,154, 79, 46,151,155,129, 90, 99,234,212, 93,120, 60, 94,126, 35, 70, 43,162, 73,
-179,229,203,203,253,101,201, 0, 50, 60, 68, 82,104,163,201,106,234, 90,234,164, 80, 40, 10,190,250,234, 43,162, 82,169,242,109,
- 52, 89,143, 53, 71, 68, 69,146,244,135,199,201, 15,251, 87,144,240,190, 1,100,207,206,217,228,202,185, 69,100,216,144,112, 18,
- 17, 17, 65, 10, 10, 10,200,128, 1, 3,136,189,249,148,201,100,123, 42, 42, 42,226, 78,157, 58, 21, 23, 17, 17, 17,183,103,207,
-158,184,243,231,207,199, 9,133,194, 61, 53,193,137,186,102, 43,224,247,229,127, 68,157,136, 86, 92,121,121, 57, 57,117,234, 20,
-137,136,136, 32,123,246,236, 33,231,207,159, 39, 66,161, 48,174,185,247,145,173,229,210,160, 65,131, 22,164,166,166,150, 45, 92,
-184,112,127, 61, 3,150,218,170,249,224, 41,229,243,169,148, 33,127,129,166, 68, 32, 16,196,221,188,121,147, 20, 23, 23,147, 96,
-149,138, 44,103, 50, 73, 22,135, 67,114, 56, 28,178, 21, 40,250, 23,216,164, 41, 13, 85, 29,254,209,212,107,180,170,170,170,200,
-187,239,190,107,224,243,249, 90, 14,135, 99,239, 20, 60,255,232,139, 80,161, 80, 92, 84,169, 84,106,149, 74,245,132,217,171,157,
-174, 80, 40,174,255,203,111, 64, 95, 14,135,147,206,102,179,159,156,130, 39,112, 68,143,118,189, 38,206, 87, 5,141, 24,210,194,
-124,114, 56, 28,206, 7,124, 62, 95,251,238,187,239, 26, 42, 42, 42,236, 49, 90, 0, 48, 72, 40, 20,102,239,222,189, 91,119,255,
-254,125, 83, 81, 81,145,249,202,149, 43,166,216,216, 88,195,199, 31,127, 92, 46, 20, 10,179,209,240,176, 4,127,202,241, 36, 27,
-219,114,107,204,214,173,249, 94, 73,195,131,133,198,232,119, 34, 73,143,214,117, 76, 86,195, 35,185,215,175, 89,109,182,110,124,
-228,153, 20,238, 43, 54,175,152,255, 54,233,222, 70,240,164,201,178, 67,179,174,217, 18, 10,133,229,139, 22, 45,178, 39,146,245,
-164, 33,220,225,231, 73,182,251,239,121,100,162,154, 88,182,250,125, 65, 62,247,243,252,187,220, 71,221, 84,240, 26,232,203, 75,
-180, 35,146,101, 75, 62, 59,201,229,242, 59,118, 68,178, 30,107,126,254,249, 38, 50, 97,220, 32,242,240,206, 33, 82, 81,120,156,
- 92,191,180,150,140, 25, 17, 74,186,119, 15, 35,219,183,111, 39,119,239,222, 37, 93,187,118, 37,205,200,103,228,180,105,211,226,
- 82, 82, 82,226,146,147,147,227,206,159, 63, 31, 55,106,212,168, 56, 0,145,181,107,130,106,204,150,113,204, 24,125, 39, 6,227,
-237, 38, 52, 95,152, 54,109, 26, 73, 73, 73, 33,201,201,201,228,252,249,243,100,212,168, 81, 4,246, 77,223,211,172,114, 41, 52,
- 52,180, 71,120,120,248,252,206,157, 59, 15,121, 90,154,255, 65,163, 37, 26, 61,122,180,213, 98,177,144, 33, 67,134, 88, 54, 0,
- 37,209, 20,165,142,166, 40,245,118, 32,255,223, 30,209,250,163, 39,252,140, 0,240,115,237, 4, 62,159,175,174,170,170,114, 22,
-139,197,135, 43, 42, 42,102,225, 81,183,200, 22,105,254, 17,249,164, 53,255, 21,154,174, 98,177,120, 83, 69, 69,197, 40, 62,159,
-159, 95, 85, 85,165,178, 67,211,129,199,227,189,205,231,243,195,181, 90,173, 47, 0,136, 68,162,123,122,189,254, 87,157, 78,183,
- 14, 64,201, 95,189,239,100, 99, 91, 46,184,220, 46, 32,152, 23,151, 81,217,102,197,169, 34,175,119, 6,200, 51,122,182, 19,165,
-130,109,253, 20,148,254, 42, 53, 41, 93,111,183,166,128, 10,131,133, 61,239,106,154,182,245,167, 63,149,123,205, 9, 23,103,244,
-108, 43,206, 0,193,167,224,105, 47,217,171, 89,215,108,137, 68,162,221,149,149,149,175, 3,248,213,222,125, 39, 7, 2, 56,168,
- 52,185,195,196, 12, 6,105,100, 10, 31, 66,180, 96, 48, 19,144, 7, 53,245,241, 29, 35,125, 31,213,175,185,101,203,102,242,243,
- 79,199,161,215, 22, 33, 87, 83,134, 9, 47,189,138, 78,157, 66,161, 80, 40,176,124,249,114,248,248,248, 96,201,146, 37, 84, 51,
-242, 25, 41, 22,139, 39,248,251,251,183,189,125,251,118,178, 86,171,253, 6,192,233,186,207, 31,127, 32, 92,200, 98,117,212,153,
-205,231,238, 0,177, 77,104,190, 32, 22,139,231,248,251,251, 7,221,190,125, 59, 81,171,213,174, 1,240, 45, 93,214,253, 51, 52,
- 25, 12,198, 58, 47, 47,175, 49,169,169,169,243, 0,236,195,127,136, 63,221,104,209,154,180,230, 63, 80,179,230, 62, 33,127,183,
-124,254,191,217,178,206, 2,133, 54, 32, 84, 22, 56,214,245, 77,152,172,166, 53, 5, 84, 24,204,172,183, 64,161, 21, 8,242, 64,
- 24,235,154, 48, 89,127,174,201, 4, 40,124,220, 72,249,245, 49, 8,213,240,249,162,175,249,122, 88,176, 96, 1, 57,121,242, 36,
-132, 66, 33,116, 58, 29, 6, 15, 30,140, 79, 62,249,132,162,203, 16, 90,243, 79,212,252, 87,194,162, 15, 1, 13, 77,147,144,191,
-107,198,168, 55,147, 13,228, 64,192, 53, 20, 48,223, 5, 3,109, 0,115, 58, 42,205,121,212,155,233,134, 22,106, 94, 65, 1, 53,
- 27, 76,248,130,107,126,136, 10, 67, 30,245, 70,243, 53,255,128,127,136, 4, 31,255,125,207,203, 63,145,186,166, 42, 54, 54,150,
- 62, 40, 52, 52,182, 51, 5, 79,246, 52,124,252,153, 54, 90, 52, 52,255,112,168,231,238, 24, 1,100, 85, 47,127, 91, 77, 26, 26,
- 26,154,255,160,225, 2,133,134, 27,180,217, 19, 18,108, 78, 67,187,159,105,205,102,105, 50, 1,200, 0, 56,224,209, 24, 36, 53,
- 93,122,155, 26,102, 99, 8, 0, 19,125, 60,105, 77, 90,147,214,164, 53,105,205,191, 88,179, 41,237,127, 98,149,100,125,189, 12,
-163,255,140, 31,142,160, 53,159, 42,131,255, 53,251, 78,208, 17, 4,235,171,151,142,244,121,167, 53,105, 77, 90,147,214,252,207,
-107,254, 43,161,171, 14,255, 89,240,255,177, 57, 39,196, 21, 64,205, 32,151, 9,168,162,252,193,199,108, 0, 64, 57,174, 19,130,
-251, 0,130,171,215,103, 82,148,221,189, 81,105,104,104,104,104,104,254, 42, 66, 1, 92, 7,224, 10, 96, 24,128, 24, 84,143,170,
-240,151, 26, 45,129, 83,123, 87,176, 24, 33,148,149,248, 3, 0, 97, 80, 73, 48, 91,227,117,133,247, 91,252,144, 21,187,249, 58,
- 18,112, 15, 80, 48, 60, 87,145,115,175,197,131,161, 5,251, 74,199,168, 20,146, 9,121,133,165,187, 19,239, 86, 28,177,103, 91,
-153,204, 75,198,119,148,143,213, 27, 77,193, 92, 14, 39,195, 88, 82, 22, 93, 92,156, 92,222,140,108, 56, 54,182,242,227,143, 9,
-117, 44,247, 58,197, 17, 26, 25, 78, 82, 14, 85,129, 10, 82,145, 43,182,122,151,164,146,131, 7,159, 35,246,158, 27,138,129,254,
- 34,137,164, 51,143, 47, 12, 19, 74,228,237,173, 4, 40, 82,103,167, 25, 76,230,243, 22,131, 54,142, 88,241, 63, 59,206,213,203,
- 0, 86, 0, 0, 6, 12,248, 25,193,144, 98, 93, 77,198,241,198,128, 91,120,249,204, 25,212, 12, 46,251, 1,128,149,118,100,215,
- 1,128, 23,128,210,224,224, 96,109, 66, 66, 66,254,211,186, 70, 91,114,222, 27,131,199,227, 11, 76, 38,163,209, 98,177,180,120,
- 98,106,158, 80,186,232,119,211, 43, 81, 12, 84, 85, 20, 47,166,203, 62, 26, 26, 26,154, 63,213,104, 13,195,163, 42,195,166, 27,
-195,123, 5,246,190,198,231, 11,188, 1,192, 74, 8,172, 4,168, 44, 43,137,203, 75,142, 29, 12, 0,138,214,161,167,216,124,105,
-103, 43,121,180,222, 98, 5,204,198,170,212,178,244, 43, 93,109,201,145,200,217,119,244,128,136,129, 99,162,162,134,249,117, 8,
-238,208, 14, 0,110, 37,220,122,120,236, 88,204,221, 51, 63, 83,135, 42,243,239,253,208,162, 0, 10,248,159,116,233,210,169,119,
-108,236,245, 37, 0,102,180,244, 8, 58, 57,137,103,157,254,254,221,190, 3,199,172, 22, 1,246, 61,112,249,142,242,177, 35,135,
- 63,211,233,189, 55,167, 49, 94,123,119,185,247,181, 11,255,251, 76,236, 26, 84, 66,172,166,211,149,234,113,191, 53, 54,113,114,
- 93,255,216,144,193,250,166,232, 36, 99,253, 87, 61,228,186,162,135,227,136,213, 50,142,162, 40, 48,185,194,131,206,109,123,239,
-119,232,255, 78, 49, 0,155,123,140, 73, 93, 3, 35,148,174, 30,135,198,189,250, 54, 95, 40, 83,177,192,228, 0,160,144,147,118,
- 7,103,190, 93, 33,127,107,241,206,208, 11,241,233,230, 95,190,223, 92, 69,113,216, 99,180,185,183,155,174, 79, 79, 79,119,128,
-151,215,163,247, 95,124,177, 0,222,109,110,225, 81, 91, 51, 96, 45, 74,191,206, 65, 48,240,200,104,165,165, 65,110,107, 94, 7,
- 15,125,126, 80, 70,250,253, 37, 57,217, 25, 71, 24, 44,150,181,184,180,242, 29, 39, 39,101, 69, 97,161, 38, 28,213, 13,185, 21,
- 10,133,168,160,160,192, 8,192,248,103,158,247,177,147, 62,249,226,224, 87, 11, 94,175,111,221,244,183, 62, 89,231,229,225, 32,
-122,115,198,228,122, 39,228,238,247,204,228,247,206,158,220,185,170, 73, 67, 44,146, 44,122,246,245,249, 31,247, 31, 16,249, 68,
-250,149, 75,231,177,247,243, 5,168, 44,167,205, 22, 13, 13, 13,205,159, 64, 76,181,185,138,169,187,162, 65,163,197,231, 11,188,
- 47,255,239,152,227, 15,231, 51, 1, 0, 17,161, 46,248,112,233,166,200, 61, 27, 99,239, 2, 64,143, 1, 81,190, 75, 62,120, 19,
- 23, 19, 53, 32,132,160,147,143, 19,134,140,124,206, 54,227,161, 10,232, 58,118,236,179, 47,190,251,238,156, 17, 15, 30, 60, 72,
-219,183,111,223,111, 0,208,167,111, 95,159,229,203,151, 63,191, 90,238,200,251,238,224,247,217, 85,234, 59,215,154,179,183,124,
-183,182,238,126,237,219, 76,248,238,203, 77,140,254,131,159, 29,159,134,202, 21, 85, 57,201,217,182,108,171, 80, 40,102,179,217,
-108, 25,240,104, 54,246, 26,140, 70,226, 2, 0,102,139, 85, 34,119,243, 43,103,114,248, 22, 30,143,115,187,188,162, 98,119, 89,
-246,157, 29,141,105,234, 77,166,160,183,222,152,196,184,145, 92, 8,239,160, 62,204,245, 43, 62,130,213, 98,146,191,253,193,210,
-177,177, 87,190, 67,165, 26,103,109,220, 53,118,221, 4,119,247,238,204, 79, 86,136, 7, 81, 20, 94,241,234,241,234,168, 37,187,
- 14,178,187,248, 72,161, 55, 89,113, 34,174,176,199,214,117,159,172,186,176,117,216,143, 0,182, 3,248, 5, 64,147,166,206,209,
-201,241,155,217,243,215,137, 43, 13,255, 31, 37,169, 54, 89,248, 98,247, 1,220,204,180,194,223,207,159,229, 50,251, 51,241,246,
-165, 83,118,105, 31,205,179, 85,159,221,109, 11,160, 23,144,228,136,169,139, 7,226,235,149,203,160, 84, 86, 66, 34,201, 0, 5,
- 21,128,246,213, 95,188,207, 45, 64, 38,128, 15, 52, 26,136,150, 76,195,224, 27,192,220,142,128, 6,192, 5,170,177, 89,227,137,
-121,197, 91,243, 86, 5, 59,183, 9, 14, 75,184,155,141,203, 49,155,145,159,151,238, 80, 92, 92,176,187,149, 79, 71, 34,146, 57,
-135,150,228,165, 64,234,128, 20,138, 88, 70,150,150, 22,231, 1,176, 41,138,228,226,226,178,200,221,179, 91,223,154,243,238,232,
-213,169,184,102, 29,131,201,250,166, 32,229,218,155,141,109,239,229, 63,124,242,138,205,125,194,147,110,158, 58,144,145, 28,119,
-222,108, 50,234,219,251,133,116,153,244,202,248,231,147,178, 21, 29,243, 75,244,184,121, 43,177,211,202,149,159,174, 76, 76,184,
-117, 75, 34,113,144,183,241,237,216,205, 63,100,232,248, 34,131, 99, 91, 91,140,150,217,108,129,147, 75, 91,176,249, 18,120,168,
-100, 40, 41,215,163, 82,111,134,194,165, 13,204,102, 51, 93,244,209,208,208,208,252, 57,228,226,201,198,239,209, 77, 26, 45, 0,
- 16, 11, 88,184,155,146, 7, 0,112, 16, 0,179,166, 78, 68, 97, 65,190,175,193,108,197,171, 19, 95,194,245,164, 92,220, 77,205,
- 7, 33, 4,190, 30, 54, 79,194, 13, 38,172, 93, 94,157,252,106,191, 83,167, 79, 95, 93, 48,127,193,215, 20,133, 75, 0,176, 61,
-250,139, 30, 11, 23, 45,124,253,165,137, 47, 13, 58,120,240, 96, 34,128,102, 25, 45, 22, 37,217,180,106,229, 50,110, 86, 65, 85,
-213,236,119,231, 89,231,188, 51,123, 61,128,103,109,114, 50,108,182, 44, 43, 43, 75,204, 96, 60, 57,151,230,167,203,230,157, 27,
- 52,102,245,253,180,140,146, 27,167,142, 30,237, 26, 24, 24,136,172,236,188, 94,159,109,216,214,241,196, 41,193,164,242, 50,221,
- 24,109,193,157,122, 39,109,230,177,217,137,139, 63,219,218,201,234,224,195,248,240,245,161, 8,106,231,134,108, 77, 9,250, 14,
- 30,193,138,187,118, 45, 18,176,217,104,213, 29, 60,112,172,193,170,233,184,124,247,149,129,163,122,186,117, 97, 48,152,168,208,
-153,144, 95,170,135,197, 10,244, 9,144,225,153, 61, 27, 88, 69,149,166,209, 75,191,207, 28,125,105, 99,148,186,170, 52,103, 38,
-128, 67, 77,196, 3, 29, 61,148, 82,220,205, 44,175,215,100, 85, 86, 61,122,128,115,152, 22, 80, 32, 78,141, 8,245, 2,240, 21,
-224, 15,252, 52,243, 69,168, 84,251, 84, 42,213, 88,165,202, 37,206,247,197, 73,148,187,119,128,164, 66,103,196,237,196, 91,229,
-129,157, 19, 72,121,145,230,237,170,202,226,131,119,128, 4,127, 96,127,181,198, 36, 52, 98,180,238,223,191, 83, 50,233,133,112,
-214,141,135,229, 72, 22,137, 16,212,115, 20, 74,243,179,216,207, 76, 90,220, 77, 87, 94,202,119, 82,121,225,206,197, 3,200,207,
-120,208,169,202,160,255,193,209,179, 71,248,143, 95,205, 53, 52, 21,221,114,113,113, 89, 52,117,234,212,143,243,115,147, 62, 25,
- 52,102,117, 72, 90, 70,201,141, 23, 23,255,218,117,250,104, 31,156,136, 47,195,178,201,225, 19, 0, 52,106,180,152, 44, 98,225,
-139, 93,188,199,188, 48,115,158,155, 51,127,158, 80,192,128,131,136,139,211, 87, 52,248,238,116, 38, 76,102,130,238, 33,237,125,
-103,189,183,110,151,171, 19, 23,185, 5, 6,100,231, 87, 65, 93, 80,133,138, 66,173,222,166, 11,130,162,160,201, 47, 68,204,143,
- 49,160,216,124, 80, 12, 10, 38,163, 17, 44, 6, 3, 20,131,162,139, 62, 26, 26, 26,154, 63,135, 6,123, 29,178, 0,224,216,177,
- 99, 36, 42, 42,234,119,165,178,197, 66,112, 55,245, 81, 19, 28, 38,147,137, 97,189,125,176,254,179,197,208, 25,204,184,153, 82,
-138, 31, 46,102,194, 80, 89, 2, 66, 8, 10,130,148,245,253,240, 19, 85, 74,171, 87, 8, 66,153, 60,246,184, 11, 87, 68,173, 29,
-229,114,249,253,196,175, 43, 23,190,163, 14, 96, 17, 99,220,210, 79,125, 82, 56,142,172,158, 7, 14,236, 15, 28, 30, 21,197, 21,
-139, 37,239, 19, 86, 71, 15,118, 37,153, 83, 90, 26, 95,218,144,102, 93, 4, 74,255, 17, 35,134, 61, 51,192,197, 69,101,125,113,
-249,149,164, 77, 51, 67, 61,219,251,180,239,117,215,164, 27,161,211,220, 63,218,192,102,143, 53,173, 86, 43, 24, 12, 6,212,106,
- 53, 44, 22, 11,244,122, 61, 76, 38, 19, 50, 51,211,212, 86, 66, 60, 44,176, 50, 92, 93, 61,192, 98,113,225,221,218, 11, 91,215,
-175, 16,238,249,238,104,216,220, 5,159, 28,209, 22,160, 59,254,127,112,203,199,154, 85, 69,197, 7,143,159, 60,237, 76,112,198,
-237,195,215,135, 50, 53,197, 21, 56,115,237, 1,174,223,206,180,247, 68,214, 29,194,161,117,118,250,131,178,213,171, 87, 51,151,
-156,120,144, 57, 96,200,179, 22,175,118, 33,173,245, 22, 2,128, 2,143,195, 2,135,197,128,151, 51, 31,135,231, 5,227,202,200,
-120, 85,100,168,243, 58, 66,200,161,198,142,167, 94,111,178,244,246, 23, 49, 59,182,149, 33,254, 97, 49,174,158,184,132,217,243,
-215, 33, 54, 69,143,242, 10, 45, 40,139, 30, 76,162, 71, 65,122, 50,204, 22, 11,105,234,188, 63, 34,180, 24, 0,120, 60,222, 7,
- 63,252,120,210, 77,111,229, 35,175, 68, 15,117,177, 30, 62,221,199,136,210,179,243,241,213,226,231, 63, 0,112,208, 31, 40,183,
- 65,147, 7, 32, 60, 45,229,158,201, 96,176, 88,171,140, 22, 70,144,167, 12, 59,126,186,134,224,240, 23,170,184, 76,166, 64, 34,
- 83, 0, 4, 8,234,251, 2,174, 30,249, 28, 98, 6,179,179, 64,202,235, 8,224,106, 99,215, 82,141,201, 90,180,104, 17,102, 76,
-125, 30, 86, 66,216, 22, 88, 25, 0,176,229,135, 7,240,242, 86, 54,118,142,254,127,186, 24, 11,131, 50, 26, 9,202, 43, 76,200,
- 47, 49, 64,194,103,225, 94, 70, 37, 30,164, 87,224,249,193,238, 24, 51,208, 21, 22, 43,193, 75,239, 95,199,179,145,174,120, 49,
-202, 3,160, 40, 20, 20, 27,160, 55, 88, 26,220,119, 6,131,209,134,201,100,134, 90, 44,150,235,143, 62, 51, 97, 1, 80, 86, 92,
- 0,189, 94, 15, 38,147, 9,185,163, 51, 0,234,137,239, 90,173,214, 20, 91,239,163,102, 66,107,210,154,180, 38,173,217,108, 26,
-242, 34,255, 16, 26, 28,202,129,209,216, 86, 15, 51,139,112, 55, 37, 15,157,253,221,209,174,181, 43,174,222, 43,198, 55,103, 50,
-177,243, 84, 58,206,220,204,135,149, 37, 65, 94, 25,112, 63, 77,141,251,233, 5, 77,142,159,205,228,177,199,189,245, 86,233,187,
- 29, 2,203,186,255,239,196, 44,184, 59,223, 15,156, 59,183,100, 22,147,199, 30, 39,111, 37,217, 55,239,221,183, 39, 72,132, 66,
-174, 65,111, 64,219, 54, 94,252, 55,103,206,154, 68,201,121, 54,207,137, 36,113, 15,144,243, 4,130, 29, 75, 63,126,159,183,238,
-135,251, 25,149, 6, 84, 30,186,164, 78,158, 51,111, 97, 17,139,205,223, 42,113, 15,176,185,237,143,201,100,130, 94,175,135,193,
- 96,128,209,104, 68,118,230,157, 17,191,252,240,222,224, 54,173, 28, 7,243,248,124, 16, 0,101, 58, 51, 82,114,181, 8, 31, 56,
-136,217, 57, 52, 52, 72,236, 26, 48,185, 62,173,210,210,244, 82, 43, 97, 74,142, 29,222,203,220,255,211, 13,124,125,236, 26,142,
-252,122, 3, 87,207,158, 48, 19,171,233,241,252, 95, 98, 87, 31, 95,177,107,135,116,177, 91,136,250,241,226, 30,220,232,240,204,
- 76, 38,131,132, 15,140,248,121,234,140, 55,255,167, 45, 47,212,236,216,180, 56, 59, 63, 39,237, 14,143, 67,153,133, 60, 38, 42,
-170,204,216,245, 75, 14,198,174,184,137,219, 25, 21, 32,132, 52, 57,129,183, 21,120,103,220,228,247, 44, 38,163, 17,126,158, 98,
-236,141, 94,137, 17,225, 29, 49,160,131, 28, 93,219,137, 32,100,233,145,152,116, 23,223,238,221,101,182, 90, 25,115,154,184, 17,
-159,169, 94,226, 0,160,162,162,226,189,185,239,207,201, 55,152,173, 48,154,172, 48, 86,191,254,242,237,167,249,150, 42,237,123,
-213,219,197,213,218,174,161,155,121,227,107,211,231,134,239,248,230,231,255, 99,239,187,195,163,170,214,238,215, 41,211, 75,122,
- 38, 9, 33, 9, 36, 64, 66,239, 16, 80, 64,122, 64,186, 32, 69, 64, 65,154, 10,138,162,130,162,130,212, 75,175, 42, 40,136,244,
-222, 59,132,170, 32, 29, 18, 32,129,144,222, 39,109,122, 59,237,247,199, 36, 16, 32,101, 2,222,251,221,223,247,101, 61,207, 60,
-147, 57,156,243,178,219,217,123,237,245,190,123,239,238,251, 46,102,145, 57,249, 14, 68,159,216,131,128,160, 48,136, 41, 82, 14,
- 2, 0, 65, 0, 4, 1, 65, 16,224, 27,210, 0, 86,158,199,222, 95,190, 13, 68, 5,241,106, 37, 36,107,252,248,241,120,240,224,
-193,115,245,158,240, 56, 9, 9,143,147,112,230,228, 85, 0,128, 87, 72,243, 66,175,144,230,133, 62,161,173,215,149,101,203,206,
- 49,188,133,229,144, 93,100,133, 66, 70, 34, 56, 80,129,129, 93, 2,176,250,155,166, 24,209, 59, 16,233, 57,102,140,159,115, 7,
-126,126, 34, 28,184,152,133, 85,219, 19, 80, 47, 68,137, 1, 93,106,224,253,190, 53,203, 86,107,105,186,151, 72, 36, 26, 62, 96,
-192,192,217, 82,153,114,193, 39,115,182,206,146, 75,233, 18, 53, 22, 20, 69,129, 97, 24,144, 36,129,161,159,174,158, 37, 85,168,
- 23, 12, 24, 48,112,182, 72, 36, 26, 78,211,116,175,234, 73,103, 53,170, 81,141,106,252,219, 20,173,146, 79,192,115,253,118,121,
- 79, 88,173,150,164,119,134,142, 68,128,198, 95,213,255,173,247,197, 55, 19,138,160,205, 74,193,227,248, 24,152,173, 12,196,158,
-161,128,204, 31,181,106,135,224,110,220, 65,199,170,197, 71,141, 60,107, 75, 42,207, 94,191,126, 1, 53, 31, 63, 36,200,197,139,
-130,175,198,199, 21,182,220, 54,243,119,140, 24,161,242, 89,188, 40,248,106,242, 19, 37,169,144, 9,237, 63, 24, 61,156, 32, 9,
- 1, 95,127, 61, 13,253,251, 68, 97,204, 7,163,136, 63,254,216, 20, 89,228, 98, 46,121,136,214,204,248,118,182, 36,167,136,181,
- 95,139, 55,218, 20, 74,185,252,207, 71, 70, 83,163,218,193,242,222,131,222,207, 60,186,251,183,229, 0, 70,187, 98,171,132, 96,
- 49, 12, 3,135,195, 1, 0,156, 83, 61,112,126,231, 27,236,200, 45,178, 33,167,200, 6,150,227, 49,104,232,104,249,245, 27,119,
- 70, 3, 40, 39, 94,139,231, 25,150,193,190,211,183,144,113,125, 15, 79,144,148,174, 84, 48, 60, 84, 1,117,195,253,253,131, 47,
-246, 25, 52,202, 87, 34,115,186, 97, 13, 38, 27,254,248,101, 81,133,233, 36, 9, 66,224, 57,182,136,101, 24, 83, 88,104, 88, 70,
-253,134,205,100,151,207,159,236,247,231,153,125, 70, 54,108,148, 71, 66,114, 22, 40,145, 20,148, 88, 6,155,195,181,133,135, 57,
-143,175,174, 5, 64,140,253,104,218,138,169, 95,126, 67,125,190,234, 18,236, 86, 51,108, 22, 19,244,186, 66,200,105, 6,177,127,
- 29, 98, 5,142,153,106,202,186,189,182,124, 75, 68, 38,128,204,210, 87, 10, 10, 10,162,255,186,116,241,240,223,127, 93, 26,227,
- 31,214,146,180, 51, 60, 30,199,252,205,103, 60,186,113,216,102,211, 71, 3, 0, 1,228, 3, 56, 89,145,112,169,118,243,112, 31,
-243,241,151, 99, 61,228, 74, 50, 38,189, 8, 41, 89,122,112,242, 64,248,215,172,243,204,191,202, 59,243,219, 38,194, 23, 61,154,
-189,139,203,247, 82,185,147,187,214,118, 7,112, 8,128,185, 34,146,117,243,230, 77,136,197,226,231,234,189, 78,221,218, 40,113,
- 29, 22, 21, 76,246,216,180,248,125, 0, 64,151, 55, 59,142, 7, 48,225,165,137, 74,182, 30,222,118, 22,109, 27,120, 33, 34, 84,
-133,140,124, 59, 4,130,198,238,179,121,120,148,110,194,233,107, 90, 4,120, 73,192,219, 73, 80, 82, 96,223,229, 12, 92,142,205,
-195,200, 94, 65,120,152, 88, 80, 14,177,166, 90,124,254,197,180, 31, 87,174, 92,117,238,157,143, 22, 15,238,208, 34, 12,122,131,
- 17, 25, 5, 12,140, 38, 3, 76, 70, 19,228, 10, 5,164, 18, 9, 40,154, 70,175, 15,230, 13, 62,246,251,183,231, 63,255, 98,218,
-143,203,150, 46,249,158,101,217,227,213,253, 97, 53,170, 81,141,106,252, 91, 21,173,241,165,175,149, 75,180, 82,238, 95,110, 13,
- 0,225,173,122,228,171,100,180, 23, 77, 18,200, 73, 79,192, 31, 75, 62, 5,207, 11,232, 61,110, 49,212,181,253, 33, 23, 83,176,
- 25,243,141, 5, 9, 23, 42,138,213, 1, 65, 48,221,215,174,203,168,253,209,164, 48,183,109,219,140, 34, 0,216,182,205, 40,154,
- 52, 49,200,237,167,117, 73,181,219,190,217, 18, 2,199,161, 79,255,119, 48,116,216, 80, 36,103,155,177,247, 98, 42, 76, 22,187,
- 75,171,229,228, 62,245,155,249,120,251, 70,125,246,126,148,146,166, 8,162, 94,136, 59,149,166,101, 88,138, 18,113,135,175,235,
- 50, 7, 13, 26,230, 19,125,108, 87, 23,206,167,126, 51, 75,222,195, 59,149,217,179,217,108,207,185, 14,189,124, 66,143,117,127,
-103, 73,122, 86,182,225,104,118,161,181,173,137, 97,145, 83,100, 67,110,145, 13, 69, 38, 7,252,213,158, 96, 25,123,147,242,236,
- 9,130,176,121,192, 59, 35, 71, 1, 32, 9,146,253,221,152,245, 48,222,249, 47,207, 72, 86, 84,255, 17,190, 23,111, 38,224,241,
-141,227,133, 2,207, 58,119,113, 39,248,244,138,203, 21, 2, 69,128, 23,211, 4, 67,145, 36,239,112, 24, 25,141,198, 55,250, 66,
-244,137,190, 86,246, 9, 40,177,244,233,189,150,231,221, 81,149,145,173, 53, 0,176,114,213,138,165,237,187,143, 16, 95,184,149,
- 4, 11, 3,180,107, 17,142, 3, 59,127,181, 9, 2,243,165, 41,235,246,154, 42, 52, 66,143,160,160,160, 79, 69, 18, 73, 23,185,
- 66, 29,228, 27, 16, 76, 58, 88, 14, 14,134,131,210, 59,144,148,170,188,186,243,164,248, 50,235,176, 71, 59, 76,218,149, 0,202,
-229,215,167,175,222,239,242,203,202,165,131, 3,188,149, 8,242, 17,227,240,133, 66,142,161,121, 82, 19, 18, 65, 0, 64,176,198,
- 13,247,111,157,199,221,187,247,208,164, 93, 20,188,213, 53,161, 18,115, 66,222,227, 63, 11,252,252, 3,155,231,100,103,136, 95,
- 36, 90,254,254,254, 63,140, 28, 57,114, 86, 64, 64, 0, 86,172, 88,241,244,122,233,122,111, 12,180, 45,237, 58,252,105,255,227,
- 10, 51,252, 65,159, 90,120,179,153, 6, 60, 15, 76, 89,126, 23, 49, 9,122,172,159,209, 2,131, 58, 7, 98,221,193, 36, 52,173,
-167,132,209,194,195, 97,231, 32,150,144,104, 16,170,130, 84, 76,225,220,173, 60, 24, 76,166, 10,109, 19,148, 20,221, 59,183, 67,
- 94,145, 25,190,238, 18,132, 6,249, 66,165, 8,133,193,194, 34, 37, 91, 7,157,137, 65, 94,161, 9,111,180,107,131, 83, 91, 36,
-213, 93, 96, 53,170, 81,141,106,252,103, 84, 45,160,212, 30, 90,207, 17,173, 35, 71,142, 8, 0, 80,150,127, 52, 35,167, 0,222,
- 42, 26,190, 53,106,227,189, 79,151, 98,243,242,207,193,113, 12, 4, 1, 96, 57,215,118, 38, 16, 4,209,233,143, 39,213,174, 95,
-171, 54,229,251,222, 8,133,101,235, 54,179,252,189, 17, 10, 75,227, 38,222,186,143, 39,213, 78, 50, 88,131,223, 96, 57, 14,127,
-198,230, 34, 38, 73,135,152,100, 61, 84,114,215,183,249,162, 36,226, 73,139, 22, 46, 16,211, 20, 65,196,166, 24,141,233,249,172,
-145, 18,137, 28, 10,185, 68,176, 11,180, 45, 57, 79,200,239, 58,224, 3,203,225, 45, 43,199, 2,248,164, 92, 85,172,120,165, 97,
-137,146, 85,242, 45, 8,130, 64, 0, 60, 79,112, 92,122,158, 21, 70, 7,131,156,194,103, 68,139, 96,203,247,156,170, 2,234,134,
-187,169, 85, 39, 40,138,146, 10, 2,192, 56,216,119, 17, 80,183,167, 49,235,113,124,105,146,117, 53, 54, 19, 9,183,207,228,112,
- 14,243, 72,115,110,220, 89, 87,243, 78, 16, 16, 40, 10, 60, 69, 18, 60, 65,128, 23,145,130, 29,130,192,191,152, 34,115, 21,136,
- 86, 9,217,146,136,168,153,167,118, 44,215,140,121,187, 1,118, 94,116,114, 62,171, 65,171, 55,101, 84,137,100,193,219,219,123,
-244, 87, 95,125,245, 67,191,119, 70, 64,103, 37,144, 83,232, 84, 3,237, 12, 15,177,210, 7,221, 63,222, 24,148,165,213, 7, 61,
-190,118,248,141,188,219,219,116,140, 85,183,162,220,116, 37,100, 94,179,152,139,252,161,230, 0, 0, 32, 0, 73, 68, 65, 84, 77,
-208, 91,156,249,153, 54, 58,130,250,110,237,105,176, 2, 13, 47,223, 64,248,186,137,241,254,187,189,112, 49,164, 22, 30, 60,124,
-136,153,179,143,194,207,195, 45,230,202,249, 67,117, 90, 68,118, 88,118,108,255,246,151, 72, 92,118,118,246,236, 45, 91,182,160,
- 89,179,102,179, 90,182,108,137,236,236,236, 18,130,252,180,222, 19, 30, 59, 5,219, 18,162,117,235,214, 93,180,104,209,180,220,
- 60, 55,169,227,134, 61,231, 50,177,241, 72, 50,228, 82, 10,181, 3,101,152,180,232, 54, 58, 55,247,193,228, 33,161, 80,201, 67,
- 80,100, 96, 96,103,120, 88,108, 44,242,245, 14,100,228, 91,145,150, 99,129,131,169, 56, 22, 94,128,128,152,248,116,216,108, 86,
-120,122,122, 66,165,176, 66,230, 17, 12,128, 66, 97,142,206,185,250,208,108,133, 66, 46,173,238,250,170, 81,141,106,252,127,131,
-138,184,200,255, 71,170,214,203,138, 86, 69, 25, 18, 4,224, 81, 74, 30,106,213,244, 69,205, 90,117, 16,255,224,110,169,206, 30,
- 96, 57,215,220, 81,135, 14,101,165, 47, 93,234,198,127,254,185,174,221,162, 69,193, 87, 38, 77, 12,114,111,220,196, 91,247,213,
- 87,169,237,150, 45,115,191,114,250,170,136, 19,138,247,235, 42,217,155, 75, 16,170,178,199, 38,217,166, 89,195, 80,106,246,182,
- 71,169,103,239, 25,114,197, 98, 49,227,239, 41, 35,212, 42, 9, 69,145, 34,137,141, 33,109,225,141, 90, 80,135, 73,162, 69, 69,
- 86, 74,136,214,139,174,195,124,109, 66,191, 83,123,167, 53,126,107,192, 98,175, 12,173, 5, 58, 59,245,212,117, 72,145, 4,238,
- 61, 72, 1, 40,113, 76, 89, 54,221,212, 94, 39,183,111,221, 28,188,108,209, 60, 56, 88, 14, 31,127,254, 29, 62, 24, 61,242, 36,
- 2,234,246, 12,174, 29,113,243,210,225,223, 21, 61, 39,254,140,148,184, 27,217,172, 77,191,163, 42, 36,235, 41,217, 2, 4, 78,
-224,201,130, 66,189,202,198, 66,134, 50,120,159,205,193,191, 82,203, 49, 90, 88, 28,254, 59, 27, 71,246,239,128,187, 90,249, 74,
- 54,220,221,221, 27,116,236,216, 9, 4, 45,129,157,177,193,206,242,176,151,138,209,114, 48, 60, 24, 65, 4, 69, 64, 83, 20,220,
- 63,208, 0, 86, 93,185,182, 70,141,234, 81,208,176, 73,203,221,223,126, 62,110,200,144,247,198,160,109,228,155,136,187,251, 23,
-252,130,234, 67,229,225, 35, 92, 73, 42,100,219,213, 15,166, 71,247,111, 77, 68,215, 12, 67,237, 6,237,241,232,254,245, 38, 98,
-177,248, 94,234,227,135,229,186, 36,179,179,179, 75,246,156,154,213,178,101, 75,164,166,166,162,160, 84,189,215,169, 91, 27, 0,
- 16,255,208,185,136,161,132,100,241,124,217,237,116,252,130,219,208, 91, 56,248,120, 74, 64, 17, 36, 32, 8,168, 21, 32,199,141,
- 71, 5, 24, 57,187, 16,145, 13,189, 16, 28,160, 0, 4, 1, 70, 43, 3,187,157,135,131, 7,236, 86, 22, 20, 89,238,146, 65,142,
-227, 56,142, 20, 24,234, 86, 76, 60, 36, 98, 17,220,139, 76,144,203,229, 16,139,243, 64,144, 36, 88,150,135,131, 97, 96, 49, 91,
-176,251,198, 85, 8,156,131,226, 56,142, 67,177, 27,180, 26,213,168, 70, 53,254, 27,241,255,113, 32,124,105,114, 85,190,162, 85,
- 17, 66,106,250,225,239,152, 36, 52,169, 31, 10,119, 55, 53, 30, 38,164,131, 34, 69, 32, 9,128, 97, 93, 39, 67,130,131,217,185,
-108,153, 59, 82,146,148,228, 79, 63, 39,213,254,120, 82,237,164,101,203,220,175, 8, 14,102, 39,128,145,130, 0, 56,201,150,147,
-112,113, 85,224, 5, 2,207, 4,249,121, 41,168, 27, 79, 76,249, 36, 73,217,188,221,101,188,183,187,148,244, 86, 75, 68, 98, 17,
-197,179, 2,233,168,169,169,109, 21,120,222,149,115,245,158,115, 29,114, 28, 7,130, 32,185, 98, 34,166, 76,203,183, 64,103,165,
-144, 83,100, 67,161,193,129,122,129, 74,156,137,222, 99,230, 24,203,182, 50,213, 54,145,216,189, 78,237,154,248,102,206, 50, 88,
-108, 28, 30,101, 24, 33,150, 74,253,253,252, 27,221, 25,249,209,116,233,148,245, 9, 24,219,197, 27,159, 95, 74,200, 48,231,200,
-166, 87,165,102, 57,142,131,197,106, 23,231,228, 21,122,234, 13, 38, 55,185, 76,106,241,245,114,207, 43,235, 94,171,253,213,198,
- 89,133,140, 70,223, 72,127, 88, 29,195, 97,177,177,248,235,236,190, 87, 49, 19,234, 87,163, 38,140,246, 82,228,170,152,108,149,
- 38, 93, 34,149, 47, 0, 34,180,178,108,223,191,119,243,221,251,247,110,254,120,253,202,133,237,139,126, 59,219,120,203,154,239,
-177,250, 96, 2, 40,138, 34, 4,134, 21,173, 60,152,132,154, 30,148, 96,100, 68,132,149, 35, 96, 42,208, 34,162, 77,175, 70,219,
-215,126, 59, 29,206, 45, 35,108,174,144,173,194,156, 27, 79,235,253,196,241,167,235, 22, 80,120,103, 83, 81,194,185,213, 78,138,
- 79,209,123,202,102,237, 14,187,198, 93, 34,112,172,131, 47,189,163,149,187,156,128,192, 3,215, 99,115,112, 43,158,132,183,155,
- 24, 42,185, 8, 12,203,195,108,103, 97,177,114, 36,207, 58,108,229,212,247,173,149, 43,150,127, 63,124,248,240, 73, 59,118,205,
- 58,212, 44,234,179,126,250,162,124,136, 36,114,136,105, 49, 72,138, 4,203,113,176, 91, 77, 40, 44, 42, 64,210,159,127, 28, 26,
- 58,100, 96,139,149, 43,150,127, 95,178, 74,177, 26,213,168, 70, 53,170,241,111, 83,179, 94,130, 75, 68, 75,165,144, 65,160,100,
-184,116, 51, 1, 17, 13,155, 98,211,161,107,168,219, 36, 18, 89, 6, 22, 2,200, 74, 87, 27,150, 96,218, 12,203, 45, 0,183,250,
-245, 83,212, 28, 56, 48,176,187, 32,136, 78,255,188, 78,159, 14, 0,161,141,157,102,120, 94,128, 32, 0, 2,239, 36, 92,174, 75,
- 58,116, 74, 82,150,190, 86,109,127, 37,238,167, 59,108, 74,169,152,244, 84, 74, 40, 95,119,137, 88, 76,211,224, 4,194,150,149,
-149, 96, 35,128,100, 87,204,189,232, 58, 84,168, 2,142,117, 29,176, 88,155,156,170,187, 81,175,192,220, 76,231,144, 64, 16,128,
-122,129, 74,196, 92, 61,202,229,100, 60,126,100,201,137,251,165,108,149, 12,148,131,229,113,231,137, 14, 69, 38, 6, 69, 70, 7,
-222,232,220, 87,252, 70,183,126,184, 20,147, 7,158,101,176,232,215,163, 6, 78, 96,134, 2, 15,152, 42,100,154,252,251, 86,108,
- 77,109,161, 73, 42,162,233,162,250,117, 67, 18, 37, 98, 17,171,215,235, 37,207,223, 69, 65, 41,151,160,192,200, 0, 0, 83,213,
-214,163, 51, 49, 56,116, 53, 27,135,247,109,135, 92, 46,135,240, 10, 45, 80, 44, 22,123,136,196, 50, 56, 76, 78,119, 97,201,199,
-241,194,135,164,165, 0, 73,123,184,104,246,129,221,110,249, 43, 41,238,106, 3,174,115, 93,106,116,183,218, 24, 53,126, 42, 2,
-235, 52, 65,223,190, 3,209,180,182,154,216,119, 37, 21, 12,195, 26,252,195, 26,169, 5,231, 42,219, 71, 0,154, 1,184,234,138,
-178,165, 46, 85,239, 13,222, 8,107,246,140,104, 1, 5, 41,183, 43, 92,197,202,217,243, 51,204,118,146, 20, 4,190,204, 41,131,
- 8,128, 96, 7,114,178, 4,100, 3,160, 73,128,166, 72,128, 32, 40,142,227,202,172, 39,150,101, 79,241, 60,159,179,117,235,214,
- 28,142,227,110,221, 60,186,244, 78,157,183, 38,206, 2, 91, 0,134,113,134, 51, 74,164, 10,240, 4,137,132,139, 27,103,113, 14,
-203,193,173, 91,183,150,108,239,112,175,186, 47,172, 70, 53,170, 81,141,127, 11, 74,159,113,248,118,105,242,229, 18,209,226,120,
- 1, 62,222, 94, 96, 4, 26, 73, 57, 58,152, 8, 13,172,102, 1, 28, 71,128, 19,132,138,182, 26,239,134, 50,150,231, 31, 58,148,
-149, 14, 96,195, 11,154,212, 83, 37,235,233,119,217, 46,153, 50,109, 18, 2,119,230,208,241,243, 67,250,117,232,226,249, 48, 43,
- 59, 93, 44, 34,105, 90, 76,137,196, 52, 73,136,105,210,238, 38,167,169, 61,235,118, 72, 4, 2,231, 43,179,105,181, 90,209,173,
-219,243, 7,147,199,197, 94,209, 20,228, 62,178, 11, 4,207,251, 74, 12,240,113,247, 69, 98,114, 42,206, 30,223,103,206,201,120,
- 28,199,217,172,253,241, 60,229,124,102, 83, 16,248, 2,157, 13, 86, 7,135, 66,163, 3, 69, 38, 7, 88,223,118, 56,240, 87, 38,
-100, 98, 10, 57,119,246, 88,180,217,233,159,218,114, 31, 39, 85, 82, 21, 95,227,185,189,180,132,244, 15,199,140, 22, 45, 95,178,
-200,214,162, 69, 75,161,160,160, 0, 70,163,241, 89,153, 16, 4,100,110, 26,168,229, 52, 30, 95, 63,134,199,103,151, 89, 0,124,
-235, 74,121,150,134,155,130, 70,191,182,254,176, 57,134, 35, 79,103,195,245,243, 7, 42,107, 50, 47,217, 84, 40, 20,242, 18,245,
-170,244,182, 14,246, 82,170, 22, 87, 92,223, 36, 45,149,151, 97,179, 59,128,211, 47, 94,212,235,116, 71,111, 93, 57, 51,201, 58,
-126, 20,114,138,108,176,228, 39,224,143, 3,191,156,117, 24, 30,117,238,177,124, 9, 57,181,127, 29,156,189, 85,160,190, 71, 83,
- 0, 15, 68, 13,159, 54,248,196,246, 37, 91, 42,203,123, 9,217,234,212,161,245, 44,146, 34, 14, 11,196, 51,178,148,153,153,233,
- 82,222,117, 57,143,139, 21,164, 42,249,192, 65, 16, 36, 37,240,207,157,129,248, 92, 58,121,158,191, 87, 66,154,104,130,232,175,
- 86, 40,144,167,213,161,100,147, 93,171,197, 0, 47,159, 26, 32, 9, 2, 76,169,123,171, 90,239,175,128,106,155,213, 54,171,109,
- 86,219,252,191,138,151,206, 56,172,130,162, 37, 32, 44, 64,137,186,129, 74, 88, 29, 26, 88,237, 28, 76, 86, 14,122,179, 3,122,
- 51,131,164,108, 51, 98, 14,189,126, 10,157, 42,150,115,235,115,193,185,223, 38, 56, 94,112, 89, 61,145, 56,236,115,150, 46,154,
-255,238,142, 22,205,237, 83,222, 14, 8,186,155,100,207, 36, 8,210, 66, 82, 52,227,165,166, 69, 15, 31,222,213, 94,185,120,172,
-163,140,229, 70,153, 43,176,195,178,172, 46, 48, 48,176,100, 64,123,122,189, 65, 29,121,255, 63,143,126, 29,218,169,223, 34,223,
-229,243,166,153, 73, 74,204, 19,180, 56,134, 99, 44,219, 45, 57,113, 63,163, 2, 93,143, 20,203, 30,252,125,251,126,164,135, 87,
- 16, 30,103,152, 96,178,178,112,176, 60, 60, 85, 98,164,223, 59,233, 72,122,120, 99,151, 49,243,238,166, 87, 40,182,109,241, 15,
- 98,106, 70, 69,245,124, 39, 50,178, 29,245,253,247,223, 33, 34, 34, 2, 22,139, 5, 36, 73, 34,168, 86, 29, 36,197,223,198,213,
-163,115, 56,115,126,242, 47, 0,126, 4, 80,229, 3,151,243,244,118, 28,191,145,139,163,251,119,130, 18,189,210, 10, 54, 82, 46,
-151,203,202, 34, 87,165, 73,215,211,155, 69, 18, 25,156,234, 19,255, 92, 67, 44, 27, 39, 18,226,239, 63,120,255,189, 97, 13,212,
-238, 30,232, 61,112,104,238,149, 75,103,251,236,255, 99,221,138,252,228,180,119,191, 91,176,202,173,123,171, 0,194, 75, 37, 65,
-145,137,199,182,148, 7, 97,112, 81,131,205,206,206,158,157,150,116, 99,228,159, 71,191,238,219,169,223, 34,223, 27,123,103, 62,
- 13,162, 39, 41,122,107,101,207, 23,164,221, 60, 91, 85,146, 85, 66,181, 4, 65,112,201,113, 46, 0, 16,137, 37,208,104, 2, 64,
- 16, 0,195,242,176, 51, 44,104, 81,245, 74,195,106, 84,163, 26,213,248, 15, 99,252, 11,223,174, 41, 90, 86,171, 53,233,205,110,
-125,193,243, 2, 56, 1,224,185, 98,229,137,127,166, 62,113,140, 53,233,117, 83,199,243,220,181, 53,235, 55,244,110,209,166, 19,
-213, 48, 88, 5,125,126, 54,174,254,121,142, 5, 47, 92,113,229,249,252,252, 71, 70,185, 95,221,119,222, 29, 60,112,247,232, 49,
- 19,139, 58,118,238,172,212,104,252,109,233, 25,233,230,141, 91,182, 50, 39,143, 29,236,200,131, 29,150,159,255,216, 88,145, 29,
-157, 78,183,178,172,235, 82,137,234, 13, 0,161, 20, 77,216, 45,218, 71, 85,138, 8,207,203, 72, 27, 52,127,206,172,228, 17,227,
-166, 74,194, 2,235, 32, 87, 71, 33, 41, 61, 27, 15, 47, 30,180,101,196, 95,223,175, 79,191, 53,214, 69, 83, 89,101, 92, 75, 7,
-176,252,234,213, 43,141,162,162,162,122,118,233,210, 69, 24, 63,126, 60, 4, 1, 56,187,126,146, 80,144,116,117, 79,177,138,245,
-228, 21,235, 37,229,226,149,219, 94, 67, 58,182,162,189,213, 99,177, 97,231, 49, 6, 2,159, 82, 69, 51,126, 53,131,107,209, 78,
-119,161,115, 75,135, 23, 63,118,230, 89,252,152, 88,229, 71,155, 17,227, 87, 78,126, 95,226, 26,143,227,239, 55,121, 28,127,127,
- 12,128,220,221, 91,127, 61, 12, 0, 54,139,101, 98,244,217, 67, 41,247, 99,111,140,234,247,222, 23,117, 26, 53,107, 77,239,217,
-180, 28, 14,171,105, 31, 0,151,219,171, 84, 66, 37,151,212,123,101,174,194,151,234, 61,249,234, 49,130,164,104, 87, 73, 83, 41,
- 37,146, 20,120,222,165,128, 58,129,231,144,241,228, 30,188,252,131,161, 86,187,131, 23, 28,128,221, 6,109, 90, 28, 56,174,250,
-172,195,106, 84,163, 26,213,248, 15,225,213, 99,180,210, 30, 56,247,211,250,119,195,144,157, 59,114,211,166,205,115, 55,111,217,
-241,134,213,110, 15, 20, 32, 78,227, 88,251, 5, 35,135,239, 93,181, 97,201,121,124,195,219,187, 94,227,141,191,174,249,118,227,
-134,159, 58,129,231,234, 19, 64,178, 64,224,188,140,225, 70, 87, 70,178, 42, 28, 52,243, 12,235,186,191,179,196,146,159,111,220,
- 92,213,103, 45,249,113,217, 36,229, 8, 90,183, 98,206, 98,146,164,122,112, 28, 47,226, 57,230, 49,231,176,254,203,162,141, 59,
- 4,151,163,220, 80, 80,193,191,197, 2,136,141,142,142,238, 16, 29, 29,221, 6,192, 74, 56,207, 80,188,241, 58,245, 98,203, 55,
-116,253,114,218,151,103,191, 0, 17,194,243, 2, 88,142, 79, 17, 91,204, 93,171,104, 38, 40, 44,172,142,194,193,112, 47, 5,192,
-151, 14,132,127, 74,180,220,107, 42, 0, 4,185, 72,180, 0,231,106,186, 95, 95,186,200,178, 11,179, 50,211,118,254,252,175, 79,
- 39, 0,168, 13,224, 50,128, 53,255,169,122,119, 88,245,121,255,238,247,134,117,216,102,167,223, 61,132,204, 88,113, 0, 65, 59,
-183,114, 16, 56, 59,120,214,158,197, 50,142,217,213,125, 95, 53,170, 81,141,106,252,199,212,172,245,101,253,166,255, 91, 82, 88,
- 88,248,196,128,194,138, 15,233,117, 5,249,249,143,140, 0, 94, 90,185,103,126, 77,187, 49,143,244,123,241, 72,191,247, 85,159,
- 55,229, 38,106,129,196,209,175,153, 12, 87, 2,217, 47, 21,127,254, 17,228,229, 61, 48, 33, 15,109, 95,183, 90,182,109,221,242,
-112,199,142,157, 34,129,164, 68,188, 64,137, 89,129, 16,177, 60, 33, 98, 24, 30, 54, 7,195, 56, 88,150, 1,199, 58,192,115,140,
-192, 59, 24, 56,119,135,255, 39,144, 2, 96,198,255, 84,189,255, 39,192, 50,142,217, 96, 28, 0, 76,213, 93, 93, 53,170, 81,141,
-106,252,119, 17,174,255, 30,162, 85,141,255,213,120,146,240, 56, 62,178,186, 24,170, 81,141,106, 84,163, 26,255,203, 73, 86,233,
-111, 0,206,216,243,110,229, 60, 80,149,213, 4,221, 94, 33, 65,103,170,109,190,182, 77, 17, 0, 9, 0, 21,128,202, 92, 91, 61,
- 81,245, 13, 43,255, 39,242,254, 53,128,219,213,245, 94,109,179,218,102,181,205,106,155,255,107,109, 86,102,187,122, 53,227,191,
-153,128, 85,219,172,182, 89,109,179,218,102,181,205,106,155,213, 54,255,239,217,252,255, 25,227,203,248, 0,168,118, 29, 86,163,
- 26,213,168, 70, 53,254, 15,194,219,187,158, 10,120, 26,215, 91, 41, 20, 62, 13,252, 0,192,156,247, 32,167,186,244,170, 81, 6,
- 74,159,115,248, 92,140, 22,249,138, 6, 69, 36, 45,249, 82,161,246,126,160,116,247,206,248, 63, 94,184, 68,120, 45,229,228,238,
- 29,107, 31,136, 8,149,247,175,202,131, 10,223,240,223,253,235,180, 77, 85,106,194, 39, 35,160,133,252,117, 18,161,212,132,250,
-170,130, 90,253,169, 14,108,212,235,223,144, 71,105,195,134, 13,219, 53,108,216,176, 29,128,127,228,148, 98,133, 38,124,120,205,
-186,145, 23, 53, 97,205,207, 41,253,234, 13,254,167, 19,172, 10,168,235,173, 10,106,185, 87, 85,163,105,161, 42,160,169, 94, 85,
-179,229, 5,181, 79,131,176,202,158, 11,234, 55,191,254,236,237, 49,219,131,250,205,175, 95,214,191,123, 70,173, 82,255,176,227,
-209, 60,239,190,255, 82, 85,247, 43,175,134,160, 55,134,123, 4,116,250,194,187,170,207, 5,134, 71,198,214,106,212, 33,183, 70,
-189,182, 49,174, 62, 83, 51,162,221,173,144,134,111,228,212, 12,111,119,163,186,228, 93,131,204, 55,180,157,204, 51,248,168,212,
- 51,248,152,212, 43,180,243,235,218, 11, 8, 8,144,215,175, 95, 63, 42, 50, 50,114, 66,215,174, 93, 63,107,222,188,249,248,144,
-144,144, 30,255,147, 19,125,133, 38,124,134, 77, 68,228,217, 68, 68,158, 66, 19, 94,233, 98, 25,165, 38, 98, 46, 65,114,153, 4,
-201,101, 42, 53, 17,115,255, 91,234, 74,234, 23, 30,162,208,132, 47, 83,251, 55,188, 38,215,212,235, 91,213,231, 61, 61, 61,123,
-248,250,250, 14, 40,249,120,122,122,246,168,126, 3, 94, 25,165, 85,172,215, 86,180, 40,145, 84,113,121,196,152,143, 27, 47,156,
- 53, 93,182, 98,195, 1,172,152, 55,237,190,205, 84,212,240,191, 49,231, 62,161,109,110, 80, 36, 85,179,244, 53,142,231,210,243,
- 18,175,181,250, 39,236, 71,212,146,143,253,246,171,145,159, 15,127,183, 91, 72,183, 62,159, 18,113,137,150,131,174, 83, 52, 52,
-219,181,119,127,208,197,243,231, 86,109,216,176,254, 71, 45, 27,177, 76, 36,165,215,232,211, 98,139,170,146, 6, 55,223,176, 80,
- 90,233,115,241,205,254, 31,251,223, 60,179,117, 19,103,231,187,155,243, 74,157,254,253,234,240,173, 83,167, 78,107,138,162,188,
- 39, 79,158, 44, 6,128,229,203,151,215,229, 56, 46, 63, 33, 33,225, 58, 94, 97,243, 83, 39,193,140, 24,185,114,241,236,205,189,
-122,245, 70,102,158, 9,139,150,173,125,235,196,145, 93, 67, 76, 57,143,246,252, 19,117,226,225, 81,219, 13, 98,245,189, 79,191,
-250, 81, 19,245, 86,107,202,104,101,113,226,226,237, 14, 91,215,254,120, 13,104,208,198,144,247,160,220, 61,197,120,179,110,166,
-159, 74,136,226,205, 58, 0, 24,254,210, 96,175, 98,186,249,202,185,168, 0, 41,125, 59, 31,168,244,208, 71,143, 90,111,156, 20,
- 73,165, 33, 36, 73,130, 36, 0,146, 36, 64, 17,132,243,156, 80,135, 37, 37,227,225,165,158,255, 13,239,137, 58,184, 77, 54, 40,
-218,155, 36,158,165,143, 32,139,191, 5, 65,159,253,232,178,247, 63,240,223,184, 55,174,235,209,232,141,186,166,141, 23, 18, 11,
-148,116,199,207,142, 18, 2,249, 83,234,165,101,119, 92, 34, 0, 50,153,231,225,195,135,125,163,162,162,220, 53,141,250, 95,112,
-229, 25, 9,101,108,120,228,200, 33,113, 84, 84,207, 42,180,207,240,238, 32,201, 45, 4, 32,226,121, 97, 57,197, 11,187,140,249,
-241, 9, 64,213, 78,159,146,107, 34,198,146, 16, 92,238,103,120, 16, 55, 44,185,113, 27, 94,181,112,105,169, 91, 87,145, 88,252,
- 89,104,120,147, 22, 25,201,143,111,152,140,134,101,172, 77,119,161,202,134, 24,246,203, 51,151,110,246,162, 69, 34, 34,170,107,
- 91,202, 6,156,123,157, 74,247,243,243, 27,176,122,245,234,176,118,237,218, 1, 0, 88,150,117,219,189,123,183,255,156, 57,115,
-148,241,241,241,251, 94,209,108,160,175,175,111,176, 68, 34, 9, 4, 0,187,221,158,161,213,106, 83, 1, 84, 58,241, 87,250,133,
-249, 64,192,143,151, 46, 94,164, 1,160, 67,135,142,115,131,223,252,196,147, 18,171, 44,101, 22,135,221,160, 44, 74, 56, 55,245,
-234,223, 87, 8, 0,136,108,219,110,186,194,167,193,154,255, 73,101, 75,166,137,104, 75, 2,159, 71,118,232, 54,104,232,176,145,
-100,163,122,193,232,209,189,203,215, 22,224,112,149,218, 12, 77,203,175, 93,187, 86,135, 36, 73,138,101, 89,107,100,100,100,234,
-235,164,171, 70,120,187,191, 8,144, 65, 14,214,254,171,246,201,141,185,192, 75, 7,199, 80,238, 65, 45,190, 5, 69,143,227,121,
- 62,205,144,122,163,253,255, 66, 69,235,229,114,174,170, 37,146,150,124, 54,252,131,143, 26, 79,253,226, 27,217,167, 43,162,113,
-116,237,244,188,255, 86,146, 5, 0, 20, 73,213, 60,121,234,164, 70, 33,161, 0, 0, 70, 43,139, 94, 81, 81,149,143, 8,181,218,
-156, 39, 9, 34,162,228, 40,113,142,117,200,104,145,196, 74, 56, 9, 18, 8, 0, 62, 53,106, 69,251,177,151, 21,195,223,237, 22,
-178,101,199,233,244,212,244,252, 42,119,106, 4, 37, 70,100,199, 30,232,214,189,167,251,181,191,255,250,113,253, 47, 63,207, 96,
- 29,204,207, 60,195, 47,179, 22, 60,206,172,180, 51,247,175,215, 82,162,242, 57, 49,104,194, 28,111, 43,233,133,239,231,173,244,
-185,120,124,219,133,140,180,102,124, 74, 74,154, 85, 32,136,251,133, 5, 89,159,153,178, 19,226, 92, 45, 50,149, 74, 21,166, 82,
-169,154, 53,109,218, 84, 54,109,218, 52,209, 91,111,189,245,140,178,143, 31, 47, 62,127,254,124,192,146, 37, 75,122,223,189,123,
-215,106, 52, 26,239, 24,141,198, 39,168, 66,160,189,191,191,239, 39,239, 12,236,139, 46,131, 62, 6,199, 19, 24,255,209, 84,156,
- 60,190,111, 34,128,127,132,104, 49, 10,183, 57,227, 38, 76,243,141,108,221,156,250,113, 91, 28,228, 18, 26, 61, 91, 69, 16, 31,
- 76,158,233,177, 97,213,143,191, 33, 15,157,202, 82,178,120,179,110,102, 99, 31,251,176,126,237, 66,113,104,187,125, 24,186,126,
- 5, 82,225, 62, 55,237,208, 55, 15, 1, 32, 44,106,178, 90,202,105, 87,215,240,160, 52, 82, 78,187, 58, 44,106,242,153, 39, 39,
- 86, 27, 42, 74,139, 72, 42, 13,217,190,109, 91, 61, 79,181, 24, 52, 73,128,162, 8,208, 20, 9,171,157,195,144,119,135,253, 99,
-205, 92,174,169,215,155,116, 30,150, 13, 30,248,221,146,251,232, 88, 85,234,132,160,196,222, 71, 14,237,167, 53,238, 82, 80, 20,
- 1,138, 4, 40,146, 64,114,142, 5, 99,199,126,224,254,186,132,189,215, 27,154,214, 95, 14,141,232, 25,217,216,171,233,206, 43,
-132,123,100,175,161,222,121, 86,197,251, 59, 14,158, 27, 38,116,152,250,183, 32,240,139,211, 47,175, 60, 85,145, 17,155,205,150,
-211, 51,170,151, 27, 65, 43, 21,103, 14,108,234, 72,147, 4, 24, 78, 0,203, 9,224,138,207, 70, 37,138,103, 48, 36, 73, 64,224,
- 5,140, 27, 55, 22, 61,163,122,153,121,150, 79,119,189,147, 35,183,156, 56,243,167,175,141,225,177,100,245,134, 31, 77, 58,237,
-143,137, 15,189,147,141,186,188,169,150,220, 71, 46,159,131, 65, 66,104,149,246, 36,102,194,182, 35, 87,209,184, 97, 3,112,188,
- 51,157, 17, 53,149,216,118,244, 42,234, 71,212,119,166,155, 23, 16, 30,164, 66,235, 86,173,129,151,142, 38,115,149,100,169,191,
-239,244,246,200,217,125,134,140,129,198,215, 23,164,192,244, 57,115,116, 91,159,223,127, 90,252, 37,107,213, 47,169,146, 49,129,
-123, 58, 46, 8, 60,255,218,170, 83,141, 26, 53,124, 91,183,126,182, 29, 35,203,178,168, 93,187, 54, 50, 50, 50, 34, 94,101,158,
- 22, 16, 16,240,246, 15, 63,252,160,233,221,187,183,200,223,223, 31, 0,144,157,157, 29,120,226,196,137, 22, 63,252,240, 67,110,
- 86, 86,214, 81, 84,176,163, 15,199,144, 98,146, 6, 37,147, 41,156,121, 4, 65, 78,251,100, 84, 83,191,128, 26,101, 30,228,174,
-213,102, 75,190,250,248, 28, 65,211,226,226,251, 65, 10, 2, 79, 84,160, 18,117, 19,137, 68,101,122, 40, 28,148, 91,164, 32,114,
-255,144,164, 72,103, 99,101, 25,109, 97,234,173, 6, 85, 80,226, 26,137, 36,226,159,223, 25, 58,166,253,224, 65,253, 17,224,235,
-142, 51,151,239, 98,226, 39,159, 51,172,131, 89,246, 74,157, 7, 69,209,185,185,185,201,158,158,158,254,175, 63,222, 18,161,167,
- 79, 30,215,156, 57, 27, 61,125,233,138, 85,147, 28,118,150,225, 5,225,233, 57,198,114,185, 84,212,189,207,187,110,154, 58,145,
-178, 85, 63,124, 40,250, 95,168,104,173,255, 71,136,150, 68,174,126,247,187,175, 38,203,230,108,189,138,163,107, 39,230,153,245,
-121,190, 79,103, 10,110, 30,183, 76,250,162, 22,175,146, 66,149,111,120, 59,130,162, 39, 16, 20,165, 36, 72, 66,194,115,124, 26,
-107,183,207,181,228, 63,202,122,221,220,243,188,128,189,127,229, 86,141, 0, 9,168,187,101,231,126,141,159,135, 20, 86, 7,135,
-161,195, 71, 98,243,230,205,106, 95,119, 9,172,118, 22,139,151, 46, 53, 24,147,143,106,146,211, 10, 51,186,245,253,252,212,147,
-164,220,152,212, 44,235,174,170,166,205,230,224,160, 55,179, 48,219, 72,212,107,212, 26,139,151,213,151,165,166, 36,126,190,233,
-247,223,166,220,191, 79,109,230, 41,114,182, 53,235, 65, 90,153, 47,157,127,227,158,110,158,222,219, 7, 78,152,231,241, 40,151,
-134, 0, 7, 18,220,100,120,247,253, 41,110, 97,254,114, 40,101,148, 71, 98, 74, 70,192,180, 47,191,188,252,132, 19,218,232,181,
- 79, 18, 43, 75, 79,173, 90,181, 6,245,233,211, 71,241,197, 23, 95,136,130,130,130,240,251,182,221, 33, 29,122, 14,233,155,153,
-149, 19, 36, 8, 2,252, 52,154,180,113, 31, 12, 57,124,236,216,177,148,180,180, 52,209,162, 69,139,218,238,223,191,191, 97,118,
-118,182,203, 51, 83, 78, 16, 96,181,113,224,138, 7, 72,173,206, 86,101,126, 26, 24, 24, 40,205,200,200,176,149, 82, 25,136,103,
- 66, 33,209,179,107,167,182,244,186,227, 73, 48, 90, 57, 40,101, 34, 36,229,152,209,170,121, 19,226, 87,142,109, 86,150,193,177,
-239,190, 61,211, 79, 37, 68,245,107, 23, 10,141,167, 2, 27,215,204,195,161, 43,137, 81, 57, 70, 2,171, 5,106, 66,128,148,238,
-174,228,179, 86,191,213,170,142,127,151,150, 33,184,222,170,142,255,197,155,113,241,242, 33, 75, 39,103, 24, 69,103, 10, 79, 76,
- 49,148,221,241,144,240, 82,139,177,225,100, 10, 20, 50, 26, 74, 25, 13,165,212,249, 77,146,196,235,205,106, 3, 26, 4, 81, 60,
- 55,150,162,232,177,195,222, 29, 82, 99,196,176, 33, 2, 40, 18,187,247, 30,238,191,117,235,150, 44,198, 97,255,141, 35,169, 13,
-229,181,159,231, 10,148, 4, 52,238, 18,124,249, 91, 12,220,228, 34,168, 21, 34,184, 41, 68,232,210,212, 23, 20,249,202, 73,244,
-156,216, 63,172,247,196,129,181, 58, 71, 4,171,234,221, 73,208,221, 31, 59,247,198,138,243, 69,157, 63, 91,179,188,161,183,177,
-200, 78,127, 63,109, 28,157,158,153,217,121,247,225, 11, 93, 56,251,152, 56,214, 97,250, 70,123,119,119,153,170,112,122,220,149,
- 22,129,145,131,101, 14, 35,115,239, 78, 92,122,157, 66,155, 20,177,201,122, 40,101, 52, 84, 37,101, 43,163,161,148,137,160,146,
-209,200, 76, 79, 66,129,137,186,156,225, 77,118,198,133, 43, 85,218, 38,223,234,224,112, 59,209,136, 90, 17,205, 17, 16, 80, 3,
-246,222,239,213,250, 59,122,239,193,107, 23, 14, 44, 48,103, 63,252,198, 85, 59,219,142, 92,197,244,169, 19,110, 18,192,173,226,
- 65,186,197,247, 11,215,182,252,113,250,199,207, 93,155, 54,123, 85,203, 87, 87,178,212, 51,187, 12,252,104,118,135,238, 3, 97,
- 40,200,193, 95,167,118,161,103,159,119,240,222,152, 79,225,225,225,179,120,217,220,175,238,176, 54,125,244, 75,125,174,127,253,
- 55,155, 52,110,176, 53,176, 70,141, 32,158,119,158,242, 33, 8,128,209,160,195, 87,159,141, 3, 47, 8,104,214,162, 77, 23, 89,
-135,238,130, 80,124, 26, 72, 94,126,158, 41,238,225,253,110,214,220,184,191, 93, 46, 75,171,149,209,106,181,184,125,251, 54,226,
-227,227, 17, 27, 27,139,252,252,124,184,187,187, 27, 77,166, 42,237,253,230,214,180,105,211, 17,209,209,209, 50, 79,207,103,135,
- 52,216,237,118,168,213,106,140, 24, 49, 66,212,163, 71,143,192,183,223,126,123,116, 76, 76,204, 54, 0,250, 50,211, 83,240, 56,
- 83,237, 23,241, 75,167,183, 58, 77, 2, 0,185, 91, 64,226,234,223, 15,199, 86, 56,161,117,175, 17,210,190,253, 27,117, 32, 8,
- 32, 32,172, 52,231,199,103, 87,160, 18, 41,175, 94,189, 26, 70, 81, 20,253,108, 12,226,241,211,198,157,245, 79, 95,186, 55,104,
-225,226, 37, 50, 55,165, 20, 90,157, 29, 31,190, 55,208,229, 49, 88,238, 23,209,187,125,251,142, 7,127,156,253, 29,173, 82, 42,
-113,234,239, 39,152,252,217,151,214,172,228,152, 37, 2, 47, 90,107,214,198,231,190,230, 80, 41,224, 31, 64,189,154, 42,168,251,
-245,148, 77, 28,213, 79,102,103, 56, 20,153, 24,216, 28, 28, 56, 94,128,206,196,224,126,170, 1, 62,110, 85, 63, 34, 76, 16,132,
-214, 0,124, 1,104, 9,130,184, 94,250,119,201,132,174,132, 27,191,240, 59,175,120,124,240, 6, 96,135,115,165,254,211,230, 83,
-252,187,188,235, 37,207,223, 7,208,160,216, 38, 7,224, 26, 65, 16,133,229,144,173,151, 84, 46,250,200,145, 35, 66,159, 62,125,
-158,246,248, 47,254,126, 17, 82,177,168,134,210,221, 23,130,240, 0, 4,241,236, 54,141,127, 96,254,146,101, 43,188, 62,249,104,
- 66,138,190,168, 32,164,248,242, 25, 87, 6, 11,154,160,150,117,122, 35,178,199,164,143, 62, 66, 68, 88, 77, 49,199,113, 66, 76,
-124, 34,179,105,195,198,247, 47, 94,145,172,208,167,199,204, 44, 37, 65, 86,105,217, 39,199,115,233, 47, 42, 88, 28,207,189, 56,
-187,125,249,144,106, 2,240, 80, 73,240,203,241, 36, 8, 2, 64, 64,128,187, 82,132, 29,231,211,145,120,115,159,190, 79, 51,189,
-105,196,194, 89, 93, 58,247,158, 18,125, 63,193,186, 43, 55,215,122, 18, 64,118, 69, 54,203,238,208,121,216, 28, 28, 24,150,197,
-158,195,135, 17,213,165, 45,218,183,111,139,142, 29,218,211, 55,110,222, 29,243,209,164,113, 65,120,182,186,227,169, 77,153, 95,
-221,214, 42,119,159, 93,131, 38, 45, 82,223, 75,103, 65, 83, 64,168,191, 28, 94,106, 49,236, 44,129,100,173,163,248,205,241,192,
-228,105,179,189,166,127, 62,233,152, 94, 43,105, 12, 60,112, 84,148,119,179,217, 44, 25, 57,114,164,136, 97, 24,199,136, 15, 63,
-237,145,157,173,237,255,211,202,127, 73, 53, 26, 63,152,173, 44,110,198, 62,110,240,227,143,179, 67, 15,159, 56,127, 96,214,151,
- 19, 15, 70, 69, 69,185,239,220,185,147,175,172, 60,159,155, 33,230,228,173,217,184,117,207,230,229, 75,230, 35, 46,165, 16, 27,
-214,173,133,192,177,191, 84, 82, 84,165,109, 10, 35, 71,142,148, 31, 56,112,160,102,122,122,186,222,108, 54,107,159,211, 35, 72,
-130,206, 41, 48,195, 71, 45,129,152, 38,225,231, 41,131,198, 93, 10, 17, 5,144, 4,193,149,101,115,195,174,163,115,121,179, 14,
-135,182,219,135,109, 92, 51, 15, 99, 62,249, 22, 49,121,146, 19,164,194,125,238,199,195, 6, 77,247,149,115, 81, 53, 60, 72, 77,
-151,150,181,160,148,137, 49, 99,202, 72,180,185,153,172,201, 40,226,191,213, 90,168,230,179, 79, 60, 61,172,251,204,243,226,136,
- 83,193, 82, 43, 68, 56,177,117,113,174, 73,167,213,149,184,228,236, 54,107,138,139,205,248, 76, 25, 51,219,233,205,155, 52,154,
- 55,105,252, 88,242,141,118,109, 4,146, 20, 33,207, 96, 39, 4, 1,248,108,242, 68,124, 60,113,156,127, 90,102,238,247,107,215,
-254, 50, 51,250,180, 48,199,164,125, 56,171, 34,155, 36,225, 84,129, 84, 50, 26, 42,185,147,184,168,100, 52,172,118, 14, 4, 1,
-202, 35,184,133,142,112, 42,185,153, 5, 41,229,206,192,159,179,233, 21,220,232,236,233, 68,117,253,194, 93,133, 87,146, 50, 99,
-231,222,188,155,115, 13, 64, 65, 80, 71,143,209, 14, 86,128,209,202, 34, 41,199, 12,214, 33, 16, 99,122,133,160,246, 96, 34, 98,
-254,198, 91,155,143,223,133, 91,169, 78,255, 57,155, 25, 87,247, 88,189, 27, 15, 28,186,124,213,186,235, 75,230,125, 75,229,233,
-236,224, 5, 1, 50, 9, 5,185,132, 46,254, 80,176,152,116, 88,251,243,175,217, 44,136, 65,184,112,129,173, 74,251, 4, 47,188,
- 55,176,119,199, 29, 4, 32, 33, 72,113,122,141,144, 90, 33, 93,251,190, 47,235,218,111, 36, 56,214, 62,253,230, 37,225,156, 57,
- 55,238,172, 43, 54, 27, 55,108, 0, 2,184,101,202,141,159, 8, 0, 74, 77,248, 47,245, 35,234,183,124,241, 90,221,186, 17, 45,
- 93,169,247,167, 74,169, 76,253,137,167,151,239,183, 17,141,154,107,114, 10,109,132,218,187, 38,146, 30,221,198,246,159,191,223,
-194, 91,237,179,207, 30,221, 53,111,197,134,253,239,118,141, 26,136,141, 63,253,107, 70,126,214, 83,162,117,166,148, 90,245,222,
-166,223,214, 7,137, 36, 82, 48, 44, 15,134, 19,156,223, 44,135,130,130, 66, 48, 44, 15,153, 66, 13,150, 39,192,112, 60, 24,150,
-135,205,206, 42, 39,142,124,251, 35, 43,240,119, 89,233, 12,172,223,233,164, 88, 42, 13, 17,224, 60,187, 86, 16, 4, 36,101, 91,
-200,128,128,128,109, 0, 32,149, 74, 33,149, 74,193,243, 60,110,198,105, 63,241,137, 8,159,132, 98,130,199, 57,236, 41, 69,201,
-127,246, 44, 47,239,254,254,254,125, 95, 36, 89, 86,171, 21, 70,163, 17,151,174, 92,119,255,109,243,158,168,164,148,244, 48, 94,
-112,183,169, 53, 97, 61, 13,185, 79,250,150, 87,158,134,156,184,143,220, 34,199,145, 95,124, 60,186,238,170, 77, 71,174, 61, 62,
- 57,183,194, 56,173,218, 93,191,182,127, 49,225,157, 86, 11, 87,110,120, 84,248,231, 47, 83, 43,171, 35,154,166, 69, 90,173,246,
-233,251,189,250,215,237,173,110,197,101, 12, 88,177,124,133,236,230, 19, 3,238, 37,101, 98,116,183, 96,231, 12,199,133,122, 87,
-250,133,249,132,214,169,179,109,237,202,133,244,163, 76, 43,214,236,187,134,232,131,191, 92,202,206,253, 59, 10, 57, 89,150, 87,
-233, 67,254, 1,162, 85,174,205,115,119,243, 96,180,178,176,217, 89, 48,188, 0,189,153, 65,110,145, 29,122,179, 3, 70, 11,139,
-209,221,131,203,124,174, 18, 62,226, 75, 16,196, 17, 65, 16,250, 8,130,208, 13,128,164,228,183,115,204, 38,142, 20, 19,178,231,
-126, 79,159, 62,253,155, 5, 11, 22,196,150,220, 91,114,189,228,222,138,174,151,122,222,123,198,140, 25,141, 23, 46, 92, 56,191,
- 93,187,118, 59,254,250,235,175, 68, 0,133,174,186, 15,233,210,153, 57,114,228, 72,101, 5, 29,230, 96, 28, 82, 55,185, 8,161,
-181,131,241,193, 55, 27,125,254, 88, 56, 54, 87, 38,161,169,227,199,143,123,229,219, 85, 32, 73,202,229, 41,138,202,183, 94,123,
-177, 88,114,116,233,210,165, 24,214,183,131, 60, 53,143, 49,222, 77,181,228,152,236, 96, 53,190,225,146,185,243, 23,170, 22, 46,
- 90,252,241,145, 67,124,145, 49,231,254,226,178, 93,124,173,110, 80, 68,169, 24, 44,130,128,192,115,233,133,201,215, 91, 1,192,
-235,196, 98, 25,173, 12,168,226,216, 26,130, 0,204, 86, 22, 20, 69,228, 22,197,237,186, 63, 98,206,220, 46, 91,118,156,206, 20,
- 72, 15,131,201,148,164,128,243,204,193, 42,195,106,231, 96, 99, 56,196,222,185,137,142,145, 13,209,190, 85,125,152,173, 28,204,
- 54, 22,181,235, 68, 0,128, 79,153, 21, 71,145,137, 2,199, 88, 5,129, 83,247,105,237, 11,141,135, 4, 1,158, 82, 72, 37, 52,
- 24, 22,176,216,121, 88,237, 28,146,115, 45, 48, 88,228,104,210,105, 72,168,119,192, 13, 91,118,178,252, 64, 65,234,141, 65, 21,
-146, 83,142,195,166,109,123,234,102,102,230,244, 63,118, 96,171, 84,171,103,112, 55,217,132,220, 34, 27, 64,249,226,135,249,107,
-164, 95, 79, 29, 63, 96,211,246,189, 41, 93, 59,180, 77,169,106,158,205,218,184, 45,187,118,239,249,165, 79,159, 1,242,216,191,
-143,225,209,237,179,243, 76,185, 85,138,207, 34,155, 53,107,198,142, 31, 63,222, 48,127,254,252,160, 67,135, 14,213,214,106,181,
-183, 1, 48, 30, 30, 30,245,195,235,134,220, 57,117,226,120,224,219, 3,134,136,210,243, 44,112, 87,136, 17,162, 81,224,202,165,
-147,140, 68, 34, 42, 51,222,164,216, 61, 56, 28, 93,191,194,161, 43,137, 81,177,249,178,243,227,198,142, 78, 57,117, 49, 46,127,
-245,230, 83,255, 10, 84, 49,183,101,188,118,245,141, 86,117,252,167, 79, 30,137, 5,171,182,224,194,205,184, 92, 19, 25, 48, 47,
-203,198,158, 46, 95, 74, 7,104,138,128, 90, 46,130, 73,175,213, 37,220, 58, 17,254, 15,201,212,163, 79, 29,216, 66, 22, 24, 24,
-164,229, 89,137,204, 2, 3, 56, 94,128,135, 66, 12,150, 23, 80, 84,144, 71,108,221,178, 25,215,175, 95, 33, 65,145, 31, 2,152,
- 85, 97,129, 18, 78, 87,161, 74, 38,114, 42, 66,114,231, 55,195,241,136,168, 91, 7,235, 87, 47,115,243,209,248,225,205,142,174,
-199, 70,171,189, 67,154,237,248,125, 53,206,255,117,235,173, 11, 43,214,180, 86,213,240, 93, 69, 16,220, 18, 8,176,218, 28, 28,
-116, 69,133,144,216,211,208, 38, 80, 11, 47, 5,135,100,125, 0, 98,178, 31,169, 42,235,240,243, 99,246,223, 38,132, 1, 51,247,
- 28,142, 94,208,179,251, 91,136, 73,214, 67, 46,161, 33,147, 80,144, 73, 40,136, 8, 14,203,126,254,133, 41,212, 25,250,228,199,
- 30,204,123,133,246,121,166,120,246,235, 36,119,156,209,119,203,170,153,127,140,251,106, 81,207,168,129,239, 19, 49,215,207,125,
- 99, 6,206,186, 54,209, 19, 92,186,198,243,174,143,113, 50,181,207,202, 41, 95,207,157,210,163,207, 16, 80, 20, 13,134, 97,255,
-137,233,136, 0, 0, 32, 0, 73, 68, 65, 84,176,119,231, 22,252,190,230,135,135,118, 99,254,251, 0,120,123, 46, 53,126,215,150,
-159,135,124,245,253, 50,162,113,179, 54,109,207,101,189,124,188, 39, 79, 17,235, 70,141,157, 48,212,207,207, 79,253, 76,209, 18,
- 16, 30,209, 16,189,251,189,131,147, 7,247,227,126,236, 93,240,130,147, 48,241,188,128,162,194,252,108,150,177,111, 42,215,227,
- 33,147,133,108,252,125,115, 61,146, 36,158, 30, 32, 63,245,163, 15,236, 19, 63,251,230,205,222, 61, 58,197, 74, 40,232,147, 83,
-179, 60,174,220,122,208,132, 23,169,130,198, 78, 91, 38,182,218, 56,232,204, 12,142,109, 40,159,235,200, 60,131,219,213,106,217,
-123,236,196,239,214, 75,165, 20,233,104, 20, 30,148,216, 41,178, 81, 90,112, 13, 31,195,143, 11,215,180,185,252,247,173,222,239,
-142, 24, 43, 27, 93,191, 37, 81,195, 91,174,254, 96,196,192,166, 28,235, 24,101, 46, 72, 43,119,127, 65,145,194,179, 40,184,118,
- 93,243, 51,197, 40,124, 31, 33, 32,244, 57,230, 65, 32,209,146, 19, 63, 8, 0, 2,106, 4, 91, 69, 82, 55, 67, 21, 20, 24, 1,
- 0, 86,253,186,189,213,157,248,204,113,203,151,175, 80,220,124, 98,192,237, 39, 58, 72,197, 36, 28, 12, 15,194, 69, 81,155, 23,
-168, 9,223,206,152,238, 86,104,226,112,254,174, 22,177, 55,206, 9,118,163,117,132,130,117, 27, 4,141,122, 20,128, 58, 0, 18,
- 8, 66, 88,103,202,241, 63, 8, 92,168,242, 65,167, 60,239,156, 47,187,249,134,133,114,180,180,183, 72,162,108, 71, 16, 66, 35,
- 66,128, 39, 32,100, 20, 20,143,169,174, 50, 53, 83, 78, 60, 22,205,255, 30, 43,127,219,143,204,124, 43,220,185, 52, 28,220, 48,
- 23, 95, 44,216, 6,139,173,252,168,134,202,248, 72, 89,196,232, 69,194, 85,242,119,201,125, 11, 22, 44,232,243, 66,221,244, 41,
-167,206, 94,186,175,228,249,133, 11, 23,206, 47,245,239,102, 87, 73,214, 83,162, 85,146,169, 74,200, 86,184,111, 64,200, 95, 7,
- 15,236,243, 44, 52, 58, 32, 19, 83, 8,174, 93, 23,179, 86, 31,244,237,213,202, 7,121, 14,119,108, 95,191,164,192,106, 54,236,
-116,169,179,208, 68,180,149,171,148,199,246,237,221,143,176, 96,141,120,235,165,130,164, 91,137,150,167, 82,175, 94,155, 34,169,
-237,102,166, 7, 13, 28,168, 56, 27,125,238, 51, 35, 80, 38,209,162, 8,170,230,175,155,247,106,212,114, 17, 8, 2, 48, 88, 88,
-140, 27,245,206,235, 15, 99, 2, 79,141,125,127, 52,136, 98,146,165,207,207,198, 55, 95,127,100, 85, 50,143,238,167, 38,167,102,
-116,235,251,197, 89,189,145,176, 14, 29,249,209,245,251,241, 11, 10,205,230, 87, 59,228,199,102,231, 96,115,240,120,242, 36, 1,
- 83, 71,119,135,136, 34, 65, 81,188, 51, 88,154, 45,191, 49, 26, 51,227, 11,224, 47, 30,188,101,233, 39,191,214,240,211,120,171,
-148,114, 65,165,144, 18,141,234,215, 19, 71, 70,182,151,212,142,104, 42,190,244,192,130, 84,173, 5,137,153, 58, 72,253,154,211,
-195,186,244,194,150, 21,211,222, 42, 72,189, 65,226,229, 32,197,231,112,250,252,213,190,191,253,188, 92,154, 83,228,192,195, 84,
- 35,178, 11,173,200, 42,180, 33,187,192, 10,149, 92,132,142,253,198, 75,143, 30, 92,215,183,107,135,182,171, 94, 37,223,137,137,
- 73, 71,147, 51,178,134, 52,109,209, 6, 91,254,248,189,131,135, 71,109,183,162,162, 36,189,171,181, 51,119,238, 92,201,194,133,
- 11,233,213,171, 87,235, 35, 35, 35,253,103,204,152,209, 51, 55, 55,247, 90,173, 90,181, 34, 78,238,219, 20,221,188, 99,255,214,
-224, 29,190, 29, 58,117, 22, 75,121, 26,167,142, 28,113,236,218,185, 53,223, 98, 49, 76,172,144,112, 40,220,231,230, 24, 9,248,
- 6, 6,198,170, 36, 92,119,154, 44,138, 47, 60, 49,101,115, 33,176, 47, 44,106,242,153,115, 55,226,226, 91,221, 76,214, 68,223,
-124,156, 91, 96,118,132, 63, 57,241, 69,133, 29, 47, 69, 16, 16, 81, 36,212,114, 26,100,113,175,170,170,209,244, 49, 8,194,183,
- 68, 57, 37, 64, 20,127, 3, 4,129,204,194,212,219, 46,196,108, 16, 2, 47, 0,113,233, 38, 24,173, 78,105,190,166,143, 2,218,
-156,116,252,180,106, 19,110,221,184,142, 30,189,250, 97,237,175, 91, 49,110,212, 16,107,101,179, 31,146, 44, 86,180, 74,169, 89,
- 42, 57, 13,128, 64,145,137,193,222,203,105,168, 19, 74,186, 60, 48, 0,128, 90,165,128,206, 96, 1, 41, 86, 35,225,230, 49,197,
-241,115,127,207,152, 57,103,249,151,133, 89,119, 83, 31,223,187,132, 8, 31, 29, 66, 3, 29,136,205,118,195,141,252,218,136,168,
- 27, 6, 82,124,221, 37,219,121,177, 77, 22, 29, 36,247,246,105,213,188, 97,187, 16,141, 7, 44,118,174, 88,213,162,240,251,198,
-205, 72, 78, 74, 31,155,127,255,224,173,127,130,209,154,114, 19,181, 82, 77,221,143,239,253,125, 54,113,224,136,143, 17, 16, 24,
-220,172, 40,245,182,139,131,151,107,164,138,115,145,104,137, 21, 30, 51,166,126,251,175, 41, 61,222, 30,140,171,151,206,226,118,
-108, 2,218,182,109,141, 94, 3,134,193,160, 47,168,191,123,243,138,238,172,217,112,146,150,178, 83,218,180,239, 66,240, 28,135,
- 71, 15, 99, 18,202,178,101,201,138,187,125, 37, 43,206,237, 57,247,148, 79,253,102, 42,119,175,219, 54, 7,135,140,140,116,252,
-249,215,249, 22,150,172,184, 42,109, 32, 44, 21, 83, 56,117, 43, 23,142,226, 51, 76, 59,118,234,110, 23,147,182, 14,243,150,111,
-140,204,202,204, 34,149,110, 62,188, 87, 96, 3,113,128,212, 97,187,243, 68, 39,118, 48, 60,194,106, 40, 43,180,233, 91,163,238,
-252,105,211,166, 54,160,196,114, 24, 76, 54,123, 86,102,134,255,250,237,231,140, 15, 30,222, 11,172,169,113,119,251,215,138,117,
- 98,189,149, 64,174,206,134, 2,131,158, 24, 49,225,171, 26,191,173, 89,240, 94, 69, 68,171,140,112,145,208,163,167, 46,213,247,
- 84,139, 9,163,149,229,243,245, 14,110,196,128,215, 91,116, 89, 76,178,198, 47, 95,182, 66,113,235,137, 1,119,158,232, 32, 19,
- 83,144,136, 73,216, 25, 30, 46,190, 78,164,191,198,127, 98,251, 86, 77,112,242,118, 30, 40,138,132,197, 80,104,166,145, 31,223,
-234,173, 30,138,150,109, 34,209,249,173, 78,120, 28, 31, 23,124,228,208,222,174, 87,254,188,144,205, 58,194, 63, 49,105,227,247,
- 87, 73, 88, 48,155, 41, 70,226,255, 65, 64, 96,173, 55, 6, 13,251,192, 61, 36, 56,144,208,248,120,131, 21,104,140, 31,245,142,
-203,111,190,147,152, 3, 11,231,204,128,205,102,135,175,135, 4,130, 0,108, 92, 53, 11,118,187, 29, 53,188,165,208,153,202, 63,
- 77,174, 50, 62, 82,158, 10, 85,165,216,147, 82,100,172,162,235, 4, 65, 28,153, 62,125,250, 55, 0,132,233,211,167,127, 83,242,
-123,193,130, 5, 22, 0,153,149,184, 14,215, 63, 71,180, 74, 50, 87,254,219, 45,142,240,241, 14,184,114,234,228, 9,247, 3,119,
-120, 92,221,127, 3,111,183, 13,128,152, 38,161,112,175,129, 59, 73, 58, 28,221,247,115,209,193, 29,235, 50,108, 54,219,226,202,
-125,205,117, 91,169, 20,202,147,127,108,217,201,251,120,123,147, 63,157,210, 62,201, 55,176, 79, 93, 90,241,127, 31,226,111,156,
- 92, 31, 32,128, 56, 33,147,201,234,218,237,118,207,202, 42,118,227,169,148,226, 32, 94,226,159,232, 91, 65, 80, 20,183,101,235,
- 22,248,184, 73, 96, 99,120, 76,255,242, 83,203,232, 30,170,162, 17,239, 14,235,210,185,247,148,104,145,178,222,217,246, 45,234,
- 9,205,155, 55, 47,162, 40,202,165, 80, 10,141, 70, 51,139, 36,201,225, 18,137, 68,109,183,219, 13,118,222,170, 48, 89,237,176,
- 58, 0,179,217, 10,145,216, 73, 22, 69, 20, 1,139,213, 14,179,197, 94,241,139,145, 29,115, 25, 64,184,190,148,166,116,246, 65,
-152,100,219,238,131,159, 14,126,119,232,204,192,102, 3, 84, 73, 89, 58,136, 9, 7, 90, 55, 8,192,185, 19,251,133,244,228,248,
-169,149,145, 44, 0,200,213, 22, 4,249,250,250,225, 86,162, 17, 25,249, 22,100, 23,147,172,172, 66, 27, 12, 22, 3,154,134,212,
- 64,145, 78, 23,244,202,229, 11,236, 63,121,242,228,144,222,253,135, 98,202,151,179,223,220,240,243,146,187, 74,137,104,140, 41,
-231,209,121, 87,136, 86, 76, 76, 76,193,215, 95,127, 93,231,215, 95,127, 37,223,123,239, 61, 75,147, 38, 77,100, 35, 71,142,124,
-115,243,230,205, 50,133, 66,102,185,115,233,208,204, 15, 39, 79,239,191,126,229,220,102,133,133,133, 4,203, 48,199, 29,133,133,
-211,141,149,144,185,180, 67,223, 60,252,225,137,227,253,238, 29,124, 15,121, 41,200, 70, 82,193, 62, 12, 13,102,237,196,131, 89,
-142, 39, 39, 86, 27,228, 67,150, 78,206, 44,226,191,181,146,154,121,149,145, 44, 0, 32, 41, 2,118,150,131, 90, 46, 2, 73,146,
- 37, 36, 62,224,247,157,199, 21,190,238, 18,136, 40, 18, 52, 69, 64,111,102,144,167,119,224,227, 15, 92,221, 33, 68,224, 89, 78,
-128,197,206,194, 92, 60, 59, 52,232,243, 48,227,203,207,209,171,239, 64,124, 56,241,115, 20, 90,128, 27,137, 6, 56, 24,166,210,
-151,130, 36, 72,152,109, 44,198,244, 8, 65,129,209, 1,147,133,133,157,229,161,144,208, 16,209, 36,148, 50, 26,110, 10, 17, 32,
- 8,226,146,206, 68, 36, 18, 89, 25,134,217, 82,193,140, 30,181,131,252, 96, 97, 72,180, 25,186, 4,221,218,133, 35,246,242, 94,
-250,194,213,123,161,159,125,249, 45, 62, 29,215, 23,123, 30,214,129,151, 38, 4, 42,165, 28,140, 64, 2, 16, 92, 12,216,155,197,
-147,142,129,195,127,249,117, 99,220,143,223, 79,151, 21,153, 8, 72,197, 20,162,207,158,193,149,191,111,172,204,187,127,112, 11,
-254, 65,136, 4,210,207,205,205, 13, 50, 9, 5,187,195,102,119, 61,116, 65,128, 0,180, 80,106,194,127, 41,158,241,183,224,120,
-148,113,173,114,162, 69,203,220,166,127,242,229,143,243,123,188, 61, 24,167,142,236,193,238, 61, 59,185,118, 81, 99,169,173,191,
-255,140, 55,187,245,195,155, 61,134,226,248,254,205,159,155,120,162,225,248, 41, 51,231,116,236,210, 27,167,142,238, 65, 78,118,
-250, 82, 87,211, 75,137,136, 41, 93,186,247,133,213,206,161, 67,215, 62, 56,113,120,255,100, 20, 47,178,112,125, 16,123,161,127,
- 6,201,126, 62,117,138, 40,183,200, 46,210,234,237, 72,215,154,145,148, 99,198,193, 29, 27, 4,215,251, 11,123,235,142, 77,107,
-138,198, 47,138, 78, 11,170, 25, 96, 19,217, 44,242,248,132, 39,245, 63,252, 96,180, 40,180,110,125, 50, 87,103,131, 86,103, 67,
-158,206, 6,163,149, 69,221,154,245, 72,134, 37,218, 85,181,158,125,220, 37,162,181,135, 19,225,166, 20,161,125,253, 87, 95,104,
-203,243,252, 51,146,181,220, 73,178,238, 38,234, 32, 21, 83,144,138, 73, 72,197, 20, 88, 78,112,105,226, 34,215,132,247,254,248,
-147,143,106,216, 89, 32, 95,103, 7, 77, 17,208,248,120, 42, 91, 55, 27,142,141, 75, 38, 3, 0,198,125,253, 19, 62, 28, 51, 18,
- 13, 26, 53, 65, 81, 97,161,255,240,193,189,151, 3,216,239,106, 90,143,157, 58, 31,124,234,226,173,175, 63,158,246,131,234,221,
-190,157,169,219, 79,116,200, 42,176, 33, 33,222, 80, 37,229, 13, 0, 88,142,135, 0, 1,155,118, 30,129, 92, 66, 67,171,115, 64,
- 16, 4,204, 93,189, 11,106,185, 8, 89,133, 78,119,127, 69,168,144,143, 84,160, 72, 85, 65,109,236, 3,103, 44,151,175,171,138,
-214,130, 5, 11, 98, 23, 44, 88, 80,166, 66, 86,138,100,189,218,161,210, 98,177,178,190,155,183,207,213, 83, 39,142,169,247,223,
-225,112,238, 78, 62, 6,119,168, 9, 99, 65, 42, 22,127,249,110, 1, 1,193, 78, 82, 84,145,205, 98,222,103,177,152,230, 1,112,
- 84,216,104,252,195, 91, 40,101,170, 51,107,215,255,193,250,104, 52,216,114,169, 32,189,208,196, 50,207,220, 86, 12,113,227,228,
-250, 80,150,103,162,172, 57,143,175, 87, 54, 19,231, 5,136, 23,252,124, 16,128, 0,158,231, 33,240, 60, 68, 50,149,210, 39, 44,
- 50,167,184,163,147,209, 36, 97, 45,221, 3, 8, 60,155,158,151, 88,177, 12, 74, 0,112, 87,136,176,243, 66, 6, 0,228, 80,134,
-155, 15, 70,188,235,116, 23, 90,237, 50,125,163, 58,117,132,214,173, 91, 23,201,229, 46,109,127, 69,249,249,249, 93,155, 57,115,
-102,253, 15, 63,252, 80, 42,145, 72,192,178,172,215,186,245,235,249,245,243,198, 97,208,228,181, 16, 75,164,176, 88, 29, 16,137,
-104, 20,234,140, 40,210,155, 97, 48, 51, 85,111, 65, 79,158,216,181,192,162, 3,251, 37, 3,123,170,154,182,145,144, 98,180,140,
- 8,192,185,147, 7,132,171, 39, 54,142,179,228,198,255,225, 98, 67,132,209,202, 32, 51,223,138,140,124, 43,178, 11,173,200, 46,
-176, 33,187,208, 10,130, 32, 96,181,179,175, 53,112,153,114,227,118,111,249,227,183,126, 54, 7,134,117,236, 49, 16,159,255,176,
- 54,100,203, 47, 11,207, 36, 10,228, 27, 46, 6,218,114,177,177,177,201, 31,124,240, 65,179,237,219,183, 83,141, 27, 55,182, 60,
-120,240, 64, 81, 76, 34, 29, 42,149, 66,190, 97,205,130,147,109,218,180,217,153, 17,255,240,108,177, 63,189,210,142, 61,164,211,
-251, 82,185,227,214,248, 96,101,251,158, 97,254, 10, 4, 43, 13, 61,235,171,238, 44,206,239,242,233,124,109,244,202,220, 44, 27,
-123, 90,107,161,154,103, 24, 69, 46,197,224, 49, 54,107,202,160,193,195, 64, 17, 36, 28, 86,115, 74, 73,227,210,184, 75, 48,107,
-235, 67,168,100, 34,168,229, 52, 84,114, 17,222,108,232,133, 42,244,103, 2,195,241, 48,219, 56, 88,108, 44,172,118, 22, 62, 65,
-158,248,117,203,110,164,230, 90,112,240,122, 30,226, 82, 12,168, 87, 83, 9, 65,168,188,155,228, 57,198,212,247,157,247,212, 20,
- 73,128, 34, 9,178, 97,253,112, 20, 24, 29, 16,211, 36,196, 50, 57,148, 82, 26,110,114, 17,196, 98, 17,114,115,115, 97,179,217,
- 16, 28, 28, 44,171,152, 10, 10, 80,171,228,168, 23, 90, 3, 14,134,197,177,139,247, 49,111,234, 32,116,239,216, 10,132, 72,133,
-135,182, 22, 80,123,169,193,147, 36, 28, 44, 15,187,131, 3, 64, 90,203,179, 23, 20, 20,212, 69,169, 84, 42,205,102,179, 33, 53,
- 53,245,124,118,220,254, 84,142,234, 63,254,196,169,232, 45,125,122,117,199,173,187,177,216,179,255,208,165, 60,111,221,180,146,
-103, 26, 53,106, 20,233,227,227,163,202,207,207,215,199,196,196, 92,123,213,121,129, 64,146,159,181,123,243, 45, 24,139,114,145,
-147,150,228,242, 44,186, 65,136, 26,223, 45, 88,219, 50, 34, 60,162, 37, 39, 56,137, 87,195, 96, 53,190,248, 97, 85,203, 58,245,
-194, 91,150, 44, 8,105, 16, 92,241,182,108,180, 66,221, 99,212,135,159, 47,232, 55,248,125, 68,159, 58,132,101,243,190,220,162,
-116,247,109,224,229,233,222,188,113,100, 15, 92, 58,115, 8, 50,181, 63, 60,189,253,223,124,111,204, 39,221, 6,191, 55, 1, 87,
- 46,157,193,202,133,223,108,230,108,134,109,174,164, 85,169, 9,245,109,214,162,205, 8,181,151, 31,138,116, 6,168, 61, 53,104,
-208,180,245,136,251,119,108, 95,155,114, 19,181,175, 76, 58, 4, 1, 54,135,128, 66,163, 3,105, 90, 11,146,179,157, 68,139,231,
-171, 16, 19,196,241,132, 74, 70,211, 94,204,227,224,123,103,162,133,144, 32, 63, 98,209,156, 47, 41, 7,100,208, 22, 57, 73,150,
- 86,111,135, 86,103,135,209,202,192, 75, 73,131,231,248, 42,207,186, 11,141, 14,168, 21, 34,184, 43,196, 46,171,140,101,225,231,
-223,119, 70,220,137,207, 28,176,108,217, 10,197,237,196, 82, 36, 75,228, 84,179,164, 98, 10, 28,207, 3, 46,188,241, 34, 90, 52,
-165,127,239,110, 72,203,179, 56, 87, 45,147, 4,234, 53,105, 3, 31, 57,143,174, 67,167, 3, 0,250,246,118,134,182, 37,102,153,
-112,248,170, 22,120, 62,176,187,226,190,216, 98,161,214,111, 61,250,217,238, 93, 59,220,173, 28,141,117,199,147, 97,182,177,144,
-137, 41, 72,197, 20,228, 98,234,185,120,236,202,137,150, 51,230, 46, 53,143,129,217,106,133,222,194, 64, 0,112,237,177, 17, 22,
- 59, 11,157,137, 65,100,125,207,215, 19, 66, 8,226,168, 32, 8,111,191, 72,136, 94, 36, 75,165, 20,169,178,108, 92, 47,109,163,
-228,254,242,136, 92,233,152, 45, 0, 85, 90,193, 69,191,200, 28, 75,255, 22, 43, 61, 27,184,171,221,175,158, 56,126, 68,181,255,
- 14,143,243,119,157, 36,139,177,228, 97,233,215,195,211,245, 69,121,157, 1, 60,113,245, 63, 83,248, 52,104, 42,147, 72,163,255,
-181, 98,157, 67,227, 23,200,239,187, 90,148,171, 51,115,207,177, 9,206,102, 35, 5, 94, 16, 91,115, 30,187,228, 67, 32, 73,194,
-241,195,228,129,224, 5, 1,179, 86,236,198,252,105, 67,161,146,191,167, 32, 8, 66, 97,178,178,152, 58,251, 55, 44,253,110,172,
- 90, 33,165, 65, 16,206,152,168, 81,195, 6,186,214, 0,173, 44, 18,254,222,110, 52, 36, 30,121, 80,218, 93,216,246,205, 94, 55,
-218,182,109, 91,228,233,233, 9,185, 92,254, 76,169, 40, 7,126,126,126,223,253,240,195, 15, 17, 19, 39, 78,124,186,217, 39, 77,
-211,248,248,163,143, 72,142, 19,112,252,248, 70,248,214,106,129, 67,167,175, 34,170, 75,107, 24,205, 86, 20, 20, 25,192,131,122,
-229,134,104, 40,202,139,206, 78,190,215,230,141,206,125,113,254,228, 1,225,234,241, 13,227,170,178, 71,143,167,151,103,218,205,
-123, 9, 13, 8,194,203,169,104, 21,147, 44, 59,195, 35,196, 79,129,180,228, 4,120,184,187,167,185,106, 79,238, 27,209,159, 32,
-133,137, 4,132,141,166,156, 71,187, 1, 8,166,172, 7,195,119,111, 91,127, 55, 54,230,246,188, 62, 35,166,208, 61, 6,127, 68,
-253,178,224,147,111, 0,184,186,241,158, 35, 46, 46,238,254,216,177, 99,219, 95,185,114,133, 3, 96, 38, 8,130,161, 40, 74, 97,
-183,219,197,157, 59,119,214, 61,124,248,240, 60,202, 14, 90,124, 14,111,126,176,219,135,144, 26,122, 73,120,199,240, 16,181,161,
-123,231, 14,237,208,174, 81, 16,210, 58,180, 3,128, 41, 41, 70, 85,132,181,206,111, 59, 25, 86,126,236,151,223, 15,207, 31, 55,
-180,219,212, 45,244,172,101, 89, 71,102, 85, 24,136,154,246,224, 66,207,178,104, 60, 77,145, 80,203, 69, 80,201,105,168,229, 34,
-168,101, 34, 48,172, 80,149,153,163,192,176,188, 83,209,178,179, 48, 90, 88, 68,223,206, 65,182,206,142, 34,131, 3, 22, 7, 7,
- 1,130,115, 54,234, 66,111,174,125,252,167, 71,201, 72,234, 17,220, 66,183,126,245, 18,183,189,151,211,159,174,232,115, 87, 72,
-160, 86, 56, 87, 99, 95,188,120, 17,222,222,149,207,246,121,158,199,158, 19,215,176,108, 83, 52, 78,108,252, 10, 50, 49,133,166,
-253,103,227,253, 1,109,193, 11, 60, 18,226, 98,115,234, 53,108,230, 71,146,114,144, 4, 1, 27,195, 3, 16,202, 45, 79,187,221,
-238,157,154,154,170,175, 91,183,174,127,141, 26, 53, 6, 83, 20, 37,192,112,219,118, 96, 71,129,249,236,145,109, 10,147,197,198,
- 41, 88,221,198,186, 89,150,183, 81,183, 46, 8,130, 16,220,220,220,196,209,209,209,198, 38, 77,154,248,190,226,171, 68,202, 53,
-225, 43, 63,156,244,217,224, 58, 97, 97,216,189,109, 35, 4,129,216,235,234,195, 91, 15, 95,193,156, 25,207,175, 48,252,226,135,
- 85, 45,151,206,158,242,220,181, 73, 51,150, 85,184,234, 80, 46, 85, 77, 27, 52,124, 60,110, 92,251, 11,139,103,127,177,195,102,
- 44,120,159, 97,153, 33, 5, 89,137, 59, 66, 27,182,133,224, 48,224,212,174, 37, 24, 58,114,156,180, 71,159,193,184,114,233, 12,
-230,127, 51,105,171,185, 40,247, 3,184, 24,228,204, 11,162,137,157,123, 14, 16, 89,108, 14,172, 90,244, 61, 38, 76,155,135,200,
- 46,125, 69, 49,183,175, 78, 4,240,163,203,225, 16, 14, 14,157,155,248, 56,201, 51,195,227, 80, 34, 69,151,213, 2,105,138, 32,
-155,135,121,192, 98,103,161,175,100, 82, 73,139, 69,217, 69, 58,125,173, 53,243, 63,163, 76, 86, 22, 90,157, 29,185, 58, 27,242,
-138,158, 17,172, 60,157, 13, 90,157, 29, 34,154, 64,252,147, 20,144, 34,186,202,241,121,133, 70, 6,109,194, 61,157,239,232, 43,
-122, 71, 24,218,173,237,137, 11,119, 6, 45, 91,182, 92,118, 39,201,128,187,137,250, 98, 37,139,130, 84, 68, 66, 82,252, 55,199,
- 59, 99, 35, 43,130,155,111, 88,232,232, 81,239,117,117, 83,201,145,249, 40, 23, 52,229,220, 34,198, 93, 19, 4,119,169, 21,159,
- 76, 26, 15, 31,111, 15,164,230,217,176,114,127, 60,238,222,127, 12,222, 82,181,108,175, 90,183, 35,234,195,143,191,240, 32, 69,
- 18,108, 62,153,228, 76, 39,197,225,225,213,195,214,204,132,123, 38,163, 62, 95,128,192,185, 24,131, 76, 8, 44,231,108,110,243,
-103, 77,199,142, 77, 63,225,228,205,220,167, 45,240,242,222,165,248,108,198, 92,228,233,237, 40,171, 93, 86,196, 71, 0,104, 75,
- 41, 81, 47,253, 46, 69,142,202,250, 77, 20,255,182,151, 99,195,254, 2,185,178,191,112,221,254,130,189,178,246,254, 91, 95,169,
-235,240, 37, 82,228,225,219, 88, 33, 83,254,117,252,248, 97,229,129,187,194, 83,146,229, 48,231, 9,243,166,244, 77,215, 23,105,
-123, 84,137,100,249,214,107, 44, 85, 72, 47,204,156,187,210,230, 23, 88,139, 61,118, 91,159,111,176,114,236,203, 49, 8, 74, 78,
-233,238,107,165, 37,210,101, 34,139,253,251,188,188, 7,166,202,148, 39, 94, 16,112,228,239,108, 8,130,115,138,180,235, 98, 6,
-138,103,230,224,120,167, 91,229,244,237, 92,208,197,113, 40,174,202,223, 63,175,251, 73,255,118, 19,157,105,196,252, 89, 79,221,
-133,145,205,156, 74,150,155,155, 27, 60, 60, 60,160, 82,169, 80,153,235,144, 32,136, 81, 31,126,248,225, 75,179,255,220,220, 92,
-116,235,218, 25,171,127,250, 21,205,186,142,198,233, 63, 79,194,193,240,104,218, 48, 12,181,106,120, 34, 45,199,240, 74, 47,186,
-210, 47,226,227, 54,157, 7,124,243,102,151,190,136, 62,177, 79,184,122,226,247,241, 85,221, 8,241,237,110,237, 15,207,153, 51,
- 43,116,230,188, 53, 82,181,140,198, 3,163, 29, 36, 65, 32,196, 79, 1,111, 37,137,243, 7, 54, 91,135,246,109,239,242,230,120,
- 65, 65,129, 91,150,174, 94,175, 92,186,112,118,231, 27, 55,137,104, 99,102,124, 1, 0,152,115,226, 22, 61, 4,238,215,252,235,
-212,177,102,157, 6,194,175, 70, 88,247,196,156,135, 46,147, 13, 0,230, 39, 79,158, 36,206,156, 57, 51, 98,225,194,133, 2, 69,
- 81, 60, 0,233,138, 21, 43,204,143, 30, 61,186, 13,231,210, 92, 84, 54,216,116,237,222,104,170, 74,194, 69,122, 41,200, 70, 97,
-254, 10,180,107,228,244,138, 14,125,251, 77, 4, 5, 7,227, 73,182,185,121,129,153, 23, 25,237, 84,216,218,117,119,175,215,246,
-161,198,177, 22,251,125, 0, 7,171, 90, 63, 4,158, 5,200,151,168, 89,106,185, 8,188,179,173, 84,137,104,217, 28, 28, 44, 54,
- 14, 22, 59, 11,147,157,131,217,206,129, 23,156,239, 4, 65, 16,112,176, 60, 92,154, 54,191,208,246,221,188,124, 16, 86,155,128,
-155,194,153, 54,183,226,237, 30, 8, 0,222,222,222,208,104, 52, 46,169,162,118,135,243, 21,183, 51,252, 83,183,190,221,193, 66,
- 16, 4,196,199,199,125,149,156,152,216,191,110,189,186, 29, 27, 54,109,230,165,144,146, 0, 80, 46,209, 50,155,205,156, 90,173,
-214,120,121,121,145, 25, 25, 25, 79,201,115,221,230,157,217,253,251,246, 98,208,160,129,198, 7,215,238, 60, 93,226,110,177, 88,
-136, 55,222,120,195, 45, 40, 40,136,180,217,108,250,170, 86,147,210, 55,124,128,167,183,215,188, 81, 31, 76, 8,239,220, 45, 10,
-231,206,158,194,193,125,219,255, 48,107,227, 79,185,106, 36, 34,162,254, 75,171, 14,235,212, 11,127,105,213, 97,173,208,122, 21,
- 18,173,134, 77, 91,183, 21, 8, 26, 39,143,236, 18,172,164, 99, 18, 0,158,179, 26,118,237,252,249,187, 31,135, 79,156, 81,167,
-119,191,225, 24, 53,242,125,208, 52,133,243,167, 15, 99,233,236,207,143, 26,117,185,163, 93, 9, 19,112, 74,111, 13,196,129,242,
-160, 79,131,235, 52,198,205,171,151,144, 16, 31, 19,123,231,250,149, 70,117,155, 68,194,183, 70,200,167, 41, 62,212, 66, 60,120,
-224,168,204,140,221,106, 77,121,127,244, 72,148, 94,117,216,174, 69,132, 55,241,226, 11, 0,192,108,200,117,108, 88, 50,245, 81,
-201,170, 67,222, 97, 79, 41,207,174,174, 80,187,231,252,159,127, 79,235,255,118, 20,153,167,183, 59, 21, 44,157,189,248, 99, 67,
- 94,201,223,122, 27,234,213, 80, 33, 46,246, 38,111,213,229,237,173,226,123,105,125,127, 72,207,251, 37,109,151,231, 5, 16,128,
-181,202,110, 41,145,219,248, 69,139,151,201,238, 36, 26,113, 55, 73,239,116, 21,138, 40, 39,193, 18,145, 79, 73,151,115, 53,123,
- 37,234, 16, 65,205, 31, 51,122, 24,242,244, 14,240, 60, 64, 83,100,241, 71,140, 84, 3,129, 52,131, 25,121,133, 90, 36, 38,167,
-160, 40, 59, 1, 36, 73,194,167, 70,184,203, 59, 73,115,130, 36,192,108, 23,154, 12,126,187, 35,189,239,175, 44, 40,164, 52,108,
-134, 28, 28,223,185, 68,107, 51,234,231, 89,204,198,125,174,236,231,248, 44, 4,129,208,234,141, 86, 63,169,136,194,238, 77,107,
- 48,228,253, 73,207,245,190, 95,125, 59, 7, 32, 9, 20, 20, 26, 64, 16,132,182,106,253, 18,113,189,162,223,175,168,140,189,182,
-141, 50,200,214,203, 19,133,242,103,163,194,241, 83, 39, 14, 43, 47, 39, 75,113, 45, 46,171,152,100,105,249,185,147,223, 78, 55,
-232, 10,122, 2,136,175,218,188,144,236, 57,116,204,180,216,176,240,134,182,115, 49,198,164, 34, 19, 83,110,156, 67,187,193, 51,
- 99,111, 28, 93,221, 91,199, 60,249, 72, 25,208,144,227, 89,118,145, 69, 27, 63,187, 28,215,161,100,246,202,221, 79,221,134, 95,
- 47,220,236,252,155,227,192, 9, 60, 4, 30,248,228,187,159,193,242, 28,120,142, 3,207, 9, 96, 56, 65, 81, 89,114, 53, 53,106,
-237, 43,124,184,171,254,136, 31, 95,118, 23,122,120,120,192,219,219, 27,222,222,222,112,115,115,171,148,104,137, 68, 34, 21, 77,
- 63, 95,212, 41, 41, 41, 72, 78, 78,134,155,155, 27, 4,158,129,157, 1, 26, 71,246,192,189,132, 24,156,185,124, 27, 2,207, 65,
-169,170,250, 41, 47, 74,191,136,143, 90,191,213,127, 77,151,126, 99,113,122,223, 58,225,250,197,195, 19, 44,185,241,191,185,172,
-208,115, 28,193, 48, 12,222,238,241, 86,202,173,216,199, 39,190,157, 54, 49,170,125,159, 9,210,118, 17,129,176,218, 57,164, 39,
- 39,224,252,129,223,173,225,161, 1, 39,187,118,104,155,194, 48, 12, 56,142,171,116, 32,183,218, 29,121,148, 72,174, 28, 54,108,
-132,232,250,181,107,123,149,190,245,118,115, 4,121,135, 16,248,166,132, 32, 12,106,218,180, 1, 28, 12, 15,179, 89, 95, 88,213,
- 60, 27, 12,134,196,141, 27, 55,134,142, 30, 61, 90,209,176, 97, 67, 81, 66, 66, 2,150, 46, 93,154,111, 48, 24, 18, 93,181,113,
-234, 98,220, 10,154, 40,124, 84,162,104,165,190,217, 14,195,250,188,137, 29, 71, 47,227,252,165, 43, 72, 49,170,110, 27, 89,250,
- 64, 90, 74,166,173,145,151,126,111,191,118,181,168,221,155, 10,247,198,190, 53,253, 93, 65,144,158,202,187, 48,203,228,250,203,
- 13, 24, 44, 12,220, 20,206,253,158, 74,148, 45,138, 32, 92,102, 68, 4,144,120,233,202,205,198,173,234, 53,196,173, 68, 29,114,
-139,108,176,216, 88,240,188, 0, 30, 2,188,213, 18,200,196, 36, 82,147, 19,193, 11,142,164, 42, 14, 21,218, 78, 29, 59,209, 0,
- 1,130, 16,104, 17, 77, 67,128,115,127, 69,185, 92,110,212,104, 52, 46, 41, 90, 14,150,197,160,168,182,136,108,221, 20,253, 39,
- 56,247,204, 60,251,199,116,120,170, 68,216,177,229, 55,164, 93, 92,177, 37,180,221,196, 83, 49,247, 98,223,137,189,245,215,136,
- 94, 45,229,205,253,233, 76,113,121, 50,169,201,100,218, 11, 64, 34, 22,139,163, 58,118,236,232,181,119,239,222, 34, 31, 31, 31,
- 94, 34, 22,107,251,245,237,195,139,196,226,130,146,123,255,252,243, 79,209,132, 9, 19,212,133,133,133,169, 57, 57, 57, 87, 0,
- 48, 21, 79, 4, 35,186,129,196,118, 16,132, 76, 37, 87,164,212,174, 29, 86,163,117,100, 91,247, 1,131,134, 64, 42,145,226,244,
-169, 19, 88,181,124,225, 46, 99,214,131, 49, 85, 41,201,127,106,213, 97,122,106, 82,162,217, 98,107,210,184,213, 91,196,165, 83,
- 7,166, 56,224,179,156,146, 58,150,116, 27, 52,169, 78, 98,166, 17,171, 22,124, 5, 79,119, 37,146, 18, 30, 90, 30, 61,184,247,
- 51, 99,213,127,229, 50,201, 2,160,200,231,222,105, 55, 50,202,211,230,224,112, 49,250,168,149,103,249,168, 43, 23,142, 37,212,
- 12,111, 45,107,220,186,171,103,222,193,223, 6,153,129, 29,149,217,201,120,248,178,130, 43,216,139,146,206, 70,159,113,247, 11,
-105, 68, 17, 32,224,176, 89,161,125,114,157, 53,231, 60,212,235, 51, 98, 92, 90,133,155,159,134,239,102,252,240,175,143, 90,183,
-106,165, 20, 32,123, 78,193, 42, 33, 88,121,122, 59,124,212, 18, 88,244, 90, 60,186,126,194,106,214, 82, 21,238,119,198,218, 77,
-138,188,220, 28,201,179,112,134,248,200,138,238,207,203,205,145,176,118,147,162,242,161,142,130,155, 82,130,123, 73, 25, 79, 3,
-223,165, 34,103,108,150, 68, 68, 61,141,211, 42,233, 11, 42,193, 91, 98,153, 7, 50,242,173, 32, 32,128,231, 88,176,140, 29, 6,
-189, 30, 25,153,217,200,201,206,129,193, 80, 4,133,202, 19,141,155,183,129, 90, 41,195,157,243,187, 32, 8,130, 75,251, 26, 50,
-132, 40,162,117,100, 7,105, 76,178, 51, 22, 75, 38, 18,112,120,251,194,124,163, 62,183,131, 49,235,209,163,170,246,197, 44,199,
-157,185,123,255, 81,163,154, 1,181,137,219, 9, 58,108,249,117, 53,236,197,202, 38,195,112,136, 73, 53, 33,171,192,140,212, 39,
- 15, 4,158,227,206,224,255, 8,232,242, 5, 64,208, 77, 27, 55, 64,143,247, 6,224,167,159,126,198,147,196,100,126,222,148,222,
-169, 70, 67, 81,175, 42,144,172,110, 40,222,107,195,156, 19,183,200,226,217, 58,253,208,173, 2,210, 98, 23, 42, 12,240,145,249,
-134,160,195,152,165, 39, 45,134, 2, 9,103, 51,211,135,183,140,217, 94,150, 77, 39,131,134,125,222, 23, 67,161,146,211, 32, 8,
- 2, 37,238,194,181,115,198, 67, 33,117,250,150, 45, 54, 22,239, 77, 93,134, 45,203, 62,135, 0, 96,248,144,203,230,242,210, 9,
-231,217,133,159, 4,224, 90,205,148,228,220,140,110,125,191, 56,107,117, 72,109,125, 6,142,190,209,170, 85,171, 34,185, 92, 14,
-185, 92, 14, 55, 55, 55,120,122,122,194,195,195,163,210,188, 51, 12, 99,180,219,237,222, 18,137, 4, 60,207, 35, 41, 41, 9, 73,
- 73, 73,208,233,116,208,106,181, 48, 25,245,236,181,179,187,233,198,237,122,163, 70, 88, 19,132,212,107, 6, 17, 69,128,166, 73,
-156, 63,244,107,121,233, 44,155,100,117,234,183,182,107,255, 15,113,122,223,122,225,250,197,195, 19, 45,185,241,191,186, 90, 71,
-197,238,158, 59,131, 6, 13,106, 50, 97,194, 4,241, 15,211, 38,156, 60,122,234,124,252,238, 35,235,251, 22, 22, 22, 5, 9,130,
- 0, 15,119,247,180,161,125,219, 31,238,252, 70,235,148,179,103,207,242,219,183,255, 63,246,238, 59,174,234,234,255, 3,248,235,
- 14,184,131, 11, 92,246, 30, 38, 67, 92,160,104,166,162, 56, 83, 75, 83, 83, 83,115,102,206,242,167, 13,115,164,137,166, 86,106,
-238,180, 52,247,200,189,194,109,185, 35,149,139,226, 6, 4, 1,145, 61, 46,151,187,231,249,253,193,200,148,233,248,182,222,207,
-199,227, 62,224,194,189, 47, 62,235, 94,222,247,124,206,231,156,159,116, 28, 14,231, 70,117,153,165,111, 82,185, 91,126, 57,253,
-235,156,246, 29, 58, 98,253,230,159, 58,220,186,125,167,195,253,251,137,240,245, 15,192, 43,245,131,161,230, 56,226,215,115, 23,
-160,148,231,110,169,205,114, 62,209,170,197, 41, 42, 42,250,109,208,160, 65,221, 46, 94,188,200, 29, 52,104,144, 58, 63, 63,255,
-210, 99,173, 88,172,166,204,152, 31,222,206, 3,176,197,191,195,200,221,143, 12,242,201, 0,190,241,243,247,195,217, 11, 49,136,
-185,120,249,251,124, 27,191,185,163,134,190, 55,182, 94,111,222,232,222,109,234,241,220, 28,109,176, 99,221, 18,222,225,152,212,
-165,169, 5,230,245,223,156,155, 51,175, 54,251,168,226, 31, 71,137, 1, 17,141,156, 96, 52, 51, 88, 88,233, 27,174,157,200,170,
-170, 55,222,167, 50,249,122,225,168,241,227,198,221,111, 26,214,252,163,161,239,141,183,110, 30,224,139, 43, 73,114,128,195,129,
-147,135, 4, 89, 89, 89, 56,191,119,157,169,232,209,221,239,121, 60,203,151,117,216,158, 40, 74,187, 22,244,216,221,177,249,249,
-249, 56,123,246, 44,202, 11, 44, 87, 87,215,170, 10,173, 63,101, 22,228,100, 94,154,183,120,109,196,152,225,111,163, 87,199, 38,
- 56,119,245, 62,244,101,227, 53,149, 95, 74,158, 18,243,131, 96,242,160, 0,253, 7,253, 26, 40, 52, 70, 65,234, 23, 15,138,207,
-163,116, 14, 86, 75, 21,203,169, 47, 44, 44, 60,124,239,222,189,118,205,154, 53,171,119,244,232,209,194, 91,151, 79, 76,122,124,
- 33, 62,253,244, 83,219, 53,107,214,216, 48,198, 46,233,245,250,228, 90,173, 59, 23, 59,100,177,177,206, 6,163, 5, 23, 46, 95,
-111,212, 37,162, 57, 44, 12,184,122,245, 42,214,111, 88,175,189, 17,127,237, 91, 85,142,199,151,213, 20, 47,149,110, 79,243,243,
- 93,117, 88,145,153,245, 40,245,219, 83, 71,246,110,123,181,195, 91, 24, 50,241,203, 47,207, 30,249,105, 78,139,246,189,184,141,
- 94,237, 6, 89,204,175, 56,125,244,248, 66,131,178,112, 14,106,238, 59, 82,233,114, 10,197, 54,255,215,184, 69, 7,164,167,165,
-226, 65,226,205, 45,218,194,164,204,180,251,188, 45,153, 25,105,227,235, 55,137,192,197, 19, 59, 39, 85, 83,104, 85,123,204,251,
-186,138,215, 29,141, 62, 60, 56, 35,227, 7, 15,149, 70, 43,100,140,105,133, 2,126,182, 45,183,100,151,162,214,203,121,199,144,
-151, 89,175,223, 59, 67,199, 31, 89,185,114,153,149,187,131, 13,178,139,180, 80,104, 12, 40, 81, 27,192,229,112, 16,228, 37,129,
-186,164, 16,231,246, 46, 54,234,149, 69,131,128,251,134,170, 50, 37,110, 33,243,139,146,126,157,248,233,132, 51, 16, 72,125,189,
- 94,233, 60,163,218,214,186,146, 71,215,222,250,116,194,207, 33,140,177, 46, 18,183,144, 18, 85,238,189, 89, 85,173, 59,135, 83,
-250,250, 30,210,201, 23, 6, 83,233,248, 99, 38, 11, 96,182, 88,202, 90,249, 0, 86,113, 62,159, 83,195,186,115, 44,187,142, 92,
- 66,102,142, 28, 26,189, 17, 58,189, 9, 6,163, 25, 92, 30, 15, 14,142, 14, 8,126, 37, 28, 82, 7,123,228,100,103, 34,230,151,
-195, 72,136, 63,119,137,195, 48, 87,147,151,248, 75,109,246,145,181,216, 33,196,211,203,131,155,165,208, 67, 44,224,225,218,185,
-163, 6,163, 94,247,109, 45,139,172,167, 50,229, 5,133, 75, 63,154,242,217,187,155, 54,110,246, 8,173,111,143,140,124, 13, 50,
-242,180, 40,209, 26,203, 10, 49, 11,116,202,124,196,255,186, 57,219,172, 45, 89,138,255,136, 42, 11, 45,147, 65, 91,178,239,248,
- 21,231,233,115, 22,243,146,238, 39, 27,231, 79,238,153,161, 81, 42,222,172,115, 75,214, 99, 54,125, 88,127,231,203, 88,137,167,
- 78, 23, 50, 11, 44,140,225,231,203,217, 21,167, 11, 45,101, 61, 47,227,238, 87, 63,141,224,227,115, 23,118,124,115,210,169,248,
-123, 37,219, 53,154, 28,233,221,164,111,139, 0,128,199,227, 85,220,202,251,102,105,181, 90,125, 13,167, 80,182,254,248,227,143,
-211,198,143, 31, 47,124,248,240, 33,238,223,191, 15,185, 92, 14,145, 72,132,227,199,143, 27, 97, 49,125, 27,127,241,192,131,123,
-178,147,179, 67, 90,118,243, 9,109,243, 38,108,108, 36,224,179,218,119,198,180,113,107, 48,184,101,135,222,223,117,233, 59, 6,
-167, 15,252,200,174,158, 59, 60, 65,147,151,176,174,174,219, 82, 46,151,223, 2,144,248,237,183,223, 54, 95,191,126,125,253, 41,
- 83,166, 36,111,253,110,206, 74, 0, 40, 40, 40, 0, 0,196,197,197,177, 9, 19, 38,232,180, 90,109, 74, 81, 81,145, 12, 53, 92,
- 0, 1, 0,154, 60,155,175,214,175,254,166,233,195, 71, 89,111, 7, 52,109, 5,215,250,173,224, 17,244, 26,138, 74, 12,184,146,
-148,137,228, 59,191,224,206,133,189, 71,213,182,166, 57,168,227,248,198,205,154, 53,243,229,114,185,175, 40,149, 74,143,198,141,
- 27, 55,147, 72, 36,113,205,154, 53, 11,231,243,249, 25,177,177,177,169,117,201, 74, 59,183, 89,231,223, 97,228,138,180, 18,187,
- 78,201,217,234,240,180, 18,187, 56,181, 80,250, 73,222,175, 43,116,155,120,222, 75,153, 33,255,214,158,205,138,125, 59,214, 45,
-225, 13, 29,251,169,249,102,177,227,100,190, 88,112,170,110,205,213,220,172, 15, 70,244,249, 99,120,135,178,150,172,178,239,107,
-213, 76, 95, 92, 28, 95, 12, 96, 90,252,109,171,239,110, 78, 30, 55, 47,236,213,136, 97,145,111, 12,226,154,172,109,113,226,192,
- 15, 44, 37,254,215, 61,124,102,158,169,169, 69,170, 17, 16, 0, 0, 32, 0, 73, 68, 65, 84,197,108, 0, 53,158, 14,210,235,107,
- 83,100, 61,189,140, 15, 37, 29,247,252,180, 97,228,190, 3,251,191,238,219,187,143,243,234, 47, 6, 98,241,218,131,144,136,133,
- 96, 22, 11, 6,118,242, 29, 48,123,116,195,183,124,221, 69,222,251,206,100,156,159,184,236,230, 52,181,218,144, 80,139,150, 24,
-150,159,159,127,193,214,214, 54,175, 93,187,118,173,133, 66, 33, 39, 63, 63,159,239,230,230,102,146, 74,165,250,140,140, 12,181,
- 78,167,219, 7,160, 78,195,142, 27,140, 22, 60,200,209,226,208,254,125,184,126,249, 23,220,185,115,175,228,206,237, 59,171, 56,
-124,182, 76,149,147, 88, 8,212,249, 3, 62, 44,149, 94,117,200,234,124,213,161, 89, 87,178, 99,235,247,243, 59,171,181,186,145,
-205,218,246, 68,189, 70, 17, 92,131,209,140, 27, 87,207,224,204,222,101,139, 13,202,194,233,207,179,143,189,124,234, 7, 51,158,
- 0,191,157, 61, 2,102,177,124, 15, 0,204, 98,249, 62,238,226,209,241,175,189, 57, 26, 78,110,245,154,201,211,227, 56,120,134,
-209,195,173,249, 92,213,177,125,155, 14, 60,120,240, 0,119,239,222, 69, 82, 82, 18, 10, 11, 11,177, 99,199,131, 58,237, 31,117,
- 81,234,169,132,219,220,238,253, 7, 14,249,121,192,224,225,162,250,193,161,220, 16, 31, 71, 56,219,242,113, 47, 41, 21, 9,177,
-241,150,123, 87,142,106, 13,138,220,190,154,162,212, 42, 11, 63, 27,151, 70,238,128,121,122,249,220,133,109,218, 68,132,124,182,
-224,235,214,206,174,110,149,190,143, 23,228,229, 10,166, 78, 60, 28, 18,243,251,111,181,154,235,208, 98, 54, 23,140, 29, 57,200,
-194, 43,157, 40, 20, 21,237,212,101, 91,175,244,195, 84,233,207,153,197, 84, 99, 11,254,123,111,183,135,201, 98,129, 74, 99,128,
- 66,165, 67,113,137, 22, 89,185, 5,184, 30, 31,143,115, 63, 31,198,253,123,215, 83,140,122,253, 73, 46,151,179, 87,147,147,112,
-174,110,103,154,248,245,157,157,156,144, 82,168,132, 72,192, 71,106, 66,172, 78,165, 40,222,254,172,199,145,166, 32, 49, 43,151,
-199,233, 54,104,208,224,227,157,187,247,150,190,218,182,171,141,139,189, 3,172,249, 12,137, 15, 50, 33,187,116, 92,149,124,253,
-188,194,168, 87,246,120, 17,179,190,252,205,213,124,213,161, 65,167,122,235,221, 62, 29,246,243,120,124,129,197, 98,210, 25,244,
-186,254,207, 83,100,189, 44,140,153, 51, 70,190,251,246,159, 62, 27,152, 44, 76,252,238, 59, 39, 52,143,127, 86, 48,154,153,205,
-187,239, 92, 82,151,190,129, 84,221,177,207,211,211,169,103,249,220,133,105,105, 5, 87, 11, 11,117,103, 0,100,104,181,218,103,
- 94,198,156,156,156,121, 11, 22, 44,232,165, 86,171, 27,118,236,216, 81,104,111,111,143,130,130, 2,156, 60,121,210, 24, 29, 29,
-125, 59, 55, 55,119, 54,144,107,210, 32,124, 75,188,246,192,136,123,177, 39,103, 55,108,217,221, 39,180,237,155,181,127, 51, 19,
-138,199,116,238,253, 62,231,244,193, 31,217,149,179, 7, 63,208,228, 37,174,125,142,205,106,208,106,181,151,181, 90,237,205,153,
- 51,103,190,234,238,238,238, 62,123,246,108,145, 66,161,176, 90,189,122,181, 54, 63, 63, 63, 91,161, 80,196,160,154,254, 52, 79,
-139, 51, 22, 63, 66,191, 99,251,126,236,196,246,253,248,186,131,139,119, 55,169,171, 79,160, 60,239, 81, 74,113, 94,230, 73, 0,
-167,203, 6,138,172,147,230,205,155, 7,112, 56,156, 65, 0,154, 74, 36,146, 32, 91, 91, 91, 33, 99,172, 33,135,195,185,101,177,
- 88,226, 27, 55,110, 28,125,251,246,237, 58, 13, 38,155,118,110,179,206, 55, 36,226,167, 66,181,197, 90,207,181,254, 41,237,220,
-102, 29, 0,228,158,250, 76, 13,224,208,237,142,211,250, 29,142, 73, 93,121,171, 72, 58, 41,239,236,215,135,235,186,204,197, 25,
-215,131, 94,212,241,175,205,186,157, 1, 96,100,124, 44,150,220,136,139,137,226, 48, 88,153, 97,154,175,201, 77,138,125, 17,249,
- 86, 86, 86, 90,111,111,239, 74,175, 46, 20, 10,133, 90,157,174,186, 6,148,115, 38,101, 22,214, 3, 29, 54,239,223,189,121,228,
-193,195,135,190,142,236,210,215, 89,228,227,131, 87,220, 56,216, 60,189,197,164, 95,226,242,174,244,254,236,252,154,228, 76,109,
- 60,234,216, 31, 70,169, 84, 38, 0, 40, 82, 42,149,125, 24, 99, 15, 57, 28,142,111, 81, 81,209, 53,163,209,120,163,206, 5,129,
- 5, 67,218,180,105,181,131,195,225,240,153,201,178, 40,198,138,247,147, 54,235, 78, 6,158,115, 90,146,208, 87,236,241,241,236,
- 21, 45, 2,131, 26,180, 40,159,235,176, 73, 61, 59,140,155,182,164, 69,189,250,193, 45,254,152,255,176,198,110, 2,204,168, 46,
- 26,181,127,195,162,243,113,191,159,249,220,197,179, 94,189,236,140,228, 59, 15,147,174,205, 51,107, 21,251,159,119, 63, 63, 72,
-186,181,108,253,183,211,166,100, 61, 74, 89,175,206, 75,188, 9, 0,234,188,196,155,119,100,248, 34, 63, 59, 99, 74, 65,110,242,
-183,207,186, 45, 84, 42, 85,230,246,237,219, 29, 34, 34, 34,184,238,238,238,200,203,203,195,153, 51,103, 44, 22,139,229, 81,157,
-179, 10, 83,206,168, 10, 57, 78, 91,214,126,183,200, 90, 98,247,166,201,100,242, 98, 12,224,243,249, 89,122,181,226,120, 9, 87,
-242, 25,138, 82,181,213,255,207,176,112, 0,112,203,231, 46,180, 88, 44,156, 69, 43, 55,167, 90,137,236, 42, 29, 12,209,168, 45,
-177,177, 88, 44,181,158,235, 80,158, 46, 11,124, 81,175,111, 14, 99,115,155,181,108,253,185,209,104,208,150,189, 62,180, 0,180,
-140,161,128,203,229,156,227, 89,140, 39, 20,207,241, 97,138,195,129, 61,227,240, 97, 39,230,131, 3, 14,148,197,133,172, 46,125,
-178, 42, 45,136,115, 19,110,169,115, 59,248, 31,211,239, 30,241,235,169,163,239,152,205,230, 87,202,218, 12, 30,232, 52,170, 61,
-202, 44,199, 45, 64,172, 9,255,126, 71,202,139, 45,206, 75,254, 67,181, 58,141,242,119,202, 12,169, 47,238,227,227,237, 62,226,
- 65,106,238,149,228,135,234, 45,248,243,180, 58,207,179,156, 60,119,119,247, 47, 56, 28,206, 48,129, 64, 96,171,215,235, 85,140,
-177,173, 57, 57, 57,243,240,212,228,191,225, 86, 98, 55,205, 8,129,200,102,150, 65,171,250, 77,157,155, 48,164,166,117,183,113,
-109,208, 77, 36,145, 76,211,106, 84, 91,213, 57, 9,155, 95,240,246,148, 10,133,194,112, 91, 91, 91,171,252,252,252,203, 0,138,
-255, 78,251,189, 89,179,102,126, 92, 46,247, 21,139,197,226, 14, 64,138,210,171, 66,242,249,124,254,163,178, 22, 45, 86,215,204,
-118,239,237,113,233,242,122,147,143, 79,158,191,183,188,236,180, 98, 5,239, 1, 75, 69,195,222,236,244,233,150,253,135, 42,187,
-234,240, 31,119,204,255,239, 50, 59,240,109, 61,243, 71,114, 5,210,249, 93, 66,180,234,252,204, 71, 19, 46,220,200,187, 12,160,
-228,121,150,211,218,218,122,168,193, 96, 16, 91, 91, 91,107, 12, 6,195,246,191,203,186,139,221, 66,222,231,130,213,122,102, 10,
- 11, 56,177, 79, 92,180,242,111, 57,150,120,161,161,161,237,173,173,173,253,204,102,179,141, 94,175, 87,107, 52,154, 7,169,169,
-169,191,161,234,137,207, 95,234,114, 74,220,130,151, 89, 91, 11, 39, 3,128,193,160, 91,161,202, 77,252,184,186, 39, 86,243,248,
-127,244, 62,114,121,165,101, 34,159,103,229,138,178,129,185, 45, 38, 83, 94, 78,202,213,224,191,112, 57,201, 51,238, 92,202,164,
- 76,202,164,204, 39,113,105,123, 82,230, 95,153, 41,242,108,228, 43,242,108, 84,235, 65,151,171,120, 60,109, 79, 82,110,108, 37,
- 55, 0,181, 24,176,148, 16, 66, 94, 2, 11,109, 2,242, 87,210,102,221,121,248, 50, 31, 79,254,115,170,236, 19,205,169,166, 42,
-173, 75,147,224,179, 84,182,167, 41,147, 50, 41,147, 50, 41,147, 50, 41,243, 63,151, 89, 83,246, 63,241,148,228,216, 39,238, 31,
- 1,240, 63,233,240, 79,205,170,148, 73,153,148, 73,153,148, 73,153,148,249, 95, 83, 81,120,113,105, 91, 16, 66, 8, 33,132,188,
- 28,212, 71,139, 16, 66, 8, 33,228,249, 84,118,234,144, 10, 45, 66, 8, 33,132,144, 23,160,202,206,240,116,234,144, 16, 66, 8,
- 33,228,249,148,183,104,121,226,137,225, 29,168,208, 34,132, 16, 66, 8,121, 49,178, 80, 89,235, 86,116,116, 52,171,236,123, 66,
- 8, 33,132,144,255,133,127,120, 45,242,120, 75,214,216,178,251, 0, 30,107,209,162, 2,139, 16, 66, 8, 33,127,151, 98,235, 31,
-166,188, 37,171,252,150,245, 84,161,213,171, 87, 47, 14, 21, 91,132, 16, 66, 8,249,171,252, 27,107, 17,238,147, 43, 72,187,153,
- 16, 66, 8, 33,127,101,177,245,111, 90, 31, 26,222,129, 16, 66, 8, 33,228,249,120, 2,232,249,216,253,255,217, 20, 60,132, 16,
- 66, 8, 33,255,118, 99,171,186, 79, 45, 90,132, 16, 66, 8, 33, 47,190,216, 34,132, 16, 66, 8, 33,255,100, 52,179, 57,101, 82,
- 38,101, 82, 38,101, 82, 38,101,254,219,149,143,163, 5, 84, 53,142, 22, 33,132, 16, 66, 8,121, 38, 61, 81, 58,126,214,216,178,
-175, 61,169,208, 34,132, 16, 66, 8,121,177,158,154,126,135, 10, 45, 66, 8, 33,132,144, 23, 91, 96,173,163, 66,139, 16, 66, 8,
- 33,228, 37,163, 66,139, 16, 66, 8, 33,228, 37,225,160,234, 43, 7, 78,215, 33,231, 89,174, 62, 56, 77,153,148, 73,153,148, 73,
-153,148, 73,153,255,185,204,154,178, 79,227,159,167,124,100,248, 35,248,163, 35,252,186,255,197, 31,166, 75, 95, 41,147, 50, 41,
-147, 50, 41,147, 50, 41,243,223,110,236, 19, 95, 43,208,169, 67, 66, 8, 33,132,144, 23, 91,108,209, 20, 60,132, 16, 66, 8, 33,
- 47, 72,149,167, 9,169, 69,139, 16, 66, 8, 33,228,249, 84, 57,169, 52, 21, 90,132, 16, 66, 8, 33, 47,167,224,162, 66,139, 16,
- 66, 8, 33,228, 5, 22, 89, 99, 43,253,109,116,116, 52,163,109, 68, 8, 33,132,144,191,202,191,182, 22, 41, 95, 49, 42,182, 8,
- 33,132, 16, 66,181, 72,157,121,226,143,171, 13,199,150,221, 7, 64, 87, 29, 18, 66, 8, 33,132, 60,175,158,248,243,149,135, 99,
-203,239, 83,161, 69, 8, 33,132, 16,242,252,198, 86,251, 91, 58,109, 72, 8, 33,132,144,191,210,191,177, 22,225,208,110, 37,132,
- 16, 66, 8,121, 46,149,181,102,173,163,205, 66, 8, 33,132, 16,242,114, 11, 46, 66, 8, 33,132, 16,242, 50,138,172,151, 61, 96,
- 41,205,108, 78,153,148, 73,153,148, 73,153,148, 73,153,255,149, 34,235,241, 33, 30, 0,208, 85,135,132, 16, 66, 8, 33,207,139,
- 38,149, 38,132, 16, 66, 8,121, 73,104, 82,105, 66, 8, 33,132,144,255,113,193, 69,133, 22, 33,132, 16, 66,200, 11, 44,178,254,
- 84,108, 81, 31, 45, 66, 8, 33,132,144,231, 83,101, 31, 45, 14,170,190,114,224,116, 29,254,192,179, 92,125,112,154, 50, 41,147,
- 50, 41,147, 50, 41,147, 50,255,115,153, 53,101,159,198, 63,223, 88,252,143, 6, 44,165, 75, 95, 41,147, 50, 41,147, 50, 41,147,
- 50, 41,243,191,134,134,119, 32,132, 16, 66, 8,121,209,133,213,147,168,208, 34,132, 16, 66, 8,121, 62, 52,142, 22, 33,132, 16,
- 66,200, 75,226,137,210, 86,173,242,175,225, 84,104, 17, 66, 8, 33,132,188, 24, 61, 81,218,170, 85,254,149, 10, 45, 66, 8, 33,
-132,144, 23,168,210,113,180, 56, 0, 16, 29, 29,205,202,238,119,236,213,171,215, 57,218, 86,132, 16, 66, 8,249, 95,250,183,214,
- 34, 21, 45, 90,189,122,245,226, 0, 56, 75,187,154, 16, 66, 8, 33,127,133,127, 99, 45,194,125,162,146,236, 72,187,153, 16, 66,
- 8, 33,127,133,127, 99, 45,194,127,162,138, 36,132, 16, 66, 8,249, 75,252,131,107, 17, 79,148,118,132, 63, 82,246, 21, 40, 27,
-242,129,198,209, 34,132, 16, 66, 8,121, 62,229, 87, 27, 62, 53,245, 14,181, 98, 17, 66, 8, 33,132, 60,159,202, 70,134, 95, 71,
-155,133, 16, 66, 8, 33,228, 37,162, 22, 45, 66, 8, 33,132,144,231,247,120,171,214,255,172, 53,139,102, 54,167, 76,202,164, 76,
-202,164, 76,202,164,204,255, 82,145,245,167,251, 52, 50, 60, 33,132, 16, 66,200, 75, 66, 87, 29, 18, 66, 8, 33,132, 60,159,242,
- 43, 14, 31,191, 79,133, 22, 33,132, 16, 66,200, 11, 44,182,158, 66,167, 14, 9, 33,132, 16, 66,158,207,216,170,126, 65,133, 22,
- 33,132, 16, 66,200, 75, 42,184, 56,168,250,202,129,211,117, 8,126,150,171, 15, 78, 83, 38,101, 82, 38,101, 82, 38,101, 82,230,
-127, 46,179,166,236,211,248,231,249,203, 6, 44,165, 75, 95, 41,147, 50, 41,147, 50, 41,147, 50, 41,243, 63,139, 78, 29, 18, 66,
- 8, 33,132,252, 13, 10, 45, 87, 62,159,255,185, 88, 44, 94, 35, 22,139,215,242,249,252,111, 1, 56,214,245, 15, 74, 36,146, 73,
- 30, 30, 30,119, 61, 60, 60, 50,252,252,252,142,218,217,217,124, 20, 32, 68, 36, 0,171, 23,180, 62, 33, 0, 62, 18,139,197,119,
- 68, 34, 81, 42,128,109, 0, 62, 2,224,242, 60,193,243,188,208,255,230,228, 62, 7,231,121,161,255, 19,191,234,233,238,238,126,
- 1, 64,183, 23,181, 83, 6,219,160,235, 0, 9,210, 7, 72,144, 62,216,230,217, 63, 53,216,217,217, 13,243,244,244,140,113,118,
-118,126,228,233,233,121, 73, 36, 18, 13,168, 99,132,155,187,187,251, 98, 95, 95,223, 4, 47, 47,175,229, 40,157,157,252,111,171,
-189, 16,237, 91, 11,145,215, 70,128,146, 8, 1,214,180, 17,224,245,215, 1,155,103,140,107, 7, 96,175,189,189,253, 53, 62,159,
- 31, 13,160, 95,217,241,213,143,207,231, 71,219,219,219, 95, 3,176,183,236,113,207,114,156, 46, 6,240, 8,192, 87,101,247,255,
-207,215,215,183, 36, 44, 44, 44, 53, 44, 44,108, 83, 80, 80,208,240,218,134,217,216,216,188,238,235,235,187,207,207,207, 47,181,
- 77,155, 54,133,222,222,222,247,124,124,124, 54, 11,133,194,142,244, 22, 71, 8, 33,127,127,111, 1,248, 26,192,170,248,248,120,
- 25, 99, 76,198, 24,147,197,199,199,203, 0,172, 1,240, 13,170,110, 66,252,211,207,157,157,157,231,206,159, 63, 95,155,149,149,
-197,242,242,242, 88, 66, 66, 2, 91, 54,107,154,165,187, 19,159, 5,184, 58,170, 61, 61, 61,239,251,251,248,236,108, 98,203,157,
- 6, 32,176, 54,153,143,113, 20,139,197,151,103,205,154,165,188,112,225,130, 82,175,215, 43, 45, 22,139, 50, 51, 51, 83,121,250,
-244,105,101, 68, 68,132, 18,192,199, 0,120,117,200,172,240,165, 23,206,177, 13, 95,176, 47,189,112,238,241,159, 55,108,216,240,
-182,197, 98, 97,253,251,247,215, 1,240,174, 75,230,147,188, 1, 81, 19,123, 56, 12,176, 69,142,105,243, 60,198, 86, 79, 97, 3,
- 36, 72,127,150, 76, 55, 55,183, 67,147, 38, 77, 82, 60,122,244,136,233,116, 58,150,158,158,206,198,141, 27, 87,236,230,230,182,
-189,150,235,238, 28, 26, 26,154, 19, 19, 19, 99,145,203,229,236,236,217,179,150,166, 77,155,230,212,178,216,234,250,196,178,172,
-243,242,242, 58, 90,151,155,155,155,219,250,186,238,163,215,132, 72, 55,200,206, 48,118,245, 36, 59,220,191, 13, 91,214,210,135,
-245,115, 18,200,219, 9,240,127, 29, 42, 31,202,164,170,204,119, 58,116,232,160,186,113,227,134,185,160,160,128,221,190,125,219,
- 50,102,204, 24, 45,128, 91, 99,198,140,209,222,190,125,219, 82, 80, 80,192,110,220,184, 97,238,208,161,131, 10,192,232, 58, 44,
- 39, 23,192,198, 57,115,230, 48,198, 24,155, 63,127, 62, 11, 11, 11, 99,157, 59,119,102, 74,165,146, 49,198, 82, 25, 99,155, 76,
- 38,211,200,218,100, 74,165,210, 97,147, 38, 77, 82,170,213,106, 86,206, 98,177, 48,185, 92,206, 86,173, 90,165,242,240,240, 56,
- 90,197,135, 12, 58,229, 65,153,148, 73,153,127,183,204,127, 50, 79,148,246,211, 42,191,213,186, 97,226,221,105,211,166,149, 23,
- 85,199,218,181,107,119,101,228,200,145,178,145, 35, 71,202,218,181,107,119, 22,192,137,216,216, 88,217,212,169, 83,101, 0,222,
-173, 97, 71, 56,182,109,219, 86,158,157,157,205,130,131,131, 89,189,122,245, 88,118,118, 54, 99,140,177,171,239,180, 96,191, 52,
- 2,123,120,254, 24, 59,121, 96, 47, 27,227,201,103,237, 61,165, 70, 79, 15,143, 2, 23, 23,151, 5,248,243,156,140,149,237,220,
-183, 27, 53,106, 84,114,235,214, 45,101, 98, 98,162,114,238,220,185,202,206,157, 59, 43, 67, 67, 67,149,253,250,245, 83,174, 92,
-185, 82,105, 48, 24,148,235,215,175, 87,218,219,219,223,170,164,216,122,230, 66,139,207,231,175,136,143,143,103,247,239,223,103,
-101,173, 20, 85,101, 74, 29, 28, 28,122, 56, 58, 58,126,236,224,224,208, 3,128, 20, 0,130, 1,219,102, 82,248,253, 95,179,128,
-134,209,239,118, 13, 92,213,245,213, 22, 3,236,184,114,227,119, 83, 24,235,239,247, 76,133,150, 84, 42, 29,246,209, 71, 31,149,
-232,116, 58,166, 86,171,153, 82,169,100,106,181,154,149,148,148,176,119,223,125, 87, 33, 18,137,222,174, 41,211,197,197,101,222,
-249,243,231, 77,217,217,217,236,252,249,243,236,232,209,163,108,245,234,213, 22, 55, 55,183,165,117,125, 1,122,120,120,156, 58,
-121,242,164, 44, 46, 46, 78,118,249,242,101,153,209,104,148, 25, 12, 6,153,193, 96,144, 69, 71, 71,203,246,239,223, 47,219,181,
-107,151, 76,175,215,203,244,122,189, 76,167,211,201,234,215,175,127,188,174,251,168,149, 16, 15,245, 23, 14, 51,182,244, 67, 86,
-188,112, 2,147,127,242, 38,203, 29, 23,201,214,188,234,195, 34,197,248, 25, 79,207,237, 89,105,166,149,149,213,185,212,212, 84,
-203,140, 25, 51,244,141, 27, 55, 46, 30, 53,106,148, 86,167,211, 49,198, 24,211,233,116,108,212,168, 81,218,198,141, 27, 23,207,
-152, 49, 67,255,224,193, 3, 11,159,207, 63, 93,135,229,252,166,188,200, 58,119,238, 28,123,156, 82,169,100,157, 59,119, 78, 13,
- 11, 11,219,244,202, 43,175, 12,169, 41,211,214,214,182,207,244,233,211,149,172, 18, 70,163,145,149,148,148,176, 7, 15, 30, 88,
-234,213,171,151, 9,192,153,222,204, 41,147, 50, 41,147, 10,173,151,102,108, 13,247, 43,223,136, 83,167, 78,149, 49,198,100, 51,
-103,206,148,149,181,108, 89, 3,176, 45,187,241, 1, 12,158, 62,125,186,140, 49, 38,155, 54,109, 90,249, 99,170,218, 17,111,237,
-217,179,199,176,124,249,114,230,238,238,206, 60, 60, 60,216,138, 21, 43,152,197, 98, 97,217,209,219,217, 47,141,192,238,124, 62,
-130, 49,198, 88,194,130,137,236,151, 70, 96,201,223,127,201,134, 14, 29,170,182,177,177,121,183,154,157,235,212,162, 69,139, 18,
-141, 70,163,220,188,121,179,210,198,198,230, 42,128,198, 40, 61, 21,201, 41, 91,214,225,141, 27, 55, 86,220,188,121, 83,249,211,
- 79, 63, 41, 1,204,173,229, 1, 19, 8,160,147, 68, 34,233, 55,221,219, 42,145,109,248,130, 77,119,199, 13, 0, 77, 1,184,150,
- 61,198,107,218,180,105,140, 49,198,124,125,125,207, 87,145, 41, 13, 13, 13,157,150,152,152, 24,101, 52, 26,163,226,226,226,162,
- 26, 52,104, 48,163,119,125,207, 54, 7,223,125, 61,188,248,203, 9,225,108,201, 39,161,223,190,209,170,235,206, 65, 29,223,125,
-239, 21,151, 11,163,220, 68,234,129, 82, 94,201, 19,167, 14,107,117, 96,123,123,123, 95, 78, 79, 79,175, 40,174, 74, 74, 74,216,
-163, 71,143, 88, 74, 74, 10,187,112,225, 2,243,244,244,252,165,166, 76, 15, 15,143,219,233,233,233,236,251,101,203, 88,255,166,
- 13, 89,164,131, 29,235,224,104,199, 90,218,138, 84,141,128,150,117, 45,180,174, 93,187, 38, 3, 32, 3, 32, 43, 40, 40,144, 21,
- 20, 20,200,138,138,138, 42,126, 6, 64, 86, 92, 92, 44, 43, 46, 46,150,233,245,122, 89, 64, 64, 64,157, 11,173, 8, 17, 34, 94,
- 19,161,176,141, 16,154,183,188, 93, 50, 39,212,119, 49,255,254,110, 27, 86,244, 97,103,182, 60,220,155,181, 19,224,255,106,153,
-249,150, 64, 32, 56, 11, 96, 74, 89, 81, 62,162, 71,143, 30,106,198, 24,235,209,163,135, 26,192,136,178,159,127, 84, 86,100,245,
-168,229,114,114,131,130,130, 84,229, 45, 89, 0,126, 11, 10, 10, 82,133,133,133,177,176,176, 48,230,235,235, 91, 82,150, 93,171,
- 55,180,192,192,192, 4,141, 70, 83, 81, 0,202,229,114,150,153,153,201,146,147,147,217,173, 91,183,216,213,171, 87, 89,106,106,
- 42,219,189,123,183,217,193,193,225, 8,189,153, 83, 38,101, 82, 38, 21, 90, 47,181,208,122,242,246,103,209,209,209,236,137, 31,
- 45,140,141,141,149, 77,159, 62, 93, 86, 67,101, 54,118,230,204,153,229,173, 94, 95, 87,243,207,127,125, 66, 66, 2, 27, 49, 98,
- 4, 11, 9, 9, 97, 33, 33, 33,108,228,200,145,172,184,184,152, 41,147,110,178, 95, 26,129, 93, 29,216,146, 49,198, 88,201,157,
- 56,246, 75, 35, 48,217,208,182,236,250,245,235,204,199,199,231,100, 53,127,255,231, 75,151, 46,229,109,223,190, 61, 27,165,253,
-177,172, 0,180, 6,176, 66, 44, 22,111, 68,233,233,194,122, 0, 28,131,131,131, 11,213,106,181,178,127,255,254, 74, 0,126,213,
-100,118, 8, 9, 9,185,191,126,253,122,150,155,155,203, 10, 11, 11,217,162,136, 6,140,109,248,130,205,111, 89,207,242,253,247,
-223,235,166, 76,153,162,114,114,114,138, 6,224,213,191,127,127, 19, 99,140, 69, 70, 70,230, 84, 22,230,224,224,208, 35, 49, 49,
- 49, 74,171,213, 70,201,229,242,168,194,194,194,168,195, 7, 15, 70,117,111,218, 96, 68,241,151, 19,194, 15,190,251,122,248, 27,
-222,142,253,150,118,123,117,252,163, 25,163,251,207,108,219,248,142,246,155,201,103,222,169,239,190,248, 89,246,182,171,171,107,
-150, 78,167, 99, 0,158,186,221,191,127,159, 57, 59, 59,167,215,148,225,228,228, 52,243,163,193,131,204,111,215,243,102,247,151,
-207, 98,198, 83, 63, 49,227,209,205, 44,105,225, 39,172,183,135,139,162,181, 53,119,122,109,151,199,195,195,227,212,229,203,151,
-255, 84,104, 21, 21, 21, 85, 90,104, 41, 20, 10,153, 94,175,151, 5, 5, 5, 29,127,222,163,190,181, 0, 1, 29,196,188,171,113,
- 35,218,179,188, 9,157, 89, 15,169, 85,234,115,196, 13, 6,112, 22,192,208, 58, 62,143, 11,224,155,242,130,106,225,194,133,140,
- 49,198,130,130,130, 84,120,190,139, 81,164, 13, 27, 54, 76, 25, 61,122,180,169, 81,163, 70,185, 17, 17, 17,242, 43, 87,174,176,
-115,231,206,177,163, 71,143,178,189,123,247,178,155, 55,111,178, 71,143, 30,177,132,132, 4,214,179,103, 79, 57,128, 14,244, 94,
- 72, 8,249, 59,171,164, 22,249,199,227,150,175, 88,175, 94,189, 56,143,173,160, 20,128,168,101,203,150,121,223,124,243,205, 18,
-148,142, 5,193, 9,229,225,157,206, 98,254,245,206, 98,254,245, 80, 30,222, 41,107, 49, 90,183, 96,193,130,121, 97, 97, 97, 89,
- 0,196, 0, 60, 42,251, 67,140,177,246,206,206,206, 72, 79, 79,135, 84, 42,133, 84, 42, 69,122,122, 58, 24, 99, 48, 49,192,200,
- 0,157,193, 0,141, 70, 3,173,133, 65, 99, 1, 20, 74, 37, 60, 60, 60, 96, 48, 24, 2,170, 88,254,102, 3, 7, 14, 12, 8, 13,
- 13,205,155, 58,117,106, 38, 74,251,202,108,124,255,253,247, 79,253,246,219,111,161, 74,165,178,240,214,173, 91,218,166, 77,155,
-246, 0,224,145,152,152, 56,108,213,170, 85, 24, 49, 98, 4,170,249,167,211,180,103,207,158, 71,111,222,188, 25, 48,116,232, 80,
-156, 61,123, 22,139, 22, 45, 66,126,126, 62, 3, 0,157, 78,199,204,102,179,161,109,219,182,134,229,203,151,183,138,140,140,188,
- 92,191,126,125, 30, 0,164,164,164, 36, 85, 22,200,225,112, 26,248,251,251, 67,167,211, 33, 47, 47, 15, 55,111,222,132,157, 84,
-138,248,204,124,247,142, 75,191, 47,248,252,224, 41,171,193,173, 66,157, 62,126, 61, 66,247,213,201,179,193,141,189,220,221,245,
- 6,163, 71, 66, 86, 78,230,179,236, 84,107,107,235,244,252,252,124,232,245,122,104, 52, 26, 40, 20, 10, 20, 20, 20, 32, 63, 63,
- 31,153,153,153,176,182,182,190, 95, 83,134,125, 97,225,249,148, 75,231, 56,187,127, 88,136, 0, 83, 33,248,251, 86,128,127,104,
- 13, 2,245,121, 88, 59,107,156,157,222,217,117,142,189,157, 93,145,131,131,195, 58, 0, 65, 53,229,133,135,135,163,160,160, 0,
- 5, 5, 5,112,118,118,134,163,163, 35, 28, 29, 29, 33,151,203, 81, 92, 92, 12,133, 66,129,224,224, 96, 52,107,214, 12, 91,183,
-110,125, 33, 7,247,239,122, 36,155, 96,158,112,234, 94, 38,172, 37, 18,212,119,180,245,127,213, 22, 78,213, 60,165,179,149,149,
-213, 30, 39, 39,167,147, 0, 62, 4, 32, 1,240,161,147,147,211, 73, 43, 43,171,190, 0,230, 3,216, 94,199,197,248,106,206,156,
- 57,211, 18, 19, 19,109,174, 95,191,142,169, 83,167, 98,238,220,185, 72, 74, 74,250, 14,128,165,236, 49, 31, 56, 59, 59, 71,115,
-185,220, 31, 1,188, 9,160,135,167,167,103,151, 26,114,251, 78,153, 50, 69,219,162, 69,139,132, 59,119,238,244,189,116,233, 82,
-203, 79, 62,249,164, 56, 45, 45, 13, 9, 9, 9,240,244,244,132,175,175, 47,148, 74, 37,138,138,138,208,183,111, 95,169,189,189,
-253,187,244, 54, 78, 8,249, 59, 23, 89, 79,212, 34,255,180, 22,173, 74,239, 87,250,137,218,198,198,102,142, 76, 38,107, 19, 22,
- 22,198, 7,176, 27, 0, 66,121, 24,208,183,109,243,141, 7,215, 45, 12,219,191,124, 86, 88,247,176,224,141,161, 60,148, 95,197,
- 22,221,178,101, 75, 71,153, 76,214, 86, 40, 20,254, 95, 21, 11,193, 0,192,209,209, 17, 82,169, 20, 14, 14, 14,112,116,116,132,
-197, 98,129, 82,173,133,202, 12,148,104,245, 40, 46, 46, 70, 73,217,125,165,206, 0,149, 74, 85,241,220, 74,116, 28, 61,122,116,
-222,170, 85,171,114,179,178,178, 22, 2,104, 58, 98,196,136, 62, 43, 87,174,196,175,191,254,170,125, 51, 36,208,121, 65,251,230,
-243, 26,103, 37, 69,133, 88, 97, 12,128,243,231,207,159, 71,219,182,109,193,225,112, 6, 85, 22, 40, 22,139,215,236,220,185, 83,
-124,235,214, 45, 4, 6, 6,222, 26, 52,104,208, 59, 11, 23, 46, 12,144, 40, 11, 47, 2,128,169, 32,251,214,196,137, 19,191, 88,
-176, 96, 65, 94, 94, 94,158, 65,173, 86,187,245,238,221, 27,233,233,233,120,244,232,209,111, 85, 20,153, 9,113,113,113,172,184,
-184, 24,201,201,201,136,139,139, 19,127,241,197, 23,173,204, 92,110,159, 12,216,189, 55, 34,162,101,171,161,173,155, 99,123,204,
-117,235, 11,247, 82, 28, 90,214,243,118,188,246, 48,235, 21, 35, 7,247,159,101,111,151,148,148,172,152, 55,111,158, 82,169, 84,
- 34, 35, 35, 3, 55,110,220,192,157, 59,119,144,154,154,138, 69,139, 22, 41, 11, 11, 11, 87,214,148,225, 37,226,127,186,248,147,
-247, 57,252,219,191, 1,215,207, 1,234, 18, 64,163,132,238,174, 12,155,238,102, 99,245,190, 3,130,180,244,116,135, 93,187,118,
-141,246,243,243,147, 1, 8,174, 46,143,177,210, 93,200,229,114,159, 44, 66,193,229,114, 75, 0,100, 75, 36,146,135,118,118,118,
- 15,185, 92,110, 54, 99, 76,245, 66, 62, 73,152, 96, 0,143, 7, 8,196,224, 90, 85, 59,181,231, 59,131, 6, 13,218,249,240,225,
-195,238,201,201,201,109, 86,174, 92, 57, 79, 36, 18,197,175, 92,185,114, 94,114,114,114,155,135, 15, 31,118, 31, 52,104,208, 78,
- 0,195,235,242,247,131,130,130, 38, 70, 69, 69, 97,209,162, 69,104,214,172, 25,130,131,131,213,115,230,204, 89, 1, 96, 22,128,
-255, 11, 10, 10,186, 56,113,226,196, 81,185,185,185, 30, 25, 25, 25,205,190,251,238,187,113, 43, 86,172,120, 53, 51, 51, 83, 84,
- 67,116,187,110,221,186,225,216,177, 99, 0,144, 5, 32,185,160,160,192,148,153,153,137,134, 13, 27,162, 85,171, 86, 80, 42,149,
- 80, 42,149,144,203,229,240,247,247,135,197, 98,105, 67,111,229,132, 16,242, 63, 45,184, 42, 47,180, 68, 34,145, 99,120,120, 56,
-234,215,175,239,136,178,171,181,156, 5,252, 25, 31,143, 30,108, 99, 43, 59, 14, 78,220, 47, 24,212,190,137,141,179,128, 63,163,
-236, 41,124,127,127,127, 97,120,120, 56, 36, 18,137,119, 21,127,252,108,118,118, 54,194,195,195,225,224,224, 0,169, 84,138,240,
-240,112, 24, 12, 6, 20,151,148, 64,101, 6,212, 70, 11,138,139,139, 81,152,151, 3,181, 25, 48,217, 57, 35, 53, 53, 21, 60, 30,
- 47,165,138, 76,207,192,192,192,188,248,248,248, 60, 0,231, 1,140,159, 59,119, 46,166, 79,159,142,217,179,103,239,180,201,122,
-208,109,231,177, 67,206, 59,230,124,224, 26, 44,224, 12, 6, 96,120,248,240, 33, 28, 28, 28, 32,145, 72, 42, 45, 12, 34, 35, 35,
- 91, 72, 36, 18,108,222,188,153,101,100,100, 68,160,244, 18,254, 20, 14,167,180,216, 19,115, 81, 12, 96,133, 76, 38,123,237,139,
- 47,190,184,215,181,107, 87,171,214,173, 91, 99,254,252,249, 0, 16, 93, 89,166, 92, 46,255,125,248,240,225,250, 51,103,206,224,
-238,221,187,146,131, 7, 15, 14,152, 63,127,126,147,180,180, 52,225,207, 71,143,191,177,237,161, 98,192,194,147, 23, 68, 11, 78,
-156,253,221,197, 94,210,248, 21, 23, 39,196,165, 61,178, 54,243,112,165,166, 61,250,154, 21,111,116, 71, 17, 63,174,189,144,155,
-213, 81,196,151,189,106,197,123,191,164,164,100,215,225,195,135, 79,124,242,201, 39,202,220,220, 92,216,217,217,161,160,160, 0,
- 95,125,245,149, 50, 46, 46,110,159, 94,175,255,185,166, 92,179,133,181,240,173,231, 7,220,143,175,248,153,193,194,112, 69,111,
-141, 94,227, 39, 35,164, 97, 67,232,245,122, 52,109,218,148, 51,119,238, 92,137, 84, 42,253,172,198,162,135,251,212,225,102,226,
-112, 56,217,140,177, 71, 74,165, 50, 67, 44, 22,167, 89, 91, 91,167, 21, 22, 22,102, 48,198,114, 94, 68,157,197,184,248,180,109,
-211, 32, 64, 40, 70, 90,129, 50,243,170, 18,133,149, 61,208,206,206,238,253,213,171, 87,139, 54,108,216, 96,156, 56,113,162,110,
-220,184,113, 86, 26,141,198,109,220,184,113, 86, 19, 39, 78,212,109,216,176,193,184,122,245,106,145,173,173,109,191,103, 89, 16,
-163,209,136,248,248,248,133, 73, 73, 73, 18,148, 14, 55, 50,121,206,156, 57, 35, 18, 19, 19, 69,171, 86,173,194,222,189,123,177,
-119,239, 94,244,233,211, 7,147, 38, 77, 66, 84, 84, 84,117,113, 54, 97, 97, 97,225,206,206,206, 56,119,238, 92, 38,128, 52, 0,
- 45,108,109,109,237,250,244,233,131,238,221,187, 67,171,213,194, 96, 48, 84, 20, 90, 60, 30, 15, 14, 14, 14,206,244, 30, 72, 8,
- 33, 47,189,200,250, 83,177,197, 7,128,242,166,186, 94,189,122,113,170,251,199,104, 46,202,133, 92,165, 70,106,177, 26,233, 69,
-150, 63,253,206, 98,177, 84,251,215, 51, 51, 51,127,142,137,137,121, 63, 60, 60,156,159,153, 89,122, 70, 44, 60, 60, 28,106,181,
- 26,153,215, 47, 67,101, 1, 36,129,161, 80,169, 84, 40,186,115, 13,182, 97,109,224,220,115, 40,150,174, 90,165, 43, 40, 40,248,
-161,178, 76,129, 64, 96,229,227,227,147,151,146,146, 98, 2, 80, 40,149, 74,187,249,249,249,225,236,217,179, 0,176,157, 1,139,
- 17,119, 6, 56,183, 31,172,180, 73,197,214,223,223, 31,185,185,185, 80, 42,149,103, 43,203,140,137,137, 73, 52, 26,141, 77,123,
-247,238,205,217,178,101,203,110,133, 66, 49, 27,192, 13,157, 5,188,235, 15,115,160, 50, 67, 4,224,117, 71, 71,199,143,162,162,
-162,186, 76,156, 56, 17,135, 15, 31,198,201,147, 39, 13, 40,237, 11, 22, 83, 73,108,113,114,114,242,218, 41, 83,166,180,230,114,
-185,227, 79,157, 58,101, 10, 14, 14, 86, 24, 12, 6,115,131,144, 16,238,236,185, 95, 90,127, 56,126,172, 67,129, 26,183,187, 55,
-240,108,203,225, 0,183, 31,229,166, 37, 41, 81, 80,221, 54,141, 20,240,162,251, 70,132, 69,190, 63,232, 45, 91, 73, 96, 99,168,
-110, 94,246, 88,187,231,232, 82,113, 92, 98,175,115,185,185,125, 14, 31, 62, 60,224,236,217,179, 31,234,245,250,250, 66,161,240,
-190, 92, 46, 95,174, 84, 42,107, 44,178,120, 60, 94, 79,157,167,143,163,188,176, 16,162,178,150, 40,133,209,130,124,157, 9,119,
- 29,130,241,174,143,111,197,105,208,236,236,108,120,120,120,112,204,102,243, 91,213,101,158, 60,121, 18,189,122,245, 42, 47, 60,
-193,225,112,192,225,112,242, 67, 66, 66,114,132, 66, 97,129,181,181,181, 98,241,226,197, 90,173, 86, 11, 62,159, 47, 50,155,205,
-188,231, 57,218, 91,217,192, 77,200, 56,107,198,245,238,212,181, 89,227,134,236,252,213,235,156, 34,181,118, 83, 53,173,128,223,
- 5, 5, 5,241, 11, 11, 11,127, 6,112,215,104, 52,238,216,189,123,183,104,216,176, 97,218, 61,123,246, 12, 1, 16,176,100,201,
-146, 1, 74,165,178, 78, 83, 42, 36, 37, 37,125,183, 96,193,130,105, 51,103,206,196,214,173, 91, 39, 38, 37, 37, 77, 47,107,233,
-234, 19, 21, 21,133,197,139, 23, 99,235,214,173,150,187,119,239, 30,181, 88, 44, 73,159,124,242, 73,152,187,187,123,126, 86, 86,
- 86, 82, 53,177, 45,123,244,232,161,187,120,241,162,160,164,164,228, 2,128,143, 38, 76,152, 48,250,181,215, 94, 83, 12, 26, 52,
-200,182,176,176, 80,110, 99, 99, 35, 88,191,126,189, 35,159,207,135, 74,165, 2,135,195, 65, 73, 73,137,158,222, 7, 9, 33,127,
- 87, 85,213, 34,255, 16, 85,254,111,224, 87,182,130,106,181, 58, 39, 61, 61,189,225,163, 71,143, 76, 0, 76, 0, 80,160, 55,125,
-189, 96,253,254, 13,253, 90, 7, 73,178,140, 70, 28,188,122, 75, 93,160, 55,149,119,126, 55, 61,122,244,168, 36, 45, 45,205, 78,
-163,209, 40,171,248, 91,191,173, 89,179, 70,115,230,204, 25,187,228,228,100,152,205,102,180,104,209, 2, 9, 9, 9, 40,186, 27,
- 15, 73,195, 22,144,116,232,133, 91,178,171,136, 59,121, 26, 15,148,122,211,189, 89, 11,138,149, 42, 85,148,193, 96, 56, 88, 89,
-160,149,149, 85, 33, 0,198, 24, 51, 3,128, 66,161,184,161, 84, 42,219,187,187,187,227,246,237,219, 18,149, 25,147, 6,204, 88,
-186,146, 49,102,182, 46,189,154,235,227, 65,131, 6, 33, 54, 54, 22, 0, 98, 43,203, 84, 40, 20, 19,199,140, 25,115,102,243,230,
-205,252,228,228,228,238, 27, 54,108,232,126,239,222, 61,198, 41, 76, 55, 95, 84, 91, 33, 96,196,164, 87,191,247, 15, 57,217,171,
- 87, 47,120,122,122, 98,253,250,245, 88,190,124,185,241,131, 15, 62, 72, 92,190,124,249,171,185,185,185, 59,170, 88,255, 98,185,
- 92,126,220,217,217,249,195, 38, 77,154,148,168, 84, 42, 20, 20, 20, 32, 51, 51, 19, 78,206,206, 92, 19,184,109, 93, 29, 28,118,
-252,156, 93, 34,225, 31,255, 29,151, 51,178,170,109,205,106,109,197, 27,222, 47,178,121,228,255,205,156, 97,139,139, 7,193, 25,
- 19, 5,182, 97, 30, 38,143, 28, 96,167,213,237,232,160,186,158, 58, 76,166, 80,108, 83, 40, 20,123,235,120,176,244,104,219,182,
-237,206, 5, 11, 22,136, 63, 95,180, 0, 75, 26,122,195, 84, 80,128, 60,157, 25,249, 58, 19, 20, 69,119,113,251,246, 45, 56, 59,
-187,224,193,131, 7,208,106,181,184,115,231, 14,227,241,120, 63,215,212,162, 83,238,177,211,133,114,161, 80, 88, 96,101,101,149,
-195,231,243, 11,147,147,147, 85, 90,173, 22, 92, 46, 87, 98, 54,155,197,181, 88, 86, 31, 23, 23,151, 79, 80, 58,152,232,225,146,
-252,252, 21,225, 86,112, 0, 31, 29,253, 93,156,223,152, 53,110,152,139,159,151,155, 60, 57,241,190,241,135, 19,151,242,181,186,
-170, 47,214, 0, 16, 93, 88, 88, 88,209, 34,185,103,207,158,201,123,246,236, 25, 13, 96, 35, 74,231,221, 58, 45,151,203,191,127,
-134, 23,223,172,125,251,246, 77,155, 57,115, 38,196, 98,113,197,224,169, 98,177, 88, 4, 0, 63,253,244, 19,110,223,190,253, 26,
-202,250,107, 89, 44,150,157, 89, 89, 89, 53,101, 6,132,134,134, 38,239,223,191, 95, 0,192,107,194,132, 9,109, 86,174, 92,137,
-145, 35, 71,230,221,186,117,171, 53,128, 20, 0, 1,227,199,143,191,178,117,235, 86, 71,139,197,130,162,162, 34,232,245,250, 20,
-122, 43, 39,132, 80,177,245, 82,132, 3,136, 67,233,248, 89, 61, 1, 28, 65,105,183,142, 42,249,150, 85,103, 39, 0,244, 46,255,
-255, 88, 69,103,120,160,244,138,172,227, 0,126, 4,224, 94, 85,168,179,179,243,103, 35, 70,140, 48,102,100,100,176,236,236,108,
-182,119,239, 94,246,241,251, 35,204,175, 7,122, 89, 2,189,220, 85,174,174,174, 9,158, 46, 78,155,154,219,224, 99, 0, 62,181,
- 88,177, 17,247,238,221, 27, 59, 98,196,136,247,203,254,238,251, 59,119,238, 84,158, 58,117, 74,201,227,241,162, 81, 58,180, 67,
-121, 65, 57,252,173,183,222, 82,234,116, 58,101, 72, 72, 72, 33, 74, 59,238, 87,101, 64,199,142, 29,139,142, 29, 59,198,204,102,
-243, 83, 99, 20,229,229,229,177,147, 39, 79,178,136,136, 8, 57,128, 97, 93,186,116, 57,123,233,210,165,179,237,218,181,219, 87,
-211, 2,187,184,184,204,184,126,253,122,108,106,106,170,236,200,145, 35,178, 29, 59,118,200,198,143, 31,127, 35, 44, 44, 76,147,
-152,152,104, 49,153, 76,236,250,181,107, 44,164, 65, 3, 21, 0,255,170,114, 58,139,249, 87, 20,235,231, 49,237,252,145, 76,219,
-215,151, 1, 96, 37, 75, 63, 99, 57, 19,187,178,132, 15,223, 96,157, 68,188,152,103, 57, 82,125,108,111,173, 0, 0, 32, 0, 73,
- 68, 65, 84,156,156,156, 78,196,198,198,178,146,146, 18,118,243,230, 77, 54,188, 87,119, 22, 51,186, 43, 59,222, 61,136,109,237,
-240, 10, 91,218, 45,140,117,239,208,158,173, 89,179,134,237,223,191,159,205,152, 49,195,226,226,226, 82,130,106,250,104,121,120,
-120,156,218,189,123,183, 12,128,140,199,227,201, 20, 10,133,172,164,164,228,231,135, 15, 31,174, 14, 9, 9,153,214,164, 73,147,
- 33, 13, 27, 54,236,220,233, 21,255,105, 93,236,132, 9, 93,237, 69,247, 27,216,218, 44,197,211,227, 94, 85,144, 2,254,129, 1,
- 1, 37,231,206,157,179,232,116, 58,118,225,194, 5, 75,163, 6,193,218, 37, 3,123,236,123,176,254,155,125,218, 99, 91, 78,168,
- 15,173,187,180,231,189, 94,241, 29,109,184, 91,218, 72, 42,134,227,120, 86,131, 1, 28,196, 31, 87, 29,142, 0,112, 8,213, 95,
-133,200, 5,176,113,254,252,249,143, 95,105, 8, 0,220,176,176, 48, 25, 99, 76, 22, 22, 22, 38,171,235,130,216,216,216,124,114,
-248,240,225, 57,126,126,126,139, 6, 13, 26,180, 94, 46,151, 31, 25, 50,100, 72, 60, 74, 47, 6,225,160,116,118,132,183,124,124,
-124,242,226,226,226,216,217,179,103, 89,255,254,253, 75,172,173,173,135,210,219, 56, 33,132,188, 20, 99,171,248, 90,173, 5,241,
-241,241,229, 99,104, 77,168, 46,124,250,244,233,178,216,216, 88, 25, 74, 71,137,175, 22,159,207, 63,240,193, 7, 31, 48,119,119,
-119,165,155,155,219, 1, 43, 30,111,180,175, 24,225,120,182, 75,221,219,111,219,182,173,207,119,223,125,215, 19,192,107, 0,172,
-188,189,189, 51,179,179,179,149,151, 46, 93, 82, 70, 68, 68, 40, 93, 92, 92,114, 67, 67, 67,149, 75,150, 44, 81, 26,141, 70,229,
- 39,159,124,162,196,211,227,125, 85, 70, 4,224, 67,129, 64,112,160, 81,163, 70,241,179,122,119, 54, 46,154, 52,154,141, 8,114,
- 85, 2,248, 14,192, 7, 0, 28, 0, 88, 13, 24, 48,224,151, 59,119,238,156, 8, 13, 13, 93, 91,139, 92,175, 38, 77,154,252,186,
-115,231,206,216,253,251,247,203, 62,251,236,179, 88,103,103,231,140,196,196, 68,139, 86,171,101, 69, 69, 69, 76, 46,151,179, 35,
- 71,142,152,157,156,156, 86, 85,185,226, 66, 94, 22, 59,185,189,210, 33, 28, 30,206, 28,202, 34, 4,220, 71,207,114,164, 72, 36,
-146,194,130,130, 2,150,157,157,205,146,147,147,217,190,125,251, 88,143,182,173,216,174,241,253,216,246,247,251,176,197, 61, 90,
-177,215,236, 68, 42, 15, 59,219, 88, 59, 59,187,220,218, 92,117,232,225,225,113, 74,167,211, 85, 12,223,224,227,227, 35, 11, 9,
- 9,217, 31, 26, 26,186,244,240,225,195,147,151, 45, 91,214,167,211, 43,254,211,190,234,222, 86,163, 62,189,135,149,236,254,142,
- 77,111, 17,172, 45, 43,230, 43,229,237,236,180,237,220,217,179,150,242,226,215,100, 50,177,131, 7, 14,176,129,111,188, 30, 95,
-124,252,167, 31, 47, 68, 77,220,249, 73,139,224,131, 17, 34, 12,174,174, 96,171,248, 40, 98, 11,231, 72,123,238,234, 55,253,156,
-178,218, 75,185,223,181,182,251,211,244, 82, 3,131,131,131,147, 25, 99, 89, 13, 27, 54, 76, 6,176,189, 97,195,134,143,223,127,
-175,138,216,138,193, 73,231,204,153,195,202, 94, 31, 92, 0,179, 23, 44, 88, 32, 99,140,201,130,130,130, 46, 2, 64, 51, 9, 92,
- 58, 72,185, 63,246, 14,112, 47,232, 32,229,254,216, 76, 82,249,148, 81,254,214,104,208,222,213,230, 66,159, 32,207,146,142,222,
-210,243,219, 55,109, 88,244,230,155,111,174, 7,176, 10,192, 60,103,103,231, 11,131, 7, 15,190,189,117,235,214,219, 75,150, 44,
- 49, 36, 38, 38,178, 81,163, 70,169,132, 66,225, 60,122, 31, 36,132,144,151,166,124,100,120,207,186, 20, 90,111, 77,155, 54, 77,
-198, 24, 43, 31, 75,107, 88, 37,143,233, 61,115,230, 76, 25, 99,172,124,116,248, 39, 7, 48,171,108, 64,179, 57,171, 87,175,102,
- 66,161,240,199,103, 92,153,199, 51, 61,250,246,237,219, 90,161, 80,188,234,238,238,254,106, 89,203,149,175,139,139, 75,242,142,
- 29, 59,148, 26,141, 70,201, 24, 83,154, 76, 38,101,108,108,172,178, 99,199,142,202,199, 62,245,215,180,156,127,242,185, 7, 46,
- 94,157,245, 62,251,220, 3, 23,159,248,213,208,141, 27, 55, 30, 75, 73, 73,249,217,222,222,126,106, 45, 51,125, 93, 93, 93,103,
- 59, 57, 57,157,112,113,113,249,220,201,201, 41,203, 96, 48,176,162,162, 34,150,144,144,192,206,158, 61,203, 98, 98, 98,152,147,
-147, 83, 70, 85,203,217, 69,204,255,189,104,209,135,204,178,113, 1,211,175,156,193, 0, 48,249,178,233, 44,127,205, 92,118,117,
- 76,119,214, 81,196,251,237, 25,182, 39, 28, 28, 28,214, 29, 56,112,192,146,148,148,196,162,163,163,217,145, 35, 71,216,164, 73,
-147, 88, 3, 47, 79, 93,107, 1, 55,167,189,144,127,226, 89, 6, 44,213,233,116, 50,133, 66, 33, 83, 42,149,178, 70,141, 26,201,
- 90,181,106,181,191,117,235,214, 75,247,236,217, 51,249,171,175,190,234,211,197, 78,152,160, 62,189,135,177,207,222, 96,236,195,
-118,236,254,232,142,172,179,152,127,189,202, 76,119,247,140,242,209,218, 85, 42, 21, 59,127,254, 60,251,245,215, 95,153,135,139,
-139, 34, 82,204, 27, 27, 33, 68,135, 8,123, 56,212,118, 57, 59, 73,185,155,126, 95,243,181, 89,115,108, 43,251,105,196, 27,166,
-142, 14,220,213,143, 61,110, 23, 99, 44,171,127,255,254, 15, 24, 99, 89,251,246,237,123,200, 24,203,234,215,175,223, 3,198, 88,
- 22,128,157,149,101, 62, 49, 56,233,198,178, 34,235,195, 57,115,230,200, 24, 99,178, 57,115,230,200,128,210, 65, 84, 59, 72,185,
-155, 47,175, 93,108,209, 29,217,204,246,140,234,105,238, 32,229,110,174,116, 57, 29,248, 63,199,109, 92,198,244, 39,182,179, 3,
-147,134,152,219,121,216,159, 11, 14, 14, 94, 60,121,242,228,253, 49, 49, 49, 55,204,102,243,237,228,228,228,219,171, 86,173,186,
-221,166, 77,155,139,206,206,206,241, 2,129,224,131,154,246,209, 11, 66,153,148, 73,153,148, 73,158,108, 96,170,230,119, 63, 47,
- 92,184, 80,194, 24,251,100,192,128, 1,248,230,155,111, 6, 54,105,210,100,176,183,183,183, 43, 0,100,102,102,170,111,222,188,
-169, 24, 48, 96, 0,102,207,158,141, 69,139, 22, 45, 69,105, 95,150,255,165,236,131, 7, 15,250, 76,156, 56, 49,247,171,175,190,
-178,140, 26, 53,170, 33,128,155,249,249,249, 13,134, 12, 25,242, 33,159,207, 31,224,239,239, 31,154,149,149,149,167,209,104,182,
- 3, 88,139, 26,206,153, 86, 69,200,133,185,101, 61, 79,156,224,194,252,216,143,223,152, 61,123,246,160,126,253,250, 25,150, 45,
- 91,102, 82, 40, 20,135,107, 25,247, 48, 47, 47,239,203,242, 59, 78, 78, 78, 30,215,175, 95,255,192,205,205,141,155,156,156, 12,
-157, 78,135,164,164, 36, 11, 74, 79, 77, 85, 74,105, 98, 43,190,223,119, 42,228,147,161,189,236,213,119,175,193,154,199,131,209,
- 74,128,236,223, 79, 96,227,249,187, 10,149, 1, 43,159,101, 61,229,114,249,183,147, 38, 77, 26, 50,117,234, 84,145,191,191, 63,
-231,183,223,126,195,238,221,187,117,185,185,185, 61, 0,156,251, 99,232,167,186,177, 88, 44, 16, 8, 4, 0,128,233,211,167,131,
-203,229, 90,229,230,230, 10, 56, 28,142,144,195,225,216,112, 56, 28,158, 49,229, 54, 44,138, 34,228, 20,201,241, 48, 71, 94,109,
-158,217, 98,217,125,249,242,229,143,155, 55,111,206,189,122,245, 42,242,242,242,144,148,148,196,204,140,237, 60,175, 49,151,118,
- 74,212,213,126,249,108,156,156,251, 54,115, 20,114, 5,155,102, 35, 82,207,229,253, 96, 65,127,148,142,165, 5, 0, 27, 57, 28,
-142, 53,128,130, 70,141, 26,117,186,115,231,142,184, 81,163, 70,154,187,119,239, 30,227,112, 56,222, 0, 54, 87,150, 41, 22,139,
-243, 1,228,239,219,183, 15, 0,198,160,116,227,181,136,138,138,202, 58,127,254, 60,230,204,153,147, 3, 96, 53, 0,216, 58, 58,
-247, 14,149, 90,115, 4, 91,230,160,141, 14,220,149, 22, 86,105,171,171,173,155,123,231, 38, 18, 46,172, 54,124,129, 87, 61, 66,
-184, 2,147,161,233,220,185,115,207, 43,149, 74,221,174, 93,187,244,239,189,247, 30, 47, 49, 49,241, 10,128, 11, 0,246,161,172,
-143, 37, 33,132,144,151,234,201, 22,172, 26,251,104, 61, 89,181,126, 3,224,251,123,247,238, 85, 76, 42,125,239,222, 61, 25,128,
- 31, 80, 58, 26,252, 91,117,168,120,103,149,181,104,173,125,198,149,121, 50, 83, 20, 30, 30, 46,190,115,231,142, 53, 42,159,196,
-145,243, 12,153, 79,169,108,174,195,224,224,224,229, 70,163,113,255, 15, 63,252,176,135,199,227, 13,121,142,106,223, 63, 40, 40,
-168,104,199,142, 29,150,232,232,104, 54,107,214, 44,179,167,167,103, 17,158,238,163,245,167,204, 72, 1,111,239,148,134,222,138,
-216, 97,237,216,253,201,189,217,133,161, 29,217, 88,111, 91, 69,164,136,183,251, 57, 63,149, 4, 73,165,210,141, 98,177, 88, 97,
-111,111,127, 10, 64,219,231,217, 71,206,206,206, 91, 61, 60, 60, 78, 61,126,115,119,119,223,239,234,234,250,157,139,139,203, 44,
- 7, 7,135,113, 1, 34,193,178,201, 13,188,180,241,125, 27,177,211, 17,174,108,168,139,224,201, 83,135, 79, 46,167,103, 64, 64,
- 64,193,182,109,219, 44, 63,255,252, 51,155, 49, 99,134,165, 94,189,122, 10, 84,211,175,173,218, 22, 45, 7,222,238,189,253, 90,
- 91,114,122,122,179,111, 26,218, 89, 58, 57,242,170,186, 66,113,104, 89, 1, 60,162,166,204,192,192,192, 31, 24, 99,155,230,207,
-159,191, 9,127,204, 5,250,250,220,185,115,163, 24, 99, 81,115,231,206,141, 2,208, 29, 0, 34,165,220,109,219,251,180, 52,103,
-190,233,197,190,110,104,107,142,148,114,183, 85,218,146,233,196, 63,120,104,116, 79, 75,214,232, 8, 54, 59, 72, 98,110,237, 36,
-252, 69, 32, 16, 76, 70,105,139,115, 43, 0, 2,250,212, 76,153,148, 73,153,212,162,245,183, 43,188,106,197,195,201,201,105, 99,
-253,250,245,247,248,251,251,239,177,181,181, 93,138,210, 78,243,117,221, 17, 1, 11, 22, 44, 80, 72,165,210,102, 47,112,231,186,
- 1,240,198,211, 19,231,190,176, 3,230, 75, 79, 76, 76,156, 58,240,250,151,158,152,248,216,143, 91, 53,108,216,240,107,148,142,
-230,253,188, 7,161,191,147,147,211, 42, 39, 39,167,140,178,190, 89,254,181,201,108,201,227, 13,233, 36,226,253,214, 86,192,205,
-238, 36,226, 95,122,149,199,123,247, 31,250, 2,172,238, 98,139,170, 50,125, 92, 92, 92,150, 57, 57, 57,101,186,184,184,172,170,
- 99,145,245,167,204,102, 98,120,118,118,224, 29,108,107,199, 81,117,150,242,246,181,180,169,250,162,142, 58,172,123,248,156, 57,
-115, 70, 50,198, 70,122,121,121, 13,120,172,240, 15,157, 61,123,118, 47,198, 88,175,242, 17,224, 91,217,192,173,163, 3,111, 71,
-132, 61, 71,222,209,129,183,163,149, 13,220,170, 90,206, 78, 14,188,221, 17,246, 28,121,164, 61,119,135,159, 16,245,232,205,156,
- 50, 41,147, 50,169,208,250,119, 20, 90,116,192, 80, 38,101, 82, 38,101, 82, 38,101, 82, 38, 21, 90,149, 23, 86,143,223, 42,206,
-176,241,105,219, 16, 66, 8, 33,132, 60,151, 42, 7, 44,229, 84, 83,149,214,165, 99,251,179, 84,182,167, 41,147, 50, 41,147, 50,
- 41,147, 50, 41,243, 63,151, 89, 83,246,255,250,194,186,127, 52,106, 86,165, 76,202,164, 76,202,164, 76,202,164,204,255, 44, 46,
-109, 2, 66, 8, 33,132,144,231, 18, 94,246,245,201,129, 75, 43,239,163,197,111, 53, 63,199,100, 50,185, 1, 0,159,207,207, 53,
- 94,153,229, 89, 93,186, 21,208,197, 84, 58,253, 14,248,192, 24, 19,112,170,146,204, 83, 38,147,201,177, 44,179,200,120,101, 86,
-247,106, 51, 91,205, 63,241,248,227, 77, 87,102,189,254,228, 99, 24,192,179,106, 53, 63,243,137,101,245,170,237, 86,225,224, 79,
- 99, 98,189,180,229,252,167,100,254,151, 89,189, 54, 63,199,104, 44, 61,142,172,172,248,185,134,203,213, 31, 71,214,175,205,207,
-124,252,241,198,203,179,220,171,203,180, 17, 11, 11, 2,189, 93,151, 86,151,153,156,153,255,137, 74,173,117,174, 46,179,174,175,
- 77, 95, 79,207, 46,230,178,215, 38, 15, 24,147,145,149,117,234,111,118, 44,181, 4, 48, 11,128,253, 99, 63,139, 7,240, 17, 29,
-149,132,144,127, 88,161, 21,135,210,121, 14,215,149, 21, 91,235,170, 44,180, 76, 38,147,155,236, 64, 20, 84, 58,160,203,240,249,
-110, 1,125,215, 62, 53, 81,178, 73, 91, 36,144,223,218, 21,202, 51, 42, 28, 93,249, 6,251,204,204, 76, 14, 0,112, 56,156, 31,
- 1,248, 85,146,233, 40, 59, 16, 5,181, 30,136, 28, 60,215,209, 15,176,207,179,182,254, 84, 44,145,116,210,104, 52, 77, 0, 64,
- 44, 22,223,210,168, 84,103, 92, 13,134, 37, 79, 62,190,170, 53,123,124, 89, 59, 15,155,239,214,176,239,218, 73,102,139, 69,240,
-232,234, 15,145,218,252, 68,190,149, 73,183,250,115,224, 88, 84, 37, 69, 85, 21,121,127,252,221,119,102, 56, 91, 1,157, 5, 34,
- 81, 51, 7, 71,199,246, 22,198, 26, 89, 44, 22,142,217,100,186,173, 40, 46,190, 96, 49,153,174,155,244, 42,103,217,225,175, 45,
-213, 45,231,147,235,242, 14,192, 63, 0, 12,144,216,218,118,226, 89, 89,181, 5, 0,179,209,248,155, 74,169, 60,243, 54,176,183,
- 54,235, 94,219,237,243,172,143,255,175, 49, 26, 77,110, 41, 39,162,160, 51, 2,225,253,191,118, 11, 27,178,101, 7, 0,232,115,
-175,187, 43, 19, 15,191, 6, 0,146,192, 94,151,133, 30,225, 57, 0,192, 79,203,114, 75,136,158, 9,157, 17,104,212,107,174, 91,
- 77,153,239,205,222,237, 60,117,108, 63, 33, 0,156,220,247, 93,131, 95,247,127,255, 6, 0,116,238, 55,225, 88,183,254, 19, 19,
- 0, 96,209,186,253,206, 59,191, 30, 88,109,102,237, 94,155,197,214,197,137,209, 65,122, 69,150,131,175,132,239,145,152,152,200,
- 5, 0, 47, 47,175, 90,189, 54,125, 0,105, 22,240, 33,151,199,107, 31, 24, 20, 20, 14,128, 37,223,191, 31,103, 54,153, 46,122,
- 2,171, 95,240,177, 52,137,177, 63, 15,206,202,225,112,232,128, 36,132,252,211, 28, 41, 43,174,142, 60,245, 97,182,170,103,168,
-116,192,185, 36,160, 67,235, 48,140, 29,242,166,237,227,191,219,187,118,174, 95,226,213, 67, 13, 55,108, 89,194, 13, 11, 11, 67,
- 74, 74, 74,173,150, 66,173, 7,206, 38, 2,144,223,177, 43,146, 72,238, 47, 91,188,216,254,245,215, 95,231,123,121,121,129,195,
-225, 32, 59, 59,187,245,233,211,167, 91,126,252,241,199,227, 33,191, 83,164,214,163,228,108, 98,205,185,229,203,218,164, 65, 61,
-204,154, 56, 80, 10, 0,159, 15, 95,221,242,234,189, 28,167,251,247,239,119,153, 54,109, 90, 1,239,204,153,239, 93,128, 77, 57,
-192,195,218, 44,231,214,159, 47,139,164, 89, 63, 5, 12,157, 56,113, 95, 80, 80,144,173,191,191, 63,199,206,206, 14, 60, 30, 15,
- 69, 69, 69,126, 55,111,222,124,227,202,149, 43,170,211,231,126, 20,196, 94,233,157,156, 43,122, 77, 91,171,117,215,100,138, 78,
-218,217,221, 26,246,246,219, 62, 3, 7, 14, 20, 5, 6, 6, 2, 0,238,223,191, 31,188,119,239,222,193,251,246,237,155, 13, 77,
-166, 73,173,135,182,166,117,175,200, 4, 32, 2,218, 58,184,185, 13,229, 89, 89, 53, 49,153, 76,222,101,173, 13,143,204, 70,227,
- 45,121,110,238,246, 39, 31, 79,158,166, 51, 2,119,178,128,174,237,195, 49,172, 95, 87, 9, 0, 76, 27,180,160,117,218,131, 36,
-107,189, 94,143, 6, 33,141, 34,230,125,189,244, 4,184, 92,108,219,127,186,226,241,181,201,140,191,147,130,168,121,203,144,121,
- 99,111,107,115,113, 82,167, 18, 69, 49, 15, 0,236,165,210,126,123,119,253,116,198, 43,116,192,239, 73,249,134, 90,101, 86,247,
-218, 60,190,107,149,103,198,205, 51,141,215,156,220,104,229,231,231,135, 27, 55,110,212,237,181, 89,124,207,206,226,233,121,123,
-201,103,159,121, 68, 70, 70,194,214,214, 22,124, 62, 31, 38,147,169,235,197,139, 23,187, 70, 69, 69, 77, 64,241, 61, 85,109, 95,
-155,181,176,132,195,225,116,122,111,236, 36,207, 55,251, 12, 64,191, 30, 17,116, 32, 18, 66,254,105,202, 91,175, 30,191,242,112,
- 93,181,133, 22,159,207,207,125,125,196, 87,110,237, 95,107,138,171,215, 19,138, 83,211,179,148,229,191, 43,188,181,183, 65,159,
- 8,239,198,231,207,159,131, 78,167,195,111,191,253,134,235,215,175,227,193,131, 7, 24, 55,110,156,174,236,212, 97,101,153, 69,
-145,131,231, 58,162, 56,209, 54, 88,112,239,149,211,119,239,242,180, 90, 45,206,159, 63,143,162,162, 34, 8, 4, 2,248,248,248,
-160, 91,183,110,252,187,119,239, 58,117,121,189,135, 52,178,199,187, 41,144, 6, 43,249,124,126, 81, 85,243,136,240,249,252,220,
- 46,195,231,187, 53, 14,174,135,251,169,153,197,179,190,222,160,180, 88, 24, 63,249, 65,154,225,220,185,115, 8, 15, 15,199,169,
- 83,167,156, 11, 11, 11,191, 88,189,122,245, 44,171,133,107, 86, 24,245, 5, 83, 80,117, 94, 81,228,224,185,142,206,185,123,252,
-127, 61,126,208,250,214,173, 91,214, 63,252,240, 3, 10, 10, 10, 32, 16, 8,224,224,224, 0, 15, 15, 15, 52,104,208,128,243,249,
-231,159,219,246,234,117, 11,255, 55,102,128,191, 33, 96,244,189,170,150,179, 98,221,149,105, 54, 46,138,147,129,251,143, 28,225,
-182,107,215,238, 79, 31,219,235,215,175,143,238,221,187,139,134, 14, 29, 26, 56,112,240, 16, 75,100,207,247,238,195,214, 95, 93,
- 99,166,234,161,216, 89, 29,227,213,117,240,224,195,115,231,206,117,240,240,240,128, 68, 34, 1, 0, 20, 23, 23,251,164,166,166,
-182,158, 61,123,118,255,203,241,187,248,145,189, 30,102, 66,226,171,169,110,123,254, 87, 89, 89,241,115,203, 91,145,236, 36,226,
-162,135, 25, 57, 42, 0,208,235,245,208,235,245,208,233,116,248, 96,194, 56,222,152,254,173,130,252,219, 79,186,246,224, 81, 78,
- 97,163,211,191, 59,149, 63,215, 88, 67, 38, 95,253, 64, 46, 79,255,101, 76,212,103,159,121,184,187,255,113, 70,112,219,214,173,
-188,194,194,194,174, 81, 81, 81,141,153, 77, 71,121,163, 94,115, 29,170,203,172,238,181, 41, 79, 56,242,202,188,137,221,155,173,
-253, 58, 26,102,179, 25, 49, 49, 49, 56,127,254, 60,150, 46, 93,202,142, 29, 59, 86,108, 47,145,140, 65,181,175,205,123,118,237,
- 60,179, 3, 22, 46,220,199, 17, 10,133, 56,116,232, 16,238,222,189, 11, 46,151,139,176,176, 48, 12, 27, 54, 12, 93,187,118,245,
- 24, 59,118, 28,139,236, 49, 40, 25,210,144,146,231, 60,150,184, 0, 38,205,136, 90,232, 57,124,244,135, 88, 52,239,115, 42,180,
- 8, 33,255,228,214,172, 42,135,120, 64,116,116, 52, 43,187,117, 0, 0, 6,112,235,247, 93,187,115, 79,172,229, 72,253,190,107,
-119, 50,128,203, 0,174, 61, 80,175,121,243,230, 70,185, 92,206,174, 92,185,194, 62,248,224, 3,213,138, 21, 43,206, 28, 57,114,
-100,175,201, 96, 88,239,229,233,249, 45,171,162,131, 61, 3,184,254,128,212,198,198, 38, 47, 61, 61,157, 29, 61,122,148,205,153,
- 51,135,109,223,190,157, 29, 59,118,140,157, 62,125,154, 29, 59,118,140,237,220,185,147,197,199,199,179,132,132, 4, 38,145, 72,
-242,252, 1,105, 53,153, 60, 6,240, 26,244,253, 97,202,190,171,198,185, 33,125,215,126,204, 0,158, 35,208,176,121,243,230,230,
-189,123,247,178,109,219,182,177, 45, 91,182,176,248,248,120,150,159,159,207,248, 66, 73, 94,249,243,170, 90, 78, 6,112,189,189,
-189,243,228,114, 57,243,245,245,101, 2,129,128,185,187,187,179, 6, 13, 26,176,214,173, 91,179, 55,222,120,131, 13, 25, 50,132,
-125,241,197, 23, 76, 46,151, 51,145, 72,148, 83,254,188,170, 50,195, 1,177, 68, 34, 73,151,201,100,172, 42, 26,141,134,229,231,
-231,179, 19, 39, 78, 48,137, 68,146, 30, 14,136,171,203, 20, 3, 45, 66, 67, 67,243,242,243,243,153,193, 96, 96,233,233,233,236,
-230,205,155,236,238,221,187, 44, 61, 61,157,105, 52,154,138,236,132,132, 4, 22, 16, 16,144, 39, 6, 90, 48,186, 8,162,202, 99,
-233,201,155,159,187,251, 27, 30, 30, 30,154,125,251,246,177, 71,143, 30,177,205,155, 55, 51, 46,176,224,201,199, 85,151, 41, 0,
-186,181,107,215,206, 28, 19, 19,195,174, 93,187,198,166, 79,159,206,186,119,239,206,122,244,232,193,162,162,162, 88, 70, 70, 6,
-203,200,200, 96,111,188,241,134, 89, 0,116,171,233,248,172,236,181, 41, 5,252,122,245,234,165, 49, 24, 12, 44, 57, 57,153, 53,
-105,210, 36,131, 7, 12,149, 0,141, 59, 0,194,154,142, 79,111,192,209,211,211, 51, 43, 38, 38,134,237,223,191,159,249,251,251,
-231,241,128,247,236,129,250,246, 64,125, 30,240, 94,253,250,245,243, 98, 98, 98, 88, 65, 65, 1,243,243,243,203,242, 6, 28,159,
-227, 88,226, 2,216, 56, 35,106, 33,187,151,161, 98, 51,162, 22, 50, 0,233,140, 49,134, 74,250,120, 18, 66,254,253,158,172, 69,
-254, 45, 42,222, 36,123,245,234,197, 1,112,182,186, 7,107,120,188,175, 22, 45, 90,196,215,106,181,216,176, 97, 67,201, 59,253,
-251,239,233,208,190,125,242, 43,254,254,114, 14,151, 91,227,108,195,121, 66,225,228, 69,139, 22, 57,232,245,122,196,198,198,162,
-101,203,150,240,240,240,128,173,173, 45,108,109,109,225,230,230,134,144,144, 16,228,230,230,194,206,206, 14, 83,167, 78,149,230,
- 9,133,147,107,202,181, 88, 24, 31, 0,204, 22,139,192, 26, 24, 27,240,234,171,177,179,103,207,230, 58, 59, 59,195,201,201, 9,
-182,182,182,184,123,247, 46,244,122, 61,108,196, 54,181, 26,164,149,203,229,114,109,109,109,241,235,175,191, 98,210,164, 73,104,
-219,182, 45, 28, 28, 28, 96,103,103,135, 38, 77,154,160, 91,183,110, 24, 51,102, 12,146,147,147,193,169, 69,167,146,219,124,254,
-135, 99,198,140,113, 11, 15, 15,175,244,247, 90,173, 22,114,185, 28,121,121,121,240,241,241,193,128, 1, 3,220,110,243,249, 31,
- 86,149,231, 12,120,248, 4, 7, 31,190,114,229,138,139, 68, 34,193,182,109,219,112,240,224, 65, 28, 63,126, 28, 71,143, 30, 69,
-116,116, 52, 14, 29, 58,132,188,188, 60, 0, 64,112,112, 48,118,239,222,237, 98,235,230, 22,237, 12,120,208, 75,186,118,210,114,
-114, 78, 54,201,206,118, 25, 58,100,200, 5,165, 82,137,161, 67,135,226,171,111,190,249,220, 10,248,184, 54,207, 15, 1,164, 78,
-158,158,155, 22, 46, 92,200,205,206,206,198,219,111,191,157,191,228,155,111,222,143, 59,113, 34, 80,118,252,120,224, 87,115,231,
-190,223,161, 67,135,252,140,140, 12,108,221,186,149,235,238,231,183, 41, 4,144,214,117, 57, 75,128, 73,203,151, 47, 23,105,181,
- 90,188,254,250,235,201,150, 91,183, 66, 76,192, 79, 74,224,238, 89,192, 80,211,243,179,128, 15,167, 78,157,234, 33, 20, 10,241,
-233,167,159,230,171,211,210,154,154,128, 45,197, 64,106, 49,144,106, 2,182,148,164,164, 52, 29, 62,124,120,190, 80, 40,196,178,
-101,203, 60,178,254,152,116,187,182, 90, 2, 56, 12,224, 28,128,204,247,198, 78,122, 47,188, 85, 27,108, 93,191, 26, 95,207,157,
-182, 9,192, 59, 28, 14,103, 59,128, 41,116,228, 17,242,223, 84,155, 90,228,111,170,202, 41,119,248,143, 87,146, 0, 58, 86,151,
-226,232,236,220,178,105,211,166, 56,127,254, 60, 66, 67, 67,175, 56, 56, 56,152,172,133, 66, 88, 89, 89,129, 89,106,172,179, 32,
-150, 72,186,116,237,218,149,255,251,239,191, 35, 32, 32, 0, 98,177, 24, 86, 86, 86,127,186, 89, 91, 91,195,211,211, 19, 10,133,
- 2, 93,186,116,177, 90,185,114,101, 23,232,116,243,106,252,135,152,120,211, 54,239,247,133, 67,126,220,188,169,126,100,100, 36,
-138,139, 21,176, 88, 44,176,177,177,129, 94,175, 7,159,207, 47, 61, 5,100,100,138,218,108, 49,179,217,108,230,241,120, 8, 8,
- 8,192, 87, 95,125, 5,173, 86, 11,107,107,107, 0,128, 66,161,128, 92, 46,199,205,155, 55,145,154,154,138,178, 79,225,213,178,
-147, 74,223, 28, 56,112, 96,165, 19,254,234,116, 58, 20, 23, 23,163,184,184, 24,114,185, 28, 90,173, 22,109,218,180, 17, 28,137,
-142,126, 19, 5, 5, 75, 42,125,142, 72,212,127,235,214,173,110, 2,129, 0, 26,141, 6, 37, 37, 37,120,248,240, 33,210,210,210,
-180,185,185,185, 38, 59, 59, 59,174,191,191, 63, 87, 40, 20, 10,251,246,237,203, 81, 40, 20,224,112, 56,232,213,171,151,243,142,
-109,219, 6, 66,175, 95, 74, 47,233,218, 57, 9,232, 90,232,245,111,189,214,170,213,175, 87,174, 94, 13,159, 60,121, 50,226,227,
-227, 23,218,236,218,117, 78, 13, 92,175,238,185,201,192,135,223, 62, 86,192,176,180,180, 80, 3,144,247,216, 67, 82,253, 83, 82,
-142, 15, 31, 62,252, 70,124,124,188,203,178,101,203, 60,222,121,251,237, 15, 1, 44,168,203, 50,218, 73,165,175,122,122,122,226,
-216,177, 99, 72,127,240, 96,154, 9,208,212,233, 19, 23,143,215, 46, 50, 50, 18,135, 14, 29, 66, 70, 90,218, 52,211,159,151,177,
-244,131, 18,144,199, 79, 78,158,182,105,211,166,141,163, 70,141, 2,143,207,111, 7, 83,157, 78, 28, 62,213,241,125,212,184,201,
-216,180,110,229, 38, 0,163, 1, 88, 0, 92,161, 35,142,144,255,118,171, 86, 77,181,200, 63,168,216, 90, 87,231, 22, 45, 55, 55,
- 55,111, 91, 91, 91,100,102,102,162, 81,195,134,185, 66,161, 16, 2, 43, 43,136, 4,130, 90, 45,129, 90,173, 14,245,242,242, 66,
-113,113, 49, 92, 92, 92, 96,109,109, 93,113, 19, 8, 4, 21,223,219,217,217,129,203,229,194,207,207, 15,106,181, 58,180,198,220,
-156,155,110,187, 86, 78,248, 32,230,220,177,250,111,191,221, 15,142,142, 78,240,245,245,129,155,155, 27,196, 98, 49,124,125,125,
- 17, 24, 24,200,150, 44, 89, 2, 27,183,176, 90,189,145, 63, 94, 60,241,249,124,152,205,102,228,228,228,224,222,189,123,136,143,
-143, 71, 76, 76, 12,174, 93,187,134,146,146, 18,212,162,206,130, 90,163,105,198,231,243, 43, 45,178,228,114, 57,228,114,121, 69,
-161,149,151,151,135,212,212, 84, 40, 85,170,230,213, 20,189,253,154, 54,109,202, 3, 0,177, 88,140,230,205,155, 99,237,218,181,
-166,159, 15, 30, 28,212, 56, 38,198,201,247,196, 9,135, 31,127,248, 97,208,128, 1, 3,204,191,255,254, 59, 20, 10, 5,238,220,
-185, 3, 87, 87, 87,190, 64, 36, 26, 72, 47,231,186,145, 1, 42,151,146,146, 30,109,219,182, 77, 41, 46, 46,198,226,197,139,185,
- 86,118,118,235,230, 86,113,138,175, 2,143, 23, 17, 25, 25,137,195,135, 15, 35, 51, 45,109,122, 90, 37, 5, 76, 26,144,151,158,
-156, 60,125,211,166, 77,232,214,173, 27, 56,124,126,157, 59, 42,181,110,221,186,169,197, 98,193,141, 27, 55,224, 0, 92,174,235,
-243, 3,131,130,194,203, 91,126, 37,192,133,170, 30, 39, 1, 46,196,197,197, 65, 44, 22,163, 81,227,198, 45,234,248,103,150,112,
- 56,156,172, 81,227, 38, 99,255,241, 75, 0,128, 77,235, 86,230, 60, 86,100, 17, 66,168, 69,235,159,218,162, 85, 94, 88, 61,126,
-195,159, 10,173, 90, 22, 31, 0, 0, 43, 43, 43, 8,132, 66, 8, 4,130,210, 2, 73, 40,172,117, 6,135,195,129, 72, 36,170, 40,
-172, 30, 47,176, 30,255,222,198,198,166, 86, 5, 12, 0, 20, 37, 29,111, 63,250,253, 81, 2,161, 80, 8,189, 94, 7,198, 24,132,
- 66, 17, 28, 28, 28, 16, 16, 16, 0,133, 66,129,182, 17, 29,116, 15,229,214,209,206,141,250,198, 63,203,214, 51,153, 76, 80,169,
- 84, 40, 42, 42, 66, 97, 97, 33, 20, 10, 5, 52, 26, 77,173, 47, 69,183, 88, 44,188,135, 15, 31,226,167,159,126, 66, 65, 65, 1,
-128,210,142,214,229,197, 85,249,215,148,148, 20,108,219,182, 13, 15, 30, 60,168,211,254,105,223,190, 61,162,163,163,121, 29,187,
-116, 89,127,202,223, 63,243,148,191,127,102,199, 46, 93,214, 31, 62,124,152,231,237,237,141,212,212, 84,196,198,198,162,168,168,
- 8,140, 49,186,126,254, 25,220, 7,138,212,133,133,163, 62,255,252,115,102,107,107,139,197,223,126,219,108, 1,240,110,109, 11,
- 24,105, 53, 5,140,244,249, 10, 24, 48,198, 96,177, 88, 96, 54,155,159,105,221, 56, 28, 14,199,202,202,170,174, 67, 43,212,229,
-193, 21, 29,223,167,126,241, 21,142, 30,218, 91,254,243, 68, 42,178, 8, 33,255, 2, 85,118,132,231, 63, 86, 65, 86,124,173, 74,
- 78, 78,206, 35,149, 74, 85,223,223,223, 31, 25, 25, 25,110,126,126,126,105, 2, 43, 43, 88, 11, 4,224,112,107,174, 9,108,108,
-108,110,100,102,102, 70,120,123,123,195,100, 50, 85, 20, 85, 79,158, 58, 44,111,165,185,118,237, 26,108,108,108,110, 64, 91,237,
-200, 9, 48,235,139,234,181,104,209,162,162,101,200,193,193, 1, 14, 14, 82, 8,133, 34,204,156, 57,211,178,108,201,146,213,126,
-157,231, 22,143,252,248,115,246,249,130,245, 47,116,203,214,246, 31,147,141,141,205, 13, 95, 95,223, 54, 82,169, 20,251,247,239,
- 71,106,106, 42,138,138,138,160, 86,171,161,211,233,160, 86,171,161,215,235, 33, 18,137,208,184,113, 99,216,219,219,227,244,233,
-211, 55,160,211, 85, 94, 92, 22, 20,236,191,113,227, 70,155, 86,173, 90, 85,180,168,116,234,212,137,211,169, 83, 39,151,138, 86,
- 52,181, 26,249,249,249,184,114,229, 10, 78,159, 62, 13, 14,135,131,196,196, 68,179, 78,163,217, 73,175,137,103,163, 5,126,227,
-109,218,180,113,252,248,241,239, 71, 68, 68,192, 12,188, 1, 96,219, 95, 88,192, 0, 0, 98, 98, 98,110,154,205,230,136, 6, 13,
- 26, 64, 14,188, 6,224, 80,157,138,200,164,164, 56,147,201,212,165, 89,179,102,216,191,103, 79,123, 0,169,149, 61, 78, 5,180,
- 15, 15, 15,135, 70,163,193,157,219,183,101,117, 40,178,214,207,136, 90,248,222,240,209, 31, 98,235,250,213,216,180,110,229,195,
-141,107, 87,248,162, 22,253,199, 8, 33,255,169,214,172, 26,107,145,191,169,177, 85, 21, 95,252,186,164, 20, 23, 21,201,226,226,
-226,234,183,104,209, 2,235,215,175,111,213,182, 77,155, 71,214, 2,129, 73, 96,109, 13,110, 45,254,145,104, 84,170, 95,126,249,
-229,151,215,250,246,237,203,255,253,247,223,225,225,225, 81, 81,104,149,127,229,243,249, 96,140,193,198,198, 6, 7, 14, 28, 48,
-104, 84,170, 95,106,108, 45, 50, 91,204,220,178, 66,143, 49, 6,185, 92, 14,107,107,107, 44, 93,186, 12,171,150, 44, 25, 98, 6,
-246, 6, 75, 92, 63, 3, 32,250,203,254, 65,171,213,191, 30, 61,122,180,229,236,217,179,173,124,124,124, 32,151,203, 81, 84, 84,
-132,130,130, 2, 40, 20, 10, 40, 20, 10, 20, 21, 21, 65, 46,151, 67, 36, 18, 33, 62, 62,222,168, 85,171,127,173, 42, 79,168,213,
-238, 27, 49, 98,196,212,184,184, 56, 79, 62,159, 15,163,209, 8,139,197, 2,139,197, 2,131,193,128,164,164, 36,220,186,117, 11,
-119,239,222, 69, 97, 97, 33,172,172,172,192,227,241,112,237,218,181, 34,137,209,184, 71, 79,175,233,103,102, 5,236,191,120,241,
-226,251,195,134, 13,131,151,143, 79, 7,100,100,212,170,128, 57, 88, 77, 1, 83,252,108, 5,204, 31, 5, 80, 73,201,213,148,148,
-148,136,142, 29, 59,194,211,199,103, 97,227,140,140, 83,183,235,208, 79,203,108, 50, 93,184,120,241, 98,151,225,195,135, 99,253,
-250,245, 11, 93, 83, 82,142,231, 61,113,154,211, 21,112,125, 37, 48,112,225,123,239,189,135,147, 39, 79,194,108, 50, 93,168, 38,
-242,241, 17,223,235,189, 55,118,146,239, 19, 29,223,215,114, 56,156,137, 0, 22,211, 17, 69, 8,249, 55,183,104,213,233,212,161,
-216,108,158, 49,101,202, 20, 35,151,203, 69,191,126,253,236, 14, 29, 62, 60,224,218,245,235, 1,185,185,185, 14,102,179,185,198,
- 44, 87,157,110,197,148, 41, 83,228,122,189, 30, 33, 33, 33, 40, 44, 44,132,217,108, 6,159,207, 7,159,207, 7,135,195, 1,151,
-203,133,173,173, 45,226,226,226,176,113,227, 70,133,171, 78,183,162,198,127, 18,102,243,141,109,219,182,129,199,227, 49,145, 72,
- 4, 14,135, 3, 62,159,143,101,203,150,229,174, 2,246, 3, 0,143,203,213, 3, 0,151,203,169,109,239,221, 26,207, 91, 10, 4,
- 2, 88, 74, 47, 2,168,241,177,142, 58,221,242, 69,139, 22,149,220,185,115, 7, 42,149,170,162,245, 77,169, 84, 86,116,174,151,
-203,229,224,112, 56, 80,169, 84, 56,124,248,112,137,163, 78,183,188,170,188, 2, 32, 59, 35, 49,177,119,171, 86,173, 10, 82, 82,
- 82, 80, 92, 92,140, 27, 55,110,224,244,233,211,216,189,123, 55, 78,158, 60,137,164,164, 36,152, 76, 38,120,123,123,131, 49,134,
-131, 7, 15, 22,155, 74, 74,222, 40, 0,178,233, 53, 81,181,122, 30, 30, 93,220,221,220,210, 93, 93, 92, 50,234,121,120,116,121,
-242,247, 82, 32, 33, 33, 33, 1, 38,147, 9, 1, 1, 1, 78,213,245,211, 98, 38,211,197,139, 23, 47, 98,248,240,225,240,173, 95,
-255, 27,127,192,245,201,199,248, 3,174,254,129,129,223,148, 23, 48,204,100,186, 88,215,101,182, 3, 86,126,246,217,103, 26,107,
-107,107,236,218,181, 43,192, 24, 20,116,151, 15,188,107, 11, 52,236, 8, 88,215,244,124, 79, 96,245, 23, 95,124,145,205,225,112,
-176,125,251,118, 23,105, 96,224, 77, 62, 48, 66, 10,212,147, 2,245,248,192, 8,105, 96,224,205, 93,187,118,185,152, 76, 38,124,
-252,241,199,217,158,192,234,106, 34, 39, 49,198,222, 98,140, 69, 50,198,124, 55,174, 93,129,163,135,246,150, 23, 89,163, 81,218,
-233,125, 24,128,155,116,196, 17, 66,254,205, 42,109,134,226,183,154,159, 3, 48,183, 14,173,195,112,245,250,189, 98, 23, 71,251,
- 19,229,191, 43,188,181,183, 65,231, 80,251,176, 53,107,214,192,202,202, 10, 15, 31, 62,196,237,219,183, 97,111,111,143, 33, 67,
-134,232, 52, 37, 37,189, 31,155,235,176, 43,128,211,101,153,165,243,169, 21, 39,218, 6,242,227,235, 31, 63, 26,205,147, 74,165,
- 80, 42,149,224,114,185, 16,137, 68,176,177,177,129, 88, 44, 70,108,108, 44,122,190,213,199,156,103, 19,249,199,128,165,127,204,
-167, 86,145, 89, 62,214,208,107,128, 77, 28,240,169,155,151,215,148, 89,179,102,137,187,119,239, 14,107,107,107,248,212, 11,206,
- 14,232,177,120, 37,151,203, 49,101, 20, 40,102, 6,214,243,146,222, 78, 76, 5,192,201, 53, 94,153,229,245,216, 92,135, 79, 45,
-167,159,254, 92,192,129, 45, 75,236,155, 55, 47,237,143, 46,151,203,145,147,147,131,220,220, 92,200,229,114,168, 84, 42, 0, 64,
-116,116, 52,142,158,191,171,208,248, 12, 72,174,106, 57,255, 88,247,123,118, 94,134,203,175,236,216,182,133,231,234,234,138,156,
-156, 28,228,229,229, 65, 46,151, 67,163,209,192,108, 54,163,176,176, 16, 27, 54,109, 49, 23,216, 70, 62,168, 24, 16,178,186, 76,
-213, 67,177,147,242,146,119,120, 99,127,246,254,251,239,219,217,219,219,195, 98,177,160,168,168, 8,233,233,233, 72, 73, 73,193,
-249,243,231, 85,185,114, 61, 84, 46,175,103, 84, 12, 88, 90, 73,230, 11,244,143,203,124,124,220, 42, 47, 79,207,204,180,180, 52,
- 55,179,217, 12,111,111,111,147,188,176,240, 27, 1,112,210, 14,200,250,127,246,174, 59, 44,138,107,125,191, 51, 59,219,119, 89,
-250,210, 81, 68, 64,186, 34,150, 24, 75, 20,236,216, 75, 52, 26, 77,108, 49, 49,177,196, 36, 26, 19, 91,212, 24, 99,162,166, 89,
-163,198,146,216,176, 4, 59,138, 98,185, 54,176,208, 65, 4, 1, 41, 75,221, 93,182,183,249,253, 33,112,209, 0,187,152,228,222,
- 27,127,251, 62,207, 62, 44,187,179,239,156,115,230,204,153,247,124,231, 59,223, 7,128,174, 0, 62,219,248,221,119,111,143, 24,
- 49, 2, 93,186,116, 41, 44, 45, 43,243,105,170, 47,209, 0,163, 3, 96,171,244,244, 76,189,117,235,150,107, 65, 65, 1,222,124,
-243,205,138,199, 15, 31, 46,170,247,215,146, 2,189,218,180,111,191,246,192,129, 3, 78,237,218,181, 67, 88, 88, 88, 41,183,160,
- 32, 36, 19,144, 54,211, 63,155,189, 55,107,178, 78,250,204, 30, 21,218,229,221,119,223,133,193, 96, 64, 98, 98, 34,110,222,188,
-137,199,143, 31,227,218,181,107, 53, 34,129,224,245, 70,185, 14,155,236,159,131,253, 21,190,251,246,237, 37, 88, 44, 22,118,237,
-218,133,228,228,100, 0, 64, 68, 68, 4,222,122,235, 45, 24, 12, 6, 76,154, 52,153, 62,153,201,203,109,169,127, 2, 8, 5,176,
- 30, 79, 69, 94, 23,154,166,185, 4, 65, 20, 3,240, 66,235,124,178,172,253,211,202,105,229,252,255,195,249, 82,194,108,174,195,
- 85,155, 97,251,108,154,143, 25,197,135,183,174,160,122,246,234, 29,184, 98,249, 50,178,107,215,174,240,242,242, 66, 68, 68, 4,
- 10, 10, 10, 56,118,118,118,230,242,169,213,246, 30, 52,241, 81,120,120,184,221,162, 69,139,108, 7, 12, 24,192,244,242,242, 2,
- 77,211, 72, 78, 78, 70,108,108,172,110,199,142, 29, 50,165,203,176,154,164,132, 95,107, 45,201,167,118, 19, 80, 2, 88,233, 89,
- 92,188,237,189,217,179,151,117,234,220,121,218,242,229,203, 73, 33,159,199, 92,179,100, 58, 23, 0, 86,253,112,208,118,196,216,
- 55,176,209,237,243,221,133, 0, 0, 32, 0, 73, 68, 65, 84, 15,232, 51,177,233, 60,114,141,203, 89, 80, 52,227,241,144, 81, 81,
-126, 31,206,121,219, 56,126,252,120,129, 72, 36,130,151,151, 23,236,237,237,145,155,155,139,162,162, 34,250,247,223,127,175,253,
-215,221, 44,230,177,115,183, 31,115,109,221, 44,201, 75, 40,239, 61,112, 92,222,144, 33, 67,236,167, 76,153, 98, 19, 25, 25,201,
-228,112, 56,224,112, 56, 40, 43, 43, 67, 78, 78,142,238,247,223,127,175, 85,138, 7, 87, 39, 37, 28,144, 91,152,235, 80,213,123,
-194,138,156, 43,231,151,207, 79,125,240, 96,178, 9,232,168,211,233, 60,140, 70, 35, 65,146,100,137,201,100,122,160,147,203,119,
-106, 34,150,111,176,230, 58,180, 12, 70,163,145,101, 52, 26, 81, 83, 83,131,243,231,207, 83, 15, 31, 62,252,236,222,189,123,159,
- 21, 23, 23, 67,175,215, 99,204,152, 49,136,136,136, 64, 66, 66, 2,202,203,202,126,111,137, 43, 19,144,114,138,138,222,154, 49,
- 99,198,233,189,123,247,146,247,238,221,115,218,181,107,215,207, 77, 9,152,201,147, 39,155,202, 10, 10,222,210, 0,210, 22,250,
-103, 75,247,102,197,153, 3,223,223, 27, 57,122,108,240,242,165,159, 49,123,244,232, 1, 39, 39, 39,244,234,213, 11, 58,157,206,
- 46, 40, 40,200,220,189, 41,239, 61,232,245,220,142, 29, 59, 10, 54,108,216,224,250,246,219,111, 99,206,156, 57, 0, 0,149, 74,
-133,115,231,206, 97,254,252,249,165, 5, 84, 55,133,185,254, 89,103,169,170, 23, 96,151, 1,244, 6,144, 11,171,227,187, 21, 86,
- 88,241,114,162, 62,169,180, 27,158, 38,150, 62,137,167,147,115,243,185, 14,175,220, 76, 65,227, 52, 31, 79,225,150,102,240,158,
-242,112,214,194,181, 97, 12,189,204,158, 73,168, 69,217, 89, 89,132,185,156,135, 13,249,212,108,253,107, 29, 31,253,214,117,205,
-170, 85,115, 55,110,220, 24, 85, 31,194,129,207,231, 63, 80, 41, 20, 23,156, 53,154, 77, 74, 91,255, 11,173,205,205, 87, 4,148,
- 1,152,109,159,148,244, 93,204,136, 49,235,184, 14,190,204, 79, 87,239, 80, 51, 72, 82,155, 83, 92,142,141,126,128,192,130, 13,
-146, 74, 45,144, 90,227,102, 40,115, 28,155,249,249, 71, 31,125,184,106,229,202,174, 66,161,176,143,206, 96,240, 55,153, 76,128,
-201,148,173, 84, 40, 46,211, 58,221, 45, 77,196,210,111,184,182,110,180,197,121, 9,237,130,228, 14,121,135,187,238,222,185,243,
-131, 67,135, 14,253,161,238,142, 26,205,119, 74,187,160,120, 75,234,222,248, 24, 53,112, 29, 18,201,245,150, 76,151,214, 92,135,
- 22,206, 62, 76,166,153,246,246,246,123,162,162,162,184,209,209,209, 24, 58,116, 40,122,244,232, 1,147,201, 4,154,166, 33,151,
-203,113,240,224, 65,172, 91,183, 46,219, 7, 88,105,142, 79, 3, 92,224,156, 58, 53,184, 99,199,142,187, 90, 18, 48,117, 34,203,
-172, 79, 98,203,247, 38, 39,219, 96, 59, 60,127,194,123,107,252,180,178, 18, 59, 71,190,193, 53, 53,229, 1,105,249,189,217, 65,
-110, 76, 62,216,109,204,168, 81,239, 49, 40,170, 87,221, 14, 72, 58, 61, 45, 45,169, 62,169, 52, 34,222, 58,223,202,190, 84, 31,
-187,206,234,248,110,133, 21, 86,188,236, 66,107, 40,158,250,107, 53,164,228,105, 54,215, 97,189,213,135,162, 40, 73,238,177, 89,
-111,180,196,206, 4,162,234, 44, 89, 48,155,235,176,238,125, 62, 32,135, 70,243,197, 51,193, 72, 27,237, 46,100, 62,119,124,107,
-194, 34, 86, 3,153, 48,104, 98, 32, 73, 3, 78,204,126,202,215,117,213, 39,141,235,212,236, 67,246,153,243,178,170,212,192, 21,
-212,214, 94, 65,109,109,147, 78,187, 76,138, 85,101,174,156,207,215,189, 0,144,253,217,186, 63,207,105, 86, 60,252,137,246,252,
-255,134, 39, 21, 21,199, 0, 8, 61,227,226, 92,206,196,197,141,255,112,193,130, 49,110,238,238,237,157,156,156,236,109,108,108,
-200, 27, 55,110, 60, 50,168,213,223,117, 2,118,215, 89, 83,205, 66, 3, 92,232, 80, 80, 16, 50,110,212,168,247, 8,138,234,217,
- 88,192,208, 6,195, 53, 95,224,199,150, 44, 89, 47,122,111,122,113,220,162,234, 44, 89, 96, 0, 51, 44,233, 27, 69, 79,203,177,
- 26, 6,195,106,220,191,223, 68,159,111,117, 95, 90, 69, 16,132, 28, 86,199,119, 43,172,176,226,229, 69,125,190,195,147,255,233,
- 19, 71, 91, 57,173,156, 47, 17, 39, 3, 79,119,209, 89,219,211,202,105,229,180,114, 90, 57,173,176, 8,148,181, 9,172,176,194,
- 98, 24,241,239,101, 48, 43,172,176,194, 10, 43,172,168, 71,189,111, 86, 99,108, 3,158,186,238, 52,167, 74, 91,179,155,224, 69,
-148,109,188,149,211,202,105,229,180,114, 90, 57,255, 43,156,124,252,113,217,219,218,158, 86,206,255, 20,167, 57,238,127,226,110,
-198,122,159,172, 6,223,172,255, 20,172,102, 85, 43,167,149,211,202,105,229,180,114, 90, 57,173,156, 47, 59,220,234, 68, 86,227,
- 23,128, 86, 6, 44,181,194, 10, 43,172,120, 89,177,124, 57, 72,154, 6, 65,211,203, 73,154, 62,196,160,233,177, 12,154,198,159,
- 74, 5, 50,118,108,211,193,108,223,127,195,222,198,218,226, 86, 88,241, 82,161, 4,205, 36,149,182,250,104,253,119,225,237,234,
-234,186, 21, 0, 81, 90, 90, 58, 19, 64,129,181, 73,254,247,224,224,224, 16,101, 48, 24, 32,147,201, 46,188,140,245, 11,110,143,
- 81, 52,137,160,134, 15,104, 20,164,231, 96, 79, 83,199, 6,249,225, 77, 16,255,142,197, 69,152,144,158,246, 16, 71, 91,113, 58,
-114,112,180,215,143, 0,112, 58,190,240, 61,252, 61,113,181, 2,156,157,157,207, 82, 20, 69, 25,141,198,217, 18,137, 36,174,121,
- 33, 52,150, 1, 0, 76, 58, 97,113, 77,169,120,209,188,119, 8,166, 82,179,179, 70,163, 82, 72, 25, 76, 70, 30,135,233,122,117,
-214,219,228,233,234,218, 87,210,154,250,253,225,195,135,155,205,226, 29,226,135,193,164, 49,120, 88, 68,232,163,220,245,155,186,
-110,236,227,235,196,124, 84,120, 87,248,213, 22,233, 86,182, 93,155, 97,111,142, 39,226, 40, 62, 49,121,231,206,202,218,151,245,
-222, 89, 3,144,122, 38,179, 3, 97, 50,249,130, 32,248, 4, 0,218,100, 50, 17, 36,249,136,107, 48,100, 45, 4,106, 95,128,211,
- 65, 7,132, 49, 57, 28, 47,163,193,224, 66, 0, 52,131,162,202,244, 26, 77, 33, 11,184,191, 24,168,121,217, 57, 89, 28,142,167,
-209, 96,112, 1,128,255,197,114, 90,241, 44,154, 21, 90, 66,161,240, 14, 73,146,158,141,147,225,214,231, 19,172,255,172,241,119,
- 4, 65,192,104, 52, 22, 85, 87, 87, 71,182,226,252, 34, 0,227, 1,212,111, 81,223, 15,224, 32, 94,220,225, 88,196, 98,177, 22,
- 10, 4,130,126, 42,149, 42, 4, 0,120, 60, 94,170, 66,161,184,168,211,233,214,191, 32, 47, 5, 96,156, 80, 40,236, 75,146,100,
- 95,154,166, 9,154,166, 19,106,107,107, 47, 2, 56, 4,224, 69, 34, 37,240,196, 98,241,106, 7, 7,135,137,139, 23, 47,174,116,
-116,116,236, 48,127,254,252,219, 85, 85, 85,191, 86, 84, 84, 44, 65, 43,114,212,253,205,104,239,234,234,186,159,201,100, 50, 10,
- 11, 11,251, 2,128,151,151, 87,130, 86,171, 53, 74, 36,146, 55, 0, 60,108, 37,159, 0, 64,119,161, 80, 24, 41, 20, 10,123, 27,
-141,198,160,186,252,140,233,181,181,181,137, 58,157,238, 14,128, 27, 0, 20,255, 67,247,136, 13, 69, 81,123,235,250,186, 63, 0,
-249,203, 54, 8,208, 36,130,210, 82, 51, 58, 52, 8,175,144,192,230, 15, 38,224,221,196,177, 22, 11,173,126,125,220,134, 13, 31,
-222,159, 4, 0,173,254,244,176,139,151, 75,142,255,197,213, 9, 24, 61,122,244,245,189,123,247,218,107, 52, 26,204,156, 57,115,
-127,124,124,252,143, 50,153,108,113,139, 3,135,208,126,254,215, 27,206,241, 9,130, 4, 0,177,201,100, 20, 63,121,242,208, 63,
- 45,229,250,160,212,212,127,173, 81,101, 92,188, 97, 34,152,179,116,232,149, 97, 73, 33,130,124, 17, 51,108,204,168,161, 43, 87,
- 46,199,196,215, 39,182, 77, 77, 85,243, 60, 68,185,236, 42,149,192,207,209, 89, 60,124,229,170,195,196,213, 43,199,134,239,221,
-181,226,226,219,111, 59,246,123, 9,197, 22,177,140,205,246,214, 27,141,131, 72,160,132,178,177,201, 5,139,165, 4, 0,210,104,
-100,104,101,178,246, 74,138,154,244, 5,112,235,115,131,225,174,165,156,171, 40,170,187,173,159, 95,239,215,143, 29,131,208,203,
-139,162, 56, 28, 18, 0, 12, 26,141, 87,109, 97,161,219,129,225,195,187, 45,207,202,186,180, 28,184,105,229,252,175,112, 90,209,
- 26,161, 69,146,164,231,147, 39, 79,196, 2,129,224,233, 96, 76,211, 48, 26,141, 48, 26,141, 13,201,139,105,154,110,248,107, 48,
- 24, 16, 24, 24,104,209,140, 22, 64, 63, 0, 83, 95,123,237,181,177,235,215,175,103,134,133,133,213,167, 12,233,245,233,167,159,
-254,144,156,156,124, 4,192,110, 60, 13,222,104,233,140,119,160, 64, 32,216,247,245,215, 95,139,250,247,239, 79,185,187,187,131,
- 32, 8,148,150,150,118,143,143,143,143,156, 63,127,254,108,133, 66, 49, 9,192,217, 86,180, 79,168,141,141,205,225, 81,163, 70,
-121,246,233,211,135, 27, 28, 28, 12,163,209,136,187,119,239,190,125,231,206,157, 9, 71,142, 28, 89, 38,151,203,199,194,242,124,
-109,132, 80, 40,156, 34, 18,137, 86, 47, 93,186,212, 97,210,164, 73,236,148,148,148,106, 95, 95, 95,226,234,213,171,206, 7, 15,
- 30,156,189,118,237,218,113, 50,153,108, 73,109,109,237, 47,176, 32,135,162,141,141,205, 29,146, 36, 61, 45, 17,194, 0, 90, 35,
-134, 59,249,248,248, 28,188,114,229,138, 79,126,126,190,113,228,200,145,123, 0,224,226,197,139, 97,122,189,158, 24, 48, 96,192,
-233,162,162,162,241, 0, 44, 29, 36,195, 29, 28, 28,142, 79,156, 56,209,161,125,251,246,124, 31, 31, 31, 66, 32, 16,128,193, 96,
- 64, 42,149,186,167,164,164, 68,223,188,121, 83, 21, 31, 31, 95,165,209,104,134, 3,184,223,138,235,212, 67, 44, 22, 79,102, 50,
-153,161, 6,131,193, 3, 0, 40,138,122,162,215,235, 83, 36, 18,201, 94, 0,215, 95,244, 6,113,113,113,249,126,245,234,213, 78,
- 18,137,132, 94,187,118,237,247,114,185,124,202,203, 58, 24,236,255,245, 16,238,220,190, 9, 60, 77,155, 67, 52,209,255, 8, 0,
-172,121,243, 22, 32,178, 75, 55,188, 49,113,156, 89,206, 33, 81,158, 95, 51,217, 44, 71,181, 90,125, 93,170,212, 28, 18,240,185,
-227, 39, 78,136,201, 6,128,211,103, 46,141,239,218,213, 62,193,150,207, 25,199,229,114,123,232,181,186,202, 83, 23,138, 62,106,
-141,168,242,240,240, 56,107,111,111,207,175,170,170, 42, 45, 47, 47,223, 60,108,216,176, 85,187,119,239,182,127,244,232, 17, 10,
- 11, 11, 49,119,238, 92, 97, 81, 81,209,123,247,239,223,255,151, 86,171,109,214,178, 37,151, 87,109,250,116,209,136,165,182,182,
- 78, 12, 1, 95, 4, 27, 91, 7,248,182,239,136,238, 61,134, 97,240,208,105,200,201, 78,238,190,123,215,202,228, 39, 79,226,191,
- 20, 58,180, 91, 85, 83,227,211,236,184, 20, 28,128, 62,195, 71, 61, 21, 89, 75,151, 46, 71, 86, 70,134, 60, 63,143,124,255,228,
- 49,138, 63, 56, 42,144, 99,208,150,230, 95,189,114,204,167,103,175,145, 0, 16,185,119,215,138,139,239,191, 97, 31,245,253,254,
-234,151, 69,196, 19, 43,153,204, 80, 24, 12, 1,142,110,110, 7,212, 38, 19,173,151, 74,189, 76, 74,165, 27, 0, 24,152, 76,173,
- 64, 40,124,224,238,231,151,152,149,148,212,251, 11,138,234,245,121,203, 9,202,235, 57,167, 12,220,176, 65, 28, 49,123, 54,171,
- 54, 47, 79,151,187,101,139,178, 44, 49,209, 72,113, 56,180,215,160, 65,132,115,223,190,220,217,233,233,172,107,107,215,246,102,
-174, 88,225,187, 68,167,219,103,229,252,143,114,254,127, 71,189, 19,124,227,221,135,219, 90, 20, 90, 4, 65, 64, 32, 16,224,192,
-129, 3, 96, 50,153,160, 40, 10, 76, 38,179,217,247,222,222,222,150, 20,100,180,171,171,235, 15, 63,254,248,163,203,192,129, 3,
-193,229,114, 27,190, 96, 48, 24,232,223,191, 63,162,163,163,153,197,197,197, 19, 14, 28, 56, 48, 97,205,154, 53,101, 53, 53, 53,
-115, 80,151, 24,186, 5,244,237,208,161, 67,236,185,115,231,120,106,181, 26,137,137,137,168,174,174, 6,155,205,134,167,167, 39,
- 6, 12, 24, 64,101,100,100, 56,244,239,223, 63, 54, 43, 43, 43, 6, 64,130, 5,101,141, 20,139,197,151, 15, 29, 58,196,237,216,
-177, 35,145,147,147,131,136,136, 8, 0,128, 84, 42,197,200,145, 35,185,147, 38, 77,106, 63, 97,194,132, 27, 18,137,164, 15,128,
- 59,102,248, 58,187,186,186,254, 50,106,212, 40,247, 53,107,214,136,108,108,108,144,159,159, 95,226,234,234,234, 95,223,222, 19,
- 38, 76, 96, 15, 27, 54,204,109,221,186,117,155, 14, 31, 62,252,145, 68, 34,153, 2, 32,169, 69,213, 90, 39,136,249,124, 62,202,
-202,202,176,127,255,126,188,247,222,123, 96, 48, 24,144, 72, 36, 56,120,240, 32,222,127,255,253,122, 65, 99,145, 24,230,243,249,
-209,126,126,126, 63, 95,188,120,209,211,206,206, 14,238,238,238,228,231,159,127, 30,234,235,235,203,107,219,182, 45,163,164,164,
- 4,177,177,177,190,147, 39, 79, 62, 94, 80, 80,240,182, 70,163, 49,187,164,230,226,226,178,243,228,201,147,222,169,169,169,216,
-178,101, 11,170,170,170,192,102,179, 97,103,103, 7, 87, 87, 87,248,251,251, 19,139, 22, 45,226, 15, 27, 54,140, 63,103,206,156,
-157, 90,173,182,147, 5,215,168,163, 88, 44,222,218,183,111, 95,223, 21, 43, 86,216,185,186,186,162,126, 98, 32,149, 74, 61,243,
-243,243,187, 47, 93,186,116,236,157, 59,119, 30, 73, 36,146, 89, 0,238,181,242,198,233, 20, 28, 28, 28, 51,114,228, 72, 70, 73,
- 73, 9,246,238,221, 27, 35,151,203, 59,181, 66, 92,254,163,112,231,246, 77,204,124,119,110,173,187,151, 23,235,220,217,159, 71,
- 31, 62, 26,112,219,142,247, 52, 33,117,141, 10,186,177,163,178,186, 12, 24, 56,141, 53,100,232,200,218,109, 63,109, 18, 90, 34,
-180,152,108,150,227,254,125,223, 22, 92,185,122, 39,244,124,252,205, 65,163,135, 15,167, 89, 44, 59, 95, 0,248,104,254, 60,102,
-236,137, 19,187,250, 71,119, 43,238,213, 51,178,224,141, 73, 11,188, 91, 81,220,128,128,128,128, 75,201,201,201, 46, 28, 14, 7,
- 85, 85, 85,142,219,182,109,251,182,103,207,158,100,110,110, 46, 50, 50, 50,144,151,151, 7,169, 84,138,254,253,251, 11,147,146,
-146, 54, 3,104, 86,104,233,200,126,171,221,219,234,191,115,228, 9,124,116, 70,153,152,214,151, 4,159, 63,121, 62,252,183,189,
-170, 8, 23,183, 64,255,169,111, 45,195,202, 85, 71,152,191,238,255,106,233,133,248,223, 0,210,167,249,140, 0, 52,122,124,186,
-100, 49,100,114, 13, 38, 77,156,129,201, 19,103, 56,210,208,186,209, 70,181, 64,171,170,182,179, 97,165,199,253,184,227,219, 81,
- 0, 60, 27,137,173, 11, 47,139,216, 90,201, 98,249,192,100,242,245, 31, 57,242, 88,238,153, 51,237,104,157,206,137,193,102, 23,
-217, 56, 56,148, 25, 52, 26, 90,175,211,177, 84, 42,149, 71,110,106,170, 91,207, 69,139, 46, 92, 93,187,182,207, 23, 12, 70,151,
-207,141,198,219,205,114, 82, 84,183,152, 31,126,112, 14,157, 62,157,115,111,197, 10, 69, 69, 98,162,202,111,200,144,234,136,119,
-222,209, 0,128, 60, 47,143,149,181,108, 25,223,185,119,111,222, 43, 11, 23,218, 27,181, 90,215,149, 43, 87,118, 93,250, 52,121,
-121,171, 56,189,199,143, 55, 46,221,181,171, 75,226,130, 5,175, 17,122, 61, 99,208, 43,175,220, 93,187,119,239,147, 63,195,249,
- 87,150,179,248,242,101, 77,149,175, 47, 34, 70,142,172,244, 22,139, 53,127,101,221,255, 76, 57,173,104, 64,189,175,214,204,198,
- 51, 84,196,197,197,245, 1,112, 9,192,138,152,152,152,229, 0, 96,107,107, 91, 86, 83, 83, 35,142,141,141, 53, 43,178,152, 76,
- 38,220,220,220,224,239,239, 47,145, 72, 36, 46, 45, 20,160,208,100, 50,121,210, 52,221, 96,125,105, 14, 26,141, 6,217,217,217,
- 8, 15, 15, 47,194,211, 68,180,205, 26,117,248,124,126,110, 70, 70,134, 83, 90, 90, 26,238,220,185, 3, 95, 95, 95,216,219,219,
-131,201,100, 66,175,215, 67, 38,147,161, 67,135, 14,224,112, 56,232,220,185,115,133, 66,161,240, 53,179, 4,196, 17, 8, 4,217,
-151, 47, 95,246,138,136,136,192,173, 91,183,224,229,229, 5, 87, 87, 87, 0, 64, 94, 94, 30,174, 94,189,138, 33, 67,134, 32, 57,
- 57, 25, 99,198,140, 41, 84, 40, 20,254, 0, 52,205, 17, 58, 56, 56,148, 92,188,120,177, 40, 44, 44, 76,173, 80, 40,200,178,178,
- 50,102, 98, 98,162, 65, 46,151, 11,165, 82, 41,179,166,166,134, 41,147,201, 40,133, 66,193, 36, 73,146,165, 82,169,152, 23, 46,
- 92, 96,232,116,186, 22, 3,100,214, 95,167, 19, 39, 78, 32, 44, 44, 12,177,177,177,248,240,195, 15,113,237,218, 53,120,121,121,
-225,208,161, 67, 88,184,112, 33, 50, 51, 51,225,228,228,132,224,224, 96,115,215, 8,237,219,183,207,121,240,224, 65,123, 22,139,
- 85,159,215,177, 62, 95, 30,202,203,203,241,240,225, 67, 60,121,242, 4,126,126,126,152, 56,113,226,195, 39, 79,158,248,153,235,
-121, 30, 30, 30,229,169,169,169, 78,225,225,225, 40, 43, 43,131,157,157, 29,108,109,109, 97,103,103,215,240,222,215,215, 23, 11,
- 22, 44,128,171,171,171, 68,173, 86,187,152, 19, 65, 97, 97, 97,103, 47, 92,184,224, 36, 18,137, 80, 90, 90, 10,153, 76, 6,138,
-162,192,231,243,225,228,228,212, 32,228,179,179,179, 49,116,232,208,138,220,220,220,129,173, 16, 73,164,139,139, 75,198,253,251,
-247,253,105,154, 70, 65, 65, 1, 50, 51, 51,241,238,187,239,102,171,213,234, 64,188, 68, 57,251, 26,249, 93,177,166,188, 53,147,
- 53,106, 68, 15,109,122,106, 28,193, 49,101,162, 83,168, 72, 10, 0,119, 83,100,182, 26,178, 3,130, 66, 98,232,163,199,175,179,
-127,217,189,141, 9, 19, 92, 64, 32, 51, 61, 27, 95, 52,199, 61,160,175,219,244,121,243,222, 14,125,173,103, 31, 82,174, 80,136,
- 55,111,222,208, 57, 55, 55, 93, 12, 0,190,190, 65,146,217,179,231, 39,217, 8, 4,146, 75, 87, 47,155, 54,110,220,153,114, 46,
-161,100,135, 5, 69,246,245,247,247,255,215,137, 19, 39,156,196, 98, 49,108,109,109,161, 80, 40,160,211,233,144,150,150,166, 62,
-112,224,128, 94, 36, 18,217,148,150,150,162,166,166, 6, 4, 65,224,196,137, 19, 5, 0,218, 60, 79, 84,239,163, 5, 0,239, 14,
- 14, 98, 6,247,243,183,103,113, 12, 60, 30, 51,203, 13,132,145, 67,208, 66,151,211,103,239,134,159, 62,127,235,141, 81,163, 63,
-116,238,213,103, 20,150,126, 54, 86, 95, 92, 92, 16,161, 67,175,140,166,124,180, 2,253,208,111,228,152, 81,227, 86,174, 92,142,
-229, 75, 87, 32,238,196, 49,169, 80, 64,106, 68,118, 76,219,222,221, 95, 85, 47,120,111, 68, 97,109,109,177,215,202,117, 7, 38,
- 14, 29,177,192,179,103,175,145,184,122,229, 24,246,238, 90,113,135,224,209,255,232,101,196,101, 0,139,164,168,105,238, 62, 62,
-251, 36,197,197, 30,124,161,144, 57, 55, 62, 94,108, 52, 26,111,143, 91,184, 80,126,244,194,133, 6, 43,233,231, 36,233,206, 96,
- 48,220,253,135, 14,189,159, 19, 23, 55,141, 99, 48,196,126, 2,148, 63,207,185, 28,176,183,243,245,157,245, 65,118, 54,235,222,
-242,229,181,134,226,226,234,200,249,243, 43,154, 58,127,209,249,243, 2,182,187,187,200,126,248,112,135, 77,109,218,208,122,137,
-100,107, 83, 62, 70, 77,113,198, 11,133,118,191,157, 62, 29, 69, 51,153,125, 62,254,228, 19, 94, 76, 76, 12,100, 50, 25,142, 28,
- 57,130,173, 91,182,104,220,220,220, 30,184,167,164, 36,135,202,100,159, 89,202, 25, 57,127,126,133,209,104, 36,198, 45, 92,216,
- 63, 53, 47,175, 95,169, 68,210, 22, 0,220, 28, 28, 10, 35,125,125,239,236,140,139,203,252,222,199,199,100,105, 57,183,159, 57,
-227,114, 56, 63,127,186,131,131, 3,175, 76, 34,161, 56,108,118,101,247,224,224, 67, 63, 45, 89,114,201,112,255, 62,139,235,233,
- 41,178,141,137,105,117,221, 35,231,207,175,168,146,203,169, 15, 86,173,122,245,113, 89, 89,219, 90,141,198,175, 70, 46,119, 53,
-234,245,164,136,207,175,108,215,161,131, 68,149,152, 88,210, 78,169,156,187, 3,144,252, 93,253,167, 41, 45,242, 15,194,243,113,
-180,254,144,235,240, 82, 76, 76,204, 31,118,215,208, 52,109,145, 53,139,201,100, 62,179, 76,213, 2, 88, 4, 65, 32, 41, 41, 9,
-142,142,142,112,117,117, 5,135,243,108,242,193,242,242,114, 92,187,118, 13,233,233,233,232,216,177, 99,253, 50, 70,243,138,136,
-195,153,183,110,221, 58, 59,173, 86,139, 59,119,238, 32, 50, 50, 18, 28, 14, 7, 44, 22,235, 25, 17, 40,145, 72, 16, 18, 18,130,
-143, 63,254,216,118,205,154, 53,243, 52, 26, 77,179, 51, 82,138,162,230,204,152, 49, 67, 92,111,193, 42, 44, 44, 68,231,206,157,
- 27,190,119,118,118,198,221,187,119, 17, 25, 25, 9, 79, 79, 79,140, 29, 59, 86,188,119,239,222, 57, 6,131, 97,125,115,156,108,
- 54,155, 12, 11, 11,235, 2, 0, 2,129, 0, 36, 73,102,137, 68, 34,103, 23, 23, 23,129, 72, 36,250, 67, 29,119,237,218, 85, 67,
-146,164,222,172, 26, 32, 73,148,150,150, 34, 52, 52, 20, 82,233,211, 12, 46, 10,133, 2,126,126,126,144,201,100, 13,162,213,221,
-221, 29, 42, 85,203,174, 95,225,225,225,203, 3, 3, 3, 7, 8, 4, 2, 14,147,201,196,189,123,247, 16, 17, 17,129, 3, 7, 14,
-192,219,219, 27,124, 62, 31,217,217,217, 8, 11, 11,195,229,203,151,225,236,236,140,144,144, 16,142, 88, 44,190, 82, 85, 85,149,
-240,248,241,227,229, 45,148,147, 20, 10,133,184,124,249, 50,118,238,220,137,188,188, 60, 20, 23, 23,195,198,198, 6,157, 58,117,
- 66,112,112, 48,122,244,232,129,236,236,108, 16,230, 59,147,171,191,191,127,220,173, 91,183,156,104,154,198,222,189,123, 81, 91,
- 91, 11,173, 86, 11,146, 36,193,229,114, 97,111,111,143,126,253,250,193,217,217, 25,254,254,254, 56,120,240,160,211,224,193,131,
- 79, 73, 36,146, 78, 0, 74,205,181,171,189,189,253,220,101,203,150,121,137,197, 98,228,231,231, 67, 42,149,194,197,197, 5,175,
-189,246,154, 71,124,124,252, 92,189, 94,191,225,101, 17, 90,141, 28,223,137,115,103,127, 30,237,223,174, 58,172, 99, 7,190, 87,
-108,156,139,215,129, 56, 73, 8, 0,132, 6,185,164,142,142,225, 23,222, 75,141, 43, 60,119,246,216,157,244, 44,196,194,130,165,
-109,169, 82,115,232,124,252,205, 65, 17, 29, 59,155,214,125,181,112,232,123,239, 78,231,136, 93,166,161,172,224, 24,226, 47, 38,
-121, 47,252,112,134,243,250,111,182,159, 62, 31,127,147,148, 42, 53,159, 89,102,202,242,254,126,247, 79, 61,156,228, 21,135,145,
-147,193, 6,207, 38, 20,190,190, 1,144,201,100,224,114,185,220,137, 19, 39, 26, 23, 47, 94,172, 20,137, 68,124,130, 32,144,144,
-144, 32, 1, 48,208, 28,175, 90,108, 79, 27,117,122, 3,205,102,152,104,194, 70, 69, 24,171,216, 41,105,143, 48, 32,186,111, 89,
-207,110,161,107, 22,175,252,230, 83,255,128, 8,231,183,167,175, 96,174, 90,254,198, 22, 16,232,213, 20, 79, 70, 14, 46, 18,135,
-142,242, 0, 12, 93,249,197,114,228,230,102,219,207,156, 90,179,130,226,240,220, 3,219,188,106,179,101,103,194, 32, 63, 63,159,
-182, 11,230,140, 61,249,237, 15,223, 14,109,108,217,218,189,107,217,113, 0, 81,150,180,237,255, 34, 72,138,234, 64, 18, 68,161,
- 76,169,100,208, 58,157,211,220,248,120,213,185, 27, 55, 46,220,159, 57,211, 38,156,197, 10, 8,103,177,192,208,233, 42,151, 0,
- 21, 95,152, 76,197,203, 40, 74,244,232,248,113,119,138,205, 78, 86,155, 76, 97, 48,153,154,138,159, 20, 62, 57, 46, 14,181, 5,
- 5,250,170, 43, 87,212, 81, 63,252, 80,225, 53,112,224, 6,173, 78,231, 84, 63, 84,144, 4, 1,162,222,117,194,100, 34,168,143,
- 63, 38,105,138,130,222,222,126, 42,170,171, 3,204,113,126, 88, 82, 50,250,141,233,211,135, 30, 63,115, 6, 62, 62, 62, 13,207,
- 51, 59, 59, 59, 44, 92,184, 16,243,231,207,231,220,189,123,183,235,225,195,135,187,174,255,250,107, 23, 0,163, 45, 41,231,185,
- 27, 55,236,223, 89,185,114, 73,199,200, 72,239, 61,251,247,115,218,183,111, 15, 0,120,248,240,161,255, 87,107,215,182, 9, 13,
- 11, 43, 91, 51,111,222,238,212,197,139, 67, 0, 92,105,137,179, 52, 49, 81,123, 56, 63,127,250,197,132, 4,187,208,208, 80, 0,
- 64,102,102,166,120,211,166, 77, 51, 66,198,142,157,180,114,246,236,207, 98,212,234, 26, 81,121, 57, 39,230,251,239,169,223,198,
-141, 51,203, 89, 95, 78, 0,120,237,237,183,231,245,234,219, 55,120,244,244,233, 14,222,222,222,132, 80, 40,132, 78,167, 67,113,
-113,177,125,106,106,106,251, 56,185, 92,118,244,198,141,189, 48, 26,251,255,141, 93,168, 73, 45,242, 15,179,100,253,241,190,168,
-251,251, 90, 92, 92, 28, 93,167, 38, 27, 30,224, 70,163,209, 34,145, 69, 81, 20, 8,130,176, 84,108,129,166,105, 84, 84, 84, 32,
- 37, 37, 5, 15, 31, 62,132, 66,161,192,163, 71,143,176,109,219, 54,124,245,213, 87,184,125,251, 54,244,122, 61,116, 58,243, 57,
-104, 5, 2, 65,116,116,116, 52,117,227,198, 13,248,250,250,130,199,227,129,205,102,131,197, 98, 53,188,184, 92, 46,220,220,220,
- 32,147,201, 16, 21, 21,197, 20, 8, 4,209,102,172, 68, 67,198,143, 31,207,174,255,191,182,182, 22, 12, 6,163, 65,180,212,214,
-214,162,170,170, 10, 53, 53, 53, 40, 41, 41,193, 43,175,188,194,182,181,181, 29, 98,233,213, 80, 42,149,181, 18,137,196,174, 87,
-175, 94,246,233,233,233,127,200,246,123,233,210, 37,181, 90,173,102,146, 36,105,145,163,253,190,125,251, 16, 27, 27,139, 11, 23,
- 46,160,168,168, 8, 91,182,108,193,158, 61,123,112,226,196, 9,100,103,103,227,187,239,190,195,230,205,155,177,123,247,238, 22,
-175, 81, 96, 96,224,224,189,123,247,118,235,222,189, 59,159,193, 96, 32, 51, 51, 19, 11, 22, 44, 64, 77, 77, 13,156,157,157, 1,
- 0,101,101,101,216,176, 97, 3, 52, 26, 13,132, 66, 33, 60, 60, 60,184, 43, 87,174,236,233,236,236, 60,160,165, 50, 26,141, 70,
- 35,131,193, 64,155, 54,109,176,116,233, 82,108,222,188, 25,103,207,158,197,161, 67,135, 48,123,246,108, 4, 7, 7, 35, 57, 57,
- 25,183,111,223, 6, 77,211, 45, 62,100,184, 92,238,216, 61,123,246,136,217,108, 54, 76, 38, 19,228,114, 57, 10, 10, 10,112,243,
-230, 77,245,177, 99,199,106, 79,158, 60,169,188,114,229,138,250,250,245,235, 52,128, 6,193, 25, 19, 19,227,200,102,179, 95,183,
-160, 73,157, 93, 93, 93, 63,157, 49, 99, 6,183,113,159, 45, 45, 45,197,232,209,163,249, 60, 30,111, 49, 0,231,151,208,228, 77,
- 31, 62, 26,112,155, 99,202, 68,108,220, 19,175,199, 69,198, 87, 23,126,244,141,195,194,143,190,113,120, 92,100,124, 53, 54,238,
-137, 23,199,148,137,195, 71, 3,110, 91, 32, 4,200,126,125,220, 70,184, 56,218,109, 29, 61,124, 56,189,121,243,134,206,239,189,
- 59,157,211, 38, 96, 33,184,182, 19,225,225,251, 14,162,122,123, 19,225,193, 36,119,243,230, 13,157, 71, 15, 31, 78,187, 56,218,
-109,237,215,199,109, 4,204,132,157, 17, 59,114, 61,248, 28, 5,218,251, 7,227,181, 62, 29,193, 36,114,112,228,208, 78,148,148,
-148,160,184,184, 24,101,101,101,130, 97,195,134,161,180,180, 84,157,144,144, 32, 81,169, 84,125, 0,100,153,171,124, 81, 81,154,
- 73, 93,107,212,153,140, 76,131, 92,202, 82,206,158,123, 56,250,118, 42,235,173,210, 26,143, 97,108,142, 61,123,112,255,174,251,
-119,238, 88,138,118,237, 66,209,165,235,128, 87,236,133,255, 10,110, 86,188,230, 34,238,247, 35, 71,143, 79, 28, 63,209,144,247,
- 40,255, 81,128, 11, 87, 75,211,180,126,238,162,237,253,153, 2,175,240,246, 65,189,157,211,115,140,110, 75, 63,126,253,215,147,
-199,191, 45,186,122,229, 24,122,246, 26, 9, 15,119,255, 62, 83,167,130,253, 79,237, 64, 4, 77,251, 50,133,194, 92,189, 84,218,
-134,226,112, 10,140, 70,163,211,173, 89,179,236,116, 44,150,155, 81,167, 43, 54,234,116,197, 58, 54, 91,244, 99, 80,144, 39, 77,
-211,142,118,158,158, 79,104, 54,219,219,160,211,229, 16, 36,217,174,201,217, 57,135,227, 41,108,211,134, 42, 61,119, 78,235, 59,
-108, 88, 53, 0,104,117, 58,167,188,252,124,219, 50,137,196,182,180,172,204,246,113, 97,161,109,238,163, 71,182,217, 57, 57,182,
- 25, 57, 57,162, 7, 41, 41,194,187, 15, 30, 8, 9, 6,195,197, 18,206,188,226,226,240,143, 63,254, 24, 60, 30, 15, 6,131,161,
-169, 49, 27, 10,133, 2, 83,167, 78,133, 18,232,110, 9,167,209,104, 36,222, 89,185,114,201, 39, 75,150,180,143,141,141,229,116,
-235,214, 13, 14, 14, 14,112,112,112, 64,183,110,221,112,248,200, 17,246,236, 57,115, 60, 63,221,177, 99, 42,201,225,120,153,227,
-172,240,243,131,131,131, 3,175, 94,100, 1, 64,135, 14, 29,176,101,203, 22,206,153,179,103,109,191,248,249,231,111, 86, 92,191,
- 30,166,121,252, 88,225, 24, 16, 64,179, 57, 28, 79, 75,219, 19, 0,228,106,117,232,134, 77,155, 28,157,156,156,136,178,178, 50,
-228,228,228,224,241,227,199, 48, 24, 12,232,210,165, 11,113,232,200, 17, 91, 45,131,209,245,111,238, 66,127,208, 34,255, 32,204,
- 68, 51,113,180,168,186, 7,208,101, 0, 68, 92, 92, 28, 93,191,156, 88,247,112,108, 16, 83,150, 8,173, 23, 65, 77, 77, 13,106,
-106,106,176, 99,199,142, 6, 97, 84, 15,173, 86,107,137,104, 9,115,119,119,135, 84, 42, 69, 64, 64,192, 51,150, 44, 22,139, 5,
-138,162,192, 98,177,192,225,112,160,209,104,224,237,237, 13,165, 82, 25,214, 18,167, 74,165,234,228,224,224,208,240,128,213,104,
- 52, 13, 34,171,190,188, 90,173, 22,213,213,213,168,173,173,133, 92, 46,135, 66,161,136,176,164,190, 38,147, 9, 41, 41, 41, 15,
- 59,116,232,208,137,193, 96, 64, 40, 20, 10, 20, 10, 69,131,111, 81, 85, 85, 21,126,249,229, 23,197,155,111,190,233,116,226,196,
- 9,179, 9,139, 9,130,192,251,239,191, 15, 14,135, 3,165, 82,137,205,155, 55,227,131, 15, 62, 0,139,197,130, 92, 46,199,150,
- 45, 91,176, 96,193, 2, 80, 20, 5,173, 86,139, 77,155, 54, 53,203,149,150,150,150,119,227,198,141,136,206,157, 59,219, 31, 61,
-122,180,188,127,255,254,206, 3, 7, 14, 4,143,199,131, 74,165,130, 94,175, 71,247,238,221, 17, 24, 24, 8,137, 68,130,211,167,
- 79, 87,248,251,251, 59,221,188,121,211, 84, 90, 90,250,216,140,184,166, 27, 89, 12, 97, 52, 26, 81, 86, 86,134,154,154, 26,148,
-151,151,163,184,184, 24, 69, 69, 69,160, 40, 10,102,116, 22, 28, 29, 29,199,132,134,134, 50, 0,128,199,227,161, 83,167, 78, 88,
-178,100,137, 65,165, 82,141, 7,112,186,238,176,193,219,183,111, 63,122,245,234, 85,202,221,221, 29, 25, 25, 25,112,118,118,166,
-184, 92,238,235, 90,173,182, 69,107,148,171,171,235,174,223,127,255,221,161, 94, 92,215,183,179, 82,249,244,114,140, 30, 61,218,
- 97,207,158, 61,187, 12, 6,195, 16,188,100,176,227,129,213, 41, 84, 36, 61, 16, 39, 9, 89,248,209, 55, 84, 96,232,211,201,235,
-204, 89,160,214,127,253, 97,200,164, 17,162,147,118, 60, 25,203, 28,207,224,104,175, 31,135, 15,239, 79, 78,156, 16,147,205, 98,
-217,249,110,221,182, 66, 44,118,153,214, 72,134,137,224,232, 36,130,111, 27, 54,113,248,100,186,120,209,226, 47, 52,251,246,124,
-155,251,235,111,113,131,216,204,243, 3, 78,199, 23,206,110,142, 59,235, 97,205, 9,165,134, 27, 36,171,188, 79, 56,184,188,138,
- 78, 29, 59, 64,236, 92,141,237,187, 14,192,167, 93, 23,104, 52, 26,136, 68, 34,190,209,104,212, 49, 24,140,125,150,136, 44, 0,
-184,112,161,198, 20, 18, 82,163,101,200, 77,134,247, 62, 88, 63,170,255,224,225,193,253,250, 69,155,206,157, 63,167,123, 53, 66,
- 87, 50,120, 96,167,178, 51,231,127,204, 46, 41,126,228, 31, 18,214, 19,105,169, 9,131,104, 26, 41, 4,209,180,232, 76,205,193,
- 25,181, 41, 45,225,192,129,153, 38,149, 41,153,183,106,245,131,193, 67,135, 78, 9,237,221,171,183,233,124,252, 69, 45, 27, 21,
-233,162,158, 61,158,188, 55,125,240,209,159,247,109, 26,112,230,244, 46, 63,169,236,113,220,238,221,205,187, 32,252,207, 43,117,
-130,112,182, 17, 8,202, 43,229,242,142, 99, 86,172,144,141, 91,184,240,108, 56, 69, 5, 27,117,186, 71, 43, 0, 21, 77,211,132,
-201, 96, 88,252, 96,255,126,198,114,130, 88,180, 2, 48,173,102, 48,152, 69, 38,147,210,131, 36,249,203, 0,106,197,115, 59,185,
-141, 6,131, 11,197,225,144,229, 9, 9,134,176,105,211, 52,245,247, 35,159,207,199,241,227,199,193,102,179, 27, 94, 44, 22,171,
-225,189,139,139, 11,136,186,109,164,127,152,248, 53,193, 9, 0, 37, 37, 37, 40, 45, 45,133,173,173, 45,156,157,157, 81, 90, 90,
-138,235,215,175, 35, 43, 43, 11, 76, 38, 19,131, 6, 13, 2,217,140,111,243,243,156,227, 22, 46,236, 31, 20, 22,230, 61,107,214,
- 44,242,249,231,163, 78,167, 67, 85, 85, 21, 70,140, 24, 65,158, 62,125,218,245, 76, 65,193,112, 0,251, 90,226,140, 24, 58,180,
-178,236,240,225, 38,207,221,185,115,103,226,218,181,107,156, 65, 3, 7,206,255,112,245,234, 31,191,223,179,167,208,104, 48,184,
-182,166,238, 36, 73,146, 4, 65,192,203,203, 11, 85, 85, 85,168,173,125,186,130, 45, 20, 10, 97,111,111, 15,189, 94, 15, 19, 77,
- 51,255,206,254,211,156, 22,249,135, 96, 91, 35,193,245,140,101,139,170, 91, 23,173, 31, 40, 94,107,252, 96, 49,153, 76, 22,137,
- 44, 38,147,105,214,231,202, 18, 43,215,243,176, 68,104,213,151,149,203,229, 62, 99,201,170, 23, 88,245,229, 36, 73, 18, 12, 6,
-195,236, 67,188, 78, 12, 49,228,114, 57,142, 28, 57,130, 62,125,250, 52, 44, 75, 73,165, 82,212,212,212, 64, 42,149, 66,173, 86,
- 35, 47, 47, 15, 23, 46, 92,128,159,159, 31, 96, 97,240,215,220,220,220, 59, 62, 62, 62,145,245, 15,241,190,125,251,122,238,222,
-189,187,120,200,144, 33,238, 52, 77,227,179,207, 62,171,232,222,189,187, 83,227,135,188, 57, 48, 24, 12, 92,191,126, 29,126,126,
-126,160,105, 26, 44, 22, 11,153,153,153, 16,139,197, 48,153, 76,160, 40, 10,229,229,229,176,177,105, 57, 70, 98, 74, 74,202, 91,
-111,191,253,118,177,173,173,109,120,101,101,101, 9,135,195,233,149,152,152,232,165,211,233, 32, 18,137, 32, 18,137,112,234,212,
- 41,216,217,217, 97,222,188,121, 5, 42,149,234,186, 64, 32,112, 81,169, 84,247, 75, 75, 75, 63,107,205,245, 54, 24, 12, 80, 40,
- 20,168,174,174, 70, 85, 85, 21,100, 50, 25,212,106,181,217, 50, 54,133, 94,189,122, 33, 46, 46,142,241,229,151, 95,254,156,155,
-155, 11, 0,240,245,245,197,188,121,243, 24, 30, 30, 30,200,203,203,195,157, 59,119,160,211,233, 64,211,116,139, 55, 47, 69, 81,
-125,223,124,243,205,158,222,222,222,132, 78,167,131,201,100,130, 70,163, 65,253,251,130,130, 2, 4, 5, 5,145,109,218,180,121,
- 37, 55, 55,183, 47, 44,219, 88, 97, 5,128,178,130, 99,240, 96,138, 1, 82, 4, 90,117, 12,149, 21, 47, 22,197, 69, 34,145,172,
-254,248,243,107,211,190, 95,167,115, 41, 42, 1, 58,132,142,132,127,112, 20,222,154,108,192,151, 95, 31,129,119,155, 14,120,252,
-248, 49,250,246,237,203, 42, 46, 46,126,187,182,182,118,161,165,220,231,207,223, 48,158, 59,117,122,236,184,215,167, 68, 70, 71,
- 15, 49,156, 61,123, 10, 41,247,207,166,190,253,250, 24, 9,109,170, 37, 28,236,120,201,153, 25,183,253,195, 59,189, 6,173,193,
-216, 11, 88,190, 14, 88, 78, 55,127,191, 67,123,242,164, 27,121,242,216,174,201, 19, 39, 77,237, 24, 21, 53, 64,127,246,252,239,
-184,243,175,243,247,190, 89, 55,227,242,151,155, 14,246,237, 63,104, 76,136,179,203,245, 83,161, 1,154,233, 94,142,182, 15,183,
-239,174,250, 39, 95,102,138,197,229, 26, 0,144,118,109,218,120, 30,189,112, 33,191, 19,147,201, 16, 1, 70,154,166, 59, 0,112,
- 34, 41,234,211, 19,211,167, 71, 4,213, 61, 72, 13,128, 41, 8, 32,165,128, 86, 0,176,209, 76,200, 28,138,203, 53,161,110, 92,
- 36, 9, 2, 52, 77, 63, 35,178,158, 23, 90, 36, 73,154, 53, 0, 52,230,108,252, 44,170,159, 80,111,221,186, 21, 28, 14, 7,108,
- 54, 27, 76, 38,211,172,251, 69, 99,206,212,188,188,126,191,236,219,199,105, 74,100, 85, 86, 86,162,178,178, 18,181,181,181,152,
- 48, 97, 2,107,197,237,219,157, 81,231,250,209, 28,167,183,155,155, 70,192,227,149,165,165,165,185, 7, 7, 7, 63, 83, 94,153,
- 76, 6, 30,143,135,125,251,247,179, 98,134, 14,125, 55,234,212,169,111, 96, 38,254, 85, 83,117, 39, 8, 2, 98,177, 24,246,246,
-246, 32, 8, 2, 6,131, 1,165,165,165, 72, 77, 77,197,237,175,151, 40,128, 0, 0, 32, 0, 73, 68, 65, 84,219,183,193, 32, 8,
-195,223,217,121,154,210, 34,255, 64,171,214, 31,150, 15,235, 45, 90, 68,115,214, 23, 75,133, 22,131,193,120, 97,171, 86,115,176,
-100,233,144,207,231, 63, 40, 46, 46,126,213,195,195, 3, 6,131,161, 65,104, 53,182,196,213, 91,201,120, 60, 30,238,222,189, 11,
- 62,159,255, 64,173, 86,183,200, 73,211,244, 43, 93,187,118, 69,108,108, 44, 18, 18, 18,240,232,209, 35, 40,149, 74,104, 52, 26,
-168, 84, 42,164,166,166,194,100, 50, 33, 52, 52, 20, 2,129, 0,124, 62,255, 65,189,229,171, 57, 40, 20,138, 18, 38,147,217,129,
-199,227, 53,124,230,230,230,134,202,202, 74,147, 94,175,199, 47,191,252, 34,115,117,117, 21,240,120, 60,139,133, 43, 65, 16,144,
- 72, 36,240,244,244,108,240,209,146,203,229, 16,139,197,245,194, 2, 26,141, 6, 54, 54, 54,160,105,218,220, 53, 82,231,228,228,
-124,216,232,255, 46,227,198,141,251,245,192,129, 3,237,226,227,227,113,243,230, 77, 56, 59, 59, 99,205,154, 53,143,242,243,243,
- 39, 2,184, 45,145,252,181,126,145,150,244,161,202,202,202, 35, 15, 30, 60,120,165,107,215,174, 13,163, 68,223,190,125,137,190,
-125,251, 58, 53, 54,245,151,151,151,227,214,173, 91,136,143,143, 7, 65, 16,200,206,206, 54,170, 84,170, 95, 91,160,102,121,120,
-120,236, 94,178,100,137,208, 96, 48, 52,244,109, 30,143, 7, 46,151, 11, 22,139, 5, 6,131,129,252,252,124,140, 24, 49,194,246,
-135, 31,126,216,165,209,104,218, 3,208,225, 37, 65,141, 10,186,187, 41, 50,219,208, 32,151,212,109, 91,191,124,117,230,172,167,
- 99,196,182,173, 95, 26, 66,131,196,169,119, 83,202,108, 35,197,230,235,123, 58,190,240, 61,173,254,244,176,211,103, 46,141,255,
-104,254, 60,166,175,111,144, 36,254, 98,146,119,148,225, 11,194,209, 73,132,202, 10, 25,242, 11,202,144,251, 88, 75,251,250, 6,
- 73,238,220,122,192,249,122,195, 70,127,133, 82,125,240,226,229,146,223,205,208,171,175, 92,127, 52,242,155,239, 56,151,167,188,
-221,133,205,227,185,163,170,226, 1,188,189,157, 49, 34, 38, 28, 59,247, 92,135,173,173, 3, 92, 92, 92, 64,146,164,192,210,186,
- 87, 84, 84, 16, 71,126,187, 50,237,205,169, 51,186, 15, 28, 48,212,112,230,236, 73, 42,225,220,137,235,187,182,125,122,148,102,
- 40,248, 4, 45,231,181,245,113,189,255, 48,231,238,196,126,209, 19,192, 99,217,248, 1,129, 77,118,216,134, 13, 6, 52, 10, 98,
- 15, 44,231,190, 57,117,102,143,129, 3,135, 27,206,158, 61,134,179,167,246,220, 88,182,172,237,169, 71, 79,246,179,254,117,187,
-136, 59,114,236,236,234,184,211,233,218, 49,195,124,178,220, 5,157, 84,192,163,127,108,255, 33, 9, 66, 86, 81, 94, 46, 98, 50,
-153,170, 93,111,188,145, 13, 0,122,138,170,148, 51, 24,206, 4, 65,100, 2,200, 92, 13, 56,129,205,150,142, 51, 24,140, 11,189,
-189, 89, 84, 73, 9,163,218,104, 52, 50, 0,246, 71,127,204,191, 8, 6, 69,149, 25, 52, 26, 47,207,129, 3, 25,202,199,143,153,
- 66, 23, 23, 3, 0,232,245,122,179, 66, 11,205,108, 90,121,158,211,210,250, 41,149, 74,152,154, 17,130,207,115,150, 74, 36,109,
-235, 38,225, 13,208,235,245, 13, 34,171,178,178, 18, 53, 53, 53, 16, 8, 4, 40,215,104, 92, 44,225, 28,208,173,219, 47, 43,150,
- 47, 95,120,248,200, 17, 86, 99,145, 85,255, 98, 50,153,248,106,221, 58,214, 7, 31,125, 52,251, 93,138,154,139, 38,150, 65,155,
-107,207,250, 73, 59,131,193, 0, 69, 81,120,252,248, 49, 10, 10, 10,240,248,241, 99, 60,126,252, 24, 60, 30, 15,244,223,188, 9,
-232, 31,236,159,133, 70, 75,133, 51,159,183,114,181, 24,222,161, 53,206,240,150, 10, 3,163,209,248,151, 10, 45,133, 66, 17,127,
-225,194,133,110, 35, 71,142,164,110,220,184, 1, 87, 87,215, 6,161, 85,255,183,126, 57,138,207,231,227,232,209,163, 58,133, 66,
- 17,111,230,102,186,112,234,212,169,200,165, 75,151, 50,223,122,235, 45,164,165,165, 97,214,172, 89,168,169,169,129, 76, 38, 67,
-101,101, 37,148, 74, 37,186,117,235, 6, 46,151,139,251,247,239,235,149, 74,229, 5,115, 75,103, 18,137,164,214,217,217,217,237,
-249,239,198,142, 29,235,242,211, 79, 63, 41, 51, 50, 50,244,175,190,250,170,200, 82,193, 81,143,223,126,251,173,193, 82,151,149,
-149,133,159,126,250, 9, 52, 77,131,166,105, 36, 37, 37, 97,253,250,245, 13,177,207, 90,137,219, 21, 21, 21, 6,189, 94, 15, 63,
- 63, 63,120,120,120, 64,173, 86, 99,227,198,141, 6, 0,183,255, 91,189, 89,173, 86, 31,158, 50,101,202, 39,201,201,201,110, 20,
- 69, 61, 53,105,215,213, 79,167,211, 33, 39, 39, 7,169,169,169,200,200,200, 64, 85, 85, 85,195, 68,224,238,221,187,213,122,189,
-254, 96,115,188,206,206,206,159,237,220,185,211,149,207,231, 63,211,159,235,173,161,245, 86,210,242,242,114,216,217,217, 33, 42,
- 42, 74,124,225,194,133,207, 52, 26,205,210,151, 68,103, 17, 99, 71,101,117,249,224,189,145, 24, 29,195, 47,140,141,123,114,109,
-253,215, 31,214, 57,195,139, 83, 71,199,120, 20,222,203,180,195,216, 81,199,186, 0, 40, 66,203,126, 90,166,139,151, 75,142,119,
-237,106,159, 16,123,226,196,174,197, 31,207, 79, 90,248,225, 12,103,165,234, 33,215,183, 13,155, 0,128,220,199, 90,250,126,154,
- 73,189,254,155,249, 73, 95,174,251,129, 44,171,172,153,117,235, 86,243,225, 13, 26,139, 23,146, 4,215, 55,176, 79,177,127, 64,
- 79,159, 27,215,247, 65,200, 87,161, 67, 96, 23, 12, 28,240, 10, 18, 46,221, 69,105,185, 26, 37, 37, 37,208,104, 52, 45,134, 75,
-200,184,127,116, 50, 77,208,222, 4, 77, 20, 16, 36,205,157, 60,101,122,175,161, 67,135,211,113,113, 39, 12,199,142,238,187,122,
-112,239,119,135, 73, 22,147, 82,105,109,181, 4,161,150,130, 76, 73,171, 85, 60,157,208, 48, 57,172,230,205,175,117,129, 93,131,
- 67, 2, 93, 39, 79,153,101, 59,100,240, 8,250,212,169, 99,166,131, 7,126, 73, 56,184, 35,108,159,137,148,177, 74, 10,149, 28,
-169, 76, 47,165, 9,182, 93,173,204,164, 44,203,109,175,118, 31, 58, 86, 7, 28,254,199,118, 32,218,100,122, 76,107,181, 62, 96,
- 50, 11,105,131,193, 21,122,125,213, 10,181,250,201, 23,108,118,219,101, 20,213, 25, 4, 97,210, 17,132, 2, 90,109, 46, 0, 56,
- 20, 20,184,105, 69,162, 82,134, 90,221, 30, 70, 99,147, 1,144,117, 26, 77, 81,109, 97,161,155, 67,159, 62,156,156,229,203,249,
- 46,221,186,169,137, 58, 31,226,150,132, 22,131,193, 0, 72,210,100, 9,167,165,245, 83,169, 84, 48, 1,250, 23,225, 52, 24, 12,
-207,136,172,122,161, 85,127,191, 88,194,185,109,217,178, 27,222, 3, 7, 86, 93,186,116,201,229,181,215, 94, 35,228,114, 57,228,
-114,249, 51, 98,203,221,221,157, 8, 14, 13,229,255,150,144,224,107,105,123, 90, 36,162, 73,242,111, 23, 90,255,112, 52,155, 72,
-154, 50,179,132,102,177,208,178,208,162,165,215,235,245, 16,139,197,168,168,168,104,246,193, 79,146, 36,120, 60, 94,253, 26,113,
-139, 59,239, 52, 26,205,198,133, 11, 23,206, 25, 60,120,176, 83,135, 14, 29, 80, 94, 94, 14, 23, 23, 23,112,185,220, 6,223,177,
-122,190,164,164, 36,236,220,185, 83,166,209,104, 54,154,225,220,176,110,221,186,247, 70,143, 30,237,224,234,234, 10,123,123,123,
-220,191,127, 31,246,246,246,144,201,100,200,204,204,132,141,141, 77,131,223,206,137, 19, 39,228, 26,141,102,131, 25,241, 70, 39,
- 38, 38,234,108,108,108,238,151,151,151, 51,170,170,170,168,234,234,106, 74, 38,147, 49,165, 82, 41,243,204,153, 51, 78,182,182,
-182,202,139, 23, 47,150,123,123,123, 51, 30, 61,122,196,208,235,245,102,213, 43, 65, 16,152, 59,119, 46, 88, 44, 22, 52, 26, 13,
- 54,110,220,136,133, 11, 23, 54,248,100,173, 91,183, 14, 75,150, 44,105, 16,206,219,183,111,111,221,192, 73,211,208,233,116,208,
-235,245, 22,111, 80,248, 83, 51, 98,203, 4,123,105,118,118,118, 76,215,174, 93,207, 29, 58,116,200,177, 46, 38, 25,202,202,202,
- 80, 86, 86,134,242,242,114,212,214,214,194, 96, 48,192,195,195, 3,101,101,101, 56,118,236,152, 84, 46,151, 15, 68, 11, 59, 14,
- 25, 12,198,148, 94,189,122, 81,207,151,161,126,150, 87, 47,222, 57, 28, 14,138,139,139,209,183,111, 95,246,165, 75,151,166, 0,
-248, 71, 11,173,198,225, 29, 6, 12,156,198, 10, 10,233,161,189,151, 26, 87, 24,232, 83, 86, 56,105,132,232, 36, 0,220, 77, 41,
-179,189,151,105,135,160,144, 24,122,192, 64,251,200,178,210,109, 97, 0,116, 45,165,235, 1, 0, 91, 62,103, 92,255,232,110,197,
- 54, 2, 1,185,254,155,237,167, 55,111,222,208,249,240,201,127,135,119, 88,255,205,211,240, 14,253,163,187,153, 50,210, 51,198,
- 1,216, 97,169,120,137,137, 25,150,188,115,247, 78,100,164, 94,116,255,100,110, 56,187,170, 76, 15,158,208, 11,145,157, 92,176,
-109,247, 3,220,187,119,175, 84,171,213,246,109,177,127, 19,180,119,106, 90, 74, 64, 88, 72,176,235,228, 41, 51, 69, 49, 49, 35,
- 16, 23,119, 28,123,127,217,145, 56,102,194,232,159,159, 84,203, 24, 98, 38,159,197,167, 77,108, 6,203,150, 98,113,120, 18,173,
-246,105, 4, 2, 38,147, 43, 2,198,181,248,224,121,103,230, 36,219,126,209, 35,112,242,212,113,236,253,101,219,229,207, 67,198,
-238,240,137, 8, 34,186,117,254,122,182, 79, 59,159, 54,138,218, 50, 25, 73,176,117,106,181,201,230,235, 95,242,191,205, 93, 50,
- 37, 23,192, 55,248,135,238, 58,100, 27,141,247, 52, 58,221, 36,175,200,200,219,197,183,111,135,173,209,235, 29, 62, 5,170, 62,
-215,106,243, 15, 1,133, 53, 0, 57,171,110, 76,255, 6,224,170, 40,202,205,150, 36,239,202,141,198,193, 96, 48, 82,209,244, 68,
-252,254,222, 33, 67,186,126,240,240, 33,203,185,103, 79, 94,113, 66, 2,191, 46, 19, 73,139, 66,139,162, 40,208,205, 47,117, 61,
-195, 73,236,217, 67, 2, 0,139,197,106,118,140, 99,177, 88, 80, 42,149,208, 55,111,193,126,134,211,237,236,217,194,135, 15, 31,
-250, 59, 56, 56, 60, 35,178,170,170,170, 26,222,171,213,106, 40,149, 74,240,120,188, 84, 85,211, 43, 34,207,112,150, 37, 38,170,
-215,206,157,187,116,226,132, 9,223,197, 95,184,192,117,116,116,132, 84, 42,125, 70,104,105,181, 90,244,139,138, 98,173, 75, 78,
-158, 12,153,108,153, 37,237,233,210,183,175, 89,127, 96, 6,131, 1,211,223,188,116,248, 18, 96,102, 83,194,139, 52,183,132, 99,
-233,174,195,102, 30,144,207,239,238, 91, 18, 25, 25,169,206,202,202,130,183,183,119,131, 88,105,124, 78,145, 72, 4, 59, 59, 59,
- 36, 37, 37, 97,245,234,213, 42, 0, 75,204,112,202,149, 74,229,235,253,251,247, 87, 81, 20,133,192,192,192,134,248, 89, 38,147,
- 9,108, 54, 27, 2,129, 0,201,201,201, 24, 54,108,152, 82,169, 84,190,142, 63,198,208,122,158, 83,170, 84, 42,223, 24, 48, 96,
-128, 50, 45, 45, 13,189,122,245,194,189,123,247, 80, 91, 91,139,218,218, 90,228,229,229, 33, 56, 56, 24, 74,165, 18, 63,253,244,
-147, 74,169, 84,190, 1, 64,218, 18,167, 92, 46, 31,182,112,225, 66,198,175,191,254,234,227,225,225, 17,210,165, 75,151, 14, 81,
- 81, 81,237, 71,141, 26,213,102,200,144, 33,110,254,254,254,234,129, 3, 7, 58, 15, 30, 60,216, 89,169, 84, 50,175, 93,187, 86,
-162,215,235, 7,155, 41,103,131, 56,201,202,202,106, 88, 42,164, 40, 10, 21, 21, 21, 13,145,251,235, 7,165,102,132,112,180, 57,
-177, 93, 47,176,234, 5,151, 5,126,110, 77,113,154,253, 17,155,205,174,183,120,210, 22,112,222, 77, 79, 79,239,223,167, 79,159,
-187,211,166, 77,147,151,150,150,194,198,198, 6,190,190,190, 8, 8, 8,128,147,147, 19,116, 58, 29,142, 30, 61,170, 56,118,236,
-216, 3,169, 84,218, 23,127,140,161, 21,253, 92, 59,230, 53, 53,200,214, 91,179,234,133, 22,151,203,133,135,135, 71,125,219,230,
-181,166, 61, 95, 16,127, 47,103,157,128,137,234, 55,176,221,144,161, 35,109,143, 30,191,206,254,238,199, 99, 15, 34,163,177,221,
-177,173,236,132, 99, 91,217,137,200,104,108,255,238,199, 99, 15,142, 30,191,206, 30, 50,116,164,109, 84,191,129,237,210, 82, 51,
- 58, 52,206,123,216, 84, 57,185, 92,110,143, 94, 61, 35,171, 47, 93,189,108,250,114,221, 15,100,191,190, 99,146,119,252,124,244,
-232,142,159,143, 30,237,215,119, 76,242,151,235,126, 32, 47, 93,189,108,234,213, 51,178,154,203,229,246,176,164,238,239,204,156,
-100, 59,116,200, 8,196,197, 29, 53, 28,254,237,167,117, 7,142,100,247,153, 62, 39,177, 44, 43,235, 30, 45, 41, 58, 11, 38,249,
- 24,233,233,233,210, 58,145,149,101, 9,231,172, 25,147, 26,139,172, 43,142,174,189,182,167,167,195,120,254,252,239,250, 11, 23,
-146, 85, 87,238, 74,164,119,210, 42,170,138,203,171, 30,201,100,149, 90,147,201, 8,163,209,200, 88,177,162,193, 97,183,201,107,
-244,234,171,175,225, 98,252,126,252,178,123,171,212,100,130,122,220,225,195,198,113,227,150,211,109,218,182,109,179,239,183,253,
- 68,204,240,145,182, 52, 96, 26, 54,122,132,221,175, 7,126, 37,218,249,181,107,235,235,219, 16,210,230, 31,215,151, 62, 1,106,
- 9, 32,189,228,214,173, 46,194, 94,189,238, 27,152,204,128,149, 44, 86,251, 77, 0,123, 28, 96,156, 5,232,151, 1,228, 50,192,
- 67, 69, 81, 29,121, 6,195, 61,185, 82,233, 9, 0, 95,208,244,163,166, 56,151, 3,213,178,199,143, 47, 39,253,240,131,198,229,
-245,215, 29,216, 46, 46, 34, 24,141, 68,253,248,222,220,139,162,168,231, 45, 48,205,114,122, 56, 57, 61, 57,113,226, 4, 2, 2,
- 2,224,225,225,129,198, 62,178,245, 1,185, 29, 29, 29,113,228,200, 17,208,207, 6,167,110,150, 51,194,199, 39,233,171,181,107,
-181, 38,147, 9,213,213,213,127,176,102, 85, 87, 87,195,100, 50,225,212,201,147, 90,217,211, 76, 32, 22,213,189, 47,131, 81, 59,
-177,119,239, 47,135, 14, 29,170,123,248,240, 97,195,206,235,122,203,150, 68, 34,129, 80, 40,132, 90,163,241, 2,192,183,132, 83,
-114,230,140, 0,102,198,245, 38, 44, 90,127, 71, 95,250,167,139,172,198, 9,165,103, 90,100,209, 50, 24, 12,240,242,242,122, 38,
-165, 11, 73,146,207,188, 90,185,227,112, 79, 90, 90,218,217,129, 3, 7, 46,237,222,189,251, 59, 75,151, 46,101,116,232,208, 1,
- 82,169, 20,246,246,246, 16,139,197,200,204,204,196,137, 19, 39,140, 21, 21, 21, 91, 0,172, 68, 19, 1,236,154, 64, 66,118,118,
-118, 76,120,120,248,129, 69,139, 22,217, 14, 24, 48,128,233,229,229, 5,154,166,145,156,156,140,216,216, 88,221,142, 29, 59,100,
-117, 34,203, 82,231,229,115,197,197,197, 99, 6, 15, 30,188,111,202,148, 41, 54, 70,163,145,153,151,151, 7,141, 70, 3,189, 94,
-143,130,130, 2, 93, 92, 92, 92,173, 82,169,156, 4,224,156, 5,124, 73, 53, 53, 53,193,231,207,159,159,114,237,218,181,213,211,
-166, 77,115,140,138,138, 98, 25, 12, 6, 92,189,122,181, 60, 34, 34, 66, 44,145, 72,116, 71,142, 28,169, 84,171,213, 75,140, 70,
-163, 69, 41,120, 8,130,128, 76, 38,131,147,147, 19, 52, 26, 13, 76, 38, 19,180, 90, 45,132, 66, 97, 67,218, 36,154,166,209, 26,
-231,250,231,250, 0, 67,167,211, 97,194,132, 9, 48,153, 76,216,184,113, 35, 12, 6, 67,171,201,108,109,109,239,220,189,123, 55,
-166, 83,167, 78, 13,226,165,190, 15,113, 56, 28, 56, 57, 57,193,209,209, 17,113,113,113, 96, 50,153,119,204,249,187,213,225, 94,
- 69, 69, 69,196,249,243,231,123, 60,120,240,224, 77, 0,157,116, 58,157,135,209,104, 36, 72,146, 44,161,105,250,190, 76, 38,251,
- 25, 22,166,224,145, 72, 36,171,167, 78,157, 26,177,127,255,126, 33, 69,253,251,214,160, 40, 10, 28, 14, 7,245,193, 49,105,154,
-134, 86,171,197,103,159,125, 38, 83, 40, 20,171, 95,150, 81, 34,178, 75, 55,108,251,105,147,240,194,197,179,229,233,217,136,181,
-183, 79,127,190,255, 21,149,149,110, 11, 43, 46, 44, 20, 70,118,233,102, 17,167, 94,171,171,124, 99,210, 2,239,186, 20, 60,159,
-229,229,229,111,221,183,231,219, 92, 0,248,122,195, 70,255,178,202,154, 89, 25,233, 25,227,182,110,253,173,135, 94,171,171,180,
-132,243,223,226,101,159, 20, 52,212, 0,110, 38, 63, 40,243, 25,246,250,153, 37,126,237, 68,195, 37,149,170, 39,181,181,202,247,
- 1,228, 90, 90,247,158,175,246,193,197,115,191, 98,239, 47,251,100,180,137,161,118,114,114,162, 1, 32, 61,221,137, 78, 79,175,
-161,255,237, 87,108,167, 96,210,247, 86, 46,120, 63,106,129, 84, 86,181, 97,227, 79, 45, 47,165,132,119,236,142,240,142,221, 49,
-231,253, 79,109,131, 67, 2,189, 1,224,240, 97, 24, 67,252,210,126, 95,250,249,242,225, 43, 87, 46,135, 76,174, 65,125,186,158,
-204,148,180,147,185,185,208,254,147,251,209, 82,131,225,234, 74,154, 30,165, 76, 76, 12,235,241,209, 71,183,174,172, 95,239, 35,
-101, 48, 94, 93, 1,152, 72,130, 48,130,166,121, 36, 73,150, 8,244,250,100, 57,155,237, 70,152, 76,157,109,140,198,163,122,163,
-145,110,129,243, 38, 22, 44,240, 87, 86, 85, 57,247,252,228, 19, 39,234,163,143,200,150,156,225, 27,223,191,150,112,222,190,127,
-255,228,172,233,211,159, 44, 91,186,116,224,150,173, 91,121, 97, 97, 97, 40, 45, 45, 69, 96, 96, 32, 60, 60, 60,112,254,252,121,
- 28, 57,120, 80, 81, 35,151, 47, 1,176,217, 18,206, 61,167, 78,101,118, 8, 9,169,216,186,117,171,251,208,161, 67, 9,133, 66,
- 1,169, 84, 10,169, 84, 10,141, 70,131,186,128,208,116, 86,118,118,186, 94,175,223, 98,105,221,141,229,229,220,149,221,186, 21,
-177, 76,166,175,198,140, 30,189,112,229, 23, 95,112,218,181,107, 71,104, 52,154, 6,171,150, 78,167,131, 80, 40,212,105,181, 90,
- 71, 52,225,247,214, 20, 39,103,199, 14, 67,121,121, 57,156,157,157, 27,194, 53, 53,142, 75, 40,151,203, 65,211,244, 75,155, 0,
-253,239, 68,179, 10,201,222,222,254, 14, 69, 81,158,141,173, 91, 77,229,206,107,252,153, 94,175, 47,170,168,168,136,124, 78,241,
- 54,231, 15,229, 11, 96, 77,191,126,253,198,124,248,225,135,196,165, 75,151,112,236,216, 49, 58, 55, 55,247,112,157, 21, 43,183,
-133,217, 83,115,156, 54, 28, 14,103,158, 64, 32,136,174, 15,225,192,231,243, 31, 40, 20,138,248,186,229, 66,249, 11,112,138, 56,
- 28,206, 92,129, 64,208,191, 46,253, 10,108,108,108,238, 42, 20,138,243, 26,141,102, 19,154, 79, 84,221, 18, 39,207,214,214,118,
-181,147,147,211, 27, 31,125,244,145, 99, 98, 98, 98,201,197,139, 23, 89, 53, 53, 53,251,181, 90,109, 75, 73,165,255,192,233,224,
-224,112,135,193, 96,120,254, 77,215, 8,225,225,225,113,195,134, 13, 27, 58,105,210, 36,232,245,122,108,222,188, 25,231,207,159,
- 63,153,147,147, 19, 99,102,134,251, 60,167,147,167,167,231,165,119,222,121,167,205,132, 9, 19,248,246,246,246,160, 40, 10, 10,
-133, 2, 57, 57, 57, 72, 78, 78,166,143, 31, 63, 94,155,148,148, 84,164, 84, 42, 95, 3, 80,209,138,246,252, 51, 51,241,103, 56,
- 41,138,234,227,229,229,245,219,178,101,203,108,250,247,239,207,115,116,116, 4,131,193,128, 94,175, 71, 73, 73, 9, 82, 82, 82,
-112,246,236, 89,197,225,195,135, 21,149,149,149, 19, 0, 92,254,111,148,243,175,228, 12,242,199,231,207, 37,138,110, 54,218,187,
-153, 99,205,150,179, 95, 31,183, 17,227,198, 12, 30, 4, 0,135,142,156, 62, 99, 65, 82,233,102,203,105,174,172,150,112, 6,250,
-145,203, 82,211, 82,158, 9,104, 25, 18, 28,154, 21, 20, 54,122,149, 37, 68,141, 34,195, 63, 83,247, 70,203,177,141,109,186,207,
- 44,179, 6,249, 34,102,196,184, 81, 67, 63, 93,178, 24,107, 86,127,137,227,135,142,158, 76,207,125, 38, 77,208, 63,174, 47, 53,
-126,182,172, 96, 48,250,145, 36,233, 69,176,217,183,244, 10, 69,182, 13,192,148, 3,140, 21,128, 98, 37,139,213, 30, 70, 99, 8,
-104,154,146, 19, 68,220,122,163,209, 30, 64,177, 57,206, 85, 20,213,157,239,230,214,123,163,201,180,248, 94, 74,138,176,241,132,
-173,222,242,220,120, 82,233,238,238, 46, 41, 41, 41,113,177,132, 51,230,251,239,117, 74,129,128,179,248,171,175,250,212,170,213,
-125, 86,174, 92, 73,221,190,125, 27, 63,253,240,131, 65, 93, 84,180,175, 28,152,219,204,106, 72,179,156,109,230,206,229,126,252,
-211, 79,111,249,250,249,137,223,124,243, 77, 38,147,201,132, 66,161, 64, 97, 97, 33,206,157, 61,171, 77, 75, 79, 79,147,201,100,
-195, 91, 83,247,152,239,191,215,217,249,250,130,239,236, 76, 95, 72, 72,176,157, 53,111,222, 59,109,125,124,108, 7, 14, 26,196,
- 20,137, 68,168,174,174, 70, 94, 94, 30,142, 30, 61, 42,169,173,173,117, 7, 96,180,132,115,223,181,107,225,167, 46, 95, 30,187,
-106,213, 42,118,104,104, 40,108,109,109, 33,151,203,145,146,146,130,203,151, 47,107,182,108,217, 34,149, 74,165,239, 24,141,198,
- 19,127, 99, 95,122, 41,151, 14,255,110, 15,127, 75, 46, 68, 36,128,207,235,222,127, 1,243, 57, 3,255,201,131,207,243,240,118,
-112,112,216,166, 86,171,105,149, 74, 53, 11, 64,193,255, 96, 57,169,200,200,200,159, 36, 18, 73, 15,154,166, 97,107,107,123, 61,
- 53, 53,245, 93, 52,179,243,198, 12, 39, 3, 64, 15,161, 80,216,205,198,198,166,143, 70,163, 9,170, 91,126, 75, 87, 40, 20,151,
-117, 58,221,205, 58,235,147,241,191, 92,119, 6,128,254,238,238,238,211, 77, 38,147, 31, 65, 16,118, 70,163, 17,122,189,190,198,
-100, 50,229, 72,165,210, 29, 0,206,255, 15,148,243, 47,225, 12,110,143, 81, 52,137,160,230, 4,193, 51, 66,235, 57, 1, 65,152,
-144,158,246, 16, 71, 91, 81, 78,114,112,180,215,143,192,211,157,137, 48,239, 92,251,111,161,101,129,120,105,181,200,108,207,152,
- 74, 19,244, 51,156, 4, 77, 20, 4,134,143,218,251,103,132,150,165, 8, 14, 64, 31,208,232, 97,162,113, 51, 35, 7, 23, 95,182,
-177,110, 25,224, 66,146,100, 87,130, 36,219,211,128,130, 32, 8, 3,104,218, 1, 52,253, 16, 12, 70,234, 82,157,238, 33,154, 78,
- 96,222, 44,231, 26,192,225, 7,123,251,235, 36, 69,185, 2, 32,235,172, 47, 38, 19, 65, 24,105,130, 48, 52, 94,222,122,110, 98,
-217, 34,167, 14, 8, 99,114, 56, 94, 70,131,193,165, 20, 16,158, 50, 26, 59,171,105,186,214, 19,248,252, 46,144,217,218,186,215,
-115, 50, 56, 28,239, 83, 52, 61,162, 92, 32, 8,151,168, 84,206, 0,104,161, 64,144, 46, 83, 40,126, 81,171,213, 63,182,182,238,
- 58, 32,140,197,225,120, 26, 13, 6, 23, 0, 32, 41, 74,114, 64,163,241, 42, 18,137,222, 84,107, 52,109,132, 66,161, 94,171,213,
-202,212,106,245, 36,131,193,112,161, 53,117,207, 49, 24,130,175,145,100, 47,157, 64,224,168, 35, 8,129,214, 96,208,105,117,186,
- 66,181, 90,253, 0,192,183, 0, 30,254,205,125,201,138, 23,188, 1,173,156, 86, 78, 43,167,149,211,202,249,255,156,115, 45, 32,
- 90, 3, 56, 88,219,243,111,229,228, 3,240,174,155, 44,254, 19,235,254, 82, 90,183, 40,107, 91, 88, 97,133, 21, 86, 88,241,119,
- 99, 81,243,110, 22, 86,252,117, 80,162, 9,159, 44, 43,254,187, 32, 90, 80,165,173, 49, 9,190,136,178,141,183,114, 90, 57,173,
-156, 86, 78, 43,167,149,211,202,249,255,142,211, 28,247, 63,113, 73,114,102, 19,159,109,251, 79,156,216,106,254,181,114, 90, 57,
-173,156, 86, 78, 43,167,149,211,202,249,255, 22,164,181, 9,154,133, 75,221,235,175, 62,214,138,151,187, 47,252, 39,224, 81,247,
-106,205,241,110,214,203,104,133, 21, 86, 88,241,255, 67,104, 89,250,208,250, 51, 15,183, 63,251, 96,252,146, 32, 80, 76, 16, 40,
- 6,240,229, 95,120,172, 57,184, 59, 57, 57,125, 16, 28, 28,188,207,197,197,101, 14, 0,113, 43,127,239,207,231,243, 55, 9, 4,
-130, 75, 2,129,224, 18,159,207,223, 4,192,255, 47,186,110, 4,128, 89, 28, 14, 39,193,205,205,237, 9,155,205, 78, 0,240, 14,
- 94,124,231,106, 7, 60,141,147,246, 5,128,240,214,252, 80, 28, 50,226,160,115,200,136,251,206, 33, 35, 82, 28, 67,135,249, 59,
-135,140, 72,113, 14, 25,113, 95, 28, 50,226,224,223,208, 95,255,202,235,251, 87,149,167,128, 32, 80, 96, 97,121,190, 37,128, 66,
-130, 64,209,255, 72,249,173,176,194, 10, 43,172,104, 86, 5,184,187,143,113,115,115,139,119,115,115, 59,239,238,238, 62,198,130,
-159, 68, 55,241,144, 48, 18, 4,140,102, 6,253,150,142, 51,103,174,108,252,219,245, 22, 86,173, 49,167, 11, 65,192, 72,215,129,
- 32, 96, 18,139,197,223,185,185,185,125,249,252, 75, 44, 22,127, 71, 16, 48, 53, 58,214,216, 72,224,181,214,172,234, 50,121,242,
-228, 67,213,213,213,113, 90,173, 54, 46, 59, 59, 59,238,181,215, 94, 59,240,156, 37,162, 89, 78, 46,151, 59,177,107,183, 30, 73,
-151,175,222,204,206,202,201, 47, 78,203,124,148,255,251,153, 11,183, 67,195,194,111,113,185,220,137,173,184, 70, 4,128, 89, 20,
- 69, 37, 8,133,194, 34,138,162, 18, 0,204,102, 48, 24, 39,214,174, 93,155,159,154,154, 90,118,237,218,181,154,203,151, 47, 63,
-153, 54,109, 90, 14, 65, 16,191, 55, 33,216,163, 45,176,192, 44,125,252,248,241,153,146,146,146,179, 60, 30,111,181, 5,199, 55,
-112, 58,135,140,184, 47,145,234,104,137, 84, 71, 59,135,140,160, 27,189,191,223,202, 54, 55,119,141,254,208, 23, 56, 28,142,183,
- 25, 65,255,119,154,232,255, 80, 30, 0,174,117,223, 69, 2,248,190,238, 85,191,157,221,149,203,225,252, 85,253,243,175,104, 79,
- 43,167,149,211,202,105,229,124, 89, 17, 81,247,215, 13, 79,253,181, 26,158,221,173,221,117,248, 94,118,118,182, 16, 0, 2, 2,
- 2,222, 5,112,164, 53, 66,130, 32,240,177,201, 68,147, 0, 64,146,196, 39,125,251,246,139,224,241,120,207, 68, 65, 86,169, 84,
-236,132,132,139, 81, 38, 19, 77,212, 29,247, 49, 77, 99, 19,128, 50, 75,207,161,213,106, 72, 38,147, 13,146, 36, 22,132,134,134,
-181,173,168,168, 72, 36, 73,114,223,147, 39, 79,170, 91,109,198, 33, 8,108,223,190, 61,192,205,205,237, 15,209,154, 75, 74, 74,
-216, 35, 70, 12,111, 21,223, 84,128,163,225,112,186,177, 8,194,205,104, 48,216, 1, 0, 69, 81,213,183,217,236,200, 53,171, 86,
-241, 9,130, 48, 85, 86, 86, 66,165, 82, 97,254,252,249,188,180,180,180,145, 21, 21, 21, 63,154,161, 13, 8,239, 24, 49,255,236,
-217, 51, 65,178,170,106,245,246, 13, 91,147, 84, 20, 75,233, 19, 28,200,250,105,219, 47,246, 51,223,154,244,126, 70, 70,234, 93,
- 52,157,142,164, 49, 72, 0, 71,231,205,155, 23, 18, 19, 19,195,150,203,229, 92,149, 74,213,118,223,190,125,159, 69, 70, 70, 10,
- 59,117,234,196,254,237,183,223, 8,169, 84, 10,154,166,249,129,129,129,244,248,241,227,213, 7, 14, 28,152, 3,224,187, 22,132,
-239,199, 79,219,146,220,216,161, 67,135,101, 0,144,157,157,205,106,212,198,204,160,160, 32, 1, 0,100,102,102,174,160,105,211,
- 60, 0,160,105,172, 3,176,184, 9,211, 90,118, 72,207,113, 0, 1,191,212,171,135,184, 33,189,198,169, 65, 35,135, 0,178,235,
- 38, 4, 43,129, 70,113,161,158, 69,122,113,113,241, 11,229, 38, 28, 58, 52,134, 32, 8,226,112, 82, 82,210, 17,137, 68,226, 99,
- 50, 25,103,180, 84,206,230,174,149,179,179,243, 89,163,209,168,169,170,170,106, 8,148,233, 28, 62,170,135,163,141, 32,170,188,
- 90,158, 88,153,118,252,178,133,125,147,112,116,116,156, 90, 81, 81,241, 37,128,233,233,233,233, 17, 0, 16, 20, 20,196, 2,112,
- 71, 36, 18,189,170,211,106, 9,235,248,103,133, 21, 86, 88,241, 31, 17, 90,201, 0,134,226,223, 41,120,182,189,136,208, 98, 3,
- 64, 98, 98, 34, 0,112, 94,160, 32, 68, 99, 1, 51,119,238, 92,184,185,185, 61, 47, 94,112,233, 82,194,159,169,236, 51,231,248,
-226,139, 47,132, 53, 53, 53,209, 63,255,252,115,111,154,166,215, 23, 23, 23,223, 48,243,251, 50,154,198, 58,146, 36, 62, 33, 8,
- 2, 28, 14, 55,235,157,119,222, 73,174,251,174,237,239,191,255,206, 31, 54,108,152, 18, 64, 62, 0,112, 56, 92, 15, 6,131, 12,
-160,105,186,254,129,219,172, 32, 28, 11,248, 26,216,236,126,179,190,255,222,208,121,216, 48, 74,224,236, 76, 0, 64,126, 70,134,
-227,186,175,191,126,181, 58, 55,151,173,114,116,172,172, 84, 40, 84, 89, 89, 89,224,112, 56, 4,131,193,232,108,174,194, 2,129,
-224,131, 85,107,190, 18,200,170,106, 84,106,153, 92,203, 48,232, 53, 54, 60,190,177,172, 84, 82, 41,228, 9,148,159,124,190,156,
-253,222,140, 41, 31, 40, 20,138,119,205, 80,205, 89,176, 96, 65, 80,215,174, 93, 61, 14, 30, 60, 72, 72,165, 82, 80, 20, 37,236,
-212,169, 19, 34, 35, 35,141, 23, 47, 94, 36,124,124,124, 16, 26, 26,138,171, 87,175,226,250,245,235, 68, 68, 68, 4, 63, 54, 54,
-118,178, 94,175,255,206,156,184,102, 48,200,249,129,129,129,157, 4, 2,129, 54, 32, 32, 0, 51,102,204, 0, 77,211,136,142,142,
- 14, 21, 10,133, 71, 20, 10, 5, 59, 51, 51,163,183, 57,145, 45, 73, 61, 62,190,222,178, 5, 32, 12, 52,114,202, 83,143, 55, 94,
-126, 12,202,204,204,236, 94, 93, 93,141,167,215,133,110, 72, 96,222,187,119,239,214,244,165, 50,154,198,186, 97,195, 98, 62, 1,
- 8, 34, 58, 58,186,102,206,156, 57,100, 70, 70,198, 27,163, 70,141, 12,205,206,206, 65, 43, 39, 3, 1, 3, 6, 12,184,122,234,
-212, 41,199,128,128,128,242,170,170,170,134, 47, 92, 29,237, 6, 94,142,221,248,193,234, 77,251, 2,247,208, 68, 77,121,250,177,
- 7,102,250, 38, 49,117,234, 91,101, 66,161,112,244,225,195,135, 51, 75, 74, 74, 40, 22,171, 65,187, 50,196, 98,177,115, 64, 64,
-192,108, 7, 7, 7, 9,131, 36,197, 52,104,218, 92,255,180,194, 10, 43,172,176,226,133,113,178, 78, 92,157,124,254, 11, 10, 0,
-226,226,226, 26, 34,211,198,196,196, 52, 59, 3,166,105,186,236,222,189,123, 94, 74,165, 18, 52, 77, 91, 50, 96, 55,222,162, 89,
- 70, 16,228, 79, 36, 73,188, 75, 16, 4, 66, 67,195, 30,109,220,184,177,169,156, 94,218,208,208,176, 71, 12, 6,217,142,166,105,
- 16, 4,185,153,166, 77,101,205,112, 54,249, 32, 98,179, 57, 31, 3,128,171,171, 91,238,233,211,167,181, 99,199,142,197,215, 95,
-127,205, 90,180,104,209, 66,138,162,230, 20, 20, 20,148,182, 80, 78, 0, 88,236,236, 44,230,111,223,190, 61,224,157,119,222, 73,
- 46, 41, 41, 89, 12, 0,110,110,110, 95, 2, 8, 6,144,223,232, 51,108,217,114,224,201,140, 25, 51,178, 36, 18,201,226,230, 56,
- 71, 3,237,189, 2, 3,251,173, 76, 76,164, 73,141,134,168,184,114, 69, 86, 94, 86,166,127, 88, 94,206,223,125,231, 78,204,103,
- 95,126,201,244,242,246,198,165, 19, 39,156, 42,148,202,114,169, 70,163, 46, 43, 43,163, 13, 6,195,117, 11,234, 30, 34,118, 22,
-243,183,126,187,249,182, 13,147, 97, 18,123,122, 16, 76, 7, 7,138,228,139,216, 12,138,212,180,107,235,207, 6, 16, 98,238, 26,
-177, 88,172,201, 3, 6, 12,224, 31, 56,112,128, 8, 13, 13,133,157,157, 29,174, 92,185,130,187,119,239,162,186,186,154,212,235,
-245,232,210,165, 11,190,250,234, 43,120,123,123,163,166,166, 6, 5, 5, 5, 78,108, 54,219, 89,175,215, 55,215,158,207,244,167,
-143, 63,254, 24,110,110,110, 48, 24, 12,168,170,170,130,193, 96,128, 80, 40, 4, 0, 20, 21, 21,225,196,137,227,150,244, 37,179,
-160,105, 26,175,188,242,138,156, 32,136,244,231, 45, 90,173,225,244,240,240,248,173,188,188, 98,112,191,126,253, 80, 93, 93,173,
- 95,190,124, 57,194,195,195, 17, 16, 16, 96,182,156,238,238,238,179, 12, 6,195, 82, 0,208,233,116,187,185, 92,238,219,123,247,
-238,117,108,156, 34,164,222,146, 85, 38,169,172,190,126, 59, 53,115,193,172,177,175, 37,222, 72, 41,212, 49, 71, 20, 72,239, 31,
-151, 54, 81,206,197, 44, 22,251,231, 54,109,218,124, 59,119,238, 92, 55, 7, 7, 7,104, 52,154,207, 74, 75, 75, 49,123,246,108,
- 0,192,144, 33, 67,194,153, 76,230,233,105,211,166,193,199,199,231, 73, 85, 85, 85, 65, 82, 82,210, 12,165, 82,153,242,162,237,
-105, 33,172,156, 86, 78, 43,167,149,243,133, 97,169, 22,249, 31, 69, 9,158, 13,231,176,237, 25,161, 21, 19, 19, 67,196,197,197,
-209, 22, 84,172,210,211,211,211,139,199,227, 1, 64,101,107, 75, 97, 50,153,230, 56, 58, 58, 74, 22, 47, 94,220, 51, 32, 32, 64,
- 59,103,206,156,148,252,252,252, 37,141,143,105,219,182,237,234, 31,126,248, 1, 89, 89, 89,249, 95,126,249,229,213,202,202,202,
-214,230, 49, 91, 68,211,216, 88,103, 29,171, 56,113,226, 68,120, 98, 98,226,187, 27, 54,108,112,126,239,189,247, 88, 31,124,240,
-193, 36, 0, 95,155, 35, 97, 48, 24,202,166,150, 11,155,130,155,155,155,150,193, 96, 52, 27, 36, 46, 6,224,113,217,236,190, 43,
- 19, 19,105,109,126,190,114,231, 55,223,216,108,189,117,107,153,158,166, 93,196, 98, 49,122,189,250,106, 45,151,193,168,144,148,
-150,154,196,237,219, 51,242, 78,159,118, 82,177,217,197, 7, 14, 28,144, 86, 86, 86, 30, 51,107,194, 35, 8,153,137,166,181, 66,
- 79,111,253,216,145,253, 67,111,223,188,155, 97, 35,118, 34, 35, 58,133,134,103,100,229, 39,193,100,210, 17, 4, 97, 54, 88,160,
-173,173,109, 64,101,101, 37,100, 50, 25,156,157,157,177,113,227, 70,184,186,186, 66,169, 84, 34, 53, 53,149,246,244,244, 36, 18,
- 19, 19,225,233,233,137,242,242,114,104,181, 90,200,229,114,137, 70,163,105, 46, 55, 99, 25, 73, 50,118,145, 36,241, 22, 65, 16,
-104,215,206,247,241,143, 63,254,168, 53,153, 76, 8, 10, 10,194,168, 81,163, 16, 27, 27,139,212,212,212,122,203,147,182, 77,155,
-182,143, 73,146,104, 83,167,149, 94,216, 2, 83,159,218,167,184,184,120,244, 11,222, 52,164,187,187,251, 36, 63, 63,191,119, 39,
- 78,156,168,103,179,217, 80, 40, 20,245,109,161, 31, 60,120, 72,205,176, 97, 49,182, 39, 79,158,108,182,156, 58,157,110,233,147,
- 39, 79,220, 84, 42, 21, 6, 13, 26,244,193,250,245,235, 5,108, 54, 27, 0, 96, 52, 26,159,177,100,173,218,176,231,236,188,165,
- 63, 38,156,253,237, 43,247, 85,139,222,126,109,210,156,213, 9, 0,206, 52, 85, 48,173, 86,155, 43,149, 74,167, 47, 88,176, 96,
-223,150, 45, 91,236,151, 44, 89, 2,147,201, 4,154,166, 97, 48, 24, 26, 18,137,155, 76, 38, 28, 61,122, 20, 15, 31, 62, 92,253,
-156,200,178,194, 10, 43,172,248,159, 67, 43,180,200,255, 34,220,240,116,217, 16,207,139,173,255,120,100,120, 6,131,177,245,220,
-185,115,157,122,247,238, 77, 69, 69, 69,133,158, 57,115, 38,244,201,147, 39, 41,117,214,131,208,168,168,168, 80,177, 88,140, 77,
-155, 54, 41, 25, 12,198,214, 23, 60, 77,195, 67,175,180,180, 52, 25,192,250,216,216,216,117,179,102,205,130,171,171,107,112, 73,
- 73,201,127,180,206, 34, 14, 39, 98,218,198,141, 6,166, 94, 79,126,191,126,189,232,155,132,132,117, 7, 15, 29,162, 94,121,229,
- 21,130,166,105, 60,184,127,159,247,213,119,223,241, 39,140, 28,153,159,153,155,107, 56,126,246,172,190,236,201,147,170, 39,229,
-229, 75, 1, 84,153,227,215,235,245,255,202,206,206,118,239,213,231, 21,143,203,183, 82,238,142, 29, 57,164, 31,147, 34,137,156,
-252,162, 59,110,174, 78,182,151, 18,226, 85,122,189,254, 95,230,120, 20, 10, 69,158,193, 96,112,160,105,218,249,210,165, 75,112,
-118,118, 70,117,117, 53,244,122, 61,180, 90,173, 86,169, 84,114, 43, 43, 43,161, 86,171,161,209,104, 32, 18,137,240,224,193,131,
- 50,131,193,112,177, 57, 78,163,209, 56,141,195,225,124,193,100, 50,217, 44, 22,171,248,206,157, 59,144,201,100,109,237,236,236,
-190, 54, 24, 12, 40, 46, 46, 70, 98, 98,226, 71, 34,145, 40, 31, 0,184, 92, 46,216,108,142,163, 70,163, 49, 0,120,242,162,109,
- 78,211,244, 11, 95, 47, 87, 87, 87,111, 30,143,183,242,147, 79, 62, 14,234,216,177, 19,202,203,203, 97, 50,153, 32, 16, 8,160,
- 84, 42, 33, 18,137,208,163, 71,143,188,149, 43, 87,150,208, 52,102,182, 32, 6, 25,117,215, 7,179,102,205, 18,136, 68, 34, 20,
- 22, 22, 34, 48, 48,176, 65,104,149,148, 87, 62,184,118, 59, 37, 99,193, 59,227,250,236, 63,145,144,126,246,210,157,244,145,131,
- 94,237, 72, 16,116,219,150,202, 40,145, 72,202, 41,138,154, 51,107,214,172, 47, 2, 2, 2,218,209, 52, 13,127,127,127, 12, 24,
- 48, 0,167, 79,159, 70, 86, 86, 22, 20, 10,133,241,198,141, 27,191,150,148,148,252,110, 29,194,173,176,194, 10, 43,254, 86,252,
-193, 55,235, 25,139,214,127, 18, 18,137,164, 60, 35, 35,227, 76, 82, 82, 82,204,248,241,227,113,233,210,165,241,103,103, 1, 0,
- 0, 32, 0, 73, 68, 65, 84,169, 0, 22, 0, 0,135,195,153, 58,126,252,120, 36, 37, 37, 33, 35, 35,227,140, 68, 34, 41,255, 43,
-206,201,102,179,213, 90,237, 83,227, 20,151,203,229,182,242,231,109,235,150, 12, 1,160,109, 11,159, 53,111, 26,161, 40,183,176,
- 65,131,168,234,187,119,101,219,111,222,252, 98,223,190,125, 84,207,158, 61, 9,189, 78, 7,163,201, 4, 95, 95, 95, 34, 42, 58,
- 90,176,107,223, 62, 7,163, 66,145,184,234,147, 79,174,108,155, 54,173, 54,187,206, 15,204, 28, 52, 26,205,119,239,206,158, 30,
-157,112,233,138, 71,112, 96,123,135, 51,231, 18,146, 29, 29,109,249, 1,126,126,130,202,234, 42,227,146, 69, 31, 81, 26,141,230,
-123,115, 60, 42,149,234,104,124,124,252, 72, 47, 47, 47,231,148,148, 20,104,181, 90, 24,141, 70, 68, 69, 69,129,166,105, 14, 0,
- 19, 69, 81,200,200,200,128, 78,167,147,100,103,103, 23,231,228,228,112, 0,172, 53, 83,190,199, 26,141, 6,233,233, 79, 87,237,
- 60, 61, 61,251, 15, 29, 58, 20, 6,131, 1,131, 6, 13,194,241,227,199,251,167,167,167,127,211, 88,243,253,217,107, 94,103, 33,
- 11,114,119,119,143,173,251,200, 34, 39,120, 15, 15,143, 80, 95, 95,223, 45,107,215,174,101,121,122,122,130,166,105,216,219,219,
- 65,169, 84,162,162,162, 18,193,193,193,240,242,242,194,218,181,107, 1,224,215,150, 44,110, 38,147, 9, 37, 37, 37,200,203,203,
- 67,110,110, 46,188,188,188, 64, 16, 4,228,114, 57, 12,134,167, 57,185,249,114,217,201, 31,118,253,222,247,208,150,165, 33,221,
-194,252,189,111, 38,167, 73, 38,143,238,207,247,247,241, 14, 40, 79, 89, 78, 2,203,155, 77,186, 92, 92, 92,156, 83, 92, 92, 60,
- 94, 34,145,176,106,106,106, 34,251,247,239,191, 41, 58, 58, 26,201,201,201,184,114,229,202, 4, 14,135, 35,209,233,116, 6, 87,
- 87,215,153, 4, 65,136,116, 58,221,254,202,202,202, 18,235,120,104,133, 21, 86, 88,241,151,163,222, 71, 11,141,254,182,206,162,
-245,127,236,157,119,120, 20, 85, 27,197,207,108,223,108,122,217,144, 66, 2,132,146, 16, 2, 4,164, 72, 15, 8,210,130,116, 80,
- 41,130, 74, 19, 69,164, 8, 22, 64, 44,128, 74, 83,145,170,210,123,211,128, 64,162,180, 72, 64, 58, 36, 36,129, 4, 82,119,211,
-203, 38,219,167,220,239,143, 20, 19, 72,217, 77, 98,129,111,126,207, 51,207,236,206,206,156,185, 83,246,206,153,247,182,192,192,
- 64,219,164,164,164, 73, 77,155, 54,149, 2,128,141,141, 77,155,230,205,155,207, 79, 76, 76, 44,178, 54, 53, 58,157,238,192,238,
-221,187, 95, 92,179,102,141,100,200,144, 33, 45,142, 28, 57,210, 5, 0,134, 12, 25,210,194,222,222, 30,187,119,239, 54,235,116,
-186, 6,235, 19,137,166,233,222,157, 59,119, 70, 94, 94, 30,146,146,146,172, 42, 66,249,229,151, 95, 20, 40,169,151, 85,227,178,
-154, 96, 76, 38,103, 39,111,111, 65,250,217,179,230, 60,141,198,179,119,159, 62, 20,109, 54, 67, 32, 16, 32, 55, 55, 23, 41, 41,
- 41,112,116,114,162, 98,239,223,183,219,182,112,225, 47, 77,131,131,165,172,201,228,106, 69, 50,181, 57, 89,153, 83,222,158,253,
-214,209, 61,123,246, 42, 11, 52,154, 4, 27, 27,133, 81, 38,147,120,204,121,251,109, 54, 47, 47,111, 50,128, 98, 11,116, 86,238,
-217,179,103,208,160, 65,131,110,251,250,250,186,103,103,103,123, 20, 20, 20,176,121,121,121, 66,148,212,181,162, 0,224,236,217,
-179,208,104, 52, 12,203,178, 23, 80,210, 23,150,201,210,132, 54,105,210,196,177, 83,167, 78, 33, 74,165, 18,133,133,133,112,117,
-117, 69,135, 14, 29, 66,132, 66,225, 15,201,201,201,133, 13,121,215,135,135,135,219, 19, 66,158, 39,132, 96,208,160, 65, 22,109,
-195,178,236,212,161, 67,135, 74, 40,138,130, 94,175,131, 92,110, 3, 91, 91, 59,216,219, 59,192,223, 63, 0, 42,149, 10, 3, 7,
- 14, 52, 37, 36, 36,124,175, 86,171, 15,212,162, 5,149, 74,133,236,236,108,164,164,164, 32, 39, 39, 7, 0,144,147,147, 83, 94,
- 57,191, 33, 40, 44, 44, 28,222,189,123,247,121, 51,103,206, 4,195, 48, 24, 62,124, 56, 82, 83, 83, 87, 63,122,244,104,191,151,
-151,215,132,169, 83,167, 42, 93, 93, 93, 49,111,222, 60, 27, 0,159,240,249, 33, 15, 15, 15, 79,131,243,120, 29,173, 39, 35, 90,
- 53,149,137,122,120,120,244,162, 40,234, 35,189, 94, 47, 45, 43,146,161, 40, 74,170, 84, 42,143,235,245,250, 21,106,181,218,170,
- 74,113, 5, 5, 5,154,135, 15, 31, 30,143,138,138, 26, 59,106,212, 40,132,135,135, 79, 6,128, 81,163, 70, 33, 42, 42, 10, 15,
- 31, 62, 60, 94, 80, 80,208, 32, 3,144,122,123,123, 15,238,211,167,207,168,206,157, 59, 35, 44, 44, 12, 44,203, 94,178,102,251,
-138, 45, 12, 81, 69,171,195,178,101, 22,137, 9,133,160, 40,170, 60,154,145,147,157,141,248,184, 56,228,229,231,195,104, 48, 64,
-171,211,177,254,205,154,233, 11, 77, 38, 49, 5, 88, 91,246,149,124,253,234,229, 20,157, 86,235,238,234,236,162, 87, 40,100, 40,
-208, 20, 74,174, 93,189, 92, 12, 32,193, 66, 13, 19, 33,164,207,175,191,254,186, 68, 40, 20,142,179,179,179,195,172, 89,179,132,
- 33, 33, 33,144, 72, 36, 48, 26,141, 40, 40, 40,192,238,221,187,179, 89,150,245, 43,221,198, 78,161, 80,236, 16, 10,133,105, 69,
- 69, 69, 31,213,186, 3,147,105, 72,104,104,168,200,100, 50,225,179,207, 62,195,210,165, 75, 49,104,208, 32,209,213,171, 87,135,
- 0,216,211, 80,119, 60,199,113, 24, 48, 96, 64,197,202,240,247, 44,217, 78, 44, 22,183,109,217,178, 37,178,179,179,145,157,157,
- 13,165, 82, 9, 47, 47, 47,120,120,120, 96,245,234,213,100,253,250,245,167,204,102,243,247, 57, 57, 57,153,150,164, 33, 49, 49,
-177, 60, 50,104, 48, 24,160,213,106,145,154,154, 90, 94,116,168,183,117, 24, 52,123,202,176, 96,173, 94,175,187,114,231,126,202,
- 71,239, 76,232,166,213,235,117,247, 31,165,196, 3,223,112, 22,220,223,211, 38, 79,158, 60,109,236,216,177, 40, 46, 46, 70, 84,
- 84, 20,122,244,232,129, 47,191,252,210,243,194,133, 11,239,117,238,220, 25, 98,177, 24,231,206,157, 3,195, 48,169,124, 94,200,
-195,195,243, 95,230, 41,173,159, 85, 35, 53, 70,180,124,124,124,156, 88,150, 93, 48,116,232,208, 1, 35, 70,140,192,192,129, 3,
- 43,253,190,103,207, 30,251,195,135, 15,175,248,230,155,111, 6,153,205,230,149,214, 20,245,113, 28,119,116,207,158, 61, 67,186,
-117,235,166,232,219,183,111,115, 0,144,201,100,166, 61,123,246,232, 56,142, 59, 90,135, 99, 41,235,136, 49, 19, 0,188,188,188,
-218,139, 68,162, 81,131, 7, 15,110, 63,101,202, 20, 68, 71, 71, 99,247,238,221, 15,252,253,253, 35, 51, 51,173,170, 95,157, 84,
- 75,171,195, 21,181, 69,183,132, 82,105,110, 65, 70,134,147,157,175,175,216,217,222, 94, 29, 22, 22,230,211,191,127,127, 42, 53,
- 53, 21,249,249,249, 48, 24, 12,184,122,245, 42, 39, 2,146, 69,206,206, 84,114, 84, 20, 37,148, 74,115, 81,185, 37, 95,173,248,
-120, 58,183,250,120,209,140,166, 6,163, 33,168,176,176,144, 17,137,197,226,198, 30, 78,169,113, 9, 86,149,196, 25, 21, 10, 69,
- 39, 0, 34,142,227,116, 46, 46, 46,138, 51,103,206, 64, 42,149,130,162, 40,180,107,215, 14,114,185, 92, 66, 8, 73, 1, 0,123,
-123,123,233,230,205,155, 29, 39, 76,152,112,177, 54,225,142, 29, 59,138,101, 50,217, 75,254,254,254,136,138,138,194,221,187,119,
-147,163,162,162,154,116,236,216, 17,190,190,190, 47,121,122,122, 30,188,113,227, 6,221, 16, 55,118, 73,139, 85,235, 43,195,179,
- 44,203, 81, 20, 5,129, 64, 0,142,227,144,157,157, 13, 63, 63, 63,108,216,176, 1,235,214,173,251, 76,173, 86,255,108,133, 22,
-171,209,104, 96,107,107,139,187,119,239, 26,135, 14, 29, 42, 19, 8, 4,120,240,224, 65,185,209,114,119,115,105,211,163,115,219,
-214,159,173,221,121,218, 86, 38,147, 13, 12,233, 20, 24,115, 63, 57,141, 16,170,214, 98,227,192,192, 64,137,159,159,223,228,177,
- 99,199, 34, 49, 49, 17, 43, 86,172,200, 81,171,213,103, 79,159, 62, 61,122,230,204,153,194, 30, 61,122, 32, 55, 55, 23, 63,253,
-244, 19,115,237,218,181, 31, 51, 50, 50,118,242,217, 56, 15, 15, 15,207,127,196,104,249,248,248,140,149, 72, 36,243,198,143, 31,
- 47, 12, 8, 8, 64,102,102, 38, 28, 28, 28,104,138,162,196, 0,224,228,228, 68,219,216,216, 96,198,140, 25, 8, 14, 14,238,181,
-112,225,194, 30, 34,145,104,131, 74,165,218, 97,201,142,179,178,178,116, 2,129,224,208,172, 89,179, 86,222,188,121,195, 15, 0,
-254,252,243,207,135, 42,149,106, 81, 86, 86,150,206,202,227, 40,235, 20,147,146,201,228, 87, 90,181,106,245,168, 83,167, 78, 14,
- 35, 70,140,128, 82,169,196,245,235,215,177,106,213,170,251, 38,147,105,201,249,243,231,153,127,250, 36, 51, 70, 99,198,181, 99,
-199,236, 67, 94,125,213, 97,206,208,161, 95,191, 53,107,214,154,143, 63,254, 88, 20, 16, 16, 64,233,116, 58, 92,185,114,133, 28,
- 62,124,152,254,233,211, 79,215,193,214, 86, 28,117,248,176,212,100, 50, 37, 91, 25,185,235,211,179,119,175,128,175,215,124, 3,
-131,190, 24, 87, 46,157, 64,126,126, 54, 54,111, 57, 18,224,237, 77,250,164,167,167,159,183, 84,139,162, 40,255,240,240,112,119,
- 66, 8,164, 82, 41,150, 47, 95, 14, 47, 47, 47, 56, 56, 56,160,168,168, 8,239,189,247,158,227,187,239,190,235, 8, 0,209,209,
-209,229,221, 51,212,134, 74,165,234, 62, 99,198, 12,123,134, 97,112,234,212, 41, 19, 69, 81, 31, 69, 68, 68,252,208,174, 93, 59,
-105,175, 94,189,236,119,238,220,217, 3,192,185,134, 50, 90,117,220,238,193,153, 51,103, 58,143, 27, 55,142,136,197, 98,170,160,
-160, 0, 78, 78, 78,216,176, 97,131, 86,173, 86,159,176, 82,107,249,162, 69,139,150,148,126,222,254,209, 71, 31,189,177,114,229,
- 74,101, 70, 70, 70,121, 84, 51, 43, 39,239,247,238, 67,223,102,115, 11, 10, 77, 63,174, 93, 56,198, 70, 46,147,126,180,242,199,
-115,180, 16,151,107,189,175, 24, 70,170, 80, 40,164,132, 16, 28, 58,116, 8,201,201,201, 83,115,115,115, 51, 88,150, 61,178, 96,
-193,130,249, 1, 1, 1,205,226,226,226,146,139,138,138,190,204,202,202,122,196,103,119, 60, 60, 60, 60,127, 27,101,149,224,203,
- 90, 31,158, 64, 73,113, 98,245, 70,139,101,217, 25,167, 79,159, 22,114, 28,135, 45, 91,182,224,218,181,107, 68,161, 80,124,164,
- 80, 40,190,179,177,177, 97,245,122,253,244, 55,223,124,115,194,210,165, 75, 5,189,122,245, 66, 84, 84,148,192,207,207,111, 50,
-128,138, 70,171, 63,106,232,107,163,176,176,240,106,102,102,134, 95,133, 14, 42,253,100, 50,249,213, 90, 14,230,113,205,199, 59,
-197,236,186,124,249,114,173,167,167,167,233,238,221,187,216,180,105, 19,119,237,218,181,179, 82,169,116,179, 90,173, 54, 90,168,
-217, 16,148,107, 74, 25,230,250,174,249,243, 3,159, 27, 62,156,123, 99,222,188, 98,137,141,205, 59, 95,127,243,205,194,130,162,
- 34, 47, 80, 20,113,117,116, 76,222,178,124,249,138, 65, 47,189, 84, 28,125,254,188,252,102,120,184, 88, 73,211,183,172, 73,103,
-122,122,250,249,115,231, 46, 98,251,214, 53, 48,155,141, 80,167,151,248,180,156,220, 66,212, 98,178,158,208,100, 24,166,112,244,
-232,209, 18, 0, 54, 19, 39, 78,148,102,101,101,161, 69,139, 22, 0, 0,141, 70,131, 19, 39, 78,160,117,235,214, 0,128, 59,119,
-238,148,127,174, 45,157,182,182,182, 47,245,232,209, 3,201,201,201,136,142,142,254, 77,173, 86,231, 2,248, 45, 53, 53,117, 72,
-231,206,157,113,244,232,209, 97, 53, 24, 45,171,174,145,133, 70,235, 9, 77, 27, 27,155, 69, 71,142, 28,153,122,233,210,165,113,
-243,231,207, 23,191,240,194, 11, 0,128,162,162, 34, 29, 0,214, 26, 77,189, 94,191, 25, 64,121,203,217,164,164,164, 93,243,230,
-205,187, 48,119,238, 92,101, 89,250,178, 99,126,142,202, 6,162,130, 66,166,126,220,189,115, 80,192,231,235,119,159, 78, 73,205,
-220, 93,120,239,120,161, 37,199, 78, 8, 1, 77,211,224, 56, 14, 46, 46, 46,218,220,220, 92,100,101,101, 61,202,202,202,154,149,
-144,144, 96,213,177, 55,228, 61,207,107,242,154,188, 38,175,249,127,138,229, 61,195, 19, 66, 24,142,227,112,238,220, 57, 28, 57,
-114,132, 53,155,205,211,212,106,117,197,222,170,191,185,126,253,122,248,232,209,163,119,196,197,197, 9, 99, 98, 98, 64, 8, 97,
-173, 73,141,193, 96,160, 41,234,201,101,245, 61,202,237,219,183, 35, 35, 35,195,156,154,154, 26,193, 48,204,209,122,182, 94,172,
-119,171,195,237,128,241, 21,147, 41, 98,105,207,158, 3,150,132,135,203,222,248,224, 3,227,107, 83,166, 44, 96, 77, 38, 90, 40,
-145,112, 82, 91, 91, 1, 43,147,137,163,207,159,151,175,159, 57,211, 69,111, 52,158,218,109, 69, 5,243,178,136, 86, 72, 72, 47,
-188,246,198, 92,232, 43, 68,180,162,174,198,195,104,134, 85, 17, 45,163,209, 24,164, 86,171, 33,151,203, 83, 0,120, 76,154, 52,
- 9, 28,199, 65,175,215,163,168,168, 8, 42,149,170,112,202,148, 41,108,169,121, 18,141, 26, 53,202,193, 18,221,230,205,155,123,
-137,197, 98,156, 58,117, 10, 98,177,248, 4, 0,136,197,226, 19,225,225,225, 67, 94,126,249,101,120,123,123, 55, 79, 76, 76,164,
- 80, 75,253, 52,247,160,225, 7, 8,208, 10, 20, 90,150,132,224,208, 82, 25, 52,252, 54, 5,220, 47,237, 53,254, 94,199,142, 29,
- 1, 11,235,101, 85,164,180,113,199, 58,154,166, 15, 46, 92,184,112, 86,215,174, 93, 95, 92,186,116, 41,133,210,174, 26,234, 73,
-124,122,122,122,239,197,139, 23,159, 38,132, 84, 50,253, 89, 57,121,191,119, 11,157, 77, 10, 10, 10,111,102,223,251,249,142, 85,
- 17, 83,134,169, 87,119, 22, 60, 60, 60, 60, 60, 13, 22,213,122,130,106,141, 22, 69, 81, 91,250,244,233, 51, 13,128,144,162,168,
- 77, 42,149,234,137,204, 95,173, 86,199,123,121,121,125,213,172, 89,179,233, 0, 8, 69, 81, 91,172, 76, 84, 38, 33, 88, 37, 16,
- 80, 11, 75,204, 93,157, 58,168, 44, 27,150,100, 33, 0, 74, 32, 16,238,184,113,227,198, 7, 41, 41, 41,217, 22, 70, 32,106,164,
- 33, 90, 29, 2,192, 94,224,209,248,228,228,211,243,218,182,237, 63,104,230, 76,180, 31, 52,200,193,171, 73, 19, 86,111, 54,115,
-119, 34, 35,169, 75,135, 14, 73,110,134,135,139,245, 70,227,169,163, 64,138,181,233, 76, 79, 79, 63,255,251,217,243,103,198,140,
- 26,242, 98,243,102, 94, 37,166,225,145, 10, 57,121,133,103,172, 49, 89,143,153,222,225, 27, 54,108,248, 89, 34,145,136, 42, 14,
-101, 99, 54,155,243,140, 70, 99, 16, 0,228,231,231,123,109,217,178,101,159, 64, 32, 72,174, 77, 47, 38, 38,230,248,146, 37, 75,
- 70, 37, 37, 37,157, 73, 77, 77, 77, 2,128,148,148,148, 36,154,166,119,168,213,234, 81,201,201,201,135, 97, 65, 35, 0, 2,180,
-138,142, 60,216, 14, 0,130,122,142, 69,116,228, 65, 57,128,118, 65, 61,199, 2, 0,234, 58,150, 97, 69, 74,187, 65,248, 40, 42,
- 42,106,207,139, 47,190,248, 38,234,209,167,215,227,102,203,108, 54, 55,121,124, 97, 89,100,203, 26, 33,147,201, 68,235,245,122,
-134,101, 89,145,217,108, 38, 38,147,137,230,243, 57,158, 90,224,199,190,228,121,106, 33,132,116, 6,160, 44,203, 54, 75,231,202,
-199, 62,155, 80, 58, 92, 96, 89, 86, 89,250, 61,155,162,168,171, 21, 52,202,151, 91,176, 45, 0,228, 0,184, 77, 81, 84,117, 65,
-144, 45,213,125,175,214,104,169, 84,170,195,176, 96,208,104, 75,215,171,129,197,165,227,196, 1,117, 31,135,173, 92,131,101,217,
-204,148,148,148,122, 95, 80,129, 64,240,104,216,176, 97, 86,173, 95,219, 58,251,129,228,183,141,198,157, 97,223,126,219,225,212,
-166, 77,222, 44,195,184, 82, 0, 17, 74,165,185, 38,147, 41, 73, 73,211,183,172,141,100, 85,138,198, 60, 76, 31,152,248, 48, 29,
- 45, 91,182, 36, 15, 30, 60,104,136, 76,245,150, 86,171,245,169,237, 22,208,233,116,189, 44, 52,131,123,211,211,211,247, 86, 97,
-216,247,169,213,234,125, 86, 60, 41,238,151,154, 42, 1, 71,113, 99,130,122,142, 61, 4,128, 43, 27, 84,186, 33,201,200,200,136,
- 67,105, 63,111,255, 53,146,147,147,141, 20, 69,237, 90,181,106,213,196,155, 55,111,238, 87,169, 84, 70, 62, 43,230,225,225,121,
-150, 77, 22, 69, 81, 97,165,223, 67, 75,131, 66, 97,143,127, 46, 91,167,108,189,138,235,148,105, 60,190,188,166,109, 1, 96,209,
-162, 69, 31,172, 88,177, 66, 1,192,210,193,152,235, 60,168,244,223, 69,230,127, 68,163,162, 41,216,250,119, 28,232,183,128, 9,
- 12,115, 25, 76,133, 58,249,116,195, 6, 34, 30, 60,120,240, 76,191,181,150, 13, 42, 93,129,182,255,175,153, 79, 82, 82,210, 6,
- 95, 95,223,205, 42,149,138, 1, 15,143, 5,207, 43,254, 20,240, 60,165, 40,171, 50, 70,213,152,178,208,154,126,175,244,226, 94,
-197,122, 85,125,167, 40, 42,108,197,138, 21,161, 86,164,183, 60,162, 37,224,175, 29, 15,207,211,205,191,209,146,150,135,135,135,
-231,153,120,243,120, 44,138, 85,102,190, 30,255,190,104,209,162, 15, 80,115,137,147, 39, 74,162, 88,158,165,223,203,235,107, 81,
- 40,105, 57, 80, 21,214,180, 38,232, 95,135,227,139,224, 53,121, 77, 94,147,215,228, 53,121, 77, 94,243,255, 78,179, 54,237,136,
- 42, 12,209,208,234,138,250,106, 42, 70,124,252,115,109,219,214,182, 46, 69, 81,213,117,243, 83, 86, 84,248,248,252,111,167, 63,
-175,201,107,242,154,188, 38,175,201,107,242,154,188,102,125, 32,132,116, 38,132, 12, 69, 73,241, 55, 33,132, 12, 37,132, 12, 90,
-180,104,209,226,178,101,139, 22, 45, 90, 76, 8,121,161,108,189,210,117,202,183, 41, 91,246,248,252,241,101, 53,173, 91, 67, 18,
-167, 61,246,185,252,251,127,165,142, 22, 15, 15, 15, 15, 15, 15, 15, 79,149,148,181, 24,172, 16,109,202, 6,112,103,197,138, 21,
-249, 21,234, 78,101, 3,184, 5, 32,184,116,189,236, 82,147, 86,177,110,149,169,244,187,169,138,117, 76,150,172, 91, 13, 91,170,
-249,204, 27,173,234, 8,246, 16,124,234,219,216,189, 83,233, 5, 0, 41, 29, 4,152, 43,237,175,136,148,117, 92,196,113, 32,132,
- 64,149, 85,112,253, 78, 22, 62,174,235,254,252,189,224,226, 46,151,175,227, 8,233, 89,186,232,124, 97,174,113,110,180, 6, 5,
-150,106,180,110,132, 64,185, 0, 11, 56,130,246, 0, 32,160,112,219,192,225,171,216, 76,235,251,147,170,234, 62, 15, 82, 98,154,
-212, 70, 49,222,209,201,185,101,126,126,206,125,179,193,120, 48, 38, 27,155, 81,135, 10,182,205,157,241, 60, 71,240, 1, 0,129,
- 88,128,213,247,243, 44,110,201,193,195,195,195, 83,223,232, 72,189,250,197,163, 40,138,173, 66,147,170,167, 38,223, 80,193, 2,
-179, 85,197,226, 63,171, 88,118,245,191,148,110,171,140, 86, 27, 37,102,130,194, 50, 0, 4, 4,159,196,100, 99,163, 85,219,123,
-162,191, 92, 40,220, 6, 64,104, 48,179,243, 8,135, 11, 85,158, 76, 1,122,203, 37,194,213, 0, 56, 3,203,190, 30,163,182,188,
-190, 88,144, 55, 6,137, 56,193, 46,142, 16, 49,203,145, 29, 32, 8,179,147,224,143,203,233, 48, 88,147, 86,223,198,238,157,142,
-253,169,126,241,236,198, 57,232,218,190, 5, 8,203, 0, 28, 13, 69,175, 5,248,109,237, 36,116, 13,244, 5,225,104,128, 99, 96,
- 55,248,107, 12,110,235, 72,238,100,213,109, 28,108,127, 47,184, 52,113,115,191,187,117,235, 54, 15,175,230,109, 40,142, 49, 35,
-238,207, 51, 19,222, 93,184,164, 95, 16, 10,219, 90, 98,182,218,123,226, 13,223,166, 1, 11,230, 46, 91, 35,244,244,242,177,229,
-104, 35,147,241,232, 94,199,111,190, 92,114, 88, 34, 72, 94,125, 91,141,109,150,222,203,109,148,152, 46,146, 73,199,218,200,109,
- 91,234,116, 69, 15, 88, 51,125, 80, 32, 22, 13,250,234,235,117, 29, 66, 6, 12,177, 99,139, 50, 4, 52,135, 54, 7,246,239,107,
-242,237,134,239,135,220, 85,179, 47, 1,224,172, 57,102,142, 96, 97,252,206,105, 67,196, 34, 33, 21, 56,117,171, 16, 96,234,100,
-180, 2,221,241, 10, 69, 80,107,247, 18,132,194,197,123, 89,216, 91,151,125,180,118,199, 15, 20,129, 63, 40, 28,162, 8,246,197,
-100, 35,139,207,242,120,120,158, 45, 4, 2,193, 89,142,227,250, 54,176, 49,120,158, 16,114,153, 63,187,255,223, 88, 23,209,162,
-240, 89,116, 66,170, 51, 88, 51,130,252,155,127, 10, 88,103,180,228, 66,225,142,171,247, 51, 61,192,152,177,245,243, 89,251, 77,
- 52,192,208,102,176, 12, 13,150,161,193, 48,102,176, 52, 13, 66, 27,177,228,199,179,128,169, 8,157,218,182,218, 1,176,158,150,
-238, 67, 76, 4,187,174, 71,158,113,161, 76,133,216,187,113,197,219,169,217,197,111, 71,220, 86,229,180,113,215, 47,142,201,194,
- 79,214, 24,130,179,155,230, 96,247,209, 19,105,235,127,208,198,114,132,192,197,193, 38, 96, 66,104,180,207,206,227,103, 83,215,
-237, 48,196, 2,128,163,173, 52, 96,242,237,251,190,245,185, 8,238,114,249,186,205,223,127,235,225,233,106, 67, 49,151, 86,130,
- 97, 89,248, 52, 25, 42, 92, 60,123,130,231,103,107,183,173,133,198,248, 90, 77,219, 7,184,163, 77,211,102,129,243,118,156,184,
-228,171,213,100,153,206,236,249, 32, 1, 70,208, 30,222,129,226, 79, 87,172, 17,126,248,254,156,247, 76,108,218,149,184, 44,196,
-212,150,215, 4,186,227,248,138,149, 95,183,239, 55, 56,212,142, 43,206, 22, 26,180,197,254, 91,127,220,182,172,117,251, 46,138,
- 94,109, 27, 75,178, 14,206,160,244, 69,121, 48, 11,228,178,126, 65,253, 29,244, 19, 95,166,183,110,223, 61, 59, 38, 11,223, 88,
-115,204, 44,249,235,222,227,184,186,247,186, 78, 17,244,186,121,249,236,116, 86,117, 21,132,165, 1,214, 92, 62, 7, 75,131,112,
- 37,243,174, 51,126, 4, 80, 55,163, 37, 32,120, 49, 34,242,170,103,102,134,186,243,218,175,191, 88, 76,174, 94,253, 21, 44,118,
-221,203,195,121,107, 13, 38, 0,127, 63, 87,225,105,154,133, 49,181,128,245, 47, 91,216,207, 95,214,221,211,142,122, 33,165,144,
-186,112, 49, 65,127,158,207,154,120,120,254,149,136, 9, 67, 8, 17, 53,176,230, 16, 66,200,201,122,202, 44, 0,240, 70,233,231,
-109, 0,190,106,128,164, 53, 6,224, 81,250, 57, 3, 64, 26,127, 7,212,139,199, 43,191,215,185, 31, 45, 57, 8, 7, 28, 26, 1,
- 0, 54,214,166,130, 0,114, 80, 66,128,214, 98,248,224, 1,112,115,247, 0,104, 29, 96,214, 1,180, 30,160,181, 0,173, 71,142,
- 58, 25, 48,107,129,196, 95,193, 16, 34,179,250,112,141,133, 64,252, 65,188,208,209, 23, 74, 71, 57,230, 12,111,227,182,229, 84,
-252,182,109,103,226,250,199,100, 97,188, 69,105, 37, 4, 93,219,181,196,250,109,218,216, 95,110,100, 15, 4,128, 33,193,174,167,
-186,182,105,226,179,110,135, 33,246,228,157,252, 65, 0, 48, 40,200,225,215, 46, 1,158,190, 92, 61,186,167,225, 8,233,229,213,
-180, 37,197,222,220, 12, 78,147, 6,141, 70,143,180, 71, 59,225,236,253,156,128,229,208,167,182,237,109,132, 88,244,206,135,171,
-196, 58, 77,166,137, 51,103,179, 74, 97,190, 80, 36,229, 40,164,159, 55, 22,115, 5,236,220,105,147,152,121, 31,127,190, 8,192,
-132,154,116,218,184, 99,246,234,213,235,218,245,232,212,218, 61,227,240, 28,170, 56, 63, 19,140, 80, 33, 27,222,173, 7,156, 90,
-181,225, 50,207,173,166,164,205,251,195,201,181, 57,210, 47,237, 65,210,229, 35, 84,207,142,163,100, 63,237,149, 76, 4,204, 85,
- 26,173,150,110,232, 57,176,119,151,253,205,125,189, 60, 9,225,192,113, 4,132, 99, 81,108,160,177,248, 64, 34, 88,150,197,232,
-129, 61, 95,176,149, 82,132,227, 56, 16,194, 33, 53, 35, 87,247,251,149,216, 23, 18,243,113,197,146, 72, 85,240,243,125,123,222,
-190,126,185, 53, 29,255, 11, 58, 77, 88, 17, 75, 1,145, 21,238,185,158, 55, 78,255,212, 26,248,177,238, 94,142, 2,155,116,106,
- 37,124,123, 79, 19,110,222,123, 74, 89,152,157, 62,249,240,206,239,199,108,220,188,121,119,108, 22,102, 88, 99,178,222,237, 45,
-141, 92,251,187,198,181, 91,115,219,236,212, 10,113, 74, 63,103,193,192, 77, 39, 99,222,137, 90,222,181,245,135, 39, 72,193,133,
- 4,195, 29, 62,223,226,225,249,103, 33,132, 52,184,217, 74, 78, 78, 86,213,199,108,121,123,123,247, 78, 79, 79,255,178,172,182,
- 10, 69, 81, 95, 54,109,218,116,201, 95, 47,170,149,222,245, 10, 89,150,157,144,158,158,126,161, 38,205,161, 67,135,122,157, 56,
-113,162, 89, 5,205,102, 0,154, 85,181,174,147,147, 19,219,189,123,247,164, 19, 39, 78,168,248, 59,164, 78,134,203,106,163, 21,
-155,114,112, 78, 71,163,186, 24, 0, 98, 45, 88,191, 82,145,159,129,102, 87,110, 95, 54,105,101, 80, 83, 23, 20,105, 77, 56,115,
- 45, 9, 44, 75,131,101,152,210,200, 22, 3,150,161, 49, 48,216, 13,221, 13, 51,240, 77, 88, 28, 24,150, 91, 81,147,230,227,152,
- 9,247, 74,135,254,227, 14,112, 28,145,202,196,130, 66,127, 31, 87,247,121,163,131, 5,115,134, 7, 65,111,102,198,237, 57,151,
-240,251,189, 44,108,181, 72,147,123,178,123, 34, 82,213, 50,150,169,245,216,107,136, 70,117,237, 31,210,203,129, 24, 11, 65,231,
- 36,162, 72, 71, 35, 49,151, 70,134,161, 0, 50, 74,109,145, 38, 71,208,190,177,183,167,226,143,253,239, 63,114, 21,106, 68,238,
- 66, 70, 34, 21, 48, 96, 57, 34, 36, 5, 49, 70,151,214, 3,196,101,245,182,106, 74,167,141,194,126, 82,239, 23,135, 58,166,236,
-153, 70,217,248, 15,132,123, 71, 31, 60,186,176, 29, 89,215,194,144,171, 74,162, 28, 12, 5,104,228,218, 2,131, 39,140,199, 87,
-227, 59,163, 72, 83, 4,161, 58,193, 81, 42,150, 57, 1,230, 42, 53, 9,139, 9,171, 87,125,238, 41, 18, 10, 74,206,103,217,196,
-210,208, 27,141, 0,203, 64, 46,226, 64,145,178,223,104,176,180, 89,209,126,212,251,179, 0,246, 74,109,199,126, 47, 11,123,219,
- 40,209, 11, 28,221,154,208,122, 80, 64,100, 76,246, 95,230, 39,208, 29,175, 60, 55,112, 74, 47, 66,225, 98, 93,174, 81, 91, 87,
-132,118,106,102,103,107,171,137, 69,218,161,183,145, 0, 57,105,212,227, 13,188, 50,117,182, 98,203,150, 45,195, 0, 50, 19,149,
-235,168,149,107,182,110, 36,156, 78,179, 88, 2, 0,122,154,108,183,151, 82, 83, 87,239,139,114,133,240,175, 17, 30,202, 34, 89,
- 9,185, 92,190,249,236, 71,113,207,207, 11, 11,105,119, 51, 36,149,162,100, 41,231, 31, 24, 11,173,185,151,172,132,215,228, 53,
-255,118, 77, 7, 7, 7,191,166, 77,155, 46,161,105,186,183, 68, 34,105,100, 54,155,193,113, 92,134, 84, 42,189,152,148,148,180,
- 92,163,209, 60,252,175, 29,251,237,219,183,173, 49, 91,181,106,138,197, 98,196,197,197, 61,176,194,108, 69, 60,182,253,174,200,
-200, 72, 28, 56,112, 0, 0, 16, 31, 31,143, 86,173, 90,217, 86,181,225,163, 71,143,108, 67, 66, 66,118, 1,240,169, 73,243,206,
-157, 59,126,191,252,242, 11, 14, 29, 58, 4, 0,136,139,139,131,191,191,127,149,137,137,140,140, 20,190,250,234,171,126, 0, 84,
-255,192, 53,122, 22, 76, 86,197,249, 95, 70, 43, 44, 44,140,132,134,134, 82,143,127,174,130, 68, 95,103,105, 71, 24, 88, 0, 72,
-180, 54, 5,247, 50,177,106,253,206,211,131,126, 59,180,161,183, 92, 34,192,210,173,243, 82,179,243,138,158, 23, 81, 37,197, 47,
- 12,129,192,217, 78, 26,181, 98,114,176,111,126,177, 1, 63,255,153,126, 33, 38,203,186, 16,105,140, 26,225, 0,231, 84,242,141,
-133, 65,159,229, 63,249,171,240,125,251, 22, 13,106, 63,119,120,123, 28,191,148, 52, 23, 96,106,237,245,157,112, 28, 8,199,148,
- 87,126, 47,125,117, 0,184,202, 3,248,114, 32, 37,203, 56,235, 34, 90,125, 0, 81,190, 59, 6,219, 43,164,223, 77,159,254,166,
- 3,157,125, 31,121, 38, 9, 82,243, 13,200,208,139, 81, 44,114, 71,122,236, 29, 86, 64, 33,188,214,144, 11, 5, 13, 97, 12, 78,
-206, 82, 59, 65,219, 1,179,188, 53,167, 62,200,151, 82,140,208, 97,228,103, 78, 57,191,173, 73, 98,180,217, 90,138, 66,173,221,
-207, 59, 58, 58,181, 50,228, 38, 9, 11,243,115,224,228, 17,132, 65,227, 66,241,201,208, 54, 40,210,104,145,157, 23, 69, 90,122,
- 58, 80,201, 23,119,227,195,193,129,200,205, 84,195, 72, 3,148,214,152,103, 48, 25,138,171, 61,143, 2,108,126,119,254,194, 87,
-154,120, 42,109,203, 26, 21, 16,142, 69,112, 96,115, 12,232,221, 21,225,145,127,224,234,157,120,112,165,141, 10, 8,199, 33, 45,
- 43, 63,211, 96,102,183, 91,117, 66, 89, 6,132, 54, 84,105,196, 80,135, 34,195,182,238, 80,176,192,199,157,253,236, 95, 95, 20,
-218,196,222, 86, 70,193, 64,179, 48,152,104, 20,253,241, 29, 92,155,182,131, 66, 46,167, 58, 66, 47,186,129,170,207,173,129,198,
-146,135,234, 2, 79, 20,103,224,213, 1, 65,239,236, 88,241,150, 45, 37, 47,185, 53,105,182,114, 36,235,143,101,157, 79,191,250,
-233,177,179, 7, 14,190,236,245,213,130, 73, 33, 3,223,219,126, 22,192, 41, 62,223,226,121, 26, 25, 51,102,140, 60, 51, 51,243,
-156,143,143, 79,155, 1, 3, 6, 40,122,245,234, 5,173, 86,139, 51,103,206, 64,171,213, 54,241,241,241,105,114,230,204,153, 81,
- 41, 41, 41, 49,141, 27, 55, 14, 57,116,232,144,197,117,104, 75, 13,144,176, 60, 11, 6, 24,138,162, 80,186,140, 42, 93, 86,231,
-113,110,165, 82, 41,146,147,147, 27, 60,178,149,158,158,254,160, 46,145,173,226,226, 98,137,183,183, 55,148, 74, 37, 88,150,133,
- 86,171,197,177, 99,199, 80, 88, 88, 8,142,227, 96, 99, 99,131,207, 86,111, 69,236,141,115,184,114,229, 10, 10, 11, 11, 37,181,
-105,166,165,165, 81,193,193,193, 48, 26,141, 96, 24, 6, 6,131, 1, 17, 17, 17,229,223, 69, 34, 17, 22,126,186, 22,241,215,206,
-225,230,205,155, 72, 75, 75,251, 71, 70, 27,177,194,139,252, 23,169,182,207,172,127,188,213, 33,203, 50,139,183,236,216, 23,181,
-120,198,120,204,126,185,191,207,242, 13, 71,250,223,203,193, 14, 0, 8,116,195,228,137,125, 91,250, 58, 41,196,248,100,207, 53,
-128,144,197,245,221, 95,116, 30,226,219, 52,226,230, 30,189,146,124,238,131,241, 29,209,220,211,161, 85,190, 52, 79,154,152,104,
-193,152,130, 28, 3,103, 59, 89,192,144, 96,215, 83,224, 56, 56,217,203, 90,131,101,224,100, 39, 11, 24, 20,228,240, 43, 0, 56,
- 40,196,173,171,138,124, 85, 71, 39, 31,241, 52,133, 76, 52,205,214,222,201,247,181, 97, 3,108,134, 12, 27,101, 99, 39,102,144,
-123,229, 12, 52,226,198,160, 93,154,192, 72,231, 33,237, 97, 2,251,219,229,123,233, 57, 69,198,121,181, 38,147,224, 66,250,195,
- 56,165, 95,251, 1,206, 57, 97, 31,102,249, 77,217,211, 76, 0, 78, 80,180,123,100,166,173,123, 23,155, 63, 19, 31, 22,115,164,
-202,136, 78, 37, 52,133,133, 73, 52, 11, 79, 61, 43,178, 79, 56,251, 19, 22, 13,110,135,252,188, 44, 24,204, 12, 10,245,140,217,
-195, 73, 46, 51, 62,188, 11,163,153,129,137,230, 32,118,242,198,153,168, 59, 57, 28, 77,255, 90,157,102, 98, 46,110, 38, 30,187,
-105, 87,113, 89,115, 55, 4,191,239, 96,115, 19,180, 30,201,105, 42,236, 56, 17,213, 49, 49, 23, 55,235,115,157, 9,199,148, 20,
- 63, 87,136,100, 81, 4,189,234, 82, 9,190,181, 59,186, 72,228,146,111,191,156,251,106,155,110,254, 46, 50, 46, 45, 10, 20,103,
-134, 45, 43,130, 94,202,194,209,167, 57, 56, 83, 17,209, 25, 12, 5,209, 64, 77, 23, 95, 8, 0,196,172,197, 87,147,130,108, 41,
-231,230, 96, 19, 79, 65,212, 97, 26,232,210,104,127, 66, 46,119,199,124,246,163,216,238,243,127,233,243,105,120,223,123,170, 19,
- 75,239,121,143,249, 46, 24,216,222,148,127, 92,243, 60,141, 4, 4, 4,120,164,167,167, 71,207,159, 63,223,101,228,200,145, 56,
-122,244, 40, 52, 26, 13,182,111,223,142,117,235,214, 97,217,178,101,160,105, 26, 91,182,108, 81, 28, 62,124,184,203,247,223,127,
-159,230,235,235, 27,148,146,146,146, 81,139,193,162, 0,200, 0,136, 75,159, 93, 20, 0,238,228,201,147, 24, 50,100, 8, 78,158,
- 60,201,149, 46, 99, 81,242,242, 83,167,177, 63,165, 82, 41,164, 82, 41, 10, 11, 11, 27,196,108,137,197, 98,216,217,217, 65, 42,
-149,162,168,168,200,106,179,197, 48,140, 48, 45, 45, 13,133,133,133, 24, 48,108, 24,214,174, 88,129,190,125,251, 98,192,128, 1,
- 32,132, 32, 34, 34, 2,253,123,180,197,248,151, 66,112,239,222, 61, 48, 12, 99, 81,122, 51, 50, 50,144,153,153,137, 65,195,134,
- 97,235,247,223,163,107,215,174, 8, 8, 8, 0,195, 48, 56,119,238, 28,198, 12,236, 1,249,136,254,136,143,143,231,111,106,203,
-163, 89, 13, 82, 71,171,222, 68,103,227, 50,119,252,124,216,203, 3,187,132, 14,235,217, 6, 91,247,255,246, 57,148,154,125, 0,
-224,106,148,125, 54,169,111,115,196,164,228,227,183,155,170,176,123, 57,104,144,214, 26, 28, 11, 55, 87, 7, 5, 32,148, 66,111,
-230, 24,135,196,218, 43, 48,115,132, 64,209,251,125, 76, 28, 22,227,211,181,141,143, 79, 89,171, 67,187, 33,107, 48,249,206, 3,
-223,206, 1, 30,190, 96,105,128,165,225, 48,126, 15,240,169,109,173,233,232,209, 76, 26,254,238,156, 57,221, 7,143, 24,103, 35,
- 85, 56,130,213,164,130,206,184,131,220,251, 23,160, 85,180, 66, 70,114, 34, 14,156,190, 82,120, 63, 45, 87, 35, 16,224, 76,102,
-161,113, 65, 98, 62,138,107,211, 53,208, 88,177,228,195,121, 67, 15,236,219,111, 47,107,222,147, 74,248,110, 72,161, 84,196,200,
-148,205,158, 19,232,228,110,228,139,237,251, 29,180, 38,172,172, 77, 71,167,213, 28,137, 56,115,106,124, 75,191,158,246,143,174,
-158,128,222, 96,132,145, 6,130,186,132,128,101,137,148, 18, 80,156,131, 80, 72,101,229,230,131,162,217,204,139,183, 30,169, 35,
-111, 37, 10,141,246, 88, 89, 99,239, 34,143,187,123, 74,248,206,176,144, 14, 0,173,199, 75,189,219, 97,237,238,223,222, 6,216,
- 41,245,187,200, 37, 17, 45, 2,244,108,163,196, 38, 66,208,243,218,177,117,173, 59,141,120, 23,214, 68,180,130,220, 48, 56,208,
-207,235,167,181,159,189,239,226,218,184,149,144,226,104, 16,143,246,128, 38,141, 80,105, 81,112,244,238, 10,214,171, 7,182,124,
-243,117, 49,199,145,125,168,161,107, 11,150, 3,184,148,243, 96, 99,143, 34, 49, 49, 17,110, 77,174, 1,148, 0,164,233, 35,152,
-153,146,205,140,102,114, 98,253,246, 95,250, 46,232,183, 34,104, 88,107,145,111,212,173,132,172,113, 83,189, 20,207,251, 10,253,
- 99,212,182,130, 28,173,150,227,243, 47,158,167, 9,131,193,112,100,213,170, 85, 46,161,161,161,101, 17, 25, 68, 69, 69, 97,219,
-182,109,176,181,173,156, 79, 14, 25, 50, 4,132, 16,151,165, 75,151, 30, 1,208,173, 58,205,238,221,187, 15,187,121,243,166,170,
- 67,135, 14,137,165,102, 75, 2, 64,112,247,238, 93, 65,106,106, 42,229,236,236, 76,188,188,188,104,149, 74,197, 1, 96,167, 78,
-157, 42, 60,120,240, 96, 75,173, 86,123,190,174, 70, 75, 42,149, 54, 72,157, 45,177, 88, 12,138,162, 32,149, 74, 33,145, 72, 64,
- 8,177,202,108,177, 44, 43, 58,121,242, 36,174, 93,187,134,101, 29, 58, 96,174,183, 55, 92, 92, 92,112,238,220, 57, 16, 66, 96,
-107,107,139,188,188, 60,236,219,183, 15,253,250,245, 3,195, 48, 18, 75,116, 15, 29, 58,132,235,215,175,227,211, 78,157, 48,215,
-209, 17,118,118,118,136,136, 40, 41, 13,148,201,100, 72, 78, 78, 70, 68, 68, 4, 66, 66, 66,248,155,186,158, 88,124,243,244, 1,
- 68,121, 20, 60,204, 38, 61, 8, 67, 0, 10, 94,129,129,144,220,187, 87,185,114,142, 37, 8, 4,248,240,155, 29, 97, 67,215,188,
- 59,140,154, 54,188,163,215,242,159,206,206, 4,128,215, 71,251,123, 43,100, 34,172, 63, 30, 67, 4, 2,124,216, 16, 7, 24, 24,
- 8, 9,149,139,153, 3,186, 6, 64, 85, 96, 66,130,170,224,247,123,128, 69,163, 56,255,182,102, 34,118,254,124, 46,117,221, 78,
- 67, 44, 33, 4, 78,118,178,128,201,183, 19,124,127, 58,121, 61,101,245, 1, 67, 44,225, 8,156, 20,226,214, 83,238,245,168,181,
-213, 97, 39, 31,241,180,247,230,205,235, 49,124,202,124, 57, 19,123, 16,166,132,211,224,204,122,104,204, 18, 20, 8, 61,144,150,
-146,130, 47,182,132,165,106,180,166,241,209,217,214, 25,204,251,185, 40, 22, 81,154,145, 95,124,242, 65,248,138,207,150,218,233,
- 19,207, 21, 11, 41, 70, 47,108,218, 71,244,217,178, 53, 84,145,209, 52, 46, 49, 31, 69,181,233, 24,237,177,114,213,234,111,134,
-190, 57, 97, 84,172,127,171, 62,174,172,234,161,171, 65,163,201,218,115,234,186, 71,233,155, 34, 5, 0, 9,105,185,200, 46,212,
- 50, 44, 67,159,183, 23, 99, 63,250, 14, 83, 0, 0, 32, 0, 73, 68, 65, 84,121,140, 37,209,193, 82,252,220,161, 12,237, 25,244,
-170,210, 94, 2,125,113, 1,220,237,197, 24,216,181,197,171,244,159,241,239, 63,204,178,198,174, 61,110,180,104, 16, 90,143,203,
- 43,251,181, 38, 44,221, 26, 44, 13,243,237, 93,214, 71,198, 40,204,157,221,219,206,193,217,244, 72, 0,173, 45, 96,227, 6,202,
-161, 9,224,216,140, 18, 7,142,131, 42, 49,154,121,251,213, 9,185, 15,147,210,126,112,179,169,185, 88,155,230, 8,184,164,115,
- 40,206, 76,192, 93,149, 25, 65, 89, 37,165,237, 14,153, 55,192,242, 61,230,240, 60,163, 36, 39, 39, 79, 90,188,120,113,100,215,
-174, 93, 27,185,185,185,161, 93,187,118,248,249,231,159, 49,127,254,252,242,117, 58,116,232, 0, 66, 8,242,242,242,176,106,213,
-170, 12,149, 74, 53,169,198, 23,244,232,232,216,157, 59,119,246,110,211,166,141, 89, 34,145, 20, 0,144, 21, 20, 20,200,243,242,
-242, 40,131,193, 0,142,227, 56, 71, 71, 71, 86,165, 82,209,227,199,143, 55, 94,186,116,169,133, 86,171, 77,174, 79, 68,203,199,
-199,231,110,110,110,110, 33, 69, 81,245,238,250,161,204,100,185,185,185, 41,139,139,139, 57, 0,249,117,233,250,129, 97, 24,116,
-234,212, 9,167, 47,220,192,201,223, 46, 65,163,138,195,204, 55, 39,161, 93,187,118, 56,125,250,116,157,175, 89,112,112, 48, 78,
- 69, 68, 34,242,218, 45, 36,199,223,198,219, 51,223, 68, 80, 80, 16, 78,157,226,107, 47, 88,193, 9, 84,174,155,117,226,113,163,
- 21, 18, 22, 22, 86,150,245, 63, 97, 95, 91,187, 33, 88,236, 36,221,181,116,112,139, 64,241,128,165,160,196, 54, 56,216,234, 84,
-143, 15,191,248, 46, 86,232,158, 60,225,110, 86,237,173,195, 42,253,105,178, 16, 77,174,196,238,189,117,175,245,171, 47,117,245,
-193,214,159, 21, 31, 3,192,184, 94,126,248,243,126, 54,174,196,103,237,141,201, 70,116,125,143,186,173, 59, 20,108, 14,246,174,
-122,103,120, 72,147,198, 30,216,118, 52, 18, 20,133, 35, 22, 61,112, 9, 33, 93,219, 52,193,186,157,143,183, 48,244,240, 93,125,
-192, 16,123, 38,186,104, 48, 0, 12,104,173,248,181,115, 11,103, 95, 82,177,226, 86, 21,216, 72, 69,211, 7,143,154, 40,103,226,
-127, 6,146, 34, 64, 49, 70,232,205, 28,212, 57, 69,208, 57,250,224, 92,212, 45,125,161,193,244,110, 76,118,221,162,120,247,114,
-144, 40,185,122, 43,165, 88,171,247, 84, 40, 91, 24,132, 2,142, 43, 54, 18,252, 25,147,164,137,201, 64,156, 37, 26,137,137, 48,
- 61,239,205,244,218,180,227,192, 18,177, 68, 58, 78, 72,129,114,119,178, 85,110, 90,243, 41,236,237,237,192,153,138, 1,109, 54,
- 70,190,245, 69,246, 93, 21,237, 7, 0,173, 92, 97,215,203, 79,188, 67, 36,160,210,206, 38,152, 63,170,109, 31, 20,141, 25, 19,
- 6,118, 16,115, 38, 45,222, 89,181, 31,155,223, 31,142,137, 47, 4,138, 79,252, 17, 63, 3,192,242,186, 94,107,194, 50, 32,180,
- 30,221, 62,184, 16, 75, 1,145, 4,232,121,237,192,103,173,129, 27, 22,107,116, 4,196,172,136, 10,108,239,107, 43,225,210,254,
- 0,151,246, 7, 17,250,244, 0,229,219,155,162, 60, 58,145,111,191, 92,166,221,186,117,219, 25, 78,128, 79, 44,232, 42, 3, 44,
- 7,228,196, 71,194,100, 50,129,102, 1,131,193, 0,173, 86, 11,219,132, 83,229,117,180, 36, 98,106,208,156,215,134, 5,147, 98,
-149,238,151, 88, 38,101,219,155,173,187,145, 98,149,238,114, 10, 27,159,163, 53,242,209, 44,158,167,145, 68,149, 74, 53,104,200,
-144, 33,191,157, 62,125,218,165,109,219,182, 0,128,107,215,174,149,188,116,118,234, 4,127,127,127,100,102,102,226,229,151, 95,
-206, 81,171,213,131, 80, 75,157,223,162,162,162,135,135, 14, 29,106,164,213,106, 59,124,244,209, 71, 89, 77,154, 52,209, 24, 12,
- 6,170,160,160,128, 99, 24, 6,206,206,206,210, 14, 29, 58,160,123,247,238,197, 81, 81, 81, 77, 83, 83, 83,139, 0, 36,213, 37,
-241,195,135, 15,199,133, 11, 37,141,246, 26,162, 95, 45,137, 68,130,182,109,219,122, 39, 38, 38,166,151, 62, 91,172,206,227, 43,
- 62, 94,110,221,186,133,243, 55,210, 32, 50,233, 33,205, 86,225,242,209, 67, 24, 54,125, 22, 24,166,238, 99,203,223,186,117, 11,
-199, 34, 46,195, 86, 38, 66, 92, 92, 52, 14, 29, 58,132,153, 51,103,214, 75,179,142,212,232, 69,254,227,168, 81, 77, 61, 45, 17,
- 0,132,134,134,158, 47,139, 86, 84,164,121,115, 72,101,197, 88, 58,160,163,247,194,113, 61, 91, 8,105,141, 10, 28,203, 65, 40,
- 6,220,221, 28,176,107,215, 94,191,189,251,247, 71,125,191,225,251,111, 56,134,249,240,110, 22,116, 86, 36,106,233,154,253,145,
-227,118,205, 11, 17,205, 28,220,218, 5, 0, 36, 34, 1,214,255, 28,205, 0, 88, 90,159,163,125,222, 27,242, 98, 26,211,220, 93,
- 29, 63, 94,252,198, 80,151,144, 78,254, 56,127,229, 46,190, 57, 20,117, 65,154,133,157, 22,223,220, 28,141,199,253, 83, 85,173,
- 14,193,213, 94,239,146,101,137,135,196,214, 25,230,164,179,128,217, 0,131,209,140,212, 92, 22,169,121, 6,136, 20, 18, 92,139,
- 79,211,187,102, 32,172, 30,135, 77,217, 42,228, 94, 75, 62, 95,221,216,160, 47,102, 52,249, 57,140, 68,122, 89,172,176,145,169,
-173,169,170,112, 57, 29,134,222,205,196,207, 1,156, 80, 42, 39,186, 15,222,123,205, 54, 61,230, 52, 90, 10, 84,160, 8,129, 77,
-224, 80,216,219, 8, 37, 61,155,138, 83, 0,192,214, 86, 33, 93,245,201,124,199,119,223,255,164,214, 58, 96,129,128,196,191,185,
-199,187,109,155, 56,227,194,245, 88, 92,184,147, 28,125,225, 90, 92, 80,223,118, 94,240,111,236, 52, 71,154, 95,176,242, 30,172,
-143,144,150, 92, 24, 6,160, 13,229,173, 14, 3,221,241, 74,231,113, 31, 85,215,218,176, 74,154, 1, 92, 60, 75, 64, 9,133, 0,
- 37, 40,105, 1,153,250, 7, 68, 78,205,201,222, 3,199,116,219,182,237,252,244, 94,142,229,141, 51,104, 22,172, 70,163,129,173,
-173, 45, 78,197, 51,198,137, 3, 37, 50,129, 64,128,212,248, 27,127, 85,134,119, 17,180,145,244,253,172,245, 31,203, 58,159,182,
-151, 82, 50,175,161,159, 4, 50,119,118,166,213,245, 33,193,195,243, 95,160,176,176,240,246,189,123,247, 6,182,111,223,126,251,
- 59,239,188, 99, 63, 97,194, 4,175, 55,223,124, 83, 0, 0,153,153,153,220,186,117,235, 84,223,126,251,109, 97, 78, 78,206, 20,
-154,166, 45,233,202,132,168,213,234, 75, 63,252,240, 67,246,197,139, 23,131,186,116,233, 34,123,238,185,231, 56,103,103,103,145,
- 76, 38, 99, 77, 38,147, 33, 62, 62,158, 77, 76, 76,244, 44, 40, 40,120, 0, 32, 1,117, 24,177,162, 52,122,181, 92, 40, 20, 46,
- 33,132,180,109,136, 58, 90, 10,133,194, 11,192, 3,138,162, 90, 90, 91,108,248,196, 3, 91, 36, 66,126,126, 62,116, 25,209,144,
-167,221, 71,123, 91, 1,218, 56,219,193,193,193,161, 94,166,168,176,176, 16,208,166, 35, 50,242, 22,192, 48,112,116,116,132,163,
-163,227, 63,110,180,170,243, 34, 79, 9,211,170, 88, 86,115, 29,173, 54, 74,204,180, 49, 97,221,244,161, 45, 36,205,124, 27,195,
-152,118, 13,183, 82,139,241,225,243, 93, 98,132, 50,123,195,244, 73,195, 59,141, 26,211, 20, 33,221, 59, 83,205, 60, 29,231,172,
- 92,179,241,173, 54,200,153, 31,147,133,245,150,164, 40, 38, 27, 15, 57,100,109, 59,123, 59,109, 70, 99,133, 30, 28, 71,112,246,
-142, 26,119,146,242,183,197,102,227,161, 53, 71,215,198, 19,253, 69, 16,236, 39,132,200, 29,109,109,139,218,248, 55,118,235,223,
- 45, 88, 48,168, 79, 39, 72,132, 64,228,159,183, 48,119,205,145,203, 28, 71,134,222,176,176,216,176,164,133, 97,101, 3, 85,210,
-194,144,174,212,194,144, 16, 66, 74, 90, 29,214, 28,124, 16, 10,169, 12, 93,242, 85, 15,177,107, 43,232, 19,206, 34, 41,159, 67,
-114, 86, 17, 52, 34, 15, 24,211,211, 1,194,165,156,175,185, 98,117,141,184,185,185,185,251,181,241,111,241,221,142, 67, 48,235,
- 10,241,240,220,118, 20,231,171,241,217,166,159, 91,120,123,187,246, 73, 79, 79, 63,111, 69,102,227,255, 91,216, 94,119, 16, 64,
- 40,150,225,196,247, 7,144,227,106, 3, 55,133, 4,156, 62, 27,211,223,157,224, 56,120,192, 4, 71, 0, 72,142,187,137, 38, 10,
-189, 69,186,102, 87,140, 26,215, 55,192, 9,180, 30, 59, 78,221, 52, 8,128, 65, 59,207, 68, 39,244,109,237, 36, 31,215,179,137,
-243,114, 85,193,104,228,214,173, 83,209,178,136, 86,121,132,175, 14,173, 13, 15, 1,108,107, 14, 9,251, 47,101,217,142, 25,240,
-156, 66, 34,162, 40, 82,156, 14, 98,227,134,141, 59, 14, 22, 75,105,235, 70, 98,231,128,229, 93, 87, 60, 92, 82,114,159, 96,251,
-224, 21,215,222, 8,255,248,121,101, 70, 70, 6,204,165,101,135, 15,243,184,223, 39, 13,104,195,166, 21,114,166, 51, 43, 71,142,
-161,108,148,210, 5, 95,237, 60, 71, 0,190, 55,105,158,167, 26,189, 94,127, 93,175,215,183, 91,176, 96,193, 43, 31,124,240, 65,
-111, 91, 91, 91, 63, 0,208,106,181, 15,105,154,190, 80,250,255,180,166,117, 32, 1,240, 32, 33, 33,225, 97, 66, 66, 66,163,221,
-187,119, 59, 1,144,151,254,102, 0, 80, 0, 32, 19,245,104,113, 88,102,170, 40,138, 90,210, 80,231,161,204, 84, 81, 20,213,178,
- 46,219, 11, 4, 2,150,162, 40, 80, 20, 5,153, 76,134,139, 23, 47, 98,236,208, 1,184,119,162, 0,109,157,236,208,101,202,116,
-236, 15, 15,135, 80, 40, 4, 69, 81, 16, 10,133, 86, 61, 71, 68, 34, 17, 34, 35, 35, 49,241,229, 49,144,137, 0, 71, 71, 71, 44,
- 88,176, 0,199,143, 31,135, 72,196,143,210,103, 5, 91, 42, 24, 46, 11,251,209,162,176, 60,124,251, 23, 18,176, 52,126,217,254,
- 53,194,238, 22,155,226,178,241, 97, 64, 54,214, 29, 66, 17,151,189,102,231,140,240,200,187, 95, 77, 29, 31,170,232,215,119, 0,
-250,133,244, 21, 5,117,238,243, 49, 80,201,104,245, 71, 13,125,109,176, 28, 62,221,114, 42,118,250,254,115,241, 20,204, 69, 24,
-255, 98,103,194,114,248,180,150,131,121, 66,211,209,198,110,127,100, 84,148, 51,204,197, 72,186,249,187,188,169, 95, 11,128, 53,
-227,193,131,251,248,118,199, 81,238,220,159,113,187, 76, 12,222, 73,204,135,214, 82,205,146, 39, 37, 3, 71, 91,105,192,160, 32,
-135, 95, 57, 16, 56, 41, 36,173, 9,199,194, 73, 33,110, 61,160,181,226, 87, 66, 8,177,183, 17,183, 38, 44, 93,171,166,222,196,
-108,222,241,227,182,213,175,191,254,186,109, 78, 90, 6, 84,154,187, 40,150,122,131, 86,248, 32,225,230, 5,189,206,200, 88,242,
- 16,175,246,124,230,228,228,100, 93,191,146,135,253,155, 86,128, 54, 25,145,149, 86,226, 85, 85, 57, 26, 56,184,121, 71,165,167,
-167, 91,172,105,102,184,194, 81, 19,166, 73,108,236, 97, 51,113, 84,168, 52, 33,215,136,142, 94,246, 37,153, 70,113, 54,238, 69,
- 68, 34,164,180,142,105, 98,170, 0, 77,130,189, 44, 74,167,189, 92,242,206,224,231,188,241, 48, 69,141,139,209,233, 59, 30,230,
- 65,197,198,170,119, 36,168, 10,102, 12,127,222, 23,107,143,199,188, 13,208,123,173, 57,246, 64,119,188, 66, 8,122,150, 84,134,
-215,131, 0, 61, 3,221,241,138,133, 45, 13,159,208, 20, 73,240,234,234, 95,147, 63, 58,120, 53,103,248,194, 87,123, 57,116,239,
- 62, 68, 10,198,132, 34,189,145,190, 87, 0,141, 53,154, 26, 61,183, 25,192,230,178, 31,174,167,113,187,122, 45,141,186,176,247,
- 77, 31,101,153, 87,191,144, 96,140, 2, 16, 53,181,171,205,199,146,190,159, 5, 68, 45,239,122,250,142,154,219,125, 33,161,188,
- 15,173, 90,255, 71,117,132,215,228, 53,255, 9, 77, 22,192, 46,154,166,119, 21, 20, 20, 52,164,166, 10, 79,246,235, 84,175, 99,
-175, 88, 76, 72, 8, 17,149, 70,179,106,171, 12, 95,163,102,197, 98, 66, 66,200,201,210,104, 86,109, 81,173, 74,154, 28,199,169,
- 58,117,234,228, 50,108,216, 48,176, 44,139,251,247,239, 35, 57, 53, 21,253,103,188, 13, 39, 39, 39, 92,184,125, 27,113,113,113,
- 88,178,100, 9,104,154,198,177, 99,199,210,106,211, 20,137, 68,230, 22, 45, 90, 72, 70,140, 24, 1,134, 97,144,152,152,136,244,
-244,116,204,157, 59, 23,142,142,142,184,126,253,122,185,102, 78, 78, 14, 68, 34,145,185,138,232,214,223,113, 47, 61,237, 60, 97,
-178,106, 54, 90, 0, 11,150, 70, 97,248, 82,172,191, 8,179,153, 70,235,152,108, 60,138,249, 43, 34,181, 81,120,229,246, 47,183,
-239,198, 62,188,254, 71, 63, 41,178,238,192,218, 55,137,251,185, 80,219,203,139,138, 96, 46,114, 64,226,175,120,148, 89, 84,124,
- 63, 23,106,171,223, 24, 56,150,130, 89, 7,168,175,225,210,133,243, 56,119,249, 22,174,222,137,101, 47, 93,143,223, 47,224,240,
-233,189, 92,220,175,195, 91, 8,236,134,174,197,107,119, 30,248,118,246,111,228, 11,150, 1,225,104, 56,142,223,139, 41, 49,221,
-125, 59, 55,119,242, 45,137,100,209,112,126,227,119, 96,181,188, 70,189,107,169,244, 22,233,241,211,163,139, 10,114,159,127,161,
- 79, 55, 91,199,192,193,200,121, 16,143,251,183, 34,245,215,239, 38, 92,186,150, 74,111,169,207,213,245,246,246,238,253, 66,159,
- 0,140,159,190, 24,102, 93, 33, 18,207,253,136,226,188, 12, 92,140,178, 67,172, 70,211, 13,128,197, 17,173,168, 20, 38, 8, 41,
-249,232,209, 84,156, 98, 15,163,199,164,208, 97,144, 81, 6,112, 70, 13, 40, 93, 14, 18,210, 77,133,163, 55,165,178, 0,160,144,
- 81, 34, 91, 82,232, 96, 81,228,177,137,107, 43,133,144,198,206,240,104,112, 92,201,240, 77, 28,135,141, 59,127, 79,152,241,233,
-196,142,104,227,235, 28,124, 51, 61,139,130, 21, 33,127,138,160,215,213,253,159,180, 54,252,246, 49,192,153, 17, 57,199,165,117,
-175,245,121,189, 80,199,225,118,238,170,144, 14, 96, 6, 68,186,205,115,214,159,250,184, 83,120, 76,207,121,111, 12,119, 0,105,
-144, 22,186,241, 49, 25,108,239,174, 43,147, 79,115,164,114,121,110, 73,100, 43,144,168, 52,228,230,133, 4, 35,223, 43, 60, 15,
- 15, 15, 0,160,184,184,120,250,148, 41, 83, 54,139,197, 98, 37, 0,138,227, 56,112, 28, 39,250,234,171,175,196, 44,203, 10, 4,
- 2, 1, 43, 20, 10,153,147, 39, 79,210, 44,203,102, 27, 12,134,233,181,105, 50, 12,147, 48,107,214,172, 22,181,181, 80,220,183,
-111, 95,153,201, 74,224,175,132, 69, 38,171,226,188, 60,202, 37,170, 33, 72,251, 73,143,137, 75,151, 2,160, 64,176, 44, 38, 27,
-143, 30, 95,229, 78, 30, 84,109,132,230,185, 65,157,251, 44, 45,219,198,218,148, 25, 88,118, 76,231,118,254,251, 0,192, 72,216,
-137,117, 57, 58,141, 81, 63,174, 67,231,110,251, 57, 66, 68, 12, 33,219, 4, 28, 14, 27, 24,220,179,164,165, 93,117,168,178, 10,
-174, 15,110,235, 72,128,146, 34,195,242,226,194,210,110, 28, 8, 33,164,188,184,240,107, 57,114, 10,141,181,246, 3,245,199, 35,
-211, 0, 19,115,117,218,153, 63,110, 78,103, 89,226, 33, 20, 82, 25,122, 19,179,185,190, 38, 11, 0,210,211,211,207, 71,132,167,
-159,185, 29,220,232, 69, 55, 69,105,148, 75, 7,228,232,112, 38, 61,187,248,124, 93, 52,243,181,244,240, 15,214, 29,255, 89, 42,
- 22,138, 64, 72, 73,135,162,132,192, 96,102,243,162, 82,152, 32, 0,104,231, 2,175, 5,199,152,125, 66, 33,149, 92,155,222,149,
- 56,245,218,241, 43, 35,230, 71, 39,229,111, 75, 42,192, 93, 0, 72, 42,192,221, 3,145,143, 62, 78,200, 40,154,127, 55, 57,255,
-107, 88, 89,175,130, 80,184,216,121,252,210, 39,150,213,247,124,198,170,113, 11,192, 72, 32,109,192,248,121,223,206,163, 40, 52,
-212,240, 19,241,122, 51,105,242,248,194,178,200, 22,159, 87,241,240,252, 55, 40,139,106, 9, 4,130,229, 13,168,121,146,162,168,
- 33, 0, 30, 88,177,217,149,226,226,226,118, 13,124,120,185, 12,195,228, 90,178,226,191, 80, 33,254,105,101,203,191,181,227,254,
-188,230, 63,175,217,178,101, 75, 98,133, 97,225,207, 39,175,201,107,242,154,255, 87,154,132, 16, 97,125,166,106, 52,169,250, 76,
-252, 53,122,234,153, 86,221,119,190,166,219, 51,200,131, 7, 15, 40,254, 44,240,240,240,240, 84, 13, 69, 81,236,223,160,201,247,
-142,199, 83,102,176, 42, 69,183, 4,252, 57,225,225,225,225,225,225,225,225,105, 16,147, 85,113, 94, 98,194, 81,125,248,207,154,
-214, 4,117, 9, 33, 70,240,154,188, 38,175,201,107,242,154,188, 38,175,249,127,167, 89,155, 54,223,154,241,111, 54, 96,188, 38,
-175,201,107,242,154,188, 38,175,201,107,254,255,105, 62,205, 84, 91, 71,139, 47, 58,228,225,225,225,225,225,225,225,249,155,224,
- 43,195,243,240,240,240,240,240,240,240,212,143, 90, 7,149,230,225,225,225,225,225,225,225,225,169, 27, 53, 15, 42,205,195,195,
-195,195,195,195,195,195, 83,103,172, 31, 84,154,135,135,135,135,135,135,135,135,199, 34,182,240,167,128,135,135,135,135,135,135,
-135,231,159,161,114,171,195,176,176, 48, 82,113,206,195,195,195,195,195,195,195,243, 79,242,172,122, 17,190,232,144,135,135,135,
-135,135,135,135,167,126, 76,227,141, 22, 15, 15, 15, 15, 15, 15, 15,207,223, 67,181,117,180,202, 58, 44, 13, 41, 13,213,133,240,
-231,138,135,135,135,135,135,135,231, 95,224,217,246, 34,124,253, 44, 30, 30, 30, 30, 30, 30, 30,222,139,240,240,240,240,240,240,
-240,240,240,252,151,224,199, 58,228,225,225,225,225,225,225,225,249,135, 13,215,223,110,180,248,145,205,121, 77, 94,147,215,228,
- 53,121, 77, 94,147,215,252,127, 50, 89,149,204, 22,223,234,144,135,135,135,135,135,135,135,167,126,212,218,234,144,135,135,135,
-135,135,135,135,135,167,110, 76, 3, 16, 90,250, 57, 20, 21,162, 90,124, 68,139,135,135,135,135,135,135,135,167,126,108, 1,224,
- 89,106,176, 78, 0, 80,243, 70,139,135,135,135,135,135,135,135,167, 97,168, 88, 47,107,104, 5,243,197, 27, 45, 30, 30, 30, 30,
- 30, 30, 30,158,122, 82,109, 29, 45, 10,213,183, 28,136,176, 98, 7,117,105,125, 16,193,107,242,154,188, 38,175,201,107,242,154,
-188,230,255,157,102,109,218, 17,120,250,152,102,141,249,106, 72,248,166,175,188, 38,175,201,107,242,154,188, 38,175,201,107,254,
-223,210,224,173, 14, 59, 2, 54,252,105,125, 38,105, 84, 58,241,240,240,240,240,240,240,212,204,223,211,234, 48, 16,120, 99, 66,
- 91,229, 38,250,110,182,195, 93, 64, 87,211,186, 74,165,114,179, 66,161,152,160,211,233,180, 20, 69,113,101,203, 9, 33, 0, 80,
-113,172,163,196,236,236,236, 94,181,237, 91, 42,149,174,107,212,168,209, 27,197,197,197, 58,138,162, 8, 69, 81,160, 40, 10, 0,
-158,152,179, 44,155,150,155,155,219,233,169,190,132,132, 8,221, 26, 53,250, 83, 44, 20,122, 91,187, 41,203,113,143,178, 50, 51,
-187, 89,177,201, 10,138,194,194,146,221,226, 75, 0,139,159,181,127, 4, 1,132,150,172,215, 22,176,143, 7,198,179, 2,193,219,
- 98, 96,131,145,227, 54, 1, 0, 5,176,117,221,183,241, 10, 90, 80, 4,193, 20, 5, 71, 66, 80, 72, 40,220,146,117, 69,194,191,
-116, 42, 70,137,197,226,225, 14, 14, 14,118,185,185,185,231, 1,236, 3,240,178,171,171,107, 31,141, 70, 83, 76,211,244,113, 0,
- 71,234, 34,220, 43, 24,239, 75, 37,226,169, 6, 51,189,234,143, 91,248,177, 79, 71,184, 50, 28, 86,202, 37,162, 94, 70, 19,243,
-101,228,109,108,179, 82,146, 42,157,202,242, 12,171,199, 72, 59,104,225,117, 7,128, 99,206,206,254, 50,165,195,111, 98,169,240,
- 81, 65,102,241,132, 49, 89, 89,169, 99,235,113,221,255,139,184,185,185,189, 38, 16, 8, 62, 39,132,128,101,217, 15,243,242,242,
-182, 55,144,244,135, 0,156, 74, 63, 23, 0,248,188,158,122,201, 0,124, 75, 63,167, 0,104,194, 63,215,235,204,198,163, 71,143,
-206,232,219,183, 47,214,174, 93,139,141, 27, 55, 38,101,103,103,175, 4,176, 3,128,233, 95,208,225,169,142, 54,192,144,175, 6,
-118,101,233,159, 62,229, 42, 44,238, 95,205,159,249,135, 73,147, 38,153, 9, 33, 36, 46, 46,142,152, 76, 38, 66,211, 52, 97, 24,
-134, 48, 12, 67,104,154, 46,159,188,189,189,211, 31,219,252, 9, 77,129, 64,176,126,244,232,209, 69,132, 16,114,237,218, 53,162,
-215,235,137,209,104, 36, 38,147,137, 24, 12, 6,162,215,235, 43, 77,141, 26, 53,202,172, 73,211,193,193,225,154,179,179,115,166,
-179,179,115,166,139,139, 75,166,139,139, 75,166,171,171,107,249,228,230,230, 86, 62, 41,149,202, 76,165, 82,153,233,226,226,114,
-173,182,116,150, 50, 16,192,121, 11,166,129, 85,108,219,191,162,209,242,244,244,204, 36,117,160,113,227,198,169, 22,164,179,140,
- 70, 20, 5,182,108, 91,138, 2, 39,147,201,124, 43,254,142, 39, 35, 93,181,134,148,189,188,188, 70,123,122,122, 70,120,122,122,
-134,123,121,121,141,182,224, 22,171,164,105,111,111,127,205,205,205, 45,211,195,195, 35,171,108,242,244,244,172, 52,121,121,121,
-149, 79,141, 26, 53,202,116,118,118,174,246, 26, 17, 64, 88,221,116, 14, 16,201,128,126, 34,161, 48,172, 81,163, 70,154, 59,119,
-238,176,132, 16, 34, 16, 8,210,203,214,177,230,216, 31, 55, 89,186, 72,124,152,115, 86,118,165,248,209,202,194,156,179,178, 43,
-186, 72,124,104,188,130, 22,117,213,180,144,170, 52, 39, 79,158, 60,249, 86,102,102,102,122, 65, 65,129,122,211,166, 77,241,114,
-185, 60,114,211,166, 77,241, 5, 5, 5,234,204,204,204,244,201,147, 39,223, 2, 48,203, 10, 77, 0, 64,183, 96, 60,255,250, 40,
- 79,221,173, 99, 19,117,253, 58,139,110,246,104,139,208, 1,221, 36,233,223, 45, 10,212, 93,216,218, 83,215,247, 57,193, 93, 43,
- 53, 41,145, 72,212,221,215,215,119,170, 82,169,156, 84, 58, 77, 44,155, 60, 60, 60, 38,122,120,120, 76,116,118,118, 30, 91,147,
-230, 65, 64,104,201,228, 35,151,119, 31,235,231,171, 75, 94,190,140,220,121,247,109, 50,181,185,143,102,140,187,123,211,127,225,
- 26,253,173,154,238,238,238, 42,154,166,137,217,108, 38,174,174,174,170, 6, 76,231,215,132,144,175, 9, 33, 95, 3,248,186, 1,
- 52,203,243, 51, 43, 12,118, 77,154,114,145, 64, 48, 79, 33,149,134,203, 68,162, 44,153, 72,148,165,144, 74,195, 69, 2,193,124,
- 0,242,255,210, 53,250, 27, 52,237,148, 74,229,195,117,235,214, 17,157, 78, 71,116, 58, 29, 89,183,110, 29, 81, 42,149, 15, 1,
-216, 89,161, 89, 87,157,103, 41,130,245,248,212,112, 17,173, 64,160, 83,191,224,150,135,231,188, 54, 30,220,161,117, 84, 45,111,
- 76, 63,116,235,212,105,234,142, 29, 59, 0, 0, 19,134, 15,199,139, 93,186,192,222,206, 22, 82,105, 73,114, 40, 66, 65, 34,150,
- 96,196,220,247, 44,217,253,151, 35, 70,140,120,245,208,161, 67,118, 0,176,113,227, 70,140, 26, 53, 10, 46, 46, 46, 80, 40, 20,
-144, 72, 36, 16,139,197,149,230,181, 33, 20, 10, 27,167,167,167,187,203,229,242,242, 40, 27,199,113,149, 38, 66, 72, 89,244, 13,
- 12,195,160, 85,171, 86,150,158,174, 69,133,133,133,189,181, 90,109,185, 70, 85,147,159,159, 31, 0,156,182, 68,240,243,207, 62,
- 5,199,104, 33, 18, 1, 12, 3, 24,205, 2,112,164, 74,115,131, 89,179,102,149,167,187, 46, 12, 29, 26, 74, 81, 20,117,232,250,
-245,235,135,179,178,178,154,113, 28,251,102, 29, 35, 93,111,221,191,127,223, 14, 0,252,253,253,103, 1, 56,108, 77, 58, 68, 34,
- 81,227,219,183,111,187,203,100,178,106, 35,151, 21, 34,152, 48,155,205,232,216,177, 35, 99,205, 62, 26, 1,190,121, 2,193,155,
- 29,158,123,110,218,210, 17, 35,228,127,254,249,167, 92, 32, 16,128, 97, 24,124,245,213, 87, 12, 33,196,169, 13,224, 16, 3,104,
-106,144,249, 0,192,107,165, 15,131,109, 0,190,170,228, 22, 8,130,245,180, 44, 52,177,120, 68,151,174, 77,223, 71, 76,244,157,
- 46,205,237,142,193, 94,100, 76, 0,254,217,168,150,131,131,195,240,181,107,215, 42,183,109,219,166,137,139,139, 51,111,218,180,
- 73, 57,125,250,116,123,179,217,140, 25, 51,102,100, 7, 4, 4, 72,214,174, 93,171, 60,114,228, 72, 63,173, 86,251,189, 85,215,
-139,194,167, 47, 15,127, 17, 6, 90, 0,154,102,148,158, 74,251, 93,115, 38,135,136, 9, 49, 97,231,241,235,160, 25,238, 71, 43,
- 35, 89,221,198,140, 25,211,124,239,222,189,162,216,216, 88, 81,235,214,173,193,113, 28, 88,150, 5, 77,211, 0, 0,142,227,208,
-178,101,203,122,159,151,169,128,191, 91, 35,151,240,110, 67, 6,219,120,202,101,112,201,207,198,235, 18,145,253,118,133,113, 55,
-128,238,207, 84,100,151, 16,136, 68, 34,164,166,166,194,221,221,221,134,227, 56, 53,128,101,249,249,249, 91,240,236,210, 69, 42,
- 18, 29,222,249,227,122,143,174,221,187, 11, 27,121,186, 35,254,126, 10, 68, 20,219,255,246,213,235, 33, 83,103,206,155, 99, 98,
-152,209, 0,254,124,214, 14,220,163,251,172,145,148, 64,184,145, 34, 28, 62,249,238,231,162, 21, 95,174, 83,204,120,115,178,112,
-238,220,185,240,241,241,105, 54,114,228,200, 47, 1,204,172, 85,167,235,172,145, 16, 10, 54,130, 16, 44,253,246,231,162, 47,190,
- 92,167,152, 89, 7,157,167,156,106,255, 35,245, 54, 90,129, 64,243, 32, 31,247, 51, 43, 22,206, 20,147, 95,127, 18,232,114,179,
-170, 93, 87,169, 84,110, 30, 52,104,208,132,237,219,255,138, 70,119,107,219, 22, 35,251,245,132,187,171, 35, 20,182,210,146,199,
- 17, 71,225, 86,220, 35,139, 12,129,143,143,207,140,195,135, 15,219, 85, 52, 19, 18,137,164,124,170,104,178,202,166,178, 7,112,
- 77,200,229,114, 68, 68, 68, 64, 36, 18, 65, 40, 20, 66, 36, 18,149, 79, 21,191, 11,133, 66, 52,106,100, 85,213,165,149,142,142,
-142,237,139,138,138, 28, 10, 10, 10,224,235,235,171, 1,112,187,194,239,237,179,179,179, 29,172, 17,228, 24, 45,230,190, 30, 8,
-177,233, 50, 76,226, 46,208,139,122,224,210,213,123, 8, 59,125, 30,233,170, 12,244,124,190, 3, 38,189, 50, 6,225,225,225, 96,
- 89,171, 75, 58, 50, 9,193,151,195,134,133,190, 15, 80, 84,255,254,253, 11,102,207,158, 45,136,141,141,125,117,228,200, 17,109,
-239,223,127, 80, 26, 85,164, 22, 18,130,245, 0, 50, 45,212,149, 2,192,133, 11, 23, 0, 64, 86,151,123, 79, 38,147, 33, 42, 42,
- 10,101,197,196, 2,129, 0, 2,129, 0, 66,161, 16,191, 60,112,131,214, 36,128, 46,243, 46,222, 14,245,133,159,159, 31, 4,130,
-218,171, 36,134, 0,242, 75,192, 72, 74, 44,158,235,233,229,213,172, 79,243,230,138,136,136, 8, 33, 0, 52,105,210,132,168,213,
-234,130,227,199,143, 23,137,128,141, 77, 8,217, 81,147,201,242,241,241,233,145,158,158,254,121,217, 57,167, 40,234,203,166, 77,
-155, 46, 41,191,110, 28,135,101, 63,106,197,115,230,188, 43,233, 26,242, 17, 0,160,235,176,189,208, 36,174, 8,164,242, 62,112,
-252,167,115, 9,141, 70,179,191,101,203,150,194,220,220,220, 75, 0,146,105,154, 94,180,107,215, 46,247,215, 95,127, 61,107,247,
-238,221, 43, 1,120,173, 90,181, 42, 68,171,213, 30,176, 70,183,103,123, 12,121,174,125,219,231,125,125,124,112,254,210,159,144,
- 72,197, 78,179, 94, 11,133,157,157, 8, 95,111, 59,193, 37,167,229,205,142,188,141, 29, 86,152,172, 46, 99,198,140,105,182,119,
-239, 94, 41, 0,220,190,125, 27, 25, 25, 25, 80, 42,149,176,177,177,129, 88, 44,134, 80, 40,132, 88, 44,110, 16,147,229,232,227,
-122,229,216,177,227, 54, 46, 46, 78,248,238,189, 57,152,148,149, 9, 39,123, 59,208,197,218,102,207,216,131,194,191, 87,175, 94,
-114,150,101,161,213,106,113,238,220, 57, 71, 27, 27, 27,199,198,141, 27, 47,133, 21,173,167,228,114,121,166,193, 96,112, 47,253,
-156,101, 48, 24, 26, 1,208,200,100,178,178,124,186,184,116,110,105,113, 98, 50,158, 44, 38, 76,161, 40,170,226,178,186,210,185,
- 75,231,246, 17, 71, 14,237,177, 43, 44,202,128,147,115, 22, 4, 40,196,150, 45, 27, 96, 99,227,128,165, 75, 63, 16, 61,234,223,
-207,123,224,144,209, 17,209,247,226,251, 63,115,102,139, 80, 91,250, 15,155,224, 98,163,176, 47,125,150,208,216,190,117, 14, 4,
- 2, 1,150, 44, 89,130,160,160,160,105,209,209,209, 31, 1,200,171, 89, 6, 91,218,245, 30,231, 34,149,151, 92, 98,142,165,177,
-105,223,252, 18,157,197,211,241,242, 48,191,105, 11,198, 60, 60, 21,212, 28, 69,165, 47,230,122,177, 0, 41, 84, 87,148, 27,134,
-176,176,176, 62,161,161,161,231,171,251,254, 20,224,137,191,250,207,170,100,190, 68, 97, 97, 97, 36, 52, 52,148,170,112,112,149,
-190,215, 68, 48,224,230,236,168,136,216,184,108,142,157,232,242, 9,161, 62,229, 1, 84,134, 74, 15,242, 74, 77, 52, 21, 10,197,
-132,237,219,183, 87, 10, 41,249, 54,114,135, 68, 34,134, 88, 66,193,169, 87, 73,239,245, 5, 23,195, 64, 81,213,154,172, 74,154,
- 90,173,214,112,243,230, 77,187,109,219,182,193,221,221, 29,205,154, 53,131, 66,161,128, 92, 46,175,100,174, 42, 26,174, 42,140,
- 86, 37,205,178,223, 69, 34, 17, 4, 2, 1,194,195,195,193, 48, 12,198,140, 25,243,132,201, 18,137, 68,213, 25,183,234,154,167,
-158, 6,112,155, 16,210,187,244, 1,124, 27, 64,159, 10,191, 15, 84, 42,149,139, 0,172,180, 84, 83, 40, 36, 16, 26, 46,129,107,
-188, 14,162,212, 57, 48,137,131,113, 54,242, 58,182,111, 94, 11, 0,104,214,186, 51,198,142, 12, 45,143,198, 89,152,206,114,188,
-189,189,247,101,103,231, 12,238,215,175, 31,242,243,243,233,101,203,150,161,125,251,246,240,247,247,183,232, 26, 85,243,230,156,
-121,251,246,109, 31,189, 94, 15, 66,136, 37,230,236, 9, 77,138,162,176,107,215, 46, 24, 12,134, 39, 86,118,238,243, 5,230,143,
-106,130, 41,111,239,192,151,113, 7,240,253,247,223,215,120,236, 10,160,189,193,177,229,122,169,144,105,191,242,131,183,100,147,
- 38, 77, 18, 78,153, 50, 5, 41, 41, 41,120,253,245,215, 13,225,225,225,166, 12,181,250,184,148,227,190, 51, 87, 54,198,213,106,
-202,100,178,157,167, 79,159,198,129, 3, 37,190, 36, 62, 62, 30,173, 90,181,178,173,100,146,243, 14,162, 40,249, 59, 92,249, 37,
- 22, 93,135,237,197,149, 95, 94, 1, 91,112, 66,220,169, 21, 10,173, 57,159,117,160, 42,205, 3,185,185,185,229, 38,106,247,238,
-221, 54,187,119,239, 30, 1,224,103, 0, 7, 0, 32, 47, 47,111,141,149,154, 0,133, 41,227, 70,141,128, 72, 98,143,216, 7,105,
-232,211,173, 35, 26,185,187,227,246,189, 4, 36,167,231,101, 82, 20, 94, 27,216, 93,186, 82,175, 55,125,116,241, 22,126,168, 69,
-147,106,220,184,177,255,193,131, 7, 37, 21, 34,208,229,255,113,161, 80, 88,254,189,204,120,215,229,254, 44, 51, 89,246,141,237,
-174,124,186,161,135,237,149, 59,187,209,170,201, 16, 56, 15, 9,197, 15,103,206,224,126,116,140,193,164, 99, 94,248, 23,174,209,
-223,165,233, 63,106,212,168, 75,123,246,236,113, 74, 77, 77,197,133, 11, 23,208,172, 89, 51,232,116, 58, 75, 94,120, 43,105, 26,
- 12, 6,247,178,109, 40,138,114, 47, 11,188,155, 76,166,178,139, 81,246, 71,116,170,176,158, 83, 13,154,190, 21,214, 43, 51, 87,
- 77, 26,224,216,165,114,137,228,224,177, 35,251,236, 98, 98, 47,160, 67,240,243,176,115,108, 3,142,205, 64,110, 94, 49,242, 31,
-168,240,217,103, 95, 98,233,178, 15,241,243,209, 67,118, 1,129,193,135, 77, 12,211, 18,128,225,153,185,238, 20,153, 22,241,203,
-238,141, 20,225,160,207,140,149,137,181, 15, 21, 19, 94, 25, 45, 28, 63,126, 60,126,254,249,103, 68, 71, 71,111,172,193,100, 69,
- 84,136,204, 79,187,123,225,192, 70, 16, 2,125, 86,172, 76,162,127,168,152,252,234, 88,225,164,151, 95,196,229,223,215,227,197,
- 14, 15,239,122,185, 99,100,126,169,197, 22, 9,145, 43,147,227, 15,114, 5,151, 43,152,173,115, 0,168, 10, 6,235, 28,254,170,
-131,249, 52, 48,180,212, 88, 77,123,252,197, 68, 84, 23,131, 5, 0,173, 0, 59, 74, 42,185,178,125,233, 91, 94,138,148,104,145,
-241,110, 20, 84, 70,142,108, 74, 98,184,142,128,205, 13, 64,255,248, 54, 58,157, 78,155,144,144, 96,243,218,200,145,232,222,182,
- 45, 60, 93, 93,209,178,113, 99,216,200,164,144, 74,196,149, 94, 89, 45, 46, 67,160, 40, 18, 16, 16,128, 97,195,134, 65, 44, 22,
- 67,161, 80,192,206,206, 14, 82,169,180,202,104,150,165,111,185,132, 16, 8,133, 66,220,189,123, 23,201,201,201,112,114,114,194,
- 31,127,252,129, 23, 94,120,225,137,168, 86, 69,115,102, 77,136,190,138, 7,127,153, 17, 59,109,141, 22,203, 82, 40, 38,193,144,
- 39,205,134,142,234, 8,163,145,129,209,104,196, 15,145,102,252,153,160,133,217,108,130,209,104,172,105,159,213, 33,240,242,242,
-154,208,178,101,203, 89,175,188,242, 10, 45,149, 74,161,213,106,161,211,233, 16, 29, 29, 77, 15, 30, 60,164, 96,216,176, 80,199,
- 19, 39, 78,144,210,162,195, 76, 43,180,115,189,189,189,125, 74,139,103,115,235,114, 87, 83, 20, 85,110, 98, 30,231,181, 53, 49,
- 16, 9, 75,174,201,198,141, 27,193,178, 44, 8, 33,213, 94, 36, 3, 69,253,182,236,139,213,142,171,214,253, 8, 71,151, 70, 56,
-127,254, 60,123,234,212,169, 34, 10,136,191, 31, 29,189,230, 37,224,228, 65,192,108, 77,250,242,243,243,109,154, 53,107,134,198,
-141, 27,131,227, 56,208, 52, 93, 30,125,201,205,205,133, 94,175,135,139,109, 1, 90,184, 54, 6, 83,116, 14,234,187,159,192,211,
- 46, 22, 59, 78,155,232,231,252,113,235, 63,144,113,252, 84, 58,213,243,173, 25,222,238, 30, 62, 16, 16, 26,170,172, 92,140, 24,
-250, 34,132, 18, 59, 60, 74,205, 65,112,155,230,158,175,190,212,195, 83, 72, 49, 88,184,114,239, 44,128,251,161, 54,185,226,226,
- 98, 54, 54, 54, 22,183,111,151,248, 93, 7, 7, 7,216,218,218, 86,250,143, 11, 4,130,122, 69,180,202, 76,214, 23, 27, 95,176,
- 21,136,181,208,176, 17,216,182,235, 58,130, 3, 66,177,233,202, 85, 3,155,153,215,255,107,131, 33,126,223, 83, 28,204,240,240,
-240,152,206,113,220, 82, 66, 72, 65,207,158, 61, 27,237,221,187,215, 57, 61, 61, 29,215,175, 95,199,146, 37, 75,178, 89,150,101,
- 8, 33, 20, 33,228,147, 6,216, 29, 87,193, 96, 53, 36, 98,133, 28,111,187, 57, 80,195, 69, 2,135,102,140,166,248, 81,142,137,
- 28,215, 49,220,183, 0,232, 26, 51, 55,129,224,141, 67,251, 55,122,185, 41, 57,132, 40,251, 65,157,105,198, 23,239, 77, 70,110,
-110, 17,126,216,186, 2,128, 20,102, 70,136,222, 33,163,225,238,238,141,105,111, 78,243,216,184,121,211, 91, 12,199,125,141,103,
-132,140, 75,223, 31, 5, 16,161, 84, 42,163,223,154, 54, 77,217,172,217, 68,200,229,114,236,219,183, 15,123,191,251,142, 93, 7,
-140,149, 1,103,103, 0, 71,107,212,185,242,151,206,156, 25, 51,148,129,129, 51, 32,147,201,240,251,169,159, 96,200,216, 85, 52,
-180, 59,204, 58, 3,134, 54, 29, 70, 92,146,126,161,242,196, 98, 60, 0, 0,177, 28,106, 0,143, 23,131, 61,109, 6,171,140, 19,
-248,171, 94,214,180, 74, 17,173, 58,231,157, 98,233,157,173,239,190,220,164, 17,140,148, 41,242, 23,164, 27, 57,118,213,125,179,
-240, 70, 33,153,127,175, 10,147, 85,122, 99,115,190,190,190,232,215,169, 19, 70,246,234, 5,145, 72, 4,185, 84, 2,123,185, 13,
- 8, 91, 18,201, 42, 43, 58,172,225,153,136,170,162, 79,174,174,174,144, 72, 36,229, 6,203,138,104, 86,149,154, 28,199, 65, 36,
- 18,225,246,237,219,232,217,179, 39,124,124,124,112,224,192, 1, 12, 28, 56,240,137,162, 68,107, 77, 86,153,209,122,172, 24,111,
- 32,128,178, 72,150, 85, 70,203, 96,162,144, 99, 10, 6, 69,181, 5,195, 0, 44, 1,140, 6, 3, 8, 1, 8, 1,104,179, 9, 6,
-131,161,124,159,150, 20,201,122,120,120,248,218,216,216, 44,127,255,253,133,129,193,193, 29,144,157,157, 13,142,227, 96,107,107,
- 11,157, 78, 7, 7, 7, 7,116,239,222,253,209,242,229,203,213,132, 96,154,149, 38,171,222,148,157,243, 51,103,206, 84, 42, 54,
- 44,155,180,234, 52, 76,121,103, 55,164,162,146,162,165,178, 58, 60, 53,229,187,125,123,247,192,165, 27,241,204, 27, 11,215, 27,
-197,185,215, 87,122,112,220,246,180,122, 28, 23, 33, 4, 57, 57, 57,200,204,204,196,240, 17, 35,176,119,207, 30, 36, 37, 37,161,
- 77,155, 54,232,219,183, 47,220,221,221,145,148,148,132, 63, 47, 26, 97,204,207, 67,158,233, 58, 20,246, 93,113,236,124,130,113,
-201, 70,115,194,191,152, 97, 12, 7, 48,217,193,193,193, 79,167,211,169, 25,134, 57, 8,224, 32,128,177, 34,145,104,172, 66,161,
-240,212,104, 52, 15, 81,210,154,232,120,109, 98, 54,114,185,171, 76,238, 0,142, 49, 66, 36, 18,193,199,167, 25, 8,107, 66,190,
- 70,143,215,198, 15,195,141,219,247,112,234,236,101,134,166,185,111, 44, 57,165,223, 22,203, 0, 0, 32, 0, 73, 68, 65, 84,173,
- 66,161,144,248,251,251, 35, 43, 43, 11, 98,177, 24, 54, 54, 54,176,179,179,195,226,197,139,241,221,119,223,149,155,172,186, 26,
-173,169,128,191,131,175,221,229,207, 55,148,152,172, 12,149, 26,153,105, 98, 40, 93, 27,225,155,239,214,105,243,147, 50,186,254,
- 8,196, 63,237, 15, 89,142,227, 62, 73, 79, 79,119, 23,137, 68, 30, 12,195, 32, 53, 53, 21,215,174, 93,195,236,217,179, 51,115,
-115,115, 67, 80,199, 99,148,203,229, 89,101,145,172,210,162,195,234,138, 19, 11, 42, 68,178, 10,106,144,172,174,152,176,121,179,
-198,246,225, 91,215,206,245,237,220,181,187, 64, 33,114,200, 47,126,144,209, 51,242,194,249,238,179,215,254,240, 86,114,126,241,
-139, 0, 18,171, 19,149,137,197,131,159,239,209, 67, 4,146, 9,145,180, 39,190, 92, 53, 30,217, 57, 26,228,231, 21, 65, 34,177,
-133,137, 22,130,229, 40,116,239,217, 11, 63,237,216,143,160, 55, 95, 23, 74,197,226, 1,140,201,244,204, 24,173, 82, 86,124,251,
-237,183,190, 1, 1, 1,216,190,125, 59,206,238,220,137, 73,133,133, 56, 47, 16, 8,105,177,216,237, 36, 77,111, 65, 45, 70,171,
-162, 78, 80, 80, 16,126,252,241, 71,236,218,181, 43,101,194, 11, 89,135,231, 78,128,187,217,140, 65,215,227,224,210,116, 24,112,
- 61, 14, 46,207, 5,160, 37, 35,194, 3,138,170,220, 29, 84, 88, 88, 88,159,138,243,167, 12, 53,170, 41, 98, 23, 1, 8, 9, 11,
- 11, 35, 21,231,181,102,156,202, 86, 51, 86,188,232,215,164,109, 11, 95,138, 62,176, 30,169, 90,198,244, 81,156, 89,122,191,152,
-204,189, 7,172,171,225, 13,130, 8,133, 66,216,219,216, 64,233,228, 84, 18,230, 23, 8, 0, 14,224,104,128, 98, 75, 12, 0,225,
- 40, 16,214,170, 12, 3, 82,169,180,202,138,239,214,214,205,170,168, 89, 84, 84,132, 71,143, 30, 97,218,180,105, 80, 40, 20, 37,
-206, 61, 35, 3, 77,154, 52,129, 72, 36, 66,122,122, 58,126,255,253,119,248,249,249, 65, 38,147, 89,229,182, 42, 68,151,218,163,
-164,149, 97,123,181, 90,237,224,233,233, 9,171, 35, 90, 28,129,206, 72,193,100, 98,113,255,254,125,168, 84, 42, 60,122,248, 0,
-157,181, 26, 16, 8, 65, 8,177, 42,162,229,237,237,221,182,121,243,230,155, 86,174, 92, 41,105,220,184, 49, 8, 33,112,118,118,
-130, 78,167, 67, 78, 78, 46,218,180,105, 3, 31, 31, 31,172, 92,185, 18, 0,246,254,211, 38,235,177,123,170,220,104, 85, 52, 92,
-239,188,228,139,188, 60, 59, 8,133,130,114,227, 92, 75, 29, 45, 9, 0,132,188, 56, 74, 20,126,234,164, 45, 3, 44,207, 16, 10,
-151,139,106,191,142, 52,203,113,138,234,126, 79, 77, 77,133, 88, 44,198,161,131, 7,145,151,153,137,224,224, 96,116,233,210, 5,
- 15, 30, 60,192,141, 27, 55,224,234,234, 10,101,227,110, 56,255,208,140, 24,149, 30,142,142,142, 72, 72, 19,252,155, 93, 6,188,
-217,191,127,255, 37,107,214,172,113,247,240,240, 16,103,103,103, 7,108,216,176, 33,120,195,134, 13,115,222,122,235,173, 70,111,
-189,245,150,179, 82,169, 20,101,100,100,248,191,247,222,123,207, 69, 68, 68,248, 1, 88, 93,147,160,173,173,189,139, 80, 98, 11,
-138, 18,193,201,209, 25, 34,169, 45, 56, 70, 4,150, 3, 28, 28,149,184,116,227, 16,254,184, 83, 52, 61, 43, 23, 7, 45,138,143,
-149, 94,119, 87, 87,215, 39, 34,213,179,103,207,198,214,173, 91,203,139, 17,235,106,178,190,216,240,130, 29, 85,106,178, 50, 82,
- 69,160,140,126,248,229,104, 84, 65,126, 82, 70,207,103,193,100,149,229,113,132, 16, 60,124,248, 16, 58,157, 14, 23, 47, 94,196,
- 39,159,124,146,253,184,201,114,119,119,127,211,193,193, 97, 89,113,113,241,151, 25, 25, 25,235,107,125,241, 43, 49, 81,101,159,
-203,230, 85, 22, 39, 90,152,212, 38, 85, 69,178,124, 60,229,167,111, 92,220,221,196,145,220,162,144, 60, 13,184,175,137,182,191,
-226,222,123, 72,231,161,130,142,223,127,218,180,203,244,197,167, 83, 53,134,128,234, 34, 91, 28,203,118,180,181,179, 7,144,133,
-235,215,206,149,155,172,220,188, 66, 24,205, 66, 24, 77, 20, 12,102, 1,250,245, 31,132,239, 54,237, 66,122, 86, 30, 88,150,109,
-247,140,153, 44,151,182,109,219,206, 24, 59,118, 44,150, 47, 95,142,136, 53,107, 76, 51, 41, 74, 35, 2,200, 9,150, 5, 71, 8,
- 37,176,172, 18,123, 37,157,175,191,254,250, 40,128,151, 87,206, 70,183,252, 98,188,230, 53,140,184, 52, 29, 86,178,226,152,247,
- 9, 0,184,100, 71, 84,126,100,134,134,134, 82,101, 37,107,214,150,176,253,215, 17,133,134,134,158, 15, 11, 11, 67,197,121, 77,
- 27,216, 55, 10, 24,178, 96,222,172, 85,157, 7,246,162,212,243, 6, 32, 79, 99, 96, 62,136, 49, 75,211,244, 53,155,172,138, 44,
-216,176, 1, 55,226, 75,254,199,141,221,221,177,240,213, 87, 65, 24,224,143,232, 24,236,143,136,192,248,254,253, 97, 43,151, 91,
- 28,217,224, 56,174,202, 40, 86,197,104,150,181, 81,167,130,130, 2, 28, 60,120, 16, 93,186,116,129, 66,161,128, 72, 36, 66,251,
-246,237,113,239,127,236, 93,103, 88, 20, 87,219,190,103,182,194,178,244,222, 85, 20, 12,138,189, 37, 98,236, 45,182,168, 81,177,
-188,246, 26, 11,106, 84,108,177,196, 26, 53,246,138, 49,118,236, 26, 43,118, 44,216, 5, 65, 17,164,151,101,233, 44,176,125,118,
-118,230,251, 65,121, 81, 41, 11,166,188,201,231,115, 93,123,205,206,206,238,189,103,230,204,156,115,159,167, 70, 69,193,195,195,
- 3, 4, 65,224,252,249,243, 24, 56,112, 32,226,227,227,241,229,151, 95,138,147,147,147,107, 76,180,222,188,121, 99,198,178,236,
-215,165,218,143,218,138, 70,163,193,219,183,111,209,175, 95, 63, 88, 90, 90,194,217,249, 56,110, 6, 31,133,200,231, 63, 32, 8,
-212,136,104,233,245,250,113,125,250,244,225, 19, 4, 1,149, 74, 9, 35, 35, 99,152,152,136, 97,106,106, 6, 47,175,134, 72, 79,
- 79, 71,207,158, 61,181,113,113,113,187,164, 82,233,201,154,182,213,219,219,219, 36, 41, 41,233, 63,117,234,212, 17, 0,128,177,
-177,113, 35, 15, 15,143, 31,226,227,227,139,106,170,213, 42, 37, 88, 4, 65,128,195,225,148, 17, 45, 46, 73,194,209,193,174,108,
-191,196, 63,141,168, 2,171, 80,146,171, 17, 2,128,155,155, 27,118,236,253,157,236,211,167, 15,102,205,154, 5,157, 78,135, 93,
-187,138,131,236,134, 15, 31, 14,138,162,112,230, 76,113,144, 36,151,203,173, 82,109,242,252,249,115,188,120,241, 2, 58,157, 14,
- 5, 5, 5,184,122,245, 42, 66,238,221, 67,208,249, 91, 72, 74,136, 69,211,134,238, 24, 63,126, 28,120, 60, 30, 14, 29, 58, 4,
- 95, 95,223,191,117, 64,224,241,120, 35, 3, 3, 3, 29, 15, 30, 60, 40, 59,127,254,188,162, 93,187,118,194, 45, 91,182,216,237,
-216,177,195, 86,171,213,194,223,223, 63,235,241,227,199,154,111,191,253,214,100,223,190,125,142,245,235,215,239, 78,211,116, 69,
- 68,203, 4,192, 48, 0,163,242,139,180, 92, 89,145, 10, 12,173, 69, 66, 82, 34, 10,228, 90, 48,122, 10, 41,105,233,144,171,245,
-200,205, 43, 66,211, 22, 61,182,223,189,123,119, 49, 69, 81,139, 0, 92,170,174,157,175, 95,191,198,227,199,143,145,148,148,132,
-132,132,132,247,153,226,196,137, 56,114,228, 72,141, 53, 90, 21,147, 44, 14, 8,141, 7, 46,157,127, 34,203,138,149,254,107, 72,
- 86,201, 24,180,204,209,209,113,153,163,163,163,209,245,235,215,205,235,212,169, 3,154,166,181, 31,106,178, 58,117,234,180, 36,
- 48, 48,208,209,195,195, 99, 58,128,173,255, 11,109, 39, 73, 76,252,121,247, 20, 27, 83, 65, 74, 58,222,109, 42,201, 37,200, 1,
-148,133,192,221, 99,224,182, 95,154, 56,253,219, 5,150, 1, 7, 87, 78,100,192, 84, 26, 33, 27, 23,159,138,221,187,119, 96,182,
-255, 24,252,246,235,207, 96, 24, 46, 52, 58, 14,220,234,182,131,134, 98, 64,144, 92, 52,107,209, 10,119,238,222, 7,143, 4, 78,
- 29,220,253, 47,227, 89,200,139,140,140,220,117,254,252,249, 25,179,102,205, 2,195, 48,130,229,187,119,171,178,179,179,215,162,
-102,249,175, 62,196, 25,184,123,247,238,152,128, 29,217,231,102,143, 4, 39,233, 34,145,247, 34, 26, 86,223, 45, 96,113,122, 61,
-129,150, 13,145, 39,170,120,138,191,247,193,246,223, 65,180, 74,153,100,249,109, 69,210,194,179,222, 79,230, 86,150,227, 72, 83,
-103,155,249,179,166,114,227, 51,212, 56, 83,103,132,252,246,225,109, 38, 25,180,112,123, 28,212, 91,106,242,199, 39,110,223, 46,
-123,191,225,248,241, 10,143, 73,191,251,206,224,149, 89,101, 90,172,154,106,178, 0, 64, 36, 18, 89,116,239,222, 29, 93,187,118,
-197,224,193,131,203,124,178,154, 55,111,142,160,160, 32, 12, 26, 52, 8, 97, 97, 97,112,116,116,196, 23, 95,124,129, 47,190,248,
- 2, 87,174, 92,169,233, 32, 7,189, 94, 15, 31, 31,159,210,168,195,166,105,105,105,102,181,237, 72,141, 70,131,220,220, 92, 88,
- 89, 89, 65, 32, 16,160,109,219, 54,152, 49,179, 45,108, 28, 15,192,199,187, 33, 20, 10, 69, 89,248,187, 1,147,173, 79,131, 6,
- 13,144,157,157,141,236,236,108,216,218,218,194,201,201, 9, 14, 14, 14,216,180,105, 19,187,117,235,214,107, 20, 69,237,202,201,
-201,169,177, 38,203,193,193,161, 3, 65, 16, 75, 84, 42,149,160,220, 10, 87, 96,107,107,123, 65,165, 82,173,149, 74,165, 6, 59,
-130, 18, 4, 1,138,162, 64, 16, 4, 46, 39, 56, 65,161, 37, 80,152,246, 2,179,250,187,191, 71,188,120, 60, 94,181,230, 82,150,
-101, 21,126,126,126,118,174,174, 46, 72,141,123,141,211,167, 89,252,242,203, 47,165, 81,145,136, 41, 89, 24,148,238,119,238,220,
- 25,117,235,214, 5, 91,131, 92, 25, 12,195,224,213,171, 87, 56,126, 33, 4,142,238,222, 72,121,247, 22, 47,175, 92, 68, 29, 91,
- 43, 52,110,209, 10, 58,157,238,147, 82,111,252, 17,162,211,233,246,123,122,122,178, 90,173, 54, 4,192,142,136,136,136, 49, 82,
-169,212,255,247,223,127,119, 26, 50,100, 72,250,197,139, 23,183, 0, 56, 24, 17, 17, 49,101,213,170, 85, 93,105,154,174, 48, 90,
-144,195,225,252, 54,103,206,156, 78, 67,134, 12, 33,248,164, 78,123, 61,248, 16,151,166,117,196,188, 69,251,245,119, 31,132,144,
- 52,173, 35, 6,251,205, 97,174,220,142, 32, 39,207,220,160,111,222,174, 15, 34, 35, 35, 29,250,246,237,187, 74,167,211, 85, 73,
-180, 74, 53, 85,149,105, 40, 57, 28, 14,198,140, 25,131,160, 32,195, 61,168,198, 3, 30,102,238,226,199,107,118,118, 19, 19, 92,
-121, 57,146, 85, 31,151,206, 63,145,101,190, 75,255, 87,145, 44, 0,200,205,205,221, 11, 96, 47,195, 48,153, 38, 38, 38, 40, 42,
- 42,170,232,254, 51,138,136,136, 48, 18, 8, 4,232,209,163,135,213,205,155, 55, 99, 72,146,220,154,158,158, 94, 41,227,168,200,
- 76, 88,145, 57, 17,159, 16,117,104,105,139,190,109, 59,180, 48,141, 54, 95,105,106,196, 85,135,213,137, 49, 50, 35, 0, 20,104,
-236, 19, 66,147,135, 21, 18, 89,194,230,173, 58,183,132, 25,215,164,175,140, 46,170,144,104,145, 28,206,203,130,124, 89,239,194,
- 34, 45, 30, 60,140,132,223,176, 6,208, 80, 4, 24,134,132, 92,161, 1, 56, 60,144, 0,134,143, 24, 13,150,224, 34, 47, 51, 29,
- 28, 14, 39, 2, 52,141,127,153, 44,156, 50,101, 74,239, 69,139, 22,213,155, 63,127, 62,230,207,159,239, 30, 24, 24,184,119,205,
-154, 53,243,179,179,179,155,160,154,228,227, 85,224,212,185, 24,180,116,238,133,251,123, 10,250,124,165,122,215,178, 97,177,230,
-171,101, 67,228,241,120,136,229,114,144,203,178,239,187, 25,245,237,219,183, 99,249,237, 63, 76, 62,116,130, 47,219, 55,200, 71,
-171, 65, 61,231, 94, 45,154,251,204, 92,188,104,177,105, 84,232, 93, 4,252,180,131,245,108,213,189,104,239,253,151, 90,185, 73,
-221,222,242,156,216,135,134,242, 11, 0,232,213,101, 16,154, 54,106,243,209, 65,223,206,197,201,218, 31,220,121,142,204,108,137,
-193,147,109, 9, 57,168,208, 39,203,144,144,254, 15, 69,165, 82,201, 34, 35, 35,237,210,210,210,222,115,124,175, 91,183, 46, 8,
-130,192,147, 39, 79,240,248,241, 99,248,249,249,129,203,229,130,199,227, 33, 36, 36,164, 70,218,152,114,218,165,210,168,195,158,
- 46, 46, 46,149, 69, 27, 86,139,165, 82,169, 80, 80, 80,128,224,224, 96, 52,104,208, 0,107,214,172,129,147,163, 61, 22, 47,158,
- 11,134, 97, 80, 88, 88, 8,189, 94,111,168, 70,139, 41,213, 22, 49, 12,131,236,236,108,212,171, 87, 15, 59,119,238,196,150, 45,
- 91, 86, 73,165,210,223,107,218, 70, 87, 87, 87, 11,189, 94, 63,175, 79,159, 62,221,191,253,246, 91,244,236,249,126, 62,214, 99,
-199,142,153,158, 57,115,102,237,182,109,219,122, 81, 20,181, 46, 43, 43, 43,219, 16,220, 3, 7,138,211, 47,137,218, 45, 67,192,
-144, 58, 24, 53,237, 16, 54,109, 58, 11,161, 80,248,222,196,187,114,229,202, 42, 73, 12,195,178,158,252,156,208,244,185, 11, 54,
-218,173, 93,123, 19, 55,111,102,129, 36, 73, 56, 58, 58,130, 36, 73, 36, 38, 38,130, 36, 73,184,187,187,131, 36, 73, 72, 36,146,
- 82,159,192,124, 84, 16,245, 88,241, 42,156,132, 90,173, 70,106, 74, 18,210,226, 98, 32, 46,204,128,173,153, 8,249,175, 95,161,
-233,248,137,101,249,159,254,102, 57,162,213,106,143,148,219,223,120,241,226, 69, 45, 65, 16,131, 81,236,167, 81,170,209, 88, 69,
-211,244,170,202, 64,218,181,107,215,124,209,162, 69,188,210,116, 27, 78,110,171,105,138,162, 24, 0,104,216,244,235,247,216,126,
-108,108, 44, 54,109,218, 4,133, 66, 1, 62,159,207, 55,228, 58, 48, 12, 83, 22, 97, 88, 17, 9,171, 9,201, 2, 0,107,119,151,
-237, 79, 94,132,232,195,227,246,168, 34,162,175, 26, 75, 83, 72,144,218,127, 47,201,250, 80,179,229,226,226,178,140, 97, 24,150,
-101,217,165,229, 14, 9,221,220,220,238, 95,191,126,221,154,166,105,108,219,182,205, 34, 35, 35,195,226,235,175,191, 14, 0, 80,
- 41,209,170,200, 76, 88,145, 57, 17,229,162, 14,133, 66,161,149, 86, 91,169,242,228,163,168, 67,189, 30, 94,102,166, 22,200, 71,
- 26, 52, 54,186,230, 50,107, 58,239,134,116, 98,152, 83,114,139, 70, 38,122, 93, 61,178, 80, 11,103,145, 5, 24,150,173, 52, 52,
- 90,163,211, 93, 13,123,241,178,135,155,107, 3,206,239,151,238, 97,192,192, 33,208,104, 72,168,117, 4, 8, 14, 15, 4,135,143,
- 38, 77, 91,224,139,198, 77,193, 2,120,254, 52,148,214,234,116, 55,254, 77,125,239,216,126,134, 31, 65, 96, 43, 88,134,173, 32,
-143, 86,189,129, 3, 7,174, 5, 48,179, 58, 28,187,118, 51,252, 72,178, 24,167,124, 30,173, 57, 51,166,224,245, 83,158,249,189,
- 23,235,249, 61,219,225,114,246, 77, 2, 34,163,255, 70, 29,242,200, 79, 74,205,241, 79, 33, 92,213, 19, 45, 87, 87, 87, 11, 51,
-161,209,129,239,199,143, 51, 77, 14,127,132,140, 55, 79,240,240, 94, 76,254,137, 51,103,243, 20,185, 89,227,107, 64,178,202,204,
-124,214, 14,117, 80,215,251, 99,162,101, 36,182, 5, 0,212,245,110, 3,142, 73,205,210, 8, 85,164,205,170, 13,201, 42, 63, 96,
- 87,148, 67,107,242,228,201, 8, 12, 12, 68,251,246,237,225,233,233, 89, 54,216,215, 84,107, 86,129,118,169,198,209,134,229,165,
-168,168, 8,238,238,238,216,183,111, 31, 34, 34, 34, 96,106,106, 10, 63, 63, 63, 20, 21, 21,149, 17, 44, 67,157,225, 89,150,141,
-189,126,253,122,235,161, 67,135,178, 60, 30,143,144,201,100,176,176,176,192,206,157, 59, 21, 82,169,244,114, 45, 72,214, 16, 62,
-159, 63,119,216,176, 97,156,134, 13, 27, 34, 51, 51, 19,102,102,102, 58,130, 32,120, 0, 96, 97, 97,161, 51, 54, 54,198,148, 41,
- 83,208,172, 89,179, 14,243,231,207,111,207,229,114,119,166,167,167, 31,170,234, 94, 34, 8,162,108, 66, 29,191,245, 45,180,218,
-226, 9,122,215,174, 93, 40,241,117,251,175,137, 32, 46, 14, 48, 32,146, 69, 44, 22,195,211,211,179,194,190,239,208,161, 3,158,
- 63,127, 94,108,154,228,114, 97,103,103,135,135, 15, 31, 26, 20, 73, 85,154, 8, 50, 50, 50, 18,222,117,109, 16,113,243, 58,108,
- 68, 60, 52,115,114,128, 75,135,142,136,137,137,249, 59,181, 89, 4,138,253, 48,186,149,220,131,251, 1, 76, 46,183,191, 19,192,
-246,154, 0,210, 52,205,146, 36, 73,164,166,166, 82, 34,145,136,176,178,178,226, 10,133, 66,104, 52,154, 50,194, 21, 27, 27,139,
- 75,151, 46, 33, 45, 45, 13, 86, 86, 86,164,185,185, 57, 40,138,202, 55, 4,223,203,203, 11, 14, 14, 14,239, 57,190,143, 31, 63,
-190, 86, 36,107, 12,224, 19,184,122, 93, 29, 33,201, 49,247,182,233,133,132,183,137,106, 82, 11,163,255, 15, 36, 11, 0,100, 50,
-217, 94, 0,123, 75,247,109,108,108,198,114, 56,156,197, 26,141,198, 60, 36, 36,196,194,214,214,150, 56,116,232,144,110,233,210,
-165, 50, 14,135,147, 79, 16,196,230,191,159, 28,226, 77, 78, 65,156, 59,207,210,137, 9, 87,179,161,254,169, 1, 95,228,243, 26,
-216, 18,141,125, 48, 48, 43,234,193, 88, 58,238,171, 76,105, 6,201,130,121, 83,197, 24,188, 63, 96,209,202,121, 49,111, 95,186,
- 25,153, 25, 97,242,148, 69,184,124,237, 14, 8,146,135,251,161, 79,160,165,244,200,201, 43,192,176,225, 35,225,226,104,131, 55,
-143,131,179,105,134,217,249,239, 34,217,204,142, 30, 3,198, 90, 10,141, 69, 37,215, 68,143, 35,191,206, 5, 73,110,197,143, 63,
-254, 8, 31, 31,159,105,145,145,145, 43, 80, 77, 30, 45,130, 96,118, 52,233, 56,220,146, 47, 44,198, 97, 25, 61,246,157, 10, 40,
-201,163, 53, 27, 59,247,158,105,210,184,110,194,242,170,242,104,253,139, 72, 86,249,109,213, 68,203,221,221, 93,104,194,195, 36,
- 30,135, 59,255,251, 17,223,218,102,197,189, 70, 90,212,203, 98,243, 2,165,162, 50,222, 69, 25,146, 10,189, 27,222,207,223,193,
- 86,101,186, 82,171, 13, 90,209,191,135, 89, 58,225,126,168,205,170, 33,201,250, 8,179, 60,217, 42,159, 55,203,213,213, 21,107,
-215,174, 53, 36,143,214,135,231, 94, 42, 61, 81,236, 0, 95,222, 25,190,167,129, 36,171, 66, 76, 91, 91, 91,228,230, 22,103, 72,
-232,212,169, 19, 58,117,250,111, 60, 3, 69, 81,101, 90, 44, 83, 83,211,138, 52, 90, 31, 97, 26, 27, 27, 7,156, 61,123,118, 92,
-104,104,232,208, 31,126,248,129,215,181,107,215, 82, 50,167,132, 97,181,221,222,195,212,235,245, 83,130,131,131, 57, 12,195, 96,
-223,190,125,120,254,252, 57, 43, 18,137,150,136, 68,162, 29,198,198,198,122,149, 74, 53,121,226,196,137, 35,151, 47, 95, 78,118,
-232,208, 1,143, 30, 61, 34,235,213,171, 55, 26,120, 47,137,101,133,231,254,228,201, 19,144, 36, 9, 58, 47, 5,211, 2, 78,192,
-196,152,139,183,111,223, 34, 47, 47,239,163, 36,166,134, 92,207,242,154,146,210, 87,135, 14, 29,202,204,144,109,219,182, 5,135,
-195, 65, 88, 88, 88,101,102,216,242,152,172,181,181,117,217,253,193,231,243,113,231,206, 29,252,244,211, 79,112,179,178, 64,126,
- 84, 4, 28, 58,117, 65,247,113, 19,225,231,231, 7, 14,135, 3, 43, 43,171, 50,205,175, 1,247,210,167, 72,121,204,113,222,222,
-222,163,223,188,121,227,210,164, 73, 19,199,200,200,200,206, 62, 62, 62,238, 17, 17, 17,165,251, 66, 24,230,155, 83,134,249,236,
-217,179,211, 59,118,236,152, 50,102,204, 24, 62,195, 48,250,228,228,100, 29, 0,194,193,193,129,243,236,217, 51,230,247,223,127,
-135, 74,165,130,139,139, 11,233,236,236, 76,220,184,113,131,137,138,138,122,194,178,236, 34, 67,206, 93,175,215,191,151,198,161,
-244,253,177, 99,199,106,252,188,215,249,194,107, 77,215,175, 27,186,230,164,135, 65, 42,137,131,190,192,150,186,116,254,162,166,
-134, 36,235,207,238,163,191, 18,115,229,187,119,239,156, 53, 26, 13, 4, 2, 1,118,237,218, 69,173, 93,187,246, 77, 78, 78,142,
- 47, 42,142, 40,127, 15,179,150, 81,135,121, 85, 96,126, 20,117, 88,144,139,203,231, 47, 60,107, 45, 30,184, 31,211,210,179,203,
- 28, 27, 89,130,176, 58,107,223,200, 87,212,166,137,132,188,178,140, 44,210, 43, 47, 87,113,238, 90,149, 86, 59,100,224,160,225,
-183,130,130,142,139,151, 46, 91,134,135, 79, 34,144, 43,147,131, 97, 57, 96, 8, 2,139, 23, 47,133,131,141, 21, 10,211,223, 41,
- 53, 20, 53, 16,239,231,208,250,199,247, 59, 65,144,211,111,252,126,104, 43, 73,128, 81,100, 70, 11, 57, 69,113,162, 81,126, 3,
-185, 67,134, 12,193,217,179,103, 17, 25, 25,185,167, 10,146, 85,134,201,178,228,244,136,144, 19, 91, 9,128, 81,101, 71, 11,185,
-242, 4,209,232, 17, 3,185,126,126,126, 56,119, 41, 20, 65, 23, 19,118, 7, 93,196, 69,252,187,165,230,153,225, 77,185,136,244,
-109,228,225,220,161, 69, 99, 35,174, 94,133,180,168, 56,228, 41,212,184,241, 58, 89, 70,178,100,173,115,235, 20, 15,144,124,164,
-164,188,171, 96,101,101, 84, 50,161,171,107,132, 73,146,228,123,218,172, 79,209,100,149,111,167,189,189,253,123,229, 92,202, 79,
-220,165, 62, 64,181, 72,237, 16,144,146,146, 98,150,146,146, 2,150,101,241,228,201, 19,179,182,109,219, 6,124,138, 54,107,238,
-220,185,101, 90,171, 15,183, 21,125, 86,157,148, 56,165,111,209,233,116,167,230,207,159, 63,173,109,219,182, 61,150, 45, 91, 70,
-160, 6, 5,120, 63,208,230,208, 12,195,224,238,221,187, 56,123,246,172,158,162,168, 73, 82,169, 52,162,220, 87,182,189,120,241,
-226,198,160, 65,131, 14, 69, 71, 71,115,222,188,121, 3,150,173, 62,238, 84,165, 82,193,211,211, 19, 52, 77, 99,253, 52, 87, 20,
- 21, 53, 1, 77,211,208,235,245, 48, 49, 49, 41,211,226,149, 39,207,213,221, 71,122,189,254, 35,162,245,228,201, 19,112, 56, 28,
-248,250,250,226,229,203,151,101, 26,173,234, 52, 80, 20, 69,165,216,219,219,219,175, 92,185,178,172, 93,217,217,217,184,126,253,
- 58,218,125,249, 21, 26, 77,154,140,244,244,116,108,222,188, 25, 78, 78, 78, 88,179,102, 13,242,242,242, 64,211,244, 95,173, 78,
-239,253,230,205, 27,151, 17, 35, 70,100, 69, 68, 68,184, 92,186,116,201,162,111,223,190, 38,195,135, 15,207,138,136,136,112, 33,
- 8,226, 43,212,208, 9,154, 97,152,133,139, 23, 47,190,182,102,205,154,128,153, 51,103,182, 29, 51,102, 12,143,199,227, 49, 18,
-137,132, 62,126,252, 56,225,233,233, 73,242,249,124, 34, 56, 56,152,121,250,244,233, 99,154,166,215, 3,184, 95, 19,141,115,121,
-146,197,225,112, 12, 37, 89,239,137,191,157,112,180, 41,153,237,187, 99,215, 90,178, 97, 93, 23,234,240,241,235,169,247, 31,189,
-139,231,104,104,255, 3, 85,164, 6,248, 55, 11,135,195, 57,233,237,237, 61,118,250,244,233,198, 61,123,246, 20, 46, 95,190,188,
-160,168,168,168, 50,146, 85,193,130,249, 47,137, 58,252,117,225, 15,151,252,231, 52, 25,235, 49,193,161, 14,110, 42,178,144,207,
-229,144,102, 22, 36, 90,184,115, 80,148, 19,107,123,241,214,193, 68, 0,213,229,101,123,246,226, 85,100,183,198, 77,154,159, 89,
-191,102,189,221,146, 5,243,121,103, 46, 93, 5, 75, 83,120, 18, 18, 2, 49, 95,207, 70,189,184,153,169,161,180,223,226, 95, 88,
-130, 71,250,112,123, 16,128, 11, 86, 86, 86,225,227,198,140,241,244,246, 30, 14,145, 72,132,211,167, 79,227,200,182,109,250, 45,
-192, 80, 33,240,114, 74, 53,249,244,178, 30,151,225,132, 77, 28, 55,206,171, 69,139, 9, 16,137, 68, 56,117,234, 20, 14,109,217,
- 98, 48,206, 63, 92, 74, 51,195, 95,198,127, 51,196, 87,227,163, 69, 18, 69,143,223, 37,203,159,188, 75,150,131, 97, 89,134,101,
- 53, 36,137, 84, 5, 69,173,121,151, 32,169, 21, 41, 40, 53, 29,174, 90, 61,253,143,179,121,148, 35, 63,181, 13,233,174,128,100,
-165,149,175,145, 86,126,146,174,236,189, 78,167, 75, 51, 16,126,157,155,155,219, 71,159,213, 94,245,203,214,136,100, 25,154, 71,
- 11, 0,114,115,115,165, 0,150, 60,122,244,232, 88,143, 30, 61, 38, 2,144,212,178,143,246,117,236,216,113, 18, 0, 14, 65, 16,
-123,210,211,211, 35, 62,122,224,165,210, 24, 39, 39,167, 13,117,235,214,157, 92,188, 48, 37,246, 85, 51,145, 39, 52,105,210,132,
-170,168, 47, 42,219,103, 24,166,218, 62,146,201,100,104,211,166,205, 71, 53, 45, 89,150, 69,114,114,114,169,198,169,236,218, 87,
- 69,224,228,114,249,228, 25, 51,102,236,229,241,120,110, 0,136, 82,146,171,215,235, 57,219,183,111, 55,210,235,245, 28, 0, 4,
- 73,146, 52,143,199, 83,159, 61,123,150,166,105, 58, 69,163,209, 76,254,139, 7,136, 83, 68,113, 41, 6,197,155, 55,111, 26,150,
-104,178,210, 34, 35, 35,195,130,130,130,108, 1,156,168, 37,238,125,165, 82,121,127,237,218,181, 29,118,237,218,181,112,242,228,
-201,109,252,252,252,184,157, 58,117,194,229,203,151,245,119,239,222,125,162, 82,169,214,213,132, 96,149,244,101,129,171,171,107,
- 25,225,170,230, 89,174,210,145,215,218, 93,184, 99,228, 84, 39,163,125,235,174,203,115,210,181,161, 58,185,118,209, 65, 32, 18,
-255,143, 37, 51, 51,243, 7, 0, 75, 55,111,222,156,222,172, 89, 51, 33,159,207,215, 26, 74,178,254, 66,161, 25,153,252,155, 95,
-186,127,119,161,227,226, 25,117,187,119,246, 21,185,214,177,115,142,138,203, 68,236,163,203,138,240,139,171,147, 88, 77,254, 0,
- 0,134,120,174, 63,213, 80, 84,131,185,243,231, 78, 19,240,120, 61,244,122,125,211,174, 55,206,179, 28, 14, 39, 66,171,211,221,
- 40, 49, 23,170,255,197, 93,190,106,195,134, 13,158,222,222,222, 56,125,250, 52,110, 28, 61,138, 97, 57, 57,184,195,225,112, 72,
- 62,223,250, 34, 69,109,132, 97, 4,105,213,166, 77,155,188,124,124,124,112,242,228, 73, 4, 31, 58,132,161,181,195,169,108,174,
-107, 13,192,182,100, 55, 7, 64, 52,128,150, 0,140, 1,104, 80, 92,218,201,166,252, 20, 86,114,172,244,248, 61,130, 32,254, 76,
- 71,216,234, 51,195,127, 40,145,177, 73, 45,255,232, 86,168, 84,170, 60, 79, 79,207, 26,197, 92,235,116,186, 42,109,184, 52, 77,
-167,121,120,120, 24,172,181, 48,132, 20,229,229,229,181,250, 19, 59,227,147,124,177,222,155, 68, 24, 38,201,209,209,145, 41,157,
-244, 43, 34, 97, 21,125,198, 2,137, 53,249,159,140,140,140,104, 0,115,106,219,206,244,244,244, 51, 48,160,104,180,161,223, 3,
-128,252,252,252, 63,188,152, 47,193,178,146,229,203,151,215,136, 96,131,101,171, 34,159, 17,114,185,188,173, 33,255, 77, 81, 20,
-254, 70, 57, 89,242, 34, 35, 35, 35, 39, 18, 4,209, 19,197, 38,129, 61,248, 99,178,121,223, 47, 44, 44,188,255,243,207, 63,119,
-216,183,111,159, 63,203,178, 40, 44, 44,220, 82, 83,130, 85,182,122,206,202,186,252, 71,157,120, 94,166,246,246,241, 61,105, 93,
- 84, 50,202, 63, 80,174, 61,132,207, 82,166,140, 98, 89,246,183, 81,163, 70,181, 3,112,240, 83,193, 42,137, 58,252, 84, 73,100,
-242, 11,154,221,153,251,211,184, 59, 22,166,125,160,231, 54,132,150,188, 8,109,238,101, 0, 7, 96,152,155, 67,217,249,210, 12,
-179,137,214,106, 55,149,155, 92,254, 63,244,179,149,143,143,143,255,216,177, 99,177,116,233, 82, 4,111,220, 72, 77, 37,136, 2,
- 30,192, 94, 43, 94,104,146, 4,176,192, 80,156,209,163, 71, 99,233,210,165,184,178,126,125,109,113,170, 18, 91,130, 32, 46, 1,
- 64, 64, 64,192,162,181,107,215, 90, 46, 92,184,176,233,186,117,235,214,148,236,191, 46, 61, 94, 50,215,245, 93,184,112, 97,227,
-114,199,139, 0, 60,251,147,175,103,133,153,225,255,108,233,246, 25,243, 51,230,103,204,207,152,159, 49, 63, 99,126,198,252,140,
-249, 41,194,178,108,159,226, 77,229,219,202,222,151,219,254, 45,194,197,103,249, 44,159,229,179,124,150,207,242, 89, 62,203, 63,
- 80,202,107,177,106,115,252, 15,148, 82, 31,173,242,178, 15, 40, 14,235,174,140,149,214, 36,234,161, 54,204,246,230,103,204,207,
-152,159, 49, 63, 99,126,198,252,140,249, 25,243,255, 29,102,117,216, 31,253,158,101,217, 62, 4, 65, 92, 98, 89,182,111,101,219,
- 82, 98,245,225,251,114,219, 63,204,237,160, 2, 41,245,205,250,200, 71,235,207,150,207,106,213,207,152,159, 49, 63, 99,126,198,
-252,140,249, 25,243, 51,230, 39, 73,169, 9, 16, 0, 27, 16, 16,176,240,127,208,116,232, 88, 66,178,202,191, 0, 84, 97, 58,100,
-217, 83, 28,137, 4,102, 2,129,136, 15, 0, 90,173,146,114,118, 70, 33, 65, 12,249, 59, 11,222,126,150,127,166,148,134,123,103,
-254,193,223,253, 44,159,229,179,124,150,207,242,255, 67,178, 75, 53, 85, 0,178, 1, 16, 37,251,218,146,109,118, 9, 33,251,240,
-253,123,199,255, 68,145,162, 18, 77, 22,183, 50,146,149,147, 35,178,225,114,243,189,244,122,245, 23, 0,192,229,146,111,115,114,
- 44, 99, 88,246, 84, 78,109,200,150,141,157,221, 11, 30,135,227,108,200,119,117,122,189, 36, 39, 51,243,253,212,241, 4,241,111,
- 32,120,134,146,136, 79, 33, 27,127, 58, 81,177,177,177,177,183,183,183,239,111,102,102,246,165, 76, 38,123,154,157,157,125,174,
-138,186,135,107, 9, 2,243,139,239, 43,252, 12, 96, 97, 21,208, 53,249,238,135,226, 41, 18,137,166, 17, 4,225, 83,242,128, 69,
- 42,149,202, 93, 0,222,253, 63, 28,144,140, 1,124,203,229,114, 71,219,216,216,180,201,200,200, 88, 14,160,182,217,188,185, 0,
-230, 90, 88, 88, 12,179,176,176,240,200,203,203,139, 47, 44, 44, 60, 9, 96, 19,128,106, 67,165,151,207,116,252,178, 83,207, 78,
- 75,238, 6,223, 93,181,124,155,244,209, 71,199,231, 58, 90,247,232,222,126,233,221,139,161, 43, 23,237, 76,207,171, 97,219,200,
-146, 23, 80, 28, 29,201,226,227,100,175,159, 42, 60, 0,253, 0,116, 2,112, 23,192, 69, 67,206,187, 18,105, 7, 96, 81, 73,155,
- 55, 1,184,243, 63,126, 31,153,216,219,219,175, 7,208,143,203,229,190,145, 72, 36,147, 0,164,253,205,109,226, 2,104, 13,192,
- 7,197,105, 56,158,193,176, 20, 14,213,138,181,181,117, 95, 46,151, 59,173, 36,181,203,174,220,220,220, 75,255,171, 29, 35, 16,
- 8,182, 56, 56, 56, 76, 80,169, 84, 74,130, 32,216,242,249, 30,105,154, 78,203,201,201,105,245,111, 27,212, 8,130,120,246, 63,
-222,196, 73, 21,124, 86,121, 30, 45,137, 4,102, 92,110,190, 87, 86, 70,196,176,116,233,171,161, 0,224,228,216,244,164,157, 67,
-147, 19, 18,137,128,114,104, 56, 80,204, 19,113,119,113, 56,188,230,106,173,198,134,199,229,229, 80,180, 46,140,212,178,211, 50,
-162,207, 85,152,108,145,199,225, 56, 39,197,220,177,163,169, 60,240,140,156,192, 51,118,171,180,181, 78, 78, 78,181, 58, 75, 75,
- 75, 15, 83, 74,104,228,207,227,113,186, 51, 44,237,195, 50, 0, 73,240, 34,105,189,238, 22, 95,163,249, 37, 63, 63,190,168,182,
- 87,176,161, 53, 28, 88,192, 15, 4,186,131,197, 13, 2, 8,138,206, 69, 70, 13, 32, 12, 37, 17,159, 66, 54,202,255,118, 51,128,
- 31,254,232, 59,201,217,217,217,178,111,223,190, 91,126,250,233, 39, 99,177, 88, 76,164,164,164,244, 92,176, 96,193,215,207,159,
- 63,159, 35,145, 72,210, 63, 36,125, 4,129,249, 12,195,146, 0, 64,146,196, 2, 91, 91, 59, 17,135,195,249, 40,183,145, 94,175,
- 23,101,103,103, 77,103, 24,150, 40,249,238,124,150,197, 86, 67, 8,163,145,145,209,112,159, 38,205,231,172,223,176, 73,108,111,
-103,103, 66,235, 25, 42, 49, 57, 73,180, 36,224,135,182,113,177,239,182,170,213,234,227,181,121,174, 57, 28,206, 48,161, 80,216,
- 23,128,119,201,103, 81, 26,141,230,146, 94,175, 63, 97,232,132,110,111,111,127,143,195,225,212,169,201, 31,235,245,250,148,204,
-204, 76,223, 90,118,209, 16, 55, 55,183, 3, 29, 59,118, 20,181,105,211, 6, 2,129, 0, 75,151, 46,157, 43,149, 74,171, 35, 90,
- 92, 0,115, 69, 34,209, 48, 19, 19, 19, 15,185, 92, 30,167, 82,169,206, 8, 4,130,110, 91,183,110,117,109,223,190,189,105,102,
-102, 38,193,225,112,236,175, 92,185,242,159, 45, 91,182,244,164,105,186,107,117,147, 92, 65, 28,187, 68,216,207,187, 67, 65,220,
-157, 37, 0,122,127,120,156, 86, 27,141,102, 57,174,125, 85,236,203,212, 18,242, 97, 48,201,226,241,120, 91, 29, 28, 28,198,170,
-139,115, 5,176, 31, 78, 56, 0,160,213,106,243,101, 50, 89,195,218, 60,242, 0,198, 91, 88, 88,140,157, 55,111,158,101,239,222,
-189,113,244,232,209,239, 3, 3, 3,243, 11, 11, 11,127, 67,113, 34,204,232, 26, 98,206,207,200,200,248,134,199,227, 17,174,174,
-174, 28,149, 74, 85, 19,162,229,133,226, 34,204,207, 0,236, 66,113,234,130,206, 64,241,243, 14,224,231, 82,226, 70,146,228,174,
-134, 13, 27,246,143,138,138,218, 13, 96, 85,109,159,117, 7, 7,135,189, 59,119,238, 28, 58, 96,192, 0, 78,118,118,182,115,179,
-102,205,142,101,100,100,116,248, 3,134,145,113, 66,161,112,118,211,166, 77, 27, 69, 71, 71,199, 20, 22, 22,110, 42,185,158, 85,
- 61, 83, 46, 0,186, 89, 88, 88,116, 93,188,120,177,184,111,223,190,216,183,111,223, 55,129,129,129,242,162,162,162, 91, 40,246,
-233,249, 36, 18,200,229,114,167,165,165,165,217,176, 44, 11, 71, 71,199,105, 0,254, 39,137, 22, 73,146, 91, 7, 13, 26, 52,246,
-216,177, 99,162,164,164, 36,145,179,179,115, 89,242,108,130, 32,106, 61,127,126,150, 79,150,125,229, 8, 87,245,121,180, 4, 2,
- 17, 95,175, 87,127,145, 46,125, 53,244,235,142,219,205, 1,224, 94,200,140,161,118, 14,141, 35, 5, 2, 81,140,208,204,232,236,
-160,126,221,154,127,215,183, 35,225,226,104,135, 52,105,150,253,175, 65,193,189, 46, 5,223, 57,139,226, 4, 98, 21, 10, 77,229,
-193,152,186,137,232, 7,219, 96,211, 41, 29, 59,174,164,225, 81,120, 34,148, 5, 57,168,227, 96,140, 13,254, 61,224, 96, 41,170,
-221,210,203,206,179, 51,205, 21,158, 24, 49,124,148,121,255,111,189,121,238, 14, 14, 96, 89, 33, 98,226,228, 95, 93,189,126,167,
-245,153, 83,199,167,153,240, 60,135, 41,178,222, 25, 60,184,181,112,132,177,130,194,183, 92, 14,241,159,246,173, 26,117, 29,254,
- 77, 7,178,145,119, 3,188,121, 29,213,227,194,237, 39, 27,200,208,215,183,104, 61,123,216,132,143,243, 47,165, 85, 38,244,251,
-136,112,116,237,218,173,131, 80, 40,124, 47,121,146, 70,163,225,223,186,117,179, 93,109,200, 70,233,127,104,181, 26,146,199, 19,
-128, 36,137, 57, 62, 62, 77,188,115,114,114,238, 16, 4,113, 32, 61,189,102,218,130, 25,128, 32,159,203,109, 73, 10,133,142,122,
-173,214, 26, 0, 8,129, 32, 63,145, 36,155, 44, 94,180, 72,204,225,112,152,220,220, 92, 40,149, 74, 98,226,196,137, 70,113,113,
-113,131, 36, 18,201,182,106, 86, 36, 8, 12, 12,244,114,116,116,252,168,122,172, 84, 42, 21, 12, 24,208,191, 54, 93,239,213,180,
- 89,139,217,193,193,215,188, 11,243,242,213,129,155,247,190,208, 25,137, 52,245,188, 27,242,118,237, 59,100, 62,105,236,200, 25,
-111,223,190, 14, 67,205,234,213,185, 25, 27, 27,159,221,184,113,163, 79,231,206,157,121,118,118,118,200,204,204, 68, 84, 84,148,
-207,237,219,183,191, 61,116,232,208, 92,149, 74, 53, 8, 48,168, 32,170,231,173,195, 7,236, 76,172,172,161,215,233,224,212,180,
- 69, 89,126,179,216,219,215, 65, 83, 20, 24,157, 14,222,125,191, 45,209, 38,179,240,246,246,174,109,214, 93,167,198,141, 27, 31,
- 89,179,102, 13, 95,163,209,224,201,147, 39,184,115,231, 14, 35,149, 74,171, 75,136,203, 37, 8,226,250,178,101,203, 92,124,125,
-125, 77,115,114,114,160,215,235,109,206,159, 63, 63,173,121,243,230,102,174,174,174,130,195,135, 15, 67, 46,151,131,166,105, 43,
- 15, 15, 15,171,225,195,135,107, 15, 31, 62, 60, 23,192,250,202, 52, 89,133,113,236, 18, 41,225,209,171, 97,203,209,200, 32,174,
-245,154,221, 11, 87,205,234, 19,101,154,173, 94, 30, 30,166,133, 18,209, 2,177, 89, 19,171, 66,201,205, 5,189, 60, 60, 2,175,
-197, 27,180, 24, 34, 75, 38,155, 17, 65, 65, 65,162,168,168, 40,145,183,183, 55, 24,134, 41,203,192, 95,154,112,214,211,211,179,
- 54,215,113,221,148, 41, 83, 22, 12, 29, 58, 20, 77,155, 54, 45, 75,138,250,227,143, 63, 98,193,130, 5,150,247,238,221,155,123,
-252,248,241,185,231,206,157, 91, 15, 32,160,134,218,152, 82,169,105, 31,175, 72, 72, 72, 24,114,246,236,217,145,243,231,207,247,
- 4, 48, 29,192,210,220,220,220,142, 37,218, 24, 65, 9,209, 26, 55,119,238,220,169, 1, 1, 1,248,230,155,111,150, 62,121,242,
-100,117, 45,181,124, 28,154,166,191, 25, 48, 96, 0, 71,167,211,193,196,196, 4, 58,157,174,254,167, 42, 37, 0,236,156, 60,121,
-242,212, 41, 83,166,192,210,210, 18, 58,157,206, 43, 40, 40, 40,112,233,210,165, 95, 2, 24, 95, 73, 91, 71, 79,157, 58,117,129,
-137, 32,113, 0, 0, 32, 0, 73, 68, 65, 84,240,168, 81,163,208,170, 85, 43,112,185,197,151,113,227,198,141, 88,185,114,165,248,
-250,245,235,223, 30, 62,124,248,219, 11, 23, 46,156,193,251,101,187,106, 36, 12,195,128,203,229, 34, 53, 53, 21,118,118,118, 66,
-134, 97,130, 9,130,216,151,151,151,119,238,127,104, 50,255,121,200,144, 33, 35,142, 29, 59, 38, 6,128, 13, 27, 54, 96,246,236,
-217,176,183,183,135, 88, 44,254, 76,117,254,119, 52, 90,147,170,213,104, 85, 39, 74,165,178,197,194,153,255, 1, 73, 22,175, 26,
- 27,212,115,195,218, 69,147,136, 11,151,130, 91, 84,169,131, 55,114, 66,244,131,109, 16,186,250, 67,163,163,241, 56, 60, 1, 55,
- 54,244, 44,158, 45,123, 47,134,134,234, 90, 58,217, 88, 9,140,141,127,214,234,245, 15,225,224,240, 4,201,201,217,213,145, 44,
- 91, 7,251, 75,123,246,172, 55,246,169,223, 16, 20,173,131, 36, 75, 2,130, 16,194,197,217, 20,227, 70,247,230,117,236,232,100,
-179, 98,197,222,203, 25, 12, 6, 42,115,222, 85,155, 48,212,203, 6, 7, 91,248,120, 14, 29,222,199, 87,216,196,167, 49,248, 66,
-227,178, 99, 45, 91,181, 66,203, 86,173,200, 0,121, 81,247,167,207, 94,116, 63,125,253,177, 70,169, 75, 62, 25,147,131, 49,213,
- 12, 50,101,132, 99,214,172, 89,176,183,183,127,239, 11,153,153,153,184,125,251, 86,133,191,169,193, 64, 86,246, 31,171, 87,175,
- 54,205,207,207,239,189,127,255,254, 46, 12,195,172,206,200,200,120, 96, 8,200, 40,160, 78,129, 80,216,117,236,166, 77, 76,243,
-254,253, 57, 22, 14, 14, 36,163,215, 19,233,241,241,214,155,183,109,235,148, 23, 27,107,172,176,178,202,203, 87,169,148, 49, 49,
- 49, 48, 50, 50, 34,184, 92,110,235, 10,160, 50, 89, 22, 63,147, 36,177,128, 32, 8, 8,133, 70, 49, 83,166, 76,121, 89,114,172,
-206,197,139, 23, 69,253,250,245, 83, 2, 72, 2, 0,161,208,200,153,195, 33,189,138, 51,177,227,103, 67, 8,166,137,137,201,204,
- 85,107,214,155, 20,230,201, 84,148, 66,161,179, 53, 19, 19,132,216,148, 83, 88, 80, 84, 36,145,102,107, 22, 47, 95,201,153, 60,
-110,212, 76,133, 66, 49,205, 80,146,213,172, 89,179,167,103,207,158,181,179,182,182,134, 76, 38, 67,110,110, 46,158, 62,125, 10,
-134, 97, 48,104,208, 32,225, 87,109,219,180, 88,180,120,201,163, 84,137,228, 75, 67,200,150,137,149, 13, 54,248, 54, 47,158,172,
-147,114,203,250,103,223,144,190,101,223, 89,153, 86, 80,170,157,251,148, 18, 82, 95,118,237,218,149, 15, 0,227,199,143, 47, 44,
- 42, 42, 90, 11,224, 24,170,207,232, 63,119,201,146, 37,206,245,234,213,115, 63,118,236, 24,228,114, 57, 0,216,213,171, 87, 15,
- 94, 94, 94,250,187,119,239,194,203,203, 11,166,166,166,184,119,239, 30, 30, 61,122,132, 86,173, 90,153,242,249,252,161, 20, 69,
- 85, 72,180, 58,245,236,180, 68,216,207,187, 67,195,150,163, 33, 54,115, 68,224,241, 19,136,126,113,168,131,134,138, 90,194,215,
-135,140, 82,177,194, 49,217, 41,226,128, 58,173, 58, 90, 55,104,220, 31,238, 45, 95,218,168,245,247, 19,150,116,175,183,142,107,
-164, 62,180,124,147, 52,183, 50,146, 5, 96,195,160, 65,131,134, 4, 5, 5, 89, 0, 64, 68, 68, 4, 50, 51, 51, 97,107,107, 11,
- 35, 35, 35,240,120,188,178,250,164,181,148, 49,187,118,237, 42, 35,109, 52, 77,151, 85, 1, 16,137, 68,248,250,235,175,209,188,
-121,115,156, 59,119,110, 76, 37, 68,203,183,109,219,182, 71,221,221,221, 93,203,127,168, 80, 40,224,231,231, 7, 0,232,216,177,
- 99, 87, 99, 99, 99,182,148, 16, 74,165, 82,249,179,103,207,186, 3,120, 82, 9,179, 84, 73, 36, 18,204,155, 55, 15,137,137,137,
-223,239,217,179, 39, 25,128,145, 64, 32, 40, 91, 31, 3,240,106,220,184,241,214,217,179,103, 35, 46, 46, 14,111,222,188,121,138,
-218,155, 82,245, 38, 38, 38,177, 58,157,174, 21, 77,211, 80,169, 84, 24, 56,112,160,209,153, 51,103, 50, 57, 28,206,219,156,156,
-156,145, 40,246, 73, 49, 84,140, 0,108,154, 50,101,202,212,249,243,231,227,214,173, 91,184,112,225, 2, 70,141, 26, 5,127,127,
-127,136,197,226,177,254,254,254,143, 80, 92,208,252, 67,233,186,107,215, 46,232,245,250,143,158, 13, 35, 35, 35,248,250,250,162,
- 81,163, 70,184,112,225, 66,215, 79, 32, 90,238,190,190,190, 2,134, 97,160, 80, 40,112,247,238, 93,177,177,177,177,216,197,197,
-101, 34,128,255, 25,162,229,238,238, 62, 37, 40, 40, 72, 92,222,250, 35, 20, 10, 81,238, 62,248, 44,127,191, 70,171,202, 21, 86,
-153,104,181, 74,138,203, 37,223, 58, 57, 54, 61,121, 47,100, 70,153,233, 16, 32,223,106,181, 74, 10, 0,244, 12,139, 66, 37, 13,
- 99, 33,137,164,140, 34,188,142,207,169, 8,234,189, 16, 77,158,177, 27,132,109,146,192,178, 44,180,148, 30,154,130, 12,172,189,
-172, 68, 84,154, 26, 90, 69, 62,180, 84,177, 27,150,141,141, 13, 55, 56,248,234,236,155, 55,111, 79,253,237,183,223, 56,105,230,
-230,111,138,128, 22, 21, 97, 90, 90,122,152, 50, 2,193,201,221,123,150, 26,179,156,120,196,164, 40,208,192,165, 13,108, 44, 92,
-145,145,163,192,195, 55, 87,240,246,221, 37,212,115,116,135,255,204, 94, 70,171,214, 28, 59,193,167,235,186,201,100,137,133,149,
-181,179,116, 21,181,247, 90, 12,232,188,120,232,115,227,160, 47, 74,255,232, 11, 98, 91, 55,180,236,236, 12, 91,215,250,194, 49,
-254, 43, 71, 3,239, 17,173,242,152,153, 4, 65,238, 38, 73, 98, 42, 65, 16,104,218,180, 89,218,166, 77,155, 42, 74, 5, 78, 53,
-109,218, 44,141,195, 33, 93,138, 7,118,114, 23,203, 50,153,213,180,243, 61, 82, 35, 16, 8,231, 23,171,253, 29, 83, 47, 95,190,
- 76, 13, 25, 50, 4, 27, 55,110, 20, 44, 88,176, 96, 49,135,195, 25, 95,129,121,239, 61,204,129,128,155, 69,253,250, 61, 86, 63,
-124,200,242,116, 58, 34,239,233,211, 66,153, 84, 74,103, 20, 21, 9, 78,189,125,251,205,132, 31,126, 16,184,186,186,226,193,165,
- 75,214,217, 10, 5, 43,211,104, 84, 50,153,140,165,105,250,105, 37,152, 11,109,109,237, 68,129,129,129, 94, 83,166, 76,121, 41,
-149, 74, 23, 2,128,163,163,227, 90, 0,141, 0, 36,149,251, 12,123,246,156,144, 76,156, 56, 49, 38, 43, 43,107, 97, 85,237, 44,
- 39,141,237,108,237, 68,199,247, 30,126,101,101,106, 76,218,186, 56,145, 60, 11, 11, 46, 45, 48,230, 51,128,170,158,107,125, 19,
- 0,141, 43,249,237,135,152,132,177,177,241,217,223,127,255,221,142,199,227, 65,175,215,195,214,214, 22,137,137,137,144,201,100,
- 40, 42, 42, 66,194,219, 40,212,117,117,197,138,128, 5,142,211, 23, 4,156, 85, 42,149,173, 62,152,204, 62, 46,128,172,163, 62,
-210,236, 85, 84,197,224, 67,179,151,129,253, 94, 94, 18, 83, 82, 82, 32, 22,139,225,227,227, 35,126,248,240,225,253, 42, 72, 86,
-249, 34,192, 67,219,183,111,111,122,236,216, 49,180,106,213, 10,230,230,230,184,123,247, 46, 34, 34, 34, 64, 81, 20, 41,151,203,
- 33, 22,139,177,110,221, 58,184,185,185,161,168,168, 8, 73, 73, 73,214, 60, 30,207,230,131,140,246,101,152,119,131,239,174, 42,
-136,187,179, 36,131,184,214, 43,240,248, 9, 76, 28, 62, 12, 14,108,252,125,243,250,196,170, 30,253,218,255,200,114, 92,251,154,
-152, 54,181,244,244,233, 7,190, 64,140,233,243, 87, 34, 38,242,162,165,178,232,213,247,132, 62,213,117,249,166, 83,179, 42, 56,
-119, 2, 0,233,234,234, 58,225,212,169, 83,166,101,170, 23, 14,167,172,230, 97,249, 34,240, 85, 20,124,175,246,122, 18, 4,129,
-196,196, 68,216,217,217, 65, 44, 22,151, 21, 16,143,138,138,194,227,199,143, 81, 90,141,162, 18,204,145, 55,111,222,116, 53, 49,
- 49,121,239, 11, 44,203, 34, 39, 39, 7, 52, 77, 67, 36, 18, 65,175,215,131,162, 40,232,116, 58,168,213,106,113,163, 70,141,166,
-233,116,186, 39, 21, 97, 50, 12, 51,103,232,208,161,237,159, 60,121,226,177,109,219, 54,104,181,218, 13, 25, 25, 25, 24, 60,120,
- 48, 24,134, 65,215,174, 93,219,177, 44, 27,189,120,241, 98, 0,192,236,217,179,117, 10,133, 98, 74,109,206,189, 68, 26,181,108,
-217,210,227,214,173, 91,232,208,161, 3, 52, 26, 13, 54,110,220,104,182,103,207, 30,179,195,135, 15,219,206,159, 63,255, 64,118,
-118,118,207,106, 48, 9, 0, 27, 28, 28, 28,166,118,234,212,201,184,164,134, 41, 14, 29, 58,132, 21, 43, 86, 4, 1, 88,124,245,
-234,213,101, 23, 46, 92, 24, 61, 97,194, 4,172, 88,177,194, 95, 38,147,237,175, 12, 51, 33, 33, 1,182,182,182, 48, 51, 51, 43,
- 30, 44, 41, 10, 97, 97, 97,184,113,227, 6,190,248,226, 11, 67,206,169,178,118,186, 15, 26, 52,232,192,241,227,199, 77, 83, 83,
- 83,113,239,222, 61,212,173, 91, 23, 74,165,210,144,218,176, 55,255,132, 9,187, 82, 76,149, 74,165, 78, 73, 73, 17,175, 95,191,
- 30,142,142,142,112,119,119,135,145,145, 17, 8,130,128, 78,167,171,170,188, 90,181,237,236,216, 17,220, 28,137,229, 0,115, 11,
-203,239, 89,150,229, 22, 20,228,239,165, 32, 59, 29, 31, 15,237, 95,120,238,255,100,105, 1,224, 37,222,175,121, 40, 45, 35, 90,
-151, 46, 93, 98,251,246,237, 75,148,110,157,157, 81,152,147, 99, 25, 99,231,208,228,132,157, 67,227,146,186, 95,228, 91, 14,199,
- 50,198,222, 94, 89, 8, 0, 20,205, 34,244,173, 12,175, 98, 51, 16, 17,155, 1, 19,161, 97,202, 23, 13, 69, 23,123,172,178, 44,
-212,242,255, 46, 90, 41,101, 62, 52, 84,177,187,135, 86,163, 68, 65,246, 27, 98,200,192,238, 70, 83,167, 78,134,163,163,179,109,
-101,120,148,208,200,127,250,236,111, 44,172, 44,120,184,244,240, 26,218,125, 49, 16, 70, 66, 30,114, 11,212, 0, 1,188,139,191,
- 1, 48,166,136,140, 73, 65,219,198, 34,244,236,225, 45, 62,119, 58,250, 7, 0, 75, 13,105, 47,157,246, 20,124,207,222,224,233,
-117,208,229, 68,131,145, 37, 3, 38, 14, 80, 17, 98,228, 74,147,241,246,254, 25,131,214,140, 12,195,124,111, 99, 99, 35, 91,188,
-120,113,167, 6, 13, 26, 80,211,166, 77, 11, 79, 78, 78,158,243,193,106,229,151, 93,187,118, 33, 54, 54, 86,178,122,245,234,187,
- 57, 57, 57, 75,106,216,209, 1, 44,139, 45, 37,166,184,156,243,231,207,183, 12, 9, 9,241,223,178,101,139,253,140, 25, 51, 4,
- 51,102,204, 24, 7,224,167,170,204,133,133, 66, 97,183,213,247,238,177,116, 90,154,230,200,246,237,130,157,161,161,139, 41,134,
-113,178,177,179, 35,190,106,219, 86, 33, 34,201,156,220,204, 76,218,214,195,131,147,120,227,134, 53,107,108,156,126,245,234,213,
- 66,185, 92, 94,105,233, 28, 14,135,163,172,200, 92, 88,145, 56, 58, 58,106, 43,242,225,170, 98, 66, 44,100, 88,150,178,168, 87,
-143,237,209,245,203, 6,177,209,241,241, 70, 22, 22, 28,207, 6,117, 27,190,126,155,248,148,213,235,213, 4, 65, 20, 26,100, 43,
-225,112,134,109,217,178,165,137,153,153, 25, 24,134,129,185,185, 57,178,179,179,161,213,106, 81, 88, 88, 8,109, 81, 1,180, 5,
- 5,136, 72, 78, 68,251, 78,157, 48,164, 87, 15,239,195,231,127, 31,166,215,235,131,170,180,231, 53,109, 81,166,201, 90, 89,199,
-250,191,182,160, 84, 89, 25,233, 90,223,194, 19,124,177, 24,221,231, 4,124,202,131,254,242,242,229,203, 87, 6, 13, 26,244,205,
- 15, 63,252, 64, 74,165,210,107,137,137,137,237, 1,188,169,234, 71, 98,177,184,126, 78, 78, 14,228,114, 57,204,205,205,177,101,
-203, 22,216,219,219, 67,169, 84,226,217,179,103,172,139,139, 11,113,247,238, 93,184,184,184, 32, 55, 55, 23, 20, 69, 65,165, 82,
-101,104,181,218, 74,205,229, 37,230,193,222,179,123,225,106,244,139, 67, 29,156,137,132,103, 67,231,118,140,141,142,120,155,114,
-253,198,195,159,104,181, 81,170, 44,237,230,130,122,173, 95,218,124, 63,111, 5,118,108, 88,134,232, 39,247,242,236,221, 10,119,
- 26, 19,154,131, 85,181, 87,161, 80,168,223,190,125,107, 26, 30, 30, 14,130, 32, 96,110,110, 14,145, 72, 84, 33,217,170,133,144,
-229, 53, 80, 10,133, 2,124, 62, 31,214,214,214,216,191,127,127,217,196, 91,183,110,221,170, 48,246,118,239,222,125,152,155,155,
-155,105,249, 15, 91,183,110,141,201,147, 39, 99,247,238,221, 8, 13, 13,125,175,158,102, 70, 70,134, 84,167,211, 85,117,222,178,
-204,204,204, 94, 3, 7, 14,124,113,255,254,125,179,253,251,247,131,166,233, 10, 95,129,129,129,120,252,248,241, 82, 0,111,107,
-121, 31,125, 49,120,240,224,123, 71,143, 30,181,200,206,206, 70,233,189,161, 80, 40,160,215,235,209,176, 97, 67,130,166,233,234,
-252,222, 72, 14,135,115,126,251,246,237,253, 38, 78,156, 8, 46,151, 11,173, 86,139,237,219,183, 99,193,130, 5,153, 37,139, 82,
- 10,192,226,131, 7, 15,142,238,223,191, 63,154, 53,107,230,125,231, 78,229,158, 29,114,185, 28,114,185, 28, 60, 30, 15, 14, 14,
- 14, 88,181,106, 21,180,218,226, 97,197,203,203,171,236, 49, 6,176,215,203,203,171, 95, 76, 76,204, 70, 20,251,174,125, 36, 14,
- 14, 14, 3, 89,150,157,164,215,235,139, 58,116,232, 96,125,252,248,113, 83,137, 68,130, 23, 47, 94, 96,233,210,165,249, 12,195,
-232, 25,134, 33, 84, 42, 85,130,157,157,221, 11,161, 80,104,172, 84, 42,243,114,115,115,215, 0,184,246,119,205,228, 4, 65, 16,
- 60, 30, 15,227,199,143, 7,151,203,133,177,177, 49,212,106, 53,116, 58, 93, 25,153, 71, 13,205,210, 13, 26,136,173,185,224, 79,
-180, 52,109,228, 63,100, 86, 95, 91, 71, 39,103, 88,152, 9, 17, 21,245,166,253,237, 91, 55,182, 11,184,209,123, 24,173,110, 79,
-116, 82,193,159, 94,236,254, 67, 46,242, 15, 37, 90, 31,213, 60,228, 86,220,153, 67,244, 44,123, 42, 71, 34, 17, 80, 2,129, 40,
-166, 84,203,101,111,175, 44, 36,136, 33,122,219,198, 3, 64, 83,186,146,129,130, 45,121, 25, 72,180,116,122,196, 70, 71,226,254,
-245,223, 97,163,148, 32, 39,161, 57,192,111, 2,173,170, 0,106, 45, 85, 66, 74,244, 8,127,113, 11,133, 5,121,240,105,213, 23,
- 32,201,199,149,225,153, 91, 19,125,191,106,217,148, 19,155, 18,137,214, 94,223,193,195,165, 3,146,165,133,144,201, 53,200, 47,
- 84,163,185, 79, 0,178,243, 85, 40, 84,170,241, 38,246, 48,156,157, 60, 72,130, 27,223,213, 80,162,165,121,115, 22,154,183, 23,
-192,119,111, 15, 65,195,254,224,184,251, 34,229,213, 29,132, 95,221,140,180,215, 15,192, 50,122, 56,122,181, 49,244, 33,217,126,
-237,218,181, 54,237,219,183,231,118,235,214,173,217,149, 43, 87,154, 73,165,210,240, 18,130,209,172, 91,183,110,205,108,109,109,
-177,117,235, 86, 21, 65, 16,219,107,217,217,101, 26,176,172,172,172,167, 0, 86,159, 61,123,118,251,228,201,147, 97,103,103,215,
- 36, 61, 61,189,210, 31,102,243,120,205,198,172, 89,195,242, 56, 28, 54,104,199, 14,254,138,107,215, 54,253,118,240, 32,191, 75,
-231,206, 4,203,178, 8, 11, 11, 19,173,223,177, 67, 52, 98,192,128,164,228,172, 44, 58, 36, 52,148,146,166,165, 21,101, 41, 20,
- 43,164, 82,105,198,223,113,103,235,116,186, 71, 9,137, 9,206,173,218, 54,183,125, 25,149,240,186,103,151,175,190, 34, 73,146,
-140,142, 79, 14,181,181, 53, 19,221,184,126,131,210,233,116,143, 12,193, 18, 10,133,125,187,116,233,194,205,207,207,135,147,147,
- 19,178,179,179, 33,145, 72,138, 53, 14, 5,249,160, 10, 10,160, 43,148, 65,175,144, 35,225,217, 83, 52,247,168, 39, 60, 37, 20,
-246, 85, 42,149, 85, 18,173,210, 85,102, 69,133,174, 75, 63, 19,152,154, 66, 32, 22,131,168,185,217,112,128,133,133,197, 2,153,
- 76,118, 5,192, 42,138,162,166, 47, 88,176,160,245,182,109,219,108, 86,175, 94,109, 54,105,210,164, 83,114,185,188, 57,138,139,
-170, 86, 54,129,197,209, 52,109, 13,192,254,214,173, 91,176,179,179, 67, 65, 65, 65,169,166, 69,171, 84, 42,141,114,115,115,161,
-209,104,160,213,106, 97,102,102,134,231,207,159,231,209, 52,125,177,186,198,153,213, 39, 86,105,168,168, 37,214,222, 38,233, 20,
-109,217, 49, 43,143,201, 95,190, 73,186, 18,192,166, 94, 30, 30,129, 20,115, 47,225, 93,228, 69,203,196,103,119,243,210,223, 41,
- 60,246, 95, 73,168,202, 71,139, 5,192, 16, 4,193,122,121,121, 33, 59, 59, 27, 28, 14, 7, 34,145, 8, 98,177, 24, 11, 23, 46,
-196,246,237,219,107, 67,180,140, 76, 76, 76,214,144, 36, 57,140, 36, 73, 91,189, 94,143,128,128, 0,244,235,215, 15, 2,129, 0,
- 20, 69,149,105, 52, 75,181, 84,213,104, 58,194, 30, 63,126,108,246,248,241,123,195, 86,103, 27, 27,155,219, 26,141, 6,241,241,
-241, 56,127,254,124, 39, 0, 33, 53,236,235,248,176,176,176, 94,190,190,190,135, 90,182,108, 89,159,101, 89, 52,105,210, 4,126,
-126,126, 56,124,248, 48,194,195,195, 81, 80, 80,192,220,184,113,227, 55, 0, 27,107, 58,135,151, 92,223,134,131, 7, 15,126,112,
-236,216, 49,203,220,220, 92,168, 84, 42, 40, 20, 10,156, 58,117, 10,237,219,183,135,141,141, 13,142, 30, 61, 74,179, 44, 91, 85,
-223,147, 36, 73,238,223,179,103, 79,191, 9, 19, 38, 96,231,206,157, 8, 10, 10, 66,255,254,253, 49,108,216, 48,100,103,103,219,
-111,216,176, 97,116,137,153,112,153,159,159, 31,228,114, 57,158, 61,123, 22,101,224, 51, 15,153, 76, 6,153, 76, 6, 99, 99,227,
-242,207, 24, 1,224,240,230,205,155,135,251,251,251,195,195,195, 99, 89, 66, 66,194,102, 84, 16, 37,202, 48,204, 20,137, 68, 98,
-201,229,114,173,105,154, 70,106,106, 42,158, 63,127,142,239,191,255, 62, 47, 47, 47,111, 50,128,100, 0,139,199,143, 31,191,106,
-206,156, 57,101,247,210,156, 57,115, 46, 93,185,114,165,215, 95,173,205,241,242,178,104, 44,224, 8,103,229, 23,113,172,243,243,
-243,203,198, 14,173, 86, 11,141, 70,243,158, 38,139,207,231, 89,183,110,238,118, 89,165, 44, 90,244,230,157,172,210, 2,233,222,
-245,205,155,138, 76,204,253,219,119,232, 50,178, 71,175,111, 57,180, 78,135,224,224,139,248,245,215, 93,232,236,235, 5,143, 6,
- 77, 48, 99,230, 44,115,141,150, 14,184,113,227,218, 2,139,199,247,175, 21, 21,202, 22, 86,133,249,255, 92, 46,151,144,171,203,
- 21,154, 14, 43, 98,144, 37, 41, 28,242, 75,118,109, 44, 45, 45,119,232,245,250,206,102,102,102, 96,100, 49,120,243,252, 9,242,
-242,121,208,168,244, 96,216, 98,178,101, 16,113,209,104,113, 47,248, 2,182,108,222,132,220,220, 92,248,126,221, 9,114,174, 43,
-220, 92,221,160, 86, 41, 75, 30, 26,128,210,234, 96,107,239,142,151, 47,195,117,133, 10, 69,165, 3, 18,223,136,242,118,179,247,
-130,134,250, 18, 70, 2, 1, 10,138,180,200, 47, 33, 89, 71, 79, 15,133, 70,169, 2,173,165, 64,107,117,176,117, 27,140, 47,236,
-187,128,209, 95,108, 92,163,203,199,232, 65, 37,222, 3,149,120, 15,198, 95,206,196,239,107,135,127, 48,145, 26, 86,119, 55, 59,
- 59, 59,235,245,235,215, 23,195,194,194, 6, 14, 29, 58, 20,119,238,220,153, 4, 96,106,137,249,102,210,208,161, 67, 17, 22, 22,
-134,215,175, 95, 95,204,206,206,206,250, 35,122, 94, 32, 16,168, 52,154,226, 57, 86, 36, 18, 25, 85,243, 93,231,214,131, 6,145,
- 5, 47, 95, 22,110,126,248,112, 89,224,254,253,252,110, 93,187, 18, 58,154, 6,163,215,163,129,167, 39,209,163, 71, 15,147,195,
- 39, 79, 90,115,116,186,199,243,166, 79,191,181,123,212,168,162,167, 10,133,161,142,230,117, 74, 76,134, 0, 80,167,138,207, 12,
- 22,141, 70,179,109,202,196,177,221, 66,238, 61,112,117,115,117, 54, 11,190, 17, 18, 46, 52, 22,144, 30,117,235,115,242, 11,242,
-184, 43,151, 45, 50,214,104, 52,134,146, 86,111, 27, 27, 27,100,100,100, 32, 54, 54, 22, 26,141, 6, 58,157, 14,140, 82, 1,109,
-190, 12,218,130, 60, 16,106, 21,132,122, 61,212, 57,153,168,227, 81, 15,248,111, 68, 98,181,166,168,138,136, 86,233,214,200,204,
- 12,124, 19, 49, 72, 30,207,224,226,232, 0, 90,182,105,211,230,228,153, 51,103,248,227,198,141,107,123,243,230,205, 29, 0,146,
- 37, 18, 73,215,165, 75,151, 62,221,177, 99,135,112,242,228,201, 13, 55,110,220, 56, 26,192,222,202, 64,212,106,245,201,203,151,
- 47,143,112,119,119,183,143,136,136,128, 90,173, 6,195, 48,232,221,187, 55, 80,236, 91, 3, 0,136,142,142, 86,169,213,234,172,
-200,200,200,194,228,228,100, 10, 6, 68, 9, 46,223, 38,125, 84,152,113,111,144,189,131,243, 99, 35,227, 58,117, 89,249,203,129,
-179,191,115,222,176,249,180, 68,125, 45, 62,190,104, 73,247,122,235, 20, 69,175,190,183,112,145,239,188,118, 41,193, 16, 71,248,
-178,232, 66,107,107,107,112,185, 92,240,120, 60,240,249,124, 16, 4,129,153, 51,103, 98,223,190,125,213,153, 14,223, 35, 89,166,
-166,166,175, 87,172, 88,225, 50,121,242,100,190,145,145, 17,242,243,243,113,244,232, 81,140, 31, 63, 30,191,254,250,107,133,254,
- 47, 6,152,148, 62,212,150,250,143, 26, 53, 10, 90,173, 22,126,126,126, 8, 12, 12,244,215,235,245, 33,181,120,164, 31,135,135,
-135,123,134,135,135,155, 1,232, 63,108,216,176,131,131, 7, 15, 70, 72, 72, 8, 46, 94,188,216, 9,197, 65, 31, 42, 0,107, 1,
-216,149,108,171,122, 62, 77,236,237,237,119, 49, 12,211,223,214,214, 54,220,203,203,203,231,216,177, 99, 22, 89, 89, 89,165,193,
- 15, 72, 76, 76,196,129, 3, 7,164,251,247,239, 47,212,235,245,214, 36, 73, 94,150,201,100, 11,171, 32,108,251, 55,111,222, 60,
-182,196, 28,136, 51,103,206,176,155, 54,109, 34,150, 46, 93,138,252,252,124,116,238,220, 25,123,246,236,153, 37,151,203,155,109,
-218,180,105,226,144, 33, 67,176,114,229, 74, 40, 20,138,205,213, 45, 86,170, 32, 95, 4,128,175, 54,111,222,236,238,239,239,143,
- 51,103,206,160,101,203,150,198, 9, 9, 9,187, 1, 76,168,168,255, 88,150, 69, 66, 66, 2,148, 74, 37, 30, 60,120,128,101,203,
-150,229,151, 35, 89,179,166, 78,157,186,106,214,172, 89, 88,179,102, 13, 27, 17, 17,145, 53,120,240, 96,251,125,251,246,113, 26,
- 52,104, 48, 75,169, 84,254,101, 68,171, 97, 3,171,117,173, 91,118, 88,224,232,220, 0, 71,143, 29, 71, 94, 94, 94,217, 53, 41,
-189, 46, 44,203,162,168,168, 8, 25, 25, 25, 48, 55, 51,197,134,141,171,190,153, 54,105,172, 43,138,211, 96,124,172,178,244,176,
-220, 56,120,216,184,185,126, 35,198, 34, 34,252, 5, 14, 31,220,139,200,136,176, 50, 60, 90, 71, 33, 38,234, 57, 98,162,158,195,
-222,193, 29, 61,186,117, 34,134, 15, 31,222,123,212,136, 97,182, 0,254,180,212, 17,255, 96,109, 22,240,113, 30,173,125,239, 17,
-173,106,212,117, 54,150,150,150,175, 79,156, 56, 97,237,235,235,203,161,105, 26,215,130,131,241,253,212,255, 96,244,168, 0, 80,
-176, 4,173,229,131,225, 27, 25,212, 18,149, 74, 9, 22, 44, 20, 10, 5, 66, 67, 67,193, 50, 52, 14,239,219, 4,150,101,202,136,
- 22,192, 66, 75, 81,112,118,107,136, 93,129,171,105,240,120, 79,161,171, 56,117, 77, 97, 46, 71,175,163, 89, 72,178, 82,144, 34,
-141,132,185,169, 27,184, 60, 55,228,202,148,224,146, 14,208,169,163,161, 47,249,173, 82,145, 6, 21,245,105,253,167,175, 64,123,
-202,214, 96,208, 85,169, 84, 71,142, 28, 57,242,205, 47,191,252, 34,232,211,167,143,215,233,211,167,191, 2,128, 62,125,250,120,
-153,153,153,225,200,145, 35, 90,149, 74,117,228, 15,212,248,116,105,211,166, 13,242,243,243,145,152,152, 24, 94,229,185,105,181,
-214, 98, 59, 59, 78,214,157, 59,186,236,252,124,215, 46, 93,186, 16, 58,154, 6, 73, 16,200, 43, 40, 64,114, 82, 18, 44, 44, 44,
-136,215,209,209,226,237, 51,102,156,243,242,241,225,150, 70, 36, 26, 34, 23, 47, 94, 20,161,216, 47,171,202,207,106, 40,138,172,
-204,140,177,211,167, 79, 63,119,228,200, 81,243,204,172,204, 24,161, 64, 64,139,197, 70, 78,163, 70, 78,227,202,100,178, 17, 0,
-228,134,130,229,231,231, 35, 33, 33, 1,198,198,198,224,243,120, 96, 84, 74,232, 21,114,168,243,178,193,161,180, 16,232,245,176,
- 18, 9,225,106,111, 15, 55, 91, 27,131, 48, 99,111, 95, 47,115,124, 47,111, 46,220,208,198, 27, 2, 19, 49, 4,166, 98, 76,187,
-116,183,100, 53,202, 7,150,254,100, 8,172,141,179,179,243,239,199,142, 29,227,103,103,103, 35, 44, 44, 44, 28, 64, 1, 0, 83,
- 0, 76, 84, 84,212,205,200,200,200,190, 37, 81,119,213, 69,139,109, 58,123,246,108,119, 95, 95, 95,186,110,221,186, 38, 89, 89,
- 89,174,249,249,249,140, 84, 42,125, 79, 37,116,253,250,117, 97, 81, 81,145,130, 97,152,115, 37, 36,171,218,252, 69,179,191,115,
- 54, 10,125,137,153, 29,123,214,105, 98,102,211, 20,121,244,203, 38,143,195,165, 51,103,127,231,188,109,243,105,137,218,152,208,
- 28, 36,244,169,174, 92, 35,181,161, 78,204, 44, 80,236, 43, 21, 26, 26,138,228,228,100, 36, 36, 36,188, 71,168, 38, 77,154,132,
-195,135, 15, 27,164,209, 50, 49, 49, 89,179,124,249,114, 23,127,127,127,126, 57, 82,132,233,211,167,163,160,160, 0,129,129,129,
-152, 62,125,122,141, 39,254, 15,164, 94,151, 46, 93,250, 56, 58, 58, 34, 55, 55, 23, 14, 14, 14,240,245,245,237, 23, 18, 18, 82,
- 23, 64, 98, 45,239,251,105, 61,123,246, 92,181, 98,197, 10,232,116, 58,140, 31, 63, 30,239,222,189, 59,249,238,221,187, 45,110,
-110,110, 51,231,207,159,111,111,111,111,143,161, 67,135,154,208, 52, 61,168, 50, 16, 43, 43,171,181,123,247,238, 29,209,167, 79,
- 31,146,162,168,175,111,223,190,141,164,164, 36,104,181, 90,208, 52,141,184,184, 56, 76,159, 62, 93, 90, 18,221, 24,103, 64,187,
-198, 45, 94,188,120,236,204,153, 51,177,126,253,122, 44, 95,190,252, 55,115,115,115,159,230,205,155,183, 88,190,124, 57,230,205,
-155, 7,119,119,119, 88, 91, 91,127,177,116,233, 82,239, 57,115,230, 96,219,182,109, 88,182,108,217,111, 0, 14,212,230, 66, 48,
- 12, 67,172, 91,183,174,217,230,205,155, 29, 75, 73, 22, 73,146, 56,113,226, 4, 94,190,124,217, 47, 62, 62,190,162,223,236,113,
-112,112,152,228,232,232, 40,184,113,227,134,216,221,221, 29, 52, 77,235, 74, 72,214,118, 55, 55,183,239,227,226,226,208,167, 79,
- 31,196,199,199, 31, 1, 48,218,220,220, 92, 49,103,206, 28,145,177,177,177,185, 82,169,252,171, 38,111,112, 72, 98,204,154,149,
-243,240,236,101, 52,206,158,229,227,217,179,103,176,183,183,135, 80, 40, 4,203,178,208,104, 52,200,206,206,134,142,210,160, 73,
-227,122, 56,180,127, 29,178,178,178, 1,146,168,212,229,134, 32,137,145, 99,255, 51, 16,247, 31, 4, 99,247,238,189,144,203, 21,
-149, 44,190,141,208,192,203, 27,206, 78,118, 72, 77, 75, 5, 65,194,230,207, 60,215,127,184,233,176,108, 8,130, 33,233, 29,202,
-139,133,133,197,150,160,160, 32,235,206,157, 59,115, 20, 10, 5, 24,134, 65, 7, 95, 95,204,244,247,199,197, 99,199,224,217,214,
- 15,132, 86, 12, 90,100, 88,212,131, 90,165, 68,163, 22, 95, 97,200,208, 97, 72, 73, 78, 70,207,190,131,161, 86, 43,203, 86, 24,
-165, 26, 45,173,150,130,141,157, 43,174, 95,191,206,193,248,241,111,176,189, 98,165,132,158, 18,188,138,137, 83,183,151,169, 94,
- 34,244,217, 97, 80, 26, 10, 77,154, 44, 5,197, 88,195,206,101, 18,116,186,243, 40,204,190, 93,108,198,176,238,140,180,148, 20,
-144, 28,254,235,218, 94, 65, 70,145,253, 73,131,110, 65, 65, 65, 65, 66, 66,194,233,208,208,208,145,131, 6, 13,194,245,235,215,
- 39, 2,192,160, 65,131, 16, 26, 26,138,132,132,132,211, 5, 5, 5, 5,127, 68,111, 59, 58, 58,246,239,212,169,147, 95,235,214,
-173,113,233,210, 37,176, 44,123,223,160, 7,155,199, 99, 73,146, 4,195, 48, 32, 0,228,202,100,120,247,238, 29,114,115,114,160,
-211,233,160,144,203, 25,111, 47, 47, 57,203, 48,166, 53,105, 79,249, 8, 67, 84, 16,117, 88,250, 89, 45, 78, 53,249,233,227,135,
- 41, 69,114,185,173,165,133,101,145, 64, 32,208,231,203,100, 5,111, 94, 71,104, 13,156, 28, 74, 37, 42, 50, 50,210, 39, 61, 61,
- 29, 41, 41, 41,160, 21, 69,224,104,180, 32, 53, 74,116,253,234, 75, 24,131,133, 17, 24,240, 24, 29,120, 28, 30,138,138,163,243,
-170, 53,119,232,203, 45, 18, 74, 73, 22, 65, 16,197,230, 66, 19, 19, 8,196,166,239,105,184, 12,185,159,132, 66,225,177, 83,167,
- 78, 57, 58, 59, 59, 99,229,202,149,112,113,113,249,194,201,201, 73,105,110,110,110,108,111,111,143, 70,141, 26,225,171,175,190,
-194,213,171, 87, 97,192, 53,160, 89,150,237,113,255,254,253,185, 15, 31, 62, 28, 98, 98, 98, 66,204,152, 49,131,219,187,119,111,
- 8,133, 66, 40,149, 74,228,231,231,227,248,241,227, 57, 12,195,148, 6,165, 88,139, 68,162, 3, 4, 65, 36, 42, 20, 10,255, 15,
- 1, 15,253,210,196, 41, 43,143, 25,207,202, 69, 3, 59,246,172,211,164, 75,207,110,168,231,217, 5, 93,122,166, 0,192, 58, 43,
-110,146,223,207,139, 45,206, 89,152, 18, 7,174, 95,187,177,204,183, 99,151,197, 11,228,119, 86,173,223, 39,171,214,159,142, 32,
- 8, 48, 12,243, 94,238,160, 15,143,143, 30, 61, 26, 39, 78,156,168,246, 58,146, 36, 57,108,242,228,201,252, 15, 52,207,144, 72,
- 36,232,219,183, 47, 6, 13, 26,244, 30,209,178,177,177,129,131,131, 3,146,146,146, 0, 32,215,192,251,106,230,184,113,227, 8,
-149, 74,133, 9, 19, 38, 32, 48, 48, 16,126,126,126, 68, 72, 72,200, 76, 0,254, 53,189,217, 73,146,220, 48,127,254,252,185,211,
-167, 79, 71, 94, 94, 30,174, 92,185,130,222,189,123,227,196,137, 19,182, 87,174, 92, 89,211,185,115,103,112, 56, 28, 92,186,116,
- 9, 52, 77, 87,153,235,139,207,231,247,239,211,167, 15,153,154,154, 10, 62,159,143, 86,173, 90, 33, 45, 45, 13, 74,165, 18, 18,
-137, 4,179,102,205,202,200,205,205,237,100,232,115,196,231,243,253,103,206,156,137,160,160, 32, 4, 4, 4, 28, 4, 48,161,160,
-160, 96,200,195,135, 15,131, 6, 12, 24, 0,137, 68,130,115,231,206, 97,217,178,101,196,232,209,163,177,115,231, 78,204,154, 53,
-235,183, 18,173, 83,101, 55,126, 81, 86, 86,150,121,253,250,245,145,153,153, 9,185, 92,142,115,231,206,217, 93,189,122,181,174,
-179,179,179, 89, 66, 66,130,254,167,159,126, 18,248,251,251, 99,203,150, 45, 8, 11, 11,195,225,195,135,209,165, 75, 23, 58, 62,
- 62,190, 66, 45, 89, 73,202,134,115, 44,203,222, 48, 49, 49, 65, 81, 81, 81,233,115,247, 67, 64, 64,192,244,181,107,139,149,236,
-233,233,233, 24, 51,102,204,168, 91,183,110, 49,157, 59,119, 22,241,249,124,168,213,106,197, 95, 57,107, 51,122, 6, 0,131,186,
-174, 98, 4, 95,220,143, 23,225,241,120, 17, 30, 9,129,176,216, 9, 94,165, 82,162, 69,147, 6,104,219,170, 13,210,165, 18, 28,
- 57,188, 31, 86, 54,206, 85,142, 35, 44,203,130,207,213,195,219,203, 1,199, 14,239,197,165, 43,183,112,248,200,241, 50,159, 55,
- 46,151,135,230, 45,218,162, 85, 43, 95,196, 39,196, 97,255,254,221,176,181,115,253,108, 28,172,165,148,153, 14,203,111, 63, 96,
-254, 93,124,125,125, 57,114,185, 28,106,181, 26, 25, 25, 25, 72, 74, 74,130,133,165, 5,226,211, 19,209, 73, 68, 33,131, 41, 68,
- 84,248,107, 61,193,225,133, 85,247,135,125, 58, 54, 7, 58, 54,199,247,227,252,170, 88,178,178, 48, 49,179, 41, 54,221,208,116,
- 44,182,109,163, 43, 35, 90,180, 94,119, 51,248,198,237, 54,227, 70,247,231, 93,191, 29, 8,157,150,129, 74,103, 14,133, 90, 11,
- 5,197, 3,105,222, 27,200, 9, 1,135, 43, 68,187,102, 13,112,238,236, 85,138,165,117,183, 12,190, 64,246, 62,160, 51, 35,203,
- 17,173,172, 15,236, 14, 86, 6,155, 14,203, 38, 94,189,254,196,209,163, 71,191,253,242,203, 47, 69,157, 59,119,174, 95, 50,113,
- 82, 71,143, 30, 85,150, 36,195,172,169,188,151, 13,222,193,193,161, 5,159,207,247,235,221,187,119,139,177, 99,199,226,205,155,
- 55, 56,114,228, 72, 76,131, 6, 13,238, 72,165,149, 71,100,115, 4,130, 92,121, 86,150,133,184,110, 93,174,165,169,105,250,213,
- 43, 87,220,187,117,239, 78,164,164,164, 32, 55, 55, 23,106,181, 26, 97,225,225, 44,143,195, 73, 35,204,204,200,232,151, 47, 73,
-142, 64,144, 91,153,182,177, 2, 73,170, 38,234,112,109,109,181, 91,174,142,150,245,151, 5, 76,169,167,214,168,125, 10, 11, 11,
-105, 46,143,199,115,113,176, 72,142,142, 51,124, 76,212,104, 52,151,110,222,188,249,109,183,110,221,132, 49,175,194, 64, 23, 20,
- 64, 91,144, 15, 62,163,135, 85,139,102,224, 80, 26, 64,171,131,179, 55, 11,181, 76,132,144, 39,209, 58,141, 70, 83,109, 82,195,
- 82,162, 69,126, 64, 12, 4, 98, 49,132,166,102, 16,138,197, 31, 18,134,234, 86,114,162, 30, 61,122,116,109,215,174, 29, 88,150,
-197,190,125,251, 64, 81,148,128,162, 40,104,181, 90, 80, 20,133,194,194, 66, 28, 62,124, 24,187,118,237,122, 8,224, 55, 3, 78,
-159, 54, 54, 54, 30, 64, 16,132, 29,151,203, 85,218,218,218,154,156, 56,113,162, 44,221, 68,243,230,205, 97,106,106,202, 71, 73,
- 82, 72, 59, 59, 59,222,175,191,254,106,209,175, 95,191,123, 21,154, 59,154,124, 49,175, 30,109,217,209,200,184, 78, 93, 51,155,
-166,168,231,217, 5, 0,208,189,239, 56,212,107,224,134,194,156, 87,117,213,170,164,129,124,110,190,229,235,109,146, 55,198,125,
-124,198, 42,178,238,190, 67,197,225,253, 21, 78, 20, 36, 73, 86,106,142, 53,132,100, 21,115, 22,210,182,212,207, 7, 0,114,115,
-115, 33,149, 74, 17, 21, 21,133,134, 13, 27, 34, 47, 47, 15,206,206,206,208,106,181,104,221,186, 53, 84, 42, 21, 54,111,222,140,
- 7, 15, 30, 60, 4, 48,203,128,255, 48,246,244,244, 28,211,162, 69, 11, 92,185,114, 5,207,158, 61,147, 4, 7, 7, 59,251,250,
-250,162,110,221,186, 99, 19, 19, 19, 23,149,152,250, 12, 21, 19, 95, 95,223, 25,211,167, 79, 71,100,100, 36,166, 76,153,146,155,
-154,154,122,238,228,201,147, 19,150, 45, 91, 70,246,236,217, 19, 82,169, 20, 27, 54,108,208, 63,120,240, 96, 35,128,149,213, 92,
-199,183,169,169,169, 46,106,181, 26,121,121,121,160,105, 26, 74,165, 18, 87,175, 94,197,225,195,135, 51, 75, 72, 86,172,161,141,
-107,214,172, 89, 35,146, 36, 17, 20, 20, 4, 0, 75, 80,156,177,255,220,192,129, 3, 37, 63,253,244,147,243,194,133, 11, 49,113,
-226, 68, 80, 20,133,245,235,215, 99,225,194,133,151, 75, 72, 86, 85,131,232, 47, 14, 14, 14,147,166, 76,153,242,197,156, 57,115,
- 16, 26, 26,106,247,252,249,243, 86, 97, 97, 97,112,117,117, 69,110,110, 46,215,218,218, 26, 91,182,108,193,236,217,179,207, 0,
-200,121,244,232,209,176,132,132,132,181, 0, 54, 84, 67,218,247, 56, 59, 59, 79, 98, 89,150, 85, 42,149, 73, 1, 1, 1, 27, 86,
-175, 94,141,217,179,103,227,245,235,215, 40, 40, 40,128,169,169, 41, 49,127,254,252, 49, 75,150, 44,193,248,241,227, 89,133, 66,
-177,235,175,158,168, 89, 86, 15,101,126, 36,244, 26, 75, 52,111,210, 16,205,125,234, 32,248,246, 11, 0, 64,215,193,190, 80, 42,
-138,112,240,224, 62,196,198,190, 3,151,199,131,133,149,131, 33,154, 64,104, 11,223, 66, 70, 73,209,173,115, 43,244,238,217, 9,
-191, 29, 58, 1, 90, 71, 97,194,184, 17,200,151,201,112,232,208,126,196, 39,196,129,203,227,193,218,230,207, 79,132, 90, 21, 23,
-249,199, 19, 45, 3,204, 79, 96, 24, 6, 18,137, 4,207,159, 63, 71, 98, 98, 34, 68, 34, 17, 84,180,158,217,125,243, 1, 67, 16,
-252, 52,134,101, 31,178,116, 89,150,226,143, 49,244,122, 73,185,140,181,230,150,150,150, 2,141, 70, 5,154,214,149,155, 85, 8,
-128, 0,248, 92,192,209,169, 30, 82, 83, 82, 89,181, 90,125,183,202, 21,148, 70,189,229,194,185, 83,211,191,106,239,107,211,187,
-235, 10,156, 59,191, 20,249,133,133, 80, 83, 60, 40,212, 20,148,106,192,194,202, 11,173,155, 52, 69,122,122, 46, 94, 61, 11,145,
-115, 53, 74, 67, 28, 69,223,109, 95, 60,206,115,220,247,243, 96,236,222, 30,154,168,115, 96,228,153,101, 26, 45, 35,177, 37,172,
-220,188, 33, 83,104,112,234,214, 11,160, 6,165, 94,178,178,178,148, 28, 14,231,232,244,233,211,215,191,120,241,220, 5, 0, 94,
-188,120,145, 38,149, 74, 23,100,101,101,213, 84, 39, 93,154, 13,158, 48, 50, 50,126,209,160, 65,131,244, 86,173, 90,153, 15, 28,
- 56, 16, 54, 54, 54, 8, 11, 11,195,218,181,107,223, 82, 20, 53, 47, 36, 36,164, 74, 83,143, 86,171,149,188, 56,127,222,172,211,
-127,254, 99, 49,175, 95,191, 13,211,167, 79,223,178,114,229, 74,158,167,167, 39,161,163, 40, 68, 68, 68,176,199,142, 30,213,237,
- 90,184,112,179,192,196,132,251,244,194, 5, 58, 60,122,154, 0, 0, 32, 0, 73, 68, 65, 84, 30,173,209, 72,254,238,155,216,217,
-217,185,163,239,215, 29,188, 55,254,178, 13,106,149, 28, 79, 66, 47, 35, 63, 63, 27,123,247,157,245,118,118,102, 59, 74, 36,146,
- 16, 67, 9,240,129, 3, 7,230,182,109,209,162,133,135,171, 43, 34,146, 19, 33, 96,244,224,211, 52, 56,148, 6, 36,173,134,171,
- 15, 11,130, 52,133, 52,163, 16,171,131, 78, 71, 26, 66,140,191,248,166, 63, 86,166, 21,128, 32, 8,108,250,210, 7, 2, 83, 49,
-248, 38, 98, 76,251,253,118, 25, 49,184,180,114, 33, 4, 98, 49,234,183, 53, 40, 33,188,242,206,157, 59,207, 35, 34, 34, 90,251,
-248,248, 96,238,220,185, 72, 74, 74, 2,195, 48,200,204,204, 84, 75,165, 82, 73,118,118,118, 18,138,243,255, 4, 86, 51,137,149,
-103, 29,206, 33, 33, 33,101,230,134, 91,183,110,193,201,201, 9,230,230,230, 40, 44, 44,196,228,201,147, 45,126,252,241, 71, 0,
-192,243,231,207, 81,158,160,124, 40, 17, 47,162, 54,202,138,216,124, 86,254,114, 96, 30,253,178, 73,151,158,169,232,222,119, 44,
-110, 92,250, 13,183,131,111,194,138,155,148, 8,147,162,171, 57,137, 57,133,105, 10,207, 61,222, 45, 39,112,164,138,224, 61, 51,
-250,199,112, 28, 29,153, 83, 11,119, 23,202,170,106,171,167,167, 39,236,237,237,203,124,180,184, 92, 46,198,143, 31, 15,150,101,
- 13, 37, 89, 37,115, 13,147,173, 86,171,237,141,140,140,144,145,145,129,184,184, 56,196,199,199,151,165, 14, 96, 24, 70,247,195,
- 15, 63,240,102,204,152,129,221,187,119,227,238,221,187, 15, 1,172, 0, 96,232, 98,109,196,208,161, 67, 77,181, 90, 45,142, 31,
- 63, 78, 3,232,123,234,212,169,231,173, 91,183,230,246,234,213,203,116,231,206,157, 35, 74,250,200, 96,162,101,102,102,198,167,
- 40, 10, 59,119,238, 68,106,106,106, 71, 0, 81, 79,159, 62,221, 51,116,232,208, 93, 62, 62, 62, 13, 34, 35, 35,223,201,229,242,
-105, 0, 94, 85, 7,150,153,153, 57,174, 85,171, 86,167, 24,134,113,239,214,173,155,201, 47,191,252, 98, 22, 29, 29, 13, 23, 23,
- 23, 48, 12, 19,129, 26,150,176,122,247,238, 93,148, 84, 42,245,238,212,169, 19,174, 94,189,186, 78,175,215,175, 1,176,126,234,
-212,169,206,201,201,201,104,209,162, 5,172,172,172, 16, 29, 29, 93, 36,149, 74,119,161,184, 36, 81,117, 42,220, 4, 0, 11,246,
-236,217,211,116,207,158, 61,126, 86, 86, 86,237,194,194,194,112,255,254,125,108,220,184, 17, 63,254,248, 35, 58,116,232,128,185,
-115,231,230, 0,240, 3, 64, 39, 36, 36, 24,148, 55,175, 84,179, 5, 0, 45, 91,182, 76, 95,187,118, 45, 38, 76,152,192,254,250,
-235,175, 91,143, 30, 61,234, 63, 98,196,136,178, 57,112,204,152, 49,236,145, 35, 71,198,160,184, 12,211, 95, 41, 58,138,210,194,
-204,170, 30,228,178, 20,100,167,134, 66,100,234,128,158, 93,154, 65,169,210,226,226,133, 51,120, 21, 17, 14,146, 36, 97,239,224,
- 10, 11, 75, 27,196,196,188, 3,170,142, 54,214, 81, 20, 5, 83,203, 58,144, 23,164, 66,155,245, 2,198, 98, 59,140,253,207, 64,
- 40, 85, 20,206,158, 59,131,200,200, 87,224,112, 56,112,112,116,133,185, 69, 49, 38,193, 86, 29,193,252, 89, 0, 84,144, 79,171,
- 90,162,197,225,112,238, 92,187,118,237,187,182,109,219,114, 99, 99, 99, 17, 27, 91,188,184,201,207,207,167, 9,232, 79,103, 69,
- 92, 24, 94,197,207,187,161, 36, 58,163,124,237, 66,177,169,169, 36,250,109,148,125,126, 94, 38,194, 95, 62, 64,108, 76, 4, 18,
-227,163, 64, 81,106,112, 72, 18, 36,135, 68,157,122,141,241,224, 97,168, 86, 77,211,161,149, 97, 22,183, 35,190,200,196,206,115,
-216,170,149,139, 46,205,158,183,220,120,200,119,187,241, 42,250, 13,228,180, 3, 88, 22,112,176, 54, 65,115,143,249,144,164,103,
- 35,232,183,157, 74,134,162, 70,126,144, 67,235, 35, 76, 0,176,207, 65,163, 93,251,126, 27, 31,120,248,216,242,121, 51, 38,219,
- 15, 24, 52, 18,130,188, 55,208,165,191, 64,189,214,189, 65, 8, 45,112,229,250,109,132, 60,127,147,201,232,217,229,246,185,248,
- 53,166, 26,204,242, 34,147,201, 30,101,100, 72, 93,202,101,129,119, 17, 10,141,170,139,142,251, 16,243,189,140,243, 28, 14,217,
-114,213,170, 85, 58,123,123,123, 42, 50, 50, 18,187,119,239,102, 94,188,120,113,157, 36,201,237, 82,169, 84, 93, 29,166,173, 78,
- 23,126, 44, 32,160, 81,155, 65,131,216,225, 51,102, 40, 33, 20,206,220,176,105, 83, 64,118,126,190, 19,203, 48,176,181,178, 74,
-219,176,112,225,218,239,134, 14,205,127,253,224,129,113,232,249,243,198, 2,154,126, 97, 64, 59,255, 8,169, 20, 83, 34,145,132,
-220,189,123, 31, 7, 3,127, 1, 69,105, 32,149, 36, 3, 0,114,114, 11, 80, 13,201,250, 16,147, 85, 42,149,131,150,252,248,227,
-227, 37,179,253, 29,190,238,218, 13, 41,225, 97,160,242,178, 65,232,104,240, 8, 46, 20, 89, 34,100,101,202,177,224,200,201, 44,
-185, 82, 57,168,130, 73,162,194,118,150,106,172,132,102,166,224,155,136, 33, 16,155,190,167,197, 50, 50, 51,131,192, 68, 12,174,
- 64, 80,145, 3,247, 71,152,114,185,124,240,119,223,125,247,234,233,211,167,150, 19, 38, 76,192, 87, 95,125,245, 82,165, 82,117,
- 6, 80, 84,219,235,201, 48,140,228,235,175,191, 38, 9,130, 16,143, 28, 57, 82,152,157,157, 93,150, 89, 93, 46,151,227,234,213,
-171,104,216,176, 56,170,255,245,235,215,104,220,184,113,165,152, 19, 23, 68, 74, 0,172,156,253,157,243,134,199,225,210,153, 0,
-214,213,107,224,138,219,193, 55,113,255,118,104, 64, 59, 31,102,219, 55, 35, 91,255, 36,234, 60,116,158,119,203, 9, 28,177,153,
- 35, 14,157, 61,195,137,122,177,127,181, 82, 25, 81, 31,187,207,253, 80, 89, 59, 9,130, 0,203,178, 31,165,114,224,112, 56, 56,
-122,244,104, 77,207,253,100, 96, 96,224,212, 41, 83,166,240,165, 82, 41,222,190,125, 11,133, 66, 1, 35, 35, 35, 4, 7, 7,211,
- 0,118, 30, 61,122, 52,248,232,209,163,189, 80, 28, 77,116,171, 38,247,167,137,137,201,244,158, 61,123,226,237,219,183,120,246,
-236,217, 25, 0,175, 94,190,124,121, 38, 54, 54,118, 88,135, 14, 29,240,219,111,191, 77, 87,169, 84,129, 53,193,100, 24,166,124,
-206,164,210,138, 15,225,114,185,188, 93,104,104,104, 77,251, 93,154,155,155,219,190,132, 88,167,218,219,219,155,133,135,135,195,
-205,205, 13, 20, 69,181,173,233,189, 84, 80, 80,240,203,246,237,219,127, 29, 55,110, 28,126,250,233,167,145, 39, 79,158, 28,249,
-205, 55,223,160, 79,159, 62, 56,112,224, 0, 94,189,122,181, 14,134,149, 21,171,232,220, 95, 1,120,101,111,111,255,189,171,171,
- 43, 54,110,220,136,136,136,136,181, 43, 87,174, 92,248,234,213, 43, 52,108,216, 80, 24, 21, 21, 69,215,102, 12, 1, 0, 51, 51,
- 51, 51,157, 78,135,243,231,207, 63, 1, 48,123,228,200,145,118, 91,182,108,241, 19,139,197,200,203,203, 83, 69, 70, 70,142, 0,
-112,225,175, 30,235, 88,130, 88, 60, 97,226,204, 61, 19, 39,140, 48,106,213,178, 57,148,133,105, 80,201, 51,161, 44,202,192,246,
-192,235, 32, 8, 18,182,182,142,176,115,112, 65,114,114, 10, 30, 94,190,162, 85, 40, 85, 91, 4, 58,102, 93,213,152, 51,138, 49,
- 91, 20, 99, 42, 21, 89, 80,201,179,202, 48,237,236,156, 74, 48,147,241, 32,244,138, 90,165, 80,252,162,101,137,159,255,228,115,
-255, 39, 75,205,106, 29,150,151,252,252,252, 89,147, 39, 79,238,188, 96,193, 2,107,154,166, 57, 86, 86, 86, 72, 78, 78,166, 79,
-159, 62,157, 39,151,203,103,213,166, 53, 92, 30,239,149,167, 87,195,206, 3, 6, 12,160,251,247,239,199, 31, 53,174, 23,215,214,
-206, 14, 5,178, 92,196,188, 13, 67,244,155, 23,240,108,216, 12,203, 86,110, 6, 44, 44,170, 45, 36, 89, 82, 86,167,239,138, 37,
- 63,156,104,223,177,135, 89,195,198,205,248,205,235,155,131,210,209, 72, 75, 75,195,133,243,225, 84,228,243,251,133, 12,173, 29,
-166,204, 49,172, 4, 79, 8, 64, 35, 23,123,125,236,168,163,107, 54,108,159,187,115,239,193,121, 11,102, 78, 48,233,224,219, 29,
- 17, 55,127,195,153, 75, 39, 20,106,141,118, 3,159,131, 77,145,185, 80,198,212,240, 26,168,213,106,234,195,249, 84,173, 86, 83,
-159,218,211, 7, 14, 28, 64,102,102,166, 54, 41, 41,233, 26, 77,211, 39,171, 40,246,252,145,108, 7,180, 3, 53,154,155, 75,124,
-125,123, 45, 9, 14, 54, 26, 51,127,190,118,228,168, 81, 63, 64,163,161, 32, 16,176, 92, 19, 19, 18, 66, 33,239,245,131, 7,198,
- 91,167, 78,181, 34,180,218, 27, 7,171, 72, 27, 80,129,252,225, 81,135,165, 26,173, 78,157, 58, 96,204,132,217, 80,149,211,104,
- 61,122, 22, 3, 13, 5,131, 53, 90, 37,146,146,148,154,218,110,230,226, 37,103,135,245,236,234,237,227, 94,231,255,216,187,238,
-176, 40,174,245,253,206,204,246, 93,138, 72, 71, 20, 43, 74, 81, 80,108,216, 16, 75,236,137, 53,118, 81, 19,141,221, 88, 34,234,
- 53,150, 68, 33,154,216, 53,106,212, 88,110,236, 45, 98, 23, 13, 26, 27, 42, 74, 81, 68, 69, 4, 4, 68,122,221, 58, 51,231,247,
- 7, 69, 68, 88, 22, 52,191,155,155,187,239,243,204,179, 59, 59,103,190, 61,115,206,204, 57,239,188,231, 59,223,145, 88, 55,168,
- 15, 19, 59, 59,100,164,165,225,207,187, 79,116, 43, 14, 29,143, 44, 38, 89, 6,197,149,225,121,190,200,201, 29, 64,247, 89, 11,
- 64, 49, 12, 80, 28,198,161,100,230, 80,131, 54, 29, 64, 9, 4,224, 8, 15,181, 90,109,136,211,223,171,231,207,159, 15, 25, 61,
-122,116,112, 80, 80, 16,221,171, 87,175,150, 39, 78,156,224, 63,228,222, 81, 42,149,237, 1, 64, 42,149,198,213,170, 85,171,206,
-132, 9, 19,160,211,233, 80, 88, 88,136,156,156, 28,188,122,245, 42,123,194,132, 9, 90, 0,144,201,100,226,161, 67,135,154, 85,
-101,115,221,209, 36,213,215, 67,235,108,172, 45,120, 57, 34, 55, 61,188, 65,109,193,203,184,246,205,249,141,235,142, 38,169,204,
- 28, 10,190, 79,127, 25, 18,147, 82,112, 97,219,222,227,199,152,113,131,134,112,142, 38, 79,253,165, 54,228,104, 85,118, 41,138,
-122, 47, 56,169,129, 36,235, 29,228,229,229, 45, 92,178,100, 73,191,172,172, 44,199,222,189,123,139, 92, 93, 93,113,251,246,109,
- 4, 5, 5,177,183,110,221, 74, 44, 40, 40, 88, 4, 64, 5,224, 98, 77,202,180,105,211,166, 13, 4, 2, 65,201, 80,218,230,226,
-159, 55,159, 56,113, 98,248, 23, 95,124,129,250,245,235,187, 61,126,252, 88,130,106, 60, 71,132,144,210, 81,134,143, 9,138,162,
- 98, 55,108,216, 80,199,206,206,142, 58,119,238, 28,203, 48, 76, 77,148,155,221, 59,119,238,108,167,211,233,190,156, 52,105, 18,
-124,124,124,192,178, 44,246,239,223,143,157, 59,119, 26, 74,178,244, 34, 38, 38,230,126, 98, 98, 98,151,121,243,230,225,199, 31,
-127, 92, 56,111,222, 60, 36, 38, 38, 34, 38, 38,230,193,135,216,205,205,205, 85, 38, 36, 36,200,189,189,189, 91, 71, 70, 70, 70,
-250,250,250,186,127,241,197, 23, 8, 12, 12, 36,127,252,241,199, 80, 0,231,254, 19,189,247,147,103,153,251,132,156,224,194,138,
-239,215,126,219,184, 81,131,175, 38,142,255,156,105,234,236,142,130,156, 87,176,180,178,133, 99,221,134, 72,123,147,142,243,231,
-207,113,233,233,217,187, 57,154, 90,254,236, 89,102,242,135,216,172,227,216, 16,111,222,188,193,217,179,103,185,236,172,220, 29,
-208,209, 43, 30,199,103,167,194, 8, 67,148,172, 73,208, 19, 37, 94, 31,172, 44, 44, 44, 14,152,153,153,165,154,153,153,165, 90,
- 88, 88, 28, 0, 12,154,125,208,163, 76,235,192,188,179, 13, 29, 42,133, 84,218, 30, 2,193,156, 90, 22, 22,231,204,205,205, 51,
-186,118,237,170,217,182,109,155,234,241,227, 40, 62, 41, 41,145,152,155,155,231,148,166,175,200,102, 57, 88, 88, 52, 50, 85,216,
-187,127,107,238,216,242, 79, 19,123,183, 60, 19,123,183, 60,115, 71,207, 27, 10,123,183,101, 22, 22,141, 76, 13,202,103, 37,104,
-104, 3,107,103, 43,108,105,102, 77, 41,157,173,176,165,161, 13,172, 13,190,118,253,195,126, 28, 69,129, 67,209, 52,108,212,192,
-102,137, 13,158, 97,152, 61,142,142,142,246,168, 94,192,186,247,108,142, 1,234,143,145, 72,190, 60,226,239,239, 23,247,199, 31,
-163,115, 95,188, 24,153, 19, 27,251,249,131, 67,135,134,111, 30, 62,124,204, 72,137,100,210, 80,160,145,161, 54,237,237,237, 3,
-238,223,191, 31,100,232, 86,134,120, 25, 92,158,141, 26,214,185,208,171, 71, 59, 50,125,242, 96, 50,125,242, 96,210,171, 71, 59,
-210,168, 97,157, 11, 31, 80, 71, 20,195, 48, 35,228,114,249, 1,133, 92, 30,161,144,203, 35,228,114,249, 1,134, 97, 70, 64,191,
- 15,213, 59, 54, 45, 45, 45,239,217,218,218,166, 86,103,179,178,178, 10,171, 70, 62, 71, 54,104,208, 32,145,166,233,117,213,124,
-166,245,217,116,150,201,100,177, 10,133,226, 85,217, 77, 38,147,149, 13, 12,101, 41,151,203, 79, 43, 20,138,245,134,216, 92,189,
-216,253,219, 27, 23,167,133,175, 94,236,254,109,249, 99, 51, 6, 90, 76,184, 29,188, 60, 99,198, 64,139, 9,134,228,211,198,198,
-230, 15, 27, 27,155, 20, 27, 27,155, 20, 91, 91, 91,189,155,149,149,213, 61, 3,108, 74, 77, 77, 77,215,155,154,154,166, 42, 20,
- 10,206,196,196, 36, 85,161, 80,172, 67,153,208, 22, 53, 45, 79,154,166, 3,221,220,220, 84, 12,195,236, 42,119,232,199,198,141,
- 27,171, 4, 2,193,154,106,218, 52,235,220,185, 51,247,240,225, 67,226,227,227, 67, 0, 88,124,196,122,183,179,176,176, 56,103,
-102,102,150, 96,106,106,186, 9,128,162,134, 54, 41, 0, 35,234,212,169,243,160, 91,183,110,133,117,234,212,185, 9,224,179,143,
-152,207,126, 3, 7, 14,228, 19, 18, 18, 8, 33,132, 36, 36, 36,144,129, 3, 7,242, 40, 10, 20,249, 33,109,242,226, 41, 83,166,
-144, 91,183,110,145, 91,183,110,145,155, 55,111,146,126,253,250,241, 0,198,126, 96, 59,143,143,117,237,174, 13,173, 26,185, 52,
-177, 56, 60,106, 72, 39,254,226,169,117,100,233,162,175, 72, 79, 31,119,210,172,177,197,113,103,103, 75,231,143, 97,243,219, 69,
-147, 73,143, 46,110,188,107, 35,139, 67,174, 13,173, 26,253, 63, 95,251, 63, 81,213,194, 95,237,112,246, 86, 90,124,151, 44, 85,
- 12, 7, 7, 7,100,100,180,147, 10, 4,157, 36, 18,137, 47,205, 48, 87, 51,211,210,102, 23,191,110,113,255, 95, 82,173,222, 14,
-189, 17,196,122,150, 36,168,137,205,119, 28,217,107,104,179, 58, 54, 12,178, 89,217,162,210,188, 90,157,108,201,178,247, 54, 65,
-111, 25,188, 99,179, 78,157, 58, 95,242, 60,223,192,208, 12,209, 52, 29,151,148,148,244, 75, 77,202,179, 73,147, 38,164,120,120,
-155,250,152,245,254, 87,220, 75,255, 75, 54,247,174,109,225,208,172,133,203,252,136,251,143,127, 44, 30, 86, 44,197,178, 25, 22,
-166,157,186,117, 93,242,231,149, 63,190, 91,182, 41, 43,239, 63,124,237, 52, 12,244,105,251, 8, 54, 75,130,132, 86,203,166, 80,
- 40,220,214,182,109,219, 47,111,223,190,189,139,227,184, 73,255,163,247,103, 63,134, 97,230, 53,109,218,180,101, 76, 76,204, 3,
-142,227,126, 68, 5,129, 34,107,144,207, 69, 13, 26, 52,152, 42, 18,137, 36,249,249,249, 89,201,201,201, 75, 0, 28,254,187,149,
-167,107,147,218,173, 9, 41, 13,186,189, 50,250,121,102,232, 71,179, 73,120,142, 39,204,247, 49, 47, 50,194,254, 3,245,254, 79,
- 35, 89, 59,254, 63,254,184,135,209,166,209,166,209,166,209,166,209,230, 71,183, 41, 51,150,167,209,230, 63,208,230, 63, 18, 2,
- 99, 17, 24, 97,132, 17, 70,252,215, 65,105, 44, 2, 35,140,248,219,161,172,170, 85,170,102, 81,122, 88,105,117, 36,193,154, 48,
-219,203, 70,155, 70,155, 70,155, 70,155, 70,155, 70,155, 70,155,255,115, 54,255,169, 36,107,135,158,253,191, 12, 70, 89,213,104,
-211,104,211,104,211,104,211,104,211,104,211,104,243,127,129,104, 85,184,111, 28, 58, 52,226, 47,199,198, 65,168, 3, 0, 51, 79,
- 32,233,175, 72,111,132, 17, 70, 24, 97,132, 17,255, 97,236, 64, 37, 67,135,127, 7,162,229, 0,160, 61,138, 22,190,125, 2,224,
- 58,128,172, 15,176,103, 5,224,115,138,162,134, 1, 0, 33,228, 8,138,102,141,164, 27,114,178, 84, 42, 77, 85,169, 84, 54,197,
-223,223,168, 84,170,178,107, 25, 80,120,127, 54, 27, 41,179, 85,136, 6, 13, 26,164,170,213,106, 27, 3,254, 62,135, 16, 18, 78,
-211,116,132,137,137,201,149,152,152,152,160,234, 92,184,175,175,175, 31,195, 48, 43, 1,128,227,184,197, 87,175, 94,221,243, 23,
-214, 91,187,186, 14,118,191,106,117, 90, 54, 53, 45,115, 9,222, 15,228, 7, 0,216,210, 31, 1, 20,139,249,197,223,215, 76, 11,
-210, 31, 71,167,186,233,245,160,181, 80, 40,156,110,107,107,219,231,213,171, 87,247, 0,124, 3, 84, 29,213,184,110,221,186, 99,
- 5, 2,193,104,142,227, 26, 49, 12, 19,203,178,236,191, 19, 19, 19,247, 25,219, 16, 35,140, 48,194, 8, 35, 12, 32, 91,239,161,
- 90, 68,171,153, 37,236, 8, 48, 2, 20,122,130,224, 18, 5, 28,124,146,129,215,134,158,223,183, 25,116, 58,182,232, 63, 69, 52,
-184,115,207,233, 29,125,250,244,113,156, 49, 99, 6, 58,116,232,128,219,183,111,123,239,222,189,123,194,225,195,135,195,121,158,
-191, 10,224, 54, 96, 80, 40, 5, 5,138,226,180,140,234,211,167, 79,143,149, 43, 87, 50,238,238,238, 80, 42,149,248,227,143, 63,
- 58,173, 89,179,102,253,141, 27, 55, 46, 3,248,173,152, 16, 84,186, 0,158, 74,165,178, 41, 89,140,147,162, 40,155,161, 67,135,
-134,150, 37, 87,197,235,171, 81,132,144, 91, 20, 69,221,228, 56,238,246,209,163, 71, 19,155, 1,237, 38, 55, 16, 29,157, 29,167,
-117, 44,111, 83,173, 86,219,156, 92,189, 10, 2,137, 4,234,188, 92,120,143,127, 75,122, 47,125, 59, 31, 20,207,130, 1,201,242,
-253,126,125, 56,128,136,228,228,228,112, 31, 31,159,184,234,214, 48,195, 48, 43,207,159, 63,111, 79, 8, 65,175, 94,189, 86, 2,
-248,171,136,150,164,125,107,207,171,167,143, 29,144,230,103,166,162,247,103,195,255,253, 52,241,141, 31,128, 99,239,144,166, 62,
-176,165, 40,204,159,178,234, 55, 6, 0,182, 46, 26,245,205,186, 79,176,241,235,139,120, 13,192,183,152,252, 0,192,106, 0, 87,
-183,244,129, 45,128, 5, 83, 86,253, 70, 1,192,207,139, 70,205,223,210, 7, 27,166,157,171,118,216,138,169,126,126,126, 27, 87,
-174, 92,201,216,219,219, 35, 41, 41,169,183,155,155, 91,211,220,220, 92, 55,232,113, 34,174, 95,191,254,161,206,221, 6, 52, 28,
- 60,108,132,220,218,202, 2,201, 41,233,102,135, 14,236,154,204,220,250,163,207,203,151, 47,135, 27,219, 16, 35,140, 48,194, 8,
- 35, 42, 65,205, 35,195,183,178,135,172, 64,139,129, 2,134, 26,219,177,181, 91,247,145,125, 59,211,110,174, 77,240, 40,234,241,
- 39,167,174,220, 89, 67,223,140, 10,102, 57,178, 79, 33,194,201,176, 20,253, 51, 97,116, 44, 4, 23, 79,254, 86,212, 19, 78, 24,
-197,132,134,134, 54,241,242,242, 42, 93, 26,166,123,247,238,232,222,189, 59,181,117,235, 86,207,139, 23, 47,122,238,220,185, 83,
- 27, 28, 28,252, 43,244,199, 71,153,222,184,113,227, 53, 27, 55,110,148,248,248,248, 64, 34,145,148, 30, 48, 49, 49,193,128, 1,
- 3, 48, 96,192, 0, 38, 57, 57,185,215,233,211,167,123,173, 94,189, 90, 19, 31, 31, 63, 15,111,163, 52,235,197,146, 37, 75, 90,
- 87,240,243,121,138,162,158,179, 44,251,192,211,211, 51,177, 41,208,100,114,223, 14,151,166,118,116, 86,204, 94,184,187, 66, 59,
- 2,177, 24,123,253,138,250,234,178, 68, 43,238,202, 57,152,152,153,102,200, 77, 77,195, 1, 68, 0, 8, 39,132, 68,196,198,198,
- 62,118, 1, 60,219, 91,208,191,238,202,226, 61,170, 65,182,144,152,152, 8,115,115,115,153,143,143, 79, 10, 69, 81,203,254,248,
-227,143,143,237,144,215,110,217,252,169,162,172,151,225,120, 29,125, 11,115,134,117,146,207,222,244,251,119, 42,141,238,152,190,
-147, 40,138,166, 87,223,228,253, 81,180, 24,239,146,140,140, 12, 31, 0,176,180,180, 20, 3,184,186,238, 14,250,126,221,145,250,
-144,216,110, 34,134, 97,182,236,222,189,251,139,177, 99,199, 22, 45, 29,241,231,159, 48, 49, 49,193,138, 21, 43,234,207,157, 59,
- 55,128,101,217, 89,149, 41, 89,157,187, 13,104,184,225,199,239,220,242, 50,115,212,219,183, 28,190,235,208,188, 25, 61,101,250,
- 92,211, 13, 90,181, 29,199,113, 99,141,202,150, 17, 70, 24, 97,132, 17,213, 81,179,170, 36, 90, 77,173,176,167, 85,115,231,207,
- 71,246,235, 36,105,209,220, 29, 34,201,219,208, 45, 94,173, 91,195,171,117,107,218, 63, 63,175,103,232,221,251, 61,143, 94,188,
-173, 46,212,197, 31,142, 73,135,159,161,185, 42, 89,148,118,229,103,182,221, 10,178,223, 72, 1, 64, 81,203, 70,181,232,228,235,
- 43, 29, 59,118,132,163,163,163, 40, 56, 56,120, 98, 21, 68,107,209,147, 39, 79, 36, 12,163, 63, 30,170,131,131, 3,134, 14, 29,
-138,102,205,154,137,187,118,237,186,168, 50,162, 37,149, 74,223, 80, 20,101, 3, 0,181,107,215,230,150, 45, 91,246,128, 20, 1,
- 0, 8, 33,228, 22, 77,211,183,121,158,191,243,251,239,191,191,114, 3,108,122,123, 53,187, 62,117,204, 80, 57, 57,186,190, 82,
-146,160,202,205,173,240,119,185,137, 34, 77,166, 80,132, 75,228,210, 8, 20,173,229, 21,225,232,232,248,216, 13,112,108,219,172,
-193,197,173, 95,143, 50,221, 53,233,187, 42,203,178, 85,171, 86, 77, 61, 60, 60,164, 28,199,161,160,160, 0, 63,255,252,179,185,
- 76, 38, 51,239,211,167,207,210,178, 55,128, 43,208, 98,136, 3, 51,105,121, 50, 55,173, 6, 55, 82,173,206,222,173, 95, 14, 29,
-208,199,172,117,251,206,120,122,117, 63, 50, 51,243,144,147,157, 15,158,231,223,139,235, 51,237, 28, 82,183,244,199,154,173, 11,
- 71, 45,160,104,154,242, 28,244, 13, 62,181,203,153,185,109,219,182, 40, 0, 66,177, 88, 92,246, 62,116,144,213,105,190,166,201,
- 39,157,241,243,226, 49, 32, 60, 79, 0,172,169,134,154,101, 99,106,106,122,234,226,197,139,237,218,180,105,131,219,183,111,227,
-197,139, 23,152, 58,117,170,102,218,180,105,162,113,227,198, 81,115,230,204,153,177,122,245,234,163, 0,110,188,247, 32, 8, 4,
-163, 63, 27, 60, 92,156,159,157,171,210,168,181,154,218, 86,181,120,117,129,170, 48, 61, 43, 87, 53,124,212,151,154,168,176, 59,
-163, 1,188, 71,180, 62,176, 60,141, 48,194, 8, 35,140, 48, 0,132,144, 54, 0,172, 1,164, 81, 20,117,183,236,126,113,146,146,
-213, 90,202,239,167,163,104, 84,202,178,140,185,116, 20,185,251, 88, 3,224, 0,132, 82, 20,149,245,129, 89,212, 63,203, 48, 40,
- 40,136,148,253, 44, 67,180, 8, 33,132,232, 50,158, 19,117,204, 57, 82,120,247,151,247, 54,101,212, 49,146, 18,122,152,220,249,
-237, 91,210,212, 74,255, 42,236,125,155, 65, 55,202, 3,100, 74, 27,144, 89, 93,107,169, 66, 67, 67,131,121,158, 15,242,239, 12,
- 66, 30,253, 70,200,163,223,200,215,222, 32, 71,143, 30, 61, 31, 16, 16, 16,180,111,223,190, 32, 0, 85,249, 41,165,230,221,189,
- 73,238,216,128, 84,134, 39, 79,158,144,109,219,182,145,133, 11, 23,146, 93,187,118, 17, 84, 17, 65,189, 87,175, 94,127, 68, 70,
- 70,146,113,227,198, 61,128,158,192,128,174,128, 98,116,125,187,104,245,161,245, 90,205,216, 22, 36,171,139,180,194,235,183,183,
-183,127, 39, 63,129,206,118,100,115, 91,103,178,167,167,215,107, 66,200,121, 66, 72, 32, 33,100, 56, 33,164, 25, 0,180, 2,204,
- 62,179,183,124,166, 58,188, 65,169,153,212,190,202,117,239, 90,181,106,213,116,222,188,121,153, 26,141,134,196,197,197,145,237,
-219,183,147, 75,151, 46,145,147, 39, 79,146, 78,157, 58, 37,151,201,175,237,132,102, 78,169,154,157,203,213, 53,185,139,132, 12,
-179,249,238,165,163,228,217,245, 35, 36,244, 96, 0,249,247,191, 70,146, 25,159,181,211,154,201, 36, 42, 0,221, 42, 59,111, 90,
- 71, 52,105, 86,223, 58, 38, 62, 62,158,104,181, 90, 50,126,252,120,210,171, 87, 47,242,201, 39,159,144, 30, 61,122,144,238,221,
-187,147,110,221,186,145, 43, 87,174,144,228,228,100,210,163,179, 87, 65,127, 87,180,174, 70,214,154, 59, 57, 57,189,142,139,139,
- 35, 90,173,150, 4, 7, 7,147,253,251,247,147,224,224, 96,226,239,239, 79, 0,236,153, 50,101,138, 50, 43, 43,139,244,234,213,
-235, 21, 42,136, 26,239,228,228,244, 56, 50, 38, 49,113,221,170, 95,174,236,221,124,224,202,241,163,151,174,156,186, 16,122,230,
-228,133,187,135,239, 60,140, 61,233,228,228,244,184,130,250,255,160,242, 52,194, 8, 35,140, 48,162,106, 46, 82, 76,180,250, 21,
-139, 29,253, 8, 33, 61,202,237,247, 43, 38, 78,239,237,251,251,251, 47, 44,187, 95,146,198,223,223,127, 33, 0,226,237,237,125,
-128, 16,210,228, 35,100,127, 82, 5, 91,213,138, 86, 9,216, 87,161, 16, 57,247,129,144,211, 65,151,254, 4,124,118, 60,160,176,
-131,146, 50, 65, 70, 74, 60,162,175, 31,211,191,144, 68, 49,206, 62,129, 16, 64,240,227,199,143, 17, 29, 29,141,196,196, 68,200,
-229,242,247,210,253,249,231,159,144,201,100,176,183,183, 55,140,233,106,222,237,231,194,189,156, 96,226,237,131,244,145, 95, 33,
- 56, 56, 24,111,222,188,129, 72, 36,130, 88, 44, 6,203,178, 85,218,163,233,162, 21,127, 75, 84,172,138,210,248, 0, 2, 73,109,
-147,211, 91,151,206,106, 64,223, 10, 18, 42, 19,158, 33, 89,197, 25,166,228,153, 40, 32, 87,200, 83,100, 50,121,233,112, 33,128,
- 8,138,162,158,182, 2,132, 10, 19,233,233, 95,191,159, 99,199,132, 5, 75,149,207,194, 43,180,209,163, 71,143,201, 0,150, 18,
- 66,178, 61, 60, 60,108, 87,174, 92,105,145,148,148,132, 71,143, 30,225,240,225,195,105,108,209,133, 82,132,144,229, 0,208, 30,
-144,214,178,174,117, 97,243,183,179, 76,113,245,144,184, 38,119,145,185,235,128, 51, 67,198, 77,153,182,113,214, 0, 20,228, 41,
-241,219,165, 48,156,191,255,252, 83, 0,127, 66,143,223,219,150, 27,120, 6,164,117, 31, 60,120,240,131,107,215,174, 89,237,220,
-185, 19, 44,203, 86,184,237,220,185, 19,151,175,223,159, 9,224,158,129,217,114,104,208,160,193,229, 59,119,238, 88,203,229,114,
- 92,186,116, 9,217,217,217,165, 74,150,159,159, 31,149,157,157, 61,226,231,159,127, 30,242,242,229,203, 31,175, 95,191,158,129,
-162,181, 32,223,185, 17, 24,134,121,206,178, 90, 23,123,215, 38,130, 97, 3, 58,119,206,207, 8,135,137,165, 7,110, 61,124,126,
- 58, 59, 43, 67,201, 48,204,243,178,233, 63, 70,121, 26, 97,132, 17, 70, 24, 81, 61, 80, 20, 21, 68, 8,233, 79, 81, 84, 80,249,
-223,202,127, 47, 73, 23, 16, 16, 80,186, 95,114, 78, 96, 96,224,170, 50,251,133, 31, 41,123,122,157,225,187, 22, 51,200,174, 21,
- 37, 82, 63, 58, 14,117,244, 41,136,156, 58, 66,220,236, 83, 48, 78,157,144, 16,126, 21, 15,207,173,195,171,168, 63, 65,120, 14,
-246, 77,219, 26,154, 17,149,139,139, 11, 84,170, 34,215, 44,181, 90, 13,145,194, 66, 53,103,210, 40, 41, 0,240, 2,169,186, 12,
-131, 53,200,160,105, 71, 95,180, 77, 37, 8,181, 45, 18, 42,218,166, 22,157,247,253,248,241, 16,137, 68, 16,137, 68,160,138, 93,
-127, 12, 33, 90, 84,113, 98,190,104,248,170,162, 76, 80,133, 18,225,111, 7,151, 78,111, 43,121, 25, 33, 86, 71,222, 66,178,154,
- 39,167, 83,185, 51,134,228, 87,174,144, 39,201,228,242, 8,153,137,162,148,104, 81, 20,245, 28, 0,136, 80,184,111,255,242,233,
- 30,138,212, 88,133,234,110, 48, 82, 84,188,182, 18, 51,203,207,157, 59,103, 35, 16, 8,236, 56,142, 67, 66, 66, 2,162,162,162,
-176, 97,195,134,212,188,188,188,174, 97, 97, 97, 49,101,185, 35, 39, 19, 31,222,183, 98, 86, 67, 65,120,136, 84,253, 60,178,218,
-119,143, 85,243,129,189, 62,237,234,121,102,242,152,197, 24,216,247, 19,140,235,234, 70,226,146, 51, 85, 0, 46, 21, 75,175, 85,
- 33, 41, 44, 44,172,103,151, 46, 93,254,221,178,101, 75, 87, 66, 8, 90,180,104,129, 17, 35, 70, 96,223,190,125,120,248,240, 33,
-114,115,115,181, 23, 47, 94, 92, 15, 96,183,129,217,146, 91, 88, 88,156,191,114,229,138,181, 92, 46,199,197,139, 23,161, 84, 42,
- 97,111,111,143,105,211,166,137, 3, 3, 3,247,230,230,230, 14, 11, 8, 8,144,198,197,197,109,190,112,225, 66,125, 20,173, 59,
-247,222, 77,160,209,104,118,252,182,111,207,198,105,211,103,212,185,114,251, 81,176, 58, 63,207,220,201, 41, 49,215,218,194,196,
-116,253, 15,203,235,105, 52,154,201, 21,151,231, 31, 53, 42, 79, 35,140, 48,194, 8, 35,222,131, 94, 46, 82,150, 60,149, 39, 91,
-213, 33,105, 0,148,254,254,254,139, 40,138, 10,242,247,247, 95, 20, 16, 16,160, 4,144,252, 87,144,172, 82,162,213,191,127,255,
-144,160,160, 32,244,239,223, 63,164, 82, 19, 60, 7,109,220, 53,104,227,174, 65,230, 61, 19,191, 7,140, 44,119,241,124,141,115,
- 55, 96,197,165, 43,106,181, 90,176,103,207,158, 82,191, 45, 0,224, 56,238,163,215, 98,117,136, 86, 49,209,123, 47, 19, 13, 36,
- 38, 33, 59,190, 30,214,222,146, 43, 20,106,254, 60,141, 36, 53,207,254,248, 76, 91,120, 55,155,172,174,204,230,201,217,147,145,
-120,253, 50,228, 38, 38,137, 95, 92,139, 40, 85,177,138, 73,214, 11, 0,168, 47, 49, 13,222, 54,107, 96, 39, 59, 17, 68,154, 51,
- 71,144,172,230,213,219, 94,234,118, 87,114,179,129, 16,130, 23, 47, 94,160,176,176, 16, 55,111,222,196,177, 99,199,210, 42, 32,
- 89,104, 32, 49,249, 99,215, 55,163,219,153,229,189, 22,105,238, 94, 70,178,154, 55,104,168,203,170,197,192,142, 34,154,186, 72,
-209,140,172,123,251,166,152,253,229, 32,172,219,245, 59,171,177,233,220,127,227,169,179,159,231,171,181,139, 12, 36, 89,165, 98,
- 99, 88, 88,152, 91, 88, 88,152, 4,128,239,136, 17, 35,206, 14, 25, 50, 4, 33, 33, 33, 56,125,250,180, 51,128,148,226,116, 43,
- 80,180, 80,246,106, 0,177,149, 9,143, 34,145,232,224,229,203,151,221, 29, 28, 28,112,249,242,101, 40,149, 74, 76,153, 50, 69,
- 51,125,250,116,145,159,159, 31,149,147,147, 83,170,100,221,188,121, 51,163, 50,146, 5, 0, 73, 73, 73,231,142, 29,222,223,161,
- 75,151, 46,131, 26, 58, 55, 51,139,205,203,125, 35,151, 75,101,215, 67,174,138,238,222,185,177, 57, 41, 41, 41,180,226,242, 12,
- 54,184, 60,141, 48,194, 8, 35,140,168, 28, 6,113,145,114,202, 84,117, 80,230, 60, 97, 64, 64, 64, 84, 64, 64,192, 59,138,215,
- 7,162,252,172,195, 51, 37,125, 90,141,226,104,113, 57, 9,239, 95, 0,207, 87,231, 98,223,251,205,194,194,130,149,201,100,239,
- 16, 45,222, 64,155,153, 39, 14, 32,118,234,168, 82, 37,171, 68,217, 66,111,191, 15, 34, 90, 60,207,223, 4,240, 78, 38,228, 54,
- 77, 71,174, 31,224,218,209,173, 97, 29, 90,119,120, 3, 94, 21,178,170,165, 79,180,170,232, 60,242,233,227, 10,156,172, 75,109,
-178, 58, 72, 21,178,120,153,137,162, 60,201,122, 9, 0, 10, 91,231, 33, 63,246,105,214,213,179, 89, 99,154, 61,180, 22, 73,133,
-186,124,255,199, 90,109,108, 1, 57, 94, 73, 25, 46,253,228,147, 79,150, 90, 90, 90, 74, 55,110,220,104,238,228,228, 4,150,101,
- 53,229, 73,150,220,166,233,200, 13, 3,155,119,108,106,103, 65,235,142,110, 66,162,146, 43,220, 16,171,219,107, 8,201,178, 50,
- 55,185,176,109,213, 84,153, 92, 34,132, 74,165, 66,224,214,163,184,120, 35,178,127,122,228,201, 11, 0, 46,124,192, 13,249, 69,
-255,254,253,215,173, 88,177, 2, 58,157, 14, 19, 39, 78,196,243,231,207, 47, 62,121,242,100, 67,189,122,245,230,125,243,205, 55,
- 14,118,118,118,248,252,243,207, 69, 58,157,206,175, 18, 27, 63,252,246,219,111,253, 61, 61, 61, 17, 18, 18,130,236,236,108,216,
-219,219, 99,250,244,233,226,128,128,128,189,185,185,185,195, 86,173, 90, 37,125,241,226,133, 94, 37,235,157,251,154,227,190,223,
-190,110,234,188, 54,237, 59,209,207,158,197,176, 9,109,125,232,171,151, 79, 95,179,180,180,220,155,144,144,240,182, 60, 7,181,
-168,118,121, 26, 97,132, 17, 70, 24,241,113, 64, 81,212,153, 98,191,171,119, 84,174,242, 36,172, 68,177, 42,187, 95, 62,125,241,
-241,143,241,178,188,163, 2,226,245,110,120,135,254,253,251, 27, 60,173,158, 47, 72, 51,136, 60,149, 71,223,102,208,213, 49,129,
- 96,145, 15, 13,145,194, 66, 53, 96,197,165, 43,149,165, 85, 40, 20, 6, 43, 90,188, 90, 85, 85,165, 84,139,104, 21,251,104,157,
- 39,132,188, 67,180,204,109,155,250, 44,248,102,214,250, 78, 67,122,211,169, 95,122, 35, 59, 95,173,254,230, 17,203,191, 42,212,
- 79,178,138,122,113, 93,156, 92, 97, 18, 33, 85,200,203,146,172, 4, 0,144,218, 52,110, 59,127,246,180,173,221, 70, 14,160,210,
-166,116, 66, 86,182, 82, 61, 47,138,165,146,148,100,216, 99,224,106, 69,230,174, 92,185,178, 29,192,118, 31, 31,159, 84,133, 66,
-129,252,252,252,247,234,160, 36,191, 29,135,244,166, 83,191,104,135,204, 2,173,250,155, 40, 22,201, 74,254, 96, 85, 36,203,186,
-150,233,133,109, 43,167,202,147, 95,189,132, 72, 36,130,137,137, 9, 46,253, 25,129,244,168, 83, 31, 66,176, 64,211,244, 50,127,
-127,255,165,211,166, 77, 67, 70, 70, 6, 78,159, 62,141,190,125,251,226,192,129, 3, 78,103,207,158, 93,231,235,235, 11,134, 97,
- 16, 20, 20, 4,157, 78,247,180, 18, 51,131, 38, 77,154, 52,111,200,144, 33, 8, 13, 13, 69, 74, 74,202, 59, 74, 86,118,118,246,
-136,173, 91,183, 14,137,139,139,171, 82,201, 42,135,182, 13, 26,183, 18, 45, 92,242, 19,212,133,111, 4,105, 73,183, 67,130, 47,
-209,183, 50, 51, 51,229, 0,114,106, 90,158, 70, 24, 97,132, 17, 70, 24,172,106, 85,198, 69,210,138, 73, 84, 90, 69,251,101, 8,
- 86, 69,251, 84, 57, 21, 76, 83,238,248,195,191,242,154, 12, 82,180, 4,182,205,193,166, 70,150, 33, 90,111,222, 57, 46, 53,173,
-109,208,208,161,142,133, 96,219,238,210, 56, 90,210,140,140, 12,169,149,149,149,170, 44, 65,144,203,229,112,112,112, 64, 86, 86,
- 22,118,236,216, 1, 84,237, 20,205,154, 13, 25,131,182, 35, 39,226,174,163, 24, 68,167, 45, 85,182,182,141, 31,255, 14,217, 18,
-137, 68, 37,190, 97, 85,117,186,119,138,149,166, 91, 0, 72, 43,231,134,223, 73, 21,138,241, 82,171,186, 86,179,167,126, 33,140,
-123,163,198,149, 78, 11,179,143,254,176,192, 36,145,152, 76, 75, 64,206,141, 42,236,197,126,246,243,254,242, 74,214,171,150,206,
- 13, 23, 75,229,210, 47,197,181,235,219,249,207,153, 42,140, 75, 85, 83, 87,218,126,147,123,108,245, 55,242, 23, 48,157,247, 10,
-217, 87, 13,168,158,165,125,251,246, 93, 74, 8, 33, 60,207, 47, 1,128,178,249,157, 51,253, 75, 97,236,107, 21,130, 59, 45,206,
- 58,246,195, 2,211, 68,232,207,175, 85,139,129, 29,109, 45,204, 46,108, 91, 53, 77,158,146, 20, 15,137, 68, 2, 83, 83, 83, 36,
-166,230, 64, 40, 96,148, 31,120,191, 73, 58,119,238,188, 96,234,212,169,136,136,136,192,148, 41, 83, 82, 18, 18, 18,142, 31, 58,
-116,104,202,183,223,126, 43,232,213,171, 23, 82, 82, 82,176,102,205, 26,221,159,127,254,185, 10,192,154, 10,239, 71,129,224,139,
-239,190,251,142, 36, 39, 39, 83, 47, 94,188,128,189,189, 61,102,204,152, 33, 94,181,106, 85,169, 79, 86,117,148,172, 18, 36, 37,
- 37,133, 92,188,124, 11,159,158, 91, 15, 86,167, 14,201,206, 72,184, 22, 29,155, 21, 82, 91, 44,158, 91,167, 85,139, 26,149,167,
- 17, 70, 24, 97,132, 17, 31, 69,197,186,171,111,255,111,128,138,134, 14, 13, 34, 90, 79, 55, 45,158,224, 60, 97,218,124,200,156,
- 58, 66,253,248, 4,248,252,212, 82, 69, 75,106, 98,129,218,245, 92,145, 93,160,198,145,224,251, 0,240,180, 58,185,202,203,203,
-131,151,151, 23,182,248, 53,237,166,202,203,144,202, 0,168, 37,102,170,147,226,206, 87,206,158, 61, 91,200,243,252, 65, 0,103,
-171, 48,179,204,221,221,125,243, 79, 63,253, 36,118, 29, 57, 1,249,183,175,151, 87, 80, 32,147,201, 32,145, 72, 16, 30, 30,142,
- 43, 87,174,104, 0, 44,171,162, 66,239,176, 44,251,240,208,161, 67,175,154, 52,172,211,219,171,165,199,204, 69, 11,253, 77, 31,
- 93,191,136, 37,171, 54,243, 77, 90,247,202, 9, 60,112, 50, 47,199,164, 94,119,101,202,147, 7, 6, 92,234,195,114, 36, 43,217,
-165, 65,221,110, 45,155,187,207, 95,178,100,177, 89,212,245, 75,248,118,245, 54,226,236,217, 35,103,245,177, 83,185,233,242,250,
-159,168,222, 68,135, 26, 82,134, 33, 33, 33,219, 1,108, 47,217, 47,159, 95,255, 21, 27,248, 12, 99, 47,114, 0, 0, 32, 0, 73,
- 68, 65, 84,166,109,122,103, 5, 30, 56, 86,144,107, 90,175,135,190,252, 90,187, 14,234,224,104,109,113, 97,211,247, 95,201, 95,
- 39, 37, 64, 34,145,192,196,196, 4, 9, 41,217, 88,186,254,112,129,150,231,123,127, 40,209, 50, 53, 53,149,104,181, 90,108,217,
-178, 5, 9, 9, 9,222, 0, 18,238,221,187,183,109,248,240,225, 27, 91,180,104,225, 18, 21, 21,245, 52, 63, 63,127, 26,128,232,
-202,140,212,170, 85,203,219,218,218,154,186,117,235, 22,190,250,234, 43,205,140, 25, 51, 68,227,198,141,163,178,178,178,106,170,
-100, 1, 0,234,212,169,227,211,179,123,123,116,236, 57, 37, 68,163,202,190, 22, 23,189, 55,132, 38, 55,164, 53, 45, 79, 35,140,
- 48,194, 8, 35,254,103, 80,179,192,224, 62,128,160,169, 37, 38,187,215, 17,189,222,247,195, 12,146, 23,123,147, 40, 67,183,147,
-220, 19, 95,146, 51,107,198,145,179,155,102,147, 41,253,220,137,139, 13,245,186,169, 37, 38,251,188, 79,220,222, 89,221,187,111,
- 51,232,122, 54, 6,233,217, 24,164, 95, 83,232, 0, 44,106,213,170,213,201,233,109,223,198,209,154,222, 22, 4,192, 87, 0, 76,
- 42,201, 86, 69, 43,134,219, 3,216,225,229,229,197, 94,189,122,149, 60, 25,214,131,132,185, 88,145,105,211,166,145,111,191,253,
-150,140, 26, 53,138, 88, 91, 91,179,197, 5, 97, 95,149,205, 79, 63,253,212, 17, 0,234,214,173, 91,171,181,107,147,215,225,193,
-167,201,181,125, 27,201,174,233,131, 73,187, 22,174,233,118, 46, 93, 30,202,236,155,181,172,162,248, 74,109,218,217,217, 45, 36,
-132,244, 38,132,216, 3,128,179,179,165, 73, 43,151, 38,201, 15, 47,159, 38,215,247,111, 38,187,166, 15, 38,237, 61,220, 50, 28,
- 93,125,163,165, 54, 46,109, 13,177, 89, 17, 42,204,111,115,151,116,219, 38, 29, 30,232,201,111,169,205,134,109, 63, 63,245, 42,
- 57,149,220,185,115,135,156, 61,123,150, 92,191,126,157,236, 59,116,138,212,107, 51, 44,223,170,197,192,142,213,184,117, 42,203,
-167,121,191,126,253,200,211,167, 79, 73,159, 62,125, 8, 0,243, 26,218, 60, 25, 23, 23, 71, 34, 35, 35,201,162, 69,139, 8,128,
- 61, 83,167, 78, 85,230,228,228,144, 30, 61,122, 36, 20, 19, 44, 65, 77,242,217,168, 65,157,192, 65, 3, 58, 47,155,254,213, 16,
-159, 15, 45,207,143, 8,163, 77,163, 77,163, 77,163,205,255, 5,155,255,205,176, 47, 86,181, 74, 62, 91, 25,164,104,133, 0, 44,
- 50,176,189,185,141,246,223,171,214,108,154,187,101,251,158,249, 11,102,126,161,232,220,169, 39, 34, 46,255,138, 99, 65,135, 10,
- 84,106,205, 26, 17,131,159, 34, 51, 80, 24, 83, 69, 46,138,227,104,189,131,176,176, 48,121,237,198,111, 99, 48, 61, 43,138,205,
-186,173,154, 23,152, 2, 96,210,253,251,247,127,242,245,245, 93,249,101,199,182,131,167,119,232, 6,157, 78,135,125,251,246, 33,
- 62, 62,254, 56,128,197,134, 42,110, 17, 17, 17,233,110,141,157,102, 9, 25,193,252,105,163, 6, 89,167, 61,127,132, 87,143,195,
- 0, 0,106,181, 82,247,250,233, 53,207,234,100, 78, 38,147,221,177,182,182,126, 98,109,109,157,213,180, 97,221, 73, 18, 8,151,
- 76, 25,241,153, 77, 70, 92, 52, 18,163,138, 70, 70,213,170, 66,237,171,167, 87, 93,106, 82,187, 78, 78, 78, 18,133, 16,147, 43,
-204,175, 70,165, 75,125, 22,221,210, 16, 59,133,106,205,170,229,235,246,125,242,253,252,241, 18, 51, 51, 51,220,143,124,134, 37,
-107, 15, 20, 40, 53,186,222,233, 17, 39, 63,202,240, 24, 33, 4, 58,157,206,224,137, 14,149, 96,129,167,167,103,179,149, 43, 87,
- 58,251,249,249,225, 67,149,172,178,136,141, 75,242,175, 83,183,145,219,179, 39,247,125,107,203, 68,255,254,144,242, 52,194, 8,
- 35,140, 48,226,127, 6,253,138,197,156, 73,101, 62,195,170, 36, 90, 37,136,124,131, 66, 0, 43, 26, 50,249,219, 22,174, 92,183,
-148,166,214,143,231, 9,249,149,165,177,252, 69, 6,210, 62, 48,115,133, 66, 1,216, 79, 6,142, 18, 0,128, 80, 80,179, 14,178,
- 24, 79, 1, 12,249,229, 70,104,155, 95,110,132,254,171,248,183,239, 1, 84,107, 44,215, 84,128,200, 78,110,141,234,116,110,229,
- 46,101, 56, 37, 94, 61,126,142,204, 2, 21, 46, 69,197,103,211,132,254,181,186,153,122,241,226,197, 31, 0, 96,107, 46,127,220,
-217,173,113,189, 46, 94,238,114, 33,165,193,171, 71,247,145,163,212,224, 98, 84,124, 14, 40,170,198, 14,213, 31, 43,191,169, 17,
-167,238,254, 14,170, 7, 69, 81,151, 23, 77, 31, 41, 89,186,246,224, 71, 37, 89, 0, 10,147,146,146, 50, 10, 11, 11, 45,147,147,
-147, 53,168,121,144,184,103,185,185,185, 45,102,207,158,189, 98,222,188,121,243,127,248,225, 7, 81, 77,124,178, 42, 67, 86, 82,
-252,137, 46,238, 31,175,254,141, 48,194, 8, 35,140,248,159,192,164,114,159, 48,152,104,149, 18,134, 55, 72, 3, 48,173, 81, 35,
- 50, 39, 54, 22,154,143,149,179,138,148,174, 15,196, 93, 0, 3,106,124, 54, 77,229,221,126, 26,159,127,231,105,124, 62,120, 66,
-120, 66,212, 52,141,196, 2,173,118,213,211, 23, 73, 53,159,117, 71, 81,220,221,103, 9,202,123,207, 19, 85,132,231, 9, 79,136,
-134,162,240, 90,167,227, 87, 69,189,136, 63,245,119,200,111,122,196,201, 27, 65, 44,213,249,198,157,200, 57, 5, 5,218,205,233,
-143, 79,222,252,136,245,162,139,136,136, 24,237,237,237, 61,129,227,184,109, 0,116, 31, 96, 75,195,178,236,130,192,192,192,227,
- 17, 17, 17,135,111,222,188,153,242, 49, 72,214, 95, 90,255, 70, 24, 97,132, 17, 70,252, 83, 81,179, 69,165, 43,195,199, 36, 89,
-127, 71, 68, 62,123,233,245, 87,216,141,122,246,178,249,127, 67,126, 83, 31,159,184,151, 10,140,248,139,138,247, 34,199,113, 23,
- 63, 38,169, 62,127,254,124, 3, 84,176,172,206,223,173,254,141, 48,194, 8, 35,140,248,199, 98, 82,101,228, 75, 96, 44, 27, 35,
-254, 1, 32, 31,139,100, 25, 97,132, 17, 70, 24, 97, 68, 13, 80,169,162, 69,161,242,153, 3,151,171,241, 7, 53,153,125,112,217,
-104,211,104,211,104,211,104,211,104,211,104,211,104,243,127,206,230, 63, 17,246, 40,114,136, 63, 83,252,169,151,124,125, 76, 24,
-167,190, 26,109, 26,109, 26,109, 26,109, 26,109, 26,109, 26,109,254,211, 81,161, 35, 60, 80,228, 60,108,132, 17, 70, 24, 97,132,
- 17,255, 77,144, 20,111, 53, 61,110,132, 17,127, 53,217, 42, 37, 92, 53,241,209,106, 82,252,249,236, 47,204,236,116,123,123,251,
- 73, 30, 30, 30,174, 34,145,136,206,203,203, 91,126,245,234,213,101,229, 19,117,118, 19,220, 99,104, 56,190,253,133, 2, 40, 6,
-160,105,112, 4,175,174,135, 43, 91, 27,235,253,111, 13, 39,153,153,245,239, 20,205,136, 57, 86, 11, 78,167, 69,145,187, 85, 17,
-120,158,141,231,180,234, 94,149,157,108,231, 57,168, 30,203,241, 63, 0,100, 11, 64, 79, 5,248,173, 20, 4, 83, 8,216,159, 41,
- 48, 95,129, 33,171,193, 81,223, 8,132,204,194,148,176,163,137,255,132, 2, 59,114,228, 8,243, 33,231, 15, 27, 54,172,194, 5,
- 68, 29, 28, 28,130,228,114,121,227,202,206, 43, 40, 40, 72, 73, 73, 73,241,253,135,223,143, 93, 0,108, 2,224, 94,238,247,104,
- 0,179, 0, 4,127,232, 31,248, 0, 2, 91, 96,178, 8,248, 6, 0,180,192,234, 84, 96,123,200,223,200,199,208,218,218,250,154,
- 64, 32,112, 46, 40, 40, 40,200,203,203,107,100,106,106, 26,171, 80, 40, 20, 44,203, 62, 77, 75, 75,235,162,239, 92, 82, 52, 41,
-165, 74, 52, 7, 76, 99,128,225, 28, 77,207, 16, 2, 91,212, 60,191,173,184, 5, 55,100,129,219,169,120,187, 60,215,124, 0, 91,
-171,121,220, 8, 35,254, 10,124,208,172,195,166, 69,237, 3,124, 0,116,105,211,166,141,109, 65, 65, 1,162,163,163, 83, 1, 92,
- 3, 16, 82,188,197,124,140,156,210, 52,253,227,186,117,235,230,206,152, 49,163,116, 49,232,240,240,112,120,122,190, 31, 35,148,
-161,225,120,245,244,101,155,187, 17, 49,104,211, 99,104, 49,209,162,129,130, 20,248,246,108, 91,211, 44,152, 90, 88, 88, 44,167,
- 40,106, 24, 77,211, 85, 54, 26, 60,207,115,132,144, 35, 89, 89, 89, 75, 1,228, 85,231,143, 20,114,137,142,229,184, 10,255, 67,
-192, 48, 92, 65,161,186,210,176, 23,181,107,215,190, 73,211,116,195,178, 11,102, 3,239, 46,160, 93,217, 49,150,101, 95,165,167,
-167, 27, 66, 66,165,180, 64, 52,139,162, 68, 61, 65,243, 77, 1, 10, 20,232, 24,158,211, 92,226, 89,237, 6, 0,170, 15, 33, 89,
-246,117, 27, 93,255,122,113,160, 99,228,227,104, 44,154, 62, 10, 63,108,218,131,133,179, 38, 96,195,142, 3,152, 53,105, 36,220,
-220,220,245,182,186, 60, 68,171, 22,207, 28,214, 35, 96,203,225, 78, 11,167, 13,147, 4,108, 57,210,121,209,244,225,226, 85,155,
- 15,119, 94, 52,253,115, 73,192,230,195,157, 22,206, 28, 38, 91,181,245, 40, 15, 96, 76, 77, 50, 57,210,217,161,128, 98,217, 10,
-223,140,137, 64,160, 62,240, 52, 89,241,159,120,162,253,252,252, 60,148, 74,229,253, 81, 61, 91, 5,182,108, 90, 39,169,162, 52,
- 25,175,147,234,196, 62, 9,243, 23,138,100, 94,159,249,239, 9,215, 43, 15, 72, 36, 13,163,163,163,157,121,158, 7,199,113, 96,
- 89,182,244, 83,163,209,160, 75,151, 46, 31,107,226,204, 0, 0,203,139, 30, 86, 4, 0, 56,252, 1,182, 76, 4, 2,193,215, 98,
-177,216,135,101, 89, 87, 0, 16, 10,133,143,213,106,117, 8,203,178,235, 0,228, 87,211,222,250,164,164, 36, 55, 19, 19, 19,104,
-181,218,210, 5,232, 25,134,113,169, 87,175,222, 22,149, 74,229,252,161, 23,111, 11, 76,238,208,169,211,134,113,115,231, 50,202,
-107,215,176, 97,247,238,245,200,205, 5,128, 45, 85,157, 43, 22,139, 47,208, 52,237, 84,157,255,227,121, 62, 94,163,209,244,170,
-206, 57, 2,129,192, 57, 57, 57,217,198,193,193, 1,121,121,121, 80, 40, 20,138,146,253, 15, 65, 8, 64,245, 6,186,176, 12, 51,
-219,210,202,170,243,253,139, 23, 21,205,155, 55,167, 25,134, 89, 8,195,131, 84, 75, 0,172, 33,132,200,138,251,139, 13,237,219,
-183,247,166, 40,138, 5, 64,120,158,167,239,220,185, 51,146,231,121, 65,113,155,183, 6,192,110, 0,106, 35, 15, 48,226,255, 65,
-205,218, 81, 93,162,117, 22,128, 79,155, 54,109,100, 35, 70,140,128,143,143, 15,156,157,157, 33,149, 74,139, 26,241,140, 12,219,
- 7, 15, 30,124,126,237,218,181,207, 79,159, 62,141, 71,143, 30, 41, 1,252, 9,160,194,135,186,123,255, 78, 51,164, 38,146,141,
- 0,144,246, 42, 35,229,213,139, 55, 27, 83, 82, 82,214, 0, 40, 27, 34,188,209,152, 49, 99,230,204,156, 57, 19, 65, 65, 65, 56,
-112,224, 0,212,106, 53,242,242,244,240,151,194, 55,200,186, 18, 8, 40,226,128,132, 16, 64,110, 3, 40,108,107, 92, 82, 22, 22,
- 22,203,103,205,154, 53,219,205,205,173, 52,138,185, 78,167, 3,203,178,208,233,116,200,202,202,194,156, 57,115,138, 58, 90, 66,
-192,243, 60,206,157, 59, 55, 99,210,164, 73,200,202,202,250,186, 34,155,237,189,234,222,163, 41,218,177, 68,171, 33, 28,247,234,
-246,131, 87,173, 89,142, 99, 84, 42,109,133, 43,149, 75,165, 34,189, 36, 79, 40, 20, 58, 62,250,253,119, 27, 90, 44, 6,225, 56,
-128,231, 65,120,190,184, 56,139, 55, 82,244, 27,225,120, 16, 29, 7,158,229,193, 42,213,104, 59,117,170, 33, 69,209, 65, 40,150,
- 29, 24,253,229, 92,187,118,237,219, 11,235,215,117, 0,203,241,120, 30,247,202,238,254,189,219, 29,143,236,221, 50, 69,163,204,
- 27, 9,160, 70,113,182,196,114,179,139,155,127,254,197,241,238,131, 72, 4, 95,189,134,203, 87, 66, 0, 0, 23,174,222, 44, 33,
-220, 85, 86, 21,216,252, 22,179, 38, 14,148, 4,110, 62, 40,156, 53,113, 16,243,195,230, 67,194,153, 19, 62, 99, 2, 55, 30, 16,
-205,156,240, 25, 19,184,233,128,104,230,196,129, 76,192,134, 93, 30, 0, 44, 0,100, 85,102,172,178, 58,162, 88, 86,242,239,216,
- 84, 6, 0,210,182,109,131,238,205, 27, 56, 44, 93, 10, 0, 24,221,200,214,224,161, 9, 43, 43,171,123, 66,161,208,177,170,116,
- 58,157,174, 74, 18,236,231,231,231,169, 84, 42,239,177, 44, 75, 4, 2,129,255,168, 65,159,156,236,221,217, 51,163,108,154,240,
-240,135,150,171, 86,253, 62,240,240,253, 60,242,185,151,233,253,160, 31,253, 90,247,159,183,231,161,158, 14,153, 86,171,213,120,
-250,244, 41,202, 46,242, 94, 6, 92, 13, 31, 41, 26,192, 6, 75, 75,203,118, 25, 25, 25,163, 1, 44,202,205,205,245, 96, 24, 6,
-181,107,215, 94,164,209,104,158,155,155,155,239,204,201,201,185, 89,172, 26, 25,186,100, 64, 23, 51, 51,179,125, 39, 78,156,176,
-104,213,170, 21,157,158,158,142, 6, 13, 26, 32, 51, 51,179,237,181,107,215,188, 38, 78,156, 56, 49, 47, 47,111,108,241,203,160,
-161,104, 38,151,203,201,184,113,227, 40,142,123,123,185,187,118,237, 66,175,230,108, 99,235, 90,242, 66,149,134,228, 4, 63, 53,
-255, 74, 36, 18,253, 25, 31, 31,159, 83,221,194, 16, 1,223,140,155, 59,151, 49,121,249, 18, 38, 15, 31, 98,116,110,174,224,135,
- 34,117,171, 74,162, 69,211,180,211,190, 3,191, 58,139,197, 98,176, 44, 91, 74, 6, 75,218, 40,157, 78, 7,173, 86, 11,157, 78,
- 7,142,227,160,211,234, 16,240,253,234, 26,183,133,114,185, 92,110,111,111,159, 42,151,203,229, 31, 72, 46,235,101,210,244,151,
- 45,189,188, 38, 45, 29, 56, 80, 26, 26, 26, 42,165,105, 26, 44,203, 98,205,154, 53, 44, 33,164,150, 27, 96,246, 8,200,173,174,
-109,137, 68, 34,216,187,119,239, 72,177, 88, 12, 0,208,104, 52,104,222,188, 57,101,236,243,141,248, 15,146,173,247, 84, 46,125,
- 68,171, 79,110,110, 46, 56,142,131,169,169, 41, 24,230,221,126,223,210,210, 18, 61,123,246, 68,151, 46, 93, 48, 98,196, 8, 60,
-122,244, 72, 54, 98,196,136,158,149, 25, 27, 53,183, 63,234, 58,219, 22,119, 38,188,253,141, 51, 15, 2,119,125,119,212,250,245,
-235,215,115,203, 36,155, 56,121,242,100, 42, 35, 35, 3,195,134, 13,187,166, 86,171, 63,133,158,135,143,227,241,202,119,196,104,
-240,132,146,173,187,243, 11,165, 81, 41, 9, 77,211,202,146,161,195,154,148, 18, 69, 81,195, 28, 28, 28,112,240,224, 65,104, 52,
-239,135, 11, 51, 51, 51, 67, 84, 84,212, 91, 85,141, 97,208,190,125,123,134,162,168, 97, 0,190,174,216, 38,237,120,227,238, 75,
-155,146,253,254, 61,221, 69,237,189,232,212,228,212, 2, 2,128, 90,188,120,113, 41,113, 3,128,229,203,151, 27,146, 79,208, 66,
- 33,210, 66, 66,222, 54,196, 2, 26,180,136, 2, 37, 4,104, 65,209, 40, 42, 8, 64, 56,128,103, 1, 94, 7, 72,237,235, 26, 82,
- 12,109,235,212,115, 14, 90,181,118,107, 45,181,142,224,224,169, 96,196,197,189, 0, 67,211,104,212,216, 25,159,116,237, 44,244,
-106,227, 93,119,245,178,185,167,147, 19,158,245, 1, 16, 90,237,130,230,137,180,113, 61, 43,236,220,117, 31,214, 22, 38, 24, 54,
-176, 47,100, 82, 9,126,216,244, 43,190, 95, 56, 29,206,141,156,176,125,253,202, 74, 79, 55, 55, 55, 95,225,234,220,216,105,235,
-222, 51,112,117,113, 97,182,238, 59, 3, 87,183,226, 79,119, 87,102,235,190, 51,112,115,119, 99,182,238, 59, 3, 15,247,102,245,
-239,165,220, 89,145,153,153, 57,189,242,242, 44, 87, 71,159, 20,213,145, 48,159, 47,109,180, 95, 78,153, 2, 0,165, 68,171, 58,
- 16, 10,133,142,201,201,201, 54, 85,165,171, 74, 53, 40, 86,178,238,177, 44,139, 55,111,222, 80,217,217,217,164, 86,173, 90, 3,
-207,111, 95,116,162, 87, 39,207, 76, 0,120,248,240, 97,237,128,128, 85, 3, 15,221,203,133,242,246,102,234,223,191,135,240,163,
- 63,245,185,119, 42,208,207, 11,197, 75, 66,148,135, 90,173,142,107,217,178, 37, 41,254, 94, 71, 34,145,136,202,221,111, 14, 77,
-154, 52,121, 79,181, 54, 96, 72,113,195,173, 91,183,166,187,185,185,193,197,197,229,102,187,118,237,204, 20, 10, 5,206,159, 63,
- 15, 87, 87, 87,119, 51, 51,179, 59, 71,142, 28, 17, 46, 88,176,192,115,247,238,221, 0, 48,195,128,226,236,225,235,235,123, 48,
- 40, 40, 72, 42, 18,137,160, 84, 42, 17, 21, 21, 5,115,115,115,136,197, 98,124,246,217,103, 76,199,142, 29, 45,187,118,237,122,
- 44, 38, 38,102, 36,170, 49, 3, 74,165, 82,145, 69,139, 22, 65, 46,151, 67, 46,151, 67,161, 80, 64,161, 80,192, 68, 10,106,219,
-172,122,178,153, 59,178,101, 95, 47,221, 22,184,111,235,178,171,117,235,242,223, 38, 38, 38,102, 87,247, 94, 80, 94,187, 6,147,
-135, 15,129, 50,207,174,161, 48, 87,212,134,191,191,127, 85,138, 20, 68, 34, 17, 58,116,232, 80,165,189,218,181,107, 31, 23, 8,
- 4,239,188,153,178, 44, 43,245,247,247,231, 98, 98, 98, 20, 52, 77, 43,120,158,135,191,191, 63,199,178,172,212,198,198,230, 38,
-207,243,169,233,233,233,131,245,217,237, 10, 72,111, 2,131, 40,161,240,107,123, 7,135, 6, 62,141, 26,201, 47, 95,190,204, 0,
-128,147,147, 19, 73, 73, 73,201, 62,117,234, 84,158, 0,248,217,137,144,189,213, 32, 89,106, 0,243,105,154,222, 32,145, 72, 4,
-245,235,215,143, 95,178,100,201,173, 98,133, 20,132, 16,186,126,253,250,109,101, 50,153,147, 90,173,102, 81, 52,116,104, 84,179,
-254, 1, 32,132,120, 21,241,246, 82,104, 0,136, 75, 4,252,162,222, 14, 86,229,126, 7,128,244,226, 23, 69,219, 74,246, 51, 0,
- 60, 2,208, 12,128, 77,241,177,187, 20, 69,101,214, 32,155,149, 43, 90, 65, 65, 65,165,175,176,253,251,247, 47,237, 88, 76, 77,
- 77,113,247,238, 93, 80, 20, 5, 83, 83, 83,152,153,153,193,220,220, 28,185,185,185,120,244,232, 17,162,163,163,241,242,229, 75,
- 80, 20,133, 70,141, 26,161,228,102, 47,131,210, 6,238,183,159,130, 32, 53,145,128,162,128, 86,221, 60,224,209,165, 57,218,132,
-198,206,186,119,153,218,145,146,146,242, 20,128,160,121,243,230, 19,219,183,111,143,181,107,215, 66,173, 86,175,173,132,100,149,
-218,188,254,136,109, 13, 0,246,246,246,243,246,159,127, 46, 31,211,187,113, 97, 74, 74,202,143, 53, 40,156,119, 26,226,244,244,
-116,131,215,226,227,121, 30, 89, 89, 89,122,109,150, 87, 8,214,109,216, 92, 43, 47, 39, 21,223,253,176, 31, 58,157, 14,115,231,
-206, 5,207,243,165, 91,118,118,182, 65,249, 36, 28,247,190,118, 64, 23,141,158, 82, 2,160,222,240, 34, 94,145,112,112, 51, 40,
- 2, 80, 28,128,247,175,171,124, 39, 36,101, 68,178, 67,203,126,216, 88, 43, 44,250, 21, 78, 5,135, 65,155,155,132,148,135, 39,
-138, 36,199, 14, 35,113, 88,205,160,157, 71, 99,204, 94,188,218,226, 95,179,199, 30,210, 40,243, 92,240,238, 48,226,229,170, 31,
- 26, 14,223,173, 88,129, 29, 27,215, 98,245,218,141,200,205,201,134, 80,104, 85,220,208,115,224, 56, 78,255,181, 19,210,219,127,
-214,120,234,135,159,143,163,173,155, 61,142,157, 15, 69,167,150, 78, 56,113,241, 30,186,120, 53,192,169,203, 97,232,214,174, 49,
-206,134, 68, 98,246,228,145,212,200, 11,187,123, 87,167,142,214,175,223, 92, 43, 47, 55, 21, 65, 43,247,226,205,150, 45,136,159,
- 62, 29,109,139,211,132, 82, 20, 68,142,142,128,168,234, 58, 42,143,199,143, 31, 67,173, 86, 87,244,102, 14, 87, 87,215, 42,235,
- 93,169, 84,222,103, 89,150,164,166,166, 82,169,169,169, 80, 40, 20, 84, 84, 84, 36,231,238,222,124, 16,137, 62,250, 11, 0, 4,
- 4,172, 26,116,248,126, 46, 10,111,110,132,242,214, 38,136, 26,132,211, 59,150, 79,214, 78, 90,186,253,126,153,103,244,157,124,
-190,126,253,186,207,235,215,175, 1, 0, 13, 27, 54,140,142,137,137,105, 86, 50,212, 92, 60,132, 40, 98, 89,214,185,100, 56,145,
-101, 89,168,213,106,244,232,209,131,209,119,237, 22, 22, 22,237, 93, 93, 93, 17, 22, 22,134,141, 27, 55,214,246,245,245,197,179,
-103,207, 64, 81, 20, 86,173, 90, 69,185,185,185, 9,211,211,211,209,171, 87, 47, 28, 63,126,188, 67,110,110,110, 85,229,105,170,
- 80, 40,118,159, 62,125, 90, 74,211, 52,242,242,242,192,243, 60, 58,118,236, 8,154,166, 17, 25, 25,137,197,139, 23,227,248,241,
-227, 56,121,242,164,204,203,203,107,119, 97, 97,161, 43,222, 29,214,175,172,142,136, 74,165, 34, 18,137, 4, 18,137, 4, 82,169,
- 20, 82,169, 20, 98,177, 24,249, 42, 96,210,186,120, 53, 35,181,226,221, 91,118,106, 60,126,230, 42,250,199, 37, 19,174, 0, 56,
-101,232, 61, 15, 20,249,100,109,248,245,215,141,163,115,114,104, 0,216, 73, 81,188,150,144,213,134, 60,239, 0,144,175,202,129,
- 83, 35, 71, 28, 59,116, 18, 67,134, 15,172,144,100, 9,133, 34,136,132, 66,152,213, 86, 84,105, 83, 36, 18,217, 70, 71, 71, 91,
- 10,133, 66, 16, 66,192,113, 28,180, 90,109,234,191,254,245, 47,235,126,253,250,153,158, 59,119,142,238,215,175, 31,111, 97, 97,
- 81, 16, 26, 26,250,134,101, 89,203,206,157, 59, 87,106, 83, 14,120,168,204,155,108, 16, 51,172, 71,224,162,105,146,177, 99,199,
- 50,227,199,143, 71, 66, 66, 2, 38, 78,156,168,186,116,233,146,230,117, 74,202, 41, 49,207,111,214, 2,225,134,182,201,229,176,
-213,195,195,163,213,137, 19, 39, 38,248,251,251,223,155, 55,111,222,119,101, 15,174, 89,179,102,197,217,179,103,157, 6, 13, 26,
-180,239,225,195,135, 91,171,211, 46,125,104,223, 97,180,249, 97,168,140,139,148,136,163, 20, 69, 5,149,105,179,251,151,236,251,
-251,251, 47, 10, 8, 8,136,162, 40, 42,168,236,239, 37,233,138, 95, 22,131, 42,218, 47, 62,183,246,194,133, 11,155, 7, 6, 6,
-174,242,246,246, 62,120,243,230,205, 23, 0,170, 75,180,244,251,104,149, 92, 80,217,139, 44,215,169, 33, 55, 55, 23,185,185,185,
- 72, 76, 76,196,182,109,219,138, 31,104, 33, 4, 2, 1, 4, 2, 65,169, 63, 67,101, 8, 14,250,115, 19,128, 77,173, 90,181, 18,
- 70,220, 58,114,238,155, 29, 51,187,183,238,209,138,185, 31, 28, 49, 20, 69,235, 17,246, 25, 55,110,156, 21, 0,236,221,187, 55,
- 29,192,185,255, 16,107, 62,242,244,233,211,217,246,246,246,165, 62, 42,101,135, 15, 89,150,133, 84, 42, 69,137, 47,139, 74,165,
-194,182,109,219, 88, 66,200, 17, 61, 54, 17, 19,117, 5, 79,163,174, 22,157,199,243,224,185,183,231, 47, 91,182, 12,132,144,210,
-206,126, 74,177,114, 82, 37,201,171,168,204, 73,185,207,114,191, 19,142,171, 98,120, 66, 52,115,232,216,233,246, 60, 37,192,239,
- 87, 30, 64, 40, 20,130, 47,163,102, 10,153,162,183,229,168,103,201,112,176,117,199,167, 35, 39,219,157,216,183,121, 38,171, 85,
-253, 80,221,178,118,241,240,198,172,217,179,241,203,142, 29, 88,188,116, 69, 41, 3, 96, 57, 14,108,149,249,164,233, 30, 29,155,
-131,205, 79, 6,195, 48,232,214,182, 49, 24,134, 65, 79,239,166, 96, 24, 6,189, 58,186, 64, 32, 16,160,119, 39, 55, 52,105,210,
- 4, 2,129,128,174,162,222, 17, 19, 21,140,167, 81,127,148, 33,189, 4, 4,128, 54, 37,229,189,244,186,148, 20,144,122,150,213,
-189,183, 48,113,226,196,236,196,196, 68,109,249, 99,117,235,214, 21, 93,187,118,173, 86, 37,195,118,165,144,201,100, 94, 2,129,
-224,126,102,102, 38, 47,151,203,105,158,231,120,119,247,230,204,249,237,139, 78,148,164, 89,184,112,209,137,207,189,204, 6,237,
- 63, 18, 68, 68,245, 59, 81,148, 80,194,126,185,116,187, 72, 40,146,121, 1, 74, 67, 94, 30,104,181, 90,141, 39, 79,158,160,170,
-252, 16, 66,244, 14,211,100,101,101,141,115,117,117,189,182,105,211,166,218, 20, 69,225,250,245,235, 96, 24,166,116,139,141,141,
- 5, 77,211,248,230,155,111,180,185,185,185, 95, 84,149, 55,129, 64, 48,251,216,177, 99,230, 98,177, 24,121,121,121,165,207, 13,
-195, 48,136,142,142,198,143, 63,254,136,113,227,198, 33, 33, 33, 1, 14, 14, 14,152, 59,119,174, 73, 96, 96,224,108,173, 86,187,
-194,128, 42, 10,215,104, 52,173,229,114, 57,164, 82, 41, 74, 8, 23, 0, 92,140, 18, 70, 42,149,202, 22,150,150,133,118,214, 33,
- 65,191,119,240,253,212,211,210,218,222, 59, 37, 37,165, 90, 75,103, 61, 7,118,196,113,220,191,250,156, 56, 97,115,227,196, 9,
-254,246,233,211,175, 36,121,121,219, 13,190,135,116, 52,226, 99, 95,193,203,203, 11,247,239,223,135,151,151, 87, 89,210, 4,177,
- 88, 12,145, 72, 4,145, 72, 4, 43, 11,131, 92, 40, 8, 77,211,184,113,227, 6, 56,142,131, 70,163,129, 70,163,129,155,155, 91,
-230,213,171, 87, 77, 0, 32, 54, 54,150,140, 25, 51, 38,251,206,157, 59,104,217, 82,255,122,234, 42,138, 10, 94,182,234, 39,243,
- 31,214,239,134,121,109, 91,132,132,132,112,231,207,159,207,163,128,152,167, 81, 81,107, 63, 5,206, 30, 1,180,213, 41, 51, 91,
- 91,219,107, 12,195,212, 47,251, 91, 70, 70,134,197,224,193,131,145,149,149,213,119,240,224,193,157,138,219,132,164,163, 71,143,
-142, 1, 0,177, 88, 12,154,166, 57, 24,241, 95,133,170,184, 72, 89,162, 84,158,112, 5, 4, 4,244, 47,255, 91, 89, 82, 85,209,
-247,178,231, 6, 6, 6,174, 42, 99, 91, 89,131,236, 87,237,163, 21, 20, 20, 68, 42, 96,144, 6,163, 42,162, 85,130,176,176, 48,
-157,131,131,195, 47, 79, 31,188,236,222,216,163, 17,100, 10,201, 39, 0, 54, 73, 36,146, 57, 99,199,142,197,237,219,183, 17, 25,
- 25,185, 11, 31, 56, 11,167,121,243,230, 23, 36, 18,137, 83, 37,195, 36,241,145,145,145,189, 42,233, 24,150,158, 62,125, 26,250,
-156,225,175, 92,185, 82,182, 83, 42,235, 12, 95,241,141,193, 19,232,180, 58, 20, 20, 42,223,118,226,197, 68,171,160,160, 0,195,
-135, 15,127, 71,209,122,243,230, 77,149,215, 71, 81, 20,126, 60,117, 10,151,142, 28, 65, 95, 79, 79, 28, 15, 13, 69,224,216, 81,
-112,113,170, 3,194, 81, 32, 20,144,112, 96, 51, 50,114,243,241, 91,240, 13,100,230, 21, 98,116,231,206,112, 54,179,210,111, 87,
- 40,234,217,182,189,183,232,242,205, 71, 16, 10, 5,160,193,131,232, 10,225,224,218, 21, 12, 77,195,220,182, 1, 68, 66, 33,132,
- 66, 1, 98, 19,211,225,218,188,141, 56, 72, 44,237, 89, 19,162, 85,215,169, 1, 56,142,195,184,113,227,112,240,224, 65, 88,218,
- 57,193,188,110,115,124,191,118, 7,250,246,232, 92,229,245,151,188,193, 11, 4, 2, 48, 12,243,222,103,201,119, 67,212, 73,194,
- 19,104,203,215, 17, 79, 0, 66,224,184,114, 37, 28, 87,174, 68,104,241,127,186, 21, 20, 64,169, 84, 2,237,220,171, 69,178, 52,
- 26, 13, 18, 19, 19,181,175, 95,191,182,173,224,120,170, 70,163,169,146,216,236,217,179, 39,220,207,207,175,117,237,218,181,239,
-133, 63,124,168,243,240,244, 20,158,219,182,232,100,201,176, 33, 0,120,122,122,102, 46, 90,180,232,228,152, 97,253, 7,110,245,
- 31,193, 77, 93,177, 79, 32,145,201, 90,247,159,183, 39,252,192,176, 97, 85,143,205,168,213,113, 30, 30, 30,196,144,235, 42, 44,
- 44,124,173,231,240, 0, 0,203, 91,181,106,101,230,235,235,139,107,215,174, 97,200,144, 33,106,173, 86,251, 20, 0,250,245,235,
-215,244,183,223,126, 19, 63,122,244, 8,214,214,214,194,248,248,248,221,168,194, 65, 94, 44, 22,119,109,211,166, 13,173, 86,171,
-223, 35, 89,129,129,129, 24, 57,114, 36,154, 54,109, 10,158,231,145,159,159, 15, 95, 95, 95,225,198,141, 27,187, 26, 72,180,102,
-185,184,184,252,136,162, 89,135,101,219,194,199,197, 67, 80,200,200,200,120,253,224, 78,112, 84,231, 30,131, 91,215,111,210,220,
- 62, 50,252,190, 94,131, 54, 54, 54, 11,105,154,254,156,231,121, 38, 55, 55, 55,241,129, 70,211,196,205,201,201,182,227,192,129,
-200, 17, 10,153, 13,193,193,116,106, 94,158, 9, 0,131,134, 32, 85,186, 2, 56, 53, 42,114,245, 27, 50,124, 32,238,223,191,143,
-161, 35, 6, 65, 36, 18, 65, 32, 16, 22, 61,155,162, 34, 69,171,150,149,153, 65,247,166, 78,167, 43,109,195, 75,252,188,180, 90,
- 45, 74, 92,179,228,114,121,233, 49,181, 90, 13,138,162,244,221, 27,180,111,151,142,184, 25, 22,195,126,241,205, 6,181, 48,227,
-126,160, 29,207,239,121, 5,164,126, 64,115,238,124,120,197, 18, 27,153,153, 57, 56,157, 14,238, 3,135,150, 62, 39,119,118,110,
-149,129,231,101,217,241,113,152,113,228,244,199, 94, 51,215,136,255, 0,170,226, 34,101,137,210,135,130,162,168, 32,127,127,255,
- 69, 0,136,191,191,255,162,146,253,128,128, 0, 37,128,164, 26,146,173,247, 84, 46,193,199, 32, 89, 37,195, 11,250,224,235,235,
- 59,195,212,212,116, 99,201,126,226,237, 36, 36,222, 78,130,107, 51,247,142,173, 60, 91,231,140, 28, 57, 18,150,150,150,152, 55,
-111, 30, 1,176,171,186,255, 31, 27, 19,101, 2,128,216,219,219,207, 43,110,144, 61, 67, 67, 67,173,239,222,189,139, 54,109,218,
-188,149,238,181, 90,116,234,212, 73,159,169,188, 98,167,246,175, 63,158, 74,198, 67,171,213,162,176, 80, 9,141, 70, 11, 86,199,
-131,101, 89,120,185,155, 98,223, 14,255,162,223,216, 18,245,172, 72, 53,115,180, 51,133,169,137, 80, 71,211,148,242, 94,248,235,
- 10, 91, 76,141, 70,131,240,248,120, 60,124,249, 18, 0,240,105,128,126,199,215,125,193,215,224,230,230, 86, 85,110, 27, 59, 58,
-216, 33,249, 82,120, 81,227,173, 76,196,221, 63, 15,195,212,212, 4, 0,224,238, 51, 26, 34, 81, 17,209, 42, 80,106, 97,213,172,
- 46, 40, 66, 42, 13, 11, 32,183,176,187, 32, 16, 73,157, 8,199,131, 16, 30,132,231, 64, 8, 15, 70, 40,146,207,152, 50, 1, 60,
-207,161,109,219,182,160, 24, 6,156, 78,141, 97, 3,122, 34, 43, 39, 15,150,181, 12,235, 36, 68, 34, 17,124,124,124,100,149, 29,
-127,246,236,153,178, 44, 49,211, 95, 71, 58, 20, 20, 40,161, 86,171,161,213,176,208,234, 88,112, 13, 69,248,238, 95,163,192,106,
- 89, 20,142,240,134, 86,199,130,159, 61, 8, 90,141, 14, 9,114,154,246,112,181,210,209,160,148, 15, 30,167,153, 85, 69,180, 74,
-200, 65,101,168,200, 39,176, 18,178,245,208,207,207,207,203,195,211,243,254,231, 61, 60,127,138,136,140, 74,142,136,140,122, 47,
-157, 83, 83,207,184,169,129, 7,231, 10, 69, 50,175,254,243,244,207, 58, 44,139,178,195,136, 31,136, 69,121,121,121, 30, 38, 38,
- 38,136,137,137, 1,195, 48,160, 40,234, 25, 0, 15, 0,176,183,183,127, 46, 16, 8, 26, 49, 12,131, 45, 91,182, 80, 2,129,160,
-133,183,183,247, 34,149, 74,117, 88,207, 11,157,171,169,169,233, 59,106,150, 72, 36,130,191,191, 63,198,140, 25, 83, 74,178, 68,
- 34, 17,246,236,217,131,214,173, 91, 67,163,209,184, 26,152,223,187, 0, 58, 27,160,248, 81,197,228,188, 74, 50,202,178,172, 95,
-198,231,159, 55, 65, 72, 8, 58, 54,106,228,230,229,229, 5,173,246,173,160,211,168, 81,163,186,121,121,121,175,149, 74,229,191,
- 81, 20,134,224,129, 94, 82,164,226, 17, 31, 91,228,126,122,255,254,125,180,109,219,182, 84,193, 42,171,102,137, 68, 34,200,196,
- 38,213, 34, 90, 60, 95,212, 46,229,229,229,209, 33, 33, 33, 86, 46, 46, 46, 20, 0,184,184,184, 80, 15, 30, 60,168, 45,151,203,
-211, 27, 55,110, 92,213, 11,176, 8, 0,186,126, 50, 88,112,233,252, 89, 5, 11,172,120,205, 48, 43, 4, 85,182,145, 68,199,241,
-124,165, 78,247, 50, 51,115,236,241, 27, 14, 0,248,182, 71,239,210,151,173,243,203, 23, 65, 40, 20,162,251,188, 69,239, 61, 75,
- 60,207, 51, 48,226, 31, 69,178, 42, 82,180, 62,172,111,126,171,104, 5, 4, 4, 68, 5, 4, 4,188,167,142, 85, 19, 85, 43, 90,
-101,165,187,234,162,228, 97,173, 12,107,215,174, 69,139, 22, 45,244,118, 68, 27, 55,110,196,254,253,251,215, 2,136,173,182,228,
-216,189,149, 59,214,157,136,106,212,212,157, 2,128, 21,179, 7,208, 5, 5, 5,184,113,227, 6,204,205,205,241,236,153,193, 97,
-191, 76,205,205,205,151,211, 52, 61,140, 41, 63, 3,160, 98,130,201,241, 60,127, 36, 39, 39,167,210,240, 14,132, 0, 90, 29,139,
-130, 66, 21, 52, 26, 13,102,127,179,185,202, 76, 4, 0,148, 86,147, 39,240,233,226, 45,171, 76,209,105,219,162, 43,166,141, 53,
-121,175,243,102,104,128,166,129,150,109,139, 20,151, 7,161, 81,224,121,128,227, 1, 43, 27, 11,236, 58,240,147, 94,146,207,114,
-124,241,219, 49,135,124, 53, 7,215,246,253,241,234,113, 72,169,130, 36, 22, 21, 13, 25,139,132, 66,240,132, 42,138,250, 80, 89,
-171, 43,150, 57,101,165,196, 58,239, 8,138,192,164,254, 45,112,244,114, 56,134,246,240,192,213, 59,143,224,219,206, 13, 81, 79,
- 95,194,221,185, 62,182,236, 62, 2, 66,144,247,243,186,239, 95,191,237,208,216,120, 67, 20,173,219,183,111, 43,203,171, 88,101,
- 63, 73,213,253, 33, 8,121,171,104, 41, 85,106,204, 91,104, 80,232,157,162, 58,234,220, 94,102, 72, 98,125,138,149, 33, 68,172,
-188,178,133, 42,194,179, 52, 4,208, 26, 88,240,159,108, 56, 57,142,195,153, 51,103, 74,235,163,162,122, 44, 91,119, 6,144, 28,
-196,199,199, 35, 42, 42, 10,237,219,183, 71, 78, 78, 14,132, 52,141,185, 17, 17,112, 27, 59, 22, 26,145, 8, 60,207, 67, 44, 22,
- 99,242,228,201, 6,151,103, 53, 91,231, 98,199,107,174, 42,227, 63,121,123,123, 55,137, 41, 40, 64, 84,116, 52,122, 44, 91, 6,
- 0, 56,123,246,236, 59,247,196,156, 57,115,196,143, 30, 61,154,120,239,222,189,137,201,201,201,107, 1,204,173,180,157, 37,234,
- 82, 31,173,207, 71, 13, 65, 19,151,134,216,255,235,129,210,227,115,230,207,130, 80, 40,130, 80, 36, 68, 45,243, 90, 6, 93,141,
- 78,167, 43, 37,173,133,133,133,244,217,179,103, 29,123,246,236, 41,154, 53,107, 22, 5, 0,251,247,239,167, 55,109,218,164,184,
-116,233,146,168, 78,157, 58, 41, 85, 40, 4,185, 73, 25,106, 9, 0,212,171, 87, 15,155,183,255, 78,247,235,215, 15,179,102,205,
-130, 78,167,195,214,173, 69,207,213,200,145, 35,161,213,106,113,236,216,177,146,231, 88,175, 26,197,106,181,239,221, 55, 20, 69,
- 65, 40, 20, 66, 36, 22, 1, 60, 15,138,162, 20,107,214,172, 89, 17, 21, 21,213,198,197,197, 5,106,181,122, 44,138, 38,127, 24,
-227,104,253,151,145, 45,125, 92,164, 34, 95,171, 98, 85,170, 50,164,149,245,219,170,140,168,149,245,217, 66,205, 38, 80, 24,230,
-163, 85, 17, 24,134,169, 82,173, 42,153,170,171, 15,115,230,204,129,169,169,105,101, 29, 16,137,136,136,120,148,146,146,178, 3,
-192,230, 26, 85, 78,112, 88,212,242,175, 7,229,161,120,108,181, 86,173, 90,233,221,186,117,203, 7,160, 61,124,248,221, 23,100,
-181, 90, 93,105, 7,110,110,110,190,124,231,206,157, 51, 7, 14, 28, 72,151, 15, 49, 80,118,120,175,100,211,233,116, 56,124,248,
-240,204, 5, 11, 22, 32, 39, 39,231,107,125,157,120, 97,129, 18,202, 98, 71,232,231,145, 71, 13,109,212, 43, 61,100, 82,203, 30,
-142, 13, 61, 42,237, 76,104, 81,145, 15,145,109,189,183, 29,152,169,169, 20,156, 30,155, 20, 69,199,190, 76, 72,174, 83,215,174,
- 54,158, 39,166,193,182,126, 11,100, 37,189, 45, 7,129,128,129,176,120,232,176,150,153, 2,105,111,222,128,166, 25,189,196,248,
-251,223,194,112, 39,242, 37,142, 93,126, 0,173,170, 0,235,246,158,135, 86,157, 15,173,170, 0, 90, 85,209,231,170, 5, 95,130,
-162,240, 90,167, 46,104, 90,157,122, 23, 8, 4,104,215,174, 93,165, 68, 39, 41, 41,201, 64, 69,139,148, 42, 90, 74, 85, 53,235,
-200,176, 55, 39,189,138, 85,201,241,154, 18,131,146,144, 15, 50,153,172,245,158, 61,149,135,113,168, 8,118,118,118,231, 76, 76,
- 76, 26, 24,154,190, 26,193, 75, 87,213,170, 85,107,185,139,139,139,235,186,117,235,132, 12,195,160,123,247,238, 77,237,236,236,
-226, 1,192,221,221,221,161,164,141,153, 58,117, 42,185,125,251,118,100,209, 59, 70,229, 16,139,197,209,230,230,230,173,125,125,
-125,145,147,147,131,196,196, 68, 40, 20, 10,184,253,244, 19, 34,166, 78,133,231,182,109,160,187,117, 3, 69, 81, 16,139,197,136,
-136,136,128, 76, 38,139, 86,169, 42, 13,249,214, 14,192,106, 0, 29,241,118,184,144, 0,184,129,162,176, 11,119, 42,104,239,104,
- 0,224,120,190,170,202, 26, 53,111,222, 60,100, 11,133, 64,191,126, 16,197,198, 66,171,213,162,125,251,246,165, 42,123,251,246,
-237, 33, 16, 8,224,225,225, 1, 7, 7, 7,108,217,178,101,148, 62,162,165,202,215, 34, 62,246, 21,188,189,189, 75,149,171,126,
-253,250,149, 42, 90, 66,161,176, 84,217,162,184,170,137, 43, 69, 81,164,236, 75, 50,199,113,148, 64, 32, 16,124,253,245,215,212,
-144, 33, 67,136, 70,163,225,197, 98, 49,125,236,216, 49,234,234,213,171,130,130,130,130,170,212,134,130, 17, 35, 70,216,212,173,
-235,136,196,231, 81, 56,122,148, 96,237,218,181,184,118,173, 40,202, 70, 76, 76,209,196,213,146,125, 95, 95, 95, 52,104,208, 0,
-164,138, 27,185,181, 22,192, 0, 0, 32, 0, 73, 68, 65, 84,191,249,160, 97,248,182,103,159,162,246,164,129, 53,132, 34, 33,196,
- 34, 17,230, 69,191, 42,173,107,179, 61, 7,197,129,129,129, 67, 93, 92, 92,138,134,246, 1,129, 49,142,214,127, 23,170, 16,122,
-210,202,145, 36, 77,153,253, 52, 0, 84,241,126, 90, 25, 66,149, 70, 81,212, 93, 66, 72,155,114,105, 75,142,107,202,125,150, 28,
-127, 88,131,236,151,172,117,248, 30,249,210,247, 70,252,244,214,173, 91,206, 94, 94, 94, 72, 72, 72,120,111, 38, 92, 73,199,165,
- 80, 40, 32,147,201,112,243,230, 77, 0,120, 90,153,177,171, 87,175,110, 66, 81,212,101, 20, 15, 27,120,251,126,222,245,102,219,
-222,109,240, 91,192,129,156,148,148, 20, 15,188,141,161, 67, 57, 56, 56,140, 17,138, 5,195, 27, 53,175,231, 3,158, 95, 29,124,
-250,198, 50,125, 87,216,168,169,123, 62, 0,101,201,172,195, 26,206, 62, 4, 77,211,195, 6, 14, 28, 72, 63,122,244, 8,195,135,
- 15,199,254,253,251, 43, 77, 59,102,204, 24, 28, 60,120, 16, 3, 7, 14,164, 23, 46, 92, 88,105,120,135,119,213, 18,205, 71,187,
- 41, 99,158, 61,196,190,131, 59, 43,245, 65,178,177, 41,242,199,122,243, 38,189,244,183, 54, 94,250, 71, 70,120, 86,115, 41,236,
- 94,168,119,135, 46,221, 69,137,169,217,224, 89, 53, 84,121,111,207, 47,204, 78, 5, 97, 85, 16,201,107,195,206,202, 28,247,111,
- 93,212,104, 53,170, 75,250,108,206, 28,232,142,169, 3, 92, 1,194, 99,208,220, 93, 8,218, 60,163,244, 13,186,211,144, 89, 8,
- 62,188,193, 96, 31,191,242, 16, 10,133,136,136,136, 80, 86,166,102, 49, 12, 99, 72, 76,174, 98,213, 81,135,194, 66, 37, 10,149,
-170,143,217,118, 88,219,218,218,254,108, 97, 97, 33,173,132, 72, 89, 91, 91, 91,255,108,105,105, 41, 53,116,232,176, 50,146, 85,
- 28, 87,235,158,159,159, 95,181,200,150, 68, 34,105,240,244,233,211,210, 96,165,250, 62, 53, 26, 13,124,125,125, 13, 13, 94,122,
- 26,192, 11,123,123,251, 27,110,110,110,230,207,159, 63,199,129, 3, 7, 68, 66,161,176, 94, 73,251,145,151,151, 7,134, 97,240,
-230,205, 27, 29,128, 9,168, 98,232, 76,173, 86,135,132,132,132,180, 28, 48, 96, 0, 19, 29, 29, 13,134, 97,138,242,229,237, 13,
-207,109,219, 16,249,245,215,240,121,249, 18, 42,173, 22, 82,169, 20, 23, 46, 92,208, 22, 22, 22,134, 84,102, 79, 38,147,237,136,
-139,139,115,151, 74,165,208,106,181,224,121, 30, 52, 77, 83, 2,129,160, 83,173, 90,181, 54, 2,104, 83,174,178,108, 60,219,248,
- 54,227, 88,150, 75, 73,120,158, 86, 85, 1,100,100,100,224,244,233,211,104,223,190, 61,124,124,124,144,148,148,132,216,216, 88,
-244,237,219,183, 52,205,195,135, 15, 17, 22, 22,134,198,141, 27, 87,173,232,209, 58, 52,110,214, 0, 34,145,168, 72,205, 17,138,
-138, 95,124,132,165, 74,150, 72, 40,130, 80, 32,132, 84, 38, 53, 88,209,162, 40, 10, 52, 77,131,162, 40,200,100,178,146,151,108,
-222,209,209, 49, 37, 51, 51,211, 30, 0, 35,147,201,192,113,156,222,151, 22,158, 16,103, 81,250,205,228,185, 11,126,180, 9, 8,
-184,140,203,151,223,128,166,105,216,219,219,131,166,105,196,197,197,129,166,105, 56, 57, 57,129,166,105, 36, 37, 37,149,144,196,
- 44, 84, 78,134, 75,159, 27,138,162, 74, 73,150, 72, 44, 42, 85,182, 0, 32, 59, 59, 91, 53,112,224,192,127,171,213,234,241,168,
-217,170, 39, 70,252,141, 65, 81,212,221,255,196,185,213, 64,191, 98, 98,245,158, 83,188,190,155,177,111,135, 14, 29,182,141, 28,
- 57,178,251,250,245,235, 97, 98, 98,130,148,148,148,210, 14, 81, 44, 22,163,110,221,186,200,204,204,196,246,237,219,241,234,213,
-171, 43, 0, 38, 27,154,163,148,148,148,219,207, 30, 60,205,240, 29,218,193,210,189, 67,179, 90,137, 79, 95,181, 79, 73, 73,185,
- 89, 76,178,118,141,156,211,119,188,239,224,182, 16,137,133, 72,124,246, 26,193,167,111,252,191, 84, 38,195, 48, 12, 69, 81, 24,
- 62,124,184, 65,233, 71,140, 24,129,144,144, 16,232, 27,102,228, 75, 20,173, 66, 21, 10,148, 31,239,197,106,218,140, 49,152, 54,
- 99, 76, 41,153, 48,100,232, 5, 0, 28, 28, 14,233, 33, 90,218,245, 65,135,182, 79,106,213,214,219,169,181,123, 3,220,185,247,
- 0,191,109,123, 43, 50,236,222,180, 2, 63,236,190,130,186,182, 22,208,170, 11,112,238,232, 47,175,181,234,194,245, 53, 20,229,
-138,200, 45, 69,129, 16,190, 90,215, 94, 66,158,132, 66, 33,154, 55,111, 94,169,162,149,153,153,169,172, 74,205, 42,173, 35,141,
- 14,249, 5, 74, 40, 11, 63, 26,209,242,236,212,169,211,165, 35, 71,142, 88,218,216,216, 32, 57, 57,185, 60,209,242,236,216,177,
-227,165, 35, 71,142, 88,218,218,218, 34, 49, 49,209,224,176, 34, 21,144, 44,164,165,165, 81, 89, 89, 89,188,133,133, 69,181,200,
- 22, 77,211, 80,171,213,120,252,248,177,161,127,107,240,108, 46,115,115,243, 61, 7, 15, 30, 52, 79, 79, 79, 7,195, 48,120,252,
-248,241, 59,179, 14, 75,182, 93,187,118,137, 6, 13, 26,180, 51, 59, 59, 91,239,180, 54,150,101,215,142, 25, 51,102, 98, 82, 82,
-146,133,141,141, 13, 82, 82, 82, 32, 22,139, 65, 8, 1,229,235,139,206, 47, 94, 64,203,113,144,201,100,136,137,137,193,142, 29,
- 59, 10,138, 67,197, 84, 40,144, 81, 20,229, 44, 18,137, 48,122,244,232,119, 14,236,221,187, 23,159,182,102, 90, 91,155, 11,242,
- 89, 72,213,169,178, 62,231, 24,134,161, 60,219,117,107,218,174, 75,191,230, 79, 34,239, 60, 79, 75,125, 85, 85,163,164,211,104,
- 52,112,113,113,193,221,187,119,113,249,242,101,116,235,214, 13, 62, 62, 62, 8, 15, 15,199,197,139, 23, 17, 22, 22, 6,138,162,
- 96,105,105, 89,226,126,161,215, 7, 67, 83,200,226, 77,114,198,123,234, 85,249,125,145, 72, 4,181,210,176,201,125,209,209,209,
-184,123,247,110,105,104, 25,134, 97,216,177, 99,199,130, 16, 66,226,226,226, 96,106,106, 74,252,252,252, 56,129, 64,192, 38, 37,
- 25,230, 31,108, 98, 98, 2,103,103,231,119, 94,124, 74,182,206,157, 59,227,222,189,123,160,105, 26, 2,129, 0, 54, 54, 54,184,
-113,227, 70,149, 55,126, 9,169, 42, 33, 89, 2,145,240, 29,210,199,243,124, 94,120,120,248, 36, 0,225,197, 74, 22, 96,140,163,
-101,196,255, 31,206,224,253,133,165,171, 84,180, 94, 0,232,113,224,192,129, 81, 39, 79,158, 92,187,113,227, 70,235,254,253,251,
- 35, 43, 43, 11, 78, 78, 78,176,183,183, 71, 80, 80, 16,206,158, 61,155,206,113,220, 92, 0, 21, 73, 63, 61,160, 39,102, 77,210,
-243,148, 35,234,252,252,169, 94, 62,174,184,114,248,122,128,157,157,221,100,134, 97,102,251, 45,250,108,124,215,129,109, 16, 19,
- 22,135,219, 23, 35,144,154,144, 94,165,205,242,206,240,181,106,213,154, 40,151,203,197,168, 96, 42,113, 5,179, 14, 75,109,114,
- 28,199,105, 52, 26, 28, 58,116,200, 32,178,117,224,192, 1,168, 84, 42,112,239,143,175,150,218, 36, 60,161, 4, 66, 9, 28,234,
-186, 64,171, 45, 0,207,215,120, 66,101,169,205,146, 55,208,231, 98, 49,108,210,211,113,231,206, 29,195, 40,119,191,126, 85,213,
-145, 74,163,202, 27,189, 97,229,188,160,233,254,171,107,117,235,208, 18,223,254,180, 23, 90,237,110,208, 12, 13,153, 68, 4,175,
-182, 29,193, 64,141,159, 3,231,103, 23,230,102,141,198,251, 75,241,188, 99,147,232, 27, 97, 33, 0,199,243,184,124, 45,212,224,
-107, 47, 51,204, 1,129, 64,128,103,207,158, 41, 43,154,109,200, 48, 69,195,156, 37,111,234,250,108, 18,158,167,132, 34, 41,234,
- 58,185, 65,163,206,255, 40,117,100, 99, 99, 51,255,196,137, 19,150, 37,161, 18,194,195,195, 65, 81,212,227,183,138, 99,209,113,
-165, 82,137,200,200, 72,132,135,135, 3, 69, 51,220, 12,126,142, 74,148,172,180,180, 52, 42, 37, 37, 5,114,185,156, 14, 15, 15,
- 87,123,120,120,220,171,226,249, 46,181,169, 82,169, 94, 86,230, 63,169, 82,169,234, 72,165, 82, 97,185, 14,207,161, 73,147, 38,
- 49, 21, 12, 33,190,151,207,156,156,156, 59, 11, 22, 44,240,234,221,187, 55,230,207,159,159,105, 97, 97, 97,250,243,207, 63, 11,
- 24,134,161,166, 79,159,206,189,121,243, 38,255,151, 95,126, 49, 63,121,242, 36,178,179,179,111, 26,112,237,121, 42,149,106, 82,
-135, 14, 29,246,158, 63,127, 94,238,236,236,140,220,220, 92, 16, 66,176,103,207, 30, 76,159, 62, 29, 82,169, 20, 49, 49, 49,248,
-244,211, 79, 11, 11, 11, 11, 39,225,125,223,201, 18,155, 20, 69, 81,132,231,121, 44, 89,178,164, 52, 56,105, 73,176, 82, 83, 25,
-133, 29,115, 26, 42,102,253,146,163, 24,245,237, 47, 99, 1,128, 99, 89,238, 73,228,157,231,123, 54,127,123, 85, 36, 18, 93,171,
-162,142, 22,207,154, 53,235,231,126,253,250,201, 76, 76, 76,144,153,153,137, 27, 55,110,224,214,173, 91,184,125,251, 54, 52, 26,
- 13, 44, 45, 45, 97, 97, 97,129,148,148, 20, 68, 71, 71, 43, 1, 44,214,103, 83, 44, 23,162, 81,211,146,153,191, 69, 10,150,176,
-204,108,195,178,234,150, 72, 40, 52,232, 57,234,210,165, 11,218,181,107, 87, 66, 86,184,248,248,248, 20,181, 90, 77,149, 33,253,
- 73, 37,132,188, 94,189,122,236,254,253,251, 73, 85, 54,121,158,127,143, 76,119,238,220,185,244,165,176, 93,187,118, 96, 24, 6,
- 15, 30, 60,168,204, 53,229, 29,155,183,119,108,193,249,239, 22, 67, 44, 18, 97,238,227,196, 82,210,181,183, 91, 43, 8,197, 34,
-184, 14, 24, 82,246,220,173, 40, 26, 46, 68, 57,146,165,175, 63,250,224,231,221,104,243,127, 30, 41,168,193, 18, 60, 37,248, 77,
-165, 82,157,251,242,203, 47, 3, 61, 61, 61,191, 92,183,110, 29, 37, 18,137,176,108,217, 50,146,156,156,252,107,241, 27, 67, 86,
- 77,114, 69, 8,249,245,143,227, 55,167,140,243, 31, 72,205, 89,239,215,233, 94,112,100,116,139, 14,206,104,209,193, 25,247,174,
- 60,194,230, 69, 7,246,115, 58,110,201,235,215,175, 19,170, 48,165,238,209,177, 89,121,103,120,203,144,171,193,150,213,157,117,
-200,243,252,145, 3, 7, 14,204, 28, 60,120, 48, 29, 26, 26,250,158, 79, 86,201,178, 59, 60,207,227,210,165, 75,208,106,181,248,
-245,215, 95,121,158,231, 43,143,163, 5,114,106,195,250,192,113,191,238, 59, 37, 22,139, 40,220,186,118, 12, 57, 89,250,103,117,
-137, 68, 66,236,218,115, 92, 43, 18, 9,159, 84,116, 92,171,213, 38, 6, 7, 7,219,246,226, 56, 33, 77,211, 21, 17,168, 10,113,
-228,200, 17, 29,207,243,241, 85, 36,187,153,250, 42, 97,192,247,243, 39, 28,232,247,249,151,182, 29, 58,116, 18, 90,217,216,130,
-162, 40,188, 73,125,131,152,200, 80,221,185, 99, 59, 83, 11, 10, 13, 91,130,103,194,143,127,148,250,100, 1, 64,255,233, 27, 75,
-253,179, 0, 96,128,223, 2,248,182,119, 7,101,136,244,244,150,100,241, 44,203, 66,161, 80,128,101,217, 10, 67, 60,152,155,155,
-203, 84, 42,149,178, 56, 16,163,222, 55,102, 2,124,244, 58,226, 56,206, 53, 43, 43, 11, 5, 5, 5,184,117,235, 22, 89,185,114,
-101, 90, 90, 90, 90,169,211,166, 78,167,115,205,204,204, 68,126,126, 62,110,222,188, 73, 2, 3, 3,211, 50, 50, 50, 22, 85,231,
- 25,146,201,100,173, 5, 2,193,189,172,172, 44, 94, 46,151,211, 58,157, 78,231,225,225, 33,145,201,100, 6, 47,168,158,146,146,
-210,187,178, 99,141, 26, 53,122,250,244,233,211, 38, 28,199,149, 93, 3, 81,164, 82,169,156, 59,116,232, 96, 72,251, 49,107,247,
-238,221, 56,126,252,120,219,220,220,220, 49,241,241,241,123, 1,180, 21, 8, 4,120,240,224,193, 99,149, 74, 53,114,240,224,193,
-123,178,178,178,238,160,104, 9, 30, 67,112, 62, 38, 38,102,180,171,171,235,238,229,203,151,155,248,248,248, 8, 28, 28, 28,208,
-166, 77, 27,196,196,196,224,204,153, 51,186,173, 91,183, 22, 20, 22, 22, 78, 0,112, 73,127,181,131, 98, 89, 22, 98,177,184,116,
-147, 72, 36, 16,137, 68,200, 83, 18,124,241, 83,172,146,133, 76,185,118,217,164, 51, 4,160, 94, 39,198,166,191,121,157,120,135,
-162,168,107, 41, 41, 41, 57,149,148,153, 88,165, 82,181, 36,132, 48, 20, 69,173,215,106,181,126, 51,102,204,176, 95,181,106, 21,
-154, 53,107,134,244,244,116, 40, 20, 10, 56, 59, 59, 35, 45, 45, 13,161,161,161, 92, 97, 97,225, 54, 0, 43, 80,236, 63, 82, 25,
-178,211,115,225,104, 87,239, 29,229,147, 16, 2,194, 1, 58, 53, 7, 78, 75,160,161,116, 16, 10,117, 16,137, 68,134, 12,169, 16,
-158,231,145,101,111, 15, 62, 50, 18,183,111,223, 6, 33,164, 82, 85,205,197,197,197, 32,133,148,227,184,247,136,214,157, 59,119,
-192, 48, 12, 58,117,234,132,176,176,176, 82, 69,203, 32,191, 68,194, 67, 44, 17,191, 51, 92, 72, 81, 20, 68, 98, 49,132, 98, 81,
- 69,179,113,140, 42,150, 17,127, 27, 24, 58,142,157, 13, 96,242,195,135, 15,247,118,237,218, 53,136, 16, 34, 68,209,120,228,245,
- 15,249,243,215,175, 95,223,191,121,230,254, 66, 91, 71,139,192, 62, 99, 58,161, 89, 75, 39,112, 44,135, 27,103, 31,224,215, 85,
- 39, 15, 38, 37, 38,249,193,128,181,207,120,158,191,218,177,117, 51, 26,101, 98,117, 59, 56, 56,240, 53,153,117,152,147,147,179,
-116,238,220,185,152, 63,127,126, 77,102, 29, 86,136,136,232,180,201, 20,136,227,128, 62,157,123,129,162,137, 70,163,214,211,240,
-161, 52,114,169, 72, 36,124,114, 55, 60,197,163,162,116,105,105,105,189,198,143, 31,127, 73, 32, 16, 52,168, 78,153,243, 60, 31,
-159,154,154,218,189,234,148,236, 13,181, 50,215,249,244,193,237, 95,159, 63,190,187, 23,207,115,141, 41, 0,140, 64,244, 92,167,
-213, 94, 80, 43,115,215,193,192, 69,165,215, 76,246,198,172, 13, 23,177,101,254, 0,204, 8, 60,140,157, 75,190,192,194,159, 14,
- 96,245,252, 89, 88,185,241,223,248,118,214,104, 12, 29, 53,158, 39, 20,253,167,161,215,193, 48,204,249,237,219,183,143,251,226,
-139, 47, 74, 39, 45, 16, 66,222,105,132,117, 58,157,146,231,121,108,219,182,141, 7,112, 94,159,189,119,235,136, 34,250,252,165,
- 12,173,163,220,220,220, 9,222,222,222,123, 0, 72, 8, 33,207,178,178,178,190, 2,222, 46, 13,149,159,159, 63,161, 67,135, 14,
-123, 8, 33, 18,138,162,222, 59,110, 8,138, 67, 61,180,182,176,176,184, 87,172,100, 73,106,226, 16,175,175,168,245, 12, 43, 26,
- 50,132,248,127,236, 93,119, 92, 20, 87,219, 61, 51,219,151, 93,202,210, 89,138, 2,138,130,162, 66,108,216, 91, 36, 42,214,136,
-198, 40,150,152,152,188,182,168, 73, 4,163,177,151, 36,182,168, 49,106,236, 70, 99,195,168,136, 53, 88, 18,141,177,128,136,160,
-210,123, 91,150,178,192,246,157,153,239, 15, 74, 16, 41,139, 38,239,151, 55,217,243,251, 45,187,195,204,156,189,247,238,157,185,
-103,158,251,220,231,161, 1,204,173, 19,241,125, 93,247,238,221,235, 38,149, 78, 40, 41, 41,233,250, 10,229,186,170, 82,169, 58,
- 46, 91,182,108,129, 64, 32, 24,168, 84, 42,219, 1,128, 72, 36,122,174,209,104,174,171, 84,170, 45,104, 62, 54,149,150,166,233,
-231, 6,131,193,215,206,206,174,106, 69,109,181,216, 2,128,115, 15,168, 7, 0,213,173,202, 40,126,212,232,130, 69, 70, 70,182,
-150, 72, 36, 67, 9,130, 24,207, 48,140,119,121,121,185,102,217,178,101,119, 78,158, 60, 89,230,238,238, 62,108,196,136, 17,132,
-181,181, 53,238,223,191,207,200,229,242,211, 0,150,192,136,149,214, 52, 77,103,124,253,245,215,104,233,245,222,212,126,157, 78,
-151, 31, 25, 25,105,251, 86, 97, 33,155,166,105,140, 28, 57,242, 5, 1, 87, 31,207,158, 61,131, 70,163,105, 54,152, 99,105,105,
- 41,186,119,239,254,194, 3,106,205, 43, 35, 35, 3,214,214,214, 47,124, 79,115,207, 88,154,178, 18, 12, 90,176, 24,168, 94, 81,
- 90,131, 42, 75, 22, 3, 70,107,210, 85, 38,252,125,241, 87, 39,223, 52,202,180,232,228,228, 52, 81, 32,226,207,110,213,206,169,
-115,110, 74, 97,124,121,153,242, 72, 94, 94,222,238, 70,110,228, 70,113,182, 48, 96,169,201,252,251, 23,113,254, 17, 71,139, 2,
-195, 80, 96,104, 6, 12, 67,131,166,169,170,132,215, 12, 13,134,162, 8,130,192,175, 90, 85,147,145,193,235,151, 83, 98,107,107,
-187,138, 97,152,183, 88, 44, 22, 89,247, 70, 93,247,115,181, 37,235,146, 76, 38,251,162, 1,203,235,255, 92,123,158, 60,121,178,
- 65,241,111,236,170,195,224,224, 96,170,133,215,230,117,145, 72,228,212,208,190,202,202,202,204,188,188,188,161,127,147,246,172,
-187, 98,176, 37,156, 45, 94,117,216, 28,103,171, 86,173,248, 58,157,206, 31,128, 23, 65, 16, 86, 0,138,117, 58,221,229,162,162,
-162, 2, 0, 93, 1, 44,171, 62,103, 53,128, 7,255,207,215,187,208,214,214,118, 63, 73,146, 46,198,156,108, 48, 24,180,197,197,
-197, 83,235, 61, 16,252, 49, 5, 15,176, 4, 92,238, 61,144,164,115, 67,215, 99, 99,159,193, 48, 57,149, 42, 85,119,226,143,123,
-126, 45,167,141,141,205, 3, 54,155,237, 98, 68,217,178,229,114,121, 87,211, 61,249,127,154,243,127, 25,245,157,224, 27,141, 20,
-255, 87, 8, 45, 19,167,137,211,196,105,226, 52,113,154, 56, 77,156, 38,206,127,186,208,106,112,219,180, 4,214, 4, 19, 76, 48,
-193, 4, 19, 76, 48,225,245,112,161,158,216,186, 80,243,129,104, 66,149,182,196, 36,248, 42,202,246,154,137,211,196,105,226, 52,
-113,154, 56, 77,156, 38,206,127, 29,167, 9,127, 34, 76,102, 85, 19,167,137,211,196,105,226, 52,113,154, 56, 77,156,255,116, 52,
- 58,117, 72,154,218,198, 4, 19, 76, 48,193, 4, 19, 76, 48,225,175,129,209, 66, 75,228,224,237, 99,219,170,243, 65,137, 75,167,
- 88,137, 75,167, 88,219, 86,157, 15,138, 28,188,125,254,165,237, 38, 4,240, 46,155,205,190,234,232,232,168, 64, 35,169,119,254,
- 1,176, 0, 48, 30, 85,241,125,198, 2, 48,251, 51,201,251, 3,236,137,192,236, 16, 32, 51, 4,200,156, 8,204,238,255, 15,244,
- 27, 92, 49,207, 41,224,214,197,119, 47,174,152,231, 20,208,224,254, 69, 78, 54,119,175, 4,127,179,110,182,212,250, 79,250, 74,
-115,123,123,251, 61, 14, 14, 14,233,246,246,246, 25,246,246,246,251, 1, 88,154,110,119, 38,152, 96,130, 9,127, 25,106,124,180,
-106, 94,181, 62, 90,108, 0,136,136,136,232, 15,224, 6,128, 1, 65, 65, 65, 55,235,159, 45,113,243,157,217,198,163,205,167,107,
- 86, 44, 33, 28,237,109,205, 12, 20,173, 75, 75,207,234,176,124,205,134, 83,185, 60,246,230,146,204,184,189,175, 80, 40,130,197,
- 98, 77,228,243,249, 65, 0,106, 4, 91,130, 70,163,137,160, 40,234, 56,140, 91,166, 13, 7, 7,135, 91, 44, 22,171,117, 75,190,
-152,162,168,204,130,130,130, 62,175,216,152,193,110,110,110,251,251,247,239,111,214,189,123,119,240,120, 60, 44, 91,182,108, 81,
- 94, 94,222, 22, 99, 9, 36, 18, 79,115, 29, 95,240, 49,155,199,123,147,209,107,125, 25, 48, 0,201,143,163, 13,154,159,185, 26,
-205,230,146,146,148,114, 35,169,150, 0,152, 86,221, 86,123, 1,124,253, 58,189,100,170, 31,244,122,170,170, 79,112,217,160,206,
-166, 90,222,248,252,243,207,217, 65, 65, 65,216,187,119,111,159, 61,123,246,124, 80, 94, 94,254, 51,128,115, 0,146, 95,183, 87,
- 58, 0,179,122,245,233,243,205,212, 69,139, 88,170, 91,183,240,205,254,253, 91, 81, 21,111,233,219,150,246, 37, 46, 23,227,109,
-109, 57, 65, 12, 3,127, 2, 32, 8, 32, 70, 38,167, 35,117, 58,234, 56,140,136,197,214, 4,222,197,139,203,241,143,182,148,160,
- 44,153, 89,202, 31,233,211,183, 44,249,250, 82, 0,195,234,239, 55,168, 5, 83, 25,150,107,144,138,137,206, 2,176,233, 53,155,
-213,204,206,206, 46,246,236,217,179, 46,221,187,119,103, 3,192,131, 7, 15, 66,130,130,130, 6,201,100, 50, 95, 0,138,255,167,
-155,144,128, 77,146,179,121, 28,206,155, 20, 69,117, 2, 0, 22,139,245, 88,171,215, 95, 53,208,244,183, 48, 50, 38,155, 9, 38,
-152,240,207, 69,115, 90,228,111,142, 70, 35,195,215, 84,142,169,251, 94, 23, 34,251,246, 29,122, 14,126,251, 89, 89,185, 82,157,
-158,158, 83,178,112,246,218,171, 31,204,223,248,211,166,239, 35, 34,111,254,158,112,215,167,251,208,120,145,125,251, 14,141, 80,
- 55, 54,135,235, 38, 20, 10, 31,238,220,185, 83,247,252,249,115,166,180,180,148,121,246,236, 25,115,250,244,105,230,163,143, 62,
- 82, 11,133,194,135, 0,220,140,225,116,112,112, 40,120, 22,117,133,201,142,141,102, 50, 30,252,206,232,245,122, 70,167,211, 49,
- 58,157,142,137,191, 20,193,196,158, 11,103, 98, 78, 31,103,180, 90, 45,163,213,106, 25,141, 70,195,120,120,120,228, 26, 89,206,
-250,144,118,236,216, 81, 27, 17, 17,193,156, 58,117,138, 89,180,104, 17,211,165, 75, 23, 10,192, 28, 99,235, 46,178,247, 26,104,
-238,220, 89, 54, 51,244, 91,221,133, 59,151,153, 39,169, 49,204,147,212, 68,230,228,181, 4,102,218, 39,219,116,230,206, 93,100,
- 34,123,175,129,205,213, 93, 34,145,244, 36, 8,130,169, 1, 0,166,117,235,214, 21,117, 95,110,110,110, 47,188, 92, 93, 93, 43,
-220,221,221,147,109,108,108,252, 27,226,156,212, 9, 12, 19,127,148, 97,226,143, 50,159,247, 3,243,228,201,147,187, 12,195,220,
-168,121,169, 84,170, 27,103,206,156,185, 49,122,244,232, 27, 0, 70, 53,209, 78, 70,181,103, 8,144, 89,126,246, 44,195,108,217,
-194, 48,253,251, 51, 9, 0, 19, 2,100,182,144,211,195,209,145, 19,179,241,235, 15,180,103,207, 30, 96, 46, 94,188,192, 68, 70,
- 70, 48, 63,157,217,207,108,221, 50, 91,231,224,192,137, 3,208,182, 5,156,108, 0,107, 1,108, 70,149,229,242,185, 76, 38, 99,
-242,243,243, 25, 0,207,171,255,183,217,206,206,110, 19, 26,182,190, 13,169,107,201, 90,240,150,227,197, 9,195,250, 48,229,101,
-185,204,132, 97,125,152, 5,111, 57,190, 96,217,122,203,211,211,124,238,200, 78,178, 39, 15,142, 80,115, 71,118,146,189,229,233,
-105,254,138,237, 73,160, 42, 79,232,206,168,168, 40, 3, 83, 7,122,189,158, 57,116,232, 16, 37,145, 72, 14,180,128,179,157,157,
-157, 93,134,181,181,245,243,186,255,180,235, 60,182,151,119,223,144,229, 54, 29, 70,247,111, 65, 57,187, 11,184,220,236,171, 39,
-190,163,228,153,143, 25,173,170,128, 41, 75,138,102,178, 19,238, 50,135,118,111,214,243,216,236,108, 0,221, 95,167, 47,181, 16,
- 38, 78, 19,167,137,243,111,200,217,148, 22,249, 95, 6,187,126, 5,235,131,207,231,133, 46,255,124, 49, 81, 42, 47, 85,169, 21,
-229, 90,189, 90,173, 38,185,140,250,113,124,106, 33,201,102,149, 46,152, 63,207, 60, 52,236,243,208, 74, 96,178,145,223,233,214,
-165, 75,151,123,225,225,225,246,214,214,214, 40, 43, 43,131, 92, 46,199,189,123,247,192, 48, 12,198,141, 27,199,239,209,173,155,
-255,210,101,203,126,203,206,201, 9, 64,227, 3,239, 31,226,197,218, 22, 95,247,169,202, 69,251, 69,186,188,106,212, 33, 8,236,
- 9, 14,170, 61,102, 85,118, 85,182, 12,129, 64, 80,155,144,248, 21, 16, 48,120,240, 96, 46, 0,188,247,222,123,138,242,242,242,
-245,213, 22, 14,163, 50,173,138,236,189, 6,218, 58, 73, 35,190,219,245,181,176, 83, 27, 47,232,244, 6,100,228,231,130,205,177,
-130,139, 11, 23,211, 39,191,201,233,215,203,218,118,237,234, 61, 23,242,105,140, 85, 22, 37, 94,110,140,203,202,202,234,208,241,
-227,199,113,226,196, 9, 0,192,243,231,207,225,229,229, 37,106,174, 12,113,113,113,158,163, 70,141,250, 81, 46,151,183,109,238,
-216,250,129,241,249,124, 62,250,244,233,131, 14, 29, 58,224,236,217,179, 3,170, 45, 91,175, 5,213,173, 91, 16, 63,122, 4,220,
-124,165,135, 23,143, 55,222,104,117, 55,242,194, 17,219, 11,145, 9,216,180,105, 63,146,147,171, 12,109,158,158,158,120,119, 82,
- 48,231,241,227, 59, 29,199,143,127,247,206, 47,191, 36,247,169, 22, 74,205, 97,229,247,223,127,191,196,221,221, 29,227,199,143,
- 15,238,216,177,163,163,133,133, 5,118,239,222, 13, 39, 39, 39, 79,173, 86,155,116,246,236, 89,105,126,126, 62,230,205,155,135,
-130,130,130, 69,141, 17, 13, 8, 28,176,148, 63,210,167,111,251, 55,166, 66,108,225,132,239,143, 29,199,179,135,135,250,106,116,
- 9, 75,185,212,205, 41, 42,134, 63, 77,150, 41, 14,109,221,181,191, 77,219,142,163,208,234,141,104, 91, 53,245, 75,234,210, 55,
- 61, 54,176, 5,234, 67, 43, 54,229,201, 95, 34, 29,127,146,229,171,120,106, 29,119, 21,114, 96, 5, 93, 35,176,106,173,181, 12,
- 70,245,235,215,175,246,135, 75, 79, 79,135, 70,163,129,143,143, 15,169,213,106, 7, 26,217,174,237,134, 14, 29,250,107,100,100,
-164, 77,187,118,237,100,197,197,197,181, 59, 28,109,172, 2,111,134,111,157,183,246,155, 31,188, 15, 51, 68,169, 44,225,167,199,
-205,112,117,239,221,243,141,107, 23,195,143,136,137,138, 44,240,172,138, 0, 90,142,148, 31,247,129, 48,179,198,196,143, 22,178,
- 7, 14, 30,228,252,230,176,183,175, 61, 75, 76, 30, 12,224,190,233,185,222, 4, 19,254,213, 86, 45,230,159, 86,167, 90,161, 21,
- 20, 20, 68, 52, 84, 65,154,161, 59, 59,216,219, 8,183,110, 60,120,159,165,211,106, 69, 86,150, 90,142,165, 5, 77,152, 91,178,
-116, 90,125, 69, 43,207, 86, 60,154,161, 59, 55,194, 95,127,137, 39, 33, 20, 10,195,207,157, 59,103,207,225,112, 64,211, 52,236,
-236,236,144,150,150,134,210,210, 82,148,151,151, 35, 57, 33, 1,238,110,174, 88, 17,186,216,105,222,226,208,112,165, 82,217, 21,
- 47, 78, 35,190,180,108,148,210,191,152, 55,186, 38, 5,203, 75,143,252,213,255,107, 96,159,177, 75, 81,211, 50, 51, 51, 33, 22,
-139,225,235,235, 43,190,125,251,246, 47, 77,136,172, 23, 56, 37, 18, 79,115,154,207, 59,177,243,187,101, 66,157, 62, 14,241, 41,
-197,104,239,222, 23, 14, 54,110,200, 45,214,226,238,189,115,136,139, 61,138, 54,206,110,152,243,209, 32,193,134,175, 79, 29,231,
- 26,220,221, 74, 75,211, 20, 13,113, 42, 20, 10,177,135,135, 7,220,220,170,242,158, 81, 20,133,248,248,120, 80, 20, 85,187, 93,
-247,253,224,233, 40, 24, 20, 25,152, 26, 18, 2,185, 92, 46,110,136,147,195,130, 97,225, 7,239,178,133, 28,128, 39,178,214, 86,
- 84, 84,212,166,225,208,233,116,136,137,137, 65, 64, 64, 64,255,147, 39, 79, 54,167,138,140,106, 79, 29,240,213, 55, 7, 14,108,
-155, 92, 86, 70, 2,192, 94,130,160,117, 12,243,149,177,125,201,222,158,115,250,210,197,195,182, 44,242, 41,172, 45,191,196,189,
-123, 25,208,233,170,202, 43,151, 23, 98,238,108, 5,184, 28,115,156, 61,251,131,141,143, 79,159,211,249,249, 58, 95,188, 56,141,
-216, 80, 57, 5, 23, 47, 94,196,220,185,115, 17, 31, 31, 47,173,201,209, 38, 20, 10,177,113,227, 70,150,143,143,143, 84, 36, 18,
-225,210,165, 75, 40, 40, 40, 32,154, 42,231,141,203, 55,214,148, 37, 95, 95,154, 79, 92,122,235,251, 99,199,241,254,164,137,112,
-100, 82,126,177,108, 67,172, 25, 58,178,247, 23, 12,203, 53, 72,100,222, 89,226,229, 59, 18, 92,158, 24,115, 62, 91,133,231,113,
-231, 37,202,242,216,217, 4,149,229,186, 98,211,201,249, 47,149,243, 84, 48,245,222,209,219,111, 92,117,187,223,234, 81,204, 7,
-191,231, 69,239,137,253, 67,104,121,178, 9,146,178, 4,170,210,154, 36, 37, 37, 33, 57, 57, 25,108, 54, 27, 42,149, 10, 6,131,
-161,193,114, 74,165,210, 89, 6,131,225,139,234,223,249,160, 64, 32,152,113,228,200, 17,155,186, 66,219,174,243,216, 94, 54,230,
-162,193, 5,133,242,146, 59,247,159, 60, 91, 56,107,252,128, 91,119,227,178,116,156,209,153,101,177,103,203, 26,105, 79,129,144,
-199, 59,125,233,204, 15, 98,125,106, 20, 68, 62, 3,192, 17,123,129,210,231, 64, 89, 82,137,242,228, 60,104,190,219, 1,191,217,
- 11,112,254,167, 83,226,142,157,186,158,212,232,245, 94, 0,180,175,112,109,182, 4, 38, 78, 19,167,137,243,239,201,217,168, 22,
- 97, 24,230, 13, 0, 14,213,155,242,106, 93, 96, 11,160, 8, 85, 25, 5, 28,170,239, 29,188, 58,167,213,223,174,123,108,253,237,
-186,159,229,213,159,237,171,223,239, 19, 4, 81,220, 76,209,157, 80,149,154,240, 66,245, 59, 80, 61,149,216,172,227, 49, 65,144,
- 10,138,162,249, 92, 59,123,245,123, 19, 6,119,186,114,237, 65,140,153,173, 5, 59,112,128,127,255,123,143, 83,127, 35, 72, 66,
- 79, 16,164, 81,126, 31, 44, 22,107,226,214,173, 91, 59, 89, 88, 88,128,166,105, 88, 90, 90, 66, 38,147, 65,171,213,162,172,172,
- 12,154,114, 5,116,229, 10, 60,202, 74, 71,239,254, 3,240,246, 91, 67,125,126,248,233,220, 68,138,162,126,108,138, 87,218,217,
-191,214,146,181,170,181,205, 31,166,137,172,210, 90,209,245,165,191, 23,184, 98, 49,222, 92, 24,250, 58,125, 32,250,194,133, 11,
- 23,199,141, 27, 55,236,147, 79, 62, 33,243,242,242, 46,165,165,165,245, 6, 16,223,172,168,224, 11, 62,254,207,199, 65, 18,137,
-152,193,201,171,231,208,207,127, 18,204,120, 44,200, 21, 58, 16, 4,144,240, 36, 28, 4, 97,141,216,231,121,232,235,103,129,161,
-129, 62,226,159, 78, 37,124,130, 63,252,131, 94,250,105, 74, 74, 74, 80, 88, 88, 8,189, 94, 15,189, 94,143,241,193,193, 56,124,
-232, 16, 42, 43, 43,161, 82,169,160,213,106, 65, 81, 20, 72,146,196,213,136,147,200, 74, 77, 64,175,128, 0,160,145,212, 75,135,
- 98,192, 1,112,247,217,179,103, 72, 72, 72, 64,118,118, 54, 4, 2, 1, 28, 29, 29,177,106,213, 42,104, 52, 85,249,196,130,131,
-131,251, 3,120,252,186, 23, 84, 50,176, 39,141,162,150, 14, 59,115,198,254,246,153, 51,244,221,243,231,179,249,229,229,187,141,
- 57,151,203,197,248,175,191,250,168,189, 72, 36, 66,118,230, 86,120,123,115,177,104,129, 13,214,127, 89, 4, 0,152, 55,215, 5,
-221,186,218, 66, 81,122, 10,182,246, 75,176,109,219,252, 54,211,166,109, 14, 81, 42,169,131,205, 80, 47, 61,119,238,220,219, 94,
- 94, 94,206,209,209,209, 4,143,199,131, 80, 40,132, 80, 40,132, 64, 32, 64, 97, 97, 33,210,210,210,152,175,191,254, 58, 7,192,
-210,166,136, 86,108,203,251, 13,192,176, 5,111,225,226,179,135,135,250, 58,179, 82, 31,189, 61,167, 79,122,236,221,232,242, 43,
- 87,111,175, 54,168, 5, 89,165,217,215, 22,123,116,139,182,157,253,233, 74,236,248,122, 57,158,253,126,171,216,193, 77,241,173,
-144,208, 52, 88,206,254,253, 87,176,157, 28,172, 13,179,166,189,109,117,222,225,206,172, 72, 54, 33,203, 47,122,184, 17,105,209,
- 42,126, 91,255, 41,237, 60, 73,109, 84, 84,148,176, 95,191,126, 80,171,213,181,150,201, 35, 71,142,208, 6,131,225,122,131,125,
- 83,167,251, 34, 39, 39,199, 73,165, 82,225,173,183,222,154,183,113,227, 70, 81, 77, 62, 57,138,162, 94,176,100,173,217,114,248,
-242,199, 95,124,123,253,242,143, 95, 74,215,132,206, 24, 48,121,206,218,235,104, 36,143, 36,155, 36,103,159, 63,179,223, 81, 32,
-209, 67,104, 61, 20,234, 2, 21,158,237,121, 31, 74,133, 26,221,214,172, 4,192,131, 86, 79, 98,247,200,241,224,216, 72,177,124,
-230, 12,233,231,187,191,255,136,166,233,173,166,231,122, 19, 76, 48,161, 30, 28, 8,130,136, 0,128,208,208,208, 37,235,215,175,
-127, 66, 16, 68, 4,195, 48, 65,213, 6,148, 8,134, 97,130,106,142,169, 22,103, 47,109,215, 28, 91,127,187,254,231,176,176,176,
-142, 27, 54,108, 88, 23, 16, 16,240,227,157, 59,119, 82, 1, 52, 39,180, 70, 84, 11,171,151, 82,239,144, 53, 10,178,238,251, 11,
- 22, 45,154,190,149,148,154,174, 28, 58,164,135, 75,196,205,199,247,167, 79, 31, 49,120,226,200,126,129,105,153,242,132, 54,173,
- 28,109,159, 60,121,108, 65,211,244, 45, 99, 90,137,207,231, 7, 13, 26, 52,136, 93, 82, 82, 2, 51, 51, 51,200,100, 50,228,228,
-228, 64,167,211, 65, 93, 86, 10, 77, 89, 41,212,165, 37,208,149,149, 32,249,193, 61,116,110,227,201,175,118,150,111, 18, 53, 86,
-151,250,150,170,186,150, 45,158,185, 57,248,230,230, 32, 90, 62,109, 56,218,202,202,234,110,205,160,170,211,233,102, 47, 94,188,
-184,136,166,105,172, 93,187,214, 66, 44, 22,159, 4,192,111,142,196,220,142, 21, 20,224,231, 75, 62, 77,139, 69,159, 46, 83,209,
-206, 99, 56,210, 10, 84, 40, 42,215,161,176, 84,135,110,253,182,163,117,151,149,112,245, 91,143,132,140, 98, 72,157,189, 72,176,
-249, 77, 38,127,206,202,202,122, 97,251,199, 99,199,160, 84, 42,209,166, 77, 27, 76,154, 52, 9,139, 23, 47,198,164, 73,147, 32,
-149, 74, 49,121,194, 40, 44, 95,190, 28,249,249,249,205, 21, 85,211,174, 93, 59, 77,171, 86,173, 52,173, 90,181,210,232,116, 58,
- 84, 84, 84,160,180,180,180,126,123,207,111,105, 67,218,219,219,135, 57, 58, 58,198,218,219,219, 63,225,243,249,145, 49, 4,241,
- 84,221,170,149, 67,239, 49, 99,136, 14, 19, 38,176, 50,132, 66,226, 38, 32, 54,134,203,214,154, 51, 98,224,160, 97,188,210,146,
-253,181, 70,170, 25,211,237,240,235,205,142,184,253, 75, 87,204,157,221, 6, 4, 41, 0, 65,242,160,172,140, 66,143,238, 1, 92,
- 43, 43,162,185,190,244, 46,128,152,222,189,123, 75,231,204,153, 67,240,249,124,204,155, 55, 79, 55,115,230,204,196, 73,147, 38,
- 37,254,252,243,207, 84,171, 86,173,224,234,234, 74,184,186,186, 58, 1,136,169, 62,167, 73, 88,180, 33,214,104,116, 9,191, 88,
-121,137, 82, 41,216,246,170,208,243,199,175,216,148, 39, 95,179, 51,117, 83,218, 51,165,231,179,223,111,201, 19,227,206,211,105,
-247,111, 20,229, 38,150,123,174,217,153,186,105,201,183,185, 13, 94,212, 55,111,130, 14,143,184,169, 83, 86, 42,217, 99, 70, 14,
- 84,206,122,111, 98, 59,107,113,199, 35,112, 30,218,165,181,155,203,228,229,235,182,233,102,126,244,177,110,239,190,253, 76,121,
-121, 57, 20, 10, 5,182,109,219,102, 56,127,254,124, 14, 69, 81, 31, 55,246, 12, 4, 0,122,189, 30,179,102,205, 18, 89, 88, 88,
- 32, 43, 43,171,214, 34, 10, 0,121, 50,249,227,219,247,227,158, 46,252, 48,184,127,165, 70,163,185,124,227, 65, 66, 7,175, 86,
- 46, 4,193, 52,186, 16,133,199,225,188,217,181, 71, 15, 22,195,148,130, 96,187, 33,249,208,215, 80,228, 23, 67, 81, 88, 12, 22,
- 71, 4, 3,248,208,211, 60, 88,117,238,142,231,247,163,225,108,231,192,230,115, 56,129,166,241,196, 4, 19,254,157,104, 74,139,
-212, 21, 75, 27, 54,108, 88,215,212,254, 58,239,218,122,219,181, 66,170,190, 8,171,251, 25, 0, 54,108,216,176,142, 97,152,160,
- 59,119,238, 28, 3,160, 50,178, 10, 31,212,121, 55, 62,142, 22, 75,173, 93,255,201,226,165,144, 88, 10, 45,187,251,123, 57,158,
-189,116,243,193,173, 59, 15, 18, 90,187,218,218, 49,122,173,228,171,205, 59, 92, 8,165,106,131,145,133,240,177,181,181,133, 78,
-167, 67, 82, 82, 18,178,179,179,161,211,233, 96,168,172,132,166,180, 20,234,146, 18, 80,149,229,224, 82, 20, 84,178, 66,216,152,
- 9,128, 63, 86, 36, 54, 99,121, 35, 26, 20, 90, 53,239, 2, 11, 11,240,205, 45, 64,114, 56,205,102,138,175,131, 55,186,119,239,
-126, 34, 46, 46,174,199,144, 33, 67, 86,163,106,137,124, 70, 78, 78,206,224,101,203,150,105, 28, 28, 28, 48,107,214,172,246, 0,
-166, 54, 43, 50,121, 90,159, 86,142,237,209,206,115, 42, 90,187, 14, 66,105,165, 30, 50,133, 30,133,165, 58,236,222, 30,128,211,
-123,187,227,215,211,125, 17,119,249, 77,148,234, 29, 33,150,142, 6, 67,105, 59, 54,197,121,245,234, 85,172, 90,181, 10,171, 87,
-175,198,218,181,107,177,122,245,106,228,228,228,192,215,215, 23,153,153,153,184,120,241, 34,242,242,242, 96,107,107,139,123,247,
-238, 97,203,150, 45,248,245,215, 95,155,173,116,141,112, 53,226,152, 22,205,165, 27, 12,134,105,121, 99,198,116, 42,176,182,238,
-224,239,239, 63,108,222,188,121,158,189,123,247,174,221,239,233,233,233, 38, 20, 10,243, 81,181,130,210,175, 41, 46, 26,240,183,
-179,243,133, 86,243,180,250, 55,230,128, 32, 4, 24,244,102, 2,122,247,125, 0,157,158, 11,146,224,131, 36, 5, 48, 24,228,144,
- 72,164, 96, 24,194,183,153, 34, 46,147,201,100, 94,215,174, 93, 35,211,210,210, 32, 16, 8, 0, 32,125,197,138, 21, 59, 54,109,
-218, 20,111, 99, 99, 67, 69, 68, 68,224,167,159,126, 66, 80, 80, 16,107,230,204,153, 94,174,174,174,187,154,171,247,138,109,121,
-191, 29,221,124,241, 29,142, 94,226, 39, 16,182,118, 71,165,120,244,127,250,219,138, 0,224, 82, 74, 74,185,189,155, 98, 67,101,
-121,108,166,149, 75,197,151,151, 82,154, 91,113,186,130,126,152,248,244,238,209, 51,151,202, 10, 11, 74, 56,254,157, 58,170,214,
-175,250,148,219,218,189,237, 87,203, 23,127,232,152,163, 16, 44, 42, 9, 57, 0, 0, 32, 0, 73, 68, 65, 84,148,190, 57,239,226,
-211,240, 75,247, 42,166, 76,127,223,240,222, 7,115,212, 23, 47, 93, 61, 67,211,116, 39, 52,178,226,144,166,105,228,229,229,225,
-201,147, 39, 72, 73, 73,129, 76, 38, 67, 81, 81, 17,202,203,203,107,167, 27,205,202, 21, 23,118, 28, 56,255, 72, 36, 20,154,245,
-232,228,229,246,123,116,124,161, 72, 40, 52,243,114,119,107, 7,172,104,240, 62, 66, 81, 84, 39,129,153, 16, 0,129,210,184, 91,
-168, 40,169, 64, 69,105, 5,202,139, 43,160,209,177,160,214,144, 80,105, 73,180,234, 63, 20, 21,149,106, 84,200,203, 64, 83, 84,
- 23,211,112, 99,130, 9, 38, 52, 49,214, 71,132,134,134, 46, 49,242, 88,163,167, 55,235, 11,175,208,208,208, 37, 4, 65, 68,132,
-133,133,117, 68,227, 11,170,234, 98, 79, 3, 47, 0, 70,132,119,144,203, 19, 43,204, 9,159,113, 11, 62,251,226,226,177,125,219,
-237, 53, 26,101,166,141, 68, 76,137,205,120,182,239,205, 90,139,242,138,146,177,149,198,135, 35, 64, 73, 73, 9, 82, 83, 83, 33,
- 20, 10,193,229,112, 64,169, 84,160, 84,149, 80,149,200, 65,234, 52,224, 82, 20,172,205,132,104, 37,117, 68,107, 7, 71,163, 56,
-147,162,174,212, 58,190,215,157, 46,252,186,187, 15,120, 34, 49,120,230, 98,252, 39,226, 6, 0,128,203,229, 2,203, 86, 27,101,
- 52,113,118,118, 62,119,244,232, 81,174, 76, 38, 67, 76, 76,204, 35, 0,101, 0,204, 1,208, 9, 9, 9,215,226,226,226,130,188,
-188,188, 0,160, 77,115,100,138, 34,146,210, 27, 24,100,229,167, 35, 45, 59, 26,214,150, 30,224,152,181, 67, 97,169, 14,124,161,
- 7,244,154, 63,102, 31,213,138, 12,168,116, 44,163,234,174,213,106, 97, 48, 24, 96, 48, 24,160,213,106,241,193, 7, 31,224,246,
-157, 59,248,241,167,159,145,154,252, 28,237,221, 29, 17, 18, 50, 5,221,187,119,199,157, 59,119,154,228,154,234, 7,189,179, 24,
-236,205,195, 72,240,196, 54,154,158,139, 47,255,222,156,216, 34, 8,130, 65, 35, 83,145,245,176, 41, 32, 32,160,237,243,202, 74,
- 60,121,250, 20, 67, 86,172, 0, 0, 68, 70, 70,190, 80,151,133, 11, 23,242,226,227,227,223,123,240,224,193,123,185,185,185,155,
- 1, 52,236,108,206, 0, 23, 46,252,134, 15, 63,140,135, 76, 38, 3, 0, 28, 63,246,135, 46, 77, 75,213,225,173, 17, 85, 51, 90,
- 86, 86, 86,216,188,217,215,168,246,164, 40, 10,123,246,236,169,157, 46, 4, 0, 54,155,221,123,225,194,133,227, 26, 58,190,109,
-219,182,220,230, 56, 23,140,119, 22,252,250,136,153,109,217,182,117, 71, 11,219,206,144,235,163,125,163,115,242,230, 46, 24,239,
-188,117,203,169, 28,181,144,208, 28, 36,168, 44, 87,182, 64,125,200,152, 50,166, 92,218,174,149,183,154,118, 40, 95,166,248,124,
-206,251,239,218, 88, 88,217, 87,238,221,177, 94, 66,178, 72,230,220, 3, 93,105, 71, 79, 27,171,209, 61,191,169,248,112,193,178,
-104,173, 33,107, 14,178,206, 61, 71, 19, 33, 46, 40,138, 66,110,110, 46,100, 50, 25, 50, 51, 51, 81, 84, 84, 53,253, 90, 84, 84,
- 4,154,166, 95,231,134, 8, 85,102, 38, 50,206,236, 69,235, 41, 83,208,109,245, 42, 80, 52, 27, 42, 37,133,205,189, 6,163,164,
- 76, 5, 13, 77, 64,250, 70, 47,188, 31,249, 11, 72,134, 2,118,127,107, 26, 73, 76, 48,225, 95, 10, 99,194, 59,212, 8,162,245,
-235,215, 7,253,217,223, 95, 87,108,173, 95,191,254,201,250,245,235, 91,242, 93,245,167, 12,107,183,107,124,180,110,212,113, 64,
-123,105,208, 44, 47, 74, 72,137,143,103,231, 86,170, 42,205, 28,236,237, 52,102, 2, 62, 93,166, 40,103, 69, 63,126,164,171,204,
- 79,126,214,130,122, 36,196,197,197,249,230,230,230, 34, 51, 35, 3, 6, 85, 37, 72,141, 22,140, 90,137, 33,125,122, 65, 0, 64,
- 64, 18,224,210, 58,176, 89, 60,148, 87, 40, 0, 32,161,217,193, 81,175,127,201,178, 69, 16, 4,120,230,230,224,137, 68,224,137,
-205, 95,176,112, 25, 99,177,225,243,249, 71, 79,158, 60,233,228,236,236,140, 85,171, 86,193,197,197,197, 91, 42,149, 42, 45, 45,
- 45,133, 14, 14, 14,232,208,161, 3,122,245,234,133,139, 23, 47, 2, 70,196,148,210, 27, 4,177,207,210,209,187,168,248, 14,126,
-185,241, 29,180, 42, 13,252,251,127, 7, 29,187, 53,236, 58,174, 4,157,116, 4,202,252,179, 85,214, 3,199,145,200,206, 76, 7,
-193,226, 61, 49,214,242, 84,243,249,209,163, 71, 56,118,246, 38,156, 90,249, 32, 51,241, 41,158, 94,191,134,219,118, 54,104,229,
-211,161,118, 26,168,209, 50, 82, 96,175,249,182, 42, 76,212,210,217,239,242,139,139,139,249,214,214,214,154,154,182,115,114,114,
-122, 29,177,245,238, 39,159,124,130, 82, 14, 7, 24, 49, 2,220,148, 20,232,116, 58,244,236,217, 19,221,186,117, 3, 0,244,236,
-217, 19,108, 54, 27,157, 59,119,134, 84, 42,197,183,223,126,251,110, 99, 66,139, 36, 16, 99, 48,200,189, 61, 61, 61,107,133,214,
-161,195, 50, 68, 63,120, 19, 4,120,216,182, 35,169,246, 88, 55, 55, 55,228,231,165,128, 32,152,184,102,202,184,218,209,209,113,
-153,147,147,147,231,166, 77,155, 88, 2,129, 0, 31,125,244,145, 71, 69, 69, 69,235,106, 83, 50,194,194,194, 0, 0,203,151, 47,
-199,138, 21, 43,160,209,104,148,141,145, 29,218,220, 73, 90, 88, 76,191,199, 84,152,141, 29,104,219,186,211,160,192, 33,240,240,
- 26,132, 65,129,153, 0,176,206,154,157, 62,225,171,207,173,206, 88,153, 19,251,175, 92,186,186,188, 79,255, 65,159, 47,174,184,
-190,230,203, 61,165,205,250, 60,150,101, 28, 44,127,198,155,184,101,251,174,195, 91,190, 8,155, 47,200,148,105, 75,114, 74,152,
- 10, 49,159, 45,110,227, 64,136,231,126,182, 58, 53, 55, 55,101, 17,178, 46, 53,187,210,146,166,105,164,164,164,212,250,244,169,
-213,106, 84, 86, 86, 34, 43, 43,171,182,207,168, 68, 22,111,205,153, 62,178, 75,165, 74,165,252,253,113, 98,230,210,121,147, 3,
- 42, 85, 42,101, 98, 90,230,115, 96, 91,131,106,140, 36,201,199,202,114,229, 16,101,169, 26,178,152,103,112, 25,220, 10,122, 3,
- 1,173,129,130, 76, 94, 14,141, 1,160, 72, 14, 58, 78, 8, 1, 69,176, 81,148,155, 3,146,197,122,132, 23,157,246, 77, 48,193,
-132,127, 15,154,212, 34, 53, 22,173,128,128,128, 31,235, 90,157,106, 62, 3,208,160,105, 87, 30, 89, 93, 49, 85, 51,157,216,216,
-247,212,227, 53, 22, 47,249,104, 53, 27,222,161,230, 59, 93, 45, 21,210,175,151, 79,118,161, 13,134,246,133, 69, 5, 6, 54,155,
-207,113,181, 84,229, 21,103, 26,255,237, 26,141, 38,226,218,181,107, 99,222,124,243, 77,126,226,227, 71,208,150,149, 65, 91, 86,
- 10, 14,109,128,181,176, 43, 72,157, 6,132, 86, 11,103,111, 26,234,114, 33,110,222,142,211,107, 52,154, 8, 99,133, 22,201, 98,
-189,232,151, 37, 22,131,111,110, 1,190, 88, 92,127,106,177, 57, 81, 96, 54,116,232,208,193, 61,123,246, 4,195, 48,216,179,103,
- 15,116, 58, 29, 79,167,211, 65,171,213, 66,167,211, 65,161, 80,224,240,225,195,216,185,115,231,109, 0, 7,154, 29,204, 12,218,
-107,151,175, 70,117,159, 49, 57,136, 19, 25,177, 25, 6, 45, 5, 21,225,130,202, 74, 61, 42,180,102,160,108,166, 0, 5, 23,192,
- 98, 11, 16,208,217, 3,103, 79,133,235, 96,208,252,108,164, 10,127,193, 42,148,149,153,142,236,228,231, 16, 43,242, 97,103, 97,
- 6,101,202,115,248,135, 76,125, 37,235,132,171,171, 43,104,154,198,192,129, 3,107,157,171, 95, 85,108,201,229,114,156, 63,127,
- 30, 61,123,246, 68,255,254,253,145,147,147,131,148,148, 20, 12, 31, 62,188,246,152, 71,143, 30, 33, 58, 58, 26,109,218, 52,109,
- 36, 44, 42,214, 71,102,103,197, 4,143, 30, 61,154,123,247,238, 93, 48, 12, 3, 47, 47, 11, 88,152,139, 64,144,124,248,248,216,
- 3,168,122, 6, 24, 48, 96, 0, 20,138, 20, 67, 73, 9, 19,217, 76,117,143, 2,248, 73,171,213, 38,245,235,215, 79,154,156,156,
-140, 5, 11, 22,176,143, 31, 63, 94, 99, 74, 70,104,232,139,139, 41, 84,170,198,167,238,219,119,242,254,212,195, 32,233, 47, 16,
-182,118,183,176,237, 12, 15,175, 65, 0,128, 55,131,102,192,163,173, 27, 20, 69,177,238,106, 85,250, 88, 46,187, 68, 18,187, 45,
- 39, 94, 56,194,119,186,186,240, 70, 34,170,166, 78,155,253,217, 85,137,199, 11, 50, 57, 83, 78,252,116,238,226,172,225, 65,163,
- 56,122,202, 96,240,109,197,177, 58,121,230, 66, 97, 78, 70,230, 55,200,188, 20,247,135,253,175, 73, 43, 30,165, 80, 40, 32, 18,
-137, 16, 23, 23,167, 25, 49, 98, 4,159, 36, 73, 36, 37, 37,213, 10, 45,123, 91,235, 14,189,187,249,122,175,217,114,248,178,136,
-207,231, 7, 14,232,234, 19,159,152,145,205, 48, 68,122,163,214, 86,189,254,234,227,152, 71, 3,237,164,109, 89, 41, 55,238,194,
-166,239,112,104, 52, 36, 84, 90, 26, 26, 3, 96, 96,113,225,228,215, 3, 86,109,124,192, 0,184,127,247,182, 94,163,215, 95, 54,
-141, 53, 38,152,240,175,182,106, 49, 77,137,164,234,207,197, 0,210,215,175, 95, 95, 84,199,218, 36, 3,240, 8, 64,151,234,227,
-100,245,206,147, 17, 4,113,159, 97,152,110,117,120,100,117, 4, 87,221,207,218,122,199, 60,106,129,200,170,251,254,162,208,106,
-108, 73, 37, 0,216,218,218,218,251,251,119,109,243,253,190, 19, 96, 24, 6,207,162, 55,162,164,240, 41,150,173,251,173,141,179,
-179,115,255,156,156,156,155,198,148,128,162,168,227,251,247,239, 95,212,227, 13,127,127,119, 23, 23, 60, 74, 79, 3,151,161,192,
-165, 40,144, 58, 13,216,148, 22, 46,190, 20, 72, 66,140,220,220, 50,108, 56,122, 34,174, 58, 74,124,147,240, 30, 62, 10,171,178,
-203, 64, 16, 4, 54, 5,248,130,103, 46, 6, 87, 36,198,127,206, 69,213,138,171,136, 85, 97,224,137,197,104,211,195,168,128,240,
-202,235,215,175, 63,120,252,248,113, 55, 95, 95, 95, 44, 90,180, 8,233,233,233,160,105, 26, 5, 5, 5,234,188,188,188, 28,153,
- 76,150, 14,224, 12,128,239, 97, 68,228,113,174, 70,189, 53,226,244,161, 57, 1,125,250,219,142, 30,187, 19, 63,157, 90,136,210,
- 50, 5,148, 6, 33, 42,213, 6, 84,106, 88,176,182,233,132, 30,157, 59, 35, 55,167, 16, 79,238, 94,174, 96,107,148, 27, 91,210,
- 65, 9,130, 64,116,116, 52, 60,165,230,120,254,203, 77,216,154,113,208, 69,234, 8,105,239, 62,181,241,165,154, 2,135, 5,195,
-187,239,190, 91, 27, 25,126,232,208,161,105, 83,166, 76,113, 90,184,112, 33,246,237,219,135,219,183,111,191,228,160,221,191,127,
-127,220,186,117,107, 37,128,229,205, 25,245,180, 90, 45,188,189,189,113,255,254,125, 92,187,118, 13,131, 6, 13, 66,255,254,253,
- 17, 27, 27,139, 43, 87,174, 32, 58, 58, 26, 4, 65,192,198,198, 6,250, 42,241,172,111,140, 76,167,195,201, 47,191,218,191,100,
-203,150,157, 29, 39, 79,158,140,211,167,127,196,140,233,237, 65,144,124, 16, 4, 31,163, 70,182,199,170,213,247,209,163,199, 0,
-216,218,114,176,101,243,217, 84,149,138, 58,108, 68, 51,174,185,114,229,138, 84,173, 86,163,180,180,148, 17,139,197,132, 92, 94,
-181,162,181, 33,139,150, 82,169, 20, 52, 70,244,248, 97,194,198,210,114,166,132,169,136, 30, 91,108,136,238, 52, 40, 48, 11,111,
- 6, 77,199,213,136, 3,136,186,124, 13,214,236,244, 52,136,202, 47, 22,165, 21, 41,242, 42,189,118,249,188, 49,147,149, 93,121,
-121,215,220, 81,207, 89, 78, 78,244,201,176,239, 20,165, 77, 9, 45, 0, 68,113,252,145,115,103, 24,140,234, 21,208,163,173,175,
-155, 19,175,164,168,144, 57,117,246, 98,156, 46,237,244,249, 58, 2,139,105, 70,168,175, 10, 13, 13,253,162,250,243,193,165, 75,
-151,206,220,176, 97,131, 93,126,126,126,173,143, 86, 97, 81,113, 84,175, 17,115, 41,121,105,153,118,255,150,207,198, 11, 5,124,
-222,210, 13,251,111,232, 89,184,219, 24,175,129,166,191,157,176, 96,217,252,196,103,209,206,173,133, 60,156,253,108, 57, 30, 93,
-185, 14, 61,201,197,135,215,126,135, 70, 71,161,180, 72,142,159,223,155, 13,177,131, 4, 59,111,156, 46,160,105,250, 59,211, 80,
- 99,130, 9,255, 94, 52,166, 69, 8,130,104, 40,198, 94, 65, 3,255,187,223,212,121,141,240,252, 25,104, 52, 42,188, 81, 75,240,
-138,138,138, 10,111,221,250, 29, 55, 34,214,224,102,196, 26, 60,137,126,132,220, 28, 45,114, 10,212,176,176,176,248,173,137, 83,
-235, 71,142,101,148, 74,229,184,165,203,190,200, 23, 8,205,208,111,240, 96, 56,218,217,195,140,203, 1,203, 64,131, 69,112, 80,
- 33,179,194,243, 88, 37, 22,239, 63, 82, 88,161, 84,142,107, 96,144, 24,210,152,200, 32, 8, 2,124, 11,115,240,196,230,224,155,
- 91,188, 48,141, 40,176,176,128,192,220, 2,108, 30,175, 33,103,248,151, 56, 43, 42, 42,222, 30, 63,126,124, 73, 89, 89, 25,102,
-206,156,137,155, 55,111, 70, 95,190,124,217, 34, 54, 54, 86, 40,147,201,218, 2, 24, 10, 96,119, 19, 34,235, 5,206,146,146,148,
-114,198,160,153,184,254,139,143, 85,106,131, 13,130,167, 30,135,136,204,130,129,162,193, 0,144, 90,243,208,123,200,106, 20,106,
-123,225,248,174,181, 74, 90,167,158, 92, 47,134,214, 11,156, 12,195, 48, 14, 14, 14, 47,181,193,181,107,215, 16, 60,254,109, 4,
-142, 29, 3, 59,119, 79,216, 15, 25,142,192,153, 31, 98,215,174, 93, 32, 73, 18,182,182,182,245, 7,222, 90,206, 67, 49,224, 28,
-123, 12,226,216, 99, 16, 7,163,193, 6, 16,114,228,200,145, 47,187,116,233,114,253,246,237,219, 27, 1, 76,172,251, 93,117,176,
-162,158, 53,171,161,223,232,243,249,243,231,171, 18, 19, 19, 33, 18,137, 96, 48, 24,112,251,246,109,236,220,185, 19,155, 54,109,
- 66,116,116, 52,108,108,108,208,166, 77, 27,104, 52, 26,220,191,127, 95, 5,224,243, 38, 56,105,153,204,240,246,182,109, 27,228,
- 65, 65,125,177,127,255, 14, 56, 58,246, 2,135,237, 8, 54,199, 14, 34,177, 55,246,126,255, 37,134, 13,243,199,185,179, 39,138,
-139,228,134,183, 1, 24,140,232, 75,234,223,127,255, 29,187,118,237,194,248,241,227,115,130,131,131,169,178,178,178, 90,139, 22,
-195, 48, 96, 24, 6, 43,170,125,204, 52, 26, 13,191, 49,206,247, 23,199,229,124,182,246,201,170,130,252,156,158, 55,175,255,246,
-110,212,229,107, 72, 77,140, 66,212,229,107,248, 37,234, 78,104, 65,126, 78, 79,255,238,237,184,227,102,206,249,244, 80,248,105,
-150,216,194, 9,135,194, 79,179, 38,205,253,120,109,215,192, 65,159, 55,215,231,171,127, 71,166,162,176, 32,108,221,198,237, 21,
- 6,157,154,252,250,155,111,115, 85,178,188,207,235,244, 75,166,185,254,169, 82,169,118,171,213,106,169, 90,173,150,106, 52,154,
-207,211,211,211,251, 45, 90,180, 72, 70, 81, 84,173,181, 84, 22,127,238,183,167,191, 30, 92,103,111, 43, 17,246,234,214,177,253,
-230,221,167,110,100,102, 21,252, 80, 39,134, 86, 67,229, 84, 87,168,212,111,143, 25, 55,165,178,180, 68,131,128,143, 67, 65, 11,
-196,208, 80,128,158, 97,193, 64,176,241,120,205,102, 8,173,205,113, 52,237,161,178, 76,175,123, 27, 47,198,208,106,170,238,175,
- 3, 19,167,137,211,196,249,247,228,252, 95,134, 19, 94,204,117,232,244,130, 69,171,185, 37,149,206,206,206,253, 70,143, 26,130,
- 1, 65, 75,193, 48, 12,158, 62,252, 10, 37,178,103,112,118,228, 35, 37, 83, 17, 0,224,102, 11, 10,147,153,158,149,213,115,254,
-231, 75,195,131,135, 14,246,241,117,119,231,183,110,221, 10, 34,123,123, 20, 21,201,240,235,221,120,253,218, 99, 39,227,170, 69,
-150, 81, 19,147, 52, 77, 87, 57,185, 3, 24, 60,127, 49, 8, 22, 11,168, 14,227, 80, 51, 48,186,119,235, 5,130,205, 6,197,208,
-208,104, 52,198,172,150,203, 78, 78, 78,126,123,242,228,201, 63, 71, 68, 68,144,129,129,129,126,103,206,156,121,157,156,121,168,
- 44, 76,188, 14, 32,104,109,216,172,227, 61, 7,141,177,240,234,216,149,219,181, 53, 11, 58, 61,129,220,156, 12, 68,132,223,211,
-197,255,126, 89,193, 24,212, 19,149, 69,137,215,155,226,210,233,116,153,109,219,182,117,216,181,107, 87,173, 51, 60, 69, 81, 40,
- 42, 42,194,111,191,253,134, 78,221,122,192,103,250,123,144,201,100,216,182,109, 27,220,220,220, 48,114,228, 72, 20, 23, 23,195,
- 96, 48, 24, 59,225, 75, 1,184, 92,253, 66, 61,145, 69, 84,167, 0,106,114,218,208,211,211,147,167, 86,171,253, 24,134, 97, 17,
- 4,177, 85,171,213, 78, 11, 11, 11,115, 90,183,110, 29,218,183,111,143,162,162, 34,136, 68, 34,120,121,121, 65, 38,147,225,222,
-189,123,148, 82,169,220,133,170, 68,214,178,102,202,151,116,239, 94, 90,207,121,243,254, 19,254,229,134, 89, 94,106,205, 0,158,
-181,117, 31, 48,140, 1, 50, 89, 58,202, 21,183,117,171, 87, 29, 72, 46, 40,212,143, 3,144,104,100,157,151,207,153, 51, 7, 0,
- 4, 0,150,166,164,164,196,248,248,248,120, 53,102,209, 50, 6, 91, 78,229,168, 1, 28,123, 59, 80,186, 64, 81, 20,235,101,205,
- 78, 79,235,233, 75,111,219,114, 42, 71,109, 33,173, 92, 83,148,126,243,121, 94,229,229, 93,135,194, 79,179,166,142,125,155,114,
- 17, 39,134, 10,236,153, 83, 70, 80, 51, 93,186,116,113, 37,136, 98,143, 66,249,179, 7, 51,102,206,154, 96,201, 85, 69,118,113,
-145,183, 33,221,252, 5,209,209,209,105,104,225,202,208,106, 60,207,201,201,233, 23, 22, 22,118,153, 97,152, 23,124, 19, 10,139,
-138,163, 2,130,230, 48,165,165,101, 49,178,132,115,198,196, 82,187,119,239, 97,244, 96,223, 78,254,167,191, 92,183,193, 97,192,
-252, 69,236,231,215,111, 0,148, 30, 25, 55,111,128,226,107,233,205,119,174, 22,148,233,116, 99, 97,138, 10,111,130, 9,255,122,
-107, 86, 83, 90,228,111,142, 17,104,196, 25,222,232,202,120,122, 56, 95,110,239,213,122,168,155,139, 29, 0, 32, 37, 45, 23, 41,
-105, 57, 87, 82, 82,115, 2,155, 81,188,141, 45,175,172, 77, 42, 77, 84,135,112, 96,140, 75, 42,253, 2,167,141,141,205, 3, 54,
-155,237,210,146,214,160, 40, 42,183,168,168,200,223,200,114, 78,114,119,119,223,144,145,145, 17, 78,211,244,130, 22,170,253, 6,
- 57,107,146, 74,147,108,222, 16,198,160,237, 4, 0, 4,155,103, 76, 82,233,186,156,157,196, 98,241,110, 14,135,227, 86,243, 59,
-214,248, 96, 81, 20,197,210,233,116, 2,138,162, 88, 0, 8,146, 36, 13, 28, 14, 71, 77, 16,132,193, 96, 48,100,106, 52,154, 89,
-248, 35,224,104, 83,117,111,118,160,175, 22, 90,104,192,162,117, 13, 0, 18, 19, 19,219, 73, 36,146,137, 4, 65,140,103, 24,198,
-187,188,188, 92,179,108,217,178,232,147, 39, 79, 42,220,221,221,223, 26, 49, 98, 4, 17, 27, 27,139,184,184, 56, 70, 46,151,159,
-170,182, 98,165,180,176, 47,145,124, 62,235, 29,107,107,114, 4,195,160, 11, 24, 16, 4,137,199,101,101,116,164, 82, 73,253, 80,
- 45, 24, 91,218, 63,107,240,110,235,214,173, 15,164,165,165,113, 26,179,164, 54, 86,247,250,248,234,243,142, 75, 3,250,246,125,
-251,183, 95,126, 57,243,217,218, 39,171,234,238,155, 59, 70, 50, 99,210,236,249, 95, 29,251,246,155,207,182,255, 84,178,223,152,
-114,250,249,249,121, 18, 4, 49, 17,128, 47,195, 48,109, 25,134, 16, 16, 4, 83, 66, 16,196, 19, 0,177, 90,173, 54, 34, 62, 62,
- 62,251, 53,234,254, 42, 79,184,141,113,214, 38,149, 6, 69,117,166, 0,198,200,164,210,255,237,114,154, 56, 77,156, 38,206,255,
- 63,206,255,101,124,208,192,255,140,139, 12, 95,131,148,212,156,192,148,212, 28,180,109,219,150, 73, 74, 74,106,145, 72,107,108,
-144,166, 40,234, 71,165, 82,249,227,235,144,200,229,242,174,127,113,227, 29, 75, 75, 75, 59,246,103, 18, 86, 11,169, 85,213,175,
- 87,197,227,138,138,138, 30,198, 30,172,211,233,254,138,182, 33,170,173, 89, 43, 27, 59, 96,232,208,161, 25, 58,157,238, 26,128,
- 44,130, 32,172, 0, 20,235,116,186,203, 6,131,161, 32, 41, 41,169,235,230,205,155,107, 34,223,175, 6,240,224, 21,203, 65,107,
- 52,212,209,220, 92,234,232, 95, 80,199,163, 90,173,118,161,141,141, 77, 27,181, 90,205, 83,171,213,220,186,139, 15,132, 66,161,
-172, 41,135,248,186,176, 50, 39, 14,114,217, 37, 54, 86,230, 68,125, 33, 5,107,103,156, 86, 85,198,181,183,118,198,105, 99, 11,
- 22, 19, 19,147,210,165, 75,151, 35, 36, 73,186, 51, 12,227, 0, 48,150, 12, 3, 25,195, 48, 69,108, 54, 59, 39, 62, 62, 62,231,
-111,116, 19, 82, 27,104,122,163, 65,171,253,195,239,208,180,186,208, 4, 19, 76,248,231,160, 81, 31, 45,118, 75,153,146,146,146,
- 8, 83,123,154, 80, 87,108, 53,181, 51, 35, 35, 67, 3,224, 78,245,171, 62, 30, 0, 24,249,119,175, 96, 94, 94,158,127, 99,251,
-140, 21, 89, 64,149,207, 22, 16,215, 96,116,246, 21,219, 75,202,177, 61,252,211,150,150,237,209,163, 71,153, 48,114,138,221, 4,
- 19, 76, 48,193,132,191, 12,175,111,209, 50,193, 4, 19, 76, 48,193, 4, 19, 76, 48,161, 65,236,169, 35,184, 94,176,110, 17,104,
-124,229, 64, 75,230, 94, 95,101,245,193, 53, 19,167,137,211,196,105,226, 52,113,154, 56, 77,156,255, 58,206,127, 42, 94, 18, 89,
-255, 13,152,150,190,154, 56, 77,156, 38, 78, 19,167,137,211,196,105,226,252, 55,136,172,250, 47, 0,166,169, 67, 19, 76, 48,225,
- 95,140,147, 39, 79, 26,149, 84,244,157,207,246, 6,137,197,146,101, 21,138,178, 13, 63,110,156,113,166,230,255,193,193,193,148,
-169, 21, 77, 48,193, 4,188,138, 51,188,135,135, 75, 7,146,162,123, 51, 12,201, 98, 72, 70, 79, 40, 84,199, 83, 74, 74, 94, 8,
- 59,224,234,234,106,197, 33, 49,146, 96, 24, 17, 65,208, 20,205, 34,111,167,166,102,199,183,160, 96, 60,137, 68, 50,135,203,229,
- 14,209,106,181, 46, 36, 73,102,107, 52,154,107, 74,165,114, 7, 94, 14, 92,248,255,134,118,237,218, 77,186,113,227,134, 85,159,
- 62,125, 52, 66,161,208,160, 82,169,216,151, 46, 93,226, 15, 27, 54,172, 52, 57, 57,249,149, 86, 36, 74,165,210, 65,123,247,238,
-245, 8, 12, 12, 68,219,182,109, 43, 39, 78,156,200, 13, 8, 8,224,206,156, 57, 51, 53, 55, 55, 55,170,133,116, 29, 8,130, 56,
- 76, 16, 4,139,166,233, 16,252, 17,186,225,207, 6, 73,146,228, 44,130, 32,198, 50, 12,227, 73, 16, 68, 10,195, 48,103,104,154,
-110, 42,112,107, 83,120, 27,192,112,146, 36,253, 1,128,166,233,104, 0,145,128,241, 43,239,254,155,156,102,102,102,126, 0,160,
- 84, 42, 99,254, 44, 78,130, 32,252, 0,128, 97,152, 87,229,156, 46, 20, 10,223, 7, 0,149, 74,245, 61,140, 72, 7, 85, 31,204,
- 46,111,198,127,229, 83, 0, 64,244,114,111, 0, 64, 75,182,137, 15,159, 18, 45,249,174,134,248, 90,194,209, 0,134, 79,158, 60,
-121,221, 15, 63,252,176, 28,192,217,191,162,227, 59, 58,186,238,216,244,205, 30,233,199,115,222,219,128,170,140, 16, 77, 95,144,
-192,155, 60, 22,107,148,150,162,126,137, 7, 78, 2, 96, 91, 91, 91, 79,226,241,120,253,180, 90,173, 19,155,205,206,211,106,181,
-183,202,202,202,142,161,137, 12, 8, 70,183,107, 2, 36, 58, 37, 28, 9,250,143, 60,111, 12, 9, 13,215, 12,249,132, 15, 74,254,
- 6,183, 81, 18,192,252,234,186,238, 67,227,225, 60,154,186,249,124, 44,149, 74,199, 42, 20, 10, 37,139,197, 98, 80,181,234,185,
-234, 79,213,126,130,166,233,194,226,226,226,144,230,184, 68,110,104,207, 19, 17,135, 41, 61, 84, 6, 13,243, 81,101, 22,158,138,
- 93,209,139, 1, 66, 24,192,157,100,145,118, 52, 77,231, 1,136, 34, 13, 56, 95,145,139,164,191,233,224,222,170,186, 93, 91, 87,
-111,115, 0, 56, 0,136, 5,240, 49,128, 10,147,254,249,175,161,190, 51,252, 5, 0,121,181, 66,171, 78,184,251, 1, 65, 65, 65,
- 55, 61, 60, 92, 58,140, 31, 51,110,221,135,179, 62, 34, 88, 44, 18,113, 79,158,176,223, 13,153, 62, 84, 34,145, 56,139, 53, 26,
- 31, 16, 4,173, 20, 8,226, 20,138,178,156,147,199,126, 48,247,110,223,158,162, 40, 26,187,118,127, 55,236,212, 79,225, 75,140,
- 20, 91,237, 28, 29, 29, 15,135,134,134, 58,142, 26, 53,138,229,232,232,136,244,244,116,171, 31,127,252,177,253,246,237,219, 39,
-148,148,148,132, 0,120,254, 10,149,237,235,104, 77, 14, 53, 23, 18,131, 81, 78,161, 92,143,159,243, 85,184, 2,224,151, 87,109,
- 61,165, 82, 57, 87,169, 84,246,232,214,173, 27,179,111,223, 62, 98,218,180,105, 12, 65, 16,132, 74,165, 58, 8,224,149,132,150,
- 72, 36,250, 54, 48, 48,208,203,203,203, 43, 37, 57, 57,121,248,137, 19, 39, 34,167, 78,157,234, 41, 18,137, 18, 1,180,107, 33,
-221, 1,185, 92,222, 69,165, 82,193,197,197,101, 31,128, 55,254,130, 78, 68,176, 88,172, 51,206,206,206,204, 87, 95,125,117,182,
- 75,151, 46, 14,197,197,197,134, 79, 63,253,116,200,221,187,119,135, 81, 20, 53,170, 5, 98, 75, 66, 16,196,110, 7, 7, 7,219,
- 13, 27, 54, 36,117,237,218, 53,150,207,231,243, 18, 19, 19,205, 22, 46, 92,184,224,249,243,231, 19, 24,134,153, 5,180,104,128,
-144, 16, 4,177, 91, 42,149,218,174, 91,183, 46,221,223,223, 63,142,203,229,114, 19, 19, 19, 69,139, 23, 47,254,248,233,211,167,
-175,196, 73,146,228,174, 30, 61,122, 72,150, 47, 95,158,208,190,125,251, 59, 44, 22,139,151,157,157, 77,174, 88,177, 98,206,213,
-171, 87,131,105,154,254,240, 85,202,105,111,111, 47, 89,177, 98, 69, 66, 64, 64,192, 93, 46,151,203,125,246,236, 25, 25, 26, 26,
- 58, 39, 41, 41,201,232,114, 90, 91, 91, 15, 36, 8, 98, 79,126,126, 62, 27, 0,156,156,156,186, 91, 88, 88,108,175,155,211,178,
- 38, 20,133, 94,175, 47, 87,171,213,147,139,139,139, 27, 12,132, 59, 45,108,219, 72, 0,216,174,171,217,174,122,111,110, 27,216,
-117,222,152, 74,251, 57, 86,197,197,219, 84, 57, 99, 12, 0, 76,170, 78, 21,190,169, 18, 96,179,217,180,159,227,199, 76, 76,126,
-139, 66,198,140, 30, 52,104,208,138,168,168,168,239, 6, 12, 24,176,248,200,145, 35,246, 89, 89, 89, 95,254,242,203, 47,174,239,
-188,243,206,180,159,127,254,121,125, 81, 81,209,169, 63,171,243,243,184,124, 62, 65, 18, 16, 10,204, 44,140, 57,158, 67,146, 65,
-119, 70,143,126,255,251,103,207,252,183, 63,125,234, 81,233,228,212, 99,222,188,121, 14,227,198,141, 35, 93, 93, 93,145,148,148,
-100,115,228,200, 17,159,239,191,255,126,108,105,105,233,124, 0, 25,175, 35,178, 42, 75,209, 73,163,133, 63,195,192,170,246,130,
- 37, 80,202,215, 33,154, 73,192,227,191,129,216,250,226,192,129, 3,203,147,146,146,176,126,253,122, 0,216,209,194,243, 23,142,
- 30, 61,122, 68,120,120,184,240,228,201,147,194,110,221,186,193,209,209, 17,213, 15, 83,181,129,169, 61, 60, 60,140,107, 51, 26,
-155,182, 70,206,120, 35,174,248, 34,190, 29,151,191, 94,232, 2, 67,175,209, 94, 99,131,166,249,195,210,206, 12, 2, 49, 27,165,
-114,133,239,179,232,172,192,235, 39,146,190, 76,122, 40,219, 80,153,137, 47,208,120, 76,190,255, 23,216,216,216,236, 75, 77, 77,
- 29, 40, 18,137, 94,248,127, 74, 74,138,159,151,151, 87, 25,128, 69, 45, 21,110,118,118,118, 71,105,154,214,200,229,242,247, 0,
-192,220,220,252, 7,145, 72, 36,201,203,203, 91,242, 87, 61,200,212,160,190, 22,249, 31,183,104,213,250,107, 53,148,235,144, 32,
- 41,186,247,135,179, 62, 34, 38, 78,122, 39, 63, 41, 37,149,102,115,120,147, 46, 93,190,108,214,161, 67, 7, 82,179, 99, 7, 12,
- 50, 25,244, 11, 22,244,186,118,237,154, 62,120,210, 20, 21,135, 69, 28,240,244,112, 55, 59,126,236, 71,199,240,211,167,122, 3,
-104, 78,104,241, 28, 29, 29, 15,223,184,113,195,217,195,195, 3,165,165,165, 72, 79, 79, 71,101,101, 37, 38, 76,152,192,233,221,
-187,183,243,248,241,227, 15,151,149,149,245,105,129,101,203,161,173, 11, 59, 98,214,244,113,237,134, 13,237, 45,114,118,109, 3,
- 38, 95,141,172,228,167,221, 34,110,220,157,119,224,116,228,243,164, 50, 38, 8, 13,231, 70,106, 18, 69, 69, 69,159,141, 29, 59,
-246,244,192,129, 3,237,248,124, 62,164, 82, 41, 49,106,212,168,194,220,220,220,149,175,172, 90,170, 83,216,144, 36, 73,213,125,
-111, 32, 61,144, 49,112,145, 72, 36,144, 72, 36, 0,224,252,186, 79,158, 86, 86, 86, 59,204,205,205,199, 43, 20, 10, 21, 73,146,
- 12, 65, 16,140, 86,171, 21, 74, 36,146, 71, 9, 79,159, 75, 53, 26, 77,219,141, 91,191,255,102, 80,223, 46, 22, 87,175, 94,197,
-184,113,227,152, 43, 87,174,204, 50, 54, 79, 29, 65, 16,187,199,142, 29,171, 92,182,108,153, 58, 41, 37,221, 57,225,121, 10, 33,
- 18,240,104, 91, 91, 91,206,189,123,247,216, 91,182,108, 17,172, 88,177, 98, 55,195, 48,227, 91,208,158,187,223,121,231, 29,221,
- 39,159,124,146,247, 44, 41,213,254,113, 66, 18, 35, 22,112, 12,182,182, 54,172,187,119,239,210,175,194, 73,146,228,174,207, 62,
-251, 76, 49,107,214,172, 18,121,113,153, 99,137,162,130,225,115, 88,122, 71, 71, 71,246,217,179,103, 53, 71,143, 30, 37,223,127,
-255,253, 93, 52, 77, 7,183,160,125,119,141, 26, 53,170, 60, 52, 52,180, 52, 49, 37,205,241,113,252,115,152,241, 57,122, 7, 7,
-123,214,253,251,247,117, 27, 55,110, 36,215,172, 89, 99, 84, 57, 69, 34,209,161, 19, 39, 78,176,207,158,173,186,247,253,246,219,
-111,164,167,167,167, 89,221, 99, 84,106, 13, 72, 2, 40, 42, 42, 50, 11, 8, 8, 56, 4,224,165,224,190,254, 43,159, 98, 90, 24,
- 48,119,238,220,188,150,118, 22,127,167,121,205, 30, 67,125,231,205,108, 81,206, 24,195,102,179,233,247,223,127, 63,191,254,126,
-181, 90, 77, 0, 24,133, 47,141, 23, 91,195,135, 15,255,252,194,133, 11,109,142, 28, 57,178,249,232,209,163, 90, 0, 16, 8, 4,
-182, 63,254,248,227,250, 9, 19, 38, 96,194,132, 9,203, 78,157, 58,245,167, 9, 45,138,161,116, 0,192, 23,240,249, 79,159, 62,
- 37,188,189,189,155,140,184,175,163,233, 7,223, 63,123,214,245, 63,222,222,221,138,105,186, 45,119,216,176,138,133, 11, 23, 22,
- 41, 20, 10,164,167,167, 67,167,211, 97,218,180,105,172, 1, 3, 6, 72, 39, 76,152,176,173,188,188,252,109, 0, 58, 35,250,228,
- 70,103,103,231, 15,202,202,202, 42,106,172, 58,125, 66, 40,118, 63, 63, 3,191,115, 91, 61,143,203, 50,112, 71, 46,160,137, 43,
- 59,136, 74,111, 15,252, 10, 0, 92, 37,100, 45,124, 24,104, 16, 22, 46,240,160, 56, 88, 99,231, 34, 28, 36,203, 80,173,170,204,
-108, 82, 44,189, 45, 18,137,198, 84, 86, 86,158,170, 30,156,219, 5, 5, 5,225,238,221,187, 0,208,187, 90,104, 13, 34, 73,242,
- 93,154,166,247, 2,104, 42,149,219,188,209,163, 71,191, 25, 30, 30,110, 14, 0,167, 78,157,130, 94,175,135,167,167, 39,184, 92,
- 46,120, 60, 30, 56, 28, 78,109,118, 16, 35,225,100,103,103, 11, 91, 75, 14, 36,214,162, 97,139,119,142,102,187,117,176, 64, 33,
-245, 4,197, 76, 41, 12,140, 6, 92, 27, 17,218, 7, 90,193,127,232, 32,242,252,174,184, 37,231,191, 77,232,170, 36, 49, 18, 25,
-208,252, 93, 70,118,146, 36,249,177,177,177,144, 74,165, 47,252,159,197, 98, 1, 64,191, 87,160, 92,150,146,146, 18,240,240,225,
- 67, 12, 28, 56,112, 89,167, 78,157,222,186,121,243,166,163, 92, 46,199,192,129, 3,183,101,103,103,159,253,171,235, 84, 87,139,
-252, 83, 76, 93,100, 61, 37, 57,160,234, 41,152,100,177, 88, 36, 82, 83,210,245, 3, 7, 14,158,154,153,153, 41,238,209,163, 7,
-201,225,112, 80, 25, 21, 5,245,253,251, 16,139,197, 24, 59,118, 44,231,214,173, 91, 22, 22, 98,139,153,105,169,105,229, 44, 22,
- 9,134, 33,155,245,121,144, 72, 36,115,150, 44, 89,226,232,229,229, 5,131,193, 80, 27,209,220, 96, 48, 32, 43, 43, 11, 98,177,
- 24, 33, 33, 33,246,102,102,102,115,140,172, 71,235,118,158,246,209, 55, 34,119,191,177,240,195,225,162,118,102, 87, 33,202,154,
- 15,241,169,255,192, 39,247, 18, 66,199,244, 16, 93,249,118,153,127, 27,169,117,116, 29, 19,171,209,208,104, 52,191,198,197,197,
-205,188,121,243, 38, 13, 0,215,175, 95,103, 18, 18, 18,102,189,206, 83, 40, 77,211, 40, 45, 45, 5, 77,211,172,234,237,154,247,
-255,215,254, 96, 97, 97,177,235,173,183,222,122, 39, 35, 35, 67,120,241,226, 69,155,204,204, 76,219,180,180, 52,187,118,237,218,
-177,215,175, 95,127, 65,173,209,177,244, 20,163, 53, 80,250,242,188, 39, 79, 82, 74, 10, 10,162,247,239,223,175, 34, 8, 98,172,
-145,223,241,182,147,147,147, 77, 88, 88, 24, 8,142, 89,247,246, 62,157,188, 88, 28,161, 37,201,225, 89,170, 84,106, 42, 53, 53,
- 53, 43, 44, 44,204,189, 75,151, 46, 82, 84, 77,175, 25,197, 41,149, 74,109, 63,249,228, 19,176,249,230,126,157,187,248,183,225,
-241, 69,230, 44,142,208,188, 71,143, 30, 3, 82, 82, 82,114, 67, 67, 67,157,186,117,235,214, 34,206,110,221,186, 73,222,127,255,
-125,131, 64,104, 30,224,225,225,233,211,185,163,207,136,118,237,218,141, 97,179,217, 6,153, 76,150, 17, 18, 18,226, 52,114,228,
- 72,135,150,112,218,219,219, 75, 66, 67, 67, 13,174,173, 60, 3, 3,223, 28,218,147, 43, 52,183,100,243, 68, 86, 74,165,154,122,
-246,236, 89,198,210,165, 75,157,252,252,252,236,141,225, 84, 42,149, 28, 91, 91, 91,248,250,250,162,131,167, 39,202,202,202, 16,
- 30, 30,142, 3, 7, 14, 96,239,222,189, 56,118,236, 24,186,246, 25, 10,115,115,115,228,230,230, 66,161, 80,112,254,219, 29,138,
-250,206,155,217,174,253, 96,212, 71, 31,125,148,251,254,251,239,231, 11,133, 66,186,254,203,218,218,154,154, 60,121,114, 65,200,
-226,173,163,106,166, 22,155,177,100,197, 70, 70, 70, 38, 31, 57,114, 4, 29, 58,116, 64, 96, 96, 32, 15, 0,230,204,153,195,155,
- 48, 97, 2, 78,156, 56,129, 83,167, 78,197,123,121,121,221, 6, 48,218,152,114,134,132,132,244, 9, 14, 14,254, 37, 56, 56, 56,
-102,226,196,137,123,102,205,154,245,194,200,149,151,155,253, 64,171,213,162,139,127, 55,179,213,251,126,159,220, 28, 95, 2,112,
-100,207,211,167, 7, 54, 60,121,146,177,172, 67, 7,171, 86,105,105,214, 7, 55,110,180,173, 73,210,173,215,235,145,149,149, 5,
-137, 68,130,201,147, 39,219,242,249,252, 16, 35,138,185,101,244,232,209,211, 51, 51, 51,197,223,127,255,189, 83, 76, 76,140, 52,
- 47, 47,207,233,231,107,151,237, 62, 93, 52,199,220, 82,204,227,229,202, 24, 2, 0,210,114, 33,122,154,138, 62, 12, 3,171,186,
-211,137,175, 4, 39, 8,133, 46,216,222,166,143,213,243, 79, 78,248, 77, 12,141,240,183,149, 56,241,195,154, 56,163,243, 87, 95,
-125,117,242,252,249,243,147,250,244,233,115, 26,128,176,129, 99, 4, 93,187,118, 13, 63,113,226,196,244,190,125,251,254, 10,192,
-183,209,167, 72, 23,151,177, 63,253,244,147, 77,205,182,173,173, 45, 4, 2,193, 75, 34,139,203,229,130, 36,201, 22, 87,111,237,
-143,147,216,214, 62, 26,196,149, 68,226,196, 87,177,248,106,216, 51,122, 93,175, 52,205,142,144,167,184,114, 34, 22,133,136,197,
-240,255,180,193,164,165, 93,134,152, 81, 88,243,119, 26,192,101, 50,217,187,253,250,245, 59, 57,124,248,112,205,195,135, 15, 33,
-147,201,224,236, 92,251,172,157,255, 10,148,214,102,102,102,112,117,117,133,151,151,215,164, 91,183,110, 57,234,245,122,164,165,
-165,161,176,176, 48,250,191, 81,167,186, 90,228,127, 12,245, 29,225, 47,188, 36,180,170,115, 11,221, 0, 0,134, 32, 42, 99,227,
-226, 56, 44, 30,111,202, 15, 71,143,242,185, 92, 46, 50, 50, 50, 16, 31, 31, 15,229,207, 63, 67,117,231, 14, 10, 10, 10, 80, 81,
- 81, 1, 7, 7, 7,236,222,183, 79,164,165,152, 25,207,158, 63,103, 49, 36, 83,215,223,160,193, 37,158,124, 62,127,200,184,113,
-227, 26, 21,100,185,185,185, 24, 62,124, 56,135,197, 98, 53,180,170,161, 62, 39, 33,181, 35,206,255,124,122,181,147, 19, 47, 30,
- 72, 90, 8,148, 71, 3,140, 6, 48,104,129,156,199,192,133,149,104, 85,241,148,184,188,122,170,163,179, 25,251,124, 3, 74,185,
-185,165,168,158,222,222,222,123,167, 76,153, 66, 2,192,160, 65,131, 8,111,111,239, 61, 0, 60,155, 56,231, 90, 51,131,228,221,
-146,146, 18, 76,152, 48,193,166, 77,155, 54,215, 38, 76,152, 96, 83,243,255, 87,229,172,177, 38,119,232,208, 65, 46, 16, 8,142,
- 1, 70,221, 96,107, 57,173,172,172,118, 12, 31, 62,124,252,209,163, 71,185, 0,112,227,198, 13,156, 63,127, 30, 79,158, 60, 65,
- 98, 98, 34,237,239,239,111,183,117,239,201, 93, 59,190, 59,180,101, 76,239, 46,210, 1,221,253,125,196, 21, 37, 21, 14, 14, 14,
-189, 25,134,241, 52,178,156,195, 87,174, 92, 25,159,144,156, 97, 73,178, 57,108, 46,135,205,183,176, 16, 57, 54,112,168,183, 0,
- 0, 32, 0, 73, 68, 65, 84, 72,204, 69, 46,214,102, 2,103, 62, 73,136,149, 74,101,254,177, 99,199,104, 0,195,141,229, 92,189,
-122,117,106, 66, 82,134, 21, 65,178,217, 28, 54,135, 43, 22,155, 89, 13, 11, 28,216, 13, 0,184, 96,184, 10,133,162,224,192,129,
- 3,186,150,112, 46, 95,190, 60,174,184,180, 66,194,230,112, 56,108, 54,171,182, 45, 69, 66,161,157, 25,159,207,211,104, 52, 57,
-223,124,243,141,170, 37,156, 43, 87,174,140,127,150,156,105, 77, 18, 4,139, 32, 72,182,133,185,200,198,198,210,204,206, 78, 44,
-180, 53, 99,179,120, 10,133, 34,231,240,225,195, 70,113,234,116, 58,110, 65, 65, 1, 18, 18, 18,224,218,173, 27,174, 94,189, 10,
- 55, 55, 55, 76,152, 48, 1,239,188,243, 14,132, 66, 33, 6, 5,116, 66, 88, 88, 24,146,147,147,161,211,233,248, 13,113,214,248,
- 73,213,135, 84, 42,125,216, 92,231,169,119,238, 11,229,244,115, 4,179, 93,251,193,168,186, 2,171, 49,126,107,107,107,170, 33,
-107, 87,125,206,225,195,135,127,254,243,207, 63,183, 57,124,248,240,168,144,144,144, 95, 15, 31, 62,140,158, 61,123, 34, 33, 33,
- 1,238,238,238, 56,120,240, 32,222,121,231,157, 95,183,109,219, 54,234,225,195,135, 93, 60, 60, 60,150, 52,199, 57,113,226,196,
-217,126,126,126, 81,249,249,249, 1,197,197,197,190,225,225,225, 51,198,142, 29,155, 58,105,210,164,193,181,130, 81,175, 63,122,
-225,220,105,140, 24, 53, 14,237, 59,250,238,154,182,228, 72,167,102,174, 77,230, 9,176,231, 64, 94,158,236,168, 90,173,156,192,
-225,152,153,253,254,187,245,169,239,190,179,173,155, 89, 32, 39, 39, 7, 35, 71,142,228,112,185,220,190,205,148,243,171, 49, 99,
-198, 76, 8, 15, 15,151,212, 88,117,238,220,185,131,199,143, 31, 35, 61, 61, 29,165,165,165, 24, 60,171, 2, 31,173,175,226,254,
-104, 61,131,161,115, 24,209, 43,222, 67,106, 33,116,131,163,141, 5,251,246,140,111,218,207,249, 96, 87, 7,182,216,154,131, 31,
- 22, 39,162, 40, 77,115,170, 17, 78, 34, 32, 32,224, 72,112,112, 48,161,213,106,161,213,106,181, 0, 26,140,234,235,236,236, 44,
-232,220,185, 51,102,205,154, 69, 90, 88, 88,108,107,172,156,149,149,149,154,200,200, 72,132,132,132, 96,254,252,249,104,219,182,
- 45, 36, 18, 9, 56, 28, 14, 14, 29, 57,110,251,206,140, 15,219,189,209,167, 95,151, 14,111,244,236, 92,174, 97,117,227, 8, 37,
-239, 55, 98, 13,105,176,238, 21,246, 15, 17,151,246, 27,182,143,202,166,239, 29, 84, 86,124,250,238,215, 79,159,221, 44,120,178,
- 36,120, 79, 28,243, 91,175,162, 35, 31,103,162, 64,159,128,190, 19, 90,193,195, 79,178, 64,228, 10,239, 87,109, 79, 35,209, 34,
-206, 78,157, 58,245,185,119,239, 30,191, 95,191,126,200,200,200, 0,135, 83,251, 60, 69,189, 78, 57, 87,174, 92,201, 87,171,213,
-120,244,232, 17,166, 78,157,154,163,211,233, 22,188, 78, 57, 91, 98,209,170,209, 34,255, 99,216, 83,239,149,215,152, 69,107, 37,
- 0,232,105,156,159, 50,117,134, 50, 34, 34,194,140,199,227, 33, 35, 35, 3,121,121,121, 56,116,224, 0, 53,200,222,190, 60,208,
-217, 89,113,232,192, 1, 70,171,213,130, 97, 24,120,123,123, 99,252,248,241,194,183, 39, 76, 42, 36, 20,170,227, 70, 76,243, 56,
-213,204,175,207,152, 49,227,165,253,159,126,250, 41, 44, 44, 44, 64, 16,132,163, 17,149, 11,158,183,114,140,139,196,195,170,128,
-201, 63, 84, 12,150, 0, 96,155, 3,108, 11, 64, 96, 9,240,205, 1,158, 25, 52, 15,163,138, 73, 38, 48,125, 92,223,247,156, 1,
-180,100,170, 7, 82,169,116, 89, 84, 84,148,221,195,135, 15, 25,133, 66,129,188,188, 60,102,221,186,117,118, 82,169,116,217,171,
-254, 34,185,185,185,171, 71,140, 24, 81, 48,117,234, 84,203, 75,151, 46,185, 78,157, 58,213,114,196,136, 17, 5,185,185,185,171,
- 95,231,151,230,114,185,172, 39, 79,158, 88,175, 89,179,230, 29, 0, 15, 58,118,236, 40,119,118,118,126,128, 42,167,201, 38, 97,
-110,110, 94, 43,178,106,172,107,108, 54, 27, 28, 14, 7, 82,169, 84, 91, 92, 92, 76,245,125,195, 83,232,109, 73,234,165,124,174,
-208, 90, 40,112, 49,183,176,236, 33,151,203, 99, 9,130, 72, 49,114,138,207,175,123,247,238, 28,138,225,208, 31, 77, 25, 36,157,
- 51,125,160,253,206, 53,239,187,125,179,250, 3,231,175, 86,204,244, 94,253,217,228,129, 36, 77,171,221,221,221, 29,107, 28,218,
-141, 48,159,251,119,237,218,149, 77,131,131,132,231,233, 5, 25,217, 57,229,111, 14, 8,168,181, 92,118,240,243, 15,180,179,179,
-235,231,237,237,221,149, 32, 8,163,150, 36, 11,133, 66,191,246,237,219,179, 73, 22,135,176,145,152,187,154,139,133, 14,181, 83,
- 40, 86, 86,189,172,237,236,130, 73,134, 41,115,114,114,178, 23, 10,133,126, 45,168, 59,155, 6, 23, 14,246,214,150,118,182, 86,
-226,192,129,189,219, 6,244, 10,104,215,169, 71,207,128,142,111,116,125,155, 48, 24, 20,158,158,158,246, 53, 78,242,205, 88, 90,
- 5, 71,143, 30,197,154, 53,107,208,185, 85, 43, 56, 59, 59,195,222,222, 30,119,238,220,193,189,123,247, 32,145, 72, 80, 88, 88,
-136,141, 27, 55,226,204,153, 51,208,233,116,230, 45,237, 79,198,136,173,166, 96, 48, 24,200,250, 2,171, 49,126,161, 80, 72,215,
- 56,201, 55,134,200,200,200, 35, 53,150,172,143, 63,254,184,207,214,173, 91,127,125,250,244, 41,196, 98, 49,238,221,187,135, 25,
- 51,102,252,186,109,219,182, 62, 31,126,248, 33, 14, 28, 56,128,212,212,212,125, 77,241, 77,156, 56,113,197,204,153, 51,191,185,
-121,243, 38,233,224,224, 0,137, 68,130, 49, 99,198, 96,223,190,125,108,131,193,176, 63, 56, 56, 56, 38, 56, 56, 56,134,202,186,
-242,249,201,189,235,238,196,197,198, 96,246,188, 79,120, 90,131, 62,212,136,234, 51, 42,177,184,220,208,175, 95,241, 9,189, 94,
- 57,145,203, 53,179,140,137,177, 62,191,127,127,173,216, 10, 11, 11,131,165,165, 37, 80,229,192,140, 38,172, 58, 31,156, 57,115,
-166,246,126,104, 99, 99, 3, 30,143, 7, 46,151, 11, 14,135, 3, 22,139,133,107,187, 68,248, 46,172, 74, 95,124, 23, 70,224,202,
- 14,162,242,117,126, 59, 51,103,248, 74, 28,120, 49,255, 57,216,177,139,239, 96, 27,220,249, 49, 31,235, 70, 60,204,190,119, 66,
-182, 80, 93,136, 77,141,156,246,198,167,159,126,218,161,176,176, 16,247,239,223,199,253,251,247, 27,179, 0,169,207,157, 59,247,
-101, 69, 69, 5, 60, 60, 60, 48,122,244,232,126, 0,186, 53,114,221,160,107,215,174, 24, 57,114, 36, 6, 14, 28,136,206,157, 59,
- 67,171, 51,112,130,167,124,208,254, 73,170,204,121,221,198,117,102, 81,215,195,201, 95,127,189,201, 58,114,250,138,101,192,192,
-161,223,112,205,157,238, 66,104,227,100, 76, 61,149,148, 28,126, 78,195,176,231,231,121,228,246, 27, 83,197,135,206,111,247, 52,
- 55, 55, 39,162,239,199,232, 15,125,123, 34,211, 87, 52,186,240,238,143,114, 40,137,124, 12,158,238, 65,210,192,248,191,203,200,
- 46, 16, 8,182,222,188,121,211, 81,167,211, 33, 46, 46, 14,243,231,207, 87,191, 38,101,173, 1,196,213,213, 21, 55,110,220,192,
-228,201,147,213, 5, 5, 5,191,253,183,234, 84, 87,139,252, 83,192,174,163, 32,107,145,149,149, 85, 42,145, 72,156,219,183,111,
- 79,106,181,218,170, 41,137, 83,167,168,189,251,247, 95, 80,171,213,243, 0,112,119,236,220,185,203,217,197,101,224,148,144, 16,
- 66,175,215, 99,196,136, 17,188,136,136, 8,155,148,194,194,114, 35, 6,156, 23,190,111,218,180,105,216,186,117, 43, 0, 96,238,
-220,185,181,166,117,194, 8,135, 37,177, 37,134, 7, 6,117,181,200, 18,109,183,208,245,210, 87,180, 78, 54,191, 43,170, 16,118,
- 5,201, 99, 67,192, 2,173,211, 27, 18, 11,199, 62, 72, 78,244,233, 32, 44,150,187, 15,233,216, 31,123,175, 30, 30,174,164,212,
- 39,140,190,225,152,153,117, 23,139,197,120,240,224, 65,113,215,174, 93, 75, 25,134,177, 92,189,122,181,173,153,153, 89,247,215,
-104,251,180,231,207,159,247,235,221,187,247, 28,146, 36,135,208, 52,125,173,160,160, 96, 7,128, 52, 35,207,255, 8,192,114, 0,
-181, 79,150, 90,173, 22, 36, 73,130, 97, 24, 76,156, 56, 17, 97, 97, 97, 29, 30, 63,126,140,168,168, 40,235, 33, 67,134,220, 5,
- 80, 10,224, 61, 0, 13, 90,205, 20, 10,133,234,222,189,123,194,168,168, 40,208, 52, 13,107,107,107, 88, 88, 88,128,207,231, 99,
-204,152, 49,226,208,208,208,193,151, 47, 95, 46, 84,180,118, 99, 9,242,114, 42,249, 98,177, 57, 28,157,251,126, 56,233,221,167,
- 12,195,156,105,193,205,129, 39,100, 27,212, 4,165, 33,191,250, 98, 27,105,198,229, 18, 2, 46, 27,124, 90,137,207,191, 92, 75,
-112, 25,138,141, 22,206,207,115,185, 92,174, 57, 31, 90, 22,143,165, 55, 35,192,252, 25, 23, 7,139,197,226, 9,184,141,251, 99,
-112, 72,146, 36, 73,146, 11,192,232,164,125,124, 62,159,107,206,103, 26,229, 20,178, 8, 22, 65, 16, 60, 52,178, 18,205,207, 17,
- 76,141, 21,137, 55, 47, 69, 83, 87, 20,247,237,219, 23, 23,162, 30,224,212,249,107, 40,202,136,197,210,197, 31,163, 91,183,110,
-136,136,136,104,178, 76, 53, 62, 90,141, 89,151,165, 82,233,195,220,220,220, 55, 26, 59,183,169, 41,195, 70,172, 84, 47,243,127,
- 97, 9,255,149, 79,209,140,143,214,232,190,125,251,206, 62,122,244,168,246,173,183,222,226, 77,156, 56, 17,190,190,190,125,166,
- 79,159, 14, 0, 24, 50,100, 8,182,110,221,218,103,250,244,233, 56,126,252, 56,194,195,195, 53, 3, 6, 12, 88,124,227,198,141,
- 28, 84,173,232,124, 9, 52, 77,143,220,189,123,119,125, 75, 33, 12, 6, 3,244,122,189,147,193, 96,112,170,190, 23,225,155,111,
-182, 21, 93,185, 28,129,197, 75, 86,194,222,206,209,207,200, 62, 68, 76,251,228,147,162,131, 27, 55, 98,227,241,227,248,196,221,
-221,236,112,124, 60,174,168,213, 56, 17, 21, 85, 84,253, 61,205,250,102, 86, 86, 86,170, 34, 35, 35, 45, 78,156, 56, 1, 43, 43,
- 43,180,109,219, 22,214,214,214,224,112, 56, 32, 89, 66,176,184, 18,180,239,216, 29,192, 61, 0,128,187, 20,149,222, 30,248,149,
- 32, 80,202,144, 45,247, 41,226,187,161,181,173,139,224,230,236, 3,190, 86, 22,246, 92, 92,218,145,137,203,219,179,206,168,139,
-176, 25, 6, 60, 67,227, 62, 95, 93, 61, 60, 60, 80, 88, 88,136,200,200,200, 74,160, 81, 65, 6,154,166,191,220,185,115,231,167,
- 75,150, 44,225,123,123,123, 3,128, 31,128,251, 13, 29, 43, 18,137,224,236,236, 92, 43, 44, 39, 78,253,208,115,214,194, 15,133,
- 99,135, 14, 4,155,109,139,210, 74, 61,228,229,122, 72,108,197, 88,188, 48, 88,112,173,171,115,183,221,219,126, 56,167, 82,161,
- 27,240,242,253,128, 32,112,255,247,216, 95, 59, 9,188, 1,130, 4,178,200,235, 32, 64,160,130,208,131, 96,177, 24,138,162,144,
-153,153, 9,134, 97, 48,121,236,140,172, 15,214,133,219,247,153,172,128,107,123, 41, 8, 6,253,255, 46, 66,192,198,198,198, 79,
- 46,151, 35, 45, 45, 13, 83,167, 78,205, 41, 42, 42,186, 90, 89, 89, 57, 35, 55, 55, 23, 0,138, 95,129,178, 86,204,251,249,249,
-161,123,247,238,152, 48, 97,130, 64,169, 84, 6,123,122,122, 58,203,100,178, 94,127,101,125,234,107,145,127,148,208,106,240, 66,
-211,235,219,107,118,237, 66,229,181,107,224, 93,185,130, 19, 82,105,133, 90,173, 94, 4, 32,171,250,194,255,248,192,193,131,183,
- 71,253,246,155,133,246,233, 83,120, 62,126, 12,142,149,149, 95, 75, 11,176,127,255,126, 40, 20, 10,148,149,149, 1, 0,182,111,
-223, 14,133, 66, 1,131,145, 9,103,217, 92,244,113,180,119, 71, 62, 18, 65,179, 73,113,122,123,101, 79,177,218, 60,215, 57,211,
-161,178,140,116,198,211,140, 30, 34,149, 92,219,147, 96,105,161, 46, 82,194,185,119, 91,176,193,238,211,146, 50,214,204,251,179,
-217,236,226,231,207,159,143,108,215,174,221,121, 0,182,175,226, 15, 80, 15, 73, 5, 5, 5,243, 94,229, 68, 22,139,181, 60, 53,
- 53,213,126,223,190,125,115, 86,175, 94,205,212, 21, 90, 53,159,217,108, 54, 24,134,129,165,165, 37, 56, 28,142,195,157, 59,119,
- 28,122,244,232,241, 45, 77,211,126,141,212,147,241,245,245, 69,106,106, 42,216,108, 54, 44, 45, 45, 65, 27,116, 88,185,240, 67,
- 80, 44, 62,251,179,207, 62,243, 27, 55,110, 92,220,190,125,251,244, 22, 1,189,123,201,229,242, 39,179, 39, 79,137, 59,123,246,
-172,182, 58,196, 67,243,143,248, 12, 19,147,152,152,200,114,145, 58,176, 24,131,146, 22,113, 1, 65,236, 55, 12, 79,236, 8, 1,
-155,197,112, 9, 18,124,129,208, 50, 45, 59, 91, 78,211,116,130, 49,156, 52, 77, 71,167,166,166, 10, 29,236,109,216, 74,149,182,
- 66,200, 97,120,233,209, 15, 82, 90,251,119,245, 4, 0,117,244,189, 27,252,246, 62,194,244, 2,153,200,221,221,221, 40, 78,149,
- 74, 21,147,147,147,195,114,112,112, 96,103,100,101,159,179, 18,139,236, 44,172,172,122, 2,128,174,188,236, 30,169,209,200, 88,
- 28,182,131, 76, 46, 47, 86,169, 84,169,198,214, 61, 57, 57,153,237,228,100,207,186,116,229,231,243, 14,102,124,123,115, 30,219,
-130, 79, 16,132, 25,139, 80,112, 13,116,145,192,204,204, 62, 45, 59,187,152, 97,152, 70, 45,132, 27, 74,167,140,173,250,189, 86,
- 30,175,195,141,216,216, 88, 92,252, 53, 1, 34, 70, 11, 66, 93,134, 43, 7,190,199,228,207,150,188,182,223, 95,115, 98,235,149,
-172, 89,187,125, 30,214,227, 71, 94, 51,142,240,147, 39, 79, 94,121,228,200,145, 90, 7,148,132,132, 4, 12, 26, 52,168,102,154,
- 3,129,129,129,232,209,163, 7, 18, 18, 18,224,229,229,133,168,168, 40, 62,139,197,226, 79,153, 50,101,221, 15, 63,252, 16,217,
-172,221,127,207, 30,204,152, 49,163, 33,199,234,100, 0,106, 66,226, 93, 17,182,225,144,109,177,188, 8,133,178,252, 24, 99,219,
-129, 32, 8, 76,251,228,147,162,221, 90, 45,142,254,254, 59, 66, 68, 34,179,131, 73, 73, 24,209,163, 7, 58, 13, 26, 84,100,204,
-189,174,198,170,163, 86,171,193,225,112, 96, 97, 97, 1, 27, 27, 27,112,185, 92,176, 56, 82,176,121, 93, 64,114,185,240,239,219,
- 5, 27, 23,137,148, 83,135, 97, 27, 65,160,148,207, 67, 52,215,172, 81, 95, 29, 66,228,134, 49, 12, 3,133, 50, 11,215,107, 4,
-137,101, 43, 88,114,204, 57, 87,102,126,235,109,101, 97,207,197,197,109, 25,184,242,109,246,105,117, 62,150, 86,183, 5,221,196,
-131, 68, 39, 43, 43, 43,100,101,101, 33, 51, 51, 51, 30, 77, 59,248, 43, 19, 18, 18, 82,248,124,126, 7, 59, 59, 59, 0,240,104,
-236,193,156,166,233, 90, 63,172,195, 71, 79,218,250,245,243, 20,188,217,167, 3, 14,157, 95,139,255, 4,111, 3,135, 69,128,162,
-116,216,188, 53, 8,148,166, 2,193,163, 62, 32,250, 15,241,234,114,237,188,118,166, 94, 85,242,253, 75, 15, 2,108,172,249,250,
-157, 59, 86,124, 49,217, 9, 52, 97,101,107,107, 47,226,114,185,176,177,112,210, 46,153,181, 32,143, 97,152,218,235,134,195,226,
-234,201,114,107,149, 60,191, 66,104,197, 81, 1, 12,217,250,213,162,217,252,249,200,206,206,158,215,175, 95,191,117,229,229,229,
- 37,149,149,149,147, 1,192,195,195,163, 21, 73,146,124, 0, 77,205,142,180, 66,195, 97, 33,184,143, 31, 63,134,185,185, 57,114,
-114,114,234, 26, 95, 64,211,244,223,102, 17,192,223, 20,254, 0,162, 1, 56, 1, 24,129, 58,225, 29,200,106, 83, 93,255,136,136,
- 8, 38, 34, 34,162,127,237,224,197, 48,180,161,184, 24,140,166,170,109, 57, 28, 14, 3,160,238,138, 38, 51, 43, 43, 43,130,227,
-226, 2,130, 95,229,250,193,252,137, 75, 95,245,122,227, 66,203,208, 20, 88, 32,116, 96,234, 60,180, 84, 10, 8,172,181, 29,140,
-121,188,101,200,231, 89,213, 29,233, 0, 3, 3, 10, 52,171,133,197, 97, 42, 43, 43, 97, 48, 24, 36,109,218,180,185, 96, 48, 24,
- 36,213,131, 27,243,255,245,139, 82, 20,149,194, 98,177, 48,103,206, 28,212, 88,127,180, 90, 45,242,243,243,161,209,104,160,213,
-106,145,154,154,138,178,178, 50,104,181, 90, 60,121,242, 4, 30, 30, 30, 96,177, 88, 78, 77,220,204, 25,134, 97,224,234,234,138,
-214,173, 91,131, 69, 48,216,251,213, 10,124, 62,255, 67,188,227, 65, 99,255,142,205, 24, 48, 96,128,143,187,187,123, 0,155,205,
-166, 28, 29, 29,185,225,225,225,231, 40,138, 26, 3,227,239, 60,145, 97, 97, 97,173, 59,118,236,104,111,101, 97,174,231,243, 88,
-224,233, 43, 25,190, 70,206,176,149, 69,112,117,109,101,128,208,204, 43, 36, 36,132,106,204, 10,209, 16,231,162, 69,139,156,188,
-189,189, 45, 37, 86,230,149, 60, 14,171,144, 11,166,168, 44,246,254, 93, 0,224,217,217,171, 33, 48,235, 48,117,234, 84, 67, 75,
- 56,151, 45, 91,230, 97,103,103,103, 69,130, 41,167,116,186, 63,230,219, 53, 90, 57,193,225,168,192,229,117,157, 59,119, 46,209,
- 18,206, 79, 63,253,212,189, 67,135, 14, 86, 86, 22,162, 10, 54,135,149,199,165,233, 60, 1,232,124,142, 86, 87, 34,176,179, 85,
-194, 76,236, 31, 18, 18,210, 40,103,141, 53, 43, 52, 52, 52,171,158,240, 70,113,113, 49,212,249,113,224,230, 60, 69, 23, 49, 7,
-221,236, 36,224,243,249,181, 75,223, 27,235,174,141,249,104, 53, 36,182,140, 61,183,235,170, 38,166, 0,119,251, 60,172, 31, 55,
- 43, 55, 55, 23, 78, 78, 78, 77, 94, 79, 63,252,240,195,146,129, 3, 7, 22, 6, 6, 6,106, 47, 92,184, 0,130, 32, 16, 21, 21,
-133,156,156, 28, 4, 6, 6,130, 97,152,154, 85,109,136,137,137,193,144, 33, 67,254,143,189,235,142,111,170,122,223,207,189,217,
- 77,154,116,143,116,208, 66,161,165,180,133, 2, 66,217, 67, 80, 16, 80,148,249, 69,144,189, 5, 1, 21, 17, 80,145, 13,162, 40,
-178, 5, 4, 28,200, 20, 40, 2, 50, 75, 89, 5,202, 42,165,180,172,210,221,210, 38, 77,154, 52,251,222,251,251,163, 73, 12,165,
- 35, 41,160,226, 47,207,231,115, 63,201, 29,121,114,238,185,247,156,243,156,247,156,243,190,250, 78,157, 58,229,154,253,107,213,
-138, 81,163, 70,193,104, 52, 66,165, 82, 65, 38,147, 33, 62, 62, 30,177,177,177,140, 80, 40,236,199, 10,126,125,209,192, 49,179,
-219,197, 52,107,142, 53,171, 86,232,121,108,206, 82, 71,202, 43, 65, 16, 24,254,225,135,197,138, 22, 45,100,219,213,234,242, 17,
- 18,137,176, 97,118,182,231,149,163, 71,189, 13, 6,131, 93, 28, 22,171, 78, 80, 80,144, 85,100,113,185, 92,176,121, 62, 96,137,
-154,130,231,213, 3, 66,255,126, 56,117,149,175,115, 19, 97,159,216, 21, 71, 68,238,213,187,118, 16, 6, 99, 81,187,193,210,189,
-237,255, 39, 61, 33,172,135,205,230,246,128,100,216,196,222,145,223, 68, 52,244, 9,117,193,133, 93, 5,248,115, 77,206,239,218,
- 2,204, 3,112,183,182,114,110, 48, 24,180, 20, 69,129, 36, 73,176,217,108,219, 57,129,231,126,255,253,119, 92,185,114, 5,176,
-113,219, 83, 86, 86, 70,177, 88, 44, 8, 4, 2, 0,112,173,161,190, 3,135,195, 1,135,195,193,233,139,103,188,254,215,191, 15,
-113,254,250, 49,180,143, 29,130, 18,149, 1,133, 10, 3, 74,203,129,232, 86,115, 17,211,125, 31,110, 60, 40, 67,243,102, 49, 44,
- 22, 79, 52,188, 42, 62,237, 67,100,171,179, 48,160, 36,149,110,164,207,113, 57,124, 97,255,237,212, 51,187,111,220,218,177,246,
-224,221,118,173, 58,169,205,198, 4,168, 84, 42,134, 32, 8,102,250,216,217,247,183,143,146, 83,171,134,222,160,217, 58,193,189,
-191,177,170, 15,241,241,241, 57,239,229,229,117,210, 44,142, 66,196, 98,241, 57,169, 84,154,134,138,133, 30,251,243,243,243, 35,
-213,106,117,123, 84, 44,206,122, 84, 82, 82,242,170,217,242,244,168, 6, 75,216,102,165, 82, 57,141,162,168,183,204,219, 27, 20,
- 69, 53,207,200,200,136,106,222,188,121,106, 88, 88,216,181,176,176,176,195, 97, 97, 97, 7,194,194,194, 14,116,237,218,245, 91,
-139,187,135, 23, 60,108,248,148, 22,121,201,132, 22,204, 34,107,163,249, 19, 86,161, 5,224,116,229, 9,104, 38, 62,255,150,105,
-242,100,184, 31, 56, 0, 78, 70, 6, 70, 14, 31, 46, 17, 10,133,171, 80,225,163,169,189,171,171,235,154,121,243,230,137,189,151,
- 44, 65,192,153, 51,200,140,143,135,145,195,185, 92,151,212,105, 52, 26,176,217,108,171, 37, 70, 36, 18,129,162, 40, 84,101,242,
-125,170, 0,154,112, 33,183, 48, 13, 60,132,130, 6,163, 58,162,236,148, 52,228,254, 92,223,120,101,131,240,187,106,110,248,124,
-159, 54,190,171, 66, 58, 36,169, 9,182,138,231, 46, 64, 86, 86, 54, 40,208, 14,141, 55,107,181, 90,133, 90,173, 70,243,230,205,
-189,174, 92,185,210, 48, 54, 54,214,211,124,252,210, 51, 62,152,182, 1, 1, 1,187, 2, 3, 3, 31, 6, 4, 4,236, 2,208,214,
-129,223,110, 78, 76, 76, 4,139,197,194,188,121,243, 80, 86, 86, 6,131,193,128,146,146, 18,100,101,101, 65,175,215, 35, 39, 39,
- 7,119,238,220,129, 94,175, 71,102,102, 38,116,186,218, 59, 36, 52, 77, 67, 34,145, 64,171, 81, 97,221,162, 57,248,108,214, 12,
- 40,238, 37, 35, 39,175, 16,238,110, 34, 76,157, 58,149,229,225,225, 65,211, 52, 29, 74, 81, 84,119,154,166,215,219,243,156,108,
-222,183,179,193,193,193, 49,203,151, 47,143,154,179,104, 61, 87,194, 86, 49,124,177,128,230,137,249, 12,175, 73, 27,140,154,187,
-138,251,221,202,175,211, 47, 92,184,144, 11,251,156,119,146, 0,206,182,104,209, 34, 34, 55, 55, 55, 54, 50, 50,178,177,119, 72,
-125, 62, 95, 26, 88,202,149,214, 83, 50, 58,109, 18, 17, 88,175,227,250,245,235, 83,206,157, 59,151,231, 8,167, 72, 36,106,178,
-109,219,182, 24, 63, 63,191, 24,142,139,139,160, 92,161,216,105, 42, 87,239, 98,185,123, 8, 72,137,251, 27,251,246,237, 75,222,
-179,103, 79,129, 35,156,225,225,225,145,139, 22, 45,138,110,218,180,105,180,127,131,134,124,151,192,224, 18, 65, 80, 72,137, 75,
-211, 88, 62,130, 66,123,174, 89,179,230,218,133, 11, 23,236,226,100,177, 88, 38,146, 36,193,225,112, 32, 20, 10,113,228,200, 17,
- 76, 30, 51, 4,193,129, 94,104, 28, 25,137,110,147,166, 97,207,158, 61,214, 57, 60, 44, 22,171,218, 22,125,235,146,169, 7, 91,
- 72,137,100,108,104,146,140, 13, 77,146, 91, 72,137,228,106,197,150,249,124, 85,215,216, 85, 27, 85, 51,220,104,135,216,250,227,
-244,233,211,203, 70,140, 24,193,235,213,171, 23,146,146,146, 48,106,212,168,179,123,247,238, 5, 0, 36, 37, 37, 97,250,244,233,
-103, 79,156, 56,129, 9, 19, 38,224,213, 87, 95,229, 37, 38, 38,174,129, 29,190,127, 76, 38, 19,182,108,217, 2,147,201, 4, 87,
- 87, 87,120,122,122,162, 79,159, 62, 72, 73, 73,153,240,227,143, 63,166,177, 56,156,119,123,191,213, 31,135, 14,236,197,157, 91,
- 41, 19,182, 46, 30,230,176, 83, 96,146, 36,209,107,248,240,226,226,232,104,217, 86,165,178,124,180,135,135, 48,178,160,192,243,
-212,174, 93,222,118, 8, 53,130,162, 40,171,184,178,136, 14,203,198,230,249,128, 45,138, 1, 91,220, 10, 55,238,114,141,220, 56,
- 92,229,181,194,237,154,252,103,113,120,228,168,126,115, 26,160,223,156, 6,232, 59,179,254, 72, 97, 61,108, 18,213,195,196, 94,
- 31,132,118, 13,107,229, 6,101,145, 1,241,223,100, 62,210,150, 96, 9,128, 59,246,148,115,154,166, 83,115,115,115,193,227,241,
- 80,175, 94,189, 8, 0,150,121,129,155,199,142, 29, 59,101,254,252,249, 51, 0,204, 55, 31,115,237,218,181,107,180, 74,165, 66,
- 70, 70, 6, 0, 92,169,193, 26,108, 93,101, 40, 83,102,242,235, 7, 52, 69,108,147,241,240,240,104,134, 92,153, 30,121, 50, 61,
- 54,173,123, 27,201,137, 11,113,229,207,247,240,168,160, 0, 46,254,239,128, 50,233, 98,236,232,212, 7, 92,191,126,157, 72, 76,
- 76, 36,104,154,134,209,104,100,202,148, 74,230,234,217,179,208, 36, 36, 16, 18,137,132,232,208,186,147,106,235,194, 67,151,246,
-173, 62,123,197, 80,238,112, 71,253, 89,240,217,253,251,247,219,238,218,181,171, 43,128,207,154, 54,109,122, 33, 43, 43,171,221,
-153, 51,103, 26, 7, 5, 5,173,170, 43,169,197, 45, 68,102,102,230, 19,155,217, 45,132,222, 44, 26,122,153,197, 92, 95, 0,211,
-241, 12,171,236, 29,192,233,151,120, 50,252, 33, 84, 90,109, 88, 89,104,217, 58, 10, 67,152,135,135,216,104, 52,228, 28, 59,118,
-204, 64,146, 36,132, 66, 33, 70,140, 26, 69,174, 91,187,182,227,144,182,109, 79,142,123,237,181,195, 39, 79,156,104, 17, 23, 23,
- 7,134, 97, 64,146, 36,126,251,237, 55,141, 86,171, 41, 9, 14, 14,118,183,167,210,176, 45, 64, 74,165,210, 42,180, 20, 10, 5,
-252,252,252,236, 30, 58, 84, 43,113,252,196,145,100, 57, 67, 77,202,234,117,119,165, 97,105,193,219,113,165, 52,197, 86, 80, 70,
- 40, 52, 12,202,180, 96, 39,145,158,113, 35,194,223, 49, 60,232, 30,119, 39, 33,237,124,137,150,210, 58,180, 90,162,168,168,104,
-206,192,129, 3, 75,164, 82, 41, 33,145, 72, 16, 24, 24, 72,246,237,219,183, 56, 59, 59,123,126, 93,159,136,151,151,215,255,186,
-118,237,122, 48, 55, 55,119, 64, 66, 66, 66,232,153, 51,103, 6,116,237,218,245,160,151,151,215,255,236,164,216, 57,123,246,108,
- 53,143,199, 67,155, 54,109, 80, 86, 86, 6,243, 42,159, 26, 55,123,134, 72,185, 92, 46, 54, 44,255, 2,159,205,154, 1, 89, 90,
- 18,110,156, 61,134,211, 5, 4,230, 46,250, 26, 92, 46,183, 78,190,190, 26,249, 8,155, 54, 13, 16,223,158, 62,106,112,222,167,
-179,102,137,175, 93,187,198,153,242,193,116, 38, 51, 95, 6, 94,175, 21, 44,116,158, 67, 94, 87,251,160,247, 27,221, 48,239,179,
-143,154,154,157,118,214,136, 38, 62,194,166, 49, 1,226,212,143,198, 13,185,255,193, 7, 31,184, 44, 93,186, 84,219,182,109, 91,
- 77, 97, 97,161,139,200,195, 51,146,237,230, 30,147,153, 95,224,218,182,109,219, 7,147, 38, 77, 42,117,148,115,238,220,185,194,
-163, 71,143,178, 7, 14, 28,104,146,203,229,174, 28, 23,151,230, 4, 95,208,250,177, 92,238, 54, 96,224,192,187, 3, 6, 12, 40,
- 55, 59, 44,181,155,243,243,207, 63, 23,222,185,115,135,221,182,109, 91, 99, 65, 65,129, 88,228,229, 29,203,114,247,108,245, 48,
-191, 80,210, 58, 46,238,222,148, 41, 83,212, 53,165,211, 86,164,136,197,226,220,246,237,219,227,155,111,190,193,119,223,125,135,
-158, 61,123, 34,229, 86, 10,122, 79,153,129,168,137,211,113,224,252, 69,228,230,230, 98,193,130, 5,136,141,141, 5,151,203,189,
- 83,101,121,156,144, 70, 92, 43, 0,113,173, 0, 4, 49, 33,141,176,236, 87,107,217,154,175,128,237,245, 85, 93,119,229,243,170,
- 45, 93, 45,164, 68,114, 77,243,176,106, 19, 91, 3, 6, 12,152,108,113,225, 48,122,244,232,179,171, 86,173,234, 48,122,116, 69,
- 71,187, 77,155, 54, 88,184,112, 97,135,185,115,231,158, 93,180,104, 17,186,117,235,134,176,176,176, 90, 23,190, 80, 20, 5,147,
-201,132, 33, 67,134,192,100, 50,225,241,227,199, 72, 79, 79,199,198,141, 27,193, 48,140, 0, 0,164, 1, 65,175,240,120, 60, 92,
-191,122,185,252,179,209,113, 63, 59, 96,201, 34,108, 59, 49, 42,149, 10, 3, 38, 78, 44,206,105,212, 72,182,190,184,184,124,140,
-135,135,176,254,163, 71,158, 98,189, 62, 16, 53,204, 75, 36, 8, 2, 52, 77, 91,133,149, 69,112, 85,222,204, 13,165, 93, 48,148,
-211,127,156,249, 41, 15, 0,208,105, 88, 0,250,206,172, 63, 82, 26, 46,252,190,227,208, 10,163,247,158,133,247,153,178, 60,106,
- 41,140, 72,117,192, 98,157,148,148,148, 4,119,119,119, 12, 28, 56,144, 79,146,228, 18, 75,127, 21, 21,190,179, 86, 90,184,248,
-124,254,138,247,222,123,143, 44, 45, 45,197,141, 27, 55, 0,224, 68,117,245, 18,195, 48,214,123, 87,201, 8, 80, 52, 15,231,174,
- 30,193,159,103,118,227, 97,238, 99, 60, 42,210, 2,108, 55,104,213, 57, 48,104,114,161, 47,189, 10,165, 78,104, 87,130,185, 92,
-238,227,166, 77,155, 50,173, 90,181, 98, 24,134,193,189,123,247, 76,153,143, 30,153, 46,127,251, 45,115,115,252,120, 66,156,158,
-206,117,113,113, 33, 26, 52,104, 0,129, 64, 64, 11, 4,130,146,191,177,241,126, 33,238, 22, 94,128, 91,136,231,105,213, 98,240,
-114, 34, 31, 79,174, 54,180, 58, 48,173,202, 97, 41, 24,137,203,224,221,107,214,185, 13, 28, 50, 76, 29, 27, 27,235, 17, 24, 24,
- 8,130, 32,240,246, 59,239, 16, 93, 19, 18,196,156,128, 0,120,181,108,105, 29,142, 56,126,236, 24,142, 28, 57,162, 62,244,251,
-190,192, 81, 99,198,188, 9, 96, 91, 13,137, 97,243,249,124,235,255,230,231,231,131,207,231, 91,231, 68, 40,149, 74,248,248,248,
- 32, 63, 63, 31,118,142,204,109,255,116,214,197, 89, 69,113,115, 26,196,137, 57,196, 97,117, 1, 40,134, 1,135,160, 0, 13, 3,
- 35, 5,232,140, 12, 94,169,207,242,252, 83, 99,242,136, 79,218,251, 0,192,118, 71,114, 79,167,211,157,186,118,237,218,120,154,
-166,119, 3, 32, 19, 18, 18,232,212,212,212,201,176,127,226,250,211,102,123,161,112,230,201,147, 39, 61,103,206,156, 41,143,143,
-143, 87,244,233,211,199,109,227,198,141,158,175,190,250,234,204,146,146,146, 29,246, 24, 2,179,178,178,182,101,103,103, 79,110,
-213,170, 21,100, 50, 25, 12, 6, 3,146,147,147, 17, 30, 30,142, 43, 87,174, 32, 34, 34, 2,151, 47, 95, 70,227,198,141, 65, 81,
- 20,180, 90, 45,104,154,166,106,171,204,101,197,143,129,146, 44,228, 37, 29, 70,250,205,100,156,204, 35,176,122,199, 65,212, 11,
-109, 80, 39, 63, 53, 17,190,194,104,169,143,215,159, 75,191,252,220, 55,243,212,111,216,187,101, 53,125,250,240,225, 40,158, 24,
-227, 59, 15,153,214, 95,111, 68, 8, 0, 94,187,184, 86,232,229,113,135, 18,134,162,224,100,106,205, 14, 22, 35,124,133,209,126,
-222, 94, 71,191, 90, 50, 95,124,239,200, 86,236,220,240, 13,179,231,167, 95, 99,181, 64, 92,116,116,116, 47,146, 36,221, 1,104,
-205,243,188,236, 10,109, 83, 21,231,241,131, 7, 91,104,129,184,253,251,247,247, 18, 10,133,254, 0,140,229,229,229,247,159,133,
-243, 68,124,124, 11, 75, 58, 9,130,240, 5, 96, 96, 24,230, 30, 28, 12,193, 51,104,208,160,133,211,167, 79,159, 69, 81,148,143,
- 77,239,156,181, 98,197, 10, 54, 77,211, 44,134, 97, 12, 36, 73, 26,142, 30, 61, 74,153, 76,166, 60,173, 86, 59,241, 89,106,145,
-254,253,251,227,226,197,139, 95,162, 98, 17,134,189,214,234, 39,230,105,153, 67,246,212,153, 63, 33, 33, 97,193,187,239,190,251,
-233,142, 29, 59,210, 87,173, 90,245,214,132, 9, 19,240,219,111,191,161, 81,163, 70,184,126,253, 58,230,204,153, 3, 0, 29,230,
-206,157,123, 96,243,230,205, 97,153,153,153, 43,236,176,104,192,100, 50,225,215, 95,127,197,219,111,191, 13, 31, 31, 31, 4, 4,
- 4,128, 32,136, 83, 99,198,140, 89, 11, 0, 44,130,197, 5, 0,157, 86,167,139,140,108,101,183, 5,151,203,229, 90,235,186,130,
-130, 2,235, 74,193,215,223,125,183,120,211,210,165,248, 89,163,193, 24, 15, 15, 97, 78, 80,144,244,192,189,123,227,110, 85, 84,
-206, 76, 77, 86,157,218, 68,150,189, 83, 26, 52,249,152,253,251,226,135,254, 0,122,118, 26, 22,128, 78,195, 2,208,170,175, 47,
- 65,178, 8,220,252,179, 4, 41,199,101,123,140, 74,156,130, 99,225,114, 82,151, 44, 89,114,160,115,231,206,111, 53,105,210, 4,
- 99,199,142,157,180,101,203, 22,174,209,104,252, 0,127,185,121,112, 35, 73,114,254,134, 13, 27,198,121,122,122, 34, 49, 49, 17,
-103,206,156, 57, 5, 32,171,186,122, 9,128,213,103, 86,189,224, 8,237,157, 76,149,176, 40,247, 28,206, 38,254,142, 70,177,211,
-224,226,255, 38, 60, 35, 23,193,144,246, 29,244, 37,127,194, 51,184, 15,114, 50,239,129,197,230,167,212, 54, 9,133, 97,152, 91,
- 57, 57, 57, 97, 97, 97, 97,196,195,135, 15, 77, 0, 24,138,162, 24, 67,199,142,198,168,165, 75, 57, 41,147, 38, 17,237,238,220,
- 97, 49, 4, 65, 39, 39, 39, 3,192,237,127,162, 21,183,184, 91, 72, 73, 73,169,206,221,130, 67,104,218,180,105,135, 51,103,206,
-240,181, 90, 45, 78,159, 62,141,214,173,173,107,187,254, 81,239,247,182, 90,228, 37,195,184, 42,142,109,124,194,162,245,196,139,
- 77, 19,156,198, 17, 17, 20,151,196,143,111,191,249,102,249,181,107,215,172,189, 62,237,165, 75, 80, 31, 57, 2,138,162,192, 48,
- 12,206, 36, 36,224,189, 97,195, 84, 28, 22,177,169,126,253, 80,134, 96,158,240,221,210,189,138,222,195,192,129, 3, 7, 90, 43,
-159,236,236,108,136, 68, 34,240,120, 60,208, 52, 13,147,201, 4, 22,139, 5, 55, 55, 55,152, 76,166,170, 76, 48,149, 57,141,148,
- 76, 61, 96,115,239,161,249, 1, 42, 3, 51,222,189, 62, 66,184, 46,214,194,233, 47, 33,240, 86, 44, 7,222,236, 34,230,196,138,
-215,242,104, 93,201, 0, 60,189,162,171,182, 37,255, 17,205,154, 53, 91,251,222,123,239,145, 0,208,189,123,119,178, 89,179,102,
-223,163,230, 80, 57, 53,114, 10, 4, 2, 62, 0, 28, 60,120, 80,150,158,158,222,243,224,193,131, 50,219,227,118,114,110, 92,190,
-124, 57,132, 66, 33, 76, 38, 19,244,122,189,117,126,150,237,167,193, 96,128,183,183, 55, 14, 29, 58, 4,138,162, 14,213,150,206,
-224,144, 80, 16, 62, 13,177,237,224, 73,156, 41,230,214, 69,100, 89, 57, 27,250,139, 26,251,123,123, 29,251,106,241, 2, 31,249,
-221,100,228,228,228, 48, 71,143, 28,186,160, 5,114, 21,101,248,172, 84,141,198, 26, 61, 4,173,195,144,117,108,195, 39,204,220,
- 78, 48,162,234, 85,131, 86,206, 40,127, 81,227, 64, 31,175,163, 95,127,181, 88, 92,122, 55, 25,249, 5, 5,248,227,208,193,107,
- 90,192, 50,220, 56,146,166,233, 24,154,166, 99, 0,140,172, 65,188, 56,196, 89, 94, 94,222,180,188,188,188,233,243,228,100, 24,
-166, 41,195, 48,118,115,218,206,137, 90,185,114,101, 90,126,126,254,123, 69, 69, 69, 61, 44,155, 92, 46,239,174, 82,169,186,148,
-151,151,119,212,172, 12,117, 43, 47, 47,247, 85,169, 84, 82,173, 86,251, 10,128,100, 7,222,121, 43,108,189, 78,231,231,231,207,
-203,207,207, 39,106, 75, 39,107, 98, 26,241,203,215, 31,253,190, 97,195, 6,233, 51,242, 63,145,206,226,226,226,221, 59,118,236,
-104,222,160, 65,131,176,145, 35, 71, 98,253,250,245, 88,181,106,149, 14, 0, 54,111,222,172,179,177,100, 5,103,102,102,182,170,
-102,216,176,187,141,181,100,251,235,175,191,206,156, 57,115, 6,111,191,253,182,213,145,232, 15, 63,252, 0,147,201,164,236,214,
-173, 27, 13, 0, 26,109,185,146,161, 25,232, 13,213,142,191, 63,149,159, 60, 30,239, 13, 91,127,129, 22,103,204, 60, 30, 15, 12,
-195,160,113,135, 14,197,165,177,177,178, 45, 10, 69,249,188,166, 77, 37,227, 34, 35, 71, 54, 1,134, 85,197, 73, 16,196, 19, 86,
-157,202,155, 3,150, 44,219,116, 22,105,242, 48,246,247,197, 15,143, 88, 44, 91, 2, 87, 54,180,101, 38,236, 91,250,240,177,246,
- 49,126,168, 78,252,212,116,239, 50,153,108,202,210,165, 75,117, 30, 30, 30,232,223,191, 63, 22, 45, 90, 52,166, 67,135, 14, 10,
- 95, 95,223,139,141, 26, 53,186, 57,120,240,224,252,228,228,228, 41, 93,187,118, 69, 70, 70, 6,190,254,250,235, 82,185, 92, 62,
-180, 38, 78,130, 32,172,150,188,190,189,187,203,214,125,255, 13,221,173,243,100, 8, 93, 36, 48,114,130, 33, 83, 25, 33, 87, 51,
-208,243,227,192,227,242,209,163,109, 52, 46, 30,221, 90, 78,233,213,219,106,123,231, 85, 42,213,158, 17, 35, 70, 40,185, 92, 46,
-244,122, 61,195,225,112,192,175,152,119, 76,115,122,246, 52,180, 75, 77, 53, 81, 12, 67, 19, 4,129, 15, 63,252, 80, 45,151,203,
-119,212,165, 28, 57, 0, 91,206,231,229,110,161,123,165,246,231,121,184,133,120, 17,247,254, 50, 99, 99, 21,219, 95, 22, 45,203,
-146, 74,203, 39, 65,208, 20, 69,209,168,223,160,190, 56,243, 97,214,234, 65,131, 6,142,238,213,171,183,176,119,239,222,130,232,
-180,138,222,232,193,131, 7,177,119,239,222,242, 63,255,252, 83,201,231,176, 54, 7,215, 11,246,163, 40, 26, 4, 65,215,168,134,
-197, 98,241, 7,179,103,207,118, 81, 40, 20, 88,181,106, 21,221,188,121,115, 82, 36, 18,193, 96, 48, 96,243,230,205,198,232,232,
-104, 14, 73,146, 80, 40, 20, 32, 73,242,142,157, 55,120, 67,145,149,219, 99,109,215,126,123, 91,189, 63,202, 43,170,107, 59,143,
- 46,193,129, 48,182,100,144,151,253, 16,233, 39,254,148,223, 58,250,109, 9,180,133,253, 80,123,120,160,170, 26,130, 47,254,252,
-243, 79,223, 41, 83,166, 48, 90,173,150,200,202,202, 98, 22, 47, 94,236, 59,118,236,216, 47,242,242,242,254, 87,199,135, 66,148,
-150,150,130, 32, 8,218, 92,114, 30,194, 56, 0, 0, 32, 0, 73, 68, 65, 84,145, 88,122,253,142,140,203,165,108,219,182,109,255,
- 59,239,188,211,183, 91,183,110, 72, 75, 75,179, 14, 17,218, 10, 45,203,234,195, 37, 75,150,148, 2,248,180, 54, 82, 14,135,131,
- 85,219,118,163, 84, 94, 12, 63,191, 0, 8, 92, 92, 80,215, 21,150, 60,146,156,183,108,193,231,190,197,183, 47, 18, 41, 23, 78,
-210,187,110, 20, 22,153, 40,166,106,143,255,101,121,140, 89,253,215,220,155, 33, 89,243,150, 45,158,239,102, 25,214,220,113, 53,
- 95, 73, 80,204,148,103, 42, 34, 47, 11,231,223,140,128,128, 0,228,231,231, 19, 1, 1, 1,140,121,142, 22, 83,131,208,122,242,
- 5,175, 24, 46, 35,106, 26, 54,172, 43,255,131, 7, 15, 22,183,108,217,242,163,140,140,140, 93, 81, 81, 81, 19, 0,212,211,233,
-116,165,115,231,206,253,106,243,230,205,163,237,177,100, 1,192,111,191,253,246,237,168, 81,163,142,188,249,230,155,159,208, 52,
-221,204,166, 97,127,224,235,235,107, 29,194,125, 92, 88, 48,107,252,232, 33,179, 84, 42,185,221,126,238, 92, 93, 93,199,205,157,
- 59, 87,160, 86,171,177,102,205, 26, 58, 58, 58,154,180,116,138,126,250,233, 39, 83, 68, 68, 4,123,224,228,201,197, 43, 11, 10,
-176, 48, 49, 81, 61, 43, 38,166,249,150,244,244, 87, 64,211,219,171,179,234, 84,101,201,178, 76,187,168, 35,242,204, 98,235, 7,
- 0, 61,219, 13,242,199,254,229, 15, 33,207,212,127, 5, 19,238,193,142,176, 64, 85, 32,103,207,158, 61, 61, 10, 11, 11,247,127,
-254,249,231,110,175,188,242, 10, 98, 98, 98, 56,174,174,174,113, 22,119, 49, 10,133, 2,199,143, 31,199,250,245,235,245,183,110,
-221,122,167,166,225, 42,138,162,138, 34, 34, 34, 44,249,192, 16, 4, 81,162,212, 17,110, 59,155,196,185,142, 28,191,139, 56,123,
-249, 60,242, 12, 52,116, 70, 26,245, 27,180, 64,151,158, 43,113,224,240, 77, 42, 47, 51, 53,213,168,145,111,178, 35,189,247,238,
-222,189,187,111,193,130, 5,131, 62,249,228, 19,151,226,226, 98, 74,167,211,209,187,119,239,102,141, 28, 57,146, 98,216,108,154,
-203,102,227,131, 15, 62,208,148,150,150,254, 14,252,173, 1,166, 95,136,187,133, 23,224, 22,226,185, 89,179,108, 63,255, 43,168,
-178,132,210, 44,242,220,250, 13,235,222,248,237,215, 29,254, 44, 22,233,127,239,254,253,203,111,245, 27,144,123,236,216, 49, 79,
-174,155, 91,107, 0,180,126,194,132, 11, 6,157, 70, 22,191,127,127, 72,253,250,161,177,230,160,210, 12,205, 34,207,213,244,135,
- 42,149, 74,157,152,152, 88,254,233,167,159, 18,217,217,217,191,248,249,249, 13, 62,124,248,176,107,191,126,253, 52,105,105,105,
-123,252,253,253,251,118,237,218, 85,252,209, 71, 31,233, 84, 42,149, 35,129, 71, 83,153,199,242, 38,151, 62, 95,241,238,165,229,
-235, 94, 3,155,213, 30, 58, 14, 64, 27,207,193, 80,118, 12,192, 47,112,192,223,145, 45, 68, 34, 81,172, 80, 40,196,181,107,215,
-228,113,113,113,122,173, 86,203, 93,180,104,145,151, 72, 36,138,173,107,198, 51, 12,195,200,229,114,208, 52,205, 6, 64,152, 63,
- 65, 59,190, 22,255,127,111,189,245,214,254,157, 59,119,190,222,187,119,111,132,133,133,193,104, 52, 34, 34, 34, 2,122,189, 30,
-225,225,225,208,233,116,248,242,203, 47,161, 80, 40,102,160,134,152,103, 4, 65,192,100, 50, 89, 39,219, 6, 6,133, 84,248,233,
-121, 6, 55, 22, 34, 14, 25,118, 39,126, 11,138, 74,138,233,157,215, 11, 11,203, 13, 84,143,187,143,203,111, 85,190,174,156,130,
-186,235,200,169,185, 0,160,163,107,142, 56, 47,226, 33, 44,253,208, 15, 40, 44, 42,198,111, 87,243, 75,213, 6,186,103,122, 21,
-156, 14,165,243, 37,225,108,241,101, 26, 6, 76,181,255,218,103,129,189,130,170, 58, 92, 43, 0,113, 69,184,133,193,134, 45, 85,
-250,200,122, 70,254,253, 25, 25, 25,251, 1, 32, 53, 53, 53,123,200,144, 33,179, 30, 62,124,184, 0,192, 31,153,153,153, 27, 28,
- 33,218,178,101, 75, 6,128, 81, 53, 93,179, 99,197,168,125, 0,246, 57,194, 91, 86, 86,166, 77, 78, 78,214,126,244,209, 71, 68,
-118,118,246, 97,127,127,255,215,143, 28, 57, 34,236,215,175,159, 46, 37, 37,229, 68, 64, 64, 64,167,238,221,187,187,254,145,148,
-148, 91,126,239, 94,124,252,195,135, 65, 70,154,142,175,169,124, 62,103,145,245,132,216,218,183,240,225,178,253,203, 30,118,167,
-117,216,163,151,227, 2,128,156,103,224, 60,115,238,220,185,168, 97,195,134,237,236,211,167, 79,187,168,168, 40,212,171, 87, 15,
-233,233,233,120,252,248, 49,110,220,184,129,131, 7, 15, 30,212,106,181,181, 6,212,150,201,100, 79,135, 39, 18,120, 6,108, 93,
- 51,239,224,229,179,173, 35, 58,246, 30,225, 18, 19, 64, 67,111, 96,144,253,232, 30,190,252,108, 83,121,254,163,140, 84,131,201,
-240, 14,236, 92,168,163,209,104, 54,126,247,221,119,156,248,248,248,222,171, 87,175, 22,135,132,132,176,184, 92, 46, 9,128,185,
-114,229, 10, 51,117,234, 84,117,113,113,241, 33,165, 82,185,241,111,110,163,207,220,191,127,191, 5,139,197,122,174,238, 22,158,
-193, 45,132, 19,207, 19, 13, 26, 4, 69, 53, 12, 9,152, 16, 86, 47,104,114,131,144,224,225, 85, 77,114, 15,243,240, 16, 55, 8,
- 13, 28, 23, 86, 47,104,114,195,144,128, 9, 13, 26, 4, 69,217, 97, 90, 12,147, 72, 36,135,165, 82,105,115, 0,112,115,115,235,
-235,238,238,126,203,205,205,173,175,185, 23,216,215,213,213,245,118,116,116,244,216,191,209, 92, 89, 35,103, 68, 68,196, 16,149,
- 74, 53, 41, 34, 34, 98,136,101,255,222,189,123,214,253,186,112, 6, 7, 7,119,187,114,229,202,255, 86,172, 88,209,191, 81,163,
- 70,125, 23, 47, 94,220,255,247,223,127,255, 95, 80, 80,208, 43,117,224,228, 3,248,153,195,225, 20,242,120,188, 34, 14,135, 83,
-104,217,216,108,118, 33,139,197, 42, 4,176,161, 26,107, 89,119,155, 94,206, 89, 63, 63,191, 76, 63, 63,191, 76,127,127,255, 76,
-127,127,255, 76,169, 84,250,212,230,237,237,125,214,222,252,140,244,119,237, 16, 87, 79,124,174,169,212,245,108, 19, 63, 81,228,
-243,120, 70,145,254,174, 29, 90,215,115, 59,215, 84, 42, 78,252,255,198,217,220, 31, 12,179, 62,146, 97,214, 71, 50,205,253,193,
-212,182,255, 60,205,254, 82,169,148,145, 74,165,243, 94,212, 80, 66, 53,252,127,123,121,127,142,156, 97, 98,177,120, 71,189,122,
-245, 44,117,221,155, 18,137,228,148,171,171,235,155,230,186,238, 77,145, 72,148, 16, 29, 29, 61,162, 54, 78, 79, 79,207, 43,190,
-190,190, 5,230, 45,223,207,207, 47,223,207,207, 47,223,215,215, 55,207,215,215, 55,207,199,199, 39,215,178,185,187,187, 95,172,
-227,189,251, 2,104, 3,224, 21, 0,146,231,152,159, 13, 0,140, 55,215, 65, 75, 1,140, 5,208,236, 57, 60, 35,130,227,226, 57,
-145,239, 30,124,142,227,234, 83,198,113,245, 41,227,187, 5,157,171, 33, 4,143, 61,156,141, 61, 61, 61, 23, 73, 36,146,223,197,
- 98,113,162, 88, 44,222,239,237,237,189, 24, 64,227,127,232, 93,114, 5,176, 25, 21,254,153,254, 64,197, 80,248,126, 84, 44, 42,
- 8,249, 23,190,243,255,159, 49,238,159,250,227,238, 78, 78, 39,167,147,211,201,233,228,116,114,190,132,156,164, 51, 63,157, 66,
-203, 65,161, 85,121, 3, 80,131,103,120, 39,156,112,194, 9, 39,156,248,127, 12,218,153, 5, 78, 56,136, 42,135,150,137, 26, 84,
-169, 35,190,166,234,162,108,143, 59, 57,157,156, 78, 78, 39,167,147,211,201,233,228,252,127,199,233,196,115,132,211,172,234,228,
-116,114, 58, 57,157,156, 78, 78, 39,167,147,243,191, 14,231,208,161, 19, 78, 56,225,132, 19, 78, 56,225,196, 11,194, 70, 27,193,
-245,196, 16,162, 83,104, 57, 14, 18,192, 36, 0, 3, 0, 52, 68, 69, 52,251,221, 0,214,162,110, 99,250, 18, 0,179, 0,180, 71,
-197,234,156, 7, 0, 18, 81,177, 58, 71,229,204,238,170,225,237,237, 61,155,195,225,184, 3, 21,161, 77, 44,159,182,223, 41,138,
- 42, 85, 42,149,139, 95, 80, 18, 88,176,211,131,178, 37,173,182,105,179,253, 52, 26,141, 47, 50,157, 78,252, 59, 17,225,233,233,
-249,179, 76, 38, 27, 10,155, 32,203, 78, 56,241, 95,128,143,143,207, 4,131,193, 48,151,203,229, 46,122,252,248,241,186,255, 71,
-183,254,148,200,122, 66,104,197,199,199, 39, 0, 64,159, 62,125, 58, 3,128,187,187,251,121,146, 36, 27, 56,242, 15, 52, 77, 63,
- 40, 45, 45,173,214,129,154,187,187,251,121, 22,139,245, 20,167,209,104, 20,179,217,236,178,170,126, 99, 50,153,114,148, 74,229,
- 43,255,146, 76, 36, 0,196,123,120,120,104, 23, 44, 88,176,182, 75,151, 46,193,121,121,121,166,153, 51,103,118,186,126,253,122,
-111, 0,111, 56, 40,182,218, 18, 4,177,181,121,243,230,251,134, 15, 31,190, 51, 46, 46,142, 87, 82, 82, 34,222,189,123,119,224,
-182,109,219,146,105,154, 30,138, 26, 2,173,254,127, 6,135,195,113,207,201,201, 17, 3, 21,161, 73,204,194, 10, 70,163, 17, 70,
-163, 17,106,181, 26,177,177,177,207,253,127,253,253,253, 91, 16, 4,177,218,213,213,245, 21,149, 74,117, 25,192,228,252,252,252,
-235,142,164,213,100, 50,129, 97, 24,107, 58,163,162,162,156, 15,212, 49,140,225,241,120, 61,195,195,195, 91,235,116, 58,249,131,
- 7, 15, 46, 81, 20,245, 57,158, 95,140, 54, 55, 0,159,243,249,252,184,134, 13, 27, 6,103,100,100,100, 27, 12,134, 36, 84, 4,
- 67, 86, 60, 15,145,213,185,115,231,179,107,214,172,241,154, 56,113,226,217,196,196,196, 14, 78,177,229,196, 63,133,224,224, 96,
-119,181, 90,189, 9, 64, 11, 14,135,227, 47, 16, 8,224,226,226, 82,192,231,243,175,185,184,184,140, 62,119,238, 92,169,163,156,
- 20, 69,125,158,153,153,233,223,166, 77,155,229,190,190,190, 95, 22, 23, 23,107, 13, 6,195, 9,185, 92, 62, 3,128,178,166,223,
- 86,214, 34, 47,153,200,178,253,132, 69,116,177,205, 55,198, 0,232,242,132, 2, 99,179,131, 30, 61,122,228, 43, 16, 8, 64,211,
-180,181, 49,171,188, 89,142,235,245,122,196,196,196, 24,106,105,112,130,179,179,179,125,121, 60,158,245,152, 94,175, 71, 96, 96,
- 32,157,147,147,227,107, 14,123, 96,133, 78,167, 67, 80, 80,208,191, 41,230,209, 36, 79, 79, 79, 69, 86, 86,118,172, 86,103,152,
- 63,118,202,167,179,135, 14,120,205,227,252,249,243,244, 27,111,188,161, 75, 72, 72,152,132,138,192,169,118, 85,230, 4, 65,108,
-155, 57,115,230,151, 2,161,196,235,228,249, 84,221,182,221,135,114,155, 71,212, 39,102,204,152,193,154, 58,117,234,153, 22, 45,
- 90,252, 76,211,116, 75, 56, 96,217,242,240,240, 56,194,231,243, 67,205,249,151, 37,151,203, 95,255, 23,190,144,108, 60,237, 60,
-182,170, 99,181,162,164,164, 4, 26,141,230,169, 45, 42, 42,202,222, 88,153, 14,165,155,195,225,236, 95,178,100, 73, 96, 65,126,
- 62,190, 89,185,178, 13, 42, 44,153,109,236,249,113, 81, 81,209, 83,233,140,140,140,132, 19, 14, 97,214,151, 95,126,185,228,221,
-119,223, 5, 69, 81,208,104, 52, 1,119,239,222,141,158, 59,119,238, 59,247,238,221,107, 13,224,254,179,118,198,195,195,195,211,
-166, 77,155,230,217,186,117,107,152,163, 84, 4, 36, 38, 38,182,217,188,121,243,123, 89, 89, 89,145, 0, 30, 63,203, 31,120,122,
-122,254,252,195, 15, 63,120, 9,133, 66, 28, 56,112,192,171, 91,183,110,137, 87,175, 94,237,248, 12, 98,139,244,242,242,154, 10,
-224, 85,154,166,121, 0,146,228,114,249, 66, 56,238,213, 93,234,234,234,186,135, 36,201,250,192, 95,222,232, 73,146,244, 38, 8,
-162,216,114,140, 32, 8, 95,154,166, 47,200,100,178,118,206,215,241,229,134,151,151,215,152,194,194,194, 53,124, 62,159,235,225,
-225, 1,161, 80, 8, 54,155, 13, 54,155, 93,143,207,231,215,227,243,249,189,186,118,237, 58,249,212,169, 83, 53,122,216,111,219,
-220,111, 36, 72, 98, 62,139, 32, 89, 0, 64,114, 68, 18, 55, 55, 55,204,159, 63, 95,212,183,111, 95, 17, 0,156, 61,123,118,248,
-136, 17, 35,186,229,228,228,196, 84, 39,182,170,210, 34, 47, 17, 54,214,212,224,193,172, 30, 19,158, 40,185, 36, 9, 30,143,135,
-139, 23, 47,194, 30,103,229,150, 16, 9, 53,214, 6,102, 15,227,215,175,255,101, 0,176, 52, 52, 60, 30, 15,231,206, 61,233, 84,
-190,109,219,182,214,194,254,119, 97, 64, 84,133,147,199, 93,239, 87,164,107,224,234, 10,239,218,187,222,143, 68,167,175, 31, 97,
-192,212,121,131,203,181,134, 86, 0,212,165,114,185,252,242,222,189,121,205, 35, 34,184, 63,255,252,115,235,192,192,192, 1, 14,
- 8,173, 89, 45, 91,182,220,195,114,113,243, 30, 62, 98,228,240,209,108,210,240,222,248,143, 22,101,231, 23,171,199,141, 27,183,
-247,192,129, 3,195,151, 45, 91,118,251,227,143, 63,158, 5, 96,142,189,233, 23, 8, 4,161,119,238,220, 9,167, 40, 10, 81, 81,
- 81,255,198, 48, 6,205, 81,225,124,239, 93, 0,191,154,143, 13, 65,133,231,254, 22, 0,174, 57, 66,102,177, 96, 85,181, 61,111,
- 4, 6, 6, 70, 14, 27, 54,204, 91, 86, 92,140,111, 86,174,180, 28,126, 5,181, 12, 35, 90,202,143, 94,175, 71,255,254,253,135,
- 81, 20,197,182,136, 64,157, 78,167, 87, 40, 20, 90,252, 53,177,244, 49,128,215,236, 72, 78, 3,145, 72,244, 21,128, 22, 26,141,
- 38, 16, 0, 68, 34, 81, 46, 77,211,251,212,106,245, 28,252, 21,192,215,225, 14, 46,128,104, 84, 31, 10,138, 89,178,100, 73,198,
-167,159,126,122,255, 31,224, 12,245,243,243, 91, 60,112,224, 64, 28, 58,116, 8,127,252,241,135,209,197,197,133, 61, 98,196, 8,
- 98,242,228,201, 30,211,166, 77,235, 5,224,187,103,124,204,189,190,252,242, 75,207, 38, 77,154, 96,247,238,221,184,113,227,134,
- 38, 60, 60,220,165, 75,151, 46, 96,179,217,158,179,103,207,126, 3,192,214,103,249, 3,153, 76,182,240,163,143, 62,218,246,235,
-175,191,138, 31, 60,120,128,213,171, 87,123, 15, 30, 60, 56, 33, 43, 43,171,179, 3, 98,139, 15, 96, 42,128,174, 44, 22,171,227,
-136, 17, 35, 76, 83,166, 76,225,144, 36,105, 92,185,114,165,207,230,205,155, 7,115, 56,156, 22, 37, 37, 37,246,116,210, 72, 0,
-243, 71,143, 30, 61,234,212,169, 83, 30,151, 46, 93,226,121,121,121,129,162, 40,171,165,152,166,105, 95,203, 59,107, 50,153, 16,
- 25, 25, 25,100,243,123,151,151, 85,104,144, 36,105,160,105,154, 3, 64, 0, 64, 87,219,254,127, 73,100,121,122,122, 78,148,201,
-100,107,253,253,253,225,231,231,247, 84, 91,171,211,233, 32, 16, 8,184,254,254,254, 63,244,237,219,151,179,127,255,254,106,135,
- 0, 9, 22,241,249,129, 29, 11, 2, 61, 61,196, 0,128,111,215, 31, 45, 7,128,223,127,255, 29,121,121,121,240,240,240, 64, 76,
- 76, 12,107,193,130, 5,210, 25, 51,102,124, 35,151,203, 71, 87,199, 85, 89,139,188,100, 22,173,141, 85,237,215, 56, 71,139, 97,
- 24,107,156, 60, 59, 95,218,202,135,142, 87,226, 35,244,122, 61, 42, 91,180, 44,133,151,195,225, 84, 54, 63,130, 32, 8,166, 38,
-206, 42, 48, 66, 36, 18,197,170,213,234,239, 29,232,221, 90, 57,119,189, 31,137,109,252,153, 67, 44,145, 72,123,125, 84,241,185,
- 13,192,249,135,163, 87,175,233,220, 57,112,234,103,171,230,105, 74,242,138,103, 15,123, 51, 52,220,223,203, 69, 84, 90,164,240,
-108,220,184, 71, 37,139, 76,109,233,236, 52,124,248,240,237,127, 94,204, 36, 4, 2, 46,151,205, 98,113, 58, 52,141,240, 10,118,
- 99,185,137, 1,183,236,251, 25,231, 71,142, 28,217,244,227,143, 63,238,232, 0, 39,204, 13, 46,126,250,233, 39, 16, 4, 65, 58,
-114,239,207, 17,199,107, 18, 89, 12,195,128, 32,136, 95,108, 26,149, 95,204,199,174,218,136, 45,118, 77,249,105,177,166, 90, 68,
-213,136, 17, 35,134,153, 76, 38,182, 77, 37, 81, 89,192, 84, 37, 98,236,186,119,169, 84,250, 39,128,215, 8,130,128, 94,171,213,
-127,245,245,215,182,167,175, 84, 18, 89,199,171, 43, 75, 70,163, 17, 20, 69,177,175, 94,189,202,177,121,215, 57, 0, 68, 0,188,
- 25,134, 1, 73,146, 55,237,200,207, 72,161, 80,120,254,224,193,131,146, 87, 94,121,133,224,241,120, 48,153, 76, 72, 73, 73, 9,
- 94,182,108,217,248,227,199,143,191,161, 86,171,163,240,116,240,116,123,158, 81,116, 98, 98,162, 58, 44, 44,172, 74,225,168, 84,
- 42,217, 17, 17, 17,157,171, 17, 69, 47,154, 51,167,176,176,240,237,215, 94,123,109, 66, 65, 65, 65,154,201,100,250, 4, 64,140,
-183,183,247,213,126,253,250,193,197,197,165,171, 70,163,249,238, 89,222,121, 95, 95,223,190,237,218,181,195,234,213,171,177,108,
-217,178,238, 0, 78, 0,232,166, 84, 42,143,191,245,214, 91,112,119,119,127,187,180,180,116,235, 51,148,163,136, 78,157, 58,253,
- 48,127,254,124,241,161, 67,135, 16, 30, 30,142,178,178, 50,124,248,225,135,190, 95,124,241,197,233,210,210,210, 46, 54,229,162,
- 58,206, 40, 62,159,191,245,215, 95,127,117, 13, 11, 11, 11,227,114,185,100, 88, 88, 24,100, 50, 25,180, 90, 45,127,209,162, 69,
- 77, 93, 92, 92,174,127,247,221,119, 91, 1,244,171, 37,157, 36,128,133, 27, 54,108,152, 48,110,220, 56,247, 97,195,134, 81,122,
-189, 30, 59,119,238, 4,139,197, 2,135,195,129, 80, 40,180, 6,175,230,114,185,104,220,248, 41, 39,233, 7,106,184, 95, 5, 42,
-230,161,186,195,177, 97,215,227, 53,240, 89,135, 62, 56, 28, 14, 4, 2, 1, 4, 2, 1,248,124, 62,238,220,185,243,153, 64, 32,
- 88, 73, 16,132,201, 30, 78,226, 47,117, 17, 11,224, 82,109,251,120,122,106,200,223, 89,127, 90, 16, 68, 16,196,183, 0,186, 86,
- 52,187,100,130,183,183,247, 7,133,133,133,143,236,229,148, 74,165, 94, 37, 37, 37,223, 73,165, 82,248,249,249, 89,219,239,192,
-192, 64, 24,141, 70, 20, 22, 22,130, 97, 24,148,150,150, 66, 40, 20, 34, 32, 32,224,187,113,227,198,237,222,184,113, 99, 73,149,
-156, 52,150,189, 53,120,238,231, 44, 22,139, 4, 0, 22,219,213,117,218,167, 64,104,104, 40, 58,116,232, 0,173, 86, 11,133, 66,
-129,232,232,104, 54, 65, 16,195, 9,130,144, 48, 12,179, 14,192,201,255,160,161,176,218,201,240, 95, 86, 30, 23,181, 68,139,231,
-114,185,118, 9, 45,243,245,181, 89, 80, 72,163,209, 8, 46,151,251,132, 69,130, 32, 8, 80, 20,245,196,113,139,208,170,139, 80,
-159, 60,121, 50,253,195, 15, 63, 76,144,203,229,235, 81,199,161,132,225,195,135, 63, 53,223, 99,198,140, 25, 57, 69, 69, 69, 76,
-255, 30,177,162,180,195,121,249, 13, 61, 92, 93,124,196,226,250, 2, 15, 79,247,146,146,146, 11,230,202,196, 94, 52,106,217,178,
-165,203,182,189,137, 57, 99,167, 47, 89,240, 74,152,151,164, 89,144,183,135,191,155, 11,207,149, 36,212, 2,147, 49,199,211,211,
- 51,220,209,116, 91,234, 5,161, 80, 8,146, 36,255, 77, 22, 45,182, 69,100,201,100, 50, 28, 58,116, 8,189,123,247,190,106, 17,
- 33, 74,165, 18,249,249,249,144, 74,165, 87,205,150,143, 90,135, 17,105,154,134,193, 96,128,193, 96,176, 10, 24,155,119,200, 42,
- 96, 44,215,178, 88,172,155,117, 76,251, 2, 15, 15,143, 78, 93,187,118,229,237,216,185,147,199, 48,140, 26, 21, 49,212, 84, 12,
- 83, 77,128,236, 74, 48,153, 76, 86, 43, 27,135,195, 65, 86, 86,150,181,225,178,196,150, 20, 8, 4,246,153, 50,248,252,143,126,
-251,237, 55, 73,235,214,173,137,146,146, 18,208, 52,109,173, 36,215,174, 93, 43, 24, 48, 96, 64, 96,114,114,242,108,157, 78,247,
-101, 29,238,149,168, 78, 16, 1,128, 68, 34, 49,193, 62,143,217,181,114,154, 76, 38,162,125,251,246, 31, 23, 23, 23, 55,213,104,
- 52,139,236,201, 70, 0, 7,114,114,114,108, 27,246,235,105,105,105,154, 65,131, 6,185,212,175, 95, 63, 46, 53, 53,245,153, 94,
-210,136,136,136,182, 28, 14, 7, 73, 73, 73, 58, 0,150,158,117,194,141, 27, 55,116,253,250,245,227, 7, 7, 7,183, 45, 45,181,
-123,202, 74, 68,100,100,228, 49, 95, 95, 95, 23, 75, 29,234,227,227,195,217,184,113,163, 56, 55, 55, 23, 6,131, 1,179,102,205,
- 66,159, 62,125,224,237,237,141, 25, 51,102,248, 45, 95,190,252,103,149, 74,213,178, 38,163, 53,143,199,219,126,247,238,221,112,
-169, 84,234,114,241,226, 69, 52,107,214, 12,197,197,197, 40, 40, 40,128, 74,165, 66, 65, 65, 1, 70,143, 30,237,251,205, 55,223,
- 4,216, 97,201,178,138,172,141, 27, 55,150,238,217,179,135,181,105,211, 38, 49,135,195,177, 10, 45, 54,155,109, 21, 90,150,216,
-138,117, 24,105, 40, 53,139, 54,119,133, 66,241, 44,243,220,248, 0,120,182, 34,139,207,231,131,207,231, 67, 32, 16, 60, 83, 92,
-214,151, 4,129, 4, 65,164,114,185, 92,190, 80, 40,228,146, 36, 9, 62,159,223,195,211,211,243, 86, 76, 76, 76,204,177, 99,199,
- 50,237, 33,209,106,181,219,249,124, 62,199,215,215, 23, 0, 16, 30, 30,142,102,205,154, 65,173, 86,211, 10,133, 2,238,238,238,
-228,163, 71,143,160,209,104,144,159,159,143,144,144, 16, 14, 73,146,219, 81, 49, 15,249, 41,156,191, 90,176, 30,192,122,203,190,
-183,183,119,161,173,165, 83, 32, 16, 32, 48, 48, 16,185,185,185, 16,139,197,172, 47,190,248,162,223,206,157, 59,223, 57,127,254,
-252,112, 0, 63,217, 80,125,249, 18,207,209,178,136, 44,219,207,191,132, 86,159, 62,125,230,197,199,199,119,174,170, 23,206,225,
-112,158,219, 92, 23,139,160,146, 72, 36,149,173, 86,160,105,186, 58,139,150,195,255, 35, 16, 8, 92, 38, 78,156, 88,182,110,221,
- 58,135,197,214,192,213,105, 86, 43,214, 83,221,200,168,168,243,179,103,207,238,123,234,212,169,220, 87,194,234,179, 69,121,143,
- 84, 2,137,187, 59,130,234,245, 30,241,118,191, 27,168, 88,125,104, 47,238,150,149,149,185, 52, 12, 18,234, 73, 82, 75,212,227,
-179,197, 82, 17,151,239,239,225, 17,200,213,235,138, 36, 30, 30, 60,157, 78, 87,138, 26,130, 64, 3,128,159,159,223, 81, 23, 23,
-151, 16,203,190,135,135,135, 27,195, 48, 16, 10,133,144, 74,165,174, 44, 22, 43,221,166,112, 61, 42, 44, 44,236, 81, 91,194,220,
-221,221,143,242,249,252, 16,146, 36, 65, 16, 4, 88, 44, 22, 72,146, 4, 73,146,214,239, 44, 22, 11, 4, 65,160,188,188,252, 81,
-102,102,102, 15, 59,238,215, 4,160, 5, 65, 16, 87, 15, 29, 58,132,184,184, 56, 28, 62,124, 24, 61,123,246,132, 66,161, 64, 74,
- 74, 10, 58,117,234, 4, 84, 12, 41,218, 5,219,201,239,150, 78,193,157, 59,119,172,194,197,118, 19,139,197,207, 98, 98, 63, 59,
-112,224, 64,252,240,195, 15,140,185, 51, 33, 34, 8,162,153,155,155,219,157,219,183,111,219, 53, 15,134, 97, 24, 24, 12,127, 93,
-106,105,188,204,243, 33, 28, 10, 14,204, 98,177,122,180,108,217,146, 80, 40, 20, 22, 1, 9, 54,155, 13, 22,139, 5, 22,139,133,
- 53,107,214,184,180,110,221,122, 46,159,207,255,152,203,229, 42,141, 70,227, 14,173, 86,187, 8, 64,233,191,169, 70,234,216,177,
-227,244,236,236,236, 62, 33, 33, 33, 7,159,129,134, 49, 26,141,122, 0, 46, 44, 22,139,243, 28,234, 40,150,249,221,210,218,136,
-125,147,121,159,143,138, 97, 98,187,224,237,237,253,243, 31,127,252, 17, 20, 18, 18, 2,163,209, 8,147,201, 4,149, 74,133,132,
-132, 4,232,116, 58,152, 76, 38,132,135,135,227,243,207, 63,215,126,240,193, 7,130, 13, 27, 54, 20,169, 84,170,161,181,208,126,
-176,123,247,110,145, 84, 42,117,209,104, 52,184,127,255, 62, 90,182,108,137,178,178, 50,168,213,106,148,151,151,195, 96, 48, 64,
-169, 84,186, 83, 20,165,175,133,235, 51, 91,145, 53,126,252,248,155, 60, 30,175,229,148, 41, 83,144,147,147, 99, 45,243, 99,199,
-142,133,159,159,159,181, 44,153,235,100,135, 42,102, 54,155, 13, 62,159, 15, 46,151, 91, 90,175, 94, 61, 16, 4, 33,120,244,232,
- 81, 93,134,226, 36, 0,148, 28, 14,135,103, 43,176,248,124, 62,146,146,146,102,243,120,188,234,172, 89,213,149, 75,198,145,253,
-127, 26, 4, 65,124,203,229,114,249,158,158,158, 92,155, 14, 39,215,213,213, 21,190,190,190,171, 1,244,178,243,190,155,123,122,
-122, 90,235,247,216,216, 88,100,103,103,239, 83, 40, 20,239, 21, 21, 21,129, 36,201,237, 36, 73,190, 99,233,164,202,229,114, 4,
- 7, 7, 55,175,142,175, 93, 11,255, 9, 32,152, 39, 44, 90,149, 58,104,144, 72, 36,120,248,240, 33,212,106, 53,147,145,145, 65,
- 76,156, 56,145,208,235,245, 63, 38, 39, 39, 95, 64,197,106,251,106,181,200, 75, 2,199,231,104, 89, 44, 90,246, 54, 0, 4, 65,
-212,218,155, 48, 26,141,174,209,209,209, 85, 77,248, 34,170, 18, 90,230,225,164, 58,189,232, 28, 14, 71, 92, 87,177, 85, 25, 7,
-247,252,234,183,236,243, 89,159,123, 6,212,111,248,241,199,159,177,223,124,243,205,139,219,182,109,163, 60,155,244,234,118,242,
-232, 79,126,223,125, 56,243,240, 31,127,252, 1, 84, 76,140,182, 23,103,227,227,227,253,103, 76,157,140,207, 63,250,224,136, 36,
-220,155,231, 74,120,138, 4, 58,245, 99, 87, 48, 26,126,163,200, 62,123, 15, 30,204, 7,144, 92, 19,137, 80, 40, 12, 73, 77, 77,
- 13,183, 93, 72,160,215,235, 33, 20, 10,113,242,228, 73, 31, 23, 23, 23, 31, 0,208,104, 52,136,137,137,177,215, 98, 18,146,158,
-158, 30, 46, 22,139, 81, 94, 94, 14,157, 78, 7,163,209, 8,154,166, 65, 16, 4, 56, 28, 14,120, 60, 30, 68, 34,145,163, 43,251,
-174, 1,120,183,119,239,222,191, 28, 62,124, 24,209,209,209,144,203,229, 72, 75, 75,179,136, 44,135,230,104, 89,172, 68,182,243,
-177,216,108, 54,126, 14, 11,195,216,188, 60,171,128,249,214,205, 13,159,211,117,139,166, 17, 19, 19,195,156, 61,123, 22, 71,142,
- 28,193, 91,111,189, 69,236,223,191,223, 64, 81, 20, 55, 47, 47,239,102, 94, 94,158, 93, 28, 52, 77, 91,211,106,169,183,109, 5,
-150,163, 66,203,100, 50,137,121, 60, 30,180, 90, 45, 44,150, 7,219,173, 65,131, 6,144,201,100,108,165, 82,201,206,203,203, 19,
- 46, 92,184,112,202,233,211,167,165,101,101,101, 67,254,201, 90,104,221,186,117, 33, 99,199,142,205, 98,179,217, 76,207,158, 61,
-135, 61,122,244,232,109,169, 84,122,226,212,169, 83, 95, 3,136,112,148,207,219,219,251, 10,155,205, 14, 82, 42,149,220, 93,187,
-118, 25,203,202,202,184, 62, 62, 62,133,150,186,195,146,215, 70,163,209,174,149,203,222,222,222, 87,138,139,139,185,223,127,255,
-189,177,164,164,132,235,231,231, 87,104,225, 41, 45, 45,229,238,218,181,203,168, 84, 42,185,110,110,110, 87, 20, 10, 69,173,124,
-197,197,197, 67,135, 15, 31,158,120,226,196, 9,111, 22,139,133, 71,143, 30,161,164,164, 4,238,238,238,216,190,125, 59, 66, 66,
- 66,176,123,247,110,153, 76, 38, 27,243,213, 87, 95,205, 53,139,172,218,230,104,117,138,139,139, 11, 41, 45, 45,133,187,187, 59,
-212,106, 53,174, 92,185,130,168,168, 40,228,229,229,129, 36, 73,184,187,187, 99,237,218,181,229, 4, 65,200,106, 34,114,113,113,
-121,123,220,184,113,238, 0, 48,110,220, 56,247,113,227,198, 85,217,192,181,109,219, 22,171, 87,175,174, 44,180, 28,233, 24, 88,
-173, 78, 54,226, 72,219,166, 77, 27,156, 62,125,122,166,131,226, 72,111, 17,109,149,173, 89,124, 62,223,225,197, 52, 52, 77,115,
- 81, 49,165,129,176,103,255, 95,128,206, 46, 46, 46,220,202, 7,203,203,203,185, 82,169,180,163, 3,194,215,203,197,165,194,224,
- 20, 18, 18, 2,133, 66, 65,233,245,250,193, 63,253,244,147, 17, 0, 90,180,104, 49,152,162, 40,173,201,100, 98,241,120, 60,168,
-213,106,248,250,250,122,213, 96, 27,253,228,192,142,133,254,149,231,104, 73,165, 82,180,104,209, 2, 58,157, 14,249,249,249, 72,
- 72, 72, 48, 82, 20,245,203,186,117,235,104, 31, 31,159, 81,253,251,247,103, 37, 39, 39,191, 15, 96,122,117, 90,228, 37,179,102,
-109,172, 86,104,153, 21,228,105, 0, 93, 42,223,100,101,241, 83,147,208,170,109,232,144,199,227,149,102,101,101,137,108, 27, 21,
-147,201,132,128,128, 0,154, 97, 24,162, 42,161,245, 44,166, 96, 14,135, 35,254,244,211, 79, 75,215,173, 91, 55,244,225,195,135,
-243,236,249,205,174,247, 35,177,173,146,200, 90,191,108,254,234,239,151, 45,244,188,119,228, 71,108, 90,181,130,162, 40, 36, 55,
-109,218,180,163, 74,165, 98,187,137,140, 40, 46,197, 97,179,200,178, 87, 20,146, 0,182, 92,186,116, 41,185, 87,175, 94,231,182,
-252,182,215, 51,239,254,253, 11,124,101,113,190,164, 81, 56,155, 27, 24,242, 78,153, 86,203, 29, 60,120,176, 15,128,254,181, 85,
- 98,165,165,165, 40, 40, 40,168, 44,192,112,231,206,157,167,174,181, 43,113, 36, 9,138,162,176,103,207, 30, 8,133, 66,136, 68,
-162, 39, 54,139,200,170,227, 66,133,116, 0,232,217,179, 39,100, 50, 25, 92, 93, 93,237, 78, 87,101,241,194, 48, 12,244,122, 61,
-244,122, 61, 12, 6, 3, 5,128,195,102,179, 49, 58, 39,199,106,229,113, 68,192, 84, 70,211,166, 77,153,243,231,207,227,220,185,
-115, 80,171,213,248,254,251,239, 33,149, 74, 95, 5,240,153,163, 92, 54,147,244, 41,165, 82,201, 81, 42,149, 86,235, 32,135,195,
-177, 90, 15,236,180,228,113,217,108,182,181, 55,106,217,108,173, 90, 44, 22, 11,126,126,126,240,247,247,199,250,245,235,185,245,
-235,215,239,243, 79,214, 64,203,151, 47,111,244,237,183,223,110,222,182,109,219,225,161, 67,135,238, 76, 73, 73, 25,233,230,230,
-118,243,228,201,147, 11,249,124, 62, 93,199,242, 29,148,151,151,231,107,123,136,166,105,161,201,100,178, 10,219,242,242,114,187,
- 59, 24, 28, 14, 39, 40, 53, 53, 85, 8, 0, 11, 23, 46,228, 0, 16, 90, 38,131, 91, 56,203,203,203, 57, 81, 81, 81, 65,246,190,
-235,137,137,137, 29,187,119,239,126,254,216,177, 99, 30, 33, 33, 33,200,205,205, 69,110,110, 46, 26, 53,106,132,197,139, 23,171,
-149, 74,101,123, 0,233, 42,149,106,191,157,156, 1, 30, 30, 30,156,172,172, 44,152, 76, 38, 52,111,222, 28,107,215,174,197,224,
-193,131, 17, 19, 19, 3,165, 82,137,212,212, 84,108,221,186,213,131,203,229,214, 88,119,104, 52,154,253, 27, 55,110, 12,174,108,
-209, 26, 54,108,152,168,176,176,208,250, 78,206,159, 63,255,137, 33, 68, 71,234,100,243,208, 86,181, 91, 93, 96, 50,153, 36, 2,
-129, 64,201,231,243,121,150,249, 89, 9, 9, 9, 14, 91,179, 42,117, 0, 29,217,255,199, 96, 17,173, 85,180,173,240,247,247,183,
-155,135,207,231, 19,150,186,209,100, 50, 65,161, 80, 80, 82,169,212, 58,188,127,245,234, 85, 42, 52, 52,148, 98,177, 88, 44, 30,
-143, 7,130, 32, 32, 20, 10,171,173,240, 25,138,153,255,230,224,207,158, 88,117, 56,237, 83,192, 96, 48,224,234,213,171, 48, 24,
- 12, 72, 72, 72, 48,126,245,213, 87,121,165,165,165,211, 0,176,143, 30, 61, 58,124,230,204,153, 44, 95, 95,223,238, 69, 69, 69,
-168, 77,139,188, 68, 98,235, 41, 43,151,165, 21, 58,221,167, 79, 31,194,188,180,146,176, 8, 39, 71,132,150,185,240,213,218,242,
- 18, 4,129,252,252,124,235,190,175,175,175,195,255,101, 47,188,188,188,212,109,219,182, 21, 23, 23, 23,239, 95,190,124,121,157,
- 44, 89,235,151,205, 95,189,100,193, 23,158,178,219, 23,145,147,151, 15, 89,145, 49,249,236,205,135,251, 0,236, 3, 0,108,104,
-114,154,152,144,182,198, 94,206, 72,111,151, 88, 14,151,189,239,181, 94,125,130, 7,141,155, 78, 78,154, 52,169,195,240,225,195,
- 21, 67,135, 14,157,234,234,234, 26, 97, 48, 24,228,123, 15, 29,202, 28, 52,104, 80,125,138,162,134,163, 22,159, 35, 26,141,230,
- 81,151, 46, 93,108,243, 83,114,252,248,113,191,204,204, 76, 76,158, 60,249,113,110,110,110,169,237,181,246,164,209, 96, 48, 60,
-138,141,141,173,118,184,208, 50,164, 8, 0,101,101,101,143, 28,200,210, 33, 48, 79,124, 47, 41, 41,193,157, 59,119,192,102,179,
-209,166, 77, 27,156, 61,123, 22, 29, 58,116,184,234,136, 85, 75,171,213, 34, 36, 36, 4, 90,173, 22,106,181,186, 28, 0,127,123,
-253,250, 0,128,247, 75, 74,112,229,171,175,112,113,201, 18,216,190,207,246,162, 89,179,102,204,197,139, 23,113,243,230, 77,232,
-116, 58,140, 25, 51, 6, 0, 8,243,187,235,136,203,140, 48, 22,139,213,179, 87,175, 94, 1, 0,160, 86,171,137, 75,151, 46, 65,
- 32, 16, 88,203,194,193,131, 7,145,155,155, 11,130, 32,224,225,225, 17, 36,151,203,235, 3,120, 88,131,217,159,120,248,240, 33,
-150, 46, 93, 10,154,166, 49,115,230, 76,132,135,135, 91, 5,214,163, 71,143,176,112,225, 66, 80, 20,133, 47,190,248, 2,141, 26,
- 53,130,209,104, 20,160,142, 46, 52,158, 7,102,204,152,113,111,223,190,125,135,179,179,179,223, 88,182,108, 89,103,130, 32,232,
-143, 63,254,120,169, 68, 34,161,158,133, 87,174, 40,195,157,187,143,172, 66,168,242,230,227,237,233, 48, 95,198,253,108,235,239,
- 41,202,150,143,130,151,167,135,163, 73, 44, 55, 26,141,234,119,222,121,199,125,207,158, 61, 68,163, 70,141,240,224,193, 3,139,
-101,168, 28,142,187,116,200,149,201,100,225, 44, 22,139,123,247,238, 93,132,134,134, 34, 46, 46, 14,139, 22, 45, 66,113,113, 49,
- 76, 38, 19,124,125,125,105,163,209,120,213, 96, 48,156,169,133,107,254,248,241,227,185, 0, 38,152, 45, 91, 77,167, 77,155, 70,
-175, 88,177, 2, 87,175, 94,181, 90,176,108, 39,195, 59, 58,116,104,107,117,178,221, 18, 18, 18,102,242,120, 60, 6, 64, 18, 28,
-119,244,172,175,108,209,170,139, 53,235, 69,225, 69,174,100,148, 74,165, 9, 98,177,184,143, 92, 46,127,194,170,213,190,125,123,
-131,159,159, 95,162,189, 60,174,174,174,114, 22,139,229, 5, 0,185,185,185, 16,137, 68,220,251,247,239, 47, 65,133,243,108,212,
-175, 95,127,137, 76, 38,227,214, 55,215,167,254,254,254,208,235,245,213, 78, 99,185,112,173,240, 71, 0, 63, 90,246, 61, 61, 61,
-243, 21, 10,133,203,138, 21, 43, 84, 75,150, 44,209, 80, 20,165, 3,112,178,180,180,212,234, 71,171,160,160, 64,193,225,112, 60,
-221,221,221, 3, 45, 66,171, 42, 45,242,146,161,122,139,150, 89, 73, 50,149, 5, 17, 65, 16, 79, 77, 80,175, 69,104,213, 42,178,
- 40,138,122,194,202, 96,153,240, 94,213,127,153, 27,245, 58, 13, 29,154, 69,150, 96,239,222,189,219,151, 47, 95,158,100,239,239,
-108,231,104,109,248,122,193, 50,139,200,186,113,238, 24,246,167, 41,138,103, 46, 89,249,109, 93,159, 64, 19,111, 97, 51, 63, 63,
-175,211, 95, 45,158, 47,185,119,100, 43,118,110,248,134,185,113,249,114,235,203,151, 47,191, 55,121,242,228,122,230, 23, 75, 6,
-224, 58,128, 65,176, 99,149, 78,110,110,110,143, 74,141,112, 58,151,203,245, 19, 10,133,200,205,205, 85,101,100,100, 56, 60, 36,
- 83, 92, 92,220,227, 5,188,128,108,139,200, 42, 46, 46, 70,106,106, 42,186,118,237, 10, 0, 56,123,246, 44,218,183,111,143,228,
-228,100,180,108,217,242, 42,128, 86,168,197, 81,171,209,104, 44,109,210,164,137,213,186,165, 80, 40,104, 0, 24,151,159,143,141,
- 82, 41,216,108, 54, 46, 46, 89,130, 57, 70, 35, 22, 57, 40,224, 99, 99, 99,153, 75,151, 46, 33, 51, 51, 19, 38,147, 9,125,251,
-246, 69, 29, 11,125, 76,100,100,228,241,147, 39, 79,250,184,186,186, 66,173, 86, 67,165, 82, 97,196,136, 17, 24, 60,120, 48,116,
- 58, 29,118,237,218,133, 3, 7, 14, 64, 44, 22, 67,173, 86, 67,173, 86,123,244,238,221,251,124,122,122,122, 39, 0,119,171, 17,
- 90, 76,143, 30, 61,144,152,152, 8, 22,139,133,214,173, 91,163,164,228,175,197, 64,126,126,126, 85,157, 99,253,147, 66,139,205,
-102, 51, 9, 9, 9,203, 58,119,238,140,236,236,236, 55, 90,182,108,249,253,200,145, 35,115,159,149,215,195, 77,140,216,168, 48,
-232,116, 58,232,116, 58, 4, 4, 4,160,172,172, 12,247,238,221,131, 78,167,131,159,175,187,195,124, 45, 98, 26, 89,249,124,125,
-125,161, 86,171,241,240,225, 67,232,245,122,120,123, 59, 36,180,130,123,244,232,113,234,151, 95,126,241,218,186,117,171,190, 75,
-151, 46,188,239,191,255,158,144, 72, 36,176,105, 88, 28, 69,194,217,179,103, 67,186,119,239,222,248,246,237,219, 72, 72, 72,128,
- 94,175, 71,139, 22, 45,144,145,145,129,182,109,219, 66,165, 82, 37, 93,190,124,249,128, 61,134, 97, 0,115,199,143, 31, 15,139,
-216, 74, 76, 76, 68,126,126, 62,196, 98,241, 83, 66,203, 50,247,209,188,106, 60,192,158,196, 90, 4,145,141,229,105,142,187,187,
-187, 1,192,183,117,180, 62, 1, 0,178,179,179,249, 77,155, 54,213, 9, 4, 2,158, 89,180,173,124, 22,190,231,137,231,176,146,
-177, 90,248,251,251, 79,243,246,246,238,222,160, 65, 3, 20, 22, 22,114,121, 60, 30,218,183,111,111,104,213,170,149,193,223,223,
-255,125,123,121,248,124,254,109, 46,151,219,169,162, 51, 65, 33, 43, 43, 11, 66,200, 69,216, 0, 0, 32, 0, 73, 68, 65, 84, 12,
-195,204,140,137,137,249,160,172,172, 12, 37, 37, 37, 60,137, 68, 98,237, 84, 55,110,220, 24, 58,157,238,182, 3,150,183,249,161,
-161,161,115,185, 92,238,162,226,226,226,170,220, 66,240,220,221,221, 37, 92, 46, 23, 6,131,225, 9,177, 89, 89,139,188,236, 34,
-235, 9,161,101,163, 34,159, 16, 58,142, 88,180,236,177, 26, 88, 38,216,219,238, 91, 68, 93,229,255,170,171, 15, 45, 55, 55, 55,
-157, 69,100, 45, 90,180, 40,169, 46, 28,187,127,249, 73,234, 70,151, 7,231, 37,253,129,244,155,201,216,151, 90, 90, 60,115,201,
-202,169,111,246, 31, 82, 88, 89,152,217,131,112, 31, 97,140,159,175,215,233,175,151, 47,145,200,110, 95, 68,126, 65, 1,254, 72,
-186,156,108, 0, 82, 1,204,124,158,166,101,160, 98,232,144,197, 98,253,155, 94, 88,235,100,248,252,252,124,139,200,106, 1, 0,
- 29, 58,116,184,106, 22, 89,176,215,162, 85, 90, 90, 90, 57,100, 77,119, 0,222,150,251,103,179,217,104, 63,119,174,195, 34, 11,
- 0,147,156,156, 12,153, 76,102,233, 41,214, 85,100,193,223,223,255,163,147, 39, 79,250,108,217,178, 69,185,109,219,182, 18,154,
-166, 57,177,177,177, 65,175,188,242, 10,177,125,251,118, 0,192,160, 65,131, 48,115,230, 76,220,186,117, 11, 34,145, 8, 29, 58,
-116,160,230,205,155,231, 59,109,218,180,247, 11, 11, 11,167, 86,217, 58,210, 52, 87, 32, 16,156, 0,240,234,237,219,183, 1,224,
- 60, 42, 66, 56, 89,172, 8,213,158,179,167,241, 45, 43, 43,227,136,197,226, 42, 93, 67,112, 43,122, 67,142, 90, 32,172,156,231,
-206,157, 91,250,245,215, 95,239,251,240,195, 15,239, 62, 35,103,149, 22,173, 62,125,250, 64,163, 51, 32,167, 80, 1,138, 50, 65,
- 99, 40,114,152,207,214,162,213,167, 79, 31,148,107,245,200,202,151,193,100,162, 80,166,177,187, 45, 23,190,246,218,107, 71,119,
-236,216,225,127,225,194, 5, 80, 20, 69,103,100,100, 60,124,231,157,119, 36, 31,127,252,177,215, 51, 44, 50, 90, 53,100,200,144,
- 1,231,206,157,147, 53,110,220,216, 51, 41, 41, 9, 69, 69, 69, 48,153, 76,120,245,213, 87,193,227,241,178,150, 44, 89,194, 5,
-176,202,222,103, 99, 22, 91,134,203,151, 47,143,189,120,241,162,167,167,167, 39,143,142,140, 68,254,177, 99,216,179,103,207, 83,
- 63,216,176, 97, 3, 96,167, 23,126,139,197,233,210,165, 75,207, 69, 96, 61,209, 82,243,120,117, 30,126,124, 89,113,233,210,165,
-220, 73,147, 38, 69, 73, 36,146,111, 59,118,236,216,213,203,203,139,244,240,240, 72, 8, 12, 12,252, 32, 54, 54,214,238,209, 5,
- 14,135, 51, 82, 36, 18,221, 51,153, 76, 44,149, 74, 5,181, 90, 93, 81, 73,155, 76, 60,146, 36, 81,191,126,125,107, 91,210,186,
-117,107,248,251,251, 83,105,105,105, 35,237,229,127,252,248,241, 19,171, 16,171,192,248,246,237,219,179,117, 58, 29, 50, 51, 51,
-207,218,158,168, 74,139,188, 36, 24, 87,163,248,178,220,148,237,205, 5, 6, 6,102, 27,141, 70, 38, 21, 96,174, 95,191,206,140,
- 27, 55,174,198, 77,171,213, 50,190,190,190,249, 85, 52,126,176,229,212,233,116, 79,252, 78,167,211, 49,126,126,126,148, 70,163,
-121,138, 83,163,209, 48, 65, 65, 65,185, 53,113, 86,129, 17,215,174, 93, 91, 55,103,206,156, 56, 7, 50,200,202,201,172,143,100,
-182,110,221,250, 63,134, 97, 58,119,140, 10,185, 57, 48,214,143,105, 31,238,155,119, 96,247, 47,131, 25,134,233, 92,121,179, 56,
- 56,173,137, 51,210, 79,212,164, 91,116, 61,249,141, 35,191, 50, 39, 87, 76, 97,190,238, 27,206,180, 12, 18,151, 70,122,187, 56,
- 26, 35,166,214,104,233,209,209,209,233, 52, 77, 51,122,189,158,137,142,142,206,120, 30,156,117, 64, 77,156,205, 81, 49,151,109,
- 72, 21,199,154, 63, 67, 58,111, 48, 12,195,200,100, 50, 70,165, 82, 49, 58,157,142,161, 40,138,177, 5,128, 27,118,112, 50, 6,
-131,129,145,203,229, 12,236,159,115, 87, 37,167, 84, 42,125,120,255,254,125,166, 97,195,134,217,102,115,252, 52,181, 90,205, 84,
-134, 90,173,102,186,118,237,202,100,100,100, 48,161,161,161,218,140,140, 12, 70, 42,149,222,169, 37,157, 13,130,131,131, 79,120,
-123,123, 39, 0, 8,119,224, 92,141,249,185,107,215,174, 48,134, 97,198, 48, 12, 51,174,154,109, 12,195, 48,145,255, 52,167, 57,
-127, 11, 25,134, 97,202,203,203, 25,153, 76,198,228,229,229, 49,229,229,229,140, 74,165, 98,174, 93,187,198, 92,184,112,129,185,
-121,243, 38,227,233,233, 89,104, 15,167,133, 79,175,215, 51, 74,165,146, 41, 42, 42, 98, 52, 26, 13,163, 86,171,153,148,148, 20,
-230,202,149, 43,204,237,219,183,171,226,123,138,211,203,203,107, 67, 65, 65,129,234,252,249,243,229,235,215,175, 47,247,247,247,
-191, 13, 32, 4, 64,132,135,135, 71,193,148, 41, 83, 24, 87, 87,215, 71,117, 44, 71, 81, 28, 14,231,218,178,101,203, 46,197,199,
-199, 23, 30, 56,112, 64,191,121,243,230,156,201,147, 39,159, 97,179,217,215, 0, 68,213,177, 28,249,186,187,187,159, 79, 74, 74,
- 50,201,229,114,166,180,180,148, 81, 42,149,140, 90,173,102, 52, 26, 13,163,215,235, 25,163,209,200,156, 57,115,134,241,243,243,
-179, 29,150,252,164,134,142,245,116,134, 97, 62, 98, 24,134,253,188,235, 58, 27,238,142,207,139,243,121,212,117, 36, 73, 26,204,
-117, 71,155,138,221,154,247,255,169,116,118,235,214,237,139,193,131, 7, 51, 61,123,246,100, 90,180,104,241,212,214,178,101, 75,
-102,226,196,137, 76,124,124, 60,243,213, 87, 95,125,241, 28,210,201, 70,197,162,151,197,221,186,117, 51, 38, 38, 38, 50,131, 6,
- 13, 98, 0,244,168, 73,139,252, 23, 4,151,197,189, 3, 97,251, 9, 0, 6,131, 33, 59, 61, 61, 93,218,216,100, 98, 1,192,154,
- 53,107,158,178, 76,217, 34, 49, 49,209, 68, 16,196,189,154,254,221, 96, 48,100,159, 60,121,210,111,245,234,213, 28, 27, 19, 48,
- 76, 38, 19,157,151,151, 71,126,255,253,247, 79, 92,127,250,244,105,147,201,100,202,114,240, 38,183, 54,111,222,124,235,243,200,
-173, 51,183, 50, 63, 56,250,199,239,222,109,226, 58,150, 74, 60, 61,171,236,133,237,122, 63, 18,196,132,154,173, 90, 4,155, 92,
-180,108,241,124,119,203, 16,228,111, 87, 11, 74,181, 58,170,107, 90,177,230,198,243,126,194, 42,149, 42,211,178, 18, 80,173, 86,
-103,253, 11, 95,194,107,168,240,113,101,170,116,172, 21,158,113,210, 41, 77,211,112,115,115,179, 90, 67,235, 96, 17,101, 44, 22,
- 86,203,163,123,150,244, 48, 12,115, 46, 37, 37, 37,116,196,136, 17,226,109,219,182,221,167, 40,138, 51,122,244,104,131,191,191,
- 63,247,236,217,179, 70, 0, 68,231,206,157,217, 5, 5, 5, 76,110,110,174,236,173,183,222, 42, 27, 59,118,172,215,245,235,215,
-121, 52, 77,215,230,180,240, 65,118,118,118,183, 58,156,171, 17, 3, 7, 14,188,143,103, 15, 99,243,194, 57, 45,144,149, 42,113,
- 63, 51,215,236,193,156, 6,245,168,208, 58,175,202,104, 52, 65,166, 44,113,216,162,117,239, 97,174, 57,196, 24, 5,138,202, 51,
-243, 85, 76,136,103,228,229,181,183, 38,108,118,135,121,243,230,245, 34, 73,146,188,120,241,162,110,249,242,229,217,143, 31, 63,
-238, 11, 32, 11, 0,228,114,121,151,173, 91,183,254,108,135, 43,135,234,144,106, 52, 26,219,126,242,201, 39, 83, 1,116, 0, 80,
-207,204,125,214,108,201,170,171, 7,243,162,210,210,210,215,123,245,234,117,140,197, 98,213,183, 41, 71,222, 0,138, 45,229,130,
- 97, 24,223,194,194,194, 55,236, 33, 36, 8, 98,229,139,170, 72, 94, 36,247, 51,214, 67, 47,197, 74,198, 19, 39, 78,124,217,183,
-111, 95,118, 72, 72,200,236,144,144, 16, 82, 46,151, 67,165, 82,129, 36, 73,248,251,251, 35, 58, 58, 26,254,254,254,244,237,219,
-183, 23,207,154, 53,171, 86,159,124, 77,154, 52, 9, 51, 26,141, 13, 73,146, 12, 3, 16,198, 48, 76, 24, 65, 16, 97, 0, 60, 1,
- 64, 34,145, 72, 66, 67, 67,217,109,218,180, 65, 92, 92, 28, 78,159, 62,141,221,187,119,255, 8,224,168,173, 53,171,178, 22,249,
- 55, 32,181, 57,152,168,107, 32,110,181, 68,103,130,198,105,134, 68,151,232,100,171,159,189,202, 34,171,250,160,210, 85,152,254,
-122,188,250,234,171,214, 2,103, 71,163,146, 89, 91,225,123,252,248,113,143,145, 35, 71, 62,193, 73, 81,148,174,164,164,100, 82,
-187,118,237,214,178, 88, 44,126,165, 23,246, 81, 81, 81,209,223, 26,171,175,178, 31,173, 30,189,222, 46,126, 86, 78, 87, 46,217,
- 48,253,208, 15, 40, 44, 42,198,111, 87, 11,228,101,122,170, 75, 70,113,121,202,139, 72,255,163, 71,143,122,190, 4,138,191, 42,
-209,250,172,193,179, 31,219,225,144,180,182, 24,117,132,217,157,200,115, 41,228, 5, 5, 5, 43,230,206,157,251,250,226,197,139,
-125, 14, 31, 62, 44,177,116, 80,250,245,235, 87,148,146,146,210, 17, 0, 95,171,213, 30, 95,188,120,177,207,252,249,243,189, 0,
-120, 1, 64,239,222,189, 11, 11, 11, 11, 87,195,137, 26, 97, 52, 26,115,162,155, 52,182,118,252,108, 93, 58,216,126, 55,153, 76,
- 57,142,240, 85,197, 99,187, 79, 81, 84,141,124, 44, 22,235,195,184,184, 56,214,135, 31,126, 88,120,248,240, 97, 75, 32, 93, 91,
-133,150, 94,139, 83, 82,123,160, 3,176,220,188, 61, 79,168,101, 50, 89, 91, 7,127, 67, 57,223,198, 42, 59,148,142,236,255, 35,
-216,191,127,255,103,131, 6, 13,218,234,233,233,249, 83, 88, 88, 88, 99, 63, 63, 63,137,139,139, 11,116, 58, 93,153, 94,175,191,
-147,158,158, 62,244,179,207, 62,123, 96,151,133, 99,235, 86, 22, 0, 46, 77,211, 2,146, 36, 69, 0, 36, 4, 65,120, 88,132, 22,
- 65, 16, 48, 24, 12,200,204,204,196,156, 57,115,168, 19, 39, 78,124, 5,224, 11, 7, 58,174,173, 0,248,216,212,227, 62, 0,244,
-168,112, 96,251,152, 32,136,203, 47, 58,191, 8, 26,167,163,174,129, 72,109,142,170,218,137,154,131, 74, 87, 87,224, 30, 63,126,
-220,246,121, 23,226,234, 56, 31, 63,126, 28,242,111, 41, 33,195,117,203,127,197,134,229, 79,196, 57,180,136,176,170,246,107,131,
- 66, 99,154,188,234,232,173, 21, 58, 19, 67, 27, 76,244,168,140,199,229,169,206,122,232,185,227,181,231, 85,150,158, 99,154, 82,
-210,210,210,218, 77,158, 60,249, 51,161, 80,216, 26, 0,202,203,203, 47,230,229,229, 45,128,121, 85, 97,109,231,157,168, 30,197,
-197,197,175,252, 27,249,244,122,253, 7,237,218,181,251,142,162,168,175, 77, 38,211,217,255, 7,143, 66,235,124, 27, 95, 94,236,
-220,185,243, 1,128,182, 0, 48, 96,192, 0, 22, 0,236,222,189,219, 97,241, 60, 98,196, 8,138, 97, 24,131,249,125, 80,163, 98,
-117,161,220, 82,167,170,213,106,121, 94, 94,222,109,138,162,110, 3,248, 25,142,175,184,245, 33, 8, 34,158, 97,152, 62,102,225,
- 22,207, 48, 76, 31,219, 99, 47,218,170, 85,203, 37,181, 79,134,119,162, 2,187, 83, 65, 84, 30, 10,172,109,191, 54,164, 23,170,
- 19, 0,180,116,230,238,255, 75,220,207,203,203, 27,254, 12,231,157,120,249,144,165,215,235,251,254, 63,186, 95,133,243,145,255,
- 71,218,191, 58, 8, 44, 11,110,223,190,253,194,166, 8,252,211,136,186,246,100, 7,188,242,190, 13,198, 85, 37,188,156, 66,203,
- 9, 39,156,112,194,137,103, 65,169, 51, 11,156,248, 47,195, 50, 55,203,178, 95,205, 28,173,202,243,179,172,251, 4,170, 95, 57,
-224, 72, 84,242,186,172,146, 56,238,228,116,114, 58, 57,157,156, 78,206,127,156,211, 29, 64, 40,128,101,181, 92, 87,121,117, 97,
- 33,128, 98, 0, 70,103,126, 58, 57,159, 65, 63,216, 5,134, 97,122,215, 52,116, 72, 16,196,161, 23, 37,180,172,147,225,155, 99,
- 94,244, 53,204,179,236,219, 43,180, 94, 52,186, 59, 57,157,156, 78, 78, 39,167,147,211,201,233,228,116,114, 62,163,208,234, 58,
-107,214,172, 79, 81,225, 26,131,153, 53,107,214,167, 12,195,244,174, 56,197,244,126,145,255,125,171, 37, 58,167, 54, 7, 99,217,
-110,181, 68,231,106, 46, 29,103,179, 89,225, 28, 58,116,194, 9, 39,156,112,194, 9, 39,254,237, 56,191,100,201,146,242, 37, 75,
-150, 88, 38,190, 63, 6, 64,152, 45, 92,143, 95,228, 31,155,135, 9,237, 89, 40, 85,115, 8,158,127, 0, 1, 36,155, 59,140,195,
-229,119, 5, 67, 71, 3, 0, 72,214, 45, 74,175, 61,101, 50, 25,126, 2,144, 87, 87,226, 72,160, 73, 35,119,151, 3, 58,138,226,
-102,151,233, 7,164, 85,132, 57,112, 24, 3,128,246,124, 30,239, 79,190,187,187, 75, 85,231,117,165,165, 26,157, 94,255,250,110,
-224,156,179, 12, 56,225,132, 19, 78, 56,241,146, 64,228,225,225,113,130, 36,201, 16,203, 1, 91,191,131,149,125, 16, 82, 20,149,
- 47,147,201, 94, 71,197, 80,241,223,201,105,251,123, 61,234,216,150, 63,111, 56, 58,116,200, 6,158,240,194,250,183, 68,204,102,
-113,248, 99,197,110,238,139,254, 55,242, 3,175,240,136,198, 68,112,112, 32,192, 0, 89,217, 57,126,247,238,102,116,219,185,109,
-213, 12,165, 66, 54,199,168,211,253,224, 40,119, 19, 64, 84,207,149,127,246,135, 89,239,186,179, 97,194,144,133,191, 28, 33, 84,
-134,224,219, 21,203, 77, 29, 18, 89,238, 94, 94, 71,151, 28, 63,238,226,209,172,217, 19,231, 24,134,169,136,175,119,227,134,203,
-236,215, 95, 63, 58, 64, 38,235,225, 20, 91,255, 73,248, 75, 36,146,105, 28, 14,167,139,193, 96, 8,225,241,120,217, 20, 69, 37,
-200,229,242,111, 1,228, 58,179,231,191,141,198,254,162,142,141,195, 66,126,201, 43, 40,188,170,212,234, 71,167,231,169,100,206,
- 92,113, 24, 53,197,215,252,199, 98,111, 2,128,171,171,235, 21,146, 36,131,108, 69,128, 37,102,175,101,191,242, 39, 77,211, 15,
-100, 50, 89,187, 26,104,195, 60, 61, 61,215, 2,104, 85,155,195,100,179,111,182,203, 50,153,108, 18,170, 95,173, 39,246,240,240,
-248,146, 32,136,129, 36, 73,178,106,187, 39,154,166, 41,134, 97,118,201,229,242, 47, 0,148, 85,119,157,135,135,199,241,180,180,
-180, 86,190,190,190,181, 90,105, 76, 38, 19,178,178,178,124, 90,183,110,125, 70, 38,147, 69,190, 72,206,191, 91,139,212, 21, 53,
-172, 58,172,246, 69, 7,240, 68,124,161, 23,234,145,149, 43,112, 61,208,182, 83,143,174, 19,167,126, 40,186,150,114, 7,127,158,
-190, 0,165, 90, 7, 22, 73,194, 93, 44, 68, 68, 68, 67, 98,229,198, 61,222, 63,174, 95,249,245,197,196, 99,189,181,106,197, 91,
- 14,201,116, 33,123,206,204,119, 90,139,188, 60, 41,128,166,240, 81,175, 88,209,236,248,171,115, 80,110,250,212, 97,145,117,226,
-132,176,168,176, 16,243, 3, 2,192, 54,153, 32, 32, 73, 8, 8, 2, 2,146,132, 72, 32, 64,207,205,155,177,224,240, 97,225,103,
-111,188,225, 20, 91,255, 49,184,186,186,142, 12, 8, 8, 88,190,105,211, 38,175, 6, 13, 26, 64, 36, 18, 65, 38,147,121,167,167,
-167, 55,159, 62,125,250,240,252,252,252,185, 74,165,114,131, 51,167,254,187,160,105, 12,219,178,104, 82, 96,254,163,187,129,227,
- 23,255, 26, 65,120, 81, 93,238,148,104, 10,156, 57, 99, 55,154, 3,184,138,170,227,151,214,116,174, 90, 8, 4,130, 66,173, 86,
-235, 91,211, 53, 60, 30,175, 72,175,215,251,213,198, 69,146,100, 80,110,110,174,175, 80, 40, 4, 69, 81,230,104, 0,180,181, 35,
-109, 27,253,196,236,168, 22,145,145,145,134,154, 56,197, 98,241,154,162,162,162,238,150, 56,129, 54,130,170, 74,228,230,230,118,
-143,138,138, 90, 83, 86, 86,246,122, 53,226,229,203,169, 83,167, 78,139,137,137,177, 88,129,204, 81, 16, 42, 62,139,139,139, 49,
-121,242,100,235,127,208, 52,141, 99,199,142, 77, 29, 57,114, 36,228,114,249,244, 26,238, 61,196,215,215,151, 48, 7, 20,175, 22,
-243,230,205,195,188,121,243,176,106,213, 42,130,195,225,184,215,146,159,207,133,243,239,210, 34,117,177, 96,213,226, 25,254, 16,
-158,156,155,117,232, 41,161,245,119,128,197,225,143,106,213,174,123,151,201,211,102,138,126,253,253, 36,210,111,223, 64,218,217,
- 29, 79, 92,243,202,235, 35, 81, 80, 92,134,145, 19, 63,114, 37, 88,236, 46,137,199,247,143, 50,234, 52, 91,236,180,102,249,133,
-240,121, 83,218,180,142,230,228,186,164,195,223,195, 5, 29, 90, 54,226, 4, 31,189, 57, 69, 13,211,119,183, 43, 86,201, 56, 36,
-178, 54,189,251, 46, 58, 26,141,240,101,177,192, 34, 8,176, 0,144, 4, 1,173, 78,135,203,195,134,161,245,246,237,248,226,224,
- 65,225,151,111,190,233,144,216, 18,137, 68,215, 8,130,240, 80,169, 84,189, 81, 17, 88,250,101, 64,148,171,171,235, 33,134, 97,
-228,106,181,186,249,191, 40, 93, 82, 84,140,209, 87,238, 29,115, 81,177,162,202,161,200,194,124, 62,127,236,128, 1, 3, 86,174,
- 94,189, 90, 88, 88, 88,136,188,188, 60, 80, 20, 5,129, 64,128,240,240,112,226,248,241,227, 94, 51,103,206, 92,113,232,208, 33,
-126, 89, 89,217,119,142,116,108, 56, 28,206, 70, 79, 79,207, 55,252,252,252, 68, 69, 69, 69,229,165,165,165,199,116, 58,221, 88,
-212, 61,108, 10,201,225,112,134,134,134,134,190, 29, 16, 16,224,151,155,155, 91,156,147,147,115, 64,167,211,253,136, 58, 6,106,
-182,201,211,102, 48,123,171, 7,144, 31, 26, 26,122, 43, 51, 51,179,232, 57,114,230,133,134,134,166,214,129, 83, 4, 96, 39,128,
-128, 90,174,203, 3, 48, 8, 14, 90,179,173, 25,203,208,127, 44,252,118,211,232,249, 35, 58, 16, 91,166,119, 15,159,176,234,248,
- 5,146,203,116,186,157,175,205,118,106, 40,251, 68,150, 57,164, 85,101, 65, 85,211,185, 26,161,211,233,124, 12, 6, 3, 56,213,
- 4,139, 87,171,213, 16,139,197, 62,246, 38,210,197,197, 5, 59,118,236, 0,135,195, 1,135,195,129, 92, 46, 71, 80, 80,144,117,
-159,203,229, 90,191,215,171, 87,175, 86, 62,138,162, 90,179, 88, 44,168, 84, 42, 80, 20,101,221, 74, 75, 75,193, 48, 12,248,124,
- 62, 40,170, 34,156,147,205,249,214,213,241, 17, 4, 49, 48, 32, 32, 0,191,254,250, 43,244,122,253, 83,231, 37, 18, 9, 82, 82,
-254, 10, 50,194, 98,177, 16, 23, 23, 71, 18, 4, 49, 16,192,244, 26,120, 25, 0, 24, 55,110, 28, 88, 44, 22, 88, 44, 22, 72,146,
-180,126,183,108, 20, 69, 97,222,188,121,168, 20,154,236,111,227,252,183,161, 22,207,240,249,168,102,142, 22,249,130,211,101,187,
-196, 51, 64, 40,146, 44,157,244,193, 71,174,135,206,220, 68, 86,118,214, 83, 34, 11, 0,174,252,249, 35,242,243,114,113, 53, 45,
- 7, 67, 71,189,239, 42,145,184, 47,173, 84,161, 86,187,108,212, 77,204,253,106,214,160, 14, 2,149, 49, 15,101, 30, 0, 43,140,
- 7,142, 80,141,153,125,154,241, 37, 98,238,114,123,210,201,231,241,254, 92,114,252,184, 85,100,181,215,233,192,167, 40,152, 40,
-202, 42,178,244, 38, 19, 52,122, 61,164, 42, 21,238,141, 28, 9,198,104,196,220,125,251,132,124, 30,239, 79,123,210, 9, 0, 92,
- 46, 87,122,224,192,129,122, 77,155, 54, 61, 13,251,157,153, 30,127,193,207,168, 38,180,140,141,141, 77,216,190,125,123, 61, 46,
-151, 43,125, 30,156, 2,129,160,191, 72, 36,122, 44, 16, 8,250,215, 49,157, 36,128,133,163, 71,143, 78,110,216,176,225, 73,179,
-176,178,138,154,134, 13, 27, 30, 31, 61,122,244, 53, 0,243,170,121,215,171,226, 12, 12, 8, 8, 88,180,122,245,106, 97, 70, 70,
- 6,114,115,115, 97, 52, 26, 49,100,200, 16, 80, 20, 5,141, 70, 3,189, 94,143,101,203,150,137,188,188,188,230,160, 34, 80,176,
- 61,247,206,117,115,115,203,216,182,109,219,128,135, 15, 31,186,158, 60,121,146, 72, 73, 73, 17,173, 88,177,162,175,151,151, 87,
- 58, 0,126, 29,242,147,148, 74,165, 91,246,239,223, 63, 41, 37, 37, 37,104,239,222,189,156,139, 23, 47, 74,215,175, 95, 63, 70,
- 42,149,110, 7,192,170,227, 51,106, 46, 20, 10,187,125,252,241,199,244,249,243,231,115,207,159, 63,159,187,114,229, 74,116,236,
-216,177,253,252,249,243, 91,212,145,179,165, 88, 44,126,245,227,143, 63,166, 19, 19, 19,243,146,146,146,114, 86,172, 88, 65,190,
-250,234,171, 29, 22, 45, 90,212,204, 65,206,157,231,207,159,239,156,157,157,221, 32, 39, 39,167,126, 78, 78, 78,104, 78, 78, 78,
-104,110,110,110, 72,126,126,126,189,130,130,130,224,162,162,162,224,132,132,132, 14, 0,126,177,135,179,177,159,104,210,244, 33,
-221,203,231,140,234,197,124,250,222,107,204,204, 33,157,153, 55, 58, 53,253,157,197,102, 19, 73,169, 89, 8,114, 3,126,156,220,
- 42, 36,216, 91,148, 18,237,233, 26,241, 47, 43,155,255, 54, 78,182, 69, 72,201,100, 50, 28, 58,116, 8,102,235, 85,115, 91,145,
-165, 84, 42,145,159,159,111, 57,199,182, 39,157, 18,137,228,196,166, 77,155, 24,173, 86, 11,133, 66,129,162,162, 34,100,103,103,
-227,222,189,123, 40, 41, 41,193,157, 59,119, 32, 20, 10, 79,216,147, 78,130, 32, 64, 81,148, 85, 72, 29, 59,118, 12,163, 71,143,
-134, 76, 38,179, 30, 99,179,217,214,239,150,223,212,198,105,177, 60, 81, 20,133,164,164, 36,140, 31, 63, 30, 43, 87,174,196, 47,
-191,252,130,248,248,120,200,100, 50,171,216, 50,153, 76,181,114, 22, 23, 23,131,166,237,235, 51, 49, 12, 3,133, 66, 97,247,115,
-183, 21, 64,108, 54,251, 41, 81,100,217, 28,121,151,158,145,243, 95, 11, 59, 60,195, 87,223,195,182,124, 49,155,234,186,188,168,
- 68,146,108,238,208,129, 35,166,122,229, 20, 41,145, 91,168, 0,139,252,171,221,107,209,125, 4,216, 44, 18,151,142, 86, 24,174,
- 72, 22, 11, 10,181, 14,165, 42, 3, 6,140,152,230,249,195,202,207,135,154, 12,218, 26,125,188,196, 0,225,209,174,174,239, 68,
- 69,213, 35,111,243,211,208,226,141,179,160,104,128, 73,124, 19,205,229,190,172,200, 63,121,239,168,203, 12,139, 82,128,140, 26,
-173, 25,238,238, 46, 30,205,154, 97,126, 64, 0, 58, 25,141,224, 50, 12, 94, 43, 44,196,141,105,211,160,219,179, 7, 36, 0,110,
-255,254,232,250,237,183, 56, 19, 16, 0,127,141, 6,165, 51,102,192,231,200, 17,112, 37, 18, 23, 60,182,111,241, 3, 65, 16,232,
-210,165, 11,142, 31, 63,238,213,179,103,207,163, 55,111,222,236,103, 50,153,206,212, 37,111,221,220,220,174,176,217,236,160,218,
-174, 51,153, 76, 57, 10,133,194,225, 48, 35,108, 54,187, 83, 92, 92,220,190,189,123,247,122, 24, 12,134,231,210, 11,225,241,120,
- 61,251,246,237,187,105,221,186,117,146, 49, 99,198,108,138,143,143, 47,215,235,245, 71, 28,121,165, 0, 44,220,176, 97,195,132,
-113,227,198,185,143, 25, 51,134,185,119,239,158,173,245,202,167, 99,199,142, 13, 55,109,218,228,223,170, 85,171,169,227,199,143,
-231, 2,152, 91,155,149,199,213,213,117,226,166, 77,155,188,139,139,139,161, 82,169,172,149,108, 78, 78, 14, 92, 92, 92, 64,146,
- 36, 72,146, 4,135,195,193,210,165, 75,189, 38, 78,156, 56, 77, 38,147, 77,179,195, 74,182,113,237,218,181, 62,175,191,254, 58,
-249,240,225, 67,144, 36, 9,129, 64,128,119,223,125,151,212,104, 52, 30,243,231,207,223,170, 86,171, 7, 59,146,135, 28, 14,103,
-232,198,141, 27, 35,218,183,111,207, 78, 75, 75, 67,219,182,109,113,233,210, 37,244,239,223,159, 83, 86, 86, 86,127,230,204,153,
-163,117, 58,157,163,126, 92,164, 66,161, 48,230,212,169, 83,217,193,193,193,214,138,165,126,253,250, 84,239,222,189,101,105,105,
-105,141,207,159, 63, 95,210,174, 93, 59, 71, 2,150, 7, 10,133,194,200, 63,254,248, 35,127,254,252,249,221, 54,108,216,208, 23,
- 0, 90,183,110,125, 96,193,130, 5, 39,101, 50, 89,244,153, 51,103,100,157, 58,117,202,177,147, 47, 64, 42,149, 82,147, 39, 79,
-118,173,233,162,205,155, 55,151,162, 34,224,114, 3, 0, 53,198,107,107, 28,234, 63,103,249,180,129, 46,160, 12, 96,140, 26,192,
- 80, 14, 24, 84,160,245,229, 32,184, 46,128, 81, 3, 31,190, 12, 59, 39, 54,150,124,242,235,253,219,212, 29,162,119, 90,113,217,
- 17, 56, 81,101, 85, 3,160, 5, 65, 16, 87, 15, 29, 58,132,184,184, 56, 28, 58,116, 8,189,123,247,190,106, 43, 6, 82, 82, 82,
-208,169, 83, 39,152, 45, 90,118,205,213, 82, 40, 20,179,230,205,155,151, 56,116,232, 80,225, 19,149, 1, 73,194,221,221, 29,189,
-122,245,210,170,213,234, 89,246, 38,148,162, 40,176,217,108,228,228,228, 96,243,230,205, 88,188,120, 49,194,195,195, 97, 52, 26,
-159, 18, 91,230,122,207,174,202,207,100, 50,225,242,229,203,248,105,251,118,204,157, 51, 7, 98,177, 24, 0, 96, 48, 24, 32,147,
-203, 33, 16, 8,172, 98,172, 22,225,180,235,238,221,255,107,239,218,195,154,186,178,253,111,159,115,242,132, 64, 32, 16, 16, 4,
-100,116,172,180, 87,171,131,232,197,199,248,168,212, 50, 90, 71,107,125,116, 20,116, 70,138,218,250,205,168,157,142, 95,191, 78,
- 91, 95, 51, 78,123,117,208,218,218,150,145,106,107,181, 29,139,218, 58, 85,219,218, 14, 62,166,222,170, 80, 91,161,248,192, 7,
-162, 16, 72, 8,132, 16, 66,158,231,220, 63,200,137, 1, 9, 36,112,162,216,203,250,190,243,145,199,225,151,181, 95,103,255,246,
- 90,107,175,125,121,121, 92, 92, 92, 43,151, 33,255,215,245,204, 2,203,178,112, 56, 28,104,110,110, 70, 78, 78,142,131,227,184,
-189,157,205, 63, 60, 41, 90,190,124, 57, 44,150,219, 6,245,161,174,152,228,196,196, 68, 12, 27, 54,204,253,158,162, 40,206, 87,
-204,127,140, 30, 2,179,199,221, 73,171, 55, 2, 0,226,226,226,144,148,148,132,152,152, 24,175,152,129,230, 34, 93, 17, 63, 50,
-195,123, 39, 90,119,227,164,108,145, 88, 54,113,192,192, 65,228, 70,149, 30, 12,195, 32, 88, 25,137,209, 51, 86,128,166, 41, 40,
-194, 34, 65,156,230,219,140,152,162,193,208, 12,244, 70, 51, 18,251, 15,164,164, 50,249, 68, 83, 39, 68, 43, 84, 41,218,246,252,
-220,209,178, 90,199, 77,200, 19,100,112,242,211,105,172, 4, 84,132, 17,207,165, 63, 32,207,254,244,135,109, 48,216, 31,241, 69,
- 95,218,225, 64, 20, 77,195,198,113,248,126,249,114, 36,231,230,162,136, 39,134,185,185, 40,202,206,134, 74, 36,130,148,162,192,
-217,237,119,248,244,125, 33, 90, 0, 80, 81, 81,129,252,252,124,213,236,217,179,247,159, 63,127,126,190,159,100,131,199,138,252,
-246,219,111,163,250,247,239,239,245,158,171, 87,175, 34, 37, 37,197,111,247,148, 68, 34, 73,127,228,145, 71,246,228,231,231, 43,
- 75, 74, 74, 16, 21, 21,213,109,162, 37,149, 74,199,165,165,165,237,121,239,189,247, 66,181, 90, 45,114,115,115, 67,167, 77,155,
-182,187,176,176,112,134,197, 98,241,133,108,182, 34, 89,185,185,185,245,121,121,121,255, 64,107, 23, 97, 85, 94, 94,222,187, 35,
- 70,140,120, 38, 59, 59, 59, 12,192, 18, 87,236, 64,135,100, 75, 42,149, 78, 24, 48, 96, 64,171, 85,173, 84,218, 98,108, 10, 14,
- 14,134, 82,169,132, 88, 44,134,197, 98, 65,114,114, 50,145, 72, 36, 99,125, 41,115, 72, 72, 72,218, 19, 79, 60, 65,157, 60,121,
- 18, 26,141, 6, 97, 97, 97, 80, 40, 20,112, 58,157,200,202,202,162,115,114,114, 38,152, 76,254,121,184,226,227,227,167, 79,154,
- 52,137, 41, 46, 46,198,181,107,215, 96,177, 88,112,241,226, 69,132,134,134, 34, 51, 51, 83,252,218,107,175, 77,187,117,235,150,
-191, 68,107, 72,118,118,118,181, 39,201,226, 37, 56, 56,152, 12, 26, 52, 72, 31, 17, 17, 49, 28,128, 63, 68,107,200,178,101,203,
-106, 54,108,216, 48,238,232,209,163,238,164,151, 71,143, 30,253, 19, 0,108,217,178,229,132, 90,173, 30, 14,192, 87,162, 5,142,
-227,216,167,158,122,170, 92, 34,145, 64, 36, 18, 65, 34,145,180,186,196, 98, 49, 40,138, 10,225,135,115,103,120, 63, 94,211,188,
-154,245,167,141, 27,131,101,180,232, 15, 51, 30, 70, 66,152, 24,144,171, 32, 30,183, 10, 36,172,197,104,201,233,175, 2, 95,172,
-194,166, 39,244, 84,246, 7,205, 7,108,206,112,245,149,186, 58,227, 61,158, 3, 70, 0,248, 59, 90, 14,215,125, 17,192,183, 61,
-100,110,250, 14, 64,242,212,169, 83,221,100,235,240,225,195, 72, 79, 79, 71,125,125, 61,138,139,139, 61, 73,150, 63, 7, 44,127,
-103,183,219,207,125,248,225,135,163,103,207,158, 77, 60,198, 23, 74, 74, 74,112,225,194,133, 34, 95,241, 40,138, 2,203,178, 16,
-137, 68,216,184,113, 35,108, 54, 27, 62,248,224, 3,124,252,241,199,160, 40, 10,132, 16, 16, 66, 16, 26, 26,138,215, 95,127,221,
-175,231,158,211,233,196,206,157, 59,177,234, 79,127,114,147, 44,151, 39, 3,125,162,163, 17, 17, 25,137, 43, 87,174,116, 74,180,
-234,234,234, 94, 57,120,240, 32, 58, 10,134, 63,120,240,160,251,117,155, 96,248,206,231, 57,154,134,197, 98,193,163,143,222, 62,
- 42,118,217,178,101,238,215,122,189, 30, 52, 77,243,117, 65,124,197, 52,115,192, 12,217,237,207,166, 60,247, 92, 43, 11,157, 55,
-204,187,193, 69,132,178,110,181, 67,182,146, 93,214,217, 24, 0, 83,209, 18,163, 85, 5,220,197, 24, 45,142, 99, 31,140,235, 27,
-139,115,101,231,193,208, 52, 36,202, 72, 40, 85,209, 96, 29, 86, 24,106,174,161, 96,223,155, 0,128,119,118,238, 5, 69, 81, 96,
- 24, 26, 22,171, 19, 15, 36,196,130,101,217, 7, 59,194,126, 8, 24, 61, 33, 58,242,191,227,251,133,145,226,240,107, 24, 20, 21,
-209,198, 17, 34,197, 3,149, 10, 50, 74, 33, 31, 89,103,104, 24,253, 35,240, 77,167,100,128,162, 64, 17,130, 32,177, 24,150,252,
-252,150,168,205,220,150, 57,171, 40, 59, 27,212,129, 3, 8,145, 74, 65, 19, 2,198,101,130,238,138, 52, 52, 52,128, 16,130, 93,
-187,118,133,103,102,102,238, 46, 46, 46,206,110,110,110,206,247, 7,163,190,190,126,234,152, 49, 99,190,222,185,115,167,186, 79,
-159, 62,119,124,175,209,104,176,112,225, 66,109,125,125,189, 95, 73,221,100, 50,217,147,211,167, 79,223,190, 99,199,142,208,203,
-151, 47,163,177,177, 17,106,181,186,187, 93, 97,120,106,106,234,254,252,252,124,165, 70,163,129,193, 96,128,197, 98,193,174, 93,
-187,194,166, 76,153,146, 95, 90, 90,154, 14,160,176, 19,140,151, 60, 73,214,226,197,139,127, 0, 16, 5, 96, 91, 91, 14,234,250,
-238, 97, 15,178,101, 0,240, 90, 7, 43,209,126,193,193,193,168,169,169,193,194,133, 11,113,233,210,109, 3,104,108,108,172,123,
-165,119,229,202, 21,168,213,106, 16, 66,162,124, 41,180, 90,173, 86, 88,173, 86, 44, 90,180, 8, 21, 21, 21,173, 48,111,222,188,
- 9, 66, 72,144,191, 21, 25, 29, 29, 29,109, 54,155,241,203, 95,254, 18,205,205, 45,231,250,206,153, 51, 7, 34,145, 8, 53, 53,
- 53, 16,137, 68,145, 93,104,159,200,169, 83,167,122, 77,173, 18, 26, 26,106, 11, 15, 15,127,200, 79,204,136,105,211,166,221,202,
-205,205,189, 99, 99,203,233,211,167,127,173, 82,169,142,170, 84,170, 65,126, 98,178,158,164, 74, 44, 22,183, 34, 90, 34,145, 8,
- 20, 69,249, 28,163,118,169,198,244, 6, 67,170,134,109,120,118,242,194,132, 40, 37,184,198,106,136, 31,121, 5,231,180,114,108,
-204, 57, 4, 0,248,227,188, 20, 12, 77, 91, 15,235,142,201, 88, 62,138,150,100,220,180, 60, 15,224,165,123,252,204,255, 31, 0,
-252, 46,184,183, 0, 12,235, 65,243,145,155,108, 29, 62,124, 24,131, 7, 15, 70, 93, 93, 29, 74, 75, 75,187, 74,178,248,231,221,
-170, 53,107,214,124, 49,115,230,204, 96,126,209, 42,151,203,177,114,229, 74,115, 99, 99,227, 42,191, 58, 17,203,130, 97, 24,247,
- 34, 89, 38,147, 33, 57, 57,217, 77,178, 8, 33,104,106,106, 2,195, 48,252,142, 68,226,163,142,136,233,211, 7, 33, 33, 33, 24,
-248,192, 3,184,236,122,142,240,175,165, 82, 41, 8, 33,112, 56, 58, 53,228, 25, 93, 65,237, 43,132,158,146,121, 82,212,161,233,
- 56, 54, 22, 44,203,242, 36,147, 19, 2, 51, 50, 50, 18,141,141,141,190, 98,246, 72,241, 98,209,226,137,214, 84,180,196,106,221,
-145,222, 97, 60,128, 2, 4,112, 75, 37, 1, 71, 88,142, 3, 67, 83, 46,223, 45, 13,154,166,160,215, 86, 97,243, 43, 75, 92, 36,
-235, 99,124,118,162, 20,113, 3, 6,223,246,227, 18, 2,112, 29,119,110,181, 82,156,187,116,102,170,188,154, 84, 33, 44, 54, 8,
- 50, 89, 27,254, 24, 46, 6, 73,164,240,236,132,184,160, 51, 7,155,115,127, 52,216, 58,157, 40,100, 20,213, 18,252, 78, 72,187,
-193, 61,148,235, 59,154, 16,112, 28, 7,142,245, 47,238,152, 39,242,114,185, 28, 54,155, 13, 52, 77, 99,235,214,173, 97,105,105,
-105,219,252, 37, 90, 0, 74,170,171,171,167,100,101,101, 29,222,187,119,111,100,100,100,100,171,213, 67, 86, 86,150,174,186,186,
-122, 10,252, 12,186, 23,137, 68,219,222,122,235,173,208,235,215,175,163,169,169, 9,114,185,220,253,240,233,106,255, 28, 57,114,
-228,231, 71,142, 28, 9, 55, 24, 12,176,217,108,144,203,229,224, 56, 14, 52, 77,227,163,143, 62,138,120,252,241,199, 15,221,184,
-113,227,145,142,116,149,203,229, 51, 92,196, 9,217,217,217, 97,217,217,217,227, 1,175,153,122,221,146,157,157, 29,182, 98,197,
-138,105,102,179,249,181, 14,202, 92,161,215,235,251,200,229,114,236,219,183, 15, 10,133, 2, 65, 65, 65,136,141,141,133, 94,175,
- 71, 80, 80, 16, 56,142,131,221,110,231, 31, 22,181,190, 20, 92,171,213, 54, 58, 28, 14,229,225,195,135, 81, 91,123,251, 95, 18,
- 18, 18, 80, 95, 95, 15,150,101,155,252,173,204,202,202,202,106, 66, 72,252,185,115,231,112,253,250,117,164,167,167,227,192,129,
- 3, 72, 73,105,241, 14, 91,173,214,174, 36,241,115,210, 52,205,117,208,111, 9,128,112, 33, 49, 93,147,151, 95,152, 44,203,178,
- 60,201,242,252,235, 73,190, 58,249,205, 86,195,249,161,104, 69,222,134,165,147, 22, 78, 30, 28, 9,179,246, 26,100, 33,145, 32,
- 97,137,216,152,115, 8,197, 87, 91,218,107,227,238,179,216,179,118, 10, 32, 87, 33, 73,169, 67,159, 16,230,137, 11, 53,247,156,
-104, 41, 61,215, 9, 61,117, 98, 74, 79, 79,135, 94,175,135, 66,161, 16, 34, 62,231,148,217,108,190,248,201, 39,159, 12,159, 58,
-117, 42, 36, 18, 9, 46, 94,188,136,194,194,194, 82, 0,167,252, 37, 90, 34,145, 8,107,214,172,193,146, 37, 75, 16, 29, 29,141,
- 85,171, 86,129, 97, 24,247, 69, 8,113, 91,184,252,145,168,232,142, 55, 62,242, 1,241,157, 25,195,149, 74,229, 26,138,162,102,
-211, 62, 84,156,211,233,116,178, 44,187,215, 96, 48,116,152,222,129, 15, 92,247,165, 45, 60,235,160,147, 57,173,219,152,119,131,
-139,116, 69,218,238, 54,244, 98,209,226,119, 29,222,113, 20, 16, 95,202, 2,151,201,174, 32, 80,138, 18,138,190,112,243, 86, 37,
- 34,194, 21, 46,146,229,186, 40, 10, 67, 7,183, 44,102, 63, 59, 81,138,184,254,131,193,208, 52, 24,154,134, 66, 46, 69,181,166,
- 10, 12, 67, 93,240,134, 59,132,198,204,153,131,226, 19,195, 35, 68,208,169,173,136,137,246, 98, 24, 24, 30,130,184, 24, 9, 30,
-139,144,245, 27, 66, 99,102,199,214, 55,206, 77,180,108, 14, 7,196, 79, 62,233,118, 23, 22,101,103, 35, 57, 55, 23,206,233,211,
- 97,178,217, 90,153,138,187, 74,180,228,114, 57,140, 70, 35,230,207,159,175,183,219,237,207,116,177,138, 11,107,107,107,103,101,
-100,100,212,242, 4,198,102,179, 33, 35, 35,163,182,182,182,118,150, 15, 86,162, 59,196,110,183, 63,147,146,146,162,215,233,116,
-110, 61,187,242,192,225, 69,165, 82,125,150,151,151,167,178, 88, 44,112, 56, 28,110, 76,185, 92, 14,154,166,161, 86,171,177,103,
-207, 30,181, 74,165,234,240,204, 42,179,217,252, 73,110,110,110, 61, 0,228,230,230,214, 19, 66,142, 17, 66,222, 38,132,188,213,
-230,122,155, 16,114,204,243, 94,179,217,188,191, 35,108,171,213,122,172,180,180,148, 11, 10, 10, 2, 77,211,176,217,108,144,201,
-100,110,147,120, 67, 67, 3,204,230, 22, 55,119, 97, 97, 33,236,118,251, 73, 95,202,110, 52, 26,191,218,185,115, 39,155,144,144,
-128,193,131, 7, 35, 57, 57, 25,169,169,169,232,215,175, 31,214,173, 91,231, 52,153, 76,126,143,189,202,202,202,207,254,249,207,
-127,218,227,227,227, 49,124,248,112, 72,165, 82, 12, 29, 58, 20,177,177,177,248,235, 95,255,106, 53, 24, 12,135,187,208, 76, 55,
-206,159, 63, 79,119, 64,114, 67,225,195,238,221, 54, 82,113,230,204, 25, 58, 53, 53,245,211,182, 95,140, 28, 57,242, 83,133, 66,
-161,228, 77,236,254,172,200, 61,201,149, 84, 42,117, 95,252,231, 12,195,248,178,250,161, 30,138, 86,228,253,109,201,196,133,147,
- 7,135,227,211,175,190,133,216, 86, 15, 88, 59,240, 8, 58,237, 32,226, 96, 68, 43, 69,113, 61, 96, 14, 88, 14,224, 7,180,228,
- 97, 90,133,158, 37,238,192,247,218,218, 90,148,150,150,162,176,176, 16,169,169,169, 56,121,242, 36,112, 59, 64,222,111, 49, 24,
- 12,171,214,174, 93,107,226,119,242,189,248,226,139,102,163,209,184,202,223,103, 48,199,113, 16,137, 68, 72, 74, 74,194,138,112,
- 76,117,201, 0, 0, 13, 69, 73, 68, 65, 84, 21, 43,112,232,208, 33, 92,188,120, 17,118,187,221, 77,132,248,152, 76,127, 44, 90,
- 98,177, 24,209,209,209,176,219,237,110,107, 22, 0, 92,190,116, 9, 12,195,128,101, 89, 88,173,214, 78, 45, 90, 74,165,114,205,
-246,237,219,127,175,211,233, 98,180, 90,109,148,231, 85, 93, 93, 29, 85, 85, 85, 21,117,235,214,173,168,138,138,138,168,242,242,
-242,168,107,215,174,197,188,250,234,171,191, 87, 42,149,107,124,209,147,166,105, 12, 29, 58, 20,203,150, 45,115, 95,111,188,241,
-134,251, 42, 40, 40,240, 59,120,157,166,105, 36,173,222,136, 41, 90,206,125, 29, 82, 19,247, 85,252,199,197, 29, 97, 6,156,139,
-116,137,191,184,118, 27,122, 30, 44,221,142,240,187, 14,249,103,153, 59,108,163,109, 48,124,192,196, 97,109,254,250,106,217,165,
-137, 73, 67, 70, 80, 26, 93, 99,171,237,159,201, 19,102,129, 16,130,190,253, 7,131,102, 24,208, 52, 5,134,166, 17, 22, 42, 67,
-233,185,115,172,197,108,254,186, 61,204,241, 0, 35,145, 75,222,152,247,216, 80, 89,165,164, 6,234,152, 96,136, 69, 45,220,145,
-187, 58,171,205, 12,193, 0, 67, 66,240,219, 91, 17,242,175,171,155,223, 8, 55,217, 62, 61,230,101, 5,200,178, 44, 20, 82, 41,
-154, 45, 22,152, 29, 14, 76,216,188,217,237, 46,164, 8,193,119, 0, 30,222,188, 25,223,228,231, 35, 84, 34, 1,164, 82,159,119,
-133,180, 71,180,116, 58, 29, 22, 44, 88, 80, 91, 85, 85,149,217,149, 24, 45, 94, 44, 22,203,113,141, 70,147, 57,107,214,172, 93,
-251,246,237, 83,205,154, 53, 75,175,209,104, 50,125,140,123,186, 67,154,155,155,243, 43, 42, 42,154, 22, 44, 88,240,254,238,221,
-187, 35, 34, 35, 35,221, 43,145, 46,117, 86, 66,116,147, 38, 77,146,250,114, 95, 39,183,172,117, 5,183, 47,113, 89,182, 30, 94,
-188,120,241, 55,104,137,191,242,148,213,239,188,243,206, 28, 15, 23,227,219, 0, 54,119, 4,220,208,208,240,214,138, 21, 43,126,
-119,252,248,241, 72,153, 76, 6, 66, 8,196, 98, 49, 6, 14, 28,232,222, 69, 35, 18,137,192,113, 28,158,123,238, 57, 93, 77, 77,
-205, 22, 31,219,102,241,218,181,107,199, 53, 55, 55,135, 47, 88,176,128,150,201,100,168,174,174, 70, 78, 78,142,115,199,142, 29,
-245, 38,147,105, 97, 23,136,240,206,151, 95,126,121, 66, 99, 99, 99,255,172,172, 44,177,193, 96,128,217,108,198,243,207, 63,111,
-125,247,221,119,111,154,205,102,191, 19,254,142, 26, 53,170,172,188,188,124,108, 83, 83, 83, 93, 80, 80, 80, 91,107, 31, 9, 14,
- 14, 30, 1,224,125,127, 48,147,147,147,175,220,184,113, 35,117,253,250,245,199,236,118,187,232,244,233,211,238, 96,248,173, 91,
-183, 22,200,100,178, 73,240,243,240, 85, 66, 8, 43,149, 74, 91, 89,176,218,190,102, 24,166,211,103,218,131,125,130,214,255,237,
-233,113, 11, 31,125, 72,137, 79,190, 58,139,181,251,175, 94,120, 96,161, 58,233,231,225, 90,176,218, 82,252,113, 94, 10, 54,238,
- 62, 11,160,197,117,200,214, 20,131,171,187, 2, 46, 36, 30,215,244,186,202, 30, 48, 7, 20,160, 37,101, 70, 79,147, 86, 36,171,
-184,184, 24, 19, 39, 78, 4, 0,156, 60,121, 18, 99,198,140,193,201,147, 39, 49,118,236, 88,191,115,105,185,228,223, 13, 13, 13,
-229, 5, 5, 5,255, 21, 31, 31,143, 83,167, 78, 93, 3,240,111,127,149,228,137, 22,195, 48,248,205,111,126,131,180,180, 52, 36,
- 36, 36,180,218,109,200,191,246,135,108, 56, 28, 14, 12, 25, 50, 4, 22,171, 21, 98,177,216,237,154,100, 24, 6,234,168, 40,148,
-149,149,249,100,209,162, 40,106,246,140, 25, 51,168,146,146, 18,204,157, 59, 23,187,118,237,242,122,111, 70, 70, 6, 62,252,240,
- 67,204,152, 49,131,122,225,133, 23, 58, 76,239,192, 7,161,251, 82, 38,126,158,238,236,185, 47, 20,102,160,185, 72,119,196, 35,
-181, 67,187, 78,147,118, 62,203,109, 69,180, 60,146,132, 5,134,104, 57,108,187, 14,124,240,230,138,212,109, 99,213, 49, 81, 74,
-232, 13,102, 55,217, 42, 42,248, 24, 0, 48,115,241, 95,192,208, 45, 46,197, 80,133, 12,114, 49,141,252,247,182,232,108,182,230,
-118,123,151, 81, 68, 45,121, 97,244, 64,165, 36,216,142,134, 62, 28, 6,171,111,159,148, 67,250,127,124, 39,225,250, 69, 56, 34,
-139,235, 48,239,231,138,208, 45, 37,245, 75, 96,103,223,184, 99, 66,172,175, 55,215,159, 59, 39, 79,223,190, 29,167, 51, 51,209,
-215,233,196,177,216, 88,168, 68, 34, 40,165, 82, 80,132,192,252,175,127,225,155,125,251, 16, 45,149, 2, 33, 33,112,172, 91, 7,
- 75,105, 41,236, 70,163,185, 11, 43, 51,204,153, 51, 71,167,211,233,102, 89,173,214,227,221,173,103,179,217,124,164,162,162, 98,
-201,168, 81,163,182,217,237,246,103,204,102,115,183,118, 70, 89,173,214, 35, 26,141,230,201, 57,115,230,124,188,127,255,254,200,
-176,176,176, 46, 99,213,214,214,166, 8,212,157, 88, 0,127,118, 5,183, 47,201,206,206, 14, 59,115,230,204,239,242,242,242,182,
-121,172, 38,162, 22, 45, 90,244,116, 27,146,213,233,174, 67, 0, 55,106,106,106,214,173, 92,185,242, 47,155, 54,109, 82,240,129,
-239,223,127,255, 61, 28, 14, 7, 68, 34, 17,156, 78, 39, 22, 45, 90,212, 88, 91, 91,187, 17,222, 51, 58,223,209,181, 26, 26, 26,
- 6,174, 95,191, 62,111,243,230,205,105, 52, 77, 7, 59,157, 78, 83, 83, 83,211,177,230,230,230,133,232, 90, 30, 45, 86,171,213,
- 46,120,233,165,151, 22,228,228,228,204,160, 40, 42,202,225,112,232,140, 70,227, 65,179,217,252, 46,186,224, 74, 58,117,234,148,
-118,222,188,121, 87,181, 90,237,131,113,113,113, 6,133, 66, 97,181, 90,173,180, 92, 46, 15, 13, 14, 14, 78, 6,112,138, 16,242,
-163, 63,152, 69, 69, 69,154,172,172,172,235, 22,139, 37,233,237,183,223, 62, 17, 26, 26,250, 21, 33,132,136,197,226,112,185, 92,
- 62, 17,192, 49, 66,200,101,127, 48, 41,138, 98, 61,173, 87,109,227,179, 36, 18,137, 79, 49, 90,253,213, 65,191, 77, 27,200,224,
-147,175,207, 98,237, 39, 55,118, 58, 57,110,223,190,162,186,127,173, 26, 3,216,246,206,195,208, 89,239,183,184, 11, 1,176, 53,
-197,176,237,205, 0, 9,138,196,137, 91, 34, 24,204,182,207,208, 43,237,137, 59,189,131, 78,167, 67, 73, 73, 9, 79,178,146, 1,
- 96,236,216,177, 69, 60,217, 42, 44, 44,196,240,225,195,139, 0,136,252,237,175, 13, 13, 13, 43,231,207,159,127,196,181, 56, 94,
-217,133,133,159,155,104,241,132, 42, 33, 33,193,253,222,243,242,136,209,242, 73,156, 78, 39,196, 98, 49, 24,134, 65, 76,108,172,
-251,183, 56,142, 67, 89, 89, 25,244,122,189, 79, 68,139,166,105,154, 16,130,185,115,125,219,144,252,212, 83, 79,225,216,177, 99,
-160,125,100,133, 52, 77, 35, 49, 49,177,211,123,120, 94,234, 43,102, 92, 92, 92,151, 49, 3,205, 69,186, 74,176,218,123,221, 30,
-169,242, 54, 32,238,150, 84, 54, 54, 26,254,252,222,246,173,155, 22, 45,125, 78, 81,124,165, 26,134, 70, 11,104,154,242,124,120,
-130, 97,104,132, 6,203, 16,223, 71,137,221,255,248,187,209,216, 80,255, 18,188,156,123,152, 16, 34, 94, 60,105,196,207,165,226,
- 24, 19,146, 30,158, 3, 90,118,155, 4,112, 26, 47,222,193, 49, 95,224, 87, 55, 76,178, 3, 55, 76,139,191,171,179,222, 73,180,
-172,214,201, 47, 62,246,216,231,107, 15, 29, 10, 26,185,115, 39,174, 44, 90,132, 88,179, 25, 82,151, 43,145, 34, 4, 10,177, 24,
- 10,177,184,133,100,229,228,192,236,112, 96,115,102,102,147,197,106,125,204,159, 65, 94, 91, 91,139,233,211,167,107, 43, 43, 43,
-167,160, 11,174, 61,111, 98, 50,153,242, 1,228, 11,133,103,177, 88,142,223,188,121,243, 87,211,167, 79, 63,116,228,200, 17,117,
- 15, 73, 50,199,147, 45,219,153, 51,103,158, 62,113,226,196, 21,180, 62, 88,180,254,196,137, 19, 87,178,178,178, 72, 94, 94,222,
-187, 0, 94,134,143, 9, 60, 77, 38,211,214, 47,191,252, 18,227,198,141,123,121,195,134, 13, 17, 41, 41, 41,136,138,138,130,209,
-104, 68, 97, 97, 33,150, 47, 95,174,111,104,104,216, 80, 95, 95,191,201, 79,157,109, 22,139, 37,195,115, 43,181, 16,245, 96,177,
- 88,118, 84, 85, 85,237, 16, 10,240,217,103,159,253,190,172,172,172, 86,173, 86,255,183, 88, 44,126, 24, 45,113, 64, 26, 0,239,
-250, 75,136,120, 89,186,116,233,185,178,178, 50, 93,223,190,125, 83, 93,152, 97,104, 57,198,104,123, 23, 48, 43,207,158, 61, 27,
- 55, 98,196, 8, 74, 36, 18,113, 52, 77, 67, 36, 18,113, 12,195,112,174,184, 26, 14, 0, 14, 30, 60, 40, 5,208,225,177, 57, 87,
-106,204,235, 51,254,254,159, 23,126,212, 52,239, 43,173,110, 90, 1,128,219, 91, 28,244,197, 80, 53, 61,121,242,160,155,176,228,
-142, 5, 9,109, 73, 84,201, 53, 86,129, 4, 71,227, 38,219, 23,171, 63,189,160,113,128,188,214,203,169,218, 95, 87,195,149,222,
-161,170,170,202,147,100,241, 86,171,228,177, 99,199, 22,185, 72, 22,255, 93, 87,226,203,142,178, 44,219,173, 57,140,227, 56,172,
- 93,187, 22,239,188,243, 14, 58,203,104,238,218,221, 71, 58,195,227, 45, 90, 78,167, 19, 54,155, 13,197,197,197,238,156, 93,188,
-187,144, 79,237,224,112, 56, 58,220,173,238,116, 58,157, 86,171, 21, 31,125,244,145, 79,100,107,207,158, 61,104,110,110,134,179,
- 19, 6,231,153,138, 97,216,176, 97,208,235,245,238,205, 62,201,201,183, 83,229,217,108, 54,191,136, 43,143,153,148,148, 4,157,
- 78, 7, 62, 94, 56, 62,243,182,177,199, 97, 50,253, 84,251,189, 87,139,214, 93,159, 49,165, 65,161, 71, 82, 70,167,141,201,124,
-122,121,112,163,197,137,235,215,203,161,173,169, 2, 69, 40,196,244,141, 67,191,126,137,144, 75, 40,236,202,221,100, 42,250,230,
-171,255, 52, 26,235,210,189, 97, 77, 85,138,191,201,121,114, 76,234,128, 1, 33, 4, 14, 59,224,180, 3, 14, 59,192,186,254,242,
-159,177,173,251, 92, 73, 73, 61,247,194,119,250,255,253,204, 96,107,247,204,170, 89,192,152, 48,149,234,243,213, 7, 15, 6,177,
- 54, 27,106, 87,174, 68,144,195, 1,153,107, 85,210, 82, 16, 41, 28,235,214,181,144,172,140,140, 38, 67,125,189, 95, 71,240, 68,
- 70, 70,158, 37,132, 68,106,181,218,251, 42, 51,188, 90,173,254,140,227, 56,157, 78,167, 75,233, 65,122, 69, 1,168, 7, 96,107,
-103, 33,161,134,255,241, 63,188, 36,170,213,234, 23, 40,138, 26,197,113, 92, 4, 69, 81,117, 44,203,158,170,169,169,121, 21, 64,
- 89,239,124,122,207,132,207, 12,255,179, 78,238,171, 1,240, 7,180, 4, 5, 95,247, 21,124,168, 82,169,180, 72,236,251,127, 61,
- 88, 58, 97,118,178, 18,253,251,132, 64, 36,150,161,178,193,129,163, 63, 54, 96,123,129,166,194,108,119, 62,126, 73,219,116,190,
-183, 41, 58, 20,193,143,224, 17, 82, 84, 42,213,183,159,127,254,121, 74,255,254,253, 41,207,128,119, 62, 87, 30,239,222, 98,152,
- 22, 46,119,252,248,113,199,220,185,115, 79, 85, 87, 87,143,243,134, 25, 18, 18,242,197, 15, 63,252,240,168,193, 96,184,131, 80,
-121,102,138,231,223,155, 76, 38, 44, 93,186,244, 75,111, 71,240, 40,149,202,156, 77,155, 54,253,126,230,204,153, 20,159,142,194,
-243,226,143, 11,226, 47,155,205,134,247,223,127,159,221,178,101,203,235, 6,131,193,171,235, 48, 38, 38,166,162,178,178, 50,142,
- 79,181,224, 75, 82,209,196,196,196,170,242,242,242,216,187,137,121, 31, 19,174, 86,214,173,123, 98,154, 16,201,229,207,134, 40,
-194, 95,153, 57,127, 89, 68,226,128, 7, 72,116, 76, 95, 16, 80,168,214,220, 66,249,213, 75,220,254, 15,222,172, 53, 53,232,215,
-152,205,166, 55, 59,194,121, 8, 24,240,179, 80,241, 94,137, 19,131,192, 19,160, 54,231, 83,221,177,226, 0, 96, 19, 81, 23,174,
- 27,237,115,126,236,192,237,195,147,173, 63,239,223, 31, 36, 25, 52,232,142, 68,113, 44,203,194, 82, 90,138,205,153,153,126,147,
-172, 94,233,149, 94, 17, 68,250,163,243, 28, 89,118,180,228,231,242,215, 98, 66,146,162,130,231,112,192,108, 10,236, 16,138, 16,
-137,131,195, 69,112,248, 34,136,105,218, 86, 84, 5,115,111,245,251, 36, 61,246, 80,105, 0,193, 42,149,234, 43,154,166,251,241,
- 22, 25, 79,107,125, 59, 7, 74, 95,175,174,174,158, 4,160,163, 29,194, 3, 66, 66, 66,222,116, 58,157, 35,125, 57, 84,154,166,
-233,211, 70,163,241, 89,116,112,168,116, 32,118, 29, 70, 68, 68,148,149,151,151, 15,224,119, 81,123,206,149,237,237, 44,191,124,
-249, 50,198,143, 31, 95,174,209,104, 18,239, 38,102, 79, 21, 47,187, 14,123,142, 69,203, 67, 98,197, 82,197, 2,137, 92,246, 8,
-107,119, 36,129, 0,140, 72,116,193,218,108,254,218, 98,110,124, 15, 94,220,133,119, 83,102, 1, 99,164, 18,201, 23,226,208, 80,
-121,123,164,205,110, 52,154, 45, 86,235,228, 94,146,213, 43,189,210, 43,189,210, 43,247,145, 12, 82,169, 84,159,139, 68, 34,169,
- 39,153,108,251,154, 23,135,195,209,172,213,106,211, 1, 92,188,203,152,255, 63,197,207, 32,181, 52, 95, 49, 93,215,248,158,142,
- 25,192,178,115, 2, 98,142,119, 97,174,190, 79,244, 28,223, 83, 49,249,242,250,129,155,230, 79, 63, 18,170, 62, 61,244,228,132,
-214, 51, 80,152, 66,141,163,118,244,228, 2,208,238,171,239, 19, 61,199,247, 52,204,182,253,199, 71, 92,191, 48,125,236, 83,254,
-234,201, 9,173,103,160, 48,187, 59,142, 58,208,147,235,110, 95,242,210,246,171,113, 31, 74,201, 47,192,149,252, 2, 92,241,240,
-118,243, 54,102,123,251, 63,191, 2, 9, 3,181, 19,128, 79,187,239,194, 39, 61, 21,211,179, 30,132, 60, 42, 32, 0,199, 14, 20,
- 8,141,217,166, 62,133,146,213,174, 29, 38,199,224, 67,194, 81,127,202, 46, 68,187,183, 41,171, 32,184, 93, 32, 89,126, 97, 10,
-213,239, 3,141, 41,212, 88,106,139, 41, 68,191,111,175,221, 3,216, 70, 66,233, 41,200, 88, 10, 68,159,111,167,255,116, 27,183,
- 45,166, 16, 99,169, 45,166, 16,253,254,110, 96, 10, 49,150,218,195, 20,162,223,123,107,251,251,213,208,196,187, 11, 93, 41, 30,
-136, 15,100, 43, 23, 0,168,174, 84, 90, 0, 45,101, 19,132,198, 20, 90,231, 64,144, 77, 63, 44, 48,247, 28, 83,224, 54, 90,237,
-194, 20,114,117, 51, 65,168, 54, 10, 68,127,247,196, 20, 10,191, 45,142, 16,237,212, 30,102,119,245,245,162,167,224,101,239,110,
-191,191, 91,152, 2,183,145, 32, 99,169, 13,230, 4,129, 23, 3, 19, 60,222,175, 22, 18, 83,168,177,212,142,158,221,110,167,246,
- 48,187,171,175, 23, 61, 5, 47,187, 16,115, 72,160,112,239,165, 69,139,163,188,246,137,220, 54,215, 93, 33, 26,247,204, 37,231,
- 39,246, 79, 10,211, 79,247, 76, 90, 0,218,254,158,234, 41, 36,102, 91, 29,133,116,247, 4, 82, 79, 33, 49,253,208,245, 39,135,
-121,191,181,123, 79,172, 79,111,120,221,113, 75,121,179,142, 6, 66, 79, 33, 49,125,196,254, 73, 96,118,163,237,127,114,194,244,
- 20, 69,248,138, 23,120,101, 2,129, 45, 48, 1, 43,183,192,122, 78, 8,132,133, 48, 0, 34,184,158,174,149,242, 43, 1, 40,251,
-253, 82,167,189, 99,169,119, 44,245,184,177,212,166, 79, 78, 16,208, 82, 36,168,229,185, 45,166, 16,191,225,137, 33, 84, 31, 13,
-116,217,133, 28, 75,129,104,251,251, 77,254, 15,176, 49,196,128, 26,186,125, 59, 0, 0, 0, 0, 73, 69, 78, 68,174, 66, 96,130,
+137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 2, 90, 0, 0, 2,
+128, 8, 6, 0, 0, 0, 68,254,214,163, 0, 0, 10, 79,105, 67, 67, 80, 80,104,111,116,111,115,104,111,112, 32, 73, 67, 67, 32,
+112,114,111,102,105,108,101, 0, 0,120,218,157, 83,103, 84, 83,233, 22, 61,247,222,244, 66, 75,136,128,148, 75,111, 82, 21, 8,
+ 32, 82, 66,139,128, 20,145, 38, 42, 33, 9, 16, 74,136, 33,161,217, 21, 81,193, 17, 69, 69, 4, 27,200,160,136, 3,142,142,128,
+140, 21, 81, 44, 12,138, 10,216, 7,228, 33,162,142,131,163,136,138,202,251,225,123,163,107,214,188,247,230,205,254,181,215, 62,
+231,172,243,157,179,207, 7,192, 8, 12,150, 72, 51, 81, 53,128, 12,169, 66, 30, 17,224,131,199,196,198,225,228, 46, 64,129, 10,
+ 36,112, 0, 16, 8,179,100, 33,115,253, 35, 1, 0,248,126, 60, 60, 43, 34,192, 7,190, 0, 1,120,211, 11, 8, 0,192, 77,155,
+192, 48, 28,135,255, 15,234, 66,153, 92, 1,128,132, 1,192,116,145, 56, 75, 8,128, 20, 0, 64,122,142, 66,166, 0, 64, 70, 1,
+128,157,152, 38, 83, 0,160, 4, 0, 96,203, 99, 98,227, 0, 80, 45, 0, 96, 39,127,230,211, 0,128,157,248,153,123, 1, 0, 91,
+148, 33, 21, 1,160,145, 0, 32, 19,101,136, 68, 0,104, 59, 0,172,207, 86,138, 69, 0, 88, 48, 0, 20,102, 75,196, 57, 0,216,
+ 45, 0, 48, 73, 87,102, 72, 0,176,183, 0,192,206, 16, 11,178, 0, 8, 12, 0, 48, 81,136,133, 41, 0, 4,123, 0, 96,200, 35,
+ 35,120, 0,132,153, 0, 20, 70,242, 87, 60,241, 43,174, 16,231, 42, 0, 0,120,153,178, 60,185, 36, 57, 69,129, 91, 8, 45,113,
+ 7, 87, 87, 46, 30, 40,206, 73, 23, 43, 20, 54, 97, 2, 97,154, 64, 46,194,121,153, 25, 50,129, 52, 15,224,243,204, 0, 0,160,
+145, 21, 17,224,131,243,253,120,206, 14,174,206,206, 54,142,182, 14, 95, 45,234,191, 6,255, 34, 98, 98,227,254,229,207,171,112,
+ 64, 0, 0,225,116,126,209,254, 44, 47,179, 26,128, 59, 6,128,109,254,162, 37,238, 4,104, 94, 11,160,117,247,139,102,178, 15,
+ 64,181, 0,160,233,218, 87,243,112,248,126, 60, 60, 69,161,144,185,217,217,229,228,228,216, 74,196, 66, 91, 97,202, 87,125,254,
+103,194, 95,192, 87,253,108,249,126, 60,252,247,245,224,190,226, 36,129, 50, 93,129, 71, 4,248,224,194,204,244, 76,165, 28,207,
+146, 9,132, 98,220,230,143, 71,252,183, 11,255,252, 29,211, 34,196, 73, 98,185, 88, 42, 20,227, 81, 18,113,142, 68,154,140,243,
+ 50,165, 34,137, 66,146, 41,197, 37,210,255,100,226,223, 44,251, 3, 62,223, 53, 0,176,106, 62, 1,123,145, 45,168, 93, 99, 3,
+246, 75, 39, 16, 88,116,192,226,247, 0, 0,242,187,111,193,212, 40, 8, 3,128,104,131,225,207,119,255,239, 63,253, 71,160, 37,
+ 0,128,102, 73,146,113, 0, 0, 94, 68, 36, 46, 84,202,179, 63,199, 8, 0, 0, 68,160,129, 42,176, 65, 27,244,193, 24, 44,192,
+ 6, 28,193, 5,220,193, 11,252, 96, 54,132, 66, 36,196,194, 66, 16, 66, 10,100,128, 28,114, 96, 41,172,130, 66, 40,134,205,176,
+ 29, 42, 96, 47,212, 64, 29, 52,192, 81,104,134,147,112, 14, 46,194, 85,184, 14, 61,112, 15,250, 97, 8,158,193, 40,188,129, 9,
+ 4, 65,200, 8, 19, 97, 33,218,136, 1, 98,138, 88, 35,142, 8, 23,153,133,248, 33,193, 72, 4, 18,139, 36, 32,201,136, 20, 81,
+ 34, 75,145, 53, 72, 49, 82,138, 84, 32, 85, 72, 29,242, 61,114, 2, 57,135, 92, 70,186,145, 59,200, 0, 50,130,252,134,188, 71,
+ 49,148,129,178, 81, 61,212, 12,181, 67,185,168, 55, 26,132, 70,162, 11,208,100,116, 49,154,143, 22,160,155,208,114,180, 26, 61,
+140, 54,161,231,208,171,104, 15,218,143, 62, 67,199, 48,192,232, 24, 7, 51,196,108, 48, 46,198,195, 66,177, 56, 44, 9,147, 99,
+203,177, 34,172, 12,171,198, 26,176, 86,172, 3,187,137,245, 99,207,177,119, 4, 18,129, 69,192, 9, 54, 4,119, 66, 32, 97, 30,
+ 65, 72, 88, 76, 88, 78,216, 72,168, 32, 28, 36, 52, 17,218, 9, 55, 9, 3,132, 81,194, 39, 34,147,168, 75,180, 38,186, 17,249,
+196, 24, 98, 50, 49,135, 88, 72, 44, 35,214, 18,143, 19, 47, 16,123,136, 67,196, 55, 36, 18,137, 67, 50, 39,185,144, 2, 73,177,
+164, 84,210, 18,210, 70,210,110, 82, 35,233, 44,169,155, 52, 72, 26, 35,147,201,218,100,107,178, 7, 57,148, 44, 32, 43,200,133,
+228,157,228,195,228, 51,228, 27,228, 33,242, 91, 10,157, 98, 64,113,164,248, 83,226, 40, 82,202,106, 74, 25,229, 16,229, 52,229,
+ 6,101,152, 50, 65, 85,163,154, 82,221,168,161, 84, 17, 53,143, 90, 66,173,161,182, 82,175, 81,135,168, 19, 52,117,154, 57,205,
+131, 22, 73, 75,165,173,162,149,211, 26,104, 23,104,247,105,175,232,116,186, 17,221,149, 30, 78,151,208, 87,210,203,233, 71,232,
+151,232, 3,244,119, 12, 13,134, 21,131,199,136,103, 40, 25,155, 24, 7, 24,103, 25,119, 24,175,152, 76,166, 25,211,139, 25,199,
+ 84, 48, 55, 49,235,152,231,153, 15,153,111, 85, 88, 42,182, 42,124, 21,145,202, 10,149, 74,149, 38,149, 27, 42, 47, 84,169,170,
+166,170,222,170, 11, 85,243, 85,203, 84,143,169, 94, 83,125,174, 70, 85, 51, 83,227,169, 9,212,150,171, 85,170,157, 80,235, 83,
+ 27, 83,103,169, 59,168,135,170,103,168,111, 84, 63,164,126, 89,253,137, 6, 89,195, 76,195, 79, 67,164, 81,160,177, 95,227,188,
+198, 32, 11, 99, 25,179,120, 44, 33,107, 13,171,134,117,129, 53,196, 38,177,205,217,124,118, 42,187,152,253, 29,187,139, 61,170,
+169,161, 57, 67, 51, 74, 51, 87,179, 82,243,148,102, 63, 7,227,152,113,248,156,116, 78, 9,231, 40,167,151,243,126,138,222, 20,
+239, 41,226, 41, 27,166, 52, 76,185, 49,101, 92,107,170,150,151,150, 88,171, 72,171, 81,171, 71,235,189, 54,174,237,167,157,166,
+189, 69,187, 89,251,129, 14, 65,199, 74, 39, 92, 39, 71,103,143,206, 5,157,231, 83,217, 83,221,167, 10,167, 22, 77, 61, 58,245,
+174, 46,170,107,165, 27,161,187, 68,119,191,110,167,238,152,158,190, 94,128,158, 76,111,167,222,121,189,231,250, 28,125, 47,253,
+ 84,253,109,250,167,245, 71, 12, 88, 6,179, 12, 36, 6,219, 12,206, 24, 60,197, 53,113,111, 60, 29, 47,199,219,241, 81, 67, 93,
+195, 64, 67,165, 97,149, 97,151,225,132,145,185,209, 60,163,213, 70,141, 70, 15,140,105,198, 92,227, 36,227,109,198,109,198,163,
+ 38, 6, 38, 33, 38, 75, 77,234, 77,238,154, 82, 77,185,166, 41,166, 59, 76, 59, 76,199,205,204,205,162,205,214,153, 53,155, 61,
+ 49,215, 50,231,155,231,155,215,155,223,183, 96, 90,120, 90, 44,182,168,182,184,101, 73,178,228, 90,166, 89,238,182,188,110,133,
+ 90, 57, 89,165, 88, 85, 90, 93,179, 70,173,157,173, 37,214,187,173,187,167, 17,167,185, 78,147, 78,171,158,214,103,195,176,241,
+182,201,182,169,183, 25,176,229,216, 6,219,174,182,109,182,125, 97,103, 98, 23,103,183,197,174,195,238,147,189,147,125,186,125,
+141,253, 61, 7, 13,135,217, 14,171, 29, 90, 29,126,115,180,114, 20, 58, 86, 58,222,154,206,156,238, 63,125,197,244,150,233, 47,
+103, 88,207, 16,207,216, 51,227,182, 19,203, 41,196,105,157, 83,155,211, 71,103, 23,103,185,115,131,243,136,139,137, 75,130,203,
+ 46,151, 62, 46,155, 27,198,221,200,189,228, 74,116,245,113, 93,225,122,210,245,157,155,179,155,194,237,168,219,175,238, 54,238,
+105,238,135,220,159,204, 52,159, 41,158, 89, 51,115,208,195,200, 67,224, 81,229,209, 63, 11,159,149, 48,107,223,172,126, 79, 67,
+ 79,129,103,181,231, 35, 47, 99, 47,145, 87,173,215,176,183,165,119,170,247, 97,239, 23, 62,246, 62,114,159,227, 62,227, 60, 55,
+222, 50,222, 89, 95,204, 55,192,183,200,183,203, 79,195,111,158, 95,133,223, 67,127, 35,255,100,255,122,255,209, 0,167,128, 37,
+ 1,103, 3,137,129, 65,129, 91, 2,251,248,122,124, 33,191,142, 63, 58,219,101,246,178,217,237, 65,140,160,185, 65, 21, 65,143,
+130,173,130,229,193,173, 33,104,200,236,144,173, 33,247,231,152,206,145,206,105, 14,133, 80,126,232,214,208, 7, 97,230, 97,139,
+195,126, 12, 39,133,135,133, 87,134, 63,142,112,136, 88, 26,209, 49,151, 53,119,209,220, 67,115,223, 68,250, 68,150, 68,222,155,
+103, 49, 79, 57,175, 45, 74, 53, 42, 62,170, 46,106, 60,218, 55,186, 52,186, 63,198, 46,102, 89,204,213, 88,157, 88, 73,108, 75,
+ 28, 57, 46, 42,174, 54,110,108,190,223,252,237,243,135,226,157,226, 11,227,123, 23,152, 47,200, 93,112,121,161,206,194,244,133,
+167, 22,169, 46, 18, 44, 58,150, 64, 76,136, 78, 56,148,240, 65, 16, 42,168, 22,140, 37,242, 19,119, 37,142, 10,121,194, 29,194,
+103, 34, 47,209, 54,209,136,216, 67, 92, 42, 30, 78,242, 72, 42, 77,122,146,236,145,188, 53,121, 36,197, 51,165, 44,229,185,132,
+ 39,169,144,188, 76, 13, 76,221,155, 58,158, 22,154,118, 32,109, 50, 61, 58,189, 49,131,146,145,144,113, 66,170, 33, 77,147,182,
+103,234,103,230,102,118,203,172,101,133,178,254,197,110,139,183, 47, 30,149, 7,201,107,179,144,172, 5, 89, 45, 10,182, 66,166,
+232, 84, 90, 40,215, 42, 7,178,103,101, 87,102,191,205,137,202, 57,150,171,158, 43,205,237,204,179,202,219,144, 55,156,239,159,
+255,237, 18,194, 18,225,146,182,165,134, 75, 87, 45, 29, 88,230,189,172,106, 57,178, 60,113,121,219, 10,227, 21, 5, 43,134, 86,
+ 6,172, 60,184,138,182, 42,109,213, 79,171,237, 87,151,174,126,189, 38,122, 77,107,129, 94,193,202,130,193,181, 1,107,235, 11,
+ 85, 10,229,133,125,235,220,215,237, 93, 79, 88, 47, 89,223,181, 97,250,134,157, 27, 62, 21,137,138,174, 20,219, 23,151, 21,127,
+216, 40,220,120,229, 27,135,111,202,191,153,220,148,180,169,171,196,185,100,207,102,210,102,233,230,222, 45,158, 91, 14,150,170,
+151,230,151, 14,110, 13,217,218,180, 13,223, 86,180,237,245,246, 69,219, 47,151,205, 40,219,187,131,182, 67,185,163,191, 60,184,
+188,101,167,201,206,205, 59, 63, 84,164, 84,244, 84,250, 84, 54,238,210,221,181, 97,215,248,110,209,238, 27,123,188,246, 52,236,
+213,219, 91,188,247,253, 62,201,190,219, 85, 1, 85, 77,213,102,213,101,251, 73,251,179,247, 63,174,137,170,233,248,150,251,109,
+ 93,173, 78,109,113,237,199, 3,210, 3,253, 7, 35, 14,182,215,185,212,213, 29,210, 61, 84, 82,143,214, 43,235, 71, 14,199, 31,
+190,254,157,239,119, 45, 13, 54, 13, 85,141,156,198,226, 35,112, 68,121,228,233,247, 9,223,247, 30, 13, 58,218,118,140,123,172,
+225, 7,211, 31,118, 29,103, 29, 47,106, 66,154,242,154, 70,155, 83,154,251, 91, 98, 91,186, 79,204, 62,209,214,234,222,122,252,
+ 71,219, 31, 15,156, 52, 60, 89,121, 74,243, 84,201,105,218,233,130,211,147,103,242,207,140,157,149,157,125,126, 46,249,220, 96,
+219,162,182,123,231, 99,206,223,106, 15,111,239,186, 16,116,225,210, 69,255,139,231, 59,188, 59,206, 92,242,184,116,242,178,219,
+229, 19, 87,184, 87,154,175, 58, 95,109,234,116,234, 60,254,147,211, 79,199,187,156,187,154,174,185, 92,107,185,238,122,189,181,
+123,102,247,233, 27,158, 55,206,221,244,189,121,241, 22,255,214,213,158, 57, 61,221,189,243,122,111,247,197,247,245,223, 22,221,
+126,114, 39,253,206,203,187,217,119, 39,238,173,188, 79,188, 95,244, 64,237, 65,217, 67,221,135,213, 63, 91,254,220,216,239,220,
+127,106,192,119,160,243,209,220, 71,247, 6,133,131,207,254,145,245,143, 15, 67, 5,143,153,143,203,134, 13,134,235,158, 56, 62,
+ 57, 57,226, 63,114,253,233,252,167, 67,207,100,207, 38,158, 23,254,162,254,203,174, 23, 22, 47,126,248,213,235,215,206,209,152,
+209,161,151,242,151,147,191,109,124,165,253,234,192,235, 25,175,219,198,194,198, 30,190,201,120, 51, 49, 94,244, 86,251,237,193,
+119,220,119, 29,239,163,223, 15, 79,228,124, 32,127, 40,255,104,249,177,245, 83,208,167,251,147, 25,147,147,255, 4, 3,152,243,
+252, 99, 51, 45,219, 0, 0, 0, 6, 98, 75, 71, 68, 0,255, 0,255, 0,255,160,189,167,147, 0, 0, 0, 9,112, 72, 89,115, 0,
+ 0, 13,213, 0, 0, 13,213, 1, 61,214, 88,241, 0, 0, 0, 7,116, 73, 77, 69, 7,220, 3, 15, 13, 43, 47, 99,146, 79, 17, 0,
+ 0, 32, 0, 73, 68, 65, 84,120,218,236, 93,119,120, 20,197, 3,125,187,183,215,239,114,233, 61, 16,146, 64, 32,148,132, 80, 20,
+144, 94, 5,162,168, 8, 2, 34, 69, 44,136, 40,160, 40,168,136, 72, 87,233, 42, 32, 42, 77, 65,176, 1, 1, 41,145, 18, 72, 2,
+132, 38, 61, 65, 18, 72, 35,237, 82,175,183,221,223, 31,201,157,151,203,181, 64,162, 63,116,223,247,237,119,119,123,187,111,103,
+103,103,102,223,188,105, 0, 11, 22, 44, 88,176, 96,193,130, 5, 11, 22, 44, 88,176, 96,193,130, 5, 11, 22,255,106, 36, 38, 38,
+ 50, 13, 56,124,160,187,156,181, 91,159,255,119,206, 38,188,119,166, 17, 57,251,212,114,126,244,144,132,179,207,255, 43,167,249,
+126, 27,192, 59,176, 33,233,168,177,226,211, 42,156, 76, 99,135,179,169, 56, 27, 43, 31,217, 9, 39,211, 4,207,253,163,135, 36,
+156,125,254,223, 56,109,211,143,155,188, 13,226,116, 51, 77, 53, 52,156, 76, 99,135,179,169, 56, 31, 52, 31, 57, 9, 39,243,160,
+105,201,193,179,255, 8,255, 33, 80, 77, 40,178,220, 70, 66, 66, 2, 97,197, 79,252,191,114, 90,199,131,153,191, 49,195,218,136,
+ 56,222,216,156, 54,241,217, 88,248, 40, 33, 33,129, 72, 76, 76, 60, 1,160, 79, 99,222,123, 99, 60,119,155,123,109, 20,222,251,
+ 16, 89, 13,226,108,172,116,223,212,156,141,149,151,108, 57, 27, 35,221,219,123,238, 77,248,140, 26, 43,156,141,146,151,154, 34,
+205,219, 73, 63, 15,204,107,203,217, 24,121,201,150,179, 49,210,253,223,193,217, 24,121,201, 30,103, 99,164,123, 71,207,254,191,
+102, 80,145,255,176, 32,176,205,224,125,255,159, 5, 81, 83,137,205, 6, 56, 48,255, 56,103, 35, 63,163,143,106, 57, 27,179,118,
+211,183,177,158, 81, 83,164,119,107,206,198,226,183,229,105,140,231,100,143,243, 65,195,235, 32,156,141,126,239, 15,154,238,255,
+ 46,206, 70,126, 70,141,146,151,108, 56,251, 54,114,101,160,175,213,239,143, 26,147,179,177,242,146,157,112, 62,240,115,178,199,
+249,160,225,117, 16,206, 70,191,247,198,120,135, 52, 21,239,191, 26, 77,213,124,214,216,156, 13,228,254, 87,113, 54,176,121,102,
+ 96, 19, 60,251,127, 52,156,141,201,105, 27,198,198,108,238,105,202,112, 54, 38,103, 3,194,250,175,227,124,216,158,251,255, 99,
+124, 58,226,123,144,102, 41, 71,238,104, 83,132,179, 49, 57,221,228,254, 87,112, 62,192,179,255,215,129,250,127, 9,136, 57,226,
+ 27,185,102,130, 70,118, 96,154, 82,184, 54,102, 56,251, 54,133, 67,216, 4,104,244,112,214,214,148,231, 55,193,189, 63, 44,113,
+202,230, 37, 54, 47,253,223,229, 37,155, 52,217,183, 17,157,162, 70,117,158,109, 57, 27,227, 26,214, 28,141,149, 70,155,250,222,
+ 27, 51, 47, 53,197,179,103,241, 0, 46, 4,203,201,114,178,156, 44, 39,203,201,114,178,156,255, 89,206,127, 37, 72, 54, 10, 88,
+176, 96,193,130, 5, 11, 22, 44, 88,176, 96,193,130, 5, 11, 22, 44, 88, 60, 84,112,216,190, 27, 18, 18,146, 40, 22,139, 91, 58,
+250, 95,169, 84,222,187,119,239, 94, 63, 54, 10,255, 57,176,207,136,197, 67, 4, 18,127, 57,232, 52, 0,166,118, 99,193,130, 5,
+139,127, 53, 28,118,134, 23, 8, 4,145, 55,110,220,136,166,105, 26, 38,147, 9, 70,163,209,242,169,211,233,208,187,119,239, 6,
+119,164, 15, 12, 12, 76,230,112, 56, 45, 26,114,142,201,100,202, 41, 42, 42,234,233,228,144, 84, 0,145, 4,241,151,102, 52,127,
+119,244, 9,160,192, 96, 48,116,114,198, 73, 16, 68,164, 45,159, 3, 46,243,119,167,156,158,158,158,231, 40,138, 10,179,199,229,
+232, 59, 77,211, 89, 37, 37, 37, 61,254,206,103,244, 95, 70, 96, 96, 96, 50, 69, 81, 13, 78,159,133,133,133, 14,211,103,112,112,
+240, 69,146, 36, 67, 26, 64,201,161,105, 58,227,222,189,123, 61,157, 8,145, 84, 0,145, 78,107, 80, 54,233,137, 32,136, 60,147,
+201,212,197, 85, 62,114,198,101, 39,141,186,226,180,136, 44,138,162,150, 5, 4, 4, 76, 85,169, 84, 26, 0, 12,135,195, 97,172,
+194, 6, 0, 48, 26,141, 37, 21, 21, 21, 29,216,148,200,130, 5,139,255,132,208,162,105,154,212,106,181,200,204,204, 4,195,216,
+ 45,239, 77,247,113,189,232,243,191, 31, 9,240, 8, 8,132, 81,175,135,196,207,223,194, 93,116,253, 42,140, 6, 61,140, 58, 29,
+154,119,237,102, 14, 3,218,182,109,203,113,193, 25,182,124,249,242, 0, 15, 15, 15,104, 52, 26,104, 52, 26,104,181, 90,104, 52,
+ 26,232,116, 58,232,116, 58,232,245,122,232,245,122, 24,141, 70,104,181, 90, 36, 37, 37,153, 12, 6,131, 83,206,197,139, 23, 7,
+200,100, 50, 11,159,121, 51,115,154,121, 13, 6, 3, 52, 26, 13,142, 30, 61,234,148,147,162,168,176,130,130,130, 0, 30,143, 7,
+134, 97, 64,211, 52, 24,134,169,179,217, 34, 42, 42, 74,239, 44,144, 77,244,140,254,203,136, 94,188, 99,127,128,167, 72, 0, 35,
+ 77, 35, 33, 46,202,242, 71,214,215,187,193, 24, 77,160,141, 70,180,122,125,188,101,127, 76, 76,140,211,244,201, 48, 76,248,226,
+ 29,251,189,220,229,148,203,229,234, 54,109,218, 20,160,198,109,118, 36,180,194,212,106,117, 64, 45,127, 61, 65, 68,146,100,157,
+237,208,161, 67, 72, 72, 72,112,117,239, 97, 51,103,206, 12, 48, 24, 12,208,233,116,208,106,181, 48, 24, 12, 48, 26,141,150,205,
+100, 50, 89, 54,157, 78,135, 51,103,206,184,235,100, 45, 31, 52,104,208,228,253,251,247, 75,126,253,245, 87, 73,139, 22, 45,192,
+227,241,192,225,112,192,225,112, 64,146, 36, 40,138,194,163,143, 62, 74,176, 73,144, 5, 11, 22,255, 25,161,165,213,106,179,227,
+227,227,153,218,239,161, 2,129,128,103, 83,203, 13,105,213,170, 85,134,237,121,174,154,171, 60, 2, 2, 49,183,153, 15, 0,224,
+195,187,114,203, 11,226,147, 30, 29, 45,199,124,156, 95, 9, 0, 16,137, 68, 32,172,171,209, 14, 32,145, 72, 48,104,208, 32,240,
+249,124,116,233,210, 5, 92, 46,215,238,198,227,241,192,229,114, 93, 70, 10, 65, 16,144, 74,165, 88,176, 96,129, 89, 36, 65, 34,
+ 20, 96,122,143, 46, 16,130,193, 87, 87,111, 65, 71, 51,160, 40,202,178,185,195,201,227,241,112,229,202, 21, 80, 20, 5, 14,135,
+ 99,249, 52,127,223,187,119, 47,158,125,246, 89, 80, 20, 5,145, 72, 4,184,152, 57,216,250, 25,233,116,186, 96, 62,159,175, 7,
+ 96, 22,103, 60,130, 32,130,238,231, 25,253,151,225, 41, 18, 96,194,250, 95, 0, 0,185,171, 94,183, 60,187, 51,175,125,104, 57,
+ 38,252,229,209, 32, 8, 2, 92, 46, 23, 36, 73, 54, 26,103, 89, 89,153,122,204,152, 49,167, 60, 60, 60, 14, 85, 85, 85,193,133,
+128, 67,110,110, 46, 40,138,114,152,222, 73,146,196,202,149, 43,241,231,159,127,186,117,239, 26,141, 6,155, 54,109,130,201,100,
+170,195,107,254,110,187,207, 77,145,181,104,240,224,193,227,247,239,223,239, 77, 16, 4, 62,255,252,115,240,120, 60, 12, 27, 54,
+ 12,190,190,190, 56,124,248, 48,120, 60, 30,222,121,231, 29, 54,241,177, 96,193,194, 89,153,199, 5,208, 17,128,127,173,137, 80,
+ 13,192,203,234,144,146,218, 79,127,243,111,130, 32,210,237,240,116,173, 61,166,132, 32,136,116,171,223, 58, 0,124, 59,251,229,
+ 0, 68,181,155, 22, 53,238,127,123,171,235,152,207,131,163,235, 82, 64,205,250, 67, 0,142, 3,232,155,144,144,112, 2, 0, 10,
+ 11, 11,135, 22, 22, 22, 2, 0, 34, 35, 35,111,100,100,100,180, 49,107,158,218,230, 41,158,209,104,140, 54, 55, 85,153,221,162,
+129, 3, 7, 58,173,225, 27,245,250,122, 2,196,158,150,178,215, 92,225, 72,192,232,245,122,140, 30, 61, 26, 0, 28,190,116,172,
+ 55, 55,180, 27,116, 58, 29, 40,138, 66,235,102,254,152, 55, 36, 30,143, 48, 6, 40, 21, 4,140,149, 74,140,144, 26,112,163,109,
+ 39,108,204, 41,193,221, 42, 5, 40,138,114,139,147,166,105,135, 34,139,195,225, 96,253,250,245, 24, 51,102, 12, 56, 28,142, 91,
+124,214,207, 40, 34, 34, 98,127, 70, 70,134, 47, 65, 16,218,218,103, 36, 48, 26,141, 50,163,209,232,107, 50,153,124, 27,242,140,
+254,203, 48,210,180,221,116,232, 40,205,186,243,156,220,225, 44, 43, 43, 83, 39, 36, 36,156, 22, 8, 4, 91, 3, 3, 3, 11,242,
+242,242, 92, 10, 45, 91,241, 99, 91,169, 88,177, 98, 5,214,174, 93,139,126,253,250,185, 21, 78,173, 86, 11,130, 32,176,113,227,
+198,122,255, 45, 92,184,176,222,245, 92,112, 18, 0,200,144,144,144,215, 14, 30, 60, 40, 51, 31,235,231,231, 7, 46,151,139, 14,
+ 29, 58,192,195,195, 3,167, 78,157,130,201,100,114, 59, 95,178, 96,193,226,223, 11,123, 90,196, 10,189,231,206,157,219,101,217,
+178,101, 75,186,119,239,190, 51, 53, 53,117, 7, 65, 16,137, 86,101, 98, 66,109,249,154,104,254,205, 48, 76, 87,107,209, 83, 43,
+214,252, 9,130, 72, 52, 31,111,253,219,252,201, 48,204, 64, 0,124,243,239,185,115,231,182, 95,182,108,217,146, 57,115,230,188,
+183,116,233, 82,222,220,185,115, 99,151, 45, 91,182,196,124, 29,123,225,176,231,104, 57, 93,123,202,220, 68,117,243,230, 77, 71,
+ 77, 84,214, 47, 0,167,165,165,196,207,223,226,100,125, 28,238,107,217,191, 32,175,194,242, 2, 91,215,185, 37, 36, 18, 9,134,
+124,252,169, 91, 78,145, 78,167, 67,113,113,177,197,101,112,181,185,203, 41, 22, 9,145, 52,179, 3,114,229,124,124,148, 86,134,
+253,151,254, 4,151,203,197,227,109, 59, 96, 40,207, 3, 31,132,243, 49,243,214, 29, 24, 24,247,250,244, 50, 12, 99, 87, 96,153,
+191,155,155, 80,220, 21, 90, 54,207, 40, 87,163,209,200, 51, 51, 51,213,116,205,139, 93,196, 48,140, 55, 65, 16,213,181, 46, 87,
+176,187,207,232,191,140,132,184, 40,139,235,116,198, 99,128,101,255,179,202, 43,150,103,242,214,250, 79, 0, 0,253, 58, 61,234,
+ 50, 63,184,195, 41,151,203,213, 61, 7,244, 61, 97, 82,235,182,140, 31, 63, 62,251,216,177, 99, 34,119,194,106, 79,104,153, 93,
+ 91,179,200,162, 40, 10, 58,157,206,173,123,215,233,116, 14,243, 7,143,199,187, 31, 71, 11, 74,165, 82,183,103,207, 30,172, 91,
+183, 14,190,190,190, 24, 60,120, 48,130,131,131,177,123,247,110, 48, 12,131,215, 95,127, 29, 34,145,200,236, 94,179, 9,144, 5,
+139,255, 54,156,105, 17,193,178,101,203,150,216, 10, 25,235,223,214, 2,202, 70, 76, 89,139,181,246, 46,222,255,137,182,226,201,
+124, 93,130, 32, 18,151, 46, 93,154,224, 34, 28, 37,142,132,150,211, 41,241,181, 90,109,118, 92, 92,156, 91,106, 66,165, 82, 21,
+186, 18, 27,246,106,245,214, 46,129, 84, 42,133, 68, 38, 5,233,102,185,107, 48, 24, 44, 66,229,200,145, 35, 16,137, 68, 24, 54,
+108,216, 3, 57, 90,122,189, 30,124, 30, 23,164, 95, 32, 38,172, 58, 6,121,181,218,242,130, 57,158,149,141, 11, 69,197,152,217,
+125, 0, 36,162, 98, 40,116, 58,183,156, 55,154,166,235,137, 44,138,162, 48,122,244,104,139,155, 96,221,111, 5, 78,154, 14,125,
+125,125,207, 81, 20, 21,102,245,140,132,145,145,145,192, 95,253,122, 8,154,166, 21, 94, 94, 94, 63, 3, 8, 97, 24, 38, 12,128,
+135, 59,207,136,133,253,244,105,187,159,182,113,170,238,135, 83, 46,151,171, 19, 18, 18, 78,155,212,186, 45,249,249,249,167, 1,
+ 8, 31,121,228,145, 6, 11, 45,179,192,226,114,185, 88,185,114, 37,214,174, 93,107,249,223, 93,161,101, 52, 26,235, 8,168, 91,
+183,110,213,185,150,173,176,115,209,108,202,160,102,116, 33, 29, 25, 25,105, 57, 39, 40, 40, 8, 94, 94, 94,160,105, 26, 52, 77,
+ 67, 40, 20, 66, 36, 18,129,199,227,177,137,142, 5, 11, 22,206,180,136,122,206,156, 57,239, 17, 4,145, 88,235, 44, 93,117, 34,
+168,236,105,143,174, 54, 98,173,196,193,113, 9,246,196,150,245,119, 51,230,206,157,219,222, 54, 28,246,154, 43, 45,165,170,205,
+180,251,117, 96,221, 68,213, 88, 47, 49,103, 47, 50,169,151, 12, 34,137, 4, 28, 14, 9,130, 32, 24, 87, 92,122,189,222, 82,240,
+ 79,157, 58,213,105,191, 21,119,251, 83,233,245,122,144, 20, 7,247,130, 34, 96, 34, 79, 90,206, 53,111, 36,197,197,221,160, 54,
+224,220,188, 8,174,155, 47, 92, 91, 71,235,245,215, 95,199,166, 77,155, 64,146,164, 37, 78, 40,138, 66,171, 86,173,144,157,157,
+237,148,139,162,168,176,187,119,239, 6, 88,199,163, 89,196, 50, 12, 3,147,201,132,168,168, 40, 77,102,102,230,155,108,214,125,
+ 48,145,229,104,191,201, 68,187,237,194,216, 59, 78, 46,151,171, 71,141, 26,117,162,178,178,114, 75,187,118,237,110,161,238, 20,
+ 8, 46,249, 40,138,170, 35,176,204, 34,107,205,154, 53,117, 68,145,193, 96,112,171, 34, 96, 48, 24,234, 9,158,207, 62,251,172,
+206, 39, 0,244,232,209,195, 45,103, 24, 0, 67,146, 36,195,227,241, 48,104,208, 32,196,198,198,226,215, 95,127, 5, 77,211,152,
+ 54,109, 26, 68, 34, 17, 86,175, 94, 13,163,209,136,229,203,151,179,142, 22, 11, 22, 44,156,105, 17,237,210,165, 75,175, 46, 93,
+186,212,226, 44,217, 58, 90, 14,222,187,195,107, 69,149,191, 89,164, 1,208,218, 19, 68,246, 92, 50, 91, 1,102,189,111,217,178,
+101, 75,108,195, 97,219, 92, 89, 71,104,253, 93, 40,188,118, 5,159, 62, 22, 15,160,110,115,225,250, 71,219, 64, 34,149, 64,226,
+ 33,197,168,189, 39, 1,160,182,208,159,227,150,163,101, 22, 90,114,185,220,169,200,106,136,163, 69,242, 41,252, 24, 86, 14,134,
+207, 5,165, 51,212, 17, 90, 28,138,139, 92,223, 8,144, 92, 30, 40,147,209, 45, 78,134, 97,234, 53, 21, 78,156, 56, 17, 4, 65,
+ 88, 70,136,197,197,197, 89,115, 17,174, 94,142,179,125,106,250,224,217, 54,199, 46, 47,213,176, 57,246,126,210,231,185,175,113,
+227,167,215, 0, 0, 61,149, 74,203,179, 88, 28,247,215,216,129, 85, 87, 78, 88,220,199,143,241,246,125,113,202,229,114,245, 35,
+ 49,237, 79,243,124, 60,183,228,228,228,156, 6, 64, 62,247,220,115, 94,113,113,113,110,229, 73,243,224, 10, 91,145,101,237,100,
+153, 63, 93,140,176,181, 18,142, 38,183, 4,148,185, 25,209,141, 52,207,152,211,182, 76, 38,131, 84, 42,181,140,184, 21, 10,133,
+ 16,139,197,150,254,157,110, 10, 55, 22, 44, 88,252,119,225,109, 22, 58,181, 98,169,142,211, 84,219,183, 42,193,250,183, 61,199,
+171,214,129, 74,118, 81,190,238,175, 21,104,118, 97,118,214,108,206, 73,116, 36,210, 40,179,130,180,254, 12, 10, 10,250, 77, 42,
+149, 70,184,123,247, 13, 25,197,102, 50,232,235, 57, 91, 4, 65, 64,234, 33,133, 72, 42,129,200, 67,234,208,245,114, 38,180,204,
+ 78,145,249,165,179,117,235, 86, 72,165, 82, 76,154, 52,169,193,125,180, 44, 66,139, 71,226,176,224, 40, 56,124,170,142,200,162,
+ 40, 10, 28, 46, 23,133,210, 96,144, 92, 46, 40,163,123, 46, 89,101,101, 37, 40,138,194,188,121,243, 44, 53,120,107,145,213,144,
+123,118, 6,146, 32,204,238,150,160,101,203,150,111, 19, 4, 17, 14,160,133, 82,169, 20,220,187,119,175, 63,155, 95,157, 40, 3,
+147,161,158, 11,229,200,125,189, 95, 78,179,147,197,243,241,220,210,166, 77, 27,139,147, 37, 22,139,205,163, 77, 93, 63, 99,146,
+180, 43,178,108, 71, 8, 82, 20, 85,147,150, 93,140,142,180,118,180,150, 46, 93,106,225,181,118,178,204,104, 72, 62, 50,135,245,
+196,137, 19,184,112,225, 2,166, 78,157, 10,145, 72,132,181,107,215,194,104, 52, 98,225,194,133, 16,137, 68,224,243,249,108,226,
+ 99,193,130,117,179,234,104, 17, 27,148,216,244,131, 34,108, 68, 77,137, 61,129,101,221, 76,104,254, 78, 16,132,193, 14,175,206,
+166, 73,209,118,191,249, 83,190,116,233,210, 99,102, 39,203,106,127,157,112,184,116,180, 4, 2, 65, 68,102,102,166,101, 34, 76,
+103,159, 58,157, 14,253,250,245,115,219, 25, 51,143, 58,164, 40, 78, 29, 97, 33,246,144, 66, 44,243,128, 72, 42,181, 21, 28,132,
+171, 66,220, 92, 35,182, 22, 90,243,231,207, 7, 69, 81,216,180,105, 19, 0,224,237,183,223,118,187,143,150,153, 19, 38, 2,121,
+204,109,196,175,122, 22,186,239, 12, 40, 74,249, 3, 20, 69, 33,160,219, 80,208,143, 60, 11,149, 72, 10,202,100,116,123,212, 97,
+ 89, 89, 25,178,179,179,193,225,112, 48,107,214,172, 58,115, 29,217,142,100, 59,114,228,136,203,123,183,231,100,205,207, 41,179,
+240,136, 68, 34,242,143, 63,254,136,160,105, 58, 82,173, 86,183,236,209,163, 7,205,102,101, 23,162,136, 54,186, 37,170,220, 77,
+159,182,156,230, 62, 89,149,149,149, 91,114,114,114,206, 0, 32,199,143, 31,239, 37, 22,139,241,205, 55,223,168, 0,240,119,239,
+222, 45,114, 37,138,204,233,198,149,200,226,114,185, 53,105,217,157,123,103,234, 78, 89,226,170, 99,188, 59,105,222, 28, 86,130,
+ 32, 96, 50,153, 32, 18,137,234, 56, 89, 66,161, 16, 2,129,128, 77,120, 44, 88,176,112, 85,150,164,187, 93,142, 51, 76, 87, 43,
+ 81,149,126, 63,188, 13,185,158, 43, 80,142,132,134, 86,171,197,245,235,215,221,229,113,123, 98,204,102, 93, 30,197,199,249,149,
+ 32, 8, 2, 95,245,104, 7,137, 76, 10,177, 68,130,145,191,158,176, 20,220, 87,150,188, 13,129, 68,138,144, 94,131,221, 42,200,
+205, 77,135,214, 66,171,162,162, 2, 92, 46, 23,139, 22, 45, 2, 73,146, 88,190,124, 57, 66, 67, 67,113,239,222, 61,236,222,189,
+219, 45, 71,139, 99,226, 32,248,133, 24,136, 39,122, 66,246, 66,111,120, 15,154,143,124, 29,133, 84,141, 24,189, 53,215,192, 63,
+188, 6, 58,218,228,246, 8, 44,163,209,136, 19, 39, 78,216,118,120,183,244,169, 50, 26,141, 48, 24, 12,208,235,245, 88,190,124,
+185, 59, 35, 60,235, 61, 55,115, 28,214, 78,130,202,201,200,200,240,103, 24,198, 7,128, 39,128, 82, 54,187, 58, 71,112,183,215,
+225,223,229, 85, 0,192,222,165, 47, 90,246,207,187,242, 87,250, 92,249, 93,205, 2, 0,109, 90, 12,110, 16,167, 92, 46, 87, 63,
+222,175, 71,178,134,230,110,238,208,161, 67, 29, 39, 75, 40, 20, 18,181,191,221,178,203, 72,146, 4,135,195,169,215, 92,232, 72,
+108,185,211, 71,203,104, 52, 90, 38, 18,117,214,159,241,126, 28,173, 23, 95,124, 17,193,193,193, 22, 39,235,227,143, 63,134, 72,
+ 36,194,220,185,115, 97, 48, 24,176,102,205, 26, 54,241,177, 96,193,226,111, 23,101,127, 7,236,150,164, 26,141,230, 78,108,108,
+ 44, 28,252, 23, 42, 20, 10,185, 54, 55, 21,210,170, 85,171, 12, 59, 77,136, 3, 1, 36,217, 43,212, 9,130,128,135,204, 3, 66,
+169, 4, 98, 27, 23, 75,232, 33,131, 64, 42, 5,201,179, 91,152,215,227, 52,247, 45,177, 22, 90,230,173,178,178, 18, 92, 46, 23,
+235,214,173,131, 76, 38,131, 86,171,117,201,105,126,233,112, 56, 28,168,114,171,113, 99, 73, 18,248,194, 84,180, 28, 60, 6,193,
+ 92, 17,120,167,126,134,218,100,112, 53, 97,105, 61,206,232,232,104,124,248,225,135,245,166,117,112,132,208,208, 80,151,247,110,
+235,100,173,108,215, 28, 60, 62, 15,111, 93,203,133, 86,171, 37,198,140, 25, 67, 3, 80, 3, 40, 81,171,213, 57,238,196,103, 35,
+224,161,231,116, 54, 42,214, 12,154, 49,217, 19, 48,118, 57,205, 78,150,134,230,110,206,206,206, 54, 59, 89,158, 98,177, 24, 27,
+ 54,108, 80, 1, 32, 23, 46, 92, 40, 14, 15, 15,231,184,147,150, 56, 28, 14, 86,173, 90,101,183, 79,150, 61,209,213,144,124,100,
+125,110,159, 62,125,236, 78, 88,234, 64,188,213,227, 52,135,213,215,215,215,226,100,153, 76, 38,203,104, 67,243,236,243, 78, 42,
+ 21,108,250,100, 57, 89,206,255, 14,231,191, 18,118, 75,224,123,247,238, 61,238,232,132,168,168,168,204,204,204,204, 86,230,165,
+ 56,106, 11, 78,158, 70,163,137,238,209,163,135, 75,107,135,166,105, 8, 4, 2, 48, 12,131,254, 31, 46, 3, 65, 2, 36,234,190,
+196, 2, 30, 27, 0, 14,135, 2, 93,179,212,135,203, 81,135,106,181,186,206,203,193,222,166, 80, 40,160,213,106,221,158,205, 91,
+163,209,212,153,130,129, 96,104,220,253,125, 87,189,209,135,230,205,221,126, 59, 66,161,176, 78,211,143, 11,199,138,112,199,209,
+178,110,122,228,241,121,160,120, 92,179,163, 85,125,235,214,173, 81,108, 50,119, 31,230, 1, 11, 0,208,186,199, 48,208,180, 9,
+140,201, 84,103,153,164,152,136,199, 65, 51, 38,232, 13, 42,104,181, 90, 87,211,158, 16,165,165,165,234, 81,163, 70,157, 0,240,
+237,136, 17, 35, 50, 80, 51,187, 48, 35,149, 74, 5, 92, 46,151, 6, 80, 6,128, 41, 47, 47,247,204,207,207,167, 53, 26, 77,115,
+ 87,225,220,191,127, 63,174, 95,191,142, 94,189,122,213, 89, 14,202,236,138, 90,207,238,238, 78,250, 52, 55,151,219,155, 17,222,
+145,144,115, 23, 28, 14, 7,158,158,158,224,241,120, 88,180,104, 17,120, 60, 30,196, 98, 49, 0, 96,205,154, 53,150,201, 87, 89,
+176, 96,193,226, 63, 35,180, 92,149,155, 78,154, 21,157, 54, 33, 26,141,198,188,240,240,240, 6, 93,204,100, 50, 21,185, 16,110,
+121,187,119,239,230, 89,187, 16,174, 62, 25,134, 41,114,241,178,205,219,187,119, 47,207,158,187,225,104,129,105, 87,156, 38,147,
+ 41,175, 69,139, 22, 14, 29, 19,123, 48, 24, 12,249,174, 68,235,178, 18,117, 29,145,240,214,181, 92,135,107, 39,178,112,153,214,
+156,164,207,247,239, 55,125,222,106,221,186,117,190,151,151,215,129,192,192, 64,121, 74, 74,138,111,215,174, 93,125,173,143,233,
+218,181,107,176,205,105, 58, 56, 94,231, 16, 4, 65,228,141, 24, 49,194,110,154, 55,139, 38, 59,233, 51,207, 85,154, 63,123,246,
+ 44,207,250,124, 71,252, 86,249, 40,207, 13,225,122, 55, 62, 62,158,180,230,113,148,246, 13, 6, 67, 9,155, 10, 89,176, 96,241,
+159, 23, 90,106,181, 58, 55, 54, 54,214,232,224,191, 28,103,231,202,229,242, 46,141,125, 3, 6,131,161,199,195,192, 89, 90, 90,
+218,168,247,110, 52, 26,243,106, 39, 40,117,122, 12,155,196,255,185,103, 4, 0,197,197,197,143, 0,128, 82,169,132,171,101,117,
+ 26, 32, 8, 27, 61,125, 26,141,198, 30, 77, 17,167,101,101,101,221,217,148,197,130, 5, 11, 86,104, 53, 0,236, 98,196,255, 31,
+104, 10,209,202,130, 5, 11, 22, 44, 88,176,104, 92,144,108, 20,176, 96,193,130, 5, 11, 22, 44, 88, 52, 13, 8,212,140, 28,176,
+135,134,140, 38, 24,120, 31,215, 78, 98, 57, 89, 78,150,147,229,100, 57, 89, 78,150,243, 63,199,233,138,155, 29,205,216,196, 2,
+140,229,100, 57, 89, 78,150,147,229,100, 57, 89,206,255, 30,231,191, 18,108,211, 33, 11, 22, 44, 88,176, 96,193,130, 69, 19,129,
+ 98,163,224, 31, 3, 7, 13,152, 81,223, 21, 24,134,241, 6,224,104,193, 56, 29, 65, 16,229,247,193, 73, 0,224,213,110,230,137,
+142, 12, 0,244, 0,244, 4, 65, 48,174, 57, 62, 34, 11, 10,188,219, 51, 38,110, 87,134, 32,184, 52,141, 75,205,155, 55,187, 72,
+ 16, 67,117, 0, 32, 9,140,105, 43,149,136, 6,106,245,186, 8, 1,151,127,189, 66,169, 56,162, 45,206,188,195, 38, 15, 22, 44,
+254, 17, 60, 1, 96, 1,106,186,149, 44, 5,176,139,141, 18, 22, 44,154, 72,104, 73,165,210,115, 36, 73,134,185,154,159,199,140,
+218,181,204,242,202,203,203,187, 52,224,218,163,164, 82,105, 63, 46,151,251, 24, 0, 24, 12,134, 20,133, 66,113, 12,192,110, 0,
+198,251,188, 39, 25,128,209, 0,198,213,254,254,190,182,176,168,186, 79,190, 88, 79, 79,207,159,184, 92, 46, 83, 90, 90,218, 13,
+ 0,124,125,125, 79, 27, 12, 6,162,170,170,106, 36,128,203, 13,228, 35,185, 92,238,202,110,221,186,245, 62,121,242,228,183, 0,
+214, 53,210,179, 20,144, 36,105, 87,160,208, 52,221,226, 62, 68, 22, 15,128,231,186,117,235,124,183,111,223, 30,159,151,151,215,
+ 1, 0,194,194,194,174,140, 31, 63,254,226,244,233,211,229, 12,195, 84, 18, 4,161,119,198, 83, 80,224,221,190,184, 48,107,106,
+ 81,241,245,209, 0, 16, 20,220, 97, 23,135, 67,242, 24,230,124,154,216,111,156, 95,171,150, 45, 94,221,249,205, 58, 94,139,136,
+102, 56,154,122,161,227,244, 55,223,107,159, 15,172, 96,197,214,223, 7, 15, 15,143,115, 36, 73,134, 57,203,227,246,242,188,201,
+100,202, 43, 43, 43,235,226,136,147,162,168, 48,103,229,133,189,125, 52, 77,103,149,150,150,218,157,106, 66, 38,147,165, 81, 20,
+ 21,225, 46,151,249,211,104, 52,230, 57, 26,165, 43,147,201,206,113, 56,156, 48,103,247,105,239, 63,154,166,179, 74, 74, 74, 28,
+133,179,222,189, 55, 70, 56,239,135,211, 89, 56,205,229, 17,128, 53,190,190,190,143,202,229,242,231, 1,188, 87, 85, 85, 21,199,
+225,112,224,227,227,243,158, 78,167,251,211,211,211,243,235,202,202,202, 84, 0,111, 2, 96,215, 75,101,193,162,177, 32,147,201,
+138, 20, 10, 5, 99, 6, 77,211,140,193, 96, 96,180, 90, 45,163, 86,171, 25,165, 82,201, 40, 20, 10,166,170,170,138,169,172,172,
+100,228,114, 57,227,239,239,111, 59,121,163,163, 54,220, 14, 50,153, 44,115,217,178,101,218,236,236,108, 70,175,215, 51,122,189,
+158,185,115,231, 14,243,233,167,159,106,101, 50, 89, 38,128, 14, 14,206, 29,232,160,176, 24, 4, 96, 71,124,124,188,110,255,254,
+253,140, 70,163, 97,148, 74, 37,179,107,215, 46,166, 93,187,118, 58, 0, 59,106,143, 33,221,228, 4,128,158, 65, 65, 65,121,183,
+111,223, 54, 29, 57,114, 68,239,233,233,153,228,233,233,153,116,231,206, 29,211,237,219,183,105, 63, 63,191, 60, 0, 61, 27, 16,
+ 78, 0,120,246,173,183,222, 42,186,115,231, 14,211,167, 79,159, 75, 86,251, 9,184, 94,231,110,160, 61, 39,139, 97,152, 32,134,
+ 97,130, 81, 51,201,101,189,141, 97,152,224,218, 99,188,221,228,148,100,101,101, 53, 11, 12, 12, 92, 70, 16,132,206,150,143, 32,
+ 8, 93, 96, 96,224,178,172,172,172,102, 12,195, 72,156,113,230,229,172,127,233,192,254, 1, 21,202,242,155,140,178,252, 38,243,
+237,230,190, 85,175, 76,127,126, 71,112, 84,167, 77, 94, 97,237,215, 93,191,121,107, 35,195, 48, 27,143,165,103,110,156,255,229,
+111, 27,159,158,190,122,131,111,120,252, 43, 13,136,207, 7, 1,203, 9,192,203,203,171, 80,169, 84, 50, 12,195, 48, 38,147,137,
+209,235,245,140, 86,171,101, 84, 42, 21,163, 80, 40,152,234,234,106, 75, 62,175,172,172,180,124, 15, 8, 8,112,152,223,189,189,
+189,139,212,106,117,157,178, 67,167,211, 89,202, 15,149, 74,197,168, 84, 42, 70,169, 84, 90, 54,133, 66,193,132,132,132,228, 58,
+ 9,231, 61,115, 56,105,154,102,140, 70, 35,163,215,235, 45,188, 26,141,166,206,166,213,106, 25,173, 86,203,132,135,135,187, 29,
+ 78,119, 56, 53, 26, 13, 19, 22, 22, 86,224,136,211,199,199,167, 72,163,209,212,225,180,190,127, 91, 94,243,239,160,160,160,194,
+134,112,186, 19, 78,103,241, 89,139,117, 25, 25, 25,140, 90,173,102, 66, 67, 67,229, 35, 71,142, 52,152, 76, 38,102,255,254,253,
+ 76,124,124, 60,221,183,111, 95,125,105,105, 41, 51,105,210, 36,198, 73,165,144,205, 71, 44, 39,139,251,113,180, 8,130,128, 68,
+ 34,193, 15, 63,252,224,112, 57, 14,235,239,205,155, 55,119,247,154, 93, 34, 34, 34, 78,156, 58,117, 74, 20, 28,252,215,132,216,
+ 58,157, 14,222,222,222,152, 54,109, 26,255,137, 39,158,104, 53,120,240,224,211,119,239,222,237, 3,224,156, 11,190,103,252,253,
+253, 63,159, 55,111, 94,224,115,207, 61, 7, 95,223, 58,147,110, 99,212,168, 81, 24, 57,114, 36, 47, 35, 35, 99,204,214,173, 91,
+199,172, 95,191,190, 80,161, 80, 76, 7,240,179, 51, 82,145, 72, 52, 34, 36, 36,100,195,169, 83,167, 2, 2, 2, 2, 16, 25, 25,
+ 73,190,243,206, 59,173,162,163,163, 69, 97, 97, 97,228,189,123,247,240,235,175,191,134,142, 29, 59,246,199,162,162,162, 87,245,
+122,253, 30, 55,238,157,239,235,235,251,222,171,175,190,234, 87, 85, 85,101, 60,127,254,124,166,121, 63,159,207, 95,216,189,123,
+247,174,199,143, 31,255, 14,192,215,247,227,100, 49, 12, 83,133,191,154,248,204, 48,152,255,119,199,217, 98, 24,134,127,233,210,
+ 37,159,238,221,187,255,172,213,106, 59, 77,157, 58, 53,103,201,146, 37, 34,153, 76, 38, 3, 64, 84, 85, 85,149, 47, 88,176, 64,
+183,122,245,234,119,219,182,109, 59, 32, 45, 45,237, 25,134, 97, 12,181,130,172, 62, 31, 65, 88,194,147,155, 95,130, 19,169, 52,
+255,195,185,111,135,125,178, 56,226,110,250,181, 92,154, 18,201,176, 47,249, 42,138,228, 10,252,150,118, 13, 65,190, 30, 4, 79,
+192,109,239, 25,218,174, 79,101,254,181,100, 56,153, 33,157, 69,227,128, 32, 8,136,197, 98,236,219,183,175,222,210, 85,246,150,
+181,162, 40, 10, 94, 94, 94, 46, 87, 55, 16, 10,133, 56,114,228,136,221,181, 23,237, 45,233,227,233,233, 9,103,149, 13,130, 32,
+ 32, 20, 10,145,146,146, 2,146, 36,237, 46, 13,100,187, 79, 34,145,128,116,178,214,149,153, 51, 57, 57,217, 37,151,249, 83, 42,
+149, 2, 53, 77,255,142, 51,165, 64,128, 83,167, 78, 57,188,103,219,239,210,218,245, 94, 93,113,166,164,164,212, 89,250,203,118,
+ 73, 48,235,223, 18,137, 4,132, 11, 82,111,111,239,110, 97, 97, 97, 56,123,246, 44,118,239,222,237,211,190,125,123,220,186,117,
+ 11, 4, 65, 96,201,146, 37, 68,187,118,237,184,133,133,133,232,213,171, 23,126,249,229,151, 30, 85, 85, 85,108,134, 97,241,143,
+128, 97, 24, 46,128,142, 0,252, 81,211,237,166, 26,128, 23,106, 86,210,224, 3,144, 3, 16,213,110, 90, 0, 10, 0,126,181,167,
+151,214,150, 45,214, 2,161,196,122,241,105,134, 97,186,214,114,155, 87,168,240,183, 58,214,124, 13,219,223,182,159,118,185, 41,
+ 0, 72, 76, 76, 52,191,204,250, 38, 36, 36,156,176,190, 57,119, 68,150,121,157, 50, 59,121,218,118,136,166, 64, 34,145,252,116,
+250,244,105,145,191,255, 95,247,160,213,106, 81, 93, 93, 13,133, 66,129,234,234,106,120,120,120, 96,247,238,221,162, 1, 3, 6,
+252, 84, 93, 93, 29, 93, 27,105,142, 56, 87,221,187,119, 47,208,104, 52,130,207,183,223, 69,137, 36, 73,196,196,196,224,189,247,
+222,195,144, 33, 67,130,250,245,235,183,202, 70,104,213, 27, 74, 42, 22,139, 55,156, 63,127, 62, 64, 44, 22, 35, 51, 51, 19,121,
+121,121,120,235,173,183,154,209, 52,141,220,220, 92,220,186,117, 11,249,249,249,216,186,117,107,192, 83, 79, 61,181,193,142,208,
+178, 55, 60,117,234,204,153, 51,219,120,123,123,147,159,126,250,105,133, 82,169,252,162,118,255,135,107,215,174,125,161,119,239,
+222, 1, 83,166, 76, 97, 82, 82, 82,182,215, 62, 56,135,241,105,221, 39,171,182,153, 15,181,137,239,134,205, 57, 49, 86,255,131,
+ 97,152, 32, 0, 90,130, 32, 42,236,112, 18, 0, 60, 7, 15, 30, 60, 75,171,213,118, 58,117,234,212,159,143, 61,246, 88, 56,128,
+123,230,196,231,233,233, 41, 89,181,106, 85, 96, 66, 66, 66, 70,255,254,253, 59, 13, 30, 60,120, 86, 73, 73,201, 18,134, 97, 74,
+172,250,108, 89, 56,105, 26,151,130,130, 59,236, 74, 78,155, 62,250,120,138,142,247,246,155,243,115,154, 55,107, 81,121, 41,179,
+204,116, 45,171, 4,213,106, 35,158,238, 95,179,128,121,183, 14,205,241,249, 15,167, 48,109,198,251,220,159,119,109, 27,249, 39,
+ 3,137,162,224,218,126, 39,241,249,160, 96, 57, 97,105, 98, 2,151,203,197,208,161, 67, 65, 16, 68,189,181, 60,185, 92, 46,210,
+210,210,208,191,127,127,112,185, 92,188,248,226,139,110,113, 82, 20,133,193,131, 7, 91,214, 81,180,230,179, 21, 13, 14, 52, 65,
+146, 77, 97, 11,138,162, 64,146,164,195,133,180,109, 57, 93,149, 75,230,112, 58,227,178,254,207, 85, 56,107,151, 60,114, 91,100,
+185,203,105, 14, 39, 69, 81,232,209,163, 7, 46, 94,188,232, 84,116, 57,208,151,117,238,189,188,188,124, 66,116,116,116,242,186,
+117,235,124, 0, 64, 46,151, 91, 22,188,231,112, 56,184,121,243, 38,116, 58, 29, 62,250,232, 35,125, 85, 85,213, 20, 54, 31,177,
+156, 77,201,233, 76,139, 0,232, 61,119,238,220, 46,203,150, 45, 91,210,189,123,247,157,169,169,169, 59, 8,130, 72,100, 24, 38,
+193,252, 57,119,238,220,246,203,150, 45, 91, 50,103,206,156,247,150, 46, 93,122,149, 32,136, 68, 0,176,253, 93, 91,150, 36,216,
+136, 56,127, 51, 79,109,158,171,115,172,189,223,182,159,246,184,235, 56, 90, 9, 9, 9, 68,237, 77, 18,214,133,154,187, 66,203,
+157,181,251, 40,138,122,125,201,146, 37,129,206, 68,150, 66,161, 64, 65, 65, 1,194,195,195,241,226,139, 47, 6,174, 91,183,238,
+117,163,209,248,153, 19, 90, 30,135,195,193,217,179,103, 81, 92, 92,140,216,216, 88, 68, 68, 68,212, 57,224,246,237,219, 56,112,
+224, 0, 42, 42, 42,208,185,115,103,160,166,115,183, 93,196,197,197,125, 20, 19, 19, 51,152, 36, 73,163, 72, 36,194,165, 75,151,
+208,169, 83, 39,252,240,195, 15,104,222,188, 57,196, 98, 49, 50, 50, 50, 16, 27, 27,139, 19, 39, 78,192,223,223, 31,241,241,241,
+198,170,170,170,147,101,101,101,199,238,222,189,251,145,163,112,134,134,134,206,127,229,149, 87,248, 5, 5, 5,244,150, 45, 91,
+ 78, 1, 56, 5,224,245,247,223,127,127,242,144, 33, 67, 2, 46, 92,184, 80,153,158,158,126,198,129,200,114,199,201, 50,218,190,
+148, 76, 38,147, 86,173, 86,235,180, 90,173,129, 36,201, 59, 4, 65,232, 76, 38, 83,180, 35, 19, 98,226,196,137, 81,165,165,165,
+211,102,204,152,145, 93, 43,178,110,162,166, 3, 60, 0,192,104, 52,106, 21, 10, 69, 85,247,238,221,195,199,142, 29,251,231,142,
+ 29, 59,166, 77,156, 56,113,247,150, 45, 91, 20, 0,212,182,132,205,155, 55,187,200,225,144, 60,101,181, 79,214,143,187,191,158,
+121, 96,239,235,205,114,115,243, 91,249,250,249, 43,121, 82,255,130,221,223,111, 62, 7, 64, 87, 80, 82,133,203,183, 11,193,229,
+114,112, 61,183, 18,189, 31, 31,197,253, 51,115,113, 79, 0,251,217,186, 92,211, 87, 22,205,139, 80, 31, 63,126,220,169,163,149,
+150,150, 6, 46,151, 11,145, 72,132,213,171, 87, 59, 37, 53, 11, 3,179, 91,228, 74,204,152, 23, 71,119,230, 62,209, 52,109, 89,
+232,221,118,251,226,139, 47, 48, 99,198,140, 58,215,168, 21, 27,132, 43, 78, 71,225, 11,111,209, 2,197, 69, 69,117,246,185,179,
+ 40,189,201,100, 2,151,203,197,166, 77,155,144,144,144,128,196,196, 68,167,159, 67,135, 14, 5, 73,146,140, 59,241,217,163, 71,
+ 15,232,245,122, 75,152,111,222,188,105,151,119,253,250,245,174,130,249, 4,128, 5,157, 58,117,146,245,235,215, 15,201,201,201,
+ 24, 57,114,164, 86,175,215,103, 2,192,240,225,195, 91,175, 91,183,142,127,254,252,121,248,250,250,114,115,114,114,190, 5,219,
+ 65,158, 69, 19,195,158, 22, 49,191,243,150, 45, 91,182,196, 86,196, 88,195,252, 63, 65, 16,137, 75,151, 46, 77,176, 22, 69,214,
+191,205,174,147,141,136,107,111,237, 72, 89,139, 40, 71, 2,202,230,125,107,125,124,137, 93,161, 85,123, 99,125,173, 93, 32,115,
+225,235, 74,100, 57,169, 57,214,129,167,167,231,176,167,159,126,218, 34,114, 52, 26,141, 69, 96,153, 69,150,249,119, 70, 70, 6,
+186,116,233,194,243,244,244, 28, 38,151,203, 63,115, 67,196, 33, 36, 36, 4,165,165,165,184,114,229, 10,194,195,195, 97, 48, 24,
+112,232,208, 33, 84, 86, 86,130,203,229,130,199,227, 65,175,119,218,119, 27, 49, 49, 49, 67,183,111,223,222,101,219,182,109,229,
+230, 26,221,247,223,127, 15,134, 97,224,239,239, 15,149, 74,133,162,162, 34, 28, 59,118, 12, 70,163, 17, 82,169, 20,145,145,145,
+252, 17, 35, 70,244, 92,176, 96, 1,215,137,208,234, 49,114,228, 72, 79,153, 76,134, 55,223,124,147,209,235,245, 75,107,247,205,
+159, 62,125,186,239,157, 59,119,116, 47,189,244,210, 89,189, 94,255,169,217, 76,180, 22, 56, 14, 30,172, 67, 39,203, 96, 48,152,
+227, 52, 91,161, 80,192,207,207, 47,220,218,217,114, 36, 6, 83, 82, 82,122, 0,224, 44, 92,184, 80, 8,160,200, 58, 12, 58,157,
+ 14, 10,133, 2, 74,165,210, 80, 89, 89, 89, 60,123,246,108,227,142, 29, 59, 56,181,231, 92,183, 39,180, 8, 98,168, 78, 38, 19,
+243, 25,134,243,254,198,141, 27,165, 67,134, 12, 33,165, 82, 41,170,171,171,101,191, 29, 60, 40, 29,208,175,103,228,146,101,159,
+ 28,150,133,197, 22,165, 92,202, 66,126, 97, 37,116, 6, 3, 34,131, 61,107,252, 48, 22, 77,142,218,129, 44, 22, 71,203, 90, 84,
+ 36, 39, 39,227,241,199, 31,183,228,117, 30,143, 87,199,249,114,197, 73, 81, 20, 30,127,252,241,122, 14,207,241,227,199,237,186,
+ 79,174, 96, 45,138,108,197,145, 61, 1, 70,146,164,203, 5,214,205,110,158, 61,177,101,237,234,219,136, 55, 87,205, 28,160, 40,
+ 10,211,167, 79, 7,151,203,197, 59,239,188, 3,138,162, 16, 31, 31, 15,138,162,208,189,123,119,112,185, 92,244,239,223,191,193,
+247,126,250,244,105,116,234,212,201, 18,166,248,248,120,116,237,218, 21, 20, 69,161, 87,175, 94,224,114,185, 24, 60,120,176, 59,
+156,239, 85, 87, 87,199, 73, 50, 7, 8,223, 0, 0, 32, 0, 73, 68, 65, 84,165, 82,100,100,100,128,195,225,128, 32,136, 91, 0,
+226, 0, 32, 56, 56,248, 79,149, 74, 21,165,209,104,240,202, 43,175, 16, 58,157, 46,246,157,119,222,121, 95,163,209,176, 66,139,
+ 69,147,193, 86,139, 88, 65, 61,103,206,156,247, 8,130, 72, 52, 59, 84,182,206,147,189,223,118,202, 38,179, 3,149, 94,155, 87,
+187,218,136,184, 18,130, 32,210, 25,134, 25,238,232, 92, 0, 58, 27, 97, 85,167,233,208,186,217,208,165,163,101, 46,124,221, 21,
+ 90,174,160,209,104, 58, 6, 4, 4, 56, 20, 89,214,159, 58,157, 14, 17, 17, 17,208,104, 52, 29, 27,250,210, 8, 14, 14,134, 94,
+175,199,215, 95,127, 13, 30,143, 7, 30,239, 47,125,161,211, 57, 55,139,174, 93,187,150,125,250,244,233, 78,157, 59,119,246,254,
+229,151, 95, 74,250,244,233,227, 63,100,200, 16,136, 68, 34,168,213,106, 24, 12, 6,116,235,214, 13, 49, 49, 49,200,203,203,195,
+111,191,253, 86, 26, 29, 29,237,119,230,204, 25,186,176,176,240,174, 19,234, 65, 3, 6, 12, 0, 65, 16, 56,120,240, 96, 41,128,
+116,129, 64,112, 96,241,226,197,222, 58,157,142, 30, 63,126,124, 78, 89, 89,217, 12, 0,122, 62,159,191,182, 79,159, 62,221,147,
+146,146,190,163,105,122,117, 67, 19,170,109,220, 42,149, 74, 8,133, 66,119,166,146,224,150,149,149,117, 0, 0,137, 68,226, 3,
+224, 79, 75, 10, 87,171,235,136, 97,157, 78,167,241,241,241,145, 0, 64,237, 57, 92, 7,156,254, 70, 35,126,188,123, 55,203,195,
+186,255,156,151,151, 23,198,141, 29, 75, 62,214,163, 7, 63,174, 99,199,193, 31,172,216,246, 67,136,175, 76, 23, 25,226, 11,131,
+201,128,164,195,135,104,134, 54, 28,102,139,157,191, 71,104,153,197,134,173,163,197,229,114,113,226,196,137,122,251,120, 60, 30,
+190,250,234, 43,183,132,129, 89, 84, 57,106, 58,179,105,234, 34, 92, 9, 24, 46,151, 11, 14,135,131, 77,155, 54,129,166,105,204,
+156, 57,179, 78,115,162, 53,191, 91,118,158,149, 8,140,153, 79, 3,208, 33,111,165,192,114,190,109,120,107,207,113,203, 37, 91,
+183,110,157, 91,142,214,240,225,195, 93, 10, 87,235, 22, 6,235,112, 93,188,120,209, 46,239,198,141, 27, 93,198,167,201,100,194,
+254,253,251, 45, 34,213,140, 15, 62,248,224, 21, 62,159, 31,120,242,228, 73, 20, 22, 22, 66,169, 84, 66,161, 80,160, 91,183,110,
+145, 36, 73, 94, 42, 44, 44,188,115,253,250,245,167,217,220,195,226,111,116,180,180, 75,151, 46,189,186,116,233, 82,187,142,149,
+173,179,228,204,121, 50, 11,172, 90, 65,228,111, 22,111,168,233, 86,147,238,234, 92, 0,124,219,166, 67,167, 70,144,141,138, 92,
+ 96,175,240,117,167,249,208, 77, 59,157, 34, 8, 2, 26,141,198,174,192,178, 22, 7,122,189, 30,101,101,101, 48,153, 76,247, 61,
+215,151,189,154,172, 43,161,117,229,202,149, 73,147, 39, 79, 46,240,244,244,140, 43, 41, 41, 41,166,105,186,127, 90, 90,154, 63,
+ 69, 81,144,201,100,144,201,100, 56,112,224, 0,196, 98, 49,166, 79,159, 94,108, 50,153,146, 61, 60, 60,124,213,106,245, 31,133,
+133,133, 31, 56, 84, 48, 92,238,224, 94,189,122,225,252,249,243, 40, 47, 47, 63, 2, 32,254,249,231,159,127,188, 89,179,102,196,
+226,197,139, 53,183,111,223, 94, 13,160, 88, 34,145,108,223,190,125,123,191,206,157, 59,123,140, 31, 63, 30, 39, 78,156,216, 8,
+ 64,227,238, 61, 43,149,202, 58, 2,171,170,170, 10,213,213,213,144, 72, 36, 70, 55,227,140,139,191, 70, 24,130, 97, 24,203,179,
+169,117,179,204,207,135,161, 40,202, 60,170,209,145,200,130, 68, 34, 89,184,109,219, 54,145,237, 32, 5,147,201,132,162,162, 34,
+200,100, 50,204,251,224, 3,222,199,111, 77,233,196,145, 6,166,145, 36, 1,157,158,169, 96,104,221, 33,101,209,115, 39,129,143,
+216,146,231,111,128, 89, 24, 60,249,228,147,245,154, 11,121, 60, 30,142, 28, 57,130,167,158,122,202, 82,113,233,220,185,179,203,
+202,149, 89, 24, 60,241,196, 19, 22,103,232,208,161, 67,118,155,253,204,142,148, 59,130,208,124,236, 27,111,188, 1,138,162,240,
+249,231,159, 99,214,172, 89, 32, 73, 18, 43, 87,174, 4, 73,146,248,240,195, 15,221, 22,153,214, 2,230,206, 39, 53,159, 97,179,
+170, 32, 95, 31, 8, 0,240,144,201,204, 55,212,160,178,135,162, 40,139,147,213,177, 99, 71,112,185, 92,116,239,222, 29, 20, 69,
+ 89,156,172, 97,195,134, 89,199, 35,227, 14, 39, 69, 81,200,204,204,180,132,185,123,247,238,117,156, 44,138,162, 48,124,248,112,
+119,130,185,196,203,203,107, 65, 76, 76, 76,219, 85,171, 86,113, 57, 28, 14, 6, 12, 24,208, 58, 40, 40,232,174,209,104,244, 93,
+184,112,161,216,206, 57, 34, 0,113,109,219,182,149,176,185,134, 69, 19, 58, 90, 11,236,252,229,109,221,231,170, 1, 21,201, 68,
+235,227,205, 28,182,226,168,214, 33, 75,118,197,101,239, 92, 87,160,204, 10,210,153,165,238,142,208,170,181,157,157, 94, 76, 44,
+ 22, 95, 46, 46, 46,238, 46, 18,137,234,136, 44,123,130,139,195,225,160,176,176, 16, 98,177,248,178, 86,171,109,180,135,232,170,
+233, 16,128,230,214,173, 91,111, 89,253, 30, 56,108,216,176, 45, 71,142, 28, 9, 78, 74, 74,194,153, 51,103,224,239,239,143,117,
+235,214,221, 43, 42, 42,154, 4,224, 72,105,105,169,203,235, 70, 69, 69,117,144, 74,165, 72, 73, 73, 1,128, 19, 0,166, 76,155,
+ 54,141, 48, 24, 12, 88,191,126,189, 18,192, 65, 47, 47,175,253,187,119,239,238, 20, 23, 23,199, 79, 74, 74,170, 58,115,230,204,
+239,110,138, 44, 19, 77,211,245, 4,150,117,156,122,120,120,184,227,104, 25, 60, 61, 61,175, 84, 85, 85,141, 82,171,213, 85, 2,
+129,192,163,170,170, 74,107, 45,176,204,252, 20, 69,113, 51, 51, 51, 11, 0, 68,122,122,122, 94,129,131,102, 78,138,162, 6, 12,
+ 24, 48,128,178,125, 6, 69, 69, 69, 40, 44, 44,132, 94,175, 71,231,206,157, 9, 14, 97,224,148,231, 94,182,153,214,129, 21, 89,
+127,147,163,197,152,243,186,121,148,160,189,145,134,135, 14, 29,178,252, 38, 73, 18,155, 55,111,118, 75, 20, 29, 57,114,196,105,
+135,117,155,166, 67,151,214,184,249,248, 47,191,252, 18, 12,195, 88,156, 44,146, 36, 49,103,206, 28, 8, 4, 2, 44, 94,188, 24,
+115,230,204, 1, 69, 81, 46,155, 14,173, 5, 76,139,119, 84,214,149,163,154, 76, 81,219, 31,138, 32, 8,107,177, 69,184, 43,222,
+156,185,121,238,180, 4, 88,115,154,207, 19, 10,133, 14, 59,194,219,112, 58,187,192, 62, 0, 89,193,193,193, 41,221,187,119,247,
+ 60,119,238, 28, 86,174, 92,201,211,106,181,205,147,146,146, 44,215,181, 23, 95, 74,165, 82,196,230, 28, 22, 77,225,102, 57,249,
+187,196,166,127, 21, 97,221,140,231,228,211,246,120, 88,237,179,230, 45, 33, 8,194, 96,231,122, 37,118,196,149,237, 53,172,143,
+ 41,113,232,104,185, 42, 44, 92, 9, 46,119, 28, 45,149, 74,245,251,193,131, 7,187,142, 29, 59,150,114,214,108,168, 84, 42, 17,
+ 24, 24,136,171, 87,175, 26, 85, 42,213,239,110, 56,101,141, 41,180,108,145, 84, 92, 92,204, 49, 24, 12,104,213,170, 21, 66, 67,
+ 67,161,209,104, 80, 81, 81,193, 1,112,196, 77, 14,158, 68, 34,225, 0, 64, 69, 69, 5, 80, 51,212,180,117,116,116, 52,206,159,
+ 63,143,178,178,178,159, 1, 12, 89,176, 96, 65,231,110,221,186,241,126,248,225, 7,213,212,169, 83,127, 54, 24, 12,110, 41, 13,
+154,166,117, 70,163, 49,130, 36, 73,125, 69, 69, 69,190,117,124, 6, 6, 6,250, 72, 36, 18,162,168,168,200,224,142,208,138,139,
+139, 59,155,147,147,131,133, 11, 23,150, 44, 89,178, 36,186,186,186,186,188,178,178,210,104, 45,182, 52, 26, 13,233,231,231, 39,
+ 88,191,126,189, 8, 0,226,226,226,206, 58, 18, 90, 74,165,178,153, 88,252, 87,197, 88,171,213,162,176,176, 16,133,133,133, 40,
+ 42, 42, 66,117,117, 53, 34, 35, 35,161, 82,169,194,217, 98,230, 31, 19, 90,117,154,207,172,243,183,245,139,188, 33,121,221, 90,
+192, 60,249,228,147,150,190, 93,102,135,204,188,253,248,227,143,182, 29,204,221, 18, 90, 95,126,249, 37,222,120,227, 13, 8,133,
+ 66,172, 90,181,170, 78,211,161,173, 56,160,105,154,112,231,222, 35,222, 85,163,112,173, 15,184, 92, 46,124,167, 22,213,105,162,
+179, 35, 56,220, 10,231,146, 37, 75, 26,165,233,208,154, 51, 60,188, 38,171,108,218,180, 9,163, 70,141,194,201,147, 39,239,187,
+233,176,125,251,246,223, 39, 38, 38,122, 94,187,118, 13, 85, 85, 85, 40, 41, 41,129, 86,171, 69, 94, 94,158,195, 86,129,218,178,
+ 92,200,230, 28, 22,127,115, 57,149,254,119,242, 54,230,245, 40, 23, 47,112,183,133,150, 59,142,150, 86,171, 93,245,230,155,111,
+ 78, 27, 56,112,160,143,135,135, 7, 10, 10, 10,234,137, 44,133, 66, 1,169, 84, 10,181, 90,141,189,123,247, 86,105,181,218, 85,
+174,196,129,193, 96, 64, 64, 64, 0, 74, 75, 75, 65, 59,232, 63, 77,146, 36, 68, 34, 17, 20, 10, 5,224,162,147,185,189, 23,134,
+ 94,175,135,193, 96,128,193, 96,128, 94,175,119, 89, 75,182, 53,243, 36, 18,137, 89,120, 0,128, 50, 36, 36,164,149, 80, 40, 68,
+118,118, 54, 80, 51,178,111,224,227,143, 63,206,149,203,229,204, 75, 47,189,116,138, 97,152, 87,224,124,118,124, 93,114,114,114,
+ 4, 0,136, 68,162, 12, 0,200,203,203, 51, 84, 84, 84,212,113, 10,197, 98, 49,243,212, 83, 79, 5, 51, 12,131,228,228,228, 8,
+ 30,143,199,192,241,168, 70,205,158, 61,123,174,121,122,122,238, 88,182,108,217,216,132,132,132,171, 29, 58,116,136, 80, 42,149,
+197,106,181, 90,173,209,104, 24, 14,135,195,243,246,246, 22, 30, 62,124,248,207,180,180,180,129, 50,153,108,199,158, 61,123,174,
+ 57,114,222, 36, 18, 73,158, 74,165,106, 97,126,166,214, 34,171,176,176, 16, 12,195, 32, 43, 43, 11, 98,177, 56,199, 85,179, 46,
+139,166,131,185, 82,101,235,188,216,238,115, 87,100, 89, 11,131,195,135, 15, 59,157, 67,203, 93, 78,107, 81, 52,107,214, 44,172,
+ 93,187,182,158,163,181,120,241, 98, 0,192, 7, 31,124,224,118, 31, 45,179,123, 85,184,214, 7, 65,111,148,213, 9, 59, 0, 16,
+230,240, 53, 44,207,131,162, 40, 44, 92,184,176, 94, 39,117,235,166, 61, 55,155,248,234,132,179,184,184, 24, 20, 69,193,199,199,
+ 7,227,198,141,195,224,193,131, 45, 77,144, 13,229,189,113,227, 70,202,187,239,190, 27,219,190,125,123, 44, 90,180,168,204,203,
+203,203,227,229,151, 95,166, 42, 42, 42, 8,103,142, 22, 43,180, 88,176,104, 4,161,101,206, 96,238,142, 58,116, 80, 88, 14, 68,
+221,185, 54, 42, 85, 42,213,184, 65,131, 6,253,178,107,215, 46, 81, 84, 84, 20,110,220,184,129,178,178, 50,232,116, 58,240,120,
+ 60, 4, 7, 7,163,162,162, 2,155, 55,111, 86,171, 84,170,113, 0, 42, 93,112,190,223,165, 75,151, 13,159,125,246,153, 48, 62,
+ 62, 30,101,101,101, 80, 40, 20, 22, 33, 68, 16, 4,100, 50, 25, 68, 34, 17,206,158, 61,139, 67,135, 14,169, 1,188,239,130,211,
+158,154,131, 94,175,183, 8, 46, 55,132,150, 53,167,196,236,234,168, 84, 42, 0, 48, 52,107,214, 44, 8, 0,178,178,178, 0,224,
+ 78,100,100,228,130,168,168, 40, 98,251,246,237, 12,195, 48,135, 28,136, 44, 11, 39, 65, 16,101, 12,195,148, 3, 8,210,233,116,
+ 60, 0,168,172,172,212,251,249,249, 5, 8, 4, 2, 90, 36, 18,209, 66,161,144, 46, 40, 40, 48, 26,141, 70, 30, 0,244,234,213,
+ 75, 7,160,208,102,141, 66,107, 78,154, 97,152,170,141, 27, 55, 46, 24, 63,126,124,247, 30, 61,122,180,127,237,181,215,174,188,
+244,210, 75,100,104,104,168,119,117,117,181,230,214,173, 91,229, 43, 86,172,168, 62,125,250,244, 64, 46,151,123,119,227,198,141,
+ 11, 0, 84, 17, 4, 65,219,227, 52, 26,141,191, 39, 37, 37, 77, 74, 72, 72,160,242,243,243, 81, 84, 84,100, 17, 89, 69, 69, 69,
+136,137,137, 65, 90, 90,154, 73,175,215, 39, 53, 32, 62, 27, 11, 44,103, 77, 37,132, 49,231,117, 71, 2,203, 92,153,114,151,211,
+ 90, 20,141, 26, 53,170,142,139,197,227,241,240,211, 79, 63,217, 45, 55,236,228,171, 58,247,110, 61,199,215,187,239,190, 91, 71,
+180,205,155, 55,207, 97,113,230, 42, 62,205, 60,149,155, 66,235,142, 58,116,144,207,157,133,211, 92,118,114,185, 92,204,155, 55,
+207,109, 71, 11,245,251,104,213,227, 52,223,123,159, 62,125,160, 82,169, 44, 66,214,145,163,229, 42, 62, 77, 38,211, 27,107,215,
+174,101,100, 50,217,163, 85, 85, 85,207,231,228,228,108, 85,169, 84,143, 84, 86, 86, 58,117,180,180, 90,173,128,205, 71, 44, 39,
+154,102,126,174,255,142,208,170,125, 73,162, 89,179,102,117,214,206, 34, 73,178,206,214,144,126, 6,181, 56,156,153,153,249,204,
+ 99,143, 61,246,221, 27,111,188,225, 17, 31, 31,207,109,209,162, 5,148, 74, 37,178,179,179,113,245,234, 85,227,158, 61,123,170,
+ 84, 42,213,243, 0,220, 25,117,182,237,218,181,107,135,134, 12, 25,242, 97,183,110,221, 94,157, 63,127, 62,167,117,235,214,168,
+172,172,132,183,183, 55, 2, 2, 2,112,243,230, 77,236,221,187,215, 84, 90, 90,186, 1,192,199,176,211,134,234,170,194,175,215,
+235, 49,102,204, 24,208, 52,141,213,171, 87,195,157, 5,149,173,160,215,235,245, 12, 0,162,182, 63,151,170,118,118,105,220,186,
+117, 11, 0,238, 70, 68, 68,120, 0, 64, 82, 82, 18,129,154,249,181,220,169,225, 51, 12,195, 88,156,173,152,152,152,108,219,194,
+209,236,100,153, 93, 48, 87,225, 38, 8, 66,195, 48, 76,177, 74,165, 26, 50,107,214,172, 15,191,252,242,203,177, 95,126,249,101,
+189,227,100, 50,217,142,149, 43, 87,126, 60,122,244,232, 98,130, 32, 28,246, 35, 83, 42,149, 31, 76,152, 48, 97,244,229,203,151,
+ 61,132, 66, 33,148, 74, 37,228,114, 57,244,122, 61, 34, 35, 35, 81, 92, 92,140,109,219,182, 85,171,213,234,143,216,236,248,207,
+192, 90, 24, 56,114,181,220, 16, 89, 14, 93,157,125,251,246,217,157,163,170,161,156,182, 98,195,221,185,173,156, 85,138,204,211,
+210,216,155, 50,162,129,229, 90, 61, 94,138,162,240,233,167,159, 90, 38,109,181,231,100, 53,196,209, 50,115,250,248,248,212,216,
+228, 98, 49,104,154,198,240,225,195, 31,132,151, 6, 48,221,106,198,247, 37,179,103,207, 94, 16, 19, 19,211, 26,128,192, 58, 14,
+ 26,232,226,179, 96,193,194,149,208, 50,153, 76,121,109,218,180,169, 83,192,185, 90,204,212, 96, 48,228,185,121,221, 67, 74,165,
+ 50,114,229,202,149,111, 74, 36,146,129, 42,149, 42,182,182,224,184,172, 84, 42,147,180, 90,237, 26, 52,108, 17,232, 18, 0,175,
+159, 62,125,122,245,144, 33, 67, 22,247,239,223,255,217,183,222,122,139, 96, 24, 6,235,215,175,103,110,223,190,253, 99,173,139,
+117,251,126, 34,201,199,199,231,218,230,205,155, 3,127,249,229, 23, 24, 12, 6,172, 89,179, 6, 30, 30, 30,215,202,202,202,220,
+165, 40, 62,122,244,232,150, 30, 61,122,188,144,150,150,182, 13,192, 31, 39, 78,156,216,218,179,103,207, 9,105,105,105,223, 3,
+184,122,236,216,177,173,221,186,117,155,144,158,158,190, 27,192,197, 6, 20,190, 22,103,203,104,180,223,210,232,192,201,114,198,
+ 89,197, 48,140,126,242,228,201,111,141, 30, 61,250,235,244,244,244, 71, 42, 42, 42, 98, 1,192,203,203,235,114,215,174, 93,207,
+238,218,181,235,102,173,147,229,170,179,126,137, 82,169,124, 42, 54, 54,246,231, 69,139, 22, 73,218,183,111, 79,181,106,213, 10,
+119,238,220,193,149, 43, 87,140,223,126,251,173, 66,173, 86, 63, 9,160,156,205,142,255,156,208, 98, 24, 6, 94, 94, 94,117, 42,
+ 81,230, 33,255, 13,109, 46,180,126, 49,155,151,234,177,229,117,196,233,108,218, 4, 51,164, 82,169,101,114, 83,119,186, 44,208,
+180,243,249,216, 24,134,177,112,154, 55, 55, 68,150,203, 17,130,181, 75,224,184,205,233,206,244, 14, 18,137, 4, 6,131,193,194,
+235,198,200,207,134,170,197,125, 0,246, 25, 12,134, 91, 0, 90,178,226,138, 5,139, 38, 20, 90,229,229,229, 93,154,248,218, 85,
+ 90,173,246, 99,173, 86,251,177,121,135, 70,163,121, 80,206,219, 0, 70, 31, 61,122,244,179,163, 71,143,154,219, 17, 22,194,245,
+122,137, 78,113,227,198,141, 4, 46,151,251,213,142, 29, 59,186, 49, 12, 3, 79, 79,207,211,119,238,220,121,185, 33, 28, 38,147,
+105,114, 90, 90,218, 52,212,246,101,210,235,245,147, 83, 82, 82,222, 68,205,122, 76, 48,153, 76,147,207,156, 57, 99,249,221,192,
+ 23, 37,195, 48,140,150, 97,152, 16, 7,135,104, 27,232,192,153,157, 45,221,174, 93,187, 20, 0, 46,225,175,121,178, 12,181,155,
+198,166,185,208, 25,142, 41,149,202, 86,243,230,205, 91,194,225,112, 6, 40,149,202, 80,137, 68,146,107, 52, 26,127, 87,169, 84,
+239,163,102,141, 42, 22,255, 16,116, 58, 93,126,155, 54,109, 40,123, 21, 40,103, 47,114,103, 21, 43,147,201,148, 23, 29, 29,237,
+178,114,102,135, 51,223,137,104,184, 27, 25, 25, 73,186,203,101,134, 94,175, 47,118, 22,206,200,200, 72, 52,148,211,213,189, 71,
+ 68, 68,216,189,119, 23,130,208,225,189, 27,141,198,251,226,116, 22,159,206,160, 86,171,203,253,253,253, 21, 26,141,134,171,213,
+106,185, 70,163,177,142,253, 40, 18,137, 74,212,106, 53,155,121, 88,176,120, 16,161,245,144,227, 28,106,150,151,104, 44,104, 47,
+ 95,190,252,130,197,158, 42, 46,190, 95, 30, 91, 37,169,112,241,187, 33,194,168,209, 29,161, 90, 33,165,106, 36,186, 82,133, 66,
+241,146,249,135,185, 15, 8,139,127, 30,114,185,252,209,198,230, 44, 43, 43,107,244,138, 90,105,105,105,247, 38,184,247, 46,255,
+ 85, 78,103, 40, 40, 40,120,212,133, 16, 99, 51, 14, 11, 22,110,130,100,163,128, 5, 11, 22, 44, 88,176, 96,193,162,105, 64,160,
+102,228,128, 61, 52,100, 52,193,192,251,184,118, 18,203,201,114,178,156, 44, 39,203,201,114,178,156,255, 57, 78, 87,220,236,104,
+198, 38, 22, 96, 44,231,255, 63, 39, 7, 0, 33, 18,137, 8,161, 80, 72,136,197, 98,130,141, 79,150,147,229,100, 57, 89, 78,150,
+147, 69,125,252,227,125,180,252,253,253,147, 41,138,138, 86, 42,149,202,234,234,234, 40, 15, 15,143,219, 18,137, 68, 98, 52, 26,
+ 51, 75, 74, 74,122, 63, 32,253,100,129, 64, 48, 51, 46, 46,174,221,205,155, 55, 51,170,170,170, 86, 0,248, 6,246, 71, 12,113,
+109,246, 19, 0,226,155, 55,111,190, 85, 40, 20,138, 51, 50, 50,230, 0,248,222,141,120, 36,224, 98, 68,146, 53,188, 37, 60, 46,
+106,250,147,245, 5,112, 28,192,190,114,165,222,240, 32, 55,125,191,156, 82,169,212,167,101,203,150,235, 35, 34, 35, 35, 25, 64,
+203, 48, 53,243, 15, 25, 13,122,222,213, 43, 87,146,239,220,185,179,161,127,255,254, 95,135,133,133, 5,114,185, 92,131,121,212,
+151, 74,165,226,109,219,182,173, 21,155,157, 88,176, 96,193,130, 5, 11, 55,133,150,164, 57,218,240, 37,196, 54,147, 1,106,163,
+150,153,170,204,197, 13,105, 51,244, 96,128, 23, 24, 32,130,228,144,254, 38, 19, 93, 72,107, 8, 35,215, 32,138, 38, 25, 74, 88,
+ 85, 85, 21,218,224, 0, 80, 84,116, 65, 65, 65, 64, 72, 72,136,121,241, 99,137,249,247, 3,128, 0,240,197, 43,175,188, 50,245,
+213, 87, 95,133,183,183, 55, 12, 6, 67,235,157, 59,119,110,154, 55,111, 94,119, 0, 47,218, 17, 67, 12,234, 78, 18,218, 58, 54,
+ 54,118,127,106,106,170,111, 69, 69, 5, 58,119,238,188,162,184,184,216,145,208, 50, 54, 52,128,222, 18, 94, 27, 0, 47, 6,121,
+ 9, 38,125, 51,171,191,119,139, 1,175,225,202,143, 11,166, 77,255,230,114, 57,128,205, 0,190, 41, 87,234,111,254, 93,156, 30,
+ 30, 30, 1,109,162,163,119,253,248,243,207,189, 79, 31, 59, 6, 31, 1, 31, 18, 17, 31, 96,128,192, 86,109,240,218,236,217,198,
+ 71, 30,121,164,223,119,223,125, 23,151,158,158,142,208,208, 80,136, 68, 34,136,197, 98,200,229,114,108,219,182,237,190,211, 17,
+ 77,211,247, 0, 28, 37,141,216,167, 40,192, 45, 54, 91,178, 96,193,130, 5,139,127,189,208, 98,104,172, 88,125, 96,114,231, 43,
+101,191,225,139,103, 10,151,138,194, 96,236, 49, 34,250,233,132,137,157,224,233, 47,134, 80, 74,161, 66, 94,213,225,230,133, 92,
+ 28,223,253, 39,188, 13,173,145,246,251,249,235, 42,149,170,237,253, 4, 68, 44, 22,139,131,131,131,139,196,214, 11,227,221, 31,
+132, 0, 86,188,250,234,171, 83,223,121,231, 29,252,254,251,239,216,179,103, 15,198,143, 31,143, 25, 51,102, 64, 42,149, 78,154,
+ 49, 99, 70, 26,128,175,157,112,180,142,141,141, 61,149,154,154,234,171, 86,171,113,229,202, 21,148,149,149,253,209, 88,145,238,
+ 45,225, 45, 91,255,114,220,187,221,158,158, 14,255,246,131, 64,144, 53,143,161,215,236,189,184,248,166,218, 59, 47,229,187,183,
+246,252,248,253, 91,203,247,220, 90, 94,174,212,207,249, 59, 56,163,162,162,214,237,250,233,167,222, 97, 97, 97,216,159,125, 27,
+ 45, 35,130,209,172, 77, 39, 84,102,223, 70,201,221, 44,232,244,122,244,237,219, 55,238,212,169, 83, 40, 40, 40,128,159,159, 31,
+ 52, 26, 13,210,211,211, 33, 20, 58, 94,141,163, 1,233,104,200,177, 93,183,150,223, 58, 95,178, 76,153,131, 15, 1,152,216,236,
+249,175, 65,235,102,205,154,253, 44, 18,137,100, 25, 25, 25, 31, 0,216,210,132,215, 26,215,173, 91,183, 53,151, 46, 93,186,160,
+213,106,223, 4,144,193, 70, 63, 11, 22, 44,254, 73, 56, 27,117, 24,236,239,239, 7,191, 72, 46,188,125, 36, 67,151,255,244,252,
+211,175, 45, 29, 0, 94, 84, 62,202,164,103,112,151,249, 29, 26,223,155,104, 51,132,135,183,191,233, 7,223,238,114,192, 71, 85,
+128,112, 8, 28, 17,250,248,248,252, 28, 16, 16,144,106,189, 25,141, 70,225,156, 57,115, 76, 25, 25, 25,146,130,130,130,128,140,
+140, 12,201,156, 57,115, 76, 70,163, 81,232, 31,232,115,193,163, 57, 47, 47,162,183,168, 68,210, 28,175,187,112,176, 62, 11, 10,
+ 10, 82,141, 29, 59, 86,221,161, 67,135,169, 12,195, 96,235,214,173,120,249,229,151,119,254,246,219,111, 17, 99,198,140,217,122,
+244,232, 81, 76,153, 50, 5, 94, 94, 94, 51,220, 21, 89, 23, 46, 92,192,132, 9, 19, 74,140, 70,227,140, 70,140,247,137,163, 86,
+156, 65,200, 35,207,130,195, 19, 89,214, 82, 35, 72, 18, 92,145, 12, 97,143, 61,143, 87, 22,127, 7, 0, 19,255, 46,206,200,168,
+168,150,231,146,147,241,237,194, 69,104, 29, 16,128,208,102,161,240,105,211, 1, 30,254,126,160, 40, 10, 12, 3,134,207,231,211,
+229,229,229,144,203,229,144,203,229,200,206,206,198,241,227,199,113,239,222, 61, 52, 70, 58,154,253,109,127, 50,225,181,182,239,
+137,155,225,160,179,116,196,226,225, 18, 89,177,177,177,167,110,220,184, 17,147,148,148, 20, 18, 26, 26,250, 73, 83, 94,172, 75,
+151, 46,203, 79,158, 60,233,115,240,224,193, 65, 65, 65, 65,201, 0, 90,223, 79,152,155, 55,111,126,189,117,235,214,121, 0,198,
+ 53,114, 16, 39,118,239,222,189,140,207,231, 31,186,207,176,177, 96,241, 48,161, 3,128, 88, 86,104,185,129,197, 59,199, 82, 62,
+109,181,184, 82,126, 0,187, 62,249, 3,159, 12,189, 73, 47,238,158, 77,127,254,194, 13, 28,222,245, 7,138,241, 7,134,189,214,
+ 18, 99, 63,232, 56, 80,108,194, 34,153, 76,118,193, 30, 15,143,199, 11,204,200,200,240,205,202,202,242,189,125,251,182,111,102,
+102,166,239,181,107,215,138, 42, 42, 42, 20,195,135, 15,167, 1, 96,248,240,225,244,221,156,187,170, 65, 79,247,161,195, 7,160,
+227,172,159,218,133,206, 73,236,228,231, 29, 44,152,235,232, 30, 56, 28,206,158, 47,191,252,242,173,220,220, 92,209,247,223,127,
+143,244,244,116, 68, 69, 69, 97,209,162,133,229, 35,122,180,237,245, 72,148,239, 42, 79, 17,247,179, 45, 91,182, 64, 44, 22,163,
+ 99,199,142,142, 92,183, 22, 29, 58,116, 72, 49,139,172,139, 23, 47,226,249,231,159,215,203,229,242,171, 0,150, 1,216, 67,145,
+ 68,178,191,167,164, 66, 34,160,238, 18, 4, 14,160,166,207, 87,120,195,163,158, 64,229,221, 75, 48,233,213,160, 4, 18,112,120,
+ 66,144, 20, 31,101,183,210,144,241,235, 66, 84,100,221,207,194,225, 15,192, 73,146, 26, 79, 46, 23,113,126,190,136,141,136,132,
+143, 80, 6, 85,218, 49,160, 66, 1, 30, 79, 0,128,129, 64, 32, 64,117,117, 53, 46, 92,184,128,235,215,175,227,220,185,115, 56,
+123,246, 44,138,138,138,112,191,233,104, 73,143,108,173,163,116,196,150, 81,255, 14,145,149,154,154,234,171,209,104,112,227,198,
+ 13,148,148,148, 92,108,202, 11,102,100,100,148,167,166,166, 34, 44, 44, 12,223,127,255,189,127, 68, 68,196,201, 6, 10,154,214,
+177,177,177,167,174, 95,191, 30,147,148,148, 20, 26, 16, 16,176,162, 49,195,247,200, 35,143, 44, 62,121,242,164,247,225,195,135,
+ 7,251,251,251,223,175, 16,100,193,226,255, 25, 2, 0, 47, 16, 4,113,182, 67,135, 14,151,219,183,111,255, 7, 65, 16,105, 0,
+ 70,225,223, 59,119,167, 83, 88,110, 58, 49, 49,241, 4, 0, 36, 36, 36,244,177, 61, 72, 17,112, 30,249,217, 69,216, 60,177,152,
+ 86,151,160, 98,209,123,159,237, 57,127,250,226, 83,111,206,120,211,123,245,198,229,216,158,118, 0, 99, 86, 24,209,107,116, 59,
+156,217,159,243,214,196,126,115,241,214,140,217, 64,253, 33,154, 12, 73,146, 72, 73, 73,129,201,100,130, 78,167,131, 78,167, 67,
+187,118,237,202,142, 29, 59, 38, 5,128,204, 63, 51, 24,174,175, 78, 48,240, 29, 25,111,202,128, 24, 40,228,122,124,247,110, 38,
+ 74,179,181, 63,214,114, 36,213,145, 7, 36,249,245,134, 13, 27,158,152, 50,101, 10,190,248,226, 11,236,220,185, 19, 79, 62,249,
+ 36,158,123,238, 57,148,148,148,120,135,226, 30, 6,180,243, 11,233, 59,125, 67,159, 49, 99,198, 64,161, 80, 32, 61, 61,253,186,
+ 77,184,146, 80,211, 25,254,245,227,199,143,251,168,213,106, 84, 87, 87,163,111,223,190,144,203,229, 60, 0,253,237,196,157, 39,
+128,230,106,181, 26, 45, 90,180,104, 93, 82, 82,210,195, 14,103, 61,120, 75,120, 22,113,171, 87,150, 67,175, 44, 7,135, 39,132,
+208, 59, 12, 87,191,155, 1,134,174,105, 49,243, 12,239,104,239,244, 38,227, 20, 11, 4, 72, 76, 77,193,241,196,125,104, 27, 25,
+137,158,177,177, 56,117,249, 10,120, 36,129,145,147, 38, 3, 52, 19,144,146,146, 66,148,148,148,224,242,229,203, 88,184,112, 33,
+114,114,114,112,224,192, 1,152, 76, 38,183,194,105,147,142, 84,139,222,251, 44,123,236,179,207,223, 60,120,228,183, 59,137,191,
+255, 52,104,123,218,209,248, 49, 43,140, 68,175,209,237,112,246, 64,206,204,108,162,252, 91,101, 46,110, 56,227,124, 64,176,156,
+ 77,199,217,190,125,251,246,167, 83, 83, 83,197,106,181, 26,187,119,239,198,252,249,243, 13,122,189,158, 2,176,199,206,185,233,
+ 0,190, 64,253,165,183,236,133, 83, 6, 96, 26,128,174,245,210,152, 66, 81,242,204, 51,207, 24, 22, 44, 88,192,125,252,241,199,
+177,111,223, 62,191,145, 35, 71, 94,204,200,200,136,199, 95,205,136, 73,174,132,225,125,116, 25,112, 43, 62,107,133, 96,112,104,
+104, 40,182,111,223,238, 63, 97,194,132,228,162,162,162,222,176,223,196,201,166, 37,150,243, 97,226,108, 1,224, 85,169, 84, 58,
+165,111,223,190,222, 79, 62,249, 36,124,125,125, 97, 52, 26,145,155,155,219, 45, 49, 49,177, 91,106,106,106,129, 78,167, 91, 11,
+ 96, 19,128, 10,123,164,206,180,200, 67, 45,180, 18, 19, 19, 25,212,140, 80,179, 11,149, 73,142,248,224,161,232,246,187,148,172,
+ 40,171,210, 47, 24,185,244,104, 69,142,254,169,175,190,250, 10,207, 61, 49, 1,251,126, 23,227,244,206,189, 24, 56,190, 16, 3,
+ 39, 71,226,207,147,142,187, 69, 24, 12, 53,131,223,140, 70, 35, 12, 6, 3,244,122, 61,244,122, 61,196, 98, 49,174,221,188, 2,
+163,119, 9,231,249, 53,173, 56,161,109, 36, 72,221, 89,136, 3,171,115,116,138, 98,195, 92, 93, 57,126,170,103,223, 0, 95,175,
+ 90,181,106,210,148, 41, 83,176, 96,193, 2,252,244,211, 79,204,138, 21, 43,136,121,243,230,161,188,188, 28,253,250,245,195, 43,
+147,159,199,181,184, 16,188, 59,127,177,108,212,168, 81,248,248,227,143,161, 84, 42, 87, 57, 8,158,151, 78,167,179, 44,118,155,
+151,231,122,233,198,156,156, 28, 48,206,151, 82,131,183,132, 39,244,146,240,150,112, 72,226, 57, 14, 1,127,131,137,193,241, 5,
+189,192,137, 25,137,249,107,119,194, 68, 51, 24,247,212, 32, 68, 42,170, 32, 18, 75,106, 20, 41,109,186, 47,206,232,161,111,130,
+228, 10, 97,210,107,176,101,203,102,236, 57, 84, 1,157,252, 14, 94,123, 60, 10,129, 78, 56,141, 70, 35,211,188,121, 27,180,108,
+175, 3, 35,224,225,216, 93, 45, 98,251, 36,224,198,181,219,200,175,212, 35, 46,182,125,139,201,147, 95,132, 64, 32,192,237,219,
+183,177,100,201, 18, 40,149, 74,119,215,133,179,151,142,164,171, 95, 91, 43,124,245,197,215,222,187,144,126, 49,119,235, 23,187,
+126,153,246,238,148,175, 79,239, 60, 24, 59,112,124, 33, 6, 76,138, 36, 55, 92, 42,127, 22,192, 2,182,130,248, 80, 98,195,153,
+ 51,103,196, 42,149, 10,213,213,213,120,249,229,151, 49,109,218, 52,174,189, 74, 75,113,113, 49, 82, 82, 82,158,156, 62,125,250,
+152,194,194,194,222,112,190,238,165,119,167, 78,157, 82,143, 29, 59,214,218,195,195,195,178,147,166,105,232,245,122, 75,153,162,
+213,106,161,213,106, 33,147,201,144,154,154, 42,244,241,241,217, 5,231, 77, 24,127, 71,151, 1, 84, 85, 85, 61, 59,106,212,168,
+228,109,219,182,249, 71, 70, 70,226,251,239,191,247,127,241,197, 23, 79,222,189,123,183, 23,216,254,100, 44, 30, 94,204,121,230,
+153,103, 22, 7, 6, 6,146, 29, 58,116, 64,112,112, 48,180, 90, 45, 42, 43, 43,193, 48, 12,252,252,252, 48,105,210, 36, 60,245,
+212, 83, 33,201,201,201,203,143, 29, 59,182,160,188,188,124, 51,128, 53, 0, 50,173, 68,150, 83, 45,242,208, 59, 90, 9, 9, 9,
+ 39,234,168, 24, 2,233,103,254, 56, 21, 43,140, 1, 8, 18,200, 37,143,129, 0,129, 10,131,158,103,168, 34,215, 30, 62,124,216,
+ 91,169, 84, 66,161, 80, 96,104,223, 17,152,187,225, 23,244,124,190, 10,205,218,132, 96,245,135, 7, 12,174,132, 22, 77,211, 48,
+ 26,141,168,174,174, 38, 79,156, 56,225, 23, 30,209,140,120,254,173, 33,152,254,125, 59,200, 2,120, 56,248,121, 14,202, 83, 67,
+148, 76,105,197, 29, 93,121,217, 86, 59,133,239,228,247,223,127,127,210, 27,111,188,129,229,203,151, 99,217,226,143, 79,135, 4,
+ 5, 62, 18, 31, 31, 79,124,244,209, 71,152, 61,123, 54,194,195,195,193, 17,120,160,101,223,231, 49,107,214, 44,172, 93,187, 22,
+ 95,173, 94,170,111,231, 35, 77,187, 86, 86,111,181, 27, 3,128, 69, 3, 6, 12,120,226,240,225,195, 62, 66,161, 16, 87,175, 94,
+197,248,241,207, 67,204, 5,184, 28, 18, 96,104, 48, 52, 13,130, 96,224, 47, 19,192, 91,196,129,191, 7, 23, 49,126,116,251,114,
+ 70,218,250,106,153, 34,195,158, 32,242,245,224, 95,221,241,193,136,176,216, 73, 95,240, 40,129, 20,218,202, 66,252,182,102, 26,
+ 22, 45,254, 26,167, 82, 79,163,162,162, 2,131, 7, 14,192,154, 81,126,127, 89,127, 78,196,155, 35,206, 27,187,222,195, 43, 83,
+167, 99,227,250,117, 32,185, 66,252,118,226, 28, 14, 31, 61,137,148,148, 20,188, 52,113, 44, 62,143, 46,116,200,105, 50, 25,224,
+ 31, 16,142,199,250, 68, 65,234, 33, 5, 73, 0, 45, 34,252,225,231,155,135,160, 32, 2,105,167,143, 34, 57, 57, 25, 30, 30, 30,
+136,136,136,192,218,181,107,145,157,157,141,151, 95,126, 25,124, 62,223, 33,175,163,116,164, 32, 12, 32, 76,252, 86, 30, 30, 30,
+ 59,116, 58,221, 42,189, 94,191,247,249, 81,147,119,188,188,228,231,118, 61,159,175,226, 52,107, 19, 2,130, 65, 31, 86,104, 61,
+180,144, 24, 12, 6,152,215,115,206,205,205,117,122,112, 92, 92, 28,182,108,217,210,110,226,196,137,201,133,133,133,143,193,254,
+162,242,178, 78,157, 58,165, 38, 39, 39,183,214,104, 52,200,202,202,114, 43, 32,181, 11, 35, 43,157, 28, 98,238, 50,224, 99,221,
+101,160,172,172,204,220,101,192, 30,202, 80,179,142,234, 93, 59,255,133, 3,120,179,182,134, 15, 59,194,242,234,248,241,227,123,
+110,223,190,157, 23, 21, 21,133,125,251,246,249,141, 26, 53, 42, 37, 35, 35,163, 43,128,108, 54,233,176,120, 8, 49,113,225,194,
+133,164,201,100, 66,105,105, 41,180, 90,109,189, 60,200, 48, 12,196, 98, 49,134, 14, 29,138, 33, 67,134, 8,206,159, 63, 63, 53,
+ 41, 41,233,213,172,172,172,249,181,121,201,174, 22,249, 87, 9,173,122, 47, 94, 10,139, 62, 29,147,234, 37,144,146,177,160, 9,
+ 47, 63,191, 0, 9,151,203, 37,188,196,129, 94,171, 86,206, 46,187,121,243,230,189, 93,187,118, 5,119,239,222, 29, 96,128, 78,
+205, 6, 67, 94,120, 26, 94, 92, 53, 74,229,165,142,230,145, 98,126, 61,176, 91, 82, 94, 94, 73,183,137,108,167, 86,169, 84,228,
+129, 3, 7,194,122,245,238,201,219,155,250, 29,241,236,178, 96,200, 2,120,248,109,237, 93, 92,252,222, 64, 79,155, 56,162,242,
+207, 75,107,170,237,213,112,121, 60,222,140, 55,222,120, 3, 59,119,238,196,156, 57,115,182, 60,213,173,229,160,103,134,245, 37,
+ 83, 82, 82, 48, 98,196, 8,228,231,231,227,151, 95,126,193,252,249,243, 49, 97,194, 4,124,241,197, 23,184,240,227, 39,184,190,
+164, 43,111,238,206,219,215,232,155,196,240, 27,165,213, 7,109,104,179,111,220,184,241, 88,255,254,253, 79,238,221,187,215, 47,
+ 38, 38, 6,219,182,109,199,204,215, 95,197,143, 11, 70, 33, 58, 80, 12,232, 21,160,117, 42, 16, 60, 17, 96, 80,131, 41,191, 11,
+189, 94, 45,125,119,199,237,235, 38, 59,156, 94, 18,222,146,239,223,127, 34,172,211,212,109, 60,243,190, 91,183,239, 96,237,241,
+114,156, 74, 61, 13,115, 19, 69, 72,128,183,109, 84, 57,124,104,246, 56, 9,146, 66,199,151,190,198,220,170, 4, 28,218,188, 4,
+ 67, 95, 94, 8,121,105, 49, 82, 83, 83, 17, 26, 26,138,207, 55,110,198,140,233, 83, 97,162, 25, 71,207,156,215,166, 77, 36, 56,
+156, 2,240, 5, 52, 8, 0,122,125, 57,252,252, 40, 52,107,230, 7,128,176,184, 87, 4, 65, 96,216,176, 97,122,134, 97,138, 52,
+ 26, 77,233,174, 93,187, 8,103,233,232,147,209,169,161,124, 49,249, 40, 1,210, 51, 32, 32,144, 16, 8, 5, 8,244,142,192, 7,
+111,190, 6,197, 11,234, 71,183,109,219,182,235,219,111,191, 45, 72, 77, 77,221, 78, 8,124,110,203, 11, 21,209, 94, 92, 53,192,
+144,205, 1,154, 45,194, 30, 78,140,126,228,145, 71, 46,254,246,219,111, 66, 62,159,143,189,123,247, 98,254,252,249,134,178,178,
+178,147,182,162, 39, 48, 48,176,253,214,173, 91, 35, 34, 35, 35,177,110,221,186,118, 35, 71,142,156, 6, 96,137, 29,206,105,199,
+142, 29,107,173,209,104,112,241,226, 69, 76,152, 48, 33,187,168,168,232,170,173,192,139,136,136,232,181, 98,197, 10,110,231,206,
+157, 81, 85, 85,133, 65,131, 6,169, 0,188,234, 36,172, 13,233, 50, 0,160,102,173, 63, 7, 93, 6,224,235,235,251, 77, 78, 78,
+ 78, 63,145, 72,228, 52,130,244,122, 61,242,242,242,224,229,229,133,196,196, 68,159,150, 45, 91,126, 0, 96, 50,155,116, 88, 60,
+140,208,233,116,216,185,115, 39, 58,117,234,132,182,109,219, 66,161, 80, 88, 68,151, 78,167,131,209,248,215, 44, 72, 36, 73,162,
+107,215,174,136,142,142, 38,102,206,156, 57,206, 90,104,253, 27, 97,126,233, 46,176,109, 23,213,100, 35, 23,192, 56, 90, 36,120,
+ 95, 40, 20,142, 14,111, 30,139, 54,109,218, 8,159,126,250,105,190, 78,167,147,158, 56,154,252,103,207,158, 61, 81, 86, 86, 22,
+ 60,103,206,156,178,176,102, 97,116,242,164,114, 95,130, 41, 7, 71,199, 79, 1,234, 47, 58,170,229, 84, 55,223,251,231,242, 96,
+ 0, 56,158, 22, 81,253,204,160,177,165, 28, 14,135, 58,125,227, 24,209,123, 6, 5,255, 22, 34,164,237, 46, 4, 63,187, 51, 34,
+ 3, 43, 33,147,201, 28,206, 79,213,177, 99,199,118, 36, 73, 98,231,206,157, 0,240,193,141,236,194, 75,146, 35, 39, 62,219,179,
+120, 11,247,221,247, 63,196,220,185,115,241,210, 75, 47, 65,175,215, 99,249,242,229, 72, 77, 77,197,175,191, 28,135, 49,105, 46,
+ 86, 60, 93, 70,190,252,157,230, 87,189,201,219,255,118,121,121,181, 13,117,198,173, 91,183,122, 13, 29, 58,244,228,238,221,187,
+253, 90,183,110,141, 21,107,191,196,248, 55,167,224,236,210, 65,128,200, 7,188,222,239,130,240, 10,175,145, 67,101, 89,192,225,
+119, 29,114,114, 72,226,185,216,137, 95, 88, 4, 81, 70, 70, 6,166,207,122, 7,191, 29, 60, 12,115, 19,197,204, 55,167, 99,235,
+218,143,161, 60,179, 1, 66,159,102,144, 4, 68,161,234,238, 37, 0,144,219, 28, 42, 43,123, 0, 0, 32, 0, 73, 68, 65, 84,187,
+119, 91, 78, 0, 80,203,239, 66,113,239, 38, 34,135,188,137, 15,198,141,199,208,151,129,181,139,222,193, 11, 19,198,224,243,141,
+155, 17, 25, 25,137,207,215,111,194,228,201,147,100, 85, 57,185,173, 97,211, 76,113, 46,253,194,141, 85,171, 23,138, 85, 42,165,
+ 39,143,207, 15, 2,195, 32, 56, 56, 24, 85, 85,213, 48, 24, 12, 80, 42, 85, 32, 73, 18, 36, 73,130,195,225, 96,196,136, 17,188,
+228,228,228,102,127,252,241,135,127,173, 5, 28,109,109, 1,155,161,201,198,216,103,158,121,102,112, 96, 96, 32,233,235,235,139,
+ 62,125,250,192,100, 50, 65,171,213,130,166,105,240,249, 38,139,165,124,242,228,201, 57,122, 83,184,113,203,132, 36, 13,135, 40,
+215, 82, 90, 97, 82,227,173,105,205,226,111, 70, 70,102,102,102,252,192,129, 3, 79,254,248,227,143,126,195,134, 13, 67,203,150,
+ 45,185, 79, 63,253,180,191, 74,165, 26, 96,125, 96, 81, 81,145,247,132, 9, 19,206,229,230,230, 70,212,238,234,234,128,179,171,
+135,135, 7,178,178,178,204, 34,171,139,109, 37,140,207,231, 31,186,116,233, 18,151,207,231, 35, 61, 61, 29, 19, 39, 78, 44,205,
+206,206,118,213, 44,119, 95, 93, 6,104,154,214,218,251,143, 36, 73,193,249,243,231,225,106, 46, 64,146, 36,193,227,213,201,198,
+ 21,108,178, 97,241,144,194,160,211,233,208,165, 75, 23,100,103,103,227,252,249,243, 22,193, 85, 90, 90,138,130,130,130, 58, 7,
+159, 61,123, 22, 23, 46, 92, 64,239,222,245,230, 36, 95,240,111,236,163,101,113, 34, 18, 19, 19,251,216,216,118,124,137, 68,114,
+246,185,231,158,107,246,244,211, 79,123,113, 56, 28,104, 52, 26, 24,141, 70,164,165,165,161,109,219,182,170,118,237,218, 85, 12,
+ 31, 62,156, 40, 45, 45,237,127,245,234,213,172,210,210,210,120,153, 76,150,245,216, 99,143,105, 52, 26, 77, 61,165,229, 21, 69,
+233,150, 95,236,198, 3,128,228,237, 5,200,217,239,163, 48,168, 77,226,200,145,149,100,159, 9, 33,168, 42,214, 99,245,179, 55,
+240,235,166,163, 88,241,217, 10, 83,239,222,189,243, 22, 47, 94, 92, 80, 80, 80,240,152, 45,151,167,167,231,181,228,228,228,182,
+ 71,143, 30,197,236,217,179,191, 51,153, 76,203,132, 92,206,193, 73, 47,189, 18,166,215,235,113,254,252,121,248,248,248, 32, 39,
+ 39, 23,188,128, 56,196,246,123, 1,111,143,235,138, 56,239,114,232, 54, 15,198,141, 2, 53,198,239,210, 46,186, 89,172,156,231,
+ 32,110, 90,135,134,134, 38,111,223,190,221, 63, 48, 48, 16,227,158, 25,134,180,247, 98,193, 27,186, 2,151, 74,196,248,236,251,
+115, 0,128,183,199,117,113,200,233, 45,225,145, 1, 50,190,225, 70,126, 53, 9, 0,119,238,220,193,132, 23,198,227,224,161, 26,
+145,117,241,226, 69,140, 27, 55, 14,237, 99,162, 33, 22,242,161,173, 44, 2,109, 50,224,110, 94, 33,242,203, 52,101, 70,154,190,
+202, 48,200,134, 85, 19,133, 45,231,221,187,119,177, 98,249, 98,220,186,126, 9,122, 69, 25,120, 18,111,164,157,191,130, 62,125,
+250,130,161,141, 40, 47,202, 69, 78,169, 10,155,183,108, 69, 84, 84, 20, 84, 42, 21, 70,141, 26, 85,230,164,153, 34,227,198,141,
+ 27,209,107,215,174,197,252,249,243,241,203, 47,191,192,100, 50, 65, 32, 16,128,162, 40,240,249,124, 68, 69, 69,225,250,245,154,
+241, 4, 52, 77,227,252,249,243, 72, 74, 74, 98,108, 45, 96,107, 62,147,201,132,146,146, 18,232,116, 58,168, 84, 42,168,213,106,
+ 48, 12, 3, 14,135, 3,134, 97, 44,181, 29, 14,135,131,172,172, 44, 92,190,124,153,217,183,111,223, 39, 12,195,204, 97,203,176,
+135, 26,173, 67, 66, 66,146,183,109,219,230, 31, 28, 28,140,126,253,250,229, 22, 22, 22, 54,183,115,220, 30,134, 97,158,204,202,
+202, 66, 84, 84,212, 94, 0, 35,238,231,152,240,240,240,146,244,244,116,191,107,215,174, 97,220,184,113, 37,181,125,190, 92,245,
+125,138,136,137,137, 73, 63,124,248,176, 15, 73,146,184,122,245, 42,198,141, 27,167, 47, 43, 43, 59, 5,199, 77,142,119, 80,211,
+191,228,174,157,255,194, 1,204, 3,224,227,224, 92, 73,116,116,116,207,115,231,206,241, 8,130,192,157, 59,119,204,121,178, 75,
+ 45, 47, 11, 22, 15, 27,158, 10, 9, 9,249,118,218,180,105,158,221,186,117, 67, 94, 94, 30,242,243,243, 81, 94, 94,142,248,248,
+120,180,111,223, 30,183,111,223,198,161, 67,135,112,225,194, 5, 8, 4, 2,132,133,133, 65,186, 99, 39,190, 34,112, 13, 64,123,
+ 39, 90,228,223, 35,180,108, 33, 16, 8, 62,152, 56,113,226,140,215, 94,123,205, 71, 32, 16,224,236,217,179,224,241,120,160,105,
+ 26, 3, 6, 12, 64,118,118, 54, 70,140, 24, 81, 86, 88, 88,248, 52,128,147,238, 92, 76, 22, 44, 40, 28,254,126,112, 96,239,241,
+ 53, 53,189,228,237, 5, 56,183,183, 24,179,118,117, 4,201, 33,240,205,244, 27, 48,101, 54,167, 91, 71,197, 48, 0,140,205,154,
+ 53, 43,220,186,117,171, 93,161, 5, 96,242,148, 41, 83,190,153, 60,121, 50, 78,156, 56,129, 93,187,118, 97,216,176, 97, 24, 62,
+124, 56,190,253,246, 91,120,201, 79,227,147, 95,175, 97,236,135, 7,112, 53,171,198, 24,106, 31,233,139, 29, 31, 15,131,230,243,
+120, 48,165, 25, 72,216, 73,221, 56,246,167,194,209, 84, 15,100, 11,111,209, 79,126,254, 94, 79,105, 24, 30, 94,237, 46,198,139,
+ 67,226,192, 31,181,189, 65,156,173,130,165,133,215,179, 10, 2, 41,129, 20,111,188,250, 34, 62, 90,242, 41, 76, 38, 19,170,171,
+171, 17, 22, 22,102, 91,163,173,135,218, 38,138, 52,235, 38, 10,107,206, 39,135, 63,142,157,187,127,134,187,205, 20,124, 62, 31,
+ 90,173, 22, 45, 91,182,220, 12,251,205, 20, 25,151, 46, 93,138, 94,188,120, 49, 54,108,216,128,125,251,246,193,104, 52, 66, 32,
+ 16, 64, 34,145, 64, 36, 18,193,207,207, 15,151, 47, 95,174,115, 82, 85, 85, 21,102,206,156,153,137,250,195,213, 51, 46, 93,186,
+ 20,237,204, 82, 54,247,219,179, 36, 74,130, 64,101,101,165, 35, 62, 22, 15,161,216,226,241,120,171,253,253,253, 59,230,231,231,
+207, 66,253,165,172,188,159,125,246,217,171, 63,252,240, 67,240,157, 59,119,220, 18, 90,143, 61,246,152, 93, 71, 11,192,196,160,
+160,160,143,171,171,171, 43, 85, 42,213, 40,184,223,193,188,117,171, 86,173, 78,238,221,187,215, 79, 44, 22,227,250,245,235, 24,
+ 63,126,124,137, 92, 46,239,141,198,237,164,222,186, 77,155, 54,167,206,158, 61,235,203,229,114,145,158,158,142, 9, 19, 38,148,
+178,157,225, 89,252, 11,224, 1, 96,118,100,100,228,219, 83,167, 78, 21,180,107,215, 14,121,121,121, 40, 41, 41, 65,121,121, 57,
+ 78,159, 62, 13, 0, 8, 13, 13, 69,104,104, 40,110,222,188,137,148,148,148, 42,133, 66, 49, 25,192, 47,255,230,136,113,216, 71,
+ 75, 44, 22, 63,247,194, 11, 47,248,152, 76, 38,244,238,221,187, 76,167,211,153,102,207,158,237, 31, 20, 20, 4, 15, 15, 15, 12,
+ 26, 52,168,188,170,170,170, 59,224,254,146, 41, 2,147,236,110,241,239,193,210,100, 20,136,123,143, 15, 65,239,241, 33,232, 58,
+ 34, 0, 36,135,192,229,195,114,240, 75, 91,170, 94,152, 50,165,178, 89,179,102, 6,146, 36,209,188,121,115,227,246,237,219, 29,
+117, 86,250,246,235,175,191,126,212, 96, 48,188,244,242,203, 47,163, 79,159, 62, 48, 26,141,216,190,125, 59,100,185, 7,176,240,
+249, 46,142, 3, 98, 50,128,224, 73, 16,232,105, 10,115, 36,178,218, 6, 74,191, 89,246,106,191,167, 6,117,240,197,222, 99, 23,
+ 49,172, 13, 23,208, 85,223, 15,231,174, 43, 91,223,152, 26, 59,233, 75, 94,105, 81, 30, 26,169,137,194,194,169, 85, 85,163,145,
+155, 41, 12, 58,157, 14, 18,137, 4, 92, 46, 23, 2,129, 0, 70,163, 17, 4, 65, 32, 62, 62, 30,205,155, 55, 71, 78, 78,142, 59,
+ 22,112, 99, 91,202, 44, 30, 94,100,232,245,250, 33,249,249,249,214,142,143,165,179,248,179,207, 62,219,101,251,246,237,193,133,
+133,133,248,227,143, 63,128,154,169, 30,236, 33,189,168,168,232, 73,177, 88,140,173, 91,183, 70, 76,152, 48,225,156, 85, 31, 45,
+115,231,244, 45,133,133,133, 91,238, 39,140,182, 93, 6,182,110,221,234, 63,106,212,168,221, 42,149,170, 67, 99, 69,132, 72, 36,
+ 90,115,230,204, 25, 95, 46,151,139,180,180, 52,140, 27, 55,174,196,201,244, 14, 44, 88, 60, 76,168, 6, 48, 47, 43, 43,235,243,
+183,223,126,251,131,118,237,218,189, 58,101,202, 20,170,109,219,182,200,207,207, 71,118,118, 54, 90,182,108,137,220,220, 92,124,
+247,221,119,186,146,146,146,213,168, 25,108, 82,249,159,141, 49, 47, 47,175,187, 59,119,238,100,130,130,130, 44,253,132,124,124,
+124,138,230,207,159,207,200,229,114,198,215,215,183,192, 13,154, 58,171,123,135,132,132,156,184,120,241, 98, 86, 79, 95, 40,199,
+125, 17,193,124, 85,221,147,249,170,186, 39,179, 38,191, 27, 19,209,195,219,248,218,180,215,242, 62,255,252,243, 91, 27, 54,108,
+200,252, 31,123,215, 29, 30, 69,181,183,223,153,237, 37,189,147, 4, 18, 32,244,208,139, 32, 29,129, 32,132,122, 85,138,128,162,
+126, 72, 64, 44, 8, 4,244,114, 17,145, 4, 68,165,233, 5, 47,150, 0,210,171, 20,169, 66,128, 80, 36, 32, 37,161, 5, 18, 72,
+207,166,111,175,115,190, 63,178,179,110,194, 38,187, 27,192, 58,239,243,204, 51, 59,237,221,211,230,156,247,252,206,239,156, 89,
+187,118,237,157,252,252,252, 59,225,225,225,103,234,224,164, 2,228,130,189,221,219, 69,145,231, 7, 63, 71,122,182,141, 32, 97,
+222,162,156,107,241,145, 68,187, 44,130, 88,138,210,201,229,219, 69,100,220,191, 15,144,113,255, 62, 64, 46,223, 46, 34,150,194,
+235, 68,179, 64, 76,212,203,155,145,103, 26,251,220,114, 20,206, 86, 33,178, 37,251, 23, 12, 35,134, 29,147,201,182,184,182,164,
+117,176,236,102,125, 57,125,229, 66, 73,179, 6, 30,247,206, 38, 12, 50,156,223,183,142, 60,211,181, 19,201,201,201, 33,121,121,
+121,228,240,225,195,196,207,207,207, 0,224, 56,170,214, 22,114,180,125,129,223, 22, 68,125,132,243,226,143, 95,147,151,134,245,
+ 37,189,163, 27,144,168, 16, 57, 35, 21,241,212, 0,246,219, 61,127,188,121,243,230, 6,165, 82, 73, 84, 42, 21,185,126,253, 58,
+105,209,162, 69, 9,126,155, 17, 53,208,129, 9,184,124,252,248,241,196, 17,146,147,147,201,181,107,215,200,212,169, 83, 73,231,
+206,157, 73,207,158, 61,201,184,113,227,200,255, 17, 16, 0, 55, 28,112,142, 10, 13, 13, 45, 95,178,100, 9, 57,121,242, 36,217,
+176, 97, 3, 89,178,100, 9,121,255,253,247,201,230,205,155,201,141, 27, 55,200,158, 61,123,156,241, 57, 10,231,147, 0,199,249,
+199,112, 30, 78, 75, 75,179,149, 41,139,197, 66,114,115,115,201,145, 35, 71, 72, 72, 72,200, 13, 84,173,147,229,136,211,171,117,
+235,214, 55,111,221,186, 69, 30, 62,124, 72,140, 70,163,141,227,230,205,155, 4,192,169, 39, 16,206, 22, 97, 97, 97, 69, 39, 79,
+158, 36,183,110,221, 34, 33, 33, 33,217, 79, 50,238,145,145,145, 69, 10,133,130,156, 56,113,130, 4, 6, 6, 22,161,110,139, 45,
+ 87,150, 56,206,191, 50,103, 36,128,141,157, 59,119,182,172, 90,181,138,188,249,230,155, 36, 34, 34,194,130,170, 69,190,195,240,
+ 15, 66,173, 22,173,242,242,242,136, 55,223,124,243,242,179,207, 62,219,181,160,160,128,237,141, 25,104,154, 38, 10,133,130, 49,
+ 26,141,185,238,254,153,209,104, 44,184,126,253,122,192,138, 35,151,139,102, 47,154, 25,148,140, 60,217,179, 47,133, 96,239,178,
+ 76,188,216,127, 74, 89,108,204, 40, 83,100,100,164,205,130,117,235,214, 45,232,245,122,109, 29,148,228,153, 38, 62,221,118,204,
+110,141,125,103,239, 98,209,181,226,239,229, 34,222,174, 93,151,203,246,207,237, 9, 24,183, 79, 64,251, 23, 54, 96,243,162,161,
+ 0, 0,166,232, 6,140,219, 39,130,146, 5,224,116,174, 0, 21, 90,227, 1, 71,164, 77, 2,101,175, 14,108,198,199,222, 19,151,
+176,104,239,195,239, 45,132,212,155,179, 76,109,212, 1,136,158,178,250,124, 2,112,126,172,222,104, 9, 24,208,191, 31,246,253,
+184,159,110,213,170, 21, 54,109,218, 36,156, 56,113, 98,180, 59, 67, 20, 53, 57, 45, 12, 9,160,128, 98, 2,108, 17, 11,120,243,
+181, 6,139,142,109, 52,172,195, 20, 66, 7,195, 20,181,249,130,236,201,203,203, 59,113,225,194,133, 11,111,191,253,118, 11,137,
+ 68, 66, 9, 4, 2, 88, 44, 22, 48, 12, 3,139,197,130,242,242,114,220,186,117, 11,141, 27, 55,182,153,128, 15,120,122, 84, 2,
+170,255,212,198, 55,127,254,124,155, 73,185, 99,199,142,200,201,201, 65, 86, 86, 22, 46, 95,190,108, 51, 41,187,200,199,225,175,
+ 15,241,249,243,231, 33, 22,255,246,149,165,171, 87,175,226,173,183,222, 74,179,250, 84, 85,214,242, 92,101,122,122,122,207,161,
+ 67,135,158, 94,181,106, 85,107,251, 33,231,147, 39, 79, 2,128,254, 73, 88,223,114,115,115,251,196,196,196,172,244,247,247,239,
+ 80, 80, 80,176,224, 73, 70, 60, 43, 43,235,189,118,237,218, 45, 81, 42,149,149,110, 14,109,114,224,240, 87, 67, 22,128,137,169,
+169,169,203, 82, 83, 83, 63, 64,213, 84,250,197, 0,210,185,164,169, 5, 97, 97, 97,119,231,206,157,171,187,120,241,162, 37, 46,
+ 46,174, 68, 46,151, 79,171,135,226,149, 6, 4, 4,108, 13, 10, 10, 74,241,247,247,191,228, 17, 44, 82,200, 27,210, 70,207, 64,
+113,129,143,143,207,245,160,160,160,115,246,223, 65,244,243,243,251, 25, 64,120, 93,156, 45,131,229,211, 95,232,232,159,219, 42,
+ 68,182, 18, 85,159, 20,162, 90, 4,203, 14,239,158,224, 73, 52, 31,251, 17,205, 34, 47,162, 93,217,150,104, 87,182, 37,154,197,
+254, 68,187,162, 13,185,147,208,157,116,139,244,206,111, 26, 44, 15,248,189, 56, 89, 88, 87,113,111, 17, 25, 25,169,184,116,233,
+ 18,201,202,202, 34, 7, 15, 30, 36, 50,153,236,122,125,123, 16,246, 43,195, 87, 75,108,169,244, 72,101,101, 37,209,233,116,228,
+196,137, 19, 36, 56, 56,216, 81, 15,186,174, 94, 73, 16,128,213,109,218,180, 49,173, 88,177,130,236,221,187,151,172, 89,179,134,
+140, 26, 53,138,204,153, 51,135,140, 29, 59,150, 4, 6, 6,234,173,230, 95,111, 23, 56,235,203,199,245, 28,255, 94,156, 17,214,
+ 94,173,189,229,118,126, 13, 75, 86, 93,156, 94,214,251,107,179,252,114,121,196,113,114,156,127, 77,206,127, 46, 2, 3, 3, 63,
+ 93,176, 96,129,250,167,159,126, 50,206,156, 57, 83,213,160, 65,131,211, 79, 40, 35,130, 0,116, 7,208,165,150, 74,182, 94,153,
+219,222,219,219,187, 69,144,236,231,185,207,249,145,203,115,155,144,138, 21, 29,136,230,171, 30,228,110, 66, 87,242,229,203,205,
+ 73,135, 80,207,135,205, 3,101,109,255, 96,206,250, 12, 81,184, 85,176, 93, 28,166,112,133,211, 93, 19,240,211, 48, 41,115, 21,
+ 26,199,201,113,114,156, 28, 39, 39,180,254,190,104,214,172, 89, 70,187,118,237,238,199,197,197,165,253, 69, 50,151,106, 25, 36,
+ 31,219, 34, 72,190,187, 85,144,244, 94,155, 96, 89, 78,139, 32,217,177, 22,129,178,247, 59, 53,128,244, 79,194,217, 66, 36, 18,
+ 29, 9, 13, 13, 85, 0,120,229, 41,164,231,132,144,144,144,135, 86,107, 89,139, 39,192, 25, 13, 96, 43,128, 45, 0, 90, 63,129,
+112,186,202,199, 85,104, 28, 39,199,201,113,114,156,156,208,250,123, 98,218,180,105,124,174,192,112,156, 28, 39,199,201,113,114,
+156, 28, 39,199,201, 9, 45,247, 65,213,145, 88,199,158,114,130, 31,227, 56, 57, 78,142,147,227,228, 56, 57, 78,142,243, 31,199,
+233,140,251, 24, 56,112,202,156,227,228, 56, 57, 78,142,147,227,172,149,147,178,110,180,117, 99,143,255,204,113,167,254,196,113,
+255,167,112,254, 45,193,255,131,254,151,205, 8, 6,117,125, 61,153,195, 31, 9,251, 23,132,112,249,196,225, 79, 10, 15, 62,159,
+255,174, 72, 36,234,107, 54,155, 91, 3,128, 64, 32, 72,215,235,245,167,204,102,243, 23, 0, 84, 92, 18,253, 97,117, 7,207,174,
+177,181, 88, 55,252, 9,235, 18,123, 81,192, 60,102,187,244, 52,226,254, 79,230,252,219, 11,173, 14,114,185,252, 63, 34,145,168,
+ 9, 69, 81, 22,181, 90,125, 77,175,215,175, 3,112,238, 49,255,243,155,224,224,224, 87, 74, 74, 74, 24,246, 35,197, 20, 69,129,
+166,105, 8, 4, 2,109, 69, 69,133, 87,125, 72, 3,219,142,122,159, 79, 81, 51, 45,196,178,174,232,250,190, 79,156,157,231, 80,
+247, 11, 35, 20, 10,199,248,249,249,249, 40, 20, 10, 66,211, 85,171, 71,240,120, 60,118,133,121,115, 69, 69,197,247,174,146,249,
+250,250, 94,244,243,243,243, 97,159,167, 40, 10, 37, 37, 37,229, 69, 69, 69,221, 0, 64, 34,145,156,149,203,229,254,124, 62, 31,
+ 60, 30, 15, 60, 30, 15, 26,141,166,164,164,164,164,231,239, 25,105, 95, 95,223, 20,154,166,155,184,243, 12,195, 48,247,203,202,
+202,158,229,138, 76,117,108,223,190,157, 23, 19,246, 90, 20,159,104,219,211, 52,241,102, 24,170,194, 76, 73,175, 30,206,253, 38,
+195,149,231, 95,124,241, 69,139, 11,183,245,241,242,242,218,176,123,247,110,223, 78,157, 58,209,197,197,197,104,220,184, 49, 74,
+ 75, 75,187, 37, 39, 39,119,126,237,181,215, 94, 83, 42,149,147, 0, 36,115, 57, 82, 55, 68, 34,209,138,224,224,224,215, 85, 42,
+149,134,162, 40, 66, 81, 20, 40,170,170,159, 85,115,111,177, 88,114, 74, 74, 74,186, 56,105,108, 5, 34,145,232,243,144,144,144,
+201, 26,141, 70, 99,229,115,200, 11, 0, 38,147, 41,167,184,184,184,139, 75,117,125, 96,224, 58,169, 84,250,178, 70,163, 81, 83,
+ 20,197,216, 95, 35,132,216, 55,230,247,138,139,139,123, 59, 19, 6, 34,145,104,101,112,112,240,171,214,184,219,194,249,184,113,
+ 15, 14, 14,158,172, 86,171, 93,226,172, 35,238,143,112, 62,141,112,254, 73, 57,255,254, 66,171, 99,199,142, 91, 46, 92,184,208,
+ 92, 32, 16, 0, 0,116, 58, 93,187,213,171, 87, 79,154, 59,119,110, 34,128,121,245,252,191,164,222,189,123,143, 75, 78, 78,166,
+247,238,221, 75,119,237,218, 21, 20, 69,193, 98,177,192, 98,177,160,109,219,182,210,250, 70,196, 91, 46,139,191,124,244,107, 73,
+135,129,111,204, 44, 2, 62,113,118,190, 46,129, 9,224, 67, 0, 77,220, 12,130,194,154, 46,151,127,175, 70,252, 41, 9, 3, 74,
+ 40, 20,254,171,119,239,222,222,199,142, 29,163,178,179,179, 41,169, 84,106, 91,172,212,100, 50,161, 77,155, 54,110, 89, 66,125,
+124,124,188,226,227,227,163,158,127,254,121,236,220,185, 19,147, 38, 77, 66,175, 94,189,238, 20, 21, 21, 1, 0,228,114,185,127,
+ 90, 90, 90,115, 63, 63, 63,104, 52, 26, 84, 84, 84, 96,208,160, 65, 40, 41, 41,121,236, 2,238, 21,142, 38, 22, 1, 22, 7,134,
+ 75, 7, 40, 30,104, 23,169, 31, 98, 77,109,247, 10, 4,130,240, 7, 15, 30, 4,137, 68, 34, 16, 66,192, 48,140,195, 61,251,219,
+104, 52,162, 77,155, 54,198,218,248,158,233, 24,190,152,162, 41,219,135,133,137,217, 82,122,225,106,222,135,143, 27, 39, 63, 63,
+191,203, 98,177, 56,216,169, 90,182,107,200,116, 58, 93, 97,105,105,105, 39, 39,143, 68, 2, 24,206,227,241,154,241,249,252,150,
+ 0, 34,205,102,115, 48, 0, 8,133,194, 66, 30,143,151,101, 50,153,110, 25, 12,134,187, 0,126, 68, 29, 31, 64,142, 9,123, 45,
+138, 50,107, 94, 80,234,153,161,178,166,137, 45, 52,247,226,111,203,196,154,131, 49, 97,175,237,112, 85,108, 57,193,192,254,253,
+251,111,217,191,127,191, 68, 40, 20, 66,171,213,226,198,141, 27,240,246,246,134, 72, 36,194,200,145, 35,121, 61,123,246,244,239,
+215,175,223,206,219,183,111,143,135,123, 62, 31, 45, 0,108, 67,213, 7,165,223, 68,245, 47, 20,212, 7, 97, 0, 70,160,234,155,
+143,141,141, 70, 99, 49,128, 84,107,152,238, 0,136, 8, 12, 12,252,129, 97, 24,125, 73, 73,201,107,112,240,161,234,238,157, 27,
+ 94,162,105, 58,156,181, 9, 48,196,146,115, 62, 53,231,137, 52, 80, 52, 77,175,140,141,141,125,117,199,142, 29,178,212,212, 84,
+ 89,235,214,173,109, 29, 34,182,204,219,163,113,227,198,206,172, 26,124,154,166, 87,188,240,194, 11,227, 55,110,220, 40,123,240,
+224,129, 44, 52, 52,212,198,105, 47,182, 88, 56,251,132,152, 93,217,255,102,240,224,193, 19, 55,108,216, 32,216,183,111,159, 52,
+ 32, 32, 0,254,254,254, 14,191, 25,219,179,103, 79,198,121,212,233,149, 35, 71,142,156,184,117,235, 86,217,133, 11, 23,100,109,
+219,182, 5,143,199,123,236,184,143, 26, 53,106,252,150, 45, 91,100,215,174, 93,147, 53,107,214, 12,172, 81,161, 38, 31, 77,211,
+104,216,176,161, 75,156, 35, 70,140, 24,191,109,219, 54,217,229,203,151,101, 45, 91,182,180,165, 39, 91, 39,213, 39,156,127,114,
+206,127,132, 69, 75,100, 52, 26,113,234,212, 41,208, 52, 13, 63, 63, 63,188,242,202, 43, 56,122,244,104,252,137, 19, 39,246,215,
+195,178,245,141, 85,100, 9, 0, 96,215,203,163,112, 95, 0,188, 85,100,128, 80, 40,196,189,123,247,192,227,241,220, 54, 45,138,
+197,226,201,132,144,127,107,114,127, 17,107,181, 38,232,242, 46,201,164, 82,169,173, 1,208,228, 89,207,231, 95,146, 73,165,210,
+123, 60, 30,239, 99,149, 74,149, 84, 27, 95,179,102,205, 54,221,184,113,163,149,179,143, 61,215,132, 70,163, 65,163, 70,141, 34,
+ 74, 75, 75,155,253, 30,141,184, 51, 78,179,217, 12,137, 68, 2,214, 26,101, 48, 24,160, 82,169,156,113, 82, 66,161,112, 12, 43,
+178, 0, 96,243,230,205, 8, 9, 9, 65, 80, 80,144,237,163,210, 44,167,171,224,241,120,136,137,137,193,194,133, 11,145,152,152,
+136,217,179,103, 87,171,104, 5, 2, 1,252,252,252,240,211, 79, 63,193,203,203, 11, 17, 17, 17, 96, 5,126,173, 2, 42,130,166,
+ 76, 38,134,214,230,193,177,229,163, 1,164, 82, 30,150, 70,245,242,121,115,216,187,145,252, 6,205,101, 88, 60,248,210, 60,245,
+ 67,253,154,186,132,137, 80, 40,196,245,235,215, 31,169, 16, 28,222,207, 35, 48,136, 43,253, 26,247,145, 42, 28,137, 56,138,166,
+252,206, 93,122,104,179,208, 14, 25,208,138,255, 76, 39,254, 87,214,166, 18, 52, 13, 48, 76, 85,211, 73, 81, 32,102, 19, 83,118,
+233, 90,222, 2, 23,210, 51, 52, 43, 43, 43,200, 89, 26,177, 48,155,205, 8, 13, 13,229, 57,185,109,104,116,116,244,174,184,184,
+ 56, 97,179,102,205, 40,161, 80, 8, 62,159, 15, 62,159,207, 10,244, 8, 66, 72, 4,195, 48,253, 10, 11, 11,201,234,213,171,151,
+157, 60,121,114, 52,128,131, 14, 43, 22,162,109,175,212, 51, 67, 79, 95, 65,183, 23, 6,206,197, 79,219,227,187,245,238,200,192,
+ 83,166,205, 0, 80, 47,161,197,138, 13,139,153,161,238,100, 86,248,237,220,185,131,162,105, 90,175, 84, 42,193, 48, 12,122,246,
+236, 9,154,166,113,253,250,117,124,240,193, 7,216,181,107, 23,246,236,217, 35,237,220,185,243,183, 26,141,166, 53,170,190,197,
+230, 84,100, 69, 71, 71, 95,185,112,225,130,196,104, 52,162,123,247,238,231,111,223,190,221, 25,245, 91,193,221, 23,192,103,243,
+230,205,155, 24, 23, 23,199,243,241,241,129, 72, 36,130, 82,169, 68, 70, 70,198,228,239,191,255,158,172, 93,187,246, 75, 0,158,
+ 89, 89, 89, 61, 46, 94,188,136,254,253,251,191, 13,224,221, 71, 21, 1, 47,252,236,197,204, 32,246,120, 68, 76, 59, 97,143, 46,
+116, 97,149, 21,167,230,221, 4,140,133,201,185,248,107,174, 43, 66,108,217,168, 81,163, 38,236,216,177,195, 3, 0,254,251,223,
+255, 98,204,152, 49,240,243,243,131, 76, 38,131, 80, 40,132, 64, 32,168,182,119,210,216,242, 0, 44, 27, 59,118,236, 11, 27, 55,
+110,244, 4,128,141, 27, 55, 98,212,168, 81,240,247,247,135,167,167, 39, 68, 34,145,237,123,175,110,118, 48,190,233,213,173,219,
+148, 13, 27, 54, 0, 0, 62,120,231, 29, 60,255,204, 51,240,144, 73, 33,147,138,192,166,133,136, 39,192,144,183,102, 58,213,151,
+ 0,150,143, 25, 51,230,165,173, 91,183,122, 2, 64,106,106, 42,138,138,138, 16, 28, 28, 12,169, 84, 10,145, 72,100,139, 51, 69,
+ 81,144, 74,165, 46,197,125,204,152, 49, 47,108,217,178,197, 19, 0,146,146,146, 16, 19, 19, 99,139,187, 88, 44,134, 80, 40,172,
+182,213, 20,157,142, 56, 71,143, 30,253,194,182,109,219, 60, 1,224,251,239,191,199,192,129, 3,225,235,235,107, 75, 79,150,203,
+157, 60,250,147,115,254, 51,132,214,149, 43, 87,254, 37,151,203, 19, 0, 4,138, 68, 34,159,241,227,199, 55,156, 50,101, 10,198,
+142, 29,139, 19, 39, 78, 76,117, 83,104, 81,193,193,193,175, 36, 39, 39,219, 90,104, 3,121, 68, 48,185,221,128, 91,241,239, 75,
+ 83,167,134, 36,102,168,112,254,226, 45, 72, 64, 83, 23,151, 47, 15,212,221,189, 11,139,193,128, 69,247,148, 85,231,205,132, 58,
+245,222, 91, 33, 29, 86,124,249,111, 0, 73,117, 52,182, 98,189, 94,143, 59,119,238,184, 21,136,236,236,108, 71, 31,127,174,119,
+ 35, 30, 17, 17, 81,215, 11,232,148,243,240,225,195,152, 53,107, 22,110,221,186, 5,246, 83, 37, 46,112, 82,126,126,126, 62,172,
+200, 98, 69,144, 84, 42,133, 64, 32,160,248,124, 62,197, 14,237, 89, 95, 46,151,132, 49, 77,211,216,180,105, 19,150, 46, 93,138,
+ 57,115,230, 96,221,186,117,104,223,190,253,111,133,144,207, 71,101,101, 37,124,125,125,225,235,235, 91, 77, 32,214,134,202, 7,
+ 12, 1, 28,139, 44,105, 35,132, 72,165,252,131, 99, 63,137,234,208,246, 57,127,168, 74,140,216, 52,247, 14,138, 51,245, 59,156,
+165, 39, 33, 4,237,219,183, 7, 69, 81, 54,161,193,110, 2,129, 0,124, 62, 31, 60, 62, 15, 58,170, 18, 77,122, 9,241,206,206,
+ 86,210, 6,205,101, 82, 71, 34,174,102, 54,127,254,197, 42, 25, 24, 82,229, 4, 66, 24,128, 1, 8, 8, 24,194,160, 48, 55, 3,
+255, 89,248,169,203,173,143, 64, 32,192,221,187,119,109,225,102, 45,195,172, 48,178,183, 26, 68, 70, 70, 58, 45, 75, 66,161,240,
+163, 61,123,246,136, 54,109,218,132,173, 91,183,130,162, 40,136,197, 98,200,229,114,248,248,248,192,223,223,223,182,133,135,135,
+ 83,223,126,251,173,176,125,251,246, 31, 85, 86, 86, 30,116,156,231,196, 91,214, 52,177,197, 11, 3,231, 2, 0, 94,152, 75, 80,
+118,231,147, 14,116,249, 2,239,250, 91, 94,170,196,198,226,197,139,241,241, 51,207, 64, 36, 18,145,138,138,114, 9,219,185,224,
+209, 60,164,165,221,192,138, 21, 43, 48, 97,194, 4,220,187,151, 65, 34, 34, 34,245,179,102,205,242, 72, 76, 76,124,199,104, 52,
+ 46,114, 38,178,218,181,107,119, 38, 37, 37, 69,162,209,104,192, 48, 12, 14, 30, 60, 40, 27, 56,112,224,233,204,204,204,222,238,
+138,173,200,200,200,125, 41, 41, 41, 61, 3, 3, 3, 81, 81, 81,129,202,202, 74,152, 76, 38,240,120, 60, 68, 68, 68, 96,217,178,
+101,212,200,145, 35,103, 76,158, 60, 89, 39,149, 74, 89,203, 70,164, 35,174,154,239,247,234, 53, 95,249, 16, 82, 85,126, 8, 67,
+170,237, 75,139,178,240,206,123,174,125,189,170, 97,195,134,111,238,220,185,211,195,222,178,100, 47, 2,236, 69, 22,187, 57, 17,
+ 6,116,163, 70,141,166,252,240,195, 15, 54,206,128,128,128,106,239, 15, 77,211, 56,125,250, 52, 18, 62,154, 7,223,192, 80,172,
+ 90,243, 95,151,134, 11, 99, 98, 98, 94, 78, 74,250,173,234,110,215,180, 41,134,245,124, 6, 65, 1, 94, 8,240,245,172, 74, 39,
+134,194,213, 91,153, 78,219, 35, 0,116,195,134, 13, 95,219,190,125,187,135,125,135,144,141, 43,219,121,102,173,248, 6,131, 1,
+ 93,186,116,113, 41,238,246,156,172,181,141, 21,109,108,122,178,255,195,190,175, 78,194, 57,133, 21,194, 86,193, 89,141, 67, 32,
+ 16, 96,251, 79, 27,106,181,102,215,151,211,221,124,175,201,153,149,149,133, 37, 75,150,128,237,180,217,187, 10,133,133,133, 97,
+213,170, 85, 78,235,165, 26,239, 64, 87, 0,129,118,167, 12, 0, 68,118,123, 5, 69, 81,191, 56,184,143, 61, 47,176,142, 88, 5,
+ 90,219, 14, 37, 0, 31, 7,124,181,241, 20, 91,219,188,192, 26,247, 87,251,159, 90,133,214,254,253,251,217,183,184, 95,108,108,
+236, 41,235,239,114,177, 88,156, 45,147,201, 66, 0, 40, 15, 30, 60,136,255,251,191,255,131,213,180, 58,194,219,219,251,134, 3,
+171,206, 21,189, 94, 63, 23, 64,161,245, 20,107,174,167, 75, 75, 75,153,163, 71,143,210, 27, 71, 15,134,129, 0, 29,255,157,128,
+152,216, 88, 28, 14, 19,129, 7,160,219,205, 98,200,100, 50,126,101,101,165,201,222,111,203,129,239,214,177, 26, 5,138, 39,225,
+243,209,253,204, 1,204, 58,115, 0,221,228, 34,148,236,216, 6,229,217,100,208, 52,133, 62,242, 0,204,158,112, 20,207,122,137,
+ 33,210,171, 65,211,180,163,146,109,227,188,115,231,206,139, 94, 94, 94, 9, 53, 18,216, 21,220, 71,213,119,156, 80, 75, 56, 93,
+106,196,217,237,242,101,135, 35,144,181,114, 90,135,224, 32,151,203,113,252,248,113,219, 61,207, 61,247, 28,116, 58, 29,252,252,
+252, 92,226, 84, 40, 20, 36, 47, 47,143,218,184,113, 35, 4, 2, 1,252,253,253, 33,147,201,168, 13, 27, 54,204, 19, 10,133,225,
+ 58,157,142, 49, 24, 12, 16,137, 68,171,216,252,225,243,249,234,202,202, 74,255,218, 56,121, 60, 30,226,226,226,240,254,251,239,
+ 99,221,186,117,152, 58,117,234, 35, 22, 47,157, 78,135,128,128, 0,155,216,114,240, 2,186, 52,244, 35, 11, 67, 91,159, 96,209,
+145, 41,171, 90, 5,135,181,148, 35,101, 75, 1, 14,172,204,202, 81, 23, 90,190, 48,148, 97,167, 51, 78, 66, 8, 50, 50, 50,106,
+ 21,195, 37,101,197,120,255,227, 55,209,241, 53, 57,106, 17,113,191,113, 50, 4, 55, 46, 31, 70,218,181, 99, 96, 44, 12, 44, 12,
+ 1, 33, 22, 48,102, 32,245,232,249,230,249,247,243,194, 8, 72,149,235, 45, 0,113,133,202,220,215, 95,212, 18,192,222, 83, 37,
+134, 21,206,226,206,231,243,161,211,233,176,103,207, 30,220,188,121, 19, 7, 15, 30,132, 86,171, 69, 64, 64, 0,124,124,124,240,
+204, 51,207, 96,242,228,201,136,140,140,116,154,239,132,144,164,236,236,236,142,189,122,245,162,202,203,203, 81, 94, 94, 14,173,
+ 86, 11,139,197, 2,179,217, 12, 62,159, 15,137, 68, 2,169, 84,138,224,224, 96,232,116, 58,162,215,235,147,106,227,100, 24,170,
+ 66,115, 47,254,246, 79,219,227,187,189, 48,151, 96,199, 82, 10, 81,141,196,154,227,151, 60,167,236, 61, 51,123, 16, 0,194, 16,
+155,105,129,152, 44, 76,241,251,243, 62,155, 81, 87, 56,217, 60, 73, 73, 73,193,140, 25, 51, 96,177, 88, 40, 1,159, 15, 66, 8,
+ 40,154,198,237,219,183,177,122,213,106,140, 27, 55, 14,205,162,162, 96, 48, 26,161, 82,169,208,191,127,127,193,170, 85,171,250,
+217, 9,173, 99,117,136, 44,127,173, 86, 11,165,178,202,248, 37, 18,137,176, 99,199,142,128,225,195,135, 39,231,229,229,213,245,
+ 61,210, 71, 56, 61, 61, 61, 35,120, 60, 30,174, 95,191,142,181,107,215,226,248,241,227, 40, 44, 44, 44, 11, 13, 13,245,238,215,
+175, 31,253,206, 59,239,160, 99,199,142,248,238,187,239, 36,206, 56, 9, 33,200,186,115, 26, 89,119,207,128, 97,170,132,101,213,
+230,248,119, 29, 61,160,106,225, 84,171,213,186, 43, 87,174,120,172, 95,191, 30, 65, 65, 65,104,220,184, 49,100, 50, 25, 36, 18,
+ 73,181, 70,214,190,225,117,246,110,106,181, 90, 93, 86, 86,150,199,150, 45, 91,224,239,239,143,200,200, 72,200,100, 50,136, 68,
+ 34,240,249,124, 80, 20,133,141, 27, 55, 98,243,194, 9,200,186,117, 13,163,134, 13,114, 26, 78,153, 76,246,114, 82, 82, 82, 53,
+ 19, 72,176,175, 47,248, 2, 26, 60, 1, 5,223,231, 70, 3, 0,202, 78,236,174,178, 85, 57,143, 59,165, 84, 42,117, 23, 46, 92,
+240,184,116,233, 18, 24,134, 65,100,100, 36, 52, 26, 13,188,188,188,108,241, 63,122,244, 40, 70,142, 28,137, 77,155, 54,161, 71,
+143, 30, 78,227,174, 82,169,116,215,174, 93,243,248,225,135, 31,224,231,231,135,134, 13, 27,218,226,206,110, 2,129, 0, 60, 30,
+ 15, 77,154, 52, 65, 69, 69, 5, 60, 60, 60,156,230, 81,106,106,170,199, 15, 63,252, 0, 95, 95, 95,132,135,135,219, 44,110,172,
+ 56, 90,250,213,194,106, 4, 18,170,193, 99,115,186,155,239, 53, 57, 71,141, 26,133,168,168, 40,120,121,121, 65, 46,151,219,184,
+235,226,172, 69,139,216,244, 54, 69, 81,251,237,222,137, 88,138,162,246,219,239,107,187,207,250,179,207,188,121,243,186, 36, 38,
+ 38, 46,233,209,163,199,150,148,148,148,205,181,241,213,198, 51,111,222,188,232,196,196,196, 37,246,247, 59,248,159,218, 45, 90,
+177,177,177,148, 53,146, 20,128,198,157, 59,119,254,229,196,137, 19,126,158,158,158,182,155, 31, 62,124,136,242,242,114,120,122,
+122,122,125,254,249,231, 94,253,250,245, 67,112,112,176,173, 7,112,231,206,157, 54, 45, 90,180,168, 4, 80,211,110,203,208, 52,
+141,103,159,125, 22, 55,172,163, 29, 49,177,177, 8, 15, 15,183, 57,121, 72, 36, 18,204,152, 49,131,154, 53,107, 22,159,181,102,
+ 16, 66,160,213,106,209,160, 65, 3,105, 93, 86, 8, 0,136,214, 22, 99,119,191, 62,160, 41, 64,115,249, 34,132, 34, 10, 52,143,
+ 66, 39, 82,130, 67,253,251,128, 2, 96,248,245, 28, 92,176,194, 92, 6, 48,232,105,152, 15,157, 53,226, 14,226, 69,213,151,147,
+181,104,164,164,164,192, 98,177,184,202, 73,104,154,134, 92, 46, 71, 72, 72, 8,164, 82, 41,100, 50, 25,181,101,203,150, 15, 27,
+ 55,110,220, 96,214,172, 89,116,101,101, 37,253,236,179,207, 98,204,152, 49,124,118,136, 51, 58, 58,218,105, 92, 78,157, 58,133,
+181,107,215, 98,234,212,169, 14, 45, 90, 20, 69, 33, 48, 48, 16, 94, 94, 94,245, 78, 95,113, 35, 68, 6,132, 75, 78, 77,255,174,
+173,143, 87,144, 16, 63,173,121,136,195,171,179,119,235,138,241, 57,204,184, 5,160,204, 85,139,150, 35, 1, 12, 30, 3,139, 95,
+ 9, 94, 93,221, 28, 97, 45,189,145,178,165, 0, 7,191,120,104, 81, 41, 76,179, 29,136, 56, 48, 0,140,102, 19, 52, 42,173,109,
+ 72,215, 98,177,224,218,201, 95,155,223,255,245, 78,244,254, 45,155, 4, 0,160, 59,185,187,218,160,231,152,175,182,181,232,235,
+ 43,184,112,170,204,116,161,174, 50,207,231,243,241,202, 43,175, 32, 49, 49, 17, 47,191,252, 50, 14, 30, 60,136, 5, 11, 22,224,
+245,215, 95,127,196,170,229,172,231,104, 50,153,190,158, 52,105,210,212, 29, 59,118,180,156, 59,119, 46,205, 90,180,100, 50, 25,
+ 40,138,130, 78,167,131, 94,175,135, 86,171,197,173, 91,183,152, 55,222,120,227,182,193, 96,248,186,214,225, 74, 74,122, 85, 38,
+214, 28,108, 26, 78, 71,169, 51, 63,245,236,245, 76,164,150,146,118,174, 24,221, 98, 32, 25,250, 74,164, 47, 8, 1, 97, 0,134,
+ 0,122,189, 26, 51,102,188,205,115,165,172,103,221, 57,141, 43,151, 47, 66, 42, 21, 67,165, 84,193,194, 88, 64, 24, 2,177, 80,
+128, 15, 63,152,143,113,227,198, 35,170,105, 83, 88, 44, 22, 8, 5, 66,124,255,253,247,232,210,165, 11, 12, 6, 67,107, 23, 44,
+ 89,254, 58,157, 14, 87,174, 92, 65,255,254,253,145,157,157,141,244,244,116, 52,111,222, 28, 27, 54,108, 8, 28, 63,126,124,114,
+ 81, 81,145,203, 31,127,191,118,237,218,188, 14, 29, 58,172, 84,169, 84,165, 42,149,106, 37,128,205, 0,202, 51, 50, 50, 90,103,
+100,100,172, 62,124,248,112,239,255,252,231, 63,188, 26, 62, 58,188, 90, 34, 15,147,201, 12,173, 86, 95,167,192, 98,143, 9, 97,
+ 92,122,103, 40,138, 34, 45, 91,182,196,240,225,195, 33, 16, 8, 32,147,201,224,225,225, 81,109,216,172,166,224,170, 43,139, 0,
+ 48, 20, 69, 33, 52, 52, 20, 67,135, 14,133, 80, 40,172,198,201,150,195,161, 67,135, 98,230,162,127,227,235,153, 3,176,118, 82,
+115, 12, 92, 92,232,204, 53, 67,245,243,207, 63, 75,223,159, 58, 21, 29,154, 53, 67,128,151, 23, 26, 5, 7, 66, 42, 22, 65,104,
+ 31, 38,202, 37, 35, 59, 1,192,240,120, 60,180,109,219, 22,133,133,133,200,204,204, 68,102,102, 38,104,154, 70,175, 94,189,108,
+ 86,152,187,119,239, 98,209,162, 69,208,235,245, 46,199,189, 89,179,102, 24, 48, 96, 0, 68, 34, 17,100, 50, 89,181, 33, 67, 54,
+ 77,149, 74, 37,162,162,162,176,119,239, 94,180,104,209,194, 41,103,171, 86,173,208,183,111,223,106,233, 41,149, 74,109,162, 8,
+ 0,178, 47,168,108,255, 17, 22, 22,230, 22,231,145,139, 15,177,254,232,207,208, 27, 24, 84,106, 76,213,189, 48, 2,188,112,230,
+135,185, 46,197,157,229,252,223,255,254,135,242,242,114, 91,221,201,118,202, 89, 35, 74,195,134, 13,241,223,255, 58,182,100,214,
+208, 34,142,234,129, 88, 23,219, 91,246, 62,182,112,137, 19, 19, 19,151,212,124,222, 25,159,253,245, 26,207, 27,106,136,179, 66,
+183,134, 14,197, 98,241,252,159,127,254,217,175,162,162, 2,119,239,222, 5, 77,211,182, 49,117, 62,159, 15,163,209,136,123,157,
+170, 47, 17, 0, 0, 32, 0, 73, 68, 65, 84,247,238,193,207,207, 15, 69, 69, 69, 16,139,197,224,241,120, 48, 24, 12, 0,208,169,
+182, 6,156, 16,130,153,138, 42, 23,161,159, 66,133,200, 2, 48, 76, 81,245, 98,176, 14,241, 59,119,238,132,135,135, 7, 60, 61,
+ 61,109,123,103,195, 72,215, 50, 51, 80, 40,160, 64,159, 59, 13,138, 6,104, 10,160,120, 0, 77, 19,208, 20, 5,250, 92, 50, 40,
+ 10,144,251,251,186,219,118, 59,115,140,175,211, 1,222,157, 70,188,230,239,147, 39, 79,194, 85,206,168,168, 40,120,120,120,216,
+182,195,135, 15, 87,179,104, 89, 44, 22,248,251,251,187,194, 73,172,254, 56, 8, 10, 10,130, 64, 32,160, 54,108,216, 48,175, 73,
+147, 38, 13,222,123,239, 61,154,199,227,225,242,229,203, 72, 75, 75, 67,100,100,164,203, 62, 91,229,229,229,249,243,230,205,179,
+204,155, 87, 53,135, 34, 58, 58, 26,229,229,229, 69,182, 97,192,202,202,146,193,131, 7, 87,243,219, 40, 46, 46, 46,169,197,179,
+ 66, 32, 15, 71, 44, 33,168,212,100,227,103, 54,204,222, 17,240, 22,120, 10,142,188,254,101, 43, 31,175, 32, 33, 14,173,122,128,
+ 35, 95,230,236,212, 21,224, 67,171, 79, 16,227,106,166, 59, 26, 54,206, 45,200,198, 27, 31,142,198,164, 53,209, 96, 69, 28,239,
+ 78,123,144,146,242, 82, 67, 89,105,146, 35, 17,199, 48, 12,204, 70, 51, 52, 58, 29, 84, 74,141,205, 58, 84,148, 87,232, 51,119,
+214,187,130,229, 51, 94, 5, 0,204, 90,177, 6,202,117,191, 85,100,187,103,141, 11, 26,253,217,214,120, 0, 35,235, 10,167, 74,
+165,130, 78,167, 67,211,166, 77,145,146,146, 2,165, 82,137, 33, 67,134,128,162, 40,219, 12, 81, 55, 96,200,205,205,237, 25, 27,
+ 27,251,203, 23, 95,124,209,180,117,235,214,148, 90,173,134, 70,163,129,253,254,218,181,107,100,243,230,205,247, 53, 26,205,179,
+ 86,211,185, 67, 28,206,253, 38, 35, 38,236,181, 29,199, 47,243, 98,131,162,110,123,229,150, 53, 53,151,228,138,213,149,218, 91,
+ 58, 11, 73, 3,177, 0, 22, 48, 32,102, 6, 22,235,176,151, 11, 53, 39, 76, 38, 51, 44, 22, 6, 15, 31, 62, 68,122, 90, 26,218,
+181,109, 9,157,222, 12, 33, 95,128,153, 55,110,160,213,120,192, 32, 20,128, 97, 24, 80, 20,141,169, 83,167, 26,173, 67, 6,181,
+ 66, 42,149,174, 62,115,230,140,191, 78,167, 67,106,106, 42, 38, 78,156,104, 40, 46, 46, 22, 1,192,203, 47,191,108,216,184,113,
+163, 40, 42, 42, 10, 27, 54,108, 8, 28, 51,102,204,118,181, 90,221,214,197, 52,221,148,159,159,191,169,230, 73,127,127,255, 85,
+ 15, 31, 62,236,103,239,243, 99, 54,155,109,193,113, 24,117, 6, 48,153, 76,208,106,245,168,168, 80,194, 96, 52, 89,235, 76, 6,
+ 22,139,217,186,103, 96,182,214,163, 34, 33,223,179, 83,219, 16, 21, 33, 4, 52, 69,149,167, 94, 47,104, 88,151,104,119, 52,196,
+229,162, 53,171, 38, 44,236, 44, 51,127,127,127, 8, 4, 2,108,218,180, 9, 87,207, 30,134,136, 71, 96, 49,155, 96, 54, 25, 97,
+ 49, 25, 32,224,241,112,252,114, 38, 6,181,242,116, 73, 16, 6, 4, 4, 96, 88,143, 30,136,237,209,163,106,122, 27,159, 15, 15,
+177, 24, 50,161,164,202,146, 5,128, 88,104, 87, 23, 17, 96,216,112, 6, 7, 7,227,210,165, 75,152, 57,115, 38,150, 46, 93, 10,
+169, 84,106,155,253,124,243,230, 77,108,219,182, 13,131, 6, 13,114, 59,238,172, 5, 47, 62, 62, 30,121,121,121, 88,177, 98, 5,
+ 58,119,238, 12,129, 64,128,242,242,114, 60,251,236,179, 40, 44, 44,116,137,211,126,120, 79, 36, 18, 85,179, 62,177, 2,208,221,
+ 60,178,231,124,117, 84, 3,236, 59,187, 25, 20, 40,156,255,225,221,106,162,240,191, 91, 79,187,205,185, 96,193,130,106,225,116,
+197,154,229,178, 31, 82,117,171,147,211,251, 40,138, 74,101,141,173,241,241,241,243, 41,138,218, 31, 31, 31, 63, 63, 33, 33,225,
+134, 43,124,142,174, 83, 20,117,192, 42,194,134,217,157, 75,117, 75,104,201,100,178,110, 30, 30, 30,184,123,247, 46,134, 12, 25,
+ 98, 40, 41, 41,185, 45, 16, 8,154, 23, 23, 23,139,139,138,138,160,209,104, 84, 31,127,252,113, 38, 0,105,247,238,221,163,142,
+ 31, 63,142,236,236,108,108,220,184, 17, 0,118,215,230,167,195, 48,140,173, 80,212,236,182,241,120, 60,156, 59,119, 14,231,206,
+ 85,119,253, 90,191,126,189,211, 6, 99,204,158, 31,113,249,242,101,216, 47, 15,192,254,182, 63, 39,145, 72,128,186,103,120, 84,
+131, 51,199,120,103, 14,240,174, 54,226,181, 85,128,174, 22,196,220,220,220, 90,159, 63,119,238, 92, 53,139,150, 51, 78, 30,143,
+ 7,139,197, 2,169, 84, 74, 9,133, 66, 74, 40, 20,134,179, 34,139,199,227,217, 94, 24,177, 88, 12,177, 88, 92,173,151, 90, 27,
+242,242,242,250,231,229,229,213,122, 93,161, 80,244, 84, 40, 20, 46,197, 85, 22,134,143,158, 29,219, 96, 30, 0,156,221,154,255,
+157,230, 33, 94, 7, 0,194,167,118,189,250,121,139,168,192, 72, 41,206,109, 47,192,145, 47,115,246,232, 10,176,208, 58,164,203,
+184,154,230, 7,142,238,197,155, 83,167, 65,204,147,217,249,100,209, 40,231,101, 99,250,198, 22, 96, 69, 92,234, 70, 3,246,111,
+253, 8, 41, 71,159, 55,213,101, 41, 51,154, 76,208,106, 12, 80,170,180,248, 40,225,187,170,147, 31,225, 2,128, 11, 61,223,156,
+137,184,152, 65, 3,220, 29,166,102,211, 59, 40, 40, 8,167, 78,157, 2, 69, 81,216,190,125, 59,188,189,189, 17, 19, 19, 3, 47,
+ 47, 47,196,199,199,227,197, 23, 95,116,183, 50,171, 40, 41, 41,233,249,206, 59,239,252,242,233,167,159, 54,106,216,176, 33, 12,
+ 6, 3,140, 70, 35, 12, 6, 3, 50, 50, 50,176,121,243,230,108,141, 70,211, 19, 64,133, 51,178,195,185,223,100,236, 74,158,149,
+ 55,112,236, 24,237,205,194,159, 80, 80, 80, 2,179, 57, 23,140,197, 12,163,217, 82,101,225, 51,155, 97, 54, 91, 32, 20,242,188,
+ 62,253,228,221,163, 12, 8,104,154, 50, 0,120,190, 54,177, 17,209, 48, 8, 94,158, 94,104,221,170, 9, 78, 28, 90, 15,131,209,
+ 12,163, 65, 13,227,244, 24,164,103, 29,135,229,254, 49, 88, 24, 11,206,164,164,233, 77, 22, 34,144, 74,229, 84,195, 6,158,188,
+ 59,247,117, 14,195,233,227,227, 19,173, 80, 40,112,231,206, 29, 76,158, 60,185,160,164,164, 36, 29,192,115, 0, 80, 82, 82,114,
+102,226,196,137,173,147,146,146, 66, 26, 55,110, 12, 15, 15, 15, 47,181, 90,237, 44,234, 30, 0,226, 0, 12, 70,117, 7,252, 82,
+ 0, 31,211, 52, 45, 78, 77, 77,125,100,166, 93,114,114, 50, 0, 92,112,220, 3,178, 90,180,116, 58, 40, 74,202,240,250,155, 31,
+254,214, 51, 2,169, 38, 46, 8, 8,166,189, 5, 9, 0, 20, 23,102,224,213,215,103,138,235, 84, 28, 12,227,176, 33,116,195, 71,
+167, 90, 71,141, 45,163, 30, 30, 30, 85,195,111,123, 55,227,192,103,111, 2, 22, 35,136, 73, 11, 24, 53,128, 81, 5,198,160, 1,
+ 37,148, 2, 38,173, 75, 66,203,195,195, 3, 30, 82, 41,130,124,124, 64, 8, 1,159,199,131, 64,192, 7, 99, 2, 40, 11,101, 43,
+ 35,140,197,165,178,110,235, 84, 74,165, 82,100,101,101, 33, 46, 46, 14, 70,163, 17,163, 70,141,130,193, 96,128, 78,167,131, 86,
+171, 69,147, 38, 77,160,209,104, 92,226, 99,103, 43,122,120,120, 64, 40, 20,226,221,119,223, 69,151, 46, 93,176,104,209, 34,204,
+153, 51, 7, 77,154, 52,193,180,105,211,176,121,243,102, 68, 71, 71, 59,227, 37,246,121,196,166, 39, 43,182,236,135,248, 0,184,
+157, 71, 53, 57, 41,138,174, 38,216,216,237,237, 73,207,185,205,153,152,152, 8,133, 66,241,136, 37,139,253, 29, 22, 22,134,175,
+190,250,170,190, 35, 67,172,245, 40,216,193,181, 97, 53, 45, 81,132,144,174, 86,223, 41,125, 66, 66,194,141,132,132,132, 88,138,
+162,246, 39, 36, 36,196,214,102,209,114,196,227,224,186,194,213, 48,243,107,140,141,246,179,191,200, 38,180,159,159, 31,175, 81,
+163, 70,180,151,151, 23,202,203,203, 17, 24, 24, 72, 20, 10,197, 88,153, 76,182,112,203,150, 45, 81, 42,149, 10, 55,111,222,196,
+170, 85,171, 46, 0, 88, 89,151,208, 58, 24,104, 53, 29, 91, 45, 89,246,199,195,135, 15, 71,227,198,141,171, 89,179,164, 82,105,
+157,133,135,189,102,107, 20,121, 60,180,104,209, 66,122,255,254,125,173, 80, 40, 68,120,120,184,180,160,160, 64, 43, 20, 10,221,
+158,233,226,204, 49,222,153, 3,188, 35,225,211,181,107,215,106, 22, 44,251,189,253,239,125,251,246, 57, 29, 58,100, 57, 91,183,
+110,109, 75, 47, 79, 79, 79,246, 89, 0,192,144, 33, 67,192, 48, 12, 2, 2, 2, 92,226,100, 69,173,213, 1, 30, 58,157,142, 81,
+ 42,149,116,106,106, 42, 68, 34, 17, 60, 61, 61,109,190, 58, 18,137,196,102,205,252,189, 32, 16,209, 83,198,124, 80,101, 96,244,
+111, 40,126,117,239,178, 76, 80,192,229,161,111, 71,246,111,218,213, 27,149, 69, 70,236,255, 60,235,129,174, 4, 9, 0,110,185,
+ 99,201,210,209,149, 94,235,206,188,131, 14, 47,139,208, 64,215, 11,159, 46,168, 42,202, 19,103,140,198,176,215,249, 96, 69, 28,
+125,167, 29,182,127, 55, 31,205,154, 53, 3, 33,132,170,189, 66, 96, 96, 48,153,160,213,106,161, 82, 85,173,155,153,113,189,250,
+ 8,163, 81, 95, 89,255,180,176, 86,176,165,165,165, 56,124,248, 48,126,250,233, 39,116,233,210,197,161,168,118, 67,112, 41, 74,
+ 75, 75,123,205,158, 61,251,252,226,197,139, 67,253,252,252, 96, 52, 26,241,240,225, 67,124,251,237,183,121, 26,141,166,151, 59,
+ 21, 12, 8, 96, 50,153,161,211,232, 81, 81,169,196,194, 79,190,175,181,232, 1, 64,105,209, 45, 12, 31,241,162,168, 46,177,209,
+ 48,204, 7,201,201,201, 24, 52,176, 23,134,141,156, 92,171,216,120,115, 70, 53,177, 33,172,163, 35,240, 94,175, 94,189, 62, 81,
+ 42,149,229, 26,141,230, 69, 0,203,237,251, 83, 37, 37, 37,189, 71,140, 24,241,133,159,159, 95,231,162,162,162,249, 46,196, 58,
+ 62, 43, 43,107,126, 68, 68, 68,181,147,122,189, 30, 17, 17, 17, 45,138,138,138, 38,244,233,211,231,223, 0,252,236, 46,123, 2,
+ 56, 2,224,171,218,202, 18, 59,116,168, 82,105,225,229,211, 0,185,153,167,156, 6, 68,200,211,129, 48, 76,157,117, 8,219, 1,
+174,109,115, 50, 51,238,145,160,178,247,178, 13,246,243,255,154,132,231,227, 18, 33, 19, 0, 75, 94,237,137, 38, 62, 0,164,126,
+ 16,246,153, 11,202,199,154, 70,113, 63,186, 68, 62,103,237, 90, 92,182,214,199,225,129,129,152, 61,118, 44,136, 9, 72, 73, 75,
+195,214,159,127,198,216,254,253, 33,147, 72, 92,238,176, 48, 12, 3,161, 80,136,140,140, 12,164,164,164,160, 85,171, 86,184,123,
+247,110,181,101, 40, 8, 33,174,198,223, 22,119,177, 88, 12,129, 64,128,130,130, 2,196,198,198, 66, 40,172, 26,198, 62,117,234,
+ 20,102,207,158,141, 41, 83,166,160, 95,191,126, 72, 79, 79,119,137,147, 16,242,200,108,197,154,195,185,238,230, 81, 77,206,154,
+237,126,125,242,157,229, 92,188,120,177,195, 9, 21,174,112, 58,210, 34, 14,242, 46,213, 94, 12,177,150, 39,123, 97, 84,243, 24,
+128, 47,123, 46, 62, 62,126,190,171,207,217, 31,179, 22, 49,119,134, 48,109, 66, 43, 54, 54,182, 90,204, 75, 75, 75,207,159, 63,
+127,190,141, 92, 46,199,173, 91,183, 68, 94, 94, 94,109,216, 10,157,166,105,108,223,190,221,115,232,208,161, 71,151, 47, 95, 30,
+206, 48, 12, 10, 11, 11,241,254,251,239,171,204,102,243, 56, 0,230,218, 26,112,103,150,169, 31,127,124,244,101,219,187,119,175,
+ 75, 67, 32,172,144,226,243,249,240,245,245,213,106,181, 90,200,100, 50,248,250,250,106, 53, 26, 13,228,114, 57, 59, 86, 76,227,
+183,153, 10,206,172, 79,206, 28,227,107, 58,192, 59, 69, 90, 90,154, 75,247, 89,135, 90, 93, 42,229, 89, 89, 89,181, 86, 36,167,
+ 78,157, 2, 99,173,104, 93,229,180,246,242, 8, 43,252,100, 50, 25,252,252,252, 32, 22,139, 33,149, 74,171,137, 44,177, 88,236,
+244,197,113,182, 32,169, 68, 34,185, 40,151,203,125,216,235, 2,129, 0, 74,165,178,188,180,180,180,219, 35, 22, 34, 13,115, 48,
+121, 99,222,148, 62, 19, 67,209,103, 98, 40, 0,188,122,105, 95,209, 43,189, 95,174,114,254,220,185,248, 30, 81,230, 89, 18, 97,
+ 66,154, 59, 34, 11, 0,136, 72, 47, 27,243, 65,135, 42,235,194,198,243,152,187,248, 29,180,107,213, 1, 62,207,230,162,105,215,
+ 80, 84, 22, 25,241,235, 22, 11, 86,254,231,125,180,110,221,218,169,192,100, 64, 96, 54,154,161,213,234,160, 82,106,241,164, 97,
+ 48, 24, 32, 22,139,177,121,243,102,244,236,217, 19,221,187,119,127, 68,100,213,211, 60,159, 83, 90, 90,218,111,229,202,149, 23,
+ 62,255,252,115, 95,149, 74,133,239,190,251,174, 66,165, 82,245, 3,144,227, 86,154, 50, 4, 38,163, 17, 26,157, 30,106, 85, 85,
+ 26,220,187,177,179,158, 61,217, 42,177,209,179, 91,115, 76,159,254, 38, 50,239,103, 64, 85,126,247,177,197, 6,128,205, 5, 5,
+ 5,155,235,184,126,207,108, 54,199,178,235,190,185,128,103, 34, 34, 34, 80, 80, 80, 80,237,228,131, 7, 15, 96,177, 88,244,168,
+ 90, 39,235, 53,123, 67, 50,106,153, 65,107,215,131,174,178,142,106,245, 80,169,170,172, 32, 58,117,241, 19, 41, 71,172,216,168,
+205, 39,171, 62,101,136,162, 40,155,211,247,140, 25, 51,112,237,234, 85, 60, 23, 90,137, 38, 33,158, 32,149,185, 16, 14,248, 15,
+126, 85, 72,177,252,139,131,110,115,111,179,115,129, 88,190,109,155,195,107,247, 70,142,116, 43,238,183,111,223,134, 84, 42,133,
+197, 98,121,164,189,113, 55,254,246, 2,230,139, 47,190,192,236,217,179,241,253,247,223,227,218,181,107,232,208,161, 3, 6, 14,
+ 28,136,162,162, 34, 92,189,122, 21,122,189,222,229,112,218,251,205,221,190,159,134, 99, 41,135,240, 32, 39, 19,121, 5,217,245,
+206,119,123,206,154, 66,107,215,177, 43,248,215,160, 78,245,226, 92,184,112, 33,138,138,138,170, 89,178,236,235,165,218, 44, 90,
+ 53,181, 72, 13, 20,215,240,133, 98,143, 13, 53, 68, 79,205,227,154,247, 3, 64, 17, 0,158,147,231,106, 30, 23, 39, 36, 36,156,
+100, 45, 97, 86, 94,158, 51,255,172, 90,135, 14, 1, 36,142, 28, 57,114,196,170, 85,171, 2, 37, 18,137,109, 6, 82,124,124, 60,
+102,207,158,141,166, 77,155, 34, 32, 32, 32,204,199,199, 7, 37, 37, 37, 88,186,116, 41,178,178,178,254, 15, 14, 22,218,171, 41,
+180,122,223, 87, 66, 36,250,173,195,202, 90,182, 0, 96,202,148, 41,143, 88,180,216, 12,170, 11, 38,147, 9,254,254,254,208,104,
+ 52,224,241,120, 24, 53,106, 20,239,250,245,235,150,152,152, 24,140, 30, 61,154,119,245,234, 85,203,176, 97,195,192,227,241, 48,
+ 96,192,128,202, 93,187,118,205, 2,240,153, 11, 98,235,137, 57,198,179,133,204,213,181,143, 92, 17,151,117,113, 82, 20, 5,141,
+ 70, 3,190,117, 86,150,171,156,236,208,161,253, 11, 72,211, 52,124,124,124,108,149, 7,107,209, 98,133,150, 51, 94,103, 11,146,
+202,100, 50,175, 91,183,110, 69,177, 19, 47,138,139,139, 49, 96,192,128, 59,165,165,165,143,112,105,243, 49,127,207,146,204, 16,
+ 0, 67, 88,177,213,117,100, 16, 69,243, 40, 92, 59, 82,130,171,135, 74, 47,155, 42,209, 27,192, 90, 0,255, 5,176, 20,192, 92,
+ 0,211,236,142, 31, 58,172, 32,117, 66,125,242,198, 60, 25,203,155,188,241, 28,190,220,181, 23,239,110,173,114,220,223,245,201,
+125, 76,125,105, 33,218, 69,183,115,109, 45, 32, 6, 48,154, 45, 80,105,117, 80,105, 53,120, 82, 96,223,135,117,235,214, 33, 61,
+ 61, 29, 58,157, 14,171, 87,175,182, 77, 42,176, 23, 89,143, 33,184, 50,164, 82, 41, 51,100,200, 16,156, 63,127, 30, 98,177,216,
+132,122,172,127,197, 16, 6, 70,179, 25, 58,173, 22, 42,231, 67,110, 78, 27, 48,163,201, 4,134,177,160,107,135,112, 92,191,118,
+ 13,114, 94, 49,254,132,176,169,234,244,244,116, 24, 12, 6, 44, 90,180,200,242,203, 47,191,156, 68,213, 2,168,172, 5,111, 66,
+223,190,125, 63,150,203,229, 62, 7, 14, 28,120, 27,192,247,117,197,221,100,182,138,246,199, 76,199,218, 70, 4, 28,249,100,213,
+103,201, 29,251,134,149, 97, 24,252,223, 27,111, 96, 96,104, 37, 70,119, 14,132, 58,255, 14,100,222,129,160,124, 34,177,252,139,
+131,184,113,223,229, 69,137, 9, 0, 12,233, 59, 18,237, 91, 61,186, 60, 88,175,231,170,250,100,103,142, 95, 68, 97,113,158,219,
+113, 87,171,213,181, 90,174,220,176,104,217,222, 57, 54,253, 58,118,236,136,230,205,155,227,228,201,147,232,212,169, 19,238,222,
+189,139,187,119,239, 34, 43, 43, 11,215,174, 93, 67, 89, 89,153,219,121,180,231,200, 86,148, 41, 75, 33, 18,138, 80, 90, 94,140,
+ 7,185,153, 8,246, 15,121,236,124,103,209,114,216, 66, 0, 64,104,160,183, 91, 66,203,158,115,217,178,101,143,136,247,122, 46,
+223,100,207,127,177,174, 99,119,159,255, 61, 81,155,208,202, 84, 40, 20,221,199,142, 29, 27, 15,160,171,245, 92, 5,128,109, 71,
+143, 30, 29, 25, 20, 20,212,191, 71,143, 30,124,145, 72,132,148,148, 20,236,218,181,235,123, 0, 91,235,250, 35,145, 72,164,141,
+140,140,148,178, 5,145,125, 17,189,188,188,120, 75,151, 46,165,214,175, 95, 95,171,149,203, 89, 6, 85, 84, 84, 64,173, 86,195,
+219,219, 27, 70,163, 17, 67,134, 12,177,164,167,167, 67, 40, 20, 98,196,136, 17,150,180,180, 52, 91, 70,255,239,127,255, 11,215,
+106,181,207,254,244,211, 79,131, 1,244,113, 35,173, 88,199,120, 15,184,232, 0, 95, 91, 47,207, 21,184, 58, 28, 87, 27,231,204,
+153, 51,235,197, 41, 20, 10,205,236,202,239, 52, 77,195,104, 52,162, 83,167, 78, 40, 42, 42,178,189, 52,114,185,220, 38,178, 92,
+ 17, 90,206, 22, 36,229,243,249, 48, 24, 12,232,211,167, 15, 40,138,194,154, 53,107,234, 10,107,145, 54, 15,111,236, 89,146,249,
+ 63, 86,108, 73, 60,248,208, 41,205, 56,241,101, 25, 12, 37,240, 26, 51,102,204,248,157, 59,119, 98,233,210,165,211,226,227,227,
+149, 47,188,240,194,180,237,219,183,219,142, 1,196, 59, 34,150, 18,239, 74,205,249,230,178,100,220,129,157,136, 3, 43,226, 42,
+110,120, 34, 89,119, 6, 87, 83,175, 3, 0,214,174, 93, 11,212, 53, 20,203, 48,148,135,135, 63, 66, 67, 91, 32, 48, 72, 7,198,
+ 69,231, 17, 87, 49,103,206,156,106, 98,202,209,202,203,246, 67,140,245, 17, 54,246,251,122,113, 0,182, 33, 47,181, 90,247,216,
+ 66,139, 21, 27, 62, 94, 66,132,133, 53, 64, 69,129,253,176, 62, 5,118,170, 82, 85,152, 73,189, 29,110, 89, 4, 5, 5,117, 47,
+ 42, 42,218, 91,227,116, 41,128,143,235,232, 88,218, 50, 58, 59, 59, 27, 49, 49, 49, 56,116,232, 16,111,247,238,221,207,237,219,
+183, 47,237,206,157, 59,217,157, 58,117,106, 56,117,234, 84,113,159, 62,125, 80, 92, 92,140,206,157, 59,127,148,155,155, 91,135,
+208,178,166,163, 78, 15,181,250,201, 91, 71, 29, 89,179, 30,167, 97,100,211,125,193,130,127, 99, 96,131,114,140,234,224,141,164,
+253,103, 49,161,163, 20, 48,136,221,230, 99,195,226, 23,218, 24,145,209,221, 31,185, 46,246,170, 90,203, 53, 50,186, 59,232,236,
+187,110,199,221, 62,204, 53,203, 76,125,202,144,125,122,190,254,250,235,152, 59,119, 46, 6, 15, 30,140,187,119,239, 34, 57, 57,
+ 25,119,239,222,197,204,153, 51, 17, 29, 29,141, 14, 29, 58,184,197,185,239,216, 14, 84,170, 42, 64, 83, 52, 74, 43, 74,160,211,
+107, 49,103,218,130,199,206,119, 91,227,127, 44,161,106,116,224,232,229,122,115,126,240,193, 7, 40, 40, 40,168,102,201,122, 28,
+191,172,191, 58,234, 90, 45, 45, 19,192,255, 57, 24,174,240, 92,180,104,209,160,128,128, 0, 80, 20,133, 47,190,248, 2,126,126,
+126, 61, 1,220, 48, 24, 12,197,106,181,122,182,157, 8, 25, 8,235, 90, 27,133,133,133, 14,231,237,171,213,106,227,160, 65,131,
+ 4, 13, 26, 52,168, 54,219, 80, 46,151,215,102,221,177,113,178,215,204,102, 51,230,204,153,131, 37, 75,150,160, 81,163, 70, 24,
+ 54,108, 24, 98, 99, 99, 65, 81, 20,134, 12, 25,130, 97,195,126, 27,202,245,241,241, 17, 30, 58,116,168, 47, 77,211,105,118, 13,
+ 72, 53, 78, 71, 96, 29,227, 77, 38,147,171, 14,240,213, 56,217,194, 54,115,230, 76, 44, 89,178, 4,243,231,215,237,234, 81, 75,
+ 35,254,212, 57, 75, 75, 75,171, 85,246, 50,153,108,205,232,209,163,249,217,217,217,213,196,149,253,230,160, 34,170,198,233,108,
+ 65, 82, 30,143,135,224,224, 96, 44, 94,188, 24,254,254,254, 8, 9, 9,113,180,144,159, 61,103,158,189,216,122,246,165, 16,236,
+ 93,150,137,231,187,141,197,237, 83, 43,245,110, 52, 16,213,194,105,177, 88,178,222,121,125,110,208,138,245, 75,121,172,216, 98,
+ 69,220,233,175, 85, 88,149,248, 45,250,244,238, 99, 51,179, 39, 39, 39,155, 29, 88,121,108,156, 22,194,164,126,154,248,239, 94,
+223,109,220, 39, 16,139,128,115,201, 59, 81, 89, 86,125, 56, 73,111,252,109, 42,181,168,211,115, 48, 92, 62,238, 82, 89, 98,197,
+244,194,133, 11,177,112,225,194, 58, 35,185,110,221, 58,167,156,174,138, 46,119,210,211,106,210,162,100,114, 95, 72,228,161,104,
+ 19,237, 11,134,152,221,173,163,108,156, 53,197, 70, 64,128, 63, 42, 10,170,203, 58,202,150, 70,117,106, 96,103,113,255,229,226,
+197,139, 35,252,253,253,145,147,147, 19, 40, 16, 8, 70, 84, 51, 87,105,181,136,140,140,108,161, 80, 40,158,117,198, 57,115,230,
+ 76,253,135, 31,126, 40, 30, 55,110, 28, 70,143, 30,141,113,227,198,137,133, 66, 97, 51, 66, 8,140, 70, 35,114,114,114,112,252,
+248,113, 40, 20,138,155,117,133,147, 33,132,146,202,124, 32,145, 55, 64,155,182, 62, 96, 24,115,125,235,124,135,117, 72, 77,107,
+150,155, 34,203, 97,249, 4,128, 95,142,239,197,130,119,219,226,251, 3, 23,176,234, 34,208,222,167, 8,109, 2, 21, 96, 20, 55,
+241,254,132, 46, 88,254,195,165,170,119,233,148,211, 60, 34,117,149, 65,157,214,248, 88,113,183,183, 92,217,255,143, 11, 62, 90,
+143,112,178,157, 68,165, 82,137,242,242,114, 36, 37, 37,225,213, 87, 95, 69, 81, 81, 17,178,178,178,112,231,206, 29,108,217,178,
+ 5, 50,153,172, 94,121, 52,235,141, 15,240,225,242,247, 64, 64,208, 50,170, 13,226,227, 22,162,107,251, 30,143,157,239, 53,225,
+130, 53,171, 86,206, 21, 43, 86,212,183, 44,253,227,132,150, 67, 4, 4, 4,140,235,219,183, 47,116, 58, 29, 2, 3, 3,145,149,
+149, 5,154,166,155, 2, 85, 67,120, 97, 97, 97,219, 20, 10, 69, 83, 87,249,120, 60, 30,204,102,179,205,247,135,221, 0, 96,248,
+240,225,248,241,199, 31,157,246, 40, 66, 66, 66,208,176, 97, 67,188,243,206, 59,143,204,114,176,159,233, 32,149, 74,113,224,192,
+129,130,210,210,210, 82, 66,136,194,157,120,179,142,241,103,206,156,113,217, 1,222, 30, 70,163, 49,251,206,157, 59, 13,214,173,
+ 91,199,171,163,241,179,161,150, 70,252,169,115, 58,234,153, 18, 66,106, 21, 89,174, 44, 35,224,108, 65, 82, 62,159,143,219,183,
+111, 99,193,130, 5,160, 40, 10, 59,119,186,228,195,147,167,205,195, 27,187, 23,103, 46,221,147,144, 57,218, 84, 1,201, 73,245,
+202, 59, 0, 86,239,216,177,163, 3, 69, 81,236, 80,225,127,119,236,216,225,105,127, 92,171,169,172,168, 40,230,197, 23, 95, 60,
+ 74, 81, 84, 83,221,201, 10, 79, 0, 34, 86,196,229, 94,211,169, 94,158,240,178,129,207,231, 91,126, 51, 88, 49, 89,133,133,133,
+207,215,198,119,253, 86,201,122,154,166,125,135, 63,223,171, 29, 40, 10, 70,195,163, 35,213, 30,101, 42,155,200, 26,253,217, 86,
+236,158, 53,214, 21,209,147,113,250,244,105,191,117,235,214,241, 93,201,247,211,167, 79,155, 9, 33,110, 15,251,177, 13,142,209,
+104,132, 86, 91, 63, 43, 10, 33, 36, 37,225,147, 15, 7,109,216,116, 80, 64, 81, 6,156, 59,181, 19, 21,229,142,221, 25, 68, 2,
+ 62,214, 39,237, 50, 11, 5, 60,135, 78, 39, 79, 80,108, 56,195,151,163, 70,141, 26,183,122,245,234, 54,142, 46,186, 48, 9, 38,
+ 75,167,211, 33, 55, 55, 23, 26,141,102,199,188,121,243,140, 7, 15, 30,124,109,204,152, 49,232,208,161, 3, 26, 52,104,128,252,
+252,124,100,100,100, 32, 41, 41,137,156, 61,123,118, 7,128,233, 78,210,113,111,226, 39, 31, 78, 78,250,225,160,136,166,140, 56,
+151,188, 19, 21, 53, 68,251,163,214,105, 1,190,249,126,151, 81, 40, 20,220,114,102, 45,178,183,102, 61,201,134,113,196,196, 56,
+140, 94,185, 10, 77,187,198, 32,113,233, 64,124,243,201,139,248,124,136, 16,198,237, 19,208,254,133, 13,216,188,104, 40, 0, 32,
+244, 27, 23,173, 37,124, 33, 30, 58,176, 88,149, 87, 72,172,226,198, 61,171, 41, 27,247,186, 44, 87,238, 90,180,104,154, 70,227,
+198,141,209,180,105, 83,244,236,217, 19,157, 58,117, 66,255,254,253,113,245,234, 85, 92,189,122, 21, 51,103,206,172, 75,100, 57,
+205,163,126,207, 14,194,133,222,183, 30, 59,111,106,230,251,147,128, 43,101, 41, 46, 46, 14, 0,254, 81,214, 45,183,133, 86,101,
+101,229, 85,134, 97,218,121,123,123,179, 22, 41,219,181, 7, 15, 30,128, 97, 24,141,187, 25, 99, 48, 24,216,197, 49,171,173,203,
+196, 58,199,215,245,226, 19, 66, 44,165,165,165,232,219,183, 47,122,247,238,109, 27, 62,177,223,236,132, 9,118,239,222, 13, 66,
+ 72, 55,119,227,109,231, 24,175,130,155, 14,240,108, 35,222,167, 79,159,163,124, 62,223,165,175,104, 58,107,196,159, 22,167,163,
+252, 97, 24,166, 86,145,229, 74, 69,228,108, 65, 82, 62,159, 15,185, 92,142, 61,123,246, 32, 32, 32,192,157,224,229,233, 10, 48,
+ 11,192,151,168,154,132,113, 23, 0, 59,141, 47,206,254,221,174,113, 92, 27,212, 10,133,130,237, 26,134,238, 94,156,185,116,239,
+210,204,129,140, 30, 59,117, 10,252, 0, 40, 47,194,137,211,114, 77, 92, 77, 87, 44,171,235,122, 95,127,209, 41, 0,129,163, 63,
+219,250,240, 84,137, 49, 98,244,103, 91, 31,236,158, 53,182, 81, 93,207, 20, 20, 20, 12, 30, 59,118,236, 33, 87,243,221,108, 54,
+103, 22, 20, 20, 60,239,110,153, 37,132,224,214,173, 91,204,235,175,191, 94,172, 80, 40, 94,172, 79, 5, 19,191, 96,213,231, 75,
+ 62,154,225, 63,100, 80,247,174,160, 1, 67,237,206,191,132, 2, 8, 95,192,203,158, 61,127,197, 27, 47,190,248,226,239, 42, 54,
+106, 86,115, 5, 5, 5, 61,255,245,175,127, 77,199,111,174, 19,213,132, 20,106,153, 93,109,197,202,134, 13, 27,182,229,241,120,
+ 98, 0, 11, 0, 60, 56,123,246,236,151,103,207,158, 29, 12,224, 25, 30,143,215,192, 98,177,228, 90, 59, 61, 91, 1,252,234,188,
+ 28, 21, 77, 5, 97,194,135, 12,124, 38, 6, 20, 69, 12, 6,189,147, 14, 18, 8, 8, 33, 66,161,224,214, 47, 87,243,219,215,213,
+145,178,251, 2,199, 19,159, 65, 60,125,250,116, 76,159, 62,221, 86,158,214,172,233,141, 29,215,207,224,133,246, 57,208,127,221,
+ 11,148, 87, 35,151, 59,124, 0,240,193,191, 95,127, 98, 97,179,143,187,189, 69,203,209,123,224,142,143, 22,143,199, 67,113,113,
+ 49,110,223,190,141,194,194, 66,104, 52, 26,164,167,167,195,104, 52,162,172,172, 12,109,219,182,173,119, 56,159, 84, 30,253,145,
+156,255,196,225, 67,183,133,150,209,104,252, 79,227,198,141, 5, 18,137,164,141,197, 98, 1, 33, 4, 22,139,133, 88, 69,141,219,
+179,240, 4, 2,129,174,121,243,230,148,163,217, 9,236,111,185, 92,174,173,195, 90,146, 16, 25, 25, 57,143,162, 40, 94,109,189,
+ 16,246, 55,195, 48, 22, 62,159,159, 80,207,180,122, 92,199,120,251, 70,252, 73,225,105,112,214,204, 31,117,171, 86,173,108, 95,
+180,175,185, 38,138,245, 99,171,106, 39,226,188,206, 5, 73,213,106,117,126, 76, 76,140,197,254,186,253,130,166,206, 52,172,117,
+123,210, 96, 69, 92, 99, 59, 17,103,121,226,255, 66,145, 7, 67,199,189, 22,113,170,196, 24, 1, 0,172,216, 2, 33, 15,234,120,
+ 74, 91, 80, 80,208,247,105, 87, 14,247,239,223, 55, 60,243,204, 51,155,148, 74,101, 28,128,122,123,243,207,255,207,154,249, 79,
+ 34, 60, 79, 75,108,212, 86,108, 1, 44,169,103, 80, 31,148,148,148, 12,168,113,238, 87, 86, 80,177,235,218,185, 29,255,155,197,
+207, 63,233, 60, 54,155,205, 57, 77,155, 54,117,203,114, 99, 50,153,114,156, 93,175,185, 70,152, 61,110,192, 27,243,207, 3, 85,
+147,191, 75, 92,226,212,233,116,165, 61,122,244, 16,184, 25,183, 34, 87,227,222,160, 65, 3,132,134,134,218,246, 44,106,158,119,
+ 22, 78,179,217,156, 19, 30, 30,142,128,128,128, 90, 87,124,175,233,147,229, 10,231,147,206,163,186, 56, 67, 67, 55, 60,113,206,
+250,134,147,131,107, 24,200,113,114,156, 28,231, 95,150,147,199,165, 39,199,201,113,114,156,191, 35,231,223, 18,156,151, 26, 7,
+ 14, 28,106,131,133, 75, 2, 14, 28, 56,112,120, 60, 80,117,168,210, 99,110,240,212, 71,217, 30,227, 56, 57, 78,142,147,227,228,
+ 56, 57, 78,142,243, 31,199,233,140,251, 24, 56, 60, 85, 1,198,113,114,156, 28, 39,199,201,113,114,156, 28,231, 63,143,243,111,
+ 9,110,232,144, 3, 7, 14, 28, 56,112,224,192,129, 19, 90, 28, 56,112,224,192,129, 3, 7, 14,156,208,226,192,129, 3, 7, 14,
+ 28, 56,112,224,192, 9, 45, 14, 28, 56,112,224,192,129, 3, 7, 78,104,113,224,192,129, 3, 7, 14, 28, 56,112,224,192,129, 3,
+ 7, 14, 28, 56,112,224, 80, 5, 10, 0,246,239,223,111,251, 32, 96,108,108, 44,197, 37, 11, 7, 14, 28, 56,112,224,192,225,247,
+196,223, 90,139,216, 71,142, 3, 7, 14, 28, 56,112,224,192,129,211, 34, 79, 6, 52, 39,182, 56,112,224,192,129, 3, 7, 14,156,
+216,226, 34,198,129, 3, 7, 14, 28, 56,112,224, 68,214, 95, 10,213, 44, 90,156,224,226,192,129, 3, 7, 14, 28, 56,252,145, 98,
+235, 47,170, 69,136,117,179, 63,230,192,129, 3, 7, 14, 28, 56,112,224,240,152, 2,171,174, 61, 7, 14, 28, 56,112,224,192,129,
+ 3,135, 39, 36,184,216,223,191,155,208,226,190,108,206,113,114,156, 28, 39,199,201,113,114,156, 28,231, 63, 22,124, 46, 9, 56,
+112,224,192,129, 3, 7, 14, 28, 30, 27,246, 86, 44,138, 19, 90, 28, 56,112,224,192,129, 3, 7, 14, 79, 78,100, 81,142,142,185,
+111, 29,114,224,192,129, 3, 7, 14, 28, 56, 60, 37,112, 22, 45, 14, 28, 56,112,224,192,129, 3,135,199, 3, 5,110,232,144, 3,
+ 7, 14, 28, 56,112,224,192,225,169,138, 45,135, 39,107,155, 57,112,204, 13,242,250,204, 62, 56,198,113,114,156, 28, 39,199,201,
+113,114,156, 28,231, 63,142,211, 25,247, 49,252,245,208, 23,192, 73, 0,253,172,251, 90,133,215,147, 6, 55,245,149,227,228, 56,
+ 57, 78,142,147,227,228, 56, 57,206,191, 59,106, 93,168,148,115,134,231,224, 12,124,212, 61,196,236,236, 58, 7, 14, 28, 56,112,
+224,240, 79, 19, 91,196,190,145,116,132,102, 0,230, 3,240,182, 59,119, 17, 64, 66,141,251,126, 0, 32,179, 59, 86, 3, 88, 4,
+224,174,211,208, 16, 34,180,242,139,173, 27, 3, 64, 7, 64, 15, 64, 73, 81,148,137,203,179, 63, 28, 61, 0,196, 90,127,239, 7,
+112,206,205,235,127, 43, 52,104,208, 64,234,235,235, 59,248,242,229,203,162,244,244,116,156, 62,125,154,172, 95,191,222, 88, 86,
+ 86,118, 36, 63, 63, 95,203, 21,151,191, 5, 98, 0,196, 91,127, 39, 2, 56,252,152,124,148, 76, 38,155, 41,151,203,135,138,197,
+226, 80,179,217, 76,105, 52,154, 60,181, 90,125,212,108, 54,127,102,173,247,220,197, 72, 63, 63,191,215, 90,182,108,217, 44, 43,
+ 43, 43, 55, 47, 47,239, 7, 0,219, 1,188, 24, 26, 26, 58, 33, 50, 50, 50,236,214,173, 91,119, 75, 75, 75,191, 1,176,247, 15,
+ 12, 39, 7, 14,255, 36, 80,117, 89, 35, 28, 97, 1, 33,100, 66, 53, 6,234, 81,142, 1, 3, 6,140, 56,114,228,136,140, 97, 24,
+176,155, 84, 42, 53, 3,120,197,137,200,242, 79, 73, 73,137,136,139,139, 27,157,151,151,215, 69,169, 84,118, 3, 0,153, 76,118,
+ 33, 40, 40,232,151,149, 43, 87,110, 33,132,228, 80, 20,165,116, 51,162,124,129, 64,240,170,175,175,239, 80,179,217,220,137, 16,
+ 2,129, 64,112,185,172,172,236,176,201,100,250, 6, 64,125,196,155,136,207,231, 79, 23,139,197, 49,102,179,185, 29, 0,240,249,
+252,107,122,189,254,176,217,108,254, 18,128,161, 30,156, 18,145, 72, 52,221,203,203,107,144,193, 96,104, 7, 0, 34,145,232, 90,
+101,101,229, 81,131,193,240,165, 85,112,254,209,224, 3,136, 37,132, 8, 0,128,199,227,141,236,214,173, 91, 4, 69, 81, 12, 69,
+ 81,132, 16, 66, 93,184,112,161,163,197, 98,161,173,229, 35, 22,192, 47, 0,204,127,197, 55, 36, 32, 32, 96, 9,195, 48,161,117,
+102,154, 68,210,229,242,229,203, 45,183,109,219,102,249,250,235,175,203,167, 76,153,226, 17, 23, 23,199, 95,179,102,205,151,249,
+249,249,111,215,188,223,223,223,255,115,154,166, 3, 92,249,127,134, 97,138, 75, 74, 74,222,251,163,226, 63,121,178,174,154,185,
+ 59, 41, 73, 18, 5, 32,167,158,229,251,233,113,234, 38, 19, 0, 72,146, 36, 69, 77,214, 77,206, 96,127, 63, 46,175, 29,226,191,
+ 58,166,236, 67, 8, 48,125,144, 39,253,184, 66, 43, 44, 44, 44,105,242,228,201,227,218,181,107,199, 39,132,192,100, 50, 65,175,
+215,183, 60,119,238, 92,191,157, 59,119,118, 81, 42,149, 47,186, 73,249,198,220,185,115, 23,127,252,241,199, 1, 2,129,128, 50,
+153, 76, 81,219,182,109,235, 52,117,234,212,119,214,173, 91,215,240,165,151, 94,242,100,207, 47, 88,176,160,107, 98, 98, 98, 19,
+ 0,159,253, 1,225,228,192,225,159,134,190,168,238,163,245, 17,128,133,117, 9, 45,185,181,241, 44,180, 90,178, 96,183,183,225,
+196,137, 19,251,248,124, 62,107,209,234,166, 86,171,131,107, 88,193, 28,137,172,200,137, 19, 39,246,216,177, 99,199,146,151, 94,
+122,169, 64, 38,147, 53, 31, 51,102,140,146,162, 40,222,182,109,219, 58, 54,109,218, 84, 58,124,248,240,137, 3, 6, 12,152, 69,
+ 8, 57, 77, 81,148,194,197, 72,182,241,243,243,219,181,108,217,178,136,152,152, 24, 97, 64, 64, 0, 8, 33,200,203,203, 11, 59,
+112,224,192,144,143, 62,250,104, 86,105,105,233, 40, 0,105,110, 36, 92, 87,169, 84,186,227,163,143, 62,106, 48,100,200, 16,126,
+ 72, 72, 8,116, 58, 29,210,211,211, 7, 30, 62,124,184,207,186,117,235,222,214,106,181, 47, 88, 5,134,171,232,230,237,237,189,
+243,187,185,115,131,187,191,250, 42,223,207,207, 15,132, 16, 40, 20,138,129,103, 54,108,232, 55,109,217,178,183, 43, 42, 42,254,
+229, 40,189,255, 72,136, 68, 34,122,227,198,141, 29, 68, 34, 17, 0,192, 96, 48, 32, 58, 58,154,250,187,188, 33, 20, 69,133,231,
+229,229,121, 11,133, 66,135,215, 45, 22, 11,250,244,233,211, 88, 40, 20,226,179,207, 62, 51, 21, 23, 23,119, 92,189,122,245,229,
+205,155, 55, 7,124,249,229,151, 47, 0,120, 68,104,209, 52, 29,144,147,147,227,144,211, 98,177,192,104, 52,194,108, 54,195, 96,
+ 48,160,117,235,214,127,104,252,147,146, 36,225, 0,222,155, 60, 89,247,174,245,212,103, 0,102, 1,184,143,122,126,179,235, 41,
+112,218,151,183,207,237,126, 63,118, 88,237, 16, 1, 0, 7,175,234, 0,192,239,113,211, 85, 46,151,183, 26, 63,126, 60, 95,161,
+ 80, 64, 32, 16,192,104, 52,162,160,160, 0,209,209,209,188, 77,155, 54,181,112,151, 47, 42, 42,106, 74, 98, 98, 98,224,193,131,
+ 7,141, 27, 55,110, 52, 12, 26, 52, 72, 48,101,202, 20,175, 62,125,250,180, 14, 15, 15,167,191,253,246, 91,253,209,163, 71, 77,
+ 19, 39, 78, 20, 37, 36, 36, 4, 30, 56,112, 96,120, 90, 90,218,103,191,119, 56, 57,112,248, 7,226, 36,126, 91,226,129,221,215,
+ 41,180, 96, 39,174, 70, 2,128, 64, 32,232, 24, 28, 28,156,100, 54,155, 67,172, 86,157,130,194,194,194,207, 76, 38,211, 21,235,
+189,123, 25,134, 25,225,204,146, 53,113,226,196, 30,135, 14, 29, 90,126,238,220,185,138,146,146,146,144,125,251,246,233,102,205,
+154,149, 5, 0,247,239,223,111, 50,124,248,240,176, 25, 51,102,228, 12, 30, 60,120,101,255,254,253,223, 34,132, 28,165, 40, 74,
+237, 76,100, 69, 71, 71,167, 36, 39, 39,123,250,248,248, 84,187, 16, 25, 25,137,183,222,122, 75, 56, 98,196,136,166,207, 61,247,
+220,217,140,140,140,222, 0,174,187, 34,136,154, 53,107,118,236,196,137, 19, 30,190,190,190, 40, 47, 47, 71, 65, 65, 1, 52, 26,
+ 13,188,188,188,240,210, 75, 47, 9,251,246,234,217,112,198,204,183,143,229,228,230, 14,116, 81,108,117,235,217,166,205,177,205,
+ 9, 9, 30,166,135, 15, 33,149, 74,161, 82,169, 0, 0,158,158,158,232,210,184, 49,255,210,134, 13, 97, 19,230,204, 57,246,203,
+237,219, 3,255, 32,177, 37,182,238,245, 0,246,243,120,188,145, 34,145,136, 30, 57,114, 36,142, 29, 59, 70,233,116, 58,190,213,
+186, 99, 30, 57,114, 36,164, 82, 41, 12, 6,135,200,170, 5, 0, 0, 32, 0, 73, 68, 65, 84, 3,131,170,161, 67,243, 95,249, 45,
+ 17,137, 68,200,200,200,168,118, 78,169, 84, 66,161, 80,160,164,164, 4,122,189, 30,229,229,229, 96, 24,134,146, 74,165, 10,134,
+ 97, 64,211,116, 77, 1, 80, 13, 66,161, 16,183,111,223,174,118,206,108, 54, 67,173, 86, 67,175,215,195,104, 52, 66,169, 84, 74,
+ 61, 61, 61,155, 5, 4, 4,228, 0,216, 91, 90, 90,250, 89, 97, 97,225,131,223, 57,250,197,172, 32, 74, 74,146,220, 3, 32,250,
+ 51,114,218, 89,178,194,172,199,191, 62,161,176,178,120,184,255,138,174,145,213, 58,150,249, 4,248, 24, 0, 56,125,250, 52, 10,
+ 11, 11, 81, 92, 92, 12,133, 66,129,240,240,112, 16, 66,220, 30,142,203,200,200,248,170,109,219,182,212,141, 27, 55, 14, 3, 88,
+179,109,219,182, 87, 74, 75, 75,227,103,207,158,237,247,233,167,159,150,206,153, 51, 39, 17,192,247,219,182,109,123,179, 85,171,
+ 86, 67,111,222,188,185,238,143, 8, 39, 7, 14, 79, 26,132,144,174, 0, 2,217,186,197, 90,239,250,219, 29, 95,165, 40,202, 96,
+119,159,193, 90, 55,212,220,179, 96,143, 21, 20, 69,253, 98,247,156,130,162,168, 95,234, 27,204, 26,251,170, 78, 55, 0,236,223,
+191,159,176,155,163, 39,131,130,130,102, 14, 24, 48, 96,121,106,106,106,235,252,252,124,223,252,252,124,223,212,212,212,214, 3,
+ 6, 12, 88, 30, 20, 20, 52,211, 46, 33,106, 62,122,204,238,154, 48, 37, 37, 37, 98,215,174, 93,137,199,142, 29,171,232,216,177,
+163,225,196,137, 19,230,193,131, 7, 23, 89, 27,104,243,224,193,131,139,126,254,249,103, 75,247,238,221,165,135, 14, 29,202, 62,
+123,246,236,231, 59,118,236, 8, 38,132,240, 28,113, 90, 33,240,241,241,217,115,234,212,169, 71, 68,150, 61, 26, 54,108,136,253,
+251,247,123,249,248,248,236, 5, 32,172, 45,156, 86, 72, 36, 18,201,206,159,127,254,217,195,211,211, 19, 69, 69, 69, 16, 8, 4,
+ 8, 10, 10, 66, 69, 69, 5, 10,242,243,241,224,206, 29,208, 6, 3,190,248,228, 99, 79,169, 84,186,195, 65,101,255, 8,167,183,
+183,247,206,205, 75,150,120,148, 28, 59,134, 95, 23, 47,134,209,104,180, 13,185, 26,141, 70,156,141,139,131,226,248,113,124,187,
+ 96,129,135,183,183,247, 78, 0, 18, 39,156, 79, 2,246,156,113, 0, 74,173, 91, 28,128,115,209,209,209,169,233,233,233,232,221,
+187, 55,182,111,223,222,126,246,236,217,113,179,103,207,142,219,190,125,123,251,222,189,123, 35, 61, 61, 29,209,209,209,169,168,
+238,159,245,180,195,249,212, 56, 45, 22, 75,181,141, 97,126,107, 99, 66, 67, 67,139,118,237,218,133,151, 94,122,137, 22,137, 68,
+249, 99,199,142, 21,159, 57,115,134, 88, 69,166,203,225,212,233,116,208,106,181, 80,171,213,184,127,255,190,116,217,178,101,189,
+ 22, 46, 92, 24,117,236,216,177,176,249,243,231, 79, 11, 12, 12,188, 28, 28, 28, 28,241, 59,199,221, 88,227,247, 23, 0,114,221,
+180, 16, 61,109, 78, 98,125, 30,147,117,147, 59,216, 85,176,238,242,214,149,158, 5,214,176,170, 1, 60,120,156,178, 52, 96,192,
+128,182, 81, 81, 81,193,219,110,248,162, 76,216, 18,140,208, 7,140,208, 7, 22,255,174,200, 16, 61,143, 70,141, 26, 5,123,120,
+120,244,112, 51,156, 27,111,220,184,241,140,181,167, 92, 2, 96,249,156, 57,115, 62,162, 40,234,244,156, 57,115, 62, 6,176,220,
+122,126,241,205,155, 55,187, 3,216,252, 7,133,243, 47,241,190,115,156,127, 46, 78, 39, 90, 36,144,162,168,253, 20, 69,237,159,
+ 55,111, 94,127, 0,254, 53,142,159,181,191, 15,128,200,209,158,221,236,206, 7, 18, 66,134,217, 61, 23, 88,207,224, 83, 14,182,
+223,132, 22, 0,196,198,198, 82,177,177,177,236,133,139, 20, 69,237, 3,112, 81, 32, 16,116,236,208,161,195,200,159,126,250,201,
+ 51, 48,240,183,255, 15, 12, 12,196,142, 29, 59, 60,219,180,105, 51, 82, 32, 16,116, 4,112,209,203,203,107, 95, 29, 86, 24,159,
+184,184,184,209,147, 38, 77,170,236,216,177, 35, 0,148,167,165,165,201,186,119,239,174, 54,155,205,148,217,108,166,186,119,239,
+174, 78, 75, 75,147,153, 76, 38,101,215,174, 93,229,207, 61,247, 92,214,123,239,189, 55,209,129,224,176,199,248,165, 75,151,134,
+251,250,250,214,165,132,161, 84, 42, 17, 28, 28,140,184,184,184, 16,129, 64,240, 90, 93,169,197,231,243,167, 47, 93,186, 52,200,
+199,199, 7,101,101,101, 8, 15, 15,135,193, 96,192,237,219,183,161, 83,171, 96, 82, 86,194, 84, 89, 14,197,189,187,240, 17,240,
+ 49,113, 68,108, 48,159,207,159,238,196, 90, 50,253,155, 57,115,130, 13, 89, 89,184,191,125, 59, 44,230, 71,141, 63,102,163, 17,
+215,254,247, 63,232,114,114,144,248,250,235,193, 34,145,104,250,239,108,201,250,148, 16, 34, 37,132, 72, 41,138, 90,217,163, 71,
+143, 77, 82,169, 52, 46, 33, 33, 33,230,200,145, 35, 67,146,147,147,251,153,205,102,129,217,108, 22,156, 62,125,186,183, 78,167,
+227,139,197, 98,240,249,124,130,191, 41, 4, 2, 1,132, 66, 33,164, 82, 41,122,245,234,117,111,253,250,245,166,240,240,112,193,
+206,157, 59,125, 67, 67, 67,229,107,214,172, 41, 87, 42,149, 75, 93,229, 51, 26,141,208,235,245,208,106,181,208,233,116, 56,113,
+226, 68,227, 25, 51,102,240,117, 58,157,101,248,240,225,165, 38,147, 73, 63,103,206, 28, 47, 63, 63,191, 89,191,103, 60, 39, 79,
+214, 49, 86,203,211, 77,171,104,201,196, 99,250, 60, 61, 13, 78, 0, 6,171, 79, 22,139, 0, 43,183,225, 9, 37,133, 25,128,202,
+ 42,180,244, 53,222,143,118,118, 22, 95,167, 40, 47, 47, 95,247,205, 55,223,132,211, 98, 31,156, 49, 12,197, 22,230, 35, 28,241,
+ 94,131,162,136,247, 17, 20, 30,133,113,227,198, 5, 17, 66,214, 60,129, 48,175, 6,208, 7,192,202,250, 60,252, 59,132, 51, 66,
+ 46,151,111,247,244,244, 60, 35,151,203,183,195, 58, 60,251, 56, 24, 20,133,129, 35, 90,209, 57,131,154,130,140,104, 69,231, 12,
+138,226,150, 26,248,187,160,134, 22,177,135,130, 16, 18, 75, 8,137, 77, 76, 76, 92, 98,215,190,179,199, 82, 23, 45, 99,177,132,
+144,216,106, 10,169, 74, 96, 61,182,209,205,193, 86,165, 41,236,149,164, 93,228,108,179, 11,131,131,131,147,146,146,146, 60,107,
+ 50,230,231,231,163,178,178, 18, 31,126,248,161,231,164, 73,147,222,206,201,201,153,236, 36, 16,162,130,130,130, 78, 19, 38, 76,
+144, 24,141,198, 50,134, 97,232,202,202, 74,190,183,183,183,133,189,193,219,219,219, 82, 81, 81, 33, 80,171,213, 60,139,197,162,
+159, 52,105,146,232,245,215, 95,239, 2,128, 87, 27,105, 96, 96,224,160,161, 67,135,214, 58,116, 96, 50,153,160, 86,171,161, 86,
+171, 97, 52, 26,209,171, 87, 47,241,250,245,235, 7, 23, 21, 21,253,183, 86,197, 33, 22, 15, 26, 52,104,144,160,180,180, 20,222,
+222,222,120,240,224, 1, 50, 51, 51,161, 87,169, 96, 84, 85,194,168, 82,194,172,172, 4,169,172, 64,201,221, 91,232,222,170,165,
+240, 7,177, 56, 70,173, 86,127, 94, 27,167,151,151,215,160,238,175,188,194,151,203,229,232, 55,161,106,158,193,161, 86,173, 64,
+ 44, 22, 48, 22, 11, 44,102, 51, 98,110,223,134,201,100, 2, 77,211,232, 90, 90,202,247,218,176, 97,144, 66,161, 88,254, 71, 20,
+118,177, 88,204,223,184,113,227,120,145, 72, 4, 66, 8,101, 48, 24,112,228,200,145,127,220, 75, 47, 18,137, 32,145, 72, 96, 52,
+ 26, 17, 25, 25,169,157, 48, 97, 66,202, 39,159,124,210,136,166,105,185, 80, 40,252,169,164,164,100, 73,126,126,254,125, 87,249,
+ 76, 38, 19, 12, 6, 3, 12, 6, 3,180, 90, 45,238,221,187, 23,210,184,113, 99, 42, 46, 46,206,162,209,104,154,172, 90,181, 42,
+227,200,145, 35,178,165, 75,151,142, 1,240,214,239, 29,223,201,147,117,173, 0,180, 74, 74,146, 8,173,150, 95,195,159,140,147,
+160,202,241, 29, 73,146,164,116, 0,138, 39, 40,178, 68, 0,188, 27,249,243,213, 2, 30, 84, 0, 60,173,162, 96, 12, 69, 81,221,
+ 91,183,110,237,155,158,158, 94, 70, 8, 57, 15, 96, 11,128,252,186,200, 24,134,161, 24,134,193,212,110,229,136,235,193,131,201,
+ 84,129,138,138, 10, 60,120,240, 0,105,105,105,184,112, 33,173,190,239,230,107, 30, 30, 30,131, 37, 18, 73,164,217,108,166, 85,
+ 42,213, 3,141, 70,115,140, 97,152,117,168,135,143,218,211, 10, 39, 11,185, 92,190,108,254,252,249, 61,189,189,189,113,229,202,
+149, 38, 91,183,110, 93,166, 86,171, 31,203,185, 94, 34,160,191,253,124,197,154,176,176, 32, 31, 92, 77,254, 49,108,201,218,109,
+223, 2, 76, 56, 39, 83,254,250,168,161, 69,236,197,208, 47,132,144, 97, 20, 69,237,175, 41,148,220, 50, 59, 61,230,243, 78, 44,
+ 90, 53, 63, 44, 93, 93,104,213,162, 32, 97, 54,155, 67,236, 45, 89,132, 16,228,231,231, 35, 55, 55, 23, 10,133, 2,190,190,190,
+ 48, 26,141, 33,174,212, 15, 74,165,178,155,191,191,191, 70, 32, 16,232,181, 90, 45,100, 50, 25, 35, 16, 8,136,245,127, 40,235,
+172, 69,139, 94,175,167,248,124,190,201,211,211,211, 67,175,215,183, 68, 29,190,100,132,144,110,254,254,254, 14,175,233,245,122,
+168, 84, 42,168,213,106,168, 84, 42,232,245,122, 4, 7, 7,195,108, 54,119,170,179, 75,107, 54,183, 11, 12, 12, 68, 94, 94, 30,
+164, 82, 41,114,114,114, 96, 80, 41, 97, 84, 42, 97, 86, 87,194, 82, 81, 1,166,178, 18,140,186, 18, 38,131, 6, 97,205, 91,129,
+157,145, 88,107, 55,220, 96,104,231,239,239, 15,181,250, 55,119, 51, 98, 21, 88,102,179, 25,102,171,115, 52, 59,156, 24, 16, 16,
+ 0,118, 70,226,239, 4, 61,128,217, 52, 77,175, 20,139,197,252,105,211,166, 33, 63, 63,191, 90,153,152, 54,109,154,205, 39,171,
+ 79,159, 62,167, 37, 18,137, 89,161, 80, 64,175,215, 11,254,174, 47, 61, 69, 81,160, 40,170, 42,143,204,102, 4, 4, 4,168,139,
+139,139, 47,148,151,151,143,175, 15,159,201,100, 98,103,116, 65,171,213,130, 16,130, 43, 87,174, 64, 34,145, 8, 44, 22,203, 13,
+179,217, 44, 19, 8, 4,160,173,206, 95,191, 23,172, 51, 2, 63, 3, 16,110,181, 16,189,134, 42,135,243, 92, 7, 21,137, 75, 73,
+231, 34,167,251,194, 77, 55,153,181, 52,229,162,126,195,145,142,208,175,165,143,232,243,132,238, 65, 62, 29,134,203,213, 50, 17,
+ 79,205, 60,232, 16,249,221,167,105, 91, 39, 77,124,205,115,209,162, 69, 17, 1, 1, 1,146,140,140, 12,221,199, 31,127,220,120,
+227,198,141, 20,170,134,233,106,197,195,135, 15,119,207,159, 63,223,111,232,208,161, 77,196, 98, 49, 85, 81, 81, 1,133, 66,129,
+194,194, 66,100,102,102,146,171, 87,175,222,211,235,245,219,221, 9,100,131, 6, 13,214,143, 31, 63,126, 82,231,206,157, 5,172,
+133, 84,173, 86,119, 60,117,234,212,136, 67,135, 14,245, 86,171,213,110,151,203,236,236,236,237, 31,124,240,129,252,249,231,159,
+111, 41, 22,139,233, 39, 17, 78,123,208, 52, 29,236,225,225,129, 99,199,142,193,199,199, 7, 52, 77, 7, 63,110,121,213, 25,153,
+176,208, 16,127,232,206,126,142,150,129, 17,208, 25,153, 48, 78,162,252,125, 44, 90,181,180,245, 93, 89,139,148, 19,177,164,141,
+143,143,159, 79, 81,212,254,248,248,248,249,142, 44, 90,214,159, 22,251,251,236,238,215, 63,105,177,229,214, 66,147, 12,195, 32,
+ 55, 55, 23,121,121,121,200,205,205, 69, 73, 73, 9,104,154, 6, 33,196,149,217,103,132,162, 40,230,232,209,163,190, 41, 41, 41,
+234,174, 93,187,150,179,254, 47,102,179,153, 50,153, 76,148,213, 47,134,122,240,224,129,240,204,153, 51, 62, 55,111,222, 12,182,
+246, 86, 25, 39,166,192, 71,206,177, 2,203,126,211,233,116,144, 72, 36,174,169, 14,107, 67,120, 37, 53,181, 74,100,169,148,214,
+ 33,195, 10, 88, 42, 43, 64,212, 74,136, 44, 38,136, 64, 64,233, 52, 46,167,159, 61, 88,145,101,180, 10, 45,131,193, 0,147,201,
+ 4,134, 97, 96, 54,255, 33,126,229, 95,181,111,223,190,211,238,221,187,167,228,230, 62,218, 22,142, 26, 53, 10,111,189,245, 22,
+102,204,152,113,115,216,176, 97, 87,127,252,241, 71, 76,159, 62, 29, 12,195,116, 0, 80, 1,224,208,223,237,165,215,235,245, 54,
+ 11,148, 78,167,131,209,104, 4,220,248,172, 66,205,178,201,230,173,217,108,102,185,169,221,187,119,225,244,233,211,116, 90,218,
+141,240,105,211,226, 88,135,251,223, 59,170, 57,168,154,185, 39,178, 86, 20, 6, 84,249, 63,213,182,164, 66, 83,212, 61,100, 71,
+234,226,124, 28,180, 95,219,254,165,119,223,125,119, 16,170,102, 56,223,127, 76,139,214,243, 34,154,250,122,102, 59, 63,201,172,
+246,254,106, 17,159, 82,221,254,122,190, 42,179,145,151, 58,184,161,204, 16,222,216, 39,116,201,146, 79, 26,220,188,121, 75,255,
+225,135, 31,166,143, 29, 59, 54,104,214,172, 89,173,119,238,220,217, 91,167,211,125, 3,160,188, 54,163,203,136, 17, 35,206, 7,
+ 5, 5, 53, 94,187,118,109, 81,118,118,182,175,201,100,146, 27,141, 70, 70,173, 86,103,106,181,218, 99, 70,163,241, 24,128, 84,
+119, 2,235,233,233,217,254,149, 87, 94, 17,148,151,151,131,207,231,195,104, 52,162,168,168, 8, 61,123,246,228,237,219,183,175,
+ 77,125, 18,160,172,172,236,243,111,190,249,230,228,230,205,155, 7,123,121,121,117, 22,139,197, 33, 0, 44, 74,165,178, 80,173,
+ 86,255, 90,159,112, 86,171,231, 44,150,194,212,212,212,166, 94, 94, 94,120,248,240, 33, 44, 22, 75,225,227,150, 1,137,144,206,
+190,150,188,175, 97,171,128,198, 56,147,114, 30, 18, 33,157,205, 45,245,245,183, 7,235, 67, 5,123, 1,229, 64, 32,165, 36, 36,
+ 36, 72, 19, 19, 19,145,144,144,112,195,145, 69,139, 21, 92, 9, 9, 9, 55,216,251,236,238, 79,126,140, 48,214,110,209,170, 77,
+ 65, 2, 85,179, 11, 21, 10,133,175,143,143,143, 77, 96,229,229,229, 33, 47, 47, 15, 34,145, 8, 15, 30, 60,128, 72, 36,202,119,
+165, 19, 34,149, 74, 47,117,236,216,177,197,253,251,247,133, 31,127,252,113,195,212,212, 84,175,158, 61,123,182,149, 74,165, 22,
+ 66, 8,116, 58, 29,157,158,158,238,177,124,249,242,176,110,221,186, 25,186,117,235,118,121,219,182,109, 90,212,177,254, 21, 69,
+ 81, 23,243,243,243,155, 68, 70, 70,178,162,173,154,184,178, 23, 92, 64,213,144, 39,159,207,191, 92, 87, 64,249,124,254,181,219,
+183,111, 15,148, 73,196, 48, 40, 43, 97, 84, 85,194,172, 84,194,162,172,128,165,162, 2, 80, 87, 66,100, 54, 67, 96, 49, 65, 42,
+145, 32, 55, 39, 7,124, 62,255, 90, 93,156, 34,145,232, 90, 97, 97,225, 64, 31, 31, 31, 91, 35,106, 50,155,171, 54,139, 5, 6,
+179,217,102,209, 18, 8, 4,200,206,206,134, 72, 36,186,246,123,151,100,154,166, 45,236, 18, 14,181,196, 3,193,193,193, 76,247,
+238,221, 49,125,250,116, 88, 44, 22,107, 54, 80,253, 0,156, 65,149,127,203, 95, 18,142,196, 45,235,180,174,213,106,161, 82,169,
+ 80, 86, 86,198,151, 74,165, 45,194,194,194,206, 27, 12,134,237,102,179,249,219,204,204,204,202,218, 56,173,194,204, 38,186, 24,
+134, 1, 33, 4, 22,139, 5, 38,147, 9, 66,161,144, 57,117, 42, 25,203,191, 88,134,164,111, 55,146, 17, 35, 70, 80,251,246,237,
+ 3,195, 48, 57,191,115,244, 13, 86,209, 82, 87,165, 81,115, 73,133,247, 81,247,146, 10,181,113,218,247,254,236,207, 81, 14,238,
+121, 4,239,190,251,238, 97, 84, 13, 25, 22, 91,197,220,227,112,126, 86,190,229, 19, 9,204, 22,181,254,212,102,213,166, 59,149,
+234, 69,155, 86, 92, 50,136,120,149, 93,250, 6,183,107,210,184, 5,207,199,199,151,254,239,186,149, 37, 63,108,220,145,241,240,
+225,195,202, 47,191,252,178, 71,139, 22, 45,188,127,253,245,215,176,218,132,150, 76, 38,107,246,218,107,175,189, 82, 86, 86, 38,
+ 76, 74, 74,218,150,159,159,127, 9, 85, 75,203,216,207,160, 30, 6,224,123,171, 16, 13,182,214,115,103, 0,124, 92, 87,127,141,
+162, 40,252,252,243,207,143,204, 14,100, 30, 79,157,251, 68, 69, 69,189,116,255,254,253,211,133,133,133,255,170,121, 81, 40, 20,
+ 46,106,222,188,121,204,141, 27, 55, 62, 2,112,208, 29, 98,141, 70, 51,103,199,142, 29,159,242,120,188, 80,139,197,146,247,255,
+236, 93,119, 88, 20,215, 23, 61, 51,219,151,222, 97, 5, 65, 65, 84, 20, 53, 63, 75, 52,177,160,177,196, 88, 18, 19,193, 30,141,
+ 49, 26,147, 88, 99,139, 93,212, 24, 53,177, 17,187,198, 32,177, 18, 75, 68, 77,212,216, 21, 27, 6, 27, 54,164, 73, 7, 5, 22,
+182,239,206,204,239, 15,118,201,178,236,194, 46, 26,141,102,206,247,237,183,187, 51,111,206,123,111,234,153,251,238,189, 79,161,
+ 80, 76,123,102,139,150,150, 30,181,100,253,238,205, 10, 53,229, 47, 22,112, 50,148, 90,250, 51, 86,135,188,190,214, 44, 61, 10,
+140,172, 81, 5, 0, 8,147,255,137,250,135,145,154, 97, 24, 67,217, 2, 35, 43,150,218,196, 10,102,110, 93,193, 51, 36, 75,103,
+ 44,221,227, 44, 89,180,190, 1,240, 38,128, 43,121,121,121,171, 63,254,248,227,239,119,236,216,225, 40,149, 74,145,151,151,135,
+252,252,124,112,185, 92, 56, 57, 57, 97,221,186,117,138,188,188,188,213,198,219,160,106, 6,121, 0, 80,122,120,120, 92,139,137,
+137,241,217,180,105, 19,119,248,240,225,233,189,123,247,110,188,110,221,186, 20, 62,159,207, 80, 20, 69,168, 84, 42, 98,204,152,
+ 49, 65, 43, 87,174, 76,227,112, 56,118, 3, 6, 12, 32,236,237,237,175,160,154,180, 1, 5, 5, 5,199, 15, 28, 56,240,225,228,
+201,147,133,106,181,218,172, 37,203,176,204,197,197, 5, 23, 46, 92, 80, 23, 21, 21, 29,171,193,138,113,252,247, 35,135, 59, 13,
+ 29, 56,144,175, 45,149, 66, 91, 42,133, 78, 42, 5, 85, 90, 12,162, 76, 10, 30,165,131,152, 79,195,199, 79, 4,157,194, 1,135,
+175, 38,106, 85, 42, 85,181,137, 13,165, 82,233,241,243,209,209,157,223, 12, 8,224, 94, 24, 63, 30, 26,173, 22,239,221,191, 95,
+ 33,174, 52, 26, 13, 14, 54,111, 14,138, 32,240,198,232,209,120,168,211,233,164, 82,233,241,127,227,197,112,227,198,141,252, 33,
+ 67,134, 36,208, 52,221, 18, 47,104,210,204, 23, 1,173, 86, 91,197, 26, 69, 81, 84,185,213,177,220,114, 32, 56,124,248,112,167,
+164,164, 36,254,173, 91,183,112,238,220,185, 55,118,236,216,241,141,191,191,127,243,140,140,140,220,154,196,155,185,164,191,208,
+251, 31,238,217,185, 23,159,127,254, 57,145,155,155,139, 93,187,118,161,166,228,169,255, 4,134, 15, 87,210,209,209,162,186, 48,
+241,123, 50,147, 82,225, 47, 88,153, 82,193, 18,167,114,120,185,149, 76, 20, 93,158,108, 84, 57,188,124, 56, 80, 20, 93,163,165,
+ 12,195,149,195,165,122,135,248,156,231,192, 41,131,142, 18,171,207,236, 44,235,125, 36,163, 52, 62, 71,177, 16,192, 31, 80, 82,
+204,195,235,204,141, 86,173, 92, 61, 0, 64,165,164,124,130,131,131,195,184, 92,174, 0, 0, 28, 28, 28, 90,185,187,187,175,123,
+242,228, 73, 7,115,199,180, 79,159, 62,237,188,188,188,254,119,244,232,209,196,156,156,156,219, 0, 46,155, 22, 10, 10, 10,154,
+125,247,238,221, 54, 60, 30,143,168,225, 28, 1, 0,132,133,133, 53, 18, 10,133,238, 71, 30, 56, 67,202,111, 0,134, 83, 2,112,
+ 69,160, 92, 90, 32,157,223, 4,126,126,151,220,139,138,138,222, 40, 41, 41, 73,180,241,208,119,249,240,195, 15,127,138,142,142,
+246, 11, 11, 11, 99,174, 95,191, 78,154,142, 34, 4, 5, 5,245,136,143,143,111,249,217,103,159,109,216,189,123,247, 23,168, 28,
+105, 91, 19,210,245,249, 6,159, 27,142, 39,227, 4, 64, 5,232,109,102,172, 66,249, 15,192,150,148, 11,207,144,158,225,153,154,
+104,209,128, 97, 97,249,155,250,156, 88,111,106,181,218,191,110,220,184,113,112,192,128, 1,101, 79,158, 60,129,187,187, 59,234,
+213,171, 7,130, 32,176,110,221, 58, 69,106,106,234,175,250, 92, 90,111,102,103,103,191,175, 23, 91,230, 80,186,102,205,154,221,
+219,183,111,119, 73, 72, 72,224,232,116, 58,167,198,141, 27,203, 47, 94,188,232,192,227,241, 24, 62,159, 79, 39, 36, 36,216, 5,
+ 5, 5, 41, 9,130, 16,254,249,231,159, 79, 46, 93,186,228, 63,117,234,212,173,168, 28, 38,110,138,157,139, 22, 45,202, 74, 73,
+ 73,129, 74,165,130, 84, 42, 69, 73, 73, 73,197,167,184,184, 24, 37, 37, 37,224,241,120,200,205,205,197,190,125,251,114,244, 89,
+226,171,179,108,172,253,113,221,250,130,156,140,116, 56,217,137,161,147, 22,131, 42,121, 2,148,150, 64,160,213,192,158, 71,161,
+110, 3, 49, 68,118, 78,200,147,150, 33,250,226,213, 92,125,150,120,203,230, 2,181,122,237,184,149, 43,243,116,124, 62, 2, 34,
+ 34,160,209, 15, 21, 26, 11, 45,138, 32,224,223,181, 43, 72,103,103,124,251,235,175,121,250, 44,241, 47, 20, 52, 77,115,212,106,
+117,117,253, 0, 77,211,153, 73, 73, 73,187, 1,156, 38, 8,130, 33, 8,130, 65,121,178,182,178, 87,249, 66,214,106,181,152, 59,
+119, 46,248,124, 62,230,206,157,139,121,243,230,225,251,239,191,199,250,245,235,241,203, 47,191,224,240,225,195,245,207,159, 63,
+207, 63,123,246, 44,179,100,201,146,194,160,160, 32,206,232,209,163, 93,196, 98,241,164,234, 56,167, 77,155, 6, 71, 71, 71, 76,
+155, 54, 13,203,150, 45,195,150, 45, 91,112,240,224, 65, 92,184,112, 1, 28, 14,135,206,204,124, 12,165, 82,201,172, 89,179, 38,
+235,224,193,131,138,213,171, 87,131,203,229, 18, 47,233, 38, 49, 73, 47,168,140, 45, 65,166, 41, 21,158, 0, 88,133,154,125,163,
+ 44,113, 66, 20, 29, 93, 87, 47,142,146,141, 4,209, 33, 0,147, 81,125,120,181,129,227, 11, 0, 62,207,129,115,150,120,200,156,
+ 36,151,205,247, 30,197,231, 40,102, 1,248,221,208, 39, 39, 39, 39,241,254,253, 7,184, 0,240,107,236, 62,222,253,251,247,157,
+ 15, 28, 56, 32,242,242,242,194, 47,191,252, 34, 18,139,197, 94, 22, 56,169,131, 7, 15,170, 4, 2,129,251,168, 81,163,122,182,
+105,211,102,162,254, 69,180, 43,128,166, 40,143, 94,236,254,232,209,163, 59, 30, 30, 30, 15,142, 29, 59, 38,179,230, 0,149,150,
+150,110,253,249,231,159,235, 61,165,220,112, 68,246, 33,162,233,229, 56,236,242, 19,210, 3,230,193,174, 78,107, 12, 30, 60,184,
+ 14, 69, 81,155,109, 60,238,131,251,245,235,247,115,116,116,180,223,168, 81,163,114,175, 95,191,158, 7, 32, 26, 64,140,241,231,
+238,221,187,133, 31,127,252,113,206,230,205,155, 37, 3, 6, 12, 88, 15,160, 63,251,232,103,193,162,242,187, 16,106,138, 58, 52,
+243,192,173,248,157,159,159,191,166,168,168,232,194,195,135, 15, 39,168,213,106, 9, 65, 16, 12,159,207,207,205,203,203, 91,109,
+148,176,212,156, 95, 73, 55,232,115,109, 16, 4,161,101, 24, 38,179, 75,151, 46,147,186,118,237, 26, 21, 23, 23,167,236,220,185,
+ 51, 98, 99, 99, 61,186,116,233, 34,167,105,154, 57,114,228,136,199,187,239,190, 43, 63,125,250,180,108,204,152, 49,141, 27, 54,
+108, 56,122,218,180,105, 5, 4, 65,208,230, 56, 13,207,178,226,226,226,126, 61,123,246,188,240,235,175,191, 58,185,184,184, 64,
+167,211, 65, 46,151, 67, 46,151,131, 97, 24, 56, 59, 59,163,160,160, 0, 11, 23, 46,148,150,148,148,124, 96, 70,184,153,114, 42,
+149, 74,101,255, 47, 38, 78, 62,190,122,193, 92, 71,255,250,245,241,228,158, 18, 58,165, 28, 60,134, 68,221, 70,206,224, 11,196,
+120,120,191, 20, 83,118,239, 47, 85, 40,149,225,102,222,150,171,112,150,148,148,244, 31, 62,111,222,137, 13, 83,167, 58,252,207,
+219, 27, 28, 14, 7, 42,149, 10, 20, 69,129,199,227, 33,116,248,112,240, 61, 61, 49,123,247,110,153, 84, 42,237,143,170, 83,241,
+152,114, 62, 15, 24,115,126,113,227,198,141,143, 67, 66, 66, 48,118,236, 88,244,235,215,175, 82,193, 3, 7, 14, 96,253,250,245,
+ 80,169, 84, 31, 3,184, 14, 96, 29,202,135, 58, 96, 34,178,254,233,118, 62,119, 78,138,162,138,238,223,191,239,180,124,249,114,
+ 66,163,209, 96,193,130, 5, 48, 8, 78,195,121,253,229,151, 95,214,113,116,116,196,252,249,243,213,133,133,133,239, 44, 91,182,
+236,100, 76, 76,140,199,214,173, 91, 7, 3,152,102,202, 73,211,116,254,205,155, 55, 29, 55,108,216, 64,234,116, 58,172, 88,177,
+162,202,240,228,200,145, 35,161,209,104,193,225,112,213, 74,165,170,169, 88, 44, 78,118,119,119, 23, 51,149,157,187, 94,228,254,
+244, 69,121, 10, 3, 99,199,119,181,177,127, 22, 44,167, 84,176,133,179, 64, 20, 29,221, 89, 57,124,248,105,189, 32, 74,210,151,
+137, 53,152,244,109,224, 52, 8,194,218,112, 30,215,127,106,132, 82,169, 68, 65, 65, 1, 10, 11, 11,225,226,226, 2, 14,135, 67,
+ 88,106,167, 74,165,186, 53,101,202,148, 27,155, 55,111,238, 22, 31, 31,223,247,236,217,179, 93, 78,156, 56,161, 76, 79, 79,215,
+105,181, 90, 70, 34,145,112, 59,116,232, 32,234,213,171,151,189, 80, 40, 36,103,205,154, 85,184,120,241, 98, 15, 84,246, 97, 51,
+237, 59,135, 32, 8,124,221,169, 20,211,186,112,160, 86,107, 80, 92, 92,140,172,172, 76,220,185,115, 7,241,241,247,192, 48, 12,
+105,195,113,119, 7, 48,107,215,174, 93,190, 2,129,128,216,189,123,119,157,221,187,119,215,104, 73,221,177, 99, 71,157, 61,123,
+246, 68,234, 71, 47, 50, 95,197,235,157,229,252,215,114,190,202, 48,205, 12,143, 26,133,150,254, 62,255, 38,244,147,146,106,181,
+218, 43,102, 82, 56,124, 3, 96,174,145, 21,172, 38,115,158,148, 97,152,115,221,186,117,251,178,107,215,174, 43,123,244,232,145,
+147,147,147, 19,184, 98,197, 10, 63,157, 78,167,185,115,231, 14,153,156,156,156,126,237,218,181, 6, 13, 27, 54, 28,125,247,238,
+221, 51, 4, 65,104,172,232,224,157,228,228,228,246, 93,186,116,217, 55,122,244,104,255,118,237,218, 9, 92, 92, 92,192,229,114,
+145,146,146,130,196,196, 68,245,158, 61,123, 50,139,139,139,109,153,130,231, 74, 90, 86, 86,247, 1, 95, 77,248,117,116,191,190,
+ 30,109, 27, 55, 18, 72, 36, 18, 64,161,192,189,140, 92, 92,186,151,168,217,114,238, 82,129, 74,165,234, 15,235,167,224,185,114,
+237,225,195,110,239, 76,157,250,107,228,208,161,222,200,201,225, 74, 36, 18, 8, 4, 2,164,166,166, 34,153,166,117, 75, 55,110,
+204,211,139,172, 23,157, 21, 94, 8, 96, 57, 77,211, 92, 0, 16,139,197, 24, 55,110, 28,140,167,220, 89,191,126, 61, 20, 10, 5,
+ 0,112, 9,130, 88, 14,224,167, 87,221,138,101,192,211,167, 79,103,191,247,222,123, 75,184, 92,174,197,172,183,174,174,174, 40,
+ 45, 45,133, 78,167,163,178,178,178,238,185,186,186,130,199,227,129, 97, 24,179,215,209,147, 39, 79,102,247,239,223,127, 17, 73,
+146,150, 44, 31,112,114,114, 74, 63,121,242,100,240,103,159,125, 70,110,219,182, 45,101,212,168, 81,194,147, 39, 79, 82, 12,195,
+236,123,209,251,160, 99,199,157,192,134,225,225, 0,194,129, 42, 14,239, 89,250,101, 54,165, 84,232,216,113, 39, 54,224,111, 78,
+227, 97, 60,131, 32,210, 91,161,154,136,162,163, 87,162,220,207,162, 90,238,142, 59, 59, 98,195,112, 60, 87, 78,107, 96,172,125,
+101, 50, 25, 40,138,170,206,154,247, 87,108,108,236,202,107,215,174,121,126,249,229,151,129, 67,135, 14,117,234,210,165,139,131,
+113, 1,133, 66, 65, 31, 58,116, 72,182,126,253,250,146,115,231,206,165,141, 28, 57,178, 93,117,237,204,200,200, 56,252,237,183,
+223, 58,247,234,213,171, 33,128, 10,255,172,130,130, 2,164,167,167,227,214,173, 91,233, 26,141,230, 55, 27,186,244, 4, 64,228,
+160, 65,131,150,111,223,190,189,206,168, 81,163,114,247,236,217,115, 11,229, 9,139, 77,225,210,175, 95,191,230,219,183,111,151,
+140, 26, 53, 42, 23,229,126,100,153, 96,193,130,133, 1,157, 81,213, 79,171,218,145,137,159,213,106, 53,163, 84, 42, 25,185, 92,
+206,148,149,149, 49, 48, 63, 11,252,193,236,236,108, 38, 51, 51,147,201,200,200, 96,210,210,210, 24, 0,191,152, 40, 94,115, 55,
+ 44,251, 29, 59,118, 52,240,245,245, 93, 96,103,103,247, 7,135,195,145,114, 56, 28,169, 80, 40,252,221,221,221,125,222,210,165,
+ 75,125, 25,134,225, 87,163,162, 45,129,203,227,241, 62,243,242,242, 58,232,230,230,150,233,234,234,154,233,229,229,117,144,199,
+227,125, 14,128, 87,131, 50,183, 4, 17,151,203,157, 98,111,111,127, 92, 40, 20,230, 11,133,194,124,123,123,251,227, 92, 46,119,
+ 10,170, 79,164, 90, 45,167, 64, 32,152,226,233,233,121,220,201,201, 41,223,201,201, 41,223,211,211,243,184, 64, 32,120, 22,206,
+103,121, 43, 49, 8, 45, 57,163, 7, 65, 16,218, 55,222,120, 99, 67,203,150, 45,215,181,108,217,114, 93,139, 22, 45, 54,233,173,
+146,140,222,218, 34,135,229,228,141,255,100, 59, 95, 26,103,104,104,104,204,246,237,219,233,217,179,103, 75, 27, 54,108,248,116,
+246,236,217,210,237,219,183,211,161,161,161, 49,181,229,244,246,246, 14, 8, 13, 13,125,186,121,243,102,221,253,251,247,153,205,
+155, 55,235, 66, 67, 67,159,154,100,134,127, 17,125, 39, 0, 4,233,173, 63,191, 1,216,139,114,231,119, 95, 0,196,112,229,112,
+ 70, 31,125,248, 7,128, 30, 22,142,189,181,156,126,202,225,195, 25,189, 79,213, 49, 0, 73, 70,255,195, 80,217,255,235, 69,112,
+154, 69,211,166, 77, 31, 50, 70, 80,171,213, 76, 65, 65, 1,115,255,254,125,230,220,185,115,140,159,159,223, 67, 43, 56,221, 1,
+140, 1,112,200,199,199,231,238, 91,111,189,149,209,190,125,251,140,128,128,128, 20, 30,143, 23,143,242, 12,239,161,250,207,114,
+ 0, 13,107,224,124,203,197,197,229, 91, 63, 63,191,223,130,131,131, 47,212,171, 87, 47,222,205,205, 45, 78, 36, 18,125,135,191,
+ 51, 99,219,122,206,119,249,240,195, 15,211,203,202,202,168, 86,173, 90,221, 53,183, 81, 72, 72,200,249,178,178, 50,106,224,192,
+129,153, 0,250,252, 23,174,119,150,243,165,112,254,167, 16,172, 23, 76, 7,141, 62,223,152, 41,247,141, 73,153,159,245,219,214,
+120, 32, 24,134,225, 48, 12, 99,207, 48,140, 51,195, 48,110, 12,195,184, 48, 12,227,192, 48,140,176, 6,243, 55,123, 98,255,115,
+156, 95,232, 5,148, 92,255,219, 20, 53,173,127,173,247,167,175,175,175,107,155, 54,109,190,218,191,127,255,148, 71,143, 30, 77,
+217,191,127,255,148, 54,109,218,124,229,235,235,235,250, 44,237,244,246,246, 14,104,210,164, 73, 84, 72, 72, 72,102,147, 38, 77,
+162, 76, 68,214,139,236,187, 64, 47, 98, 66,244,159, 64,253, 50, 2,229,185,176,214,234,133, 77,144,133, 55, 53, 91, 56, 13,124,
+191, 1,120, 87,255,249, 77,191,204,239, 37,112, 86, 65,253,250,245,143, 54,111,222,252, 97,139, 22, 45,146, 91,180,104,241,176,
+105,211,166, 15, 27, 55,110,252, 48, 40, 40,232, 97,221,186,117, 31,122,120,120, 28,173,197, 49,114, 3, 32, 65,213,105,192, 94,
+246, 57,223, 57, 52, 52,244,146, 72, 36, 50,155, 27,140,203,229, 70,182,104,209,226, 38,202, 35, 37,217,251, 39,203,201, 10,173,
+127, 17,216,147,240,213,227, 20,162,250,105, 70,106, 90,207,238,207, 87,155,211,236, 92, 93,122, 33, 19,168, 23, 56,130,231,192,
+105,204,103, 56,167,130,140, 68,211,203,224,100,207, 37,150,147,229,100,133,214,115, 7,151,221, 5, 44, 76,160,122,198,245, 44,
+ 94,109,216,146, 19,235, 89, 56,205,241, 61,122,201,156, 44, 88,176, 96,241,188,238,157,157, 1,156, 49,188, 21, 90, 82,165,182,
+ 68, 19,212, 70,217,158, 96, 57, 89, 78,150,147,229,100, 57, 89, 78,150,243, 63,199,105,192, 74, 11,203,239,153,252,223,244,138,
+ 10,175, 23,146,166,135, 53,171,178,156, 44, 39,203,201,114,178,156, 44, 39,203, 89, 91,140,126, 69, 69, 86,152,225, 15, 59,116,
+200,130, 5, 11, 22, 44, 88,176, 96,241,252, 80,115, 30,173,189,123,247,114, 12,191, 7, 13, 26, 52,146,162,168,175, 12,255, 57,
+ 28,206,143,187,118,237,250,169,186, 26, 34, 34, 34,168,234, 56,205,161,166,122,204,113, 54,109,232, 52,214,221,217,110, 66,113,
+137,124, 85, 74, 54,117, 78,169, 84, 54, 49,172, 19,137, 68, 73, 63,253,244,211,131,231,221,206,145, 35, 71, 54, 52,173,167,158,
+ 31,175,179,155,163,104,220,211,226,178, 21,183, 31,150,109, 98,207,177,151, 2, 15, 0,125, 28, 69,252,247,155,186,240,223,186,
+245, 68,121, 81,166,161, 14,161, 60, 26,182,232,117,236,176,143,143, 79, 99, 39, 39,167, 97, 0,154,202,229,114, 47, 59, 59,187,
+124, 0,119,164, 82,105, 76,110,110,238, 61,107,121,194,234, 33, 29,128,191,254,111,198,153, 52, 4, 88,179,174, 38,244, 8,130,
+146, 1,132, 4, 1,205,177,228,191,157,209,223,109, 0, 37,205, 84, 93,222,163, 1,212, 12, 3, 62, 1,168,142, 61,130,232, 53,
+ 58, 84, 78, 0,186,163, 60,133,195, 13,148,167,159,144,179,151, 44, 11, 22,175, 21, 76,135, 10, 43,254,115, 45,136,137, 78,124,
+ 46, 17,197,128,113, 1, 24,119,149, 74,197, 19, 8, 4, 80,171,213,176,179, 19,175, 29, 51,106,228, 2,144, 40,214,234, 48,238,
+167,159,126,170,245, 76,215,182,212, 3,224,148,233,246,174, 78,226, 69,167, 15, 77,119,237,212,123,233,119,234,212,194,105,165,
+165,165,164, 80, 40,132, 74,165,130,179,179,115,251,177,163, 71,183, 34,121,140,154,207,183,191,184,114,229,202,220,218,182,115,
+210,164, 73, 62, 26,141,242,109,154,166, 5,106,181, 90,104, 90,143,179,157,253,210,211,135,166,219,133,245,249,110, 1,192, 10,
+173,151, 0, 65,128,171,253,153, 85,131, 58,135,188,213, 52, 24,244,157,179, 80,170, 53,239,159,206, 44,123,127, 94,124,246,228,
+204, 50, 77, 75, 60,135,132,149,255, 34,112, 2, 3, 3,191,244,244,244, 28,184,113,227, 70,126, 96, 96, 32, 68, 34, 17, 20, 10,
+133,228,209,163, 71,146,177, 99,199,134,137,197,226,221, 41, 41, 41,107, 97,221, 68,112,254,167,127,158, 3, 0,104, 63,108,161,
+ 63,202, 39,139,150,155,174,235, 60, 98,161, 63,128,169,168, 60, 49,114, 14,202, 83, 40,152,187,235, 8,226,182,127,143,247, 63,
+158,194, 5, 48,182,162,241, 36,240,251, 47,171,209,115,208,132, 74,203, 9, 6,220, 67,219,191, 71,159,143,167, 88,156, 71,241,
+221, 96, 66, 75,211,140, 69, 75, 60, 73, 18,186, 63, 30, 50,230, 38, 24,206, 67,121, 14,176, 42,148, 40,159,208,217,108,249,222,
+141, 57,121, 26, 45,101, 54,225, 44,159,199,201, 63,124,143,170,178,237,240,255, 65,171,165,202,239,173,124, 46,168,131, 41,206,
+167,103,205,154,197,237,211,167, 15,182,108,217,210, 97,211,166, 77,163, 75, 75, 75,255,212,239,183,100,246,242,101,193,226,181,
+ 22, 92,230,133, 22,151,131, 13,191,253,250, 83,131,188,252, 66, 12,255,236,107,236,220,185, 19, 69, 69, 69,112,117,117,133,128,
+207,231,173, 90, 62,199,199,201,201,222,103,248,232,105, 27, 0, 52,174,109,107,108,172, 39,216,116,123, 66, 63,149, 14,151, 67,
+242, 4, 2, 1,185,123,247,110, 20, 23, 23,195,197,197, 5, 2, 1,143, 92,249,221, 55, 98, 39, 39, 7,241,167, 95,204,232,128,
+242,252, 63,181,130, 90, 93,214, 97,255,206,159,156, 10, 10, 10, 48,226,243,105, 48,173,135,207,231, 83,134, 7, 11,123,142,189,
+ 20,204,218, 56,238,227,144,102,142,128,230,246, 5,240, 56, 28,216, 57,187,162, 59,151, 3, 14,129, 38,195,255, 72,155, 9, 96,
+222,235,210,217,192,192,192, 47, 35, 34, 34, 6, 46, 90,180,136, 79,146,229, 41,231,100, 50, 25, 20, 10, 5,124,125,125,113,250,
+244,105,254,236,217,179, 7, 30, 56,112, 0, 41, 41, 41,107,108,229,191,125,251,118, 61,127,127,127, 37, 0,244,109,238,104,186,
+ 46,192,176, 14, 0, 28, 29, 29,107,228,115,119,177, 87,221,190,125,169,169, 97,187, 47,187,250, 82, 22,150, 43, 1,216, 85,199,
+ 69,211, 12,247, 88,212, 88,139,235, 63, 91,180, 67,119, 99,239,185,198,129,129,129, 10,227,229, 14, 14, 14,150, 54,241, 46, 43,
+ 43,243, 55, 93,104, 40,175,209, 82, 94,150,234,235, 49,110,189, 89, 1,166,165,192,221,177, 99, 7, 0,224,135, 41, 67, 56,155,
+ 47, 23,114,185,220,242, 91,237,242,229,203, 17, 25, 25, 41,248,227,143, 63,122,109,223,190,189,215,193,131, 7, 87, 89, 18,170,
+ 44, 88,176,120, 37, 69,150,241,183,101,161, 69, 18,132,163,147,163, 3,194, 7,143,193,209,163,191,163, 83,167, 78, 21,235,234,
+215,175,143,136,254, 31, 96,215,207, 43, 1,192,241, 89, 90,244,172,245, 20,149,200,230,245, 28, 24,181, 48, 35,183, 44, 62, 46,
+ 46, 14, 29, 59,118,172,180,253,224, 1,225,248,101,235,114, 84,147,101,222, 42, 16, 12,201,119,116,178,199,160,225,159,195, 92,
+ 61,163, 71,244,139,123, 55, 98,117,183,188, 39,178,149,236,121,246,226,209,192,199,189, 71,243,144,198, 40,218,183, 22,137,197,
+ 74, 28,205, 86,226,211,238,109, 17,234, 38, 70, 71, 29, 5, 31,123,222, 59,185, 50,237,107,109,100,132,121, 0, 0, 32, 0, 73,
+ 68, 65, 84, 33,180,124,124,124, 26,123,122,122, 86, 18, 89,165,165,165, 40, 43, 43,131, 84, 42, 69,105,105, 41, 72,146,196,180,
+105,211,248,103,206,156, 25,232,227,227,115,194,138, 97,196, 12,189, 37, 11,224,240,202,230,206,157,171,242,242,242, 82,217,217,
+217, 49, 92,190,176,180,243,136,133,142, 0, 64,114,249,165,171, 86,173, 82,251,250,250, 42,185, 92,174, 96,194,132, 9,164, 53,
+109, 86,169, 84,140, 49,167, 90,173,170, 88,190,116,233, 82,181,183,183,183,202,206,206,142,209,104,172, 55, 58,222, 76,125, 10,
+ 33,159, 3, 33,159, 3,145,128, 7,199,122,109, 32, 44,186, 5,157, 78,135,101,203,150,105,124,124,124,212,118,118,118,140, 64,
+ 32,224,143, 31, 63,190,198,118,142, 28, 57,146,113,113,113,209,216,217,217,241, 35, 35, 35,171, 68, 10,157,188,145, 5,177,128,
+ 7, 59, 33, 23,193,245,253, 32,100, 20, 86,183,149,195,169,236,141, 32, 20, 10,209,161, 67, 7, 52,109,218, 20, 7, 15, 30,236,
+204, 10, 45, 22, 44, 94, 11, 88,140, 48,228, 2, 64, 92, 92, 92, 24,202, 39, 68, 68,159, 62,125,136,242, 45, 24, 76,253,178, 63,
+ 62, 29, 49, 8, 20, 69, 87,204,243, 69,144, 4,190,248,164, 23,104,218,154, 17,137,154, 67, 60,107, 81, 79, 5, 39, 67,144, 28,
+ 0,104, 16, 32, 97, 70,127, 58, 20, 20, 77,255, 61, 80,194, 1,198,140,232, 89,190,236, 57,180,147, 3, 10, 95,143,253, 8,230,
+234,105,220,160, 14,169,211, 40, 65, 84,158,236,241,159,152,108,147,229, 52,131,166,117, 37, 65, 90,133, 2, 74,165, 22,209,247,
+158, 42,142,103,201,188, 72,151,180,130,213,225,237, 68,156,130,108, 4, 56, 10,130,115,101,218,215,162,239, 78, 78, 78,195, 54,
+110,220, 88, 69,100,229,229,229,145,101,101,101,208,104, 52,116,105,105, 41, 40,138,194,140, 25, 51,120,179,103,207, 30,150,155,
+155, 27,105,208, 60,230, 56,245,126, 87, 83,111,223,190, 29, 48,107,214, 44,205, 59,239,188,147, 81,191,126,125, 25,135,195,129,
+ 68, 34, 89,221,189,123,119,183, 69,139, 22,105,122,245,234,149,198,225,112, 16, 28, 28, 44,187,117,235, 86, 0, 0,177,181,125,
+ 55,230,252,233,228,143, 12, 0, 16, 4,129,238,221,187,167, 7, 7, 7,203, 56, 28, 14, 30, 28, 90,202, 88,187, 63,121, 92, 18,
+ 13,125,157,245, 55, 17, 2, 16, 59, 84,120,226,117,239,222, 61,179,113,227,198,101, 36, 73,226,230,205,155,126,168, 58,173, 85,
+ 21, 78,177, 88,172, 29, 60,120,112,198,189,123,247,204,149, 7,151, 67,162, 93, 99,189, 1,203,183, 37,144,121,222, 98, 59,121,
+ 28,232,102,127, 57,132,235, 34, 2,132,142, 30, 42,169, 84, 10, 39, 39,167,114, 11,153, 70,131,191,254,250, 11,111,189,245, 86,
+216,222,189,123,207,176,215, 59,203,201,114,254, 13,115, 90,228, 21,180,102, 25, 79,116, 95,201, 71,235,180,105,167, 40, 74,135,
+250,254,222, 88, 58,103, 36, 40,138, 6, 69, 81,208,233,191, 41,138,130, 86,163,121, 46, 45,123,150,122, 92,157,196,139,126,223,
+ 61,206,245,157,126,203,187, 46,153, 53,226, 56, 69, 1, 52,173,133, 86, 11, 80,180, 22, 52, 69, 65,171,125, 62,174, 57, 90,154,
+ 70,128,159, 15,150,204, 26, 1,211,122, 98,118,237,237,123,242,183,105,118,157,250,124,247,245,131,116,249, 50, 86,216,191, 88,
+136,248, 66, 46,195, 21, 65,173,214,161, 84, 77,171, 1,200,148, 90, 90,195,216,123,136, 0,128, 75, 18,175, 83,116,109,211,192,
+192,192, 74, 34,235,251,239,191,247, 88,183,110,157, 47, 0,244,239,223, 63,171,107,215,174,133,247,239,223,135, 68, 34, 33, 10,
+ 11, 11,123, 3,152,160,223,118, 42,128,117, 22,120,101,254,254,254, 74, 79, 79, 79,149, 65, 16,145, 36, 9, 46,151, 11,127,127,
+127,165,151,151,151, 42, 56, 56, 88,198,231,243, 65,146, 36, 12, 66,207,170,215, 60,130, 0,135,195,129,129,211,212,218, 99,224,
+180, 5, 60, 46, 89,245,246,102,196, 73,146,164,217,250, 44,158, 67, 34, 17, 3,192, 98,121, 14,105,116,123,228, 86,239, 33, 16,
+253, 23,120, 0, 78, 51, 12,131,235,215,175, 35, 37, 37, 5,124, 62, 31, 62, 62, 62,136,140,140,132, 74, 85,174,119, 35, 34, 34,
+194, 0,220,100,175, 96, 22, 44, 42,112,250, 21, 20, 88,166, 86,173,234,125,180,226,226,226,194,250,244,233,115,198, 32,128,202,
+197,142, 25,241,163,213, 65,171,213, 0, 12,243, 92,132,150,165,122, 40,138,174,182, 30,131,143, 22, 77, 51, 92,179, 34,139,166,
+161,211,106,159,203,222,163, 41, 45,104, 90, 11,115,245, 16, 4, 73,233,111,248,124,246, 58,121,241,240,241, 15, 32,181,254,245,
+113, 78,167,132,175,187, 80,128, 66, 5, 2, 27,133,112,254,146,107,113,225, 70, 18, 60, 28,156, 94,155,227, 34,151,203,189, 68,
+ 34, 17,100, 50, 89,133, 37,107,221,186,117,190,106,181,154, 4, 0, 46,151,231, 87, 64,251,138, 40, 26,112,118,202, 65, 81, 81,
+137, 59,195, 48,132, 94,240, 44, 7,240, 19,170,201,238,207,231,243, 43, 4,138,177, 0, 18, 10,133,181, 18, 48, 6, 24,196, 25,
+159,207, 55,187,220,116,120,173, 38,240,141,133, 22,152,114,171,150,137,216,226,112, 56, 48,248, 70,213, 4,129, 64, 80,209,119,
+115,224,114,140,234,227,216,238,138,169,209,104, 80, 86, 86,134,226,226, 98,136, 68,229, 6, 51,134, 97, 64, 16,196, 4, 0, 19,
+217,171,152, 5, 11,243, 90,228, 21, 22, 91,230,133, 22,202, 77,118, 4, 0,232,180, 26,179,226,103,239,161, 11,200,200,149,193,
+199,227, 10, 24, 27,179,158, 14, 28, 56,240,103,137, 68,210,206,240, 95, 40,118,112, 31, 61,110, 62,116, 58, 13, 28,197, 36, 62,
+ 27,214,179,146,200, 42,183,104,169, 45,206, 9, 82, 84, 34,155,215, 51, 98,205, 66,103, 39,247,120, 83,241,179, 36, 58, 33,188,
+ 72,170,242, 35,201,171, 40, 34, 36, 84,196,152,249, 35,141,110,238, 55,118,175,159, 59,217,106,123, 32, 65,242,194,199,174, 30,
+205,112, 29,154,216,145,165,103,167,143,104,187,223, 88,204,185,185,185,197,245, 8, 95,213, 45,239, 41,235,163,245, 50,224,232,
+236, 66,250,181,238,140,214, 19,162,112,242,155,233, 12, 80, 4,119,137, 47,217,229,203,197,112,104,221, 23,151, 62, 27, 70, 3,
+ 79, 95,139,190,218,217,217,229,203,229,114,137, 66,161,128, 84, 42,133, 84, 42,173, 44, 8,120, 60, 98,244,231, 95,121,240,248,
+ 2,104, 53,106, 28,141, 89, 92, 35,167, 33,133, 67,223,230,142,224,240, 4,165,119, 2, 3, 87,115,185, 92,144, 36,137, 67,107,
+167, 79,216,183, 98,156, 35, 0,220,136, 91, 43, 29, 52,237,199, 53, 36, 73, 66,165, 82, 9,109,105,247,227,199,143,253, 84, 42,
+149, 82, 47,208, 12,194, 15,169,169,169,117, 85, 42,149,194,120,185, 53, 16,219, 57, 2, 46,245, 1, 59,175, 42,214,179,180,180,
+180, 58, 90,173, 86,206,229,114,161, 86,171,173, 82, 69, 36, 73,242,111,222,188,233, 71,211,180,217,242, 77,131,234, 0, 62,205,
+ 1,129,179,213,125,102,172,120, 17,213,139,173, 23,150, 65,154, 5,139, 87,197,178,245, 10, 94, 19,132,133,223, 21, 66,171,115,
+ 92, 92, 28, 99,252,134,168,211,106,245, 34,235,111,209, 67, 81, 52,178, 11,148,184,127,255, 1, 86,173, 90,133, 11,151,166, 56,
+ 47, 90,180, 72, 56,123,246,108,213,192,129, 3, 87,208, 52,221,130, 36,201, 27,248,123,168,162,178, 85,136,166,235, 38, 36, 36,
+ 4, 26,254,107,181, 90, 56, 58, 58,194,209,209, 17,141,131,253,170,136, 44,138,162,160,169,102,232,208,224,163, 69, 48, 52,163,
+213, 82,160,104,186, 66,252, 20, 73, 85,126,191,157,184,222,192,168,120, 35,195,143, 14,109,154, 88, 22,131, 99, 35, 43,250,177,
+123,253,220,201,139,182,108, 17, 22, 81,158,227, 7,133,127, 26, 26, 49,104, 24, 6,127,244, 94,152, 74,173, 62,200, 33, 25, 90,
+ 91, 81, 31, 72, 48, 48,245,209, 98,241,130,144, 92, 44,211,242,132, 98, 56,248,212,195,131, 50,138,207,225,112,174, 60, 42,150,
+243, 73, 14, 23, 36,151,143, 59, 69, 74,237,107,212,221, 59,201,201,201,146,186,117,235, 66, 42,149, 66,167,211,209,253,251,247,
+207,226,114,121,126, 92, 30,143,232, 51,232, 43, 58, 55, 55, 91, 75,146, 28, 48, 12,133,247, 34,198, 18, 66,145,152,175, 81,171,
+117, 40, 31, 58, 52,103,205, 50, 78,225,224,216,189,123,119, 55, 67, 36,224,190, 21,227, 28,141,214, 57,181,106,213,202,205, 56,
+234,208, 74,107, 17, 49,112,224, 64,177,191,191, 63, 1, 0, 87, 99,102, 25,172,103, 68,223,190,125, 69,254,254,229,126,248,127,
+174, 29,103, 53,167,135, 29, 3,148,164, 2, 37,105, 85, 44, 89,125,251,246, 21, 6, 6, 6,218,116, 45,234, 29,224, 45,230,238,
+178,231,234,128,220,235, 86,113, 13,255, 31,180,190, 14,224,174,120,143,132,192,193, 93,213,110,250, 31,151, 89,177,197,130,133,
+ 85, 48,209, 34,175, 20,194,244, 2,177,179,254,187, 66,112,113, 1, 64,111,162, 35,140,116, 22,180, 58, 77, 21,145, 69, 81, 20,
+120,132, 10,171, 86,173,194,196,137, 19, 1,128, 63,121,242,228,253,139, 22, 45,250,144,166,233, 22, 12,195,116, 36, 8,162,186,
+183,198,211, 18,137, 36,143, 97, 24, 30, 73,146, 29,215,174, 93,235,214,171, 87, 47, 56, 58, 58,130,161,153, 42, 34,139,162,104,
+104, 52,106,139,211,220,186, 58,137, 23,253,190,119,188,235, 59, 31, 44,239, 74,209,244,113,131,200,162, 41, 10,160,203, 55,122,
+146,159,133, 99, 71, 15, 98,195,250, 13, 69, 32,152,187, 96, 64,235,197, 32, 44,136,193, 22,231,175, 38,117,236,208,166, 9, 22,
+109,217, 34,188,157,144,179,255,171, 73, 51, 67, 35, 6, 13,195,222, 93, 49, 32,117,197,215,141, 69, 22,165,165, 81, 82, 84,216,
+247, 20,235,163,245,178,224,118,236,248,113, 98,216,176, 97,116,105,105, 41,248, 2, 1,173,213,106, 57,111,191,253, 54, 53,113,
+226, 68, 50, 55, 55, 23,210,210, 50, 46, 0, 55,188, 6,102, 45,169, 84, 26, 51,118,236,216,176,179,103,207,242, 73,146,132, 84,
+ 42, 69,151, 46, 93, 10, 11,104, 95,209,232,207,191,242,200,206,206,210, 57,137,185, 42, 62,159,135,252,252,124, 58,172,215, 16,
+197,160,145, 19,235, 76,156,181,100, 99,206,197,245,235,172,169,195, 56, 18,208,116,221,230,205,155,213,190,190,190, 74,161, 80,
+ 40, 24, 49, 98,132, 85,227,135,106,181,154, 89,186,116,169,202, 52,186, 80,173, 86, 51,171, 86,173, 82,251,249,249,169,196, 98,
+ 49,163,213,214,236,247, 73,146,132,238,179, 69, 59,116, 58,157,174,146, 21,203, 32,178,180, 52, 81, 22, 21, 21,165,241,243,243,
+ 83,219,217,217, 49, 66,161,144,111, 77, 59,191,250,234, 43,198,213,213, 85, 99,111,111,207,159, 54,109,218, 51, 69, 29,106, 41,
+112, 23,173,173, 72,239, 32,116,116,116, 68,105,105,105, 69, 91, 37, 18, 9, 43,182, 88,176, 48,131, 42, 90,228,213,180,194, 89,
+151, 71,139, 6,202,242,242, 11,189, 60,188,235, 65,167,211,233, 63, 90,232,180, 90,140, 31, 51, 8, 43,214, 71, 1,128, 65,108,
+117,159, 60,121,242,126, 0, 53,222,204,118,239,222,189,112,242,228,201, 78,121,121,121,127,252,252,243,207,110, 67,134, 12,193,
+212,169, 83,177,124,249,114,240, 4, 34,184,121,214,173,168,199, 80,111, 97,193, 83, 48, 96,202, 44,216,233, 52,229, 55, 41,112,
+221, 61, 3,160,165,180,160,181, 90,104,181, 90, 16,156,242,174, 29, 59,122, 16, 67, 62,249, 10, 60,161,147,235,143,171,150, 41,
+ 66, 91, 75, 62,156, 61,106,148,202, 10, 35, 32,121, 59, 33,103,255, 87, 19,167,117, 55,136,172, 95, 99,214,223,253, 97,198, 7,
+ 59,133, 2,110, 69, 61, 90,154, 6, 73,114, 88, 31,173,151, 36,178,132, 66, 97,236,145, 35, 71, 30,182,108,217,146,144,201,100,
+208,106,181, 40, 44, 44,196,254,253,251,239, 48, 12, 3, 87, 87, 87, 28, 57,114,132, 30, 50,100, 72,172, 74,165, 10,127,213,197,
+ 86,110,110,238, 61,177, 88,188,123,230,204,153,131,102,204,152,193,163,105, 26,247,239,223, 7, 8,130,225,241, 5, 32, 73, 18,
+ 60, 30, 23, 37, 37, 82,218,206,193, 37, 71,195,112,236,120,124, 1, 72, 14,191,186, 48,225, 12,125, 50, 82,144, 92,126,169, 33,
+ 18,144,207,231,227,210,222,239,165,157, 71, 44,116, 2, 0,190, 80, 92,212,163, 71,143,244, 38, 77,154,200,174, 93,187, 22,128,
+170, 81,135,166,215,167,174,223,136,105, 28, 59,177, 72,214,189,123,247, 12, 3,103,218,241, 31,165,195,190,152, 69, 16, 28,129,
+172, 79,159, 62,233,161,161,161, 50, 14,135,131,164,131,203,164,253, 70, 76, 19, 17,213, 36, 89,253,227, 33,243,217,141,189,231,
+ 26, 47, 94,188, 88,219,171, 87,175,199, 6,127,177,180,180,180, 58,189,123,247, 22,174, 92,185, 82,219,187,119,239,204,102,205,
+154,149,145, 36,137,132,132, 4,191,234, 44, 85, 6,136,197, 98,237,167,159,126,154,113,235,214,173,218, 70, 29, 86,139,186,117,
+235,130,166,105,116,233,210, 5, 74,165,146,181,108,177, 96,241,122,194, 52,143,150,229,204,240, 90,157,246,171, 49, 19, 22,252,
+ 8, 16, 14, 70,119,129,191, 13, 75, 12,136, 41, 83,190,182, 7, 32, 54,136,173, 73,147, 38,213, 56,205,137,145,200,106, 61,100,
+200, 16,124,243,205, 55,248,225,135, 31,168,229,203,151,115,238, 61, 72,213,140,248, 98, 94,177, 73, 61, 96,192,148,209, 90,250,
+ 43,115,124, 69, 37,178,121, 29,123,127,183, 32, 43, 79,126,126,196,216,217, 21,119, 47, 10,128,148,144, 80, 0,176, 97,253,122,
+ 25, 79,232,100, 31, 49,104, 24, 0,116,255,113,213,178,253,139,176,165,102,177,197, 16, 33, 95, 77,154,230,106, 16, 89,107, 87,
+ 46,190,229, 76,228, 69,141,251,250,142,214,184, 30, 0,112,115,196,254,142,189,191,123, 55,255,169,108, 53,123,158,189, 56, 8,
+ 4,130,133, 39, 79,158,180,111,222,188, 57,241,228,201, 19, 80, 84,249, 17,209,104, 52, 40, 41, 41, 65,105,105, 41, 84, 42, 21,
+ 90,181,106, 69,174, 89,179,198,126,220,184,113, 11,213,106,245, 23,175,122,191, 83, 82, 82,214,254,246,219,111, 56,115,230,204,
+192, 25, 51,102,240,124,124,124, 8,103,231, 60, 66,171, 81, 3, 96,152,130,130, 2,218,206,193, 37,199,195,219, 47, 35, 59, 55,
+ 63, 68,171, 81,131,166, 52, 22,189,205,245,233, 29,166,220,190,125,187,222,247,223,127,175, 54,142, 4, 28, 52,237,199, 53,173,
+ 90,181,114,139,138,138, 82,247,233,211, 39,221,224,188,110,141, 51,252,177, 71,152,112,251,246,205,166,166,156,157, 71,127,191,
+213,192,105, 28,141,216,247,235,141, 91,131,131,131,221, 66, 67, 67,211,171,227, 13, 12, 12, 84, 72, 36, 18,117,227,198,141,203,
+120, 60, 94,185, 37, 75,171,149, 7, 6, 6,210,222,222,222,234, 38, 77,154,148,217,234,180, 47, 22,139, 25,131, 85,204, 28,108,
+137, 58,228,113,160, 27, 50,100, 72, 69,102,248, 41,193,193, 57,195,134, 13,147, 76,158, 60, 25, 91,183,110,197,133, 11, 23,170,
+136,253,176,176, 48,156, 61,123,118, 1, 94,163,196,186, 44, 88,252,199, 80,125, 30, 45, 83,108,219, 22,243, 39,140,124,154,204,
+ 97,209,162, 69, 66,189, 37,171,251,196,137, 19,161, 80, 40, 92,205, 20,235, 6,125,174, 13,115, 34,107,217,178,101, 59, 25,134,
+241, 3,208,129,162,232,203,155,183,108,235, 98,169,190,136,136,136, 42,156, 12, 65,114, 72,146, 40, 19,240,152,191,214,111,218,
+250, 75,165,242,229,206,239,141, 64,224,198,143,171,150, 41, 0,116, 55, 21, 91,248,123,154,145, 10, 78, 3, 62, 31,251,121,133,
+200,250,113,213,178,227,161,173,253, 63,156, 61,106,161, 89,113,182,112,222, 24,123,146, 36,222, 54,241,209,170,194,249, 28,192,
+114,254,141, 46, 67,134, 12,105,209,182,109, 91,210, 88,100,169,213,234,138,196,157, 6,103,241,172,172, 44,132,133,133,145, 45,
+ 90,180,104,118,229,202,149, 46,248,123, 58,167, 87,181,239, 84, 74, 74,202, 26, 31, 31,159, 19,115,231,206, 29, 86, 88, 88,216,
+187,168,168,216, 61,110,219, 66,244,140, 24, 75,132,245, 26, 44, 83, 51, 92, 81,102, 78, 94,227,211, 71,118,184, 29,221,189, 22,
+ 26,181,122, 12,128,187,248, 59,189,131, 41,167,220,144,198,161,113,227,198, 50, 99,161,226,239,239,175,172, 83,167,142, 42, 52,
+ 52,180, 98,185,133,104,190, 42,125,183,149, 83,239,255, 37,171,105,127, 26, 68,155,105,218, 8, 59, 59, 59, 24,196,151, 45,237,
+ 52,142,182, 52,123,163,172, 57,234,176,130, 83,159,222,161,146, 78,139,137,137,233, 22, 19, 19,211, 26,192, 95, 40,159,235, 80,
+ 11,148, 15, 37, 26, 57,205,207,215,127,216,235,157,229,252,175,114,190,202, 8,195,223,190, 89, 64,185,175,214, 25,139, 66,171,
+ 38, 24, 28,223, 1,144,147, 38, 77, 42, 82, 40, 20,174,195,134, 13,171,118,155,220,220,220,173,209,209,209,149, 68,214, 71, 31,
+125,244, 73,108,108,236,137,252,252,252, 90,245,202,213, 73,188,232,204,161,233,174, 97,125,190,155, 8, 96,185, 5, 67, 30, 29,
+218, 90,242,225,143,171,150,237, 55, 17, 91,219, 1,124,100, 73,149,246,120,239, 3,236,216,246,163,193,183, 75,124,235, 90,214,
+209,129,215, 35,205, 70, 43,186, 56, 8, 35,245,237,152,204,250,104,189, 24,240,249,252,206, 51,102,204,224,203,100,178, 42, 34,
+203, 84,104, 73,165, 82,220,184,113, 3, 35, 70,140, 16, 38, 38, 38,118,214,104, 52,167, 94,135,125,144,155,155,123, 79,159,140,
+116,130, 33,133,131, 80, 36,230, 15, 30, 57,209,175, 34,234,112,247, 90,168,148, 10, 0,224, 90,147,222,129,203,229,242, 19, 19,
+ 19, 3, 12, 86, 43,141, 70, 35, 52, 44,191,118,237, 90,128, 33,183,150, 82,169,180, 58,234,240,159,226,188,121,243,166,159, 33,
+ 58,210, 16, 93,200,229,114,249, 9, 9, 9,126, 6, 78,149, 74,101, 85,212,161, 64, 32,224, 39, 38, 38,250, 81, 20,245,220,162,
+ 14,141,133, 49,202,231, 89,172, 52,215,162,222,183,140, 32, 8,130, 97,135, 13, 89,176,120,229, 97, 26, 41, 89,253,164,210, 53,
+193,224,248,110,195, 38,220,186,117,235,246, 24, 52,104, 80, 37,145, 21, 30, 30, 78,237,219,183,239,180, 68, 34,201, 35, 73,242,
+158,173,237,168,240,209, 66,149, 55, 72,144, 36,121,163, 67,155, 38, 32, 73,242,198,236, 81,163, 84,139,176,165,146,216, 58,184,
+127,207,187,153, 69,119,204, 75, 51, 0,238, 94,190, 24,242,201, 87, 24,242,201, 87,174, 0,218, 3,150,163, 21,171,107, 7,139,
+127, 6, 4, 65, 8,234,212,169,115, 75,169, 84,130, 32, 8,168, 84,170, 10,129, 85, 90, 90,138,146,146,146,138,255, 26,141, 6,
+ 5, 5, 5,240,247,247, 7, 65, 16,175,181, 31,157, 70,163,209,205, 88,240,125, 52,135,203,215,209,180,134,208,104, 52, 35,109,
+185,206,103,204,152, 65,194,140,239,213,184,113,227,204, 46,127, 89,156, 51,103,206, 52, 27, 37, 56,110,220,184,106,163, 7, 45,
+225,235,175,191,126,110, 81,135,214,223,190, 88,176, 96,241,154,193,108,232, 94,173,132, 22, 73,146, 55,204, 68, 23, 18, 0, 24,
+146, 36,111,152,201,114,160,203,200,200, 88,224,226,226, 50, 70, 38,147,253,254,209, 71, 31, 77, 10, 15, 15,167,128,114, 7,249,
+218,246,168,168, 68, 54,175,115,223,165,147,139,203, 84, 81,166,235, 76, 45, 79, 6,177,181,118,245,178,117,251, 99,119,133,231,
+102,103,174,179,212, 55, 75,130,202, 82,180, 98,137, 84,177,160,115,223,165, 19,139,164, 10,214, 71,235, 5,129,162,168, 99, 98,
+177,152, 48, 76,166,108,108,189,146, 74,165,144,203,229,208, 79, 73, 3, 0, 40, 43, 43,131,179,179, 51, 40,138, 98, 94,179, 93,
+161, 2, 48, 85,111,173, 2,128,169,169,167,215, 24,159,219, 55,141,215, 85, 99,205,202,177,102,130,104,115,219, 85,183,238, 31,
+224,204,171,102,130,232,234,144,103, 35, 95, 30, 0,240,121,156,124, 75,147, 71,243,121,156,252,106,252,246,109,124,111, 32, 24,
+ 0, 11,216, 43,155, 5,139, 87,247,253,255,101, 85,220,141,229,100, 57, 89,206, 23,194, 41,212,127,172, 93,199,238, 79,150,147,
+229,100, 57,255,109,156,230, 48,250, 21, 17, 90,140,153, 15,128, 90, 90,180, 88,176, 96,241,175,131,170,150,235, 88,176, 96,193,
+130,197,179,163,202,100,210,198, 43, 44,169, 82, 91,162, 9,106,163,108, 79,176,156, 44, 39,203,201,114,178,156, 44, 39,203,249,
+159,227,172,137,219,120,251,209, 0, 54,189, 34, 98,235,165, 4,180,176,102, 85,150,147,229,100, 57, 89, 78,150,147,229,100, 57,
+107, 11,118,232,144, 5, 11, 22, 44, 88,176, 96,193,226, 63, 14,219, 18,150,178, 48, 3,255, 15,102,131,198, 76,253,238, 92,134,
+199, 7,231,191,110, 93, 12, 15, 15,231,216, 82, 62, 53,213,133,188, 14,201, 15, 78,246,252,190,101, 50,237, 15,244,245,121, 81,
+ 53,157,136, 30,129, 45, 63,182, 19,217,125,161, 86,171,235, 59, 56, 58,230, 63,125, 82,176,225,105,198,205,181, 70,101,156, 46,
+ 95,190, 44,105,219,182,109, 54,128, 82,163, 55, 5, 22, 44, 88, 60, 79,184, 52,169, 11,130, 24, 9, 48,127,135, 93,210,204, 29,
+148,220,221, 86,169,156,115,200, 39, 32,137,166, 70, 75, 20, 96,176, 25,197, 73,143,107,120,224,184, 36, 39, 39, 7, 52,104,208,
+ 32, 29, 64,177,105,237,102,214,177,215, 57,139, 87, 25, 97,168,156,176,180,226, 90,120,118,161, 21,252, 81,125,232,200,225, 96,
+ 48, 20, 4, 18,145, 26,219,191, 86, 60, 65, 31,250,130,230,190, 9,160, 37,192,180,180, 23,139,254,167, 80,107,242,105,134,249,
+ 24,143,246,252,101, 51, 95,253,240,177,176, 60,157,197, 2,164,198,174,183,137,143,102,102, 93, 61,187, 79,232, 98, 71,160, 65,
+171,143,166,161,114, 6,231,218, 66, 0,160, 35, 73,146, 77,237,236,236, 36,114,185,188,128,166,233,199, 40, 31,159, 46,170, 37,
+ 39, 9,224, 83, 7,123,251,158, 1,142,130,150, 25,133, 37, 89,165, 90,234, 28,202, 19,186, 22, 61,175, 51,170, 92,100,249,108,
+154, 56,184,237,136,101,227,187,193,165,243,210,105,114,160, 58,161, 69,248, 53,122,251,224,192, 65, 17,157,191, 28, 61,194,193,
+215,211, 1, 57,133, 50,247,245, 91, 99,190,143,137,217,209,103,212,192,238, 61, 1, 96,225,194,133,253,234,214,173, 91,143,195,
+225,164,206,153, 51,103,251,188,121,243, 24,194,242, 76,229, 18,253, 57,108,184,225,219, 3, 8, 5, 16, 8, 32, 5,192,109, 84,
+206, 50, 94, 27,188, 18,156,190,190,190,117,104,154, 30,229,237,237,221, 59, 47, 47,239, 48, 73,146, 91,178,178,178,178, 95,230,
+ 93,135, 97,152,141, 4, 65,140,102, 24,102,147, 13,223, 99,108,169, 67, 36, 18,229, 41,149, 74, 47,253,239,124,165, 82,233,253,
+ 79,245,231, 69,214,245,130,222,191, 63, 59,118,254,118, 79,227, 69, 61, 58, 52, 53,115, 71, 33,154, 30, 59,127,167, 83,229,114,
+161,148,133,123, 32,193, 48, 12, 22, 44, 88, 64, 68, 70, 70,126, 18, 20, 20, 20, 76,146,228,253,185,115,231, 86, 74,125, 99,186,
+206,232, 58,103,197, 22,139, 87, 21,182, 77, 42, 93, 35,154,132,219, 67,201,132, 3,196,136,176, 54,255,235, 48,230,227,190, 4,
+195, 17, 97,240,103,211,117, 54,115, 5,140, 16,130,163, 88,212,188,105,163, 73, 17,125,187,145,173, 67,235, 65,226,233, 12,144,
+ 60,108, 60,146,230, 30,181,108,206, 58, 0,109,107,209,202,121,143,226,119,122,229, 20, 83, 32, 8,128, 32, 0,146, 0,202,148,
+ 52,122,244, 27, 62, 15,192,122, 27,239, 74,164,139, 29,129, 73, 59,149, 0,192,121, 14, 7,165,158,167,167,231, 39, 19, 38, 76,
+176, 15, 13, 13,117, 17,137, 68, 2,165, 82,233,157,156,156,236, 57,103,206,156, 80,133, 66,113, 8,192, 85, 27, 57,253, 27,248,
+213,217, 19, 53,233,211, 55, 91, 4, 6,128,167, 46, 3,173,146,213,125,144,252,240,173,207,215,237,253,236,206, 83,229, 32,212,
+ 98,202,132,194,194, 66, 2, 0, 60, 60, 60,152,202, 34,171,221,136,149,147,123, 96,210,138, 99,144, 43,213,191, 84,199,225, 86,
+239,141, 97, 31,126,248, 65,231,197,179,198, 57,100, 61,209, 32, 49, 85, 1, 55, 7, 62,230, 77, 29, 43, 80,169,180,111,173,219,
+ 30, 51,250,199,239,166,111,166, 40,234, 29, 0,173, 41,138,186, 6, 96,251,130, 5, 11, 44,221,124, 35, 1,204,212,159,208, 59,
+ 56, 28,206,241, 46, 93,186,212, 31, 53,106, 20,209,170, 85, 43, 36, 36, 36, 4,238,220,185,179,219,225,195,135, 83, 41,138,186,
+ 9,224, 62,244,211,158, 88, 1, 30,128, 70, 28, 14,167,249,191,153, 83, 34,145,136,213,106,245,112, 63, 63,191,209,111,191,253,
+118,243,190,125,251, 18,141, 26, 53,194,189,123,247, 90, 29, 61,122,116,222,185,115,231,110,102,102,102,110, 18, 8, 4,209, 57,
+ 57, 57,138, 23,254, 28, 39,136,209, 0,234,232,117,242, 2, 43,190,179, 81,158, 75, 42,199,218, 58,148, 74,165,151, 97, 10, 27,
+130, 32,188,254,201,254,216, 88, 87, 18, 65, 16,110,250,178,168,238,155, 36, 73,232,116, 58, 25, 69, 81, 65, 53,112, 54,210,191,
+ 72, 89,173,117, 1, 84,151, 8, 90, 12, 0, 61,218, 55,125, 10, 2,119, 42, 44, 90, 85, 95, 50,239, 84, 8, 48, 6, 77,143, 93,
+184,227, 86,201, 10,102,250, 22,187, 96, 1, 49,111,222, 60,204,159, 63,191, 47,128,142, 52, 77,159, 11, 9, 9, 89, 83,137,146,
+166, 43,214,205,155, 55,111,117, 53,215, 57, 11, 22,175, 10, 58,195,150, 73,165, 45,190,255, 4,245,239, 4, 10, 35, 2,220,189,
+194,199,143, 26, 32, 14, 13,105, 0, 37, 28,144, 86, 72,225, 72,220, 81, 0,216,109,155,213,105, 64,107, 46, 87, 25,189,108,254,
+212,198, 29,223, 12,197,173, 44, 45,174,101, 81,144,167,106,193, 33,181,160,104, 6, 96,160,172,109,175, 51,139,116, 56,127, 95,
+ 13,146, 0, 56, 36, 64,146, 4, 56,100, 45,201,104,245,131,133,219,174,135, 22,230,209, 0,173,126,240,140, 7,164,105,195,134,
+ 13,135, 69, 70, 70,186,228,230,230,218, 39, 36, 36, 64, 40, 20,194,213,213,149, 35,145, 72,234,172, 88,177, 66, 49,126,252,248,
+222, 26,141, 38, 13, 64,161,149,156, 33,189, 90, 55,191,184,105,217, 66,103,237,229,163, 40,222,245, 43, 56, 36, 3,190,189, 3,
+234,139,197, 56,250, 97, 3,183,240,184,212,125, 87,242,100, 33, 0,178,106, 34,187,123,247, 46, 71,165, 82, 13,114,114,114,106,
+199,227,241,188, 69,174,245,232,108,110,235, 39, 5, 68, 96, 74,190,151,188,211,228,110,222, 61,127,152,216, 5,147, 86, 28,195,
+170,157,151,126,110,137,220,185,213,229,205,182,179,115, 24, 51,254,139, 81, 14,153,133, 26, 44,218, 87,136,109,103,165, 24,222,
+209, 17,147,222,115,198,144,193, 3,237,247,254, 26, 59, 6,192,102,163, 77,238,133,132,132, 16,119,239,222, 53,119,243,117, 5,
+ 48, 93,173, 86,147,124, 62,159, 16,137, 68,195, 22, 47, 94,172, 25, 60,120,112,166,161, 64,199,142, 29,209,177, 99, 71,162,180,
+180, 52,240,212,169, 83,129, 49, 49, 49,186,248,248,248, 36, 0, 7, 45, 91, 44,196, 25, 74,165,162,174, 72, 44,150,175, 95,183,
+238,135, 78,157, 58,209, 66,225,223,233,167,106,195, 9, 0,206,206,206,155,189,188,188,136,111,190,249, 38,251,121,113,214,171,
+ 87,239,216,155,111,190,217,165, 71,143, 30,220,246,237,219,163, 78,157, 58, 21,235, 60, 60, 60,208,177, 99, 71,226,241,227,199,
+ 45,206,157, 59,183,238,216,177, 99,107,254,250,235,175, 83,105,105,105, 61, 94,176, 69,107,147, 94, 76,228,216, 88,254,149, 7,
+ 65, 16, 14, 27, 55,110,244, 50,204,201,168,213,106, 65, 81, 84,197,183,225, 67,211, 52, 40,138,194,226,197,139, 41,153, 76,102,
+205, 62,146, 25,189, 53, 27, 62,180,185,111,129, 64,224, 97, 72,216, 91,195,157,253,142, 68, 88,220,196,222,222, 62, 0, 64, 47,
+120, 6, 79,175, 92,160,252,253, 89, 38,147,165,231,168, 92,238, 0,232, 84, 13,155, 75,100,100,228,240,249,243,231,127, 96,100,
+165,109, 30, 17, 17, 97, 58,237, 85,115,253,183,140, 32,136,211, 36, 73, 30, 2,176, 13,207,209,234,206,226,245, 2,195, 48,109,
+ 0,120, 26, 45, 82,163,124, 84, 8,250,231, 36, 1,192,221,100,185,113, 57,195,119,129,126,185,167,126, 59,198,136,183,128, 32,
+136,171,181,108,226, 25, 88,240,211,226, 2, 64, 92, 92, 28,211,167, 79, 31,194,240,109, 94, 20,133, 31,249,116,240,251, 61,123,
+119,125, 27,164,200, 21, 15,242,129,248, 12, 6, 92, 82, 11, 18, 12, 46, 95, 56,197,128, 75, 71,155,108,101,217,122, 82,175,255,
+215,205, 67, 67,150,110, 89, 54,129,147,148,207,197,182,115,114,104,148,101, 40,200,205, 64,126,118, 58,114, 50, 83,144,149,145,
+114, 19, 32,230, 89,205, 89,229,192, 0, 20,173,127, 7,164,129,106, 34, 47,107,230,212,200,238, 6, 54, 10, 13, 45, 18, 80,128,
+ 70,118,215,138,234, 45,113, 54, 11, 14, 14, 30, 60,107,214, 44,183,219,183,111,139,229,114,185,234,232,209,163,247,210,210,210,
+156, 36, 18,201,211,177, 99,199, 6,215,169, 83,199,233,163,143, 62, 18,236,218,181,171, 31, 42,135,181, 90,226, 12,125,191,221,
+255,226,183,174, 89,105,255,100,111, 20,212,201, 55,112, 36, 71,134, 11,121,114, 38,208, 89, 72,124,213,194, 19, 14, 66, 46, 22,
+182,175,227,208,107,127,242, 82, 45, 77, 15,169,142,243,226,197,139, 18, 59, 59,187, 21, 67,135, 14,149,140, 27, 55, 78, 72,113,
+ 93,184,177,241, 79,156,167,175,139,175, 35, 87,105, 56,131,187,212,195,228,161,205, 49,121,213, 73,131,200, 26, 93,191,126, 49,
+125,253,186,101, 78,173, 70, 83,223,207,203, 9,137,105, 10,108, 59, 43,197,159,179,234,160,235,226,108,124,212,146,139, 16,127,
+ 7,232, 52,218, 70, 17, 17, 17,209,250,183,246,171, 0,250, 69, 68, 68, 52,230,112, 56, 39, 1, 28,168,233, 24,137, 68,230,103,
+ 79,113,117,117, 69, 88, 88, 24, 66, 66, 66,184,157, 58,117,106,110, 34, 96, 42,113,106, 52,106, 9, 77, 51,112,116,116, 20,187,
+187,187,187, 58, 58, 58, 62, 49,247,160,178,133, 19, 0,220,220,220,250,135,133,133,113,119,238,220, 89,152,154,154,122,121,240,
+224,193, 41, 78, 78, 78,149,172,191,246,246,246, 8, 14, 14,198,156, 57,115,184, 61,123,246,172,145,211,219,219,187,123, 76, 76,
+ 12, 8,130,168,120,104, 87, 49, 22, 7, 4,192,199,199, 7,189,122,245,226,246,239,223,191,123, 90, 90, 90,173,174, 35, 27,112,
+194,140, 69,107,129,201,113,178, 56,252,102,174,188, 21,199, 61,223, 96, 93,210,243,225, 25,174,205,106,135, 59, 69, 34, 81,133,
+ 21,202, 76, 93, 85, 56, 73,146,196,236,217,179, 65, 16, 4,120, 60, 30,248,124,190,217,239,206,157, 59,219,218,206,199, 4, 65,
+144,124, 62,127, 58,151,203, 29,165, 82,169,252, 68, 34, 81, 54, 69, 81, 63,171, 84,170,197, 0,180, 12,195,184, 88, 16, 89,102,
+ 57,237,237,237, 3, 30, 60,120,208,208, 82, 67, 84, 42, 21,154, 55,111, 14,168,144, 84, 29,103,114,114,114, 64, 80, 80, 80, 35,
+ 0,134, 41,218,206, 50, 12,211,201,232,191, 49,206, 50, 12,243,158,254,247,253, 71,143, 30, 5, 52,104,208,160,232, 69,157,159,
+ 44,231,191,143,179, 6, 45,226, 73, 16, 68,156,209,181,218,199,240,127,198,140, 25, 51,151, 44, 89,114,155, 32,136, 56,227,229,
+198,229,140,191,245,247,155, 56,134, 97,250,124,243,205, 55,161,223,125,247,221,183,134,178,255,132, 72,180,197,162,229, 84,160,
+180,199,185, 12, 39,112, 57, 20,184, 36, 1, 46, 7, 0, 67, 32, 61, 45, 25,165,210,226,243, 72,221,151,106,157, 37, 43,188,253,
+ 27,111, 52, 91,182, 99,213, 52,242,167,115,114, 20,203,148,184,251,215,105, 92, 61,125, 32,151,210, 81, 7, 64, 48,215, 0, 50,
+ 1, 41,244, 61, 32,182,118,115, 92, 16, 12,183, 92,104,233,197, 85, 37,177,245,210,208,162,113,227,198, 3,231,204,153,227,113,
+253,250,117, 81, 73, 73, 73,233,142, 29, 59,178, 85, 42, 85, 26,128, 63,210,211,211, 27,175, 94,189, 90,176,108,217,178,102,205,
+154, 53,147,236,217,179, 71,109,102, 58,163, 42,156, 83, 71, 12,137, 31, 53,126,162, 40,105,207, 90, 8,146, 18, 48,251, 70, 33,
+245,103,142,124, 22,128, 85,120, 92,214,190, 64,169, 59,190, 50,172, 46, 89,207,145,143, 6, 46,130,206,119,159, 42,171,181,100,
+217,217,217,173,136,137,137, 9,104,211,166, 13, 9, 0,231,238,235,132,211,215,197,215,249, 99, 73,123,162,125, 83,119,228, 23,
+171, 48, 97,109, 34,142,198,231,255,110, 16, 89, 53, 53,210,209,209,177, 32, 51, 95,234,237,238, 32,194,199, 29, 28,208,117,113,
+ 54,194, 91, 11, 33,228, 19,184,151,154,139, 6, 65,245,136,196,243, 7, 91,235, 69, 86,155,156,156, 28, 0,104, 13, 32,245,241,
+227,199,146,182,109,219,150, 24,209, 21, 1, 88, 42, 16, 8,102, 19, 4,193,180,105,211, 38,177, 89,179,102,101,174,174,174, 80,
+ 40, 20, 80,169, 84,224,243,249, 80, 40, 20, 72, 79, 79,199,229,203,151,225,234,234,106,211,129, 42, 43, 43,131,163,163, 35,104,
+154,126,102, 78,138,162,136, 13, 27, 54,216,223,190,125,219, 62, 54, 54,214,123,210,164, 73, 79,154, 52,105,114,109,224,192,129,
+ 15,189,188,188, 84, 55,110,220,192,197,139, 23, 81, 84, 84,132,118,237,218, 89,197,169, 86,171,193,229,114,161, 80, 40, 32, 20,
+ 10,193,229,114,161,211,233, 64,211,116,133,248, 42, 43, 43,195,211,167, 79,193,231,243,161, 86,171, 95,198, 27,104, 21, 11, 85,
+117,195,111,181,177,104, 25, 11, 53, 43, 69, 86, 77,150, 40,139,195,157,197,197,197, 98, 23, 23,151,233, 0,114,106,170,139, 32,
+ 8,112, 56, 28,240,249,124, 16, 4,129, 78,157, 58,225,211, 79, 63, 69,203,150, 45,145,156,156,140, 93,187,118,225,234,213,171,
+224,241,120, 21,229,173, 30,159,232,220,153, 35, 18,137, 46,190,255,254,251,161,179,102,205, 18,213,171, 87, 15, 73, 73, 73,254,
+223,125,247,221,244, 19, 39, 78,124, 32,147,201, 90, 27,238,118,213, 91,233,245, 67,130,229,195,133,189, 84, 42, 21,146,146,146,
+108,217,166, 10, 26, 52,104,144, 78,146,228, 67,154,166,207, 1,104,206, 48, 76, 39,130, 32,142,162,220, 47,209, 24, 50,134, 97,
+222, 35, 8, 66, 10,224, 38, 73,146,247,105,154, 78,103,237, 54, 44,172,184,175,244, 49,253, 79, 16, 68,220,146, 37, 75,250,152,
+ 19, 87,102,174,205, 74,203,191,251,238,187,111,141,254, 63,139, 69, 53, 12,149,157,225, 59,235,173, 92,127, 11,173,184,184,184,
+234, 21, 8,141,143,226,246,237,188,212, 85,131,128,208, 86, 29,141,172, 67, 12, 18, 46, 95, 4,192,252,108, 85, 83, 36,125,196,
+ 36,135,251,243,134,111,199,145, 27, 79,203,241, 56, 59, 31, 23,143,252,140,130,156,180,109, 0, 51, 9,169,177,210,103, 62, 18,
+245, 62,106,230,229,238,225,162,212, 48,160, 25, 0, 85,196,214, 75, 65,203, 70,141, 26,245,143,143,143,247, 80, 42,149,162,243,
+231,207,203, 99, 98, 98,114, 53, 26,205,105, 0, 23,244,101,174, 23, 20, 20, 68,232,133, 9,135,203,229, 10, 52, 26, 77,117,190,
+ 11, 45,167,142, 26,126,126,233,134,173,162,135,183, 18,177, 58,246, 8,138,229,114,234,116,190,162, 31, 0,131,162, 63,121,189,
+ 80,145,197,128,169,203, 35, 9, 72,236,121, 62,119,159, 42, 69,128,249, 33, 89,149, 74, 53,120,232,208,161, 18,131,200, 2,128,
+194, 82, 45, 87,174,210,114,218, 55,117, 71,171, 46, 17, 72, 56,181, 23,123,206,102, 33,200,211,238,108,125,251, 98,171,246,104,
+ 65,126,206,134,149, 81, 27, 87, 46, 93, 48, 85, 48,185,151, 51,194, 91,243, 32,226, 19,112,178,227, 97,241,154,205,218,235,151,
+207,222,144, 72, 36,113, 0,250,229,228,228, 64, 34,145,148, 1,184,207,225,112, 82, 41,138, 50,231,212, 61, 23,128,119,116,116,
+ 52,169,213,106,203,146,147,147,225,227,227, 3,111,111,111, 56, 59, 59,227,238,221,187,248,243,207, 63,113,239,222, 61,208, 52,
+141, 55,222,120,195,166,131,245,228,201, 19,220,184,113, 3,189,122,245,158, 84, 80,144,239,228,234,230, 46, 59,127,238,236,247,
+181,225,164,105,154, 0,128,208,208, 80,132,134,134,138,178,178,178,252,226,226,226,188, 22, 45, 90,148, 17, 16, 16,176, 67,161,
+ 80, 84,178, 28, 88, 43,180, 12,226,194, 32, 2, 69, 34, 17,248,124, 62,164, 82, 41,242,242,242, 80, 90, 90, 30,180,233,226,226,
+242, 82,132,150, 5, 11,213,115, 43,255, 15,139,195, 42,195,157, 46, 46, 46, 67, 1, 76,183,178, 47,208,233,116,224,243,249,104,
+219,182, 45,162,162,162,112,245,234, 85, 28, 56,112, 0,254,254,254, 24, 49, 98, 4, 72,146,196,237,219,183,109,109, 34, 29, 31,
+ 31, 63,189, 95,191,126,161,209,209,209,162,244,244,116,220,187,119, 15, 46, 46, 46,136,138,138, 18,142, 30, 61,186,193,169, 83,
+167,230,162, 60,248,165,122, 24, 69, 23,202,196,146, 1,205,155, 55,175, 82,196,199,199,199,249,143, 63,254,240,170, 16, 96,166,
+ 17,137, 85, 81, 60,119,238,220,149, 33, 33, 33,171,244,195,133, 29, 1,216, 51, 12,211, 57, 54, 54,150, 0,128,240,240,112,134,
+ 32, 8,195, 3,233,230,222,189,123,187,220,189,123,151,153, 63,127, 62,235,163,197,194,146, 22, 25,109,184, 38, 45, 9, 40, 91,
+132,154,177, 60,104, 55, 9, 0, 0, 32, 0, 73, 68, 65, 84,197,203,128,111,190,249, 38,116,201,146, 37, 87,158, 81,100, 25,191,
+ 49, 49, 6,177, 85,241, 48,181, 56,100, 88, 97,251, 34, 37, 62, 94,238,110, 51, 70,180, 7, 77, 3, 58, 10,208, 81, 12,100,114,
+ 5,146,110, 93,149, 67, 68,196, 90,213, 28,161, 96,217,162, 89, 19, 3, 19, 51, 73,100, 23,105,112,230,224, 70,166, 32, 39,173,
+ 63, 82,247,142,124, 62, 34,107, 64,115, 31,111,175, 51, 59, 55, 46, 36,175,166,168, 65,209,229, 58,139,166,153,138,223, 47, 1,
+ 62,158,158,158, 67, 46, 93,186,228, 41, 20, 10, 69, 15, 30, 60,160,247,238,221, 91,164,209,104, 78, 24,137, 44, 0,104,223,186,
+117,107,157,131,131, 3,100, 50,153, 70,163,209, 40,171, 17, 89,126,157, 91,182, 56,187,116,195, 86,145, 82,173, 70,137, 66, 5,
+142,187,151,169,200, 2,128,183,187, 52,244,245, 37, 68,142, 96, 0,164, 73, 53,217,150, 68, 22, 0, 8,133,194,110,227,198,141,
+171, 52, 47,158,135, 35, 79,103, 39,228, 81, 23,238, 20,210, 9,167,246,226,220,237, 66, 90,196,231, 80,158, 76, 74,160,181, 59,
+160, 56,243,206,134, 3,191,197, 29,255,122,206,178, 50,185,172, 20, 65,117,196, 40, 43, 45,193,226, 37, 75,181,241,241,231, 78,
+ 79,159,244,249, 91,123,247,238,253, 14,229,206,224, 0,112,127,239,222,189,195,231,204,153,179, 29,127,167,121, 48, 69,246,144,
+ 33, 67, 50,155, 54,109, 90, 18, 18, 18, 82,242,228,201, 19,220,185,115, 7, 69, 69, 69, 88,189,122, 53,146,146,146, 96,176, 8,
+ 90,229,171, 82, 85, 32,161,168,232,169, 3,195, 48, 40,122,250,196,126,214,172, 89,206,181,225,164, 40,170,210,181,229,235,235,
+139,177, 99,199,242,229,114,185, 75, 70, 70,134,147,241, 58,107, 57,213,106, 53, 12,150, 33,134, 97,160, 86,171, 81, 82, 82, 2,
+181, 90,141,135, 15, 31, 86,136, 44,125,253, 47,205,162,101,248, 45, 18,137,242, 12,231,178, 97, 8, 78, 36, 18,229, 91, 42,255,
+ 44, 48,170,139,209,255,182, 85, 28,214,216, 31, 43,143, 59,248,124, 62, 62,253,244, 83, 92,185,114, 5,201,201,201,224,112, 56,
+144,201,100,144,203,229,232,222,189, 59, 4, 2,129,173, 22, 45,134,207,231, 15,157, 57,115,166, 40, 53, 53, 21,133,133,133, 6,
+103,122, 80, 20,133, 73,147, 38,137,133, 66,225, 80, 91, 77,247, 57, 57, 57,239, 62,124,248,176,145,233, 39, 55, 55,183,196,216,
+167,176,182,136,141,141, 37,194,195,195,153,240,240,112,198, 32,184, 88,176, 48, 7, 11, 90,100,147, 37,139,214,243,176,138, 25,
+ 44, 91,208, 7,136,212, 2, 6,145, 21,102, 36,188, 8,131,133,203,186,161,195,160, 1,255,243,118,119, 59, 21,189, 54,210, 33,
+238, 22,129,204,199,105, 40,200, 73, 71,235,183, 58, 35,233, 86, 34,104, 45,181, 15, 15, 99,107,246,228,172, 23,222, 48, 36,164,
+201, 23, 97,111, 53,195,178,184, 50, 60, 72,248, 3,197, 5, 57, 63, 34,109,239,190,231,114,132, 2,194, 91,120,123,185,157,218,
+190, 54,210,229,232, 29, 18,143, 31,167,225,224,246,149,140, 86,163, 42, 70,229, 72, 46,155,223,154,197,180, 90, 80, 86,156, 7,
+117, 41, 5, 17, 41, 23,217, 56, 72,145, 11,224,220,202,149, 43,187,182,107,215, 78, 48,100,200,144,220,162,162,162,131, 0, 46,
+ 25,149,105,218,176, 97,195, 94, 81, 81, 81,222,143, 31, 63,198,137, 19, 39,114, 81, 30,250,111, 9,153,103, 19,111,173,251,115,
+251,230,169,226,192,198, 88, 61,243,107, 93,236,213, 59,239, 3, 56,106, 84, 38,164, 91,243,134,113,139,166,124, 73,210,215,127,
+199,141,244, 60,164,148,168,254,180, 68, 88, 88, 88, 72,200,229,242, 0, 23, 23, 23,227, 19, 18, 18,123,153,106,218,128,134,217,
+221,167,159,175,163,212, 80, 16,242, 72,102,194, 7, 1,217, 87, 14,198,186, 23, 42, 11, 9, 67, 52, 98, 77,248,108, 96,183, 15,
+214,198,236,255, 56, 46,238,240, 23, 26,149,178, 89,227,198,141,152,107,241,167,110, 76,159,244,121,207, 90, 30,113,135, 43, 87,
+174,144, 28, 14,167,146, 64, 55,182, 16,217,106, 41,178, 5,214,114,154, 10, 45, 3,116, 58, 29, 81, 91, 78,149, 74, 85, 33,180,
+ 76, 31,238,230, 4,227, 63,209,127, 91, 44, 84,198, 67,134, 6,127, 58,165, 82,233,165,247,217,242,126,158, 22,173,103,137, 68,
+172,110,248,210,150,246,145, 36, 9,154,166,193,231,243,241,198, 27,111, 32, 46, 46, 14,110,110,110,112,114,114,130,147,147, 19,
+196, 98, 49,220,221,221, 43,132, 22, 73, 90, 29,165,195,168, 84, 42,127,127,127,127, 60,124,248, 16, 34,145,168,226, 35, 20, 10,
+ 17, 26, 26, 10,153, 76,230,139,151,105,187,103,193,226,159,189,175,196, 25,139, 37,130, 32,226,102,204,152, 49,179,182,124, 51,
+102,204,152,105,206,194,245,140,130,171,146,117,139,107,172, 32,205, 42, 73,189,200,218,246,227, 2,167,253,127, 1,153,153,169,
+ 56,190,103, 77,169, 86,163, 46,162,105,109, 64,202,189, 68,128,196,207, 86, 53,129,100,222,252,160, 87, 23,226,248,109, 53,164,
+197, 5,184,127,237,143, 52, 40, 4,223, 60, 55,145,229,237,113, 42,122,237, 2,151, 67,183, 8, 60,126,156,134,163, 59, 87, 75,
+181, 26, 77, 55,164,198, 94,123, 22,234,161,124,254, 7,252,186, 25,125, 70,117,204, 6, 69, 80, 24,154,116,247,189,252, 92,124,
+144,115,190,250,200, 48, 99, 20, 20, 20, 28, 92,185,114, 37,177,124,249,242, 48,165, 82,249, 43, 0, 99, 19,101,179,160,160,160,
+ 65,155, 54,109,114,123,252,248, 49,239,252,249,243,178, 83,167, 78, 49, 0, 14,213, 96,113,153,214,125,228, 88, 78,203,122,190,
+227,174,167,101,189, 15,224,119,163,213,161,125, 90, 53,189,176,117,201, 92, 71,237,133, 88,148,229, 60,198, 55, 23, 50,165, 0,
+172,222,223, 90,173, 22, 37, 37, 37,208,150, 61,209,181,150,200, 74,230, 71,120,169,242,138,148, 92, 30, 45,215,133, 56,229,171,
+ 78, 61, 73,225,216,217,217,217,180, 47,215, 46,153, 26, 3, 32, 38, 34, 34, 34,250,102,252,225,214, 18,137,228,112, 72, 72, 8,
+ 1, 0, 22, 34, 12, 45, 33, 18,192,164,183,223,126,155,104,219,182,237,229, 85,171, 86, 29,171, 78,172,212,198,162, 85, 19,172,
+229,164,105,154,180,176,127,137,218,114, 26, 91,180,106, 18, 90, 47,211,162,101, 78,180, 24,139, 68, 99, 33,244,111,136, 58,172,
+ 78, 76,217,210, 62,131,159, 28,159,207, 71, 98, 98, 34,234,214,173, 11,141, 70, 3, 71, 71, 71, 56, 58, 58,194,193,193, 1,165,
+165,165,224,241,120,176,177,207,180, 72, 36,202,184,115,231, 78, 35, 79, 79, 79, 80, 20, 85, 73,108, 61,120,240, 0,246,246,246,
+ 89,182, 90,180, 36, 18,201, 31,250,168,195, 74,240,241,241,113,126, 30,251,213,216,146, 21, 30, 30,206, 14, 17,178,168,214,154,
+101,193,170, 85, 96, 98,137, 82, 27,253, 47, 64,121, 14,183, 62,250,223, 48,243, 91,109,102,217,147, 37, 75,150,156, 50,242,239,
+ 42,120,198, 46, 24, 82, 60, 84,138,112,225,214,100,201,242,114,115, 61,181,101,245,124,167, 61, 9, 64,214,227, 84,156,217, 23,
+ 85,162,163, 52,239,128,102,114,226, 79,236,139, 5, 1, 57, 82, 98,207, 88,119,139, 64,203,150, 77, 2,112,224,182, 22, 5,153,
+ 15,192, 48,244, 54,228,199,200,159,249,232, 4,125,244,134,151,155,199,169,109, 81,243,157,247, 39, 18,200,124,156,138,227,123,
+162,164, 58,173,188, 43, 82,247, 37,212,150,246, 83,192,149, 99, 47, 90,215,191,115,203, 1, 1, 65,126,160, 25, 45,104, 62,131,
+143,166,121,112,239, 95,151, 31, 56, 39, 42,217, 67,151,209, 95,100, 93,178,206,129,174,172,172,236, 0,128,107,168,156, 94,161,
+ 69,112,112,240,128,117,235,214,121,102,102,102,138,174, 95,191,174,216,184,113, 99, 62, 77,211,251, 1, 88, 51,148,250,245,245,
+180,172, 45,168,156, 47,167,197,212,145, 67,226,135,124, 50, 74,148,122, 34, 6,174,169, 73,152,114, 33,155,186, 95,164, 30,172,
+183,174,153,133,135,135, 7, 83, 88, 88,152, 94, 92, 92,220,200,222,222, 30, 79,158, 60,193,211,167, 79, 81, 82, 82, 2,149,244,
+169,206,157, 42,150, 17,186,167,224,241,120,200,127,172, 5, 69, 81,185,214, 90,179, 0,184, 70, 70, 70,126, 70,211,180, 33, 35,
+ 98,165,232, 66,163,114,134,243,161, 81, 68, 68, 68,180, 81,212,161,177, 51,188, 33,189, 3,161, 79,239,208,238,247,223,127,191,
+219,179,103,207, 76,115, 98, 69, 40, 20,218,236, 40,109, 41,138,177, 54,156,150, 44, 90,166,203,109,225, 52, 12, 95, 26,156,224,
+ 77,151, 27,192,225,112, 64,211, 52,172, 8,170,248, 71, 69,139,113,116, 96,109, 68,142,201,177,169, 54,113,104, 45, 35, 17,159,
+171, 69,203,112, 44,248,124, 62,126,251,237, 55,124,242,201, 39,160, 40, 10,118,118,118,112,112,112,128,189,189, 61,246,237,219,
+ 7, 67,250, 7, 91,244,171, 86,171,253,101,201,146, 37, 51, 55,108,216, 32,102, 24, 6, 2,129,160, 66,104,205,159, 63, 95,161,
+209,104,126,177, 74,104, 25, 50,190,211,204, 29,123,123, 93,181, 81,135,230,182,177,224,175,229, 18, 25, 25, 57,156,166,233, 15,
+ 96,146,194,193,164, 92,165,212, 15,108,122, 7, 22, 86,220, 79,174,254,139,155,103, 16, 88,132,145, 37,171, 66,112,145,213,137,
+ 23, 79, 87,151, 83,155, 87,207,119,218,113,149, 64,106, 74, 10, 78,255,186,166, 92,100, 61,218,243, 23,210, 99,243,144, 26,219,
+ 1, 41,177,239, 90,253,246, 68, 16, 45,235,120,185,224,169,140,134,180, 48, 3, 96,112,253,121,136, 44, 79, 87,207, 83, 63, 69,
+205,119,222,251, 23,137,212,212, 84, 28,223,179,166, 68,167, 83,190,243, 44, 34,107, 40,159,255, 65,112, 67,191,228,217,159,125,
+ 48,160,109, 3, 31,184,103,220,197,161, 17, 3,176,112,215,135,112,244,228,224,205, 94,142,248,116,177,207, 0, 73,168,240,161,
+164, 3, 62,176,129,218, 88,100,181,172, 95,191,254,128, 75,151, 46,121, 52,111,222, 92,116,239,222, 61,229,198,141, 27,243, 21,
+ 10,197, 49, 0,137, 54,112, 26,139,172,150, 51, 70,143,136, 95,186, 57, 90, 68,242, 5, 88,246,203, 33,140, 63,155, 73, 29, 78,
+151, 70,160,242,176,162, 89,168, 84,170, 19, 81, 81, 81, 42,146, 36,241,244,233, 83, 20, 22, 22, 34, 63, 63,191,226,187,184,184,
+ 24, 28, 14, 7, 39, 79,158, 84, 75,165,210, 75,214, 54,240,226,197,139,245,179,178,178, 66,114,114,114, 90,235, 63,247, 80, 30,
+ 93,232, 96,180,172,117, 78, 78, 78, 24,128,171,134,229,153,153,153,245, 46, 95,190, 44,169,137,223,209,209, 17,124, 62,191,146,
+ 69, 75, 40, 20,194,219,219, 27, 58,157, 14,187,119,239, 6,128,167,213,113,240,249,130, 28,146, 36, 64, 51,180, 74, 36, 18,209,
+ 18,137,196,172,192,178,133, 83,143,204,247,222,123, 79,153,144,144, 96,214,162, 85, 27, 78,134, 97,228, 61,122,244, 64,118,118,
+ 54, 68, 34, 81,197,195,218, 32,168, 72,146,132, 80, 40, 68,110,110, 46,198,140, 25, 3,134, 97,228, 47,250,206, 99,236,211,164,
+ 23, 67, 4, 0, 66, 47,132,170,248,105, 89,235, 3,101, 24, 26,100, 24, 6, 6,193,101,178,190,162, 46,107,178,183,155,248,116,
+141, 46, 46, 46, 94, 90,222, 28,102,163,201,247, 38, 27, 30, 10, 21, 66, 43, 41, 41, 9,209,209,209, 40, 46, 46,134, 64, 32, 64,
+ 81, 81, 17,182,110,221,138, 59,119,238, 64, 32, 16,192,176, 47,172,213,111,109,219,182, 93,122,238,220,185, 59,131, 7, 15, 86,
+ 36, 38, 38, 66,161, 80, 32, 49, 49, 17,239,190,251,174,242,194,133, 11,201, 10,133, 34, 18,214, 12, 29, 26, 50,190,235,167,215,
+ 81,169, 84,184,126,253,186,217,143,165,109, 76,145,156,156, 28, 64, 81, 84, 35,134, 97, 58, 50, 12,227, 4,125, 10, 7,253,127,
+227,207,123,250,117, 78, 12,195,116,164, 40, 42, 56, 57, 57, 57,128,149, 19, 44, 94, 81,156, 49, 18, 91,140,145,200, 58, 83,189,
+ 69,139, 38,163,182,172, 89,224,244,203, 21, 18,143,211,147,113,237,200,186, 18,138,214,190, 99,227,116, 56,221, 96,148,107, 67,
+ 36,182,111, 70, 19,229,225,204,210,194,199, 0,195,169,141,208,170,196, 9,154,140,218,186,102,190,243,206,107, 4,178, 31, 63,
+194,133,131,107, 75,116, 58, 85, 87,164,196, 94,175, 13,231, 80, 62,127, 14,143, 67,204,238,209,254,127,252, 14,255,107, 8,251,
+252, 52,228,102,102, 99,119, 82,193,211,228, 34,213,168, 11,132, 6,233,143, 84, 91,122,125,230,230,230,234,195, 67,159,207,221,
+221, 46, 29,146, 30, 32,120, 50, 13,163, 97,150,228, 92,168,152,150,162,114, 59,171,194,199,209,209,113,240,181,107,215,156, 68,
+ 34,145,248,218,181,107,244,198,141, 27,159, 40, 20,138, 35, 0,226,173,234,123, 85,248,181,105, 24,116,230,219,181,155, 69,101,
+ 50, 57,100,106, 13,132,222, 18,106,127,252,173,254,176,156, 0,179, 18,167, 80, 40,220,185,115,231,206, 94,157, 58,117, 10,104,
+214,172, 25,249,244,233, 83,148,149,149, 85, 56, 87,123,122,122, 34, 41, 41,137, 78, 77, 77,205, 22, 10,133,187,172,109,231,219,
+111,191,157, 74,146,228, 61,253, 48,218, 61,152, 68, 23, 26, 21,109,148,147,147,211, 70, 34,145,156, 1, 96,103, 20,117,104,204,
+105, 72,239, 48, 19, 0, 73, 16,196,213,196,196,196,178,158, 61,123, 66, 44, 22, 67, 38,147,193,223,223, 31, 58,157, 14, 71,142,
+ 28, 65, 66, 66,130,140,166,233, 51,102,196,107,165,118, 42,149, 10,127, 0,164, 66, 46,127, 99,248,240,225, 97,147, 39, 79,174,
+ 20,146,238,229,229, 5, 55, 55, 55,155, 56, 1,224,233,211,167, 77,126,255,253,247,137,137,137,137, 95,247,234,213,203,121,230,
+204,153,194,250,245,235,131,162, 40,178,182,156, 69, 69, 69,206,215,175, 95,255,190, 67,135, 14, 95,246,236,217,147,251,237,183,
+223,194,217,217, 25, 20, 69, 65, 44, 22, 67, 42,149, 34, 50, 50, 18,231,207,159,215, 49, 12,179,182,164,164,100,138,141,231, 18,
+158,245,218,180,100, 1,178,148,146,193, 66,249,127,188,157, 38, 62, 93,208,167,112,152,110, 33,131, 61,172, 61,231, 13, 66,139,
+195,225, 32, 45, 45, 13, 27, 55,110,172,146, 71,203,144,254,193, 2,183,185,190, 51,167, 79,159,166, 8,130,120,235,218,181,107,
+211, 63,254,248,227, 81, 50,153,204,207,222,222, 62, 91,171,213,254,172, 80, 40, 22,163,220, 31,149,111,203, 61, 68, 38,147,165,
+155,139, 58, 52, 45, 3,184, 84,203,105,146,222,161, 82, 10, 7,147,109, 42,165,126, 48,147,222,225, 31, 63,238, 44,231,191,146,
+243, 85, 23, 91,150, 19,150, 86, 65,203,209, 60,158, 66,219,252, 92, 50,241, 44, 34,171,170,181, 68, 41, 79,158,187, 51,227,127,
+106,149, 18,178,146,188,251, 72,219,157,255, 76,221,210,183,243,108, 50,129,180,212, 71,184, 18,183,182,188,157, 41,177,181,110,
+ 39, 1,124,179,254,104, 44,159,112,118,195,141,137,159, 32,187, 88,134,163, 41, 69,123, 24,185,234,139, 95,128, 34,156, 7, 72,
+157,234,220,214, 89,185,235, 58,126,228, 60,192,195,151,135, 21, 83,127,134,104,134, 59,255,205,174,157,108,153, 3, 49, 87, 36,
+ 18,157, 91,189,122,117,183,142, 29, 59, 10, 35, 34, 34,204, 57,200,219,138,204,171, 15, 30,173, 63,188,225,135,169,238,205,219,
+225,199, 57,211,168,157,241,183, 76,163, 16,171, 69, 72, 72, 8,117,241,226,197,201, 99,198,140, 89,209,173, 91,183, 58,239,191,
+255,190,192,223,223, 31, 66,161, 16,143, 30, 61,194,185,115,231,212, 41, 41, 41,217,114,185,124,114,139, 22, 45,108,201,113, 86,
+ 52,119,238,220,165,250, 58, 8,253,112, 97,107,232,163, 11, 13,133,244, 73, 75, 91, 3,176,155, 63,127,254,199, 0, 96, 33,236,
+123, 46,128, 13, 0,184, 12,195,228,198,196,196,188,117,240,224,193,183, 38, 77,154,196,239,213,171, 23, 46, 93,186,132,227,199,
+143,107, 52, 26, 77,188, 94,184, 90, 59, 85, 14, 13,224,186, 78,167,187,181,108,217,178,183, 56, 28,206, 92,195,138, 59,119,238,
+ 96,219,182,109,181,225,212, 1,248, 62, 47, 47,111,125, 76, 76,204,220, 19, 39, 78,140, 28, 62,124,184,147, 86,171, 69, 82, 82,
+ 18,126,250,233,167, 90,113,150,148,148, 76,244,240,240,152,125,228,200,145,159,143, 29, 59,214,111,216,176, 97,228,248,241,227,
+ 17, 21, 21,133, 95,127,253,149,166, 40,234, 32,143,199, 27, 94, 88, 88, 40,123, 25,119, 29,253, 48, 92,182,141,115, 29,214,200,
+251, 44, 67,131, 86, 34,231, 89, 9, 12,253,232,220,185,115,133,149,209, 96,133, 51, 46, 67, 16,132,205, 67,135, 0, 92, 24,134,
+161, 1,172, 69,249,252,162,198, 89,225, 57,248, 59,115,188,181,140, 77,115, 84, 46,119,160, 66, 82,245,147, 74,187, 0, 12,154,
+214,192, 86, 60,119,238,220,149,243,230,205, 91,105,154,194,193,184,144,105,234,135, 5, 11, 22,128, 77,239,192,226,117,133,121,
+161,117,125,147, 86, 27,216,127,230,234,111,167,205,211,105,213, 37, 12, 52,225,120,180, 47,241, 89, 43, 99,104,102,198,201, 29,
+243,163,192,160,136,161,116,211,159,185,245,255, 80, 59, 9,103, 55,148, 70,142,197,175,183,179,153, 92,153,246,195, 95, 52,154,
+ 74,214,160,114,159, 44,122,224, 41,101,209,110,215, 58,188,253, 19,223,113, 39, 14, 63,253,216,230,122,242,243,243,127, 91,185,
+114, 37,249,195, 15, 63,132,201,229,114, 83, 7,249,218, 98, 90,223,113, 51, 56,111, 6, 7,140,187,242, 48,253, 3, 88, 49, 92,
+104,138,183,223,126, 59,231,238,221,187, 67,142, 29, 59, 54,248,236,217,179,221,100, 50, 89, 0, 65, 16,176,179,179, 75, 87,169,
+ 84, 39,132, 66,225, 78, 27, 69, 22, 0, 96,222,188,121,204,130, 5, 11,136,187,119,239, 50, 28, 14,231, 79, 0,169, 28, 14, 39,
+205,216, 9,222,120,185, 97,155,249,243,231, 91,243, 64, 60, 91, 86, 86,150, 16, 25, 25,217, 41, 50, 50,242, 13,189, 85,232, 44,
+254,246,249,178, 21, 90, 0,103,249,124, 65, 54, 65, 16,126,124,129, 80,118,241,226,197, 19,207,200, 41,215,104, 52,211, 31, 63,
+126,188, 98,197,138, 21,139,237,237,237,219,220,185,115,231,207,103,225,212,139,168,254,110,110,110,117,162,163,163,247,110,221,
+186,181, 29,151,203,189, 68, 16, 68, 68, 73, 73,201, 75,157, 84, 90, 63, 65,244, 2, 27,230, 58,180,138,247,121, 39, 41,253, 39,
+132, 27, 69, 81,101,179,103,207,206, 55, 21, 94,166,214, 43,195,127,125, 42, 23,107,246,169, 45, 81,148, 53, 8, 23,162, 12, 0,
+202,231, 46, 44,159, 86,199,218, 73,165, 1, 40,106,186,206, 73,146, 60, 8,224, 62, 73,146, 15, 77, 3, 93,140,215, 45, 88,176,
+160,166,235,156, 5,139, 87, 26, 86,220,217,230,147,192,252,218,122,210,190, 64,115,229,243,105,231, 16, 62,127, 1, 9, 76, 5,
+ 64, 48,192,138, 95, 52,154, 89,213,109,232,243, 54, 22, 51, 4, 38,233,119,230,183,185, 23,176,168, 22,125,247,133, 21,243, 15,
+218,200,217, 24,213, 79, 40, 91,133, 51, 60, 60,156, 99,225, 97, 94,105, 82,105, 75,136,141,173,200,226,111,169,157,198,231,155,
+227,229,203,151,235,180,109,219, 54, 7,149,157,254,205, 45,103,108,236, 59, 7, 0,245,156,247,231, 43,193, 25, 20, 20, 36,120,
+244,232,145,250,223,117,109,178,156,255, 74, 78,151, 38,117, 65,224, 51, 24,231, 14,170,214,162,101, 36,208, 24,230, 39, 20, 39,
+ 61,182,208, 78,195,117,238,146,156,156, 28,208,160, 65,131,116, 0,197, 38,237, 48,183,142, 97,143,209,127,158,211, 28, 70,163,
+242, 84,116, 44,204, 28, 8,150,147,229,100, 57, 89, 78,150,147,229,100, 57, 89,206,218, 10,173, 87, 26, 36, 88,176, 96,193,130,
+ 5, 11, 22, 44, 88,252, 35, 32,170, 81,165,182,152, 4,107,163,108, 79,176,156, 44, 39,203,201,114,178,156, 44, 39,203,249,159,
+227,172,137,219,120,251, 87,117,232,240,133,181,155, 53,171,178,156, 44, 39,203,201,114,178,156, 44, 39,203,249, 44,130,229,149,
+ 6, 23, 44, 88,176, 96,193,130, 5,139, 87, 6,221, 26, 66,194,165, 64,254,254,200,170, 32,170, 26,209, 51, 8,190, 0,240,188,
+248,254,163,144, 0,232,109,244,255, 48,244,145,241,172,208,122,117, 17, 12, 96, 38, 0,227,185,200,174, 0, 88, 98, 82,110, 7,
+ 0,227, 9, 9,101, 40,159, 39,240,161, 45,149,145, 36,185,164, 83,167, 78, 95,156, 63,127,254, 7,157, 78, 23, 89,139,246, 6,
+ 72, 36,146,165, 4, 65,180, 2,192, 35, 8,226, 81, 94, 94,222, 18,157, 78,247, 44, 81, 43,129, 62, 62, 62,223, 1,248, 31, 73,
+146, 60,130, 32,146,243,242,242, 22,233,116,186,211,207,192,233,232,237,237,221,158, 97, 24, 31, 0, 28, 30,143,247, 36, 43, 43,
+235, 50,106,153, 91, 41,124,126, 18, 95, 42,211,241, 0,192,201,158,171,141,157,223, 68, 99,237, 50,246, 20,103,193,226,191, 13,
+166, 60, 50,185, 18,222, 13,194, 98, 70,135, 41, 20, 64,244,168,143, 53,127,164, 98,138,165,237, 9, 51, 81,205,166,156,239, 6,
+ 97, 49,197,148,115,244, 8,194,247,127, 60, 66,181,145,246,214,112, 26,176, 9, 32, 71, 91, 49, 75, 1, 97, 93,244,245,191, 29,
+189, 81,121,168,176, 98,232,176, 90,161, 53,176, 33, 36, 20, 23,220,216, 36, 24,194,120, 29, 1,188,161,127,200, 63, 68,121,174,
+162,210,103,108,220,171,194,249,111,195, 92,134, 97,134, 84, 58, 89,205,228, 33,122,231,157,119,222, 63,118,236,152,157, 97,190,
+ 59,154,166, 33, 22,139,117, 0, 70,216, 80,151,215,192,129, 3,103,108,217,178, 5, 3, 6, 12,152, 29, 23, 23,183, 18, 64,153,
+181, 27,187,186,186,134,187,184,184, 68,109,222,188,217,179, 93,187,183, 8,129, 64,128, 71,143,146,253,198,140, 25,211,236,238,
+221,187, 7,243,243,243, 71,217,218,121, 55, 55,183,161, 46, 46, 46, 43, 54,110,220,232,209,161, 67, 7, 16, 4,129,132,132, 4,
+191,137, 19, 39,190,145,145,145,177, 43, 47, 47,239, 75, 91, 57,221,221,221, 27, 58, 59, 59,119,249,241,199, 31,197,237,219,183,
+135, 72, 36, 66, 98, 98,162,195,231,159,127,238,147,149,149,149,148,151,151,119,198, 86,145,117, 51,225, 80, 63,157, 70,181, 12,
+ 0,184,124,225,180,118, 43,226, 15,221, 60,117,168,111, 77,203,194,231, 39, 29, 96,197, 22, 11, 22, 44,140, 49,180, 14,124, 24,
+ 6, 83,143,253, 52,135, 4,128, 30, 35, 23,142, 31, 90, 7, 63,252,146,109,121, 14, 91, 27,249,166, 12,247, 69, 84,116, 22,242,
+158,165,157,155, 0,114, 34,151, 59,254,205,182,109, 61,190,186,112, 33, 89, 3,252,252, 31, 57, 68,102,135, 57, 45, 10,173,254,
+ 77, 16,169, 43,183,152, 16, 61, 27, 96,215,241, 84,206,185,119,222,121,167,193,167,159,126, 74,180,108,217, 18, 9, 9, 9, 13,
+119,237,218,213,251,240,225,195,201, 20, 69, 37, 0,184, 13,235,179, 90,243, 0,132,114, 56,156, 86,255,114,206,127, 51,236,245,
+226, 42, 15,127, 39, 58,173,146,240,244,228,201,147,191,113,185, 92,131, 69,235, 77,153, 76,230,109, 98, 5,179, 6,245,180, 90,
+ 45,238,221,187, 7,146, 36,121, 0,234,163,234,148, 26,150,224,103,103,103,183, 46,254, 74,130, 59,193, 21,163, 72, 9, 64,169,
+129,192,193, 27, 91,182,197,184, 77,158,240,101,255,211,167, 79,159, 43, 45, 45,221,110, 67,123,234,219,219,219,175,188,113,227,
+134,187,157,157, 29,104,154, 70,105,105, 41,124,124,124,176,121,243,102,151,201,147, 39, 15,145, 74,165,167,149, 74,229,175,182,
+136,115,103,103,231, 46,183,110,221, 18, 27, 38,148, 86,171,213,240,243,243,195,142, 29, 59,132,227,199,143,111, 82, 92, 92,156,
+169, 86,171, 83,172, 37,148,202,116, 60,157, 70,181, 44,122,237,252,186, 0, 48,252,203,249,203, 4,165, 78, 71,172, 89, 38,149,
+233, 14, 3, 96,133, 22,139, 23,141, 86, 30, 30, 30,177,133,133,133,103, 0,140,194,243,177, 52, 52, 20,137, 68, 45,104,154,246,
+ 33, 73, 18, 28, 14, 39, 87, 38,147,221, 0,240,160,182,132,238, 65,157,251, 66,104,247, 9, 24,250, 13, 18, 0, 65,146,137,148,
+ 70,190,237,201,131,211,135,158,137, 83, 32, 30, 9, 48,111,144, 0, 77,144,228, 13, 90, 39,223, 92,120,239,244,209,127,203,193,
+185, 84,130, 70, 65, 62,214, 79,140,249, 60,248, 6, 5, 66, 66,210, 32,119,164, 89, 63,172, 56, 14,232, 53, 97,194, 4,159, 47,
+191,248,130,248,100,196,136,224, 51,231,207, 19, 97,182,204, 86,240,106,194,162,227,187, 89,161, 21,222, 4,174, 12, 48,125, 87,
+212, 76,146,203,225, 16,131, 39, 44, 25,178,117,237,247,100,247,190, 17, 21,195, 39, 29, 59,118, 68,199,142, 29,137,101,203,150,
+ 5,255,249,231,159,193, 59,118,236,208,197,199,199,223, 0,176,219, 82,101,239, 6, 65, 65, 3, 34, 62,143, 43, 27, 60,103,251,
+198,182,109,219,254,159,189,243, 14,139,226,106,219,248, 61,219,251, 46, 11, 11, 75, 71, 84, 58, 54,136, 98, 87, 44,216, 80, 44,
+137, 93, 99,124,237, 45,209, 68, 99, 98, 52, 38,182,216, 98, 84,140, 26,107,236,250, 26,123, 47,177, 87, 80, 64,197, 74,103, 89,
+154,244,178,253,124,127, 0,126, 72, 40, 11,152,215,148,249, 93,215, 92, 11,103,103,238, 61,211,206,220,243,156, 6, 30,143,135,
+250,104, 2, 64,247,198,140, 24,182,101,195,136, 97,211,230,199,183,110,221,150,188, 11,205,191, 17,119,129, 55,147, 90,203,157,
+156,156,218, 25, 12, 6, 62, 0,176, 88,172,226,196,196,196,105, 40,153, 27, 16, 0,142,154, 76,166,126,181,208,102, 0, 88,208,
+175, 95,191,121, 83,167, 78,133,179,179, 51,166, 79,159, 14,189, 94, 31,118,250,244,233,249, 0,150,161,134,155,199,198,198,102,
+254,134, 13, 27, 44, 89, 92, 17,252,230,196, 34, 37,219, 0, 0, 16,243,128, 99,147, 8,166, 79,159, 46,189,127,255,254,162,218,
+ 24, 45, 27, 27,155,239,126,249,229, 23, 75,161, 80, 8, 66,200,155,185, 24,243,243,243,145,159,159,143, 41, 83,166, 72,159, 60,
+121,242, 67,109,140,150, 82,169,108,183,126,253,122, 1,159,207, 71,126,126, 62, 71,167,211, 81,121,121,121, 40, 44, 44, 36, 90,
+173, 86, 55,109,218, 52,222,163, 71,143, 58,167,164,164,196,128,230,175, 2, 19,192, 0, 54,155, 61,176,113,227,198, 31,188,120,
+241,226,129,193, 96, 56, 12,224,240, 59,120,153,234,106,111,111,191, 88,165, 82,173, 7,176,235,223,114, 64,149, 74,229,225,155,
+ 55,111, 58,109,216,176,225,227, 85,171, 86,157, 2,240,223,122,200,113, 56, 28,206,160, 78,157, 58, 57,141, 30, 61,154,171, 84,
+ 42,161,209,104, 16, 27, 27, 43, 61,112,224,128,203,195,135, 15,147, 74,103,196, 48,251,133,194,202,189,173, 24, 44,233,190, 54,
+109,219,181, 31, 60,104,128, 68,105, 37, 67,145,214,136, 23,241, 41,206,103, 78, 29,235, 20,205, 17,220,212,233,114,134,102, 62,
+191,153, 95, 91,205,192,192,174,237,187,117,237, 42,145, 89,200,144, 83,160,195,171,184,100,151,203,231,143,119, 96,177, 4, 87,
+ 77,148,126,100, 90,212,249,194,247,121,110,166, 3,172, 2,190, 85,179,230,109,253,238, 7,141, 93,244, 1, 33, 4, 12,130,181,
+ 21,163, 89,211, 1,214,218,146,105,191,106,165, 7, 66, 8, 69, 97,101,249,104, 86,143, 70, 88, 76, 8, 62, 7, 3, 84,143, 26,
+170, 41,203, 8, 2,120, 22,150,150, 1, 19,199,143,167,242,114,115,241,240,225,195,194,138, 38,235, 71, 7,112,174, 50,208,224,
+104, 98,221,205,246, 95, 52,154, 85,105,213,161,217,227,104, 9,133,194, 74,211,101, 50, 25, 2, 3, 3,177,116,233, 82, 22, 0,
+255, 10, 95,191, 61,201, 42,192, 59,177,113, 46,100, 34, 30,195,217,217, 89, 34,149, 74,235,173, 9, 0, 32, 38,215,182,206,164,
+215,189, 95,191,250,248,194,158,213,190, 5,121,217,236,138,171,136,197, 98,120,120,120, 96,222,188,121,230,105,214,159,255,169,
+166,173,173,173,103,135, 14, 29,252, 47, 93,185, 98,161, 82,169,120, 42,149,138,119,238,210, 37,139, 54,109,218,248,219,218,218,
+122,190, 57, 84,132,212, 38,159,223,135,134,134,206, 63,122,244, 40,163, 67,135, 14,144,203,229, 8, 12, 12,196,169, 83,167, 88,
+171, 86,173, 90, 2, 96, 94, 77,249,100, 48, 24,237, 59,116,232, 64,129, 16,168,115, 12,184,179,212, 19, 15, 87,122, 33,175,152,
+224,117, 78, 46,138,138,138, 33, 20, 10,249, 40,169,238, 53,119,223,219,182,105,211,134, 2,240,198, 92,229,229,149, 44,249,249,
+ 5,208,106,117,224,241,120, 18, 0,124,115, 53, 9, 33,182,237,218,181, 3, 0,232,116,186, 55,111,120,217,217,217, 84, 78, 78,
+ 14,180, 90, 45,216,108, 54, 7, 53,183,107,124,163, 41, 21,177,244, 44, 14,111,246,232, 41,223, 38,142,158,242,109, 34,139,195,
+155,173,149,228, 26,205, 73,147,138, 88,250,247,124,125, 90, 51, 24,140,109,141, 26, 53,122,194, 96, 48,118, 2,176,173,167,102,
+ 75, 0, 75, 4, 2,193, 5, 47, 47,175, 68,161, 80,120,169,212,168,183,169,163, 38, 87, 40, 20, 94, 90,178,100,201,193, 7, 15,
+ 30, 12,190,120,241,162,107,100,100,228,160,229,203,151,239, 19,139,197,215,240,118,187,196, 90,223,155,174,174,174, 91,239,220,
+185,211,178,109,219,182, 91, 0,240,222,209,253,206, 4,208, 2,102,205,200,241, 94,206,187,189,159,159,159, 19,159,207, 71,183,
+110,221, 0,160,115,125, 52, 57, 28,206,160,121,243,230, 53,250,230,155,111,184, 41, 41, 41,184,116,233, 18,238,222,189, 11,131,
+193,128, 73,147, 38,241, 70,143, 30,221, 80, 34,145, 12,170, 85, 62, 89,210,125, 51, 62,253,172,231, 23,211,199, 73, 34, 18,116,
+216,126, 33, 1, 71,110,165, 32,173,144,139,190,131, 70,203,122,132, 12,233,193,229,201,246,213, 86,243,203, 57,115,122,142,255,
+100,184,228,113,138, 9,199,110,171,113,251,105, 14, 12,108, 11,244, 30,244, 31,121,243,118, 61,251,176,192,222,241,190,207,209,
+ 47, 64,235, 25, 51,102, 88,207, 94,185,251,134,125,203, 1,107,211,179,208,161,188,241,113, 7, 44, 44, 69,162, 1, 79, 59,117,
+ 26, 39, 40,153, 47,182, 90,205,183,244,252, 67,214,165,101,161, 99,249,246, 89, 29, 45,225, 86, 90,173,200, 60,183,237, 27, 6,
+161, 48,125,132,253, 91,229, 64,165,249,252, 29, 24, 60,227,179,207,216, 50,185, 28,161,161,161,208, 20, 20,188,213,102,182,171,
+ 19,122, 94, 16,178,146, 26,122, 57, 62, 9,116,161,174,253, 3,223, 87,198, 87, 25,209, 58,113,226, 4, 9, 14, 14,166, 0,224,
+208, 19,100, 13,242,198, 15, 67,166, 46,153, 71, 49, 40,210,192,183,237, 99,135, 70, 62, 5, 86, 86, 86, 40, 44, 44,132, 70,163,
+ 1,135,195, 65,113,113, 49, 18, 18, 18,112,251,246,109,200,229,242, 90,229, 36, 55, 55, 23, 98,177, 24, 98,177,248,157,104,206,
+253,184, 27,239, 85, 98, 58,239,236,237,223, 59,253, 52,249,191,173, 27,181,232, 28,217,117,200,244, 40,169,181,125,113,100,100,
+ 36,110,222,188,137,172,172, 44, 4, 4, 4,252, 83, 78,230,221,210, 54, 89,119, 1,200, 27, 55,110,236,120,246,194, 85,121,126,
+177, 73, 26,151,170,103,155, 76, 38, 8,133,118,134,253,135,142,229, 12, 30,212,151, 82,171,213,105, 0,238,150,154,219,154,230,
+ 84,228, 3,240,252,240,195, 15,191,156, 60,121, 50, 94,190,124,137,113,227,198, 21,221,189,123, 55,179,109,219,182, 86,191,252,
+242,139, 96,230,204,153,184,114,229,202,130, 19, 39, 78,252, 6, 32, 22, 64,165,115,181, 17, 66, 56, 28, 14, 7,134, 82,219,160,
+ 51,154,222,248,251,220,220, 92,144,162, 44,112, 56, 28, 38, 0,107,152,217,142,206,100, 50,113,216,108,246, 27,147,149,144,154,
+139,132,180, 66,228,230,107, 81, 84,100,128,182,136,128, 41,180, 98, 1,113, 74, 0,113,230, 70, 71,248,124, 62, 12, 6, 3,242,
+242, 74,178, 81, 22, 41,211,106,181,200,201,201, 1,147,201, 20, 3,144, 2,120,109,142, 96,105, 35,247, 35,165,213,128,184,183,
+187,159,226,197,201,185,111,165, 73, 69, 44,253,161,153,222, 76, 43,199,230,215, 91, 12,222,225,245, 38,237,253,182,207,226, 89,
+ 91, 91, 95, 62,120,240,160,183,155,155, 27, 98, 99, 99,189, 62,250,232,163,128,148,148,148, 22,168,253,156,140, 66, 6,131,241,
+195,232,209,163, 39, 15, 27, 54,140,114,119,119, 7,139,197,130,193, 96,112,124,249,242,101,224,129, 3, 7,230,108,221,186,245,
+ 23,163,209, 56, 11,230,183,251, 99,112,185,220,253,155, 54,109,234, 24, 16, 16,128,157, 59,119,226,238,221,187,166,150, 45, 91,
+ 50, 70,141, 26, 5, 23, 23,151,128, 81,163, 70, 29,209,104, 52,189,235, 24,217,114,105,211,166,141, 19,147,201, 68,219,182,109,
+ 57, 55,111,222,244, 3,112,179,158,199, 84,236,232,232,120,165,115,231,206, 45, 46, 92,184, 16,174, 86,171, 59,215, 98,127, 1,
+ 32,196,222,222,126,185, 76, 38,147,215,162,140, 45, 76, 78, 78,254, 28,192, 33, 51, 55,105,237,239,239,143,248,248,120,120,122,
+122,130,195,225,180,209,233,116, 19, 0,244, 4,240, 53,128, 39,181,200,175,123,215,174, 93,157, 58,119,238, 76, 29, 58,116,232,
+ 77,251, 80, 6,131, 1,131,193, 0, 14,135,131,214,173, 91, 51,194,194,194, 28,238,221,187,231, 14, 51,170, 17,173, 26,117,238,
+219,182,125,167,246, 29, 3,154, 49, 86, 29,122, 1,163,201, 8, 38,101, 0,139, 50,193,164,231,129,199, 97,194,221,247, 3,230,
+211, 71, 17, 1, 90,141,174,111,230,243, 11,199,205,209,236, 25,212,189,131,183,167, 59,227,167, 35,175,144,157,252,196,152, 28,
+125, 53,131,193,100,192,219,191,139,194,221,167, 5,179, 69, 64,103,182, 42,246, 81, 96,113,113,199,110, 89, 47,175, 94,120, 31,
+ 55,228, 66,128,233,232,160, 24, 16,220,189, 51, 39, 69,165, 42, 56,112,232,120, 84,161, 30,183, 1,224, 10, 64,245, 6,154, 53,
+109,213,170,211, 47,203,150, 89,217,217,217,177, 71, 14, 27,102,216, 28, 30, 30,142, 42,170,126, 23, 2, 76,133,173,109,183,137,
+ 19, 39, 50, 83, 84, 42,114,224,240,201,200, 50, 61,148,188,165, 52,109,230,232, 21,140,130,167,181,170,166,236, 11,112,149,182,
+182,222, 19, 38, 76,128, 90,165,194,206, 93,187,242,139,129, 91,101, 81,172, 99, 76,172,247,105,100, 59,102,246,127,250, 81, 78,
+118, 10, 76, 92,176,185, 77,160, 46,173, 17, 82,254,255,252,151,247, 34,127, 99,147, 53,190, 82,163, 85,145,255, 62,193,124, 9,
+ 7,174, 7, 14,236,101,164,231,233, 10, 94,190,124, 9,133, 66, 1, 59, 59, 59,200,100, 50, 60,126,252, 24,151, 46, 93,194,179,
+103,207, 96, 50,153,208,188,121,243, 90,229, 38, 35, 35, 3, 17, 17, 17,144,203,229,239, 76,179,145,147, 53,166, 58, 89,115, 82,
+ 51,115, 57, 23,238, 62, 11,216, 60,119,144, 15,195,107,208,214,242,147,196,106,181, 90,252, 67,120,211,187,208,201,201,169,221,
+246,237,219, 57, 26, 3, 36,238, 19,110,173, 40, 40, 54,138, 0, 64,196,103, 22,132, 45,247,152,245,253,247,223, 23,124,242,201,
+ 39, 94,137,137,137, 75,205,136,245, 47,238,218,181,235, 23,132, 16,246,140, 25, 51, 0, 0,163, 71,143,206,189,125,251,182, 59,
+128,180, 75,151, 46,217,143, 29, 59,246,249,229,203,151,133,159,125,246, 25,211, 96, 48, 60,102,177, 88,228,196,137, 19,223, 1,
+248,246, 15, 79, 68, 6,227,126,120,120,120, 3,123, 23, 15,184, 88, 49,208, 97,222,179,146, 2, 78,104, 66, 82,220, 43, 68, 71,
+222,133,173,173,173,204,206,206,238, 73, 82, 82,146, 46, 57, 57,121, 78, 65, 65,193,134, 26,242,248, 48, 44, 44,204,206,197,197,
+ 5,249,249,249, 72, 74, 47,196,244,195, 66,228, 22,149, 4, 49,216, 40, 66, 11, 39, 15,137,128,161,189,155,150,150,166,211,106,
+181,223,228,228,228,108,175, 78,147,205,102,103, 70, 70, 70,138,157,157,157, 81, 92, 92, 76, 94,191,126, 77, 21, 20, 20, 32, 47,
+ 47,143, 58,121,242,100,255,148,148,148,150,174,174,174,148,163,163,227,119, 41, 41, 41, 69,201,201,201,227,204,169,154, 44, 53,
+ 76, 70, 22,139,181,106,252,248,241,131,127,251,237,183,251,135,190,245, 14, 41, 87, 93, 34,243,245,245, 61,219,172,153,143,253,
+174,149, 77,215, 2, 88,241, 23,184,182,198,124,245,213, 87,222,150,150,150,152, 56,113, 34, 22, 46, 92,136,249,243,231,187, 77,
+156, 56,113, 60,128, 31,107,161, 35,176,181,181,189,247,211, 79, 63,121,181,107,215, 14,167, 78,157,194,222,189,123, 17, 19, 19,
+ 99,112,117,117,101, 5, 4, 4, 96,193,130, 5,232,209,163,199,184,105,211,166,117, 82,169, 84,126,102,154,143, 79, 22, 44, 88,
+ 16,210,190,125,123,124,252,241,199,154,223,127,255,125, 48,128,115,231,207,159,239,114,229,202,149, 67,187,119,239, 22, 44, 89,
+178,164,219,204,153, 51, 39, 2, 88, 87,135,253,239,223,177, 99,201, 28,202,237,219,183,199,242,229,203,123,212,211,104,113,173,
+172,172, 78,238,220,185,179,133,135,135, 7, 70,142, 28,233, 55,120,240,224,147, 89, 89, 89,221, 1,152, 85, 32, 57, 56, 56,252,
+112,244,232,209,198, 85,213, 44, 84,134, 70,163,177, 28, 48, 96,192,178,184,184,184, 90, 25,173, 61,123,246,224,243,207, 63, 71,
+243,230,205,155,181,110,221,122,227,132, 9, 19,240,225,135, 31,118,125,252,248,177, 18, 37,189,150,107,132,207,231, 55, 27, 58,
+116, 40,247,206,157, 59, 0, 0, 95, 95, 95,180,104,209, 2,155,104,178,222, 0, 0, 32, 0, 73, 68, 65, 84,241,241,241,184,127,
+255, 62, 52, 26, 13,148, 74, 37, 6, 14, 28,200,143,139,139,107,150,145,145, 81,163,209, 98,240,132, 99, 66,130,123, 75,142,221,
+ 78,129,209,100,192, 7,141,165, 8,240,178,193,211,164, 92,132, 61, 73,130, 81,203,129,212,210, 10,109, 58, 5, 89,170,147, 99,
+198,100, 2, 53,183,215,226, 9,199, 12, 12,233, 35, 62,118, 75,133,108, 85, 52,121,113,247,183, 75,250,226,130,113, 0,112,255,
+226,190,141,182, 86,130,238,238,254, 31, 48, 59,119,239, 39, 63,188, 87, 61, 38,235,127, 51,183,223, 31,184,226,132, 77, 46,236,
+140,209,179,135,119, 32,108,185,227, 93,137, 94,191,190,236,187, 30, 64,208,156,175,190,106,253,159,241,227,249, 38,147, 9,187,
+127,253, 53, 55, 34, 60,252,233,120,192, 52,161, 10,189,245,128,203,224,144, 16,158, 68, 42,197,167,211,167, 67,162,215, 95,126,
+115, 72,128,174,159,126,241, 69,187, 41, 83,166, 8, 54,126, 55,249,126,143,177,139,252, 77,132, 80,101,213,148,123,170, 15,197,
+181, 28, 27, 18, 2,137, 84,138, 25, 51,102,128,210,233,206,190, 49, 80, 44, 92,254,164,127,135,128,225,125,219,131, 2,133,189,
+ 39,174,227, 69,124,122,228,229, 20,188,250,187,186,170, 10, 84,217, 70,171,218,170,195, 60, 29, 82,187,246, 25,148,226,238,238,
+158,231,230,230,150,151,153,153,137,168,168, 40,100,101,101, 97,221,186,117,136,142,142,134,201,100,170,179,129, 49,153, 76,120,
+215,154, 0,160,180,146, 98,100,239, 86, 44, 77,113, 1, 63, 61, 61,253,173,234,163,127,144,209,122,131,193, 96,224,187,186,186,
+130, 1, 80, 57,133,122,177,122, 79, 71, 74,189,167, 35,149, 83,168, 23,107,181, 90,134, 88, 44,134, 70,163,225,155, 33,197,238,
+213,171,215, 23,191,253,246, 27,123,241,226,197,104,210,164, 9,116, 58, 29,110,223,190,157, 4, 32,173,116, 29,213,213,171, 87,
+ 85,101, 70,120,233,210,165, 56,124,248, 48,213,173, 91,183, 57,149, 93, 79, 41, 41, 41, 63, 76,152, 48,225,117, 97,222,107,108,
+ 26, 82,132, 67, 35,211,177, 45, 36, 6,195,172, 14,226,117,106, 2, 54,111,222,140,243,231, 47, 80,231,206,157,231,252,254,251,
+239,162, 62,125,250,172,117,112,112, 56, 81, 93, 38, 85, 42,213,226, 41, 83,166,100,231,229,229, 33, 47, 47, 15, 69, 69,197,120,
+ 93, 0, 68,174,246, 70,228,106,111, 20,155, 4, 8, 93,191,129, 17, 25, 25,169,136,137,137,177,239,219,183,239,106, 59, 59,187,
+173,213,105, 38, 39, 39,223,153, 58,117,106,113,110,110, 46,180, 90,173,206,104, 52,106,139,138,138,244,251,246,237,251,204,202,
+202,170,205,169, 83,167,216,231,207, 95, 96,253,254,251, 21,206,165, 75,151,100,129,129,129,251,149, 74,229, 14,115, 34,101, 76,
+ 38,115,205,174, 93,187,198,132,134,134, 42, 3, 2, 2,124, 42, 84, 69,217,117,239,222,189,193,175,191,254,234,176,124,249,242,
+ 57, 40,233,128,242, 94, 81, 40, 20,211, 66, 66, 66, 16, 26, 26,138,227,199,143,207, 92,187,118, 45,122,245,234, 5,123,123,251,
+169, 48,191,218, 11, 0, 86,252,248,227,143, 94, 94, 94, 94, 24, 61,122,180,118,220,184,113,179,182,111,223,238,122,237,218, 53,
+206,142, 29, 59, 26, 76,156, 56,113,198,240,225,195,139, 27, 54,108,136,117,235,214, 53,102, 48, 24,107,204,186,191,149,202,207,
+134, 13, 27,134,149, 43, 87,226,247,223,127, 31,132,146, 7,170, 22,192,233, 27, 55,110,244, 93,178,100, 9, 6, 13, 26, 4, 71,
+ 71,199, 25,117,137, 60,121,123,123,127,211,179,103, 79, 92,187,118, 13,126,126,126,104,211,166,205, 76, 0,138, 58, 30, 78,134,
+ 88, 44,222,191,125,251,246, 14, 13, 26, 52,192,162, 69,139,208,168, 81, 35,108,221,186,181,131, 72, 36,218, 15, 51,155,111,200,
+100, 50,177, 80, 40,196,156, 57,115,200,160, 65,131, 94,215,180,204,156, 57,147,240,120, 60,200,229,114,115, 59,190, 8,248,124,
+126,219, 38, 77,154,224,246,237,219, 56,127,254, 60,230,205,155,135,207, 62,251, 12,233,233,233, 24, 58,116,168, 16,192,135,181,
+216,111, 27,107,107,107,228,230,150,204, 11,223,164, 73, 19, 60,120,240, 0,233,233,233,112,116,116,132, 90,173,134,149,149, 21,
+ 60, 60, 60, 96, 50,153,108,204,147, 36, 77, 20,150, 50,164,101,105,192,130, 1,254,238, 10, 92,142,202, 68, 66,186, 22, 54, 86,
+ 22, 80,167,165,195,193,138, 15, 39, 39,103, 16, 98,106, 98,150, 3,102, 50,252,121,124, 1, 94,231,233,144,252,228,247, 76,157,
+ 81, 51, 33, 59,246, 70, 98,118,236,141, 68,157,166,120,194,253,235,231, 51, 27, 40, 5,112,114,114, 2, 69, 76,173,222,199,253,
+248,145, 51,156, 68, 2,214,232,243,219,190,161, 78,252, 50,151,210,100, 38,180,236,169, 44,137, 44, 91, 3,174, 31, 13, 29,218,
+118,214,172, 89,252,212,212, 84,211,240, 33, 67, 94, 47,254,246,219, 11,103,106,120, 49,200, 7,220,186,119,239, 14, 6,128, 51,
+231,206, 21,168,129, 36, 0, 80, 2, 78,253, 6, 12,232,248,213,151, 95, 10, 50, 50, 51, 77,183, 95,230, 31,139, 78, 35, 3, 45,
+141,112, 53,167,125,150, 17,104, 90,166,123,246,236, 89, 82, 4,220, 7,128,206, 78,152, 26,212,206, 55, 96, 84, 72, 71,164,164,
+101, 97,198,226,109,216,120,224,202, 89,153,158,116,249, 7, 61,138,199,215,201,104,149, 86,253,252, 33,173,176,240,143,181, 7,
+245, 53, 48,127,134,102,101,252, 19,141, 86, 25,122,125, 73, 45,137, 86,111,130, 86,111, 42,123,171, 69, 81, 81,145,217, 18,103,
+207,158,221, 57,125,250,116,172, 94,189, 26,207,159, 63, 7,135,195, 65,147, 38, 77,236, 0,136,203,202,124,127,127,127, 27, 6,
+131,129,167, 79,159, 98,213,170, 85,248,228,147, 79,200,205,155, 55,183,162,242,241, 82, 30,188,126,253,122,253,132,113,159,100,
+103,165, 38, 64, 95,148,133,180,228, 87,208, 20,100, 99,209,210, 31, 80,168,103, 65,157,163,131, 58, 71, 7, 6,207, 18, 27,127,
+217,206,244,246,246,238,201,100, 50,131,171,201,231,237,212,212,212, 95, 38, 77,154,148,173, 86,171,223,236,159, 86, 79,160,213,
+191,125,189, 10,133, 66,172, 89,179, 70,230,238,238, 30,194, 98,177, 2,171,209, 76, 73, 76, 76,140,158, 52,105,146, 54, 53, 53,
+ 21, 57, 57, 57, 56,118,236, 88,223, 6, 13, 26,200,151,173, 88, 77, 21,232, 88, 80,103,235,160,206,214,129, 43,182,193,254, 67,
+191, 49, 61, 60, 60,134,179, 88,172, 54, 53,153,172,221,187,119,143, 26, 50,100,136,100,197,138, 21,175,143, 30, 61, 26, 10,160,
+252, 9,121,186,102,205,154, 3,251,247,239,207,251,226,139, 47, 44,151, 47, 95, 62,243, 61,155,173,192, 33, 67,134,120,154, 76,
+ 38, 28, 60,120, 48, 18,192,143,191,253,246,219, 61,141, 70,131,161, 67,135,186,150, 86, 35,153, 67,203,225,195,135, 79,238,208,
+161, 3, 62,253,244, 83,221,133, 11, 23,252, 1,172, 70, 73, 85, 46, 1, 16, 15, 96,237,149, 43, 87,154, 79,155, 54, 77,211,170,
+ 85, 43,124,252,241,199,159, 0,232, 80,131,110,219, 97,195,134,121,153, 76, 38,236,219,183, 47, 2,192,169, 10,223, 95, 58,116,
+232,208,109,173, 86,139, 17, 35, 70, 52, 4, 80,155,130,156,195,227,241, 14,126,255,253,247, 22,201,201,201, 24, 53,106,148,230,
+233,211,167,248,246,219,111, 5, 50,153,236, 84,185,123,192,108,120, 60,222,230,159,127,254, 57,164,105,211,166,152, 52,105,146,
+118,195,134, 13,211, 39, 79,158,172,245,247,247, 71,104,104,104, 8,151,203,173,213, 20, 29, 42,149, 42,251,201,147, 39, 86, 53,
+ 45, 73, 73, 73,230,118,207, 23,138,197,226, 91,190,190,190,185, 77,154, 52,249,192, 96, 48,224,241,227,199,175,118,238,220,105,
+106,210,164, 9,214,175, 95,143,229,203,151, 35, 56, 56, 24, 76, 38,211,108,163,197,100, 50,161,211,233, 32, 20, 10,193, 98,177,
+240,234,213,171,178,161,101,192,225,112, 0, 0, 34,145, 8, 2,129, 0, 12, 6,195,172,222,104, 20, 5,146, 91,168, 7,155,205,
+ 0,139, 97, 66,116,124, 14,116,122, 19,248, 28, 38,216, 44, 10, 32, 38, 88,136,216,224,115,153, 96, 80,148,201, 76, 77,228, 20,
+232,192,229, 48,192,230,112, 41,134,193, 40,120,243,112,100, 25, 5, 2, 1,151, 82, 72,121,224,115,254, 66,211, 2, 83, 37, 13,
+203,199, 0,108,145,179,243,224,149,171, 86,113,115,243,243, 49,104,208,160,215,113,247,238,237, 42, 2,238,117,170,161,147, 18,
+131,197,114,239,220,169, 19,194,194,195,145,151,149,245, 2, 40,105, 28,207,181,183, 31,178,102,205, 26,110, 81,113, 49, 6, 13,
+ 28,152,253,252,250,245,221,137,249, 56,177, 47,190,196,136,213,120,222, 57, 28,219, 50,221,156,172,172, 44,160,100, 8, 9,165,
+181,120,217,148,225, 61,144, 87, 88,140,217, 63,236, 50,133, 71,167, 76,189,150,132, 62,191,169,144,243, 15,123, 12,143,175,176,
+ 0, 48, 99,192,210,178,232, 82, 77,102, 69,163,209,188,115, 3, 84, 95,205,202, 76, 98,125, 53,255,138,176, 88,172,226,103,207,
+158,113,165, 86,246, 38, 43, 9, 59,171,193, 39,215,101, 0, 96, 41,102,229,232,140,122,147, 74,165, 2,143,199, 43, 54,179,186,
+ 97,220,230,205,155, 23, 1,240, 97,177, 88, 39,182,111,223, 78,237,218,181, 75, 62,108,216,176,151, 79,158, 60, 73,246,245,245,
+117,217,190,125,187, 20, 0,214,174, 93, 75,246,239,223,223, 3, 37, 67,102, 84, 57,142, 75,106,106,234,183,153,153,153, 55,167,
+ 76,153,178,142,203,229,202, 69, 34,145,213,181,107,215,168, 98, 29, 65,203,175,226,223,244, 68,148, 10, 24,184, 58, 87,138,241,
+227,199, 51,159, 60,121,178, 52, 57, 57,249, 68, 53,154,115,178,179,179,175, 61,127,254,124,181,204,177,133,181,200,229, 43, 89,
+192,220,167, 0, 0, 23, 5, 27,140,210,114, 49, 59, 59, 27,233,233,233,152, 60,121,178,252,229,203,151,115,146,147,147, 47, 87,
+ 19,213,186,146,145,145,145,244,232,209,163,206,108, 54,155, 43, 18,137, 90,222,186,117,139, 42,214,154,208,108, 78, 60, 94,231,
+151,228,211, 82,204,194,253,239,149,152, 58,117, 42,235,197,139, 23, 63,164,164,164,180,175,180, 48, 99, 48,150,151, 55, 89,179,
+103,207,126, 8,160, 33,128,183,170, 70,141, 70, 35, 53, 98,196,136, 40, 0, 77,190,248,226, 11, 75, 66,200,204, 57,115,230,188,
+ 6,176,233,127,125, 45, 73,165,210,101, 19, 38, 76,192,254,253,251,145,149,149,181, 6, 0,114,115,115,127,220,179,103,207,190,
+113,227,198,225,215, 95,127, 93,150,158,158,126, 6, 53,119,213,238, 53,116,232, 80,156, 62,125, 26, 23, 47, 94,252, 6,192,227,
+ 42,214,123,126,237,218,181, 57, 71,143, 30,253,105,216,176, 97,216,182,109, 91, 79, 0,213, 53,144,237,222,163, 71, 15,156, 58,
+117, 10,153,153,153,161,149,173,144,157,157,189,225,216,177, 99,173,123,244,232,129,165, 75,151,118, 7,112,201,140, 93,247,146,
+201,100,219,127,250,233,167,150, 77,155, 54,197,240,225,195,139,117, 58, 93,207, 47,190,248,226,248,222,189,123, 37, 59,119,238,
+252, 96,252,248,241,119, 74,199,124,187,109, 86, 40,139,193, 88,178,106,213,170,177,157, 59,119,198,204,153, 51, 13,103,207,158,
+237, 7,224,220,153, 51,103, 94,206,158, 61,251,228,170, 85,171,152, 43, 87,174, 28, 59, 99,198,140,116,147,201,244,190,204,245,
+247,107,215,174,109, 29, 20, 20,132, 87,175, 94,225,246,237,219,208,233,116,191,222,186,117,235,170,155,155,219,247, 90,173,246,
+184, 72, 36, 26, 45,145, 72,124, 91,180,104,209,229,254,253,251, 66,152,215, 78, 47, 53, 54, 54,214, 66, 38,147,193, 96, 48, 32,
+ 50, 50, 18,206,206,206,208,233,116,136,137,137, 65,211,166, 77,193,225,112,144,154,154,138,114,209,242, 26, 76, 17, 35,242,101,
+156,170,161,165, 68, 4, 24,249,120,240, 52, 9,214, 10, 57,140, 20, 3,106,117, 10, 90,120, 58,130,162, 40,100,103,170, 65, 81,
+ 84,148, 57,154, 70, 98, 10, 75, 80,165, 57, 88, 73,120,104,218, 58,200,234,214,153,244, 93,210,134,237,198,179,152, 20,147,203,
+ 19,111, 26,251,241,199, 10,147,137, 32, 59, 51, 21, 44, 6,227,238,251, 56, 65, 7, 19,144,216,169, 17,255, 65,208,216, 69, 45,
+ 40, 2, 82,164,195,206,109,169,200, 18, 2, 45,214,126,253,181,133,149, 66,129,225,195,135,155, 50,147,147, 47, 20,154, 57,176,
+114, 67, 55, 55,165, 88, 34,193,141, 27, 55,192, 44,105, 99,139,173,128,215,242,217,179,173,108,108,109,241,201,216,177,166,212,
+132,132, 75, 69,128,170, 54,121,109,216,168, 17,187, 76,151, 81,170,155,194,196,244, 47,250,117,224,137, 4, 60, 44,217,248, 27,
+ 18, 51, 10,246,221, 74,193,198,127,104,188, 99,115,181, 17,173,170, 26,159,149, 52,170, 22, 86,107, 86,248,124,254,155,104, 74,
+ 45,222,244,222,185,102, 77,252, 25,154,239,145,185, 0,142, 2,152,155,152,152, 24, 61,118,236, 88,157, 65,167,201,187,185,168,
+225,151,225, 75, 27, 76,186,245,173,221,164, 35,211,101, 95, 22,230,188,206, 91,187,118,173, 62, 49, 49, 49,186,252, 54, 53,104,
+ 39, 0, 56,181, 99,199,142, 13, 7, 15, 30, 68,147, 38, 77,240,248,241, 99,155,130,130, 2,191,168,168, 40, 75, 47, 47, 47,236,
+218,181, 11,251,247,239, 95, 13,224,124,117, 38,171, 12,131,193,112, 65,173, 86,123,196,199,199, 55,182,176,176,208, 91, 88, 88,
+160, 98, 79,196,220, 34, 19, 50,179,115, 96,105,105, 5,169, 84,234,106,134, 57, 63,165, 86,171,221, 77,114,207,142,238, 25,107,
+114,194,150, 56, 33,108,137, 19, 78,205,177,135,157, 5, 23, 89, 89, 89, 72, 79, 79, 71,122,122, 58, 40,138,130, 94,175,247, 54,
+ 67, 51, 38, 37, 37,101, 75, 66, 66,194, 81,165, 82, 9,137, 68, 2, 2, 64,157,173,199,195,149, 94,120,184,210, 11,234,108, 61,
+114,243,242,208,160, 65, 3, 72, 36,146,170,170, 40, 24, 14, 14, 14,189,135, 12, 25, 34, 1,128, 82, 3,213,149, 16, 50,169,146,
+101,162,193, 96,104, 87,182,238,231,159,127,110, 9,160,199,255,248,122, 98, 2,152, 50,110,220,184, 15,248,124, 62,214,175, 95,
+ 31, 3, 96,119, 89, 89,191, 97,195,134,167, 0, 48,125,250,116, 95, 0, 51, 81,197, 72,208,111, 66, 67, 28,142,191,183,183, 55,
+110,221,186, 5, 0,191,213,240,219,135,110,222,188, 9, 55, 55, 55,240,249,252,150, 53,172,235,234,228,228,132,167, 79,159, 2,
+192,131, 42,214,121,240,244,233,211,146,234, 30,138,114, 53, 99,223, 67,130,130,130, 34, 47, 95,190,220,178,109,219,182, 24, 59,
+118,172,246,206,157, 59,189, 1, 92,125,240,224, 65,224,136, 17, 35, 10,220,221,221,113,229,202, 21,175, 17, 35, 70,220,100, 48,
+ 24,139,204,208,252,228,187,239,190,155,219,191,127,127,124,247,221,119,228,192,129, 3,195, 1,156, 43,253,238,236,190,125,251,
+ 70, 45, 94,188,152, 12, 28, 56, 16, 11, 23, 46,156, 11, 96, 82,117, 98, 5, 5, 5, 57, 70,163, 17, 5, 5, 5,102,133,228,205,
+ 93, 95,161, 80,244, 10, 10, 10,194,188,121,243,224,224,224,128,227,199,143, 19, 0, 39, 0, 92,211,106,181, 29, 1,172, 42, 40,
+ 40, 56,114,235,214, 45,116,239,222,157,131,183,167, 24,169,238,247, 35,247,236,217,163,145,201,100,112,113,113, 65,195,134, 13,
+161, 86,171, 17, 23, 23,135,166, 77,155,194,223,223, 31, 6,131, 1, 91,182,108, 41,206,203,203, 51,107, 76, 62,131,182, 96,231,
+249,147,135,115,172, 36, 60, 56,218,200,208,192,193, 18,249,217, 25, 72, 87,171,224,239,237,140, 78,254, 13,144,145,163,197,217,
+ 19,135,179,242,242, 10,119,154, 21,194,215, 20,110,191,112,230,120,142, 92,194,129,135,167, 47, 70,140,157,222,162,133, 95,192,
+249, 86,173,218,157, 93,177,108, 73,179,174,109,188,169,164,140, 98,156, 62,241, 91, 86, 78,110,238,246,247, 81,208, 47, 4,152,
+197, 50,247,171,161, 71,195,182,248,244, 28,183, 37, 58, 9,107, 0, 64,207,100,122,245,238,213, 11, 73, 73, 73, 56,124,240, 96,
+ 74, 33, 16, 97,174,158, 64, 32, 96, 0, 64, 78, 78, 14,120,165,237,238, 12,128,103,159, 62,125,144,158,145,129, 61,187,119,167,
+159, 6,194,107,147,207,190, 0, 87, 40, 40, 9, 8,230,228,228,128, 2,114, 1,128, 98,161,119,171, 38,110, 72,127,157,139,203,
+119,163,243, 27, 20, 97,114,117, 58,127,227,134,240,117,107,163, 5, 32, 99,230,204,153,224,241,120,176,179,179,123, 99,142,202,
+204, 10,151,203,133,157,157, 29, 12, 6, 3,246,237,219, 7, 0, 25,213,190,225, 1,154,126,147,150,154, 52,122, 82,200,102,179,
+223,137,102,233,155,163,102,208,236,109,166, 51, 55, 43,239, 20, 83, 23,205,191, 1,173, 74,199,196,106, 5, 32, 43, 46, 46, 46,
+105,240,160,126, 57,241, 47, 31,169, 11,178, 85, 41,185,153,137, 41,137, 49, 81,234,175,230,204,204, 73, 74, 74, 74, 68,201, 88,
+ 90,173, 84, 42, 85,217, 54,230, 48,115,240,224,193, 63,143, 27, 55,142, 60,124,248, 16, 0, 16, 22, 22,134,143, 63,254,152,140,
+ 26, 53,106, 13,128, 47,235,144,239,130,162,162,162,183,162, 33, 58,163,233, 77,149, 95,110,110, 46, 84, 42, 21,180, 90,173,217,
+142,248,249,217,149,207, 94,199,221,215,251,186,136,224,235, 34,130,151,147, 16,148, 33,255,141,201, 74, 79, 79, 47,123,115, 46,
+174, 69, 62,115, 53, 26,205, 91,249, 44, 95, 53,153,155,155, 11,181, 90, 13,163,209, 88,213,131,204,148,156,156,124,118,255,254,
+253,121, 0,176, 98,197,138,215, 20, 69, 93,164, 40,234,231, 74,150,141, 44, 22,235, 70,217,186, 43, 87,174,124,141, 63, 86,137,
+253,153,244,111,218,180,105,214,220,185,115,215,207,152, 49, 3, 27, 55,110, 68, 74, 74,202,151,248,255,177,120, 76, 25, 25, 25,
+179, 67, 67, 67, 49,102,204, 24,204,159, 63,127,165,159,159, 95, 46,128, 17, 85, 9, 90, 91, 91, 59,178, 88, 44,132,135,135,231,
+ 2,120, 85,195,239,171,195,195,195, 83, 41,138,130,157,157, 93,163,234, 86,180,180,180,108, 44,145, 72,144,156,156, 12,148,190,
+ 49, 87, 66,156, 74,165, 34, 92, 46, 23,246,246,246,110, 53,237,188, 92, 46,159,189,101,203, 22,214,163, 71,143,208,181,107,215,
+164, 43, 87,174,116, 7, 80,214, 37, 61, 60, 44, 44,172, 67, 96, 96,224,179,243,231,207,227,135, 31,126,160,154, 55,111, 62,169,
+ 38, 77, 23, 23,151,137,159,124,242, 9,214,173, 91,135, 77,155, 54, 77, 2,112,176,194, 42,123, 67, 67, 67,167,111,218,180, 9,
+ 99,199,142,133,171,171,235,136,234,244,226,227,227,231,116,238,220, 57,236,249,243,231,102,205,120, 96,230,250,129, 1, 1, 1,
+141,139,138,138,176,125,251,246, 87,141, 27, 55,190,119,240,224,193,153,248,227, 3,251,200,225,195,135, 49,114,228, 72, 52,111,
+222,124, 59,128, 97,230,220,150, 79,158, 60, 73,188,116,233,146,137,195,225,192,197,197, 5,193,193,193, 24, 62,124, 56,154, 53,
+107, 6,157, 78,135,195,135, 15,155,162,162,162,146,180, 90,173, 89, 99, 41,101, 62,255,253,120,108,236,179, 27,225,119,174,234,
+ 89, 76, 6,156,237, 44, 49,160, 91, 11,252,231,195,118,240,247,114, 64,124, 90, 17, 46, 93, 58,175,143,141,125,117,203,156, 30,
+135,101,154,209,143, 35,110, 62, 10,191,110, 96,179, 40,120,121,186, 99,222, 87,179,229,139, 23,204,177,112,111,228,140,136,152,
+ 28,156, 63,119, 90,175, 74, 74,188,252,190,122, 28, 94, 1, 56, 98, 30, 37, 98, 50, 24, 48, 50,120, 5,204,210,142, 52, 77,124,
+124, 60,148,182,182, 56,121,242, 36, 24,181,232, 17,122, 5,224,136,197, 37,181,224,249,249,249, 40,211,107,236,233,233,233,236,
+226,130, 83, 39, 79,130,105, 50, 61,233, 84,203, 1, 70,159,150, 84, 67,191,209,165,128,226,201, 78,144, 52,118,178,241,148,203,
+ 68,184, 19,241, 2, 26, 61,185,187, 59, 11,239,117, 60,178, 63,145,241,168, 99,213,225,138,141, 27, 55,182,218,178,101, 75,247,
+153, 51,103,138, 71,143, 30, 13, 62,159,143,194,194, 66, 56, 58, 58,194,104, 52,226,204,153, 51,184,127,255,126,190,201,100, 58,
+143, 63, 14, 27,208, 13,229,122,105,156,125, 5, 65,137,223, 42,108,117,244,163,143,222,137, 38, 0,136, 95,152,164,153, 13,180,
+187,214, 30,188, 62,112,207,217,112,234,211, 97,157, 24,254,158, 78, 0, 0,165, 82, 9,169, 84, 90,107,205,119,192,159,174, 89,
+190, 90, 87,173, 86, 63, 85,171,213,105,227,198,141,243, 42,107,248,206,227,241,138, 75, 35, 89, 89,149,109, 99, 70, 62,117, 0,
+ 38,111,217,178,229, 88, 78, 78,206,217, 47,190,248, 2,139, 23, 47,198,241,227,199, 59, 0,184, 81,199,125, 55,102,101,101,101,
+223,189,123, 87,233,230,237,135,134, 54,108,116,252,230, 57, 8, 33,176, 18, 18,228,101,191,198,131, 7,225,200,203,203,187, 83,
+155,124,234,116,186,236,180,180, 52,133,141,141, 13, 94,191,126,141,140,140,140, 55, 38, 43, 43, 43, 11,175, 95,191, 38, 20,245,
+135, 49, 91,170,211, 44, 72, 75, 75, 43,140,142,142,230, 42,157,220,208,200,134,131,128,175,158, 2,132,192,217,146,129,188,220,
+108,220,186,117, 11, 57, 57, 57,191, 87,165,105, 50,153,102,141, 24, 49,130, 9, 96,212, 23, 95,124, 97, 9,160,249,236,217,179,
+207,163, 66,207, 66, 22,139,245,227,174, 93,187,154,148, 85, 49,206,153, 51,103, 53,128, 45,255,171,107,201,202,202,106,214,201,
+147, 39, 37, 58,157, 14,107,215,174,197,234,213,171,183,226,143, 3, 85,158, 92,191,126,125, 40,131,193,152, 50,117,234, 84, 76,
+152, 48, 65,248,193, 7, 31,204, 76, 73, 73,217, 93,153,102,114,114,242, 60,127,127,255,249,105,105,105, 75,204, 50,203,207,159,
+143,247,247,247,159,151,150,150,182,188,186,115, 36, 18,137, 68, 70,163, 17,177,177,177, 89, 64,149,237, 59,138, 99, 99, 99,147,
+141, 70,163,163, 80, 40,180,172,233,250,204,202,202, 90,242,193, 7, 31,124,155,154,154,122, 14,192,162, 74, 12,249,195,148,148,
+ 20,223, 25, 51,102, 76, 91,182,108,217, 64,181, 90,189,175, 38,205,248,248,248, 37,129,129,129,223, 60,123,246,108, 7,170,174,
+ 2, 94,191,112,225, 66,221,174, 93,187, 38,197,198,198, 46,173, 65,243, 68, 70, 70,198,137, 90,156,223,170,214,127,163,201,100,
+ 50,103, 47, 91,182,140,177,113,227, 70, 16, 66, 86, 26,141,198,170,242, 25,113,228,200,145,157,237,218,181, 27,125,240,224, 65,
+190,175,175,239, 4,141, 70,179,183,166,235,179,176,176,240,240,193,131, 7, 7, 70, 68, 68, 56,142, 30, 61,154,239,225,225, 1,
+157, 78,135,148,148, 20,108,220,184,177, 56, 42, 42, 42, 41, 59, 59,251,112,109,202, 16,131, 54,119,216,205, 75, 71,247,198, 61,
+143,106,211,185,103,136, 92,171,115, 4, 47,147,137,236, 76, 53,206,156, 56,156, 21, 27,251,234, 86, 97, 97,246,176,218,104,234,
+ 52, 57, 67,111, 93, 62,182, 47, 41, 54,186,117,199,192,222,242, 98,173, 11,120, 28, 6, 50, 83,147,113,230,228,209,215,177,177,
+ 49,215,138,245,154,143,223, 87, 57,207,116,197, 34,166,250,254,184,137,125, 91, 64, 32,119,124,192, 6,214,182, 3, 4, 10,165,
+146, 83,122,239, 64, 92,210,230,209, 44,205, 84,128,235, 86, 90, 75, 85, 88, 88, 8, 54,160, 29, 3,176,173,173,173, 5, 0,240,
+236,217, 51, 8, 75,106, 53,106,149,207,124, 64, 36, 44,167,203, 0, 10, 51, 89,112,104, 44, 21, 81, 0,144,164,206,132, 86, 95,
+237,115,227,239,206,230,114,134,107,115, 93, 4, 56, 0,186,137,197,226,197,243,231,207, 95,121,231,206,157,149,193,193,193, 43,
+121, 60,222,226,210,131,205,169,230, 68,252,207, 52, 91,218,195, 50,176, 17,117, 53,168, 49,101,154,216, 65,110,252, 56, 64,164,
+237,210,165, 75,104, 61,243, 89,159,155,229,207,212, 60,170,215,235, 9, 74,170,237,142,162,234, 42,193,185,229,190, 87, 39, 36,
+ 36,144,210,191,107,147, 79,197,144, 33, 67, 76,121,121,121,100,240,224,193, 4, 53, 79,225, 83,173, 38,143,199, 11,236,216,177,
+163, 62, 53,253, 53,121, 26,147, 76,110,135, 61, 38,103, 47,221, 36,251, 14,159, 36,235, 66, 55,145,102,205,154,105, 1,184,212,
+ 70,147,197, 98,117, 9, 12, 12,204, 76, 77, 77, 37,209,209,209,228,234,213,171,228,208,161, 67,100,211,166, 77,228,231,159,127,
+ 38, 78, 78, 78,169, 0,148,181,209, 20, 8, 4, 33,189,122,245,210,103,231, 22,146,216,228, 76, 18, 25, 29, 75,110,220,141, 36,
+103, 46,221, 32,187,247, 30, 36, 62, 62, 62,197,102,104, 50,153, 76,230,186,125,251,246,229, 18, 66, 72, 72, 72, 72, 18,222, 30,
+ 72,181,225,172, 89,179,210, 8, 33,100,249,242,229,153,168,188, 33,252,159,125, 45,245,116,112,112,120,202,225,112, 78, 2, 24,
+ 85,195,118, 67, 89, 44,214,113, 91, 91,219,123, 0, 6,188,135,251, 40,216,198,198,230, 54,128,154,102, 56, 40, 91,175,255, 63,
+228,126,255, 51, 52,187,176, 88,172,171, 64,245,147, 8,151, 43,175,191,103, 50,153,167, 0,116,173,101, 62,221, 21, 10,197, 96,
+185, 92,254,169, 92, 46,255,212,198,198,102, 48,151,203,117,175,207,190, 91,185,119,235,235,236,215,239,136, 83,243, 62,241,206,
+ 45,130,227, 93,253, 67,142, 88,185,119,235, 91, 95, 77, 23,255,144,163,206, 45,130, 19,156, 91,244,141,107,216, 50,228,136,194,
+179, 91,175,247,121,142, 70, 57,192,190,123, 67, 24,200,213,111, 8,185,250, 13,233,214, 16,166, 54, 22,240,105, 5, 72,122,116,
+235,182,138, 24,141,171, 6,246,239,191,202, 13,176, 34, 0,179,226, 82,153,166, 31, 32,125,179,109, 72,200,170, 70,128,162, 59,
+ 32,236,212,161,195, 74, 98, 52,174, 26, 49,116,232, 42,103,192,182, 50,189,170, 52, 9,192,116, 0,236,203,235, 42,128,198, 31,
+186,194,119,110, 95, 87, 66,174,126, 67, 22,126,228, 65,252,149, 24, 85,131,102, 85,145,162,191,117, 68,171,182,136, 74, 11,215,
+165,165,159,162,119,112, 17,190,115,205,214,118,240,232,214,152,138,238,237,201,122,141,146, 46,201,162,127, 96, 33,185, 67,171,
+213,146,226,226, 98, 82, 88, 88, 72,242,243,243, 43, 26,168, 55,134, 76,165, 82,145,164,164, 36,146,144,144, 64,226,226,226, 8,
+254,191,237,141,217,249,148, 74,165, 91, 62,250,232, 35, 35,155,205, 94,247, 46,246,221,210,210,114,105, 64, 64,128,238,167,159,
+126, 34, 71,142, 28, 33,191,252,242, 11,153, 58,117, 42,105,210,164,137,198,194,194, 98, 88, 93, 52,109,109,109,231,121,122,122,
+102,110,221,186,149,236,222,189,155,172, 89,179,134,124,253,245,215, 70, 71, 71, 71,181, 68, 34,233, 81, 23, 77, 27, 27,155,205,
+237,219,183,215,109,222,188,153,156, 63,127,158,236,217,179,135,204,154, 53,139,120,121,121,105, 68, 34,209, 32, 51, 53,153, 44,
+ 22,107,213,196,137, 19,213,246,246,246, 39, 43,124, 39,244,241,241,185, 55, 98,196, 8, 21,128, 57,255,160,235,147,214,164, 53,
+105,205, 63,193,104, 13,183,135, 3, 1,152, 66, 14,103,104,167, 14, 29, 86,114,128,161,181, 53, 69,124, 38,243,195,118, 1, 1,
+ 43, 57,192,176,178,117,249, 76,230,135,157, 58,116, 88,201,102, 50, 71, 86,165, 87,157, 38, 1,152, 28, 22,107, 78,187, 54,109,
+ 86,177,128,175,202,210,186, 52,164,158,204,234,233, 68, 58,184, 80, 47, 70,218, 64,248, 15, 54, 90,239, 28,214,159,112, 17,254,
+ 93, 52,255, 42, 55,181, 91,169, 97, 58, 90,139,136,214, 81,148,204,162,238, 86,199,124, 10,222,241,190, 55, 85, 40, 20,167,221,
+220,220,210, 27, 52,104,160,146,203,229,123, 1, 56,214, 83,211,215,214,214,246, 87,165, 82,249,220,206,206, 46, 66,161, 80,252,
+136,146, 81,231,235,172,201,102,179, 3,148, 74,229,239,174,174,174,217, 46, 46, 46,169, 10,133, 98, 95, 37,145, 44,115, 52,237,
+ 80,121,161,194, 41,253,142,126,232,208,154,180, 38,173,249,150,129, 9,106,132,101,221, 27,194,208,189, 33,140, 65,174,248,177,
+188, 65, 9, 6, 4,117, 53, 69, 31, 3,188,138,235,215,164, 87,147, 38, 1,152,109, 1,113,197,109,122, 59,194,199, 76,205,191,
+123, 68,171,172,156,175,221,240, 14, 85, 96,248, 19, 50,249,119,209,252,171,240, 2,213, 52, 70, 46,199,210,119,248,155, 69,239,
+120, 31, 34, 51, 50, 50,122,101,100,188,211,190, 9,143,212,106,245,168,119, 41,168,215,235,239,164,166,166,118,126, 7, 82, 85,
+117,189,214,193,204,110,217, 52, 52, 52,255, 30, 40,192,136, 87,248,178,155, 59,214,178,140, 96,156,137, 65,114,133, 46,121, 69,
+ 84, 93, 52, 75, 48,238,168,164,140,167,234,154,207,255, 39,255, 15, 26, 73,120, 76,253,123, 78, 91, 10, 74,218,104,213,219,104,
+209,208,208,208,208,208,208,252, 15,184,240,156,126, 17,251, 27,112, 18,111, 71,223, 78,150, 51,162, 85,134, 62,107,211,147,162,
+ 46,225,211, 11,180, 38,173, 73,107,210,154,180, 38,173, 73,107,254,235, 52,203,168,106,238,212,167, 21,254,175, 83, 47,190,127,
+ 11,116, 61, 59,173, 73,107,210,154,180, 38,173, 73,107,210,154,255,116,234, 60,142, 22, 13, 13, 13, 13, 13, 13, 13, 13, 77,245,
+ 84, 25,117,163,141, 22, 13, 13, 13, 13, 13, 13, 13, 77,253,176, 67,201, 20, 85, 39,241,255, 83, 85,109, 6,106,158,130,231, 45,
+150, 45, 91,198,112,115,115, 19,115,185,220, 38,175, 94,189, 98, 76,158, 60,185,222, 29, 9, 86,254,184,142,225,226,226, 34, 6,
+208, 36, 51, 43,143,241,201,127,190,160,232,243, 69, 67, 67, 67, 67, 67, 67,243, 55,162, 79,169,177, 42,251,124, 19,225,170,149,
+209, 90,180,104, 17, 18, 18, 18, 68, 0,134,248,250,250,114, 55,108,216, 64, 14, 28, 56, 80, 47, 99,244,213,156, 89,136,143,143,
+ 23, 1, 24, 98,163,176,224,110,219,178,130, 28, 60,126,253,157,155, 45,133, 66, 97,245,191,220,142,134,134,134,134,134,134,230,
+ 95,197,248,114,159,227,235,100,180, 88, 44, 22,147,203,229, 54, 98, 48, 24,189,248,124,126, 75, 0, 40,157,146,165,206,176, 88,
+ 44, 38,151,199,107,196,100, 50,123,241,120, 37,154, 31,245,109, 95, 95,205,174, 34,145, 40, 81, 40, 20,222, 7, 32,144, 72, 36,
+225, 58,157,238,177, 68, 34,185, 89, 27, 29,137, 68,114,179,116,187,112, 0, 2,161, 80,120, 95, 36, 18, 37,178, 88,172,174,244,
+245, 68, 67, 67, 67, 67, 67, 67, 83,202,230, 74,150, 63,114,226,196,137, 42, 13, 14,151,203,101,248,250,250,182,119,113,113,185,
+225,237,237,173,117,116,116, 60, 36, 20, 10, 69,245,204, 24,195,205,195,171,189,189,157,242, 70,139, 70,118, 90, 27, 27,155, 67,
+108, 54,187, 62,154, 76,137, 68,178, 38, 40, 40, 40,231,198,141, 27, 68, 42,149,166, 2,176,176,182,182, 86, 17, 66,136,173,173,
+173,169, 54, 98,182,182,182, 38, 66, 8,177,182,182, 86, 1,176,144, 74,165,169, 55,110,220, 32, 65, 65, 65, 57, 18,137,100, 13,
+106, 30,209,150,134,134,134,134,134,134,166, 22, 84,231, 69,254,194,148, 69,177,236,234,188,115, 92, 46,215, 79,161, 80, 68,125,
+246,217,103,198,205,155, 55, 19, 23, 23,151,187, 54, 54, 54,109, 20, 10,197, 91, 13,234,199,140, 25, 83,155,106, 63, 63,137, 84,
+ 22,181, 99, 70, 79, 99,209,182, 16,226, 96,103,115,215,194,194,162,141, 84, 42,125, 75,115,196, 39, 19,204,209,180,151,201,100,
+ 17,203,150, 45, 43,206,206,206, 38,132, 16, 34,147,201, 82, 1,200,149, 74,165, 42, 38, 38,134, 40, 20, 10, 2,243,163,120, 12,
+133, 66, 65, 98, 98, 98,136, 82,169, 84, 1,144,203,100,178, 84, 66, 8,201,206,206, 38,203,150, 45, 43,150,201,100, 17, 0,236,
+233,219,130,134,134,134,134,134,230, 95,109,180, 42, 26, 46,243,170, 14, 91,182,108,201, 83, 42,149,109, 36, 18, 73,127,177, 88,
+ 28,218,175, 95, 63,223,129, 3, 7, 50, 52, 26,141,209,215,215,215,222,213,213,117,154, 92, 46, 31,197,231,243,155,113,185,220,
+145, 82,169,212,110,239,222,189,110,213,105, 54,109,254, 1,207,194, 66,222,134,203,229,245, 23,139, 37,161, 19, 63,236,226, 59,
+106,230, 32, 6, 71, 27,103,236,210,204,217,190, 73, 35,187,105,182,114,209, 40, 22,147,209,140,162,168,145,124, 62,223,110,247,
+182, 77,110, 53,236, 88, 35,123,123,251,240,189,123,247, 54, 25, 50,100, 8, 47, 58, 58, 26, 0, 96, 52, 26,185, 0,244, 76, 38,
+ 19, 60, 30, 15, 58,157, 46, 11,128,185, 39,144,232,116,186, 44, 30,143, 7, 38,147, 9, 0,250, 82, 61, 68, 71, 71, 99,200,144,
+ 33,188,189,123,247, 54,177,183,183, 15, 7,208,136,190, 53,104,104,104,104,104,104,254,181,148,153,171,147,168, 80,117,200, 42,
+115,143,193,193,193,111, 69,141,184, 92,238,134,103,207,158,181,179,180,180,108,196,102,179,141, 67,135, 14,229,141, 24, 49, 2,
+233,233,233,166,252,252,124,166,159,159,159,242,222,189,123,189, 12, 6, 67, 7, 11, 11,139,194,236,236,108,133, 70,163,121, 1,
+ 96, 90, 53, 25,217,240,252,105, 84, 59, 43,185,101, 35, 46,155,105,156, 58,118, 4,239,171, 57, 61, 65,105,194, 76,198,180, 76,
+230,247,254, 22,202, 31,111, 22,244,122,166, 51,118, 40,144,241, 11,213, 57,154, 26, 53, 21, 10,133, 63,135,195,185,127,250,244,
+105, 8,133, 66,228,228,228,128,203,229, 2, 0,242,243,243,101, 0, 88, 20, 69,129,203,229, 34, 55, 55, 87, 94,155,163,150,155,
+155, 43,231,114,185,160, 40, 10, 0, 88,165,122,224,114,185,200,201,201,129,155,155, 27,117,250,244,105,155, 94,189,122,189,212,
+233,116, 31,100,100,100,132,209,215, 26, 13, 13, 13, 13, 13, 77,237,169,204,139,252,141,168,113, 28,173,206,165,161,186,242, 19,
+231,238,180,182,182,182, 21,139,197,222,227,199,143,103, 40, 20, 10,220,191,127,223, 84, 80, 80,192, 96,179,217, 96,179,217,204,
+ 46, 93,186,136, 13, 6,131,240,212,169, 83,212,203,151, 47,211,245,122,253,247,153,153,153,247,170,201,200,206,198, 22, 60, 91,
+129, 5,215,251,248, 23, 29, 25,214,110,153,192,217,133, 38,146,159,198, 96,153, 8, 20, 34, 19,115, 85, 7, 74,172,150,185, 10,
+167,238, 75,167,174,189,204, 78,215,235,245,223,231,229,229, 85,167,153, 12, 0,165,121,130, 84, 42,133,209, 88,126,126, 75, 16,
+ 6,131, 1, 30,143, 87,167, 35,199,227,241,192, 96, 48,128,114,145, 48,153, 76, 6, 38,147, 9, 6,131, 1, 54,155,253, 86, 62,
+104,104,104,104,104,104,104,234, 68,101, 94,228,239, 66,249,113,180,204,155,155, 82,169, 84, 82, 82,169,212,174,121,243,230,223,
+ 6, 5, 5,197, 12, 24, 48,160,240,167,159,126, 34,171, 87,175, 38,171, 86,173, 34, 91,183,110, 53, 94,190,124, 89,255,159,255,
+252,167,216,221,221,253, 69,104,104,168, 55, 0,244,238,221,187,202,234, 72, 11,185, 37, 37,230,178,236,124,188,155,126, 59,188,
+115,147,152,111,250,123, 20,234,118,248, 17,211,124, 39, 98, 92,231, 74,140, 7,187, 26,201,179, 21,250, 37,227,186, 22, 55,112,
+105,240,226,231,173,251,189, 1,160, 91, 80,239,106,171, 56, 21, 10, 69, 75, 71, 71,199,212,115,231,206,153,178,178,178, 72,102,
+102,102, 89, 27,173,108, 0, 50, 23, 23, 23,149,193, 96, 32,114,185,252,117,109,142,154, 92, 46,127,109, 48, 24,136,139,139,139,
+170,196, 95,201,178, 9, 33, 36, 51, 51,147,100,101,101,145,115,231,206,153, 28, 29, 29, 83, 21, 10, 69, 75,250,254,160,161,161,
+161,161,161,249,215, 50,190,194,103,205,180,107,215,142,146, 74,165,140,166, 77,155,138,237,237,237, 91,219,219,219,223,249,241,
+199, 31,201,234,213,171, 13, 27, 55,110, 36,191,254,250,171,225,227,143, 63,206, 21,137, 68, 39,185, 92,174, 28, 0, 92, 93, 93,
+171, 13,249,181,108,221,134, 18,240,121, 12, 79, 79, 31,177,194,202,170,181,181,149,229, 29,221,234, 38,132, 44,116, 48,144, 45,
+ 45, 8, 57,216,211,176, 98,112,171, 92, 54,155,115, 18,128, 28, 0, 28,237,237,204, 13, 35,218,219,216,216, 68, 44, 92,184,176,
+ 64,167,211,145,210, 94,134,169, 0, 44, 92, 92, 92, 84,132, 16,226,232,232,152, 8, 64, 97,166,158,194,209,209, 49,145, 16, 82,
+102,180, 44,108,109,109, 83, 9, 33, 68,167,211,145,133, 11, 23, 22,216,216,216,208,141,225,105,104,104,104,104,104,104,170,156,
+235,176,202, 72,209,141, 27, 55, 72,110,110,174, 41, 57, 57,217,152,159,159, 47,245,243,243,147, 51,153, 76, 40,149, 74, 38,147,
+201, 52, 21, 20, 20, 48, 21, 10,133,138,205,102,239,214,106,181, 89,253,251,247,167, 98, 99, 99,171,109,104,126,239,246, 45, 82,
+ 84,172, 49, 37, 37, 37, 26, 11,243,115,165,163,154, 89,202, 89, 6, 29, 76,126,237,152,185, 2,119,147,169, 40,139,233,101,199,
+ 83,113, 56,236,221, 0,178, 6, 4,247,161,146, 84, 41,230, 54, 94, 87,165,165,165,249,109,216,176, 97, 75,199,142, 29,179, 10,
+ 11, 11,203,218, 86, 85, 28,130,193,194, 76,189,138,235, 49, 41,138, 66, 97, 97, 33, 58,118,236,152,181, 97,195,134, 45,105,105,
+105,126, 0, 84,244,245, 69, 67, 67, 67, 67, 67,243,175,166,202,113,180,106, 28,234,160,176,176, 80,206,225,112,186,181,106,213,
+170, 65, 65, 65,129,105,209,162, 69,137, 63,253,244,211,174, 23, 47, 94,232, 45, 44, 44, 26, 9, 4,130, 79, 81, 76,136,102, 0,
+ 0, 32, 0, 73, 68, 65, 84,135, 12, 25,162, 56,114,228, 8,233,208,161, 67,197,232, 83,165,179,123, 23, 21,229,203,121, 28,118,
+183, 79, 3, 36, 13, 18,117,114,147,247,167,119, 19, 59,205,191,185,235,183, 71, 44,125, 83,203,162, 70,150, 92,234,211, 33, 67,
+ 6, 43,126, 59,113,146,180,105,211,218, 44,205, 82,140,105,105,105,159,222,191,127,127,112,195,134, 13,147,244,122,125, 18,128,
+204,162,162,162, 84,123,123,251, 52,157, 78,151, 4, 64, 87,201,118,149,105,234,116, 58, 93,146,189,189,125, 90, 81, 81, 81, 42,
+128, 76,189, 94,159,212,176, 97,195,164,251,247,239, 15, 78, 75, 75,251, 20,128,177,154,188,208,179,186,211,154,180, 38,173, 73,
+107,210,154,180,230,191,135, 63, 68,179, 0, 51, 38,149,230,241,120, 29,157,157,157,219, 63,122,244,200,120,235,214,173, 28, 6,
+131,241,115,239,222,189, 15, 29, 62,124, 56,192,210,210,210,198,201,201, 73,121,241,226,197, 64, 0, 7,174, 93,187,102, 86,244,
+ 73,192,227,116,108,225, 40,107,191,249, 33, 49,110,187,255, 60,199,200,228,253,220,101,208,160, 67,211,119,237, 9,176, 87, 72,
+108, 90,216, 73,149,167, 78,157, 9, 4,112,224,214,173,219,181, 30, 79,195, 96, 48, 92, 76, 75, 75,115, 42,251, 63, 61, 61,221,
+ 79,161, 80,120,163, 36,250,148, 99,166, 76,188,201,100,234,109, 50,153,236, 51, 50, 50,158, 0, 64, 70, 70,198, 7,244,117, 68,
+ 67, 67, 67, 67, 67, 67, 83,137,201,218, 92,217,255,213, 70,180,184, 92,174, 3,147,201,244, 73, 74, 74,138, 63,117,234,212,163,
+150, 45, 91,246,138,143,143, 95, 70, 8,137, 19, 10,133,227, 19, 19, 19,159, 39, 38, 38,106,139,138,138, 38,214, 34, 51, 14, 96,
+112,124,238,171,138,226,127,184,248,248, 81,211, 54, 61,122,169,213,170,101, 70, 66,226,184, 66,233,248,103, 9,233,207,111,167,
+105,180,197,197,181,210,172,145,140,140,140, 39, 25, 25, 25, 57,181,220, 38,167,204,100,209,208,208,208,208,208,208,208,212,150,
+154, 34, 90, 58,163,209,184, 66,163,209,200,127,251,237,183,228,160,160, 32, 13, 0,108,216,176,193, 52,118,236,216,235,175, 94,
+189,234,250,228,201,147, 94,182,182,182,151, 0, 80, 49, 49, 49,230, 68,159,116, 38,147,113,133, 86,171,145, 95,188, 28,150,220,
+177,125, 83, 13, 0,108, 92,191,214, 52,116,252,140,235,175,162, 31,117,125, 22, 21,222,203,214,214,246,146,209,192,162, 82,212,
+113,132, 62, 77, 52, 52, 52, 52, 52, 52, 52,127, 97, 54,227,237, 42,195,205,102, 25, 45,173, 86,155,174,213,106, 1, 32, 43, 40,
+ 40,232,173,239,182,110,221, 74, 0, 20, 0, 56,152,153,153, 89,155,204,164, 23, 21, 21, 1, 64, 86,199,246, 77,223,250, 98,223,
+230,159,222,104,230,231,229,210,167,141,134,134,134,134,134,134,230,239,100,182,254, 0,131, 62, 46, 52, 52, 52, 52, 52, 52, 52,
+ 52,245, 98,124, 85,255, 83,168,186,231,192,133, 90,252, 64, 93,122, 31, 92,160, 53,105, 77, 90,147,214,164, 53,105, 77, 90,243,
+ 95,167, 89,147,246, 5,252,253,168,178, 49,252,159, 13,221,245,149,214,164, 53,105, 77, 90,147,214,164, 53,105,205,127, 58,118,
+120,123,120, 7,187,178, 47, 88,244,177,161,161,249,123, 67, 14,130,137, 44, 79, 87, 16, 98, 15, 38, 55, 5, 41,145,175,168,111,
+ 97,170,183,102,170,143, 11, 4,122, 37, 12,252,116,164, 70,196,212, 87,147,134,134,230,159,135,109,219,201, 3, 40, 6,243,103,
+138,152, 80,148, 26,205,227, 20,197, 9,211, 82,226,255,141,222, 34, 5, 85, 68,176,104,163, 69, 67,243,119, 39,221,203, 3, 44,
+ 44, 5, 3,118, 32,186,151,176,246, 89, 10, 60,142,170,183, 38,199,180, 8, 70,134, 35,136,238, 25,108, 60,151, 1, 79, 31,211,
+ 7,251,159,199,180,169,147,200,147,168, 59, 72, 72, 80,161, 81, 99, 59,120,120,181,197, 79,107, 67, 41,250,200,208,152,247, 86,
+ 70,109,238,214,119,132,165, 64, 40, 1, 0,152, 12,122,108,157,217,226,188,193, 96,216, 9,224, 8,128,162,127,251, 33,250,159,
+ 55,134,103,179,217,169, 0, 76,124, 62,255, 48,202,133,214,104,104,254, 4,236, 74,175, 51, 83,233,117, 87, 27,196, 44, 22,107,
+190, 80, 40,188,204,227,241,210,120, 60, 94,154, 72, 36,186,204, 98,177,230, 3, 16,255,101,202,184, 95,155, 8,193, 48,246,210,
+234, 77, 14,103, 34,179,109, 10, 53, 70, 15, 48, 12,189,201, 86,119,113,189, 52, 89, 84, 80,177,206,228,188,251,110,161,178, 64,
+107,240, 6, 65,189, 52,203, 97,193,225,112,206,192,252, 57, 71,105,254,100,226, 99,162,112,234,196, 42, 44,250,110, 52,182,111,
+158,136,167, 79,110,215, 75,207, 27,248,224, 3, 22,235,115, 47,160, 11, 74,218, 1,211,252,147,161,200,248, 11,199,119,167, 31,
+223,187, 62,125,255,170,137,228,232,210, 96,172, 93,187,182,219,232,209,163,119, 59, 59, 59,167, 3,248,136, 54, 90,255, 99,244,
+122,189, 77, 70, 70, 6,181,115,231,206,126, 50,153,236, 37,139,197,154, 11,128,243,111, 57,224, 98,177,248,166, 84, 42, 77,149,
+201,100,169, 82,169, 52,188,166,244,127, 40, 30,214,214,214,241,150,150,150,207,202, 39, 90, 55, 27,208,214,173,221,168, 5, 86,
+ 62, 33,157,234,169,207, 97,177, 88,115,101, 50,217,203,157, 59,119,246, 75, 78, 78,166,244,122,189, 77, 45,182,239, 40,151,203,
+159,220,185,115,231,155,140,140,140, 78,137,183,183, 90,171,239,108,178,142,255,125, 85,231,251,167,214,125, 99, 97, 33,123, 12,
+160,227, 95,226, 72, 22,155,148, 96, 48, 3, 31,165, 20, 10, 83,114,245,202,176,184, 66, 9,192,236, 12,109, 61, 94, 98,114, 76,
+ 74,128,116,121,152, 84, 36,186,249,218, 90,121,237,149, 70, 10, 6, 35, 16,197,148,109,189, 11, 28, 6, 99,146,201,100,234,206,
+225,112, 62,165,159, 80,127, 13,120, 60, 14, 64, 8,196, 34, 62, 0, 2, 70, 61,173, 17,151,193,104,119,179, 95,191, 69,115,154,
+ 53,155,230, 5,244,173,194,108, 81, 0,166,123,121,121,157, 6, 48,244, 29,238,206, 15,158,158,158,201, 0,102,188,171,114,201,
+223,223,191,109, 96, 96,224,130, 22, 45, 90,116,122, 87,154,255, 36,212, 55, 55,252,150,114,125,157,141,234, 70,168, 77,118,204,
+213,233,118, 74,185, 41, 38, 38, 6,125,250,244,193,250,245,235,133,190,190,190,187, 0,216,255, 11,110, 37,191,178, 23,124, 84,
+104,163,101,182,209,250,208, 21,237,134, 53,196,149,193,174,200, 27,210, 16,249, 35, 27,226,250, 32, 87,116,169, 75,110,172,172,
+172,208,177, 99, 71,102,114,114,178, 96,214,172, 89, 11,248,124,126, 44,128, 30,117,209, 18, 8, 4,247,133, 66, 97, 34,139,197,
+122, 43, 47, 66,161,240,190, 72, 36, 74,100,177, 88, 93,203,167, 75, 36,146,155, 82,169, 52, 85, 34,145,132, 87, 97,132,238, 75,
+165,210, 84,177, 88,124,191,124, 58,139,197,234, 42, 22,139,147, 36, 18, 73,197,244, 46, 18,137, 36,177, 98,122, 85,176,217,108,
+199,196,196, 68,155,164,164, 36, 27, 46,151,171, 44,159,158,144,144, 96,147,152,152,248, 86,122,109, 96,177, 88, 93, 68, 34, 81,
+162, 80, 40,188, 95, 89,122,197,125,170,138,114,199,174,139, 57,233,181, 45,120,130,130,130,174,167,164,164, 56, 91, 88, 88,188,
+ 53,113,183,165,204,162,199,175, 91, 67,103,134,244, 14,154,100,237,221,191,105, 29,245,123,240,249,252,216, 89,179,102, 45, 72,
+ 78, 78, 22,180,105,211,134,201, 96,212,234,125,162, 91, 72, 72,200,209,212,212, 84,135,230,205,155, 51, 13, 6, 3, 30, 29,155,
+ 15, 97,196,167,224,199,110,132,147, 32,157,245,242,252, 50,199,160,206, 31, 28,197,123,110, 12, 74, 14,122,115, 64,153, 58,154,
+ 8,177,126,146, 92,108,221,167,223, 71,172, 7,137, 69,214,122,163,209, 18, 96,118, 38,219, 93,120,117,210,100,233, 59,152, 8,
+ 81, 94,140, 99, 91, 7, 14,158,198,188, 20,199,178,214, 27,141, 86, 96,160, 83, 93, 52,203, 95,254, 76, 38,115,230,170, 85,171,
+ 24, 0,166, 2,224,254,155, 12, 77, 43,123, 56,116,105,204,188,235,103,135,118,239, 80,214,183,244,126,247,168,175,208,150,237,
+167, 49,118,194,102,184,123,181,174,151,142,214,100,122,186, 47, 38,230,236,200,198,141,131,231, 52,107, 54,166, 18,179, 69, 1,
+152,179,108,217,178, 81,143, 30, 61,178,110,216,176,225,132,119,244,210,191,102,217,178,101,179, 31, 61,122,100,239,234,234,186,
+176,150,154, 85,150, 75,114,185,188,199,150, 45, 91,102,246,233,211,103,146,191,191,127,211,119,161,249, 15,102,253,195,135, 15,
+157, 87,173, 90,245,229,216,177, 99,115, 1,160,107,215,174, 28, 0,109,234, 93,222, 17,194, 37,132, 4, 18, 66,250, 16, 66,186,
+ 18, 66, 90,149,254,221,178,116,233, 67, 8,233, 86,225,179,101,233,182,101,223, 7, 84,161,209,167,226,118,229,182,169,248,255,
+ 91,127, 87, 98,180,250,160,164,173, 86,159,183,118,224,196,137, 19,164,252,103, 69,134,184,226,219,105,109, 29, 10,159, 28,223,
+ 67,242, 19, 99, 72, 86,244, 3,242, 96,243, 18, 50,173,165,117,225,240,134,248,161,246,199,139,144, 27, 55,110,144, 71,143, 30,
+145,252,252,124,242,252,249,115, 18, 16, 16, 80, 36, 20, 10, 47, 2,112,173,141,152, 68, 34, 73,189,120,241, 34, 9, 10, 10,202,
+ 17,139,197, 43,203,110, 46,169, 84,154,122,227,198, 13, 18, 20, 20,148, 35,145, 72,214, 0, 96, 2,192,160, 65,131,210, 8, 33,
+196,218,218, 90, 85,153, 94, 72, 72, 72, 22, 33,132,200,100,178,178,170, 38,166, 68, 34, 89, 51,101,202,148,252,123,247,238, 17,
+185, 92, 94,150,206,144, 74,165, 43,167, 78,157,154, 31, 22, 22, 86, 62,189, 90, 44, 45, 45, 19,141, 70, 35, 57,126,252, 56,177,
+177,177, 81,149,187,153, 19,141, 70, 35, 57,122,244,104,149,121,171, 46, 80, 32, 22,139, 87,140, 28, 57, 50, 47, 46, 46,142, 88,
+ 89, 89,165,150, 75, 95, 57,122,244,232,188,132,132, 4,162, 80, 40,204,202,163,149,149, 85,234,205,155, 55,201,192,129, 3,115,
+203, 31, 83, 43, 43,171,212, 91,183,110,149,165,175, 48,167, 32,179,183,183,159, 96, 99, 99,163,178,177,177, 81, 89, 88, 88, 44,
+182,179,179, 83,167,167,167, 19, 66, 8,105,212,168, 81, 90,249, 72,150,141,111,191,207, 54, 30,188,117,231,106, 84,102,122,179,
+238,147, 86,200,154,133,200,106,113, 12, 92,133, 66,225,197, 78,157, 58, 21, 37, 38, 38,146,130,130, 2, 18, 17, 17, 65,110,220,
+184, 65, 94,188,120, 65, 0,152, 51,195,128, 68, 44, 22, 39,107, 52, 26,147, 70,163, 49,165,167,167, 27,211,210,210,140,209, 43,
+237, 8,217,198,126,179,100, 31,237, 75,212, 87,151,154,164, 98, 97, 18, 0,201,123, 51, 90,161, 62,142,100,147,231,190,199,243,
+157,163,175, 46,235,169, 39,113,151,200,158, 49,214,250, 43,159, 57,188, 36, 63,123,253,151,108,242,118,170,147,230,207,222,123,
+ 34,190,118,126,186,110,225,116,125,124,124, 60,249,124,116, 79,195,185,105, 14,175,200, 70,175,131,117,209, 44,199,176, 1, 3,
+ 6,228, 39, 36, 36, 16, 31, 31,159, 2, 38,147, 57,246,223,100,178,186,121,112,147, 35,118,127,110,234,235, 43,204,124, 71,102,
+203,215,198,198, 38, 99,199,142, 29, 68, 34,145,164,213,213,108,125,216,191, 51, 41,202,185, 72,250, 7,183,170,246, 30, 25, 60,
+120, 48, 9, 12, 12, 36,211,166, 77,171,233, 94,162,188,128,126, 59,155, 53, 59,106,250,240, 67,227,206,102,205,142,122, 1,253,
+ 74, 13, 22, 5,224,203,229,203,151,135,233,245,250,176,237,219,183,135,245,235,215, 47, 12,192,231,245, 60, 22, 63,253,240,195,
+ 15, 68,175,215,147,237,219,183,147,126,253,250, 17, 0,107,235, 83, 46,149, 69,178,252,252,252, 62, 59,114,228,200,157,167, 79,
+159,166, 7, 7, 7,175,104,214,172,153,172,174,154,127, 69,196, 98,177, 91,211,166, 77,119,249,248,248, 36, 52,111,222, 92,235,
+237,237, 93,236,225,225, 17,231,235,235,187,131,199,227,185,214, 81,182,117,187,118,237,140, 87,174, 92, 33, 3, 6, 12, 32,229,
+ 76, 72,181, 84,231, 69, 8, 33,173,190,252,242,203,185, 0,200,151, 95,126, 57,151, 16,210,167,212, 79,244, 41,255,119,197,207,
+ 50,243, 84,246,127,101, 26,101, 75,101,154,149,253, 70,133,223, 65, 21,145,172,241,127,216,185, 19, 39, 78,116, 58,113,226,196,
+149,138, 59,247, 81, 67,180,157,214,214,161,168, 40, 61,133, 68, 45,249,148, 92, 14,116, 36, 55, 58,219,146,103, 51, 7,144,148,
+221,107,200,228, 22,242,194, 15, 27, 34,176,182, 70, 43, 44, 44,140,132,133,133,145,240,240,112, 18, 27, 27, 75,114,114,114,200,
+254,253,251,141, 86, 86, 86, 69, 60, 30,111, 25, 0,129, 57, 98, 82,169, 52,149, 16, 66, 52, 26, 13, 89,188,120,113,113,105,164,
+ 74, 41,147,201, 82, 9, 33, 36, 59, 59,155, 44, 91,182,172, 88, 38,147, 69, 0,176, 87, 40, 20,137, 49, 49, 49, 68,169, 84, 86,
+106,102,228,114,121,234,211,167, 79,203,140,147,131, 92, 46,143, 58,118,236,152,142, 16, 66,146,146,146,136,165,165,101, 42, 0,
+165,149,149,213,131, 19, 39, 78,232, 8, 33, 68,165, 82,149,165,155,101,180,138,138,138,200,185,115,231,222,202, 67, 89,250,233,
+211,167,223, 50, 96,102,160,148,201,100, 97,251,247,239,215, 26,141, 70, 18, 21, 21, 85,102, 18,149, 22, 22, 22,225, 7, 15, 30,
+212, 26,141, 70, 18, 29, 29,109,182, 25,108,208,160, 65, 26, 33,132, 24, 12, 6,178,113,227, 70, 77,217, 49, 45, 75,215,106,181,
+100,195,134, 13, 26,169, 84, 26, 6,160,218,232,155, 66,161, 80,105,181, 90,146,157,157, 77, 2, 2, 2,242,111,220,184, 65,114,
+115,115, 9, 33,132, 52,104,208, 32, 13, 0, 60, 59,141,253,254,206,243,252,220, 79,102,135, 30,112,109, 53,124,201,217,187,201,
+ 73, 91,142,220, 15, 83,248,134,244, 52, 39,168,201,227,241,150,217,217,217, 21, 95,187,118,205,168,211,233, 72, 66, 66, 2, 9,
+ 15, 15,127,115,141, 69, 70, 70,154,101,180, 88, 44,214,252, 59,119,238,232,140, 70,163, 41, 35, 35,195,152,150,150,102, 76, 75,
+ 75, 51, 84, 52, 90,100, 27,155,100,156, 30, 71, 78,110,158,161,229,112, 56,243,223, 79, 52, 11, 76,178,201, 51,132,108,242, 12,
+219, 49, 82,145,145, 23,190,151,144,243, 51,200,171,239, 27,146,249, 61, 37,121,166, 77,158, 97,100,147,215,135,228,219, 78,172,
+ 90,105,110,246,238, 75, 54,121,134,253,240,145, 75,230,131,176,123,228,202,149, 43,100,195,154,229,100, 90, 55,135, 2,211, 38,
+207, 48,242,179,247,192,218,104,150,135,199,227, 61,191,126,253, 58,185,122,245, 42, 89,184,112, 33, 17, 10,133, 9,239, 34,170,
+ 71,126,246,112, 33,191,120,116, 34, 91,221,237,200,239,157,254,114, 29,124, 90,217,195,161,187, 7, 55, 41,227,193, 17, 66, 94,
+191, 32,234,149, 62,164,167, 39,187,190,102,203,215,198,198, 38, 61, 46, 46,142,168,213,106,178,122,245,106, 34,149, 74,235,100,
+182, 62,236,223,153, 20,101, 95,168,214,104,133,132,132,144, 31,127,252,145,232,245,122,210,186,117,107,115, 94, 90,254, 96,182,
+ 60,129, 16, 0,115, 87,172, 88,241,198,100,133,134,134,134, 69, 70, 70,134, 57, 59, 59,159,170,199,177, 88,187, 98,197,138, 55,
+ 38, 43, 52, 52,148, 68, 70, 70, 18, 23, 23,151,196,250,148, 75,221,187,119,255, 62, 54, 54, 54,119,222,188,121, 7, 58,118,236,
+184,228,193,131, 7, 73, 39, 79,158, 12,243,243,243,235, 89, 87,205,119, 16,213, 97,149, 70,118,184,132, 16, 54, 33,164,204,188,
+178, 0,176,203, 2, 10,230, 48,114,228, 72, 97,219,182,109,195, 70,140, 24, 81,184, 99,199, 14, 18, 23, 23, 71, 34, 34, 34,200,
+138, 21, 43,200,130, 5, 11,200,182,109,219,200,192,129, 3, 11, 2, 2, 2,238,124,248,225,135,252, 90,100,211,199,213,213, 53,
+231,232,209,163,100,207,158, 61,132,195,225,156, 52,119,195,234,188, 72, 85,102,170, 42,131, 85,241,187,106,140, 88,181,134,205,
+140,223,251,163,169,170, 24, 9, 41,247,247,239,193,193,193,157,254,240,240, 33,248,110,252,172,239,249,177, 59, 86, 35,117,255,
+122, 48,179, 83,193,206,203,132,230,250, 73,232,175, 31,195,168, 54,109, 4, 2,138, 90, 84,219, 11,134,203,229,130,203,229,130,
+195,225,160,176,176, 16, 42,149, 10,237,219,183,103,132,135,135,243, 39, 76,152, 48, 67, 32, 16, 36, 0,232, 95,227,221, 76,149,
+ 68,164,111,222,188,137,113,227,198,241,118,237,218,213,220,218,218,250,161,209,104,228, 2, 64,116,116, 52,134, 12, 25,194,219,
+187,119,111, 19,123,123,251,112,157, 78, 39,228,241,120, 96, 50,153, 85,234,113,185, 92,232,245,122,158,187,187,123,196,195,135,
+ 15,125,131,131,131,217,241,241,241,136,137,137,129, 94,175,231,122,120,120, 68,134,135,135, 55,239,211,167, 15, 59, 49, 49, 17,
+241,241,241,111,242, 97, 78,126,181, 90, 45,120, 60, 30,202, 87,105, 81, 20, 5,141, 70, 3, 46,151,107,182, 22,139,197,234,226,
+229,229, 21,249,240,225, 67,191,144,144, 16,206,189,123,247,144,148,148, 4,163,209,200,245,246,246,142,124,248,240, 97,139,126,
+253,250,113, 34, 34, 34,144,154,154, 10,115,171,208,202,214,123,248,240, 33, 70,140, 24,193, 61,115,230, 76, 11, 59, 59,187, 8,
+131,193,192, 5,128,200,200, 72, 12, 25, 50,132,123,246,236, 89, 63, 39, 39,167,136, 26,170, 18,153, 0,160,215,235, 49, 97,194,
+ 4,145, 84, 42, 69, 98, 98, 34, 76, 38, 19,140, 70, 35, 0, 32, 51, 43, 51,242, 97,100, 84,244,168, 97, 31,117, 42,210,105, 52,
+183,238,222,127,210,168,129,139, 35, 69,145, 6, 53,100,181,191, 72, 36, 74, 88,185,114,229,103,113,113,113, 60, 47, 47, 47,198,
+171, 87,175,144,151,151, 7, 14,135,243,230, 26, 51,119,191,185, 92,110,103, 31, 31, 31, 86,113,113, 49, 76, 38, 19, 0, 16, 6,
+163,242, 22, 43,252,236,235,240, 86, 26,216, 2,129,160,243,123,121,122,231,250, 88,193,132,238,241,233, 90, 30,207,194, 81, 34,
+182,243, 0, 18,174,162,161, 53, 15, 76, 6,147,127, 47,166, 80, 4,144,238,112,206,176,170,157,166,169,123, 76,154,150,167,183,
+108, 34,182,119,116, 70,102,102, 38,156, 26,121,161,152,107,205,189,249,162, 64, 12,170,150,154,255, 79, 7,119,119,119, 91, 55,
+ 55, 55,100,100,100,192,207,207, 15,114,185, 92, 14,160,123,157, 31, 58,219, 93,120,200, 69, 59,128,177, 18, 70,106, 33,244,172,
+165,120,145,238, 71, 54,249,177,255, 74, 38, 75, 42,230,222,222,187,111,191,131,149,179, 55,112,242, 19, 40, 45,120,216, 58,201,
+207,210, 90,198, 59, 90, 71,179,229,171, 84, 42, 47,221,185,115, 71,193,231,243, 17, 30, 30, 14, 31, 31, 31,172, 94,189,218, 90,
+ 46,151, 95,173, 91,100,139,128, 80, 85,155,172,142, 29, 59, 98,234,212,169,216,181,107, 23, 44, 45, 45, 49, 98,196,136,154,204,
+ 22,137, 6,142,255, 16, 17,177,125,215,203,151, 39, 70, 54,110, 28, 60,194,195, 99,241,196,161, 67,199, 78,159, 62, 29,203,151,
+ 47,199,209,163, 71,209,174, 93, 59,140, 31, 63, 94,159,144,144,176,179,174, 85, 85, 43, 87,174,156, 54, 99,198,140,138,154,186,
+248,248,248, 31,234, 85, 46,101,102, 70, 70, 68, 68, 68, 15, 27, 54,172, 83,113,113,177,230,238,221,187, 79, 92, 93, 93, 29, 1,
+ 52,168,171,102, 61, 12, 22, 69, 8,225, 3, 16,150, 46, 34, 0,194,189,123,247,202, 66, 66, 66,164,165,105,130,210,165,198,234,
+125, 31, 31, 31,199,231,207,159, 39,207,156, 57,211,111,215,174, 93, 2,161, 80,136,236,236,108,252,242,203, 47,152, 59,119, 46,
+ 40,138, 2, 33, 4,219,182,109, 19,142, 25, 51,166,213,203,151, 47,147, 93, 92, 92,204,105,210,194, 19,139,197, 7, 23, 47, 94,
+ 44, 53,153, 76,152, 51,103, 78,134, 78,167,155, 90,250,221, 60, 11, 11,139,219, 40, 49,220,213, 81,169, 23, 41,247,172, 60, 81,
+225,216, 4, 87, 76,171,248, 29, 33, 36,184, 58,141, 90,158,139,202,126,239,100,117,102,171,252, 19,168,115,165, 46, 18,104,102,
+235,234,137,156,243, 7, 33, 96, 81, 16, 48, 75, 23, 22, 5,198,171, 72, 56,241,217,208, 19,226, 91, 87,163, 85,182,176,217,108,
+ 20, 22, 22,194,104, 52, 98,238,220,185,188,115,231,206, 89, 49, 24,140,255,214,164, 83,222, 48, 61,123,246, 12,222,222,222,212,
+241,227,199,149, 83,167, 78, 21,148,253, 78, 78, 78, 14,220,220,220,168,211,167, 79,219,124,253,245,215,226,234,204, 12, 69, 81,
+224,112, 56,152, 49, 99,134,224,238,221,187,150,246,246,246,120,245,234, 21, 94,191,126, 13,177, 88,140, 25, 51,102, 8,238,220,
+185, 99,109,111,111,143,184,184, 56,228,228,228, 64, 44, 22,215,218,104,113, 56,156,183,182,161, 40, 10, 58,157,174, 86,198, 64,
+ 38,147,237, 9, 11, 11,179,150,201,100,136,136,136,128,193, 96,128, 76, 38,195,180,105,211, 4, 97, 97, 97,214, 22, 22, 22,136,
+142,142, 6, 33, 4, 82,169,180, 86,121, 4, 0,147,201,132,232,232,104, 52,104,208, 0, 87,175, 94,181,153, 56,113, 34,191, 44,
+253,197,139, 23,112,116,116,196,213,171, 87,109, 68, 34,209,158,170,180, 76, 38, 19, 82, 82, 82,240,232,209, 35,188,122,245, 10,
+233,233,233,200,200,200, 64, 94, 94, 30, 12, 6, 3, 0, 64,152,151,123,114,239,129,227, 15, 5, 2,129,208,199,195,221, 57, 50,
+234,113,154, 64, 32, 16,186, 56, 59,123, 0,223, 50,170, 49,132,255,141,143,143,183, 26, 51,102, 12, 71,173, 86, 35, 43, 43, 11,
+ 44, 22,235, 15,215, 22,151,107, 94, 83, 32,131,193,224,205,231,243, 41,157, 78,247, 38, 2,198,229,114,241,217,158, 66,248,204,
+199, 91,203,208, 53,105, 32, 70, 61,180, 90,173,247,255, 60,154, 5, 80,160,180,238,160, 40,191,219,175, 10, 44, 59, 4, 15,227,
+ 32,230, 12, 96,210, 3, 12, 22, 58, 55,115,100, 29,141, 44, 80,130,160, 25, 52,240, 34,164,230,158, 95, 4,160, 0,157, 27, 64,
+125,112,238,185,193,170,221,128, 73,156,228,228,100,112, 56, 28,240,120, 60,248,117, 25,196,218,251, 80,111, 11, 10,205,161,131,
+167, 57,154,111,133, 29, 5,130,111, 22, 44, 88, 32, 42,175, 57,118,236, 88,145, 76, 38, 91, 80,103,147, 85, 32,108, 3, 3,153,
+241, 40,185,176,193,226,147,106,239,151,105, 69,158, 32,100, 38,160,111,241, 14,204, 86,103, 30,143, 23, 3,160,125,189, 76,150,
+132,123,107,223,190,253, 14,150, 78, 37, 38, 11,134, 98,128, 45,128,173,181, 5,182,126, 22,104,105,109, 33,168,173,217,242, 85,
+ 42,149, 23,111,223,190,173,224,243,249, 8, 11, 11, 3,135,195, 1,159,207, 71,211,166, 77,177,105,211, 38,107, 75, 75,203, 90,
+155, 45, 2, 82,105,204,183,127,255,254,164, 99,199,142,152, 50,101, 10,118,238,220, 9,173, 86,139,197,139, 23, 35, 62, 62,222,
+ 44,217,104,224,248,178,136,136, 29, 75, 31, 61,122,246,165,175,175, 87,127,145,200,114,202,136, 17,178,175,191,254,250,196,177,
+ 99,199,182,247,233,211, 39,227,238,221,187, 63, 2, 56, 88,203,195, 75, 1, 8, 93,181,106,213,148, 50,227,246,245,215, 95,111,
+ 59,118,236,216,210, 62,125,250,164,220,189,123,119, 38,128,208,250,148, 75, 38,147,233,228,127,255,251,223,135, 2,129, 64,232,
+233,233,233, 28, 21, 21,149, 38, 16, 8,132,206,206,206, 30,157, 58,117, 98,212, 69,179, 46,216,216,216,116,189,125,251,182, 15,
+ 74, 58,141,241,202,140, 86, 84, 84,148, 69,110,110,174,133, 88, 44,182,176,179,179,147,148,153,173, 1, 3, 6, 88,176, 88,172,
+106,175,219,252,252,252, 99,243,230,205,147, 13, 24, 48,160,236,127, 92,191,126, 29, 59,119,238,132, 72, 36,122,107,221,126,253,
+250, 97,220,184,113,114,173, 86,251, 95, 51,178, 59,122,194,132, 9,158, 74,165, 18,223,124,243,141, 38, 57, 57,185, 43,128,120,
+ 0,178,110,221,186,125, 31, 21, 21, 21,208,170, 85,171, 3, 0,252,171,187,247, 42,243, 34,229,141,142, 57,105,117, 93,223, 92,
+179, 85, 33,169,202, 49,180,222, 50, 90,193,193,193, 87, 80, 69, 79, 42,221,235, 84,240, 96,132,128, 73, 65,200, 44,103,182, 96,
+ 2, 43, 39, 13, 84, 29,122,169, 84,246, 48,228,114,185, 96, 50,153,208,106,181, 48,119,162,234, 50, 83, 32,149, 74, 33, 22,139,
+ 81, 84, 84, 4,131,193, 0, 62,159, 95,102, 70, 32,149, 74,193,102,179,193,102,179,193,231,243,255, 16, 77,170, 24,205,225,112,
+ 56, 16,137, 68, 72, 73, 73, 65,124,124, 60, 76, 38, 19,196, 98, 49, 68, 34, 17,184, 92, 46, 84, 42, 21, 84, 42, 21, 8, 33, 16,
+137, 68, 16,137, 68,168, 77,131,107,163,209, 88,233,195, 95,175,215,215, 42,162,101, 48, 24,240,228,201, 19, 36, 36, 36,128,207,
+231,191,217, 87, 30,143,135, 23, 47, 94, 64,173, 86, 67, 40, 20, 66, 42,149, 66, 38,147,153,173, 91,182, 47, 18,137, 4, 2,129,
+ 0, 89, 89, 89, 40, 44, 44,124,115, 76,165, 82, 41, 68, 34, 17,114,114,114,144,150,150, 86,237,190, 27,141, 70,168, 84, 42,164,
+167,167, 35, 49, 49, 17, 25, 25, 25,111, 10,160,210,168, 81,253, 2, 59,185,185,200,204,204,124, 19,137,172,106, 49, 7,147,201,
+132,188,188, 60,220,190,125,155, 50,153, 76,200,206,206, 54,165,171,213,198,201, 42, 46,142,126,251, 51,217,127,230, 65,241,222,
+ 83, 97, 69,135, 47, 62, 42, 10, 61, 28, 89,196, 15, 88,104,192,251, 96,131,175, 12,122,118, 80, 70,190,158,151,174,227,200,148,
+190,221,128,152,211, 0,131, 5,240,229,104,221,164, 33,226,179,140,162,167,169, 90, 62, 40,244, 64,168,135,220, 44, 77, 35,187,
+123,122,158,158, 23,167,179,150,122, 55,243, 71,106,106, 42,120, 60, 30,120, 60, 30, 62,104,215, 13, 49,153, 70,225,227,228, 34,
+ 33, 8,130,204,210,252,127, 26,137,197,226, 54,237,219,183,167,202,107,246,238,221, 27, 20, 69, 53, 5,224, 85,171, 66,110,109,
+ 35, 46,116,194,214, 96,145, 25,143, 83, 10,237,143, 70, 21,123,244,237, 63,200,242,167, 11,105,222, 79,212, 26, 87, 16,253, 44,
+ 16,157,127, 61,204, 86, 39,137, 68,114, 98,221,186,117,174,124, 62,255, 52,128, 14,117, 17, 17, 11,152, 27,191,153, 50,204, 65,
+ 94,102,178,244,133, 0, 75, 0,176, 5, 0, 75, 0, 91, 27, 5, 22,141,235,110, 41,228,179, 15,215,194,176,238, 13, 13, 13,181,
+174,104,178,202, 22, 63, 63, 63,204,159, 63,223,218,210,210,114,143, 57,122, 43, 87, 44, 39,217, 57, 57, 0, 1,114,115,243,177,
+114,197,242,172,178,239, 6, 12, 24, 64, 58,116,232,128, 41, 83,166, 96,233,210,165, 56,117,234, 20, 90,183,110,141,241,227,199,
+163, 85,171, 86, 53, 73, 7,201,100,178, 93,221,186,117,187,173,146, 72,198,165,248,251,115, 47,202,100, 57, 93,115,114,100, 46,
+ 81, 81, 58, 79, 32, 18,192,134,164,164,164,158,181, 48, 89, 67,165, 82,105, 88,215,174, 93,117, 18,137, 36, 97,245,234,213,147,
+167, 78,157,138,229,203,151, 99,222,188,121,191, 0,248, 15,128,175,146,146,146,236,171, 51, 89,127, 86,185,244,103,149,117, 70,
+163, 49,241,224,193,131,173,116, 58,157, 99,105,245, 32, 47, 59, 59, 91,250,250,245,107,137, 78,167, 19,153, 76, 38,145,133,133,
+133, 24,128,112,212,168, 81,172,199,143, 31,123, 27, 12,134,228,234, 52,213,106,245,240, 57,115,230,100,100,100,100, 0, 0,154,
+ 54,109,138,236,236,108,124,254,249,231,248,244,211,146, 14,193, 45, 90,180, 0, 33, 4,169,169,169, 88,185,114,101,170, 90,173,
+254,216,140,236, 54,118,119,119, 71, 84, 84, 20,158, 60,121,114, 1,128, 9, 37,237, 88,115, 30, 60,120,240, 48, 61, 61, 29,123,
+246,236,225, 56, 56, 56, 28, 67, 21, 67,188, 84,231, 69,234, 2, 69, 81, 39,235,178, 93, 89,228,170,178,136, 88, 21, 84, 31,209,
+ 10, 14, 14,166,202,127,190, 21, 49,162, 16,145,112,255, 42, 44,125,253,223,138,102, 9,153, 20, 4, 82, 25, 98, 18,227,193, 1,
+245,232, 93, 25,173,172,172, 44, 76,158, 60,185,104,248,240,225,153, 38,147,105,144,185,166, 64, 38,147, 65, 38,147,225,241,227,
+199,100,224,192,129,169,171, 87,175, 46, 42,111,180,158, 61,123, 70,130,130,130,210, 22, 44, 88,144, 95,157,209, 42,139,104, 45,
+ 91,182,172,168,115,231,206,233,143, 30, 61, 34,101,102, 74, 44, 22, 99,229,255,177,119,221,225, 81, 84,111,247,204,204,246,150,
+ 94, 73, 72, 8,161, 36, 64, 32,132, 22, 64, 80, 32, 64, 64, 58, 34,130,136,130, 34, 69, 68, 20, 17, 21,233, 2,210,155, 82, 20,
+ 69,105, 2,130,210, 17, 8, 85,105, 9, 45,148, 52, 72, 47,155, 77,207,246,221,153,185,223, 31, 73, 48, 64,202, 38,168, 63,245,
+219,243, 60,243,108,246,238,204,201,109,115,231,204,123,239,125,223, 21, 43, 12, 61,122,244, 80, 95,187,118,141, 84,164,213,197,
+162, 69,211,244, 35,161, 85,249, 26,154,166,193,243,124,157,132,150, 78,167, 27,253,226,139, 47,170,239,223,191, 79, 42,202,233,
+232,232,136, 85,171, 86, 25,122,247,238,173,190,115,231, 14,169, 72,115,112,112,176, 89, 12, 86,252,127,149, 74, 5, 7, 7, 7,
+220,189,123,151,244,233,211, 71,189,110,221, 58, 99,229,244,123,247,238,145, 65,131, 6,169, 75, 75, 75, 71,215, 36, 94, 42,166,
+243, 88,150,133,209,104, 68, 94, 94, 30,210,211,211, 31,153,211, 13, 10,135,200, 81, 47, 15, 12, 53, 24, 12,250,187,241, 9,105,
+173, 67, 90,122, 24, 12, 6,125,106, 90, 90, 60, 48,143,175,129,123,120,171, 86,173,242, 39, 79,158,108, 40, 44, 44,124,102,161,
+ 37, 22,139,239, 11, 4, 2,210,173, 91, 55, 98, 54,155, 73,122,122,186, 53,175,176,144, 13, 94,188,152,220,153, 62,157,146, 69,
+ 71, 75,148, 74, 37, 85,206, 73, 63,120,240,128,151,201,100,247,255,118,161, 69,243, 94,160,200,115, 23, 18,180, 78,189, 7,142,
+ 20, 83, 57, 87, 1,139, 22,144, 56, 3, 18,103, 8, 20,174,232,215,173, 45,179,237,114,137, 23, 8,223, 5, 34,137,111,173,156,
+ 66,226, 9,240,221, 78,198, 27,157,159,123,105,170,184,160,160, 0, 12,195, 60, 18, 69,114,133, 2,189,134,188, 70,127,123,213,
+228, 5,144,174,160, 24,223, 58,220,235, 51, 63,251,236, 51, 81, 97, 97, 33,104,154,254,131, 83, 46,199,196,137, 19, 37, 14, 14,
+ 14,179,109, 30,252,246,182, 16, 65, 40, 9, 7,200,123,113, 57,198, 6, 7,111, 27,130, 62, 88,186, 85,214,170,109, 71,188,253,
+130,135,108,233,145,220, 86, 55,211, 13,141, 1,110, 58, 88,115,251,122,136,173,110, 42,149,234, 72,116,116,180,188,127,255,254,
+ 88,177, 98,133, 66, 38,147, 29,171,207,192,175,211,114,239, 44, 88,247,131,250,214,234,190,128, 69, 87, 38,176, 42, 29,185, 90,
+ 30,115,182, 70, 21, 91,173,100,148,173,156, 6,131, 97,236,155,111,190,153,191,127,255,254,167, 68,150, 84, 42, 69,114,114, 50,
+ 62,255,252,243,130,130,130,130, 90, 31,138,171, 86,174,136,137,189,121, 6,223,126,189, 0, 0,193,250, 85,147,112,233,194,110,
+167, 23,158,239, 78, 26, 53,106, 68, 58,118,236,136,201,147, 39, 99,209,162, 69,136,139,139,131,155,155, 27, 38, 77,154,132,231,
+159,127, 30, 43, 87,174,172,105,144,234,243,206, 59,239,124,158,145,145, 17,116,242,228, 73,129, 70,163,241, 88,249,205, 55,197,
+251,138,139, 11,150,196,198,198,125, 18, 18,210,108, 86,155, 54,175,215,224,250,161, 74,145, 53,101,202,148, 93, 25, 25, 25, 97,
+167, 78,157, 18,106, 52, 26,223, 41, 83,166, 96,249,242,229,152, 61,123,246,102, 0,111,195,182, 13, 47, 54,143, 75, 12,195, 68,
+ 14, 31, 62, 60,212, 96, 48,232,227,226,226,210, 66, 66, 66, 60, 12, 6,131, 62, 45, 45, 45,254,220,185,115,124,125, 56,235,131,
+252,252,252,164,157, 59,119,198, 79,157, 58, 53, 44, 35, 35,163, 5, 0,215,210,210, 82, 69,105,105,169,196,108, 54,203,156,157,
+157,157,219,182,109,235, 54, 97,194, 4,229,141, 27, 55, 90,100,100,100,104,203,173, 72,213,194, 98,177,196, 21, 22, 22, 14,232,
+219,183,111, 81, 97, 97, 33,218,180,105,131,129, 3, 7,194,203,203, 11, 13, 26, 52,192,224,193,131,209,188,121,115,228,231,231,
+ 99,212,168, 81, 5, 26,141,166, 47,128, 7, 54,100, 55, 41, 39, 39, 7, 93,186,116,193,130, 5, 11, 6,140, 24, 49,226, 78,183,
+110,221, 74, 66, 66, 66,244,190,190,190,193,107,215,174,133,143,143, 15,246,238,221,235, 45,145, 72,118, 86, 33,178,170,213, 34,
+ 0, 52,229,130,199,252,196,167,166,150,223,108,189,182,202,191,109, 56,239, 73,177, 85,249,120,106,234,176,234, 6, 1,230,124,
+191,119,155, 81,236,215, 20,142, 65,161,144, 75,165,144,137,197,144, 57,187,194,196,243,248, 38, 57, 71,175, 35,100,118, 93, 59,
+207,147, 15, 66,138,162,176, 97,195, 6,182,115,231,206,198,168,168,168,245, 6,131,193, 15,101, 94,101,109, 22, 5,235,214,173,
+211, 79,155, 54,237,102,110,110,110,168, 84, 42, 53, 87,164,175, 95,191, 94,255,218,107,175,197,102,100,100,132,201,229,114,125,
+117,235,179, 42, 11, 45,137, 68, 98,202,205,205,237, 56,126,252,248,251, 95,125,245,149, 78, 46,151, 67,161, 80, 64, 34,145,152,
+115,115,115, 67, 39, 79,158,124,115,249,242,229,122,153, 76, 6,133, 66, 81,167,105, 57, 66,200, 83,130,170,114,186,173, 96, 89,
+ 54, 42, 55, 55, 55,116,218,180,105, 55,214,174, 93,171,171, 16, 64,149,243,184,114,229, 74,189, 82,169,172,147, 69,171,226, 60,
+133, 66,129, 53,107,214,232,167, 78,157,122, 51, 55, 55, 55, 84, 34,145,152, 43,165,235,222,121,231,157, 27,185,185,185,161, 44,
+203, 70,213,240, 54,198,149,148,148, 64, 32, 16, 32, 54, 54,214, 36, 18,137, 64,211, 52, 18, 19, 19, 31, 13, 62, 46, 46, 46, 45,
+ 67, 91,135, 4,255,176,107,239, 57,153, 72, 34,233,220,177,125,139, 7, 41,169, 25,132, 80, 41,181,100,245,103,131,193,224, 23,
+ 21, 21,181,190,115,231,206,198, 13, 27, 54,176,213, 89,182,108,129,201,100, 58,119,253,250,117,171, 84, 42,165,178,179,179, 89,
+134, 97,192,113, 28, 49,117,236,104,106,189,118, 45,185, 59,107, 22,229,160, 80, 8, 68, 34, 17,228,114, 57,117,252,248,113,179,
+ 94,175, 63,247,247, 11, 45,200, 65, 65,150,144,107, 82, 73,105,150, 66,252,207,101, 34, 75,234, 4, 72,157, 1,169, 51,124,124,
+124,113, 53, 89,175, 2, 13, 49, 56, 27,124,136, 17,162, 0, 5,121,172, 26, 42,161, 88, 70,229,228,228, 60, 18, 68, 21, 71, 64,
+211, 22,184,158,170, 85,130, 34, 18, 48,168,139, 11,146, 1,174,174,174,130,236,236,236,167, 56, 91,182,108,201, 88,173, 86,219,
+ 93,187,100,113,222, 0, 63, 37, 62,199,232,125,224,166, 46,104,250,146,111,101, 50,174, 8,136, 94,135, 86,129, 13, 48,253,165,
+182,226, 79, 15,106, 90, 93, 75,209, 7,130, 33,111,131,215,186,215, 33,159,207,169, 84,170, 99,215,174, 93,147,171, 84, 42, 60,
+120,240, 0, 29, 59,118,196,150, 45, 91,228,114,185,252, 40,128, 58,173,199,187,162, 70,170,182,148,235, 60,115,111, 90,206,173,
+108,246, 49,145,165,209, 17,188,249,197,193,162,194, 18,227,240,203,233,213,223, 63, 85,224, 70, 81, 81, 81,159,217,179,103,231,
+107, 52,154,199, 68, 86,106,106,106,197, 67,241, 5, 0,181,190,252,158, 61,115, 34,108,241,162,105,184, 22,125, 7,253, 6,188,
+135,235,183,146,240,201, 71, 67,224,228, 32, 67, 84, 84, 20,134, 14, 29,138, 5, 11, 22, 32, 49, 49, 17, 63,254,248, 35,181,101,
+203, 22,234,242,229,203,212, 23, 95,124, 65,213,178,164,225,213, 37, 75,150,224,218,181,107,232,223,191, 63,206,159, 63,143,130,
+130, 2,236, 62,118, 44, 97,103, 66,194, 39, 21,107,182,170,113,253, 80, 37, 28, 28, 28, 62, 88,178,100, 9,162,163,163, 31,113,
+230,231,231, 99,201,146, 37, 25, 0, 38,213, 69,100,213,101, 92,106,211,166, 77,240,174, 93,187,206, 73,165, 82, 73,199,142, 29,
+ 91, 36, 39, 39,103, 0, 72,169, 7,103,201,179,204, 84,229,229,229,253,190,101,203,150,203, 61,123,246,148,143, 29, 59,214,253,
+151, 95,126,113,213,235,245, 13, 36, 18,137,135,217,108, 22,223,187,119,143,217,183,111,159,215,221,187,119,147,141, 70,227, 85,
+ 91,234, 35, 55, 55,247,106, 92, 92, 92,223, 54,109,218,220, 91,191,126,125,134,183,183, 55, 63, 97,194, 4,188,249,230,155,112,
+119,119,231,214,172, 89,147,214,173, 91,183,216,164,164,164, 8,189, 94,127,219,198,188,126,183,120,241,226,223,118,237,218,133,
+129, 3, 7,226,139, 47,190,192,238,221,187,113,230,204, 25,217,133, 11, 23,196, 91,182,108,129, 72, 36, 66,120,120, 56,250,244,
+233,211,171,124,186,211,214,231,210, 53,138,162,142, 80, 20,117,234,137,207,107, 53,253, 86,135,107,171,251,187,198,243,158,200,
+230,150, 39, 14,219,241,106, 32,230, 77, 12, 81,233,127, 31, 19, 78,114, 38, 60, 71,212, 35, 91,144,139,207,187,144,241, 77, 40,
+221,216,122,186,119, 48, 24, 12,143,142,253,251,247, 19, 47, 47, 47,157, 74,165,170,179,123, 7, 47, 47, 47,117, 73, 73, 9,233,
+208,161, 67,129,187,187,251, 35, 87, 4,222,222,222,106,157, 78, 71,194,195,195, 11, 60, 60, 60, 30,185,119,240,245,245, 77, 39,
+132, 16,127,127,255,172,234, 38,158,227,147, 0, 0, 32, 0, 73, 68, 65, 84,248, 88,150, 37, 94, 94, 94, 21, 59,244,132, 46, 46,
+ 46, 27, 59,117,234, 84,160, 86,171,137,183,183,247, 35,215, 9,238,238,238, 43, 58,118,236,248,100,122,109,249, 77,207,200,200,
+ 32, 25, 25, 25,164, 97,195,134, 89,149,211, 83, 83, 83, 73,106,106, 42,241,245,245,173,179,123, 7,119,119,247,229, 85,228,165,
+ 94,121,244,243,243, 83, 27, 12, 6,210,165, 75,151,199,234,212,207,207, 79,109, 52, 26, 43,210,109,114,239, 32,147,201,222,150,
+ 74,165, 89, 82,169, 52, 75, 34,145,124,222,168, 81,163,220, 61,123,246,144, 53,107,214, 84,108, 73,135,123,203, 65,157,155,118,
+121,253, 19,247,150,131, 63,120, 22,247, 14, 42,149,234,180,151,151,151,110,255,254,253,143,245, 47,131,193, 96,179,123, 7,153,
+ 76,150,161,213,106,121,181, 90,109,253,237,183,223,244,209,209,209,250,216,216, 88,125,114,114,178, 33, 63, 55,215,162, 86,171,
+ 13,197,197,197,166,155, 55,111,154,228,242,255,141,123, 7,178,165,121, 83,178, 49,248, 96,210,130,128,187,211,186,203,141,183,
+ 23,133, 18,242,211, 80, 66,142,190, 73, 72,212, 76,114,117,243, 4,210, 37, 64,194,253, 54,163, 97, 60,217, 20,116,192, 22,151,
+ 12,100, 75,235,166,100, 99,240,209,132,249, 1,119,199,118,107, 96,252,230,171, 53,228,202,149, 43, 36, 54, 54,150, 60,120,240,
+128, 28,253,121, 15,233, 18, 40, 47,227,220, 24,124,176,142,110, 30,186, 74, 36, 18,237,170, 85,171,200,229,203,151, 31,113, 30,
+ 60,120,144,200,229,114, 61, 96,219,174,101, 2, 80,100, 99,203, 33,236, 87, 65, 23, 62,237,173, 44,205, 63, 60,147,144,219,219,
+ 8,217,210,138,144,239, 58, 17,178,231, 69, 66, 14,189, 78, 46,175,121,137,116, 13, 16, 89,201,166,160,243,100,115, 75,155, 23,
+219, 11,133,194,146,253,251,247,147,172,172, 44,114,254,252,121, 18, 29, 29, 77,238,223,191, 79,210,210,210,200,145, 35, 71,136,
+ 80, 40, 52,162, 30, 97,203, 58,121,194, 63,162,153, 40,251,230,210,174,132,252, 50,138,104,118,190, 74, 6,132,168, 10,194, 27,
+ 62,147, 63,186,182,174,174,174,121, 71,142, 28, 33,201,201,201,228,220,185,115,196,195,195, 35, 15,128,205,235,101, 7,244,235,
+ 70,136,249, 38,233,209, 61,132,180,105, 19, 66,158,239,218,140,100, 38,173, 35, 29,219, 53, 34, 27, 55,110, 36,106,181,154, 52,
+106,212,136,212, 53, 99, 17, 17, 17, 87, 8, 33, 49,253,251,247,143, 1,112, 60, 34, 34, 34,230,225,195,135, 49, 29, 59,118,188,
+140,154, 93, 63, 84,139, 94,189,122, 89, 8, 33,164,127,255,254, 4, 64, 86, 68, 68, 4,121,248,240, 33,233,216,177,163,185, 62,
+149,103,203,184, 20, 22, 22,214,185,103,207,158,159,132,133,133,125, 96,139,123,135, 90, 56,255, 44, 39,212, 12,202,156,127,182,
+ 4,208,190,252,104, 81,158,198, 60, 3,231,235, 66,161,240, 27, 23, 23,151, 51,206,206,206, 81, 12,195,108, 1, 48, 6,245,243,
+111, 70,151, 91, 24,127,117,119,119, 79,108,211,166,141,161,111,223,190,164, 95,191,126,100,202,148, 41,132,231,121,178,103,207,
+ 30,178, 96,193, 2,210,196,213,149, 93, 3,228,109, 2,222,128, 29,101, 14, 75,223, 8,164,206,141,110,140,210, 81,141,161, 29,
+215,132,178,197, 97,105, 68,117, 66,139,231,121, 18, 31, 31, 79,122,244,232,161, 83, 40, 20,153,176,221, 97,233, 99,156,110,110,
+110,209, 30, 30, 30, 79, 57,209,172,148,254,152,195, 82, 15, 15,143,223,189,189,189,213,238,238,238,215,171,226,116,115,115,139,
+246,246,246, 86,187,185,185, 61,230,220,147, 97,152,254,110,110,110,153, 79,166, 11, 4,130,158, 30, 30, 30,233, 79,166, 87, 83,
+118,120,121,121,165,103,101,101, 17,141, 70, 67,252,252,252,178,158, 20, 96, 57, 57, 57,143, 9, 48, 91, 56,107,203, 75, 13,121,
+172,146,211,134, 58,173, 79,187, 87,160,185,143,143, 79,238,202,149, 43,137, 82,169,124,108,203,115, 80,247,113,159, 93, 73,208,
+150,188,249,209,198, 61, 85, 56, 44,181,213, 57,104, 95,133, 66,145,217,163, 71, 15, 93,124,124, 60,225,121,158,240, 60, 95,157,
+208,170,138, 51,178,125,251,246,249,121,121,121, 92,105,105, 41,155,158,158,110,122,248,240,161, 97,209,162, 69, 22,141, 70, 99,
+212,106,181,230, 91,183,110,153,188,189,189, 53, 0, 34,235,218, 70,245, 68,196,147,211,103,100,115,139,174,100, 83,139, 35,247,
+231,250,223,123,189,147,194, 20,179,178, 63, 33, 81, 51,201,229,141,111,146,206, 1,226, 50, 65,180, 57,248, 24,249,182,121,119,
+178, 46, 80,108, 19,231, 55, 77,186,145,205,193,199,238,206,241,191, 55,180,157,187,121,215,182,205, 36, 49, 49,145, 28,220,183,
+147,132, 55, 46, 23, 89,155, 90,252, 74, 54,182,232, 97, 11,103, 85, 98,107,235,214,173, 36, 49, 49,145, 28, 56,112,192, 86,145,
+ 21, 81,149,208,250, 56, 66, 89,244,102, 39,169,105, 84, 91,177,121,112, 43,145,165, 79, 83, 17,219,197, 95,192,133,122,211,124,
+ 11,119,144, 62, 65, 50, 19,217, 20,116,158,108,106,209,215,214,124,138,197,226, 52, 84,242,169,243,228, 33,145, 72, 52, 53, 8,
+173,136, 90,197, 86,115, 73,246,233, 5, 61,201,192, 54,170,124, 27, 69, 86,109,125,169,173,155,155, 91,222,119,223,125, 71, 60,
+ 61, 61, 53, 54,138,172, 71,156,131, 6,244, 33,169, 73, 71,201,129, 61, 75, 72,143,238, 45,200,246,173,211,200,149,243,115,201,
+139,253,122,144,136,136, 8,146,151,151, 71,122,246,236, 73,234,154, 79, 71, 71,199,237, 90,173, 54,230,196,137, 19, 49, 17, 17,
+ 17, 49,219,183,111,143,185,120,241, 98,140, 92, 46,223, 94, 97,156,120, 82,108,181,120,122,252,143,120,194,162, 21, 83, 90, 90,
+ 74, 78,156, 56, 65, 34, 34, 34,200,246,237,219,201,197,139, 23,137, 92, 46,143,169,239,125,100,235,184,212,187,119,239,207,146,
+147,147, 75,230,204,153,179,167, 10,135,165,182,114, 38,254, 73,249,252, 83,198,144,255, 1,167, 74, 38,147,197,220,188,121,147,
+ 20, 22, 22,146, 16, 79, 79,178,152, 97, 72,134, 72, 68,178, 68, 34,178, 17, 40,248, 15,200,164, 9,213, 77, 29,254,213,168, 82,
+104, 25,141, 70, 50, 99,198, 12,179, 84, 42,213,139, 68,162,186,134,224,249, 87,119, 66, 55, 55,183,223, 61, 61, 61,213,158,158,
+158,143,137,189,202,233,110,110,110,215,255,227, 55, 96,115,145, 72,148, 42, 20, 10, 31, 15,193,211,114, 80,231, 38, 93,199,206,
+246,108, 53,168,223, 51,230, 83, 36, 18,137, 62,150, 74,165,250, 25, 51,102,152,181, 90,109, 93,132, 22, 0,244,150,203,229,153,
+223,127,255,189, 33, 33, 33,193, 90, 80, 80,192, 94,185,114,197, 26, 29, 29,109,158, 55,111, 94,169, 92, 46,207, 68,245,110, 9,
+254,150,250, 36,235, 2,197, 21, 98,235,246,108,255,251, 3, 67,228,150, 45,239,247, 33,157, 27, 61, 33,178,170,247,228, 94, 53,
+103,185,216,186,241,169,223,253, 30,205,149,236,146,217,211, 73,120, 99,217,227, 34,171, 14,156, 79,138, 45,185, 92, 94, 58,119,
+238,220,186, 88,178, 30, 23,132,223, 4,249,145,205,193,219,203, 68, 84, 45,199,198,160,175,201,134, 32,191,127,202,125,212,201,
+ 19,254,189,154, 75,238,212,193,146,101, 75, 62,219, 58, 59, 59,223,171,131, 37,235, 17,231,134, 13,235,201,171, 35,123,147,164,
+123,251,137, 54,255, 40,185,126,105, 21, 25, 54, 40,140,132,135,119, 36,155, 55,111, 38,113,113,113,164, 67,135, 14,164, 30,249,
+236, 51,113,226,196,152,135, 15, 31,198, 60,120,240, 32,230,226,197,139, 49, 67,134, 12,137, 1,208,167,242, 76, 80,133,216,178,
+ 12, 27,102,106, 75,211,211,107,225,124,101,226,196,137,228,225,195,135,228,193,131, 7,228,226,197,139,100,200,144, 33, 4,117,
+ 11,223, 83,175,113, 41, 44, 44,172,115,143, 30, 61,102,183,107,215,174,223,159,197,249,255, 80,104, 41,134, 14, 29,202,115, 28,
+ 71,250,245,235,199,173, 5,138,182, 80,148,122, 11, 69,169, 55, 3,154,255,186, 69,235,175, 14,248, 25, 1,224, 84,229, 4,169,
+ 84,170, 54, 26,141,238, 74,165,242,103,173, 86, 59, 21,101,219, 34,159,137,243,175,200,167,157,243, 63,193,233,173, 84, 42,215,
+107,181,218, 33, 82,169, 84, 99, 52, 26, 61,235,192,233, 36,145, 72,166, 75,165,210, 30,122,189,190, 57, 0, 40, 20,138,120,147,
+201,116,198, 96, 48,172, 6, 80,244,191, 46, 59, 89, 23, 40,134, 88,220, 30, 4,179, 98,210,116,141,151,156, 40,240,127,191,167,
+115, 90,151, 38,138,100, 8,249, 47, 64,153,174, 82,111,164,154,234,204, 41,163, 58,130, 19,206,186,154,162,111,244,197,201, 82,
+255, 15,122, 40,211,186, 4, 42,211, 64,240, 5, 36,250, 75,117,229,124, 82,108, 41, 20,138,239,117, 58,221, 91, 0,206,212,181,
+236,100,111, 11, 17,116, 86, 31, 88,153, 16,144, 26, 66,248, 16,162, 7,205,196, 34, 7,106,106,222, 61,139,253, 62,170,154,243,
+171,175,190, 36,167, 78, 30,133, 73, 95,128,236,220, 18,188, 58,102, 28,218,182, 13,131,155,155, 27, 22, 47, 94,140,166, 77,155,
+ 98,193,130, 5, 84, 61,242,217, 71,169, 84,190, 26, 28, 28, 28,120,247,238,221, 7,122,189,126, 7,128, 95,159,124,254, 4, 3,
+ 61,228, 2, 65,168,129,101,207,223, 3,162,107,225,124, 69,169, 84,126, 16, 28, 28,220,234,238,221,187,119,244,122,253, 74, 0,
+187,237, 99,221,191,131,147,166,233,213,254,254,254,195,146,147,147,103, 1,216,133,255, 71,248,219,133,150,157,211,206,249, 47,
+228,172,184, 79,200, 63, 45,159,127,136, 45,126, 42, 40, 52, 6,161, 50, 32,226,215,212, 34,178,106,231,148, 81, 29,193, 10,222,
+ 3,133,134, 32,200, 1,161, 87,215, 34,178,254, 94,145, 9, 80,152, 87,195,248, 53, 15,132,170,190,189,236,125,190, 10,124,246,
+217,103,228,248,241,227,144,203,229, 48, 24, 12,232,219,183, 47, 22, 46, 92, 72,217,199, 16, 59,231,223,200,249,159,132,192, 94,
+ 5,118,216, 81, 43,200, 63, 53, 99,212,187, 15,204,100,111,139,107,200, 99,102,128, 70, 99,128, 77,133,142,205,161,222, 77, 53,
+ 63, 35,231, 21,228, 81,211,192,160, 57,196,108, 18,180,230, 28,106, 82,253, 57,255,130, 55, 68,130,121,255,220,118,249, 55,226,
+ 73, 81, 21, 29, 29,109,175, 20, 59,236,176, 29, 19,240,248, 78,195, 71,223,237, 66,203, 14, 59,254,229,160, 70,220,179, 0,200,
+ 40, 63,254,177,156,118,216, 97,135, 29,255, 15, 5, 23, 40, 84,191,160,173, 46, 38,193,250, 44,180, 59,101,231,172, 23, 39, 3,
+192, 17,128, 19,202,124,144, 84,108,233,173,205,205, 70, 63, 0, 86,123,125,218, 57,237,156,118, 78, 59,167,157,243,127,204, 89,
+ 27,247,191,113, 74,178,170, 93,134, 91,254,142,127, 28, 97,231,252, 83,209,247, 63, 83,118,130, 80, 16,172, 41, 63, 66,237,237,
+110,231,180,115,218, 57,237,156,255,239, 57,255,147,176, 79, 29,254,187, 32,253,215,230,156, 16,111, 0, 21, 78, 46, 99, 97,164,
+130, 33,197, 52, 0, 64, 41,174, 19,130, 4, 0, 33,229,191,167, 83, 84,157,119,163,218, 97,135, 29,118,216, 97,199,255, 10, 97,
+ 0,174, 3,240, 6,240, 34,128, 35, 40,247,170,240, 63, 21, 90, 50,215,102,222, 16,208,109, 40,158, 4, 3, 0,161,169,251, 96,
+249, 91,134,252,132,103,126,200, 42, 27, 52,119, 33, 16,239,165, 96, 30,161,205,138,127,102,103,104, 33,205, 29,134,121,186,169,
+ 94,205,201, 47,254,254, 78,156,246,151,186, 92,235,232,232,239, 40,117,113,126,201,100,177,134,136, 69,162, 52, 75, 81,201,150,
+194,194, 7,165,245,200,134, 75, 77, 63,206,155, 71,168,195,217,215, 41,145,220, 66,187, 58,136, 40, 45,180, 68,155,173,228, 3,
+138,146,201,190,125, 35, 72, 93,219,134,162,241,130, 66,165,106, 39,145,202, 59,202, 85,206,205,120, 2, 20,168, 51, 83,204, 86,
+246, 34,103,214,199, 16, 30,103,235,208, 86,175, 1, 88, 2, 0,232,217,243, 20, 66,224,128,213, 21, 25,199,164,158,183,241, 90,
+ 84, 20, 42,156,203,126, 12, 96,105, 29,178,235, 4,192, 31, 64,113, 72, 72,136, 62, 54, 54, 86,243,103,245,209,103,105,247,154,
+ 32,145, 72,101, 86,171,197,194,113,220, 51, 7,166,150,200, 29,230, 62, 21, 94,137,162, 97,212, 22,206,183,143,125,118,216, 97,
+135, 29,127,171,208,122, 17,101, 83,134,181, 47,134,247,111,249,220, 53,169, 84, 22, 0, 0, 60, 33,224, 9,160, 43, 41,138,201,
+121, 16,221, 23, 0,220, 26,133,157, 16, 74, 29,218,241,164,236,119,142, 7, 88,139, 49,185, 36,245, 74, 7, 91,114,164,112,111,
+ 62,180,103, 68,175, 97, 3, 6,188, 24,212, 58,164,117, 19, 0,184, 29,123, 59,233,240,225, 35,113, 81,167,168,253, 58, 77,252,
+129,103, 50,160, 64,186,176,125,251,182,207, 69, 71, 95, 95, 0, 96,202,179,214,160,171,171,114,234,175, 63,205,232,222,107,216,
+ 10, 5, 80,183, 7,174,212,197,249,165,193, 3, 35,219,126,248,238, 68,250,205, 25,139, 3,174,253,118,118,153,210,187, 85, 17,
+225,173,191,234,212, 35, 47,212, 20, 56,249, 73,253, 88,157,192,218, 81,112,156, 94,243, 93,103,103, 67, 65,210, 72,194,115, 35,
+ 41,138, 2, 35,150,239,115, 15,124,110,143,211, 11,239, 23, 2,176,121,199,152,131,119,203, 8, 15,111,223,253, 35,199, 77,151,
+202, 29, 61, 5, 96, 68, 0, 40,100,165,220, 67,212,238, 37,206,239,205,223, 26,246,219,173, 84,246,244, 79, 95, 26, 41,145,112,
+152, 62,251,110,237,243,233,169,169, 78,240,247, 47,251,251,235,175, 63, 67, 64,227,219, 40, 91,107, 6,172, 66,241, 15, 89, 8,
+ 1,202,132, 86, 74, 10,156,109,205,107,223,254, 47,247, 78, 75, 77, 88,144,149,153,246, 11, 45, 16,240,133,197,186,247, 93, 93,
+ 61,180,249,249,185, 61, 80,190,144,219,205,205, 77,145,151,151,103, 1, 96,249, 59,219,253,165, 55, 22,126,189,239,187,207,222,
+170,234,183,201,239, 45, 92,237,239,235,164,120,119,202,248, 42, 3,114, 63, 31, 57,254,195,115,199,183, 46,175, 85, 16, 43, 84,
+115,135,191, 53,123,222, 11, 61,251, 60,150,126,229,210, 69,236,220,240, 25,116,165,118,177,101,135, 29,118,216,241, 55,224, 72,
+185,184, 58,242,228, 15,213, 10, 45,169, 84, 22,112,249,236, 97,151, 3, 23,211, 1, 0, 17, 97, 94,248,100,209,250, 62,219,215,
+ 69,199, 1, 64,231,158, 3,154, 47,248,248, 93,252,126, 39, 23,132, 16,180,109,234,138,126,131, 71,216, 38, 60, 60, 91,116,120,
+233,165,225,163,103,204,248, 96, 80, 98, 98, 98,202,174, 93,187, 46, 0, 64,183,238,221,155, 46, 94,188,248,229, 21,206, 46,146,
+ 31,247,253,148,105, 84,223,187, 86,159,210, 74, 27, 4,250, 4, 53,107,252,234,143,223,174,167, 95,232, 59,124, 84, 10,116, 75,
+140, 89, 15, 50,109,185,214,205,205,109,154, 80, 40,116, 4,202,162,177, 87,192, 98, 33, 94, 0,192,114,188,202,185, 65, 80, 41,
+ 35,146,114, 18,137,232,110,169, 86,251,125, 73,230,189,111,106,226, 52, 89,173,173,222,155,244, 6,125,227, 65, 62, 2, 90,117,
+ 99,214, 44,249, 20, 60,103,117,158,254,241,162,151,162,175,252, 8,157, 26,231,108, 44,154,240,201, 4, 31,159,112,102,225, 18,
+101,111,138,194,235,254,157,199, 13, 89,176,109,159,176,125, 83, 7,152,172, 60,142,197,228,119,222,184,122,225,242,223, 54,190,
+120, 8,192,102, 0,167, 1,212, 42,234, 92, 92, 93,118, 76,155,189, 90,169, 51,255, 97, 37, 41, 23, 89,248,250,251,189,184,153,
+206, 35, 56, 40, 88,224, 53,109,153,114,243,162, 9,219,244,101,113,182,170,146,187,129, 0,186, 2,247, 93,240,246,252, 94,248,
+ 97,233,231,240,240,208, 65,165, 74, 3, 5, 79, 0,205,202, 79, 76, 16,231, 33, 29,192,199,185,185, 80, 44,152,136,190, 55,128,
+143, 66,129, 92, 0,191, 81, 53, 69,141, 39,236,146,247,102, 45, 15,113,111, 28,210, 49, 54, 46, 19,151,143,124, 9, 77, 78,170,
+ 83, 97, 97,222,247, 13,155,134, 18,133,163,123, 88, 81,206, 67, 56, 56,225, 33, 69,184,193,197,197,133, 57, 0,108,178, 34,121,
+121,121,205,245,241,235,212,189,162,221, 93,252,219, 22, 86,252, 70, 51,130, 29,121, 15,175,189, 91,211,245,254,193, 3,199, 47,
+249,178, 91,143,251, 55, 79,236, 77,123, 16,115,145,181, 90, 76,205,130,218,180,127,227,245, 81, 47,223,207,116, 11,213, 20,153,
+112,243,246,157,182, 75,151,126,177,244, 78,236,237,219, 42,149,147,115,227,230,161,157,130,219,244, 31, 85, 96,118, 9,180, 69,
+104,177, 44, 7, 87,175, 64, 8,165, 42,248,122, 58,162,168,212, 4,157,137,133,155, 87, 99,176, 44,107, 31,250,236,176,195, 14,
+ 59,254, 30,100,227,241,197,239, 91,106, 21, 90, 0,160,148, 9, 16,247, 48, 7, 0,224, 36, 3,166,190, 61, 22,249,121,154,230,
+102,150,199,184,177, 99,112,253,126, 54,226,146, 53, 32,132,160,185,175,205, 65,184,193,128,111, 63,110,252,184,231, 79,252,250,
+235,213,207,102,127,246, 3, 69,225, 18, 0,108,222,242,117,231, 57,115,231,188, 53,102,236,152,222,251,246,237,187, 3,160, 94,
+ 66, 75, 64,169,214, 47, 95,250,185, 56, 35,207,104,156, 54, 99, 22,255,193,251,211,214, 0, 24,110,147,146, 17, 10, 29, 51, 50,
+ 50,148, 52,253,120, 44,205, 47, 62,159,117,190,247,176, 21, 9, 41,105, 69, 55, 78, 28, 60,216,161,101,203,150,200,200,204,233,
+186,108,237,166,208, 99, 39,100,111,148,150, 24,134,233,243,238, 85, 25,180, 89, 34, 20,222,153,191,108, 99, 91,222,169, 41,253,
+201, 91,253,209,170, 73, 3,100,230, 22,161,123,223, 65,130,152,107,215,250, 0, 54, 11,173, 39,157, 7,190,100,230,115, 67, 23,
+127,127,165,215,144, 46, 13,218,211, 52, 3,173,193, 10, 77,177, 9, 28, 15,116,107,225,136,200,237,107, 5, 5, 58,235,208, 69,
+ 63,165, 15,189,180,110,128,218, 88,156,245, 14,128,253,181,216, 3, 93,124, 61, 28, 16,151, 94, 90,165,200,210, 25,203, 30,224,
+ 34,134, 3, 5,226, 90, 3, 81, 87, 0,223, 1,193,192,201,119, 70,195,211,115,151,167,167,231, 75, 30,158, 94, 49,205, 71,191,
+ 65,249, 4,180, 80,105, 13, 22,220,189,115,187,180,101,187, 88, 82, 90,144, 59,221,168, 43,220,119, 15,136, 13, 6,246,148,115,
+188,129, 26,132, 86, 66,194,189,162, 55, 94,233, 33,184,145, 84,138, 7, 10, 5, 90,117, 25,130, 98, 77,134, 48,242,141,249,157,
+ 12,165,197, 82, 87, 79,127,220,251,125, 47, 52,105,137,109,141,102,211, 1, 23,191,206, 61, 14,125,247,145,185, 54,235,150,151,
+151,215,220,183,223,126,123,158, 38,251,254,194,222,195, 86,180, 73, 73, 43,186, 49,122,254,153, 14,147,135, 54,197,177, 91, 37,
+248,124,124,143, 87, 1,212, 40,180, 24, 1,225,164, 74,175,128, 97,175,188, 51,171,129,187,116,150, 92, 70,195, 73, 33,198,175,
+ 87,114,241,227,175,233,176,178, 4,225,109,154, 53,159,250,225,234,109,222,174, 98,100,231,153,145,169, 49, 66,157,103,132, 54,
+ 95,111,178,169, 67, 80, 20,114, 53,249, 56,114,232, 8, 40,161, 20, 20, 77,193,106,177, 64, 64,211,160,104,202, 62,244,217, 97,
+135, 29,118,252, 61,168,118,215,161, 0, 0, 14, 31, 62, 76, 6, 12, 24,240,212,168,204,113, 4,113,201,101, 75,112, 24,134,193,
+139,207, 53,197,154,101,243, 97, 48,179,184,249,176, 24, 7,126, 79,135, 89, 87, 4, 66, 8,242, 90,121, 84,245,143, 31,155, 82,
+ 90,177, 68, 22,198, 72,132, 35,127,187,162,104,228,226,236,236,156,112,231, 7,221,156,247,213, 45, 4,196, 18,179,232,139,166,
+ 15, 69, 46,130, 46,123,247,238,105, 57,112,192, 0,177, 82,169,154, 73, 4,161,190, 66, 29,249,160,184,248, 86,113,117,156, 79,
+ 66,230, 17, 60,104,208,139,145, 61,189,188, 60,249,209,139,175,220, 95,255, 78,152, 95,179,166,205,186,198, 89, 13,131, 12,185,
+ 9, 7,171,185,236, 17, 39,207,243,160,105, 26,106,181, 26, 28,199,193,100, 50,193,106,181, 34, 61, 61, 69,205, 19,226,203,129,
+167,189,189,125, 33, 16,136, 17,208,200, 31, 27,215, 44,145,111,255,241, 96,199,143, 62, 91,248,139, 62, 15,225,248,195,185,229,
+ 35, 78, 99, 65,225,190,163,199,127,117, 39,136,106,240,201, 91,253,153,220, 66, 45,162,174, 37,226,250,221,244,186, 54,228,147,
+ 46, 28, 26,101,166, 38,150,172, 88,177,130, 89,112, 44, 49,189,103,191,225,156,127,147, 54,141, 76, 28, 1, 64, 65, 34, 18, 64,
+ 36,160,225,239, 46,197,207,179, 66,112,101,240, 45,207, 62, 97,238,171, 9, 33,251,107,170, 79,147,201,202, 61, 23,172, 96, 66,
+ 3, 29,113, 43,169, 16, 87,143, 93,194,180,217,171, 17,253,208,132, 82,173, 30, 20,103, 2, 67, 76,200, 75,125, 0,150,227, 72,
+109,237, 94,134,176, 66, 0,144, 72, 36, 31, 31, 56,116,188,129,137,151, 34,167,200, 4,117,161, 9, 77,195,135, 41, 82, 51, 53,
+248,110,254,203, 31, 3,216, 23, 12,148,218,192, 41, 1,208, 35,229, 97,188,213,108,230,120,163,133,163, 91,249, 57,226,155,147,
+215, 16,210,227, 21,163,152, 97,100, 42, 71, 55,128, 0,173,186,191,130,171,191,108,128,146,102,218,201, 28, 36,161, 0,174,214,
+212,151, 42, 68,214,220,185,115, 49,229,237,151,193, 19, 34,228,192,211, 0,240,213,129, 68,248, 7,120,212,212, 70,127,132,139,
+225,104,202, 98, 33, 40,213, 90,161, 41, 50, 67, 37, 21, 32, 62, 77,135,196, 84, 45, 94,238,235,131, 97,189,188,193,241, 4, 99,
+102, 94,199,240, 62,222, 24, 61,192, 23,160, 40,228, 21,154, 97, 50,115,213,150,157,166,233,198, 12,195,132,113, 28,119,189,236,
+ 59, 3, 14, 64, 73, 97, 30, 76, 38, 19, 24,134,129,179,139, 59, 0,234,177,115,121,158,127,104,235,125, 84, 79,216, 57,237,156,
+118, 78, 59,103,189, 81,157, 22,249,151,160, 90, 87, 14,116, 77, 87, 37,165, 23, 32,238, 97, 14,218, 5,251,160, 73, 35,111, 92,
+141, 47,196,142,168,116,108, 61,145,138,168,155, 26,240, 2, 21,114, 74,128,132, 20, 53, 18, 82,243,106,245,159,205, 72,132, 35,
+223,123,175,120, 70,235,150, 37,225,103,143, 77,133,143,123, 66,203,143, 62, 42,154,202, 72,132, 35,157, 27,170,118,205,154, 49,
+253, 85,149, 92, 46, 54,155,204, 8,108,236, 47,125,247,157,169,111, 80,206, 18,155, 99, 34,169,124, 90, 56, 75,100,178,111, 22,
+205,155, 41, 89,125, 32, 33, 77,103,134,110,255, 37,245,131, 15,102,205, 41, 16, 8,165, 27, 85, 62, 45,108, 94,251, 99,181, 90,
+ 97, 50,153, 96, 54,155, 97,177, 88,144,153,126,111,208,233, 3, 31,246,109,220,208,165,175, 68, 42, 5, 1, 80, 98, 96,241, 48,
+ 91,143, 30,189,122, 51,237,194,194, 90, 41,189, 91,140,175,138,171,184, 56,181,152, 39,140,234,240,207, 59,153, 61, 39,111,224,
+135,195,215,240,203,153, 27,184,122,238, 24, 75,120,235,163,248, 95, 74,239,166,205,149,222,173, 83,149, 13,218,168, 31, 29, 62,
+ 33, 53,186,103,102, 24,154,244,232, 21,113,234,237, 41,239,158,213,151,230,231,126,179,126,126,166, 38, 43,229,158, 68, 68,177,
+114, 9, 3,173,145,197,182,211, 89,120,105,201, 77,220, 77,211,130, 16, 82,107, 0,111, 30,120,127,228,248, 15, 57,171,197,130,
+ 32, 63, 37,118,110, 89,138, 65, 61, 66,209,179,181, 51, 58, 52, 81, 64, 46, 48,225,206,253, 56,236,222,185,141,229,121,250,131,
+ 90,110,196,200,242, 35, 6, 0,180, 90,237,135, 31,205,252, 64, 99,102,121, 88,172, 60, 44,229,159,167,119,127,161,225,140,250,
+ 15,203,175,139,169,116, 93,117, 55,243,186, 55, 39,127,212,227,155, 29,167,122,239, 63,159, 77,171,243, 45,136, 58,190, 15,222,
+ 13, 3, 33, 98,104, 25, 40, 0, 20, 5, 80, 20, 8, 33,112,247,111, 1, 35,207,227,167, 77,159,250,160,134,245,106, 21, 34,107,
+194,132, 9,184,119,239,222, 99,237,158,148,152,140,164,196,100,156, 58,113, 25, 0,224,226,223,182,208,197,191,109,161, 91,227,
+ 14,155,171,226, 50,115, 86,222,192,114,200, 41, 50, 66, 46,165,225,231, 35,199,208,158,222, 88,255, 73, 27,140,238,239,131, 12,
+181, 30, 19, 22,222,132,167,167, 16, 63,159,207,198,186, 93, 73,104,230,175,192,144,158, 13,240,250, 64,223,170,173,181, 2, 65,
+ 63,161, 80, 56,106,200,144,161,243, 37, 82,197,146,119, 22,238,152, 39,147, 8, 42,172,177, 96, 24, 6, 86,171, 21, 52, 77, 97,
+228,180,245,243, 36,114,213,146, 33, 67,134,206, 23, 10,133,163, 4, 2, 65, 63,251, 75,167, 29,118,216, 97,199, 95,102,209,170,
+ 56,188, 31, 27,183,171,187,194,104, 52, 36, 15, 31, 57, 6,222, 30, 94,202,193, 47,188, 46,138, 73, 42,130, 38, 59, 21,137,241,
+177,208, 27,173, 16, 57, 55, 6,164, 94,104, 20,224,143, 91,113,191, 88,214, 45, 63,162,229, 89, 83,114,117,124,131, 6,121,251,
+ 38,222,167,232,229,203,252, 46,199,199, 21,182,219, 57,251, 59,140, 30,173,116, 91,190,204,239,114,202, 3, 5, 45,151,146, 46,
+111,140, 29, 69,209, 20,193, 71, 31,205,192,224, 1,145, 24,247,198,107,212,247,223,111, 11, 47,178,177,148, 60,132, 27, 62,254,
+116,190, 88, 93,196,154,175,198,107, 77,114,133, 76,246, 91,130, 86,215, 42,192, 79,214,127,216,235, 89, 71,246,126,179, 26,192,
+ 88, 91,184, 42, 4,150,213,106,133,197, 98, 1, 0,174,204,122, 80,246,153, 95,106, 70,110,145, 9,234, 34, 19, 88,142,199,176,
+145, 99,101,215,162,111,142, 5, 80,205,122, 45,158,183,178, 86,236, 63,121, 29,153,215,246,241, 20,205, 20, 87, 90, 12, 15,165,
+119,211,230, 94, 94,126,231, 7, 12,123,205, 93, 44, 45,155,134, 45,213,153,240,253,166,101, 53,230,147,166, 40,194,115,108, 17,
+107,181,234, 2, 27, 7,102, 6,183, 12,149, 94, 60,123, 98,208,111,167,246,107,217,192,215,156,146, 82,178,193, 8, 37, 96, 68,
+ 82,152, 44,182,109, 60, 84, 39, 94,254, 18, 0, 53,126,242,140, 53,211, 63,252,132,121,127,221, 5,152,141,122,152, 12, 58,148,
+ 20, 23, 66, 38,176,226,206,239, 7, 89,194, 89,167,235,178,111,124, 89, 61, 19,149, 5, 32,171,114, 74, 65, 65, 65,212,239, 23,
+206, 31,186,242,251,133,113, 94,129,237,104,179,149, 71, 98,236, 21, 62, 51, 33,250,144,201, 84, 18, 5, 0, 20,144, 15,224, 68,
+ 77,134, 75,149,131,147,227,184, 41, 31,142,119,146, 41,232,216,140, 34,164,102,151,128,147,249,192,203,183,201, 31,243,171,124,
+ 89,121, 59, 6,185,163, 79,232,203,184,120, 59,141, 59,177,231,203,222, 0, 14, 2,208,215, 36,178, 98, 98, 98, 32, 18,137, 30,
+107,247, 38, 77, 3, 80, 49,117, 88, 84, 48,213,105,219,242,215, 1, 0, 61,159,235, 62, 1,192,219, 79,189,168,228,148,192,213,
+204,162, 83, 11, 23, 4, 53, 86, 34, 51,223, 12, 66, 9,176,247,116, 30, 18, 50,116, 56,121, 85, 3,111, 23, 49,120, 51, 13, 70,
+ 2,236,191,152,137,139,119,242, 48,166, 95, 67,220,127, 88, 80,141,176,102,194,222,255, 96,198,130,181,107,215,157, 25, 62,121,
+249, 75,221,194, 2, 81, 82,170, 69,102,129, 21, 90, 93, 41,116, 90, 29,100,114, 57, 36, 98, 49, 24,129, 0,253,222,248,252,165,
+163,223,125,122,246,253, 15,102, 44, 88,181,114,197, 28,150,101,143,217,199, 67, 59,236,176,195,142,191,212,162, 53,161,114, 90,
+181, 66, 43,245,238,197, 14, 0,208,188,125,159,124,165, 84,224, 34,160, 41,168, 51,146,240,253,138,105,224,121,130,254,111, 45,
+135, 42,192, 11, 50, 17, 3,147, 54, 95, 91,144,116,174,166,181, 58,160, 40,107,239, 47, 55,103, 6, 76,158, 20,232,176,115,167,
+ 86, 8, 0, 59,119,106,133,147, 38, 54,116,248,106,115,114, 64,167,231,218,129,112, 28, 6, 12, 30,142,145,175,140, 68, 74,142,
+ 30, 63,157, 79,131,206, 96,182,105,183,156,204, 45, 56,212,205,213, 61,242,189,215, 35, 21, 2,134,162,154,249, 59, 50,233, 26,
+ 43,203, 48, 66,238,208,181,226,172, 97,195, 94,113,139, 58,186,167, 39,231, 22, 28,106,200,187,127,179, 54, 62,147,201,244,216,
+212,161,139, 91,227,163,189,135,175,200,200,206, 41, 61,146, 83,104,236,164,179,178, 80, 23,153,144, 91,100, 66,145,206, 2, 47,
+149, 51, 88,171,185,117,117,124,132,144, 31,134, 12, 31,243, 26, 0,154,162,217,239,180,217,247,227,203,126,249, 67,100, 69, 14,
+ 30,237,126, 62, 38, 9,137,209,199, 10, 9,207,150,121,113,167,248,140,154,235, 21,132,161,192,139, 4,148,149,161,105,222, 98,
+209, 90, 61, 60,220,163,206, 69, 29, 31,104,100, 31,128, 17, 73, 30,157,107,120,124, 58,170, 54,177,181, 1, 0,214,174, 91,179,
+178, 75,239,209,162,115,215,147, 97,176, 2,157,195,154,227,231, 31,191, 54, 17, 98,253, 80,151,125, 99, 67, 29, 58,161, 83,195,
+134, 13,167, 9,197,226,158, 50,185,170,161,187,183, 31,109, 97, 57, 88,172, 28, 20,174, 62,180, 68,233,210,155,167, 69, 23, 89,
+139, 57,202,162,211,172, 5, 80,173,190, 62,121,249,110,207, 77,107, 87,190,228,237,170, 64, 67, 55, 17, 14,157, 43,228,172, 2,
+158,246,240, 15,162, 0,192,207,195, 1,119,175,159,197,173, 91,183,209,186,115, 36, 92, 85,190, 80,138, 56,146,151,248, 91,129,
+167,151, 79, 91,117, 78,166,232, 73,161,229,229,229, 53,119,204,152, 49,243,188,189,189,177,102,205,154, 71,233,149,219, 61, 4,
+232, 84,121,234,240,171, 3,137, 53, 22,248,141, 1,141,240, 92,168, 7,120, 30,120,119,245, 45,196, 38,149, 96,203,199, 97, 24,
+214,195, 7,155,127, 73, 70,155,102, 10,104, 13, 60, 44,102, 14, 34, 49,141, 22,141,149,144,136, 24,156,185,158,135, 82,157,174,
+ 70,110,138,145,160,119,143,206,200, 43,210,195,221, 81,140,198, 13,221,161,148, 55, 70,169,129, 69,106, 78, 49,138,117, 86,228,
+ 21,234,208,181,115, 71,252,186, 93,108, 31, 2,237,176,195, 14, 59,254, 30,171, 22, 80,201,135,214, 99, 66,235,240,225,195, 4,
+ 0,170,154, 31,205, 84, 23,192, 85, 41,128,123,131, 0,188, 58,109, 37,126, 88,253, 62, 56,206, 10, 66, 0,150,179,205, 51, 1,
+ 33,194,147, 83, 38, 5, 4, 55, 10, 96,220, 95, 29, 45, 55,236,216,169,151,189, 58, 90,110, 8,105,237, 90, 60,101, 82, 64,114,
+169,209,175, 43,203,113,248,237, 78, 46, 98,147,139, 17,155, 82, 2,165,204,118, 55, 95,140, 88, 52,105,217,210, 37, 34, 1, 67,
+ 81,119, 82,181,218,140,124, 86,203, 8,133, 22,185, 76, 76,204, 68, 96, 74,201, 35,249,189,134,188, 97, 56,180,125,237,120, 0,
+239, 84,107, 21, 43,223,105, 88, 97,201,170,248, 36,132, 16, 10,224,121,138,227, 50,242,140,208, 90,172, 80, 23,254, 33,180, 40,
+182,250,153, 83,165,119,211,230, 14, 42,229,113,134, 97, 36,132, 0, 86, 11,251, 50,188,155,246,213,102, 39,198, 87, 22, 89,151,
+239,100, 33,233,198, 41, 53,103,209,143,209,231,198,157,182,181,236, 20, 5,194, 48,224, 25,154,226, 41, 10,188,144, 38,102, 16,
+194, 63,153, 35,125, 29,132, 86,133,216, 18, 11,153,217,191,238, 94,237, 49,238,197, 22,248,241,124,153,230, 51,150,106, 74,116,
+153,117, 18, 89,112,117,117, 29, 59,115,230,204,185,131,134,143, 70,177,145,130,186,176,204, 26,104,182,242, 16, 41,220,208,123,
+202,183, 13,179, 53, 37, 13, 19,175, 30,234,154,119, 99,103,177,213, 88,188,166,218,124, 37,101, 93, 53,232,117, 40, 49,148,149,
+103,198,216, 32,230,179, 47, 79,130, 37, 2,184,184,251,192,221, 65,132,215, 95,238,135,243,254,141,112,239,254,125,204,158,127,
+ 4,158, 78, 14,177,151,206, 30,108, 18, 22,222,109,213,209, 3,187,158, 18,113, 57, 57, 57,243,183,111,223,142,208,208,208,121,
+237,218,181, 67, 78, 78, 78,133, 64,126,212,238, 73,137,101, 6,219, 10,161,117,253,250, 45,132,133,181,169,182,204,173,155, 56,
+ 96,223,153, 44,124,123, 56, 5, 50, 9,131, 0, 31, 41, 38, 45,187,129, 30,109,221, 48,117, 68, 99, 40,101,254, 40, 42,181,194,
+108,229, 97, 48,177,200, 47,177, 32, 51,223,136,116,181, 1, 22,107,205,107,225, 9, 8, 98,227, 51, 96, 50, 25,225,236,236, 12,
+165,220, 8,169,147, 31, 0, 6,133,234,226,178,221,135,122, 35,228, 50,137,125,232,179,195, 14, 59,254, 53,168, 73,139,252,139,
+172, 90, 79, 91,180,106, 42, 16, 33, 64, 66,106, 30, 26,249,186,195,183, 81, 19,196,223,187, 85,105,176, 7, 88,206,182,233,168,
+131, 7,179, 51, 86,174,116,224,223,127,191,184,243,178,101,126,151, 38, 77,108,232, 24,210,218,181,120,230,204,180,206,171, 86,
+ 57, 94, 58,121, 89,200,145,114,127, 93, 21,190,185, 8,169,139,143, 77,186, 99,104,203,198,204,252,157, 9,105,167,111,151,230,
+138, 68, 34,171,151,179,148, 82, 41,197, 12, 67, 11,197, 38, 43,109,106,222, 42,140, 57, 68, 83, 97, 53,177, 84, 8,173, 39,167,
+ 14,243, 53, 73,131,126,253,105, 70,200, 11, 67,150,187,100,106, 12, 40, 54, 51,143,166, 14, 25,154,194,237,123,169, 0, 35,138,
+173,138,211, 65,229,114, 98,215,142, 31,252, 86, 45,251, 28, 22,150,195,148,247, 63,195, 27, 99,199,156,128,119,211,190,126, 1,
+ 65, 49, 23, 14,125, 39,239, 59,113, 35, 82,227,162,115, 88, 83,201,238,186,136,172, 71, 98, 11, 32, 28,225,233,130,194, 18,165,
+137,133, 20, 85,232, 62,147,133,175, 87,207,209, 26, 88, 28,186,146,131,195, 7,118,195, 81,165,168, 23,135,163,163, 99,139,238,
+221,159, 7, 37, 16,195,108, 53,193,204,242, 48, 87, 90,163,101,177,242,176, 18, 33,228,222,109, 80,112,247,231, 22, 48, 22, 87,
+203,245,218,107,125, 10, 90,182,110,183,247,211,247,223, 26, 49,226,213,113,232, 20,254, 28,226,110,253, 14,207,134,193, 80, 58,
+185,145, 75,201,133,108,231, 96, 63,193,216,193, 29,168, 40,223, 64, 4,180,232,130,132,187,215, 90,139, 68,162,219,105,137,247,
+171,157,146,204,201,201,169,240, 57, 53,175, 93,187,118, 72, 75, 75, 67, 65,165,118,111,210, 52, 0, 0, 16,127,191,108, 19, 67,
+133,200,226,249,170,251,233,132, 37, 55, 80, 98,224,224,230, 44, 6, 67,209, 0, 33,104,228, 45, 67,116, 66, 1,198,204, 47, 68,
+120, 75, 23,248,121,203, 1, 66,160, 53, 90, 97, 54,243,176,240,128,217,200,130,161,171,221, 50,200,113, 28,199,209,196,202, 92,
+143,141,135, 88, 36,132, 99,145, 14, 50,153, 12, 34, 81, 30, 40,154, 6,203,242,176, 88,173, 48,232, 13,216, 27,125, 25,132,179,
+ 48, 28,199,113, 40,159, 6,181,195, 14, 59,236,248, 39,226, 95,188, 16,190,178,184,170,222,162, 85, 19,252,125, 61,113, 37, 54,
+ 25,173,131, 27,195,209, 65,133,251, 73, 25, 96,104, 33,104, 10,176,178,182,139, 33, 98,177,254,184,106,149, 35, 82,147, 21,244,
+ 87, 27,147, 3,166, 76, 10, 72, 94,181,202,241, 18,177, 88,127, 4, 48,134, 16,160, 76,108,149, 9, 46,174, 14,186,128,240,214,
+134,158, 46,114, 38,250,129, 46,159,166, 25,147,171,163,148,119,117,148,208,174, 42,177, 80, 36,100,120,150,208, 22, 95,143, 0,
+ 35,225,121, 91,226,234, 61, 54,117,200,113, 28, 40,138,230,202,133,152, 34, 61,223,128, 98, 35, 3,117,145, 9,133,165, 22, 52,
+243, 81,224, 84,212, 62, 61,103, 53,236,172,210,218, 38, 20, 57, 54, 9,240,197, 39, 11, 87,193, 96,226,144,144,169,133, 72, 34,
+241,242,244,106,117,115,204,228, 89,146,119,183, 36, 97,124, 79, 87,188,127, 33, 41, 83,175,150,206,170, 75,203,114, 28, 7,131,
+209, 44, 82,231, 21, 58,151,148,234, 28,100, 82,137,193,221,197, 49,175,170,115,141,230,250, 61,103,229, 82, 1, 6,134,123,193,
+104, 25, 5,131,137,197,239,167,247,215,135,166,177,103, 3, 95,104,205,149,196, 85,185,216,170, 44,186,132, 74,119, 0, 84,227,
+218,138,125,247,118,204,203,119,111,199, 44,184,118,233,220,174,101,223,156, 14,217,190, 97, 14,214,255,146, 4,134, 97, 40, 98,
+101,133,107,127, 73,134,175, 19, 67,180, 86, 33,101,228, 40,232, 10, 52, 8,234,216,175,213,174, 47, 63,157,133, 50,151, 17, 38,
+ 91,196, 86,161, 58,250, 81,187, 31, 63,246,104,223, 2, 10,111,110, 43, 74, 58,179,190, 76,226, 51,130,125, 85,171,118,139,217,
+195, 81, 76, 56,214,194, 87,246,104,229, 40,163, 64,120,224,218, 29, 53,174,199,211,112,117, 16, 65, 41, 19,194,202,242,208,155,
+ 89, 24,140, 28,205,179, 22, 83, 53,237,125,125,237,154,213,115, 70,141, 26, 53,105,247,158,121, 7, 67, 35,223, 27, 84, 82,148,
+ 15,161, 88, 6,145, 64, 4,154,161,193,114, 28,204, 70, 29, 10,139, 10,144,252,219,247, 7, 71,142, 24, 26,182,118,205,234, 57,
+ 21,187, 20,237,176,195, 14, 59,236,248,203,172, 89, 79,193, 38,161,165,148, 75, 65, 24, 41, 46,196, 36, 33,168,101, 27,108, 59,
+120, 21, 77, 91,135, 35,187,148, 5, 1, 93,235,110,195, 10,204,248,216,112, 29,192,245, 65,131,228,190, 67,135,250,244, 38, 68,
+120,114,227,230,146, 12, 0,104, 28, 82, 70,195,243, 4,132, 0,132, 47, 19, 92,182,155,116, 4,169,201,217, 37,141, 2,188, 20,
+184,155, 97, 49, 41, 36, 34,218, 89, 33,102,220, 29,197, 34,145, 64, 0,142, 80,166,236,236, 36, 19, 5,164,216, 66,247,228,212,
+161, 92,233,125,180,215,144,229,154,148,180,226,232,102, 5,250,208, 98,139,179,110, 80,142, 0, 0, 32, 0, 73, 68, 65, 84, 24,
+132, 0,205,124, 20,136,189,124,132, 83,103, 38, 38, 24,212,113,155,170,182,146,129,177,176, 60,110, 62, 40, 70,145,206,138, 34,
+173, 5, 93,123, 12, 20,117,141, 24,132, 11,177,121,224, 89, 43,150,125,125,164,148, 35,214,145,192, 61,107, 29, 10, 77, 95,185,
+126,199, 87, 83,168,147, 8, 5,130,162,224,166,254, 15,197, 34, 33, 91, 82, 82, 34,126,252, 44, 6, 10,153, 24, 5, 90, 43, 0,
+ 88,235,218,123,138,117, 86, 28,188,156,131, 67,251,119, 65, 38,147,129,212,163, 7,138, 68, 34, 39,161, 72, 10,139,174,108,186,
+176,226,176, 60,113,208, 2, 9, 64, 11,156,108,164,189,103, 54, 27,126, 79,142,187,220,130,235,209,148, 25, 27, 17,128,215, 38,
+ 76,135, 79,147,214, 24, 56,112, 40,218, 4,168,168,253,151,210, 96,181,178,165, 94,129,173, 84,164,108,151,109, 2,128, 80, 0,
+151,109,177,108,169, 42,181,123,139,174,129,161,127, 8, 45,160, 32,245, 70,141,187, 88, 57,115,126,166,222, 76,211,132,240, 85,
+190, 50, 8, 1, 16, 51,160,206, 38,200, 1, 32,160, 1, 1, 67, 3, 20,197,112, 28, 87,101, 59,177, 44,251, 43,207,243,234, 29,
+ 59,118,168, 57,142,187, 30,115,100,229,205, 38, 47, 76,156, 7,182, 0, 86,107,217,114, 70,177, 68, 14,158,162,145,116,254,219,
+121,156,197,240,203,142, 29, 59, 42,220, 59,220,182,143,133,118,216, 97,135, 29,127, 9, 42,199, 56,124,177,178,248,178, 73,104,
+113, 60,129,155,171, 11,172, 68,128,100,117, 49,116,148, 7,140,122, 2,142,163,192, 17, 82,147,171,241, 8, 84,177, 61,255,224,
+193,236, 12, 0, 91,159,176, 73, 61,178,100, 61,250,172,122, 74,166, 74, 78,138,112,167, 14, 30, 59, 59, 98, 80,183,158,206,247,
+179,115, 50, 68, 66, 90, 32, 16, 49, 66,145,128,166, 68, 2,218,236, 32, 19, 48,251, 54,239, 22, 19, 10,103,107,227, 52, 26,141,
+136,136,120, 60, 48,121,220,157, 75, 30, 5,185, 9,102, 66,241,188,187,184, 20,110,142,238,120,152,146,134,211,199,246,235,213,
+153,137,113,156,201, 56, 24,143, 75,206, 63, 56, 9,225, 11,138, 77, 48, 90, 56, 20,106, 45, 40,210, 89,192,186,119,198,207,191,
+103, 65, 42, 98,160,190,185,207,160,201,201,152,102,202, 77, 76,174,165, 41, 62,194, 99,190,180, 72,198,155,227,198, 10, 87,175,
+ 88,102, 10, 11,107, 71, 10, 10, 10,160,213,106,255,168, 19,138,130,212,193, 3, 42,153, 0,137,215,142, 34,241,244, 42, 3,128,
+ 79,109,169,207,202,112,144, 11, 48,168,147, 23, 76,150, 81,200, 43, 54,225,218,217,159,107,235, 50, 79,113,202,229,114, 89,133,
+245,170,178, 91, 7,115, 37,171, 22, 87,222,222,180, 64, 34,171,130,179, 55,128,147, 79, 38,150, 20, 23, 31,185,126,233,212, 36,
+227,132,215,160, 46, 50,193,144,159,132,239,127,222,116,218, 82,154,208,163,207,234, 21,244,244,193, 77,112,250,122,129,234,182,
+128, 1,120, 32,114,212,140,151,142,239, 90,177,189,182,178, 87,136,173,231,187,117,152, 71, 51,212, 33, 66,253, 33,150,178,178,
+178,108, 42,123,177, 58,177,220,130, 84,167, 57,112, 80, 20,205, 16,254,177, 24,136,143,229,147,231,249,219, 21,162, 73, 64, 81,
+131, 85,114, 57,242, 52,197,168,112,178,107, 52,148,194,197,173, 1,104,138,130,181,210,185,117,109,247,122,192,206,105,231,180,
+115,218, 57,255,191,226,169, 24,135,117,176,104, 17, 4,122, 43,208,212, 71, 1,163,197, 3, 70, 51, 7,157,145, 67,137,222,130,
+ 18,189, 21,201, 57,122,196, 30,124,246, 28,150, 89,177,202, 92,159,147, 50,127,155,224,120, 98,179,245, 68,108, 49, 47, 92,185,
+108,241,203,187,195,218,154,223,125,209,187,225,173,100,115, 22, 69,209, 6,154, 17, 88, 93, 84, 2,225,253,251,183, 52,151,206,
+ 31,237, 46,101,185,215,244, 53,240,176, 44, 91,236,227,227, 83,241, 64,123,148,222,162,137,108,240,111, 71, 62,106,252,252,160,
+101,238,171, 63,159,161,167, 25, 17, 79, 9, 68,177,156,213,176,203,160,142,219,136, 26,236,122,180, 72,122,239,202,141,187,225,
+ 78, 46, 13,145,152,169,131,206,200,194,194,242,112, 86,138,144,113,251,132, 37,249,126,244, 30,109,214,173,109,245,168,182,157,
+241,247, 98,125, 35, 35,251, 14, 15, 15,239,204,204,153,243, 25,130,130,130, 96, 48, 24, 64,211, 52, 26, 54,106,130,228,248, 27,
+184,124,100, 33,167,207, 79,217, 4, 96, 1,128, 58, 7, 92,206, 43, 49,227, 88,116, 46,142, 28,248, 17,140,176, 94, 59,216,104,
+153, 76, 38,173, 74, 92, 85, 22, 93,143, 78, 22,138,165, 40,179, 62,241,143,117,196,170,113, 60, 41,254,238,189,215, 95,125,165,
+133,202,209, 9,253,135,142,204,189,116,225,244,128, 3,223,111, 94,147,159,146,254,242,103, 75,214, 57,244,110,239, 77,185, 40,
+197, 40,210,241,216,153,122, 47, 16, 54,218, 96,115,114,114,230,167, 39, 71,143,249,237,200, 71, 3,159, 31,180,204, 61,250,167,
+217,143, 22,209,211,140, 96, 71,109,215, 23,164,199,156,174,171,200,170,144, 90,132, 16,155, 38,206, 9, 0,161, 72, 12, 15, 15,
+111, 80, 20, 96,101,121,152,173, 44, 4, 66,251, 78, 67, 59,236,176,195,142,191, 25, 19,158,248,180,205,162,101, 52, 26,147,159,
+139, 24, 8,158, 39,224, 8,192,115,229,150, 39,254, 15,235, 19,103, 53, 38, 63,107,238,120,158,187,186, 97,203,214,254, 97, 29,
+159,103, 90,250, 41, 81,146,159,131,203,191,157, 97,193,147, 75,182, 92,159,159,159,160,149,121, 54, 29,254,242, 75, 67,247,142,
+ 29, 55,177,168,123,143, 30, 10, 15, 15, 47, 83, 70,102,134,254,219,237, 59,172, 39,142,254,210,157, 7,251, 74,126,126,162,182,
+ 38,158,226,226,226,181, 85,165, 75,196,202,174, 0, 26, 51, 2,202,108,208, 36,212,105, 69,120, 94,102,250,176,197, 11,231,165,
+140,126,107,186, 56,208,167, 9,114,139, 25, 36,103,228,224,254,249, 95, 76,153,241,215, 14,148,100, 92, 31,111, 35, 85,118, 21,
+105, 25, 0, 86, 95,190,124,169, 85,100,100,100,223,158, 61,123,146, 9, 19, 38,128, 16,224,244,150, 73,164, 32,249,242,190,114,
+ 43,214,131,122,182, 75,234,249, 75, 55, 92, 70,116,111, 47,112, 85,141,199,214, 31,143, 90, 65,248,212, 58,210,120,250,250, 53,
+ 18,148, 77, 23,150,185,116,120,242, 48, 91,255, 88, 63, 38, 82,122, 10,244,136,245,172,166,188, 79,105,141,196,248,187,173, 19,
+227,239,142, 3,144,187,119,199,215,135, 0,192,100, 48, 76,140, 58,125, 48,245,238,157,232,215, 6,189,250, 65,147, 86,161, 29,
+ 4,251,182,173,134,197,168,219, 15,192,230,254, 42, 17, 51, 41, 21,237, 94,219, 84,225, 83,237,158,114,249, 40, 69, 51, 2, 91,
+ 69, 83, 37, 75, 36, 77,120,222,166, 5,117,132,231,144,249,224, 54, 92,188,252,160, 82, 57,130, 39, 22,192,108,130, 38, 61, 14,
+ 28,103,143,117,104,135, 29,118,216,241, 55,161,254,107,180,210,239,149,249,211,250,171, 81,154,147, 59,102,219,182, 31, 22,253,
+176,125,119, 87,163,217,236, 67, 32, 74,231, 88,243, 57, 45,135, 57,182,114, 24,212,137,209,174,174,205, 66,190,253,122,195,167,
+223,110,253,234,121,240, 92, 48, 5,164, 16, 10,103,165, 86,110,108,109, 34,171,198,135,102, 94,233,230,222,195, 87, 24,242,243,
+181, 63,212,245, 90, 67,126, 92, 14,205, 88, 26,110, 94,179,112, 57, 77, 51,125, 56,142, 23,242,156, 53,145,179, 24,191, 48,104,
+226, 14,194,230, 85,110, 40,168,225,183, 59, 0,238, 68, 69, 69,117,139,138,138,234, 8, 96, 45,202, 98, 40, 70, 63, 75,187,152,
+242, 75,123,125, 56,227,195,211, 31,128,242,231,121, 2,150,227, 83, 69, 6,125,175, 58,210, 52, 12, 12,108, 34,183, 88,185,167,
+ 22,192, 87, 94, 8,255, 72,104, 57,250,202, 1, 52,180, 81,104, 1,101,187,233,190,126, 42,145,101,151,102,103,165,255,184,241,
+139,105,111, 3, 8, 0,112, 17,192,134,191,171,221, 45,198,146,188,191,250,190, 97, 45,166,249, 25,183, 14, 34,235,142,200,155,
+ 18,148,185,114, 32,156, 25, 60,107,206,102,173,150,249,246,177,207, 14, 59,236,176,227,111,179,102,109,169,234,187,224,159,146,
+195,194,194, 7,165, 40,172, 57, 72,175, 45,200,207, 79,208, 2,120,106,231,158,254, 25,121, 99, 19, 74,126, 66, 66,201, 79,245,
+189, 94,151,251, 80, 3, 60, 28,251,140,217,176,101, 33,251,133,242,227, 79, 65, 94,222, 61, 29,242,208,233, 89,155,101,231,142,
+237,247,119,239,254, 81, 72,104, 70,200, 19, 70,196, 18, 74,200,242,148,208,106,229, 97,178, 88,173, 22,150,181,130, 99, 45,224,
+ 57, 43,225, 45, 86,148,121,135,255, 51,144, 10,224,227,255, 85,187,255, 29, 96,173,150,249,176, 90, 0,232,236, 67,157, 29,118,
+216, 97,199, 63, 75,112,253,115,132,150, 29,255,105, 60, 72, 74,140, 15,183, 87,131, 29,118,216, 97,135, 29,255,113,145, 85,249,
+ 19, 64,217,218,243,136,106, 46,168,203,110,130,136,122,100,232,148,157,243,153, 57,133, 0,196, 0,148, 0,106,155,218,234,139,
+186, 59,172,252, 95,148,253, 35, 0, 55,236,237,110,231,180,115,218, 57,237,156,255, 89,206,218,184,237,187, 25,255, 98, 1,102,
+231,180,115,218, 57,237,156,118, 78, 59,167,157,243,255, 31,231,191, 25, 19,170, 56, 0,216,167, 14,237,176,195, 14, 59,236,248,
+127, 8, 87,215,102, 74,224,209,186,222, 90, 33,119,107,225, 9, 0,250,188,123,106,123,237,217, 81, 5, 42,199, 57,124,108,141,
+ 22, 93, 79, 66, 33, 45, 16,127, 40, 87,185,222, 83, 56,186,102,254, 63,175, 92,170,121, 35,197,212,222,221, 3,126, 14,106, 44,
+ 27, 92,151, 11,229,238,205,191,243,106,210, 41, 77,225,209,124, 42,188,195,100,207,146, 9,133, 71, 99,119,101,195,246,191,169,
+124, 90,245,251, 11,202, 40,105,217,178,101,231,150, 45, 91,118, 6,240,167, 68, 41,150,123, 52, 31,229,219, 52,252,188, 71, 96,
+219, 51, 10,207,102, 47,253,217, 25, 86,122, 55,117, 85, 54,108,247,147,178, 65,155, 66,165,119,155, 18,165,111,187,115, 42,183,
+ 22,129,181, 93,215,112,208,226,224,249,187, 98,119, 53, 28,180, 56,184,170,223,157, 35,215,169,230,238, 78,248,220,117,224, 23,
+ 74,251,184, 82, 63, 52,236, 58,202,201,251,249, 15, 92,235,122,157, 79,243,240, 59,141, 90,117,203,109,208,172, 83,172,173,215,
+248, 6,117,190,238,223,178,171,218,183,121,231,104,123,205,219, 6,169,123,227,206, 82,103,191, 35, 18,103,191,163, 18,151,198,
+ 61,158,149,207,219,219, 91, 22, 28, 28, 28, 25, 30, 30,254,118,175, 94,189,222,107,219,182,237, 4,127,127,255, 62,255,203, 23,
+125,185, 71,243,143, 77, 66, 42,207, 36,164,242,228, 30,205,107,221, 44,163,240, 8, 90, 68,209, 92, 22, 69,115, 89, 10,143,160,
+ 69,255,148,182,146,120, 54,247,151,123, 52, 95,165,242,106,121, 85,230,209,108, 96, 93,175,119,118,118,238,227,238,238, 62,164,
+226,112,118,118,238, 99,191, 3,234,141,202, 86,172,103,182,104, 49, 66,137,252,226,232,113, 83, 66,150,206,155, 37, 93,179,245,
+103,172,249,124,198, 93,147,174,168,229, 63,177,228,110,141, 59, 70, 51, 52,227, 91, 57,141,227,185,140,188,135, 87,219,255, 25,
+252, 65,141,100,227, 63,157, 57,230,253, 81, 47, 71,248, 71, 12,152, 70,197, 61, 52,252, 98,187, 68, 67,232,158,159, 14, 52, 60,
+127,246,204,186,173, 91,183, 44,208,176, 65,171,132, 18,193,134,146,244, 59, 69,117,201,131,131,123, 96, 99,129,194,237,252,115,
+131,167,120,197,156,218,177,141, 51,243,189,245,121,149,162,127,215, 31,238, 77,154, 52,233,192, 48,140,235,212,169, 83, 69, 0,
+176,122,245,234,166, 28,199,229, 39, 37, 37, 93, 67, 61,156,159,150, 9,204,160, 49,107,151,207,255,161, 95,191,254,200,202,211,
+ 97,217,170, 47, 95, 56,126,120,207, 8,157, 58, 97,223,159,209, 38, 78, 78, 1, 14, 16,169,110, 79,155,185,192, 35,242,133, 14,
+140,214,200,226,248,249, 27,221,118,124,185,224, 42,208,162, 99,105,222,189,106,125,138,241,250,226,217,158, 74, 18,201,235,139,
+ 1, 96,212, 83, 15,123,165, 53,194, 93,198, 69,122, 75, 4, 55,242,129, 90,131, 62, 58, 53,234,122, 66, 40,145,248,211, 52, 13,
+154, 2,104,154, 2, 67, 81,101,113, 66, 45,134,212,204,251, 23,250,254, 19,238, 19,149, 95,199, 28, 48, 2, 87,154,250, 35,127,
+ 20, 93,254, 73, 72, 73, 78,194, 69,215, 63,225,223, 56,134, 52,117,106,213,181,169,238,219,115, 15, 11, 20,130,238,239, 29,161,
+ 8,253, 85,218,133, 85, 55,109, 18, 0, 82,169,243,161, 67,135,220, 35, 35, 35, 29, 61, 90, 13, 62,103,203, 53, 98, 70,219,242,
+240,225,131,162,200,200,190,117,232,159,205,123,131,166,183, 83,128,144,231,201,106,134, 39,123,180,249,241, 73, 64,221,162, 79,
+201, 60,130,198,211, 32, 54,143, 51, 60,168,104, 67,110,220,214,250, 86,174, 64,226,208, 75, 40, 18,189,215,184,121,235,176,204,
+148,196,104,157,182,116, 21,107, 42, 62, 87,103, 34, 43,251,225,169, 11, 49,253, 4, 66, 33, 21,217,171, 19, 99, 2,206, 60, 75,
+163,123,122,122, 14, 89,191,126,125, 96,231,206,157, 1, 0, 44,203, 58,236,221,187,215,107,225,194,133,138,248,248,248,253,245,
+164,245,113,119,119,247, 19,139,197, 62, 0, 96, 54,155, 51, 53, 26, 77, 26,128, 90, 95,252, 21,158,129,110, 32, 88,112,225,252,
+121, 1, 0,116,235,214,125,145,223,115,239, 56, 51, 34,165,161,202,234, 48,151, 42,138,146,206, 76,191,124,229, 18, 5, 0,225,
+157, 58,207,146,187,181,216,240,191,180,108, 73, 61,130, 58,209,192,251,225,221, 34,134,141,124,101, 12,221,170,153, 31,250,244,
+238,249,145, 1, 56, 84,167, 62, 35, 16,200,174, 94,189,218,132,166,105,134,101, 89, 99,120,120,120,218,179,228,171, 65,243,206,
+191, 83,160, 27, 90, 88,243,215,154, 7,209,139,128,167, 2,199, 48,142, 13,195, 62, 5, 35,120,139,231,249,244,210,180,232, 46,
+255, 65,139,214,211,245, 92, 87, 38, 90, 32,126,111,212, 27,147, 67,166,127,240,137,116,218,154, 40, 28,249,114, 86,222, 63, 85,
+100, 1, 0, 67, 51,190, 39,126, 61,225, 33, 23, 51, 0, 0,173,145, 69,191,200,200,218,159, 8,141, 58,158,165, 41, 42,168, 34,
+148, 56,199, 90,164, 2,161,216, 72,149, 9, 36, 80, 0,220, 26, 52,138,242,100, 47,202, 71,189, 28,225,191,125,247,201,140,180,
+140,252, 58, 15,106, 20, 35, 66,120,247, 62,136,232,221,215,241,234,149,223, 23,108,217,180,241, 99,214, 98,221,200, 91,249, 85,
+198,130,196,172, 90, 7,115,175,102,237,196, 74,183,227,195,222, 94,232,106,164, 93, 48,231,243,181,110,231,143,237, 60,151,153,
+ 30,202,167,166,166, 27, 9, 69,221, 45, 44,200,126, 79,151,147, 20,103,107,149, 41,149,202, 64,165, 82, 25,218,166, 77, 27,233,
+140, 25, 51,132, 47,188,240,194, 31,146,125,194, 4,209,217,179,103,189, 87,172, 88,209,255,214,173, 91, 70,173, 86,123, 83,171,
+213, 62, 64, 29, 22,218,123,121,185,191, 51,124,232, 64,244, 28, 54, 5, 28, 79, 97,194,228,233, 56,113,108,255, 68, 0,127,138,
+208,178,202, 29, 22,190,245,246, 12,247,240, 14,109,153, 5, 59,227, 32, 19, 11,208,183,125, 16,245,198,212,217, 78, 91,215, 45,
+248, 6,121,120,190, 42, 75, 22,175, 47,158, 29,226,102,126,101, 80,231,198, 56,184,203,252, 10,122,205, 4, 45,119, 92,148,126,
+240,147,251, 0, 16, 24, 57, 85, 37,225, 52,235, 27, 56, 49, 30, 18, 78,179, 62, 48,114,234,169, 7,199,215,151,214,148, 23,161,
+ 68,226,191,107,231,206,102,206, 42, 17, 4, 52, 5,134,161, 32, 96,104, 24,205, 28, 70,188,252,202,159,214,205,101, 30,205,250,
+211,101,193,178,193, 3,223, 25,114, 19,142,214,165, 77, 40, 70,228,122,248,224, 1,129,135,163, 4, 12, 67,129,161, 1,134,166,
+144,162, 54, 96,252,248, 55, 28,159, 85,176,247,235,234,209,225,195,145, 65,125,195, 67, 92,218,252,120,137,114, 12,239, 55,210,
+ 53,207, 40,127,125,247, 47,103, 94, 33,221,166, 95, 33,132, 95,158,113,113,237,175, 53,145,152, 76, 38,117,223,200,126, 14,148,
+ 64, 33, 63,245,243,182,238, 2,154,130,149, 35, 96, 57, 2,174, 60, 54, 42, 85,254, 6, 67,211, 20, 8, 79,240,214, 91,227,209,
+ 55,178,159,158,103,249, 12,219, 7, 57,122,251,241, 83,191,185,155,172, 60, 86,172,223,186, 64, 87,172, 89,240,240,190,107,138,
+182, 56,111,186, 33, 55,193,230, 56, 24, 52, 72,251,244, 7,177,111,239, 60,124, 25, 33, 45, 91,128,227,203,242, 25,228,171,192,
+206, 35,151, 17, 28, 20, 92,150,111,158,160,121, 67, 37, 58,180,239, 0, 60, 21,154,204, 86,145,165,154,243,252,139, 99,230, 15,
+ 24, 49, 14, 30,238,238,160,137,117,192,169, 35, 59, 7,124,247,213,242, 15, 89, 99,201,138, 58,145, 17,238,209,115,129,240,252,
+ 51, 91,157, 26, 52,104,224,222,161,195, 31,238, 24, 89,150, 69, 64, 64, 0, 50, 51, 51,131,234,243,158,230,237,237,253,226,220,
+185,115, 61,250,247,239, 47,244,242,242, 2, 0,228,228,228,248, 28, 63,126, 60,108,238,220,185,185,217,217,217, 71, 80,131, 71,
+ 31,206, 74,139,104, 1, 24,169, 84, 94, 86, 70, 80,244,140,119, 94,107,227,233,221,160,202, 64,238, 26, 77,142,120,230,148, 51,
+148, 64, 32, 42, 63, 31, 52, 33, 60, 85,131,149, 40, 66, 40, 20, 86, 57, 67, 97, 97, 28,194,137,208,241, 77,154,161,203, 58, 43,
+107,213, 20,166, 93,111, 81, 7, 75, 92, 43,161, 88,180,113,248,200,113, 93, 94, 26, 54, 24,222,238,142, 56,117,241, 22, 38,190,
+243,190,149,181, 88, 87,213,107,240, 96, 24, 65,110,110,110,138,179,179,179,215,179, 63,111,169,198, 39, 79, 28,243, 56,117, 58,
+106,214,202, 53,235, 38, 89,204,172,149, 39,228, 81, 28, 99,153, 76, 34,236, 61,224,101, 7,143, 38,225,210,117,115,223, 20,254,
+ 7, 45, 90, 91,254, 20,161, 37,150,169, 94,254,108,230, 84,233,194, 29,151,113,228,203,137,121,250,146, 60,247, 71,111, 10, 14,
+ 78,215,117, 37, 69, 97,245,201,161,210,189,121,103,138, 17,188, 77, 49,140,130,162, 41, 49,207,241,233,172,217,188,200,144,159,
+144,253,172,165,231,121,130,159,126,207,173,155, 0, 34,104,186,253,199, 3, 30,158, 78, 18, 24, 45, 28, 70,142, 26,131, 31,126,
+248, 65,229,238, 40,134,209,204, 98,249,202,149,165,218,148, 35, 30, 41,233,133,153, 17, 3,223,255,245, 65,114,110,108, 90,182,
+113, 79, 93,243,102,178,112, 40,209,179,208,155,104, 52,107,213, 1,203, 87, 5, 75,211, 82, 31,190,191,237,187,111,222,189,123,
+151,249,129,103,232,249,198,236,123,233, 85,222,116, 94, 33,125, 29,156, 93,119, 13,125,251,115,167,132, 92, 1, 8, 44, 72,114,
+144,226,229,215,223,117, 8,244,146, 65, 33,101,156, 30,166,102,122,207,248,240,195,139, 15, 56,210,177, 68,243,224, 97,109,249,
+105,212,168,209,176, 1, 3, 6,200, 63,248,224, 3, 97,195,134, 13,241,221,206,189,254,221,250,142, 24,152,149,173,110, 72, 8,
+129,167,135, 71,250, 91,111,140, 56,116,244,232,209,212,244,244,116,225,178,101,203, 58, 29, 56,112,160,101, 78, 78,142,205,111,
+166, 28, 33, 48,154, 56,112,229, 15, 72, 77,177,169,206,250,212,199,199, 71,146,153,153,105,170,100,101,160,254, 48, 20, 82,125,
+123, 61,223, 73,176,249, 88, 50,180, 70, 14, 10,169, 16,201,106, 61,218,183,109, 77,125,205,177,161, 85, 17,142,127,249,197,217,
+158, 74, 18, 57,168,115, 99,120, 56,203,241,237,134,207,113,240,210,195, 72,181,150,194,122,194,188,237, 45, 17,244, 86,240,217,
+235, 95,104,223,196,171,103, 59,127, 92,107,223,196,235,124, 76, 92,188,108,196,202,169,153, 90,225,169,194,227,239,150, 86, 61,
+240,208,112, 81,137,176,245, 68, 42,228, 82, 1, 20, 82, 1, 20,146,178, 79,154,166,158,237,173,214,187, 69, 67,134,231,198, 51,
+140, 96,252, 43, 47,143,104, 48,250,149, 17, 4, 12,141,189, 63, 29, 26,188, 99,199,246,108,171,197,252, 13, 71, 51, 91,171,235,
+ 63,143, 85, 40, 13,120, 56,138,241,225, 55,177,112,144, 9,161,146, 11,225, 32, 23,162,103, 27,119, 48,116,189,179,232, 60,113,
+112, 96,255,137, 67, 27,245, 8,242, 83, 54,187,153, 84,124,119,252,162,232, 53,103,139,122,188,183, 97,117, 75, 87,109,145, 89,
+ 48,103,198, 91,130,140,172,172, 30,123, 15,157,235,201,153,199,197,177, 22,221, 39,154, 91,123,171,180, 10,103,196, 93, 10,243,
+ 9,127, 73,106,209, 90,111,223,140,203,104, 82,104,146,224, 78, 74, 9, 20, 82, 1,148, 21,117, 43, 21, 64, 33, 21, 66, 41, 21,
+ 32, 43, 35, 25, 5, 58,230, 98,166, 43,221, 3,231, 46,213,201, 77,190,209,194,225,198, 67, 45, 26, 5,181,133,183,119, 3,152,
+251,191,218,232, 74,212, 79,191, 92, 61,247,243, 18,125,206,253, 79,108,229,217,121,248, 50,102, 77,127, 59,134, 2,174,151, 63,
+164,195,230, 44,253,178,221,130, 89, 83, 30, 75,155, 49,127, 93,187,250, 91,178, 84,179,123, 14,157, 60,191, 91,239,161, 40, 45,
+ 80,227,247, 95,247,160,239,128,225,120,117,220, 52, 56, 57,185, 45, 95,181,104,230, 77,214, 84, 18,245,212,152,235, 21,252, 92,
+235,144, 22, 59,124, 26, 52,104,200,243,101, 81, 62, 8, 1,180,165,197,152,249,222, 91,224, 9, 65,104, 88,199,158,210,110,189,
+ 9, 41,143, 6,146,151,159,167,139,187,127, 55,194,152, 27,119,197,230,186, 52, 26,173, 26,141, 6, 55,110,220, 64,124,124, 60,
+238,220,185,131,252,252,124, 56, 58, 58,106,117,186, 58,249,126,115,104,211,166,205,232,168,168, 40,169,179,243, 31, 65, 26,204,
+102, 51, 84, 42, 21, 70,143, 30, 45,236,211,167,143,207,139, 47,190, 56, 54, 54, 54,118, 39,128,146, 42,243, 83,144,152,165,242,
+ 12,218,244,252, 11,207, 79, 2, 0,153,131,247,195,245,223, 29,186, 83,227, 11,173, 99, 3,255, 46, 93,186, 54, 1, 33,160, 64,
+214,234,243,227,115,106,176, 18, 41, 46, 95,190, 28,200, 48,140,224,143,103, 16,143,175,190,253, 49,248,228,133,219,195,150, 46,
+ 95, 33,117, 80, 72,160, 41, 54,227,205, 87,135,218,252, 12,150,121, 6,245,239,210,165,251, 47, 11,230,127, 38, 80, 42, 20,248,
+245,202, 3, 76,125,239, 67, 99,118, 74,236, 10,194, 11,191,212,107,226,115,159,241, 81, 73,240, 39,160,153,175, 18,170, 65,125,
+165, 19, 95, 27, 36, 53, 91, 57, 20,233,172, 48, 89, 56,112, 60, 65,177,206,138,187,105,165,112,115,168,123,136, 48, 66, 72, 7,
+ 0,238, 0, 52, 20, 69, 93,171,252,189,226,133,174, 66, 27, 63,241, 61,175,252,249,224, 10,192,140,178,157,250,143,186, 79,249,
+247,234,210, 43,174,191, 11,160, 69, 57, 39, 7,224, 42, 69, 81,133,213,136,173,167,172, 92,130,195,135, 15,147, 1, 3, 6, 60,
+ 26,241,159,252,254, 36, 36, 34, 97, 3,133,163, 59, 8,185, 7,138,250,227, 52, 15, 47,159,252, 21,171,214,184,188, 51,249,237,
+212,146,162, 2,255,242,228, 83,182, 60, 44, 4, 20,179,234,249,174,225,125, 38, 77,158,140,160, 64, 95, 17,199,113, 36, 54,254,
+161,117,219,214,111, 95, 63,127, 73,188,166, 36, 35,118,118, 37, 19,100,157,182,125,114, 60,151,241,164, 5,139,227,185, 39,223,
+110,159, 14, 82, 77, 1, 78, 74, 49, 54, 29, 75, 6, 33, 0, 5, 2, 71,133, 16,187,207,102,224, 97,204,254,146, 1,161, 37,186,
+209, 75,231,245,236,209,255,221,168,187, 73,198, 61,185,185,198, 19, 0,114,106,226,172,122, 64,231, 97,178,112,176,178, 44,246,
+ 29, 58,132,200,158,157,208,165, 75, 39,116,239,214, 69, 16, 29,115,107,220,228, 73,111, 53,196, 31,187, 59, 30,113, 74, 61,155,
+118, 80, 58,186,237, 25, 54,105,153,234,118, 6, 11, 1, 3, 52,246,146,193, 69, 37,130,153,165,144,162,177,148,223, 57, 78,152,
+ 58, 99,190,203,172,247, 39, 29, 45,209,136, 67,128,123,150,154,202,174,215,235,197, 99,198,140, 17, 90,173, 86,203,232, 55,167,
+245,201,201,209, 12,254,106,237, 23, 18, 15, 15, 79,232,141, 44, 98,238, 36,182, 88,176, 96,126,227, 67,199,207,254, 60,239,195,
+137,191, 68, 70, 70, 58,254,248,227,143,124,109,245,249,216, 27,162, 58,111,195,183, 59,246,253,176,122,197, 98,196,165, 22, 98,
+235,230, 47, 65, 56,118, 83, 45, 85, 85,153,147,140, 25, 51, 70,246,243,207, 63,251,102,100,100,148,232,245,122,205, 99,246, 8,
+154, 18,168, 11,244,112, 83,137, 33, 18,208,240,116,150,194,195, 81, 2, 33, 3,208, 20,197, 85,197,185,117,207,145, 69,188,190,
+ 24, 7,119,153, 95,249,118,195,231, 24,247,206,167,136,205, 19, 31,167,229,142,139,166,188, 50,108,150,187,140,139,108,224, 68,
+123,244,108,215, 8, 10,169, 8, 31,191, 59, 6, 29, 99, 82, 60, 50,139,248, 79, 53, 6,166,237,252,227,143,130,117,159,122,220,
+ 56, 82,102,193, 82,201,133, 56,190, 99,121,174,174, 88, 83, 92, 49, 37,103, 54, 25, 83,109,236,198,167,170,120,179,157,213,182,
+117,171,207, 39, 77, 24, 79,119,237,220,145,208,180, 16,121,165,102,138, 16,224,189,169, 19, 49,101,226, 91, 94,233, 89,185,115,
+190,252,114,211,236,168,147,100,161, 78,115,127, 94, 77,156, 52, 85,102, 5, 82, 74, 5, 80,202,202,132,139, 82, 42,128,209,204,
+129,162,192, 56,249,133, 21, 83,101,150,220,172,130,212,106,223,192, 31,227,116,241,107,117,250,228, 67, 85,112,225,158,194, 75,
+201, 89,119, 22,197,220, 82, 95, 5, 80,208,176,187,211, 88, 11, 75,160, 53,178, 72, 86,235,193, 90, 8, 53,174,159, 63, 2, 94,
+162,130, 22,127,123,253,135, 99,183,224, 80,105,208,127,140, 51,243,242, 62,163,107,200,208,145,171,215,109,190,182,226,243, 79,
+153,188, 98, 51,120, 66, 32, 21, 51,144,137, 5,229, 7, 3,131,174, 24, 95,110,252, 58,135, 5, 53, 12,231,206,177,117,233,159,
+224,201,171, 67,251,119,223, 77, 1, 98,138, 22,101, 52,240,111,228,223,107,224,235,210, 94,131,198,128, 99,205,179, 98, 46,144,
+ 51,250,220,184,211,182,112,134,180,108, 1, 10,184,174,203,141,159, 8, 0, 10,143,230,155,130,131,130,219, 61,153,214,180,105,
+ 80, 59, 91,218,253,145,165, 84,170,122,199,217,197,253,211,160, 86,109, 61,212,133, 38, 74,229,234,139,228,132, 27,216,181,113,
+206,118,222,104,158,127,250,200,158,207,215,108, 61,240,114,175,200,161,248,246,171, 47, 62,206,207,126, 36,180, 78, 85,178, 86,
+189,186,237,155, 45, 13,133, 98, 9,172, 44, 15, 43, 71,202, 62, 89, 14, 5, 5,133,176,178, 60,164,114, 21, 88,158,130,149,227,
+ 97,101,121,152,204,172, 98,226,152, 23, 39, 27,129, 43, 85,229,211, 39,248,249, 19, 34,137,196,159,160, 44,118, 45, 33, 4,201,
+ 57, 6,218,219,219,123, 39, 0, 72, 36, 18, 72, 36, 18,240, 60,143,152, 56,205, 59,110, 65,205, 39,161, 92,224,113, 22,115,106,
+ 81,202,111,125,171, 43,187,151,151,215,192, 39, 69,150,209,104,132, 86,171,197,133, 75,215, 28,191,249, 97, 95,100,114,106, 70,
+ 32, 79, 28, 77, 42,143,192,190,165,185, 15, 6, 86, 87,159,165,234,184,201, 14,225,111,209, 31, 76, 25,219,116,221,182,195, 87,
+ 19, 79, 44,170,113,157, 86, 64,175,143,204, 31,188, 61,188,253,210,181, 91, 19, 10,127,219, 52,189,182, 54, 18, 8, 4, 66,141,
+ 70,243,232,254, 94,255,245,174,246,215,227, 50,135,172, 89,189, 70, 26,243,160, 20,183,147,179, 48, 54,194,175,236, 13,199,134,
+118, 87,120, 6,186, 53,110,210,100,231,151,107,151, 10, 18,178,140,216,176,255, 42,162,126,217,116, 33, 39,247, 74, 36,212,217,
+134,250,140, 33,127,130,208,170,150,243,204,173, 60,104,141, 44, 76,102, 22, 86,158,160, 68,111, 69,110,145, 25, 37,122, 11,180,
+ 6, 22, 99,123,251, 85,121, 93, 45,122,196,157,162,168,195,132,144, 1,132,144, 8, 0,226,138,239,101,207,108,234,112,185, 32,
+123,236,251,172, 89,179, 62, 89,178,100,201,157,138,115, 43,210, 43,206,173, 41,189,210,245,174, 31,127,252,113,200,210,165, 75,
+ 23,119,238,220,121,247,239,191,255,254, 16, 64,161,173,211,135,130,202,133, 57,124,248,112,109, 21, 29,104,177, 90, 36, 14, 50,
+ 33, 26, 7,248,225,141, 79,190,117,251,126,233,248, 92,169, 88,192, 28, 59,118,204, 37,223,172, 4, 77, 51, 54,191,162, 40,221,
+155,117, 17,137,196, 71, 86,174, 92,137, 87, 6,118,147,165,229, 89,181,183,210, 12,106,157, 25,172,135,123,115,241,162,197, 75,
+149, 75,151, 45,159,114,248, 32, 95,164, 85,223, 93, 94,245, 20, 95,251,104,134,170,180, 6,139,162, 64,120, 46,163, 48,229, 90,
+123, 0,120,150,181, 88, 90,163, 21, 76,249,218, 26,138, 2,244, 70, 22, 12, 67,229, 22,197,237,185, 59,122,225,162,158,219,119,
+159,204, 34,180, 83,169, 78,151, 44, 71, 89,204,193, 58,195,104,230, 96,178,114,184,115, 51, 6,221,195, 91,162, 75,251, 96,232,
+141, 28,244, 38, 22, 1, 77,130, 0,192,173,202,134, 99,232,135,132,179, 26, 9,225, 84, 3, 58,184,195,195, 73, 12,111,103, 9,
+ 36, 98, 1,172, 44, 96, 48,243, 48,154, 57,164,228, 26, 80,106,144,161,245,243, 35, 26,187,122, 71,155,114, 82,100, 63, 23,164,
+ 69, 15,171, 81,156,114, 28,182,237,220,215, 52, 43, 75, 61,248,232,207, 59, 36,154, 18, 43,110,165,232,144, 91,100, 2, 24,119,
+204, 93,188, 65,242,209,244, 9, 67,182,237,250, 41,181, 87,183, 78,169,117, 45,179, 94, 19,183,125,207,222,125,155, 6, 12, 24,
+ 34,187,115,229, 40, 18,110,156,254, 92,151, 91,167,245, 89,116,104,104, 40, 59, 97,194,132,210,197,139, 23, 55, 60,120,240, 96,
+128, 70,163,185, 1,192,234,228,228, 20,220,188,169,255,205, 95,143, 31,243,121,113,200, 8, 97, 70,158, 1,142,114, 17,252, 61,
+228,184,116,225,132, 85, 44, 22, 86,185,222,164,124,122,112, 20,122,205,196,193, 75, 15, 35,239,228, 75,207,190, 53,126,108,234,
+175,231,227,242,215,255,240,235, 23, 62, 74,235, 13, 41,175, 89, 31,221,190,137,215,172,169, 99,176,100,221,118,156,139,137,203,
+213,209,222,159,103,155,216,147,213,155,210, 1, 1, 67, 65, 37, 19, 66, 87,162, 41, 78,186,126,188,249,159,100,166, 30,251,235,
+207,219,233,130, 82, 43,210,243,140, 84, 86, 65, 41, 56,158,192, 73, 46, 2,203, 19, 20, 21,228, 81, 59,182,255,128,107,215, 46,
+209, 96,232, 55, 1,204,171,177, 66,169,178,169, 66,165, 84, 88,102, 17,146,149,125, 90, 57, 30, 65, 77,155, 96,203,250, 85, 14,
+110, 30,158,120,174,187,237,107,163, 85,174,254,161,187,191, 91,143,179,191, 95,127,225,220,154, 13, 29,148, 13,220,215, 81, 20,
+183, 2, 4, 70,147,133, 67,113, 81, 33,196,230,116,116,244,209,192, 69,206, 33,165,196, 27,177, 57, 9,202,218, 6,252,252,216,
+ 3, 55, 40, 50,100,246,190, 67, 81, 75,250,246,126, 1,177, 41, 37,144,137, 5,144,138, 25, 72,197, 12,132, 20,135, 85, 27, 55,
+ 89, 11,139, 75, 7,228,223,249, 37,175, 30,253,243, 84,249,219,111,153,184,227,180,238,219,215,205,254,254,173,153,203,250, 70,
+ 14,125,157,138,189,118,230, 19, 61,112,218,182, 23, 61, 98, 83, 26,207,219,254,140,147,170,220,214,190,251,209,162,119,251, 12,
+ 24, 1,134, 17,192,106,181,226,167, 31,183,227,187, 13,115,239,155,181,249,175, 3,224,205,185,204,132, 61,219, 55,142,152, 57,
+103, 21, 21, 18,218,177,211,153,236,167,195,123,254, 31,123,231, 29, 21,213,213,181,241,231, 78, 99, 26,189,131,130, 21, 4, 11,
+ 40,246, 94,163,198, 30, 53,193, 18, 49,177, 39,198, 36,198, 68,141, 38,106,212,104, 76,236, 45,177,197,168,177,247,142, 13, 91,
+140, 10, 40,138, 40, 72,239,157,233,125,230,158,239, 15,192, 88, 40,131,229,123, 83,206,111,173, 89,112,135,225,153, 91,207,125,
+238, 62,251,236,195,114,153, 95,198,140,155, 20,234,225,225, 97,247, 87, 68,139,160, 81, 64, 19,244, 27, 52, 12,103,143, 30,198,
+131,216, 24,176,164,212, 48,177, 44,129,172,164, 40,215,108, 50,108,175,180,199, 67, 36,170,179,237,215, 29,254, 28, 14,243,100,
+ 2,249,207, 63,250,192, 48,249,179,175, 59,245,235,221, 53,214,134, 11, 69,106,122,142,227,141,232,184, 32,150,111,235, 51,110,
+198, 10,129, 78,111,129, 92, 99,194,169,173,149,123, 29,145,147,111,251,186, 45,251,141,155,252,205, 38,161,144,203, 49, 54,109,
+228,147,220,181, 93,211, 12, 95,111, 87,229,119, 75,215,181,185,118, 51,186,223,123,163,198,137,194, 2, 91, 50,222, 46, 98,187,
+ 15, 70,189, 19,108, 49, 27,199,104,138, 51, 42,173, 47,200,151, 56,201,124,235,249,105,254,138, 24, 53, 58,196, 16,212,127,198,
+121, 48, 72,214,230,197, 15, 5, 0, 47,111, 95, 29, 95,104,175,172, 65, 4,134, 0,192,154,205,187, 91,221,141,207,158,176,114,
+229, 42, 73, 84,146, 18,119,146,228, 16, 10, 56, 48,154, 88, 48, 86, 6,181, 89,194,157, 52,103,246, 44,251, 18,181, 5, 17, 49,
+ 5,136,141,188, 68, 12, 42,221, 40,137,217,126, 40,220,237,198, 0,104, 8, 32,145, 97,200, 47,234, 60,207,163,192,229, 26, 79,
+116,202,178,165,207,203,246,110, 13,234, 91,120,194,126,124, 27,105,123,134, 33, 77, 25, 2, 39,128,100, 21,151,221, 83,173,117,
+106,234,188,120, 44,251,254, 91,172,222,114, 24,217, 69, 58, 56, 88, 50,112,116,235, 34,124,177,228,119,104,245,149,103, 53, 84,
+231, 71, 42, 50, 70,207, 27,174,242,223,203, 63,183,100,201,146, 1,207, 29,155, 1,149, 28,179, 23, 62, 87,254,255, 75,151, 46,
+253,254,169,191,107,172, 53, 89, 79,140, 86,249, 70, 85, 99,182, 26,185,121,213,249,227,232,145, 67, 78, 37, 42, 35, 68, 2, 46,
+124,235,249, 97,254,218,163,110,111,183,114, 69,161,209, 1,187, 55,253, 84,172,211, 40,247, 90,213, 88,184, 7,180, 21,219, 74,
+ 79, 29, 58,120, 24, 13,124,221, 5,187,174, 22,167, 68, 39,107,159,132,122, 21, 5,105, 54,245,236, 53,188,161,239,188, 35,185,
+112,241,210,103, 42,160, 66,163,197,101,184,181, 55,239, 56,232,110, 39,230,131, 97, 0,165,214,140, 9, 99,134,189,250,109,140,
+176,220,113, 99,195,192,148,153, 44, 69, 81, 46,190,158,249,145, 78,106, 74,120,144,158,154,158,213,107,224, 23, 23, 20, 42, 70,
+ 23,250,254, 71,183, 31,196, 47, 41,209,104, 94,110,146, 31,189,193, 2,189,145, 69, 82, 82, 34, 62, 15,123, 11,124, 46, 7, 92,
+ 46, 91,154, 44,109,174,252,100, 84,101,199, 23,195, 83, 48,124,231,242,169,155,189, 61,220, 93,108,165, 98, 98, 43, 17, 50, 77,
+ 3,253, 5,237,218,117,176,169, 23, 16, 44,184, 26,167, 69,122,129, 22,201,217,114, 8, 61, 90,240, 70,244,120, 27, 59, 87,205,
+232, 86,156, 30,201,193,139, 73,138,207,112, 46,226,207,129, 91, 54,174, 20,230,201,140,120,152,174, 66,110,137, 14, 57, 37,122,
+228, 22,235, 96, 43,230,163,203,160,137,194,147, 71,127, 25,216,179,115,219, 53, 47,179,221,201,201, 41, 39, 83,179,114,222, 13,
+ 14,105,131,157,191,253,218,217,209,177,158,189, 76,150,162,176,246,232, 44, 90,180,200,102,233,210,165,188,181,107,215, 42,218,
+181,107,231, 57,123,246,236, 62,249,249,249,183,234,214,173, 27,112,246,208,246,139, 45,186, 12,110, 13,214,232,214,185,107,119,
+129,144,229, 33,252,196, 9,227,190,189,187,138,180, 90,229,228, 42, 13,135,196, 97, 81,158,138,129, 91,173, 90,177,182, 54,150,
+183,120, 28, 89,124,201,153,105, 59, 74,128, 67, 13,250,126,114,254, 82,228,163,248, 86, 81,169,238, 23,163, 30,231, 23,107,140,
+141,146,206,124, 81,101,195,203,101, 24,240,185, 28,216,137,121,224,148,181,170,182,222,193,143,193, 48,110,229,145, 83, 6, 76,
+217, 79,128, 97,144, 93,146,126,199,138,156, 13,134,176, 4,120,148,169,134, 74, 87, 26,154,175,237, 42, 65, 65, 94, 38, 54,172,
+217,142,232,200,219,232,253,246, 32,172,223,188, 11, 19,198,188,171,171,238,233,135,195, 41,139,104, 61, 21,205,178, 21,243, 0,
+ 48,144,169, 77, 56,120, 45, 3, 13,235,115,172,190, 49, 0,128,157,173, 4,114,165, 22, 28,129, 29, 18,163, 78, 73, 78, 95,186,
+ 57,123,238,194,149, 95,150,228,196,164, 63,190,119, 21, 1,174,114,212,175,101, 68,108,174, 61, 34,139,234, 33,192,175, 1, 56,
+130,219, 86,105, 23,198, 6, 45, 59,202, 57, 56,160, 85,139, 38,237,235,184, 59, 66,107,176,148, 69,181,184,248,117,219, 14,164,
+166,100,142, 43,122,112, 52,250,117, 56, 90,117,126,114,129,208,221,239,227,123, 55, 47, 36,191, 51,234, 99,120,213,242,109, 46,
+ 75,191, 99,229,205,203, 58, 83,101,177,210,104, 9, 36,142,179, 63,159,243,195,180,222,253,135,227,207,171, 23,112, 39, 54, 17,
+109,219,182,198,219, 67, 70, 64,169, 40, 14,220,191, 99,213, 91,102,141,242, 44, 79,104,158,214,166, 67, 15,134,181, 88,144,240,
+240,126, 98, 69, 90,218,156, 71,119,110,228, 60,178,127,166,123,202, 53,176,185,173,131,243, 29,189,209,130,172,172, 76, 92,255,
+ 35, 34, 68,155,243,168, 70, 5,132,133, 2, 46,194,163,243, 97, 44,155,195,180, 75,215,183, 12, 2,142,190,243,226,149,219,169,
+ 20,239, 5, 0, 0, 32, 0, 73, 68, 65, 84,218,229,100,231,112,164,246,174,172,115,173,198, 2, 47,161, 81,127, 55, 73, 46, 48,
+154, 88, 52,240,150, 86,169,233,230,237,247,253,140, 25,159, 55,230, 10,196, 80,170,245,134,156,236, 44,207, 77,187, 47,169,226,
+ 30,222,171, 85,219,221,193,254,135, 85,191, 8, 20, 58, 6,249,114, 61,138,149, 10,102,212,164,175,188,183,172, 91, 50,186, 42,
+163, 85, 65,186, 72,253,147,225, 87, 3,157,236, 4,140, 74,103,102,139, 20, 70,203,168, 33,175, 54,232,178,204,100, 77, 92,185,
+ 98,149, 36, 58, 73,137,187, 73,114,136, 4, 92,216, 8, 56, 48,152, 88, 88,121, 57,113, 60,221, 61, 39,119,104, 21,132,179,119,
+ 10,193,229,114,160, 85,150,104,120, 40,138,111,213,173,183,164,101,155,118,232,222,173, 43, 30,199, 63,242, 61,113,236, 96,207,
+ 27,215, 47,231,154,141,141,166,170, 11,226, 15,215, 40,176,160,209,112, 77, 54,158, 31,120,213,170,219,113,232,136, 15, 28,234,
+248,214, 98,220, 93, 93, 96, 38, 60, 76, 28, 51,204,234, 43,191,212,152, 3, 75, 23,206,134, 94,111,128,155,163, 13, 8, 1,182,
+173,153, 15,131,193, 0,111, 23, 33,228,234,202,103,147,171,206,143, 84, 22,133,170, 81,238,201, 83,102,172,170,247, 25,134, 57,
+ 49,107,214,172,175, 1,144, 89,179,102,125, 93,190,188,100,201, 18, 45,128,236,106,186, 14, 55, 61, 99,180,202, 55,174,242,171,
+ 91, 16,224,234,226,117, 35,252,236, 25,135, 35,119, 89,252,121, 56, 18,253,219,122, 65,192,227, 64,226,224,141,187, 41,114,156,
+ 60,180, 81,118,116,207, 47, 89,122,189,254,199,234,251,154,253, 90,217, 74,164,103,127,219,185,151,117,117,113,225,108, 8, 47,
+ 72, 42, 82,154,159,116,105,197,223, 60,198, 70,158,221,228, 69,192,156, 17,137, 68,126, 6,131,193,169,186, 3,187, 45, 60,173,
+ 44,137,151,121, 29,109, 43, 24, 46,215,178,115,215, 78,184,218,219, 64,111, 98, 49,235,203, 79,181, 97,189,109,101,163,222, 27,
+209,163,123,191,105, 23,249, 82,255, 11, 29, 66,252, 73,139, 22, 45,100, 92, 46,215,170, 84, 10,119,119,247,249, 28, 14,103,164,
+141,141,141,157,193, 96, 80, 26, 88,157, 68,173, 51, 64,103, 4, 52, 26, 29,248,130, 82,179,200,231, 50,208,234, 12,208,104, 13,
+ 85, 95, 24,185,247,175, 1,104,164,120, 42,166,116, 33,174,129,205,239,251,143,126, 58,252,189,208,185,181,154, 15,177, 77,201,
+145, 67,192, 24,209,186,177, 23, 46,157, 57, 76, 50, 83,227, 63,175,206,100, 1, 64,126, 65,177,143,155,155, 7,162,147, 85,200,
+ 42,210, 34,183,204,100,229,148,232,161,212, 42, 17, 92,199, 27, 50,185,220,231,165,247, 47,112,248,236,217,179,239,246, 27, 28,
+138,105, 95, 46,232,180,117,227, 79, 49, 82, 27,254,135,234,188,132, 8,107,140,214,253,251,247,139,103,206,156,217,112,243,230,
+205,156,209,163, 71,107,131,130,130, 68,239,191,255,126,167, 29, 59,118,136, 36, 18,145,246,238,213, 99,115,199,127, 50,107,240,
+166,213,139,154,151,148,148, 48,102,147,233,180,177,164,100,150,170, 26, 51,151,113,236,235,135,243,146,140, 99,223,234,236,118,
+204, 89,194,105, 42, 36,134, 17,104, 60,127, 47,226,230, 27,147,206,172, 85,138,223, 93,254, 73,182,140,157,163,227,184, 47,174,
+206,100, 1, 0,135,203,192, 96,182,192, 78,204, 7,135,195, 41, 55,241, 94,191,238, 61, 45,113,115,176, 1,159,203, 1,143,203,
+ 64,161, 49,161, 80, 97,196,199, 31, 88, 91, 33,132,176,102, 11,129,214, 96,134,166,236,233, 80,169, 40,196,236, 47,167,227,237,
+129,239, 96,252,228,233, 40,209, 2,145,201, 74, 24, 77,166,106, 47, 10, 14,195,129, 70,111,198,135,189,235,160, 88,101,132, 90,
+107,134,193,204, 66, 98,195, 3,159,199,129, 84,196,131,189,132, 15, 16, 34, 40,111, 76,248,124,190,206,100, 50,237,172,226,137,
+ 30,245,124, 60,160, 53,113,208, 38,244, 39,244,106,223, 8,177,215, 14,242, 46,255,121,175,254,103, 95,206,193,167, 19, 6,226,
+192,195,134,112,118,175, 3, 91,169, 24, 38,194, 1, 64,172, 76,216,155,207,114,140,239,140,252,121,243,182, 71,223,125, 59, 75,
+ 36, 83, 51, 16, 10,184,184,120,225, 60,110,220,140, 92, 93,248,224,232, 78,188, 70,248,132,227, 97,111,111, 15,145, 13, 23, 6,
+163,222, 96,125,234, 2, 1, 1, 66,164,238,141,126, 46,123,226, 15,177,176,168,224,189,234,141, 22, 79,100, 63,107,234,151,223,
+125,223,187,255,112,132,159, 56,128,253, 7,246, 90,218,247, 29,199,221,245,235, 70,116,234, 53, 8,157,122,135,226,244,225, 29,
+211,213, 44,211,100,226,180,185, 11,187,244,232,135,240,147, 7,144,151,155,185,220,218,245,229,242,153,105, 61,222, 26, 8,157,
+193,130,206, 61, 7,224,204,241,195,159,160,108,144,133,245, 55,177,231,218,103,112,204,211, 63,159,198,207,151, 25,248, 5, 10,
+ 3, 50, 11, 52, 72,201,211,224,232,158,173,196,250,246,194,208,186, 75,112,109,254,196,101, 23, 51,124,106,123,233,249,122,173,
+ 56, 62, 49, 41,112,252, 7, 97,252,250,126,129,156,124,185, 30, 5,114, 61, 10,229,122,168,116,102,248,213,246,231,152,204, 76,
+251,154, 30,103, 87, 7, 27,254,250,227,201,176,151,242,209, 33,240,229, 7,218,178, 44,251,151,201, 90, 89,106,178, 98,146,229,
+ 16, 10,184, 16, 10, 56, 16, 10,184, 48, 91,136, 85, 15, 46, 98,247, 70,253, 62,158,250,145,183,193, 12, 20,201, 13,224,113, 25,
+184,187, 58, 73, 91, 55, 31,137,109, 63,125, 2, 0,152, 48,115, 3,198,127,248, 62, 26, 55, 13,130,172,164,196,115,228,240,126,
+ 43, 1, 28,182,118, 93, 79,133, 71,248,134, 95,137,158,249,241,140,121,182,239, 13,236,206,189,147, 36, 71, 78,177, 30,137,241,
+202, 26, 69,222, 0,192,108, 97, 65, 64,176,125,239, 9,136,109,120, 40,144, 27, 65, 8,193,162,181,251, 96, 39,230, 35,167,164,
+180,187,191, 42,170,244, 35, 85, 68,164,106, 16,109, 28,128,210, 92, 46, 55,107, 35, 90, 75,150, 44,137, 93,178,100, 73,133, 17,
+178,167, 76,214,203, 77, 42, 45, 16, 72, 3,237, 93, 92,255, 12, 63,115,202,238,240, 93, 11, 46,221, 45,194,240,206,181,161, 42,
+ 78,199,143, 95,190, 87,204,128, 24, 56, 92,174, 76,175,213, 28,210,106,213,139, 1, 24,171, 60,105, 60, 27,133, 72, 69,182,231,
+215,111,250,205,236,234,238,142,157, 87,139, 51, 75,212,102,211, 95,221, 86, 38, 38,242,236,166,250,102,214,212, 87,151,247,248,
+118,117, 79,226, 44,129, 96,201,198,163, 0, 8, 88,150, 5, 97, 89,240, 69,182, 82,215, 6,237,242,202, 26, 58, 17,143,195,232,
+158,110, 1, 8,107,206, 44, 76,174, 58, 12,202, 0,112,144,240,177,247,114, 22, 0,228,113,149, 81,113,163,222, 43,237, 46,212,
+ 25, 68,138,166, 13, 27,146,214,173, 91,203,196, 98,171,202, 95,113, 61, 60, 60,110,205,157, 59, 55,112,252,248,241, 66, 27, 27,
+ 27,152,205,102,231, 95, 54,109, 98, 55, 45,158,128,161,159,172,135,192, 70, 8,173,206, 8, 62,159,135, 18,185, 10, 50,133, 6,
+ 74,141,169,230,103, 80, 82,146,161, 0, 88,118,228,176,205, 59,125,108,131,219,216,112, 4,104, 25,224,133, 75,103,143,144, 63,
+207,108,155,160,205,143,255,205,202, 19, 17, 42,157, 9,217, 69, 58,100, 21,233,144, 91,162, 67,110,177, 30,185, 37, 58, 48, 12,
+ 3,157,193,252, 74, 55, 46,117,254,163,253, 59,127,219, 50, 72,111,196,136, 46,189,223,193,244,121,235,235,236,252,121,233,249,
+100,194,233,104,101,162,173, 37, 54, 54, 54,245,131, 15, 62,104,190,123,247,110,110,179,102,205,180,113,113,113,146, 50, 19,105,
+180,181,149,136,183,174, 91,114,182, 77,155, 54,123,179,226, 31, 94, 40,235, 79,175,182, 97,175,211,117,172, 80,108,140,158,232,
+ 43,237,208,167,129,167, 4,190, 82,101,159, 64,219,187, 63, 22,245,248,244,251,130,139,171,243,115,244,230,115, 5, 90,110,139,
+ 44, 21,223,170, 28, 60,147, 94,151, 54,116,248, 8,112, 25, 14,140, 58, 77, 90,249,201,229,238, 96,131,249,187, 30,194, 86,196,
+135,157,152, 7, 91, 49, 31,157,154, 56,163, 6,237, 25, 49, 89, 88,104,244, 22,104,245,102,232, 12,102,184,250, 56, 97,243,206,
+253, 72,207,215,226,232,237, 66, 60, 74, 83,194,191,182, 20,132, 84,223, 76,178, 22,147,122,224,176,209,118, 92, 14, 3, 46,135,
+225, 52, 9,108,132, 98,149, 17, 2, 30, 7, 2,145, 24, 82, 33, 15,246, 98, 62, 4, 2, 62,242,243,243,161,215,235,225,235,235,
+ 43,170,218, 10, 18,216,217,138,225, 95,223, 27, 70,147, 25,167,174, 60,192,226,207,135,226,173, 46,173,192,240,109,241, 80, 31,
+ 2, 59,103, 59,176, 28, 14,140,102, 22, 6,163, 5, 0, 71, 87,153,158,143,143, 79, 15,169, 84, 42,213,104, 52,202,244,244,244,
+136,220, 71,135,211, 45,220,193, 19,207,132, 95,220, 57,224,237,183, 16, 29, 19,139, 3,135,143, 93, 45,116,145,207, 40,255,159,
+166, 77,155,182,115,117,117,181, 45, 42, 42, 82,220,191,127,255,214,203, 62, 23, 16, 14,231,179,246,157,186, 65, 37,203, 71, 94,
+ 70,138,213, 79,209,141,235,216,225,155, 37,235, 91, 6, 52, 10,104,105, 33,165,198,171,137,175, 29,190,152,183,166,101, 67,255,
+ 70, 45,203, 7,132, 52,246,173,186, 44, 27, 79, 98,215,123,204,248,233, 75, 6, 13, 31,139,139,225,199,176, 98,241,151, 59,165,
+ 14,110,141,157,157, 28, 90, 52,107,215, 27, 87,207, 31,131,200,206, 19, 78, 46,158,157, 70,127, 56,181,215,240,209,147,112,227,
+234,121,172, 94,250,245, 14,139, 94,249,187, 53,235, 42,117,175,239,214, 60,164,205, 40, 59,103, 15,200,228, 74,216, 57,185,163,
+113,112,235, 81, 15,238,234,103,170,243,147, 11, 94,218,116, 16, 2,189,145,160, 68,101, 68, 70,129, 22,169,185,165, 70,139,101,
+107,144, 19,100, 97, 25, 91, 17,143,231,108,122,236,123,239,252, 69, 82,199,199,131, 89,182,240, 75,174, 17, 34, 20,200, 74, 77,
+ 86,129,194,128, 2,185, 1, 42,157, 9,206, 82, 30, 88, 11, 91,227,167,238, 18,149, 17,118, 18, 62, 28, 36, 2,171,163,140, 21,
+177,241,215,189, 1,119,227,179,135,172, 88,177, 74,114, 39,249, 41,147,197, 47,141,102, 9, 5, 92, 88, 88, 22,176,226,138,231,
+243,248,211, 6,247,235,133,140, 66,109,233,168,101, 14, 3,255,160, 54,112, 21,179,232, 25, 58, 11, 0, 48,176, 95,105,106, 91,
+114,142, 26,199,255, 44, 0,158, 77,236,174,186, 45,214,106,185,155,118,157,252,108,255,190, 61, 14, 58, 11, 15,191,156, 78,133,
+ 70,111,134, 72,192,133, 80,192,133, 88,192,125, 38, 31,187,122,163, 85,154,115,151, 94,104,130, 70,167,131, 66,107, 2, 1,112,
+235,177, 10, 90,131, 25,114,181, 9,237, 2,157, 94, 45, 16,194, 48, 39, 9, 33,253,159, 55, 68,207,155,165,167, 34, 82, 21,105,
+220,126, 90,163,252,243,149, 25,185,167,115,182, 0,212,104, 4, 23,239,121,231,248,244,178, 64,234,212,216,193,206,225,207, 51,
+167, 79,216, 30,190,203, 34, 34,166,212,100,153,180,133, 88, 62,115,100,166, 66, 86,216, 29, 64,146,181, 95, 38,113,109, 28, 44,
+178, 17, 94,252, 97,213, 47, 70,119,143, 90,236,161, 63,101,249,114,141,229, 25, 55, 97,209,235, 57,132, 37, 2, 93,222, 99,171,
+250, 16, 56, 28,198, 56,239,147,119,192, 18,130,249,171,246,227,251, 25,161,176, 21,143,150, 48, 12, 35, 81,235,204,248,124,193,
+ 22, 44,255,102,156,157, 68,200, 3,195,148,230, 68,141, 25,241,142,117, 39,160,206,140,196,155,187, 85,202,228, 19,113, 79,119,
+ 23,182,237,244,118,100,219,182,109,101, 78, 78, 78, 16,139,197,127, 69, 42, 42,193,195,195,227,155,121,243,230, 5, 76,158, 60,
+249, 73,177, 79, 30,143,135,143, 63,250,136, 99,177, 16,156, 62,189, 13,110,117, 67,112,236,220,159,232,219,163, 53, 84, 26, 29,
+138,101, 74,176,224,190,244,137,168,148, 21, 94,204, 77,189,215,166, 99,247,129,136, 56,123,132,252,121,122,235,132,154,212,232,
+113,114,118,202,136,186,151,216,152, 97,156, 75, 35, 90,101, 38,203, 96, 98, 81,199, 67,130,140,212, 68, 56, 58, 56,100, 88,171,
+ 39,118, 11, 24,204,112,200,100, 6,100,155, 58, 47, 97, 63, 0,162,206,137, 27,185,255,247, 77, 49,177,247,239, 44, 30, 48,106,
+ 26,175,247,240,143,184, 63, 47,153,250, 53, 0,107, 11,239, 25, 31, 61,122,244, 96,220,184,113, 29,110,220,184, 97, 1,160, 97,
+ 24,198,196,229,114, 37, 6,131, 65,208,189,123,119,249,195,135, 15, 35, 80,113,210,226, 51,116,250, 96,191, 43, 35, 84,190,109,
+195, 26, 71,214,177, 83,190,213,189,115,123,180,111,234,131,140,206,237, 1, 96, 90,154,202, 54, 64,215,112,203, 94,147, 89,124,
+234,231, 95,143,127, 63, 33,180,215,231, 59,121,243, 87,228,156,152, 95,101, 34,106, 70,220,229, 62, 21,217,120, 30,151, 3, 59,
+ 49, 31,182, 98, 30,236,196,124,216,137,248, 48,153, 73, 77,158, 28,137,201,204,150, 70,180, 12,102,168,180,102, 92,188,147,135,
+ 92,185, 1, 50,165, 17, 90,163, 5, 4,164,244,105,212,138,214,188,224,241,117,199,242, 59,169,163,111,136,124,211,218,159,236,
+ 15, 94,203,124, 50,162,207, 65, 98, 3, 59, 73,233,104,236, 43, 87,174,192,197,165,250,167,125,150,101,113,224,204, 45,172,216,
+126, 17,103,182,125, 5,145,128,139,224,193, 11, 48,118, 72, 91,176,132, 69,226,163,216, 60,255, 38,205, 61, 56, 28, 49, 56, 12,
+ 3,189,137, 5, 64, 42,221,159, 6,131,193, 37, 61, 61, 93,225,231,231,231,233,237,237, 61,156,203,229, 18, 40,239,232,143,236,
+ 41,214, 92, 56,241,187, 68,173,213, 91, 36,102,249, 54,191, 28,109,127,248,249,129, 97, 24, 98,111,111, 47,184,120,241,162, 42,
+ 40, 40,200,237, 37, 47, 37,142,216,189,209,234,241, 83, 62, 27,222,176, 65, 3,236,255,125, 27, 8, 97, 14, 90,251,207,187,142,
+223,192,194,217,207,142, 48,252, 98,222,154,150,203, 23, 76,123,230,189, 41,179, 87, 84, 57,234, 80, 44,180,157, 49,116,228, 68,
+ 68,222,250, 3, 63, 46,248, 98,143, 94, 85, 60,214,100, 54,189, 91,156,147,188,167,126,147,182, 32, 70, 37,194,247,253,132,208,
+247, 39, 8,123, 15, 24,142, 27, 87,207,227,251,175,167,236,210,200,242, 63,128,149, 73,206, 44,225, 79,238,222,103, 8, 95,171,
+ 55, 98,205,178,111, 49,105,198, 98,180,235, 49,144,127,255,206,159,147, 1,124,103,117, 58,132,209,130,238, 65,174,165,230,217,
+196,226, 88, 50,151, 87,209, 25,200,227, 50,156, 22, 13, 28,161, 53,152,161,168,230,161,146, 39,224,231,202,228,138,186,235,190,
+255,140,171,214,153, 81, 32, 55, 32, 95,174, 71,161,236, 47,131, 85, 40,215,163, 64,110, 0,159,199, 32, 62, 41, 13, 28, 62,175,
+198,249,121, 37, 42, 19,218, 52,114, 42,189, 70, 95,178,119,196,196,179,111,123,230,242,221,161, 43, 86,172, 20,221, 77, 81, 34,
+ 38, 89, 81, 22,201,226, 66,200,231,192,166,236,119, 11, 91,154, 27, 89, 21,246,110, 13,234,135,141, 25,221,211,222, 86,140,236,
+132,124,240,184,165, 37, 98, 28,220,125,224, 32,212, 97,234,148,137,112,117,113, 68,122,161, 30,171, 15,199, 35,230,193, 99,176,
+218,154,109,246,154, 95,246,244, 29,255,241, 23,142, 28,190, 13,118,156, 77, 41, 93, 79,174, 5, 15,255, 60,174,203, 78,188,167,
+ 86, 41,138, 8,136,197,202, 28,100,134,152, 45,165,167,219,247,243,103, 97,207,246, 13, 56, 27,149,255,228, 12,188,118,112, 57,
+ 62,155,189, 8,133, 10, 3, 42, 58, 47,171,242, 35, 0, 10,158,138, 68,189,176,252,148, 57,170,104,153, 41, 91, 54, 84,162, 97,
+120,206, 92, 25,158,123,223,240,156, 94, 69,181,255, 54, 85,219,117,248,130, 41,114,116,107, 38, 17, 73,255, 56,125,250,184,244,
+ 72, 12,121, 98,178,140,154, 66,178,120,218,192, 76,133,172,160,119,141, 76,150,155,127, 51,161, 68,120,121,238,162,213,122,143,
+ 90,117,205,167,238, 40,138,148, 58,139,249,197, 28, 4,169, 69,234,224,166,227,217, 8, 87,240,181,134,111, 11, 11,227,212,213,
+ 69,158, 88, 66,112,226,102, 46, 8, 41,125, 68,218,119, 37, 11,101, 79,230,176,176,165,221, 42,231,238,228,131, 87,150,135, 98,
+109,248,123,227, 47, 27, 20,253,131,228,234, 81,223,207,127,210, 93,216,174,121,105, 36,203,222,222, 30,142,142,142,176,181,181,
+ 69,117, 93,135, 12,195,140, 25, 63,126,252, 11, 79,255,249,249,249,232,213,179, 59,214,110,216,140,230, 61,195,112,238,250, 89,
+ 24, 77, 44,130,155, 52, 64, 93,111, 39,100,228, 41, 95,234, 66,151,122, 4,124,220,166,251,144,175, 59,245, 24,136,139,103, 14,
+145, 63,207,252, 58,177,166,133, 16,251,247,234,112,124,225,194,249,245,231, 46, 94, 39,180, 19,241, 16,167, 50,128,195, 48,168,
+227, 33,129,139,148,131,136, 35, 59,116,161, 3, 59, 88, 93, 28,207,199,167,214,206,229,107, 55, 73,151, 47, 93,208, 61, 50,138,
+185,168,202,142, 47, 6, 0, 77,222,163,101, 15,129, 7,181,255, 8, 63,213,188,235, 59,240,240,110,240, 86,114,222, 67,171,205,
+ 6, 0, 77, 82, 82, 82,242,220,185,115, 3,150, 46, 93, 74,184, 92, 46, 11, 64,184,106,213, 42, 77, 66, 66,194, 29,148, 14,205,
+ 69,117, 55,155,158,111, 53,253,220,214,198,210,206, 89,194,105,218,192, 83,130,246, 77, 75,123, 69, 67,251,119,130,143,175, 47,
+146,114, 53, 45,138, 53, 44, 95,101,224, 54, 88,255, 75,204,237,122,174,220, 9,102,173,225, 1,128,163, 53, 61, 62, 12,254, 74,
+144, 47,143,102,217,137,249, 96, 75,207,149, 26, 25, 45,189,209, 2,173,222, 2,173,193, 12,181,193, 2,141,193, 2,150,148, 94,
+ 19, 12,195,192,104,102, 97,213, 99,243,115,231,190,189,179, 43, 26,212, 99, 96, 47, 41, 93, 55,251,178,114, 15, 12, 0, 23, 23,
+ 23,184,187,187, 91, 21, 21, 53, 24, 75, 47,113,131,137,125,210,173,111, 48,154, 65, 8, 65,124,252,163,175, 82,147,147, 7,251,
+249,251,117,105, 18,220,220, 89, 34,228, 0, 64,165, 70, 75,163,209, 88,236,236,236,220,157,157,157, 57, 89, 89, 89, 79,204,179,
+ 95,139,238,230,195,135, 14, 98,232,208,119, 84,113,183,238, 62, 25,226,174,213,106,153,142, 29, 59,218,251,248,248,112,244,122,
+189,162,166,135, 73,234,214,104,136,147,139,243,226, 49, 31, 76,106,212,189, 87, 95, 92,186, 16,142,163,135,118,255,166, 41,136,
+ 15,183, 86, 36, 32, 32,240,133, 81,135, 13,253, 27,189, 48,234,176,110,125,255, 42,141, 86,147,224,214,109, 9,195,195,217, 19,
+251,136,142, 99,156, 2,128,181,232,148,251,246,110,252,230,187,145,147,103, 55,236, 55,104, 36,198,188, 63, 22, 60, 30, 23, 17,
+231,142, 99,249,130,233, 39, 85,242,252, 48,107,210, 4, 74, 67,111,141, 5,181,196, 62,159,250, 54,108,134,168, 63,175, 34, 49,
+254,126,236,221,219, 55,154,250, 5,181,131,155,119,157, 79,211, 92,185, 75, 17, 23,103,172, 78,198,160,211,165,141, 13,123, 31,
+ 79,143, 58,108, 31, 18,224,194, 60,127, 1, 0,208, 40,243,141, 91,127,250, 60,161,124,212, 33,107, 52,164, 85,166, 43, 47, 41,
+ 56, 16,113,253,230,140,193,253,251,114, 10, 21,134,210, 8,150,220, 80,246,210,163,176,252,119,133, 30,254,222,182,120, 20, 27,
+197,234,228,133, 7,107,120, 93,234,198,190,219,231, 65,249,185,203,178, 4, 12,160,171,113,183, 20,223,126,226,178, 31, 87,136,
+238, 38,171, 16,147,162, 40,237, 42,228,115, 75, 13, 22,159,243,196,116,149,142,102,175, 38, 58,196,112,191,255, 48,108, 4, 10,
+ 21, 70,176, 44,192,227,114,202, 94, 2,164, 43, 25,100, 40, 53, 40, 44, 41, 64,114,106, 26,100,185,137,224,112, 56,112,245,110,
+100,117, 37,105, 11,177,241,210, 24, 72,208,240,254, 93,120,135,254,200,129, 68,200,131, 94,153,135,211,123,127, 42,208,171, 20,
+139,181, 26,213, 33,107,234, 57,254,149,130,192, 20, 40, 84, 58, 15, 33,159,139,253,219,215,225,221,177, 83,158,105,125,191,154,
+179, 16,224, 48, 40, 46, 81,130, 97,152,130,154,181, 75,204,237,170,150, 95, 50, 50,246,202, 26, 21,152,173, 23, 31, 20, 42,127,
+ 26, 37,167,195,207, 28,151, 94, 75, 21,226,214,163,156, 50,147, 85,192, 46,250,164,127,166, 82, 94,220, 7, 64,124,205,158, 11,
+ 57,125, 66, 63,156, 17,219,160, 81, 19,253,165,251,170, 20,153,218, 84,105,158, 67,251,225,115, 99, 35, 79,174,237, 39, 55, 37,
+125, 36,245,106, 98, 97,205,230,101,218,130,248, 5,149,116, 29,218, 44, 88,189,255, 73,183,225,204,165, 59, 74,127,183, 88, 96,
+ 33, 44, 8, 11, 76,253,102, 35,204,172, 5,172,197, 2,214, 66, 96,178, 16, 73,117,171,235,238, 93,247, 80,201,195,125,129,163,
+190,123,177,187,208,209,209, 17, 46, 46, 46,112,113,113,129,189,189,125,181, 70,139,207,231,219,242,120,207,238,234,180,180, 52,
+164,166,166,194,222,222, 30,132, 53,193, 96, 2,154,181,235,141,123,137,247,113,254,218, 29, 16,214, 2,169,109,205,103,121,145,
+122, 4,124,212,186,219,224,117, 61, 6,141,195,185, 67,191,144,219, 87,142, 79,210,230,199,111,177, 58, 66,111,177, 48, 38,147,
+ 9,253,123,119, 75,139,142,125,124,102,206,140,201,125, 59, 12,152, 36,108, 31, 80, 11, 58,131, 5,153,169,137,136, 56,242,171,
+174, 81,125,175,179, 61, 59,183, 77, 51,153, 76,176, 88, 44,213,222,200,117, 6, 99, 33,151, 47,150,142, 24, 49,138,127,251,214,
+173,131, 82, 55,255,253, 22,134,115,151, 33,108, 48, 67,200,208,224,224,198, 48,154, 88,104, 52,138,146,154,110,179, 82,169, 76,
+222,182,109, 91,253,176,176, 48, 73,147, 38, 77,248,137,137,137, 88,190,124,121,145, 82,169, 76,182, 86, 35,252,202,163, 85, 60,
+166, 36,161, 60,162,149,222,169, 61, 70, 12,232,132, 61, 39,175, 33,226,234, 13,164,169,108,239,168,204,188, 35, 25,105,217,250,
+166,206,138,131,131,218,215,229,238,223, 94,114, 48,182,219,172,247, 8, 17,134, 23, 94,158,175,182,254,226, 6,148, 90, 19,236,
+ 37,165,245,158,202, 35, 91, 92,134,177,218, 17, 49, 64,242,213, 27, 81,205, 90,249, 55, 65,116,178, 28,249, 50, 61,180,122, 51,
+ 88,150,128, 5,129,139,157, 13, 68, 2, 14,210, 83,147,193, 18, 99, 74, 13,111, 21, 5, 93,187,116,229, 1, 12, 24,134,240,248,
+ 60, 30, 8, 74,235, 43,138,197, 98,149,187,187,187, 85, 17, 45,163,217,140,161,125,219,162, 93,235, 96, 12,158, 84, 90, 51,243,
+194,111,179,224,100,203,199,158,157, 91,144,113,101,213,206,250,237, 39,135,223,191, 23, 59, 44, 54,250,143, 81,111,183, 20,183,
+240,228,101, 11, 42, 11,147,170,213,234,131, 0,108, 4, 2, 65,223, 46, 93,186, 56, 31, 60,120, 80,230,234,234,202,218, 8, 4,
+ 5,131, 6, 14, 96,249, 2, 65,113,249,103,175, 95,191,206,159, 52,105,146, 93, 73, 73, 73,122, 94, 94,222, 13, 0,166,170, 31,
+ 4, 3,122,129,131,221, 96, 24,145,173, 88,146, 86,175, 94, 3,239,214,237,218, 58, 12, 25,250, 46,132, 54, 66,156, 11, 63,131,
+ 53, 43,151,238, 83,229,196,125, 88,147, 61,249,186, 70, 29,102,166,167, 36,107,180,250,160,102,173,186, 49, 87,195,143, 76, 51,
+194,117, 37, 87,104,252,169,215,208, 41, 13,147,179, 85, 88,179,228, 43, 56, 57, 72,145,146,248, 80,155, 16,119,111,163, 73,167,
+248,202,106,147, 5, 64, 82,100, 25,214,254,253,190, 78,122,163, 5, 87, 46,158,212,177,102,182,239,141,203,167, 18,107, 55,106,
+ 45,106,214,186,167, 83,225,209, 45, 67, 53,192,158,234,116,178, 30,190, 24,193, 37, 6, 89,202,133,139,231, 29, 60,234, 52,229,
+ 50, 96, 96,212,235, 80,144,116,219,172,201,123,168, 80,100,221,183,106, 20,110, 81, 6,190,153, 61,239,135,143, 90,183,106, 37,
+ 37, 16, 61, 19,193, 42, 55, 88,133, 10, 3, 92,237,108,160, 85, 20, 32,225,246, 25,157,166,128, 91,101,189, 51,179, 65, 45, 41,
+204,207,179,249, 43,157, 33,190, 93, 85,159, 47,204,207,179, 49, 27,212,146,234,111,117, 92,216, 75,109,112, 47, 37,235, 73,226,
+187,144, 95,154,155,101,195,231, 62,201,211, 42,111, 11,170,161,155, 64,228,136,172, 34, 29, 24, 16,176, 22, 51,204, 38, 3,148,
+ 10, 5,178,178,115,145,151,155, 7,165, 82, 6,137,173, 19,154,181,104, 3, 59,169, 8,119, 35,246,129, 16, 98, 85, 93, 67, 19,
+195, 15,104,221,174,179,240,126,106,105, 46,150,136, 79,112,124,247,210, 34,149, 34,191,179, 42, 39, 33,161,166,109,177,217, 98,
+ 57, 31,243, 32,161,105,109,175,122,204,157, 68, 57,118,110, 94, 11, 67, 89,100,211,100,178,224,126,186, 26, 57,197, 26,164, 39,
+197, 17,214, 98, 57,143,255, 8,188,202, 3,128,224, 5, 55,107,140,222,163,135, 96,195,134,141, 72, 74, 78,101, 23, 79,235,151,
+174, 82,202,222,174,129,201,234,133,178, 90, 27,154,188, 71,203,180, 78,173, 51,143, 69, 23,115,180, 6, 82,101,130,143,200,173,
+ 14, 58,127,184,252,172, 86, 89,108, 99,209,107,120,199,119,126,184,187, 34,205, 82, 7, 13,195,226, 47, 66, 97, 43,230,129, 97,
+ 24,148,119, 23,174, 95, 56, 17, 18, 97,105,223,178, 86,111,198,232,207, 87, 96,231,138,233, 32, 0, 70,190,123, 77, 83,217,122,
+162,116,238,194,169, 94,184, 85, 59, 45, 53, 63,171,215,192, 47, 46,232,140, 66,253,128,119,194, 34, 91,181,106, 37, 19,139,197,
+ 16,139,197,176,183,183,135,147,147, 19, 28, 29, 29,171,221,118,147,201,164, 50, 24, 12, 46, 54, 54, 54, 96, 89, 22, 41, 41, 41,
+ 72, 73, 73,129, 92, 46, 71, 65, 65, 1,212, 42,133,249,214,133,253,188,102,237,251,193,187, 65, 16,234,248, 55, 7,159,203,128,
+199,227, 32,226,216,230,202,214,179, 98,147,213,117,208,250,158,131,199,227,220,161, 77,228,246,149,227,147,181,249,241,155,173,
+ 61, 70,101,221, 61,119,135, 14, 29, 26, 52,105,210, 36,193,188, 25,147,206,158, 12,143,136,223,127, 98,211,192,146, 18,153, 15,
+ 33, 4,142, 14, 14, 25,161, 3, 59, 28,239,222,177,117,218,133, 11, 23,216,221,187,119,235, 25,134,185, 87,149,102,105, 35,149,
+255,219,133,243, 23,231,119,238,218, 13, 91,182,239,238, 26,251, 32,174,107, 98, 98, 2,124,234, 52, 64,189,250,254,208, 48, 78,
+184,120,249, 42, 84,178,252,223,172, 89,207,231,162, 90, 76, 73, 73,201, 31,161,161,161,189,175, 93,187,198, 9, 13, 13,213, 20,
+ 22, 22, 94,127, 42,138, 69,170,211,188,241,243, 59, 5, 0,126,171,211,117,236,190, 44,163,236, 83, 0, 75,125,235,248, 34,226,
+234, 13,220,184,118,115, 99,161,196,119,193,135,163, 63,152, 88,119, 16,119,252,160,246,117,185,238, 78, 18,252,190,105, 57,247,
+216,141,212, 21,169, 69,150, 45, 75, 47,207, 95,104,205, 49,122,114,227, 80, 26,209,177,177, 51, 76, 22, 2,150,148, 54,184,118,
+ 34,126,101, 13,239, 11,154, 60,131,240,195,201,147, 38, 37, 54, 11,110,241,217,232, 15, 38, 11, 90, 52,240,193,173,199, 50,128,
+ 97,224,236, 41, 69, 78, 78, 14,174, 28,216,100, 46,201,122,184,145,203,101,191,171,193,254, 68, 73,218, 29,191,167, 22, 39, 22,
+ 22, 22, 34, 34, 34, 2,229, 6,203,205,205,173, 50,163,245,140,102, 81, 94,246,245,133, 63,254,210,113,194,152,119, 48,160, 91,
+ 83, 92,190,157, 8, 67, 89,189,166,242,161,228,201, 55,126,182,249, 52,180,129,225,163,161,141, 20, 90,147, 77,234, 55, 41,242,
+ 43, 40,157,131,149,173,100, 61, 13,197,197,197,199, 30, 61,122,212,169,121,243,230,117, 79,157, 58, 85, 28,123,243,236,180,167,
+ 87,226,139, 47,190,176,221,176, 97,131,132, 16,114,221, 96, 48, 36, 89,181,237, 28,252, 30, 21, 25,233, 98, 52,177,184,122,243,
+110,227,158, 29, 91,128, 37,192,237,219,183,177,101,235, 22,221,189,152, 59, 63,169,243, 60,191,171,194,188, 84,184, 63, 45,175,
+ 54,234,240,137,102, 78, 86,234, 79,231, 78, 30,216,217,186,235, 64,140,154,250,221,119, 17, 39,119,207,111,217,121, 0,167,113,
+235,222,136,186,113, 17,231, 79,157,249,193,168, 42,158,143,234,115, 71, 42, 92, 79,161, 88,242, 73,147,150, 93,145,158,150,138,
+148,132,251,191,233,138, 31,103,167, 37,114,127,203,206, 76,155, 92,191,105, 71, 92, 59,187,103, 90, 21, 70,171,202,115,222,199,
+ 77,188,233,212,137, 99, 35, 50, 51,127,246, 84,107,117, 66, 66,136, 78,104,195,203,181,229, 40,247, 42,172, 94,207, 56, 99, 65,
+118,221,161,239,142,158,124,114,205,154,149,124, 15, 71, 9,114, 75,116, 80,104,141, 80,106,140,224, 48, 12,252,188,165,208, 40,
+139,113,249,192,143, 38,131,170, 36, 20, 72, 52, 86,166, 41,117, 15, 88, 84,242,248,226,212, 47,166, 92,130,141,131,143,119,189,
+ 30,179,171,140,214, 41,179,238, 12,252, 98,202,241, 0, 66, 72, 79,169,123,128, 82,157,255,104,110,101,219,206, 48,165,215,247,
+168,238, 62, 48,154, 75,235,143,153, 89,192,194,178,101, 81, 62,128, 60,233,207,103,170,217,118,134,221,123,242, 58,178,243,100,
+208, 26, 76,208, 27,204, 48,154, 44,224,112,185,112,116,114,132,127,189, 16, 56, 56,218, 35, 47, 55, 27, 55, 46, 28, 67,124,204,
+229,235, 12,193, 2,109, 65,194, 5,107,142,145, 64,236, 24,224,229,237,201,201, 81, 24, 32,182,225,226,206,229, 83, 70,147, 65,
+255,147,149, 38,235, 5, 77, 89, 81,241,138,207,102,124, 57,242,215,109,219, 61,131,234,219, 35,179, 80,139,204, 2, 29,148, 58,
+ 83,153, 17, 99,161, 87, 21, 34,230,226,246, 92,139, 78,185, 2,255, 17, 42, 53, 90,102,163, 78,121,240,204, 45,151, 89,243,127,
+228, 62, 78, 76, 50, 45,250,180,127,166, 86,165,232, 87,227, 72,214, 83,252,250,113,253, 61,111, 98, 35, 94,232, 46, 36, 44, 88,
+ 66,112,252,102,238,147,238, 66,182, 44,243, 50, 58,177,234,105, 4,159,158,187,176, 91,191,105,231, 98, 30, 41,119,105,181,121,
+ 14, 15, 31,255, 84, 2, 0, 92, 46,247,201,171, 60, 55, 75,167,211, 25,170,233, 66,217,177,121,243,230,153,147, 39, 79, 22,102,
+100,100, 32, 49, 49, 17, 50,153, 12, 34,145, 8,103,206,156, 49,129, 53,255, 20,115,237,112,202,163,168,240,111, 3, 90,245,174,
+ 29,212,190, 31, 36, 18, 41,120,196,250,100, 76,137,123,163, 17,173,186, 14, 90,215,115,200, 4,156, 63,188,153,220,190,124,108,
+138,182, 32,126, 83, 77,247,165, 76, 38,139, 5,144,240,211, 79, 63,181,216,178,101, 75,253, 25, 51,102, 36,237, 88, 55,127, 13,
+ 0, 20, 21, 21, 1, 0,162,163,163,201,148, 41, 83,244, 58,157, 46,185,164,164, 36, 10,213, 12,128, 0, 0,109,129,228,251, 45,
+235,151, 54,203,200,202,121,167, 65,179, 54,112,171,223, 6,158,126,109, 81,162, 52,226,214,227,108, 36,197, 93, 64,220,213, 3,
+167, 52,182,230,249,168, 97,125,227,230,205,155,251,112, 56,156,122, 42,149,202,179, 73,147, 38,205,165, 82,105,116,243,230,205,
+ 67,120, 60, 94,102,100,100,100,106, 77,180,210, 46,111,215,215,233, 58,118,117,154,210,174,123, 82,174, 38, 36, 77,105, 23,173,
+ 17, 58, 76, 47,184,184, 90,255, 43,183,214, 10, 98, 44,140,221,191, 93,113,240,247, 77,203,185,163, 39,126, 97,185, 47,119,250,
+148, 39,182, 57, 87,179,112, 53, 39,231,163,176,193,127,149,119, 40,139,100,149,253,110, 85,152, 94, 46,143,145, 3,152, 25,243,
+128,191,238,254,167,147, 22, 6,183,238,248,126,151,183, 67, 57,102,129, 45,206, 30,254,153, 36,199, 92,220,207, 35,150, 57, 90,
+ 43,102, 3,168,182, 59,200, 96,176,198,100,189,184,142, 25,210,110,251,119,111, 29,123,240,240,161, 37, 67, 6, 13,118, 89,255,
+205,123,248,241,151, 35,144,138,133, 32, 44,139,247,186,251, 12,255,118,124,224, 64, 31, 15, 81,173,131,151, 50,175, 76, 93,121,
+127,166, 70, 99,140,183, 34, 18, 67, 10, 11, 11,175,218,218,218, 22,116,234,212,169,157, 80, 40,100, 10, 11, 11,121,238,238,238,
+102, 7, 7, 7, 67,102,102,166, 70,175,215, 31, 4, 80,163,178,227, 70, 19,139,148, 60, 29,142, 30, 58,136,187, 55, 47, 32, 46,
+238,145, 50,238, 65,220, 90,134, 71, 86,170,243, 18,138,129, 26, 63,224,131,173,112,212, 33,169,241,168, 67,139, 94,249,251,142,
+141,139,122,104,116,250,177,205, 59,244, 71,221,198, 29, 57, 70,147, 5,247,110, 95,194,165, 3, 43,127, 52,170,138,103,189,202,
+ 49,246,174, 93,223,159,112,109,240, 71,196, 73, 16,150,221, 8, 0,132,101, 55, 70, 95, 59, 53,185,109,191,241,112,118,175,219,
+ 92,150, 30,205,224, 37,170,135, 11,120, 28,245,233,131,191, 30, 78, 73, 73,193,195,135, 15,241,248,241, 99, 20, 23, 23,227,247,
+223, 83,106,116,124, 52, 37,169,231,226, 31,112,250, 12,123,111,212,241,225, 35,198,136,234,251, 7,113, 2,106, 59,193,197,150,
+135, 71,143, 83, 17, 31, 25,195, 62,186,117, 74,103, 84,228, 15,209,150,164, 86,106,252, 36,174,141, 61, 0,203,172,242,185, 11,
+219,183,239, 24,240,229,226, 37,237, 92,220,220, 43,108,199,139, 10,242,109,190,154,122, 44,224,198,159,127, 88, 53,215, 33,107,
+177, 20, 77, 28, 27,202,114, 75, 39, 10,197,147, 56,117,217,222, 43,125,152, 42,125,159,176,230,106, 35,248, 31,188,211, 25,102,
+150,133, 90,107,132, 66,173,135, 92,169, 67, 78,126, 17,238,198,196,224,242,241, 99, 72,124,116, 55,217,100, 48,132,115, 56,204,
+ 1,109, 94,252,229,154,245, 52,241,234,187, 56, 59, 35,185, 88, 5,145, 13, 15,169,241,145,122,181, 66,190,235,101,207, 35,109,
+ 81, 66, 78, 62,151,233, 29, 26, 58,226, 76,143, 62,131, 28, 90,119,232, 37,113,181,119,132,128, 71,144,144,146,141,168,235,103,
+212, 73,119,175, 40, 76, 6, 85,223,215, 49,235,203,223,156,234, 71, 29, 26,245,234,129, 35, 7,119, 61,196,229,242,108, 88,214,
+172, 55, 26,244,195, 94,197,100,189, 41, 8,177,100,142, 29,249,206, 51,207, 6,102,150,136, 71,190,123, 86,251,244,179,130,201,
+ 66, 36, 35,223,189,174, 41,109, 64, 42, 79,236,243,242,114,238, 95, 62,119, 97, 90, 90,209,237,226, 98,253, 37, 0,153, 58,157,
+238,165,215, 49, 47, 47,111,225,226,197,139, 7,104, 52,154,192,110,221,186, 9,237,237,237, 81, 84, 84,132,240,240,112,211,137,
+ 19, 39, 30,228,231,231,127, 11,228,155,181, 8,249, 45, 70,119, 56,236, 81,100,248,183,129,173,250,212, 14,234,208,207,250,198,
+ 76, 40,158,208, 99,208, 56,230,252,145,205,228, 86,196,145,143,180, 5, 9,191,188,194,110, 53,234,116,186,155, 58,157,238,254,
+156, 57,115, 90,123,120,120,120,124,251,237,183, 34,133, 66,193, 95,191,126,189,174,176,176, 48, 87,161, 80,220, 64, 21,249, 52,
+ 47, 18,109,146,103, 97,232,233,131,155,187,147,131,155,223,114,116,173,213,219,193,173,118, 67, 89, 65, 86,178,188, 32, 59, 28,
+192,249,178, 66,145, 53,162, 69,139, 22, 13, 24,134, 9, 5,208, 76, 42,149,250,217,218,218, 10, 9, 33,129, 12,195,196,178, 44,
+ 27,211,164, 73,147, 19, 15, 30, 60,168, 81, 49,217,180,203,219,245, 62, 1, 29,119, 23,107, 88,129,129, 35,216,157,118,121,187,
+ 30, 0,242,207,125,169, 1,112,244, 65,183,153, 67,143,221, 72, 93, 19, 91,226, 48,173, 32, 98,201,177,154,174,179, 60,243,174,
+223,235, 58,255,117, 57, 15, 50, 1,140,141,137,196,242,123,209, 55,230, 49, 4,124, 11,204,139,180,249,143, 35, 95,135, 62,159,
+207,215,213,170, 85,171,194,209,133, 66,161, 80,167,215, 87, 21, 64,185,108, 86,229, 96, 11,208,117,251,161,125,219,199, 30, 57,
+118,116, 73,151,158, 67, 92, 68,181,107,163,158, 59,131,237,179, 90, 78,187, 16, 93,112,107,208,151, 87, 54, 36,101,235, 98, 80,
+195,124, 24,149, 74, 21, 15,160, 68,165, 82, 13, 38,132,100, 48, 12,227, 83, 82, 82,114,199,100, 50,221,171,177, 33, 96, 49,170,
+125,251, 54,191, 51, 12,195, 35,102,118,217, 13, 62,119,183, 46, 39, 46, 19,175, 56, 45, 73, 80, 61,123,124,254,237,234,150, 13,
+253, 26,181, 44,159,235,176,105, 93, 59, 76,154,185,188,101,221,250,254, 45,255,154,255,176,218, 52, 1, 98,210,148,124,120,104,
+235,178, 43,209,127, 94,250,218,213,171,110,221,220,204,164,184,140,199,119, 22, 90,116,138, 67,175,122,156, 83, 30,199,174,220,
+242,211,204, 25, 57, 89,201, 91, 52, 5, 9,247, 1, 64, 83,144,112, 63, 46, 10,223, 20,230,102,206, 40,202, 79,250,233,101,247,
+133, 90,173,206,222,181,107,151, 99,199,142, 29, 57, 30, 30, 30, 40, 40, 40,192,165, 75,151, 88,150,101,179,106,172, 85,156,124,
+ 73, 93,204, 56,255,246,203,186,101, 2,169, 93, 63,179,217,236, 77, 8,192,227,241,114, 12, 26,197, 25, 37, 71,250, 37, 74, 82,
+117, 85,223, 51, 88, 6, 0,167,124,238, 66,150,101,153,101,107,182,167,242, 69,118, 21, 22, 67, 52,233,148, 18,150,101,173,158,
+235, 80,150, 30,213,240,117, 93,223, 12, 33, 11,154,183,106,247,181,201,100,212,149, 93, 31, 58, 0, 58, 66, 80,196,225, 48,151,
+185,172,233,172,226, 21, 30,166, 24, 6,246,132,225,193, 78,204, 3, 3, 6, 42,121, 49,169, 73, 78, 86,133,134, 56, 63, 62, 86,
+147,223,181,206,105,195,190,176,139,231, 78, 53,148,119, 13, 0, 0, 32, 0, 73, 68, 65, 84,189,107,177, 88,234,149,197, 12, 82,
+244, 90,245,126, 85,142,211,111, 64,164, 25,255,126, 78,150,155, 45,230, 13,127,145, 85,221, 40,127, 39,205,128,250,226,193,181,
+107,121,132,165,164,230,223, 74,202,208,252,134,103,167,213,121,149,245,228,122,120,120,124,195, 48,204,251, 54, 54, 54,182, 6,
+131, 65, 77, 8,217,145,151,151,183, 16, 47, 76,254, 27,194, 23,187,107,195,108, 68,146,185, 70,157,250, 15, 77,126,252,168,234,
+182, 93,226,214,168,183, 72, 42,157,169,211,170,119,104,242,226,183,191,230,253,233, 32, 20, 10, 67,108,109,109,249,133,133,133,
+ 55, 1,200,255, 78,199,189,121,243,230,190, 28, 14,167, 30,203,178, 30, 0, 28, 80, 58, 42,164,144,199,227,101,149, 69,180, 72,
+ 77, 53, 59,125,176,223,181,231, 91, 77, 63, 15,191,242,104, 85, 89,183,226, 19,106, 13, 95, 33,122,191, 95,247, 47,126, 59,116,
+180,162, 81,135,255,184,115,254,255, 79,179, 43,207,214,171,112, 44,199,198, 97, 81,207, 0,157,166, 48, 59,107,202,213,123, 5,
+ 55, 1, 40, 95,101, 61, 5, 2,193,104,163,209, 40, 22, 8, 4, 90,163,209,184,235,239,178,237, 98,247,128,113, 28, 16,171,103,
+166, 96,193, 68, 62, 55,104,229,223,114, 46,113,131,130,130, 58, 11, 4, 2, 95,139,197, 34, 49, 24, 12, 26,173, 86,155,146,154,
+154,250, 7, 42,159,248,252,141,174,167,212,221,127,165, 64, 32,252, 20, 0,140, 70,253,106,117,126,194,231, 85,253, 99, 21,159,
+255, 71, 31, 35,215,122,173, 18,120, 92,190, 27,202, 10,115,179,102,115, 65, 94,242,109,255,255,225,122, 82, 94,242,224, 82, 77,
+170, 73, 53,169,230,243,112,232,254,164,154,255, 75, 77,145, 87, 99, 31,145, 87, 99,171,139, 46, 87,242,121,186, 63, 41,229, 76,
+172,224, 5,192,138,130,165, 20, 10,133,242, 6, 96,233, 46,160,252, 47,209,229,196,101,188,201,207, 83,254,115, 84,154, 19,205,
+ 84,225, 74,107, 18, 18,124, 25,103,123,158,106, 82, 77,170, 73, 53,169, 38,213,164,154,255, 57,205,234,180,255,137, 93,146, 19,
+159, 91, 62, 9,224,255, 37,225,159,134, 85,169, 38,213,164,154, 84,147,106, 82, 77,170,249, 95,227,137,241,226,208,125, 65,161,
+ 80, 40, 20, 10,133,242,102,160, 57, 90, 20, 10,133, 66,161, 80, 40,175, 70, 69, 93,135,212,104, 81, 40, 20, 10,133, 66,161,188,
+ 6, 42, 77,134,167, 93,135, 20, 10,133, 66,161, 80, 40,175, 70,121, 68,203, 11,207,149,119,160, 70,139, 66,161, 80, 40, 20, 10,
+229,245,144,131,138,162, 91, 39, 78,156, 32, 21,253, 78,161, 80, 40, 20, 10,133,242,255,193, 63,220,139, 60, 29,201,154, 88,182,
+ 12,224,169,136, 22, 53, 88, 20, 10,133, 66,161, 80,254, 46,102,235, 31, 70,121, 36,171,252,149,243,130,209, 26, 48, 96, 0, 67,
+205, 22,133, 66,161, 80, 40,148,255, 21,255, 70, 47,194,121,126, 3,233, 97,166, 80, 40, 20, 10,133,242,191, 52, 91,255,166,237,
+161,229, 29, 40, 20, 10,133, 66,161, 80, 94, 13, 47, 0,253,159, 90,254,127,155,130,135, 66,161, 80, 40, 20, 10,229,223,206,196,
+202,150,105, 68,139, 66,161, 80, 40, 20, 10,229,245,155, 45, 10,133, 66,161, 80, 40, 20,202, 63, 25, 58,179, 57,213,164,154, 84,
+147,106, 82, 77,170, 73, 53,255,237,148,215,209, 2, 42,171,163, 69,161, 80, 40, 20, 10,133, 66,121, 41,250,163,180,126,214,196,
+178,159,253,169,209,162, 80, 40, 20, 10,133, 66,121,189,188, 48,253, 14, 53, 90, 20, 10,133, 66,161, 80, 40,175,215, 96,109,162,
+ 70,139, 66,161, 80, 40, 20, 10,229, 13, 67,141, 22,133, 66,161, 80, 40, 20,202, 27,130, 65,229, 35, 7,206,215, 64,231,101, 70,
+ 31,156,167,154, 84,147,106, 82, 77,170, 73, 53,169,230,127, 78,179, 58,237,243,248,231, 81, 94, 25,254, 36,254, 74,132,223,244,
+255,241,197,116,232, 43,213,164,154, 84,147,106, 82, 77,170, 73, 53,255,237, 76,124,238,231, 19,104,215, 33,133, 66,161, 80, 40,
+ 20,202,235, 53, 91,116, 10, 30, 10,133, 66,161, 80, 40,148,215, 68,165,221,132, 52,162, 69,161, 80, 40, 20, 10,133,242,106, 84,
+ 58,169, 52, 53, 90, 20, 10,133, 66,161, 80, 40,111,198,112, 81,163, 69,161, 80, 40, 20, 10,133,242, 26, 77,214,196, 10,255,122,
+226,196, 9, 66,247, 17,133, 66,161, 80, 40,148,255, 21,255, 90, 47, 82,190, 97,212,108, 81, 40, 20, 10,133, 66,161, 94,164,198,
+120,225,175,209,134, 19,203,150, 1,208, 81,135, 20, 10,133, 66,161, 80, 40,175, 74,127, 60, 59,242,112, 98,249, 50, 53, 90, 20,
+ 10,133, 66,161, 80, 40,175,206,196, 42,255, 74,187, 13, 41, 20, 10,133, 66,161,252, 47,249, 55,122, 17,134, 30, 86, 10,133, 66,
+161, 80, 40,148, 87,162,162,104,214, 38,186, 91, 40, 20, 10,133, 66,161, 80,222,172,225,162, 80, 40, 20, 10,133, 66,161,188, 9,
+147,245,166, 11,150,210,153,205,169, 38,213,164,154, 84,147,106, 82, 77,170,249, 95, 49, 89, 79,151,120, 0, 64, 71, 29, 82, 40,
+ 20, 10,133, 66,161,188, 42,116, 82,105, 10,133, 66,161, 80, 40,148, 55, 4,157, 84,154, 66,161, 80, 40, 20, 10,229,255,217,112,
+ 81,163, 69,161, 80, 40, 20, 10,133,242, 26, 77,214, 51,102,139,230,104, 81, 40, 20, 10,133, 66,161,188, 26,149,230,104, 49,168,
+124,228,192,249, 26,124,193,203,140, 62, 56, 79, 53,169, 38,213,164,154, 84,147,106, 82,205,255,156,102,117,218,231,241,207,103,
+ 34,254,159, 10,150,210,161,175, 84,147,106, 82, 77,170, 73, 53,169, 38,213,252,175, 65,203, 59, 80, 40, 20, 10,133, 66,161,188,
+110, 99,245, 60,212,104, 81, 40, 20, 10,133, 66,161,188, 26,180,142, 22,133, 66,161, 80, 40, 20,202, 27,194, 11,165, 81,173,242,
+159, 33,212,104, 81, 40, 20, 10,133, 66,161,188, 30,250,163, 52,170, 85,254,147, 26, 45, 10,133, 66,161, 80, 40,148,215, 72,133,
+117,180, 24, 0, 56,113,226, 4, 41, 91,238, 54, 96,192,128,203,116, 95, 81, 40, 20, 10,133, 66,249,255,228,223,234, 69,158, 68,
+180, 6, 12, 24,192, 0,136,160,135,154, 66,161, 80, 40, 20,202,255,130,127,163, 23,225, 60,231, 36,187,209,195, 76,161, 80, 40,
+ 20, 10,229,127,193,191,209,139,240,158,115,145, 20, 10,133, 66,161, 80, 40,255, 19,254,193, 94,196, 11,165,137,240, 39,203,126,
+ 2,101, 37, 31,104, 29, 45, 10,133, 66,161, 80, 40,148, 87,163,124,180,225, 11, 83,239,208, 40, 22,133, 66,161, 80, 40, 20,202,
+171, 81, 81,101,248, 77,116,183, 80, 40, 20, 10,133, 66,161,188, 65,104, 68,139, 66,161, 80, 40, 20, 10,229,213,121, 58,170,245,
+255, 22,205,162, 51,155, 83, 77,170, 73, 53,169, 38,213,164,154, 84,243,191,100,178,158, 89,166,149,225, 41, 20, 10,133, 66,161,
+ 80,222, 16,116,212, 33,133, 66,161, 80, 40, 20,202,171, 81, 62,226,240,233,101,106,180, 40, 20, 10,133, 66,161, 80, 94,163,217,
+122, 1,218,117, 72,161, 80, 40, 20, 10,133,242,106, 76,172,236, 15,212,104, 81, 40, 20, 10,133, 66,161,188, 33,195,197,160,242,
+145, 3,231,107, 32,252, 50,163, 15,206, 83, 77,170, 73, 53,169, 38,213,164,154, 84,243, 63,167, 89,157,246,121,252,243,248,159,
+ 21, 44,165, 67, 95,169, 38,213,164,154, 84,147,106, 82, 77,170,249,159,133,118, 29, 82, 40, 20, 10,133, 66,161,252, 13,140,150,
+ 27,143,199,251, 90, 44, 22,111, 16,139,197,191,240,120,188,159, 0, 56,213,244, 11,165, 82,233, 52, 79, 79,207,135,158,158,158,
+153,190,190,190,167,236,236, 36,159, 53, 16,162, 11, 0,254,107,218,158, 0, 0,159,137,197,226, 56,145, 72,148, 10, 96, 39,128,
+207, 0,184,190,138,240, 66,111, 12,187,255,233,224, 35, 11,189, 49,236,185, 63,245,247,240,240,184, 10,160,247,235, 58, 40, 35,
+ 36,232, 53, 92,138,244,225, 82,164,143,144,188,252, 83,131,157,157,221,251, 94, 94, 94, 55, 92, 92, 92,178,188,188,188,174,139,
+ 68,162,225, 53,148,112,247,240,240,248,209,199,199, 39,222,219,219,123, 21, 74,103, 39,255,219,210, 89,136,206,237,132, 40,104,
+111, 3,101, 71, 27,108,104,111,131,183,222, 2, 36, 47, 41,215, 9,192, 1,123,123,251, 59, 60, 30,239, 4,128,161,101,231,215,
+ 80, 30,143,119,194,222,222,254, 14,128, 3,101,159,123,153,243,244, 71, 0, 89, 0,190, 47, 91,254,196,199,199, 71, 25, 28, 28,
+156, 26, 28, 28,252,171,159,159,223, 24,107,197, 36, 18,201, 91, 62, 62, 62, 7,125,125,125, 83,219,183,111, 95, 92,171, 86,173,
+ 71,181,107,215,222, 46, 20, 10,187,209, 38,142, 66,161, 80,254,254, 12, 4,176, 4,192,218,152,152,152, 40, 66, 72, 20, 33, 36,
+ 42, 38, 38, 38, 10,192, 6, 0, 75, 81,121, 8,241,153,247, 93, 92, 92, 22, 44, 90,180, 72,151,147,147, 67, 10, 10, 10, 72,124,
+124, 60, 89, 57,119, 38,219,199,153, 71, 26,184, 57,105,188,188,188, 18,235,212,174,189,167,169, 45,103, 38,128,134,214,104, 62,
+133,147, 88, 44,190, 57,119,238, 92,213,213,171, 87, 85, 6,131, 65,197,178,172, 42, 59, 59, 91,117,254,252,121, 85,199,142, 29,
+ 85, 0, 62, 7,192,173,129,230, 19,190,243,198,101,178,245, 27,242,157, 55, 46, 63,253,126, 96, 96,224, 3,150,101,201,176, 97,
+195,244, 0,106,213, 68,243,121,106, 1,162,166,246,112, 28,110,139, 60,243,246,133,132,172,159, 65,134, 75,145,254, 50,154,238,
+238,238, 71,167, 77,155,166,200,202,202, 34,122,189,158,164,167,167,147, 73,147, 38,201,221,221,221,119, 89,185,237, 46, 65, 65,
+ 65,121, 55,110,220, 96,101, 50, 25,137,136,136, 96,155, 53,107,150,103,165,217,234,245,220,186,108,242,246,246, 62, 85,147,151,
+187,187,251,150,154, 30,163,182, 66,164, 27,163, 46, 17,114, 59,156, 28, 27,214,158,172,108, 85,155, 12,117,182,145,117,178,193,
+ 39, 93, 43, 46,101, 82,153,230,187, 93,187,118, 85,223,187,119,207, 82, 84, 84, 68, 30, 60,120,192, 78,152, 48, 65, 7, 32,118,
+194,132, 9,186, 7, 15, 30,176, 69, 69, 69,228,222,189,123,150,174, 93,187,170, 1,140,175,193,122,114, 0,108,155, 63,127, 62,
+ 33,132,144, 69,139, 22,145,224,224, 96,210,163, 71, 15,162, 82,169, 8, 33, 36,149, 16,242,171,217,108, 30,107,141,166,131,131,
+195,251,211,166, 77, 83,105, 52, 26, 82, 14,203,178, 68, 38,147,145,181,107,215,170, 61, 61, 61, 79, 85,242,144, 65,187, 60,168,
+ 38,213,164,154,127, 55,205,127, 50, 94, 40,205,211, 42,127, 89, 29,152, 24, 57,115,230,204,114, 83,117,186, 83,167, 78,183,198,
+142, 29, 27, 53,118,236,216,168, 78,157, 58, 69, 0, 56, 27, 25, 25, 25,245,213, 87, 95, 69, 1, 24, 89,205,129,112,234,208,161,
+131, 44, 55, 55,151,248,251,251,147,186,117,235,146,220,220, 92, 66, 8, 33,183,223,109, 73, 46, 52, 6,201,184,114,154,132, 31,
+ 62, 64, 38,120,241, 72,103, 47, 7,147,151,167,103,145,171,171,235, 98, 60, 59, 39, 99, 69, 7,247,157,198,141, 27, 43, 99, 99,
+ 99, 85, 9, 9, 9,170, 5, 11, 22,168,122,244,232,161, 10, 10, 10, 82, 13, 29, 58, 84,181,102,205, 26,149,209,104, 84,109,217,
+178, 69,101,111,111, 31, 91,129,217,122,105,163,197,227,241, 86,199,196,196,144,196,196, 68, 82, 22,165,168, 76,211,193,209,209,
+177,175,147,147,211,231,142,142,142,125, 1, 56, 0,128, 63, 96,219,220, 1,190,159, 52,111, 16,120, 98,100,175,134,107,123,181,
+110, 57,220,142, 35, 51,173,155, 65,200, 48,223,151, 50, 90, 14, 14, 14,239,127,246,217,103, 74,189, 94, 79, 52, 26, 13, 81,169,
+ 84, 68,163,209, 16,165, 82, 73, 70,142, 28,169, 16,137, 68,239, 84,167,233,234,234,186,240,202,149, 43,230,220,220, 92,114,229,
+202, 21,114,234,212, 41,178,126,253,122,214,221,221,125, 69, 77, 47, 64, 79, 79,207,115,225,225,225, 81,209,209,209, 81, 55,111,
+222,140, 50,153, 76, 81, 70,163, 49,202,104, 52, 70,157, 56,113, 34,234,208,161, 67, 81,123,247,238,141, 50, 24, 12, 81, 6,131,
+ 33, 74,175,215, 71,213,175, 95,255, 76, 77,143, 81, 27, 33, 50, 12, 87,143, 17,178,226, 99, 34,255, 97, 10,145, 77,239, 71,242,
+ 39,117, 33, 27, 90,215, 38, 93,196, 56,142, 23,231,246,172, 80,147,207,231, 95, 78, 77, 77,101,103,207,158,109,104,210,164,137,
+252,195, 15, 63,212,233,245,122, 66, 8, 33,122,189,158,124,248,225,135,186, 38, 77,154,200,103,207,158,109, 72, 73, 73, 97,121,
+ 60,222,249, 26,172,231,210,114,147,117,249,242,101,242, 52, 42,149,138,244,232,209, 35, 53, 56, 56,248,215,122,245,234,141,170,
+ 78,211,214,214,118,240,172, 89,179, 84,164, 2, 76, 38, 19, 81, 42,149, 36, 37, 37,133,173, 91,183,110, 54, 0, 23,218,152, 83,
+ 77,170, 73, 53,169,209,122, 99, 76,172,102,185,226,157,248,213, 87, 95, 69, 17, 66,162,230,204,153, 19, 85, 22,217, 18, 0,176,
+ 45,123,241, 0,140,152, 53,107, 86, 20, 33, 36,106,230,204,153,229,159,169,236, 64, 12,220,191,127,191,113,213,170, 85,196,195,
+195,131,120,122,122,146,213,171, 87, 19,150,101, 73,238,137, 93,228, 66, 99,144,184,175,195, 8, 33,132,196, 47,158, 74, 46, 52,
+ 6, 73,218,248, 29, 25, 61,122,180, 70, 34,145,140,172,226,224, 58,183,108,217, 82,169,213,106, 85,219,183,111, 87, 73, 36,146,
+219, 0,154,160,180, 43,146, 41, 91,215, 49, 77,154, 52, 81,220,191,127, 95,181,123,247,110, 21,128, 5, 86,158, 48, 13, 1,116,
+151, 74,165, 67,103,213,226, 39,144,173,223,144, 89, 30,184, 7,160, 25, 0,183,178,207,120,207,156, 57,147, 16, 66,136,143,143,
+207,149, 74, 52, 29,130,130,130,102, 38, 36, 36,204, 51,153, 76,243,162,163,163,231, 53,106,212,104,246,160,250, 94,237,143,140,
+124, 43, 68,254,221,148, 16,178,124,122,208, 79,111,183,233,181, 39,180,219,200, 15,234,185, 94,253,208, 93,164,121,207,129,171,
+124,174,235,208,170, 19,187, 86,173, 90, 55,211,211,211,159,152, 43,165, 82, 73,178,178,178, 72,114,114, 50,185,122,245, 42,241,
+242,242,186, 80,157,166,167,167,231,131,244,244,116,178,113,229, 74, 50,172, 89, 32,233,226,104, 71,186, 58,217,145, 86,182, 34,
+117, 99,160, 85, 77,141,214,157, 59,119,162, 0, 68, 1,136, 42, 42, 42,138, 42, 42, 42,138, 42, 41, 41,121,242, 30,128, 40,185,
+ 92, 30, 37,151,203,163, 12, 6, 67, 84,131, 6, 13,106,108,180, 58,138,208,177,173, 8,197,237,133,208, 14,172,229,154, 61,165,
+190,171,229,207,145,237, 73,201,199, 61,200,170,144, 90,164,147, 13, 62,177, 82,115,160,141,141, 77, 4,128, 25,101,166, 60,172,
+111,223,190, 26, 66, 8,233,219,183,175, 6, 64, 88,217,251,159,149,153,172,190, 86,174, 39,199,207,207, 79, 93, 30,201, 2,240,
+135,159,159,159, 58, 56, 56,152, 4, 7, 7, 19, 31, 31, 31,101,153,182, 85, 13, 90,195,134, 13,227,181, 90,237, 19, 3, 40,147,
+201, 72,118,118, 54, 73, 74, 74, 34,177,177,177,228,246,237,219, 36, 53, 53,149,236,219,183,207,226,232,232,120,146, 54,230, 84,
+147,106, 82, 77,106,180,222,168,209,122,254,245, 44, 39, 78,156, 32,207,189,245, 67,100,100,100,212,172, 89,179,162,170,113,102,
+ 19,231,204,153, 83, 30,245, 90, 82,197,205,127, 75,124,124, 60, 9, 11, 11, 35, 1, 1, 1, 36, 32, 32,128,140, 29, 59,150,200,
+229,114,162,122,124,159, 92,104, 12,114,251,189, 86,132, 16, 66,148,113,209,228, 66, 99,144,168,209, 29,200,221,187,119, 73,237,
+218,181,195,171,248,254,227,215,175, 95, 47,216,181,107, 87, 46, 74,243,177,248, 0,218, 1, 88, 45, 22,139,183,161,180,187,176,
+ 46, 0, 39,127,127,255, 98,141, 70,163, 26, 54,108,152, 10,128,111, 21,154, 93, 3, 2, 2, 18,183,108,217, 66,242,243,243, 73,
+113,113, 49, 89,214,177, 17, 33, 91,191, 33,139, 90,213,101, 55,110,220,168,159, 49, 99,134,218,217,217,249, 4, 0,239, 97,195,
+134,153, 9, 33,164, 75,151, 46,121, 21,137, 57, 58, 58,246, 77, 72, 72,152,167,211,233,230,201,100,178,121,197,197,197,243,142,
+ 29, 57, 50,175, 79,179, 70, 97,242,239,166,132, 28, 25,249, 86,200,219,181,156,134,174,232,221,122,114,214,236,241,195,230,116,
+104, 18,167, 91,250,233,165,119,235,123,252,248, 50, 71,219,205,205, 45, 71,175,215, 19, 0, 47,188, 18, 19, 19,137,139,139, 75,
+122,117, 26,206,206,206,115, 62, 27, 17,106,121,167,110, 45,146,184,106, 46, 49,157,219, 77, 76,167,182,147,199, 63, 76, 39,131,
+ 60, 93, 21,237, 4,156, 89,214,174,143,167,167,231,185,155, 55,111, 62, 99,180, 74, 74, 74, 42, 52, 90, 10,133, 34,202, 96, 48,
+ 68,249,249,249,157,121,213,179,190,157, 13, 26,116, 21,115,111, 71,135,117, 38, 5, 83,122,144,190, 14,252,212, 87,144, 27, 1,
+ 32, 2,192,232, 26,254, 31, 7,192,210,114, 67,245,195, 15, 63, 16, 66, 8,241,243,243, 83,227,213, 6,163, 56, 4, 6, 6, 38,
+143, 31, 63,222,220,184,113,227,252,142, 29, 59,202,110,221,186, 69, 46, 95,190, 76, 78,157, 58, 69, 14, 28, 56, 64,238,223,191,
+ 79,178,178,178, 72,124,124, 60,233,223,191,191, 12, 64, 87,218, 22, 82, 40,148,191, 51, 21,120,145,127, 60,156,242, 13, 27, 48,
+ 96, 0,243,212, 6, 58, 0, 16,181,106,213,170, 96,233,210,165,203, 81, 90, 11,130, 9,226,226,221, 30, 98,222,221, 30, 98,222,
+221, 32, 46,222, 45,139, 24,109, 90,188,120,241,194,224,224,224, 28, 0, 98, 0,158, 21,125, 17, 33,164,179,139,139, 11,210,211,
+211,225,224,224, 0, 7, 7, 7,164,167,167,131, 16, 2, 51, 1, 76, 4,208, 27,141,208,106,181,208,177, 4, 90, 22, 80,168, 84,
+240,244,244,132,209,104,108, 80,201,250, 55,127,239,189,247, 26, 4, 5, 5, 21,124,245,213, 87,217, 40,205,149,217, 54,110,220,
+184,115,127,252,241, 71,144, 74,165, 42,142,141,141,213, 53,107,214,172, 47, 0,207,132,132,132,247,215,174, 93,139,176,176, 48,
+ 84,113,211,105,214,191,127,255, 83,247,239,223,111, 48,122,244,104, 68, 68, 68, 96,217,178,101, 40, 44, 44, 36, 0,160,215,235,
+137,197, 98, 49,118,232,208,193,184,106,213,170, 54, 93,186,116,185, 89,191,126,125, 46, 0, 36, 39, 39, 63,174, 72,144, 97,152,
+ 70,117,234,212,129, 94,175, 71, 65, 65, 1,238,223,191, 15, 59, 7, 7,196,100, 23,122,116, 91,177,177,232,235, 35,231,248, 35,
+218, 4, 57,127,254, 86, 71,253,247,225, 17,254, 77,188, 61, 60, 12, 70,147,103,124, 78, 94,246,203, 28, 84,129, 64,144, 94, 88,
+ 88, 8,131,193, 0,173, 86, 11,133, 66,129,162,162, 34, 20, 22, 22, 34, 59, 59, 27, 2,129, 32,177, 58, 13,251,226,226, 43,201,
+215, 47, 51,251,126,254, 1, 13,204,197,224, 29, 92, 13,222,209, 13,104,104, 40,192, 47,115, 39,217, 25, 92,220,230,219,219,217,
+149, 56, 58, 58,110, 2,224, 87,157, 94, 72, 72, 8,138,138,138, 80, 84, 84, 4, 23, 23, 23, 56, 57, 57,193,201,201, 9, 50,153,
+ 12,114,185, 28, 10,133, 2,254,254,254,104,222,188, 57,118,236,216,241, 90, 78,238, 63, 13, 72, 50,195, 50,229,220,163,108, 8,
+164, 82,212,119,178,173,211,218, 22,206, 85,252, 75, 15, 62,159,191,223,217,217, 57, 28,192,199, 0,164, 0, 62,118,118,118, 14,
+231,243,249, 67, 0, 44, 2,176,171,134,171,241,253,252,249,243,103, 38, 36, 36, 72,238,222,189,139,175,190,250, 10, 11, 22, 44,
+192,227,199,143,215, 1, 96,203, 62,243,145,139,139,203, 9, 14,135,179, 25, 64, 63, 0,125,189,188,188,122, 86,163, 59,100,198,
+140, 25,186,150, 45, 91,198,199,197,197, 13,185,126,253,122,171,233,211,167,203,211,210,210, 16, 31, 31, 15, 47, 47, 47,248,248,
+248, 64,165, 82,161,164,164, 4, 67,134, 12,113,176,183,183, 31, 73,155,113, 10,133,242,119, 54, 89,207,121,145,127, 90, 68,171,
+194,229, 10,159,168, 37, 18,201,252,168,168,168,246,193,193,193, 60, 0,251, 0, 32,136,139,225, 67, 58,180,216,118,100,211, 15,
+193,135, 86,205, 13,238, 19,236,191, 45,136,139,242, 81,108, 39, 90,181,106,229, 20, 21, 21,213, 65, 40, 20,126, 82,201, 74, 16,
+ 0,112,114,114,130,131,131, 3, 28, 29, 29,225,228,228, 4,150,101,161,210,232,160,182, 0, 74,157, 1,114,185, 28,202,178,101,
+149,222, 8,181, 90,253,228,127, 43,160,219,248,241,227, 11,214,174, 93,155,159,147,147,243, 3,128,102, 97, 97, 97,131,215,172,
+ 89,131,139, 23, 47,234,250, 5, 52,116, 89,220,185,197,194, 38, 57,143,231, 5,240, 49, 1,192,149, 43, 87,174,160, 67,135, 14,
+ 96, 24, 38,180, 34, 65,177, 88,188, 97,207,158, 61,226,216,216, 88, 52,108,216, 48, 54, 52, 52,244,221, 31,126,248,161,129, 84,
+ 85,124, 13, 0,204, 69,185,177, 83,167, 78,253,102,241,226,197, 5, 5, 5, 5, 70,141, 70,227, 62,104,208, 32,164,167,167, 35,
+ 43, 43,235,143, 74, 76,102,124,116,116, 52,145,203,229, 72, 74, 74, 66,116,116,180,248,155,111,190,105, 99,225,112, 6,103,194,
+238,131,176,142,173,218,140,110,215, 2,187,110,220, 21, 92,125,148,236,216,170,110, 45,167, 59, 25, 57,245, 76, 12, 18, 95,230,
+104, 43,149,202,213, 11, 23, 46, 84,169, 84, 42,100,102,102,226,222,189,123,136,139,139, 67,106,106, 42,150, 45, 91,166, 42, 46,
+ 46, 94, 83,157,134,183,136,247,197,143,211,199, 49,188, 7,127, 0,119, 47, 3, 26, 37,160, 85, 65,255, 48, 10,191, 62,204,197,
+250,131,135,109,210,210,211, 29,247,238,221, 59,222,215,215, 55, 10,128,127, 85,122,132,148, 30, 66, 14,135,243,188, 9, 5,135,
+195, 81, 2,200,149, 74,165, 25,118,118,118, 25, 28, 14, 39,151, 16,162,126, 45, 79, 18,102, 24,193,229, 2, 54, 98,112,248, 85,
+ 78,237,249,110,104,104,232,158,140,140,140, 62, 73, 73, 73,237,215,172, 89,179, 80, 36, 18,197,172, 89,179,102, 97, 82, 82, 82,
+251,140,140,140, 62,161,161,161,123, 0,140,169,201,247,251,249,249, 77,157, 55,111, 30,150, 45, 91,134,230,205,155,195,223,223,
+ 95, 51,127,254,252,213, 0,230, 2,248,196,207,207,239,218,212,169, 83, 63,204,207,207,247,204,204,204,108,190,110,221,186, 73,
+171, 87,175,110,157,157,157, 45,170, 70,186, 83,239,222,189,113,250,244,105, 0,200, 1,144, 84, 84, 84,100,206,206,206, 70, 96,
+ 96, 32,218,180,105, 3,149, 74, 5,149, 74, 5,153, 76,134, 58,117,234,128,101,217,246,180, 41,167, 80, 40,148,255, 87,195, 85,
+177,209, 18,137, 68, 78, 33, 33, 33,168, 95,191,190, 19,202, 70,107,185,216,240,102,127, 62,126,132,196, 54,234, 12,152,232, 11,
+ 8,237,220, 84,226, 98,195,155, 93,246, 47,188, 58,117,234, 8, 67, 66, 66, 32,149, 74,107, 85,242,229, 17,185,185,185, 8, 9,
+ 9,129,163,163, 35, 28, 28, 28, 16, 18, 18, 2,163,209, 8,185, 82, 9,181, 5,208,152, 88,200,229,114, 20, 23,228, 65, 99, 1,
+204,118, 46, 72, 77, 77, 5,151,203, 77,174, 68,211,171, 97,195,134, 5, 49, 49, 49, 5, 0,174, 0,152,188, 96,193, 2,204,154,
+ 53, 11,223,126,251,237, 30, 73, 78, 74,239, 61,167,143,186,252, 62,255, 35, 55,127, 27,102, 4, 0, 99, 70, 70, 6, 28, 29, 29,
+ 33,149, 74, 43, 52, 6, 93,186,116,105, 41,149, 74,177,125,251,118,146,153,153,217, 17,165, 67,248,147, 25,166,212,236,137, 57,
+144, 3, 88, 29, 21, 21,213,246,155,111,190,121,212,171, 87, 47,126,187,118,237,176,104,209, 34, 0, 56, 81,145,166, 76, 38,251,
+115,204,152, 49,134, 75,151, 46,225,225,195,135,210, 35, 71,142, 12, 95,180,104, 81,211,180,180, 52,225,241, 83,103,222,222,153,
+161, 24,254, 67,248, 85,209,226,179, 17,127,186,218, 75,155,212,115,117, 70,116, 90,150,192,194,197,173,234,142,104, 91, 62,119,
+124, 55, 17, 47,186,179,144,147,211, 77,196,139,106,205,231,142, 83, 42,149,123,143, 29, 59,118,118,250,244,233,170,252,252,124,
+216,217,217,161,168,168, 8,223,127,255,189, 42, 58, 58,250,160,193, 96, 56, 94,157,174,133, 37, 45,125,234,250, 2,137, 49, 79,
+222, 51,178, 4,183, 12, 2, 12,152,252, 41, 2, 2, 3, 97, 48, 24,208,172, 89, 51,102,193,130, 5, 82, 7, 7,135, 47,171, 53,
+ 61,156, 23, 78, 55, 51,195, 48,185,132,144, 44,149, 74,149, 41, 22,139,211, 4, 2, 65, 90,113,113,113, 38, 33, 36,239,117,248,
+ 44,194,193, 23, 29,154,249, 1, 66, 49,210,138, 84,217,183, 85, 40,174,232,131,118,118,118,227,214,175, 95, 47,218,186,117,171,
+105,234,212,169,250, 73,147, 38,241,181, 90,173,251,164, 73,147,248, 83,167, 78,213,111,221,186,213,180,126,253,122,145,173,173,
+237,208,151, 89, 17,147,201,132,152,152,152, 31, 30, 63,126, 44, 69,105,185,145, 79,231,207,159, 31,150,144,144, 32, 90,187,118,
+ 45, 14, 28, 56,128, 3, 7, 14, 96,240,224,193,152, 54,109, 26,230,205,155, 87,149,156, 36, 56, 56, 56,196,197,197, 5,151, 47,
+ 95,206, 6,144, 6,160,165,173,173,173,221,224,193,131,209,167, 79, 31,232,116, 58, 24,141,198, 39, 70,139,203,229,194,209,209,
+209,133,182,129, 20, 10,133,242,198, 77,214, 51,102,139, 7, 0,229,161,186, 1, 3, 6, 48, 85,221, 24, 45, 37,249,144,169, 53,
+ 72,149,107,144, 94,194, 62,243, 55,150,101,171,252,246,236,236,236,227, 55,110,220, 24, 23, 18, 18,194,203,206, 46,237, 17, 11,
+ 9, 9,129, 70,163, 65,246,221,155, 80,179,128,180, 97, 16,212,106, 53, 74,226,238,192, 54,184, 61, 92,250,143,198,138,181,107,
+245, 69, 69, 69, 63, 87,164,105, 99, 99,195,175, 93,187,118, 65,114,114,178, 25, 64,177,131,131, 67,111, 95, 95, 95, 68, 68, 68,
+ 0,192, 46, 2,252,136,232, 75,192,229, 67, 32,165, 33, 21,219, 58,117,234, 32, 63, 63, 31, 42,149, 42,162, 34,205, 27, 55,110,
+ 36,152, 76,166,102,131, 6, 13, 98,126,251,237,183,125, 10,133,226, 91, 0,247,244, 44,184,119, 51,242,160,182, 64, 4,224, 45,
+ 39, 39,167,207,230,205,155,215,115,234,212,169, 56,118,236, 24,194,195,195,141, 40,205, 5,187, 81,129,172, 60, 41, 41,233,151,
+ 25, 51,102,180,227,112, 56,147,207,157, 59,103,246,247,247, 87, 24,141, 70, 75,163,128, 0,206,183, 11,190, 19,124, 60,121,162,
+ 99,145, 6, 15,250, 52,242,234,192, 48,192,131,172,252,180,199, 42, 20, 85,181, 79,187,216,112, 79, 12,233, 24,220,101, 92,232,
+ 64, 91,105,195, 38, 80,223,191,233,249,203,254, 83, 43,196,209, 9, 3, 46,231,231, 15, 62,118,236,216,240,136,136,136,143, 13,
+ 6, 67,125,161, 80,152, 40,147,201, 86,169, 84,170,106, 77, 22,151,203,237,175,247,170,237, 36, 43, 46,134,168, 44, 18,165, 48,
+177, 40,212,155,241,208,209, 31, 35,107,251, 60,233, 6,205,205,205,133,167,167, 39, 99,177, 88, 6, 86,165, 25, 30, 30,142, 1,
+ 3, 6,148, 27, 79, 48, 12, 3,134, 97, 10, 3, 2, 2,242,132, 66, 97,145, 64, 32, 80,252,248,227,143, 58,157, 78, 7, 30,143,
+ 39,178, 88, 44,220, 87, 57,219,219, 72,224, 46, 36,204,134, 73,131,186,247,106,222, 36,144, 92,185,125,151, 41,209,232,126,173,
+ 34, 10,184,206,207,207,143, 87, 92, 92,124, 28,192, 67,147,201,244,251,190,125,251, 68,239,191,255,190,110,255,254,253,163, 0,
+ 52, 88,190,124,249,112,149, 74, 85,163, 41, 21, 30, 63,126,188,110,241,226,197, 51,231,204,153,131, 29, 59,118, 76,125,252,248,
+241,172,178, 72,215,224,121,243,230,225,199, 31,127,196,142, 29, 59,216,135, 15, 31,158, 98, 89,246,241,244,233,211,131, 61, 60,
+ 60, 10,115,114,114, 30, 87, 33,219,170,111,223,190,250,107,215,174,217, 40,149,202,171, 0, 62,155, 50,101,202,248,182,109,219,
+ 42, 66, 67, 67,109,139,139,139,101, 18,137,196,102,203,150, 45, 78, 60, 30, 15,106,181, 26, 12,195, 64,169, 84, 26,104, 59, 72,
+161, 80,254,174, 84,230, 69,254, 33, 84,122,111,224, 85,180,129, 26,141, 38, 47, 61, 61, 61, 48, 43, 43,203, 12,192, 12, 0, 69,
+ 6,243,146,197, 91, 14,109, 29,218,206, 79,154, 99, 50,225,200,237, 88, 77,145,193, 92,158,252,110,206,202,202, 82,166,165,165,
+217,105,181, 90, 85, 37,223,245,199,134, 13, 27,180,151, 46, 93,178, 75, 74, 74,130,197, 98, 65,203,150, 45, 17, 31, 31,143,146,
+135, 49,144, 6,182,132,180,235, 0,196, 70,221, 70,116,248,121,164,168, 12,230, 71,115, 23,203, 85,106,245, 60,163,209,120,164,
+ 34, 65, 62,159, 95, 12,128, 16, 66, 44, 0,160, 80, 40,238,169, 84,170,206, 30, 30, 30,120,240,224,129, 84,109,193,180,225,179,
+ 87,172, 33,132, 88, 4,165,163,185, 62, 15, 13, 13, 69,100,100, 36, 0, 68, 86,164,169, 80, 40,166, 78,152, 48,225,210,246,237,
+219,121, 73, 73, 73,125,182,110,221,218,231,209,163, 71,132, 41, 78,183, 92,211,240,209, 32,108, 90,235,141,117, 2,194, 7, 12,
+ 24, 0, 47, 47, 47,108,217,178, 5,171, 86,173, 50,125,244,209, 71, 9,171, 86,173,106,157,159,159,255,123, 37,219, 47,151,201,
+100,103, 92, 92, 92, 62,110,218,180,169, 82,173, 86,163,168,168, 8,217,217,217,112,118,113,225,152,193,233,224,230,232,248,251,
+241, 92,165,148,119,230, 79,220,204,204,169, 50,154,213,142,207, 29, 51,180, 75,139, 46,159,204,153,109,139,107, 71,192, 76,152,
+ 7,178,117, 33, 62, 29, 59,220, 78,167,255,189,171,250,110,234,251, 81, 10,197, 78,133, 66,113,160,134, 39, 75,223, 14, 29, 58,
+236, 89,188,120,177,248,235,101,139,177, 60,176, 22,204, 69, 69, 40,208, 91, 80,168, 55, 67, 81,242, 16, 15, 30,196,194,197,197,
+ 21, 41, 41, 41,208,233,116,136,139,139, 35, 92, 46,247,120,117, 17,157,114,158,234, 46,148, 9,133,194, 34, 62,159,159,199,227,
+241,138,147,146,146,212, 58,157, 14, 28, 14, 71,106,177, 88,196, 86,172,107,109, 87, 87,215,233, 40, 45, 38,122, 76, 89, 88,184,
+ 58,132, 15, 71,240,208,173,142,171,203,219,115, 39,189,239,234,235,237, 46, 75, 74, 72, 52,253,124,246,122,161, 78, 95,249, 96,
+ 13, 0, 39,138,139,139,159, 68, 36,247,239,223,255,233,254,253,251,199, 3,216,134,210,121,183,206,203,100,178,141, 47,113,241,
+205, 61,120,240,224,204, 57,115,230, 64, 44, 22, 63, 41,158, 42, 22,139, 69, 0,176,123,247,110, 60,120,240,160, 45,202,242,181,
+ 88,150,221,147,147,147, 83,157,102,131,160,160,160,164, 67,135, 14,217, 0,240,158, 50,101, 74,251, 53,107,214, 96,236,216,177,
+ 5,177,177,177,237, 0, 36, 3,104, 48,121,242,228, 91, 59,118,236,112, 98, 89, 22, 37, 37, 37, 48, 24, 12,201,180, 41,167, 80,
+ 40,212,108,189, 17, 66, 0, 68,163,180,126, 86,127, 0, 39, 81,154,214, 81, 41, 62,101,238,236, 44,128, 65,229,247,199, 74,146,
+225,129,210, 17, 89,103, 0,108, 6,224, 81,153,168,139,139,203,151, 97, 97, 97,166,204,204, 76,146,155,155, 75, 14, 28, 56, 64,
+ 62, 31, 23,102,121,171,161, 55,219,208,219, 67,237,230,230, 22,239,229,234,252,107, 11, 9, 62, 7, 80,219,138, 13, 11,123,244,
+232,209,196,176,176,176,113,101,223, 59,110,207,158, 61,170,115,231,206,169,184, 92,238, 9,148,150,118, 40, 55,148, 99, 6, 14,
+ 28,168,210,235,245,170,128,128,128, 98,148, 38,238, 87,198,240,110,221,186,149,156, 62,125,154, 88, 44,150, 23,106, 20, 21, 20,
+ 20,144,240,240,112,210,177, 99, 71, 25,128,247,123,246,236, 25,113,253,250,245,136, 78,157, 58, 29,172,110,133, 93, 93, 93,103,
+223,189,123, 55, 50, 53, 53, 53,234,228,201,147, 81,191,255,254,123,212,228,201,147,239, 5, 7, 7,107, 19, 18, 18, 88,179,217,
+ 76,238,222,185, 67, 2, 26, 53, 82, 3,168, 83,153, 78, 15, 49,239,150, 98,203, 66,162, 91, 52,150,232,134,248, 16, 0, 68,185,
+226, 75,146, 55,181, 23,137,255,248,109,210, 93,196,189,241, 50,103,138,179,179,243,217,200,200, 72,162, 84, 42,201,253,251,247,
+201,152, 1,125,200,141,241,189,200,153, 62,126,100, 71,215,122,100, 69,239, 96,210,167,107,103,178, 97,195, 6,114,232,208, 33,
+ 50,123,246,108,214,213,213, 85,137, 42,114,180, 60, 61, 61,207,237,219,183, 47, 10, 64, 20,151,203,141, 82, 40, 20, 81, 74,165,
+242,120, 70, 70,198,250,128,128,128,153, 77,155, 54, 29, 21, 24, 24,216,163,123,189, 58, 51,123,218, 9,227,123,217,139, 18, 27,
+217, 74, 86,224,197,186, 87, 79,112, 0,234, 52,108,208, 64,121,249,242,101, 86,175,215,147,171, 87,175,178,141, 27,249,235,150,
+191,215,247, 96,202,150,165, 7,117,167,127, 59,171, 57,186,233,250,254, 15, 6,196,116,147,112,126,107, 47,125, 82,142,227,101,
+ 25, 1,224, 8,254, 26,117, 24, 6,224, 40,170, 30,133,200, 1,176,109,209,162, 69, 79,143, 52, 4, 0, 78,112,112,112, 20, 33,
+ 36, 42, 56, 56, 56,170,166, 43, 34,145, 72,166, 31, 59,118,108,190,175,175,239,178,208,208,208, 45, 50,153,236,228,168, 81,163,
+ 98, 80, 58, 24,132, 65,233,236, 8, 3,107,215,174, 93, 16, 29, 29, 77, 34, 34, 34,200,176, 97,195,148, 2,129, 96, 52,109,198,
+ 41, 20, 10,229,141, 48,177,146,159, 85,178, 56, 38, 38,166,188,134,214,148,170,196,103,205,154, 21, 21, 25, 25, 25,133,210, 42,
+241, 85,194,227,241, 14,127,244,209, 71,196,195,195, 67,229,238,238,126,152,207,229,142,247, 17, 35, 4, 47, 55,212,189,243,206,
+157, 59, 7,175, 91,183,174, 63,128,182, 0,248,181,106,213,202,206,205,205, 85, 93,191,126, 93,213,177, 99, 71,149,171,171,107,
+126, 80, 80,144,106,249,242,229, 42,147,201,164,154, 62,125,186, 10, 47,214,251,170, 8, 17,128,143,109,108,108, 14, 55,110,220,
+ 56,102,238,160, 30,166,101,211,198,147, 48, 63, 55, 21,128,117, 0, 62, 2,224, 8,128, 63,124,248,240, 11,113,113,113,103,131,
+130,130,126,177, 66,215,187,105,211,166, 23,247,236,217, 19,121,232,208,161,168, 47,191,252, 50,210,197,197, 37, 51, 33, 33,129,
+213,233,116,164,164,164,132,200,100, 50,114,242,228, 73,139,179,179,243,218, 74, 55, 92,200,205, 33,225,187, 42, 44,225,144, 49,
+103, 52,233,104,195,201,122,153, 51, 69, 42,149, 22, 23, 21, 21,145,220,220, 92,146,148,148, 68, 14, 30, 60, 72,250,118,104, 67,
+246, 78, 30, 74,118,141, 27, 76,126,236,219,134,180,181, 19,169, 61,237,108, 35,237,236,236,242,173, 25,117,232,233,233,121, 78,
+175,215, 63, 41,223, 80,187,118,237,168,128,128,128, 67, 65, 65, 65, 43,142, 29, 59,246,233,202,149, 43, 7,119,175, 87,103,230,
+247,125, 58,104, 53,231,247, 19,229,190,117,100, 86, 75,127, 93,153,153,175,144, 90, 46,206, 59, 47, 71, 68,176,229,230,215,108,
+ 54,147, 35,135, 15,147,247,222,126, 43, 70,126,102,247,230,171,243,166,238,153,222,210,255, 72, 71, 17, 70, 84,101,216,158, 60,
+138,216,194,165,139, 61,103,125, 63, 95,231,156,206, 14,156,117,237,236,158,153, 94,234, 61,127,127,255, 36, 66, 72, 78, 96, 96,
+ 96, 18,128, 93,129,129,129, 79, 47,127, 80,137,236,147,226,164,243,231,207, 39,101,215, 7, 7,192,183,139, 23, 47,142, 34,132,
+ 68,249,249,249, 93, 3,128,230, 82,184,118,117,224,108, 30,212,192,163,168,171, 3,103,115,115,105,197, 83, 70,213, 17,160, 81,
+103, 55,201,213,193,126, 94,202,110,181, 28,174,236,250,117,235,178,126,253,250,109, 1,176, 22,192, 66, 23, 23,151,171, 35, 70,
+140,120,176, 99,199,142, 7,203,151, 47, 55,254, 31,123, 87, 30,214,196,181,190,223,153, 76,246, 4,194, 26,194,174,178,168, 32,
+168,184,111,184,224, 46,238,104,221,171,117,185, 86,175,214,214,218,186, 20,193,170, 85, 91,107,181,181, 85,107, 69, 69, 91, 20,
+113, 41,238,168, 21,173,187, 40,130,130, 32, 59,178,132, 45, 4, 66,246,100,126,127, 40, 92,106, 89,130,109,127,183,246,230,125,
+158, 60,132,228,204,155,115,102,206,153,121,207,119,190,243,125,105,105,105,244,156, 57,115, 20, 28, 14,231, 83,243,125,208, 12,
+ 51,204, 48,227, 47, 67,109,100,120,199,150, 8,173,209, 31,125,244,209,125,154,166,107, 99,105,205,104,160,204,152,213,171, 87,
+223,167,105,186, 54, 58,252,171, 1,204, 26, 10,104, 22,182,115,231, 78,154,195,225,124,255,154,141,169,207, 41, 25, 55,110, 92,
+ 79,185, 92,222,205,193,193,161,219, 75,203,149,171,157,157, 93,198,225,195,135,171,149, 74,101, 53, 77,211,213,122,189,190,250,
+222,189,123,213, 3, 6, 12,168,174, 55,235,111,174,158,191,193, 42, 9,174,223, 93,243, 14,189, 74,130,235,175,124, 53,125,223,
+190,125,103, 51, 51, 51,127,182,180,180, 92, 97, 34,167,171,189,189,125,168,141,141,205,121, 59, 59,187, 85, 54, 54, 54,133, 90,
+173,150,174,168,168,160,159, 62,125, 74,255,242,203, 47,244,205,155, 55,105, 27, 27,155,252,198,234, 25,196,163,110, 85,108, 89,
+ 68, 27,247,109,160, 53, 59, 86,210, 0,104,217,182,143,233,210,111,195,233,187,243,134,209, 3,184,140, 27,175,113, 62, 97,101,
+101,181,231,248,241,227,198,244,244,116, 58, 54, 54,150, 62,125,250, 52,189,100,201, 18,186,173,147,163,186, 39,155, 44,238,199,
+161,206,191, 78,192, 82,181, 90,125, 95, 46,151,223,175,174,174,190,239,227,227,115,191,123,155,137,145, 13, 0, 0, 32, 0, 73,
+ 68, 65, 84,247,238, 49, 61,123,246,252,242,232,209,163, 75, 55,110,220, 56, 54,200,130,243,180, 38,238, 40, 77,127, 56,130,166,
+ 23,245,165,159,205, 29, 64, 15,226, 81, 15, 27,229,116,112,200,175,141,214,174, 80, 40,232,248,248,120,250,242,229,203,180,196,
+206, 78, 30,200, 99,204,239,195, 65,255, 62,150,176, 50,181,158, 3, 69,100,196,173,111, 63, 51, 40,207, 30,164,127,156, 53, 66,
+ 63,192,138,220, 89,175, 92, 20, 77,211,133, 19, 39, 78,204,162,105,186,240,216,177, 99,121, 52, 77, 23, 78,152, 48, 33,139,166,
+233, 66, 0, 63, 53,196,249, 74,112,210,125, 47, 69,214,162,176,176,176,251, 52, 77,223, 15, 11, 11,187, 15,188, 8,162,218, 95,
+ 68,238,191,189,251,115,163,250,244,126,250,232,156, 81,134,254, 34,114,127,131,245,180,162,126, 78,216,183,141,214,156, 63, 68,
+ 31, 95, 50,205,208, 87, 98,121,213,219,219,251,243,165, 75,151,198,220,188,121,243,145,193, 96,120,156,145,145,241,248,235,175,
+191,126,220,171, 87,175,235,182,182,182,137,108, 54,251,221,230,174,209,159, 4, 51,167,153,211,204,105,230, 52,227, 85, 3, 83,
+ 19,223,253,188,121,243,102, 1, 77,211,239,135,132,132, 96,211,166, 77,147, 59,116,232, 48,197,217,217,217, 30, 0, 10, 10, 10,
+106,146,146,146,228, 33, 33, 33, 8, 13, 13,197,150, 45, 91,190,196, 11, 95,150,255, 79, 20,157, 56,113,194,101,241,226,197,210,
+141, 27, 55, 26,231,204,153,211, 30, 64, 82,105,105,105,219,105,211,166, 45,162, 40, 42,196,221,221,221,191,176,176,176, 68,169,
+ 84, 30, 2,176, 27,205,172,153, 54, 6, 14, 9, 67,215, 86,142, 56, 79,194, 80,239,227, 17,161,161,161,111, 77,152, 48, 65,187,
+109,219, 54,189, 92, 46, 63,101, 34, 93, 94, 73, 73,201,186,218,127,108,108,108, 36, 15, 31, 62,124, 87, 44, 22,147, 25, 25, 25,
+ 80,171,213, 72, 79, 79, 55,226,197,210, 84,131,168,214,211,219,191, 59,118,177,221,251,211,131, 45,107, 82, 30,128,197, 96, 64,
+199,100,163,232,214,121,236,139, 79,145, 43,180,216,241, 58,237,148,201,100, 95, 44, 89,178,100,218,138, 21, 43,184,238,238,238,
+196,141, 27, 55,112,228,200, 17,181, 84, 42, 29, 14,224,234,127, 66, 63,181, 12, 70,163, 17,108, 54, 27, 0,240,241,199, 31,131,
+ 36, 73,166, 84, 42,101, 19, 4,193, 33, 8,130, 79, 16, 4, 67,151,249, 24, 70,121, 5,138, 43,100,200, 43,150, 53,201,103, 48,
+ 26,143,220,190,125,123, 89,231,206,157,201,187,119,239,162,164,164, 4,233,233,233,180,129,166,127,138, 87, 26, 94, 56, 37,170,
+ 77,175, 31,223,198,118, 92, 39,107, 14,201,142, 8, 69,160,134,100,236, 50, 98, 34, 94,196,210, 2,128,125, 4, 65,176, 0,148,
+249,248,248, 12,124,242,228, 9,207,199,199, 71,153,146,146,114,150, 32, 8,103, 0,251, 27,226,228,241,120,165, 0, 74,143, 29,
+ 59, 6, 0,243,240,226,228,117, 89,187,118,109, 97,124,124, 60,194,194,194,138, 1,236, 4, 0,161,181,237, 24,127, 17,139, 96,
+ 31, 8, 67, 47, 53,200, 29, 70,186, 65,171,171, 80,236, 48,168,131,128, 4,243,135, 79,208, 77,210,142,100,235,181,126,225,225,
+225,241,213,213,213,234,168,168, 40,205,236,217,179, 25,105,105,105,119, 0, 92, 3,112, 12, 47,125, 44,205, 48,195, 12, 51,204,
+248, 75,241,170, 5,171, 89, 31,173, 87, 85,235, 38, 0,223,165,166,166,214, 37,149, 78, 77, 77,189, 15, 96, 23, 94, 68,131, 31,
+221, 2,197,187,230,165, 69,107,247,107, 54,230, 85, 78,110, 64, 64, 0,239,201,147, 39, 44, 52,156,196,145,120, 13,206,223,161,
+161, 92,135,222,222,222, 95,233,116,186,152, 93,187,118, 29,101, 48, 24,211,254,128,218,119,247,242,242,170, 56,124,248,176, 49,
+ 54, 54,150, 94,179,102,141,193,209,209,177, 2,191,247,209,250, 13,103, 32,155, 17,189,188,189,179,252,222,140,190,244,179,165,
+ 99,232,107,211, 7,208,243,157,133,242, 64, 46,227,200, 31,156,149,120,137, 68,162,125, 60, 30, 79,110,105,105,121, 17, 64,239,
+ 63,114,141,108,109,109, 15, 74, 36,146,139,245, 95, 14, 14, 14, 49,246,246,246,223,216,217,217,173,177,178,178, 90,224,193,101,
+111, 91,218,214, 73,149, 56,206,135,142,235, 99, 79, 79,183, 99,191,186,116,248,106, 61, 29, 61, 60, 60,202, 34, 35, 35,141, 63,
+255,252, 51,189,114,229, 74, 99,171, 86,173,228,104,194,175,173, 73,139,150, 21,227, 72,244,132,158,198,226, 81,206,244,166,246,
+ 22,198,129,214,140,198,118, 40, 78,127, 41,128,103, 53,199,233,233,233,185,139,166,233,136,245,235,215, 71,224, 63,185, 64,135,
+132,135,135,175,165,105,122,109,120,120,248, 90, 0,195, 0, 32, 80, 68, 70, 30, 26,219,213, 80, 48,210,137,254,172,189,208, 16,
+ 40, 34, 35, 27,180,100,218, 80, 39, 78,206, 29,101, 44,156,219,135, 14,245, 18, 24,122,218,112, 46,177,217,236,165,120, 97,113,
+238, 14,128,109,158, 53,155, 57,205,156,102, 78,179, 69,235,111, 39,188, 76,130,196,198,198,102, 95,155, 54,109,142,186,187,187,
+ 31, 21, 10,133, 95,226,133,211,124, 75, 47,132,199,134, 13, 27,228, 34,145,168,211,159,120,113,197, 0,156,241,251,196,185,127,
+ 90,135, 89,231,136,197,105, 43, 38, 63, 92,231,136,197,245, 62,238,222,190,125,251,207,240, 34,154,247, 31,237,132,238, 54, 54,
+ 54, 95,219,216,216,228,191,244,205,114, 55,133,179, 43,131, 49,109, 32,151,113,163, 55,155, 44, 26,200,165,126,237,198, 96, 76,
+125, 67, 7, 96, 83,155, 45, 26,227,116,177,179,179,219,102, 99, 99, 83, 96,103,103,247,117, 11, 69,214,111, 56, 59,241,224, 56,
+200,138,113,162,183, 5,161, 24, 36, 98, 28,235,202,111,124, 83, 71, 11,218, 30, 16, 22, 22,246, 54, 77,211,111, 59, 57, 57,133,
+212, 19,254,254,161,161,161,193, 52, 77, 7,215, 70,128,239,206,135,120,128, 21,227,112, 31, 75, 66, 54,192,138,113,184, 59, 31,
+226,198,234, 57,208,138,113,164,143, 37, 33, 11,180, 36, 15,187,113,208,202,124, 51, 55,115,154, 57,205,156,102,161,245,207, 16,
+ 90,230, 14, 99,230, 52,115,154, 57,205,156,102, 78, 51,167,153,211, 44,180, 26, 22, 86,245, 95,117, 43,108,148,249,220,152, 97,
+134, 25,102,152, 97,134, 25,102,252, 33, 52, 26,176,148,104, 66,149,182,196,177,253,117,148,109,156,153,211,204,105,230, 52,115,
+154, 57,205,156,102,206,255, 57,206,230,184,255,191, 55,214,189,209, 48,155, 85,205,156,102, 78, 51,167,153,211,204,105,230, 52,
+115,254,207,130, 52,159, 2, 51,204, 48,195, 12, 51,204, 48,195,140, 63,132,128,151,127, 95, 13, 92,218,176,143, 22,213,125,125,
+177, 94,175, 23, 3, 0, 69, 81, 82,221,157, 53,142, 77,177, 51,129, 32,253,139,244, 59,160,128,121,122,224, 98, 3,156, 23,245,
+122,189,245, 75,206, 10,221,157, 53,195,154,228,236,190,254,124,253,242,250, 59,107,134,188, 90,134, 6, 24,204,238,235, 11, 94,
+169,171,147,169,103,133,192,111, 98, 98,253,101,245,124, 83, 56,255,151,193,236,177,190, 88,167,123,209,143,152, 76, 74,170,189,
+221,116, 63, 98,245, 88, 95, 80,191,188,238,246, 26,135,166, 56,249, 60, 78,153,167,179,253,151, 77,113,102, 20,148,190,175,168,
+ 81,217, 54,197,217,210,177,233,234,232, 24,100,120, 57, 54, 25,192,188,252,194,194,139,127,179,190,212, 21,192, 26, 0,150,245,
+ 62, 75, 4,240,158,185, 87,154, 97,134, 25,111,152,208, 74,192,139, 60,135,123, 94,138,173, 61,141, 10, 45,189, 94, 47,190,127,
+124, 45, 20,106, 32,104,230,122,177,199,184,221,191, 75,148,172, 87, 85,176,101,201, 81,254, 12,157,220,218,158,210, 90, 22, 20,
+ 20, 16, 0, 64, 16,196,247, 0,220, 26,224,180,190,127,124, 45,106, 52, 64,224,148,112,107, 55,192,178,132,197,250,128, 39, 16,
+ 12, 84, 42,149, 29, 0,128,199,227, 37, 43, 21,138, 43,246, 90,237,214, 87,203, 55,214,178,250,117, 29, 52, 99,189,184,253,184,
+221, 75, 12, 70, 35,251,249,221, 93,129,170,210, 52,138,169, 87,239, 92, 5,156, 93,219,128,168,106,132,239, 63,191, 59,105,165,
+ 45, 19, 24,196,230,114, 59, 89, 89, 91,247, 51,210,180,143,209,104, 36, 12,122,253, 99,121,101,229, 53,163, 94,255, 80,175, 81,
+216,222, 63,245,153,177,169,122,190,218,150, 73, 0,117, 28, 8, 17, 8,133, 3, 25, 76,102,111, 0, 48,232,116, 55, 20,213,213,
+ 87,198, 3,209,166,180,221,212,243,243,186,229,255,215,160,211,233,197,153,231,215, 66,173, 3, 2, 38,126, 38,238, 56,237,192,
+ 97, 0,208, 72, 31, 58, 84,167,157,234, 1, 0, 2,207,224,219, 28, 73, 64, 49, 0, 80, 57,133,226,167,177,171,161,214, 1, 62,
+193,225,226,230, 56,103,135, 30,177, 93, 49,127, 2, 7, 0, 46, 28,251,166,237,229,152,239, 70, 0,192,160, 9, 11,207, 14,157,
+184,248, 41, 0,108,217, 19, 99,251,211,103,147,155,228, 52,109,108, 86,178, 42,211, 98,189, 52,242, 66, 43, 87, 1, 37, 73, 75,
+ 75, 35, 1,192,201,201,201,164,177,233, 2,136, 10,129, 69, 36,131,209,207,211,203, 43, 0, 0,157,241,236, 89,130, 65,175,191,
+238, 8,236,252,147,251,210, 18,154,254,109,112, 86,130, 32,204, 29,210, 12, 51,204,120,211,112,250,165,184, 58,253,187,201,108,
+ 99, 71, 40,212,192,213,116,160,127,207,142,152, 63,109,164,176,254,119,209,187,195,221,210,238,158,108,255,195,129,173,100,199,
+142, 29,145,153,153,105, 82, 45,106, 52,192, 47,105, 0,100, 79, 44, 42, 4,130,103,219, 62,255,220,114,200,144, 33,148,147,147,
+ 19, 8,130, 64, 81, 81, 81,207,184,184,184,174,203,150, 45,251, 23,100, 79, 42,106, 52,168,250, 37,173,121,222,218,186,118,104,
+219, 10,107, 22, 79, 22, 1,192,170,153, 59,187,222, 77, 45,182,121,246,236, 89,208, 71, 31,125, 84,198,184,114,229, 59, 59, 32,
+162, 24,200, 51,165,158, 7,127,190,205, 21, 21,254,232, 49,125,241,226, 99, 94, 94, 94, 66,119,119,119,194,194,194, 2, 12, 6,
+ 3, 21, 21, 21,110, 73, 73, 73, 35,238,220,185,163,136,187,250, 61,251,222,157, 49, 25, 82,110, 15,149, 73,109, 87, 22,112, 47,
+ 88, 88, 36,207, 24, 63,222,101,242,228,201, 92, 79, 79, 79, 0,192,179,103,207,188,163,163,163,167, 28, 59,118, 44, 20,202, 2,
+125,141, 6,170,230,218, 94,199, 9,128, 11,244,182, 18,139,167, 51,152,204, 14,122,189,222,249,165,181,225,185, 65,167, 75,150,
+ 73,165,135, 94, 45,111,198,239,161,214, 1, 79, 10,129,193,253, 2, 48, 99,194, 96, 1, 0,124,244,214,134,158, 57, 89,233, 44,
+141, 70,131,182,237,124,250,124,250,217,151,231, 65,146,136,140,137,171, 43,111, 10,103,226,147, 76,172,253,116, 27, 10, 30, 69,
+247, 52, 84,166, 15,172,146, 87, 50, 0,192, 82, 36,154, 16, 29,245,227, 21, 39,255,144, 91,233,165, 90,147, 56,155, 26,155,231,
+162,190,118,204, 79,186,226,251,237,133,125, 76, 55, 55, 55, 60,122,244,168,101, 99,179, 50,213,194,232,232,248,120,235,135, 31,
+ 74, 2, 3, 3, 33, 20, 10, 65, 81, 20,244,122,253,224,235,215,175, 15, 94,187,118,237, 66, 84,166, 42, 76, 29,155, 38, 96, 43,
+ 65, 16, 3,103,207, 95,226, 56,114,108, 8, 38, 12,239,211,100, 97,173, 70,195, 96,177,217, 6,115,111, 53,195, 12, 51,254, 70,
+168,181, 94,213,223,121,184,167, 73,161, 69, 81,148,116,200,172,141,226,126, 61,252,112,247,225,211,202,236,220,194,234,218,239,
+202,147,163,219,142,237,227,236, 27, 31,127, 21,106,181, 26, 55,110,220,192,195,135, 15,145,149,149,133, 5, 11, 22,168, 95, 46,
+ 29, 54,196, 89, 17, 56, 37,220, 26,149,105, 66,111,118,106,235,184,148, 20,134, 74,165, 66,124,124, 60, 42, 42, 42,192,102,179,
+225,226,226,130,161, 67,135, 82, 41, 41, 41, 54, 65, 67,134,139, 2,135, 79,205,132,200,187,154,162,168,138,198,242,136, 80, 20,
+ 37, 13,154,185, 94,236,235,221, 10,207,178, 11, 42,215,124,246, 67,181,209, 72, 83, 25, 89, 57,218,171, 87,175, 34, 32, 32, 0,
+ 23, 47, 94,180, 45, 47, 47,255,100,231,206,157,107,152,155,191,221,174,211,148, 45, 71,227,124, 21,129, 83,194,173,109,165, 71,
+221, 47,159, 59,193, 74, 78, 78,102,237,218,181, 11,101,101,101, 96,179,217,176,178,178,130, 68, 34, 65,219,182,109,137, 85,171,
+ 86, 9,131,131,147,241,239,121, 33,238, 90,143,185,169,141,213,179,174,237,213, 57,124, 59,249, 5,207,152,211,167,201,190,125,
+251,254,102,218,222,166, 77, 27, 12, 27, 54,140, 59,125,250,116,207,201, 83,166, 25, 3, 71,205,126, 6,161,123, 77,179,156,138,
+ 60,158,109,205, 77,167,193, 83,166,156, 10, 15, 15,183,146, 72, 36, 16, 8, 4, 0,128,202,202, 74,151,236,236,236,158,161,161,
+161, 19,111, 39, 70, 81,129,193,121, 5, 16,184, 42,155, 58,159,255,171, 96, 50, 41,105,173, 21,201, 66,192,171,200,203, 47, 86,
+ 0,128, 70,163,129, 70,163,129, 90,173,198,187, 11, 23, 48,230, 77,236,238,229,222,111,201,131,172,231,197,229, 62,113,183,108,
+106,143,213, 53,195, 73,213,100,201,100,185,151,230,173,253,240, 67,137,131,195,127, 86, 4, 35, 15, 30,100,148,151,151, 15, 94,
+187,118,173, 47,205, 31, 32,243, 9, 14,183,106,138,179,169,177, 41,123,122,186,245,167,139,135,117,218,253, 89, 44, 12, 6, 3,
+110,222,188,137,248,248,120,124,249,229,151,244,217,179,103, 43, 45, 5,130,121,104,114,108,166, 90,244,117, 44,242,216,188,249,
+ 24,193,225,112,112,242,228, 73,164,164,164,128, 36, 73,116,236,216, 17, 51,102,204,192,224,193,131, 37,243,231, 47,160, 3,135,
+191,149, 1, 81,187,170, 63,216,151, 72, 0, 75, 86,174,221,236, 56,115,238, 34,108,249,116, 85,179, 66,203, 44,178,204, 48,195,
+140,191,177, 53,171,209, 16, 15,136,141,141,165, 95,190,250, 3, 0, 13,144,109,198,237,254,233,232, 61,227,233, 54,227,118,255,
+ 68, 3, 36, 13,144,150, 64,171,206,157, 59,235,100, 50, 25,125,231,206, 29,250,221,119,223, 85,108,223,190,253,202,233,211,167,
+163,245, 90,237, 94, 39, 71,199, 47,232, 70, 28,236,105,128,116, 7, 68,124, 62,191, 36, 55, 55,151, 62,115,230, 12, 29, 22, 22,
+ 70, 31, 58,116,136, 62,123,246, 44, 29, 23, 23, 71,159, 61,123,150,254,233,167,159,232,196,196, 68,250,233,211,167,180, 64, 32,
+ 40,113, 7, 68, 77,112, 50,104,128,209,118,220,174,229,199,238,234,194,219,141,219,189,140, 6, 24,214, 64,251,206,157, 59, 27,
+162,163,163,233,200,200, 72,250,192,129, 3,116, 98, 98, 34, 93, 90, 90, 74, 83, 28, 65, 73,237,113,141,213,147, 6, 72,103,103,
+231, 18,153, 76, 70,187,186,186,210,108, 54,155,118,112,112,160,219,182,109, 75,247,236,217,147, 30, 49, 98, 4, 61,109,218, 52,
+250,147, 79, 62,161,101, 50, 25,205,229,114,139,107,143,107,140, 51, 0,224, 9, 4,130,220,251,247,239,211,141, 65,169, 84,210,
+165,165,165,244,249,243,231,105,129, 64,144, 27, 0,240,154,226,228, 1, 93,252,253,253, 75, 74, 75, 75,105,173, 86, 75,231,230,
+230,210, 73, 73, 73,116, 74, 74, 10,157,155,155, 75, 43,149,202, 58,238,167, 79,159,210, 30, 30, 30, 37, 60,160, 11,109,222, 4,
+209,104, 95,122,245,229,230,224, 48, 66, 34,145, 40,143, 29, 59, 70, 63,127,254,156,222,191,127, 63, 77, 2, 27, 94, 45,215, 20,
+ 39, 27, 24,218,183,111, 95,195,205,155, 55,233, 7, 15, 30,208, 31,127,252, 49, 61,108,216, 48,122,248,240,225,244,218,181,107,
+233,252,252,124, 58, 63, 63,159, 30, 49, 98,132,129, 13, 12,109,174,127, 54, 52, 54, 69,128, 91,112,112,176, 82,171,213,210, 25,
+ 25, 25,116,135, 14, 29,242, 25,192,116, 1,224,219, 31,224, 52,215, 63,157, 1,107, 71, 71,199,194,155, 55,111,210, 49, 49, 49,
+180,187,187,123, 9, 3,152,109, 9,180,177, 4,218, 48,128,217,109,218,180, 41,185,121,243, 38, 93, 86, 86, 70,187,185,185, 21,
+ 58, 3,214,127,160, 47,145, 0,246,173, 92,187,153, 78,205, 87,208, 43,215,110,166, 1,228,210, 52, 77,163, 1, 31, 79, 51,204,
+ 48,227,159,143, 87,181,200, 63, 5,117, 55,201,224,224, 96, 2,192, 47, 77, 21, 86, 50, 24, 27,183,108,217, 66,169, 84, 42,252,
+240,195, 15, 85,147, 38, 78, 60,218,191, 95,191,140,214,238,238, 50,130, 36,155,205, 54, 92,194,225, 44,221,178,101,139,149, 70,
+163,193,189,123,247,208,181,107, 87, 72, 36, 18, 8,133, 66, 8,133, 66,136,197, 98,180,107,215, 14, 82,169, 20, 22, 22, 22, 88,
+177, 98,133,168,132,195, 89,218, 28,175,209, 72, 83, 0, 96, 48, 26,217, 44, 96,190, 71,183,110,247, 66, 67, 67, 73, 91, 91, 91,
+216,216,216, 64, 40, 20, 34, 37, 37, 5, 26,141, 6,124, 30,223,164, 32,173, 36, 73,146, 66,161, 16,151, 47, 95,198,146, 37, 75,
+208,187,119,111, 88, 89, 89,193,194,194, 2, 29, 58,116,192,208,161, 67, 49,111,222, 60,100,100,100,128, 48,193,169,228, 49, 69,
+ 45,154, 55,111,158, 56, 32, 32,160,193,239, 85, 42, 21,100, 50, 25, 74, 74, 74,224,226,226,130,144,144, 16,241, 99,138, 90,212,
+ 24,159, 45, 32,113,241,246, 62,117,231,206, 29, 59,129, 64,128,200,200, 72,156, 56,113, 2,231,206,157,195,153, 51,103, 16, 27,
+ 27,139,147, 39, 79,162,164,164, 4, 0,224,237,237,141, 35, 71,142,216, 9,197,226, 88, 91, 64, 98, 30,210,166, 33,167,184,248,
+ 66,135,162, 34,187,233,211,166, 93,171,174,174,198,244,233,211,177,113,211,166, 85, 76, 96,153, 41,199,183, 3, 68, 54,142,142,
+ 17,155, 55,111, 38,139,138,138, 48,126,252,248,210,173,155, 54,189,147,112,254,188,231,253,115,231, 60, 55,134,135,191,211,191,
+127,255,210,252,252,124, 28, 60,120,144,116,112,115,139,104, 7,136, 90, 90,207, 42, 96,201, 87, 95,125,197, 85,169, 84, 24, 50,
+100, 72,134, 49, 57,185,157, 30,248,177, 26, 72,249, 5,208, 54,119,124, 33,176,104,197,138, 21, 18, 14,135,131, 15, 62,248,160,
+180, 38, 39,199, 79, 15, 28,168, 4,178, 43,129,108, 61,112,160, 42, 51,211,111,230,204,153,165, 28, 14, 7,219,182,109,147, 20,
+254, 39,233,182,169,232, 10,224, 20,128,171, 0, 10,102,207, 95, 50, 59,160,123, 47, 28,220,187, 19,159,133,127, 20, 1, 96, 18,
+ 65, 16,135, 0, 44, 55,247, 60, 51,204,248,223,132, 41, 90,228,111,138, 70, 83,238, 80,245,149, 36,128, 1, 77,177, 88,219,218,
+118,245,243,243, 67,124,124, 60,252,253,253,239, 88, 89, 89,233, 89, 28, 14,152, 76, 38,104, 99,179, 58, 11, 60,129, 32,104,240,
+224,193,212,173, 91,183,224,225,225, 1, 30,143, 7, 38,147,249,155, 23,139,197,130,163,163, 35,228,114, 57,130,130,130,152, 59,
+118,236, 8,130, 90,253,105,179, 15,196,180, 36, 97,201,173,205,211,190,223, 31,209, 38, 48, 48, 16,149,149,114, 24,141, 70,240,
+249,124,104, 52, 26, 80, 20,245, 98, 9, 72, 71,203, 77, 57, 99, 6,131,193,192, 96, 48,224,225,225,129,141, 27, 55, 66,165, 82,
+129,197, 98, 1, 0,228,114, 57,100, 50, 25,146,146,146,144,157,157,141,151,179,240, 38, 97, 33, 18,141,156, 60,121,114,131, 9,
+127,213,106, 53, 42, 43, 43, 81, 89, 89, 9,153, 76, 6,149, 74,133, 94,189,122,177, 79,199,198,142, 68, 89,217,214, 6,143,225,
+114, 39, 30, 60,120, 80,204,102,179,161, 84, 42, 81, 85, 85,133,188,188, 60,228,228,228,168,164, 82,169,222,194,194,130,116,119,
+119, 39, 57, 28, 14,103,220,184,113,132, 92, 46, 7, 65, 16, 8, 14, 14,182, 61, 28, 25, 57, 25, 26,205,151,230, 33,109, 26, 46,
+ 0,234, 46, 26,205,232, 30,221,187, 95,190,115,247,110,192,210,165, 75,145,152,152,184,153, 31, 21,117,181, 6,120,216,212,177,
+ 25,192,162, 47,234, 9, 24, 58, 39,199, 95, 11,148,212, 43,146,237,158,153,121,110,230,204,153,143, 18, 19, 19,237,182,109,219,
+ 38,153, 52,126,252, 34, 0, 27, 90, 82, 71, 11,145,168,155,163,163, 35,206,158, 61,139,220,172,172,143,244,128,178, 69, 51, 46,
+ 6,163,111, 96, 96, 32, 78,158, 60,137,252,156,156,143,244,191,173,227,139,137, 18, 80, 66,101,100,124, 20, 17, 17,177,111,206,
+156, 57, 96, 80, 84, 95,232, 91,180,112,248, 59,199,247, 57, 11,150, 34, 98,207,142, 8, 0,115, 1, 24, 1,220, 49,247, 56, 51,
+204,248,223,182,106, 53,167, 69,222, 32,177,181,167,197, 22, 45,177, 88,236, 44, 20, 10, 81, 80, 80, 0,159,246,237,165, 28, 14,
+ 7,108, 38, 19, 92, 54,219,164, 26,212,212,212,248, 59, 57, 57,161,178,178, 18,118,118,118, 96,177, 88,117, 47, 54,155, 93,247,
+222,194,194, 2, 36, 73,194,205,205, 13, 53, 53, 53,254,205,242, 22, 39,137,163,118, 44,124,247,230,213,179,109,198,143,159, 0,
+107,107, 27,184,186,186, 64, 44, 22,131,199,227,193,213,213, 21,158,158,158,244,214,173, 91,193, 23,119, 52,233, 70, 94, 95, 60,
+ 81, 20, 5,131,193,128,226,226, 98,164,166,166, 34, 49, 49, 17, 55,111,222,196,131, 7, 15, 80, 85, 85, 5, 19,116, 22,106,148,
+202, 78, 20, 69, 53, 40,178,100, 50, 25,100, 50, 89,157,208, 42, 41, 41, 65,118,118, 54,170, 21,138,206, 77,136,222, 9,126,126,
+126, 12, 0,224,241,120,232,220,185, 51,118,239,222,173,255,249,196,137,183,124,111,222,180,113, 61,127,222,234,251, 93,187,222,
+ 10, 9, 9, 49,220,186,117, 11,114,185, 28, 79,158, 60,129,189,189, 61,197,230,114, 39,155,135,115,203,112, 31, 80,216, 85, 85,
+ 13,239,221,187,119,102,101,101, 37, 62,255,252,115,146,105, 97,177, 39,188,145, 37,190, 58, 48, 24,125, 2, 3, 3,113,234,212,
+ 41, 20,228,228,124,156,211,128,128,201, 1, 74,114, 51, 50, 62,142,136,136,192,208,161, 67, 65, 80, 84,159,150,214,175,103,207,
+158,126, 70,163, 17,143, 30, 61,130, 21,112,187,165,199,123,122,121, 5,212, 90,126, 5,192,181,198,202, 9,128,107, 9, 9, 9,
+224,241,120,240,241,245,237,210,194,159,217, 74, 16, 68,225,156, 5, 75, 17,115,238, 87, 0, 64,196,158, 29,197,245, 68,150, 25,
+102,152, 97,182,104,189,169, 22,173, 90, 97, 85,255,133,223, 8, 45, 19,197, 7, 0,128,201,100,130,205,225,128,205,102,191, 16,
+ 72, 28,142,201, 28, 4, 65,128,203,229,214, 9,171,250, 2,171,254,123, 62,159,111,146,128, 1,128,138,244,115,253,230,190, 51,
+135,205,225,112,160,209,168, 65,211, 52, 56, 28, 46,172,172,172,224,225,225, 1,185, 92,142,222,125,250,171,243,100,172, 88, 91,
+159,113,137,175,115,246,244,122, 61, 20, 10, 5, 42, 42, 42, 80, 94, 94, 14,185, 92, 14,165, 82,105,242, 86,116,163,209,200,200,
+203,203,195,143, 63,254,136,178,178, 50, 0, 47, 28,173,107,197, 85,237,223,204,204, 76, 68, 70, 70, 34, 43, 43,171, 69,215,167,
+ 95,191,126,136,141,141,101, 12, 8, 10,218,123,209,221,189,224,162,187,123,193,128,160,160,189,167, 78,157, 98, 56, 59, 59, 35,
+ 59, 59, 27,247,238,221, 67, 69, 69, 5,104,154, 54,239,159,127, 13, 60, 3, 42,106,202,203,231,172, 90,181,138, 22, 10,133,248,
+252,139, 47, 58,109, 0,166,154, 42, 96, 68, 77, 8, 24,209, 31, 19, 48,160,105, 26, 70,163, 17, 6,195,235,249,138, 19, 4, 65,
+ 48,153,204,150,134, 86,104, 73,225, 58,199,247, 21,159,108,196,153,147,209,181,159,167,153, 69,150, 25,102,152,241, 15, 64,163,
+142,240, 84, 61, 5, 89,247,183, 49, 20, 23, 23, 63, 87, 40, 20,109,220,221,221,145,159,159, 47,118,115,115,203, 97, 51,153, 96,
+177,217, 32,200,230, 53, 1,159,207,127, 84, 80, 80,208,199,217,217, 25,122,189,190, 78, 84,189,186,116, 88,107,165,121,240,224,
+ 1,248,124,254, 35,168,154,140,156, 0,131,166,162, 85,151, 46, 93,234, 44, 67, 86, 86, 86,176,178, 18,129,195,225, 98,245,234,
+213,198,109, 91,183,238,116, 27, 20, 94,249,246,178, 85,244,170, 13,123,255,212, 51,107,234,131,137,207,231, 63,114,117,117,237,
+ 37, 18,137, 16, 19, 19,131,236,236,108, 84, 84, 84,160,166,166, 6,106,181, 26, 53, 53, 53,208,104, 52,224,114,185,240,245,245,
+133,165,165, 37,226,226,226, 30, 65,173,110, 88, 92,150,149,197, 60,122,244,168, 87,247,238,221,235, 44, 42, 3, 7, 14, 36, 6,
+ 14, 28,104, 87,103, 69,171,169, 65,105,105, 41,238,220,185,131,184,184, 56, 16, 4,129,180,180, 52,131, 90,169,252,201, 60, 38,
+ 94, 15, 42,224, 6, 35, 34, 98,223,191,254,245,175,119,250,244,233, 3, 3, 48, 2, 64,228,127, 81,192, 0, 0,110,222,188,153,
+100, 48, 24,250,180,109,219, 22, 50,160, 7,128,147, 45, 18,145,233,233, 9,122,189, 62,168, 83,167, 78,136, 57,122,180, 31,128,
+236,134,202, 41,128,126, 1, 1, 1, 80, 42,149,120,242,248,241,253, 22,136,172,189, 43,215,110,158, 61,115,238, 34, 28,220,187,
+ 19, 17,123,118,228,237,219,189,221, 21, 38,248,143,153, 97,134, 25,255, 83,214,172,102,181,200,223, 20,243, 27, 19, 95, 84, 75,
+ 88, 42, 43, 42,238, 39, 36, 36,180,233,210,165, 11,246,238,221,219,189,119,175, 94,207, 89,108,182,158,205, 98,129, 52,225, 65,
+162, 84, 40, 46, 93,186,116,169,199,184,113,227,168, 91,183,110, 65, 34,145,212, 9,173,218,191, 20, 69,129,166,105,240,249,124,
+ 28, 63,126, 92,171, 84, 40, 46, 53,107, 45, 50, 24, 13,228, 75,161, 71,211, 52,100, 50, 25, 88, 44, 22,190,252,114, 27,190,222,
+186,117,154, 1,136,246, 22,216,127, 8,128,251, 95,123, 64,215,212, 92, 62,115,230, 76,215,208,208, 80,166,139,139, 11,100, 50,
+ 25, 42, 42, 42, 80, 86, 86, 6,185, 92, 14,185, 92,142,138,138, 10,200,100, 50,112,185, 92, 36, 38, 38,234, 84, 53, 53,151, 27,
+227,227,168, 84,199,102,205,154,181, 34, 33, 33,193,145,162, 40,232,116, 58, 24,141, 70, 24,141, 70,104,181, 90,164,167,167, 35,
+ 57, 57, 25, 41, 41, 41, 40, 47, 47, 7,147,201, 4,131,193,192,131, 7, 15, 42, 4, 58,221, 81,141,121, 76,191, 54,152, 64,204,
+245,235,215,223,153, 49, 99, 6,156, 92, 92,250, 35, 63,223, 36, 1,115,162, 9, 1, 83,249,122, 2,230, 63, 2,168,170,234,110,
+102,102,102,159, 1, 3, 6,192,209,197,101,179,111,126,254,197,199, 45,240,211, 50,232,245,215,174, 95,191, 30, 52,115,230, 76,
+236,221,187,119,179,125,102,230,185,146, 87,150, 57,237, 1,251,214,158,158,155,103,207,158,141, 11, 23, 46,192,160,215, 95,107,
+130,178,126,196,247, 86,179,231, 47,113,125,197,241,125, 55, 65, 16,139, 1,124,110,238, 81,102,152, 97,198, 63,217,162,213,162,
+165, 67,158,193,176,114,249,242,229, 58,146, 36, 49, 97,194, 4,139,147,167, 78,133, 60,120,248,208, 67, 42,149, 90, 25, 12,134,
+102,185,236,213,234,237,203,151, 47,151,105, 52, 26,180,107,215, 14,229,229,229, 48, 24, 12,160, 40, 10, 20, 69,129, 32, 8,144,
+ 36, 9,161, 80,136,132,132, 4,236,219,183, 79,110,175, 86,111,111,246, 33, 97, 48, 60,138,140,140, 4,131,193,160,185, 92, 46,
+ 8,130, 0, 69, 81,216,182,109,155,244,107, 32, 6, 0, 24, 36,169, 1, 0,146, 36, 76,245,222,109,118,221,146,205,102,195,248,
+ 98, 19, 64,179,101,173,213,234,175,182,108,217, 82,245,228,201, 19, 40, 20,138, 58,235, 91,117,117,117,157,115,189, 76, 38, 3,
+ 65, 16, 80, 40, 20, 56,117,234, 84,149,181, 90,253, 85, 99,124,101, 64, 81,126, 90,218,152,238,221,187,151,101,102,102,162,178,
+178, 18,143, 30, 61, 66, 92, 92, 28,142, 28, 57,130, 11, 23, 46, 32, 61, 61, 29,122,189, 30,206,206,206,160,105, 26, 39, 78,156,
+168,212, 87, 85,141, 40, 3,138,204, 99,162,113,180,146, 72,130, 28,196,226, 92,123, 59,187,252, 86, 18, 73,208,171,223,139,128,
+167, 79,159, 62,133, 94,175,135,135,135,135, 77, 83,126, 90,180, 94,127,253,250,245,235,152, 57,115, 38, 92,219,180,217,228, 14,
+216,191, 90,198, 29,176,119,247,244,220, 84, 43, 96,104,189,254,122, 75,235,108, 1,236,248,240,195, 15,149, 44, 22, 11, 81, 81,
+ 81, 30, 58, 47,175, 20, 10,152, 42, 4,218, 15, 0, 88,205, 29,239, 8,236,252,228,147, 79,138, 8,130,192,161, 67,135,236, 68,
+158,158, 73, 20, 48, 75, 4,180, 18, 1,173, 40, 96,150,200,211, 51, 41, 42, 42,202, 78,175,215, 99,217,178,101, 69,142,192,206,
+ 38, 40,151,208, 52, 61,154,166,233, 64,154,166, 93,247,237,222,142, 51, 39,163,107, 69,214, 92,188,112,122,159, 1, 32,201,220,
+227,204, 48,195,140,127, 50, 26, 52, 67, 81,221,215, 23, 3,180,184,127,207,142,184,251, 48,181,210,206,218,242,124,237,119,229,
+201,209,109, 7,249, 91,118,252,246,219,111,193,100, 50,145,151,151,135,199,143, 31,195,210,210, 18,211,166, 77, 83, 43,171,170,
+198,212,203,117, 56, 24, 64,220, 75,206, 23,249,212, 42,211,132,158, 84, 98,155,115,103, 98, 25, 34,145, 8,213,213,213, 32, 73,
+ 18, 92, 46, 23,124, 62, 31, 60, 30, 15,247,238,221,195,168,209, 99, 13, 37,252,192,255, 4, 44,253, 79, 62,181, 58,206,218, 88,
+ 67, 61, 0,126, 2,240,129,216,201,105,249,154, 53,107,120,195,134, 13, 3,139,197,130, 75, 43,239, 34,143,225,159,239, 32, 73,
+ 66,159, 95, 38, 95,237,217,202, 73,244, 56, 45, 27, 0, 33,213,221, 89,227, 84, 47,215,225,239,234,233,166,185,234,113,252,192,
+ 86,203,206,157, 95,248,163,203,100, 50, 20, 23, 23, 67, 42,149, 66, 38,147, 65,161, 80, 0, 0, 98, 99, 99,113, 38, 62, 69,174,
+116, 9,201,104,172,158,255,105,123,170,133,147,246,118,235,195,145, 7, 24,246,246,246, 40, 46, 46, 70, 73, 73, 9,100, 50, 25,
+148, 74, 37, 12, 6, 3,202,203,203,241, 67,196, 1, 67,153, 48, 48,171, 46, 32,100, 83,156,138, 60,158, 77,245,175,206, 1,190,
+238,244, 59,239,188, 99, 97,105,105, 9,163,209,136,138,138, 10,228,230,230, 34, 51, 51, 19,241,241,241, 10,169, 76, 3,133,221,
+144,252,186,128,165, 13,112,254,137,120,227, 56,235,199,173,114,114,116, 44,200,201,201, 17, 27, 12, 6, 56, 59, 59,235,101,229,
+229,155,216,192, 5, 11,160, 16, 0, 93, 10,172,249,106,199,142, 57, 99,199,142, 69,183,110,221,242,138,138,139, 91, 55,212,151,
+104,128,209, 14, 16,213,184,184, 36,223,185,115, 71,146,155,155,139,153, 51,103,150,230, 60,123,246,113,173,191, 86, 37,208,207,
+221,211,115, 83, 84, 84,148, 93,155, 54,109,224,239,239, 95,196,205,205,237,144, 10, 84, 54,210, 63, 27, 29,155,178,167,167, 91,
+ 47, 28,239,215,237,221,119,223,133, 94,175, 71,124,124, 60,110,223,190,141,156,156, 28,252,250,235,175, 50, 75,129,224,173,122,
+185, 14, 27,236,159, 35,188, 21, 30,135, 14, 69, 18, 44, 22, 11, 17, 17, 17, 72, 72, 72, 0, 0, 4, 4, 4, 96,246,236,217,208,
+235,245,152, 62,125, 6,125, 58,149,151,209, 84,255, 4,224, 7,224, 11,188, 16,121,221,104,154,230, 18, 4, 81, 0,192, 21, 45,
+243,201, 50,247, 79, 51,167,153,243,127,135,243, 31,137,102,115, 29,174,255, 14,162,223,166,249,152, 87, 16,189, 59,156,234,219,
+ 47,176,125,120,216, 90,178,123,247,238,112,117,117, 69, 64, 64, 0,114,115,115, 57, 86, 86, 86,205,229, 83,171, 14, 28, 62, 53,
+179, 99,199,142, 86, 31,127,252,177,104,232,208,161, 76, 87, 87, 87,208, 52,141,132,132, 4,196,196,196,104,247,238,221, 43,175,
+113, 24, 45,187,127,229,199,106, 83,242,169,221, 6,106, 0,172,115, 41, 40,216,179,104,225,194,181,157,187,116,121, 39, 44, 44,
+140, 20,242,121,204,141,171,231,114, 1, 96,253, 55, 71, 68, 99, 67,166,225, 43, 47,160,255,212,134,243,200,213,175,103,110,254,
+188,156,145,227,131,188, 62, 88, 60,199, 48,121,242,100,129,165,165, 37, 92, 93, 93, 97,109,109,141,140,140, 12,228,231,231,211,
+ 63,255,252,115,245,205, 7, 79,153, 39, 46,220,205,225,138, 28, 77,201, 75, 88, 21, 56,108, 82,214,200,145, 35,173,103,205,154,
+101,209,181,107, 87, 38,135,195, 1,135,195, 65,113,113, 49,210,211,211,181, 63,255,252,115,117,141,120, 68,197,253, 43, 81, 85,
+ 38,230, 58, 84, 6, 78, 9, 79,191,118, 49,108, 89,242,163, 71, 51,140, 64, 39,173, 86,235,108, 48, 24, 8,146, 36, 11,141, 70,
+227, 35,109, 85,213, 62,117, 64,216, 54,115,174, 67,211, 96, 48, 24, 88, 6,131, 1, 50,153, 12, 23, 47, 94,164,158, 61,123,182,
+230,225,195,135,107, 10, 10, 10,160,211,233, 48,113,226, 68, 4, 4, 4,224,202,149, 43, 40, 41, 46,254,185, 41,174, 84,160,146,
+147,159, 63,123,222,188,121,103, 35, 35, 35,201,135, 15, 31,218, 69, 68, 68,252,208,144,128,153, 49, 99,134,177, 56, 55,119,182,
+ 26,168,108,162,127, 54, 53, 54, 75,207, 69,125,253,112,220,132, 16,223,176,208, 53,204,222,189,123,195,206,206, 14,253,250,245,
+131, 86,171,181,242,241,241,105,110,108, 86, 5, 14,127, 43,163, 83,167, 78,130,109,219,182, 73,230,204,153,131,197,139, 23, 3,
+ 0,148, 74, 37, 46, 92,184,128,101,203,150, 21,229, 82, 61, 20,205,245,207,151,150,170, 90, 1,118, 21, 64, 32,128, 12,152, 29,
+223,205, 48,195,140,127, 38,106,147, 74, 59,226, 69, 98,233,211,120, 49, 57,111, 62,215,225,181,219, 73,168,159,230,227, 5, 28,
+ 31,235,221,102, 61, 91,176,124,147, 63, 67, 39,183,102, 18, 42,203,180,167, 79,137,230,114, 30,214,229, 83, 19,121, 87,219,102,
+254,212,125,227,250,245, 75,191,250,234,171,160,218, 16, 14,124, 62,255,145, 82,161,184,100,175, 86,111,175, 17,121, 95,106,105,
+110,190,124,160, 24,192, 66,235,251,247,119, 4,143,157,184,133,107,227,193, 92,181, 97,175,138, 65,146,154,244,130, 18,124,229,
+ 5, 8, 76,216, 32, 89,163, 1,146,101,142,250, 98,219,144,212, 79, 62,252,240,131,245,235,214,117, 23, 10,133,253,181,122,189,
+183,209,104, 4,140,198,180, 26,133,226, 42,173,213,222, 81, 7,132,110,229,138, 28,105,147,243, 18, 90,249, 84,217,100, 69,119,
+223,191,111,223,146,163, 71,143,254,174,237,182,106,245,142, 26, 43,159, 56, 83,218, 94,191,140, 10,184, 1,169,244, 70, 83,166,
+ 75,115,174, 67, 19,103, 31, 70,227,124,107,107,235,131, 65, 65, 65,220,193,131, 7, 99,212,168, 81,232,221,187, 55,140, 70, 35,
+104,154, 70, 85, 85, 21,142, 28, 57,130, 45, 91,182,164,181, 6,214, 53,199,167, 6, 46,113,206,156, 25,209,169, 83,167,136,166,
+ 4,204, 75,145,213,172, 79, 98,211, 99,147,147,166, 23,141,201,158,178,104,163,151, 70, 94,104,101,203,215, 75,146,147, 30,145,
+166,143,205,118, 85,134,132, 35, 61, 38,142, 31,191,136, 65, 81,253, 94,238,128,164,159, 60,126,124,191, 54,169, 52, 2,102, 95,
+108, 97, 95,170,141, 93,103,118,124, 55,195, 12, 51,254,233, 66,107, 20, 94,248,107,213,165,228,105, 52,215, 97,173,213,135,162,
+ 40,105,198,137, 5,211,154, 98,103, 2, 65, 47, 45, 89,104, 54,215,225,203,247,217, 64, 21,212,234, 79,127, 19,140,180,222,238,
+ 66,230, 43,229, 91, 18, 22,177, 2, 72,133, 94, 29, 12,233, 99,224,212,194, 23,124,221,215,127, 84,191, 77,141, 62,100,127,243,
+187,172,114, 21,112, 13,213,213,215, 80, 93,221,160,211, 46,147, 98,149, 55, 87,207, 87,219,158, 11,200,255,104,219, 95,229,108,
+ 86, 60,252,129,243,249,191,134,231,165,165, 39, 0, 8, 93, 98, 99, 29,206,197,198, 78,254,224,253,247, 39, 58, 58, 57,121,218,
+217,217, 89, 91, 88, 88,144,183,110,221,202,212,171, 84, 59, 58, 3,251, 95, 90, 83,155,133, 26,184,212, 46, 55,183,195,164,241,
+227, 23, 17, 20,213,183,190,128,161,245,250, 95, 61,128,157, 77, 89,178, 94,119,108,186,114, 28,131, 94, 90,178,192, 0,230,153,
+210, 55,242, 95,212, 99, 3,244,250, 13, 72, 76,108,160,207,183,184, 47,173, 39, 8,162, 10,102,199,119, 51,204, 48,227,159,139,
+218,124,135,167,255,191,127,120,176,153,211,204,249, 15,226,100,224,197, 46, 58,243,249, 52,115,154, 57,205,156,102, 78, 51, 76,
+ 2,101, 62, 5,102,152, 97, 50, 12,248,207, 50,152, 25,102,152, 97,134, 25,102,212,162,214, 55,171, 62,246, 0, 47, 92,119, 26,
+ 83,165, 45,217, 77,240, 58,202, 54,206,204,105,230, 52,115,154, 57,205,156,255, 21, 78, 62,126,191,236,109, 62,159,102,206,255,
+ 47,206,230,184,223,196,221,140,181, 62, 89,117,190, 89,255, 95, 48,155, 85,205,156,102, 78, 51,167,153,211,204,105,230, 52,115,
+254,211,225,248, 82,100,213,127, 1,104, 97,192, 82, 51,204, 48,195,140,127, 42,194,194, 64,210, 52, 8,154, 14, 35,105,250, 40,
+131,166, 67, 24, 52,141, 63,148, 10, 36, 36,164,225, 96,182,255,158,102,109, 97, 62,227,102,152,241,143, 66, 33, 26, 73, 42,109,
+246,209,250,239,194, 77, 34,145,236, 6, 64, 20, 21, 21,205, 7,144,107, 62, 37,127, 63,216,216,216, 4,233,245,122,200,229,242,
+ 75,127, 22, 39,131,193, 32, 12, 6, 3,253,119,104,159,175, 39,198,211, 36,124,234, 62,160,145,251, 36, 29, 7, 27, 42,235,227,
+133,153, 32,254, 19,139,139, 48,226,201,227,103, 56,222,130,159, 35, 71, 12,118,221, 9, 0,103,227,242, 22,225,175,137,171,213,
+214,222,222,254,114,207,188, 0, 0, 32, 0, 73, 68, 65, 84,254, 60, 69, 81,148,193, 96, 88, 40,149, 74, 99, 27, 23, 66, 33, 12,
+ 0, 96,210, 87, 86,202,138,196, 31,191,247, 47,130, 89,163,222, 39, 83, 43, 21,149, 12, 38, 35,139,195,148, 92, 95, 48,135, 60,
+ 91, 81,221,235,113, 67,199, 71, 71, 71, 55,154,197,187,131, 23, 70,144, 6,223,209, 1,126,153, 25, 95,108,239,254, 85,127, 15,
+ 59,102,102,222, 3,225,230, 93,149,187,217, 86,238,163,103, 78, 38, 98, 41, 62, 49, 99,223,190,178,234,127,234,216,217, 8,144,
+ 58, 38,179, 29, 97, 52,122,128, 32,248, 4, 0,218,104, 52, 18, 36,153,201,213,235,159, 46, 7,170, 95,131,211, 70, 11,248, 51,
+ 57, 28, 87,131, 94,239, 64, 0, 52,131,162,138,117,106,117, 30, 11, 72, 92, 9,200,254,233,156, 44, 14,199,197,160,215, 59, 0,
+192,223,177,158,102,252, 22,141, 10, 45,161, 80,120,143, 36, 73,151,250,201,112,107,243, 9,214,126, 86,255, 59,130, 32, 96, 48,
+ 24,242, 43, 42, 42,186,182,224,247, 45, 1, 76, 6, 80,187, 69,253, 48,128, 35,120,125,135, 99, 75, 22,139,181, 92, 32, 16, 12,
+ 82, 42,149, 29, 0,128,199,227, 37, 43, 20,138,203, 90,173,246,139,215,228,165, 0, 76, 18, 10,133, 3, 73,146, 28, 72,211, 52,
+ 65,211,244,149,234,234,234,203, 0,142, 2,120,157, 72, 9, 60,177, 88,188,193,198,198,102,234,202,149, 43,203,108,109,109,219,
+ 45, 91,182,236,110,121,121,249,143,165,165,165,171,209,130, 28,117,127, 49, 60, 37, 18,201, 97, 38,147,201,200,203,203, 27, 8,
+ 0,174,174,174, 87, 52, 26,141, 65, 42,149, 78, 3,240,172,133,124, 2, 0, 61,133, 66, 97, 87,161, 80, 24,104, 48, 24,124, 94,
+230,103,124, 82, 93, 93, 29,175,213,106,239, 1,184, 5, 64,241, 55, 26, 35, 22, 20, 69, 69,190,236,235,222, 0,170,254, 12,210,
+191,139,200, 2, 0,154,132,207,227,228,148,118,117,194,171, 67,251,198, 11, 19,112,107,160,172,201, 66,107, 80,127,199,209, 99,
+198, 12, 33, 1, 64,163, 59, 59,250,242,213,194,147,127,114,115,218, 78,152, 48,225, 70,100,100,164,181, 90,173,198,252,249,243,
+ 15,199,197,197,237,148,203,229, 43,155,188,113, 8,173,151,125,190,237, 2,159, 32, 72, 0, 16, 27,141, 6,241,243,231,207,188,
+ 31, 39,221, 24,158,156,124,115,163, 50,229,242, 45, 35,193, 92,160, 69,191, 20, 83, 42,225,227,129,224,209, 19,199,143, 90,183,
+ 46, 12, 83,223,154,218, 42, 57, 89,197,115,182,204, 96,151, 43, 5, 94,182,246,226, 49,235,214, 71, 19,215,175,157, 24, 19, 25,
+ 17,126,121,206, 28,219, 65,255, 64,177, 69,172,101,179,221,116, 6,195,112, 18, 40,164, 44, 44, 50,192, 98,213, 0, 0,105, 48,
+ 48, 52,114,185,103, 13, 69, 77,255, 20,184,243,137, 94,255,192, 84,206,245, 20,213, 83,228,229, 21,248,214,137, 19, 16,186,186,
+ 82, 20,135, 67, 2,128, 94,173,118,173,206,203,115,140, 26, 51,166, 71,216,211,167,191,132, 1,183,205,156,255, 21, 78, 51, 90,
+ 34,180, 72,146,116,121,254,252,185, 88, 32, 16,188,184, 25,211, 52, 12, 6, 3, 12, 6, 67, 93,242, 98,154,166,235,254,234,245,
+122,180,111,223,222,164, 25, 45,128, 65, 0,222, 30, 48, 96, 64,200, 23, 95,124,193,244,247,247,175, 77, 25,210,111,213,170, 85,
+223, 36, 36, 36, 28, 3,176, 31, 47,130, 55,154, 58,227, 29, 38, 16, 8, 14,125,254,249,231,150, 67,134, 12,161,156,156,156, 64,
+ 16, 4,138,138,138,122,198,197,197,117, 93,182,108,217, 66,133, 66, 49, 29,192,249, 22,156, 31, 63, 11, 11,139,232,241,227,199,
+187,244,239,223,159,235,235,235, 11,131,193,128, 7, 15, 30,204,185,119,239,222,148, 99,199,142,173,173,170,170, 10,129,233,249,
+218, 8,161, 80, 56,203,210,210,114, 67,104,104,168,205,244,233,211,217, 73, 73, 73, 21, 30, 30, 30,196,245,235,215,237,143, 28,
+ 57,178,112,211,166, 77,147,228,114,249,234,234,234,234, 3, 48, 33,135,162,133,133,197, 61,146, 36, 93, 76, 17,194, 47, 31,240,
+166,138,225,206,173, 91,183, 62,114,237,218,181,214,217,217,217,134,113,227,198, 29, 4,128,203,151, 47,251,235,116, 58, 98,232,
+208,161,103,243,243,243, 39, 3, 48,245, 38,217,209,198,198,230,228,212,169, 83,109, 60, 61, 61,249,173, 91,183, 38, 4, 2, 1,
+ 24, 12, 6, 42, 43, 43,157,146,146,146, 6,223,190,125, 91, 25, 23, 23, 87,174, 86,171,199, 0, 72,108,193,117,234, 45, 22,139,
+103, 48,153, 76, 63,189, 94,239, 12, 0, 20, 69, 61,215,233,116, 73, 82,169, 52, 18,192,141,215, 29, 32, 14, 14, 14, 95,111,216,
+176,193, 78, 42,149,210,155, 54,109,250,186,170,170,106,150, 41,199, 69, 68, 68,144,179,103,207,254, 75,162,160,175, 91, 23,206,
+ 12, 13, 93,171,251,179,121, 15,255,120, 20,247,238,222, 6, 94,164,205, 33, 26,232,127, 4, 0,214,123,239,189,143,174,221,122,
+ 96,218,212, 73,205,114,142, 12,114,249,156,201,102,217,170, 84,170, 27,149, 53,234,163, 2, 62,119,242,212, 41,193,105, 0,112,
+246,220, 47,147,187,119,183,190, 34,226,115, 38,113,185,220,222, 58,141,182,236,204,165,252, 15, 91, 34,170,156,157,157,207, 91,
+ 91, 91,243,203,203,203,139, 74, 74, 74,190, 27, 61,122,244,250,253,251,247, 91,103,102,102, 34, 47, 47, 15, 75,151, 46, 21,230,
+231,231, 47, 74, 76, 76,188,169,209,104, 26,181,108, 85, 85,149,111, 95,245,241,216, 80,145,200,142, 33,224, 91,194, 66,100, 3,
+ 15,207, 78,232,217,123, 52, 70,140,122, 7,233,105, 9, 61,247, 71,172, 75,120,254, 60,238, 51,161, 77,155,245, 50, 89,235, 70,
+175,173,111, 91,244, 31, 51,254,133,200, 10, 13, 13,195,211,148,148,170,236, 44,242,223,167, 79, 80,252, 17, 65,237, 57,122, 77,
+ 81,246,245,107, 39, 90,247,237, 55, 14, 0,186, 70, 70,132, 95,254,247, 52,235,160,175, 15, 87, 84,253, 67,158, 43,196, 58, 38,
+211, 15,122,125, 91, 91, 71,199, 40,149,209, 72,235, 42, 43, 93,141, 53, 53,142, 0,160,103, 50, 53, 2,161,240,145,147,151, 87,
+252,211,251,247, 3, 63,165,168,126,159, 52,157,160,188,150,115,214,176,109,219,196, 1, 11, 23,178,170,179,178,180, 25,187,118,
+213, 20,199,199, 27, 40, 14,135,118, 29, 62,156,176, 31, 56,144,187,240,201, 19,214,175,155, 54, 5, 50,195,195, 61, 86,107,181,
+135,204,156,255,175,156,255,235,168,117,130,175,191,251,112, 79,147, 66,139, 32, 8, 8, 4, 2, 68, 69, 69,129,201,100,130,162,
+ 40, 48,153,204, 70,223,187,185,185,153, 82,145, 9, 18,137,228,155,157, 59,119, 58, 12, 27, 54, 12, 92, 46,183,238, 11, 6,131,
+129, 33, 67,134, 96,240,224,193,204,130,130,130, 41, 81, 81, 81, 83, 54,110,220, 88, 44,147,201, 22,227,101, 98,232, 38, 48,176,
+ 93,187,118, 49, 23, 46, 92,224,169, 84, 42,196,199,199,163,162,162, 2,108, 54, 27, 46, 46, 46, 24, 58,116, 40,149,146,146, 98,
+ 51,100,200,144,152,167, 79,159, 6, 3,184, 98, 66, 93,187,138,197,226,171, 71,143, 30,229,118,234,212,137, 72, 79, 79, 71, 64,
+ 64, 0, 0,160,178,178, 18,227,198,141,227, 78,159, 62,221,115,202,148, 41,183,164, 82,105,127, 0,247,154,225,235, 34,145, 72,
+ 14,140, 31, 63,222,105,227,198,141,150, 22, 22, 22,200,206,206, 46,148, 72, 36,222,181,231,123,202,148, 41,236,209,163, 71, 59,
+110,217,178,101,123,116,116,244,135, 82,169,116, 22,128,251, 77,170,214,151,130,152,207,231,163,184,184, 24,135, 15, 31,198,162,
+ 69,139,192, 96, 48, 32,149, 74,113,228,200, 17,252,251,223,255,174, 21, 52, 38,137, 97, 62,159, 63,216,203,203,235,135,203,151,
+ 47,187, 88, 89, 89,193,201,201,137,252,228,147, 79,252, 60, 60, 60,120,173, 90,181, 98, 20, 22, 22, 34, 38, 38,198, 99,198,140,
+ 25, 39,115,115,115,231,168,213,234,102,151,212, 28, 28, 28,246,157, 62,125,218, 45, 57, 57, 25,187,118,237, 66,121,121, 57,216,
+108, 54,172,172,172, 32,145, 72,224,237,237, 77,124,252,241,199,252,209,163, 71,243, 23, 47, 94,188, 79,163,209,116, 54,225, 26,
+117, 18,139,197,187, 7, 14, 28,232, 17, 30, 30,110, 37,145, 72, 80, 59, 49,168,172,172,116,201,206,206,238, 25, 26, 26, 26,114,
+239,222,189, 76,169, 84,186, 0,192,195, 22, 14,156,206,190,190,190,193,227,198,141, 99, 20, 22, 22, 34, 50, 50, 50,184,170,170,
+170,179, 41,226,146,162,168,191,204, 98,101,164,105, 14,128, 63, 93,104,221,187,123, 27,243,223, 93, 90,237,228,234,202,186,112,
+254,135, 9,209,199,219,222,181,226,189, 72, 72, 45, 83, 66, 27, 50,254,105,183,161,195,222, 97,141, 28, 53,174,122,207,183,219,
+133,166, 8, 45, 38,155,101,123,248,208,151,185,215,174,223,243,187, 24,119,123,248,132, 49, 99,104, 22,203,202, 3, 0, 62, 92,
+246, 30, 51,230,212,169,136, 33,131,123, 20,244,235,219, 53,119,218,244,247,221, 90, 80,221,182,109,219,182,253, 37, 33, 33,193,
+129,195,225,160,188,188,220,118,207,158, 61, 95,246,237,219,151,204,200,200, 64, 74, 74, 10,178,178,178, 80, 89, 89,137, 33, 67,
+134, 8,239,223,191,255, 29,128, 70,133,150,150, 28,180,193,169,149,110,135, 45, 79,208, 90,107,144,139,105, 93,161,239,197,211,
+ 23, 59,254, 20,169, 12,112,112,108,239,253,246,236,181, 88,183,254, 24,243,199,195,155, 67, 47,197,253, 4,144,173, 27,207, 8,
+ 64,163,247,170,213, 43, 33,175, 82, 99,250,212,121,152, 49,117,158, 45, 13,141, 35,109, 80, 9, 52,202, 10, 43, 11,214,147,216,
+157,123,191, 28, 15,192,165,158,216,186,244, 79, 17, 91,235, 88,172,214, 48, 26, 61,188,199,141, 59,145,113,238, 92, 27, 90,171,
+181, 99,176,217,249, 22, 54, 54,197,122,181,154,214,105,181, 44,165, 82,233,156,145,156,236,216,247,227,143, 47, 93,223,180,169,
+255,167, 12, 70,183, 79, 12,134,187,141,114, 82, 84,143,224,111,190,177,247,155, 59,151,243, 48, 60, 92, 81, 26, 31,175,244, 26,
+ 57,178, 34,224, 95,255, 82, 3, 64, 85, 86, 22,235,233,218,181,124,251,192, 64, 94,175,229,203,173, 13, 26,141,100,221,186,117,
+221, 67, 95, 36, 47,111, 17,167,219,228,201,134,208,136,136,110,241,239,191, 63,128,208,233, 24,195,123,245,122,176, 41, 50,242,
+249, 31,225,252, 51,235, 89,112,245,170,186,220,195, 3, 1,227,198,149,185,137,197,234, 63,179,237,127,164,158,102,212,161,214,
+ 87,107,126,253, 25, 42, 98, 99, 99,251, 3,248, 5, 64,120,112,112,112, 24, 0,136, 68,162, 98,153, 76, 38,142,137,137,105, 86,
+100, 49,153, 76, 56, 58, 58,194,219,219, 91, 42,149, 74, 29,154,168, 64,158,209,104,116,161,105,186,206,250,210, 24,212,106, 53,
+210,210,210,208,177, 99,199,124,188, 72, 68,219,168, 81,135,207,231,103,164,164,164,216, 61,126,252, 24,247,238,221,131,135,135,
+ 7,172,173,173,193,100, 50,161,211,233, 32,151,203,209,174, 93, 59,112, 56, 28,116,233,210,165, 84,161, 80,120, 52,179, 4,196,
+ 17, 8, 4,105, 87,175, 94,117, 13, 8, 8,192,157, 59,119,224,234,234, 10,137, 68, 2, 0,200,202,202,194,245,235,215, 49,114,
+228, 72, 36, 36, 36, 96,226,196,137,121, 10,133,194, 27,128,186, 49, 66, 27, 27,155,194,203,151, 47,231,251,251,251,171, 20, 10,
+ 5, 89, 92, 92,204,140,143,143,215, 87, 85, 85, 9, 43, 43, 43,153, 50,153,140, 41,151,203, 41,133, 66,193, 36, 73,146,165, 84,
+ 42,153,151, 46, 93, 98,104,181,218, 38, 3,100,214, 94,167, 83,167, 78,193,223,223, 31, 49, 49, 49,248,224,131, 15,240,235,175,
+191,194,213,213, 21, 71,143, 30,197,242,229,203,145,154,154, 10, 59, 59, 59,248,250,250, 54,119,141,224,233,233,153,254,232,209,
+ 35, 79, 22,139, 85,155,215,177, 54, 95, 30, 74, 74, 74,240,236,217, 51, 60,127,254, 28, 94, 94, 94,152, 58,117,234,179,231,207,
+159,123, 53,215,243,156,157,157, 75,146,147,147,237, 58,118,236,136,226,226, 98, 88, 89, 89, 65, 36, 18,193,202,202,170,238,189,
+135,135, 7,222,127,255,125, 72, 36, 18,169, 74,165,114,104, 78, 4,249,251,251,159,191,116,233,146,157,165,165, 37,138,138,138,
+ 32,151,203, 65, 81, 20,248,124, 62,236,236,236,234,132,124, 90, 90, 26, 70,141, 26, 85,154,145,145, 49,172, 5, 22, 56,210,193,
+193, 33, 37, 49, 49,209,155,166,105,228,230,230, 34, 53, 53, 21,239,190,251,110,154, 74,165,106,143,255, 98,206,190, 3,251, 15,
+112,102,189, 61, 75,253,103,241,213,243,187, 98,205,154, 61,159, 53,126,108,111,205,147,228, 88,130, 99, 76, 69,103, 63,203, 74,
+ 0,120,144, 36, 23,169,201,118,240,233, 16, 76, 31, 63,121,131,125, 96,255, 30, 38,140,112, 0,129,212, 39,105,248,180, 49,238,
+161, 3, 29,231,190,247,222, 28,191, 1,125,251,147, 85, 10,133,248,187,239,182,117,201,200,120, 34, 6, 0, 15, 15, 31,233,194,
+133,203,238, 91, 8, 4,210, 95,174, 95, 53,126,245,213,190,164, 11, 87, 10,247,154, 80,101, 15,111,111,239,155,167, 78,157,178,
+ 19,139,197, 16,137, 68, 80, 40, 20,208,106,181,120,252,248,177, 42, 42, 42, 74,103,105,105,105, 81, 84, 84, 4,153, 76, 6,130,
+ 32,112,234,212,169, 92, 0,238,175, 18,213,250,104, 1,192,187, 35,124,152,190,131,188,173, 89, 28, 61,143,199,124,234, 8,194,
+192, 33,104,161,195,217,243, 15, 58,158,189,120,103,218,248, 9, 31,216,247,235, 63, 30,161,107, 66,116, 5, 5,185, 1, 90,244,
+ 75,105,200, 71,171,189, 23, 6,141,155, 56,126,210,186,117, 97, 8, 11, 13, 71,236,169, 19,149, 66, 1,169,182,180, 98,138, 2,
+123,246, 81,189,191,104,108, 94,117,117,129,235,186, 45, 81, 83, 71,141,125,223,165,111,191,113,184,126,237, 4, 34, 35,194,239,
+ 17, 60,250,141, 94, 70, 92, 11,176, 72,138,122,199,169,117,235, 67,210,130, 2,103,190, 80,200, 92, 26, 23, 39, 54, 24, 12,119,
+ 39, 45, 95, 94,117,252,210,165,186, 9,200, 39, 36,233,196, 96, 48,156,188, 71,141, 74, 76,143,141,125,135,163,215,199,124, 4,
+148,188,202, 25, 6, 88, 91,121,120, 44, 88,146,150,198,122, 24, 22, 86,173, 47, 40,168,232,186,108, 89,105, 67,191,159,127,241,
+162,128,237,228,100,105, 61,102,140,205,118,119,119, 90, 39,149,238,110,200,199,168, 33,206, 56,161,208,234,167,179,103,131,104,
+ 38,179,255,138,143, 62,226, 5, 7, 7, 67, 46,151,227,216,177, 99,216,189,107,151,218,209,209,241,145, 83, 82, 82,130,159, 92,
+190,198, 84,206,174,203,150,149, 26, 12, 6, 98,210,242,229, 67,146,179,178, 6, 21, 73,165,173, 0,192,209,198, 38,175,171,135,
+199,189,125,177,177,169, 95,183,110,109, 52,181,158,223,159, 59,231, 16,157,157, 61,215,198,198,134, 87, 44,149, 82, 28, 54,187,
+172,167,175,239,209,111, 87,175,254, 69,159,152,200,226,186,184, 88,138,130,131, 91,220,246,174,203,150,149,150, 87, 85, 81, 75,
+214,175,239,147, 83, 92,220,170, 90,173,246,146, 85, 85, 73, 12, 58, 29,105,201,231,151,181,105,215, 78,170,140,143, 47,108, 83,
+ 83,179,116, 47, 32,253,171,250, 79, 67, 90,228, 13,194,171,113,180,126,151,235,240,151,224,224,224,223,237,174,161,105,218, 36,
+107, 22,147,201,252,205, 50, 85, 19, 96, 17, 4,129,251,247,239,195,214,214, 22, 18,137, 4, 28,206,111,147, 15,150,148,148,224,
+215, 95,127,197,147, 39, 79,208,169, 83,167,218,101,140,198, 21, 17,135,243,222,150, 45, 91,172, 52, 26, 13,238,221,187,135,174,
+ 93,187,130,195,225,128,197, 98,253, 70, 4, 74,165, 82,116,232,208, 1, 43, 86,172, 16,109,220,184,241, 61,181, 90,189,174, 9,
+107,196,226,121,243,230,137,107, 45, 88,121,121,121,232,210,165, 75,221,247,246,246,246,120,240,224, 1,186,118,237, 10, 23, 23,
+ 23,132,132,132,136, 35, 35, 35, 23,235,245,250, 47, 26,227,100,179,217,164,191,191,127, 55, 0, 16, 8, 4, 32, 73,242,169,165,
+165,165,189,131,131,131,192,210,210,146,213,192,210,147,140, 36,201,102,173, 22, 36, 73,162,168,168, 8,126,126,126,168,172,124,
+145,193, 69,161, 80,192,203,203, 11,114,185,188, 78,180, 58, 57, 57, 65,169,108,218,245,171, 99,199,142, 97,237,219,183, 31, 42,
+ 16, 8, 56, 76, 38, 19, 15, 31, 62, 68, 64, 64, 0,162,162,162,224,230,230, 6, 62,159,143,180,180, 52,248,251,251,227,234,213,
+171,176,183,183, 71,135, 14, 29, 56, 98,177,248, 90,121,121,249,149,156,156,156,176, 38,234, 73, 10,133, 66, 92,189,122, 21,251,
+246,237, 67, 86, 86, 22, 10, 10, 10, 96, 97, 97,129,206,157, 59,195,215,215, 23,189,123,247, 70, 90, 90, 26,136,230, 59,147,196,
+219,219, 59,246,206,157, 59,118, 52, 77, 35, 50, 50, 18,213,213,213,208,104, 52, 32, 73, 18, 92, 46, 23,214,214,214, 24, 52,104,
+ 16,236,237,237,225,237,237,141, 35, 71,142,216,141, 24, 49,226,140, 84, 42,237, 12,160,168,185,243,106,109,109,189,116,237,218,
+181,174, 98,177, 24,217,217,217,168,172,172,132,131,131, 3, 6, 12, 24,224, 28, 23, 23,183, 84,167,211,109,251,111,141,230, 63,
+ 83,100, 1, 64, 61,199,119,226,194,249, 31, 38,120,183,169,240,239,212,142,239, 26, 19,235,224, 26, 21, 43,237, 0, 0,126, 62,
+ 14,201, 19,130,249,121, 15,147, 99,243, 46,156, 63,113,239,201, 83,196,152,178,180, 93, 89,163, 62,122, 49,238,246,240,128, 78,
+ 93,140, 91, 54, 47, 31,181,232,221,185, 28,177,195, 59, 40,206, 61,129,184,203,247,221,150,127, 48,207,254,139,173,223,159,189,
+ 24,119,155,172,172, 81,175, 49,205,148,229,246,245,254,111,123,219, 85,149, 70, 35, 61,133, 13,158,133, 31, 60, 60,218, 66, 46,
+151,131,203,229,114,167, 78,157,106, 88,185,114,101,141,165,165, 37,159, 32, 8, 92,185,114, 69, 10, 96, 88,115,188, 42,177, 53,
+109,208,234,244, 52,155, 97,164, 9, 11, 37, 97, 40,103, 39, 61,206,196,208,193, 3,139,251,246,240,219,184,114,221,214, 85,222,
+109, 3,236,231,204, 13,103,174, 15,155,182, 11, 4,250, 53,196,147,146,142,203,196,209,227, 60, 0,163,214,125, 26,134,140,140,
+ 52,235,249,111,203,194, 41, 14,207,169,189,123, 31,139, 93,251,174, 12,247,242,106,221,234,253,197, 33,167,191,252,230,203, 81,
+245, 45, 91,251, 35,214,158, 4, 16,100,202,185,253, 59,130,164,168,118, 36, 65,228,201,107,106, 24,180, 86,107,183, 52, 46, 78,
+121,225,214,173, 75,137,243,231, 91,116,100,177,218,118,100,177,192,208,106,203, 86, 3,165,159, 26,141, 5,107, 41,202, 50,243,
+228, 73, 39,138,205, 78, 80, 25,141,254, 48, 26, 27,138,159,212,113, 70,108, 44,170,115,115,117,229,215,174,169,130,190,249,166,
+212,117,216,176,109, 26,173,214,174,246, 86, 65, 18, 4,136, 90,215, 9,163,145,160, 86,172, 32,105,138,130,206,218,250,109, 84,
+ 84,180,109,142,243,131,194,194, 9,211,230,206, 29,117,242,220, 57,180,110,221,186,238,121,102,101,101,133,229,203,151, 99,217,
+178,101,156, 7, 15, 30,116,143,142,142,238,254,197,231,159, 59, 0,152, 96, 74, 61, 47,220,186,101,253,175,117,235, 86,119,234,
+218,213,237,224,225,195, 28, 79, 79, 79, 0,192,179,103,207,188, 55,111,218,228,238,231,239, 95,188,241,189,247,246, 39,175, 92,
+217, 1,192,181,166, 56,139,226,227, 53,209,217,217,115, 47, 95,185, 98,229,231,231, 7, 0, 72, 77, 77, 21,111,223,190,125, 94,
+135,144,144,233,235, 22, 46, 92, 19,172, 82,201, 44, 75, 74, 56,193, 95,127, 77,253, 52,105, 82,179,156,181,245, 4,128, 1,115,
+230,188,215,111,224, 64,223, 9,115,231,218,184,185,185, 17, 66,161, 16, 90,173, 22, 5, 5, 5,214,201,201,201,158,177, 85, 85,
+242,227,183,110, 69,194, 96, 24,242, 23,118,161, 6,181,200, 27,102,201,250,253,184,120,249,119, 64,108,108, 44,253, 82, 77,214,
+ 61,192, 13, 6,131, 73, 34,139,162, 40, 16, 4, 97,170,216, 2, 77,211, 40, 45, 45, 69, 82, 82, 18,158, 61,123, 6,133, 66,129,
+204,204, 76,236,217,179, 7,155, 55,111,198,221,187,119,161,211,233,160,213, 54,159,131, 86, 32, 16, 12, 30, 60,120, 48,117,235,
+214, 45,120,120,120,128,199,227,129,205,102,131,197, 98,213,189,184, 92, 46, 28, 29, 29, 33,151,203, 17, 20, 20,196, 20, 8, 4,
+131,155,177, 18,141,156, 60,121, 50,187,246,255,234,234,106, 48, 24,140, 58,209, 82, 93, 93,141,242,242,114,200,100, 50, 20, 22,
+ 22,162, 87,175, 94,108,145, 72, 52,210,212,171, 81, 83, 83, 83, 45,149, 74,173,250,245,235,103,253,228,201,147,223,101,251,253,
+229,151, 95, 84, 42,149,138, 73,146,164, 73,142,246,135, 14, 29, 66, 76, 76, 12, 46, 93,186,132,252,252,124,236,218,181, 11, 7,
+ 15, 30,196,169, 83,167,144,150,150,134, 29, 59,118,224,187,239,190,195,254,253,251,155,188, 70,237,219,183, 31, 17, 25, 25,217,
+163,103,207,158,124, 6,131,129,212,212, 84,188,255,254,251,144,201,100,176,183,183, 7, 0, 20, 23, 23, 99,219,182,109, 80,171,
+213, 16, 10,133,112,118,118,230,174, 91,183,174,175,189,189,253,208,166,234,104, 48, 24, 12, 12, 6, 3,238,238,238, 8, 13, 13,
+197,119,223,125,135,243,231,207,227,232,209,163, 88,184,112, 33,124,125,125,145,144,144,128,187,119,239,130,166,233, 38, 31, 50,
+ 92, 46, 55,228,224,193,131, 98, 54,155, 13,163,209,136,170,170, 42,228,230,230,226,246,237,219,170, 19, 39, 78, 84,159, 62,125,
+186,230,218,181,107,170, 27, 55,110,208, 0,234, 4,103,112,112,176, 45,155,205,126,203,132, 83,106, 47,145, 72, 86,205,155, 55,
+143, 91,191,207, 22, 21, 21, 97,194,132, 9,124, 30,143,183, 18,128,125, 83, 4,145,145,145,127,217,205, 34, 44, 60,204,242, 47,
+162,166,163,143,183,189,203, 49,166, 34, 38,246,185,107, 78,190,161,207,242, 15,183,218, 44,255,112,171, 77, 78,190,161, 79, 76,
+236,115, 87,142, 49, 21,209,199,219,222, 53, 65, 8,144,131,250, 59,142,117,176,181,218, 61, 97,204, 24,250,187,239,182,117, 89,
+244,238, 92,142,123,219,229,224,138,166,194,217,227, 95, 8, 10,116, 35, 58,250,146,220,239,190,219,214,101,194,152, 49,180,131,
+173,213,238, 65,253, 29,199,162,153,176, 51, 98, 91,174, 51,159,163,128,167,183, 47, 6,244,239, 4, 38,145,142, 99, 71,247,161,
+176,176, 16, 5, 5, 5, 40, 46, 46, 22,140, 30, 61, 26, 69, 69, 69,170, 43, 87,174, 72,149, 74,101,127, 0, 79,155,107,124,126,
+254, 99,163,170,218,160, 53, 26,152,250,170, 74, 86,205,194,165,209,131,239, 38,179,102, 23,201,156, 71,179, 57,214,236, 17, 67,
+186, 31,222,183, 55, 20,109,218,248,161, 91,247,161,189,172,133, 55,125, 27, 21,175, 25,136,253,249,216,241,147, 83, 39, 79,213,
+103,101,102,103,182,117,224,106,104,154,214, 45,253,248,251, 33, 76,129,107, 71, 79,159, 64,251, 39,233, 6,199,208, 21,111,253,
+120,250,228,151,249,215,175,157, 64,223,126,227,224,236,228,221,255,237,183,193,126, 83, 45, 90, 4, 77,123, 48,133,194, 12, 93,
+101,165, 59,197,225,228, 26, 12, 6,187, 59, 11, 22, 88,105, 89, 44, 71,131, 86, 91, 96,208,106, 11,180,108,182,229, 78, 31, 31,
+ 23,154,166,109,173, 92, 92,158,211,108,182,155, 94,171, 77, 39, 72,178, 77,131,179,115, 14,199, 69,232,238, 78, 21, 93,184,160,
+241, 24, 61,186, 2, 0, 52, 90,173, 93, 86,118,182,168, 88, 42, 21, 21, 21, 23,139,114,242,242, 68, 25,153,153,162,180,244,116,
+ 81, 74,122,186,229,163,164, 36,225,131, 71,143,132, 4,131,225, 96, 10,103, 86, 65, 65,199, 21, 43, 86,128,199,227, 65,175,215,
+ 55,116,207,134, 66,161,192,219,111,191,141, 26,160,167, 41,156, 6,131,129,248,215,186,117,171, 63, 90,189,218, 51, 38, 38,134,
+211,163, 71, 15,216,216,216,192,198,198, 6, 61,122,244, 64,244,177, 99,236,133,139, 23,187,172,218,187,247,109,146,195,113,109,
+142,179,212,203, 11, 54, 54, 54,188, 90,145, 5, 0,237,218,181,195,174, 93,187, 56,231,206,159, 23,125,250,195, 15, 91,195,111,
+220,240, 87,231,228, 40,108,219,182,165,217, 28,142,139,169,231, 19, 0,170, 84, 42,191,109,219,183,219,218,217,217, 17,197,197,
+197, 72, 79, 79, 71, 78, 78, 14,244,122, 61,186,117,235, 70, 28, 61,118, 76,164, 97, 48,186,255,197, 93,232,119, 90,228, 13,194,
+124, 52, 18, 71,139,122,249, 0,186, 10,128,136,141,141,165,107,151, 19, 95, 62, 28,235,196,148, 41, 66,235,117, 32,147,201, 32,
+147,201,176,119,239,222, 58, 97, 84, 11,141, 70, 99,138,104,241,119,114,114, 66,101,101, 37,218,182,109,251, 27, 75, 22,139,197,
+ 2, 69, 81, 96,177, 88,224,112, 56, 80,171,213,112,115,115, 67, 77, 77,141,127, 83,156, 74,165,178,179,141,141, 77,221, 3, 86,
+173, 86,215,137,172,218,250,106, 52, 26, 84, 84, 84,160,186,186, 26, 85, 85, 85, 80, 40, 20, 1,166,180,215,104, 52, 34, 41, 41,
+233, 89,187,118,237, 58, 51, 24, 12, 8,133, 66,129, 66,161,168,243, 45, 42, 47, 47,199,129, 3, 7, 20, 51,103,206,180, 59,117,
+234, 84,179, 9,139, 9,130,192,191,255,253,111,112, 56, 28,212,212,212,224,187,239,190,195,146, 37, 75,192, 98,177, 80, 85, 85,
+133, 93,187,118,225,253,247,223, 7, 69, 81,208,104, 52,216,190,125,123,163, 92,143, 31, 63,206,186,117,235, 86, 64,151, 46, 93,
+172,143, 31, 63, 94, 50,100,200, 16,251, 97,195,134,129,199,227, 65,169, 84, 66,167,211,161,103,207,158,104,223,190, 61,164, 82,
+ 41,206,158, 61, 91,234,237,237,109,119,251,246,109, 99, 81, 81, 81, 78, 51,226,154,174,103, 49,132,193, 96, 64,113,113, 49,100,
+ 50, 25, 74, 74, 74, 80, 80, 80,128,252,252,124, 80, 20,133,102,116, 22,108,109,109, 39,250,249,249, 49, 0,128,199,227,161,115,
+231,206, 88,189,122,181, 94,169, 84, 78, 6,112,246,101,177, 17,223,127,255,253,241,235,215,175, 83, 78, 78, 78, 72, 73, 73,129,
+189,189, 61,197,229,114,223,210,104, 52, 77, 90,163, 36, 18, 73,196,207, 63,255,108, 83, 43,174,107,207,115, 77,205,139,203, 49,
+ 97,194, 4,155,131, 7, 15, 70,232,245,250, 70,197,117, 97, 97,225, 95,103, 53, 32, 24,234,191,138,219,138, 7, 86,103, 63,203,
+202,168, 88,105,135,229, 31,110,165,218,251,189,152,188,206, 95, 0,234,139,207, 63,232, 48,125,172,229,105, 43,158,156,213, 28,
+207,136,193,174, 59,199,140, 25, 66, 78,157, 18,156,198, 98, 89,121,236,222, 19, 46, 22, 59,188, 83,175, 17,150,176,181,179,132,
+135, 59,155,136, 62,253, 68,252,241,202, 79,213,135, 14,126,153,241,227, 79,177,195,217,204,139, 67,207,198,229, 45,108,140,251,
+233, 51,217,169, 26, 53,215, 71, 94,150, 72,216, 56,244, 65,231, 78,237, 32,182,175,192,247, 17, 81,104,221,166, 27,212,106, 53,
+ 44, 45, 45,249, 6,131, 65,203, 96, 48, 14,153, 34,178, 0,224,210, 37,153,177, 67, 7,153,134, 81,101,212, 47, 90,242,197,248,
+ 33, 35,198,248, 14, 26, 52,216,120,225,226, 5,109,159, 0,109,225,136, 97,157,139,207, 93,220,153, 86, 88,144,233,221,193,191,
+ 47, 30, 39, 95, 25, 78,211, 72, 34,136,134, 69,103,114, 58,206,169,140,143,175, 68, 69,205, 55, 42,141, 9,188,245, 27, 30,141,
+ 24, 53,106,150, 95, 96,191, 64,227,197,184,203, 26, 54, 74,159, 88,246,237,253,124,209,220, 17,199,127, 56,180,125,232,185,179,
+ 17, 94,149,242,156,216,253,251,161,198, 27, 10,154, 32,236, 45, 4,130,146,178,170,170, 78, 19,195,195,229,147,150, 47, 63,223,
+145,162,124, 13, 90,109,102, 56,160,164,105,154, 48,234,245, 43, 31, 29, 62,204, 8, 35,136,143,195, 1,227, 6, 6,131,153,111,
+ 52,214, 56,147, 36,127, 45, 64,133,191,178,147,219,160,215, 59, 80, 28, 14, 89,114,229,138,222,255,157,119,212,181,227,145,207,
+231,227,228,201,147, 96,179,217,117, 47, 22,139, 85,247,222,193,193, 1,196,203,109,164,191,155,248, 53,192, 89, 59,110,139,138,
+138, 32, 18,137, 96,111,111,143,162,162, 34,220,184,113, 3, 79,159, 62, 5,147,201,196,240,225,195, 65, 54,226,219,252, 42,231,
+164,229,203,135,248,248,251,187, 45, 88,176,128,124,245,249,168,213,106, 81, 94, 94,142,177, 99,199,146,103,207,158,149,156,203,
+205, 29, 3,224, 80, 83,156, 1,163, 70,149, 21, 71, 71, 55,248,219, 93,186,116, 33,126,253,245, 87,206,240, 97,195,150,125,176,
+ 97,195,206,175, 15, 30,204, 51,232,245,146,150,180,157, 36, 73,146, 32, 8,184,186,186,162,188,188, 28,213,213, 47, 86,176,133,
+ 66, 33,172,173,173,161,211,233, 96,164,105,230, 95,217,127, 26,211, 34,111, 8,246,212, 19, 92,191,177,108, 81, 47,215, 69,107,
+111, 20, 3,234, 63, 88,140, 70,163, 73, 34,139,201,100, 54,235,115,101,138,149,235, 85,152, 34,180,106,235,202,229,114,127, 99,
+201,170, 21, 88,181,245, 36, 73, 18, 12, 6,163,217,135,248, 75, 49,196,168,170,170,194,177, 99,199,208,191,127,255,186,101,169,
+202,202, 74,200,100, 50, 84, 86, 86, 66,165, 82, 33, 43, 43, 11,151, 46, 93,130,151,151, 23, 96, 98,240,215,140,140,140,123,173,
+ 91,183,238, 90,251, 16, 31, 56,112,160,203,254,253,251, 11, 70,142, 28,233, 68,211, 52,214,172, 89, 83,218,179,103, 79,187,250,
+ 15,249,230,192, 96, 48,112,227,198, 13,120,121,121,129,166,105,176, 88, 44,164,166,166, 66, 44, 22,195,104, 52,130,162, 40,148,
+148,148,192,194,162,233, 24,137, 73, 73, 73,179,231,204,153, 83, 32, 18,137, 58,150,149,149, 21,114, 56,156,126,241,241,241,174,
+ 90,173, 22,150,150,150,176,180,180,196,153, 51,103, 96,101,101,133,247,222,123, 47, 87,169, 84,222, 16, 8, 4, 14, 74,165, 50,
+177,168,168,104, 77, 75,174,183, 94,175,135, 66,161, 64, 69, 69, 5,202,203,203, 33,151,203,161, 82,169,154,173, 99, 67,232,215,
+175, 31, 98, 99, 99, 25,159,125,246,217, 15, 25, 25, 25, 0, 0, 15, 15, 15,188,247,222,123, 12,103,103,103,100,101,101,225,222,
+189,123,208,106,181,160,105,186,201,193, 75, 81,212,192,153, 51,103,246,117,115,115, 35,180, 90, 45,140, 70, 35,212,106, 53,106,
+223,231,230,230,194,199,199,135,116,119,119,239,149,145,145, 49, 16,141,108,172,168, 63, 97,248,179, 17, 26,250,137, 6,111, 32,
+138,115, 79,192,153, 41, 6, 72, 75,208,202, 19, 40, 43,125,189, 40, 46, 82,169,116,195,138, 79,126,125,231,235, 45, 90,135,252,
+ 66,160,157,223, 56,120,251, 6, 97,246, 12, 61, 62,251,252, 24,220,220,219, 33, 39, 39, 7, 3, 7, 14,100, 21, 20, 20,204,169,
+174,174, 94,110, 42,247,197,139,183, 12, 23,206,156, 13,153,244,214,172,174,131, 7,143,212,159, 63,127, 6, 73,137,231,147,231,
+188, 53, 81, 74, 27,171, 9, 27, 43, 94, 66,106,202, 93,239,142,157, 7, 64,163, 55,244, 3,194,182, 0, 97,116,227,227, 29,154,
+211,167, 29,201,211, 39, 34,102, 76,157,254,118,167,160,160,161,186,243, 23,127,198,189,155, 23, 31,110,221, 50,239,234,103,219,
+143, 12, 28, 50,124, 98, 7,123,135, 27,103,252,218,170,231,186,218,138,158,125,191,191, 28,111, 48, 40, 22,151,171, 7, 64, 90,
+185,187,187, 28,191,116, 41,187, 51,147,201,176, 4, 12, 52, 77,183, 3, 96, 71, 82,212,170, 83,115,231, 6,248,188,124,144,234,
+ 1,163, 15, 64, 86, 2, 26, 1,192, 70, 35, 33,115, 40, 46,215,136,151,247, 69,146, 32, 64,211,244,111, 68,214,171, 66,139, 36,
+201,102, 13, 0,245, 57,235, 63,139,106, 39,212,187,119,239, 6,135,195, 1,155,205, 6,147,201,108,214,253,162, 62,103,114, 86,
+214,160, 3,135, 14,113, 26, 18, 89,101,101,101, 40, 43, 43, 67,117,117, 53,166, 76,153,194, 10,191,123,183, 11, 94,186,126, 52,
+198,233,230,232,168, 22,240,120,197,143, 31, 63,118,242,245,245,253, 77,125,229,114, 57,120, 60, 30, 14, 29, 62,204, 10, 30, 53,
+234,221,160, 51,103,182,162,153,248, 87, 13,181,157, 32, 8,136,197, 98, 88, 91, 91,131, 32, 8,232,245,122, 20, 21, 21, 33, 57,
+ 57, 25,119,239,222, 5,131, 32,244,127,101,231,105, 72,139,188,129, 86,173,223, 45, 31,214, 90,180,136,198,172, 47,166, 10, 45,
+ 6,131,241,218, 86,173,198, 96,202,210, 33,159,207,127, 84, 80, 80,208,199,217,217, 25,122,189,190, 78,104,213,183,196,213, 62,
+244,120, 60, 30, 30, 60,120, 0, 62,159,255, 72,165, 82, 53,201, 73,211,116,175,238,221,187, 35, 38, 38, 6, 87,174, 92, 65,102,
+102, 38,106,106,106,160, 86,171,161, 84, 42,145,156,156, 12,163,209, 8, 63, 63, 63, 8, 4, 2,240,249,252, 71,181,150,175,198,
+160, 80, 40, 10,153, 76,102, 59, 30,143, 87,247,153,163,163, 35,202,202,202,140, 58,157, 14, 7, 14, 28,144, 75, 36, 18, 1,143,
+199, 51, 89,184, 18, 4, 1,169, 84, 10, 23, 23,151, 58, 31,173,170,170, 42,136,197,226, 90, 97, 1,181, 90, 13, 11, 11, 11,208,
+ 52,221,220, 53, 82,165,167,167,127, 80,239,255,110,147, 38, 77,250, 49, 42, 42,170, 77, 92, 92, 28,110,223,190, 13,123,123,123,
+108,220,184, 49, 51, 59, 59,123, 42,128,187, 82,233,159,235, 23,105, 74, 31, 42, 43, 43, 59,246,232,209,163, 94,221,187,119,175,
+187, 75, 12, 28, 56,144, 24, 56,112,160, 93,125, 83,127, 73, 73, 9,238,220,185,131,184,184, 56, 16, 4,129,180,180, 52,131, 82,
+169,252,177, 9,106,150,179,179,243,254,213,171, 87, 11,245,122,125, 93,223,230,241,120,224,114,185, 96,177, 88, 96, 48, 24,200,
+206,206,198,216,177, 99, 69,223,124,243, 77,132, 90,173,246, 4,240,187,142,186,108,217,178, 55,210,199, 70,166,132,246, 65,146,
+ 92,228,231,227,144,188,103,247,103,125,230, 47,120,113,143,216,179,251, 51,189,159,143, 56,249, 65, 82,177,168,171, 24,205, 14,
+204,179,113,121,139, 52,186,179,163,207,158,251,101,242,135,203,222, 99,122,120,248, 72,227, 46,223,119, 11,210,127, 74,216,218,
+ 89,162,172, 84,142,236,220, 98,100,228,104,104, 15, 15, 31,233,189, 59,143, 56,159,111,251,202, 91, 81,163, 58,114,249,106,225,
+207,205,208,171,174,221,200, 28,183,117, 7,231,234,172, 57,221,216, 60,158, 19,202, 75, 31,193,205,205, 30, 99,131, 59, 98,223,
+193, 27, 16,137,108,224,224,224, 0,146, 36, 5,166,182,189,180,180,148, 56,246,211,181,119,102,190, 61,175,231,176,161,163,244,
+231,206,159,166,174, 92, 56,117, 35, 98,207,170,227, 52, 67,193, 39,232, 42, 94,171,214,146,196,103,233, 15,166, 14, 26, 60, 5,
+ 60,150,133, 23,208,190,193, 14, 91,183,193,128, 70,110, 76, 84, 24,119,230,219,243,123, 15, 27, 54, 70,127,254,252, 9,156, 63,
+115,240,214,218,181,173,206,100, 62, 63,204,186,121, 55,159, 59, 46,100, 97, 69,236,217, 39,154,137,163, 91, 63,117, 18,116, 86,
+ 2,153,111,172,202, 34, 9, 66, 94, 90, 82, 98,201,100, 50,149, 17,211,166,165, 1,128,142,162,202,170, 24, 12,123,130, 32, 82,
+ 1,164,110, 0,236,192,102, 87, 78,210,235, 13,203,221,220, 88, 84, 97, 33,163,194, 96, 48, 48, 0,246,135,191,207,191, 8, 6,
+ 69, 21,235,213,106, 87,151, 97,195, 24, 53, 57, 57, 76,161,131,131, 30, 0,116, 58, 93,179, 66, 11,141,108, 90,121,149,211,212,
+246,213,212,212,192,216,136, 16,124,149,179, 72, 42,109,245,114, 18, 94, 7,157, 78, 87, 39,178,202,202,202, 32,147,201, 32, 16,
+ 8, 80,162, 86, 59,152,194, 57,180, 71,143, 3,225, 97, 97,203,163,143, 29, 99,213, 23, 89,181, 47, 38,147,137,205, 91,182,176,
+150,124,248,225,194,119, 41,106, 41, 26, 88, 6,109,236,124,214, 78,218, 25, 12, 6, 40,138, 66, 78, 78, 14,114,115,115,145,147,
+147,131,156,156, 28,240,120, 60,208,127,241, 38,160, 55,216, 63, 11,245,150, 10,231,191,106,229,106, 50,188, 67, 75,156,225, 77,
+ 21, 6, 6,131,225, 79, 21, 90, 10,133, 34,238,210,165, 75, 61,198,141, 27, 71,221,186,117, 11, 18,137,164, 78,104,213,254,173,
+ 93,142,226,243,249, 56,126,252,184, 86,161, 80,196, 53, 51,152, 46,157, 57,115,166,107,104,104, 40,115,246,236,217,120,252,248,
+ 49, 22, 44, 88, 0,153, 76, 6,185, 92,142,178,178, 50,212,212,212,160, 71,143, 30,224,114,185, 72, 76, 76,212,213,212,212, 92,
+106,110,233, 76, 42,149, 86,219,219,219, 59,190,250, 93, 72, 72,136,195,183,223,126, 91,147,146,146,162,235,211,167,143,165,169,
+130,163, 22, 63,253,244, 83,157,165,238,233,211,167,248,246,219,111, 65,211, 52,104,154,198,253,251,247,241,197, 23, 95,212,197,
+ 62,107, 33,238,150,150,150,234,117, 58, 29,188,188,188,224,236,236, 12,149, 74,133,175,190,250, 74, 15,224,238,127,171, 55,171,
+ 84,170,232, 89,179,102,125,148,144,144,224, 72, 81,212, 11,147,246,203,246,105,181, 90,164,167,167, 35, 57, 57, 25, 41, 41, 41,
+ 40, 47, 47,175,155, 8, 60,120,240,160, 66,167,211, 29,105,140,215,222,222,126,205,190,125,251, 36,124, 62,255, 55,253,185,214,
+ 26, 90,107, 37, 45, 41, 41,129,149,149, 21,130,130,130,196,151, 46, 93, 90,163, 86,171, 67,241,207, 0, 17, 50,254,105,183, 37,
+139,198, 97, 66, 48, 63, 47, 38,246,249,175, 95,124,254,193, 3,214,187, 21, 0, 0, 32, 0, 73, 68, 65, 84, 75,103,120,113,242,
+132, 96,231,188,135,169, 86, 8, 25,127,162, 27,128,124, 52,237,167,101,188,124,181,240,100,247,238,214, 87, 98, 78,157,138, 88,
+185, 98,217,253,229, 31,204,179,175, 81, 62,227,122,184,179, 9, 0,200,200,209,208,137,143,141,170, 47,182, 46,187,255,217,150,
+111,200,226, 50,217,130, 59,119, 26, 15,111, 80, 95,188,144, 36,184, 30,237,251, 23,120,183,237,219,250,214,141, 67, 16,242,149,
+104,215,190, 27,134, 13,237,133, 43,191, 60, 64, 81,137, 10,133,133,133, 80,171,213, 77,134, 75, 72, 73, 60, 62,131, 38,104, 55,
+130, 38,114, 9,146,230,206,152, 53,183,223,168, 81, 99,232,216,216, 83,250, 19,199, 15, 93, 63, 18,185, 35,154,100, 49, 41,165,
+ 70,164, 33, 8, 85, 37,200,164,199,213,138, 23, 19, 26, 38,135,213,184,249,245,101, 96, 87,223, 14,237, 37, 51,102, 45, 16,141,
+ 28, 49,150, 62,115,230,132,241, 72,212,129, 43, 71,246,250, 31, 50,146,114, 86, 97, 94, 13,167, 82,174,171,164, 9,182, 85,181,
+220, 88, 83,156,225,169,114, 26, 21,162, 5,162,223,216, 14, 68, 27,141, 57,180, 70,211, 26, 76,102, 30,173,215, 75,160,211,149,
+135,171, 84,207, 63,101,179, 91,253, 31,123,215, 29,223, 84,245,190,159,155,221, 38,221,139, 14, 90, 70,129,210,197,178,128,178,
+ 87, 89, 45,162, 40,136,162, 56, 25,138,162, 44, 65, 16, 16, 80,134,130,128,130, 44, 21,144,189,161, 32, 80,164,165,140,130,108,
+232,166,133,206,164, 77,186,146, 54,251,142,243,251,131,182, 22,236, 72, 10,250, 83,191,121, 62,159,124,114,115,115,239,147,115,
+206, 61, 57,247,185,239,121,207,251, 46, 16, 8,158, 1, 69,113,102,138,210,194,100,202, 2, 0,183,220, 92, 31,147,147, 83, 33,
+223, 96,104, 3,150,173, 51, 0,178,217,104,204,175,204,203,243,113,235,219, 87,114,111,225, 66,105,179,238,221, 13, 84,149, 15,
+113, 67, 66,139,207,231, 3, 60, 30,103, 9,167,165,245,211,235,245,224,234, 9,173,210, 24, 39,195, 48,143,136,172,106,161, 85,
+253,127,177,132,115,211,130, 5,151, 3,134, 12, 41,141,143,143,111,214,175, 95, 63,170,162,162, 2, 21, 21, 21,143,136, 45, 95,
+ 95, 95, 42, 52, 60, 92,186, 59, 46, 46,208,210,246,180, 72, 68,243,120,127,185,208,250,151,163,222, 68,210,130, 70,166,208, 44,
+ 22, 90, 22, 90,180,104,154,166,225,229,229,133,226,226,226,122,111,252, 60, 30, 15,246,246,246,213,115,196, 13,174,188, 51, 26,
+141,171,103,204,152, 49,101,216,176, 97, 30,237,219,183,135, 74,165, 66,179,102,205, 96,103,103, 87,227, 59, 86,205,119,253,250,
+117,252,244,211, 79, 26,163,209,184,186, 17,206,111, 87,172, 88,241,193,168, 81,163,220,188,189,189,225,234,234,138,219,183,111,
+195,213,213, 21, 26,141, 6,105,105,105,112,116,116,172,241,219, 57,122,244,104,133,209,104,252,182, 17,241, 70, 18, 18, 18,204,
+142,142,142,183, 85, 42, 21,191,180,180, 84, 80, 86, 86, 38,208,104, 52, 66,181, 90, 45, 60,121,242,164,135,179,179,179,238,236,
+217,179,170,128,128, 0,254,253,251,247,249, 52, 77, 55,170, 94, 41,138,194,212,169, 83, 33, 18,137, 96, 52, 26,177,122,245,106,
+204,152, 49,163,198, 39,107,197,138, 21,152, 59,119,110,141,112,222,188,121,179,117, 3, 39, 33, 48,155,205,160,105,218,226, 5,
+ 10, 79,244, 68,108,153, 96, 47,204,200,200,136,238,214,173,219,233,125,251,246,185, 87,197, 36, 67, 81, 81, 17,138,138,138,160,
+ 82,169, 80, 89, 89, 9,134, 97,224,231,231,135,162,162, 34, 28, 62,124, 88, 93, 81, 81, 49, 4, 13,172, 56,228,243,249,227,123,
+247,238, 45,120,188, 12,213, 79,121,213,226, 93, 34,145, 64, 46,151,163,127,255,254,226,248,248,248,241, 0,254,213, 66,171,118,
+120,135,193, 67,222, 17,133,132,245, 48,221, 74,138,201, 11,110, 85,148, 55,110,164,211,113, 0,184,121,183,200,249, 86,154, 11,
+ 66,194,162,201,224, 33,174, 17, 69,133,155, 58, 0, 48, 55,148,174, 7, 0,156,165,146,209,145,131,186,203, 29,101, 50,222, 55,
+ 43, 55,255,250,195, 15,223, 62,179,255,248, 31,225, 29,190, 89,249, 48,188, 67,228,160,238, 92,106, 74,234,104, 0, 91, 44, 21,
+ 47,209,209, 35,110,252,180,245, 39,164, 38,157,245,253,116,106, 71,113,105, 17, 13,123, 7,127, 68,116,110,134, 77, 91,239,224,
+214,173, 91,133, 38,147,169,127,131,253,155, 34, 1, 73,201,119,131, 58,132,133,122,191, 62,126,130, 83,116,244, 72,196,196, 28,
+193, 47,219,182, 36,188, 52,118,212,143, 5,101, 26,190,151, 80, 42,146, 18, 78,204, 23, 57, 11, 68, 18,123,165,201,244, 48, 2,
+129, 80,104,231, 4,140,110,240,198, 51,105,194, 56,231, 1,131, 70,226,248,137, 35,248,101,219,166,115,159,135,189,188,165, 85,
+151, 16,170,251, 51, 95, 79,110,213,186, 85, 11,109,101,145,134, 71,137,205, 6, 3,231,248,245,182,236, 85, 89,115,199,103, 1,
+ 88,137,127,233,170, 67, 49,203,222, 50,154,205,227,252, 35, 34,174,202,175, 94,237,240, 21, 77,187,125, 6,148,126,110, 50,101,
+239, 3,242,202, 1,222,196,170, 49,125, 37, 96,167, 23, 8,124,156,121,188,155, 21, 44, 59, 12,124,126, 18,234,126, 16,191,253,
+203,240,225,221, 62,202,204, 20,121,246,234,101, 47,143,139,147, 86,101, 34,105, 80,104, 9, 4, 2,144,250,167,186, 30,225,164,
+182,111,231, 1, 15,167,252,235, 27,227, 68, 34, 17,116, 58, 29,104,212,107,209,125,132,211,231,212,169,188,204,204,204,118,110,
+110,110,143,136,172,210,210,210,154,109,131,193, 0,157, 78, 7,123,123,251, 36,125,221, 51, 34,143,112, 22, 37, 36, 24,150, 77,
+157, 58,255,213,177, 99,215,158,249,237, 55, 59,119,119,119,168,213,234, 71,132,150,201,100,194,128,129, 3, 69, 43,110,220,120,
+ 29, 26,205, 2, 75,218,179, 89,255,254,141,250, 3,243,249,124,112,127,241,212,225,127, 0, 19,234, 18, 94,188,198,166,112, 44,
+ 93,117, 88,207, 13,242,241,213,125,115, 35, 34, 34, 12,233,233,233, 8, 8, 8,168, 17, 43,181,127,211,201,201, 9, 46, 46, 46,
+184,126,253, 58,190,252,242, 75, 61,128,185,141,112, 86,232,116,186, 87, 34, 35, 35,245, 2,129, 0,193,193,193, 53,241,179, 56,
+142,131, 88, 44,134, 76, 38,195,141, 27, 55, 48, 98,196, 8,157, 78,167,123, 5,127,142,161,245, 56,167, 90,167,211,189, 54,120,
+240, 96, 93,114,114, 50,122,247,238,141, 91,183,110,161,178,178, 18,149,149,149,120,240,224, 1, 66, 67, 67,161,211,233,176,126,
+253,122,189, 78,167,123, 13,128,186, 33,206,138,138,138, 17, 51,102,204,224,239,218,181,171,149,159,159, 95, 88,215,174, 93,219,
+ 15, 28, 56,176,205,139, 47,190,216, 98,248,240,225, 62,237,218,181, 51, 12, 25, 50,196,115,216,176, 97,158, 58,157, 78,120,241,
+226, 69, 5, 77,211,195, 26, 41,103,141, 56, 73, 79, 79,175,153, 42, 20, 8, 4, 40, 46, 46,174,137,220, 95, 61, 40,213, 35,132,
+ 7, 53, 38,182,171, 5, 86,181,224,178,192,207,173, 46,206, 70, 79, 18,139,197,213, 22, 79, 98, 1,231,205,148,148,148,200,190,
+125,251,222,124,231,157,119, 42, 10, 11, 11,225,232,232,136,192,192, 64, 4, 5, 5,193,195,195, 3,102,179, 25,135, 14, 29,210,
+ 30, 62,124,248,142, 90,173,238,143, 63,199,208, 26,244, 88, 59, 62,168,107,144,173,182,102, 85, 11, 45, 59, 59, 59,248,249,249,
+ 85,183,237, 3,107,218,179,137,248,107, 57,171, 4,204,192, 1, 67, 90, 15,143,122,193,249,208,145, 75,226,181,235, 14,223,137,
+ 24,132,205,238, 45, 53, 71,221, 91,106,142, 70, 12,194,230,181,235, 14,223, 57,116,228,146,120,120,212, 11,206, 3, 7, 12,105,
+157,156,148,218,190,118,222,195,186,202,105,103,103,215,163,119,175,136,178,248, 11,231,184,165, 43,190,231, 13,232,255,210,141,
+ 45, 63, 30, 58,180,229,199, 67,135, 6,244,127,233,198,210, 21,223,243,226, 47,156,227,122,247,138, 40,179,179,179,235, 97, 73,
+221, 39, 77, 24,231, 28, 53,124, 36, 98, 98, 14, 49,251,119,175, 95,177,231, 64, 70,223,119,167, 36, 20,165,167,223, 34,202,252,
+ 83, 16,242,114,144,146,146,162,174, 18, 89,233,150,112, 78,124,111, 92,109,145,117,222,221,187,247,230,148, 20,176,177,177,199,
+232,223,126,187,161, 63,127, 83,169,190,150, 92, 92, 42, 87,149,222,215,104, 74, 76, 28,199,130,101, 89,254, 23, 95,212, 56,236,
+214,121,141,122,246,236,135,179,103,118, 98,219,214,141,106,142,131, 97,244,254,253,236,232,209, 11, 73,139,150, 45, 91,236,216,
+189,147,138,126,254, 5,103, 2,112, 35, 70,141,116,217,181,103, 23,213,186,109,235,150,129,129, 53, 33,109,254,117,125,233, 83,
+160,146, 2, 82, 20,191,255,222,213,161,119,239,219,140, 80, 24,180, 72, 36,106,179, 6, 16,143, 6,216,137, 0,189, 0,224, 45,
+ 0,252,244, 2, 65, 39,123,134,185, 85,161,211, 53, 7,128,197,132,220,175,139,115, 33, 80,166,201,201, 57,119,253,251,239,141,
+205, 94,121,197, 77,220,172,153, 19, 88,150,170, 30,223,235,123, 9, 4,130,199, 45, 48,245,114,250,121,120, 20, 28, 61,122, 20,
+ 65, 65, 65,240,243,243, 67,109, 31,217,234,128,220,238,238,238, 56,112,224, 0,200,163,193,169,235,229,236,210,170,213,245,229,
+203,150,153, 56,142, 67, 89, 89,217,159,172, 89,101,101,101,224, 56, 14, 39,142, 31, 55,105, 30,102, 2,177,168,238,253,249,252,
+202, 87,251,244, 89, 26, 21, 21,101,206,204,204,172, 89,121, 93,109,217, 82, 42,149,112,112,112,128,193,104,244, 7, 32,181,132,
+ 83,121,242,164, 12,141,140,235,117, 88,180,254,138,190,244,111, 23, 89,181, 19, 74, 79,176,200,162,197, 48, 12,252,253,253, 31,
+ 73,233,194,227,241, 30,121, 89,185,226,112,123,114,114,242,169, 33, 67,134,204,127,246,217,103, 39,205,159, 63,159,223,190,125,
+123,168,213,106,184,186,186,194,203,203, 11,105,105,105, 56,122,244, 40, 91, 92, 92,188, 1,192, 34,212, 17,192,174, 14,196,101,
+100,100, 68,119,236,216,113,207,236,217,179,157, 7, 15, 30, 44,244,247,247, 7, 33, 4, 55,110,220,192,193,131, 7,205, 91,182,
+108,209, 84,137,172, 56, 11,203,122, 90, 46,151,191, 52,108,216,176, 29,227,199,143,119,100, 89, 86,248,224,193, 3, 24,141, 70,
+208, 52,141,220,220, 92,115, 76, 76, 76,165, 78,167, 27, 7,224,180, 5,124,215,203,203,203, 67, 99, 99, 99,199, 95,188,120,241,
+203,119,222,121,199,125,224,192,129, 34,134, 97,112,225,194, 5, 85,151, 46, 93,188,148, 74,165,249,192,129, 3, 37, 6,131, 97,
+ 46,203,178, 22,165,224,161, 40, 10, 26,141, 6, 30, 30, 30, 48, 26,141,224, 56, 14, 38,147, 9, 14, 14, 14, 53,105,147, 8, 33,
+176,198,185,254,177, 62,192, 55,155,205, 24, 59,118, 44, 56,142,195,234,213,171,193, 48,140,213,100,206,206,206,215,110,222,188,
+ 25,221,185,115,231, 26,241, 82,221,135, 36, 18, 9, 60, 60, 60,224,238,238,142,152,152, 24, 8,133,194,107,141,249,187, 85,225,
+ 86,113,113,113,151,216,216,216, 30,119,238,220,121, 3, 64,103,179,217,236,199,178, 44,197,227,241, 20,132,144,219, 26,141,230,
+ 71, 88,152,130, 71,169, 84,126,249,230,155,111,118,217,185,115,167,131, 64,240,199, 95, 67, 32, 16, 64, 34,145,160, 58, 56, 38,
+ 33, 4, 38,147, 9,243,230,205,211,104,181,218, 47,255, 43,163, 68, 68,215,238,216,180,126,141,195,111,103, 79,169, 82, 50,112,
+208,213, 53,229,241,254,151, 95, 84,184,169,131, 60, 47,207, 33,162,107,119,139, 56,105,147,185,228,181,113,211, 2,170, 82,240,
+204,123,240, 32,123,227,142,237,171,178, 0,224,235,111, 87,183, 43, 42, 41,159,152,146,156, 58,122,195,134,221, 61, 24,179,185,
+196, 18,206, 63,196,203, 14, 53, 8, 12, 0,174,220,184, 83,212,106,196, 43, 39,231,182,109,237,244,188,178, 68, 95, 80, 89,169,
+251, 16, 64,150,165,117,239,213,179, 47,206,158,222,133, 95,182,237,208, 16,142,111,240,240,240, 32, 0,144,146,226, 65, 82, 82,
+202,201, 31,126,197, 46, 90, 33,185,181,104,218,135, 3,167,169, 53,165,223,174, 94,223,240, 84, 74,199, 78,207,162, 99,167,103,
+ 49,229,195,207,156, 67,195,130, 3, 0, 96,255,126,176, 97,109,147,143,205,255,124,225,243,139, 22, 45,132,166,194,136,234,116,
+ 61,105,119,147,143,103,101,193,244,111,238, 71,243, 25,230,194, 34, 66, 94,212, 37, 36,116,232, 49,115,230,239,231,191,249,166,
+149,154,207,239,249, 5,192,241, 40,138, 5, 33,246, 60, 30, 79, 33,163,233, 27, 21, 98,177, 15,197,113,207, 56,178,236, 33,186,
+129,252,159,243, 25,230, 10,166, 77,107,167, 43, 45,245,236,245,233,167, 30,130,153, 51,121, 13, 57,195,215,254,255, 90,194,121,
+245,246,237,227, 19,223,125,183, 96,193,252,249, 67, 54,108,220,104,223,161, 67, 7, 20, 22, 22, 34, 56, 56, 24,126,126,126,136,
+141,141,197,129,189,123,181,229, 21, 21,115, 1,252, 96, 9,231,246, 19, 39,210,218,135,133, 21,111,220,184,209, 55, 42, 42,138,
+210,106,181, 80,171,213, 80,171,213, 48, 26,141,168, 10, 8, 77,210, 51, 50, 82,104,154,222, 96,105,221, 89,149,202,110, 81,247,
+238,249, 34,142, 91,254,210,168, 81, 51, 22, 45, 94, 44,105,221,186, 53,101, 52, 26,107,172, 90,102,179, 25, 14, 14, 14,102,147,
+201,228,142, 58,252,222,234,226,148,108,217,194,168, 84, 42,120,122,122,214,132,107,170, 29,151,176,162,162, 2,132,144,255,108,
+ 2,244,191, 18,245, 42, 36, 87, 87,215,107, 2,129,160,121,109,235, 86, 93,185,243,106,239,163,105, 58,191,184,184, 56,226, 49,
+197, 91,159, 63, 84, 32,128,175, 6, 12, 24,240,210,244,233,211,169,248,248,120, 28, 62,124,152,100,101,101,237,175,178, 98,101,
+ 53,240,244, 84, 31,167,163, 68, 34,249, 88, 38,147, 13,170, 14,225, 32,149, 74,239,104,181,218, 51, 85,211,133, 21, 77,224,116,
+146, 72, 36, 83,101, 50, 89,100, 85,250, 21, 56, 58, 58,222,212,106,181,177, 70,163,113, 13,234, 79, 84,221, 16,167,189,179,179,
+243,151, 30, 30, 30,175,205,156, 57,211, 61, 33, 33, 65,113,246,236, 89, 81,121,121,249, 78,147,201,212, 80, 82,233, 63,113,186,
+185,185, 93,227,243,249,205,255,162,107,132,142, 29, 59,198,140, 24, 49, 34,106,220,184,113,160,105, 26, 63,252,240, 3, 98, 99,
+ 99,143,223,187,119, 47,186,145, 39,220,199, 57, 61,154, 55,111, 30, 63,105,210,164, 22, 99,199,142,149,186,186,186, 66, 32, 16,
+ 64,171,213,226,222,189,123,184,113,227, 6, 57,114,228, 72,229,245,235,215,243,117, 58, 93, 63, 0,197, 86,180,231,147, 60,137,
+ 63,194, 41, 16, 8,250,250,251,251,239, 94,176, 96,129, 99,100,100,164,189,187,187, 59,248,124, 62,104,154,134, 66,161,192,221,
+187,119,113,234,212, 41,237,254,253,251,181, 37, 37, 37, 99, 1,156,251,255, 40,231,211,228, 12,105,135,207, 31, 75, 20, 93,111,
+180,247, 70,142,109,180,156, 3,250,250,140, 28,253,210,176,161,132, 16,236, 59,112,242,100, 92, 66,163, 73,165,235, 45,103, 99,
+101,181,132, 51,184, 45,111, 65, 82,242,221, 71, 2, 90,134,133,134,167,135,116, 24,181,196, 18,162, 90,145,225, 31,169,123,173,
+233,216,218, 54,221, 71,166, 89, 67, 2, 17, 61,114,244,139, 81,159,205,157,131,175,190, 92,138, 35,251, 14, 29, 79,201,122, 36,
+ 77,208,191,174, 47,213,190,183,124,193,231, 15,224,241,120,254,148, 88,252, 59,173,213,102, 56, 2,194, 10,128,255, 5,160, 93,
+ 36, 18,181, 1,203,134,129, 16, 65, 5, 69,197,124,195,178,174, 0,228,141,113, 46, 17, 8,158,149,250,248,244, 89,205,113,115,
+110,221,189,235, 80,251,129,173,218,242, 92,251,161,210,215,215, 87,169, 80, 40,154, 89,194, 25,253,221,119,102,157, 76, 38,153,
+179,124,121,223, 74,131,161,239,162, 69,139, 4, 87,175, 94,197,250,239,191,103, 12,249,249, 59, 84,192,212,122,102, 67,234,229,
+108, 49,117,170,221,172,245,235,223, 10,108,219,214,235,141, 55,222, 16, 10,133, 66,104,181, 90,228,229,229,225,244,169, 83,166,
+228,148,148,100,141, 70,243,188, 53,117,143,254,238, 59,179, 75, 96, 32,164,158,158,228,183,184, 56,231,137, 31,127, 60,169,101,
+171, 86,206, 67,134, 14, 21, 58, 57, 57,161,172,172, 12, 15, 30, 60,192,161, 67,135,148,149,149,149,190, 0, 88, 75, 56,119, 92,
+188,216,241,196,185,115, 47, 47, 89,178, 68, 28, 30, 30, 14,103,103,103, 84, 84, 84,224,238,221,187, 56,119,238,156,113,195,134,
+ 13,106,181, 90, 61,137,101,217,163,127, 97, 95,250, 79, 78, 29,254,213, 30,254,150, 92,136, 8, 0,159, 87,109, 47, 70,227, 57,
+ 3,255,205,131,207,227, 8,112,115,115,219,100, 48, 24,136, 94,175,159, 8, 32,247, 31, 88, 78, 65, 68, 68,196,122,165, 82,217,
+131, 16, 2,103,103,231, 75, 73, 73, 73,239,163,158,149, 55,141,112,242, 1,244,112,112,112,232,238,232,232,216,215,104, 52,134,
+ 84, 77,191,165,104,181,218,115,102,179,249, 74,149,245,137,253,127,174, 59, 31, 64,164,175,175,239,187, 28,199,181,165, 40,202,
+133,101, 89,208, 52, 93,206,113,220, 61,181, 90,189, 5, 64,236, 63,160,156, 79,133, 51,180, 13, 94, 36, 60,132,212, 39, 8, 30,
+ 17, 90,143, 9, 8,138, 67, 74,114, 38, 14, 89, 81, 78,222,208, 65,254,235, 56, 22, 56, 29,151,247, 1, 26,119,174,253, 67,104,
+ 89, 32, 94,172, 22,153,109,248,111, 18,138, 60,194, 73, 17, 42, 55,184,227,139,191, 60,137,208,178, 20,161, 65,232, 11,130, 30,
+ 28,193,149,212,123, 56,251, 95, 27,235, 22, 0,205,120, 60, 94, 55,138,199,107, 67, 0, 45, 69, 81, 12, 8,113, 3, 33,153,224,
+243,147,230,155,205,153,168, 59,129,121,189,156, 95, 1,110,223,187,186, 94,226, 9, 4,222, 0,120, 85,214, 23,142,163, 40,150,
+ 80, 20, 83,123,122,235,177, 7,203, 6, 57,205, 64, 7,161, 68,226,207, 50, 76,179, 66,192,225, 4,203, 62, 99, 32,164,178, 57,
+240,249, 77, 32,205,218,186, 87,115,242, 37,146,128, 19,132,140, 84,201,100, 29,149,122,189, 39, 0,226, 32,147,165,104,180,218,
+109, 6,131, 97,157,181,117, 55, 3, 29, 68, 18, 73,115,150, 97,154, 1, 0, 79, 32, 80,238, 49, 26,253,243,157,156,222, 48, 24,
+141, 45, 28, 28, 28,104,147,201,164, 49, 24, 12,227, 24,134,249,205,154,186,223, 99,152,208,139, 60, 94,111,179, 76,230,110,166,
+ 40,153,137, 97,204, 38,179, 57,207, 96, 48,220, 1,176, 10, 64,230, 95,220,151,108,104,226, 31,208,198,105,227,180,113,218, 56,
+109,156,255,227,156,203, 0,167,175, 0, 55, 91,123,254,165,156, 82, 0, 1, 85, 15,139,255,198,186,255, 39,173, 91, 2, 91, 91,
+216, 96,131, 13, 54,216,240, 87, 99,118,253,110, 22, 54, 60, 61,232, 80,135, 79,150, 13,255,191,160, 26, 80,165,214,152, 4,155,
+162,108,207,216, 56,109,156, 54, 78, 27,167,141,211,198,105,227,252,159,227,108,140,251,223, 56, 37, 57,161,142,125,155,254,142,
+ 31,182,153,127,109,156, 54, 78, 27,103,157, 24, 49, 98, 4,207,214,158, 54, 78, 27,167,141,243,191, 14,158,173, 9,234, 69,179,
+170,215,211, 62,214,134,255,118, 95,248, 59,224, 87,245,178,230,120,159,127, 90,163, 30, 59,118,140, 3,128, 59, 41,119, 37, 21,
+ 21, 21,182,177,200, 6, 27,108,176, 9,173,191,249,166,245, 36, 55,183, 39,189, 49, 46,165, 40,200, 41, 10,114, 0, 75,159,226,
+177,141,193,215,195,195,227,163,208,208,208, 29,205,154, 53,155, 2,192,203,202,243,219, 73,165,210, 53, 50,153, 44, 94, 38,147,
+197, 75,165,210, 53, 0,218, 61,165,235, 70, 1,152, 40,145, 72,226,124,124,124, 10,196, 98,113, 28,128, 73,104,250,202,213,246,
+120, 24, 39,109, 49,128,142,214,156,232, 21, 54,114,175,103,216,200,219,158, 97, 35,239,186,135,143,104,231, 25, 54,242,174,103,
+216,200,219, 94, 97, 35,247,254, 5,253,245,105, 94,223,167, 85,158, 92,138, 66,174,133,229, 89, 69, 1,121, 20,133,252,127, 72,
+249,255,132, 14, 33,225,198,209, 99,198,216,219,134, 99, 27,108,176,225,127, 30,190,190,190, 47,249,248,248,156,241,241,241,137,
+245,245,245,125,201,130, 83, 6,213,113,147, 96, 41, 10,108, 35,131,126, 67,199, 53,102,174,172,125,238, 55, 22, 86,173, 54,103,
+ 51,138, 2, 75,170, 64, 81,224,188,188,188,214,250,248,248, 44,125,252,229,229,229,181,150,162,192,213, 58,150,173, 37,240,172,
+ 53,171, 54,123,253,245,215,247,149,149,149,197,152, 76,166,152,140,140,140,152,126,253,250,237,121,204, 18, 81, 47,167,157,157,
+221,171,221,186,247,184,126,238,194,149,140,244,123,217,242,228,180,251,217,199, 78,254,118, 53,188, 67,199,223,237,236,236, 94,
+181,226, 26, 81, 0, 38, 10, 4,130, 56, 7, 7,135,124,129, 64, 16, 7, 96, 50,159,207, 63,186,108,217,178,236,164,164,164,162,
+139, 23, 47,150,159, 59,119,174,224,157,119,222,185, 71, 81,212,177, 58, 4,251, 32, 11, 44, 48,243,115,114,114, 78, 42, 20,138,
+ 83,246,246,246, 95, 90,112,124, 13,167,103,216,200,219, 74,181,153, 40,213,102,226, 25, 54,146,212,218,190,109,101,155, 55,118,
+141,254,212, 23, 36, 18, 73, 64, 35,130,254,175, 52,209,255,169, 60, 0,188,171,190,139, 0,240, 93,213,171,122, 57,187,183,157,
+ 68,242,180,250,231,211,104, 79, 27,167,141,211,198,105,227,252,175,162, 75,213,187, 15, 30,250,107,213,220,187,173, 93,117,248,
+ 65, 70, 70,134, 3, 0, 4, 5, 5,189, 15,224,128, 53, 66,130,162, 48,139,227, 8, 15, 0,120, 60,234,211,254,253, 7,116,177,
+183,183,127, 36, 10,178, 94,175, 23,199,197,157, 29,200,113,132,170, 58,110, 22, 33, 88, 3,160,200,210,223, 48,153,140, 60,161,
+ 80, 12, 30,143,154, 22, 30,222,161,101,113,113,113, 2,143,199,219, 81, 80, 80, 80,102,181, 25,135,162,176,121,243,230, 32, 31,
+ 31,159, 63, 69,107, 86, 40, 20,226,145, 35,159,183,138,239, 77, 64, 98,148, 72,186,139, 40,202,135,101, 24, 23, 0, 16, 8, 4,
+101, 87,197,226,136,175,150, 44,145, 82, 20,197,149,148,148, 64,175,215,227,147, 79, 62,177, 79, 78, 78,126,161,184,184,120, 93,
+ 35,180, 65, 29, 59,117,249,228,212,169,147, 33,154,210, 50,195,230,111, 55, 94,215, 11, 68,186, 86,161,193,162,245,155,182,185,
+ 78,120,107,220,135,169,169, 73, 55, 81,119, 58,146,218,224, 1, 56,244,241,199, 31,135, 69, 71, 71,139, 43, 42, 42,236,244,122,
+125,203, 29, 59,118,204,139,136,136,112,232,220,185,179,120,247,238,221,148, 90,173, 6, 33, 68, 26, 28, 28, 76,198,140, 25, 99,
+216,179,103,207, 20, 0,107, 27, 16,190,179, 30,182, 37,111,117,251,246,237, 23, 0, 64, 70, 70,134,168, 86, 27, 11, 67, 66, 66,
+100, 0,144,150,150,246, 5, 33,220,199, 0, 64, 8, 86, 0,152, 83,135,105, 45, 35,172,215,104,128, 66,219,164, 11,251,236,194,
+122,143, 54,128,224, 30, 5,100, 84, 61, 16, 44, 2,106,197,133,122, 20, 41,114,185,188, 73,185, 9,163,162,162, 41,138,162,246,
+ 95,191,126,253,128, 82,169,108,197,113,236,123, 13,149,179,190,107,229,233,233,121,138,101, 89, 99,105,105,105, 77,160, 76,207,
+142, 47,246,112,119,148, 13, 84,149, 85, 36,148, 36, 31, 57,103, 97,223,164,220,221,221,223, 44, 46, 46, 94, 10,224,221,148,148,
+148, 46, 0, 16, 18, 18, 34, 2,112,205,201,201,169,167,217,100,162,108,227,159, 13, 54,216, 96,195,223, 34,180,110, 0,136,194,
+ 31, 41,120, 54, 53, 69,104,137, 1, 32, 33, 33, 1, 0, 36, 77, 40, 8, 85, 91,192, 76,157, 58, 21, 62, 62, 62,143,139, 23,196,
+199,199, 61, 73,101, 31,249,141,197,139, 23, 59,148,151,151, 15,250,241,199, 31,251, 16, 66,190,145,203,229,151, 27, 57,191,136,
+ 16,172,224,241,168, 79, 41,138,130, 68, 98,151, 62,105,210,164, 27, 85,223,181, 60,118,236,152,116,196,136, 17, 58, 0,217, 0,
+ 32,145,216,249,241,249,188, 32, 66, 72,245, 13,183, 94, 65,248, 50, 16,200,136,197, 3, 38,126,247, 29,243,204,136, 17, 2,153,
+167, 39, 5, 0,217,169,169,238, 43,190,254,186,103, 89, 86,150, 88,239,238, 94, 82,162,213,234,211,211,211, 33,145, 72, 40, 62,
+159,255, 76, 99, 21,150,201,100, 31, 45,249,106,185, 76, 83, 90,174, 55,104, 42, 76,124,134, 54, 58,218, 75,217,162, 66,101,137,
+131,189, 76,247,233,231, 11,197, 31,188, 55,254, 35,173, 86,251,126, 35, 84, 83,166, 77,155, 22,210,173, 91, 55,191,189,123,247,
+ 82,106,181, 26, 2,129,192,161,115,231,206,136,136,136, 96,207,158, 61, 75,181,106,213, 10,225,225,225,184,112,225, 2, 46, 93,
+186, 68,117,233,210, 69,122,240,224,193,215,105,154, 94,219,152,184,230,243,121,159, 4, 7, 7,119,150,201,100,166,160,160, 32,
+188,247,222,123, 32,132, 96,208,160, 65,225, 14, 14, 14, 7,180, 90,173, 56, 45, 45,181, 79, 99, 34, 91,153,116,100, 76,181,101,
+ 11, 64, 7, 16,220, 83, 37, 29,169, 61,253, 24,146,150,150,246,108, 89, 89, 25, 30, 94, 23, 82,147,192,188, 79,159, 62,214,244,
+165, 34, 66,176, 98,196,136,232, 79, 1,138, 26, 52,104, 80,249,148, 41, 83,120,169,169,169,175,189,248,226, 11,225, 25, 25,247,
+ 96,229,195, 64,208,224,193,131, 47,156, 56,113,194, 61, 40, 40, 72, 85, 90, 90, 90,243,133,183,187,203,144,115, 7, 87,127,244,
+229,154, 29,193,219, 9, 85,174, 74, 57,124,167,145,190, 73,189,249,230, 91, 69, 14, 14, 14,163,246,239,223,159,166, 80, 40, 4,
+ 34, 81,141,118,229,123,121,121,121, 6, 5, 5, 77,118,115,115, 83,242,121, 60, 47, 2, 66, 26,235,159,255,223,200, 72, 79, 21,
+182, 11, 10,166,109,227,181, 13, 54,216,240, 47,196,241, 42,113,117,252,241, 47, 4, 0, 16, 19, 19, 83, 19,153, 54, 58, 58,186,
+222, 39, 96, 66, 72,209,173, 91,183,252,117, 58, 29, 8, 33,150, 12,216,181,151,104, 22, 81, 20,111, 61,143, 71,189, 79, 81, 20,
+194,195, 59,220, 95,189,122,117, 93, 57,189, 76,225,225, 29,238,243,249,188,214,132, 16, 80, 20,239, 7, 66,184,162,122, 56,235,
+188, 17,137,197,146, 89, 0,224,237,237,147,245,235,175,191,154, 94,126,249,101,124,253,245,215,162,217,179,103,207, 16, 8, 4,
+ 83,114,115,115, 11, 27, 40, 39, 0,204,241,244,244,146,110,222,188, 57,104,210,164, 73, 55, 20, 10,197, 28, 0,240,241,241, 89,
+ 10, 32, 20, 64,118,173,125,216,176, 97, 79,193,123,239,189,151,174, 84, 42,231,212,199, 57, 10,104,227, 31, 28, 60, 96, 81, 66,
+ 2,225, 25,141, 84,241,249,243, 26, 85, 81, 17,157,169, 82, 73,183, 94,187, 22, 61,111,233, 82,161,127, 64, 0,226,143, 30,245,
+ 40,214,233, 84,106,163,209, 80, 84, 84, 68, 24,134,185,100, 65,221,195,188, 60,189,164, 27, 87,253,112,213, 81,200,231,188,154,
+251, 81, 66, 55, 55, 1, 79,234, 36,230, 11,120,198,214, 45,219,137, 1,132, 53,118,141, 68, 34,209,235,131, 7, 15,150,238,217,
+179,135, 10, 15, 15,135,139,139, 11,206,159, 63,143,155, 55,111,162,172,172,140, 71,211, 52,186,118,237,138,229,203,151, 35, 32,
+ 32, 0,229,229,229,200,205,205,245, 16,139,197,158, 52, 77,215,215,158,143,244,167, 89,179,102,193,199,199, 7, 12,195,160,180,
+180, 20, 12,195,192,193,193, 1, 0,144,159,159,143,163, 71,143, 88,210,151, 26, 5, 33, 4,207, 61,247, 92, 5, 69, 81, 41,143,
+ 91,180,172,225,244,243,243,219,173, 82, 21, 15, 27, 48, 96, 0,202,202,202,232,133, 11, 23,162, 99,199,142, 8, 10, 10,106,180,
+156,190,190,190, 19, 25,134,153, 15, 0,102,179,121,171,157,157,221,219,191,252,242,139,123,237, 20, 33,213,150,172, 34,101, 73,
+217,165,171, 73,105,211, 38,190,220, 47,225,242,221, 60,179,112,100,174,250,246, 17,117, 29,229,156, 35, 18,137,127,108,209,162,
+197,170,169, 83,167,250,184,185,185,193,104, 52,206, 43, 44, 44,196,228,201,147, 1, 0,195,135, 15,239, 40, 20, 10,127,125,231,
+157,119,208,170, 85,171,130,210,210,210,220,235,215,175,191,167,211,233,238, 54,181, 61, 45,196, 19,113,214, 35,178,254,113,229,
+180,113,218, 56,109,156,127, 13,167,165, 90,228, 31, 10, 5, 30, 13,231,176,233, 17,161, 21, 29, 29, 77,197,196,196, 16, 11, 42,
+ 86,210,188,121,115,127,123,123,123, 0, 40,177,182, 20, 28,199, 77,113,119,119, 87,206,153, 51,167, 87, 80, 80,144,105,202,148,
+ 41,119,179,179,179,231,214, 62,166,101,203,150, 95,126,255,253,247, 72, 79, 79,207, 94,186,116,233,133,146,146, 18,107,243,152,
+205, 38, 4,171,171,172, 99,197, 71,143, 30,237,152,144,144,240,254,183,223,126,235,249,193, 7, 31,136, 62,250,232,163,113, 0,
+190,110,140,132,207,231,235,234,154, 46,172, 11, 62, 62, 62, 38, 62,159, 95,111,144,184,104,192,222, 78, 44,238,191, 40, 33,129,
+152,178,179,117, 63,173, 92,233,184,241,247,223, 23,208,132, 52,243,242,242, 66,239,158, 61, 43,237,248,252, 98,101, 97, 33,231,
+213,166, 13,255,193,175,191,122,232,197, 98,249,158, 61,123,212, 37, 37, 37,135, 27, 53,225, 81,148,134, 35,196,228,208, 60,128,
+126,249,133,200,240,171, 87,110,166, 58,122,121,240,186,116, 14,239,152,154,158,125, 29, 28,103,166, 40,170,209, 96,129,206,206,
+206, 65, 37, 37, 37,208,104, 52,240,244,244,196,234,213,171,225,237,237, 13,157, 78,135,164,164, 36,210,188,121,115, 42, 33, 33,
+ 1,205,155, 55,135, 74,165,130,201,100, 66, 69, 69,133,210,104, 52,214,151,155,177,136,199,227,255,204,227, 81,111, 81, 20,133,
+214,173, 3,115,214,173, 91,103,226, 56, 14, 33, 33, 33,120,241,197, 23,113,240,224, 65, 36, 37, 37, 85, 91,158, 76, 45, 90,180,
+204,225,241,168, 22, 85, 90,169,201, 22,152,234,212, 62,114,185,124, 84, 19,255, 52, 60, 95, 95,223,113,109,219,182,125,255,213,
+ 87, 95,165,197, 98, 49,180, 90,109,117, 91,208,195,134, 13, 47, 31, 49, 34,218,249,248,241,227,245,150,211,108, 54,207, 47, 40,
+ 40,240,209,235,245, 24, 58,116,232, 71,223,124,243,141, 76, 44, 22, 3, 0, 88,150,125,196,146,181,228,219,237,167, 62,158,191,
+ 46,238,212,238,229,190, 75,102,191,221,111,220,148, 47,227, 0,156,172,171, 96, 38,147, 41, 75,173, 86,191, 59,109,218,180, 29,
+ 27, 54,108,112,157, 59,119, 46, 56,142, 3, 33, 4, 12,195,212, 36, 18,231, 56, 14,135, 14, 29, 66,102,102,230,151,143,137, 44,
+ 27,108,176,193,134,127, 28,172,208, 34,255, 68,248,224,225,180, 33, 30, 23, 91,127,123,100,120, 62,159,191,241,244,233,211,157,
+251,244,233, 35, 24, 56,112, 96,248,201,147, 39,195, 11, 10, 10,238, 86, 89, 15,194, 7, 14, 28, 24,238,229,229,133, 53,107,214,
+232,248,124,254,198, 38,254, 76,205, 77,175,176,176,240, 6,128,111, 14, 30, 60,184, 98,226,196,137,240,246,246, 14, 85, 40, 20,
+127,107,157,157, 36,146, 46,239,172, 94,205, 8,105,154,247,221, 55,223, 56,173,140,139, 91,177,119,223, 62,193,115,207, 61, 71,
+ 17, 66,112,231,246,109,251,229,107,215, 74,199,190,240, 66,118, 90, 86, 22,115,228,212, 41,186,168,160,160,180, 64,165,154, 15,
+160,180, 49,126,154,166, 19, 51, 50, 50,124,123,247,125,206,239,220,239,119,111,190,252,194,240, 1, 66, 1,143,186,151,157,127,
+205,199,219,195, 57, 62,238,140,158,166,233,196,198,120,180, 90,237, 3,134, 97,220, 8, 33,158,241,241,241,240,244,244, 68, 89,
+ 89, 25,104,154,134,201,100, 50,233,116, 58,187,146,146, 18, 24, 12, 6, 24,141, 70, 56, 57, 57,225,206,157, 59, 69, 12,195,156,
+173,143,147,101,217,119, 36, 18,201, 98,161, 80, 40, 22,137, 68,242,107,215,174, 65,163,209,180,116,113,113,249,154, 97, 24,200,
+229,114, 36, 36, 36,204,116,114,114,202, 6, 0, 59, 59, 59,136,197, 18,119,163,209,200, 0, 40,104,106,155, 19, 66,154,124,189,
+188,189,189, 3,236,237,237, 23,125,250,233,172,144, 78,157, 58, 67,165, 82,129,227, 56,200,100, 50,232,116, 58, 56, 57, 57,161,
+ 71,143, 30, 15, 22, 45, 90,164, 32, 4, 19, 26, 16,131,252,170,235,131,137, 19, 39,202,156,156,156,144,151,151,135,224,224,224,
+ 26,161,165, 80,149,220,185,120,245,110,234,180, 73,163,251,238, 60, 26,151,114, 42,254, 90,202, 11, 67,123,118,162, 40,210,178,
+161, 50, 42,149, 74,149, 64, 32,152, 50,113,226,196,197, 65, 65, 65,173, 9, 33,104,215,174, 29, 6, 15, 30,140, 95,127,253, 21,
+233,233,233,208,106,181,236,229,203,151,119, 41, 20,138, 99,182, 33,220, 6, 27,108,176,225, 47,197,159,124,179, 30,177,104,253,
+157, 80, 42,149,170,212,212,212,147,215,175, 95,143, 30, 51,102, 12,226,227,227,223, 4, 48, 13, 0, 36, 18,201,155, 99,198,140,
+193,245,235,215,145,154,154,122, 82,169, 84,170,158,198,111,138,197, 98,131,201,244,208, 56,101,103,103,103,103,229,233, 45,171,
+166, 12, 1,160,101, 3,251,234, 55,141, 8, 4, 62, 29,134, 14, 21,148,221,188,169,217,124,229,202,226, 29, 59,118, 8,122,245,
+234, 69,209,102, 51, 88,142, 67, 96, 96, 32, 53,112,208, 32,217,207, 59,118,184,177, 90,109,194,146, 79, 63, 61,191,233,157,119,
+ 42, 51,170,252,192, 26,131,209,104, 92,251,254,228,119, 7,197,197,159,247, 11, 13,110,227,118,242,116,220, 13,119,119,103,105,
+ 80,219,182,178,146,178, 82,118,238,236,153, 2,163,209,248, 93, 99, 60,122,189,254,208,153, 51,103, 94,240,247,247,247,188,123,
+247, 46, 76, 38, 19, 88,150,197,192,129, 3, 65, 8,145, 0,224, 4, 2, 1, 82, 83, 83, 97, 54,155,149, 25, 25, 25,242,123,247,
+238, 73, 0, 44,107,164,124, 57, 70,163, 17, 41, 41, 15,103,237,154, 55,111, 30, 25, 21, 21, 5,134, 97, 48,116,232, 80, 28, 57,
+114, 36, 50, 37, 37,101,101,109,205,247,164,215,188,202, 66, 22,226,235,235,123,176,106,151, 69, 78,240,126,126,126,225,129,129,
+129, 27,150, 45, 91, 38,106,222,188, 57, 8, 33,112,117,117,129, 78,167, 67,113,113, 9, 66, 67, 67,225,239,239,143,101,203,150,
+ 1,192,174,134, 44,110, 28,199, 65,161, 80,224,193,131, 7,200,202,202,130,191,191, 63, 40,138, 66, 69, 69, 5, 24,230, 97, 78,
+110,105,133,230,248,247, 63, 31,235,191,111,195,252,176,238, 29,218, 5, 92,185,145,172,124,125, 84,164,180, 93,171,128, 32,213,
+221,133, 60, 96, 97,189, 73,151,229,114,249, 61,185, 92, 62, 70,169, 84,138,202,203,203, 35, 34, 35, 35,215, 12, 26, 52, 8, 55,
+110,220,192,249,243,231,199, 74, 36, 18,165,217,108,102,188,189,189, 39, 80, 20,229,100, 54,155,119,150,148,148, 40,108,227,161,
+ 13, 54,216, 96,195, 83, 71,181,143, 22,106,189, 91,103,209, 10, 9, 9,145,101,103,103,191,209,178,101, 75, 49, 0,216,219,219,
+135, 6, 6, 6,206,200,202,202,170,176,182, 52, 58,157,110,239,142, 29, 59, 6,175, 90,181, 74, 52,124,248,240, 54, 7, 15, 30,
+236, 6, 0,195,135, 15,111,227,232,232,136, 29, 59,118,152,117, 58,221, 83,139,137, 68,211,116,159,174, 93,187,162,180,180, 20,
+217,217,217, 86, 77,161, 28, 59,118, 76,138,135,126, 89, 13,238,107, 8,140,201,228,234,226,231,199, 43,136,139, 51,151,106, 52,
+ 62,125,250,246,165,104,179, 25, 60, 30, 15, 37, 37, 37,200,205,205,133,179,139, 11,149,154,145,225,176,101,214,172, 99, 45, 59,
+117, 18,179, 38,147,187, 21,197,212, 22, 43,139,222,250,112,202, 7,135,118,238,220,229, 89,174,209,100,218,219, 75,141, 18,137,
+200,123,234,135, 31,178,165,165,165,227, 1, 84, 90,192,179,108,231,206,157, 67,135, 14, 29,122, 59, 32, 32,192, 75,165, 82,121,
+151,151,151,179,165,165,165,124, 60,244,181,162, 0, 32, 46, 46, 14, 26,141,134, 97, 89, 54, 1, 15, 99, 97,153, 44, 45,104,139,
+ 22, 45,156, 35, 34, 34,250,121,122,122, 66,173, 86,195,221,221, 29,157, 59,119,238,199,231,243,127,204,201,201, 81, 63,205, 94,
+ 31, 27, 27,235, 72, 8,121,150, 16,130,161, 67,135, 90,116, 14,203,178,111, 71, 69, 69,137, 40,138,130, 94,175,131,157,157, 61,
+100, 50, 7, 56, 58, 58, 33, 40,168, 61,228,114, 57,134, 12, 25, 98,202,204,204, 92,175, 80, 40,246, 54,194, 5,185, 92, 14,149,
+ 74,133,220,220, 92, 20, 23, 23, 3, 0,138,139,139,107,156,243,159, 6,212,106,245,200, 30, 61,122, 76,159, 60,121, 50, 24,134,
+193,200,145, 35,145,151,151,183,242,193,131, 7,123,124,125,125,199,189,253,246,219,158,238,238,238,152, 62,125,186, 61,128, 47,
+108,227,161, 13, 54,216, 96,195, 83,199,227, 62, 90,127,182,104, 53, 52, 39,234,237,237,221,155,162,168,121,122,189, 94, 92, 61,
+ 37, 67, 81,148,216,211,211,243,136, 94,175, 95,170, 80, 40,172,114,138, 43, 47, 47,215,220,191,127,255, 72, 98, 98,226,232, 81,
+163, 70, 33, 54, 54,118, 60, 0,140, 26, 53, 10,137,137,137,184,127,255,254,145,242,242,242,167,146,128,212,207,207,111, 88,223,
+190,125, 71,117,237,218, 21, 49, 49, 49, 96, 89,246,146, 53,231,215, 94, 97,136, 58, 86, 29, 86,239,179,136,201,113,202, 59, 0,
+ 0, 32, 0, 73, 68, 65, 84,140,207, 7, 69, 81, 53,214,140, 98,149, 10,233,105,105, 40, 45, 43,131,209, 96,128, 86,167, 99,131,
+ 90,181,210,171, 77, 38, 33, 5, 88, 59,247,149,115,253,234,229, 92,157, 86,235,229,238,234,166,151, 74, 37, 40,215,168, 69,215,
+174, 94,174, 4,144,105, 33,135,137, 16,210,247,215, 95,127,157,207,231,243,199, 56, 56, 56,224,253,247,223,231,247,235,215, 15,
+ 34,145, 8, 70,163, 17,229,229,229,216,177, 99,135,138,101,217,214, 85,231, 56, 72,165,210,109,124, 62, 63,191,162,162, 98, 94,
+163, 63, 96, 50, 13,143,142,142, 22,152, 76, 38, 44, 89,178, 4, 11, 22, 44,192,208,161, 67, 5, 87,175, 94, 29, 14, 96,231,211,
+234,241, 28,199, 33, 50, 50,178,182, 51,124,138, 37,231, 9,133,194,240,182,109,219, 66,165, 82, 65,165, 82,193,211,211, 19,190,
+190,190,240,246,246,198,202,149, 43,201,154, 53,107, 78,154,205,230,245,197,197,197, 69,150,148, 33, 43, 43,171,198, 50,104, 48,
+ 24,160,213,106,145,151,151, 87, 51,117,168,151, 57, 13,157,242,214,136, 78, 90,189, 94,119,229, 78, 70,238,188,143,198, 61,167,
+213,235,117, 25, 15,114,211,129,181,156, 5,253,123,194,248,241,227, 39,140, 30, 61, 26,149,149,149, 72, 76, 76, 68,207,158, 61,
+177, 98,197, 10,159,132,132,132,105, 93,187,118,133, 80, 40, 68,124,124, 60, 24,134,201,179,141,133, 54,216, 96,195, 63, 25,255,
+ 82,255,172, 6,209,160, 69,203,223,223,223,133,101,217,153, 81, 81, 81,145, 47,188,240, 2,134, 12, 25,242,200,247, 59,119,238,
+116, 60,112,224,192,210,181,107,215, 14, 53,155,205,203,172,153,234,227, 56,238,208,206,157, 59,135, 63,247,220,115,210,254,253,
+251, 7, 2,128, 68, 34, 49,237,220,185, 83,199,113,220,161, 38,212,165, 58, 16, 99, 17, 0,248,250,250,118, 20, 8, 4,163,134,
+ 13, 27,214,241,173,183,222, 66, 82, 82, 18,118,236,216,113, 47, 40, 40,232, 66, 81,145, 85,254,213,217,141,172, 58, 92,218,152,
+117,139, 47, 22,151,148, 23, 22,186, 56, 4, 4, 8, 93, 29, 29, 21, 49, 49, 49,254,131, 6, 13,162,242,242,242, 80, 86, 86, 6,
+131,193,128,171, 87,175,114, 2, 32, 71,224,234, 74,229, 36, 38, 82,124,177,184, 4,180,117, 43,221,253,125, 92,219,125, 62,123,
+ 82, 75,131,209, 16,166, 86,171, 25,129, 80, 40,108,238,237,146,151,150,105,213, 76,156, 81, 42,149, 70, 0, 16,112, 28,167,115,
+115,115,147,158, 62,125, 26, 98,177, 24, 20, 69,161, 67,135, 14,176,179,179, 19, 17, 66,114, 1,192,209,209, 81,188,113,227, 70,
+231,113,227,198,157,111,140,184, 75,151, 46, 66,137, 68,242,124, 80, 80, 16, 18, 19, 19,113,247,238,221,156,196,196,196, 22, 93,
+186,116, 65, 64, 64,192,243, 62, 62, 62,251,110,220,184,241, 84,150,247, 63, 92,177,106,189, 51, 60,203,178, 28, 69, 81,224,241,
+120,224, 56, 14, 42,149, 10,173, 91,183,198,186,117,235,176,122,245,234, 37, 10,133,226,168, 21, 92,172, 70,163,129, 76, 38,195,
+221,187,119,141, 81, 81, 81, 18, 30,143,135,123,247,238,213, 8, 45, 47, 15,183,208,158, 93,195,131,151,124,187,253,148, 76, 34,
+145, 12,233, 23, 17,146,156,145,147, 79, 8,213,232,180,113, 72, 72,136,168,117,235,214,227, 71,143, 30,141,172,172, 44, 44, 93,
+186,180, 88,161, 80,196,157, 58,117,234,165,201,147, 39,243,123,246,236,137,146,146, 18,252,252,243,207,204,181,107,215,126, 42,
+ 44, 44,220,110, 27,198,109,176,193, 6, 27,254, 33, 66,203,223,223,127,180, 72, 36,154,254,202, 43,175,240,219,183,111,143,162,
+162, 34, 56, 57, 57,209, 20, 69, 9, 1,192,197,197,133,182,183,183,199,164, 73,147,208,169, 83,167,222,179,102,205,234, 41, 16,
+ 8,214,201,229,242,109,150,252,176, 82,169,212,241,120,188,253,239,191,255,254,178,155, 55,111,180, 6,128,223,127,255,253,190,
+ 92, 46,159,173, 84, 42,117, 86,214,163, 58, 40, 38, 37,145,216, 93,105,215,174,221,131,136,136, 8,167, 23, 94,120, 1,158,158,
+158,184,126,253, 58,150, 47, 95,158, 97, 50,153,230,159, 59,119,142,249,187, 27,153, 49, 26, 11,175, 29, 62,236,216,239,181,215,
+156,166, 70, 69,125,243,193,251,239,175,250,252,243,207, 5,237,219,183,167,116, 58, 29,174, 92,185, 66, 14, 28, 56, 64,255,188,
+120,241,106,200,100,194,196, 3, 7,196, 38,147, 41,199, 74,203, 93,223, 94,125,122,183,255,102,213, 90, 24,244,149,184,114,233,
+ 56,202,202, 84,216,184,233, 96,123, 63, 63,210,183,160,160,224,156,165, 92, 20, 69, 5,197,198,198,122, 17, 66, 32, 22,139,177,
+104,209, 34,248,250,250,194,201,201, 9, 21, 21, 21,152, 54,109,154,243,199, 31,127,236, 12, 0, 73, 73, 73, 53,225, 25, 26,131,
+ 92, 46,239, 49,105,210, 36, 71,134, 97,112,242,228, 73, 19, 69, 81,243,206,156, 57,243, 99,135, 14, 29,196,189,123,247,118,220,
+190,125,123, 79, 0,241, 79, 75,104, 53,241,188,123,167, 79,159,238, 58,102,204, 24, 34, 20, 10,169,242,242,114,184,184,184, 96,
+221,186,117, 90,133, 66,113,220, 74,174, 69,179,103,207,158, 95,181,189,117,222,188,121,239, 46, 91,182,204,179,176,176,176,198,
+170,169, 44, 46, 61,219, 35,234, 67,182,164, 92,109,250,233,219, 89, 47,219,219, 73,196,243,150,253, 20, 79,243,113,185,209,126,
+197, 48, 98,169, 84, 42, 38,132, 96,255,254,253,200,201,201,121,187,164,164,164,144,101,217,131, 51,103,206,156,209,190,125,251,
+ 86,105,105,105, 57, 21, 21, 21, 43,148, 74,229, 3,219,112,103,131, 13, 54,216,240,151,161,218, 9,190,122,245,225,113, 60,156,
+ 78,172, 95,104,177, 44, 59,233,212,169, 83,124,142,227,176,105,211, 38, 92,187,118,141, 72,165,210,121, 82,169,244,123,123,123,
+123, 86,175,215, 79,124,239,189,247,198, 45, 88,176,128,215,187,119,111, 36, 38, 38,242, 90,183,110, 61, 30, 64,109,161, 53, 8,
+ 13,196,218, 80,171,213, 87,139,138, 10, 91,215, 10, 80,217, 90, 34,177,187,218, 72,101, 30,231,124, 60, 40,102,247, 69,139, 22,
+105,125,124,124, 76,119,239,222,197,134, 13, 27,184,107,215,174,197,137,197,226,141, 10,133,194,104, 33,231,211, 64, 13,167,152,
+ 97,174,255, 50, 99, 70,200, 51, 35, 71,114,239, 78,159, 94, 41,178,183,255,232,155,181,107,103,149, 87, 84,248,130,162,136,187,
+179,115,206,166, 69,139,150, 14,125,254,249,202,164,115,231,236,110,198,198, 10, 61,105,250,150, 53,229, 44, 40, 40, 56, 23, 31,
+127, 30, 91, 55,175,130,217,108,132,162,224,161, 78, 43, 46, 81,163, 17,145,245, 39, 78,134, 97,212, 47,189,244,146, 8,128,253,
+235,175,191, 46, 86, 42,149,104,211,166, 13, 0, 64,163,209,224,248,241,227, 8, 14, 14, 6, 0,220,185,115,167,102,187,177,114,
+202,100,178,231,123,246,236,137,156,156, 28, 36, 37, 37,253,166, 80, 40, 74, 0,252,150,151,151, 55,188,107,215,174, 56,116,232,
+208,136, 6,132,150, 85,215,200, 66,161,245, 39, 78,123,123,251,217, 7, 15, 30,124,251,210,165, 75, 99,102,204,152, 33, 28, 56,
+112, 32, 0,160,162,162, 66, 7,128,181,134, 83,175,215,111, 4, 80,179,114, 54, 59, 59,251,151,233,211,167, 39,124,242,201, 39,
+158,213,229, 83, 37, 31, 77, 84, 1,137, 97,253,222,254,188, 71,215,176,246, 95,174,217,113, 42, 55,175,104,135, 58,229,136,218,
+146,186, 19, 66, 64,211, 52, 56,142,131,155,155,155,182,164,164, 4, 74,165,242,129, 82,169,124, 63, 51, 51,211,170,186, 63,205,
+ 62,111,227,180,113,218, 56,109,156,255,163,176, 60, 50, 60, 33,132,225, 56, 14,241,241,241, 56,120,240, 32,107, 54,155, 39, 40,
+ 20,138,218,209,170,215, 94,191,126, 61,246,165,151, 94,218,150,150,150,198, 79, 78, 78, 6, 33,132,181,166, 52, 6,131,129,166,
+168, 63,239,123,210, 90,110,221,186, 21,133,133,133,230,188,188,188, 51, 12,195, 28,122,194,213,139, 79,188,234,112, 43, 96,124,
+213,100, 58,179,160, 87,175,200,249,177,177,146,119, 63,251,204,248,230, 91,111,205,100, 77, 38,154, 47, 18,113, 98,153,140,199,
+ 74, 36,194,164,115,231,236,214, 76,158,236,166, 55, 26, 79,238,176,194,193,188,218,162,213,175, 95,111,188,249,238, 39,208,215,
+178,104, 37, 94, 77,135,209, 12,171, 44, 90, 70,163, 49, 76,161, 80,192,206,206, 46, 23,128,247, 27,111,188, 1,142,227,160,215,
+235, 81, 81, 81, 1,185, 92,174,126,235,173,183,216, 42,241, 36, 24, 53,106,148,147, 37,188,129,129,129,190, 66,161, 16, 39, 79,
+158,132, 80, 40, 60, 14, 0, 66,161,240,120,108,108,236,240,177, 99,199,194,207,207, 47, 48, 43, 43,139, 66, 35,254,105, 94, 97,
+ 35,247, 18,160, 29, 40,180,125,104,130, 67, 91,207,176,145,183, 41, 32,163, 42,106,124, 74,151, 46, 93, 0, 11,253,178,106,163,
+106,113,199,106,154,166,247,205,154, 53,235,253,238,221,187, 15, 94,176, 96, 1,133,170, 80, 13, 79,136,244,130,130,130, 62,115,
+230,204, 57, 69, 8,121, 68,244, 43,139, 75,207, 62, 23, 61,133,148,151,171,111,170, 82,142,222,177,202, 98,202, 48, 79, 20,206,
+194, 6, 27,108,176,193,134,167,102,213,250, 19,234, 21, 90, 20, 69,109,234,219,183,239, 4, 0,124,138,162, 54,200,229,242, 63,
+ 13,254, 10,133, 34,221,215,215,247,235, 86,173, 90, 77, 4, 64, 40,138,218,100,101,161,138, 8,193,114, 30,143,154,245, 80,220,
+ 53, 41, 64,101,117, 90,146, 89, 0, 40, 30,143,191,237,198,141, 27,159,229,230,230,170, 44,180, 64, 52,136,167,177,234, 16, 0,
+118, 1, 15, 94,201,201, 57, 53, 61, 60,124,208,208,201,147,209,113,232, 80, 39,223, 22, 45, 88,189,217,204,221,185,112,129,186,
+180,127,191,232,102,108,172, 80,111, 52,158, 60, 4,228, 90, 91,206,130,130,130,115,103,227,206,157,126,121,212,240,193,129,173,
+124, 31,138,134, 7,114, 20,151,170, 79, 91, 35,178, 30, 19,189, 35,215,173, 91,119, 84, 36, 18, 9,106,167,178, 49,155,205,165,
+ 70,163, 49, 12, 0,202,202,202,124, 55,109,218,180,155,199,227,229, 52,198,151,156,156,124,100,254,252,249,163,178,179,179, 79,
+231,229,229,101, 3, 64,110,110,110, 54, 77,211,219, 20, 10,197,168,156,156,156, 3,176, 96, 17, 0, 1,218, 37, 93,216,215, 1,
+ 0,194,122,141, 70,210,133,125,118, 0, 58,132,245, 26, 13, 0,104,106, 46,195,218,168, 10,131, 48, 47, 49, 49,113,231,224,193,
+131,223,195, 19,196,244,122, 92,108,153,205,230, 22,143,239,172,182,108, 89, 67,100, 50,153,104,189, 94,207,176, 44, 43, 48,155,
+205,196,100, 50,217,210,215,216,208, 24,108,185, 47,109,248,215,130, 16,210, 21,128,103,245,176, 89,245,238,249,216,182, 9, 85,
+233, 2,171,135,202,170,207, 42,138,162,174,214,226,168,217,111,193,185, 0, 80, 12,224, 54, 69, 81,245, 25, 65, 54,213,247,185,
+ 94,161, 37,151,203, 15,192,130,164,209,150, 30,215, 0,230, 84,229,137, 3,154,158,135,173,134,131,101,217,162,220,220,220, 39,
+190,160, 60, 30,239,193,136, 17, 35,172, 58,190,177, 99,246, 0, 57, 31, 26,141,219, 99,190,251,174,243,201, 13, 27,252, 88,134,
+113,167, 0,194, 23,139, 75, 76, 38, 83,182, 39, 77,223,178,214,146,245,136, 53,230,126,193,144,172,251, 5,104,219,182, 45,185,
+119,239,222,211, 24, 84,111,105,181, 90,255,198,186,128, 78,167,235,109,161, 24,220, 85, 80, 80,176,171, 14,193,190, 91,161, 80,
+236,182,226, 78,145, 81, 37,170,120, 28,197,189, 28,214,107,244,126, 0, 92,117, 82,233,167,137,194,194,194, 52, 84,197,121,251,
+167, 33, 39, 39,199, 72, 81,212, 47,203,151, 47,127,253,230,205,155,123,228,114,185,209, 54, 20,219, 96,131, 13,255,101,145, 69,
+ 81, 84, 76,213,231,232, 42,163, 80,204,227,219,213,199, 84, 31, 87,251,152,106,142,199,247, 55,116, 46, 0,204,158, 61,251,179,
+165, 75,151, 74, 1, 88,154,140,185,201, 73,165,255, 42, 20,253, 67, 56,106,139,130,205,127, 69, 69,191, 3, 76, 96,152,203, 96,
+106,249,228,211, 79,215, 16,113,239,222,189,255,244, 83,107,117, 82,233, 90, 8,255, 95, 29,124,178,179,179,215, 5, 4, 4,108,
+148,203,229, 12,108,176,193,130,251,149,173, 9,108,248,151,194,179, 46, 97, 84,143, 40,139,110,232,251, 71, 30,220,235, 56,174,
+174,207, 20, 69,197, 44, 93,186, 52,218,138,242,214, 88,180,120,182,107,103,131, 13,255,110,252,127,172,164,181,193, 6, 27,108,
+248, 79, 60,121, 60,102,197,170, 22, 95,143,127,158, 61,123,246,103,104,120,198,201, 7, 15,173, 88, 62, 85,159,107,252,181, 40,
+ 60, 92, 57, 80, 23,172, 89, 77, 48,168, 9,245, 59, 99,227,180,113,218, 56,109,156, 54, 78, 27,167,141,243,127,142,179, 49,238,
+ 51,117, 8,162,168,250,166,250, 26,154, 70,124,124,187,177,115, 27, 59,150,162,168,250,194,252, 84, 79, 21, 62,254,254,151, 99,
+144,141,211,198,105,227,180,113,218, 56,109,156, 54, 78, 27,231,147,128, 16,210,149, 16, 18,133,135,211,223,132, 16, 18, 69, 8,
+ 25, 58,123,246,236, 57,213,251,102,207,158, 61,135, 16, 50,176,250,184,170, 99,106,206,169,222,247,248,251,227,251, 26, 58,182,
+129, 34, 78,120,108,187,230,243, 63,197, 71,203, 6, 27,108,176,193, 6, 27,108,176,161, 78, 84,175, 24,172,101,109, 82, 1,184,
+179,116,233,210,178, 90,190, 83, 42, 0,183, 0,116,170, 58, 78, 85, 37,210,106,251, 86,153,170, 62,155,234, 56,198,100,201,177,
+245, 96, 83, 61,219, 54,161, 85, 31, 58,121,243, 22, 7, 52,247,138,168,186, 0, 32, 85, 73,128,185,170,120, 69,164, 58,112, 17,
+199,129, 16, 2,185,178,252,250, 29, 37, 62,111,234,239, 5,249,194,205,203,206,110, 53, 71, 72,175,170, 93,231,212, 37,198, 79,
+146, 52, 40,183,148, 35,184, 25, 66,236,120,152,201, 17,116, 4, 0, 30,133,219, 6, 14, 95,167, 22, 89, 31, 79,170,174,126, 30,
+230,137, 9, 98,123,233, 43,206, 46,174,109,203,202,138, 51,204, 6,227,190,100, 21, 54,162, 9, 14,182,129,174,120,150, 35,248,
+ 12, 0, 79,200,195,202,140, 82,139, 87,114,216, 96,131, 13, 54, 60,169,117,228,137,226,226, 81, 20,197,214,193, 73, 61, 33,167,
+109,161,130, 5, 98,171,142,221,191,215,177,239,234, 63,169,220, 86, 9,173, 80, 79, 76, 6,133,133, 0, 8, 8,190, 72, 86,225,
+ 7,171,206,247,193, 32, 59, 62,127, 11, 0,190,193,204, 78, 39, 28, 18,234,108, 76, 30,250,216,137,248, 43, 1,112, 6,150,125,
+ 39, 89, 97,185,191, 88,152, 31,134, 10, 56,222, 47, 28, 33, 66,150, 35,219, 64, 16,227, 32,194,197,203, 5, 48, 88, 83,214,128,
+230, 94, 17,135,127, 87, 12,142,251, 97, 42,186,119,108, 3,194, 50, 0, 71, 67,218,123, 38,126,251,246, 13,116, 15, 9, 0,225,
+104,128, 99,224, 48,236, 27, 12, 11,119, 38,119,148, 77,203,131, 29,228, 11,183, 22, 30, 94,119, 55,111,222,226,237, 27, 24, 74,
+113,140, 25,105,191,159, 30,247,241,172,249, 3,194,160, 14,183, 68,108,117,244,193,187, 1, 45,219,207,252,100,225, 42,190,143,
+175,191,140,163,141, 76,225,131,148, 46,107, 87,204, 63, 32,226,229,172,188,173,192, 22, 75,251,114,168, 39, 38, 10, 36,226,209,
+246,118,178,182, 58, 93,197, 61,214, 76,239,227, 9, 5, 67,191,254,102,117,231,126,145,195, 29,216,138, 66, 30,205, 33,116,239,
+158,221, 45,190, 91,183,126,248, 93, 5,251, 60, 0,206,154, 58,115, 4,179,210,183, 79, 24, 46, 20,240,169,144,183, 55,243, 1,
+166, 73, 66, 43,196, 11,175, 82, 4,141,134,151, 32, 20,206,167, 40,177,171, 41,191, 17,236,133, 31, 41,130, 32, 80,216, 79, 17,
+236, 78, 86, 65,105, 27,242,108,176,225,191, 5, 30,143, 23,199,113, 92,255,167, 44, 12,158, 37,132, 92,182,181,238,255, 54,172,
+179,104, 81, 88,146,148,153,231, 10,214,140,176,160,192,197,128,117, 66,203,142,207,223,118, 53,163,200, 27,140, 25,155,191,124,
+127,143,137, 6, 24,218, 12,150,161,193, 50, 52, 24,198, 12,150,166, 65,104, 35,230,255, 20, 7,152, 42, 16, 17,222,110, 27,192,
+250, 88,250, 27, 66,194,251,229,250,133,211,110,148, 73,141, 93, 63, 44,253, 48, 79, 85,249,225,153,219,242,226, 80, 47,253,156,
+100, 37,126,182, 70, 16,196,109,152,138, 29,135,142,231,175,249, 81,155,202, 17, 2, 55, 39,251,246,227,162,147,252,183, 31,137,
+203, 91,189,205,144, 10, 0,206, 50,113,251,241,183, 51, 2,158,228, 34,120,217,217,173,222,184,254, 59,111, 31,119,123,138,185,
+180, 12, 12,203,194,191, 69, 20,127,206,148,113, 62, 75,190,221,242, 45, 52,198, 55, 27, 58,191,189, 23, 66, 91,182, 10,153,190,
+237,248,165, 0,173, 70,105, 58,189,243,179, 76, 24, 65,123,251,133, 8, 23, 47, 93,197,159,251,233,212,105, 38, 54,255, 74,154,
+ 18,201,141,141, 53, 33, 94, 56,178,116,217, 55, 29, 7, 12,139,118,224, 42, 85,124,131,182, 50,104,243, 79, 91, 22, 6,119,236,
+ 38,237, 29,222, 92,164,220, 55,137,210, 87,148,194,204,179,147, 12, 8, 27,228,164,127,125, 44,189,121,235,142, 41,201, 74,172,
+181,166,206, 44,249,163,239,113, 92,211,163,174, 83, 4,189,111, 94,142,155,200,202,175,130,176, 52,192,154,107,222,193,210, 32,
+220,195,247,238,147,126, 2,208, 52,161,197, 35, 24,124,230,194, 85,159,162, 66, 69,215,111,191,249,106, 14,185,122,245, 87,176,
+248, 37,165, 20,231,172, 21,152, 0,130, 90,187,243, 79,209, 44,140,121,229,108, 80,245,206, 1, 65,146, 30, 62, 14,212,192, 92,
+ 53,149,112, 62, 83,127,206, 54, 52,217, 96,195,255,139,197,132, 33,132, 8,158, 50,231,112, 66,200,137, 39,164,153, 9,224,221,
+170,237, 45, 0,190,126, 10, 69,107, 14,192,187,106,187, 16, 64,190,173, 7, 60, 17, 30,119,126,111,114, 28, 45, 59, 16, 14,216,
+255, 2, 0,216, 91, 91, 10, 2,216,129,226, 3,180, 22, 35,135, 69,194,195,203, 27,160,117,128, 89, 7,208,122,128,214, 2,180,
+ 30,197,138, 28,192,172, 5,178,126, 5, 67,136,196,234,234, 26,213, 64,250, 62, 12,236, 18, 0, 79,103, 59, 76, 29, 25,234,177,
+233,100,250,150, 45,167,211, 6, 37, 43,241,138, 69,101, 37, 4,221, 59,180,197,154, 45,218,212, 99, 55, 84, 67, 0, 96,120, 39,
+247,147,221, 67, 91,248,175,222,102, 72, 61,113,167,108, 40, 0, 12, 13,115,250,181, 91,123,159, 0,238, 9,194,211,112,132,244,
+246,109,217,150, 98,111,110, 4,167,201,135, 70,163, 71,254,131,237,112,245,123,134,199,114,232,219,216,249,246,124,204,254,104,
+238,114,161, 78, 83,100,226,204, 42,214,147, 95,198, 23,136, 57, 10, 5,231,140,149, 92, 57,251,201,132, 55,152,233,159,127, 57,
+ 27,192,184,134,120, 66,189, 48,101,229,202,213, 29,122, 70, 4,123, 21, 30,152, 74, 85,150, 21,129,225, 75, 37, 35,159,235, 9,
+151,118,161, 92, 81,252, 74, 74, 28, 56, 8, 46,238,129, 40,184,180, 19,217,151, 15, 82,189,186,140,146,252,188, 75,244, 58, 96,
+174, 83,104,181,245, 64,175, 33,125,186,237, 9, 12,240,245, 33,132, 3,199, 17, 16,142, 69,165,129,198,156,189, 89, 96, 89, 22,
+ 47, 13,233, 53, 80, 38,166, 8,199,113, 32,132, 67, 94, 97,137,238,236,149,212,129, 89,101,184, 98,137,165,170,211,179,253,123,
+221,190,126, 57,152, 78, 63,134,136,113, 75, 83, 41,224, 66,173, 62,215,235,198,169,159,131,129,159,154,174,229, 40,176,217, 39,
+151, 33,160,207, 4,254,198, 93, 39, 61,213,170,130,241, 7,182,175,127,249,135,141, 27,119,164, 42, 49,201, 26,145,245,113, 31,
+241,133,111,207,106,220,159, 11,148,169,242,106,217, 41, 91,187,242,134,108, 56,145,252, 81,226,162,238,193,115,143,147,242,132,
+ 76,195, 29,219,184,101,131, 13,127, 47, 8, 33, 79, 93,108,229,228,228,200,159, 68,108,249,249,249,245, 41, 40, 40, 88, 81,237,
+173, 66, 81,212,138,150, 45, 91,206,255,227, 65,245,145,103, 61, 53,203,178,227, 10, 10, 10, 18, 26,226,140,138,138,242, 61,126,
+252,120,171, 90,156,173, 0,180,170,235, 88, 23, 23, 23,182, 71,143, 30,217,199,143, 31,151,219,122, 72,147, 4,151,213, 66, 43,
+ 53,119,223,212, 46, 70, 69, 37, 0,164, 90,112,252, 35, 83,126, 6,154, 93,182,117,225, 27,203,194, 90,186,161, 66,107,194,233,
+107,217, 96, 89, 26, 44,195, 84, 89,182, 24,176, 12,141, 33,157, 60,208,195, 48, 9,107, 99,210,192,176,220,210,134, 56, 31,135,
+153,112,175,118, 30, 52,102, 47,199, 17,177, 68,200, 83, 7,249,187,123, 77,127,169, 19,111,234,200, 48,232,205,204,152,157,241,
+153,103, 83,148,216,108, 17, 39,247,231,240, 68,164,174,125, 44,211,104,221, 27,176, 70,117, 31,212,175,183, 19, 49,170, 65, 23,
+103,161, 66, 71, 35,171,132, 70,161,161, 28, 18, 74, 97, 17, 39, 71,208,177,185,159,143,244,226,158, 79, 31,184,243, 53, 2, 47,
+ 62, 35, 18,243, 24,176, 28,225,147,242,100,163, 91,112,164,176,218,111,171,161,114,218, 75, 29,223,232, 51, 56,202, 57,119,231,
+ 4,202, 62,104, 8,188,186,248,227, 65,194, 86, 40,175,197,160, 68,158, 77, 57, 25,202,209,204,189, 13,134,141,123, 5, 95,191,
+210, 21, 21,154, 10,240, 21,153,206, 98,161,196, 5, 48,215,201, 73, 88,140, 91,185,252, 75, 31, 1,159,247,176, 61,171, 95, 44,
+ 13,189,209, 8,176, 12,236, 4, 28, 40, 82,253, 29, 13,150, 54, 75, 59,142,250,244,125,128,189,210, 88,221, 83,148,216, 21,234,
+137,222,224,232, 96, 66,235, 65, 1, 23,146, 85,127,136,159, 16, 47,188,250,204,144,183,122, 19, 10,231,155,114,141,194,221, 17,
+ 29,209,202, 65, 38,211,164, 34,127,255,135,200,132, 29,105,214,243, 93,188,250,246, 20,233,166, 77,155, 70, 0,100, 50, 30,245,
+ 81,171,225, 12,110,198,159, 72,179,152, 15, 0,122,154,108,117, 20, 83,111,175,220,157,232, 14,254, 31, 25, 30,170, 45, 89,153,
+ 37, 92,153, 57,110, 94,218,179,211, 99,250,117,184,217, 47,143,162, 36,185,231,238, 25,213,214,244, 37, 43, 97,227,180,113,254,
+229,156, 78, 78, 78,173, 91,182,108, 57,159,166,233, 62, 34,145,168,153,217,108, 6,199,113,133, 98,177,248,124,118,118,246, 34,
+141, 70,115,255,159, 86,247,219,183,111, 91, 35,182, 26,229, 20, 10,133, 72, 75, 75,187,103,133,216, 58,243,216,249,191, 92,184,
+112, 1,123,247,238, 5, 0,164,167,167,163, 93,187,118,178,186, 78,124,240,224,129,172, 95,191,126,191, 0,240,111,136,243,206,
+157, 59,173,143, 29, 59,134,253,251,247, 3, 0,210,210,210, 16, 20, 20, 84,103, 97, 46, 92,184,192,127,237,181,215, 90, 3,144,
+255, 13,215,232,191, 32,178,106,191,255, 33,180, 98, 98, 98, 72,116,116, 52,245,248,118, 29,200, 10,112, 21,119,129,129, 5,128,
+ 44,107, 75,144, 82,132,229,107,182,159, 26,250,219,254,117,125,236, 68, 60, 44,216, 60, 61, 79, 85, 90,241,172,128,122, 56,253,
+194, 16,240, 92, 29,196,137, 75,199,119, 10, 40,171, 52,224,232,239, 5, 9,201, 74,235, 76,164,201, 10,196, 2,156,203,195, 79,
+ 44, 12,122,101,208,248,175, 99,119,239,158, 61,180,227, 39, 35, 59,226,200,165,236, 79, 0,166,209,168,239,132,227, 64, 56,166,
+198,249,189,234,209, 1,224, 30, 77,224,203,129, 60,220,199, 89,103,209,234, 11, 8,202,188, 48,204, 81, 42,254,126,226,196,247,
+156,104, 85, 6, 74, 77, 34,228,149, 25, 80,168, 23,162, 82,224,133,130,212, 59, 44,143, 66,108,163, 38, 23, 10, 26,194, 24, 92,
+ 92,197, 14,188,240,200,247,253, 52, 39, 63, 43, 19, 83, 12,223,233,197, 37, 46,197,191,173,202,102,180, 42, 45, 69,161,209,240,
+243,206,206, 46,237, 12, 37,217,124,117, 89, 49, 92,188,195, 48,116, 76, 52,190,136, 10, 69,133, 70, 11, 85,105, 34,105,235,227,
+ 68,229,156,223,129,185,195, 66, 80, 82,164,128,145, 6, 40,173,177,212, 96, 50, 84,214,219,142, 60,108,252,120,198,172, 87, 91,
+248,120,202,170, 23, 21, 16,142, 69,167,144, 64, 68,246,233,142,216, 11, 23,113,245, 78, 58,184,170, 69, 5,132,227,144,175, 44,
+ 43, 50,152,217,173, 86, 53, 40,203,128,208,134, 58,133, 24,154, 48,101, 24,238, 5, 41, 11,124,222,181,181,227, 59,179,163, 91,
+ 56,202, 36, 20, 12, 52, 11,131,137, 70,197,197,239,225,222,178, 3,164,118,118, 84, 23,232, 5, 55, 80,119,219, 26,104,204,191,
+175, 40,247, 65,101, 33, 94,139, 12,251,104,219,210, 15,100,148,221,195,174, 73,179,143, 90,178, 46, 46,236,122,234,181,197,135,
+227,246,238, 27,235,251,245,204, 55,250, 13,153,182, 53, 14,192, 73,219,184,101,195,191, 17, 47,191,252,178, 93, 81, 81, 81,188,
+191,191,127,104,100,100,164,180,119,239,222,208,106,181, 56,125,250, 52,180, 90,109, 11,127,127,255, 22,167, 79,159, 30,149,155,
+155,155,220,188,121,243,126,251,247,239,183,216,135,182, 74, 0,241,107,134, 96,128,161, 40, 10, 85,251,168,170,125, 77,206,115,
+ 43, 22,139,145,147,147,243,212, 45, 91, 5, 5, 5,247,154, 98,217,170,172,172, 20,249,249,249,193,211,211, 19, 44,203, 66,171,
+213,226,240,225,195, 80,171,213,224, 56, 14,246,246,246, 88,178,114, 51, 82,111,196,227,202,149, 43, 80,171,213,162,198, 56,243,
+243,243,169, 78,157, 58,193,104, 52,130, 97, 24, 24, 12, 6,156, 57,115,166,230,179, 64, 32,192,172,197,223, 34,253, 90, 60,110,
+222,188,137,252,252,252,191, 37,219,136, 21, 90,228,159,136,122, 99,102,253,237,171, 14, 89,150,153,179,105,219,238,196, 57,147,
+ 94,193,148,177,131,252, 23,173, 59, 56, 40,165, 24,219, 0, 32,196, 3,227, 95,239,223, 54,192, 69, 42,196, 23, 59,175, 1,132,
+204,121,210,223, 75, 42, 69,122,104, 51,238,147, 67, 87,114,226, 63,123,165, 11, 2,125,156,218,149,137, 75,197, 89, 89, 22,228,
+ 20,228, 24,184, 58, 72,218, 15,239,228,126, 18, 28, 7, 23, 71, 73, 48, 88, 6, 46, 14,146,246, 67,195,156,126, 5, 0, 39,169,
+ 48,184, 46,203, 87,125,136,240, 23, 78,144, 74, 4, 19,100,142, 46, 1,111,142,136,180, 31, 62, 98,148,189,131,144, 65,201,149,
+211,208, 8,155,131,118,107, 1, 35, 93,138,252,251,153,236,111,151, 83, 10,138, 43,140,211, 27, 45, 38, 65, 66,193,253, 52,207,
+214, 29, 35, 93,139, 99,230, 42, 91,191,181,179, 21, 15, 28,175, 98,199,139, 69, 50,175,110,246,191,103,221,175,228, 72,157, 22,
+157, 71,160, 81,171,179,105, 22, 62,122, 86,224,152, 25,247, 51,102, 15,235,128,178, 82, 37, 12,102, 6,106, 61, 99,246,118,177,
+147, 24,239,223,133,209,204,192, 68,115, 16,186,248,225,116,226,157, 98,142,166,127,173,143, 51,171, 4, 55,179, 14,223,116,168,
+189, 47,208, 3,157, 62,117,178,191, 9, 90,143,156,124, 57,182, 29, 79,236,146, 85,130,155, 79,114,157, 9,199, 60,156,126,174,
+101,201,162, 8,122, 55,197, 9, 62,216, 11,221, 68,118,162,239, 86,124,242, 90,232,115, 65,110, 18, 46, 63, 17, 20,103,134,140,
+ 21, 64, 47,102,225,236, 31, 8,206, 84, 65,116, 6, 67,121, 18,208,208,197,231, 3, 0, 49,107,241,245, 27, 97, 50,202, 53, 16,
+108,214, 73, 8, 58, 79, 0, 93,101,237,207, 44,225,238,152,227,230,165,246,152,113,172,239,226,216,254, 41,242,227, 11, 82,252,
+ 94,254,190, 19,176,181,165,237,118,109,195,191, 17,237,219,183,247, 46, 40, 40, 72,154, 49, 99,134,219,139, 47,190,136, 67,135,
+ 14, 65,163,209, 96,235,214,173, 88,189,122, 53, 22, 46, 92, 8,154,166,177,105,211, 38,233,129, 3, 7,186,173, 95,191, 62, 63,
+ 32, 32, 32, 44, 55, 55,183,176, 17,129, 69, 1,144, 0, 16, 86,221,187, 40, 0,220,137, 19, 39, 48,124,248,112,156, 56,113,130,
+171,218,199,226,225,195, 79,147,114,127,138,197, 98,136,197, 98,168,213,234,167, 34,182,132, 66, 33, 28, 28, 28, 32, 22,139, 81,
+ 81, 81, 97,181,216, 98, 24,134,159,159,159, 15,181, 90,141,200, 17, 35,240,237,210,165,232,223,191, 63, 34, 35, 35, 65, 8,193,
+153, 51,103, 48,168,103, 56, 94,121,190, 31, 82, 82, 82,192, 48,140, 69,229, 45, 44, 44, 68, 81, 81, 17,134,142, 24,129,205,235,
+215,163,123,247,238,104,223,190, 61, 24,134, 65,124,124, 60, 94, 30,210, 19,118, 47, 12, 66,122,122,186,173, 83, 91,110,205,122,
+ 42, 62, 90, 79,140, 36, 21, 46,115, 71,206,197,140, 29,210, 45,122, 68,175, 80,108,222,243,219,151,240,212,236, 6, 0,119,163,
+100,201, 27,253, 3,145,156, 91,134,223,110,202, 99, 82,138,241, 84, 86,107,112, 44, 60,220,157,164, 0, 95, 12,189,153, 99,156,
+178, 26,119, 96,230, 8,129,180,207,167,120,125, 68,178,127,247, 80,127,255,234, 85,135, 14,195, 87, 97,252,157,123, 1, 93,219,
+123, 7,128,165, 1,150,134,211, 43, 59,129,197,178, 70,203,209,179,149, 56,246,227,169, 83,123, 12,123, 97,140,189, 88,234, 12,
+ 86,147, 7,186,240, 14, 74, 50, 18,160,149,182, 67, 97, 78, 22,246,158,186,162,206,200, 47,209,240,120, 56, 93,164, 54,206,204,
+ 42, 67,101, 99,188, 6, 26, 75,231,207,157, 30,181,119,247, 30, 71, 73, 96, 47, 42,243,251,225,106,177,128,145,120,182,122,134,
+167,179,243, 32, 95,109,221,227,164, 53, 97, 89, 99, 60, 58,173,230,224,153,211, 39, 95,105,219,186,151,227,131,171,199,161, 55,
+ 24, 97,164,129,176,110,253,192,178, 68, 76,241, 40,206,137,207,167,148, 37,101,160,104,182,232,252,173, 7,138, 11,183,178,248,
+ 70, 71, 44,107, 48,186,200,227,234,158,226,127, 52,162, 95,103,128,214,227,249, 62, 29,240,237,142,223, 62, 4,216,183,158,236,
+ 34, 63,180,104, 17,160, 87,168, 39, 54, 16,130, 94,215, 14,175, 14,142,120,225, 99, 88, 99,209, 10,243,192,176,144,214,190, 63,
+127,187,228, 83, 55,247,230,237,248, 20, 71,131,120,119, 4, 52,249,132,202, 79,132,179, 95,119,176,190, 61,177,105,237, 55,149,
+ 28, 71,118,163,129,208, 22, 44, 7,112,185,231,192,166, 30, 66, 86, 86, 22, 60, 90, 92, 3, 40, 30, 72,203, 7, 48, 51, 15, 79,
+ 51,154,201,241, 53, 91,143,245,159, 57, 96,105,216,136, 96, 65, 64,226,173, 76,229,152,183,125,165,207, 6,240,131,146, 21, 50,
+ 94,177, 86,203,217,198, 47, 27,254, 77, 48, 24, 12, 7,151, 47, 95,238, 22, 29, 29, 93,109,145, 65, 98, 98, 34,182,108,217, 2,
+153,236,209,113,114,248,240,225, 32,132,184, 45, 88,176,224, 32,128,231,234,227,236,209,163,199,136,155, 55,111,202, 59,119,238,
+156, 85, 37,182, 68, 0,120,119,239,222,229,229,229,229, 81,174,174,174,196,215,215,151,150,203,229, 28, 0,246,237,183,223,230,
+239,219,183,175,173, 86,171, 61,215, 84,161, 37, 22,139,159,138,207,150, 80, 40, 4, 69, 81, 16,139,197, 16,137, 68, 32,132, 88,
+ 37,182, 88,150, 21,156, 56,113, 2,215,174, 93,195,194,206,157,241,137,159, 31,220,220,220, 16, 31, 31, 15, 66, 8,100, 50, 25,
+ 74, 75, 75,177,123,247,110, 12, 24, 48, 0, 12,195,136, 44,225,221,191,127, 63,174, 95,191,142,197, 17, 17,248,196,217, 25, 14,
+ 14, 14, 56,115,230,225,108,160, 68, 34, 65, 78, 78, 14,206,156, 57,131,126,253,250,217, 58,245, 19,194,226,206,211, 23, 16,148,
+ 82,240, 54,155,244, 32, 12, 1, 40,248,134,132, 64,148,146,242,168,115,142, 37,224,241, 48,119,237,182,152,168, 85, 31,143,160,
+ 38,140,236,226,187,232,231,184,201, 0,240,206, 75, 65,126, 82,137, 0,107,142, 36, 19, 30, 15,115,159, 70, 5, 67, 66, 32,162,
+ 74, 48, 57,178,123,123,200,203, 77,200,148,151,159, 77, 1, 44,202,226,252,219,170,215,177,253,104,124,222,234,237,134, 84, 66,
+ 8, 92, 28, 36,237,199,223,206, 12,248,249,196,245,220,149,123, 13,169,132, 35,112,145, 10,131,223, 74,233,217,232,170,195, 8,
+127,225,132,105,211,167,247, 28,249,214, 12, 59, 38,117, 31, 76,153,167,192,153,245,208,152, 69, 40,231,123, 35, 63, 55, 23, 95,
+109,138,201,211,104, 77,175, 36,169,172, 19,152, 25, 37,168, 20, 80,154, 23,191,250,226,179,216,165, 75, 22, 56,232,179,226, 43,
+249, 20,163,231,183,236, 43, 88,178,112, 21, 85, 97, 52,141,201, 42, 67, 69, 99, 60, 70, 71, 44, 91,190,114,109,212,123,227, 70,
+165, 6,181,235,235,206,202,239,187, 27, 52, 26,229,206,147,215,189,171,158, 20, 41, 0,200,204, 47,129, 74,173,101, 88,134, 62,
+231, 40,196,162,100, 75,172,131, 85,104,237, 5,207,232, 94, 97,175,121, 58,138,160,175, 44,135,151,163, 16, 67,186,183,121,141,
+254, 61,253,211,251, 74,107,228,218,227, 66,139, 6,161,245,184,188,108, 64, 48, 97,233, 96,176, 52,204,183,127,177,222, 50, 70,
+225,147, 41,125, 28,156, 92, 77, 15,120,208,202, 0,123, 15, 80, 78, 45, 0,231, 86,148, 48,100, 12,228, 89, 73,204,135,175,141,
+ 43,185,159,157,255,163,135,125,195,211,218, 52, 71,192,101,199,163,178, 40, 19,119,229,102,132, 41, 31,206,182, 59, 21,221, 0,
+107,139,152, 99,195,127, 20, 57, 57, 57,111,204,153, 51,231, 66,247,238,221,155,121,120,120,160, 67,135, 14, 56,122,244, 40,102,
+204,152, 81,115, 76,231,206,157, 65, 8, 65,105,105, 41,150, 47, 95, 94, 40,151,203,223,104,240, 1, 61, 41, 41,117,251,246,237,
+125, 66, 67, 67,205, 34,145,168, 28,128,164,188,188,220,174,180,180,148, 50, 24, 12,224, 56,142,115,118,118,102,229,114, 57,253,
+202, 43,175, 24, 47, 93,186,212, 70,171,213,230, 60,137, 69,203,223,223,255,110, 73, 73,137,154,162,168, 39, 14,253, 80, 45,178,
+ 60, 60, 60, 60, 43, 43, 43, 57, 0,101, 77, 9,253,192, 48, 12, 34, 34, 34,112, 42,225, 6, 78,252,118, 9, 26,121, 26, 38,191,
+247, 6, 58,116,232,128, 83,167, 78, 53,249,154,117,234,212, 9, 39,207, 92,192,133,107,183,144,147,126, 27, 31, 78,126, 15, 97,
+ 97, 97, 56,121,210,230,189, 96, 5,142,227, 81,223,172,227,143, 11,173,126, 49, 49, 49,213, 67,255,159,228,107,176, 7, 58, 9,
+ 93,196,191, 44, 24,214, 38, 68, 24,185, 0,148,208, 30,251,218,157,236, 57,247,171,239, 83,249, 94, 57,227,238, 42, 27, 95, 29,
+246,200,159, 70,137, 36,114, 37,117,215,173,148,224,215,158,239,238,143,205, 71,165,159, 3,192,152,222,173,241,123,134, 10, 87,
+210,149,187,146, 85, 72,122,210, 90,135,123, 65,202, 22, 99,215,242,143, 70,246,107,209,220, 27, 91, 14, 93, 0, 69,225,160, 69,
+ 55, 92, 66, 72,247,208, 22, 88,189,253,241, 21,134,222, 1, 43,247, 26, 82, 79, 39, 85, 12, 3,128,200, 96,233,175, 93,219,184,
+ 6,144,218,142, 91,117,192, 94, 44,152, 56,108,212,235,118, 76,250, 81, 32,251, 12, 40,198, 8,189,153,131,162,184, 2, 58,103,
+127,196, 39,222,210,171, 13,166,143,147, 85, 77,179,226,165, 20, 35, 75,116,245, 86,110,165, 86,239, 35,245,108, 99,224,243, 56,
+174,210, 72,240,123,114,182, 38,185, 16,105,150,112,100,101,193,244,172, 31,211,123,195,182,189,243,133, 34,241, 24, 62, 5,202,
+203, 69,230,185, 97,213, 98, 56, 58, 58,128, 51, 85, 2, 90, 21, 94,252,224, 43,213, 93, 57,221, 26, 0,218,185,195,161,119,107,
+225, 54, 1,143,202,143,203, 52,207,107,236, 55, 40, 26,147,198, 13,233, 44,228, 76, 90,124,180,124, 15, 54,126, 58, 18,175, 15,
+ 12, 17, 30,191,152, 62, 9,192,162,166, 94,107,194, 50, 32,180, 30,207,125,150,144, 74, 1, 23, 8,208,235,218,222, 37,193,192,
+ 13,139, 57,186, 0, 66, 86, 64,133,116, 12,144,137,184,252,139,224,242, 47, 18,190,127, 79, 80, 1,125, 40,202, 59,130,124,183,
+ 98,161,118,243,230, 45,167, 57, 30,190,176, 32, 84, 6, 88, 14, 40, 78,191, 0,147,201, 4,154, 5, 12, 6, 3,180, 90, 45,100,
+153, 39,107,124,180, 68, 66,106,232,212, 55, 71,116, 34,149,114,221,177, 84, 38,119,203,123,193,207,145, 74,185,238,114, 46,155,
+ 94,172, 53,218,172, 89, 54,252, 27,145, 37,151,203,135, 14, 31, 62,252,183, 83,167, 78,185,133,135,135, 3, 0,174, 93,187,246,
+240,161, 51, 34, 2, 65, 65, 65, 40, 42, 42,194,216,177, 99,139, 21, 10,197, 80, 52,226,243, 91, 81, 81,113,127,255,254,253,205,
+180, 90,109,231,121,243,230, 41, 91,180,104,161, 49, 24, 12, 84,121,121, 57,199, 48, 12, 92, 93, 93,197,157, 59,119, 70,143, 30,
+ 61, 42, 19, 19, 19, 91,230,229,229, 85, 0,200,110, 74,225, 71,142, 28,137,132,132,135,139,246,158, 70, 92, 45,145, 72,132,240,
+240,112,191,172,172,172,130,170,123,139,213, 99,124,237,219,203,173, 91,183,112,238, 70, 62, 4, 38, 61,196, 42, 57, 46, 31,218,
+143, 17, 19,223, 7,195, 52, 61,183,252,173, 91,183,112,248,204,101,200, 36, 2,164,165, 37, 97,255,254,253,152, 60,121,242, 19,
+113, 54, 17, 13,106,145,127, 56, 20,168,199, 79, 75, 0, 0,209,209,209,231,170,173, 21,181, 17, 24, 8,177,164, 18, 11, 34,187,
+248,205, 26,211,171, 13,159,214,200,193,177, 28,248, 66,192,203,195, 9,191,252,178,171,245,174, 61,123, 18,215,175, 91,191,150,
+ 99,152,185,119,149,208, 89, 81,168, 5,171,246, 92, 24,243,203,244,126,130,201,195,130,221, 0, 64, 36,224, 97,205,209, 36, 6,
+192,130, 39,169,237,179,126,197,208, 97,164, 0, 0, 32, 0, 73, 68, 65, 84,176,171,164, 49,193,203,221,249,243, 57,239, 70,185,
+245,139, 8,194,185, 43,119,177,118,127, 98,130, 88,137,237, 22,119,110,142,198,227,250,169,174, 85,135,224, 26,247,187,100, 89,
+226, 45,146,185,194,156, 29, 7,152, 13, 48, 24,205,200, 43, 97,145, 87,106,128, 64, 42,194,181,244,124,189,123, 33, 98,158,160,
+218,148, 76,106,231, 59,255,203,149,205, 13,250, 74, 70, 83, 86,204,136,196,151,133, 82,123,137,194, 26, 87,133,203, 5, 48,244,
+105, 37,124, 6,224,248, 98, 59,162,251,108,218,155,178,130,228, 83,104,203,147,131, 34, 4,246, 33, 81,112,180,231,139,122,181,
+ 20,230, 2,128, 76, 38, 21, 47,255, 98,134,243,199,159,126,209,168, 15, 88, 8, 32, 10, 10,244,254, 56,188,133, 43, 18,174,167,
+ 34,225, 78, 78, 82,194,181,180,176,254, 29,124, 17,212,220,101,170,184,172,124, 89, 10,172,183,144, 62,188, 48, 12, 64, 27,106,
+ 86, 29,134,120,225,213,174, 99,230,213,183,218,176, 78,180, 2,184,116,150,128,226,243, 1,138,247,112, 5,100,222, 69, 8, 92,
+ 2,201,174,189,135,117, 91,182,108, 95,156, 82,108,249,226, 12,154, 5,171,209,104, 32,147,201,112, 50,157, 49,190, 62, 68, 36,
+225,241,120,200, 75,191,241,135, 51,188, 27, 47, 84,212,127, 73,240,197,133, 93, 79, 57,138, 41,137,111,212, 23, 33,204,157,237,
+249, 77,189, 73,216, 96,195, 63, 1,106,181,250,118, 74, 74,202,144,142, 29, 59,110,253,232,163,143, 28,199,141, 27,231,251,222,
+123,239,241, 0,160,168,168,136, 91,189,122,181,252,187,239,190, 83, 23, 23, 23,191, 69,211,180, 37,161, 76,136, 66,161,184,244,
+227,143, 63,170,206,159, 63, 31,214,173, 91, 55,201, 51,207, 60,195,185,186,186, 10, 36, 18, 9,107, 50,153, 12,233,233,233,108,
+ 86, 86,150, 79,121,121,249, 61, 0,153,104, 66,198,138, 42,235,213, 34, 62,159, 63,159, 16, 18,254, 52,124,180,164, 82,169, 47,
+128,123, 20, 69,181,181,118,218,240, 79, 55,108,129, 0,101,101,101,208, 21, 38,193, 46, 63, 3, 29,101, 60,132,186, 58,192,201,
+201,233,137, 68,145, 90,173, 6,180, 5,184,112,225, 22,192, 48,112,118,118,134,179,179,243,223, 46,180,234,211, 34,255, 18, 76,
+168, 99, 95,195, 62, 90,161,158,152,108,111,194,234,137, 81,109, 68,173, 2,154,195,152,127, 13,183,242, 42, 49,247,217,110,201,
+124,137,163, 97,226, 27, 35, 35, 70,189,220, 18,253,122,116,165, 90,249, 56, 79, 93,182,234,135, 15, 66, 81, 60, 35, 89,137, 53,
+150,148, 40, 89,133,251, 28,148, 91,226,110,231, 79,106, 46,213,131,227, 8,226,238, 40,112, 39,187,108, 75,170, 10,247,173,169,
+ 93,168, 15, 6, 9,192,219, 67, 8,177,115,150,201, 42, 66,131,154,123, 12,122,174, 19,111,104,223, 8,136,248,192,133,223,111,
+225,147, 85, 7, 47,115, 28,137,186, 97,225,180,225,195, 21,134,143, 10,168,135, 43, 12,233, 71, 86, 24, 18, 66,200,195, 85,135,
+ 13, 27, 31,248,124,170, 80,151,115,213, 91,232,222, 14,250,204, 56,100,151,113,200, 81, 86, 64, 35,240,134,177,160, 0, 32, 92,
+238,185,134, 29,171, 27,132,135,135,135, 87,235,208,160, 54,223,111,219, 15,179, 78,141,251,241, 91, 81, 89,166,192,146, 13, 71,
+219,248,249,185,247, 45, 40, 40, 56,103,197, 96, 19,244, 91,204, 46, 47, 16,128, 47,148,224,248,250,189, 40,118,183,135,135, 84,
+ 4, 78,175,194,196,143,199, 57, 15,139, 28,231, 12, 0, 57,105, 55,209, 66,170,183,136,215,236,142, 81, 99,250,183,119, 1,173,
+199,182,147, 55, 13, 60, 96,232,246,211, 73,153,253,131, 93,236,198,244,106,225,186, 72, 94,254, 18, 74,154, 22, 84,180,218,162,
+ 85, 99,225,107,194,106,195,253, 0, 27,204, 33,115,207, 37,165,236,229,200,103,164, 34, 1, 69,145,202, 2, 16,123, 15,252,176,
+109, 95,165,152,182, 46, 19, 59, 7, 44,234,190,244,254,252,135,253, 4, 91,135, 45,189,246,110,236,231,207,122, 22, 22, 22,194,
+ 92, 53,119,120,191,148, 59,251, 70,100, 40,155,175,230, 76,167,151,189,248, 50,101,239, 41,158,249,245,246,120, 2,216,162, 73,
+219,240,175,134, 94,175,191,174,215,235, 59,204,156, 57,243,213,207, 62,251,172,143, 76, 38,107, 13, 0, 90,173,246, 62, 77,211,
+ 9, 85,255, 79,107, 86, 7, 18, 0,247, 50, 51, 51,239,103,102,102, 54,219,177, 99,135, 11, 0,187,170,239, 12, 0,202, 1, 20,
+225, 9, 86, 28, 86,139, 42,138,162,230, 63,173,118,168, 22, 85, 20, 69,181,109,202,249, 60, 30,143,165, 40, 10, 20, 69, 65, 34,
+145,224,252,249,243, 24, 29, 21,137,148,227,229, 8,119,113, 64,183,183, 38, 98, 79,108, 44,248,124, 62, 40,138, 2,159,207,183,
+234, 62, 34, 16, 8,112,225,194, 5,188, 62,246,101, 72, 4,128,179,179, 51,102,206,156,137, 35, 71,142, 64, 32,176,101,233,179,
+ 2,155,106, 9, 46, 11,227,104, 81, 88, 20,187,245, 43, 17, 88, 26,199,182,126,131,152,255, 99,239,188,195,162,184,218, 40,126,
+166,108, 99, 89, 58, 75, 47, 34, 17, 16,197,222,149,168,177, 37, 17, 99,139, 45, 49,182,168,196,104,212,152,216,141,198, 24,187,
+ 17, 99, 47,201,103,239,198,130, 73, 84, 18,123, 65,197, 2, 34, 32, 40, 74,239,157, 93,182, 76,249,254,160, 4,148,178,139,166,
+153,249, 61,207, 60,179,101,246,236,204,220,221,185,103,222,123,239,123, 35,138,180,209,153,152,231,147,137,160, 35, 40,228, 50,
+191,219, 29,120,238, 74,196,170,177,195, 2,228,111,117,239,133,183,186,117,167,155,182,237,186, 0,168, 98,180,122,162,150, 92,
+ 27, 44,135,111,182,253, 26, 53,241,224,133, 24, 2,186, 66, 12,235,221,150,103, 57,124, 83,199,193,188,160,105, 97,162, 56,120,
+229,250,117, 43,232,138,240,244,238,239,178, 6, 13,223, 0, 88, 29, 98, 99, 31, 97,253,174,159,184, 11, 55,163,247,104, 25,124,
+246, 56, 23,197,134,106,150,214,148, 12, 44, 76, 37, 62,111, 55, 53,255,133, 3, 15, 75,185,184, 49,207,177,176,148,139, 26,247,
+106, 44,255,133,231,121,222,204, 68,212,152,103,245,117,106,170,181,204,214, 93, 63,238, 88, 51,110,220, 56,211,172,164, 52,164,
+ 20, 68,160, 72,226, 12,189,220, 21,113,119, 47,169, 85, 26,198,144, 74,188,198,243,153,149,149,149, 17, 22,154,131,131, 91,150,
+ 65,175,213, 32, 35,169,212,171,166,100, 21,192,220,214,249,122,114,114,178,193,154, 58,134,203, 31,244,225, 4,177,137, 25, 76,
+ 70, 14, 10,144,196,101,107,208,202,201,172,244,162, 81,148,137,135, 33, 87,208,173,172,143,233,227, 68, 18,238, 45,156, 12,218,
+ 79, 51,153,248,179,119, 90, 59,227, 73, 66, 42, 46, 63, 72,222,245, 36, 7, 41,108, 84,234,174,184,148,188,192,254, 29,220,176,
+246, 68,228, 20, 64,191,223,152, 99,247,181,195, 8,158, 71,151,210,206,240,106,240, 64, 23, 95, 59,140, 48,112,164,225, 11,154,
+180, 24, 31,172,249,229,217,252,195,183,178,250,207,252,192,223,188, 83,167,119, 37, 96,180, 40, 84,107,244, 15,243, 80, 96,140,
+102,129,154,219, 10, 96,107,249, 27, 97, 73,220, 30,255,133,215, 47,237, 31,239,170, 44,247,234,151,226, 52,215, 1, 92, 31,219,
+222,100,129,184,251, 18,159,235,139,219,159, 9, 79,229,246, 94,138,171,200,161, 85,231,255,168,158, 8,154,130,230, 95,161,201,
+ 2,216,163,215,235,247,228,229,229,189, 74,205, 20,188,152,215,233,165,142,189,114, 51, 33,207,243,116, 89, 52,171,174,206,240,
+181,106, 86,110, 38,228,121,254,231,178,104, 86, 93, 81,173, 42,154, 28,199,165,180,105,211,198,186, 95,191,126, 96, 89, 22,143,
+ 30, 61,194,179,196, 68,244, 12,156, 2, 75, 75, 75, 92,186,127, 31,209,209,209,248,234,171,175,160,215,235,113,252,248,241,164,
+186, 52,105,154,214,189,241,198, 27,226, 1, 3, 6,128, 97, 24, 60,126,252, 24,201,201,201,152, 62,125, 58, 44, 44, 44, 16, 22,
+ 22, 86,161,153,149,149, 5,154,166,117,213, 68,183,254,140,223,210,191,157, 23, 76, 86,237, 70, 11, 96,193,234,145,127,110, 33,
+214, 93,134, 78,167, 71,227,200, 76,196, 71,254, 17,145,218, 76,133,222, 63,117, 63, 34,234, 73,216,213,183, 36,200, 8,135,177,
+119, 18,143,178,145,106, 38, 43, 44,132,174,208, 28,143,127, 65,124,122, 97,209,163,108,164, 26,125,199,192,177, 4,116, 42, 32,
+245, 54,174, 93,186,136, 11, 55,238,225, 86,120, 20,123, 45, 44,230, 32,201,225,155,135,217,120, 84,143,187, 16, 40,250,174,197,
+232,240, 88,183,182,222,246,110, 96, 25,240,156, 30, 22,195,246, 99, 76,100, 39,183,182,158,150,110,165,145, 44, 61,172, 62,254,
+ 29, 88, 35,171, 85,239,118,162,126,155,228,196,153,193,133,121,217, 29,122,116,237,104,106,225,251, 14,178, 98, 99,240,232,222,
+ 21,117, 88, 68,220,181,219,137,250,109, 47, 83,186,206,206,206,111,246,232,234,131, 97, 19,231, 64,167,202,199,227, 11, 63,162,
+ 40, 39, 13,151,175, 43, 16, 85, 80,208, 17,128,193, 17,173,235, 9, 76, 83, 36,228,162,115, 3, 81,130, 25, 52, 14, 31, 5,244,
+131,148, 40, 1,167, 41, 0,161,202, 66, 92,178, 54,127,240,150, 68, 22, 0,228, 82,130, 54,229,243,205, 13,138, 60,186,219,120,
+201, 41, 61,118,159,123, 0,142, 43,157,190,137,227,176,121,247,239,113,129,223,140,108,133, 38,110, 86, 45,238, 38,103, 16, 48,
+ 34,228, 79,240,240,191,117,240,235,198, 37,191, 45, 0, 56, 29,174, 76,181,110,236,191, 46,199, 31,245,156,110, 39, 34, 5,201,
+ 0, 2, 65,171,182, 78, 93,247,235,130, 54,231, 34,187,204,248,184,191, 57,248, 87, 50, 66, 55, 38, 50,141,125,179,253,242,103,
+103, 56,190,106,123,110,105,100,203,151, 79, 41,224,239, 94,138,211, 8, 89,225, 5, 4, 4, 0, 0, 69, 69, 69, 19,199,140, 25,
+179, 85, 36, 18, 41, 1, 16, 28,199,129,227, 56,122,213,170, 85, 34,150,101, 73,146, 36, 89,138,162,152,159,127,254, 89,207,178,
+108,102, 73, 73,201,196,186, 52, 25,134,137,155, 52,105,210, 27,117,141, 80, 60,112,224, 64,185,201,138, 19, 74,194, 32,147, 85,
+121, 93, 17,229,162,107, 9,210,126,221,121,228,194,133, 0, 8,240, 88, 20,153,137,248,231, 55, 9,207, 65, 74, 19, 74, 55,189,
+105,219,174, 11,203, 63, 99,236,158,149,176,236,251,109,155,121, 31, 0, 0, 13,207,142,172,207,209, 21,104,212, 67, 91,182,237,
+120,144,227,121,154,225,249, 29, 36,135,163, 37, 12, 30, 26, 50,210,174, 38, 82, 50,242,194,222,241,179,224,129,210, 38,195,138,
+230,194,178, 52, 14, 60,207,243, 21,205,133,171,101,200,202,215,212,153, 7,234,106,188,182,151,150,185, 53,225,236,213,187, 19,
+ 89,150,119,160, 40, 34, 77,173,101,182,190,172,201, 2,128,228,228,228,139, 33,231,146,207,222,111, 97,223,219, 86, 94, 22,229,
+ 82, 1, 89, 42,156, 77,206, 44,186, 88, 31,205,220, 98,125,255,185, 65, 39, 78, 74, 68, 20, 13,158, 47, 77, 40,202,243, 40,209,
+177, 57,215, 19,152,166, 0,208,204, 26, 78, 95, 30,103, 14, 80, 20,241,172, 46,189,208,232,212,181,195,150,135,124,241,224,105,
+238,142,167,121,136, 0,128,167,121,136, 56,116, 37,126, 65, 92, 90,225, 23, 17,207,114, 87,195,200,126, 21, 60,129,203,109,135,
+ 45,124,225,181,151, 61,159, 81,169,184, 7, 96, 32,144,212,107,216,140,245, 51, 8, 2,175,106,250,137, 24,181,142,119,127,254,
+197,242,200,150,112,173, 18, 16,248,103, 80, 30,213, 34, 73,114,241, 43,212,252,153, 32,136,119, 1,196, 26,241,177,208,162,162,
+162,102,175,248,240,178, 25,134,201, 54,100,195,191,161, 67,252,191,149,109,127,215, 23,247, 20, 52,255,122,205, 70,141, 26,241,
+ 70, 24, 22,225,124, 10,154,130,166,160,249,159,210,228,121,158,122,153,165, 6, 77,226,101, 22,161,140,254,245, 76,168,233,185,
+208,211,237, 53, 36, 54, 54,150, 16,206,130,128,128,128, 64,245, 16, 4,193,254, 9,154, 66,118, 60,129,114,131, 85, 37,186, 69,
+ 10,231, 68, 64, 64, 64, 64, 64, 64, 64,224,149,152,172,202,235, 82, 19,142,154,195,127,198,140, 38,168, 79, 8, 49, 68,208, 20,
+ 52, 5, 77, 65, 83,208, 20, 52, 5,205,255,156,102, 93,218,194,104,198, 63,217,128, 9,154,130,166,160, 41,104, 10,154,130,166,
+160,249,223,211,252, 55, 83, 99, 31, 45,161,233, 80, 64, 64, 64, 64, 64, 64, 64,224, 79, 66,232, 12, 47, 32, 32, 32, 32, 32, 32,
+ 32,240,114,212, 57,169,180,128,128,128,128,128,128,128,128, 64,253,168,125, 82,105, 1, 1, 1, 1, 1, 1, 1, 1,129,122, 99,
+252,164,210, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,177, 77, 56, 5, 2, 2, 2, 2, 2, 2, 2, 2,127, 13, 85, 71, 29, 6, 7,
+ 7,243,149,215, 2, 2, 2, 2, 2, 2, 2, 2,127, 37,175,171, 23, 17,154, 14, 5, 4, 4, 4, 4, 4, 4, 4, 94,142, 9,130,
+209, 18, 16, 16, 16, 16, 16, 16, 16,248,115,168,177,143, 86,121,194,210,110,101,161,186,110,194,185, 18, 16, 16, 16, 16, 16, 16,
+248, 27,120,189,189,136,208, 63, 75, 64, 64, 64, 64, 64, 64, 64,240, 34, 2, 2, 2, 2, 2, 2, 2, 2, 2,255, 36,132,185, 14,
+ 5, 4, 4, 4, 4, 4, 4, 4,254, 98,195,245,167, 27, 45, 97,102,115, 65, 83,208, 20, 52, 5, 77, 65, 83,208, 20, 52,255, 75,
+ 38,171,138,217, 18, 70, 29, 10, 8, 8, 8, 8, 8, 8, 8,188, 28,117,142, 58, 20, 16, 16, 16, 16, 16, 16, 16, 16,168, 31, 19,
+ 0, 4,148, 61, 14, 64,165,168,150, 16,209, 18, 16, 16, 16, 16, 16, 16, 16,120, 57,182, 1,112, 44, 51, 88,167, 1,164, 10, 70,
+ 75, 64, 64, 64, 64, 64, 64, 64,224,213, 80,185, 95, 86,223, 74,230, 75, 48, 90, 2, 2, 2, 2, 2, 2, 2, 2, 47, 73,141,125,
+180, 8,212, 60,114, 32,196,136, 47,168,207,232,131, 16, 65, 83,208, 20, 52, 5, 77, 65, 83,208, 20, 52,255,115,154,117,105,135,
+224,223,199, 4, 99,204,215,171, 68, 24,250, 42,104, 10,154,130,166,160, 41,104, 10,154,130,230,127,150, 87, 62,234,176, 21, 96,
+ 34,156,214,215, 18,251,178, 69, 64, 64, 64, 64, 64, 64,160,118,254,156, 81,135,190,192,199, 31,250, 41,183,232, 35, 50,205, 35,
+ 0, 85,109,219, 42,149,202,173,114,185,252, 67,149, 74, 85, 76, 16, 4, 87,254, 58,207,243, 0, 80,121,174,163,199,153,153,153,
+254,117,125,183, 68, 34, 9,178,183,183,255,184,168,168, 72, 69, 16, 4, 79, 16, 4, 8,130, 0,128, 23,214, 44,203, 38,101,103,
+103,183,249, 87, 23, 33,207, 83,182,246,246, 55, 69, 20,229,108,236, 71, 89,142,139,207, 72, 79,239,104,196, 71,150, 17, 4,102,
+150,126, 45, 86, 2,152,243,186,253, 35,120,128, 50,100, 59, 63,192, 44, 6, 24,198,146,228, 20, 17,176, 81,195,113, 91, 0,128,
+ 0,216,250,126,183, 38, 20,111, 16, 60, 90, 16, 4, 44,120, 30,249, 60,129,123,210,246,136,251,155, 78,197, 32,145, 72,212,223,
+220,220, 92,145,157,157,125, 17,192, 1, 0,195,109,108,108,186, 22, 20, 20, 20,233,245,250, 19, 0,142,213, 71,216,191, 5,102,
+ 73,196,162,177, 37, 58,253,138,171,247,240, 99,215, 86,176, 97, 56, 44,151,137,105,127,141,150, 89,121,229, 62,118, 24, 41, 73,
+148, 45,229,215, 12,163,231, 72, 59,108, 96,185, 3,192,113, 43, 43,111,169,210,252, 55,145,132,138,207, 75, 47,250,240,253,140,
+140,196, 33, 47, 81,238,255, 68,108,109,109, 71,147, 36,249, 45,207,243, 96, 89,118, 94, 78, 78,206,206, 87, 36, 61, 15,128,101,
+217,227, 60, 0,223,190,164,222, 51, 0,110,101,143, 19, 0,184, 11,245,122,189,217,252,211, 79, 63, 5,118,239,222, 29,107,215,
+174,197,230,205,155,159,102,102,102, 46, 7,176, 11,128,246,111,208, 17,168,137, 38,192,187,171,250,180,103,245,255,251,134,171,
+244,114,207, 26,254,204, 63,124,244,209, 71, 58,158,231,249,232,232,104, 94,171,213,242,122,189,158,103, 24,134,103, 24,134,215,
+235,245, 21,139,179,179,115,242,115, 31,127, 65,147, 36,201,117,131, 7, 15, 46,228,121,158,191,125,251, 54,175, 86,171,121,141,
+ 70,195,107,181, 90,190,164,164,132, 87,171,213, 85, 22,123,123,251,244,218, 52,205,205,205,111, 91, 89, 89,165, 91, 89, 89,165,
+ 91, 91, 91,167, 91, 91, 91,167,219,216,216, 84, 44,182,182,182, 21,139, 82,169, 76, 87, 42,149,233,214,214,214,183,235,218,207,
+ 50,250, 0,184,104,192,210,167,154,207,246,172,108,180, 28, 29, 29,211,249,122,224,226,226,146,104,192,126,150, 99, 79, 16, 96,
+203, 63, 75, 16,224,164, 82,169, 91,229,247,241, 98,164,171,206,144,178,147,147,211, 96, 71, 71,199, 16, 71, 71,199,115, 78, 78,
+ 78,131, 13,248,137, 85,209, 52, 51, 51,187,109,107,107,155,238,224,224,144, 81,190, 56, 58, 58, 86, 89,156,156,156, 42, 22,123,
+123,251,116, 43, 43,171, 26,203,136, 7,168,154,150, 11, 0, 45, 5,222,162, 41, 42,216,222,222,190, 32, 60, 60,156,229,121,158,
+ 39, 73, 50,185,124, 27, 99,142,253,121,147,165,186,130,121, 89,231,165,161, 69,241,203,243,179,206, 75, 67, 85, 87, 48, 79, 19,
+138, 55,234,171,105, 32,213,105,142, 26, 53,106,212,189,244,244,244,228,188,188,188,212, 45, 91,182,196,200,100,178, 43, 91,182,
+108,137,201,203,203, 75, 77, 79, 79, 79, 30, 53,106,212, 61, 0,147,140,208, 4, 0,116,108,129, 14,227, 6, 57,170,238, 29, 31,
+169,122,171, 45,125,183,179, 31, 2,122,117, 20, 39,111,152,237,171,186,180,189,139,170,123,107, 50,194, 72, 77,130,166,233, 78,
+110,110,110, 99,149, 74,229, 71,101,203,200,242,197,193,193, 97,164,131,131,195, 72, 43, 43,171, 33,181,105, 30, 6, 40, 67, 22,
+ 87,153,172,211,144,134,110,170,103,139, 23,241,225,211,166,240, 99, 61, 93, 11,222,183,179,107,240, 55,148,209,159,170,105,103,
+103,151,162,215,235,121,157, 78,199,219,216,216,164,188,194,253, 92,205,243,252,106,158,231, 87, 3, 88,253, 10, 52, 43,174,103,
+ 70, 24,236,218, 52,101, 52, 73,206,144, 75, 36,231,164, 52,157, 33,165,233, 12,185, 68,114,142, 38,201, 47, 0,200,254, 73,101,
+244, 39,104, 42,148, 74,229,147,160,160, 32, 94,165, 82,241, 42,149,138, 15, 10, 10,226,149, 74,229, 19, 0, 10, 35, 52,235,171,
+243, 58, 69,176,158, 95, 94, 93, 68,203, 23,104,243, 86,139, 70, 71,167,142, 30, 6,238, 72, 16, 81,199, 29,211, 15, 29,219,180,
+ 25,187,107,215, 46, 0,192,135,253,251,163,119,187,118, 48, 83,152, 66, 34, 41,221, 29,130, 39, 32, 22,137, 49, 96,250,231,134,
+124,253,202, 1, 3, 6,124,112,228,200, 17, 5, 0,108,222,188, 25,131, 6, 13,130,181,181, 53,228,114, 57,196, 98, 49, 68, 34,
+ 81,149,117, 93, 80, 20,229,146,156,156,108, 39,147,201, 42,162,108, 28,199, 85, 89,120,158, 47,143,190,129, 97, 24,120,121,121,
+ 25,122,186,102,231,231,231,191, 89, 92, 92, 92,161, 81,221,210,176, 97, 67, 0, 56, 99,136,224,183, 75,190, 1,199, 20,131,166,
+ 1,134, 1, 52, 58, 18, 28, 95,173,185,193,164, 73,147, 42,246,187, 62,244,237, 27, 64, 16, 4,113, 36, 44, 44,236,104, 70, 70,
+134, 7,199,177,227,235, 25,233,250,244,209,163, 71, 10, 0,240,246,246,158, 4,224,168, 49,251, 65,211,180,203,253,251,247,237,
+164, 82,105,141,145,203, 74, 17, 76,232,116, 58,180,106,213,138, 49,230, 59,236, 1,183, 28,146, 28,223,178,117,235, 9, 11, 7,
+ 12,144,221,188,121, 83, 70,146, 36, 24,134,193,170, 85,171, 24,158,231, 45,155, 0,230,145, 64, 65, 45, 50,115, 1,140, 46,171,
+ 12,118, 0, 88, 85,197, 45,240,104,161,214, 75, 3, 30, 23, 13,104,215,190,193, 44, 68, 62, 8,111,231,169, 56, 14, 51, 90, 19,
+ 7,252,181, 81, 45,115,115,243,254,107,215,174, 85,238,216,177,163, 32, 58, 58, 90,183,101,203, 22,229,196,137, 19,205,116, 58,
+ 29, 2, 3, 3, 51,125,124,124,196,107,215,174, 85, 30, 59,118,236,173,226,226,226, 77, 70,149, 23,129,111,134,247,239,141, 18,
+ 61, 9,189,158, 81, 58, 42,205,246, 76, 29,213, 77,196,243, 90,236, 62, 17, 6, 61,195,253,104,100, 36,171,227,251,239,191,239,
+185,127,255,126, 58, 42, 42,138,110,220,184, 49, 56,142, 3,203,178,208,235,245, 0, 0,142,227,208,168, 81,163,151, 62, 47, 99,
+ 1,111, 91,123,235,115, 29,223,125,199,196, 81, 38,133,117,110, 38,198,137,105,179,157,114,205, 94, 0,157, 94,171,200, 46,207,
+131,166,105, 36, 38, 38,194,206,206,206,132,227,184, 84, 0,139,114,115,115,183,225,245,165,157,132,166,143,238,254,113,157, 67,
+251, 78,157, 40,123, 71, 59,196, 60, 74, 0, 77,176, 61,239,223, 10,235, 54,246,147, 25, 83,181, 12, 51, 24,192,205,215,237,192,
+ 29, 58, 77, 26, 72,144,212,102,130,231,240,245,134,147,133,203, 86, 6,201, 3,199,143,162,166, 79,159, 14, 87, 87, 87,143,129,
+ 3, 7,174, 4,240, 73,157, 58,237, 39, 13, 4, 69,110, 6,207, 99,225,250,147,133, 75, 87, 6,201, 63,169,135,206,191,156, 26,
+255, 35, 47,109,180,124, 1,207,166,174,118,103,151,205,252, 68,196,255,242, 63, 82,149,157, 81,227,182, 74,165,114,235,219,111,
+191,253,225,206,157,127, 68,163, 59,250,249, 97,224, 91, 93, 96,103, 99, 1,185,169,164,180, 58,226, 8,220,139,142, 55,200, 16,
+184,186,186, 6, 30, 61,122, 84, 81,217, 76,136,197,226,138,165,178,201, 42, 95,202, 43,224,218,144,201,100, 8, 9, 9, 1, 77,
+211,160, 40, 10, 52, 77, 87, 44,149,159, 83, 20, 5,123,123,163,186, 46, 45,183,176,176,104, 94, 88, 88,104,158,151,151, 7, 55,
+ 55,183, 2, 0,247, 43,189,223, 60, 51, 51,211,220, 24, 65,142, 41,198,244,113,190, 16,105,111, 64, 43,106, 7, 53,221, 25,215,
+110, 61, 68,240,153,139, 72, 78, 73, 67,151, 14, 45,241,209,136,247,113,238,220, 57,176,172,209, 45, 29,233, 60,143,149,253,250,
+ 5,204, 2, 8,162,103,207,158,121,147, 39, 79, 38,163,162,162, 62, 24, 56,112,128,223,163, 71,177,101, 81, 69, 98, 38,207, 99,
+ 29,128,116, 3,117, 37, 0,112,233,210, 37, 0,144,214,231,183, 39,149, 74,113,253,250,117,148, 55, 19,147, 36, 9,146, 36, 65,
+ 81, 20, 78,197,218,162, 88, 75, 66,149, 30,129, 41, 1,110,104,216,176, 33, 72,178,238, 46,137,221, 0,217, 53, 96, 32, 33, 18,
+ 77,119,116,114,242,232,234,233, 41, 15, 9, 9,161, 0,192,221,221,157, 79, 77, 77,205, 59,113,226, 68, 33, 13,108,118,231,249,
+ 93,181,153, 44, 87, 87,215,206,201,201,201,223,150,159,115,130, 32, 86, 54,104,208,224,171,138,114,227, 56, 44,250,177, 88, 52,
+117,234, 52,113,251,110,243, 1, 0,237,251,237, 71,193,227,101,190, 68,206, 92,139,191,250, 42, 81, 80, 80,112,176, 81,163, 70,
+ 84,118,118,246, 53, 0,207,244,122,253,236, 61,123,246,216,141, 27, 55, 46, 99,239,222,189,203, 1, 56,173, 88,177,162, 91,113,
+113,241, 33, 99,116,187, 52,199,187,173,155,251,117,112,115,117,197,197,107, 55, 33,150,136, 44, 39,141, 14,128, 66, 65, 99,245,
+142,211,220,179,164,156,201, 87,238, 99,151, 17, 38,171,221,251,239,191,239,177,127,255,126, 9, 0,220,191,127, 31,105,105,105,
+ 80, 42,149, 48, 49, 49,129, 72, 36, 2, 69, 81, 16,137, 68,175,196,100, 89,184,218,132, 30, 63,126,194,196,218,218, 18, 27, 62,
+159,138,143, 50,210, 97,105,166,128,190,168,216,227, 53,171, 40,188,253,253,253,101, 44,203,162,184,184, 24, 23, 46, 92,176, 48,
+ 49, 49,177,112,113,113, 89, 8, 35, 70, 79,201,100,178,244,146,146, 18,187,178,199, 25, 37, 37, 37,246, 0, 10,164, 82,105,249,
+117,186,168,108,109,104,115,226, 51,188,216, 76,152, 64, 16, 68,229,215,234, 75,219,118,109,155,135, 28, 59,178, 79,145, 95,152,
+ 6, 75,171, 12,144,200,199,182,109, 27, 97, 98, 98,142,133, 11,231,210,241, 61,223,114,238,243,238,224,144, 7, 15, 99,122,190,
+118,102,139, 39,182,245,236,247,161,181,137,220,172,172, 46,209, 99,231,246,169, 32, 73, 18, 95,125,245, 21,154, 54,109, 58,225,
+193,131, 7,243, 1,228,212, 46,131,109,205,222, 28,106, 45,145,149, 22, 49,199,234,177,229,192, 23,165, 58,115, 38, 98,120,191,
+134, 19,190,124,255,201,175, 77, 61, 81, 88,118, 99,174, 22,145, 72, 32,218,163,194, 48, 4, 7, 7,119, 13, 8, 8,184, 88,211,
+243,127, 1,142,248, 35,127, 86, 21,243, 69, 7, 7, 7,243, 1, 1, 1, 68,165,131,171,242,188, 54, 90, 0,182, 86, 22,242,144,
+205,139,166, 42,232, 27,167, 41,117, 66, 44, 82, 74,170, 84,228, 85,134,104,202,229,242, 15,119,238,220, 89, 37,164,228,102,111,
+ 7,177, 88, 4,145,152,128,165,127,105,246,250,188,203,193, 32,136, 26, 77, 86, 21,205,226,226,226,146,187,119,239, 42,118,236,
+216, 1, 59, 59, 59,120,120,120, 64, 46,151, 67, 38,147, 85, 49, 87,149, 13, 87, 53, 70,171,138,102,249,251, 52, 77,131, 36, 73,
+156, 59,119, 14, 12,195,224,253,247,223,127,193,100,209, 52, 93,147,113,171,105,120,234, 25, 0,247,121,158,127,179,172, 2,190,
+ 15,160,107,165,247,251, 40,149,202,217, 0,150, 27,170, 73, 81, 60,168,146,107,224, 92,130, 64, 39, 78,133, 86,212, 2,231,175,
+132, 97,231,214,181, 0, 0,143,198,109, 49,100, 96, 64, 69, 52,206,192,253,172,192,217,217,249, 64,102,102,214, 59,111,189,245,
+ 22,114,115,115,245,139, 22, 45, 66,243,230,205,225,237,237,109, 80, 25,213,112,231,156,126,255,254,125, 87,181, 90, 13,158,231,
+ 13, 49,103, 47,104, 18, 4,129, 61,123,246,160,164,164,228,133,141,173,186, 46,197, 23,131,220, 49,102,202, 46,172,140, 62,132,
+ 77,155, 54,213,122,236,114,160,121,137, 69,163,117, 18,138,105,190,124,238,167,210,143, 62,250,136, 26, 51,102, 12, 18, 18, 18,
+ 48,110,220,184,146,115,231,206,105,211, 82, 83, 79, 72, 56,110,131,174,170, 49,174, 81, 83, 42,149,238, 62,115,230, 12, 14, 29,
+ 42,245, 37, 49, 49, 49,240,242,242, 50,173, 98,146,115, 14,163,240,217, 6,132,158,138, 66,251,126,251, 17,122,106, 4,216,188,
+211,162, 54, 94,200, 55,230,124,214,131,234, 52, 15,101,103,103, 87,152,168,189,123,247,154,236,221,187,119, 0,128,147, 0, 14,
+ 1, 64, 78, 78,206,119, 70,106, 2, 4,198, 12, 29, 52, 0,180,216, 12, 81,177, 73,232,218,177, 21,236,237,236,112,255, 97, 28,
+158, 37,231,164, 19, 4, 70,247,233, 36, 89,174, 86,107,231, 95,190,135, 31,234,208, 36, 92, 92, 92,188, 15, 31, 62, 44,174, 20,
+129,174,248,143, 83, 20, 85,241,188,220,120,215,231,247, 89,110,178,204, 92, 20,161,223,108,236,108, 26, 26,190, 23, 94,238,239,
+194,234,221, 0,252,112,246, 44, 30, 61,136, 44,209,170,152, 30,127, 67, 25,253, 89,154,222,131, 6, 13,186,182,111,223, 62,203,
+196,196, 68, 92,186,116, 9, 30, 30, 30, 80,169, 84,134,220,240, 86,209, 44, 41, 41,177, 43,255, 12, 65, 16,118,229,129,119,173,
+ 86, 91, 94, 24,229,127, 68,203, 74,219, 89,214,162,233, 86,105,187,114,115,229,254, 10,142, 93, 34, 19,139, 15, 31, 63,118, 64,
+ 17, 25,117, 9, 45, 91,116,128,194,162, 9, 56, 54, 13,217, 57, 69,200,141, 77,193,146, 37, 43,177,112,209, 60,156,252,233,136,
+194,199,183,197, 81, 45,195, 52, 2, 80,242,218,148, 59,193, 79, 8, 57,181,119, 51,193,115, 80,167, 71, 73, 69,197, 79,228, 31,
+142, 24, 76, 13, 27, 54, 12, 39, 79,158,196,131, 7, 15, 54,215, 98,178, 66, 42, 69,230, 39, 68, 92, 58,180, 25, 60, 15,117, 70,
+148, 84,172,126, 34, 31,245,193, 16,234,163,225,189,113,227,247,117,232,221,242, 73,132,147, 29, 6,230,150, 89,108,154, 66,182,
+ 84,134,171,124, 40,110, 84, 50, 91, 23, 0, 16,149, 12,214, 5,252,209, 7,243,223, 64,223, 50, 99, 53,225,249, 27, 19,186, 62,
+ 6, 11, 0,188, 0, 5, 33, 17,135,238, 92,248,169,147, 60,225, 1,173,137,184,142, 20, 13,199,111,121,202,112,173, 0,147, 59,
+128,250,249,207,168, 84,170,226,184,184, 56,147,209, 3, 7,162,147,159, 31, 28,109,108,208,200,197, 5, 38, 82, 9, 36, 98, 81,
+149, 91, 86,131,219, 16, 8,130,247,241,241, 65,191,126,253, 32, 18,137, 32,151,203,161, 80, 40, 32,145, 72,170,141,102, 25,122,
+151,203,243, 60, 40,138, 66, 68, 68, 4,158, 61,123, 6, 75, 75, 75, 92,189,122, 21, 61,122,244,120, 33,170, 85,217,156, 25, 19,
+162,175,166,226, 47, 55, 98,103,140,209, 98, 89, 2, 69,124, 11,200,158, 78,134,138,104, 5,141,134,129, 70,163,193, 15, 87,116,
+184, 25, 87, 12,157, 78, 11,141, 70, 83,219,119,214, 4,233,228,228,244, 97,163, 70,141, 38,141, 24, 49, 66, 47,145, 72, 80, 92,
+ 92, 12,149, 74,133, 7, 15, 30,232,223,121,231,221,188,126,253, 2, 44, 78,159, 62,205,151, 53, 29,166, 27,161,157,237,236,236,
+236, 90,214, 60,155, 93,159, 95, 53, 65, 16, 21, 38,230,121, 70,127, 23, 9,154, 42, 45,147,205,155, 55,131,101, 89,240, 60, 95,
+ 99, 33,149, 16,196,111,139,150,174,177, 88, 17,244, 35, 44,172,237,113,241,226, 69,246,215, 95,127, 45, 36,128,152, 71, 15, 30,
+124,247, 30,240,243, 97, 64,103,204,254,229,230,230,154,120,120,120,192,197,197, 5, 28,199, 65,175,215, 87, 68, 95,178,179,179,
+161, 86,171, 97,109,154,135, 55,108, 92,192, 20, 94, 64,106,196,215,112, 84, 68, 97,215, 25,173,190,181, 55,238,253, 3, 46, 28,
+255, 43, 91, 94,242,174, 25,206,118, 14,174, 32,121, 61, 82, 50,178, 49,160,111,111, 80, 98, 5,226, 19,179,208,162,137,167,227,
+ 7,239,117,118,164, 8, 6, 51,151,239,159, 4,112, 63,212, 37, 87, 84, 84,196, 70, 69, 69,225,254,253, 82,191,107,110,110, 14,
+ 83, 83,211, 42,255,113,146, 36, 95, 42,162, 85,110,178,150,110,238, 97, 74,138,138, 81,192,134, 96,199,158, 48,180,240, 9,192,
+150,208, 91, 37,108,122, 78,207,213, 37, 37, 49, 7,254,197,193, 12, 7, 7,135,137, 28,199, 45,228,121, 62,175, 75,151, 46,246,
+251,247,239,183, 74, 78, 78, 70, 88, 88, 24,190,250,234,171, 76,150,101, 25,158,231, 9,158,231,191,126, 5, 95,199, 85, 50, 88,
+175, 18,145, 92,134, 41,182,230, 68,127,154, 52,247, 96, 10,138,226,179,180,252, 9, 21,195,173, 7,160,175,245,226, 70,146, 31,
+ 31, 57,184,217,201, 86,201,161,155,242, 45,164,166,235,176,244,243, 81,200,206, 46,196, 15,219,151, 1,144, 64,199, 80,120,179,
+219, 96,216,217, 57, 99,194,248, 9, 14,155,183,110,249,148,225,184,213,120, 77, 72,187,182,233, 39, 0, 33, 74,165,242,193,167,
+ 19, 38, 40, 61, 60, 70, 66, 38,147,225,192,129, 3,216,191, 97, 3, 27, 4, 12,145, 2,231, 3,129,159,106,213, 9,253, 67,103,
+106, 96,160,210,215, 55, 16, 82,169, 20,191,255,250, 63,148,164,237, 41,236,219, 9, 58, 85, 9,250, 54,232,199, 91, 63, 61, 69,
+228,136, 68,136, 5, 0,145, 12,169, 0,158,111, 6,251,183, 25,172,114, 78,227,143,126, 89, 19,170, 68,180,234,125,237, 20, 73,
+194,183, 79, 27,238,110, 15, 13,161,189,114, 10,201, 26,142, 93,241, 72, 71,221,201,231,191,120, 88,141,201, 42,251, 97,115,110,
+110,110,120,171, 77, 27, 12,244,247, 7, 77,211,144, 73,196, 48,147,153,128,103, 75, 35, 89,229, 77,135,181,212,137,168, 46,250,
+100, 99, 99, 3,177, 88, 92, 97,176,140,136,102, 85,171,201,113, 28,104,154,198,253,251,247,209,165, 75, 23,184,186,186,226,208,
+161, 67,232,211,167,207, 11, 77,137,198,154,172,114,163,245, 92, 51, 94, 31, 0,229,145, 44,163,140, 86,137,150, 64,150,182, 5,
+ 8,194, 15, 12, 3,176, 60,160, 41, 41, 1,207, 3, 60, 15,232,117, 90,148,148,148, 84,124,167, 33, 77,178, 14, 14, 14,110, 38,
+ 38, 38,139,103,205,154,233,219,162, 69, 75,100,102,102,130,227, 56,152,154,154, 66,165, 82,193,220,220, 28,157, 58,117,138, 95,
+188,120,113, 42,207, 99,130,145, 38,235,165, 41, 63,231,103,207,158,173,210,108, 88,190, 20,167, 38, 97,204,103,123, 33,161, 75,
+155,150,202,251,240,212,118,221,237,254,102,103, 92,187, 19,195,124, 60,115,157, 70,148, 29,182,220,129,227,118, 38,189,196,113,
+241, 60,143,172,172, 44,164,167,167,163,255,128, 1,216,191,111, 31,158, 62,125,138, 38, 77,154,160,123,247,238,176,179,179,195,
+211,167, 79,113,243,178, 6,154,220, 28,228,104,195, 32, 55,107,143,227, 23,227, 52, 95,109,214,197,253,141, 23,140,254, 0, 70,
+153,155,155, 55, 84,169, 84,169, 12,195, 28, 6,112, 24,192, 16,154,166,135,200,229,114,199,130,130,130, 39, 40, 29, 77,116,162,
+ 46, 49, 19,153,204, 70, 42, 51, 7,199,104, 64,211, 52, 92, 93, 61,192,179, 90,228, 22,168, 49,122, 88, 63,220,185,255, 16,191,
+158,191,193,232,245,220,247,134,156, 86,138,162,120,111,111,111,100,100,100, 64, 36, 18,193,196,196, 4, 10,133, 2,115,230,204,
+193,134, 13, 27, 42, 76, 86,125,141,214, 88,192,219,220, 77,113,227,219,141,165, 38, 43, 45, 37, 21,233, 73, 34, 40,109,236,241,
+253,134,160,226,220,167,105,237,127, 4, 98,254,237,149, 44,199,113, 95, 39, 39, 39,219,209, 52,237,192, 48, 12, 18, 19, 19,113,
+251,246,109, 76,158, 60, 57, 61, 59, 59,187, 27,234,121,140, 50,153, 44,163, 60,146, 85,214,116, 88, 83,115, 98, 94,165, 72, 86,
+ 94, 45,146, 53, 53, 19,122,122,184,152,157,219,190,118,186, 91,219,246,157, 72, 57,109,158, 91, 20,155,214,229,202,165,139,157,
+ 38,175,253,225,211,103,185, 69,189, 1, 60,174, 73, 84, 42, 18,189,211,161,115,103, 26,124, 58,104, 73, 23,172, 92, 49, 12,153,
+ 89, 5,200,205, 41,132, 88,108, 10,173,158, 2,203, 17,232,212,197, 31,255,219,117, 16, 77,199,143,163, 36, 34, 81, 47, 70,171,
+125,109,140, 86, 25,203,214,175, 95,239,230,227,227,131,157, 59,119,226,252,238,221,248, 40, 63, 31, 23, 73,146,210,139, 68,182,
+ 63,235,245,219, 80,135,209,170,172,211,180,105, 83,252,248,227,143,216,179,103, 79,194,135, 61, 50,142, 78,255, 16,118, 58, 29,
+222, 14,139,134,117,131,126, 64, 88, 52,172, 91,251,160, 17, 67, 35,150, 32,170,166,131, 10, 14, 14,238, 90,121,253, 47, 35, 21,
+ 53, 52,177,211, 0,186, 5, 7, 7,243,149,215,117, 94, 56,149, 94,129,203,122, 55,116,247,123,195,141,208, 31, 90,135,196, 98,
+ 70, 59, 63, 90, 39,121, 84,196, 79,127, 8, 4,213,114, 7,193, 83, 20, 5, 51, 19, 19, 40, 45, 45, 75,195,252, 36, 9,112, 0,
+167, 7, 8,182,212, 0,240, 28, 1,158, 53,234,130, 1,137, 68, 82,109,199,119, 99,251,102, 85,214, 44, 44, 44, 68,124,124, 60,
+ 38, 76,152, 0,185, 92, 94,234,220,211,210,224,238,238, 14,154,166,145,156,156,140,223,127,255, 29, 13, 27, 54,132, 84, 42, 53,
+202,109, 85,138, 46, 53, 71,233, 40,195,230,169,169,169,230,142,142,142, 48, 58,162,197,241, 80,105, 8,104,181, 44, 30, 61,122,
+132,148,148, 20,196, 63,137, 69,219,226, 2,240,160,192,243,188, 81, 17, 45,103,103,103, 63, 79, 79,207, 45,203,151, 47, 23,187,
+184,184,128,231,121, 88, 89, 89, 66,165, 82, 33, 43, 43, 27, 77,154, 52,129,171,171, 43,150, 47, 95, 14, 0,251,255,106,147,245,
+220,111,170,194,104, 85, 54, 92,159,189,231,134,156, 28, 5, 40,138,172, 48,206,117,244,209, 18, 3, 64,183,222,131,232,115,191,
+254,108,202, 0,139,211, 40,106, 49, 93,119, 57,234, 89,142,147,215,244,126, 98, 98, 34, 68, 34, 17,142, 28, 62,140,156,244,116,
+180,104,209, 2,237,218,181, 67,108,108, 44,238,220,185, 3, 27, 27, 27, 40, 93, 58,226,226, 19, 29, 34, 83,212,176,176,176, 64,
+ 92, 18,249,119,166, 12, 24,223,179,103,207,175,190,251,238, 59, 59, 7, 7, 7, 81,102,102,166,207,198,141, 27, 91,108,220,184,
+113,234,167,159,126,106,255,233,167,159, 90, 41,149, 74, 58, 45, 45,205,251,243,207, 63,111, 29, 18, 18,210, 16,192,154,218, 4,
+ 77, 77,205,172, 41,177, 41, 8,130,134,165,133, 21,104,137, 41, 56,134, 6,203, 1,230, 22, 74, 92,187,115, 4, 87,195, 11, 39,
+102,100,227,176, 65,241,177,178,114,183,177,177,121, 33, 82, 61,121,242,100,108,223,190,189,162, 25,177,190, 38,107,233,198, 30,
+ 10,162,204,100,165, 37,210, 32, 52, 13,113,234,167,235,121,185, 79,211,186,188, 14, 38,171,252, 26,199,243, 60,158, 60,121, 2,
+149, 74,133,203,151, 47,227,235,175,191,206,124,222,100,217,217,217,141, 55, 55, 55, 95, 84, 84, 84,180, 50, 45, 45,109, 93,157,
+ 55,126,165, 38,170,252,113,249,186,218,230, 68, 3,119,213,189,186, 72,150,171,163,236,204,157,203,123,221, 45,248,123, 4,158,
+ 77, 0, 30, 21, 60, 48, 11,181,123,243,221,182,125,201, 86,155,190,105,208,110,226,156, 51,137, 5, 37, 62, 53, 69,182, 56,150,
+109,101,170, 48, 3,144,129,176,219, 23, 42, 76, 86,118, 78, 62, 52, 58, 10, 26, 45,129, 18, 29,137,183,122,190,141, 13, 91,246,
+ 32, 57, 35, 7, 44,203, 54,123,205, 76,150,181,159,159, 95,224,144, 33, 67,176,120,241, 98,132,124,247,157,246, 19,130, 40,160,
+ 1,254, 52,203,130,227,121,130, 52,172, 19,123, 21,157,213,171, 87,255, 4,200,224,209, 35, 0, 0, 32, 0, 73, 68, 65, 84, 96,
+248,242,201,232,152, 91,132,209, 78,253,120,235, 6,253, 74, 55,124,127, 22, 15, 0,214,153, 33, 85,171,204,128,128, 0,162,188,
+101,205,216, 22,182,127, 58,116, 64, 64,192,197,224,224, 96, 84, 94,215,246, 1, 51,123,159,119,191,156, 49,105, 69,219, 62,254,
+ 68,234,140, 94,200, 41, 40, 97,230, 70,234, 36, 73,234,218, 77, 86,101,190,220,184, 17,119, 98, 74,255,199, 46,118,118,152,249,
+193, 7,224, 25,224,234,131, 72, 28, 12, 9,193,176,158, 61, 97, 42,147, 25, 28,217,224, 56,174,218, 40, 86,229,104,150,177, 81,
+167,188,188, 60, 28, 62,124, 24,237,218,181,131, 92, 46, 7, 77,211,104,222,188, 57, 30, 62,124, 8, 79, 79, 79, 16, 4,129,227,
+199,143, 99,224,192,129,120,252,248, 49, 58,118,236,168,120,246,236,153,209, 70, 43, 50, 50,210,156,231,249, 55,203,163, 31,245,
+ 69,163,209, 32, 42, 42, 10,253,250,245,131,149,149, 21,156,157,247, 35,228,204, 94,200,253, 62, 2, 65,192, 40,163,197,178,236,
+216,190,125,251,138, 9,130,128, 90,173,130, 76,102, 2, 83, 83, 5,204,204,204,225,237,237,131,148,148, 20,244,233,211, 71, 27,
+ 23, 23,183, 41, 53, 53,245,144,177,251,234,235,235,107,250,244,233,211,143, 26, 52,104, 32, 1, 0, 19, 19,147, 38,158,158,158,
+ 95, 60,126,252,184,208,216,168, 86,185,193, 34, 8, 2, 20, 69, 85, 24, 45,154, 36,225,232, 96, 87,241,188,172,127, 26, 81,139,
+ 86, 65,114,182, 70, 10, 0,110,110,110,216,176,245, 36,217,183,111, 95, 76,157, 58, 21,122,189, 30,155, 54,149, 14,178, 27, 49,
+ 98, 4,116, 58, 29,142, 30, 45, 29, 36, 73,211,116,173, 97,147,219,183,111, 35, 44, 44, 12,122,189, 30,249,249,249,248,229,151,
+ 95,112,241,210, 37, 28, 56,254, 27,158, 62,137, 69,115, 31,119,140, 27, 55, 22, 34,145, 8,187,118,237, 66,151, 46, 93,254,214,
+ 11,130, 72, 36,250,112,251,246,237,142, 59,119,238,204, 59,126,252,120,113,135, 14, 29,164, 65, 65, 65,118, 27, 54,108, 80,106,
+181, 90, 76,155, 54, 45,227,198,141, 27,154, 1, 3, 6,152,110,219,182,205,241,141, 55,222,232,197, 48, 76,117, 70,203, 20,192,
+ 48, 0, 35,115, 11,181,116, 94,161, 26, 28,163,197,147,167,241,200, 47,210,130, 99,117, 72, 72, 74, 65, 81, 9,139,236,156, 66,
+ 52,111,213,123,253,133, 11, 23,230,233,116,186,185, 0,130,235,218,207, 7, 15, 30,224,198,141, 27,120,250,244, 41,158, 60,121,
+ 82,213, 41,142, 31,143, 61,123,246, 24, 29,209,170,222,100, 81, 32, 52,158, 8, 62, 30,154,151, 17,155,250,218,152,172,178,107,
+208, 66, 71, 71,199,133,142,142,142,178,179,103,207, 90, 52,104,208, 0, 12,195,104,159,143,100,117,235,214,109,254,246,237,219,
+ 29, 61, 61, 61, 39, 3, 88,247, 79,216,119,146,196,248,149,155, 3,109,205, 36, 9, 41,120,180,166, 44,151, 32, 5,168, 10,128,
+ 11,251, 64,119, 94, 16, 63,121,192, 44,171,217, 59, 23,143,231,192,213, 56, 66, 54,238,113, 34, 54,111,222,128,233,211, 70,227,
+127, 63,172, 4,199,209,208,232, 41,184,121,116,128, 70,199,129, 32,105,180,104,213, 6,231, 47, 92,134,136, 4, 14,239,220,252,
+154,249, 44,228, 68, 68, 68,108, 58,126,252,248,148,169, 83,167,130,227, 56,201,162,205,155,213,153,153,153,203, 96, 92,254,171,
+231,117, 6,110,222,188, 57,102,246,134,204,159,166,127, 8,234,233, 41, 34, 39, 44, 26,214,239,207,226,113,100, 5,129,214, 62,
+200,145, 87, 95,197, 95,122,110,253,122, 24,173,114, 39, 89,121, 93, 29,173,188, 26,126, 99, 97,109, 53,150, 52,115,182,157, 57,
+245, 19,250,113, 90, 9,142, 54,248,160,232,247,221,223,155,166, 49,210,245,113, 40, 9, 50,230,139, 15,254,254,123,197,227, 85,
+251,247, 87,251, 94,234,251,239, 27,124,103, 86, 83, 20,203,216, 72, 22, 0,200,229,114,203, 94,189,122,161, 71,143, 30, 24, 60,
+120,112, 69,159,172,150, 45, 91,226,192,129, 3, 24, 52,104, 16,238,222,189, 11, 71, 71, 71, 52,110,220, 24,141, 27, 55,198,207,
+ 63,255,108,236, 69, 14, 44,203,194,207,207,175,124,212, 97,243,164,164, 36,243,250, 22,164, 70,163, 65,118,118, 54,172,173,173,
+ 33,145, 72,208,190,125, 59, 76,249,172, 61,108, 29,127,132,159,175, 15,138,139,139, 43,134,191, 27, 80,217,250, 53,106,212, 8,
+153,153,153,200,204,204,132, 82,169,132,147,147, 19, 28, 28, 28,176,102,205, 26,126,221,186,117,191,234,116,186, 77, 89, 89, 89,
+ 70, 71,178, 28, 28, 28,252, 9,130,152,175, 86,171, 37,149,238,112, 37, 74,165,242,132, 90,173, 94,150,154,154,106,112, 71, 80,
+130, 32,160,211,233, 64, 16, 4, 78, 63,113, 66,177,150, 64, 65, 82, 24,166,190,231, 94,197,120,137, 68,162, 58,155, 75,121,158,
+ 47, 30, 62,124,184,157,171,171, 11, 18,227, 30,224,200, 17, 30,223,125,247, 93,249,168, 72,196,148,221, 24,148, 63,239,222,189,
+ 59, 60, 60, 60,192, 27,145, 43,131,227, 56,220,191,127, 31,251, 79, 92,132,163,187, 47, 18, 30, 69,225,206,207,167,208, 64,105,
+141,166,173,218, 64,175,215,191, 84,234,141, 87,129, 94,175,223,225,229,229,197,107,181,218,139, 0, 54,132,135,135,143, 78, 77,
+ 77,157,118,242,228, 73,167, 33, 67,134,164,156, 58,117, 42, 8,192,206,240,240,240,192, 37, 75,150,244, 96, 24,166,218,209,130,
+ 20, 69,253,239,243,207, 63,239, 54,100,200, 16, 66, 76,234,181,103,207,236,162, 25, 70, 79,124, 57,119, 7,123,225,202, 69,146,
+ 97,244,196,224,225,159,115, 63,255, 30, 78, 78,252,108, 21,219,178, 67, 95, 68, 68, 68, 56, 4, 4, 4, 44,209,235,245,181, 26,
+173,242, 72, 85, 77, 17, 74,138,162, 48,122,244,104, 28, 56, 96,120, 15,170,113,128,167,185,187,226,198,210,141, 61, 21, 4, 93,
+ 84,201,100,189,129,224,227,161,121,233,143, 82, 94, 43,147, 5, 0,217,217,217, 91, 1,108,229, 56, 46,221,212,212, 20,133,133,
+133,213,253,254,100,225,225,225, 50,137, 68,130,222,189,123, 91,135,132,132,196,144, 36,185, 46, 37, 37,165, 70,199, 81, 93, 51,
+ 97,117,205,137,120,137, 81,135, 86, 74, 4,180,247,111,101, 22,109,177,216, 76, 70,151,220,109, 16, 35, 51, 39, 0,228,107,236,
+159, 92,123, 54,172,128,200,144,182,108,211,189, 53,204,105,211,128, 60,166,176, 90,163, 69, 82,212,157,252,220,188,119, 10, 10,
+181,184,114, 53, 2,195,135, 53,130, 70, 71,128,227, 72, 20, 21,107, 0, 74, 4, 18,192,136, 15, 70,129, 39,104,228,164,167,128,
+162,168,112, 48, 12, 94, 51,230, 4, 6, 6,190, 51,119,238,220,134, 51,103,206,196,204,153, 51,221,183,111,223,190,117,233,210,
+165, 51, 51, 51, 51,155,161,142,228,227,181,232, 52, 56,117, 96,193,140, 19,151,183,228,247,237,164,126,212,218,167, 52,242,213,
+218, 7, 57, 34, 17, 98,105, 10,217, 60, 95,181,155, 81, 64, 64, 64,215,202,235,127, 25,207,119,130,175,120,110, 80, 31,173, 70,
+ 13,157,223,110,213,210,239,179,121,115,231,153, 61,188,118, 1,179,191,217,192,123,181,233, 85,184,245,242, 29,109,145,169,199,
+ 59, 69, 89,177, 87, 13,245, 23, 0,240,246, 91,131,208,188, 73,187, 23,222,236,210,189, 52, 89,251,149,243,183,145,158,153,108,
+112,101, 91,102, 14,170,237,147,101,200,144,254,231, 81,171,213,121, 17, 17, 17,118, 73, 73, 73, 85, 58,190,123,120,120,128, 32,
+ 8,132,134,134,226,198,141, 27, 24, 62,124, 56,104,154,134, 72, 36,194,197,139, 23,141,138,198, 84,138, 46,149,143, 58,236,227,
+226,226, 82,211,104,195, 58,181,212,106, 53,242,243,243,113,230,204, 25, 52,106,212, 8, 75,151, 46,133,147,163, 61,230,205,155,
+ 1,142,227, 80, 80, 80, 0,150,101, 13,141,104,113,229,209, 34,142,227,144,153,153,137,134, 13, 27, 98,227,198,141, 8, 10, 10,
+ 90,146,154,154,122,210,216,125,116,117,117,181,100, 89,246,203,190,125,251,246, 26, 48, 96, 0,250,244,169,154,143,117,223,190,
+125,102, 71,143, 30, 93,246,253,247,223,191,173,211,233,150,103,100,100,100, 26,162,251,227,143,165,233,151,228, 29, 22, 98,246,
+144, 6, 24, 57,105, 23,214,172, 57, 6,169, 84, 90,165,226, 93,188,120,113,173, 38,134,227,121, 47,113,214,181,148, 25,179, 86,
+219, 45, 91, 22,130,144,144, 12,144, 36, 9, 71, 71, 71,144, 36,137,248,248,120,144, 36, 9,119,119,119,144, 36,137,228,228,228,
+242, 62,129,185,168,102,212, 99,245,119,225, 36, 74, 74, 74,144,152,240, 20, 73,113, 49, 80, 20,164, 65,105, 46, 71,238,131,251,
+104, 62,110,124, 69,254,167,191,153, 61, 90,173,118, 79,165,231,171, 79,157, 58,165, 37, 8, 98, 48, 74,251,105,148, 71, 52,150,
+ 48, 12,179,164, 38,145, 14, 29, 58,180,156, 59,119,174,168, 60,221,134,147,219,183,140, 78,167,227, 0,192,167,249,155, 85,220,
+126,108,108, 44,214,172, 89,131,226,226, 98,136,197, 98,177, 33,231,129,227,184,138, 17,134,213,153, 48, 99, 76, 22, 0,216,184,
+187,172, 15, 13,187,200,222,139,219,162, 14,143,254,197, 36, 53,129, 4,169,125,125, 77,214,243,145, 45, 23, 23,151,133, 28,199,
+241, 60,207, 47,168,244,150,212,205,205,237,242,217,179,103,109, 24,134,193,247,223,127,111,153,150,150,102,249,230,155,111,206,
+ 6, 80,163,209,170,174,153,176,186,230, 68, 84, 26,117, 40,149, 74,173,181,218, 26,131, 39, 47,140, 58,100, 89,120,155,155, 89,
+ 34, 23, 73,208,216,234, 91,230,217, 48, 57,231, 82,199,223,117,122,214,170,137, 41,171,111, 72, 22,104,225, 44,183, 4,199,243,
+ 53, 14,141,214,232,245,191,220, 13,187,211,219,205,181, 17,117, 50,248, 18,250, 15, 28, 2,141,134, 68,137,158, 0, 65,137, 64,
+ 80, 98, 52,107,222, 10,141,155, 54, 7, 15,224,246,205,107,140, 86,175, 63,247, 58,149,189, 99,231, 41,195, 9, 2,235,192,115,
+124, 53,121,180, 26, 14, 28, 56,112, 25,128,207,234,210,177,235, 48,101, 56, 73,150,234, 84,206,163,245,249,148, 64, 60,184, 41,
+178,184, 20,182, 66,220,167, 3, 78,103,134, 16,144,203,254, 24,117, 40, 34, 95, 42, 53,199,191,197,112,213,109,180, 92, 93, 93,
+ 45,205,165,178, 31, 63, 29, 55,214,236,217,189,235, 72,139, 12,197,213, 75, 49,185, 7,143, 30,203, 41,206,206, 24,103,132,201,
+170,104,230,179,113,104, 0, 15,223, 23,141,150, 76,161, 4, 0,120,248,182, 3,101,106, 92, 26,161,234,162, 89,245, 49, 89,149,
+ 47,216,213,229,208,154, 56,113, 34,182,111,223,142,206,157, 59,195,203,203,171,226, 98,111,108,212,172,154,232,146,209,163, 13,
+ 43, 83, 88, 88, 8,119,119,119,108,219,182, 13,225,225,225, 48, 51, 51,195,240,225,195, 81, 88, 88, 88, 97,176, 12,237, 12,207,
+243,124,236,217,179,103,219, 14, 29, 58,148, 23,137, 68, 68, 94, 94, 30, 44, 45, 45,177,113,227,198,226,212,212,212,211,245, 48,
+ 89, 67,196, 98,241,140, 97,195,134, 81, 62, 62, 62, 72, 79, 79,135,185,185,185,158, 32, 8, 17, 0, 88, 90, 90,234, 77, 76, 76,
+ 16, 24, 24,136, 22, 45, 90,248,207,156, 57,179, 51, 77,211, 27, 83, 82, 82,118,213,246, 91, 34, 8,162,162, 66, 29,183, 46, 10,
+ 90,109,105, 5,189,105,211, 38,148,245,117,251,163,137, 32, 46, 14, 48, 96, 36,139, 66,161,128,151,151, 87,181,101,239,239,239,
+143,219,183,111,151, 54, 77,210, 52,236,236,236,112,245,234, 85,131, 70, 82,149, 39,130,140,136,136,128,175,135, 45,194, 67,206,
+194, 86, 46, 66, 11, 39, 7,184,248,119, 69, 76, 76,204,223, 25,205, 34, 80,218, 15,163,103,217,111,112, 7,128,137,149,158,111,
+ 4,176,222, 24, 65,134, 97,120,146, 36,137,196,196, 68,157, 92, 46, 39,172,173,173,105,169, 84, 10,141, 70, 83, 97,184, 98, 99,
+ 99, 17, 28, 28,140,164,164, 36, 88, 91, 91,147, 22, 22, 22,208,233,116,185,134,232,123,123,123,195,193,193,161, 74,199,247,113,
+227,198,213,203,100,141, 6,252,182,127,187,188,129,148,164, 44,124,109,223,198,147,168,248, 18, 82, 11,217,127,193,100, 1, 64,
+ 94, 94,222, 86, 0, 91,203,159,219,218,218,142,161, 40,106,158, 70,163,177,184,120,241,162,165, 82,169, 36,118,237,218,165, 95,
+176, 96, 65, 30, 69, 81,185, 4, 65,172,253,251,205, 33, 34,179,242,227,220, 69, 86, 78,220,189, 18,254,218,180,196,217,141,115,
+ 69,141,148, 68, 83, 63, 12,204,120,120,101, 12, 19,215, 41, 61, 53,141,228,193, 69,214,114, 13,222, 49,123,238,226, 47, 99,162,
+238,184,201,204,101,152, 24, 56, 23,167,127, 61, 15,130, 20,225,242,181, 80,104,117, 44,178,114,242, 49,108,196,135,112,113,180,
+ 69,228,141, 51,153, 12,199,109,124,189, 76, 54,183,161,119,255, 49, 86, 82, 19,121,217, 57, 97,177,231,135, 25, 32,201,117,248,
+234,171,175,224,231,231, 55, 41, 34, 34,226,107,212,145, 71,139, 32,184, 13,205,186,142,176, 18, 75, 75,117,120,142,197,182,195,
+179,203,242,104, 77,199,198,173, 71,155, 53,245,120,178,168,182, 60, 90,175,145,201,170,188,174,221,104,185,187,187, 75, 77, 69,
+152, 32,162,232,153,159,126, 48, 64,153, 17,247, 0, 73, 15,239,148, 54, 47,232,212,186,180, 71, 15, 13, 73,133,222, 19, 85,243,
+119,240,181, 53, 93,149,148, 24,116, 71, 95, 69,179,188,194,125, 62,154,101,164,201,122, 65,179,178,217,170,156, 55,203,213,213,
+ 21,203,150, 45, 51, 36,143,214,243,199, 94, 78, 31,148,118,128,175,220, 25,190,143,129, 38,171, 90, 77,165, 82,137,236,236,210,
+ 12, 9,221,186,117, 67,183,110,127,140,103,208,233,116, 21, 81, 44, 51, 51,179,234, 34, 90, 47,104,154,152,152,204, 62,118,236,
+216,216,107,215,174, 13,253,226,139, 47, 68, 61,122,244, 40, 55,115, 42, 24, 54,183, 91, 21, 77,150,101, 3,207,156, 57, 67,113,
+ 28,135,109,219,182,225,246,237,219,188, 92, 46,159, 47,151,203, 55,152,152,152,176,106,181,122,226,248,241,227, 63, 92,180,104,
+ 17,233,239,239,143,235,215,175,147, 13, 27, 54, 28, 5, 84, 73, 98, 89,237,177,135,134,134,130, 36, 73, 48, 57, 9,152, 52,251,
+ 32, 76, 77,104, 68, 69, 69, 33, 39, 39,231,133, 36,166,134,156,207,202,145,146,242,197,223,223,191,162, 25,178,125,251,246,160,
+ 40, 10,119,239,222,173,169, 25,182,178, 38,111, 99, 99, 83,241,251, 16,139,197, 56,127,254, 60,190,249,230, 27,184, 89, 91, 34,
+247, 97, 56, 28,186,189,133, 94, 99,199, 99,248,240,225,160, 40, 10,214,214,214, 21,145, 95, 3,126, 75, 47, 67,101,205,177,190,
+190,190,163, 34, 35, 35, 93,154, 53,107,230, 24, 17, 17,209,221,207,207,207, 61, 60, 60,188,252,185, 20,134,245,205,169,208,188,
+117,235,214,145, 13, 27, 54, 4,142, 30, 61, 90,204,113, 28,251,236,217, 51, 61, 0,194,193,193,129,186,117,235, 22,119,242,228,
+ 73,168,213,106,184,184,184,144,206,206,206,196,185,115,231,184,135, 15, 31,134,242, 60, 63,215,144, 99,103, 89,182, 74, 26,135,
+242,199,251,246,237, 51,250,255,222,160,177,247,210, 30,111,250,184,102,165,220, 69,106,114, 28,216,124,165, 46,248,248, 41,141,
+145, 38,235,207, 46,163,191, 82,115,241,163, 71,143,156, 53, 26, 13, 36, 18, 9, 54,109,218,164, 91,182,108, 89,100, 86, 86, 86,
+ 23, 84, 63,162,188,138,102, 61, 71, 29,230,212,162,249,194,168,195,252,108,156, 62,126,226, 86, 91,197,192, 29,152,148,146, 89,
+209,177,145, 39, 8,235, 99,246, 77,186,200,219, 53, 75, 38,127, 94, 72, 22,178,170,211,181, 28,187, 86,173,213, 14, 25, 56,104,
+196,111, 7, 14,236, 87, 44, 88,184, 16, 87, 67,195,145,157, 87, 4,142,167,192, 17, 4,230,205, 91, 0, 7, 91,107, 20,164, 60,
+ 82,105,116,186,129,168,154, 67,235, 95, 95,238, 4, 65, 78, 62,119,114,215, 58,146, 0, 87,156, 30, 45,165, 10,227,228, 35,135,
+ 15,164,135, 12, 25,130, 99,199,142, 33, 34, 34, 98, 75, 45, 38,171, 66,147,231,201,201,225, 23, 15,174, 35, 0, 78,157, 25, 45,
+165,139,158,200, 71,125, 48,144, 30, 62,124, 56,126, 10,190,134, 3,167,158,108, 62,112, 10,167,240,122, 99,124,102,120, 51, 26,
+ 17, 93,154,120, 58,251,183,106, 42,163, 89, 53,146, 30,198, 33,167,184, 4,231, 30, 60,203, 35,121,178,222,185,117, 74, 47,144,
+ 98, 36, 36, 60,170,230,206, 74, 86, 86,161,151, 24,165, 73,146,100,149,104,214,203, 68,178, 42,239,167,189,189,125,149,233, 92,
+ 42, 87,220,229,125,128,234,145,218, 97,118, 66, 66,130,121, 66, 66, 2,120,158, 71,104,104,168,121,251,246,237,103,191, 76, 52,
+107,198,140, 25, 21, 81,171,231,215,213,189, 86, 23,101,157,210,131,244,122,253,225,153, 51,103, 78,106,223,190,125,239,133, 11,
+ 23, 18, 48, 98, 2,222,231,162, 57, 12,199,113,184,112,225, 2,142, 29, 59,198,234,116,186, 9,169,169,169,225,149, 54,249, 62,
+ 44, 44,236,220,160, 65,131,118, 69, 71, 71, 83,145,145,145,224,249,186,199,157,170,213,106,120,121,121,129, 97, 24,172,152,228,
+138,194,194,102, 96, 24, 6, 44,203,194,212,212,180, 34,138, 87,217, 60,215,245, 59, 98, 89,246, 5,163, 21, 26, 26, 10,138,162,
+208,165, 75, 23,220,185,115,167, 34,162, 85, 87, 4, 74,167,211, 37,216,219,219,219, 47, 94,188,184, 98,191, 50, 51, 51,113,246,
+236, 89,116,232,216, 9, 77, 38, 76, 68, 74, 74, 10,214,174, 93, 11, 39, 39, 39, 44, 93,186, 20, 57, 57, 57, 96, 24,230,175, 14,
+167,191, 19, 25, 25,233,242,193, 7, 31,100,132,135,135,187, 4, 7, 7, 91, 6, 4, 4,152,142, 24, 49, 34, 35, 60, 60,220,133,
+ 32,136, 78, 48,178, 19, 52,199,113,115,230,205,155,247,235,210,165, 75,103,127,246,217,103,237, 71,143, 30, 45, 18,137, 68, 92,
+114,114, 50,179,127,255,126,194,203,203,139, 20,139,197,196,153, 51,103,184,155, 55,111,222, 96, 24,102, 5,128,203,198, 68,156,
+ 43,155, 44,138,162, 12, 53, 89, 85,152,102, 39, 29,101, 70,102,118,217,176,105, 25,233,227,225,162,219,189,255,108,226,229,235,
+143, 30, 83, 26,102,218,143,181,164, 6,120,157,161, 40,234,144,175,175,239,152,201,147, 39,155,244,233,211, 71,186,104,209,162,
+252,194,194,194,154, 76, 86, 53, 55,204,127,201,168,195, 31,230,124, 17, 60,237,243,102, 99, 60, 63,118,104,128,144,226, 12,228,
+210, 20,105,110, 73,162,149, 59,133,194,172, 88,229,169,223,118,198, 3,168, 43, 47,219,173,176,251, 17, 61,155, 54,107,121,116,
+197,210, 21,118,243,103,205, 20, 29, 13,254, 5, 60,163, 67,232,197,139, 80,136, 89,254, 97, 88, 72,186, 70,167, 29,128,215,112,
+ 10,158,212,171,235, 15, 0, 56, 97,109,109,125,111,236,232,209, 94,190,190, 35, 32,151,203,113,228,200, 17,236,249,254,123, 54,
+ 8, 24, 42, 5,238, 4,214,145, 79, 47,227, 70,133,206,221,241, 99,199,122,183,106,245, 49,228,114, 57, 14, 31, 62,140, 93, 65,
+ 65, 6,235,252,203, 41,207, 12,127, 26,127,100,136,175,163,143, 22, 73, 20,222,120,244,172, 40,244,209,179, 34,112, 60,207,241,
+188,134, 36,145, 88,172,211, 45,125,244, 36,185, 94,166,160,188,233,112,201,183,147, 95, 93,155, 71, 37,243, 83,223, 33,221,213,
+152,172,164,202,115,164, 85,174,164,107,122,172,215,235,147, 12,148, 95,238,230,230,246,194,107,245, 15,253,242, 70,153, 44, 67,
+243,104, 1, 64,118,118,118, 42,128,249,215,175, 95,223,215,187,119,239,241, 0,146,235, 89, 70,219,186,118,237, 58, 1, 0, 69,
+ 16,196,150,148,148,148,240, 23,254,240,169,169, 49, 78, 78, 78,171, 60, 60, 60, 38,150,222,152, 18,219,234,168,200,159, 52,107,
+214, 76, 87, 93, 89,212,244,156,227,184, 58,203, 40, 47, 47, 15,237,218,181,123, 97, 78, 75,158,231,241,236,217,179,242,136, 83,
+197,185,175,205,192, 21, 21, 21, 77,156, 50,101,202, 86,145, 72,228, 6,128, 40, 55,185, 44,203, 82,235,215,175,151,177, 44, 75,
+ 1, 32, 72,146,100, 68, 34, 81,201,177, 99,199, 24,134, 97, 18, 52, 26,205,196,191,248, 2,113,152, 40,157,138,161, 56, 50, 50,
+210,167, 44,146,149, 20, 17, 17,113,247,192,129, 3, 74, 0, 7,235,169,123, 89,165, 82, 93, 94,182,108,153,255,166, 77,155,230,
+ 76,156, 56,177,221,240,225,195,233,110,221,186,225,244,233,211,236,133, 11, 23, 66,213,106,245,114, 99, 12, 86, 89, 89,230,187,
+186,186, 86, 24,174, 58,254,203,181,118,228,181,113,151,110,248,240, 19, 39,217,182,229,103,139,178, 82,180,215,244, 69,218,185,
+ 59,129, 8,252,135, 73, 79, 79,255, 2,192,130,181,107,215,166,180,104,209, 66, 42, 22,139,181,134,154,172,191, 16,134,203, 43,
+122,247,187, 94,239,159,232, 58,111,138, 71,175,238, 93,228,174, 13,236,156, 31,198,165, 35,246,250,233,226,123,167,190,125,202,
+107,114,251, 3, 48,164,231,250, 77,141, 78,215,104,198,204, 25,147, 36, 34, 81,111,150,101,155,247, 56,119,156,167, 40, 42, 92,
+171,215,159, 43,107, 46, 44,121,141,139,124,201,170, 85,171,188,124,125,125,113,228,200, 17,156,219,187, 23,195,178,178,112,158,
+162, 40, 82, 44,182, 57,165,211,173,134, 97, 6,105,201,154, 53,107,188,253,252,252,112,232,208, 33,156,217,181, 11, 67,235,167,
+ 83, 83, 93,215, 22,128,178,236,105, 22,128,104, 0,173, 1,152, 0,208,160,116,106, 39,219,202, 85, 88,217,123,229,239, 95, 34,
+ 8,226,207,236, 8, 91,119,102,248,231,137,136,125,218,250, 85,239,133, 90,173,206,241,242,242, 50,106,204,181, 94,175,175,181,
+ 13,151, 97,152, 36, 79, 79, 79,131,163, 22,134,152,162,156,156,156, 54,127, 98, 97,188, 84, 95,172, 42,149, 8,199, 61,117,116,
+116,228,202, 43,253,234, 76, 88,117,175,241, 64,188, 49,223,147,150,150, 22, 13,224,243,250,238,103, 74, 74,202, 81, 24, 48,105,
+180,161,219, 1, 64,110,110,238, 43,159,204,151,224,249,228, 69,139, 22, 25,101,176,193,243,181,153,207,240,162,162,162,246,134,
+124,183, 78,167,195,223,200,161,178,133,140,136,136, 24, 79, 16, 68, 31,148, 54, 9,108,193,171,201,230,125,185,160,160,224,242,
+202,149, 43,253,183,109,219, 54,141,231,121, 20, 20, 20, 4, 25,107,176, 42,238,158, 51, 50, 78,191,170, 3,207, 73,215,254,190,
+127, 75,210, 91,234, 60,221,180,237, 69,218, 93, 16,168, 8, 70,241, 60,255,191,145, 35, 71,118, 0,176,243,101,197,106, 24,117,
+248,178,196,115,185,249, 45,206,207,248,102,236,121, 75,179,190, 96,105, 31,104,201, 83,208,102,159, 6,240, 35, 12,235,230, 80,
+113,188, 12,199,173, 97,180,218, 53,149, 42,151,255, 66, 57, 91,251,249,249, 77, 27, 51,102, 12, 22, 44, 88,128, 51,171, 87,235,
+ 62, 33,136,124, 17,192,255, 90,122,163, 73, 18,192, 44, 67,117, 70,141, 26,133, 5, 11, 22,224,231, 21, 43,234,171, 83, 27, 74,
+130, 32,130, 1, 96,246,236,217,115,151, 45, 91,102, 53,103,206,156,230,203,151, 47, 95, 90,246,252, 65,249,251,101,117, 93,192,
+156, 57,115,154, 86,122,191, 16,192,173, 63,249,124, 86,155, 25,254,207,166,167,160, 41,104, 10,154,130,166,160, 41,104, 10,154,
+130,230,203,192,243,124,223,210, 85,205,235,154, 30, 87, 90,255, 45,208, 16, 16, 16, 16, 16, 16, 16, 16,248, 23, 82, 57,138, 85,
+159,247, 95, 33,229,125,180, 42,179, 13, 40, 29,214, 93,147, 43, 53,102,212, 67,125,156,109,136,160, 41,104, 10,154,130,166,160,
+ 41,104, 10,154,255, 57,205,186,180, 95,248, 60,207,243,125, 9,130, 8,230,121, 62,160,166,117,185,177,122,254,113,165,245, 43,
+235,118, 80, 13,229,125,179, 94,232,163,245,103, 35,132, 85, 5, 77, 65, 83,208, 20, 52, 5, 77, 65, 83,208,124, 41,202,155, 0,
+ 1,240,179,103,207,158,243, 15,108, 58,116, 44, 51, 89,149, 23, 0,181, 52, 29,242,252, 97, 42, 57, 25,230, 18,137, 92, 12, 0,
+ 90,173, 74,231,236,140, 2,130, 24,242,119, 78,120, 43,240,239,164,124,184,119,250, 43,222, 86, 64, 64, 64, 64,224,191, 65,102,
+121,164, 10, 64, 38, 0,162,236,185,182,108,157, 89,102,200,158,127, 92,229,253, 63,145, 84,212, 16,201,162,107, 50, 89, 89, 89,
+114, 91,154,206,245,102,217,146,198, 0, 64,211,100, 84, 86,150, 85, 12,207, 31,206,170,143,217,178,181,179, 11, 19, 81,148,179,
+ 33,219,234, 89, 54, 57, 43, 61,189,106,234,120,130,120, 29, 12,158,161, 38,226,101,204,198,159,110, 84,108,109,109,237,237,237,
+237,223, 51, 55, 55,239,152,151,151,119, 51, 51, 51,243,167, 90,230, 61, 92, 70, 16,152, 89,250,187,194, 74, 0,115,106,145, 54,
+102,219,231,241,146,203,229,147, 8,130,240, 43,251,131, 69,168, 84,170, 77, 0, 30,253, 7, 47, 72, 38, 0, 6,208, 52, 61,202,
+214,214,182, 93, 90, 90,218, 34, 0,245,205,230, 77, 3,152, 97,105,105, 57,204,210,210,210, 51, 39, 39,231,113, 65, 65,193, 33,
+ 0,107, 0,212, 57, 84,122,209,103,142, 29,187,245,233, 54,255,194,153, 11, 75, 22,125,159,122,253,133,247,103, 56,218,244,238,
+213,121,193,133, 83,215, 22,207,221,152,146, 99,228,190,145,101, 11, 80, 58, 58,146,199,139,201, 94, 95, 22, 17,128,126, 0,186,
+ 1,184, 0,224,148, 33,199, 93, 3, 29, 0,204, 45,219,231, 53, 0,206,255,195,127, 71,166,246,246,246, 43, 0,244,163,105, 58,
+ 50, 57, 57,121, 2,128,164,191,121,159,104, 0,109, 1,248,161, 52, 13,199, 45, 24,150,194,161, 78,108,108,108, 2,104,154,158,
+ 84,150,218,101, 83,118,118,118,240, 63,181, 96, 36, 18, 73,144,131,131,195,199,106,181, 90, 69, 16, 4, 95, 57,223, 35,195, 48,
+ 73, 89, 89, 89,109, 94,183,139, 26, 65, 16,183,254,225,187, 56,161,154,215,106,206,163,149,156, 12,115,154,206,245,206, 72, 11,
+ 31,150,146,122,127, 40, 0, 56, 57, 54, 63,100,231,208,236, 96,114,178, 68,231,224, 51, 80, 33,146,211,155, 40, 74,212,178, 68,
+171,177, 21,209,162, 44, 29,163,191, 75,106,249, 73,105,209, 63, 85,155,108, 81, 68, 81,206, 79, 99,206,219, 49,186, 28,136,100,
+ 78, 16,153,184,213,184,183, 78, 78, 78,245, 58, 74, 43, 43, 79, 51,157, 84, 54, 77, 36,162,122,113, 60,227,199,115, 0, 73,136,
+ 34, 24, 86,255,155, 88,163,249, 46, 55,247,113, 97,125,207,160,143, 13, 28,120, 96, 56, 8,244, 2,143,115, 4,112, 32, 58, 27,
+105, 70, 72, 24,106, 34, 94,198,108, 84,254,236, 90, 0, 95,188,234, 95,146,179,179,179, 85, 64, 64, 64,208, 55,223,124, 99,162,
+ 80, 40,136,132,132,132, 62,179,102,205,122,243,246,237,219,159, 39, 39, 39,167, 60,111,250, 8, 2, 51, 57,142, 39, 1,128, 36,
+137, 89, 74,165,157,156,162,168, 23,114, 27,177, 44, 43,207,204,204,152,204,113, 60, 81,182,237, 76,158,199, 58, 67, 12,163, 76,
+ 38, 27,225,215,172,229,231, 43, 86,173, 81,216,219,217,153, 50, 44,167,139,127,246, 84, 62,127,246, 23,237,227, 98, 31,173, 43,
+ 41, 41,217, 95,159,255, 53, 69, 81,195,164, 82,105, 0, 0,223,178,215, 30,106, 52,154, 96,150,101, 15, 26, 90,161,219,219,219,
+ 95,162, 40,170,129, 49, 95,204,178,108, 66,122,122,122,151,122, 22,209, 16, 55, 55,183, 31,187,118,237, 42,111,215,174, 29, 36,
+ 18, 9, 22, 44, 88, 48, 35, 53, 53,181, 46,163, 69, 3,152, 33,151,203,135,153,154,154,122, 22, 21, 21,197,169,213,234,163, 18,
+137,164,231,186,117,235, 92, 59,119,238,108,150,158,158, 78, 80, 20,101,255,243,207, 63,127, 20, 20, 20,212,135, 97,152, 30,117,
+ 85,114,249,113,252,124,105, 63, 95,255,252,184,243,243, 1,188,243,252,251, 76,137,108, 20, 79,185, 6,168,249, 59,137,101,230,
+195, 96,147, 37, 18,137,214, 57, 56, 56,140, 41, 41,205, 21,192, 63, 95,225, 0,128, 86,171,205,205,203,203,243,169,207, 95, 30,
+192, 56, 75, 75,203, 49, 95,126,249,165,213, 59,239,188,131,189,123,247,126,186,125,251,246,220,130,130,130,255,161, 52, 17,102,
+180,145,154, 51,211,210,210,222, 21,137, 68,132,171,171, 43,165, 86,171,141, 49, 90,222, 40,157,132,249, 22,128, 77, 40, 77, 93,
+208, 29, 40,253,191, 3, 88, 89,110,220, 72,146,220,228,227,227,243,222,195,135, 15, 55, 3, 88, 82,223,255,186,131,131,195,214,
+141, 27, 55, 14,237,223,191, 63,149,153,153,233,220,162, 69,139,125,105,105,105,254,175,224, 50, 50, 86, 42,149, 78,111,222,188,
+121,147,232,232,232,152,130,130,130, 53,101,231,179,182,255,148, 11,128,158,150,150,150, 61,230,205,155,167, 8, 8, 8,192,182,
+109,219,222,221,190,125,123, 81, 97, 97,225,111, 40,237,211,243, 82, 38,144,166,233, 73, 73, 73, 73,182, 60,207,195,209,209,113,
+ 18,128,127,164,209, 34, 73,114,221,160, 65,131,198,236,219,183, 79,254,244,233, 83,185,179,179,115, 69,242,108,130, 32,234, 93,
+127, 10,188, 52,219, 42, 25,174,186,243,104, 73, 36,114, 49,203,150, 52, 78, 73,189, 63,244,205,174,235, 45, 0,224,210,197, 41,
+ 67,237, 28,154, 70, 72, 36,242, 24,169,185,236,216,160,126, 61, 91,190, 31,208,149,112,113,180, 67, 82,106,134,253, 15, 7,206,
+188, 29,124,230,252, 49,148, 38, 16,171, 22, 70,151, 3, 19, 93, 8,162,175,124, 15,219,110, 41,216,240,115, 18,174,223,139,135,
+ 42, 63, 11, 13, 28, 76,176,106, 90,111, 56, 88,201,235,119,235,101,231,213,157,161,165, 7, 63, 24, 49,210,226,189, 1,190, 34,
+119, 7, 7,240,188, 20, 49,113, 69,157,126, 57,123,190,237,209,195,251, 39,153,138,188,134, 21,103, 60, 50,248,226,214,202, 17,
+ 38,197, 58, 12,160, 41,226,163,206,109,154,244, 24,241,174, 63,217,196,183, 17, 34, 31, 60,236,125,226,247,208, 85,228,181, 7,
+191, 49, 44,191,219, 84,140,227,119, 82,107, 77,232,247,130,225,232,209,163,167,191, 84, 42,173,146, 60, 73,163,209,136,127,251,
+ 45,164, 67,125,204, 70,249,119,104,181, 26, 82, 36,146,128, 36,137,207,253,252,154,249,102,101,101,157, 39, 8,226,199,148, 20,
+227,162, 5, 83, 0, 73, 46, 77,183, 38,165, 82, 71, 86,171,181, 1, 0, 66, 34,201,141, 39,201,102,243,230,206, 85, 80, 20,197,
+101,103,103, 67,165, 82, 17,227,199,143,151,197,197,197, 13, 74, 78, 78,254,190,142, 59, 18,108,223,190,221,219,209,209,241,133,
+217, 99, 83, 83, 83, 37,253,251,191, 87,159,162,247,110,222,162,213,244, 51,103,126,245, 45,200,201, 45,217,190,118,107,152, 94,
+ 38,215, 52,244,245, 17,109,218,182,203, 98,194,152, 15,167, 68, 69, 61,184, 11,227,230,171,115, 51, 49, 49, 57,182,122,245,106,
+191,238,221,187,139,236,236,236,144,158,158,142,135, 15, 31,250,253,254,251,239, 3,118,237,218, 53, 67,173, 86, 15, 2, 12,154,
+ 16,213,235,183,221, 63,218,153, 90,219,128,213,235,225,212,188, 85, 69,126,179,216,223,207,130,209,233,192,233,245,240, 13, 24,
+ 80, 22, 77,230,225,235,235, 91,223,172,187, 78, 77,155, 54,221,179,116,233, 82,177, 70,163, 65,104,104, 40,206,159, 63,207,165,
+166,166,214,149, 16,151, 38, 8,226,236,194,133, 11, 93,186,116,233, 98,150,149,149, 5,150,101,109,143, 31, 63, 62,169,101,203,
+150,230,174,174,174,146,221,187,119,163,168,168, 8, 12,195, 88,123,122,122, 90,143, 24, 49, 66,187,123,247,238, 25, 0, 86,212,
+ 20,201, 42,136,227,231,167, 18,158,111,251,180, 30,133, 52,226,215,183,167,191,141, 95,204,223, 32, 42, 34, 91,111,123,122,154,
+ 21, 36,203,103, 41,204,155, 89, 23, 36,135,204,122,219,211,115,251,175,143, 13,186, 25, 34,203, 42,155, 15, 14, 28, 56, 32,127,
+248,240,161,220,215,215, 23, 28,199, 85,100,224, 47, 79, 56,235,229,229, 85,159,243,184, 60, 48, 48,112,214,208,161, 67,209,188,
+121,243,138,164,168, 95,125,245, 21,102,205,154,101,117,233,210,165, 25,251,247,239,159,241,211, 79, 63,173, 0, 48,219,200,104,
+ 76, 57,198,150,241,215, 79,158, 60, 25,114,236,216,177, 15,103,206,156,233, 5, 96, 50,128, 5,217,217,217, 93,203,162, 49,146,
+ 50,163, 53,118,198,140, 25,159,204,158, 61, 27,239,190,251,238,130,208,208,208,111,235, 25,229,163, 24,134,121,183,127,255,254,
+148, 94,175,135,169,169, 41,244,122,253, 27, 47, 27,148, 0,176,113,226,196,137,159, 4, 6, 6,194,202,202, 10,122,189,222,251,
+192,129, 3,219, 23, 44, 88,208, 17,192,184, 26,246,117,212, 39,159,124, 50,120,228,200,145,104,211,166, 13,104,186,244, 52,174,
+ 94,189, 26,139, 23, 47, 86,156, 61,123,118,192,238,221,187, 7,156, 56,113,226, 40,170, 78,219,101, 20, 28,199,129,166,105, 36,
+ 38, 38,194,206,206, 78,202,113,220, 25,130, 32,182,229,228,228,252,244, 15,170,204, 87, 14, 25, 50,228,131,125,251,246, 41, 0,
+ 96,213,170, 85,152, 62,125, 58,236,237,237,161, 80, 40, 4,171,243,207,137,104, 77,168, 51,162, 85, 23, 42,149,170,213,156,207,
+ 62, 2, 73,150,222, 53, 54,106,232,134,101,115, 39, 16, 39,130,207,180,170, 53, 6, 47,115, 66,244,149,239, 33,117,157, 6,141,
+158,193,141,123, 79,112,110, 85,159,210,218,242,157,121,208,232,122,148, 87, 54,214, 18, 19,147,149, 90,150,189, 10, 7,135, 80,
+ 60,123,150, 89,151,201, 82, 58,216, 7,111,217,178,194,196,239, 13, 31,232, 24, 61,146, 51,146, 65, 16, 82,184, 56,155, 97,236,
+168,119, 68, 93,187, 58,217,126,253,245,214,211,105, 28, 6,170,178, 30,213,153, 48,212,219, 22, 59, 91,249,121, 13, 29,209,183,
+139,180,153, 95, 83,136,165, 38, 21,239,181,110,211, 6,173,219,180, 33,103, 23, 21,246,186,121, 43,172,215,145,179, 55, 52, 42,
+253,179, 67, 49, 89, 24, 93,199, 69,166,194,112, 76,157, 58, 21,246,246,246, 85, 54, 72, 79, 79,199,239,191,255, 86,237,103,140,
+184,144, 85,124,199,183,223,126,107,150,155,155,251,206,142, 29, 59,222,226, 56,238,219,180,180,180, 43,134,136,140, 4, 26,228,
+ 75,165, 61,198,172, 89,195,181,124,239, 61,202,210,193,129,228, 88,150, 72,121,252,216,102,237,247,223,119,203,137,141, 53, 41,
+182,182,206,201, 85,171, 85, 49, 49, 49,144,201,100, 4, 77,211,109,171,145, 74,231,121,172, 36, 73, 98, 22, 65, 16,144, 74,101,
+ 49,129,129,129,119,202,222,107,112,234,212, 41,121,191,126,253, 84, 0,158, 2,128, 84, 42,115,166, 40,210,187, 52, 19, 59, 86,
+ 26, 98, 48, 77, 77, 77, 63, 91,178,116,133,105, 65, 78,158, 90, 87, 92,172, 87,154, 43, 8, 66, 97, 70, 21,228, 23, 22, 38,167,
+102,106,230, 45, 90, 76, 77, 28, 59,242,179,226,226,226, 73,134,154,172, 22, 45, 90,220, 60,118,236,152,157,141,141, 13,242,242,
+242,144,157,157,141,155, 55,111,130,227, 56, 12, 26, 52, 72,218,169,125,187, 86,115,231,205,191,158,152,156,220,209, 16,179,101,
+106,109,139, 85, 93, 90,150, 86,214, 79,179, 43,202,103,219,144,128,138,109, 22, 39,229,151, 71,231, 94,102, 10,169,142, 61,122,
+244, 16, 3,192,184,113,227, 10, 10, 11, 11,151, 1,216,135,186, 51,250,207,152, 63,127,190,115,195,134, 13,221,247,237,219,135,
+162,162, 34, 0,176,107,216,176, 33,188,189,189,217, 11, 23, 46,192,219,219, 27,102,102,102,184,116,233, 18,174, 95,191,142, 54,
+109,218,152,137,197,226,161, 58,157,174, 90,163,213,173, 79,183,249,210,126,190,254, 62,173, 71, 65, 97,238,136,237,251, 15, 34,
+ 58,108,151,191, 70,247,112,190,152,189, 56, 82,205, 75, 71,103, 38, 40,102, 55,104,211,213,166, 81,211,247,224,222,250,142,109,
+ 9,123,249,201,252, 94, 13,151,211,178,146, 93,139,214,164,102,215,100,178, 0,172, 26, 52,104,208,144, 3, 7, 14, 88, 2, 64,
+120,120, 56,210,211,211,161, 84, 42, 33,147,201, 32, 18,137, 42,230, 39,173, 39,163, 55,109,218, 84, 97,218, 24,134,169,152, 5,
+ 64, 46,151,227,205, 55,223, 68,203,150, 45,241,211, 79, 63,141,174,193,104,117,105,223,190,253, 94,119,119,119,215,202, 47, 22,
+ 23, 23, 99,248,240,225, 0,128,174, 93,187,246, 48, 49, 49,225,203, 13, 97,106,106,106,209,173, 91,183,122, 1, 8,173,193, 89,
+170,147,147,147,241,229,151, 95, 34, 62, 62,254,211, 45, 91,182, 60, 3, 32,147, 72, 36, 21,247,199, 0,188,155, 54,109,186,110,
+250,244,233,136,139,139, 67,100,100,228, 77,212,191, 41,149, 53, 53, 53,141,213,235,245,109, 24,134,129, 90,173,198,192,129, 3,
+101, 71,143, 30, 77,167, 40, 42, 42, 43, 43,235, 67,148,246, 73, 49, 20, 25,128, 53,129,129,129,159,204,156, 57, 19,191,253,246,
+ 27, 78,156, 56,129,145, 35, 71, 98,218,180,105, 80, 40, 20, 99,166, 77,155,118, 29,165, 19,154, 63, 79,143, 77,155, 54,129,101,
+217, 23,254, 27, 50,153, 12, 93,186,116, 65,147, 38, 77,112,226,196,137, 30, 47, 97,180,220,187,116,233, 34,225, 56, 14,197,197,
+197,184,112,225,130,194,196,196, 68,225,226,226, 50, 30,192, 63,198,104,185,187,187, 7, 30, 56,112, 64, 81,185,245, 71, 42,149,
+162,210,239, 64,224,239,143,104,213,122,135, 85,129, 86,171,210,209, 52, 25,229,228,216,252,208,165,139, 83, 42,154, 14, 1, 50,
+ 74,171, 85,233, 0,128,229,120, 20,168, 24,152, 72, 73, 60, 77, 43,196,131,199, 89,213, 73, 85, 25,162, 41, 50,113,131,180,170,
+ 8,231,172, 0, 0, 32, 0, 73, 68, 65, 84,221, 83,240, 60, 15,173,142,133, 38, 63, 13,203, 78,171,240, 48,169, 4,218,226, 92,
+104,117,165,221,176,108,109,109,233, 51,103,126,153, 30, 18,242,251, 39,255,251,223,255,168, 36, 11,139,200, 66,160, 85,117,154,
+ 86, 86,158,102,156, 68,114,104,243,150, 5, 38, 60,245, 24, 49, 9,197,104,228,210, 14,182,150,174, 72,203, 42,198,213,200,159,
+ 17,245, 40, 24, 13, 29,221, 49,237,179,183,101, 75,150,238, 59, 40,102, 60,220,242,242,226, 11,106,218,207,242,187,168,173,191,
+198,128,201,121, 12, 54, 59, 14,108, 97,202, 11, 27, 40,148,110,104,221,221, 25, 74,215, 55,164,163,167, 45, 30, 5, 84, 49, 90,
+149, 53,211, 9,130,220, 76,146,196, 39, 4, 65,160,121,243, 22, 73,107,214,172,169, 46, 21,184,174,121,243, 22, 73, 20, 69,186,
+148, 94,216,201, 77, 60,207,165,215,177,159, 85, 76,141, 68, 34,157, 89, 26,246,119, 76, 60,125,250,180,110,200,144, 33, 88,189,
+122,181,100,214,172, 89,243, 40,138, 26, 87, 77,243, 94, 21,205,129,128,155,229, 27,111,244,254,246,234, 85, 94,164,215, 19, 57,
+ 55,111, 22,228,165,166, 50,105,133,133,146,195, 81, 81,239,126,252,197, 23, 18, 87, 87, 87, 92, 9, 14,182,201, 44, 46,230,243,
+ 52, 26,117, 94, 94, 30,207, 48,204,205, 26, 52,231, 40,149,118,242,237,219,183,123, 7, 6, 6,222, 73, 77, 77,157, 3, 0,142,
+142,142,203, 0, 52, 1,240,180,210,107,216,178,229, 96,242,248,241,227, 99, 50, 50, 50,230,212,182,159,149,104,106,167,180,147,
+239,223,186,251,190,181,153, 9,169,116,113, 34, 69,150,150, 52, 35, 49, 17,115,128,186,161,235, 27,166, 0,154,214,240,217,231,
+ 53, 9, 19, 19,147, 99, 39, 79,158,180, 19,137, 68, 96, 89, 22, 74,165, 18,241,241,241,200,203,203, 67, 97, 97, 33,158, 68, 61,
+132,135,171, 43,190,158, 61,203,113,242,172,217,199, 84, 42, 85,155,231, 42,179, 23, 39, 64,214,235, 94,136,236, 85, 55,139,193,
+243,205, 94, 6,150,123,101,226, 19, 18, 18,160, 80, 40,224,231,231,167,184,122,245,234,229, 90, 76, 86,229, 73,128,135,118,238,
+220,217,108,223,190,125,104,211,166, 13, 44, 44, 44,112,225,194, 5,132,135,135, 67,167,211,145, 69, 69, 69, 80, 40, 20, 88,190,
+124, 57,220,220,220, 80, 88, 88,136,167, 79,159,218,136, 68, 34,219,231, 50,218, 87,104, 94, 56,115, 97, 73,126,220,249,249,105,
+196,175,111,111,223,127, 16,227, 71, 12,131, 3,255,248,178,197, 27,196,146,222,253, 58,127,197, 83,174, 1,166,102,205,173,188,
+252,250, 65, 44, 81, 96,242,204,197,136,137, 56,101,165, 42,188,255, 41,193, 38,186, 46, 90,115,120,106, 53,199, 78, 0, 32, 93,
+ 93, 93, 63, 62,124,248,176, 89, 69,232,133,162, 42,230, 60,172, 60, 9,124, 45, 19,190,215,121, 62, 9,130, 64,124,124, 60,236,
+236,236,160, 80, 40, 42, 38, 16,127,248,240, 33,110,220,184,129,242,217, 40,106,208,252, 48, 36, 36,196,213,212,212,180,202, 6,
+ 60,207, 35, 43, 43, 11, 12,195, 64, 46,151,131,101, 89,232,116, 58,232,245,122,148,148,148, 40,154, 52,105, 50, 73,175,215,135,
+ 86,167,201,113,220,231, 67,135, 14,237, 28, 26, 26,234,249,253,247,223, 67,171,213,174, 74, 75, 75,195,224,193,131,193,113, 28,
+122,244,232,209,129,231,249,232,121,243,230, 1, 0,166, 79,159,174, 47, 46, 46, 14,172,207,177,151,209,164,117,235,214,158,191,
+253,246, 27,252,253,253,161,209,104,176,122,245,106,243, 45, 91,182,152,239,222,189, 91, 57,115,230,204, 31, 51, 51, 51,251,212,
+161, 73, 0, 88,229,224,224,240, 73,183,110,221, 76,202,230, 48,197,174, 93,187,240,245,215, 95, 31, 0, 48,239,151, 95,126, 89,
+120,226,196,137, 81, 31,127,252, 49,190,254,250,235,105,121,121,121, 59,106,210,124,242,228, 9,148, 74, 37,204,205,205, 75, 47,
+150, 58, 29,238,222,189,139,115,231,206,161,113,227,198,134, 28, 83, 77,251,233, 62,104,208,160, 31,247,239,223,111,150,152,152,
+136, 75,151, 46,193,195,195, 3, 42,149,202,144,185, 97, 67,254,132, 10,187, 70, 77,181, 90, 93,146,144,144,160, 88,177, 98, 5,
+ 28, 29, 29,225,238,238, 14,153, 76, 6,130, 32,160,215,235,107,155, 94,173,206,253,236,218, 21,116, 86,178, 85,127, 11, 75,171,
+ 79,121,158,167,243,243,115,183,234,144,119,228,241, 99,104,255,194, 99,255, 55,211, 10,192, 29, 84,157,243, 48,181,194,104, 5,
+ 7, 7,243, 1, 1, 1, 68,249,218,217, 25, 5, 89, 89, 86, 49,118, 14,205, 14,218, 57, 52, 45,155,247,139,140,162, 40,171, 24,
+123,123, 85, 1, 0,232, 24, 30,215,162,242,112, 63, 54, 13,225,177,105, 48,149, 26, 22,124,209,232,152,210, 30,171, 60,143,146,
+162, 63,110, 90,117,170, 92,104,116,165,221, 61,180, 26, 21,242, 51, 35,137, 33, 3,123,201, 62,249,100, 34, 28, 29,157,149, 53,
+233,233,164,178,105,147,167,191,107,105,109, 41, 66,240,213, 95,209,161,241, 64,200,164, 34,100,231,151, 0, 4,240,232,241, 57,
+128, 51, 67, 68, 76, 2,218, 55,149,163, 79,111, 95,197, 79, 71,162,191, 0,176,192,144,253,101,146,110, 66,236,245, 14, 68,172,
+ 30,250,172,104,112,121,207, 0, 83, 7,168, 9, 5,178, 83,159, 33,234,242, 81,131,238, 25, 57,142,251,212,214,214, 54,111,222,
+188,121,221, 26, 53,106,164,155, 52,105,210,189,103,207,158,125,254,220,221,202,119,155, 54,109, 66,108,108,108,242,183,223,126,
+123, 33, 43, 43,107,190,145, 5, 61,155,231, 17, 84,214, 20,151,117,252,248,241,214, 23, 47, 94,156, 22, 20, 20,100, 63,101,202,
+ 20,201,148, 41, 83,198, 2,248,166,182,230,194, 2,169,180,231,183,151, 46,241, 76, 82,146,102,207,250,245,146,141,215,174,205,
+211,113,156,147,173,157, 29,209,169,125,251, 98, 57, 73,102,101,167,167, 51, 74, 79, 79, 42,254,220, 57, 27,222,196, 36,229,151,
+ 95,126, 41, 40, 42, 42,170,113,234, 28,138,162, 84,213, 53, 23, 86,135,163,163,163,182,186, 62, 92,181, 84,136, 5, 28,207,235,
+ 44, 27, 54,228,123,247,232,216, 40, 54,250,241, 99,153,165, 37,229,213,200,195,231, 65, 84,252, 77,158,101, 75, 8,130, 40, 48,
+168,173,132,162,134, 5, 5, 5, 53, 51, 55, 55, 7,199,113,176,176,176, 64,102,102, 38,180, 90, 45, 10, 10, 10,160, 45,204,135,
+ 54, 63, 31,225,207,226,209,185, 91, 55, 12,121,187,183,239,238,227, 39,135,177, 44,123,160,214,246,188,230,173, 42, 34, 89,139,
+ 27,216,252,209, 22,148,152, 87, 97,186, 86,180,242,130, 88,161, 64,175,207,103,191,204, 31,253,206,233,211,167,127, 30, 52,104,
+208,187, 95,124,241, 5,153,154,154,250,107,124,124,124,103, 0,145,181,125, 72,161, 80,188,145,149,149,133,162,162, 34, 88, 88,
+ 88, 32, 40, 40, 8,246,246,246, 80,169, 84,184,117,235, 22,239,226,226, 66, 92,184,112, 1, 46, 46, 46,200,206,206,134, 78,167,
+131, 90,173, 78,211,106,181, 53, 54,151,151, 53, 15,190, 51,253,109,252, 18, 29,182,203,223,153,120,114,107,232,140,174,177,209,
+225, 81, 9,103,207, 93,253,134, 41,145, 37,230, 37,133,204,106,216,246,142,237,167, 95,126,141, 13,171, 22, 34, 58,244, 82,142,
+189, 91,193, 70, 19, 66,179,179,182,253, 45, 46, 46, 46,137,138,138, 50,187,119,239, 30, 8,130,128,133,133, 5,228,114,121,181,
+102,171, 30,144,149, 35, 80,197,197,197, 16,139,197,176,177,177,193,142, 29, 59, 42, 42, 94, 15, 15,143,218, 52,182,246,234,213,
+107,152,155,155,155, 89,229, 23,219,182,109,139,137, 19, 39, 98,243,230,205,184,118,237, 90,149,249, 52,211,210,210, 82,245,122,
+125,109,199,157,151,158,158,254,246,192,129, 3,195, 46, 95,190,108,190, 99,199, 14, 48, 12, 83,237,178,125,251,118,220,184,113,
+ 99, 1,128,168,122,254,142, 26, 15, 30, 60,248,210,222,189,123, 45, 51, 51, 51, 81,254,219, 40, 46, 46, 6,203,178,240,241,241,
+ 33, 24,134,169,171,223, 27, 73, 81,212,241,245,235,215,247, 27, 63,126, 60,104,154,134, 86,171,197,250,245,235, 49,107,214,172,
+244,178,155, 82, 29,128,121, 59,119,238, 28,245,222,123,239,161, 69,139, 22,190,231,207,215,220,179,163,168,168, 8, 69, 69, 69,
+ 16,137, 68,112,112,112,192,146, 37, 75,160,213,150, 94, 86,188,189,189, 43,254,198, 0,182,122,123,123,247,139,137,137, 89,141,
+210,190,107, 47,224,224,224, 48,144,231,249, 9, 44,203, 22,250,251,251,219,236,223,191,223, 44, 57, 57, 25, 97, 97, 97, 88,176,
+ 96, 65, 46,199,113, 44,199,113,132, 90,173,126, 98,103,103, 23, 38,149, 74, 77, 84, 42, 85, 78,118,118,246, 82, 0,191,254, 93,
+ 53, 57, 65, 16,132, 72, 36,194,184,113,227, 64,211, 52, 76, 76, 76, 80, 82, 82, 2,189, 94, 95, 97,230, 97,100,179,116,163, 70,
+ 10, 27, 26,226,241, 86,102, 77,166, 13,153, 26,160,116,116,114,134,165,185, 20, 15, 31, 70,118,254,253,183,115,235, 37,116,244,
+ 22, 78,171,223, 18,253, 52,255, 79,159,236,254,121, 47,242, 47, 53, 90, 47,204,121, 72, 87, 95,152, 67, 88,158, 63,156,149,156,
+ 44,209, 73, 36,242,152,242, 40,151,189,189,170,128, 32,134,176,202,166,253,193,232,244,101, 23, 10,190,108, 49,208,104,233, 89,
+196, 70, 71,224,242,217,147,176, 85, 37, 35,235, 73, 75, 64,220, 12, 90,117, 62, 74,180,186, 50, 83,194,226, 94,216,111, 40,200,
+207,129, 95,155, 0,128, 36,111,212,164,103, 97, 67, 4,116,106,221,156,138, 77,136, 64, 91,239,247,225,233,226,143,103,169, 5,
+200, 43,210, 32,183,160, 4, 45,253,102, 35, 51, 87,141, 2, 85, 9, 34, 99,119,195,217,201,147, 36,232,199, 61, 12, 53, 90,154,
+200, 99,208, 68,157,128,216,189, 51, 36, 62,239,129,114,239,130,132,251,231,113,239,151,181, 72,122,112, 5, 60,199,254,159,189,
+235, 14,139,226,106,191,103,102, 59,187, 75,239, 69,177,130, 98,239, 13, 69,108,104,236, 29, 75,172,209,168,216, 27,106,172, 81,
+209,104, 98,239, 37, 6,123, 55, 98, 23, 21, 11,118, 64, 64,172,244,178, 82,151,182,125,103,103,126,127, 80,130, 72, 89,208,228,
+251,126,249,246, 60,207, 60,187, 51, 59,115,246,157,123,239,220,123,230,189,247,190, 23,246,174,109,245,125, 72,118, 92,191,126,
+189,109,167, 78,157,216, 61,122,244,104,126,245,234,213,230, 18,137, 36,172, 80, 96, 52,239,209,163, 71,115,107,107,107,108,219,
+182, 77, 65, 16,196,142,106,102,118,177, 7, 44, 45, 45,237, 25,128,117,231,207,159,223, 49,117,234, 84,216,216,216, 52, 77, 73,
+ 73, 41,247,194,116, 14,167,249,248,245,235, 25, 14,139,197,156,220,185,147,187,250,250,245, 95,127, 63,114,132,219,205,211,147,
+ 96, 24, 6,161,161,161,194,141, 59,119, 10, 71, 15, 28, 24, 23,159,150, 70, 5, 5, 7,107, 36, 73, 73,121,105, 50,217,106,137,
+ 68,242,233, 63, 81,178,181, 90,237,227,152,216, 24,199,214,237, 90, 88,135, 68,197, 68,122,117,235,216,145, 36, 73,242,109,116,
+124,176,181,181,137,240,214,205, 91, 26,173, 86,251, 88, 31, 46, 62,159,223,175, 91,183,110,108,169, 84, 10, 7, 7, 7,164,167,
+167, 35, 57, 57,185,192,227,144, 35,133, 38, 39, 7,218,220,108,232,100,249,136,121,254, 12, 45,234,214,225,159,225,243,251,201,
+229,242, 10,133, 86,209, 91,102, 89, 11, 93, 23, 29,227, 25, 27,131, 39, 22,131,168,122,183,225, 64, 51, 51,179,197,217,217,217,
+ 87, 1,172,213,104, 52, 62,139, 23, 47,110,179,125,251,118,171,117,235,214,153, 76,153, 50,229, 76,126,126,126, 11, 20, 44,170,
+ 90, 94, 3,246,145,162, 40, 75, 0,182,129,129,129,176,177,177, 65, 78, 78, 78,145,167, 69, 45,151,203, 5,153,153,153, 80,169,
+ 84, 80,171,213, 48, 49, 49,193,139, 23, 47,178, 40,138,186, 92,153,113, 38,245,136,181, 42, 77,212, 79,150,110,162, 20, 13,101,
+238,145,150, 69, 75, 87,253, 42, 89, 3,224,215,222,117,235, 30,208,208,247, 99,222, 71, 92, 54,143,125,126, 47, 43,229,189,172,
+238,193,171, 49, 21,141,209, 98, 0,208, 4, 65, 48,174,174,174, 72, 79, 79, 7,139,197,130, 80, 40,132, 88, 44,198,146, 37, 75,
+176, 99,199,142,234, 8, 45,129, 72, 36, 90, 79,146,228, 72,146, 36,173,117, 58, 29,124,125,125,209,191,127,127,240,120, 60,104,
+ 52,154, 98,143,102,145,151,170, 18, 79, 71,232,147, 39, 79, 76,158, 60,249,172,218,242,180,178,178,186,163, 82,169, 16, 29, 29,
+141,139, 23, 47,118, 5, 16, 84,197,188,142, 14, 13, 13,237,237,238,238,254, 71,171, 86,173,234, 49, 12,131,166, 77,155,194,219,
+219, 27,254,254,254, 8, 11, 11, 67, 78, 78, 14,125,235,214,173,223, 1,108,174,106, 27, 94,152,190, 13,134, 14, 29,250,240,248,
+241,227,230,153,153,153, 80, 40, 20,144,201,100, 56,115,230, 12, 58,117,234, 4, 43, 43, 43, 28, 59,118,140, 98, 24,166,162,188,
+ 39, 73,146, 60,184,119,239,222,254,147, 39, 79,198,174, 93,187,112,242,228, 73, 12, 24, 48, 0, 35, 71,142, 68,122,122,186,237,
+166, 77,155,198, 21,118, 19,174,244,246,246, 70,126,126, 62,158, 63,127, 30,165,231, 51,143,236,236,108,100,103,103,195,200,200,
+168,228, 51, 70, 0,240,223,178,101,203,168, 57,115,230,160,110,221,186, 43, 99, 98, 98,182,160,140, 89,162, 52, 77,255,152,156,
+156,108,206,102,179, 45, 41,138, 66, 98, 98, 34, 94,188,120,129, 25, 51,102,100,101,101,101, 77, 5, 16, 15, 96,217,164, 73,147,
+214,206,155, 55,175,184, 44,205,155, 55, 47,224,234,213,171,189,255,105,111,142,171,171, 89, 99, 30,139, 63, 91,154,199,178,148,
+ 74,165,197,117,135, 90,173,134, 74,165,250,204,147,197,229,114, 44,219,180,168,121, 69, 33,207, 91,250,250,125,118,185, 11,164,
+187,213, 51,109, 38, 20,153,206,233,212,185,219,152, 94,189, 7,177, 40,173, 22, 55,110, 92,198,161, 67,187,225,233,238,138,186,
+245,155, 98,230,172,217,166, 42, 53,229,123,235,214,245,197,102, 79, 30, 92,207,203,205, 94, 82, 17,231,255, 56,174, 20,138,171,
+ 43,101,118, 29,150,165, 32, 11, 67, 56, 72, 11,119,173,204,205,205,119,234,116, 58, 79, 19, 19, 19,208,217,239,240,250,197, 83,
+100, 73, 57, 80, 41,116,160,153, 2,177,165,151,112, 81,169,113,255,198, 37,108,221,242, 43, 50, 51, 51,225,222,165, 43,242,217,
+ 53, 80,179, 70, 77, 40, 21,242,194,135, 6,208,168,181,176,182,117, 70, 72, 72,152, 54, 87, 38, 43,183, 66,226, 10, 52,110, 53,
+109, 93,161,210,116,128,128,199, 67, 78,158, 26,210, 66,145,117,236,236, 8,168,228, 10, 80,106, 13, 40,181, 22,214, 53,135,162,
+161,109, 55,208,186,203,141,171,148,124,180, 14,154,216,251,208,196,222,135, 81,135, 89,248,211,111, 84,169,134, 84,191,117,119,
+211,211,211,211, 34, 35, 35, 47,135,134,134, 14, 30, 49, 98, 4,238,222,189, 59, 5,192,180,194,238,155, 41, 35, 70,140, 64,104,
+104, 40, 34, 35, 35, 47,167,167,167,167,125,139,156,231,241,120, 10,149,170,160,141, 21, 10,133,130, 74,206,117,108, 51,100, 8,
+153, 19, 18,146,187,229,209,163,149, 7, 14, 30,228,246,232,222,157,208, 82, 20,104,157, 14,245, 93, 92,136, 94,189,122,137,252,
+ 79,159,182,100,105,181, 79, 22,250,248, 4,238, 25, 59, 54,239,153, 76,166,239, 64,243, 90,133, 93,134, 0, 80,171,130, 99,122,
+ 67,165, 82,109,255,241,135, 9, 61,130,238, 63,172, 81,179,134,163,201,141, 91, 65, 97,124, 35, 30, 89,183,118, 61,150, 52, 39,
+139,189,102,229, 82, 35,149, 74,165,175,104,117,179,178,178,194,167, 79,159,240,225,195, 7,168, 84, 42,104,181, 90,208,114, 25,
+212,210,108,168,115,178, 64, 40, 21,224,235,116, 80,102,164,162, 86,221, 58,192, 95, 51, 18, 43,237,138, 42, 75,104, 21,125, 10,
+ 76, 76,192, 21,137, 65,114, 56,122, 47,142, 14,160, 85,219,182,109, 79,159, 59,119,142, 59,113,226,196,118,183,111,223,222, 9,
+ 32, 62, 57, 57,185,251,242,229,203,159,237,220,185,147, 63,117,234,212, 6,155, 55,111, 30, 7, 96, 95,121, 36, 74,165,242,244,
+149, 43, 87, 70, 59, 59, 59,219,134,135,135, 67,169, 84,130,166,105,244,233,211, 7, 40, 24, 91, 3, 0,120,251,246,173, 66,169,
+ 84,166, 69, 68, 68,228,198,199,199,107,160,199, 44,193, 85,219, 37,143,115, 63,221, 31, 98,107,231,248, 68, 96, 84,171, 54,147,
+ 31, 50,120,238, 48,199, 77, 91,206, 38, 43,175, 71, 71,231,253,212,179,206, 6, 89,222,171, 25,102, 78,249,187,174, 7,196,232,
+ 51, 16,190,120,118,161,165,165, 37,216,108, 54, 56, 28, 14,184, 92, 46, 8,130,192,172, 89,179,176,127,255,254,202,186, 14, 63,
+ 19, 89,198,198,198,145,171, 87,175,118,154, 58,117, 42, 87, 32, 16, 64, 42,149,226,216,177, 99,152, 52,105, 18, 14, 29, 58, 84,
+230,248, 23, 61,186,148, 74,123, 75,231,140, 29, 59, 22,106,181, 26,222,222,222, 56,112,224,192, 28,157, 78, 23, 84,141, 71,250,
+ 73, 88, 88,152, 75, 88, 88,152, 9,128, 1, 35, 71,142, 60, 50,116,232, 80, 4, 5, 5,225,242,229,203, 93, 81, 48,233, 67, 1,
+192, 15,128, 77,225,103, 69,207,167,200,214,214,118, 55, 77,211, 3,172,173,173,195, 92, 93, 93,155, 28, 63,126,220, 44, 45, 45,
+173,104,242, 3, 98, 99, 99,113,248,240, 97,201,193,131, 7,115,117, 58,157, 37, 73,146, 87,178,179,179,151, 84, 32,216, 14,110,
+217,178,101, 66, 97,119, 32,206,157, 59,199,252,250,235,175,196,242,229,203, 33,149, 74,225,233,233,137,189,123,247,206,206,207,
+207,111,254,235,175,191,254, 48,124,248,112,172, 89,179, 6, 50,153,108, 75,101, 47, 43, 21,136, 47, 2, 64,199, 45, 91,182, 56,
+207,153, 51, 7,231,206,157, 67,171, 86,173,140, 98, 98, 98,246, 0,152, 92, 86,254, 49, 12,131,152,152, 24,200,229,114, 60,124,
+248, 16, 43, 87,174,148,150, 16, 89,179,167, 77,155,182,118,246,236,217, 88,191,126, 61, 19, 30, 30,158, 54,116,232, 80,219,253,
+251,247,179,234,215,175, 63, 91, 46,151,255, 99, 66,171, 65,125,139, 13,109, 90,117, 94,108,239, 88, 31,199,142,159, 64, 86, 86,
+ 86,113,154, 20,165, 11,195, 48,200,203,203,195,167, 79,159, 96,106, 98,140, 77,155,215,126, 55,125,202,132, 26, 40, 8,131,241,
+165,203,178,174,249,230,161, 35, 39,206,247, 30, 61, 1,225, 97, 47,225,127,100, 31, 34,194, 67,139,249, 40,173, 6,239,162, 94,
+224, 93,212, 11,216,218, 57,163, 87,143,174,196,168, 81,163,250,140, 29, 61,210, 26,192,223, 22, 58,226,255,177, 55, 11,248, 50,
+142,214,254,207,132, 86, 37,238, 58, 43,115,115,243,200, 83,167, 78, 89,186,187,187,179, 40,138,194,245, 27, 55, 48, 99,218,247,
+ 24, 55,214, 23, 26,152,131, 82,115, 65,115, 5,122, 89,162, 80,200,193,128,129, 76, 38, 67,112,112, 48, 24,154,130,255,254, 95,
+193, 48,116,177,208, 2, 24,168, 53, 26, 56,214,108,128,221, 7,214, 81,224,112,158, 65, 91,118,232,154,220, 76,150, 78, 75, 49,
+ 72, 78, 75, 64,130, 36, 2,166,198, 53,193,230,212, 68,102,182, 28,108,210, 14, 90,229, 91,232, 10,175,149,203,146,160,208,124,
+ 93,254,233,202,240,158, 50, 85,168,116, 21, 10,197,209,163, 71,143,126,247,219,111,191,241,250,246,237,235,122,246,236,217,142,
+ 0,208,183,111, 95, 87, 19, 19, 19, 28, 61,122, 84,173, 80, 40,142,126, 67,143, 79,183,182,109,219, 66, 42,149, 34, 54, 54, 54,
+172,194,123, 83,171, 45,197, 54, 54,172,180,187,119,181,233, 82,105,141,110,221,186, 17, 90,138, 2, 73, 16,200,202,201, 65,124,
+ 92, 28,204,204,204,136,200,183,111,197, 59,102,206,188,224,218,164, 9,187,104, 70,162, 62,184,124,249,178, 16, 5,227,178, 42,
+ 60, 86, 69,200,210, 82, 63, 77,240,241,241,185,112,244,232, 49,211,212,180,212,119,124, 30,143, 18,139, 5, 14, 99,199, 76,103,
+103,103,103,143, 6,144,175, 47,153, 84, 42, 69, 76, 76, 12,140,140,140,192,229,112, 64, 43,228,208,201,242,161,204, 74, 7, 75,
+163, 6, 79,167,131,133,144,143, 26,182,182,168,105,109,165, 23,231,135, 59, 55,139, 7,190,151,236, 46,220,212,214, 13, 60,145,
+ 24, 60, 99, 49,166, 7,220, 43,124, 27,229, 2,203,127,214,135,214,202,209,209,241,207,227,199,143,115,211,211,211, 17, 26, 26,
+ 26, 6, 32, 7,128, 49, 0, 58, 42, 42,234,118, 68, 68, 68,191,194, 89,119,149,205, 22,251,245,252,249,243, 61,221,221,221,169,
+218,181,107,139,210,210,210,106, 72,165, 82, 90, 34,145,124,230, 18,186,121,243, 38, 63, 47, 47, 79, 70,211,244,133, 66,145, 85,
+105,252,162,185,195, 28, 5,193, 33,152,229,225, 85,171,169,137, 85, 51,100, 81, 33, 77,159,132, 73,102,205, 29,230,184,125,203,
+217,100,165, 17,161, 58, 66,232, 18,107,176, 5, 74,125, 7, 49, 51, 64,193, 88,169,224,224, 96,196,199,199, 35, 38, 38,230, 51,
+ 65, 53,101,202, 20,248,251,251,235,229,209, 18,137, 68,235, 87,173, 90,229, 52,103,206, 28,110, 9, 81, 4, 31, 31, 31,228,228,
+228,224,192,129, 3,240,241,241,169,114,195, 95, 10,117,186,117,235,214,215,222,222, 30,153,153,153,176,179,179,131,187,187,123,
+255,160,160,160,218, 0, 98,171, 89,238,167,123,121,121,173, 93,189,122, 53,180, 90, 45, 38, 77,154,132,247,239,223,159,126,255,
+254,253,214,154, 53,107,206, 90,180,104,145,173,173,173, 45, 70,140, 24, 33,162, 40,106, 72,121, 36, 22, 22, 22,126,251,246,237,
+ 27,221,183,111, 95, 82,163,209,116,185,115,231, 14,226,226,226,160, 86,171, 65, 81, 20, 62,126,252, 8, 31, 31, 31, 73,225,236,
+198,143,122,216, 53,113,217,178,101, 19,102,205,154,133,141, 27, 55, 98,213,170, 85,191,155,154,154, 54,105,209,162, 69,203, 85,
+171, 86, 97,225,194,133,112,118,118,134,165,165,101,195,229,203,151,187,205,155, 55, 15,219,183,111,199,202,149, 43,127, 7,112,
+184, 58, 9, 65,211, 52,177, 97,195,134,230, 91,182,108,177, 47, 18, 89, 36, 73,226,212,169, 83, 8, 9, 9,233, 31, 29, 29, 93,
+214, 53,123,237,236,236,166,216,219,219,243,110,221,186, 37,118,118,118, 6, 69, 81,218, 66,145,181,163,102,205,154, 51, 62,126,
+252,136,190,125,251, 34, 58, 58,250, 40,128,113,166,166,166,178,121,243,230, 9,141,140,140, 76,229,114,249, 63,213,120,131, 69,
+ 18,227,215,175, 89,136,231, 33,111,113,254, 60, 23,207,159, 63,135,173,173, 45,248,124, 62, 24,134,129, 74,165, 66,122,122, 58,
+180, 26, 21,154, 54,174,131, 63, 14,110, 64, 90, 90, 58, 64, 18,229, 14,185, 33, 72, 98,204,132,239, 7,227,193,195, 27,216,179,
+103, 31,242,243,101,229,188,124, 11, 80,223,213, 13,142, 14, 54, 72, 76, 74, 4, 65,194,234,239,188,215,255,231, 93,135,197, 85,
+ 16,244, 9,239, 80, 18,102,102,102, 91, 79,158, 60,105,233,233,233,201,146,201,100,160,105, 26,157,221,221, 49,107,206, 28, 92,
+ 62,126, 28, 46,237,188, 65,168,197,160,132,250,205,122, 80, 42,228,104,212,178, 35,134,143, 24,137,132,248,120,120,245, 27, 10,
+165, 82, 94,252,134, 81,228,209, 82,171, 53,176,178,169,129,155, 55,111,178, 48,105,210,107,236, 40,219, 41,161,211,240, 94,189,
+251,168,236,148,173, 8, 65,240,115,127,104, 84, 26, 52,109,186, 28, 26,218, 18, 54, 78, 83,160,213, 94, 68,110,250,157,130,110,
+ 12, 75, 79, 36, 37, 36,128,100,113, 35,171,155,130,180, 44,253,171, 42,221,156,156,156,156,152,152,152,179,193,193,193, 99,134,
+ 12, 25,130,155, 55,111,254, 0, 0, 67,134, 12, 65,112,112, 48, 98, 98, 98,206,230,228,228,228,124,139,220,182,183,183, 31,208,
+181,107, 87,239, 54,109,218, 32, 32, 32, 0, 12,195, 60,208,235,193,230,112, 24,146, 36, 65,211, 52, 8, 0,153,217,217,120,255,
+254, 61, 50, 51, 50,160,213,106, 33,203,207,167,221, 92, 93,243, 25,154, 54,174,138, 61, 37,103, 24,162,140, 89,135, 69,199,170,
+113,171,241,207,158, 60, 74,200,203,207,183, 54, 55, 51,207,227,241,120, 58,105,118,118,206,235,200,112,181,158,141, 67, 17,162,
+ 34, 34, 34,154,164,164,164, 32, 33, 33, 1,148, 44, 15, 44,149, 26,164, 74,142,238, 29, 59,192, 8, 12, 4,160,193,161,181,224,
+176, 56,200, 43,152,157, 87,105,119,135,174,196, 75, 66,145,200, 34, 8,162,160,187, 80, 36, 2, 79,108,252,153,135, 75,159,242,
+196,231,243,143,159, 57,115,198,222,209,209, 17,107,214,172,129,147,147, 83, 67, 7, 7, 7,185,169,169,169,145,173,173, 45, 26,
+ 53,106,132,142, 29, 59,226,218,181,107,208, 35, 13, 40,134, 97,122, 61,120,240, 96,254,163, 71,143,134,139, 68, 34, 98,230,204,
+153,236, 62,125,250,128,207,231, 67, 46,151, 67, 42,149,226,196,137, 19, 25, 52, 77, 23, 77, 74,177, 20, 10,133,135, 9,130,136,
+149,201,100,115, 74, 19,254,241, 91, 83,135,180, 44,122, 18,147, 47, 28,236,225, 85,171,105, 55,175, 30,168,227,210, 13,221,188,
+ 18, 0, 96,131, 5, 59,206,251,151,101,102, 23,204,140,137,195, 55,175,223, 90,233,238,209,109,217,226,252,187,107, 55,238,207,
+174,116, 60, 29, 65, 16,160,105,250,179,216, 65,165,127, 31, 55,110, 28, 78,157, 58, 85,105, 58,146, 36, 57,114,234,212,169,220,
+ 82,158,103, 36, 39, 39,163, 95,191,126, 24, 50,100,200,103, 66,203,202,202, 10,118,118,118,136,139,139, 3,128, 76, 61,203,213,
+172,137, 19, 39, 18, 10,133, 2,147, 39, 79,198,129, 3, 7,224,237,237, 77, 4, 5, 5,205, 2, 48,167,170,133,157, 36,201, 77,
+139, 22, 45,154,239,227,227,131,172,172, 44, 92,189,122, 21,125,250,244,193,169, 83,167,172,175, 94,189,186,222,211,211, 19, 44,
+ 22, 11, 1, 1, 1,160, 40,170,194, 88, 95, 92, 46,119, 64,223,190,125,201,196,196, 68,112,185, 92,180,110,221, 26, 73, 73, 73,
+144,203,229, 72, 78, 78,198,236,217,179, 63,101,102,102,118,213,247, 57,226,114,185,115,102,205,154,133,147, 39, 79,194,215,215,
+247, 8,128,201, 57, 57, 57,195, 31, 61,122,116,114,224,192,129, 72, 78, 78,198,133, 11, 23,176,114,229, 74, 98,220,184,113,216,
+181,107, 23,102,207,158,253,123,161,215,169,188,130,159,151,150,150,102, 90,175, 94, 61,164,166,166, 34, 63, 63, 31, 23, 46, 92,
+176,185,118,237, 90,109, 71, 71, 71,147,152,152, 24,221,207, 63,255,204,155, 51,103, 14,182,110,221,138,208,208, 80,248,251,251,
+163, 91,183,110, 84,116,116,116,153, 94,178,194,144, 13, 23, 24,134,185, 37, 18,137,144,151,151, 87,244,220, 45,240,245,245,245,
+241,243, 43,112,178,167,164,164, 96,252,248,241, 99, 3, 3, 3,105, 79, 79, 79, 33,151,203,133, 82,169,148,253,147,173, 54,173,
+163, 1,208,168, 93, 67,140, 27,151, 15,226,101, 88, 52, 94,134, 69,128,199, 47, 24, 4,175, 80,200,209,178,105,125,180,107,221,
+ 22, 41,146,100, 28,245, 63, 8, 11, 43,199, 10,235, 17,134, 97,192,101,235,224,230,106,135,227,254,251, 16,112, 53, 16,254, 71,
+ 79, 20,143,121, 99,179, 57,104,209,178, 29, 90,183,118, 71,116,204, 71, 28, 60,184, 7,214, 54, 53, 12,157,131,213, 68,113,215,
+ 97,201,207, 82,202,191,155,187,187, 59, 43, 63, 63, 31, 74,165, 18,159, 62,125, 66, 92, 92, 28,204,204,205, 16,157, 18,139,174,
+ 66, 13, 62,209,185,136, 10,139,212, 17, 44, 78,104,101,127,216,215,163, 5,224,209, 2, 51, 38,122, 87,240,202,202, 64,100, 98,
+ 85,208,117, 67, 81, 31,176,125, 59, 85,158,208,162,116,218,219, 55,110,221,105, 59,113,220, 0,206,205, 59, 7,160, 85,211, 80,
+104, 77, 33, 83,170, 33,211,112, 64,154,246, 1, 50,130,192, 98,243,209,190,121,125, 92, 56,127, 77,195, 80,218, 64,189, 19,200,
+182, 9,168,212,136, 18, 66, 43,173, 84,191,131,133,222, 93,135,197, 13,175, 78,119,234,216,177, 99,131, 58,116,232, 32,244,244,
+244,172, 87,216,112,106,142, 29, 59, 38, 47, 12,134, 89, 85,124, 22, 13,222,206,206,174, 37,151,203,245,238,211,167, 79,203, 9,
+ 19, 38,224,245,235,215, 56,122,244,232,187,250,245,235,223,149, 72,202,159,145,205,226,241, 50,243,211,210,204,196,181,107,179,
+205,141,141, 83,174, 93,189,234,220,163,103, 79, 34, 33, 33, 1,153,153,153, 80, 42,149, 8, 13, 11, 99, 56, 44, 86, 18, 97, 98,
+ 66,190, 13, 9, 33, 89, 60, 94,102,121,222,198, 50, 16, 87,201,172, 67,191,234,122,183,106,216,155,215, 91,233,251, 99, 29,165,
+ 74,217, 36, 55, 55,151, 98,115, 56, 28, 39, 59,179,248,183, 31,245,175, 19, 85, 42, 85,192,237,219,183, 7,245,232,209,131,255,
+238, 85, 40,168,156, 28,168,115,164,224,210, 58, 88,180,108, 14,150, 70, 5,168,181,112,116, 99,160,204, 22, 34,232,233, 91,173,
+ 74,165,170, 52,168, 97,145,208, 34, 75, 9, 3,158, 88, 12,190,177, 9,248, 98,113,105,193, 80,217,155,156,176, 87,175, 94,221,
+219,183,111, 15,134, 97,176,127,255,126,104, 52, 26,158, 70,163,129, 90,173,134, 70,163, 65,110,110, 46,252,253,253,177,123,247,
+238, 71, 0,126,215,227,246, 41, 35, 35,163,129, 4, 65,216,176,217,108,185,181,181,181,232,212,169, 83,197,225, 38, 90,180,104,
+ 1, 99, 99, 99, 46, 10,131, 66,218,216,216,112, 14, 29, 58,100,214,191,127,255,251,101,118,119, 52,109,184,176, 14,101,238, 33,
+ 48,170, 85,219,196,170, 25,234,184,116, 3, 0,244,236, 55, 17,117,234,215, 68,110,198,171,218, 74, 69,220, 96, 46, 91,106, 30,
+185, 61,249,181, 81,223, 38, 19,100,105,247,222,163,236,233,253,101, 54, 20, 36, 73,150,219, 29,171,143,200, 42,208, 44,164,117,
+209, 56, 31, 0,200,204,204,132, 68, 34, 65, 84, 84, 20, 26, 52,104,128,172,172, 44, 56, 58, 58, 66,173, 86,163, 77,155, 54, 80,
+ 40, 20,216,178,101, 11, 30, 62,124,248, 8,192,108, 61,254,195,200,197,197,101,124,203,150, 45,113,245,234, 85, 60,127,254, 60,
+249,198,141, 27,142,238,238,238,168, 93,187,246,132,216,216,216,165,133, 93,125,250, 66,228,238,238, 62,211,199,199, 7, 17, 17,
+ 17,248,241,199, 31, 51, 19, 19, 19, 47,156, 62,125,122,242,202,149, 43, 73, 47, 47, 47, 72, 36, 18,108,218,180, 73,247,240,225,
+195,205, 0,214, 84,146,142,111, 18, 19, 19,157,148, 74, 37,178,178,178, 64, 81, 20,228,114, 57,174, 93,187, 6,127,127,255,212,
+ 66,145,245, 65, 95,227,154, 55,111,222,136, 36, 73,156, 60,121, 18, 0,126, 66, 65,196,254, 11,131, 7, 15, 78,254,249,231,159,
+ 29,151, 44, 89,130, 31,126,248, 1, 26,141, 6, 27, 55,110,196,146, 37, 75,174, 20,138,172,138, 42,209,223,236,236,236,166,252,
+248,227,143, 13,231,205,155,135,224,224, 96,155, 23, 47, 94,180, 14, 13, 13, 69,141, 26, 53,144,153,153,201,182,180,180,196,214,
+173, 91, 49,119,238,220,115, 0, 50, 30, 63,126, 60, 50, 38, 38,198, 15,192,166, 74, 68,251, 94, 71, 71,199, 41, 12,195, 48,114,
+185, 60,206,215,215,119,211,186,117,235, 48,119,238, 92, 68, 70, 70, 34, 39, 39, 7,198,198,198,196,162, 69,139,198,255,244,211,
+ 79,152, 52,105, 18, 35,147,201,118,255,211, 13, 53,195,232, 32,151, 70, 64,167, 50, 71,139,166, 13,208,162, 73, 45,220,184,243,
+ 18, 0,208,125,168, 59,228,178, 60, 28, 57,178, 31, 31, 62,188, 7,155,195,129,153,133,157, 62,158, 64,168,115,223, 32, 91, 35,
+ 65, 15,207,214,232,227,213, 21,191,255,113, 10,148, 86,131,201, 19, 71, 67,154,157,141, 63,254, 56,136,232,152,143, 96,115, 56,
+176,180,250,251, 3,161, 86,164, 69,254,223, 11, 45, 61,186,159, 64,211, 52,146,147,147,241,226,197, 11,196,198,198, 66, 40, 20,
+ 66, 65,233,232, 61,183, 31,210, 4,193, 77,162, 25,230, 17, 67, 21, 71, 41,254,146, 67,167, 75, 46, 17,177,214,212,220,220,156,
+167, 82, 41, 64, 81,218, 18,173, 10, 1, 16, 0,151, 13,216, 59,212, 65, 98, 66, 34,163, 84, 42,239, 85,248, 6,165, 82,110,189,
+116,225,140, 79,199, 78,238, 86,125,186,175,198,133,139,203, 33,205,205,133, 82,195,129, 76,169,129, 92, 9,152, 89,184,162, 77,
+211,102, 72, 73,201,196,171,231, 65,249,108,149, 92,159,129,162,239,119, 44,155,232, 50,113,198, 66, 24, 57,119,130, 42,234, 2,
+232,252,212, 98,143,150, 64,108, 14,139,154,110,200,150,169,112, 38,240, 37, 80,133,165, 94,210,210,210,228, 44, 22,235,152,143,
+143,207,198,151, 47, 95, 56, 1,192,203,151, 47,147, 36, 18,201,226,180,180,180,170,250,164,139,162,193, 19, 2,129,209,203,250,
+245,235,167,180,110,221,218,116,240,224,193,176,178,178, 66,104,104, 40,252,252,252,222,104, 52,154,133, 65, 65, 65, 21,118,245,
+168,213,234,228,151, 23, 47,154,116,253,254,123,179,133,253,251,111,242,241,241,217,186,102,205, 26,142,139,139, 11,161,213,104,
+ 16, 30, 30,206, 28, 63,118, 76,187,123,201,146, 45, 60,145,136,253,236,210, 37, 14,165, 82, 37,255,167, 11,177,163,163,163,135,
+123,151,206,110,155,127,219, 14,165, 34, 31, 79,131,175, 64, 42, 77,199,190,253,231,221, 28, 29, 25,143,228,228,228, 32,125, 5,
+240,225,195,135,231,183,107,217,178,101,221, 26, 53, 16, 30, 31, 11, 30,173, 3,151,162,192,210,168, 64, 82, 74,212,104,194,128,
+ 32,141, 33,249,148,139,117, 39,207, 70,232, 35,140, 27,126, 55, 0,107,146,114, 64, 16, 4,126,237,208, 4, 60, 99, 49,184, 34,
+ 49,166,255,121,167, 88, 24, 4,172, 89, 2,158, 88,140,122,237,244, 10, 8, 47,191,123,247,238,139,240,240,240, 54, 77,154, 52,
+193,252,249,243, 17, 23, 23, 7,154,166,145,154,154,170,148, 72, 36,201,233,233,233,113, 40,136,255,115,160,146, 70,172,164,234,
+112, 12, 10, 10, 42,238,110, 8, 12, 12,132,131,131, 3, 76, 77, 77,145,155,155,139,169, 83,167,154,173, 88,177, 2, 0,240,226,
+197, 11,148, 20, 40,165, 17,254, 50,106,115,118, 30, 35,101,242, 67, 6,103, 81, 33, 77,187,121, 37,162,103,191, 9,184, 21,240,
+ 59,238,220,184, 13, 11,118, 92, 44, 68,121,215, 50, 98, 51,114,147,100, 46,123,221, 90, 77,102, 73,100, 55,246,206, 28,240,142,
+101,111, 79,159, 89,178, 39, 55,187, 34, 91, 93, 92, 92, 96,107,107, 91, 60, 70,139,205,102, 99,210,164, 73, 96, 24, 70, 95,145,
+ 85,216,214,208,233, 74,165,210, 86, 32, 16,224,211,167, 79,248,248,241, 35,162,163,163,139, 67, 7,208, 52,173, 93,176, 96, 1,
+103,230,204,153,216,179,103, 15,238,221,187,247, 8,192,106, 0,250,190,172,141, 30, 49, 98,132,177, 90,173,198,137, 19, 39, 40,
+ 0,253,206,156, 57,243,162, 77,155, 54,236,222,189,123, 27,239,218,181,107,116, 97, 30,233, 45,180, 76, 76, 76,184, 26,141, 6,
+187,118,237, 66, 98, 98,162, 7,128,168,103,207,158,237, 29, 49, 98,196,238, 38, 77,154,212,143,136,136,120,159,159,159, 63, 29,
+192,171,202,200, 82, 83, 83, 39,182,110,221,250, 12, 77,211,206, 61,122,244, 16,253,246,219,111, 38,111,223,190,133,147,147, 19,
+104,154, 14, 71, 21,151,176,122,255,254,125,148, 68, 34,113,235,218,181, 43,174, 93,187,182, 65,167,211,173, 7,176,113,218,180,
+105,142,241,241,241,104,217,178, 37, 44, 44, 44,240,246,237,219, 60,137, 68,178, 27, 5, 75, 18, 85,230,194,141, 1,176,120,239,
+222,189,205,246,238,221,235,109, 97, 97,209, 62, 52, 52, 20, 15, 30, 60,192,230,205,155,177, 98,197, 10,116,238,220, 25,243,231,
+207,207, 0,224, 13,128,138,137,137,209, 43,110, 94,145,103, 11, 0, 90,181,106,149,226,231,231,135,201,147, 39, 51,135, 14, 29,
+218,118,236,216,177, 57,163, 71,143, 46,110, 3,199,143, 31,207, 28, 61,122,116, 60, 10,150, 97,250, 39,161,213,104,212, 48,177,
+168,131,252,236, 4,164, 39, 6, 67,104,108, 7,175,110,205, 33, 87,168,113,249,210, 57,188, 10, 15, 3, 73,146,176,181,171, 1,
+ 51,115, 43,188,123,247, 30,168,120,182,177, 86,163,209,192,216,188, 22,242,115, 18,161, 78,123, 9, 35,177, 13, 38,124, 63, 24,
+114,133, 6,231, 47,156, 67, 68,196, 43,176, 88, 44,216,217,215,128,169, 89, 1, 39,193, 84, 60,131,217, 0, 0,101,196,211,170,
+ 84,104,177, 88,172,187,215,175, 95, 31,214,174, 93, 59,246,135, 15, 31,240,225, 67,193,203,141, 84, 42,165, 8,232,206,166,133,
+ 95, 26, 85,193,229, 61, 80, 56, 59,163,228,218,133, 98, 99,227,228,183,111,162,108,165, 89,169, 8, 11,121,136, 15,239,194, 17,
+ 27, 29, 5,141, 70, 9, 22, 73,130,100,145,168, 85,167, 49, 30, 62, 10, 86, 43, 41, 42,184, 60,206, 2, 59,162,243, 68, 54, 46,
+ 35,215,174, 89, 26, 48,119,225, 42,163,225,195,246,224,213,219,215,200,167,236,192, 48,128,157,165, 8, 45,234, 46, 66,114, 74,
+ 58, 78,254,190, 75, 78,107, 52, 99, 74,197,208,250,130, 19, 0,108, 51,208,104,247,254,223, 39, 29,240, 63,190,106,225,204,169,
+182, 3,135,140, 1, 47,235, 53,180, 41, 47, 81,167, 77, 31, 16,124, 51, 92,189,121, 7, 65, 47, 94,167,210, 58,102,149,109, 38,
+ 14,189,171,132,179, 36,178,179,179, 31,127,250, 36,113, 42, 17, 5,222,137,207, 23, 84, 54, 59,174, 52,231,103, 17,231, 89, 44,
+178,213,218,181,107,181,182,182,182,154,136, 61,213,231,155, 0, 0, 32, 0, 73, 68, 65, 84,136, 8,236,217,179,135,126,249,242,
+229, 77,146, 36,119, 72, 36, 18,101,101,156,214, 90,109,216,113, 95,223, 70,109,135, 12, 97, 70,205,156, 41, 7,159, 63,107,211,
+175,191,250,166, 75,165, 14, 12, 77,195,218,194, 34,105,211,146, 37,126,195, 70,140,144, 70, 62,124,104, 20,124,241,162, 17,143,
+162, 94,234, 97,231,183, 64,185,156,201,201,201, 65,247,238, 61,192,145, 3,191, 65,163, 81, 65,146, 28, 15, 0,200,200,204, 65,
+ 37, 34,171, 52, 39, 35,151,203,135,252,180, 98,197,147,159,230,206,177,235,210,189, 7, 18,194, 66,161,201, 74, 7,161,165,192,
+ 33,216,144,165, 9,145,150,154,143,197, 71, 79,167,229,203,229, 67,202,104, 36,202,180,179,200, 99,197, 55, 49, 6, 87, 36, 6,
+ 79,108,252,153, 23, 75, 96, 98, 2,158, 72, 12, 54,143, 87,214, 0,238, 47, 56,243,243,243,135, 14, 27, 54,236,213,179,103,207,
+204, 39, 79,158,140,142, 29, 59,134, 40, 20, 10, 79, 0,121,213, 77, 79,154,166,147,187,116,233, 66, 18, 4, 33, 30, 51,102, 12,
+ 63, 61, 61,189, 56,178,122,126,126, 62,174, 93,187,134, 6, 13, 10,102,245, 71, 70, 70,162,113,227,198,229,114,254,176, 56, 34,
+ 25,192,154,185,195, 28, 55, 61, 9,147,204, 2,176,161, 78,253, 26,184,115,227, 54, 30,220, 9,246,109,223,132,222,254,221,152,
+ 54, 63, 11, 61, 71, 44,116,107, 53,153, 37, 54,177,199, 31,231,207,177,162, 94, 30, 92, 39,151,135,215,195,158, 11, 11,202,179,
+147, 32, 8, 48, 12,243, 69, 40, 7, 22,139,133, 99,199,142, 85,245,222, 79, 31, 56,112, 96,218,143, 63,254,200,149, 72, 36,120,
+243,230, 13,100, 50, 25, 4, 2, 1,110,220,184, 65, 1,216,117,236,216,177, 27,199,142, 29,235,141,130,217, 68,129, 85, 41,159,
+ 34,145,200,199,203,203, 11,111,222,188,193,243,231,207,207, 1,120, 21, 18, 18,114,238,195,135, 15, 35, 59,119,238,140,223,127,
+255,221, 71,161, 80, 28,168, 10, 39, 77,211, 37, 99, 38, 21,173,248, 16,150,159,159,223, 62, 56, 56,184,170,249, 46,201,204,204,
+236, 84, 40,172, 19,109,109,109, 77,194,194,194, 80,179,102, 77,104, 52,154,118, 85, 45, 75, 57, 57, 57,191,237,216,177,227,208,
+196,137, 19,241,243,207, 63,143, 57,125,250,244,152,239,190,251, 14,125,251,246,197,225,195,135,241,234,213,171, 13,208,111, 89,
+177,178,238,253, 21,128, 87,182,182,182, 51,106,212,168,129,205,155, 55, 35, 60, 60,220,111,205,154, 53, 75, 94,189,122,133, 6,
+ 13, 26,240,163,162,162,168,234,212, 33, 0, 96, 98, 98, 98,162,213,106,113,241,226,197,167, 0,230,142, 25, 51,198,102,235,214,
+173,222, 98,177, 24, 89, 89, 89,138,136,136,136,209, 0, 46,253,211,117, 29, 67, 16,203, 38,255, 48,107,239, 15,147, 71, 11, 90,
+183,106, 1,121,110, 18, 20,249,169,144,231,125,194,142, 3, 55, 65, 16, 36,172,173,237, 97, 99,231,132,248,248, 4, 60,186,114,
+ 85, 45,147, 43,182,242,180,244,134,138, 57,103, 22,112,182, 44,224,148,203,210,160,200, 79, 43,230,180,177,113, 40,228,140,199,
+195,224,171, 74,133, 76,246,155,154, 33,126,249,155,239,253,255, 51,170,182,214, 97, 73, 72,165,210,217, 83,167, 78,245, 92,188,
+120,177, 37, 69, 81, 44, 11, 11, 11,196,199,199, 83,103,207,158,205,202,207,207,159, 93, 29,107,216, 28,206, 43, 23,215, 6,158,
+ 3, 7, 14,164, 6, 12,232,207, 29, 59,177, 55,219,218,198, 6, 57,217,153,120,247, 38, 20,111, 95,191,132, 75,131,230, 88,185,
+102, 11, 96,102, 86,233, 66,146,133,203,234,244, 91,253,211,130, 83,157, 60,122,153, 52,104,220,156,219,162,158, 41, 52, 90, 10,
+ 73, 73, 73,184,116, 49, 76, 19,241,226, 65, 46, 77,169, 71,202, 51,244, 91,130, 39, 8,160,144,137,125, 77,108, 52,199,214,111,
+218, 49,127,215,190, 35, 11, 23,207,154, 44,234,236,222, 19,225,183,127,199,185,128, 83, 50,165, 74,189,137,203,194,175, 17,153,
+144,191,171, 98, 26, 40,149, 74, 77,233,246, 84,169, 84,106,190, 54,167, 15, 31, 62,140,212,212, 84,117, 92, 92,220,117,138,162,
+ 78, 87,176,216,243, 23,216, 1,168, 7,171, 84,183,127,114,119,239,253,211,141, 27,130,241,139, 22,169,199,140, 29,187, 0, 42,
+149, 6, 60, 30,195, 22,137, 72,240,249,156,200,135, 15,141,182, 77,155,102, 65,168,213,183,142, 84, 16, 54,160, 12,124,243, 89,
+135, 69, 30,173,174, 93, 59, 99,252,228,185, 80,148,240,104, 61,126,254, 14, 42, 13,244,246,104, 21, 34, 33, 46, 49,177,253,172,
+101, 63,157, 31,233,213,221,173,137,115, 45,190,117,237, 90, 16,219,217, 33, 51, 61, 29, 15,159,191,213,174, 57,117, 62,162, 80,
+100,233, 21, 87,134,166,233,130, 65,238, 0,186,207, 94, 12,130,197, 2, 10,195, 56, 20,205, 28,170,221,166, 35, 8, 54, 27, 58,
+134,134, 74,165,210,103,208, 95,210,199,143, 31,135,142, 25, 51, 38, 48, 32, 32,128,244,242,242,106,113,225,194, 5,250,107,202,
+142, 66,161,104, 15, 0, 2,129, 32,214,204,204,204,113,226,196,137,208,106,181,144,203,229,200,201,201, 65, 82, 82, 82,246,196,
+137, 19, 53, 0, 96,100,100,196, 27, 54,108,152, 73,101,156, 91,206, 38, 43,231, 14,115,220,110,193,142,243,206,205,120, 85,219,
+130, 29, 23,219,190, 9,189,125,203,217,100,165,137,131,108,109, 70, 92,208, 59,137,236,198,222, 63,206,159, 99,141, 27, 60, 84,
+231, 36,126,239, 43,176, 97,206, 86,198, 75, 16,196, 23,193, 73,245, 20, 89,159, 33, 47, 47,111,201,242,229,203,251, 74,165, 82,
+167,222,189,123,115,221,220,220,240,228,201, 19, 4, 4, 4, 80,143, 31, 63, 78,148,201,100, 75, 1, 40, 1,220,172, 78,154,186,
+186,186,214,102,179,217, 69, 93,105, 59, 11, 15,239,188,112,225,194,200,201,147, 39,163, 86,173, 90,141,162,162,162,248,168,194,
+115,196, 48, 76,113, 47,195,183, 4, 65, 16,209,219,182,109,115,180,179,179, 35,174, 93,187, 70,177, 88,172,234,120,110, 14, 31,
+ 60,120,176,157, 86,171,253, 97,202,148, 41,240,240,240, 0, 69, 81, 56,122,244, 40, 14, 30, 60,168,175,200,170, 16,239,222,189,
+123,153,152,152,216,101,193,130, 5,216,188,121,243,146, 5, 11, 22, 32, 49, 49, 17,239,222,189, 11,253, 26,222,220,220, 92, 69,
+ 66, 66,130,176, 67,135, 14,173, 35, 34, 34, 34, 60, 61, 61, 27, 79,158, 60, 25, 27, 54,108, 96,238,221,187, 55, 12,192,181,255,
+ 68,235,253,246, 67,150, 63, 71,199,190,177,102,237,111, 43,234,213,173,253,227,164, 9, 35, 88,174, 46,141, 33,203, 73,130,165,
+149, 45,156,106,212, 65,122, 90, 6,174, 95,191,166,203,200,200, 62,172, 35,137,213, 31, 62,100,165,124, 13,167,163, 83, 29,164,
+165,165,225,234,213,171,186,108,105,238,126,104,201, 53, 81,241,217,169, 48, 64, 31, 79,214, 20, 84, 16, 37,190, 34, 88,153,155,
+155,159, 48, 49, 49, 73, 53, 49, 49, 73, 53, 55, 55, 63, 1,232, 53,251,160, 71,137,218,129,245,217, 54,108,152, 0, 2, 65,123,
+176,217,243,204,204,205,175,153,154,154,102,118,237,218, 85,189,119,239, 94,101, 84, 84, 36,157,156,156,200,152,154,154,230, 20,
+159, 95, 22,103, 41,152,155,215, 53, 22,217, 55, 94, 97,234,212,226,161,216,190, 81,158,216,190, 81,158,169, 83,243, 71, 34,251,
+ 70,171,204,205,235, 26,235,101,103, 57,168, 99, 3,107, 23, 43,236,106, 96, 77, 40, 92,172,176,171,142, 13,172,245,190,247,138,
+187,253,116, 4, 1, 29, 10,166, 97,163, 26,156, 69, 28, 52,139,197, 58,226,228,228,100,143,170, 5,172,251,130,115, 44, 80,107,
+ 44,159,255,195, 25, 95,223,241,177,247,238,141,201,141,137, 25,149, 19, 29, 61, 34,244,212,169,145, 59, 71,142, 28, 59,138,207,
+159, 50, 12,168,171, 47,167,189,189,189,223,203,151, 47, 3,244,221, 74, 8, 47,189,211,179,110, 29,199, 27, 94, 61,218, 49, 62,
+ 83,135, 48, 62, 83,135, 48, 94, 61,218, 49,117,235, 56,222,248,138, 60, 34, 88, 44,150,183, 80, 40, 60, 33, 18, 10,195, 69, 66,
+ 97,184, 80, 40, 60,193, 98,177,188, 81,241, 24,170,207, 56, 45, 45, 45, 95,216,218,218,166, 86,101,179,178,178, 10,169,130,157,
+163,106,215,174,157, 72,146,228,150, 42, 62,211, 21,113,186, 24, 25, 25, 69,139, 68,162,164,146,155,145,145, 81,201,192, 80,150,
+ 66,161,240,178, 72, 36,218,170, 15,231, 47,203, 26,175,120,116,115,198,171, 95,150, 53, 94, 81,250,183,153,131,204, 39, 62, 9,
+ 92,157, 57,115,144,249, 68,125,236,180,177,177,185,103, 99, 99, 35,177,177,177,145,216,218,218, 86,184, 89, 89, 89,189,208,131,
+ 83, 96,108,108,188,213,216,216, 56, 85, 36, 18,233,196, 98,113,170, 72, 36,218,130, 18,161, 45,170,155,158, 36, 73,110,104,212,
+168,145,146,197, 98, 29, 42,245,211,230,122,245,234, 41,217,108,246,166, 42,114,154,116,238,220, 89, 23, 22, 22,198,120,120,120,
+ 48, 0,204,191, 97,190,219,153,155,155, 95, 51, 49, 49, 73, 48, 54, 54,222, 1, 64, 84, 77, 78, 2,128,183,163,163, 99,104,183,
+110,221,228,142,142,142,193, 0, 6,126, 67, 59,251, 14, 26, 52,136, 78, 72, 72, 96, 24,134, 97, 18, 18, 18,152, 65,131, 6,209,
+ 40, 8, 20,249, 53,117,242,178,105,211,166, 49,143, 31, 63,102, 30, 63,126,204, 4, 7, 7, 51,125,251,246,165, 1,124,255,149,
+245, 60,190,213,189,187,213,177,170,219,176,190,249,233,209, 67,221,233,155,151,182, 48, 43,151,254,200,244,244,104,204, 52,168,
+103,126,222,197,197,210,229, 91,112,174, 88, 58,149,233,209,165, 17,237, 86,215,252,148, 91, 29,171,186,255,240,189,255, 27,189,
+ 90,248,187, 7,156,253,229, 90,252, 92, 44,149, 13, 7, 7, 7,100,102,182, 19,176,217,238,124, 62,223,147,100,177,238,102,165,
+167,207, 41,124,221,210,253, 83,174,218, 10, 27,244,186,224, 85,176, 36, 65,117, 56, 63, 27,200, 94, 77,206,170,112,232,197, 89,
+222,162,210,180, 74,149, 98, 73, 81, 47,118,160,194, 52,248,140,211,209,209,241, 7,154,166,107,235,107, 16, 73,146,177,201,201,
+201, 7,170,147,158,245,235,215,103, 10,187,183,137,111,153,239,127, 71, 89,250, 95,226,252,227,183,166, 14, 13,154, 54, 92, 24,
+254, 50,106,115, 97,183, 98, 49, 86,205, 52, 55,118,239,214,117,249,195, 59,247,126, 94,181, 67,154,247, 31,190,119, 18,122,142,
+105,251, 6,156, 69, 65, 66,171,196,201,225,112,246,182,109,219,246,135, 39, 79,158, 28,210,233,116, 83,254, 71,203,103, 95, 22,
+139,181,192,213,213,181,197,187,119,239, 66,117, 58,221,102,148, 17, 40,178, 26,118, 46,173, 93,187,246,116, 46,151,203,207,207,
+207,151,166,164,164, 44, 7,112,250,191, 45, 61,221,234, 91,180,102,152,226,160,219,235,222,124,204,122,246,205, 56, 25, 90, 71,
+ 51,172,181,239, 98, 50, 67,254, 3,249,254,111, 19, 89,251,255,137, 63,238, 97,224, 52,112, 26, 56, 13,156, 6,206,111,206,105,
+100, 72, 79, 3,231,191,144,243, 95, 9,182, 33, 9, 12, 48,192, 0, 3,254,223, 65, 97, 72, 2, 3, 12,248,175, 67, 73,175, 86,
+177, 55,139,168, 64,149, 86,197, 37, 88, 29,101,123,219,192,105,224, 52,112, 26, 56, 13,156, 6, 78, 3,231,255, 28,231,191, 85,
+100,237,175, 96,255,111,131,193,173,106,224, 52,112, 26, 56, 13,156, 6, 78, 3,167,129,243,127, 65,104,149,185,111,232, 58, 52,
+224,111,199,246,193,112, 4,128, 89, 23,144,252,119,156,111,128, 1, 6, 24, 96,128, 1,255, 97,236, 71, 57, 93,135,255, 13, 66,
+203, 1, 64,123, 20, 44,124,251, 22,192, 3, 0,210,175,224,179, 2, 48,130, 32,136,225, 0,192, 48,204, 25, 20,204, 26,201,208,
+231, 98,129, 64,144,170, 84, 42,109, 10,191,167, 41,149,202,146,107, 25, 16,248,114, 54, 27, 83, 98, 43, 19,181,107,215, 78, 85,
+169, 84, 54,122,252,125, 14,195, 48,175, 72,146, 12, 23,139,197,119,222,189,123, 23, 80,149, 27,247,244,244, 28,207, 98,177,214,
+ 1,128, 78,167, 91,118,247,238,221, 35,127, 99,190,181,171,225, 96,247,187, 70,171,161, 82,211,179,150,227,203, 64,126, 0,128,
+ 93,253,224, 71, 80, 88, 88,248,125,211,140,128,138,227,232, 84,245,252, 10,208,154,195,225,248,216,218,218,246, 73, 74, 74,122,
+ 1, 96, 17, 80,121, 84,227, 26, 53,106,124,207,102,179,199,232,116,186,186, 44, 22, 43,154,162,168, 99,137,137,137,254,134, 58,
+196, 0, 3, 12, 48,192, 0, 61,196,214, 23,168,146,208,106, 96, 9, 59, 6,240, 6,129,158, 96,112,139, 0, 78,190,205,196, 39,
+125,175,255,174, 1,180, 90,170,224, 63,185, 36,116,215, 62,146,251,251,244,233,227, 52,115,230, 76,116,236,216, 17, 79,158, 60,
+233,112,248,240,225,137,167, 79,159,126, 69,211,244, 93, 0, 79, 0,189, 66, 41,136, 80, 16,167,101,116,159, 62,125,122,172, 91,
+183,142,213,184,113, 99, 40, 20, 10,220,187,119,207,125,211,166, 77, 91, 31, 61,122,116, 27,192,241, 66, 65, 80,238, 2,120, 74,
+165,210,166,104, 49, 78,130, 32,108,134, 13, 27,246,172,164,184, 42, 92, 95,141, 96, 24,230, 49, 65, 16,193, 58,157,238,201,217,
+179,103, 19, 27, 0,237,166,214,230,158,157, 19,171,113, 42,205,169, 82,169,108, 46,254,178, 30,108, 62, 31,170,188, 92,116,152,
+240,151,232,189,181, 98, 33, 8,154, 2, 11,140,212,115,237,214, 87, 0,194, 83, 82, 82, 94,121,120,120,196, 86, 53,135, 89, 44,
+214,186,235,215,175,219, 51, 12, 3, 47, 47,175,117, 0,254, 46,161,197,111,223,186,249,221,203,231, 78, 8,242,179, 82,209,123,
+224,200, 99,239, 19,211,198, 3, 56,247,153,104,234, 3, 91,130,192,194,105,235,143,179, 0, 96,247,210,209,139,182,244,194,246,
+185, 55,241, 9,128,103,161,248, 1,128, 95, 0,220,221,213, 7,182, 0, 22, 79, 91,127,156, 0,128, 61, 75, 71, 47,220,213, 7,
+219,102, 92,171,114,216,138,233,227,199,143,223,190,110,221, 58,150,189,189, 61,146,147,147,123, 55,106,212,200, 53, 55, 55,183,
+ 17, 42, 24, 68, 92,171, 86,173, 83,157,187,245,175, 51,100,184,183,208,218,202, 28, 41,146, 12,147, 83, 39, 14, 77,101, 61,190,
+215, 39, 46, 46,110,164,161, 14, 49,192, 0, 3, 12, 48,160, 28, 84, 63, 50,124, 75,123, 24,201, 52, 24,196,102, 17,223,119,106,
+221,168,251,168,239, 58,147,141,220,234,227,117,100, 84,175, 75,119,158,110, 34,131, 35, 3, 41, 29,227, 47,226,226, 98,136,164,
+226,153, 48, 90, 10,236,155, 23,143, 23,180,132, 19, 71,179,158, 61,123, 86,191, 85,171, 86,197, 75,195,116,239,222, 29,221,187,
+119, 39,118,239,222,221,252,230,205,155,205, 15, 30, 60,168, 9, 12, 12,252, 29, 21,199, 71,241,169, 87,175,222,166,237,219,183,
+243, 61, 60, 60,192,231,243,139,127, 16,139,197,232,223,191, 63,250,247,239,207, 74, 73, 73,241,186,124,249,178,215, 47,191,252,
+162,142,143,143, 95,128,191,162, 52, 87,136,229,203,151,183, 46,227,240,117,130, 32, 62, 82, 20, 21,218,188,121,243, 68, 87,160,
+254,212,239, 58,222,154,222,201, 69, 52,103,201,225, 50,121,216, 60, 30,254, 24, 95,208, 86,151, 20, 90,177,119,174, 65,108, 98,
+156, 41, 52, 54,126, 5, 32, 28,192, 43,134, 97,194,163,163,163,163, 26, 2,205,219,155,147,191, 31,146,210,205,170, 32,182,144,
+152,152, 8, 83, 83, 83, 35, 15, 15, 15, 9, 65, 16,171,238,221,187,247,173, 7,228,181, 91,181,112, 58, 87, 26,247, 10,159,222,
+ 60,198,188,225,238,194, 57, 59,254,252, 89,169,214,158,171,232, 34,130, 32,201, 95,130,105, 95, 20, 44,198,187, 60, 51, 51,211,
+ 3, 0, 44, 45, 45,121, 0,238,110,121,138,239,230,118, 34,190, 38,182, 27,151,197, 98,237, 58,124,248,240,228,239,191,255,190,
+ 96,233,136,135, 15, 33, 22,139,177,102,205,154, 90,243,231,207,247,163, 40,106,118,121,158,172,206,221,250,215,217,182,249,231,
+ 70,121, 89, 57,170,125,187, 78, 63,119,104,210,128,156,230, 51,223,120,155, 70,101,167,211,233,190, 55,120,182, 12, 48,192, 0,
+ 3, 12,168,138, 55,171, 82,161,229,106,133, 35, 45,155,184,140, 24,213,215,157,223,180, 73, 99,112,249,127,133,110,105,213,186,
+ 53, 90,181,110, 77,250,230,231,245,124,246,252,101,207,179, 55,159,168,228,218,248,211,239, 50, 48, 94, 95,171,138, 22,165, 93,
+ 55,208,182,155, 44, 59, 77, 0, 0, 34, 51, 27,229,210,139,159,238,116,234,212, 9, 78, 78, 78,220,192,192,192, 73,149, 8,173,
+165,111,223,190,229,179, 88, 21,199, 67,117,112,112,192,176, 97,195,208,160, 65, 3, 94,215,174, 93,151,150, 39,180, 4, 2, 65,
+ 26, 65, 16, 54, 0, 96, 97, 97,161, 91,181,106, 85, 40, 83, 0, 0, 96, 24,134,121, 76,146,228, 19,154,166,159,254,249,231,159,
+ 73,141, 0,155,222,173, 26, 60,152, 62,118,152,144, 57,187,181, 92,145,160,204,205, 45,243,184, 80, 44, 74, 55, 18,137, 94,241,
+133,130,112, 20,172,229, 21,238,228,228, 20,213, 8,112,106,219,160,246,205,221,115, 71, 27, 31,154,242,115,165,105,217,178,101,
+ 75,215,102,205,154, 9,116, 58, 29,100, 50, 25,246,236,217, 99,106,100,100,100,218,167, 79,159,149, 37, 11,128, 27,208,116,168,
+ 3,107,202,234, 20,221,140,106, 20, 36,179,206, 29, 90,199, 13,235,223,199,164,117,251,206,120,127,247, 40,178,178,242,144,147,
+157, 15,154,166,191,136,235, 51,227, 26, 82,119,245,195,166,221, 75, 70, 47, 38, 72,146,104, 62,120, 17, 6,216,229,204,218,187,
+119,111, 36, 0, 14,143,199, 43, 89, 14, 29,140, 28,155,108,170,223,171, 51,246, 44, 27, 11,134,166, 25, 0,155,170,224,205,178,
+ 49, 54, 54,190,116,243,230,205,118,109,218,180,193,147, 39, 79, 16, 19, 19,131,233,211,167,171,103,204,152,193, 29, 55,110, 28,
+ 49,111,222,188,153,191,252,242,203, 89, 0,143,190,120, 16,216,236, 49, 3,135,140,228,229,103,231, 42,213, 42,141,218,194,202,
+140, 86,201,148,242, 12,105,174,114,228,232, 31,212,145, 33, 79,199, 0,248, 66,104,125,101,122, 26, 96,128, 1, 6, 24,160, 7,
+ 24,134,105, 3,192, 26, 64, 58, 65, 16,207, 75,238, 23,158, 82,180, 90, 75,233,253, 12, 20,244, 74, 89,150,160,203, 64,193,112,
+ 31,107, 0, 58, 0,207, 8,130,144,126,165,137, 21,207, 50, 12, 8, 8, 96, 74,126,150, 16, 90, 12,195, 48,140, 54,243, 35,163,
+122,119,141,145, 63, 63,240,197,166,136, 60,199, 72,158,157,102,158, 30, 95,193,184, 90, 85,188, 10,251,119, 13,160, 29,221, 12,
+204,180, 54, 96,102,119, 53, 83, 62,123,246, 44,144,166,233, 0,223,206, 96,152,215,199, 25,230,245,113,102,110, 7, 48,103,207,
+158,189,238,231,231, 23,224,239,239, 31, 0,160,178,113, 74,169,121,207,131,153,167, 54, 96,202,195,219,183,111,153,189,123,247,
+ 50, 75,150, 44, 97, 14, 29, 58,196,160,146, 8,234, 94, 94, 94,247, 34, 34, 34,152,113,227,198,133,162,130,192,128,110,128,104,
+ 76, 45,187, 55,170, 83, 91, 53,234,239,155, 50,210, 46,130, 50,239,223,222,222,254, 51,123, 54,184,216, 49, 59,219,186, 48, 71,
+122,182,250,196, 48,204,117,134, 97, 54, 48, 12, 51,146, 97,152, 6, 0,208, 18, 48, 25,104,111,249, 65,121,122,155, 66, 61,165,
+125,165,235,222,181,108,217,210,117,193,130, 5, 89,106,181,154,137,141,141,101,246,237,219,199,220,186,117,139,185,120,241, 34,
+227,238,238,158, 82,194, 94,219,137, 13,156, 83,213, 7, 87,171,170, 83,138, 56, 44,214,206,231,183,206, 50, 31, 30,156, 97,158,
+157,244, 99,142,253, 52,138,153, 57,176,157,198,196,136,175, 4,208,173,188,235,102,116, 66,253, 6,181,172,223,197,199,199, 51,
+ 26,141,134,153, 48, 97, 2,227,229,229,197,244,234,213,139,233,209,163, 7,211,189,123,119,166, 91,183,110,204,157, 59,119,152,
+148,148, 20,166, 71,231, 86,178,126,110,104, 93, 5,211,154, 56, 59, 59,127,138,141,141,101, 52, 26, 13, 19, 24, 24,200, 28, 61,
+122,148, 9, 12, 12,100,124,125,125, 25, 0, 71,166, 77,155,166,144, 74,165,140,151,151, 87, 18,202,136, 26,239,236,236, 28, 21,
+241, 46, 49,113,203,250, 3,119,254,216,121,226,206,249,179,183,238, 92,186,241,236,202,197, 27,207, 79, 63, 13,139,190,232,236,
+236, 28, 85, 70,254,127, 85,122, 26, 96,128, 1, 6, 24, 80,185, 22, 41, 20, 90,125, 11,157, 29,125, 25,134,233, 81,106,191,111,
+161,112,250, 98,223,215,215,119, 73,201,253,162,115,124,125,125,151, 0, 96, 58,116,232,112,130, 97,152,250,223,192,252, 41,101,
+108,149,123,180,138, 64, 37, 61, 3,215,165, 15, 56, 58, 45,180, 25,111, 65,103,199, 3, 34, 59, 40, 8, 49, 50, 37,241,120,243,
+224, 92,197, 11, 73, 20,226,234, 91,112, 0, 4, 70, 69, 69,225,205,155, 55, 72, 76, 76,132, 80, 40,252,226,188,135, 15, 31,194,
+200,200, 8,246,246,246,250, 41, 93,245,231,237,220,171, 86,206, 16,119,240, 64,198,168, 31, 17, 24, 24,136,180,180, 52,112,185,
+ 92,240,120, 60, 80, 20, 85, 41, 31, 73, 22,172,248, 91,228,197, 42,235, 28, 15,128,205,183, 16, 95,222,189,114,118,109,242,113,
+ 0, 71,145,240, 1, 41, 74,157,126,158, 60,177, 8, 66,145, 80, 98,100, 36, 44,238, 46, 4, 16, 78, 16,196,251,150, 0, 71, 36,
+ 22, 92,254,125,237, 60, 59, 86, 72,160, 64,241,225, 85,153, 28, 61,122,244,152, 10, 96, 37,195, 48,217,205,154, 53,179, 93,183,
+110,157,121,114,114, 50, 94,191,126,141,211,167, 79,167, 83, 5, 55, 74, 48, 12,179, 26, 0,218, 3, 2, 51,107,179, 27, 59, 87,
+204, 54,198,221, 83,188,234,148, 34, 83,183,254, 87,134,142,155, 54, 99,251,236,254,144,229, 41,112,252, 86, 8,174,191,252, 56,
+ 0,192, 67, 84, 48,238,109,215, 35,124, 0,210,187, 15, 25, 50, 36,244,254,253,251, 86, 7, 15, 30, 4, 69, 81,101,110, 7, 15,
+ 30,196,237, 7, 47,103, 1,120,161,167, 89, 14,181,107,215,190,253,244,233, 83,107,161, 80,136, 91,183,110, 33, 59, 59,187,216,
+147, 53,126,252,120, 34, 59, 59,219,123,207,158, 61, 67,227,226,226, 54, 63,120,240, 32, 19, 5,107, 65,126, 86, 16, 88, 44,214,
+ 71,138,210, 52,180,119,171,207, 30,222,191,115,231,252,204, 87, 16, 91, 54,195,227,176,143,151,179,165,153, 10, 22,139,245,177,
+228,249,223, 34, 61, 13, 48,192, 0, 3, 12,168, 26, 8,130, 8, 96, 24,166, 31, 65, 16, 1,165,143,149,254, 94,116,158,159,159,
+ 95,241,126,209, 53, 27, 54,108, 88, 95, 98, 95,254,141,204,171,112, 48,124,215, 66, 5,217,181,172,147, 84,175,207, 67,245,230,
+ 18,184,206,157,192,107, 48, 0, 44,103,119, 36,188,186,139,176,107, 91,144, 20,249, 16, 12,173,131,189,107, 91,125, 13, 81, 54,
+108,216, 16, 74,101,193,208, 44,149, 74, 5,174,200, 92, 57,111,202,104, 1, 0,208,108,129,170,132,130,213,139,208,184,147, 39,
+218,166, 50,120,102, 91,224,168,104,155, 90,112,221,218, 9, 19,192,229,114,193,229,114, 65, 20, 14,253,209, 71,104, 17,133, 39,
+211, 5,221, 87,101, 25, 65,200,249,156,227, 39, 87,250,180,229,199,133,243, 84, 17,143,145,162,162,153,203,169,186, 43,250,216,
+ 43, 20, 9,147,141,132,194,112, 35,177,168, 88,104, 17, 4,241, 17, 0, 24, 14,199,255,232,106,159,102,162,212,104,145,242,121,
+ 32, 36, 74, 90, 83, 14,205,234,107,215,174,217,176,217,108, 59,157, 78,135,132,132, 4, 68, 70, 70, 98,219,182,109,169,121,121,
+121, 93, 67, 66, 66,222,149,212,142, 58, 35,222,105,255, 53,179,235,176, 95, 5, 9, 84, 31, 35,170, 92,122,172,154, 12,242, 26,
+208,181,249,149,169, 99,151, 97,208,119,189, 48,174,107, 35, 38, 54, 37, 75, 9,224, 86,161,235,181, 50, 36,135,132,132,244,236,
+210,165,203,177, 22, 45, 90,184, 49, 12,131,166, 77,155,194,219,219, 27,254,254,254, 8, 11, 11, 67,110,110,174,230,230,205,155,
+ 91, 1, 28,214,211, 44,161,185,185,249,245, 59,119,238, 88, 11,133, 66,220,188,121, 19, 10,133, 2,246,246,246,152, 49, 99, 6,
+111,195,134, 13,127,228,230,230, 14,247,243,243, 19,196,198,198,238,188,113,227, 70, 45, 20,172, 59,247, 69, 33, 80,171,213,251,
+143,251, 31,217, 62,195,103,166,227,157, 39,175, 3, 85,249,121,166,206,206,137,185,214,230, 98,227,173, 27, 87,215, 84,171,213,
+ 83,203, 78,207,123,213, 74, 79, 3, 12, 48,192, 0, 3,190, 64,133, 90,164,164,120, 42, 45,182,170, 34,210, 0, 40,124,125,125,
+151, 18, 4, 17,224,235,235,187,212,207,207, 79, 1, 32,229,239, 16, 89,197, 66,171, 95,191,126, 65, 1, 1, 1,232,215,175, 95,
+ 80,185, 20,180, 14,154,216,251,208,196,222,135, 81,135, 89,248,211,111, 84,169,155,167,171,109, 93,255, 53,183,238,168, 84, 42,
+246,145, 35, 71,138,199,109, 1,128, 78,167,251,230,185, 88, 21,161, 85, 40,244,190, 48,162, 54, 95, 28,180,127,238,240,246,150,
+ 58, 57, 71,253,240, 50,146, 85, 52,181,249,131, 70,254, 60,155,249,165, 60,206,139,115,166, 34,241,193,109, 8,197,226,196,201,
+247,195,139,189, 88,133, 34, 43, 6, 0,106,241,141, 3,247,206, 30,228,110,199, 5, 87,125,229, 12, 82, 84,180,106,111,156,246,
+112, 57,133, 13, 12,195, 32, 38, 38, 6,114,185, 28,193,193,193, 56,119,238, 92,122, 25, 34, 11,181,249,226,123,135, 22,141,105,
+103,146,247,137,171,126,126, 27, 41, 42, 90,175,174, 46,171,166,131, 58,113, 73,226, 38, 65,178,140,186,183,119,197,156, 31, 6,
+ 99,203,161, 63, 41,181, 77,231,126,219, 47, 93, 29,145,175,210, 44,213, 83,100, 21, 59, 27, 67, 66, 66, 26,133,132,132,240, 1,
+120,122,123,123, 95, 29, 58,116, 40,130,130,130,112,249,242,101, 23, 0,146,194,243,214,160, 96,161,236, 95, 0, 68,151,231,120,
+228,114,185, 39,111,223,190,221,216,193,193, 1,183,111,223,134, 66,161,192,180,105,211,212, 62, 62, 62,220,241,227,199, 19, 57,
+ 57, 57,197,158,172,224,224,224,204,242, 68, 22, 0, 36, 39, 39, 95, 59,119,250,104,199, 46, 93,186, 12,174,227,210,192, 36, 58,
+ 47, 55, 77, 40, 20, 24, 61, 8,186,203,125,254,244,209,206,228,228,228,103,101,167,103,160,222,233,105,128, 1, 6, 24, 96, 64,
+249,208, 75,139,148,242, 76, 85, 5, 37,174,227,248,249,249, 69,250,249,249,125,230,241,250, 74,148,158,117,120,165,168, 77,171,
+ 86, 28, 45, 93, 78,194,151, 55, 64,211, 85,185,217, 47,142,153,155,155, 83, 70, 70, 70,159, 9, 45, 90, 79,206,172, 11, 39, 16,
+ 61,125,116,177, 39,171,200,179,133,222,227,191, 74,104,209, 52, 29, 12,224, 51, 35,132, 54,174,163,182,246,119,235,212,168,142,
+ 35,169, 61,189, 13, 73,114, 74,185,242,173, 70,249, 38,143, 25, 16, 85,198, 32,235, 98, 78, 74, 11,129,200, 40,222, 72, 44, 42,
+ 45,178,226, 0, 64,100,235, 50,116,115,159, 6, 93,155, 55,168, 71, 82,167,126, 67,178, 92,155,239, 27,165,209, 68,203,152,243,
+229,164,225,202, 94,189,122,173,180,180,180, 20,108,223,190,221,212,217,217, 25, 20, 69,169, 75,139, 44,161,141,235,168,109,131,
+154,116,114,181, 51, 39,181,103,119, 32, 81,161,147,111,139,214,254,161,143,200,178, 50, 21,223,216,187,126,186,145,144,207,129,
+ 82,169,196,134,221,103,113,243, 81, 68,191,140,136,139, 55, 0,220,248,138, 2, 57,185, 95,191,126, 91,214,172, 89, 3,173, 86,
+139, 73,147, 38,225,227,199,143, 55,223,190,125,187,173,102,205,154, 11, 22, 45, 90,228, 96,103,103,135, 17, 35, 70,112,181, 90,
+237,248,114, 56, 54, 30, 63,126,188, 95,243,230,205, 17, 20, 20,132,236,236,108,216,219,219,195,199,199,135,231,231,231,247, 71,
+110,110,238,240,245,235,215, 11, 98, 98, 98, 42,244,100,125, 86,174,117,186,181,251,182, 76, 95,208,166,189, 59,249,225,195, 59,
+ 42,161,173, 7,121,247,246,229,251,150,150,150,127, 36, 36, 36,252,149,158,131,155, 86, 57, 61, 13, 48,192, 0, 3, 12,248, 54,
+ 32, 8,226, 74,225,184,171,207,188, 92,165, 69, 88,145,199,170,228,126,233,243, 11,127,255, 22, 47,203,251,203, 16, 94,159,135,
+119,232,215,175,159,222,211,234,105, 89,186, 94,226,169, 52,190,107, 0,173,163, 24,236,165, 30, 36,184, 34,115,101,255, 53,183,
+238,148,119,174, 72, 36,210,219,163, 69,171,148,149,101, 74,149,132, 86,225, 24,173,235, 12,195,124, 38,180, 76,109, 93, 61, 22,
+ 47,154,189,213,125,104,111, 50,245,135, 14,200,206, 87,169, 22,189,166,232, 36,121,197, 34,171,160, 21,215,198, 10, 69,226,112,
+129, 72, 88, 82,100, 37, 0,128,192,166, 94,219,133,115,102,236,238, 54,170, 63,145, 62,205, 29,210,108,133,106, 65, 36, 69, 36,
+ 43,152,225, 81,192,221,178,232,238,220,185,179, 15,192, 62, 15, 15,143, 84,145, 72,132,252,252,252, 47,242,160,200,222, 78, 67,
+123,147,169,147,219, 33, 75,166, 81, 45,138,164,144,162,160, 79, 86, 38,178,172,205,140,111,236, 93, 55, 93,152,146, 20, 7, 46,
+151, 11,177, 88,140, 91, 15,195,145, 17,121,233,107, 4, 22, 72,146, 92,229,235,235,187,114,198,140, 25,200,204,204,196,229,203,
+151,241,221,119,223,225,196,137, 19,206, 87,175, 94,221,226,233,233, 9, 22,139,133,128,128, 0,104,181,218,247,229,208, 12,158,
+ 50,101,202,130,161, 67,135,226,217,179,103,144, 72, 36,159,121,178,178,179,179,189,119,239,222, 61, 52, 54, 54,182, 82, 79, 86,
+ 41,180,173, 93,175, 37,119,201,242, 95,161,146,167,177,211,147,159, 4, 5,222, 34, 31,103,101,101, 9, 1,228, 84, 55, 61, 13,
+ 48,192, 0, 3, 12,208,219,171, 85,158, 22, 73, 47, 20, 81,233,101,237,151, 16, 88,101,237, 19,165,188, 96,234, 82,191,135,253,
+157,247,164,151, 71,139,109,219, 4, 84,106, 68, 9,161,149,246,217,239, 2, 99, 11,189,186, 14,181, 20,216,123, 15, 23,199,209,
+ 18,100,102,102, 10,172,172,172,148, 37, 5,130, 80, 40,132,131,131, 3,164, 82, 41,246,239,223, 15, 84, 62, 40,154, 50, 25, 58,
+ 22,109, 71, 77,194,115, 39, 30, 24,173,166,216,179,181,119,194,132,207,196, 22,151,203, 45, 26, 27, 86, 89,163,251,180,208,211,
+244, 24, 0,211,210,165,206,207, 2,145,104,130,192,170,134,213,156,233,147, 57,177,105, 42,220,113, 95,146,125,118,227, 98,113,
+ 34, 35,158,145,128,156, 71,149,240, 69, 15,220,115,180,180, 39, 43,169,133, 75,157,101, 2,161,224, 7,158, 69, 45, 59,223,121,
+211, 57,177,169, 42,226, 78,219, 69,185,231,126, 89, 36,140,129,241,130, 36,100,223,213, 35,123, 86,126,247,221,119, 43, 25,134,
+ 97,104,154, 94, 14, 0, 37,237,157,231,243, 3, 39,250,147, 18,129,238,203,164,231, 54, 46, 54, 78, 68,197,246, 90, 53, 29,212,
+201,214,220,228,198,222,245, 51,132,146,228,120,240,249,124, 24, 27, 27, 35, 49, 53, 7, 28, 54, 75,241,149,229,141,223,185,115,
+231,197,211,167, 79, 71,120,120, 56,166, 77,155, 38, 73, 72, 72, 56,127,234,212,169,105, 43, 86,172, 96,123,121,121, 65, 34,145,
+ 96,211,166, 77,218,135, 15, 31,174, 7,176,169,204,242,200,102, 79,254,249,231,159,153,148,148, 20, 34, 38, 38, 6,246,246,246,
+152, 57,115, 38,111,253,250,245,197, 99,178,170,226,201, 42, 66,114,114,114,208,205,219,143, 49,224,218, 86, 80, 90, 85, 80,118,
+102,194,253, 55,209,210, 32, 11, 30,111,190, 99,203,166,213, 74, 79, 3, 12, 48,192, 0, 3,190,137, 23,235,121, 69,251,255, 5,
+ 40,171,235, 80, 47,161,245,126,199,178,137, 46, 19,103, 44,132,145,115, 39,168,162, 46,128,206, 79, 45,246,104, 9,196,230,176,
+168,233,134,108,153, 10,103, 2, 95, 2,192,251,170, 88,149,151,151,135, 86,173, 90, 97,215,120,215,110,202,188, 76,129, 17, 0,
+ 21,223, 68,121,145,215,249,206,213,171, 87,229, 52, 77,159, 4,112,181, 18,154, 85,141, 27, 55,222,249,235,175,191,242,220, 70,
+ 77, 68,254,147, 7,165, 61, 40, 48, 50, 50, 2,159,207,199,171, 87,175,112,231,206, 29, 53,128, 85,149,100,232, 83,138,162,194,
+ 78,157, 58,149, 84,191,142, 99,239, 86, 45,154,205, 90,186,196,215,248,245,131,155, 88,190,126, 39, 93,191,181, 87,206,134, 19,
+ 23,243,114,196, 53,187, 43, 36,111, 67,245,184,213,176, 82, 34, 43,165, 97,237, 26,221, 90, 52,105,188,112,249,242,101, 38,145,
+ 15,110, 97,197, 47,123, 25,151,230, 61,114,126, 57,119, 41, 55, 67, 88,171,151, 50,237,205, 51,125,210, 48, 40, 40,104, 31,128,
+125, 69,251,165,237,245, 93,179,141,118,109,211, 91,186,225,196, 57, 89,174,113,205, 30, 21,217,107,237, 54,184,163,147,181,249,
+141, 29,107,127, 20,126, 74, 78, 0,159,207,135, 88, 44, 70,130, 36, 27, 43,183,158,150,105,104,186,247,215, 10, 45, 99, 99, 99,
+190, 70,163,193,174, 93,187,144,144,144,208, 1, 64,194,139, 23, 47,246,142, 28, 57,114,123,211,166, 77, 27, 70, 70, 70,190,207,
+207,207,159, 1,224, 77,121, 36,102,102,102, 29,172,173,173,137,199,143, 31,227,199, 31,127, 84,207,156, 57,147, 59,110,220, 56,
+ 66, 42,149, 86,215,147, 5, 0,112,116,116,244,232,217,189, 61, 58,245,156, 22,164, 86,102,223,143,125,243, 71, 16,201, 60, 18,
+ 84, 55, 61, 13, 48,192, 0, 3, 12,248,159, 65,245, 2,131,123, 0,108, 87, 75, 76,109,236,200,253,228,191,113, 38,147, 23, 29,
+204, 40,158,237, 99,114, 47,252,192, 92,217, 52,142,185,186, 99, 14, 51,173,111, 99,166,161, 13,241,201,213, 18, 83, 61,190, 20,
+110,159,173,238,253, 93, 3,104,123,214, 3,211,179, 30,152,190,174,208, 2, 88,218,178,101,203,139, 62,109,255,138,163,229,211,
+ 22, 12,128, 31, 1,136,203, 49,171,172, 21,195,237, 1,236,111,213,170, 21,117,247,238, 93,230,237,240, 30, 76, 72, 67, 43,102,
+198,140, 25,204,138, 21, 43,152,209,163, 71, 51,214,214,214, 84, 97, 66,216, 87,198, 57, 96,192, 0, 39, 0,168, 81,163,134, 89,
+107,183,250,159, 94, 5, 94,102,238,251,111,103, 14,249, 12, 97,218, 53,117,203,176,107,216, 37,204,200,190, 65,139, 74,146,175,
+152,211,206,206,110, 9,195, 48,189, 25,134,177, 7, 0, 23, 23, 75,113,203,134,245, 83,194,110, 95,102, 30, 28,221,201, 28,242,
+ 25,194,180,111,214, 40,211,201,205,243,141,192,166, 97, 91,125, 56,203, 66,153,246, 54,105,152, 97, 91,191, 99,104, 5,246, 22,
+115,214,105, 59,226, 82, 82, 74, 42,243,244,233, 83,230,234,213,171,204,131, 7, 15, 24,255, 83,151,152,154,109,134,231, 91, 53,
+ 29,212,169, 10, 69,167, 60, 59, 77,251,246,237,203,188,127,255,158,233,211,167, 15, 3,192,180,154,156, 23, 99, 99, 99,153,136,
+136, 8,102,233,210,165, 12,128, 35,211,167, 79, 87,228,228,228, 48, 61,122,244, 72, 40, 20, 88,236,234,216, 89,183,182,227,134,
+193,253, 59,175,242,249,113,168,199,215,166,231, 55,132,129,211,192,105,224, 52,112,254, 47,112,254,127,134,125,161, 87,171,232,
+179,165, 94, 30,173, 32,128, 66, 38,246, 53,177,209, 28, 91,191,105,199,252, 93,251,142, 44, 92, 60,107,178,168,179,123, 79,132,
+223,254, 29,231, 2, 78,201,148, 42,245, 38, 46, 11,191, 70,100, 66,254,174, 18, 43, 10,227,104,125,134,144,144, 16,161, 69,189,
+191, 98, 48,125, 40,136,205,186,183,138, 55, 40, 1, 48,229,229,203,151,191,122,122,122,174,251,161, 83,219, 33, 62, 29,187, 65,
+171,213,194,223,223, 31,241,241,241,231, 1, 44,211,215,227, 22, 30, 30,158,209,168,158,243,108, 14,139,189,112,198,232,193,214,
+233, 31, 95, 35, 41, 42, 4, 0,160, 82, 41,180,159,222,223,111, 94, 21,227,140,140,140,158, 90, 91, 91,191,181,182,182,150,186,
+214,169, 49,133, 15,206,242,105,222, 3,109, 50, 99,223, 32, 49,178,160,103, 84,165,148,107,146,222,223,109, 88,157,220,117,118,
+118,230,139, 56,152, 90,166,189,106,165, 54,245,195,155, 22,250,240,200, 85,234,245,171,183,248,247, 90,187,112, 2,223,196,196,
+ 4, 47, 35, 62, 96,249,111, 39,100, 10,181,182,119, 70,248,197,111,210, 61,198, 48, 12,180, 90,173,222, 19, 29,202,193,226,230,
+205,155, 55, 88,183,110,157,203,248,241,227,241,181,158,172,146,136,142, 77,246,117,172, 81,183,209,135,183, 47, 61, 45,140,184,
+199,190, 38, 61, 13, 48,192, 0, 3, 12,248,159, 65,223, 66,103,206,148, 18,159, 33,149, 10,173, 34, 68,164, 65, 14, 96, 77, 29,
+ 86,254,222, 37,235,182,172, 36,137,173, 19,104,134,249,157, 34,177, 58, 38, 19,233, 95,105,156,156,195, 6,213,107,208,104, 54,
+ 0,112,216,213,107, 32, 11,241, 30,192,208, 3,143,158,181, 57,240,232,217, 79,133,199,214, 2,168, 82, 95,174, 49, 27, 17,238,
+141,234, 58,118,110,217, 88,192,210, 41,144, 20,245, 17, 89, 50, 37,110, 69,198,103,147, 12,249,123, 85,141,138,137,137,185, 7,
+ 0,182,166,194,168,206,141,234,213,236,210,170,177,144, 67,168,145,244,250, 37,114, 20,106,220,140,140,207, 1, 65, 84,123, 64,
+245,183,178, 55, 53,252,210,243, 63, 65,244, 32, 8,226,246, 82,159, 81,252,149,191,157,252,166, 34, 11,128, 60, 57, 57, 57, 83,
+ 46,151, 91,166,164,164,168, 81,253, 32,113, 31,114,115,115,155,206,153, 51,103,205,130, 5,216, 12, 53,220, 0, 0, 32, 0, 73,
+ 68, 65, 84, 11, 22,110,220,184,145, 91,157, 49, 89,229, 65,154, 28,127,161, 75,227,111,151,255, 6, 24, 96,128, 1, 6,252, 79,
+ 96, 74,169, 79,232, 45,180,138, 5, 67, 26,210, 1,204,168, 91,151,153, 23, 29, 13,245,183,178,172, 44, 79,215, 87,226, 57,128,
+254,213,190,154, 36,242,158,188,143,207,127,250, 62, 62, 31, 52,195,208, 12,163, 34, 73, 36,202, 52,154,245,239, 99,146,171, 63,
+235,142, 32,116,207, 63, 36, 40, 94,124, 76, 84, 50, 52,205,208, 12,163, 38, 8,124,210,106,233,245,145, 49,241,151,254, 27,236,
+205, 8,191,248, 40,128, 34, 58, 63,122, 26, 49, 79, 38,211,236,204,136,186, 24,252, 13,243, 69, 27, 30, 30, 62,166, 67,135, 14,
+ 19,117, 58,221, 94, 0,218,175,224, 82, 83, 20,181,120,195,134, 13,231,195,195,195, 79, 7, 7, 7, 75,190,133,200,250, 91,243,
+223, 0, 3, 12, 48,192,128,127, 43,170,183,168,116,121,248,150, 34,235,191, 17, 17, 31,226, 90,253, 29,188,145, 31,226,154,252,
+127,176, 55, 53,234,194,139, 84,192,251,111, 74,222,155, 58,157,238,230,183, 20,213,215,175, 95,175,141, 50,150,213,249,111,203,
+127, 3, 12, 48,192, 0, 3,254,181,152, 82,158,248, 98, 27,210,198,128,127, 1,152,111, 37,178, 12, 48,192, 0, 3, 12, 48,160,
+ 26, 40,215,163, 69,160,252,153, 3,183,171,240, 7,213,153,125,112,219,192,105,224, 52,112, 26, 56, 13,156, 6, 78, 3,231,255,
+ 28,231,191, 17,246, 40, 24, 16,127,165,240,179, 66,241,245, 45, 97,152,250,106,224, 52,112, 26, 56, 13,156, 6, 78, 3,167,129,
+243,223,142, 50, 7,194, 3, 5,131,135, 13, 48,192, 0, 3, 12, 48,224,255, 19,248,133, 91,117,127, 55,192,128,191, 91,108, 21,
+ 11,174,234,140,209,170, 95,248,249,225,111, 52,214,199,222,222,126, 74,179,102,205,220,184, 92, 46,153,151,151,183,250,238,221,
+187,171, 74,159,212,185, 17,251, 5,139,132,211, 95, 71, 8,128, 96, 1, 36, 9, 29,131,164, 7,175, 20,173, 13,249,254, 95, 13,
+103, 35, 19,235, 63, 9,146,197,211, 81, 26,232,180, 26, 20, 12,183, 42, 0, 77, 83,241, 58,141,202,171,188,139,237,154, 15,174,
+ 73,233,232,141, 0,179, 11, 32,167, 3,244,110, 2,236,105, 12,168, 61, 4, 88, 63,130,197,252, 2, 29,177,136,205, 97, 45,145,
+132,156, 77,252, 55, 36,216,153, 51,103, 88, 95,115,253,240,225,195,203, 92, 64,212,193,193, 33, 64, 40, 20,214, 43,239, 58,153,
+ 76, 38,145, 72, 36,158,255,242,242,216, 5,192, 14, 0,141, 75, 29,127, 3, 96, 54,128,192,175,253, 3, 15,128,109, 11, 76,229,
+ 2,139, 0, 64, 3,252,146, 10,236, 11,250, 47, 26, 99,104,109,109,125,159,205,102,187,200,100, 50, 89, 94, 94, 94, 93, 99, 99,
+227,104,145, 72, 36,162, 40,234,125,122,122,122,151,138,174,101, 10, 38,165, 84,138, 38,128,241, 59, 96,164,142, 36,103,114,128,
+ 93, 42,154,222, 91, 88,131,235,179,192,237,116,252,181, 60,215, 66, 0,187,171,248,187, 1, 6,252, 29,248,170, 89,135,174, 5,
+245, 3, 60, 0,116,105,211,166,141,173, 76, 38,195,155, 55,111, 82, 1,220, 7, 16, 84,184,189,251, 22,150,146, 36,185,121,203,
+150, 45,243,103,206,156, 89,188, 24,244,171, 87,175,208,188,249,151, 49, 66, 89, 36,156,238, 94,190,109,243, 60,252, 29,218,244,
+ 24, 86, 40,180, 72, 64, 38,129,103,207,182,213, 53,193,216,220,220,124, 53, 65, 16,195, 73,146,172,180,210,160,105, 90,199, 48,
+204, 25,169, 84,186, 18, 64, 94, 85,254, 72, 36,228,107, 41,157,174,204,255, 96,179, 88, 58,153, 92, 85,110,216, 11, 11, 11,139,
+ 96,146, 36,235,148, 92, 48, 27,248,124, 1,237,242,126,163, 40, 42, 41, 35, 35, 67, 31, 17, 42, 32,217,220,217, 4,193,237, 9,
+146,118, 5, 8, 16, 32,223,209, 58,245, 45,154,210,108, 3,160,252, 26,145,101, 95,163,238,131,185,203, 54, 56, 69, 68,189,193,
+ 82,159,209,216,184,227, 8,150,204,158,136,109,251, 79, 96,246,148, 81,104,212,168,113,133,181, 46, 13,238,250,101,179,134,247,
+240,219,117,218,125,201,140,225,124,191, 93,103, 58, 47,245, 25,201, 91,191,243,116,231,165, 62, 35,248,126, 59, 79,187, 47,153,
+ 53,220,104,253,238,179, 52,128,177,213, 49,114,148,139,131,140,160,168, 50,223,140, 25, 54, 91,117,226,125,138,232, 63,241, 68,
+143, 31, 63,190,153, 66,161,120, 57,186,103,203, 13, 45, 92, 29,147,203, 58, 39,243, 83,178, 99,244,219, 16, 95, 14,215,168,213,
+ 64,223, 35,175, 42,116, 15,240,249,117,222,188,121,227, 66,211, 52,116, 58, 29, 40,138, 42,254, 84,171,213,232,210,165,203,183,
+154, 56,211, 31,192,234,130,135, 21,126, 0, 78,127, 5,151,152,205,102,207,229,241,120, 30, 20, 69,185, 1, 0,135,195,137, 82,
+169, 84, 65, 20, 69,109, 1,144, 95, 69,190,173,201,201,201,141,196, 98, 49, 52, 26, 77,241, 2,244, 44, 22,171, 97,205,154, 53,
+119, 41,149, 74,151,175,189,121, 91, 96,106, 71,119,247,109,227,230,207,103, 41,238,223,199,182,195,135,183, 34, 55, 23, 0,118,
+ 85,118, 45,143,199,187, 65,146,164,115, 85,254,143,166,233,120,181, 90,237, 85,149,107,216,108,182, 75, 74, 74,138,141,131,131,
+ 3,242,242,242, 32, 18,137, 68, 69,251, 95,131, 32,128,232, 13,116,161, 88,172, 57,150, 86, 86,157, 95,222,188, 41,106,210,164,
+ 9,201, 98,177,150, 64,255, 32,213,124, 0,155, 24,134, 49, 42,108, 47,182,181,111,223,190, 3, 65, 16, 20, 0,134,166,105,242,
+233,211,167,163,104,154,102, 23,214,121,155, 0, 28, 6,160, 50,232, 0, 3,254, 1,111,214,254,170, 10,173,171, 0, 60,218,180,
+105, 99,228,237,237, 13, 15, 15, 15,184,184,184, 64, 32, 16, 20, 84,226,153,153,182,161,161,161, 35,238,223,191, 63,226,242,229,
+203,120,253,250,181, 2,192, 67, 0,101, 62,212,221,251,185,207, 20,136,249,219, 1, 32, 61, 41, 83,146, 20,147,182, 93, 34,145,
+108, 2, 80, 50, 68,120,221,177, 99,199,206,155, 53,107, 22, 2, 2, 2,112,226,196, 9,168, 84, 42,228,229, 85,160, 95,228,105,
+144,222,217, 0,136, 98,129,132, 32, 64,104, 3,136,108,171,157, 82,230,230,230,171,103,207,158, 61,167, 81,163, 70,197, 81,204,
+181, 90, 45, 40,138,130, 86,171,133, 84, 42,197,188,121,243, 10, 26, 90,134, 1, 77,211,184,118,237,218,204, 41, 83,166, 64, 42,
+149,206, 45,139,179,125,171, 26, 47, 72,130,116, 42,242,213, 48, 58, 93,210,147,208,164,214,148, 78,199, 82, 42, 53,101,174, 84,
+ 46, 16,112, 43, 20,121, 28, 14,199,233,245,159,127,218,144, 60, 30, 24,157, 14,160,105, 48, 52, 93,152,156,133, 27, 83,112,140,
+209,209, 96,180, 58,208, 20, 13, 74,161, 66,219,233,211,245, 73,138,142, 28,158,209,137, 49, 63,204,183,107,215,190, 61,167, 86,
+ 13, 7, 80, 58, 26, 31, 99,147,236, 94,190,120,210,233,204, 31,187,166,169, 21,121,163, 0, 84, 43,206, 22, 79,104,114,115,231,
+158, 3, 78,207, 67, 35, 16,120,247, 62,110,223, 9, 2, 0,220,184, 27, 92, 36,184, 43,205, 42, 80,249, 77,103, 79, 26,196,223,
+176,243, 36,103,246,164,193,172,141, 59, 79,113,102, 77, 28,200,218,176,253, 4,119,214,196,129,172, 13, 59, 78,112,103, 77, 26,
+196,242,219,118,168, 25, 0,115, 0,210,242,200,202,203, 35,130,162,248,199,162, 83, 89, 0,144,190,119, 47,180,105,105,112, 88,
+185, 18, 0, 48,166,174,173,222, 93, 19, 86, 86, 86, 47, 56, 28,142, 83,101,231,105,181,218, 74, 69,240,248,241,227,155, 43, 20,
+138, 23, 20, 69, 49,108, 54,219,119,244,224, 94, 23,123,119,110,158, 89,242,156, 87,175,194, 44,215,175,255,115,208,233,151,121,
+204,136, 86,198, 47, 3, 54,143,111,221,111,193,145,176, 10, 26,100, 82,165, 82,225,253,251,247, 40,185,200,123, 9,232,170,249,
+ 72,145, 0,182, 89, 90, 90,182,203,204,204, 28, 3, 96,105,110,110,110, 51, 22,139, 5, 11, 11,139,165,106,181,250,163,169,169,
+233,193,156,156,156,224, 66,175,145,190, 75, 6,116, 49, 49, 49,241,191,112,225,130,121,203,150, 45,201,140,140, 12,212,174, 93,
+ 27, 89, 89, 89,109,239,223,191,223,106,210,164, 73,147,242,242,242,190, 47,124, 25,212, 23, 13,132, 66, 33, 51,110,220, 56, 66,
+167,251,235,118, 15, 29, 58, 4,175, 38, 84, 61,107, 51,161, 92,169,102,114, 2,223,155,254,200,229,114, 31,198,199,199,231, 84,
+ 53, 49,184,192,162,113,243,231,179,196,113,113, 16,135,133, 97, 76,110, 46,123, 99,129,119,171, 82,161, 69,146,164,179,255,137,
+223, 93,120, 60, 30, 40,138, 42, 22,131, 69,117,148, 86,171,133, 70,163,129, 86,171,133, 78,167,131, 86,163,133,223,218, 95,170,
+ 93, 23, 10,133, 66,161,189,189,125,170, 80, 40, 20,126,165,184,172,153, 69,146, 63,180,104,213,106,202,202, 65,131, 4,207,158,
+ 61, 19,144, 36, 9,138,162,176,105,211, 38,138, 97, 24,179, 70,128,201,107, 32,183,170,220,124, 62,159,253,199, 31,127,140,226,
+241,120, 0, 0,181, 90,141, 38, 77,154, 16,134, 54,223,128,255,160,216,250,194,203, 85,145,208,234,147,155,155, 11,157, 78, 7,
+ 99, 99, 99,176, 88,159,183,251,150,150,150,232,217,179, 39,186,116,233, 2,111,111,111,188,126,253,218,200,219,219,187,103,121,
+100,163,231,247, 67, 13, 23,219,194,198,132,182,127,116, 37,116,195,161,159,207, 90,127,250,244,105,126,137,211, 38, 77,157, 58,
+149,200,204,204,196,240,225,195,239,171, 84,170, 1,168,224,225,211,209, 72,242,244, 30, 3,154, 33,140,182, 60, 61, 64,168,149,
+ 10,134, 36, 73, 69, 81,215, 97,117, 82,137, 32,136,225, 14, 14, 14, 56,121,242, 36,212,234, 47,195,133,153,152,152, 32, 50, 50,
+242, 47,175, 26,139,133,246,237,219,179, 8,130, 24, 14, 96,110,217,156,164,211,163,231,113, 54, 69,251,253,122, 54,230,182,111,
+ 69,166,166,164,202, 24, 0,196,178,101,203,138,133, 27, 0,172, 94,189, 90, 31, 59, 65,114, 56, 72, 15, 10,250,171, 34,102,147,
+ 32,185, 4, 8, 14, 64,178, 11,122, 81,193, 0,140, 14,160, 41,128,214, 2, 2,251, 26,250, 36, 67, 91,199,154, 46, 1,235,127,
+219,109,166,210, 50, 56,121, 41, 16,177,177, 49, 96,145, 36,234,214,115, 65,175,174,157, 57,173,218,116,168,241,203,170,249,151,
+ 83, 18, 62,244, 1,240,172,202, 9, 77, 51,130,122, 53,173,112,240,208, 75, 88,155,139, 49,124,208,119, 48, 18,240,177,113,199,
+239, 88,187,196, 7, 46,117,157,177,111,235,186,114, 47, 55, 53, 53, 93,227,230, 82,207,121,247, 31, 87,224,214,176, 33,107,183,
+255, 21,184, 53, 42,252,108,236,198,218,237,127, 5,141, 26, 55, 98,237,246,191,130,102,141, 27,212,122, 33,121,186, 38, 43, 43,
+203,167,252,244, 44,149, 71,189, 10,242,136,147, 79, 23, 87,218,113,211,166, 1, 64,177,208,170, 10, 56, 28,142, 83, 74, 74,138,
+ 77,101,231, 85,230, 53, 40,244,100,189,160, 40, 10,105,105,105, 68,118,118, 54, 99,102,102, 54,232,250,190,165, 23,188,220,155,
+103, 1, 64, 88, 88,152,133,159,223,250, 65,167, 94,228, 66,241,100, 39,113,236,207, 32,122,204, 0,143, 23,151, 54,140,111,133,
+194, 37, 33, 74, 67,165, 82,197,182,104,209,130, 41,252,238,200,231,243,185,165,202,155, 67,253,250,245,191,240, 90,235,209,165,
+184,237,241,227,199, 62,141, 26, 53, 66,195,134, 13,131,219,181,107,103, 34, 18,137,112,253,250,117,184,185,185, 53, 54, 49, 49,
+121,122,230,204, 25,206,226,197,139,155, 31, 62,124, 24, 0,102,234,145,156, 61, 60, 61, 61, 79, 6, 4, 4, 8,184, 92, 46, 20,
+ 10, 5, 34, 35, 35, 97,106,106, 10, 30,143,135,129, 3, 7,178, 58,117,234,100,217,181,107,215,115,239,222,189, 27,133, 42,204,
+128, 82, 42,149,204,210,165, 75, 33, 20, 10, 33, 20, 10, 33, 18,137, 32, 18,137, 32, 22,128,216, 59,187,166,209,172,253,217, 70,
+115, 87,238,221,224,191,123,213,221, 26, 53,232, 21,137,137,137,217, 85, 45, 11,138,251,247, 33, 14, 11, 3, 74, 60,187,250,194,
+ 84,100, 1, 95, 95,223,202, 60, 82,224,114,185,232,216,177, 99,165,124, 22, 22, 22,231,217,108,246,103,111,166, 20, 69, 9,124,
+125,125,117,239,222,189, 19,145, 36, 41,162,105, 26,190,190,190, 58,138,162, 4, 54, 54, 54,193, 52, 77,167,102,100,100, 12,169,
+136,183, 43, 32, 8, 6, 6, 19, 28,206, 92,123, 7,135,218, 30,117,235, 10,111,223,190,205, 2, 0,103,103,103, 70, 34,145,100,
+ 95,186,116, 41,143, 13,236,113,102,152, 63,170, 32,178, 84, 0, 22,146, 36,185,141,207,231,179,107,213,170, 21,191,124,249,242,
+199,133, 30, 82, 48, 12, 67,214,170, 85,171,173,145,145,145,179, 74,165,162, 80,208,117,104,240,102,253, 11,192, 48, 76,171, 2,
+221, 94, 12, 53, 0, 94,145, 3,191,160,181,131, 85,169,227, 0,144, 81,248,162,104, 91,206,126, 38,128,215, 0, 26, 0,176, 41,
+252,237, 57, 65, 16, 89,213, 48,179,124,143, 86, 64, 64, 64,241, 43,108,191,126,253,138, 27, 22, 99, 99, 99, 60,127,254, 28, 4,
+ 65,192,216,216, 24, 38, 38, 38, 48, 53, 53, 69,110,110, 46, 94,191,126,141, 55,111,222, 32, 46, 46, 14, 4, 65,160,110,221,186,
+ 40, 42,236, 37, 80, 92,193, 29,255, 53, 0, 2, 49, 31, 4, 1,180,236,214, 12,205,186, 52, 65,155,103,209,179, 95,220, 38,246,
+ 75, 36,146,247, 0,216, 77,154, 52,153,212,190,125,123,252,246,219,111, 80,169, 84,191,149, 35,178,138, 57, 31,188,166, 90, 3,
+128,189,189,253,130,163,215, 63, 10,199,246,174, 39,151, 72, 36,155,171,145, 56,159, 85,196, 25, 25, 25,122,175,197, 71,211, 52,
+164, 82,105,133,156,165, 61, 4, 91,182,237, 52,203,203, 73,197,207, 27,143, 66,171,213, 98,254,252,249,160,105,186,120,203,206,
+206,214,203, 78, 70,167,251,210,119, 64, 22,244,158, 18,108,160,230,200, 2, 93,145,112,114, 39,136,255, 99,239,186,195,162,184,
+214,247, 59,179,125,233,189, 41,160,162, 40, 8,130, 13,197,134,189, 68, 76,172, 49,118,163,137, 55,137, 37,150, 68,108,209,152,
+ 40, 36,214,152,104,212, 24,163, 49, 54,236, 98,139,221,196,174, 32, 82, 20, 20, 17,144,186,244,178,109,118,103,206,239, 15,138,
+128,108, 65,115,127, 55,247,102,223,231,217,103,119,118,102,223, 61,101,230,156,247,124,231, 59,223, 33, 0,197, 2,120, 53, 95,
+245, 59, 33, 9, 79, 40, 61,176,226,155, 77, 54,209,143, 94,224,248,197,104, 48,165,153,200,126,112,180,210,228,216,109, 28, 14,
+170,120,232, 18,208, 18,159, 46,249,214,118,233,167,147, 14,168, 21,101, 62,168, 59,141,120,193,240, 67,195,226,171,149, 43,177,
+125,211,122,124,187,126, 19, 74, 75,138, 33, 16, 56, 84, 53,244, 44, 88,150,213,159,119, 66, 6,135,205,153, 74,125,243,227, 17,
+ 4,181,117,197,225,179,119,208,163,189, 39,142,254,126, 15,189, 58, 54,199,241, 11,209,232,219,165, 37, 78, 95,141,195,167, 51,
+198, 81,227,206,237, 28,220,152, 58,218,184,241, 7,155,178,210, 92, 68,173,218,141,188,205,155,145, 54,115, 38,130,170,174,185,
+ 67, 81, 16, 54,109, 10, 8, 13,215, 81,125, 36, 38, 38, 66,165, 82, 53, 52, 50,135,175,175,175,193,122, 87, 40, 20,247,181, 90,
+ 45,201,205,205,165,114,115,115, 97,110,110, 78,197,199,199,177,126,126,254, 35,200,163, 67, 63, 1, 64,120,248,234, 17, 7,239,
+151, 66,126, 99, 19, 20, 55,191,135,176,121, 44,189,253,203, 25,204,135,203,183,221,175,245,140,214, 73,103, 78, 78,206,144,156,
+156, 28, 0, 64,139, 22, 45, 30, 37, 37, 37,181,169,158,106,174,154, 66, 20,106,181, 90,239,234,233, 68,173, 86, 11,149, 74,133,
+254,253,251,243,244,229,221,214,214,182,171,175,175, 47,162,163,163,177,105,211, 38,187, 62,125,250,224,201,147, 39,160, 40, 10,
+171, 87,175,166,218,182,109, 43,200,207,207,199,160, 65,131,112,228,200,145,110,165,165,165,134,202,211,210,220,220,124,231,201,
+147, 39, 37, 52, 77,163,172,172, 12, 28,199,161,123,247,238,160,105, 26,113,113,113, 88,178,100, 9,142, 28, 57,130, 99,199,142,
+ 73, 59,118,236,184, 83, 46,151,251,162,238,180,190,174, 58, 34, 74,165,146,136,197, 98,136,197, 98, 72, 36, 18, 72, 36, 18,136,
+ 68, 34,148, 43,129, 15, 55,164,169,120, 18, 7,206,175,125,143,150, 83,103,175,166,215, 46,123,255, 18,128,227,198,222,243, 64,
+165, 79,214,119,191,252,178,105, 66, 73, 9, 13, 0, 59, 40,138, 99, 8,249,214,152,231, 29, 0,202,149, 37,240,244,106,138,195,
+ 7,142, 97,212,216,225, 13,138, 44,129, 64, 8,161, 64, 0, 43, 59,115,131,156, 66,161,208,249,209,163, 71,246, 2,129, 0,132,
+ 16,176, 44, 11,134, 97,114,151, 46, 93,234, 56,116,232, 80,203, 51,103,206,208, 67,135, 14,229,108,109,109, 43,238,220,185,147,
+167,213,106,237,123,246,236,169,147,211, 12, 8, 80, 90,183,250, 78,196,211, 6, 68, 44,254, 68, 60,105,210, 36,222,212,169, 83,
+145,158,158,142,105,211,166, 41,207,159, 63,175,206,201,206, 62, 46,226,184, 31, 24, 32,214,216, 54,185, 30,182, 4, 4, 4,116,
+ 56,122,244,232,251, 97, 97, 97,247, 22, 44, 88,240, 85,237,147,107,214,172, 89,121,250,244,105,207, 17, 35, 70,252,250,224,193,
+131, 45,141,105,151,222,180,239, 48,113,190, 25,116,105,145,106,227, 40, 69, 81, 81,181,218,236,208,234,227,176,176,176,197,225,
+225,225,241, 20, 69, 69,213,254,190,250,186,170,193, 98, 84, 67,199, 85,191,181, 91,180,104,145,127, 68, 68,196,234,224,224,224,
+253, 55,110,220,120, 6,160,177, 66, 75,191,143, 86,117,134,106,103,178, 94,167,134,210,210, 82,148,150,150, 34, 35, 35, 3, 91,
+183,110,173,122,160, 5,224,243,249,224,243,249, 53,254, 12,186,112, 49,234,207,239, 1,124,223,161, 67, 7,193,195,155,145,103,
+ 62,223, 62,187, 95,167,254, 29,120,247, 47, 62, 28,141,202,253, 8,135, 76,158, 60,217, 1, 0,118,239,222,157, 15,224,204,127,
+ 72, 53, 71, 38, 39, 39,127,234,234,234, 90,227,163, 82,123,250, 80,171,213, 66, 34,145,160,218,151, 69,169, 84, 98,235,214,173,
+ 90, 66, 72,164, 30, 78, 36,197, 95, 66,114,252,229,202,223,113, 28, 56,246,229,239, 87,172, 88, 1, 66, 72, 77,103,255, 81,149,
+229,196,160,200,107,168,204, 73,189,247,122,223, 19,150, 53, 48, 61, 33,156, 61,122,210, 76, 87,142,226,227,196,165, 24, 8, 4,
+ 2,112,181,172,153, 2, 94,229,104, 57,254, 73, 22,220,156,253,240,246,184, 25, 46, 71,127,253, 97,182,150, 81,126,211,216,178,
+246, 9, 8,198,156, 79, 63,197, 79,219,183, 99,201,242,149, 53, 10, 64,203,178,208, 26, 76, 39, 77,247,239,238, 15,109,121, 22,
+120, 60, 30,250, 6,181, 4,143,199,195,128,224,214,224,241,120, 24,212,221, 7,124, 62, 31,131,123,180, 69,171, 86,173,192,231,
+243,105, 3,245,142,164,248,139, 72,142,191, 82, 75,244, 18, 16, 0, 76,118,246, 43,215,107,178,179, 65, 60,236, 27,123,111, 97,
+218,180,105,197, 25, 25, 25, 76,253,115,238,238,238,194,107,215,174,217,232,152,182,171,129, 84, 42,237,200,231,243,239, 23, 22,
+ 22,114,102,102,102, 52,199,177,156,159,159, 63,239,236,182,197, 71,171,175, 89,180,104,241,209,119, 59, 90,141,216, 19, 25, 69,
+132,205,122, 80,148, 64,172,253, 96,249, 54,161, 64, 40,237, 8, 40,140, 25, 60,208, 42,149, 10,143, 31, 63,134,161,244, 16, 66,
+244, 78,211, 20, 21, 21, 77,246,245,245,189,246,253,247,223,219, 81, 20,133, 63,254,248, 3, 60, 30,175,230,149,146,146, 2,154,
+166,241,249,231,159, 51,165,165,165,211, 13,165,141,207,231,127,122,248,240, 97,107,145, 72,132,178,178,178,154,231,134,199,227,
+225,209,163, 71, 88,187,118, 45, 38, 79,158,140,244,244,116,184,185,185, 97,254,252,249, 22, 17, 17, 17,159, 50, 12,179,210,136,
+ 42,138, 85,171,213,157,204,204,204, 32,145, 72, 80, 45,184, 0,224,247,120, 65,156, 66,161,104,103,111, 47,119,113,188, 26,117,
+162, 91,159,183, 3,237, 29, 93,131,179,179,179, 27,181,117,214, 83, 96,123, 42,203, 46, 29,114,244,168,211,245,163, 71,185, 91,
+ 39, 79,190, 16,151,149,109, 51,250, 30,210,208, 72, 75,121,129,142, 29, 59,226,254,253,251,232,216,177, 99,109,209, 4,145, 72,
+ 4,161, 80, 8,161, 80, 8, 7, 91,163, 92, 40, 8, 77,211,184,126,253, 58, 88,150,133, 90,173,134, 90,173, 70,219,182,109, 11,
+ 47, 95,190,108, 1, 0, 41, 41, 41,100,226,196,137,197,183,111,223, 70,251,246,250,247, 83, 87, 82,212,197, 21,171,215, 89,127,
+179,113, 39,172,237,156,113,245,234, 85,246,236,217,179,101, 20,144,148, 28, 31,191,254,109,224,116, 36,192, 52,166,204,156,157,
+157,175,241,120,188,102,181,191, 43, 40, 40,176, 29, 57,114, 36,138,138,138,222, 26, 57,114,100,143,170, 54, 33,243,208,161, 67,
+ 19, 1, 64, 36, 18,129,166,105, 22, 38,252, 87,193,144, 22,169, 45,148,234, 11,174,240,240,240,208,250,223,213, 22, 85, 13,125,
+174,253,219,136,136,136,213,181,184, 21,175,145,124,195, 62, 90, 81, 81, 81,164, 1, 5,105, 52, 12, 9,173,106, 68, 71, 71,107,
+220,220,220,126, 74,142,121,222,175,101,128, 23,164,230,226,129, 0,190, 23,139,197,243, 38, 77,154,132, 91,183,110, 33, 46, 46,
+238,103,188,225, 42, 28,127,127,255,115, 98,177,216, 83,199, 52, 73, 90, 92, 92,220, 32, 29, 29,195,242,147, 39, 79, 66,159, 51,
+252,165, 75,151,106,119, 74,181,157,225, 27,190, 49, 56, 2, 13,163, 65,133, 92,241,178, 19,175, 18, 90, 21, 21, 21, 24, 59,118,
+108, 29,139, 86, 94, 94,158,193,252, 81, 20,133,181,199,143,227,124,100, 36,222, 10, 12,196,145, 59,119, 16, 49,105, 60,124, 60,
+155,128,176, 20, 8, 5,164,239,251, 1, 5,165,229,216,123,241, 58, 10,203,228,152,208,179, 39,188,173, 28,244,243, 10,132, 3,
+130,186, 6, 11, 47,220, 72,128, 64,192, 7, 13, 14, 68, 35,135,155,111,111,240,104, 26,214,206,205, 33, 20, 8, 32, 16,240,145,
+146,145, 15, 95,255,206,162, 40,145,100,192,235, 8, 45,119,207,230, 96, 89, 22,147, 39, 79,198,254,253,251, 97,239,226, 9,107,
+119,127,124,189,126, 59,222,234,223,211, 96,254,171, 71,240,124, 62, 31, 60, 30,239,149,247,234,207,198, 88, 39, 9, 71,192,212,
+175, 35,142, 0,132,160,233,170, 85,104,186,106, 21,238, 84,253,103,219,138, 10, 40, 20, 10,160,139, 95,163, 68,150, 90,173, 70,
+ 70, 70, 6,147,147,147,227,220,192,249, 92,181, 90,109, 80,216,236,218,181, 43,118,202,148, 41,157,236,236,236,238,197, 62,120,
+160, 9, 8, 12, 20,156,217,186,248, 88,245,180, 33, 0, 4, 6, 6, 22, 46, 94,188,248,216,196, 49,161,195,183,132,189,199,126,
+188,242, 87,190, 88, 42,237, 20,186, 96, 87,236,190, 49, 99, 12,207,205,168, 84,169, 1, 1, 1,196,152,124,201,229,242, 28, 61,
+167,135, 1,248,178, 67,135, 14, 86,125,250,244,193,181,107,215, 48,106,212, 40, 21,195, 48,201, 0, 48,116,232,208,214,123,247,
+238, 21, 37, 36, 36,192,209,209, 81,144,150,150,182, 19, 6, 28,228, 69, 34, 81,239,206,157, 59,211, 42,149,234, 21,145, 21, 17,
+ 17,129,113,227,198,161,117,235,214,224, 56, 14,229,229,229,232,211,167,143, 96,211,166, 77,189,141, 20, 90,115,124,124,124,214,
+162,114,213, 97,237,182, 48,177,106, 10, 10, 5, 5, 5, 57, 49,183, 47,198,247,236, 63,178, 83,179, 86,254,174,113,177,247,245,
+ 18, 58, 57, 57, 45,162,105,250, 93,142,227,120,165,165,165, 25, 49,106,117,171,182,158,158,206,221,135, 15, 71,137, 64,192,251,
+238,226, 69, 58,183,172,204, 2,128, 81, 83,144, 74, 77, 5, 60,189, 42, 93,253, 70,141, 29,142,251,247,239, 99,244,123, 35, 32,
+ 20, 10,193,231, 11, 42,159, 77, 97,165, 69,203,198,193,202,168,123, 83,163,209,212,180,225,213,126, 94, 12,195,160,218, 53,203,
+204,204,172,230,156, 74,165, 2, 69, 81,250,238, 13,186, 79,175,238,184, 17,157,164,157,254,249,119, 42, 65,193,253, 8, 23,142,
+219,245, 2,200,125,131,230,220,251,224,202,101, 78, 82, 43,107,176, 26, 13,252,134,143,174,121, 78,110,239,216, 34, 5,199, 73,
+139,211, 82, 49, 43,242,228, 95,189,103,174, 9,255, 1, 24,210, 34,181,133,210,155,130,162,168,168,176,176,176,197, 0, 72, 88,
+ 88,216,226,234,227,240,240,112, 5,128,204,215, 20, 91,175, 88,185,248,127,133,200,170,158, 94,208,135, 62,125,250,204,178,180,
+180,220, 84,125,156,113, 43, 19, 25,183, 50,225,219,198,175,123,135,192, 78, 37,227,198,141,131,189,189, 61, 22, 44, 88, 64, 0,
+252,220,216,255, 79, 73,138,183, 0, 64, 92, 93, 93, 23, 84, 53,200,129,119,238,220,113,188,123,247, 46, 58,119,238,252,210,116,
+207, 48,232,209,163,135, 62,170,178, 42,167,246,185,127,157,149,140, 3,195, 48,144,203, 21, 80,171, 25,104, 53, 28,180, 90, 45,
+ 58,250, 89,226,215,237, 97,149,223,105,171,173,103,149, 86,179,166, 46,150,176,180, 16,104,104,154, 82,220,139,205,105,176,197,
+ 84,171,213,136, 77, 75,195,131,231,207, 1, 0,111,135,235,119,124,253,245,226, 53,180,109,219,214, 80,106, 91, 54,117,115, 65,
+214,249,216,202,198, 91,145,129,187,127, 30,132,165,165, 5, 0,192, 47,100, 2,132,194, 74,161, 85,161, 96,224,208,198, 29, 20,
+ 33, 58,195, 2,152,217,186,156,227, 11, 37,158,132,229, 64, 8, 7,194,177, 32,132, 3, 79, 32, 52,155,245,209,251,224, 56, 22,
+ 65, 65, 65,160,120, 60,176, 26, 21,198, 12, 27,128,162,146, 50,216,219, 24,215, 73, 8,133, 66,132,132,132, 72,117,157,127,242,
+228,137,162,182, 48,211, 95, 71, 26, 84, 84, 40,160, 82,169,192,168,181, 96, 52, 90,176, 45,132,248,106,233,120,104, 25, 45,228,
+239, 5,131,209,104,193,125, 58, 2,140, 90,131,116, 51,154, 14,240,117,208,208,160, 20, 49,137, 50, 43, 67, 66,171, 90, 28,232,
+ 66, 67, 62,129, 58,196,214,131, 41, 83,166,116, 12, 8, 12,188,255,110,255,192,117, 15,227,226,179, 30,198,197,191,114,157,103,
+235,192,212,143, 35,246,207, 23, 8,165, 29, 67, 23,232, 95,117, 88, 27,181,167, 17,223, 16,139,203,202,202, 2, 44, 44, 44,144,
+148,148, 4, 30,143, 7,138,162,158, 0, 8, 0, 0, 87, 87,215,167,124, 62,223,139,199,227, 97,243,230,205, 20,159,207,111, 23,
+ 28, 28,188, 88,169, 84, 30,212, 51,160,243,181,180,180,172, 99,205, 18, 10,133, 8, 11, 11,195,196,137, 19,107, 68,150, 80, 40,
+196,174, 93,187,208,169, 83, 39,168,213,106, 95, 35,211,123, 23, 64, 79, 35, 44,126, 84,149, 56, 55, 40, 70,181, 90,237,148,130,
+119,223,109,133,171, 87,209,221,203,171,109,199,142, 29,193, 48, 47, 13, 58, 94, 94, 94,238,101,101,101, 57, 10,133,226, 55, 84,
+134, 33,136,209, 43,138,148, 28,210, 82, 42,221, 79,239,223,191,143,160,160,160, 26, 11, 86,109,107,150, 80, 40,132, 84,100,209,
+ 40,161,197,113,149,237, 82, 89, 89, 25,125,245,234, 85, 7, 31, 31, 31, 10, 0,124,124,124,168,152,152, 24, 59, 51, 51,179,252,
+150, 45, 91, 26, 26, 0, 11, 1,160,247,192,145,252,243,103, 79,155,107,129,149, 57, 60,222, 74,190,193, 54,146,104, 88,142,211,
+233,116, 47,181,178,198,174, 41, 99, 1, 0, 95,244, 31, 92, 51,216, 58,251,229, 98, 8, 4, 2,244, 91,176,248,149,103,137,227,
+ 56, 30, 76,248,159, 18, 89, 13, 89,180,222,172,111,126,105,209, 10, 15, 15,143, 15, 15, 15,127,197, 58,214, 72, 24,182,104,213,
+ 54,221, 53, 22,213, 15,171, 46,172, 95,191, 30,237,218,181,211,219, 17,109,218,180, 9,123,246,236, 89, 15, 32,165,209, 38,199,
+126, 29,252,176,225,104,188, 87,107, 63, 10, 0, 86,126, 58,140,174,168,168,192,245,235,215, 97,109,109,141, 39, 79,140, 14,251,
+101,105,109,109,253, 37, 77,211, 99,120,245, 87, 0, 52, 44, 48, 89,142,227, 34, 75, 74, 74,116,134,119, 32, 4, 96, 52, 90, 84,
+200,149, 80,171,213,248,244,243, 31, 12, 38, 34, 28,160, 24,117, 25, 63,164, 87,176, 84,151, 69, 39,168, 93,111,124, 50,201,226,
+149,206,155, 71, 3, 52, 13,180, 15,170,180,184,196,220,137, 7,199, 1, 44, 7, 56, 56,217,226,231,125,235,244,138,124, 45,203,
+ 85,141,142, 89,148,171, 88,248,118, 13,197,139,196,171, 53, 22, 36,145,176,114,202, 88, 40, 16,128, 35, 84,101,212, 7, 93,173,
+174, 72,234, 89,148,157,226,189, 61,234, 33, 62, 12,109,135, 67, 23, 98, 49,186,127, 0, 46,223, 78, 64,159, 46,109, 17,159,252,
+ 28,126,222,205,176,121,103, 36, 8, 65,217,143, 27,190,206,121,217,161,105,211,140,177,104,221,186,117, 75, 81,223,138, 85,251,
+157, 24,238, 15, 65,200, 75,139,150, 66,169,194,130, 69, 70,133,222,169,172,163,158, 93,165,198, 92,172,207, 98,101,140, 16,171,
+111,217,130,129,240, 44, 45, 0,116, 2, 22,254, 39, 27, 78,150,101,113,234,212,169,154,250,104,168, 30,107,215,157, 17, 34, 7,
+105,105,105,136,143,143, 71,215,174, 93, 81, 82, 82, 2, 1, 77, 99,254,195,135,104, 59,105, 18,212, 66, 33, 56,142,131, 72, 36,
+194,140, 25, 51,140, 46,207, 70,182,206, 85,142,215,172, 33,242,117,193,193,193,173,146, 42, 42, 16,255,232, 17,250,175, 88, 1,
+ 0, 56,125,250,116,157,123, 98,222,188,121,162,132,132,132,105,247,238,221,155,150,149,149,181, 30,192,124,157,237, 44, 81,213,
+248,104,189, 59,126, 20, 90,249,180,192,158, 95,246,213,156,159,247,217, 28, 8, 4, 66, 8,132, 2,216, 88,219, 24,149, 27,141,
+ 70, 83, 35, 90,229,114, 57,125,250,244,233,166, 3, 6, 12, 16,206,153, 51,135, 2,128, 61,123,246,208,223,127,255,189,249,249,
+243,231,133, 77,154, 52,201, 54, 96, 33, 40,205, 44, 80,137, 1,192,195,195, 3, 63,108, 59, 65, 15, 29, 58, 20,115,230,204,129,
+ 70,163,193,150, 45,149,207,213,184,113,227,192, 48, 12, 14, 31, 62, 92,253, 28,235,181, 70,105, 25,230,149,251,134,162, 40, 8,
+ 4, 2, 8, 69, 66,128,227, 64, 81,148,249,154, 53,107, 86,198,199,199,119,246,241,241,129, 74,165,154,132,202,197, 31,166, 56,
+ 90,255,101, 98, 75,159, 22,105,200,215,170,202, 42,165, 11,178,218,126, 91,186,132, 90,109,159, 45,188,222, 2, 10,227,124,180,
+ 26, 2,143,199, 51,104,173,170, 94,170,171, 15,243,230,205,131,165,165,165,174, 14,136, 60,124,248, 48, 33, 59, 59,123, 59,128,
+ 31, 94,171,114, 46, 70,199,127, 57,119, 68, 25,170,230, 86,109,108,108,242,251,246,237, 91, 14,128, 57,120,176,238, 0, 89,165,
+ 82,233,236,192,173,173,173,191,220,177, 99,199,236,225,195,135,211,245, 67, 12,212,158,222,171,126,105, 52, 26, 28, 60,120,112,
+246,194,133, 11, 81, 82, 82, 50, 87, 95, 39, 46,175, 80, 64, 81,229, 8,253, 52,238,144,177,141,186,206, 83, 22, 54,174,104,218,
+ 34, 64,103,103, 66, 11, 43,125,136,156, 61, 94,118, 96,150,150, 18,176,122, 56, 41,138, 78,121,158,158,213,196,221,197, 14, 79,
+ 51,100,112,110,214, 14, 69,153, 47,203,129,207,231, 65, 80, 53,117,104, 99,101, 14, 89, 94, 30,104,154,167, 87, 24,127,189, 55,
+ 26,183,227,158,227,240,133, 24, 48,202, 10,108,216,125, 22,140,170, 28,140,178, 2,140,178,242,125,245,194, 15, 64, 81,200,209,
+168, 42, 90, 55,166,222,249,124, 62,186,116,233,162, 83,232,100,102,102, 26,105,209, 34, 53, 22, 45,133,178,145,117,100,220,200,
+ 73,175,197,170,250,252,235, 10,131,234,144, 15, 82,169,180,211,174, 93,186,195, 56, 52, 4, 23, 23,151, 51, 22, 22, 22,205,141,
+189,190, 17,193, 75, 87,219,216,216,124,233,227,227,227,187, 97,195, 6, 1,143,199, 67,191,126,253, 90,187,184,184,164, 1,128,
+159,159,159, 91,117, 27,243,241,199, 31,147, 91,183,110,197, 85,142, 49,116, 67, 36, 18, 61,178,182,182,238,212,167, 79, 31,148,
+148,148, 32, 35, 35, 3,230,230,230,104,187,110, 29, 30,126,252, 49, 2,183,110, 5,221,183, 47, 40,138,130, 72, 36,194,195,135,
+ 15, 33,149, 74, 31, 41,149, 58, 67,190,117, 1,240, 45,128,238,120, 57, 93, 72, 0, 92, 71,101,216,133,219, 13,180,119, 52, 0,
+176, 28,103,168,178,198, 47, 88,176, 0,197, 2, 1, 48,116, 40,132, 41, 41, 96, 24, 6, 93,187,118,173,177,178,119,237,218, 21,
+124, 62, 31, 1, 1, 1,112,115,115,195,230,205,155,199,235, 19, 90,202,114, 6,105, 41, 47, 16, 28, 28, 92, 99,185, 26, 58,116,
+104,141, 69, 75, 32, 16,212, 88,182, 40,214,176,112,165, 40,138,212, 30, 36,179, 44, 75,241,249,124,254,220,185,115,169, 81,163,
+ 70, 17,181, 90,205,137, 68, 34,250,240,225,195,212,229,203,151,249, 21, 21, 21,134,172, 13, 21,239,189,247,158,147,187,123, 83,
+100, 60,141,199,161, 67, 4,235,215,175,199,181,107,149, 81, 54,146,146, 42, 23,174, 86, 31,247,233,211, 7,205,155, 55, 7, 49,
+112,227,251,143, 24,131, 47, 6, 12,169,108, 79,154, 59, 66, 32, 20, 64, 36, 20, 98,193,163, 23, 53,117,109,181,107,191, 40, 34,
+ 34, 98,180,143,143, 79,229,212, 62,192, 55,197,209,250,239,130, 1, 67,143,172,158, 72, 82,215, 58,150, 1,160,170,142,101,181,
+ 4,149,140,162,168,187,132,144,206,245,174,173, 62,175,174,247, 94,125,254,193,107, 36,191,122,175,195, 87,196,151,190, 17,113,
+242,205,155, 55,189, 59,118,236,136,244,244,244, 87, 86,194, 85,119, 92,230,230,230,144, 74,165,184,113,227, 6, 0, 36,235, 34,
+187,124,249,242,247,168,140,186,140,170,105,131,224, 62,239,246,190, 17, 52,184, 51,246,134,239, 43,201,206,206, 14,192,203, 24,
+ 58,148,155,155,219, 68,129,136, 63,214,203,223, 35, 4, 28,247,237,197,147,215, 87,232,203,161, 87,107,191,114, 0,138,234, 85,
+135,175,185,250, 16, 52, 77,143, 25, 62,124, 56,157,144,144,128,177, 99,199, 98,207,158, 61, 58,175,157, 56,113, 34,246,239,223,
+143,225,195,135,211,139, 22, 45,210, 25,222,161,174,181, 68,253,151,221,148, 73, 79, 30,224,215,253, 59,116,250, 32, 57, 57, 85,
+250, 99,229,229,229,215,124,215,185,163,254,153, 17, 78,171, 62, 31,125,239, 78,112,183, 94,253,132, 25,185,197,224,180, 42, 40,
+203, 94,254, 94, 94,156, 11,162, 85, 66,104,102, 7, 23, 7,107,220,191,249,187,154, 81, 43,207,235,227,156, 61,220, 15, 31, 15,
+243, 5, 8,135, 17,243,127, 70,212, 15,179,106, 70,208, 61, 70,205,193,197,131,223, 25,237,227, 87, 31, 2,129, 0, 15, 31, 62,
+ 84,232,178,102,241,120, 60, 99, 98,114, 85, 89, 29, 53,144,203, 21,144, 43,148,127,101,219,225,232,236,236,252,163,173,173,173,
+ 68,135,144,114,116,116,116,252,209,222,222, 94, 98,236,212,161, 46,145, 85, 21, 87,235,222,148, 41, 83, 26, 37,182,196, 98,113,
+243,228,228,228,154, 96,165,250,222,213,106, 53,250,244,233, 99,108,240,210,147, 0,158,185,186,186, 94,111,219,182,173,245,211,
+167, 79,177,111,223, 62,161, 64, 32,240,168,110, 63,202,202,202,192,227,241,144,151,151,167, 1,240, 62, 12, 76,157,169, 84,170,
+171, 87,175, 94,109, 63,108,216, 48,222,163, 71,143,192,227,241, 42,211, 21, 28,140,192,173, 91, 17, 55,119, 46, 66,158, 63,135,
+146, 97, 32,145, 72,112,238,220, 57, 70, 46,151, 95,213,197, 39,149, 74,183,167,166,166,250, 73, 36, 18, 48, 12, 3,142,227, 64,
+211, 52,197,231,243,123,216,216,216,108, 2,208,185, 94,101, 57, 5,118,238,211,134,213,106,217,236,244,167, 50, 67, 5, 80, 80,
+ 80,128,147, 39, 79,162,107,215,174, 8, 9, 9, 65,102,102, 38, 82, 82, 82,240,214, 91,111,213, 92,243,224,193, 3, 68, 71, 71,
+163,101,203,150,134, 45,122,180, 6, 45,219, 52,135, 80, 40,172,180,230, 8,132, 85, 3, 31, 65,141, 37, 75, 40, 16, 66,192, 23,
+ 64, 34,149, 24,109,209,162, 40, 10, 52, 77,131,162, 40, 72,165,210,234, 65, 54,215,180,105,211,236,194,194, 66, 87, 0, 60,169,
+ 84, 10,150,101,245, 14, 90, 56, 66,188,133,249, 55,178,230, 47, 92,235, 20, 30,126, 1, 23, 46,228,129,166,105,184,186,186,130,
+166,105,164,166,166,130,166,105,120,122,122,130,166,105,100,102,102, 86,139,196, 34,232, 22,195, 53,207, 13, 69, 81, 53, 34, 75,
+ 40, 18,214, 88,182, 0,160,184,184, 88, 57,124,248,240,223, 84, 42,213, 84,188,222,174, 39, 38,252,141, 65, 81,212,221,255,196,
+111, 27,129,161, 85,194,234, 21,167,120,125, 55,227, 91,221,186,117,219, 58,110,220,184,126, 27, 55,110,132,133,133, 5,178,179,
+179,107, 58, 68,145, 72, 4,119,119,119, 20, 22, 22, 98,219,182,109,120,241,226,197, 37, 0, 51,140, 77, 81,118,118,246,173, 39,
+ 49,201, 5,125, 70,119,179,247,235,214,198, 38, 35,249, 69,215,236,236,236, 27, 85, 34,235,231,113,243,222,154,218,103,100, 16,
+132, 34, 1, 50,158,228,224,226,201,235,255, 47,149,201,227,241,120, 20, 69, 97,236,216,177, 70, 93,255,222,123,239,225,234,213,
+171,208, 55,205,200, 85, 91,180,228, 74, 84, 40,254,186,129,213, 39,179, 38,226,147, 89, 19,107,196,132, 49, 83, 47, 0,224,230,
+118, 64,143, 95,191, 93,233, 0, 0, 32, 0, 73, 68, 65, 84,208, 98, 54, 70, 29,216,246, 97,135,160, 96,207, 78,126,205,113,251,
+ 94, 12,246,110,125,105,100,216,249,253, 74,124,179,243, 18,220,157,109,193,168, 42,112,230,208, 79, 57,140, 74,190,241, 53,141,
+114,149,226,150,162, 64, 8,215,168,188, 87,139, 39,129, 64, 0,127,127,127,157, 22,173,194,194, 66,133, 33,107, 86, 77, 29,169,
+ 53, 40,175, 80, 64, 33,255,203,132, 86, 96,143, 30, 61,206, 71, 70, 70,218, 59, 57, 57, 33, 43, 43,171,190,208, 10,236,222,189,
+251,249,200,200, 72,123,103,103,103,100,100,100, 24, 29, 86,164, 1,145, 5,153, 76, 70, 21, 21, 21,113,182,182,182,141, 18, 91,
+ 52, 77, 67,165, 82, 33, 49, 49,209,216,191, 53,122, 53,151,181,181,245,174,253,251,247, 91,231,231,231,131,199,227, 33, 49, 49,
+177,206,170,195,234,215,207, 63,255, 44, 28, 49, 98,196,142,226,226, 98,189,203,218,180, 90,237,250,137, 19, 39, 78,203,204,204,
+180,117,114,114, 66,118,118, 54, 68, 34, 17, 8, 33,160,250,244, 65,207,103,207,192,176, 44,164, 82, 41,146,146,146,176,125,251,
+246,138,170, 80, 49, 13, 26,200, 40,138,242, 22, 10,133,152, 48, 97, 66,157, 19,187,119,239,198,219,157,120,157, 28,173,249,229,
+ 90, 72, 84,185,210, 33,103,120, 60, 30, 21,216,165,111,235, 46,189,134,250, 63,142,187,253, 84,150,251,194, 80,163,164, 81,171,
+213,240,241,241,193,221,187,119,113,225,194, 5,244,237,219, 23, 33, 33, 33,136,141,141,197,239,191,255,142,232,232,104, 80, 20,
+ 5,123,123,251,106,247, 11,189, 62, 24,106,185, 22,121, 89, 5,175, 88,175,234, 31, 11,133, 66,168, 20,198, 45,238,123,244,232,
+ 17,238,222,189, 91, 19, 90,134,199,227,105, 39, 77,154, 4, 66, 8, 73, 77, 77,133,165,165, 37,153, 50,101, 10,203,231,243,181,
+153,153,198,249, 7, 91, 88, 88,192,219,219,187,206,192,167,250,213,179,103, 79,220,187,119, 15, 52, 77,131,207,231,195,201,201,
+ 9,215,175, 95, 55,120,227, 87,139,170,106,145,197, 23, 10,234,136, 62,142,227,202, 98, 99, 99, 63, 4, 16, 91,101,201, 2, 76,
+113,180, 76,248,255,195, 41,188,186,177,180, 65,139,214, 51, 0,253,247,237,219, 55,254,216,177, 99,235, 55,109,218,228, 24, 26,
+ 26,138,162,162, 34,120,122,122,194,213,213, 21, 81, 81, 81, 56,125,250,116, 62,203,178,243, 1, 52,100,250,233, 15, 61, 49,107,
+ 50,159,102, 71,170,202,203, 63,238, 24,226,139, 75, 7,255, 8,119,113,113,153,193,227,241, 62,157,178,248,157,169,189,135,119,
+ 70, 82,116, 42,110,253,254, 16,185,233,249, 6, 57,235, 59,195,219,216,216, 76, 51, 51, 51, 19,161,129,165,196, 13,172, 58,172,
+225,100, 89,150, 85,171,213, 56,112,224,128, 81, 98,107,223,190,125, 80, 42,149, 96, 95,157, 95,173,225, 36, 28,161,248, 2, 49,
+220,220,125,192, 48, 21,224,184,215, 94, 80, 89,195, 89, 61, 2,125, 42, 18,193, 41, 63, 31,183,111,223, 54, 78,114, 15, 29,106,
+168,142,148,106,101,217,132,239, 86, 45,136,154, 25,246,173, 77,223,110,237,241,197,186,221, 96,152,157,160,121, 52,164, 98, 33,
+ 58, 6,117, 7, 15, 42,252, 24,241, 89,177,188,180,104, 2, 94,221,138,167, 14, 39,209, 55,195, 66, 0,150,227,112,225,218, 29,
+163,243, 94,107,154, 3,124, 62, 31, 79,158, 60, 81, 52,180,218,144,199,171,156,230,172, 30,169,235,227, 36, 28, 71, 9,132, 18,
+184,123,182,133, 90, 85,254,151,212,145,147,147,211,103, 71,143, 30,181,175, 14,149, 16, 27, 27, 11,138,162, 18, 95, 90, 28, 43,
+207, 43, 20, 10,196,197,197, 33, 54, 54, 22,168, 92,225,102,244,115, 84,109,201,146,201,100, 84,118,118, 54,204,204,204,232,216,
+216, 88, 85, 64, 64,192, 61, 3,207,119, 13,167, 82,169,124,174,203,127, 82,169, 84, 54,145, 72, 36,130,122, 29,158, 91,171, 86,
+173,146, 26,152, 66,124, 37,157, 37, 37, 37,183, 23, 46, 92,216,113,240,224,193,248,236,179,207, 10,109,109,109, 45,127,252,241,
+ 71, 62,143,199,163,102,206,156,201,230,229,229,149,255,244,211, 79,214,199,142, 29, 67,113,113,241, 13, 35,242, 94,166, 84, 42,
+ 63,236,214,173,219,238,179,103,207,154,121,123,123,163,180,180, 20,132, 16,236,218,181, 11, 51,103,206,132, 68, 34, 65, 82, 82,
+ 18,222,126,251,109,185, 92, 46,255, 16,175,250, 78, 86,115, 82, 20, 69, 17,142,227,176,108,217,178,154,224,164,213,193, 74, 45,
+165, 20,182,207,107, 97, 62,231,167, 18,243,241, 95,252, 52, 9, 0, 88,173,150,125, 28,119,251,233,174, 31,190,184, 44, 20, 10,
+175, 25,168,163, 37,115,230,204,249,113,232,208,161, 82, 11, 11, 11, 20, 22, 22,226,250,245,235,184,121,243, 38,110,221,186, 5,
+181, 90, 13,123,123,123,216,218,218, 34, 59, 59, 27,143, 30, 61, 82, 0, 88,162,143, 83,100, 38,128, 87,235,234,149,191,149, 22,
+ 44, 65,173,213,134,181,173, 91, 66,129,192,168,231,168, 87,175, 94,232,210,165, 75,181, 88, 97,211,210,210,178, 85, 42, 21, 85,
+ 75,244,103, 86, 11,114, 15, 15, 15,237,158, 61,123,136, 33, 78,142,227, 94, 17,211, 61,123,246,172, 25, 20,118,233,210, 5, 60,
+ 30, 15, 49, 49, 49,186, 92, 83,234,112,222,218,190, 25,103,191, 90, 2,145, 80,136,249,137, 25, 53,162,107,119,223, 14, 16,136,
+132,240, 29, 54,170,246,111,183,160,114,186, 16,245, 68,150,190,254,232,141,159,119, 19,231, 63, 30,217,120,141, 45,120,170,177,
+ 87,169, 84,158,249,224,131, 15, 34, 2, 3, 3, 63,216,176, 97, 3, 37, 20, 10,177, 98,197, 10,146,149,149,245, 75,213,136,161,
+232,117, 82, 69, 8,249,229,202,145, 27, 31, 77, 14, 27, 78,205,219, 56,165,199,189,139,113,143,218,117,243, 70,187,110,222,184,
+119, 41, 1, 63, 44,222,183,135,213,176,203,114,114,114,210, 13, 80,169,250,119,111, 83,223, 25,222,254,234,229,139,246,141, 93,
+117,200,113, 92,228,190,125,251,102,143, 28, 57,146,190,115,231,206, 43, 62, 89,213,219,238,112, 28,135,243,231,207,131, 97, 24,
+252,242,203, 47, 28,199,113,186,227,104,129, 28,255,110, 99,196,228, 95,126, 61, 46, 18, 9, 41,220,188,118, 24, 37, 69,250, 87,
+117, 9,133, 2,252,188,235, 8, 35, 20, 10, 30, 55,116,158, 97,152,140,139, 23, 47, 58, 15, 98, 89, 1, 77,211, 13, 9,168, 6,
+ 17, 25, 25,169,225, 56, 46,205,192,101, 55,114, 95,164, 15,251,250,179,247,247, 13,125,247, 3,231,110,221,122, 8, 28,156,156,
+ 65, 81, 20,242,114,243,144, 20,119, 71,115,230,240,142,220, 10,185,113, 91,240,188,191,246, 74,141, 79, 22, 0,132,206,220, 84,
+227,159, 5, 0,195,166, 44, 68,159,174,126,160,140, 49, 61,189, 20, 89,156, 86,171,133,185,185, 57,180, 90,109,131, 33, 30,172,
+173,173,165, 74,165, 82, 81, 21,136, 81,239,136,153, 0,127,121, 29,177, 44,235, 91, 84, 84,132,138,138, 10,220,188,121,147,172,
+ 90,181, 74, 38,147,201,106,156, 54, 53, 26,141,111, 97, 97, 33,202,203,203,113,227,198, 13, 18, 17, 17, 33, 43, 40, 40, 88,220,
+152,103, 72, 42,149,118,226,243,249,247,138,138,138, 56, 51, 51, 51, 90,163,209,104, 2, 2, 2,196, 82,169,212,232, 13,213,179,
+179,179, 7,235, 58,231,229,229,149,156,156,156,220,138,101,217,218,123, 32, 10,149, 74,165,119,183,110,221,140,105, 63,230,236,
+220,185, 19, 71,142, 28, 9, 42, 45, 45,157,152,150,150,182, 27, 64, 16,159,207, 71, 76, 76, 76,162, 82,169, 28, 55,114,228,200,
+ 93, 69, 69, 69,183, 81,185, 5,143, 49, 56,155,148,148, 52,193,215,215,119,231,151, 95,126,105, 17, 18, 18,194,119,115,115, 67,
+231,206,157,145,148,148,132, 83,167, 78,105,182,108,217, 82, 33,151,203,223, 7,112, 94,127,181,131,210,106,181, 16,137, 68, 53,
+ 47,177, 88, 12,161, 80,136, 50, 5,193,244,117, 41, 10, 45,164,138,245, 43, 62, 60, 69, 0, 42, 39, 35, 37, 63, 47, 39,227, 54,
+ 69, 81,215,178,179,179, 75,116,148,153, 72,169, 84,182, 39,132,240, 40,138,218,200, 48,204,148, 89,179,102,185,174, 94,189, 26,
+109,218,180, 65,126,126, 62,204,205,205,225,237,237, 13,153, 76,134, 59,119,238,176,114,185,124, 43,128,149,168,242, 31,209,133,
+226,252, 82, 52,117,241,168, 99,249, 36,132,128,176,128, 70,197,130,101, 8,212,148, 6, 2,129, 6, 66,161,208,152, 41, 21,194,
+113, 28,138, 92, 93,193,197,197,225,214,173, 91, 32,132,232,180,170,249,248,248, 24,101, 33,101, 89,246, 21,161,117,251,246,109,
+240,120, 60,244,232,209, 3,209,209,209, 53, 22, 45,163,252, 18, 9, 7,145, 88, 84,103,186,144,162, 40, 8, 69, 34, 8, 68,194,
+134, 86,227,152,172, 88, 38,252,109, 96,236, 60,118, 49,128, 25, 15, 30, 60,216,221,187,119,239, 40, 66,136, 0,149,243,145,127,
+188,201,159,231,228,228,220,191,113,234,254, 34,231,166,182, 17, 67, 38,246, 64,155,246,158, 96,181, 44,174,159,142,193, 47,171,
+143,237,207,204,200,156, 2, 35,246, 62,227, 56,238,114,247, 78,109,104,212,138,213,237,230,230,198,189,206,170,195,146,146,146,
+229,243,231,207,199,103,159,125,246, 58,171, 14, 27,196,195, 71,178, 25, 20, 72,211, 97, 67,122, 14, 2, 69, 19,181, 90,165,167,
+225, 67, 77,228, 82,161, 80,240,248,110,108,118, 64, 67,215,201,100,178, 65, 83,167, 78, 61,207,231,243,155, 55,166,204, 57,142,
+ 75,203,205,205,237,103,248, 74,237,117,149,162,212,251,228,254,109,115,207, 30,217, 57,136,227,216,150, 20, 0, 30, 95,248, 84,
+195, 48,231, 84,138,210, 13, 48,114, 83,233, 53, 51,130, 49,231,187,223,177,249,179, 97,152, 21,113, 16, 59,150, 77,199,162,117,
+251,240,237,103,115,176,106,211,111,248, 98,206, 4,140, 30, 63,149, 35, 20,253,167,177,249,224,241,120,103,183,109,219, 54,121,
+250,244,233, 53,139, 22, 8, 33,117, 26, 97,141, 70,163,224, 56, 14, 91,183,110,229, 0,156,213,199, 87,183,142, 40,162,207, 95,
+202,216, 58, 42, 45, 45,125, 63, 56, 56,120, 23, 0, 49, 33,228, 73, 81, 81,209,191,128,151, 91, 67,149,151,151,191,223,173, 91,
+183, 93,132, 16, 49, 69, 81,175,156, 55, 6, 85,161, 30, 58,217,218,218,222,171,178,100,137, 95,199, 33, 94, 95, 81,235,153, 86,
+ 52,102, 10,145, 3, 48,171, 86,196,247,213, 65, 65, 65,181, 55,149, 78, 44, 42, 42,234,244, 26,233, 58,175, 80, 40,252,150, 45,
+ 91, 54, 87, 34,145,244,145,203,229,173, 1,192,220,220, 60, 73,165, 82, 93, 86, 40, 20, 27, 96, 56, 54,149,154,227,184, 36,173,
+ 86,235,239,232,232, 88,185,162,182, 74,108, 1,192,137,123,236, 61,128,237, 92,105, 20,223,107,116,194, 78,159, 62,221,204,214,
+214,118, 32, 69, 81,163, 9, 33, 62,101,101,101,170,101,203,150,221,136,140,140, 44,105,222,188,249,144,161, 67,135, 82,118,118,
+118,184,123,247, 46, 41, 40, 40, 56, 12, 96, 49,140, 88,105,205,113, 92,218,154, 53,107,208,216,231, 93,223,121,134, 97,114, 78,
+159, 62,237, 48, 56, 47,143,207,113, 28,134, 13, 27, 86, 71,192,213,199,227,199,143,161, 82,169, 12, 6,115, 44, 46, 46, 70, 80,
+ 80, 80,157, 1,106,245, 43, 45, 45, 13,118,118,118,117,254,199,208, 24, 75, 85, 82,132,190,115, 23, 2, 85, 43, 74,171, 81,105,
+201, 34, 32,106,147,174, 50,225,239,139,127,247,230,155, 70,153, 22, 93, 93, 93,199, 74,204,197,159,120,182,118, 13,200, 74,201,
+ 75, 40, 43,145,239,201,206,206,222,166,163, 33, 55,138,179,145, 1, 75, 77,230,223,127, 19,231,203, 56, 90, 44, 8, 97, 65, 56,
+ 2, 66, 56,112, 28, 91,185,225, 53,225, 64, 88,150,162, 40,252,169, 86,232,141, 12, 94, 63,157,182, 14, 14, 14, 43, 9, 33,131,
+121, 60, 30, 93,187,161,174,253,185,202,146,117, 86, 38,147,125,209,128,229,245,191,174, 60, 35, 35, 35, 27, 20,255,198,174, 58,
+ 28, 51,102, 12,219,200,103,243,178,185,185,185,107, 67,231, 42, 42, 42,210,179,179,179, 7,254, 77,202,179,246,138,193,198,112,
+ 54,122,213,161, 33, 78, 79, 79, 79, 49,195, 48, 29, 0,120, 83, 20,101, 3,160,144, 97,152,115,249,249,249,185, 0, 58, 1, 88,
+ 86,245,155,175, 0,220,251, 15, 63,239, 82, 7, 7,135,157, 52, 77, 55, 53,230,199, 90,173, 86, 93, 88, 88, 56,185,222,128,224,
+229, 20, 60,192,147, 8,133,119, 64,211, 77, 26,122, 30,117,125, 6, 33,153, 21, 10, 69, 16,245,178,205,175,225,180,183,183,191,
+199,231,243,155, 26,145,182, 23, 5, 5, 5,157, 76,109,242,127, 53,231,127, 51,234, 59,193,235,140, 20,255,239, 16, 90, 38, 78,
+ 19,167,137,211,196,105,226, 52,113,154, 56, 77,156,255,235, 66,171,193, 99,211, 18, 88, 19, 76, 48,193, 4, 19, 76, 48,193,132,
+ 55,195,169,122, 98,235, 84,245, 7, 74,143, 42,109,140, 73,240,117,148,237, 5, 19,167,137,211,196,105,226, 52,113,154, 56, 77,
+156,255, 56, 78, 19,254, 66,152,204,170, 38, 78, 19,167,137,211,196,105,226, 52,113,154, 56,255,215,161,115,234,144, 54,149,141,
+ 9, 38,152, 96,130, 9, 38,152, 96,194,191, 7, 70, 11, 45,115,103, 31, 95, 7,207,128, 93,182, 77,219,197,218, 54,109, 23,235,
+224, 25,176,203,220,217,199,247, 31, 90,110, 82, 0,227,249,124,254,121, 23, 23,151, 82,232,216,122,231,127, 0, 86, 0, 70,163,
+ 50,190,207, 8, 0,102,127, 37,121, 8,192, 31, 11,124, 50, 9, 72,159, 4,164,143, 5, 62, 9,249, 31,244, 27, 92, 49,219, 53,
+248,218,153,241,103, 86,204,118, 13,110,240,252,124, 87,251, 91,191,143,249,110,245, 39,110,118,127,209, 95, 90, 58, 57, 57,109,
+119,118,118,126,238,228,228,148,230,228,228,180, 19,128,181,169,185, 51,193, 4, 19, 76,248,183,161,218, 71,171,250, 85,227,163,
+197, 7,128,168,168,168, 16, 0, 87, 0,244, 14, 13, 13,189, 90,255,215,182, 30,254,211, 91,182,104,249,217,215, 43, 22, 83, 46,
+ 78, 14,102, 90,150, 99, 82,159,103,180, 93,254,117,196,161, 44, 17,127,125, 81,122,220,142,215, 72, 20,197,227,241,198,138,197,
+226, 80, 0,213,130, 45, 81,165, 82, 69,177, 44,123, 0,198, 45,211,134,179,179,243, 53, 30,143,215,172, 49,127,204,178,108,122,
+110,110,110,143,215, 44,204, 49, 30, 30, 30, 59, 67, 66, 66,204,130,130,130, 32, 18,137,176,108,217,178,249,217,217,217, 27,140,
+ 37,176,181,245,178,100,196,146, 79,249, 34,209, 0,162, 81,251, 19, 16,128, 22,199,113, 90,213, 69,161, 74,181,190,168, 40,165,
+204, 72,170,197, 0,166, 84,149,213, 14, 0,107,222,228, 46,153,220, 30, 26, 13, 91,121, 79, 8,249, 96,143, 63,179,190,178,100,
+201, 18,126,104,104, 40,118,236,216,209, 99,251,246,237, 31,150,149,149, 93, 4,112, 2,192,211, 55,189, 43,157,129, 25,221,122,
+244,248,110,242,252,249, 60,197,181,107,248,110,231,206,141,168,140,183,180,185,177,247,146, 80,136,209, 14, 14,130, 80, 66,208,
+129, 2, 40, 10,136,145, 21,112,167, 25,134, 61, 0, 35, 98,177,233,193,120,212, 93,142,191,183,177, 4, 37, 79,201, 82,241, 48,
+223,158, 37, 79, 47, 47, 5, 48,164,254,121,173, 82, 50,153,240,220, 67, 21, 36, 58, 3,192,186, 55, 44, 86, 51, 71, 71,199,216,
+227,199,143, 55, 13, 10, 10,226, 3,192,189,123,247, 38,133,134,134,246,149,201,100,254, 0, 74,255, 67,141,144,132, 79,211,159,
+136, 4,130, 1, 44,203,182, 3, 0, 30,143,247, 80,173,209,156,215,114,220,102, 24, 25,147,205, 4, 19, 76,248,223,133, 33, 45,
+242, 55,135,206,200,240,213,153, 35,181,223,107,195,220,169, 77,219,174,253, 70, 61, 46, 41,147, 43,159, 63,207, 44,154,247,201,
+170,243, 31,206, 89,123,108,221, 79, 81,167,175,222, 78,188,229, 27, 52, 48,193,220,169, 77, 91, 29,212,186,230,112, 61,164, 82,
+233,253, 45, 91,182, 48, 73, 73, 73,164,184,184,152, 60,126,252,152, 28, 62,124,152,124,244,209, 71, 74,169, 84,122, 31,128,135,
+ 49,156,206,206,206,185,143, 47,253, 78, 94,196, 70,147,180,123,183,137, 70,163, 33, 12,195, 16,134, 97, 72,194,217, 40, 18,123,
+226, 8,137, 57,124,128,168,213,106,162, 86,171,137, 74,165, 34, 45, 90,180,200, 50, 50,157,245,225,230,231,231,167,142,138,138,
+ 34,135, 14, 29, 34,243,231,207, 39,129,129,129, 44,128,153,198,230,221,220,201,187,143,101,147, 0,217,244,176,205,204,169, 27,
+231, 72,252,179, 24, 18,255, 44,153, 68, 94, 72, 36, 83, 22,108, 98, 44,155, 4,202,204,157,188,251, 24,202,187,173,173,109, 87,
+138,162, 72, 53, 0,144,102,205,154,149,215,126,121,120,120,212,121,185,187,187,151, 55,111,222,252,169,189,189,125,135,134, 56,
+199,181, 3, 33, 9,123, 9, 73,216, 75,150,244, 2,137,143,143,191, 69, 8,185, 82,253, 82, 40, 20, 87,142, 30, 61,122,229,157,
+119,222,185, 2,224,109, 61,229,100, 84,121, 78, 2,210,203,142, 31, 39,100,195, 6, 66, 66, 66, 72, 34, 64, 38, 1,233,141,228,
+108,225,226, 34,136, 89,187,230, 67,245,241,227,191,144, 51,103, 78,145,211,167,163,200,177,163, 59,201,198, 13,159, 48,206,206,
+130, 56, 0,173, 26,193,201, 7,176, 10,192,122, 84, 90, 46,147,100, 50, 25,201,201,201, 33, 0,146,170,190, 91,239,232,232,184,
+ 14, 13, 91,223,250,215,182,100,205, 29,236,114,230,221, 33, 61, 72, 89, 73, 22,121,119, 72, 15, 50,119,176, 75, 29,203,214, 96,
+ 47, 47,203, 89,195,218,201,226,239,237, 97,103, 13,107, 39, 27,236,229,101,249,154,229, 73,161,114,159,208, 45,151, 46, 93,210,
+146, 90,208,104, 52,100,247,238,221,172,173,173,237, 47,141,224,108,237,232,232,152,102,103,103,151, 84,251, 75,199,128, 17,221,
+124,122, 78, 90,110,223,246,157,144, 70,164, 51, 72, 34, 20,190, 56,127,240, 71,182, 32,253, 33, 81, 43,114, 73,201,147,104,242,
+ 34,241, 22,217,189,109,189, 70,196,231,191, 0, 16,244, 38,247, 82, 35, 97,226, 52,113,154, 56,255,134,156,250,180,200,127, 51,
+248,245, 51, 88, 31, 98,177, 40,108,249,146,133, 84,113, 65,177, 66, 89, 90,166,214, 40,149, 74, 90, 72,148, 15, 19,158,229,209,
+124, 94,241,220, 57,179, 45,195, 22, 45, 9,171, 0, 38, 24,249,159, 30,129,129,129,119,142, 28, 57,226,100,103,103,135,146,146,
+ 18, 20, 20, 20,224,206,157, 59, 32,132, 96,228,200,145,226, 46,157, 59,119, 88,186,108,217,205, 23,153,153,193,208,221,241,190,
+ 20, 47,118, 14, 88,211,163,114, 47,218, 47,158, 23, 84,246, 58, 20,133,237, 99, 66,107,174, 89,249,162,114,183, 12,137, 68, 82,
+179, 33,241,107, 32,184, 95,191,126, 66, 0,152, 54,109, 90,105, 89, 89, 89,120,149,133,195,168,157, 86,205,157,188,251, 56,184,
+186, 69,253,184,117,141,180, 93, 75,111, 48, 26, 45,210,114,178,192, 23,216,160,105, 83, 33,166, 78, 24, 32,232,213,205,206, 97,
+213, 87,219, 79,229,112, 24, 33,207, 79, 62,167,139,203,198,198,102,247,129, 3, 7,112,240,224, 65, 0, 64, 82, 82, 18,188,189,
+189,205, 13,165, 33, 46, 46,206,235,237,183,223,222, 95, 80, 80,208,202,208,181,245, 3,227,139,197, 98,244,232,209, 3,109,219,
+182,197,241,227,199,123, 87, 89,182,222, 8,138,107,215, 96,241,224, 1,112,245,181, 6, 47, 45, 58,118,244,188,117,250,212, 30,
+135, 83,167, 19,177,110,221, 78, 60,125, 90,105,104,243,242,242,194,248,113, 99, 4, 15, 31,222,240, 27, 61,122,252,141, 63,254,
+120,218,163, 74, 40, 25,194,151, 63,253,244,211,226,230,205,155, 99,244,232,209, 99,252,252,252, 92,172,172,172,176,109,219, 54,
+184,186,186,122,169,213,234, 39,199,143, 31,119,203,201,201,193,236,217,179,145,155,155, 59, 95, 23, 81,239, 65,189,151,138,135,
+249,246,108,211,113, 50, 44,172, 92,241,211,190, 3,120,124,127,119, 79, 21,147,184, 84,200, 94,157,168, 32,226, 41,178,116,139,
+176,102,157, 66,236, 91,249,189, 13,207,142,209, 14, 74,246,143,103, 75, 7,180,136,224, 75,148,187, 87,172,203, 46,120,133,116,
+116, 36,207,191,244,145, 93,220,121, 20, 0, 43,184,106,129, 85, 99,173, 37,120,187, 87,175, 94, 53, 21,247,252,249,115,168, 84,
+ 42,248,250,250,210,106,181,186,143,145,229,218,122,224,192,129,127,158, 62,125,218,190,117,235,214,178,194,194,194,154, 19, 46,
+246, 54,131,174, 30,217, 56,123,213,119,191,249,252, 74,168, 98, 89,226,177,135, 6,184,130,186,119,237,120,225,204,145, 61, 22,
+ 84,121, 6, 68, 54,249, 0, 87,128,148,253, 63,131, 50,179,195,216,143,230,241,251,244,235,219,100,192,144, 81, 23, 30, 39, 63,
+237, 7,224,174,105, 92,111,130, 9,255,104,171, 22,249, 95,203, 83,141,208, 10, 13, 13,165, 26,202, 32, 71,184, 0,103, 39,123,
+233,198,181,187,238,242, 24,181,218,220,198, 90, 45,176,182,226, 40, 75,107, 30,163,214,148,123,122,121,138, 56,194, 5,232,224,
+175,191,196,147,146, 74,165, 71, 78,156, 56,225, 36, 16, 8,192,113, 28, 28, 29, 29,145,154,154,138,226,226, 98,148,149,149,225,
+105, 98, 34,154,123,184, 99, 69,216, 66,215,217, 11,195,142,200,229,242, 78,168, 59,141,248,202,178, 81, 86, 83,119,223,232,234,
+ 45, 88, 94, 25,242, 87,125,215,192, 57, 99,151,162,166,166,167,167,195,194,194, 2,254,254,254, 22,215,175, 95,255, 67,143,200,
+170,195,105,107,235,101,201,137, 69, 7,183,252,184, 76,202,104,226,144,144, 82,136, 54,205,123,194,217,222, 3, 89,133,106,220,
+186,115, 2,113,177,123,209,178,137, 7,102,126,212, 87, 18,177,230,208, 1,161,182,185, 71,113,113,106,105, 67,156,165,165,165,
+ 22, 45, 90,180,128,135, 71,229,190,103, 44,203, 34, 33, 33, 1, 44,203,214, 28,215,126,223,117,248, 18,180,165,105,152, 60,105,
+ 18, 10, 10, 10, 44, 26,226, 20,240,160,157,247,225,120,190, 84, 0,136,204,237,212,229,229,229, 53,219,112, 48, 12,131,152,152,
+ 24, 4, 7, 7,135, 68, 70, 70, 26, 82, 69, 70,149, 39, 3,124,251,221, 47,191,108,154, 80, 82, 66, 3,192, 14,138,226, 24, 66,
+190, 53,246, 94,114,114, 18, 28, 62,123,230, 87, 7, 30,253, 8,118,214,223,224,206,157, 52, 48, 76,101,122, 11, 10,242, 48,235,
+147, 82, 8, 5,150, 56,126,252, 55,123, 95,223, 30,135,115,114, 24,127,212,157, 70,108, 40,157,146, 51,103,206, 96,214,172, 89,
+ 72, 72, 72,112,171,222,163, 77, 42,149, 98,237,218,181, 60, 95, 95, 95, 55,115,115,115,156, 61,123, 22,185,185,185,148,190,116,
+ 94, 57,119,229,235,146,167,151,151,230, 80,103, 7,255,180,239, 0, 62, 24, 55, 22, 46, 36,229, 15,235,150,212,215, 3,135,117,
+255,130,240,220, 67,205, 45, 3,108,189,253,135, 65, 40,178,192,204,207, 87, 34, 41,238,164,173,188, 44,246, 19,138,205,112, 95,
+177, 46,114,206, 43,233, 60, 52,134,157,182,247,122,199,243, 30,119, 61, 31,196,124,120, 59, 59,122,123,236, 75,161,229,197,167,
+104,214, 26,168,220,214,228,201,147, 39,120,250,244, 41,248,124, 62, 20, 10, 5,180, 90,109,131,233,116,115,115,155,161,213,106,
+191,168,170,231, 93, 18,137,228,253, 61,123,246,216,215, 22,218,142, 1, 35,186,217, 91,154,247,203,205, 43, 40,186,113, 55,254,
+241,188, 25,163,123, 95,187, 21,151,193, 8,222, 73, 47,137, 61, 94,162,163, 60, 37, 82,145,232,240,217,163,191, 89,104,158, 93,
+130,185,111,111, 8, 44,188,193,106, 50, 33, 47,170, 64,217,211,108,168,126,252, 1,237, 63,153,139,147,199, 14, 89,248,181,235,
+ 20,169,210,104,188, 1,168, 95,227,217,108, 12, 76,156, 38, 78, 19,231,223,147, 83,167, 22, 33,132,116, 4,224, 92,117, 88, 80,
+165, 11, 28, 0,228,163,114, 71, 1,231,170,182, 67, 84,235,103,245,143,107, 95, 91,255,184,246,231,130,170,207, 78, 85,239,119,
+ 41,138, 42, 52,144,116, 87, 84,110, 77,120,170,234, 29,168,154, 74, 52,232,120, 76, 81,116, 41,203,114, 98,161,163,147,114,218,
+187,253,218,253,126,225, 94,140,153,131, 21,127, 80,239, 14, 33,119, 30, 62,187, 73,209,148,134,162,104,163,252, 62,120, 60,222,
+216,141, 27, 55,182,179,178,178, 2,199,113,176,182,182,134, 76, 38,131, 90,173, 70, 73, 73, 9, 84,101,165, 96,202, 74,241, 32,
+227, 57,186,135,244,198,168,193, 3,125,127, 59,118, 98, 44,203,178,251,245,241,186, 5,116,168,177,100,173,108,102,255,210, 52,
+145, 81, 92, 35,186,190,233,224, 13,161,133, 5, 6,204, 11,123,147,123, 32,250,212,169, 83,103, 70,142, 28, 57,100,193,130, 5,
+116,118,118,246,217,212,212,212,238, 0, 18, 12,138, 10,177,228,211,143, 63, 13,181,181,181, 32,136, 60,127, 2,189, 58,140,131,
+153,136,135,130, 82, 6, 20, 5, 36,198, 31, 1, 69,217, 33, 54, 41, 27, 61,219, 91, 97,224, 32, 95,139, 99,135, 18, 23,224,165,
+127,208, 43, 85, 83, 84, 84,132,188,188, 60,104, 52, 26,104, 52, 26,140, 30, 51, 6,191,238,222,141,138,138, 10, 40, 20, 10,168,
+213,106,176, 44, 11,154,166,113, 62, 42, 18, 25,207, 18,209, 45, 56, 24,208,177,245,210,238, 24, 8, 0,220,122,252,248, 49, 18,
+ 19, 19,241,226,197, 11, 72, 36, 18,184,184,184, 96,229,202,149, 80,169, 42,247, 19, 27, 51,102, 76, 8,128,135,111,250, 64, 61,
+ 5,182,167,178,236,210, 33, 71,143, 58, 93, 63,122,148,187,117,242,228, 11,113, 89,217, 54, 99,126, 43, 20, 98,244,154,111, 63,
+106, 99,110,110,142, 23,233, 27,225,227, 35,196,252,185,246, 8,255, 38, 31, 0, 48,123, 86, 83,116,238,228,128,210,226, 67,112,
+112, 90,140, 77,155,230,180,156, 50,101,253, 36,185,156,221,101,128,122,233,137, 19, 39, 70,121,123,123, 55,137,142,142,166, 68,
+ 34, 17,164, 82, 41,164, 82, 41, 36, 18, 9,242,242,242,144,154,154, 74,214,172, 89,147, 9, 96,169, 62,162, 21,155,178,111, 2,
+ 24, 50,119, 48,206, 60,190,191,187,103, 19,222,179, 7,163,102,246,120, 30,123, 43,186,236,247,243,215,191,210, 42, 37, 25,197,
+ 47, 46, 44,108,209, 57,218,225,147,207,190,196, 15,107,150,227,241,237,107,133,206, 30,165,155,165,148,170,193,116,134,132,172,
+224,187, 58,219,105,103, 76, 25,101,115,210,249,198,140,211,124, 74,150,147,127,127, 45, 82,163, 21,226, 86, 29, 38,182,246,162,
+213,151, 46, 93,146,246,234,213, 11, 74,165,178,198, 50,185,103,207, 30, 78,171,213, 94,110,240,222,100,152, 47, 50, 51, 51, 93,
+ 21, 10, 5, 6, 15, 30, 60,123,237,218,181,230,213,251,201,177, 44, 91,199,146,245,245,134, 95,207,125,250,197,230,203,231,246,
+127,227,246,117,216,251,189, 39,204, 92,117, 25, 58,246,145,228,211,244, 39, 39,143,238,116,145,216,106, 32,181, 27, 8,101,174,
+ 2,143,183,127, 0,121,169, 18,157,191,254, 18,128, 8,106, 13,141,109,195, 70, 67, 96,239,134,229,211,223,119, 91,178,237,167,
+143, 56,142,219,104, 26,215,155, 96,130, 9,245,224, 76, 81, 84, 20, 0,132,133,133, 45, 14, 15, 15,143,167, 40, 42,138, 16, 18,
+ 90,101, 64,137, 34,132,132, 86, 95, 83, 37,206, 94, 57,174,190,182,254,113,253,207,139, 22, 45,242,139,136,136, 88, 29, 28, 28,
+188,255,198,141, 27,207, 0, 24, 18, 90, 67,171,132,213, 43, 91,239,208,213, 10,178,246,123, 29,139, 22,199, 93,123,242,236,185,
+124, 96,255, 46, 77,163,174, 62,188, 59,117,234,208,126, 99,135,245, 26,148,154, 94,144,216,210,211,197, 33, 62,254,161, 21,199,
+113,215,140, 41, 37,177, 88, 28,218,183,111, 95,126, 81, 81, 17,204,204,204, 32,147,201,144,153,153, 9,134, 97,160, 44, 41,134,
+170,164, 24,202,226, 34, 48, 37, 69,120,122,239, 14, 2, 90,122,137,171,156,229,245,162,218,234, 82,223, 82, 85,219,178, 37,178,
+180,132,216,210, 18, 84,227,167, 13,223,177,177,177,185, 85,221,169, 50, 12,243,201,194,133, 11,243, 57,142,195,170, 85,171,172,
+ 44, 44, 44, 34, 1,136, 13,145, 88, 58,242, 66,131,219,251,211,143, 82, 99,209, 35,112, 50, 90,183,120, 11,169,185, 10,228,151,
+ 49,200, 43,102,208,185,215,247,104, 22,248, 37,220,219,135, 35, 49,173, 16,110, 77,188,105,240,197,122, 55,127,206,200,200,168,
+115,188,127,223, 62,200,229,114,180,108,217, 18,227,198,141,195,194,133, 11, 49,110,220, 56,184,185,185, 97,194,187,111, 99,249,
+242,229,200,201,201, 49,148, 84, 85,235,214,173, 85,158,158,158, 42, 79, 79, 79, 21,195, 48, 40, 47, 47, 71,113,113,113,253,242,
+158,211,216,130,116,114,114, 90,228,226,226, 18,235,228,228, 20, 47, 22,139, 79,199, 80,212, 35,165,167,167,115,247,225,195,169,
+182,239,190,203, 75,147, 74,169,171,128,133, 49, 92, 14,118,130,161,125,250, 14, 17, 21, 23,237,172, 49, 82,189, 63,213, 17,127,
+ 94,245,195,245, 63, 58, 97,214, 39, 45, 65,209, 18, 80,180, 8,242,138, 75,232, 18, 20, 44,180,177,161, 12,221, 75,227, 1,196,
+116,239,222,221,109,230,204,153,148, 88, 44,198,236,217,179,153,233,211,167, 39,143, 27, 55, 46,249,226,197,139,172,167,167, 39,
+220,221,221, 41,119,119,119, 87, 0, 49, 85,191,209, 11,171,150,212,215, 42, 38,241, 15, 27,111,243,103, 44, 28,186,149,107,196,
+163, 87,172,203, 46,248,122,203,179,117,169,143,229, 94,143,111, 95, 43, 72,142, 59,201,165,222,189,146,159,149, 92,230,245,245,
+150,103,235, 22,111,206,106,240,161,190,122, 21,220,145,168,171,140,188, 66,206, 31, 62,172,143,124,198,180,177,173,237, 44,252,
+246,160,201,192,192,102, 30, 77, 39, 44, 95,189,137,153,254,209,167,204,142,159,119,146,178,178, 50,148,150,150, 98,211,166, 77,
+218,147, 39, 79,102,178, 44,251,169,174, 49, 16, 0,104, 52, 26,204,152, 49,195,220,202,202, 10, 25, 25, 25, 53, 22, 81, 0,200,
+150, 21, 60,188,126, 55,238,209,188,127,141, 9,169, 80,169, 84,231,174,220, 75,108,235,237,217,148,162,136,206,133, 40, 34,129,
+ 96, 64,167, 46, 93,120,132, 20,131,226,123,224,233,238, 53, 40,205, 41, 68,105, 94, 33,120, 2,115,104, 33,134,134, 19,193, 38,
+ 32, 8, 73,119,163,209,196,209,153, 47, 22, 8, 6,153,250, 19, 19, 76,248,103, 66,159, 22,169, 45,150, 34, 34, 34, 86,235, 59,
+ 95,235, 93, 93,239,184, 70, 72,213, 23, 97,181, 63, 3, 64, 68, 68,196,106, 66, 72,232,141, 27, 55,246, 1, 80, 24,153,133, 15,
+107,189, 27, 31, 71,139,167, 84,135, 47, 88,184, 20,182,214, 82,235,160, 14,222, 46,199,207, 94,189,119,237,198,189,196,102,238,
+ 14,142, 68,163,182,253,118,253, 15, 77, 41,185, 34,194,200, 68,248, 58, 56, 56,128, 97, 24, 60,121,242, 4, 47, 94,188, 0,195,
+ 48,208, 86, 84, 64, 85, 92, 12,101, 81, 17,216,138, 50, 8, 89, 22, 10, 89, 30,236,205, 36,192,203, 21,137, 6, 44,111, 84,131,
+ 66,171,250, 93, 98,101, 5,177,165, 21,104,129,192,224, 78,241,181,208, 49, 40, 40,232, 96, 92, 92, 92,151,254,253,251,127,133,
+202, 37,242,105,153,153,153,253,150, 45, 91,166,114,118,118,198,140, 25, 51,218, 0,152,108, 80,100,138,212,190,158, 46,109,208,
+218,107, 50,154,185,247, 69,113,133, 6,178, 82, 13,242,138, 25,108,251, 62, 24,135,119, 4,225,207,195, 61, 17,119,110, 0,138,
+ 53, 46,176,112,123, 7,132, 85,251,233,227, 60,127,254, 60, 86,174, 92,137,175,190,250, 10,171, 86,173,194, 87, 95,125,133,204,
+204, 76,248,251,251, 35, 61, 61, 29,103,206,156, 65,118,118, 54, 28, 28, 28,112,231,206, 29,108,216,176, 1,127,254,249,167,193,
+ 76, 87, 11, 87, 35,174,105,212, 92,186, 86,171,157,146, 61,124,120,187, 92, 59,187,182, 29, 58,116, 24, 50,123,246,108,175,238,
+221,187,215,156,247,242,242,242,144, 74,165, 57,168, 92, 65,217, 94, 31, 23, 7,116,112,116,244,135, 90,245,168,170,142, 5,160,
+ 40, 9,250, 14, 72, 68,247,158,247,192,104,132,160, 41, 49,104, 90, 2,173,182, 0,182,182,110, 32,132,242, 55,144,196,101, 50,
+153,204,251,194,133, 11,116,106,106, 42, 36, 18, 9, 0, 60, 95,177, 98,197, 15,235,214,173, 75,176,183,183,103,163,162,162,112,
+236,216, 49,132,134,134,242,166, 79,159,238,237,238,238,190,213, 80,190, 87,108,202,190,185,119,253,153,247, 4, 26,219,246, 18,
+105,179,230,168,176,120,231,227, 16, 7,115, 0, 56,155,146, 82,230,228, 81, 26, 81, 81, 22,155,110,211,180,252,155,179, 41,134,
+ 86,156,174,224,238, 39, 63,186,181,247,232,217,146,188,220, 34, 65,135,118,126,138,240,149,159, 9,155, 53,111,245,237,242,133,
+255,114,201, 44,149, 20, 15,152,125,230,209,145,179,119,202, 39, 78,253, 64, 59,237,195,153,202, 51,103,207, 31,229, 56,174, 29,
+116,172, 56,228, 56, 14,217,217,217,136,143,143, 71, 74, 74, 10,100, 50, 25,242,243,243, 81, 86, 86, 86, 51,221,104, 86, 86,122,
+234,135, 95, 78, 62, 48,151, 74,205,186,180,243,246,184, 29,157,144,103, 46,149,154,121, 55,247,104, 13,172,104,176, 29, 97, 89,
+182,157,196, 76, 10,128, 66,113,220, 53,148, 23,149,163,188,184, 28,101,133,229, 80, 49, 60, 40, 85, 52, 20,106, 26,158, 33, 3,
+ 81, 94,161, 68,121, 65, 9, 56,150, 13, 52,117, 55, 38,152, 96,130,158,190, 62, 42, 44, 44,108,177,145,215, 26, 61,189, 89, 95,
+120,133,133,133, 45,166, 40, 42,106,209,162, 69,126,208,189,160,170, 54,182, 55,240, 2, 96, 68,120,135,130,130,228,114, 75,202,
+119,228,220,207,191, 56,179,239,231,239,157, 84, 42,121,186,189,173, 5,107, 97, 38,114,152, 54, 99, 21,202,202,139, 70, 84, 24,
+ 31,142, 0, 69, 69, 69,120,246,236, 25,164, 82, 41,132, 2, 1, 88,133, 2,172,162, 2,138,162, 2,208,140, 10, 66,150,133,157,
+153, 20,158,110, 46,104,230,236, 98, 20,231,147, 75,191,215, 56,190,215,158, 46, 92, 19,228, 11,145,185, 5, 68,150, 22,248, 56,
+234, 10, 0, 64, 40, 20, 2,203,190, 50,202,104,210,164, 73,147, 19,123,247,238, 21,202,100, 50,196,196,196, 60, 0, 80, 2,192,
+ 18, 0,151,152,152,120, 33, 46, 46, 46,212,219,219, 27, 0, 90, 26, 34, 43,205,167, 89,141,150, 32, 35,231, 57, 82, 95, 68,195,
+206,186, 5, 4,102,173,145, 87,204, 64, 44,109, 1,141,234,229,236,163,178, 52, 13, 10,134,103, 84,222,213,106, 53,180, 90, 45,
+180, 90, 45,212,106, 53, 62,252,240, 67, 92,191,113, 3,251,143, 93,196,179,167, 73,104,211,220, 5,147, 38, 77, 68, 80, 80, 16,
+110,220,184,161,151,107,114,123,104,154, 88,128,191,126, 8, 13,145,133,189,170,235,194,115,183, 13,137, 45,138,162, 8,116, 76,
+ 69,214,195,186,224,224,224, 86, 73, 21, 21,136,127,244, 8,253, 87,172, 0, 0,156, 62,125,186, 78, 94,230,205,155, 39, 74, 72,
+ 72,152,118,239,222,189,105, 89, 89, 89,235, 1, 52,236,108, 78,128, 83,167,110,226, 95,255, 74,128, 76, 38, 3, 0, 28,216,247,
+ 82,151,166, 62, 99, 48,120,104,229,140,150,141,141, 13,214,175,247, 55,170, 60, 89,150,197,246,237,219,107,166, 11, 1,128,207,
+231,119,159, 55,111,222,200,134,174,111,213,170,149,208, 16,231,220,209, 77, 36,127, 62, 32,159, 88,183,106,230,103,229, 16,128,
+ 2, 77,180,127,116,102,246,172,185,163,155,108,220,112, 40, 83, 41,165, 84,187, 40, 54,195,157, 47, 81,238, 54, 38,141, 41,103,
+191, 87, 23,120, 78,217,157, 35, 43, 93, 50,243,131,241,246, 86, 54, 78, 21, 59,126, 8,183,165,121, 52, 57,113,143, 41,246,243,
+178,183,121,167,235,119,229,255,154,187, 44, 90,173,205,152,137,140, 19, 73,208, 19,226,130,101, 89,100,101,101, 65, 38,147, 33,
+ 61, 61, 29,249,249,149,211,175,249,249,249,224, 56,238, 77, 26, 68, 40,210,211,145,118,116, 7,154, 77,156,136,206, 95,173, 4,
+203,241,161,144,179, 88,223,173, 31,138, 74, 20, 80,113, 20,220, 58,118,195, 7,167,255, 0, 77, 88, 96,219,102, 83, 79, 98,130,
+ 9,255, 80, 24, 19,222,161, 90, 16,133,135,135,135,254,213,255, 95, 91,108,133,135,135,199,135,135,135, 55,230,191,234, 79, 25,
+214, 28, 87,251,104, 93,169,229,128,246, 74,167, 89,150,159,152,146,144,192,207,170, 80, 84,152, 57, 59, 57,170,204, 36, 98,174,
+164,180,140, 23,253,240, 1, 83,145,243,244,113, 35,242,145, 24, 23, 23,231,159,149,149,133,244,180, 52,104, 21, 21,160, 85,106,
+ 16,165, 28,253,123,116,131, 4,128,132,166, 32,228, 24,240,121, 34,148,149,151, 2, 64,162,193,206, 81,163,121,197,178, 69, 81,
+ 20, 68,150,150, 16,153,155, 67,100, 97, 89,199,194,101,140,197, 70, 44, 22,239,141,140,140,116,109,210,164, 9, 86,174, 92,137,
+166, 77,155,250,184,185,185,201,173,173,173,165,206,206,206,104,219,182, 45,186,117,235,134, 51,103,206, 0, 70,196,148,210,104,
+ 37,177,143,159,163,123,126,225, 13,252,113,229, 71,168, 21, 42,116, 8,249, 17, 12,191, 25, 28,253,190, 4,247,100, 15,228, 57,
+199, 43,173, 7, 46,195,240, 34,253, 57, 40,158, 40,222, 88,203, 83,245,231, 7, 15, 30, 96,223,241,171,112,245,244, 69,122,242,
+ 35, 60,186,124, 1,215, 29,237,225,233,219,182,102, 26, 72,103, 26, 89,240,191,222, 92, 25, 38,106,233, 39,227,197,133,133,133,
+ 98, 59, 59, 59, 85,117,217,185,186,186,190,137,216, 26,191,127, 26, 81,117, 0, 0, 32, 0, 73, 68, 65, 84, 96,193, 2, 20, 11,
+ 4,192,208,161, 16,166,164,128, 97, 24,116,237,218, 21,157, 59,119, 6, 0,116,237,218, 21,124, 62, 31, 1, 1, 1,112,115,115,
+195,230,205,155,199,235, 18, 90, 52,133, 24,173,182,192,199,203,203,171, 70,104,237,254, 85,134,232,123, 3, 64, 65,132, 77, 63,
+ 60,169,185,214,195,195, 3, 57,217, 41,160, 40, 18,103, 32,141, 95,185,184,184, 44,115,117,117,245, 90,183,110, 29, 79, 34,145,
+224,163,143, 62,106, 81, 94, 94,222,172,202,148,140, 69,139, 22, 1, 0,150, 47, 95,142, 21, 43, 86, 64,165, 82,201,117,145,237,
+ 94,223,206, 45,175,144,155, 70,202,205, 70,244,113,104,214,174,239,160,254,104,225,221, 23,125, 7,165, 3,192,106, 59,254,243,
+119,191, 93, 98,115,212,198,146,218,249,251,217,243,203,123,132,244, 93,178,176,252,242,215,223,108, 47, 54,232,243, 88,146,182,
+171,236,177,104,236,134,239,183,254,186,225,139, 69,115, 36,233, 50,117, 81,102, 17, 41,183, 16,243, 45, 90, 58, 83, 22,179, 62,
+255,234, 89, 86, 86,202,124,100,156, 53,184,210,146,227, 56,164,164,164,212,248,244, 41,149, 74, 84, 84, 84, 32, 35, 35,163,230,
+158, 81,152, 91, 13,158, 57,117, 88, 96,133, 66, 33,191,253, 48, 57,125,233,236, 9,193, 21, 10,133, 60, 57, 53, 61, 9,216,212,
+160, 26,163,105,250,161,188, 76,222, 95, 94,172,132, 44,230, 49,154,246,243,132, 70, 75, 65,173,101, 33, 43, 40,131, 74, 11,176,
+180, 0,126,239, 78, 2, 75,241,145,159,149, 9,154,199,123,128,186, 78,251, 38,152, 96,194, 63, 7,122,181, 72,181, 69, 43, 56,
+ 56,120,127,109,171, 83,245,103, 0, 42,232,119,229,145,213, 22, 83,213,211,137,186,254,167, 30,175,177,120,197, 71,203, 96,120,
+135,234,255,116,183, 46,117, 91,179,124, 66, 83, 78,171,109,147,151,159,171,229,243,197, 2,119,107, 69,118, 97,186,241,255,174,
+ 82,169,162, 46, 92,184, 48,124,192,128, 1,226,228,135, 15,160, 46, 41,129,186,164, 24, 2, 78, 11, 59,105, 39,208,140, 10,148,
+ 90,141, 38, 62, 28,148,101, 82, 92,189, 30,167, 81,169, 84, 81,198, 10, 45,154,199,171,235,151,101, 97, 1,177,165, 21,196, 22,
+ 22,245,167, 22, 13,137, 2,179,129, 3, 7,246,235,218,181, 43, 8, 33,216,190,125, 59, 24,134, 17, 49, 12, 3,181, 90, 13,134,
+ 97, 80, 90, 90,138, 95,127,253, 21, 91,182,108,185, 14,224, 23,131,157,153, 86,125,225,220,249, 75, 65,239, 79, 8, 21,156,142,
+ 90, 15,173,154,133,130,106,138,138, 10, 13,202,213,102, 96,237, 39, 2,185,167,192,227, 75, 16, 28,208, 2,199, 15, 29, 97,160,
+ 85, 93, 52, 82,133,215,177, 10,101,164, 63,199,139,167, 73,176, 40,205,129,163,149, 25,228, 41, 73,232, 48,105,242,107, 89, 39,
+220,221,221,193,113, 28,250,244,233, 83,227, 92,253,186, 98,171,160,160, 0, 39, 79,158, 68,215,174, 93, 17, 18, 18,130,204,204,
+ 76,164,164,164,224,173,183,222,170,185,230,193,131, 7,136,142,142, 70,203,150,250,141,132,249,133,154,211, 47, 50, 98,198,188,
+243,206, 59,194, 91,183,110,129, 16, 2,111,111, 43, 88, 89,154,131,162,197,240,245,117, 2, 80, 57, 6,232,221,187, 55, 74, 75,
+ 83,180, 69, 69,228,180,129,236,238, 5,112, 76,173, 86, 63,233,213,171,151,219,211,167, 79, 49,119,238, 92,254,129, 3, 7,170,
+ 77,201, 8, 11,171,187,152, 66,161,208, 61,117,223,166,157,207,103, 45,180,182, 33, 18,105,179,230, 86, 14, 1,104,225,221, 23,
+ 0, 48, 32,244,125,180,104,229,129,210,252,216,230, 74,197,243, 17, 66,126,145,109,236,166,204, 4,233, 80,255,169,202,188, 43,
+201,168,156, 58, 53, 88,237,138,228, 3,185,233,130,137, 7,143,157, 56, 51,227,173,208,183, 5, 26, 86,171,245,247, 20,216, 68,
+ 30, 61,149,151,153,150,254, 29,210,207,198,189,180,255,233,181,226,177,165,165,165, 48, 55, 55, 71, 92, 92,156,106,232,208,161,
+ 98,154,166,241,228,201,147, 26,161,229,228, 96,215,182,123,103,127,159,175, 55,252,122,206, 92, 44, 22, 15,234,221,201, 55, 33,
+ 57,237, 5, 33,212,115,157,214, 86,141,230,252,195,152, 7,125, 28,221, 90,241, 82,174,220,130,125,207,183,160, 82,209, 80,168,
+ 57,168,180,128,150, 39,132,107,251, 46,176,105,233, 11, 2,224,238,173,235, 26,149, 70,115,206,212,215,152, 96,194, 63,218,170,
+ 69,244,137,164,170,207,133, 0,158,135,135,135,231,215,178, 54,201, 0, 60, 0, 16, 88,117,157,172,222,239,100, 20, 69,221, 37,
+132,116,174,197, 35,171, 37,184,106,127, 86,215,187,230, 65, 35, 68, 86,237,247,186, 66, 75,215,146, 74, 0,112,112,112,112,234,
+208,161, 83,203,159,126, 62, 8, 66, 8, 30, 71,175, 69, 81,222, 35, 44, 91,125,179,101,147, 38, 77, 66, 50, 51, 51,175, 26,147,
+ 2,150,101, 15,236,220,185,115,126,151,142, 29, 58, 52,111,218, 20, 15,158,167, 66, 72, 88, 8, 89, 22, 52,163, 2,159, 85,163,
+169, 63, 11,154,178, 64, 86, 86, 9, 34,246, 30,140,171,138, 18,175, 23, 62,111,189,141,149, 47, 74, 64, 81, 20,214, 5,251, 67,
+100,105, 1,161,185, 5, 62, 62,113,169, 70, 92, 69,173, 92, 4,145,133, 5, 90,118, 49, 42, 32,188,252,242,229,203,247, 30, 62,
+124,216,217,223,223, 31,243,231,207,199,243,231,207,193,113, 28,114,115,115,149,217,217,217,153, 50,153,236, 57,128,163, 0,126,
+130, 17,145,199,133, 42,229,198,168,195,187,103, 6,247, 8,113,120,103,196, 22, 28, 59, 52, 15,197, 37,165,144,107,165,168, 80,
+106, 81,161,226,193,206,190, 29,186, 4, 4, 32, 43, 51, 15,241,183,206,149,243, 85,242,181,141,185, 65, 41,138, 66,116,116, 52,
+188,220, 44,145,244,199, 85, 56,152, 9, 16,232,230, 2,183,238, 61,106,226, 75,233,131,128, 7,237,248,241,227,107, 34,195, 15,
+ 28, 56, 48,117,226,196,137,174,243,230,205,195,207, 63,255,140,235,215,175,191,226,160, 29, 18, 18,130,107,215,174,125, 9, 96,
+185, 33,163,158, 90,173,134,143,143, 15,238,222,189,139, 11, 23, 46,160,111,223,190, 8, 9, 9, 65,108,108, 44,126,255,253,119,
+ 68, 71, 71,131,162, 40,216,219,219, 67, 83, 41,158, 53,186,200, 24, 6,145,223,124,187,115,241,134, 13, 91,252, 38, 76,152,128,
+195,135,247,227,253,169,109, 64,209, 98, 80,148, 24,111, 15,107,131,149, 95,221, 69,151, 46,189,225,224, 32,192,134,245,199,159,
+ 41, 20,236,175, 70, 20,227,215,191,255,254,187,155, 82,169, 68,113,113, 49,177,176,176,160, 10, 10, 42, 87,180, 54,100,209,146,
+203,229, 18, 93, 68, 15,239, 39,174, 45, 46, 35, 69,164, 60,122, 68,161, 54,186, 93,223, 65, 25, 24, 16, 58, 21,231,163,126,193,
+165,115, 23, 96,199,127,158, 10,243,178, 51,249,169,249,165,217, 21,222, 91,125, 59, 78,231,189,168, 56,183,117,214,219, 73, 60,
+ 87, 87, 46,114,209,143,165,197,250,132, 22, 0,170, 48, 97,207,137,163, 4,111,119, 11,238,210,202,223,195, 85, 84,148,159, 71,
+ 14, 29, 63, 19,199,164, 30, 62, 89, 75, 96, 17, 3, 66,125,101, 88, 88,216, 23, 85,159,119, 45, 93,186,116,122, 68, 68,132, 99,
+ 78, 78, 78,141,143, 86, 94,126,225,165,110, 67,103,177, 5,197, 37,234,157, 27, 62, 31, 45,149,136, 69, 75, 35,118, 94,209,240,
+112, 75, 23,175,150,227, 54,191, 59,119,217,156,228,199,209, 77,154, 73, 69, 56,254,249,114, 60,248,253, 50, 52,180, 16,255,186,
+112, 27, 42,134, 69,113,126, 1, 46, 78,251, 4, 22,206,182,216,114,229,112, 46,199,113, 63,154,186, 26, 19, 76,248,231, 66,151,
+ 22,161, 40,170,161, 24,123,185, 13,124,119, 87,223,239,116,240,252, 21,208, 25, 21,222,168, 37,120,249,249,249,121,215,174,221,
+198,149,168,175,113, 53,234,107,196, 71, 63, 64, 86,166, 26,153,185, 74, 88, 89, 89,221,212,243,211,250,145, 99,137, 92, 46, 31,
+185,116,217, 23, 57, 18,169, 25,122,245,235, 7, 23, 71, 39,152, 9, 5,224,105, 57,240, 40, 1,202,101, 54, 72,138,149, 99,225,
+206, 61,121,229,114,249,200, 6, 58,137,254,186, 68, 6, 69, 81, 16, 91, 89, 66,100, 97, 9,177,165, 85,157,105, 68,137,149, 21,
+ 36,150, 86,224,139, 68, 13, 57,195,191,194, 89, 94, 94, 62,106,244,232,209, 69, 37, 37, 37,152, 62,125, 58,174, 94,189, 26,125,
+238,220, 57,171,216,216, 88,169, 76, 38,107, 5, 96, 32,128,109,122, 68, 86, 29,206,162,162,148, 50,162, 85,141, 13,255,226, 83,
+133, 82,107,143, 49,147, 15,192,156,206,128,150,229, 64, 0,184,217,137,208,189,255, 87,200, 83,119,195,129,173,171,228, 28,163,
+156, 80, 47,134, 86, 29, 78, 66, 8,113,118,118,126,165, 12, 46, 92,184,128, 49,163, 71, 97,208,136,225,112,108,238, 5,167,254,
+111, 97,208,244,127, 97,235,214,173,160,105, 26, 14, 14, 14,245, 59,222, 26,206,221, 49, 16,236,123, 8,106,223, 67, 80,187,162,
+193, 7, 48,105,207,158, 61,223, 4, 6, 6, 94,190,126,253,250, 90, 0, 99,107,255, 87, 45,172,168,103,205,106,168,142,150,204,
+153, 51, 71,145,156,156, 12,115,115,115,104,181, 90, 92,191,126, 29, 91,182,108,193,186,117,235, 16, 29, 29, 13,123,123,123,180,
+108,217, 18, 42,149, 10,119,239,222, 85, 0, 88,162,135,147,147,201,180,163, 54,109,138, 40, 8, 13,237,137,157, 59,127,128,139,
+ 75, 55, 8,248, 46,224, 11, 28, 97,110,225,131, 29, 63,125,131, 33, 67, 58,224,196,241,131,133,249, 5,218, 81, 0,180, 70,220,
+ 75,202,219,183,111, 99,235,214,173, 24, 61,122,116,230,152, 49, 99,216,146,146,146, 26,139, 22, 33, 4,132, 16,172,168,242, 49,
+ 83,169, 84, 98, 93,156, 31, 44,140,203,252,124, 85,252,202,220,156,204,174, 87, 47,223, 28,127,233,220, 5, 60, 75,190,132, 75,
+231, 46,224,143, 75, 55,194,114,115, 50,187,118, 8,106, 45, 28, 57,125,230,103,187,143, 28,230, 89, 88,185, 98,247,145,195,188,
+113,179, 62, 93,213,105, 80,223, 37,134,238,249,170,122, 36,229,121,185,139, 86,175,253,190, 92,203, 40,233, 53,223,109,206, 82,
+200,178,151,212,186, 47,137,161,251, 83,161, 80,108, 83, 42,149,110, 74,165,210, 77,165, 82, 45,121,254,252,121,175,249,243,231,
+203, 88,150,173,177,150,202, 18, 78,220,124,244,231,174,213, 78, 14,182,210,110,157,253,218,172,223,118,232, 74,122, 70,238,111,
+181, 98,104, 53,148, 78,101,185, 66, 57,106,248,200,137, 21,197, 69, 42, 4,127, 26, 6, 78, 98, 1, 21, 11,104, 8, 15, 90,138,
+143,135, 95,175,135,212,206, 18,123, 83,239,203, 75, 52,204, 40,212,141,161,165, 47,239,111, 2, 19,167,137,211,196,249,247,228,
+252,111,134, 43,234,238,117,232, 90,199,162,101,104, 73,101,147, 38, 77,122,189,243,118,127,244, 14, 93, 10, 66, 8, 30,221,255,
+ 22, 69,178,199,104,226, 34, 70, 74,122,105, 48,128,171,141, 72, 76,250,243,140,140,174,115,150, 44, 61, 50,102, 96, 63, 95,255,
+230,205,197,205,154,121,194,220,201, 9,249,249, 50,252,121, 43, 65,179,106, 95,100, 92,149,200, 50,106, 98,146,227,184, 74, 39,
+119, 0,253,230, 44, 4,197,227, 1, 85, 97, 28,170, 59,198,230,157,187,129,226,243,193, 18, 14, 42,149,202,152,213,114, 47,158,
+ 62,125, 58,106,194,132, 9, 23,163,162,162,232, 65,131, 6,181, 63,122,244,232,155,236,153,135,138,188,228,203, 0, 66, 87, 45,
+154,113,160,107,223,225, 86,222,126,157,132,157,154,241,192,104, 40,100,101,166, 33,234,200, 29, 38,225,246,185, 82,162, 85,142,
+149,231, 39, 95,214,199,197, 48, 76,122,171, 86,173,156,183,110,221, 90,227, 12,207,178, 44,242,243,243,113,243,230, 77,180,235,
+220, 5,190, 83,167, 65, 38,147, 97,211,166, 77,240,240,240,192,176, 97,195, 80, 88, 88, 8,173, 86,107,236,132, 47, 11,224, 92,
+213, 11,245, 68, 22, 85,181, 5,144,222,105, 67, 47, 47, 47,145, 82,169,108, 79, 8,225, 81, 20,181, 81,173, 86, 79, 89,180,104,
+145,235,234,213,171,209,166, 77, 27,228,231,231,195,220,220, 28,222,222,222,144,201,100,184,115,231, 14, 43,151,203,183,162,114,
+ 35,107,153,129,244, 61,185,115, 39,181,235,236,217, 31, 31,249, 38, 98,134,183, 82,213, 91,100,103,215, 3,132,104, 33,147, 61,
+ 71, 89,233,117,230,171,149,191, 60,205,205,211,140, 4,144,108,100,158,151,207,156, 57, 19, 0, 36, 0,150,166,164,164,196,248,
+250,250,122,235,178,104, 25,131, 13,135, 50,149, 0,246,141, 26,228, 54,183, 52, 63,214,219,142,255, 60,181,171, 63,183,105,195,
+161, 76,165,149, 91,197,215,249,207,175, 38,101, 87,156,219,186,251,200, 97,222,228, 17,163,216,166, 22,201, 97, 18, 39,114,200,
+ 8,106, 18, 24, 24,232, 78, 81,133, 45,242, 10, 30,223,123,127,250,140,119,173,133,138,211,129, 77, 11, 90,210, 30, 29, 36,209,
+209,209,169,104,228,202,208, 42, 36,101,102,102,246, 90,180,104,209, 57, 66, 72, 29,223,132,188,252,194, 75,193,161, 51, 73,113,
+113, 73,140, 44,241,132, 49,177,212,238,220,185, 31,221,207,191, 93,135,195,223,172,142,112,238, 61,103, 62, 63,233,242, 21,128,
+213, 32,237,234, 21,176, 98, 53,183,254,198,249,220, 18,134, 25, 1, 83, 84,120, 19, 76,248,199, 91,179,244,105,145,191, 57,134,
+ 66,135, 51,188,209,153,241,106,209,228, 92, 27,239,102, 3, 61,154, 58, 2, 0, 82, 82,179,144,146,154,249,123,202,179,204, 65,
+ 6, 20,175,174,229,149, 53,155, 74, 83, 85, 33, 28,136,113,155, 74,215,225,180,183,183,191,199,231,243,155, 54,166, 52, 88,150,
+205,202,207,207,239, 96,100, 58,199, 53,111,222, 60, 34, 45, 45,237, 8,199,113,115, 27,169,246, 27,228,172,222, 84,154,230,139,
+250, 19,173,186, 29, 0, 80,124,145, 49,155, 74,215,230,108,103, 97, 97,177, 77, 32, 16,120, 84,215, 99,181, 15, 22,203,178, 60,
+134, 97, 36, 44,203,242, 0, 80, 52, 77,107, 5, 2,129,146,162, 40,173, 86,171, 77, 87,169, 84, 51,240, 50,224,168,190,188, 27,
+236,232,171,132, 22, 26,176,104, 93, 0,128,228,228,228,214,182,182,182, 99, 41,138, 26, 77, 8,241, 41, 43, 43, 83, 45, 91,182,
+ 44, 58, 50, 50,178,180,121,243,230,131,135, 14, 29, 74,197,198,198, 34, 46, 46,142, 20, 20, 20, 28,170,178, 98,165, 52,242, 94,
+162,197, 98,222,123,118,118,244, 80, 66, 16, 8, 2,138,162,241,176,164,132, 59, 45,151,179,191, 85, 9,198,198,222,159,213, 24,
+223,172, 89,179, 95, 82, 83, 83, 5,186, 44,169,186,242, 94, 31,223, 46,241, 91, 26,220,179,231,168,155,127,252,113,244,243, 85,
+241, 43,107,159,155, 53,220,246,253,113,159,204,249,118,223,230,239, 62,255,254, 88,209, 78, 99,210,217,190,125,123, 47,138,162,
+198, 2,240, 39,132,180, 34,132,146, 80, 20, 41,162, 40, 42, 30, 64,172, 90,173,142, 74, 72, 72,120,241, 6,121,127,157, 17,174,
+ 46,206,154, 77,165,193,178, 1, 44, 64,140,220, 84,250,255, 59,157, 38, 78, 19,167,137,243, 63,199,249,223,140, 15, 27,248,206,
+184,200,240,213, 72,121,150, 57, 40,229, 89, 38, 90,181,106, 69,158, 60,121,210, 40,145,166,171,147,102, 89,118,191, 92, 46,223,
+255, 38, 36, 5, 5, 5,157,254,205,133,183, 47, 53, 53,117,223, 95, 73, 88, 37,164, 86, 86,189, 94, 23, 15,203,203,203,187, 24,
+123, 49,195, 48,255,142,178,161,170,172, 89, 95,234,186, 96,224,192,129,105, 12,195, 92, 0,144, 65, 81,148, 13,128, 66,134, 97,
+206,105,181,218,220, 39, 79,158,116, 90,191,126,125,117,228,251,175, 0,220,123,205,116,112, 42, 21,187, 55, 43,139,221,251,111,
+200,227, 94,181, 90, 61,207,222,222,190,165, 82,169, 20, 41,149, 74, 97,237,197, 7, 82,169, 84,166,207, 33,190, 54,108, 44,169,
+ 93, 66,126,145,189,141, 37, 85, 95, 72,193,174, 9, 14, 43, 42,226,218,216, 53,193, 97, 99, 19, 22, 19, 19,147, 18, 24, 24,184,
+135,166,233,230,132, 16,103,128, 88, 19, 2, 25, 33, 36,159,207,231,103, 38, 36, 36,100,254,141, 26, 33,165,150,227,214,106,213,
+234,151,126,135,166,213,133, 38,152, 96,194,255, 14,116,250,104,241, 27,203,244,228,201, 19,202, 84,158, 38,212, 22, 91,250, 78,
+166,165,165,169, 0,220,168,122,213,199, 61, 0,195,254,238, 25,204,206,206,238,160,235,156,177, 34, 11,168,244,217, 2,226, 26,
+140,206,190,226,251,162, 50,124,127,228,179,198,166,237,193,131, 7,233, 48,114,138,221, 4, 19, 76, 48,193,132,127, 27,222,220,
+162,101,130, 9, 38,152, 96,130, 9, 38,152, 96, 66,131,216, 94, 75,112,213,177,110, 81,208,189,114,160, 49,115,175,175,179,250,
+224,130,137,211,196,105,226, 52,113,154, 56, 77,156, 38,206,127, 28,231,255, 42, 94, 17, 89,255, 31, 48, 45,125, 53,113,154, 56,
+ 77,156, 38, 78, 19,167,137,211,196,249, 79, 16, 89,245, 95, 0, 76, 83,135, 38,152, 96,194, 63, 24,145,145,145, 70,109, 42,250,
+222,231, 59, 66, 45, 44,108,151,149,151,150, 68,236, 95,251,254,209,234,239,199,140, 25,195,154, 74,209, 4, 19, 76,192,235, 56,
+195,183,104,209,180, 45,205,114,221, 9,161,121,132, 38, 26,170, 84,113, 32,165,168,168, 78,216, 1,119,119,119, 27, 1,141, 97,
+ 20, 33,230, 20,197,177, 28,143,190,254,236,217,139,132, 70, 36, 76,100,107,107, 59, 83, 40, 20,246, 87,171,213, 77,105,154,126,
+161, 82,169, 46,200,229,242, 31,240,106,224,194,255, 24, 90,183,110, 61,238,202,149, 43, 54, 61,122,244, 80, 73,165, 82,173, 66,
+161,224,159, 61,123, 86, 60,100,200,144,226,167, 79,159,190,214,138, 68, 55, 55,183,190, 59,118,236,104, 49,104,208, 32,180,106,
+213,170, 98,236,216,177,194,224,224, 96,225,244,233,211,159,101,101,101, 93,106, 36, 93, 91,138,162,126,165, 40,138,199,113,220,
+ 36,188, 12,221,240, 87,131,166,105,122, 6, 69, 81, 35, 8, 33, 94, 20, 69,165, 16, 66,142,114, 28,167, 47,112,171, 62,140, 2,
+240, 22, 77,211, 29, 0,128,227,184,104, 0,167, 1,227, 87,222,253,127,114,154,153,153,181, 7, 0,185, 92, 30,243, 87,113, 82,
+ 20,213, 30, 0, 8, 33,175,203, 57, 85, 42,149,126, 0, 0, 10,133,226, 39, 24,177, 29, 84,125,144,173, 62,164,195,151,143, 0,
+ 0,209,203,125, 0, 0,141, 57,166,254,245,136,106,204,127, 53,196,215, 24,142, 6,240,214,132, 9, 19, 86,255,246,219,111,203,
+ 1, 28,255,119,220,248, 46, 46,238, 63,172,251,110,187,219,167, 51,167, 69,160,114, 71, 8,253, 15, 36, 48, 64,196,227,189,173,
+102,217, 63, 18,128,255, 99,239,186,227,162,184,186,246, 51, 51, 59,219,119, 97,119,169, 75, 17, 5, 5, 17, 80,192,130, 61,162,
+ 38, 26,187, 70, 44, 81,177,196, 22,163, 38, 70,141, 26, 53, 26,107,140,137, 61,182,216,123,141,130,189,247,138,198,138,157,222,
+251,194, 46,219,103,190, 63, 96,121, 81, 41,139,154,188,201,251,113,126,191,113,156, 97,230,217,123,239,220,242,220,115,207, 61,
+103, 47, 0,142, 66,161,232,207,227,241, 90,235,245,122, 37,135,195, 73,209,235,245, 23,243,242,242,118,162,130, 8, 8, 86,151,
+235, 99,200, 13, 26, 56, 19,204,127,226,188,177, 36,116, 92, 17, 82,137,122,200,249, 7,116,163, 36,128,241,197,121,221,128,242,
+221,121, 84,212,249,124,237,226,226,210, 83,165, 82,105, 40,138, 98, 81,180,235,185,232,159,162,191, 19, 12,195,164,103,103,103,
+ 15,170, 12, 75, 92, 3,117,121, 98, 98,171,217,136, 66,147,142, 29,173, 78, 64,180,196, 29,205, 89, 96, 16, 11,212, 34, 41,210,
+129, 97,152, 20, 0,103, 73, 19, 34, 10,146,241,252, 31, 58,184,123, 20,151,107,205,226,107, 26,128, 19,128,123, 0,190, 6, 80,
+ 80,205,127,254, 54,121,211, 24,254, 8,128,148, 18,162, 85,202,221,125,155, 46, 93,186, 92,240,244,116,243,235,221,163,215,252,
+ 81, 35, 71, 19, 20, 69,226,193,195,135,156,207, 7, 13,249, 68, 46,151,187, 74,116,186,122, 32, 8, 70, 35, 16, 60, 80,169,242,
+146,246,238,220, 46,245,173, 91,215,108, 54, 51, 88,179,118,245,167,251,254, 56, 48,205, 74,178,229,227,236,236,188,117,202,148,
+ 41,206,221,186,117,163,156,157,157, 17, 27, 27, 43,219,181,107, 87,221, 21, 43, 86,244,201,201,201, 25, 4,224,233, 59,100,182,
+149,179,130,252, 68, 42, 36,218, 33,223,140,124, 35,206,164, 22,226, 36,128, 75,239, 90,122, 26,141,102,172, 70,163, 9,105,220,
+184, 49,187, 97,195, 6, 98,240,224,193, 44, 65, 16, 68, 97, 97,225,102, 0,239, 68,180,196, 98,241,170, 14, 29, 58,120,123,123,
+123,191,124,241,226, 69,167, 61,123,246, 28, 13, 15, 15,247, 18,139,197,207, 0,248, 84, 17,110, 83, 86, 86, 86, 96, 97, 97, 33,
+220,220,220, 54, 0,104,248, 23, 84, 34,130,162,168,131,174,174,174,236,162, 69,139, 14, 5, 6, 6, 58,101,103,103,155, 38, 77,
+154,212,254,250,245,235,159,154,205,230,110, 85, 32, 91,114,130, 32,214, 58, 57, 57,217, 47, 92,184,240,121,163, 70,141,238,241,
+249,124,222,179,103,207, 68, 19, 38, 76,248,230,233,211,167,125, 88,150, 29, 9, 84,105,128,144, 19, 4,177,214,197,197,197,126,
+254,252,249,177,193,193,193, 15,184, 92, 46,247,217,179,103,226,239,190,251,238,235,232,232,232,119,194, 36, 73,114, 77, 72, 72,
+136,252,135, 31,126,120, 92,183,110,221,171, 20, 69,241, 18, 19, 19,201, 89,179,102,125,117,234,212,169, 48,134, 97, 70,189, 75,
+ 58, 29, 29, 29,229,179,102,205,122,220,172, 89,179,235, 92, 46,151,251,228,201, 19,114,202,148, 41, 95, 61,127,254,220,234,116,
+ 42, 20,138, 80,130, 32,214,165,166,166,114, 0, 64,169, 84, 54,177,177,177, 89, 81, 58,166,165,197, 21,133,209,104,204,215,106,
+181, 3,178,179,179,203,116,132, 59,120,234,242,174, 0,176,194, 96,185, 46, 58, 87,118, 13,172,137,176, 38,211, 65,206, 69,126,
+241,126, 81, 15,237, 1, 0,253,139, 67,133,255,162, 6, 56, 28, 14, 19,228,252, 53,123, 55,181, 74, 46, 99,186,183,109,219,118,
+214,217,179,103, 87,183,105,211,230,187,109,219,182, 57, 38, 36, 36,252,116,233,210, 37,247,126,253,250, 13, 62,115,230,204,130,
+204,204,204,125, 31,170,242,243,184,124, 62, 65, 18, 16, 10, 68, 54,214, 60, 79,147,100,151,171,221,187, 15, 95,255,228, 73,240,
+138,232,104, 79,181, 82, 25, 50,110,220, 56,167, 94,189,122,145,238,238,238,120,254,252,185,221,182,109,219,234,173, 95,191,190,
+103,110,110,238,120, 0,113,239, 67,178,212,185,168,175,211, 35,152,101, 33, 43,105,176, 4,114,249, 6,220, 97, 31,227,254, 63,
+128,108,205,220,180,105,211, 15,207,159, 63,199,130, 5, 11, 0, 96,101, 21,223,159,208,189,123,247,206, 7, 14, 28, 16,238,221,
+187, 87,216,184,113, 99, 56, 59, 59,163,120, 50, 85,226,152,218,211,211,211,186, 50, 99,240,203,210,163, 67, 27, 62,200, 62,134,
+ 85,189, 82, 23, 8,221, 96,106,222,221,187,103,151,193,193,176,117, 16, 65, 32,225, 32, 55, 75, 21,240,228, 78, 66,135,115,123,
+158,255,244, 60, 42, 99,161, 58, 30, 51, 81,190, 79,190,255,138,216,217,217,109,120,245,234, 85,168, 88, 44,126,237,254,203,151,
+ 47,131,188,189,189,243, 0,124, 91, 85,226,230,224,224,176,131, 97, 24, 93, 86, 86,214, 48, 0,144, 74,165,219,197, 98,177, 60,
+ 37, 37,101,218, 95, 53,145,177,200,155, 92,228, 95,174,209, 42,177,215, 42, 43,214, 33, 65,154,153, 22,163, 70,142, 38,250,246,
+239,151,250,252,229, 43,134, 67,243,250, 31, 63,113, 66,228,231,231, 71,234, 86,174,132, 41, 35, 3,198,111,190,105,126,250,244,
+105, 99, 88,255,129,133, 52, 69,108,242,242,172, 37,218,189,115,151,243,129,253,251, 90, 0,168,140,104,241,156,157,157,183,158,
+ 63,127,222,213,211,211, 19,185,185,185,136,141,141,133, 90,173, 70,159, 62,125,232, 22, 45, 90,184,246,238,221,123,107, 94, 94,
+ 94,203, 42,104,182,156,234,184,113, 34, 71, 14,233,229,243,233, 39, 45,196,174,238,181,193,166,106,145,240, 34,186,113,228,249,
+235,227, 54,237, 63,250,244,121, 30,219, 5,101,199, 70,170, 80, 50, 51, 51, 39,247,236,217,115,127,104,104,168, 3,159,207,135,
+139,139, 11,209,173, 91,183,244,228,228,228,217,239,204, 90,138, 67,216,144, 36,105, 46,125, 46, 35, 60,144, 53,226, 38,151,203,
+ 33,151,203, 1,192,245,125,103,158, 50,153,108,165, 84, 42,237,173, 82,169, 10, 73,146,100, 9,130, 96,245,122,189, 80, 46,151,
+255,249, 56,250,169,139, 78,167,171,179,120,233,250,101,109, 91, 5,218,156, 58,117, 10,189,122,245, 98, 79,158, 60, 57,210,218,
+ 56,117, 4, 65,172,237,217,179,167,102,198,140, 25,218,231, 47, 99, 93, 31, 63,125, 73,136, 5, 60,198,222,222,158,190,121,243,
+ 38,103,201,146, 37,130, 89,179,102,173,101, 89,182,119, 21,202,115,109,191,126,253, 12, 19, 39, 78, 76,121,242,252,149,227,253,
+199,207, 89,137,128, 54,217,219,219, 81,215,175, 95,103,222, 5,147, 36,201, 53,147, 39, 79, 86,141, 28, 57, 50, 39, 43, 59,207,
+ 57, 71, 85,192,242,105,202,232,236,236,204, 57,116,232,144,110,199,142, 29,228,240,225,195,215, 48, 12, 19, 86,133,242, 93,211,
+173, 91,183,252, 41, 83,166,228, 62,123, 25,227,124,255,209, 83,136,248,180,209,201,201,145,186,117,235,150, 97,241,226,197,228,
+220,185,115,173, 74,167, 88, 44,222,178,103,207, 30,206,161, 67, 69,125,223,181,107,215, 72, 47, 47, 47, 81,233,103, 10,181, 58,
+144, 4,144,153,153, 41,106,214,172,217, 22, 0,111, 57,247, 13,158, 29,141,193, 83,129,177, 99,199,166, 84,181,178, 4, 43,199,
+ 85,250,140,121,181, 47,187, 68, 51,180, 7,135,195, 97,134, 15, 31,158,250,230,223,181, 90, 45, 1,160, 27,126,178,158,108,117,
+234,212,233,251, 35, 71,142,212,222,182,109,219,175, 59,118,236,208, 3,128, 64, 32,176,223,181,107,215,130, 62,125,250,160, 79,
+159, 62, 51,246,237,219,247,193,136,150,153, 53, 27, 0,128, 47,224,243,163,163,163, 9, 95, 95,223, 10, 61,238, 27, 24,230,246,
+250, 39, 79, 26,125,233,235,219, 56,155, 97,234,112, 63,253,180, 96,194,132, 9,153, 42,149, 10,177,177,177, 48, 24, 12, 24, 60,
+120, 48,213,166, 77, 27,151, 62,125,250, 44,207,207,207,255, 12,128,193,138, 58,185,216,213,213,117, 68, 94, 94, 94,129, 69,171,
+211,114,144,153,211, 58,200,196,111, 80,199,200,227, 82, 38,110,215,111, 24,226,228, 74, 66,237,235,137,203, 0,192,213, 32,163,
+138,147,129, 50,197,198, 13,158,102, 26,115, 29,220,132,109, 51,226, 10,127, 84,199, 87, 72,150, 62, 19,139,197, 61,212,106,245,
+190,226,193,217,167, 75,151, 46,184,126,253, 58, 0,180, 40, 38, 90,109, 73,146,252,156, 97,152,223, 1, 84, 20,202,109, 92,247,
+238,221, 63, 62,112,224,128, 20, 0,246,237,219, 7,163,209, 8, 47, 47, 47,112,185, 92,240,120, 60,208, 52, 93, 18, 29,196, 74,
+ 81, 58, 56,216,195,222,150,134, 92, 33,254,244,187,223,186,115,106,248,217, 32,221,252, 16,217,108, 46, 76,172, 14, 92, 59, 49,
+234,118,144, 33,248,147,182,100,196,154, 7,211, 34, 86, 61,110,164, 33,209, 21,113,208,253, 83, 70,118,146, 36,249,247,238,221,
+131,139,139,203,107,247, 41,138, 2,128,214,239, 0, 57,227,229,203,151,205,162,162,162, 16, 26, 26, 58,163,126,253,250, 29, 47,
+ 92,184,224,156,149,149,133,208,208,208,229,137,137,137,135,254,234, 60,149,230, 34,255, 43,170, 46,242, 13, 38,217,166,104, 22,
+ 76, 82, 20, 69,226,213,203, 88, 99,104,104,187,240,248,248,120, 73, 72, 72, 8, 73,211, 52,212,103,207, 66,123,235, 22, 36, 18,
+ 9,122,246,236, 73, 95,188,120,209,198, 70, 98,243, 69,204,171,152,124,138, 34,193,178,100,165, 54, 15,114,185,252,171,105,211,
+166, 57,123,123,123,195,100, 50,149,120, 52, 55,153, 76, 72, 72, 72,128, 68, 34,193,160, 65,131, 28, 69, 34,209, 87, 86,230,163,
+166,143,151,227,157,243, 71,215, 54,156, 48,170,147,216, 71,116, 10,226,132,241,144,236,251, 18,245,146,143, 99, 74,143, 16,241,
+201, 85, 51,130,107,187, 40,238,148, 82,177, 90, 45, 58,157,238,242,131, 7, 15,190,184,112,225, 2, 3, 0,231,206,157, 99, 31,
+ 63,126, 60,242,125,102,161, 12,195, 32, 55, 55, 23, 12,195, 80,197,215,150,243,127,181, 62,216,216,216,172,233,216,177, 99,191,
+184,184, 56,225,177, 99,199,236,226,227,227,237, 99, 98, 98, 28,124,124,124, 56, 11, 22, 44, 56,162,213, 25, 40,163,153,213,155,
+204,198,252,148,135, 15, 95,230,164,165,221,217,184,113, 99, 33, 65, 16, 61,173,252,141,207,148, 74,165,221,212,169, 83, 65,208,
+162, 38,117,235,213,247,166,104,161, 45, 73,243,108, 11, 11,181,230, 87,175, 94, 37, 76,157, 58,181, 86, 96, 96,160, 11,138,150,
+215,172,194,116,113,113,177,159, 56,113, 34, 56,124,105, 80,131,192,224,218, 60,190, 88, 74,209, 66,105, 72, 72, 72,155,151, 47,
+ 95, 38, 79,153, 50, 69,217,184,113,227, 42, 97, 54,110,220, 88, 62,124,248,112,147, 64, 40,109,230,233,233, 85,175,129,127,189,
+206, 62, 62, 62, 61, 56, 28,142, 41, 35, 35, 35,110,208,160, 65,202,174, 93,187, 58, 85, 5,211,209,209, 81, 62,101,202, 20,147,
+187,135, 87,135, 14, 31,127,210,148, 43,148,218,114,120, 98,153, 70,163, 53, 63,121,242, 36,110,250,244,233,202,160,160, 32, 71,
+107, 48, 53, 26, 13,109,111,111,143,128,128, 0,248,121,121, 33, 47, 47, 15, 7, 14, 28,192,166, 77,155,240,251,239,191, 99,231,
+206,157,104,212,242, 19, 72,165, 82, 36, 39, 39, 67,165, 82,209,127,119,133, 50,175,246,101, 87,232, 71,116, 27, 61,122,116,242,
+240,225,195, 83,133, 66, 33,243,230,161, 80, 40,204, 3, 6, 12, 72, 27,244,221,210,110,150,165,197, 74, 52, 89,247,142, 30, 61,
+250, 98,219,182,109,240,243,243, 67,135, 14, 29,120, 0,240,213, 87, 95,241,250,244,233,131, 61,123,246, 96,223,190,125,143,188,
+189,189,175, 0,232,110, 77, 58, 7, 13, 26,212, 50, 44, 44,236, 82, 88, 88,216,221,190,125,251,174, 27, 57,114,228,107, 35, 87,
+ 74,114,226,109,189, 94,143,192,224,198,162, 57, 27,110, 12,168, 12,239, 49,176,109, 93,116,244,166,133, 15, 31,198,205,240,243,
+147,121,196,196, 40, 54, 47, 94,108,111, 9,210,109, 52, 26,145,144,144, 0,185, 92,142, 1, 3, 6,216,243,249,252, 65, 86, 36,
+115, 73,247,238,221,135,196,199,199, 75,214,175, 95,175,188,123,247,174, 75, 74, 74,138,242,204,233, 19, 14,147,190,253, 74,106,
+ 43,225,241,146, 51, 88, 2, 0, 98,146, 33,142,126,133,150, 44, 11, 89,233,229,196,119, 18, 37,132, 66, 55,172,168,221, 82,246,
+116,226,158,160,190, 83, 34,131,237,229, 74,254,212, 10,222,104,176,104,209,162,189, 17, 17, 17,253, 91,182,108,185, 31,128,176,
+140,103, 4,141, 26, 53, 58,176,103,207,158, 33,173, 90,181,186, 12, 32,160,220, 89,164,155, 91,207, 63,254,248,195,206,114,109,
+111,111, 15,129, 64,240, 22,201,226,114,185, 32, 73,178,202,217,155,183,171, 63, 71, 81, 79,135, 7, 57, 71,177,103,209, 61, 44,
+250,244, 9, 51,191,121,140,110,229,160,104,156,220,115, 15,233,184,135, 78, 95,214, 70,255,233,129,237, 69,102,204,253, 39, 13,
+224, 25, 25, 25,159,183,110,221,122,111,167, 78,157,116, 81, 81, 81,200,200,200,128,171,107,201, 92, 59,245, 29, 32, 21, 34,145,
+ 8,238,238,238,240,246,246,238,127,241,226, 69,103,163,209,136,152,152, 24,164,167,167,223,249, 59,242, 84,154,139,252,203,228,
+ 77, 67,248, 35,111, 17,173,226,216, 66,231, 1,128, 37, 8,245,189, 7, 15,104,138,199, 27,184,125,199, 14, 62,151,203, 69, 92,
+ 92, 28, 30, 61,122, 4,205,153, 51, 40,188,122, 21,105,105,105, 40, 40, 40,128,147,147, 19,214,110,216, 32,214,155,217,161, 79,
+158, 62,165, 88,146, 45,109,111, 80,230, 22, 79, 62,159,223,190, 87,175, 94,229, 18,178,228,228,100,116,234,212,137,166, 40,170,
+172, 93, 13,111, 98, 18, 46, 14, 68,196,153,253,115,148, 74,222, 35,224,249, 4, 32,255, 14,192,234, 0,147, 30, 72,186, 15, 28,
+153, 13,143,130,104,226,196,156,112,103, 87, 17, 39,162, 12,166, 92,217, 86, 84, 47, 95, 95,223,223, 7, 14, 28, 72, 2, 64,219,
+182,109, 9, 95, 95,223,117, 0,188, 42,120,231,116, 37,131,228,245,156,156, 28,244,233,211,199,174,118,237,218,167,251,244,233,
+ 99,103,185,255,174,152, 22,109,178,159,159, 95,150, 64, 32,216, 9, 88,213,193,150, 96,202,100,178,149,157, 58,117,234,189, 99,
+199, 14, 46, 0,156, 63,127, 30, 17, 17, 17,120,248,240, 33,158, 61,123,198, 4, 7, 7, 59, 44,253,125,239,154,149,171,183, 44,
+233,209, 34,208,165, 77,147,224,122,146,130,156, 2, 39, 39,167, 22, 44,203,122, 89,153,206, 78,179,103,207,126,244,248, 69,156,
+ 45,201,161, 57, 92,154,195,183,177, 17, 59,201,165, 98, 55,133, 72,224,202, 39, 9,137, 70,163, 73,221,185,115, 39, 3,160,147,
+181,152,115,230,204,121,245,248,121,156,140, 32, 57, 28,154, 67,115, 37, 18,145,236,211, 14,161,141, 1,128, 11,150,171, 82,169,
+210, 54,109,218,100,168, 10,230, 15, 63,252,240, 32, 59,183, 64,206,161,105,154,195,161, 74,202, 82, 44, 20, 58,136,248,124,158,
+ 78,167, 75, 90,182,108, 89, 97, 85, 48,103,207,158,253,232,201,139,120, 5, 73, 16, 20, 65,144, 28, 27,169,216,206,206, 86,228,
+224, 32, 17,218,139, 56, 20, 79,165, 82, 37,109,221,186,213, 42, 76,131,193,192, 77, 75, 75,195,227,199,143,225,222,184, 49, 78,
+157, 58,133, 26, 53,106,160, 79,159, 62,232,215,175, 31,132, 66, 33,218, 54,171,143,169, 83,167,226,197,139, 23, 48, 24, 12,252,
+178, 48, 45,118, 82,111,138,139,139, 75, 84,101,149,231,141,119, 95, 75,103,144, 51,216, 21,250, 17,221, 74, 19,172,242,240, 21,
+ 10,133,185, 44,109,215,155,152,157, 58,117,250,254,204,153, 51,181,183,110,221,218,109,208,160, 65,151,183,110,221,138,166, 77,
+155,226,241,227,199,168, 85,171, 22, 54,111,222,140,126,253,250, 93, 94,190,124,121,183,168,168,168, 64, 79, 79,207,105,149, 97,
+246,237,219,119, 76, 80, 80,208,217,212,212,212,102,217,217,217, 1, 7, 14, 28, 24,218,179,103,207, 87,253,251,247,111, 87, 66,
+ 24,141,198, 29, 71, 14,239, 71,231,110,189, 80,215, 63, 96,205,224,105,219,234, 87,210, 54,217,135,192,186, 77, 41, 41, 25, 59,
+180, 90, 77, 31,154, 22,137,110,220, 80,236, 91,189,218,190,116,100,129,164,164, 36,116,237,218,149,230,114,185,173, 42, 73,231,
+162, 30, 61,122,244, 57,112,224,128,220,162,213,185,122,245, 42,238,223,191,143,216,216, 88,228,230,230,162,221,200, 2,140, 94,
+ 80,132, 61,122, 1,139, 79,190, 98,197,239,216,135,148,136,176, 6,156,237,108, 56, 87,134, 46,171,251,213,136, 53,126, 28,137,
+130,198,246,239,158, 33, 51, 70,183,175, 28, 76,162, 89,179,102,219,194,194,194, 8,189, 94, 15,189, 94,175, 7, 80,166, 87, 95,
+ 87, 87, 87, 65,131, 6, 13, 48,114,228, 72,210,198,198,102,121,121,233, 84,171,213,186,163, 71,143, 98,208,160, 65, 24, 63,126,
+ 60,234,212,169, 3,185, 92, 14,154,166,177,101,219,110,251,126, 67, 71,249, 52,108,217, 58,208,175, 97,211, 6,249, 58,170, 49,
+ 45,148, 15, 47, 71, 27, 82,102,222, 11, 28,163,240, 32,230, 26, 86,116, 75,100,110,110,214, 20, 76,250,252,231,232, 39, 23,210,
+ 30, 78, 11, 91,247,128,189,214, 60,115,219,215,241, 72, 51, 62, 70,171, 62, 30,240, 12,146,127, 35,118,135,239,187,150,167,149,
+ 82, 37,204,250,245,235,183,188,121,243, 38,191,117,235,214,136,139,139, 3, 77,151,204,167,204,239,147,206,217,179,103,243,181,
+ 90, 45,254,252,243, 79,132,135,135, 39, 25, 12,134,111,222, 39,157, 85,209,104, 89,184,200,191, 76,214,189,113,164,148,167,209,
+154, 13, 0, 70, 6, 17, 3,195,135,106, 34, 35, 35, 69, 60, 30, 15,113,113,113, 72, 73, 73,193,150, 77,155,204,109, 29, 29,243,
+ 59,184,186,170,182,108,218,196,234,245,122,176, 44, 11, 95, 95, 95,244,238,221, 91,248, 89,159,254,233,132,170,112,183, 21,203,
+ 60, 74,203,250,250,208,161, 67,223,250,251,164, 73,147, 96, 99, 99, 3,130, 32,156,173,200, 92,216,184,217, 61,220,228,158,178,
+ 52, 54,117, 75, 54, 40, 1,192,145, 2, 28, 27, 64, 96, 11,240,165, 0, 79, 4, 93,212,217,108,146,237, 16,219,171,213, 48, 87,
+ 0, 85, 89,234,129,139,139,203,140,179,103,207, 58, 68, 69, 69,177, 42,149, 10, 41, 41, 41,236,252,249,243, 29, 92, 92, 92,102,
+188,235, 23, 73, 78, 78,158,211,185,115,231,180,240,240,112,219,227,199,143,187,135,135,135,219,118,238,220, 57, 45, 57, 57,121,
+206,251,124,105, 46,151, 75, 61,124,248, 80, 49,119,238,220,126, 0,110,251,251,251,103,185,186,186,222, 70,145,209,100,133, 34,
+149, 74, 75, 72,150, 69,187,198,225,112, 64,211, 52, 92, 92, 92,244,217,217,217,230, 86, 13,189,132,190,182,164,209,133,207, 21,
+ 42,132, 2, 55,169,141,109, 72, 86, 86,214, 61,130, 32, 94, 90,185,196, 23,212,164, 73, 19,218,204,210,204, 15, 12,241,165, 0,
+ 0, 32, 0, 73, 68, 65, 84,232,129,109, 93,190, 26, 18,234,248,219,220,225, 53,150,205, 25,225,186,104,214, 23,190,115, 38, 15,
+ 8, 37, 25, 70, 91,171, 86, 45,103,139, 65,187, 21,234,243,224, 70,141, 26,113, 24,208,120,252, 52, 54, 45, 46, 49, 41,255,227,
+ 54,205, 74, 52,151,126, 65,193, 29, 28, 28, 28, 90,251,250,250, 54, 34, 8,194,170, 45,201, 66,161, 48,168,110,221,186, 28,146,
+162, 9, 59,185,212, 93, 42, 17, 58,149, 44,161,200,100,205, 21, 14, 14, 97, 36,203,230, 41,149, 74, 71,161, 80, 24, 84,133,188,
+115, 24,112,225,228,168,176,117,176,151, 73, 58,132,182,168,211,172,121, 51,159,250, 33, 77,155,249, 55,108,244, 25, 97, 50,169,
+188,188,188, 28, 45, 70,242,149,104, 90, 5, 59,118,236,192,220,185,115,209,192,195, 3,174,174,174,112,116,116,196,213,171, 87,
+113,243,230, 77,200,229,114,164,167,167, 99,241,226,197, 56,120,240, 32, 12, 6,131,180,170,245,201, 26,178, 85,145,152, 76, 38,
+242, 77,130, 85, 30,190, 80, 40,100, 44, 70,242,229,201,209,163, 71,183, 89, 52, 89, 95,127,253,117,203,165, 75,151, 94,142,142,
+142,134, 68, 34,193,205,155, 55, 49,116,232,208,203,203,151, 47,111, 57,106,212, 40,108,218,180, 9,175, 94,189,218, 80, 17, 94,
+223,190,125,103,125,241,197, 23,203, 46, 92,184, 64, 58, 57, 57, 65, 46,151,163, 71,143, 30,216,176, 97, 3,199,100, 50,109, 12,
+ 11, 11,187, 27, 22, 22,118,215,156,112,242,251,189,191,207,191,250,224,222, 93,140, 25, 55,145,167, 55, 25,167, 88,145,125,182,
+ 80, 34,201, 55,181,110,157,189,199,104,212,244,229,114, 69,182,119,239, 42, 34, 54,110, 44, 33, 91, 83,167, 78,133,173,173, 45,
+ 80,100,192,140, 10,180, 58, 35, 14, 30, 60, 88,210, 31,218,217,217,129,199,227,129,203,229,130,166,105, 80, 20,133,211,107,196,
+ 88, 61,181,136, 95,172,158, 74,224,228, 74, 66,253, 62,223, 78,228,138, 0,185, 19,239,238,151,155,253, 3, 3,218,217,225,234,
+174, 84,204,239, 28,149,120,115, 79,198, 4,109, 58,126, 41,231,181,134,147, 38, 77,242, 75, 79, 79,199,173, 91,183,112,235,214,
+173,242, 52, 64,218,195,135, 15,255, 84, 80, 80, 0, 79, 79, 79,116,239,222,189, 53,128,198,229,180, 27, 52,106,212, 8, 93,187,
+118, 69,104,104, 40, 26, 52,104, 0,189,193, 68,135, 13, 28, 81,247,225,171, 12,215,249,139,231,139,206,158, 59, 64, 94,190,124,
+129,218,182,255,164,109,179,208, 79,150,113,165,202,235, 16,218, 41,173,201,167,198,156,133, 32,229,167, 88,119,102, 28,185,226,
+124,184,100, 75,196, 10, 47,169, 84, 74,220,185,117,215,184,101,213,158,248, 0,113,247,244,235,187,178,160, 33, 82,209,110,136,
+ 39,201, 0,189,255, 41, 35,187, 64, 32, 88,122,225,194, 5,103,131,193,128, 7, 15, 30, 96,252,248,241,218,247,132, 44, 81,128,
+184,187,187,227,252,249,243, 24, 48, 96,128, 54, 45, 45,237,218,223,149,167,210, 92,228,127, 69, 56,165, 24,100,137, 36, 36, 36,
+228,202,229,114,215,186,117,235,146,122,189,190,104, 73, 98,223, 62,243,239, 27, 55, 30,209,106,181,227, 0,112, 87,254,246,219,
+ 26, 87, 55,183,208,129,131, 6, 17, 70,163, 17,157, 59,119,230, 69, 70, 70,218,189, 76, 79,207,183, 98,192,121,237,247, 6, 15,
+ 30,140,165, 75,151, 2, 0,198,142, 29, 91,162, 90, 39,172, 48, 88,146,216,162, 83,135, 46,141,108, 18,196, 43,108, 12,205,141,
+ 5, 53, 95, 72,175,139, 11,132,141, 64,242, 56, 16, 80, 96, 12, 70,211,179,244,158,183, 95, 60,171,231, 39,204,206,170,213,222,
+255, 35,252,126,106,107, 39,141, 89,187,199,234, 14, 71, 36,106, 34,145, 72,112,251,246,237,236, 70,141, 26,229,178, 44,107, 59,
+103,206, 28,123,145, 72,212,228, 61,202, 62,230,233,211,167,173, 91,180,104,241, 21, 73,146,237, 25,134, 57,157,150,150,182, 18,
+ 64,140,149,239,143, 6,240, 3,128,146,153,165, 94,175, 7, 73,146, 96, 89, 22,125,251,246,197,212,169, 83,253,238,223,191,143,
+179,103,207, 42,218,183,111,127, 29, 64, 46,128, 97, 0,202,212,154,169, 84,170,194,155, 55,111, 10,207,158, 61, 11,134, 97,160,
+ 80, 40, 96, 99, 99, 3, 62,159,143, 30, 61,122, 72,166, 76,153,210,238,196,137, 19,233,170,154, 53, 40, 65, 74,146,154, 47,145,
+ 72,225,236,218,106, 84,255,207,163, 89,150, 61, 88,133,206,129, 39,228,152,180,132, 89, 71, 46,154,185,156, 20,113,185,132,128,
+203, 1,159,209,224,251,159,230, 17, 92,214,204, 65, 21,215,231,185, 92, 46, 87,202,135,158,226, 81, 70, 17, 1,246, 67, 52, 14,
+138,162,120, 2,110,249,246, 24, 52, 73,146, 36, 73,114, 1, 88, 29,180,143,207,231,115,165,124,182, 92, 76, 33, 69, 80, 4, 65,
+240, 80,206, 78,180, 32,103,176, 22, 45, 18,111,220, 75, 93,105, 82,220,170, 85, 43, 28, 57,123, 27,251, 34, 78, 35, 51,238, 30,
+166,127,247, 53, 26, 55,110,140,200,200,200, 10,211,100,177,209, 42, 79,187,236,226,226, 18,149,156,156,220,176,188,119, 43, 90,
+ 50, 44, 71, 75,245, 54,254, 76, 91, 4,207,142, 70, 37, 54, 90,221, 91,181,106, 53,102,199,142, 29,250,142, 29, 59,242,250,246,
+237,139,128,128,128,150, 67,134, 12, 1, 0,180,111,223, 30, 75,151, 46,109, 57,100,200, 16,236,222,189, 27, 7, 14, 28,208,181,
+105,211,230,187,243,231,207, 39,161,104, 71,231, 91,194, 48, 76,215,181,107,215,190,169, 41,132,201,100,130,209,104, 84,154, 76,
+ 38,101,113, 95,132,101,203,150,103,158, 60, 17,137,239,166,205,134,163,131,115,144,149,117,136, 24, 60,113, 98,230,230,197,139,
+177,120,247,110, 76,172, 85, 75,180,245,209, 35,156,212,106,177,231,236,217,204,226,223,169,212, 54, 83,173, 86, 23, 30, 61,122,
+212,102,207,158, 61,144,201,100,168, 83,167, 14, 20, 10, 5,104,154, 6, 73, 9, 65,113,229,168,235,223, 4,192, 77, 0, 64, 45,
+ 23,168,125, 61,113,153, 32,144,203,146, 85,183, 41,226,215, 64, 77,123, 55,193,133, 49,155, 2,100, 54,142, 92, 28, 95, 25,143,
+ 19, 43, 18, 14,106, 51,241, 43, 76,120,130,242,109,190, 26,121,122,122, 34, 61, 61, 29, 71,143, 30, 85, 3,229, 18, 50, 48, 12,
+243,211,111,191,253, 54,105,218,180,105,124, 95, 95, 95, 0, 8, 2,112,171,172,103,197, 98, 49, 92, 93, 93, 75,136,101,223,240,
+ 81, 94, 35, 39,140, 18,246,252, 36, 20, 28,142, 61,114,213, 70,100,229, 27, 33,183,151,224,187, 9, 97,130,211,141, 92, 27,175,
+ 93,190,253,112, 97, 33, 26, 3,111,247, 7, 4,129, 91, 55,238, 93,174, 47,240, 5, 8, 18, 72, 32,207,129, 0,129, 2,194, 8,
+130,162, 88,179,217,140,248,248,120,176, 44,139, 1, 61,135, 38,140,152,127,192,177,229, 0, 21,220,235,186,128, 96,241,209, 63,
+133, 8,216,217,217, 5,101,101,101, 33, 38, 38, 6,225,225,225, 73,153,153,153,167,212,106,245,208,228,228,100, 0,200,126, 7,
+200, 18, 50, 31, 20, 20,132, 38, 77,154,160, 79,159, 62, 2,141, 70, 19,230,229,229,229,154,145,145,209,252,175,204,207,155, 92,
+228,127,138,104,149,217,208,140,198,186,186, 53,107,160, 62,125, 26,188,147, 39,177,199,197,165, 64,171,213,126, 11, 32,161,184,
+225,127,189,105,243,230, 43,221,174, 93,179,209, 71, 71,195,235,254,125,208, 50, 89, 80, 85, 19,176,113,227, 70,168, 84, 42,228,
+229,229, 1, 0, 86,172, 88, 1,149, 74, 5,147,149, 1,103, 57, 92,180,116,118,172,133, 84, 60, 3,195, 33, 37,177,117, 53, 77,
+ 37, 90,105,178,107,188,147, 58,143,116, 69,116, 92,136,184, 48, 75,223,148,160,244,208,102,106,224,218,162, 14, 56,224,180,172,
+ 74, 26, 45,235,254, 28, 14, 39,251,233,211,167, 93,125,124,124, 34, 0,216,191,139, 61,192, 27,242, 60, 45, 45,109,220,187,188,
+ 72, 81,212, 15,175, 94,189,114,220,176, 97,195, 87,115,230,204, 97, 75, 19, 45,203,255, 57, 28, 14, 88,150,133,173,173, 45,104,
+154,118,186,122,245,170, 83, 72, 72,200, 42,134, 97,130,202,201, 39, 27, 16, 16,128, 87,175, 94,129,195,225,192,214,214, 22,140,
+201,128,217, 19, 70,193, 76,241, 57,147, 39, 79, 14,234,213,171,215,131, 13, 27, 54, 24,109,154,181,104,158,149,149,245,112,204,
+128,129, 15, 14, 29, 58,164, 47,118,241, 80,249, 20,159,101,239, 62,123,246,140,114,115,113,162, 88,147,134, 17,115, 1,193,189,
+101, 44, 79,226, 12, 1,135, 98,185, 4, 9,190, 64,104, 27,147,152,152,197, 48,204, 99,107, 48, 25,134,185,243,234,213, 43,161,
+147,163, 29, 71, 83,168, 47, 16,210, 44, 47,246,206,237,151, 53,131, 27,121, 1,128,246,206,205,243,252,186,245,132,177,105, 25,
+226, 90,181,106, 89,133, 89, 88, 88,120, 55, 41, 41,137,114,114,114,226,196, 37, 36, 30,150, 73,196, 14, 54, 50, 89, 83, 0, 48,
+228,231,221, 36,117,186, 12,138,230, 56,101,100,101,101, 23, 22, 22,190,178, 54,239, 47, 94,188,224, 40,149,142,212,241,147,103,
+ 34,156, 68,124, 71, 41,143, 99,195, 39, 8, 66, 68, 17, 42,174,137,201, 20,136, 68,142, 49,137,137,217, 44,203,150,171, 33, 92,
+152, 59,176,103,209,247,154,189,187, 20, 54,238,221,187,135, 99,151, 31, 67,204,234, 65,104,243,112,114,211,122, 12,152, 60,237,
+189,237,254, 42, 35, 91,239,164,205, 90, 91, 47,234, 13,124,164, 84, 98, 8, 63, 96,192,128,217,219,182,109, 43, 49, 64,121,252,
+248, 49,218,182,109,107, 89,230, 64,135, 14, 29, 16, 18, 18,130,199,143, 31,195,219,219, 27,103,207,158,229, 83, 20,197, 31, 56,
+112,224,252,237,219,183, 31,173, 84,239,191,110, 29,134, 14, 29, 90,150, 97,245, 11, 0, 90, 66,238, 91, 48,117,225, 22,251,236,
+172, 76,164,103,164,222,181,182, 28, 8,130,192,224,137, 19, 51,215,234,245,216,113,227, 6, 6,137,197,162,205,207,159,163,115,
+ 72, 8,234,183,109,155,105, 77, 95,103,209,234,104,181, 90,208, 52, 13, 27, 27, 27,216,217,217,129,203,229,130,162, 93,192,225,
+ 5,130,228,114, 17,220, 42, 16,139,191, 21,107,194, 63,197,114,130, 64, 46,159,135, 59, 92, 81,185,182, 58,132,184, 6,122,176,
+ 44, 84,154, 4,156,179, 16, 18, 91, 15,216,210, 82,250,228, 23,171,124,101, 54,142, 92, 28, 91, 30,135,147,171, 18,247,107, 83,
+ 49,189,184, 44,152, 10, 38, 18,245,101, 50, 25, 18, 18, 18, 16, 31, 31,255, 8, 21, 27,248,107, 30, 63,126,252,146,207,231,251,
+ 57, 56, 56, 0,128,103,121, 19,115,134, 97, 74,236,176,182,238,216,107, 31,212,218, 75,240,113, 75, 63,108,137,152,135, 47,195,
+150,131,166, 8,152,205, 6,252,186,180, 11,204,186, 2,132,117, 27, 65,124,212,222, 59,240,116,132,254, 11, 99, 97,206,250,183,
+ 38, 2, 28,204,253,185,223, 85, 25, 95, 66,214, 7, 67,200,236,237, 29,197, 92, 46, 23,118, 54, 74,253,180,145,223,164,176, 44,
+ 91,210,110,104,138,107, 36,243, 21,133, 89,169, 5, 66, 25, 93, 8,176,100,205,119,243,102,243,225, 37, 49, 49,113, 92,235,214,
+173,231,231,231,231,231,168,213,234, 1, 0,224,233,233,233, 65,146, 36, 31, 64, 69,171, 35, 30, 40,219, 45, 4,247,254,253,251,
+144, 74,165, 72, 74, 74, 42,173,124, 1,195, 48,255,152, 77, 0,255, 80, 9, 6,112, 7,128, 18, 64,103,148,114,239, 64, 22,171,
+234, 62,138,140,140,100, 35, 35, 35, 63, 42, 25,188, 88,150, 49,101,103,131,213, 21,149, 45, 77,211, 44,128,210, 59,154, 68, 50,
+153,140,160,221,220, 64,240,139, 76, 63,216, 15,184,245,213,104,180,206,181, 12, 99, 6, 5,194, 0,182,212,164, 69, 45, 32, 48,
+207,190, 29,198,241,102, 32,149, 39, 43, 61,210, 1, 38, 22,102, 48, 84, 21,147,195,170,213,106,152, 76, 38,121,237,218,181,143,
+152, 76, 38,121,241,224,198,254,183,190,168,217,108,126, 73, 81, 20,190,250,234, 43, 88,180, 63,122,189, 30,169,169,169,208,233,
+116,208,235,245,120,245,234, 21,242,242,242,160,215,235,241,240,225, 67,120,122,122,130,162, 40,101, 5,157, 57,203,178, 44,220,
+221,221, 81,179,102, 77, 80, 4,139,223, 23,205,194,247,227, 71,161,159, 39,131,141, 43,127, 69,155, 54,109,234,213,170, 85,171,
+ 25,135,195, 49, 59, 59, 59,115, 15, 28, 56,112,216,108, 54,247,128,245, 61,207,209,169, 83,167,214,244,247,247,119,148,217, 72,
+141,124, 30, 5,158, 81,205,242,117, 89, 44, 71,147, 9,119,119, 15, 19,132, 34,239, 65,131, 6,153,203,211, 66,148,133,249,237,
+183,223, 42,125,125,125,109,229, 50,169,154, 71, 83,233, 92,176,153,121,247,110, 93, 7, 0,158,131,163, 22, 2,145, 95,120,120,
+184,169, 42,152, 51,102,204,240,116,112,112,144,145, 96,243,205, 6,195,127,214,219,117,250, 44,130,166, 11,193,229, 53, 26, 59,
+118, 44, 81, 21,204, 73,147, 38,213,242,243,243,147,201,108,196, 5, 28,154, 74,225, 50, 76,138, 0, 76, 42,173, 55,228, 8, 28,
+236, 53, 16, 73,130, 7, 13, 26, 84, 46,166, 69,155, 53,101,202,148,132, 55,136, 55,178,179,179,161, 77,125, 0,110, 82, 52, 2,
+ 37, 52, 26, 59,200,193,231,243, 75,182,190,151, 87, 93,203,179,209, 42,139,108, 89,251,110,163, 31, 43, 88, 2, 92, 91, 47,234,
+ 77,191, 89,201,201,201, 80, 42,149, 21,182,167,237,219,183, 79, 11, 13, 13, 77,239,208,161,131,254,200,145, 35, 32, 8, 2,103,
+207,158, 69, 82, 82, 18, 58,116,232, 0,150,101, 45,187,218,112,247,238, 93,180,111,223, 94,223,186,117,235,164, 98,255, 90,149,
+202,208,161, 67, 97, 52, 26, 81, 80, 80,128,236,236,108, 68, 70, 70, 34, 48, 48,144, 21,137, 68,189, 40,247, 79,230,133,125, 49,
+173,121, 64,131, 32,172, 90,190, 88,207,227,208, 11,171,210, 94, 9,130, 64,248,183,223,102,230, 5, 7,103,111, 85,171, 53,131,
+109,108, 68,181, 19, 18, 20,183, 79,156,176, 55, 24, 12, 86, 97, 88,180, 58,110,110,110, 37, 36,139,203,229,130,195,115, 0, 37,
+174, 15,158, 93, 7,136,156,123,225,220, 29,190,206, 86,140,131, 82, 9,142,139,101,229,187,118, 16,185, 99, 94,243,190,202, 3,
+ 45,250, 41,207,136,106, 96, 67,241,120, 64,178, 28,226,192,144, 95,125,106, 59,212, 20,226,218,222, 84,156, 92,149,248,135, 54,
+ 21,179, 0, 60,175,172,157, 27, 12, 6,173,217,108, 6, 73,146,224,112, 56,165,109, 2,175,252,241,199, 31,184,125,251, 54, 80,
+202,109, 79,126,126,190,153,162, 40, 8, 4, 2, 0,144, 84,208,223,129,166,105,208, 52,141,243,215, 47,218,245,251,172, 11,113,
+245,207, 83,104, 17,216, 31, 89, 5, 6,164,229, 25,144,171, 1,252, 27, 79, 71, 64,251,131,184,247, 42, 31, 65, 13, 2, 40,138,
+ 39, 14, 47, 11, 79, 27,131, 4,117, 60,122,103, 61, 98,234,232, 19,133,199,174, 29,122,252,232,226,190,123, 15,119,253, 22,241,
+188,121,227,214,234, 98,101, 2, 10, 10, 10, 88,130, 32,216,111,134, 79,123,185,117,104,142,121,249,128,123, 12, 71, 39,120,241,
+ 55,118,245, 30, 14, 14, 14, 87,237,236,236,206, 22,147, 35, 15,169, 84,122, 69,169, 84, 70,163,104,163,199,161,148,148, 20, 95,
+181, 90,221, 2, 69,155,179,226,178,178,178,218, 22,107,158,226, 42,208,132,109, 80,169, 84, 95,155,205,230,110,197,199,167,102,
+179, 57,232,217,179,103,126, 65, 65, 65,143,188,188,188,238,122,121,121, 29,243,242,242, 58,236,229,229,117, 56, 52, 52,116,169,
+197,221,195, 95,188,108,248, 22, 23,249,151, 17, 45, 20,147,172,117,197,103,148, 16, 45, 0,231,223, 52, 64, 51,241,249, 15, 77,
+ 99,198, 64,118,248, 48,232,103,207, 48, 36, 60,220, 70, 36, 18, 45, 71,145,143,166, 22, 18,137,100,213,172, 89,179,164,246, 11,
+ 22,192,229,226, 69,196, 70, 70,194, 72,211,183,222, 37,117,133,133,133,224,112, 56, 37,154, 24,177, 88, 12,179,217,140,178, 84,
+190,111, 53, 64, 19,174, 37,165, 69,131,135,154, 96,192, 22, 28, 87,181,190,209,255,229,116,199, 72,149,167,247,115, 53,215,251,
+ 71,135,166,142,203, 61, 90,222, 80, 19,156, 2,158, 76,128,248,248, 4,152,193, 84,105,189, 89,171,213,230,169,213,106, 4, 5,
+ 5,217,221,190,125,187,118, 96, 96,160,162,248,254,205,247,252, 48,205, 92, 92, 92,246,186,186,186,198,184,184,184,236, 5,208,
+172, 10,239,110,184,116,233, 18, 40,138,194,172, 89,179,144,159,159, 15,131,193,128,172,172, 44,196,199,199, 67,175,215, 35, 49,
+ 49, 17, 79,158, 60,129, 94,175, 71,108,108, 44,116,186,202, 39, 36, 12,195,192,198,198, 6,218,194, 2,172,158,247, 61,102, 76,
+153,128,188, 23, 81, 72, 76, 78,131,204, 86,140,113,227,198, 81,114,185,156, 97, 24,166,166,217,108,110,207, 48,204, 26,107,190,
+ 83,169,250,118,217,221,221, 61, 96,209,162, 69,126,223,207, 91,195,181,225, 20,176,124,169,128,225, 73,249, 44,175, 94, 83, 12,
+157,190,156,187,108,201, 47, 79,175, 93,187,150, 4,235,156,119,146, 0, 46, 7, 7, 7,251, 36, 37, 37, 5,250,250,250,214,181,
+247,168,197,231, 43, 93,115,185,202, 26, 42, 86,167,189, 65,184,214,104,181,102,205,154, 7, 87,174, 92, 73,174, 10,166, 88, 44,
+174,183,101,203,150, 0, 39, 39,167, 0, 90, 40, 20,104,242,242,246,152, 52,234,189,148, 76, 46, 32,109,100,159, 30, 60,120, 48,
+106,255,254,253,169, 85,193,244,246,246,246,157, 55,111,158,127,253,250,245,253,157, 61,107,243,133,174,238, 89, 2, 55,143, 44,
+ 97,253, 64, 62,220,106,118, 92,181,106,213,221,107,215,174, 89,133, 73, 81,148,137, 36, 73,208, 52, 13,145, 72,132,227,199,143,
+ 99,204, 23,253,225,238,106,135,186,190,190,104,247,229,215,216,191,127,127,137, 13, 15, 69, 81,229,142,232,155, 23,140,139, 8,
+ 86, 18, 81, 88, 91, 47, 10,107,235, 69, 5, 43,137,168,114,201, 86,241,223,203,122,198,170,222,168,156,229, 70, 43,200,214,209,
+243,231,207,255, 52,120,240, 96, 94,167, 78,157,112,227,198, 13, 12, 29, 58,244,242,129, 3, 7, 0, 0, 55,110,220,192, 55,223,
+124,115,249,204,153, 51, 24, 53,106, 20,218,182,109,203,187,116,233,210, 42, 88,225,251,199,100, 50, 97,227,198,141, 48,153, 76,
+144, 72, 36, 80, 40, 20,232,210,165, 11, 30, 60,120, 48,106,211,166, 77,209, 20, 77,127,222,185,219,103, 56,114,248, 0,158, 60,
+124, 48,106,243,252,129, 85,118, 10, 76,146, 36, 58,133,135,103,102,250,251,103,111, 86,169, 52,195,228,114,145,111,106,170,226,
+220,222,189,246, 86, 16, 53,194,108, 54,151,144, 43, 11,233,176, 28, 28,158, 3, 56,226, 0,112,164,141,113,239, 57,215,200, 13,
+193, 29, 94, 99, 60,174,200,127, 22,205, 35,135,246,250,222, 19,189,190,247, 68,247,201,181,134,136,106,224,119,113, 13,140,238,
+ 52,190,102,168, 87, 99, 91,168,210, 13,136,252, 53, 54, 78,155,133, 5, 0,158, 88,211,206, 25,134,121,148,148,148, 4, 30,143,
+135, 26, 53,106,248, 0,176,216, 5,110, 24, 62,124,248,216, 31,127,252,113, 2,128, 31,139,239, 73, 66, 67, 67,253, 11, 10, 10,
+240,236,217, 51, 0,184, 93,129, 54,184,100,151, 97,182, 42,150, 95,203,165, 62, 2,235,141,132, 92,222, 0, 73,217,122, 36,103,
+235,241,251,234, 30,136,186, 52, 23,183, 79, 14, 66, 92,106, 42,132,206, 61, 97, 54,233, 2,172,152,212,187,252,249,231,159,196,
+165, 75,151, 8,134, 97, 96, 52, 26,217,124,149,138,189,115,249, 50, 10, 47, 92, 32,108,108,108,136,150, 77, 90, 23,108,158,123,
+228,230,193,149,151,111, 27, 52, 85,158,168,191,143,204,120,249,242,101,179,189,123,247,134, 2,152, 81,191,126,253,107,241,241,
+241,205, 47, 94,188, 88,215,205,205,109,249,187,130, 90,220, 66,196,198,198,190,118, 20,187,133,208, 23,147,134, 78,197,100,174,
+ 59,128,111,240, 30,187,236,171, 32,231,255,197,198,240, 71,240,198,110,195, 55,137, 86,105, 71, 97,240,146,203,165, 70,163, 33,
+241,212,169, 83, 6,146, 36, 33, 18,137, 48,120,232, 80,114,245,111,191,181,234,223,172,217,217, 17, 31,127,124,236,236,153, 51,
+193, 33, 33, 33, 96, 89, 22, 36, 73, 98,247,238,221,133, 90,109, 97,150,187,187,187,204,154, 78,163,116, 3, 82,169, 84, 37, 68,
+ 43, 47, 47, 15, 78, 78, 78, 86, 47, 29,170, 85, 56,125,230,120, 84, 14,107,254, 50,190,211,243, 37,134,133,169, 61, 66,114, 25,
+ 51, 39,207,108, 68, 94, 33,139,124, 45, 56, 55, 72, 69,200, 96,239,158,134, 87,237, 67,158, 92,136,190,154,165, 53,107,171,180,
+ 91, 34, 61, 61,253,251,176,176,176, 44,165, 82, 73,216,216,216,192,213,213,149,236,222,189,123,102, 66, 66,194,143,239,250, 69,
+236,236,236,250,133,134,134, 70, 36, 37, 37,245,190,112,225, 66,205,139, 23, 47,246, 14, 13, 13,141,176,179,179,235,103, 37,196,
+158,105,211,166,169,121, 60, 30,154, 54,109,138,252,252,124, 20,239,242,169,240,176,102,137,148,203,229, 98,237,162, 31, 48, 99,
+202, 4,100, 71,223,192,189,203,167,112, 62,149,192,244,121,191,128,203,229,190,147,175,175, 58, 14,162,250,245, 93,164,143,191,
+ 25,218, 55,121,234,148, 41,210,187,119,239,210, 99,199,127,195,198,166,100,131,215,105, 49,133,143,190, 39,255, 84, 59,160,243,
+167,237, 48,107,198,196,250,197, 78, 59, 43,148,122, 14,162,250, 1, 46,210, 71, 19, 71,244,127, 57,126,252,120,225,194,133, 11,
+181,205,154, 53, 43, 76, 75, 75, 19,138,229, 10, 95,142,173, 44, 32, 54, 37, 85,210,172, 89,179, 87, 95,126,249,101,110, 85, 49,
+167, 79,159, 46, 58,113,226, 4, 39, 44, 44,204,148,147,147, 35,161,133,194, 32,130, 47,104,146,145,147, 99,219, 59, 44,236,121,
+239,222,189, 53,197, 14, 75,173,198,156, 57,115,166,232,201,147, 39,156,102,205,154, 25, 83, 83, 83,165, 98, 59,251, 64, 74,166,
+104, 28,147,146,102,211, 36, 36,228,197,216,177, 99,213, 21,165,179, 52, 73,145, 74,165, 73, 45, 90,180,192,175,191,254,138,101,
+203,150,161, 99,199,142,120,240,240, 1, 58,143,157, 0,191,209,223,224,240,213,235, 72, 74, 74,194,156, 57,115, 16, 24, 24, 8,
+ 46,151,251,164,204,246, 56, 42,154,184,155, 10,226,110, 42, 8, 98, 84, 52, 97,185, 46, 87,179,245, 99, 30, 74, 63, 95,214,115,
+183,103,150,173,233, 10, 86, 18, 81, 21,217, 97, 85, 70,182,122,247,238, 61,198,226,194, 97,216,176, 97,151,151, 47, 95,222,114,
+216,176,162,137,118,211,166, 77, 49,119,238,220,150,211,167, 79,191, 60,111,222, 60,180,107,215, 14, 94, 94, 94,149,110,124, 49,
+155,205, 48,153, 76,232,223,191, 63, 76, 38, 19, 50, 50, 50,240,244,233, 83,172, 91,183, 14, 44,203, 10, 0, 64,233,226,214,136,
+199,227,225,207, 59,183, 52, 51,134,133,108,175,130, 38,139, 40, 61,137, 41, 40, 40, 64,239,209,163, 51, 19,235,212,201, 94,147,
+153,169,249, 66, 46, 23,213,138,139, 83, 72,245,122, 87, 84, 96,151, 72, 16, 4, 24,134, 41, 33, 86, 22,194,245,230, 81, 60, 80,
+ 90, 37, 6, 13,115,244,226,182,100, 0, 64,235,129, 46,232, 62,185,214, 16,165,183,104, 69,171, 1, 69, 74,239,253,115, 95,178,
+249,201,230,133, 48,226, 81, 21, 52,214, 55,110,220,184, 1,153, 76,134,176,176, 48, 62, 73,146, 11, 44,243, 85, 20,249,206, 90,
+ 98,193,226,243,249,139, 7, 13, 26, 68,230,230,230,226,222,189,123, 0,112,166,188,126,137,101,217,146,188, 23,100, 19, 48, 51,
+ 60, 92,185,115, 28, 39, 47,238, 67, 76, 82, 6,226,210,181, 0,199, 22, 90,117, 34, 12,133, 73,208,231,222,129, 74, 39,178, 42,
+193, 92, 46, 55,163,126,253,250,108,227,198,141, 89,150,101,241,226,197, 11, 83,108, 92,156,233,214,210,165,236,253,145, 35, 9,
+233,211,167, 92,161, 80, 72,120,122,122, 66, 32, 16, 48, 2,129, 32,235,111, 28,188,255, 18,119, 11,127,129, 91,136, 15,169,213,
+ 98,241,239,148, 20,188,190,219,176,196,129,105, 89, 14, 75,193,218, 8,251,238, 91,181,218, 54,172,255, 64,117, 96, 96,160,220,
+213,213, 21, 4, 65,160, 71,207,158, 68,232,133, 11, 82,218,197, 5,118, 13, 27,150, 44, 71,156, 62,117, 10,199,143, 31, 87, 31,
+249,227,160,235,208, 47,190,232, 10, 96, 75, 5,137,225,240,249,252,146,223, 77, 73, 73, 1,159,207, 47,177,137, 80,169, 84,112,
+112,112, 64, 74, 74, 10,172, 92,153,219, 58,117,202,245, 41,233, 33,223,123,134, 72,105,226,152, 58, 21,102,150, 5, 77,152,129,
+ 66, 22, 70, 51,160, 51,178,104, 84,139, 82,156, 44, 52,201, 35,111, 28,120, 5, 96,107, 85, 74, 79,167,211,157,187,123,247,238,
+ 72,134, 97,246, 1, 32, 47, 92,184,192, 60,122,244,104, 12,172, 55, 92,127, 91,109, 47, 18, 77, 62,123,246,172, 98,242,228,201,
+ 57,145,145,145,121, 93,186,116,177, 93,183,110,157,162,109,219,182,147,179,178,178,118, 89,163, 8,140,143,143,223,146,144,144,
+ 48,166,113,227,198,200,206,206,134,193, 96, 64, 84, 84, 20,188,189,189,113,251,246,109,248,248,248,224,214,173, 91,168, 91,183,
+ 46,204,102, 51,180, 90, 45, 24,134, 49, 87,214,153,103,103,102, 0, 89,241, 72,190,113, 12, 79,239, 71,225,108, 50,129,149,187,
+ 34, 80,163,166,231, 59,249,169,241,113, 20,249, 43, 29,236, 78, 46,156, 61,211, 49,246,220,110, 28,216,184,146, 57,127,236,152,
+ 31, 79,138,145, 31,245,255,250, 51,189, 17, 30, 0,120,205, 67, 26,163,147,252,137, 89, 84, 19,169,103, 31, 85,236, 96,209,199,
+ 81,228,239,100,111,119,226,231, 5, 63, 74, 95, 28,223,140, 61,107,127,101,247,111,219, 25,168, 5, 66,252,253,253, 59,145, 36,
+ 41, 3,160, 45,182,243,178, 42,180, 77, 89,152,167, 35, 34,130,181, 64,200,161, 67,135, 58,137, 68, 34,103, 0, 70,141, 70,243,
+242,125, 48,207, 68, 70, 6, 91,210, 73, 16,132, 35, 0, 3,203,178, 47, 80,197, 16, 60,125,250,244,153,251,205, 55,223, 76, 49,
+155,205, 14,165,102,231,212,226,197,139, 57, 12,195, 80, 44,203, 26, 72,146, 52,156, 56,113,194,108, 50,153,146,181, 90,237,232,
+247,233, 69, 62,251,236, 51, 92,191,126,125, 54,138, 54, 97, 88,171,173,126,205, 78,171, 56,100,207, 59,227, 95,184,112, 97,206,
+231,159,127, 62,117,215,174, 93, 79,151, 47, 95,222,109,212,168, 81,216,189,123, 55,234,212,169,131, 63,255,252, 19,223,127,255,
+ 61, 0,180,156, 62,125,250,225, 13, 27, 54,120,197,198,198, 46,182, 66,163, 1,147,201,132,157, 59,119,162, 71,143, 30,112,112,
+112,128,139,139, 11, 8,130, 56,247,197, 23, 95,252, 6, 0, 20, 65,113, 1, 64,167,213,233,124,125, 27, 91,173,193,229,114,185,
+ 37,125, 93,106,106,106,201, 78,193, 79, 62,255, 60,243,247,133, 11,177,189,176, 16, 95,200,229,162, 68, 55, 55,229,225, 23, 47,
+ 70, 60, 44,234,156,217,138,180, 58,149,145, 44,107, 77, 26, 10, 83, 48,237,143,249, 49,206, 0, 58,182, 30,232,130,214, 3, 93,
+208,184,187, 35, 65, 82, 4,238,159,204,194,131,211,217,251,141, 42,156, 67,213,194,229, 60, 90,176, 96,193,225,143, 62,250,168,
+ 91,189,122,245, 48,124,248,240, 47, 55,110,220,200, 53, 26,141,227,241, 31, 55, 15,182, 36, 73,254,184,118,237,218, 17, 10,133,
+ 2,151, 46, 93,194,197,139, 23,207, 1,136, 47,175, 95, 2, 80,226, 51,171,134,187,143,246, 73,108,129, 40, 61,233, 10, 46, 95,
+250, 3,117, 2,191,134,208,185, 43, 20,190,243, 96,136, 94, 6,125,214, 73, 40,220,187, 32, 49,246, 5, 40, 14,255, 65,101, 70,
+ 40, 44,203, 62, 76, 76, 76,244,242,242,242, 34, 98, 98, 98, 76, 0, 88,179,217,204, 26, 90,181, 50,250, 45, 92, 72, 63,248,242,
+ 75,162,249,147, 39, 20, 75, 16, 76, 84, 84, 20, 0, 60,254,111,140,226, 22,119, 11, 15, 30, 60, 40,207,221, 66,149,164,126,253,
+250, 45, 47, 94,188,200,215,106,181, 56,127,254, 60,154, 52, 41,217,219,245, 95,245,126, 95,154,139,252,203,100, 68, 25,247,214,
+189,166,209,122,173, 98, 51, 4, 93,215,199,199,204, 37,177,169, 71,215,174,154,187,119,239,150,204,250,180, 55,111, 66,125,252,
+ 56,204,102, 51, 88,150,197,197, 11, 23, 48,104,224,192, 2,154, 34,126,175, 85,171, 38, 75,176,175,249,110,105, 95,198,236, 33,
+ 44, 44, 44,172,164,243, 73, 72, 72,128, 88, 44, 6,143,199, 3,195, 48, 48,153, 76,160, 40, 10,182,182,182, 48,153, 76,101,169,
+ 96,222,196, 52,154,179,213,189, 55,116, 30,144,226, 82, 96, 96, 71,202,106,193,131, 43, 44,105,156,206, 54, 4,186, 5,210,176,
+231,164,179,103, 22,127,156,204,232,178,122,227,237, 29, 93,149,109,249,247,105,208,160,193,111,131, 6, 13, 34, 1,160,125,251,
+246,100,131, 6, 13, 86,160,226, 80, 57, 21, 98, 10, 4, 2, 62, 0, 68, 68, 68,100, 63,125,250,180, 99, 68, 68, 68,118,233,251,
+ 86, 98,174, 91,180,104, 17, 68, 34, 17, 76, 38, 19,244,122,125,137,125, 86,233,179,193, 96,128,189,189, 61,142, 28, 57, 2,179,
+217,124,164,178,116,186,123,212, 4,225, 80, 27, 91, 34,206,226, 98, 38,247, 93, 72, 86, 9,102,109,103,113, 93,103,123,187, 83,
+ 63,207,159,227,144,243, 60, 10,137,137,137,236,137,227, 71,174,105,129,164,188,124,204,200, 85,163,110,161, 30,130, 38, 94,136,
+ 63,181,246, 59,118,122,107, 24, 81,246,174,193, 18, 76, 63,103,113, 93, 87, 7,187, 19,191,252, 60, 95,154,251, 60, 10, 41,169,
+169, 56,122, 36,226,174, 22,176, 44, 55, 14, 97, 24, 38,128, 97,152, 0, 0, 67, 42, 32, 47, 85,194,212,104, 52,245, 53, 26, 77,
+253, 15,137,201,178,108,125,150,101,173,198, 44,109, 19,181,100,201,146,232,148,148,148, 65,233,233,233, 29, 44, 71, 78, 78, 78,
+251,130,130,130, 54, 26,141,166, 85,225,146,154,182, 26,141,198,177,160,160, 64,169,213,106, 27, 1,136,170, 66,157, 47,145,210,
+ 94,167, 83, 82, 82,102,165,164,164, 16,149,165,147, 26, 29, 77,236,248,101,226, 31,107,215,174, 85,190, 39,254,107,233,204,204,
+204,220,183,107,215,174, 32, 79, 79, 79,175, 33, 67,134, 96,205,154, 53, 88,190,124,185, 14, 0, 54,108,216,160, 43,165,201,114,
+143,141,141,109, 92,206,178, 97,251, 82,218,146,173,159,124,242, 9,123,241,226, 69,244,232,209,163,196,145,232,250,245,235, 97,
+ 50,153, 84,237,218,181, 99, 0,160, 80,171, 81,177, 12, 11,189,161,220,245,247,183,202,147,199,227,125, 90,218, 95,160,197, 25,
+ 51,143,199, 3,203,178,168,219,178,101,102,110, 96, 96,246,198,188, 60,205,172,250,245,109, 70,248,250, 14,169, 7, 12, 44, 11,
+147, 32,136,215,180, 58,111, 30, 85,208,100,149, 78,103,122, 97, 50,134,255, 49, 63,230,184, 69,179, 37,144,112,160,205, 55,225,
+224,194,152, 12,109, 6,214,151, 71,126, 42,202,123,118,118,246,216,133, 11, 23,234,228,114, 57, 62,251,236, 51,204,155, 55,239,
+139,150, 45, 91,230, 57, 58, 58, 94,175, 83,167,206,253,190,125,251,166, 68, 69, 69,141, 13, 13, 13,197,179,103,207,240,203, 47,
+191,228,230,228,228, 12,168, 8,147, 32,136, 18, 77, 94,247,206,237,179, 87,175,248,149,105,247,209, 24,136,132, 54, 48,210,238,
+200, 46, 48, 34, 71,205, 66,207, 15, 1,143,203, 71,135,102,254,184,126, 98,179,198,172, 87,111,169,172,206, 23, 20, 20,236, 31,
+ 60,120,176,138,203,229, 66,175,215,179, 52, 77,131, 95,100,119,204,208, 29, 59, 26,154, 63,122,100, 50,179, 44, 67, 16, 4,190,
+253,246, 91,117, 78, 78,206,174,119,105, 71, 85,144,210,152, 31,202,221, 66,251, 55,198,159, 15,225, 22,226,175,200,251,191, 89,
+214,149,113,252, 71,163,101,217, 82,105, 57, 19, 4, 99, 54,155, 25,212,242,172, 37,141,141,137, 95,217,167, 79,216,176, 78,157,
+ 58,139, 58,119,238, 44,240,143, 46,154,141, 70, 68, 68,224,192,129, 3,154,147, 39, 79,170,248, 52,181,193,189,134,187,147,217,
+204,128, 32,152, 10,217,176, 84, 42, 29, 63,109,218, 52, 97, 94, 94, 30,150, 47, 95,206, 4, 5, 5,145, 98,177, 24, 6,131, 1,
+ 27, 54,108, 48,250,251,251,211, 36, 73, 34, 47, 47, 15, 36, 73, 62,177, 50,131,247,242,226,147, 58,252, 22,218,235, 64,227,175,
+134,218,249,133, 54,151,183,113,119,133,177, 33,139,228,132, 24, 60, 61,115, 50,231,225,137,165, 89,208,166,245, 66,229,225,129,
+202, 26, 8,126, 56,121,242,164,227,216,177, 99, 89,173, 86, 75,196,199,199,179,243,231,207,119, 28, 62,124,248, 15,201,201,201,
+253,222,241,163, 16,185,185,185, 32, 8,130, 41,238, 72, 44,179,254,170,172,203, 61,216,178,101,203,161,158, 61,123,118,111,215,
+174, 29,162,163,163, 75,150, 8, 75, 19, 45,203,238,195, 5, 11, 22,228, 2,152, 90, 25, 40, 77,211, 88,190,101, 31,114,115, 50,
+225,228,228, 2,129, 80,136,119,221, 97,201, 35,201, 89, 63,205,153,233,152,249,248, 58,241,224,218, 89,102,239,189,180,116,147,
+153, 45,219,227,127,126, 50, 91,204,254, 43,158,205,144,212,172,159,230,255,104,107, 89,214,220,117, 39, 69, 69,152,217,177,239,
+213, 68,254, 45,152,127,179,184,184,184, 32, 37, 37,133,112,113,113, 97,139,109,180,216, 10,136,214,235, 21,188,104,185,140,168,
+104,217,240, 93,241, 95,189,122, 53,191, 97,195,134, 19,159, 61,123,182,215,207,207,111, 20,128, 26, 58,157, 46,119,250,244,233,
+ 63,111,216,176, 97,152, 53,154, 44, 0,216,189,123,247,210,161, 67,135, 30,239,218,181,235,119, 12,195, 52, 40, 53,176,191,114,
+116,116, 44, 89,194,205, 72, 75,157, 50,114, 88,255, 41, 5, 5, 57, 86,251,185,147, 72, 36, 35,166, 79,159, 46, 80,171,213, 88,
+181,106, 21,227,239,239, 79, 90, 38, 69,219,182,109, 51,249,248,248,112,194,198,140,201, 92,146,154,138,185,151, 46,169,167, 4,
+ 4, 4,109,124,250,180, 17, 24,102,107,121, 90,157,178, 52, 89, 22,179,139,119,148,228, 98,178,181, 30, 64,199,230,125,156,113,
+104, 81, 12,114, 98,245, 63,195,132, 23,176, 34, 44, 80, 25,146,184,127,255,254, 14,105,105,105,135,102,206,156,105,219,168, 81,
+ 35, 4, 4, 4,208, 18,137, 36,196,226, 46, 38, 47, 47, 15,167, 79,159,198,154, 53,107,244, 15, 31, 62,236, 89,209,114,149,217,
+108, 78,247,241,241,177,148, 3, 75, 16, 68,150, 74, 71,216,238,169, 23, 34, 25, 50,114, 47,113,249,214, 85, 36, 27, 24,232,140,
+ 12,106,121, 6,163, 77,199, 37, 56,124,236,190, 57, 57,246,209, 35, 99, 97,206,239, 86,164,247,197,243,231,207, 15,206,153, 51,
+167,207,119,223,125, 39,204,204,204, 52,235,116, 58,102,223,190,125,212,144, 33, 67,204, 44,135,195,112, 57, 28,140, 31, 63,190,
+ 48, 55, 55,247, 15,224,111, 13, 48,253,151,184, 91,248, 11,220, 66,124, 48,109, 86,233,243,255,138,148,217, 66, 25,138,188,178,
+102,237,234, 79,119,239,220,229, 76, 81,164,243,139,151, 47,111,117,235,213, 59,233,212,169, 83, 10,174,173,109, 19, 0,140,126,
+212,168,107, 6, 93, 97,118,228,161, 67, 30,181,106,213, 12, 44, 14, 42,205, 50, 20,121,165,162, 31, 44, 40, 40, 80, 95,186,116,
+ 73, 51,117,234, 84, 34, 33, 33, 97,135,147,147, 83,223, 99,199,142, 73,122,245,234, 85, 24, 29, 29,189,223,217,217,185,123,104,
+104,168,116,226,196,137,186,130,130,130,170, 4, 30,125,196,102,228,212,187, 57,115,241,231, 55, 23,173,254, 24, 28,170, 5,116,
+ 52,192, 24,175,192,144,127, 10,192, 14, 84,193,223, 81,105, 17,139,197,129, 34,145, 8,119,239,222,205, 9, 9, 9,209,107,181,
+ 90,238,188,121,243,236,196, 98,113,224,187, 22, 60,203,178,108, 78, 78, 14, 24,134,225, 0, 32,138,207, 96,170,190, 23,191, 95,
+183,110,221, 14,237,217,179,231,147,206,157, 59,195,203,203, 11, 70,163, 17, 62, 62, 62,208,235,245,240,246,246,134, 78,167,195,
+236,217,179,145,151,151, 55, 1, 21,196, 60, 35, 8, 2, 38,147,169,196,216,214,213,205,163,200, 79,207,123,184,177, 16,211,164,
+215,147,200,141, 72,207,202,100,246,252,153,150,166, 49,152, 59, 60,207,208, 60,124,243, 57,141, 25,234,208, 33,227,146, 0, 64,
+199, 84, 28,113, 94,204,131,215,211, 35,235,145,150,158,137,221,119, 82,114,213, 6,166,227,211, 50, 48,171,148,206,127, 9,102,
+240,236,104,244, 30,103,253,179,239, 35,214, 18,170,242,228,110, 42,136,219,162,141, 44,214,110, 44,211, 71,214,123,226, 31,122,
+246,236,217, 33, 0,120,244,232, 81, 66,255,254,253,167,196,196,196,204, 1,112, 52, 54, 54,118,109, 85,128, 54,110,220,248, 12,
+192,208,138,158,217,181,120,232, 65, 0, 7,171,130,155,159,159,175,141,138,138,210, 78,156, 56,145, 72, 72, 72, 56,230,236,236,
+252,201,241,227,199, 69,189,122,245,210, 61,120,240,224,140,139,139, 75,235,246,237,219, 75,142,222,184,145,164,121,241, 34, 50,
+ 50, 38,198,205,200, 48,145, 21,181,207, 15, 76,178, 94, 35, 91, 7,231,198,252,116,232,167,152,246,140, 14,251,245, 57,184, 6,
+ 32,241, 61, 48, 47, 94,185,114,197,111,224,192,129,123,186,116,233,210,220,207,207, 15, 53,106,212,192,211,167, 79,145,145,145,
+129,123,247,238, 33, 34, 34, 34, 66,171,213, 86, 26, 80, 59, 59, 59,251,237,240, 68, 2,133,203,230, 85,179, 34,110, 93,110,226,
+211,170,243, 96, 97,128, 11,112,159,172, 26, 0, 0, 32, 0, 73, 68, 65, 84, 3,189,129, 69, 66,220, 11,204,158,241,187, 38, 37,
+238,217, 35,131,201,208, 19, 86,110,212, 41, 44, 44, 92,183,108,217, 50, 58, 50, 50,178,243,202,149, 43,165, 30, 30, 30, 20,151,
+203, 37, 1,176,183,111,223,102,199,141, 27,167,206,204,204, 60,162, 82,169,214,253,205, 99,244,197,151, 47, 95, 6, 83, 20,245,
+ 65,221, 45,188,135, 91,136,106,249,144,226,233,233,230, 87,219,195,101,148, 87, 13,183, 49,158, 30,238,225,101, 25,185,123,201,
+229, 82,207,154,174, 35,188,106,184,141,169,237,225, 50,202,211,211,205,207, 10,213,162,151,141,141,205, 49,165, 82, 25, 4, 0,
+182,182,182,221,101, 50,217, 67, 91, 91,219,238,197,179,192,238, 18,137,228,177,191,191,255,240,191, 81, 93, 89, 33,166,143,143,
+ 79,255,130,130,130, 47,125,124,124,250, 91,174, 95,188,120, 81,114,253, 46,152,238,238,238,237,110,223,190,221,111,241,226,197,
+159,213,169, 83,167,251,252,249,243, 63,251,227,143, 63,250,185,185,185, 53,122, 7, 76, 62,128,237, 52, 77,167,241,120,188,116,
+154,166,211, 44, 7,135,195, 73,163, 40, 42, 13,192,218,114,180,101,237, 75,205,114, 46, 59, 57, 57,197, 58, 57, 57,197, 58, 59,
+ 59,199, 58, 59, 59,199, 42,149,202,183, 14,123,123,251,203,214,150,167,175,179,164,101, 72, 13,233,149,250, 74,201,229,122, 78,
+ 98,223, 15,241,141,124,157, 37, 45,155,212,176,189, 82, 95, 41,189,244,255, 13, 51,200, 25, 44,187,198,151,101,215,248,178, 65,
+206, 96, 43,187,254,144,106,127,165, 82,201, 42,149,202, 89,127,213, 82, 66, 57,248,127,123,123,255,128,152, 94, 82,169,116, 87,
+141, 26, 53, 44,125, 93, 87, 27, 27,155,115, 18,137,164,107,113, 95,215, 85, 44, 22, 95,240,247,247, 31, 92, 25,166, 66,161,184,
+237,232,232,152, 90,124,164, 56, 57, 57,165, 56, 57, 57,165, 56, 58, 58, 38, 59, 58, 58, 38, 59, 56, 56, 36, 89, 14,153, 76,118,
+253, 29,243,238, 8,160, 41,128, 70, 0,108, 62, 96,121,122, 2, 24, 89,220, 7, 45, 4, 48, 28, 64,131, 15,240,141, 8, 90,168,
+ 24,205,151,185, 95,161, 37, 14,249,180,196, 33,159,111,235,118,165,130, 16, 60,214, 96,214, 85, 40, 20,243,108,108,108,254,144,
+ 74,165,151,164, 82,233, 33,123,123,251,249, 0,234,254,151,234,146, 4,192, 6, 20,249,103, 58,138,162,165,240, 67, 40,218, 84,
+224,241, 15,172,243,255,159,101,196,127,235,135,219, 87, 99, 86, 99, 86, 99, 86, 99, 86, 99, 86, 99,254, 11, 49,201,234,242,172,
+ 38, 90, 85, 36, 90,111, 30, 0, 42,240, 12, 95, 45,213, 82, 45,213, 82, 45,213,242,255, 88,152,234, 34,168,150, 42, 74,153, 75,
+203, 68, 5,172,180, 42,190,166,222,133,217,158,174,198,172,198,172,198,172,198,172,198,172,198,172,198,252,127,135, 89, 45, 31,
+ 80,170,213,170,213,152,213,152,213,152,213,152,213,152,213,152,213,152,255,235, 82,189,116, 88, 45,213, 82, 45,213, 82, 45,213,
+ 82, 45,213,242, 23,201,186, 82,132,235,181, 37,196,106,162, 85,117, 33, 1,124, 9,160, 55,128,218, 40,138,102,191, 15,192,111,
+120,183, 53,125, 27, 0, 83, 0,180, 64,209,238,156, 87, 0, 46,161,104,119, 78, 65,117,113,151, 45,246,246,246,211,104,154,150,
+ 1, 69,161, 77, 44,231,210,255, 55,155,205,185, 42,149,106,254, 95,148, 4, 10, 86,122, 80,182,164,181,116,218, 74,159,141, 70,
+227, 95,153,206,106,249,103,138,143, 66,161,216,158,157,157, 61, 0,165,130, 44, 87, 75,181,252, 47,136,131,131,195, 40,131,193,
+ 48,157,203,229,206,203,200,200, 88,253,255, 40,235,111,145,172,215,136, 86,100,100,228, 5, 0,232,210,165,203, 71, 0, 32,147,
+201,174,146, 36,233, 89,149, 95, 96, 24,230, 85,110,110,110,185, 14,212,100, 50,217, 85,138,162,222,194, 52, 26,141, 82, 14,135,
+147, 95,214, 59, 38,147, 41, 81,165, 82, 53,250,135, 20, 34, 1, 32, 82, 46,151,107,231,204,153,243, 91,155, 54,109,220,147,147,
+147, 77,147, 39, 79,110,253,231,159,127,118, 6,240,105, 21,201, 86, 51,130, 32, 54, 7, 5, 5, 29, 12, 15, 15,223, 19, 18, 18,
+194,203,202,202,146,238,219,183,207,117,203,150, 45, 81, 12,195, 12, 64, 5,129, 86,255, 63, 11, 77,211,178,196,196, 68, 41, 80,
+ 20,154,164,152, 88,193,104, 52,194,104, 52, 66,173, 86, 35, 48, 48,240,131,255,174,179,179,115, 48, 65, 16, 43, 37, 18, 73,163,
+130,130,130, 91, 0,198,164,164,164,252, 89,149,180,154, 76, 38,176, 44, 91,146, 78, 63, 63,191,234, 15, 90, 53,249,130,199,227,
+117,244,246,246,110,162,211,233,114, 94,189,122,117,211,108, 54,207,196,135,139,209,102, 11, 96, 38,159,207, 15,169, 93,187,182,
+251,179,103,207, 18, 12, 6,195, 13, 20, 5, 67,206,251, 16, 36,235,163,143, 62,186,188,106,213, 42,187,209,163, 71, 95,190,116,
+233, 82,203,106,178, 85, 45,255, 45,113,119,119,151,169,213,234,223, 1, 4,211, 52,237, 44, 16, 8, 32, 20, 10, 83,249,124,254,
+ 93,161, 80, 56,236,202,149, 43,185, 85,197, 52,155,205, 51, 99, 99, 99,157,155, 54,109,186,200,209,209,113,118,102,102,166,214,
+ 96, 48,156,201,201,201,153, 0, 64, 85,209,187,111,114,145,127, 25,201, 42,125,134,133,116,113,138, 51,198, 2,104,243, 26, 3,
+227,112,220,226,226,226, 28, 5, 2, 1, 24,134, 41, 25,204,222, 60, 44,247,245,122, 61, 2, 2, 2, 12,149, 12, 56,238, 9, 9,
+ 9,142, 60, 30,175,228,158, 94,175,135,171,171, 43,147,152,152,232, 88, 28,246,160, 68,116, 58, 29,220,220,220,254, 73, 49,143,
+190, 84, 40, 20,121,241,241, 9,129, 90,157,225,199,225, 99,167, 78, 27,208,251, 99,249,213,171, 87,153, 79, 63,253, 84,119,225,
+194,133, 47, 81, 20, 56,213,170,206,156, 32,136, 45,147, 39, 79,158, 45, 16,217,216,157,189,250, 72,183,101,223,145,164, 32,159,
+ 90,196,132, 9, 19,168,113,227,198, 93, 12, 14, 14,222,206, 48, 76, 67, 84, 65,179, 37,151,203,143,243,249,252,154,197,229, 23,
+159,147,147,243,201, 63,176, 66,114,240,182,243,216,178,238, 85, 42, 89, 89, 89, 40, 44, 44,124,235,240,243,243,179, 54, 86,102,
+149,210, 77,211,244,161, 5, 11, 22,184,166,166,164,224,215, 37, 75,154,162, 72,147,217,212,154,151,211,211,211,223, 74,167,175,
+175, 47,170,165, 74, 50,101,246,236,217, 11, 62,255,252,115,152,205,102, 20, 22, 22,186, 60,127,254,220,127,250,244,233, 61, 95,
+188,120,209, 4,192,203,247,157,140,123,123,123, 71,127,253,245,215,138, 38, 77,154,160, 56, 74,133,203,165, 75,151,154,110,216,
+176, 97, 80,124,124,188, 47,128,140,247,249, 1,133, 66,177,125,253,250,245,118, 34,145, 8,135, 15, 31,182,107,215,174,221,165,
+ 59,119,238,180,122, 15,178, 69,218,217,217,141, 3,208,150, 97, 24, 30,128, 27, 57, 57, 57,115, 81,117,175,238, 74,137, 68,178,
+159, 36,201, 90,192,127,188,209,147, 36,105, 79, 16, 68,166,229, 30, 65, 16,142, 12,195, 92,203,206,206,110, 94, 93, 29,255,221,
+ 98,103,103,247, 69, 90, 90,218, 42, 62,159,207,149,203,229, 16,137, 68,224,112, 56,224,112, 56, 53,248,124,126, 13, 62,159,223,
+ 41, 52, 52,116,204,185,115,231, 42,244,176,223, 44,200,105, 8, 72,226, 71,138, 32, 41, 0, 32,105,177,141,173,173, 45,126,252,
+241, 71,113,247,238,221,197, 0,112,249,242,229,240,193,131, 7,183, 75, 76, 76, 12, 40,143,108,149,197, 69,254, 69,178,174,162,
+ 1, 15,197,236,241,194,107, 45,151, 36,193,227,241,112,253,250,117, 88,227,172,220, 18, 34,161,194,222,160,216,195,248,159,127,
+254, 71, 1, 96, 25,104,120, 60, 30,174, 92,121,221,169,124,179,102,205, 74, 26,251,223, 37,189,253,138,156, 60,238,253,170, 40,
+ 93, 97, 43,139,188,107,239,253,202, 23,173,127,137, 67,239,113,179,250,106,180,134,198, 0,212,185, 57, 57, 57,183, 14, 28, 72,
+ 14,242,241,225,110,223,190,189,137,171,171,107,239, 42, 16,173, 41, 13, 27, 54,220, 79, 9,109,237,195, 7, 15, 9, 31,198, 33,
+ 13,131, 70, 78,156,151,144,146,169, 30, 49, 98,196,129,195,135, 15,135,255,244,211, 79,143, 39, 77,154, 52, 5,192,247,214,166,
+ 95, 32, 16,212,124,242,228,137,183,217,108,134,159,159,223, 63, 49,140, 65, 16,138,156,239,125, 14, 96,103,241,189,254, 40,242,
+220, 31, 12,224,110, 85,192, 44, 26,172,178,142, 15, 45,174,174,174,190, 3, 7, 14,180,207,206,204,196,175, 75,150, 88,110, 55,
+ 66, 37,203,136,150,246,163,215,235,241,217,103,159, 13, 52,155,205, 28, 11, 9,212,233,116,250,188,188, 60, 45,254, 99, 88,154,
+ 1,224, 99, 43,146,227, 41, 22,139,127, 6, 16, 92, 88, 88,232, 10, 0, 98,177, 56,137, 97,152,131,106,181,250,123,252, 39,128,
+111,149, 39,184, 0,252, 81,126, 40, 40,118,193,130, 5,207,166, 78,157,250,242,191,128, 89,211,201,201,105,126, 88, 88, 24,142,
+ 28, 57,130,163, 71,143, 26,133, 66, 33,103,240,224,193,196,152, 49, 99,228, 95,127,253,117, 39, 0,203,222,243, 51,119,154, 61,
+123,182,162, 94,189,122,216,183,111, 31,238,221,187, 87,232,237,237, 45,108,211,166, 13, 56, 28,142, 98,218,180,105,159, 2,216,
+252, 62, 63,144,157,157, 61,119,226,196,137, 91,118,238,220, 41,125,245,234, 21, 86,174, 92,105,223,183,111,223, 11,241,241,241,
+ 31, 85,129,108,241, 1,140, 3, 16, 74, 81, 84,171,193,131, 7,155,198,142, 29, 75,147, 36,105, 92,178,100,137,195,134, 13, 27,
+250,210, 52, 29,156,149,149,101,205, 36,141, 4,240,227,176, 97,195,134,158, 59,119, 78,126,243,230, 77,158,157,157, 29,204,102,
+115,137,166,152, 97, 24, 71, 75,157, 53,153, 76,240,245,245,117, 43,245,190,240,223, 74, 52, 72,146, 52, 48, 12, 67, 3, 16, 0,
+208, 85,118,253,191, 68,178, 20, 10,197,232,236,236,236,223,156,157,157,225,228,228,244,214, 88,171,211,233, 32, 16, 8,184,206,
+206,206,235,187,119,239, 78, 31, 58,116,168,220, 37, 64,130, 34,102, 30,222, 53,199, 85, 33,151, 2, 0,150,174, 57,161, 1,128,
+ 63,254,248, 3,201,201,201,144,203,229, 8, 8, 8,160,230,204,153,163,156, 48, 97,194,175, 57, 57, 57,195,202,195,122,147,139,
+252,203, 52, 90,235,202,186,174,208, 70,139,101,217,146, 56,121, 86, 86,218, 55,111,157,126, 3,143,208,235,245,120, 83,163,101,
+105,188, 52, 77,191,169,126, 4, 65, 16,108, 69,152,101,200, 96,177, 88, 28,168, 86,171, 87, 84, 97,118, 91,130,185,247, 43, 95,
+108,225, 79,238,111,137, 68,218,105, 98,209,121, 11,128,171, 49,195, 86,174,250,232, 35,215,113, 51,150,207, 42,204, 74,206,156,
+ 54,176,107, 77,111,103, 59,161, 56, 55, 61, 79, 81,183,110,135, 55, 52, 50,149,165,179,117,120,120,248,214,147,215, 99, 9,129,
+128,203,229, 80, 20,221,178,190,143,157,187, 45,101, 43, 5,108, 19, 94, 62,187, 58,100,200,144,250,147, 38, 77,106, 85, 5, 76,
+ 20, 15,184,216,182,109, 27, 8,130, 32,171,146,247, 15, 40,167, 43, 34, 89, 44,203,130, 32,136, 29,165, 6,149, 29,197,247,238,
+148, 34, 91,156,138,202,211,162, 77,181,144,170,193,131, 7, 15, 52,153, 76,156, 82,157,196,155, 4,166, 44, 18, 99, 85,222,149,
+ 74,229, 73, 0, 31, 19, 4, 1,189, 86,171,255,249,151, 95, 74,255,249,246, 27, 36,235,116,121,109,201,104, 52,194,108, 54,115,
+238,220,185, 67,151,170,235, 52, 0, 49, 0,123,150,101, 65,146,228,125, 43,202,211, 87, 36, 18, 93,141,136,136,176,105,212,168,
+ 17,193,227,241, 96, 50,153,240,224,193, 3,247,159,126,250,105,228,233,211,167, 63, 85,171,213,126,120, 59,120,186, 53,223,200,
+255,210,165, 75,106, 47, 47,175, 50,137,163, 74,165,226,248,248,248,124, 84, 14, 41,250,171, 49, 19,211,210,210,122,124,252,241,
+199,163, 82, 83, 83,163, 77, 38,211,119, 0, 2,236,237,237,239,244,234,213, 11, 66,161, 48,180,176,176,112,217,251,212,121, 71,
+ 71,199,238,205,155, 55,199,202,149, 43,241,211, 79, 63,181, 7,112, 6, 64, 59,149, 74,117,186, 91,183,110,144,201,100, 61,114,
+115,115, 55,191, 71, 59,242,105,221,186,245,250, 31,127,252, 81,122,228,200, 17,120,123,123, 35, 63, 63, 31,223,126,251,173,227,
+ 15, 63,252,112, 62, 55, 55,183, 77,169,118, 81, 30,166, 31,159,207,223,188,115,231, 78,137,151,151,151, 23,151,203, 37,189,188,
+188,144,157,157, 13,173, 86,203,159, 55,111, 94,125,161, 80,248,231,178,101,203, 54, 3,232, 85, 73, 58, 73, 0,115,215,174, 93,
+ 59,106,196,136, 17,178,129, 3, 7,154,245,122, 61,246,236,217, 3,138,162, 64,211, 52, 68, 34, 81, 73,240,106, 46,151,139,186,
+117,223,114,146,126,184,130,252,230,161,200, 14, 85,134,170, 45,187,158,174, 0,175,100,233,131,166,105, 8, 4, 2, 8, 4, 2,
+240,249,124, 60,121,242,100,134, 64, 32, 88, 66, 16,132,201, 26, 76,226, 63,236, 34, 16,192,205,202,174,241,182,105,200,223,217,
+127, 90,196,141, 32,136,165, 0, 66,139,134, 93,242,130,189,189,253,248,180,180,180, 56,107, 49,149, 74,165, 93, 86, 86,214, 50,
+165, 82, 9, 39, 39,167,146,241,219,213,213, 21, 70,163, 17,105,105,105, 96, 89, 22,185,185,185, 16,137, 68,112,113,113, 89, 54,
+ 98,196,136,125,235,214,173,203, 42, 19,147,193, 79,221,250, 78,159, 73, 81, 20, 9, 0, 20, 71, 34,249,122, 42, 80,179,102, 77,
+180,108,217, 18, 90,173, 22,121,121,121,240,247,247,231, 16, 4, 17, 78, 16,132, 13,203,178,171, 1,156,253, 31, 84, 20,150,107,
+ 12, 63,251,205,117, 81, 75,180,120, 46,151,107, 21,209, 42,126,190, 50, 13, 10,105, 52, 26,193,229,114, 95,211, 72, 16, 4, 1,
+179,217,252,218,125, 11,209,122, 23,162, 62,102,204, 24,102,253,250,245,163,114,114,114,214,224, 29,151, 18,194,195,195,223,178,
+247,152, 48, 97, 66, 98,122,122, 58,251, 89,135, 64,113,244,177,228,148,218,114,137,208, 65, 42,173, 37,144, 43,100, 89, 89, 89,
+215,138, 59, 19,107,165, 78,195,134, 13,133, 91, 14, 92, 74, 28,254,205,130, 57,141,188,236,108, 26,184,217,203,157,109,133, 60,
+ 9, 73,168, 5, 38, 99,162, 66,161,240,174,106,186, 45,253,130, 72, 36, 2, 73,146,255, 36,141, 22,199, 66,178,178,179,179,113,
+228,200, 17,116,238,220,249,142,133,132,168, 84, 42,164,164,164, 64,169, 84,222, 41,214,124, 84,186,140,200, 48, 12, 12, 6, 3,
+ 12, 6, 67, 9,129, 41, 85,135, 74, 8,140,229, 89,138,162,238,191, 99,218,231,200,229,242,214,161,161,161,188, 93,123,246,240,
+ 88,150, 85,163, 40,134, 90, 1,203,150, 19, 32,251, 13, 49,153, 76, 37, 90, 54,154,166, 17, 31, 31, 95, 50,112, 89, 98, 75, 10,
+ 4, 2,235, 84, 25,124,254,196,221,187,119,219, 52,105,210,132,200,202,202, 2,195, 48, 37,157,228,111,191,253, 38,232,221,187,
+183,107, 84, 84,212, 52,157, 78, 55,251, 29,242, 74,148, 71,136, 0,192,198,198,198, 4,235, 60,102, 87,138,105, 50,153,136, 22,
+ 45, 90, 76,202,204,204,172, 95, 88, 88, 56,207,154, 98, 4,112, 56, 49, 49,177,244,192,254,103,116,116,116, 97,159, 62,125,132,
+181,106,213, 10,121,244,232,209,123, 85, 82, 31, 31,159,102, 52, 77,227,198,141, 27, 58, 0,150,153,245,133,123,247,238,233,122,
+245,234,197,119,119,119,111,150,155,107,181,201,138,143,175,175,239, 41, 71, 71, 71,161,165, 15,117,112,112,160,215,173, 91, 39,
+ 77, 74, 74,130,193, 96,192,148, 41, 83,208,165, 75, 23,216,219,219, 99,194,132, 9, 78,139, 22, 45,218, 94, 80, 80,208,176, 34,
+165, 53,143,199,219,250,252,249,115,111,165, 82, 41,188,126,253, 58, 26, 52,104,128,204,204, 76,164,166,166,162,160,160, 0,169,
+169,169, 24, 54,108,152,227,175,191,254,234, 98,133, 38,171,132,100,173, 91,183, 46,119,255,254,253,212,239,191,255, 46,165,105,
+186,132,104,113, 56,156, 18,162,101,137,173,248, 14, 43, 13,185,197,164, 77,150,151,151,247, 62,118,110,124, 0,188,210, 36,139,
+207,231,131,207,231, 67, 32, 16,188, 87, 92,214,127,137,184, 18, 4,241,136,203,229,242, 69, 34, 17,151, 36, 73,240,249,252, 14,
+ 10,133,226, 97, 64, 64, 64,192,169, 83,167, 98,173, 1,209,106,181, 91,249,124, 62,237,232,232, 8, 0,240,246,246, 70,131, 6,
+ 13,160, 86,171,153,188,188, 60,200,100, 50, 50, 46, 46, 14,133,133,133, 72, 73, 73,129,135,135, 7, 77,146,228, 86, 20,217, 33,
+191, 37, 87,239,164,174, 1,176,198,114,109,111,111,159, 86, 90,211, 41, 16, 8,224,234,234,138,164,164, 36, 72,165, 82,234,135,
+ 31,126,232,181,103,207,158,158, 87,175, 94, 13, 7,176,173, 20,212,236,127,177,141,150,133,100,149, 62,255,135,104,117,233,210,
+101, 86,100,100,228, 71,101,205,194,105,154,254, 96,182, 46, 22, 66,101, 99, 99,243,166,214, 10, 12,195,148,167,209,170,242,239,
+ 8, 4, 2,225,232,209,163,243, 87,175, 94, 93,101,178, 21,182, 50,186, 68,139,245,214, 52,210,207,239,234,180,105,211,186,159,
+ 59,119, 46,169,145, 87, 45,142, 56, 57,174, 64, 96, 35,147,193,173, 70,231,193, 61,122,221, 67,209,238, 67,107,229,121,126,126,
+190,176,182,155, 72, 79,146, 90,162, 6,159, 35, 85,138,185,124,103,185,220,149,171,215,165,219,200,229, 60,157, 78,151,139, 10,
+130, 64, 3,128,147,147,211, 9,161, 80,232, 97,185,150,203,229,182, 44,203, 66, 36, 18, 65,169, 84, 74, 40,138,122, 90,170,113,
+197,165,165,165,117,168, 44, 97, 50,153,236, 4,159,207,247, 32, 73, 18, 4, 65,128,162, 40,144, 36, 9,146, 36, 75,254, 79, 81,
+ 20, 8,130,128, 70,163,137,139,141,141,237, 96, 69,126, 77, 0,130, 9,130,184,115,228,200, 17,132,132,132,224,216,177, 99,232,
+216,177, 35,242,242,242,240,224,193, 3,180,110,221, 26, 40, 90, 82,180, 74, 74, 27,191, 91, 38, 5, 79,158, 60, 41, 33, 46,165,
+ 15,169, 84,250, 62, 42,246,203, 97, 97, 97, 88,191,126, 61, 91, 60,153, 16, 19, 4,209,192,214,214,246,201,227,199,143,173,178,
+131, 97, 89, 22, 6,195,127, 30,181, 12, 94,197,246, 16, 85, 10, 14, 76, 81, 84,135,134, 13, 27, 18,121,121,121, 22, 2, 9, 14,
+135, 3,138,162, 64, 81, 20, 86,173, 90, 37,108,210,164,201,116, 62,159, 63,137,203,229,170,140, 70,227, 46,173, 86, 59, 15, 64,
+238, 63,169, 71,106,213,170,213, 55, 9, 9, 9, 93, 60, 60, 60, 34,222, 3,134, 53, 26,141,122, 0, 66,138,162,232, 15,208, 71,
+ 81,197,117, 75, 91,138,236,155,138,175,249, 40, 90, 38,182, 74,236,237,237,183, 31, 61,122,212,205,195,195, 3, 70,163, 17, 38,
+147, 9, 5, 5, 5,184,112,225, 2,116, 58, 29, 76, 38, 19,188,189,189, 49,115,230, 76,237,248,241,227, 5,107,215,174, 77, 47,
+ 40, 40, 24, 80, 9,236,248,125,251,246,137,149, 74,165,176,176,176, 16, 47, 95,190, 68,195,134, 13,145,159,159, 15,181, 90, 13,
+141, 70, 3,131,193, 0,149, 74, 37, 51,155,205,250, 74,176,102,148, 38, 89, 35, 71,142,188,207,227,241, 26,142, 29, 59, 22,137,
+137,137, 37,109,126,248,240,225,112,114,114, 42,105, 75,197,125,114,149, 58,102, 14,135, 3, 62,159, 15, 46,151,155, 91,163, 70,
+ 13, 16, 4, 33,136,139,139,123,151,165, 56, 27, 0, 42,154,166,121,165, 9, 22,159,207,199,141, 27, 55,166,241,120,188,242,180,
+ 89,229,181, 75,182, 42,215,255,109, 33, 8, 98, 41,151,203,229, 43, 20, 10,110,169, 9, 39, 87, 34,145,192,209,209,113, 37,128,
+ 78, 86,230, 59, 72,161, 80,148,244,239,129,129,129, 72, 72, 72, 56,152,151,151, 55, 40, 61, 61, 29, 36, 73,110, 37, 73,178,167,
+101,146,154,147,147, 3,119,119,247,160,242,240,154, 7, 59,143, 2,193,190,166,209,122, 99,130, 6, 27, 27, 27,196,196,196, 64,
+173, 86,179,207,158, 61, 35, 70,143, 30, 77,232,245,250, 77, 81, 81, 81,215, 80,180,219,190, 92, 46,242, 47,145,170,219,104, 89,
+ 52, 90,214, 14, 0, 4, 65, 84, 58,155, 48, 26,141, 18,127,127,255,178, 12,190,136,178,136, 86,241,114,210, 59, 85,116,154,166,
+165,239, 74,182,222,148,136,253, 59,157,126,154, 57,101,166,194,165, 86,237, 73,147,102,112,186,118,237,122,125,203,150, 45,102,
+ 69,189, 78,237,206,158,216,230,180,236,219,201,199,142, 30, 61, 10, 20, 25, 70, 91, 43,151, 35, 35, 35,157, 39,140, 27,131,153,
+ 19,199, 31,183,241,182,231, 73, 8,133, 88,160, 83,103, 72,192, 22,242,235,248,118, 57, 16, 17,145, 2, 32,170, 34, 16,145, 72,
+228,241,232,209, 35,239,210, 27, 9,244,122, 61, 68, 34, 17,206,158, 61,235, 32, 20, 10, 29, 0,160,176,176, 16, 1, 1, 1,214,
+106, 76, 60,158, 62,125,234, 45,149, 74,161,209,104,160,211,233, 96, 52, 26,193, 48, 12, 8,130, 0, 77,211,224,241,120, 16,139,
+197, 85,221,217,119, 23,192,231,157, 59,119,222,113,236,216, 49,248,251,251, 35, 39, 39, 7,209,209,209, 22,146, 85, 37, 27, 45,
+139,150,168,180, 61, 22,135,195,193,118, 47, 47, 12, 79, 78, 46, 33, 48, 75,109,109, 49,147,121,183,104, 26, 1, 1, 1,236,229,
+203,151,113,252,248,113,116,235,214,141, 56,116,232,144,193,108, 54,115,147,147,147,239, 39, 39, 39, 91,133,193, 48, 76, 73, 90,
+ 45,253,118,105,130, 85, 85,162,101, 50,153,164, 60, 30, 15, 90,173, 22, 22,205, 67,233,195,211,211, 19,217,217,217, 28,149, 74,
+197, 73, 78, 78, 22,205,157, 59,119,236,249,243,231,149,249,249,249,253,255,155,189,208,234,213,171, 61,134, 15, 31, 30,207,225,
+112,216,142, 29, 59, 14,140,139,139,235,161, 84, 42,207,156, 59,119,238, 23, 0, 62, 85,197,179,183,183,191,205,225,112,220, 84,
+ 42, 21,119,239,222,189,198,252,252,124,174,131,131, 67,154,165,239,176,148,181,209,104,180,106,231,178,189,189,253,237,204,204,
+ 76,238,138, 21, 43,140, 89, 89, 89, 92, 39, 39,167, 52, 11, 78,110,110, 46,119,239,222,189, 70,149, 74,197,181,181,181,189,157,
+151,151, 87, 41, 94,102,102,230,128,240,240,240, 75,103,206,156,177,167, 40, 10,113,113,113,200,202,202,130, 76, 38,195,214,173,
+ 91,225,225,225,129,125,251,246,101,103,103,103,127,241,243,207, 63, 79, 47, 38, 89,149,217,104,181, 14, 9, 9,241,200,205,205,
+133, 76, 38,131, 90,173,198,237,219,183,225,231,231,135,228,228,100,144, 36, 9,153, 76,134,223,126,251, 77, 67, 16, 68,118, 69,
+ 64, 66,161,176,199,136, 17, 35,100, 0, 48, 98,196, 8,217,136, 17, 35,202, 28,224,154, 53,107,134,149, 43, 87,190, 73,180,170,
+ 50, 49, 40,209, 58,149, 34, 71,218,166, 77,155,226,252,249,243,147,171, 72,142,244, 22,210,246,166, 54,139,207,231, 87,121, 51,
+ 13,195, 48, 92, 20,153, 52, 16,214, 92,255, 3,228, 35,161, 80,200,125,243,166, 70,163,225, 42,149,202, 86, 85, 32,190,118, 66,
+ 97,145,194,201,195,195, 3,121,121,121,102,189, 94,223,247,255,218,187,206,240, 38,174,180,123,102, 70,189, 88,238, 21, 3, 6,
+ 2,152, 14,166, 99, 58, 14, 16, 32, 75, 18,218, 38,212,133,152, 16,216, 44, 36, 11, 36, 31,201,134, 56,148, 64, 96, 33,129, 16,
+240, 66, 48, 16, 72, 66, 11, 29, 66, 89,140, 9, 53, 54, 4, 55,108, 76,115, 47,178, 44,217,146,101,149, 25,205,247,195,146, 34,
+ 27, 23,201,150, 41, 89,157,231,153,199, 26,207,232,232,206,157, 91,206,125,239,123,223,187,103,207, 30, 35, 0,132,133,133, 77,
+ 97, 24,166,130,166,105,138,207,231, 67,163,209,192,207,207,207,187, 14,219,232,210,163, 63,172, 8,168,238,163, 21, 24, 24,136,
+176,176, 48,232,116, 58,228,229,229, 33, 54, 54,214,200, 48,204,222,111,191,253,214,228,235,235,251,183, 9, 19, 38, 80,241,241,
+241, 11, 0, 44,170, 77,139,188, 96,214,172,232, 90,133,150, 89, 65, 94, 4, 48,180,250, 67, 86, 23, 63,117, 9,173,250,166, 14,
+249,124,190, 50, 51, 51, 83, 98,219,169,208, 52,141,160,160, 32, 19,203,178, 68, 77, 66,171, 49,166, 96, 46,151,235,246,209, 71,
+ 31, 41,191,253,246,219,169, 15, 31, 62, 92,110,207,119,246, 47,232,128, 93,213, 68,214,214, 53, 81,155, 55,173, 89,225,149,113,
+122, 39,182,127,189,142, 97, 24,196,119,237,218,117,144, 90,173,230,184, 75,140,144, 43,113,202, 44,178,236, 21,133, 36,128,239,
+110,220,184, 17, 63,102,204,152, 95,191,251,241,144, 87,238,253,251, 87, 5,165,242, 60, 89,219,118, 28, 94,179,150,175,151, 85,
+ 84,240,166, 76,153,226, 11, 96, 66,125,141,152, 82,169, 68,126,126,126,117, 1,134,187,119,239, 62,113,175, 93,137, 35, 73, 48,
+ 12,131,131, 7, 15, 66, 44, 22, 67, 34,145, 84, 57, 44, 34,171,129, 11, 21,210, 0, 96,244,232,209, 80, 40, 20,144, 74,165,118,
+167,171,186,120, 97, 89, 22,122,189, 30,122,189, 30, 6,131,129, 1,192,229,112, 56,152,157,157,109,181,242, 56, 34, 96,170,163,
+107,215,174,236,149, 43, 87,240,235,175,191, 66,163,209, 96,211,166, 77, 8, 12, 12, 28, 14,224, 19, 71,185,108,156,244,153,210,
+210, 82,110,105,105,169,213, 58,200,229,114,173,214, 3, 59, 45,121, 60, 14,135, 99, 29,141, 90, 14, 91,171, 22, 69, 81,240,247,
+247, 71, 64, 64, 0,182,110,221,202,107,213,170,213,184,103,217, 2,173, 93,187,182,237,198,141, 27,119,236,218,181,235,212,212,
+169, 83,127, 74, 76, 76,156,229,238,238,126,231,194,133, 11, 43, 4, 2,129,169,129,245, 59, 56, 55, 55,215,207,246, 95, 38,147,
+ 73, 76,211,180, 85,216,150,151,151,219, 61,192,224,114,185,193,201,201,201, 98, 0, 88,177, 98, 5, 23,128,216,226, 12,110,225,
+ 44, 47, 47,231,118,234,212, 41,216,222,178, 30, 23, 23, 55, 40, 34, 34,226,202,217,179,103, 61, 91,182,108,137,156,156, 28,228,
+228,228,160,109,219,182, 88,181,106,149,166,180,180, 52, 28, 64,154, 90,173, 62, 98, 39,103,144,167,167, 39, 55, 51, 51, 19, 52,
+ 77,163, 71,143, 30,216,178,101, 11,166, 76,153,130, 46, 93,186,160,180,180, 20,201,201,201,136,137,137,241,228,241,120,117,182,
+ 29, 90,173,246, 72,116,116,116,243,234, 22,173,105,211,166, 73, 10, 10, 10,172,101, 50, 42, 42,170,202, 20,162, 35,109,178,121,
+106,171,214,163, 33,160,105, 90, 38, 20, 10, 75, 5, 2, 1,223,226,159, 21, 27, 27,235,176, 53,171,218, 0,208,145,243,103, 6,
+139,104,173,161,111, 69, 64, 64,128,221, 60, 2,129,128,176,180,141, 52, 77, 67,165, 82, 49,129,129,129,214,233,253,132,132, 4,
+ 38, 36, 36,132,161, 40,138,226,243,249, 32, 8, 2, 98,177,184,214, 6,159,101,216,168, 87,167,124, 82,101,213,225,194,143, 0,
+131,193,128,132,132, 4, 24, 12, 6,196,198,198, 26,191,252,242,203, 92,165, 82,185, 16, 0,231,204,153, 51, 51,150, 44, 89, 66,
+249,249,249, 69, 20, 22, 22,162, 62, 45,242, 2,137,173, 39,172, 92,150, 94,232,226,184,113,227, 8,243,210, 74,194, 34,156, 28,
+ 17, 90,230,202, 87,111,207, 75, 16, 4,242,242,242,172,231,126,126,126, 14,255,150,189,240,246,246,214,244,239,223,223, 77, 46,
+151, 31, 89,187,118,109,131, 44, 89, 91,215, 68,109, 94,253,249,167, 94,138,148,107,200,206,205,131,162,208, 24,127,249,206,195,
+195, 0, 14, 3, 0,182,117,188, 72,188,147,250,141,189,156, 29,124, 68,221,185, 60,206,225,151,199,140,107, 62, 57,114, 17,249,
+238,187,239, 14,156, 49, 99,134,106,234,212,169,239, 73,165,210,246, 6,131,161,228,208,137, 19,143, 38, 79,158,220,138, 97,152,
+ 25,168, 39,230,136, 86,171,125, 60,116,232, 80,219,252,148,157, 59,119,206,255,209,163, 71,152, 63,127,126, 81, 78, 78,142,210,
+246, 94,123,210,104, 48, 24, 30,119,239,222,189,214,233, 66,203,148, 34, 0,148,149,149, 61,118, 32, 75,223,132,217,241,189,184,
+184, 24,119,239,222, 5,135,195, 65,191,126,253,112,249,242,101, 12, 28, 56, 48,193, 17,171, 86, 69, 69, 5, 90,182,108,137,138,
+138, 10,104, 52,154,114, 0,130,221,173, 90, 1, 0, 22, 20, 23,227,183, 47,191,196,181,213,171, 97, 91,158,237, 69,183,110,221,
+216,107,215,174,225,206,157, 59,208,233,116,152, 51,103, 14, 0, 16,230,178,235, 72,200,140, 54, 20, 69,141, 30, 51,102, 76, 16,
+ 0,104, 52, 26,226,198,141, 27, 16, 10,133,214,186,112,236,216, 49,228,228,228,128, 32, 8,120,122,122, 6,151,148,148,180, 2,
+240,176, 14,179, 63,241,240,225, 67,124,241,197, 23, 48,153, 76, 88,178,100, 9,218,181,107,103, 21, 88,143, 31, 63,198,138, 21,
+ 43,192, 48, 12, 62,253,244, 83,180,109,219, 22, 70,163, 81,136, 6,134,208,112, 6,222,127,255,253,140,195,135, 15,159,202,202,
+202,122,101,205,154, 53, 67, 8,130, 48, 45, 94,188,248, 11,153, 76,198, 52,134,183, 68, 85,134,187,247, 30, 91,133, 80,245,195,
+215,199,203, 97,190,244,251, 89,214,239, 51,140, 45, 31, 3,111, 47, 79, 71,147, 88,110, 52, 26, 53,175,191,254,186,199,193,131,
+ 7,137,182,109,219,226,193,131, 7, 22,203, 80, 57, 28, 15,233,144,163, 80, 40,218, 81, 20,197,187,119,239, 30, 66, 66, 66,208,
+183,111, 95,172, 92,185, 18,114,185, 28, 52, 77,195,207,207,207,100, 52, 26, 19, 12, 6,195,165,122,184,162,230,206,157,203, 3,
+240,142,217,178,213,117,225,194,133,166,117,235,214, 33, 33, 33,193,106,193,178,117,134,119,116,234,208,214,234,100,123,196,198,
+198, 46,225,243,249, 44,128,235,112, 60,208,179,190,186, 69,171, 33,214,172,166, 66, 83,174,100, 12, 12, 12,140,117,115,115, 27,
+ 87, 82, 82, 82,197,170, 21, 30, 30,110,240,247,247,143,179,151, 71, 42,149,150, 80, 20,229, 13, 0, 57, 57, 57,144, 72, 36,188,
+251,247,239,175, 70,101,240,108,180,106,213,106,181, 66,161,224,181, 50,183,167, 1, 1, 1,208,235,245,181,186,177, 92,189, 85,
+176, 19,192, 78,203,185,151,151, 87,158, 74,165, 18,173, 91,183, 78,189,122,245,106, 45,195, 48, 58, 0, 23,148, 74,165, 53,142,
+ 86,126,126,190,138,203,229,122,121,120,120, 52,179, 8,173,154,180,200, 11,134,218, 45, 90,102, 37,201, 86, 23, 68, 4, 65, 60,
+225,160, 94,143,208,170, 87,100, 49, 12, 83,197,202, 96,113,120,175,233,183,204,157,122,131,166, 14,205, 34, 75,120,232,208,161,
+221,107,215,174,189,110,239,247,108,125,180,182,173,255,124,141, 69,100,253,254,235, 89, 28, 73, 85,201,151,172,222,176,177,161,
+111,160,163,143,184,155,191,191,247,197, 47, 87, 69,201, 50, 78,199,224,167,109,255,102,127,191,121,179,207,205,155, 55,167,207,
+159, 63,191,133,185, 96, 41, 0,220, 6, 48, 25,118,172,210,201,201,201, 25, 85,173, 19, 78,227,241,120,254, 98,177, 24, 57, 57,
+ 57,234,244,244,116,135,167,100,228,114,249,168, 38, 40,128, 28,139,200,146,203,229, 72, 78, 78,198,176, 97,195, 0, 0,151, 47,
+ 95, 70,120,120, 56,226,227,227,209,179,103,207, 4, 0,189, 81, 79,160, 86,163,209,168,236,216,177,163,213,186,165, 82,169, 76,
+ 0, 16,153,151,135,232,192, 64,112, 56, 28, 92, 91,189, 26,203,140, 70,172,116, 80,192,119,239,222,157,189,113,227, 6, 30, 61,
+122, 4,154,166, 49,126,252,120, 52,176,210,119,233,208,161,195,185, 11, 23, 46,248, 74,165, 82,104, 52, 26,168,213,106,204,156,
+ 57, 19, 83,166, 76,129, 78,167,195,254,253,251,113,244,232, 81,184,185,185, 65,163,209, 64,163,209,120,142, 29, 59,246, 74, 90,
+ 90,218, 96, 0,247,106, 17, 90,236,168, 81,163, 16, 23, 23, 7,138,162,208,167, 79, 31, 20, 23,255,177, 24,200,223,223,191,166,
+107,212,179, 20, 90, 28, 14,135,141,141,141, 93, 51,100,200, 16,100,101,101,189,210,179,103,207, 77,179,102,205,202,105, 44,175,
+167,187, 27,186,119,106, 3,157, 78, 7,157, 78,135,160,160, 32,148,149,149, 33, 35, 35, 3, 58,157, 14,254,126, 30, 14,243,133,
+117,105,107,229,243,243,243,131, 70,163,193,195,135, 15,161,215,235,225,227,227,144,208,106, 62,106,212,168,255,238,221,187,215,
+ 59, 38, 38, 70, 63,116,232, 80,254,166, 77,155, 8,153, 76, 6,155,142,197, 81,196, 94,190,124,185,101, 68, 68, 68,104, 74, 74,
+ 10, 98, 99, 99,161,215,235, 17, 22, 22,134,244,244,116,244,239,223, 31,106,181,250,250,205,155, 55,143,218, 99, 24, 6,240,241,
+220,185,115, 97, 17, 91,113,113,113,200,203,203,131,155,155,219, 19, 66,203,226,251,104, 94, 53, 30,100, 79, 98, 45,130,200,198,
+242,180,204,195,195,195, 0, 96, 99, 3,173, 79, 0,128,172,172, 44, 65,215,174, 93,117, 66,161,144,111, 22,109, 27, 26,195,231,
+ 76, 56, 97, 37, 99,173, 8, 8, 8, 88,232,227,227, 19,209,186,117,107, 20, 20, 20,240,248,124, 62,194,195,195, 13,189,123,247,
+ 54, 4, 4, 4, 44,176,151, 71, 32, 16,164,240,120,188,193,149,131, 9, 6,153,153,153, 96, 89,118, 73,151, 46, 93,254, 81, 86,
+ 86,134,226,226, 98,190, 76, 38,179, 14,170, 67, 67, 67,161,211,233, 82, 28,176,188, 69,133,132,132,124,204,227,241, 86,202,229,
+242,154,194, 66,240, 61, 60, 60,100, 60, 30, 15, 6,131,161,138,216,172,174, 69, 94,116,145, 85, 69,104,217,168,200, 42, 66,199,
+ 17,139,150, 61, 86, 3,139,131,189,237,185, 69,212, 85,255,173,134,198,208,114,119,119,215, 89, 68,214,202,149, 43,175, 55,132,
+227,192,222, 61,129,238,166,242,230,185,215, 79, 34,237, 78, 60, 14, 39, 43,229, 75, 86,111,120,239,213, 9,111, 22, 84, 23,102,
+246,160,157,175,184,139,191,159,247,197,245,107, 87,203, 20, 41,215,144,151,159,143,147,215,111,198, 27,128,100, 0, 75,156,105,
+ 90, 6, 42,167, 14, 41,138,122,158, 10,172,213, 25, 62, 47, 47,207, 34,178,194, 0, 96,224,192,129, 9,102,145, 5,123, 45, 90,
+ 74,165,178,250,150, 53, 17, 0,124, 44,207,207,225,112, 16,254,241,199, 14,139, 44, 0,108,124,124, 60, 20, 10,133,101,164,216,
+ 80,145,133,128,128,128,127, 94,184,112,193,247,187,239,190, 43,221,181,107, 87,177,201,100,226,118,239,222, 61,184, 87,175, 94,
+196,238,221,187, 1, 0,147, 39, 79,198,146, 37, 75,144,148,148, 4,137, 68,130,129, 3, 7, 50,203,151, 47,247, 91,184,112,225,
+130,130,130,130,247,106,236, 29, 77, 38,158, 80, 40, 60, 15, 96,120, 74, 74, 10, 0, 92, 65,229, 22, 78, 22, 43, 66,173,215,236,
+233,124,203,202,202,184,110,110,110, 53,134,134,224, 85,142,134, 28,181, 64, 88, 57,127,253,245,215, 47,214,175, 95,127,248,131,
+ 15, 62,184,215, 72,206, 26, 45, 90,227,198,141,131, 86,103, 64,118,129, 10, 12, 67, 67,107, 40,116,152,207,214,162, 53,110,220,
+ 56,148, 87,232,145,153,167, 0, 77, 51, 40,211,218,221,151,139, 95,126,249,229, 51, 63,252,240, 67,192,213,171, 87,193, 48,140,
+ 41, 61, 61,253,225,235,175,191, 46, 91,188,120,177,119, 35, 22, 25,125,253,230,155,111, 78,252,245,215, 95, 21,161,161,161, 94,
+215,175, 95, 71, 97, 97, 33,104,154,198,240,225,195,193,231,243, 51, 87,175, 94,205, 3,240,181,189,239,198, 44,182, 12, 55,111,
+222,124,251,218,181,107, 94, 94, 94, 94,124, 83,135, 14,200, 59,123, 22, 7, 15, 30,124,226, 11,219,182,109, 3,236,140,194,111,
+177, 56,221,184,113,195, 41, 2,171, 74, 79,205,231, 55,120,250,241, 69,197,141, 27, 55,114,222,125,247,221, 78, 50,153,108,227,
+160, 65,131,134,121,123,123,147,158,158,158,177,205,154, 53,251, 71,247,238,221,237,158, 93,224,114,185,179, 36, 18, 73, 6, 77,
+211,148, 90,173,134, 70,163,169,108,164,105,154, 79,146, 36, 90,181,106,101,237, 75,250,244,233,131,128,128, 0, 38, 53, 53,117,
+150,189,252, 69, 69, 69, 85, 86, 33,214,128,185,225,225,225, 28,157, 78,135, 71,143, 30, 93,182,189, 80,147, 22,121, 65, 16, 89,
+167,248,178, 60,148,237,195, 53,107,214, 44,203,104, 52,178,201, 0,123,251,246,109, 54, 50, 50,178,206,163,162,162,130,245,243,
+243,203,171,161,243,131, 45,167, 78,167,171,242, 61,157, 78,199,250,251,251, 51, 90,173,246, 9, 78,173, 86,203, 6, 7, 7,231,
+212,197, 89, 3,102,222,186,117,235,219,101,203,150,245,117, 32,131,172,156,236,214, 14,108, 76, 76,204, 95, 89,150, 29, 50,168,
+ 83,203, 59,147,186,251,179,225,237,252,114,143, 30,216, 59,133,101,217, 33,213, 15, 75,128,211,186, 56, 59,248, 75, 58,142,232,
+220,162,228,247,211,251,216, 11,235,254,206,174, 31,223,142,237, 25,236,166,236,224, 35,114,116,143,152,122,119, 75,239,220,185,
+115,154,201,100, 98,245,122, 61,219,185,115,231,116,103,112, 54, 0,117,113,246, 64,165, 47,219,155, 53,252,175, 71, 35,210,249,
+ 59,203,178,172, 66,161, 96,213,106, 53,171,211,233, 88,134, 97, 88, 91, 0,248,221, 14, 78,214, 96, 48,176, 37, 37, 37, 44,236,
+247,185,171,145, 51, 48, 48,240,225,253,251,247,217,151, 94,122, 41,203,108,142, 95,168,209,104,216,234,208,104, 52,236,176, 97,
+195,216,244,244,116, 54, 36, 36,164, 34, 61, 61,157, 13, 12, 12,188, 91, 79, 58, 91, 55,111,222,252,188,143,143, 79, 44,128,118,
+ 14, 92,171, 51, 63,247,239,223,223,134,101,217, 57, 44,203, 70,214,114,204,119,133,129,130, 0, 0, 32, 0, 73, 68, 65, 84, 97,
+ 89,182,195,179,230, 52,231,111, 1,203,178,108,121,121, 57,171, 80, 40,216,220,220, 92,182,188,188,156, 85,171,213,236,173, 91,
+183,216,171, 87,175,178,119,238,220, 97,189,188,188, 10,236,225,180,240,233,245,122,182,180,180,148, 45, 44, 44,100,181, 90, 45,
+171,209,104,216,196,196, 68,246,183,223,126, 99, 83, 82, 82,106,226,123,130,211,219,219,123, 91,126,126,190,250,202,149, 43,229,
+ 91,183,110, 45, 15, 8, 8, 72, 1,208, 18, 64,123, 79, 79,207,252,191,255,253,239,172, 84, 42,125,220,192,122,212,137,203,229,
+222, 90,179,102,205,141,227,199,143, 23, 28, 61,122, 84,191, 99,199,142,236,249,243,231, 95,226,112, 56,183, 0,116,106, 96, 61,
+242,243,240,240,184,114,253,250,117,186,164,164,132, 85, 42,149,108,105,105, 41,171,209,104, 88,173, 86,203,234,245,122,214,104,
+ 52,178,151, 46, 93, 98,253,253,253,109,167, 37,151,214, 49,176, 94,196,178,236, 63, 89,150,229, 56,187,173,179,225, 30,228, 44,
+ 78,103,180,117, 36, 73, 26,204,109, 71,191,202,211,186,207,159, 85, 58, 71,140, 24,241,233,148, 41, 83,216,209,163, 71,179, 97,
+ 97, 97, 79, 28, 61,123,246,100,231,205,155,199, 30, 63,126,156,253,242,203, 47, 63,117, 66, 58, 57,168, 92,244,178,106,196,136,
+ 17,198,184,184, 56,118,242,228,201, 44,128, 81,117,105,145, 63,131,224,178,132,119, 32,108,255, 2,128,193, 96,200, 74, 75, 75,
+ 11, 12,165,105, 10, 0,190,249,230,155, 39, 44, 83,182,136,139,139,163, 9,130,200,168,235,215, 13, 6, 67,214,133, 11, 23,252,
+ 55,111,222,204,181, 49, 1,131,166,105, 83,110,110, 46,185,105,211,166, 42,247, 95,188,120,145,166,105, 58,211,193,135,140,233,
+209,163, 71,140, 51,114,235, 82,210,163,127,156, 57,249,179, 79,191,190,131,148, 50, 47,175, 26, 71, 97,251, 23,116, 0,241, 78,
+221, 86, 45,130, 67,174, 92,179, 42,202,195, 50, 5,249, 99, 66,190,178, 66,199, 12, 75,149,107,127,119,246, 27, 86,171,213,143,
+ 44, 43, 1, 53, 26, 77,230,115, 88, 8,111,161, 50,198, 21, 93,237,127,189,209, 72,167, 83,147,201, 4,119,119,119,171, 53,180,
+ 1, 22, 81,214, 98, 97,181,188,186,198,164,135,101,217, 95, 19, 19, 19, 67,102,206,156,233,182,107,215,174,251, 12,195,112,103,
+207,158,109, 8, 8, 8,224, 93,190,124,217, 8,128, 24, 50,100, 8, 39, 63, 63,159,205,201,201, 81,252,229, 47,127, 41,123,251,
+237,183,189,111,223,190,205, 55,153, 76,245, 5, 45,124,144,149,149, 53,162, 1,215,234,196,164, 73,147,238,163,241,219,216, 52,
+ 57,167, 5, 10,101, 41,238, 63,202, 49, 71, 48, 55,129,121, 92, 96,245,171, 50, 26,105, 40, 74,139, 29,182,104,101, 60,204, 49,
+111, 49,198,128, 97,114,205,124,149, 14,241,108, 73,121,253,189, 9,135, 51,112,249,242,229, 99, 72,146, 36,175, 93,187,166, 91,
+187,118,109, 86, 81, 81,209,120, 0,153, 0, 80, 82, 82, 50, 52, 38, 38,230,123, 59, 66, 57,212,134,100,163,209,216,127,233,210,
+165,239, 1, 24, 8,160,133,153,251,178,217,146,213,208, 8,230,133, 74,165,114,228,152, 49, 99,206, 82, 20,213,202,166, 30,249,
+ 0,144, 91,234, 5,203,178,126, 5, 5, 5,175,216, 67, 72, 16,196,134,166,106, 72,154,146,187,145,237,208, 11,177,146,241,252,
+249,243,159,141, 31, 63,158,211,178,101,203,255,107,217,178, 37, 89, 82, 82, 2,181, 90, 13,146, 36, 17, 16, 16,128,206,157, 59,
+ 35, 32, 32,192,148,146,146,178,234,195, 15, 63,172, 55, 38, 95,199,142, 29,219, 24,141,198,151, 72,146,108, 3,160, 13,203,178,
+109, 8,130,104, 3,192, 11, 0,100, 50,153, 44, 36, 36,132,211,175, 95, 63,244,237,219, 23, 23, 47, 94,196,129, 3, 7,118, 2,
+ 56, 99,107,205,170,174, 69,158, 7, 36,247, 0,219,233, 22,136,164,158, 24, 66,152,112,145, 37, 49,180,115,188, 53,206, 94,117,
+145, 85,251,166,210, 53,152,254, 70, 13, 31, 62,220, 90,225,236,232, 84, 30,213, 87,249,138,138,138, 70,205,154, 53,171, 10, 39,
+195, 48,186,226,226,226,119, 7, 12, 24,176,133,162, 40, 65,181, 2,251,184,176,176,240,169,238,213, 87, 61,142,214,168, 49,175,
+201, 27,203, 41,229,145, 47,165,157,248, 15, 10, 10,229,248, 49, 33,191,164, 76,207, 12, 77,151,151, 39, 54, 69,250, 31, 63,126,
+ 60,250, 5, 80,252, 53,137,214,198,110,158, 93,100, 71, 64,210,250,246,168, 35,204,225, 68,156, 82,201,243,243,243,215,125,252,
+241,199, 35, 87,173, 90,229,123,234,212, 41,153,101,128,242,198, 27,111, 20, 38, 38, 38, 14, 2, 32,168,168,168, 56,183,106,213,
+ 42,223,168,168, 40,111, 0,222, 0, 48,118,236,216,130,130,130,130,205,112,161, 78, 24,141,198,236,206, 29, 67,173, 3, 63,219,
+144, 14,182,159,105,154,206,118,132,175, 38, 30,219,115,134, 97,234,228,163, 40,234,131,190,125,251, 82, 31,124,240, 65,193,169,
+ 83,167, 44, 27,233,218, 42,180,180,122,130,146,218, 3, 29,128,181,230,195,153,208, 40, 20,138,254, 14,126,135,113,149,198, 26,
+ 7,148,142,156, 63, 19, 28, 57,114,228,147,201,147, 39,199,120,121,121,237,105,211,166, 77,168,191,191,191, 76, 36, 18, 65,167,
+211,149,233,245,250,187,105,105,105, 83, 63,249,228,147, 7,118, 89, 56, 98, 98, 40, 0, 60,147,201, 36, 36, 73, 82, 2, 64, 70,
+ 16,132,167, 69,104, 17, 4, 1,131,193,128, 71,143, 30, 97,217,178,101,204,249,243,231,191, 4,240,169, 3, 3,215,222, 0,124,
+109,218,113, 95, 0,122, 84, 6,176, 45, 34, 8,226,102, 83,231, 23, 97,194,197, 78,183, 64, 36,247, 64, 77,253, 68,221,155, 74,
+215, 86,225,138,138,138,250, 59,187, 18,215,198, 89, 84, 84,212,242,121,169, 33, 51,116,107,247, 97,219,218, 42,251, 28, 90, 68,
+ 88, 77,231,245, 65,165,165,231,127,125, 38,105,157,142,102, 77, 6,218,244,183,244,162,242,100, 87, 59,228,116,188,236,172,186,
+228,196, 52, 37,166,166,166, 14,152, 63,127,254, 39, 98,177,184, 15, 0,148,151,151, 95,203,205,205,253, 28,230, 85,133,245, 93,
+119,161,118,200,229,242, 94,207, 35,159, 94,175,255,199,128, 1, 3,190, 98, 24,102, 61, 77,211,151,255, 7, 94, 69,133,171, 52,
+190,184,248,233,167,159, 30, 0,232, 15, 0, 19, 39, 78,164, 0,224,192,129, 3, 14,139,231,153, 51,103, 50, 44,203, 26,204,229,
+ 65,131,202,213,133, 37,150, 54, 85,163,209,148,228,230,230,166, 48, 12,147, 2,224,123, 56,190,226,214,151, 32,136,227, 44,203,
+142, 51, 11,183,227, 44,203,142,179,253, 95, 83, 91,181,234,185,165,126,103,120, 23, 42,113, 32, 25, 68,245,169,192,250,206,235,
+ 67, 90,129, 38, 22, 64, 79, 87,238,254, 79,226,126,110,110,238,140, 70, 92,119,225,197, 67,166, 94,175, 31,255, 63,244,188, 42,
+215, 43,255,147,244,127, 13, 16, 88, 22,164,164,164, 52,153,139,192,179, 70,167, 91, 85, 7,224,213,207,109, 16, 89,147,240,114,
+ 9, 45, 23, 92,112,193, 5, 23, 26, 3,165, 43, 11, 92,248, 51,195,226,155,101, 57,175,197, 71,171,186,127,150,245,156, 64,237,
+ 43, 7, 28,217,149,188, 33,171, 36,206,185, 56, 93,156, 46, 78, 23,167,139,243,153,115,122, 0, 8, 1,176,166,158,251,170,175,
+ 46, 44, 0, 32, 7, 96,116,229,167,139,179, 17,250,193, 46,176, 44, 59,182,174,169, 67,130, 32, 78, 52,149,208,178, 58,195,247,
+192,242,206,183,176,220,114,110,175,208,106,106, 68,184, 56, 93,156, 46, 78, 23,167,139,211,197,233,226,116,113, 54, 82,104, 13,
+251,240,195, 15, 63, 66,101,104, 12,246,195, 15, 63,252,136,101,217,177,149,151,216,177, 77,249,219, 73, 61, 49, 36,185, 7, 88,
+203,145,212, 19, 67,106,185, 53,210,230,176,194, 53,117,232,130, 11, 46,184,224,130, 11, 46, 60,239,184,178,122,245,234,242,213,
+171, 87, 91, 28,223,139, 0, 16,102, 11, 87, 81, 83,254,176,121,154,208,158,133, 82,117,111,193,243, 12, 16, 68,114,120,211,184,
+ 60,193, 48,176,166,206, 0, 0,146, 74, 98,244, 21,255,165,105,195, 30, 0,185, 13, 37,238, 0,116,108,235, 33, 58,170, 99, 24,
+ 94, 86,153,126, 98,106,229, 54, 7, 14, 99, 34, 16, 46,224,243,127, 17,120,120,136,106,186,174, 83, 42,181, 58,189,126,228, 1,
+224, 87, 87, 29,112,193, 5, 23, 92,112,225, 5,129,196,211,211,243, 60, 73,146, 45, 45,255,176,141, 59, 88, 61, 6, 33,195, 48,
+121, 10,133, 98, 36, 42,167,138,159, 38,167,237,247,245,104, 96, 95,238,108, 56, 58,117,200, 1,170, 68, 97,125, 42, 59,102, 83,
+ 92,193,219,110,238, 30, 43,255, 58,235, 31,222,237,218,135, 18,205,155, 55, 3, 88, 32, 51, 43,219, 63,227, 94,250,136,159,118,
+125,253,126,169, 74,177,204,168,211,253,199, 81,238,142,128,164,133, 84,112,249, 63, 31,190,229,193, 1,141, 55, 87,236, 61, 77,
+168, 13,205, 83, 42,151,155, 58, 36,178, 60,188,189,207,172, 62,119, 78,228,217,173, 91,149,107, 44,203, 86,238,175,247,251,239,
+162,255, 27, 57,242,204, 68,133, 98,148, 75,108,253, 41, 17, 32,147,201, 22,114,185,220,161, 6,131,161, 37,159,207,207, 98, 24,
+ 38,182,164,164,100, 35,128, 28, 87,246,252,185, 17, 26, 32, 25, 20,218,166,229,222,220,252,130,132,210, 10,253,236,180, 92,181,
+194,149, 43, 14,163,174,253, 53,159,217,222,155, 0, 32,149, 74,127, 35, 73, 50,216, 86, 4, 88,246,236,181,156, 87,255,107, 50,
+153, 30, 40, 20,138, 1,117,208,182,241,242,242,218, 2,160,119,125, 1,147,205,177,217,110, 42, 20,138,119, 81,251,106, 61, 55,
+ 79, 79,207,207, 8,130,152, 68,146, 36, 85,223, 51,153, 76, 38,134,101,217,253, 37, 37, 37,159, 2, 40,171,237, 62, 79, 79,207,
+115,169,169,169,189,253,252,252,234,181,210,208, 52,141,204,204, 76,223, 62,125,250, 92, 82, 40, 20, 29,154,146,243,105,107,145,
+134,162,142, 85,135,181, 22,116, 0, 85,246, 23,106,210,136,172, 60,161,244,104,255,193,163,134,205,123,239, 3,201,173,196,187,
+248,229,226, 85,148,106,116,160, 72, 18, 30,110, 98,180,111,255, 18,177, 33,250,160,207,206,173, 27,214, 95,139, 59, 59,182, 66,
+163,250,139, 67, 50, 93,204, 89,182,228,245, 62, 18,111, 47, 6, 48, 49,248,231,152,238,146,255, 59,158,176, 12,229,244, 71, 14,
+139,172,243,231,197,133, 5, 5,136, 10, 10, 2,135,166, 33, 36, 73, 8, 9, 2, 66,146,132, 68, 40,196,232, 29, 59,240,249,169,
+ 83,226, 79, 94,121,197, 37,182,254,100,144, 74,165,179,130,130,130,214,110,223,190,221,187,117,235,214,144, 72, 36, 80, 40, 20,
+ 62,105,105,105, 61, 22, 45, 90, 52, 35, 47, 47,239,227,210,210,210,109,174,156,250,243,194,100,194,180,239, 86,190,219, 44,239,
+241,189,102,115, 87,237,107, 79,120, 51, 67,239, 22,107,243, 93, 57, 99, 55,122, 0, 72, 64,205,251,151,214,117,173, 86, 8,133,
+194,130,138,138, 10,191,186,238,225,243,249,133,122,189,222,191, 62, 46,146, 36,131,115,114,114,252,196, 98, 49, 24,134, 49,239,
+ 6, 96,178, 14,164,109,119, 63, 49, 7,170, 69,135, 14, 29, 12,117,113,186,185,185,125, 83, 88, 88, 24, 97,217, 39,208, 70, 80,
+213,136,156,156,156,136, 78,157, 58,125, 83, 86, 86, 54,178, 22,241,242,217,123,239,189,183,176, 75,151, 46, 22, 43,144,121, 23,
+132,202,191,114,185, 28,243,231,207,183,254,134,201,100,194,217,179,103,223,155, 53,107, 22, 74, 74, 74, 22,213,241,236, 45,253,
+252,252, 8,243,134,226,181, 98,249,242,229, 88,190,124, 57,190,254,250,107,130,203,229,122,212,147,159, 78,225,124, 90, 90,164,
+ 33, 22,172,122, 34,195,159, 64, 85,223,172, 19, 79, 8,173,167, 1,138, 43,248, 91,239, 1, 17, 67,231, 47, 92, 34,217,247,243,
+ 5,164,165,252,142,212,203, 63, 84,185,167,215,200, 89,200,151,151, 97,214,188,127, 74, 9,138, 51, 52,238,220,145,191, 25,117,
+218,239,236,180,102,249,183, 20,240,255,222,175, 79,103,110,142, 40, 13, 1,158, 34, 12,236,217,150,219,252,204,157,191,107, 64,
+127,149, 82,185, 74,198, 33,145,181,253,173,183, 48,200,104,132, 31, 69,129, 34, 8, 80, 0, 72,130, 64,133, 78,135,155,211,166,
+161,207,238,221,248,244,216, 49,241,103,175,190,234,144,216,146, 72, 36,183, 8,130,240, 84,171,213, 99, 81,185,177,244,139,128,
+ 78, 82,169,244, 4,203,178, 37, 26,141,166,199,115,148,174, 64, 84,206,209, 87, 31, 29,243, 80,185,162,202,161,157,133, 5, 2,
+193,219, 19, 39, 78,220,176,121,243,102,113, 65, 65, 1,114,115,115,193, 48, 12,132, 66, 33,218,181,107, 71,156, 59,119,206,123,
+201,146, 37,235, 78,156, 56, 33, 40, 43, 43,251,202,145,129, 13,151,203,141,246,242,242,122,197,223,223, 95, 82, 88, 88, 88,174,
+ 84, 42,207,234,116,186,183,209,240,109, 83, 72, 46,151, 59, 53, 36, 36,228,181,160,160, 32,255,156,156, 28,121,118,118,246, 81,
+157, 78,183, 19, 13,220,168,217, 38, 79,187,193, 28,173, 30, 64, 94, 72, 72, 72,210,163, 71,143, 10,157,200,153, 27, 18, 18,146,
+220, 0, 78, 9,128,159, 0, 4,213,115, 95, 46,128,201,112,208,154,109,205, 88,214,116,114,197,198,237,179,163,102, 14, 36,190,
+ 91, 20,209,238,157,175,207, 93, 37,121,236,224,148,188,138, 44,151,134,178, 79,100,153,183,180,170, 46,168,234,186, 86, 39,116,
+ 58,157,175,193, 96, 0,183,150,205,226, 53, 26, 13,220,220,220,124,237, 77,164, 72, 36,194, 15, 63,252, 0, 46,151, 11, 46,151,
+139,146,146, 18, 4, 7, 7, 91,207,121, 60,158,245,115,139, 22, 45,234,229, 99, 24,166, 15, 69, 81, 80,171,213, 96, 24,198,122,
+ 40,149, 74,176, 44, 11,129, 64, 0,134,169,220,206,201,230,122,159,218,248, 8,130,152, 20, 20, 20,132,125,251,246, 65,175,215,
+ 63,113, 93, 38,147, 33, 49,241,143, 77, 70, 40,138, 66,223,190,125, 73,130, 32, 38, 1, 88, 84, 7, 47, 11, 0,145,145,145,160,
+ 40, 10, 20, 69,129, 36, 73,235,103,203,193, 48, 12,150, 47, 95,142,106, 91,147, 61, 53,206,231, 13,245, 68,134,207, 67, 45, 62,
+ 90,100, 19,167,203,118,137,103,144, 88, 34,251,226,221,127,252, 83,122,226,210, 29,100,102,101, 62, 33,178, 0,224,183, 95,118,
+ 34, 47, 55, 7, 9,169,217,152,250,183, 5, 82,153,204,227,139,106, 13,106,173,203, 70,221,221,120, 95,126, 56,121,160, 80,109,
+204, 69,153, 39, 64,181,225,131, 43,214, 96,201,184,110, 2,153, 27,111,173, 61,233, 20,240,249,191,172, 62,119,206, 42,178,194,
+117, 58, 8, 24, 6, 52,195, 88, 69,150,158,166,161,213,235, 17,168, 86, 35, 99,214, 44,176, 70, 35, 62, 62,124, 88, 44,224,243,
+127,177, 39,157, 0,192,227,241, 2,143, 30, 61,218,162,107,215,174, 23, 97,127, 48,211,115, 77,252,142,234, 66,207,238,221,187,
+199,238,222,189,187, 5,143,199, 11,116, 6,167, 80, 40,156, 32,145, 72,138,132, 66,225,132, 6,166,147, 4,176, 98,246,236,217,
+241, 47,189,244,210, 5,179,176,178,138,154,151, 94,122,233,220,236,217,179,111, 1, 88, 94, 75, 89,175,137,179, 89, 80, 80,208,
+202,205,155, 55,139,211,211,211,145,147,147, 3,163,209,136, 55,223,124, 19, 12,195, 64,171,213, 66,175,215, 99,205,154, 53, 18,
+111,111,239,101,168,220, 40,216,158,103,231,185,187,187,167,239,218,181,107,226,195,135, 15,165, 23, 46, 92, 32, 18, 19, 19, 37,
+235,214,173, 27,239,237,237,157, 6, 64,208,128,252, 36, 3, 3, 3,191, 59,114,228,200,187,137,137,137,193,135, 14, 29,226, 94,
+187,118, 45,112,235,214,173,115, 2, 3, 3,119, 3,160, 26,248,142,122,136,197,226, 17,139, 23, 47, 54, 93,185,114, 37,231,202,
+149, 43, 57, 27, 54,108,192,160, 65,131,194,163,162,162,194, 26,200,217,211,205,205,109,248,226,197,139, 77,113,113,113,185,215,
+175, 95,207, 94,183,110, 29, 57,124,248,240,129, 43, 87,174,236,230, 32,231, 79, 87,174, 92, 25,146,149,149,213, 58, 59, 59,187,
+ 85,118,118,118, 72,118,118,118, 72, 78, 78, 78,203,188,188,188, 22,249,249,249,205, 11, 11, 11,155,199,198,198, 14, 4,176,215,
+ 30,206, 80,127,201,187,139,222,140, 40, 95,246,183, 49,236, 71,211, 95,102,151,188, 57,132,125,101,112,215,159, 41, 14,135,184,
+158,156,137, 96,119, 96,231,252,222, 45,155,251, 72, 18, 59,123, 73,219, 63,103,117,243,121,227,228, 88,132,148, 66,161,192,137,
+ 19, 39, 96,182, 94,245,176, 21, 89,165,165,165,200,203,203,179, 92,227,216,147, 78,153, 76,118,126,251,246,237,108, 69, 69, 5,
+ 84, 42, 21, 10, 11, 11,145,149,149,133,140,140, 12, 20, 23, 23,227,238,221,187, 16,139,197,231,237, 73, 39, 65, 16, 96, 24,198,
+ 42,164,206,158, 61,139,217,179,103, 67,161, 80, 88,255,199,225,112,172,159, 45,223,169,143,211, 98,121, 98, 24, 6,215,175, 95,
+199,220,185,115,177, 97,195, 6,236,221,187, 23,199,143, 31,135, 66,161,176,138, 45,154,166,235,229,148,203,229, 48,153,236, 27,
+ 51,177, 44, 11,149, 74,101,247,123,183, 21, 64, 28, 14,231, 9, 81,100, 57, 28, 41, 75,141,228,124,110, 97, 71,100,248,218, 71,
+216,150, 15,102, 83,221,208,166, 74, 36,201,225, 77,157, 52,243, 61,239,236,194, 82,228, 20,168, 64,145,127,244,123, 97, 17, 51,
+193,161, 72,220, 56, 83,105,184, 34, 41, 10, 42,141, 14, 74,181, 1, 19,103, 46,244,250,207,134,127, 77,165, 13, 21,117,198,120,
+233, 2,180,235, 44,149,190,222,169, 83, 11, 50, 69,144,138,176, 87, 46,131, 49, 1,108,220,171,232, 81,226, 71,117,248,133,255,
+186,166,204,176, 50, 17, 72,175,211,154,225,225, 33,242,236,214, 13, 81, 65, 65, 24,108, 52,130,199,178,120,185,160, 0,191, 47,
+ 92, 8,221,193,131, 32, 1,240, 38, 76,192,176,141, 27,113, 41, 40, 8, 1, 90, 45,148,239,191, 15,223,211,167,193,147,201, 68,
+ 40,178,111,241, 3, 65, 16, 24, 58,116, 40,206,157, 59,231, 61,122,244,232, 51,119,238,220,121,131,166,233, 75, 13,201, 91,119,
+119,247,223, 56, 28, 78,112,125,247,209, 52,157,173, 82,169, 28,222,102,132,195,225, 12,238,219,183,239,225, 67,135, 14,121, 26,
+ 12, 6,167,140, 66,248,124,254,232,241,227,199,111,255,246,219,111,101,115,230,204,217,126,252,248,241,114,189, 94,127,218,145,
+ 34, 5, 96,197,182,109,219,222,137,140,140,244,152, 51,103, 14,155,145,145, 97,107,189,242, 29, 52,104,208, 75,219,183,111, 15,
+232,221,187,247,123,115,231,206,229, 1,248,184, 62, 43,143, 84, 42,157,183,125,251,118, 31,185, 92, 14,181, 90,109,109,100,179,
+179,179, 33, 18,137, 64,146, 36, 72,146, 4,151,203,197, 23, 95,124,225, 61,111,222,188,133, 10,133, 98,161, 29, 86,178,232, 45,
+ 91,182,248,142, 28, 57,146,124,248,240, 33, 72,146,132, 80, 40,196, 91,111,189, 69,106,181, 90,207,168,168,168, 24,141, 70, 51,
+197,145, 60,228,114,185, 83,163,163,163,219,135,135,135,115, 82, 83, 83,209,191,127,127,220,184,113, 3, 19, 38, 76,224,150,149,
+149,181, 90,178,100,201,108,157, 78,231,104, 28,151, 64,177, 88,220,229,191,255,253,111, 86,243,230,205,173, 13, 75,171, 86,173,
+152,177, 99,199, 42, 82, 83, 83, 67,175, 92,185, 82, 60, 96,192, 0, 71, 54, 44,111, 38, 22,139, 59,156, 60,121, 50, 47, 42, 42,
+106,196,182,109,219,198, 3, 64,159, 62,125,142,126,254,249,231, 23, 20, 10, 69,231, 75,151, 46, 41, 6, 15, 30,156,109, 39, 95,
+ 80, 96, 96, 32, 51,127,254,124,105, 93, 55,237,216,177, 67,137,202, 13,151, 91, 3,168,115,191,182,208,144,128,101,107, 23, 78,
+ 18,129, 49,128, 53,106, 1, 67, 57, 96, 80,195,164, 47, 7,193, 19, 1, 70, 45,124, 5, 10,252, 52, 47, 84,182,116,223,253, 20,
+230, 46, 49, 54, 85, 94,118, 26, 46,212,216,212, 0, 8, 35, 8, 34,225,196,137, 19,232,219,183, 47, 78,156, 56,129,177, 99,199,
+ 38,216,138,129,196,196, 68, 12, 30, 60, 24,102,139,150, 93,190, 90, 42,149,234,195,229,203,151,199, 77,157, 58, 85, 92,165, 49,
+ 32, 73,120,120,120, 96,204,152, 49, 21, 26,141,230, 67,123, 19,202, 48, 12, 56, 28, 14,178,179,179,177, 99,199, 14,172, 90,181,
+ 10,237,218,181,131,209,104,124, 66,108,153,219, 61,187, 26, 63,154,166,113,243,230, 77,236,217,189, 27, 31, 47, 91, 6, 55, 55,
+ 55, 0,128,193, 96,128,162,164, 4, 66,161,208, 42,198,234, 17, 78,251,239,221,187,183, 48, 56, 56,184,202,148,161,229,175,185,
+205,130,201,100, 2, 77,211,168,168,168,192,134, 13, 27,104,150,101,247,215,215,255, 88, 68,209,194,133, 11,161,211,253, 97, 80,
+239,102,246, 73, 14, 9, 9, 65,247,238,221,173,231, 36, 73,178,246,114,254,103, 64, 23,104,109,238, 14, 93,190, 14, 0, 16, 28,
+ 28,140,208,208, 80, 4, 6, 6,214,202,217,212, 90,164, 33,112, 32, 50,124,237, 66,235,105,236,148,205,229, 9,135,181,105,219,
+158,200,204, 83,128,195,225, 64,226,238,131, 1,175, 45, 2, 69,145,144,122,248,128, 96,180,127, 40, 98,146, 2,135,226, 64, 81,
+166, 69, 72,235,182,164, 64, 40, 26,166,169, 71,104,201,220,185, 91, 22, 79, 25, 32, 44,166,179, 33,106, 33, 4, 99,233, 78,131,
+248, 32,189,203,240,193,232,118,162,200,163,119,182, 64,101, 28,110, 79,122, 41,154,134, 31, 69,193,192,178,248,125,225, 66,132,
+ 69, 71, 35,193, 34, 12,163,163,145, 16, 25, 9, 47, 46, 23, 2,146, 4,107, 52, 62, 49,167,111,143,208, 2,128,172,172, 44, 28,
+ 60,120,208,107,210,164, 73,135, 19, 19, 19,167, 58, 40, 54, 44, 92, 62,215,175, 95,247,107,221,186,117,173,247, 60,120,240, 0,
+189,122,245,114,120,122,138,207,231,143, 30, 62,124,248,190,131, 7, 15,186, 39, 39, 39,195,207,207,175,209, 66, 75, 32, 16, 12,
+142,136,136,216,183,107,215, 46, 89, 81, 81, 17,162,163,163,101,175,190,250,234,222,248,248,248,215,116, 58,157, 61, 98,179,138,
+200,138,142,142, 86,238,216,177,227, 63,168, 58, 69,152,183, 99,199,142,239,122,247,238,253,110,100,100,164, 7,128,119,204,190,
+ 3,117,138, 45,129, 64, 48,180, 77,155, 54, 85, 70,181, 2, 65,165,177, 73, 34,145,192,221,221, 29, 60, 30, 15, 58,157, 14, 97,
+ 97, 97, 4,159,207, 31,104,207, 51,187,185,185, 69,188,254,250,235,228,229,203,151,145,159,159, 15, 15, 15, 15, 72,165, 82, 48,
+ 12,131, 57,115,230, 80, 27, 54,108, 24,170,209, 56, 54,195,213,188,121,243,241, 35, 70,140,224, 36, 37, 37,225,225,195,135,208,
+233,116, 72, 75, 75,131, 76, 38,195,244,233,211,121,107,215,174,125, 53, 39, 39,199, 81,161,213, 37, 50, 50,178,192, 86,100, 89,
+ 32,145, 72,136,246,237,219, 43,188,189,189,123, 2,112, 68,104,117, 89,176, 96, 65,225,234,213,171, 7,159, 59,119,206, 26,244,
+242,220,185,115, 75, 0,224,171,175,190,138,243,245,245,237, 9,192, 94,161, 5,150,101, 77,127,253,235, 95, 31,243,249,124,112,
+185, 92,240,249,252, 42, 7,143,199, 3, 73,146,110,150,234, 92, 31, 95,202,195,252, 53,115,150,172, 91, 39, 17, 82,220,127,188,
+214, 21, 45, 60,120,128,200, 11,188,193, 75, 65,120, 84, 26, 45, 89,197, 3,224,151,165, 88,255,186,130,140,252,190,226,103, 3,
+227,233,123,191,164,164,236, 25,247, 1,189, 1,252, 27,149,155,235, 46, 3,112,253, 57,233,155,110, 1, 8, 27, 59,118,172, 85,
+108,157, 58,117, 10,163, 71,143,134, 82,169, 68, 82, 82,146,173,200,114,100,131,229, 91, 70,163,241,246, 15, 63,252, 48, 96,210,
+164, 73,132, 77,253, 66,114,114, 50,238,222,189,155, 96, 47, 31, 73,146, 48,153, 76,224,114,185, 88,183,110, 29, 12, 6, 3,190,
+255,254,123, 28, 56,112, 0, 36, 73,130, 32, 8, 16, 4, 1,153, 76,134,175,191,254,218,161,118,143, 97, 24,196,196,196, 96,233,
+146, 37, 86,145,101,158,201, 64,128,191, 63,188,125,124,112,255,254,253,122,133, 86, 73, 73,201,167,199,142, 29, 67, 93,206,240,
+199,142, 29,179,126,174,230, 12, 95,127, 63, 71, 81,208,233,116,120,249,229, 63,182,138, 93,176, 96,129,245,179, 66,161, 0, 69,
+ 81,150,188, 32,236,229,212,178,192,107,194, 63,254, 55,230,131, 15,170, 88,232,106,227,124, 26, 90,196, 89,214,173, 26,196, 86,
+152,217, 58, 27, 8, 96, 44, 42,125,180,242,128,167,232,163,197,178,166, 14,193,205,130,112, 59, 35, 17, 28,138, 2,223,221, 7,
+238, 94,254, 48,209,122,168, 10, 31,226,226,161,111, 0, 0,219, 98,246,131, 36, 73,112, 56, 20,116,122, 6,237, 90, 4,193,100,
+ 50,117,168,139,187, 35, 48, 96,168,191, 79,223,230, 45, 61,136, 36,207,135,104,239,231, 93,109, 34, 68,128,118,185, 82,162,191,
+ 84,212,167, 68, 85, 58, 32, 5,184, 82,175, 24, 32, 73,144, 4, 1, 49,143, 7,221,193,131,149, 94,155,209,149,125, 86, 66,100,
+ 36,200,159,127,134,155, 64, 0,138, 32,192, 49,155,160, 27,130,210,210, 82, 16, 4,129, 61,123,246,120, 78,159, 62,125,111, 82,
+ 82, 82,100, 69, 69,197, 65, 71, 56,148, 74,229,216,240,240,240, 11, 49, 49, 49,190, 1, 1, 1, 79, 92,207,207,207,199,204,153,
+ 51,139,148, 74,165, 67, 65,221,132, 66,225,132,241,227,199,111,223,185,115,167,236,222,189,123, 80,171,213,240,245,245,109,108,
+ 81,232,217,175, 95,191,195, 7, 15, 30,116,207,207,207,135, 74,165,130, 78,167,195,158, 61,123, 60,198,140, 25,115, 48, 53, 53,
+117, 52,128,248,122, 56, 62,177, 21, 89,115,231,206,189, 3,192, 15,192,150,234, 26,212,124,173,171,141,216, 82, 1, 88, 91,199,
+ 72,180,165, 68, 34, 65, 97, 97, 33,102,206,156,137,244,244, 63, 12,160, 65, 65, 65,214,145,222,253,251,247,225,235,235, 11,130,
+ 32,252,236,121,104, 95, 95, 95,169, 94,175,199,236,217,179,145,149,149, 85,133, 51, 59, 59, 27, 4, 65,136, 29,205, 72,127,127,
+127,127,173, 86,139, 65,131, 6,161,162,162,114, 95,223,201,147, 39,131,203,229,162,176,176, 16, 92, 46,215,167, 1,239,199,103,
+236,216,177,181,134, 86,145,201,100, 6, 79, 79,207,142, 14,114,122,191,250,234,171, 57,209,209,209, 79, 44,108,185,113,227,198,
+ 95,188,188,188,206,121,121,121,181,119,144,211,100, 43,170,120, 60, 94, 21,161,197,229,114, 65,146,164,221, 62,106,233,133,154,
+205, 28, 34,175,251,234,249, 35,103,182,240,115, 7,171, 46, 0,111,248,167,184, 93, 36,194,186, 13, 39, 1, 0,255,124,171, 23,
+186, 69,172,128,126,231, 72, 44,236, 79,241,167,101,235, 22, 3,248,228, 25,183,249, 95, 2,176,172,130,251, 22, 64,247,231,168,
+ 63,178,138,173, 83,167, 78,161,115,231,206, 40, 41, 41, 65,106,106,106, 67, 69,150,165,189, 91,250,217,103,159,253,242,198, 27,
+111, 72, 44,131, 86,145, 72,132,247,223,127, 95,171, 86,171,151, 58, 84,136, 76, 38,112, 56, 28,235, 32, 89, 40, 20, 34, 44, 44,
+204, 42,178, 8,130, 64,121,121, 57, 56, 28,142,101, 69, 34, 97,103, 26, 17, 24, 16, 0, 55, 55, 55,180,109,215, 14,247,204,237,
+136,229,179, 64, 32, 0, 65, 16,160,233,122, 13,121,101,102,167,246, 69,206,238,146, 45,162,168, 78,211,113, 80, 16, 76, 38,147,
+ 69,100,178,206,224,244,241,241,129, 90,173,182,151,243,185, 68, 45, 22, 45,139,208, 26,139, 74, 95,173, 39,194, 59, 12, 1,112,
+ 17, 77,184,164,146, 0, 75,152, 88, 22, 28,138, 52,207,221, 82,160, 40, 18,138,162, 60,108,252,244, 29,179,200, 58,128, 19,113,
+169, 8,110,211,249,143,121, 92,130, 0,216,186, 11,183,175, 59, 47,122,222, 27,253, 68, 5, 68, 30, 60,130,196, 16, 10,171,233,
+ 71, 79, 30,136, 16, 18,243,135, 6,139,111, 30,171,136, 78, 81, 25,234,237, 40,132, 36, 89,233,252, 78, 16, 53, 58,247,144,230,
+107, 20, 65,128,101, 89,176, 38,199,252,142, 45, 66, 94, 36, 18,193, 96, 48,128,162, 40,108,218,180,201, 35, 34, 34, 98,139,163,
+ 66, 11, 64,114, 65, 65,193,152, 57,115,230,156,218,191,127,191,143,143,143, 79,149,209,195,156, 57,115,228, 5, 5, 5, 99,224,
+160,211, 61,151,203,221,242,237,183,223,202, 30, 61,122,132,242,242,114,136, 68, 34,107,227,211,208,242,217,167, 79,159, 51,167,
+ 79,159,246, 84,169, 84, 48, 24, 12, 16,137, 68, 96, 89, 22, 20, 69,225,199, 31,127,244, 30, 55,110,220,201,204,204,204,225,117,
+165, 85, 36, 18,189,102, 22, 78,136,140,140,244,136,140,140, 28, 2,212, 26,169,215,138,200,200, 72,143, 69,139, 22,189,170,213,
+106,215,214,241,204, 89, 10,133, 34, 64, 36, 18,225,208,161, 67,144, 74,165, 16,139,197, 8, 10, 10,130, 66,161,128, 88, 44, 6,
+203,178, 48, 26,141,150,198,162,216,158, 7, 47, 42, 42, 82,211, 52,237,126,234,212, 41, 20, 23,255,241,149, 22, 45, 90, 64,169,
+ 84,194,100, 50,149, 59,154,153,185,185,185, 5, 4, 65, 52,191,125,251, 54, 30, 61,122,132,209,163, 71,227,231,159,127, 70,175,
+ 94,149,179,195,122,189,190, 33, 65,252, 24,138,162,216, 58,202, 45, 1,192,211,153,156,230,206,203, 33, 78,147,201,100,178,136,
+ 44,219,191,182,226,171,158,223,172, 82,157, 59,250, 75,119,172,158, 55, 98,230,200,206, 62,208, 22, 61,132,208,205, 7,132, 71,
+ 8,214,109, 56,137,164, 7,149,239,107,221,222,223,176, 47,106, 12, 32,242, 66,168,187, 28, 1,110,156,215,239, 22, 62,115,161,
+229,110, 59, 78,120, 94, 59,166,209,163, 71, 67,161, 80, 64, 42,149, 58,195, 63,231,170, 86,171, 77, 59,114,228, 72,207,177, 99,
+199,130,207,231, 35, 45, 45, 13,241,241,241,169, 0,174, 58, 42,180,184, 92, 46, 62,251,236, 51,188,243,206, 59,240,247,247,199,
+210,165, 75,193,225,112,172, 7, 65, 16, 86, 11,151, 35,240,243,175,123,225,163,197, 33,190, 62, 99,184,187,187,251,103, 36, 73,
+ 78,162,236,200, 56,134, 97, 24,147,201,180, 95,165, 82,213, 25,222,193,226,184,110,207,187,176,205,131,122,250,180, 70,115, 62,
+ 13, 45,210, 16, 84, 95,109, 88,139, 69,203,178,234,240,137,173,128, 44, 79,121,209,108,178,187,216, 84, 9, 37, 72,234,110,118,
+ 78, 46,188, 61,165,102,145,101, 62, 72, 18,221, 58, 87, 14,102, 79,196,165, 34,184,117,103,112, 40, 10, 28,138,130, 84, 36, 64,
+ 65,126, 30, 56, 28,242,110,109,188, 93, 40,188,241, 70,251,230, 33,158,222, 92,200,125,245, 8,244,175,197, 48,208,211, 13,193,
+129,124,140,242, 22,182,236, 66,225,141,186,173,111,172, 85,104, 25,104, 26,188, 9, 19,172,211,133, 9,145,145, 8,139,142, 6,
+ 51,126, 60, 52, 6, 67, 21, 83,113, 67,133,150, 72, 36, 66, 89, 89, 25,166, 78,157,170, 48, 26,141,239, 54, 48,139,227,139,139,
+139, 39, 78,155, 54,173,216, 34, 96, 12, 6, 3,166, 77,155, 86, 92, 92, 92, 60,209, 14, 43,209, 19, 48, 26,141,239,246,234,213,
+ 75, 33,151,203,173,233,108, 72,131, 99,129,151,151,215,137, 29, 59,118,120,233,116, 58,208, 52,109,229, 20,137, 68,160, 40, 10,
+190,190,190,216,183,111,159,175,151,151, 87,157,123, 86,105,181,218, 35,209,209,209, 74, 0,136,142,142, 86, 18, 4, 17, 75, 16,
+196, 86,130, 32,190,173,118,108, 37, 8, 34,214,246, 94,173, 86,123,184, 46,110,189, 94, 31,155,154,154,202,138,197, 98, 80, 20,
+ 5,131,193, 0,161, 80,104, 53,137,151,150,150, 66,171,173,156,230,142,143,143,135,209,104,188,108,207,179,151,149,149,157,143,
+137,137, 49,181,104,209, 2,157, 59,119, 70, 88, 88, 24,250,245,235,135,150, 45, 91,226,243,207, 63,103, 52, 26,141,195,117, 47,
+ 55, 55,247,196, 79, 63,253,100,108,222,188, 57,122,246,236, 9,129, 64,128,110,221,186, 33, 40, 40, 8,171, 86,173,210,171, 84,
+170, 83, 13,120, 77,153,137,137,137, 84, 29, 34, 87, 6, 59, 86,239, 86, 67,214,205,155, 55,169,126,253,250, 29,173,126,161, 79,
+159, 62, 71,165, 82,169,187,197,196,238,200,136,220, 86, 92, 9, 4, 2,235, 97,249, 63,135,195,177,103,244, 67,118,244,151,238,
+248,226,157, 97, 51, 71,118,246,196,209,243,215,193, 51, 40, 1,125, 29, 51,130,140, 17, 4, 79, 2,127,119,110,240,115,208, 7,
+ 44, 4,112, 7,149,113,152,150,226,249,130,213,241,189,184,184, 24,169,169,169,136,143,143, 71,191,126,253,112,249,242,101,224,
+ 15, 7,121,135,161, 82,169,150, 70, 69, 69,105, 44, 43,249,150, 45, 91,166, 45, 43, 43, 91,234,104, 27,204,178, 44,184, 92, 46,
+ 66, 67, 67,177,104,209, 34,156, 60,121, 18,105,105,105, 48, 26,141, 86, 33,100,241,201,116,196,162,197,227,241,224,239,239, 15,
+163,209,104,181,102, 1,192,189,244,116,112, 56, 28,152, 76, 38,232,245,250,122, 45, 90,238,238,238,159,109,223,190,253, 61,185,
+ 92, 30, 88, 84, 84,228,103,123, 20, 20, 20,248,229,229,229,249,229,228,228,248,101,101,101,249, 61,126,252,216,239,225,195,135,
+129,107,214,172,121,207,221,221,253, 51,123,210, 73, 81, 20,186,117,235,134, 5, 11, 22, 88,143,205,155, 55, 91,143,139, 23, 47,
+ 58,236,188, 78, 81, 20, 66,151,175,195,152, 34,214,122,156,244, 37,172, 71,210, 63,231,214,197,217,228, 90,164, 65,250,197,188,
+218,208,118, 99,233, 26, 96, 89,117,104,105,203,172,110, 27,213,157,225,155, 12,180,190,226,194,131,140,244, 97,161, 93,122,147,
+249,114,117,149,229,159, 97, 67, 39,130, 32, 8, 52,107,221, 25, 20,135, 3,138, 34,193,161, 40,120,200,132, 72,189,125,219,164,
+211,106, 47,212,196, 57, 4,224,240, 69,252,205,111,141,234, 38,204,229, 23,194, 55, 80, 2, 30,183, 82, 59,178, 15, 38, 86,235,
+ 33, 56, 64, 23, 55,204,202,241, 22, 93, 40,168,216,236,169, 49, 28,141,173,101, 4,104, 50,153, 32, 21, 8, 80,161,211, 65, 75,
+211, 24,186,113,163,117,186,144, 36, 8,220, 2,208,117,227, 70, 92, 57,120, 16, 50, 62, 31, 16, 8,236, 94, 21, 82,147,208,146,
+203,229,152, 49, 99, 70,113, 94, 94,222,244,134,248,104, 89,160,211,233, 46,229,231,231, 79,159, 56,113,226,158, 67,135, 14,121,
+ 77,156, 56, 81,145,159,159, 63,221, 78,191,167, 39, 80, 81, 81,113, 48, 43, 43,171,124,198,140, 25,187,247,238,221,235,237,227,
+227, 99, 29,137, 52,168,176, 18,132,124,196,136, 17, 2,123,238,171,231,150, 40,179,115,251, 59,102,203, 86,215,185,115,231, 94,
+ 65,165,255,149, 45,150,111,219,182,109,178,205, 20,227, 86, 0, 27,235, 34, 46, 45, 45,253,118,209,162, 69,127,187,116,233,146,
+143, 80, 40, 4, 65, 16,224,241,120,104,219,182,173,117, 21, 13,151,203, 5,203,178,248,224,131, 15,228,133,133,133, 95,217,249,
+110,230, 70, 69, 69, 13,174,168,168,240,156, 49, 99, 6, 37, 20, 10, 81, 80, 80,128, 13, 27, 54, 48, 59,119,238, 84,106, 52,154,
+153, 13, 16,194, 49,255,250,215,191,134,170,213,234,214,115,230,204,225,169, 84, 42,104,181, 90, 44, 94,188, 88,255,221,119,223,
+101,107,181, 90,135, 3,254,246,239,223, 63,227,241,227,199, 3,203,203,203, 75,196, 98,113,117,107, 31, 33,145, 72,122, 3,216,
+237, 8,103, 88, 88,216,253,204,204,204,126, 43, 86,172,136, 53, 26,141,220, 27, 55,110, 88,157,225, 55,109,218,116, 81, 40, 20,
+142,128,131,155,175, 18, 4, 97, 18, 8, 4, 85, 44, 88,213, 63,115, 56,156,122,219,180, 14, 1,226, 21, 95,188, 61,120,230,203,
+ 29,221,113,228,252,111,136, 58,252,224,110,187,153,190,161, 47,121, 22,193, 84,148,138,127,190,213, 11,235,246,254, 6,160,114,
+234,208, 84,152, 4,182,228, 62, 88,183,230,120,168,144,231, 62, 7,125,192, 69, 84,134,204,120,222, 80, 69,100, 37, 37, 37, 97,
+216,176, 97, 0,128,203,151, 47, 35, 60, 60, 28,151, 47, 95,198,192,129, 3, 29,142,165,101,198,127, 75, 75, 75, 31, 95,188,120,
+177, 83,243,230,205,113,245,234,213,135, 0,254,235,104, 34, 45, 66,139,195,225,224,205, 55,223, 68, 68, 68, 4, 90,180,104, 81,
+101,181,161,229,179, 35, 98,131,166,105,116,233,210, 5, 58,189, 30, 60, 30,207, 58, 53,201,225,112,224,235,231,135,140,140, 12,
+187, 44, 90, 36, 73, 78,122,237,181,215,200,228,228,100, 76,153, 50, 5,123,246,236,169,245,222,105,211,166,225,135, 31,126,192,
+107,175,189, 70,126,244,209, 71,117,134,119,176, 56,161,219,243, 76,150,126,186,190,118,223, 89,156, 77,173, 69, 26, 3,155,208,
+ 14, 53, 78,154,212,240,191,232, 42, 66,203, 38, 72, 88,211, 8, 45,218,176,231,231,239,191, 89,212,111,203, 64,223, 64, 63,119,
+ 40, 84, 90,171,216, 74,184,120, 0, 0,240,198,220,149,224, 80,149, 83,138, 50,169, 16, 34, 30,133,131,187,190,146, 27, 12, 21,
+ 53,150,174, 50, 46,249,206, 71, 3,218,186,243, 37, 70,148, 6,176,232,236,251,199, 78, 57, 68,235, 3, 79, 10,174, 30,158,240,
+ 73, 42,193, 91, 47, 73,101, 95, 37, 43,223,129,209,180,249,137, 14, 81,169,212, 42,111,223, 22,141,222,190, 29, 55,166, 79, 71,
+ 51,134, 65,108, 80, 16,188,184, 92,184, 11, 4, 32, 9, 2,218,227,199,113,229,208, 33,248, 11, 4,128,155, 27,232,207, 63,135,
+ 46, 53, 21,198,178, 50,109, 3, 70,102,152, 60,121,178, 92, 46,151, 79,212,235,245,151, 26,155,207, 90,173,246,116, 86, 86, 40,
+104, 68,151, 0, 0, 9, 69, 73, 68, 65, 84,214, 59,253,251,247,223, 98, 52, 26,223,213,106,181,141, 90, 25,165,215,235, 79,231,
+231,231, 79,152, 60,121,242,129,195,135, 15,251,120,120,120, 52,152,171,184,184,184,151,147,138,147, 9,192,199,102,231,246,119,
+ 34, 35, 35, 61,110,222,188,249,183, 29, 59,118,108,177, 25, 77,248,205,158, 61,251,237,106, 34,171,222, 85,135, 0, 50, 11, 11,
+ 11, 63,127,255,253,247, 87,174, 95,191, 94,106,113,124,255,253,247,223, 65,211, 52,184, 92, 46, 24,134,193,236,217,179,213,197,
+197,197,235, 80,123, 68,231, 39,138, 86,105,105,105,219, 21, 43, 86,236,216,184,113, 99, 4, 69, 81, 18,134, 97, 52,229,229,229,
+177, 21, 21, 21, 51,209,176, 56, 90,166,162,162,162, 25,159,124,242,201,140, 13, 27, 54,188, 70,146,164, 31, 77,211,242,178,178,
+178, 99, 90,173,246, 59, 52, 96, 42,233,234,213,171, 69,111,189,245,214,131,162,162,162, 14,193,193,193, 42,169, 84,170,215,235,
+245,148, 72, 36,146, 73, 36,146, 48, 0, 87, 9,130, 72,113,132, 51, 33, 33, 33,127,206,156, 57,143,116, 58, 93,232,214,173, 91,
+227,100, 50,217,121,130, 32, 8, 30,143,231, 41, 18,137,134, 1,136, 37, 8,226,158, 35,156, 36, 73,154,108,173, 87,213,253,179,
+248,124,190, 93, 62, 90,173,125,197,179, 34,218,114,112,228,194,111,136, 58,146, 25,195,176,236,161, 67, 9, 37,199,151,134, 3,
+134,253,111,161,219,196,221,149,211,133, 0, 76,133, 73, 48,236,159, 6, 66,236,131,184, 28, 46, 84, 90,195, 9,184, 80, 19,172,
+225, 29,228,114, 57,146,147,147, 45, 34, 43, 12, 0, 6, 14, 28,152, 96, 17, 91,241,241,241,232,217,179,103, 2, 0,174,163,229,
+181,180,180,244,253,169, 83,167,158, 54, 15,142,223,111,192,192,207, 42,180, 44,130,170, 69,139, 22,214,115,219,195,198, 71,203,
+ 46, 48, 12, 3, 30,143, 7, 14,135,131,192,160, 32,235,111,177, 44,139,140,140, 12, 40, 20, 10,187,132, 22, 69, 81, 20, 65, 16,
+152, 50,197,190, 5,201,127,253,235, 95, 17, 27, 27, 11,202, 78, 85, 72, 81, 20, 66, 66, 66,234,189,199,162, 75,237,229, 12, 14,
+ 14,110, 48,103, 83,107,145,134, 10,172,154, 62,215, 36,170,106,171, 16, 79, 11,185,106,181,234,227, 93,219, 55,173,159, 61,239,
+ 3,105,210,253, 2,168,212, 58, 80, 20,105,219,120,130,195,161, 32,147, 8,209, 60,192, 29,123,255,243,239,178,178, 82,229, 39,
+168,101,223,195, 22,110,188,185, 35,122,191, 36,224, 5,106, 16,218,117, 50, 40,225, 31, 34,128,205,175,101,118, 48,252, 23,188,
+146,169, 17,254,156,169,153,123,171, 68,255,164,208,210,235, 71, 46, 27, 53,234, 76,212,201,147,226, 62, 49, 49,184, 63,123, 54,
+130,180, 90, 8,204, 83,137, 36, 65, 64,202,227, 65,202,227, 85,138,172, 13, 27,160,165,105,108,156, 62,189, 92,167,215,143,114,
+164,146, 23, 23, 23, 99,252,248,241, 69,185,185,185, 99,208,128,169,189,218,160,209,104, 14, 2, 56,232, 44, 62,157, 78,119, 41,
+ 59, 59,251,149,241,227,199,159, 60,125,250,180,239,115, 18,100,206, 34,182, 12, 55,111,222,124, 59, 46, 46,238, 62,170,110, 44,
+170,140,139,139,187, 63,103,206, 28, 98,199,142, 29,223, 1,248, 23,236, 12,224,169,209,104, 54,157, 61,123, 22,131, 7, 15,254,
+215,234,213,171,189,123,245,234, 5, 63, 63, 63,148,149,149, 33, 62, 62, 30, 11, 23, 46, 84,148,150,150,174, 86, 42,149,235, 29,
+ 76,179, 65,167,211, 77,179, 93, 74,237,140,124,208,233,116, 59,243,242,242,118, 58,139,112,254,252,249,191,103,100,100, 20,251,
+250,250,246,229,241,120, 93, 81,233, 7,148, 15,224, 59, 71, 5,145, 5,243,230,205,187,157,145,145, 33,111,214,172, 89, 63, 51,
+167, 7, 42,183, 49,218,222, 0,206,220,223,126,251, 45,184,119,239,222, 36,151,203,101, 41,138, 2,151,203,101, 57, 28, 14,107,
+246,171, 97, 1,224,216,177, 99, 2, 0,117,110,155,115,191, 80,187, 98,218,191,127,253, 40, 37,191,226, 80,106, 65,249, 34, 0,
+236,254, 36,241, 47,221,124,169,145, 35,219,103, 67, 23, 61, 16,132,172, 50, 80, 37,171,206, 3, 33,241, 71,182,169, 25,150, 31,
+189,155, 79,131, 88,235,210, 84, 53,143,171, 97, 14,239,144,151,151,103, 43,178, 44, 86,171,176,129, 3, 7, 38,152, 69,150,229,
+ 90, 67,252,203,206,153, 76,166, 70,245, 97, 44,203, 34, 42, 42, 10,219,182,109, 67,125, 17,205,205,171,251,136,250,248, 44, 22,
+ 45,134, 97, 96, 48, 24,144,148,148,100,141,217,101,153, 46,180,132,118,160,105,186,206,213,234, 12,195, 48,122,189, 30, 63,254,
+248,163, 93, 98,107,223,190,125,168,168,168, 0, 83,143,130,179, 13,197,208,189,123,119, 40, 20, 10,235, 98,159,176,176, 63, 66,
+229, 25, 12, 6,135,132,171,133, 51, 52, 52, 20,114,185, 28, 22,127,225,230,211,255, 48,246,208, 26,205,159,181,220,215,106,209,
+122,234, 61,166, 64, 44, 59,221,107, 64, 68,248,244,183, 23, 74,212, 58, 6,143, 30, 61, 70, 81, 97, 30, 72,130, 68, 96,179, 96,
+180,108, 25, 2, 17,159,196,158,232,245,154,132, 43,231,127, 85,151,149,140,174,141,107,172, 59,239,202,134, 9,225,253,218,180,
+113, 35, 64, 27, 1,198, 8,208, 70,192,100,254,107,249,159,169,106,153, 75, 78, 86,178, 31,221, 82, 92, 59,161, 50,212,184,103,
+213, 68, 32,220,195,203,235,204,242, 99,199,196, 38,131, 1,197,239,191, 15, 49, 77, 67,104, 30,149, 84, 62,136, 0,244,231,159,
+ 87,138,172,105,211,202, 85, 74,165, 67, 91,240,248,248,248,252, 70, 16,132, 79, 81, 81,209, 11, 21, 25,222,215,215,247, 4,203,
+178,114,185, 92,222,235, 57, 74,151, 31, 0, 37, 0, 67, 13, 3, 9, 95, 56,238,255, 99, 65,136,175,175,239, 71, 36, 73,246,103,
+ 89,214,155, 36,201, 18,147,201,116,181,176,176,112, 13,128, 12, 87,127,250,204, 96,137, 12,223,170,158,251, 10, 1,252, 3,149,
+ 78,193,143,236, 37,239,230,238,238,174,227, 27, 15,255,165,179, 96,232,164, 48,119,180, 14,112, 3,151, 39, 68,110, 41,141,115,
+ 41,165,216,126, 49, 63, 75,107,100,198,165, 23,149, 39,186, 94, 69,157,112,250, 22, 60,206,132,151,151,215,245, 51,103,206,244,
+106,221,186, 53,105,235,240,110,137,149,103,153,222,226,112, 42,181,220,165, 75,151,232, 41, 83,166, 92, 45, 40, 40, 24, 92, 27,
+167,155,155,219, 47,119,238,220,121, 89,165, 82, 61, 33,168,108, 35,197, 91,206, 53, 26, 13,230,205,155,119,182,182, 45,120,220,
+221,221, 55,172, 95,191,254,189, 55,222,120,131,180,132,163,176, 61, 44,219, 5, 89, 14,131,193,128,221,187,119,155,190,250,234,
+171,175, 85, 42, 85,173, 83,135,129,129,129, 89,185,185,185,193,150, 80, 11,246, 4, 21, 13, 9, 9,201,123,252,248,113,208,211,
+228,124,129, 5, 87, 21,235,214, 51, 49, 77,112, 69,162,249,110, 82,207, 79,223,152,186,192, 59,164, 77, 59,194, 63,176, 25, 8,
+144, 40,200,207,193,227, 7,233,236,225,239,191, 41,214,148, 42, 62,211,106, 53,223,212,197,211, 17,104,211, 74,198,219,207,103,
+208, 30, 22, 1, 84,109,127,170, 39, 70, 28, 0, 12, 92,242,238,163, 50,227,228,148, 58,166,125, 44, 98,235,227,195,135,197,252,
+246,237,159, 8, 20,103, 50,153,160, 75, 77,197,198,233,211, 29, 22, 89, 46,184,224,130, 83,208, 26,245,199,200, 50,162, 50, 62,
+151,163, 22, 19, 34,212, 79, 50,153, 5, 38,145, 48,117, 33, 9,130, 79,179, 72, 3,139, 95,196,156,242, 45, 9,121,208,186,178,
+223, 46, 60,183,155, 74, 3,144,120,121,121,157,167, 40,170,165,197, 34, 99,107,173,175, 97, 67,233, 71, 5, 5, 5, 35, 0,212,
+181, 66,184,141,155,155,219, 55, 12,195,244,177,103, 83,105,138,162,110,148,149,149,205, 71, 29,155, 74, 55,197,170, 67,111,111,
+239,140,199,143, 31,183,177,172,162,182,237, 43,107, 90, 89,126,239,222, 61, 12, 25, 50,228,113,126,126,126,200,211,228,124, 94,
+ 81,203,170,195,231,199,162,101,131, 32,158, 64, 58,131, 47, 18, 14, 55, 25,233, 80, 16, 0,135,203,189,171,175,208, 94,208,105,
+213,187, 80,203,116,225,211,196, 68, 32, 92,192,231,255,194,147,201, 68, 53,137, 54, 99, 89,153, 86,167,215,143,116,137, 44, 23,
+ 92,112,193, 5, 23, 94, 32,180,247,242,242, 58,195,229,114, 5,182, 98,178,250,103, 11,104,154,174, 40, 42, 42, 26, 13, 32,237,
+ 41,115,254,111,194, 65, 39,181, 8,123, 57,205,199,144,231,157,179, 9,159,157,117, 34,231, 16, 51,231,242, 23, 36,157, 67,158,
+ 87, 78,203,243, 58,192, 27,225, 72, 57,114, 86,126,218,164,147,117,118, 58,155,138,211, 89,245,168,134,116,178, 77,240,222,151,
+191, 32,233, 28,242,188,113, 86, 47, 63,118,242, 58,196,105,103,153,114, 52,157,172,179,211,217, 84,156,141,173, 71,117,164,147,
+109,108, 89,170,229,221, 47,199, 11,136,228, 30, 96,147,123,128, 77,234, 89, 99,220,198,200,218,190,231,144, 35, 97, 83,173, 4,
+176,132,221, 55,243, 19,207, 43,167,109, 62, 56,115,171,128, 38,216,118,224,162,179, 57,171,229,167,179,176,220,188,194, 36, 22,
+118, 4, 28,117,228,217,157,241,222,171, 61,171, 83,120, 27, 32,178, 28,226,116, 86,185,111,106, 78,103,213,165,234,156,206, 40,
+247, 53,189,247, 38,124, 71,206, 74,167, 83,234, 82, 83,148,249, 26,202, 79,163,121,171,115, 58,163, 46, 85,231,116, 70,185,127,
+ 26,156,206,168, 75, 53,113, 58,163,220,215,246,238, 95, 84, 67,147,101,186,208, 28,226,129,176, 67,108, 69, 3, 0,217,144, 76,
+107, 66, 75,217, 80,103,115, 58, 59,205, 77, 33, 54, 29,176,192, 60,115, 78, 39,191,163,229,102, 78,103,142,110,134, 58,235, 29,
+ 53, 69,121,183,229,116, 22,127,117, 30,103,188,167,154, 56, 27,155,222, 90,210,233,244,103,111,108,185,127, 90,156, 78,126, 71,
+ 78,169, 75,213, 56,135, 58,121, 48, 48,212,230,124,185, 51, 57,157, 85,151,106, 72,103,163,223, 83, 77,156,141, 77,111, 45,233,
+116,250,179, 59,163, 15,105, 42,222,103,105,209, 98,201, 90,203, 68,116,181,227,169, 8,141,103, 54, 37,231, 32,247,159,138,211,
+193,233,153,136, 38,120,247,207, 52,157,206,228,172,158, 70,103, 78,247, 52,101, 58,157,201,233, 64, 90,255,116,156, 47,218,123,
+127, 30,243,179, 54,190,198, 76, 75,213,102, 29,109,138,116, 58,147,211, 78,238, 63, 5,103, 35,222,253,159, 14,156,231, 37, 33,
+150,140,119,242,200, 4, 78,182,192, 52,217,115, 59, 57,157, 67,155,194, 66,216, 4,112,122, 58,205, 35,229, 79,155,224,217, 95,
+148, 60,117,213, 37, 87, 93,122,238,234, 82,181, 50, 57,212,137,150, 34,167, 90,158,171,115, 58,227, 55,108, 57,156, 85, 70,155,
+250,217,157, 89,151,154,226,221,191,104,248,127,145,193,179,185, 29, 76,112,153, 0, 0, 0, 0, 73, 69, 78, 68,174, 66, 96,130,
0};
diff --git a/source/blender/editors/datafiles/claystrips.png.c b/source/blender/editors/datafiles/claystrips.png.c
new file mode 100644
index 00000000000..b6ebc54ebb2
--- /dev/null
+++ b/source/blender/editors/datafiles/claystrips.png.c
@@ -0,0 +1,290 @@
+/* DataToC output of file <claystrips_png> */
+
+int datatoc_claystrips_png_size= 9087;
+char datatoc_claystrips_png[]= {
+137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 96, 0, 0, 0, 96, 8, 6, 0, 0, 0,226,152,
+119, 56, 0, 0, 0, 1,115, 82, 71, 66, 0,174,206, 28,233, 0, 0, 0, 6, 98, 75, 71, 68, 0,255, 0,255, 0,255,160,189,167,
+147, 0, 0, 0, 9,112, 72, 89,115, 0, 0, 13,215, 0, 0, 13,215, 1, 66, 40,155,120, 0, 0, 0, 7,116, 73, 77, 69, 7,220,
+ 3, 18, 11, 2, 3,179,242, 79,233, 0, 0, 0, 25,116, 69, 88,116, 67,111,109,109,101,110,116, 0, 67,114,101, 97,116,101,100,
+ 32,119,105,116,104, 32, 71, 73, 77, 80, 87,129, 14, 23, 0, 0, 32, 0, 73, 68, 65, 84,120,218,237,125, 91,143, 37,199,113,230,
+ 87,153, 89, 85,231,214, 51,211,195, 33, 72, 13,181, 94,131, 67,137, 23,107, 13,138, 52, 47, 35,122, 73, 8, 16,236, 39, 61, 88,
+128, 40, 81,126,144, 4,239,171,254,131,159, 23,254, 27,122,149, 13,120, 33, 8,235, 39,173, 5,173,177, 90,136, 38, 69, 64,182,
+ 41,137,226,144,115, 35,102,166, 79,159, 91, 93, 51,115, 31, 42, 34, 39, 42, 79,158,230,202,242,202, 90,123, 26,104,244,189,186,
+ 42, 51, 50,226,139, 47,190,136,147, 1,240,120,240,246,175,246,166, 30, 44,193,131, 13,120,176, 1, 15,222, 30,108,192,131, 13,
+120,240,246, 96, 3, 30,108,192,131,183,223,252,155,249,109,186,153,233,108,134, 43, 79, 60, 1,103, 45,138,162,192,227,143, 63,
+142,178, 44,225,156,195,102,179,193,123,239,189, 55,250,253, 44,203,240,225,245,235, 56, 61, 57,121,176, 1,191,210,177,211, 26,
+ 90,107,124,226, 19,159,192,107,175,189,134,171, 87,175,226,145, 71, 31,133, 82,195,129,156,148, 37, 0,192, 57, 7,107, 45,148,
+ 82,225,103,222,123,120,239,195,231, 0,112,253,250,117,188,245,214, 91,248,251,183,222,194,141,235,215,113,227,198, 13,116, 93,
+ 7,248,223,254, 28, 51,251, 77,101,194, 58,207, 49,159,205,240,228, 83, 79,225,149, 87, 94,193,139, 47,190,136,135, 47, 93,130,
+115, 14, 93,215,193, 90,139,182,235, 0, 0, 69,158, 67, 41, 21, 22, 59,203, 50,104,173,145,101,217,104,241,189, 88, 96,185, 65,
+239,191,255, 62,190,251,221,239,226,199, 63,254, 49,238,220,185,131,174,109,255,253,110, 64, 94, 20,120,242,169,167,240,217,103,
+159,197,213,171, 87,113,229,202, 21,104,173,209,117, 29,156,115, 97, 33,123,107, 97,173, 13,139,169,149, 66,150,101,232,173, 69,
+145,231,208, 90,143,172,158,223,248,107,231,220,240,238, 61, 84,150,193, 58,135,147,123,247,240, 63,254,246,111,241,191,127,244,
+ 35,124,240,193, 7, 88,157,158,254,251,217,128,203,143, 61,134, 39, 62,245, 41,124,246,217,103,241,202, 31,254, 33, 30,190,116,
+105,180,232,236,195,121, 3,156,115,104,233, 36,104,173, 81,228,121,248,122, 62,155, 5, 11,143, 23, 94,158, 6,190,142,247, 30,
+150, 54, 68, 41,133,211,211, 83,252,253,155,111,226, 39,239,188,131,159,189,251, 46,174, 93,187,246, 91,227,158,254,197, 55,224,
+241, 43, 87,240,185,207,125, 14,207, 63,255, 60,254,227,239,254, 46,142,207,159, 71,219,117,240,222, 7, 95,206, 11,159,101, 89,
+176, 92,107, 45,250,190, 71,111, 45, 12,197,136,186,105, 96,173,197,185,163, 35,104,173,247, 22, 61,254,200, 27, 32, 55,193,210,
+201,106,154, 6,187,237, 22,215,174, 93,195,123,239,189,135, 55,223,124, 19,255,248, 15,255,240,111, 99, 3,102,243, 57,254,243,
+171,175,226,229,151, 94,194, 39, 63,249, 73, 92,190,124, 57,160, 23, 0,208, 90, 67,101,217,176, 80,145,213,242,231,206, 57,180,
+109,139,182,235,160,148,130,209, 26, 93,223, 3, 0, 22,243, 57,180,214,112,206, 33,203, 50,100,116, 45,190,190,116, 67,124, 45,
+107, 45, 44,197,151,158,174,211,180, 45,154,170, 66, 93,215, 56, 57, 57,193,187, 63,251, 25,254,219, 95,255,245,191,170,107,250,
+181, 54,224,252,241, 49,190,244, 39,127,130,171, 87,175,226,194,241, 49,142, 22,139, 96,229,222,123, 24, 99,194, 63,144,110, 39,
+203,178,251, 65,150,252, 54, 91,170,115, 14,125,223, 7,235, 85, 74, 97, 62,155,133, 83, 99,140, 9,127, 27,191,141, 92,144,181,
+104,218, 22,109,219,134,191,235,186, 14,117, 93,163,218,237,176,221,237,208,181, 45,150,167,167,184,121,227, 6,254,251,223,252,
+ 13,110,223,188,249,255,199, 6, 92,124,232, 33,124,227, 27,223,192, 75, 47,191,140,217,116, 58, 44, 52, 45, 44,163, 21,137, 88,
+ 84,150, 33, 19,238,199, 57, 7,103,109,248,199,210,109,100, 89,134,190,239,131,251, 49,198, 96, 82,150,240,222,163,235, 58,204,
+231,243,209,181, 83,110, 72,186,183,237,110, 23,126,191,235,186, 1,158, 2,232,105, 51,214,235, 53,178, 44, 67, 93,215,248,201,
+ 59,239,224,175,254,242, 47,127,163,168,233, 87,218,128,115,231,207,227,235, 95,255, 58,190,240,133, 47,160, 40,138, 17, 4,140,
+177,186, 86, 10, 16, 27,194,139, 12,239,225,163,127,204, 22,203, 39,196, 57,135,166,105,208,245, 61,138, 60, 15,238,172,239,123,
+204,102,179,189, 83, 21, 47,126,223,247,225,122, 50, 22,244,125, 31, 54,131, 97,111,181,221,226,206,157, 59,152, 76, 38,200,243,
+ 28,167,167,167,248,193, 15,126,128, 31,254,240,135,216,109,183,191, 29, 27,144, 23, 5,190,248,197, 47,226,171,111,188,129,243,
+231,206, 5, 95,204, 22,205,254, 89,126, 61,242,205,188,184, 2,201,132,197,243, 62,184, 32,185, 56,117,211,160,235, 58, 76,202,
+ 18,179,217, 44,248,245,233,116,186,247,247, 62,113, 10, 56,183,144, 27, 32,175,223,247,253,144,119,120,143,182,105,112,122,122,
+138,249,124, 62, 66, 91,255,248, 79,255,132,239,125,239,123,120,255,151,191, 68,211, 52,225, 57,126, 99, 27,144, 41,133,103, 63,
+251, 89,252,151, 63,251, 51,124,250,211,159, 30,225,116,233,207,179, 44, 11,110, 72,186,128, 44,203,194,131, 75,191,205, 65, 52,
+ 88, 45,197, 1,182,126,107, 45,218,182, 69,211,182,112,206, 97, 58,153,132,107,207,102,179,224,214,148, 64, 70,222,251,209,102,
+112, 80,103,100,197,247,237, 68, 96,230,251,104,219, 22,235,213, 10,219,237, 22,211,233, 20, 69, 81,192, 24, 3,173, 53,242,162,
+192,245, 15, 63,196,219,111,191,141,255,249,119,127,135,187,119,238, 96,179,217,192, 19, 0,248,127,182, 1,153, 82,248,210,151,
+190,132,175,253,233,159, 98, 49,159, 7, 24,201, 11,200,214,158, 17,181,192,139, 41,173,159, 79, 69,140,225, 99,183, 17,252, 63,
+ 16, 78, 3, 47, 82,219,117,152, 77,167, 97,115,138,162, 24,197,154, 17,158,167, 5,229,239,117,125,143,186,174,209,245, 61, 12,
+221, 87, 79,215,102, 3,225,141,170,171, 42, 24, 24, 7,110,109, 12, 84,150,161, 44, 75, 20,101,137,174,109,241,211,159,254, 20,
+ 63,121,231, 29,252,228,237,183,113,227,198,141, 95, 59,159, 72,110,128,210, 26, 95,254,242,151,241,213, 55,222,192,156,142, 63,
+ 47,120, 88,120,122, 88,249, 49, 14,142,177, 59,226, 13, 11, 27,112,192,255,243, 6,176, 43, 50, 90,195, 24, 19, 54, 32,143, 50,
+227,216,250,229, 6, 55, 77, 19,172,221, 82, 28,145,167,129,255, 23,103,209,174,239,177,221,110, 67,188, 97,247,202,107, 96,204,
+ 64,159,221,190,125, 27,255,235, 71, 63,194,219,111,189,133, 95,252,252,231,255,124,138, 6,192,159,199,139,255,250,235,175,227,
+245,175,124, 5,243,217, 44, 88,190, 49, 38,208, 3,169,119,185,232,108,245, 90, 88,190, 76,194,216, 90, 51,250,200,139,198,139,
+202,191,163,148, 2,188, 71, 71,176,148,131,120, 81, 20, 35, 67,144,159,103,156, 97, 39,178,102,118,135,241, 41,149,208,214,211,
+ 66,247,125,143,166,105,194,117, 84,244,236,179,217, 12, 79, 92,185,130, 79, 63,249, 36, 30,122,232, 33,156, 44,151,216,172,215,
+191,230, 6,100, 25,222,248,218,215,240,229,215, 95,199,185,163,163,224,219,195,113,167,223, 73,157, 2,249,181,116, 79,241,239,
+197,249, 64,240,231,226,154, 50,142,240, 27,199, 8,165, 20,138,162,216, 63, 1,194, 0,194,198,136,132,173,167,128, 44,145, 90,
+223,247,163,216,101, 9, 26,231,121, 14, 67,207,108,140, 65, 73,236, 44,111,162,124,198,249,124,142,199, 30,123, 12, 79, 63,253,
+ 52,202,201, 4, 63,255, 21, 79, 67,112, 65,231,206,159,199,183,190,245, 45,188,244,210, 75, 56, 90, 44, 70, 15,205,150, 42, 33,
+165, 92, 28, 25,116,247, 78,132,240,205,242,251,169,192,201,239,140, 82, 36, 69,225, 9, 45, 25,173, 49,159,207, 3, 12,150, 49,
+ 68, 34, 35,240,102, 18,199,180,217,110,135, 5,213, 58,184, 34,222, 80,201,200, 42,165,208, 81, 54,174,148,194,234,244, 20, 39,
+ 39, 39,184,120,241, 34,242, 60, 15,255,131, 93, 25,255,127, 0,168,235, 26,239,190,251, 46,190,253,237,111, 99,189, 90,253,223,
+159,128,231,158,123, 14,255,245, 47,254, 2, 87, 30,127, 28,139,249, 60, 4, 43,165, 84, 8,178,236,251,226,133,148, 46, 71, 90,
+112,216, 12,233,118,132,191,150,113, 32, 70, 70,242, 20,240, 3,202,235, 74, 43,142, 99, 83, 42, 47,136,239,155, 23,159,249, 37,
+134,171,236,218,188,247,232,218, 22,206,123,148,101,137,237,118, 59, 58,185,155,205, 38, 24, 4,159, 70,254,249,133, 11, 23,240,
+194, 11, 47,224,131,235,215,113,239,238,221,143,223,128,167,159,121,230,207,191,249,205,111, 6,254, 70,107, 13,107, 45,202,178,
+ 28, 61, 92,252, 32, 33,249, 74, 88,124, 88,244,136, 32,147,167, 73, 90,105,124, 50,100,102,172,148, 26, 78,129,181,200,201, 93,
+228, 84, 47,136, 93, 86,202, 29,202,205,224,235, 4, 74,131, 2, 51, 95, 83, 22,129, 44,185, 39,165, 20,202,162,192,122,189, 70,
+215,117, 48,198,224,252,133, 11, 35, 96, 16,146,204, 44,131,166,204,253,185,231,158, 3,128,143,117, 73,234,115, 87,175, 2, 64,
+ 88,112,107, 45,180, 82, 33,250, 75,146,139, 23, 94,243,194, 75, 11, 22,254, 44,184, 4,250,158, 34,107, 83,148, 29,139,149, 9,
+ 31,179,136, 39,210,145, 69,243,169,236,201, 37, 65, 4, 76,105,253, 35, 88, 43,232, 17, 25, 51,120,241,229,102, 72, 18, 47,203,
+ 50, 20,130,254,232,251, 30,199,199,199, 33, 22,236, 8, 37, 49,194,226,211, 83, 22, 5, 52,185, 52,231, 61, 62,255,249,207,227,
+ 43, 95,253, 42, 20,253,239,116, 73, 82, 36, 81,140, 8,140, 49,163, 84, 94, 30,113, 21, 33, 12, 9, 39,101, 80,221, 91,104,233,
+ 14,232,231, 50,176,203, 13,201,196,207, 37, 94,215, 90, 67,211,105,236,105,161,242, 40,248,142,114, 11, 50,160,140, 16,150, 12,
+206, 61, 17,127,177, 27,226,205,224, 4,174,169,107,204,230,115,180, 77, 3, 99, 12,150,203, 37, 38,147, 9,180,214, 40,203,114,
+244,127,229,198, 27,173, 97,180,198, 31,188,240, 2,178, 44,195,119,190,243, 29,180, 77,147, 40,207,146,181, 3,128, 86, 10, 5,
+ 5,154,192,102, 70,254, 62, 69, 39,179,149,239,185, 24,105,229, 7, 18,177,248,243,140, 16, 6,195, 94,165, 84,192,253,158, 32,
+105,211,182, 33, 96, 34,113, 63, 1,165,208,137,115,244, 51,166,185, 25,210,242,115,179,123,100,151, 35,223,172,181,232,187, 14,
+ 57,229, 31, 23, 47, 94,132,214, 26,211,233, 52,184, 66, 94,120,173, 53,114,226,174,216,131,216,190,199, 51,207, 60,131, 63,250,
+227, 63,134,206,243,253, 13,200,232, 2, 0,160,141, 9, 46, 68,137,239, 75, 50, 77, 50,156, 42,225,191,165,127, 15, 31,227,223,
+161, 19, 49,242,223, 34, 56,243, 38,168,136, 89,101, 43,141,171,106,242,132,166,226,129, 18,240,152, 51,237, 56,144, 75, 56,202,
+207,109,180,198,108, 62, 71,223,247, 3, 45,190, 88,160,156, 78,161,180,198,114,185, 28,242, 4,250,123, 25,136,229, 73,208, 4,
+ 99,255,224,249,231,241,218,107,175,141,248,176,160,138, 96,107,103,235,144,148, 3, 91,129, 60,194,217, 30,152, 77,159,146,189,
+ 19, 16,185,165, 24, 17,141,174, 67, 22, 37,173, 90,146,128,241,145,151,150, 31,111,146,220, 12, 43, 8,181, 80,165,163, 83, 34,
+ 51, 94, 6, 35,222,123, 56,186, 15, 38,239,182,155, 77, 72,214,202,178, 68,223,247,168,234, 26, 69,158, 7, 55,206,245,236,172,
+235,208, 57,135,178, 44,241,242, 75, 47,193, 89,139,239,127,255,251,193, 61, 42,208,131, 26, 99,194, 81,149, 55,109,173, 13,214,
+ 58, 90,124, 97,217, 18,117,248,120, 65,229,251,190, 15,186,191, 89, 7, 16,145,116, 29, 18, 81,197,185,200, 94, 18, 38, 3,179,
+176, 74, 25,180,115, 50, 58, 54, 50,118, 35, 50, 96, 51,147, 90,237,118,128,247,176,125, 31,114,130,158,104,139, 60,207, 81,144,
+123,153, 16,117,195, 44, 48,127,174,148,194,185,115,231,240,234,171,175,226,197, 23, 95, 20, 6, 67,255,144,143,184, 33,180, 50,
+ 98, 44, 19, 22, 31, 47,122,204,116,198, 27, 19,163,158, 56,136,199,144,213,138, 69,214, 74, 5,190, 62,150,160,200, 35, 31,223,
+ 71, 12, 85,131,175,167, 0, 25,200, 57, 66, 50,210,141,133, 4,144,138, 66,124, 42,202,201,100, 88,232,201, 4,198, 24,228,121,
+142,166,105, 80,148, 37,234,186,198,106,185, 68,158,231, 1,218, 22,101, 57, 32, 76, 65,217,191,242,202, 43,120,228,145, 71,216,
+149, 15,190,154,143, 78,236, 78,172,181,193,234, 51,177,248, 50,147, 77, 45,124, 42, 48, 38, 93, 81,180, 9, 1,182,146,213, 27,
+ 99,130,144,171, 20, 73,143, 68, 71,108,189, 41, 42, 67,210, 40,206,185, 16,216, 3,172,165,140,182,160, 69, 27,197, 0, 99, 48,
+153, 78, 81,148, 37, 76, 81, 12,240,211, 90,204,230,115, 76,166, 83,104,173,177, 94,175, 81,215, 53,118,219, 45,142,142,142,194,
+243, 44,142,142,134,196, 78, 84, 0, 45, 81, 34, 69, 81,224,229,171, 87,161,180,134,226,165,208, 34,121,226, 55, 46,223,177,107,
+ 10, 8, 72, 66, 60, 97,141,113, 54,187,151, 20, 69,112, 51,222, 8,127,192,189,177,159,150, 22,202, 11, 47,177,191, 20, 1,240,
+230, 72, 3,144,238,197,210,207,140, 49,131,239,142, 98,128, 68, 68,206, 57, 56,162,182, 79, 79, 78,144,231,121, 64, 64, 77,219,
+222,223,104,165,240,208,165, 75,104,219, 22,155,245,122,160,179, 5,146,155, 76, 38,152, 77,167,152, 78,167,184,112,254, 60, 62,
+243,153,207, 64, 5,151, 34,162,115,202,189,248,216,125, 36,104,135, 20, 85,145, 60, 5,188,192,156,128, 37,114, 10, 31,113, 68,
+188,128, 57,225,244,142,202,142,114,225,101,205, 89, 6,228,120,241, 89, 4,198, 11,220,245,125, 72,168,164, 2,143, 93,145,117,
+ 14, 74,107,204, 72,159,180, 89,175, 3,220, 60, 90, 44,134,210,105, 81,192,246, 61,218,166,193,100, 54, 27,174,217,117,152,204,
+102, 33,111,240,228, 90, 89,253,177,152,207, 15,171,163, 25, 10,202, 27, 98,182, 16,145,165,159, 85, 28, 63, 35, 9,216,183,252,
+ 67,247, 34,138,250,146,147,231,100, 43, 6, 8,169, 56, 36, 17,157, 44, 28,201,224, 44,197, 5, 18, 0,148, 69, 17,170,100,198,
+ 24,172, 86, 43,212,117,141,201,116,138,249,124, 14,219,247,216,108, 54,208, 68, 77,192,123, 44, 22, 11, 84, 85,133,122,183,187,
+ 15,169, 41,195,103, 99, 48,198,220,223,128, 81,150, 42,248,115,149, 58, 9, 7, 22, 54, 46,200,164, 24,208, 56, 14,248, 68,133,
+ 12,226, 84, 72, 84,195, 6, 97,164,139,161,251,180, 66,101,145,188,158,184,183,156, 54,144, 13,136,209,144, 44,234, 51, 97,199,
+155, 98, 5,162,241, 4, 69, 1,192, 20, 5,166,211,233, 80,212,161, 83, 85, 87, 21,156,181,152, 83, 37,209, 57,135,178, 40, 48,
+153, 76, 80,150, 37,114,170,234,121,112,127, 64,194, 69, 4,122,129,240,174,181,118,175, 40,157, 90,240, 36,250, 73, 36, 97,136,
+ 22,122, 47,120, 71,155,144, 58,101,172,148,144, 5,248,179, 72, 57, 41, 32, 96,229,134,230,228,140, 92, 25,187, 34,182,246,212,
+ 41, 41,203,114,168, 89, 55, 13,142, 22, 11, 28, 29, 29, 97,179,217, 12, 18, 23,165, 48,161, 18,170, 33, 55,197,155, 39, 11, 84,
+ 76,183, 27,196,148,177,120, 72,182, 58, 38,168,156,115, 67, 96, 57, 64, 46, 73, 42, 57,165,126, 56,116, 18,178, 68, 57,241,227,
+ 54,149, 23,107, 84, 44,250,152,205,226,123,147,226, 49, 9,101,165, 20,222, 11,177, 88,128,168,121, 14, 77, 39,162,109, 91, 44,
+ 79, 78,194, 38, 77,167, 83,116,125, 15,103, 45, 12,233, 90,251,190, 71, 78,238,139,107, 12,147,201, 4,206,251, 16,196, 21,179,
+138,225, 61,162, 3, 82, 5, 15, 31, 45,120,106, 19,246,172, 93, 34,161, 67,137, 89,164,112,115,194,237,201,148,223, 69, 52,134,
+ 22,185,139, 36,227,246, 42,111,130, 87,146,137, 22,187, 28, 94,252,160,206,163, 13,225,211, 16,199,141,245,122,141,147,123,247,
+ 80, 78, 38, 56, 62, 62,134,179, 22,155,205, 6,125,215,193, 8,101, 69, 57,153, 12, 65,154,174, 23,128, 68,215, 65, 33, 1,253,
+100,246, 40, 57, 32, 62, 54,103,249,217,189,120,146,250, 24, 37,101,238,128,202, 77,110,188,132,115,133,168, 7,200, 83,151,186,
+191, 44,170, 57,135,223, 37,106,187, 19,138,108,201,121, 41,165, 80,150,229,136, 41,182,214,162, 35,216, 57,153, 76,144, 41,133,
+187,119,239, 14,148,196,100, 18,146, 51,195, 37, 77,173,209,145, 52,134,121,173,166,105, 6, 24,107, 12,224,253,125, 24, 42,249,
+ 25,169, 84, 72, 21, 53,152,158,216,251,249, 33,173,140,116, 67, 18, 98,210,123,170,182,124,200,173,132,218, 2,163, 26, 82,209,
+ 85, 85,181, 39,222,149,174, 71,107, 29, 98,138,124,150, 44,203, 70,149, 48, 73, 71, 56,113, 58, 56, 54,228,100,217, 76,242,157,
+156,156, 96,181, 90, 97, 62,159,227,194,241,241,160, 73,173,235,251, 53, 11,239,135,216,153,101,152,206,102, 40,138, 98,168,180,
+145, 43, 50,114, 97,108, 92,120,161,155,222, 17, 49,181,231, 43,197,105,201, 82,137, 86,204,144,198,191,155,162, 57, 14, 72,207,
+195, 38, 9, 52,196,190, 56,203, 50,148,137, 26,177, 92,108,201,238,202,197,231, 24,199,207, 36,105, 25, 25, 3,216,215, 75,195,
+204,178, 12, 93,215,225,238,157, 59,120,248,225,135,199, 98, 1,231,144,211,198, 58,239,225,233,239,140, 49,104,182, 91, 56,231,
+ 80,215,181,128,161,226, 65,227,138, 23,223,164,132,161,214,218,225,194,241,226,127, 12,230,207, 82, 68,220, 25,180,197, 30,199,
+ 79,208,144, 51, 85,246,213, 92, 96,137,221, 97,138, 19,226, 86, 40, 22, 2,179, 8, 56,112,248, 66, 20, 16,171, 48,228,189, 24,
+ 99, 80, 78, 38, 88,173, 86,104,219, 22,147,201, 4, 71,231,206, 13, 39, 68,107, 52,117, 61, 64, 88,214, 29, 9,215,214,117, 29,
+202,162,184,223,164, 39,249,148, 56, 14,112,224, 83, 7,152,199, 36,245, 28, 23,102, 34,154,195,127, 76,226, 37, 73,183, 56, 31,
+144, 20, 68,219,182,129,117,116, 36,165,145,127, 31,171,239,228, 9,231,103, 27, 81, 14, 98,161,120,227,100,198, 45,101,244, 92,
+138,188,125,251, 54,238,221,189,139,163,163, 35,228,121,142,106,183,131, 39,133,181,230,120,165, 84,112,209, 92,176,209,198, 12,
+ 27,224, 36,121, 37,234,182, 25, 45, 24, 87,167, 98,110,197, 37,178, 80, 28, 42,208,124, 12,130, 58,132,166,226,160, 26, 47, 68,
+ 31, 89, 23,243, 70, 41, 88, 43, 23, 78,178,159,242,122,114,179,249,251, 49, 10,228,255, 83,150, 37,142,142,142,176, 94,173,176,
+ 92, 46,241, 24, 81, 18, 69, 89, 14, 25, 58, 9,203, 10,206, 5,178, 12, 93,211, 64, 41,133,182,235, 80, 87, 21,148, 39,127,197,
+ 21,160,192, 9, 37, 84,199,142, 45, 46,166,126, 15, 20, 92, 66, 16,162,119, 31,159, 32, 81,204,207, 14,104, 70, 37, 10,139,121,
+ 39, 99, 12, 12,249,126,185, 81, 62,186, 70,124, 93, 67,156, 18, 47,178,204,124,229,166,132,250, 46,209,206,129,132,227, 32, 76,
+144,114,177, 88,224,131, 15, 62,192,102,187, 69,145,231,152,207,231,208,198,160,239, 58,116, 84, 62,117,180, 30,225,228,101, 25,
+202,201, 4,134,143, 47, 43, 22,120, 51, 92,148, 84, 73,218, 90, 30, 99, 21, 87,185, 18,150,183, 39,212, 74, 48,160, 62,194,252,
+242,123, 82,101,237,163,250,174,166, 56,208,146, 66,129, 19,156,164, 4, 68,168, 61,152,144,235,163, 90, 64,236, 94,227, 46,204,
+174,239,209, 19,180,228,205, 45, 39, 19, 44,151, 75,220,187,115, 7,231,207,157, 27,130, 56,197, 22,254, 60, 47,138,128,176, 90,
+170, 31,228,198,192,120, 74,146, 88,135,153,114, 3, 28,136,186,174, 11, 13,119,225,253, 0,247, 63,242,223, 31,179,224, 72,180,
+ 48, 73, 12, 31,208, 11,113, 63,177,251,146,106,234, 84,117, 46,174,160,245, 36,127,103,186, 61,150,219,199, 20,119,208, 19,137,
+ 56, 25, 19,119,143, 60,250, 40,110,221,186,133,255,240, 59,191,131, 60,207, 49,157,205,194, 41,208, 81, 91,149, 22,140,174,145,
+ 62,109,100,185,194,255,115,214, 6, 0, 59,194,219,113,131, 92,172, 9,197, 33,138, 57,177,224, 42,209,184, 17,159,136,184, 3,
+ 82,234,254, 51,165, 70,253, 4,135,228,239,161, 51,134,122,199, 24,239,199, 89,116,252,191, 66,193,134,172,152, 99, 15,255, 77,
+211, 52, 88, 44, 22,120,255,151,191,196,127,250,253,223,199,241,133, 11, 35, 69,133,228,161, 24,113,221,231,130,168, 24, 35, 89,
+ 78, 25,148,229,162,177, 27, 96, 81, 43,136,172, 11, 15,113,198,130,199,139,157, 9,152,155, 90,236, 67, 27, 32, 85,212, 44, 87,
+ 47,242, 28, 59,234,255,146,192, 64, 26, 85,104, 87,165, 77,154,205,102, 48,132,238,228, 6,201, 66, 79, 74, 73,205,139,202,240,
+213,210, 61, 77, 72, 35,244,222, 47,126,129,201, 51,207,220, 87, 61,144, 75,148, 48,190,107,219, 80, 25, 51,153, 40,142,196, 90,
+ 77,169,112, 46,104,247,249, 98,206, 57, 40,194,206,129, 51, 74,248,254,176,224, 9,247,227, 18,139,140,132,208, 74, 6,217, 88,
+ 1, 97,140, 65, 81,150, 67, 79,153,176, 54,249, 55,142, 92, 84,219,182,208, 74,225,104,177, 8,113, 32,134,150,210, 35,196,174,
+136,117, 62,242,247,180,168, 45, 88,231,240,238,187,239,226,137, 79,125, 10, 57, 41, 36,156,247,128,240, 22,124, 10,114, 18,191,
+153, 61,205, 62, 91,126,148,177, 74, 78, 62, 21,148, 83, 46,200, 71,110,104,143,212, 59,227,116,140,126, 47,225, 86,164,236,144,
+147, 40,153,165,202, 92,161, 23, 69, 24, 54, 32,174,168,241,194,103, 66, 62, 25,187,174, 17,157,109, 12, 50,239,161, 68,166,204,
+235,178,152,207,177, 90,173,198,144, 85, 92, 87, 54,186, 56,242, 38,102, 68, 31,167,168, 1,162, 40,194,142, 43, 21, 84, 4,163,
+230,139,196, 73, 58, 52, 88, 35,213, 97, 19,147,112, 92, 89,114,145, 79,142,185,253, 92,244, 14, 75,221,191,188,127,166, 45,152,
+120,235, 5,197, 32, 75,149,177,223,143, 51,234, 80, 21,164,191,239,186, 14, 77,211,160,105,154, 16,212, 79,150,203,144,224,177,
+120, 87,214, 21,248, 36,122, 42, 12,153, 84, 6,155, 69, 5,114, 45, 52, 57, 82, 27, 31,138,206,146,204, 59, 64, 45, 28, 90,112,
+217,221, 46,239,197, 31,112,101,210,138, 36, 69, 13, 0,109,211, 12,165,194,201,228,254,105, 98, 45, 41,185, 14, 41,187,148,126,
+ 61,238, 49,142, 79,162,244,255,177,122,155, 81,207,209,209, 17,250, 15, 62, 64, 83,215,161,227, 50,206,101,164,235,180, 28,132,
+ 71, 42, 4,153, 92, 69,228, 26, 31, 85, 57,116, 67,138,159, 14,185, 22, 28,192,250,201, 77,226,251,144, 10,140, 3, 39, 71, 42,
+159,165,133,199, 56, 62, 14,172,103,125, 95,102,220,123,201,160,115, 48,121,126, 63, 87, 34,235,230,161, 34, 69, 81,192, 59,135,
+ 15, 63,252, 16,231, 47, 92, 24,209,229,220, 80, 50,146, 87,134, 13, 72, 80, 5, 35,249,160, 56,158,220, 65,210,117,221, 72,174,
+120, 22, 71,116, 40, 43,141, 33,104,170, 40,147,186, 70,140,215, 89, 4, 85,215,117,128,206,177,245,202, 19,196,165, 65, 43, 71,
+ 38, 68,150, 30,171, 45, 70,136, 42,203,224,100, 7, 15,117,221,111,169,177,251,218,181,107,120,242,169,167, 70, 48,151, 79, 67,
+181,219,161, 33,165,117, 81,150,247,201, 56,159,232, 78,137, 31, 66, 50,145, 93,223, 67, 19, 22,102,153,246, 89, 45,168,169, 90,
+109, 60,128, 73,138,189, 92,130,142,136,143,190,164,152, 21, 41,147,229,181, 36, 39, 31,199, 14,105,137, 49, 18,226,153, 67,113,
+126, 98,157, 11,254,159,107,209,252,222, 52, 13, 50,165, 48,155,207,113,235,214,173, 80, 46,141, 93,119,215,117, 65, 35,148,101,
+ 25,140, 79, 80, 6, 18,130, 58,241, 51, 14,118,121,158,163,109,219, 32, 99,148,141,124,177,111,151,232,232,172,138,215, 33, 42,
+ 34, 94, 56,230,105,226,241, 8, 69, 81,160,239,186, 97, 34, 10, 17, 94,210,144,120, 88, 71, 32,217, 36,161, 39,146, 58,173, 20,
+242,168, 1,208, 18, 32, 96, 8,202,198,200, 45,179,252,183,214, 90,108,214,107,220,254,232,163,209,224, 17, 94, 35,126, 30,110,
+ 32,183,214,194,100, 17, 93, 32,231, 56,248, 51,132,183, 93,215,193, 79, 38,201, 62,223, 67, 62, 53, 85,108, 65,164,162, 59, 43,
+ 35,150,238, 39,190, 78,128,151,130, 42, 1,117, 60, 74,216, 39,209,140, 76,236,228,233, 25,157, 56,225,158,117,158, 67,115, 25,
+149, 54,206, 90,139,150,144, 80, 85, 85,216,237,118,216,110, 54,232,218, 54,120, 6, 54, 28,107, 45,170,170, 66,219,182, 65,216,
+101, 82,130,172, 24, 13,113,207, 20, 39, 27,198, 24, 84,117, 61,238,255,194,253, 97,124,123,149,169,152, 9,149,138, 8,225, 91,
+ 15,117, 77,198,244, 64,223,247,131,178, 32,106,168,208, 90,135, 69, 97,171, 15,240, 79,148, 22, 57, 27,150,113, 33, 84,192,200,
+218, 37,157, 30,126,207,251, 80, 92, 97,119,210,118, 29,218,166, 25,180, 63,147, 9, 46, 28, 31,227,198,205,155,161,206, 44,103,
+ 87,180, 77, 3,109, 12,102,116, 95, 74,169,241, 6,248,216,250,152, 67, 23, 41,183,247,126,208, 82, 82,243,116,198, 52, 46,245,
+ 79, 37,229,138,169,158, 2, 81, 71,254, 56, 58,226, 80,153, 82, 6,114,206, 60,251,168,143,215,139,209, 7, 65,102, 40, 40,231,
+152, 82, 80, 66,166, 51,218,120, 25, 35,200,133,177,112,184,200,243,208,216,200,242,245, 15, 63,252, 16,199, 23, 47,142, 59,112,
+138, 2,166,239,131,166,200, 89, 59,176,161,158,118, 55, 5, 23, 67, 11,191, 96, 19,181,214, 80,100,109,140, 58,152,214,149,250,
+202, 84, 11,145, 44,222,251, 68,118,123,168, 56, 51, 98, 69,163,123,149,174,164, 35, 74,194, 8,245,155,204, 29, 0,160, 21,215,
+ 9,106,139, 4,112,224,160, 27, 43, 51, 36,213,209,247, 61, 90, 49,157,171,105, 26,120,231,112,235,214, 45, 60,243,123,191, 55,
+122,182,190,109, 81, 85, 85, 72,220,192, 65, 56,149,132,200,250,111, 28, 0, 57,203, 99, 40,154, 42,130, 39,191, 78,212,129, 67,
+162, 37, 78,139, 63, 35, 72, 75, 50,142,239,131,181, 62, 60, 23, 78,206,130,144,127, 35,185,127, 41,191, 31, 37, 90,214,194, 69,
+153,126,220,155, 44, 93, 22,103,182, 93,215,161,170, 42, 84, 85, 5, 0, 88, 46,151, 1, 9,113,204,100,174, 42,232, 76,181, 30,
+130,112,150,104,184, 8, 86,168,212, 64, 38,209,226, 51,146, 48,198,132,169, 34,241, 28, 55,159,144, 29,142, 18, 44,105,233,226,
+ 4,166,170, 95,103, 13, 4,137,169,137, 64, 15,183,109,208,101,114,192,147,194, 94, 69, 49, 65,142, 55,235, 73,205,236, 19,160,
+ 96,143,144,163,133,103, 5,116,136, 5,228, 90, 0, 96,183,219, 5, 99,181,148,116,113,214, 94,215, 53,106, 10,220, 6,114,192,
+197, 33, 26, 88,164,242,124, 81, 46, 62,199,110, 32, 38,157, 70, 13, 29, 9,154, 34, 86, 50, 28,170, 13,140,240,184, 64, 48, 28,
+236,248,235, 78, 44,196,174,170, 70, 67, 96, 99,215,193, 69, 28,110,178, 54,220,172,205,255, 87,248,252,216, 75,132, 46, 24, 99,
+ 6,139,110, 26,104,165, 80, 85, 21,238,221,187,135,205,118, 59,140,101, 35,218,158, 71, 25, 44,151, 75,236,170,106,168, 19,100,
+217, 16, 3, 36, 39, 62,202, 62,197, 64,189,216,205,140,228,125, 20,248,242, 60, 15, 69,253, 20, 17,151,154,148, 24, 99,252,179,
+ 20,114, 50, 75,149,115, 65,165,206, 7, 0,214,171,213,168,173, 40,238,176,148,195,252,130,242,193,185, 17,207,115, 72,161, 33,
+239, 37, 19, 94,161,109,219, 1,130,110,183, 33, 64,243,243, 54,117,141,213,106,133,211,211,211, 97, 38, 42, 53,117, 59,231, 96,
+ 88, 19,106, 83,202,231,104,113,184,154,196,197,232,140, 38,224, 26, 99,144,115,122, 79,169,126, 38, 10, 59,135, 84, 5,114,254,
+ 68,204, 66,166, 80, 79,120,120,177, 25, 13, 85,182,164, 74,186,109, 91,204,154, 6,115,154,123, 17, 10,239,236, 58,200,141,142,
+148,207, 89, 6, 37, 79, 0, 97,253, 61, 8, 76,168,176,237,186,161, 48, 67, 16,157,209,215,116, 58,133,202,178,209,224,191,134,
+ 96,234,185,115,231,208,118, 29,182,155, 13, 60,157, 86,195,205, 3, 18, 53, 72,109,103, 70, 15, 44,131, 72,128,127,162,237, 83,
+182,129,198,104, 37, 37, 57,116, 9, 25, 99,138,157, 60, 36,212, 98,203,231,222, 49,214,247, 79,167, 83, 84,116,196,251,190, 71,
+ 79,238,169,161, 5,145, 67, 58,226, 96, 45,179, 94, 47, 44, 93,198, 9, 43, 50,102, 93,150, 40,200, 61,183,212, 31,160,133,218,
+ 66,150, 79,101,207,242,108, 54,195,116, 58, 29, 88, 89,151,168,127,166, 70,199,112,242,163, 4, 21,192,124,183,244,197,204,121,
+200, 38,185,184, 74, 21,187,186, 56,144,230,162, 91, 63, 62, 33,222,123,100,162,200, 18, 55,228,149,147, 9,106,202, 74,243,162,
+ 8,147,216, 75,146, 9, 90, 49,111, 66,142,196, 57,132,245, 33,122,232,242, 60, 15,149,193,160,172,238,186,161,217,142,202,180,
+ 70,107, 76, 72, 45,119,243,230, 77, 92,190,124, 57,244, 19,179, 27, 83, 74, 97,181, 90, 81, 16,142,230, 56, 28,122,240,216, 63,
+243, 6,236,104,214,154, 34,157,166, 84,154,197, 11, 61,154, 57, 17,181,154, 30,146, 35,198,138,181,152,195,145,115,126,120,224,
+171,119, 14, 29,249,232,197, 98, 17,166,162,240,201,130,208,185,118,125, 31,178,219,152,140,211,137, 33, 32, 18,140, 72,151,215,
+182, 45,170,186,198,233,106, 53,140,177,161, 38, 14, 83, 20, 56, 71, 82, 21,134,171,203,229, 18,119,239,222,189, 79, 71,103,130,
+110,149, 92,121, 44,247,102, 9,139, 76, 76, 60,249, 85,173, 53,244, 25, 52,115,236,223, 15,113,239,113,160,142,121,168,184,101,
+ 41,110,228, 54,132,208,118,187,221,125,242, 75,184, 79,166, 36,100, 37,207, 71, 19,192, 98,191, 31,244, 61,226, 99,252, 51,174,
+ 22,206,166, 83,180, 77,131, 13,117,203, 24,173,209, 91, 27,166, 50,158,158,158, 98,181, 90, 13,227,119,138,130,116, 65,137,102,
+231, 94, 8,139,226,214,211,184, 27,134, 79, 0, 79, 52, 60,212, 47, 48,154,173, 35,160,175, 60,154,103,149, 49,189,247,208,228,
+ 71,157,184,159, 82,184, 5, 9, 26,154,186, 30, 70, 21, 19,111,197, 99,243, 57, 65,146, 42,235, 56, 33, 11, 68, 28,183,226,138,
+210,226,168,154, 70,110,136,131,112,215,117,129,202,168,118, 59,244,214, 98,117,122,138,187,119,239,162,170,170,209,240, 39, 0,
+ 48,177,168, 41,142, 7,169,252, 32,158, 86, 37,253,187,236,170,145,200, 74,102,159,169,215, 2, 72, 9,114,247,180, 64, 66,197,
+ 16,183, 20,197,243,133,186,174,195,122,189,198,226,232, 8,206,185, 16, 87,164, 27,100, 96, 97, 69,112,149, 60,146,146,185,144,
+ 82, 1, 21, 73, 57, 35, 67, 80,102, 66,119,187, 29, 90,106,194,240,222,163,169,170, 1,251,239,118, 3,253,192, 11, 79,109,171,
+134,103,107, 86, 85, 53,170, 36,237,233,242, 19, 83,173,138, 60, 15, 29,127,220,255, 42, 45,112,111,100,101,170, 67, 62, 66, 62,
+ 54,130,163,146,204,138, 55, 48, 12,141, 37,183, 35, 55,191,216,110, 3, 53,205, 57,129,108,194,147, 61, 16, 78, 36,115, 49,239,
+100, 5, 76,239, 89, 19, 36,160,167,167, 56, 18, 42,113,194,149, 43,165,176,221,110,177, 60, 61, 69, 79,241,130, 65,202,108, 54,
+195, 29, 0,134,199,206,112,144,136, 27,216,226,114, 99, 56,150,212,104,198, 68,156, 21,115,255, 83,243,219, 82,197,239,100, 91,
+ 83,162,150,156,211, 32, 17,185,153,114,100,129,142, 38,232, 50, 49,198,247, 50,165, 70,105,134,162,220, 25,207,227,102, 92, 20,
+216,153, 29,117, 18, 98, 83,188, 40,138, 2, 37, 25, 28,215, 4,154,166, 65, 77,133, 22,166,237, 37, 34,156, 77,167, 88,139, 17,
+104,114, 8,136, 97, 30,166,166,155,145, 74, 3, 45,146,171,152,254,149, 11,196,101, 74,105, 57, 49,172,149,110,202,201,169,234,
+137, 18,165, 84, 39,247,180, 24,135,200,185, 0, 93, 69,230,217, 19,223,239,196,160,214,158,104, 96, 54, 34,118, 33,150, 78, 68,
+ 75, 42,230, 64,222, 81, 0,149, 30,129, 45,158,239,131, 93, 55,187,177,134, 42, 93, 28, 23, 23,139, 5,154,166, 25, 32,103,219,
+142,158,183, 38,137,167,201, 34,157,191,148,242,201,241, 91, 49, 38,150,141,211,220,115,107,157,131,141,212,105,241, 34,203,210,
+165, 75,100,224,136,168,241,148, 80, 86, 14,214, 11, 83, 94, 40, 39,225,124,132, 19, 29,231, 28,118, 84,133,226,134, 10,182,218,
+174,239, 7,164, 98, 76, 24, 16, 46, 27,181, 37,241, 22, 98, 16,137,186,156,152,184,107, 73, 49,199,243,172,229,218,221,188,121,
+115,232,134,164,252,198,121,143,135, 46, 94, 28, 10,248,222,195, 88,145,112,100,162, 1, 46,158, 40, 37,221, 4, 19, 81, 33, 23,
+216,237, 6, 58, 66,140, 56,139,149,205,161,199, 76, 10,186,162, 65, 73, 41,169, 74,170,211, 61,116,184, 16, 58,145,253,107,252,
+ 55, 21,229, 39,211,233, 20,117, 85, 13,155, 50,155,161,164, 97,124, 44, 19, 9, 98, 45,242,233,188,169, 41,151,169,178, 12,208,
+ 26, 69,150, 1,162, 9,187,110, 26,212, 44,117,167,198, 12,118,207, 60,131,154,217, 80,103, 45,214,155, 13, 86, 12, 83,229,172,
+184, 84,159,173,117, 14,153, 88, 32, 89,233, 79, 77,175,141, 19, 23, 89, 73,219, 75,232, 68, 16, 5,171,211, 18,101, 72,159, 16,
+208, 6, 20, 70,228, 22, 43, 29, 24,217,176, 75, 89,173,215,152, 76, 38,184,120,241, 98,200, 98, 59,145,120, 49,101, 33, 11,229,
+ 41, 5, 30,183, 24,197,131,101,123, 58, 13, 25, 53, 92,120,239, 3,236,237,186, 14, 91, 2, 3,114,192,121, 77, 53,135, 48,178,
+140,253,219,161,196, 72, 90,117, 30, 77, 84, 12, 13,208,162,254,170,196, 64,138, 34, 33,251,142,133,185,253,129,222,227, 84,151,
+140, 44,148,123,231,144, 69,136, 43, 52, 67, 83,137,210,146, 85,242,230,196,226,168, 64, 97,208, 96, 37, 38,207,100, 64,102,244,
+ 35, 3,243,136, 92,164,231,204,148, 66,181,219, 13,100,156,181, 88,158,158, 66,122, 24,118,199,125,223,135,154,136,225,116,156,
+253, 92,140,201,229, 6,104, 65,218,133, 14,114, 94,104,178, 66,153,170,167,134, 55, 73,168, 25,187,158,148,184, 75,139,137, 94,
+113, 60,104,187, 14,158, 94, 33,169,174,235,208, 14, 84, 85, 21, 86,171, 21, 54,155, 13,242, 60,199,165, 75,151, 48,159,207, 71,
+250,165,208,124, 40,220,140,156,148, 30,247, 7,199, 39, 53, 32, 25,154,170,213, 52, 13,118,187, 93, 64, 90,121, 81, 4, 84,196,
+ 11,239, 40,145,148,242,124,195, 71, 72,214,114, 83,178, 18,217, 42,100,157, 67, 30,213,129, 25,246,229,121, 30,220,128, 19,181,
+130, 67,139, 28,143, 68,142,171, 93,169, 19, 32, 5, 82,172, 81,229,216,210, 52, 13,150,203, 37, 78, 78, 78,208,117, 29, 46, 94,
+188, 56, 12, 93, 37, 40,106,133,134,167, 35, 14,135,221,149, 49, 6, 77,219,134,110,120,110,196, 75,161, 58, 70, 87, 46, 86, 0,
+138,211,188, 38, 94, 40, 12,152,141, 84,223,148,144,233, 32, 39,137,219,126, 98, 55,196, 62,212, 8,139,151,189,183,123,170,103,
+ 65, 87, 28, 74,232,112, 70,149, 44,165,170, 11,121,138,214,208, 98,180,152,115, 14,125,219, 34,163,225,120,109,219, 98,179,217,
+224,248,248, 24,115,122,117,167,160,140,176, 22, 53,189,156,149,148,184, 48,244,118,226, 36, 4,119, 41,220, 88, 72,196,200, 69,
+ 49, 28,237,173, 13, 52,132, 38, 68,228, 4, 64,224,156, 41, 52,197,132,177,149, 2, 47, 75,210, 73,106,230,181,214,152, 16,165,
+ 26, 6, 94,136, 5,110,154, 38, 28, 83, 62, 9,121,180,152,146, 74, 72,225,250, 67,172,169, 68, 97, 35, 53, 91,215,193,208,189,
+ 48, 85, 60,235,123,108,214,107, 44,151, 75, 84,117,141,123,247,238, 97, 58,157,134, 23, 99,144,167, 74,206, 2,226,225,123,117,
+ 93,135, 83,145, 2, 14, 1,189,113,114, 38, 80, 98,156, 72, 90,154, 17,225, 5, 69,195, 49,131, 73, 77, 99,173, 69,211,117,168,
+118, 59,100,212,190, 41,135, 99,243, 8,128,120,138,148, 28,214, 23, 72, 42, 57, 12, 67,104,244,229, 72,176, 67,228, 94,234, 53,
+ 6,124,244,114, 38, 78, 36, 74, 74, 41, 24,106, 27,229, 69,109,154, 6,203,147, 19,172,214,107,220,190,125, 27, 77, 93,163, 41,
+ 75,172,215,235,144, 27,152,162, 0, 8, 5, 49,133,109, 8,159, 91,138, 11,204,221,239,197, 29, 81,168, 41,138, 2,104, 91, 52,
+ 20, 63,131, 52, 38,234,182, 12, 74,136,178, 12,192, 67,139,193,230,198,211,241,155, 76,167,123, 67,241,120, 40, 29,143,237,226,
+197,142,199,126,133,151,158,162,122,192, 89,242,148,184, 6, 28, 47,184,172, 64,133, 90, 52,161, 29, 67, 80,153,135,162,246,212,
+ 37,223, 25,131,150, 94, 29,239,206,157, 59,216, 85, 21,234,166, 65, 57,153,224,233,167,159,198,165,135, 31, 30, 93,191,205, 50,
+228,100, 88,204,224, 86, 85, 53,212, 13,120,146,138,128,164,204, 7,201,207, 57, 25, 11,191, 39, 74,152,153, 82,152,208,164, 21,
+103,109, 56, 5,108,253,204,157,193,123, 42, 73, 10,171,149, 40, 33,206,140,115,177, 0,241, 20, 90,153,213,198, 69,153,152,138,
+ 24,189, 40, 67,162, 22,124,232,149, 50, 70, 42,102, 81,171,104,182, 91,108, 54, 27,236,126,171,177,119, 0, 0, 2,206, 73, 68,
+ 65, 84,118, 59,228,121,142, 25,128,106,183,195,148, 70,200, 72,132,199,125,190,146,130,150,180, 2, 15,212,107,232,197,127,216,
+247, 59, 41, 40,227, 53,145,129, 89,142,244,177, 22,179,217, 12, 43, 10,194,185,156, 44, 73,180, 8,195, 83,211,117, 29, 26, 78,
+ 92, 68,237,210,123, 31, 38, 99,121,162,115,195, 28,207,104,248,133,161,105, 80,188, 73,129,150, 16,173, 64, 41, 69, 68,220,123,
+155,137,121,112,161,205,147, 11,222,252,114, 87, 81,128,102, 56,185, 88, 44, 70,254, 27,192,240,170,123, 98,182, 4,128,176,113,
+210,184, 24, 5, 5,185,137, 40,164, 56, 81, 27,224,207,101,125, 92,146,117,153,112,171, 53, 21,226, 83,221, 65,124,221,193, 5,
+ 17,127, 35, 19, 12, 69, 11, 33,155,203,100,191,112,140,203, 25, 31, 55,162, 90,212, 11,148, 32, 37,126,178,217,205,104,141, 76,
+136, 1,248,232, 59, 33,131, 73,141, 39,230,205,110, 9,245,116,109,139, 83,122,169, 17, 69, 10, 57, 69, 90,125,153,179, 56, 42,
+158,112,220,200,148, 10, 35,229,249,101,170, 88, 11,203,229, 67,153,187,184,232,217,246, 52,174,194, 32,184,198,192,181,228, 76,
+180,114, 57, 58, 81, 25, 48, 52,233,105, 10,104, 0, 6, 13, 60,177,126,124, 51, 74,142,174,164, 28, 64,186, 25,249, 66,155,124,
+131,187,170, 66, 71, 86,176,247,138, 71, 52, 67, 39, 12, 1, 20, 15, 16,203, 87,226,124, 36,188,200, 27, 33,150,144,132,209, 98,
+201,226, 74, 93, 85, 88,158,156,132,105,133,172, 96,227,190,134,150,192, 7, 23,108,182,219,237,208,110,196,197, 22, 97, 12, 46,
+114, 53,146,154, 72, 17,137, 18,150, 50,114, 98,113,150,117, 46,240, 96, 33, 19,102, 77,165,124,117, 33, 14, 80,101, 89, 98, 50,
+153,132, 1,213,169, 49,241,178,148,201,242,188,188, 44, 71,163,123,101, 33, 91, 74,202,195, 56, 74, 17, 99,152, 70,144,245, 87,
+230,107,120,209, 55,155,205,200, 18,173,152,232,251,232,163,143,226,242,229,203,152,209, 75,225, 90,231, 0,122,105,196,160,164,
+163,211,204, 19,208,121,174,167, 87,106,152,243,198, 69,123,218,144,150,105,110, 97, 48,225,100, 18, 49,168, 34, 96,161,201,224,
+216, 21,247, 17, 41,105,186,174,195, 71, 31,125,116, 95,116,171,245,253, 57, 65,121, 14, 80,225,165, 44,138, 33,251,229,128,196,
+ 92, 12,249, 75,134,109, 85, 85, 13, 20, 65,228,171,227,217,211, 18, 59,143,116, 68,209, 76, 33,239,253,160,191,140, 40,226, 94,
+ 8,104,229,171, 44, 49, 50, 89,204,231,120,255,253,247, 67,158,192,244,181, 38,151,215, 81,198,203,226,179,166,174, 67,241,158,
+101, 36, 77,211,160, 37, 94,200, 37, 12,110,143, 32,228, 87,103,162,181,104,154, 38, 12,238,246,228,254, 60,185,160,170,174, 7,
+ 20, 84,148, 37, 86,171,213,240,178, 75, 50,173,150,252, 63, 89,167,162, 76, 81,186, 19,185,192, 76, 90,181,109, 59,200,252,132,
+164, 59,140, 50, 16,175,178, 33,199, 9,164, 50,229, 84,214,204,110,145,255,215,150,168,240,176,168,125,143,140, 90, 86, 89,168,
+165, 8, 20,100, 81, 39, 13,191,122,119, 71,214, 45,135,175, 42,238,135, 38, 35,203,164, 98, 46,158,125, 23,189, 46, 50,207, 34,
+109,154, 38,232,146,156, 76,112,133,225,253, 31, 32, 1, 67,246, 69,185,191,176, 0, 0, 0, 0, 73, 69, 78, 68,174, 66, 96,130,
+ 0};
+
diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt
index ce21d47ae48..762db26bc4f 100644
--- a/source/blender/editors/gpencil/CMakeLists.txt
+++ b/source/blender/editors/gpencil/CMakeLists.txt
@@ -47,4 +47,8 @@ set(SRC
gpencil_intern.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/gpencil/SConscript b/source/blender/editors/gpencil/SConscript
index dca419d2fb7..9d92a238eb7 100644
--- a/source/blender/editors/gpencil/SConscript
+++ b/source/blender/editors/gpencil/SConscript
@@ -8,4 +8,9 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../gpu ../../blenloader ../../bmesh ../../blenfont'
incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern'
-env.BlenderLib ( 'bf_editors_gpencil', sources, Split(incs), [], libtype=['core'], priority=[45] )
+defs = []
+
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_gpencil', sources, Split(incs), defs, libtype=['core'], priority=[45] )
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 76af016b6c6..528991e31f0 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -79,7 +79,7 @@ typedef enum eDrawStrokeFlags {
GP_DRAWDATA_ONLYV2D = (1<<2), /* only draw 'canvas' strokes */
GP_DRAWDATA_ONLYI2D = (1<<3), /* only draw 'image' strokes */
GP_DRAWDATA_IEDITHACK = (1<<4), /* special hack for drawing strokes in Image Editor (weird coordinates) */
- GP_DRAWDATA_NO_XRAY = (1<<5), /* dont draw xray in 3D view (which is default) */
+ GP_DRAWDATA_NO_XRAY = (1<<5), /* don't draw xray in 3D view (which is default) */
} eDrawStrokeFlags;
@@ -298,7 +298,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness_s
for (i=0, pt1=points, pt2=points+1; i < (totpoints-1); i++, pt1++, pt2++) {
float s0[2], s1[2]; /* segment 'center' points */
- float t0[2], t1[2]; /* tesselated coordinates */
+ float t0[2], t1[2]; /* tessellated coordinates */
float m1[2], m2[2]; /* gradient and normal */
float mt[2], sc[2]; /* gradient for thickness, point for end-cap */
float pthick; /* thickness at segment point */
@@ -513,7 +513,7 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int
glDepthMask(0);
glEnable(GL_DEPTH_TEST);
- /* first arg is normally rv3d->dist, but this isnt available here and seems to work quite well without */
+ /* first arg is normally rv3d->dist, but this isn't available here and seems to work quite well without */
bglPolygonOffset(1.0f, 1.0f);
#if 0
glEnable(GL_POLYGON_OFFSET_LINE);
@@ -783,7 +783,7 @@ void draw_gpencil_view3d (Scene *scene, View3D *v3d, ARegion *ar, short only3d)
gpd= gpencil_data_get_active_v3d(scene); // XXX
if (gpd == NULL) return;
- /* when rendering to the offscreen buffer we dont want to
+ /* when rendering to the offscreen buffer we don't want to
* deal with the camera border, otherwise map the coords to the camera border. */
if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) {
rctf rectf;
@@ -791,10 +791,10 @@ void draw_gpencil_view3d (Scene *scene, View3D *v3d, ARegion *ar, short only3d)
BLI_copy_rcti_rctf(&rect, &rectf);
}
else {
- rect.xmin= 0;
- rect.ymin= 0;
- rect.xmax= ar->winx;
- rect.ymax= ar->winy;
+ rect.xmin = 0;
+ rect.ymin = 0;
+ rect.xmax = ar->winx;
+ rect.ymax = ar->winy;
}
/* draw it! */
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index c932eb4c7d0..3b0847c2e0f 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -561,7 +561,7 @@ static short mirror_gpf_xaxis (bGPDframe *gpf, Scene *scene)
static short mirror_gpf_marker (bGPDframe *gpf, Scene *scene)
{
static TimeMarker *marker;
- static short initialised = 0;
+ static short initialized = 0;
int diff;
/* In order for this mirror function to work without
@@ -581,16 +581,16 @@ static short mirror_gpf_marker (bGPDframe *gpf, Scene *scene)
}
else {
/* initialization time */
- if (initialised) {
+ if (initialized) {
/* reset everything for safety */
marker = NULL;
- initialised = 0;
+ initialized = 0;
}
else {
/* try to find a marker */
marker= ED_markers_get_first_selected(&scene->markers);
- if(marker) {
- initialised= 1;
+ if (marker) {
+ initialized= 1;
}
}
}
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 9a492153b7f..ced7dab91f4 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -143,7 +143,7 @@ bGPdata **gpencil_data_get_pointers (bContext *C, PointerRNA *ptr)
SpaceClip *sc= (SpaceClip *)CTX_wm_space_data(C);
MovieClip *clip= ED_space_clip(sc);
- if(clip) {
+ if (clip) {
/* for now, as long as there's a clip, default to using that in Clip Editor */
if (ptr) RNA_id_pointer_create(&clip->id, ptr);
return &clip->gpd;
@@ -213,14 +213,14 @@ static int gp_data_add_exec (bContext *C, wmOperator *op)
void GPENCIL_OT_data_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Grease Pencil Add New";
- ot->idname= "GPENCIL_OT_data_add";
- ot->description= "Add new Grease Pencil datablock";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Grease Pencil Add New";
+ ot->idname = "GPENCIL_OT_data_add";
+ ot->description = "Add new Grease Pencil datablock";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* callbacks */
- ot->exec= gp_data_add_exec;
- ot->poll= gp_add_poll;
+ ot->exec = gp_data_add_exec;
+ ot->poll = gp_add_poll;
}
/* ******************* Unlink Data ************************ */
@@ -261,14 +261,14 @@ static int gp_data_unlink_exec (bContext *C, wmOperator *op)
void GPENCIL_OT_data_unlink (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Grease Pencil Unlink";
- ot->idname= "GPENCIL_OT_data_unlink";
- ot->description= "Unlink active Grease Pencil datablock";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Grease Pencil Unlink";
+ ot->idname = "GPENCIL_OT_data_unlink";
+ ot->description = "Unlink active Grease Pencil datablock";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* callbacks */
- ot->exec= gp_data_unlink_exec;
- ot->poll= gp_data_unlink_poll;
+ ot->exec = gp_data_unlink_exec;
+ ot->poll = gp_data_unlink_poll;
}
/* ******************* Add New Layer ************************ */
@@ -298,14 +298,14 @@ static int gp_layer_add_exec (bContext *C, wmOperator *op)
void GPENCIL_OT_layer_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add New Layer";
- ot->idname= "GPENCIL_OT_layer_add";
- ot->description= "Add new Grease Pencil layer for the active Grease Pencil datablock";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Add New Layer";
+ ot->idname = "GPENCIL_OT_layer_add";
+ ot->description = "Add new Grease Pencil layer for the active Grease Pencil datablock";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* callbacks */
- ot->exec= gp_layer_add_exec;
- ot->poll= gp_add_poll;
+ ot->exec = gp_layer_add_exec;
+ ot->poll = gp_add_poll;
}
/* ******************* Delete Active Frame ************************ */
@@ -349,14 +349,14 @@ static int gp_actframe_delete_exec (bContext *C, wmOperator *op)
void GPENCIL_OT_active_frame_delete (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Active Frame";
- ot->idname= "GPENCIL_OT_active_frame_delete";
- ot->description= "Delete the active frame for the active Grease Pencil datablock";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Delete Active Frame";
+ ot->idname = "GPENCIL_OT_active_frame_delete";
+ ot->description = "Delete the active frame for the active Grease Pencil datablock";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* callbacks */
- ot->exec= gp_actframe_delete_exec;
- ot->poll= gp_actframe_delete_poll;
+ ot->exec = gp_actframe_delete_exec;
+ ot->poll = gp_actframe_delete_poll;
}
/* ************************************************ */
@@ -402,7 +402,7 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi
VECCOPY2D(mvalf, mvali);
}
else {
- if(subrect) {
+ if (subrect) {
mvalf[0]= (((float)pt->x/100.0f) * (subrect->xmax - subrect->xmin)) + subrect->xmin;
mvalf[1]= (((float)pt->y/100.0f) * (subrect->ymax - subrect->ymin)) + subrect->ymin;
}
@@ -561,7 +561,7 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short
return;
/* initialize camera framing */
- if(gp_camera_view_subrect(C, &subrect)) {
+ if (gp_camera_view_subrect(C, &subrect)) {
subrect_ptr= &subrect;
}
@@ -632,21 +632,21 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op)
void GPENCIL_OT_convert (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Convert Grease Pencil";
- ot->idname= "GPENCIL_OT_convert";
- ot->description= "Convert the active Grease Pencil layer to a new Object";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Convert Grease Pencil";
+ ot->idname = "GPENCIL_OT_convert";
+ ot->description = "Convert the active Grease Pencil layer to a new Object";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= gp_convert_layer_exec;
- ot->poll= gp_convert_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = gp_convert_layer_exec;
+ ot->poll = gp_convert_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_gpencil_convertmodes, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_gpencil_convertmodes, 0, "Type", "");
}
/* ************************************************ */
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index 954c79bb17d..0afe791029f 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -50,7 +50,7 @@
void ED_keymap_gpencil(wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Grease Pencil", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Grease Pencil", 0, 0);
wmKeyMapItem *kmi;
/* Draw */
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 535a0f947f1..b21c059fcc1 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -902,7 +902,7 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho
}
#endif
else {
- if(p->subrect == NULL) { /* normal 3D view */
+ if (p->subrect == NULL) { /* normal 3D view */
x0= (int)(pt1->x / 100 * p->ar->winx);
y0= (int)(pt1->y / 100 * p->ar->winy);
x1= (int)(pt2->x / 100 * p->ar->winx);
@@ -940,10 +940,10 @@ static void gp_stroke_doeraser (tGPsdata *p)
rcti rect;
/* rect is rectangle of eraser */
- rect.xmin= p->mval[0] - p->radius;
- rect.ymin= p->mval[1] - p->radius;
- rect.xmax= p->mval[0] + p->radius;
- rect.ymax= p->mval[1] + p->radius;
+ rect.xmin = p->mval[0] - p->radius;
+ rect.ymin = p->mval[1] - p->radius;
+ rect.xmax = p->mval[0] + p->radius;
+ rect.ymax = p->mval[1] + p->radius;
/* loop over strokes, checking segments for intersections */
for (gps= gpf->strokes.first; gps; gps= gpn) {
@@ -1204,7 +1204,7 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
if (p->gpl == NULL) {
p->gpl= gpencil_layer_addnew(p->gpd);
- if(p->custom_color[3])
+ if (p->custom_color[3])
copy_v3_v3(p->gpl->color, p->custom_color);
}
if (p->gpl->flag & GP_LAYER_LOCKED) {
@@ -1756,7 +1756,7 @@ static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op)
if (gp_session_initdata(C, p))
gp_paint_initstroke(p, p->paintmode);
- if(p->status != GP_STATUS_ERROR)
+ if (p->status != GP_STATUS_ERROR)
p->status= GP_STATUS_PAINTING;
return op->customdata;
@@ -1919,19 +1919,19 @@ static EnumPropertyItem prop_gpencil_drawmodes[] = {
void GPENCIL_OT_draw (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Grease Pencil Draw";
- ot->idname= "GPENCIL_OT_draw";
- ot->description= "Make annotations on the active data";
+ ot->name = "Grease Pencil Draw";
+ ot->idname = "GPENCIL_OT_draw";
+ ot->description = "Make annotations on the active data";
/* api callbacks */
- ot->exec= gpencil_draw_exec;
- ot->invoke= gpencil_draw_invoke;
- ot->modal= gpencil_draw_modal;
- ot->cancel= gpencil_draw_cancel;
- ot->poll= gpencil_draw_poll;
+ ot->exec = gpencil_draw_exec;
+ ot->invoke = gpencil_draw_invoke;
+ ot->modal = gpencil_draw_modal;
+ ot->cancel = gpencil_draw_cancel;
+ ot->poll = gpencil_draw_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* settings for drawing */
RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to interpret mouse movements");
diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c
index 1ab00082043..36624b88a9f 100644
--- a/source/blender/editors/gpencil/gpencil_undo.c
+++ b/source/blender/editors/gpencil/gpencil_undo.c
@@ -69,10 +69,10 @@ int ED_undo_gpencil_step(bContext *C, int step, const char *name)
gpd_ptr= gpencil_data_get_pointers(C, NULL);
- if(step==1) { /* undo */
+ if (step==1) { /* undo */
//printf("\t\tGP - undo step\n");
- if(cur_node->prev) {
- if(!name || strcmp(cur_node->name, name) == 0) {
+ if (cur_node->prev) {
+ if (!name || strcmp(cur_node->name, name) == 0) {
cur_node= cur_node->prev;
new_gpd= cur_node->gpd;
}
@@ -80,17 +80,17 @@ int ED_undo_gpencil_step(bContext *C, int step, const char *name)
}
else if (step==-1) {
//printf("\t\tGP - redo step\n");
- if(cur_node->next) {
- if(!name || strcmp(cur_node->name, name) == 0) {
+ if (cur_node->next) {
+ if (!name || strcmp(cur_node->name, name) == 0) {
cur_node= cur_node->next;
new_gpd= cur_node->gpd;
}
}
}
- if(new_gpd) {
- if(gpd_ptr) {
- if(*gpd_ptr) {
+ if (new_gpd) {
+ if (gpd_ptr) {
+ if (*gpd_ptr) {
bGPdata *gpd= *gpd_ptr;
bGPDlayer *gpl, *gpld;
@@ -124,11 +124,11 @@ void gpencil_undo_push(bGPdata *gpd)
//printf("\t\tGP - undo push\n");
- if(cur_node) {
+ if (cur_node) {
/* remove all un-done nodes from stack */
undo_node= cur_node->next;
- while(undo_node) {
+ while (undo_node) {
bGPundonode *next_node= undo_node->next;
free_gpencil_data(undo_node->gpd);
@@ -153,7 +153,7 @@ void gpencil_undo_finish(void)
{
bGPundonode *undo_node= undo_nodes.first;
- while(undo_node) {
+ while (undo_node) {
free_gpencil_data(undo_node->gpd);
MEM_freeN(undo_node->gpd);
diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h
index c725808ec34..9b20553e0cc 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -69,6 +69,9 @@ extern char datatoc_blur_png[];
extern int datatoc_clay_png_size;
extern char datatoc_clay_png[];
+extern int datatoc_claystrips_png_size;
+extern char datatoc_claystrips_png[];
+
extern int datatoc_clone_png_size;
extern char datatoc_clone_png[];
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 17a06bbb9ac..5bb30ab6d40 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -192,7 +192,7 @@ struct UvVertMap *EDBM_make_uv_vert_map(struct BMEditMesh *em, int selected, int
void EM_add_data_layer(struct BMEditMesh *em, struct CustomData *data, int type, const char *name);
void EM_free_data_layer(struct BMEditMesh *em, struct CustomData *data, int type);
-void EDBM_toggle_select_all(struct BMEditMesh *em);
+void EDBM_select_toggle_all(struct BMEditMesh *em);
void EDBM_flag_enable_all(struct BMEditMesh *em, const char hflag);
void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
void EDBM_select_mirrored(struct Object *obedit, struct BMEditMesh *em, int extend);
diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h
index 2b99e52057d..e723ff73532 100644
--- a/source/blender/editors/include/ED_numinput.h
+++ b/source/blender/editors/include/ED_numinput.h
@@ -28,6 +28,15 @@
#define __ED_NUMINPUT_H__
+/*
+ The ctrl value has different meaning:
+ 0 : No value has been typed
+
+ otherwise, |value| - 1 is where the cursor is located after the period
+ Positive : number is positive
+ Negative : number is negative
+*/
+
typedef struct NumInput {
short idx;
short idx_max;
diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h
index 51699d095ae..6f7d0c55b9a 100644
--- a/source/blender/editors/include/ED_screen_types.h
+++ b/source/blender/editors/include/ED_screen_types.h
@@ -41,6 +41,7 @@ typedef struct ScreenAnimData {
short flag; /* flags for playback */
int sfra; /* frame that playback was started from */
int nextfra; /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */
+ double last_duration; /* used for frame dropping */
} ScreenAnimData;
/* for animplayer */
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 4532a351c7d..f6dee351c29 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -175,8 +175,8 @@ typedef enum SnapMode
#define SNAP_MIN_DISTANCE 30
-int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, const float mval[2]);
-int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2]);
+int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, const float mval[2], SnapMode mode);
+int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2], SnapMode mode);
int snapObjectsTransform(struct TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
int snapObjectsContext(struct bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index f35af356c94..c1fa45a10a1 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -843,17 +843,13 @@ DEF_ICON(LONGDISPLAY)
DEF_ICON(SHORTDISPLAY)
DEF_ICON(GHOST)
DEF_ICON(IMGDISPLAY)
-#ifndef DEF_ICON_BLANK_SKIP
- DEF_ICON(BLANK284)
- DEF_ICON(BLANK285)
-#endif
+DEF_ICON(SAVE_AS)
+DEF_ICON(SAVE_COPY)
DEF_ICON(BOOKMARKS)
DEF_ICON(FONTPREVIEW)
DEF_ICON(FILTER)
DEF_ICON(NEWFOLDER)
-#ifndef DEF_ICON_BLANK_SKIP
- DEF_ICON(BLANK285F)
-#endif
+DEF_ICON(OPEN_RECENT)
DEF_ICON(FILE_PARENT)
DEF_ICON(FILE_REFRESH)
DEF_ICON(FILE_FOLDER)
@@ -864,26 +860,26 @@ DEF_ICON(FILE_MOVIE)
DEF_ICON(FILE_SCRIPT)
DEF_ICON(FILE_SOUND)
DEF_ICON(FILE_FONT)
-#ifndef DEF_ICON_BLANK_SKIP
- DEF_ICON(BLANK291b)
+DEF_ICON(FILE_TEXT)
- /* available */
- DEF_ICON(BLANK292)
- DEF_ICON(BLANK293)
- DEF_ICON(BLANK294)
- DEF_ICON(BLANK295)
- DEF_ICON(BLANK296)
- DEF_ICON(BLANK297)
- DEF_ICON(BLANK298)
- DEF_ICON(BLANK299)
+ /* FILE SELECT */
+DEF_ICON(RECOVER_AUTO)
+DEF_ICON(SAVE_PREFS)
+DEF_ICON(LINK_BLEND)
+DEF_ICON(APPEND_BLEND)
+DEF_ICON(IMPORT)
+DEF_ICON(EXPORT)
+DEF_ICON(EXTERNAL_DATA)
+DEF_ICON(LOAD_FACTORY)
+#ifndef DEF_ICON_BLANK_SKIP
DEF_ICON(BLANK300)
DEF_ICON(BLANK301)
DEF_ICON(BLANK302)
DEF_ICON(BLANK303)
DEF_ICON(BLANK304)
- DEF_ICON(BLANK305)
- DEF_ICON(BLANK306)
#endif
+DEF_ICON(LOOP_BACK)
+DEF_ICON(LOOP_FORWARDS)
DEF_ICON(BACK)
DEF_ICON(FORWARD)
#ifndef DEF_ICON_BLANK_SKIP
@@ -968,6 +964,7 @@ DEF_ICON(BRUSH_ADD)
DEF_ICON(BRUSH_BLOB)
DEF_ICON(BRUSH_BLUR)
DEF_ICON(BRUSH_CLAY)
+DEF_ICON(BRUSH_CLAY_STRIPS)
DEF_ICON(BRUSH_CLONE)
DEF_ICON(BRUSH_CREASE)
DEF_ICON(BRUSH_DARKEN)
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 4e7474c6f5f..041ab08a37d 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -133,8 +133,9 @@ enum {
TH_STRIP_SELECT,
TH_LAMP,
-
TH_SPEAKER,
+ TH_CAMERA,
+ TH_EMPTY,
TH_NODE,
TH_NODE_IN_OUT,
@@ -149,6 +150,7 @@ enum {
TH_CONSOLE_CURSOR,
TH_SEQ_MOVIE,
+ TH_SEQ_MOVIECLIP,
TH_SEQ_IMAGE,
TH_SEQ_SCENE,
TH_SEQ_AUDIO,
@@ -156,6 +158,7 @@ enum {
TH_SEQ_PLUGIN,
TH_SEQ_TRANSITION,
TH_SEQ_META,
+ TH_SEQ_PREVIEW,
TH_EDGE_SHARP,
TH_EDITMESH_ACTIVE,
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index edddd9bf407..b6821abf243 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -81,7 +81,7 @@
/* avoid unneeded calls to ui_get_but_val */
#define UI_BUT_VALUE_UNSET DBL_MAX
-#define UI_GET_BUT_VALUE_INIT(_but, _value) if(_value == DBL_MAX) { (_value)= ui_get_but_val(_but); }
+#define UI_GET_BUT_VALUE_INIT(_but, _value) if (_value == DBL_MAX) { (_value)= ui_get_but_val(_but); }
/*
* a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt
@@ -107,7 +107,7 @@ void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y
gx= *x;
gy= *y;
- if(block->panel) {
+ if (block->panel) {
gx += block->panel->ofsx;
gy += block->panel->ofsy;
}
@@ -137,10 +137,10 @@ void ui_block_to_window_rct(const ARegion *ar, uiBlock *block, rctf *graph, rcti
ui_block_to_window_fl(ar, block, &tmpr.xmin, &tmpr.ymin);
ui_block_to_window_fl(ar, block, &tmpr.xmax, &tmpr.ymax);
- winr->xmin= tmpr.xmin;
- winr->ymin= tmpr.ymin;
- winr->xmax= tmpr.xmax;
- winr->ymax= tmpr.ymax;
+ winr->xmin = tmpr.xmin;
+ winr->ymin = tmpr.ymin;
+ winr->xmax = tmpr.xmax;
+ winr->ymax = tmpr.ymax;
}
void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y) /* for mouse cursor */
@@ -167,7 +167,7 @@ void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y
*y= (a*(py-f) + d*(c-px))/(a*e-d*b);
*x= (px- b*(*y)- c)/a;
- if(block->panel) {
+ if (block->panel) {
*x -= block->panel->ofsx;
*y -= block->panel->ofsy;
}
@@ -198,7 +198,7 @@ void ui_block_translate(uiBlock *block, int x, int y)
{
uiBut *bt;
- for(bt= block->buttons.first; bt; bt=bt->next) {
+ for (bt= block->buttons.first; bt; bt=bt->next) {
bt->x1 += x;
bt->y1 += y;
bt->x2 += x;
@@ -220,21 +220,21 @@ static void ui_text_bounds_block(uiBlock *block, float offset)
uiStyleFontSet(&style->widget);
- for(bt= block->buttons.first; bt; bt= bt->next) {
- if(bt->type!=SEPR) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
+ if (bt->type!=SEPR) {
j= BLF_width(style->widget.uifont_id, bt->drawstr);
- if(j > i) i = j;
+ if (j > i) i = j;
}
- if(bt->next && bt->x1 < bt->next->x1)
+ if (bt->next && bt->x1 < bt->next->x1)
lastcol++;
}
/* cope with multi collumns */
bt= block->buttons.first;
- while(bt) {
- if(bt->next && bt->x1 < bt->next->x1) {
+ while (bt) {
+ if (bt->next && bt->x1 < bt->next->x1) {
nextcol= 1;
col++;
}
@@ -243,12 +243,12 @@ static void ui_text_bounds_block(uiBlock *block, float offset)
bt->x1 = x1addval;
bt->x2 = bt->x1 + i + block->bounds;
- if(col == lastcol)
+ if (col == lastcol)
bt->x2= MAX2(bt->x2, offset + block->minbounds);
ui_check_but(bt); // clips text again
- if(nextcol)
+ if (nextcol)
x1addval+= i + block->bounds;
bt= bt->next;
@@ -260,8 +260,8 @@ void ui_bounds_block(uiBlock *block)
uiBut *bt;
int xof;
- if(block->buttons.first==NULL) {
- if(block->panel) {
+ if (block->buttons.first==NULL) {
+ if (block->panel) {
block->minx= 0.0; block->maxx= block->panel->sizex;
block->miny= 0.0; block->maxy= block->panel->sizey;
}
@@ -272,12 +272,12 @@ void ui_bounds_block(uiBlock *block)
block->maxx= block->maxy= -10000;
bt= block->buttons.first;
- while(bt) {
- if(bt->x1 < block->minx) block->minx= bt->x1;
- if(bt->y1 < block->miny) block->miny= bt->y1;
+ while (bt) {
+ if (bt->x1 < block->minx) block->minx= bt->x1;
+ if (bt->y1 < block->miny) block->miny= bt->y1;
- if(bt->x2 > block->maxx) block->maxx= bt->x2;
- if(bt->y2 > block->maxy) block->maxy= bt->y2;
+ if (bt->x2 > block->maxx) block->maxx= bt->x2;
+ if (bt->y2 > block->maxy) block->maxy= bt->y2;
bt= bt->next;
}
@@ -292,13 +292,13 @@ void ui_bounds_block(uiBlock *block)
/* hardcoded exception... but that one is annoying with larger safety */
bt= block->buttons.first;
- if(bt && strncmp(bt->str, "ERROR", 5)==0) xof= 10;
+ if (bt && strncmp(bt->str, "ERROR", 5)==0) xof= 10;
else xof= 40;
- block->safety.xmin= block->minx-xof;
- block->safety.ymin= block->miny-xof;
- block->safety.xmax= block->maxx+xof;
- block->safety.ymax= block->maxy+xof;
+ block->safety.xmin = block->minx-xof;
+ block->safety.ymin = block->miny-xof;
+ block->safety.xmax = block->maxx+xof;
+ block->safety.ymax = block->maxy+xof;
}
static void ui_centered_bounds_block(const bContext *C, uiBlock *block)
@@ -345,8 +345,8 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
oldheight= block->maxy - block->miny;
/* first we ensure wide enough text bounds */
- if(bounds_calc==UI_BLOCK_BOUNDS_POPUP_MENU) {
- if(block->flag & UI_BLOCK_LOOP) {
+ if (bounds_calc==UI_BLOCK_BOUNDS_POPUP_MENU) {
+ if (block->flag & UI_BLOCK_LOOP) {
block->bounds= 50;
ui_text_bounds_block(block, block->minx);
}
@@ -369,19 +369,19 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
startx= window->eventstate->x + block->minx + (block->mx*width)/oldwidth;
starty= window->eventstate->y + block->miny + (block->my*height)/oldheight;
- if(startx<10)
+ if (startx<10)
startx= 10;
- if(starty<10)
+ if (starty<10)
starty= 10;
endx= startx+width;
endy= starty+height;
- if(endx>xmax) {
+ if (endx>xmax) {
endx= xmax-10;
startx= endx-width;
}
- if(endy>ymax-20) {
+ if (endy>ymax-20) {
endy= ymax-20;
starty= endy-height;
}
@@ -395,7 +395,7 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
/* used for various cases */
void uiBoundsBlock(uiBlock *block, int addval)
{
- if(block==NULL)
+ if (block==NULL)
return;
block->bounds= addval;
@@ -452,7 +452,7 @@ static int ui_but_float_precision(uiBut *but, double value)
int prec;
/* first check if prec is 0 and fallback to a simple default */
- if((prec= (int)but->a2) == 0) {
+ if ((prec= (int)but->a2) == 0) {
prec= (but->hardmax < 10.001f) ? 3 : 2;
}
@@ -460,16 +460,16 @@ static int ui_but_float_precision(uiBut *but, double value)
* the number, this is so 0.00001 is not displayed as 0.00,
* _but_, this is only for small values si 10.0001 will not get
* the same treatment */
- if(value != 0.0 && (value= ABS(value)) < 0.1) {
+ if (value != 0.0 && (value= ABS(value)) < 0.1) {
int value_i= (int)((value * PRECISION_FLOAT_MAX_POW) + 0.5);
- if(value_i != 0) {
+ if (value_i != 0) {
const int prec_span= 3; /* show: 0.01001, 5 would allow 0.0100001 for eg. */
int test_prec;
int prec_min= -1;
int dec_flag= 0;
int i= PRECISION_FLOAT_MAX;
- while(i && value_i) {
- if(value_i % 10) {
+ while (i && value_i) {
+ if (value_i % 10) {
dec_flag |= 1<<i;
prec_min= i;
}
@@ -482,12 +482,12 @@ static int ui_but_float_precision(uiBut *but, double value)
dec_flag= (dec_flag >> (prec_min + 1)) & ((1 << prec_span) - 1);
- while(dec_flag) {
+ while (dec_flag) {
test_prec++;
dec_flag = dec_flag >> 1;
}
- if(test_prec > prec) {
+ if (test_prec > prec) {
prec= test_prec;
}
}
@@ -502,14 +502,14 @@ static void ui_draw_linkline(uiLinkLine *line)
{
rcti rect;
- if(line->from==NULL || line->to==NULL) return;
+ if (line->from==NULL || line->to==NULL) return;
- rect.xmin= (line->from->x1+line->from->x2)/2.0f;
- rect.ymin= (line->from->y1+line->from->y2)/2.0f;
- rect.xmax= (line->to->x1+line->to->x2)/2.0f;
- rect.ymax= (line->to->y1+line->to->y2)/2.0f;
+ rect.xmin = (line->from->x1+line->from->x2)/2.0f;
+ rect.ymin = (line->from->y1+line->from->y2)/2.0f;
+ rect.xmax = (line->to->x1+line->to->x2)/2.0f;
+ rect.ymax = (line->to->y1+line->to->y2)/2.0f;
- if(line->flag & UI_SELECT)
+ if (line->flag & UI_SELECT)
glColor3ub(100,100,100);
else
glColor3ub(0,0,0);
@@ -523,10 +523,10 @@ static void ui_draw_links(uiBlock *block)
uiLinkLine *line;
but= block->buttons.first;
- while(but) {
- if(but->type==LINK && but->link) {
+ while (but) {
+ if (but->type==LINK && but->link) {
line= but->link->lines.first;
- while(line) {
+ while (line) {
ui_draw_linkline(line);
line= line->next;
}
@@ -542,16 +542,16 @@ static int ui_but_equals_old(uiBut *but, uiBut *oldbut)
{
/* various properties are being compared here, hopefully sufficient
* to catch all cases, but it is simple to add more checks later */
- if(but->retval != oldbut->retval) return 0;
- if(but->rnapoin.data != oldbut->rnapoin.data) return 0;
- if(but->rnaprop != oldbut->rnaprop)
- if(but->rnaindex != oldbut->rnaindex) return 0;
- if(but->func != oldbut->func) return 0;
- if(but->funcN != oldbut->funcN) return 0;
- if(oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return 0;
- if(oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return 0;
- if(!but->funcN && ((but->poin != oldbut->poin && (uiBut*)oldbut->poin != oldbut) || but->pointype != oldbut->pointype)) return 0;
- if(but->optype != oldbut->optype) return 0;
+ if (but->retval != oldbut->retval) return 0;
+ if (but->rnapoin.data != oldbut->rnapoin.data) return 0;
+ if (but->rnaprop != oldbut->rnaprop)
+ if (but->rnaindex != oldbut->rnaindex) return 0;
+ if (but->func != oldbut->func) return 0;
+ if (but->funcN != oldbut->funcN) return 0;
+ if (oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return 0;
+ if (oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return 0;
+ if (!but->funcN && ((but->poin != oldbut->poin && (uiBut*)oldbut->poin != oldbut) || but->pointype != oldbut->pointype)) return 0;
+ if (but->optype != oldbut->optype) return 0;
return 1;
}
@@ -563,25 +563,25 @@ static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut
uiBut *but;
/* if active button is LINK */
- if(newbut->type==LINK && newbut->link) {
+ if (newbut->type==LINK && newbut->link) {
SWAP(uiLink *, oldbut->link, newbut->link);
- for(line= oldbut->link->lines.first; line; line= line->next) {
- if(line->to==newbut)
+ for (line= oldbut->link->lines.first; line; line= line->next) {
+ if (line->to==newbut)
line->to= oldbut;
- if(line->from==newbut)
+ if (line->from==newbut)
line->from= oldbut;
}
}
/* check all other button links */
- for(but= block->buttons.first; but; but= but->next) {
- if(but!=newbut && but->type==LINK && but->link) {
- for(line= but->link->lines.first; line; line= line->next) {
- if(line->to==newbut)
+ for (but= block->buttons.first; but; but= but->next) {
+ if (but!=newbut && but->type==LINK && but->link) {
+ for (line= but->link->lines.first; line; line= line->next) {
+ if (line->to==newbut)
line->to= oldbut;
- if(line->from==newbut)
+ if (line->from==newbut)
line->from= oldbut;
}
}
@@ -595,12 +595,12 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
int found= 0;
oldblock= block->oldblock;
- if(!oldblock)
+ if (!oldblock)
return found;
- for(oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) {
- if(ui_but_equals_old(oldbut, but)) {
- if(oldbut->active) {
+ for (oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) {
+ if (ui_but_equals_old(oldbut, but)) {
+ if (oldbut->active) {
#if 0
// but->flag= oldbut->flag;
#else
@@ -638,14 +638,14 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
/* typically the same pointers, but not on undo/redo */
/* XXX some menu buttons store button itself in but->poin. Ugly */
- if(oldbut->poin != (char *)oldbut) {
+ if (oldbut->poin != (char *)oldbut) {
SWAP(char *, oldbut->poin, but->poin)
SWAP(void *, oldbut->func_argN, but->func_argN)
}
/* copy hardmin for list rows to prevent 'sticking' highlight to mouse position
* when scrolling without moving mouse (see [#28432]) */
- if(ELEM(oldbut->type, ROW, LISTROW))
+ if (ELEM(oldbut->type, ROW, LISTROW))
oldbut->hardmax= but->hardmax;
ui_but_update_linklines(block, oldbut, but);
@@ -679,24 +679,24 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
int activate= 0, found= 0, isactive= 0;
oldblock= block->oldblock;
- if(!oldblock)
+ if (!oldblock)
activate= 1;
else {
- for(oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) {
- if(ui_but_equals_old(oldbut, but)) {
+ for (oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) {
+ if (ui_but_equals_old(oldbut, but)) {
found= 1;
- if(oldbut->active)
+ if (oldbut->active)
isactive= 1;
break;
}
}
}
- if(activate || found==0) {
+ if (activate || found==0) {
ui_button_activate_do( (bContext *)C, CTX_wm_region(C), but);
}
- else if(found && isactive==0) {
+ else if (found && isactive==0) {
BLI_remlink(&block->buttons, but);
ui_free_but(C, but);
@@ -706,17 +706,17 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
return 1;
}
-/* use to check if we need to disable undo, but dont make any changes
+/* use to check if we need to disable undo, but don't make any changes
* returns FALSE if undo needs to be disabled. */
static int ui_but_is_rna_undo(uiBut *but)
{
- if(but->rnapoin.id.data) {
+ if (but->rnapoin.id.data) {
/* avoid undo push for buttons who's ID are screen or wm level
* we could disable undo for buttons with no ID too but may have
* unforeseen consequences, so best check for ID's we _know_ are not
* handled by undo - campbell */
ID *id= but->rnapoin.id.data;
- if(ID_CHECK_UNDO(id) == FALSE) {
+ if (ID_CHECK_UNDO(id) == FALSE) {
return FALSE;
}
else {
@@ -743,32 +743,32 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
int tot_missing= 0;
/* only do it before bounding */
- if(block->minx != block->maxx)
+ if (block->minx != block->maxx)
return;
- for(pass=0; pass<2; pass++) {
+ for (pass=0; pass<2; pass++) {
/* 2 Passes, on for first letter only, second for any letter if first fails
* fun first pass on all buttons so first word chars always get first priority */
- for(but=block->buttons.first; but; but=but->next) {
- if(!ELEM4(but->type, BUT, MENU, BLOCK, PULLDOWN) || (but->flag & UI_HIDDEN)) {
+ for (but=block->buttons.first; but; but=but->next) {
+ if (!ELEM4(but->type, BUT, MENU, BLOCK, PULLDOWN) || (but->flag & UI_HIDDEN)) {
/* pass */
}
- else if(but->menu_key=='\0') {
- if(but->str) {
- for(str_pt= but->str; *str_pt; ) {
+ else if (but->menu_key=='\0') {
+ if (but->str) {
+ for (str_pt= but->str; *str_pt; ) {
menu_key= tolower(*str_pt);
- if((menu_key >= 'a' && menu_key <= 'z') && !(menu_key_mask & 1<<(menu_key-'a'))) {
+ if ((menu_key >= 'a' && menu_key <= 'z') && !(menu_key_mask & 1<<(menu_key-'a'))) {
menu_key_mask |= 1<<(menu_key-'a');
break;
}
- if(pass==0) {
+ if (pass==0) {
/* Skip to next delimiter on first pass (be picky) */
- while(isalpha(*str_pt))
+ while (isalpha(*str_pt))
str_pt++;
- if(*str_pt)
+ if (*str_pt)
str_pt++;
}
else {
@@ -777,7 +777,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
}
}
- if(*str_pt) {
+ if (*str_pt) {
but->menu_key= menu_key;
}
else {
@@ -786,7 +786,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
}
/* if all keys have been used just exit, unlikely */
- if(menu_key_mask == (1<<26)-1) {
+ if (menu_key_mask == (1<<26)-1) {
return;
}
}
@@ -794,7 +794,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
}
/* check if second pass is needed */
- if(!tot_missing) {
+ if (!tot_missing) {
break;
}
}
@@ -808,7 +808,7 @@ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const short do_st
if (do_strip) {
char *cpoin= strchr(but->str, '|');
- if(cpoin) {
+ if (cpoin) {
*cpoin= '\0';
}
}
@@ -844,14 +844,14 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
IDProperty *prop_menu_name= NULL;
/* only do it before bounding */
- if(block->minx != block->maxx)
+ if (block->minx != block->maxx)
return;
- for(but=block->buttons.first; but; but=but->next) {
- if(but->optype) {
+ for (but=block->buttons.first; but; but=but->next) {
+ if (but->optype) {
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
- if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
+ if (WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
buf, sizeof(buf)))
{
ui_but_add_shortcut(but, buf, FALSE);
@@ -868,7 +868,7 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
IDP_AssignString(prop_menu_name, mt->idname, sizeof(mt->idname));
- if(WM_key_event_operator_string(C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, FALSE,
+ if (WM_key_event_operator_string(C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, FALSE,
buf, sizeof(buf)))
{
ui_but_add_shortcut(but, buf, FALSE);
@@ -894,30 +894,30 @@ void uiEndBlock(const bContext *C, uiBlock *block)
* on matching buttons, we need this to make button event handling non
* blocking, while still allowing buttons to be remade each redraw as it
* is expected by blender code */
- for(but=block->buttons.first; but; but=but->next) {
- if(ui_but_update_from_old_block(C, block, &but))
+ for (but=block->buttons.first; but; but=but->next) {
+ if (ui_but_update_from_old_block(C, block, &but))
ui_check_but(but);
/* temp? Proper check for greying out */
- if(but->optype) {
+ if (but->optype) {
wmOperatorType *ot= but->optype;
- if(but->context)
+ if (but->context)
CTX_store_set((bContext*)C, but->context);
- if(ot == NULL || WM_operator_poll_context((bContext*)C, ot, but->opcontext)==0) {
+ if (ot == NULL || WM_operator_poll_context((bContext*)C, ot, but->opcontext)==0) {
but->flag |= UI_BUT_DISABLED;
but->lock = 1;
}
- if(but->context)
+ if (but->context)
CTX_store_set((bContext*)C, NULL);
}
ui_but_anim_flag(but, (scene)? scene->r.cfra: 0.0f);
}
- if(block->oldblock) {
+ if (block->oldblock) {
block->auto_open= block->oldblock->auto_open;
block->auto_open_last= block->oldblock->auto_open_last;
block->tooltipdisabled= block->oldblock->tooltipdisabled;
@@ -926,21 +926,21 @@ void uiEndBlock(const bContext *C, uiBlock *block)
}
/* handle pending stuff */
- if(block->layouts.first) uiBlockLayoutResolve(block, NULL, NULL);
+ if (block->layouts.first) uiBlockLayoutResolve(block, NULL, NULL);
ui_block_do_align(block);
- if((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) {
+ if ((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) {
ui_menu_block_set_keyaccels(block); /* could use a different flag to check */
}
- if(block->flag & UI_BLOCK_LOOP) ui_menu_block_set_keymaps(C, block);
+ if (block->flag & UI_BLOCK_LOOP) ui_menu_block_set_keymaps(C, block);
/* after keymaps! */
- if(block->dobounds == UI_BLOCK_BOUNDS) ui_bounds_block(block);
- else if(block->dobounds == UI_BLOCK_BOUNDS_TEXT) ui_text_bounds_block(block, 0.0f);
- else if(block->dobounds == UI_BLOCK_BOUNDS_POPUP_CENTER) ui_centered_bounds_block(C, block);
- else if(block->dobounds) ui_popup_bounds_block(C, block, block->dobounds);
+ if (block->dobounds == UI_BLOCK_BOUNDS) ui_bounds_block(block);
+ else if (block->dobounds == UI_BLOCK_BOUNDS_TEXT) ui_text_bounds_block(block, 0.0f);
+ else if (block->dobounds == UI_BLOCK_BOUNDS_POPUP_CENTER) ui_centered_bounds_block(C, block);
+ else if (block->dobounds) ui_popup_bounds_block(C, block, block->dobounds);
- if(block->minx==0.0f && block->maxx==0.0f) uiBoundsBlock(block, 0);
- if(block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
+ if (block->minx==0.0f && block->maxx==0.0f) uiBoundsBlock(block, 0);
+ if (block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
block->endblock= 1;
}
@@ -949,14 +949,14 @@ void uiEndBlock(const bContext *C, uiBlock *block)
void ui_fontscale(short *points, float aspect)
{
- if(aspect < 0.9f || aspect > 1.1f) {
+ if (aspect < 0.9f || aspect > 1.1f) {
float pointsf= *points;
/* for some reason scaling fonts goes too fast compared to widget size */
aspect= sqrt(aspect);
pointsf /= aspect;
- if(aspect > 1.0f)
+ if (aspect > 1.0f)
*points= ceilf(pointsf);
else
*points= floorf(pointsf);
@@ -975,14 +975,14 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u
gx= (but?but->x1:block->minx) + (block->panel?block->panel->ofsx:0.0f);
gy= (but?but->y1:block->miny) + (block->panel?block->panel->ofsy:0.0f);
- rect->xmin= floorf(getsizex*(0.5f+ 0.5f*(gx*block->winmat[0][0]+ gy*block->winmat[1][0]+ block->winmat[3][0])));
- rect->ymin= floorf(getsizey*(0.5f+ 0.5f*(gx*block->winmat[0][1]+ gy*block->winmat[1][1]+ block->winmat[3][1])));
+ rect->xmin = floorf(getsizex*(0.5f+ 0.5f*(gx*block->winmat[0][0]+ gy*block->winmat[1][0]+ block->winmat[3][0])));
+ rect->ymin = floorf(getsizey*(0.5f+ 0.5f*(gx*block->winmat[0][1]+ gy*block->winmat[1][1]+ block->winmat[3][1])));
gx= (but?but->x2:block->maxx) + (block->panel?block->panel->ofsx:0.0f);
gy= (but?but->y2:block->maxy) + (block->panel?block->panel->ofsy:0.0f);
- rect->xmax= floorf(getsizex*(0.5f+ 0.5f*(gx*block->winmat[0][0]+ gy*block->winmat[1][0]+ block->winmat[3][0])));
- rect->ymax= floorf(getsizey*(0.5f+ 0.5f*(gx*block->winmat[0][1]+ gy*block->winmat[1][1]+ block->winmat[3][1])));
+ rect->xmax = floorf(getsizex*(0.5f+ 0.5f*(gx*block->winmat[0][0]+ gy*block->winmat[1][0]+ block->winmat[3][0])));
+ rect->ymax = floorf(getsizey*(0.5f+ 0.5f*(gx*block->winmat[0][1]+ gy*block->winmat[1][1]+ block->winmat[3][1])));
}
@@ -997,15 +997,15 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
/* get menu region or area region */
ar= CTX_wm_menu(C);
- if(!ar)
+ if (!ar)
ar= CTX_wm_region(C);
- if(!block->endblock)
+ if (!block->endblock)
uiEndBlock(C, block);
/* disable AA, makes widgets too blurry */
multisample_enabled= glIsEnabled(GL_MULTISAMPLE_ARB);
- if(multisample_enabled)
+ if (multisample_enabled)
glDisable(GL_MULTISAMPLE_ARB);
/* we set this only once */
@@ -1030,19 +1030,19 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
/* back */
- if(block->flag & UI_BLOCK_LOOP)
+ if (block->flag & UI_BLOCK_LOOP)
ui_draw_menu_back(&style, block, &rect);
- else if(block->panel)
+ else if (block->panel)
ui_draw_aligned_panel(&style, block, &rect);
/* widgets */
- for(but= block->buttons.first; but; but= but->next) {
- if(!(but->flag & (UI_HIDDEN|UI_SCROLLED))) {
+ for (but= block->buttons.first; but; but= but->next) {
+ if (!(but->flag & (UI_HIDDEN|UI_SCROLLED))) {
ui_but_to_pixelrect(&rect, ar, block, but);
/* XXX: figure out why invalid coordinates happen when closing render window */
/* and material preview is redrawn in main window (temp fix for bug #23848) */
- if(rect.xmin < rect.xmax && rect.ymin < rect.ymax)
+ if (rect.xmin < rect.xmax && rect.ymin < rect.ymax)
ui_draw_but(C, ar, &style, but, &rect);
}
}
@@ -1053,7 +1053,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
- if(multisample_enabled)
+ if (multisample_enabled)
glEnable(GL_MULTISAMPLE_ARB);
ui_draw_links(block);
@@ -1065,13 +1065,13 @@ static void ui_is_but_sel(uiBut *but, double *value)
{
short is_push=0, is_true=1;
- if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) is_true= 0;
+ if (ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) is_true= 0;
- if( but->bit ) {
+ if ( but->bit ) {
int lvalue;
UI_GET_BUT_VALUE_INIT(but, *value)
lvalue= (int)*value;
- if( BTST(lvalue, (but->bitnr)) ) is_push= is_true;
+ if ( BTST(lvalue, (but->bitnr)) ) is_push= is_true;
else is_push= !is_true;
}
else {
@@ -1091,23 +1091,23 @@ static void ui_is_but_sel(uiBut *but, double *value)
case ICONTOG:
case OPTION:
UI_GET_BUT_VALUE_INIT(but, *value)
- if(*value != (double)but->hardmin) is_push= 1;
+ if (*value != (double)but->hardmin) is_push= 1;
break;
case ICONTOGN:
case TOGN:
case OPTIONN:
UI_GET_BUT_VALUE_INIT(but, *value)
- if(*value==0.0) is_push= 1;
+ if (*value==0.0) is_push= 1;
break;
case ROW:
case LISTROW:
UI_GET_BUT_VALUE_INIT(but, *value)
/* support for rna enum buts */
- if(but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
- if((int)*value & (int)but->hardmax) is_push= 1;
+ if (but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
+ if ((int)*value & (int)but->hardmax) is_push= 1;
}
else {
- if(*value == (double)but->hardmax) is_push= 1;
+ if (*value == (double)but->hardmax) is_push= 1;
}
break;
case COL:
@@ -1119,8 +1119,8 @@ static void ui_is_but_sel(uiBut *but, double *value)
}
}
- if(is_push==2);
- else if(is_push==1) but->flag |= UI_SELECT;
+ if (is_push==2);
+ else if (is_push==1) but->flag |= UI_SELECT;
else but->flag &= ~UI_SELECT;
}
@@ -1129,9 +1129,9 @@ static uiBut *ui_find_inlink(uiBlock *block, void *poin)
uiBut *but;
but= block->buttons.first;
- while(but) {
- if(but->type==INLINK) {
- if(but->poin == poin) return but;
+ while (but) {
+ if (but->type==INLINK) {
+ if (but->poin == poin) return but;
}
but= but->next;
}
@@ -1161,24 +1161,24 @@ void uiComposeLinks(uiBlock *block)
int a;
but= block->buttons.first;
- while(but) {
- if(but->type==LINK) {
+ while (but) {
+ if (but->type==LINK) {
link= but->link;
/* for all pointers in the array */
- if(link) {
- if(link->ppoin) {
+ if (link) {
+ if (link->ppoin) {
ppoin= link->ppoin;
- for(a=0; a < *(link->totlink); a++) {
+ for (a=0; a < *(link->totlink); a++) {
bt= ui_find_inlink(block, (*ppoin)[a] );
- if(bt) {
+ if (bt) {
ui_add_link_line(&link->lines, but, bt);
}
}
}
- else if(link->poin) {
+ else if (link->poin) {
bt= ui_find_inlink(block, *(link->poin) );
- if(bt) {
+ if (bt) {
ui_add_link_line(&link->lines, but, bt);
}
}
@@ -1193,7 +1193,7 @@ void uiComposeLinks(uiBlock *block)
void uiBlockSetButLock(uiBlock *block, int val, const char *lockstr)
{
- if(val) {
+ if (val) {
block->lock= val ? 1:0;
block->lockstr= lockstr;
}
@@ -1217,18 +1217,18 @@ void ui_delete_linkline(uiLinkLine *line, uiBut *but)
link= line->from->link;
/* are there more pointers allowed? */
- if(link->ppoin) {
+ if (link->ppoin) {
- if(*(link->totlink)==1) {
+ if (*(link->totlink)==1) {
*(link->totlink)= 0;
MEM_freeN(*(link->ppoin));
*(link->ppoin)= NULL;
}
else {
b= 0;
- for(a=0; a< (*(link->totlink)); a++) {
+ for (a=0; a< (*(link->totlink)); a++) {
- if( (*(link->ppoin))[a] != line->to->poin ) {
+ if ( (*(link->ppoin))[a] != line->to->poin ) {
(*(link->ppoin))[b]= (*(link->ppoin))[a];
b++;
}
@@ -1254,30 +1254,30 @@ void ui_get_but_vectorf(uiBut *but, float vec[3])
PropertyRNA *prop;
int a, tot;
- if(but->editvec) {
+ if (but->editvec) {
copy_v3_v3(vec, but->editvec);
}
- if(but->rnaprop) {
+ if (but->rnaprop) {
prop= but->rnaprop;
vec[0]= vec[1]= vec[2]= 0.0f;
- if(RNA_property_type(prop) == PROP_FLOAT) {
+ if (RNA_property_type(prop) == PROP_FLOAT) {
tot= RNA_property_array_length(&but->rnapoin, prop);
tot= MIN2(tot, 3);
- for(a=0; a<tot; a++)
+ for (a=0; a<tot; a++)
vec[a]= RNA_property_float_get_index(&but->rnapoin, prop, a);
}
}
- else if(but->pointype == CHA) {
+ else if (but->pointype == CHA) {
char *cp= (char *)but->poin;
vec[0]= ((float)cp[0])/255.0f;
vec[1]= ((float)cp[1])/255.0f;
vec[2]= ((float)cp[2])/255.0f;
}
- else if(but->pointype == FLO) {
+ else if (but->pointype == FLO) {
float *fp= (float *)but->poin;
copy_v3_v3(vec, fp);
}
@@ -1298,14 +1298,14 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
{
PropertyRNA *prop;
- if(but->editvec) {
+ if (but->editvec) {
copy_v3_v3(but->editvec, vec);
}
- if(but->rnaprop) {
+ if (but->rnaprop) {
prop= but->rnaprop;
- if(RNA_property_type(prop) == PROP_FLOAT) {
+ if (RNA_property_type(prop) == PROP_FLOAT) {
int tot;
int a;
@@ -1317,13 +1317,13 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
}
}
}
- else if(but->pointype == CHA) {
+ else if (but->pointype == CHA) {
char *cp= (char *)but->poin;
cp[0]= (char)(0.5f + vec[0]*255.0f);
cp[1]= (char)(0.5f + vec[1]*255.0f);
cp[2]= (char)(0.5f + vec[2]*255.0f);
}
- else if(but->pointype == FLO) {
+ else if (but->pointype == FLO) {
float *fp= (float *)but->poin;
copy_v3_v3(fp, vec);
}
@@ -1331,10 +1331,10 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
int ui_is_but_float(uiBut *but)
{
- if(but->pointype==FLO && but->poin)
+ if (but->pointype==FLO && but->poin)
return 1;
- if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT)
+ if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT)
return 1;
return 0;
@@ -1345,7 +1345,7 @@ int ui_is_but_unit(uiBut *but)
UnitSettings *unit= but->block->unit;
const int unit_type= uiButGetUnitType(but);
- if(unit_type == PROP_UNIT_NONE)
+ if (unit_type == PROP_UNIT_NONE)
return 0;
#if 1 // removed so angle buttons get correct snapping
@@ -1382,27 +1382,27 @@ double ui_get_but_val(uiBut *but)
PropertyRNA *prop;
double value = 0.0;
- if(but->editval) { return *(but->editval); }
- if(but->poin==NULL && but->rnapoin.data==NULL) return 0.0;
+ if (but->editval) { return *(but->editval); }
+ if (but->poin==NULL && but->rnapoin.data==NULL) return 0.0;
- if(but->rnaprop) {
+ if (but->rnaprop) {
prop= but->rnaprop;
switch(RNA_property_type(prop)) {
case PROP_BOOLEAN:
- if(RNA_property_array_check(prop))
+ if (RNA_property_array_check(prop))
value= RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_boolean_get(&but->rnapoin, prop);
break;
case PROP_INT:
- if(RNA_property_array_check(prop))
+ if (RNA_property_array_check(prop))
value= RNA_property_int_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_int_get(&but->rnapoin, prop);
break;
case PROP_FLOAT:
- if(RNA_property_array_check(prop))
+ if (RNA_property_array_check(prop))
value= RNA_property_float_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_float_get(&but->rnapoin, prop);
@@ -1415,7 +1415,7 @@ double ui_get_but_val(uiBut *but)
break;
}
}
- else if(but->type== HSVSLI) {
+ else if (but->type== HSVSLI) {
float h, s, v, *fp;
fp= (but->editvec)? but->editvec: (float *)but->poin;
@@ -1427,16 +1427,16 @@ double ui_get_but_val(uiBut *but)
case 'V': value= v; break;
}
}
- else if( but->pointype == CHA ) {
+ else if ( but->pointype == CHA ) {
value= *(char *)but->poin;
}
- else if( but->pointype == SHO ) {
+ else if ( but->pointype == SHO ) {
value= *(short *)but->poin;
}
- else if( but->pointype == INT ) {
+ else if ( but->pointype == INT ) {
value= *(int *)but->poin;
}
- else if( but->pointype == FLO ) {
+ else if ( but->pointype == FLO ) {
value= *(float *)but->poin;
}
@@ -1448,31 +1448,31 @@ void ui_set_but_val(uiBut *but, double value)
PropertyRNA *prop;
/* value is a hsv value: convert to rgb */
- if(but->rnaprop) {
+ if (but->rnaprop) {
prop= but->rnaprop;
- if(RNA_property_editable(&but->rnapoin, prop)) {
+ if (RNA_property_editable(&but->rnapoin, prop)) {
switch(RNA_property_type(prop)) {
case PROP_BOOLEAN:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if (RNA_property_array_length(&but->rnapoin, prop))
RNA_property_boolean_set_index(&but->rnapoin, prop, but->rnaindex, value);
else
RNA_property_boolean_set(&but->rnapoin, prop, value);
break;
case PROP_INT:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if (RNA_property_array_length(&but->rnapoin, prop))
RNA_property_int_set_index(&but->rnapoin, prop, but->rnaindex, (int)value);
else
RNA_property_int_set(&but->rnapoin, prop, (int)value);
break;
case PROP_FLOAT:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if (RNA_property_array_length(&but->rnapoin, prop))
RNA_property_float_set_index(&but->rnapoin, prop, but->rnaindex, value);
else
RNA_property_float_set(&but->rnapoin, prop, value);
break;
case PROP_ENUM:
- if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+ if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
int ivalue= (int)value;
ivalue ^= RNA_property_enum_get(&but->rnapoin, prop); /* toggle for enum/flag buttons */
RNA_property_enum_set(&but->rnapoin, prop, ivalue);
@@ -1490,8 +1490,8 @@ void ui_set_but_val(uiBut *but, double value)
* so leave this unset */
value= UI_BUT_VALUE_UNSET;
}
- else if(but->pointype==0);
- else if(but->type==HSVSLI ) {
+ else if (but->pointype==0);
+ else if (but->type==HSVSLI ) {
float h, s, v, *fp;
fp= (but->editvec)? but->editvec: (float *)but->poin;
@@ -1508,9 +1508,9 @@ void ui_set_but_val(uiBut *but, double value)
}
else {
/* first do rounding */
- if(but->pointype==CHA)
+ if (but->pointype==CHA)
value= (char)floor(value+0.5);
- else if(but->pointype==SHO ) {
+ else if (but->pointype==SHO ) {
/* gcc 3.2.1 seems to have problems
* casting a double like 32772.0 to
* a short so we cast to an int, then
@@ -1519,24 +1519,24 @@ void ui_set_but_val(uiBut *but, double value)
gcckludge = (int) floor(value+0.5);
value= (short)gcckludge;
}
- else if(but->pointype==INT )
+ else if (but->pointype==INT )
value= (int)floor(value+0.5);
- else if(but->pointype==FLO ) {
+ else if (but->pointype==FLO ) {
float fval= (float)value;
- if(fval>= -0.00001f && fval<= 0.00001f) fval= 0.0f; /* prevent negative zero */
+ if (fval>= -0.00001f && fval<= 0.00001f) fval= 0.0f; /* prevent negative zero */
value= fval;
}
/* then set value with possible edit override */
- if(but->editval)
+ if (but->editval)
value= *but->editval= value;
- else if(but->pointype==CHA)
+ else if (but->pointype==CHA)
value= *((char *)but->poin)= (char)value;
- else if(but->pointype==SHO)
+ else if (but->pointype==SHO)
value= *((short *)but->poin)= (short)value;
- else if(but->pointype==INT)
+ else if (but->pointype==INT)
value= *((int *)but->poin)= (int)value;
- else if(but->pointype==FLO)
+ else if (but->pointype==FLO)
value= *((float *)but->poin)= (float)value;
}
@@ -1546,9 +1546,9 @@ void ui_set_but_val(uiBut *but, double value)
int ui_get_but_string_max_length(uiBut *but)
{
- if(ELEM(but->type, TEX, SEARCH_MENU))
+ if (ELEM(but->type, TEX, SEARCH_MENU))
return but->hardmax;
- else if(but->type == IDPOIN)
+ else if (but->type == IDPOIN)
return MAX_ID_NAME-2;
else
return UI_MAX_DRAW_STR;
@@ -1559,16 +1559,16 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
UnitSettings *unit= but->block->unit;
int unit_type= uiButGetUnitType(but);
- if(unit_type == PROP_UNIT_LENGTH) {
+ if (unit_type == PROP_UNIT_LENGTH) {
return value * (double)unit->scale_length;
}
- else if(unit_type == PROP_UNIT_AREA) {
+ else if (unit_type == PROP_UNIT_AREA) {
return value * pow(unit->scale_length, 2);
}
- else if(unit_type == PROP_UNIT_VOLUME) {
+ else if (unit_type == PROP_UNIT_VOLUME) {
return value * pow(unit->scale_length, 3);
}
- else if(unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */
+ else if (unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */
Scene *scene= CTX_data_scene(but->block->evil_C);
return FRA2TIME(value);
}
@@ -1580,7 +1580,7 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
/* str will be overwritten */
void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen)
{
- if(ui_is_but_unit(but)) {
+ if (ui_is_but_unit(but)) {
UnitSettings *unit= but->block->unit;
int unit_type= uiButGetUnitType(but);
char *orig_str;
@@ -1601,11 +1601,11 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va
int unit_type= uiButGetUnitType(but);
int precision= but->a2;
- if(unit->scale_length<0.0001f) unit->scale_length= 1.0f; // XXX do_versions
+ if (unit->scale_length<0.0001f) unit->scale_length= 1.0f; // XXX do_versions
/* Sanity checks */
- if(precision > PRECISION_FLOAT_MAX) precision= PRECISION_FLOAT_MAX;
- else if(precision==0) precision= 2;
+ if (precision > PRECISION_FLOAT_MAX) precision= PRECISION_FLOAT_MAX;
+ else if (precision==0) precision= 2;
bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, unit->system, unit_type>>16, do_split, pad);
}
@@ -1617,7 +1617,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), but->block->unit->system, unit_type);
- if(step > 0.0f) { /* -1 is an error value */
+ if (step > 0.0f) { /* -1 is an error value */
return (float)((double)step/ui_get_but_scale_unit(but, 1.0))*100.0f;
}
else {
@@ -1628,37 +1628,37 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
{
- if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+ if (but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
PropertyType type;
char *buf= NULL;
int buf_len;
type= RNA_property_type(but->rnaprop);
- if(type == PROP_STRING) {
+ if (type == PROP_STRING) {
/* RNA string */
buf= RNA_property_string_get_alloc(&but->rnapoin, but->rnaprop, str, maxlen, &buf_len);
}
- else if(type == PROP_POINTER) {
+ else if (type == PROP_POINTER) {
/* RNA pointer */
PointerRNA ptr= RNA_property_pointer_get(&but->rnapoin, but->rnaprop);
buf= RNA_struct_name_get_alloc(&ptr, str, maxlen, &buf_len);
}
- if(!buf) {
+ if (!buf) {
str[0] = '\0';
}
- else if(buf && buf != str) {
+ else if (buf && buf != str) {
/* string was too long, we have to truncate */
memcpy(str, buf, MIN2(maxlen, buf_len+1));
MEM_freeN(buf);
}
}
- else if(but->type == IDPOIN) {
+ else if (but->type == IDPOIN) {
/* ID pointer */
- if(but->idpoin_idpp) { /* Can be NULL for ID properties by python */
+ if (but->idpoin_idpp) { /* Can be NULL for ID properties by python */
ID *id= *(but->idpoin_idpp);
- if(id) {
+ if (id) {
BLI_strncpy(str, id->name+2, maxlen);
return;
}
@@ -1666,17 +1666,17 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
str[0] = '\0';
return;
}
- else if(but->type == TEX) {
+ else if (but->type == TEX) {
/* string */
BLI_strncpy(str, but->poin, maxlen);
return;
}
- else if(but->type == SEARCH_MENU) {
+ else if (but->type == SEARCH_MENU) {
/* string */
BLI_strncpy(str, but->poin, maxlen);
return;
}
- else if(ui_but_anim_expression_get(but, str, maxlen))
+ else if (ui_but_anim_expression_get(but, str, maxlen))
; /* driver expression */
else {
/* number editing */
@@ -1684,8 +1684,8 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
value= ui_get_but_val(but);
- if(ui_is_but_float(but)) {
- if(ui_is_but_unit(but)) {
+ if (ui_is_but_float(but)) {
+ if (ui_is_but_unit(but)) {
ui_get_but_string_unit(but, str, maxlen, value, 0);
}
else {
@@ -1722,12 +1722,12 @@ int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double
#ifdef WITH_PYTHON
- if(str[0] != '\0') {
+ if (str[0] != '\0') {
int is_unit_but= ui_is_but_unit(but);
/* only enable verbose if we won't run again with units */
- if(BPY_button_exec(C, str, value, is_unit_but==FALSE) != -1) {
+ if (BPY_button_exec(C, str, value, is_unit_but==FALSE) != -1) {
/* if the value parsed ok without unit conversion this button may still need a unit multiplier */
- if(is_unit_but) {
+ if (is_unit_but) {
char str_new[128];
BLI_snprintf(str_new, sizeof(str_new), "%f", *value);
@@ -1737,7 +1737,7 @@ int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double
ok= TRUE; /* parse normal string via py (no unit conversion needed) */
}
}
- else if(is_unit_but) {
+ else if (is_unit_but) {
/* parse failed, this is a unit but so run replacements and parse again */
ok= ui_set_but_string_eval_num_unit(C, but, str, value);
}
@@ -1759,23 +1759,23 @@ int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double
int ui_set_but_string(bContext *C, uiBut *but, const char *str)
{
- if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
- if(RNA_property_editable(&but->rnapoin, but->rnaprop)) {
+ if (but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+ if (RNA_property_editable(&but->rnapoin, but->rnaprop)) {
PropertyType type;
type= RNA_property_type(but->rnaprop);
- if(type == PROP_STRING) {
+ if (type == PROP_STRING) {
/* RNA string */
RNA_property_string_set(&but->rnapoin, but->rnaprop, str);
return 1;
}
- else if(type == PROP_POINTER) {
+ else if (type == PROP_POINTER) {
/* RNA pointer */
PointerRNA ptr, rptr;
PropertyRNA *prop;
- if(str == NULL || str[0] == '\0') {
+ if (str == NULL || str[0] == '\0') {
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, PointerRNA_NULL);
return 1;
}
@@ -1783,7 +1783,7 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
ptr= but->rnasearchpoin;
prop= but->rnasearchprop;
- if(prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr))
+ if (prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr))
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr);
return 1;
@@ -1793,28 +1793,28 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
}
}
}
- else if(but->type == IDPOIN) {
+ else if (but->type == IDPOIN) {
/* ID pointer */
but->idpoin_func(C, str, but->idpoin_idpp);
return 1;
}
- else if(but->type == TEX) {
+ else if (but->type == TEX) {
/* string */
- if(ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax);
+ if (ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax);
else BLI_strncpy(but->poin, str, but->hardmax);
return 1;
}
- else if(but->type == SEARCH_MENU) {
+ else if (but->type == SEARCH_MENU) {
/* string */
BLI_strncpy(but->poin, str, but->hardmax);
return 1;
}
- else if(ui_but_anim_expression_set(but, str)) {
+ else if (ui_but_anim_expression_set(but, str)) {
/* driver expression */
return 1;
}
- else if(str[0]=='#') {
+ else if (str[0]=='#') {
/* shortcut to create new driver expression (versus immediate Py-execution) */
return ui_but_anim_expression_create(but, str+1);
}
@@ -1822,16 +1822,16 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
/* number editing */
double value;
- if(ui_set_but_string_eval_num(C, but, str, &value) == FALSE) {
+ if (ui_set_but_string_eval_num(C, but, str, &value) == FALSE) {
return 0;
}
- if(!ui_is_but_float(but)) value= (int)floor(value + 0.5);
- if(but->type==NUMABS) value= fabs(value);
+ if (!ui_is_but_float(but)) value= (int)floor(value + 0.5);
+ if (but->type==NUMABS) value= fabs(value);
/* not that we use hard limits here */
- if(value < (double)but->hardmin) value= but->hardmin;
- if(value > (double)but->hardmax) value= but->hardmax;
+ if (value < (double)but->hardmin) value= but->hardmin;
+ if (value > (double)but->hardmax) value= but->hardmax;
ui_set_but_val(but, value);
return 1;
@@ -1855,9 +1855,9 @@ static double soft_range_round_up(double value, double max)
/* round up to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, .. */
double newmax= pow(10.0, ceil(log(value)/M_LN10));
- if(newmax*0.2 >= max && newmax*0.2 >= value)
+ if (newmax*0.2 >= max && newmax*0.2 >= value)
return newmax*0.2;
- else if(newmax*0.5 >= max && newmax*0.5 >= value)
+ else if (newmax*0.5 >= max && newmax*0.5 >= value)
return newmax*0.5;
else
return newmax;
@@ -1868,9 +1868,9 @@ static double soft_range_round_down(double value, double max)
/* round down to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, .. */
double newmax= pow(10.0, floor(log(value)/M_LN10));
- if(newmax*5.0 <= max && newmax*5.0 <= value)
+ if (newmax*5.0 <= max && newmax*5.0 <= value)
return newmax*5.0;
- else if(newmax*2.0 <= max && newmax*2.0 <= value)
+ else if (newmax*2.0 <= max && newmax*2.0 <= value)
return newmax*2.0;
else
return newmax;
@@ -1880,9 +1880,9 @@ void ui_set_but_soft_range(uiBut *but, double value)
{
/* ideally we would not limit this but practically, its more then
* enough worst case is very long vectors wont use a smart soft-range
- * which isnt so bad. */
+ * which isn't so bad. */
- if(but->rnaprop) {
+ if (but->rnaprop) {
const PropertyType type= RNA_property_type(but->rnaprop);
double softmin, softmax /*, step, precision*/;
double value_min= value;
@@ -1890,7 +1890,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
/* clamp button range to something reasonable in case
* we get -inf/inf from RNA properties */
- if(type == PROP_INT) {
+ if (type == PROP_INT) {
int imin, imax, istep;
const int array_len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
@@ -1900,14 +1900,14 @@ void ui_set_but_soft_range(uiBut *but, double value)
/*step= istep;*/ /*UNUSED*/
/*precision= 1;*/ /*UNUSED*/
- if(array_len >= 2) {
+ if (array_len >= 2) {
int value_range[2];
RNA_property_int_get_array_range(&but->rnapoin, but->rnaprop, value_range);
value_min= (double)value_range[0];
value_max= (double)value_range[1];
}
}
- else if(type == PROP_FLOAT) {
+ else if (type == PROP_FLOAT) {
float fmin, fmax, fstep, fprecision;
const int array_len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
@@ -1917,7 +1917,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
/*step= fstep;*/ /*UNUSED*/
/*precision= fprecision;*/ /*UNUSED*/
- if(array_len >= 2) {
+ if (array_len >= 2) {
float value_range[2];
RNA_property_float_get_array_range(&but->rnapoin, but->rnaprop, value_range);
value_min= (double)value_range[0];
@@ -1928,22 +1928,22 @@ void ui_set_but_soft_range(uiBut *but, double value)
return;
/* if the value goes out of the soft/max range, adapt the range */
- if(value_min+1e-10 < softmin) {
- if(value_min < 0.0)
+ if (value_min+1e-10 < softmin) {
+ if (value_min < 0.0)
softmin= -soft_range_round_up(-value_min, -softmin);
else
softmin= soft_range_round_down(value_min, softmin);
- if(softmin < (double)but->hardmin)
+ if (softmin < (double)but->hardmin)
softmin= (double)but->hardmin;
}
- if(value_max-1e-10 > softmax) {
- if(value_max < 0.0)
+ if (value_max-1e-10 > softmax) {
+ if (value_max < 0.0)
softmax= -soft_range_round_down(-value_max, -softmax);
else
softmax= soft_range_round_up(value_max, softmax);
- if(softmax > (double)but->hardmax)
+ if (softmax > (double)but->hardmax)
softmax= but->hardmax;
}
@@ -1956,7 +1956,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
static void ui_free_link(uiLink *link)
{
- if(link) {
+ if (link) {
BLI_freelistN(&link->lines);
MEM_freeN(link);
}
@@ -1965,16 +1965,16 @@ static void ui_free_link(uiLink *link)
/* can be called with C==NULL */
static void ui_free_but(const bContext *C, uiBut *but)
{
- if(but->opptr) {
+ if (but->opptr) {
WM_operator_properties_free(but->opptr);
MEM_freeN(but->opptr);
}
- if(but->func_argN) {
+ if (but->func_argN) {
MEM_freeN(but->func_argN);
}
- if(but->active) {
+ if (but->active) {
/* XXX solve later, buttons should be free-able without context ideally,
* however they may have open tooltips or popup windows, which need to
* be closed using a context pointer */
@@ -1982,7 +1982,7 @@ static void ui_free_but(const bContext *C, uiBut *but)
ui_button_active_free(C, but);
}
else {
- if(but->active) {
+ if (but->active) {
MEM_freeN(but->active);
}
}
@@ -2004,7 +2004,7 @@ void uiFreeBlock(const bContext *C, uiBlock *block)
{
uiBut *but;
- while( (but= block->buttons.first) ) {
+ while ( (but= block->buttons.first) ) {
BLI_remlink(&block->buttons, but);
ui_free_but(C, but);
}
@@ -2029,7 +2029,7 @@ void uiFreeBlocks(const bContext *C, ListBase *lb)
{
uiBlock *block;
- while( (block= lb->first) ) {
+ while ( (block= lb->first) ) {
BLI_remlink(lb, block);
uiFreeBlock(C, block);
}
@@ -2039,11 +2039,11 @@ void uiFreeInactiveBlocks(const bContext *C, ListBase *lb)
{
uiBlock *block, *nextblock;
- for(block=lb->first; block; block=nextblock) {
+ for (block=lb->first; block; block=nextblock) {
nextblock= block->next;
- if(!block->handle) {
- if(!block->active) {
+ if (!block->handle) {
+ if (!block->active) {
BLI_remlink(lb, block);
uiFreeBlock(C, block);
}
@@ -2060,7 +2060,7 @@ void uiBlockSetRegion(uiBlock *block, ARegion *region)
/* each listbase only has one block with this name, free block
* if is already there so it can be rebuilt from scratch */
- if(lb) {
+ if (lb) {
oldblock= BLI_findstring(lb, block->name, offsetof(uiBlock, name));
if (oldblock) {
@@ -2100,11 +2100,11 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
BLI_strncpy(block->name, name, sizeof(block->name));
- if(region)
+ if (region)
uiBlockSetRegion(block, region);
/* window matrix and aspect */
- if(region && region->swinid) {
+ if (region && region->swinid) {
wm_subwindow_getmatrix(window, region->swinid, block->winmat);
wm_subwindow_getsize(window, region->swinid, &getsizex, &getsizey);
@@ -2146,7 +2146,7 @@ void ui_check_but(uiBut *but)
ui_is_but_sel(but, &value);
/* only update soft range while not editing */
- if(but->rnaprop && !(but->editval || but->editstr || but->editvec)) {
+ if (but->rnaprop && !(but->editval || but->editstr || but->editvec)) {
UI_GET_BUT_VALUE_INIT(but, value)
ui_set_but_soft_range(but, value);
}
@@ -2159,8 +2159,8 @@ void ui_check_but(uiBut *but)
case NUMSLI:
case HSVSLI:
UI_GET_BUT_VALUE_INIT(but, value)
- if(value < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
- else if(value > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
+ if (value < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
+ else if (value > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
break;
case NUMABS:
@@ -2168,27 +2168,27 @@ void ui_check_but(uiBut *but)
double value_abs;
UI_GET_BUT_VALUE_INIT(but, value)
value_abs= fabs(value);
- if(value_abs < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
- else if(value_abs > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
+ if (value_abs < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
+ else if (value_abs > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
break;
}
case ICONTOG:
case ICONTOGN:
- if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
- if(but->flag & UI_SELECT) but->iconadd= 1;
+ if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
+ if (but->flag & UI_SELECT) but->iconadd= 1;
else but->iconadd= 0;
}
break;
case ICONROW:
- if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
+ if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
UI_GET_BUT_VALUE_INIT(but, value)
but->iconadd= (int)value- (int)(but->hardmin);
}
break;
case ICONTEXTROW:
- if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
+ if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
UI_GET_BUT_VALUE_INIT(but, value)
but->iconadd= (int)value- (int)(but->hardmin);
}
@@ -2205,7 +2205,7 @@ void ui_check_but(uiBut *but)
case MENU:
case ICONTEXTROW:
- if(but->x2 - but->x1 > 24) {
+ if (but->x2 - but->x1 > 24) {
UI_GET_BUT_VALUE_INIT(but, value)
ui_set_name_menu(but, (int)value);
}
@@ -2218,11 +2218,11 @@ void ui_check_but(uiBut *but)
UI_GET_BUT_VALUE_INIT(but, value)
- if(ui_is_but_float(but)) {
- if(value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
- else if(value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str);
+ if (ui_is_but_float(but)) {
+ if (value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
+ else if (value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str);
/* support length type buttons */
- else if(ui_is_but_unit(but)) {
+ else if (ui_is_but_unit(but)) {
char new_str[sizeof(but->drawstr)];
ui_get_but_string_unit(but, new_str, sizeof(new_str), value, TRUE);
BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, new_str);
@@ -2236,7 +2236,7 @@ void ui_check_but(uiBut *but)
BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%d", but->str, (int)value);
}
- if(but->rnaprop) {
+ if (but->rnaprop) {
PropertySubType pstype = RNA_property_subtype(but->rnaprop);
if (pstype == PROP_PERCENTAGE)
@@ -2245,7 +2245,7 @@ void ui_check_but(uiBut *but)
break;
case LABEL:
- if(ui_is_but_float(but)) {
+ if (ui_is_but_float(but)) {
int prec;
UI_GET_BUT_VALUE_INIT(but, value)
prec= ui_but_float_precision(but, value);
@@ -2260,7 +2260,7 @@ void ui_check_but(uiBut *but)
case IDPOIN:
case TEX:
case SEARCH_MENU:
- if(!but->editstr) {
+ if (!but->editstr) {
char str[UI_MAX_DRAW_STR];
ui_get_but_string(but, str, UI_MAX_DRAW_STR-strlen(but->str));
@@ -2284,16 +2284,16 @@ void ui_check_but(uiBut *but)
if (but->flag & UI_SELECT) {
but->drawstr[0]= '\0';
- if(but->modifier_key) {
+ if (but->modifier_key) {
char *str= but->drawstr;
- if(but->modifier_key & KM_SHIFT)
+ if (but->modifier_key & KM_SHIFT)
str= strcat(str, "Shift ");
- if(but->modifier_key & KM_CTRL)
+ if (but->modifier_key & KM_CTRL)
str= strcat(str, "Ctrl ");
- if(but->modifier_key & KM_ALT)
+ if (but->modifier_key & KM_ALT)
str= strcat(str, "Alt ");
- if(but->modifier_key & KM_OSKEY)
+ if (but->modifier_key & KM_OSKEY)
str= strcat(str, "Cmd ");
(void)str; /* UNUSED */
@@ -2308,7 +2308,7 @@ void ui_check_but(uiBut *but)
case BUT_TOGDUAL:
/* trying to get the dual-icon to left of text... not very nice */
- if(but->str[0]) {
+ if (but->str[0]) {
BLI_strncpy(but->drawstr, " ", UI_MAX_DRAW_STR);
BLI_strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2);
}
@@ -2323,7 +2323,7 @@ void ui_check_but(uiBut *but)
}
/* if we are doing text editing, this will override the drawstr */
- if(but->editstr)
+ if (but->editstr)
BLI_strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR);
/* text clipping moved to widget drawing code itself */
@@ -2333,7 +2333,7 @@ void ui_check_but(uiBut *but)
void uiBlockBeginAlign(uiBlock *block)
{
/* if other align was active, end it */
- if(block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
+ if (block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
block->flag |= UI_BUT_ALIGN_DOWN;
block->alignnr++;
@@ -2348,7 +2348,7 @@ static int buts_are_horiz(uiBut *but1, uiBut *but2)
dx= fabs( but1->x2 - but2->x1);
dy= fabs( but1->y1 - but2->y2);
- if(dx > dy) return 0;
+ if (dx > dy) return 0;
return 1;
}
@@ -2369,9 +2369,9 @@ static void ui_block_do_align_but(uiBut *first, short nr)
/* auto align */
- for(but=first; but && but->alignnr == nr; but=but->next) {
- if(but->next && but->next->alignnr == nr) {
- if(buts_are_horiz(but, but->next)) cols++;
+ for (but=first; but && but->alignnr == nr; but=but->next) {
+ if (but->next && but->next->alignnr == nr) {
+ if (buts_are_horiz(but, but->next)) cols++;
else rows++;
}
}
@@ -2379,18 +2379,18 @@ static void ui_block_do_align_but(uiBut *first, short nr)
/* rows==0: 1 row, cols==0: 1 column */
/* note; how it uses 'flag' in loop below (either set it, or OR it) is confusing */
- for(but=first, prev=NULL; but && but->alignnr == nr; prev=but, but=but->next) {
+ for (but=first, prev=NULL; but && but->alignnr == nr; prev=but, but=but->next) {
next= but->next;
- if(next && next->alignnr != nr)
+ if (next && next->alignnr != nr)
next= NULL;
/* clear old flag */
but->flag &= ~UI_BUT_ALIGN;
- if(flag==0) { /* first case */
- if(next) {
- if(buts_are_horiz(but, next)) {
- if(rows==0)
+ if (flag==0) { /* first case */
+ if (next) {
+ if (buts_are_horiz(but, next)) {
+ if (rows==0)
flag= UI_BUT_ALIGN_RIGHT;
else
flag= UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT;
@@ -2400,10 +2400,10 @@ static void ui_block_do_align_but(uiBut *first, short nr)
}
}
}
- else if(next==NULL) { /* last case */
- if(prev) {
- if(buts_are_horiz(prev, but)) {
- if(rows==0)
+ else if (next==NULL) { /* last case */
+ if (prev) {
+ if (buts_are_horiz(prev, but)) {
+ if (rows==0)
flag= UI_BUT_ALIGN_LEFT;
else
flag= UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT;
@@ -2411,39 +2411,39 @@ static void ui_block_do_align_but(uiBut *first, short nr)
else flag= UI_BUT_ALIGN_TOP;
}
}
- else if(buts_are_horiz(but, next)) {
+ else if (buts_are_horiz(but, next)) {
/* check if this is already second row */
- if( prev && buts_are_horiz(prev, but)==0) {
+ if ( prev && buts_are_horiz(prev, but)==0) {
flag &= ~UI_BUT_ALIGN_LEFT;
flag |= UI_BUT_ALIGN_TOP;
/* exception case: bottom row */
- if(rows>0) {
+ if (rows>0) {
uiBut *bt= but;
- while(bt && bt->alignnr == nr) {
- if(bt->next && bt->next->alignnr == nr && buts_are_horiz(bt, bt->next)==0 ) break;
+ while (bt && bt->alignnr == nr) {
+ if (bt->next && bt->next->alignnr == nr && buts_are_horiz(bt, bt->next)==0 ) break;
bt= bt->next;
}
- if(bt==NULL || bt->alignnr != nr) flag= UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT;
+ if (bt==NULL || bt->alignnr != nr) flag= UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT;
}
}
else flag |= UI_BUT_ALIGN_LEFT;
}
else {
- if(cols==0) {
+ if (cols==0) {
flag |= UI_BUT_ALIGN_TOP;
}
else { /* next button switches to new row */
- if(prev && buts_are_horiz(prev, but))
+ if (prev && buts_are_horiz(prev, but))
flag |= UI_BUT_ALIGN_LEFT;
else {
flag &= ~UI_BUT_ALIGN_LEFT;
flag |= UI_BUT_ALIGN_TOP;
}
- if( (flag & UI_BUT_ALIGN_TOP)==0) { /* stil top row */
- if(prev) {
- if(next && buts_are_horiz(but, next))
+ if ( (flag & UI_BUT_ALIGN_TOP)==0) { /* stil top row */
+ if (prev) {
+ if (next && buts_are_horiz(but, next))
flag = UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT|UI_BUT_ALIGN_RIGHT;
else {
/* last button in top row */
@@ -2461,30 +2461,30 @@ static void ui_block_do_align_but(uiBut *first, short nr)
but->flag |= flag;
/* merge coordinates */
- if(prev) {
+ if (prev) {
// simple cases
- if(rows==0) {
+ if (rows==0) {
but->x1= (prev->x2+but->x1)/2.0f;
prev->x2= but->x1;
}
- else if(cols==0) {
+ else if (cols==0) {
but->y2= (prev->y1+but->y2)/2.0f;
prev->y1= but->y2;
}
else {
- if(buts_are_horiz(prev, but)) {
+ if (buts_are_horiz(prev, but)) {
but->x1= (prev->x2+but->x1)/2.0f;
prev->x2= but->x1;
/* copy height too */
but->y2= prev->y2;
}
- else if(prev->prev && buts_are_horiz(prev->prev, prev)==0) {
+ else if (prev->prev && buts_are_horiz(prev->prev, prev)==0) {
/* the previous button is a single one in its row */
but->y2= (prev->y1+but->y2)/2.0f;
prev->y1= but->y2;
but->x1= prev->x1;
- if(next && buts_are_horiz(but, next)==0)
+ if (next && buts_are_horiz(but, next)==0)
but->x2= prev->x2;
}
else {
@@ -2502,15 +2502,15 @@ void ui_block_do_align(uiBlock *block)
short nr;
/* align buttons with same align nr */
- for(but=block->buttons.first; but;) {
- if(but->alignnr) {
+ for (but=block->buttons.first; but;) {
+ if (but->alignnr) {
nr= but->alignnr;
ui_block_do_align_but(but, nr);
/* skip with same number */
- for(; but && but->alignnr == nr; but=but->next);
+ for (; but && but->alignnr == nr; but=but->next);
- if(!but)
+ if (!but)
break;
}
else
@@ -2531,8 +2531,8 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
uiBut *but;
int slen;
- if(type & BUTPOIN) { /* a pointer is required */
- if(poin==NULL)
+ if (type & BUTPOIN) { /* a pointer is required */
+ if (poin==NULL)
return NULL;
}
@@ -2548,7 +2548,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->retval= retval;
slen= strlen(str);
- if(slen >= UI_MAX_NAME_STR-1) {
+ if (slen >= UI_MAX_NAME_STR-1) {
but->str= MEM_mallocN(slen+2, "ui_def_but str"); /* why +2 ? */
}
else {
@@ -2575,7 +2575,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->aspect= 1.0f; //XXX block->aspect;
but->block= block; // pointer back, used for frontbuffer status, and picker
- if((block->flag & UI_BUT_ALIGN) && ui_but_can_align(but))
+ if ((block->flag & UI_BUT_ALIGN) && ui_but_can_align(but))
but->alignnr= block->alignnr;
but->func= block->func;
@@ -2583,24 +2583,24 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->func_arg2= block->func_arg2;
but->funcN= block->funcN;
- if(block->func_argN)
+ if (block->func_argN)
but->func_argN= MEM_dupallocN(block->func_argN);
but->pos= -1; /* cursor invisible */
- if(ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) { /* add a space to name */
+ if (ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) { /* add a space to name */
/* slen remains unchanged from previous assignment, ensure this stays true */
- if(slen>0 && slen<UI_MAX_NAME_STR-2) {
- if(but->str[slen-1]!=' ') {
+ if (slen>0 && slen<UI_MAX_NAME_STR-2) {
+ if (but->str[slen-1]!=' ') {
but->str[slen]= ' ';
but->str[slen+1]= 0;
}
}
}
- if((block->flag & UI_BLOCK_LOOP) || ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR))
+ if ((block->flag & UI_BLOCK_LOOP) || ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR))
but->flag |= (UI_TEXT_LEFT|UI_ICON_LEFT);
- else if(but->type==BUT_TOGDUAL)
+ else if (but->type==BUT_TOGDUAL)
but->flag |= UI_ICON_LEFT;
but->flag |= (block->flag & UI_BUT_ALIGN);
@@ -2612,14 +2612,14 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
}
/* keep track of UI_interface.h */
- if(ELEM7(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, LISTBOX, BUTM));
- else if(ELEM3(but->type, SCROLL, SEPR, FTPREVIEW));
- else if(but->type >= SEARCH_MENU);
+ if (ELEM7(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, LISTBOX, BUTM));
+ else if (ELEM3(but->type, SCROLL, SEPR, FTPREVIEW));
+ else if (but->type >= SEARCH_MENU);
else but->flag |= UI_BUT_UNDO;
BLI_addtail(&block->buttons, but);
- if(block->curlayout)
+ if (block->curlayout)
ui_layout_add_but(block->curlayout, but);
#ifdef WITH_PYTHON
@@ -2653,8 +2653,8 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
int freestr= 0, icon= 0;
/* use rna values if parameters are not specified */
- if(!str) {
- if(type == MENU && proptype == PROP_ENUM) {
+ if (!str) {
+ if (type == MENU && proptype == PROP_ENUM) {
EnumPropertyItem *item;
DynStr *dynstr;
int i, totitem, value, free;
@@ -2664,19 +2664,19 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
dynstr= BLI_dynstr_new();
BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(prop));
- for(i=0; i<totitem; i++) {
- if(!item[i].identifier[0]) {
- if(item[i].name)
+ for (i=0; i<totitem; i++) {
+ if (!item[i].identifier[0]) {
+ if (item[i].name)
BLI_dynstr_appendf(dynstr, "|%s%%l", item[i].name);
else
BLI_dynstr_append(dynstr, "|%l");
}
- else if(item[i].icon)
+ else if (item[i].icon)
BLI_dynstr_appendf(dynstr, "|%s %%i%d %%x%d", item[i].name, item[i].icon, item[i].value);
else
BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
- if(value == item[i].value)
+ if (value == item[i].value)
icon= item[i].icon;
}
str= BLI_dynstr_get_cstring(dynstr);
@@ -2688,13 +2688,13 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
freestr= 1;
}
- else if(ELEM(type, ROW, LISTROW) && proptype == PROP_ENUM) {
+ else if (ELEM(type, ROW, LISTROW) && proptype == PROP_ENUM) {
EnumPropertyItem *item;
int i, totitem, free;
RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
- for(i=0; i<totitem; i++) {
- if(item[i].identifier[0] && item[i].value == (int)max) {
+ for (i=0; i<totitem; i++) {
+ if (item[i].identifier[0] && item[i].value == (int)max) {
str= item[i].name;
icon= item[i].icon;
}
@@ -2713,44 +2713,44 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
}
}
- if(!tip && proptype != PROP_ENUM)
+ if (!tip && proptype != PROP_ENUM)
tip= RNA_property_ui_description(prop);
- if(min == max || a1 == -1 || a2 == -1) {
- if(proptype == PROP_INT) {
+ if (min == max || a1 == -1 || a2 == -1) {
+ if (proptype == PROP_INT) {
int hardmin, hardmax, softmin, softmax, step;
RNA_property_int_range(ptr, prop, &hardmin, &hardmax);
RNA_property_int_ui_range(ptr, prop, &softmin, &softmax, &step);
- if(!ELEM(type, ROW, LISTROW) && min == max) {
+ if (!ELEM(type, ROW, LISTROW) && min == max) {
min= hardmin;
max= hardmax;
}
- if(a1 == -1)
+ if (a1 == -1)
a1= step;
- if(a2 == -1)
+ if (a2 == -1)
a2= 0;
}
- else if(proptype == PROP_FLOAT) {
+ else if (proptype == PROP_FLOAT) {
float hardmin, hardmax, softmin, softmax, step, precision;
RNA_property_float_range(ptr, prop, &hardmin, &hardmax);
RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
- if(!ELEM(type, ROW, LISTROW) && min == max) {
+ if (!ELEM(type, ROW, LISTROW) && min == max) {
min= hardmin;
max= hardmax;
}
- if(a1 == -1)
+ if (a1 == -1)
a1= step;
- if(a2 == -1)
+ if (a2 == -1)
a2= precision;
}
- else if(proptype == PROP_STRING) {
+ else if (proptype == PROP_STRING) {
min= 0;
max= RNA_property_string_maxlength(prop);
- if(max == 0) /* interface code should ideally support unlimited length */
+ if (max == 0) /* interface code should ideally support unlimited length */
max= UI_MAX_DRAW_STR;
}
}
@@ -2761,12 +2761,12 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
but->rnapoin= *ptr;
but->rnaprop= prop;
- if(RNA_property_array_length(&but->rnapoin, but->rnaprop))
+ if (RNA_property_array_length(&but->rnapoin, but->rnaprop))
but->rnaindex= index;
else
but->rnaindex= 0;
- if(icon) {
+ if (icon) {
but->icon= (BIFIconID)icon;
but->flag |= UI_HAS_ICON;
but->flag|= UI_ICON_LEFT;
@@ -2781,7 +2781,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
}
/* If this button uses units, calculate the step from this */
- if((proptype == PROP_FLOAT) && ui_is_but_unit(but)) {
+ if ((proptype == PROP_FLOAT) && ui_is_but_unit(but)) {
but->a1= ui_get_but_step_unit(but, but->a1);
}
@@ -2797,7 +2797,7 @@ static uiBut *ui_def_but_rna_propname(uiBlock *block, int type, int retval, cons
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
uiBut *but;
- if(prop) {
+ if (prop) {
but= ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
}
else {
@@ -2813,14 +2813,15 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
{
uiBut *but;
- if(!str) {
- if(ot) str = ot->name;
+ if (!str) {
+ if (ot && ot->srna)
+ str = RNA_struct_ui_name(ot->srna);
+ else
+ str = "";
}
-
- if ((!tip || tip[0]=='\0') && ot && ot->description) {
- tip= ot->description;
- tip = TIP_(tip);
+ if ((!tip || tip[0]=='\0') && ot && ot->srna) {
+ tip = RNA_struct_ui_description(ot->srna);
}
but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip);
@@ -2828,7 +2829,7 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
but->opcontext= opcontext;
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
- if(!ot) {
+ if (!ot) {
but->flag |= UI_BUT_DISABLED;
but->lock = 1;
but->lockstr = "";
@@ -2836,12 +2837,15 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
return but;
}
+
+#if 0 /* UNUSED */
static uiBut *UNUSED_FUNCTION(ui_def_but_operator)(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, const char *tip)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0);
if (str == NULL && ot == NULL) str = opname;
return ui_def_but_operator_ptr(block, type, ot, opcontext, str, x1, y1, x2, y2, tip);
}
+#endif
static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
{
@@ -2850,8 +2854,8 @@ static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opn
ot= WM_operatortype_find(opname, 0);
- if(!str) {
- if(ot) str= ot->name;
+ if (!str) {
+ if (ot) str= ot->name;
else str= opname;
}
@@ -2864,7 +2868,7 @@ static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opn
but->opcontext= opcontext;
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
- if(!ot) {
+ if (!ot) {
but->flag |= UI_BUT_DISABLED;
but->lock = 1;
but->lockstr = "";
@@ -2890,7 +2894,8 @@ static int findBitIndex(unsigned int x)
{
if (!x || !is_power_of_2_i(x)) { /* is_power_of_2_i(x) strips lowest bit */
return -1;
- } else {
+ }
+ else {
int idx= 0;
if (x&0xFFFF0000) idx+=16, x>>=16;
@@ -2928,23 +2933,23 @@ void autocomplete_do_name(AutoComplete *autocpl, const char *name)
const char *startname= autocpl->startname;
int a;
- for(a=0; a<autocpl->maxlen-1; a++) {
- if(startname[a]==0 || startname[a]!=name[a])
+ for (a=0; a<autocpl->maxlen-1; a++) {
+ if (startname[a]==0 || startname[a]!=name[a])
break;
}
/* found a match */
- if(startname[a]==0) {
+ if (startname[a]==0) {
/* first match */
- if(truncate[0]==0)
+ if (truncate[0]==0)
BLI_strncpy(truncate, name, autocpl->maxlen);
else {
/* remove from truncate what is not in bone->name */
- for(a=0; a<autocpl->maxlen-1; a++) {
- if(name[a] == 0) {
+ for (a=0; a<autocpl->maxlen-1; a++) {
+ if (name[a] == 0) {
truncate[a]= 0;
break;
}
- else if(truncate[a]!=name[a])
+ else if (truncate[a]!=name[a])
truncate[a]= 0;
}
}
@@ -2953,10 +2958,10 @@ void autocomplete_do_name(AutoComplete *autocpl, const char *name)
void autocomplete_end(AutoComplete *autocpl, char *autoname)
{
- if(autocpl->truncate[0])
+ if (autocpl->truncate[0])
BLI_strncpy(autoname, autocpl->truncate, autocpl->maxlen);
else {
- if (autoname != autocpl->startname) /* dont copy a string over its self */
+ if (autoname != autocpl->startname) /* don't copy a string over its self */
BLI_strncpy(autoname, autocpl->startname, autocpl->maxlen);
}
MEM_freeN(autocpl->truncate);
@@ -2969,14 +2974,14 @@ static void autocomplete_id(bContext *C, char *str, void *arg_v)
int blocktype= (intptr_t)arg_v;
ListBase *listb= which_libbase(CTX_data_main(C), blocktype);
- if(listb==NULL) return;
+ if (listb==NULL) return;
/* search if str matches the beginning of an ID struct */
- if(str[0]) {
+ if (str[0]) {
AutoComplete *autocpl= autocomplete_begin(str, MAX_ID_NAME-2);
ID *id;
- for(id= listb->first; id; id= id->next)
+ for (id= listb->first; id; id= id->next)
autocomplete_do_name(autocpl, id->name+2);
autocomplete_end(autocpl, str);
@@ -2985,7 +2990,7 @@ static void autocomplete_id(bContext *C, char *str, void *arg_v)
static void ui_check_but_and_iconize(uiBut *but, int icon)
{
- if(icon) {
+ if (icon) {
but->icon= (BIFIconID) icon;
but->flag|= UI_HAS_ICON;
}
@@ -2998,7 +3003,8 @@ static uiBut *uiDefButBit(uiBlock *block, int type, int bit, int retval, const c
int bitIdx= findBitIndex(bit);
if (bitIdx==-1) {
return NULL;
- } else {
+ }
+ else {
return uiDefBut(block, type|BIT|bitIdx, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
}
}
@@ -3082,7 +3088,8 @@ static uiBut *uiDefIconButBit(uiBlock *block, int type, int bit, int retval, int
int bitIdx= findBitIndex(bit);
if (bitIdx==-1) {
return NULL;
- } else {
+ }
+ else {
return uiDefIconBut(block, type|BIT|bitIdx, retval, icon, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
}
}
@@ -3160,7 +3167,8 @@ static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval,
int bitIdx= findBitIndex(bit);
if (bitIdx==-1) {
return NULL;
- } else {
+ }
+ else {
return uiDefIconTextBut(block, type|BIT|bitIdx, retval, icon, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
}
}
@@ -3268,19 +3276,19 @@ void uiBlockFlipOrder(uiBlock *block)
uiBut *but, *next;
float centy, miny=10000, maxy= -10000;
- if(U.uiflag & USER_MENUFIXEDORDER)
+ if (U.uiflag & USER_MENUFIXEDORDER)
return;
- else if(block->flag & UI_BLOCK_NO_FLIP)
+ else if (block->flag & UI_BLOCK_NO_FLIP)
return;
- for(but= block->buttons.first; but; but= but->next) {
- if(but->flag & UI_BUT_ALIGN) return;
- if(but->y1 < miny) miny= but->y1;
- if(but->y2 > maxy) maxy= but->y2;
+ for (but= block->buttons.first; but; but= but->next) {
+ if (but->flag & UI_BUT_ALIGN) return;
+ if (but->y1 < miny) miny= but->y1;
+ if (but->y2 > maxy) maxy= but->y2;
}
/* mirror trick */
centy= (miny+maxy)/2.0f;
- for(but= block->buttons.first; but; but= but->next) {
+ for (but= block->buttons.first; but; but= but->next) {
but->y1 = centy-(but->y1-centy);
but->y2 = centy-(but->y2-centy);
SWAP(float, but->y1, but->y2);
@@ -3289,7 +3297,7 @@ void uiBlockFlipOrder(uiBlock *block)
/* also flip order in block itself, for example for arrowkey */
lb.first= lb.last= NULL;
but= block->buttons.first;
- while(but) {
+ while (but) {
next= but->next;
BLI_remlink(&block->buttons, but);
BLI_addtail(&lb, but);
@@ -3370,7 +3378,7 @@ void uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *imb
PointerRNA *uiButGetOperatorPtrRNA(uiBut *but)
{
- if(but->optype && !but->opptr) {
+ if (but->optype && !but->opptr) {
but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
WM_operator_properties_create_ptr(but->opptr, but->optype);
}
@@ -3473,7 +3481,7 @@ uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int
but->idpoin_idpp= (ID**) idpp;
ui_check_but(but);
- if(blocktype)
+ if (blocktype)
uiButSetCompleteFunc(but, autocomplete_id, (void *)(intptr_t)blocktype);
return but;
@@ -3552,7 +3560,7 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg,
uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
/* XXX temp, old menu calls pass on icon arrow, which is now UI_ICON_SUBMENU flag */
- if(icon!=ICON_RIGHTARROW_THIN) {
+ if (icon!=ICON_RIGHTARROW_THIN) {
but->icon= (BIFIconID) icon;
but->flag|= UI_ICON_LEFT;
}
@@ -3626,9 +3634,9 @@ void uiButSetSearchFunc(uiBut *but, uiButSearchFunc sfunc, void *arg, uiButHandl
uiButSetFunc(but, bfunc, arg, active);
/* search buttons show red-alert if item doesn't exist, not for menus */
- if(0==(but->block->flag & UI_BLOCK_LOOP)) {
+ if (0==(but->block->flag & UI_BLOCK_LOOP)) {
/* skip empty buttons, not all buttons need input, we only show invalid */
- if(but->drawstr[0])
+ if (but->drawstr[0])
ui_but_search_test(but);
}
}
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 5e095bae922..9b48e956468 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -69,11 +69,11 @@ void ui_but_anim_flag(uiBut *but, float cfra)
fcu= ui_but_get_fcurve(but, NULL, &driven);
- if(fcu) {
- if(!driven) {
+ if (fcu) {
+ if (!driven) {
but->flag |= UI_BUT_ANIMATED;
- if(fcurve_frame_has_keyframe(fcu, cfra, 0))
+ if (fcurve_frame_has_keyframe(fcu, cfra, 0))
but->flag |= UI_BUT_ANIMATED_KEY;
}
else {
@@ -90,10 +90,10 @@ int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen)
fcu= ui_but_get_fcurve(but, NULL, &driven);
- if(fcu && driven) {
+ if (fcu && driven) {
driver= fcu->driver;
- if(driver && driver->type == DRIVER_TYPE_PYTHON) {
+ if (driver && driver->type == DRIVER_TYPE_PYTHON) {
BLI_strncpy(str, driver->expression, maxlen);
return 1;
}
@@ -110,10 +110,10 @@ int ui_but_anim_expression_set(uiBut *but, const char *str)
fcu= ui_but_get_fcurve(but, NULL, &driven);
- if(fcu && driven) {
+ if (fcu && driven) {
driver= fcu->driver;
- if(driver && driver->type == DRIVER_TYPE_PYTHON) {
+ if (driver && driver->type == DRIVER_TYPE_PYTHON) {
BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression));
driver->flag |= DRIVER_FLAG_RECOMPILE;
WM_event_add_notifier(but->block->evil_C, NC_ANIMATION|ND_KEYFRAME, NULL);
@@ -185,11 +185,11 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
fcu= ui_but_get_fcurve(but, &action, &driven);
- if(fcu && !driven) {
+ if (fcu && !driven) {
id= but->rnapoin.id.data;
// TODO: this should probably respect the keyingset only option for anim
- if(autokeyframe_cfra_can_key(scene, id)) {
+ if (autokeyframe_cfra_can_key(scene, id)) {
ReportList *reports = CTX_wm_reports(C);
short flag = ANIM_get_keyframing_flags(scene, 1);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 01700e1c52a..a2f253cecaf 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -83,16 +83,16 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
int a;
/* mult */
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
vec[a][0]*= rad; vec[a][1]*= rad;
}
glBegin(mode);
/* start with corner right-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
+ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
glVertex2f(maxx-rad, miny);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
}
glVertex2f(maxx, miny+rad);
@@ -100,9 +100,9 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
else glVertex2f(maxx, miny);
/* corner right-top */
- if(roundboxtype & UI_CNR_TOP_RIGHT) {
+ if (roundboxtype & UI_CNR_TOP_RIGHT) {
glVertex2f(maxx, maxy-rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
}
glVertex2f(maxx-rad, maxy);
@@ -110,9 +110,9 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
else glVertex2f(maxx, maxy);
/* corner left-top */
- if(roundboxtype & UI_CNR_TOP_LEFT) {
+ if (roundboxtype & UI_CNR_TOP_LEFT) {
glVertex2f(minx+rad, maxy);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
}
glVertex2f(minx, maxy-rad);
@@ -120,9 +120,9 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
else glVertex2f(minx, maxy);
/* corner left-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
+ if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
glVertex2f(minx, miny+rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
}
glVertex2f(minx+rad, miny);
@@ -154,30 +154,30 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
int a;
/* mult */
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
vec[a][0]*= rad; vec[a][1]*= rad;
}
/* get current color, needs to be outside of glBegin/End */
glGetFloatv(GL_CURRENT_COLOR, color);
/* 'shade' defines strength of shading */
- coltop[0]= color[0]+shadetop; if(coltop[0]>1.0f) coltop[0]= 1.0f;
- coltop[1]= color[1]+shadetop; if(coltop[1]>1.0f) coltop[1]= 1.0f;
- coltop[2]= color[2]+shadetop; if(coltop[2]>1.0f) coltop[2]= 1.0f;
- coldown[0]= color[0]+shadedown; if(coldown[0]<0.0f) coldown[0]= 0.0f;
- coldown[1]= color[1]+shadedown; if(coldown[1]<0.0f) coldown[1]= 0.0f;
- coldown[2]= color[2]+shadedown; if(coldown[2]<0.0f) coldown[2]= 0.0f;
+ coltop[0]= color[0]+shadetop; if (coltop[0]>1.0f) coltop[0]= 1.0f;
+ coltop[1]= color[1]+shadetop; if (coltop[1]>1.0f) coltop[1]= 1.0f;
+ coltop[2]= color[2]+shadetop; if (coltop[2]>1.0f) coltop[2]= 1.0f;
+ coldown[0]= color[0]+shadedown; if (coldown[0]<0.0f) coldown[0]= 0.0f;
+ coldown[1]= color[1]+shadedown; if (coldown[1]<0.0f) coldown[1]= 0.0f;
+ coldown[2]= color[2]+shadedown; if (coldown[2]<0.0f) coldown[2]= 0.0f;
glShadeModel(GL_SMOOTH);
glBegin(mode);
/* start with corner right-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
+ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
round_box_shade_col(coltop, coldown, 0.0);
glVertex2f(maxx-rad, miny);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(coltop, coldown, vec[a][1]*idiv);
glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
}
@@ -191,12 +191,12 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
}
/* corner right-top */
- if(roundboxtype & UI_CNR_TOP_RIGHT) {
+ if (roundboxtype & UI_CNR_TOP_RIGHT) {
round_box_shade_col(coltop, coldown, (div-rad)*idiv);
glVertex2f(maxx, maxy-rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])*idiv);
glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
}
@@ -209,12 +209,12 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
}
/* corner left-top */
- if(roundboxtype & UI_CNR_TOP_LEFT) {
+ if (roundboxtype & UI_CNR_TOP_LEFT) {
round_box_shade_col(coltop, coldown, 1.0);
glVertex2f(minx+rad, maxy);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(coltop, coldown, (div-vec[a][1])*idiv);
glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
}
@@ -228,12 +228,12 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
}
/* corner left-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
+ if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
round_box_shade_col(coltop, coldown, rad*idiv);
glVertex2f(minx, miny+rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(coltop, coldown, (rad-vec[a][1])*idiv);
glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
}
@@ -262,29 +262,29 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
int a;
/* mult */
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
vec[a][0]*= rad; vec[a][1]*= rad;
}
/* get current color, needs to be outside of glBegin/End */
glGetFloatv(GL_CURRENT_COLOR, color);
/* 'shade' defines strength of shading */
- colLeft[0]= color[0]+shadeLeft; if(colLeft[0]>1.0f) colLeft[0]= 1.0f;
- colLeft[1]= color[1]+shadeLeft; if(colLeft[1]>1.0f) colLeft[1]= 1.0f;
- colLeft[2]= color[2]+shadeLeft; if(colLeft[2]>1.0f) colLeft[2]= 1.0f;
- colRight[0]= color[0]+shadeRight; if(colRight[0]<0.0f) colRight[0]= 0.0f;
- colRight[1]= color[1]+shadeRight; if(colRight[1]<0.0f) colRight[1]= 0.0f;
- colRight[2]= color[2]+shadeRight; if(colRight[2]<0.0f) colRight[2]= 0.0f;
+ colLeft[0]= color[0]+shadeLeft; if (colLeft[0]>1.0f) colLeft[0]= 1.0f;
+ colLeft[1]= color[1]+shadeLeft; if (colLeft[1]>1.0f) colLeft[1]= 1.0f;
+ colLeft[2]= color[2]+shadeLeft; if (colLeft[2]>1.0f) colLeft[2]= 1.0f;
+ colRight[0]= color[0]+shadeRight; if (colRight[0]<0.0f) colRight[0]= 0.0f;
+ colRight[1]= color[1]+shadeRight; if (colRight[1]<0.0f) colRight[1]= 0.0f;
+ colRight[2]= color[2]+shadeRight; if (colRight[2]<0.0f) colRight[2]= 0.0f;
glShadeModel(GL_SMOOTH);
glBegin(mode);
/* start with corner right-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
+ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
round_box_shade_col(colLeft, colRight, 0.0);
glVertex2f(maxx-rad, miny);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(colLeft, colRight, vec[a][0]*idiv);
glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
}
@@ -298,11 +298,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
}
/* corner right-top */
- if(roundboxtype & UI_CNR_TOP_RIGHT) {
+ if (roundboxtype & UI_CNR_TOP_RIGHT) {
round_box_shade_col(colLeft, colRight, 0.0);
glVertex2f(maxx, maxy-rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(colLeft, colRight, (div-rad-vec[a][0])*idiv);
glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
@@ -316,11 +316,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
}
/* corner left-top */
- if(roundboxtype & UI_CNR_TOP_LEFT) {
+ if (roundboxtype & UI_CNR_TOP_LEFT) {
round_box_shade_col(colLeft, colRight, (div-rad)*idiv);
glVertex2f(minx+rad, maxy);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(colLeft, colRight, (div-rad+vec[a][0])*idiv);
glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
}
@@ -334,11 +334,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
}
/* corner left-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
+ if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
round_box_shade_col(colLeft, colRight, 1.0);
glVertex2f(minx, miny+rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(colLeft, colRight, (vec[a][0])*idiv);
glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
}
@@ -360,7 +360,7 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad)
{
float color[4];
- if(roundboxtype & UI_RB_ALPHA) {
+ if (roundboxtype & UI_RB_ALPHA) {
glGetFloatv(GL_CURRENT_COLOR, color);
color[3]= 0.5;
glColor4fv(color);
@@ -382,7 +382,7 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
{
float color[4];
- if(roundboxtype & UI_RB_ALPHA) {
+ if (roundboxtype & UI_RB_ALPHA) {
glGetFloatv(GL_CURRENT_COLOR, color);
color[3]= 0.5;
glColor4fv(color);
@@ -401,7 +401,7 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel)
{
/* below */
- if(sel) glColor3ub(200,200,200);
+ if (sel) glColor3ub(200,200,200);
else glColor3ub(50,50,50);
fdrawline(x1, y1, x2, y1);
@@ -409,7 +409,7 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel)
fdrawline(x2, y1, x2, y2);
/* top */
- if(sel) glColor3ub(50,50,50);
+ if (sel) glColor3ub(50,50,50);
else glColor3ub(200,200,200);
fdrawline(x1, y2, x2, y2);
@@ -477,8 +477,8 @@ static void ui_draw_but_CHARTAB(uiBut *but)
int charmax = G.charmax;
/* FO_BUILTIN_NAME font in use. There are TTF FO_BUILTIN_NAME and non-TTF FO_BUILTIN_NAME fonts */
- if(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
- if(G.ui_international == TRUE) {
+ if (!strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
+ if (G.ui_international == TRUE) {
charmax = 0xff;
}
else {
@@ -487,7 +487,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
}
/* Category list exited without selecting the area */
- if(G.charmax == 0)
+ if (G.charmax == 0)
charmax = G.charmax = 0xffff;
/* Calculate the size of the button */
@@ -506,9 +506,9 @@ static void ui_draw_but_CHARTAB(uiBut *but)
cs = G.charstart;
/* Set the font, in case it is not FO_BUILTIN_NAME font */
- if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
+ if (G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
// Is the font file packed, if so then use the packed file
- if(G.selfont->packedfile) {
+ if (G.selfont->packedfile) {
pf = G.selfont->packedfile;
FTF_SetFont(pf->data, pf->size, 14.0);
}
@@ -522,7 +522,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
}
}
else {
- if(G.ui_international == TRUE) {
+ if (G.ui_international == TRUE) {
FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0);
}
}
@@ -534,14 +534,14 @@ static void ui_draw_but_CHARTAB(uiBut *but)
glRectf((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax));
glColor3ub(0, 0, 0);
- for(y = 0; y < 6; y++) {
+ for (y = 0; y < 6; y++) {
// Do not draw more than the category allows
- if(cs > charmax) break;
+ if (cs > charmax) break;
- for(x = 0; x < 12; x++)
+ for (x = 0; x < 12; x++)
{
// Do not draw more than the category allows
- if(cs > charmax) break;
+ if (cs > charmax) break;
// Draw one grid cell
glBegin(GL_LINE_LOOP);
@@ -610,7 +610,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
glShadeModel(GL_FLAT);
/* Return Font Settings to original */
- if(U.fontsize && U.fontname[0]) {
+ if (U.fontsize && U.fontname[0]) {
result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize);
}
else if (U.fontsize) {
@@ -622,7 +622,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
}
/* resets the font size */
- if(G.ui_international == TRUE) {
+ if (G.ui_international == TRUE) {
// uiSetCurFont(but->block, UI_HELV);
}
}
@@ -769,8 +769,8 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
/* log scale for alpha */
alpha = scopes->wavefrm_alpha*scopes->wavefrm_alpha;
- for(c=0; c<3; c++) {
- for(i=0; i<3; i++) {
+ for (c=0; c<3; c++) {
+ for (i=0; i<3; i++) {
colors_alpha[c][i] = colors[c][i] * alpha;
colorsycc_alpha[c][i] = colorsycc[c][i] * alpha;
}
@@ -811,7 +811,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
fdrawline(rect.xmin+w, rect.ymin, rect.xmin+w, rect.ymax);
/* 16-235-240 level in case of ITU-R BT601/709 */
glColor4f(1.f, 0.4f, 0.f, 0.2f);
- if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)){
+ if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)) {
fdrawline(rect.xmin+22, yofs+h*16.0f/255.0f, rect.xmax+1, yofs+h*16.0f/255.0f);
fdrawline(rect.xmin+22, yofs+h*235.0f/255.0f, rect.xmin+w3, yofs+h*235.0f/255.0f);
fdrawline(rect.xmin+3*w3, yofs+h*235.0f/255.0f, rect.xmax+1, yofs+h*235.0f/255.0f);
@@ -826,7 +826,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
/* LUMA (1 channel) */
glBlendFunc(GL_ONE,GL_ONE);
glColor3f(alpha, alpha, alpha);
- if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA){
+ if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) {
glBlendFunc(GL_ONE,GL_ONE);
@@ -1004,9 +1004,9 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
fdrawline(centerx - (diam/2)-5, centery, centerx + (diam/2)+5, centery);
fdrawline(centerx, centery - (diam/2)-5, centerx, centery + (diam/2)+5);
/* circles */
- for(j=0; j<5; j++) {
+ for (j=0; j<5; j++) {
glBegin(GL_LINE_STRIP);
- for(i=0; i<=360; i=i+15) {
+ for (i=0; i<=360; i=i+15) {
const float a= DEG2RADF((float)i);
const float r= (j+1)/10.0f;
glVertex2f(polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a));
@@ -1018,7 +1018,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
fdrawline(polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery,diam,0.5,skin_rad),
polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery,diam,0.1,skin_rad));
/* saturation points */
- for(i=0; i<6; i++)
+ for (i=0; i<6; i++)
vectorscope_draw_target(centerx, centery, diam, colors[i]);
if (scopes->ok && scopes->vecscope != NULL) {
@@ -1052,10 +1052,10 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
float x1, y1, sizex, sizey;
float v3[2], v1[2], v2[2], v1a[2], v2a[2];
int a;
- float pos, colf[4]= {0,0,0,0}; /* initialize in case the colorband isnt valid */
+ float pos, colf[4]= {0,0,0,0}; /* initialize in case the colorband isn't valid */
coba= (ColorBand *)(but->editcoba? but->editcoba: but->poin);
- if(coba==NULL) return;
+ if (coba==NULL) return;
x1= rect->xmin;
y1= rect->ymin;
@@ -1086,9 +1086,9 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
glColor4fv( &cbd->r );
glVertex2fv(v1); glVertex2fv(v2);
- for( a = 1; a <= sizex; a++ ) {
+ for ( a = 1; a <= sizex; a++ ) {
pos = ((float)a) / (sizex-1);
- do_colorband( coba, pos, colf );
+ do_colorband(coba, pos, colf);
if (but->block->color_profile != BLI_PR_NONE)
linearrgb_to_srgb_v3_v3(colf, colf);
@@ -1117,10 +1117,10 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
cbd= coba->data;
glBegin(GL_LINES);
- for(a=0; a<coba->tot; a++, cbd++) {
+ for (a=0; a<coba->tot; a++, cbd++) {
v1[0]=v2[0]=v3[0]=v1a[0]=v2a[0]= x1+ cbd->pos*sizex;
- if(a==coba->cur) {
+ if (a==coba->cur) {
glColor3ub(0, 0, 0);
glVertex2fv(v1);
glVertex2fv(v3);
@@ -1185,7 +1185,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glCullFace(GL_BACK); glEnable(GL_CULL_FACE);
/* disable blender light */
- for(a=0; a<8; a++) {
+ for (a=0; a<8; a++) {
old[a]= glIsEnabled(GL_LIGHT0+a);
glDisable(GL_LIGHT0+a);
}
@@ -1207,14 +1207,14 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glPushMatrix();
glTranslatef(rect->xmin + 0.5f*(rect->xmax-rect->xmin), rect->ymin+ 0.5f*(rect->ymax-rect->ymin), 0.0f);
- if( rect->xmax-rect->xmin < rect->ymax-rect->ymin)
+ if ( rect->xmax-rect->xmin < rect->ymax-rect->ymin)
size= (rect->xmax-rect->xmin)/200.f;
else
size= (rect->ymax-rect->ymin)/200.f;
glScalef(size, size, size);
- if(displist==0) {
+ if (displist==0) {
GLUquadricObj *qobj;
displist= glGenLists(1);
@@ -1249,8 +1249,8 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glPopMatrix();
/* enable blender light */
- for(a=0; a<8; a++) {
- if(old[a])
+ for (a=0; a<8; a++) {
+ if (old[a])
glEnable(GL_LIGHT0+a);
}
}
@@ -1262,8 +1262,8 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
glBegin(GL_LINES);
dx= step*zoomx;
fx= rect->xmin + zoomx*(-offsx);
- if(fx > rect->xmin) fx -= dx*(floorf(fx-rect->xmin));
- while(fx < rect->xmax) {
+ if (fx > rect->xmin) fx -= dx*(floorf(fx-rect->xmin));
+ while (fx < rect->xmax) {
glVertex2f(fx, rect->ymin);
glVertex2f(fx, rect->ymax);
fx+= dx;
@@ -1271,8 +1271,8 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
dy= step*zoomy;
fy= rect->ymin + zoomy*(-offsy);
- if(fy > rect->ymin) fy -= dy*(floorf(fy-rect->ymin));
- while(fy < rect->ymax) {
+ if (fy > rect->ymin) fy -= dy*(floorf(fy-rect->ymin));
+ while (fy < rect->ymax) {
glVertex2f(rect->xmin, fy);
glVertex2f(rect->xmax, fy);
fy+= dy;
@@ -1303,10 +1303,10 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
/* need scissor test, curve can draw outside of boundary */
glGetIntegerv(GL_VIEWPORT, scissor);
- scissor_new.xmin= ar->winrct.xmin + rect->xmin;
- scissor_new.ymin= ar->winrct.ymin + rect->ymin;
- scissor_new.xmax= ar->winrct.xmin + rect->xmax;
- scissor_new.ymax= ar->winrct.ymin + rect->ymax;
+ scissor_new.xmin = ar->winrct.xmin + rect->xmin;
+ scissor_new.ymin = ar->winrct.ymin + rect->ymin;
+ scissor_new.xmax = ar->winrct.xmin + rect->xmax;
+ scissor_new.ymax = ar->winrct.ymin + rect->ymax;
BLI_isect_rcti(&scissor_new, &ar->winrct, &scissor_new);
glScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax-scissor_new.xmin, scissor_new.ymax-scissor_new.ymin);
@@ -1317,7 +1317,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
offsy= cumap->curr.ymin-but->aspect/zoomy;
/* backdrop */
- if(cumap->flag & CUMA_DO_CLIP) {
+ if (cumap->flag & CUMA_DO_CLIP) {
glColor3ubvShade((unsigned char *)wcol->inner, -20);
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
glColor3ubv((unsigned char*)wcol->inner);
@@ -1367,7 +1367,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
/* cfra option */
/* XXX 2.48 */
#if 0
- if(cumap->flag & CUMA_DRAW_CFRA) {
+ if (cumap->flag & CUMA_DRAW_CFRA) {
glColor3ub(0x60, 0xc0, 0x40);
glBegin(GL_LINES);
glVertex2f(rect->xmin + zoomx*(cumap->sample[0]-offsx), rect->ymin);
@@ -1379,8 +1379,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
/* XXX 2.48 */
#if 0
- if(cumap->flag & CUMA_DRAW_SAMPLE) {
- if(cumap->cur==3) {
+ if (cumap->flag & CUMA_DRAW_SAMPLE) {
+ if (cumap->cur==3) {
float lum= cumap->sample[0]*0.35f + cumap->sample[1]*0.45f + cumap->sample[2]*0.2f;
glColor3ub(240, 240, 240);
@@ -1390,9 +1390,9 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
glEnd();
}
else {
- if(cumap->cur==0)
+ if (cumap->cur==0)
glColor3ub(240, 100, 100);
- else if(cumap->cur==1)
+ else if (cumap->cur==1)
glColor3ub(100, 240, 100);
else
glColor3ub(100, 100, 240);
@@ -1411,25 +1411,25 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
glEnable(GL_BLEND);
glBegin(GL_LINE_STRIP);
- if(cuma->table==NULL)
+ if (cuma->table==NULL)
curvemapping_changed(cumap, 0); /* 0 = no remove doubles */
cmp= cuma->table;
/* first point */
- if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
+ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
glVertex2f(rect->xmin, rect->ymin + zoomy*(cmp[0].y-offsy));
else {
fx= rect->xmin + zoomx*(cmp[0].x-offsx + cuma->ext_in[0]);
fy= rect->ymin + zoomy*(cmp[0].y-offsy + cuma->ext_in[1]);
glVertex2f(fx, fy);
}
- for(a=0; a<=CM_TABLE; a++) {
+ for (a=0; a<=CM_TABLE; a++) {
fx= rect->xmin + zoomx*(cmp[a].x-offsx);
fy= rect->ymin + zoomy*(cmp[a].y-offsy);
glVertex2f(fx, fy);
}
/* last point */
- if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
+ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
glVertex2f(rect->xmax, rect->ymin + zoomy*(cmp[CM_TABLE].y-offsy));
else {
fx= rect->xmin + zoomx*(cmp[CM_TABLE].x-offsx - cuma->ext_out[0]);
@@ -1444,8 +1444,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
cmp= cuma->curve;
glPointSize(3.0f);
bglBegin(GL_POINTS);
- for(a=0; a<cuma->totpoint; a++) {
- if(cmp[a].flag & SELECT)
+ for (a=0; a<cuma->totpoint; a++) {
+ if (cmp[a].flag & SELECT)
UI_ThemeColor(TH_TEXT_HI);
else
UI_ThemeColor(TH_TEXT);
@@ -1475,7 +1475,7 @@ static ImBuf *scale_trackpreview_ibuf(ImBuf *ibuf, float track_pos[2], int width
scaleibuf= IMB_allocImBuf(width, height, 32, IB_rect);
- for(y= 0; y<height; y++) {
+ for (y= 0; y<height; y++) {
for (x= 0; x<width; x++) {
float src_x= scalex*(x)+margin-off_x;
float src_y= scaley*(y)+margin-off_y;
@@ -1506,14 +1506,14 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
glGetIntegerv(GL_VIEWPORT, scissor);
glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
- if(scopes->track_disabled) {
+ if (scopes->track_disabled) {
glColor4f(0.7f, 0.3f, 0.3f, 0.3f);
uiSetRoundBox(15);
uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin, rect.xmax+1, rect.ymax+1, 3.0f);
ok= 1;
}
- else if(scopes->track_preview) {
+ else if (scopes->track_preview) {
/* additional margin around image */
/* NOTE: should be kept in sync with value from BKE_movieclip_update_scopes */
const int margin= 3;
@@ -1532,7 +1532,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
width= rect.xmax-rect.xmin+1;
height = rect.ymax-rect.ymin;
- if(width > 0 && height > 0) {
+ if (width > 0 && height > 0) {
zoomx= (float)width / (scopes->track_preview->x-2*margin);
zoomy= (float)height / (scopes->track_preview->y-2*margin);
@@ -1549,8 +1549,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
glTranslatef(off_x+rect.xmin+track_pos[0]*zoomx, off_y+rect.ymin+track_pos[1]*zoomy, 0.f);
glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin+rect.ymin, rect.xmax-rect.xmin, rect.ymax-rect.ymin);
- for(a= 0; a< 2; a++) {
- if(a==1) {
+ for (a= 0; a< 2; a++) {
+ if (a==1) {
glLineStipple(3, 0xaaaa);
glEnable(GL_LINE_STIPPLE);
UI_ThemeColor(TH_SEL_MARKER);
@@ -1574,7 +1574,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
ok= 1;
}
- if(!ok) {
+ if (!ok) {
glColor4f(0.f, 0.f, 0.f, 0.3f);
uiSetRoundBox(15);
uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin, rect.xmax+1, rect.ymax+1, 3.0f);
@@ -1647,14 +1647,14 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select))
glEnable(GL_BLEND);
- if(radius > (rct->ymax-rct->ymin-10.0f)/2.0f)
+ if (radius > (rct->ymax-rct->ymin-10.0f)/2.0f)
rad= (rct->ymax-rct->ymin-10.0f)/2.0f;
else
rad= radius;
i= 12;
#if 0
- if(select) {
+ if (select) {
a= i*aspect; /* same as below */
}
else
@@ -1663,7 +1663,7 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select))
a= i*aspect;
}
- for(; i--; a-=aspect) {
+ for (; i--; a-=aspect) {
/* alpha ranges from 2 to 20 or so */
glColor4ub(0, 0, 0, alpha);
alpha+= 2;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index cae6f61d269..21c3f4ca038 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -212,18 +212,18 @@ static int ui_but_editable(uiBut *but)
static uiBut *ui_but_prev(uiBut *but)
{
- while(but->prev) {
+ while (but->prev) {
but= but->prev;
- if(!ui_but_editable(but)) return but;
+ if (!ui_but_editable(but)) return but;
}
return NULL;
}
static uiBut *ui_but_next(uiBut *but)
{
- while(but->next) {
+ while (but->next) {
but= but->next;
- if(!ui_but_editable(but)) return but;
+ if (!ui_but_editable(but)) return but;
}
return NULL;
}
@@ -233,8 +233,8 @@ static uiBut *ui_but_first(uiBlock *block)
uiBut *but;
but= block->buttons.first;
- while(but) {
- if(!ui_but_editable(but)) return but;
+ while (but) {
+ if (!ui_but_editable(but)) return but;
but= but->next;
}
return NULL;
@@ -245,8 +245,8 @@ static uiBut *ui_but_last(uiBlock *block)
uiBut *but;
but= block->buttons.last;
- while(but) {
- if(!ui_but_editable(but)) return but;
+ while (but) {
+ if (!ui_but_editable(but)) return but;
but= but->prev;
}
return NULL;
@@ -254,8 +254,8 @@ static uiBut *ui_but_last(uiBlock *block)
static int ui_is_a_warp_but(uiBut *but)
{
- if(U.uiflag & USER_CONTINUOUS_MOUSE)
- if(ELEM4(but->type, NUM, NUMABS, HSVCIRCLE, TRACKPREVIEW))
+ if (U.uiflag & USER_CONTINUOUS_MOUSE)
+ if (ELEM4(but->type, NUM, NUMABS, HSVCIRCLE, TRACKPREVIEW))
return TRUE;
return FALSE;
@@ -286,10 +286,10 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
* handling is done, i.e. menus are closed, in order to avoid conflicts
* with these functions removing the buttons we are working with */
- if(but->func || but->funcN || block->handle_func || but->rename_func || (but->type == BUTM && block->butm_func) || but->optype || but->rnaprop) {
+ if (but->func || but->funcN || block->handle_func || but->rename_func || (but->type == BUTM && block->butm_func) || but->optype || but->rnaprop) {
after= MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc");
- if(but->func && ELEM(but, but->func_arg1, but->func_arg2)) {
+ if (but->func && ELEM(but, but->func_arg1, but->func_arg2)) {
/* exception, this will crash due to removed button otherwise */
but->func(C, but->func_arg1, but->func_arg2);
}
@@ -311,7 +311,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
after->handle_func_arg= block->handle_func_arg;
after->retval= but->retval;
- if(but->type == BUTM) {
+ if (but->type == BUTM) {
after->butm_func= block->butm_func;
after->butm_func_arg= block->butm_func_arg;
after->a2= but->a2;
@@ -324,7 +324,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
after->rnapoin= but->rnapoin;
after->rnaprop= but->rnaprop;
- if(but->context)
+ if (but->context)
after->context= CTX_store_copy(but->context);
but->optype= NULL;
@@ -340,17 +340,17 @@ static void ui_apply_autokey_undo(bContext *C, uiBut *but)
Scene *scene= CTX_data_scene(C);
uiAfterFunc *after;
- if(but->flag & UI_BUT_UNDO) {
+ if (but->flag & UI_BUT_UNDO) {
const char *str= NULL;
/* define which string to use for undo */
if ELEM(but->type, LINK, INLINK) str= "Add button link";
else if ELEM(but->type, MENU, ICONTEXTROW) str= but->drawstr;
- else if(but->drawstr[0]) str= but->drawstr;
+ else if (but->drawstr[0]) str= but->drawstr;
else str= but->tip;
- /* fallback, else we dont get an undo! */
- if(str == NULL || str[0] == '\0') {
+ /* fallback, else we don't get an undo! */
+ if (str == NULL || str[0] == '\0') {
str= "Unknown Action";
}
@@ -374,51 +374,51 @@ static void ui_apply_but_funcs_after(bContext *C)
funcs= UIAfterFuncs;
UIAfterFuncs.first= UIAfterFuncs.last= NULL;
- for(afterf=funcs.first; afterf; afterf=after.next) {
+ for (afterf=funcs.first; afterf; afterf=after.next) {
after= *afterf; /* copy to avoid memleak on exit() */
BLI_freelinkN(&funcs, afterf);
- if(after.context)
+ if (after.context)
CTX_store_set(C, after.context);
- if(after.opptr) {
+ if (after.opptr) {
/* free in advance to avoid leak on exit */
opptr= *after.opptr,
MEM_freeN(after.opptr);
}
- if(after.optype)
+ if (after.optype)
WM_operator_name_call(C, after.optype->idname, after.opcontext, (after.opptr)? &opptr: NULL);
- if(after.opptr)
+ if (after.opptr)
WM_operator_properties_free(&opptr);
- if(after.rnapoin.data)
+ if (after.rnapoin.data)
RNA_property_update(C, &after.rnapoin, after.rnaprop);
- if(after.context) {
+ if (after.context) {
CTX_store_set(C, NULL);
CTX_store_free(after.context);
}
- if(after.func)
+ if (after.func)
after.func(C, after.func_arg1, after.func_arg2);
- if(after.funcN)
+ if (after.funcN)
after.funcN(C, after.func_argN, after.func_arg2);
- if(after.func_argN)
+ if (after.func_argN)
MEM_freeN(after.func_argN);
- if(after.handle_func)
+ if (after.handle_func)
after.handle_func(C, after.handle_func_arg, after.retval);
- if(after.butm_func)
+ if (after.butm_func)
after.butm_func(C, after.butm_func_arg, after.a2);
- if(after.rename_func)
+ if (after.rename_func)
after.rename_func(C, after.rename_arg1, after.rename_orig);
- if(after.rename_orig)
+ if (after.rename_orig)
MEM_freeN(after.rename_orig);
- if(after.undostr[0])
+ if (after.undostr[0])
ED_undo_push(C, after.undostr);
}
}
@@ -442,7 +442,7 @@ static void ui_apply_but_BUTM(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
+ if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
ui_set_but_val(but, data->value);
ui_check_but(but);
@@ -457,50 +457,50 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
int w, lvalue, push;
/* local hack... */
- if(but->type==BUT_TOGDUAL && data->togdual) {
- if(but->pointype==SHO)
+ if (but->type==BUT_TOGDUAL && data->togdual) {
+ if (but->pointype==SHO)
but->poin += 2;
- else if(but->pointype==INT)
+ else if (but->pointype==INT)
but->poin += 4;
}
value= ui_get_but_val(but);
lvalue= (int)value;
- if(but->bit) {
+ if (but->bit) {
w= BTST(lvalue, but->bitnr);
- if(w) lvalue = BCLR(lvalue, but->bitnr);
+ if (w) lvalue = BCLR(lvalue, but->bitnr);
else lvalue = BSET(lvalue, but->bitnr);
- if(but->type==TOGR) {
- if(!data->togonly) {
+ if (but->type==TOGR) {
+ if (!data->togonly) {
lvalue= 1<<(but->bitnr);
ui_set_but_val(but, (double)lvalue);
}
else {
- if(lvalue==0) lvalue= 1<<(but->bitnr);
+ if (lvalue==0) lvalue= 1<<(but->bitnr);
}
}
ui_set_but_val(but, (double)lvalue);
- if(but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
+ if (but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
}
else {
- if(value==0.0) push= 1;
+ if (value==0.0) push= 1;
else push= 0;
- if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) push= !push;
+ if (ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) push= !push;
ui_set_but_val(but, (double)push);
- if(but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
+ if (but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
}
/* end local hack... */
- if(but->type==BUT_TOGDUAL && data->togdual) {
- if(but->pointype==SHO)
+ if (but->type==BUT_TOGDUAL && data->togdual) {
+ if (but->pointype==SHO)
but->poin -= 2;
- else if(but->pointype==INT)
+ else if (but->pointype==INT)
but->poin -= 4;
}
@@ -517,8 +517,8 @@ static void ui_apply_but_ROW(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
ui_set_but_val(but, but->hardmax);
/* states of other row buttons */
- for(bt= block->buttons.first; bt; bt= bt->next)
- if(bt!=but && bt->poin==but->poin && ELEM(bt->type, ROW, LISTROW))
+ for (bt= block->buttons.first; bt; bt= bt->next)
+ if (bt!=but && bt->poin==but->poin && ELEM(bt->type, ROW, LISTROW))
ui_check_but(bt);
ui_apply_but_func(C, but);
@@ -529,7 +529,7 @@ static void ui_apply_but_ROW(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
static void ui_apply_but_TEX(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(!data->str)
+ if (!data->str)
return;
ui_set_but_string(C, but, data->str);
@@ -548,8 +548,8 @@ static void ui_apply_but_TEX(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(data->str) {
- if(ui_set_but_string(C, but, data->str)) {
+ if (data->str) {
+ if (ui_set_but_string(C, but, data->str)) {
data->value= ui_get_but_val(but);
}
else {
@@ -569,27 +569,29 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_apply_but_TOG3(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(but->pointype==SHO ) {
+ if (but->pointype==SHO ) {
short *sp= (short *)but->poin;
- if( BTST(sp[1], but->bitnr)) {
+ if ( BTST(sp[1], but->bitnr)) {
sp[1]= BCLR(sp[1], but->bitnr);
sp[0]= BCLR(sp[0], but->bitnr);
}
- else if( BTST(sp[0], but->bitnr)) {
+ else if ( BTST(sp[0], but->bitnr)) {
sp[1]= BSET(sp[1], but->bitnr);
- } else {
+ }
+ else {
sp[0]= BSET(sp[0], but->bitnr);
}
}
else {
- if( BTST(*(but->poin+2), but->bitnr)) {
+ if ( BTST(*(but->poin+2), but->bitnr)) {
*(but->poin+2)= BCLR(*(but->poin+2), but->bitnr);
*(but->poin)= BCLR(*(but->poin), but->bitnr);
}
- else if( BTST(*(but->poin), but->bitnr)) {
+ else if ( BTST(*(but->poin), but->bitnr)) {
*(but->poin+2)= BSET(*(but->poin+2), but->bitnr);
- } else {
+ }
+ else {
*(but->poin)= BSET(*(but->poin), but->bitnr);
}
}
@@ -651,12 +653,12 @@ static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event)
ui_window_to_block(ar, but->block, &x, &y);
- rect.xmin= but->x1; rect.xmax= but->x2;
- rect.ymin= but->y1; rect.ymax= but->y2;
+ rect.xmin = but->x1; rect.xmax = but->x2;
+ rect.ymin = but->y1; rect.ymax = but->y2;
- if(but->imb); /* use button size itself */
- else if(but->flag & UI_ICON_LEFT) {
- rect.xmax= rect.xmin + (rect.ymax-rect.ymin);
+ if (but->imb); /* use button size itself */
+ else if (but->flag & UI_ICON_LEFT) {
+ rect.xmax = rect.xmin + (rect.ymax-rect.ymin);
}
else {
int delta= (rect.xmax-rect.xmin) - (rect.ymax-rect.ymin);
@@ -672,14 +674,14 @@ static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data,
/* prevent other WM gestures to start while we try to drag */
WM_gestures_remove(C);
- if( ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > U.dragthreshold ) {
+ if ( ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > U.dragthreshold ) {
wmDrag *drag;
button_activate_state(C, but, BUTTON_STATE_EXIT);
data->cancel= 1;
drag= WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but));
- if(but->imb)
+ if (but->imb)
WM_event_drag_image(drag, but->imb, but->imb_scale, but->x2-but->x1, but->y2-but->y1);
return 1;
}
@@ -697,31 +699,31 @@ static void ui_delete_active_linkline(uiBlock *block)
int a, b;
but= block->buttons.first;
- while(but) {
- if(but->type==LINK && but->link) {
+ while (but) {
+ if (but->type==LINK && but->link) {
line= but->link->lines.first;
- while(line) {
+ while (line) {
nline= line->next;
- if(line->flag & UI_SELECT) {
+ if (line->flag & UI_SELECT) {
BLI_remlink(&but->link->lines, line);
link= line->from->link;
/* are there more pointers allowed? */
- if(link->ppoin) {
+ if (link->ppoin) {
- if(*(link->totlink)==1) {
+ if (*(link->totlink)==1) {
*(link->totlink)= 0;
MEM_freeN(*(link->ppoin));
*(link->ppoin)= NULL;
}
else {
b= 0;
- for(a=0; a< (*(link->totlink)); a++) {
+ for (a=0; a< (*(link->totlink)); a++) {
- if( (*(link->ppoin))[a] != line->to->poin ) {
+ if ( (*(link->ppoin))[a] != line->to->poin ) {
(*(link->ppoin))[b]= (*(link->ppoin))[a];
b++;
}
@@ -749,10 +751,10 @@ static uiLinkLine *ui_is_a_link(uiBut *from, uiBut *to)
uiLink *link;
link= from->link;
- if(link) {
+ if (link) {
line= link->lines.first;
- while(line) {
- if(line->from==from && line->to==to) return line;
+ while (line) {
+ if (line->from==from && line->to==to) return line;
line= line->next;
}
}
@@ -772,7 +774,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
uiLink *link= from->link;
- if(link->ppoin)
+ if (link->ppoin)
sens_from_links= (bController ***)(link->ppoin);
else return;
@@ -790,7 +792,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
if (ob) break;
} CTX_DATA_END;
- if(!ob) return;
+ if (!ob) return;
/* (2) check if the sensor and the actuator are from the same object */
for (act_iter= ob->actuators.first; act_iter; act_iter= (bActuator *)act_iter->next) {
@@ -799,7 +801,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
}
// only works if the sensor and the actuator are from the same object
- if(!act_iter) return;
+ if (!act_iter) return;
/* (3) add a new controller */
if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED) {
@@ -831,7 +833,7 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to)
void **oldppoin;
int a;
- if( (line= ui_is_a_link(from, to)) ) {
+ if ( (line= ui_is_a_link(from, to)) ) {
line->flag |= UI_SELECT;
ui_delete_active_linkline(from->block);
return;
@@ -841,13 +843,13 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to)
return;
}
else if (from->type==LINK && to->type==INLINK) {
- if( from->link->tocode != (int)to->hardmin ) {
+ if ( from->link->tocode != (int)to->hardmin ) {
ui_add_smart_controller(C, from, to);
return;
}
}
- else if(from->type==INLINK && to->type==LINK) {
- if( to->link->tocode == (int)from->hardmin ) {
+ else if (from->type==INLINK && to->type==LINK) {
+ if ( to->link->tocode == (int)from->hardmin ) {
return;
}
}
@@ -855,18 +857,18 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to)
link= from->link;
/* are there more pointers allowed? */
- if(link->ppoin) {
+ if (link->ppoin) {
oldppoin= *(link->ppoin);
(*(link->totlink))++;
*(link->ppoin)= MEM_callocN( *(link->totlink)*sizeof(void *), "new link");
- for(a=0; a< (*(link->totlink))-1; a++) {
+ for (a=0; a< (*(link->totlink))-1; a++) {
(*(link->ppoin))[a]= oldppoin[a];
}
(*(link->ppoin))[a]= to->poin;
- if(oldppoin) MEM_freeN(oldppoin);
+ if (oldppoin) MEM_freeN(oldppoin);
}
else {
*(link->poin)= to->poin;
@@ -880,15 +882,15 @@ static void ui_apply_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data)
ARegion *ar= CTX_wm_region(C);
uiBut *bt;
- for(bt= but->block->buttons.first; bt; bt= bt->next) {
- if( ui_mouse_inside_button(ar, bt, but->linkto[0]+ar->winrct.xmin, but->linkto[1]+ar->winrct.ymin) )
+ for (bt= but->block->buttons.first; bt; bt= bt->next) {
+ if ( ui_mouse_inside_button(ar, bt, but->linkto[0]+ar->winrct.xmin, but->linkto[1]+ar->winrct.ymin) )
break;
}
- if(bt && bt!=but) {
+ if (bt && bt!=but) {
if (!ELEM(bt->type, LINK, INLINK) || !ELEM(but->type, LINK, INLINK))
return;
- if(but->type==LINK) ui_add_link(C, but, bt);
+ if (but->type==LINK) ui_add_link(C, but, bt);
else ui_add_link(C, bt, but);
ui_apply_but_func(C, but);
@@ -938,11 +940,11 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
/* if we cancel and have not applied yet, there is nothing to do,
* otherwise we have to restore the original value again */
- if(data->cancel) {
- if(!data->applied)
+ if (data->cancel) {
+ if (!data->applied)
return;
- if(data->str) MEM_freeN(data->str);
+ if (data->str) MEM_freeN(data->str);
data->str= data->origstr;
data->origstr= NULL;
data->value= data->origvalue;
@@ -953,9 +955,9 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
else {
/* we avoid applying interactive edits a second time
* at the end with the appliedinteractive flag */
- if(interactive)
+ if (interactive)
data->appliedinteractive= 1;
- else if(data->appliedinteractive)
+ else if (data->appliedinteractive)
return;
}
@@ -1076,13 +1078,13 @@ static void ui_but_drop(bContext *C, wmEvent *event, uiBut *but, uiHandleButtonD
wmDrag *wmd;
ListBase *drags= event->customdata; /* drop event type has listbase customdata by default */
- for(wmd= drags->first; wmd; wmd= wmd->next) {
- if(wmd->type==WM_DRAG_ID) {
+ for (wmd= drags->first; wmd; wmd= wmd->next) {
+ if (wmd->type==WM_DRAG_ID) {
/* align these types with UI_but_active_drop_name */
- if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+ if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
ID *id= (ID *)wmd->poin;
- if(but->poin==NULL && but->rnapoin.data==NULL) {}
+ if (but->poin==NULL && but->rnapoin.data==NULL) {}
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
BLI_strncpy(data->str, id->name+2, data->maxlen);
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -1100,14 +1102,14 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
static ColorBand but_copypaste_coba = {0};
char buf[UI_MAX_DRAW_STR+1]= {0};
- if(mode=='v' && but->lock)
+ if (mode=='v' && but->lock)
return;
- if(mode=='v') {
+ if (mode=='v') {
/* extract first line from clipboard in case of multi-line copies */
char *p, *pbuf= WM_clipboard_text_get(0);
p= pbuf;
- if(p) {
+ if (p) {
int i = 0;
while (*p && *p!='\r' && *p!='\n' && i<UI_MAX_DRAW_STR) {
buf[i++]=*p;
@@ -1121,8 +1123,8 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
/* numeric value */
if ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI) {
- if(but->poin==NULL && but->rnapoin.data==NULL);
- else if(mode=='c') {
+ if (but->poin==NULL && but->rnapoin.data==NULL);
+ else if (mode=='c') {
ui_get_but_string(but, buf, sizeof(buf));
WM_clipboard_text_set(buf, 0);
}
@@ -1139,11 +1141,11 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
/* RGB triple */
- else if(but->type==COL) {
+ else if (but->type==COL) {
float rgb[3];
- if(but->poin==NULL && but->rnapoin.data==NULL);
- else if(mode=='c') {
+ if (but->poin==NULL && but->rnapoin.data==NULL);
+ else if (mode=='c') {
ui_get_but_vectorf(but, rgb);
BLI_snprintf(buf, sizeof(buf), "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]);
@@ -1160,11 +1162,11 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
/* text/string and ID data */
- else if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+ else if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
uiHandleButtonData *active_data= but->active;
- if(but->poin==NULL && but->rnapoin.data==NULL);
- else if(mode=='c') {
+ if (but->poin==NULL && but->rnapoin.data==NULL);
+ else if (mode=='c') {
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
BLI_strncpy(buf, active_data->str, UI_MAX_DRAW_STR);
WM_clipboard_text_set(active_data->str, 0);
@@ -1174,10 +1176,10 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
else {
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
- if(ui_is_but_utf8(but)) BLI_strncpy_utf8(active_data->str, buf, active_data->maxlen);
+ if (ui_is_but_utf8(but)) BLI_strncpy_utf8(active_data->str, buf, active_data->maxlen);
else BLI_strncpy(active_data->str, buf, active_data->maxlen);
- if(but->type == SEARCH_MENU) {
+ if (but->type == SEARCH_MENU) {
/* else uiSearchboxData.active member is not updated [#26856] */
ui_searchbox_update(C, data->searchbox, but, 1);
}
@@ -1185,18 +1187,18 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
}
/* colorband (not supported by system clipboard) */
- else if(but->type==BUT_COLORBAND) {
- if(mode=='c') {
- if(but->poin==NULL)
+ else if (but->type==BUT_COLORBAND) {
+ if (mode=='c') {
+ if (but->poin==NULL)
return;
memcpy(&but_copypaste_coba, but->poin, sizeof(ColorBand));
}
else {
- if(but_copypaste_coba.tot==0)
+ if (but_copypaste_coba.tot==0)
return;
- if(!but->poin)
+ if (!but->poin)
but->poin= MEM_callocN(sizeof(ColorBand), "colorband");
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
@@ -1206,7 +1208,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
/* operator button (any type) */
else if (but->optype) {
- if(mode=='c') {
+ if (mode=='c') {
PointerRNA *opptr;
char *str;
opptr= uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */
@@ -1228,8 +1230,8 @@ static int ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data)
char *str= data->str;
int len= strlen(str);
int change= 0;
- if(but->selsta != but->selend && len) {
- memmove( str+but->selsta, str+but->selend, (len - but->selend) + 1 );
+ if (but->selsta != but->selend && len) {
+ memmove(str + but->selsta, str + but->selend, (len - but->selend) + 1);
change= 1;
}
@@ -1255,9 +1257,9 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
BLI_strncpy(origstr, but->drawstr, data->maxlen);
/* XXX solve generic */
- if(but->type==NUM || but->type==NUMSLI)
+ if (but->type==NUM || but->type==NUMSLI)
startx += (int)(0.5f*(but->y2 - but->y1));
- else if(ELEM(but->type, TEX, SEARCH_MENU)) {
+ else if (ELEM(but->type, TEX, SEARCH_MENU)) {
startx += 5;
if (but->flag & UI_HAS_ICON)
startx += UI_DPI_ICON_SIZE;
@@ -1319,7 +1321,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
}
}
but->pos += but->ofs;
- if(but->pos<0) but->pos= 0;
+ if (but->pos<0) but->pos= 0;
}
if (fstyle->kerning == 1)
@@ -1353,7 +1355,7 @@ static int ui_textedit_type_buf(uiBut *but, uiHandleButtonData *data,
str= data->str;
len= strlen(str);
- if(len-(but->selend - but->selsta)+1 <= data->maxlen) {
+ if (len-(but->selend - but->selsta)+1 <= data->maxlen) {
int step= utf8_buf_len;
/* type over the current selection */
@@ -1362,7 +1364,7 @@ static int ui_textedit_type_buf(uiBut *but, uiHandleButtonData *data,
len= strlen(str);
}
- if(len + step < data->maxlen) {
+ if (len + step < data->maxlen) {
memmove(&str[but->pos + step], &str[but->pos], (len + 1) - but->pos);
memcpy(&str[but->pos], utf8_buf, step * sizeof(char));
but->pos += step;
@@ -1417,11 +1419,11 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, strCursorJump
BLI_str_cursor_step_utf8(str, len, &pos_i, direction, jump);
but->pos = pos_i;
- if(select) {
+ if (select) {
/* existing selection */
if (has_sel) {
- if(data->selextend == 0) {
+ if (data->selextend == 0) {
data->selextend= EXTEND_RIGHT;
}
@@ -1472,11 +1474,11 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
int changed= 0;
if (jump == STRCUR_JUMP_ALL) {
- if(len) changed=1;
+ if (len) changed=1;
str[0]= '\0';
but->pos= 0;
}
- else if(direction) { /* delete */
+ else if (direction) { /* delete */
if ((but->selend - but->selsta) > 0) {
changed= ui_textedit_delete_selection(but, data);
}
@@ -1494,7 +1496,7 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
if ((but->selend - but->selsta) > 0) {
changed= ui_textedit_delete_selection(but, data);
}
- else if(but->pos>0) {
+ else if (but->pos>0) {
int pos = but->pos;
int step;
@@ -1517,7 +1519,7 @@ static int ui_textedit_autocomplete(bContext *C, uiBut *but, uiHandleButtonData
str= data->str;
- if(data->searchbox)
+ if (data->searchbox)
ui_searchbox_autocomplete(C, data->searchbox, but, data->str);
else
but->autocomplete_func(C, str, but->autofunc_arg);
@@ -1542,7 +1544,7 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
/* extract the first line from the clipboard */
p = pbuf= WM_clipboard_text_get(0);
- if(p && p[0]) {
+ if (p && p[0]) {
unsigned int y;
i= 0;
while (*p && *p!='\r' && *p!='\n' && i<UI_MAX_DRAW_STR-1) {
@@ -1560,8 +1562,8 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
for (y=0; y<strlen(buf); y++)
{
/* add contents of buffer */
- if(len+1 < data->maxlen) {
- for(x= data->maxlen; x>but->pos; x--)
+ if (len+1 < data->maxlen) {
+ for (x= data->maxlen; x>but->pos; x--)
str[x]= str[x-1];
str[but->pos]= buf[y];
but->pos++;
@@ -1580,7 +1582,7 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
/* cut & copy */
else if (copy || cut) {
/* copy the contents to the copypaste buffer */
- for(x= but->selsta; x <= but->selend; x++) {
+ for (x= but->selsta; x <= but->selend; x++) {
if (x==but->selend)
buf[x] = '\0';
else
@@ -1590,8 +1592,8 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
WM_clipboard_text_set(buf, 0);
/* for cut only, delete the selection afterwards */
- if(cut)
- if((but->selend - but->selsta) > 0)
+ if (cut)
+ if ((but->selend - but->selsta) > 0)
changed= ui_textedit_delete_selection(but, data);
}
@@ -1602,7 +1604,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
{
int len;
- if(data->str) {
+ if (data->str) {
MEM_freeN(data->str);
data->str= NULL;
}
@@ -1612,7 +1614,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
data->str= MEM_callocN(sizeof(char)*data->maxlen + 1, "textedit str");
ui_get_but_string(but, data->str, data->maxlen);
- if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) {
+ if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) {
ui_convert_to_unit_alt_name(but, data->str, data->maxlen);
}
@@ -1630,7 +1632,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
but->selend = len;
/* optional searchbox */
- if(but->type==SEARCH_MENU) {
+ if (but->type==SEARCH_MENU) {
data->searchbox= ui_searchbox_create(C, data->region, but);
ui_searchbox_update(C, data->searchbox, but, 1); /* 1= reset */
}
@@ -1642,18 +1644,18 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(but) {
- if(ui_is_but_utf8(but)) {
+ if (but) {
+ if (ui_is_but_utf8(but)) {
int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr));
/* not a file?, strip non utf-8 chars */
- if(strip) {
- /* wont happen often so isnt that annoying to keep it here for a while */
+ if (strip) {
+ /* wont happen often so isn't that annoying to keep it here for a while */
printf("%s: invalid utf8 - stripped chars %d\n", __func__, strip);
}
}
- if(data->searchbox) {
- if(data->cancel==0)
+ if (data->searchbox) {
+ if (data->cancel==0)
ui_searchbox_apply(but, data->searchbox);
ui_searchbox_free(C, data->searchbox);
@@ -1672,21 +1674,21 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
uiBut *but;
/* label and roundbox can overlap real buttons (backdrops...) */
- if(ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
+ if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
return;
- for(but= actbut->next; but; but= but->next) {
- if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
- if(!(but->flag & UI_BUT_DISABLED)) {
+ for (but= actbut->next; but; but= but->next) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+ if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut= but;
data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
return;
}
}
}
- for(but= block->buttons.first; but!=actbut; but= but->next) {
- if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
- if(!(but->flag & UI_BUT_DISABLED)) {
+ for (but= block->buttons.first; but!=actbut; but= but->next) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+ if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut= but;
data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
return;
@@ -1700,21 +1702,21 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
uiBut *but;
/* label and roundbox can overlap real buttons (backdrops...) */
- if(ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
+ if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
return;
- for(but= actbut->prev; but; but= but->prev) {
- if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
- if(!(but->flag & UI_BUT_DISABLED)) {
+ for (but= actbut->prev; but; but= but->prev) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+ if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut= but;
data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
return;
}
}
}
- for(but= block->buttons.last; but!=actbut; but= but->prev) {
- if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
- if(!(but->flag & UI_BUT_DISABLED)) {
+ for (but= block->buttons.last; but!=actbut; but= but->prev) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+ if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut= but;
data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
return;
@@ -1732,7 +1734,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
case WHEELUPMOUSE:
case WHEELDOWNMOUSE:
case MOUSEMOVE:
- if(data->searchbox)
+ if (data->searchbox)
ui_searchbox_event(C, data->searchbox, but, event);
break;
@@ -1746,10 +1748,10 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
case LEFTMOUSE: {
/* exit on LMB only on RELEASE for searchbox, to mimic other popups, and allow multiple menu levels */
- if(data->searchbox)
+ if (data->searchbox)
inbox= ui_searchbox_inside(data->searchbox, event->x, event->y);
- if(event->val==KM_PRESS) {
+ if (event->val==KM_PRESS) {
mx= event->x;
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
@@ -1762,15 +1764,15 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
button_activate_state(C, but, BUTTON_STATE_TEXT_SELECTING);
retval= WM_UI_HANDLER_BREAK;
}
- else if(inbox==0) {
+ else if (inbox==0) {
/* if searchbox, click outside will cancel */
- if(data->searchbox)
+ if (data->searchbox)
data->cancel= data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval= WM_UI_HANDLER_BREAK;
}
}
- else if(inbox) {
+ else if (inbox) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval= WM_UI_HANDLER_BREAK;
}
@@ -1778,17 +1780,17 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
}
- if(event->val==KM_PRESS) {
+ if (event->val==KM_PRESS) {
switch (event->type) {
case VKEY:
case XKEY:
case CKEY:
- if(event->ctrl || event->oskey) {
- if(event->type == VKEY)
+ if (event->ctrl || event->oskey) {
+ if (event->type == VKEY)
changed= ui_textedit_copypaste(but, data, 1, 0, 0);
- else if(event->type == CKEY)
+ else if (event->type == CKEY)
changed= ui_textedit_copypaste(but, data, 0, 1, 0);
- else if(event->type == XKEY)
+ else if (event->type == XKEY)
changed= ui_textedit_copypaste(but, data, 0, 0, 1);
retval= WM_UI_HANDLER_BREAK;
@@ -1803,7 +1805,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
retval= WM_UI_HANDLER_BREAK;
break;
case DOWNARROWKEY:
- if(data->searchbox) {
+ if (data->searchbox) {
ui_searchbox_event(C, data->searchbox, but, event);
break;
}
@@ -1813,7 +1815,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
retval= WM_UI_HANDLER_BREAK;
break;
case UPARROWKEY:
- if(data->searchbox) {
+ if (data->searchbox) {
ui_searchbox_event(C, data->searchbox, but, event);
break;
}
@@ -1839,12 +1841,12 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
case TABKEY:
/* there is a key conflict here, we can't tab with autocomplete */
- if(but->autocomplete_func || data->searchbox) {
+ if (but->autocomplete_func || data->searchbox) {
changed= ui_textedit_autocomplete(C, but, data);
update= 1; /* do live update for tab key */
}
/* the hotkey here is not well defined, was G.qual so we check all */
- else if(event->shift || event->ctrl || event->alt || event->oskey) {
+ else if (event->shift || event->ctrl || event->alt || event->oskey) {
ui_textedit_prev_but(block, but, data);
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
@@ -1856,20 +1858,20 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
break;
}
- if((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) {
+ if ((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) {
char ascii = event->ascii;
const char *utf8_buf= event->utf8_buf;
/* exception that's useful for number buttons, some keyboard
* numpads have a comma instead of a period */
- if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* could use data->min*/
- if(event->type == PADPERIOD && ascii == ',') {
+ if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* could use data->min*/
+ if (event->type == PADPERIOD && ascii == ',') {
ascii = '.';
utf8_buf= NULL; /* force ascii fallback */
}
}
- if(utf8_buf && utf8_buf[0]) {
+ if (utf8_buf && utf8_buf[0]) {
int utf8_buf_len= BLI_str_utf8_size(utf8_buf);
/* keep this printf until utf8 is well tested */
if (utf8_buf_len != 1) {
@@ -1887,21 +1889,21 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
/* textbutton with magnifier icon: do live update for search button */
- if(but->icon==ICON_VIEWZOOM)
+ if (but->icon==ICON_VIEWZOOM)
update= 1;
}
- if(changed) {
+ if (changed) {
/* only update when typing for TAB key */
- if(update && data->interactive) ui_apply_button(C, block, but, data, 1);
+ if (update && data->interactive) ui_apply_button(C, block, but, data, 1);
else ui_check_but(but);
but->changed= TRUE;
- if(data->searchbox)
+ if (data->searchbox)
ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */
}
- if(changed || (retval == WM_UI_HANDLER_BREAK))
+ if (changed || (retval == WM_UI_HANDLER_BREAK))
ED_region_tag_redraw(data->region);
}
@@ -1920,13 +1922,13 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u
break;
}
case LEFTMOUSE:
- if(event->val == KM_RELEASE)
+ if (event->val == KM_RELEASE)
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
retval= WM_UI_HANDLER_BREAK;
break;
}
- if(retval == WM_UI_HANDLER_BREAK) {
+ if (retval == WM_UI_HANDLER_BREAK) {
ui_check_but(but);
ED_region_tag_redraw(data->region);
}
@@ -1936,14 +1938,14 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u
static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data)
{
- if(but->type == BUT_CURVE) {
+ if (but->type == BUT_CURVE) {
but->editcumap= (CurveMapping*)but->poin;
}
- else if(but->type == BUT_COLORBAND) {
+ else if (but->type == BUT_COLORBAND) {
data->coba= (ColorBand*)but->poin;
but->editcoba= data->coba;
}
- else if(ELEM3(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE)) {
+ else if (ELEM3(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE)) {
ui_get_but_vectorf(but, data->origvec);
copy_v3_v3(data->vec, data->origvec);
but->editvec= data->vec;
@@ -1984,7 +1986,7 @@ static void ui_numedit_end(uiBut *but, uiHandleButtonData *data)
static void ui_numedit_apply(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data)
{
- if(data->interactive) ui_apply_button(C, block, but, data, 1);
+ if (data->interactive) ui_apply_button(C, block, but, data, 1);
else ui_check_but(but);
ED_region_tag_redraw(data->region);
@@ -2003,7 +2005,7 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
switch(but->type) {
case BLOCK:
case PULLDOWN:
- if(but->menu_create_func) {
+ if (but->menu_create_func) {
menufunc= but->menu_create_func;
arg= but->poin;
}
@@ -2013,7 +2015,7 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
}
break;
case MENU:
- if(but->menu_create_func) {
+ if (but->menu_create_func) {
menufunc= but->menu_create_func;
arg= but->poin;
}
@@ -2043,14 +2045,14 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
break;
}
- if(func || handlefunc) {
+ if (func || handlefunc) {
data->menu= ui_popup_block_create(C, data->region, but, func, handlefunc, arg);
- if(but->block->handle)
+ if (but->block->handle)
data->menu->popup= but->block->handle->popup;
}
- else if(menufunc || menustr) {
+ else if (menufunc || menustr) {
data->menu= ui_popup_menu_create(C, data->region, but, menufunc, arg, menustr);
- if(but->block->handle)
+ if (but->block->handle)
data->menu->popup= but->block->handle->popup;
}
@@ -2060,14 +2062,14 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(but) {
+ if (but) {
but->editval= NULL;
but->editvec= NULL;
but->block->auto_open_last= PIL_check_seconds_timer();
}
- if(data->menu) {
+ if (data->menu) {
ui_popup_block_free(C, data->menu);
data->menu= NULL;
}
@@ -2077,23 +2079,23 @@ static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data)
static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type == LEFTMOUSE && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
return WM_UI_HANDLER_BREAK;
}
- else if(event->type == LEFTMOUSE && but->block->handle) {
+ else if (event->type == LEFTMOUSE && but->block->handle) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ else if (ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
- if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
- if(!(but->flag & UI_SELECT))
+ else if (data->state == BUTTON_STATE_WAIT_RELEASE) {
+ if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if (!(but->flag & UI_SELECT))
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
@@ -2105,24 +2107,24 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
but->drawstr[0]= 0;
but->modifier_key= 0;
button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
+ else if (data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
- if(event->type == MOUSEMOVE)
+ if (event->type == MOUSEMOVE)
return WM_UI_HANDLER_CONTINUE;
- if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
+ if (event->type == LEFTMOUSE && event->val==KM_PRESS) {
/* only cancel if click outside the button */
- if(ui_mouse_inside_button(but->active->region, but, event->x, event->y) == 0) {
+ if (ui_mouse_inside_button(but->active->region, but, event->x, event->y) == 0) {
/* data->cancel doesnt work, this button opens immediate */
- if(but->flag & UI_BUT_IMMEDIATE)
+ if (but->flag & UI_BUT_IMMEDIATE)
ui_set_but_val(but, 0);
else
data->cancel= 1;
@@ -2133,18 +2135,18 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
/* always set */
but->modifier_key = 0;
- if(event->shift) but->modifier_key |= KM_SHIFT;
- if(event->alt) but->modifier_key |= KM_ALT;
- if(event->ctrl) but->modifier_key |= KM_CTRL;
- if(event->oskey) but->modifier_key |= KM_OSKEY;
+ if (event->shift) but->modifier_key |= KM_SHIFT;
+ if (event->alt) but->modifier_key |= KM_ALT;
+ if (event->ctrl) but->modifier_key |= KM_CTRL;
+ if (event->oskey) but->modifier_key |= KM_OSKEY;
ui_check_but(but);
ED_region_tag_redraw(data->region);
- if(event->val==KM_PRESS) {
- if(ISHOTKEY(event->type)) {
+ if (event->val==KM_PRESS) {
+ if (ISHOTKEY(event->type)) {
- if(WM_key_event_string(event->type)[0])
+ if (WM_key_event_string(event->type)[0])
ui_set_but_val(but, event->type);
else
data->cancel= 1;
@@ -2152,7 +2154,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
- else if(event->type == ESCKEY) {
+ else if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -2166,18 +2168,18 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
- if(event->type == MOUSEMOVE)
+ else if (data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
+ if (event->type == MOUSEMOVE)
return WM_UI_HANDLER_CONTINUE;
- if(event->val==KM_PRESS) {
- if(WM_key_event_string(event->type)[0])
+ if (event->val==KM_PRESS) {
+ if (WM_key_event_string(event->type)[0])
ui_set_but_val(but, event->type);
else
data->cancel= 1;
@@ -2191,20 +2193,20 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, w
static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val==KM_PRESS) {
- if(but->dt == UI_EMBOSSN && !event->ctrl);
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val==KM_PRESS) {
+ if (but->dt == UI_EMBOSSN && !event->ctrl);
else {
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
return WM_UI_HANDLER_BREAK;
}
}
}
- else if(data->state == BUTTON_STATE_TEXT_EDITING) {
+ else if (data->state == BUTTON_STATE_TEXT_EDITING) {
ui_do_but_textedit(C, block, but, data, event);
return WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_TEXT_SELECTING) {
+ else if (data->state == BUTTON_STATE_TEXT_SELECTING) {
ui_do_but_textedit_select(C, block, but, data, event);
return WM_UI_HANDLER_BREAK;
}
@@ -2214,8 +2216,8 @@ static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
data->togdual= event->ctrl;
data->togonly= !event->shift;
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -2228,11 +2230,11 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
/* first handle click on icondrag type button */
- if(event->type==LEFTMOUSE && but->dragpoin) {
- if(ui_but_mouse_inside_icon(but, data->region, event)) {
+ if (event->type==LEFTMOUSE && but->dragpoin) {
+ if (ui_but_mouse_inside_icon(but, data->region, event)) {
/* tell the button to wait and keep checking further events to
* see if it should start dragging */
@@ -2243,27 +2245,27 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
}
}
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
int ret = WM_UI_HANDLER_BREAK;
/* XXX (a bit ugly) Special case handling for filebrowser drag button */
- if(but->dragpoin && but->imb && ui_but_mouse_inside_icon(but, data->region, event)) {
+ if (but->dragpoin && but->imb && ui_but_mouse_inside_icon(but, data->region, event)) {
ret = WM_UI_HANDLER_CONTINUE;
}
button_activate_state(C, but, BUTTON_STATE_EXIT);
return ret;
}
}
- else if(data->state == BUTTON_STATE_WAIT_DRAG) {
+ else if (data->state == BUTTON_STATE_WAIT_DRAG) {
/* this function also ends state */
- if(ui_but_start_drag(C, but, data, event)) {
+ if (ui_but_start_drag(C, but, data, event)) {
return WM_UI_HANDLER_BREAK;
}
/* If the mouse has been pressed and released, getting to
* this point without triggering a drag, then clear the
* drag state for this button and continue to pass on the event */
- if(event->type==LEFTMOUSE && event->val==KM_RELEASE) {
+ if (event->type==LEFTMOUSE && event->val==KM_RELEASE) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_CONTINUE;
}
@@ -2279,25 +2281,25 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
/* var names match ui_numedit_but_NUM */
static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, float softmax, float softrange, int snap)
{
- if(tempf==softmin || tempf==softmax || snap==0) {
+ if (tempf==softmin || tempf==softmax || snap==0) {
/* pass */
}
else {
float fac= 1.0f;
- if(ui_is_but_unit(but)) {
+ if (ui_is_but_unit(but)) {
UnitSettings *unit= but->block->unit;
int unit_type= uiButGetUnitType(but)>>16;
- if(bUnit_IsValid(unit->system, unit_type)) {
+ if (bUnit_IsValid(unit->system, unit_type)) {
fac= (float)bUnit_BaseScalar(unit->system, unit_type);
- if(ELEM3(unit_type, B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME)) {
+ if (ELEM3(unit_type, B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME)) {
fac /= unit->scale_length;
}
}
}
- if(fac != 1.0f) {
+ if (fac != 1.0f) {
/* snap in unit-space */
tempf /= fac;
/* softmin /= fac; */ /* UNUSED */
@@ -2305,18 +2307,18 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa
softrange /= fac;
}
- if(snap==1) {
- if(softrange < 2.10f) tempf= 0.1f*floorf(10.0f*tempf);
- else if(softrange < 21.0f) tempf= floorf(tempf);
+ if (snap==1) {
+ if (softrange < 2.10f) tempf= 0.1f*floorf(10.0f*tempf);
+ else if (softrange < 21.0f) tempf= floorf(tempf);
else tempf= 10.0f*floorf(tempf/10.0f);
}
- else if(snap==2) {
- if(softrange < 2.10f) tempf= 0.01f*floorf(100.0f*tempf);
- else if(softrange < 21.0f) tempf= 0.1f*floorf(10.0f*tempf);
+ else if (snap==2) {
+ if (softrange < 2.10f) tempf= 0.01f*floorf(100.0f*tempf);
+ else if (softrange < 21.0f) tempf= 0.1f*floorf(10.0f*tempf);
else tempf= floor(tempf);
}
- if(fac != 1.0f)
+ if (fac != 1.0f)
tempf *= fac;
}
@@ -2325,7 +2327,7 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa
static float ui_numedit_apply_snap(int temp, float softmin, float softmax, int snap)
{
- if(temp==softmin || temp==softmax)
+ if (temp==softmin || temp==softmax)
return temp;
switch(snap) {
@@ -2347,13 +2349,13 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
float deler, tempf, softmin, softmax, softrange;
int lvalue, temp, changed= 0;
- if(mx == data->draglastx)
+ if (mx == data->draglastx)
return changed;
/* drag-lock - prevent unwanted scroll adjustments */
/* change value (now 3) to adjust threshold in pixels */
- if(data->draglock) {
- if(abs(mx-data->dragstartx) <= 3)
+ if (data->draglock) {
+ if (abs(mx-data->dragstartx) <= 3)
return changed;
data->draglock= 0;
@@ -2364,19 +2366,20 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
softmax= but->softmax;
softrange= softmax - softmin;
- if(ui_is_a_warp_but(but)) {
+ if (ui_is_a_warp_but(but)) {
/* Mouse location isn't screen clamped to the screen so use a linear mapping
* 2px == 1-int, or 1px == 1-ClickStep */
- if(ui_is_but_float(but)) {
+ if (ui_is_but_float(but)) {
fac *= 0.01f*but->a1;
tempf = (float)data->startvalue + ((float)(mx - data->dragstartx) * fac);
tempf= ui_numedit_apply_snapf(but, tempf, softmin, softmax, softrange, snap);
#if 1 /* fake moving the click start, nicer for dragging back after passing the limit */
- if(tempf < softmin) {
+ if (tempf < softmin) {
data->dragstartx -= (softmin-tempf) / fac;
tempf= softmin;
- } else if (tempf > softmax) {
+ }
+ else if (tempf > softmax) {
data->dragstartx += (tempf-softmax) / fac;
tempf= softmax;
}
@@ -2384,25 +2387,26 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
CLAMP(tempf, softmin, softmax);
#endif
- if(tempf != (float)data->value) {
+ if (tempf != (float)data->value) {
data->dragchange= 1;
data->value= tempf;
changed= 1;
}
}
else {
- if(softrange > 256) fac= 1.0; /* 1px == 1 */
- else if(softrange > 32) fac= 1.0/2.0; /* 2px == 1 */
+ if (softrange > 256) fac= 1.0; /* 1px == 1 */
+ else if (softrange > 32) fac= 1.0/2.0; /* 2px == 1 */
else fac= 1.0/16.0; /* 16px == 1? */
temp= data->startvalue + (((double)mx - data->dragstartx) * (double)fac);
temp= ui_numedit_apply_snap(temp, softmin, softmax, snap);
#if 1 /* fake moving the click start, nicer for dragging back after passing the limit */
- if(temp < softmin) {
+ if (temp < softmin) {
data->dragstartx -= (softmin-temp) / fac;
temp= softmin;
- } else if (temp > softmax) {
+ }
+ else if (temp > softmax) {
data->dragstartx += (temp-softmax) / fac;
temp= softmax;
}
@@ -2410,7 +2414,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
CLAMP(temp, softmin, softmax);
#endif
- if(temp != data->value) {
+ if (temp != data->value) {
data->dragchange= 1;
data->value= temp;
changed= 1;
@@ -2422,7 +2426,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
else {
/* Use a non-linear mapping of the mouse drag especially for large floats (normal behavior) */
deler= 500;
- if(!ui_is_but_float(but)) {
+ if (!ui_is_but_float(but)) {
/* prevent large ranges from getting too out of control */
if (softrange > 600) deler = powf(softrange, 0.75);
@@ -2431,13 +2435,15 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
}
deler /= fac;
- if(softrange > 11) {
+ if (softrange > 11) {
/* non linear change in mouse input- good for high precicsion */
data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabsf(data->dragstartx-mx)*0.002f);
- } else if (softrange > 129) { /* only scale large int buttons */
+ }
+ else if (softrange > 129) { /* only scale large int buttons */
/* non linear change in mouse input- good for high precicsionm ints need less fine tuning */
data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabsf(data->dragstartx-mx)*0.004f);
- } else {
+ }
+ else {
/*no scaling */
data->dragf += ((float)(mx - data->draglastx)) / deler;
}
@@ -2447,7 +2453,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
tempf= (softmin + data->dragf*softrange);
- if(!ui_is_but_float(but)) {
+ if (!ui_is_but_float(but)) {
temp= floorf(tempf + 0.5f);
temp= ui_numedit_apply_snap(temp, softmin, softmax, snap);
@@ -2455,7 +2461,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
CLAMP(temp, softmin, softmax);
lvalue= (int)data->value;
- if(temp != lvalue) {
+ if (temp != lvalue) {
data->dragchange= 1;
data->value= (double)temp;
changed= 1;
@@ -2467,7 +2473,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
CLAMP(tempf, softmin, softmax);
- if(tempf != (float)data->value) {
+ if (tempf != (float)data->value) {
data->dragchange= 1;
data->value= tempf;
changed= 1;
@@ -2491,27 +2497,27 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
/* XXX hardcoded keymap check.... */
- if(event->type == WHEELDOWNMOUSE && event->alt) {
+ if (event->type == WHEELDOWNMOUSE && event->alt) {
mx= but->x1;
click= 1;
}
- else if(event->type == WHEELUPMOUSE && event->alt) {
+ else if (event->type == WHEELUPMOUSE && event->alt) {
mx= but->x2;
click= 1;
}
- else if(event->val==KM_PRESS) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
+ else if (event->val==KM_PRESS) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
retval= WM_UI_HANDLER_BREAK;
}
- else if(event->type == LEFTMOUSE) {
+ else if (event->type == LEFTMOUSE) {
data->dragstartx= data->draglastx= ui_is_a_warp_but(but) ? screen_mx:mx;
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
retval= WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
+ else if (ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
click= 1;
else if (event->type == MINUSKEY && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
@@ -2522,43 +2528,43 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
- if(data->dragchange)
+ else if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if (data->dragchange)
button_activate_state(C, but, BUTTON_STATE_EXIT);
else
click= 1;
}
- else if(event->type == MOUSEMOVE) {
+ else if (event->type == MOUSEMOVE) {
float fac;
int snap;
fac= 1.0f;
- if(event->shift) fac /= 10.0f;
- if(event->alt) fac /= 20.0f;
+ if (event->shift) fac /= 10.0f;
+ if (event->alt) fac /= 20.0f;
snap= (event->ctrl)? (event->shift)? 2: 1: 0;
- if(ui_numedit_but_NUM(but, data, fac, snap, (ui_is_a_warp_but(but) ? screen_mx:mx)))
+ if (ui_numedit_but_NUM(but, data, fac, snap, (ui_is_a_warp_but(but) ? screen_mx:mx)))
ui_numedit_apply(C, block, but, data);
}
retval= WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_TEXT_EDITING) {
+ else if (data->state == BUTTON_STATE_TEXT_EDITING) {
ui_do_but_textedit(C, block, but, data, event);
retval= WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_TEXT_SELECTING) {
+ else if (data->state == BUTTON_STATE_TEXT_SELECTING) {
ui_do_but_textedit_select(C, block, but, data, event);
retval= WM_UI_HANDLER_BREAK;
}
- if(click) {
+ if (click) {
/* we can click on the side arrows to increment/decrement,
* or click inside to edit the value directly */
float tempf, softmin, softmax;
@@ -2567,23 +2573,23 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
softmin= but->softmin;
softmax= but->softmax;
- if(!ui_is_but_float(but)) {
- if(mx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
+ if (!ui_is_but_float(but)) {
+ if (mx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
temp= (int)data->value - 1;
- if(temp>=softmin && temp<=softmax)
+ if (temp>=softmin && temp<=softmax)
data->value= (double)temp;
else
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(mx > (but->x1 + (2*(but->x2 - but->x1)/3) + 3)) {
+ else if (mx > (but->x1 + (2*(but->x2 - but->x1)/3) + 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
temp= (int)data->value + 1;
- if(temp>=softmin && temp<=softmax)
+ if (temp>=softmin && temp<=softmax)
data->value= (double)temp;
else
data->cancel= 1;
@@ -2594,7 +2600,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
}
else {
- if(mx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
+ if (mx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
tempf= (float)data->value - 0.01f * but->a1;
@@ -2603,7 +2609,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(mx > but->x1 + (2*((but->x2 - but->x1)/3) + 3)) {
+ else if (mx > but->x1 + (2*((but->x2 - but->x1)/3) + 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
tempf= (float)data->value + 0.01f * but->a1;
@@ -2631,9 +2637,9 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i
softmax= but->softmax;
softrange= softmax - softmin;
- if(but->type==NUMSLI) deler= ((but->x2-but->x1) - 5.0f*but->aspect);
- else if(but->type==HSVSLI) deler= ((but->x2-but->x1)/2.0f - 5.0f*but->aspect);
- else if(but->type==SCROLL) {
+ if (but->type==NUMSLI) deler= ((but->x2-but->x1) - 5.0f*but->aspect);
+ else if (but->type==HSVSLI) deler= ((but->x2-but->x1)/2.0f - 5.0f*but->aspect);
+ else if (but->type==SCROLL) {
int horizontal= (but->x2 - but->x1 > but->y2 - but->y1);
float size= (horizontal)? (but->x2-but->x1): -(but->y2-but->y1);
deler= size*(but->softmax - but->softmin)/(but->softmax - but->softmin + but->a1);
@@ -2642,26 +2648,26 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i
f= (float)(mx-data->dragstartx)/deler + data->dragfstart;
- if(shift)
+ if (shift)
f= (f-data->dragfstart)/10.0f + data->dragfstart;
CLAMP(f, 0.0f, 1.0f);
tempf= softmin + f*softrange;
temp= floorf(tempf+0.5f);
- if(ctrl) {
- if(tempf==softmin || tempf==softmax);
- else if(ui_is_but_float(but)) {
+ if (ctrl) {
+ if (tempf==softmin || tempf==softmax);
+ else if (ui_is_but_float(but)) {
- if(shift) {
- if(tempf==softmin || tempf==softmax);
- else if(softmax-softmin < 2.10f) tempf= 0.01f * floorf(100.0f*tempf);
- else if(softmax-softmin < 21.0f) tempf= 0.1f * floorf(10.0f*tempf);
+ if (shift) {
+ if (tempf==softmin || tempf==softmax);
+ else if (softmax-softmin < 2.10f) tempf= 0.01f * floorf(100.0f*tempf);
+ else if (softmax-softmin < 21.0f) tempf= 0.1f * floorf(10.0f*tempf);
else tempf= floorf(tempf);
}
else {
- if(softmax-softmin < 2.10f) tempf= 0.1f * floorf(10.0f*tempf);
- else if(softmax-softmin < 21.0f) tempf= floorf(tempf);
+ if (softmax-softmin < 2.10f) tempf= 0.1f * floorf(10.0f*tempf);
+ else if (softmax-softmin < 21.0f) tempf= floorf(tempf);
else tempf= 10.0f*floorf(tempf/10.0f);
}
}
@@ -2671,12 +2677,12 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i
}
}
- if(!ui_is_but_float(but)) {
+ if (!ui_is_but_float(but)) {
lvalue= floor(data->value+0.5);
CLAMP(temp, softmin, softmax);
- if(temp != lvalue) {
+ if (temp != lvalue) {
data->value= temp;
data->dragchange= 1;
changed= 1;
@@ -2685,7 +2691,7 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i
else {
CLAMP(tempf, softmin, softmax);
- if(tempf != (float)data->value) {
+ if (tempf != (float)data->value) {
data->value= tempf;
data->dragchange= 1;
changed= 1;
@@ -2704,23 +2710,23 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
/* XXX hardcoded keymap check.... */
- if(event->type == WHEELDOWNMOUSE && event->alt) {
+ if (event->type == WHEELDOWNMOUSE && event->alt) {
mx= but->x1;
click= 2;
}
- else if(event->type == WHEELUPMOUSE && event->alt) {
+ else if (event->type == WHEELUPMOUSE && event->alt) {
mx= but->x2;
click= 2;
}
- else if(event->val==KM_PRESS) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
+ else if (event->val==KM_PRESS) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
retval= WM_UI_HANDLER_BREAK;
}
/* alt-click on sides to get "arrows" like in NUM buttons, and match wheel usage above */
- else if(event->type == LEFTMOUSE && event->alt) {
+ else if (event->type == LEFTMOUSE && event->alt) {
int halfpos = (but->x1 + but->x2) / 2;
click = 2;
if (mx < halfpos)
@@ -2728,13 +2734,13 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
else
mx = but->x2;
}
- else if(event->type == LEFTMOUSE) {
+ else if (event->type == LEFTMOUSE) {
data->dragstartx= mx;
data->draglastx= mx;
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
retval= WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
+ else if (ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
click= 1;
else if (event->type == MINUSKEY && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
@@ -2744,34 +2750,34 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
}
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
- if(data->dragchange)
+ else if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if (data->dragchange)
button_activate_state(C, but, BUTTON_STATE_EXIT);
else
click= 1;
}
- else if(event->type == MOUSEMOVE) {
- if(ui_numedit_but_SLI(but, data, event->shift, event->ctrl, mx))
+ else if (event->type == MOUSEMOVE) {
+ if (ui_numedit_but_SLI(but, data, event->shift, event->ctrl, mx))
ui_numedit_apply(C, block, but, data);
}
retval= WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_TEXT_EDITING) {
+ else if (data->state == BUTTON_STATE_TEXT_EDITING) {
ui_do_but_textedit(C, block, but, data, event);
retval= WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_TEXT_SELECTING) {
+ else if (data->state == BUTTON_STATE_TEXT_SELECTING) {
ui_do_but_textedit_select(C, block, but, data, event);
retval= WM_UI_HANDLER_BREAK;
}
- if(click) {
+ if (click) {
if (click==2) {
/* nudge slider to the left or right */
float f, tempf, softmin, softmax, softrange;
@@ -2787,7 +2793,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
temp= (int)data->value;
#if 0
- if(but->type==SLI) {
+ if (but->type==SLI) {
f= (float)(mx-but->x1)/(but->x2-but->x1); /* same as below */
}
else
@@ -2798,20 +2804,20 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
f= softmin + f*softrange;
- if(!ui_is_but_float(but)) {
- if(f<temp) temp--;
+ if (!ui_is_but_float(but)) {
+ if (f<temp) temp--;
else temp++;
- if(temp>=softmin && temp<=softmax)
+ if (temp>=softmin && temp<=softmax)
data->value= temp;
else
data->cancel= 1;
}
else {
- if(f<tempf) tempf -= 0.01f;
+ if (f<tempf) tempf -= 0.01f;
else tempf += 0.01f;
- if(tempf>=softmin && tempf<=softmax)
+ if (tempf>=softmin && tempf<=softmax)
data->value= tempf;
else
data->cancel= 1;
@@ -2840,10 +2846,10 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->val==KM_PRESS) {
- if(event->type == LEFTMOUSE) {
- if(horizontal) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->val==KM_PRESS) {
+ if (event->type == LEFTMOUSE) {
+ if (horizontal) {
data->dragstartx= mx;
data->draglastx= mx;
}
@@ -2856,22 +2862,22 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
}
/* UNUSED - otherwise code is ok, add back if needed */
#if 0
- else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
+ else if (ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
click= 1;
#endif
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(ui_numedit_but_SLI(but, data, 0, 0, (horizontal)? mx: my))
+ else if (event->type == MOUSEMOVE) {
+ if (ui_numedit_but_SLI(but, data, 0, 0, (horizontal)? mx: my))
ui_numedit_apply(C, block, but, data);
}
@@ -2885,11 +2891,11 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
/* first handle click on icondrag type button */
- if(event->type==LEFTMOUSE && but->dragpoin && event->val==KM_PRESS) {
- if(ui_but_mouse_inside_icon(but, data->region, event)) {
+ if (event->type==LEFTMOUSE && but->dragpoin && event->val==KM_PRESS) {
+ if (ui_but_mouse_inside_icon(but, data->region, event)) {
button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG);
data->dragstartx= event->x;
data->dragstarty= event->y;
@@ -2898,13 +2904,13 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
}
/* regular open menu */
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
return WM_UI_HANDLER_BREAK;
}
- else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) {
+ else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) {
- if(event->type == WHEELDOWNMOUSE && event->alt) {
+ if (event->type == WHEELDOWNMOUSE && event->alt) {
data->value= ui_step_name_menu(but, -1);
button_activate_state(C, but, BUTTON_STATE_EXIT);
ui_apply_button(C, but->block, but, data, 1);
@@ -2921,7 +2927,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
return WM_UI_HANDLER_BREAK;
}
- else if(event->type == WHEELUPMOUSE && event->alt) {
+ else if (event->type == WHEELUPMOUSE && event->alt) {
data->value= ui_step_name_menu(but, 1);
button_activate_state(C, but, BUTTON_STATE_EXIT);
ui_apply_button(C, but->block, but, data, 1);
@@ -2933,15 +2939,15 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
return WM_UI_HANDLER_BREAK;
}
}
- else if(but->type==COL) {
- if( ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
+ else if (but->type==COL) {
+ if ( ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
float *hsv= ui_block_hsv_get(but->block);
float col[3];
ui_get_but_vectorf(but, col);
rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
- if(event->type==WHEELDOWNMOUSE)
+ if (event->type==WHEELDOWNMOUSE)
hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f);
else
hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f);
@@ -2955,21 +2961,21 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
}
}
}
- else if(data->state == BUTTON_STATE_WAIT_DRAG) {
+ else if (data->state == BUTTON_STATE_WAIT_DRAG) {
/* this function also ends state */
- if(ui_but_start_drag(C, but, data, event)) {
+ if (ui_but_start_drag(C, but, data, event)) {
return WM_UI_HANDLER_BREAK;
}
/* outside icon quit, not needed if drag activated */
- if(0==ui_but_mouse_inside_icon(but, data->region, event)) {
+ if (0==ui_but_mouse_inside_icon(but, data->region, event)) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
data->cancel= 1;
return WM_UI_HANDLER_BREAK;
}
- if(event->type==LEFTMOUSE && event->val==KM_RELEASE) {
+ if (event->type==LEFTMOUSE && event->val==KM_RELEASE) {
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
return WM_UI_HANDLER_BREAK;
}
@@ -2994,11 +3000,11 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i
rad= (but->x2 - but->x1);
radsq= rad*rad;
- if(fp[2]>0.0f) {
+ if (fp[2]>0.0f) {
mdx= (rad*fp[0]);
mdy= (rad*fp[1]);
}
- else if(fp[2]> -1.0f) {
+ else if (fp[2]> -1.0f) {
mrad= rad/sqrtf(fp[0]*fp[0] + fp[1]*fp[1]);
mdx= 2.0f*mrad*fp[0] - (rad*fp[0]);
@@ -3011,7 +3017,7 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i
fp= data->vec;
mrad= dx*dx+dy*dy;
- if(mrad < radsq) { /* inner circle */
+ if (mrad < radsq) { /* inner circle */
fp[0]= dx;
fp[1]= dy;
fp[2]= sqrt( radsq-dx*dx-dy*dy );
@@ -3024,7 +3030,7 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i
dy*= (2.0f*mrad - 1.0f);
mrad= dx*dx+dy*dy;
- if(mrad < radsq) {
+ if (mrad < radsq) {
fp[0]= dx;
fp[1]= dy;
fp[2]= -sqrt( radsq-dx*dx-dy*dy );
@@ -3046,8 +3052,8 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -3055,20 +3061,20 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_NORMAL(but, data, mx, my))
+ if (ui_numedit_but_NORMAL(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_NORMAL(but, data, mx, my))
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_NORMAL(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS)
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
@@ -3212,8 +3218,8 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -3221,7 +3227,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_HSVCUBE(but, data, mx, my))
+ if (ui_numedit_but_HSVCUBE(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
@@ -3237,8 +3243,8 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
return WM_UI_HANDLER_BREAK;
}
/* XXX hardcoded keymap check.... */
- else if (event->type == DELKEY && event->val == KM_PRESS) {
- if (but->a1==UI_GRAD_V_ALT){
+ else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
+ if (but->a1==UI_GRAD_V_ALT) {
int len;
/* reset only value */
@@ -3267,19 +3273,19 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
}
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_HSVCUBE(but, data, mx, my))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_HSVCUBE(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS)
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
@@ -3295,8 +3301,8 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
float rgb[3];
float hsv[3];
- rect.xmin= but->x1; rect.xmax= but->x2;
- rect.ymin= but->y1; rect.ymax= but->y2;
+ rect.xmin = but->x1; rect.xmax = but->x2;
+ rect.ymin = but->y1; rect.ymax = but->y2;
ui_get_but_vectorf(but, rgb);
copy_v3_v3(hsv, ui_block_hsv_get(but->block));
@@ -3308,7 +3314,7 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
if (hsv[2] == 0.f) hsv[2] = 0.0001f;
}
- if(U.uiflag & USER_CONTINUOUS_MOUSE) {
+ if (U.uiflag & USER_CONTINUOUS_MOUSE) {
float fac= shift ? 0.05f : 1.0f;
/* slow down the mouse, this is fairly picky */
mx = (data->dragstartx*(1.0f-fac) + mx*fac);
@@ -3317,12 +3323,12 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
ui_hsvcircle_vals_from_pos(hsv, hsv+1, &rect, (float)mx, (float)my);
- if(but->flag & UI_BUT_COLOR_CUBIC)
+ if (but->flag & UI_BUT_COLOR_CUBIC)
hsv[1]= 1.0f - sqrt3f(1.0f - hsv[1]);
hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
- if((but->flag & UI_BUT_VEC_SIZE_LOCK) && (rgb[0] || rgb[1] || rgb[2])) {
+ if ((but->flag & UI_BUT_VEC_SIZE_LOCK) && (rgb[0] || rgb[1] || rgb[2])) {
normalize_v3(rgb);
mul_v3_fl(rgb, but->a2);
}
@@ -3379,7 +3385,7 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND
hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2);
- if((but->flag & UI_BUT_VEC_SIZE_LOCK) && (data->vec[0] || data->vec[1] || data->vec[2])) {
+ if ((but->flag & UI_BUT_VEC_SIZE_LOCK) && (data->vec[0] || data->vec[1] || data->vec[2])) {
normalize_v3(data->vec);
mul_v3_fl(data->vec, but->a2);
}
@@ -3395,8 +3401,8 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -3404,7 +3410,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
+ if (ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
@@ -3420,7 +3426,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_BREAK;
}
/* XXX hardcoded keymap check.... */
- else if (event->type == DELKEY && event->val == KM_PRESS) {
+ else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
int len;
/* reset only saturation */
@@ -3448,32 +3454,32 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
/* XXX hardcoded keymap check.... */
- else if(event->type == WHEELDOWNMOUSE) {
+ else if (event->type == WHEELDOWNMOUSE) {
float *hsv= ui_block_hsv_get(but->block);
hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f);
ui_set_but_hsv(but); // converts to rgb
ui_numedit_apply(C, block, but, data);
}
- else if(event->type == WHEELUPMOUSE) {
+ else if (event->type == WHEELUPMOUSE) {
float *hsv= ui_block_hsv_get(but->block);
hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f);
ui_set_but_hsv(but); // converts to rgb
ui_numedit_apply(C, block, but, data);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
return WM_UI_HANDLER_BREAK;
@@ -3488,7 +3494,7 @@ static int ui_numedit_but_COLORBAND(uiBut *but, uiHandleButtonData *data, int mx
float dx;
int changed= 0;
- if(data->draglastx == mx)
+ if (data->draglastx == mx)
return changed;
dx= ((float)(mx - data->draglastx))/(but->x2-but->x1);
@@ -3514,11 +3520,11 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
coba= (ColorBand*)but->poin;
- if(event->ctrl) {
+ if (event->ctrl) {
/* insert new key on mouse location */
float pos= ((float)(mx - but->x1))/(but->x2-but->x1);
colorband_element_add(coba, pos);
@@ -3531,11 +3537,11 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
data->draglasty= my;
/* activate new key when mouse is close */
- for(a=0, cbd= coba->data; a<coba->tot; a++, cbd++) {
+ for (a=0, cbd= coba->data; a<coba->tot; a++, cbd++) {
xco= but->x1 + (cbd->pos*(but->x2-but->x1));
xco= ABS(xco-mx);
- if(a==coba->cur) xco+= 5; // selected one disadvantage
- if(xco<mindist) {
+ if (a==coba->cur) xco+= 5; // selected one disadvantage
+ if (xco<mindist) {
coba->cur= a;
mindist= xco;
}
@@ -3548,14 +3554,14 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_COLORBAND(but, data, mx))
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_COLORBAND(but, data, mx))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS)
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
@@ -3577,38 +3583,38 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
/* offsx= cumap->curr.xmin; */
/* offsy= cumap->curr.ymin; */
- if(snap) {
+ if (snap) {
float d[2];
d[0]= mx - data->dragstartx;
d[1]= my - data->dragstarty;
- if(len_v2(d) < 3.0f)
+ if (len_v2(d) < 3.0f)
snap= 0;
}
- if(data->dragsel != -1) {
+ if (data->dragsel != -1) {
int moved_point= 0; /* for ctrl grid, can't use orig coords because of sorting */
fx= (mx-data->draglastx)/zoomx;
fy= (my-data->draglasty)/zoomy;
- for(a=0; a<cuma->totpoint; a++) {
- if(cmp[a].flag & SELECT) {
+ for (a=0; a<cuma->totpoint; a++) {
+ if (cmp[a].flag & SELECT) {
float origx= cmp[a].x, origy= cmp[a].y;
cmp[a].x+= fx;
cmp[a].y+= fy;
- if(snap) {
+ if (snap) {
cmp[a].x= 0.125f*floorf(0.5f + 8.0f*cmp[a].x);
cmp[a].y= 0.125f*floorf(0.5f + 8.0f*cmp[a].y);
}
- if(cmp[a].x!=origx || cmp[a].y!=origy)
+ if (cmp[a].x!=origx || cmp[a].y!=origy)
moved_point= 1;
}
}
curvemapping_changed(cumap, 0); /* no remove doubles */
- if(moved_point) {
+ if (moved_point) {
data->draglastx= mx;
data->draglasty= my;
changed= 1;
@@ -3621,14 +3627,14 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
fy= (my-data->draglasty)/zoomy;
/* clamp for clip */
- if(cumap->flag & CUMA_DO_CLIP) {
- if(cumap->curr.xmin-fx < cumap->clipr.xmin)
+ if (cumap->flag & CUMA_DO_CLIP) {
+ if (cumap->curr.xmin-fx < cumap->clipr.xmin)
fx= cumap->curr.xmin - cumap->clipr.xmin;
- else if(cumap->curr.xmax-fx > cumap->clipr.xmax)
+ else if (cumap->curr.xmax-fx > cumap->clipr.xmax)
fx= cumap->curr.xmax - cumap->clipr.xmax;
- if(cumap->curr.ymin-fy < cumap->clipr.ymin)
+ if (cumap->curr.ymin-fy < cumap->clipr.ymin)
fy= cumap->curr.ymin - cumap->clipr.ymin;
- else if(cumap->curr.ymax-fy > cumap->clipr.ymax)
+ else if (cumap->curr.ymax-fy > cumap->clipr.ymax)
fy= cumap->curr.ymax - cumap->clipr.ymax;
}
@@ -3654,8 +3660,8 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
CurveMapping *cumap= (CurveMapping*)but->poin;
CurveMap *cuma= cumap->cm+cumap->cur;
CurveMapPoint *cmp;
@@ -3668,7 +3674,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
offsx= cumap->curr.xmin;
offsy= cumap->curr.ymin;
- if(event->ctrl) {
+ if (event->ctrl) {
fx= ((float)my - but->x1)/zoomx + offsx;
fy= ((float)my - but->y1)/zoomy + offsy;
@@ -3679,11 +3685,11 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
/* check for selecting of a point */
cmp= cuma->curve; /* ctrl adds point, new malloc */
- for(a=0; a<cuma->totpoint; a++) {
+ for (a=0; a<cuma->totpoint; a++) {
fx= but->x1 + zoomx*(cmp[a].x-offsx);
fy= but->y1 + zoomy*(cmp[a].y-offsy);
dist= (fx-mx)*(fx-mx) + (fy-my)*(fy-my);
- if(dist < mindist) {
+ if (dist < mindist) {
sel= a;
mindist= dist;
}
@@ -3701,7 +3707,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
/* loop through the curve segment table and find what's near the mouse.
* 0.05 is kinda arbitrary, but seems to be what works nicely. */
- for(i=0; i<=CM_TABLE; i++) {
+ for (i=0; i<=CM_TABLE; i++) {
if ( (fabsf(fx - cmp[i].x) < 0.05f) &&
(fabsf(fy - cmp[i].y) < 0.05f))
{
@@ -3715,8 +3721,8 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
cmp= cuma->curve;
/* find newly added point and make it 'sel' */
- for(a=0; a<cuma->totpoint; a++)
- if(cmp[a].x == fx)
+ for (a=0; a<cuma->totpoint; a++)
+ if (cmp[a].x == fx)
sel = a;
break;
@@ -3724,11 +3730,11 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
}
}
- if(sel!= -1) {
+ if (sel!= -1) {
/* ok, we move a point */
/* deselect all if this one is deselect. except if we hold shift */
- if(event->shift == FALSE) {
- for(a=0; a<cuma->totpoint; a++)
+ if (event->shift == FALSE) {
+ for (a=0; a<cuma->totpoint; a++)
cmp[a].flag &= ~SELECT;
cmp[sel].flag |= SELECT;
}
@@ -3751,23 +3757,23 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_CURVE(but, data, event->ctrl, mx, my))
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_CURVE(but, data, event->ctrl, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
- if(data->dragsel != -1) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ if (data->dragsel != -1) {
CurveMapping *cumap= (CurveMapping*)but->poin;
CurveMap *cuma= cumap->cm+cumap->cur;
CurveMapPoint *cmp= cuma->curve;
- if(!data->dragchange) {
+ if (!data->dragchange) {
/* deselect all, select one */
- if(event->shift == FALSE) {
- for(a=0; a<cuma->totpoint; a++)
+ if (event->shift == FALSE) {
+ for (a=0; a<cuma->totpoint; a++)
cmp[a].flag &= ~SELECT;
cmp[data->dragsel].flag |= SELECT;
}
@@ -3801,8 +3807,8 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
int changed= 1;
float /* dx, */ dy, yfac=1.f; /* UNUSED */
- /* rect.xmin= but->x1; rect.xmax= but->x2; */
- /* rect.ymin= but->y1; rect.ymax= but->y2; */
+ /* rect.xmin = but->x1; rect.xmax = but->x2; */
+ /* rect.ymin = but->y1; rect.ymax = but->y2; */
/* dx = mx - data->draglastx; */ /* UNUSED */
dy = my - data->draglasty;
@@ -3811,7 +3817,8 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize histogram widget itself */
hist->height = (but->y2 - but->y1) + (data->dragstarty - my);
- } else {
+ }
+ else {
/* scale histogram values */
yfac = MIN2(powf(hist->ymax, 2.f), 1.f) * 0.5f;
hist->ymax += dy * yfac;
@@ -3833,8 +3840,8 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -3842,13 +3849,13 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_HISTOGRAM(but, data, mx, my))
+ if (ui_numedit_but_HISTOGRAM(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
}
/* XXX hardcoded keymap check.... */
- else if (event->type == DELKEY && event->val == KM_PRESS) {
+ else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
Histogram *hist = (Histogram *)but->poin;
hist->ymax = 1.f;
@@ -3856,19 +3863,19 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_HISTOGRAM(but, data, mx, my))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_HISTOGRAM(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
return WM_UI_HANDLER_BREAK;
@@ -3884,8 +3891,8 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
int changed= 1;
float /* dx, */ dy /* , yfac=1.f */; /* UNUSED */
- /* rect.xmin= but->x1; rect.xmax= but->x2; */
- /* rect.ymin= but->y1; rect.ymax= but->y2; */
+ /* rect.xmin = but->x1; rect.xmax = but->x2; */
+ /* rect.ymin = but->y1; rect.ymax = but->y2; */
/* dx = mx - data->draglastx; */ /* UNUSED */
dy = my - data->draglasty;
@@ -3894,7 +3901,8 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize waveform widget itself */
scopes->wavefrm_height = (but->y2 - but->y1) + (data->dragstarty - my);
- } else {
+ }
+ else {
/* scale waveform values */
/* yfac = scopes->wavefrm_yfac; */ /* UNUSED */
scopes->wavefrm_yfac += dy/200.0f;
@@ -3916,8 +3924,8 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -3925,13 +3933,13 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_WAVEFORM(but, data, mx, my))
+ if (ui_numedit_but_WAVEFORM(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
}
/* XXX hardcoded keymap check.... */
- else if (event->type == DELKEY && event->val == KM_PRESS) {
+ else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
Scopes *scopes = (Scopes *)but->poin;
scopes->wavefrm_yfac = 1.f;
@@ -3939,19 +3947,19 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_WAVEFORM(but, data, mx, my))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_WAVEFORM(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
return WM_UI_HANDLER_BREAK;
@@ -3967,8 +3975,8 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int
int changed= 1;
/* float dx, dy; */
- /* rect.xmin= but->x1; rect.xmax= but->x2; */
- /* rect.ymin= but->y1; rect.ymax= but->y2; */
+ /* rect.xmin = but->x1; rect.xmax = but->x2; */
+ /* rect.ymin = but->y1; rect.ymax = but->y2; */
/* dx = mx - data->draglastx; */
/* dy = my - data->draglasty; */
@@ -3992,8 +4000,8 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -4001,25 +4009,25 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_VECTORSCOPE(but, data, mx, my))
+ if (ui_numedit_but_VECTORSCOPE(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_VECTORSCOPE(but, data, mx, my))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_VECTORSCOPE(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
return WM_UI_HANDLER_BREAK;
@@ -4042,8 +4050,8 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
/* Calculate the size of the button */
width = abs(but->x2 - but->x1);
height = abs(but->y2 - but->y1);
@@ -4065,30 +4073,30 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
che = cs + (y*12) + x;
- if(che > G.charmax)
+ if (che > G.charmax)
che = 0;
- if(G.obedit) {
+ if (G.obedit) {
do_textedit(0,0,che);
}
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, WHEELUPMOUSE, PAGEUPKEY)) {
- for(but= block->buttons.first; but; but= but->next) {
- if(but->type == CHARTAB) {
+ else if (ELEM(event->type, WHEELUPMOUSE, PAGEUPKEY)) {
+ for (but= block->buttons.first; but; but= but->next) {
+ if (but->type == CHARTAB) {
G.charstart = G.charstart - (12*6);
- if(G.charstart < 0)
+ if (G.charstart < 0)
G.charstart = 0;
- if(G.charstart < G.charmin)
+ if (G.charstart < G.charmin)
G.charstart = G.charmin;
ui_draw_but(but);
//Really nasty... to update the num button from the same butblock
- for(bt= block->buttons.first; bt; bt= bt->next)
+ for (bt= block->buttons.first; bt; bt= bt->next)
{
- if(ELEM(bt->type, NUM, NUMABS)) {
+ if (ELEM(bt->type, NUM, NUMABS)) {
ui_check_but(bt);
ui_draw_but(bt);
}
@@ -4100,19 +4108,19 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
return WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, WHEELDOWNMOUSE, PAGEDOWNKEY)) {
- for(but= block->buttons.first; but; but= but->next) {
- if(but->type == CHARTAB) {
+ else if (ELEM(event->type, WHEELDOWNMOUSE, PAGEDOWNKEY)) {
+ for (but= block->buttons.first; but; but= but->next) {
+ if (but->type == CHARTAB) {
G.charstart = G.charstart + (12*6);
- if(G.charstart > (0xffff - 12*6))
+ if (G.charstart > (0xffff - 12*6))
G.charstart = 0xffff - (12*6);
- if(G.charstart > G.charmax - 12*6)
+ if (G.charstart > G.charmax - 12*6)
G.charstart = G.charmax - 12*6;
ui_draw_but(but);
- for(bt= block->buttons.first; bt; bt= bt->next)
+ for (bt= block->buttons.first; bt; bt= bt->next)
{
- if(ELEM(bt->type, NUM, NUMABS)) {
+ if (ELEM(bt->type, NUM, NUMABS)) {
ui_check_but(bt);
ui_draw_but(bt);
}
@@ -4138,20 +4146,20 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
{
VECCOPY2D(but->linkto, event->mval);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type == LEFTMOUSE && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
return WM_UI_HANDLER_BREAK;
}
- else if(event->type == LEFTMOUSE && but->block->handle) {
+ else if (event->type == LEFTMOUSE && but->block->handle) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
+ else if (data->state == BUTTON_STATE_WAIT_RELEASE) {
- if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
- if(!(but->flag & UI_SELECT))
+ if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if (!(but->flag & UI_SELECT))
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
@@ -4170,7 +4178,7 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
dx = mx - data->draglastx;
dy = my - data->draglasty;
- if(shift) {
+ if (shift) {
dx /= 5.0f;
dy /= 5.0f;
}
@@ -4178,9 +4186,10 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize preview widget itself */
scopes->track_preview_height = (but->y2 - but->y1) + (data->dragstarty - my);
- } else {
- if(scopes->marker) {
- if(scopes->marker->framenr!=scopes->framenr)
+ }
+ else {
+ if (scopes->marker) {
+ if (scopes->marker->framenr!=scopes->framenr)
scopes->marker= BKE_tracking_ensure_marker(scopes->track, scopes->framenr);
scopes->marker->flag&= ~(MARKER_DISABLED|MARKER_TRACKED);
@@ -4207,8 +4216,8 @@ static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHan
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -4216,25 +4225,25 @@ static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHan
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
+ if (ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
return WM_UI_HANDLER_BREAK;
@@ -4253,7 +4262,7 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
/* complex code to change name of button */
- if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
+ if (WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
shortcut_str, sizeof(shortcut_str)))
{
ui_but_add_shortcut(but, shortcut_str, TRUE);
@@ -4316,7 +4325,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
kmi_id = kmi->id;
/* copy properties, prop can be NULL for reset */
- if(prop)
+ if (prop)
prop= IDP_CopyProperty(prop);
WM_keymap_properties_reset(kmi, prop);
@@ -4379,12 +4388,12 @@ static int ui_but_menu(bContext *C, uiBut *but)
int length;
const char *name;
- if((but->rnapoin.data && but->rnaprop)==0 && but->optype==NULL)
+ if ((but->rnapoin.data && but->rnaprop)==0 && but->optype==NULL)
return 0;
button_timers_tooltip_remove(C, but);
- if(but->rnaprop)
+ if (but->rnaprop)
name= RNA_property_ui_name(but->rnaprop);
else if (but->optype)
name= but->optype->name;
@@ -4396,19 +4405,19 @@ static int ui_but_menu(bContext *C, uiBut *but)
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
- if(but->rnapoin.data && but->rnaprop) {
+ if (but->rnapoin.data && but->rnaprop) {
short is_anim= RNA_property_animateable(&but->rnapoin, but->rnaprop);
/* second slower test, saved people finding keyframe items in menus when its not possible */
- if(is_anim)
+ if (is_anim)
is_anim= RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);
length= RNA_property_array_length(&but->rnapoin, but->rnaprop);
/* Keyframes */
- if(but->flag & UI_BUT_ANIMATED_KEY) {
+ if (but->flag & UI_BUT_ANIMATED_KEY) {
/* replace/delete keyfraemes */
- if(length) {
+ if (length) {
uiItemBooleanO(layout, "Replace Keyframes", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
uiItemBooleanO(layout, "Replace Single Keyframe", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
uiItemBooleanO(layout, "Delete Keyframes", ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 1);
@@ -4424,9 +4433,9 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
- else if(but->flag & UI_BUT_DRIVEN);
- else if(is_anim) {
- if(length) {
+ else if (but->flag & UI_BUT_DRIVEN);
+ else if (is_anim) {
+ if (length) {
uiItemBooleanO(layout, "Insert Keyframes", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
uiItemBooleanO(layout, "Insert Single Keyframe", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
}
@@ -4435,10 +4444,10 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
/* Drivers */
- if(but->flag & UI_BUT_DRIVEN) {
+ if (but->flag & UI_BUT_DRIVEN) {
uiItemS(layout);
- if(length) {
+ if (length) {
uiItemBooleanO(layout, "Delete Drivers", ICON_NONE, "ANIM_OT_driver_button_remove", "all", 1);
uiItemBooleanO(layout, "Delete Single Driver", ICON_NONE, "ANIM_OT_driver_button_remove", "all", 0);
}
@@ -4449,11 +4458,11 @@ static int ui_but_menu(bContext *C, uiBut *but)
if (ANIM_driver_can_paste())
uiItemO(layout, "Paste Driver", ICON_NONE, "ANIM_OT_paste_driver_button");
}
- else if(but->flag & (UI_BUT_ANIMATED_KEY|UI_BUT_ANIMATED));
- else if(is_anim) {
+ else if (but->flag & (UI_BUT_ANIMATED_KEY|UI_BUT_ANIMATED));
+ else if (is_anim) {
uiItemS(layout);
- if(length) {
+ if (length) {
uiItemBooleanO(layout, "Add Drivers", ICON_NONE, "ANIM_OT_driver_button_add", "all", 1);
uiItemBooleanO(layout, "Add Single Driver", ICON_NONE, "ANIM_OT_driver_button_add", "all", 0);
}
@@ -4466,10 +4475,10 @@ static int ui_but_menu(bContext *C, uiBut *but)
/* Keying Sets */
// TODO: check on modifyability of Keying Set when doing this
- if(is_anim) {
+ if (is_anim) {
uiItemS(layout);
- if(length) {
+ if (length) {
uiItemBooleanO(layout, "Add All to Keying Set", ICON_NONE, "ANIM_OT_keyingset_button_add", "all", 1);
uiItemBooleanO(layout, "Add Single to Keying Set", ICON_NONE, "ANIM_OT_keyingset_button_add", "all", 0);
uiItemO(layout, "Remove from Keying Set", ICON_NONE, "ANIM_OT_keyingset_button_remove");
@@ -4487,7 +4496,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
//Copy Property Value
//Paste Property Value
- if(length) {
+ if (length) {
uiItemBooleanO(layout, "Reset All to Default Values", ICON_NONE, "UI_OT_reset_default_button", "all", 1);
uiItemBooleanO(layout, "Reset Single to Default Value", ICON_NONE, "UI_OT_reset_default_button", "all", 0);
}
@@ -4501,17 +4510,17 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
/* Operator buttons */
- if(but->optype) {
+ if (but->optype) {
uiBlock *block = uiLayoutGetBlock(layout);
uiBut *but2;
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
int w = uiLayoutGetWidth(layout);
wmKeyMap *km;
- wmKeyMapItem *kmi= NULL;
+ wmKeyMapItem *kmi = NULL;
int kmi_id= WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
if (kmi_id)
- kmi= WM_keymap_item_find_id(km, kmi_id);
+ kmi = WM_keymap_item_find_id(km, kmi_id);
/* keyboard shortcuts */
if ((kmi) && ISKEYBOARD(kmi->type)) {
@@ -4539,7 +4548,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
char buf[512];
PointerRNA ptr_props;
- if(but->rnapoin.data && but->rnaprop) {
+ if (but->rnapoin.data && but->rnaprop) {
BLI_snprintf(buf, sizeof(buf), "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
WM_operator_properties_create(&ptr_props, "WM_OT_doc_view");
@@ -4588,27 +4597,27 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
data= but->active;
retval= WM_UI_HANDLER_CONTINUE;
- if(but->flag & UI_BUT_DISABLED)
+ if (but->flag & UI_BUT_DISABLED)
return WM_UI_HANDLER_CONTINUE;
- if( (data->state == BUTTON_STATE_HIGHLIGHT) &&
+ if ( (data->state == BUTTON_STATE_HIGHLIGHT) &&
/* check prevval because of modal operators [#24016],
* modifier check is to allow Ctrl+C for copy.
* if this causes other problems, remove this check and suffer the bug :) - campbell */
((event->prevval != KM_PRESS) || (ISKEYMODIFIER(event->prevtype)) || (event->type == EVT_DROP))
) {
/* handle copy-paste */
- if(ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) {
+ if (ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) {
ui_but_copy_paste(C, but, data, (event->type == CKEY)? 'c': 'v');
return WM_UI_HANDLER_BREAK;
}
/* handle drop */
- else if(event->type == EVT_DROP) {
+ else if (event->type == EVT_DROP) {
ui_but_drop (C, event, but, data);
}
/* handle keyframing */
- else if(event->type == IKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
- if(event->alt)
+ else if (event->type == IKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
+ if (event->alt)
ui_but_anim_delete_keyframe(C);
else
ui_but_anim_insert_keyframe(C);
@@ -4618,8 +4627,8 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
return WM_UI_HANDLER_BREAK;
}
/* handle drivers */
- else if(event->type == DKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
- if(event->alt)
+ else if (event->type == DKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
+ if (event->alt)
ui_but_anim_remove_driver(C);
else
ui_but_anim_add_driver(C);
@@ -4629,8 +4638,8 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
return WM_UI_HANDLER_BREAK;
}
/* handle keyingsets */
- else if(event->type == KKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
- if(event->alt)
+ else if (event->type == KKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
+ if (event->alt)
ui_but_anim_remove_keyingset(C);
else
ui_but_anim_add_keyingset(C);
@@ -4641,13 +4650,13 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
}
/* reset to default */
/* XXX hardcoded keymap check.... */
- else if(event->type == BACKSPACEKEY && event->val == KM_PRESS) {
+ else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
/* ctrl+backspace = reset active button; backspace = reset a whole array*/
if (!(ELEM3(but->type, HSVCIRCLE, HSVCUBE, HISTOGRAM)))
ui_set_but_default(C, !event->ctrl);
}
/* handle menu */
- else if(event->type == RIGHTMOUSE && event->val == KM_PRESS) {
+ else if (event->type == RIGHTMOUSE && event->val == KM_PRESS) {
/* RMB has two options now */
if (ui_but_menu(C, but)) {
return WM_UI_HANDLER_BREAK;
@@ -4656,16 +4665,16 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
}
/* verify if we can edit this button */
- if(ELEM(event->type, LEFTMOUSE, RETKEY)) {
+ if (ELEM(event->type, LEFTMOUSE, RETKEY)) {
/* this should become disabled button .. */
- if(but->lock) {
- if(but->lockstr) {
+ if (but->lock) {
+ if (but->lockstr) {
BKE_report(NULL, RPT_WARNING, but->lockstr);
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
}
- else if(but->pointype && but->poin==NULL) {
+ else if (but->pointype && but->poin==NULL) {
/* there's a pointer needed */
BKE_reportf(NULL, RPT_WARNING, "DoButton pointer error: %s", but->str);
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -4741,7 +4750,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
retval= ui_do_but_BUT(C, but, data, event);
break;
case COL:
- if(but->a1 == UI_GRAD_V_ALT) // signal to prevent calling up color picker
+ if (but->a1 == UI_GRAD_V_ALT) // signal to prevent calling up color picker
retval= ui_do_but_EXIT(C, but, data, event);
else
retval= ui_do_but_BLOCK(C, but, data, event);
@@ -4791,9 +4800,9 @@ static uiBut *ui_but_find_activated(ARegion *ar)
uiBlock *block;
uiBut *but;
- for(block=ar->uiblocks.first; block; block=block->next)
- for(but=block->buttons.first; but; but= but->next)
- if(but->active)
+ for (block=ar->uiblocks.first; block; block=block->next)
+ for (but=block->buttons.first; but; but= but->next)
+ if (but->active)
return but;
return NULL;
@@ -4809,15 +4818,15 @@ void uiFreeActiveButtons(const bContext *C, bScreen *screen)
{
ScrArea *sa= screen->areabase.first;
- for(;sa; sa= sa->next) {
+ for (;sa; sa= sa->next) {
ARegion *ar= sa->regionbase.first;
- for(;ar; ar= ar->next) {
+ for (;ar; ar= ar->next) {
uiBut *but= ui_but_find_activated(ar);
- if(but) {
+ if (but) {
uiHandleButtonData *data= but->active;
- if(data->menu==NULL && data->searchbox==NULL)
- if(data->state == BUTTON_STATE_HIGHLIGHT)
+ if (data->menu==NULL && data->searchbox==NULL)
+ if (data->state == BUTTON_STATE_HIGHLIGHT)
ui_button_active_free(C, but);
}
}
@@ -4833,8 +4842,8 @@ int UI_but_active_drop_name(bContext *C)
ARegion *ar= CTX_wm_region(C);
uiBut *but= ui_but_find_activated(ar);
- if(but) {
- if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU))
+ if (but) {
+ if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU))
return 1;
}
@@ -4845,12 +4854,12 @@ static void ui_blocks_set_tooltips(ARegion *ar, int enable)
{
uiBlock *block;
- if(!ar)
+ if (!ar)
return;
/* we disabled buttons when when they were already shown, and
* re-enable them on mouse move */
- for(block=ar->uiblocks.first; block; block=block->next)
+ for (block=ar->uiblocks.first; block; block=block->next)
block->tooltipdisabled= !enable;
}
@@ -4859,8 +4868,8 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
uiBlock *block;
/* check if the mouse is in the region */
- if(!BLI_in_rcti(&ar->winrct, x, y)) {
- for(block=ar->uiblocks.first; block; block=block->next)
+ if (!BLI_in_rcti(&ar->winrct, x, y)) {
+ for (block=ar->uiblocks.first; block; block=block->next)
block->auto_open= FALSE;
return 0;
@@ -4871,7 +4880,7 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
* even when they are not visible, so we need to make a copy of the mask to
* use to check
*/
- if(ar->v2d.mask.xmin!=ar->v2d.mask.xmax) {
+ if (ar->v2d.mask.xmin!=ar->v2d.mask.xmax) {
View2D *v2d= &ar->v2d;
rcti mask_rct;
int mx, my;
@@ -4882,26 +4891,26 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
ui_window_to_region(ar, &mx, &my);
/* make a copy of the mask rect, and tweak accordingly for hidden scrollbars */
- mask_rct.xmin= v2d->mask.xmin;
- mask_rct.xmax= v2d->mask.xmax;
- mask_rct.ymin= v2d->mask.ymin;
- mask_rct.ymax= v2d->mask.ymax;
+ mask_rct.xmin = v2d->mask.xmin;
+ mask_rct.xmax = v2d->mask.xmax;
+ mask_rct.ymin = v2d->mask.ymin;
+ mask_rct.ymax = v2d->mask.ymax;
if (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE|V2D_SCROLL_VERTICAL_FULLR)) {
if (v2d->scroll & V2D_SCROLL_LEFT)
- mask_rct.xmin= v2d->vert.xmin;
+ mask_rct.xmin = v2d->vert.xmin;
else if (v2d->scroll & V2D_SCROLL_RIGHT)
- mask_rct.xmax= v2d->vert.xmax;
+ mask_rct.xmax = v2d->vert.xmax;
}
if (v2d->scroll & (V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_HORIZONTAL_FULLR)) {
if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O))
- mask_rct.ymin= v2d->hor.ymin;
+ mask_rct.ymin = v2d->hor.ymin;
else if (v2d->scroll & V2D_SCROLL_TOP)
- mask_rct.ymax= v2d->hor.ymax;
+ mask_rct.ymax = v2d->hor.ymax;
}
/* check if in the rect */
- if(!BLI_in_rcti(&mask_rct, mx, my))
+ if (!BLI_in_rcti(&mask_rct, mx, my))
return 0;
}
@@ -4910,12 +4919,12 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
{
- if(!ui_mouse_inside_region(ar, x, y))
+ if (!ui_mouse_inside_region(ar, x, y))
return 0;
ui_window_to_block(ar, but->block, &x, &y);
- if(!ui_but_contains_pt(but, x, y))
+ if (!ui_but_contains_pt(but, x, y))
return 0;
return 1;
@@ -4927,34 +4936,34 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
uiBut *but, *butover= NULL;
int mx, my;
-// if(!win->active)
+// if (!win->active)
// return NULL;
- if(!ui_mouse_inside_region(ar, x, y))
+ if (!ui_mouse_inside_region(ar, x, y))
return NULL;
- for(block=ar->uiblocks.first; block; block=block->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
mx= x;
my= y;
ui_window_to_block(ar, block, &mx, &my);
- for(but=block->buttons.first; but; but= but->next) {
+ for (but=block->buttons.first; but; but= but->next) {
/* note, LABEL is included for hilights, this allows drags */
- if(but->type==LABEL && but->dragpoin==NULL)
+ if (but->type==LABEL && but->dragpoin==NULL)
continue;
- if(ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX))
+ if (ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX))
continue;
- if(but->flag & UI_HIDDEN)
+ if (but->flag & UI_HIDDEN)
continue;
- if(but->flag & UI_SCROLLED)
+ if (but->flag & UI_SCROLLED)
continue;
- if(ui_but_contains_pt(but, mx, my))
+ if (ui_but_contains_pt(but, mx, my))
butover= but;
}
/* CLIP_EVENTS prevents the event from reaching other blocks */
if (block->flag & UI_BLOCK_CLIP_EVENTS) {
/* check if mouse is inside block */
- if(block->minx <= mx && block->maxx >= mx &&
+ if (block->minx <= mx && block->maxx >= mx &&
block->miny <= my && block->maxy >= my)
break;
}
@@ -4969,18 +4978,18 @@ static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y)
uiBut *but;
int mx, my;
-// if(!win->active)
+// if (!win->active)
// return NULL;
- if(!ui_mouse_inside_region(ar, x, y))
+ if (!ui_mouse_inside_region(ar, x, y))
return NULL;
- for(block=ar->uiblocks.first; block; block=block->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
mx= x;
my= y;
ui_window_to_block(ar, block, &mx, &my);
- for(but=block->buttons.last; but; but= but->prev)
- if(but->type == LISTBOX && ui_but_contains_pt(but, mx, my))
+ for (but=block->buttons.last; but; but= but->prev)
+ if (but->type == LISTBOX && ui_but_contains_pt(but, mx, my))
return but;
}
@@ -5001,18 +5010,18 @@ static void button_timers_tooltip_remove(bContext *C, uiBut *but)
uiHandleButtonData *data;
data= but->active;
- if(data) {
+ if (data) {
- if(data->tooltiptimer) {
+ if (data->tooltiptimer) {
WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
data->tooltiptimer= NULL;
}
- if(data->tooltip) {
+ if (data->tooltip) {
ui_tooltip_free(C, data->tooltip);
data->tooltip= NULL;
}
- if(data->autoopentimer) {
+ if (data->autoopentimer) {
WM_event_remove_timer(data->wm, data->window, data->autoopentimer);
data->autoopentimer= NULL;
}
@@ -5026,14 +5035,14 @@ static void button_tooltip_timer_reset(bContext *C, uiBut *but)
data= but->active;
- if(data->tooltiptimer) {
+ if (data->tooltiptimer) {
WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
data->tooltiptimer= NULL;
}
- if(U.flag & USER_TOOLTIPS)
- if(!but->block->tooltipdisabled)
- if(!wm->drags.first)
+ if (U.flag & USER_TOOLTIPS)
+ if (!but->block->tooltipdisabled)
+ if (!wm->drags.first)
data->tooltiptimer= WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_TOOLTIP_DELAY);
}
@@ -5042,26 +5051,26 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
uiHandleButtonData *data;
data= but->active;
- if(data->state == state)
+ if (data->state == state)
return;
/* highlight has timers for tooltips and auto open */
- if(state == BUTTON_STATE_HIGHLIGHT) {
+ if (state == BUTTON_STATE_HIGHLIGHT) {
but->flag &= ~UI_SELECT;
button_tooltip_timer_reset(C, but);
/* automatic open pulldown block timer */
- if(ELEM3(but->type, BLOCK, PULLDOWN, ICONTEXTROW)) {
- if(data->used_mouse && !data->autoopentimer) {
+ if (ELEM3(but->type, BLOCK, PULLDOWN, ICONTEXTROW)) {
+ if (data->used_mouse && !data->autoopentimer) {
int time;
- if(but->block->auto_open==TRUE) time= 1; // test for toolbox
- else if((but->block->flag & UI_BLOCK_LOOP && but->type != BLOCK) || but->block->auto_open==TRUE) time= 5*U.menuthreshold2;
- else if(U.uiflag & USER_MENUOPENAUTO) time= 5*U.menuthreshold1;
+ if (but->block->auto_open==TRUE) time= 1; // test for toolbox
+ else if ((but->block->flag & UI_BLOCK_LOOP && but->type != BLOCK) || but->block->auto_open==TRUE) time= 5*U.menuthreshold2;
+ else if (U.uiflag & USER_MENUOPENAUTO) time= 5*U.menuthreshold1;
else time= -1;
- if(time >= 0)
+ if (time >= 0)
data->autoopentimer= WM_event_add_timer(data->wm, data->window, TIMER, 0.02*(double)time);
}
}
@@ -5072,65 +5081,66 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
}
/* text editing */
- if(state == BUTTON_STATE_TEXT_EDITING && data->state != BUTTON_STATE_TEXT_SELECTING)
+ if (state == BUTTON_STATE_TEXT_EDITING && data->state != BUTTON_STATE_TEXT_SELECTING)
ui_textedit_begin(C, but, data);
- else if(data->state == BUTTON_STATE_TEXT_EDITING && state != BUTTON_STATE_TEXT_SELECTING)
+ else if (data->state == BUTTON_STATE_TEXT_EDITING && state != BUTTON_STATE_TEXT_SELECTING)
ui_textedit_end(C, but, data);
- else if(data->state == BUTTON_STATE_TEXT_SELECTING && state != BUTTON_STATE_TEXT_EDITING)
+ else if (data->state == BUTTON_STATE_TEXT_SELECTING && state != BUTTON_STATE_TEXT_EDITING)
ui_textedit_end(C, but, data);
/* number editing */
- if(state == BUTTON_STATE_NUM_EDITING) {
- if(ui_is_a_warp_but(but))
+ if (state == BUTTON_STATE_NUM_EDITING) {
+ if (ui_is_a_warp_but(but))
WM_cursor_grab(CTX_wm_window(C), TRUE, TRUE, NULL);
ui_numedit_begin(but, data);
- } else if(data->state == BUTTON_STATE_NUM_EDITING) {
+ }
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
ui_numedit_end(but, data);
- if(ui_is_a_warp_but(but))
+ if (ui_is_a_warp_but(but))
WM_cursor_ungrab(CTX_wm_window(C));
}
/* menu open */
- if(state == BUTTON_STATE_MENU_OPEN)
+ if (state == BUTTON_STATE_MENU_OPEN)
ui_blockopen_begin(C, but, data);
- else if(data->state == BUTTON_STATE_MENU_OPEN)
+ else if (data->state == BUTTON_STATE_MENU_OPEN)
ui_blockopen_end(C, but, data);
/* add a short delay before exiting, to ensure there is some feedback */
- if(state == BUTTON_STATE_WAIT_FLASH) {
+ if (state == BUTTON_STATE_WAIT_FLASH) {
data->flashtimer= WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_FLASH_DELAY);
}
- else if(data->flashtimer) {
+ else if (data->flashtimer) {
WM_event_remove_timer(data->wm, data->window, data->flashtimer);
data->flashtimer= NULL;
}
/* add a blocking ui handler at the window handler for blocking, modal states
* but not for popups, because we already have a window level handler*/
- if(!(but->block->handle && but->block->handle->popup)) {
- if(button_modal_state(state)) {
- if(!button_modal_state(data->state))
+ if (!(but->block->handle && but->block->handle->popup)) {
+ if (button_modal_state(state)) {
+ if (!button_modal_state(data->state))
WM_event_add_ui_handler(C, &data->window->modalhandlers, ui_handler_region_menu, NULL, data);
}
else {
- if(button_modal_state(data->state))
+ if (button_modal_state(data->state))
WM_event_remove_ui_handler(&data->window->modalhandlers, ui_handler_region_menu, NULL, data, 1); /* 1 = postpone free */
}
}
/* wait for mousemove to enable drag */
- if(state == BUTTON_STATE_WAIT_DRAG) {
+ if (state == BUTTON_STATE_WAIT_DRAG) {
but->flag &= ~UI_SELECT;
}
data->state= state;
- if(state != BUTTON_STATE_EXIT) {
+ if (state != BUTTON_STATE_EXIT) {
/* When objects for eg. are removed, running ui_check_but() can access
* the removed data - so disable update on exit. Also in case of
* highlight when not in a popup menu, we remove because data used in
* button below popup might have been removed by action of popup. Needs
* a more reliable solution... */
- if(state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
+ if (state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
ui_check_but(but);
}
@@ -5147,7 +5157,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
data->wm= CTX_wm_manager(C);
data->window= CTX_wm_window(C);
data->region= ar;
- if( ELEM(but->type, BUT_CURVE, SEARCH_MENU) ); // XXX curve is temp
+ if ( ELEM(but->type, BUT_CURVE, SEARCH_MENU) ); // XXX curve is temp
else data->interactive= 1;
data->state = BUTTON_STATE_INIT;
@@ -5159,42 +5169,42 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
/* we disable auto_open in the block after a threshold, because we still
* want to allow auto opening adjacent menus even if no button is activated
* in between going over to the other button, but only for a short while */
- if(type == BUTTON_ACTIVATE_OVER && but->block->auto_open==TRUE)
- if(but->block->auto_open_last+BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer())
+ if (type == BUTTON_ACTIVATE_OVER && but->block->auto_open==TRUE)
+ if (but->block->auto_open_last+BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer())
but->block->auto_open= FALSE;
- if(type == BUTTON_ACTIVATE_OVER) {
+ if (type == BUTTON_ACTIVATE_OVER) {
data->used_mouse= 1;
}
button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
/* activate right away */
- if(but->flag & UI_BUT_IMMEDIATE) {
- if(but->type==HOTKEYEVT)
+ if (but->flag & UI_BUT_IMMEDIATE) {
+ if (but->type==HOTKEYEVT)
button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
/* .. more to be added here */
}
- if(type == BUTTON_ACTIVATE_OPEN) {
+ if (type == BUTTON_ACTIVATE_OPEN) {
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
/* activate first button in submenu */
- if(data->menu && data->menu->region) {
+ if (data->menu && data->menu->region) {
ARegion *subar= data->menu->region;
uiBlock *subblock= subar->uiblocks.first;
uiBut *subbut;
- if(subblock) {
+ if (subblock) {
subbut= ui_but_first(subblock);
- if(subbut)
+ if (subbut)
ui_handle_button_activate(C, subar, subbut, BUTTON_ACTIVATE);
}
}
}
- else if(type == BUTTON_ACTIVATE_TEXT_EDITING)
+ else if (type == BUTTON_ACTIVATE_TEXT_EDITING)
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
- else if(type == BUTTON_ACTIVATE_APPLY)
+ else if (type == BUTTON_ACTIVATE_APPLY)
button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
}
@@ -5204,18 +5214,18 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
uiBut *bt;
/* ensure we are in the exit state */
- if(data->state != BUTTON_STATE_EXIT)
+ if (data->state != BUTTON_STATE_EXIT)
button_activate_state(C, but, BUTTON_STATE_EXIT);
/* apply the button action or value */
- if(!onfree)
+ if (!onfree)
ui_apply_button(C, block, but, data, 0);
/* if this button is in a menu, this will set the button return
* value to the button value and the menu return value to ok, the
* menu return value will be picked up and the menu will close */
- if(block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN)) {
- if(!data->cancel || data->escapecancel) {
+ if (block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN)) {
+ if (!data->cancel || data->escapecancel) {
uiPopupBlockHandle *menu;
menu= block->handle;
@@ -5224,18 +5234,18 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
}
}
- if(!onfree && !data->cancel) {
+ if (!onfree && !data->cancel) {
/* autokey & undo push */
ui_apply_autokey_undo(C, but);
/* popup menu memory */
- if(block->flag & UI_BLOCK_POPUP_MEMORY)
+ if (block->flag & UI_BLOCK_POPUP_MEMORY)
ui_popup_menu_memory(block, but);
}
/* disable tooltips until mousemove + last active flag */
- for(block=data->region->uiblocks.first; block; block=block->next) {
- for(bt=block->buttons.first; bt; bt=bt->next)
+ for (block=data->region->uiblocks.first; block; block=block->next) {
+ for (bt=block->buttons.first; bt; bt=bt->next)
bt->flag &= ~UI_BUT_LAST_ACTIVE;
block->tooltipdisabled= 1;
@@ -5244,9 +5254,9 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
ui_blocks_set_tooltips(data->region, 0);
/* clean up */
- if(data->str)
+ if (data->str)
MEM_freeN(data->str);
- if(data->origstr)
+ if (data->origstr)
MEM_freeN(data->origstr);
/* redraw (data is but->active!) */
@@ -5257,13 +5267,13 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
but->active= NULL;
but->flag &= ~(UI_ACTIVE|UI_SELECT);
but->flag |= UI_BUT_LAST_ACTIVE;
- if(!onfree)
+ if (!onfree)
ui_check_but(but);
/* adds empty mousemove in queue for re-init handler, in case mouse is
* still over a button. we cannot just check for this ourselfs because
* at this point the mouse may be over a button in another region */
- if(mousemove)
+ if (mousemove)
WM_event_add_mousemove(C);
}
@@ -5274,7 +5284,7 @@ void ui_button_active_free(const bContext *C, uiBut *but)
/* this gets called when the button somehow disappears while it is still
* active, this is bad for user interaction, but we need to handle this
* case cleanly anyway in case it happens */
- if(but->active) {
+ if (but->active) {
data= but->active;
data->cancel= 1;
button_activate_exit((bContext*)C, data, but, 0, 1);
@@ -5288,27 +5298,27 @@ static uiBut *ui_context_button_active(const bContext *C, int (*but_check_cb)(ui
ARegion *ar= CTX_wm_region(C);
- while(ar) {
+ while (ar) {
uiBlock *block;
uiBut *but, *activebut= NULL;
/* find active button */
- for(block=ar->uiblocks.first; block; block=block->next) {
- for(but=block->buttons.first; but; but= but->next) {
- if(but->active)
+ for (block=ar->uiblocks.first; block; block=block->next) {
+ for (but=block->buttons.first; but; but= but->next) {
+ if (but->active)
activebut= but;
- else if(!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
+ else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
activebut= but;
}
}
- if(activebut && (but_check_cb == NULL || but_check_cb(activebut))) {
+ if (activebut && (but_check_cb == NULL || but_check_cb(activebut))) {
uiHandleButtonData *data= activebut->active;
but_found= activebut;
/* recurse into opened menu, like colorpicker case */
- if(data && data->menu && (ar != data->menu->region)) {
+ if (data && data->menu && (ar != data->menu->region)) {
ar = data->menu->region;
}
else {
@@ -5345,7 +5355,7 @@ void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct P
memset(ptr, 0, sizeof(*ptr));
- if(activebut && activebut->rnapoin.data) {
+ if (activebut && activebut->rnapoin.data) {
*ptr= activebut->rnapoin;
*prop= activebut->rnaprop;
*index= activebut->rnaindex;
@@ -5359,7 +5369,7 @@ void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct P
void uiContextActivePropertyHandle(bContext *C)
{
uiBut *activebut= ui_context_rna_button_active(C);
- if(activebut) {
+ if (activebut) {
/* TODO, look into a better way to handle the button change
* currently this is mainly so reset defaults works for the
* operator redo panel - campbell */
@@ -5381,7 +5391,7 @@ wmOperator *uiContextActiveOperator(const struct bContext *C)
}
/* scan active regions ui */
- for(block=ar_ctx->uiblocks.first; block; block=block->next) {
+ for (block=ar_ctx->uiblocks.first; block; block=block->next) {
if (block->ui_operator) {
return block->ui_operator;
}
@@ -5396,7 +5406,7 @@ wmOperator *uiContextActiveOperator(const struct bContext *C)
if (ar == ar_ctx) {
continue;
}
- for(block=ar->uiblocks.first; block; block=block->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
if (block->ui_operator) {
return block->ui_operator;
}
@@ -5415,26 +5425,26 @@ void uiContextAnimUpdate(const bContext *C)
uiBlock *block;
uiBut *but, *activebut;
- while(ar) {
+ while (ar) {
/* find active button */
activebut= NULL;
- for(block=ar->uiblocks.first; block; block=block->next) {
- for(but=block->buttons.first; but; but= but->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
+ for (but=block->buttons.first; but; but= but->next) {
ui_but_anim_flag(but, (scene)? scene->r.cfra: 0.0f);
ED_region_tag_redraw(ar);
- if(but->active)
+ if (but->active)
activebut= but;
- else if(!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
+ else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
activebut= but;
}
}
- if(activebut) {
+ if (activebut) {
/* always recurse into opened menu, so all buttons update (like colorpicker) */
uiHandleButtonData *data= activebut->active;
- if(data && data->menu)
+ if (data && data->menu)
ar = data->menu->region;
else
return;
@@ -5453,9 +5463,9 @@ static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event)
uiBlock *block;
uiBut *but;
- for(block=ar->uiblocks.first; block; block=block->next) {
- for(but=block->buttons.first; but; but= but->next)
- if(but==event->customdata)
+ for (block=ar->uiblocks.first; block; block=block->next) {
+ for (but=block->buttons.first; but; but= but->next)
+ if (but==event->customdata)
return but;
}
return NULL;
@@ -5465,14 +5475,14 @@ static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar)
{
uiBut *but;
- if(event->type == MOUSEMOVE) {
+ if (event->type == MOUSEMOVE) {
but= ui_but_find_mouse_over(ar, event->x, event->y);
- if(but)
+ if (but)
button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
}
- else if(event->type == EVT_BUT_OPEN) {
+ else if (event->type == EVT_BUT_OPEN) {
but= uit_but_find_open_event(ar, event);
- if(but) {
+ if (but) {
button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
ui_do_button(C, but->block, but, event);
}
@@ -5504,7 +5514,7 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu
uiHandleButtonData *data;
oldbut= ui_but_find_activated(ar);
- if(oldbut) {
+ if (oldbut) {
data= oldbut->active;
data->cancel= 1;
button_activate_exit(C, data, oldbut, 0, 0);
@@ -5530,7 +5540,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
retval= WM_UI_HANDLER_CONTINUE;
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
switch(event->type) {
case WINDEACTIVATE:
case EVT_BUT_CANCEL:
@@ -5540,15 +5550,15 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
break;
case MOUSEMOVE:
/* verify if we are still over the button, if not exit */
- if(!ui_mouse_inside_button(ar, but, event->x, event->y)) {
+ if (!ui_mouse_inside_button(ar, but, event->x, event->y)) {
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(ui_but_find_mouse_over(ar, event->x, event->y) != but) {
+ else if (ui_but_find_mouse_over(ar, event->x, event->y) != but) {
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->x!=event->prevx || event->y!=event->prevy) {
+ else if (event->x!=event->prevx || event->y!=event->prevy) {
/* re-enable tooltip on mouse move */
ui_blocks_set_tooltips(ar, 1);
button_tooltip_timer_reset(C, but);
@@ -5557,19 +5567,19 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
break;
case TIMER: {
/* handle tooltip timer */
- if(event->customdata == data->tooltiptimer) {
+ if (event->customdata == data->tooltiptimer) {
WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
data->tooltiptimer= NULL;
- if(!data->tooltip)
+ if (!data->tooltip)
data->tooltip= ui_tooltip_create(C, data->region, but);
}
/* handle menu auto open timer */
- else if(event->customdata == data->autoopentimer) {
+ else if (event->customdata == data->autoopentimer) {
WM_event_remove_timer(data->wm, data->window, data->autoopentimer);
data->autoopentimer= NULL;
- if(ui_mouse_inside_button(ar, but, event->x, event->y))
+ if (ui_mouse_inside_button(ar, but, event->x, event->y))
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
}
@@ -5579,7 +5589,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
case WHEELDOWNMOUSE:
case MIDDLEMOUSE:
/* XXX hardcoded keymap check... but anyway, while view changes, tooltips should be removed */
- if(data->tooltiptimer) {
+ if (data->tooltiptimer) {
WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
data->tooltiptimer= NULL;
}
@@ -5590,7 +5600,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
}
}
}
- else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
+ else if (data->state == BUTTON_STATE_WAIT_RELEASE) {
switch(event->type) {
case WINDEACTIVATE:
data->cancel= 1;
@@ -5598,7 +5608,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
break;
case MOUSEMOVE:
- if(ELEM(but->type,LINK, INLINK)) {
+ if (ELEM(but->type,LINK, INLINK)) {
but->flag |= UI_SELECT;
ui_do_button(C, block, but, event);
ED_region_tag_redraw(data->region);
@@ -5606,15 +5616,15 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
else {
/* deselect the button when moving the mouse away */
/* also de-activate for buttons that only show higlights */
- if(ui_mouse_inside_button(ar, but, event->x, event->y)) {
- if(!(but->flag & UI_SELECT)) {
+ if (ui_mouse_inside_button(ar, but, event->x, event->y)) {
+ if (!(but->flag & UI_SELECT)) {
but->flag |= (UI_SELECT|UI_ACTIVE);
data->cancel= 0;
ED_region_tag_redraw(data->region);
}
}
else {
- if(but->flag & UI_SELECT) {
+ if (but->flag & UI_SELECT) {
but->flag &= ~(UI_SELECT|UI_ACTIVE);
data->cancel= 1;
ED_region_tag_redraw(data->region);
@@ -5630,30 +5640,30 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
retval= WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_WAIT_FLASH) {
+ else if (data->state == BUTTON_STATE_WAIT_FLASH) {
switch(event->type) {
case TIMER: {
- if(event->customdata == data->flashtimer)
+ if (event->customdata == data->flashtimer)
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
}
retval= WM_UI_HANDLER_CONTINUE;
}
- else if(data->state == BUTTON_STATE_MENU_OPEN) {
+ else if (data->state == BUTTON_STATE_MENU_OPEN) {
/* check for exit because of mouse-over another button */
switch(event->type) {
case MOUSEMOVE:
- if(data->menu && data->menu->region)
- if(ui_mouse_inside_region(data->menu->region, event->x, event->y))
+ if (data->menu && data->menu->region)
+ if (ui_mouse_inside_region(data->menu->region, event->x, event->y))
break;
{
uiBut *bt= ui_but_find_mouse_over(ar, event->x, event->y);
- if(bt && bt->active != data) {
- if(but->type != COL) /* exception */
+ if (bt && bt->active != data) {
+ if (but->type != COL) /* exception */
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
@@ -5669,14 +5679,14 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
// retval= WM_UI_HANDLER_BREAK; XXX why ?
}
- if(data->state == BUTTON_STATE_EXIT) {
+ if (data->state == BUTTON_STATE_EXIT) {
postbut= data->postbut;
posttype= data->posttype;
button_activate_exit(C, data, but, (postbut == NULL), 0);
/* for jumping to the next button with tab while text editing */
- if(postbut)
+ if (postbut)
button_activate_init(C, ar, postbut, posttype);
}
@@ -5689,22 +5699,22 @@ static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
int retval= WM_UI_HANDLER_CONTINUE;
int value, min, max;
- if(but && (event->val == KM_PRESS)) {
+ if (but && (event->val == KM_PRESS)) {
Panel *pa= but->block->panel;
- if(ELEM(event->type, UPARROWKEY, DOWNARROWKEY) ||
+ if (ELEM(event->type, UPARROWKEY, DOWNARROWKEY) ||
((ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->alt))) {
/* activate up/down the list */
value= RNA_property_int_get(&but->rnapoin, but->rnaprop);
- if(ELEM(event->type, UPARROWKEY, WHEELUPMOUSE))
+ if (ELEM(event->type, UPARROWKEY, WHEELUPMOUSE))
value--;
else
value++;
- if(value < pa->list_scroll)
+ if (value < pa->list_scroll)
pa->list_scroll= value;
- else if(value >= pa->list_scroll+pa->list_size)
+ else if (value >= pa->list_scroll+pa->list_size)
pa->list_scroll= value - pa->list_size + 1;
RNA_property_int_range(&but->rnapoin, but->rnaprop, &min, &max);
@@ -5716,12 +5726,12 @@ static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
retval= WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->shift) {
+ else if (ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->shift) {
/* silly replacement for proper grip */
- if(pa->list_grip_size == 0)
+ if (pa->list_grip_size == 0)
pa->list_grip_size= pa->list_size;
- if(event->type == WHEELUPMOUSE)
+ if (event->type == WHEELUPMOUSE)
pa->list_grip_size--;
else
pa->list_grip_size++;
@@ -5732,10 +5742,10 @@ static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
retval= WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
- if(pa->list_last_len > pa->list_size) {
+ else if (ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
+ if (pa->list_last_len > pa->list_size) {
/* list template will clamp */
- if(event->type == WHEELUPMOUSE)
+ if (event->type == WHEELUPMOUSE)
pa->list_scroll--;
else
pa->list_scroll++;
@@ -5759,29 +5769,29 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
menu= data->menu;
/* copy over return values from the closing menu */
- if((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) {
- if(but->type == COL)
+ if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) {
+ if (but->type == COL)
copy_v3_v3(data->vec, menu->retvec);
- else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
+ else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
data->value= menu->retvalue;
}
- if(menu->menuretval & UI_RETURN_UPDATE) {
- if(data->interactive) ui_apply_button(C, but->block, but, data, 1);
+ if (menu->menuretval & UI_RETURN_UPDATE) {
+ if (data->interactive) ui_apply_button(C, but->block, but, data, 1);
else ui_check_but(but);
menu->menuretval= 0;
}
/* now change button state or exit, which will close the submenu */
- if((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_CANCEL)) {
- if(menu->menuretval != UI_RETURN_OK)
+ if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_CANCEL)) {
+ if (menu->menuretval != UI_RETURN_OK)
data->cancel= 1;
button_activate_exit(C, data, but, 1, 0);
}
- else if(menu->menuretval & UI_RETURN_OUT) {
- if(event->type==MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) {
+ else if (menu->menuretval & UI_RETURN_OUT) {
+ if (event->type==MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) {
button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
}
else {
@@ -5811,12 +5821,12 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
static void ui_mouse_motion_towards_init(uiPopupBlockHandle *menu, int mx, int my, int force)
{
- if(!menu->dotowards || force) {
+ if (!menu->dotowards || force) {
menu->dotowards= 1;
menu->towardsx= mx;
menu->towardsy= my;
- if(force)
+ if (force)
menu->towardstime= DBL_MAX; /* unlimited time */
else
menu->towardstime= PIL_check_seconds_timer();
@@ -5828,7 +5838,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
float p1[2], p2[2], p3[2], p4[2], oldp[2], newp[2];
int closer;
- if(!menu->dotowards) return 0;
+ if (!menu->dotowards) return 0;
/* verify that we are moving towards one of the edges of the
* menu block, in other words, in the triangle formed by the
@@ -5851,7 +5861,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
newp[0]= mx;
newp[1]= my;
- if(len_v2v2(oldp, newp) < 4.0f)
+ if (len_v2v2(oldp, newp) < 4.0f)
return menu->dotowards;
closer= 0;
@@ -5860,11 +5870,11 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
closer |= isect_point_tri_v2(newp, oldp, p3, p4);
closer |= isect_point_tri_v2(newp, oldp, p4, p1);
- if(!closer)
+ if (!closer)
menu->dotowards= 0;
/* 1 second timer */
- if(PIL_check_seconds_timer() - menu->towardstime > BUTTON_MOUSE_TOWARDS_THRESH)
+ if (PIL_check_seconds_timer() - menu->towardstime > BUTTON_MOUSE_TOWARDS_THRESH)
menu->dotowards= 0;
return menu->dotowards;
@@ -5872,12 +5882,12 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
static char ui_menu_scroll_test(uiBlock *block, int my)
{
- if(block->flag & (UI_BLOCK_CLIPTOP|UI_BLOCK_CLIPBOTTOM)) {
- if(block->flag & UI_BLOCK_CLIPTOP)
- if(my > block->maxy-14)
+ if (block->flag & (UI_BLOCK_CLIPTOP|UI_BLOCK_CLIPBOTTOM)) {
+ if (block->flag & UI_BLOCK_CLIPTOP)
+ if (my > block->maxy-14)
return 't';
- if(block->flag & UI_BLOCK_CLIPBOTTOM)
- if(my < block->miny+14)
+ if (block->flag & UI_BLOCK_CLIPBOTTOM)
+ if (my < block->miny+14)
return 'b';
}
return 0;
@@ -5887,7 +5897,7 @@ static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my)
{
char test= ui_menu_scroll_test(block, my);
- if(test) {
+ if (test) {
uiBut *b1= block->buttons.first;
uiBut *b2= block->buttons.last;
uiBut *bnext;
@@ -5895,36 +5905,36 @@ static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my)
int dy= 0;
/* get first and last visible buttons */
- while(b1 && ui_but_next(b1) && (b1->flag & UI_SCROLLED))
+ while (b1 && ui_but_next(b1) && (b1->flag & UI_SCROLLED))
b1= ui_but_next(b1);
- while(b2 && ui_but_prev(b2) && (b2->flag & UI_SCROLLED))
+ while (b2 && ui_but_prev(b2) && (b2->flag & UI_SCROLLED))
b2= ui_but_prev(b2);
/* skips separators */
bnext= ui_but_next(b1);
bprev= ui_but_prev(b2);
- if(bnext==NULL || bprev==NULL)
+ if (bnext==NULL || bprev==NULL)
return 0;
- if(test=='t') {
+ if (test=='t') {
/* bottom button is first button */
- if(b1->y1 < b2->y1)
+ if (b1->y1 < b2->y1)
dy= bnext->y1 - b1->y1;
/* bottom button is last button */
else
dy= bprev->y1 - b2->y1;
}
- else if(test=='b') {
+ else if (test=='b') {
/* bottom button is first button */
- if(b1->y1 < b2->y1)
+ if (b1->y1 < b2->y1)
dy= b1->y1 - bnext->y1;
/* bottom button is last button */
else
dy= b2->y1 - bprev->y1;
}
- if(dy) {
+ if (dy) {
- for(b1= block->buttons.first; b1; b1= b1->next) {
+ for (b1= block->buttons.first; b1; b1= b1->next) {
b1->y1 -= dy;
b1->y2 -= dy;
}
@@ -5959,43 +5969,43 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
/* check if mouse is inside block */
inside= 0;
- if(block->minx <= mx && block->maxx >= mx)
- if(block->miny <= my && block->maxy >= my)
+ if (block->minx <= mx && block->maxx >= mx)
+ if (block->miny <= my && block->maxy >= my)
inside= 1;
/* if there's an active modal button, don't check events or outside, except for search menu */
but= ui_but_find_activated(ar);
- if(but && button_modal_state(but->active->state) && but->type!=SEARCH_MENU) {
+ if (but && button_modal_state(but->active->state) && but->type!=SEARCH_MENU) {
/* if a button is activated modal, always reset the start mouse
* position of the towards mechanism to avoid loosing focus,
* and don't handle events */
ui_mouse_motion_towards_init(menu, mx, my, 1);
}
- else if(event->type == TIMER) {
- if(event->customdata == menu->scrolltimer)
+ else if (event->type == TIMER) {
+ if (event->customdata == menu->scrolltimer)
ui_menu_scroll(ar, block, my);
}
else {
/* for ui_mouse_motion_towards_block */
- if(event->type == MOUSEMOVE) {
+ if (event->type == MOUSEMOVE) {
ui_mouse_motion_towards_init(menu, mx, my, 0);
/* add menu scroll timer, if needed */
- if(ui_menu_scroll_test(block, my))
- if(menu->scrolltimer==NULL)
+ if (ui_menu_scroll_test(block, my))
+ if (menu->scrolltimer==NULL)
menu->scrolltimer=
WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, MENU_SCROLL_INTERVAL);
}
/* first block own event func */
- if(block->block_event_func && block->block_event_func(C, block, event));
+ if (block->block_event_func && block->block_event_func(C, block, event));
/* events not for active search menu button */
- else if(but==NULL || but->type!=SEARCH_MENU) {
+ else if (but==NULL || but->type!=SEARCH_MENU) {
switch(event->type) {
/* closing sublevels of pulldowns */
case LEFTARROWKEY:
- if(event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP))
- if(block->saferct.first)
+ if (event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP))
+ if (block->saferct.first)
menu->menuretval= UI_RETURN_OUT;
retval= WM_UI_HANDLER_BREAK;
@@ -6003,16 +6013,16 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
/* opening sublevels of pulldowns */
case RIGHTARROWKEY:
- if(event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
+ if (event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
but= ui_but_find_activated(ar);
- if(!but) {
+ if (!but) {
/* no item active, we make first active */
- if(block->direction & UI_TOP) but= ui_but_last(block);
+ if (block->direction & UI_TOP) but= ui_but_last(block);
else but= ui_but_first(block);
}
- if(but && ELEM(but->type, BLOCK, PULLDOWN))
+ if (but && ELEM(but->type, BLOCK, PULLDOWN))
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN);
}
@@ -6024,40 +6034,40 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
case WHEELUPMOUSE:
case WHEELDOWNMOUSE:
/* arrowkeys: only handle for block_loop blocks */
- if(event->alt || event->shift || event->ctrl || event->oskey);
- else if(inside || (block->flag & UI_BLOCK_LOOP)) {
- if(event->val==KM_PRESS) {
+ if (event->alt || event->shift || event->ctrl || event->oskey);
+ else if (inside || (block->flag & UI_BLOCK_LOOP)) {
+ if (event->val==KM_PRESS) {
but= ui_but_find_activated(ar);
- if(but) {
+ if (but) {
/* is there a situation where UI_LEFT or UI_RIGHT would also change navigation direction? */
- if( ((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DOWN)) ||
+ if ( ((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DOWN)) ||
((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_RIGHT)) ||
((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_TOP))
) {
/* the following is just a hack - uiBut->type set to BUT and BUTM have there menus built
* opposite ways - this should be changed so that all popup-menus use the same uiBlock->direction */
- if(but->type & BUT)
+ if (but->type & BUT)
but= ui_but_next(but);
else
but= ui_but_prev(but);
}
else {
- if(but->type & BUT)
+ if (but->type & BUT)
but= ui_but_prev(but);
else
but= ui_but_next(but);
}
- if(but)
+ if (but)
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE);
}
- if(!but) {
- if( ((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DOWN)) ||
+ if (!but) {
+ if ( ((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DOWN)) ||
((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) ||
((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP))
) {
- if((bt= ui_but_first(block)) && (bt->type & BUT)) {
+ if ((bt= ui_but_first(block)) && (bt->type & BUT)) {
bt= ui_but_last(block);
}
else {
@@ -6065,7 +6075,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
}
}
else {
- if((bt= ui_but_first(block)) && (bt->type & BUT)) {
+ if ((bt= ui_but_first(block)) && (bt->type & BUT)) {
/* keep ui_but_first() */
}
else {
@@ -6073,7 +6083,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
}
}
- if(bt)
+ if (bt)
ui_handle_button_activate(C, ar, bt, BUTTON_ACTIVATE);
}
}
@@ -6086,50 +6096,50 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
case ONEKEY: case PAD1:
act= 1;
case TWOKEY: case PAD2:
- if(act==0) act= 2;
+ if (act==0) act= 2;
case THREEKEY: case PAD3:
- if(act==0) act= 3;
+ if (act==0) act= 3;
case FOURKEY: case PAD4:
- if(act==0) act= 4;
+ if (act==0) act= 4;
case FIVEKEY: case PAD5:
- if(act==0) act= 5;
+ if (act==0) act= 5;
case SIXKEY: case PAD6:
- if(act==0) act= 6;
+ if (act==0) act= 6;
case SEVENKEY: case PAD7:
- if(act==0) act= 7;
+ if (act==0) act= 7;
case EIGHTKEY: case PAD8:
- if(act==0) act= 8;
+ if (act==0) act= 8;
case NINEKEY: case PAD9:
- if(act==0) act= 9;
+ if (act==0) act= 9;
case ZEROKEY: case PAD0:
- if(act==0) act= 10;
+ if (act==0) act= 10;
- if((block->flag & UI_BLOCK_NUMSELECT) && event->val==KM_PRESS) {
- if(event->alt) act+= 10;
+ if ((block->flag & UI_BLOCK_NUMSELECT) && event->val==KM_PRESS) {
+ if (event->alt) act+= 10;
count= 0;
- for(but= block->buttons.first; but; but= but->next) {
+ for (but= block->buttons.first; but; but= but->next) {
int doit= 0;
- if(but->type!=LABEL && but->type!=SEPR)
+ if (but->type!=LABEL && but->type!=SEPR)
count++;
/* exception for rna layer buts */
- if(but->rnapoin.data && but->rnaprop) {
+ if (but->rnapoin.data && but->rnaprop) {
if (ELEM(RNA_property_subtype(but->rnaprop), PROP_LAYER, PROP_LAYER_MEMBER)) {
if (but->rnaindex== act-1)
doit=1;
}
}
/* exception for menus like layer buts, with button aligning they're not drawn in order */
- else if(but->type==TOGR) {
- if(but->bitnr==act-1)
+ else if (but->type==TOGR) {
+ if (but->bitnr==act-1)
doit= 1;
}
- else if(count==act)
+ else if (count==act)
doit=1;
- if(doit) {
+ if (doit) {
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY);
break;
}
@@ -6167,19 +6177,19 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
case YKEY:
case ZKEY:
{
- if( (event->val == KM_PRESS) &&
+ if ( (event->val == KM_PRESS) &&
(event->shift == FALSE) &&
(event->ctrl == FALSE) &&
(event->oskey == FALSE)
) {
- for(but= block->buttons.first; but; but= but->next) {
+ for (but= block->buttons.first; but; but= but->next) {
- if(but->menu_key==event->type) {
- if(but->type == BUT) {
+ if (but->menu_key==event->type) {
+ if (but->type == BUT) {
/* mainly for operator buttons */
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY);
}
- else if(ELEM(but->type, BLOCK, PULLDOWN)) {
+ else if (ELEM(but->type, BLOCK, PULLDOWN)) {
/* open submenus (like right arrow key) */
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN);
}
@@ -6203,15 +6213,15 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
}
/* here we check return conditions for menus */
- if(block->flag & UI_BLOCK_LOOP) {
+ if (block->flag & UI_BLOCK_LOOP) {
/* if we click outside the block, verify if we clicked on the
* button that opened us, otherwise we need to close */
- if(inside==0) {
+ if (inside==0) {
uiSafetyRct *saferct= block->saferct.first;
- if(ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) && event->val==KM_PRESS) {
- if(saferct && !BLI_in_rctf(&saferct->parent, event->x, event->y)) {
- if(block->flag & (UI_BLOCK_OUT_1))
+ if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) && event->val==KM_PRESS) {
+ if (saferct && !BLI_in_rctf(&saferct->parent, event->x, event->y)) {
+ if (block->flag & (UI_BLOCK_OUT_1))
menu->menuretval= UI_RETURN_OK;
else
menu->menuretval= UI_RETURN_OUT;
@@ -6219,45 +6229,45 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
}
}
- if(menu->menuretval);
- else if(event->type==ESCKEY && event->val==KM_PRESS) {
+ if (menu->menuretval);
+ else if (event->type==ESCKEY && event->val==KM_PRESS) {
/* esc cancels this and all preceding menus */
menu->menuretval= UI_RETURN_CANCEL;
}
- else if(ELEM(event->type, RETKEY, PADENTER) && event->val==KM_PRESS) {
+ else if (ELEM(event->type, RETKEY, PADENTER) && event->val==KM_PRESS) {
/* enter will always close this block, we let the event
* get handled by the button if it is activated, otherwise we cancel */
- if(!ui_but_find_activated(ar))
+ if (!ui_but_find_activated(ar))
menu->menuretval= UI_RETURN_CANCEL | UI_RETURN_POPUP_OK;
}
else {
ui_mouse_motion_towards_check(block, menu, mx, my);
/* check mouse moving outside of the menu */
- if(inside==0 && (block->flag & UI_BLOCK_MOVEMOUSE_QUIT)) {
+ if (inside==0 && (block->flag & UI_BLOCK_MOVEMOUSE_QUIT)) {
uiSafetyRct *saferct;
/* check for all parent rects, enables arrowkeys to be used */
- for(saferct=block->saferct.first; saferct; saferct= saferct->next) {
+ for (saferct=block->saferct.first; saferct; saferct= saferct->next) {
/* for mouse move we only check our own rect, for other
* events we check all preceding block rects too to make
* arrow keys navigation work */
- if(event->type!=MOUSEMOVE || saferct==block->saferct.first) {
- if(BLI_in_rctf(&saferct->parent, (float)event->x, (float)event->y))
+ if (event->type!=MOUSEMOVE || saferct==block->saferct.first) {
+ if (BLI_in_rctf(&saferct->parent, (float)event->x, (float)event->y))
break;
- if(BLI_in_rctf(&saferct->safety, (float)event->x, (float)event->y))
+ if (BLI_in_rctf(&saferct->safety, (float)event->x, (float)event->y))
break;
}
}
/* strict check, and include the parent rect */
- if(!menu->dotowards && !saferct) {
- if(block->flag & (UI_BLOCK_OUT_1))
+ if (!menu->dotowards && !saferct) {
+ if (block->flag & (UI_BLOCK_OUT_1))
menu->menuretval= UI_RETURN_OK;
else
menu->menuretval= UI_RETURN_OUT;
}
- else if(menu->dotowards && event->type==MOUSEMOVE)
+ else if (menu->dotowards && event->type==MOUSEMOVE)
retval= WM_UI_HANDLER_BREAK;
}
}
@@ -6268,20 +6278,20 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
* buttons inside this region. disabled inside check .. not sure
* anymore why it was there? but it meant enter didn't work
* for example when mouse was not over submenu */
- if((/*inside &&*/ (!menu->menuretval || (menu->menuretval & UI_RETURN_UPDATE)) && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) {
+ if ((/*inside &&*/ (!menu->menuretval || (menu->menuretval & UI_RETURN_UPDATE)) && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) {
but= ui_but_find_activated(ar);
- if(but) {
+ if (but) {
ScrArea *ctx_area= CTX_wm_area(C);
ARegion *ctx_region= CTX_wm_region(C);
- if(menu->ctx_area) CTX_wm_area_set(C, menu->ctx_area);
- if(menu->ctx_region) CTX_wm_region_set(C, menu->ctx_region);
+ if (menu->ctx_area) CTX_wm_area_set(C, menu->ctx_area);
+ if (menu->ctx_region) CTX_wm_region_set(C, menu->ctx_region);
retval= ui_handle_button_event(C, event, but);
- if(menu->ctx_area) CTX_wm_area_set(C, ctx_area);
- if(menu->ctx_region) CTX_wm_region_set(C, ctx_region);
+ if (menu->ctx_area) CTX_wm_area_set(C, ctx_area);
+ if (menu->ctx_region) CTX_wm_region_set(C, ctx_region);
}
else
retval= ui_handle_button_over(C, event, ar);
@@ -6290,9 +6300,9 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
/* if we set a menu return value, ensure we continue passing this on to
* lower menus and buttons, so always set continue then, and if we are
* inside the region otherwise, ensure we swallow the event */
- if(menu->menuretval)
+ if (menu->menuretval)
return WM_UI_HANDLER_CONTINUE;
- else if(inside)
+ else if (inside)
return WM_UI_HANDLER_BREAK;
else
return retval;
@@ -6314,11 +6324,11 @@ static int ui_handle_menu_return_submenu(bContext *C, wmEvent *event, uiPopupBlo
data= but->active;
submenu= data->menu;
- if(submenu->menuretval) {
+ if (submenu->menuretval) {
/* first decide if we want to close our own menu cascading, if
* so pass on the sub menu return value to our own menu handle */
- if((submenu->menuretval & UI_RETURN_OK) || (submenu->menuretval & UI_RETURN_CANCEL)) {
- if(!(block->flag & UI_BLOCK_KEEP_OPEN)) {
+ if ((submenu->menuretval & UI_RETURN_OK) || (submenu->menuretval & UI_RETURN_CANCEL)) {
+ if (!(block->flag & UI_BLOCK_KEEP_OPEN)) {
menu->menuretval= submenu->menuretval;
menu->butretval= data->retval;
}
@@ -6330,7 +6340,7 @@ static int ui_handle_menu_return_submenu(bContext *C, wmEvent *event, uiPopupBlo
* will actually close the submenu too */
ui_handle_button_return_submenu(C, event, but);
- if(update)
+ if (update)
submenu->menuretval = 0;
}
@@ -6341,7 +6351,7 @@ static int ui_handle_menu_return_submenu(bContext *C, wmEvent *event, uiPopupBlo
ui_window_to_block(ar, block, &mx, &my);
ui_mouse_motion_towards_init(menu, mx, my, 1);
- if(menu->menuretval)
+ if (menu->menuretval)
return WM_UI_HANDLER_CONTINUE;
else
return WM_UI_HANDLER_BREAK;
@@ -6359,12 +6369,12 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHa
data= (but)? but->active: NULL;
submenu= (data)? data->menu: NULL;
- if(submenu)
+ if (submenu)
retval= ui_handle_menus_recursive(C, event, submenu);
/* now handle events for our own menu */
- if(retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
- if(submenu && submenu->menuretval)
+ if (retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
+ if (submenu && submenu->menuretval)
retval= ui_handle_menu_return_submenu(C, event, menu);
else
retval= ui_handle_menu_event(C, event, menu, (submenu == NULL));
@@ -6385,26 +6395,26 @@ static int ui_handler_region(bContext *C, wmEvent *event, void *UNUSED(userdata)
ar= CTX_wm_region(C);
retval= WM_UI_HANDLER_CONTINUE;
- if(ar==NULL) return retval;
- if(ar->uiblocks.first==NULL) return retval;
+ if (ar==NULL) return retval;
+ if (ar->uiblocks.first==NULL) return retval;
/* either handle events for already activated button or try to activate */
but= ui_but_find_activated(ar);
retval= ui_handler_panel_region(C, event);
- if(retval == WM_UI_HANDLER_CONTINUE)
+ if (retval == WM_UI_HANDLER_CONTINUE)
retval= ui_handle_list_event(C, event, ar);
- if(retval == WM_UI_HANDLER_CONTINUE) {
- if(but)
+ if (retval == WM_UI_HANDLER_CONTINUE) {
+ if (but)
retval= ui_handle_button_event(C, event, but);
else
retval= ui_handle_button_over(C, event, ar);
}
/* re-enable tooltips */
- if(event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
+ if (event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
ui_blocks_set_tooltips(ar, 1);
/* delayed apply callbacks */
@@ -6419,17 +6429,17 @@ static void ui_handler_remove_region(bContext *C, void *UNUSED(userdata))
ARegion *ar;
ar= CTX_wm_region(C);
- if(ar == NULL) return;
+ if (ar == NULL) return;
uiFreeBlocks(C, &ar->uiblocks);
sc= CTX_wm_screen(C);
- if(sc == NULL) return;
+ if (sc == NULL) return;
/* delayed apply callbacks, but not for screen level regions, those
* we rather do at the very end after closing them all, which will
* be done in ui_handler_region/window */
- if(BLI_findindex(&sc->regionbase, ar) == -1)
+ if (BLI_findindex(&sc->regionbase, ar) == -1)
ui_apply_but_funcs_after(C);
}
@@ -6443,23 +6453,23 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(user
/* here we handle buttons at the window level, modal, for example
* while number sliding, text editing, or when a menu block is open */
ar= CTX_wm_menu(C);
- if(!ar)
+ if (!ar)
ar= CTX_wm_region(C);
but= ui_but_find_activated(ar);
- if(but) {
+ if (but) {
/* handle activated button events */
data= but->active;
- if(data->state == BUTTON_STATE_MENU_OPEN) {
+ if (data->state == BUTTON_STATE_MENU_OPEN) {
/* handle events for menus and their buttons recursively,
* this will handle events from the top to the bottom menu */
retval= ui_handle_menus_recursive(C, event, data->menu);
/* handle events for the activated button */
- if(retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
- if(data->menu->menuretval)
+ if (retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
+ if (data->menu->menuretval)
ui_handle_button_return_submenu(C, event, but);
else
ui_handle_button_event(C, event, but);
@@ -6472,7 +6482,7 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(user
}
/* re-enable tooltips */
- if(event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
+ if (event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
ui_blocks_set_tooltips(ar, 1);
/* delayed apply callbacks */
@@ -6490,25 +6500,25 @@ static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata)
ui_handle_menus_recursive(C, event, menu);
/* free if done, does not free handle itself */
- if(menu->menuretval) {
+ if (menu->menuretval) {
/* copy values, we have to free first (closes region) */
uiPopupBlockHandle temp= *menu;
ui_popup_block_free(C, menu);
UI_remove_popup_handlers(&CTX_wm_window(C)->modalhandlers, menu);
- if((temp.menuretval & UI_RETURN_OK) || (temp.menuretval & UI_RETURN_POPUP_OK)) {
- if(temp.popup_func)
+ if ((temp.menuretval & UI_RETURN_OK) || (temp.menuretval & UI_RETURN_POPUP_OK)) {
+ if (temp.popup_func)
temp.popup_func(C, temp.popup_arg, temp.retvalue);
- if(temp.optype)
+ if (temp.optype)
WM_operator_name_call(C, temp.optype->idname, temp.opcontext, NULL);
}
- else if(temp.cancel_func)
+ else if (temp.cancel_func)
temp.cancel_func(temp.popup_arg);
}
else {
/* re-enable tooltips */
- if(event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
+ if (event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
ui_blocks_set_tooltips(menu->region, 1);
}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 552d5b0d221..4b5612c6408 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -147,13 +147,13 @@ static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int
di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
di->type= type;
- if(type == ICON_TYPE_TEXTURE) {
+ if (type == ICON_TYPE_TEXTURE) {
di->data.texture.x= xofs;
di->data.texture.y= yofs;
di->data.texture.w= size;
di->data.texture.h= size;
}
- else if(type == ICON_TYPE_BUFFER) {
+ else if (type == ICON_TYPE_BUFFER) {
iimg = MEM_mallocN(sizeof(IconImage), "icon_img");
iimg->rect = MEM_mallocN(size*size*sizeof(unsigned int), "icon_rect");
iimg->w = size;
@@ -476,6 +476,7 @@ static void init_brush_icons(void)
INIT_BRUSH_ICON(ICON_BRUSH_BLOB, blob);
INIT_BRUSH_ICON(ICON_BRUSH_BLUR, blur);
INIT_BRUSH_ICON(ICON_BRUSH_CLAY, clay);
+ INIT_BRUSH_ICON(ICON_BRUSH_CLAY_STRIPS, claystrips);
INIT_BRUSH_ICON(ICON_BRUSH_CLONE, clone);
INIT_BRUSH_ICON(ICON_BRUSH_CREASE, crease);
INIT_BRUSH_ICON(ICON_BRUSH_DARKEN, darken);
@@ -516,7 +517,7 @@ static void init_internal_icons(void)
if (icondir) {
BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile);
bbuf = IMB_loadiffname(iconfilestr, IB_rect); /* if the image is missing bbuf will just be NULL */
- if(bbuf && (bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H)) {
+ if (bbuf && (bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H)) {
printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
IMB_freeImBuf(bbuf);
bbuf= NULL;
@@ -526,21 +527,21 @@ static void init_internal_icons(void)
printf("%s: 'icons' data path not found, continuing\n", __func__);
}
}
- if(bbuf==NULL)
+ if (bbuf==NULL)
bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blender_icons_png, datatoc_blender_icons_png_size, IB_rect, "<blender icons>");
- if(bbuf) {
+ if (bbuf) {
/* free existing texture if any */
- if(icongltex.id) {
+ if (icongltex.id) {
glDeleteTextures(1, &icongltex.id);
icongltex.id= 0;
}
/* we only use a texture for cards with non-power of two */
- if(GPU_non_power_of_two_support()) {
+ if (GPU_non_power_of_two_support()) {
glGenTextures(1, &icongltex.id);
- if(icongltex.id) {
+ if (icongltex.id) {
icongltex.w = bbuf->x;
icongltex.h = bbuf->y;
icongltex.invw = 1.0f/bbuf->x;
@@ -552,7 +553,7 @@ static void init_internal_icons(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
- if(glGetError() == GL_OUT_OF_MEMORY) {
+ if (glGetError() == GL_OUT_OF_MEMORY) {
glDeleteTextures(1, &icongltex.id);
icongltex.id= 0;
}
@@ -560,12 +561,12 @@ static void init_internal_icons(void)
}
}
- if(icongltex.id)
+ if (icongltex.id)
icontype= ICON_TYPE_TEXTURE;
else
icontype= ICON_TYPE_BUFFER;
- if(bbuf) {
+ if (bbuf) {
for (y=0; y<ICON_GRID_ROWS; y++) {
for (x=0; x<ICON_GRID_COLS; x++) {
def_internal_icon(bbuf, BIFICONID_FIRST + y*ICON_GRID_COLS + x,
@@ -603,21 +604,21 @@ static void init_iconfile_list(struct ListBase *list)
list->first = list->last = NULL;
icondir = BLI_get_folder(BLENDER_DATAFILES, "icons");
- if(icondir==NULL)
+ if (icondir==NULL)
return;
/* since BLI_dir_contents changes the current working directory, restore it
* back to old value afterwards */
- if(!BLI_current_working_dir(olddir, sizeof(olddir)))
+ if (!BLI_current_working_dir(olddir, sizeof(olddir)))
restoredir = 0;
totfile = BLI_dir_contents(icondir, &dir);
if (restoredir && !chdir(olddir)) {} /* fix warning about checking return value */
- for(i=0; i<totfile; i++) {
- if( (dir[i].type & S_IFREG) ) {
+ for (i=0; i<totfile; i++) {
+ if ( (dir[i].type & S_IFREG) ) {
char *filename = dir[i].relname;
- if(BLI_testextensie(filename, ".png")) {
+ if (BLI_testextensie(filename, ".png")) {
/* loading all icons on file start is overkill & slows startup
* its possible they change size after blender load anyway. */
#if 0
@@ -630,7 +631,7 @@ static void init_iconfile_list(struct ListBase *list)
BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, filename);
bbuf= IMB_loadiffname(iconfilestr, IB_rect);
- if(bbuf) {
+ if (bbuf) {
ifilex = bbuf->x;
ifiley = bbuf->y;
IMB_freeImBuf(bbuf);
@@ -677,7 +678,7 @@ static void free_iconfile_list(struct ListBase *list)
{
IconFile *ifile=NULL, *next_ifile=NULL;
- for(ifile=list->first; ifile; ifile=next_ifile) {
+ for (ifile=list->first; ifile; ifile=next_ifile) {
next_ifile = ifile->next;
BLI_freelinkN(list, ifile);
}
@@ -688,7 +689,7 @@ int UI_iconfile_get_index(const char *filename)
IconFile *ifile;
ListBase *list=&(iconfilelist);
- for(ifile=list->first; ifile; ifile=ifile->next) {
+ for (ifile=list->first; ifile; ifile=ifile->next) {
if (BLI_path_cmp(filename, ifile->filename) == 0) {
return ifile->index;
}
@@ -708,7 +709,7 @@ ListBase *UI_iconfile_list(void)
void UI_icons_free(void)
{
#ifndef WITH_HEADLESS
- if(icongltex.id) {
+ if (icongltex.id) {
glDeleteTextures(1, &icongltex.id);
icongltex.id= 0;
}
@@ -722,9 +723,9 @@ void UI_icons_free_drawinfo(void *drawinfo)
{
DrawInfo *di = drawinfo;
- if(di) {
- if(di->type == ICON_TYPE_BUFFER) {
- if(di->data.buffer.image) {
+ if (di) {
+ if (di->type == ICON_TYPE_BUFFER) {
+ if (di->data.buffer.image) {
MEM_freeN(di->data.buffer.image->rect);
MEM_freeN(di->data.buffer.image);
}
@@ -859,24 +860,24 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
ImBuf *ima= NULL;
/* sanity check */
- if(w<=0 || h<=0 || w>2000 || h>2000) {
+ if (w<=0 || h<=0 || w>2000 || h>2000) {
printf("%s: icons are %i x %i pixels?\n", __func__, w, h);
BLI_assert(!"invalid icon size");
return;
}
/* modulate color */
- if(alpha != 1.0f)
+ if (alpha != 1.0f)
glPixelTransferf(GL_ALPHA_SCALE, alpha);
- if(rgb) {
+ if (rgb) {
glPixelTransferf(GL_RED_SCALE, rgb[0]);
glPixelTransferf(GL_GREEN_SCALE, rgb[1]);
glPixelTransferf(GL_BLUE_SCALE, rgb[2]);
}
/* rect contains image in 'rendersize', we only scale if needed */
- if(rw!=w && rh!=h) {
+ if (rw!=w && rh!=h) {
/* first allocate imbuf for scaling and copy preview into it */
ima = IMB_allocImBuf(rw, rh, 32, IB_rect);
memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int));
@@ -885,7 +886,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
}
/* draw */
- if(is_preview) {
+ if (is_preview) {
glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect);
}
else {
@@ -893,14 +894,14 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect);
}
- if(ima)
+ if (ima)
IMB_freeImBuf(ima);
/* restore color */
- if(alpha != 0.0f)
+ if (alpha != 0.0f)
glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
- if(rgb) {
+ if (rgb) {
glPixelTransferf(GL_RED_SCALE, 1.0f);
glPixelTransferf(GL_GREEN_SCALE, 1.0f);
glPixelTransferf(GL_BLUE_SCALE, 1.0f);
@@ -911,7 +912,7 @@ static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy
{
float x1, x2, y1, y2;
- if(rgb) glColor4f(rgb[0], rgb[1], rgb[2], alpha);
+ if (rgb) glColor4f(rgb[0], rgb[1], rgb[2], alpha);
else glColor4f(1.0f, 1.0f, 1.0f, alpha);
x1= ix*icongltex.invw;
@@ -981,29 +982,29 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
w = (int)(fdraw_size/aspect + 0.5f);
h = (int)(fdraw_size/aspect + 0.5f);
- if(di->type == ICON_TYPE_VECTOR) {
+ if (di->type == ICON_TYPE_VECTOR) {
/* vector icons use the uiBlock transformation, they are not drawn
* with untransformed coordinates like the other icons */
di->data.vector.func((int)x, (int)y, ICON_DEFAULT_HEIGHT, ICON_DEFAULT_HEIGHT, 1.0f);
}
- else if(di->type == ICON_TYPE_TEXTURE) {
+ else if (di->type == ICON_TYPE_TEXTURE) {
icon_draw_texture(x, y, (float)w, (float)h, di->data.texture.x, di->data.texture.y,
di->data.texture.w, di->data.texture.h, alpha, rgb);
}
- else if(di->type == ICON_TYPE_BUFFER) {
+ else if (di->type == ICON_TYPE_BUFFER) {
/* it is a builtin icon */
iimg= di->data.buffer.image;
- if(!iimg->rect) return; /* something has gone wrong! */
+ if (!iimg->rect) return; /* something has gone wrong! */
icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, is_preview);
}
- else if(di->type == ICON_TYPE_PREVIEW) {
+ else if (di->type == ICON_TYPE_PREVIEW) {
PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj);
- if(pi) {
+ if (pi) {
/* no create icon on this level in code */
- if(!pi->rect[size]) return; /* something has gone wrong! */
+ if (!pi->rect[size]) return; /* something has gone wrong! */
/* preview images use premul alpha ... */
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
@@ -1040,13 +1041,13 @@ static void ui_id_brush_render(bContext *C, ID *id)
PreviewImage *pi = BKE_previewimg_get(id);
enum eIconSizes i;
- if(!pi)
+ if (!pi)
return;
- for(i = 0; i < NUM_ICON_SIZES; i++) {
+ for (i = 0; i < NUM_ICON_SIZES; i++) {
/* check if rect needs to be created; changed
* only set by dynamic icons */
- if((pi->changed[i] || !pi->rect[i])) {
+ if ((pi->changed[i] || !pi->rect[i])) {
icon_set_image(C, id, pi, i);
pi->changed[i] = 0;
}
@@ -1058,7 +1059,7 @@ static int ui_id_brush_get_icon(bContext *C, ID *id)
{
Brush *br = (Brush*)id;
- if(br->flag & BRUSH_CUSTOM_ICON) {
+ if (br->flag & BRUSH_CUSTOM_ICON) {
BKE_icon_getid(id);
ui_id_brush_render(C, id);
}
@@ -1072,34 +1073,34 @@ static int ui_id_brush_get_icon(bContext *C, ID *id)
* be strictly in one paint mode only to avoid
* checking various context stuff here */
- if(CTX_wm_view3d(C) && ob) {
- if(ob->mode & OB_MODE_SCULPT)
+ if (CTX_wm_view3d(C) && ob) {
+ if (ob->mode & OB_MODE_SCULPT)
mode = OB_MODE_SCULPT;
- else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))
+ else if (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))
mode = OB_MODE_VERTEX_PAINT;
- else if(ob->mode & OB_MODE_TEXTURE_PAINT)
+ else if (ob->mode & OB_MODE_TEXTURE_PAINT)
mode = OB_MODE_TEXTURE_PAINT;
}
- else if((sima = CTX_wm_space_image(C)) &&
+ else if ((sima = CTX_wm_space_image(C)) &&
(sima->flag & SI_DRAWTOOL)) {
mode = OB_MODE_TEXTURE_PAINT;
}
/* reset the icon */
- if(mode == OB_MODE_SCULPT) {
+ if (mode == OB_MODE_SCULPT) {
items = brush_sculpt_tool_items;
tool = br->sculpt_tool;
}
- else if(mode == OB_MODE_VERTEX_PAINT) {
+ else if (mode == OB_MODE_VERTEX_PAINT) {
items = brush_vertex_tool_items;
tool = br->vertexpaint_tool;
}
- else if(mode == OB_MODE_TEXTURE_PAINT) {
+ else if (mode == OB_MODE_TEXTURE_PAINT) {
items = brush_image_tool_items;
tool = br->imagepaint_tool;
}
- if(!items || !RNA_enum_icon_from_value(items, tool, &id->icon_id))
+ if (!items || !RNA_enum_icon_from_value(items, tool, &id->icon_id))
id->icon_id = 0;
}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index dd4bbc75249..a0935e7abdd 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -68,6 +68,7 @@ typedef enum {
UI_WTYPE_NUMBER,
UI_WTYPE_SLIDER,
UI_WTYPE_EXEC,
+ UI_WTYPE_TOOLTIP,
/* strings */
UI_WTYPE_NAME,
@@ -84,7 +85,7 @@ typedef enum {
UI_WTYPE_PULLDOWN,
UI_WTYPE_MENU_ITEM,
UI_WTYPE_MENU_BACK,
-
+
/* specials */
UI_WTYPE_ICON,
UI_WTYPE_SWATCH,
@@ -465,6 +466,8 @@ extern int ui_button_is_active(struct ARegion *ar);
void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3);
void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad);
void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
+uiWidgetColors* ui_tooltip_get_theme(void);
+void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
void ui_draw_search_back(struct uiStyle *style, uiBlock *block, rcti *rect);
int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol);
void ui_draw_link_bezier(rcti *rect);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index a0dbecbd4a6..88db06c5ec3 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -172,7 +172,7 @@ static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_
{
int len= strlen(name);
- if(len != 0 && len+1 < UI_MAX_NAME_STR) {
+ if (len != 0 && len+1 < UI_MAX_NAME_STR) {
BLI_strncpy(namestr, name, UI_MAX_NAME_STR);
namestr[len]= ':';
namestr[len+1]= '\0';
@@ -185,23 +185,23 @@ static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_
static int ui_item_fit(int item, int pos, int all, int available, int last, int alignment, int *offset)
{
/* available == 0 is unlimited */
- if(available == 0)
+ if (available == 0)
return item;
- if(offset)
+ if (offset)
*offset= 0;
- if(all > available) {
+ if (all > available) {
/* contents is bigger than available space */
- if(last)
+ if (last)
return available-pos;
else
return (item*available)/all;
}
else {
/* contents is smaller or equal to available space */
- if(alignment == UI_LAYOUT_ALIGN_EXPAND) {
- if(last)
+ if (alignment == UI_LAYOUT_ALIGN_EXPAND) {
+ if (last)
return available-pos;
else
return (item*available)/all;
@@ -225,9 +225,9 @@ static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, int
{
int variable = ui_layout_vary_direction(layout) == UI_ITEM_VARY_X;
- if(icon && !name[0])
+ if (icon && !name[0])
return UI_UNIT_X; /* icon only */
- else if(icon)
+ else if (icon)
return (variable)? UI_GetStringWidth(name) + (compact? 5: 10) + UI_UNIT_X: 10*UI_UNIT_X; /* icon + text */
else
return (variable)? UI_GetStringWidth(name) + (compact? 5: 10) + UI_UNIT_X: 10*UI_UNIT_X; /* text only */
@@ -235,37 +235,37 @@ static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, int
static void ui_item_size(uiItem *item, int *r_w, int *r_h)
{
- if(item->type == ITEM_BUTTON) {
+ if (item->type == ITEM_BUTTON) {
uiButtonItem *bitem= (uiButtonItem*)item;
- if(r_w) *r_w= bitem->but->x2 - bitem->but->x1;
- if(r_h) *r_h= bitem->but->y2 - bitem->but->y1;
+ if (r_w) *r_w= bitem->but->x2 - bitem->but->x1;
+ if (r_h) *r_h= bitem->but->y2 - bitem->but->y1;
}
else {
uiLayout *litem= (uiLayout*)item;
- if(r_w) *r_w= litem->w;
- if(r_h) *r_h= litem->h;
+ if (r_w) *r_w= litem->w;
+ if (r_h) *r_h= litem->h;
}
}
static void ui_item_offset(uiItem *item, int *r_x, int *r_y)
{
- if(item->type == ITEM_BUTTON) {
+ if (item->type == ITEM_BUTTON) {
uiButtonItem *bitem= (uiButtonItem*)item;
- if(r_x) *r_x= bitem->but->x1;
- if(r_y) *r_y= bitem->but->y1;
+ if (r_x) *r_x= bitem->but->x1;
+ if (r_y) *r_y= bitem->but->y1;
}
else {
- if(r_x) *r_x= 0;
- if(r_y) *r_y= 0;
+ if (r_x) *r_x= 0;
+ if (r_y) *r_y= 0;
}
}
static void ui_item_position(uiItem *item, int x, int y, int w, int h)
{
- if(item->type == ITEM_BUTTON) {
+ if (item->type == ITEM_BUTTON) {
uiButtonItem *bitem= (uiButtonItem*)item;
bitem->but->x1= x;
@@ -308,7 +308,7 @@ static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, int a
{
uiLayout *sub;
- if(ui_layout_local_dir(test) == UI_LAYOUT_HORIZONTAL)
+ if (ui_layout_local_dir(test) == UI_LAYOUT_HORIZONTAL)
sub= uiLayoutRow(layout, align);
else
sub= uiLayoutColumn(layout, align);
@@ -327,16 +327,16 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index)
int shift= win->eventstate->shift;
int len= RNA_property_array_length(ptr, prop);
- if(!shift) {
+ if (!shift) {
RNA_property_boolean_set_index(ptr, prop, index, TRUE);
- for(i=0; i<len; i++)
- if(i != index)
+ for (i=0; i<len; i++)
+ if (i != index)
RNA_property_boolean_set_index(ptr, prop, i, 0);
RNA_property_update(C, ptr, prop);
- for(cbut=but->block->buttons.first; cbut; cbut=cbut->next)
+ for (cbut=but->block->buttons.first; cbut; cbut=cbut->next)
ui_check_but(cbut);
}
}
@@ -359,11 +359,11 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
uiBlockSetCurLayout(block, sub);
/* create label */
- if(name[0])
+ if (name[0])
uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
/* create buttons */
- if(type == PROP_BOOLEAN && ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) {
+ if (type == PROP_BOOLEAN && ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) {
/* special check for layer layout */
int butw, buth, unit;
int cols= (len >= 20)? 2: 1;
@@ -376,28 +376,28 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
butw= unit;
buth= unit;
- if(ptr->type == &RNA_Armature) {
+ if (ptr->type == &RNA_Armature) {
bArmature *arm= (bArmature *)ptr->data;
layer_used= arm->layer_used;
}
- for(b=0; b<cols; b++) {
+ for (b=0; b<cols; b++) {
uiBlockBeginAlign(block);
- for(a=0; a<colbuts; a++) {
- if(layer_used & (1<<(a+b*colbuts))) icon= ICON_LAYER_USED;
+ for (a=0; a<colbuts; a++) {
+ if (layer_used & (1<<(a+b*colbuts))) icon= ICON_LAYER_USED;
else icon= ICON_BLANK1;
- but= uiDefAutoButR(block, ptr, prop, a+b*colbuts, "", icon, x + butw*a, y+buth, butw, buth);
- if(subtype == PROP_LAYER_MEMBER)
+ but = uiDefAutoButR(block, ptr, prop, a+b*colbuts, "", icon, x + butw*a, y+buth, butw, buth);
+ if (subtype == PROP_LAYER_MEMBER)
uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+b*colbuts));
}
- for(a=0; a<colbuts; a++) {
- if(layer_used & (1<<(a+len/2+b*colbuts))) icon= ICON_LAYER_USED;
+ for (a=0; a<colbuts; a++) {
+ if (layer_used & (1<<(a+len/2+b*colbuts))) icon= ICON_LAYER_USED;
else icon= ICON_BLANK1;
- but= uiDefAutoButR(block, ptr, prop, a+len/2+b*colbuts, "", icon, x + butw*a, y, butw, buth);
- if(subtype == PROP_LAYER_MEMBER)
+ but = uiDefAutoButR(block, ptr, prop, a+len/2+b*colbuts, "", icon, x + butw*a, y, butw, buth);
+ if (subtype == PROP_LAYER_MEMBER)
uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+len/2+b*colbuts));
}
uiBlockEndAlign(block);
@@ -405,7 +405,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
x += colbuts*butw + style->buttonspacex;
}
}
- else if(subtype == PROP_MATRIX) {
+ else if (subtype == PROP_MATRIX) {
int totdim, dim_size[3]; /* 3 == RNA_MAX_ARRAY_DIMENSION */
int row, col;
@@ -417,16 +417,16 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
w /= dim_size[0];
/* h /= dim_size[1]; */ /* UNUSED */
- for(a=0; a<len; a++) {
+ for (a=0; a<len; a++) {
col= a % dim_size[0];
row= a / dim_size[0];
- but= uiDefAutoButR(block, ptr, prop, a, "", ICON_NONE, x + w*col, y+(dim_size[1]*UI_UNIT_Y)-(row*UI_UNIT_Y), w, UI_UNIT_Y);
- if(slider && but->type==NUM)
+ but = uiDefAutoButR(block, ptr, prop, a, "", ICON_NONE, x + w*col, y+(dim_size[1]*UI_UNIT_Y)-(row*UI_UNIT_Y), w, UI_UNIT_Y);
+ if (slider && but->type==NUM)
but->type= NUMSLI;
}
}
- else if(subtype == PROP_DIRECTION) {
+ else if (subtype == PROP_DIRECTION) {
uiDefButR_prop(block, BUT_NORMAL, 0, name, x, y, UI_UNIT_X*3, UI_UNIT_Y*3, ptr, prop, 0, 0, 0, -1, -1, NULL);
}
else {
@@ -434,7 +434,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
* to work with common cases, but may need to be re-worked */
/* special case, boolean array in a menu, this could be used in a more generic way too */
- if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) {
+ if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) {
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y);
}
else {
@@ -445,29 +445,29 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
/* layout for known array subtypes */
char str[3]= {'\0'};
- if(!icon_only) {
- if(type != PROP_BOOLEAN) {
+ if (!icon_only) {
+ if (type != PROP_BOOLEAN) {
str[1]= ':';
}
}
/* show checkboxes for rna on a non-emboss block (menu for eg) */
- if(type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSSN, UI_EMBOSSP)) {
+ if (type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSSN, UI_EMBOSSP)) {
boolarr= MEM_callocN(sizeof(int)*len, "ui_item_array");
RNA_property_boolean_get_array(ptr, prop, boolarr);
}
- for(a=0; a<len; a++) {
- if(!icon_only) str[0]= RNA_property_array_item_char(prop, a);
- if(boolarr) icon= boolarr[a] ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
- but= uiDefAutoButR(block, ptr, prop, a, str, icon, 0, 0, w, UI_UNIT_Y);
- if(slider && but->type==NUM)
+ for (a=0; a<len; a++) {
+ if (!icon_only) str[0]= RNA_property_array_item_char(prop, a);
+ if (boolarr) icon= boolarr[a] ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+ but = uiDefAutoButR(block, ptr, prop, a, str, icon, 0, 0, w, UI_UNIT_Y);
+ if (slider && but->type==NUM)
but->type= NUMSLI;
- if(toggle && but->type==OPTION)
+ if (toggle && but->type==OPTION)
but->type= TOG;
}
- if(boolarr) {
+ if (boolarr) {
MEM_freeN(boolarr);
}
}
@@ -486,8 +486,8 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
uiBlockSetCurLayout(block, ui_item_local_sublayout(layout, layout, 1));
- for(a=0; a<totitem; a++) {
- if(!item[a].identifier[0])
+ for (a=0; a<totitem; a++) {
+ if (!item[a].identifier[0])
continue;
name= (!uiname || uiname[0])? item[a].name: "";
@@ -495,14 +495,14 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
value= item[a].value;
itemw= ui_text_icon_width(block->curlayout, name, icon, 0);
- if(icon && name[0] && !icon_only)
- but= uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
- else if(icon)
- but= uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
+ if (icon && name[0] && !icon_only)
+ but = uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
+ else if (icon)
+ but = uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
else
- but= uiDefButR_prop(block, ROW, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
+ but = uiDefButR_prop(block, ROW, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
- if(ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL)
+ if (ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL)
but->flag |= UI_TEXT_LEFT;
}
uiBlockSetCurLayout(block, layout);
@@ -535,7 +535,7 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n
sub= uiLayoutRow(layout, 0);
uiBlockSetCurLayout(block, sub);
- if(name[0]) {
+ if (name[0]) {
/* XXX UI_GetStringWidth is not accurate */
#if 0
labelw = UI_GetStringWidth(name);
@@ -549,33 +549,33 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n
type= RNA_property_type(prop);
subtype= RNA_property_subtype(prop);
- if(subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) {
+ if (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) {
uiBlockSetCurLayout(block, uiLayoutRow(sub, 1));
uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w-UI_UNIT_X, h);
/* BUTTONS_OT_file_browse calls uiFileBrowseContextProperty */
- but= uiDefIconButO(block, BUT, subtype==PROP_DIRPATH ?
+ but = uiDefIconButO(block, BUT, subtype==PROP_DIRPATH ?
"BUTTONS_OT_directory_browse" :
"BUTTONS_OT_file_browse",
WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL);
}
- else if(flag & UI_ITEM_R_EVENT) {
+ else if (flag & UI_ITEM_R_EVENT) {
uiDefButR_prop(block, KEYEVT, 0, name, x, y, w, h, ptr, prop, index, 0, 0, -1, -1, NULL);
}
- else if(flag & UI_ITEM_R_FULL_EVENT) {
- if(RNA_struct_is_a(ptr->type, &RNA_KeyMapItem)) {
+ else if (flag & UI_ITEM_R_FULL_EVENT) {
+ if (RNA_struct_is_a(ptr->type, &RNA_KeyMapItem)) {
char buf[128];
WM_keymap_item_to_string(ptr->data, buf, sizeof(buf));
- but= uiDefButR_prop(block, HOTKEYEVT, 0, buf, x, y, w, h, ptr, prop, 0, 0, 0, -1, -1, NULL);
+ but = uiDefButR_prop(block, HOTKEYEVT, 0, buf, x, y, w, h, ptr, prop, 0, 0, 0, -1, -1, NULL);
uiButSetFunc(but, ui_keymap_but_cb, but, NULL);
if (flag & UI_ITEM_R_IMMEDIATE)
uiButSetFlag(but, UI_BUT_IMMEDIATE);
}
}
else
- but= uiDefAutoButR(block, ptr, prop, index, (type == PROP_ENUM && !(flag & UI_ITEM_R_ICON_ONLY))? NULL: "", icon, x, y, w, h);
+ but = uiDefAutoButR(block, ptr, prop, index, (type == PROP_ENUM && !(flag & UI_ITEM_R_ICON_ONLY))? NULL: "", icon, x, y, w, h);
uiBlockSetCurLayout(block, layout);
return but;
@@ -590,16 +590,16 @@ void uiFileBrowseContextProperty(const bContext *C, PointerRNA *ptr, PropertyRNA
memset(ptr, 0, sizeof(*ptr));
*prop= NULL;
- if(!ar)
+ if (!ar)
return;
- for(block=ar->uiblocks.first; block; block=block->next) {
- for(but=block->buttons.first; but; but= but->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
+ for (but=block->buttons.first; but; but= but->next) {
prevbut= but->prev;
/* find the button before the active one */
- if((but->flag & UI_BUT_LAST_ACTIVE) && prevbut && prevbut->rnapoin.data) {
- if(RNA_property_type(prevbut->rnaprop) == PROP_STRING) {
+ if ((but->flag & UI_BUT_LAST_ACTIVE) && prevbut && prevbut->rnapoin.data) {
+ if (RNA_property_type(prevbut->rnaprop) == PROP_STRING) {
*ptr= prevbut->rnapoin;
*prop= prevbut->rnaprop;
return;
@@ -620,12 +620,12 @@ static void ui_item_disabled(uiLayout *layout, const char *name)
uiBlockSetCurLayout(block, layout);
- if(!name)
+ if (!name)
name= "";
w= ui_text_icon_width(layout, name, 0, 0);
- but= uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
but->flag |= UI_BUT_DISABLED;
but->lock = 1;
but->lockstr = "";
@@ -638,11 +638,14 @@ PointerRNA uiItemFullO_ptr(uiLayout *layout, wmOperatorType *ot, const char *nam
uiBut *but;
int w;
- if(!name) {
- name= IFACE_(ot->name);
+ if (!name) {
+ if (ot && ot->srna)
+ name = RNA_struct_ui_name(ot->srna);
+ else
+ name = "";
}
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
/* create button */
@@ -654,7 +657,7 @@ PointerRNA uiItemFullO_ptr(uiLayout *layout, wmOperatorType *ot, const char *nam
uiBlockSetEmboss(block, UI_EMBOSSN);
/* create the button */
- if(icon) {
+ if (icon) {
if (name[0]) {
but = uiDefIconTextButO_ptr(block, BUT, ot, context, icon, name, 0, 0, w, UI_UNIT_Y, NULL);
}
@@ -663,26 +666,26 @@ PointerRNA uiItemFullO_ptr(uiLayout *layout, wmOperatorType *ot, const char *nam
}
}
else {
- but= uiDefButO_ptr(block, BUT, ot, context, name, 0, 0, w, UI_UNIT_Y, NULL);
+ but = uiDefButO_ptr(block, BUT, ot, context, name, 0, 0, w, UI_UNIT_Y, NULL);
}
assert(but->optype != NULL);
/* text alignment for toolbar buttons */
- if((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
+ if ((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
but->flag |= UI_TEXT_LEFT;
if (flag & UI_ITEM_R_NO_BG)
uiBlockSetEmboss(block, UI_EMBOSS);
- if(layout->redalert)
+ if (layout->redalert)
uiButSetFlag(but, UI_BUT_REDALERT);
/* assign properties */
- if(properties || (flag & UI_ITEM_O_RETURN_PROPS)) {
+ if (properties || (flag & UI_ITEM_O_RETURN_PROPS)) {
PointerRNA *opptr= uiButGetOperatorPtrRNA(but);
- if(properties) {
+ if (properties) {
opptr->data= properties;
}
else {
@@ -730,7 +733,7 @@ static void uiItemEnumO_ptr__internal(uiLayout *layout, wmOperatorType *ot, cons
WM_operator_properties_create_ptr(&ptr, ot);
RNA_property_enum_set(&ptr, prop, value);
- if(!name)
+ if (!name)
name = ui_menu_enumpropname(layout, &ptr, prop, value);
uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -752,7 +755,7 @@ void uiItemEnumO_ptr(uiLayout *layout, wmOperatorType *ot, const char *name, int
RNA_property_enum_set(&ptr, prop, value);
- if(!name)
+ if (!name)
name = ui_menu_enumpropname(layout, &ptr, prop, value);
uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -761,7 +764,7 @@ void uiItemEnumO(uiLayout *layout, const char *opname, const char *name, int ico
{
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
- if(ot) {
+ if (ot) {
uiItemEnumO_ptr(layout, ot, name, icon, propname, value);
}
else {
@@ -780,7 +783,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
uiBut *bt;
uiBlock *block= layout->root->block;
- if(!ot || !ot->srna) {
+ if (!ot || !ot->srna) {
ui_item_disabled(layout, opname);
RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
return;
@@ -792,7 +795,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
/* don't let bad properties slip through */
BLI_assert((prop == NULL) || (RNA_property_type(prop) == PROP_ENUM));
- if(prop && RNA_property_type(prop) == PROP_ENUM) {
+ if (prop && RNA_property_type(prop) == PROP_ENUM) {
EnumPropertyItem *item;
int totitem, i, free;
uiLayout *split= uiLayoutSplit(layout, 0, 0);
@@ -800,13 +803,13 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
RNA_property_enum_items_gettexted(block->evil_C, &ptr, prop, &item, &totitem, &free);
- for(i=0; i<totitem; i++) {
- if(item[i].identifier[0]) {
- if(properties) {
+ for (i=0; i<totitem; i++) {
+ if (item[i].identifier[0]) {
+ if (properties) {
PointerRNA tptr;
WM_operator_properties_create_ptr(&tptr, ot);
- if(tptr.data) {
+ if (tptr.data) {
IDP_FreeProperty(tptr.data);
MEM_freeN(tptr.data);
}
@@ -820,8 +823,8 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
}
}
else {
- if(item[i].name) {
- if(i != 0) {
+ if (item[i].name) {
+ if (i != 0) {
column= uiLayoutColumn(split, 0);
/* inconsistent, but menus with labels do not look good flipped */
block->flag |= UI_BLOCK_NO_FLIP;
@@ -870,7 +873,7 @@ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, const char
RNA_property_enum_set(&ptr, prop, value);
/* same as uiItemEnumO */
- if(!name)
+ if (!name)
name = ui_menu_enumpropname(layout, &ptr, prop, value);
uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -890,10 +893,10 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
WM_operator_properties_create_ptr(&ptr, ot);
/* enum lookup */
- if((prop= RNA_struct_find_property(&ptr, propname))) {
+ if ((prop= RNA_struct_find_property(&ptr, propname))) {
RNA_property_enum_items_gettexted(layout->root->block->evil_C, &ptr, prop, &item, NULL, &free);
- if(item==NULL || RNA_enum_value_from_id(item, value_str, &value)==0) {
- if(free) {
+ if (item==NULL || RNA_enum_value_from_id(item, value_str, &value)==0) {
+ if (free) {
MEM_freeN(item);
}
RNA_warning("%s.%s, enum %s not found", RNA_struct_identifier(ptr.type), propname, value_str);
@@ -912,7 +915,7 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
RNA_property_enum_set(&ptr, prop, value);
/* same as uiItemEnumO */
- if(!name)
+ if (!name)
name = ui_menu_enumpropname(layout, &ptr, prop, value);
uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -988,32 +991,32 @@ static void ui_item_rna_size(uiLayout *layout, const char *name, int icon, Point
subtype= RNA_property_subtype(prop);
len= RNA_property_array_length(ptr, prop);
- if(ELEM3(type, PROP_STRING, PROP_POINTER, PROP_ENUM) && !name[0] && !icon_only)
+ if (ELEM3(type, PROP_STRING, PROP_POINTER, PROP_ENUM) && !name[0] && !icon_only)
name= "non-empty text";
- else if(type == PROP_BOOLEAN && !name[0] && !icon_only)
+ else if (type == PROP_BOOLEAN && !name[0] && !icon_only)
icon= ICON_DOT;
w= ui_text_icon_width(layout, name, icon, 0);
h= UI_UNIT_Y;
/* increase height for arrays */
- if(index == RNA_NO_INDEX && len > 0) {
- if(!name[0] && icon == ICON_NONE)
+ if (index == RNA_NO_INDEX && len > 0) {
+ if (!name[0] && icon == ICON_NONE)
h= 0;
- if(ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER))
+ if (ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER))
h += 2*UI_UNIT_Y;
- else if(subtype == PROP_MATRIX)
+ else if (subtype == PROP_MATRIX)
h += ceil(sqrt(len))*UI_UNIT_Y;
else
h += len*UI_UNIT_Y;
}
- else if(ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
- if(type == PROP_BOOLEAN && name[0])
+ else if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
+ if (type == PROP_BOOLEAN && name[0])
w += UI_UNIT_X/5;
- else if(type == PROP_ENUM)
+ else if (type == PROP_ENUM)
w += UI_UNIT_X/4;
- else if(type == PROP_FLOAT || type == PROP_INT)
+ else if (type == PROP_FLOAT || type == PROP_INT)
w += UI_UNIT_X*3;
}
@@ -1037,26 +1040,26 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
len= (is_array) ? RNA_property_array_length(ptr, prop) : 0;
/* set name and icon */
- if(!name)
+ if (!name)
name= RNA_property_ui_name(prop);
- if(icon == ICON_NONE)
+ if (icon == ICON_NONE)
icon= RNA_property_ui_icon(prop);
- if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
+ if (ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
name= ui_item_name_add_colon(name, namestr);
- else if(type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX)
+ else if (type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX)
name= ui_item_name_add_colon(name, namestr);
- else if(type == PROP_ENUM && index != RNA_ENUM_VALUE)
+ else if (type == PROP_ENUM && index != RNA_ENUM_VALUE)
name= ui_item_name_add_colon(name, namestr);
- if(layout->root->type == UI_LAYOUT_MENU) {
- if(type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) {
- if(is_array) icon= (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+ if (layout->root->type == UI_LAYOUT_MENU) {
+ if (type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) {
+ if (is_array) icon= (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
else icon= (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
}
- else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
+ else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) {
int enum_value= RNA_property_enum_get(ptr, prop);
- if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+ if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
icon= (enum_value & value)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
}
else {
@@ -1078,39 +1081,39 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
uiBlockSetEmboss(block, UI_EMBOSSN);
/* array property */
- if(index == RNA_NO_INDEX && is_array)
+ if (index == RNA_NO_INDEX && is_array)
ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only);
/* enum item */
- else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
- if(icon && name[0] && !icon_only)
+ else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) {
+ if (icon && name[0] && !icon_only)
uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
- else if(icon)
+ else if (icon)
uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
else
uiDefButR_prop(block, ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
}
/* expanded enum */
- else if(type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG))
+ else if (type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG))
ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only);
/* property with separate label */
- else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
+ else if (type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
ui_but_add_search(but, ptr, prop, NULL, NULL);
- if(layout->redalert)
+ if (layout->redalert)
uiButSetFlag(but, UI_BUT_REDALERT);
}
/* single button */
else {
- but= uiDefAutoButR(block, ptr, prop, index, name, icon, 0, 0, w, h);
+ but = uiDefAutoButR(block, ptr, prop, index, name, icon, 0, 0, w, h);
- if(slider && but->type==NUM)
+ if (slider && but->type==NUM)
but->type= NUMSLI;
- if(toggle && but->type==OPTION)
+ if (toggle && but->type==OPTION)
but->type= TOG;
- if(layout->redalert)
+ if (layout->redalert)
uiButSetFlag(but, UI_BUT_REDALERT);
}
@@ -1122,7 +1125,7 @@ void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, int flag,
{
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
ui_item_disabled(layout, propname);
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
@@ -1135,7 +1138,7 @@ void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA
{
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
- if(!prop || RNA_property_type(prop) != PROP_ENUM) {
+ if (!prop || RNA_property_type(prop) != PROP_ENUM) {
ui_item_disabled(layout, propname);
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
@@ -1150,7 +1153,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
EnumPropertyItem *item;
int ivalue, a, free;
- if(!prop || RNA_property_type(prop) != PROP_ENUM) {
+ if (!prop || RNA_property_type(prop) != PROP_ENUM) {
ui_item_disabled(layout, propname);
RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
@@ -1158,7 +1161,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
RNA_property_enum_items_gettexted(layout->root->block->evil_C, ptr, prop, &item, NULL, &free);
- if(!RNA_enum_value_from_id(item, value, &ivalue)) {
+ if (!RNA_enum_value_from_id(item, value, &ivalue)) {
if (free) {
MEM_freeN(item);
}
@@ -1167,8 +1170,8 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
return;
}
- for(a=0; item[a].identifier; a++) {
- if(item[a].value == ivalue) {
+ for (a=0; item[a].identifier; a++) {
+ if (item[a].value == ivalue) {
uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, name ? name : item[a].name, icon ? icon : item[a].icon);
break;
}
@@ -1187,13 +1190,13 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
ui_item_disabled(layout, propname);
RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
- if(RNA_property_type(prop) != PROP_ENUM) {
+ if (RNA_property_type(prop) != PROP_ENUM) {
RNA_warning("not an enum property: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -1205,13 +1208,13 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
- for(i=0; i<totitem; i++) {
- if(item[i].identifier[0]) {
+ for (i=0; i<totitem; i++) {
+ if (item[i].identifier[0]) {
uiItemEnumR(column, item[i].name, ICON_NONE, ptr, propname, item[i].value);
}
else {
- if(item[i].name) {
- if(i != 0) {
+ if (item[i].name) {
+ if (i != 0) {
column= uiLayoutColumn(split, 0);
/* inconsistent, but menus with labels do not look good flipped */
block->flag |= UI_BLOCK_NO_FLIP;
@@ -1263,17 +1266,17 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
/* build a temporary list of relevant items first */
RNA_PROP_BEGIN(&but->rnasearchpoin, itemptr, but->rnasearchprop) {
- if(flag & PROP_ID_SELF_CHECK)
- if(itemptr.data == but->rnapoin.id.data)
+ if (flag & PROP_ID_SELF_CHECK)
+ if (itemptr.data == but->rnapoin.id.data)
continue;
/* use filter */
- if(RNA_property_type(but->rnaprop)==PROP_POINTER) {
- if(RNA_property_pointer_poll(&but->rnapoin, but->rnaprop, &itemptr)==0)
+ if (RNA_property_type(but->rnaprop)==PROP_POINTER) {
+ if (RNA_property_pointer_poll(&but->rnapoin, but->rnaprop, &itemptr)==0)
continue;
}
- if(itemptr.type && RNA_struct_is_ID(itemptr.type)) {
+ if (itemptr.type && RNA_struct_is_ID(itemptr.type)) {
ID *id= itemptr.data;
char name_ui[MAX_ID_NAME];
@@ -1290,8 +1293,8 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
iconid = 0;
}
- if(name) {
- if(skip_filter || BLI_strcasestr(name, str)) {
+ if (name) {
+ if (skip_filter || BLI_strcasestr(name, str)) {
cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
cis->name = MEM_dupallocN(name);
cis->index = i;
@@ -1332,10 +1335,10 @@ static void search_id_collection(StructRNA *ptype, PointerRNA *ptr, PropertyRNA
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) {
+ if (RNA_property_type(iprop) == PROP_COLLECTION) {
srna= RNA_property_pointer_type(ptr, iprop);
- if(ptype == srna) {
+ if (ptype == srna) {
*prop= iprop;
break;
}
@@ -1350,8 +1353,8 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
PointerRNA sptr;
/* for ID's we do automatic lookup */
- if(!searchprop) {
- if(RNA_property_type(prop) == PROP_POINTER) {
+ if (!searchprop) {
+ if (RNA_property_type(prop) == PROP_POINTER) {
ptype= RNA_property_pointer_type(ptr, prop);
search_id_collection(ptype, &sptr, &searchprop);
searchptr= &sptr;
@@ -1359,7 +1362,7 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
}
/* turn button into search button */
- if(searchprop) {
+ if (searchprop) {
but->type= SEARCH_MENU;
but->hardmax= MAX2(but->hardmax, 256);
but->rnasearchpoin= *searchptr;
@@ -1382,13 +1385,13 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
/* validate arguments */
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
type= RNA_property_type(prop);
- if(!ELEM(type, PROP_POINTER, PROP_STRING)) {
+ if (!ELEM(type, PROP_POINTER, PROP_STRING)) {
RNA_warning("Property %s must be a pointer or string", propname);
return;
}
@@ -1396,7 +1399,7 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
searchprop= RNA_struct_find_property(searchptr, searchpropname);
- if(!searchprop) {
+ if (!searchprop) {
RNA_warning("search collection property not found: %s.%s", RNA_struct_identifier(ptr->type), searchpropname);
return;
}
@@ -1406,15 +1409,15 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
}
/* get icon & name */
- if(icon==ICON_NONE) {
- if(type == PROP_POINTER)
+ if (icon==ICON_NONE) {
+ if (type == PROP_POINTER)
icontype= RNA_property_pointer_type(ptr, prop);
else
icontype= RNA_property_pointer_type(searchptr, searchprop);
icon= RNA_struct_ui_icon(icontype);
}
- if(!name)
+ if (!name)
name= RNA_property_ui_name(prop);
/* create button */
@@ -1445,35 +1448,35 @@ static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCre
uiBlockSetCurLayout(block, layout);
- if(layout->root->type == UI_LAYOUT_HEADER)
+ if (layout->root->type == UI_LAYOUT_HEADER)
uiBlockSetEmboss(block, UI_EMBOSS);
- if(!name)
+ if (!name)
name= "";
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
w= ui_text_icon_width(layout, name, icon, 1);
h= UI_UNIT_Y;
- if(layout->root->type == UI_LAYOUT_HEADER) /* ugly .. */
+ if (layout->root->type == UI_LAYOUT_HEADER) /* ugly .. */
w -= 10;
- if(name[0] && icon)
- but= uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, tip);
- else if(icon)
- but= uiDefIconMenuBut(block, func, arg, icon, 0, 0, w, h, tip);
+ if (name[0] && icon)
+ but = uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, tip);
+ else if (icon)
+ but = uiDefIconMenuBut(block, func, arg, icon, 0, 0, w, h, tip);
else
- but= uiDefMenuBut(block, func, arg, name, 0, 0, w, h, tip);
+ but = uiDefMenuBut(block, func, arg, name, 0, 0, w, h, tip);
- if(argN) { /* ugly .. */
+ if (argN) { /* ugly .. */
but->poin= (char*)but;
but->func_argN= argN;
}
- if(layout->root->type == UI_LAYOUT_HEADER)
+ if (layout->root->type == UI_LAYOUT_HEADER)
uiBlockSetEmboss(block, UI_EMBOSS);
- else if(ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR)) {
+ else if (ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR)) {
but->type= MENU;
but->flag |= UI_TEXT_LEFT;
}
@@ -1483,18 +1486,18 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const
{
MenuType *mt;
- mt= WM_menutype_find(menuname, FALSE);
+ mt = WM_menutype_find(menuname, FALSE);
- if(mt==NULL) {
+ if (mt==NULL) {
RNA_warning("not found %s", menuname);
return;
}
- if(!name) {
- name= IFACE_(mt->label);
+ if (!name) {
+ name = IFACE_(mt->label);
}
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL, mt->description);
@@ -1509,19 +1512,19 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
uiBlockSetCurLayout(block, layout);
- if(!name)
+ if (!name)
name= "";
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
w= ui_text_icon_width(layout, name, icon, 0);
- if(icon && name[0])
- but= uiDefIconTextBut(block, LABEL, 0, icon, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
- else if(icon)
- but= uiDefIconBut(block, LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ if (icon && name[0])
+ but = uiDefIconTextBut(block, LABEL, 0, icon, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ else if (icon)
+ but = uiDefIconBut(block, LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
else
- but= uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
return but;
}
@@ -1535,8 +1538,8 @@ void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon)
{
uiBut *but= uiItemL_(layout, name, icon);
- if(ptr && ptr->type)
- if(RNA_struct_is_ID(ptr->type))
+ if (ptr && ptr->type)
+ if (RNA_struct_is_ID(ptr->type))
uiButSetDragID(but, ptr->id.data);
}
@@ -1551,16 +1554,16 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval)
uiBlockSetCurLayout(block, layout);
- if(!name)
+ if (!name)
name= "";
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
w= ui_text_icon_width(layout, name, icon, 0);
- if(icon && name[0])
+ if (icon && name[0])
uiDefIconTextButF(block, BUT, argval, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, "");
- else if(icon)
+ else if (icon)
uiDefIconButF(block, BUT, argval, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, "");
else
uiDefButF(block, BUT, argval, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, "");
@@ -1578,7 +1581,7 @@ void uiItemS(uiLayout *layout)
/* level items */
void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg)
{
- if(!func)
+ if (!func)
return;
ui_item_menu(layout, name, icon, func, arg, NULL, "");
@@ -1586,7 +1589,7 @@ void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc
typedef struct MenuItemLevel {
int opcontext;
- /* dont use pointers to the strings because python can dynamically
+ /* don't use pointers to the strings because python can dynamically
* allocate strings and free before the menu draws, see [#27304] */
char opname[OP_MAX_TYPENAME];
char propname[MAX_IDPROP_NAME];
@@ -1608,15 +1611,15 @@ void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname,
UI_OPERATOR_ERROR_RET(ot, opname, return);
- if(!ot->srna) {
+ if (!ot->srna) {
ui_item_disabled(layout, opname);
RNA_warning("operator missing srna '%s'", opname);
return;
}
- if(!name)
+ if (!name)
name= ot->name;
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
lvl= MEM_callocN(sizeof(MenuItemLevel), "MenuItemLevel");
@@ -1641,15 +1644,15 @@ void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propn
PropertyRNA *prop;
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
ui_item_disabled(layout, propname);
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
- if(!name)
+ if (!name)
name= RNA_property_ui_name(prop);
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
lvl= MEM_callocN(sizeof(MenuItemLevel), "MenuItemLevel");
@@ -1671,13 +1674,13 @@ static void ui_litem_estimate_row(uiLayout *litem)
litem->w= 0;
litem->h= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
litem->w += itemw;
litem->h= MAX2(itemh, litem->h);
- if(item->next)
+ if (item->next)
litem->w += litem->space;
}
}
@@ -1699,16 +1702,16 @@ static void ui_litem_layout_row(uiLayout *litem)
totw= 0;
tot= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
totw += itemw;
tot++;
}
- if(totw == 0)
+ if (totw == 0)
return;
- if(w != 0)
+ if (w != 0)
w -= (tot-1)*litem->space;
fixedw= 0;
@@ -1718,21 +1721,21 @@ static void ui_litem_layout_row(uiLayout *litem)
x= 0;
flag= 0;
- for(item=litem->items.first; item; item=item->next) {
- if(item->flag)
+ for (item=litem->items.first; item; item=item->next) {
+ if (item->flag)
continue;
ui_item_size(item, &itemw, &itemh);
minw= ui_litem_min_width(itemw);
- if(w - lastw > 0)
+ if (w - lastw > 0)
neww= ui_item_fit(itemw, x, totw, w-lastw, !item->next, litem->alignment, NULL);
else
neww= 0; /* no space left, all will need clamping to minimum size */
x += neww;
- if((neww < minw || itemw == minw) && w != 0) {
+ if ((neww < minw || itemw == minw) && w != 0) {
/* fixed size */
item->flag= 1;
fixedw += minw;
@@ -1747,17 +1750,17 @@ static void ui_litem_layout_row(uiLayout *litem)
}
lastw= fixedw;
- } while(flag);
+ } while (flag);
freex= 0;
fixedx= 0;
x= litem->x;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
minw= ui_litem_min_width(itemw);
- if(item->flag) {
+ if (item->flag) {
/* fixed minimum size items */
itemw= ui_item_fit(minw, fixedx, fixedw, MIN2(w, fixedw), !item->next, litem->alignment, NULL);
fixedx += itemw;
@@ -1770,12 +1773,12 @@ static void ui_litem_layout_row(uiLayout *litem)
/* align right/center */
offset= 0;
- if(litem->alignment == UI_LAYOUT_ALIGN_RIGHT) {
- if(freew > 0 && freew < w-fixedw)
+ if (litem->alignment == UI_LAYOUT_ALIGN_RIGHT) {
+ if (freew > 0 && freew < w-fixedw)
offset= (w - fixedw) - freew;
}
- else if(litem->alignment == UI_LAYOUT_ALIGN_CENTER) {
- if(freew > 0 && freew < w-fixedw)
+ else if (litem->alignment == UI_LAYOUT_ALIGN_CENTER) {
+ if (freew > 0 && freew < w-fixedw)
offset= ((w - fixedw) - freew)/2;
}
@@ -1783,7 +1786,7 @@ static void ui_litem_layout_row(uiLayout *litem)
ui_item_position(item, x+offset, y-itemh, itemw, itemh);
x += itemw;
- if(item->next)
+ if (item->next)
x += litem->space;
}
@@ -1802,13 +1805,13 @@ static void ui_litem_estimate_column(uiLayout *litem)
litem->w= 0;
litem->h= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
litem->w= MAX2(litem->w, itemw);
litem->h += itemh;
- if(item->next)
+ if (item->next)
litem->h += litem->space;
}
}
@@ -1821,13 +1824,13 @@ static void ui_litem_layout_column(uiLayout *litem)
x= litem->x;
y= litem->y;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, NULL, &itemh);
y -= itemh;
ui_item_position(item, x, y, litem->w, itemh);
- if(item->next)
+ if (item->next)
y -= litem->space;
}
@@ -1844,7 +1847,7 @@ static void ui_litem_estimate_root(uiLayout *UNUSED(litem))
static void ui_litem_layout_root(uiLayout *litem)
{
- if(litem->root->type == UI_LAYOUT_HEADER)
+ if (litem->root->type == UI_LAYOUT_HEADER)
ui_litem_layout_row(litem);
else
ui_litem_layout_column(litem);
@@ -1872,16 +1875,16 @@ static void ui_litem_layout_box(uiLayout *litem)
litem->x += style->boxspace;
- if(w != 0) litem->w -= 2*style->boxspace;
- if(h != 0) litem->h -= 2*style->boxspace;
+ if (w != 0) litem->w -= 2*style->boxspace;
+ if (h != 0) litem->h -= 2*style->boxspace;
ui_litem_layout_column(litem);
litem->x -= style->boxspace;
litem->y -= style->boxspace;
- if(w != 0) litem->w += 2*style->boxspace;
- if(h != 0) litem->h += style->boxspace;
+ if (w != 0) litem->w += 2*style->boxspace;
+ if (h != 0) litem->h += style->boxspace;
/* roundbox around the sublayout */
but= box->roundbox;
@@ -1903,16 +1906,16 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
/* compute max needed width and total height */
toth= 0;
totitem= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
maxw= MAX2(maxw, itemw);
toth += itemh;
totitem++;
}
- if(flow->number <= 0) {
+ if (flow->number <= 0) {
/* auto compute number of columns, not very good */
- if(maxw == 0) {
+ if (maxw == 0) {
flow->totcol= 1;
return;
}
@@ -1934,7 +1937,7 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
/* create column per column */
col= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
y -= itemh + style->buttonspacey;
@@ -1943,7 +1946,7 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
maxw= MAX2(itemw, maxw);
/* decide to go to next one */
- if(col < flow->totcol-1 && emy <= -emh) {
+ if (col < flow->totcol-1 && emy <= -emh) {
x += maxw + litem->space;
maxw= 0;
y= 0;
@@ -1966,7 +1969,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
/* compute max needed width and total height */
toth= 0;
totitem= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
toth += itemh;
totitem++;
@@ -1983,7 +1986,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
/* create column per column */
col= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, NULL, &itemh);
itemw= ui_item_fit(1, x-litem->x, flow->totcol, w, col == flow->totcol-1, litem->alignment, &offset);
@@ -1994,7 +1997,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
miny= MIN2(miny, y);
/* decide to go to next one */
- if(col < flow->totcol-1 && emy <= -emh) {
+ if (col < flow->totcol-1 && emy <= -emh) {
x += itemw + style->columnspace;
y= litem->y;
col++;
@@ -2017,7 +2020,7 @@ static void ui_litem_estimate_absolute(uiLayout *litem)
litem->w= 0;
litem->h= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_offset(item, &itemx, &itemy);
ui_item_size(item, &itemw, &itemh);
@@ -2043,7 +2046,7 @@ static void ui_litem_layout_absolute(uiLayout *litem)
totw= 0;
toth= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_offset(item, &itemx, &itemy);
ui_item_size(item, &itemw, &itemh);
@@ -2057,25 +2060,25 @@ static void ui_litem_layout_absolute(uiLayout *litem)
totw -= minx;
toth -= miny;
- if(litem->w && totw > 0)
+ if (litem->w && totw > 0)
scalex= (float)litem->w/(float)totw;
- if(litem->h && toth > 0)
+ if (litem->h && toth > 0)
scaley= (float)litem->h/(float)toth;
x= litem->x;
y= litem->y - scaley*toth;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_offset(item, &itemx, &itemy);
ui_item_size(item, &itemw, &itemh);
- if(scalex != 1.0f) {
+ if (scalex != 1.0f) {
newx= (itemx - minx)*scalex;
itemw= (itemx - minx + itemw)*scalex - newx;
itemx= minx + newx;
}
- if(scaley != 1.0f) {
+ if (scaley != 1.0f) {
newy= (itemy - miny)*scaley;
itemh= (itemy - miny + itemh)*scaley - newy;
itemy= miny + newy;
@@ -2104,7 +2107,7 @@ static void ui_litem_layout_split(uiLayout *litem)
const int tot= BLI_countlist(&litem->items);
int itemh, x, y, w, colw=0;
- if(tot == 0)
+ if (tot == 0)
return;
x= litem->x;
@@ -2116,13 +2119,13 @@ static void ui_litem_layout_split(uiLayout *litem)
colw= w*percentage;
colw= MAX2(colw, 0);
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, NULL, &itemh);
ui_item_position(item, x, y-itemh, colw, itemh);
x += colw;
- if(item->next) {
+ if (item->next) {
colw= (w - (int)(w*percentage))/(tot-1);
colw= MAX2(colw, 0);
@@ -2145,7 +2148,7 @@ static void ui_litem_estimate_overlap(uiLayout *litem)
litem->w= 0;
litem->h= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
litem->w= MAX2(itemw, litem->w);
@@ -2161,7 +2164,7 @@ static void ui_litem_layout_overlap(uiLayout *litem)
x= litem->x;
y= litem->y;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
ui_item_position(item, x, y-itemh, litem->w, itemh);
@@ -2421,16 +2424,16 @@ static void ui_item_scale(uiLayout *litem, float scale[2])
uiItem *item;
int x, y, w, h;
- for(item=litem->items.last; item; item=item->prev) {
+ for (item=litem->items.last; item; item=item->prev) {
ui_item_size(item, &w, &h);
ui_item_offset(item, &x, &y);
- if(scale[0] != 0.0f) {
+ if (scale[0] != 0.0f) {
x *= scale[0];
w *= scale[0];
}
- if(scale[1] != 0.0f) {
+ if (scale[1] != 0.0f) {
y *= scale[1];
h *= scale[1];
}
@@ -2443,16 +2446,16 @@ static void ui_item_estimate(uiItem *item)
{
uiItem *subitem;
- if(item->type != ITEM_BUTTON) {
+ if (item->type != ITEM_BUTTON) {
uiLayout *litem= (uiLayout*)item;
- for(subitem=litem->items.first; subitem; subitem=subitem->next)
+ for (subitem=litem->items.first; subitem; subitem=subitem->next)
ui_item_estimate(subitem);
- if(litem->items.first == NULL)
+ if (litem->items.first == NULL)
return;
- if(litem->scale[0] != 0.0f || litem->scale[1] != 0.0f)
+ if (litem->scale[0] != 0.0f || litem->scale[1] != 0.0f)
ui_item_scale(litem, litem->scale);
switch(litem->item.type) {
@@ -2492,16 +2495,16 @@ static void ui_item_align(uiLayout *litem, short nr)
uiButtonItem *bitem;
uiLayoutItemBx *box;
- for(item=litem->items.last; item; item=item->prev) {
- if(item->type == ITEM_BUTTON) {
+ for (item=litem->items.last; item; item=item->prev) {
+ if (item->type == ITEM_BUTTON) {
bitem= (uiButtonItem*)item;
- if(ui_but_can_align(bitem->but))
- if(!bitem->but->alignnr)
+ if (ui_but_can_align(bitem->but))
+ if (!bitem->but->alignnr)
bitem->but->alignnr= nr;
}
- else if(item->type == ITEM_LAYOUT_ABSOLUTE);
- else if(item->type == ITEM_LAYOUT_OVERLAP);
- else if(item->type == ITEM_LAYOUT_BOX) {
+ else if (item->type == ITEM_LAYOUT_ABSOLUTE);
+ else if (item->type == ITEM_LAYOUT_OVERLAP);
+ else if (item->type == ITEM_LAYOUT_BOX) {
box= (uiLayoutItemBx*)item;
box->roundbox->alignnr= nr;
BLI_remlink(&litem->root->block->buttons, box->roundbox);
@@ -2517,8 +2520,8 @@ static void ui_item_flag(uiLayout *litem, int flag)
uiItem *item;
uiButtonItem *bitem;
- for(item=litem->items.last; item; item=item->prev) {
- if(item->type == ITEM_BUTTON) {
+ for (item=litem->items.last; item; item=item->prev) {
+ if (item->type == ITEM_BUTTON) {
bitem= (uiButtonItem*)item;
bitem->but->flag |= flag;
}
@@ -2531,17 +2534,17 @@ static void ui_item_layout(uiItem *item)
{
uiItem *subitem;
- if(item->type != ITEM_BUTTON) {
+ if (item->type != ITEM_BUTTON) {
uiLayout *litem= (uiLayout*)item;
- if(litem->items.first == NULL)
+ if (litem->items.first == NULL)
return;
- if(litem->align)
+ if (litem->align)
ui_item_align(litem, ++litem->root->block->alignnr);
- if(!litem->active)
+ if (!litem->active)
ui_item_flag(litem, UI_BUT_INACTIVE);
- if(!litem->enabled)
+ if (!litem->enabled)
ui_item_flag(litem, UI_BUT_DISABLED);
switch(litem->item.type) {
@@ -2573,31 +2576,31 @@ static void ui_item_layout(uiItem *item)
break;
}
- for(subitem=litem->items.first; subitem; subitem=subitem->next)
+ for (subitem=litem->items.first; subitem; subitem=subitem->next)
ui_item_layout(subitem);
}
}
static void ui_layout_end(uiBlock *block, uiLayout *layout, int *x, int *y)
{
- if(layout->root->handlefunc)
+ if (layout->root->handlefunc)
uiBlockSetHandleFunc(block, layout->root->handlefunc, layout->root->argv);
ui_item_estimate(&layout->item);
ui_item_layout(&layout->item);
- if(x) *x= layout->x;
- if(y) *y= layout->y;
+ if (x) *x= layout->x;
+ if (y) *y= layout->y;
}
static void ui_layout_free(uiLayout *layout)
{
uiItem *item, *next;
- for(item=layout->items.first; item; item=next) {
+ for (item=layout->items.first; item; item=next) {
next= item->next;
- if(item->type == ITEM_BUTTON)
+ if (item->type == ITEM_BUTTON)
MEM_freeN(item);
else
ui_layout_free((uiLayout*)item);
@@ -2628,10 +2631,10 @@ uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int siz
layout->enabled= 1;
layout->context= NULL;
- if(type == UI_LAYOUT_MENU)
+ if (type == UI_LAYOUT_MENU)
layout->space= 0;
- if(dir == UI_LAYOUT_HORIZONTAL) {
+ if (dir == UI_LAYOUT_HORIZONTAL) {
layout->h= size;
layout->root->emh= em*UI_UNIT_Y;
}
@@ -2672,7 +2675,7 @@ void ui_layout_add_but(uiLayout *layout, uiBut *but)
bitem->but= but;
BLI_addtail(&layout->items, bitem);
- if(layout->context) {
+ if (layout->context) {
but->context= layout->context;
but->context->used= 1;
}
@@ -2693,12 +2696,12 @@ void uiBlockLayoutResolve(uiBlock *block, int *x, int *y)
{
uiLayoutRoot *root;
- if(x) *x= 0;
- if(y) *y= 0;
+ if (x) *x= 0;
+ if (y) *y= 0;
block->curlayout= NULL;
- for(root=block->layouts.first; root; root=root->next) {
+ for (root=block->layouts.first; root; root=root->next) {
/* NULL in advance so we don't interfere when adding button */
ui_layout_end(block, root->layout, x, y);
ui_layout_free(root->layout);
@@ -2730,13 +2733,13 @@ static void ui_intro_button(DynStr *ds, uiButtonItem *bitem)
BLI_dynstr_appendf(ds, "'draw_string':'''%s''', ", but->drawstr);
BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : ""); // not exactly needed, rna has this
- if(but->optype) {
+ if (but->optype) {
char *opstr = WM_operator_pystring(but->block->evil_C, but->optype, but->opptr, 0);
BLI_dynstr_appendf(ds, "'operator':'''%s''', ", opstr ? opstr : "");
MEM_freeN(opstr);
}
- if(but->rnaprop) {
+ if (but->rnaprop) {
BLI_dynstr_appendf(ds, "'rna':'%s.%s[%d]', ", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop), but->rnaindex);
}
@@ -2748,7 +2751,7 @@ static void ui_intro_items(DynStr *ds, ListBase *lb)
BLI_dynstr_append(ds, "[");
- for(item=lb->first; item; item=item->next) {
+ for (item=lb->first; item; item=item->next) {
BLI_dynstr_append(ds, "{");
@@ -2779,7 +2782,7 @@ static void ui_intro_items(DynStr *ds, ListBase *lb)
BLI_dynstr_append(ds, "}");
- if(item != lb->last)
+ if (item != lb->last)
BLI_dynstr_append(ds, ", ");
}
BLI_dynstr_append(ds, "], ");
@@ -2815,24 +2818,24 @@ static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt,
/* this function does not initialize the layout, functions can be called on the layout before and after */
void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag)
{
- if(!op->properties) {
+ if (!op->properties) {
IDPropertyTemplate val = {0};
op->properties= IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
}
- if(flag & UI_LAYOUT_OP_SHOW_TITLE) {
+ if (flag & UI_LAYOUT_OP_SHOW_TITLE) {
uiItemL(layout, op->type->name, ICON_NONE);
}
/* poll() on this operator may still fail, at the moment there is no nice feedback when this happens
* just fails silently */
- if(!WM_operator_repeat_check(C, op)) {
+ if (!WM_operator_repeat_check(C, op)) {
uiBlockSetButLock(uiLayoutGetBlock(layout), TRUE, "Operator cannot redo");
uiItemL(layout, "* Redo Unsupported *", ICON_NONE); // XXX, could give some nicer feedback or not show redo panel at all?
}
/* menu */
- if(op->type->flag & OPTYPE_PRESET) {
+ if (op->type->flag & OPTYPE_PRESET) {
/* XXX, no simple way to get WM_MT_operator_presets.bl_label from python! Label remains the same always! */
PointerRNA op_ptr;
uiLayout *row;
@@ -2852,7 +2855,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
op_ptr= uiItemFullO(row, "WM_OT_operator_preset_add", "", ICON_ZOOMOUT, op_ptr.data, WM_OP_INVOKE_DEFAULT, 0);
}
- if(op->type->ui) {
+ if (op->type->ui) {
op->layout= layout;
op->type->ui((bContext*)C, op);
op->layout= NULL;
@@ -2869,7 +2872,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
/* main draw call */
empty= uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0;
- if(empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) {
+ if (empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) {
uiItemL(layout, IFACE_("No Properties"), ICON_NONE);
}
}
@@ -2893,7 +2896,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
{
uiBut *but;
- for(but= uiLayoutGetBlock(layout)->buttons.first; but; but= but->next) {
+ for (but= uiLayoutGetBlock(layout)->buttons.first; but; but= but->next) {
/* no undo for buttons for operator redo panels */
uiButClearFlag(but, UI_BUT_UNDO);
@@ -2910,7 +2913,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
/* this is a bit of a hack but best keep it in one place at least */
MenuType *uiButGetMenuType(uiBut *but)
{
- if(but->menu_create_func == ui_item_menutype_func) {
+ if (but->menu_create_func == ui_item_menutype_func) {
return (MenuType *)but->poin;
}
else {
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 5ca3f730006..4e97a38fe25 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -89,7 +89,7 @@ static void eyedropper_exit(bContext *C, wmOperator *op)
{
WM_cursor_restore(CTX_wm_window(C));
- if(op->customdata)
+ if (op->customdata)
MEM_freeN(op->customdata);
op->customdata= NULL;
}
@@ -102,7 +102,7 @@ static int eyedropper_cancel(bContext *C, wmOperator *op)
static void eyedropper_sample(bContext *C, Eyedropper *eye, int mx, int my)
{
- if(RNA_property_type(eye->prop) == PROP_FLOAT) {
+ if (RNA_property_type(eye->prop) == PROP_FLOAT) {
Scene *scene = CTX_data_scene(C);
const int color_manage = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
float col[4];
@@ -135,7 +135,7 @@ static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event)
case RIGHTMOUSE:
return eyedropper_cancel(C, op);
case LEFTMOUSE:
- if(event->val==KM_RELEASE) {
+ if (event->val==KM_RELEASE) {
eyedropper_sample(C, eye, event->x, event->y);
eyedropper_exit(C, op);
return OPERATOR_FINISHED;
@@ -157,7 +157,8 @@ static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
- } else {
+ }
+ else {
eyedropper_exit(C, op);
return OPERATOR_CANCELLED;
}
@@ -175,7 +176,8 @@ static int eyedropper_exec (bContext *C, wmOperator *op)
eyedropper_exit(C, op);
return OPERATOR_FINISHED;
- } else {
+ }
+ else {
return OPERATOR_CANCELLED;
}
}
@@ -189,19 +191,19 @@ static int eyedropper_poll(bContext *C)
static void UI_OT_eyedropper(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Eyedropper";
- ot->idname= "UI_OT_eyedropper";
- ot->description= "Sample a color from the Blender Window to store in a property";
+ ot->name = "Eyedropper";
+ ot->idname = "UI_OT_eyedropper";
+ ot->description = "Sample a color from the Blender Window to store in a property";
/* api callbacks */
- ot->invoke= eyedropper_invoke;
- ot->modal= eyedropper_modal;
- ot->cancel= eyedropper_cancel;
- ot->exec= eyedropper_exec;
- ot->poll= eyedropper_poll;
+ ot->invoke = eyedropper_invoke;
+ ot->modal = eyedropper_modal;
+ ot->cancel = eyedropper_cancel;
+ ot->exec = eyedropper_exec;
+ ot->poll = eyedropper_poll;
/* flags */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
/* properties */
}
@@ -219,15 +221,15 @@ static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
static void UI_OT_reset_default_theme(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reset to Default Theme";
- ot->idname= "UI_OT_reset_default_theme";
- ot->description= "Reset to the default theme colors";
+ ot->name = "Reset to Default Theme";
+ ot->idname = "UI_OT_reset_default_theme";
+ ot->description = "Reset to the default theme colors";
/* callbacks */
- ot->exec= reset_default_theme_exec;
+ ot->exec = reset_default_theme_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
/* Copy Data Path Operator ------------------------ */
@@ -259,16 +261,16 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
static void UI_OT_copy_data_path_button(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Data Path";
- ot->idname= "UI_OT_copy_data_path_button";
- ot->description= "Copy the RNA data path for this property to the clipboard";
+ ot->name = "Copy Data Path";
+ ot->idname = "UI_OT_copy_data_path_button";
+ ot->description = "Copy the RNA data path for this property to the clipboard";
/* callbacks */
- ot->exec= copy_data_path_button_exec;
+ ot->exec = copy_data_path_button_exec;
//op->poll= ??? // TODO: need to have some valid property before this can be done
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
/* Reset to Default Values Button Operator ------------------------ */
@@ -296,7 +298,7 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
/* if there is a valid property that is editable... */
if (ptr.data && prop && RNA_property_editable(&ptr, prop)) {
- if(RNA_property_reset(&ptr, prop, (all)? -1: index)) {
+ if (RNA_property_reset(&ptr, prop, (all)? -1: index)) {
/* perform updates required for this property */
RNA_property_update(C, &ptr, prop);
@@ -307,12 +309,12 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
}
}
- /* Since we dont want to undo _all_ edits to settings, eg window
+ /* Since we don't want to undo _all_ edits to settings, eg window
* edits on the screen or on operator settings.
* it might be better to move undo's inline - campbell */
- if(success) {
+ if (success) {
ID *id= ptr.id.data;
- if(id && ID_CHECK_UNDO(id)) {
+ if (id && ID_CHECK_UNDO(id)) {
/* do nothing, go ahead with undo */
}
else {
@@ -327,16 +329,16 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
static void UI_OT_reset_default_button(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reset to Default Value";
- ot->idname= "UI_OT_reset_default_button";
- ot->description= "Reset this property's value to its default value";
+ ot->name = "Reset to Default Value";
+ ot->idname = "UI_OT_reset_default_button";
+ ot->description = "Reset this property's value to its default value";
/* callbacks */
- ot->poll= reset_default_button_poll;
- ot->exec= reset_default_button_exec;
+ ot->poll = reset_default_button_poll;
+ ot->exec = reset_default_button_exec;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array");
@@ -346,13 +348,13 @@ static void UI_OT_reset_default_button(wmOperatorType *ot)
static int copy_to_selected_list(bContext *C, PointerRNA *ptr, ListBase *lb)
{
- if(RNA_struct_is_a(ptr->type, &RNA_Object))
+ if (RNA_struct_is_a(ptr->type, &RNA_Object))
*lb = CTX_data_collection_get(C, "selected_editable_objects");
- else if(RNA_struct_is_a(ptr->type, &RNA_EditBone))
+ else if (RNA_struct_is_a(ptr->type, &RNA_EditBone))
*lb = CTX_data_collection_get(C, "selected_editable_bones");
- else if(RNA_struct_is_a(ptr->type, &RNA_PoseBone))
+ else if (RNA_struct_is_a(ptr->type, &RNA_PoseBone))
*lb = CTX_data_collection_get(C, "selected_pose_bones");
- else if(RNA_struct_is_a(ptr->type, &RNA_Sequence))
+ else if (RNA_struct_is_a(ptr->type, &RNA_Sequence))
*lb = CTX_data_collection_get(C, "selected_editable_sequences");
else
return 0;
@@ -372,9 +374,9 @@ static int copy_to_selected_button_poll(bContext *C)
CollectionPointerLink *link;
ListBase lb;
- if(copy_to_selected_list(C, &ptr, &lb)) {
- for(link= lb.first; link; link=link->next)
- if(link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop))
+ if (copy_to_selected_list(C, &ptr, &lb)) {
+ for (link= lb.first; link; link=link->next)
+ if (link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop))
success= 1;
BLI_freelistN(&lb);
@@ -399,10 +401,10 @@ static int copy_to_selected_button_exec(bContext *C, wmOperator *op)
CollectionPointerLink *link;
ListBase lb;
- if(copy_to_selected_list(C, &ptr, &lb)) {
- for(link= lb.first; link; link=link->next) {
- if(link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop)) {
- if(RNA_property_copy(&link->ptr, &ptr, prop, (all)? -1: index)) {
+ if (copy_to_selected_list(C, &ptr, &lb)) {
+ for (link= lb.first; link; link=link->next) {
+ if (link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop)) {
+ if (RNA_property_copy(&link->ptr, &ptr, prop, (all)? -1: index)) {
RNA_property_update(C, &link->ptr, prop);
success= 1;
}
@@ -419,16 +421,16 @@ static int copy_to_selected_button_exec(bContext *C, wmOperator *op)
static void UI_OT_copy_to_selected_button(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy To Selected";
- ot->idname= "UI_OT_copy_to_selected_button";
- ot->description= "Copy property from this object to selected objects or bones";
+ ot->name = "Copy To Selected";
+ ot->idname = "UI_OT_copy_to_selected_button";
+ ot->description = "Copy property from this object to selected objects or bones";
/* callbacks */
- ot->poll= copy_to_selected_button_poll;
- ot->exec= copy_to_selected_button_exec;
+ ot->poll = copy_to_selected_button_poll;
+ ot->exec = copy_to_selected_button_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array");
@@ -474,13 +476,13 @@ static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op))
static void UI_OT_reports_to_textblock(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reports to Text Block";
- ot->idname= "UI_OT_reports_to_textblock";
- ot->description= "Write the reports ";
+ ot->name = "Reports to Text Block";
+ ot->idname = "UI_OT_reports_to_textblock";
+ ot->description = "Write the reports ";
/* callbacks */
- ot->poll= reports_to_text_poll;
- ot->exec= reports_to_text_exec;
+ ot->poll = reports_to_text_poll;
+ ot->exec = reports_to_text_exec;
}
#ifdef WITH_PYTHON
@@ -536,7 +538,7 @@ static int ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b)
/* this just needs to be a 'good-enough' comparison so we can know beyond
* reasonable doubt that these buttons are the same between redraws.
* if this fails it only means edit-source fails - campbell */
- if( (but_a->x1 == but_b->x1) &&
+ if ( (but_a->x1 == but_b->x1) &&
(but_a->x2 == but_b->x2) &&
(but_a->y1 == but_b->y1) &&
(but_a->y2 == but_b->y2) &&
@@ -609,7 +611,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
/* naughty!, find text area to set, not good behavior
* but since this is a dev tool lets allow it - campbell */
ScrArea *sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0);
- if(sa) {
+ if (sa) {
SpaceText *st= sa->spacedata.first;
st->text= text;
}
@@ -647,7 +649,7 @@ static int editsource_exec(bContext *C, wmOperator *op)
/* redraw and get active button python info */
ED_region_do_draw(C, ar);
- for(BLI_ghashIterator_init(&ghi, ui_editsource_info->hash);
+ for (BLI_ghashIterator_init(&ghi, ui_editsource_info->hash);
!BLI_ghashIterator_isDone(&ghi);
BLI_ghashIterator_step(&ghi))
{
@@ -693,12 +695,12 @@ static int editsource_exec(bContext *C, wmOperator *op)
static void UI_OT_editsource(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reports to Text Block";
- ot->idname= "UI_OT_editsource";
- ot->description= "Edit source code for a button";
+ ot->name = "Reports to Text Block";
+ ot->idname = "UI_OT_editsource";
+ ot->description = "Edit source code for a button";
/* callbacks */
- ot->exec= editsource_exec;
+ ot->exec = editsource_exec;
}
#endif /* WITH_PYTHON */
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index b1099576505..08c96aaf0fb 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -103,17 +103,17 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
static int panel_aligned(ScrArea *sa, ARegion *ar)
{
- if(sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
+ if (sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
SpaceButs *sbuts= sa->spacedata.first;
return sbuts->align;
}
- else if(sa->spacetype==SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW)
+ else if (sa->spacetype==SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW)
return BUT_VERTICAL;
- else if(sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
+ else if (sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
return BUT_VERTICAL;
- else if(sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
+ else if (sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
return BUT_VERTICAL;
- else if(ELEM3(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS))
+ else if (ELEM3(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS))
return BUT_VERTICAL;
return 0;
@@ -126,34 +126,34 @@ static int panels_re_align(ScrArea *sa, ARegion *ar, Panel **r_pa)
*r_pa= NULL;
- if(sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
+ if (sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
SpaceButs *sbuts= sa->spacedata.first;
- if(sbuts->align)
- if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb)
+ if (sbuts->align)
+ if (sbuts->re_align || sbuts->mainbo!=sbuts->mainb)
return 1;
}
- else if(ar->regiontype==RGN_TYPE_UI)
+ else if (ar->regiontype==RGN_TYPE_UI)
return 1;
- else if(sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
+ else if (sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
return 1;
- else if(sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
+ else if (sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
return 1;
/* in case panel is added or disappears */
- for(pa=ar->panels.first; pa; pa=pa->next) {
- if((pa->runtime_flag & PNL_WAS_ACTIVE) && !(pa->runtime_flag & PNL_ACTIVE))
+ for (pa=ar->panels.first; pa; pa=pa->next) {
+ if ((pa->runtime_flag & PNL_WAS_ACTIVE) && !(pa->runtime_flag & PNL_ACTIVE))
return 1;
- if(!(pa->runtime_flag & PNL_WAS_ACTIVE) && (pa->runtime_flag & PNL_ACTIVE))
+ if (!(pa->runtime_flag & PNL_WAS_ACTIVE) && (pa->runtime_flag & PNL_ACTIVE))
return 1;
- if(pa->activedata)
+ if (pa->activedata)
active= 1;
}
/* in case we need to do an animation (size changes) */
- for(pa=ar->panels.first; pa; pa=pa->next) {
- if(pa->runtime_flag & PNL_ANIM_ALIGN) {
- if(!active)
+ for (pa=ar->panels.first; pa; pa=pa->next) {
+ if (pa->runtime_flag & PNL_ANIM_ALIGN) {
+ if (!active)
*r_pa= pa;
return 1;
}
@@ -183,14 +183,14 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
int align= panel_aligned(sa, ar);
/* check if Panel exists, then use that one */
- for(pa=ar->panels.first; pa; pa=pa->next)
- if(strncmp(pa->panelname, idname, UI_MAX_NAME_STR)==0)
- if(strncmp(pa->tabname, tabname, UI_MAX_NAME_STR)==0)
+ for (pa=ar->panels.first; pa; pa=pa->next)
+ if (strncmp(pa->panelname, idname, UI_MAX_NAME_STR)==0)
+ if (strncmp(pa->tabname, tabname, UI_MAX_NAME_STR)==0)
break;
newpanel= (pa == NULL);
- if(!newpanel) {
+ if (!newpanel) {
pa->type= pt;
}
else {
@@ -200,8 +200,8 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
BLI_strncpy(pa->panelname, idname, UI_MAX_NAME_STR);
BLI_strncpy(pa->tabname, tabname, UI_MAX_NAME_STR);
- if(pt->flag & PNL_DEFAULT_CLOSED) {
- if(align == BUT_VERTICAL)
+ if (pt->flag & PNL_DEFAULT_CLOSED) {
+ if (align == BUT_VERTICAL)
pa->flag |= PNL_CLOSEDY;
else
pa->flag |= PNL_CLOSEDX;
@@ -216,11 +216,11 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
BLI_addtail(&ar->panels, pa);
/* make new Panel tabbed? */
- if(hookname) {
- for(patab= ar->panels.first; patab; patab= patab->next) {
- if((patab->runtime_flag & PNL_ACTIVE) && patab->paneltab==NULL) {
- if(strncmp(hookname, patab->panelname, UI_MAX_NAME_STR)==0) {
- if(strncmp(tabname, patab->tabname, UI_MAX_NAME_STR)==0) {
+ if (hookname) {
+ for (patab= ar->panels.first; patab; patab= patab->next) {
+ if ((patab->runtime_flag & PNL_ACTIVE) && patab->paneltab==NULL) {
+ if (strncmp(hookname, patab->panelname, UI_MAX_NAME_STR)==0) {
+ if (strncmp(tabname, patab->tabname, UI_MAX_NAME_STR)==0) {
pa->paneltab= patab;
ui_panel_copy_offset(pa, patab);
break;
@@ -236,19 +236,19 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
/* if a new panel is added, we insert it right after the panel
* that was last added. this way new panels are inserted in the
* right place between versions */
- for(palast=ar->panels.first; palast; palast=palast->next)
- if(palast->runtime_flag & PNL_LAST_ADDED)
+ for (palast=ar->panels.first; palast; palast=palast->next)
+ if (palast->runtime_flag & PNL_LAST_ADDED)
break;
- if(newpanel) {
+ if (newpanel) {
pa->sortorder= (palast)? palast->sortorder+1: 0;
- for(panext=ar->panels.first; panext; panext=panext->next)
- if(panext != pa && panext->sortorder >= pa->sortorder)
+ for (panext=ar->panels.first; panext; panext=panext->next)
+ if (panext != pa && panext->sortorder >= pa->sortorder)
panext->sortorder++;
}
- if(palast)
+ if (palast)
palast->runtime_flag &= ~PNL_LAST_ADDED;
/* assign to block */
@@ -257,8 +257,8 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
*open= 0;
- if(pa->paneltab) return pa;
- if(pa->flag & PNL_CLOSED) return pa;
+ if (pa->paneltab) return pa;
+ if (pa->flag & PNL_CLOSED) return pa;
*open= 1;
@@ -269,23 +269,23 @@ void uiEndPanel(uiBlock *block, int width, int height)
{
Panel *pa= block->panel;
- if(pa->runtime_flag & PNL_NEW_ADDED) {
+ if (pa->runtime_flag & PNL_NEW_ADDED) {
pa->runtime_flag &= ~PNL_NEW_ADDED;
pa->sizex= width;
pa->sizey= height;
}
else {
/* check if we need to do an animation */
- if(!ELEM(width, 0, pa->sizex) || !ELEM(height, 0, pa->sizey)) {
+ if (!ELEM(width, 0, pa->sizex) || !ELEM(height, 0, pa->sizey)) {
pa->runtime_flag |= PNL_ANIM_ALIGN;
- if(height != 0)
+ if (height != 0)
pa->ofsy += pa->sizey-height;
}
/* update width/height if non-zero */
- if(width != 0)
+ if (width != 0)
pa->sizex= width;
- if(height != 0)
+ if (height != 0)
pa->sizey= height;
}
}
@@ -301,7 +301,7 @@ static void ui_offset_panel_block(uiBlock *block)
ofsy= block->panel->sizey - style->panelspace;
- for(but= block->buttons.first; but; but=but->next) {
+ for (but= block->buttons.first; but; but=but->next) {
but->y1 += ofsy;
but->y2 += ofsy;
}
@@ -319,7 +319,7 @@ static void uiPanelPush(uiBlock *block)
{
glPushMatrix();
- if(block->panel)
+ if (block->panel)
glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0);
}
@@ -332,10 +332,10 @@ static void uiPanelPop(uiBlock *UNUSED(block))
/* triangle 'icon' for panel header */
void UI_DrawTriIcon(float x, float y, char dir)
{
- if(dir=='h') {
+ if (dir=='h') {
ui_draw_anti_tria( x-3, y-5, x-3, y+5, x+7,y );
}
- else if(dir=='t') {
+ else if (dir=='t') {
ui_draw_anti_tria( x-5, y-7, x+5, y-7, x, y+3);
}
else { /* 'v' = vertical, down */
@@ -346,7 +346,7 @@ void UI_DrawTriIcon(float x, float y, char dir)
/* triangle 'icon' inside rect */
static void ui_draw_tria_rect(rctf *rect, char dir)
{
- if(dir=='h') {
+ if (dir=='h') {
float half= 0.5f*(rect->ymax - rect->ymin);
ui_draw_anti_tria(rect->xmin, rect->ymin, rect->xmin, rect->ymax, rect->xmax, rect->ymin+half);
}
@@ -441,10 +441,10 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r
Panel *panel= block->panel;
rcti hrect;
int pnl_icons;
- const char *activename= IFACE_(panel->drawname[0] ? panel->drawname : panel->panelname);
+ const char *activename = IFACE_(panel->drawname[0] ? panel->drawname : panel->panelname);
/* + 0.001f to avoid flirting with float inaccuracy */
- if(panel->control & UI_PNL_CLOSE) pnl_icons=(panel->labelofs+2*PNL_ICON+5)/block->aspect + 0.001f;
+ if (panel->control & UI_PNL_CLOSE) pnl_icons=(panel->labelofs+2*PNL_ICON+5)/block->aspect + 0.001f;
else pnl_icons= (panel->labelofs+PNL_ICON+5)/block->aspect + 0.001f;
/* active tab */
@@ -452,8 +452,8 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r
UI_ThemeColor(TH_TITLE);
hrect= *rect;
- if(dir == 'h') {
- hrect.xmin= rect->xmin+pnl_icons;
+ if (dir == 'h') {
+ hrect.xmin = rect->xmin+pnl_icons;
hrect.ymin += 2.0f/block->aspect;
uiStyleFontDraw(&style->paneltitle, &hrect, activename);
}
@@ -461,7 +461,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r
/* ignore 'pnl_icons', otherwise the text gets offset horizontally
* + 0.001f to avoid flirting with float inaccuracy
*/
- hrect.xmin= rect->xmin + (PNL_ICON+5)/block->aspect + 0.001f;
+ hrect.xmin = rect->xmin + (PNL_ICON+5)/block->aspect + 0.001f;
uiStyleFontDrawRotated(&style->paneltitle, &hrect, activename);
}
}
@@ -473,10 +473,10 @@ static void rectf_scale(rctf *rect, float scale)
float sizex= 0.5f*scale*(rect->xmax - rect->xmin);
float sizey= 0.5f*scale*(rect->ymax - rect->ymin);
- rect->xmin= centx - sizex;
- rect->xmax= centx + sizex;
- rect->ymin= centy - sizey;
- rect->ymax= centy + sizey;
+ rect->xmin = centx - sizex;
+ rect->xmax = centx + sizex;
+ rect->ymin = centy - sizey;
+ rect->ymax = centy + sizey;
}
/* panel integrated in buttonswindow, tool/property lists etc */
@@ -488,14 +488,14 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
rctf itemrect;
int ofsx;
- if(panel->paneltab) return;
- if(panel->type && (panel->type->flag & PNL_NO_HEADER)) return;
+ if (panel->paneltab) return;
+ if (panel->type && (panel->type->flag & PNL_NO_HEADER)) return;
/* calculate header rect */
/* + 0.001f to prevent flicker due to float inaccuracy */
headrect= *rect;
- headrect.ymin= headrect.ymax;
- headrect.ymax= headrect.ymin + floor(PNL_HEADER/block->aspect + 0.001f);
+ headrect.ymin = headrect.ymax;
+ headrect.ymax = headrect.ymin + floor(PNL_HEADER/block->aspect + 0.001f);
{
float minx= rect->xmin;
@@ -504,7 +504,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
glEnable(GL_BLEND);
- if(btheme->tui.panel.show_header) {
+ if (btheme->tui.panel.show_header) {
/* draw with background color */
glEnable(GL_BLEND);
glColor4ubv((unsigned char*)btheme->tui.panel.header);
@@ -513,7 +513,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
fdrawline(minx, y, maxx, y);
fdrawline(minx, y, maxx, y);
}
- else if(!(panel->runtime_flag & PNL_FIRST)) {
+ else if (!(panel->runtime_flag & PNL_FIRST)) {
/* draw embossed separator */
minx += 5.0f/block->aspect;
maxx -= 5.0f/block->aspect;
@@ -529,14 +529,14 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
}
/* horizontal title */
- if(!(panel->flag & PNL_CLOSEDX)) {
+ if (!(panel->flag & PNL_CLOSEDX)) {
ui_draw_aligned_panel_header(style, block, &headrect, 'h');
/* itemrect smaller */
- itemrect.xmax= headrect.xmax - 5.0f/block->aspect;
- itemrect.xmin= itemrect.xmax - (headrect.ymax-headrect.ymin);
- itemrect.ymin= headrect.ymin;
- itemrect.ymax= headrect.ymax;
+ itemrect.xmax = headrect.xmax - 5.0f/block->aspect;
+ itemrect.xmin = itemrect.xmax - (headrect.ymax-headrect.ymin);
+ itemrect.ymin = headrect.ymin;
+ itemrect.ymax = headrect.ymax;
rectf_scale(&itemrect, 0.7f);
ui_draw_panel_dragwidget(&itemrect);
@@ -545,10 +545,10 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
/* if the panel is minimized vertically:
* (------)
*/
- if(panel->flag & PNL_CLOSEDY) {
+ if (panel->flag & PNL_CLOSEDY) {
}
- else if(panel->flag & PNL_CLOSEDX) {
+ else if (panel->flag & PNL_CLOSEDX) {
/* draw vertical title */
ui_draw_aligned_panel_header(style, block, &headrect, 'v');
}
@@ -556,22 +556,22 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
else {
/* in some occasions, draw a border */
- if(panel->flag & PNL_SELECT) {
- if(panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL);
+ if (panel->flag & PNL_SELECT) {
+ if (panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL);
else uiSetRoundBox(UI_CNR_NONE);
UI_ThemeColorShade(TH_BACK, -120);
uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax+1, 8);
}
- if(panel->control & UI_PNL_SCALE)
+ if (panel->control & UI_PNL_SCALE)
ui_draw_panel_scalewidget(rect);
}
/* draw optional close icon */
ofsx= 6;
- if(panel->control & UI_PNL_CLOSE) {
+ if (panel->control & UI_PNL_CLOSE) {
UI_ThemeColor(TH_TEXT);
ui_draw_x_icon(rect->xmin+2+ofsx, rect->ymax+2);
@@ -582,16 +582,16 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
UI_ThemeColor(TH_TEXT);
/* itemrect smaller */
- itemrect.xmin= headrect.xmin + 5.0f/block->aspect;
- itemrect.xmax= itemrect.xmin + (headrect.ymax-headrect.ymin);
- itemrect.ymin= headrect.ymin;
- itemrect.ymax= headrect.ymax;
+ itemrect.xmin = headrect.xmin + 5.0f/block->aspect;
+ itemrect.xmax = itemrect.xmin + (headrect.ymax-headrect.ymin);
+ itemrect.ymin = headrect.ymin;
+ itemrect.ymax = headrect.ymax;
rectf_scale(&itemrect, 0.35f);
- if(panel->flag & PNL_CLOSEDY)
+ if (panel->flag & PNL_CLOSEDY)
ui_draw_tria_rect(&itemrect, 'h');
- else if(panel->flag & PNL_CLOSEDX)
+ else if (panel->flag & PNL_CLOSEDX)
ui_draw_tria_rect(&itemrect, 'h');
else
ui_draw_tria_rect(&itemrect, 'v');
@@ -603,7 +603,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
static int get_panel_header(Panel *pa)
{
- if(pa->type && (pa->type->flag & PNL_NO_HEADER))
+ if (pa->type && (pa->type->flag & PNL_NO_HEADER))
return 0;
return PNL_HEADER;
@@ -611,26 +611,26 @@ static int get_panel_header(Panel *pa)
static int get_panel_size_y(Panel *pa)
{
- if(pa->type && (pa->type->flag & PNL_NO_HEADER))
+ if (pa->type && (pa->type->flag & PNL_NO_HEADER))
return pa->sizey;
return PNL_HEADER + pa->sizey;
}
-/* this function is needed because uiBlock and Panel itself dont
+/* this function is needed because uiBlock and Panel itself don't
* change sizey or location when closed */
static int get_panel_real_ofsy(Panel *pa)
{
- if(pa->flag & PNL_CLOSEDY) return pa->ofsy+pa->sizey;
- else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDY)) return pa->ofsy+pa->sizey;
- else if(pa->paneltab) return pa->paneltab->ofsy;
+ if (pa->flag & PNL_CLOSEDY) return pa->ofsy+pa->sizey;
+ else if (pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDY)) return pa->ofsy+pa->sizey;
+ else if (pa->paneltab) return pa->paneltab->ofsy;
else return pa->ofsy;
}
static int get_panel_real_ofsx(Panel *pa)
{
- if(pa->flag & PNL_CLOSEDX) return pa->ofsx+get_panel_header(pa);
- else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx+get_panel_header(pa);
+ if (pa->flag & PNL_CLOSEDX) return pa->ofsx+get_panel_header(pa);
+ else if (pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx+get_panel_header(pa);
else return pa->ofsx+pa->sizex;
}
@@ -648,10 +648,10 @@ static int find_leftmost_panel(const void *a1, const void *a2)
{
const PanelSort *ps1=a1, *ps2=a2;
- if(ps1->pa->ofsx > ps2->pa->ofsx) return 1;
- else if(ps1->pa->ofsx < ps2->pa->ofsx) return -1;
- else if(ps1->pa->sortorder > ps2->pa->sortorder) return 1;
- else if(ps1->pa->sortorder < ps2->pa->sortorder) return -1;
+ if (ps1->pa->ofsx > ps2->pa->ofsx) return 1;
+ else if (ps1->pa->ofsx < ps2->pa->ofsx) return -1;
+ else if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
+ else if (ps1->pa->sortorder < ps2->pa->sortorder) return -1;
return 0;
}
@@ -665,10 +665,10 @@ static int find_highest_panel(const void *a1, const void *a2)
* prevent them from being sorted */
if (ps1->pa->sortorder < ps2->pa->sortorder && ps1->pa->type->flag & PNL_NO_HEADER) return -1;
- if(ps1->pa->ofsy+ps1->pa->sizey < ps2->pa->ofsy+ps2->pa->sizey) return 1;
- else if(ps1->pa->ofsy+ps1->pa->sizey > ps2->pa->ofsy+ps2->pa->sizey) return -1;
- else if(ps1->pa->sortorder > ps2->pa->sortorder) return 1;
- else if(ps1->pa->sortorder < ps2->pa->sortorder) return -1;
+ if (ps1->pa->ofsy+ps1->pa->sizey < ps2->pa->ofsy+ps2->pa->sizey) return 1;
+ else if (ps1->pa->ofsy+ps1->pa->sizey > ps2->pa->ofsy+ps2->pa->sizey) return -1;
+ else if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
+ else if (ps1->pa->sortorder < ps2->pa->sortorder) return -1;
return 0;
}
@@ -677,8 +677,8 @@ static int compare_panel(const void *a1, const void *a2)
{
const PanelSort *ps1=a1, *ps2=a2;
- if(ps1->pa->sortorder > ps2->pa->sortorder) return 1;
- else if(ps1->pa->sortorder < ps2->pa->sortorder) return -1;
+ if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
+ else if (ps1->pa->sortorder < ps2->pa->sortorder) return -1;
return 0;
}
@@ -693,18 +693,18 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
int align= panel_aligned(sa, ar);
/* count active, not tabbed panels */
- for(pa= ar->panels.first; pa; pa= pa->next)
- if((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL)
+ for (pa= ar->panels.first; pa; pa= pa->next)
+ if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL)
tot++;
- if(tot==0) return 0;
+ if (tot==0) return 0;
/* extra; change close direction? */
- for(pa= ar->panels.first; pa; pa= pa->next) {
- if((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL) {
- if((pa->flag & PNL_CLOSEDX) && (align==BUT_VERTICAL))
+ for (pa= ar->panels.first; pa; pa= pa->next) {
+ if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL) {
+ if ((pa->flag & PNL_CLOSEDX) && (align==BUT_VERTICAL))
pa->flag ^= PNL_CLOSED;
- else if((pa->flag & PNL_CLOSEDY) && (align==BUT_HORIZONTAL))
+ else if ((pa->flag & PNL_CLOSEDY) && (align==BUT_HORIZONTAL))
pa->flag ^= PNL_CLOSED;
}
}
@@ -713,22 +713,22 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
panelsort= MEM_callocN(tot*sizeof(PanelSort), "panelsort");
ps= panelsort;
- for(pa= ar->panels.first; pa; pa= pa->next) {
- if((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL) {
+ for (pa= ar->panels.first; pa; pa= pa->next) {
+ if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL) {
ps->pa= MEM_dupallocN(pa);
ps->orig= pa;
ps++;
}
}
- if(drag) {
+ if (drag) {
/* while we are dragging, we sort on location and update sortorder */
- if(align==BUT_VERTICAL)
+ if (align==BUT_VERTICAL)
qsort(panelsort, tot, sizeof(PanelSort), find_highest_panel);
else
qsort(panelsort, tot, sizeof(PanelSort), find_leftmost_panel);
- for(ps=panelsort, a=0; a<tot; a++, ps++)
+ for (ps=panelsort, a=0; a<tot; a++, ps++)
ps->orig->sortorder= a;
}
else
@@ -740,10 +740,10 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
ps->pa->ofsx= 0;
ps->pa->ofsy= -get_panel_size_y(ps->pa);
- for(a=0; a<tot-1; a++, ps++) {
+ for (a=0; a<tot-1; a++, ps++) {
psnext= ps+1;
- if(align==BUT_VERTICAL) {
+ if (align==BUT_VERTICAL) {
psnext->pa->ofsx= ps->pa->ofsx;
psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - get_panel_size_y(psnext->pa);
}
@@ -756,9 +756,9 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
/* we interpolate */
done= 0;
ps= panelsort;
- for(a=0; a<tot; a++, ps++) {
- if((ps->pa->flag & PNL_SELECT)==0) {
- if((ps->orig->ofsx != ps->pa->ofsx) || (ps->orig->ofsy != ps->pa->ofsy)) {
+ for (a=0; a<tot; a++, ps++) {
+ if ((ps->pa->flag & PNL_SELECT)==0) {
+ if ((ps->orig->ofsx != ps->pa->ofsx) || (ps->orig->ofsy != ps->pa->ofsy)) {
ps->orig->ofsx= floorf(0.5f + fac*(float)ps->pa->ofsx + (1.0f-fac)*(float)ps->orig->ofsx);
ps->orig->ofsy= floorf(0.5f + fac*(float)ps->pa->ofsy + (1.0f-fac)*(float)ps->orig->ofsy);
done= 1;
@@ -767,8 +767,8 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
}
/* copy locations to tabs */
- for(pa= ar->panels.first; pa; pa= pa->next)
- if(pa->paneltab && (pa->runtime_flag & PNL_ACTIVE))
+ for (pa= ar->panels.first; pa; pa= pa->next)
+ if (pa->paneltab && (pa->runtime_flag & PNL_ACTIVE))
ui_panel_copy_offset(pa, pa->paneltab);
/* free panelsort array */
@@ -788,11 +788,11 @@ static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y)
int sizey = UI_PANEL_WIDTH;
/* compute size taken up by panels, for setting in view2d */
- for(pa= ar->panels.first; pa; pa= pa->next) {
- if(pa->runtime_flag & PNL_ACTIVE) {
+ for (pa= ar->panels.first; pa; pa= pa->next) {
+ if (pa->runtime_flag & PNL_ACTIVE) {
int pa_sizex, pa_sizey;
- if(align==BUT_VERTICAL) {
+ if (align==BUT_VERTICAL) {
pa_sizex= pa->ofsx + pa->sizex;
pa_sizey= get_panel_real_ofsy(pa);
}
@@ -822,12 +822,12 @@ static void ui_do_animate(const bContext *C, Panel *panel)
fac= MIN2(fac, 1.0f);
/* for max 1 second, interpolate positions */
- if(uiAlignPanelStep(sa, ar, fac, 0))
+ if (uiAlignPanelStep(sa, ar, fac, 0))
ED_region_tag_redraw(ar);
else
fac= 1.0f;
- if(fac >= 1.0f) {
+ if (fac >= 1.0f) {
panel_activate_state(C, panel, PANEL_STATE_EXIT);
return;
}
@@ -839,8 +839,8 @@ void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar)
/* set all panels as inactive, so that at the end we know
* which ones were used */
- for(pa=ar->panels.first; pa; pa=pa->next) {
- if(pa->runtime_flag & PNL_ACTIVE)
+ for (pa=ar->panels.first; pa; pa=pa->next) {
+ if (pa->runtime_flag & PNL_ACTIVE)
pa->runtime_flag= PNL_WAS_ACTIVE;
else
pa->runtime_flag= 0;
@@ -855,25 +855,25 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
Panel *panot, *panew, *patest, *pa, *firstpa;
/* offset contents */
- for(block= ar->uiblocks.first; block; block= block->next)
- if(block->active && block->panel)
+ for (block= ar->uiblocks.first; block; block= block->next)
+ if (block->active && block->panel)
ui_offset_panel_block(block);
/* consistency; are panels not made, whilst they have tabs */
- for(panot= ar->panels.first; panot; panot= panot->next) {
- if((panot->runtime_flag & PNL_ACTIVE)==0) { // not made
+ for (panot= ar->panels.first; panot; panot= panot->next) {
+ if ((panot->runtime_flag & PNL_ACTIVE)==0) { // not made
- for(panew= ar->panels.first; panew; panew= panew->next) {
- if((panew->runtime_flag & PNL_ACTIVE)) {
- if(panew->paneltab==panot) { // panew is tab in notmade pa
+ for (panew= ar->panels.first; panew; panew= panew->next) {
+ if ((panew->runtime_flag & PNL_ACTIVE)) {
+ if (panew->paneltab==panot) { // panew is tab in notmade pa
break;
}
}
}
/* now panew can become the new parent, check all other tabs */
- if(panew) {
- for(patest= ar->panels.first; patest; patest= patest->next) {
- if(patest->paneltab == panot) {
+ if (panew) {
+ for (patest= ar->panels.first; patest; patest= patest->next) {
+ if (patest->paneltab == panot) {
patest->paneltab= panew;
}
}
@@ -885,8 +885,8 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
}
/* re-align, possibly with animation */
- if(panels_re_align(sa, ar, &pa)) {
- if(pa)
+ if (panels_re_align(sa, ar, &pa)) {
+ if (pa)
panel_activate_state(C, pa, PANEL_STATE_ANIMATION);
else
uiAlignPanelStep(sa, ar, 1.0, 0);
@@ -894,12 +894,12 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
/* tag first panel */
firstpa= NULL;
- for(block= ar->uiblocks.first; block; block=block->next)
- if(block->active && block->panel)
- if(!firstpa || block->panel->sortorder < firstpa->sortorder)
+ for (block= ar->uiblocks.first; block; block=block->next)
+ if (block->active && block->panel)
+ if (!firstpa || block->panel->sortorder < firstpa->sortorder)
firstpa= block->panel;
- if(firstpa)
+ if (firstpa)
firstpa->runtime_flag |= PNL_FIRST;
/* compute size taken up by panel */
@@ -913,14 +913,14 @@ void uiDrawPanels(const bContext *C, ARegion *ar)
UI_ThemeClearColor(TH_BACK);
/* draw panels, selected on top */
- for(block= ar->uiblocks.first; block; block=block->next) {
- if(block->active && block->panel && !(block->panel->flag & PNL_SELECT)) {
+ for (block= ar->uiblocks.first; block; block=block->next) {
+ if (block->active && block->panel && !(block->panel->flag & PNL_SELECT)) {
uiDrawBlock(C, block);
}
}
- for(block= ar->uiblocks.first; block; block=block->next) {
- if(block->active && block->panel && (block->panel->flag & PNL_SELECT)) {
+ for (block= ar->uiblocks.first; block; block=block->next) {
+ if (block->active && block->panel && (block->panel->flag & PNL_SELECT)) {
uiDrawBlock(C, block);
}
}
@@ -934,21 +934,21 @@ static void check_panel_overlap(ARegion *ar, Panel *panel)
/* also called with panel==NULL for clear */
- for(pa=ar->panels.first; pa; pa=pa->next) {
+ for (pa=ar->panels.first; pa; pa=pa->next) {
pa->flag &= ~PNL_OVERLAP;
- if(panel && (pa != panel)) {
- if(pa->paneltab==NULL && (pa->runtime_flag & PNL_ACTIVE)) {
+ if (panel && (pa != panel)) {
+ if (pa->paneltab==NULL && (pa->runtime_flag & PNL_ACTIVE)) {
float safex= 0.2, safey= 0.2;
- if(pa->flag & PNL_CLOSEDX) safex= 0.05;
- else if(pa->flag & PNL_CLOSEDY) safey= 0.05;
- else if(panel->flag & PNL_CLOSEDX) safex= 0.05;
- else if(panel->flag & PNL_CLOSEDY) safey= 0.05;
+ if (pa->flag & PNL_CLOSEDX) safex= 0.05;
+ else if (pa->flag & PNL_CLOSEDY) safey= 0.05;
+ else if (panel->flag & PNL_CLOSEDX) safex= 0.05;
+ else if (panel->flag & PNL_CLOSEDY) safey= 0.05;
- if(pa->ofsx > panel->ofsx- safex*panel->sizex)
- if(pa->ofsx+pa->sizex < panel->ofsx+ (1.0f+safex)*panel->sizex)
- if(pa->ofsy > panel->ofsy- safey*panel->sizey)
- if(pa->ofsy+pa->sizey < panel->ofsy+ (1.0f+safey)*panel->sizey)
+ if (pa->ofsx > panel->ofsx- safex*panel->sizex)
+ if (pa->ofsx+pa->sizex < panel->ofsx+ (1.0f+safex)*panel->sizex)
+ if (pa->ofsy > panel->ofsy- safey*panel->sizey)
+ if (pa->ofsy+pa->sizey < panel->ofsy+ (1.0f+safey)*panel->sizey)
pa->flag |= PNL_OVERLAP;
}
}
@@ -965,7 +965,7 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
short align= panel_aligned(sa, ar), dx=0, dy=0;
/* first clip for window, no dragging outside */
- if(!BLI_in_rcti(&ar->winrct, event->x, event->y))
+ if (!BLI_in_rcti(&ar->winrct, event->x, event->y))
return;
dx= (event->x-data->startx) & ~(PNL_GRID-1);
@@ -974,10 +974,10 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
dx *= (float)(ar->v2d.cur.xmax - ar->v2d.cur.xmin)/(float)(ar->winrct.xmax - ar->winrct.xmin);
dy *= (float)(ar->v2d.cur.ymax - ar->v2d.cur.ymin)/(float)(ar->winrct.ymax - ar->winrct.ymin);
- if(data->state == PANEL_STATE_DRAG_SCALE) {
+ if (data->state == PANEL_STATE_DRAG_SCALE) {
panel->sizex = MAX2(data->startsizex+dx, UI_PANEL_MINX);
- if(data->startsizey-dy < UI_PANEL_MINY)
+ if (data->startsizey-dy < UI_PANEL_MINY)
dy= -UI_PANEL_MINY+data->startsizey;
panel->sizey= data->startsizey-dy;
@@ -991,7 +991,7 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
panel->ofsy = data->startofsy+dy;
check_panel_overlap(ar, panel);
- if(align) uiAlignPanelStep(sa, ar, 0.2, 1);
+ if (align) uiAlignPanelStep(sa, ar, 0.2, 1);
}
ED_region_tag_redraw(ar);
@@ -1001,7 +1001,7 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
/* this function is supposed to call general window drawing too */
-/* also it supposes a block has panel, and isnt a menu */
+/* also it supposes a block has panel, and isn't a menu */
static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, int my, int event)
{
ScrArea *sa= CTX_wm_area(C);
@@ -1014,34 +1014,34 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
/* XXX weak code, currently it assumes layout style for location of widgets */
/* check open/collapsed button */
- if(event==RETKEY)
+ if (event==RETKEY)
button= 1;
- else if(event==AKEY)
+ else if (event==AKEY)
button= 1;
- else if(block->panel->flag & PNL_CLOSEDX) {
- if(my >= block->maxy) button= 1;
+ else if (block->panel->flag & PNL_CLOSEDX) {
+ if (my >= block->maxy) button= 1;
}
- else if(block->panel->control & UI_PNL_CLOSE) {
+ else if (block->panel->control & UI_PNL_CLOSE) {
/* whole of header can be used to collapse panel (except top-right corner) */
- if(mx <= block->maxx-8-PNL_ICON) button= 2;
- //else if(mx <= block->minx+10+2*PNL_ICON+2) button= 1;
+ if (mx <= block->maxx-8-PNL_ICON) button= 2;
+ //else if (mx <= block->minx+10+2*PNL_ICON+2) button= 1;
}
- else if(mx <= block->maxx-PNL_ICON-12) {
+ else if (mx <= block->maxx-PNL_ICON-12) {
button= 1;
}
- if(button) {
- if(button==2) { // close
+ if (button) {
+ if (button==2) { // close
ED_region_tag_redraw(ar);
}
else { // collapse
- if(block->panel->flag & PNL_CLOSED) {
+ if (block->panel->flag & PNL_CLOSED) {
block->panel->flag &= ~PNL_CLOSED;
/* snap back up so full panel aligns with screen edge */
if (block->panel->snap & PNL_SNAP_BOTTOM)
block->panel->ofsy= 0;
}
- else if(align==BUT_HORIZONTAL) {
+ else if (align==BUT_HORIZONTAL) {
block->panel->flag |= PNL_CLOSEDX;
}
else {
@@ -1051,20 +1051,20 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
block->panel->ofsy= -block->panel->sizey;
}
- for(pa= ar->panels.first; pa; pa= pa->next) {
- if(pa->paneltab==block->panel) {
- if(block->panel->flag & PNL_CLOSED) pa->flag |= PNL_CLOSED;
+ for (pa= ar->panels.first; pa; pa= pa->next) {
+ if (pa->paneltab==block->panel) {
+ if (block->panel->flag & PNL_CLOSED) pa->flag |= PNL_CLOSED;
else pa->flag &= ~PNL_CLOSED;
}
}
}
- if(align)
+ if (align)
panel_activate_state(C, block->panel, PANEL_STATE_ANIMATION);
else
ED_region_tag_redraw(ar);
}
- else if(mx <= (block->maxx-PNL_ICON-12)+PNL_ICON+2) {
+ else if (mx <= (block->maxx-PNL_ICON-12)+PNL_ICON+2) {
panel_activate_state(C, block->panel, PANEL_STATE_DRAG);
}
}
@@ -1080,7 +1080,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
int retval, mx, my, inside_header= 0, inside_scale= 0, inside;
retval= WM_UI_HANDLER_CONTINUE;
- for(block=ar->uiblocks.last; block; block=block->prev) {
+ for (block=ar->uiblocks.last; block; block=block->prev) {
mx= event->x;
my= event->y;
ui_window_to_block(ar, block, &mx, &my);
@@ -1089,20 +1089,20 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
inside= 0;
pa= block->panel;
- if(!pa || pa->paneltab!=NULL)
+ if (!pa || pa->paneltab!=NULL)
continue;
- if(pa->type && pa->type->flag & PNL_NO_HEADER) // XXX - accessed freed panels when scripts reload, need to fix.
+ if (pa->type && pa->type->flag & PNL_NO_HEADER) // XXX - accessed freed panels when scripts reload, need to fix.
continue;
- if(block->minx <= mx && block->maxx >= mx)
- if(block->miny <= my && block->maxy+PNL_HEADER >= my)
+ if (block->minx <= mx && block->maxx >= mx)
+ if (block->miny <= my && block->maxy+PNL_HEADER >= my)
inside= 1;
- if(inside && event->val==KM_PRESS) {
- if(event->type == AKEY && !ELEM4(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift, event->alt)) {
+ if (inside && event->val==KM_PRESS) {
+ if (event->type == AKEY && !ELEM4(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift, event->alt)) {
- if(pa->flag & PNL_CLOSEDY) {
- if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my))
+ if (pa->flag & PNL_CLOSEDY) {
+ if ((block->maxy <= my) && (block->maxy+PNL_HEADER >= my))
ui_handle_panel_header(C, block, mx, my, event->type);
}
else
@@ -1113,53 +1113,53 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
}
/* on active button, do not handle panels */
- if(ui_button_is_active(ar))
+ if (ui_button_is_active(ar))
continue;
- if(inside) {
+ if (inside) {
/* clicked at panel header? */
- if(pa->flag & PNL_CLOSEDX) {
- if(block->minx <= mx && block->minx+PNL_HEADER >= mx)
+ if (pa->flag & PNL_CLOSEDX) {
+ if (block->minx <= mx && block->minx+PNL_HEADER >= mx)
inside_header= 1;
}
- else if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my)) {
+ else if ((block->maxy <= my) && (block->maxy+PNL_HEADER >= my)) {
inside_header= 1;
}
- else if(pa->control & UI_PNL_SCALE) {
- if(block->maxx-PNL_HEADER <= mx)
- if(block->miny+PNL_HEADER >= my)
+ else if (pa->control & UI_PNL_SCALE) {
+ if (block->maxx-PNL_HEADER <= mx)
+ if (block->miny+PNL_HEADER >= my)
inside_scale= 1;
}
- if(event->val==KM_PRESS) {
+ if (event->val==KM_PRESS) {
/* open close on header */
- if(ELEM(event->type, RETKEY, PADENTER)) {
- if(inside_header) {
+ if (ELEM(event->type, RETKEY, PADENTER)) {
+ if (inside_header) {
ui_handle_panel_header(C, block, mx, my, RETKEY);
break;
}
}
- else if(event->type == LEFTMOUSE) {
- if(inside_header) {
+ else if (event->type == LEFTMOUSE) {
+ if (inside_header) {
ui_handle_panel_header(C, block, mx, my, 0);
break;
}
- else if(inside_scale && !(pa->flag & PNL_CLOSED)) {
+ else if (inside_scale && !(pa->flag & PNL_CLOSED)) {
panel_activate_state(C, pa, PANEL_STATE_DRAG_SCALE);
break;
}
}
- else if(event->type == ESCKEY) {
+ else if (event->type == ESCKEY) {
/*XXX 2.50*/
#if 0
- if(block->handler) {
+ if (block->handler) {
rem_blockhandler(sa, block->handler);
ED_region_tag_redraw(ar);
retval= WM_UI_HANDLER_BREAK;
}
#endif
}
- else if(event->type==PADPLUSKEY || event->type==PADMINUS) {
+ else if (event->type==PADPLUSKEY || event->type==PADMINUS) {
#if 0 // XXX make float panel exception?
int zoom=0;
@@ -1171,13 +1171,13 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
else
zoom=1;
- if(zoom) {
+ if (zoom) {
ScrArea *sa= CTX_wm_area(C);
SpaceLink *sl= sa->spacedata.first;
- if(sa->spacetype!=SPACE_BUTS) {
- if(!(pa->control & UI_PNL_SCALE)) {
- if(event->type==PADPLUSKEY) sl->blockscale+= 0.1;
+ if (sa->spacetype!=SPACE_BUTS) {
+ if (!(pa->control & UI_PNL_SCALE)) {
+ if (event->type==PADPLUSKEY) sl->blockscale+= 0.1;
else sl->blockscale-= 0.1;
CLAMP(sl->blockscale, 0.6, 1.0);
@@ -1204,30 +1204,30 @@ static int ui_handler_panel(bContext *C, wmEvent *event, void *userdata)
uiHandlePanelData *data= panel->activedata;
/* verify if we can stop */
- if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
int align= panel_aligned(sa, ar);
- if(align)
+ if (align)
panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
else
panel_activate_state(C, panel, PANEL_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(data->state == PANEL_STATE_DRAG)
+ else if (event->type == MOUSEMOVE) {
+ if (data->state == PANEL_STATE_DRAG)
ui_do_drag(C, event, panel);
}
- else if(event->type == TIMER && event->customdata == data->animtimer) {
- if(data->state == PANEL_STATE_ANIMATION)
+ else if (event->type == TIMER && event->customdata == data->animtimer) {
+ if (data->state == PANEL_STATE_ANIMATION)
ui_do_animate(C, panel);
- else if(data->state == PANEL_STATE_DRAG)
+ else if (data->state == PANEL_STATE_DRAG)
ui_do_drag(C, event, panel);
}
data= panel->activedata;
- if(data && data->state == PANEL_STATE_ANIMATION)
+ if (data && data->state == PANEL_STATE_ANIMATION)
return WM_UI_HANDLER_CONTINUE;
else
return WM_UI_HANDLER_BREAK;
@@ -1246,11 +1246,11 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
wmWindow *win= CTX_wm_window(C);
ARegion *ar= CTX_wm_region(C);
- if(data && data->state == state)
+ if (data && data->state == state)
return;
- if(state == PANEL_STATE_EXIT || state == PANEL_STATE_ANIMATION) {
- if(data && data->state != PANEL_STATE_ANIMATION) {
+ if (state == PANEL_STATE_EXIT || state == PANEL_STATE_ANIMATION) {
+ if (data && data->state != PANEL_STATE_ANIMATION) {
/* XXX:
* - the panel tabbing function call below (test_add_new_tabs()) has been commented out
* "It is too easy to do by accident when reordering panels, is very hard to control and use, and has no real benefit." - BillRey
@@ -1265,26 +1265,26 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
else
pa->flag |= PNL_SELECT;
- if(data && data->animtimer) {
+ if (data && data->animtimer) {
WM_event_remove_timer(CTX_wm_manager(C), win, data->animtimer);
data->animtimer= NULL;
}
- if(state == PANEL_STATE_EXIT) {
+ if (state == PANEL_STATE_EXIT) {
MEM_freeN(data);
pa->activedata= NULL;
WM_event_remove_ui_handler(&win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa, 0);
}
else {
- if(!data) {
+ if (!data) {
data= MEM_callocN(sizeof(uiHandlePanelData), "uiHandlePanelData");
pa->activedata= data;
WM_event_add_ui_handler(C, &win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa);
}
- if(ELEM(state, PANEL_STATE_ANIMATION, PANEL_STATE_DRAG))
+ if (ELEM(state, PANEL_STATE_ANIMATION, PANEL_STATE_DRAG))
data->animtimer= WM_event_add_timer(CTX_wm_manager(C), win, TIMER, ANIMATION_INTERVAL);
data->state= state;
@@ -1301,15 +1301,15 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
/* XXX exception handling, 3d window preview panel */
#if 0
- if(block->drawextra==BIF_view3d_previewdraw)
+ if (block->drawextra==BIF_view3d_previewdraw)
BIF_view3d_previewrender_clear(curarea);
#endif
/* XXX exception handling, 3d window preview panel */
#if 0
- if(block->drawextra==BIF_view3d_previewdraw)
+ if (block->drawextra==BIF_view3d_previewdraw)
BIF_view3d_previewrender_signal(curarea, PR_DISPRECT);
- else if(strcmp(block->name, "image_panel_preview")==0)
+ else if (strcmp(block->name, "image_panel_preview")==0)
image_preview_event(2);
#endif
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index f971410672c..13962777da3 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -174,32 +174,36 @@ static MenuData *decompose_menu_string(const char *str)
*s= '\0';
s++;
- } else if (s[1]=='t') {
+ }
+ else if (s[1]=='t') {
nitem_is_title= (s != instr); /* check for empty title */
*s= '\0';
s++;
- } else if (s[1]=='l') {
+ }
+ else if (s[1]=='l') {
nitem_is_sepr= 1;
- if(!nitem) nitem= "";
+ if (!nitem) nitem= "";
*s= '\0';
s++;
- } else if (s[1]=='i') {
+ }
+ else if (s[1]=='i') {
nicon= atoi(s+2);
*s= '\0';
s++;
}
- } else if (c=='|' || c == '\n' || c=='\0') {
+ }
+ else if (c=='|' || c == '\n' || c=='\0') {
if (nitem) {
*s= '\0';
- if(nitem_is_title) {
+ if (nitem_is_title) {
menudata_set_title(md, nitem, nicon);
nitem_is_title= 0;
}
- else if(nitem_is_sepr) {
+ else if (nitem_is_sepr) {
/* prevent separator to get a value */
menudata_add_item(md, nitem, -1, nicon, 1);
nretval= md->nitems+1;
@@ -217,7 +221,8 @@ static MenuData *decompose_menu_string(const char *str)
if (c=='\0') {
break;
}
- } else if (!nitem) {
+ }
+ else if (!nitem) {
nitem= s;
}
@@ -254,20 +259,20 @@ int ui_step_name_menu(uiBut *but, int step)
if (md->items[i].retval==value)
break;
- if(step==1) {
+ if (step==1) {
/* skip separators */
- for(; i<md->nitems-1; i++) {
- if(md->items[i+1].retval != -1) {
+ for (; i<md->nitems-1; i++) {
+ if (md->items[i+1].retval != -1) {
value= md->items[i+1].retval;
break;
}
}
}
else {
- if(i>0) {
+ if (i>0) {
/* skip separators */
- for(; i>0; i--) {
- if(md->items[i-1].retval != -1) {
+ for (; i>0; i--) {
+ if (md->items[i-1].retval != -1) {
value= md->items[i-1].retval;
break;
}
@@ -298,7 +303,7 @@ static ARegion *ui_add_temporary_region(bScreen *sc)
static void ui_remove_temporary_region(bContext *C, bScreen *sc, ARegion *ar)
{
- if(CTX_wm_window(C))
+ if (CTX_wm_window(C))
wm_draw_region_clear(CTX_wm_window(C), ar);
ED_region_exit(C, ar);
@@ -308,34 +313,90 @@ static void ui_remove_temporary_region(bContext *C, bScreen *sc, ARegion *ar)
/************************* Creating Tooltips **********************/
-#define MAX_TOOLTIP_LINES 8
+typedef enum {
+ UI_TIP_LC_MAIN,
+ UI_TIP_LC_NORMAL,
+ UI_TIP_LC_PYTHON,
+ UI_TIP_LC_ALERT,
+ UI_TIP_LC_SUBMENU
+} uiTooltipLineColor;
+#define UI_TIP_LC_MAX 5
+#define MAX_TOOLTIP_LINES 8
typedef struct uiTooltipData {
rcti bbox;
uiFontStyle fstyle;
char lines[MAX_TOOLTIP_LINES][512];
- unsigned int color[MAX_TOOLTIP_LINES];
+ uiTooltipLineColor color_id[MAX_TOOLTIP_LINES];
int totline;
int toth, spaceh, lineh;
} uiTooltipData;
+static void rgb_tint(float col[3],
+ float h, float h_strength,
+ float v, float v_strength)
+{
+ float col_hsv_from[3];
+ float col_hsv_to[3];
+
+ rgb_to_hsv(col[0], col[1], col[2], col_hsv_from + 0, col_hsv_from + 1, col_hsv_from + 2);
+
+ col_hsv_to[0] = h;
+ col_hsv_to[1] = h_strength;
+ col_hsv_to[2] = (col_hsv_from[2] * (1.0f - v_strength)) + (v * v_strength);
+
+ hsv_to_rgb(col_hsv_to[0], col_hsv_to[1], col_hsv_to[2], col + 0, col + 1, col + 2);
+}
+
static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
{
uiTooltipData *data= ar->regiondata;
+ uiWidgetColors* theme = ui_tooltip_get_theme();
rcti bbox= data->bbox;
- int a;
-
- ui_draw_menu_back(UI_GetStyle(), NULL, &data->bbox);
+ float tip_colors[UI_TIP_LC_MAX][3];
+
+ float *main_color = tip_colors[UI_TIP_LC_MAIN]; /* the color from the theme */
+ float *normal_color = tip_colors[UI_TIP_LC_NORMAL];
+ float *python_color = tip_colors[UI_TIP_LC_PYTHON];
+ float *alert_color = tip_colors[UI_TIP_LC_ALERT];
+ float *submenu_color = tip_colors[UI_TIP_LC_SUBMENU];
+
+ float background_color[3];
+ float tone_bg;
+ int i;
+
+ /* draw background */
+ ui_draw_tooltip_background(UI_GetStyle(), NULL, &bbox);
+
+ /* set background_color */
+ rgb_uchar_to_float(background_color, (const unsigned char *)theme->inner);
+
+ /* calculate normal_color */
+ rgb_uchar_to_float(main_color, (const unsigned char *)theme->text);
+ copy_v3_v3(normal_color, main_color);
+ copy_v3_v3(python_color, main_color);
+ copy_v3_v3(alert_color, main_color);
+ copy_v3_v3(submenu_color, main_color);
+
+ /* find the brightness difference between background and text colors */
+ tone_bg = rgb_to_grayscale(background_color);
+ /* tone_fg = rgb_to_grayscale(main_color); */
+
+ rgb_tint(normal_color, 0.0f, 0.0f, tone_bg, 0.3f); /* a shade darker (to bg) */
+ rgb_tint(python_color, 0.666f, 0.25f, tone_bg, 0.3f); /* blue */
+ rgb_tint(alert_color, 0.0f, 0.8f, tone_bg, 0.1f); /* bright red */
+ rgb_tint(submenu_color, 0.0f, 0.0f, tone_bg, 0.3f); /* a shade darker (to bg) */
+
/* draw text */
uiStyleFontSet(&data->fstyle);
- bbox.ymax= bbox.ymax - 0.5f*((bbox.ymax - bbox.ymin) - data->toth);
- bbox.ymin= bbox.ymax - data->lineh;
+ bbox.ymax = bbox.ymax - 0.5f*((bbox.ymax - bbox.ymin) - data->toth);
+ bbox.ymin = bbox.ymax - data->lineh;
- for(a=0; a<data->totline; a++) {
- cpack(data->color[a]);
- uiStyleFontDraw(&data->fstyle, &bbox, data->lines[a]);
+ for (i = 0; i < data->totline; i++) {
+ glColor3fv(tip_colors[data->color_id[i]]);
+ uiStyleFontDraw(&data->fstyle, &bbox, data->lines[i]);
bbox.ymin -= data->lineh + data->spaceh;
bbox.ymax -= data->lineh + data->spaceh;
}
@@ -362,33 +423,33 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
float x1f, x2f, y1f, y2f;
int x1, x2, y1, y2, winx, winy, ofsx, ofsy, w, h, a;
- if(but->flag & UI_BUT_NO_TOOLTIP)
+ if (but->flag & UI_BUT_NO_TOOLTIP)
return NULL;
/* create tooltip data */
data= MEM_callocN(sizeof(uiTooltipData), "uiTooltipData");
/* special case, enum rna buttons only have enum item description, use general enum description too before the specific one */
- if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
+ if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
const char *descr= RNA_property_description(but->rnaprop);
- if(descr && descr[0]) {
+ if (descr && descr[0]) {
BLI_strncpy(data->lines[data->totline], descr, sizeof(data->lines[0]));
- data->color[data->totline]= 0xFFFFFF;
+ data->color_id[data->totline] = UI_TIP_LC_MAIN;
data->totline++;
}
- if(ELEM(but->type, ROW, MENU)) {
+ if (ELEM(but->type, ROW, MENU)) {
EnumPropertyItem *item;
int i, totitem, free;
int value = (but->type == ROW)? but->hardmax: ui_get_but_val(but);
RNA_property_enum_items_gettexted(C, &but->rnapoin, but->rnaprop, &item, &totitem, &free);
- for(i=0; i<totitem; i++) {
- if(item[i].identifier[0] && item[i].value == value) {
- if(item[i].description && item[i].description[0]) {
+ for (i=0; i<totitem; i++) {
+ if (item[i].identifier[0] && item[i].value == value) {
+ if (item[i].description && item[i].description[0]) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description);
- data->color[data->totline]= 0xDDDDDD;
+ data->color_id[data->totline] = UI_TIP_LC_SUBMENU;
data->totline++;
}
break;
@@ -401,52 +462,52 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
}
}
- if(but->tip && but->tip[0] != '\0') {
+ if (but->tip && but->tip[0] != '\0') {
BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0]));
- data->color[data->totline]= 0xFFFFFF;
+ data->color_id[data->totline] = UI_TIP_LC_MAIN;
data->totline++;
}
- if(but->optype && !(but->block->flag & UI_BLOCK_LOOP)) {
+ if (but->optype && !(but->block->flag & UI_BLOCK_LOOP)) {
/* operator keymap (not menus, they already have it) */
prop= (but->opptr)? but->opptr->data: NULL;
- if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
+ if (WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
buf, sizeof(buf)))
{
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), buf);
- data->color[data->totline]= 0x888888;
+ data->color_id[data->totline] = UI_TIP_LC_NORMAL;
data->totline++;
}
}
- if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+ if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
/* full string */
ui_get_but_string(but, buf, sizeof(buf));
- if(buf[0]) {
+ if (buf[0]) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Value: %s"), buf);
- data->color[data->totline]= 0x888888;
+ data->color_id[data->totline] = UI_TIP_LC_NORMAL;
data->totline++;
}
}
- if(but->rnaprop) {
+ if (but->rnaprop) {
int unit_type= uiButGetUnitType(but);
if (unit_type == PROP_UNIT_ROTATION) {
if (RNA_property_type(but->rnaprop) == PROP_FLOAT) {
float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop);
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Radians: %f"), value);
- data->color[data->totline]= 0x888888;
+ data->color_id[data->totline] = UI_TIP_LC_NORMAL;
data->totline++;
}
}
- if(but->flag & UI_BUT_DRIVEN) {
- if(ui_but_anim_expression_get(but, buf, sizeof(buf))) {
+ if (but->flag & UI_BUT_DRIVEN) {
+ if (ui_but_anim_expression_get(but, buf, sizeof(buf))) {
/* expression */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Expression: %s"), buf);
- data->color[data->totline]= 0x888888;
+ data->color_id[data->totline] = UI_TIP_LC_NORMAL;
data->totline++;
}
}
@@ -454,15 +515,15 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* rna info */
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s.%s"), RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
- data->color[data->totline]= 0x888888;
+ data->color_id[data->totline] = UI_TIP_LC_PYTHON;
data->totline++;
}
- if(but->rnapoin.id.data) {
+ if (but->rnapoin.id.data) {
ID *id= but->rnapoin.id.data;
- if(id->lib && id->lib->name) {
+ if (id->lib && id->lib->name) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Library: %s"), id->lib->name);
- data->color[data->totline]= 0x888888;
+ data->color_id[data->totline] = UI_TIP_LC_NORMAL;
data->totline++;
}
}
@@ -477,21 +538,21 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* operator info */
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), str);
- data->color[data->totline]= 0x888888;
+ data->color_id[data->totline] = UI_TIP_LC_PYTHON;
data->totline++;
}
MEM_freeN(str);
/* second check if we are disabled - why */
- if(but->flag & UI_BUT_DISABLED) {
+ if (but->flag & UI_BUT_DISABLED) {
const char *poll_msg;
CTX_wm_operator_poll_msg_set(C, NULL);
WM_operator_poll_context(C, but->optype, but->opcontext);
poll_msg= CTX_wm_operator_poll_msg_get(C);
- if(poll_msg) {
+ if (poll_msg) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Disabled: %s"), poll_msg);
- data->color[data->totline]= 0x6666ff; /* alert */
+ data->color_id[data->totline] = UI_TIP_LC_ALERT; /* alert */
data->totline++;
}
}
@@ -501,7 +562,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
MenuType *mt= uiButGetMenuType(but);
if (mt) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), mt->idname);
- data->color[data->totline]= 0x888888;
+ data->color_id[data->totline] = UI_TIP_LC_PYTHON;
data->totline++;
}
}
@@ -510,7 +571,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
assert(data->totline < MAX_TOOLTIP_LINES);
- if(data->totline == 0) {
+ if (data->totline == 0) {
MEM_freeN(data);
return NULL;
}
@@ -535,7 +596,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
h= BLF_height_max(data->fstyle.uifont_id);
- for(a=0, fontw=0, fonth=0; a<data->totline; a++) {
+ for (a=0, fontw=0, fonth=0; a<data->totline; a++) {
w= BLF_width(data->fstyle.uifont_id, data->lines[a]);
fontw= MAX2(fontw, w);
fonth += (a == 0)? h: h+TIP_MARGIN_Y;
@@ -566,9 +627,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* copy to int, gets projected if possible too */
x1= x1f; y1= y1f; x2= x2f; y2= y2f;
- if(butregion) {
+ if (butregion) {
/* XXX temp, region v2ds can be empty still */
- if(butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
+ if (butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
UI_view2d_to_region_no_clip(&butregion->v2d, x1f, y1f, &x1, &y1);
UI_view2d_to_region_no_clip(&butregion->v2d, x2f, y2f, &x2, &y2);
}
@@ -581,9 +642,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
wm_window_get_size(CTX_wm_window(C), &winx, &winy);
- if(x2 > winx) {
+ if (x2 > winx) {
/* super size */
- if(x2 > winx + x1) {
+ if (x2 > winx + x1) {
x2= winx;
x1= 0;
}
@@ -594,22 +655,22 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
}
/* ensure at least 5 px above screen bounds
* 25 is just a guess to be above the menu item */
- if(y1 < 5) {
+ if (y1 < 5) {
y2 += (-y1) + 30;
y1 = 30;
}
/* widget rect, in region coords */
- data->bbox.xmin= MENU_SHADOW_SIDE;
- data->bbox.xmax= x2-x1 + MENU_SHADOW_SIDE;
- data->bbox.ymin= MENU_SHADOW_BOTTOM;
- data->bbox.ymax= y2-y1 + MENU_SHADOW_BOTTOM;
+ data->bbox.xmin = MENU_SHADOW_SIDE;
+ data->bbox.xmax = x2-x1 + MENU_SHADOW_SIDE;
+ data->bbox.ymin = MENU_SHADOW_BOTTOM;
+ data->bbox.ymax = y2-y1 + MENU_SHADOW_BOTTOM;
/* region bigger for shadow */
- ar->winrct.xmin= x1 - MENU_SHADOW_SIDE;
- ar->winrct.xmax= x2 + MENU_SHADOW_SIDE;
- ar->winrct.ymin= y1 - MENU_SHADOW_BOTTOM;
- ar->winrct.ymax= y2 + MENU_TOP;
+ ar->winrct.xmin = x1 - MENU_SHADOW_SIDE;
+ ar->winrct.xmax = x2 + MENU_SHADOW_SIDE;
+ ar->winrct.ymin = y1 - MENU_SHADOW_BOTTOM;
+ ar->winrct.ymax = y2 + MENU_TOP;
/* adds subwindow */
ED_region_init(C, ar);
@@ -659,35 +720,35 @@ typedef struct uiSearchboxData {
int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid)
{
/* hijack for autocomplete */
- if(items->autocpl) {
+ if (items->autocpl) {
autocomplete_do_name(items->autocpl, name);
return 1;
}
/* hijack for finding active item */
- if(items->active) {
- if(poin==items->active)
+ if (items->active) {
+ if (poin==items->active)
items->offset_i= items->totitem;
items->totitem++;
return 1;
}
- if(items->totitem>=items->maxitem) {
+ if (items->totitem>=items->maxitem) {
items->more= 1;
return 0;
}
/* skip first items in list */
- if(items->offset_i > 0) {
+ if (items->offset_i > 0) {
items->offset_i--;
return 1;
}
- if(items->names)
+ if (items->names)
BLI_strncpy(items->names[items->totitem], name, items->maxstrlen);
- if(items->pointers)
+ if (items->pointers)
items->pointers[items->totitem]= poin;
- if(items->icons)
+ if (items->icons)
items->icons[items->totitem]= iconid;
items->totitem++;
@@ -708,10 +769,10 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
/* apply step */
data->active+= step;
- if(data->items.totitem==0)
+ if (data->items.totitem==0)
data->active= 0;
- else if(data->active > data->items.totitem) {
- if(data->items.more) {
+ else if (data->active > data->items.totitem) {
+ if (data->items.more) {
data->items.offset++;
data->active= data->items.totitem;
ui_searchbox_update(C, ar, but, 0);
@@ -719,13 +780,13 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
else
data->active= data->items.totitem;
}
- else if(data->active < 1) {
- if(data->items.offset) {
+ else if (data->active < 1) {
+ if (data->items.offset) {
data->items.offset--;
data->active= 1;
ui_searchbox_update(C, ar, but, 0);
}
- else if(data->active < 0)
+ else if (data->active < 0)
data->active= 0;
}
@@ -756,11 +817,11 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr)
int buth= (data->bbox.ymax-data->bbox.ymin - 2*MENU_TOP)/SEARCH_ITEMS;
*rect= data->bbox;
- rect->xmin= data->bbox.xmin + 3.0f;
- rect->xmax= data->bbox.xmax - 3.0f;
+ rect->xmin = data->bbox.xmin + 3.0f;
+ rect->xmax = data->bbox.xmax - 3.0f;
- rect->ymax= data->bbox.ymax - MENU_TOP - itemnr*buth;
- rect->ymin= rect->ymax - buth;
+ rect->ymax = data->bbox.ymax - MENU_TOP - itemnr*buth;
+ rect->ymin = rect->ymax - buth;
}
}
@@ -780,13 +841,13 @@ void ui_searchbox_apply(uiBut *but, ARegion *ar)
but->func_arg2= NULL;
- if(data->active) {
+ if (data->active) {
char *name= data->items.names[data->active-1];
char *cpoin= strchr(name, '|');
- if(cpoin) cpoin[0]= 0;
+ if (cpoin) cpoin[0]= 0;
BLI_strncpy(but->editstr, name, data->items.maxstrlen);
- if(cpoin) cpoin[0]= '|';
+ if (cpoin) cpoin[0]= '|';
but->func_arg2= data->items.pointers[data->active-1];
}
@@ -806,14 +867,14 @@ void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, wmEvent *event)
ui_searchbox_select(C, ar, but, 1);
break;
case MOUSEMOVE:
- if(BLI_in_rcti(&ar->winrct, event->x, event->y)) {
+ if (BLI_in_rcti(&ar->winrct, event->x, event->y)) {
rcti rect;
int a;
- for(a=0; a<data->items.totitem; a++) {
+ for (a=0; a<data->items.totitem; a++) {
ui_searchbox_butrect(&rect, data, a);
- if(BLI_in_rcti(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
- if( data->active!= a+1) {
+ if (BLI_in_rcti(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
+ if ( data->active!= a+1) {
data->active= a+1;
ui_searchbox_select(C, ar, but, 0);
break;
@@ -833,7 +894,7 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, int reset)
/* reset vars */
data->items.totitem= 0;
data->items.more= 0;
- if(reset==0) {
+ if (reset==0) {
data->items.offset_i= data->items.offset;
}
else {
@@ -841,21 +902,21 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, int reset)
data->active= 0;
/* handle active */
- if(but->search_func && but->func_arg2) {
+ if (but->search_func && but->func_arg2) {
data->items.active= but->func_arg2;
but->search_func(C, but->search_arg, but->editstr, &data->items);
data->items.active= NULL;
/* found active item, calculate real offset by centering it */
- if(data->items.totitem) {
+ if (data->items.totitem) {
/* first case, begin of list */
- if(data->items.offset_i < data->items.maxitem) {
+ if (data->items.offset_i < data->items.maxitem) {
data->active= data->items.offset_i+1;
data->items.offset_i= 0;
}
else {
/* second case, end of list */
- if(data->items.totitem - data->items.offset_i <= data->items.maxitem) {
+ if (data->items.totitem - data->items.offset_i <= data->items.maxitem) {
data->active= 1 + data->items.offset_i - data->items.totitem + data->items.maxitem;
data->items.offset_i= data->items.totitem - data->items.maxitem;
}
@@ -872,22 +933,22 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, int reset)
}
/* callback */
- if(but->search_func)
+ if (but->search_func)
but->search_func(C, but->search_arg, but->editstr, &data->items);
/* handle case where editstr is equal to one of items */
- if(reset && data->active==0) {
+ if (reset && data->active==0) {
int a;
- for(a=0; a<data->items.totitem; a++) {
+ for (a=0; a<data->items.totitem; a++) {
char *cpoin= strchr(data->items.names[a], '|');
- if(cpoin) cpoin[0]= 0;
- if(0==strcmp(but->editstr, data->items.names[a]))
+ if (cpoin) cpoin[0]= 0;
+ if (0==strcmp(but->editstr, data->items.names[a]))
data->active= a+1;
- if(cpoin) cpoin[0]= '|';
+ if (cpoin) cpoin[0]= '|';
}
- if(data->items.totitem==1 && but->editstr[0])
+ if (data->items.totitem==1 && but->editstr[0])
data->active= 1;
}
@@ -901,7 +962,7 @@ void ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
{
uiSearchboxData *data= ar->regiondata;
- if(str[0]) {
+ if (str[0]) {
data->items.autocpl= autocomplete_begin(str, ui_get_but_string_max_length(but));
but->search_func(C, but->search_arg, but->editstr, &data->items);
@@ -918,17 +979,17 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
/* pixel space */
wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
- if(!data->noback)
+ if (!data->noback)
ui_draw_search_back(NULL, NULL, &data->bbox); /* style not used yet */
/* draw text */
- if(data->items.totitem) {
+ if (data->items.totitem) {
rcti rect;
int a;
if (data->preview) {
/* draw items */
- for(a=0; a<data->items.totitem; a++) {
+ for (a=0; a<data->items.totitem; a++) {
ui_searchbox_butrect(&rect, data, a);
/* widget itself */
@@ -939,22 +1000,23 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
}
/* indicate more */
- if(data->items.more) {
+ if (data->items.more) {
ui_searchbox_butrect(&rect, data, data->items.maxitem-1);
glEnable(GL_BLEND);
UI_icon_draw(rect.xmax-18, rect.ymin-7, ICON_TRIA_DOWN);
glDisable(GL_BLEND);
}
- if(data->items.offset) {
+ if (data->items.offset) {
ui_searchbox_butrect(&rect, data, 0);
glEnable(GL_BLEND);
UI_icon_draw(rect.xmin, rect.ymax-9, ICON_TRIA_UP);
glDisable(GL_BLEND);
}
- } else {
+ }
+ else {
/* draw items */
- for(a=0; a<data->items.totitem; a++) {
+ for (a=0; a<data->items.totitem; a++) {
ui_searchbox_butrect(&rect, data, a);
/* widget itself */
@@ -962,13 +1024,13 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
}
/* indicate more */
- if(data->items.more) {
+ if (data->items.more) {
ui_searchbox_butrect(&rect, data, data->items.maxitem-1);
glEnable(GL_BLEND);
UI_icon_draw((rect.xmax-rect.xmin)/2, rect.ymin-9, ICON_TRIA_DOWN);
glDisable(GL_BLEND);
}
- if(data->items.offset) {
+ if (data->items.offset) {
ui_searchbox_butrect(&rect, data, 0);
glEnable(GL_BLEND);
UI_icon_draw((rect.xmax-rect.xmin)/2, rect.ymax-7, ICON_TRIA_UP);
@@ -1026,7 +1088,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
/* special case, hardcoded feature, not draw backdrop when called from menus,
* assume for design that popup already added it */
- if(but->block->flag & UI_BLOCK_LOOP)
+ if (but->block->flag & UI_BLOCK_LOOP)
data->noback= 1;
if (but->a1 > 0 && but->a2 > 0) {
@@ -1036,20 +1098,20 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
}
/* compute position */
- if(but->block->flag & UI_BLOCK_LOOP) {
+ if (but->block->flag & UI_BLOCK_LOOP) {
/* this case is search menu inside other menu */
/* we copy region size */
ar->winrct= butregion->winrct;
/* widget rect, in region coords */
- data->bbox.xmin= MENU_SHADOW_SIDE;
- data->bbox.xmax= (ar->winrct.xmax-ar->winrct.xmin) - MENU_SHADOW_SIDE;
- data->bbox.ymin= MENU_SHADOW_BOTTOM;
- data->bbox.ymax= (ar->winrct.ymax-ar->winrct.ymin) - MENU_SHADOW_BOTTOM;
+ data->bbox.xmin = MENU_SHADOW_SIDE;
+ data->bbox.xmax = (ar->winrct.xmax-ar->winrct.xmin) - MENU_SHADOW_SIDE;
+ data->bbox.ymin = MENU_SHADOW_BOTTOM;
+ data->bbox.ymax = (ar->winrct.ymax-ar->winrct.ymin) - MENU_SHADOW_BOTTOM;
/* check if button is lower half */
- if( but->y2 < (but->block->miny+but->block->maxy)/2 ) {
+ if ( but->y2 < (but->block->miny+but->block->maxy)/2 ) {
data->bbox.ymin += (but->y2-but->y1);
}
else {
@@ -1071,12 +1133,12 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
y2f += ofsy;
/* minimal width */
- if(x2f - x1f < 150) x2f= x1f+150; // XXX arbitrary
+ if (x2f - x1f < 150) x2f= x1f+150; // XXX arbitrary
/* copy to int, gets projected if possible too */
x1= x1f; y1= y1f; x2= x2f; y2= y2f;
- if(butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
+ if (butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
UI_view2d_to_region_no_clip(&butregion->v2d, x1f, y1f, &x1, &y1);
UI_view2d_to_region_no_clip(&butregion->v2d, x2f, y2f, &x2, &y2);
}
@@ -1088,9 +1150,9 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
wm_window_get_size(CTX_wm_window(C), &winx, &winy);
- if(x2 > winx) {
+ if (x2 > winx) {
/* super size */
- if(x2 > winx + x1) {
+ if (x2 > winx + x1) {
x2= winx;
x1= 0;
}
@@ -1100,7 +1162,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
}
}
- if(y1 < 0) {
+ if (y1 < 0) {
int newy1;
UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->y2 + ofsy, NULL, &newy1);
newy1 += butregion->winrct.ymin;
@@ -1110,16 +1172,16 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
}
/* widget rect, in region coords */
- data->bbox.xmin= MENU_SHADOW_SIDE;
- data->bbox.xmax= x2-x1 + MENU_SHADOW_SIDE;
- data->bbox.ymin= MENU_SHADOW_BOTTOM;
- data->bbox.ymax= y2-y1 + MENU_SHADOW_BOTTOM;
+ data->bbox.xmin = MENU_SHADOW_SIDE;
+ data->bbox.xmax = x2-x1 + MENU_SHADOW_SIDE;
+ data->bbox.ymin = MENU_SHADOW_BOTTOM;
+ data->bbox.ymax = y2-y1 + MENU_SHADOW_BOTTOM;
/* region bigger for shadow */
- ar->winrct.xmin= x1 - MENU_SHADOW_SIDE;
- ar->winrct.xmax= x2 + MENU_SHADOW_SIDE;
- ar->winrct.ymin= y1 - MENU_SHADOW_BOTTOM;
- ar->winrct.ymax= y2;
+ ar->winrct.xmin = x1 - MENU_SHADOW_SIDE;
+ ar->winrct.xmax = x2 + MENU_SHADOW_SIDE;
+ ar->winrct.ymin = y1 - MENU_SHADOW_BOTTOM;
+ ar->winrct.ymax = y2;
}
/* adds subwindow */
@@ -1131,7 +1193,8 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
/* prepare search data */
if (data->preview) {
data->items.maxitem= data->prv_rows * data->prv_cols;
- } else {
+ }
+ else {
data->items.maxitem= SEARCH_ITEMS;
}
data->items.maxstrlen= but->hardmax;
@@ -1139,7 +1202,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
data->items.names= MEM_callocN(data->items.maxitem*sizeof(void *), "search names");
data->items.pointers= MEM_callocN(data->items.maxitem*sizeof(void *), "search pointers");
data->items.icons= MEM_callocN(data->items.maxitem*sizeof(int), "search icons");
- for(x1=0; x1<data->items.maxitem; x1++)
+ for (x1=0; x1<data->items.maxitem; x1++)
data->items.names[x1]= MEM_callocN(but->hardmax+1, "search pointers");
return ar;
@@ -1159,7 +1222,7 @@ void ui_but_search_test(uiBut *but)
/* possibly very large lists (such as ID datablocks) only
* only validate string RNA buts (not pointers) */
- if(but->rnaprop && RNA_property_type(but->rnaprop) != PROP_STRING) {
+ if (but->rnaprop && RNA_property_type(but->rnaprop) != PROP_STRING) {
return;
}
@@ -1169,19 +1232,19 @@ void ui_but_search_test(uiBut *but)
items->maxitem= 10;
items->maxstrlen= 256;
items->names= MEM_callocN(items->maxitem*sizeof(void *), "search names");
- for(x1=0; x1<items->maxitem; x1++)
+ for (x1=0; x1<items->maxitem; x1++)
items->names[x1]= MEM_callocN(but->hardmax+1, "search names");
but->search_func(but->block->evil_C, but->search_arg, but->drawstr, items);
/* only redalert when we are sure of it, this can miss cases when >10 matches */
- if(items->totitem==0)
+ if (items->totitem==0)
uiButSetFlag(but, UI_BUT_REDALERT);
- else if(items->more==0) {
- for(x1= 0; x1<items->totitem; x1++)
- if(strcmp(but->drawstr, items->names[x1])==0)
+ else if (items->more==0) {
+ for (x1= 0; x1<items->totitem; x1++)
+ if (strcmp(but->drawstr, items->names[x1])==0)
break;
- if(x1==items->totitem)
+ if (x1==items->totitem)
uiButSetFlag(but, UI_BUT_REDALERT);
}
@@ -1206,25 +1269,25 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
short dir1= 0, dir2=0;
/* transform to window coordinates, using the source button region/block */
- butrct.xmin= but->x1; butrct.xmax= but->x2;
- butrct.ymin= but->y1; butrct.ymax= but->y2;
+ butrct.xmin = but->x1; butrct.xmax = but->x2;
+ butrct.ymin = but->y1; butrct.ymax = but->y2;
ui_block_to_window_fl(butregion, but->block, &butrct.xmin, &butrct.ymin);
ui_block_to_window_fl(butregion, but->block, &butrct.xmax, &butrct.ymax);
/* calc block rect */
- if(block->minx == 0.0f && block->maxx == 0.0f) {
- if(block->buttons.first) {
+ if (block->minx == 0.0f && block->maxx == 0.0f) {
+ if (block->buttons.first) {
block->minx= block->miny= 10000;
block->maxx= block->maxy= -10000;
bt= block->buttons.first;
- while(bt) {
- if(bt->x1 < block->minx) block->minx= bt->x1;
- if(bt->y1 < block->miny) block->miny= bt->y1;
+ while (bt) {
+ if (bt->x1 < block->minx) block->minx= bt->x1;
+ if (bt->y1 < block->miny) block->miny= bt->y1;
- if(bt->x2 > block->maxx) block->maxx= bt->x2;
- if(bt->y2 > block->maxy) block->maxy= bt->y2;
+ if (bt->x2 > block->maxx) block->maxx= bt->x2;
+ if (bt->y2 > block->maxy) block->maxy= bt->y2;
bt= bt->next;
}
@@ -1254,16 +1317,16 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
wm_window_get_size(window, &winx, &winy);
- if(block->direction & UI_CENTER) center= ysize/2;
+ if (block->direction & UI_CENTER) center= ysize/2;
else center= 0;
/* check if there's space at all */
- if( butrct.xmin-xsize > 0.0f) left= 1;
- if( butrct.xmax+xsize < winx) right= 1;
- if( butrct.ymin-ysize+center > 0.0f) down= 1;
- if( butrct.ymax+ysize-center < winy) top= 1;
+ if ( butrct.xmin-xsize > 0.0f) left= 1;
+ if ( butrct.xmax+xsize < winx) right= 1;
+ if ( butrct.ymin-ysize+center > 0.0f) down= 1;
+ if ( butrct.ymax+ysize-center < winy) top= 1;
- if(top==0 && down==0) {
+ if (top==0 && down==0) {
if (butrct.ymin-ysize < winy-butrct.ymax-ysize)
top= 1;
else
@@ -1273,74 +1336,74 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
dir1= block->direction & UI_DIRECTION;
/* secundary directions */
- if(dir1 & (UI_TOP|UI_DOWN)) {
- if(dir1 & UI_LEFT) dir2= UI_LEFT;
- else if(dir1 & UI_RIGHT) dir2= UI_RIGHT;
+ if (dir1 & (UI_TOP|UI_DOWN)) {
+ if (dir1 & UI_LEFT) dir2= UI_LEFT;
+ else if (dir1 & UI_RIGHT) dir2= UI_RIGHT;
dir1 &= (UI_TOP|UI_DOWN);
}
- if(dir2==0) if(dir1==UI_LEFT || dir1==UI_RIGHT) dir2= UI_DOWN;
- if(dir2==0) if(dir1==UI_TOP || dir1==UI_DOWN) dir2= UI_LEFT;
+ if (dir2==0) if (dir1==UI_LEFT || dir1==UI_RIGHT) dir2= UI_DOWN;
+ if (dir2==0) if (dir1==UI_TOP || dir1==UI_DOWN) dir2= UI_LEFT;
- /* no space at all? dont change */
- if(left || right) {
- if(dir1==UI_LEFT && left==0) dir1= UI_RIGHT;
- if(dir1==UI_RIGHT && right==0) dir1= UI_LEFT;
+ /* no space at all? don't change */
+ if (left || right) {
+ if (dir1==UI_LEFT && left==0) dir1= UI_RIGHT;
+ if (dir1==UI_RIGHT && right==0) dir1= UI_LEFT;
/* this is aligning, not append! */
- if(dir2==UI_LEFT && right==0) dir2= UI_RIGHT;
- if(dir2==UI_RIGHT && left==0) dir2= UI_LEFT;
+ if (dir2==UI_LEFT && right==0) dir2= UI_RIGHT;
+ if (dir2==UI_RIGHT && left==0) dir2= UI_LEFT;
}
- if(down || top) {
- if(dir1==UI_TOP && top==0) dir1= UI_DOWN;
- if(dir1==UI_DOWN && down==0) dir1= UI_TOP;
- if(dir2==UI_TOP && top==0) dir2= UI_DOWN;
- if(dir2==UI_DOWN && down==0) dir2= UI_TOP;
+ if (down || top) {
+ if (dir1==UI_TOP && top==0) dir1= UI_DOWN;
+ if (dir1==UI_DOWN && down==0) dir1= UI_TOP;
+ if (dir2==UI_TOP && top==0) dir2= UI_DOWN;
+ if (dir2==UI_DOWN && down==0) dir2= UI_TOP;
}
- if(dir1==UI_LEFT) {
+ if (dir1==UI_LEFT) {
xof= butrct.xmin - block->maxx;
- if(dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
+ if (dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
else yof= butrct.ymax - block->maxy+center;
}
- else if(dir1==UI_RIGHT) {
+ else if (dir1==UI_RIGHT) {
xof= butrct.xmax - block->minx;
- if(dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
+ if (dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
else yof= butrct.ymax - block->maxy+center;
}
- else if(dir1==UI_TOP) {
+ else if (dir1==UI_TOP) {
yof= butrct.ymax - block->miny;
- if(dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
+ if (dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
else xof= butrct.xmin - block->minx;
// changed direction?
- if((dir1 & block->direction)==0) {
- if(block->direction & UI_SHIFT_FLIPPED)
+ if ((dir1 & block->direction)==0) {
+ if (block->direction & UI_SHIFT_FLIPPED)
xof+= dir2==UI_LEFT?25:-25;
uiBlockFlipOrder(block);
}
}
- else if(dir1==UI_DOWN) {
+ else if (dir1==UI_DOWN) {
yof= butrct.ymin - block->maxy;
- if(dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
+ if (dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
else xof= butrct.xmin - block->minx;
// changed direction?
- if((dir1 & block->direction)==0) {
- if(block->direction & UI_SHIFT_FLIPPED)
+ if ((dir1 & block->direction)==0) {
+ if (block->direction & UI_SHIFT_FLIPPED)
xof+= dir2==UI_LEFT?25:-25;
uiBlockFlipOrder(block);
}
}
/* and now we handle the exception; no space below or to top */
- if(top==0 && down==0) {
- if(dir1==UI_LEFT || dir1==UI_RIGHT) {
+ if (top==0 && down==0) {
+ if (dir1==UI_LEFT || dir1==UI_RIGHT) {
// align with bottom of screen
// yof= ysize; (not with menu scrolls)
}
}
/* or no space left or right */
- if(left==0 && right==0) {
- if(dir1==UI_TOP || dir1==UI_DOWN) {
+ if (left==0 && right==0) {
+ if (dir1==UI_TOP || dir1==UI_DOWN) {
// align with left size of screen
xof= -block->minx+5;
}
@@ -1351,16 +1414,16 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
yof += block->yofs/block->aspect;
#if 0
/* clamp to window bounds, could be made into an option if its ever annoying */
- if( (offscreen= (block->miny+yof)) < 0) yof -= offscreen; /* bottom */
- else if((offscreen= (block->maxy+yof)-winy) > 0) yof -= offscreen; /* top */
- if( (offscreen= (block->minx+xof)) < 0) xof -= offscreen; /* left */
- else if((offscreen= (block->maxx+xof)-winx) > 0) xof -= offscreen; /* right */
+ if ( (offscreen= (block->miny+yof)) < 0) yof -= offscreen; /* bottom */
+ else if ((offscreen= (block->maxy+yof)-winy) > 0) yof -= offscreen; /* top */
+ if ( (offscreen= (block->minx+xof)) < 0) xof -= offscreen; /* left */
+ else if ((offscreen= (block->maxx+xof)-winx) > 0) xof -= offscreen; /* right */
#endif
}
/* apply offset, buttons in window coords */
- for(bt= block->buttons.first; bt; bt= bt->next) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
ui_block_to_window_fl(butregion, but->block, &bt->x1, &bt->y1);
ui_block_to_window_fl(butregion, but->block, &bt->x2, &bt->y2);
@@ -1380,38 +1443,38 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
block->maxy += yof;
/* safety calculus */
- if(but) {
+ if (but) {
float midx= (butrct.xmin+butrct.xmax)/2.0f;
float midy= (butrct.ymin+butrct.ymax)/2.0f;
/* when you are outside parent button, safety there should be smaller */
// parent button to left
- if( midx < block->minx ) block->safety.xmin= block->minx-3;
- else block->safety.xmin= block->minx-40;
+ if ( midx < block->minx ) block->safety.xmin = block->minx-3;
+ else block->safety.xmin = block->minx-40;
// parent button to right
- if( midx > block->maxx ) block->safety.xmax= block->maxx+3;
- else block->safety.xmax= block->maxx+40;
+ if ( midx > block->maxx ) block->safety.xmax = block->maxx+3;
+ else block->safety.xmax = block->maxx+40;
// parent button on bottom
- if( midy < block->miny ) block->safety.ymin= block->miny-3;
- else block->safety.ymin= block->miny-40;
+ if ( midy < block->miny ) block->safety.ymin = block->miny-3;
+ else block->safety.ymin = block->miny-40;
// parent button on top
- if( midy > block->maxy ) block->safety.ymax= block->maxy+3;
- else block->safety.ymax= block->maxy+40;
+ if ( midy > block->maxy ) block->safety.ymax = block->maxy+3;
+ else block->safety.ymax = block->maxy+40;
// exception for switched pulldowns...
- if(dir1 && (dir1 & block->direction)==0) {
- if(dir2==UI_RIGHT) block->safety.xmax= block->maxx+3;
- if(dir2==UI_LEFT) block->safety.xmin= block->minx-3;
+ if (dir1 && (dir1 & block->direction)==0) {
+ if (dir2==UI_RIGHT) block->safety.xmax = block->maxx+3;
+ if (dir2==UI_LEFT) block->safety.xmin = block->minx-3;
}
block->direction= dir1;
}
else {
- block->safety.xmin= block->minx-40;
- block->safety.ymin= block->miny-40;
- block->safety.xmax= block->maxx+40;
- block->safety.ymax= block->maxy+40;
+ block->safety.xmin = block->minx-40;
+ block->safety.ymin = block->miny-40;
+ block->safety.xmax = block->maxx+40;
+ block->safety.ymax = block->maxy+40;
}
/* keep a list of these, needed for pulldown menus */
@@ -1419,7 +1482,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
saferct->parent= butrct;
saferct->safety= block->safety;
BLI_freelistN(&block->saferct);
- if(but)
+ if (but)
BLI_duplicatelist(&block->saferct, &but->block->saferct);
BLI_addhead(&block->saferct, saferct);
}
@@ -1428,7 +1491,7 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar)
{
uiBlock *block;
- for(block=ar->uiblocks.first; block; block=block->next)
+ for (block=ar->uiblocks.first; block; block=block->next)
uiDrawBlock(C, block);
}
@@ -1438,14 +1501,14 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
wm_window_get_size(window, &winx, &winy);
- if(block->minx < MENU_SHADOW_SIDE)
+ if (block->minx < MENU_SHADOW_SIDE)
block->minx= MENU_SHADOW_SIDE;
- if(block->maxx > winx-MENU_SHADOW_SIDE)
+ if (block->maxx > winx-MENU_SHADOW_SIDE)
block->maxx= winx-MENU_SHADOW_SIDE;
- if(block->miny < MENU_SHADOW_BOTTOM)
+ if (block->miny < MENU_SHADOW_BOTTOM)
block->miny= MENU_SHADOW_BOTTOM;
- if(block->maxy > winy-MENU_TOP)
+ if (block->maxy > winy-MENU_TOP)
block->maxy= winy-MENU_TOP;
}
@@ -1457,33 +1520,33 @@ void ui_popup_block_scrolltest(uiBlock *block)
block->flag &= ~(UI_BLOCK_CLIPBOTTOM|UI_BLOCK_CLIPTOP);
- for(bt= block->buttons.first; bt; bt= bt->next)
+ for (bt= block->buttons.first; bt; bt= bt->next)
bt->flag &= ~UI_SCROLLED;
- if(block->buttons.first==block->buttons.last)
+ if (block->buttons.first==block->buttons.last)
return;
/* mark buttons that are outside boundary and the ones next to it for arrow(s) */
- for(bt= block->buttons.first; bt; bt= bt->next) {
- if(bt->y1 < block->miny) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
+ if (bt->y1 < block->miny) {
bt->flag |= UI_SCROLLED;
block->flag |= UI_BLOCK_CLIPBOTTOM;
/* make space for arrow */
- if(bt->y2 < block->miny +10) {
- if(is_flip && bt->next && bt->next->y1 > bt->y1)
+ if (bt->y2 < block->miny +10) {
+ if (is_flip && bt->next && bt->next->y1 > bt->y1)
bt->next->flag |= UI_SCROLLED;
- else if(!is_flip && bt->prev && bt->prev->y1 > bt->y1)
+ else if (!is_flip && bt->prev && bt->prev->y1 > bt->y1)
bt->prev->flag |= UI_SCROLLED;
}
}
- if(bt->y2 > block->maxy) {
+ if (bt->y2 > block->maxy) {
bt->flag |= UI_SCROLLED;
block->flag |= UI_BLOCK_CLIPTOP;
/* make space for arrow */
- if(bt->y1 > block->maxy -10) {
- if(!is_flip && bt->next && bt->next->y2 < bt->y2)
+ if (bt->y1 > block->maxy -10) {
+ if (!is_flip && bt->next && bt->next->y2 < bt->y2)
bt->next->flag |= UI_SCROLLED;
- else if(is_flip && bt->prev && bt->prev->y2 < bt->y2)
+ else if (is_flip && bt->prev && bt->prev->y2 < bt->y2)
bt->prev->flag |= UI_SCROLLED;
}
}
@@ -1518,12 +1581,12 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
UI_add_region_handlers(&ar->handlers);
/* create ui block */
- if(create_func)
+ if (create_func)
block= create_func(C, handle->region, arg);
else
block= handle_create_func(C, handle, arg);
- if(block->handle) {
+ if (block->handle) {
memcpy(block->handle, handle, sizeof(uiPopupBlockHandle));
MEM_freeN(handle);
handle= block->handle;
@@ -1533,12 +1596,12 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
ar->regiondata= handle;
- if(!block->endblock)
+ if (!block->endblock)
uiEndBlock(C, block);
/* if this is being created from a button */
- if(but) {
- if(ELEM(but->type, BLOCK, PULLDOWN))
+ if (but) {
+ if (ELEM(but->type, BLOCK, PULLDOWN))
block->xofs = -2; /* for proper alignment */
block->aspect = but->block->aspect;
@@ -1559,17 +1622,17 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
/* the block and buttons were positioned in window space as in 2.4x, now
* these menu blocks are regions so we bring it back to region space.
* additionally we add some padding for the menu shadow or rounded menus */
- ar->winrct.xmin= block->minx - MENU_SHADOW_SIDE;
- ar->winrct.xmax= block->maxx + MENU_SHADOW_SIDE;
- ar->winrct.ymin= block->miny - MENU_SHADOW_BOTTOM;
- ar->winrct.ymax= block->maxy + MENU_TOP;
+ ar->winrct.xmin = block->minx - MENU_SHADOW_SIDE;
+ ar->winrct.xmax = block->maxx + MENU_SHADOW_SIDE;
+ ar->winrct.ymin = block->miny - MENU_SHADOW_BOTTOM;
+ ar->winrct.ymax = block->maxy + MENU_TOP;
block->minx -= ar->winrct.xmin;
block->maxx -= ar->winrct.xmin;
block->miny -= ar->winrct.ymin;
block->maxy -= ar->winrct.ymin;
- for(bt= block->buttons.first; bt; bt= bt->next) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
bt->x1 -= ar->winrct.xmin;
bt->x2 -= ar->winrct.xmin;
bt->y1 -= ar->winrct.ymin;
@@ -1599,7 +1662,7 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
{
ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region);
- if(handle->scrolltimer)
+ if (handle->scrolltimer)
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), handle->scrolltimer);
MEM_freeN(handle);
@@ -1626,20 +1689,20 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
/* columns and row estimation */
columns= (md->nitems+20)/20;
- if(columns<1)
+ if (columns<1)
columns= 1;
- if(columns>8)
+ if (columns>8)
columns= (md->nitems+25)/25;
rows= md->nitems/columns;
- if(rows<1)
+ if (rows<1)
rows= 1;
- while(rows*columns<md->nitems)
+ while (rows*columns<md->nitems)
rows++;
/* create title */
- if(md->title) {
- if(md->titleicon) {
+ if (md->title) {
+ if (md->titleicon) {
uiItemL(layout, md->title, md->titleicon);
}
else {
@@ -1651,8 +1714,8 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
/* inconsistent, but menus with labels do not look good flipped */
entry= md->items;
- for(a=0; a<md->nitems; a++, entry++) {
- if(entry->sepr && entry->str[0]) {
+ for (a=0; a<md->nitems; a++, entry++) {
+ if (entry->sepr && entry->str[0]) {
block->flag |= UI_BLOCK_NO_FLIP;
break;
}
@@ -1661,18 +1724,18 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
/* create items */
split= uiLayoutSplit(layout, 0, 0);
- for(a=0; a<md->nitems; a++) {
- if(a == column_end) {
+ for (a=0; a<md->nitems; a++) {
+ if (a == column_end) {
/* start new column, and find out where it ends in advance, so we
* can flip the order of items properly per column */
column_start= a;
column_end= md->nitems;
- for(b=a+1; b<md->nitems; b++) {
+ for (b=a+1; b<md->nitems; b++) {
entry= &md->items[b];
/* new column on N rows or on separation label */
- if(((b-a) % rows == 0) || (entry->sepr && entry->str[0])) {
+ if (((b-a) % rows == 0) || (entry->sepr && entry->str[0])) {
column_end = b;
break;
}
@@ -1681,17 +1744,17 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
column= uiLayoutColumn(split, 0);
}
- if(block->flag & UI_BLOCK_NO_FLIP)
+ if (block->flag & UI_BLOCK_NO_FLIP)
entry= &md->items[a];
else
entry= &md->items[column_start + column_end-1-a];
- if(entry->sepr) {
+ if (entry->sepr) {
uiItemL(column, entry->str, entry->icon);
bt= block->buttons.last;
bt->flag= UI_TEXT_LEFT;
}
- else if(entry->icon) {
+ else if (entry->icon) {
uiDefIconTextButF(block, BUTM|FLO, B_NOP, entry->icon, entry->str, 0, 0,
UI_UNIT_X*5, UI_UNIT_Y, &handle->retvalue, (float) entry->retval, 0.0, 0, 0, "");
}
@@ -1713,7 +1776,7 @@ void ui_block_func_ICONROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but)
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
- for(a=(int)but->hardmin; a<=(int)but->hardmax; a++)
+ for (a=(int)but->hardmin; a<=(int)but->hardmax; a++)
uiDefIconButF(block, BUTM|FLO, B_NOP, but->icon+(a-but->hardmin), 0, 0, UI_UNIT_X*5, UI_UNIT_Y,
&handle->retvalue, (float)a, 0.0, 0, 0, "");
}
@@ -1732,16 +1795,16 @@ void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_
md= decompose_menu_string(but->str);
/* title */
- if(md->title) {
+ if (md->title) {
bt= uiDefBut(block, LABEL, 0, md->title, 0, 0, UI_UNIT_X*5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
bt->flag= UI_TEXT_LEFT;
}
/* loop through the menu options and draw them out with icons & text labels */
- for(a=0; a<md->nitems; a++) {
+ for (a=0; a<md->nitems; a++) {
entry= &md->items[md->nitems-a-1];
- if(entry->sepr)
+ if (entry->sepr)
uiItemS(layout);
else
uiDefIconTextButF(block, BUTM|FLO, B_NOP, (short)((but->icon)+(entry->retval-but->hardmin)), entry->str,
@@ -1793,13 +1856,13 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
// this updates button strings, is hackish... but button pointers are on stack of caller function
- for(bt= block->buttons.first; bt; bt= bt->next) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
if (bt->rnaprop) {
ui_set_but_vectorf(bt, rgb);
}
- else if(strcmp(bt->str, "Hex: ")==0) {
+ else if (strcmp(bt->str, "Hex: ")==0) {
float rgb_gamma[3];
double intpart;
char col[16];
@@ -1808,7 +1871,8 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
if (block->color_profile == BLI_PR_NONE) {
copy_v3_v3(rgb_gamma, rgb);
- } else {
+ }
+ else {
/* make an sRGB version, for Hex code */
linearrgb_to_srgb_v3_v3(rgb_gamma, rgb);
}
@@ -1821,23 +1885,23 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
strcpy(bt->poin, col);
}
- else if(bt->str[1]==' ') {
- if(bt->str[0]=='R') {
+ else if (bt->str[1]==' ') {
+ if (bt->str[0]=='R') {
ui_set_but_val(bt, rgb[0]);
}
- else if(bt->str[0]=='G') {
+ else if (bt->str[0]=='G') {
ui_set_but_val(bt, rgb[1]);
}
- else if(bt->str[0]=='B') {
+ else if (bt->str[0]=='B') {
ui_set_but_val(bt, rgb[2]);
}
- else if(bt->str[0]=='H') {
+ else if (bt->str[0]=='H') {
ui_set_but_val(bt, hsv[0]);
}
- else if(bt->str[0]=='S') {
+ else if (bt->str[0]=='S') {
ui_set_but_val(bt, hsv[1]);
}
- else if(bt->str[0]=='V') {
+ else if (bt->str[0]=='V') {
ui_set_but_val(bt, hsv[2]);
}
}
@@ -1859,7 +1923,7 @@ static void do_picker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
ui_update_block_buts_rgb(but->block, rgb);
}
- if(popup)
+ if (popup)
popup->menuretval= UI_RETURN_UPDATE;
}
@@ -1874,7 +1938,7 @@ static void do_hsv_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
ui_update_block_buts_rgb(but->block, rgb);
- if(popup)
+ if (popup)
popup->menuretval= UI_RETURN_UPDATE;
}
@@ -1895,7 +1959,7 @@ static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl)
ui_update_block_buts_rgb(but->block, rgb);
- if(popup)
+ if (popup)
popup->menuretval= UI_RETURN_UPDATE;
}
@@ -1904,7 +1968,7 @@ static void close_popup_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
uiBut *but= (uiBut *)bt1;
uiPopupBlockHandle *popup= but->block->handle;
- if(popup)
+ if (popup)
popup->menuretval= UI_RETURN_OK;
}
@@ -1913,26 +1977,26 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode)
uiBut *bt;
/* tag buttons */
- for(bt= block->buttons.first; bt; bt= bt->next) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
if (bt->type == LABEL) {
- if( bt->str[1]=='G') {
- if(colormode==2) bt->flag &= ~UI_HIDDEN;
+ if ( bt->str[1]=='G') {
+ if (colormode==2) bt->flag &= ~UI_HIDDEN;
else bt->flag |= UI_HIDDEN;
}
}
- if(bt->type==NUMSLI || bt->type==TEX) {
- if( bt->str[1]=='e') {
- if(colormode==2) bt->flag &= ~UI_HIDDEN;
+ if (bt->type==NUMSLI || bt->type==TEX) {
+ if ( bt->str[1]=='e') {
+ if (colormode==2) bt->flag &= ~UI_HIDDEN;
else bt->flag |= UI_HIDDEN;
}
- else if( ELEM3(bt->str[0], 'R', 'G', 'B')) {
- if(colormode==0) bt->flag &= ~UI_HIDDEN;
+ else if ( ELEM3(bt->str[0], 'R', 'G', 'B')) {
+ if (colormode==0) bt->flag &= ~UI_HIDDEN;
else bt->flag |= UI_HIDDEN;
}
- else if( ELEM3(bt->str[0], 'H', 'S', 'V')) {
- if(colormode==1) bt->flag &= ~UI_HIDDEN;
+ else if ( ELEM3(bt->str[0], 'H', 'S', 'V')) {
+ if (colormode==1) bt->flag &= ~UI_HIDDEN;
else bt->flag |= UI_HIDDEN;
}
}
@@ -2007,7 +2071,8 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
if (block->color_profile == BLI_PR_NONE) {
BLI_strncpy(tip, "Value in Display Color Space", sizeof(tip));
copy_v3_v3(rgb_gamma, rgb);
- } else {
+ }
+ else {
BLI_strncpy(tip, "Value in Linear RGB Color Space", sizeof(tip));
/* make an sRGB version, for Hex code */
linearrgb_to_srgb_v3_v3(rgb_gamma, rgb);
@@ -2069,7 +2134,7 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
uiBlockEndAlign(block);
- if(rgb[3] != FLT_MAX) {
+ if (rgb[3] != FLT_MAX) {
bt= uiDefButR_prop(block, NUMSLI, 0, "A ", 0, -120, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 0, "Alpha");
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
}
@@ -2093,16 +2158,16 @@ static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, w
{
float add= 0.0f;
- if(event->type==WHEELUPMOUSE)
+ if (event->type==WHEELUPMOUSE)
add= 0.05f;
- else if(event->type==WHEELDOWNMOUSE)
+ else if (event->type==WHEELDOWNMOUSE)
add= -0.05f;
- if(add!=0.0f) {
+ if (add!=0.0f) {
uiBut *but;
- for(but= block->buttons.first; but; but= but->next) {
- if(but->type==HSVCUBE && but->active==NULL) {
+ for (but= block->buttons.first; but; but= but->next) {
+ if (but->type==HSVCUBE && but->active==NULL) {
uiPopupBlockHandle *popup= block->handle;
float col[3];
float *hsv= ui_block_hsv_get(block);
@@ -2116,7 +2181,7 @@ static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, w
ui_set_but_vectorf(but, col);
ui_update_block_buts_rgb(block, col);
- if(popup)
+ if (popup)
popup->menuretval= UI_RETURN_UPDATE;
return 1;
@@ -2164,9 +2229,9 @@ static int ui_popup_string_hash(char *str)
int hash;
char *delimit= strchr(str, '|');
- if(delimit) *delimit= 0;
+ if (delimit) *delimit= 0;
hash= BLI_ghashutil_strhash(str);
- if(delimit) *delimit= '|';
+ if (delimit) *delimit= '|';
return hash;
}
@@ -2182,21 +2247,21 @@ uiBut *ui_popup_menu_memory(uiBlock *block, uiBut *but)
static int mem[256], first=1;
int hash= block->puphash;
- if(first) {
+ if (first) {
/* init */
memset(mem, -1, sizeof(mem));
first= 0;
}
- if(but) {
+ if (but) {
/* set */
mem[hash & 255 ]= ui_popup_string_hash(but->str);
return NULL;
}
else {
/* get */
- for(but=block->buttons.first; but; but=but->next)
- if(ui_popup_string_hash(but->str) == mem[hash & 255])
+ for (but=block->buttons.first; but; but=but->next)
+ if (ui_popup_string_hash(but->str) == mem[hash & 255])
return but;
return NULL;
@@ -2224,17 +2289,17 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
uiPopupMenu *pup= arg_pup;
int offset[2], direction, minwidth, width, height, flip;
- if(pup->menu_func) {
+ if (pup->menu_func) {
pup->block->handle= handle;
pup->menu_func(C, pup->layout, pup->menu_arg);
pup->block->handle= NULL;
}
- if(pup->but) {
+ if (pup->but) {
/* minimum width to enforece */
minwidth= pup->but->x2 - pup->but->x1;
- if(pup->but->type == PULLDOWN || pup->but->menu_create_func) {
+ if (pup->but->type == PULLDOWN || pup->but->menu_create_func) {
direction= UI_DOWN;
flip= 1;
}
@@ -2253,7 +2318,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
/* in some cases we create the block before the region,
* so we set it delayed here if necessary */
- if(BLI_findindex(&handle->region->uiblocks, block) == -1)
+ if (BLI_findindex(&handle->region->uiblocks, block) == -1)
uiBlockSetRegion(block, handle->region);
block->direction= direction;
@@ -2262,12 +2327,12 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
- if(pup->popup) {
+ if (pup->popup) {
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT|UI_BLOCK_RET_1);
uiBlockSetDirection(block, direction);
/* offset the mouse position, possibly based on earlier selection */
- if((block->flag & UI_BLOCK_POPUP_MEMORY) &&
+ if ((block->flag & UI_BLOCK_POPUP_MEMORY) &&
(bt= ui_popup_menu_memory(block, NULL))) {
/* position mouse on last clicked item, at 0.8*width of the
* button, so it doesn't overlap the text too much, also note
@@ -2280,7 +2345,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
/* position mouse at 0.8*width of the button and below the tile
* on the first item */
offset[0]= 0;
- for(bt=block->buttons.first; bt; bt=bt->next)
+ for (bt=block->buttons.first; bt; bt=bt->next)
offset[0]= MIN2(offset[0], -(bt->x1 + 0.8f*(bt->x2 - bt->x1)));
offset[1]= 1.5*UI_UNIT_Y;
@@ -2291,11 +2356,11 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
}
else {
/* for a header menu we set the direction automatic */
- if(!pup->slideout && flip) {
+ if (!pup->slideout && flip) {
ScrArea *sa= CTX_wm_area(C);
- if(sa && sa->headertype==HEADERDOWN) {
+ if (sa && sa->headertype==HEADERDOWN) {
ARegion *ar= CTX_wm_region(C);
- if(ar && ar->regiontype == RGN_TYPE_HEADER) {
+ if (ar && ar->regiontype == RGN_TYPE_HEADER) {
uiBlockSetDirection(block, UI_TOP);
uiBlockFlipOrder(block);
}
@@ -2307,7 +2372,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
}
/* if menu slides out of other menu, override direction */
- if(pup->slideout)
+ if (pup->slideout)
uiBlockSetDirection(block, UI_RIGHT);
uiEndBlock(C, block);
@@ -2328,7 +2393,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
pup->but= but;
uiLayoutSetOperatorContext(pup->layout, WM_OP_INVOKE_REGION_WIN);
- if(!but) {
+ if (!but) {
/* no button to start from, means we are a popup */
pup->mx= window->eventstate->x;
pup->my= window->eventstate->y;
@@ -2343,13 +2408,13 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
/* if this is an rna button then we can assume its an enum
* flipping enums is generally not good since the order can be
* important [#28786] */
- if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
+ if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
pup->block->flag |= UI_BLOCK_NO_FLIP;
}
}
#endif
- if(str) {
+ if (str) {
/* menu is created from a string */
pup->menu_func= ui_block_func_MENUSTR;
pup->menu_arg= str;
@@ -2362,7 +2427,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
handle= ui_popup_block_create(C, butregion, but, NULL, ui_block_func_POPUP, pup);
- if(!but) {
+ if (!but) {
handle->popup= 1;
UI_add_popup_handlers(C, &window->modalhandlers, handle);
@@ -2393,15 +2458,15 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
pup->block->handle= MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle");
/* create title button */
- if(title && title[0]) {
+ if (title && title[0]) {
char titlestr[256];
- if(icon) {
+ if (icon) {
BLI_snprintf(titlestr, sizeof(titlestr), " %s", title);
uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
}
else {
- but= uiDefBut(pup->block, LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ but = uiDefBut(pup->block, LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
but->flag= UI_TEXT_LEFT;
}
}
@@ -2439,7 +2504,7 @@ static void operator_name_cb(bContext *C, void *arg, int retval)
{
const char *opname= arg;
- if(opname && retval > 0)
+ if (opname && retval > 0)
WM_operator_name_call(C, opname, WM_OP_EXEC_DEFAULT, NULL);
}
@@ -2447,7 +2512,7 @@ static void operator_cb(bContext *C, void *arg, int retval)
{
wmOperator *op= arg;
- if(op && retval > 0)
+ if (op && retval > 0)
WM_operator_call(C, op);
else
WM_operator_free(op);
@@ -2542,26 +2607,26 @@ void uiPupMenuReports(bContext *C, ReportList *reports)
DynStr *ds;
char *str;
- if(!reports || !reports->list.first)
+ if (!reports || !reports->list.first)
return;
- if(!CTX_wm_window(C))
+ if (!CTX_wm_window(C))
return;
ds= BLI_dynstr_new();
- for(report=reports->list.first; report; report=report->next) {
- if(report->type < reports->printlevel)
+ for (report=reports->list.first; report; report=report->next) {
+ if (report->type < reports->printlevel)
; /* pass */
- else if(report->type >= RPT_ERROR)
+ else if (report->type >= RPT_ERROR)
BLI_dynstr_appendf(ds, "Error %%i%d%%t|%s", ICON_ERROR, report->message);
- else if(report->type >= RPT_WARNING)
+ else if (report->type >= RPT_WARNING)
BLI_dynstr_appendf(ds, "Warning %%i%d%%t|%s", ICON_ERROR, report->message);
- else if(report->type >= RPT_INFO)
+ else if (report->type >= RPT_INFO)
BLI_dynstr_appendf(ds, "Info %%i%d%%t|%s", ICON_INFO, report->message);
}
str= BLI_dynstr_get_cstring(ds);
- if(str[0] != '\0')
+ if (str[0] != '\0')
ui_popup_menu_create(C, NULL, NULL, NULL, NULL, str);
MEM_freeN(str);
@@ -2573,14 +2638,14 @@ void uiPupMenuInvoke(bContext *C, const char *idname)
uiPopupMenu *pup;
uiLayout *layout;
Menu menu;
- MenuType *mt= WM_menutype_find(idname, TRUE);
+ MenuType *mt = WM_menutype_find(idname, TRUE);
- if(mt==NULL) {
+ if (mt==NULL) {
printf("%s: named menu \"%s\" not found\n", __func__, idname);
return;
}
- if(mt->poll && mt->poll(C, mt)==0)
+ if (mt->poll && mt->poll(C, mt)==0)
return;
pup= uiPupMenuBegin(C, mt->label, ICON_NONE);
@@ -2656,11 +2721,11 @@ void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int
void uiPupBlockClose(bContext *C, uiBlock *block)
{
- if(block->handle) {
+ if (block->handle) {
wmWindow *win = CTX_wm_window(C);
/* if loading new .blend while popup is open, window will be NULL */
- if(win) {
+ if (win) {
UI_remove_popup_handlers(&win->modalhandlers, block->handle);
ui_popup_block_free(C, block->handle);
}
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 65e2b98f4b9..6a2038b18bc 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -132,8 +132,8 @@ static uiFont *uifont_to_blfont(int id)
{
uiFont *font= U.uifonts.first;
- for(; font; font= font->next) {
- if(font->uifont_id==id) {
+ for (; font; font= font->next) {
+ if (font->uifont_id==id) {
return font;
}
}
@@ -154,14 +154,14 @@ void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str,
height= BLF_ascender(fs->uifont_id);
yofs= ceil( 0.5f*(rect->ymax - rect->ymin - height));
- if(fs->align==UI_STYLE_TEXT_CENTER) {
+ if (fs->align==UI_STYLE_TEXT_CENTER) {
xofs= floor( 0.5f*(rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str)));
/* don't center text if it chops off the start of the text, 2 gives some margin */
- if(xofs < 2) {
+ if (xofs < 2) {
xofs= 2;
}
}
- else if(fs->align==UI_STYLE_TEXT_RIGHT) {
+ else if (fs->align==UI_STYLE_TEXT_RIGHT) {
xofs= rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str) - 1;
}
@@ -219,10 +219,10 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
angle= 90.0f;
/* translate rect to vertical */
- txtrect.xmin= rect->xmin - (rect->ymax - rect->ymin);
- txtrect.ymin= rect->ymin - (rect->xmax - rect->xmin);
- txtrect.xmax= rect->xmin;
- txtrect.ymax= rect->ymin;
+ txtrect.xmin = rect->xmin - (rect->ymax - rect->ymin);
+ txtrect.ymin = rect->ymin - (rect->xmax - rect->xmin);
+ txtrect.xmax = rect->xmin;
+ txtrect.ymax = rect->ymin;
/* clip is very strict, so we give it some space */
/* clipping is done without rotation, so make rect big enough to contain both positions */
@@ -306,12 +306,12 @@ void uiStyleInit(void)
uiStyle *style= U.uistyles.first;
/* recover from uninitialized dpi */
- if(U.dpi == 0)
+ if (U.dpi == 0)
U.dpi= 72;
CLAMP(U.dpi, 48, 128);
/* default builtin */
- if(font==NULL) {
+ if (font==NULL) {
font= MEM_callocN(sizeof(uiFont), "ui font");
BLI_addtail(&U.uifonts, font);
@@ -319,19 +319,19 @@ void uiStyleInit(void)
font->uifont_id= UIFONT_DEFAULT;
}
- for(font= U.uifonts.first; font; font= font->next) {
+ for (font= U.uifonts.first; font; font= font->next) {
- if(font->uifont_id==UIFONT_DEFAULT) {
+ if (font->uifont_id==UIFONT_DEFAULT) {
#ifdef WITH_INTERNATIONAL
int font_size= datatoc_bfont_ttf_size;
unsigned char *font_ttf= (unsigned char*)datatoc_bfont_ttf;
static int last_font_size = 0;
/* use unicode font for translation */
- if(U.transopts & USER_DOTRANSLATE) {
+ if (U.transopts & USER_DOTRANSLATE) {
font_ttf= BLF_get_unifont(&font_size);
- if(!font_ttf) {
+ if (!font_ttf) {
/* fall back if not found */
font_size= datatoc_bfont_ttf_size;
font_ttf= (unsigned char*)datatoc_bfont_ttf;
@@ -339,7 +339,7 @@ void uiStyleInit(void)
}
/* relload only if needed */
- if(last_font_size != font_size) {
+ if (last_font_size != font_size) {
BLF_unload("default");
last_font_size = font_size;
}
@@ -351,7 +351,7 @@ void uiStyleInit(void)
}
else {
font->blf_id= BLF_load(font->filename);
- if(font->blf_id == -1)
+ if (font->blf_id == -1)
font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
}
@@ -370,7 +370,7 @@ void uiStyleInit(void)
}
}
- if(style==NULL) {
+ if (style==NULL) {
ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT );
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index a9aa3368a28..3df4dd7c887 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -84,7 +84,7 @@ void uiTemplateHeader(uiLayout *layout, bContext *C, int menus)
uiBlock *block;
block= uiLayoutAbsoluteBlock(layout);
- if(menus) ED_area_header_standardbuttons(C, block, 0);
+ if (menus) ED_area_header_standardbuttons(C, block, 0);
else ED_area_header_switchbutton(C, block, 0);
}
@@ -105,7 +105,7 @@ static void id_search_call_cb(bContext *C, void *arg_template, void *item)
TemplateID *template= (TemplateID*)arg_template;
/* ID */
- if(item) {
+ if (item) {
PointerRNA idptr;
RNA_id_pointer_create(item, &idptr);
@@ -124,29 +124,29 @@ static void id_search_cb(const bContext *C, void *arg_template, const char *str,
int flag= RNA_property_flag(template->prop);
/* ID listbase */
- for(id= lb->first; id; id= id->next) {
- if(!((flag & PROP_ID_SELF_CHECK) && id == id_from)) {
+ for (id= lb->first; id; id= id->next) {
+ if (!((flag & PROP_ID_SELF_CHECK) && id == id_from)) {
/* use filter */
- if(RNA_property_type(template->prop)==PROP_POINTER) {
+ if (RNA_property_type(template->prop)==PROP_POINTER) {
PointerRNA ptr;
RNA_id_pointer_create(id, &ptr);
- if(RNA_property_pointer_poll(&template->ptr, template->prop, &ptr)==0)
+ if (RNA_property_pointer_poll(&template->ptr, template->prop, &ptr)==0)
continue;
}
/* hide dot-datablocks, but only if filter does not force it visible */
- if(U.uiflag & USER_HIDE_DOT)
+ if (U.uiflag & USER_HIDE_DOT)
if ((id->name[2]=='.') && (str[0] != '.'))
continue;
- if(BLI_strcasestr(id->name+2, str)) {
+ if (BLI_strcasestr(id->name+2, str)) {
char name_ui[MAX_ID_NAME];
name_uiprefix_id(name_ui, id);
iconid= ui_id_icon_get((bContext*)C, id, template->preview);
- if(!uiSearchItemAdd(items, name_ui, id, iconid))
+ if (!uiSearchItemAdd(items, name_ui, id, iconid))
break;
}
}
@@ -182,7 +182,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
/* fake button, it holds space for search items */
uiDefBut(block, LABEL, 0, "", 10, 15, w, h, NULL, 0, 0, 0, 0, NULL);
- but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, 19, template.prv_rows, template.prv_cols, "");
+ but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, 19, template.prv_rows, template.prv_cols, "");
uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
}
/* list view */
@@ -190,7 +190,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
/* fake button, it holds space for search items */
uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
- but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, "");
+ but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, "");
uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
}
@@ -221,14 +221,14 @@ void uiIDContextProperty(bContext *C, PointerRNA *ptr, PropertyRNA **prop)
memset(ptr, 0, sizeof(*ptr));
*prop= NULL;
- if(!ar)
+ if (!ar)
return;
- for(block=ar->uiblocks.first; block; block=block->next) {
- for(but=block->buttons.first; but; but= but->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
+ for (but=block->buttons.first; but; but= but->next) {
/* find the button before the active one */
- if((but->flag & (UI_BUT_LAST_ACTIVE|UI_ACTIVE))) {
- if(but->func_argN) {
+ if ((but->flag & (UI_BUT_LAST_ACTIVE|UI_ACTIVE))) {
+ if (but->func_argN) {
template= but->func_argN;
*ptr= template->ptr;
*prop= template->prop;
@@ -261,20 +261,20 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
RNA_property_pointer_set(&template->ptr, template->prop, idptr);
RNA_property_update(C, &template->ptr, template->prop);
- if(id && CTX_wm_window(C)->eventstate->shift) /* useful hidden functionality, */
+ if (id && CTX_wm_window(C)->eventstate->shift) /* useful hidden functionality, */
id->us= 0;
break;
case UI_ID_FAKE_USER:
- if(id) {
- if(id->flag & LIB_FAKEUSER) id_us_plus(id);
+ if (id) {
+ if (id->flag & LIB_FAKEUSER) id_us_plus(id);
else id_us_min(id);
}
else return;
break;
case UI_ID_LOCAL:
- if(id) {
- if(id_make_local(id, 0)) {
+ if (id) {
+ if (id_make_local(id, 0)) {
/* reassign to get get proper updates/notifiers */
idptr= RNA_property_pointer_get(&template->ptr, template->prop);
RNA_property_pointer_set(&template->ptr, template->prop, idptr);
@@ -283,18 +283,18 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
}
break;
case UI_ID_ALONE:
- if(id) {
+ if (id) {
const int do_scene_obj= (GS(id->name) == ID_OB) &&
(template->ptr.type == &RNA_SceneObjects);
/* make copy */
- if(do_scene_obj) {
+ if (do_scene_obj) {
Scene *scene= CTX_data_scene(C);
ED_object_single_user(scene, (struct Object *)id);
WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
}
else {
- if(id) {
+ if (id) {
id_single_user(C, id, &template->ptr, template->prop);
}
}
@@ -309,7 +309,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
static const char *template_id_browse_tip(StructRNA *type)
{
- if(type) {
+ if (type) {
switch(RNA_type_to_ID_code(type)) {
case ID_SCE: return N_("Browse Scene to be linked");
case ID_OB: return N_("Browse Object to be linked");
@@ -356,138 +356,138 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
block= uiLayoutGetBlock(layout);
uiBlockBeginAlign(block);
- if(idptr.type)
+ if (idptr.type)
type= idptr.type;
- if(flag & UI_ID_PREVIEWS) {
+ if (flag & UI_ID_PREVIEWS) {
- but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6,
+ but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6,
TIP_(template_id_browse_tip(type)));
- if(type) {
+ if (type) {
but->icon= RNA_struct_ui_icon(type);
if (id) but->icon = ui_id_icon_get(C, id, 1);
uiButSetFlag(but, UI_HAS_ICON|UI_ICON_PREVIEW);
}
- if((idfrom && idfrom->lib) || !editable)
+ if ((idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
uiLayoutRow(layout, 1);
template->preview= 1;
}
- else if(flag & UI_ID_BROWSE) {
- but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y,
+ else if (flag & UI_ID_BROWSE) {
+ but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y,
TIP_(template_id_browse_tip(type)));
- if(type) {
+ if (type) {
but->icon= RNA_struct_ui_icon(type);
/* default dragging of icon for id browse buttons */
uiButSetDragID(but, id);
uiButSetFlag(but, UI_HAS_ICON|UI_ICON_LEFT);
}
- if((idfrom && idfrom->lib) || !editable)
+ if ((idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
}
/* text button with name */
- if(id) {
+ if (id) {
char name[UI_MAX_NAME_STR];
const short user_alert= (id->us <= 0);
//text_idbutton(id, name);
name[0]= '\0';
- but= uiDefButR(block, TEX, 0, name, 0, 0, UI_UNIT_X*6, UI_UNIT_Y, &idptr, "name", -1, 0, 0, -1, -1, NULL);
+ but = uiDefButR(block, TEX, 0, name, 0, 0, UI_UNIT_X*6, UI_UNIT_Y, &idptr, "name", -1, 0, 0, -1, -1, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_RENAME));
- if(user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
+ if (user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
- if(id->lib) {
- if(id->flag & LIB_INDIRECT) {
- but= uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ if (id->lib) {
+ if (id->flag & LIB_INDIRECT) {
+ but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Indirect library datablock, cannot change"));
uiButSetFlag(but, UI_BUT_DISABLED);
}
else {
- but= uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Direct linked library datablock, click to make local"));
- if(!id_make_local(id, 1 /* test */) || (idfrom && idfrom->lib))
+ if (!id_make_local(id, 1 /* test */) || (idfrom && idfrom->lib))
uiButSetFlag(but, UI_BUT_DISABLED);
}
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_LOCAL));
}
- if(id->us > 1) {
+ if (id->us > 1) {
char numstr[32];
BLI_snprintf(numstr, sizeof(numstr), "%d", id->us);
- but= uiDefBut(block, BUT, 0, numstr, 0,0,UI_UNIT_X + ((id->us < 10) ? 0:10), UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ but = uiDefBut(block, BUT, 0, numstr, 0,0,UI_UNIT_X + ((id->us < 10) ? 0:10), UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Display number of users of this data (click to make a single-user copy)"));
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE));
- if(!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib) || !editable)
+ if (!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
}
- if(user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
+ if (user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
- if(id->lib == NULL && !(ELEM5(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB))) {
+ if (id->lib == NULL && !(ELEM5(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB))) {
uiDefButR(block, TOG, 0, "F", 0, 0, UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL);
}
}
- if(flag & UI_ID_ADD_NEW) {
+ if (flag & UI_ID_ADD_NEW) {
int w= id?UI_UNIT_X: (flag & UI_ID_OPEN)? UI_UNIT_X*3: UI_UNIT_X*6;
- if(newop) {
- but= uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id)? "": IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL);
+ if (newop) {
+ but = uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id)? "": IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
else {
- but= uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id)? "": IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+ but = uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id)? "": IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
- if((idfrom && idfrom->lib) || !editable)
+ if ((idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
}
- if(flag & UI_ID_OPEN) {
+ if (flag & UI_ID_OPEN) {
int w= id?UI_UNIT_X: (flag & UI_ID_ADD_NEW)? UI_UNIT_X*3: UI_UNIT_X*6;
- if(openop) {
- but= uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id)? "": IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL);
+ if (openop) {
+ but = uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id)? "": IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN));
}
else {
- but= uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id)? "": IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+ but = uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id)? "": IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN));
}
- if((idfrom && idfrom->lib) || !editable)
+ if ((idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
}
/* delete button */
- if(id && (flag & UI_ID_DELETE) && (RNA_property_flag(template->prop) & PROP_NEVER_UNLINK)==0) {
- if(unlinkop) {
- but= uiDefIconButO(block, BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
+ if (id && (flag & UI_ID_DELETE) && (RNA_property_flag(template->prop) & PROP_NEVER_UNLINK)==0) {
+ if (unlinkop) {
+ but = uiDefIconButO(block, BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
/* so we can access the template from operators, font unlinking needs this */
uiButSetNFunc(but, NULL, MEM_dupallocN(template), NULL);
}
else {
- but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Unlink datablock. Shift + Click to set users to zero, data will then not be saved"));
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE));
- if(RNA_property_flag(template->prop) & PROP_NEVER_NULL)
+ if (RNA_property_flag(template->prop) & PROP_NEVER_NULL)
uiButSetFlag(but, UI_BUT_DISABLED);
}
- if((idfrom && idfrom->lib) || !editable)
+ if ((idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
}
- if(idcode == ID_TE)
+ if (idcode == ID_TE)
uiTemplateTextureShow(layout, C, &template->ptr, template->prop);
uiBlockEndAlign(block);
@@ -502,7 +502,7 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
prop= RNA_struct_find_property(ptr, propname);
- if(!prop || RNA_property_type(prop) != PROP_POINTER) {
+ if (!prop || RNA_property_type(prop) != PROP_POINTER) {
RNA_warning("pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -513,9 +513,9 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
template->prv_rows = prv_rows;
template->prv_cols = prv_cols;
- if(newop)
+ if (newop)
flag |= UI_ID_ADD_NEW;
- if(openop)
+ if (openop)
flag |= UI_ID_OPEN;
type= RNA_property_pointer_type(ptr, prop);
@@ -525,7 +525,7 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
/* create UI elements for this template
* - template_ID makes a copy of the template data and assigns it to the relevant buttons
*/
- if(template->idlb) {
+ if (template->idlb) {
uiLayoutRow(layout, 1);
template_ID(C, layout, template, type, idcode, flag, newop, openop, unlinkop);
}
@@ -650,9 +650,9 @@ static void modifiers_setOnCage(bContext *C, void *ob_v, void *md_v)
/* undo button operation */
md->mode ^= eModifierMode_OnCage;
- for(i = 0, md=ob->modifiers.first; md; ++i, md=md->next) {
- if(md == md_v) {
- if(i >= cageIndex)
+ for (i = 0, md=ob->modifiers.first; md; ++i, md=md->next) {
+ if (md == md_v) {
+ if (i >= cageIndex)
md->mode ^= eModifierMode_OnCage;
break;
}
@@ -686,8 +686,8 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
static int modifier_can_delete(ModifierData *md)
{
/* fluid particle modifier can't be deleted here */
- if(md->type == eModifierType_ParticleSystem)
- if(((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID)
+ if (md->type == eModifierType_ParticleSystem)
+ if (((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID)
return 0;
return 1;
@@ -788,20 +788,21 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
/* place holder button */
uiBlockSetEmboss(block, UI_EMBOSSN);
- but= uiDefIconBut(block, BUT, 0, ICON_NONE, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, NULL);
+ but = uiDefIconBut(block, BUT, 0, ICON_NONE, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, NULL);
uiButSetFlag(but, UI_BUT_DISABLED);
uiBlockSetEmboss(block, UI_EMBOSS);
}
} /* tessellation point for curve-typed objects */
else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- /* some modifiers could work with pre-tesselated curves only */
+ /* some modifiers could work with pre-tessellated curves only */
if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
- /* add disabled pre-tesselated button, so users could have
+ /* add disabled pre-tessellated button, so users could have
* message for this modifiers */
but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
TIP_("This modifier could be applied on splines' points only"));
uiButSetFlag(but, UI_BUT_DISABLED);
- } else if (mti->type != eModifierTypeType_Constructive) {
+ }
+ else if (mti->type != eModifierTypeType_Constructive) {
/* constructive modifiers tessellates curve before applying */
uiItemR(row, &ptr, "use_apply_on_spline", 0, "", ICON_NONE);
}
@@ -841,9 +842,9 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
ParticleSystem *psys= ((ParticleSystemModifierData *)md)->psys;
if (!(ob->mode & OB_MODE_PARTICLE_EDIT) && psys->pathcache) {
- if(ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB))
+ if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB))
uiItemO(row, "Convert", ICON_NONE, "OBJECT_OT_duplicates_make_real");
- else if(psys->part->ren_as == PART_DRAW_PATH)
+ else if (psys->part->ren_as == PART_DRAW_PATH)
uiItemO(row, "Convert", ICON_NONE, "OBJECT_OT_modifier_convert");
}
}
@@ -868,7 +869,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
}
/* error messages */
- if(md->error) {
+ if (md->error) {
box = uiLayoutBox(column);
row = uiLayoutRow(box, 0);
uiItemL(row, md->error, ICON_ERROR);
@@ -885,7 +886,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
int i, lastCageIndex, cageIndex;
/* verify we have valid data */
- if(!RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
+ if (!RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
RNA_warning("Expected modifier on object");
return NULL;
}
@@ -893,7 +894,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
ob= ptr->id.data;
md= ptr->data;
- if(!ob || !(GS(ob->id.name) == ID_OB)) {
+ if (!ob || !(GS(ob->id.name) == ID_OB)) {
RNA_warning("Expected modifier on object");
return NULL;
}
@@ -906,10 +907,10 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
// XXX virtual modifiers are not accesible for python
vmd = modifiers_getVirtualModifierList(ob);
- for(i=0; vmd; i++, vmd=vmd->next) {
- if(md == vmd)
+ for (i=0; vmd; i++, vmd=vmd->next) {
+ if (md == vmd)
return draw_modifier(layout, scene, ob, md, i, cageIndex, lastCageIndex);
- else if(vmd->mode & eModifierMode_Virtual)
+ else if (vmd->mode & eModifierMode_Virtual)
i--;
}
@@ -953,9 +954,9 @@ static void do_constraint_panels(bContext *C, void *ob_pt, int event)
// if there are problems because of this, then rna needs changed update functions.
//
// object_test_constraints(ob);
- // if(ob->pose) update_pose_constraint_flags(ob->pose);
+ // if (ob->pose) update_pose_constraint_flags(ob->pose);
- 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);
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
@@ -1020,7 +1021,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
if (con->flag & CONSTRAINT_DISABLE)
uiLayoutSetRedAlert(row, 1);
- if(proxy_protected == 0) {
+ if (proxy_protected == 0) {
uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
}
else
@@ -1111,7 +1112,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
bConstraint *con;
/* verify we have valid data */
- if(!RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
+ if (!RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
RNA_warning("Expected constraint on object");
return NULL;
}
@@ -1119,7 +1120,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
ob= ptr->id.data;
con= ptr->data;
- if(!ob || !(GS(ob->id.name) == ID_OB)) {
+ if (!ob || !(GS(ob->id.name) == ID_OB)) {
RNA_warning("Expected constraint on object");
return NULL;
}
@@ -1127,9 +1128,9 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
uiBlockSetButLock(uiLayoutGetBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE);
/* hrms, the temporal constraint should not draw! */
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data= con->data;
- if(data->flag & CONSTRAINT_IK_TEMP)
+ if (data->flag & CONSTRAINT_IK_TEMP)
return NULL;
}
@@ -1165,7 +1166,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
PointerRNA material_ptr;
PointerRNA texture_ptr;
- if(id && !ELEM4(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA)) {
+ if (id && !ELEM4(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA)) {
RNA_warning("Expected ID of type material, texture, lamp or world");
return;
}
@@ -1174,18 +1175,18 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
pid= id;
pparent= NULL;
- if(id && (GS(id->name) == ID_TE)) {
- if(parent && (GS(parent->name) == ID_MA))
+ if (id && (GS(id->name) == ID_TE)) {
+ if (parent && (GS(parent->name) == ID_MA))
pr_texture= &((Material*)parent)->pr_texture;
- else if(parent && (GS(parent->name) == ID_WO))
+ else if (parent && (GS(parent->name) == ID_WO))
pr_texture= &((World*)parent)->pr_texture;
- else if(parent && (GS(parent->name) == ID_LA))
+ else if (parent && (GS(parent->name) == ID_LA))
pr_texture= &((Lamp*)parent)->pr_texture;
- if(pr_texture) {
- if(*pr_texture == TEX_PR_OTHER)
+ if (pr_texture) {
+ if (*pr_texture == TEX_PR_OTHER)
pid= parent;
- else if(*pr_texture == TEX_PR_BOTH)
+ else if (*pr_texture == TEX_PR_BOTH)
pparent= parent;
}
}
@@ -1203,8 +1204,8 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
/* add buttons */
if (pid && show_buttons) {
- if(GS(pid->name) == ID_MA || (pparent && GS(pparent->name) == ID_MA)) {
- if(GS(pid->name) == ID_MA) ma= (Material*)pid;
+ if (GS(pid->name) == ID_MA || (pparent && GS(pparent->name) == ID_MA)) {
+ if (GS(pid->name) == ID_MA) ma= (Material*)pid;
else ma= (Material*)pparent;
/* Create RNA Pointer */
@@ -1215,22 +1216,22 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
uiItemR(col, &material_ptr, "preview_render_type", UI_ITEM_R_EXPAND, "", ICON_NONE);
}
- if(pr_texture) {
+ if (pr_texture) {
/* Create RNA Pointer */
RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr);
uiLayoutRow(layout, 1);
uiDefButS(block, ROW, B_MATPRV, IFACE_("Texture"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, "");
- if(GS(parent->name) == ID_MA)
+ if (GS(parent->name) == ID_MA)
uiDefButS(block, ROW, B_MATPRV, IFACE_("Material"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
- else if(GS(parent->name) == ID_LA)
+ else if (GS(parent->name) == ID_LA)
uiDefButS(block, ROW, B_MATPRV, IFACE_("Lamp"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
- else if(GS(parent->name) == ID_WO)
+ else if (GS(parent->name) == ID_WO)
uiDefButS(block, ROW, B_MATPRV, IFACE_("World"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
uiDefButS(block, ROW, B_MATPRV, IFACE_("Both"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, "");
/* Alpha button for texture preview */
- if(*pr_texture!=TEX_PR_OTHER) {
+ if (*pr_texture!=TEX_PR_OTHER) {
row = uiLayoutRow(layout, 0);
uiItemR(row, &texture_ptr, "use_preview_alpha", 0, NULL, ICON_NONE);
}
@@ -1263,12 +1264,12 @@ static void colorband_add_cb(bContext *C, void *cb_v, void *coba_v)
ColorBand *coba= coba_v;
float pos= 0.5f;
- if(coba->tot > 1) {
- if(coba->cur > 0) pos= (coba->data[coba->cur-1].pos + coba->data[coba->cur].pos) * 0.5f;
+ if (coba->tot > 1) {
+ if (coba->cur > 0) pos= (coba->data[coba->cur-1].pos + coba->data[coba->cur].pos) * 0.5f;
else pos= (coba->data[coba->cur+1].pos + coba->data[coba->cur].pos) * 0.5f;
}
- if(colorband_element_add(coba, pos)) {
+ if (colorband_element_add(coba, pos)) {
rna_update_cb(C, cb_v, NULL);
ED_undo_push(C, "Add colorband");
}
@@ -1278,7 +1279,7 @@ static void colorband_del_cb(bContext *C, void *cb_v, void *coba_v)
{
ColorBand *coba= coba_v;
- if(colorband_element_remove(coba, coba->cur)) {
+ if (colorband_element_remove(coba, coba->cur)) {
ED_undo_push(C, "Delete colorband");
rna_update_cb(C, cb_v, NULL);
}
@@ -1291,10 +1292,10 @@ static void colorband_flip_cb(bContext *C, void *cb_v, void *coba_v)
ColorBand *coba= coba_v;
int a;
- for(a=0; a<coba->tot; a++) {
+ for (a=0; a<coba->tot; a++) {
data_tmp[a]= coba->data[coba->tot - (a + 1)];
}
- for(a=0; a<coba->tot; a++) {
+ for (a=0; a<coba->tot; a++) {
data_tmp[a].pos = 1.0f - data_tmp[a].pos;
coba->data[a]= data_tmp[a];
}
@@ -1326,7 +1327,7 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
const int line1_y= yoffs + 65 + UI_UNIT_Y + 2; /* 2 for some space between the buttons */
const int line2_y= yoffs + 65;
- if(coba==NULL) return;
+ if (coba==NULL) return;
bt= uiDefBut(block, BUT, 0, IFACE_("Add"), 0+xoffs,line1_y,40,UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Add a new color stop to the colorband"));
@@ -1353,7 +1354,7 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
- if(coba->tot) {
+ if (coba->tot) {
CBData *cbd= coba->data + coba->cur;
/* better to use rna so we can animate them */
@@ -1387,7 +1388,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
uiBlockEndAlign(block);
- if(coba->tot) {
+ if (coba->tot) {
CBData *cbd= coba->data + coba->cur;
PointerRNA ptr;
RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr);
@@ -1407,7 +1408,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr, int small, RNAUpdateCb *cb)
{
- if(small)
+ if (small)
colorband_buttons_small(layout, block, coba, butr, cb);
else
colorband_buttons_large(layout, block, coba, 0, 0, cb);
@@ -1421,19 +1422,19 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname
uiBlock *block;
rctf rect;
- if(!prop || RNA_property_type(prop) != PROP_POINTER)
+ if (!prop || RNA_property_type(prop) != PROP_POINTER)
return;
cptr= RNA_property_pointer_get(ptr, prop);
- if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_ColorRamp))
+ if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_ColorRamp))
return;
cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
cb->ptr= *ptr;
cb->prop= prop;
- rect.xmin= 0; rect.xmax= 200;
- rect.ymin= 0; rect.ymax= 190;
+ rect.xmin = 0; rect.xmax = 200;
+ rect.ymin = 0; rect.ymax = 190;
block= uiLayoutAbsoluteBlock(layout);
colorband_buttons_layout(layout, block, cptr.data, &rect, !expand, cb);
@@ -1453,19 +1454,19 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
Histogram *hist;
rctf rect;
- if(!prop || RNA_property_type(prop) != PROP_POINTER)
+ if (!prop || RNA_property_type(prop) != PROP_POINTER)
return;
cptr= RNA_property_pointer_get(ptr, prop);
- if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Histogram))
+ if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Histogram))
return;
cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
cb->ptr= *ptr;
cb->prop= prop;
- rect.xmin= 0; rect.xmax= 200;
- rect.ymin= 0; rect.ymax= 190;
+ rect.xmin = 0; rect.xmax = 200;
+ rect.ymin = 0; rect.ymax = 190;
block= uiLayoutAbsoluteBlock(layout);
//colorband_buttons_layout(layout, block, cptr.data, &rect, !expand, cb);
@@ -1492,11 +1493,11 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
Scopes *scopes;
rctf rect;
- if(!prop || RNA_property_type(prop) != PROP_POINTER)
+ if (!prop || RNA_property_type(prop) != PROP_POINTER)
return;
cptr= RNA_property_pointer_get(ptr, prop);
- if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
+ if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
return;
scopes = (Scopes *)cptr.data;
@@ -1504,8 +1505,8 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
cb->ptr= *ptr;
cb->prop= prop;
- rect.xmin= 0; rect.xmax= 200;
- rect.ymin= 0; rect.ymax= 190;
+ rect.xmin = 0; rect.xmax = 200;
+ rect.ymin = 0; rect.ymax = 190;
block= uiLayoutAbsoluteBlock(layout);
@@ -1529,11 +1530,11 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
Scopes *scopes;
rctf rect;
- if(!prop || RNA_property_type(prop) != PROP_POINTER)
+ if (!prop || RNA_property_type(prop) != PROP_POINTER)
return;
cptr= RNA_property_pointer_get(ptr, prop);
- if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
+ if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
return;
scopes = (Scopes *)cptr.data;
@@ -1541,8 +1542,8 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
cb->ptr= *ptr;
cb->prop= prop;
- rect.xmin= 0; rect.xmax= 200;
- rect.ymin= 0; rect.ymax= 190;
+ rect.xmin = 0; rect.xmax = 200;
+ rect.ymin = 0; rect.ymax = 190;
block= uiLayoutAbsoluteBlock(layout);
@@ -1563,7 +1564,7 @@ static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *UNUSED(ar
float d;
/* we allow 20 times zoom */
- if( (cumap->curr.xmax - cumap->curr.xmin) > 0.04f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
+ if ( (cumap->curr.xmax - cumap->curr.xmin) > 0.04f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
d= 0.1154f*(cumap->curr.xmax - cumap->curr.xmin);
cumap->curr.xmin+= d;
cumap->curr.xmax-= d;
@@ -1580,31 +1581,31 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(u
CurveMapping *cumap = cumap_v;
float d, d1;
- /* we allow 20 times zoom, but dont view outside clip */
- if( (cumap->curr.xmax - cumap->curr.xmin) < 20.0f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
+ /* we allow 20 times zoom, but don't view outside clip */
+ if ( (cumap->curr.xmax - cumap->curr.xmin) < 20.0f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
d= d1= 0.15f*(cumap->curr.xmax - cumap->curr.xmin);
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.xmin-d < cumap->clipr.xmin)
+ if (cumap->flag & CUMA_DO_CLIP)
+ if (cumap->curr.xmin-d < cumap->clipr.xmin)
d1= cumap->curr.xmin - cumap->clipr.xmin;
cumap->curr.xmin-= d1;
d1= d;
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.xmax+d > cumap->clipr.xmax)
+ if (cumap->flag & CUMA_DO_CLIP)
+ if (cumap->curr.xmax+d > cumap->clipr.xmax)
d1= -cumap->curr.xmax + cumap->clipr.xmax;
cumap->curr.xmax+= d1;
d= d1= 0.15f*(cumap->curr.ymax - cumap->curr.ymin);
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.ymin-d < cumap->clipr.ymin)
+ if (cumap->flag & CUMA_DO_CLIP)
+ if (cumap->curr.ymin-d < cumap->clipr.ymin)
d1= cumap->curr.ymin - cumap->clipr.ymin;
cumap->curr.ymin-= d1;
d1= d;
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.ymax+d > cumap->clipr.ymax)
+ if (cumap->flag & CUMA_DO_CLIP)
+ if (cumap->curr.ymax+d > cumap->clipr.ymax)
d1= -cumap->curr.ymax + cumap->clipr.ymax;
cumap->curr.ymax+= d1;
}
@@ -1744,7 +1745,7 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
int a;
cumap->preset = CURVE_PRESET_LINE;
- for(a=0; a<CM_TOT; a++)
+ for (a=0; a<CM_TOT; a++)
curvemap_reset(cumap->cm+a, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE);
cumap->black[0]=cumap->black[1]=cumap->black[2]= 0.0f;
@@ -1772,42 +1773,42 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
/* curve chooser */
row= uiLayoutRow(layout, 0);
- if(labeltype=='v') {
+ if (labeltype=='v') {
/* vector */
sub= uiLayoutRow(row, 1);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
- if(cumap->cm[0].curve) {
+ if (cumap->cm[0].curve) {
bt= uiDefButI(block, ROW, 0, "X", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[1].curve) {
+ if (cumap->cm[1].curve) {
bt= uiDefButI(block, ROW, 0, "Y", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[2].curve) {
+ if (cumap->cm[2].curve) {
bt= uiDefButI(block, ROW, 0, "Z", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
}
- else if(labeltype=='c') {
+ else if (labeltype=='c') {
/* color */
sub= uiLayoutRow(row, 1);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
- if(cumap->cm[3].curve) {
+ if (cumap->cm[3].curve) {
bt= uiDefButI(block, ROW, 0, "C", 0, 0, dx, dx, &cumap->cur, 0.0, 3.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[0].curve) {
+ if (cumap->cm[0].curve) {
bt= uiDefButI(block, ROW, 0, "R", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[1].curve) {
+ if (cumap->cm[1].curve) {
bt= uiDefButI(block, ROW, 0, "G", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[2].curve) {
+ if (cumap->cm[2].curve) {
bt= uiDefButI(block, ROW, 0, "B", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
@@ -1817,15 +1818,15 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
sub= uiLayoutRow(row, 1);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
- if(cumap->cm[0].curve) {
+ if (cumap->cm[0].curve) {
bt= uiDefButI(block, ROW, 0, "H", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[1].curve) {
+ if (cumap->cm[1].curve) {
bt= uiDefButI(block, ROW, 0, "S", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[2].curve) {
+ if (cumap->cm[2].curve) {
bt= uiDefButI(block, ROW, 0, "V", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
@@ -1847,14 +1848,14 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom out"));
uiButSetFunc(bt, curvemap_buttons_zoom_out, cumap, NULL);
- if(brush)
+ if (brush)
bt= uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
else
bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
- if(cumap->flag & CUMA_DO_CLIP) icon= ICON_CLIPUV_HLT; else icon= ICON_CLIPUV_DEHLT;
+ if (cumap->flag & CUMA_DO_CLIP) icon= ICON_CLIPUV_HLT; else icon= ICON_CLIPUV_DEHLT;
bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, TIP_("Clipping Options"));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
@@ -1871,7 +1872,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, MIN2(size, 200), cumap, 0.0f, 1.0f, bg, 0, "");
/* black/white levels */
- if(levels) {
+ if (levels) {
split= uiLayoutSplit(layout, 0, 0);
uiItemR(uiLayoutColumn(split, 0), ptr, "black_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(uiLayoutColumn(split, 0), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -1891,20 +1892,20 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
PointerRNA cptr;
- if(!prop) {
+ if (!prop) {
RNA_warning("curve property not found: %s.%s",
RNA_struct_identifier(ptr->type), propname);
return;
}
- if(RNA_property_type(prop) != PROP_POINTER) {
+ if (RNA_property_type(prop) != PROP_POINTER) {
RNA_warning("curve is not a pointer: %s.%s",
RNA_struct_identifier(ptr->type), propname);
return;
}
cptr= RNA_property_pointer_get(ptr, prop);
- if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_CurveMapping))
+ if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_CurveMapping))
return;
cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
@@ -1938,20 +1939,20 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propnam
col = uiLayoutColumn(layout, 0);
row= uiLayoutRow(col, 1);
- but= uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, 0, 0, "");
+ but = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, 0, 0, "");
- if(lock) {
+ if (lock) {
but->flag |= UI_BUT_COLOR_LOCK;
}
- if(lock_luminosity) {
+ if (lock_luminosity) {
float color[4]; /* in case of alpha */
but->flag |= UI_BUT_VEC_SIZE_LOCK;
RNA_property_float_get_array(ptr, prop, color);
but->a2= len_v3(color);
}
- if(cubic)
+ if (cubic)
but->flag |= UI_BUT_COLOR_CUBIC;
uiItemS(row);
@@ -1969,13 +1970,13 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2)
wmWindow *win= CTX_wm_window(C);
int i, tot, shift= win->eventstate->shift;
- if(!shift) {
+ if (!shift) {
tot= RNA_property_array_length(&but->rnapoin, but->rnaprop);
/* Normally clicking only selects one layer */
RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, cur, TRUE);
- for(i = 0; i < tot; ++i) {
- if(i != cur)
+ for (i = 0; i < tot; ++i) {
+ if (i != cur)
RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, i, FALSE);
}
}
@@ -2013,14 +2014,14 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
cols= (layers / 2) + (layers % 2);
groups= ((cols / 2) < cols_per_group) ? (1) : (cols / cols_per_group);
- if(used_ptr && used_propname) {
+ if (used_ptr && used_propname) {
used_prop= RNA_struct_find_property(used_ptr, used_propname);
if (!used_prop) {
RNA_warning("used layers property not found: %s.%s", RNA_struct_identifier(ptr->type), used_propname);
return;
}
- if(RNA_property_array_length(used_ptr, used_prop) < layers)
+ if (RNA_property_array_length(used_ptr, used_prop) < layers)
used_prop = NULL;
}
@@ -2042,12 +2043,12 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
int icon = 0;
int butlay = 1 << layer;
- if(active_layer & butlay)
+ if (active_layer & butlay)
icon = ICON_LAYER_ACTIVE;
- else if(used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, layer))
+ else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, layer))
icon = ICON_LAYER_USED;
- but= uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X/2, UI_UNIT_Y/2);
+ but = uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X/2, UI_UNIT_Y/2);
uiButSetFunc(but, handle_layer_buttons, but, SET_INT_IN_POINTER(layer));
but->type= TOG;
}
@@ -2063,20 +2064,20 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int
ID *id= NULL;
int icon;
- if(!itemptr->data)
+ if (!itemptr->data)
return rnaicon;
/* try ID, material or texture slot */
- if(RNA_struct_is_ID(itemptr->type)) {
+ if (RNA_struct_is_ID(itemptr->type)) {
id= itemptr->id.data;
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
id= RNA_pointer_get(itemptr, "material").data;
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_TextureSlot)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_TextureSlot)) {
id= RNA_pointer_get(itemptr, "texture").data;
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_DynamicPaintSurface)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_DynamicPaintSurface)) {
DynamicPaintSurface *surface= (DynamicPaintSurface*)itemptr->data;
if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) return ICON_TEXTURE_SHADED;
@@ -2085,10 +2086,10 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int
}
/* get icon from ID */
- if(id) {
+ if (id) {
icon= ui_id_icon_get(C, id, big);
- if(icon)
+ if (icon)
return icon;
}
@@ -2109,37 +2110,37 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
/* list item behind label & other buttons */
sub= uiLayoutRow(overlap, 0);
- but= uiDefButR_prop(block, LISTROW, 0, "", 0,0, UI_UNIT_X*10,UI_UNIT_Y, activeptr, activeprop, 0, 0, i, 0, 0, "");
+ but = uiDefButR_prop(block, LISTROW, 0, "", 0,0, UI_UNIT_X*10,UI_UNIT_Y, activeptr, activeprop, 0, 0, i, 0, 0, "");
uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
sub= uiLayoutRow(overlap, 0);
/* retrieve icon and name */
icon= list_item_icon_get(C, itemptr, rnaicon, 0);
- if(icon == ICON_NONE || icon == ICON_DOT)
+ if (icon == ICON_NONE || icon == ICON_DOT)
icon= 0;
namebuf= RNA_struct_name_get_alloc(itemptr, NULL, 0, NULL);
name= (namebuf)? namebuf: "";
/* hardcoded types */
- if(itemptr->type == &RNA_MeshTexturePolyLayer || itemptr->type == &RNA_MeshLoopColorLayer) {
+ if (itemptr->type == &RNA_MeshTexturePolyLayer || itemptr->type == &RNA_MeshLoopColorLayer) {
uiItemL(sub, name, icon);
uiBlockSetEmboss(block, UI_EMBOSSN);
uiDefIconButR(block, TOG, 0, ICON_SCENE, 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "active_render", 0, 0, 0, 0, 0, NULL);
uiBlockSetEmboss(block, UI_EMBOSS);
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_MaterialTextureSlot)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialTextureSlot)) {
uiItemL(sub, name, icon);
uiBlockSetEmboss(block, UI_EMBOSS);
uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, ptr, "use_textures", i, 0, 0, 0, 0, NULL);
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer) || RNA_struct_is_a(itemptr->type, &RNA_FreestyleLineSet)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer) || RNA_struct_is_a(itemptr->type, &RNA_FreestyleLineSet)) {
uiItemL(sub, name, icon);
uiBlockSetEmboss(block, UI_EMBOSS);
uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "use", 0, 0, 0, 0, 0, NULL);
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
/* provision to draw active node name */
Material *ma, *manode;
Scene *scene= CTX_data_scene(C);
@@ -2150,19 +2151,19 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
uiItemL(sub, name, icon);
ma= give_current_material(ob, index+1);
- if (ma && !scene_use_new_shading_nodes(scene)){
+ if (ma && !scene_use_new_shading_nodes(scene)) {
manode= give_node_material(ma);
- if(manode) {
+ if (manode) {
char str[MAX_ID_NAME + 12];
BLI_snprintf(str, sizeof(str), "Node %s", manode->id.name+2);
uiItemL(sub, str, ui_id_icon_get(C, &manode->id, 1));
}
- else if(ma->use_nodes) {
+ else if (ma->use_nodes) {
uiItemL(sub, "Node <none>", ICON_NONE);
}
}
}
- else if(itemptr->type == &RNA_ShapeKey) {
+ else if (itemptr->type == &RNA_ShapeKey) {
Object *ob= (Object*)activeptr->data;
Key *key= (Key*)itemptr->id.data;
@@ -2172,18 +2173,18 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
uiBlockSetEmboss(block, UI_EMBOSSN);
row= uiLayoutRow(split, 1);
- if(i == 0 || (key->type != KEY_RELATIVE)) uiItemL(row, "", ICON_NONE);
+ if (i == 0 || (key->type != KEY_RELATIVE)) uiItemL(row, "", ICON_NONE);
else uiItemR(row, itemptr, "value", 0, "", ICON_NONE);
uiItemR(row, itemptr, "mute", 0, "", 0);
- if( (key->flag & KEYBLOCK_MUTE) ||
+ if ( (key->flag & KEYBLOCK_MUTE) ||
(ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)) )
{
uiLayoutSetActive(row, 0);
}
uiBlockSetEmboss(block, UI_EMBOSS);
}
- else if(itemptr->type == &RNA_VertexGroup) {
+ else if (itemptr->type == &RNA_VertexGroup) {
bDeformGroup *dg= (bDeformGroup *)itemptr->data;
uiItemL(sub, name, icon);
/* RNA does not allow nice lock icons, use lower level buttons */
@@ -2195,7 +2196,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
uiBlockSetEmboss(block, UI_EMBOSS);
#endif
}
- else if(itemptr->type == &RNA_KeyingSetPath) {
+ else if (itemptr->type == &RNA_KeyingSetPath) {
KS_Path *ksp = (KS_Path*)itemptr->data;
/* icon needs to be the type of ID which is currently active */
@@ -2204,7 +2205,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
/* nothing else special to do... */
uiItemL(sub, name, icon); /* fails, backdrop LISTROW... */
}
- else if(itemptr->type == &RNA_DynamicPaintSurface) {
+ else if (itemptr->type == &RNA_DynamicPaintSurface) {
char name_final[96];
const char *enum_name;
PropertyRNA *prop = RNA_struct_find_property(itemptr, "surface_type");
@@ -2222,11 +2223,11 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
}
uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "is_active", i, 0, 0, 0, 0, NULL);
}
- else if(itemptr->type == &RNA_MovieTrackingObject) {
+ else if (itemptr->type == &RNA_MovieTrackingObject) {
MovieTrackingObject *tracking_object= (MovieTrackingObject*)itemptr->data;
split= uiLayoutSplit(sub, 0.75f, 0);
- if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+ if (tracking_object->flag&TRACKING_OBJECT_CAMERA) {
uiItemL(split, name, ICON_CAMERA_DATA);
}
else {
@@ -2265,7 +2266,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
/* If the special property is set for the item, and it is a collection... */
PropertyRNA *prop_list= RNA_struct_find_property(itemptr, prop_list_id);
- if(prop_list && RNA_property_type(prop_list) == PROP_STRING) {
+ if (prop_list && RNA_property_type(prop_list) == PROP_STRING) {
int prop_names_len;
char *prop_names = RNA_property_string_get_alloc(itemptr, prop_list, NULL, 0, &prop_names_len);
char *prop_names_end= prop_names + prop_names_len;
@@ -2309,44 +2310,44 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
block= uiLayoutGetBlock(layout);
pa= block->panel;
- if(!pa) {
+ if (!pa) {
RNA_warning("Only works inside a panel");
return;
}
- if(!activeptr->data)
+ if (!activeptr->data)
return;
- if(ptr->data) {
+ if (ptr->data) {
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
RNA_warning("Property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
}
activeprop= RNA_struct_find_property(activeptr, activepropname);
- if(!activeprop) {
+ if (!activeprop) {
RNA_warning("Property not found: %s.%s", RNA_struct_identifier(ptr->type), activepropname);
return;
}
- if(prop) {
+ if (prop) {
type= RNA_property_type(prop);
- if(type != PROP_COLLECTION) {
+ if (type != PROP_COLLECTION) {
RNA_warning("uiExpected collection property");
return;
}
}
activetype= RNA_property_type(activeprop);
- if(activetype != PROP_INT) {
+ if (activetype != PROP_INT) {
RNA_warning("Expected integer property");
return;
}
/* get icon */
- if(ptr->data && prop) {
+ if (ptr->data && prop) {
ptype= RNA_property_pointer_type(ptr, prop);
rnaicon= RNA_struct_ui_icon(ptype);
}
@@ -2354,20 +2355,20 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
/* get active data */
activei= RNA_property_int_get(activeptr, activeprop);
- if(listtype == 'i') {
+ if (listtype == 'i') {
box= uiLayoutListBox(layout, ptr, prop, activeptr, activeprop);
col= uiLayoutColumn(box, 1);
row= uiLayoutRow(col, 0);
- if(ptr->data && prop) {
+ if (ptr->data && prop) {
/* create list items */
RNA_PROP_BEGIN(ptr, itemptr, prop) {
/* create button */
- if(!(i % 9))
+ if (!(i % 9))
row= uiLayoutRow(col, 0);
icon= list_item_icon_get(C, &itemptr, rnaicon, 1);
- but= uiDefIconButR_prop(block, LISTROW, 0, icon, 0,0,UI_UNIT_X*10,UI_UNIT_Y, activeptr, activeprop, 0, 0, i, 0, 0, "");
+ but = uiDefIconButR_prop(block, LISTROW, 0, icon, 0,0,UI_UNIT_X*10,UI_UNIT_Y, activeptr, activeprop, 0, 0, i, 0, 0, "");
uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
@@ -2376,17 +2377,17 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
RNA_PROP_END;
}
}
- else if(listtype == 'c') {
+ else if (listtype == 'c') {
/* compact layout */
row= uiLayoutRow(layout, 1);
- if(ptr->data && prop) {
+ if (ptr->data && prop) {
/* create list items */
RNA_PROP_BEGIN(ptr, itemptr, prop) {
found= (activei == i);
- if(found) {
+ if (found) {
/* create button */
name= RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL);
icon= list_item_icon_get(C, &itemptr, rnaicon, 0);
@@ -2403,22 +2404,22 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
}
/* if not found, add in dummy button */
- if(i == 0)
+ if (i == 0)
uiItemL(row, "", ICON_NONE);
/* next/prev button */
BLI_snprintf(numstr, sizeof(numstr), "%d :", i);
- but= uiDefIconTextButR_prop(block, NUM, 0, 0, numstr, 0,0,UI_UNIT_X*5,UI_UNIT_Y, activeptr, activeprop, 0, 0, 0, 0, 0, "");
- if(i == 0)
+ but = uiDefIconTextButR_prop(block, NUM, 0, 0, numstr, 0,0,UI_UNIT_X*5,UI_UNIT_Y, activeptr, activeprop, 0, 0, 0, 0, 0, "");
+ if (i == 0)
uiButSetFlag(but, UI_BUT_DISABLED);
}
else {
/* default rows */
- if(rows == 0)
+ if (rows == 0)
rows= 5;
if (maxrows == 0)
maxrows = 5;
- if(pa->list_grip_size != 0)
+ if (pa->list_grip_size != 0)
rows= pa->list_grip_size;
/* layout */
@@ -2429,13 +2430,13 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
/* init numbers */
RNA_property_int_range(activeptr, activeprop, &min, &max);
- if(prop)
+ if (prop)
len= RNA_property_collection_length(ptr, prop);
items= CLAMPIS(len, rows, MAX2(rows, maxrows));
/* if list length changes and active is out of view, scroll to it */
- if(pa->list_last_len != len)
- if((activei < pa->list_scroll || activei >= pa->list_scroll+items))
+ if (pa->list_last_len != len)
+ if ((activei < pa->list_scroll || activei >= pa->list_scroll+items))
pa->list_scroll= activei;
pa->list_scroll= MIN2(pa->list_scroll, len-items);
@@ -2443,10 +2444,10 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
pa->list_size= items;
pa->list_last_len= len;
- if(ptr->data && prop) {
+ if (ptr->data && prop) {
/* create list items */
RNA_PROP_BEGIN(ptr, itemptr, prop) {
- if(i >= pa->list_scroll && i<pa->list_scroll+items)
+ if (i >= pa->list_scroll && i<pa->list_scroll+items)
list_item_row(C, col, ptr, &itemptr, i, rnaicon, activeptr, activeprop, prop_list);
i++;
@@ -2455,14 +2456,14 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
}
/* add dummy buttons to fill space */
- while(i < pa->list_scroll+items) {
- if(i >= pa->list_scroll)
+ while (i < pa->list_scroll+items) {
+ if (i >= pa->list_scroll)
uiItemL(col, "", ICON_NONE);
i++;
}
/* add scrollbar */
- if(len > items) {
+ if (len > items) {
col= uiLayoutColumn(row, 0);
uiDefButI(block, SCROLL, 0, "", 0,0,UI_UNIT_X*0.75,UI_UNIT_Y*items, &pa->list_scroll, 0, len-items, items, 0, "");
}
@@ -2475,7 +2476,7 @@ static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2)
{
wmOperatorType *ot= arg2;
- if(ot)
+ if (ot)
WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
}
@@ -2483,11 +2484,11 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
{
GHashIterator *iter= WM_operatortype_iter();
- for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+ for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
- if(BLI_strcasestr(ot->name, str)) {
- if(WM_operator_poll((bContext*)C, ot)) {
+ if (BLI_strcasestr(ot->name, str)) {
+ if (WM_operator_poll((bContext*)C, ot)) {
char name[256];
int len= strlen(ot->name);
@@ -2495,7 +2496,7 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
BLI_strncpy(name, ot->name, sizeof(name));
/* check for hotkey */
- if(len < sizeof(name)-6) {
+ if (len < sizeof(name)-6) {
if (WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE,
&name[len+1], sizeof(name)-len-1))
{
@@ -2503,7 +2504,7 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
}
}
- if(0==uiSearchItemAdd(items, name, ot, 0))
+ if (0==uiSearchItemAdd(items, name, ot, 0))
break;
}
}
@@ -2520,7 +2521,7 @@ void uiTemplateOperatorSearch(uiLayout *layout)
block= uiLayoutGetBlock(layout);
uiBlockSetCurLayout(block, layout);
- but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 0, 0, UI_UNIT_X*6, UI_UNIT_Y, 0, 0, "");
+ but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 0, 0, UI_UNIT_X*6, UI_UNIT_Y, 0, 0, "");
uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
}
@@ -2571,29 +2572,32 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
uiBlockSetHandleFunc(block, do_running_jobs, NULL);
- if(sa->spacetype==SPACE_NODE) {
- if(WM_jobs_test(wm, sa))
+ if (sa->spacetype==SPACE_NODE) {
+ if (WM_jobs_test(wm, sa))
owner = sa;
handle_event= B_STOPCOMPO;
- } else if (sa->spacetype==SPACE_SEQ) {
- if(WM_jobs_test(wm, sa))
+ }
+ else if (sa->spacetype==SPACE_SEQ) {
+ if (WM_jobs_test(wm, sa))
owner = sa;
handle_event = B_STOPSEQ;
- } else if(sa->spacetype==SPACE_CLIP) {
- if(WM_jobs_test(wm, sa))
+ }
+ else if (sa->spacetype==SPACE_CLIP) {
+ if (WM_jobs_test(wm, sa))
owner = sa;
handle_event= B_STOPCLIP;
- } else {
+ }
+ else {
Scene *scene;
/* another scene can be rendering too, for example via compositor */
- for(scene= CTX_data_main(C)->scene.first; scene; scene= scene->id.next)
- if(WM_jobs_test(wm, scene))
+ for (scene= CTX_data_main(C)->scene.first; scene; scene= scene->id.next)
+ if (WM_jobs_test(wm, scene))
break;
owner = scene;
handle_event= B_STOPRENDER;
}
- if(owner) {
+ if (owner) {
uiLayout *ui_abs;
ui_abs= uiLayoutAbsolute(layout, 0);
@@ -2606,10 +2610,10 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
uiLayoutRow(layout, 0);
}
- if(WM_jobs_test(wm, screen))
+ if (WM_jobs_test(wm, screen))
uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
TIP_("Stop screencast"));
- if(screen->animtimer)
+ if (screen->animtimer)
uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, TIP_("Anim Player"), 0,0,100,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
TIP_("Stop animation playback"));
}
@@ -2645,12 +2649,12 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
/* make a box around the report to make it stand out */
uiBlockBeginAlign(block);
- but= uiDefBut(block, ROUNDBOX, 0, "", 0, 0, UI_UNIT_X+10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
+ but = uiDefBut(block, ROUNDBOX, 0, "", 0, 0, UI_UNIT_X+10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
/* set the report's bg color in but->col - ROUNDBOX feature */
rgb_float_to_uchar(but->col, rti->col);
but->col[3]= 255;
- but= uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
+ but = uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
but->col[0]= but->col[1]= but->col[2]= FTOCHAR(rti->greyscale);
but->col[3]= 255;
@@ -2658,11 +2662,11 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
/* icon and report message on top */
- if(report->type & RPT_ERROR_ALL)
+ if (report->type & RPT_ERROR_ALL)
icon = ICON_ERROR;
- else if(report->type & RPT_WARNING_ALL)
+ else if (report->type & RPT_WARNING_ALL)
icon = ICON_ERROR;
- else if(report->type & RPT_INFO_ALL)
+ else if (report->type & RPT_INFO_ALL)
icon = ICON_INFO;
/* XXX: temporary operator to dump all reports to a text block, but only if more than 1 report
@@ -2684,7 +2688,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
static void keymap_item_modified(bContext *UNUSED(C), void *kmi_p, void *UNUSED(unused))
{
- wmKeyMapItem *kmi= (wmKeyMapItem*)kmi_p;
+ wmKeyMapItem *kmi = (wmKeyMapItem*)kmi_p;
WM_keyconfig_update_tag(NULL, kmi);
}
@@ -2694,7 +2698,7 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
uiItemS(layout);
- if(title)
+ if (title)
uiItemL(layout, title, ICON_NONE);
flow= uiLayoutColumnFlow(layout, 2, 0);
@@ -2702,15 +2706,15 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
RNA_STRUCT_BEGIN(ptr, prop) {
int flag= RNA_property_flag(prop);
- if(flag & PROP_HIDDEN)
+ if (flag & PROP_HIDDEN)
continue;
/* recurse for nested properties */
- if(RNA_property_type(prop) == PROP_POINTER) {
+ if (RNA_property_type(prop) == PROP_POINTER) {
PointerRNA propptr= RNA_property_pointer_get(ptr, prop);
const char *name= RNA_property_ui_name(prop);
- if(propptr.data && RNA_struct_is_a(propptr.type, &RNA_OperatorProperties)) {
+ if (propptr.data && RNA_struct_is_a(propptr.type, &RNA_OperatorProperties)) {
template_keymap_item_properties(layout, name, &propptr);
continue;
}
@@ -2726,14 +2730,14 @@ void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr)
{
PointerRNA propptr= RNA_pointer_get(ptr, "properties");
- if(propptr.data) {
+ if (propptr.data) {
uiBut *but= uiLayoutGetBlock(layout)->buttons.last;
template_keymap_item_properties(layout, NULL, &propptr);
/* attach callbacks to compensate for missing properties update,
* we don't know which keymap (item) is being modified there */
- for(; but; but=but->next)
+ for (; but; but=but->next)
uiButSetFunc(but, keymap_item_modified, ptr->data, NULL);
}
}
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 610e9f8762d..91b37896e66 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -60,15 +60,15 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
{
int arraylen= RNA_property_array_length(ptr, prop);
- if(arraylen && index == -1)
+ if (arraylen && index == -1)
return NULL;
- if(icon && name && name[0] == '\0')
- but= uiDefIconButR_prop(block, ICONTOG, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
- else if(icon)
- but= uiDefIconTextButR_prop(block, ICONTOG, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ if (icon && name && name[0] == '\0')
+ but = uiDefIconButR_prop(block, ICONTOG, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ else if (icon)
+ but = uiDefIconTextButR_prop(block, ICONTOG, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
else
- but= uiDefButR_prop(block, OPTION, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ but = uiDefButR_prop(block, OPTION, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
break;
}
case PROP_INT:
@@ -76,49 +76,49 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
{
int arraylen= RNA_property_array_length(ptr, prop);
- if(arraylen && index == -1) {
- if(ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA))
- but= uiDefButR_prop(block, COL, 0, name, x1, y1, x2, y2, ptr, prop, 0, 0, 0, -1, -1, NULL);
+ if (arraylen && index == -1) {
+ if (ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA))
+ but = uiDefButR_prop(block, COL, 0, name, x1, y1, x2, y2, ptr, prop, 0, 0, 0, -1, -1, NULL);
}
- else if(RNA_property_subtype(prop) == PROP_PERCENTAGE || RNA_property_subtype(prop) == PROP_FACTOR)
- but= uiDefButR_prop(block, NUMSLI, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ else if (RNA_property_subtype(prop) == PROP_PERCENTAGE || RNA_property_subtype(prop) == PROP_FACTOR)
+ but = uiDefButR_prop(block, NUMSLI, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
else
- but= uiDefButR_prop(block, NUM, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ but = uiDefButR_prop(block, NUM, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
break;
}
case PROP_ENUM:
- if(icon && name && name[0] == '\0')
- but= uiDefIconButR_prop(block, MENU, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
- else if(icon)
- but= uiDefIconTextButR_prop(block, MENU, 0, icon, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ if (icon && name && name[0] == '\0')
+ but = uiDefIconButR_prop(block, MENU, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ else if (icon)
+ but = uiDefIconTextButR_prop(block, MENU, 0, icon, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
else
- but= uiDefButR_prop(block, MENU, 0, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ but = uiDefButR_prop(block, MENU, 0, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
break;
case PROP_STRING:
- if(icon && name && name[0] == '\0')
- but= uiDefIconButR_prop(block, TEX, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
- else if(icon)
- but= uiDefIconTextButR_prop(block, TEX, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ if (icon && name && name[0] == '\0')
+ but = uiDefIconButR_prop(block, TEX, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ else if (icon)
+ but = uiDefIconTextButR_prop(block, TEX, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
else
- but= uiDefButR_prop(block, TEX, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ but = uiDefButR_prop(block, TEX, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
break;
case PROP_POINTER: {
PointerRNA pptr;
pptr= RNA_property_pointer_get(ptr, prop);
- if(!pptr.type)
+ if (!pptr.type)
pptr.type= RNA_property_pointer_type(ptr, prop);
icon= RNA_struct_ui_icon(pptr.type);
- if(icon == ICON_DOT)
+ if (icon == ICON_DOT)
icon= 0;
- but= uiDefIconTextButR_prop(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+ but = uiDefIconTextButR_prop(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
break;
}
case PROP_COLLECTION: {
char text[256];
BLI_snprintf(text, sizeof(text), IFACE_("%d items"), RNA_property_collection_length(ptr, prop));
- but= uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL);
+ but = uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL);
uiButSetFlag(but, UI_BUT_DISABLED);
break;
}
@@ -141,22 +141,22 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Pointe
RNA_STRUCT_BEGIN(ptr, prop) {
flag= RNA_property_flag(prop);
- if(flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop)==FALSE))
+ if (flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop)==FALSE))
continue;
- if(label_align != '\0') {
+ if (label_align != '\0') {
PropertyType type = RNA_property_type(prop);
int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop));
name= RNA_property_ui_name(prop);
- if(label_align=='V') {
+ if (label_align=='V') {
col= uiLayoutColumn(layout, 1);
- if(!is_boolean)
+ if (!is_boolean)
uiItemL(col, name, ICON_NONE);
}
- else if(label_align=='H') {
+ else if (label_align=='H') {
split = uiLayoutSplit(layout, 0.5f, 0);
col= uiLayoutColumn(split, 0);
@@ -194,16 +194,16 @@ int uiIconFromID(ID *id)
PointerRNA ptr;
short idcode;
- if(id==NULL)
+ if (id==NULL)
return ICON_NONE;
idcode= GS(id->name);
/* exception for objects */
- if(idcode == ID_OB) {
+ if (idcode == ID_OB) {
ob= (Object*)id;
- if(ob->type == OB_EMPTY)
+ if (ob->type == OB_EMPTY)
return ICON_EMPTY_DATA;
else
return uiIconFromID(ob->data);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 0e51932df90..3baa672e42d 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -41,6 +41,7 @@
#include "BLI_listbase.h"
#include "BLI_rect.h"
#include "BLI_string.h"
+#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -245,7 +246,7 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r
rad+= step;
- if(2.0f*rad > rect->ymax-rect->ymin)
+ if (2.0f*rad > rect->ymax-rect->ymin)
rad= 0.5f*(rect->ymax-rect->ymin);
minx= rect->xmin-step;
@@ -254,59 +255,59 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r
maxy= rect->ymax+step;
/* mult */
- for(a=0; a < WIDGET_CURVE_RESOLU; a++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++) {
vec[a][0]= rad*cornervec[a][0];
vec[a][1]= rad*cornervec[a][1];
}
/* start with left-top, anti clockwise */
- if(roundboxalign & UI_CNR_TOP_LEFT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ if (roundboxalign & UI_CNR_TOP_LEFT) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx+rad-vec[a][0];
vert[tot][1]= maxy-vec[a][1];
}
}
else {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx;
vert[tot][1]= maxy;
}
}
- if(roundboxalign & UI_CNR_BOTTOM_LEFT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ if (roundboxalign & UI_CNR_BOTTOM_LEFT) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx+vec[a][1];
vert[tot][1]= miny+rad-vec[a][0];
}
}
else {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx;
vert[tot][1]= miny;
}
}
- if(roundboxalign & UI_CNR_BOTTOM_RIGHT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ if (roundboxalign & UI_CNR_BOTTOM_RIGHT) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx-rad+vec[a][0];
vert[tot][1]= miny+vec[a][1];
}
}
else {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx;
vert[tot][1]= miny;
}
}
- if(roundboxalign & UI_CNR_TOP_RIGHT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ if (roundboxalign & UI_CNR_TOP_RIGHT) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx-vec[a][1];
vert[tot][1]= maxy-rad+vec[a][0];
}
}
else {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx;
vert[tot][1]= maxy;
}
@@ -333,14 +334,14 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
minsize= MIN2((rect->xmax-rect->xmin)*hnum, (rect->ymax-rect->ymin)*vnum);
- if(2.0f*rad > minsize)
+ if (2.0f*rad > minsize)
rad= 0.5f*minsize;
- if(2.0f*(radi+1.0f) > minsize)
+ if (2.0f*(radi+1.0f) > minsize)
radi= 0.5f*minsize - 1.0f;
/* mult */
- for(a=0; a < WIDGET_CURVE_RESOLU; a++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++) {
veci[a][0]= radi*cornervec[a][0];
veci[a][1]= radi*cornervec[a][1];
vec[a][0]= rad*cornervec[a][0];
@@ -348,9 +349,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
}
/* corner left-bottom */
- if(roundboxalign & UI_CNR_BOTTOM_LEFT) {
+ if (roundboxalign & UI_CNR_BOTTOM_LEFT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= minxi+veci[a][1];
wt->inner_v[tot][1]= minyi+radi-veci[a][0];
@@ -375,9 +376,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
}
/* corner right-bottom */
- if(roundboxalign & UI_CNR_BOTTOM_RIGHT) {
+ if (roundboxalign & UI_CNR_BOTTOM_RIGHT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= maxxi-radi+veci[a][0];
wt->inner_v[tot][1]= minyi+veci[a][1];
@@ -404,9 +405,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
wt->halfwayvert= tot;
/* corner right-top */
- if(roundboxalign & UI_CNR_TOP_RIGHT) {
+ if (roundboxalign & UI_CNR_TOP_RIGHT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= maxxi-veci[a][1];
wt->inner_v[tot][1]= maxyi-radi+veci[a][0];
@@ -431,9 +432,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
}
/* corner left-top */
- if(roundboxalign & UI_CNR_TOP_LEFT) {
+ if (roundboxalign & UI_CNR_TOP_LEFT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= minxi+radi-veci[a][0];
wt->inner_v[tot][1]= maxyi-veci[a][1];
@@ -483,21 +484,21 @@ static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, cha
centy= (float)rect->ymin + 0.5f*minsize;
sizex= sizey= -0.5f*triasize*minsize;
- if(where=='r') {
+ if (where=='r') {
centx= (float)rect->xmax - 0.5f*minsize;
sizex= -sizex;
}
- else if(where=='t') {
+ else if (where=='t') {
centy= (float)rect->ymax - 0.5f*minsize;
sizey= -sizey;
i2=0; i1= 1;
}
- else if(where=='b') {
+ else if (where=='b') {
sizex= -sizex;
i2=0; i1= 1;
}
- for(a=0; a<3; a++) {
+ for (a=0; a<3; a++) {
tria->vec[a][0]= sizex*num_tria_vert[a][i1] + centx;
tria->vec[a][1]= sizey*num_tria_vert[a][i2] + centy;
}
@@ -518,21 +519,21 @@ static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize
centy= (float)rect->ymin + 0.5f*minsize;
sizex= sizey= -0.5f*triasize*minsize;
- if(where=='r') {
+ if (where=='r') {
centx= (float)rect->xmax - 0.5f*minsize;
sizex= -sizex;
}
- else if(where=='t') {
+ else if (where=='t') {
centy= (float)rect->ymax - 0.5f*minsize;
sizey= -sizey;
i2=0; i1= 1;
}
- else if(where=='b') {
+ else if (where=='b') {
sizex= -sizex;
i2=0; i1= 1;
}
- for(a=0; a<16; a++) {
+ for (a=0; a<16; a++) {
tria->vec[a][0]= sizex*scroll_circle_vert[a][i1] + centx;
tria->vec[a][1]= sizey*scroll_circle_vert[a][i2] + centy;
}
@@ -561,10 +562,10 @@ static void widget_menu_trias(uiWidgetTrias *tria, rcti *rect)
/* XXX exception */
asp= ((float)rect->xmax-rect->xmin)/((float)rect->ymax-rect->ymin);
- if(asp > 1.2f && asp < 2.6f)
+ if (asp > 1.2f && asp < 2.6f)
centx= rect->xmax - 0.3f*(rect->ymax-rect->ymin);
- for(a=0; a<6; a++) {
+ for (a=0; a<6; a++) {
tria->vec[a][0]= size*menu_tria_vert[a][0] + centx;
tria->vec[a][1]= size*menu_tria_vert[a][1] + centy;
}
@@ -583,7 +584,7 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect)
centy= rect->ymin + 0.5f*(rect->ymax-rect->ymin);
size= 0.5f*(rect->ymax-rect->ymin);
- for(a=0; a<6; a++) {
+ for (a=0; a<6; a++) {
tria->vec[a][0]= size*check_tria_vert[a][0] + centx;
tria->vec[a][1]= size*check_tria_vert[a][1] + centy;
}
@@ -622,7 +623,7 @@ static void round_box_shade_col4_r(unsigned char col_r[4], const char col1[4], c
static void widget_verts_to_quad_strip(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX*2+2][2])
{
int a;
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
copy_v2_v2(quad_strip[a*2], wtb->outer_v[a]);
copy_v2_v2(quad_strip[a*2+1], wtb->inner_v[a]);
}
@@ -633,7 +634,7 @@ static void widget_verts_to_quad_strip(uiWidgetBase *wtb, const int totvert, flo
static void widget_verts_to_quad_strip_open(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX*2][2])
{
int a;
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
quad_strip[a*2][0]= wtb->outer_v[a][0];
quad_strip[a*2][1]= wtb->outer_v[a][1];
quad_strip[a*2+1][0]= wtb->outer_v[a][0];
@@ -659,8 +660,8 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glEnable(GL_BLEND);
/* backdrop non AA */
- if(wtb->inner) {
- if(wcol->shaded==0) {
+ if (wtb->inner) {
+ if (wcol->shaded==0) {
if (wcol->alpha_check) {
float inner_v_half[WIDGET_SIZE_MAX][2];
float x_mid= 0.0f; /* used for dumb clamping of values */
@@ -690,7 +691,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glColor4ubv((unsigned char*)wcol->inner);
glEnableClientState(GL_VERTEX_ARRAY);
- for(a=0; a<wtb->totvert; a++) {
+ for (a=0; a<wtb->totvert; a++) {
x_mid += wtb->inner_v[a][0];
}
x_mid /= wtb->totvert;
@@ -702,7 +703,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
/* 1/2 solid color */
glColor4ub(wcol->inner[0], wcol->inner[1], wcol->inner[2], 255);
- for(a=0; a<wtb->totvert; a++) {
+ for (a=0; a<wtb->totvert; a++) {
inner_v_half[a][0]= MIN2(wtb->inner_v[a][0], x_mid);
inner_v_half[a][1]= wtb->inner_v[a][1];
}
@@ -730,7 +731,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
shadecolors4(col1, col2, wcol->inner, wcol->shadetop, wcol->shadedown);
glShadeModel(GL_SMOOTH);
- for(a=0; a<wtb->totvert; a++, col_pt += 4) {
+ for (a=0; a<wtb->totvert; a++, col_pt += 4) {
round_box_shade_col4_r(col_pt, col1, col2, wtb->inner_uv[a][wtb->shadedir]);
}
@@ -747,7 +748,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
}
/* for each AA step */
- if(wtb->outline) {
+ if (wtb->outline) {
float quad_strip[WIDGET_SIZE_MAX*2+2][2]; /* + 2 because the last pair is wrapped */
float quad_strip_emboss[WIDGET_SIZE_MAX*2][2]; /* only for emboss */
@@ -758,7 +759,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
widget_verts_to_quad_strip(wtb, wtb->totvert, quad_strip);
- if(wtb->emboss) {
+ if (wtb->emboss) {
widget_verts_to_quad_strip_open(wtb, wtb->halfwayvert, quad_strip_emboss);
}
@@ -774,7 +775,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert*2 + 2);
/* emboss bottom shadow */
- if(wtb->emboss) {
+ if (wtb->emboss) {
glColor4f(1.0f, 1.0f, 1.0f, 0.02f);
glVertexPointer(2, GL_FLOAT, 0, quad_strip_emboss);
@@ -788,7 +789,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
}
/* decoration */
- if(wtb->tria1.tot || wtb->tria2.tot) {
+ if (wtb->tria1.tot || wtb->tria2.tot) {
const unsigned char tcol[4] = {wcol->item[0],
wcol->item[1],
wcol->item[2],
@@ -797,11 +798,11 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
for (j = 0; j < WIDGET_AA_JITTER; j++) {
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
- if(wtb->tria1.tot) {
+ if (wtb->tria1.tot) {
glColor4ubv(tcol);
widget_trias_draw(&wtb->tria1);
}
- if(wtb->tria2.tot) {
+ if (wtb->tria2.tot) {
glColor4ubv(tcol);
widget_trias_draw(&wtb->tria2);
}
@@ -822,7 +823,7 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect)
{
int w, h, size;
- if(icon==ICON_NONE)
+ if (icon==ICON_NONE)
return;
w = rect->xmax - rect->xmin;
@@ -830,7 +831,7 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect)
size = MIN2(w, h);
size -= PREVIEW_PAD*2; /* padding */
- if(size > 0) {
+ if (size > 0) {
int x = rect->xmin + w/2 - size/2;
int y = rect->ymin + h/2 - size/2;
@@ -857,11 +858,11 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
}
/* this icon doesn't need draw... */
- if(icon==ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU)==0) return;
+ if (icon==ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU)==0) return;
/* we need aspect from block, for menus... these buttons are scaled in uiPositionBlock() */
aspect= but->block->aspect;
- if(aspect != but->aspect) {
+ if (aspect != but->aspect) {
/* prevent scaling up icon in pupmenu */
if (aspect < 1.0f) {
height= UI_DPI_ICON_SIZE;
@@ -876,27 +877,28 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
/* calculate blend color */
if ELEM4(but->type, TOG, ROW, TOGN, LISTROW) {
- if(but->flag & UI_SELECT);
- else if(but->flag & UI_ACTIVE);
+ if (but->flag & UI_SELECT);
+ else if (but->flag & UI_ACTIVE);
else alpha= 0.5f;
}
/* extra feature allows more alpha blending */
- if(but->type==LABEL && but->a1==1.0f) alpha *= but->a2;
+ if (but->type==LABEL && but->a1==1.0f) alpha *= but->a2;
glEnable(GL_BLEND);
- if(icon && icon!=ICON_BLANK1) {
- if(but->flag & UI_ICON_LEFT) {
+ if (icon && icon!=ICON_BLANK1) {
+ if (but->flag & UI_ICON_LEFT) {
if (but->type==BUT_TOGDUAL) {
if (but->drawstr[0]) {
xs= rect->xmin-1;
- } else {
+ }
+ else {
xs= (rect->xmin+rect->xmax- height)/2;
}
}
else if (but->block->flag & UI_BLOCK_LOOP) {
- if(but->type==SEARCH_MENU)
+ if (but->type==SEARCH_MENU)
xs= rect->xmin+4;
else
xs= rect->xmin+1;
@@ -915,7 +917,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
}
/* to indicate draggable */
- if(but->dragpoin && (but->flag & UI_ACTIVE)) {
+ if (but->dragpoin && (but->flag & UI_ACTIVE)) {
float rgb[3]= {1.25f, 1.25f, 1.25f};
UI_icon_draw_aspect_color(xs, ys, icon, aspect, rgb);
}
@@ -933,6 +935,22 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
glDisable(GL_BLEND);
}
+static void ui_text_clip_give_prev_off(uiBut *but)
+{
+ char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + but->ofs);
+ int bytes = but->drawstr + but->ofs - prev_utf8;
+
+ but->ofs -= bytes;
+}
+
+static void ui_text_clip_give_next_off(uiBut *but)
+{
+ char *next_utf8 = BLI_str_find_next_char_utf8(but->drawstr + but->ofs, NULL);
+ int bytes = next_utf8 - (but->drawstr + but->ofs);
+
+ but->ofs += bytes;
+}
+
/* sets but->ofs to make sure text is correctly visible */
static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
{
@@ -948,46 +966,49 @@ static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
/* if text editing we define ofs dynamically */
- if(but->editstr && but->pos >= 0) {
- if(but->ofs > but->pos)
+ if (but->editstr && but->pos >= 0) {
+ if (but->ofs > but->pos)
but->ofs= but->pos;
- if(BLF_width(fstyle->uifont_id, but->drawstr) <= okwidth)
+ if (BLF_width(fstyle->uifont_id, but->drawstr) <= okwidth)
but->ofs = 0;
}
else but->ofs= 0;
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
- while(but->strwidth > okwidth) {
+ while (but->strwidth > okwidth) {
/* textbut exception, clip right when... */
- if(but->editstr && but->pos >= 0) {
+ if (but->editstr && but->pos >= 0) {
float width;
char buf[UI_MAX_DRAW_STR];
/* copy draw string */
- BLI_strncpy(buf, but->drawstr, sizeof(buf));
+ BLI_strncpy_utf8(buf, but->drawstr, sizeof(buf));
/* string position of cursor */
buf[but->pos]= 0;
width= BLF_width(fstyle->uifont_id, buf+but->ofs);
/* if cursor is at 20 pixels of right side button we clip left */
- if(width > okwidth-20)
- but->ofs++;
+ if (width > okwidth-20)
+ ui_text_clip_give_next_off(but);
else {
+ int len, bytes;
/* shift string to the left */
- if(width < 20 && but->ofs > 0)
- but->ofs--;
- but->drawstr[ strlen(but->drawstr)-1 ]= 0;
+ if (width < 20 && but->ofs > 0)
+ ui_text_clip_give_prev_off(but);
+ len= strlen(but->drawstr);
+ bytes= BLI_str_utf8_size(BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + len));
+ but->drawstr[ len-bytes ]= 0;
}
}
else
- but->ofs++;
+ ui_text_clip_give_next_off(but);
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
- if(but->strwidth < 10) break;
+ if (but->strwidth < 10) break;
}
if (fstyle->kerning==1)
@@ -1018,34 +1039,40 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
/* chop off the leading text, starting from the right */
while (but->strwidth > okwidth && cp2 > but->drawstr) {
+ int bytes = BLI_str_utf8_size(cp2);
+ if (bytes < 0)
+ bytes = 1;
+
/* shift the text after and including cp2 back by 1 char, +1 to include null terminator */
- memmove(cp2-1, cp2, strlen(cp2)+1);
- cp2--;
+ memmove(cp2-bytes, cp2, strlen(cp2)+1);
+ cp2-=bytes;
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
- if(but->strwidth < 10) break;
+ if (but->strwidth < 10) break;
}
/* after the leading text is gone, chop off the : and following space, with ofs */
while ((but->strwidth > okwidth) && (but->ofs < 2))
{
- but->ofs++;
+ ui_text_clip_give_next_off(but);
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
- if(but->strwidth < 10) break;
+ if (but->strwidth < 10) break;
}
}
/* once the label's gone, chop off the least significant digits */
- while(but->strwidth > okwidth ) {
- int pos= strlen(but->drawstr);
-
- but->drawstr[ pos-1 ] = 0;
- pos--;
+ while (but->strwidth > okwidth ) {
+ int len= strlen(but->drawstr);
+ int bytes= BLI_str_utf8_size(BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + len));
+ if (bytes < 0)
+ bytes = 1;
+
+ but->drawstr[ len-bytes ]= 0;
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
- if(but->strwidth < 10) break;
+ if (but->strwidth < 10) break;
}
if (fstyle->kerning==1)
@@ -1063,7 +1090,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
uiStyleFontSet(fstyle);
- if(but->editstr || (but->flag & UI_TEXT_LEFT))
+ if (but->editstr || (but->flag & UI_TEXT_LEFT))
fstyle->align= UI_STYLE_TEXT_LEFT;
else
fstyle->align= UI_STYLE_TEXT_CENTER;
@@ -1072,7 +1099,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
/* text button selection and cursor */
- if(but->editstr && but->pos != -1) {
+ if (but->editstr && but->pos != -1) {
short t=0, pos=0, ch;
short selsta_tmp, selend_tmp, selsta_draw, selwidth_draw;
@@ -1081,7 +1108,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
selsta_tmp = but->selsta;
selend_tmp = but->selend;
- if(but->drawstr[0]!=0) {
+ if (but->drawstr[0]!=0) {
if (but->selsta >= but->ofs) {
ch= but->drawstr[selsta_tmp];
@@ -1090,8 +1117,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
selsta_draw = BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
but->drawstr[selsta_tmp]= ch;
- } else
+ }
+ else {
selsta_draw = 0;
+ }
ch= but->drawstr[selend_tmp];
but->drawstr[selend_tmp]= 0;
@@ -1103,11 +1132,12 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
glColor3ubv((unsigned char*)wcol->item);
glRects(rect->xmin+selsta_draw, rect->ymin+2, rect->xmin+selwidth_draw, rect->ymax-2);
}
- } else {
+ }
+ else {
/* text cursor */
pos= but->pos;
- if(pos >= but->ofs) {
- if(but->drawstr[0]!=0) {
+ if (pos >= but->ofs) {
+ if (but->drawstr[0]!=0) {
ch= but->drawstr[pos];
but->drawstr[pos]= 0;
@@ -1126,14 +1156,14 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
// ui_rasterpos_safe(x, y, but->aspect);
-// if(but->type==IDPOIN) transopts= 0; // no translation, of course!
+// if (but->type==IDPOIN) transopts= 0; // no translation, of course!
// else transopts= ui_translate_buttons();
/* cut string in 2 parts - only for menu entries */
- if((but->block->flag & UI_BLOCK_LOOP)) {
- if(ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS)==0) {
+ if ((but->block->flag & UI_BLOCK_LOOP)) {
+ if (ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS)==0) {
cpoin= strchr(but->drawstr, '|');
- if(cpoin) *cpoin= 0;
+ if (cpoin) *cpoin= 0;
}
}
@@ -1141,17 +1171,17 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
uiStyleFontDrawExt(fstyle, rect, but->drawstr+but->ofs, &font_xofs, &font_yofs);
- if(but->menu_key != '\0') {
+ if (but->menu_key != '\0') {
char fixedbuf[128];
char *str;
BLI_strncpy(fixedbuf, but->drawstr + but->ofs, sizeof(fixedbuf));
str= strchr(fixedbuf, but->menu_key-32); /* upper case */
- if(str==NULL)
+ if (str==NULL)
str= strchr(fixedbuf, but->menu_key);
- if(str) {
+ if (str) {
int ul_index= -1;
float ul_advance;
@@ -1174,7 +1204,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
}
/* part text right aligned */
- if(cpoin) {
+ if (cpoin) {
fstyle->align= UI_STYLE_TEXT_RIGHT;
rect->xmax -= ui_but_draw_menu_icon(but) ? UI_DPI_ICON_SIZE : 5;
uiStyleFontDraw(fstyle, rect, cpoin+1);
@@ -1186,7 +1216,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
{
- if(but==NULL) return;
+ if (but==NULL) return;
/* clip but->drawstr to fit in available space */
if (but->editstr && but->pos >= 0) {
@@ -1209,16 +1239,16 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
}
else {
- if(but->type==BUT_TOGDUAL) {
+ if (but->type==BUT_TOGDUAL) {
int dualset= 0;
- if(but->pointype==SHO)
+ if (but->pointype==SHO)
dualset= BTST( *(((short *)but->poin)+1), but->bitnr);
- else if(but->pointype==INT)
+ else if (but->pointype==INT)
dualset= BTST( *(((int *)but->poin)+1), but->bitnr);
widget_draw_icon(but, ICON_DOT, dualset?1.0f:0.25f, rect);
}
- else if(but->type==MENU && (but->flag & UI_BUT_NODE_LINK)) {
+ else if (but->type==MENU && (but->flag & UI_BUT_NODE_LINK)) {
int tmp = rect->xmin;
rect->xmin = rect->xmax - (rect->ymax - rect->ymin) - 1;
widget_draw_icon(but, ICON_LAYER_USED, 1.0f, rect);
@@ -1233,10 +1263,10 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
rect->xmin += (int)((float)UI_icon_get_width(but->icon+but->iconadd) * UI_DPI_ICON_FAC);
- if(but->editstr || (but->flag & UI_TEXT_LEFT))
+ if (but->editstr || (but->flag & UI_TEXT_LEFT))
rect->xmin += 5;
}
- else if((but->flag & UI_TEXT_LEFT))
+ else if ((but->flag & UI_TEXT_LEFT))
rect->xmin += 5;
/* always draw text for textbutton cursor */
@@ -1367,7 +1397,7 @@ static struct uiWidgetColors wcol_menu_item= {
{0, 0, 0, 255},
{0, 0, 0, 0},
{86, 128, 194, 255},
- {255, 255, 255, 255},
+ {172, 172, 172, 128},
{255, 255, 255, 255},
{0, 0, 0, 255},
@@ -1390,6 +1420,19 @@ static struct uiWidgetColors wcol_menu_back= {
25, -20
};
+/* tooltip colour */
+static struct uiWidgetColors wcol_tooltip= {
+ {0, 0, 0, 255},
+ {25, 25, 25, 230},
+ {45, 45, 45, 230},
+ {100, 100, 100, 255},
+
+ {160, 160, 160, 255},
+ {255, 255, 255, 255},
+
+ 0,
+ 25, -20
+};
static struct uiWidgetColors wcol_radio= {
{0, 0, 0, 255},
@@ -1524,6 +1567,7 @@ void ui_widget_color_init(ThemeUI *tui)
tui->wcol_menu= wcol_menu;
tui->wcol_pulldown= wcol_pulldown;
tui->wcol_menu_back= wcol_menu_back;
+ tui->wcol_tooltip = wcol_tooltip;
tui->wcol_menu_item= wcol_menu_item;
tui->wcol_box= wcol_box;
tui->wcol_scroll= wcol_scroll;
@@ -1537,7 +1581,7 @@ void ui_widget_color_init(ThemeUI *tui)
static void widget_state_blend(char cp[3], const char cpstate[3], const float fac)
{
- if(fac != 0.0f) {
+ if (fac != 0.0f) {
cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]);
cp[1]= (int)((1.0f-fac)*cp[1] + fac*cpstate[1]);
cp[2]= (int)((1.0f-fac)*cp[2] + fac*cpstate[2]);
@@ -1551,41 +1595,41 @@ static void widget_state(uiWidgetType *wt, int state)
wt->wcol= *(wt->wcol_theme);
- if(state & UI_SELECT) {
+ if (state & UI_SELECT) {
copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
- if(state & UI_BUT_ANIMATED_KEY)
+ if (state & UI_BUT_ANIMATED_KEY)
widget_state_blend(wt->wcol.inner, wcol_state->inner_key_sel, wcol_state->blend);
- else if(state & UI_BUT_ANIMATED)
+ else if (state & UI_BUT_ANIMATED)
widget_state_blend(wt->wcol.inner, wcol_state->inner_anim_sel, wcol_state->blend);
- else if(state & UI_BUT_DRIVEN)
+ else if (state & UI_BUT_DRIVEN)
widget_state_blend(wt->wcol.inner, wcol_state->inner_driven_sel, wcol_state->blend);
copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
}
else {
- if(state & UI_BUT_ANIMATED_KEY)
+ if (state & UI_BUT_ANIMATED_KEY)
widget_state_blend(wt->wcol.inner, wcol_state->inner_key, wcol_state->blend);
- else if(state & UI_BUT_ANIMATED)
+ else if (state & UI_BUT_ANIMATED)
widget_state_blend(wt->wcol.inner, wcol_state->inner_anim, wcol_state->blend);
- else if(state & UI_BUT_DRIVEN)
+ else if (state & UI_BUT_DRIVEN)
widget_state_blend(wt->wcol.inner, wcol_state->inner_driven, wcol_state->blend);
- if(state & UI_ACTIVE) { /* mouse over? */
+ if (state & UI_ACTIVE) { /* mouse over? */
wt->wcol.inner[0]= wt->wcol.inner[0]>=240? 255 : wt->wcol.inner[0]+15;
wt->wcol.inner[1]= wt->wcol.inner[1]>=240? 255 : wt->wcol.inner[1]+15;
wt->wcol.inner[2]= wt->wcol.inner[2]>=240? 255 : wt->wcol.inner[2]+15;
}
}
- if(state & UI_BUT_REDALERT) {
+ if (state & UI_BUT_REDALERT) {
char red[4]= {255, 0, 0};
widget_state_blend(wt->wcol.inner, red, 0.4f);
}
- if(state & UI_BUT_NODE_ACTIVE) {
+ if (state & UI_BUT_NODE_ACTIVE) {
char blue[4]= {86, 128, 194};
widget_state_blend(wt->wcol.inner, blue, 0.3f);
}
@@ -1602,24 +1646,24 @@ static void widget_state_numslider(uiWidgetType *wt, int state)
/* now, set the inner-part so that it reflects state settings too */
// TODO: maybe we should have separate settings for the blending colors used for this case?
- if(state & UI_SELECT) {
+ if (state & UI_SELECT) {
- if(state & UI_BUT_ANIMATED_KEY)
+ if (state & UI_BUT_ANIMATED_KEY)
widget_state_blend(wt->wcol.item, wcol_state->inner_key_sel, blend);
- else if(state & UI_BUT_ANIMATED)
+ else if (state & UI_BUT_ANIMATED)
widget_state_blend(wt->wcol.item, wcol_state->inner_anim_sel, blend);
- else if(state & UI_BUT_DRIVEN)
+ else if (state & UI_BUT_DRIVEN)
widget_state_blend(wt->wcol.item, wcol_state->inner_driven_sel, blend);
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
}
else {
- if(state & UI_BUT_ANIMATED_KEY)
+ if (state & UI_BUT_ANIMATED_KEY)
widget_state_blend(wt->wcol.item, wcol_state->inner_key, blend);
- else if(state & UI_BUT_ANIMATED)
+ else if (state & UI_BUT_ANIMATED)
widget_state_blend(wt->wcol.item, wcol_state->inner_anim, blend);
- else if(state & UI_BUT_DRIVEN)
+ else if (state & UI_BUT_DRIVEN)
widget_state_blend(wt->wcol.item, wcol_state->inner_driven, blend);
}
}
@@ -1630,7 +1674,7 @@ static void widget_state_label(uiWidgetType *wt, int state)
/* call this for option button */
widget_state(wt, state);
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
else
UI_GetThemeColor4ubv(TH_TEXT, (unsigned char *)wt->wcol.text);
@@ -1645,7 +1689,7 @@ static void widget_state_option_menu(uiWidgetType *wt, int state)
widget_state(wt, state);
/* if not selected we get theme from menu back */
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
else {
bTheme *btheme= UI_GetTheme(); /* XXX */
@@ -1668,7 +1712,7 @@ static void widget_state_pulldown(uiWidgetType *wt, int state)
copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
copy_v3_v3_char(wt->wcol.outline, wt->wcol.inner);
- if(state & UI_ACTIVE)
+ if (state & UI_ACTIVE)
copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
}
@@ -1677,12 +1721,12 @@ static void widget_state_menu_item(uiWidgetType *wt, int state)
{
wt->wcol= *(wt->wcol_theme);
- if(state & (UI_BUT_DISABLED|UI_BUT_INACTIVE)) {
+ if (state & (UI_BUT_DISABLED|UI_BUT_INACTIVE)) {
wt->wcol.text[0]= 0.5f*(wt->wcol.text[0]+wt->wcol.text_sel[0]);
wt->wcol.text[1]= 0.5f*(wt->wcol.text[1]+wt->wcol.text_sel[1]);
wt->wcol.text[2]= 0.5f*(wt->wcol.text[2]+wt->wcol.text_sel[2]);
}
- else if(state & UI_ACTIVE) {
+ else if (state & UI_ACTIVE) {
copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
}
@@ -1701,7 +1745,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float
float quad_strip[WIDGET_SIZE_MAX*2][2];
/* prevent tooltips to not show round shadow */
- if( 2.0f*radout > 0.2f*(rect1.ymax-rect1.ymin) )
+ if ( 2.0f*radout > 0.2f*(rect1.ymax-rect1.ymin) )
rect1.ymax -= 0.2f*(rect1.ymax-rect1.ymin);
else
rect1.ymax -= 2.0f*radout;
@@ -1715,7 +1759,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float
glEnableClientState(GL_VERTEX_ARRAY);
- for(step= 1; step<=radout; step++, alpha*=alphastep) {
+ for (step= 1; step<=radout; step++, alpha*=alphastep) {
round_box_shadow_edges(wtb.outer_v, &rect1, radin, UI_CNR_ALL, (float)step);
glColor4f(0.0f, 0.0f, 0.0f, alpha);
@@ -1788,7 +1832,7 @@ void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float
float centy= (float)(rect->ymin + rect->ymax)/2;
float radius, dist;
- if( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
+ if ( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
radius= (float)(rect->ymax - rect->ymin)/2;
else
radius= (float)(rect->xmax - rect->xmin)/2;
@@ -1796,7 +1840,7 @@ void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float
mx-= centx;
my-= centy;
dist= sqrt( mx*mx + my*my);
- if(dist < radius)
+ if (dist < radius)
*valdist= dist/radius;
else
*valdist= 1.0f;
@@ -1820,7 +1864,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
centx= (float)(rect->xmin + rect->xmax)/2;
centy= (float)(rect->ymin + rect->ymax)/2;
- if( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
+ if ( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
radius= (float)(rect->ymax - rect->ymin)/2;
else
radius= (float)(rect->xmax - rect->xmin)/2;
@@ -1847,7 +1891,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glColor3fv(colcent);
glVertex2f( centx, centy);
- for(a=0; a<=tot; a++, ang+=radstep) {
+ for (a=0; a<=tot; a++, ang+=radstep) {
float si= sin(ang);
float co= cos(ang);
@@ -1876,7 +1920,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* cursor */
ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI;
- if(but->flag & UI_BUT_COLOR_CUBIC)
+ if (but->flag & UI_BUT_COLOR_CUBIC)
cursor_radius = (1.0f - powf(1.0f - hsvo[1], 3.0f));
else
cursor_radius = hsvo[1];
@@ -1946,7 +1990,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
/* old below */
- for(dx=0.0f; dx<1.0f; dx+= 0.05f) {
+ for (dx=0.0f; dx<1.0f; dx+= 0.05f) {
// previous color
copy_v3_v3(col0[0], col1[0]);
copy_v3_v3(col0[1], col1[1]);
@@ -2000,7 +2044,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
dy= (rect->ymax-rect->ymin)/3.0;
glBegin(GL_QUADS);
- for(a=0; a<3; a++, sy+=dy) {
+ for (a=0; a<3; a++, sy+=dy) {
glColor4f(col0[a][0], col0[a][1], col0[a][2], alpha);
glVertex2f(sx1, sy);
@@ -2142,7 +2186,7 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round
float rad= 0.5f*(rect->ymax - rect->ymin);
float textofs = rad*0.75f;
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
SWAP(short, wcol->shadetop, wcol->shadedown);
widget_init(&wtb);
@@ -2151,7 +2195,7 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round
round_box_edges(&wtb, roundboxalign, rect, rad);
/* decoration */
- if(!(state & UI_TEXTINPUT)) {
+ if (!(state & UI_TEXTINPUT)) {
widget_num_tria(&wtb.tria1, rect, 0.6f, 'l');
widget_num_tria(&wtb.tria2, rect, 0.6f, 'r');
}
@@ -2192,7 +2236,7 @@ void ui_draw_link_bezier(rcti *rect)
{
float coord_array[LINK_RESOL+1][2];
- if(ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
+ if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
/* we can reuse the dist variable here to increment the GL curve eval amount*/
// const float dist= 1.0f/(float)LINK_RESOL; // UNUSED
@@ -2223,7 +2267,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
/* determine horizontal/vertical */
horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
- if(horizontal)
+ if (horizontal)
rad= 0.5f*(rect->ymax - rect->ymin);
else
rad= 0.5f*(rect->xmax - rect->xmin);
@@ -2231,25 +2275,25 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
wtb.shadedir= (horizontal)? 1: 0;
/* draw back part, colors swapped and shading inverted */
- if(horizontal)
+ if (horizontal)
SWAP(short, wcol->shadetop, wcol->shadedown);
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
widgetbase_draw(&wtb, wcol);
/* slider */
- if(slider->xmax-slider->xmin<2 || slider->ymax-slider->ymin<2);
+ if (slider->xmax-slider->xmin<2 || slider->ymax-slider->ymin<2);
else {
SWAP(short, wcol->shadetop, wcol->shadedown);
copy_v4_v4_char(wcol->inner, wcol->item);
- if(wcol->shadetop>wcol->shadedown)
+ if (wcol->shadetop>wcol->shadedown)
wcol->shadetop+= 20; /* XXX violates themes... */
else wcol->shadedown+= 20;
- if(state & UI_SCROLL_PRESSED) {
+ if (state & UI_SCROLL_PRESSED) {
wcol->inner[0]= wcol->inner[0]>=250? 255 : wcol->inner[0]+5;
wcol->inner[1]= wcol->inner[1]>=250? 255 : wcol->inner[1]+5;
wcol->inner[2]= wcol->inner[2]>=250? 255 : wcol->inner[2]+5;
@@ -2264,13 +2308,13 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
round_box_edges(&wtb, UI_CNR_ALL, slider, rad);
- if(state & UI_SCROLL_ARROWS) {
- if(wcol->item[0] > 48) wcol->item[0]-= 48;
- if(wcol->item[1] > 48) wcol->item[1]-= 48;
- if(wcol->item[2] > 48) wcol->item[2]-= 48;
+ if (state & UI_SCROLL_ARROWS) {
+ if (wcol->item[0] > 48) wcol->item[0]-= 48;
+ if (wcol->item[1] > 48) wcol->item[1]-= 48;
+ if (wcol->item[2] > 48) wcol->item[2]-= 48;
wcol->item[3]= 255;
- if(horizontal) {
+ if (horizontal) {
widget_scroll_circle(&wtb.tria1, slider, 0.6f, 'l');
widget_scroll_circle(&wtb.tria2, slider, 0.6f, 'r');
}
@@ -2305,42 +2349,42 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
/* determine horizontal/vertical */
horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
- if(horizontal) {
+ if (horizontal) {
fac= (rect->xmax - rect->xmin)/(size);
- rect1.xmin= rect1.xmin + ceilf(fac*((float)value - but->softmin));
- rect1.xmax= rect1.xmin + ceilf(fac*(but->a1 - but->softmin));
+ rect1.xmin = rect1.xmin + ceilf(fac*((float)value - but->softmin));
+ rect1.xmax = rect1.xmin + ceilf(fac*(but->a1 - but->softmin));
/* ensure minimium size */
min= rect->ymax - rect->ymin;
- if(rect1.xmax - rect1.xmin < min) {
- rect1.xmax= rect1.xmin + min;
+ if (rect1.xmax - rect1.xmin < min) {
+ rect1.xmax = rect1.xmin + min;
- if(rect1.xmax > rect->xmax) {
- rect1.xmax= rect->xmax;
- rect1.xmin= MAX2(rect1.xmax - min, rect->xmin);
+ if (rect1.xmax > rect->xmax) {
+ rect1.xmax = rect->xmax;
+ rect1.xmin = MAX2(rect1.xmax - min, rect->xmin);
}
}
}
else {
fac= (rect->ymax - rect->ymin)/(size);
- rect1.ymax= rect1.ymax - ceilf(fac*((float)value - but->softmin));
- rect1.ymin= rect1.ymax - ceilf(fac*(but->a1 - but->softmin));
+ rect1.ymax = rect1.ymax - ceilf(fac*((float)value - but->softmin));
+ rect1.ymin = rect1.ymax - ceilf(fac*(but->a1 - but->softmin));
/* ensure minimium size */
min= rect->xmax - rect->xmin;
- if(rect1.ymax - rect1.ymin < min) {
- rect1.ymax= rect1.ymin + min;
+ if (rect1.ymax - rect1.ymin < min) {
+ rect1.ymax = rect1.ymin + min;
- if(rect1.ymax > rect->ymax) {
- rect1.ymax= rect->ymax;
- rect1.ymin= MAX2(rect1.ymax - min, rect->ymin);
+ if (rect1.ymax > rect->ymax) {
+ rect1.ymax = rect->ymax;
+ rect1.ymin = MAX2(rect1.ymax - min, rect->ymin);
}
}
}
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
state= UI_SCROLL_PRESSED;
else
state= 0;
@@ -2376,15 +2420,15 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
- if(but->flag & UI_SELECT) {
+ if (but->flag & UI_SELECT) {
rcti rectlink;
UI_ThemeColor(TH_TEXT_HI);
- rectlink.xmin= (rect->xmin+rect->xmax)/2;
- rectlink.ymin= (rect->ymin+rect->ymax)/2;
- rectlink.xmax= but->linkto[0];
- rectlink.ymax= but->linkto[1];
+ rectlink.xmin = (rect->xmin+rect->xmax)/2;
+ rectlink.ymin = (rect->ymin+rect->ymax)/2;
+ rectlink.xmax = but->linkto[0];
+ rectlink.ymax = but->linkto[1];
ui_draw_link_bezier(&rectlink);
}
@@ -2412,14 +2456,14 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
widgetbase_draw(&wtb, wcol);
/* draw left/right parts only when not in text editing */
- if(!(state & UI_TEXTINPUT)) {
+ if (!(state & UI_TEXTINPUT)) {
/* slider part */
copy_v3_v3_char(outline, wcol->outline);
copy_v3_v3_char(wcol->outline, wcol->item);
copy_v3_v3_char(wcol->inner, wcol->item);
- if(!(state & UI_SELECT))
+ if (!(state & UI_SELECT))
SWAP(short, wcol->shadetop, wcol->shadedown);
rect1= *rect;
@@ -2428,15 +2472,15 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
fac= ((float)value-but->softmin)*(rect1.xmax - rect1.xmin - offs)/(but->softmax - but->softmin);
/* left part of slider, always rounded */
- rect1.xmax= rect1.xmin + ceil(offs+1.0f);
+ rect1.xmax = rect1.xmin + ceil(offs+1.0f);
round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT), &rect1, offs);
wtb1.outline= 0;
widgetbase_draw(&wtb1, wcol);
/* right part of slider, interpolate roundness */
- rect1.xmax= rect1.xmin + fac + offs;
+ rect1.xmax = rect1.xmin + fac + offs;
rect1.xmin+= floor(offs-1.0f);
- if(rect1.xmax + offs > rect->xmax)
+ if (rect1.xmax + offs > rect->xmax)
offs*= (rect1.xmax + offs - rect->xmax)/offs;
else
offs= 0.0f;
@@ -2445,7 +2489,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
widgetbase_draw(&wtb1, wcol);
copy_v3_v3_char(wcol->outline, outline);
- if(!(state & UI_SELECT))
+ if (!(state & UI_SELECT))
SWAP(short, wcol->shadetop, wcol->shadedown);
}
@@ -2474,7 +2518,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
color_profile = BLI_PR_NONE;
- if(RNA_property_array_length(&but->rnapoin, but->rnaprop)==4) {
+ if (RNA_property_array_length(&but->rnapoin, but->rnaprop)==4) {
col[3]= RNA_property_float_get_index(&but->rnapoin, but->rnaprop, 3);
}
}
@@ -2486,7 +2530,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
ui_get_but_vectorf(but, col);
- if(state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
+ if (state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
// draw based on state - color for keyed etc
widgetbase_draw(&wtb, wcol);
@@ -2513,7 +2557,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
{
- if(state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
+ if (state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
uiWidgetBase wtb;
widget_init(&wtb);
@@ -2530,7 +2574,7 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun
{
uiWidgetBase wtb;
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
SWAP(short, wcol->shadetop, wcol->shadedown);
widget_init(&wtb);
@@ -2599,7 +2643,7 @@ static void widget_menunodebut(uiWidgetColors *wcol, rcti *rect, int UNUSED(stat
static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
{
- if(state & UI_ACTIVE) {
+ if (state & UI_ACTIVE) {
uiWidgetBase wtb;
float rad= 0.5f*(rect->ymax - rect->ymin); // 4.0f
@@ -2647,7 +2691,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
widget_init(&wtb);
/* square */
- recttemp.xmax= recttemp.xmin + (recttemp.ymax-recttemp.ymin);
+ recttemp.xmax = recttemp.xmin + (recttemp.ymax-recttemp.ymin);
/* smaller */
delta= 1 + (recttemp.ymax-recttemp.ymin)/8;
@@ -2660,7 +2704,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
round_box_edges(&wtb, UI_CNR_ALL, &recttemp, 4.0f);
/* decoration */
- if(state & UI_SELECT) {
+ if (state & UI_SELECT) {
widget_check_trias(&wtb.tria1, &recttemp);
}
@@ -2749,7 +2793,7 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
widget_init(&wtb);
- if(but->block->drawextra) {
+ if (but->block->drawextra) {
/* note: drawextra can change rect +1 or -1, to match round errors of existing previews */
but->block->drawextra(C, but->poin, but->block->drawextra_arg1, but->block->drawextra_arg2, rect);
@@ -2838,6 +2882,11 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
wt.wcol_theme= &btheme->tui.wcol_tool;
wt.draw= widget_roundbut;
break;
+
+ case UI_WTYPE_TOOLTIP:
+ wt.wcol_theme = &btheme->tui.wcol_tooltip;
+ wt.draw = widget_menu_back;
+ break;
/* strings */
@@ -2939,11 +2988,11 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
static int widget_roundbox_set(uiBut *but, rcti *rect)
{
/* alignment */
- if(but->flag & UI_BUT_ALIGN) {
+ if (but->flag & UI_BUT_ALIGN) {
- if(but->flag & UI_BUT_ALIGN_TOP)
+ if (but->flag & UI_BUT_ALIGN_TOP)
rect->ymax+= 1;
- if(but->flag & UI_BUT_ALIGN_LEFT)
+ if (but->flag & UI_BUT_ALIGN_LEFT)
rect->xmin-= 1;
switch(but->flag & UI_BUT_ALIGN) {
@@ -2980,7 +3029,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
uiWidgetType *wt= NULL;
/* handle menus separately */
- if(but->dt==UI_EMBOSSP) {
+ if (but->dt==UI_EMBOSSP) {
switch (but->type) {
case LABEL:
widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect);
@@ -2993,7 +3042,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
wt= widget_type(UI_WTYPE_MENU_ITEM);
}
}
- else if(but->dt==UI_EMBOSSN) {
+ else if (but->dt==UI_EMBOSSN) {
/* "nothing" */
wt= widget_type(UI_WTYPE_ICON);
}
@@ -3001,7 +3050,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
switch (but->type) {
case LABEL:
- if(but->block->flag & UI_BLOCK_LOOP)
+ if (but->block->flag & UI_BLOCK_LOOP)
widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect);
else {
wt= widget_type(UI_WTYPE_LABEL);
@@ -3039,7 +3088,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case SEARCH_MENU:
wt= widget_type(UI_WTYPE_NAME);
- if(but->block->flag & UI_BLOCK_LOOP)
+ if (but->block->flag & UI_BLOCK_LOOP)
wt->wcol_theme= &btheme->tui.wcol_menu_back;
break;
@@ -3060,7 +3109,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
wt= widget_type(UI_WTYPE_TOGGLE);
/* option buttons have strings outside, on menus use different colors */
- if(but->block->flag & UI_BLOCK_LOOP)
+ if (but->block->flag & UI_BLOCK_LOOP)
wt->state= widget_state_option_menu;
break;
@@ -3068,9 +3117,9 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case MENU:
case BLOCK:
case ICONTEXTROW:
- if(but->flag & UI_BUT_NODE_LINK)
+ if (but->flag & UI_BUT_NODE_LINK)
wt= widget_type(UI_WTYPE_MENU_NODE_LINK);
- else if(!but->str[0] && but->icon)
+ else if (!but->str[0] && but->icon)
wt= widget_type(UI_WTYPE_MENU_ICON_RADIO);
else
wt= widget_type(UI_WTYPE_MENU_RADIO);
@@ -3105,7 +3154,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
break;
case HSVCUBE:
- if(but->a1 == UI_GRAD_V_ALT) // vertical V slider, uses new widget draw now
+ if (but->a1 == UI_GRAD_V_ALT) // vertical V slider, uses new widget draw now
ui_draw_but_HSV_v(but, rect);
else // other HSV pickers...
ui_draw_but_HSVCUBE(but, rect);
@@ -3161,24 +3210,24 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
}
}
- if(wt) {
+ if (wt) {
rcti disablerect= *rect; /* rect gets clipped smaller for text */
int roundboxalign, state;
roundboxalign= widget_roundbox_set(but, rect);
state= but->flag;
- if(but->editstr) state |= UI_TEXTINPUT;
+ if (but->editstr) state |= UI_TEXTINPUT;
wt->state(wt, state);
- if(wt->custom)
+ if (wt->custom)
wt->custom(but, &wt->wcol, rect, state, roundboxalign);
- else if(wt->draw)
+ else if (wt->draw)
wt->draw(&wt->wcol, rect, state, roundboxalign);
wt->text(fstyle, &wt->wcol, but, rect);
- if(state & (UI_BUT_DISABLED|UI_BUT_INACTIVE))
- if(but->dt!=UI_EMBOSSP)
+ if (state & (UI_BUT_DISABLED|UI_BUT_INACTIVE))
+ if (but->dt!=UI_EMBOSSP)
widget_disabled(&disablerect);
}
}
@@ -3188,18 +3237,18 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_BACK);
wt->state(wt, 0);
- if(block)
+ if (block)
wt->draw(&wt->wcol, rect, block->flag, block->direction);
else
wt->draw(&wt->wcol, rect, 0, 0);
- if(block) {
- if(block->flag & UI_BLOCK_CLIPTOP) {
+ if (block) {
+ if (block->flag & UI_BLOCK_CLIPTOP) {
/* XXX no scaling for UI here yet */
glColor3ubv((unsigned char*)wt->wcol.text);
UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymax-8, 't');
}
- if(block->flag & UI_BLOCK_CLIPBOTTOM) {
+ if (block->flag & UI_BLOCK_CLIPBOTTOM) {
/* XXX no scaling for UI here yet */
glColor3ubv((unsigned char*)wt->wcol.text);
UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymin+10, 'v');
@@ -3207,6 +3256,19 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
}
}
+uiWidgetColors* ui_tooltip_get_theme(void) {
+ uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP);
+ return wt->wcol_theme;
+}
+
+void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect)
+{
+ uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP);
+ wt->state(wt, 0);
+ /* wt->draw ends up using same function to draw the tooltip as menu_back */
+ wt->draw(&wt->wcol, rect, 0, 0);
+}
+
void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
{
uiWidgetType *wt= widget_type(UI_WTYPE_BOX);
@@ -3216,7 +3278,7 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
glDisable(GL_BLEND);
wt->state(wt, 0);
- if(block)
+ if (block)
wt->draw(&wt->wcol, rect, block->flag, UI_CNR_ALL);
else
wt->draw(&wt->wcol, rect, 0, UI_CNR_ALL);
@@ -3240,11 +3302,11 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
/* text location offset */
rect->xmin+=5;
- if(iconid) rect->xmin+= UI_DPI_ICON_SIZE;
+ if (iconid) rect->xmin+= UI_DPI_ICON_SIZE;
/* cut string in 2 parts? */
cpoin= strchr(name, '|');
- if(cpoin) {
+ if (cpoin) {
*cpoin= 0;
rect->xmax -= BLF_width(fstyle->uifont_id, cpoin+1) + 10;
}
@@ -3253,9 +3315,9 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
uiStyleFontDraw(fstyle, rect, name);
/* part text right aligned */
- if(cpoin) {
+ if (cpoin) {
fstyle->align= UI_STYLE_TEXT_RIGHT;
- rect->xmax= _rect.xmax - 5;
+ rect->xmax = _rect.xmax - 5;
uiStyleFontDraw(fstyle, rect, cpoin+1);
*cpoin= '|';
}
@@ -3263,7 +3325,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
/* restore rect, was messed with */
*rect= _rect;
- if(iconid) {
+ if (iconid) {
int xs= rect->xmin+4;
int ys= 1 + (rect->ymin+rect->ymax- UI_DPI_ICON_SIZE)/2;
glEnable(GL_BLEND);
@@ -3291,21 +3353,23 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int
trect.xmax = trect.xmin + font_dims[0] + 10;
trect.ymin += 10;
trect.ymax = trect.ymin + font_dims[1];
- if(trect.xmax > rect->xmax - PREVIEW_PAD)
+ if (trect.xmax > rect->xmax - PREVIEW_PAD)
trect.xmax = rect->xmax - PREVIEW_PAD;
bg_rect = trect;
bg_rect.xmin = rect->xmin + PREVIEW_PAD;
bg_rect.ymin = rect->ymin + PREVIEW_PAD;
- bg_rect.xmax += PREVIEW_PAD / 2;
+ bg_rect.xmax = rect->xmax - PREVIEW_PAD;
bg_rect.ymax += PREVIEW_PAD / 2;
- if(bg_rect.xmax > rect->xmax - PREVIEW_PAD)
+ if (bg_rect.xmax > rect->xmax - PREVIEW_PAD)
bg_rect.xmax = rect->xmax - PREVIEW_PAD;
UI_GetThemeColor3ubv(TH_BUTBACK, bg_col);
- glColor3ubv(bg_col);
+ glColor4ubv((unsigned char*)wt->wcol.item);
+ glEnable(GL_BLEND);
glRecti(bg_rect.xmin, bg_rect.ymin, bg_rect.xmax, bg_rect.ymax);
+ glDisable(GL_BLEND);
if (state == UI_ACTIVE)
glColor3ubv((unsigned char*)wt->wcol.text);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 3d609fd6b7a..1ab2320a052 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -43,6 +43,7 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLI_math.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
@@ -88,10 +89,10 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
const char *cp= error;
- if(btheme) {
+ if (btheme) {
// first check for ui buttons theme
- if(colorid < TH_THEMEUI) {
+ if (colorid < TH_THEMEUI) {
switch(colorid) {
@@ -160,41 +161,41 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
switch(colorid) {
case TH_BACK:
- if(theme_regionid==RGN_TYPE_WINDOW)
+ if (theme_regionid==RGN_TYPE_WINDOW)
cp= ts->back;
- else if(theme_regionid==RGN_TYPE_CHANNELS)
+ else if (theme_regionid==RGN_TYPE_CHANNELS)
cp= ts->list;
- else if(theme_regionid==RGN_TYPE_HEADER)
+ else if (theme_regionid==RGN_TYPE_HEADER)
cp= ts->header;
else
cp= ts->button;
break;
case TH_TEXT:
- if(theme_regionid==RGN_TYPE_WINDOW)
+ if (theme_regionid==RGN_TYPE_WINDOW)
cp= ts->text;
- else if(theme_regionid==RGN_TYPE_CHANNELS)
+ else if (theme_regionid==RGN_TYPE_CHANNELS)
cp= ts->list_text;
- else if(theme_regionid==RGN_TYPE_HEADER)
+ else if (theme_regionid==RGN_TYPE_HEADER)
cp= ts->header_text;
else
cp= ts->button_text;
break;
case TH_TEXT_HI:
- if(theme_regionid==RGN_TYPE_WINDOW)
+ if (theme_regionid==RGN_TYPE_WINDOW)
cp= ts->text_hi;
- else if(theme_regionid==RGN_TYPE_CHANNELS)
+ else if (theme_regionid==RGN_TYPE_CHANNELS)
cp= ts->list_text_hi;
- else if(theme_regionid==RGN_TYPE_HEADER)
+ else if (theme_regionid==RGN_TYPE_HEADER)
cp= ts->header_text_hi;
else
cp= ts->button_text_hi;
break;
case TH_TITLE:
- if(theme_regionid==RGN_TYPE_WINDOW)
+ if (theme_regionid==RGN_TYPE_WINDOW)
cp= ts->title;
- else if(theme_regionid==RGN_TYPE_CHANNELS)
+ else if (theme_regionid==RGN_TYPE_CHANNELS)
cp= ts->list_title;
- else if(theme_regionid==RGN_TYPE_HEADER)
+ else if (theme_regionid==RGN_TYPE_HEADER)
cp= ts->header_title;
else
cp= ts->button_title;
@@ -244,6 +245,10 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp= ts->lamp; break;
case TH_SPEAKER:
cp= ts->speaker; break;
+ case TH_CAMERA:
+ cp= ts->camera; break;
+ case TH_EMPTY:
+ cp= ts->empty; break;
case TH_SELECT:
cp= ts->select; break;
case TH_ACTIVE:
@@ -367,6 +372,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_SEQ_MOVIE:
cp= ts->movie; break;
+ case TH_SEQ_MOVIECLIP:
+ cp= ts->movieclip; break;
case TH_SEQ_IMAGE:
cp= ts->image; break;
case TH_SEQ_SCENE:
@@ -381,6 +388,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp= ts->transition; break;
case TH_SEQ_META:
cp= ts->meta; break;
+ case TH_SEQ_PREVIEW:
+ cp= ts->preview_back; break;
case TH_CONSOLE_OUTPUT:
cp= ts->console_output; break;
@@ -471,11 +480,6 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
return (unsigned char *)cp;
}
-
-#define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a;
-#define SETCOLF(col, r, g, b, a) col[0]=r*255; col[1]=g*255; col[2]= b*255; col[3]= a*255;
-#define SETCOLTEST(col, r, g, b, a) if(col[3]==0) {col[0]=r; col[1]=g; col[2]= b; col[3]= a;}
-
/* use this call to init new bone color sets in Theme */
static void ui_theme_init_boneColorSets(bTheme *btheme)
{
@@ -483,65 +487,65 @@ static void ui_theme_init_boneColorSets(bTheme *btheme)
/* define default color sets - currently we only define 15 of these, though that should be ample */
/* set 1 */
- SETCOL(btheme->tarm[0].solid, 0x9a, 0x00, 0x00, 255);
- SETCOL(btheme->tarm[0].select, 0xbd, 0x11, 0x11, 255);
- SETCOL(btheme->tarm[0].active, 0xf7, 0x0a, 0x0a, 255);
+ rgba_char_args_set(btheme->tarm[0].solid, 0x9a, 0x00, 0x00, 255);
+ rgba_char_args_set(btheme->tarm[0].select, 0xbd, 0x11, 0x11, 255);
+ rgba_char_args_set(btheme->tarm[0].active, 0xf7, 0x0a, 0x0a, 255);
/* set 2 */
- SETCOL(btheme->tarm[1].solid, 0xf7, 0x40, 0x18, 255);
- SETCOL(btheme->tarm[1].select, 0xf6, 0x69, 0x13, 255);
- SETCOL(btheme->tarm[1].active, 0xfa, 0x99, 0x00, 255);
+ rgba_char_args_set(btheme->tarm[1].solid, 0xf7, 0x40, 0x18, 255);
+ rgba_char_args_set(btheme->tarm[1].select, 0xf6, 0x69, 0x13, 255);
+ rgba_char_args_set(btheme->tarm[1].active, 0xfa, 0x99, 0x00, 255);
/* set 3 */
- SETCOL(btheme->tarm[2].solid, 0x1e, 0x91, 0x09, 255);
- SETCOL(btheme->tarm[2].select, 0x59, 0xb7, 0x0b, 255);
- SETCOL(btheme->tarm[2].active, 0x83, 0xef, 0x1d, 255);
+ rgba_char_args_set(btheme->tarm[2].solid, 0x1e, 0x91, 0x09, 255);
+ rgba_char_args_set(btheme->tarm[2].select, 0x59, 0xb7, 0x0b, 255);
+ rgba_char_args_set(btheme->tarm[2].active, 0x83, 0xef, 0x1d, 255);
/* set 4 */
- SETCOL(btheme->tarm[3].solid, 0x0a, 0x36, 0x94, 255);
- SETCOL(btheme->tarm[3].select, 0x36, 0x67, 0xdf, 255);
- SETCOL(btheme->tarm[3].active, 0x5e, 0xc1, 0xef, 255);
+ rgba_char_args_set(btheme->tarm[3].solid, 0x0a, 0x36, 0x94, 255);
+ rgba_char_args_set(btheme->tarm[3].select, 0x36, 0x67, 0xdf, 255);
+ rgba_char_args_set(btheme->tarm[3].active, 0x5e, 0xc1, 0xef, 255);
/* set 5 */
- SETCOL(btheme->tarm[4].solid, 0xa9, 0x29, 0x4e, 255);
- SETCOL(btheme->tarm[4].select, 0xc1, 0x41, 0x6a, 255);
- SETCOL(btheme->tarm[4].active, 0xf0, 0x5d, 0x91, 255);
+ rgba_char_args_set(btheme->tarm[4].solid, 0xa9, 0x29, 0x4e, 255);
+ rgba_char_args_set(btheme->tarm[4].select, 0xc1, 0x41, 0x6a, 255);
+ rgba_char_args_set(btheme->tarm[4].active, 0xf0, 0x5d, 0x91, 255);
/* set 6 */
- SETCOL(btheme->tarm[5].solid, 0x43, 0x0c, 0x78, 255);
- SETCOL(btheme->tarm[5].select, 0x54, 0x3a, 0xa3, 255);
- SETCOL(btheme->tarm[5].active, 0x87, 0x64, 0xd5, 255);
+ rgba_char_args_set(btheme->tarm[5].solid, 0x43, 0x0c, 0x78, 255);
+ rgba_char_args_set(btheme->tarm[5].select, 0x54, 0x3a, 0xa3, 255);
+ rgba_char_args_set(btheme->tarm[5].active, 0x87, 0x64, 0xd5, 255);
/* set 7 */
- SETCOL(btheme->tarm[6].solid, 0x24, 0x78, 0x5a, 255);
- SETCOL(btheme->tarm[6].select, 0x3c, 0x95, 0x79, 255);
- SETCOL(btheme->tarm[6].active, 0x6f, 0xb6, 0xab, 255);
+ rgba_char_args_set(btheme->tarm[6].solid, 0x24, 0x78, 0x5a, 255);
+ rgba_char_args_set(btheme->tarm[6].select, 0x3c, 0x95, 0x79, 255);
+ rgba_char_args_set(btheme->tarm[6].active, 0x6f, 0xb6, 0xab, 255);
/* set 8 */
- SETCOL(btheme->tarm[7].solid, 0x4b, 0x70, 0x7c, 255);
- SETCOL(btheme->tarm[7].select, 0x6a, 0x86, 0x91, 255);
- SETCOL(btheme->tarm[7].active, 0x9b, 0xc2, 0xcd, 255);
+ rgba_char_args_set(btheme->tarm[7].solid, 0x4b, 0x70, 0x7c, 255);
+ rgba_char_args_set(btheme->tarm[7].select, 0x6a, 0x86, 0x91, 255);
+ rgba_char_args_set(btheme->tarm[7].active, 0x9b, 0xc2, 0xcd, 255);
/* set 9 */
- SETCOL(btheme->tarm[8].solid, 0xf4, 0xc9, 0x0c, 255);
- SETCOL(btheme->tarm[8].select, 0xee, 0xc2, 0x36, 255);
- SETCOL(btheme->tarm[8].active, 0xf3, 0xff, 0x00, 255);
+ rgba_char_args_set(btheme->tarm[8].solid, 0xf4, 0xc9, 0x0c, 255);
+ rgba_char_args_set(btheme->tarm[8].select, 0xee, 0xc2, 0x36, 255);
+ rgba_char_args_set(btheme->tarm[8].active, 0xf3, 0xff, 0x00, 255);
/* set 10 */
- SETCOL(btheme->tarm[9].solid, 0x1e, 0x20, 0x24, 255);
- SETCOL(btheme->tarm[9].select, 0x48, 0x4c, 0x56, 255);
- SETCOL(btheme->tarm[9].active, 0xff, 0xff, 0xff, 255);
+ rgba_char_args_set(btheme->tarm[9].solid, 0x1e, 0x20, 0x24, 255);
+ rgba_char_args_set(btheme->tarm[9].select, 0x48, 0x4c, 0x56, 255);
+ rgba_char_args_set(btheme->tarm[9].active, 0xff, 0xff, 0xff, 255);
/* set 11 */
- SETCOL(btheme->tarm[10].solid, 0x6f, 0x2f, 0x6a, 255);
- SETCOL(btheme->tarm[10].select, 0x98, 0x45, 0xbe, 255);
- SETCOL(btheme->tarm[10].active, 0xd3, 0x30, 0xd6, 255);
+ rgba_char_args_set(btheme->tarm[10].solid, 0x6f, 0x2f, 0x6a, 255);
+ rgba_char_args_set(btheme->tarm[10].select, 0x98, 0x45, 0xbe, 255);
+ rgba_char_args_set(btheme->tarm[10].active, 0xd3, 0x30, 0xd6, 255);
/* set 12 */
- SETCOL(btheme->tarm[11].solid, 0x6c, 0x8e, 0x22, 255);
- SETCOL(btheme->tarm[11].select, 0x7f, 0xb0, 0x22, 255);
- SETCOL(btheme->tarm[11].active, 0xbb, 0xef, 0x5b, 255);
+ rgba_char_args_set(btheme->tarm[11].solid, 0x6c, 0x8e, 0x22, 255);
+ rgba_char_args_set(btheme->tarm[11].select, 0x7f, 0xb0, 0x22, 255);
+ rgba_char_args_set(btheme->tarm[11].active, 0xbb, 0xef, 0x5b, 255);
/* set 13 */
- SETCOL(btheme->tarm[12].solid, 0x8d, 0x8d, 0x8d, 255);
- SETCOL(btheme->tarm[12].select, 0xb0, 0xb0, 0xb0, 255);
- SETCOL(btheme->tarm[12].active, 0xde, 0xde, 0xde, 255);
+ rgba_char_args_set(btheme->tarm[12].solid, 0x8d, 0x8d, 0x8d, 255);
+ rgba_char_args_set(btheme->tarm[12].select, 0xb0, 0xb0, 0xb0, 255);
+ rgba_char_args_set(btheme->tarm[12].active, 0xde, 0xde, 0xde, 255);
/* set 14 */
- SETCOL(btheme->tarm[13].solid, 0x83, 0x43, 0x26, 255);
- SETCOL(btheme->tarm[13].select, 0x8b, 0x58, 0x11, 255);
- SETCOL(btheme->tarm[13].active, 0xbd, 0x6a, 0x11, 255);
+ rgba_char_args_set(btheme->tarm[13].solid, 0x83, 0x43, 0x26, 255);
+ rgba_char_args_set(btheme->tarm[13].select, 0x8b, 0x58, 0x11, 255);
+ rgba_char_args_set(btheme->tarm[13].active, 0xbd, 0x6a, 0x11, 255);
/* set 15 */
- SETCOL(btheme->tarm[14].solid, 0x08, 0x31, 0x0e, 255);
- SETCOL(btheme->tarm[14].select, 0x1c, 0x43, 0x0b, 255);
- SETCOL(btheme->tarm[14].active, 0x34, 0x62, 0x2b, 255);
+ rgba_char_args_set(btheme->tarm[14].solid, 0x08, 0x31, 0x0e, 255);
+ rgba_char_args_set(btheme->tarm[14].select, 0x1c, 0x43, 0x0b, 255);
+ rgba_char_args_set(btheme->tarm[14].active, 0x34, 0x62, 0x2b, 255);
/* reset flags too */
for (i = 0; i < 20; i++)
@@ -551,23 +555,23 @@ static void ui_theme_init_boneColorSets(bTheme *btheme)
/* use this call to init new variables in themespace, if they're same for all */
static void ui_theme_init_new_do(ThemeSpace *ts)
{
- SETCOLTEST(ts->header_text, 0, 0, 0, 255);
- SETCOLTEST(ts->header_title, 0, 0, 0, 255);
- SETCOLTEST(ts->header_text_hi, 255, 255, 255, 255);
+ rgba_char_args_test_set(ts->header_text, 0, 0, 0, 255);
+ rgba_char_args_test_set(ts->header_title, 0, 0, 0, 255);
+ rgba_char_args_test_set(ts->header_text_hi, 255, 255, 255, 255);
- SETCOLTEST(ts->panel_text, 0, 0, 0, 255);
- SETCOLTEST(ts->panel_title, 0, 0, 0, 255);
- SETCOLTEST(ts->panel_text_hi, 255, 255, 255, 255);
+ rgba_char_args_test_set(ts->panel_text, 0, 0, 0, 255);
+ rgba_char_args_test_set(ts->panel_title, 0, 0, 0, 255);
+ rgba_char_args_test_set(ts->panel_text_hi, 255, 255, 255, 255);
- SETCOLTEST(ts->button, 145, 145, 145, 245);
- SETCOLTEST(ts->button_title, 0, 0, 0, 255);
- SETCOLTEST(ts->button_text, 0, 0, 0, 255);
- SETCOLTEST(ts->button_text_hi, 255, 255, 255, 255);
+ rgba_char_args_test_set(ts->button, 145, 145, 145, 245);
+ rgba_char_args_test_set(ts->button_title, 0, 0, 0, 255);
+ rgba_char_args_test_set(ts->button_text, 0, 0, 0, 255);
+ rgba_char_args_test_set(ts->button_text_hi, 255, 255, 255, 255);
- SETCOLTEST(ts->list, 165, 165, 165, 255);
- SETCOLTEST(ts->list_title, 0, 0, 0, 255);
- SETCOLTEST(ts->list_text, 0, 0, 0, 255);
- SETCOLTEST(ts->list_text_hi, 255, 255, 255, 255);
+ rgba_char_args_test_set(ts->list, 165, 165, 165, 255);
+ rgba_char_args_test_set(ts->list_title, 0, 0, 0, 255);
+ rgba_char_args_test_set(ts->list_text, 0, 0, 0, 255);
+ rgba_char_args_test_set(ts->list_text_hi, 255, 255, 255, 255);
}
static void ui_theme_init_new(bTheme *btheme)
@@ -602,11 +606,11 @@ void ui_theme_init_default(void)
bTheme *btheme;
/* we search for the theme with name Default */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
- if(strcmp("Default", btheme->name)==0) break;
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ if (strcmp("Default", btheme->name)==0) break;
}
- if(btheme==NULL) {
+ if (btheme==NULL) {
btheme= MEM_callocN(sizeof(bTheme), "theme");
BLI_addtail(&U.themes, btheme);
strcpy(btheme->name, "Default");
@@ -618,7 +622,7 @@ void ui_theme_init_default(void)
ui_widget_color_init(&btheme->tui);
btheme->tui.iconfile[0]= 0;
btheme->tui.panel.show_header = FALSE;
- SETCOL(btheme->tui.panel.header, 0, 0, 0, 25);
+ rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25);
/* Bone Color Sets */
ui_theme_init_boneColorSets(btheme);
@@ -627,117 +631,119 @@ void ui_theme_init_default(void)
ui_theme_init_new(btheme);
/* space view3d */
- SETCOLF(btheme->tv3d.back, 0.225, 0.225, 0.225, 1.0);
- SETCOL(btheme->tv3d.text, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.text_hi, 255, 255, 255, 255);
+ rgba_char_args_set_fl(btheme->tv3d.back, 0.225, 0.225, 0.225, 1.0);
+ rgba_char_args_set(btheme->tv3d.text, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.text_hi, 255, 255, 255, 255);
- SETCOLF(btheme->tv3d.header, 0.45, 0.45, 0.45, 1.0);
- SETCOLF(btheme->tv3d.button, 0.45, 0.45, 0.45, 1.0);
- SETCOL(btheme->tv3d.panel, 165, 165, 165, 127);
+ rgba_char_args_set_fl(btheme->tv3d.header, 0.45, 0.45, 0.45, 1.0);
+ rgba_char_args_set_fl(btheme->tv3d.button, 0.45, 0.45, 0.45, 1.0);
+ rgba_char_args_set(btheme->tv3d.panel, 165, 165, 165, 127);
- SETCOL(btheme->tv3d.shade1, 160, 160, 160, 100);
- SETCOL(btheme->tv3d.shade2, 0x7f, 0x70, 0x70, 100);
-
- SETCOLF(btheme->tv3d.grid, 0.251, 0.251, 0.251, 1.0);
- SETCOL(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255);
- SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40);
- SETCOL(btheme->tv3d.speaker, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.select, 241, 88, 0, 255);
- SETCOL(btheme->tv3d.active, 255, 170, 64, 255);
- SETCOL(btheme->tv3d.group, 8, 48, 8, 255);
- SETCOL(btheme->tv3d.group_active, 85, 187, 85, 255);
- SETCOL(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255);
- SETCOL(btheme->tv3d.vertex, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.vertex_select, 255, 133, 0, 255);
+ rgba_char_args_set(btheme->tv3d.shade1, 160, 160, 160, 100);
+ rgba_char_args_set(btheme->tv3d.shade2, 0x7f, 0x70, 0x70, 100);
+
+ rgba_char_args_set_fl(btheme->tv3d.grid, 0.251, 0.251, 0.251, 1.0);
+ rgba_char_args_set(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255);
+ rgba_char_args_set(btheme->tv3d.lamp, 0, 0, 0, 40);
+ rgba_char_args_set(btheme->tv3d.speaker, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.camera, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.empty, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.select, 241, 88, 0, 255);
+ rgba_char_args_set(btheme->tv3d.active, 255, 170, 64, 255);
+ rgba_char_args_set(btheme->tv3d.group, 8, 48, 8, 255);
+ rgba_char_args_set(btheme->tv3d.group_active, 85, 187, 85, 255);
+ rgba_char_args_set(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255);
+ rgba_char_args_set(btheme->tv3d.vertex, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.vertex_select, 255, 133, 0, 255);
btheme->tv3d.vertex_size= 3;
btheme->tv3d.outline_width= 1;
- SETCOL(btheme->tv3d.edge, 0x0, 0x0, 0x0, 255);
- SETCOL(btheme->tv3d.edge_select, 255, 160, 0, 255);
- SETCOL(btheme->tv3d.edge_seam, 219, 37, 18, 255);
- SETCOL(btheme->tv3d.edge_facesel, 75, 75, 75, 255);
- SETCOL(btheme->tv3d.face, 0, 0, 0, 18);
- SETCOL(btheme->tv3d.face_select, 255, 133, 0, 60);
- SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
- SETCOL(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
- SETCOL(btheme->tv3d.face_dot, 255, 133, 0, 255);
- SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
- SETCOLF(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
- SETCOL(btheme->tv3d.edge_sharp, 0, 255, 255, 255);
- SETCOL(btheme->tv3d.header_text, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.header_text_hi, 255, 255, 255, 255);
- SETCOL(btheme->tv3d.button_text, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.button_text_hi, 255, 255, 255, 255);
- SETCOL(btheme->tv3d.button_title, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.title, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.freestyle_edge_mark, 0x7f, 0xff, 0x7f, 255);
- SETCOL(btheme->tv3d.freestyle_face_mark, 0x7f, 0xff, 0x7f, 51);
+ rgba_char_args_set(btheme->tv3d.edge, 0x0, 0x0, 0x0, 255);
+ rgba_char_args_set(btheme->tv3d.edge_select, 255, 160, 0, 255);
+ rgba_char_args_set(btheme->tv3d.edge_seam, 219, 37, 18, 255);
+ rgba_char_args_set(btheme->tv3d.edge_facesel, 75, 75, 75, 255);
+ rgba_char_args_set(btheme->tv3d.face, 0, 0, 0, 18);
+ rgba_char_args_set(btheme->tv3d.face_select, 255, 133, 0, 60);
+ rgba_char_args_set(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
+ rgba_char_args_set(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
+ rgba_char_args_set(btheme->tv3d.face_dot, 255, 133, 0, 255);
+ rgba_char_args_set(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
+ rgba_char_args_set_fl(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
+ rgba_char_args_set(btheme->tv3d.edge_sharp, 0, 255, 255, 255);
+ rgba_char_args_set(btheme->tv3d.header_text, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.header_text_hi, 255, 255, 255, 255);
+ rgba_char_args_set(btheme->tv3d.button_text, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.button_text_hi, 255, 255, 255, 255);
+ rgba_char_args_set(btheme->tv3d.button_title, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.title, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.freestyle_edge_mark, 0x7f, 0xff, 0x7f, 255);
+ rgba_char_args_set(btheme->tv3d.freestyle_face_mark, 0x7f, 0xff, 0x7f, 51);
btheme->tv3d.facedot_size= 4;
- SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
- SETCOL(btheme->tv3d.extra_face_area, 0, 32, 0, 255);
- SETCOL(btheme->tv3d.extra_face_angle, 0, 0, 128, 255);
+ rgba_char_args_set(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.extra_face_area, 0, 32, 0, 255);
+ rgba_char_args_set(btheme->tv3d.extra_face_angle, 0, 0, 128, 255);
- SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
+ rgba_char_args_set(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
- SETCOL(btheme->tv3d.nurb_uline, 0x90, 0x90, 0x00, 255);
- SETCOL(btheme->tv3d.nurb_vline, 0x80, 0x30, 0x60, 255);
- SETCOL(btheme->tv3d.nurb_sel_uline, 0xf0, 0xff, 0x40, 255);
- SETCOL(btheme->tv3d.nurb_sel_vline, 0xf0, 0x90, 0xa0, 255);
+ rgba_char_args_set(btheme->tv3d.nurb_uline, 0x90, 0x90, 0x00, 255);
+ rgba_char_args_set(btheme->tv3d.nurb_vline, 0x80, 0x30, 0x60, 255);
+ rgba_char_args_set(btheme->tv3d.nurb_sel_uline, 0xf0, 0xff, 0x40, 255);
+ rgba_char_args_set(btheme->tv3d.nurb_sel_vline, 0xf0, 0x90, 0xa0, 255);
- SETCOL(btheme->tv3d.handle_free, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
- SETCOL(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
- SETCOL(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
- SETCOL(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
- SETCOL(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
- SETCOL(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
+ rgba_char_args_set(btheme->tv3d.handle_free, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
+ rgba_char_args_set(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
+ rgba_char_args_set(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
+ rgba_char_args_set(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
+ rgba_char_args_set(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
+ rgba_char_args_set(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
- SETCOL(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
- SETCOL(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
+ rgba_char_args_set(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
+ rgba_char_args_set(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
- SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255);
- SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80); // alpha 80 is not meant editable, used for wire+action draw
+ rgba_char_args_set(btheme->tv3d.bone_solid, 200, 200, 200, 255);
+ rgba_char_args_set(btheme->tv3d.bone_pose, 80, 200, 255, 80); // alpha 80 is not meant editable, used for wire+action draw
- SETCOL(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
- SETCOL(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
+ rgba_char_args_set(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
+ rgba_char_args_set(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
/* space buttons */
/* to have something initialized */
btheme->tbuts= btheme->tv3d;
- SETCOLF(btheme->tbuts.back, 0.45, 0.45, 0.45, 1.0);
- SETCOL(btheme->tbuts.panel, 0x82, 0x82, 0x82, 255);
+ rgba_char_args_set_fl(btheme->tbuts.back, 0.45, 0.45, 0.45, 1.0);
+ rgba_char_args_set(btheme->tbuts.panel, 0x82, 0x82, 0x82, 255);
/* graph editor */
btheme->tipo= btheme->tv3d;
- SETCOLF(btheme->tipo.back, 0.42, 0.42, 0.42, 1.0);
- SETCOLF(btheme->tipo.list, 0.4, 0.4, 0.4, 1.0);
- SETCOL(btheme->tipo.grid, 94, 94, 94, 255);
- SETCOL(btheme->tipo.panel, 255, 255, 255, 150);
- SETCOL(btheme->tipo.shade1, 150, 150, 150, 100); /* scrollbars */
- SETCOL(btheme->tipo.shade2, 0x70, 0x70, 0x70, 100);
- SETCOL(btheme->tipo.vertex, 0, 0, 0, 255);
- SETCOL(btheme->tipo.vertex_select, 255, 133, 0, 255);
- SETCOL(btheme->tipo.hilite, 0x60, 0xc0, 0x40, 255);
+ rgba_char_args_set_fl(btheme->tipo.back, 0.42, 0.42, 0.42, 1.0);
+ rgba_char_args_set_fl(btheme->tipo.list, 0.4, 0.4, 0.4, 1.0);
+ rgba_char_args_set(btheme->tipo.grid, 94, 94, 94, 255);
+ rgba_char_args_set(btheme->tipo.panel, 255, 255, 255, 150);
+ rgba_char_args_set(btheme->tipo.shade1, 150, 150, 150, 100); /* scrollbars */
+ rgba_char_args_set(btheme->tipo.shade2, 0x70, 0x70, 0x70, 100);
+ rgba_char_args_set(btheme->tipo.vertex, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tipo.vertex_select, 255, 133, 0, 255);
+ rgba_char_args_set(btheme->tipo.hilite, 0x60, 0xc0, 0x40, 255);
btheme->tipo.vertex_size= 3;
- SETCOL(btheme->tipo.handle_vertex, 0, 0, 0, 255);
- SETCOL(btheme->tipo.handle_vertex_select, 255, 133, 0, 255);
- SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
- SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
+ rgba_char_args_set(btheme->tipo.handle_vertex, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tipo.handle_vertex_select, 255, 133, 0, 255);
+ rgba_char_args_set(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
+ rgba_char_args_set(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
btheme->tipo.handle_vertex_size= 4;
- SETCOL(btheme->tipo.ds_channel, 82, 96, 110, 255);
- SETCOL(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
- SETCOL(btheme->tipo.group, 79, 101, 73, 255);
- SETCOL(btheme->tipo.group_active, 135, 177, 125, 255);
+ rgba_char_args_set(btheme->tipo.ds_channel, 82, 96, 110, 255);
+ rgba_char_args_set(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
+ rgba_char_args_set(btheme->tipo.group, 79, 101, 73, 255);
+ rgba_char_args_set(btheme->tipo.group_active, 135, 177, 125, 255);
/* dopesheet */
btheme->tact= btheme->tipo;
- SETCOL(btheme->tact.strip, 12, 10, 10, 128);
- SETCOL(btheme->tact.strip_select, 255, 140, 0, 255);
+ rgba_char_args_set(btheme->tact.strip, 12, 10, 10, 128);
+ rgba_char_args_set(btheme->tact.strip_select, 255, 140, 0, 255);
/* space nla */
btheme->tnla= btheme->tact;
@@ -745,131 +751,132 @@ void ui_theme_init_default(void)
/* space file */
/* to have something initialized */
btheme->tfile= btheme->tv3d;
- SETCOLF(btheme->tfile.back, 0.3, 0.3, 0.3, 1);
- SETCOLF(btheme->tfile.panel, 0.3, 0.3, 0.3, 1);
- SETCOLF(btheme->tfile.list, 0.4, 0.4, 0.4, 1);
- SETCOL(btheme->tfile.text, 250, 250, 250, 255);
- SETCOL(btheme->tfile.text_hi, 15, 15, 15, 255);
- SETCOL(btheme->tfile.panel, 145, 145, 145, 255); // bookmark/ui regions
- SETCOL(btheme->tfile.active, 130, 130, 130, 255); // selected files
- SETCOL(btheme->tfile.hilite, 255, 140, 25, 255); // selected files
+ rgba_char_args_set_fl(btheme->tfile.back, 0.3, 0.3, 0.3, 1);
+ rgba_char_args_set_fl(btheme->tfile.panel, 0.3, 0.3, 0.3, 1);
+ rgba_char_args_set_fl(btheme->tfile.list, 0.4, 0.4, 0.4, 1);
+ rgba_char_args_set(btheme->tfile.text, 250, 250, 250, 255);
+ rgba_char_args_set(btheme->tfile.text_hi, 15, 15, 15, 255);
+ rgba_char_args_set(btheme->tfile.panel, 145, 145, 145, 255); // bookmark/ui regions
+ rgba_char_args_set(btheme->tfile.active, 130, 130, 130, 255); // selected files
+ rgba_char_args_set(btheme->tfile.hilite, 255, 140, 25, 255); // selected files
- SETCOL(btheme->tfile.grid, 250, 250, 250, 255);
- SETCOL(btheme->tfile.image, 250, 250, 250, 255);
- SETCOL(btheme->tfile.movie, 250, 250, 250, 255);
- SETCOL(btheme->tfile.scene, 250, 250, 250, 255);
+ rgba_char_args_set(btheme->tfile.grid, 250, 250, 250, 255);
+ rgba_char_args_set(btheme->tfile.image, 250, 250, 250, 255);
+ rgba_char_args_set(btheme->tfile.movie, 250, 250, 250, 255);
+ rgba_char_args_set(btheme->tfile.scene, 250, 250, 250, 255);
/* space seq */
btheme->tseq= btheme->tv3d;
- SETCOL(btheme->tseq.back, 116, 116, 116, 255);
- SETCOL(btheme->tseq.movie, 81, 105, 135, 255);
- SETCOL(btheme->tseq.image, 109, 88, 129, 255);
- SETCOL(btheme->tseq.scene, 78, 152, 62, 255);
- SETCOL(btheme->tseq.audio, 46, 143, 143, 255);
- SETCOL(btheme->tseq.effect, 169, 84, 124, 255);
- SETCOL(btheme->tseq.plugin, 126, 126, 80, 255);
- SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
- SETCOL(btheme->tseq.meta, 109, 145, 131, 255);
-
+ rgba_char_args_set(btheme->tseq.back, 116, 116, 116, 255);
+ rgba_char_args_set(btheme->tseq.movie, 81, 105, 135, 255);
+ rgba_char_args_set(btheme->tseq.movieclip, 32, 32, 143, 255);
+ rgba_char_args_set(btheme->tseq.image, 109, 88, 129, 255);
+ rgba_char_args_set(btheme->tseq.scene, 78, 152, 62, 255);
+ rgba_char_args_set(btheme->tseq.audio, 46, 143, 143, 255);
+ rgba_char_args_set(btheme->tseq.effect, 169, 84, 124, 255);
+ rgba_char_args_set(btheme->tseq.plugin, 126, 126, 80, 255);
+ rgba_char_args_set(btheme->tseq.transition, 162, 95, 111, 255);
+ rgba_char_args_set(btheme->tseq.meta, 109, 145, 131, 255);
+ rgba_char_args_set(btheme->tseq.preview_back, 0, 0, 0, 255);
/* space image */
btheme->tima= btheme->tv3d;
- SETCOL(btheme->tima.back, 53, 53, 53, 255);
- SETCOL(btheme->tima.vertex, 0, 0, 0, 255);
- SETCOL(btheme->tima.vertex_select, 255, 133, 0, 255);
+ rgba_char_args_set(btheme->tima.back, 53, 53, 53, 255);
+ rgba_char_args_set(btheme->tima.vertex, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tima.vertex_select, 255, 133, 0, 255);
btheme->tima.vertex_size= 3;
btheme->tima.facedot_size= 3;
- SETCOL(btheme->tima.face, 255, 255, 255, 10);
- SETCOL(btheme->tima.face_select, 255, 133, 0, 60);
- SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
- SETCOLF(btheme->tima.preview_back, 0.45, 0.45, 0.45, 1.0);
- SETCOLF(btheme->tima.preview_stitch_face, 0.5, 0.5, 0.0, 0.2);
- SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 0.0, 1.0, 0.2);
- SETCOLF(btheme->tima.preview_stitch_vert, 0.0, 0.0, 1.0, 0.2);
- SETCOLF(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
- SETCOLF(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
+ rgba_char_args_set(btheme->tima.face, 255, 255, 255, 10);
+ rgba_char_args_set(btheme->tima.face_select, 255, 133, 0, 60);
+ rgba_char_args_set(btheme->tima.editmesh_active, 255, 255, 255, 128);
+ rgba_char_args_set_fl(btheme->tima.preview_back, 0.45, 0.45, 0.45, 1.0);
+ rgba_char_args_set_fl(btheme->tima.preview_stitch_face, 0.5, 0.5, 0.0, 0.2);
+ rgba_char_args_set_fl(btheme->tima.preview_stitch_edge, 1.0, 0.0, 1.0, 0.2);
+ rgba_char_args_set_fl(btheme->tima.preview_stitch_vert, 0.0, 0.0, 1.0, 0.2);
+ rgba_char_args_set_fl(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
+ rgba_char_args_set_fl(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
/* space text */
btheme->text= btheme->tv3d;
- SETCOL(btheme->text.back, 153, 153, 153, 255);
- SETCOL(btheme->text.shade1, 143, 143, 143, 255);
- SETCOL(btheme->text.shade2, 0xc6, 0x77, 0x77, 255);
- SETCOL(btheme->text.hilite, 255, 0, 0, 255);
+ rgba_char_args_set(btheme->text.back, 153, 153, 153, 255);
+ rgba_char_args_set(btheme->text.shade1, 143, 143, 143, 255);
+ rgba_char_args_set(btheme->text.shade2, 0xc6, 0x77, 0x77, 255);
+ rgba_char_args_set(btheme->text.hilite, 255, 0, 0, 255);
/* syntax highlighting */
- SETCOL(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
- SETCOL(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
- SETCOL(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
- SETCOL(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */
- SETCOL(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */
+ rgba_char_args_set(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
+ rgba_char_args_set(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
+ rgba_char_args_set(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
+ rgba_char_args_set(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */
+ rgba_char_args_set(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */
/* space oops */
btheme->toops= btheme->tv3d;
- SETCOLF(btheme->toops.back, 0.45, 0.45, 0.45, 1.0);
+ rgba_char_args_set_fl(btheme->toops.back, 0.45, 0.45, 0.45, 1.0);
- SETCOLF(btheme->toops.match, 0.2, 0.5, 0.2, 0.3); /* highlighting search match - soft green*/
- SETCOLF(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
+ rgba_char_args_set_fl(btheme->toops.match, 0.2, 0.5, 0.2, 0.3); /* highlighting search match - soft green*/
+ rgba_char_args_set_fl(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
/* space info */
btheme->tinfo= btheme->tv3d;
- SETCOLF(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
+ rgba_char_args_set_fl(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
/* space user preferences */
btheme->tuserpref= btheme->tv3d;
- SETCOLF(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
+ rgba_char_args_set_fl(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
/* space console */
btheme->tconsole= btheme->tv3d;
- SETCOL(btheme->tconsole.back, 0, 0, 0, 255);
- SETCOL(btheme->tconsole.console_output, 96, 128, 255, 255);
- SETCOL(btheme->tconsole.console_input, 255, 255, 255, 255);
- SETCOL(btheme->tconsole.console_info, 0, 170, 0, 255);
- SETCOL(btheme->tconsole.console_error, 220, 96, 96, 255);
- SETCOL(btheme->tconsole.console_cursor, 220, 96, 96, 255);
+ rgba_char_args_set(btheme->tconsole.back, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tconsole.console_output, 96, 128, 255, 255);
+ rgba_char_args_set(btheme->tconsole.console_input, 255, 255, 255, 255);
+ rgba_char_args_set(btheme->tconsole.console_info, 0, 170, 0, 255);
+ rgba_char_args_set(btheme->tconsole.console_error, 220, 96, 96, 255);
+ rgba_char_args_set(btheme->tconsole.console_cursor, 220, 96, 96, 255);
/* space time */
btheme->ttime= btheme->tv3d;
- SETCOLF(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
- SETCOLF(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
- SETCOL(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
+ rgba_char_args_set_fl(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
+ rgba_char_args_set_fl(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
+ rgba_char_args_set(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
/* space node, re-uses syntax color storage */
btheme->tnode= btheme->tv3d;
- SETCOL(btheme->tnode.edge_select, 255, 255, 255, 255);
- SETCOL(btheme->tnode.syntaxl, 155, 155, 155, 160); /* TH_NODE, backdrop */
- SETCOL(btheme->tnode.syntaxn, 100, 100, 100, 255); /* in/output */
- SETCOL(btheme->tnode.syntaxb, 108, 105, 111, 255); /* operator */
- SETCOL(btheme->tnode.syntaxv, 104, 106, 117, 255); /* generator */
- SETCOL(btheme->tnode.syntaxc, 105, 117, 110, 255); /* group */
+ rgba_char_args_set(btheme->tnode.edge_select, 255, 255, 255, 255);
+ rgba_char_args_set(btheme->tnode.syntaxl, 155, 155, 155, 160); /* TH_NODE, backdrop */
+ rgba_char_args_set(btheme->tnode.syntaxn, 100, 100, 100, 255); /* in/output */
+ rgba_char_args_set(btheme->tnode.syntaxb, 108, 105, 111, 255); /* operator */
+ rgba_char_args_set(btheme->tnode.syntaxv, 104, 106, 117, 255); /* generator */
+ rgba_char_args_set(btheme->tnode.syntaxc, 105, 117, 110, 255); /* group */
btheme->tnode.noodle_curving = 5;
/* space logic */
btheme->tlogic= btheme->tv3d;
- SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
+ rgba_char_args_set(btheme->tlogic.back, 100, 100, 100, 255);
/* space clip */
btheme->tclip= btheme->tv3d;
- SETCOL(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
- SETCOL(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
- SETCOL(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
- SETCOL(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
- SETCOL(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
- SETCOL(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
- SETCOL(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
- SETCOL(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
- SETCOL(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
- SETCOL(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
- SETCOL(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
- SETCOL(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
+ rgba_char_args_set(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
+ rgba_char_args_set(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
+ rgba_char_args_set(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
+ rgba_char_args_set(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
+ rgba_char_args_set(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
+ rgba_char_args_set(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
+ rgba_char_args_set(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
btheme->tclip.handle_vertex_size= 4;
}
void UI_SetTheme(int spacetype, int regionid)
{
- if(spacetype==0) { // called for safety, when delete themes
+ if (spacetype==0) { // called for safety, when delete themes
theme_active= U.themes.first;
theme_spacetype= SPACE_VIEW3D;
theme_regionid= RGN_TYPE_WINDOW;
@@ -1181,16 +1188,16 @@ void init_userdef_do_versions(void)
// countall();
/* the UserDef struct is not corrected with do_versions() .... ugh! */
- if(U.wheellinescroll == 0) U.wheellinescroll = 3;
- if(U.menuthreshold1==0) {
+ if (U.wheellinescroll == 0) U.wheellinescroll = 3;
+ if (U.menuthreshold1==0) {
U.menuthreshold1= 5;
U.menuthreshold2= 2;
}
- if(U.tb_leftmouse==0) {
+ if (U.tb_leftmouse==0) {
U.tb_leftmouse= 5;
U.tb_rightmouse= 5;
}
- if(U.mixbufsize==0) U.mixbufsize= 2048;
+ if (U.mixbufsize==0) U.mixbufsize= 2048;
if (strcmp(U.tempdir, "/") == 0) {
BLI_system_temporary_dir(U.tempdir);
}
@@ -1203,14 +1210,18 @@ void init_userdef_do_versions(void)
// XXX error(STRINGIFY(BLENDER_STARTUP_FILE)" is buggy, please consider removing it.\n");
}
/* transform widget settings */
- if(U.tw_hotspot==0) {
+ if (U.tw_hotspot==0) {
U.tw_hotspot= 14;
U.tw_size= 20; // percentage of window size
U.tw_handlesize= 16; // percentage of widget radius
}
- if(U.pad_rot_angle==0)
+ if (U.pad_rot_angle==0)
U.pad_rot_angle= 15;
-
+ /* graph editor - unselected F-Curve visibility */
+ if (U.fcu_inactive_alpha == 0) {
+ U.fcu_inactive_alpha = 0.25f;
+ }
+
/* signal for derivedmesh to use colorband */
/* run in case this was on and is now off in the user prefs [#28096] */
vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL);
@@ -1232,19 +1243,19 @@ void init_userdef_do_versions(void)
U.uiflag |= USER_GLOBALUNDO;
if (U.undosteps==0) U.undosteps=32;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* check for alpha==0 is safe, then color was never set */
- if(btheme->tv3d.edge_seam[3]==0) {
- SETCOL(btheme->tv3d.edge_seam, 230, 150, 50, 255);
+ if (btheme->tv3d.edge_seam[3]==0) {
+ rgba_char_args_set(btheme->tv3d.edge_seam, 230, 150, 50, 255);
}
- if(btheme->tv3d.normal[3]==0) {
- SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
+ if (btheme->tv3d.normal[3]==0) {
+ rgba_char_args_set(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
}
- if(btheme->tv3d.vertex_normal[3]==0) {
- SETCOL(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
+ if (btheme->tv3d.vertex_normal[3]==0) {
+ rgba_char_args_set(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
}
- if(btheme->tv3d.face_dot[3]==0) {
- SETCOL(btheme->tv3d.face_dot, 255, 138, 48, 255);
+ if (btheme->tv3d.face_dot[3]==0) {
+ rgba_char_args_set(btheme->tv3d.face_dot, 255, 138, 48, 255);
btheme->tv3d.facedot_size= 4;
}
}
@@ -1257,89 +1268,89 @@ void init_userdef_do_versions(void)
if (bmain->versionfile <= 236) {
bTheme *btheme;
/* new space type */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* check for alpha==0 is safe, then color was never set */
- if(btheme->ttime.back[3]==0) {
+ if (btheme->ttime.back[3]==0) {
// copied from ui_theme_init_default
btheme->ttime= btheme->tv3d;
- SETCOLF(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
- SETCOLF(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
- SETCOL(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
+ rgba_char_args_set_fl(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
+ rgba_char_args_set_fl(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
+ rgba_char_args_set(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
}
- if(btheme->text.syntaxn[3]==0) {
- SETCOL(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
- SETCOL(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
- SETCOL(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
- SETCOL(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */
- SETCOL(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */
+ if (btheme->text.syntaxn[3]==0) {
+ rgba_char_args_set(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
+ rgba_char_args_set(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
+ rgba_char_args_set(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
+ rgba_char_args_set(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */
+ rgba_char_args_set(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */
}
}
}
if (bmain->versionfile <= 237) {
bTheme *btheme;
/* bone colors */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* check for alpha==0 is safe, then color was never set */
- if(btheme->tv3d.bone_solid[3]==0) {
- SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255);
- SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80);
+ if (btheme->tv3d.bone_solid[3]==0) {
+ rgba_char_args_set(btheme->tv3d.bone_solid, 200, 200, 200, 255);
+ rgba_char_args_set(btheme->tv3d.bone_pose, 80, 200, 255, 80);
}
}
}
if (bmain->versionfile <= 238) {
bTheme *btheme;
/* bone colors */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* check for alpha==0 is safe, then color was never set */
- if(btheme->tnla.strip[3]==0) {
- SETCOL(btheme->tnla.strip_select, 0xff, 0xff, 0xaa, 255);
- SETCOL(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
+ if (btheme->tnla.strip[3]==0) {
+ rgba_char_args_set(btheme->tnla.strip_select, 0xff, 0xff, 0xaa, 255);
+ rgba_char_args_set(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
}
}
}
if (bmain->versionfile <= 239) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* Lamp theme, check for alpha==0 is safe, then color was never set */
- if(btheme->tv3d.lamp[3]==0) {
- SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40);
+ if (btheme->tv3d.lamp[3]==0) {
+ rgba_char_args_set(btheme->tv3d.lamp, 0, 0, 0, 40);
/* TEMPORAL, remove me! (ton) */
U.uiflag |= USER_PLAINMENUS;
}
}
- if(U.obcenter_dia==0) U.obcenter_dia= 6;
+ if (U.obcenter_dia==0) U.obcenter_dia= 6;
}
if (bmain->versionfile <= 241) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* Node editor theme, check for alpha==0 is safe, then color was never set */
- if(btheme->tnode.syntaxn[3]==0) {
+ if (btheme->tnode.syntaxn[3]==0) {
/* re-uses syntax color storage */
btheme->tnode= btheme->tv3d;
- SETCOL(btheme->tnode.edge_select, 255, 255, 255, 255);
- SETCOL(btheme->tnode.syntaxl, 150, 150, 150, 255); /* TH_NODE, backdrop */
- SETCOL(btheme->tnode.syntaxn, 129, 131, 144, 255); /* in/output */
- SETCOL(btheme->tnode.syntaxb, 127,127,127, 255); /* operator */
- SETCOL(btheme->tnode.syntaxv, 142, 138, 145, 255); /* generator */
- SETCOL(btheme->tnode.syntaxc, 120, 145, 120, 255); /* group */
+ rgba_char_args_set(btheme->tnode.edge_select, 255, 255, 255, 255);
+ rgba_char_args_set(btheme->tnode.syntaxl, 150, 150, 150, 255); /* TH_NODE, backdrop */
+ rgba_char_args_set(btheme->tnode.syntaxn, 129, 131, 144, 255); /* in/output */
+ rgba_char_args_set(btheme->tnode.syntaxb, 127,127,127, 255); /* operator */
+ rgba_char_args_set(btheme->tnode.syntaxv, 142, 138, 145, 255); /* generator */
+ rgba_char_args_set(btheme->tnode.syntaxc, 120, 145, 120, 255); /* group */
}
/* Group theme colors */
- if(btheme->tv3d.group[3]==0) {
- SETCOL(btheme->tv3d.group, 0x0C, 0x30, 0x0C, 255);
- SETCOL(btheme->tv3d.group_active, 0x66, 0xFF, 0x66, 255);
+ if (btheme->tv3d.group[3]==0) {
+ rgba_char_args_set(btheme->tv3d.group, 0x0C, 0x30, 0x0C, 255);
+ rgba_char_args_set(btheme->tv3d.group_active, 0x66, 0xFF, 0x66, 255);
}
/* Sequence editor theme*/
- if(btheme->tseq.movie[3]==0) {
- SETCOL(btheme->tseq.movie, 81, 105, 135, 255);
- SETCOL(btheme->tseq.image, 109, 88, 129, 255);
- SETCOL(btheme->tseq.scene, 78, 152, 62, 255);
- SETCOL(btheme->tseq.audio, 46, 143, 143, 255);
- SETCOL(btheme->tseq.effect, 169, 84, 124, 255);
- SETCOL(btheme->tseq.plugin, 126, 126, 80, 255);
- SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
- SETCOL(btheme->tseq.meta, 109, 145, 131, 255);
+ if (btheme->tseq.movie[3]==0) {
+ rgba_char_args_set(btheme->tseq.movie, 81, 105, 135, 255);
+ rgba_char_args_set(btheme->tseq.image, 109, 88, 129, 255);
+ rgba_char_args_set(btheme->tseq.scene, 78, 152, 62, 255);
+ rgba_char_args_set(btheme->tseq.audio, 46, 143, 143, 255);
+ rgba_char_args_set(btheme->tseq.effect, 169, 84, 124, 255);
+ rgba_char_args_set(btheme->tseq.plugin, 126, 126, 80, 255);
+ rgba_char_args_set(btheme->tseq.transition, 162, 95, 111, 255);
+ rgba_char_args_set(btheme->tseq.meta, 109, 145, 131, 255);
}
}
@@ -1355,17 +1366,17 @@ void init_userdef_do_versions(void)
if (bmain->versionfile <= 242) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* long keyframe color */
/* check for alpha==0 is safe, then color was never set */
- if(btheme->tact.strip[3]==0) {
- SETCOL(btheme->tv3d.edge_sharp, 255, 32, 32, 255);
- SETCOL(btheme->tact.strip_select, 0xff, 0xff, 0xaa, 204);
- SETCOL(btheme->tact.strip, 0xe4, 0x9c, 0xc6, 204);
+ if (btheme->tact.strip[3]==0) {
+ rgba_char_args_set(btheme->tv3d.edge_sharp, 255, 32, 32, 255);
+ rgba_char_args_set(btheme->tact.strip_select, 0xff, 0xff, 0xaa, 204);
+ rgba_char_args_set(btheme->tact.strip, 0xe4, 0x9c, 0xc6, 204);
}
/* IPO-Editor - Vertex Size*/
- if(btheme->tipo.vertex_size == 0) {
+ if (btheme->tipo.vertex_size == 0) {
btheme->tipo.vertex_size= 3;
}
}
@@ -1376,31 +1387,31 @@ void init_userdef_do_versions(void)
}
if (bmain->versionfile < 245 || (bmain->versionfile == 245 && bmain->subversionfile < 3)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
- SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ rgba_char_args_set(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
}
- if(U.coba_weight.tot==0)
+ if (U.coba_weight.tot==0)
init_colorband(&U.coba_weight, 1);
}
if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) {
bTheme *btheme;
for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* these should all use the same color */
- SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
- SETCOL(btheme->tipo.cframe, 0x60, 0xc0, 0x40, 255);
- SETCOL(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
- SETCOL(btheme->tnla.cframe, 0x60, 0xc0, 0x40, 255);
- SETCOL(btheme->tseq.cframe, 0x60, 0xc0, 0x40, 255);
- //SETCOL(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255); Not needed anymore
- SETCOL(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
+ rgba_char_args_set(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
+ rgba_char_args_set(btheme->tipo.cframe, 0x60, 0xc0, 0x40, 255);
+ rgba_char_args_set(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
+ rgba_char_args_set(btheme->tnla.cframe, 0x60, 0xc0, 0x40, 255);
+ rgba_char_args_set(btheme->tseq.cframe, 0x60, 0xc0, 0x40, 255);
+ //rgba_char_args_set(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255); Not needed anymore
+ rgba_char_args_set(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
}
}
if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 13)) {
bTheme *btheme;
for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* action channel groups (recolor anyway) */
- SETCOL(btheme->tact.group, 0x39, 0x7d, 0x1b, 255);
- SETCOL(btheme->tact.group_active, 0x7d, 0xe9, 0x60, 255);
+ rgba_char_args_set(btheme->tact.group, 0x39, 0x7d, 0x1b, 255);
+ rgba_char_args_set(btheme->tact.group_active, 0x7d, 0xe9, 0x60, 255);
/* bone custom-color sets */
if (btheme->tarm[0].solid[3] == 0)
@@ -1419,50 +1430,50 @@ void init_userdef_do_versions(void)
/* IPO Editor: Handles/Vertices */
col = btheme->tipo.vertex;
- SETCOL(btheme->tipo.handle_vertex, col[0], col[1], col[2], 255);
+ rgba_char_args_set(btheme->tipo.handle_vertex, col[0], col[1], col[2], 255);
col = btheme->tipo.vertex_select;
- SETCOL(btheme->tipo.handle_vertex_select, col[0], col[1], col[2], 255);
+ rgba_char_args_set(btheme->tipo.handle_vertex_select, col[0], col[1], col[2], 255);
btheme->tipo.handle_vertex_size= btheme->tipo.vertex_size;
/* Sequence/Image Editor: colors for GPencil text */
col = btheme->tv3d.bone_pose;
- SETCOL(btheme->tseq.bone_pose, col[0], col[1], col[2], 255);
- SETCOL(btheme->tima.bone_pose, col[0], col[1], col[2], 255);
+ rgba_char_args_set(btheme->tseq.bone_pose, col[0], col[1], col[2], 255);
+ rgba_char_args_set(btheme->tima.bone_pose, col[0], col[1], col[2], 255);
col = btheme->tv3d.vertex_select;
- SETCOL(btheme->tseq.vertex_select, col[0], col[1], col[2], 255);
+ rgba_char_args_set(btheme->tseq.vertex_select, col[0], col[1], col[2], 255);
}
}
if (bmain->versionfile < 250) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* this was not properly initialized in 2.45 */
- if(btheme->tima.face_dot[3]==0) {
- SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
- SETCOL(btheme->tima.face_dot, 255, 133, 0, 255);
+ if (btheme->tima.face_dot[3]==0) {
+ rgba_char_args_set(btheme->tima.editmesh_active, 255, 255, 255, 128);
+ rgba_char_args_set(btheme->tima.face_dot, 255, 133, 0, 255);
btheme->tima.facedot_size= 2;
}
/* DopeSheet - (Object) Channel color */
- SETCOL(btheme->tact.ds_channel, 82, 96, 110, 255);
- SETCOL(btheme->tact.ds_subchannel, 124, 137, 150, 255);
+ rgba_char_args_set(btheme->tact.ds_channel, 82, 96, 110, 255);
+ rgba_char_args_set(btheme->tact.ds_subchannel, 124, 137, 150, 255);
/* DopeSheet - Group Channel color (saner version) */
- SETCOL(btheme->tact.group, 79, 101, 73, 255);
- SETCOL(btheme->tact.group_active, 135, 177, 125, 255);
+ rgba_char_args_set(btheme->tact.group, 79, 101, 73, 255);
+ rgba_char_args_set(btheme->tact.group_active, 135, 177, 125, 255);
/* Graph Editor - (Object) Channel color */
- SETCOL(btheme->tipo.ds_channel, 82, 96, 110, 255);
- SETCOL(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
+ rgba_char_args_set(btheme->tipo.ds_channel, 82, 96, 110, 255);
+ rgba_char_args_set(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
/* Graph Editor - Group Channel color */
- SETCOL(btheme->tipo.group, 79, 101, 73, 255);
- SETCOL(btheme->tipo.group_active, 135, 177, 125, 255);
+ rgba_char_args_set(btheme->tipo.group, 79, 101, 73, 255);
+ rgba_char_args_set(btheme->tipo.group_active, 135, 177, 125, 255);
/* Nla Editor - (Object) Channel color */
- SETCOL(btheme->tnla.ds_channel, 82, 96, 110, 255);
- SETCOL(btheme->tnla.ds_subchannel, 124, 137, 150, 255);
+ rgba_char_args_set(btheme->tnla.ds_channel, 82, 96, 110, 255);
+ rgba_char_args_set(btheme->tnla.ds_subchannel, 124, 137, 150, 255);
/* NLA Editor - New Strip colors */
- SETCOL(btheme->tnla.strip, 12, 10, 10, 128);
- SETCOL(btheme->tnla.strip_select, 255, 140, 0, 255);
+ rgba_char_args_set(btheme->tnla.strip, 12, 10, 10, 128);
+ rgba_char_args_set(btheme->tnla.strip_select, 255, 140, 0, 255);
}
/* adjust grease-pencil distances */
@@ -1476,31 +1487,31 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 1)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* common (new) variables, it checks for alpha==0 */
ui_theme_init_new(btheme);
- if(btheme->tui.wcol_num.outline[3]==0)
+ if (btheme->tui.wcol_num.outline[3]==0)
ui_widget_color_init(&btheme->tui);
/* Logic editor theme, check for alpha==0 is safe, then color was never set */
- if(btheme->tlogic.syntaxn[3]==0) {
+ if (btheme->tlogic.syntaxn[3]==0) {
/* re-uses syntax color storage */
btheme->tlogic= btheme->tv3d;
- SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
+ rgba_char_args_set(btheme->tlogic.back, 100, 100, 100, 255);
}
- SETCOLF(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
- SETCOLF(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
+ rgba_char_args_set_fl(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
+ rgba_char_args_set_fl(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
}
}
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 3)) {
/* new audio system */
- if(U.audiochannels == 0)
+ if (U.audiochannels == 0)
U.audiochannels = 2;
- if(U.audiodevice == 0) {
+ if (U.audiodevice == 0) {
#ifdef WITH_OPENAL
U.audiodevice = 2;
#endif
@@ -1508,9 +1519,9 @@ void init_userdef_do_versions(void)
U.audiodevice = 1;
#endif
}
- if(U.audioformat == 0)
+ if (U.audioformat == 0)
U.audioformat = 0x24;
- if(U.audiorate == 0)
+ if (U.audiorate == 0)
U.audiorate = 44100;
}
@@ -1520,7 +1531,7 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 8)) {
wmKeyMap *km;
- for(km=U.user_keymaps.first; km; km=km->next) {
+ for (km=U.user_keymaps.first; km; km=km->next) {
if (strcmp(km->idname, "Armature_Sketch")==0)
strcpy(km->idname, "Armature Sketch");
else if (strcmp(km->idname, "View3D")==0)
@@ -1558,7 +1569,7 @@ void init_userdef_do_versions(void)
}
}
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 16)) {
- if(U.wmdrawmethod == USER_DRAW_TRIPLE)
+ if (U.wmdrawmethod == USER_DRAW_TRIPLE)
U.wmdrawmethod = USER_DRAW_AUTOMATIC;
}
@@ -1573,39 +1584,39 @@ void init_userdef_do_versions(void)
U.keyhandles_new = HD_AUTO;
/* init new curve colors */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* init colors used for handles in 3D-View */
- SETCOL(btheme->tv3d.handle_free, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
- SETCOL(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
- SETCOL(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
- SETCOL(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
- SETCOL(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
- SETCOL(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
- SETCOL(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
+ rgba_char_args_set(btheme->tv3d.handle_free, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
+ rgba_char_args_set(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
+ rgba_char_args_set(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
+ rgba_char_args_set(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
+ rgba_char_args_set(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
+ rgba_char_args_set(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
+ rgba_char_args_set(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
/* same colors again for Graph Editor... */
- SETCOL(btheme->tipo.handle_free, 0, 0, 0, 255);
- SETCOL(btheme->tipo.handle_auto, 0x90, 0x90, 0x00, 255);
- SETCOL(btheme->tipo.handle_vect, 0x40, 0x90, 0x30, 255);
- SETCOL(btheme->tipo.handle_align, 0x80, 0x30, 0x60, 255);
- SETCOL(btheme->tipo.handle_sel_free, 0, 0, 0, 255);
- SETCOL(btheme->tipo.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
- SETCOL(btheme->tipo.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
- SETCOL(btheme->tipo.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
+ rgba_char_args_set(btheme->tipo.handle_free, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tipo.handle_auto, 0x90, 0x90, 0x00, 255);
+ rgba_char_args_set(btheme->tipo.handle_vect, 0x40, 0x90, 0x30, 255);
+ rgba_char_args_set(btheme->tipo.handle_align, 0x80, 0x30, 0x60, 255);
+ rgba_char_args_set(btheme->tipo.handle_sel_free, 0, 0, 0, 255);
+ rgba_char_args_set(btheme->tipo.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
+ rgba_char_args_set(btheme->tipo.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
+ rgba_char_args_set(btheme->tipo.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
/* edge crease */
- SETCOLF(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
+ rgba_char_args_set_fl(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
}
}
if (bmain->versionfile <= 252) {
bTheme *btheme;
/* init new curve colors */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
if (btheme->tv3d.lastsel_point[3] == 0)
- SETCOL(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
+ rgba_char_args_set(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
}
}
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
@@ -1625,7 +1636,7 @@ void init_userdef_do_versions(void)
5, -5
};
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* init progress bar theme */
btheme->tui.wcol_progress= wcol_progress;
}
@@ -1633,17 +1644,17 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 2)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
- SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
- SETCOL(btheme->tv3d.extra_face_angle, 0, 32, 0, 255);
- SETCOL(btheme->tv3d.extra_face_area, 0, 0, 128, 255);
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ rgba_char_args_set(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
+ rgba_char_args_set(btheme->tv3d.extra_face_angle, 0, 32, 0, 255);
+ rgba_char_args_set(btheme->tv3d.extra_face_area, 0, 0, 128, 255);
}
}
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 4)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
- if((btheme->tv3d.outline_width) == 0) btheme->tv3d.outline_width= 1;
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ if ((btheme->tv3d.outline_width) == 0) btheme->tv3d.outline_width= 1;
}
}
@@ -1654,7 +1665,7 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 2)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
btheme->tnode.noodle_curving = 5;
}
}
@@ -1662,7 +1673,7 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 1)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
btheme->tv3d.speaker[3] = 255;
}
}
@@ -1676,40 +1687,40 @@ void init_userdef_do_versions(void)
if (U.keyhandles_new == HD_AUTO)
U.keyhandles_new = HD_AUTO_ANIM;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
- if(btheme->tv3d.bundle_solid[3] == 0)
- SETCOL(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ if (btheme->tv3d.bundle_solid[3] == 0)
+ rgba_char_args_set(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
- if(btheme->tv3d.camera_path[3] == 0)
- SETCOL(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
+ if (btheme->tv3d.camera_path[3] == 0)
+ rgba_char_args_set(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
- if((btheme->tclip.back[3]) == 0) {
+ if ((btheme->tclip.back[3]) == 0) {
btheme->tclip= btheme->tv3d;
- SETCOL(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
- SETCOL(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
- SETCOL(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
- SETCOL(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
- SETCOL(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
- SETCOL(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
- SETCOL(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
- SETCOL(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
- SETCOL(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
- SETCOL(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
- SETCOL(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
- SETCOL(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
+ rgba_char_args_set(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
+ rgba_char_args_set(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
+ rgba_char_args_set(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
+ rgba_char_args_set(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
+ rgba_char_args_set(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
+ rgba_char_args_set(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
+ rgba_char_args_set(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
btheme->tclip.handle_vertex_size= 4;
}
/* auto-clamped handles -> based on auto */
- if(btheme->tipo.handle_auto_clamped[3] == 0)
- SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
- if(btheme->tipo.handle_sel_auto_clamped[3] == 0)
- SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
+ if (btheme->tipo.handle_auto_clamped[3] == 0)
+ rgba_char_args_set(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
+ if (btheme->tipo.handle_sel_auto_clamped[3] == 0)
+ rgba_char_args_set(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
}
/* enable (Cycles) addon by default */
- if(!BLI_findstring(&U.addons, "cycles", offsetof(bAddon, module))) {
+ if (!BLI_findstring(&U.addons, "cycles", offsetof(bAddon, module))) {
bAddon *baddon= MEM_callocN(sizeof(bAddon), "bAddon");
BLI_strncpy(baddon->module, "cycles", sizeof(baddon->module));
BLI_addtail(&U.addons, baddon);
@@ -1719,29 +1730,49 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 5)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
- SETCOL(btheme->tui.panel.header, 0, 0, 0, 25);
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25);
btheme->tui.icon_alpha= 1.0;
}
}
if (bmain->versionfile < 261 || (bmain->versionfile == 261 && bmain->subversionfile < 4)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
- SETCOLF(btheme->tima.preview_stitch_face, 0.071, 0.259, 0.694, 0.150);
- SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 0.522, 0.0, 0.7);
- SETCOLF(btheme->tima.preview_stitch_vert, 1.0, 0.522, 0.0, 0.5);
- SETCOLF(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
- SETCOLF(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
- SETCOLF(btheme->tima.preview_stitch_active, 0.886, 0.824, 0.765, 0.140);
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ rgba_char_args_set_fl(btheme->tima.preview_stitch_face, 0.071, 0.259, 0.694, 0.150);
+ rgba_char_args_set_fl(btheme->tima.preview_stitch_edge, 1.0, 0.522, 0.0, 0.7);
+ rgba_char_args_set_fl(btheme->tima.preview_stitch_vert, 1.0, 0.522, 0.0, 0.5);
+ rgba_char_args_set_fl(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
+ rgba_char_args_set_fl(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
+ rgba_char_args_set_fl(btheme->tima.preview_stitch_active, 0.886, 0.824, 0.765, 0.140);
- SETCOLF(btheme->toops.match, 0.2, 0.5, 0.2, 0.3);
- SETCOLF(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
+ rgba_char_args_set_fl(btheme->toops.match, 0.2, 0.5, 0.2, 0.3);
+ rgba_char_args_set_fl(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
}
U.use_16bit_textures = 1;
}
+ if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 2)) {
+ bTheme *btheme;
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ if (btheme->tui.wcol_menu_item.item[3] == 255)
+ rgba_char_args_set(btheme->tui.wcol_menu_item.item, 172, 172, 172, 128);
+ }
+ }
+
+ if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 3)) {
+ bTheme *btheme;
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ if (btheme->tui.wcol_tooltip.inner[3] == 0) {
+ btheme->tui.wcol_tooltip = btheme->tui.wcol_menu_back;
+ }
+ if (btheme->tui.wcol_tooltip.text[0] == 160) { /* hrmf */
+ rgba_char_args_set(btheme->tui.wcol_tooltip.text, 255, 255, 255, 255);
+ }
+ }
+ }
+
/* Freestyle color settings */
{
bTheme *btheme;
@@ -1749,8 +1780,8 @@ void init_userdef_do_versions(void)
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
/* check for alpha==0 is safe, then color was never set */
if(btheme->tv3d.freestyle_edge_mark[3]==0) {
- SETCOL(btheme->tv3d.freestyle_edge_mark, 0x7f, 0xff, 0x7f, 255);
- SETCOL(btheme->tv3d.freestyle_face_mark, 0x7f, 0xff, 0x7f, 51);
+ rgba_char_args_set(btheme->tv3d.freestyle_edge_mark, 0x7f, 0xff, 0x7f, 255);
+ rgba_char_args_set(btheme->tv3d.freestyle_face_mark, 0x7f, 0xff, 0x7f, 51);
}
}
}
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 2feccf7a4e8..9072db77b6f 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -73,9 +73,9 @@
*/
static int view2d_scroll_mapped(int scroll)
{
- if(scroll & V2D_SCROLL_HORIZONTAL_HIDE)
+ if (scroll & V2D_SCROLL_HORIZONTAL_HIDE)
scroll &= ~(V2D_SCROLL_HORIZONTAL);
- if(scroll & V2D_SCROLL_VERTICAL_HIDE)
+ if (scroll & V2D_SCROLL_VERTICAL_HIDE)
scroll &= ~(V2D_SCROLL_VERTICAL);
return scroll;
}
@@ -86,20 +86,20 @@ static void view2d_masks(View2D *v2d)
int scroll;
/* mask - view frame */
- v2d->mask.xmin= v2d->mask.ymin= 0;
- v2d->mask.xmax= v2d->winx - 1; /* -1 yes! masks are pixels */
- v2d->mask.ymax= v2d->winy - 1;
+ v2d->mask.xmin = v2d->mask.ymin = 0;
+ v2d->mask.xmax = v2d->winx - 1; /* -1 yes! masks are pixels */
+ v2d->mask.ymax = v2d->winy - 1;
#if 0
// XXX see above
v2d->scroll &= ~(V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_VERTICAL_HIDE);
/* check size if: */
if (v2d->scroll & V2D_SCROLL_HORIZONTAL)
- if(!(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL))
+ if (!(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL))
if (v2d->tot.xmax-v2d->tot.xmin <= v2d->cur.xmax-v2d->cur.xmin)
v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
if (v2d->scroll & V2D_SCROLL_VERTICAL)
- if(!(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL))
+ if (!(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL))
if (v2d->tot.ymax-v2d->tot.ymin <= v2d->cur.ymax-v2d->cur.ymin)
v2d->scroll |= V2D_SCROLL_VERTICAL_HIDE;
#endif
@@ -114,29 +114,29 @@ static void view2d_masks(View2D *v2d)
if (scroll & V2D_SCROLL_LEFT) {
/* on left-hand edge of region */
v2d->vert= v2d->mask;
- v2d->vert.xmax= V2D_SCROLL_WIDTH;
- v2d->mask.xmin= v2d->vert.xmax + 1;
+ v2d->vert.xmax = V2D_SCROLL_WIDTH;
+ v2d->mask.xmin = v2d->vert.xmax + 1;
}
else if (scroll & V2D_SCROLL_RIGHT) {
/* on right-hand edge of region */
v2d->vert= v2d->mask;
v2d->vert.xmax++; /* one pixel extra... was leaving a minor gap... */
- v2d->vert.xmin= v2d->vert.xmax - V2D_SCROLL_WIDTH;
- v2d->mask.xmax= v2d->vert.xmin - 1;
+ v2d->vert.xmin = v2d->vert.xmax - V2D_SCROLL_WIDTH;
+ v2d->mask.xmax = v2d->vert.xmin - 1;
}
/* horizontal scroller */
if (scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) {
/* on bottom edge of region (V2D_SCROLL_BOTTOM_O is outliner, the other is for standard) */
v2d->hor= v2d->mask;
- v2d->hor.ymax= V2D_SCROLL_HEIGHT;
- v2d->mask.ymin= v2d->hor.ymax + 1;
+ v2d->hor.ymax = V2D_SCROLL_HEIGHT;
+ v2d->mask.ymin = v2d->hor.ymax + 1;
}
else if (scroll & V2D_SCROLL_TOP) {
/* on upper edge of region */
v2d->hor= v2d->mask;
- v2d->hor.ymin= v2d->hor.ymax - V2D_SCROLL_HEIGHT;
- v2d->mask.ymax= v2d->hor.ymin - 1;
+ v2d->hor.ymin = v2d->hor.ymax - V2D_SCROLL_HEIGHT;
+ v2d->mask.ymax = v2d->hor.ymin - 1;
}
/* adjust vertical scroller if there's a horizontal scroller, to leave corner free */
@@ -144,11 +144,11 @@ static void view2d_masks(View2D *v2d)
/* just set y min/max for vertical scroller to y min/max of mask as appropriate */
if (scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) {
/* on bottom edge of region (V2D_SCROLL_BOTTOM_O is outliner, the other is for standard) */
- v2d->vert.ymin= v2d->mask.ymin;
+ v2d->vert.ymin = v2d->mask.ymin;
}
else if (scroll & V2D_SCROLL_TOP) {
/* on upper edge of region */
- v2d->vert.ymax= v2d->mask.ymax;
+ v2d->vert.ymax = v2d->mask.ymax;
}
}
}
@@ -161,7 +161,7 @@ static void view2d_masks(View2D *v2d)
* - for some of these presets, it is expected that the region will have defined some
* additional settings necessary for the customisation of the 2D viewport to its requirements
* - this function should only be called from region init() callbacks, where it is expected that
- * this is called before UI_view2d_size_update(), as this one checks that the rects are properly initialised.
+ * this is called before UI_view2d_size_update(), as this one checks that the rects are properly initialized.
*/
void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
{
@@ -170,7 +170,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
/* initialize data if there is a need for such */
if ((v2d->flag & V2D_IS_INITIALISED) == 0) {
- /* set initialised flag so that View2D doesn't get reinitialised next time again */
+ /* set initialized flag so that View2D doesn't get reinitialised next time again */
v2d->flag |= V2D_IS_INITIALISED;
init= 1;
@@ -196,9 +196,9 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
v2d->align= (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
v2d->keeptot= V2D_KEEPTOT_BOUNDS;
- v2d->tot.xmin= v2d->tot.ymin= 0.0f;
- v2d->tot.xmax= (float)(winx - 1);
- v2d->tot.ymax= (float)(winy - 1);
+ v2d->tot.xmin = v2d->tot.ymin = 0.0f;
+ v2d->tot.xmax = (float)(winx - 1);
+ v2d->tot.ymax = (float)(winy - 1);
v2d->cur= v2d->tot;
@@ -281,18 +281,18 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
v2d->scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
- v2d->tot.xmin= 0.0f;
- v2d->tot.xmax= winx;
+ v2d->tot.xmin = 0.0f;
+ v2d->tot.xmax = winx;
- v2d->tot.ymax= 0.0f;
- v2d->tot.ymin= -winy;
+ v2d->tot.ymax = 0.0f;
+ v2d->tot.ymin = -winy;
- v2d->cur.xmin= 0.0f;
+ v2d->cur.xmin = 0.0f;
/* bad workaround for keeping zoom level with scrollers */
- v2d->cur.xmax= (winx - V2D_SCROLL_WIDTH)*panelzoom;
+ v2d->cur.xmax = (winx - V2D_SCROLL_WIDTH)*panelzoom;
- v2d->cur.ymax= 0.0f;
- v2d->cur.ymin= (-winy)*panelzoom;
+ v2d->cur.ymax = 0.0f;
+ v2d->cur.ymin = (-winy)*panelzoom;
}
break;
@@ -362,10 +362,10 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
* NOTE: width and height must use FLT_MIN instead of 1, otherwise it is impossible to
* get enough resolution in Graph Editor for editing some curves
*/
- if(width < FLT_MIN) width= 1;
- if(height < FLT_MIN) height= 1;
- if(winx < 1) winx= 1;
- if(winy < 1) winy= 1;
+ if (width < FLT_MIN) width= 1;
+ if (height < FLT_MIN) height= 1;
+ if (winx < 1) winx= 1;
+ if (winy < 1) winy= 1;
/* V2D_LIMITZOOM indicates that zoom level should be preserved when the window size changes */
if (resize && (v2d->keepzoom & V2D_KEEPZOOM)) {
@@ -375,7 +375,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
zoom= winx / width;
oldzoom= v2d->oldwinx / curwidth;
- if(oldzoom != zoom)
+ if (oldzoom != zoom)
width *= zoom/oldzoom;
}
@@ -383,7 +383,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
zoom= winy / height;
oldzoom= v2d->oldwiny / curheight;
- if(oldzoom != zoom)
+ if (oldzoom != zoom)
height *= zoom/oldzoom;
}
}
@@ -502,7 +502,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
cur->xmax += width - (cur->xmax - cur->xmin);
}
else if (v2d->keepofs & V2D_KEEPOFS_X) {
- if(v2d->align & V2D_ALIGN_NO_POS_X)
+ if (v2d->align & V2D_ALIGN_NO_POS_X)
cur->xmin -= width - (cur->xmax - cur->xmin);
else
cur->xmax += width - (cur->xmax - cur->xmin);
@@ -520,7 +520,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
cur->ymax += height - (cur->ymax - cur->ymin);
}
else if (v2d->keepofs & V2D_KEEPOFS_Y) {
- if(v2d->align & V2D_ALIGN_NO_POS_Y)
+ if (v2d->align & V2D_ALIGN_NO_POS_Y)
cur->ymin -= height - (cur->ymax - cur->ymin);
else
cur->ymax += height - (cur->ymax - cur->ymin);
@@ -546,8 +546,8 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
/* width */
if ( (curwidth > totwidth) && !(v2d->keepzoom & (V2D_KEEPZOOM|V2D_LOCKZOOM_X|V2D_LIMITZOOM)) ) {
/* if zoom doesn't have to be maintained, just clamp edges */
- if (cur->xmin < tot->xmin) cur->xmin= tot->xmin;
- if (cur->xmax > tot->xmax) cur->xmax= tot->xmax;
+ if (cur->xmin < tot->xmin) cur->xmin = tot->xmin;
+ if (cur->xmax > tot->xmax) cur->xmax = tot->xmax;
}
else if (v2d->keeptot == V2D_KEEPTOT_STRICT) {
/* This is an exception for the outliner (and later channel-lists, headers)
@@ -595,8 +595,8 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
temp= (tot->xmax + tot->xmin) * 0.5f;
diff= curheight * 0.5f;
- cur->xmin= temp - diff;
- cur->xmax= temp + diff;
+ cur->xmin = temp - diff;
+ cur->xmax = temp + diff;
}
else if (cur->xmin < tot->xmin) {
/* move cur across so that it sits at minimum of tot */
@@ -629,8 +629,8 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
/* height */
if ( (curheight > totheight) && !(v2d->keepzoom & (V2D_KEEPZOOM|V2D_LOCKZOOM_Y|V2D_LIMITZOOM)) ) {
/* if zoom doesn't have to be maintained, just clamp edges */
- if (cur->ymin < tot->ymin) cur->ymin= tot->ymin;
- if (cur->ymax > tot->ymax) cur->ymax= tot->ymax;
+ if (cur->ymin < tot->ymin) cur->ymin = tot->ymin;
+ if (cur->ymax > tot->ymax) cur->ymax = tot->ymax;
}
else {
/* This here occurs when:
@@ -645,8 +645,8 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
temp= (tot->ymax + tot->ymin) * 0.5f;
diff= curheight * 0.5f;
- cur->ymin= temp - diff;
- cur->ymax= temp + diff;
+ cur->ymin = temp - diff;
+ cur->ymax = temp + diff;
}
else if (cur->ymin < tot->ymin) {
/* there's still space remaining, so shift up */
@@ -680,7 +680,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
/* width is in negative-x half */
if (v2d->cur.xmax > 0) {
v2d->cur.xmin -= v2d->cur.xmax;
- v2d->cur.xmax= 0.0f;
+ v2d->cur.xmax = 0.0f;
}
}
else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
@@ -738,13 +738,13 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
if (ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) {
if (flag == V2D_LOCK_COPY) {
/* other views with locks on must copy active */
- ar->v2d.cur.ymin= v2dcur->cur.ymin;
- ar->v2d.cur.ymax= v2dcur->cur.ymax;
+ ar->v2d.cur.ymin = v2dcur->cur.ymin;
+ ar->v2d.cur.ymax = v2dcur->cur.ymax;
}
else { /* V2D_LOCK_SET */
/* active must copy others */
- v2dcur->cur.ymin= ar->v2d.cur.ymin;
- v2dcur->cur.ymax= ar->v2d.cur.ymax;
+ v2dcur->cur.ymin = ar->v2d.cur.ymin;
+ v2dcur->cur.ymax = ar->v2d.cur.ymax;
}
/* region possibly changed, so refresh */
@@ -764,13 +764,13 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
if (ar->v2d.flag & V2D_VIEWSYNC_SCREEN_TIME) {
if (flag == V2D_LOCK_COPY) {
/* other views with locks on must copy active */
- ar->v2d.cur.xmin= v2dcur->cur.xmin;
- ar->v2d.cur.xmax= v2dcur->cur.xmax;
+ ar->v2d.cur.xmin = v2dcur->cur.xmin;
+ ar->v2d.cur.xmax = v2dcur->cur.xmax;
}
else { /* V2D_LOCK_SET */
/* active must copy others */
- v2dcur->cur.xmin= ar->v2d.cur.xmin;
- v2dcur->cur.xmax= ar->v2d.cur.xmax;
+ v2dcur->cur.xmin = ar->v2d.cur.xmin;
+ v2dcur->cur.xmax = ar->v2d.cur.xmax;
}
/* region possibly changed, so refresh */
@@ -797,39 +797,39 @@ void UI_view2d_curRect_reset (View2D *v2d)
/* handle width - posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
/* width is in negative-x half */
- v2d->cur.xmin= (float)-width;
- v2d->cur.xmax= 0.0f;
+ v2d->cur.xmin = (float)-width;
+ v2d->cur.xmax = 0.0f;
}
else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
/* width is in positive-x half */
- v2d->cur.xmin= 0.0f;
- v2d->cur.xmax= (float)width;
+ v2d->cur.xmin = 0.0f;
+ v2d->cur.xmax = (float)width;
}
else {
/* width is centered around x==0 */
const float dx= (float)width / 2.0f;
- v2d->cur.xmin= -dx;
- v2d->cur.xmax= dx;
+ v2d->cur.xmin = -dx;
+ v2d->cur.xmax = dx;
}
/* handle height - posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
/* height is in negative-y half */
- v2d->cur.ymin= (float)-height;
- v2d->cur.ymax= 0.0f;
+ v2d->cur.ymin = (float)-height;
+ v2d->cur.ymax = 0.0f;
}
else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
/* height is in positive-y half */
- v2d->cur.ymin= 0.0f;
- v2d->cur.ymax= (float)height;
+ v2d->cur.ymin = 0.0f;
+ v2d->cur.ymax = (float)height;
}
else {
/* height is centered around y==0 */
const float dy= (float)height / 2.0f;
- v2d->cur.ymin= -dy;
- v2d->cur.ymax= dy;
+ v2d->cur.ymin = -dy;
+ v2d->cur.ymax = dy;
}
}
@@ -846,9 +846,9 @@ void UI_view2d_totRect_set_resize (View2D *v2d, int width, int height, int resiz
/* hrumf! */
/* XXX: there are work arounds for this in the panel and file browse code. */
- if(scroll & V2D_SCROLL_HORIZONTAL)
+ if (scroll & V2D_SCROLL_HORIZONTAL)
width -= V2D_SCROLL_WIDTH;
- if(scroll & V2D_SCROLL_VERTICAL)
+ if (scroll & V2D_SCROLL_VERTICAL)
height -= V2D_SCROLL_HEIGHT;
if (ELEM3(0, v2d, width, height)) {
@@ -860,39 +860,39 @@ void UI_view2d_totRect_set_resize (View2D *v2d, int width, int height, int resiz
/* handle width - posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
/* width is in negative-x half */
- v2d->tot.xmin= (float)-width;
- v2d->tot.xmax= 0.0f;
+ v2d->tot.xmin = (float)-width;
+ v2d->tot.xmax = 0.0f;
}
else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
/* width is in positive-x half */
- v2d->tot.xmin= 0.0f;
- v2d->tot.xmax= (float)width;
+ v2d->tot.xmin = 0.0f;
+ v2d->tot.xmax = (float)width;
}
else {
/* width is centered around x==0 */
const float dx= (float)width / 2.0f;
- v2d->tot.xmin= -dx;
- v2d->tot.xmax= dx;
+ v2d->tot.xmin = -dx;
+ v2d->tot.xmax = dx;
}
/* handle height - posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
/* height is in negative-y half */
- v2d->tot.ymin= (float)-height;
- v2d->tot.ymax= 0.0f;
+ v2d->tot.ymin = (float)-height;
+ v2d->tot.ymax = 0.0f;
}
else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
/* height is in positive-y half */
- v2d->tot.ymin= 0.0f;
- v2d->tot.ymax= (float)height;
+ v2d->tot.ymin = 0.0f;
+ v2d->tot.ymax = (float)height;
}
else {
/* height is centered around y==0 */
const float dy= (float)height / 2.0f;
- v2d->tot.ymin= -dy;
- v2d->tot.ymax= dy;
+ v2d->tot.ymin = -dy;
+ v2d->tot.ymax = dy;
}
/* make sure that 'cur' rect is in a valid state as a result of these changes */
@@ -911,17 +911,17 @@ int UI_view2d_tab_set(View2D *v2d, int tab)
int changed= 0;
/* if tab changed, change offset */
- if(tab != v2d->tab_cur && v2d->tab_offset) {
- if(tab < v2d->tab_num)
+ if (tab != v2d->tab_cur && v2d->tab_offset) {
+ if (tab < v2d->tab_num)
offset= &v2d->tab_offset[tab*2];
else
offset= default_offset;
v2d->cur.xmax += offset[0] - v2d->cur.xmin;
- v2d->cur.xmin= offset[0];
+ v2d->cur.xmin = offset[0];
v2d->cur.ymin += offset[1] - v2d->cur.ymax;
- v2d->cur.ymax= offset[1];
+ v2d->cur.ymax = offset[1];
/* validation should happen in subsequent totRect_set */
@@ -929,10 +929,10 @@ int UI_view2d_tab_set(View2D *v2d, int tab)
}
/* resize array if needed */
- if(tab >= v2d->tab_num) {
+ if (tab >= v2d->tab_num) {
new_offset= MEM_callocN(sizeof(float)*(tab+1)*2, "view2d tab offset");
- if(v2d->tab_offset) {
+ if (v2d->tab_offset) {
memcpy(new_offset, v2d->tab_offset, sizeof(float)*v2d->tab_num*2);
MEM_freeN(v2d->tab_offset);
}
@@ -995,13 +995,13 @@ void UI_view2d_view_ortho(View2D *v2d)
curmasked.ymin-= yofs; curmasked.ymax-=yofs;
/* XXX ton: this flag set by outliner, for icons */
- if(v2d->flag & V2D_PIXELOFS_X) {
- curmasked.xmin= floorf(curmasked.xmin) - 0.001f;
- curmasked.xmax= floorf(curmasked.xmax) - 0.001f;
+ if (v2d->flag & V2D_PIXELOFS_X) {
+ curmasked.xmin = floorf(curmasked.xmin) - 0.001f;
+ curmasked.xmax = floorf(curmasked.xmax) - 0.001f;
}
- if(v2d->flag & V2D_PIXELOFS_Y) {
- curmasked.ymin= floorf(curmasked.ymin) - 0.001f;
- curmasked.ymax= floorf(curmasked.ymax) - 0.001f;
+ if (v2d->flag & V2D_PIXELOFS_Y) {
+ curmasked.ymin = floorf(curmasked.ymin) - 0.001f;
+ curmasked.ymax = floorf(curmasked.ymax) - 0.001f;
}
/* set matrix on all appropriate axes */
@@ -1078,7 +1078,7 @@ static void step_to_grid(float *step, int *power, int unit)
if (loga < 0.0f) {
if (rem < 0.2f) rem= 0.2f;
- else if(rem < 0.5f) rem= 0.5f;
+ else if (rem < 0.5f) rem= 0.5f;
else rem= 1.0f;
*step= rem * (float)pow(10.0, (*power));
@@ -1094,7 +1094,7 @@ static void step_to_grid(float *step, int *power, int unit)
}
else {
if (rem < 2.0f) rem= 2.0f;
- else if(rem < 5.0f) rem= 5.0f;
+ else if (rem < 5.0f) rem= 5.0f;
else rem= 10.0f;
*step= rem * (float)pow(10.0, (*power));
@@ -1143,7 +1143,7 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x
space= v2d->cur.xmax - v2d->cur.xmin;
pixels= (float)(v2d->mask.xmax - v2d->mask.xmin);
- if(pixels!=0.0f) {
+ if (pixels!=0.0f) {
grid->dx= (U.v2d_min_gridsize * space) / (seconddiv * pixels);
step_to_grid(&grid->dx, &grid->powerx, xunits);
grid->dx *= seconddiv;
@@ -1307,13 +1307,13 @@ void UI_view2d_constant_grid_draw(View2D *v2d)
start= v2d->cur.xmin - (float)fmod(v2d->cur.xmin, step);
glBegin(GL_LINES);
- for(; start<v2d->cur.xmax; start+=step) {
+ for (; start<v2d->cur.xmax; start+=step) {
glVertex2f(start, v2d->cur.ymin);
glVertex2f(start, v2d->cur.ymax);
}
start= v2d->cur.ymin - (float)fmod(v2d->cur.ymin, step);
- for(; start<v2d->cur.ymax; start+=step) {
+ for (; start<v2d->cur.ymax; start+=step) {
glVertex2f(v2d->cur.xmin, start);
glVertex2f(v2d->cur.xmax, start);
}
@@ -1411,16 +1411,16 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
/* scroller 'button' extents */
totsize= v2d->tot.xmax - v2d->tot.xmin;
scrollsize= (float)(hor.xmax - hor.xmin);
- if(totsize==0.0f) totsize = 1.0f; /* avoid divide by zero */
+ if (totsize==0.0f) totsize = 1.0f; /* avoid divide by zero */
fac1= (v2d->cur.xmin - v2d->tot.xmin) / totsize;
- if(fac1<=0.0f)
+ if (fac1<=0.0f)
scrollers->hor_min= hor.xmin;
else
scrollers->hor_min= (int)(hor.xmin + (fac1 * scrollsize));
fac2= (v2d->cur.xmax - v2d->tot.xmin) / totsize;
- if(fac2>=1.0f)
+ if (fac2>=1.0f)
scrollers->hor_max= hor.xmax;
else
scrollers->hor_max= (int)(hor.xmin + (fac2 * scrollsize));
@@ -1437,7 +1437,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
}
/* check whether sliders can disappear due to the full-range being used */
- if(v2d->keeptot) {
+ if (v2d->keeptot) {
if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) {
v2d->scroll |= V2D_SCROLL_HORIZONTAL_FULLR;
scrollers->horfull= 1;
@@ -1452,16 +1452,16 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
/* scroller 'button' extents */
totsize= v2d->tot.ymax - v2d->tot.ymin;
scrollsize= (float)(vert.ymax - vert.ymin);
- if(totsize==0.0f) totsize = 1.0f; /* avoid divide by zero */
+ if (totsize==0.0f) totsize = 1.0f; /* avoid divide by zero */
fac1= (v2d->cur.ymin- v2d->tot.ymin) / totsize;
- if(fac1<=0.0f)
+ if (fac1<=0.0f)
scrollers->vert_min= vert.ymin;
else
scrollers->vert_min= (int)(vert.ymin + (fac1 * scrollsize));
fac2= (v2d->cur.ymax - v2d->tot.ymin) / totsize;
- if(fac2>=1.0f)
+ if (fac2>=1.0f)
scrollers->vert_max= vert.ymax;
else
scrollers->vert_max= (int)(vert.ymin + (fac2 * scrollsize));
@@ -1479,7 +1479,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
}
/* check whether sliders can disappear due to the full-range being used */
- if(v2d->keeptot) {
+ if (v2d->keeptot) {
if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) {
v2d->scroll |= V2D_SCROLL_VERTICAL_FULLR;
scrollers->vertfull= 1;
@@ -1559,16 +1559,16 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* horizontal scrollbar */
if (scroll & V2D_SCROLL_HORIZONTAL) {
/* only draw scrollbar when it doesn't fill the entire space */
- if(vs->horfull==0) {
+ if (vs->horfull==0) {
bTheme *btheme= UI_GetTheme();
uiWidgetColors wcol= btheme->tui.wcol_scroll;
rcti slider;
int state;
- slider.xmin= vs->hor_min;
- slider.xmax= vs->hor_max;
- slider.ymin= hor.ymin;
- slider.ymax= hor.ymax;
+ slider.xmin = vs->hor_min;
+ slider.xmax = vs->hor_max;
+ slider.ymin = hor.ymin;
+ slider.ymax = hor.ymax;
state= (v2d->scroll_ui & V2D_SCROLL_H_ACTIVE)?UI_SCROLL_PRESSED:0;
@@ -1628,7 +1628,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
for (; fac < hor.xmax-10; fac+=dfac, val+=grid->dx) {
/* make prints look nicer for scrollers */
- if(fac < hor.xmin+10)
+ if (fac < hor.xmin+10)
continue;
switch (vs->xunits) {
@@ -1670,16 +1670,16 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* vertical scrollbar */
if (scroll & V2D_SCROLL_VERTICAL) {
/* only draw scrollbar when it doesn't fill the entire space */
- if(vs->vertfull==0) {
+ if (vs->vertfull==0) {
bTheme *btheme= UI_GetTheme();
uiWidgetColors wcol= btheme->tui.wcol_scroll;
rcti slider;
int state;
- slider.xmin= vert.xmin;
- slider.xmax= vert.xmax;
- slider.ymin= vs->vert_min;
- slider.ymax= vs->vert_max;
+ slider.xmin = vert.xmin;
+ slider.xmax = vert.xmax;
+ slider.ymin = vs->vert_min;
+ slider.ymax = vs->vert_max;
state= (v2d->scroll_ui & V2D_SCROLL_V_ACTIVE)?UI_SCROLL_PRESSED:0;
@@ -1738,7 +1738,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
for (; fac < vert.ymax-10; fac+= dfac, val += grid->dy) {
/* make prints look nicer for scrollers */
- if(fac < vert.ymin+10)
+ if (fac < vert.ymin+10)
continue;
scroll_printstr(scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v');
@@ -1779,14 +1779,14 @@ void UI_view2d_listview_cell_to_view(View2D *v2d, short columnwidth, short rowhe
if ELEM(NULL, v2d, rect)
return;
if ((columnwidth <= 0) && (rowheight <= 0)) {
- rect->xmin= rect->xmax= 0.0f;
- rect->ymin= rect->ymax= 0.0f;
+ rect->xmin = rect->xmax = 0.0f;
+ rect->ymin = rect->ymax = 0.0f;
return;
}
/* x-coordinates */
- rect->xmin= startx + (float)(columnwidth * column);
- rect->xmax= startx + (float)(columnwidth * (column + 1));
+ rect->xmin = startx + (float)(columnwidth * column);
+ rect->xmax = startx + (float)(columnwidth * (column + 1));
if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
/* simply negate the values for the coordinates if in negative half */
@@ -1795,8 +1795,8 @@ void UI_view2d_listview_cell_to_view(View2D *v2d, short columnwidth, short rowhe
}
/* y-coordinates */
- rect->ymin= starty + (float)(rowheight * row);
- rect->ymax= starty + (float)(rowheight * (row + 1));
+ rect->ymin = starty + (float)(rowheight * row);
+ rect->ymax = starty + (float)(rowheight * (row + 1));
if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
/* simply negate the values for the coordinates if in negative half */
@@ -1935,12 +1935,12 @@ void UI_view2d_to_region_no_clip(View2D *v2d, float x, float y, int *regionx, in
/* although we don't clamp to lie within region bounds, we must avoid exceeding size of ints */
if (regionx) {
if (x < INT_MIN) *regionx= INT_MIN;
- else if(x > INT_MAX) *regionx= INT_MAX;
+ else if (x > INT_MAX) *regionx= INT_MAX;
else *regionx= (int)x;
}
if (regiony) {
if (y < INT_MIN) *regiony= INT_MIN;
- else if(y > INT_MAX) *regiony= INT_MAX;
+ else if (y > INT_MAX) *regiony= INT_MAX;
else *regiony= (int)y;
}
}
@@ -2039,7 +2039,7 @@ void UI_view2d_text_cache_add(View2D *v2d, float x, float y, const char *str, co
UI_view2d_view_to_region(v2d, x, y, mval, mval+1);
- if(mval[0]!=V2D_IS_CLIPPED && mval[1]!=V2D_IS_CLIPPED) {
+ if (mval[0]!=V2D_IS_CLIPPED && mval[1]!=V2D_IS_CLIPPED) {
int len= strlen(str)+1;
/* use calloc, rect has to be zeroe'd */
View2DString *v2s= MEM_callocN(sizeof(View2DString)+len, "View2DString");
@@ -2083,19 +2083,19 @@ void UI_view2d_text_cache_draw(ARegion *ar)
// glPushMatrix();
ED_region_pixelspace(ar);
- for(v2s= strings.first; v2s; v2s= v2s->next) {
+ for (v2s= strings.first; v2s; v2s= v2s->next) {
const char *str= (const char *)(v2s+1);
int xofs=0, yofs;
yofs= ceil( 0.5f*(v2s->rect.ymax - v2s->rect.ymin - BLF_height_default("28")));
- if(yofs<1) yofs= 1;
+ if (yofs<1) yofs= 1;
- if(col_pack_prev != v2s->col.pack) {
+ if (col_pack_prev != v2s->col.pack) {
glColor3ubv(v2s->col.ub);
col_pack_prev= v2s->col.pack;
}
- if(v2s->rect.xmin >= v2s->rect.xmax)
+ if (v2s->rect.xmin >= v2s->rect.xmax)
BLF_draw_default((float)v2s->mval[0]+xofs, (float)v2s->mval[1]+yofs, 0.0, str, BLF_DRAW_STR_DUMMY_MAX);
else {
BLF_clipping_default(v2s->rect.xmin-4, v2s->rect.ymin-4, v2s->rect.xmax+4, v2s->rect.ymax+4);
@@ -2110,7 +2110,7 @@ void UI_view2d_text_cache_draw(ARegion *ar)
// glMatrixMode(GL_MODELVIEW);
// glPopMatrix();
- if(strings.first)
+ if (strings.first)
BLI_freelistN(&strings);
}
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 49dae81d985..c729e944c62 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -291,18 +291,18 @@ static int view_pan_cancel(bContext *UNUSED(C), wmOperator *op)
static void VIEW2D_OT_pan(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Pan View";
- ot->description= "Pan the view";
- ot->idname= "VIEW2D_OT_pan";
+ ot->name = "Pan View";
+ ot->description = "Pan the view";
+ ot->idname = "VIEW2D_OT_pan";
/* api callbacks */
- ot->exec= view_pan_exec;
- ot->invoke= view_pan_invoke;
- ot->modal= view_pan_modal;
- ot->cancel= view_pan_cancel;
+ ot->exec = view_pan_exec;
+ ot->invoke = view_pan_invoke;
+ ot->modal = view_pan_modal;
+ ot->cancel = view_pan_cancel;
/* operator is modal */
- ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -341,12 +341,12 @@ static int view_scrollright_exec(bContext *C, wmOperator *op)
static void VIEW2D_OT_scroll_right(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Scroll Right";
- ot->description= "Scroll the view right";
- ot->idname= "VIEW2D_OT_scroll_right";
+ ot->name = "Scroll Right";
+ ot->description = "Scroll the view right";
+ ot->idname = "VIEW2D_OT_scroll_right";
/* api callbacks */
- ot->exec= view_scrollright_exec;
+ ot->exec = view_scrollright_exec;
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -385,12 +385,12 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op)
static void VIEW2D_OT_scroll_left(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Scroll Left";
- ot->description= "Scroll the view left";
- ot->idname= "VIEW2D_OT_scroll_left";
+ ot->name = "Scroll Left";
+ ot->description = "Scroll the view left";
+ ot->idname = "VIEW2D_OT_scroll_left";
/* api callbacks */
- ot->exec= view_scrollleft_exec;
+ ot->exec = view_scrollleft_exec;
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -418,7 +418,7 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", -40);
- if(RNA_boolean_get(op->ptr, "page")) {
+ if (RNA_boolean_get(op->ptr, "page")) {
ARegion *ar= CTX_wm_region(C);
RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymin - ar->v2d.mask.ymax);
}
@@ -433,12 +433,12 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
static void VIEW2D_OT_scroll_down(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Scroll Down";
- ot->description= "Scroll the view down";
- ot->idname= "VIEW2D_OT_scroll_down";
+ ot->name = "Scroll Down";
+ ot->description = "Scroll the view down";
+ ot->idname = "VIEW2D_OT_scroll_down";
/* api callbacks */
- ot->exec= view_scrolldown_exec;
+ ot->exec = view_scrolldown_exec;
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -468,7 +468,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", 40);
- if(RNA_boolean_get(op->ptr, "page")) {
+ if (RNA_boolean_get(op->ptr, "page")) {
ARegion *ar= CTX_wm_region(C);
RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymax - ar->v2d.mask.ymin);
}
@@ -483,12 +483,12 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
static void VIEW2D_OT_scroll_up(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Scroll Up";
- ot->description= "Scroll the view up";
- ot->idname= "VIEW2D_OT_scroll_up";
+ ot->name = "Scroll Up";
+ ot->description = "Scroll the view up";
+ ot->idname = "VIEW2D_OT_scroll_up";
/* api callbacks */
- ot->exec= view_scrollup_exec;
+ ot->exec = view_scrollup_exec;
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -711,14 +711,14 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void VIEW2D_OT_zoom_in(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Zoom In";
- ot->description= "Zoom in the view";
- ot->idname= "VIEW2D_OT_zoom_in";
+ ot->name = "Zoom In";
+ ot->description = "Zoom in the view";
+ ot->idname = "VIEW2D_OT_zoom_in";
/* api callbacks */
- ot->invoke= view_zoomin_invoke;
-// ot->exec= view_zoomin_exec; // XXX, needs view_zoomdrag_init called first.
- ot->poll= view_zoom_poll;
+ ot->invoke = view_zoomin_invoke;
+// ot->exec = view_zoomin_exec; // XXX, needs view_zoomdrag_init called first.
+ ot->poll = view_zoom_poll;
/* rna - must keep these in sync with the other operators */
RNA_def_float(ot->srna, "zoomfacx", 0, -FLT_MAX, FLT_MAX, "Zoom Factor X", "", -FLT_MAX, FLT_MAX);
@@ -753,7 +753,7 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, wmEvent *event)
vzd= op->customdata;
- if(U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
+ if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
ARegion *ar= CTX_wm_region(C);
/* store initial mouse position (in view space) */
@@ -768,14 +768,14 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void VIEW2D_OT_zoom_out(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Zoom Out";
- ot->description= "Zoom out the view";
- ot->idname= "VIEW2D_OT_zoom_out";
+ ot->name = "Zoom Out";
+ ot->description = "Zoom out the view";
+ ot->idname = "VIEW2D_OT_zoom_out";
/* api callbacks */
- ot->invoke= view_zoomout_invoke;
-// ot->exec= view_zoomout_exec; // XXX, needs view_zoomdrag_init called first.
- ot->poll= view_zoom_poll;
+ ot->invoke = view_zoomout_invoke;
+// ot->exec = view_zoomout_exec; // XXX, needs view_zoomdrag_init called first.
+ ot->poll = view_zoom_poll;
/* rna - must keep these in sync with the other operators */
RNA_def_float(ot->srna, "zoomfacx", 0, -FLT_MAX, FLT_MAX, "Zoom Factor X", "", -FLT_MAX, FLT_MAX);
@@ -867,7 +867,7 @@ static void view_zoomdrag_exit(bContext *C, wmOperator *op)
if (op->customdata) {
v2dViewZoomData *vzd= op->customdata;
- if(vzd->timer)
+ if (vzd->timer)
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), vzd->timer);
MEM_freeN(op->customdata);
@@ -975,7 +975,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
if (event->type == TIMER && event->customdata == vzd->timer) {
view_zoomdrag_apply(C, op);
}
- else if(event->type == MOUSEMOVE) {
+ else if (event->type == MOUSEMOVE) {
float dx, dy;
/* calculate new delta transform, based on zooming mode */
@@ -1063,20 +1063,20 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
static void VIEW2D_OT_zoom(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Zoom 2D View";
- ot->description= "Zoom in/out the view";
- ot->idname= "VIEW2D_OT_zoom";
+ ot->name = "Zoom 2D View";
+ ot->description = "Zoom in/out the view";
+ ot->idname = "VIEW2D_OT_zoom";
/* api callbacks */
- ot->exec= view_zoomdrag_exec;
- ot->invoke= view_zoomdrag_invoke;
- ot->modal= view_zoomdrag_modal;
- ot->cancel= view_zoomdrag_cancel;
+ ot->exec = view_zoomdrag_exec;
+ ot->invoke = view_zoomdrag_invoke;
+ ot->modal = view_zoomdrag_modal;
+ ot->cancel = view_zoomdrag_cancel;
- ot->poll= view_zoom_poll;
+ ot->poll = view_zoom_poll;
/* operator is repeatable */
- // ot->flag= OPTYPE_BLOCKING;
+ // ot->flag = OPTYPE_BLOCKING;
/* rna - must keep these in sync with the other operators */
RNA_def_float(ot->srna, "deltax", 0, -FLT_MAX, FLT_MAX, "Delta X", "", -FLT_MAX, FLT_MAX);
@@ -1116,12 +1116,12 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
* if zoom is allowed to be changed
*/
if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) {
- v2d->cur.xmin= rect.xmin;
- v2d->cur.xmax= rect.xmax;
+ v2d->cur.xmin = rect.xmin;
+ v2d->cur.xmax = rect.xmax;
}
if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0) {
- v2d->cur.ymin= rect.ymin;
- v2d->cur.ymax= rect.ymax;
+ v2d->cur.ymin = rect.ymin;
+ v2d->cur.ymax = rect.ymax;
}
}
else /* if (gesture_mode == GESTURE_MODAL_OUT) */ {
@@ -1138,16 +1138,16 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
zoom= size / (rect.xmax - rect.xmin);
center= (v2d->cur.xmax + v2d->cur.xmin) * 0.5f;
- v2d->cur.xmin= center - (size * zoom);
- v2d->cur.xmax= center + (size * zoom);
+ v2d->cur.xmin = center - (size * zoom);
+ v2d->cur.xmax = center + (size * zoom);
}
if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0) {
size= (v2d->cur.ymax - v2d->cur.ymin);
zoom= size / (rect.ymax - rect.ymin);
center= (v2d->cur.ymax + v2d->cur.ymin) * 0.5f;
- v2d->cur.ymin= center - (size * zoom);
- v2d->cur.ymax= center + (size * zoom);
+ v2d->cur.ymin = center - (size * zoom);
+ v2d->cur.ymax = center + (size * zoom);
}
}
@@ -1164,17 +1164,17 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
static void VIEW2D_OT_zoom_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Zoom to Border";
- ot->description= "Zoom in the view to the nearest item contained in the border";
- ot->idname= "VIEW2D_OT_zoom_border";
+ ot->name = "Zoom to Border";
+ ot->description = "Zoom in the view to the nearest item contained in the border";
+ ot->idname = "VIEW2D_OT_zoom_border";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= view_borderzoom_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = view_borderzoom_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= view_zoom_poll;
+ ot->poll = view_zoom_poll;
/* rna */
RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX);
@@ -1547,7 +1547,7 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
if ( ((vsm->scroller=='h') && (v2d->keepofs & V2D_LOCKOFS_X)) ||
((vsm->scroller=='v') && (v2d->keepofs & V2D_LOCKOFS_Y)) )
{
- /* free customdata initialised */
+ /* free customdata initialized */
scroller_activate_exit(C, op);
/* can't catch this event for ourselves, so let it go to someone else? */
@@ -1559,7 +1559,7 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
if ( ((vsm->scroller=='h') && (v2d->scroll & (V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_HORIZONTAL_FULLR))) ||
((vsm->scroller=='v') && (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE|V2D_SCROLL_VERTICAL_FULLR))) )
{
- /* free customdata initialised */
+ /* free customdata initialized */
scroller_activate_exit(C, op);
/* can't catch this event for ourselves, so let it go to someone else? */
@@ -1587,19 +1587,19 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Scroller Activate";
- ot->description= "Scroll view by mouse click and drag";
- ot->idname= "VIEW2D_OT_scroller_activate";
+ ot->name = "Scroller Activate";
+ ot->description = "Scroll view by mouse click and drag";
+ ot->idname = "VIEW2D_OT_scroller_activate";
/* flags */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
/* api callbacks */
- ot->invoke= scroller_activate_invoke;
- ot->modal= scroller_activate_modal;
- ot->cancel= scroller_activate_cancel;
+ ot->invoke = scroller_activate_invoke;
+ ot->modal = scroller_activate_modal;
+ ot->cancel = scroller_activate_cancel;
- ot->poll= view2d_poll;
+ ot->poll = view2d_poll;
}
/* ********************************************************* */
@@ -1616,29 +1616,29 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
winx= (float)(v2d->mask.xmax - v2d->mask.xmin + 1);
winy= (float)(v2d->mask.ymax - v2d->mask.ymin + 1);
- v2d->cur.xmax= v2d->cur.xmin + winx;
- v2d->cur.ymax= v2d->cur.ymin + winy;
+ v2d->cur.xmax = v2d->cur.xmin + winx;
+ v2d->cur.ymax = v2d->cur.ymin + winy;
/* align */
if (v2d->align) {
/* posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
- v2d->cur.xmax= 0.0f;
- v2d->cur.xmin= -winx*style->panelzoom;
+ v2d->cur.xmax = 0.0f;
+ v2d->cur.xmin = -winx*style->panelzoom;
}
else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
- v2d->cur.xmax= winx*style->panelzoom;
- v2d->cur.xmin= 0.0f;
+ v2d->cur.xmax = winx*style->panelzoom;
+ v2d->cur.xmin = 0.0f;
}
/* - posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
- v2d->cur.ymax= 0.0f;
- v2d->cur.ymin= -winy*style->panelzoom;
+ v2d->cur.ymax = 0.0f;
+ v2d->cur.ymin = -winy*style->panelzoom;
}
else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
- v2d->cur.ymax= winy*style->panelzoom;
- v2d->cur.ymin= 0.0f;
+ v2d->cur.ymax = winy*style->panelzoom;
+ v2d->cur.ymin = 0.0f;
}
}
@@ -1655,13 +1655,13 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
static void VIEW2D_OT_reset(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reset View";
- ot->description= "Reset the view";
- ot->idname= "VIEW2D_OT_reset";
+ ot->name = "Reset View";
+ ot->description = "Reset the view";
+ ot->idname = "VIEW2D_OT_reset";
/* api callbacks */
- ot->exec= reset_exec;
- ot->poll= view2d_poll;
+ ot->exec = reset_exec;
+ ot->poll = view2d_poll;
}
/* ********************************************************* */
@@ -1689,7 +1689,7 @@ void UI_view2d_operatortypes(void)
void UI_view2d_keymap(wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "View2D", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "View2D", 0, 0);
wmKeyMapItem *kmi;
/* scrollers */
@@ -1742,7 +1742,7 @@ void UI_view2d_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "VIEW2D_OT_zoom_border", BKEY, KM_PRESS, KM_SHIFT, 0);
/* Alternative keymap for buttons listview */
- keymap= WM_keymap_find(keyconf, "View2D Buttons List", 0, 0);
+ keymap = WM_keymap_find(keyconf, "View2D Buttons List", 0, 0);
WM_keymap_add_item(keymap, "VIEW2D_OT_scroller_activate", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "VIEW2D_OT_scroller_activate", MIDDLEMOUSE, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt
index 9d2229b52f4..de9443d1eb4 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -38,15 +38,14 @@ set(INC_SYS
)
set(SRC
- bmesh_select.c
- bmesh_selecthistory.c
- bmesh_tools.c
- bmesh_utils.c
editface.c
editmesh_add.c
editmesh_bvh.c
- knifetool.c
- loopcut.c
+ editmesh_knife.c
+ editmesh_loopcut.c
+ editmesh_select.c
+ editmesh_tools.c
+ editmesh_utils.c
mesh_data.c
mesh_ops.c
meshtools.c
diff --git a/source/blender/editors/mesh/bmesh_selecthistory.c b/source/blender/editors/mesh/bmesh_selecthistory.c
deleted file mode 100644
index c912813ac63..00000000000
--- a/source/blender/editors/mesh/bmesh_selecthistory.c
+++ /dev/null
@@ -1,69 +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) 2004 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/* ********* Selection History ************ */
-
-#include "BKE_tessmesh.h"
-
-
-/* these wrap equivalent bmesh functions. I'm in two minds of it we should
- * just use the bm functions directly; on the one hand, there's no real
- * need (at the moment) to wrap them, but on the other hand having these
- * wrapped avoids a confusing mess of mixing BM_ and EDBM_ namespaces. */
-
-void EDBM_editselection_center(BMEditMesh *em, float *center, BMEditSelection *ese)
-{
- BM_editselection_center(em->bm, center, ese);
-}
-
-void EDBM_editselection_normal(float *normal, BMEditSelection *ese)
-{
- BM_editselection_normal(normal, ese);
-}
-
-/* Calculate a plane that is rightangles to the edge/vert/faces normal
- * also make the plane run along an axis that is related to the geometry,
- * because this is used for the manipulators Y axis. */
-void EDBM_editselection_plane(BMEditMesh *em, float *plane, BMEditSelection *ese)
-{
- BM_editselection_plane(em->bm, plane, ese);
-}
-
-void EDBM_remove_selection(BMEditMesh *em, BMElem *ele)
-{
- BM_select_history_remove(em->bm, ele);
-}
-
-void EDBM_store_selection(BMEditMesh *em, BMElem *ele)
-{
- BM_select_history_store(em->bm, ele);
-}
-
-void EDBM_validate_selections(BMEditMesh *em)
-{
- BM_select_history_validate(em->bm);
-}
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index a7f72481456..efa5ce0395c 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -77,7 +77,7 @@ void paintface_flush_flags(Object *ob)
int totface, totpoly;
int i;
- if(me==NULL || dm==NULL)
+ if (me==NULL || dm==NULL)
return;
/*
@@ -169,20 +169,20 @@ void paintface_hide(Object *ob, const int unselected)
int a;
me= get_mesh(ob);
- if(me==NULL || me->totpoly==0) return;
+ if (me==NULL || me->totpoly==0) return;
mface= me->mpoly;
a= me->totpoly;
- while(a--) {
- if((mface->flag & ME_HIDE) == 0) {
- if(unselected) {
- if( (mface->flag & ME_FACE_SEL)==0) mface->flag |= ME_HIDE;
+ while (a--) {
+ if ((mface->flag & ME_HIDE) == 0) {
+ if (unselected) {
+ if ( (mface->flag & ME_FACE_SEL)==0) mface->flag |= ME_HIDE;
}
else {
- if( (mface->flag & ME_FACE_SEL)) mface->flag |= ME_HIDE;
+ if ( (mface->flag & ME_FACE_SEL)) mface->flag |= ME_HIDE;
}
}
- if(mface->flag & ME_HIDE) mface->flag &= ~ME_FACE_SEL;
+ if (mface->flag & ME_HIDE) mface->flag &= ~ME_FACE_SEL;
mface++;
}
@@ -198,12 +198,12 @@ void paintface_reveal(Object *ob)
int a;
me= get_mesh(ob);
- if(me==NULL || me->totpoly==0) return;
+ if (me==NULL || me->totpoly==0) return;
mface= me->mpoly;
a= me->totpoly;
- while(a--) {
- if(mface->flag & ME_HIDE) {
+ while (a--) {
+ if (mface->flag & ME_HIDE) {
mface->flag |= ME_FACE_SEL;
mface->flag -= ME_HIDE;
}
@@ -239,8 +239,8 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
seamhash = BLI_edgehash_new();
linkflag= MEM_callocN(sizeof(char)*me->totpoly, "linkflaguv");
- for(med=me->medge, a=0; a < me->totedge; a++, med++)
- if(med->flag & ME_SEAM)
+ for (med=me->medge, a=0; a < me->totedge; a++, med++)
+ if (med->flag & ME_SEAM)
BLI_edgehash_insert(seamhash, med->v1, med->v2, NULL);
if (mode==0 || mode==1) {
@@ -252,25 +252,25 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
else {
/* fill array by selection */
mf= me->mpoly;
- for(a=0; a<me->totpoly; a++, mf++) {
- if(mf->flag & ME_HIDE);
- else if(mf->flag & ME_FACE_SEL) {
+ for (a=0; a<me->totpoly; a++, mf++) {
+ if (mf->flag & ME_HIDE);
+ else if (mf->flag & ME_FACE_SEL) {
hash_add_face(ehash, mf, me->mloop + mf->loopstart);
linkflag[a]= 1;
}
}
}
- while(doit) {
+ while (doit) {
doit= 0;
/* expand selection */
mf= me->mpoly;
- for(a=0; a<me->totpoly; a++, mf++) {
- if(mf->flag & ME_HIDE)
+ for (a=0; a<me->totpoly; a++, mf++) {
+ if (mf->flag & ME_HIDE)
continue;
- if(!linkflag[a]) {
+ if (!linkflag[a]) {
MLoop *mnextl;
mark= 0;
@@ -282,7 +282,7 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
mark = 1;
}
- if(mark) {
+ if (mark) {
linkflag[a]= 1;
hash_add_face(ehash, mf, me->mloop + mf->loopstart);
doit= 1;
@@ -295,26 +295,26 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
BLI_edgehash_free(ehash, NULL);
BLI_edgehash_free(seamhash, NULL);
- if(mode==0 || mode==2) {
- for(a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
- if(linkflag[a])
+ if (mode==0 || mode==2) {
+ for (a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
+ if (linkflag[a])
mf->flag |= ME_FACE_SEL;
else
mf->flag &= ~ME_FACE_SEL;
}
- else if(mode==1) {
- for(a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
- if(linkflag[a] && (mf->flag & ME_FACE_SEL))
+ else if (mode==1) {
+ for (a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
+ if (linkflag[a] && (mf->flag & ME_FACE_SEL))
break;
if (a<me->totpoly) {
- for(a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
- if(linkflag[a])
+ for (a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
+ if (linkflag[a])
mf->flag &= ~ME_FACE_SEL;
}
else {
- for(a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
- if(linkflag[a])
+ for (a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
+ if (linkflag[a])
mf->flag |= ME_FACE_SEL;
}
}
@@ -328,7 +328,7 @@ void paintface_select_linked(bContext *UNUSED(C), Object *ob, int UNUSED(mval[2]
unsigned int index=0;
me = get_mesh(ob);
- if(me==NULL || me->totpoly==0) return;
+ if (me==NULL || me->totpoly==0) return;
if (mode==0 || mode==1) {
// XXX - Causes glitches, not sure why
@@ -350,13 +350,13 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
int a;
me= get_mesh(ob);
- if(me==NULL) return;
+ if (me==NULL) return;
- if(action == SEL_INVERT) {
+ if (action == SEL_INVERT) {
mface= me->mpoly;
a= me->totpoly;
- while(a--) {
- if((mface->flag & ME_HIDE) == 0) {
+ while (a--) {
+ if ((mface->flag & ME_HIDE) == 0) {
mface->flag ^= ME_FACE_SEL;
}
mface++;
@@ -368,8 +368,8 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
mface= me->mpoly;
a= me->totpoly;
- while(a--) {
- if((mface->flag & ME_HIDE) == 0 && mface->flag & ME_FACE_SEL) {
+ while (a--) {
+ if ((mface->flag & ME_HIDE) == 0 && mface->flag & ME_FACE_SEL) {
action = SEL_DESELECT;
break;
}
@@ -379,8 +379,8 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
mface= me->mpoly;
a= me->totpoly;
- while(a--) {
- if((mface->flag & ME_HIDE) == 0) {
+ while (a--) {
+ if ((mface->flag & ME_HIDE) == 0) {
switch (action) {
case SEL_SELECT:
mface->flag |= ME_FACE_SEL;
@@ -397,7 +397,7 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
}
}
- if(flush_flags) {
+ if (flush_flags) {
paintface_flush_flags(ob);
}
}
@@ -413,7 +413,7 @@ int paintface_minmax(Object *ob, float *min, float *max)
float vec[3], bmat[3][3];
me= get_mesh(ob);
- if(!me || !me->mtpoly) return ok;
+ if (!me || !me->mtpoly) return ok;
copy_m3_m4(bmat, ob->obmat);
@@ -462,7 +462,7 @@ void seam_mark_clear_tface(Scene *scene, short mode)
int a, b;
me= get_mesh(OBACT);
- if(me==0 || me->totpoly==0) return;
+ if (me==0 || me->totpoly==0) return;
if (mode == 0)
mode = pupmenu("Seams%t|Mark Border Seam %x1|Clear Seam %x2");
@@ -571,7 +571,7 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
me= get_mesh(ob);
- if(me==NULL || me->totpoly==0 || sx*sy <= 0)
+ if (me==NULL || me->totpoly==0 || sx*sy <= 0)
return OPERATOR_CANCELLED;
selar= MEM_callocN(me->totpoly+1, "selar");
@@ -580,8 +580,8 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
paintface_deselect_all_visible(vc->obact, SEL_DESELECT, FALSE);
mface= me->mpoly;
- for(a=1; a<=me->totpoly; a++, mface++) {
- if((mface->flag & ME_HIDE) == 0)
+ for (a=1; a<=me->totpoly; a++, mface++) {
+ if ((mface->flag & ME_HIDE) == 0)
mface->flag &= ~ME_FACE_SEL;
}
}
@@ -591,23 +591,23 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
ibuf = IMB_allocImBuf(sx,sy,32,IB_rect);
rt = ibuf->rect;
glReadPixels(rect->xmin+vc->ar->winrct.xmin, rect->ymin+vc->ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
- if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
+ if (ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
a= sx*sy;
- while(a--) {
- if(*rt) {
+ while (a--) {
+ if (*rt) {
index= WM_framebuffer_to_index(*rt);
- if(index<=me->totpoly) selar[index]= 1;
+ if (index<=me->totpoly) selar[index]= 1;
}
rt++;
}
mface= me->mpoly;
- for(a=1; a<=me->totpoly; a++, mface++) {
- if(selar[a]) {
- if(mface->flag & ME_HIDE);
+ for (a=1; a<=me->totpoly; a++, mface++) {
+ if (selar[a]) {
+ if (mface->flag & ME_HIDE);
else {
- if(select) mface->flag |= ME_FACE_SEL;
+ if (select) mface->flag |= ME_FACE_SEL;
else mface->flag &= ~ME_FACE_SEL;
}
}
@@ -638,7 +638,7 @@ void paintvert_flush_flags(Object *ob)
int totvert;
int i;
- if(me==NULL || dm==NULL)
+ if (me==NULL || dm==NULL)
return;
index_array = dm->getVertDataArray(dm, CD_ORIGINDEX);
@@ -648,11 +648,11 @@ void paintvert_flush_flags(Object *ob)
dm_mv= dm_mvert;
- if(index_array) {
+ if (index_array) {
int orig_index;
for (i= 0; i<totvert; i++, dm_mv++) {
orig_index= index_array[i];
- if(orig_index != ORIGINDEX_NONE) {
+ if (orig_index != ORIGINDEX_NONE) {
dm_mv->flag= me->mvert[index_array[i]].flag;
}
}
@@ -671,13 +671,13 @@ void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
int a;
me= get_mesh(ob);
- if(me==NULL) return;
+ if (me==NULL) return;
- if(action == SEL_INVERT) {
+ if (action == SEL_INVERT) {
mvert= me->mvert;
a= me->totvert;
- while(a--) {
- if((mvert->flag & ME_HIDE) == 0) {
+ while (a--) {
+ if ((mvert->flag & ME_HIDE) == 0) {
mvert->flag ^= SELECT;
}
mvert++;
@@ -689,8 +689,8 @@ void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
mvert= me->mvert;
a= me->totvert;
- while(a--) {
- if((mvert->flag & ME_HIDE) == 0 && mvert->flag & SELECT) {
+ while (a--) {
+ if ((mvert->flag & ME_HIDE) == 0 && mvert->flag & SELECT) {
action = SEL_DESELECT;
break;
}
@@ -700,8 +700,8 @@ void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
mvert= me->mvert;
a= me->totvert;
- while(a--) {
- if((mvert->flag & ME_HIDE) == 0) {
+ while (a--) {
+ if ((mvert->flag & ME_HIDE) == 0) {
switch (action) {
case SEL_SELECT:
mvert->flag |= SELECT;
@@ -718,7 +718,7 @@ void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
}
}
- if(flush_flags) {
+ if (flush_flags) {
paintvert_flush_flags(ob);
}
}
@@ -763,7 +763,7 @@ int ED_mesh_mirrtopo_recalc_check(Mesh *me, const int ob_mode, MirrTopoStore_t *
totedge = me->totedge;
}
- if( (mesh_topo_store->index_lookup==NULL) ||
+ if ( (mesh_topo_store->index_lookup==NULL) ||
(mesh_topo_store->prev_ob_mode != ob_mode) ||
(totvert != mesh_topo_store->prev_vert_tot) ||
(totedge != mesh_topo_store->prev_edge_tot))
@@ -801,7 +801,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
mesh_topo_store->prev_ob_mode = ob_mode;
- if(em) {
+ if (em) {
BM_mesh_elem_index_ensure(em->bm, BM_VERT);
totvert = em->bm->totvert;
@@ -813,7 +813,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
topo_hash = MEM_callocN(totvert * sizeof(MirrTopoHash_t), "TopoMirr");
/* Initialize the vert-edge-user counts used to detect unique topology */
- if(em) {
+ if (em) {
totedge = me->edit_btmesh->bm->totedge;
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
@@ -824,7 +824,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
else {
totedge = me->totedge;
- for(a=0, medge=me->medge; a < me->totedge; a++, medge++) {
+ for (a=0, medge=me->medge; a < me->totedge; a++, medge++) {
topo_hash[medge->v1]++;
topo_hash[medge->v2]++;
}
@@ -833,17 +833,17 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
topo_hash_prev = MEM_dupallocN(topo_hash);
tot_unique_prev = -1;
- while(1) {
+ while (1) {
/* use the number of edges per vert to give verts unique topology IDs */
- if(em) {
+ if (em) {
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
topo_hash[BM_elem_index_get(eed->v1)] += topo_hash_prev[BM_elem_index_get(eed->v2)];
topo_hash[BM_elem_index_get(eed->v2)] += topo_hash_prev[BM_elem_index_get(eed->v1)];
}
}
else {
- for(a=0, medge=me->medge; a<me->totedge; a++, medge++) {
+ for (a=0, medge=me->medge; a<me->totedge; a++, medge++) {
/* This can make really big numbers, wrapping around here is fine */
topo_hash[medge->v1] += topo_hash_prev[medge->v2];
topo_hash[medge->v2] += topo_hash_prev[medge->v1];
@@ -855,7 +855,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
qsort(topo_hash_prev, totvert, sizeof(MirrTopoHash_t), mirrtopo_hash_sort);
tot_unique = 1; /* account for skiping the first value */
- for(a=1; a<totvert; a++) {
+ for (a=1; a<totvert; a++) {
if (topo_hash_prev[a-1] != topo_hash_prev[a]) {
tot_unique++;
}
@@ -879,14 +879,14 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
/* since we are looping through verts, initialize these values here too */
index_lookup = MEM_mallocN(totvert * sizeof(*index_lookup), "mesh_topo_lookup");
- if(em) {
+ if (em) {
if (skip_em_vert_array_init == FALSE) {
EDBM_init_index_arrays(em,1, 0, 0);
}
}
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
topo_pairs[a].hash = topo_hash[a];
topo_pairs[a].v_index = a;
@@ -901,11 +901,11 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
/* Get the pairs out of the sorted hashes, note, totvert+1 means we can use the previous 2,
* but you cant ever access the last 'a' index of MirrTopoPairs */
- for(a=2; a <= totvert; a++) {
+ for (a=2; a <= totvert; a++) {
/* printf("I %d %ld %d\n", (a-last), MirrTopoPairs[a ].hash, MirrTopoPairs[a ].v_index ); */
if ((a==totvert) || (topo_pairs[a-1].hash != topo_pairs[a].hash)) {
if (a-last==2) {
- if(em) {
+ if (em) {
index_lookup[topo_pairs[a-1].v_index] = (intptr_t)EDBM_get_vert_for_index(em, topo_pairs[a-2].v_index);
index_lookup[topo_pairs[a-2].v_index] = (intptr_t)EDBM_get_vert_for_index(em, topo_pairs[a-1].v_index);
}
@@ -917,7 +917,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
last = a;
}
}
- if(em) {
+ if (em) {
if (skip_em_vert_array_init == FALSE) {
EDBM_free_index_arrays(em);
}
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 1794e5d6e21..d816d33c9df 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -55,7 +55,7 @@
/* returns standard diameter */
static float new_primitive_matrix(bContext *C, float *loc, float *rot, float primmat[][4])
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
View3D *v3d = CTX_wm_view3d(C);
float mat[3][3], rmat[3][3], cmat[3][3], imat[3][3];
@@ -85,11 +85,11 @@ static void make_prim_init(bContext *C, const char *idname,
float *dia, float mat[][4],
int *state, float *loc, float *rot, unsigned int layer)
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
*state = 0;
- if(obedit==NULL || obedit->type!=OB_MESH) {
- obedit= ED_object_add_type(C, OB_MESH, loc, rot, FALSE, layer);
+ if (obedit == NULL || obedit->type != OB_MESH) {
+ obedit = ED_object_add_type(C, OB_MESH, loc, rot, FALSE, layer);
rename_id((ID *)obedit, idname);
rename_id((ID *)obedit->data, idname);
@@ -98,7 +98,9 @@ static void make_prim_init(bContext *C, const char *idname,
ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER); /* rare cases the active layer is messed up */
*state = 1;
}
- else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
+ else {
+ DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
+ }
*dia *= new_primitive_matrix(C, loc, rot, mat);
}
@@ -158,17 +160,17 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op)
void MESH_OT_primitive_plane_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Plane";
- ot->description= "Construct a filled planar mesh with 4 vertices";
- ot->idname= "MESH_OT_primitive_plane_add";
+ ot->name = "Add Plane";
+ ot->description = "Construct a filled planar mesh with 4 vertices";
+ ot->idname = "MESH_OT_primitive_plane_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_plane_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_plane_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -186,7 +188,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op)
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
make_prim_init(C, "Cube", &dia, mat, &state, loc, rot, layer);
- obedit= CTX_data_edit_object(C);
+ obedit = CTX_data_edit_object(C);
me = obedit->data;
em = me->edit_btmesh;
@@ -203,17 +205,17 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op)
void MESH_OT_primitive_cube_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Cube";
- ot->description= "Construct a cube mesh";
- ot->idname= "MESH_OT_primitive_cube_add";
+ ot->name = "Add Cube";
+ ot->description = "Construct a cube mesh";
+ ot->idname = "MESH_OT_primitive_cube_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_cube_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_cube_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -235,7 +237,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
unsigned int layer;
cap_end = RNA_enum_get(op->ptr, "fill_type");
- cap_tri = cap_end==2;
+ cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
make_prim_init(C, "Circle", &dia, mat, &state, loc, rot, layer);
@@ -262,17 +264,17 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Circle";
- ot->description= "Construct a circle mesh";
- ot->idname= "MESH_OT_primitive_circle_add";
+ ot->name = "Add Circle";
+ ot->description = "Construct a circle mesh";
+ ot->idname = "MESH_OT_primitive_circle_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_circle_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_circle_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_int(ot->srna, "vertices", 32, 3, INT_MAX, "Vertices", "", 3, 500);
@@ -294,7 +296,7 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
unsigned int layer;
cap_end = RNA_enum_get(op->ptr, "end_fill_type");
- cap_tri = cap_end==2;
+ cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
make_prim_init(C, "Cylinder", &dia, mat, &state, loc, rot, layer);
@@ -325,17 +327,17 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Cylinder";
- ot->description= "Construct a cylinder mesh";
- ot->idname= "MESH_OT_primitive_cylinder_add";
+ ot->name = "Add Cylinder";
+ ot->description = "Construct a cylinder mesh";
+ ot->idname = "MESH_OT_primitive_cylinder_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_cylinder_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_cylinder_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_int(ot->srna, "vertices", 32, 2, INT_MAX, "Vertices", "", 2, 500);
@@ -359,7 +361,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
unsigned int layer;
cap_end = RNA_enum_get(op->ptr, "end_fill_type");
- cap_tri = cap_end==2;
+ cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
make_prim_init(C, "Cone", &dia, mat, &state, loc, rot, layer);
@@ -387,17 +389,17 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Cone";
- ot->description= "Construct a conic mesh";
- ot->idname= "MESH_OT_primitive_cone_add";
+ ot->name = "Add Cone";
+ ot->description = "Construct a conic mesh";
+ ot->idname = "MESH_OT_primitive_cone_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_cone_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_cone_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_int(ot->srna, "vertices", 32, 2, INT_MAX, "Vertices", "", 2, 500);
@@ -447,17 +449,17 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Grid";
- ot->description= "Construct a grid mesh";
- ot->idname= "MESH_OT_primitive_grid_add";
+ ot->name = "Add Grid";
+ ot->description = "Construct a grid mesh";
+ ot->idname = "MESH_OT_primitive_grid_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_grid_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_grid_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_int(ot->srna, "x_subdivisions", 10, 3, INT_MAX, "X Subdivisions", "", 3, 1000);
@@ -480,7 +482,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, &view_aligned);
if (!view_aligned)
- rot[0] += M_PI/2.0f;
+ rot[0] += M_PI / 2.0f;
make_prim_init(C, "Monkey", &dia, mat, &state, loc, rot, layer);
@@ -499,17 +501,17 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
void MESH_OT_primitive_monkey_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Monkey";
- ot->description= "Construct a Suzanne mesh";
- ot->idname= "MESH_OT_primitive_monkey_add";
+ ot->name = "Add Monkey";
+ ot->description = "Construct a Suzanne mesh";
+ ot->idname = "MESH_OT_primitive_monkey_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_monkey_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_monkey_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -534,7 +536,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
if (!EDBM_CallAndSelectOpf(em, op, "vertout",
"create_uvsphere segments=%i revolutions=%i diameter=%f mat=%m4",
RNA_int_get(op->ptr, "segments"), RNA_int_get(op->ptr, "ring_count"),
- RNA_float_get(op->ptr,"size"), mat))
+ RNA_float_get(op->ptr, "size"), mat))
{
return OPERATOR_CANCELLED;
}
@@ -549,17 +551,17 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add UV Sphere";
- ot->description= "Construct a UV sphere mesh";
- ot->idname= "MESH_OT_primitive_uv_sphere_add";
+ ot->name = "Add UV Sphere";
+ ot->description = "Construct a UV sphere mesh";
+ ot->idname = "MESH_OT_primitive_uv_sphere_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_uvsphere_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_uvsphere_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_int(ot->srna, "segments", 32, 3, INT_MAX, "Segments", "", 3, 500);
@@ -606,17 +608,17 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Ico Sphere";
- ot->description= "Construct an Icosphere mesh";
- ot->idname= "MESH_OT_primitive_ico_sphere_add";
+ ot->name = "Add Ico Sphere";
+ ot->description = "Construct an Icosphere mesh";
+ ot->idname = "MESH_OT_primitive_ico_sphere_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_icosphere_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = add_primitive_icosphere_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_int(ot->srna, "subdivisions", 2, 1, INT_MAX, "Subdivisions", "", 1, 8);
diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c
index 44d4d554ac8..6571af11af5 100644
--- a/source/blender/editors/mesh/editmesh_bvh.c
+++ b/source/blender/editors/mesh/editmesh_bvh.c
@@ -24,6 +24,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
+/** \file blender/editors/mesh/editmesh_bvh.c
+ * \ingroup edmesh
+ */
+
#define IN_EDITMESHBVH
@@ -53,7 +58,7 @@ typedef struct BMBVHTree {
float maxdist; //for nearest point search
float uv[2];
- /*stuff for topological vert search*/
+ /* stuff for topological vert search */
BMVert *v, *curv;
GHash *gh;
float curw, curd;
@@ -96,7 +101,7 @@ BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, Scene *scene, Object *obedit)
tree->scene = scene;
tree->em = em;
tree->bm = em->bm;
- tree->epsilon = FLT_EPSILON*2.0f;
+ tree->epsilon = FLT_EPSILON * 2.0f;
tree->flag = flag;
tree->tree = BLI_bvhtree_new(em->tottri, tree->epsilon, 8, 8);
@@ -106,7 +111,7 @@ BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, Scene *scene, Object *obedit)
BMVert *v;
void *data[3];
- tree->cos = MEM_callocN(sizeof(float)*3*em->bm->totvert, "bmbvh cos");
+ tree->cos = MEM_callocN(sizeof(float) * 3 * em->bm->totvert, "bmbvh cos");
BM_ITER_INDEX(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL, i) {
BM_elem_index_set(v, i); /* set_inline */
copy_v3_v3(tree->cos[i], v->co);
@@ -115,7 +120,7 @@ BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, Scene *scene, Object *obedit)
cage = editbmesh_get_derived_cage_and_final(scene, obedit, em, &final, CD_MASK_DERIVEDMESH);
- cagecos = MEM_callocN(sizeof(float)*3*em->bm->totvert, "bmbvh cagecos");
+ cagecos = MEM_callocN(sizeof(float) * 3 * em->bm->totvert, "bmbvh cagecos");
data[0] = em;
data[1] = cagecos;
@@ -126,18 +131,19 @@ BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, Scene *scene, Object *obedit)
tree->cagecos = cagecos;
- for (i=0; i<em->tottri; i++) {
+ for (i = 0; i < em->tottri; i++) {
if (flag & BMBVH_USE_CAGE) {
copy_v3_v3(cos[0], cagecos[BM_elem_index_get(em->looptris[i][0]->v)]);
copy_v3_v3(cos[1], cagecos[BM_elem_index_get(em->looptris[i][1]->v)]);
copy_v3_v3(cos[2], cagecos[BM_elem_index_get(em->looptris[i][2]->v)]);
- } else {
+ }
+ else {
copy_v3_v3(cos[0], em->looptris[i][0]->v->co);
copy_v3_v3(cos[1], em->looptris[i][1]->v->co);
copy_v3_v3(cos[2], em->looptris[i][2]->v->co);
}
- BLI_bvhtree_insert(tree->tree, i, (float*)cos, 3);
+ BLI_bvhtree_insert(tree->tree, i, (float *)cos, 3);
}
BLI_bvhtree_balance(tree->tree);
@@ -158,14 +164,15 @@ void BMBVH_FreeBVH(BMBVHTree *tree)
MEM_freeN(tree);
}
-/*taken from bvhutils.c*/
+/* taken from bvhutils.c */
static float ray_tri_intersection(const BVHTreeRay *ray, const float UNUSED(m_dist), float *v0,
float *v1, float *v2, float *uv, float UNUSED(e))
{
float dist;
- if(isect_ray_tri_v3((float*)ray->origin, (float*)ray->direction, v0, v1, v2, &dist, uv))
+ if (isect_ray_tri_v3((float *)ray->origin, (float *)ray->direction, v0, v1, v2, &dist, uv)) {
return dist;
+ }
return FLT_MAX;
}
@@ -217,11 +224,13 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo
v2 = tree->em->looptris[hit.index][1]->v;
v3 = tree->em->looptris[hit.index][2]->v;
- for (i=0; i<3; i++) {
- co[i] = v1->co[i] + (v2->co[i] - v1->co[i])*tree->uv[0] + (v3->co[i]-v1->co[i])*tree->uv[1];
+ for (i = 0; i < 3; i++) {
+ co[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) +
+ ((v3->co[i] - v1->co[i]) * tree->uv[1]);
}
copy_v3_v3(hitout, co);
- } else {
+ }
+ else {
copy_v3_v3(hitout, hit.co);
}
@@ -249,10 +258,10 @@ static void vertsearchcallback(void *userdata, int index, const float *UNUSED(co
maxdist = tree->maxdist;
- for (i=0; i<3; i++) {
+ for (i = 0; i < 3; i++) {
sub_v3_v3v3(v, hit->co, ls[i]->v->co);
- dist = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
+ dist = len_v3(v);
if (dist < hit->dist && dist < maxdist) {
copy_v3_v3(hit->co, ls[i]->v->co);
copy_v3_v3(hit->no, ls[i]->v->no);
@@ -267,7 +276,7 @@ BMVert *BMBVH_FindClosestVert(BMBVHTree *tree, float *co, float maxdist)
BVHTreeNearest hit;
copy_v3_v3(hit.co, co);
- hit.dist = maxdist*5;
+ hit.dist = maxdist * 5;
hit.index = -1;
tree->maxdist = maxdist;
@@ -276,14 +285,14 @@ BMVert *BMBVH_FindClosestVert(BMBVHTree *tree, float *co, float maxdist)
if (hit.dist != FLT_MAX && hit.index != -1) {
BMLoop **ls = tree->em->looptris[hit.index];
float dist, curdist = tree->maxdist, v[3];
- int cur=0, i;
+ int cur = 0, i;
maxdist = tree->maxdist;
- for (i=0; i<3; i++) {
+ for (i = 0; i < 3; i++) {
sub_v3_v3v3(v, hit.co, ls[i]->v->co);
- dist = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
+ dist = len_v3(v);
if (dist < curdist) {
cur = i;
curdist = dist;
@@ -303,7 +312,7 @@ typedef struct walklist {
float w, r;
int totwalked;
- /*state data*/
+ /* state data */
BMVert *lastv;
BMLoop *curl, *firstl;
BMEdge *cure;
@@ -312,17 +321,19 @@ typedef struct walklist {
/* UNUSED */
#if 0
static short winding(float *v1, float *v2, float *v3)
-/* is v3 to the right of v1-v2 ? With exception: v3==v1 || v3==v2 */
+/* is v3 to the right of (v1 - v2) ? With exception: v3 == v1 || v3 == v2 */
{
double inp;
- //inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy]) +(v1[coy]-v2[coy])*(v1[cox]-v3[cox]);
- inp= (v2[0]-v1[0])*(v1[1]-v3[1]) +(v1[1]-v2[1])*(v1[0]-v3[0]);
+ //inp = (v2[cox] - v1[cox]) * (v1[coy] - v3[coy]) + (v1[coy] - v2[coy]) * (v1[cox] - v3[cox]);
+ inp = (v2[0] - v1[0]) * (v1[1] - v3[1]) + (v1[1] - v2[1]) * (v1[0] - v3[0]);
- if(inp<0.0) return 0;
- else if(inp==0) {
- if(v1[0]==v3[0] && v1[1]==v3[1]) return 0;
- if(v2[0]==v3[0] && v2[1]==v3[1]) return 0;
+ if (inp < 0.0) {
+ return 0;
+ }
+ else if (inp == 0) {
+ if (v1[0] == v3[0] && v1[1] == v3[1]) return 0;
+ if (v2[0] == v3[0] && v2[1] == v3[1]) return 0;
}
return 1;
}
@@ -366,8 +377,8 @@ int BMBVH_EdgeVisible(BMBVHTree *tree, BMEdge *e, ARegion *ar, View3D *v3d, Obje
return 0;
}
- mval_f[0] = ar->winx/2.0;
- mval_f[1] = ar->winy/2.0;
+ mval_f[0] = ar->winx / 2.0f;
+ mval_f[1] = ar->winy / 2.0f;
ED_view3d_win_to_segment_clip(ar, v3d, mval_f, origin, end);
invert_m4_m4(invmat, obedit->obmat);
@@ -405,7 +416,7 @@ int BMBVH_EdgeVisible(BMBVHTree *tree, BMEdge *e, ARegion *ar, View3D *v3d, Obje
normalize_v3(dir2);
normalize_v3(dir3);
- /*do three samplings: left, middle, right*/
+ /* do three samplings: left, middle, right */
f = edge_ray_cast(tree, co1, dir1, NULL, e);
if (f && !edge_ray_cast(tree, co2, dir2, NULL, e))
return 1;
diff --git a/source/blender/editors/mesh/knifetool.c b/source/blender/editors/mesh/editmesh_knife.c
index e1380e6f1e1..f6367779251 100644
--- a/source/blender/editors/mesh/knifetool.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -19,13 +19,17 @@
* All rights reserved.
*
*
- * Contributor(s): Joseph Eagar, Joshua Leung
+ * Contributor(s): Joseph Eagar, Joshua Leung, Howard Trickey,
+ * Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
-#define _USE_MATH_DEFINES
+/** \file blender/editors/mesh/editmesh_knife.c
+ * \ingroup edmesh
+ */
+#define _USE_MATH_DEFINES
#include "MEM_guardedalloc.h"
@@ -44,7 +48,6 @@
#include "BIF_gl.h"
#include "BIF_glutil.h" /* for paint cursor */
-
#include "ED_screen.h"
#include "ED_space_api.h"
#include "ED_view3d.h"
@@ -62,7 +65,6 @@
/* this code here is kindof messy. . .I might need to eventually rework it - joeedh */
-#define MAXGROUP 30
#define KMAXDIST 10 /* max mouse distance from edge before not detecting it */
/* knifetool operator */
@@ -84,7 +86,7 @@ typedef struct KnifeEdge {
BMFace *basef; /* face to restrict face fill to */
ListBase faces;
int draw;
-
+
BMEdge *e, *oe; /* non-NULL if this is an original edge */
} KnifeEdge;
@@ -99,65 +101,72 @@ typedef struct BMEdgeHit {
BMFace *f;
} BMEdgeHit;
+typedef struct KnifePosData {
+ float co[3];
+ float cage[3];
+
+ /* At most one of vert, edge, or bmface should be non-NULL,
+ * saying whether the point is snapped to a vertex, edge, or in a face.
+ * If none are set, this point is in space and is_space should be true. */
+ KnifeVert *vert;
+ KnifeEdge *edge;
+ BMFace *bmface;
+ int is_space;
+
+ int mval[2]; /* mouse screen position */
+} KnifePosData;
+
/* struct for properties used while drawing */
typedef struct knifetool_opdata {
ARegion *ar; /* region that knifetool was activated in */
void *draw_handle; /* for drawing preview loop */
ViewContext vc;
bContext *C;
-
+
Object *ob;
BMEditMesh *em;
-
+
MemArena *arena;
GHash *origvertmap;
GHash *origedgemap;
-
+
GHash *kedgefacemap;
-
+
BMBVHTree *bmbvh;
BLI_mempool *kverts;
BLI_mempool *kedges;
-
+
float vthresh;
float ethresh;
-
- float vertco[3], vertcage[3];
- float prevco[3], prevcage[3];
-
+
/* used for drag-cutting */
BMEdgeHit *linehits;
int totlinehit;
-
- /* if curedge is NULL, attach to curvert;
- * if curvert is NULL, attach to curbmface,
- * otherwise create null vert */
- KnifeEdge *curedge, *prevedge;
- KnifeVert *curvert, *prevvert;
- BMFace *curbmface, *prevbmface;
-
- int totkedge, totkvert, cutnr;
-
+
+ /* Data for mouse-position-derived data (cur) and previous click (prev) */
+ KnifePosData cur, prev;
+
+ int totkedge, totkvert;
+
BLI_mempool *refs;
-
+
float projmat[4][4];
int is_ortho;
int cut_through;
float clipsta, clipend;
-
+
enum {
MODE_IDLE,
MODE_DRAGGING,
MODE_CONNECT,
MODE_PANNING
} mode;
-
+
int snap_midpoints, prevmode, extend;
int ignore_edge_snapping, ignore_vert_snapping;
- int prevmval[2];
-
+
enum {
ANGLE_FREE,
ANGLE_0,
@@ -166,7 +175,6 @@ typedef struct knifetool_opdata {
ANGLE_135
} angle_snapping;
- int is_space, prev_is_space; /*1 if current cut location, vertco, isn't on the mesh */
float (*cagecos)[3];
} knifetool_opdata;
@@ -180,6 +188,17 @@ static void knife_project_v3(knifetool_opdata *kcd, const float co[3], float sco
ED_view3d_project_float_v3(kcd->ar, co, sco, kcd->projmat);
}
+static void knife_pos_data_clear(KnifePosData *kpd)
+{
+ zero_v3(kpd->co);
+ zero_v3(kpd->cage);
+ kpd->vert = NULL;
+ kpd->edge = NULL;
+ kpd->bmface = NULL;
+ kpd->mval[0] = 0;
+ kpd->mval[1] = 0;
+}
+
static ListBase *knife_empty_list(knifetool_opdata *kcd)
{
ListBase *lst;
@@ -258,19 +277,19 @@ static KnifeEdge *get_bm_knife_edge(knifetool_opdata *kcd, BMEdge *e)
if (!kfe) {
BMIter iter;
BMFace *f;
-
+
kfe = new_knife_edge(kcd);
kfe->e = e;
kfe->v1 = get_bm_knife_vert(kcd, e->v1);
kfe->v2 = get_bm_knife_vert(kcd, e->v2);
knife_add_to_vert_edges(kcd, kfe);
-
+
BLI_ghash_insert(kcd->origedgemap, e, kfe);
-
+
BM_ITER(f, &iter, kcd->em->bm, BM_FACES_OF_EDGE, e) {
knife_append_list(kcd, &kfe->faces, f);
-
+
/* ensures the kedges lst for this f is initialized,
* it automatically adds kfe by itself */
knife_get_face_kedges(kcd, f);
@@ -280,33 +299,26 @@ static KnifeEdge *get_bm_knife_edge(knifetool_opdata *kcd, BMEdge *e)
return kfe;
}
+/* User has just clicked for first time or first time after a restart (E key).
+ * Copy the current position data into prev. */
static void knife_start_cut(knifetool_opdata *kcd)
{
- kcd->prevedge = kcd->curedge;
- kcd->prevvert = kcd->curvert;
- kcd->prevbmface = kcd->curbmface;
- kcd->cutnr++;
- kcd->prev_is_space = kcd->is_space;
- kcd->is_space = 0;
- kcd->prevmval[0] = kcd->vc.mval[0];
- kcd->prevmval[1] = kcd->vc.mval[1];
-
- copy_v3_v3(kcd->prevco, kcd->vertco);
- copy_v3_v3(kcd->prevcage, kcd->vertcage);
-
- if (kcd->prevvert == NULL && kcd->prevedge == NULL && is_zero_v3(kcd->prevcage)) {
+ kcd->prev = kcd->cur;
+ kcd->cur.is_space = 0; /*TODO: why do we do this? */
+
+ if (kcd->prev.vert == NULL && kcd->prev.edge == NULL && is_zero_v3(kcd->prev.cage)) {
/* Make prevcage a point on the view ray to mouse closest to a point on model: choose vertex 0 */
float origin[3], ray[3], co[3];
BMVert *v0;
- knife_input_ray_cast(kcd, kcd->vc.mval, origin, ray);
+ knife_input_ray_cast(kcd, kcd->cur.mval, origin, ray);
add_v3_v3v3(co, origin, ray);
v0 = BM_vert_at_index(kcd->em->bm, 0);
if (v0) {
- closest_to_line_v3(kcd->prevcage, v0->co, co, origin);
- copy_v3_v3(kcd->prevco, kcd->prevcage);
- copy_v3_v3(kcd->vertcage, kcd->prevcage);
- copy_v3_v3(kcd->vertco, kcd->prevco);
+ closest_to_line_v3(kcd->prev.cage, v0->co, co, origin);
+ copy_v3_v3(kcd->prev.co, kcd->prev.cage); /*TODO: do we need this? */
+ copy_v3_v3(kcd->cur.cage, kcd->prev.cage);
+ copy_v3_v3(kcd->cur.co, kcd->prev.co);
}
}
}
@@ -320,7 +332,7 @@ static ListBase *knife_get_face_kedges(knifetool_opdata *kcd, BMFace *f)
BMEdge *e;
lst = knife_empty_list(kcd);
-
+
BM_ITER(e, &iter, kcd->em->bm, BM_EDGES_OF_FACE, f) {
knife_append_list(kcd, lst, get_bm_knife_edge(kcd, e));
}
@@ -339,9 +351,9 @@ static void knife_find_basef(knifetool_opdata *kcd, KnifeEdge *kfe)
if (kfe->v1->isface || kfe->v2->isface) {
if (kfe->v2->isface)
- kfe->basef = kcd->curbmface;
- else
- kfe->basef = kcd->prevbmface;
+ kfe->basef = kcd->cur.bmface;
+ else
+ kfe->basef = kcd->prev.bmface;
}
else {
for (r1 = kfe->v1->edges.first; r1 && !kfe->basef; r1 = r1->next) {
@@ -349,12 +361,12 @@ static void knife_find_basef(knifetool_opdata *kcd, KnifeEdge *kfe)
for (r2 = ke1->faces.first; r2 && !kfe->basef; r2 = r2->next) {
for (r3 = kfe->v2->edges.first; r3 && !kfe->basef; r3 = r3->next) {
KnifeEdge *ke2 = r3->ref;
-
+
for (r4 = ke2->faces.first; r4 && !kfe->basef; r4 = r4->next) {
if (r2->ref == r4->ref) {
kfe->basef = r2->ref;
}
- }
+ }
}
}
}
@@ -408,48 +420,50 @@ static KnifeVert *knife_split_edge(knifetool_opdata *kcd, KnifeEdge *kfe, float
return newkfe->v2;
}
+/* Make a single KnifeEdge for cut from kcd->prev to kcd->cur.
+ * and move cur data to prev. */
static void knife_add_single_cut(knifetool_opdata *kcd)
{
KnifeEdge *kfe = new_knife_edge(kcd), *kfe2 = NULL, *kfe3 = NULL;
- if (kcd->prevvert && kcd->prevvert == kcd->curvert)
+ if (kcd->prev.vert && kcd->prev.vert == kcd->cur.vert)
return;
- if (kcd->prevedge && kcd->prevedge == kcd->curedge)
+ if (kcd->prev.edge && kcd->prev.edge == kcd->cur.edge)
return;
kfe->draw = 1;
- if (kcd->prevvert) {
- kfe->v1 = kcd->prevvert;
+ if (kcd->prev.vert) {
+ kfe->v1 = kcd->prev.vert;
}
- else if (kcd->prevedge) {
- kfe->v1 = knife_split_edge(kcd, kcd->prevedge, kcd->prevco, &kfe2);
+ else if (kcd->prev.edge) {
+ kfe->v1 = knife_split_edge(kcd, kcd->prev.edge, kcd->prev.co, &kfe2);
}
else {
- kfe->v1 = new_knife_vert(kcd, kcd->prevco, kcd->prevco);
- kfe->v1->draw = kfe->draw = !kcd->prev_is_space;
- kfe->v1->inspace = kcd->prev_is_space;
- kfe->draw = !kcd->prev_is_space;
+ kfe->v1 = new_knife_vert(kcd, kcd->prev.co, kcd->prev.co);
+ kfe->v1->draw = kfe->draw = !kcd->prev.is_space;
+ kfe->v1->inspace = kcd->prev.is_space;
+ kfe->draw = !kcd->prev.is_space;
kfe->v1->isface = 1;
}
- if (kcd->curvert) {
- kfe->v2 = kcd->curvert;
+ if (kcd->cur.vert) {
+ kfe->v2 = kcd->cur.vert;
}
- else if (kcd->curedge) {
- kfe->v2 = knife_split_edge(kcd, kcd->curedge, kcd->vertco, &kfe3);
- kcd->curvert = kfe->v2;
+ else if (kcd->cur.edge) {
+ kfe->v2 = knife_split_edge(kcd, kcd->cur.edge, kcd->cur.co, &kfe3);
+ kcd->cur.vert = kfe->v2;
}
else {
- kfe->v2 = new_knife_vert(kcd, kcd->vertco, kcd->vertco);
- kfe->v2->draw = !kcd->is_space;
+ kfe->v2 = new_knife_vert(kcd, kcd->cur.co, kcd->cur.co);
+ kfe->v2->draw = !kcd->cur.is_space;
kfe->v2->isface = 1;
- kfe->v2->inspace = kcd->is_space;
-
- if (kcd->is_space)
+ kfe->v2->inspace = kcd->cur.is_space;
+
+ if (kcd->cur.is_space)
kfe->draw = 0;
- kcd->curvert = kfe->v2;
+ kcd->cur.vert = kfe->v2;
}
knife_find_basef(kcd, kfe);
@@ -460,40 +474,32 @@ static void knife_add_single_cut(knifetool_opdata *kcd)
knife_edge_append_face(kcd, kfe, kfe->basef);
/* sanity check to make sure we're in the right edge/face lists */
- if (kcd->curbmface) {
- if (!find_ref(&kfe->faces, kcd->curbmface)) {
- knife_edge_append_face(kcd, kfe, kcd->curbmface);
+ if (kcd->cur.bmface) {
+ if (!find_ref(&kfe->faces, kcd->cur.bmface)) {
+ knife_edge_append_face(kcd, kfe, kcd->cur.bmface);
}
- if (kcd->prevbmface && kcd->prevbmface != kcd->curbmface) {
- if (!find_ref(&kfe->faces, kcd->prevbmface)) {
- knife_edge_append_face(kcd, kfe, kcd->prevbmface);
+ if (kcd->prev.bmface && kcd->prev.bmface != kcd->cur.bmface) {
+ if (!find_ref(&kfe->faces, kcd->prev.bmface)) {
+ knife_edge_append_face(kcd, kfe, kcd->prev.bmface);
}
}
}
/* set up for next cut */
- kcd->prevbmface = kcd->curbmface;
- kcd->prevvert = kcd->curvert;
- kcd->prevedge = kcd->curedge;
- copy_v3_v3(kcd->prevco, kcd->vertco);
- copy_v3_v3(kcd->prevcage, kcd->vertcage);
- kcd->prev_is_space = kcd->is_space;
- kcd->prevmval[0] = kcd->vc.mval[0];
- kcd->prevmval[1] = kcd->vc.mval[1];
+ kcd->prev = kcd->cur;
}
static int verge_linehit(const void *vlh1, const void *vlh2)
{
const BMEdgeHit *lh1 = vlh1, *lh2 = vlh2;
- if (lh1->l < lh2->l) return -1;
- else if (lh1->l > lh2->l) return 1;
+ if (lh1->l < lh2->l) return -1;
+ else if (lh1->l > lh2->l) return 1;
else return 0;
}
-static void knife_add_single_cut_through(knifetool_opdata *kcd,
- KnifeVert *v1, KnifeVert *v2, BMFace *f)
+static void knife_add_single_cut_through(knifetool_opdata *kcd, KnifeVert *v1, KnifeVert *v2, BMFace *f)
{
KnifeEdge *kfenew;
@@ -548,7 +554,7 @@ static void knife_cut_through(knifetool_opdata *kcd)
BMFace *f;
KnifeEdge *kfe, *kfe2, *kfe3;
KnifeVert *v1, *v2, *firstv = NULL, *lastv = NULL;
- ListBase firstfaces = {NULL, NULL}, lastfaces = { NULL, NULL};
+ ListBase firstfaces = {NULL, NULL}, lastfaces = {NULL, NULL};
Ref *r, *r2;
KnifeEdge **splitkfe;
int i, j, found;
@@ -562,32 +568,32 @@ static void knife_cut_through(knifetool_opdata *kcd)
qsort(kcd->linehits, kcd->totlinehit, sizeof(BMEdgeHit), verge_linehit);
splitkfe = MEM_callocN(kcd->totlinehit * sizeof(KnifeEdge *), "knife_cut_through");
- if (kcd->prevvert) {
- if (kcd->prevvert == kcd->curvert)
+ if (kcd->prev.vert) {
+ if (kcd->prev.vert == kcd->cur.vert)
return;
- firstv = kcd->prevvert;
- knife_get_vert_faces(kcd, firstv, kcd->prevbmface, &firstfaces);
+ firstv = kcd->prev.vert;
+ knife_get_vert_faces(kcd, firstv, kcd->prev.bmface, &firstfaces);
}
- else if (kcd->prevedge) {
- if (kcd->prevedge == kcd->curedge)
+ else if (kcd->prev.edge) {
+ if (kcd->prev.edge == kcd->cur.edge)
return;
- firstv = knife_split_edge(kcd, kcd->prevedge, kcd->prevco, &kfe3);
- knife_get_edge_faces(kcd, kcd->prevedge, &firstfaces);
+ firstv = knife_split_edge(kcd, kcd->prev.edge, kcd->prev.co, &kfe3);
+ knife_get_edge_faces(kcd, kcd->prev.edge, &firstfaces);
}
- if (kcd->curvert) {
- lastv = kcd->curvert;
- knife_get_vert_faces(kcd, lastv, kcd->curbmface, &lastfaces);
+ if (kcd->cur.vert) {
+ lastv = kcd->cur.vert;
+ knife_get_vert_faces(kcd, lastv, kcd->cur.bmface, &lastfaces);
}
- else if (kcd->curedge) {
- lastv = knife_split_edge(kcd, kcd->curedge, kcd->vertco, &kfe3);
- knife_get_edge_faces(kcd, kcd->curedge, &lastfaces);
+ else if (kcd->cur.edge) {
+ lastv = knife_split_edge(kcd, kcd->cur.edge, kcd->cur.co, &kfe3);
+ knife_get_edge_faces(kcd, kcd->cur.edge, &lastfaces);
}
if (firstv) {
/* For each face incident to firstv,
* find the first following linehit (if any) sharing that face and connect */
- for (r = firstfaces.first; r; r = r->next ) {
+ for (r = firstfaces.first; r; r = r->next) {
f = r->ref;
found = 0;
for (j = 0, lh2 = kcd->linehits; j < kcd->totlinehit; j++, lh2++) {
@@ -624,8 +630,8 @@ static void knife_cut_through(knifetool_opdata *kcd)
kfe2 = lh2->kfe;
for (r2 = kfe2->faces.first; r2; r2 = r2->next) {
if (r2->ref == f) {
- v1 = splitkfe[i]? kfe->v1 : knife_split_edge(kcd, kfe, lh->hit, &splitkfe[i]);
- v2 = splitkfe[j]? kfe2->v1 : knife_split_edge(kcd, kfe2, lh2->hit, &splitkfe[j]);
+ v1 = splitkfe[i] ? kfe->v1 : knife_split_edge(kcd, kfe, lh->hit, &splitkfe[i]);
+ v2 = splitkfe[j] ? kfe2->v1 : knife_split_edge(kcd, kfe2, lh2->hit, &splitkfe[j]);
knife_add_single_cut_through(kcd, v1, v2, f);
found = 1;
break;
@@ -635,7 +641,7 @@ static void knife_cut_through(knifetool_opdata *kcd)
if (!found && lastv) {
for (r2 = lastfaces.first; r2; r2 = r2->next) {
if (r2->ref == f) {
- v1 = splitkfe[i]? kfe->v1 : knife_split_edge(kcd, kfe, lh->hit, &splitkfe[i]);
+ v1 = splitkfe[i] ? kfe->v1 : knife_split_edge(kcd, kfe, lh->hit, &splitkfe[i]);
knife_add_single_cut_through(kcd, v1, lastv, f);
break;
}
@@ -650,19 +656,15 @@ static void knife_cut_through(knifetool_opdata *kcd)
kcd->totlinehit = 0;
/* set up for next cut */
- kcd->prevbmface = kcd->curbmface;
- kcd->prevvert = kcd->curvert;
- kcd->prevedge = kcd->curedge;
- copy_v3_v3(kcd->prevco, kcd->vertco);
- copy_v3_v3(kcd->prevcage, kcd->vertcage);
- kcd->prev_is_space = kcd->is_space;
- kcd->prevmval[0] = kcd->vc.mval[0];
- kcd->prevmval[1] = kcd->vc.mval[1];
+ kcd->prev = kcd->cur;
}
+/* User has just left-clicked after the first time.
+ * Add all knife cuts implied by line from prev to cur.
+ * If that line crossed edges then kcd->linehits will be non-NULL. */
static void knife_add_cut(knifetool_opdata *kcd)
{
- knifetool_opdata oldkcd = *kcd;
+ KnifePosData savcur = kcd->cur;
if (kcd->cut_through) {
knife_cut_through(kcd);
@@ -686,57 +688,47 @@ static void knife_add_cut(knifetool_opdata *kcd)
else if (lastlh && firstlh) {
if (firstlh->v || lastlh->v) {
KnifeVert *kfv = firstlh->v ? firstlh->v : lastlh->v;
-
- kcd->prevvert = kfv;
- copy_v3_v3(kcd->prevco, firstlh->hit);
- copy_v3_v3(kcd->prevcage, firstlh->cagehit);
- kcd->prevedge = NULL;
- kcd->prevbmface = f;
+
+ kcd->prev.vert = kfv;
+ copy_v3_v3(kcd->prev.co, firstlh->hit);
+ copy_v3_v3(kcd->prev.cage, firstlh->cagehit);
+ kcd->prev.edge = NULL;
+ kcd->prev.bmface = f;
+ /* TODO: should we set prev.in_space = 0 ? */
}
lastlh = firstlh = NULL;
}
- if (len_v3v3(kcd->prevcage, lh->realhit) < FLT_EPSILON * 80)
+ if (len_v3v3(kcd->prev.cage, lh->realhit) < FLT_EPSILON * 80)
continue;
- if (len_v3v3(kcd->vertcage, lh->realhit) < FLT_EPSILON * 80)
+ if (len_v3v3(kcd->cur.cage, lh->realhit) < FLT_EPSILON * 80)
continue;
- if (kcd->prev_is_space) {
- kcd->prev_is_space = 0;
- copy_v3_v3(kcd->prevco, lh->hit);
- copy_v3_v3(kcd->prevcage, lh->cagehit);
- kcd->prevvert = NULL;
- kcd->prevedge = lh->kfe;
- kcd->prevbmface = lh->f;
+ if (kcd->prev.is_space) {
+ kcd->prev.is_space = 0;
+ copy_v3_v3(kcd->prev.co, lh->hit);
+ copy_v3_v3(kcd->prev.cage, lh->cagehit);
+ kcd->prev.vert = NULL;
+ kcd->prev.edge = lh->kfe;
+ kcd->prev.bmface = lh->f;
continue;
- }
+ }
- kcd->is_space = 0;
- kcd->curedge = lh->kfe;
- kcd->curbmface = lh->f;
- kcd->curvert = lh->v;
- copy_v3_v3(kcd->vertco, lh->hit);
- copy_v3_v3(kcd->vertcage, lh->cagehit);
+ kcd->cur.is_space = 0;
+ kcd->cur.edge = lh->kfe;
+ kcd->cur.bmface = lh->f;
+ kcd->cur.vert = lh->v;
+ copy_v3_v3(kcd->cur.co, lh->hit);
+ copy_v3_v3(kcd->cur.cage, lh->cagehit);
knife_add_single_cut(kcd);
}
- if (oldkcd.is_space) {
- kcd->prevbmface = oldkcd.curbmface;
- kcd->prevvert = oldkcd.curvert;
- kcd->prevedge = oldkcd.curedge;
- copy_v3_v3(kcd->prevco, oldkcd.vertco);
- copy_v3_v3(kcd->prevcage, oldkcd.vertcage);
- kcd->prev_is_space = oldkcd.is_space;
+ if (savcur.is_space) {
+ kcd->prev = savcur;
}
else {
- kcd->curbmface = oldkcd.curbmface;
- kcd->curvert = oldkcd.curvert;
- kcd->curedge = oldkcd.curedge;
- kcd->is_space = oldkcd.is_space;
- copy_v3_v3(kcd->vertco, oldkcd.vertco);
- copy_v3_v3(kcd->vertcage, oldkcd.vertcage);
-
+ kcd->cur = savcur;
knife_add_single_cut(kcd);
}
@@ -762,7 +754,7 @@ static void knifetool_draw_angle_snapping(knifetool_opdata *kcd)
/* make u the window coords of prevcage */
view3d_get_transformation(kcd->ar, kcd->vc.rv3d, kcd->ob, &mats);
- gluProject(kcd->prevcage[0], kcd->prevcage[1], kcd->prevcage[2],
+ gluProject(kcd->prev.cage[0], kcd->prev.cage[1], kcd->prev.cage[2],
mats.modelview, mats.projection, mats.viewport,
&u[0], &u[1], &u[2]);
@@ -855,65 +847,65 @@ static void knifetool_draw_angle_snapping(knifetool_opdata *kcd)
static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
{
knifetool_opdata *kcd = arg;
-
+
glDisable(GL_DEPTH_TEST);
-
+
glPolygonOffset(1.0f, 1.0f);
-
+
glPushMatrix();
glMultMatrixf(kcd->ob->obmat);
-
+
if (kcd->mode == MODE_DRAGGING) {
if (kcd->angle_snapping != ANGLE_FREE)
knifetool_draw_angle_snapping(kcd);
glColor3f(0.1, 0.1, 0.1);
glLineWidth(2.0);
-
+
glBegin(GL_LINES);
- glVertex3fv(kcd->prevcage);
- glVertex3fv(kcd->vertcage);
+ glVertex3fv(kcd->prev.cage);
+ glVertex3fv(kcd->cur.cage);
glEnd();
-
+
glLineWidth(1.0);
}
-
- if (kcd->curedge) {
+
+ if (kcd->cur.edge) {
glColor3f(0.5, 0.3, 0.15);
glLineWidth(2.0);
-
+
glBegin(GL_LINES);
- glVertex3fv(kcd->curedge->v1->cageco);
- glVertex3fv(kcd->curedge->v2->cageco);
+ glVertex3fv(kcd->cur.edge->v1->cageco);
+ glVertex3fv(kcd->cur.edge->v2->cageco);
glEnd();
-
+
glLineWidth(1.0);
}
- else if (kcd->curvert) {
+ else if (kcd->cur.vert) {
glColor3f(0.8, 0.2, 0.1);
glPointSize(11);
-
+
glBegin(GL_POINTS);
- glVertex3fv(kcd->vertcage);
+ glVertex3fv(kcd->cur.cage);
glEnd();
}
-
- if (kcd->curbmface) {
+
+ if (kcd->cur.bmface) {
glColor3f(0.1, 0.8, 0.05);
glPointSize(9);
-
+
glBegin(GL_POINTS);
- glVertex3fv(kcd->vertcage);
+ glVertex3fv(kcd->cur.cage);
glEnd();
}
-
+
if (kcd->totlinehit > 0) {
BMEdgeHit *lh;
int i;
-
+
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
+
/* draw any snapped verts first */
glColor4f(0.8, 0.2, 0.1, 0.4);
glPointSize(11);
@@ -921,11 +913,11 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void
lh = kcd->linehits;
for (i = 0; i < kcd->totlinehit; i++, lh++) {
float sv1[3], sv2[3];
-
+
knife_project_v3(kcd, lh->kfe->v1->cageco, sv1);
knife_project_v3(kcd, lh->kfe->v2->cageco, sv2);
knife_project_v3(kcd, lh->cagehit, lh->schit);
-
+
if (len_v2v2(lh->schit, sv1) < kcd->vthresh / 4.0f) {
copy_v3_v3(lh->cagehit, lh->kfe->v1->cageco);
glVertex3fv(lh->cagehit);
@@ -938,7 +930,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void
}
}
glEnd();
-
+
/* now draw the rest */
glColor4f(0.1, 0.8, 0.05, 0.4);
glPointSize(7);
@@ -950,11 +942,11 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void
glEnd();
glDisable(GL_BLEND);
}
-
+
if (kcd->totkedge > 0) {
BLI_mempool_iter iter;
KnifeEdge *kfe;
-
+
glLineWidth(1.0);
glBegin(GL_LINES);
@@ -962,13 +954,13 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void
for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) {
if (!kfe->draw)
continue;
-
+
glColor3f(0.2, 0.2, 0.2);
-
+
glVertex3fv(kfe->v1->cageco);
glVertex3fv(kfe->v2->cageco);
}
-
+
glEnd();
glLineWidth(1.0);
}
@@ -976,20 +968,20 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void
if (kcd->totkvert > 0) {
BLI_mempool_iter iter;
KnifeVert *kfv;
-
+
glPointSize(5.0);
-
+
glBegin(GL_POINTS);
BLI_mempool_iternew(kcd->kverts, &iter);
for (kfv = BLI_mempool_iterstep(&iter); kfv; kfv = BLI_mempool_iterstep(&iter)) {
if (!kfv->draw)
continue;
-
+
glColor3f(0.6, 0.1, 0.2);
-
+
glVertex3fv(kfv->cageco);
}
-
+
glEnd();
}
@@ -1018,7 +1010,7 @@ static BMEdgeHit *knife_edge_tri_isect(knifetool_opdata *kcd, BMBVHTree *bmtree,
float cos[9], uv[3], lambda;
unsigned int tot = 0;
int i, j;
-
+
/* for comparing distances, error of intersection depends on triangle scale.
* need to scale down before squaring for accurate comparison */
const float depsilon = 50 * FLT_EPSILON * len_v3_tri_side_max(v1, v2, v3);
@@ -1030,37 +1022,37 @@ static BMEdgeHit *knife_edge_tri_isect(knifetool_opdata *kcd, BMBVHTree *bmtree,
BLI_bvhtree_insert(tree2, 0, cos, 3);
BLI_bvhtree_balance(tree2);
-
+
result = results = BLI_bvhtree_overlap(tree, tree2, &tot);
-
+
for (i = 0; i < tot; i++, result++) {
float p[3];
-
+
ls = (BMLoop **)kcd->em->looptris[result->indexA];
-
+
for (j = 0; j < 3; j++) {
BMLoop *l1 = ls[j];
BMFace *hitf;
ListBase *lst = knife_get_face_kedges(kcd, l1->f);
Ref *ref;
-
+
for (ref = lst->first; ref; ref = ref->next) {
KnifeEdge *kfe = ref->ref;
-
- //if (kfe == kcd->curedge || kfe == kcd->prevedge)
+
+ //if (kfe == kcd->cur.edge || kfe == kcd->prev.edge)
// continue;
-
+
if (isect_line_tri_v3(kfe->v1->cageco, kfe->v2->cageco, v1, v2, v3, &lambda, uv)) {
float no[3], view[3], sp[3];
-
+
interp_v3_v3v3(p, kfe->v1->cageco, kfe->v2->cageco, lambda);
-
- if (kcd->curvert && len_squared_v3v3(kcd->curvert->cageco, p) < depsilon_squared)
+
+ if (kcd->cur.vert && len_squared_v3v3(kcd->cur.vert->cageco, p) < depsilon_squared)
continue;
- if (kcd->prevvert && len_squared_v3v3(kcd->prevvert->cageco, p) < depsilon_squared)
+ if (kcd->prev.vert && len_squared_v3v3(kcd->prev.vert->cageco, p) < depsilon_squared)
continue;
- if ( len_squared_v3v3(kcd->prevcage, p) < depsilon_squared ||
- len_squared_v3v3(kcd->vertcage, p) < depsilon_squared)
+ if (len_squared_v3v3(kcd->prev.cage, p) < depsilon_squared ||
+ len_squared_v3v3(kcd->cur.cage, p) < depsilon_squared)
{
continue;
}
@@ -1086,28 +1078,28 @@ static BMEdgeHit *knife_edge_tri_isect(knifetool_opdata *kcd, BMBVHTree *bmtree,
/* ray cast */
hitf = BMBVH_RayCast(bmtree, p, no, NULL, NULL);
}
-
+
/* ok, if visible add the new point */
if (!hitf && !BLI_smallhash_haskey(ehash, (intptr_t)kfe)) {
BMEdgeHit hit;
- if ( len_squared_v3v3(p, kcd->vertco) < depsilon_squared ||
- len_squared_v3v3(p, kcd->prevco) < depsilon_squared)
+ if (len_squared_v3v3(p, kcd->cur.co) < depsilon_squared ||
+ len_squared_v3v3(p, kcd->prev.co) < depsilon_squared)
{
continue;
}
-
+
hit.kfe = kfe;
hit.v = NULL;
-
+
knife_find_basef(kcd, kfe);
hit.f = kfe->basef;
hit.perc = len_v3v3(p, kfe->v1->cageco) / len_v3v3(kfe->v1->cageco, kfe->v2->cageco);
copy_v3_v3(hit.cagehit, p);
-
+
interp_v3_v3v3(p, kfe->v1->co, kfe->v2->co, hit.perc);
copy_v3_v3(hit.realhit, p);
-
+
/* BMESH_TODO: should also snap to vertices */
if (kcd->snap_midpoints) {
float perc = hit.perc;
@@ -1122,7 +1114,7 @@ static BMEdgeHit *knife_edge_tri_isect(knifetool_opdata *kcd, BMBVHTree *bmtree,
else {
perc = 1.0f;
}
-
+
interp_v3_v3v3(hit.hit, kfe->v1->co, kfe->v2->co, perc);
interp_v3_v3v3(hit.cagehit, kfe->v1->cageco, kfe->v2->cageco, perc);
}
@@ -1130,7 +1122,7 @@ static BMEdgeHit *knife_edge_tri_isect(knifetool_opdata *kcd, BMBVHTree *bmtree,
copy_v3_v3(hit.hit, p);
}
knife_project_v3(kcd, hit.cagehit, hit.schit);
-
+
BLI_array_append(edges, hit);
BLI_smallhash_insert(ehash, (intptr_t)kfe, NULL);
}
@@ -1138,13 +1130,13 @@ static BMEdgeHit *knife_edge_tri_isect(knifetool_opdata *kcd, BMBVHTree *bmtree,
}
}
}
-
+
if (results)
MEM_freeN(results);
-
+
BLI_bvhtree_free(tree2);
*count = BLI_array_count(edges);
-
+
return edges;
}
@@ -1163,7 +1155,7 @@ static void knife_find_line_hits(knifetool_opdata *kcd)
SmallHash hash, *ehash = &hash;
float v1[3], v2[3], v3[3], v4[4], s1[3], s2[3];
int i, c1, c2;
-
+
knife_bgl_get_mats(kcd, &mats);
if (kcd->linehits) {
@@ -1172,8 +1164,8 @@ static void knife_find_line_hits(knifetool_opdata *kcd)
kcd->totlinehit = 0;
}
- copy_v3_v3(v1, kcd->prevcage);
- copy_v3_v3(v2, kcd->vertcage);
+ copy_v3_v3(v1, kcd->prev.cage);
+ copy_v3_v3(v2, kcd->cur.cage);
/* project screen line's 3d coordinates back into 2d */
knife_project_v3(kcd, v1, s1);
@@ -1191,6 +1183,16 @@ static void knife_find_line_hits(knifetool_opdata *kcd)
mul_m4_v3(kcd->ob->imat, v3);
mul_m4_v3(kcd->ob->imat, v4);
+ /* numeric error, 'v1' -> 'v2', 'v2' -> 'v4' can end up being ~2000 units apart in otho mode
+ * (from ED_view3d_win_to_segment_clip() above)
+ * this gives precision error in 'knife_edge_tri_isect', rather then solving properly
+ * (which may involve using doubles everywhere!),
+ * limit the distance between these points */
+ if (kcd->is_ortho) {
+ limit_dist_v3(v1, v3, 200.0f);
+ limit_dist_v3(v2, v4, 200.0f);
+ }
+
BLI_smallhash_init(ehash);
/* test two triangles of sceen line's plane */
@@ -1249,33 +1251,32 @@ static void knife_input_ray_cast(knifetool_opdata *kcd, const int mval_i[2],
mul_m3_v3(imat, r_ray);
}
-
static BMFace *knife_find_closest_face(knifetool_opdata *kcd, float co[3], float cageco[3], int *is_space)
{
BMFace *f;
int dist = KMAXDIST;
float origin[3];
float ray[3];
-
+
/* unproject to find view ray */
knife_input_ray_cast(kcd, kcd->vc.mval, origin, ray);
add_v3_v3v3(co, origin, ray);
f = BMBVH_RayCast(kcd->bmbvh, origin, ray, co, cageco);
-
+
if (is_space)
*is_space = !f;
-
+
if (!f) {
/* try to use backbuffer selection method if ray casting failed */
f = EDBM_findnearestface(&kcd->vc, &dist);
-
+
/* cheat for now; just put in the origin instead
* of a true coordinate on the face.
* This just puts a point 1.0f infront of the view. */
add_v3_v3v3(co, origin, ray);
}
-
+
return f;
}
@@ -1286,35 +1287,35 @@ static int knife_sample_screen_density(knifetool_opdata *kcd, float radius)
BMFace *f;
int is_space;
float co[3], cageco[3], sco[3];
-
+
f = knife_find_closest_face(kcd, co, cageco, &is_space);
-
+
if (f && !is_space) {
ListBase *lst;
Ref *ref;
float dis;
int c = 0;
-
+
knife_project_v3(kcd, cageco, sco);
-
+
lst = knife_get_face_kedges(kcd, f);
for (ref = lst->first; ref; ref = ref->next) {
KnifeEdge *kfe = ref->ref;
int i;
-
+
for (i = 0; i < 2; i++) {
KnifeVert *kfv = i ? kfe->v2 : kfe->v1;
-
+
knife_project_v3(kcd, kfv->cageco, kfv->sco);
-
+
dis = len_v2v2(kfv->sco, sco);
if (dis < radius) {
if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
float vec[3];
-
+
copy_v3_v3(vec, kfv->cageco);
mul_m4_v3(kcd->vc.obedit->obmat, vec);
-
+
if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, TRUE) == 0) {
c++;
}
@@ -1325,10 +1326,10 @@ static int knife_sample_screen_density(knifetool_opdata *kcd, float radius)
}
}
}
-
+
return c;
}
-
+
return 0;
}
@@ -1337,9 +1338,9 @@ static int knife_sample_screen_density(knifetool_opdata *kcd, float radius)
static float knife_snap_size(knifetool_opdata *kcd, float maxsize)
{
float density = (float)knife_sample_screen_density(kcd, maxsize * 2.0f);
-
+
density = MAX2(density, 1);
-
+
return MIN2(maxsize / (density * 0.5f), maxsize);
}
@@ -1348,32 +1349,32 @@ static KnifeEdge *knife_find_closest_edge(knifetool_opdata *kcd, float p[3], flo
{
BMFace *f;
float co[3], cageco[3], sco[3], maxdist = knife_snap_size(kcd, kcd->ethresh);
-
+
if (kcd->ignore_vert_snapping)
maxdist *= 0.5;
f = knife_find_closest_face(kcd, co, cageco, NULL);
*is_space = !f;
-
+
/* set p to co, in case we don't find anything, means a face cut */
copy_v3_v3(p, co);
copy_v3_v3(cagep, cageco);
-
- kcd->curbmface = f;
-
+
+ kcd->cur.bmface = f;
+
if (f) {
KnifeEdge *cure = NULL;
ListBase *lst;
Ref *ref;
float dis, curdis = FLT_MAX;
-
+
knife_project_v3(kcd, cageco, sco);
-
+
/* look through all edges associated with this face */
lst = knife_get_face_kedges(kcd, f);
for (ref = lst->first; ref; ref = ref->next) {
KnifeEdge *kfe = ref->ref;
-
+
/* project edge vertices into screen space */
knife_project_v3(kcd, kfe->v1->cageco, kfe->v1->sco);
knife_project_v3(kcd, kfe->v2->cageco, kfe->v2->sco);
@@ -1383,12 +1384,12 @@ static KnifeEdge *knife_find_closest_edge(knifetool_opdata *kcd, float p[3], flo
if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
float labda = labda_PdistVL2Dfl(sco, kfe->v1->sco, kfe->v2->sco);
float vec[3];
-
+
vec[0] = kfe->v1->cageco[0] + labda * (kfe->v2->cageco[0] - kfe->v1->cageco[0]);
vec[1] = kfe->v1->cageco[1] + labda * (kfe->v2->cageco[1] - kfe->v1->cageco[1]);
vec[2] = kfe->v1->cageco[2] + labda * (kfe->v2->cageco[2] - kfe->v1->cageco[2]);
mul_m4_v3(kcd->vc.obedit->obmat, vec);
-
+
if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, TRUE) == 0) {
cure = kfe;
curdis = dis;
@@ -1400,10 +1401,10 @@ static KnifeEdge *knife_find_closest_edge(knifetool_opdata *kcd, float p[3], flo
}
}
}
-
+
if (fptr)
*fptr = f;
-
+
if (cure && p) {
if (!kcd->ignore_edge_snapping || !(cure->e)) {
if (kcd->snap_midpoints) {
@@ -1412,7 +1413,7 @@ static KnifeEdge *knife_find_closest_edge(knifetool_opdata *kcd, float p[3], flo
}
else {
float d;
-
+
closest_to_line_segment_v3(cagep, cageco, cure->v1->cageco, cure->v2->cageco);
d = len_v3v3(cagep, cure->v1->cageco) / len_v3v3(cure->v1->cageco, cure->v2->cageco);
interp_v3_v3v3(p, cure->v1->co, cure->v2->co, d);
@@ -1422,58 +1423,59 @@ static KnifeEdge *knife_find_closest_edge(knifetool_opdata *kcd, float p[3], flo
return NULL;
}
}
-
+
return cure;
}
-
+
if (fptr)
*fptr = NULL;
-
+
return NULL;
}
/* find a vertex near the mouse cursor, if it exists */
-static KnifeVert *knife_find_closest_vert(knifetool_opdata *kcd, float p[3], float cagep[3], BMFace **fptr, int *is_space)
+static KnifeVert *knife_find_closest_vert(knifetool_opdata *kcd, float p[3], float cagep[3], BMFace **fptr,
+ int *is_space)
{
BMFace *f;
float co[3], cageco[3], sco[3], maxdist = knife_snap_size(kcd, kcd->vthresh);
-
+
if (kcd->ignore_vert_snapping)
maxdist *= 0.5;
-
+
f = knife_find_closest_face(kcd, co, cageco, is_space);
-
+
/* set p to co, in case we don't find anything, means a face cut */
copy_v3_v3(p, co);
copy_v3_v3(cagep, p);
- kcd->curbmface = f;
-
+ kcd->cur.bmface = f;
+
if (f) {
ListBase *lst;
Ref *ref;
KnifeVert *curv = NULL;
float dis, curdis = FLT_MAX;
-
+
knife_project_v3(kcd, cageco, sco);
-
+
lst = knife_get_face_kedges(kcd, f);
for (ref = lst->first; ref; ref = ref->next) {
KnifeEdge *kfe = ref->ref;
int i;
-
+
for (i = 0; i < 2; i++) {
KnifeVert *kfv = i ? kfe->v2 : kfe->v1;
-
+
knife_project_v3(kcd, kfv->cageco, kfv->sco);
-
+
dis = len_v2v2(kfv->sco, sco);
if (dis < curdis && dis < maxdist) {
if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
float vec[3];
-
+
copy_v3_v3(vec, kfv->cageco);
mul_m4_v3(kcd->vc.obedit->obmat, vec);
-
+
if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, TRUE) == 0) {
curv = kfv;
curdis = dis;
@@ -1486,29 +1488,29 @@ static KnifeVert *knife_find_closest_vert(knifetool_opdata *kcd, float p[3], flo
}
}
}
-
+
if (!kcd->ignore_vert_snapping || !(curv && curv->v)) {
if (fptr)
*fptr = f;
-
+
if (curv && p) {
copy_v3_v3(p, curv->co);
copy_v3_v3(cagep, curv->cageco);
}
-
+
return curv;
}
else {
if (fptr)
*fptr = f;
-
+
return NULL;
}
}
-
+
if (fptr)
*fptr = NULL;
-
+
return NULL;
}
@@ -1517,30 +1519,30 @@ static void knife_snap_angle(knifetool_opdata *kcd)
int dx, dy;
float w, abs_tan;
- dx = kcd->vc.mval[0] - kcd->prevmval[0];
- dy = kcd->vc.mval[1] - kcd->prevmval[1];
+ dx = kcd->vc.mval[0] - kcd->prev.mval[0];
+ dy = kcd->vc.mval[1] - kcd->prev.mval[1];
if (dx == 0 || dy == 0)
return;
w = (float)dy / (float)dx;
abs_tan = fabsf(w);
- if (abs_tan <= 0.4142f) { /* tan(22.5 degrees) = 0.4142 */
+ if (abs_tan <= 0.4142f) { /* tan(22.5 degrees) = 0.4142 */
kcd->angle_snapping = ANGLE_0;
- kcd->vc.mval[1] = kcd->prevmval[1];
+ kcd->vc.mval[1] = kcd->prev.mval[1];
}
else if (abs_tan < 2.4142f) { /* tan(67.5 degrees) = 2.4142 */
if (w > 0) {
kcd->angle_snapping = ANGLE_45;
- kcd->vc.mval[1] = kcd->prevmval[1] + dx;
+ kcd->vc.mval[1] = kcd->prev.mval[1] + dx;
}
else {
kcd->angle_snapping = ANGLE_135;
- kcd->vc.mval[1] = kcd->prevmval[1] - dx;
+ kcd->vc.mval[1] = kcd->prev.mval[1] - dx;
}
}
else {
kcd->angle_snapping = ANGLE_90;
- kcd->vc.mval[0] = kcd->prevmval[0];
+ kcd->vc.mval[0] = kcd->prev.mval[0];
}
}
@@ -1550,24 +1552,26 @@ static int knife_update_active(knifetool_opdata *kcd)
if (kcd->angle_snapping != ANGLE_FREE && kcd->mode == MODE_DRAGGING)
knife_snap_angle(kcd);
- kcd->curvert = NULL; kcd->curedge = NULL; kcd->curbmface = NULL;
+ knife_pos_data_clear(&kcd->cur);
+ kcd->cur.mval[0] = kcd->vc.mval[0];
+ kcd->cur.mval[1] = kcd->vc.mval[1];
- kcd->curvert = knife_find_closest_vert(kcd, kcd->vertco, kcd->vertcage, &kcd->curbmface, &kcd->is_space);
- if (!kcd->curvert) {
- kcd->curedge = knife_find_closest_edge(kcd, kcd->vertco, kcd->vertcage, &kcd->curbmface, &kcd->is_space);
+ kcd->cur.vert = knife_find_closest_vert(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
+ if (!kcd->cur.vert) {
+ kcd->cur.edge = knife_find_closest_edge(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
}
- /* if no hits are found this would normally default to (0,0,0) so instead
+ /* if no hits are found this would normally default to (0, 0, 0) so instead
* get a point at the mouse ray closest to the previous point.
* Note that drawing lines in `free-space` isn't properly supported
- * but theres no guarantee (0,0,0) has any geometry either - campbell */
- if (kcd->curvert == NULL && kcd->curedge == NULL) {
- float origin[3], ray[3], co[3];
+ * but theres no guarantee (0, 0, 0) has any geometry either - campbell */
+ if (kcd->cur.vert == NULL && kcd->cur.edge == NULL) {
+ float origin[3], ray[3], co[3];
- knife_input_ray_cast(kcd, kcd->vc.mval, origin, ray);
- add_v3_v3v3(co, origin, ray);
+ knife_input_ray_cast(kcd, kcd->vc.mval, origin, ray);
+ add_v3_v3v3(co, origin, ray);
- closest_to_line_v3(kcd->vertcage, kcd->prevcage, co, origin);
+ closest_to_line_v3(kcd->cur.cage, kcd->prev.cage, co, origin);
}
if (kcd->mode == MODE_DRAGGING) {
@@ -1595,9 +1599,9 @@ typedef struct facenet_entry {
static void rnd_offset_co(float co[3], float scale)
{
int i;
-
+
for (i = 0; i < 3; i++) {
- co[i] += (BLI_drand()-0.5)*scale;
+ co[i] += (BLI_drand() - 0.5) * scale;
}
}
@@ -1613,62 +1617,62 @@ static void remerge_faces(knifetool_opdata *kcd)
BLI_array_declare(faces);
BMOperator bmop;
int idx;
-
+
BMO_op_initf(bm, &bmop, "beautify_fill faces=%ff constrain_edges=%fe", FACE_NEW, BOUNDARY);
-
+
BMO_op_exec(bm, &bmop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", FACE_NEW, BM_FACE);
-
+ BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE, FACE_NEW);
+
BMO_op_finish(bm, &bmop);
-
+
BLI_smallhash_init(visit);
BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
BMIter eiter;
BMEdge *e;
BMFace *f2;
-
+
if (!BMO_elem_flag_test(bm, f, FACE_NEW))
continue;
-
+
if (BLI_smallhash_haskey(visit, (intptr_t)f))
continue;
-
+
BLI_array_empty(stack);
BLI_array_empty(faces);
BLI_array_append(stack, f);
BLI_smallhash_insert(visit, (intptr_t)f, NULL);
-
+
do {
f2 = BLI_array_pop(stack);
-
+
BLI_array_append(faces, f2);
-
+
BM_ITER(e, &eiter, bm, BM_EDGES_OF_FACE, f2) {
BMIter fiter;
BMFace *f3;
-
+
if (BMO_elem_flag_test(bm, e, BOUNDARY))
continue;
-
+
BM_ITER(f3, &fiter, bm, BM_FACES_OF_EDGE, e) {
if (!BMO_elem_flag_test(bm, f3, FACE_NEW))
continue;
if (BLI_smallhash_haskey(visit, (intptr_t)f3))
continue;
-
+
BLI_smallhash_insert(visit, (intptr_t)f3, NULL);
BLI_array_append(stack, f3);
}
- }
+ }
} while (BLI_array_count(stack) > 0);
-
+
if (BLI_array_count(faces) > 0) {
idx = BM_elem_index_get(faces[0]);
-
+
f2 = BM_faces_join(bm, faces, BLI_array_count(faces));
if (f2) {
BMO_elem_flag_enable(bm, f2, FACE_NEW);
- BM_elem_index_set(f2, idx); /* set_dirty! */ /* BMESH_TODO, check if this is valid or not */
+ BM_elem_index_set(f2, idx); /* set_dirty! *//* BMESH_TODO, check if this is valid or not */
}
}
}
@@ -1698,7 +1702,7 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
MemArena *arena = BLI_memarena_new(1 << 16, "knifenet_fill_faces");
SmallHash shash;
int i, j, k = 0, totface = bm->totface;
-
+
BMO_push(bm, NULL);
bmesh_edit_begin(bm, BMO_OP_FLAG_UNTAN_MULTIRES);
@@ -1710,7 +1714,7 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
i++;
}
bm->elem_index_dirty &= ~BM_FACE;
-
+
BM_ITER(e, &bmiter, bm, BM_EDGES_OF_MESH, NULL) {
BMO_elem_flag_enable(bm, e, BOUNDARY);
}
@@ -1731,9 +1735,9 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
BMO_elem_flag_enable(bm, kfv->v, MARK);
}
-
+
/* we want to only do changed faces. first, go over new edges and add to
- * face net lists.*/
+ * face net lists.*/
i = j = k = 0;
BLI_mempool_iternew(kcd->kedges, &iter);
for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) {
@@ -1747,9 +1751,9 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
kfe->oe = kfe->e;
continue;
}
-
+
j++;
-
+
if (kfe->e) {
kfe->oe = kfe->e;
@@ -1757,37 +1761,37 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
BMO_elem_flag_disable(bm, kfe->e, BOUNDARY);
kfe->e = NULL;
}
-
+
kfe->e = BM_edge_create(bm, kfe->v1->v, kfe->v2->v, NULL, TRUE);
BMO_elem_flag_enable(bm, kfe->e, BOUNDARY);
-
+
for (ref = kfe->faces.first; ref; ref = ref->next) {
f = ref->ref;
-
+
entry = BLI_memarena_alloc(arena, sizeof(*entry));
entry->kfe = kfe;
BLI_addtail(face_nets + BM_elem_index_get(f), entry);
}
}
-
+
/* go over original edges, and add to faces with new geometry */
BLI_mempool_iternew(kcd->kedges, &iter);
for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) {
Ref *ref;
-
+
if (!kfe->v1 || !kfe->v2 || kfe->v1->inspace || kfe->v2->inspace)
continue;
if (!(kfe->oe && kfe->v1->v == kfe->oe->v1 && kfe->v2->v == kfe->oe->v2))
continue;
-
+
k++;
-
+
BMO_elem_flag_enable(bm, kfe->e, BOUNDARY);
kfe->oe = kfe->e;
-
+
for (ref = kfe->faces.first; ref; ref = ref->next) {
f = ref->ref;
-
+
if (face_nets[BM_elem_index_get(f)].first) {
entry = BLI_memarena_alloc(arena, sizeof(*entry));
entry->kfe = kfe;
@@ -1795,22 +1799,22 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
}
}
}
-
+
for (i = 0; i < totface; i++) {
SmallHash *hash = &shash;
ScanFillFace *efa;
ScanFillVert *eve, *lasteve;
int j;
float rndscale = FLT_EPSILON * 25;
-
+
f = faces[i];
BLI_smallhash_init(hash);
-
+
if (face_nets[i].first)
BMO_elem_flag_enable(bm, f, DEL);
-
+
BLI_begin_edgefill();
-
+
for (entry = face_nets[i].first; entry; entry = entry->next) {
if (!BLI_smallhash_haskey(hash, (intptr_t)entry->kfe->v1)) {
eve = BLI_addfillvert(entry->kfe->v1->v->co);
@@ -1826,27 +1830,27 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
rnd_offset_co(eve->co, rndscale);
eve->tmp.p = entry->kfe->v2->v;
BLI_smallhash_insert(hash, (intptr_t)entry->kfe->v2, eve);
- }
+ }
}
-
+
for (j = 0, entry = face_nets[i].first; entry; entry = entry->next, j++) {
lasteve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v1);
eve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v2);
-
+
eve->poly_nr++;
lasteve->poly_nr++;
}
-
+
for (j = 0, entry = face_nets[i].first; entry; entry = entry->next, j++) {
lasteve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v1);
eve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v2);
-
+
if (eve->poly_nr > 1 && lasteve->poly_nr > 1) {
ScanFillEdge *eed;
eed = BLI_addfilledge(lasteve, eve);
if (entry->kfe->oe)
- eed->f = FILLBOUNDARY; /* mark as original boundary edge */
-
+ eed->f = FILLBOUNDARY; /* mark as original boundary edge */
+
BMO_elem_flag_disable(bm, entry->kfe->e->v1, DEL);
BMO_elem_flag_disable(bm, entry->kfe->e->v2, DEL);
}
@@ -1857,45 +1861,45 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
BLI_remlink(&fillvertbase, eve);
}
}
-
+
BLI_edgefill(0);
-
+
for (efa = fillfacebase.first; efa; efa = efa->next) {
BMVert *v1 = efa->v3->tmp.p, *v2 = efa->v2->tmp.p, *v3 = efa->v1->tmp.p;
BMFace *f2;
BMLoop *l_iter;
BMVert *verts[3] = {v1, v2, v3};
-
+
if (v1 == v2 || v2 == v3 || v1 == v3)
continue;
if (BM_face_exists(bm, verts, 3, &f2))
continue;
-
+
f2 = BM_face_create_quad_tri(bm,
- v1, v2, v3, NULL,
- NULL, FALSE);
+ v1, v2, v3, NULL,
+ NULL, FALSE);
BMO_elem_flag_enable(bm, f2, FACE_NEW);
-
+
l_iter = BM_FACE_FIRST_LOOP(f2);
do {
BMO_elem_flag_disable(bm, l_iter->e, DEL);
} while ((l_iter = l_iter->next) != BM_FACE_FIRST_LOOP(f2));
-
+
BMO_elem_flag_disable(bm, f2, DEL);
- BM_elem_index_set(f2, i); /* set_dirty! */ /* note, not 100% sure this is dirty? need to check */
+ BM_elem_index_set(f2, i); /* set_dirty! *//* note, not 100% sure this is dirty? need to check */
BM_face_normal_update(bm, f2);
if (dot_v3v3(f->no, f2->no) < 0.0f) {
BM_face_normal_flip(bm, f2);
}
}
-
+
BLI_end_edgefill();
BLI_smallhash_release(hash);
}
bm->elem_index_dirty |= BM_FACE;
-
+
/* interpolate customdata */
BM_ITER(f, &bmiter, bm, BM_FACES_OF_MESH, NULL) {
BMLoop *l1;
@@ -1904,14 +1908,14 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
if (!BMO_elem_flag_test(bm, f, FACE_NEW))
continue;
-
+
f2 = faces[BM_elem_index_get(f)];
if (BM_elem_index_get(f) < 0 || BM_elem_index_get(f) >= totface) {
fprintf(stderr, "%s: face index out of range! (bmesh internal error)\n", __func__);
}
BM_elem_attrs_copy(bm, bm, f2, f);
-
+
BM_ITER(l1, &liter1, bm, BM_LOOPS_OF_FACE, f) {
BM_loop_interp_from_face(bm, l1, f2, TRUE, TRUE);
}
@@ -1930,7 +1934,7 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
if (faces)
MEM_freeN(faces);
BLI_memarena_free(arena);
-
+
BMO_error_clear(bm); /* remerge_faces sometimes raises errors, so make sure to clear them */
bmesh_edit_end(bm, BMO_OP_FLAG_UNTAN_MULTIRES);
@@ -1940,7 +1944,8 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
#else /* use direct (non-scanfill) method for cuts */
/* assuming v is on line ab, what fraction of the way is v from a to b? */
-static float frac_along(const float a[3], const float b[3], const float v[3]) {
+static float frac_along(const float a[3], const float b[3], const float v[3])
+{
float lab;
lab = len_v3v3(a, b);
@@ -1953,7 +1958,8 @@ static float frac_along(const float a[3], const float b[3], const float v[3]) {
}
/* sort list of kverts by fraction along edge e */
-static void sort_by_frac_along(ListBase *lst, BMEdge *e) {
+static void sort_by_frac_along(ListBase *lst, BMEdge *e)
+{
KnifeVert *vcur, *vprev;
float *v1co, *v2co;
Ref *cur = NULL, *prev = NULL, *next = NULL;
@@ -1985,8 +1991,9 @@ static void sort_by_frac_along(ListBase *lst, BMEdge *e) {
/* The chain so far goes from an instantiated vertex to kfv (some may be reversed).
* If possible, complete the chain to another instantiated vertex and return 1, else return 0.
* The visited hash says which KnifeVert's have already been tried, not including kfv. */
-static int find_chain_search(knifetool_opdata *kcd, KnifeVert *kfv,
- ListBase *fedges, SmallHash *visited, ListBase *chain) {
+static int find_chain_search(knifetool_opdata *kcd, KnifeVert *kfv, ListBase *fedges, SmallHash *visited,
+ ListBase *chain)
+{
Ref *r;
KnifeEdge *kfe;
KnifeVert *kfv_other;
@@ -2016,8 +2023,8 @@ static int find_chain_search(knifetool_opdata *kcd, KnifeVert *kfv,
return FALSE;
}
-static ListBase * find_chain_from_vertex(knifetool_opdata *kcd, KnifeEdge *kfe,
- BMVert *v, ListBase *fedges) {
+static ListBase * find_chain_from_vertex(knifetool_opdata *kcd, KnifeEdge *kfe, BMVert *v, ListBase *fedges)
+{
SmallHash visited_, *visited = &visited_;
ListBase *ans;
int found;
@@ -2046,7 +2053,8 @@ static ListBase * find_chain_from_vertex(knifetool_opdata *kcd, KnifeEdge *kfe,
/* Find a chain in fedges from one instantiated vertex to another.
* Remove the edges in the chain from fedges and return a separate list of the chain. */
-static ListBase * find_chain(knifetool_opdata *kcd, ListBase *fedges) {
+static ListBase * find_chain(knifetool_opdata *kcd, ListBase *fedges)
+{
Ref *r, *ref;
KnifeEdge *kfe;
BMVert *v1, *v2;
@@ -2084,8 +2092,9 @@ static ListBase * find_chain(knifetool_opdata *kcd, ListBase *fedges) {
/* The hole so far goes from kfvfirst to kfv (some may be reversed).
* If possible, complete the hole back to kfvfirst and return 1, else return 0.
* The visited hash says which KnifeVert's have already been tried, not including kfv or kfvfirst. */
-static int find_hole_search(knifetool_opdata *kcd, KnifeVert *kfvfirst, KnifeVert *kfv,
- ListBase *fedges, SmallHash *visited, ListBase *hole) {
+static int find_hole_search(knifetool_opdata *kcd, KnifeVert *kfvfirst, KnifeVert *kfv, ListBase *fedges,
+ SmallHash *visited, ListBase *hole)
+{
Ref *r;
KnifeEdge *kfe, *kfelast;
KnifeVert *kfv_other;
@@ -2099,6 +2108,8 @@ static int find_hole_search(knifetool_opdata *kcd, KnifeVert *kfvfirst, KnifeVer
kfe = r->ref;
if (kfe == kfelast)
continue;
+ if (kfe->v1->v || kfe->v2->v)
+ continue;
kfv_other = NULL;
if (kfe->v1 == kfv)
kfv_other = kfe->v2;
@@ -2116,7 +2127,8 @@ static int find_hole_search(knifetool_opdata *kcd, KnifeVert *kfvfirst, KnifeVer
/* Find a hole (simple cycle with no instantiated vertices).
* Remove the edges in the cycle from fedges and return a separate list of the cycle */
-static ListBase *find_hole(knifetool_opdata *kcd, ListBase *fedges) {
+static ListBase *find_hole(knifetool_opdata *kcd, ListBase *fedges)
+{
ListBase *ans;
Ref *r, *ref;
KnifeEdge *kfe;
@@ -2158,14 +2170,15 @@ static ListBase *find_hole(knifetool_opdata *kcd, ListBase *fedges) {
* If found, return TRUE and make a 'main chain' going across f which uses
* the two diagonals and one part of the hole, and a 'side chain' that
* completes the hole. */
-static int find_hole_chains(knifetool_opdata *kcd, ListBase *hole, BMFace *f,
- ListBase **mainchain, ListBase **sidechain) {
+static int find_hole_chains(knifetool_opdata *kcd, ListBase *hole, BMFace *f, ListBase **mainchain,
+ ListBase **sidechain)
+{
float **fco, **hco;
BMVert **fv;
KnifeVert **hv;
KnifeEdge **he;
Ref *r;
- KnifeVert *kfv;
+ KnifeVert *kfv, *kfvother;
KnifeEdge *kfe;
ListBase *chain;
BMVert *v;
@@ -2190,30 +2203,38 @@ static int find_hole_chains(knifetool_opdata *kcd, ListBase *hole, BMFace *f,
i = 0;
kfv = NULL;
+ kfvother = NULL;
for (r = hole->first; r; r = r->next) {
kfe = r->ref;
he[i] = kfe;
- kfv = (kfv == kfe->v1)? kfe->v2 : kfe->v1;
- hco[i] = BLI_memarena_alloc(kcd->arena, 2*sizeof(float));
+ if (kfvother == NULL) {
+ kfv = kfe->v1;
+ }
+ else {
+ kfv = kfvother;
+ BLI_assert(kfv == kfe->v1 || kfv == kfe->v2);
+ }
+ hco[i] = BLI_memarena_alloc(kcd->arena, 2 * sizeof(float));
hco[i][0] = kfv->co[ax];
hco[i][1] = kfv->co[ay];
hv[i] = kfv;
+ kfvother = (kfe->v1 == kfv) ? kfe->v2 : kfe->v1;
i++;
}
j = 0;
BM_ITER(v, &iter, kcd->em->bm, BM_VERTS_OF_FACE, f) {
- fco[j] = BLI_memarena_alloc(kcd->arena, 2*sizeof(float));
+ fco[j] = BLI_memarena_alloc(kcd->arena, 2 * sizeof(float));
fco[j][0] = v->co[ax];
fco[j][1] = v->co[ay];
fv[j] = v;
j++;
}
- /* For first diagonal (m==0), want shortest length.
- * For second diagonal (m==1), want max separation of index of hole
+ /* For first diagonal (m == 0), want shortest length.
+ * For second diagonal (m == 1), want max separation of index of hole
* vertex from the hole vertex used in the first diagonal, and from there
- * want the one with shortest length. */
+ * want the one with shortest length not to the same vertex as the first diagonal. */
for (m = 0; m < 2; m++) {
besti[m] = -1;
bestj[m] = -1;
@@ -2230,23 +2251,25 @@ static int find_hole_chains(knifetool_opdata *kcd, ListBase *hole, BMFace *f,
bestd = FLT_MAX;
}
for (j = 0; j < nf; j++) {
+ if (m == 1 && j == bestj[0])
+ continue;
d = len_squared_v2v2(hco[i], fco[j]);
if (d > bestd)
continue;
ok = TRUE;
for (k = 0; k < nh && ok; k++) {
- if (k == i || (k+1) % nh == i)
+ if (k == i || (k + 1) % nh == i)
continue;
- if (isect_line_line_v2(hco[i], fco[j], hco[k], hco[(k+1) % nh]))
+ if (isect_line_line_v2(hco[i], fco[j], hco[k], hco[(k + 1) % nh]))
ok = FALSE;
}
if (!ok)
continue;
for (k = 0; k < nf && ok; k++) {
- if (k == j || (k+1) % nf == j)
+ if (k == j || (k + 1) % nf == j)
continue;
- if (isect_line_line_v2(hco[i], fco[j], fco[k], fco[(k+1) % nf]))
+ if (isect_line_line_v2(hco[i], fco[j], fco[k], fco[(k + 1) % nf]))
ok = FALSE;
}
if (ok) {
@@ -2261,12 +2284,13 @@ static int find_hole_chains(knifetool_opdata *kcd, ListBase *hole, BMFace *f,
}
if (besti[0] != -1 && besti[1] != -1) {
+ BLI_assert(besti[0] != besti[1] && bestj[0] != bestj[1]);
kfe = new_knife_edge(kcd);
kfe->v1 = get_bm_knife_vert(kcd, fv[bestj[0]]);
kfe->v2 = hv[besti[0]];
chain = knife_empty_list(kcd);
knife_append_list(kcd, chain, kfe);
- for (i = besti[0]; i != besti[1]; i = (i+1) % nh) {
+ for (i = besti[0]; i != besti[1]; i = (i + 1) % nh) {
knife_append_list(kcd, chain, he[i]);
}
kfe = new_knife_edge(kcd);
@@ -2276,7 +2300,7 @@ static int find_hole_chains(knifetool_opdata *kcd, ListBase *hole, BMFace *f,
*mainchain = chain;
chain = knife_empty_list(kcd);
- for (i = besti[1]; i != besti[0]; i = (i+1) % nh) {
+ for (i = besti[1]; i != besti[0]; i = (i + 1) % nh) {
knife_append_list(kcd, chain, he[i]);
}
*sidechain = chain;
@@ -2288,13 +2312,18 @@ static int find_hole_chains(knifetool_opdata *kcd, ListBase *hole, BMFace *f,
}
}
-static int knife_edge_in_face(knifetool_opdata *kcd, KnifeEdge *kfe, BMFace *f) {
+static int knife_edge_in_face(knifetool_opdata *kcd, KnifeEdge *kfe, BMFace *f)
+{
BMesh *bm = kcd->em->bm;
BMVert *v1, *v2;
- BMLoop *l1, *l2, *l, *loops[2];
+ BMLoop *l1, *l2, *l;
+ float mid[3];
BMIter iter;
int v1inside, v2inside;
+ if (!f)
+ return FALSE;
+
v1 = kfe->v1->v;
v2 = kfe->v2->v;
l1 = NULL;
@@ -2315,24 +2344,25 @@ static int knife_edge_in_face(knifetool_opdata *kcd, KnifeEdge *kfe, BMFace *f)
return TRUE;
if (l1 && l2) {
/* Can have case where v1 and v2 are on shared chain between two faces.
- * BM_face_legal_splits does visibility and self-intersection tests. */
- loops[0] = l1;
- loops[1] = l2;
- BM_face_legal_splits(bm, f, (BMLoop *(*)[2])loops, 1);
- return (loops[0] != NULL);
+ * BM_face_legal_splits does visibility and self-intersection tests,
+ * but it is expensive and maybe a bit buggy, so use a simple
+ * "is the midpoint in the face" test */
+ mid_v3_v3v3(mid, kfe->v1->co, kfe->v2->co);
+ return BM_face_point_inside_test(bm, f, mid);
}
return FALSE;
}
/* Split face f with KnifeEdges on chain. f remains as one side, the face formed is put in *newface.
* The new face will be on the left side of the chain as viewed from the normal-out side of f. */
-static void knife_make_chain_cut(knifetool_opdata *kcd, BMFace *f, ListBase *chain, BMFace **newface) {
+static void knife_make_chain_cut(knifetool_opdata *kcd, BMFace *f, ListBase *chain, BMFace **newface)
+{
BMesh *bm = kcd->em->bm;
KnifeEdge *kfe, *kfelast;
BMVert *v1, *v2;
BMFace *fnew;
Ref *ref;
- KnifeVert *kfv, *kfvprev;
+ KnifeVert *kfv, *kfvprev;
BMLoop *lnew, *l_iter;
int i;
int nco = BLI_countlist(chain) - 1;
@@ -2347,29 +2377,38 @@ static void knife_make_chain_cut(knifetool_opdata *kcd, BMFace *f, ListBase *cha
v2 = kfelast->v2->v ? kfelast->v2->v : kfelast->v1->v;
BLI_assert(v1 != NULL && v2 != NULL);
kfvprev = kfe->v1->v == v1 ? kfe->v1 : kfe->v2;
- for (ref = chain->first, i=0; i < nco && ref != chain->last; ref = ref->next, i++) {
+ for (ref = chain->first, i = 0; i < nco && ref != chain->last; ref = ref->next, i++) {
kfe = ref->ref;
BLI_assert(kfvprev == kfe->v1 || kfvprev == kfe->v2);
- kfv = kfe->v1 == kfvprev? kfe->v2 : kfe->v1;
+ kfv = kfe->v1 == kfvprev ? kfe->v2 : kfe->v1;
copy_v3_v3(cos[i], kfv->co);
kverts[i] = kfv;
kfvprev = kfv;
}
BLI_assert(i == nco);
- fnew = BM_face_split_n(bm, f, v1, v2, cos, nco, &lnew, NULL);
- *newface = fnew;
-
- /* Now go through lnew chain matching up chain kv's and assign real v's to them */
- for (l_iter = lnew->next, i = 0; i < nco; l_iter = l_iter->next, i++) {
- BLI_assert(equals_v3v3(cos[i], l_iter->v->co));
- kverts[i]->v = l_iter->v;
+ lnew = NULL;
+ if (nco == 0) {
+ *newface = BM_face_split(bm, f, v1, v2, &lnew, NULL, TRUE);
+ }
+ else {
+ fnew = BM_face_split_n(bm, f, v1, v2, cos, nco, &lnew, NULL);
+ *newface = fnew;
+
+ if (fnew) {
+ /* Now go through lnew chain matching up chain kv's and assign real v's to them */
+ for (l_iter = lnew->next, i = 0; i < nco; l_iter = l_iter->next, i++) {
+ BLI_assert(equals_v3v3(cos[i], l_iter->v->co));
+ kverts[i]->v = l_iter->v;
+ }
+ }
}
BLI_array_fixedstack_free(cos);
BLI_array_fixedstack_free(kverts);
}
-static void knife_make_face_cuts(knifetool_opdata *kcd, BMFace *f, ListBase *kfedges) {
+static void knife_make_face_cuts(knifetool_opdata *kcd, BMFace *f, ListBase *kfedges)
+{
BMesh *bm = kcd->em->bm;
KnifeEdge *kfe;
BMFace *fnew, *fnew2, *fhole;
@@ -2381,6 +2420,10 @@ static void knife_make_face_cuts(knifetool_opdata *kcd, BMFace *f, ListBase *kfe
oldcount = BLI_countlist(kfedges);
while ((chain = find_chain(kcd, kfedges)) != NULL) {
knife_make_chain_cut(kcd, f, chain, &fnew);
+ if (!fnew) {
+ BLI_assert("!knife failed chain cut");
+ return;
+ }
/* Move kfedges to fnew_kfedges if they are now in fnew.
* The chain edges were removed already */
@@ -2413,6 +2456,10 @@ static void knife_make_face_cuts(knifetool_opdata *kcd, BMFace *f, ListBase *kfe
* from the second last vertex to the second vertex.
*/
knife_make_chain_cut(kcd, f, chain, &fnew);
+ if (!fnew) {
+ BLI_assert(!"knife failed hole cut");
+ return;
+ }
kfe = ((Ref *)sidechain->first)->ref;
if (knife_edge_in_face(kcd, kfe, f)) {
knife_make_chain_cut(kcd, f, sidechain, &fnew2);
@@ -2423,8 +2470,8 @@ static void knife_make_face_cuts(knifetool_opdata *kcd, BMFace *f, ListBase *kfe
fhole = fnew2;
}
else {
- /* shouldn't happen */
- BLI_assert(0);
+ /* shouldn't happen except in funny edge cases */
+ return;
}
BM_face_kill(bm, fhole);
/* Move kfedges to either fnew or fnew2 if appropriate.
@@ -2502,7 +2549,7 @@ static void knife_make_cuts(knifetool_opdata *kcd)
BLI_mempool_iternew(kcd->kverts, &iter);
for (kfv = BLI_mempool_iterstep(&iter); kfv; kfv = BLI_mempool_iterstep(&iter)) {
if (kfv->v)
- continue; /* already have a BMVert */
+ continue; /* already have a BMVert */
for (ref = kfv->edges.first; ref; ref = ref->next) {
kfe = ref->ref;
e = kfe->e;
@@ -2545,15 +2592,15 @@ static void knife_make_cuts(knifetool_opdata *kcd)
static void knifetool_finish(bContext *C, wmOperator *op)
{
knifetool_opdata *kcd = op->customdata;
-
+
#if SCANFILL_CUTS
knifenet_fill_faces(kcd);
#else
knife_make_cuts(kcd);
#endif
-
+
DAG_id_tag_update(kcd->ob->data, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, kcd->ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, kcd->ob->data);
}
/* copied from paint_image.c */
@@ -2573,29 +2620,29 @@ static int project_knife_view_clip(View3D *v3d, RegionView3D *rv3d, float *clips
static void knife_recalc_projmat(knifetool_opdata *kcd)
{
ARegion *ar = CTX_wm_region(kcd->C);
-
+
if (!ar)
return;
-
+
invert_m4_m4(kcd->ob->imat, kcd->ob->obmat);
ED_view3d_ob_project_mat_get(ar->regiondata, kcd->ob, kcd->projmat);
//mult_m4_m4m4(kcd->projmat, kcd->vc.rv3d->winmat, kcd->vc.rv3d->viewmat);
-
+
kcd->is_ortho = project_knife_view_clip(kcd->vc.v3d, kcd->vc.rv3d,
&kcd->clipsta, &kcd->clipend);
}
/* called when modal loop selection is done... */
-static void knifetool_exit (bContext *UNUSED(C), wmOperator *op)
+static void knifetool_exit(bContext *UNUSED(C), wmOperator *op)
{
knifetool_opdata *kcd = op->customdata;
-
+
if (!kcd)
return;
-
+
/* deactivate the extra drawing stuff in 3D-View */
ED_region_draw_cb_exit(kcd->ar->type, kcd->draw_handle);
-
+
/* free the custom data */
BLI_mempool_destroy(kcd->refs);
BLI_mempool_destroy(kcd->kverts);
@@ -2604,10 +2651,10 @@ static void knifetool_exit (bContext *UNUSED(C), wmOperator *op)
BLI_ghash_free(kcd->origedgemap, NULL, NULL);
BLI_ghash_free(kcd->origvertmap, NULL, NULL);
BLI_ghash_free(kcd->kedgefacemap, NULL, NULL);
-
+
BMBVH_FreeBVH(kcd->bmbvh);
BLI_memarena_free(kcd->arena);
-
+
/* tag for redraw */
ED_region_tag_redraw(kcd->ar);
@@ -2619,14 +2666,13 @@ static void knifetool_exit (bContext *UNUSED(C), wmOperator *op)
op->customdata = NULL;
}
-static void cage_mapped_verts_callback(void *userData, int index, float *co,
- float *UNUSED(no_f), short *UNUSED(no_s))
+static void cage_mapped_verts_callback(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
void **data = userData;
BMEditMesh *em = data[0];
float (*cagecos)[3] = data[1];
SmallHash *hash = data[2];
-
+
if (index >= 0 && index < em->bm->totvert && !BLI_smallhash_haskey(hash, index)) {
BLI_smallhash_insert(hash, index, NULL);
copy_v3_v3(cagecos[index], co);
@@ -2642,10 +2688,10 @@ static int knifetool_init(bContext *C, wmOperator *op, int UNUSED(do_cut))
DerivedMesh *cage, *final;
SmallHash shash;
void *data[3];
-
+
/* alloc new customdata */
kcd = op->customdata = MEM_callocN(sizeof(knifetool_opdata), "knifetool Modal Op Data");
-
+
/* assign the drawing handle for drawing preview line... */
kcd->ob = obedit;
kcd->ar = CTX_wm_region(C);
@@ -2662,26 +2708,26 @@ static int knifetool_init(bContext *C, wmOperator *op, int UNUSED(do_cut))
data[0] = kcd->em;
data[1] = kcd->cagecos;
data[2] = &shash;
-
+
BLI_smallhash_init(&shash);
cage->foreachMappedVert(cage, cage_mapped_verts_callback, data);
BLI_smallhash_release(&shash);
-
- kcd->bmbvh = BMBVH_NewBVH(kcd->em, BMBVH_USE_CAGE|BMBVH_RETURN_ORIG, scene, obedit);
+
+ kcd->bmbvh = BMBVH_NewBVH(kcd->em, BMBVH_USE_CAGE | BMBVH_RETURN_ORIG, scene, obedit);
kcd->arena = BLI_memarena_new(1 << 15, "knife");
kcd->vthresh = KMAXDIST - 1;
kcd->ethresh = KMAXDIST;
-
+
kcd->extend = 1;
-
+
knife_recalc_projmat(kcd);
-
+
ED_region_tag_redraw(kcd->ar);
-
+
kcd->refs = BLI_mempool_create(sizeof(Ref), 1, 2048, 0);
kcd->kverts = BLI_mempool_create(sizeof(KnifeVert), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
kcd->kedges = BLI_mempool_create(sizeof(KnifeEdge), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
-
+
kcd->origedgemap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife origedgemap");
kcd->origvertmap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife origvertmap");
kcd->kedgefacemap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife origvertmap");
@@ -2689,17 +2735,20 @@ static int knifetool_init(bContext *C, wmOperator *op, int UNUSED(do_cut))
/* cut all the way through the mesh if use_occlude_geometry button not pushed */
kcd->cut_through = !(kcd->vc.v3d->flag & V3D_ZBUF_SELECT);
+ knife_pos_data_clear(&kcd->cur);
+ knife_pos_data_clear(&kcd->prev);
+
return 1;
}
-static int knifetool_cancel (bContext *C, wmOperator *op)
+static int knifetool_cancel(bContext *C, wmOperator *op)
{
/* this is just a wrapper around exit() */
knifetool_exit(C, op);
return OPERATOR_CANCELLED;
}
-static int knifetool_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+static int knifetool_invoke(bContext *C, wmOperator *op, wmEvent *evt)
{
knifetool_opdata *kcd;
@@ -2707,14 +2756,18 @@ static int knifetool_invoke (bContext *C, wmOperator *op, wmEvent *evt)
if (!knifetool_init(C, op, 0))
return OPERATOR_CANCELLED;
-
+
/* add a modal handler for this operator - handles loop selection */
WM_event_add_modal_handler(C, op);
kcd = op->customdata;
kcd->vc.mval[0] = evt->mval[0];
kcd->vc.mval[1] = evt->mval[1];
-
+
+ ED_area_headerprint(CTX_wm_area(C),
+ "LMB: define cut lines, Return or RMB: confirm, E: new cut, Ctrl: midpoint snap, "
+ "Shift: ignore snap, C: angle constrain, Turn off limit selection to visibile: cut through");
+
return OPERATOR_RUNNING_MODAL;
}
@@ -2733,27 +2786,27 @@ enum {
wmKeyMap *knifetool_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
- {KNF_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
- {KNF_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
- {KNF_MODAL_MIDPOINT_ON, "SNAP_MIDPOINTS_ON", 0, "Snap To Midpoints On", ""},
- {KNF_MODAL_MIDPOINT_OFF, "SNAP_MIDPOINTS_OFF", 0, "Snap To Midpoints Off", ""},
- {KNF_MODEL_IGNORE_SNAP_ON, "IGNORE_SNAP_ON", 0, "Ignore Snapping On", ""},
- {KNF_MODEL_IGNORE_SNAP_OFF, "IGNORE_SNAP_OFF", 0, "Ignore Snapping Off", ""},
- {KNF_MODAL_ANGLE_SNAP_TOGGLE, "ANGLE_SNAP_TOGGLE", 0, "Toggle Angle Snapping", ""},
- {KNF_MODAL_NEW_CUT, "NEW_CUT", 0, "End Current Cut", ""},
- {KNF_MODAL_ADD_CUT, "ADD_CUT", 0, "Add Cut", ""},
-
- {0, NULL, 0, NULL, NULL}};
-
+ {KNF_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
+ {KNF_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
+ {KNF_MODAL_MIDPOINT_ON, "SNAP_MIDPOINTS_ON", 0, "Snap To Midpoints On", ""},
+ {KNF_MODAL_MIDPOINT_OFF, "SNAP_MIDPOINTS_OFF", 0, "Snap To Midpoints Off", ""},
+ {KNF_MODEL_IGNORE_SNAP_ON, "IGNORE_SNAP_ON", 0, "Ignore Snapping On", ""},
+ {KNF_MODEL_IGNORE_SNAP_OFF, "IGNORE_SNAP_OFF", 0, "Ignore Snapping Off", ""},
+ {KNF_MODAL_ANGLE_SNAP_TOGGLE, "ANGLE_SNAP_TOGGLE", 0, "Toggle Angle Snapping", ""},
+ {KNF_MODAL_NEW_CUT, "NEW_CUT", 0, "End Current Cut", ""},
+ {KNF_MODAL_ADD_CUT, "ADD_CUT", 0, "Add Cut", ""},
+ {0, NULL, 0, NULL, NULL}};
+
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Knife Tool Modal Map");
-
+
/* this function is called for each spacetype, only needs to add map once */
- if (keymap) return NULL;
-
+ if (keymap)
+ return NULL;
+
keymap = WM_modalkeymap_add(keyconf, "Knife Tool Modal Map", modal_items);
-
+
/* items for modal map */
- WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, KNF_MODAL_CANCEL);
+ WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, KNF_MODAL_CANCEL);
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, KNF_MODAL_ADD_CUT);
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_PRESS, KM_ANY, 0, KNF_MODAL_CONFIRM);
WM_modalkeymap_add_item(keymap, RETKEY, KM_PRESS, KM_ANY, 0, KNF_MODAL_CONFIRM);
@@ -2769,51 +2822,54 @@ wmKeyMap *knifetool_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, KNF_MODEL_IGNORE_SNAP_OFF);
WM_modalkeymap_add_item(keymap, RIGHTSHIFTKEY, KM_PRESS, KM_ANY, 0, KNF_MODEL_IGNORE_SNAP_ON);
WM_modalkeymap_add_item(keymap, RIGHTSHIFTKEY, KM_RELEASE, KM_ANY, 0, KNF_MODEL_IGNORE_SNAP_OFF);
-
+
WM_modalkeymap_add_item(keymap, CKEY, KM_PRESS, 0, 0, KNF_MODAL_ANGLE_SNAP_TOGGLE);
WM_modalkeymap_assign(keymap, "MESH_OT_knifetool");
-
+
return keymap;
}
-static int knifetool_modal (bContext *C, wmOperator *op, wmEvent *event)
+static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
{
Object *obedit;
knifetool_opdata *kcd = op->customdata;
-
+
if (!C) {
return OPERATOR_FINISHED;
}
-
+
obedit = CTX_data_edit_object(C);
if (!obedit || obedit->type != OB_MESH || BMEdit_FromObject(obedit) != kcd->em) {
knifetool_exit(C, op);
+ ED_area_headerprint(CTX_wm_area(C), NULL);
return OPERATOR_FINISHED;
}
view3d_operator_needs_opengl(C);
-
+
if (kcd->mode == MODE_PANNING)
kcd->mode = kcd->prevmode;
-
+
/* handle modal keymap */
if (event->type == EVT_MODAL_MAP) {
switch (event->val) {
case KNF_MODAL_CANCEL:
/* finish */
ED_region_tag_redraw(kcd->ar);
-
+
knifetool_exit(C, op);
-
+ ED_area_headerprint(CTX_wm_area(C), NULL);
+
return OPERATOR_CANCELLED;
case KNF_MODAL_CONFIRM:
/* finish */
ED_region_tag_redraw(kcd->ar);
-
+
knifetool_finish(C, op);
knifetool_exit(C, op);
-
+ ED_area_headerprint(CTX_wm_area(C), NULL);
+
return OPERATOR_FINISHED;
case KNF_MODAL_MIDPOINT_ON:
kcd->snap_midpoints = 1;
@@ -2859,10 +2915,10 @@ static int knifetool_modal (bContext *C, wmOperator *op, wmEvent *event)
knife_start_cut(kcd);
kcd->mode = MODE_DRAGGING;
}
-
+
ED_region_tag_redraw(kcd->ar);
break;
- }
+ }
}
else { /* non-modal-mapped events */
switch (event->type) {
@@ -2878,41 +2934,41 @@ static int knifetool_modal (bContext *C, wmOperator *op, wmEvent *event)
else {
kcd->mode = kcd->prevmode;
}
-
+
ED_region_tag_redraw(kcd->ar);
return OPERATOR_PASS_THROUGH;
-
- case MOUSEMOVE: /* mouse moved somewhere to select another loop */
+
+ case MOUSEMOVE: /* mouse moved somewhere to select another loop */
if (kcd->mode != MODE_PANNING) {
knife_recalc_projmat(kcd);
kcd->vc.mval[0] = event->mval[0];
kcd->vc.mval[1] = event->mval[1];
-
- if (knife_update_active(kcd))
+
+ if (knife_update_active(kcd))
ED_region_tag_redraw(kcd->ar);
}
-
+
break;
}
}
-
+
/* keep going until the user confirms */
return OPERATOR_RUNNING_MODAL;
}
-void MESH_OT_knifetool (wmOperatorType *ot)
+void MESH_OT_knifetool(wmOperatorType *ot)
{
/* description */
ot->name = "Knife Topology Tool";
ot->idname = "MESH_OT_knifetool";
ot->description = "Cut new topology";
-
+
/* callbacks */
ot->invoke = knifetool_invoke;
ot->modal = knifetool_modal;
ot->cancel = knifetool_cancel;
ot->poll = ED_operator_editmesh_view3d;
-
+
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
}
diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 86469ae5461..b409ee16e25 100644
--- a/source/blender/editors/mesh/loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -24,11 +24,10 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/loopcut.c
+/** \file blender/editors/mesh/editmesh_loopcut.c
* \ingroup edmesh
*/
-
#include <float.h>
#define _USE_MATH_DEFINES
#include <math.h>
@@ -113,7 +112,7 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
int i;
if (lcd->totedge > 0) {
- if(v3d && v3d->zbuf)
+ if (v3d && v3d->zbuf)
glDisable(GL_DEPTH_TEST);
glPushMatrix();
@@ -121,20 +120,20 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
glColor3ub(255, 0, 255);
glBegin(GL_LINES);
- for (i=0; i<lcd->totedge; i++) {
+ for (i = 0; i < lcd->totedge; i++) {
glVertex3fv(lcd->edges[i][0]);
glVertex3fv(lcd->edges[i][1]);
}
glEnd();
glPopMatrix();
- if(v3d && v3d->zbuf)
+ if (v3d && v3d->zbuf)
glEnable(GL_DEPTH_TEST);
}
}
/* given two opposite edges in a face, finds the ordering of their vertices so
- * that cut preview lines won't cross each other*/
+ * that cut preview lines won't cross each other */
static void edgering_find_order(BMEditMesh *em, BMEdge *lasteed, BMEdge *eed,
BMVert *lastv1, BMVert *v[2][2])
{
@@ -144,7 +143,7 @@ static void edgering_find_order(BMEditMesh *em, BMEdge *lasteed, BMEdge *eed,
l = eed->l;
- /*find correct order for v[1]*/
+ /* find correct order for v[1] */
if (!(BM_edge_in_face(l->f, eed) && BM_edge_in_face(l->f, lasteed))) {
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_LOOP, l) {
if (BM_edge_in_face(l->f, eed) && BM_edge_in_face(l->f, lasteed))
@@ -152,7 +151,7 @@ static void edgering_find_order(BMEditMesh *em, BMEdge *lasteed, BMEdge *eed,
}
}
- /*this should never happen*/
+ /* this should never happen */
if (!l) {
v[0][0] = eed->v1;
v[0][1] = eed->v2;
@@ -170,7 +169,8 @@ static void edgering_find_order(BMEditMesh *em, BMEdge *lasteed, BMEdge *eed,
if (l2->v == lastv1) {
v[0][0] = eed->v1;
v[0][1] = eed->v2;
- } else {
+ }
+ else {
v[0][0] = eed->v2;
v[0][1] = eed->v1;
}
@@ -186,7 +186,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
float (*edges)[2][3] = NULL;
BLI_array_declare(edges);
float co[2][3];
- int i, tot=0;
+ int i, tot = 0;
memset(v, 0, sizeof(v));
@@ -209,7 +209,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
BMW_NIL_LAY);
eed = BMW_begin(&walker, startedge);
- for (; eed; eed=BMW_step(&walker)) {
+ for ( ; eed; eed = BMW_step(&walker)) {
BM_elem_select_set(em->bm, eed, TRUE);
}
BMW_end(&walker);
@@ -223,12 +223,13 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
eed = startedge = BMW_begin(&walker, startedge);
lastv1 = NULL;
- for (lasteed=NULL; eed; eed=BMW_step(&walker)) {
+ for (lasteed = NULL; eed; eed = BMW_step(&walker)) {
if (lasteed) {
if (lastv1) {
v[1][0] = v[0][0];
v[1][1] = v[0][1];
- } else {
+ }
+ else {
v[1][0] = lasteed->v1;
v[1][1] = lasteed->v2;
lastv1 = lasteed->v1;
@@ -237,14 +238,14 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
edgering_find_order(em, lasteed, eed, lastv1, v);
lastv1 = v[0][0];
- 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];
- co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1])*(i/((float)previewlines+1))+v[0][0]->co[1];
- co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2])*(i/((float)previewlines+1))+v[0][0]->co[2];
+ 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];
+ co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1]) * (i / ((float)previewlines + 1)) + v[0][0]->co[1];
+ co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2]) * (i / ((float)previewlines + 1)) + v[0][0]->co[2];
- co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0])*(i/((float)previewlines+1))+v[1][0]->co[0];
- co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1])*(i/((float)previewlines+1))+v[1][0]->co[1];
- co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2])*(i/((float)previewlines+1))+v[1][0]->co[2];
+ co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0]) * (i / ((float)previewlines + 1)) + v[1][0]->co[0];
+ co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1]) * (i / ((float)previewlines + 1)) + v[1][0]->co[1];
+ co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2]) * (i / ((float)previewlines + 1)) + v[1][0]->co[2];
BLI_array_growone(edges);
copy_v3_v3(edges[tot][0], co[0]);
@@ -261,17 +262,17 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
edgering_find_order(em, lasteed, startedge, lastv1, v);
- for(i=1;i<=previewlines;i++){
+ for (i = 1; i <= previewlines; i++) {
if (!v[0][0] || !v[0][1] || !v[1][0] || !v[1][1])
continue;
- co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0])*(i/((float)previewlines+1))+v[0][0]->co[0];
- co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1])*(i/((float)previewlines+1))+v[0][0]->co[1];
- co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2])*(i/((float)previewlines+1))+v[0][0]->co[2];
+ co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0]) * (i / ((float)previewlines + 1)) + v[0][0]->co[0];
+ co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1]) * (i / ((float)previewlines + 1)) + v[0][0]->co[1];
+ co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2]) * (i / ((float)previewlines + 1)) + v[0][0]->co[2];
- co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0])*(i/((float)previewlines+1))+v[1][0]->co[0];
- co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1])*(i/((float)previewlines+1))+v[1][0]->co[1];
- co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2])*(i/((float)previewlines+1))+v[1][0]->co[2];
+ co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0]) * (i / ((float)previewlines + 1)) + v[1][0]->co[0];
+ co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1]) * (i / ((float)previewlines + 1)) + v[1][0]->co[1];
+ co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2]) * (i / ((float)previewlines + 1)) + v[1][0]->co[2];
BLI_array_growone(edges);
copy_v3_v3(edges[tot][0], co[0]);
@@ -299,8 +300,8 @@ static void ringsel_find_edge(tringselOpData *lcd, int cuts)
static void ringsel_finish(bContext *C, wmOperator *op)
{
- tringselOpData *lcd= op->customdata;
- int cuts= RNA_int_get(op->ptr, "number_cuts");
+ tringselOpData *lcd = op->customdata;
+ int cuts = RNA_int_get(op->ptr, "number_cuts");
if (lcd->eed) {
BMEditMesh *em = lcd->em;
@@ -318,7 +319,7 @@ static void ringsel_finish(bContext *C, wmOperator *op)
em->selectmode = SCE_SELECT_EDGE;
else
em->selectmode &= ~SCE_SELECT_FACE;
- CTX_data_tool_settings(C)->selectmode= em->selectmode;
+ CTX_data_tool_settings(C)->selectmode = em->selectmode;
EDBM_selectmode_set(em);
WM_event_add_notifier(C, NC_SCENE|ND_TOOLSETTINGS, CTX_data_scene(C));
@@ -332,9 +333,9 @@ static void ringsel_finish(bContext *C, wmOperator *op)
else {
/* sets as active, useful for other tools */
- if(em->selectmode & SCE_SELECT_VERTEX)
+ if (em->selectmode & SCE_SELECT_VERTEX)
EDBM_store_selection(em, lcd->eed->v1); /* low priority TODO, get vertrex close to mouse */
- if(em->selectmode & SCE_SELECT_EDGE)
+ if (em->selectmode & SCE_SELECT_EDGE)
EDBM_store_selection(em, lcd->eed);
EDBM_selectmode_flush(lcd->em);
@@ -346,7 +347,7 @@ static void ringsel_finish(bContext *C, wmOperator *op)
/* called when modal loop selection is done... */
static void ringsel_exit(bContext *UNUSED(C), wmOperator *op)
{
- tringselOpData *lcd= op->customdata;
+ tringselOpData *lcd = op->customdata;
/* deactivate the extra drawing stuff in 3D-View */
ED_region_draw_cb_exit(lcd->ar->type, lcd->draw_handle);
@@ -358,7 +359,7 @@ static void ringsel_exit(bContext *UNUSED(C), wmOperator *op)
/* free the custom data */
MEM_freeN(lcd);
- op->customdata= NULL;
+ op->customdata = NULL;
}
/* called when modal loop selection gets set up... */
@@ -367,11 +368,11 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut)
tringselOpData *lcd;
/* alloc new customdata */
- lcd= op->customdata= MEM_callocN(sizeof(tringselOpData), "ringsel Modal Op Data");
+ lcd = op->customdata = MEM_callocN(sizeof(tringselOpData), "ringsel Modal Op Data");
/* assign the drawing handle for drawing preview line... */
- lcd->ar= CTX_wm_region(C);
- lcd->draw_handle= ED_region_draw_cb_activate(lcd->ar->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW);
+ lcd->ar = CTX_wm_region(C);
+ lcd->draw_handle = ED_region_draw_cb_activate(lcd->ar->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW);
lcd->ob = CTX_data_edit_object(C);
lcd->em = BMEdit_FromObject(lcd->ob);
lcd->extend = do_cut ? 0 : RNA_boolean_get(op->ptr, "extend");
@@ -397,12 +398,12 @@ static int ringcut_cancel (bContext *C, wmOperator *op)
static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt)
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
tringselOpData *lcd;
BMEdge *edge;
int dist = 75;
- if(modifiers_isDeformedByLattice(obedit) || modifiers_isDeformedByArmature(obedit))
+ if (modifiers_isDeformedByLattice(obedit) || modifiers_isDeformedByArmature(obedit))
BKE_report(op->reports, RPT_WARNING, "Loop cut doesn't work well on deformed edit mesh display");
view3d_operator_needs_opengl(C);
@@ -429,8 +430,8 @@ static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt)
static int loopcut_modal (bContext *C, wmOperator *op, wmEvent *event)
{
- int cuts= RNA_int_get(op->ptr,"number_cuts");
- tringselOpData *lcd= op->customdata;
+ int cuts = RNA_int_get(op->ptr, "number_cuts");
+ tringselOpData *lcd = op->customdata;
int show_cuts = 0;
view3d_operator_needs_opengl(C);
@@ -476,7 +477,7 @@ static int loopcut_modal (bContext *C, wmOperator *op, wmEvent *event)
break;
cuts++;
- RNA_int_set(op->ptr,"number_cuts",cuts);
+ RNA_int_set(op->ptr, "number_cuts", cuts);
ringsel_find_edge(lcd, cuts);
show_cuts = TRUE;
@@ -488,8 +489,8 @@ static int loopcut_modal (bContext *C, wmOperator *op, wmEvent *event)
if (event->val == KM_RELEASE)
break;
- cuts=MAX2(cuts-1,1);
- RNA_int_set(op->ptr,"number_cuts",cuts);
+ cuts = MAX2(cuts - 1, 1);
+ RNA_int_set(op->ptr, "number_cuts", cuts);
ringsel_find_edge(lcd, cuts);
show_cuts = TRUE;
@@ -514,15 +515,15 @@ static int loopcut_modal (bContext *C, wmOperator *op, wmEvent *event)
}
/* using the keyboard to input the number of cuts */
- if (event->val==KM_PRESS) {
+ if (event->val == KM_PRESS) {
float value;
if (handleNumInput(&lcd->num, event)) {
applyNumInput(&lcd->num, &value);
- cuts= CLAMPIS(value, 1, 130);
+ cuts = CLAMPIS(value, 1, 130);
- RNA_int_set(op->ptr,"number_cuts",cuts);
+ RNA_int_set(op->ptr, "number_cuts", cuts);
ringsel_find_edge(lcd, cuts);
show_cuts = TRUE;
@@ -546,16 +547,16 @@ static int loopcut_modal (bContext *C, wmOperator *op, wmEvent *event)
void MESH_OT_edgering_select (wmOperatorType *ot)
{
/* description */
- ot->name= "Edge Ring Select";
- ot->idname= "MESH_OT_edgering_select";
- ot->description= "Select an edge ring";
+ ot->name = "Edge Ring Select";
+ ot->idname = "MESH_OT_edgering_select";
+ ot->description = "Select an edge ring";
/* callbacks */
- ot->invoke= ringsel_invoke;
- ot->poll= ED_operator_editmesh_region_view3d;
+ ot->invoke = ringsel_invoke;
+ ot->poll = ED_operator_editmesh_region_view3d;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
}
@@ -564,20 +565,24 @@ void MESH_OT_edgering_select (wmOperatorType *ot)
void MESH_OT_loopcut (wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* description */
- ot->name= "Loop Cut";
- ot->idname= "MESH_OT_loopcut";
- ot->description= "Add a new loop between existing loops";
+ ot->name = "Loop Cut";
+ ot->idname = "MESH_OT_loopcut";
+ ot->description = "Add a new loop between existing loops";
/* callbacks */
- ot->invoke= ringcut_invoke;
- ot->modal= loopcut_modal;
- ot->cancel= ringcut_cancel;
- ot->poll= ED_operator_editmesh_region_view3d;
+ ot->invoke = ringcut_invoke;
+ ot->modal = loopcut_modal;
+ ot->cancel = ringcut_cancel;
+ ot->poll = ED_operator_editmesh_region_view3d;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* properties */
- RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
+ prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
+ /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 0f402def70b..d0b39dc5cc8 100644
--- a/source/blender/editors/mesh/bmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -25,6 +25,10 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/mesh/editmesh_select.c
+ * \ingroup edmesh
+ */
+
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
@@ -189,7 +193,7 @@ int EDBM_init_backbuf_border(ViewContext *vc, short xmin, short ymin, short xmax
/* build selection lookup */
selbuf = MEM_callocN(bm_vertoffs + 1, "selbuf");
- a = (xmax - xmin + 1) * (ymax-ymin + 1);
+ a = (xmax - xmin + 1) * (ymax - ymin + 1);
while (a--) {
if (*dr > 0 && *dr <= bm_vertoffs)
selbuf[*dr] = 1;
@@ -227,9 +231,9 @@ int EDBM_mask_init_backbuf_border(ViewContext *vc, int mcords[][2], short tot, s
/* method in use for face selecting too */
if (vc->obedit == NULL) {
- if (paint_facesel_test(vc->obact));
- else if (paint_vertsel_test(vc->obact));
- else return 0;
+ if (!(paint_facesel_test(vc->obact) || paint_vertsel_test(vc->obact))) {
+ return 0;
+ }
}
else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
return 0;
@@ -289,9 +293,9 @@ int EDBM_init_backbuf_circle(ViewContext *vc, short xs, short ys, short rads)
/* method in use for face selecting too */
if (vc->obedit == NULL) {
- if (paint_facesel_test(vc->obact));
- else if (paint_vertsel_test(vc->obact));
- else return 0;
+ if (!(paint_facesel_test(vc->obact) || paint_vertsel_test(vc->obact))) {
+ return 0;
+ }
}
else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) return 0;
@@ -333,7 +337,7 @@ static void findnearestvert__doClosest(void *userData, BMVert *eve, int x, int y
}
if (data->dist > 3) {
- int temp = abs(data->mval[0] - x) + abs(data->mval[1]- y);
+ int temp = abs(data->mval[0] - x) + abs(data->mval[1] - y);
if (BM_elem_flag_test(eve, BM_ELEM_SELECT) == data->select) {
if (data->strict == 1) {
return;
@@ -499,7 +503,7 @@ BMEdge *EDBM_findnearestedge(ViewContext *vc, int *dist)
view3d_validate_backbuf(vc);
- index = view3d_sample_backbuf_rect(vc, vc->mval, 50, bm_solidoffs, bm_wireoffs, &distance,0, NULL, NULL);
+ index = view3d_sample_backbuf_rect(vc, vc->mval, 50, bm_solidoffs, bm_wireoffs, &distance, 0, NULL, NULL);
eed = BM_edge_at_index(vc->em->bm, index - 1);
if (eed && distance < *dist) {
@@ -649,7 +653,7 @@ static int unified_findnearest(ViewContext *vc, BMVert **r_eve, BMEdge **r_eed,
if (em->selectmode & SCE_SELECT_FACE)
*r_efa = EDBM_findnearestface(vc, &dist);
- dist-= 20; /* since edges select lines, we give dots advantage of 20 pix */
+ dist -= 20; /* since edges select lines, we give dots advantage of 20 pix */
if (em->selectmode & SCE_SELECT_EDGE)
*r_eed = EDBM_findnearestedge(vc, &dist);
@@ -701,8 +705,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
/* get the type from RNA */
int type = RNA_enum_get(op->ptr, "type");
-
- float thresh = CTX_data_tool_settings(C)->select_thresh;
+ float thresh = RNA_float_get(op->ptr, "threshold");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
EDBM_InitOpf(em, &bmop, op, "similarfaces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
@@ -714,7 +717,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_ELEM_SELECT, BM_ALL, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_ALL, BM_ELEM_SELECT, TRUE);
/* finish the operator */
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
@@ -742,8 +745,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
/* get the type from RNA */
int type = RNA_enum_get(op->ptr, "type");
-
- float thresh = CTX_data_tool_settings(C)->select_thresh;
+ float thresh = RNA_float_get(op->ptr, "threshold");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
EDBM_InitOpf(em, &bmop, op, "similaredges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
@@ -755,7 +757,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_ELEM_SELECT, BM_ALL, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_ALL, BM_ELEM_SELECT, TRUE);
EDBM_selectmode_flush(em);
/* finish the operator */
@@ -786,7 +788,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
BMOperator bmop;
/* get the type from RNA */
int type = RNA_enum_get(op->ptr, "type");
- float thresh = CTX_data_tool_settings(C)->select_thresh;
+ float thresh = RNA_float_get(op->ptr, "threshold");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
EDBM_InitOpf(em, &bmop, op, "similarverts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
@@ -798,7 +800,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ELEM_SELECT, BM_ALL, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
/* finish the operator */
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
@@ -815,16 +817,23 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int select_similar_exec(bContext *C, wmOperator *op)
+static int edbm_select_similar_exec(bContext *C, wmOperator *op)
{
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "threshold");
+
int type = RNA_enum_get(op->ptr, "type");
- if (type < 100)
- return similar_vert_select_exec(C, op);
- else if (type < 200)
- return similar_edge_select_exec(C, op);
- else
- return similar_face_select_exec(C, op);
+ if (!RNA_property_is_set(op->ptr, prop)) {
+ RNA_property_float_set(op->ptr, prop, ts->select_thresh);
+ }
+ else {
+ ts->select_thresh = RNA_property_float_get(op->ptr, prop);
+ }
+
+ if (type < 100) return similar_vert_select_exec(C, op);
+ else if (type < 200) return similar_edge_select_exec(C, op);
+ else return similar_face_select_exec(C, op);
}
static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop),
@@ -872,7 +881,7 @@ void MESH_OT_select_similar(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_menu_invoke;
- ot->exec = select_similar_exec;
+ ot->exec = edbm_select_similar_exec;
ot->poll = ED_operator_editmesh;
ot->description = "Select similar vertices, edges or faces by property types";
@@ -882,6 +891,8 @@ void MESH_OT_select_similar(wmOperatorType *ot)
/* properties */
prop = ot->prop = RNA_def_enum(ot->srna, "type", prop_similar_types, SIMVERT_NORMAL, "Type", "");
RNA_def_enum_funcs(prop, select_similar_type_itemf);
+
+ RNA_def_float(ot->srna, "threshold", 0.0, 0.0, 1.0, "Threshold", "", 0.01, 1.0);
}
/* ***************************************************** */
@@ -907,7 +918,7 @@ static void walker_select(BMEditMesh *em, int walkercode, void *start, int selec
BMW_end(&walker);
}
-static int loop_multiselect(bContext *C, wmOperator *op)
+static int edbm_loop_multiselect_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -928,7 +939,7 @@ static int loop_multiselect(bContext *C, wmOperator *op)
}
- edarray = MEM_mallocN(sizeof(BMEdge *)*totedgesel,"edge array");
+ edarray = MEM_mallocN(sizeof(BMEdge *) * totedgesel, "edge array");
edindex = 0;
for (eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
@@ -971,7 +982,7 @@ void MESH_OT_loop_multi_select(wmOperatorType *ot)
ot->idname = "MESH_OT_loop_multi_select";
/* api callbacks */
- ot->exec = loop_multiselect;
+ ot->exec = edbm_loop_multiselect_exec;
ot->poll = ED_operator_editmesh;
ot->description = "Select a loop of connected edges by connection type";
@@ -1057,7 +1068,7 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
}
}
-static int mesh_select_loop_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int edbm_select_loop_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
view3d_operator_needs_opengl(C);
@@ -1077,7 +1088,7 @@ void MESH_OT_loop_select(wmOperatorType *ot)
ot->description = "Select a loop";
/* api callbacks */
- ot->invoke = mesh_select_loop_invoke;
+ ot->invoke = edbm_select_loop_invoke;
ot->poll = ED_operator_editmesh_region_view3d;
ot->description = "Select a loop of connected edges";
@@ -1097,7 +1108,7 @@ void MESH_OT_edgering_select(wmOperatorType *ot)
ot->description = "Select an edge ring";
/* callbacks */
- ot->invoke = mesh_select_loop_invoke;
+ ot->invoke = edbm_select_loop_invoke;
ot->poll = ED_operator_editmesh_region_view3d;
/* flags */
@@ -1175,17 +1186,13 @@ static void edgetag_context_set(BMEditMesh *em, Scene *scene, BMEdge *e, int val
case EDGE_MODE_TAG_CREASE:
{
float *crease = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_CREASE);
-
- if (val) *crease = 1.0f;
- else *crease = 0.0f;
+ *crease = (val) ? 1.0f : 0.0f;
break;
}
case EDGE_MODE_TAG_BEVEL:
{
float *bweight = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_BWEIGHT);
-
- if (val) *bweight = 1.0f;
- else *bweight = 0.0f;
+ *bweight = (val) ? 1.0f : 0.0f;
break;
}
}
@@ -1424,7 +1431,7 @@ static void mouse_mesh_shortest_path(bContext *C, int mval[2])
}
-static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
+static int edbm_shortest_path_select_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
view3d_operator_needs_opengl(C);
@@ -1441,7 +1448,7 @@ void MESH_OT_select_shortest_path(wmOperatorType *ot)
ot->idname = "MESH_OT_select_shortest_path";
/* api callbacks */
- ot->invoke = mesh_shortest_path_select_invoke;
+ ot->invoke = edbm_shortest_path_select_invoke;
ot->poll = ED_operator_editmesh;
ot->description = "Select shortest path between two selections";
@@ -1552,7 +1559,7 @@ static void EDBM_strip_selections(BMEditMesh *em)
}
}
-/* when switching select mode, makes sure selection is consistant for editing */
+/* when switching select mode, makes sure selection is consistent for editing */
/* also for paranoia checks to make sure edge or face mode works */
void EDBM_selectmode_set(BMEditMesh *em)
{
@@ -1609,8 +1616,8 @@ void EDBM_convertsel(BMEditMesh *em, short oldmode, short selectmode)
/* select all edges associated with every selected vertex */
eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
for ( ; eed; eed = BM_iter_step(&iter)) {
- if ( (BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) ||
- BM_elem_flag_test(eed->v2, BM_ELEM_SELECT)))
+ if ((BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) ||
+ BM_elem_flag_test(eed->v2, BM_ELEM_SELECT)))
{
BM_elem_select_set(em->bm, eed, TRUE);
}
@@ -1669,6 +1676,13 @@ void EDBM_deselect_by_material(BMEditMesh *em, const short index, const short se
}
}
+void EDBM_select_toggle_all(BMEditMesh *em) /* exported for UV */
+{
+ if (em->bm->totvertsel || em->bm->totedgesel || em->bm->totfacesel)
+ EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+ else
+ EDBM_flag_enable_all(em, BM_ELEM_SELECT);
+}
void EDBM_select_swap(BMEditMesh *em) /* exported for UV */
{
@@ -1746,7 +1760,7 @@ static void linked_limit_default(bContext *C, wmOperator *op)
}
}
-static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Object *obedit = CTX_data_edit_object(C);
ViewContext vc;
@@ -1845,7 +1859,7 @@ void MESH_OT_select_linked_pick(wmOperatorType *ot)
ot->idname = "MESH_OT_select_linked_pick";
/* api callbacks */
- ot->invoke = select_linked_pick_invoke;
+ ot->invoke = edbm_select_linked_pick_invoke;
ot->poll = ED_operator_editmesh;
ot->description = "(De)select all vertices linked to the edge under the mouse cursor";
@@ -1857,7 +1871,7 @@ void MESH_OT_select_linked_pick(wmOperatorType *ot)
}
-static int select_linked_exec(bContext *C, wmOperator *op)
+static int edbm_select_linked_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1940,7 +1954,7 @@ void MESH_OT_select_linked(wmOperatorType *ot)
ot->idname = "MESH_OT_select_linked";
/* api callbacks */
- ot->exec = select_linked_exec;
+ ot->exec = edbm_select_linked_exec;
ot->poll = ED_operator_editmesh;
ot->description = "Select all vertices linked to the active mesh";
@@ -1952,7 +1966,7 @@ void MESH_OT_select_linked(wmOperatorType *ot)
/* ******************** **************** */
-static int select_more(bContext *C, wmOperator *UNUSED(op))
+static int edbm_select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1971,14 +1985,14 @@ void MESH_OT_select_more(wmOperatorType *ot)
ot->description = "Select more vertices, edges or faces connected to initial selection";
/* api callbacks */
- ot->exec = select_more;
+ ot->exec = edbm_select_more_exec;
ot->poll = ED_operator_editmesh;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int select_less(bContext *C, wmOperator *UNUSED(op))
+static int edbm_select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1997,7 +2011,7 @@ void MESH_OT_select_less(wmOperatorType *ot)
ot->description = "Deselect vertices, edges or faces at the boundary of each selection region";
/* api callbacks */
- ot->exec = select_less;
+ ot->exec = edbm_select_less_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2090,7 +2104,7 @@ static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed,
ese = (BMEditSelection *)em->bm->selected.last;
if (ese) {
- switch(ese->htype) {
+ switch (ese->htype) {
case BM_VERT:
*r_eve = (BMVert *)ese->ele;
return;
@@ -2152,7 +2166,7 @@ static int EM_deselect_nth(BMEditMesh *em, int nth, int offset)
return 0;
}
-static int mesh_select_nth_exec(bContext *C, wmOperator *op)
+static int edbm_select_nth_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2181,7 +2195,7 @@ void MESH_OT_select_nth(wmOperatorType *ot)
ot->idname = "MESH_OT_select_nth";
/* api callbacks */
- ot->exec = mesh_select_nth_exec;
+ ot->exec = edbm_select_nth_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2206,11 +2220,12 @@ int EM_view3d_poll(bContext *C)
{
if (ED_operator_editmesh(C) && ED_operator_view3d_active(C))
return 1;
+
return 0;
}
-static int select_sharp_edges_exec(bContext *C, wmOperator *op)
+static int edbm_select_sharp_edges_exec(bContext *C, wmOperator *op)
{
/* Find edges that have exactly two neighboring faces,
* check the angle between those faces, and if angle is
@@ -2257,7 +2272,7 @@ void MESH_OT_edges_select_sharp(wmOperatorType *ot)
ot->idname = "MESH_OT_edges_select_sharp";
/* api callbacks */
- ot->exec = select_sharp_edges_exec;
+ ot->exec = edbm_select_sharp_edges_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2267,7 +2282,7 @@ void MESH_OT_edges_select_sharp(wmOperatorType *ot)
RNA_def_float(ot->srna, "sharpness", 1.0f, 0.01f, FLT_MAX, "sharpness", "", 1.0f, 180.0f);
}
-static int select_linked_flat_faces_exec(bContext *C, wmOperator *op)
+static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2338,7 +2353,7 @@ void MESH_OT_faces_select_linked_flat(wmOperatorType *ot)
ot->idname = "MESH_OT_faces_select_linked_flat";
/* api callbacks */
- ot->exec = select_linked_flat_faces_exec;
+ ot->exec = edbm_select_linked_flat_faces_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2348,7 +2363,7 @@ void MESH_OT_faces_select_linked_flat(wmOperatorType *ot)
RNA_def_float(ot->srna, "sharpness", 1.0f, 0.01f, FLT_MAX, "sharpness", "", 1.0f, 180.0f);
}
-static int select_non_manifold_exec(bContext *C, wmOperator *op)
+static int edbm_select_non_manifold_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2366,7 +2381,7 @@ static int select_non_manifold_exec(bContext *C, wmOperator *op)
}
BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN) && !BM_vert_is_manifold(em->bm, v)) {
+ if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN) && !BM_vert_is_manifold(v)) {
BM_elem_select_set(em->bm, v, TRUE);
}
}
@@ -2390,14 +2405,14 @@ void MESH_OT_select_non_manifold(wmOperatorType *ot)
ot->idname = "MESH_OT_select_non_manifold";
/* api callbacks */
- ot->exec = select_non_manifold_exec;
+ ot->exec = edbm_select_non_manifold_exec;
ot->poll = ED_operator_editmesh;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int mesh_select_random_exec(bContext *C, wmOperator *op)
+static int edbm_select_random_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2405,7 +2420,7 @@ static int mesh_select_random_exec(bContext *C, wmOperator *op)
BMEdge *eed;
BMFace *efa;
BMIter iter;
- float randfac = RNA_float_get(op->ptr, "percent")/100.0f;
+ float randfac = RNA_float_get(op->ptr, "percent") / 100.0f;
BLI_srand(BLI_rand()); /* random seed */
@@ -2450,7 +2465,7 @@ void MESH_OT_select_random(wmOperatorType *ot)
ot->idname = "MESH_OT_select_random";
/* api callbacks */
- ot->exec = mesh_select_random_exec;
+ ot->exec = edbm_select_random_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2463,7 +2478,7 @@ void MESH_OT_select_random(wmOperatorType *ot)
"Extend Selection", "Extend selection instead of deselecting everything first");
}
-static int select_next_loop(bContext *C, wmOperator *UNUSED(op))
+static int edbm_select_next_loop_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2505,7 +2520,7 @@ void MESH_OT_select_next_loop(wmOperatorType *ot)
ot->description = "";
/* api callbacks */
- ot->exec = select_next_loop;
+ ot->exec = edbm_select_next_loop_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2513,7 +2528,7 @@ void MESH_OT_select_next_loop(wmOperatorType *ot)
}
-static int region_to_loop(bContext *C, wmOperator *UNUSED(op))
+static int edbm_region_to_loop_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2572,7 +2587,7 @@ void MESH_OT_region_to_loop(wmOperatorType *ot)
ot->idname = "MESH_OT_region_to_loop";
/* api callbacks */
- ot->exec = region_to_loop;
+ ot->exec = edbm_region_to_loop_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2717,7 +2732,7 @@ static int loop_find_regions(BMEditMesh *em, int selbigger)
return count;
}
-static int loop_to_region(bContext *C, wmOperator *op)
+static int edbm_loop_to_region_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2753,7 +2768,7 @@ void MESH_OT_loop_to_region(wmOperatorType *ot)
ot->idname = "MESH_OT_loop_to_region";
/* api callbacks */
- ot->exec = loop_to_region;
+ ot->exec = edbm_loop_to_region_exec;
ot->poll = ED_operator_editmesh;
/* flags */
diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 4e4a9d5630b..323dae7163b 100644
--- a/source/blender/editors/mesh/bmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -25,6 +25,10 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/mesh/editmesh_tools.c
+ * \ingroup edmesh
+ */
+
#include "MEM_guardedalloc.h"
#include "DNA_material_types.h"
@@ -63,26 +67,26 @@
#include "mesh_intern.h"
-
+/* allow accumulated normals to form a new direction but don't
+ * accept direct opposite directions else they will cancel each other out */
static void add_normal_aligned(float nor[3], const float add[3])
{
if (dot_v3v3(nor, add) < -0.9999f) {
sub_v3_v3(nor, add);
}
else {
- sub_v3_v3(nor, add);
+ add_v3_v3(nor, add);
}
}
-
-static int subdivide_exec(bContext *C, wmOperator *op)
+static int edbm_subdivide_exec(bContext *C, wmOperator *op)
{
ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- int cuts = RNA_int_get(op->ptr,"number_cuts");
+ 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.5;
+ float fractal = RNA_float_get(op->ptr, "fractal") / 2.5f;
int flag = 0;
if (smooth != 0.0f)
@@ -120,26 +124,31 @@ static EnumPropertyItem prop_mesh_cornervert_types[] = {
void MESH_OT_subdivide(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "Subdivide";
ot->description = "Subdivide selected edges";
ot->idname = "MESH_OT_subdivide";
/* api callbacks */
- ot->exec = subdivide_exec;
+ ot->exec = edbm_subdivide_exec;
ot->poll = ED_operator_editmesh;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
+ prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
+ /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
/* BMESH_TODO, this currently does nothing, just add to stop UI from erroring out! */
RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, FLT_MAX, "Smoothness", "Smoothness factor (BMESH TODO)", 0.0f, 1.0f);
RNA_def_boolean(ot->srna, "quadtri", 0, "Quad/Tri Mode", "Tries to prevent ngons");
RNA_def_enum(ot->srna, "quadcorner", prop_mesh_cornervert_types, SUBD_STRAIGHT_CUT,
- "Quad Corner Type", "How to subdivide quad corners (anything other then Straight Cut will prevent ngons)");
+ "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_int(ot->srna, "seed", 0, 0, 10000, "Random Seed", "Seed for the random number generator", 0, 50);
@@ -167,7 +176,7 @@ void EMBM_project_snap_verts(bContext *C, ARegion *ar, Object *obedit, BMEditMes
/* individual face extrude */
/* will use vertex normals for extrusion directions, so *nor is unaffected */
-static short EDBM_Extrude_face_indiv(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
+static short edbm_extrude_face_indiv(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
{
BMOIter siter;
BMIter liter;
@@ -199,7 +208,7 @@ static short EDBM_Extrude_face_indiv(BMEditMesh *em, wmOperator *op, const char
}
/* extrudes individual edges */
-static short EDBM_Extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
+static short edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
{
BMOperator bmop;
@@ -209,7 +218,7 @@ static short EDBM_Extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
BMO_op_exec(em->bm, &bmop);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ELEM_SELECT, BM_VERT|BM_EDGE, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_VERT|BM_EDGE, BM_ELEM_SELECT, TRUE);
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
return 0;
@@ -219,17 +228,17 @@ static short EDBM_Extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char
}
/* extrudes individual vertices */
-static short EDBM_Extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
+static short edbm_extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
{
BMOperator bmop;
EDBM_InitOpf(em, &bmop, op, "extrude_vert_indiv verts=%hv", hflag);
/* deselect original verts */
- BMO_slot_buffer_hflag_disable(em->bm, &bmop, "verts", BM_ELEM_SELECT, BM_VERT, TRUE);
+ BMO_slot_buffer_hflag_disable(em->bm, &bmop, "verts", BM_VERT, BM_ELEM_SELECT, TRUE);
BMO_op_exec(em->bm, &bmop);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ELEM_SELECT, BM_VERT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_VERT, BM_ELEM_SELECT, TRUE);
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
return 0;
@@ -238,7 +247,7 @@ static short EDBM_Extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char
return 'g'; // g is grab
}
-static short EDBM_Extrude_edge(Object *obedit, BMEditMesh *em, const char hflag, float nor[3])
+static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag, float nor[3])
{
BMesh *bm = em->bm;
BMIter iter;
@@ -250,7 +259,7 @@ static short EDBM_Extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
BMElem *ele;
BMO_op_init(bm, &extop, "extrude_face_region");
- BMO_slot_buffer_from_hflag(bm, &extop, "edgefacein", hflag, BM_VERT|BM_EDGE|BM_FACE);
+ BMO_slot_buffer_from_hflag(bm, &extop, "edgefacein", BM_VERT|BM_EDGE|BM_FACE, hflag);
/* If a mirror modifier with clipping is on, we need to adjust some
* of the cases above to handle edges on the line of symmetry.
@@ -317,7 +326,7 @@ static short EDBM_Extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
BMO_op_exec(bm, &extop);
- nor[0] = nor[1] = nor[2] = 0.0f;
+ zero_v3(nor);
BMO_ITER(ele, &siter, bm, &extop, "geomout", BM_ALL) {
BM_elem_select_set(bm, ele, TRUE);
@@ -332,11 +341,11 @@ static short EDBM_Extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
BMO_op_finish(bm, &extop);
- if (nor[0] == 0.0f && nor[1] == 0.0f && nor[2] == 0.0f) return 'g'; // grab
- return 'n'; // normal constraint
-
+ /* grab / normal constraint */
+ return is_zero_v3(nor) ? 'g' : 'n';
}
-static short EDBM_Extrude_vert(Object *obedit, BMEditMesh *em, const char hflag, float *nor)
+
+static short edbm_extrude_vert(Object *obedit, BMEditMesh *em, const char hflag, float nor[3])
{
BMIter iter;
BMEdge *eed;
@@ -364,18 +373,18 @@ static short EDBM_Extrude_vert(Object *obedit, BMEditMesh *em, const char hflag,
}
}
- return EDBM_Extrude_edge(obedit, em, hflag, nor);
+ return edbm_extrude_edge(obedit, em, hflag, nor);
}
-static int extrude_repeat_mesh(bContext *C, wmOperator *op)
+static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
- int steps = RNA_int_get(op->ptr,"steps");
+ int steps = RNA_int_get(op->ptr, "steps");
- float offs = RNA_float_get(op->ptr,"offset");
+ float offs = RNA_float_get(op->ptr, "offset");
float dvec[3], tmat[3][3], bmat[3][3], nor[3] = {0.0, 0.0, 0.0};
short a;
@@ -389,7 +398,7 @@ static int extrude_repeat_mesh(bContext *C, wmOperator *op)
mul_m3_v3(tmat, dvec);
for (a = 0; a < steps; a++) {
- EDBM_Extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
+ edbm_extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
//BMO_op_callf(em->bm, "extrude_face_region edgefacein=%hef", BM_ELEM_SELECT);
BMO_op_callf(em->bm, "translate vec=%v verts=%hv", (float *)dvec, BM_ELEM_SELECT);
//extrudeflag(obedit, em, SELECT, nor);
@@ -412,7 +421,7 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot)
ot->idname = "MESH_OT_extrude_repeat";
/* api callbacks */
- ot->exec = extrude_repeat_mesh;
+ ot->exec = edbm_extrude_repeat_exec;
ot->poll = ED_operator_editmesh_view3d;
/* flags */
@@ -424,13 +433,13 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot)
}
/* generic extern called extruder */
-static int EDBM_Extrude_Mesh(Scene *scene, Object *obedit, BMEditMesh *em, wmOperator *op, float *norin)
+static int edbm_extrude_mesh(Scene *scene, Object *obedit, BMEditMesh *em, wmOperator *op, float *norin)
{
short nr, transmode = 0;
float stacknor[3] = {0.0f, 0.0f, 0.0f};
float *nor = norin ? norin : stacknor;
- nor[0] = nor[1] = nor[2] = 0.0f;
+ zero_v3(nor);
if (em->selectmode & SCE_SELECT_VERTEX) {
if (em->bm->totvertsel == 0) nr = 0;
@@ -465,24 +474,24 @@ static int EDBM_Extrude_Mesh(Scene *scene, Object *obedit, BMEditMesh *em, wmOpe
if (nr < 1) return 'g';
- if (nr == 1 && em->selectmode & SCE_SELECT_VERTEX)
- transmode = EDBM_Extrude_vert(obedit, em, BM_ELEM_SELECT, nor);
- else if (nr == 1) transmode = EDBM_Extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
- else if (nr == 4) transmode = EDBM_Extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor);
- else if (nr == 3) transmode = EDBM_Extrude_edges_indiv(em, op, BM_ELEM_SELECT, nor);
- else transmode = EDBM_Extrude_face_indiv(em, op, BM_ELEM_SELECT, nor);
+ if (nr == 1 && (em->selectmode & SCE_SELECT_VERTEX))
+ transmode = edbm_extrude_vert(obedit, em, BM_ELEM_SELECT, nor);
+ else if (nr == 1) transmode = edbm_extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
+ else if (nr == 4) transmode = edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor);
+ else if (nr == 3) transmode = edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, nor);
+ else transmode = edbm_extrude_face_indiv(em, op, BM_ELEM_SELECT, nor);
if (transmode == 0) {
BKE_report(op->reports, RPT_ERROR, "Not a valid selection for extrude");
}
else {
- /* We need to force immediate calculation here because
- * transform may use derived objects (which are now stale).
- *
- * This shouldn't be necessary, derived queries should be
- * automatically building this data if invalid. Or something.
- */
+ /* We need to force immediate calculation here because
+ * transform may use derived objects (which are now stale).
+ *
+ * This shouldn't be necessary, derived queries should be
+ * automatically building this data if invalid. Or something.
+ */
// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
object_handle_update(scene, obedit);
@@ -507,13 +516,13 @@ static int EDBM_Extrude_Mesh(Scene *scene, Object *obedit, BMEditMesh *em, wmOpe
}
/* extrude without transform */
-static int mesh_extrude_region_exec(bContext *C, wmOperator *op)
+static int edbm_extrude_region_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- EDBM_Extrude_Mesh(scene, obedit, em, op, NULL);
+ edbm_extrude_mesh(scene, obedit, em, op, NULL);
/* This normally happens when pushing undo but modal operators
* like this one don't push undo data until after modal mode is
@@ -534,7 +543,7 @@ void MESH_OT_extrude_region(wmOperatorType *ot)
/* api callbacks */
//ot->invoke = mesh_extrude_region_invoke;
- ot->exec = mesh_extrude_region_exec;
+ ot->exec = edbm_extrude_region_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -543,13 +552,13 @@ void MESH_OT_extrude_region(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
}
-static int mesh_extrude_verts_exec(bContext *C, wmOperator *op)
+static int edbm_extrude_verts_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
float nor[3];
- EDBM_Extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor);
+ edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
@@ -563,7 +572,7 @@ void MESH_OT_extrude_verts_indiv(wmOperatorType *ot)
ot->idname = "MESH_OT_extrude_verts_indiv";
/* api callbacks */
- ot->exec = mesh_extrude_verts_exec;
+ ot->exec = edbm_extrude_verts_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -573,13 +582,13 @@ void MESH_OT_extrude_verts_indiv(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
}
-static int mesh_extrude_edges_exec(bContext *C, wmOperator *op)
+static int edbm_extrude_edges_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
float nor[3];
- EDBM_Extrude_edges_indiv(em, op, BM_ELEM_SELECT, nor);
+ edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, nor);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
@@ -593,7 +602,7 @@ void MESH_OT_extrude_edges_indiv(wmOperatorType *ot)
ot->idname = "MESH_OT_extrude_edges_indiv";
/* api callbacks */
- ot->exec = mesh_extrude_edges_exec;
+ ot->exec = edbm_extrude_edges_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -603,13 +612,13 @@ void MESH_OT_extrude_edges_indiv(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
}
-static int mesh_extrude_faces_exec(bContext *C, wmOperator *op)
+static int edbm_extrude_faces_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
float nor[3];
- EDBM_Extrude_face_indiv(em, op, BM_ELEM_SELECT, nor);
+ edbm_extrude_face_indiv(em, op, BM_ELEM_SELECT, nor);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
@@ -623,7 +632,7 @@ void MESH_OT_extrude_faces_indiv(wmOperatorType *ot)
ot->idname = "MESH_OT_extrude_faces_indiv";
/* api callbacks */
- ot->exec = mesh_extrude_faces_exec;
+ ot->exec = edbm_extrude_faces_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -634,15 +643,7 @@ void MESH_OT_extrude_faces_indiv(wmOperatorType *ot)
/* ******************** (de)select all operator **************** */
-void EDBM_toggle_select_all(BMEditMesh *em) /* exported for UV */
-{
- if (em->bm->totvertsel || em->bm->totedgesel || em->bm->totfacesel)
- EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- else
- EDBM_flag_enable_all(em, BM_ELEM_SELECT);
-}
-
-static int mesh_select_all_exec(bContext *C, wmOperator *op)
+static int edbm_select_all_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -650,7 +651,7 @@ static int mesh_select_all_exec(bContext *C, wmOperator *op)
switch (action) {
case SEL_TOGGLE:
- EDBM_toggle_select_all(em);
+ EDBM_select_toggle_all(em);
break;
case SEL_SELECT:
EDBM_flag_enable_all(em, BM_ELEM_SELECT);
@@ -671,12 +672,12 @@ static int mesh_select_all_exec(bContext *C, wmOperator *op)
void MESH_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Select/Deselect All";
+ ot->name = "(De)select All";
ot->idname = "MESH_OT_select_all";
ot->description = "(De)select all vertices, edges or faces";
/* api callbacks */
- ot->exec = mesh_select_all_exec;
+ ot->exec = edbm_select_all_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -685,7 +686,7 @@ void MESH_OT_select_all(wmOperatorType *ot)
WM_operator_properties_select_all(ot);
}
-static int mesh_faces_select_interior_exec(bContext *C, wmOperator *UNUSED(op))
+static int edbm_faces_select_interior_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -709,7 +710,7 @@ void MESH_OT_select_interior_faces(wmOperatorType *ot)
ot->description = "Select faces where all edges have more than 2 face users";
/* api callbacks */
- ot->exec = mesh_faces_select_interior_exec;
+ ot->exec = edbm_faces_select_interior_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -717,8 +718,7 @@ void MESH_OT_select_interior_faces(wmOperatorType *ot)
}
/* *************** add-click-mesh (extrude) operator ************** */
-/* in trunk see: 'editmesh_add.c' */
-static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
+static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ViewContext vc;
BMVert *v1;
@@ -843,7 +843,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
EMBM_project_snap_verts(C, vc.ar, vc.obedit, vc.em);
}
- EDBM_Extrude_edge(vc.obedit, vc.em, BM_ELEM_SELECT, nor);
+ edbm_extrude_edge(vc.obedit, vc.em, BM_ELEM_SELECT, nor);
EDBM_CallOpf(vc.em, op, "rotate verts=%hv cent=%v mat=%m3",
BM_ELEM_SELECT, cent, mat);
EDBM_CallOpf(vc.em, op, "translate verts=%hv vec=%v",
@@ -894,7 +894,7 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)
ot->idname = "MESH_OT_dupli_extrude_cursor";
/* api callbacks */
- ot->invoke = dupli_extrude_cursor;
+ ot->invoke = edbm_dupli_extrude_cursor_invoke;
ot->description = "Duplicate and extrude selected vertices, edges or faces towards the mouse cursor";
ot->poll = ED_operator_editmesh;
@@ -904,97 +904,50 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "rotate_source", 1, "Rotate Source", "Rotate initial selection giving better shape");
}
-static int delete_mesh(bContext *C, Object *obedit, wmOperator *op, int event, Scene *UNUSED(scene))
+/* Note, these values must match delete_mesh() event values */
+static EnumPropertyItem prop_mesh_delete_types[] = {
+ {0, "VERT", 0, "Vertices", ""},
+ {1, "EDGE", 0, "Edges", ""},
+ {2, "FACE", 0, "Faces", ""},
+ {3, "EDGE_FACE", 0, "Edges & Faces", ""},
+ {4, "ONLY_FACE", 0, "Only Faces", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+static int edbm_delete_exec(bContext *C, wmOperator *op)
{
- BMEditMesh *bem = BMEdit_FromObject(obedit);
-
- if (event < 1) return OPERATOR_CANCELLED;
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+ int type = RNA_enum_get(op->ptr, "type");
- if (event == 10) {
- //"Erase Vertices";
+ BMEditMesh *bem = BMEdit_FromObject(obedit);
- if (!EDBM_CallOpf(bem, op, "del geom=%hv context=%i", BM_ELEM_SELECT, DEL_VERTS))
+ if (type == 0) {
+ if (!EDBM_CallOpf(bem, op, "del geom=%hv context=%i", BM_ELEM_SELECT, DEL_VERTS)) /* Erase Vertices */
return OPERATOR_CANCELLED;
- }
- else if (event == 11) {
- //"Edge Loop"
- if (!EDBM_CallOpf(bem, op, "dissolve_edge_loop edges=%he", BM_ELEM_SELECT))
- return OPERATOR_CANCELLED;
- }
- else if (event == 7) {
- int use_verts = RNA_boolean_get(op->ptr, "use_verts");
- //"Dissolve"
- if (bem->selectmode & SCE_SELECT_FACE) {
- if (!EDBM_CallOpf(bem, op, "dissolve_faces faces=%hf use_verts=%b", BM_ELEM_SELECT, use_verts))
- return OPERATOR_CANCELLED;
- }
- else if (bem->selectmode & SCE_SELECT_EDGE) {
- if (!EDBM_CallOpf(bem, op, "dissolve_edges edges=%he use_verts=%b", BM_ELEM_SELECT, use_verts))
- return OPERATOR_CANCELLED;
- }
- else if (bem->selectmode & SCE_SELECT_VERTEX) {
- if (!EDBM_CallOpf(bem, op, "dissolve_verts verts=%hv", BM_ELEM_SELECT))
- return OPERATOR_CANCELLED;
- }
}
- else if (event == 4) {
- //Edges and Faces
- if (!EDBM_CallOpf(bem, op, "del geom=%hef context=%i", BM_ELEM_SELECT, DEL_EDGESFACES))
+ else if (type == 1) {
+ if (!EDBM_CallOpf(bem, op, "del geom=%he context=%i", BM_ELEM_SELECT, DEL_EDGES)) /* Erase Edges */
return OPERATOR_CANCELLED;
- }
- else if (event == 1) {
- //"Erase Edges"
- if (!EDBM_CallOpf(bem, op, "del geom=%he context=%i", BM_ELEM_SELECT, DEL_EDGES))
+ }
+ else if (type == 2) {
+ if (!EDBM_CallOpf(bem, op, "del geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES)) /* Erase Faces */
return OPERATOR_CANCELLED;
}
- else if (event == 2) {
- //"Erase Faces";
- if (!EDBM_CallOpf(bem, op, "del geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES))
+ else if (type == 3) {
+ if (!EDBM_CallOpf(bem, op, "del geom=%hef context=%i", BM_ELEM_SELECT, DEL_EDGESFACES)) /* Edges and Faces */
return OPERATOR_CANCELLED;
}
- else if (event == 5) {
+ else if (type == 4) {
//"Erase Only Faces";
if (!EDBM_CallOpf(bem, op, "del geom=%hf context=%i",
BM_ELEM_SELECT, DEL_ONLYFACES))
return OPERATOR_CANCELLED;
}
-
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- return OPERATOR_FINISHED;
-}
-
-/* Note, these values must match delete_mesh() event values */
-static EnumPropertyItem prop_mesh_delete_types[] = {
- {7, "DISSOLVE", 0, "Dissolve", ""},
- {12, "COLLAPSE", 0, "Collapse", ""},
- {10,"VERT", 0, "Vertices", ""},
- {1, "EDGE", 0, "Edges", ""},
- {2, "FACE", 0, "Faces", ""},
- {11, "EDGE_LOOP", 0, "Edge Loop", ""},
- {4, "EDGE_FACE", 0, "Edges & Faces", ""},
- {5, "ONLY_FACE", 0, "Only Faces", ""},
- {0, NULL, 0, NULL, NULL}
-};
+ EDBM_flag_disable_all(em, BM_ELEM_SELECT);
-static int delete_mesh_exec(bContext *C, wmOperator *op)
-{
- Object *obedit = CTX_data_edit_object(C);
- BMEditMesh *em = BMEdit_FromObject(obedit);
- Scene *scene = CTX_data_scene(C);
- int type = RNA_enum_get(op->ptr, "type");
-
- if (type != 12) {
- if (delete_mesh(C, obedit, op, type, scene) == OPERATOR_CANCELLED)
- return OPERATOR_CANCELLED;
- EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- }
- else {
- if (!EDBM_CallOpf(em, op, "collapse edges=%he", BM_ELEM_SELECT))
- return OPERATOR_CANCELLED;
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
- }
+ DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA|ND_SELECT, obedit);
@@ -1010,7 +963,7 @@ void MESH_OT_delete(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_menu_invoke;
- ot->exec = delete_mesh_exec;
+ ot->exec = edbm_delete_exec;
ot->poll = ED_operator_editmesh;
@@ -1018,15 +971,68 @@ void MESH_OT_delete(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- ot->prop = RNA_def_enum(ot->srna, "type", prop_mesh_delete_types, 10, "Type", "Method used for deleting mesh data");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_mesh_delete_types, 0, "Type", "Method used for deleting mesh data");
+}
- /* TODO, move dissolve into its own operator so this doesnt confuse non-dissolve options */
- RNA_def_boolean(ot->srna, "use_verts", 0, "Dissolve Verts",
- "When dissolving faces/edges, also dissolve remaining vertices");
+static int edbm_collapse_edge_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+
+ if (!EDBM_CallOpf(em, op, "collapse edges=%he", BM_ELEM_SELECT))
+ return OPERATOR_CANCELLED;
+ DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA|ND_SELECT, obedit);
+
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_edge_collapse(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Edge Collapse";
+ ot->description = "Collapse selected edges";
+ ot->idname = "MESH_OT_edge_collapse";
+
+ /* api callbacks */
+ ot->exec = edbm_collapse_edge_exec;
+ ot->poll = ED_operator_editmesh;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
+static int edbm_collapse_edge_loop_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+
+ if (!EDBM_CallOpf(em, op, "dissolve_edge_loop edges=%he", BM_ELEM_SELECT))
+ return OPERATOR_CANCELLED;
+ DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA|ND_SELECT, obedit);
+
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_edge_collapse_loop(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Edge Collapse Loop";
+ ot->description = "Collapse selected edge loops";
+ ot->idname = "MESH_OT_edge_collapse_loop";
+
+ /* api callbacks */
+ ot->exec = edbm_collapse_edge_loop_exec;
+ ot->poll = ED_operator_editmesh;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+}
-static int addedgeface_mesh_exec(bContext *C, wmOperator *op)
+static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
{
BMOperator bmop;
Object *obedit = CTX_data_edit_object(C);
@@ -1036,7 +1042,7 @@ static int addedgeface_mesh_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
BMO_op_exec(em->bm, &bmop);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_ELEM_SELECT, BM_FACE, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
@@ -1056,7 +1062,7 @@ void MESH_OT_edge_face_add(wmOperatorType *ot)
ot->idname = "MESH_OT_edge_face_add";
/* api callbacks */
- ot->exec = addedgeface_mesh_exec;
+ ot->exec = edbm_add_edge_face_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -1065,7 +1071,7 @@ void MESH_OT_edge_face_add(wmOperatorType *ot)
/* ************************* SEAMS AND EDGES **************** */
-static int editbmesh_mark_seam(bContext *C, wmOperator *op)
+static int edbm_mark_seam(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
Mesh *me = ((Mesh *)obedit->data);
@@ -1110,7 +1116,7 @@ void MESH_OT_mark_seam(wmOperatorType *ot)
ot->description = "(un)mark selected edges as a seam";
/* api callbacks */
- ot->exec = editbmesh_mark_seam;
+ ot->exec = edbm_mark_seam;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -1119,7 +1125,7 @@ void MESH_OT_mark_seam(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
}
-static int editbmesh_mark_sharp(bContext *C, wmOperator *op)
+static int edbm_mark_sharp(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
Mesh *me = ((Mesh *)obedit->data);
@@ -1166,7 +1172,7 @@ void MESH_OT_mark_sharp(wmOperatorType *ot)
ot->description = "(un)mark selected edges as sharp";
/* api callbacks */
- ot->exec = editbmesh_mark_sharp;
+ ot->exec = edbm_mark_sharp;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -1176,7 +1182,7 @@ void MESH_OT_mark_sharp(wmOperatorType *ot)
}
-static int editbmesh_vert_connect(bContext *C, wmOperator *op)
+static int edbm_vert_connect(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1206,14 +1212,14 @@ void MESH_OT_vert_connect(wmOperatorType *ot)
ot->idname = "MESH_OT_vert_connect";
/* api callbacks */
- ot->exec = editbmesh_vert_connect;
+ ot->exec = edbm_vert_connect;
ot->poll = ED_operator_editmesh;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int editbmesh_edge_split(bContext *C, wmOperator *op)
+static int edbm_edge_split_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1221,13 +1227,13 @@ static int editbmesh_edge_split(bContext *C, wmOperator *op)
BMOperator bmop;
int len = 0;
- if (!EDBM_InitOpf(em, &bmop, op, "edgesplit edges=%he numcuts=%i",
- BM_ELEM_SELECT, RNA_int_get(op->ptr,"number_cuts")))
+ if (!EDBM_InitOpf(em, &bmop, op, "edgesplit edges=%he",
+ BM_ELEM_SELECT))
{
return OPERATOR_CANCELLED;
}
BMO_op_exec(bm, &bmop);
- len = BMO_slot_get(&bmop, "outsplit")->len;
+ len = BMO_slot_get(&bmop, "edgeout")->len;
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
}
@@ -1245,18 +1251,16 @@ void MESH_OT_edge_split(wmOperatorType *ot)
ot->idname = "MESH_OT_edge_split";
/* api callbacks */
- ot->exec = editbmesh_edge_split;
+ ot->exec = edbm_edge_split_exec;
ot->poll = ED_operator_editmesh;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
-
- RNA_def_int(ot->srna, "number_cuts", 1, 1, 10, "Number of Cuts", "", 1, INT_MAX);
}
/****************** add duplicate operator ***************/
-static int mesh_duplicate_exec(bContext *C, wmOperator *op)
+static int edbm_duplicate_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(ob);
@@ -1267,7 +1271,7 @@ static int mesh_duplicate_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "newout", BM_ELEM_SELECT, BM_ALL, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "newout", BM_ALL, BM_ELEM_SELECT, TRUE);
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
@@ -1279,10 +1283,10 @@ static int mesh_duplicate_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int edbm_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
WM_cursor_wait(1);
- mesh_duplicate_exec(C, op);
+ edbm_duplicate_exec(C, op);
WM_cursor_wait(0);
return OPERATOR_FINISHED;
@@ -1296,8 +1300,8 @@ void MESH_OT_duplicate(wmOperatorType *ot)
ot->idname = "MESH_OT_duplicate";
/* api callbacks */
- ot->invoke = mesh_duplicate_invoke;
- ot->exec = mesh_duplicate_exec;
+ ot->invoke = edbm_duplicate_invoke;
+ ot->exec = edbm_duplicate_exec;
ot->poll = ED_operator_editmesh;
@@ -1305,7 +1309,7 @@ void MESH_OT_duplicate(wmOperatorType *ot)
RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
}
-static int flip_normals(bContext *C, wmOperator *op)
+static int edbm_flip_normals_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1327,7 +1331,7 @@ void MESH_OT_flip_normals(wmOperatorType *ot)
ot->idname = "MESH_OT_flip_normals";
/* api callbacks */
- ot->exec = flip_normals;
+ ot->exec = edbm_flip_normals_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -1340,7 +1344,7 @@ static const EnumPropertyItem direction_items[] = {
{0, NULL, 0, NULL, NULL}};
/* only accepts 1 selected edge, or 2 selected faces */
-static int edge_rotate_selected(bContext *C, wmOperator *op)
+static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1380,8 +1384,15 @@ static int edge_rotate_selected(bContext *C, wmOperator *op)
EDBM_InitOpf(em, &bmop, op, "edgerotate edges=%he ccw=%b", BM_ELEM_TAG, do_ccw);
+ /* avoids leaving old verts selected which can be a problem running multiple times,
+ * since this means the edges become selected around the face which then attempt to rotate */
+ BMO_slot_buffer_hflag_disable(em->bm, &bmop, "edges", BM_EDGE, BM_ELEM_SELECT, TRUE);
+
BMO_op_exec(em->bm, &bmop);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_ELEM_SELECT, BM_EDGE, TRUE);
+ /* edges may rotate into hidden vertices, if this does _not_ run we get an ilogical state */
+ BMO_slot_buffer_hflag_disable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_HIDDEN, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_SELECT, TRUE);
+ EDBM_selectmode_flush(em);
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
@@ -1401,7 +1412,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot)
ot->idname = "MESH_OT_edge_rotate";
/* api callbacks */
- ot->exec = edge_rotate_selected;
+ ot->exec = edbm_edge_rotate_selected_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -1411,40 +1422,8 @@ void MESH_OT_edge_rotate(wmOperatorType *ot)
RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate edge around");
}
-/* swap is 0 or 1, if 1 it hides not selected */
-void EDBM_hide_mesh(BMEditMesh *em, int swap)
-{
- BMIter iter;
- BMElem *ele;
- int itermode;
-
- if (em == NULL) return;
-
- if (em->selectmode & SCE_SELECT_VERTEX)
- itermode = BM_VERTS_OF_MESH;
- else if (em->selectmode & SCE_SELECT_EDGE)
- itermode = BM_EDGES_OF_MESH;
- else
- itermode = BM_FACES_OF_MESH;
-
- BM_ITER(ele, &iter, em->bm, itermode, NULL) {
- if (BM_elem_flag_test(ele, BM_ELEM_SELECT) ^ swap)
- BM_elem_hide_set(em->bm, ele, TRUE);
- }
-
- EDBM_selectmode_flush(em);
-
- /* original hide flushing comment (OUTDATED):
- * hide happens on least dominant select mode, and flushes up, not down! (helps preventing errors in subsurf) */
- /* - vertex hidden, always means edge is hidden too
- * - edge hidden, always means face is hidden too
- * - face hidden, only set face hide
- * - then only flush back down what's absolute hidden
- */
-
-}
-static int hide_mesh_exec(bContext *C, wmOperator *op)
+static int edbm_hide_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1464,7 +1443,7 @@ void MESH_OT_hide(wmOperatorType *ot)
ot->idname = "MESH_OT_hide";
/* api callbacks */
- ot->exec = hide_mesh_exec;
+ ot->exec = edbm_hide_exec;
ot->poll = ED_operator_editmesh;
ot->description = "Hide (un)selected vertices, edges or faces";
@@ -1475,50 +1454,7 @@ void MESH_OT_hide(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
}
-
-void EDBM_reveal_mesh(BMEditMesh *em)
-{
- const char iter_types[3] = {BM_VERTS_OF_MESH,
- BM_EDGES_OF_MESH,
- BM_FACES_OF_MESH};
-
- int sels[3] = {(em->selectmode & SCE_SELECT_VERTEX),
- (em->selectmode & SCE_SELECT_EDGE),
- (em->selectmode & SCE_SELECT_FACE),
- };
-
- BMIter iter;
- BMElem *ele;
- int i;
-
- /* Use tag flag to remember what was hidden before all is revealed.
- * BM_ELEM_HIDDEN --> BM_ELEM_TAG */
- for (i = 0; i < 3; i++) {
- BM_ITER(ele, &iter, em->bm, iter_types[i], NULL) {
- BM_elem_flag_set(ele, BM_ELEM_TAG, BM_elem_flag_test(ele, BM_ELEM_HIDDEN));
- }
- }
-
- /* Reveal everything */
- EDBM_flag_disable_all(em, BM_ELEM_HIDDEN);
-
- /* Select relevant just-revealed elements */
- for (i = 0; i < 3; i++) {
- if (!sels[i]) {
- continue;
- }
-
- BM_ITER(ele, &iter, em->bm, iter_types[i], NULL) {
- if (BM_elem_flag_test(ele, BM_ELEM_TAG)) {
- BM_elem_select_set(em->bm, ele, TRUE);
- }
- }
- }
-
- EDBM_selectmode_flush(em);
-}
-
-static int reveal_mesh_exec(bContext *C, wmOperator *UNUSED(op))
+static int edbm_reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1539,14 +1475,14 @@ void MESH_OT_reveal(wmOperatorType *ot)
ot->description = "Reveal all hidden vertices, edges and faces";
/* api callbacks */
- ot->exec = reveal_mesh_exec;
+ ot->exec = edbm_reveal_exec;
ot->poll = ED_operator_editmesh;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int normals_make_consistent_exec(bContext *C, wmOperator *op)
+static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1573,7 +1509,7 @@ void MESH_OT_normals_make_consistent(wmOperatorType *ot)
ot->idname = "MESH_OT_normals_make_consistent";
/* api callbacks */
- ot->exec = normals_make_consistent_exec;
+ ot->exec = edbm_normals_make_consistent_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -1584,7 +1520,7 @@ void MESH_OT_normals_make_consistent(wmOperatorType *ot)
-static int do_smooth_vertex(bContext *C, wmOperator *op)
+static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1618,7 +1554,7 @@ static int do_smooth_vertex(bContext *C, wmOperator *op)
}
}
- repeat = RNA_int_get(op->ptr,"repeat");
+ repeat = RNA_int_get(op->ptr, "repeat");
if (!repeat)
repeat = 1;
@@ -1651,7 +1587,7 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
ot->idname = "MESH_OT_vertices_smooth";
/* api callbacks */
- ot->exec = do_smooth_vertex;
+ ot->exec = edbm_do_smooth_vertex_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -1660,81 +1596,6 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Number of times to smooth the mesh", "", 1, INT_MAX);
}
-
-static int bm_test_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *obedit = CTX_data_edit_object(C);
- ARegion *ar = CTX_wm_region(C);
- View3D *v3d = CTX_wm_view3d(C);
- BMEditMesh *em = BMEdit_FromObject(obedit);
- BMBVHTree *tree = BMBVH_NewBVH(em, 0, NULL, NULL);
- BMIter iter;
- BMEdge *e;
-
- /* hide all back edges */
- BM_ITER(e, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
- if (!BM_elem_flag_test(e, BM_ELEM_SELECT))
- continue;
-
- if (!BMBVH_EdgeVisible(tree, e, ar, v3d, obedit))
- BM_elem_select_set(em->bm, e, FALSE);
- }
-
- BMBVH_FreeBVH(tree);
-
-#if 0 //uv island walker test
- BMIter iter, liter;
- BMFace *f;
- BMLoop *l, *l2;
- MLoopUV *luv;
- BMWalker walker;
- int i = 0;
-
- BM_ITER(f, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, f) {
- luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- }
- }
-
- BMW_init(&walker, em->bm, BMW_UVISLAND, BMW_NIL_LAY);
-
- BM_ITER(f, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, f) {
- luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- if (luv->flag & MLOOPUV_VERTSEL) {
- l2 = BMW_begin(&walker, l);
- for (; l2; l2 = BMW_step(&walker)) {
- luv = CustomData_bmesh_get(&em->bm->ldata, l2->head.data, CD_MLOOPUV);
- luv->flag |= MLOOPUV_VERTSEL;
- }
- }
- }
- }
-
- BMW_end(&walker);
-#endif
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_bm_test(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "BMesh Test Operator";
- ot->idname = "MESH_OT_bm_test";
-
- /* api callbacks */
- ot->exec = bm_test_exec;
- ot->poll = ED_operator_editmesh;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
-
- //RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Number of times to smooth the mesh", "", 1, INT_MAX);
-}
-
/********************** Smooth/Solid Operators *************************/
static void mesh_set_smooth_faces(BMEditMesh *em, short smooth)
@@ -1751,7 +1612,7 @@ static void mesh_set_smooth_faces(BMEditMesh *em, short smooth)
}
}
-static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op))
+static int edbm_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1772,14 +1633,14 @@ void MESH_OT_faces_shade_smooth(wmOperatorType *ot)
ot->idname = "MESH_OT_faces_shade_smooth";
/* api callbacks */
- ot->exec = mesh_faces_shade_smooth_exec;
+ ot->exec = edbm_faces_shade_smooth_exec;
ot->poll = ED_operator_editmesh;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op))
+static int edbm_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1800,7 +1661,7 @@ void MESH_OT_faces_shade_flat(wmOperatorType *ot)
ot->idname = "MESH_OT_faces_shade_flat";
/* api callbacks */
- ot->exec = mesh_faces_shade_flat_exec;
+ ot->exec = edbm_faces_shade_flat_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -1810,13 +1671,7 @@ void MESH_OT_faces_shade_flat(wmOperatorType *ot)
/********************** UV/Color Operators *************************/
-
-static const EnumPropertyItem axis_items[] = {
- {OPUVC_AXIS_X, "X", 0, "X", ""},
- {OPUVC_AXIS_Y, "Y", 0, "Y", ""},
- {0, NULL, 0, NULL, NULL}};
-
-static int mesh_rotate_uvs(bContext *C, wmOperator *op)
+static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(ob);
@@ -1844,7 +1699,7 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int mesh_reverse_uvs(bContext *C, wmOperator *op)
+static int edbm_reverse_uvs_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(ob);
@@ -1869,7 +1724,7 @@ static int mesh_reverse_uvs(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int mesh_rotate_colors(bContext *C, wmOperator *op)
+static int edbm_rotate_colors_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(ob);
@@ -1900,7 +1755,7 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op)
}
-static int mesh_reverse_colors(bContext *C, wmOperator *op)
+static int edbm_reverse_colors_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(ob);
@@ -1931,7 +1786,7 @@ void MESH_OT_uvs_rotate(wmOperatorType *ot)
ot->idname = "MESH_OT_uvs_rotate";
/* api callbacks */
- ot->exec = mesh_rotate_uvs;
+ ot->exec = edbm_rotate_uvs_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -1949,7 +1804,7 @@ void MESH_OT_uvs_reverse(wmOperatorType *ot)
ot->idname = "MESH_OT_uvs_reverse";
/* api callbacks */
- ot->exec = mesh_reverse_uvs;
+ ot->exec = edbm_reverse_uvs_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -1966,7 +1821,7 @@ void MESH_OT_colors_rotate(wmOperatorType *ot)
ot->idname = "MESH_OT_colors_rotate";
/* api callbacks */
- ot->exec = mesh_rotate_colors;
+ ot->exec = edbm_rotate_colors_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -1983,7 +1838,7 @@ void MESH_OT_colors_reverse(wmOperatorType *ot)
ot->idname = "MESH_OT_colors_reverse";
/* api callbacks */
- ot->exec = mesh_reverse_colors;
+ ot->exec = edbm_reverse_colors_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2068,7 +1923,7 @@ static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob,
return OPERATOR_FINISHED;
}
-static int merge_exec(bContext *C, wmOperator *op)
+static int edbm_merge_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -2076,7 +1931,7 @@ static int merge_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(obedit);
int status = 0, uvs = RNA_boolean_get(op->ptr, "uvs");
- switch(RNA_enum_get(op->ptr, "type")) {
+ switch (RNA_enum_get(op->ptr, "type")) {
case 3:
status = merge_target(em, scene, v3d, obedit, 0, uvs, op);
break;
@@ -2162,7 +2017,7 @@ void MESH_OT_merge(wmOperatorType *ot)
ot->idname = "MESH_OT_merge";
/* api callbacks */
- ot->exec = merge_exec;
+ ot->exec = edbm_merge_exec;
ot->invoke = WM_menu_invoke;
ot->poll = ED_operator_editmesh;
@@ -2176,7 +2031,7 @@ void MESH_OT_merge(wmOperatorType *ot)
}
-static int removedoublesflag_exec(bContext *C, wmOperator *op)
+static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2197,7 +2052,7 @@ static int removedoublesflag_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- BKE_reportf(op->reports, RPT_INFO, "Removed %d vert%s", count, (count==1)?"ex":"ices");
+ BKE_reportf(op->reports, RPT_INFO, "Removed %d vert%s", count, (count == 1) ? "ex" : "ices");
DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
@@ -2213,7 +2068,7 @@ void MESH_OT_remove_doubles(wmOperatorType *ot)
ot->idname = "MESH_OT_remove_doubles";
/* api callbacks */
- ot->exec = removedoublesflag_exec;
+ ot->exec = edbm_remove_doubles_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2240,7 +2095,7 @@ typedef struct PathEdge {
-static int select_vertex_path_exec(bContext *C, wmOperator *op)
+static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(ob);
@@ -2270,7 +2125,7 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op)
/* EDBM_flag_disable_all(em, BM_ELEM_SELECT); */
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ELEM_SELECT, BM_ALL, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
/* finish the operator */
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
@@ -2303,7 +2158,7 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot)
ot->idname = "MESH_OT_select_vertex_path";
/* api callbacks */
- ot->exec = select_vertex_path_exec;
+ ot->exec = edbm_select_vertex_path_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2326,7 +2181,7 @@ static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *c
}
/* based on mouse cursor position, it defines how is being ripped */
-static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Object *obedit = CTX_data_edit_object(C);
ARegion *ar = CTX_wm_region(C);
@@ -2568,7 +2423,7 @@ void MESH_OT_rip(wmOperatorType *ot)
ot->idname = "MESH_OT_rip";
/* api callbacks */
- ot->invoke = mesh_rip_invoke;
+ ot->invoke = edbm_rip_invoke;
ot->poll = EM_view3d_poll;
/* flags */
@@ -2617,7 +2472,7 @@ static void shape_propagate(Object *obedit, BMEditMesh *em, wmOperator *op)
}
-static int shape_propagate_to_all_exec(bContext *C, wmOperator *op)
+static int edbm_shape_propagate_to_all_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
Mesh *me = obedit->data;
@@ -2640,7 +2495,7 @@ void MESH_OT_shape_propagate_to_all(wmOperatorType *ot)
ot->idname = "MESH_OT_shape_propagate_to_all";
/* api callbacks */
- ot->exec = shape_propagate_to_all_exec;
+ ot->exec = edbm_shape_propagate_to_all_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2648,7 +2503,7 @@ void MESH_OT_shape_propagate_to_all(wmOperatorType *ot)
}
/* BMESH_TODO this should be properly encapsulated in a bmop. but later.*/
-static int blend_from_shape_exec(bContext *C, wmOperator *op)
+static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
Mesh *me = obedit->data;
@@ -2735,7 +2590,7 @@ void MESH_OT_blend_from_shape(wmOperatorType *ot)
ot->idname = "MESH_OT_blend_from_shape";
/* api callbacks */
- ot->exec = blend_from_shape_exec;
+ ot->exec = edbm_blend_from_shape_exec;
ot->invoke = WM_operator_props_popup;
ot->poll = ED_operator_editmesh;
@@ -2750,7 +2605,7 @@ void MESH_OT_blend_from_shape(wmOperatorType *ot)
}
/* BMESH_TODO - some way to select on an arbitrary axis */
-static int select_axis_exec(bContext *C, wmOperator *op)
+static int edbm_select_axis_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2775,7 +2630,7 @@ static int select_axis_exec(bContext *C, wmOperator *op)
BM_ITER(ev, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
if (!BM_elem_flag_test(ev, BM_ELEM_HIDDEN)) {
- switch(mode) {
+ switch (mode) {
case -1: /* aligned */
if (fabs(ev->co[axis] - value) < limit)
BM_elem_select_set(em->bm, ev, TRUE);
@@ -2819,7 +2674,7 @@ void MESH_OT_select_axis(wmOperatorType *ot)
ot->idname = "MESH_OT_select_axis";
/* api callbacks */
- ot->exec = select_axis_exec;
+ ot->exec = edbm_select_axis_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2830,7 +2685,7 @@ void MESH_OT_select_axis(wmOperatorType *ot)
RNA_def_enum(ot->srna, "axis", axis_items_xyz, 0, "Axis", "Select the axis to compare each vertex on");
}
-static int solidify_exec(bContext *C, wmOperator *op)
+static int edbm_solidify_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
Mesh *me = obedit->data;
@@ -2847,13 +2702,13 @@ static int solidify_exec(bContext *C, wmOperator *op)
/* deselect only the faces in the region to be solidified (leave wire
* edges and loose verts selected, as there will be no corresponding
* geometry selected below) */
- BMO_slot_buffer_hflag_disable(bm, &bmop, "geom", BM_ELEM_SELECT, BM_FACE, TRUE);
+ BMO_slot_buffer_hflag_disable(bm, &bmop, "geom", BM_FACE, BM_ELEM_SELECT, TRUE);
/* run the solidify operator */
BMO_op_exec(bm, &bmop);
/* select the newly generated faces */
- BMO_slot_buffer_hflag_enable(bm, &bmop, "geomout", BM_ELEM_SELECT, BM_FACE, TRUE);
+ BMO_slot_buffer_hflag_enable(bm, &bmop, "geomout", BM_FACE, BM_ELEM_SELECT, TRUE);
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
@@ -2875,7 +2730,7 @@ void MESH_OT_solidify(wmOperatorType *ot)
ot->idname = "MESH_OT_solidify";
/* api callbacks */
- ot->exec = solidify_exec;
+ ot->exec = edbm_solidify_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2942,7 +2797,7 @@ static float bm_edge_seg_isect(BMEdge *e, CutCurve *c, int len, char mode,
int i;
//threshold = 0.000001; /* tolerance for vertex intersection */
- // XXX threshold = scene->toolsettings->select_thresh / 100;
+ // XXX threshold = scene->toolsettings->select_thresh / 100;
/* Get screen coords of verts */
scr = BLI_ghash_lookup(gh, e->v1);
@@ -2965,7 +2820,7 @@ static float bm_edge_seg_isect(BMEdge *e, CutCurve *c, int len, char mode,
*isected = 0;
- /* check for *exact* vertex intersection first */
+ /* check for _exact_ vertex intersection first */
if (mode != KNIFE_MULTICUT) {
for (i = 0; i < len; i++) {
if (i > 0) {
@@ -3082,12 +2937,12 @@ static float bm_edge_seg_isect(BMEdge *e, CutCurve *c, int len, char mode,
}
lastdist = dist;
}
- return(perc);
+ return perc;
}
#define MAX_CUTS 2048
-static int knife_cut_exec(bContext *C, wmOperator *op)
+static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -3118,7 +2973,9 @@ static int knife_cut_exec(bContext *C, wmOperator *op)
RNA_float_get_array(&itemptr, "loc", (float *)&curve[len]);
len++;
- if (len >= MAX_CUTS) break;
+ if (len >= MAX_CUTS) {
+ break;
+ }
}
RNA_END;
@@ -3164,7 +3021,7 @@ static int knife_cut_exec(bContext *C, wmOperator *op)
}
}
- BMO_slot_buffer_from_flag(bm, &bmop, "edges", 1, BM_EDGE);
+ BMO_slot_buffer_from_flag(bm, &bmop, "edges", BM_EDGE, 1);
if (mode == KNIFE_MIDPOINT) numcuts = 1;
BMO_slot_int_set(&bmop, "numcuts", numcuts);
@@ -3199,7 +3056,7 @@ void MESH_OT_knife_cut(wmOperatorType *ot)
ot->invoke = WM_gesture_lines_invoke;
ot->modal = WM_gesture_lines_modal;
- ot->exec = knife_cut_exec;
+ ot->exec = edbm_knife_cut_exec;
ot->poll = EM_view3d_poll;
@@ -3228,7 +3085,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
if (!em)
return OPERATOR_CANCELLED;
- bm_new = BM_mesh_create(obedit, &bm_mesh_allocsize_default);
+ bm_new = BM_mesh_create(&bm_mesh_allocsize_default);
CustomData_copy(&em->bm->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&em->bm->edata, &bm_new->edata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&em->bm->ldata, &bm_new->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
@@ -3360,7 +3217,7 @@ static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase, wmOper
return result;
}
-static int mesh_separate_exec(bContext *C, wmOperator *op)
+static int edbm_separate_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -3401,7 +3258,7 @@ void MESH_OT_separate(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_menu_invoke;
- ot->exec = mesh_separate_exec;
+ ot->exec = edbm_separate_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -3411,7 +3268,7 @@ void MESH_OT_separate(wmOperatorType *ot)
}
-static int fill_mesh_exec(bContext *C, wmOperator *op)
+static int edbm_fill_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -3424,7 +3281,7 @@ static int fill_mesh_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
/* select new geometry */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ELEM_SELECT, BM_FACE|BM_EDGE, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_FACE|BM_EDGE, BM_ELEM_SELECT, TRUE);
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
@@ -3444,14 +3301,14 @@ void MESH_OT_fill(wmOperatorType *ot)
ot->idname = "MESH_OT_fill";
/* api callbacks */
- ot->exec = fill_mesh_exec;
+ ot->exec = edbm_fill_exec;
ot->poll = ED_operator_editmesh;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int beautify_fill_exec(bContext *C, wmOperator *op)
+static int edbm_beautify_fill_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -3472,7 +3329,7 @@ void MESH_OT_beautify_fill(wmOperatorType *ot)
ot->idname = "MESH_OT_beautify_fill";
/* api callbacks */
- ot->exec = beautify_fill_exec;
+ ot->exec = edbm_beautify_fill_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -3481,7 +3338,7 @@ void MESH_OT_beautify_fill(wmOperatorType *ot)
/********************** Quad/Tri Operators *************************/
-static int quads_convert_to_tris_exec(bContext *C, wmOperator *op)
+static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -3503,7 +3360,7 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
ot->idname = "MESH_OT_quads_convert_to_tris";
/* api callbacks */
- ot->exec = quads_convert_to_tris_exec;
+ ot->exec = edbm_quads_convert_to_tris_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -3512,7 +3369,7 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_beauty", 1, "Beauty", "Use best triangulation division (currently quads only)");
}
-static int tris_convert_to_quads_exec(bContext *C, wmOperator *op)
+static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -3546,7 +3403,7 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
ot->idname = "MESH_OT_tris_convert_to_quads";
/* api callbacks */
- ot->exec = tris_convert_to_quads_exec;
+ ot->exec = edbm_tris_convert_to_quads_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -3562,7 +3419,53 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "materials", 0, "Compare Materials", "");
}
-static int dissolve_limited_exec(bContext *C, wmOperator *op)
+static int edbm_dissolve_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+
+ int use_verts = RNA_boolean_get(op->ptr, "use_verts");
+
+ if (em->selectmode & SCE_SELECT_FACE) {
+ if (!EDBM_CallOpf(em, op, "dissolve_faces faces=%hf use_verts=%b", BM_ELEM_SELECT, use_verts))
+ return OPERATOR_CANCELLED;
+ }
+ else if (em->selectmode & SCE_SELECT_EDGE) {
+ if (!EDBM_CallOpf(em, op, "dissolve_edges edges=%he use_verts=%b", BM_ELEM_SELECT, use_verts))
+ return OPERATOR_CANCELLED;
+ }
+ else if (em->selectmode & SCE_SELECT_VERTEX) {
+ if (!EDBM_CallOpf(em, op, "dissolve_verts verts=%hv", BM_ELEM_SELECT))
+ return OPERATOR_CANCELLED;
+ }
+
+ DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA|ND_SELECT, obedit);
+
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_dissolve(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Dissolve";
+ ot->description = "Dissolve geometry";
+ ot->idname = "MESH_OT_dissolve";
+
+ /* api callbacks */
+ ot->exec = edbm_dissolve_exec;
+ ot->poll = ED_operator_editmesh;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* TODO, move dissolve into its own operator so this doesnt confuse non-dissolve options */
+ RNA_def_boolean(ot->srna, "use_verts", 0, "Dissolve Verts",
+ "When dissolving faces/edges, also dissolve remaining vertices");
+}
+
+static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -3591,7 +3494,7 @@ void MESH_OT_dissolve_limited(wmOperatorType *ot)
ot->description = "Dissolve selected edges and verts, limited by the angle of surrounding geometry";
/* api callbacks */
- ot->exec = dissolve_limited_exec;
+ ot->exec = edbm_dissolve_limited_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -3602,7 +3505,7 @@ void MESH_OT_dissolve_limited(wmOperatorType *ot)
RNA_def_property_float_default(prop, DEG2RADF(15.0f));
}
-static int split_mesh_exec(bContext *C, wmOperator *op)
+static int edbm_split_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(ob);
@@ -3611,7 +3514,7 @@ static int split_mesh_exec(bContext *C, wmOperator *op)
EDBM_InitOpf(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, FALSE);
BMO_op_exec(em->bm, &bmop);
BM_mesh_elem_flag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ELEM_SELECT, BM_ALL, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, TRUE);
if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
}
@@ -3633,7 +3536,7 @@ void MESH_OT_split(wmOperatorType *ot)
ot->idname = "MESH_OT_split";
/* api callbacks */
- ot->exec = split_mesh_exec;
+ ot->exec = edbm_split_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -3641,7 +3544,7 @@ void MESH_OT_split(wmOperatorType *ot)
}
-static int spin_mesh_exec(bContext *C, wmOperator *op)
+static int edbm_spin_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
ToolSettings *ts = CTX_data_tool_settings(C);
@@ -3674,7 +3577,7 @@ static int spin_mesh_exec(bContext *C, wmOperator *op)
}
BMO_op_exec(bm, &spinop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ELEM_SELECT, BM_ALL, TRUE);
+ BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE);
if (!EDBM_FinishOp(em, &spinop, op, TRUE)) {
return OPERATOR_CANCELLED;
}
@@ -3686,7 +3589,7 @@ static int spin_mesh_exec(bContext *C, wmOperator *op)
}
/* get center and axis, in global coords */
-static int spin_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int edbm_spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -3695,7 +3598,7 @@ static int spin_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
RNA_float_set_array(op->ptr, "center", give_cursor(scene, v3d));
RNA_float_set_array(op->ptr, "axis", rv3d->viewinv[2]);
- return spin_mesh_exec(C, op);
+ return edbm_spin_exec(C, op);
}
void MESH_OT_spin(wmOperatorType *ot)
@@ -3705,8 +3608,8 @@ void MESH_OT_spin(wmOperatorType *ot)
ot->idname = "MESH_OT_spin";
/* api callbacks */
- ot->invoke = spin_mesh_invoke;
- ot->exec = spin_mesh_exec;
+ ot->invoke = edbm_spin_invoke;
+ ot->exec = edbm_spin_exec;
ot->poll = EM_view3d_poll;
/* flags */
@@ -3722,7 +3625,7 @@ void MESH_OT_spin(wmOperatorType *ot)
}
-static int screw_mesh_exec(bContext *C, wmOperator *op)
+static int edbm_screw_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -3800,7 +3703,7 @@ static int screw_mesh_exec(bContext *C, wmOperator *op)
}
BMO_op_exec(bm, &spinop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ELEM_SELECT, BM_ALL, TRUE);
+ BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE);
if (!EDBM_FinishOp(em, &spinop, op, TRUE)) {
return OPERATOR_CANCELLED;
}
@@ -3812,7 +3715,7 @@ static int screw_mesh_exec(bContext *C, wmOperator *op)
}
/* get center and axis, in global coords */
-static int screw_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int edbm_screw_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -3821,7 +3724,7 @@ static int screw_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
RNA_float_set_array(op->ptr, "center", give_cursor(scene, v3d));
RNA_float_set_array(op->ptr, "axis", rv3d->viewinv[1]);
- return screw_mesh_exec(C, op);
+ return edbm_screw_exec(C, op);
}
void MESH_OT_screw(wmOperatorType *ot)
@@ -3831,8 +3734,8 @@ void MESH_OT_screw(wmOperatorType *ot)
ot->idname = "MESH_OT_screw";
/* api callbacks */
- ot->invoke = screw_mesh_invoke;
- ot->exec = screw_mesh_exec;
+ ot->invoke = edbm_screw_invoke;
+ ot->exec = edbm_screw_exec;
ot->poll = EM_view3d_poll;
/* flags */
@@ -3848,7 +3751,7 @@ void MESH_OT_screw(wmOperatorType *ot)
"Axis", "Axis in global view space", -FLT_MAX, FLT_MAX);
}
-static int select_by_number_vertices_exec(bContext *C, wmOperator *op)
+static int edbm_select_by_number_vertices_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -3864,11 +3767,14 @@ static int select_by_number_vertices_exec(bContext *C, wmOperator *op)
if (type == 0 && efa->len < numverts) {
select = 1;
- }else if (type == 1 && efa->len == numverts) {
+ }
+ else if (type == 1 && efa->len == numverts) {
select = 1;
- }else if (type == 2 && efa->len > numverts) {
+ }
+ else if (type == 2 && efa->len > numverts) {
select = 1;
- }else if (type == 3 && efa->len != numverts) {
+ }
+ else if (type == 3 && efa->len != numverts) {
select = 1;
}
@@ -3899,7 +3805,7 @@ void MESH_OT_select_by_number_vertices(wmOperatorType *ot)
ot->idname = "MESH_OT_select_by_number_vertices";
/* api callbacks */
- ot->exec = select_by_number_vertices_exec;
+ ot->exec = edbm_select_by_number_vertices_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -3910,7 +3816,7 @@ void MESH_OT_select_by_number_vertices(wmOperatorType *ot)
RNA_def_enum(ot->srna, "type", type_items, 1, "Type", "Type of comparison to make");
}
-static int select_loose_verts_exec(bContext *C, wmOperator *UNUSED(op))
+static int edbm_select_loose_verts_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -3948,14 +3854,14 @@ void MESH_OT_select_loose_verts(wmOperatorType *ot)
ot->idname = "MESH_OT_select_loose_verts";
/* api callbacks */
- ot->exec = select_loose_verts_exec;
+ ot->exec = edbm_select_loose_verts_exec;
ot->poll = ED_operator_editmesh;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int select_mirror_exec(bContext *C, wmOperator *op)
+static int edbm_select_mirror_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -3976,7 +3882,7 @@ void MESH_OT_select_mirror(wmOperatorType *ot)
ot->idname = "MESH_OT_select_mirror";
/* api callbacks */
- ot->exec = select_mirror_exec;
+ ot->exec = edbm_select_mirror_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -4050,7 +3956,7 @@ static void xsortvert_flag(bContext *UNUSED(C), int UNUSED(flag))
em = vc.em;
amount = em->bm->totvert;
- sortblock = MEM_callocN(sizeof(xvertsort) * amount,"xsort");
+ sortblock = MEM_callocN(sizeof(xvertsort) * amount, "xsort");
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT))
sortblock[i].v1 = eve;
@@ -4079,7 +3985,7 @@ static void xsortvert_flag(bContext *UNUSED(C), int UNUSED(flag))
}
-static int mesh_vertices_sort_exec(bContext *C, wmOperator *UNUSED(op))
+static int edbm_vertices_sort_exec(bContext *C, wmOperator *UNUSED(op))
{
xsortvert_flag(C, SELECT);
return OPERATOR_FINISHED;
@@ -4093,7 +3999,7 @@ void MESH_OT_vertices_sort(wmOperatorType *ot)
ot->idname = "MESH_OT_vertices_sort";
/* api callbacks */
- ot->exec = mesh_vertices_sort_exec;
+ ot->exec = edbm_vertices_sort_exec;
ot->poll = EM_view3d_poll; /* uses view relative X axis to sort verts */
@@ -4134,7 +4040,7 @@ static int float_sort(const void *v1, const void *v2)
return 0;
}
-static int sort_faces_exec(bContext *C, wmOperator *op)
+static int edbm_sort_faces_exec(bContext *C, wmOperator *op)
{
RegionView3D *rv3d = ED_view3d_context_rv3d(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -4210,7 +4116,7 @@ static int sort_faces_exec(bContext *C, wmOperator *op)
for (i = 0; i < me->totpoly; i++, mp++) {
if (event == 3) {
- face_sort_floats[i] = ((float)mp->mat_nr)*reverse;
+ face_sort_floats[i] = ((float)mp->mat_nr) * reverse;
}
else if (event == 4) {
/* selected first */
@@ -4273,7 +4179,7 @@ void MESH_OT_sort_faces(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_menu_invoke;
- ot->exec = sort_faces_exec;
+ ot->exec = edbm_sort_faces_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -4303,7 +4209,7 @@ static void hashvert_flag(EditMesh *em, int flag)
if (amount == 0) return;
/* allocate memory */
- sb = sortblock = (struct xvertsort *)MEM_mallocN(sizeof(struct xvertsort)*amount,"sortremovedoub");
+ sb = sortblock = (struct xvertsort *)MEM_mallocN(sizeof(struct xvertsort) * amount, "sortremovedoub");
eve = em->verts.first;
while (eve) {
if (eve->f & flag) {
@@ -4343,7 +4249,7 @@ static void hashvert_flag(EditMesh *em, int flag)
}
#endif
-static int mesh_vertices_randomize_exec(bContext *C, wmOperator *UNUSED(op))
+static int edbm_vertices_randomize_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -4363,7 +4269,7 @@ void MESH_OT_vertices_randomize(wmOperatorType *ot)
ot->idname = "MESH_OT_vertices_randomize";
/* api callbacks */
- ot->exec = mesh_vertices_randomize_exec;
+ ot->exec = edbm_vertices_randomize_exec;
ot->poll = ED_operator_editmesh;
@@ -4374,7 +4280,7 @@ void MESH_OT_vertices_randomize(wmOperatorType *ot)
/******end of qsort stuff ****/
-static int mesh_noise_exec(bContext *C, wmOperator *op)
+static int edbm_noise_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -4436,7 +4342,7 @@ void MESH_OT_noise(wmOperatorType *ot)
ot->idname = "MESH_OT_noise";
/* api callbacks */
- ot->exec = mesh_noise_exec;
+ ot->exec = edbm_noise_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -4446,14 +4352,14 @@ void MESH_OT_noise(wmOperatorType *ot)
}
/* bevel! yay!!*/
-static int mesh_bevel_exec(bContext *C, wmOperator *op)
+static int edbm_bevel_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
BMIter iter;
BMEdge *eed;
BMOperator bmop;
- float factor = RNA_float_get(op->ptr, "percent"), fac = factor /*, dfac */ /* UNUSED */, df, s;
+ float factor = RNA_float_get(op->ptr, "percent") /*, dfac */ /* UNUSED */, df, s;
int i, recursion = RNA_int_get(op->ptr, "recursion");
const int use_even = RNA_boolean_get(op->ptr, "use_even");
const int use_dist = RNA_boolean_get(op->ptr, "use_dist");
@@ -4490,9 +4396,8 @@ static int mesh_bevel_exec(bContext *C, wmOperator *op)
mul_vn_fl(w, recursion, 1.0f / (float)ftot);
- fac = factor;
for (i = 0; i < recursion; i++) {
- fac = w[recursion - i - 1] * factor;
+ float fac = w[recursion - i - 1] * factor;
if (!EDBM_InitOpf(em, &bmop, op,
"bevel geom=%hev percent=%f lengthlayer=%i use_lengths=%b use_even=%b use_dist=%b",
@@ -4526,7 +4431,7 @@ void MESH_OT_bevel(wmOperatorType *ot)
ot->idname = "MESH_OT_bevel";
/* api callbacks */
- ot->exec = mesh_bevel_exec;
+ ot->exec = edbm_bevel_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -4540,7 +4445,7 @@ void MESH_OT_bevel(wmOperatorType *ot)
}
-static int bridge_edge_loops(bContext *C, wmOperator *op)
+static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -4557,12 +4462,12 @@ static int bridge_edge_loops(bContext *C, wmOperator *op)
void MESH_OT_bridge_edge_loops(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Bridge edge loops";
+ ot->name = "Bridge Two Edge Loops";
ot->description = "Make faces between two edge loops";
ot->idname = "MESH_OT_bridge_edge_loops";
/* api callbacks */
- ot->exec = bridge_edge_loops;
+ ot->exec = edbm_bridge_edge_loops_exec;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -4571,7 +4476,70 @@ void MESH_OT_bridge_edge_loops(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "inside", 0, "Inside", "");
}
-static int mark_freestyle_edge(bContext *C, wmOperator *op)
+
+
+static int edbm_inset_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+ BMOperator bmop;
+ const int use_boundary = FALSE; //RNA_boolean_get(op->ptr, "use_boundary");
+ const int use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset");
+ const int use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
+ const float thickness = RNA_float_get(op->ptr, "thickness");
+ const int use_outset = RNA_boolean_get(op->ptr, "use_outset");
+
+ EDBM_InitOpf(em, &bmop, op,
+ "inset faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b thickness=%f use_outset=%b",
+ BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, thickness, use_outset);
+
+ BMO_op_exec(em->bm, &bmop);
+
+ /* deselect original verts */
+ EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+
+ if (!EDBM_FinishOp(em, &bmop, op, TRUE)) {
+ return OPERATOR_CANCELLED;
+ }
+ else {
+ DAG_id_tag_update(obedit->data, 0);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+
+ return OPERATOR_FINISHED;
+ }
+}
+
+void MESH_OT_inset(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name = "Inset Faces";
+ ot->idname = "MESH_OT_inset";
+
+ /* api callbacks */
+ ot->exec = edbm_inset_exec;
+ ot->poll = ED_operator_editmesh;
+ ot->description = "";
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+ // RNA_def_boolean(ot->srna, "use_boundary", TRUE, "Boundary", "Inset face boundries");
+ RNA_def_boolean(ot->srna, "use_even_offset", TRUE, "Offset Even", "Scale the offset to give more even thickness");
+ RNA_def_boolean(ot->srna, "use_relative_offset", FALSE, "Offset Relative", "Scale the offset by surrounding geometry");
+
+ prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "thickness", "", 0.0f, 10.0f);
+ /* use 1 rather then 10 for max else dragging the button moves too far */
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
+
+ RNA_def_boolean(ot->srna, "use_outset", FALSE, "Outset", "outset rather then inset");
+}
+
+static int edbm_mark_freestyle_edge(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
Mesh *me = ((Mesh *)obedit->data);
@@ -4609,21 +4577,21 @@ static int mark_freestyle_edge(bContext *C, wmOperator *op)
void MESH_OT_mark_freestyle_edge(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mark Freestyle Edge";
- ot->description= "(un)mark selected edges as Freestyle feature edges";
- ot->idname= "MESH_OT_mark_freestyle_edge";
+ ot->name = "Mark Freestyle Edge";
+ ot->description = "(un)mark selected edges as Freestyle feature edges";
+ ot->idname = "MESH_OT_mark_freestyle_edge";
/* api callbacks */
- ot->exec= mark_freestyle_edge;
- ot->poll= ED_operator_editmesh;
+ ot->exec = edbm_mark_freestyle_edge;
+ ot->poll = ED_operator_editmesh;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
}
-static int mark_freestyle_face_exec(bContext *C, wmOperator *op)
+static int edbm_mark_freestyle_face_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
Mesh *me = ((Mesh *)obedit->data);
@@ -4660,16 +4628,17 @@ static int mark_freestyle_face_exec(bContext *C, wmOperator *op)
void MESH_OT_mark_freestyle_face(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mark Freestyle Face";
- ot->description= "(un)mark selected faces for exclusion from Freestyle feature edge detection";
- ot->idname= "MESH_OT_mark_freestyle_face";
+ ot->name = "Mark Freestyle Face";
+ ot->description = "(un)mark selected faces for exclusion from Freestyle feature edge detection";
+ ot->idname = "MESH_OT_mark_freestyle_face";
/* api callbacks */
- ot->exec= mark_freestyle_face_exec;
- ot->poll= ED_operator_editmesh;
+ ot->exec = edbm_mark_freestyle_face_exec;
+ ot->poll = ED_operator_editmesh;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
}
+
diff --git a/source/blender/editors/mesh/bmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index bee4d4283f6..bf37dbbea2e 100644
--- a/source/blender/editors/mesh/bmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -25,6 +25,10 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/mesh/editmesh_utils.c
+ * \ingroup edmesh
+ */
+
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
@@ -212,7 +216,7 @@ int EDBM_CallAndSelectOpf(BMEditMesh *em, wmOperator *op, const char *selectslot
BM_mesh_elem_flag_disable_all(em->bm, BM_VERT|BM_EDGE|BM_FACE, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, selectslot, BM_ELEM_SELECT, BM_ALL, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, selectslot, BM_ALL, BM_ELEM_SELECT, TRUE);
va_end(list);
return EDBM_FinishOp(em, &bmop, op, TRUE);
@@ -421,8 +425,8 @@ void EDBM_select_more(BMEditMesh *em)
"regionextend geom=%hvef constrict=%b use_faces=%b",
BM_ELEM_SELECT, FALSE, use_faces);
BMO_op_exec(em->bm, &bmop);
- /* dont flush selection in edge/vertex mode */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ELEM_SELECT, BM_ALL, use_faces ? TRUE : FALSE);
+ /* don't flush selection in edge/vertex mode */
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
BMO_op_finish(em->bm, &bmop);
EDBM_select_flush(em);
@@ -437,8 +441,8 @@ void EDBM_select_less(BMEditMesh *em)
"regionextend geom=%hvef constrict=%b use_faces=%b",
BM_ELEM_SELECT, TRUE, use_faces);
BMO_op_exec(em->bm, &bmop);
- /* dont flush selection in edge/vertex mode */
- BMO_slot_buffer_hflag_disable(em->bm, &bmop, "geomout", BM_ELEM_SELECT, BM_ALL, use_faces ? TRUE : FALSE);
+ /* don't flush selection in edge/vertex mode */
+ BMO_slot_buffer_hflag_disable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
BMO_op_finish(em->bm, &bmop);
EDBM_selectmode_flush(em);
@@ -514,7 +518,7 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
Mesh *obme = obdata;
undomesh *um = MEM_callocN(sizeof(undomesh), "undo Mesh");
- BLI_strncpy(um->obname, em->bm->ob->id.name + 2, sizeof(um->obname));
+ BLI_strncpy(um->obname, em->ob->id.name + 2, sizeof(um->obname));
/* make sure shape keys work */
um->me.key = obme->key ? copy_key_nolib(obme->key) : NULL;
@@ -527,6 +531,8 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
#endif
+ /* BM_mesh_validate(em->bm); */ /* for troubleshooting */
+
BMO_op_callf(em->bm, "bmesh_to_mesh mesh=%p notessellation=%b", &um->me, TRUE);
um->selectmode = em->selectmode;
@@ -546,7 +552,7 @@ static void undoMesh_to_editbtMesh(void *umv, void *emv, void *UNUSED(obdata))
BMEdit_Free(em);
- bm = BM_mesh_create(ob, &bm_mesh_allocsize_default);
+ bm = BM_mesh_create(&bm_mesh_allocsize_default);
BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", &um->me, ob, FALSE);
em2 = BMEdit_Create(bm, TRUE);
@@ -560,7 +566,7 @@ static void undoMesh_to_editbtMesh(void *umv, void *emv, void *UNUSED(obdata))
static void free_undo(void *umv)
{
- if (((Mesh *)umv)->key) {
+ if (((Mesh *)umv)->key) {
free_key(((Mesh *)umv)->key);
MEM_freeN(((Mesh *)umv)->key);
}
@@ -572,6 +578,13 @@ static void free_undo(void *umv)
/* and this is all the undo system needs to know */
void undo_push_mesh(bContext *C, const char *name)
{
+ /* em->ob gets out of date and crashes on mesh undo,
+ * this is an easy way to ensure its OK
+ * though we could investigate the matter further. */
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+ em->ob = obedit;
+
undo_editmode_push(C, name, getEditMesh, free_undo, undoMesh_to_editbtMesh, editbtMesh_to_undoMesh, NULL);
}
@@ -616,8 +629,8 @@ UvVertMap *EDBM_make_uv_vert_map(BMEditMesh *em, int selected, int do_face_idx_a
return NULL;
}
- vmap->vert = (UvMapVert **)MEM_callocN(sizeof(*vmap->vert)*totverts, "UvMapVert_pt");
- buf = vmap->buf = (UvMapVert *)MEM_callocN(sizeof(*vmap->buf)*totuv, "UvMapVert");
+ vmap->vert = (UvMapVert **)MEM_callocN(sizeof(*vmap->vert) * totverts, "UvMapVert_pt");
+ buf = vmap->buf = (UvMapVert *)MEM_callocN(sizeof(*vmap->buf) * totuv, "UvMapVert");
if (!vmap->vert || !vmap->buf) {
free_uv_vert_map(vmap);
@@ -741,7 +754,7 @@ UvElementMap *EDBM_make_uv_element_map(BMEditMesh *em, int selected, int do_isla
totverts = em->bm->totvert;
totuv = 0;
- island_number = MEM_mallocN(sizeof(*stack)*em->bm->totface, "uv_island_number_face");
+ island_number = MEM_mallocN(sizeof(*stack) * em->bm->totface, "uv_island_number_face");
if (!island_number) {
return NULL;
}
@@ -841,9 +854,9 @@ UvElementMap *EDBM_make_uv_element_map(BMEditMesh *em, int selected, int do_isla
if (do_islands) {
/* map holds the map from current vmap->buf to the new, sorted map */
- map = MEM_mallocN(sizeof(*map)*totuv, "uvelement_remap");
- stack = MEM_mallocN(sizeof(*stack)*em->bm->totface, "uv_island_face_stack");
- islandbuf = MEM_callocN(sizeof(*islandbuf)*totuv, "uvelement_island_buffer");
+ map = MEM_mallocN(sizeof(*map) * totuv, "uvelement_remap");
+ stack = MEM_mallocN(sizeof(*stack) * em->bm->totface, "uv_island_face_stack");
+ islandbuf = MEM_callocN(sizeof(*islandbuf) * totuv, "uvelement_island_buffer");
/* at this point, every UvElement in vert points to a UvElement sharing the same vertex. Now we should sort uv's in islands. */
for (i = 0; i < totuv; i++) {
@@ -900,7 +913,7 @@ UvElementMap *EDBM_make_uv_element_map(BMEditMesh *em, int selected, int do_isla
element_map->vert[i] = &islandbuf[map[element_map->vert[i] - element_map->buf]];
}
- element_map->islandIndices = MEM_callocN(sizeof(*element_map->islandIndices)*nislands,"UvElementMap_island_indices");
+ element_map->islandIndices = MEM_callocN(sizeof(*element_map->islandIndices) * nislands, "UvElementMap_island_indices");
if (!element_map->islandIndices) {
MEM_freeN(islandbuf);
MEM_freeN(stack);
@@ -1142,3 +1155,119 @@ void EDBM_ApplyMirrorCache(BMEditMesh *em, const int sel_from, const int sel_to)
}
}
}
+
+
+/* swap is 0 or 1, if 1 it hides not selected */
+void EDBM_hide_mesh(BMEditMesh *em, int swap)
+{
+ BMIter iter;
+ BMElem *ele;
+ int itermode;
+
+ if (em == NULL) return;
+
+ if (em->selectmode & SCE_SELECT_VERTEX)
+ itermode = BM_VERTS_OF_MESH;
+ else if (em->selectmode & SCE_SELECT_EDGE)
+ itermode = BM_EDGES_OF_MESH;
+ else
+ itermode = BM_FACES_OF_MESH;
+
+ BM_ITER(ele, &iter, em->bm, itermode, NULL) {
+ if (BM_elem_flag_test(ele, BM_ELEM_SELECT) ^ swap)
+ BM_elem_hide_set(em->bm, ele, TRUE);
+ }
+
+ EDBM_selectmode_flush(em);
+
+ /* original hide flushing comment (OUTDATED):
+ * hide happens on least dominant select mode, and flushes up, not down! (helps preventing errors in subsurf) */
+ /* - vertex hidden, always means edge is hidden too
+ * - edge hidden, always means face is hidden too
+ * - face hidden, only set face hide
+ * - then only flush back down what's absolute hidden
+ */
+}
+
+
+void EDBM_reveal_mesh(BMEditMesh *em)
+{
+ const char iter_types[3] = {BM_VERTS_OF_MESH,
+ BM_EDGES_OF_MESH,
+ BM_FACES_OF_MESH};
+
+ int sels[3] = {(em->selectmode & SCE_SELECT_VERTEX),
+ (em->selectmode & SCE_SELECT_EDGE),
+ (em->selectmode & SCE_SELECT_FACE),
+ };
+
+ BMIter iter;
+ BMElem *ele;
+ int i;
+
+ /* Use tag flag to remember what was hidden before all is revealed.
+ * BM_ELEM_HIDDEN --> BM_ELEM_TAG */
+ for (i = 0; i < 3; i++) {
+ BM_ITER(ele, &iter, em->bm, iter_types[i], NULL) {
+ BM_elem_flag_set(ele, BM_ELEM_TAG, BM_elem_flag_test(ele, BM_ELEM_HIDDEN));
+ }
+ }
+
+ /* Reveal everything */
+ EDBM_flag_disable_all(em, BM_ELEM_HIDDEN);
+
+ /* Select relevant just-revealed elements */
+ for (i = 0; i < 3; i++) {
+ if (!sels[i]) {
+ continue;
+ }
+
+ BM_ITER(ele, &iter, em->bm, iter_types[i], NULL) {
+ if (BM_elem_flag_test(ele, BM_ELEM_TAG)) {
+ BM_elem_select_set(em->bm, ele, TRUE);
+ }
+ }
+ }
+
+ EDBM_selectmode_flush(em);
+}
+
+/* * Selection History ***************************************************** */
+/* these wrap equivalent bmesh functions. I'm in two minds of it we should
+ * just use the bm functions directly; on the one hand, there's no real
+ * need (at the moment) to wrap them, but on the other hand having these
+ * wrapped avoids a confusing mess of mixing BM_ and EDBM_ namespaces. */
+
+void EDBM_editselection_center(BMEditMesh *em, float *center, BMEditSelection *ese)
+{
+ BM_editselection_center(em->bm, center, ese);
+}
+
+void EDBM_editselection_normal(float *normal, BMEditSelection *ese)
+{
+ BM_editselection_normal(normal, ese);
+}
+
+/* Calculate a plane that is rightangles to the edge/vert/faces normal
+ * also make the plane run along an axis that is related to the geometry,
+ * because this is used for the manipulators Y axis. */
+void EDBM_editselection_plane(BMEditMesh *em, float *plane, BMEditSelection *ese)
+{
+ BM_editselection_plane(em->bm, plane, ese);
+}
+
+void EDBM_remove_selection(BMEditMesh *em, BMElem *ele)
+{
+ BM_select_history_remove(em->bm, ele);
+}
+
+void EDBM_store_selection(BMEditMesh *em, BMElem *ele)
+{
+ BM_select_history_store(em->bm, ele);
+}
+
+void EDBM_validate_selections(BMEditMesh *em)
+{
+ BM_select_history_validate(em->bm);
+}
+/* end select history */
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 428406ee3ee..770fd68079a 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -83,13 +83,26 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
int type= layer->type;
int index;
int i, actindex, rndindex, cloneindex, stencilindex, tot;
-
+
if (layer->type == CD_MLOOPCOL || layer->type == CD_MLOOPUV) {
- data = (me->edit_btmesh)? &me->edit_btmesh->bm->ldata: &me->ldata;
- tot = me->totloop;
- } else {
- data = (me->edit_btmesh)? &me->edit_btmesh->bm->pdata: &me->pdata;
- tot = me->totpoly;
+ if (me->edit_btmesh) {
+ data = &me->edit_btmesh->bm->ldata;
+ tot = me->edit_btmesh->bm->totloop;
+ }
+ else {
+ data = &me->ldata;
+ tot = me->totloop;
+ }
+ }
+ else {
+ if (me->edit_btmesh) {
+ data = &me->edit_btmesh->bm->pdata;
+ tot = me->edit_btmesh->bm->totface;
+ }
+ else {
+ data = &me->pdata;
+ tot = me->totpoly;
+ }
}
index = CustomData_get_layer_index(data, type);
@@ -107,7 +120,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
stencillayerdata = data->layers[CustomData_get_stencil_layer_index(data, type)].data;
CustomData_set_layer_active(data, type, layer - &data->layers[index]);
- if(me->edit_btmesh) {
+ if (me->edit_btmesh) {
BM_data_layer_free(me->edit_btmesh->bm, data, type);
}
else {
@@ -115,7 +128,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
mesh_update_customdata_pointers(me, TRUE);
}
- if(!CustomData_has_layer(data, type) && (type == CD_MLOOPCOL && (ob->mode & OB_MODE_VERTEX_PAINT)))
+ if (!CustomData_has_layer(data, type) && (type == CD_MLOOPCOL && (ob->mode & OB_MODE_VERTEX_PAINT)))
ED_object_toggle_modes(C, OB_MODE_VERTEX_PAINT);
/* reconstruct active layer */
@@ -186,7 +199,7 @@ static void copy_editface_active_customdata(BMEditMesh *em, int type, int index)
EditFace *efa;
int n= CustomData_get_active_layer(&em->fdata, type);
- for(efa= em->faces.first; efa; efa= efa->next) {
+ for (efa= em->faces.first; efa; efa= efa->next) {
void *data= CustomData_em_get_n(&em->fdata, efa->data, type, n);
CustomData_em_set_n(&em->fdata, efa->data, type, index, data);
}
@@ -259,7 +272,8 @@ int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
fuvs[2][0] = 1.0;
fuvs[2][1] = 1.0;
- } else if (len == 4) {
+ }
+ else if (len == 4) {
fuvs[0][0] = 0.0;
fuvs[0][1] = 0.0;
@@ -272,7 +286,8 @@ int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
fuvs[3][0] = 0.0;
fuvs[3][1] = 1.0;
/*make sure we ignore 2-sided faces*/
- } else if (len > 2) {
+ }
+ else if (len > 2) {
float fac = 0.0f, dfac = 1.0f / (float)len;
dfac *= M_PI*2;
@@ -288,7 +303,7 @@ int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
fuvs += len;
}
- /* BMESH_TODO: Copy poly UVs onto CD_MTFACE layer for tesselated faces */
+ /* BMESH_TODO: Copy poly UVs onto CD_MTFACE layer for tessellated faces */
BLI_array_free(uvs);
BLI_array_free(polylengths);
@@ -327,7 +342,7 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
CustomData_set_layer_name(&em->bm->ldata, CD_MLOOPUV, layernum, name);
CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPUV, layernum);
- if(active_set || layernum == 0) {
+ if (active_set || layernum == 0) {
CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPUV, layernum);
}
}
@@ -340,7 +355,8 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DUPLICATE, me->mtpoly, me->totpoly, name);
CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DUPLICATE, me->mloopuv, me->totloop, name);
CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DUPLICATE, me->mtface, me->totface, name);
- } else {
+ }
+ else {
CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DEFAULT, NULL, me->totpoly, name);
CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DEFAULT, NULL, me->totloop, name);
CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface, name);
@@ -401,12 +417,12 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes
return -1;
}
- BM_data_layer_add(em->bm, &em->bm->pdata, CD_MLOOPCOL);
+ BM_data_layer_add(em->bm, &em->bm->ldata, CD_MLOOPCOL);
CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum);
/* copy data from active vertex color layer */
if (layernum) {
- copy_editface_active_customdata(em, CD_MCOL, layernum);
+ copy_editface_active_customdata(em, CD_MLOOPCOL, layernum);
}
if (active_set || layernum == 0) {
@@ -419,16 +435,16 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes
return -1;
}
- if(me->mloopcol) {
+ if (me->mloopcol) {
CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop, name);
- CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mloopcol, me->totface, name);
+ CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mcol, me->totface, name);
}
else {
CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name);
CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface, name);
}
- if(active_set || layernum==0) {
+ if (active_set || layernum==0) {
CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, layernum);
CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
}
@@ -444,13 +460,14 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes
int ED_mesh_color_remove(bContext *C, Object *ob, Mesh *me)
{
+ CustomData *ldata = GET_CD_DATA(me, ldata);
CustomDataLayer *cdl;
int index;
- index= CustomData_get_active_layer_index(&me->ldata, CD_MLOOPCOL);
- cdl= (index == -1)? NULL: &me->ldata.layers[index];
+ index= CustomData_get_active_layer_index(ldata, CD_MLOOPCOL);
+ cdl= (index == -1)? NULL: &ldata->layers[index];
- if(!cdl)
+ if (!cdl)
return 0;
delete_customdata_layer(C, ob, cdl);
@@ -462,13 +479,14 @@ int ED_mesh_color_remove(bContext *C, Object *ob, Mesh *me)
int ED_mesh_color_remove_named(bContext *C, Object *ob, Mesh *me, const char *name)
{
+ CustomData *ldata = GET_CD_DATA(me, ldata);
CustomDataLayer *cdl;
int index;
- index= CustomData_get_named_layer_index(&me->ldata, CD_MLOOPCOL, name);
- cdl= (index == -1)? NULL: &me->ldata.layers[index];
+ index= CustomData_get_named_layer_index(ldata, CD_MLOOPCOL, name);
+ cdl = (index == -1) ? NULL : &ldata->layers[index];
- if(!cdl)
+ if (!cdl)
return 0;
delete_customdata_layer(C, ob, cdl);
@@ -487,12 +505,12 @@ static int layers_poll(bContext *C)
return (ob && !ob->id.lib && ob->type==OB_MESH && data && !data->lib);
}
-static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= ED_object_context(C);
Mesh *me= ob->data;
- if(ED_mesh_uv_texture_add(C, me, NULL, TRUE) == -1)
+ if (ED_mesh_uv_texture_add(C, me, NULL, TRUE) == -1)
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -501,16 +519,16 @@ static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
void MESH_OT_uv_texture_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add UV Map";
- ot->description= "Add UV Map";
- ot->idname= "MESH_OT_uv_texture_add";
+ ot->name = "Add UV Map";
+ ot->description = "Add UV Map";
+ ot->idname = "MESH_OT_uv_texture_add";
/* api callbacks */
- ot->poll= layers_poll;
- ot->exec= uv_texture_add_exec;
+ ot->poll = layers_poll;
+ ot->exec = mesh_uv_texture_add_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -526,13 +544,13 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
char name[MAX_ID_NAME-2];
/* Check context */
- if(base==NULL || base->object->type!=OB_MESH) {
+ if (base==NULL || base->object->type!=OB_MESH) {
BKE_report(op->reports, RPT_ERROR, "Not an Object or Mesh");
return OPERATOR_CANCELLED;
}
/* check input variables */
- if(RNA_struct_property_is_set(op->ptr, "filepath")) {
+ if (RNA_struct_property_is_set(op->ptr, "filepath")) {
char path[FILE_MAX];
RNA_string_get(op->ptr, "filepath", path);
@@ -543,7 +561,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
ima= (Image *)find_id("IM", name);
}
- if(!ima) {
+ if (!ima) {
BKE_report(op->reports, RPT_ERROR, "Not an Image");
return OPERATOR_CANCELLED;
}
@@ -552,16 +570,16 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
obedit= base->object;
me= obedit->data;
- if(me->edit_btmesh==NULL) {
+ if (me->edit_btmesh==NULL) {
EDBM_MakeEditBMesh(scene->toolsettings, scene, obedit);
exitmode= 1;
}
- if(me->edit_btmesh==NULL)
+ if (me->edit_btmesh==NULL)
return OPERATOR_CANCELLED;
ED_uvedit_assign_image(bmain, scene, obedit, ima, NULL);
- if(exitmode) {
+ if (exitmode) {
EDBM_LoadEditBMesh(scene, obedit);
EDBM_FreeEditBMesh(me->edit_btmesh);
MEM_freeN(me->edit_btmesh);
@@ -573,7 +591,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
/* dummie drop support; ensure view shows a result :) */
- if(v3d)
+ if (v3d)
v3d->flag2 |= V3D_SOLID_TEX;
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -584,28 +602,28 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
void MESH_OT_drop_named_image(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Assign Image to UV Map";
- ot->description= "Assign Image to active UV Map, or create an UV Map";
- ot->idname= "MESH_OT_drop_named_image";
+ ot->name = "Assign Image to UV Map";
+ ot->description = "Assign Image to active UV Map, or create an UV Map";
+ ot->idname = "MESH_OT_drop_named_image";
/* api callbacks */
- ot->poll= layers_poll;
- ot->invoke= drop_named_image_invoke;
+ ot->poll = layers_poll;
+ ot->invoke = drop_named_image_invoke;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME-2, "Name", "Image name to assign");
RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file");
}
-static int uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= ED_object_context(C);
Mesh *me= ob->data;
- if(!ED_mesh_uv_texture_remove(C, ob, me))
+ if (!ED_mesh_uv_texture_remove(C, ob, me))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -614,27 +632,27 @@ static int uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
void MESH_OT_uv_texture_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove UV Map";
- ot->description= "Remove UV Map";
- ot->idname= "MESH_OT_uv_texture_remove";
+ ot->name = "Remove UV Map";
+ ot->description = "Remove UV Map";
+ ot->idname = "MESH_OT_uv_texture_remove";
/* api callbacks */
- ot->poll= layers_poll;
- ot->exec= uv_texture_remove_exec;
+ ot->poll = layers_poll;
+ ot->exec = mesh_uv_texture_remove_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/*********************** vertex color operators ************************/
-static int vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *ob= ED_object_context(C);
Mesh *me= ob->data;
- if(ED_mesh_color_add(C, scene, ob, me, NULL, TRUE) == -1)
+ if (ED_mesh_color_add(C, scene, ob, me, NULL, TRUE) == -1)
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -643,24 +661,24 @@ static int vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op))
void MESH_OT_vertex_color_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Vertex Color";
- ot->description= "Add vertex color layer";
- ot->idname= "MESH_OT_vertex_color_add";
+ ot->name = "Add Vertex Color";
+ ot->description = "Add vertex color layer";
+ ot->idname = "MESH_OT_vertex_color_add";
/* api callbacks */
- ot->poll= layers_poll;
- ot->exec= vertex_color_add_exec;
+ ot->poll = layers_poll;
+ ot->exec = mesh_vertex_color_add_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= ED_object_context(C);
Mesh *me= ob->data;
- if(!ED_mesh_color_remove(C, ob, me))
+ if (!ED_mesh_color_remove(C, ob, me))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -669,21 +687,21 @@ static int vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
void MESH_OT_vertex_color_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Vertex Color";
- ot->description= "Remove vertex color layer";
- ot->idname= "MESH_OT_vertex_color_remove";
+ ot->name = "Remove Vertex Color";
+ ot->description = "Remove vertex color layer";
+ ot->idname = "MESH_OT_vertex_color_remove";
/* api callbacks */
- ot->exec= vertex_color_remove_exec;
- ot->poll= layers_poll;
+ ot->exec = mesh_vertex_color_remove_exec;
+ ot->poll = layers_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/*********************** sticky operators ************************/
-static int sticky_add_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_sticky_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
View3D *v3d= CTX_wm_view3d(C);
@@ -692,7 +710,7 @@ static int sticky_add_exec(bContext *C, wmOperator *UNUSED(op))
/* why is this commented out? */
#if 0
- if(me->msticky)
+ if (me->msticky)
return OPERATOR_CANCELLED;
#endif
@@ -707,24 +725,24 @@ static int sticky_add_exec(bContext *C, wmOperator *UNUSED(op))
void MESH_OT_sticky_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Sticky";
- ot->description= "Add sticky UV texture layer";
- ot->idname= "MESH_OT_sticky_add";
+ ot->name = "Add Sticky";
+ ot->description = "Add sticky UV texture layer";
+ ot->idname = "MESH_OT_sticky_add";
/* api callbacks */
- ot->poll= layers_poll;
- ot->exec= sticky_add_exec;
+ ot->poll = layers_poll;
+ ot->exec = mesh_sticky_add_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int sticky_remove_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_sticky_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= ED_object_context(C);
Mesh *me= ob->data;
- if(!me->msticky)
+ if (!me->msticky)
return OPERATOR_CANCELLED;
CustomData_free_layer_active(&me->vdata, CD_MSTICKY, me->totvert);
@@ -739,16 +757,16 @@ static int sticky_remove_exec(bContext *C, wmOperator *UNUSED(op))
void MESH_OT_sticky_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Sticky";
- ot->description= "Remove sticky UV texture layer";
- ot->idname= "MESH_OT_sticky_remove";
+ ot->name = "Remove Sticky";
+ ot->description = "Remove sticky UV texture layer";
+ ot->idname = "MESH_OT_sticky_remove";
/* api callbacks */
- ot->poll= layers_poll;
- ot->exec= sticky_remove_exec;
+ ot->poll = layers_poll;
+ ot->exec = mesh_sticky_remove_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************** Add Geometry Layers *************************/
@@ -757,22 +775,25 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
{
int *polyindex = NULL;
float (*face_nors)[3];
+ int tessface_input = FALSE;
- if(mesh->totface > 0 && mesh->totpoly == 0) {
+ if (mesh->totface > 0 && mesh->totpoly == 0) {
convert_mfaces_to_mpolys(mesh);
- /* would only be converting back again, dont bother */
- calc_tessface = FALSE;
+ /* would only be converting back again, don't bother */
+ tessface_input = TRUE;
/* it also happens that converting the faces calculates edges, skip this */
calc_edges = FALSE;
}
- if(calc_edges || (mesh->totpoly && mesh->totedge == 0))
+ if (calc_edges || (mesh->totpoly && mesh->totedge == 0))
BKE_mesh_calc_edges(mesh, calc_edges);
if (calc_tessface) {
- BKE_mesh_tessface_calc(mesh);
+ if (tessface_input == FALSE) {
+ BKE_mesh_tessface_calc(mesh);
+ }
}
else {
/* default state is not to have tessface's so make sure this is the case */
@@ -784,8 +805,8 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
* calculate normals only for the mvert's. - campbell */
#ifdef USE_BMESH_MPOLY_NORMALS
polyindex = CustomData_get_layer(&mesh->fdata, CD_POLYINDEX);
- /* add a normals layer for tesselated faces, a tessface normal will
- * contain the normal of the poly the face was tesselated from. */
+ /* add a normals layer for tessellated faces, a tessface normal will
+ * contain the normal of the poly the face was tessellated from. */
face_nors = CustomData_add_layer(&mesh->fdata, CD_NORMAL, CD_CALLOC, NULL, mesh->totface);
mesh_calc_normals_mapping_ex(mesh->mvert, mesh->totvert,
@@ -812,14 +833,14 @@ static void mesh_add_verts(Mesh *mesh, int len)
MVert *mvert;
int i, totvert;
- if(len == 0)
+ if (len == 0)
return;
totvert= mesh->totvert + len;
CustomData_copy(&mesh->vdata, &vdata, CD_MASK_MESH, CD_DEFAULT, totvert);
CustomData_copy_data(&mesh->vdata, &vdata, 0, 0, mesh->totvert);
- if(!CustomData_has_layer(&vdata, CD_MVERT))
+ if (!CustomData_has_layer(&vdata, CD_MVERT))
CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
CustomData_free(&mesh->vdata, mesh->totvert);
@@ -829,7 +850,7 @@ static void mesh_add_verts(Mesh *mesh, int len)
/* scan the input list and insert the new vertices */
mvert= &mesh->mvert[mesh->totvert];
- for(i=0; i<len; i++, mvert++)
+ for (i=0; i<len; i++, mvert++)
mvert->flag |= SELECT;
/* set final vertex list size */
@@ -841,7 +862,7 @@ void ED_mesh_transform(Mesh *me, float *mat)
int i;
MVert *mvert= me->mvert;
- for(i= 0; i < me->totvert; i++, mvert++)
+ for (i= 0; i < me->totvert; i++, mvert++)
mul_m4_v3((float (*)[4])mat, mvert->co);
mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
@@ -853,7 +874,7 @@ static void mesh_add_edges(Mesh *mesh, int len)
MEdge *medge;
int i, totedge;
- if(len == 0)
+ if (len == 0)
return;
totedge= mesh->totedge+len;
@@ -862,16 +883,16 @@ static void mesh_add_edges(Mesh *mesh, int len)
CustomData_copy(&mesh->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge);
CustomData_copy_data(&mesh->edata, &edata, 0, 0, mesh->totedge);
- if(!CustomData_has_layer(&edata, CD_MEDGE))
+ if (!CustomData_has_layer(&edata, CD_MEDGE))
CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
CustomData_free(&mesh->edata, mesh->totedge);
mesh->edata= edata;
- mesh_update_customdata_pointers(mesh, FALSE); /* new edges dont change tessellation */
+ mesh_update_customdata_pointers(mesh, FALSE); /* new edges don't change tessellation */
/* set default flags */
medge= &mesh->medge[mesh->totedge];
- for(i=0; i<len; i++, medge++)
+ for (i=0; i<len; i++, medge++)
medge->flag= ME_EDGEDRAW|ME_EDGERENDER|SELECT;
mesh->totedge= totedge;
@@ -883,7 +904,7 @@ static void mesh_add_faces(Mesh *mesh, int len)
MFace *mface;
int i, totface;
- if(len == 0)
+ if (len == 0)
return;
totface= mesh->totface + len; /* new face count */
@@ -892,7 +913,7 @@ static void mesh_add_faces(Mesh *mesh, int len)
CustomData_copy(&mesh->fdata, &fdata, CD_MASK_MESH, CD_DEFAULT, totface);
CustomData_copy_data(&mesh->fdata, &fdata, 0, 0, mesh->totface);
- if(!CustomData_has_layer(&fdata, CD_MFACE))
+ if (!CustomData_has_layer(&fdata, CD_MFACE))
CustomData_add_layer(&fdata, CD_MFACE, CD_CALLOC, NULL, totface);
CustomData_free(&mesh->fdata, mesh->totface);
@@ -901,7 +922,7 @@ static void mesh_add_faces(Mesh *mesh, int len)
/* set default flags */
mface= &mesh->mface[mesh->totface];
- for(i=0; i<len; i++, mface++)
+ for (i=0; i<len; i++, mface++)
mface->flag= ME_FACE_SEL;
mesh->totface= totface;
@@ -912,7 +933,7 @@ static void mesh_add_loops(Mesh *mesh, int len)
CustomData ldata;
int totloop;
- if(len == 0)
+ if (len == 0)
return;
totloop= mesh->totloop + len; /* new face count */
@@ -921,7 +942,7 @@ static void mesh_add_loops(Mesh *mesh, int len)
CustomData_copy(&mesh->ldata, &ldata, CD_MASK_MESH, CD_DEFAULT, totloop);
CustomData_copy_data(&mesh->ldata, &ldata, 0, 0, mesh->totloop);
- if(!CustomData_has_layer(&ldata, CD_MLOOP))
+ if (!CustomData_has_layer(&ldata, CD_MLOOP))
CustomData_add_layer(&ldata, CD_MLOOP, CD_CALLOC, NULL, totloop);
CustomData_free(&mesh->ldata, mesh->totloop);
@@ -937,7 +958,7 @@ static void mesh_add_polys(Mesh *mesh, int len)
MPoly *mpoly;
int i, totpoly;
- if(len == 0)
+ if (len == 0)
return;
totpoly= mesh->totpoly + len; /* new face count */
@@ -946,7 +967,7 @@ static void mesh_add_polys(Mesh *mesh, int len)
CustomData_copy(&mesh->pdata, &pdata, CD_MASK_MESH, CD_DEFAULT, totpoly);
CustomData_copy_data(&mesh->pdata, &pdata, 0, 0, mesh->totpoly);
- if(!CustomData_has_layer(&pdata, CD_MPOLY))
+ if (!CustomData_has_layer(&pdata, CD_MPOLY))
CustomData_add_layer(&pdata, CD_MPOLY, CD_CALLOC, NULL, totpoly);
CustomData_free(&mesh->pdata, mesh->totpoly);
@@ -955,7 +976,7 @@ static void mesh_add_polys(Mesh *mesh, int len)
/* set default flags */
mpoly= &mesh->mpoly[mesh->totpoly];
- for(i=0; i<len; i++, mpoly++)
+ for (i=0; i<len; i++, mpoly++)
mpoly->flag= ME_FACE_SEL;
mesh->totpoly= totpoly;
@@ -965,7 +986,7 @@ static void mesh_remove_verts(Mesh *mesh, int len)
{
int totvert;
- if(len == 0)
+ if (len == 0)
return;
totvert= mesh->totvert - len;
@@ -979,7 +1000,7 @@ static void mesh_remove_edges(Mesh *mesh, int len)
{
int totedge;
- if(len == 0)
+ if (len == 0)
return;
totedge= mesh->totedge - len;
@@ -992,7 +1013,7 @@ static void mesh_remove_faces(Mesh *mesh, int len)
{
int totface;
- if(len == 0)
+ if (len == 0)
return;
totface= mesh->totface - len; /* new face count */
@@ -1004,23 +1025,23 @@ static void mesh_remove_faces(Mesh *mesh, int len)
#if 0
void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add geometry in edit mode");
return;
}
- if(verts)
+ if (verts)
mesh_add_verts(mesh, verts);
- if(edges)
+ if (edges)
mesh_add_edges(mesh, edges);
- if(faces)
+ if (faces)
mesh_add_faces(mesh, faces);
}
#endif
void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add faces in edit mode");
return;
}
@@ -1030,7 +1051,7 @@ void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add edges in edit mode");
return;
}
@@ -1040,7 +1061,7 @@ void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add vertices in edit mode");
return;
}
@@ -1050,11 +1071,11 @@ void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't remove faces in edit mode");
return;
}
- else if(count > mesh->totface) {
+ else if (count > mesh->totface) {
BKE_report(reports, RPT_ERROR, "Can't remove more faces than the mesh contains");
return;
}
@@ -1064,11 +1085,11 @@ void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't remove edges in edit mode");
return;
}
- else if(count > mesh->totedge) {
+ else if (count > mesh->totedge) {
BKE_report(reports, RPT_ERROR, "Can't remove more edges than the mesh contains");
return;
}
@@ -1078,11 +1099,11 @@ void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't remove vertices in edit mode");
return;
}
- else if(count > mesh->totvert) {
+ else if (count > mesh->totvert) {
BKE_report(reports, RPT_ERROR, "Can't remove more vertices than the mesh contains");
return;
}
@@ -1092,7 +1113,7 @@ void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add loops in edit mode.");
return;
}
@@ -1102,7 +1123,7 @@ void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add polys in edit mode.");
return;
}
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 4d3aec1757e..fe5ab4d554e 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -156,6 +156,7 @@ void MESH_OT_fill(struct wmOperatorType *ot);
void MESH_OT_beautify_fill(struct wmOperatorType *ot);
void MESH_OT_quads_convert_to_tris(struct wmOperatorType *ot);
void MESH_OT_tris_convert_to_quads(struct wmOperatorType *ot);
+void MESH_OT_dissolve(struct wmOperatorType *ot);
void MESH_OT_dissolve_limited(struct wmOperatorType *ot);
void MESH_OT_faces_shade_smooth(struct wmOperatorType *ot);
void MESH_OT_faces_shade_flat(struct wmOperatorType *ot);
@@ -176,6 +177,8 @@ void MESH_OT_colors_rotate(struct wmOperatorType *ot);
void MESH_OT_colors_reverse(struct wmOperatorType *ot);
void MESH_OT_delete(struct wmOperatorType *ot);
+void MESH_OT_edge_collapse(struct wmOperatorType *ot);
+void MESH_OT_edge_collapse_loop(struct wmOperatorType *ot);
void MESH_OT_rip(struct wmOperatorType *ot);
void MESH_OT_shape_propagate_to_all(struct wmOperatorType *ot);
@@ -200,7 +203,6 @@ void MESH_OT_extrude_region(struct wmOperatorType *ot);
void MESH_OT_extrude_verts_indiv(struct wmOperatorType *ot);
void MESH_OT_extrude_edges_indiv(struct wmOperatorType *ot);
void MESH_OT_extrude_faces_indiv(struct wmOperatorType *ot);
-void MESH_OT_bm_test(struct wmOperatorType *ot);
void MESH_OT_edgering_select(struct wmOperatorType *ot);
void MESH_OT_loopcut(struct wmOperatorType *ot);
@@ -209,6 +211,7 @@ void MESH_OT_knifetool(struct wmOperatorType *ot);
void MESH_OT_bevel(struct wmOperatorType *ot);
void MESH_OT_bridge_edge_loops(struct wmOperatorType *ot);
+void MESH_OT_inset(struct wmOperatorType *ot);
/* ******************* mesh_navmesh.c */
void MESH_OT_navmesh_make(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index 38d632ffaee..02ef1540cc1 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -37,6 +37,11 @@
#include "DNA_modifier_types.h"
#include "DNA_ID.h"
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+#include "BLI_math_vector.h"
+#include "BLI_linklist.h"
+
#include "BKE_library.h"
#include "BKE_depsgraph.h"
#include "BKE_context.h"
@@ -49,11 +54,6 @@
#include "BKE_report.h"
#include "BKE_tessmesh.h"
-#include "BLI_listbase.h"
-#include "BLI_utildefines.h"
-#include "BLI_math_vector.h"
-#include "BLI_linklist.h"
-
#include "ED_object.h"
#include "ED_mesh.h"
#include "ED_screen.h"
@@ -66,26 +66,26 @@
#include "mesh_intern.h"
#include "recast-capi.h"
-static void createVertsTrisData(bContext *C, LinkNode* obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r)
+static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r)
{
MVert *mvert;
- int nfaces= 0, *tri, i, curnverts, basenverts, curnfaces;
+ int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces;
MFace *mface;
float co[3], wco[3];
Object *ob;
LinkNode *oblink, *dmlink;
DerivedMesh *dm;
- Scene* scene= CTX_data_scene(C);
- LinkNode* dms= NULL;
+ Scene *scene = CTX_data_scene(C);
+ LinkNode *dms = NULL;
int nverts, ntris, *tris;
float *verts;
- nverts= 0;
- ntris= 0;
+ nverts = 0;
+ ntris = 0;
/* calculate number of verts and tris */
- for(oblink= obs; oblink; oblink= oblink->next) {
+ for (oblink = obs; oblink; oblink= oblink->next) {
ob= (Object*) oblink->link;
dm= mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH);
BLI_linklist_append(&dms, (void*)dm);
@@ -96,9 +96,9 @@ static void createVertsTrisData(bContext *C, LinkNode* obs, int *nverts_r, float
/* resolve quad faces */
mface= dm->getTessFaceArray(dm);
- for(i= 0; i<nfaces; i++) {
- MFace* mf= &mface[i];
- if(mf->v4)
+ for (i= 0; i<nfaces; i++) {
+ MFace *mf= &mface[i];
+ if (mf->v4)
ntris+=1;
}
}
@@ -109,7 +109,7 @@ static void createVertsTrisData(bContext *C, LinkNode* obs, int *nverts_r, float
basenverts= 0;
tri= tris;
- for(oblink= obs, dmlink= dms; oblink && dmlink;
+ for (oblink= obs, dmlink= dms; oblink && dmlink;
oblink= oblink->next, dmlink= dmlink->next) {
ob= (Object*) oblink->link;
dm= (DerivedMesh*) dmlink->link;
@@ -118,7 +118,7 @@ static void createVertsTrisData(bContext *C, LinkNode* obs, int *nverts_r, float
mvert= dm->getVertArray(dm);
/* copy verts */
- for(i= 0; i<curnverts; i++) {
+ for (i= 0; i<curnverts; i++) {
MVert *v= &mvert[i];
copy_v3_v3(co, v->co);
@@ -133,15 +133,15 @@ static void createVertsTrisData(bContext *C, LinkNode* obs, int *nverts_r, float
curnfaces= dm->getNumTessFaces(dm);
mface= dm->getTessFaceArray(dm);
- for(i= 0; i<curnfaces; i++) {
- MFace* mf= &mface[i];
+ for (i= 0; i<curnfaces; i++) {
+ MFace *mf= &mface[i];
tri[0]= basenverts + mf->v1;
tri[1]= basenverts + mf->v3;
tri[2]= basenverts + mf->v2;
tri += 3;
- if(mf->v4) {
+ if (mf->v4) {
tri[0]= basenverts + mf->v1;
tri[1]= basenverts + mf->v4;
tri[2]= basenverts + mf->v3;
@@ -153,7 +153,7 @@ static void createVertsTrisData(bContext *C, LinkNode* obs, int *nverts_r, float
}
/* release derived mesh */
- for(dmlink= dms; dmlink; dmlink= dmlink->next) {
+ for (dmlink= dms; dmlink; dmlink= dmlink->next) {
dm= (DerivedMesh*) dmlink->link;
dm->release(dm);
}
@@ -172,7 +172,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
float bmin[3], bmax[3];
struct recast_heightfield *solid;
unsigned char *triflags;
- struct recast_compactHeightfield* chf;
+ struct recast_compactHeightfield *chf;
struct recast_contourSet *cset;
int width, height, walkableHeight, walkableClimb, walkableRadius;
int minRegionArea, mergeRegionArea, maxEdgeLen;
@@ -198,7 +198,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
/* Allocate voxel heightfield where we rasterize our input data to */
solid= recast_newHeightfield();
- if(!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) {
+ if (!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) {
recast_destroyHeightfield(solid);
return 0;
@@ -220,7 +220,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
/* ** Step 4: Partition walkable surface to simple regions ** */
chf= recast_newCompactHeightfield();
- if(!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) {
+ if (!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) {
recast_destroyHeightfield(solid);
recast_destroyCompactHeightfield(chf);
@@ -237,14 +237,14 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
}
/* Prepare for region partitioning, by calculating distance field along the walkable surface */
- if(!recast_buildDistanceField(chf)) {
+ if (!recast_buildDistanceField(chf)) {
recast_destroyCompactHeightfield(chf);
return 0;
}
/* Partition the walkable surface into simple regions without holes */
- if(!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) {
+ if (!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) {
recast_destroyCompactHeightfield(chf);
return 0;
@@ -254,7 +254,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
/* Create contours */
cset= recast_newContourSet();
- if(!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset)) {
+ if (!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset)) {
recast_destroyCompactHeightfield(chf);
recast_destroyContourSet(cset);
@@ -263,7 +263,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
/* ** Step 6: Build polygons mesh from contours ** */
*pmesh= recast_newPolyMesh();
- if(!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) {
+ if (!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) {
recast_destroyCompactHeightfield(chf);
recast_destroyContourSet(cset);
recast_destroyPolyMesh(*pmesh);
@@ -275,7 +275,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
/* ** Step 7: Create detail mesh which allows to access approximate height on each polygon ** */
*dmesh= recast_newPolyMeshDetail();
- if(!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) {
+ if (!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) {
recast_destroyCompactHeightfield(chf);
recast_destroyContourSet(cset);
recast_destroyPolyMesh(*pmesh);
@@ -290,15 +290,15 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
return 1;
}
-static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, Base* base)
+static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, Base *base)
{
float co[3], rot[3];
BMEditMesh *em;
int i,j, k;
- unsigned short* v;
+ unsigned short *v;
int face[3];
Scene *scene= CTX_data_scene(C);
- Object* obedit;
+ Object *obedit;
int createob= base==NULL;
int nverts, nmeshes, nvp;
unsigned short *verts, *polys;
@@ -309,7 +309,7 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
zero_v3(co);
zero_v3(rot);
- if(createob) {
+ if (createob) {
/* create new object */
obedit= ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1);
}
@@ -323,7 +323,7 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER);
em = BMEdit_FromObject(obedit);
- if(!createob) {
+ if (!createob) {
/* clear */
EDBM_ClearMesh(em);
}
@@ -333,7 +333,7 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
recast_polyMeshGetBoundbox(pmesh, bmin, NULL);
recast_polyMeshGetCell(pmesh, &cs, &ch);
- for(i= 0; i<nverts; i++) {
+ for (i= 0; i<nverts; i++) {
v= &verts[3*i];
co[0]= bmin[0] + v[0]*cs;
co[1]= bmin[1] + v[1]*ch;
@@ -351,22 +351,22 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
dverts= recast_polyMeshDetailGetVerts(dmesh, NULL);
tris= recast_polyMeshDetailGetTris(dmesh, NULL);
- for(i= 0; i<nmeshes; i++) {
+ for (i= 0; i<nmeshes; i++) {
int uniquevbase= em->bm->totvert;
unsigned int vbase= meshes[4*i+0];
unsigned short ndv= meshes[4*i+1];
unsigned short tribase= meshes[4*i+2];
unsigned short trinum= meshes[4*i+3];
- const unsigned short* p= &polys[i*nvp*2];
+ const unsigned short *p= &polys[i*nvp*2];
int nv= 0;
- for(j= 0; j < nvp; ++j) {
- if(p[j]==0xffff) break;
+ for (j= 0; j < nvp; ++j) {
+ if (p[j]==0xffff) break;
nv++;
}
/* create unique verts */
- for(j= nv; j<ndv; j++) {
+ for (j= nv; j<ndv; j++) {
copy_v3_v3(co, &dverts[3*(vbase + j)]);
SWAP(float, co[1], co[2]);
BM_vert_create(em->bm, co, NULL);
@@ -375,13 +375,13 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
EDBM_init_index_arrays(em, 1, 0, 0);
/* create faces */
- for(j= 0; j<trinum; j++) {
- unsigned char* tri= &tris[4*(tribase+j)];
- BMFace* newFace;
- int* polygonIdx;
+ for (j= 0; j<trinum; j++) {
+ unsigned char *tri= &tris[4*(tribase+j)];
+ BMFace *newFace;
+ int *polygonIdx;
- for(k= 0; k<3; k++) {
- if(tri[k]<nv)
+ for (k= 0; k<3; k++) {
+ if (tri[k]<nv)
face[k] = p[tri[k]]; /* shared vertex */
else
face[k] = uniquevbase+tri[k]-nv; /* unique vertex */
@@ -410,7 +410,7 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
ED_object_exit_editmode(C, EM_FREEDATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
- if(createob) {
+ if (createob) {
obedit->gameflag&= ~OB_COLLISION;
obedit->gameflag|= OB_NAVMESH;
obedit->body_type= OB_BODY_TYPE_NAVMESH;
@@ -422,11 +422,11 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
return obedit;
}
-static int create_navmesh_exec(bContext *C, wmOperator *op)
+static int navmesh_create_exec(bContext *C, wmOperator *op)
{
- Scene* scene= CTX_data_scene(C);
- LinkNode* obs= NULL;
- Base* navmeshBase= NULL;
+ Scene *scene= CTX_data_scene(C);
+ LinkNode *obs= NULL;
+ Base *navmeshBase= NULL;
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
if (base->object->type == OB_MESH) {
@@ -470,15 +470,15 @@ static int create_navmesh_exec(bContext *C, wmOperator *op)
void MESH_OT_navmesh_make(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Create navigation mesh";
- ot->description= "Create navigation mesh for selected objects";
- ot->idname= "MESH_OT_navmesh_make";
+ ot->name = "Create navigation mesh";
+ ot->description = "Create navigation mesh for selected objects";
+ ot->idname = "MESH_OT_navmesh_make";
/* api callbacks */
- ot->exec= create_navmesh_exec;
+ ot->exec = navmesh_create_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
@@ -489,19 +489,19 @@ static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
/* do work here */
BMFace *efa_act= BM_active_face_get(em->bm, FALSE);
- if(efa_act) {
- if(CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
+ if (efa_act) {
+ if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
BMFace *efa;
BMIter iter;
int targetPolyIdx= *(int*)CustomData_bmesh_get(&em->bm->pdata, efa_act->head.data, CD_RECAST);
targetPolyIdx= targetPolyIdx>=0? targetPolyIdx : -targetPolyIdx;
- if(targetPolyIdx > 0) {
+ if (targetPolyIdx > 0) {
/* set target poly idx to other selected faces */
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(BM_elem_flag_test(efa, BM_ELEM_SELECT) && efa != efa_act) {
- int* recastDataBlock= (int*)CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_RECAST);
- *recastDataBlock= targetPolyIdx;
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && efa != efa_act) {
+ int *recastDataBlock = (int*)CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_RECAST);
+ *recastDataBlock = targetPolyIdx;
}
}
}
@@ -520,16 +520,16 @@ static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "NavMesh Copy Face Index";
- ot->description= "Copy the index from the active face";
- ot->idname= "MESH_OT_navmesh_face_copy";
+ ot->name = "NavMesh Copy Face Index";
+ ot->description = "Copy the index from the active face";
+ ot->idname = "MESH_OT_navmesh_face_copy";
/* api callbacks */
- ot->poll= ED_operator_editmesh;
- ot->exec= navmesh_face_copy_exec;
+ ot->poll = ED_operator_editmesh;
+ ot->exec = navmesh_face_copy_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int compare(const void * a, const void * b)
@@ -537,18 +537,18 @@ static int compare(const void * a, const void * b)
return ( *(int*)a - *(int*)b );
}
-static int findFreeNavPolyIndex(BMEditMesh* em)
+static int findFreeNavPolyIndex(BMEditMesh *em)
{
/* construct vector of indices */
- int numfaces= em->bm->totface;
- int* indices= MEM_callocN(sizeof(int)*numfaces, "findFreeNavPolyIndex(indices)");
- BMFace* ef;
+ int numfaces = em->bm->totface;
+ int *indices = MEM_callocN(sizeof(int)*numfaces, "findFreeNavPolyIndex(indices)");
+ BMFace *ef;
BMIter iter;
- int i, idx= em->bm->totface-1, freeIdx= 1;
+ int i, idx = em->bm->totface-1, freeIdx = 1;
/*XXX this originally went last to first, but that isn't possible anymore*/
BM_ITER(ef, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- int polyIdx= *(int*)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
+ int polyIdx = *(int*)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
indices[idx]= polyIdx;
idx--;
}
@@ -556,11 +556,11 @@ static int findFreeNavPolyIndex(BMEditMesh* em)
qsort(indices, numfaces, sizeof(int), compare);
/* search first free index */
- freeIdx= 1;
- for(i= 0; i<numfaces; i++) {
- if(indices[i]==freeIdx)
+ freeIdx = 1;
+ for (i = 0; i<numfaces; i++) {
+ if (indices[i]==freeIdx)
freeIdx++;
- else if(indices[i]>freeIdx)
+ else if (indices[i]>freeIdx)
break;
}
@@ -576,17 +576,17 @@ static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op))
BMFace *ef;
BMIter iter;
- if(CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
- int targetPolyIdx= findFreeNavPolyIndex(em);
+ if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
+ int targetPolyIdx = findFreeNavPolyIndex(em);
- if(targetPolyIdx>0) {
+ if (targetPolyIdx>0) {
/* set target poly idx to selected faces */
/*XXX this originally went last to first, but that isn't possible anymore*/
BM_ITER(ef, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(BM_elem_flag_test(ef, BM_ELEM_SELECT)) {
- int *recastDataBlock= (int*)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
- *recastDataBlock= targetPolyIdx;
+ if (BM_elem_flag_test(ef, BM_ELEM_SELECT)) {
+ int *recastDataBlock = (int*)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
+ *recastDataBlock = targetPolyIdx;
}
}
}
@@ -601,23 +601,23 @@ static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op))
void MESH_OT_navmesh_face_add(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "NavMesh New Face Index";
- ot->description= "Add a new index and assign it to selected faces";
- ot->idname= "MESH_OT_navmesh_face_add";
+ ot->name = "NavMesh New Face Index";
+ ot->description = "Add a new index and assign it to selected faces";
+ ot->idname = "MESH_OT_navmesh_face_add";
/* api callbacks */
- ot->poll= ED_operator_editmesh;
- ot->exec= navmesh_face_add_exec;
+ ot->poll = ED_operator_editmesh;
+ ot->exec = navmesh_face_add_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int navmesh_obmode_data_poll(bContext *C)
{
Object *ob = ED_object_active_context(C);
if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
return CustomData_has_layer(&me->pdata, CD_RECAST);
}
return FALSE;
@@ -635,7 +635,7 @@ static int navmesh_obmode_poll(bContext *C)
static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = ED_object_active_context(C);
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly);
@@ -650,22 +650,22 @@ static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op))
void MESH_OT_navmesh_reset(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "NavMesh Reset Index Values";
- ot->description= "Assign a new index to every face";
- ot->idname= "MESH_OT_navmesh_reset";
+ ot->name = "NavMesh Reset Index Values";
+ ot->description = "Assign a new index to every face";
+ ot->idname = "MESH_OT_navmesh_reset";
/* api callbacks */
- ot->poll= navmesh_obmode_poll;
- ot->exec= navmesh_reset_exec;
+ ot->poll = navmesh_obmode_poll;
+ ot->exec = navmesh_reset_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = ED_object_active_context(C);
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly);
@@ -678,14 +678,14 @@ static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op))
void MESH_OT_navmesh_clear(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "NavMesh Clear Data";
- ot->description= "Remove navmesh data from this mesh";
- ot->idname= "MESH_OT_navmesh_clear";
+ ot->name = "NavMesh Clear Data";
+ ot->description = "Remove navmesh data from this mesh";
+ ot->idname = "MESH_OT_navmesh_clear";
/* api callbacks */
- ot->poll= navmesh_obmode_data_poll;
- ot->exec= navmesh_clear_exec;
+ ot->poll = navmesh_obmode_data_poll;
+ ot->exec = navmesh_clear_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index dd5b278b16a..6a0fa0cf7c9 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -114,6 +114,7 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_beautify_fill);
WM_operatortype_append(MESH_OT_quads_convert_to_tris);
WM_operatortype_append(MESH_OT_tris_convert_to_quads);
+ WM_operatortype_append(MESH_OT_dissolve);
WM_operatortype_append(MESH_OT_dissolve_limited);
WM_operatortype_append(MESH_OT_faces_shade_smooth);
WM_operatortype_append(MESH_OT_faces_shade_flat);
@@ -121,6 +122,8 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_mark_freestyle_face);
WM_operatortype_append(MESH_OT_delete);
+ WM_operatortype_append(MESH_OT_edge_collapse);
+ WM_operatortype_append(MESH_OT_edge_collapse_loop);
WM_operatortype_append(MESH_OT_separate);
WM_operatortype_append(MESH_OT_dupli_extrude_cursor);
@@ -161,6 +164,8 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_select_next_loop);
WM_operatortype_append(MESH_OT_bridge_edge_loops);
+ WM_operatortype_append(MESH_OT_inset);
+ WM_operatortype_append(MESH_OT_edge_split);
#ifdef WITH_GAMEENGINE
WM_operatortype_append(MESH_OT_navmesh_make);
@@ -175,7 +180,7 @@ void ED_operatortypes_mesh(void)
static int ED_operator_editmesh_face_select(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_MESH) {
+ if (obedit && obedit->type==OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(obedit);
if (em && em->selectmode & SCE_SELECT_FACE) {
return 1;
@@ -190,51 +195,51 @@ void ED_operatormacros_mesh(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot= WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Cut mesh loop and slide it";
WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
RNA_struct_idprops_unset(otmacro->ptr, "release_confirm");
- ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Duplicate mesh and move";
WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
- ot= WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Rip polygons and move the result";
WM_operatortype_macro_define(ot, "MESH_OT_rip");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
- ot= WM_operatortype_append_macro("MESH_OT_extrude_region_move", "Extrude Region and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("MESH_OT_extrude_region_move", "Extrude Region and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Extrude region and move result";
- otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
- ot= WM_operatortype_append_macro("MESH_OT_extrude_faces_move", "Extrude Individual Faces and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("MESH_OT_extrude_faces_move", "Extrude Individual Faces and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Extrude faces and move result";
- otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
+ otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
RNA_enum_set(otmacro->ptr, "proportional", 0);
RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
- ot= WM_operatortype_append_macro("MESH_OT_extrude_edges_move", "Extrude Only Edges and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("MESH_OT_extrude_edges_move", "Extrude Only Edges and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Extrude edges and move result";
- otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
- ot= WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", "Extrude Only Vertices and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", "Extrude Only Vertices and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Extrude vertices and move result";
- otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude_verts_indiv");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_verts_indiv");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
}
@@ -246,8 +251,8 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
wmKeyMapItem *kmi;
int i;
- keymap= WM_keymap_find(keyconf, "Mesh", 0, 0);
- keymap->poll= ED_operator_editmesh;
+ keymap = WM_keymap_find(keyconf, "Mesh", 0, 0);
+ keymap->poll = ED_operator_editmesh;
WM_keymap_add_item(keymap, "MESH_OT_loopcut_slide", RKEY, KM_PRESS, KM_CTRL, 0);
@@ -338,8 +343,10 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT|KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "rotate_source", FALSE);
- WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_dissolve", DKEY, KM_PRESS, 0, 0);
+
+ WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_delete", XKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_delete", DELKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_knifetool", KKEY, KM_PRESS, 0, 0);
//RNA_enum_set(WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, KM_SHIFT, KKEY)->ptr, "type", 2/*KNIFE_MIDPOINT*/);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 44d923a009b..7d0172b3c15 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -110,20 +110,20 @@ int join_mesh_exec(bContext *C, wmOperator *op)
MDeformVert *dvert;
CustomData vdata, edata, fdata, ldata, pdata;
- if(scene->obedit) {
+ if (scene->obedit) {
BKE_report(op->reports, RPT_WARNING, "Cant join while in editmode");
return OPERATOR_CANCELLED;
}
/* ob is the object we are adding geometry to */
- if(!ob || ob->type!=OB_MESH) {
+ if (!ob || ob->type!=OB_MESH) {
BKE_report(op->reports, RPT_WARNING, "Active object is not a mesh");
return OPERATOR_CANCELLED;
}
/* count & check */
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- if(base->object->type==OB_MESH) {
+ if (base->object->type==OB_MESH) {
me= base->object->data;
totvert+= me->totvert;
@@ -132,18 +132,18 @@ int join_mesh_exec(bContext *C, wmOperator *op)
totpoly+= me->totpoly;
totmat+= base->object->totcol;
- if(base->object == ob)
+ if (base->object == ob)
ok= 1;
/* check for shapekeys */
- if(me->key)
+ if (me->key)
haskey++;
}
}
CTX_DATA_END;
/* that way the active object is always selected */
- if(ok==0) {
+ if (ok==0) {
BKE_report(op->reports, RPT_WARNING, "Active object is not a selected mesh");
return OPERATOR_CANCELLED;
}
@@ -152,12 +152,12 @@ int join_mesh_exec(bContext *C, wmOperator *op)
me= (Mesh *)ob->data;
key= me->key;
- if(totvert==0 || totvert==me->totvert) {
+ if (totvert==0 || totvert==me->totvert) {
BKE_report(op->reports, RPT_WARNING, "No mesh data to join");
return OPERATOR_CANCELLED;
}
- if(totvert > MESH_MAX_VERTS) {
+ if (totvert > MESH_MAX_VERTS) {
BKE_reportf(op->reports, RPT_WARNING, "Joining results in %d vertices, limit is " STRINGIFY(MESH_MAX_VERTS), totvert);
return OPERATOR_CANCELLED;
}
@@ -168,7 +168,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
totcol= ob->totcol;
/* obact materials in new main array, is nicer start! */
- for(a=0; a<ob->totcol; a++) {
+ for (a=0; a<ob->totcol; a++) {
matar[a]= give_current_material(ob, a+1);
id_us_plus((ID *)matar[a]);
/* increase id->us : will be lowered later */
@@ -179,19 +179,19 @@ int join_mesh_exec(bContext *C, wmOperator *op)
* - if destination mesh didn't have shapekeys, but we encountered some in the meshes we're
* joining, set up a new keyblock and assign to the mesh
*/
- if(key) {
+ if (key) {
/* make a duplicate copy that will only be used here... (must remember to free it!) */
nkey= copy_key(key);
/* for all keys in old block, clear data-arrays */
- for(kb= key->block.first; kb; kb= kb->next) {
- if(kb->data) MEM_freeN(kb->data);
+ for (kb= key->block.first; kb; kb= kb->next) {
+ if (kb->data) MEM_freeN(kb->data);
kb->data= MEM_callocN(sizeof(float)*3*totvert, "join_shapekey");
kb->totelem= totvert;
kb->weights= NULL;
}
}
- else if(haskey) {
+ else if (haskey) {
/* add a new key-block and add to the mesh */
key= me->key= add_key((ID *)me);
key->type = KEY_RELATIVE;
@@ -200,48 +200,48 @@ 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) {
/* only act if a mesh, and not the one we're joining to */
- if((ob!=base->object) && (base->object->type==OB_MESH)) {
+ if ((ob!=base->object) && (base->object->type==OB_MESH)) {
me= base->object->data;
/* Join this object's vertex groups to the base one's */
- for(dg=base->object->defbase.first; dg; dg=dg->next) {
+ for (dg=base->object->defbase.first; dg; dg=dg->next) {
/* See if this group exists in the object (if it doesn't, add it to the end) */
- if(!defgroup_find_name(ob, dg->name)) {
+ if (!defgroup_find_name(ob, dg->name)) {
odg = MEM_callocN(sizeof(bDeformGroup), "join deformGroup");
memcpy(odg, dg, sizeof(bDeformGroup));
BLI_addtail(&ob->defbase, odg);
}
}
- if(ob->defbase.first && ob->actdef==0)
+ if (ob->defbase.first && ob->actdef==0)
ob->actdef=1;
- if(me->totvert) {
+ if (me->totvert) {
/* Add this object's materials to the base one's if they don't exist already (but only if limits not exceeded yet) */
- if(totcol < MAXMAT) {
- for(a=1; a<=base->object->totcol; a++) {
+ if (totcol < MAXMAT) {
+ for (a=1; a<=base->object->totcol; a++) {
ma= give_current_material(base->object, a);
- for(b=0; b<totcol; b++) {
- if(ma == matar[b]) break;
+ for (b=0; b<totcol; b++) {
+ if (ma == matar[b]) break;
}
- if(b==totcol) {
+ if (b==totcol) {
matar[b]= ma;
- if(ma) {
+ if (ma) {
id_us_plus(&ma->id);
}
totcol++;
}
- if(totcol >= MAXMAT)
+ if (totcol >= MAXMAT)
break;
}
}
/* if this mesh has shapekeys, check if destination mesh already has matching entries too */
- if(me->key && key) {
- for(kb= me->key->block.first; kb; kb= kb->next) {
+ if (me->key && key) {
+ for (kb= me->key->block.first; kb; kb= kb->next) {
/* if key doesn't exist in destination mesh, add it */
- if(key_get_named_keyblock(key, kb->name) == NULL) {
+ if (key_get_named_keyblock(key, kb->name) == NULL) {
/* copy this existing one over to the new shapekey block */
kbn= MEM_dupallocN(kb);
kbn->prev= kbn->next= NULL;
@@ -253,7 +253,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
okb= key->block.last;
curpos= (okb) ? okb->pos : -0.1f;
- if(key->type == KEY_RELATIVE)
+ if (key->type == KEY_RELATIVE)
kbn->pos= curpos + 0.1f;
else
kbn->pos= curpos;
@@ -261,12 +261,12 @@ int join_mesh_exec(bContext *C, wmOperator *op)
BLI_addtail(&key->block, kbn);
kbn->adrcode= key->totkey;
key->totkey++;
- if(key->totkey==1) key->refkey= kbn;
+ if (key->totkey==1) key->refkey= kbn;
// XXX 2.5 Animato
#if 0
/* also, copy corresponding ipo-curve to ipo-block if applicable */
- if(me->key->ipo && key->ipo) {
+ if (me->key->ipo && key->ipo) {
// FIXME... this is a luxury item!
puts("FIXME: ignoring IPO's when joining shapekeys on Meshes for now...");
}
@@ -301,10 +301,10 @@ int join_mesh_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
/* only join if this is a mesh */
- if(base->object->type==OB_MESH) {
+ if (base->object->type==OB_MESH) {
me= base->object->data;
- if(me->totvert) {
+ if (me->totvert) {
/* standard data */
CustomData_merge(&me->vdata, &vdata, CD_MASK_MESH, CD_DEFAULT, totvert);
CustomData_copy_data(&me->vdata, &vdata, 0, vertofs, me->totvert);
@@ -313,15 +313,15 @@ int join_mesh_exec(bContext *C, wmOperator *op)
dvert= CustomData_get(&vdata, vertofs, CD_MDEFORMVERT);
/* NB: vertex groups here are new version */
- if(dvert) {
- for(i=0; i<me->totvert; i++) {
- for(j=0; j<dvert[i].totweight; j++) {
+ if (dvert) {
+ for (i=0; i<me->totvert; i++) {
+ for (j=0; j<dvert[i].totweight; j++) {
/* Find the old vertex group */
odg = BLI_findlink(&base->object->defbase, dvert[i].dw[j].def_nr);
- if(odg) {
+ if (odg) {
/* Search for a match in the new object, and set new index */
- for(dg=ob->defbase.first, index=0; dg; dg=dg->next, index++) {
- if(!strcmp(dg->name, odg->name)) {
+ for (dg=ob->defbase.first, index=0; dg; dg=dg->next, index++) {
+ if (!strcmp(dg->name, odg->name)) {
dvert[i].dw[j].def_nr = index;
break;
}
@@ -332,12 +332,12 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
/* if this is the object we're merging into, no need to do anything */
- if(base->object != ob) {
+ if (base->object != ob) {
/* watch this: switch matmul order really goes wrong */
mult_m4_m4m4(cmat, imat, base->object->obmat);
/* transform vertex coordinates into new space */
- for(a=0, mv=mvert; a < me->totvert; a++, mv++) {
+ for (a=0, mv=mvert; a < me->totvert; a++, mv++) {
mul_m4_v3(cmat, mv->co);
}
@@ -345,18 +345,18 @@ int join_mesh_exec(bContext *C, wmOperator *op)
* - if there's a matching one, copy it across (will need to transform vertices into new space...)
* - otherwise, just copy own coordinates of mesh (no need to transform vertex coordinates into new space)
*/
- if(key) {
+ if (key) {
/* if this mesh has any shapekeys, check first, otherwise just copy coordinates */
- for(kb= key->block.first; kb; kb= kb->next) {
+ for (kb= key->block.first; kb; kb= kb->next) {
/* get pointer to where to write data for this mesh in shapekey's data array */
fp1= ((float *)kb->data) + (vertofs*3);
/* check if this mesh has such a shapekey */
okb= key_get_named_keyblock(me->key, kb->name);
- if(okb) {
+ if (okb) {
/* copy this mesh's shapekey to the destination shapekey (need to transform first) */
fp2= ((float *)(okb->data));
- for(a=0; a < me->totvert; a++, fp1+=3, fp2+=3) {
+ for (a=0; a < me->totvert; a++, fp1+=3, fp2+=3) {
copy_v3_v3(fp1, fp2);
mul_m4_v3(cmat, fp1);
}
@@ -364,7 +364,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
else {
/* copy this mesh's vertex coordinates to the destination shapekey */
mv= mvert;
- for(a=0; a < me->totvert; a++, fp1+=3, mv++) {
+ for (a=0; a < me->totvert; a++, fp1+=3, mv++) {
copy_v3_v3(fp1, mv->co);
}
}
@@ -376,24 +376,24 @@ int join_mesh_exec(bContext *C, wmOperator *op)
* - if it was an 'original', copy the appropriate data from nkey
* - otherwise, copy across plain coordinates (no need to transform coordinates)
*/
- if(key) {
- for(kb= key->block.first; kb; kb= kb->next) {
+ if (key) {
+ for (kb= key->block.first; kb; kb= kb->next) {
/* get pointer to where to write data for this mesh in shapekey's data array */
fp1= ((float *)kb->data) + (vertofs*3);
/* check if this was one of the original shapekeys */
okb= key_get_named_keyblock(nkey, kb->name);
- if(okb) {
+ if (okb) {
/* copy this mesh's shapekey to the destination shapekey */
fp2= ((float *)(okb->data));
- for(a=0; a < me->totvert; a++, fp1+=3, fp2+=3) {
+ for (a=0; a < me->totvert; a++, fp1+=3, fp2+=3) {
copy_v3_v3(fp1, fp2);
}
}
else {
/* copy base-coordinates to the destination shapekey */
mv= mvert;
- for(a=0; a < me->totvert; a++, fp1+=3, mv++) {
+ for (a=0; a < me->totvert; a++, fp1+=3, mv++) {
copy_v3_v3(fp1, mv->co);
}
}
@@ -405,36 +405,36 @@ int join_mesh_exec(bContext *C, wmOperator *op)
mvert+= me->totvert;
}
- if(me->totedge) {
+ if (me->totedge) {
CustomData_merge(&me->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge);
CustomData_copy_data(&me->edata, &edata, 0, edgeofs, me->totedge);
- for(a=0; a<me->totedge; a++, medge++) {
+ for (a=0; a<me->totedge; a++, medge++) {
medge->v1+= vertofs;
medge->v2+= vertofs;
}
}
if (me->totloop) {
- if(base->object!=ob)
+ if (base->object!=ob)
multiresModifier_prepare_join(scene, base->object, ob);
CustomData_merge(&me->ldata, &ldata, CD_MASK_MESH, CD_DEFAULT, totloop);
CustomData_copy_data(&me->ldata, &ldata, 0, loopofs, me->totloop);
- for(a=0; a<me->totloop; a++, mloop++) {
+ for (a=0; a<me->totloop; a++, mloop++) {
mloop->v += vertofs;
mloop->e += edgeofs;
}
}
- if(me->totpoly) {
+ if (me->totpoly) {
/* make mapping for materials */
- for(a=1; a<=base->object->totcol; a++) {
+ for (a=1; a<=base->object->totcol; a++) {
ma= give_current_material(base->object, a);
- for(b=0; b<totcol; b++) {
- if(ma == matar[b]) {
+ for (b=0; b<totcol; b++) {
+ if (ma == matar[b]) {
matmap[a-1]= b;
break;
}
@@ -444,7 +444,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
CustomData_merge(&me->pdata, &pdata, CD_MASK_MESH, CD_DEFAULT, totpoly);
CustomData_copy_data(&me->pdata, &pdata, 0, polyofs, me->totpoly);
- for(a=0; a<me->totpoly; a++, mpoly++) {
+ for (a=0; a<me->totpoly; a++, mpoly++) {
mpoly->loopstart += loopofs;
mpoly->mat_nr= matmap ? matmap[(int)mpoly->mat_nr] : 0;
}
@@ -460,7 +460,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
loopofs += me->totloop;
/* free base, now that data is merged */
- if(base->object != ob)
+ if (base->object != ob)
ED_base_object_free_and_unlink(bmain, scene, base);
}
}
@@ -487,21 +487,21 @@ int join_mesh_exec(bContext *C, wmOperator *op)
mesh_update_customdata_pointers(me, TRUE); /* BMESH_TODO, check if this arg can be failse, non urgent - campbell */
/* old material array */
- for(a=1; a<=ob->totcol; a++) {
+ for (a=1; a<=ob->totcol; a++) {
ma= ob->mat[a-1];
- if(ma) ma->id.us--;
+ if (ma) ma->id.us--;
}
- for(a=1; a<=me->totcol; a++) {
+ for (a=1; a<=me->totcol; a++) {
ma= me->mat[a-1];
- if(ma) ma->id.us--;
+ if (ma) ma->id.us--;
}
- if(ob->mat) MEM_freeN(ob->mat);
- if(ob->matbits) MEM_freeN(ob->matbits);
- if(me->mat) MEM_freeN(me->mat);
+ if (ob->mat) MEM_freeN(ob->mat);
+ if (ob->matbits) MEM_freeN(ob->matbits);
+ if (me->mat) MEM_freeN(me->mat);
ob->mat= me->mat= NULL;
ob->matbits= NULL;
- if(totcol) {
+ if (totcol) {
me->mat= matar;
ob->mat= MEM_callocN(sizeof(void *)*totcol, "join obmatar");
ob->matbits= MEM_callocN(sizeof(char)*totcol, "join obmatbits");
@@ -517,11 +517,11 @@ int join_mesh_exec(bContext *C, wmOperator *op)
test_object_materials((ID *)me);
/* free temp copy of destination shapekeys (if applicable) */
- if(nkey) {
+ if (nkey) {
// XXX 2.5 Animato
#if 0
/* free it's ipo too - both are not actually freed from memory yet as ID-blocks */
- if(nkey->ipo) {
+ if (nkey->ipo) {
free_ipo(nkey->ipo);
BLI_remlink(&bmain->ipo, nkey->ipo);
MEM_freeN(nkey->ipo);
@@ -590,7 +590,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if(key == NULL) {
+ if (key == NULL) {
key= me->key= add_key((ID *)me);
key->type= KEY_RELATIVE;
@@ -603,7 +603,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
if (base->object == ob) continue;
- if(base->object->type==OB_MESH) {
+ if (base->object->type==OB_MESH) {
selme = (Mesh *)base->object->data;
if (selme->totvert==me->totvert) {
@@ -656,16 +656,16 @@ static int mesh_octree_get_base_offs(float *co, float *offs, float *div)
static void mesh_octree_add_node(MocNode **bt, intptr_t index)
{
- if(*bt==NULL) {
+ if (*bt==NULL) {
*bt= MEM_callocN(sizeof(MocNode), "MocNode");
(*bt)->index[0]= index;
}
else {
int a;
- for(a=0; a<MOC_NODE_RES; a++) {
- if((*bt)->index[a]==index)
+ for (a=0; a<MOC_NODE_RES; a++) {
+ if ((*bt)->index[a]==index)
return;
- else if((*bt)->index[a]==0) {
+ else if ((*bt)->index[a]==0) {
(*bt)->index[a]= index;
return;
}
@@ -676,7 +676,7 @@ static void mesh_octree_add_node(MocNode **bt, intptr_t index)
static void mesh_octree_free_node(MocNode **bt)
{
- if( (*bt)->next ) {
+ if ( (*bt)->next ) {
mesh_octree_free_node(&(*bt)->next);
}
MEM_freeN(*bt);
@@ -739,26 +739,26 @@ static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, float *co)
float *vec;
int a;
- if(*bt==NULL)
+ if (*bt==NULL)
return -1;
- for(a=0; a<MOC_NODE_RES; a++) {
- if((*bt)->index[a]) {
+ for (a=0; a<MOC_NODE_RES; a++) {
+ if ((*bt)->index[a]) {
/* does mesh verts and editmode, code looks potential dangerous, octree should really be filled OK! */
- if(mvert) {
+ if (mvert) {
vec= (mvert+(*bt)->index[a]-1)->co;
- if(compare_v3v3(vec, co, MOC_THRESH))
+ if (compare_v3v3(vec, co, MOC_THRESH))
return (*bt)->index[a]-1;
}
else {
BMVert *eve= (BMVert *)((*bt)->index[a]);
- if(compare_v3v3(eve->co, co, MOC_THRESH))
+ if (compare_v3v3(eve->co, co, MOC_THRESH))
return (*bt)->index[a];
}
}
else return -1;
}
- if( (*bt)->next)
+ if ( (*bt)->next)
return mesh_octree_find_index(&(*bt)->next, mvert, co);
return -1;
@@ -775,21 +775,21 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
{
MocNode **bt;
- if(mode=='u') { /* use table */
- if(MeshOctree.table==NULL)
+ if (mode=='u') { /* use table */
+ if (MeshOctree.table==NULL)
mesh_octree_table(ob, em, NULL, 's');
- if(MeshOctree.table) {
+ if (MeshOctree.table) {
Mesh *me= ob->data;
bt= MeshOctree.table + mesh_octree_get_base_offs(co, MeshOctree.offs, MeshOctree.div);
- if(em)
+ if (em)
return mesh_octree_find_index(bt, NULL, co);
else
return mesh_octree_find_index(bt, me->mvert, co);
}
return -1;
}
- else if(mode=='s') { /* start table */
+ else if (mode=='s') { /* start table */
Mesh *me= ob->data;
float min[3], max[3];
@@ -797,18 +797,19 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
* we are using the undeformed coordinates*/
INIT_MINMAX(min, max);
- if(em && me->edit_btmesh==em) {
+ if (em && me->edit_btmesh==em) {
BMIter iter;
BMVert *eve;
- BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL)
- DO_MINMAX(eve->co, min, max)
+ BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
+ DO_MINMAX(eve->co, min, max);
+ }
}
else {
MVert *mvert;
int a;
- for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++)
+ for (a=0, mvert= me->mvert; a<me->totvert; a++, mvert++)
DO_MINMAX(mvert->co, min, max);
}
@@ -824,16 +825,16 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
MeshOctree.div[2]+= 2*MOC_THRESH;
mul_v3_fl(MeshOctree.div, 1.0f/MOC_RES);
- if(MeshOctree.div[0]==0.0f) MeshOctree.div[0]= 1.0f;
- if(MeshOctree.div[1]==0.0f) MeshOctree.div[1]= 1.0f;
- if(MeshOctree.div[2]==0.0f) MeshOctree.div[2]= 1.0f;
+ if (MeshOctree.div[0]==0.0f) MeshOctree.div[0]= 1.0f;
+ if (MeshOctree.div[1]==0.0f) MeshOctree.div[1]= 1.0f;
+ if (MeshOctree.div[2]==0.0f) MeshOctree.div[2]= 1.0f;
- if(MeshOctree.table) /* happens when entering this call without ending it */
+ if (MeshOctree.table) /* happens when entering this call without ending it */
mesh_octree_table(ob, em, co, 'e');
MeshOctree.table= MEM_callocN(MOC_RES*MOC_RES*MOC_RES*sizeof(void *), "sym table");
- if(em && me->edit_btmesh==em) {
+ if (em && me->edit_btmesh==em) {
BMVert *eve;
BMIter iter;
@@ -845,16 +846,16 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
MVert *mvert;
int a;
- for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++)
+ for (a=0, mvert= me->mvert; a<me->totvert; a++, mvert++)
mesh_octree_add_nodes(MeshOctree.table, mvert->co, MeshOctree.offs, MeshOctree.div, a+1);
}
}
- else if(mode=='e') { /* end table */
- if(MeshOctree.table) {
+ else if (mode=='e') { /* end table */
+ if (MeshOctree.table) {
int a;
- for(a=0, bt=MeshOctree.table; a<MOC_RES*MOC_RES*MOC_RES; a++, bt++) {
- if(*bt) mesh_octree_free_node(bt);
+ for (a=0, bt=MeshOctree.table; a<MOC_RES*MOC_RES*MOC_RES; a++, bt++) {
+ if (*bt) mesh_octree_free_node(bt);
}
MEM_freeN(MeshOctree.table);
MeshOctree.table= NULL;
@@ -870,15 +871,15 @@ MirrTopoStore_t mesh_topo_store= {NULL, -1. -1, -1};
/* note, is supposed return -1 on error, which callers are currently checking for, but is not used so far */
int mesh_mirrtopo_table(Object *ob, char mode)
{
- if(mode=='u') { /* use table */
+ if (mode=='u') { /* use table */
if (ED_mesh_mirrtopo_recalc_check(ob->data, ob->mode, &mesh_topo_store)) {
mesh_mirrtopo_table(ob, 's');
}
}
- else if(mode=='s') { /* start table */
+ else if (mode=='s') { /* start table */
ED_mesh_mirrtopo_init(ob->data, ob->mode, &mesh_topo_store, FALSE);
}
- else if(mode=='e') { /* end table */
+ else if (mode=='e') { /* end table */
ED_mesh_mirrtopo_free(&mesh_topo_store);
}
return 0;
@@ -910,7 +911,8 @@ int mesh_get_x_mirror_vert(Object *ob, int index)
{
if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) {
return mesh_get_x_mirror_vert_topo(ob, index);
- } else {
+ }
+ else {
return mesh_get_x_mirror_vert_spacial(ob, index);
}
return 0;
@@ -933,7 +935,7 @@ static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, f
vec[2]= co[2];
poinval= mesh_octree_table(ob, em, vec, 'u');
- if(poinval != -1)
+ if (poinval != -1)
return (BMVert *)(poinval);
return NULL;
}
@@ -962,7 +964,7 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *e
poinval= mesh_topo_store.index_lookup[index];
- if(poinval != -1)
+ if (poinval != -1)
return (BMVert *)(poinval);
return NULL;
}
@@ -997,7 +999,8 @@ static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float
cent_vec[0] = face_cent[0];
cent_vec[1]= -((face_cent[1])-mirrCent[1]) + mirrCent[1];
- } else {
+ }
+ else {
vec[0]= -((uv[0])-mirrCent[0]) + mirrCent[0];
vec[1]= uv[1];
@@ -1038,7 +1041,7 @@ static unsigned int mirror_facehash(const void *ptr)
const MFace *mf= ptr;
int v0, v1;
- if(mf->v4) {
+ if (mf->v4) {
v0= MIN4(mf->v1, mf->v2, mf->v3, mf->v4);
v1= MAX4(mf->v1, mf->v2, mf->v3, mf->v4);
}
@@ -1052,22 +1055,22 @@ static unsigned int mirror_facehash(const void *ptr)
static int mirror_facerotation(MFace *a, MFace *b)
{
- if(b->v4) {
- if(a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3 && a->v4==b->v4)
+ if (b->v4) {
+ if (a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3 && a->v4==b->v4)
return 0;
- else if(a->v4==b->v1 && a->v1==b->v2 && a->v2==b->v3 && a->v3==b->v4)
+ else if (a->v4==b->v1 && a->v1==b->v2 && a->v2==b->v3 && a->v3==b->v4)
return 1;
- else if(a->v3==b->v1 && a->v4==b->v2 && a->v1==b->v3 && a->v2==b->v4)
+ else if (a->v3==b->v1 && a->v4==b->v2 && a->v1==b->v3 && a->v2==b->v4)
return 2;
- else if(a->v2==b->v1 && a->v3==b->v2 && a->v4==b->v3 && a->v1==b->v4)
+ else if (a->v2==b->v1 && a->v3==b->v2 && a->v4==b->v3 && a->v1==b->v4)
return 3;
}
else {
- if(a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3)
+ if (a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3)
return 0;
- else if(a->v3==b->v1 && a->v1==b->v2 && a->v2==b->v3)
+ else if (a->v3==b->v1 && a->v1==b->v2 && a->v2==b->v3)
return 1;
- else if(a->v2==b->v1 && a->v3==b->v2 && a->v1==b->v3)
+ else if (a->v2==b->v1 && a->v3==b->v2 && a->v1==b->v3)
return 2;
}
@@ -1094,29 +1097,29 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em)
mesh_octree_table(ob, em, NULL, 's');
- for(a=0, mv=mvert; a<me->totvert; a++, mv++)
+ for (a=0, mv=mvert; a<me->totvert; a++, mv++)
mirrorverts[a]= mesh_get_x_mirror_vert(ob, a);
mesh_octree_table(ob, em, NULL, 'e');
fhash= BLI_ghash_new(mirror_facehash, mirror_facecmp, "mirror_facehash gh");
- for(a=0, mf=mface; a<me->totface; a++, mf++)
+ for (a=0, mf=mface; a<me->totface; a++, mf++)
BLI_ghash_insert(fhash, mf, mf);
- for(a=0, mf=mface; a<me->totface; a++, mf++) {
+ for (a=0, mf=mface; a<me->totface; a++, mf++) {
mirrormf.v1= mirrorverts[mf->v3];
mirrormf.v2= mirrorverts[mf->v2];
mirrormf.v3= mirrorverts[mf->v1];
mirrormf.v4= (mf->v4)? mirrorverts[mf->v4]: 0;
/* make sure v4 is not 0 if a quad */
- if(mf->v4 && mirrormf.v4==0) {
+ if (mf->v4 && mirrormf.v4==0) {
SWAP(unsigned int, mirrormf.v1, mirrormf.v3);
SWAP(unsigned int, mirrormf.v2, mirrormf.v4);
}
hashmf= BLI_ghash_lookup(fhash, &mirrormf);
- if(hashmf) {
+ if (hashmf) {
mirrorfaces[a*2]= hashmf - mface;
mirrorfaces[a*2+1]= mirror_facerotation(&mirrormf, hashmf);
}
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index 1287d903020..713009d2a19 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -82,8 +82,8 @@ void make_editMball(Object *obedit)
ml= mb->elems.first;
- while(ml) {
- if(ml->flag & SELECT) mb->lastelem = ml;
+ while (ml) {
+ if (ml->flag & SELECT) mb->lastelem = ml;
ml= ml->next;
}
@@ -106,7 +106,7 @@ MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int UNU
/* Deselect all existing metaelems */
ml= mball->editelems->first;
- while(ml) {
+ while (ml) {
ml->flag &= ~SELECT;
ml= ml->next;
}
@@ -131,11 +131,11 @@ static int mball_select_all_exec(bContext *C, wmOperator *op)
int action = RNA_enum_get(op->ptr, "action");
ml= mb->editelems->first;
- if(ml) {
+ if (ml) {
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
- while(ml) {
- if(ml->flag & SELECT) {
+ while (ml) {
+ if (ml->flag & SELECT) {
action = SEL_DESELECT;
break;
}
@@ -144,7 +144,7 @@ static int mball_select_all_exec(bContext *C, wmOperator *op)
}
ml= mb->editelems->first;
- while(ml) {
+ while (ml) {
switch (action) {
case SEL_SELECT:
ml->flag |= SELECT;
@@ -167,16 +167,16 @@ static int mball_select_all_exec(bContext *C, wmOperator *op)
void MBALL_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect All";
- ot->description= "Change selection of all meta elements";
- ot->idname= "MBALL_OT_select_all";
+ ot->name = "(De)select All";
+ ot->description = "Change selection of all meta elements";
+ ot->idname = "MBALL_OT_select_all";
/* callback functions */
- ot->exec= mball_select_all_exec;
- ot->poll= ED_operator_editmball;
+ ot->exec = mball_select_all_exec;
+ ot->poll = ED_operator_editmball;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -191,15 +191,15 @@ static int select_random_metaelems_exec(bContext *C, wmOperator *op)
MetaElem *ml;
float percent= RNA_float_get(op->ptr, "percent");
- if(percent == 0.0f)
+ if (percent == 0.0f)
return OPERATOR_CANCELLED;
ml= mb->editelems->first;
BLI_srand( BLI_rand() ); /* Random seed */
/* Stupid version of random selection. Should be improved. */
- while(ml) {
- if(BLI_frand() < percent)
+ while (ml) {
+ if (BLI_frand() < percent)
ml->flag |= SELECT;
else
ml->flag &= ~SELECT;
@@ -215,17 +215,17 @@ static int select_random_metaelems_exec(bContext *C, wmOperator *op)
void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Random...";
- ot->description= "Randomly select metaelements";
- ot->idname= "MBALL_OT_select_random_metaelems";
+ ot->name = "Random...";
+ ot->description = "Randomly select metaelements";
+ ot->idname = "MBALL_OT_select_random_metaelems";
/* callback functions */
- ot->exec= select_random_metaelems_exec;
- ot->invoke= WM_operator_props_popup;
- ot->poll= ED_operator_editmball;
+ ot->exec = select_random_metaelems_exec;
+ ot->invoke = WM_operator_props_popup;
+ ot->poll = ED_operator_editmball;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of metaelems to select randomly", 0.0001f, 1.0f);
@@ -241,9 +241,9 @@ static int duplicate_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
MetaElem *ml, *newml;
ml= mb->editelems->last;
- if(ml) {
- while(ml) {
- if(ml->flag & SELECT) {
+ if (ml) {
+ while (ml) {
+ if (ml->flag & SELECT) {
newml= MEM_dupallocN(ml);
BLI_addtail(mb->editelems, newml);
mb->lastelem= newml;
@@ -274,17 +274,17 @@ static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
void MBALL_OT_duplicate_metaelems(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Duplicate Metaelements";
- ot->description= "Delete selected metaelement(s)";
- ot->idname= "MBALL_OT_duplicate_metaelems";
+ ot->name = "Duplicate Metaelements";
+ ot->description = "Delete selected metaelement(s)";
+ ot->idname = "MBALL_OT_duplicate_metaelems";
/* callback functions */
- ot->exec= duplicate_metaelems_exec;
- ot->invoke= duplicate_metaelems_invoke;
- ot->poll= ED_operator_editmball;
+ ot->exec = duplicate_metaelems_exec;
+ ot->invoke = duplicate_metaelems_invoke;
+ ot->poll = ED_operator_editmball;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* to give to transform */
RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -300,11 +300,11 @@ static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
MetaElem *ml, *next;
ml= mb->editelems->first;
- if(ml) {
- while(ml) {
+ if (ml) {
+ while (ml) {
next= ml->next;
- if(ml->flag & SELECT) {
- if(mb->lastelem==ml) mb->lastelem= NULL;
+ if (ml->flag & SELECT) {
+ if (mb->lastelem==ml) mb->lastelem= NULL;
BLI_remlink(mb->editelems, ml);
MEM_freeN(ml);
}
@@ -320,16 +320,16 @@ static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
void MBALL_OT_delete_metaelems(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete";
- ot->description= "Delete selected metaelement(s)";
- ot->idname= "MBALL_OT_delete_metaelems";
+ ot->name = "Delete";
+ ot->description = "Delete selected metaelement(s)";
+ ot->idname = "MBALL_OT_delete_metaelems";
/* callback functions */
- ot->exec= delete_metaelems_exec;
- ot->poll= ED_operator_editmball;
+ ot->exec = delete_metaelems_exec;
+ ot->poll = ED_operator_editmball;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/***************************** Hide operator *****************************/
@@ -344,9 +344,9 @@ static int hide_metaelems_exec(bContext *C, wmOperator *op)
ml= mb->editelems->first;
- if(ml) {
- while(ml) {
- if((ml->flag & SELECT) != invert)
+ if (ml) {
+ while (ml) {
+ if ((ml->flag & SELECT) != invert)
ml->flag |= MB_HIDE;
ml= ml->next;
}
@@ -360,16 +360,16 @@ static int hide_metaelems_exec(bContext *C, wmOperator *op)
void MBALL_OT_hide_metaelems(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Hide";
- ot->description= "Hide (un)selected metaelement(s)";
- ot->idname= "MBALL_OT_hide_metaelems";
+ ot->name = "Hide";
+ ot->description = "Hide (un)selected metaelement(s)";
+ ot->idname = "MBALL_OT_hide_metaelems";
/* callback functions */
- ot->exec= hide_metaelems_exec;
- ot->poll= ED_operator_editmball;
+ ot->exec = hide_metaelems_exec;
+ ot->poll = ED_operator_editmball;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
@@ -386,8 +386,8 @@ static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
ml= mb->editelems->first;
- if(ml) {
- while(ml) {
+ if (ml) {
+ while (ml) {
ml->flag &= ~MB_HIDE;
ml= ml->next;
}
@@ -401,16 +401,16 @@ static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
void MBALL_OT_reveal_metaelems(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reveal";
- ot->description= "Reveal all hidden metaelements";
- ot->idname= "MBALL_OT_reveal_metaelems";
+ ot->name = "Reveal";
+ ot->description = "Reveal all hidden metaelements";
+ ot->idname = "MBALL_OT_reveal_metaelems";
/* callback functions */
- ot->exec= reveal_metaelems_exec;
- ot->poll= ED_operator_editmball;
+ ot->exec = reveal_metaelems_exec;
+ ot->poll = ED_operator_editmball;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* Select MetaElement with mouse click (user can select radius circle or
@@ -428,49 +428,49 @@ int mouse_mball(bContext *C, const int mval[2], int extend)
view3d_set_viewcontext(C, &vc);
- rect.xmin= mval[0]-12;
- rect.xmax= mval[0]+12;
- rect.ymin= mval[1]-12;
- rect.ymax= mval[1]+12;
+ rect.xmin = mval[0]-12;
+ rect.xmax = mval[0]+12;
+ rect.ymin = mval[1]-12;
+ rect.ymax = mval[1]+12;
hits= view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
/* does startelem exist? */
ml= mb->editelems->first;
- while(ml) {
- if(ml==startelem) break;
+ while (ml) {
+ if (ml==startelem) break;
ml= ml->next;
}
- if(ml==NULL) startelem= mb->editelems->first;
+ if (ml==NULL) startelem= mb->editelems->first;
- if(hits>0) {
+ if (hits>0) {
ml= startelem;
- while(ml) {
- for(a=0; a<hits; a++) {
+ while (ml) {
+ for (a=0; a<hits; a++) {
/* index converted for gl stuff */
- if(ml->selcol1==buffer[ 4 * a + 3 ]) {
+ if (ml->selcol1==buffer[ 4 * a + 3 ]) {
ml->flag |= MB_SCALE_RAD;
act= ml;
}
- if(ml->selcol2==buffer[ 4 * a + 3 ]) {
+ if (ml->selcol2==buffer[ 4 * a + 3 ]) {
ml->flag &= ~MB_SCALE_RAD;
act= ml;
}
}
- if(act) break;
+ if (act) break;
ml= ml->next;
- if(ml==NULL) ml= mb->editelems->first;
- if(ml==startelem) break;
+ if (ml==NULL) ml= mb->editelems->first;
+ if (ml==startelem) break;
}
/* When some metaelem was found, then it is necessary to select or
* deselect it. */
- if(act) {
- if(extend==0) {
+ if (act) {
+ if (extend==0) {
/* Deselect all existing metaelems */
ml= mb->editelems->first;
- while(ml) {
+ while (ml) {
ml->flag &= ~SELECT;
ml= ml->next;
}
@@ -478,7 +478,7 @@ int mouse_mball(bContext *C, const int mval[2], int extend)
act->flag |= SELECT;
}
else {
- if(act->flag & SELECT)
+ if (act->flag & SELECT)
act->flag &= ~SELECT;
else
act->flag |= SELECT;
@@ -502,10 +502,10 @@ static void freeMetaElemlist(ListBase *lb)
{
MetaElem *ml, *next;
- if(lb==NULL) return;
+ if (lb==NULL) return;
ml= lb->first;
- while(ml) {
+ while (ml) {
next= ml->next;
BLI_remlink(lb, ml);
MEM_freeN(ml);
@@ -526,7 +526,7 @@ static void undoMball_to_editMball(void *lbu, void *lbe, void *UNUSED(obe))
/* copy 'undo' MetaElems to 'edit' MetaElems */
ml= lb->first;
- while(ml) {
+ while (ml) {
newml= MEM_dupallocN(ml);
BLI_addtail(editelems, newml);
ml= ml->next;
@@ -546,7 +546,7 @@ static void *editMball_to_undoMball(void *lbe, void *UNUSED(obe))
/* copy contents of current ListBase to the undo ListBase */
ml= editelems->first;
- while(ml) {
+ while (ml) {
newml= MEM_dupallocN(ml);
BLI_addtail(lb, newml);
ml= ml->next;
@@ -566,7 +566,7 @@ static void free_undoMball(void *lbv)
static ListBase *metaball_get_editelems(Object *ob)
{
- if(ob && ob->type==OB_MBALL) {
+ if (ob && ob->type==OB_MBALL) {
struct MetaBall *mb= (struct MetaBall*)ob->data;
return mb->editelems;
}
diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c
index f689fb049fe..5d019cc49d9 100644
--- a/source/blender/editors/metaball/mball_ops.c
+++ b/source/blender/editors/metaball/mball_ops.c
@@ -59,8 +59,8 @@ void ED_keymap_metaball(wmKeyConfig *keyconf)
wmKeyMap *keymap;
wmKeyMapItem *kmi;
- keymap= WM_keymap_find(keyconf, "Metaball", 0, 0);
- keymap->poll= ED_operator_editmball;
+ keymap = WM_keymap_find(keyconf, "Metaball", 0, 0);
+ keymap->poll = ED_operator_editmball;
WM_keymap_add_item(keymap, "OBJECT_OT_metaball_add", AKEY, KM_PRESS, KM_SHIFT, 0);
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 996dd4ca59f..3717591e412 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -123,7 +123,7 @@ 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);
- if(rv3d) {
+ if (rv3d) {
float quat[4];
copy_qt_qt(quat, rv3d->viewquat);
quat[0]= -quat[0];
@@ -174,7 +174,7 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit, float *loc, fl
invert_m3_m3(imat, mat);
mul_m3_v3(imat, primmat[3]);
- if(v3d) return v3d->grid;
+ if (v3d) return v3d->grid;
return 1.0f;
}
@@ -193,7 +193,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
prop = RNA_def_boolean(ot->srna, "view_align", 0, "Align to View", "Align the new object to the view");
RNA_def_property_update_runtime(prop, view_align_update);
- if(do_editmode) {
+ 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);
@@ -212,23 +212,23 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
static void object_add_generic_invoke_options(bContext *C, wmOperator *op)
{
- if(RNA_struct_find_property(op->ptr, "enter_editmode")) /* optional */
+ if (RNA_struct_find_property(op->ptr, "enter_editmode")) /* optional */
if (!RNA_struct_property_is_set(op->ptr, "enter_editmode"))
RNA_boolean_set(op->ptr, "enter_editmode", U.flag & USER_ADD_EDITMODE);
- if(!RNA_struct_property_is_set(op->ptr, "location")) {
+ if (!RNA_struct_property_is_set(op->ptr, "location")) {
float loc[3];
ED_object_location_from_view(C, loc);
RNA_float_set_array(op->ptr, "location", loc);
}
- if(!RNA_struct_property_is_set(op->ptr, "layers")) {
+ if (!RNA_struct_property_is_set(op->ptr, "layers")) {
View3D *v3d = CTX_wm_view3d(C);
Scene *scene = CTX_data_scene(C);
int a, values[20], layer;
- if(v3d) {
+ if (v3d) {
layer = (v3d->scenelock && !v3d->localvd)? scene->layact: v3d->layact;
}
else {
@@ -257,15 +257,15 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
int view_align;
*enter_editmode = FALSE;
- if(RNA_struct_find_property(op->ptr, "enter_editmode") && RNA_boolean_get(op->ptr, "enter_editmode")) {
+ if (RNA_struct_find_property(op->ptr, "enter_editmode") && RNA_boolean_get(op->ptr, "enter_editmode")) {
*enter_editmode = TRUE;
}
- if(RNA_struct_property_is_set(op->ptr, "layers")) {
+ 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++) {
- if(layer_values[a])
+ for (a=0; a<20; a++) {
+ if (layer_values[a])
*layer |= (1 << a);
else
*layer &= ~(1 << a);
@@ -279,10 +279,10 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
/* in local view we additionally add local view layers,
* not part of operator properties */
- if(v3d && v3d->localvd)
+ if (v3d && v3d->localvd)
*layer |= v3d->lay;
- if(RNA_struct_property_is_set(op->ptr, "rotation"))
+ if (RNA_struct_property_is_set(op->ptr, "rotation"))
view_align = FALSE;
else if (RNA_struct_property_is_set(op->ptr, "view_align"))
view_align = RNA_boolean_get(op->ptr, "view_align");
@@ -303,7 +303,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
RNA_float_get_array(op->ptr, "location", loc);
- if(*layer == 0) {
+ if (*layer == 0) {
BKE_report(op->reports, RPT_ERROR, "Property 'layer' has no values set");
return 0;
}
@@ -339,7 +339,7 @@ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot,
ED_render_id_flush_update(bmain, ob->data);
}
- if(enter_editmode)
+ if (enter_editmode)
ED_object_enter_editmode(C, EM_IGNORE_LAYER);
WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
@@ -354,7 +354,7 @@ static int object_add_exec(bContext *C, wmOperator *op)
unsigned int layer;
float loc[3], rot[3];
- if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
+ if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
ED_object_add_type(C, RNA_enum_get(op->ptr, "type"), loc, rot, enter_editmode, layer);
@@ -365,18 +365,18 @@ static int object_add_exec(bContext *C, wmOperator *op)
void OBJECT_OT_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Object";
+ ot->name = "Add Object";
ot->description = "Add an object to the scene";
- ot->idname= "OBJECT_OT_add";
+ ot->idname = "OBJECT_OT_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= object_add_exec;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = object_add_exec;
- ot->poll= ED_operator_objectmode;
+ 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", "");
@@ -411,10 +411,10 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
object_add_generic_invoke_options(C, op);
- if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
+ if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return NULL;
- if(type==PFIELD_GUIDE) {
+ if (type==PFIELD_GUIDE) {
ob= ED_object_add_type(C, OB_CURVE, loc, rot, FALSE, layer);
rename_id(&ob->id, "CurveGuide");
@@ -423,7 +423,7 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
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));
- if(!enter_editmode)
+ if (!enter_editmode)
ED_object_exit_editmode(C, EM_FREEDATA);
}
else {
@@ -448,7 +448,7 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
/* for object add operator */
static int effector_add_exec(bContext *C, wmOperator *op)
{
- if(effector_add_type(C, op, RNA_enum_get(op->ptr, "type")) == NULL)
+ if (effector_add_type(C, op, RNA_enum_get(op->ptr, "type")) == NULL)
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -457,20 +457,20 @@ static int effector_add_exec(bContext *C, wmOperator *op)
void OBJECT_OT_effector_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Effector";
+ ot->name = "Add Effector";
ot->description = "Add an empty object with a physics effector to the scene";
- ot->idname= "OBJECT_OT_effector_add";
+ ot->idname = "OBJECT_OT_effector_add";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= effector_add_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = effector_add_exec;
- ot->poll= ED_operator_objectmode;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", field_type_items, 0, "Type", "");
ED_object_add_generic_props(ot, TRUE);
}
@@ -491,7 +491,7 @@ static int object_camera_add_exec(bContext *C, wmOperator *op)
object_add_generic_invoke_options(C, op);
- if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
+ 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);
@@ -512,16 +512,16 @@ void OBJECT_OT_camera_add(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Camera";
+ ot->name = "Add Camera";
ot->description = "Add a camera object to the scene";
- ot->idname= "OBJECT_OT_camera_add";
+ ot->idname = "OBJECT_OT_camera_add";
/* api callbacks */
- ot->exec= object_camera_add_exec;
- ot->poll= ED_operator_objectmode;
+ ot->exec = object_camera_add_exec;
+ 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);
@@ -545,10 +545,10 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
object_add_generic_invoke_options(C, op); // XXX these props don't get set right when only exec() is called
- if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
+ 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) {
+ if (obedit==NULL || obedit->type!=OB_MBALL) {
obedit= ED_object_add_type(C, OB_MBALL, loc, rot, TRUE, layer);
newob = 1;
}
@@ -578,7 +578,7 @@ static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
layout= uiPupMenuLayout(pup);
- if(!obedit || obedit->type == OB_MBALL)
+ if (!obedit || obedit->type == OB_MBALL)
uiItemsEnumO(layout, op->type->idname, "type");
else
uiItemsEnumO(layout, "OBJECT_OT_metaball_add", "type");
@@ -590,17 +590,17 @@ static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
void OBJECT_OT_metaball_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Metaball";
- ot->description= "Add an metaball object to the scene";
- ot->idname= "OBJECT_OT_metaball_add";
+ ot->name = "Add Metaball";
+ ot->description = "Add an metaball object to the scene";
+ ot->idname = "OBJECT_OT_metaball_add";
/* api callbacks */
- ot->invoke= object_metaball_add_invoke;
- ot->exec= object_metaball_add_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->invoke = object_metaball_add_invoke;
+ ot->exec = object_metaball_add_exec;
+ 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);
@@ -614,10 +614,10 @@ static int object_add_text_exec(bContext *C, wmOperator *op)
float loc[3], rot[3];
object_add_generic_invoke_options(C, op); // XXX these props don't get set right when only exec() is called
- if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
+ 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);
@@ -630,17 +630,17 @@ static int object_add_text_exec(bContext *C, wmOperator *op)
void OBJECT_OT_text_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Text";
+ ot->name = "Add Text";
ot->description = "Add a text object to the scene";
- ot->idname= "OBJECT_OT_text_add";
+ ot->idname = "OBJECT_OT_text_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= object_add_text_exec;
- ot->poll= ED_operator_objectmode;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = object_add_text_exec;
+ 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);
}
@@ -655,7 +655,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
float loc[3], rot[3];
object_add_generic_invoke_options(C, op); // XXX these props don't get set right when only exec() is called
- if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
+ 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)) {
@@ -665,7 +665,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
}
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;
}
@@ -685,17 +685,17 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
void OBJECT_OT_armature_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Armature";
+ ot->name = "Add Armature";
ot->description = "Add an armature object to the scene";
- ot->idname= "OBJECT_OT_armature_add";
+ ot->idname = "OBJECT_OT_armature_add";
/* api callbacks */
- ot->invoke= ED_object_add_generic_invoke;
- ot->exec= object_armature_add_exec;
- ot->poll= ED_operator_objectmode;
+ ot->invoke = ED_object_add_generic_invoke;
+ ot->exec = object_armature_add_exec;
+ 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);
}
@@ -723,7 +723,7 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op)
float loc[3], rot[3];
object_add_generic_invoke_options(C, op);
- if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
+ 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);
@@ -733,7 +733,7 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op)
rename_id(&ob->id, get_lamp_defname(type));
rename_id(&la->id, get_lamp_defname(type));
- if(scene_use_new_shading_nodes(scene)) {
+ if (scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(scene, &la->id);
la->use_nodes= 1;
}
@@ -752,20 +752,20 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Add Lamp";
+ ot->name = "Add Lamp";
ot->description = "Add a lamp object to the scene";
- ot->idname= "OBJECT_OT_lamp_add";
+ ot->idname = "OBJECT_OT_lamp_add";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= object_lamp_add_exec;
- ot->poll= ED_operator_objectmode;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = object_lamp_add_exec;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", lamp_type_items, 0, "Type", "");
ED_object_add_generic_props(ot, FALSE);
}
@@ -779,10 +779,10 @@ static int group_instance_add_exec(bContext *C, wmOperator *op)
float loc[3], rot[3];
object_add_generic_invoke_options(C, op);
- if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
+ if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- if(group) {
+ 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);
@@ -811,7 +811,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
object_add_generic_invoke_options(C, op);
- if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
+ 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);
@@ -843,16 +843,16 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
void OBJECT_OT_speaker_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Speaker";
+ ot->name = "Add Speaker";
ot->description = "Add a speaker object to the scene";
- ot->idname= "OBJECT_OT_speaker_add";
+ ot->idname = "OBJECT_OT_speaker_add";
/* api callbacks */
- ot->exec= object_speaker_add_exec;
- ot->poll= ED_operator_objectmode;
+ ot->exec = object_speaker_add_exec;
+ 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);
}
@@ -863,23 +863,23 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Group Instance";
+ ot->name = "Add Group Instance";
ot->description = "Add a dupligroup instance";
- ot->idname= "OBJECT_OT_group_instance_add";
+ ot->idname = "OBJECT_OT_group_instance_add";
/* api callbacks */
- ot->invoke= WM_enum_search_invoke;
- ot->exec= group_instance_add_exec;
+ ot->invoke = WM_enum_search_invoke;
+ ot->exec = group_instance_add_exec;
- ot->poll= ED_operator_objectmode;
+ 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", "");
RNA_def_enum_funcs(prop, RNA_group_itemf);
- ot->prop= prop;
+ ot->prop = prop;
ED_object_add_generic_props(ot, FALSE);
}
@@ -892,7 +892,7 @@ 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);
}
@@ -903,12 +903,12 @@ static int object_delete_exec(bContext *C, wmOperator *op)
const short use_global= RNA_boolean_get(op->ptr, "use_global");
/* int islamp= 0; */ /* UNUSED */
- if(CTX_data_edit_object(C))
+ if (CTX_data_edit_object(C))
return OPERATOR_CANCELLED;
CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
- /* if(base->object->type==OB_LAMP) islamp= 1; */
+ /* if (base->object->type==OB_LAMP) islamp= 1; */
/* deselect object -- it could be used in other scenes */
base->object->flag &= ~SELECT;
@@ -946,17 +946,17 @@ static int object_delete_exec(bContext *C, wmOperator *op)
void OBJECT_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete";
+ ot->name = "Delete";
ot->description = "Delete selected objects";
- ot->idname= "OBJECT_OT_delete";
+ ot->idname = "OBJECT_OT_delete";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= object_delete_exec;
- ot->poll= ED_operator_objectmode;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = object_delete_exec;
+ 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");
}
@@ -978,18 +978,18 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
CTX_DATA_END;
/* materials */
- if( dupflag & USER_DUP_MAT) {
+ if ( dupflag & USER_DUP_MAT) {
mao= bmain->mat.first;
- while(mao) {
- if(mao->id.newid) {
+ while (mao) {
+ if (mao->id.newid) {
ma= (Material *)mao->id.newid;
- if(dupflag & USER_DUP_TEX) {
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) {
+ if (dupflag & USER_DUP_TEX) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a]) {
id= (ID *)ma->mtex[a]->tex;
- if(id) {
+ if (id) {
ID_NEW_US(ma->mtex[a]->tex)
else ma->mtex[a]->tex= copy_texture(ma->mtex[a]->tex);
id->us--;
@@ -999,7 +999,7 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
}
#if 0 // XXX old animation system
id= (ID *)ma->ipo;
- if(id) {
+ if (id) {
ID_NEW_US(ma->ipo)
else ma->ipo= copy_ipo(ma->ipo);
id->us--;
@@ -1012,13 +1012,13 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
#if 0 // XXX old animation system
/* lamps */
- if( dupflag & USER_DUP_IPO) {
+ if ( dupflag & USER_DUP_IPO) {
Lamp *la= bmain->lamp.first;
- while(la) {
- if(la->id.newid) {
+ while (la) {
+ if (la->id.newid) {
Lamp *lan= (Lamp *)la->id.newid;
id= (ID *)lan->ipo;
- if(id) {
+ if (id) {
ID_NEW_US(lan->ipo)
else lan->ipo= copy_ipo(lan->ipo);
id->us--;
@@ -1030,12 +1030,12 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
/* ipos */
ipo= bmain->ipo.first;
- while(ipo) {
- if(ipo->id.lib==NULL && ipo->id.newid) {
+ while (ipo) {
+ 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) {
- if(icu->driver) {
+ for (icu= ipon->curve.first; icu; icu= icu->next) {
+ if (icu->driver) {
ID_NEW(icu->driver->ob);
}
}
@@ -1059,23 +1059,23 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
DupliObject *dob;
GHash *dupli_gh= NULL, *parent_gh= NULL;
- if(!(base->object->transflag & OB_DUPLI))
+ if (!(base->object->transflag & OB_DUPLI))
return;
lb= object_duplilist(scene, base->object);
- if(use_hierarchy || use_base_parent) {
+ 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");
}
- for(dob= lb->first; dob; dob= dob->next) {
+ for (dob= lb->first; dob; dob= dob->next) {
Base *basen;
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);
@@ -1097,14 +1097,14 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
copy_m4_m4(ob->obmat, dob->mat);
object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
- if(dupli_gh)
+ if (dupli_gh)
BLI_ghash_insert(dupli_gh, dob, ob);
- if(parent_gh)
+ if (parent_gh)
BLI_ghash_insert(parent_gh, BLI_ghashutil_pairalloc(dob->ob, 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;
@@ -1113,7 +1113,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
Object *ob_dst_par= NULL;
/* find parent that was also made real */
- if(ob_src_par) {
+ if (ob_src_par) {
GHashPair *pair = BLI_ghashutil_pairalloc(ob_src_par, dob->index);
ob_dst_par = BLI_ghash_lookup(parent_gh, pair);
BLI_ghashutil_pairfree(pair);
@@ -1151,7 +1151,7 @@ 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);
@@ -1167,9 +1167,9 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
}
}
- if(dupli_gh)
+ if (dupli_gh)
BLI_ghash_free(dupli_gh, NULL, NULL);
- if(parent_gh)
+ if (parent_gh)
BLI_ghash_free(parent_gh, BLI_ghashutil_pairfree, NULL);
copy_object_set_idnew(C, 0);
@@ -1209,17 +1209,17 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Duplicates Real";
+ ot->name = "Make Duplicates Real";
ot->description = "Make dupli objects attached to this object real";
- ot->idname= "OBJECT_OT_duplicates_make_real";
+ ot->idname = "OBJECT_OT_duplicates_make_real";
/* api callbacks */
- ot->exec= object_duplicates_make_real_exec;
+ ot->exec = object_duplicates_make_real_exec;
- ot->poll= ED_operator_objectmode;
+ 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");
@@ -1234,12 +1234,12 @@ static EnumPropertyItem convert_target_items[]= {
static void curvetomesh(Scene *scene, Object *ob)
{
- if(ob->disp.first == NULL)
+ if (ob->disp.first == NULL)
makeDispListCurveTypes(scene, ob, 0); /* force creation */
nurbs_to_mesh(ob); /* also does users */
- if(ob->type == OB_MESH)
+ if (ob->type == OB_MESH)
object_free_modifiers(ob);
}
@@ -1299,7 +1299,7 @@ static int convert_exec(bContext *C, wmOperator *op)
ob->flag &= ~OB_DONE;
/* flag data thats not been edited (only needed for !keep_original) */
- if(ob->data) {
+ if (ob->data) {
((ID *)ob->data)->flag |= LIB_DOIT;
}
}
@@ -1308,17 +1308,17 @@ static int convert_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
ob= base->object;
- if(ob->flag & OB_DONE || !IS_TAGGED(ob->data)) {
+ if (ob->flag & OB_DONE || !IS_TAGGED(ob->data)) {
if (ob->type != target) {
base->flag &= ~SELECT;
ob->flag &= ~SELECT;
}
/* obdata already modified */
- if(!IS_TAGGED(ob->data)) {
+ if (!IS_TAGGED(ob->data)) {
/* 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) {
+ if (ob->type == OB_MESH) {
object_free_modifiers(ob); /* after derivedmesh calls! */
}
}
@@ -1336,16 +1336,17 @@ static int convert_exec(bContext *C, wmOperator *op)
/* make a new copy of the mesh */
newob->data= copy_mesh(me);
- } else {
+ }
+ else {
newob = ob;
}
mesh_to_curve(scene, newob);
- if(newob->type==OB_CURVE)
+ 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) {
@@ -1358,7 +1359,8 @@ static int convert_exec(bContext *C, wmOperator *op)
/* make a new copy of the mesh */
newob->data= copy_mesh(me);
- } else {
+ }
+ else {
newob = ob;
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
}
@@ -1377,7 +1379,7 @@ static int convert_exec(bContext *C, wmOperator *op)
dm->release(dm);
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) {
@@ -1389,7 +1391,8 @@ static int convert_exec(bContext *C, wmOperator *op)
/* make a new copy of the curve */
newob->data= copy_curve(ob->data);
- } else {
+ }
+ else {
newob= ob;
}
@@ -1401,28 +1404,28 @@ static int convert_exec(bContext *C, wmOperator *op)
newob->type= OB_CURVE;
cu->type= OB_CURVE;
- if(cu->vfont) {
+ if (cu->vfont) {
cu->vfont->id.us--;
cu->vfont= NULL;
}
- if(cu->vfontb) {
+ if (cu->vfontb) {
cu->vfontb->id.us--;
cu->vfontb= NULL;
}
- if(cu->vfonti) {
+ if (cu->vfonti) {
cu->vfonti->id.us--;
cu->vfonti= NULL;
}
- if(cu->vfontbi) {
+ if (cu->vfontbi) {
cu->vfontbi->id.us--;
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) {
+ 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;
}
@@ -1430,20 +1433,20 @@ static int convert_exec(bContext *C, wmOperator *op)
}
}
- for(nu=cu->nurb.first; nu; nu=nu->next)
+ for (nu=cu->nurb.first; nu; nu=nu->next)
nu->charidx= 0;
- if(target == OB_MESH) {
+ if (target == OB_MESH) {
curvetomesh(scene, newob);
/* meshes doesn't use displist */
freedisplist(&newob->disp);
}
}
- else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
ob->flag |= OB_DONE;
- if(target == OB_MESH) {
+ if (target == OB_MESH) {
if (keep_original) {
basen= duplibase_for_convert(scene, base, NULL);
newob= basen->object;
@@ -1453,7 +1456,8 @@ static int convert_exec(bContext *C, wmOperator *op)
/* make a new copy of the curve */
newob->data= copy_curve(ob->data);
- } else {
+ }
+ else {
newob= ob;
/* meshes doesn't use displist */
@@ -1463,7 +1467,7 @@ 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;
@@ -1480,7 +1484,7 @@ static int convert_exec(bContext *C, wmOperator *op)
makeDispListMBall(scene, baseob);
}
- if(!(baseob->flag & OB_DONE)) {
+ if (!(baseob->flag & OB_DONE)) {
baseob->flag |= OB_DONE;
basen= duplibase_for_convert(scene, base, baseob);
@@ -1494,9 +1498,9 @@ static int convert_exec(bContext *C, wmOperator *op)
me= newob->data;
me->totcol= mb->totcol;
- if(newob->totcol) {
+ if (newob->totcol) {
me->mat= MEM_dupallocN(mb->mat);
- for(a=0; a<newob->totcol; a++) id_us_plus((ID *)me->mat[a]);
+ for (a=0; a<newob->totcol; a++) id_us_plus((ID *)me->mat[a]);
}
mball_to_mesh(&baseob->disp, newob->data);
@@ -1515,8 +1519,8 @@ static int convert_exec(bContext *C, wmOperator *op)
/* tag obdata if it was been changed */
/* If the original object is active then make this object active */
- if(basen) {
- if(ob == obact) {
+ if (basen) {
+ if (ob == obact) {
/* store new active base to update BASACT */
basact= basen;
}
@@ -1530,8 +1534,8 @@ static int convert_exec(bContext *C, wmOperator *op)
}
/* delete original if needed */
- if(basedel) {
- if(!keep_original)
+ if (basedel) {
+ if (!keep_original)
ED_base_object_free_and_unlink(bmain, scene, basedel);
basedel = NULL;
@@ -1539,7 +1543,7 @@ static int convert_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- if(!keep_original) {
+ if (!keep_original) {
if (mballConverted) {
Base *base= scene->base.first, *tmpbase;
while (base) {
@@ -1564,7 +1568,8 @@ static int convert_exec(bContext *C, wmOperator *op)
/* active base was changed */
ED_base_object_activate(C, basact);
BASACT= basact;
- } else if (BASACT->object->flag & OB_DONE) {
+ }
+ 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);
}
@@ -1580,20 +1585,20 @@ static int convert_exec(bContext *C, wmOperator *op)
void OBJECT_OT_convert(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Convert to";
+ ot->name = "Convert to";
ot->description = "Convert selected objects to another type";
- ot->idname= "OBJECT_OT_convert";
+ ot->idname = "OBJECT_OT_convert";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= convert_exec;
- ot->poll= convert_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = convert_exec;
+ 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");
+ ot->prop = RNA_def_enum(ot->srna, "target", convert_target_items, OB_MESH, "Target", "Type of object to convert to");
RNA_def_boolean(ot->srna, "keep_original", 0, "Keep Original", "Keep original objects instead of replacing them");
}
@@ -1616,7 +1621,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
int a, didit;
ob= base->object;
- if(ob->mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
; /* nothing? */
}
else {
@@ -1628,42 +1633,42 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
BLI_addhead(&scene->base, basen); /* addhead: prevent eternal loop */
basen->object= obn;
- if(basen->flag & OB_FROMGROUP) {
+ if (basen->flag & OB_FROMGROUP) {
Group *group;
- for(group= bmain->group.first; group; group= group->id.next) {
- if(object_in_group(ob, group))
+ for (group= bmain->group.first; group; group= group->id.next) {
+ if (object_in_group(ob, group))
add_to_group(group, obn, scene, basen);
}
}
/* duplicates using userflags */
- if(dupflag & USER_DUP_ACT) {
+ if (dupflag & USER_DUP_ACT) {
BKE_copy_animdata_id_action(&obn->id);
}
- if(dupflag & USER_DUP_MAT) {
- for(a=0; a<obn->totcol; a++) {
+ if (dupflag & USER_DUP_MAT) {
+ for (a=0; a<obn->totcol; a++) {
id= (ID *)obn->mat[a];
- if(id) {
+ if (id) {
ID_NEW_US(obn->mat[a])
else obn->mat[a]= copy_material(obn->mat[a]);
id->us--;
- if(dupflag & USER_DUP_ACT) {
+ if (dupflag & USER_DUP_ACT) {
BKE_copy_animdata_id_action(&obn->mat[a]->id);
}
}
}
}
- if(dupflag & USER_DUP_PSYS) {
+ if (dupflag & USER_DUP_PSYS) {
ParticleSystem *psys;
- for(psys=obn->particlesystem.first; psys; psys=psys->next) {
+ for (psys=obn->particlesystem.first; psys; psys=psys->next) {
id= (ID*) psys->part;
- if(id) {
+ if (id) {
ID_NEW_US(psys->part)
else psys->part= psys_copy_settings(psys->part);
- if(dupflag & USER_DUP_ACT) {
+ if (dupflag & USER_DUP_ACT) {
BKE_copy_animdata_id_action(&psys->part->id);
}
@@ -1677,12 +1682,12 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
switch(obn->type) {
case OB_MESH:
- if(dupflag & USER_DUP_MESH) {
+ if (dupflag & USER_DUP_MESH) {
ID_NEW_US2( obn->data )
else {
obn->data= copy_mesh(obn->data);
- if(obn->fluidsimSettings) {
+ if (obn->fluidsimSettings) {
obn->fluidsimSettings->orgMesh = (Mesh *)obn->data;
}
@@ -1692,7 +1697,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
break;
case OB_CURVE:
- if(dupflag & USER_DUP_CURVE) {
+ if (dupflag & USER_DUP_CURVE) {
ID_NEW_US2(obn->data )
else {
obn->data= copy_curve(obn->data);
@@ -1702,7 +1707,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
break;
case OB_SURF:
- if(dupflag & USER_DUP_SURF) {
+ if (dupflag & USER_DUP_SURF) {
ID_NEW_US2( obn->data )
else {
obn->data= copy_curve(obn->data);
@@ -1712,7 +1717,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
break;
case OB_FONT:
- if(dupflag & USER_DUP_FONT) {
+ if (dupflag & USER_DUP_FONT) {
ID_NEW_US2( obn->data )
else {
obn->data= copy_curve(obn->data);
@@ -1722,7 +1727,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
break;
case OB_MBALL:
- if(dupflag & USER_DUP_MBALL) {
+ if (dupflag & USER_DUP_MBALL) {
ID_NEW_US2(obn->data )
else {
obn->data= copy_mball(obn->data);
@@ -1732,7 +1737,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
break;
case OB_LAMP:
- if(dupflag & USER_DUP_LAMP) {
+ if (dupflag & USER_DUP_LAMP) {
ID_NEW_US2(obn->data )
else {
obn->data= copy_lamp(obn->data);
@@ -1744,9 +1749,9 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
case OB_ARMATURE:
obn->recalc |= OB_RECALC_DATA;
- if(obn->pose) obn->pose->flag |= POSE_RECALC;
+ if (obn->pose) obn->pose->flag |= POSE_RECALC;
- if(dupflag & USER_DUP_ARM) {
+ if (dupflag & USER_DUP_ARM) {
ID_NEW_US2(obn->data )
else {
obn->data= copy_armature(obn->data);
@@ -1759,7 +1764,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
break;
case OB_LATTICE:
- if(dupflag!=0) {
+ if (dupflag!=0) {
ID_NEW_US2(obn->data )
else {
obn->data= copy_lattice(obn->data);
@@ -1769,7 +1774,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
break;
case OB_CAMERA:
- if(dupflag!=0) {
+ if (dupflag!=0) {
ID_NEW_US2(obn->data )
else {
obn->data= copy_camera(obn->data);
@@ -1779,7 +1784,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
break;
case OB_SPEAKER:
- if(dupflag!=0) {
+ if (dupflag!=0) {
ID_NEW_US2(obn->data )
else {
obn->data= copy_speaker(obn->data);
@@ -1792,34 +1797,34 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
/* check if obdata is copied */
- if(didit) {
+ if (didit) {
Key *key = ob_get_key(obn);
- if(dupflag & USER_DUP_ACT) {
+ if (dupflag & USER_DUP_ACT) {
bActuator *act;
BKE_copy_animdata_id_action((ID *)obn->data);
- if(key) {
+ if (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) {
+ if (act->type == ACT_ACTION) {
bActionActuator* actact = (bActionActuator*) act->data;
- if(ob->adt && actact->act == ob->adt->action) {
+ if (ob->adt && actact->act == ob->adt->action) {
actact->act = obn->adt->action;
}
}
}
}
- if(dupflag & USER_DUP_MAT) {
+ if (dupflag & USER_DUP_MAT) {
matarar= give_matarar(obn);
- if(matarar) {
- for(a=0; a<obn->totcol; a++) {
+ if (matarar) {
+ for (a=0; a<obn->totcol; a++) {
id= (ID *)(*matarar)[a];
- if(id) {
+ if (id) {
ID_NEW_US( (*matarar)[a] )
else (*matarar)[a]= copy_material((*matarar)[a]);
@@ -1886,10 +1891,10 @@ 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) {
+ if (basen->object->data) {
DAG_id_tag_update(basen->object->data, 0);
}
}
@@ -1910,16 +1915,16 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Duplicate Objects";
+ ot->name = "Duplicate Objects";
ot->description = "Duplicate selected objects";
- ot->idname= "OBJECT_OT_duplicate";
+ ot->idname = "OBJECT_OT_duplicate";
/* api callbacks */
- ot->exec= duplicate_exec;
- ot->poll= ED_operator_objectmode;
+ ot->exec = duplicate_exec;
+ 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");
@@ -1943,7 +1948,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
/* find object, create fake base */
RNA_string_get(op->ptr, "name", name);
ob= (Object *)find_id("OB", name);
- if(ob==NULL)
+ if (ob==NULL)
return OPERATOR_CANCELLED;
base= MEM_callocN(sizeof(Base), "duplibase");
@@ -1981,16 +1986,16 @@ static int add_named_exec(bContext *C, wmOperator *op)
void OBJECT_OT_add_named(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Named Object";
+ ot->name = "Add Named Object";
ot->description = "Add named object";
- ot->idname= "OBJECT_OT_add_named";
+ ot->idname = "OBJECT_OT_add_named";
/* api callbacks */
- ot->exec= add_named_exec;
- ot->poll= ED_operator_objectmode;
+ ot->exec = add_named_exec;
+ 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");
@@ -2017,20 +2022,20 @@ static int join_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
- if(scene->obedit) {
+ if (scene->obedit) {
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode");
return OPERATOR_CANCELLED;
}
- else if(object_data_is_libdata(ob)) {
+ else if (object_data_is_libdata(ob)) {
BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
return OPERATOR_CANCELLED;
}
- if(ob->type == OB_MESH)
+ if (ob->type == OB_MESH)
return join_mesh_exec(C, op);
- else if(ELEM(ob->type, OB_CURVE, OB_SURF))
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF))
return join_curve_exec(C, op);
- else if(ob->type == OB_ARMATURE)
+ else if (ob->type == OB_ARMATURE)
return join_armature_exec(C, op);
return OPERATOR_CANCELLED;
@@ -2039,16 +2044,16 @@ static int join_exec(bContext *C, wmOperator *op)
void OBJECT_OT_join(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Join";
+ ot->name = "Join";
ot->description = "Join selected objects into active object";
- ot->idname= "OBJECT_OT_join";
+ ot->idname = "OBJECT_OT_join";
/* api callbacks */
- ot->exec= join_exec;
- ot->poll= join_poll;
+ ot->exec = join_exec;
+ ot->poll = join_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/**************************** Join as Shape Key*************************/
@@ -2070,16 +2075,16 @@ static int join_shapes_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
- if(scene->obedit) {
+ if (scene->obedit) {
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode");
return OPERATOR_CANCELLED;
}
- else if(object_data_is_libdata(ob)) {
+ else if (object_data_is_libdata(ob)) {
BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
return OPERATOR_CANCELLED;
}
- if(ob->type == OB_MESH)
+ if (ob->type == OB_MESH)
return join_mesh_shapes_exec(C, op);
return OPERATOR_CANCELLED;
@@ -2088,14 +2093,14 @@ static int join_shapes_exec(bContext *C, wmOperator *op)
void OBJECT_OT_join_shapes(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Join as Shapes";
+ ot->name = "Join as Shapes";
ot->description = "Merge selected objects to shapes of active object";
- ot->idname= "OBJECT_OT_join_shapes";
+ ot->idname = "OBJECT_OT_join_shapes";
/* api callbacks */
- ot->exec= join_shapes_exec;
- ot->poll= join_shapes_poll;
+ ot->exec = join_shapes_exec;
+ 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 b3629abc4e6..deefcfd6989 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -161,10 +161,11 @@ static void multiresbake_get_normal(const MResolvePixelData *data, float norm[],
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) {
+ if (!smoothnormal) { /* flat */
+ if (data->precomputed_normals) {
copy_v3_v3(norm, &data->precomputed_normals[3*face_num]);
- } else {
+ }
+ else {
float nor[3];
float *p0, *p1, *p2;
const int iGetNrVerts= data->mface[face_num].v4!=0 ? 4 : 3;
@@ -173,16 +174,18 @@ static void multiresbake_get_normal(const MResolvePixelData *data, float norm[],
p1= data->mvert[indices[1]].co;
p2= data->mvert[indices[2]].co;
- if(iGetNrVerts==4) {
+ if (iGetNrVerts==4) {
float *p3= data->mvert[indices[3]].co;
normal_quad_v3(nor, p0, p1, p2, p3);
- } else {
+ }
+ else {
normal_tri_v3(nor, p0, p1, p2);
}
copy_v3_v3(norm, nor);
}
- } else {
+ }
+ else {
short *no= data->mvert[indices[vert_index]].no;
normal_short_to_float_v3(norm, no);
@@ -239,7 +242,7 @@ static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
/* 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++) {
+ 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;
}
@@ -258,8 +261,8 @@ static void set_rast_triangle(const MBakeRast *bake_rast, const int x, const int
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;
}
@@ -277,29 +280,29 @@ static void rasterize_half(const MBakeRast *bake_rast,
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;
- 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;
- 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);
- if(iXr>0 && iXl<w) {
+ 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);
}
}
@@ -318,19 +321,20 @@ static void bake_rasterize(const MBakeRast *bake_rast, const float st0_in[2], co
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);
}
@@ -348,7 +352,7 @@ static void bake_rasterize(const MBakeRast *bake_rast, const float st0_in[2], co
static int multiresbake_test_break(MultiresBakeRender *bkr)
{
- if(!bkr->stop) {
+ if (!bkr->stop) {
/* this means baker is executed outside from job system */
return 0;
}
@@ -368,12 +372,12 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData
MTFace *mtface= dm->getTessFaceDataArray(dm, CD_MTFACE);
float *pvtangent= NULL;
- if(CustomData_get_layer_index(&dm->faceData, CD_TANGENT) == -1)
+ if (CustomData_get_layer_index(&dm->faceData, CD_TANGENT) == -1)
DM_add_tangent_layer(dm);
pvtangent= DM_get_tessface_data_layer(dm, CD_TANGENT);
- if(tot_face > 0) { /* sanity check */
+ if (tot_face > 0) { /* sanity check */
int f= 0;
MBakeRast bake_rast;
MResolvePixelData data={NULL};
@@ -390,19 +394,19 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData
data.lvl= lvl;
data.pass_data= passKnownData;
- if(initBakeData)
+ if (initBakeData)
data.bake_data= initBakeData(bkr, ima);
init_bake_rast(&bake_rast, ibuf, &data, flush_pixel);
- for(f= 0; f<tot_face; f++) {
+ for (f= 0; f<tot_face; f++) {
MTFace *mtfate= &mtface[f];
int verts[3][2], nr_tris, t;
- if(multiresbake_test_break(bkr))
+ if (multiresbake_test_break(bkr))
break;
- if(mtfate->tpage!=ima)
+ if (mtfate->tpage!=ima)
continue;
data.face_index= f;
@@ -418,7 +422,7 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData
verts[2][1]=3;
nr_tris= mface[f].v4!=0 ? 2 : 1;
- for(t= 0; t<nr_tris; t++) {
+ for (t= 0; t<nr_tris; t++) {
data.i0 = verts[0][t];
data.i1 = verts[1][t];
data.i2 = verts[2][t];
@@ -428,17 +432,17 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData
bkr->baked_faces++;
- if(bkr->do_update)
+ if (bkr->do_update)
*bkr->do_update= 1;
- if(bkr->progress)
+ if (bkr->progress)
*bkr->progress= ((float)bkr->baked_objects + (float)bkr->baked_faces / tot_face) / bkr->tot_obj;
}
- if(applyBakeData)
+ if (applyBakeData)
applyBakeData(data.bake_data);
- if(freeBakeData)
+ if (freeBakeData)
freeBakeData(data.bake_data);
}
}
@@ -486,12 +490,13 @@ static void interp_bilinear_grid(DMGridData *grid, int grid_size, float crn_x, f
u= crn_x-x0;
v= crn_y-y0;
- if(mode == 0) {
+ if (mode == 0) {
copy_v3_v3(data[0], grid[y0 * grid_size + x0].no);
copy_v3_v3(data[1], grid[y0 * grid_size + x1].no);
copy_v3_v3(data[2], grid[y1 * grid_size + x1].no);
copy_v3_v3(data[3], grid[y1 * grid_size + x0].no);
- } else {
+ }
+ else {
copy_v3_v3(data[0], grid[y0 * grid_size + x0].co);
copy_v3_v3(data[1], grid[y0 * grid_size + x1].co);
copy_v3_v3(data[2], grid[y1 * grid_size + x1].co);
@@ -517,10 +522,11 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *orig
face_side= (grid_size<<1)-1;
- if(lvl==0) {
+ 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 {
+ }
+ else {
int side= (1 << (lvl-1)) + 1;
int grid_index= origindex[face_index];
int loc_offs= face_index % (1<<(2*lvl));
@@ -539,10 +545,10 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *orig
CLAMP(crn_x, 0.0f, grid_size);
CLAMP(crn_y, 0.0f, grid_size);
- if(n != NULL)
+ if (n != NULL)
interp_bilinear_grid(grid_data[g_index + S], grid_size, crn_x, crn_y, 0, n);
- if(co != NULL)
+ if (co != NULL)
interp_bilinear_grid(grid_data[g_index + S], grid_size, crn_x, crn_y, 1, co);
}
@@ -552,12 +558,13 @@ static void interp_bilinear_mface(DerivedMesh *dm, MFace *mface, const float u,
{
float data[4][3];
- if(mode == 0) {
+ if (mode == 0) {
dm->getVertNo(dm, mface->v1, data[0]);
dm->getVertNo(dm, mface->v2, data[1]);
dm->getVertNo(dm, mface->v3, data[2]);
dm->getVertNo(dm, mface->v4, data[3]);
- } else {
+ }
+ else {
dm->getVertCo(dm, mface->v1, data[0]);
dm->getVertCo(dm, mface->v2, data[1]);
dm->getVertCo(dm, mface->v3, data[2]);
@@ -573,11 +580,12 @@ static void interp_barycentric_mface(DerivedMesh *dm, MFace *mface, const float
{
float data[3][3];
- if(mode == 0) {
+ if (mode == 0) {
dm->getVertNo(dm, mface->v1, data[0]);
dm->getVertNo(dm, mface->v2, data[1]);
dm->getVertNo(dm, mface->v3, data[2]);
- } else {
+ }
+ else {
dm->getVertCo(dm, mface->v1, data[0]);
dm->getVertCo(dm, mface->v2, data[1]);
dm->getVertCo(dm, mface->v3, data[2]);
@@ -599,7 +607,7 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
height_data->height_max= -FLT_MAX;
height_data->height_min= FLT_MAX;
- if(!bkr->use_lores_mesh) {
+ if (!bkr->use_lores_mesh) {
SubsurfModifierData smd= {{NULL}};
int ss_lvl= bkr->tot_lvl - bkr->lvl;
@@ -608,7 +616,7 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
smd.levels= smd.renderLevels= ss_lvl;
smd.flags|= eSubsurfModifierFlag_SubsurfUv;
- if(bkr->simple)
+ if (bkr->simple)
smd.subdivType= ME_SIMPLE_SUBSURF;
height_data->ssdm= subsurf_make_derived_from_derived(bkr->lores_dm, &smd, 0, NULL, 0, 0, 0);
@@ -646,24 +654,25 @@ static void apply_heights_data(void *bake_data)
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++) {
+ 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) {
+ if (ibuf->rect_float) {
float *rrgbf= ibuf->rect_float + i*4;
- if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
+ if (max-min > 1e-5f) height= (heights[i]-min)/(max-min);
else height= 0;
rrgbf[0]=rrgbf[1]=rrgbf[2]= height;
- } else {
+ }
+ else {
char *rrgb= (char*)ibuf->rect + i*4;
- if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
+ if (max-min > 1e-5f) height= (heights[i]-min)/(max-min);
else height= 0;
rrgb[0]=rrgb[1]=rrgb[2]= FTOCHAR(height);
@@ -678,7 +687,7 @@ static void free_heights_data(void *bake_data)
{
MHeightBakeData *height_data= (MHeightBakeData*)bake_data;
- if(height_data->ssdm)
+ if (height_data->ssdm)
height_data->ssdm->release(height_data->ssdm);
MEM_freeN(height_data->heights);
@@ -710,10 +719,11 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
st1= mtface[face_index].uv[1];
st2= mtface[face_index].uv[2];
- if(mface.v4) {
+ if (mface.v4) {
st3= mtface[face_index].uv[3];
resolve_quad_uv(uv, st, st0, st1, st2, st3);
- } else
+ }
+ else
resolve_tri_uv(uv, st, st0, st1, st2);
CLAMP(uv[0], 0.0f, 1.0f);
@@ -721,15 +731,17 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
get_ccgdm_data(lores_dm, hires_dm, height_data->origindex, lvl, face_index, uv[0], uv[1], p1, 0);
- if(height_data->ssdm) {
+ if (height_data->ssdm) {
get_ccgdm_data(lores_dm, height_data->ssdm, height_data->origindex, 0, face_index, uv[0], uv[1], p0, n);
- } else {
+ }
+ else {
lores_dm->getTessFace(lores_dm, face_index, &mface);
- if(mface.v4) {
+ if (mface.v4) {
interp_bilinear_mface(lores_dm, &mface, uv[0], uv[1], 1, p0);
interp_bilinear_mface(lores_dm, &mface, uv[0], uv[1], 0, n);
- } else {
+ }
+ else {
interp_barycentric_mface(lores_dm, &mface, uv[0], uv[1], 1, p0);
interp_barycentric_mface(lores_dm, &mface, uv[0], uv[1], 0, n);
}
@@ -739,15 +751,16 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
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;
+ 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) {
+ if (ibuf->rect_float) {
float *rrgbf= ibuf->rect_float + pixel*4;
rrgbf[3]= 1.0f;
ibuf->userflags= IB_RECT_INVALID;
- } else {
+ }
+ else {
char *rrgb= (char*)ibuf->rect + pixel*4;
rrgb[3]= 255;
}
@@ -777,10 +790,11 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
st1= mtface[face_index].uv[1];
st2= mtface[face_index].uv[2];
- if(mface.v4) {
+ if (mface.v4) {
st3= mtface[face_index].uv[3];
resolve_quad_uv(uv, st, st0, st1, st2, st3);
- } else
+ }
+ else
resolve_tri_uv(uv, st, st0, st1, st2);
CLAMP(uv[0], 0.0f, 1.0f);
@@ -793,7 +807,7 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
mul_v3_fl(vec, 0.5);
add_v3_v3(vec, tmp);
- if(ibuf->rect_float) {
+ if (ibuf->rect_float) {
float *rrgbf= ibuf->rect_float + pixel*4;
rrgbf[0]= vec[0];
rrgbf[1]= vec[1];
@@ -801,7 +815,8 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
rrgbf[3]= 1.0f;
ibuf->userflags= IB_RECT_INVALID;
- } else {
+ }
+ else {
unsigned char *rrgb= (unsigned char *)ibuf->rect + pixel*4;
rgb_float_to_uchar(rrgb, vec);
rrgb[3]= 255;
@@ -819,12 +834,12 @@ static void count_images(MultiresBakeRender *bkr)
totface= dm->getNumTessFaces(dm);
- for(a= 0; a<totface; a++)
+ for (a= 0; a<totface; a++)
mtface[a].tpage->id.flag&= ~LIB_DOIT;
- for(a= 0; a<totface; a++) {
+ for (a= 0; a<totface; a++) {
Image *ima= mtface[a].tpage;
- if((ima->id.flag&LIB_DOIT)==0) {
+ if ((ima->id.flag&LIB_DOIT)==0) {
LinkData *data= BLI_genericNodeN(ima);
BLI_addtail(&bkr->image, data);
bkr->tot_image++;
@@ -832,7 +847,7 @@ static void count_images(MultiresBakeRender *bkr)
}
}
- for(a= 0; a<totface; a++)
+ for (a= 0; a<totface; a++)
mtface[a].tpage->id.flag&= ~LIB_DOIT;
}
@@ -840,11 +855,11 @@ static void bake_images(MultiresBakeRender *bkr)
{
LinkData *link;
- for(link= bkr->image.first; link; link= link->next) {
+ 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) {
ibuf->userdata= MEM_callocN(ibuf->y*ibuf->x, "MultiresBake imbuf mask");
switch(bkr->mode) {
@@ -866,26 +881,26 @@ static void finish_images(MultiresBakeRender *bkr)
{
LinkData *link;
- for(link= bkr->image.first; link; link= link->next) {
+ 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;
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
ibuf->userflags|= IB_RECT_INVALID;
- if(ibuf->mipmap[0]) {
+ if (ibuf->mipmap[0]) {
ibuf->userflags|= IB_MIPMAP_INVALID;
imb_freemipmapImBuf(ibuf);
}
- if(ibuf->userdata) {
+ if (ibuf->userdata) {
MEM_freeN(ibuf->userdata);
ibuf->userdata= NULL;
}
@@ -910,7 +925,7 @@ static int multiresbake_check(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
ob= base->object;
- if(ob->type != OB_MESH) {
+ 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;
@@ -921,25 +936,26 @@ static int multiresbake_check(bContext *C, wmOperator *op)
mmd= get_multires_modifier(scene, ob, 0);
/* Multi-resolution should be and be last in the stack */
- if(ok && mmd) {
+ if (ok && mmd) {
ModifierData *md;
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;
}
}
- } else ok= 0;
+ }
+ else ok= 0;
- if(!ok) {
+ if (!ok) {
BKE_report(op->reports, RPT_ERROR, "Multires data baking requires multi-resolution object");
break;
}
- if(!me->mtpoly) {
+ if (!me->mtpoly) {
BKE_report(op->reports, RPT_ERROR, "Mesh should be unwrapped before multires data baking");
ok= 0;
@@ -949,7 +965,7 @@ static int multiresbake_check(bContext *C, wmOperator *op)
while (ok && a--) {
Image *ima = me->mtpoly[a].tpage;
- if(!ima) {
+ if (!ima) {
BKE_report(op->reports, RPT_ERROR, "You should have active texture to use multires baker");
ok= 0;
@@ -957,25 +973,26 @@ static int multiresbake_check(bContext *C, wmOperator *op)
else {
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- if(!ibuf) {
+ if (!ibuf) {
BKE_report(op->reports, RPT_ERROR, "Baking should happend to image with image buffer");
ok= 0;
- } else {
- if(ibuf->rect==NULL && ibuf->rect_float==NULL)
+ }
+ else {
+ if (ibuf->rect==NULL && ibuf->rect_float==NULL)
ok= 0;
- if(ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
+ if (ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
ok= 0;
- if(!ok)
+ if (!ok)
BKE_report(op->reports, RPT_ERROR, "Baking to unsupported image type");
}
}
}
}
- if(!ok)
+ if (!ok)
break;
}
CTX_DATA_END;
@@ -991,17 +1008,18 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
*lvl= mmd->lvl;
- if(*lvl==0) {
+ if (*lvl==0) {
DerivedMesh *tmp_dm= CDDM_from_mesh(me, ob);
dm= CDDM_copy(tmp_dm);
tmp_dm->release(tmp_dm);
- } else {
+ }
+ else {
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, 0);
+ dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
cddm->release(cddm);
}
@@ -1021,7 +1039,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
tmp_mmd.lvl= mmd->totlvl;
tmp_mmd.sculptlvl= mmd->totlvl;
- dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0, 0);
+ dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
cddm->release(cddm);
return dm;
@@ -1033,13 +1051,13 @@ static void clear_images(MTFace *mtface, int totface)
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++)
+ for (a= 0; a<totface; a++)
mtface[a].tpage->id.flag&= ~LIB_DOIT;
- for(a= 0; a<totface; a++) {
+ for (a= 0; a<totface; a++) {
Image *ima= mtface[a].tpage;
- if((ima->id.flag&LIB_DOIT)==0) {
+ 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);
@@ -1047,7 +1065,7 @@ static void clear_images(MTFace *mtface, int totface)
}
}
- for(a= 0; a<totface; a++)
+ for (a= 0; a<totface; a++)
mtface[a].tpage->id.flag&= ~LIB_DOIT;
}
@@ -1057,10 +1075,10 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
int objects_baked= 0;
- if(!multiresbake_check(C, op))
+ if (!multiresbake_check(C, op))
return OPERATOR_CANCELLED;
- if(scene->r.bake_flag&R_BAKE_CLEAR) { /* clear images */
+ if (scene->r.bake_flag&R_BAKE_CLEAR) { /* clear images */
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
Mesh *me;
@@ -1087,7 +1105,7 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
/* create low-resolution DM (to bake to) and hi-resolution DM (to bake from) */
bkr.lores_dm= multiresbake_create_loresdm(scene, ob, &bkr.lvl);
- if(!bkr.lores_dm)
+ if (!bkr.lores_dm)
continue;
bkr.hires_dm= multiresbake_create_hiresdm(scene, ob, &bkr.tot_lvl, &bkr.simple);
@@ -1103,7 +1121,7 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- if(!objects_baked)
+ if (!objects_baked)
BKE_report(op->reports, RPT_ERROR, "No objects found to bake from");
return OPERATOR_FINISHED;
@@ -1130,7 +1148,7 @@ static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
multires_force_update(ob);
lores_dm = multiresbake_create_loresdm(scene, ob, &lvl);
- if(!lores_dm)
+ if (!lores_dm)
continue;
data= MEM_callocN(sizeof(MultiresBakerJobData), "multiresBaker derivedMesh_data");
@@ -1151,8 +1169,8 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa
tot_obj= BLI_countlist(&bkj->data);
- if(bkj->bake_clear) { /* clear images */
- for(data= bkj->data.first; data; data= data->next) {
+ 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);
@@ -1160,7 +1178,7 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa
}
}
- for(data= bkj->data.first; data; data= data->next) {
+ for (data= bkj->data.first; data; data= data->next) {
MultiresBakeRender bkr= {0};
/* copy data stored in job descriptor */
@@ -1214,13 +1232,13 @@ static int multiresbake_image_exec(bContext *C, wmOperator *op)
MultiresBakeJob *bkr;
wmJob *steve;
- if(!multiresbake_check(C, op))
+ if (!multiresbake_check(C, op))
return OPERATOR_CANCELLED;
bkr= MEM_callocN(sizeof(MultiresBakeJob), "MultiresBakeJob data");
init_multiresbake_job(C, bkr);
- if(!bkr->data.first) {
+ if (!bkr->data.first) {
BKE_report(op->reports, RPT_ERROR, "No objects found to bake from");
return OPERATOR_CANCELLED;
}
@@ -1278,10 +1296,10 @@ static int test_bake_internal(bContext *C, ReportList *reports)
{
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 {
@@ -1304,12 +1322,12 @@ static void init_bake_internal(BakeRender *bkr, bContext *C)
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;
}
@@ -1320,22 +1338,22 @@ 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->prev_wo_amb_occ == 0)
+ 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->prev_r_raytrace == 0)
+ 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) {
+ 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) {
+ if (ibuf) {
+ if (ibuf->userflags & IB_BITMAPDIRTY) {
GPU_free_image(ima);
imb_freemipmapImBuf(ibuf);
}
@@ -1384,9 +1402,9 @@ static void bake_update(void *bkv)
{
BakeRender *bkr= bkv;
- if(bkr->sa && bkr->sa->spacetype==SPACE_IMAGE) { /* in case the user changed while baking */
+ if (bkr->sa && bkr->sa->spacetype==SPACE_IMAGE) { /* in case the user changed while baking */
SpaceImage *sima= bkr->sa->spacedata.first;
- if(sima)
+ if (sima)
sima->image= RE_bake_shade_get_image();
}
}
@@ -1396,9 +1414,9 @@ static void bake_freejob(void *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);
@@ -1409,7 +1427,7 @@ 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)))
+ if (0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
/* running render */
@@ -1434,14 +1452,15 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
Scene *scene= CTX_data_scene(C);
int result= OPERATOR_CANCELLED;
- if(is_multires_bake(scene)) {
+ if (is_multires_bake(scene)) {
result= multiresbake_image_exec(C, op);
- } else {
+ }
+ else {
/* only one render job at a time */
- if(WM_jobs_test(CTX_wm_manager(C), scene))
+ 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 {
@@ -1483,10 +1502,11 @@ static int bake_image_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
int result= OPERATOR_CANCELLED;
- if(is_multires_bake(scene)) {
+ if (is_multires_bake(scene)) {
result= multiresbake_image_exec_locked(C, op);
- } else {
- if(test_bake_internal(C, op->reports)==0) {
+ }
+ else {
+ if (test_bake_internal(C, op->reports)==0) {
return OPERATOR_CANCELLED;
}
else {
@@ -1506,9 +1526,9 @@ static int bake_image_exec(bContext *C, wmOperator *op)
bkr.ready= 0;
BLI_insert_thread(&threads, &bkr);
- while(bkr.ready==0) {
+ while (bkr.ready==0) {
PIL_sleep_ms(50);
- if(bkr.ready)
+ if (bkr.ready)
break;
/* used to redraw in 2.4x but this is just for exec in 2.5 */
@@ -1517,9 +1537,9 @@ 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);
@@ -1536,12 +1556,12 @@ static int bake_image_exec(bContext *C, wmOperator *op)
void OBJECT_OT_bake_image(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Bake";
- ot->description= "Bake image textures of selected objects";
- ot->idname= "OBJECT_OT_bake_image";
+ ot->name = "Bake";
+ ot->description = "Bake image textures of selected objects";
+ ot->idname = "OBJECT_OT_bake_image";
/* api callbacks */
- ot->exec= bake_image_exec;
- ot->invoke= objects_bake_render_invoke;
- ot->modal= objects_bake_render_modal;
+ ot->exec = bake_image_exec;
+ ot->invoke = objects_bake_render_invoke;
+ ot->modal = objects_bake_render_modal;
}
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 774eec0e0a8..5b2aaf30897 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -142,6 +142,7 @@ bConstraint *get_active_constraint (Object *ob)
}
/* -------------- Constraint Management (Add New, Remove, Rename) -------------------- */
+#ifdef WITH_PYTHON
/* ------------- PyConstraints ------------------ */
/* this callback sets the text-file to be used for selected menu item */
@@ -160,7 +161,6 @@ static void validate_pyconstraint_cb (void *arg1, void *arg2)
data->text = text;
}
-#ifdef WITH_PYTHON
/* this returns a string for the list of usable pyconstraint script names */
static char *buildmenu_pyconstraints (Text *con_text, int *pyconindex)
{
@@ -405,17 +405,17 @@ 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->clip != NULL && data->track[0]) {
+ if ((data->flag&CAMERASOLVER_ACTIVECLIP)==0) {
+ if (data->clip != NULL && data->track[0]) {
MovieTracking *tracking= &data->clip->tracking;
MovieTrackingObject *tracking_object;
- if(data->object[0])
+ if (data->object[0])
tracking_object= BKE_tracking_named_object(tracking, data->object);
else
tracking_object= BKE_tracking_get_camera_object(tracking);
- if(!tracking_object) {
+ if (!tracking_object) {
curcon->flag |= CONSTRAINT_DISABLE;
}
else {
@@ -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;
}
@@ -644,16 +644,16 @@ static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
void CONSTRAINT_OT_stretchto_reset (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reset Original Length";
- ot->idname= "CONSTRAINT_OT_stretchto_reset";
- ot->description= "Reset original length of bone for Stretch To Constraint";
+ ot->name = "Reset Original Length";
+ ot->idname = "CONSTRAINT_OT_stretchto_reset";
+ ot->description = "Reset original length of bone for Stretch To Constraint";
- ot->exec= stretchto_reset_exec;
- ot->invoke= stretchto_reset_invoke;
- ot->poll= edit_constraint_poll;
+ ot->exec = stretchto_reset_exec;
+ ot->invoke = stretchto_reset_invoke;
+ ot->poll = edit_constraint_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -687,16 +687,16 @@ static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
void CONSTRAINT_OT_limitdistance_reset (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reset Distance";
- ot->idname= "CONSTRAINT_OT_limitdistance_reset";
- ot->description= "Reset limiting distance for Limit Distance Constraint";
+ ot->name = "Reset Distance";
+ ot->idname = "CONSTRAINT_OT_limitdistance_reset";
+ ot->description = "Reset limiting distance for Limit Distance Constraint";
- ot->exec= limitdistance_reset_exec;
- ot->invoke= limitdistance_reset_invoke;
- ot->poll= edit_constraint_poll;
+ ot->exec = limitdistance_reset_exec;
+ ot->invoke = limitdistance_reset_invoke;
+ ot->poll = edit_constraint_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -813,16 +813,16 @@ static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
void CONSTRAINT_OT_childof_set_inverse (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Inverse";
- ot->idname= "CONSTRAINT_OT_childof_set_inverse";
- ot->description= "Set inverse correction for ChildOf constraint";
+ ot->name = "Set Inverse";
+ ot->idname = "CONSTRAINT_OT_childof_set_inverse";
+ ot->description = "Set inverse correction for ChildOf constraint";
- ot->exec= childof_set_inverse_exec;
- ot->invoke= childof_set_inverse_invoke;
- ot->poll= edit_constraint_poll;
+ ot->exec = childof_set_inverse_exec;
+ ot->invoke = childof_set_inverse_invoke;
+ ot->poll = edit_constraint_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -833,7 +833,7 @@ static int childof_clear_inverse_exec (bContext *C, wmOperator *op)
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
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;
}
@@ -857,16 +857,16 @@ static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UN
void CONSTRAINT_OT_childof_clear_inverse (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Inverse";
- ot->idname= "CONSTRAINT_OT_childof_clear_inverse";
- ot->description= "Clear inverse correction for ChildOf constraint";
+ ot->name = "Clear Inverse";
+ ot->idname = "CONSTRAINT_OT_childof_clear_inverse";
+ ot->description = "Clear inverse correction for ChildOf constraint";
- ot->exec= childof_clear_inverse_exec;
- ot->invoke= childof_clear_inverse_invoke;
- ot->poll= edit_constraint_poll;
+ ot->exec = childof_clear_inverse_exec;
+ ot->invoke = childof_clear_inverse_invoke;
+ ot->poll = edit_constraint_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -904,16 +904,16 @@ static int objectsolver_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent
void CONSTRAINT_OT_objectsolver_set_inverse (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Inverse";
- ot->idname= "CONSTRAINT_OT_objectsolver_set_inverse";
- ot->description= "Set inverse correction for ObjectSolver constraint";
+ ot->name = "Set Inverse";
+ ot->idname = "CONSTRAINT_OT_objectsolver_set_inverse";
+ ot->description = "Set inverse correction for ObjectSolver constraint";
- ot->exec= objectsolver_set_inverse_exec;
- ot->invoke= objectsolver_set_inverse_invoke;
- ot->poll= edit_constraint_poll;
+ ot->exec = objectsolver_set_inverse_exec;
+ ot->invoke = objectsolver_set_inverse_invoke;
+ ot->poll = edit_constraint_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -923,7 +923,7 @@ static int objectsolver_clear_inverse_exec (bContext *C, wmOperator *op)
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
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;
}
@@ -947,16 +947,16 @@ static int objectsolver_clear_inverse_invoke(bContext *C, wmOperator *op, wmEven
void CONSTRAINT_OT_objectsolver_clear_inverse (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Inverse";
- ot->idname= "CONSTRAINT_OT_objectsolver_clear_inverse";
- ot->description= "Clear inverse correction for ObjectSolver constraint";
+ ot->name = "Clear Inverse";
+ ot->idname = "CONSTRAINT_OT_objectsolver_clear_inverse";
+ ot->description = "Clear inverse correction for ObjectSolver constraint";
- ot->exec= objectsolver_clear_inverse_exec;
- ot->invoke= objectsolver_clear_inverse_invoke;
- ot->poll= edit_constraint_poll;
+ ot->exec = objectsolver_clear_inverse_exec;
+ ot->invoke = objectsolver_clear_inverse_invoke;
+ ot->poll = edit_constraint_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -977,11 +977,11 @@ void ED_object_constraint_set_active(Object *ob, bConstraint *con)
void ED_object_constraint_update(Object *ob)
{
- if(ob->pose) update_pose_constraint_flags(ob->pose);
+ if (ob->pose) update_pose_constraint_flags(ob->pose);
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,7 +989,7 @@ 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);
}
@@ -1015,7 +1015,7 @@ static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
ED_object_constraint_update(ob); /* needed to set the flags on posebones correctly */
/* ITASC needs to be rebuilt once a constraint is removed [#26920] */
- if(is_ik) {
+ if (is_ik) {
BIK_clear_data(ob->pose);
}
@@ -1033,16 +1033,16 @@ static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
void CONSTRAINT_OT_delete (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Constraint";
- ot->idname= "CONSTRAINT_OT_delete";
- ot->description= "Remove constraint from constraint stack";
+ ot->name = "Delete Constraint";
+ ot->idname = "CONSTRAINT_OT_delete";
+ ot->description = "Remove constraint from constraint stack";
/* callbacks */
- ot->exec= constraint_delete_exec;
- ot->poll= constraint_poll;
+ ot->exec = constraint_delete_exec;
+ 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)
@@ -1078,17 +1078,17 @@ static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNU
void CONSTRAINT_OT_move_down (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Constraint Down";
- ot->idname= "CONSTRAINT_OT_move_down";
- ot->description= "Move constraint down in constraint stack";
+ ot->name = "Move Constraint Down";
+ ot->idname = "CONSTRAINT_OT_move_down";
+ ot->description = "Move constraint down in constraint stack";
/* callbacks */
- ot->exec= constraint_move_down_exec;
- ot->invoke= constraint_move_down_invoke;
- ot->poll= edit_constraint_poll;
+ ot->exec = constraint_move_down_exec;
+ ot->invoke = constraint_move_down_invoke;
+ ot->poll = edit_constraint_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -1125,17 +1125,17 @@ static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
void CONSTRAINT_OT_move_up (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Constraint Up";
- ot->idname= "CONSTRAINT_OT_move_up";
- ot->description= "Move constraint up in constraint stack";
+ ot->name = "Move Constraint Up";
+ ot->idname = "CONSTRAINT_OT_move_up";
+ ot->description = "Move constraint up in constraint stack";
/* callbacks */
- ot->exec= constraint_move_up_exec;
- ot->invoke= constraint_move_up_invoke;
- ot->poll= edit_constraint_poll;
+ ot->exec = constraint_move_up_exec;
+ ot->invoke = constraint_move_up_invoke;
+ ot->poll = edit_constraint_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -1160,7 +1160,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
/* force depsgraph to get recalculated since relationships removed */
DAG_scene_sort(bmain, scene); /* sort order of objects */
- /* note, calling BIK_clear_data() isnt needed here */
+ /* note, calling BIK_clear_data() isn't needed here */
/* do updates */
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -1173,12 +1173,12 @@ void POSE_OT_constraints_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Pose Constraints";
- ot->idname= "POSE_OT_constraints_clear";
- ot->description= "Clear all the constraints for the selected bones";
+ ot->idname = "POSE_OT_constraints_clear";
+ ot->description = "Clear all the constraints for the selected bones";
/* callbacks */
- ot->exec= pose_constraints_clear_exec;
- ot->poll= ED_operator_posemode; // XXX - do we want to ensure there are selected bones too?
+ ot->exec = pose_constraints_clear_exec;
+ ot->poll = ED_operator_posemode; // XXX - do we want to ensure there are selected bones too?
}
@@ -1208,12 +1208,12 @@ void OBJECT_OT_constraints_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Object Constraints";
- ot->idname= "OBJECT_OT_constraints_clear";
- ot->description= "Clear all the constraints for the active Object only";
+ ot->idname = "OBJECT_OT_constraints_clear";
+ ot->description = "Clear all the constraints for the active Object only";
/* callbacks */
- ot->exec= object_constraints_clear_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = object_constraints_clear_exec;
+ ot->poll = ED_operator_object_active_editable;
}
/************************ copy all constraints operators *********************/
@@ -1253,16 +1253,16 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
void POSE_OT_constraints_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Constraints to Selected";
- ot->idname= "POSE_OT_constraints_copy";
+ ot->name = "Copy Constraints to Selected";
+ ot->idname = "POSE_OT_constraints_copy";
ot->description = "Copy constraints to other selected bones";
/* api callbacks */
- ot->exec= pose_constraint_copy_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_constraint_copy_exec;
+ 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))
@@ -1294,16 +1294,16 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_constraints_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Constraints to Selected";
- ot->idname= "OBJECT_OT_constraints_copy";
+ ot->name = "Copy Constraints to Selected";
+ ot->idname = "OBJECT_OT_constraints_copy";
ot->description = "Copy constraints to other selected objects";
/* api callbacks */
- ot->exec= object_constraint_copy_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = object_constraint_copy_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ add constraint operators *********************/
@@ -1609,77 +1609,77 @@ static int pose_constraint_add_exec(bContext *C, wmOperator *op)
void OBJECT_OT_constraint_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Constraint";
+ ot->name = "Add Constraint";
ot->description = "Add a constraint to the active object";
- ot->idname= "OBJECT_OT_constraint_add";
+ ot->idname = "OBJECT_OT_constraint_add";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= object_constraint_add_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = object_constraint_add_exec;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
}
void OBJECT_OT_constraint_add_with_targets(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Constraint (with Targets)";
+ ot->name = "Add Constraint (with Targets)";
ot->description = "Add a constraint to the active object, with target (where applicable) set to the selected Objects/Bones";
- ot->idname= "OBJECT_OT_constraint_add_with_targets";
+ ot->idname = "OBJECT_OT_constraint_add_with_targets";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= object_constraint_add_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = object_constraint_add_exec;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
}
void POSE_OT_constraint_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Constraint";
+ ot->name = "Add Constraint";
ot->description = "Add a constraint to the active bone";
- ot->idname= "POSE_OT_constraint_add";
+ ot->idname = "POSE_OT_constraint_add";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= pose_constraint_add_exec;
- ot->poll= ED_operator_posemode;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = pose_constraint_add_exec;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
}
void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Constraint (with Targets)";
+ ot->name = "Add Constraint (with Targets)";
ot->description = "Add a constraint to the active bone, with target (where applicable) set to the selected Objects/Bones";
- ot->idname= "POSE_OT_constraint_add_with_targets";
+ ot->idname = "POSE_OT_constraint_add_with_targets";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= pose_constraint_add_exec;
- ot->poll= ED_operator_posemode;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = pose_constraint_add_exec;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
}
/************************ IK Constraint operators *********************/
@@ -1752,17 +1752,17 @@ static int pose_ik_add_exec(bContext *C, wmOperator *op)
void POSE_OT_ik_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add IK to Bone";
- ot->description= "Add IK Constraint to the active Bone";
- ot->idname= "POSE_OT_ik_add";
+ ot->name = "Add IK to Bone";
+ ot->description = "Add IK Constraint to the active Bone";
+ ot->idname = "POSE_OT_ik_add";
/* api callbacks */
- ot->invoke= pose_ik_add_invoke;
- ot->exec= pose_ik_add_exec;
- ot->poll= ED_operator_posemode;
+ ot->invoke = pose_ik_add_invoke;
+ ot->exec = pose_ik_add_exec;
+ 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");
@@ -1803,15 +1803,15 @@ static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op))
void POSE_OT_ik_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove IK";
- ot->description= "Remove all IK Constraints from selected bones";
- ot->idname= "POSE_OT_ik_clear";
+ ot->name = "Remove IK";
+ ot->description = "Remove all IK Constraints from selected bones";
+ ot->idname = "POSE_OT_ik_clear";
/* api callbacks */
- ot->exec= pose_ik_clear_exec;
- ot->poll= ED_operator_posemode;
+ ot->exec = pose_ik_clear_exec;
+ 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 e456e6f0796..09625e30eaf 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -121,7 +121,7 @@ Object *ED_object_context(bContext *C)
Object *ED_object_active_context(bContext *C)
{
Object *ob= NULL;
- if(C) {
+ if (C) {
ob= ED_object_context(C);
if (!ob) ob= CTX_data_active_object(C);
}
@@ -140,8 +140,8 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
int changed = 0;
/* XXX need a context loop to handle such cases */
- for(base = FIRSTBASE; base; base=base->next) {
- if((base->lay & v3d->lay) && base->object->restrictflag & OB_RESTRICT_VIEW) {
+ 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;
base->object->restrictflag &= ~OB_RESTRICT_VIEW;
@@ -161,16 +161,16 @@ void OBJECT_OT_hide_view_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Restrict View";
+ ot->name = "Clear Restrict View";
ot->description = "Reveal the object by setting the hide flag";
- ot->idname= "OBJECT_OT_hide_view_clear";
+ ot->idname = "OBJECT_OT_hide_view_clear";
/* api callbacks */
- ot->exec= object_hide_view_clear_exec;
- ot->poll= ED_operator_view3d_active;
+ ot->exec = object_hide_view_clear_exec;
+ 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)
@@ -181,7 +181,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
const int unselected= RNA_boolean_get(op->ptr, "unselected");
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if(!unselected) {
+ if (!unselected) {
if (base->flag & SELECT) {
base->flag &= ~SELECT;
base->object->flag = base->flag;
@@ -215,16 +215,16 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
void OBJECT_OT_hide_view_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Restrict View";
+ ot->name = "Set Restrict View";
ot->description = "Hide the object by setting the hide flag";
- ot->idname= "OBJECT_OT_hide_view_set";
+ ot->idname = "OBJECT_OT_hide_view_set";
/* api callbacks */
- ot->exec= object_hide_view_set_exec;
- ot->poll= ED_operator_view3d_active;
+ ot->exec = object_hide_view_set_exec;
+ 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");
@@ -237,14 +237,14 @@ static int object_hide_render_clear_exec(bContext *C, wmOperator *UNUSED(op))
/* XXX need a context loop to handle such cases */
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if(ob->restrictflag & OB_RESTRICT_RENDER) {
+ if (ob->restrictflag & OB_RESTRICT_RENDER) {
ob->restrictflag &= ~OB_RESTRICT_RENDER;
changed= 1;
}
}
CTX_DATA_END;
- if(changed)
+ if (changed)
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_OUTLINER, NULL);
return OPERATOR_FINISHED;
@@ -254,16 +254,16 @@ void OBJECT_OT_hide_render_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Restrict Render";
+ ot->name = "Clear Restrict Render";
ot->description = "Reveal the render object by setting the hide render flag";
- ot->idname= "OBJECT_OT_hide_render_clear";
+ ot->idname = "OBJECT_OT_hide_render_clear";
/* api callbacks */
- ot->exec= object_hide_render_clear_exec;
- ot->poll= ED_operator_view3d_active;
+ ot->exec = object_hide_render_clear_exec;
+ 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)
@@ -271,7 +271,7 @@ static int object_hide_render_set_exec(bContext *C, wmOperator *op)
const int unselected= RNA_boolean_get(op->ptr, "unselected");
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if(!unselected) {
+ if (!unselected) {
if (base->flag & SELECT) {
base->object->restrictflag |= OB_RESTRICT_RENDER;
}
@@ -290,16 +290,16 @@ static int object_hide_render_set_exec(bContext *C, wmOperator *op)
void OBJECT_OT_hide_render_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Restrict Render";
+ ot->name = "Set Restrict Render";
ot->description = "Hide the render object by setting the hide render flag";
- ot->idname= "OBJECT_OT_hide_render_set";
+ ot->idname = "OBJECT_OT_hide_render_set";
/* api callbacks */
- ot->exec= object_hide_render_set_exec;
- ot->poll= ED_operator_view3d_active;
+ ot->exec = object_hide_render_set_exec;
+ 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");
}
@@ -314,55 +314,55 @@ void ED_object_exit_editmode(bContext *C, int flag)
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) {
+ if (flag & EM_WAITCURSOR) waitcursor(1);
+ if (obedit->type==OB_MESH) {
Mesh *me= obedit->data;
-// if(EM_texFaceCheck())
+// 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;
}
EDBM_LoadEditBMesh(scene, obedit);
- if(freedata) {
+ if (freedata) {
EDBM_FreeEditBMesh(me->edit_btmesh);
MEM_freeN(me->edit_btmesh);
me->edit_btmesh= NULL;
}
- if(obedit->restore_mode & OB_MODE_WEIGHT_PAINT) {
+ 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) {
ED_armature_from_edit(obedit);
- if(freedata)
+ if (freedata)
ED_armature_edit_free(obedit);
}
- else if(ELEM(obedit->type, OB_CURVE, OB_SURF)) {
+ else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
load_editNurb(obedit);
- if(freedata) free_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);
+ 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);
+ 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);
+ if (freedata) free_editMball(obedit);
}
/* freedata only 0 now on file saves and render */
- if(freedata) {
+ if (freedata) {
ListBase pidlist;
PTCacheID *pid;
@@ -371,8 +371,8 @@ void ED_object_exit_editmode(bContext *C, int flag)
/* flag object caches as outdated */
BKE_ptcache_ids_from_object(&pidlist, obedit, NULL, 0);
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
+ 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;
}
BLI_freelistN(&pidlist);
@@ -382,10 +382,10 @@ void ED_object_exit_editmode(bContext *C, int flag)
/* 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);
- if(flag & EM_DO_UNDO)
+ if (flag & EM_DO_UNDO)
ED_undo_push(C, "Editmode");
- if(flag & EM_WAITCURSOR) waitcursor(0);
+ if (flag & EM_WAITCURSOR) waitcursor(0);
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
@@ -403,17 +403,17 @@ void ED_object_enter_editmode(bContext *C, int flag)
View3D *v3d= NULL;
int ok= 0;
- if(scene->id.lib) return;
+ if (scene->id.lib) return;
- if(sa && sa->spacetype==SPACE_VIEW3D)
+ if (sa && sa->spacetype==SPACE_VIEW3D)
v3d= sa->spacedata.first;
- if((flag & EM_IGNORE_LAYER)==0) {
+ 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;
@@ -428,18 +428,18 @@ void ED_object_enter_editmode(bContext *C, int flag)
return;
}
- if(flag & EM_WAITCURSOR) waitcursor(1);
+ if (flag & EM_WAITCURSOR) waitcursor(1);
ob->restore_mode = ob->mode;
/* 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;
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
ok= 1;
scene->obedit= ob; // context sees this
@@ -458,7 +458,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
* object_data_is_libdata that prevent the bugfix #6614, so
* i add this little hack here.
*/
- if(arm->id.lib) {
+ if (arm->id.lib) {
error_libdata();
return;
}
@@ -470,28 +470,28 @@ void ED_object_enter_editmode(bContext *C, int flag)
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_ARMATURE, scene);
}
- else if(ob->type==OB_FONT) {
+ 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);
}
- else if(ob->type==OB_MBALL) {
+ 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);
}
- else if(ob->type==OB_LATTICE) {
+ 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);
}
- else if(ob->type==OB_SURF || ob->type==OB_CURVE) {
+ else if (ob->type==OB_SURF || ob->type==OB_CURVE) {
ok= 1;
scene->obedit= ob; // XXX for context
make_editNurb(ob);
@@ -499,7 +499,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_CURVE, scene);
}
- if(ok) {
+ if (ok) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else {
@@ -508,15 +508,15 @@ void ED_object_enter_editmode(bContext *C, int flag)
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
}
- if(flag & EM_DO_UNDO) ED_undo_push(C, "Enter Editmode");
- if(flag & EM_WAITCURSOR) waitcursor(0);
+ if (flag & EM_DO_UNDO) ED_undo_push(C, "Enter Editmode");
+ if (flag & EM_WAITCURSOR) waitcursor(0);
}
static int editmode_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
ToolSettings *toolsettings = CTX_data_tool_settings(C);
- if(!CTX_data_edit_object(C))
+ 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] */
@@ -531,7 +531,7 @@ static int editmode_toggle_poll(bContext *C)
Object *ob = CTX_data_active_object(C);
/* covers proxies too */
- if(ELEM(NULL, ob, ob->data) || ((ID *)ob->data)->lib)
+ if (ELEM(NULL, ob, ob->data) || ((ID *)ob->data)->lib)
return 0;
if (ob->restrictflag & OB_RESTRICT_VIEW)
@@ -547,17 +547,17 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Editmode";
+ ot->name = "Toggle Editmode";
ot->description = "Toggle object's editmode";
- ot->idname= "OBJECT_OT_editmode_toggle";
+ ot->idname = "OBJECT_OT_editmode_toggle";
/* api callbacks */
- ot->exec= editmode_toggle_exec;
+ ot->exec = editmode_toggle_exec;
- ot->poll= editmode_toggle_poll;
+ ot->poll = editmode_toggle_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* *************************** */
@@ -566,12 +566,12 @@ static int posemode_exec(bContext *C, wmOperator *UNUSED(op))
{
Base *base= CTX_data_active_base(C);
- if(base->object->type==OB_ARMATURE) {
- if(base->object==CTX_data_edit_object(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);
ED_armature_enter_posemode(C, base);
}
- else if(base->object->mode & OB_MODE_POSE)
+ else if (base->object->mode & OB_MODE_POSE)
ED_armature_exit_posemode(C, base);
else
ED_armature_enter_posemode(C, base);
@@ -585,16 +585,16 @@ static int posemode_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_posemode_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Pose Mode";
- ot->idname= "OBJECT_OT_posemode_toggle";
- ot->description= "Enable or disable posing/selecting bones";
+ ot->name = "Toggle Pose Mode";
+ ot->idname = "OBJECT_OT_posemode_toggle";
+ ot->description = "Enable or disable posing/selecting bones";
/* api callbacks */
- ot->exec= posemode_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = posemode_exec;
+ 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)
@@ -606,7 +606,7 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
char *str;
prop= ob->prop.first;
- while(prop) {
+ while (prop) {
tot++;
prop= prop->next;
}
@@ -620,7 +620,7 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
tot= 0;
prop= ob->prop.first;
- while(prop) {
+ while (prop) {
tot++;
strcat(str, "|");
strcat(str, prop->name);
@@ -630,23 +630,25 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
nr= pupmenu(str);
if ( nr==1 || nr==2 ) {
- 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))) {
if (nr==1) { /* replace */
copy_properties( &base->object->prop, &ob->prop );
- } else {
- for(prop = ob->prop.first; prop; prop= prop->next ) {
+ }
+ else {
+ for (prop = ob->prop.first; prop; prop= prop->next ) {
set_ob_property(base->object, prop);
}
}
}
}
- } else if(nr>0) {
+ }
+ 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))) {
+ if (prop) {
+ for (base= FIRSTBASE; base; base= base->next) {
+ if ((base != BASACT) &&(TESTBASELIB(v3d, base))) {
set_ob_property(base->object, prop);
}
}
@@ -661,9 +663,9 @@ 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) {
- if(base->object != ob) {
- if(TESTBASELIB(v3d, base)) {
+ for (base= FIRSTBASE; base; base= base->next) {
+ if (base->object != ob) {
+ if (TESTBASELIB(v3d, base)) {
/* first: free all logic */
free_sensors(&base->object->sensors);
@@ -697,7 +699,7 @@ static void copy_texture_space(Object *to, Object *ob)
float *poin1= NULL, *poin2= NULL;
short texflag= 0;
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
texflag= ((Mesh *)ob->data)->texflag;
poin2= ((Mesh *)ob->data)->loc;
}
@@ -705,14 +707,14 @@ static void copy_texture_space(Object *to, Object *ob)
texflag= ((Curve *)ob->data)->texflag;
poin2= ((Curve *)ob->data)->loc;
}
- else if(ob->type==OB_MBALL) {
+ else if (ob->type==OB_MBALL) {
texflag= ((MetaBall *)ob->data)->texflag;
poin2= ((MetaBall *)ob->data)->loc;
}
else
return;
- if(to->type==OB_MESH) {
+ if (to->type==OB_MESH) {
((Mesh *)to->data)->texflag= texflag;
poin1= ((Mesh *)to->data)->loc;
}
@@ -720,7 +722,7 @@ static void copy_texture_space(Object *to, Object *ob)
((Curve *)to->data)->texflag= texflag;
poin1= ((Curve *)to->data)->loc;
}
- else if(to->type==OB_MBALL) {
+ else if (to->type==OB_MBALL) {
((MetaBall *)to->data)->texflag= texflag;
poin1= ((MetaBall *)to->data)->loc;
}
@@ -729,7 +731,7 @@ static void copy_texture_space(Object *to, Object *ob)
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) {
@@ -750,58 +752,58 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
Nurb *nu;
int do_scene_sort= 0;
- if(scene->id.lib) return;
+ if (scene->id.lib) return;
- if(!(ob=OBACT)) return;
+ if (!(ob=OBACT)) return;
- if(scene->obedit) { // XXX get from context
+ 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) {
- if(base != BASACT) {
- if(TESTBASELIB(v3d, base)) {
+ 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 */
+ 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 */
+ else if (event==5) { /* time offs */
base->object->sf= ob->sf;
}
- else if(event==6) { /* dupli */
+ else if (event==6) { /* dupli */
base->object->dupon= ob->dupon;
base->object->dupoff= ob->dupoff;
base->object->dupsta= ob->dupsta;
@@ -811,17 +813,17 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
base->object->transflag |= (ob->transflag & OB_DUPLI);
base->object->dup_group= ob->dup_group;
- if(ob->dup_group)
+ if (ob->dup_group)
id_lib_extern(&ob->dup_group->id);
}
- else if(event==7) { /* mass */
+ else if (event==7) { /* mass */
base->object->mass= ob->mass;
}
- else if(event==8) { /* damping */
+ 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;
@@ -836,12 +838,12 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
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) {
+ if (base->object->type==ob->type) {
cu= ob->data;
cu1= base->object->data;
@@ -856,16 +858,16 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
cu1->wordspace= cu->wordspace;
cu1->ulpos= cu->ulpos;
cu1->ulheight= cu->ulheight;
- if(cu1->vfont) cu1->vfont->id.us--;
+ if (cu1->vfont) cu1->vfont->id.us--;
cu1->vfont= cu->vfont;
id_us_plus((ID *)cu1->vfont);
- if(cu1->vfontb) cu1->vfontb->id.us--;
+ if (cu1->vfontb) cu1->vfontb->id.us--;
cu1->vfontb= cu->vfontb;
id_us_plus((ID *)cu1->vfontb);
- if(cu1->vfonti) cu1->vfonti->id.us--;
+ if (cu1->vfonti) cu1->vfonti->id.us--;
cu1->vfonti= cu->vfonti;
id_us_plus((ID *)cu1->vfonti);
- if(cu1->vfontbi) cu1->vfontbi->id.us--;
+ if (cu1->vfontbi) cu1->vfontbi->id.us--;
cu1->vfontbi= cu->vfontbi;
id_us_plus((ID *)cu1->vfontbi);
@@ -877,9 +879,9 @@ 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)) {
+ if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
cu= ob->data;
cu1= base->object->data;
@@ -893,9 +895,9 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
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)) {
+ if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
cu= ob->data;
cu1= base->object->data;
@@ -904,7 +906,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
nu= cu1->nurb.first;
- while(nu) {
+ while (nu) {
nu->resolu= cu1->resolu;
nu= nu->next;
}
@@ -912,7 +914,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
base->object->recalc |= OB_RECALC_DATA;
}
}
- else if(event==21) {
+ else if (event==21) {
if (base->object->type==OB_MESH) {
ModifierData *md = modifiers_findByType(ob, eModifierType_Subsurf);
@@ -929,15 +931,15 @@ 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;
}
- else if(event==23) {
+ else if (event==23) {
base->object->softflag= ob->softflag;
- if(base->object->soft) sbFree(base->object->soft);
+ if (base->object->soft) sbFree(base->object->soft);
base->object->soft= copy_softbody(ob->soft);
@@ -945,47 +947,47 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
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 */
+ 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)
+ if (me->flag & ME_AUTOSMOOTH)
cme->flag |= ME_AUTOSMOOTH;
else
cme->flag &= ~ME_AUTOSMOOTH;
}
}
- else if(event==28) { /* UV orco */
- if(ELEM(base->object->type, OB_CURVE, OB_SURF)) {
+ else if (event==28) { /* UV orco */
+ if (ELEM(base->object->type, OB_CURVE, OB_SURF)) {
cu= ob->data;
cu1= base->object->data;
- if(cu->flag & CU_UV_ORCO)
+ if (cu->flag & CU_UV_ORCO)
cu1->flag |= CU_UV_ORCO;
else
cu1->flag &= ~CU_UV_ORCO;
}
}
- else if(event==29) { /* protected bits */
+ else if (event==29) { /* protected bits */
base->object->protectflag= ob->protectflag;
}
- else if(event==30) { /* index object */
+ 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);
}
}
}
}
- if(do_scene_sort)
+ if (do_scene_sort)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
@@ -997,7 +999,7 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
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)
@@ -1023,27 +1025,27 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
// strcat(str, "|Texture Space%x17");
// }
- if(ob->type == OB_FONT) strcat(str, "|Font Settings%x18|Bevel Settings%x19");
- if(ob->type == OB_CURVE) strcat(str, "|Bevel Settings%x19|UV Orco%x28");
+ if (ob->type == OB_FONT) strcat(str, "|Font Settings%x18|Bevel Settings%x19");
+ if (ob->type == OB_CURVE) strcat(str, "|Bevel Settings%x19|UV Orco%x28");
- if((ob->type == OB_FONT) || (ob->type == OB_CURVE)) {
+ if ((ob->type == OB_FONT) || (ob->type == OB_CURVE)) {
strcat(str, "|Curve Resolution%x25");
}
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
strcat(str, "|Subsurf Settings%x21|AutoSmooth%x27");
}
- if(ob->soft) strcat(str, "|Soft Body Settings%x23");
+ if (ob->soft) strcat(str, "|Soft Body Settings%x23");
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;
+ if (event<= 0) return;
copy_attr(bmain, scene, v3d, event);
}
@@ -1054,10 +1056,10 @@ static int forcefield_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_active_object(C);
- if(ob->pd == NULL)
+ if (ob->pd == NULL)
ob->pd = object_add_collision_fields(PFIELD_FORCE);
- if(ob->pd->forcefield == 0)
+ if (ob->pd->forcefield == 0)
ob->pd->forcefield = PFIELD_FORCE;
else
ob->pd->forcefield = 0;
@@ -1071,16 +1073,16 @@ void OBJECT_OT_forcefield_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Force Field";
+ ot->name = "Toggle Force Field";
ot->description = "Toggle object's force field";
- ot->idname= "OBJECT_OT_forcefield_toggle";
+ ot->idname = "OBJECT_OT_forcefield_toggle";
/* api callbacks */
- ot->exec= forcefield_toggle_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = forcefield_toggle_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ********************************************** */
@@ -1137,16 +1139,16 @@ static int object_calculate_paths_exec (bContext *C, wmOperator *op)
void OBJECT_OT_paths_calculate (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Calculate Object Paths";
- ot->idname= "OBJECT_OT_paths_calculate";
- ot->description= "Calculate paths for the selected bones";
+ ot->name = "Calculate Object Paths";
+ ot->idname = "OBJECT_OT_paths_calculate";
+ ot->description = "Calculate paths for the selected bones";
/* api callbacks */
- ot->exec= object_calculate_paths_exec;
- ot->poll= ED_operator_object_active_editable;
+ 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;
}
/* --------- */
@@ -1181,13 +1183,13 @@ static int object_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_paths_clear (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Object Paths";
- ot->idname= "OBJECT_OT_paths_clear";
- ot->description= "Clear path caches for selected bones";
+ ot->name = "Clear Object Paths";
+ ot->idname = "OBJECT_OT_paths_clear";
+ ot->description = "Clear path caches for selected bones";
/* api callbacks */
- ot->exec= object_clear_paths_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = object_clear_paths_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1205,7 +1207,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
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);
@@ -1216,8 +1218,8 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
else if ELEM(ob->type, OB_SURF, OB_CURVE) {
cu= ob->data;
- for(nu=cu->nurb.first; nu; nu=nu->next) {
- if(!clear) nu->flag |= ME_SMOOTH;
+ for (nu=cu->nurb.first; nu; nu=nu->next) {
+ if (!clear) nu->flag |= ME_SMOOTH;
else nu->flag &= ~ME_SMOOTH;
}
@@ -1240,31 +1242,31 @@ static int shade_poll(bContext *C)
void OBJECT_OT_shade_flat(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Shade Flat";
- ot->description= "Display faces 'flat'";
- ot->idname= "OBJECT_OT_shade_flat";
+ ot->name = "Shade Flat";
+ ot->description = "Display faces 'flat'";
+ ot->idname = "OBJECT_OT_shade_flat";
/* api callbacks */
- ot->poll= shade_poll;
- ot->exec= shade_smooth_exec;
+ ot->poll = shade_poll;
+ 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)
{
/* identifiers */
- ot->name= "Shade Smooth";
- ot->description= "Display faces 'smooth' (using vertex normals)";
- ot->idname= "OBJECT_OT_shade_smooth";
+ ot->name = "Shade Smooth";
+ ot->description = "Display faces 'smooth' (using vertex normals)";
+ ot->idname = "OBJECT_OT_shade_smooth";
/* api callbacks */
- ot->poll= shade_poll;
- ot->exec= shade_smooth_exec;
+ ot->poll = shade_poll;
+ ot->exec = shade_smooth_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ********************** */
@@ -1279,31 +1281,31 @@ 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->id.lib) return;
+ if (scene->obedit) return; // XXX get from context
+ if (scene->id.lib) return;
- for(base= FIRSTBASE; base; base= base->next) {
- if(TESTBASELIB(v3d, base)) {
+ for (base= FIRSTBASE; base; base= base->next) {
+ if (TESTBASELIB(v3d, base)) {
ob= base->object;
done= 0;
- for(a=1; a<=ob->totcol; a++) {
+ for (a=1; a<=ob->totcol; a++) {
ma= give_current_material(ob, a);
- if(ma) {
- for(b=0; b<MAX_MTEX; b++) {
- if(ma->mtex[b] && ma->mtex[b]->tex) {
+ if (ma) {
+ 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) {
+ 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) {
+ if (ob->type==OB_MESH) {
float size[3];
mesh_get_texspace(ob->data, NULL, NULL, size);
space= size[0]/size[1];
}
- else if(ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
+ else if (ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
Curve *cu= ob->data;
space= cu->size[0]/cu->size[1];
}
@@ -1311,17 +1313,17 @@ static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d)
x= ibuf->x/space;
y= ibuf->y;
- if(x>y) ob->size[0]= ob->size[1]*x/y;
+ if (x>y) ob->size[0]= ob->size[1]*x/y;
else ob->size[1]= ob->size[0]*y/x;
done= 1;
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
}
- if(done) break;
+ if (done) break;
}
}
- if(done) break;
+ if (done) break;
}
}
}
@@ -1336,12 +1338,12 @@ static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(
Object *ob;
int totitem= 0;
- if(!C) /* needed for docs */
+ if (!C) /* needed for docs */
return object_mode_items;
ob = CTX_data_active_object(C);
- while(ob && input->identifier) {
- if((input->value == OB_MODE_EDIT && ((ob->type == OB_MESH) || (ob->type == OB_ARMATURE) ||
+ while (ob && input->identifier) {
+ if ((input->value == OB_MODE_EDIT && ((ob->type == OB_MESH) || (ob->type == OB_ARMATURE) ||
(ob->type == OB_CURVE) || (ob->type == OB_SURF) ||
(ob->type == OB_FONT) || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) ||
(input->value == OB_MODE_POSE && (ob->type == OB_ARMATURE)) ||
@@ -1362,19 +1364,19 @@ static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(
static const char *object_mode_op_string(int mode)
{
- if(mode & OB_MODE_EDIT)
+ if (mode & OB_MODE_EDIT)
return "OBJECT_OT_editmode_toggle";
- if(mode == OB_MODE_SCULPT)
+ if (mode == OB_MODE_SCULPT)
return "SCULPT_OT_sculptmode_toggle";
- if(mode == OB_MODE_VERTEX_PAINT)
+ if (mode == OB_MODE_VERTEX_PAINT)
return "PAINT_OT_vertex_paint_toggle";
- if(mode == OB_MODE_WEIGHT_PAINT)
+ if (mode == OB_MODE_WEIGHT_PAINT)
return "PAINT_OT_weight_paint_toggle";
- if(mode == OB_MODE_TEXTURE_PAINT)
+ if (mode == OB_MODE_TEXTURE_PAINT)
return "PAINT_OT_texture_paint_toggle";
- if(mode == OB_MODE_PARTICLE_EDIT)
+ if (mode == OB_MODE_PARTICLE_EDIT)
return "PARTICLE_OT_particle_edit_toggle";
- if(mode == OB_MODE_POSE)
+ if (mode == OB_MODE_POSE)
return "OBJECT_OT_posemode_toggle";
return NULL;
}
@@ -1385,27 +1387,27 @@ static int object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *o
{
ObjectMode mode = RNA_enum_get(op->ptr, "mode");
- if(ob) {
- if(mode == OB_MODE_OBJECT)
+ if (ob) {
+ 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))
+ 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))
+ if (mode & (OB_MODE_EDIT))
return 1;
return 0;
case OB_LATTICE:
- if(mode & (OB_MODE_EDIT|OB_MODE_WEIGHT_PAINT))
+ if (mode & (OB_MODE_EDIT|OB_MODE_WEIGHT_PAINT))
return 1;
case OB_ARMATURE:
- if(mode & (OB_MODE_EDIT|OB_MODE_POSE))
+ if (mode & (OB_MODE_EDIT|OB_MODE_POSE))
return 1;
}
}
@@ -1420,23 +1422,23 @@ static int object_mode_set_exec(bContext *C, wmOperator *op)
ObjectMode restore_mode = (ob) ? ob->mode : OB_MODE_OBJECT;
int toggle = RNA_boolean_get(op->ptr, "toggle");
- if(!ob || !object_mode_set_compat(C, op, ob))
+ if (!ob || !object_mode_set_compat(C, op, ob))
return OPERATOR_PASS_THROUGH;
/* Exit current mode if it's not the mode we're setting */
- if(ob->mode != OB_MODE_OBJECT && ob->mode != mode)
+ if (ob->mode != OB_MODE_OBJECT && ob->mode != mode)
WM_operator_name_call(C, object_mode_op_string(ob->mode), WM_OP_EXEC_REGION_WIN, NULL);
- if(mode != OB_MODE_OBJECT) {
+ if (mode != OB_MODE_OBJECT) {
/* Enter new mode */
- if(ob->mode != mode || toggle)
+ if (ob->mode != mode || toggle)
WM_operator_name_call(C, object_mode_op_string(mode), WM_OP_EXEC_REGION_WIN, NULL);
- if(toggle) {
- if(ob->mode == mode)
+ if (toggle) {
+ if (ob->mode == mode)
/* For toggling, store old mode so we know what to go back to */
ob->restore_mode = restore_mode;
- else if(ob->restore_mode != OB_MODE_OBJECT && ob->restore_mode != mode) {
+ else if (ob->restore_mode != OB_MODE_OBJECT && ob->restore_mode != mode) {
WM_operator_name_call(C, object_mode_op_string(ob->restore_mode), WM_OP_EXEC_REGION_WIN, NULL);
}
}
@@ -1450,17 +1452,17 @@ void OBJECT_OT_mode_set(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Set Object Mode";
+ ot->name = "Set Object Mode";
ot->description = "Sets the object interaction mode";
- ot->idname= "OBJECT_OT_mode_set";
+ ot->idname = "OBJECT_OT_mode_set";
/* api callbacks */
- ot->exec= object_mode_set_exec;
+ ot->exec = object_mode_set_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= 0; /* no register/undo here, leave it to operators being called */
+ 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", "");
RNA_def_enum_funcs(prop, object_mode_set_itemsf);
@@ -1472,19 +1474,19 @@ void OBJECT_OT_mode_set(wmOperatorType *ot)
void ED_object_toggle_modes(bContext *C, int mode)
{
- if(mode & OB_MODE_SCULPT)
+ if (mode & OB_MODE_SCULPT)
WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if(mode & OB_MODE_VERTEX_PAINT)
+ if (mode & OB_MODE_VERTEX_PAINT)
WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if(mode & OB_MODE_WEIGHT_PAINT)
+ if (mode & OB_MODE_WEIGHT_PAINT)
WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if(mode & OB_MODE_TEXTURE_PAINT)
+ if (mode & OB_MODE_TEXTURE_PAINT)
WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if(mode & OB_MODE_PARTICLE_EDIT)
+ if (mode & OB_MODE_PARTICLE_EDIT)
WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if(mode & OB_MODE_POSE)
+ if (mode & OB_MODE_POSE)
WM_operator_name_call(C, "OBJECT_OT_posemode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if(mode & OB_MODE_EDIT)
+ if (mode & OB_MODE_EDIT)
WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
}
@@ -1515,16 +1517,16 @@ static int game_property_new(bContext *C, wmOperator *op)
void OBJECT_OT_game_property_new(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "New Game Property";
- ot->description= "Create a new property available to the game engine";
- ot->idname= "OBJECT_OT_game_property_new";
+ ot->name = "New Game Property";
+ ot->description = "Create a new property available to the game engine";
+ ot->idname = "OBJECT_OT_game_property_new";
/* api callbacks */
- ot->exec= game_property_new;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = game_property_new;
+ 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");
@@ -1536,12 +1538,12 @@ static int game_property_remove(bContext *C, wmOperator *op)
bProperty *prop;
int index= RNA_int_get(op->ptr, "index");
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
prop= BLI_findlink(&ob->prop, index);
- if(prop) {
+ if (prop) {
BLI_remlink(&ob->prop, prop);
free_property(prop);
@@ -1556,16 +1558,16 @@ static int game_property_remove(bContext *C, wmOperator *op)
void OBJECT_OT_game_property_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Game Property";
- ot->description= "Remove game property";
- ot->idname= "OBJECT_OT_game_property_remove";
+ ot->name = "Remove Game Property";
+ ot->description = "Remove game property";
+ ot->idname = "OBJECT_OT_game_property_remove";
/* api callbacks */
- ot->exec= game_property_remove;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = game_property_remove;
+ 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);
}
@@ -1591,10 +1593,10 @@ static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), P
bProperty *prop;
int a, totitem= 0;
- if(!ob)
+ if (!ob)
return gameprops_items;
- for(a=1, prop= ob->prop.first; prop; prop=prop->next, a++) {
+ for (a=1, prop= ob->prop.first; prop; prop=prop->next, a++) {
tmp.value= a;
tmp.identifier= prop->name;
tmp.name= prop->name;
@@ -1614,10 +1616,10 @@ static int game_property_copy_exec(bContext *C, wmOperator *op)
int type = RNA_enum_get(op->ptr, "operation");
int propid= RNA_enum_get(op->ptr, "property");
- if(propid > 0) { /* copy */
+ if (propid > 0) { /* copy */
prop = BLI_findlink(&ob->prop, propid-1);
- if(prop) {
+ if (prop) {
CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
if (ob != ob_iter)
set_ob_property(ob_iter, prop);
@@ -1633,7 +1635,7 @@ static int game_property_copy_exec(bContext *C, wmOperator *op)
/* 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);
}
}
@@ -1647,20 +1649,20 @@ void OBJECT_OT_game_property_copy(wmOperatorType *ot)
{
PropertyRNA *prop;
/* identifiers */
- ot->name= "Copy Game Property";
- ot->idname= "OBJECT_OT_game_property_copy";
+ ot->name = "Copy Game Property";
+ ot->idname = "OBJECT_OT_game_property_copy";
/* api callbacks */
- ot->exec= game_property_copy_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = game_property_copy_exec;
+ 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");
RNA_def_enum_funcs(prop, gameprops_itemf);
- ot->prop=prop;
+ ot->prop = prop;
}
static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1676,15 +1678,15 @@ static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_game_property_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Game Property";
- ot->idname= "OBJECT_OT_game_property_clear";
+ ot->name = "Clear Game Property";
+ ot->idname = "OBJECT_OT_game_property_clear";
/* api callbacks */
- ot->exec= game_property_clear_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = game_property_clear_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ Copy Logic Bricks ***********************/
@@ -1694,7 +1696,7 @@ static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob=ED_object_active_context(C);
CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
- if(ob != ob_iter) {
+ if (ob != ob_iter) {
/* first: free all logic */
free_sensors(&ob_iter->sensors);
unlink_controllers(&ob_iter->controllers);
@@ -1717,7 +1719,7 @@ static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
ob_iter->state= ob->state;
ob_iter->init_state= ob->init_state;
- if(ob_iter->totcol==ob->totcol) {
+ if (ob_iter->totcol==ob->totcol) {
ob_iter->actcol= ob->actcol;
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob_iter);
}
@@ -1733,16 +1735,16 @@ static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Logic Bricks to Selected";
+ ot->name = "Copy Logic Bricks to Selected";
ot->description = "Copy logic bricks to other selected objects";
- ot->idname= "OBJECT_OT_logic_bricks_copy";
+ ot->idname = "OBJECT_OT_logic_bricks_copy";
/* api callbacks */
- ot->exec= logicbricks_copy_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = logicbricks_copy_exec;
+ 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))
@@ -1750,7 +1752,7 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob=ED_object_active_context(C);
CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
- if(ob != ob_iter) {
+ if (ob != ob_iter) {
ob_iter->gameflag = ob->gameflag;
ob_iter->gameflag2 = ob->gameflag2;
ob_iter->inertia = ob->inertia;
@@ -1767,7 +1769,7 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
ob_iter->collision_boundtype = ob->collision_boundtype;
ob_iter->margin = ob->margin;
ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft);
- if(ob->restrictflag & OB_RESTRICT_RENDER)
+ if (ob->restrictflag & OB_RESTRICT_RENDER)
ob_iter->restrictflag |= OB_RESTRICT_RENDER;
else
ob_iter->restrictflag &= ~OB_RESTRICT_RENDER;
@@ -1781,14 +1783,14 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Game Physics Properties to Selected";
+ ot->name = "Copy Game Physics Properties to Selected";
ot->description = "Copy game physics properties to other selected objects";
- ot->idname= "OBJECT_OT_game_physics_copy";
+ ot->idname = "OBJECT_OT_game_physics_copy";
/* api callbacks */
- ot->exec= game_physics_copy_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = game_physics_copy_exec;
+ 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 d5dfbda8696..34410b87e79 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -67,13 +67,13 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
Group *group;
int ok = 0;
- if(!ob) return OPERATOR_CANCELLED;
+ if (!ob) return OPERATOR_CANCELLED;
/* 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) {
- if(object_in_group(ob, group)) {
+ 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) {
add_to_group(group, base->object, scene, base);
@@ -83,7 +83,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
}
}
- if(!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups");
+ 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);
@@ -94,16 +94,16 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
void GROUP_OT_objects_add_active(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Selected To Active Group";
+ ot->name = "Add Selected To Active Group";
ot->description = "Add the object to an object group that contains the active object";
- ot->idname= "GROUP_OT_objects_add_active";
+ ot->idname = "GROUP_OT_objects_add_active";
/* api callbacks */
- ot->exec= objects_add_active_exec;
- ot->poll= ED_operator_objectmode;
+ ot->exec = objects_add_active_exec;
+ 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)
@@ -114,13 +114,13 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
Group *group;
int ok = 0;
- if(!ob) return OPERATOR_CANCELLED;
+ if (!ob) return OPERATOR_CANCELLED;
/* 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) {
- if(object_in_group(ob, group)) {
+ 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) {
rem_from_group(group, base->object, scene, base);
@@ -130,7 +130,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
}
}
- if(!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups");
+ 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);
@@ -141,16 +141,16 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
void GROUP_OT_objects_remove_active(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Selected From Active Group";
+ ot->name = "Remove Selected From Active Group";
ot->description = "Remove the object from an object group that contains the active object";
- ot->idname= "GROUP_OT_objects_remove_active";
+ ot->idname = "GROUP_OT_objects_remove_active";
/* api callbacks */
- ot->exec= objects_remove_active_exec;
- ot->poll= ED_operator_objectmode;
+ ot->exec = objects_remove_active_exec;
+ 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))
@@ -161,7 +161,7 @@ static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
group = NULL;
- while((group = find_group(base->object, group)))
+ while ((group = find_group(base->object, group)))
rem_from_group(group, base->object, scene, base);
}
CTX_DATA_END;
@@ -175,16 +175,16 @@ static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
void GROUP_OT_objects_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove From Groups";
+ ot->name = "Remove From Groups";
ot->description = "Remove selected objects from all groups";
- ot->idname= "GROUP_OT_objects_remove";
+ ot->idname = "GROUP_OT_objects_remove";
/* api callbacks */
- ot->exec= group_objects_remove_exec;
- ot->poll= ED_operator_objectmode;
+ ot->exec = group_objects_remove_exec;
+ 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)
@@ -212,16 +212,16 @@ static int group_create_exec(bContext *C, wmOperator *op)
void GROUP_OT_create(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Create New Group";
+ ot->name = "Create New Group";
ot->description = "Create an object group from selected objects";
- ot->idname= "GROUP_OT_create";
+ ot->idname = "GROUP_OT_create";
/* api callbacks */
- ot->exec= group_create_exec;
- ot->poll= ED_operator_objectmode;
+ ot->exec = group_create_exec;
+ 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");
}
@@ -234,7 +234,7 @@ static int group_add_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= ED_object_context(C);
Group *group;
- if(ob == NULL)
+ if (ob == NULL)
return OPERATOR_CANCELLED;
group= add_group("Group");
@@ -248,15 +248,15 @@ static int group_add_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_group_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add to Group";
- ot->idname= "OBJECT_OT_group_add";
+ ot->name = "Add to Group";
+ ot->idname = "OBJECT_OT_group_add";
ot->description = "Add an object to a new group";
/* api callbacks */
- ot->exec= group_add_exec;
+ 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)
@@ -265,7 +265,7 @@ static int group_link_exec(bContext *C, wmOperator *op)
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))
+ if (ELEM(NULL, ob, group))
return OPERATOR_CANCELLED;
add_to_group(group, ob, scene, NULL);
@@ -280,21 +280,21 @@ void OBJECT_OT_group_link(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Link to Group";
- ot->idname= "OBJECT_OT_group_link";
+ ot->name = "Link to Group";
+ ot->idname = "OBJECT_OT_group_link";
ot->description = "Add an object to an existing group";
/* api callbacks */
- ot->exec= group_link_exec;
- ot->invoke= WM_enum_search_invoke;
+ ot->exec = group_link_exec;
+ 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", "");
RNA_def_enum_funcs(prop, RNA_group_local_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
static int group_remove_exec(bContext *C, wmOperator *UNUSED(op))
@@ -303,7 +303,7 @@ static int group_remove_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= ED_object_context(C);
Group *group= CTX_data_pointer_get_type(C, "group", &RNA_Group).data;
- if(!ob || !group)
+ if (!ob || !group)
return OPERATOR_CANCELLED;
rem_from_group(group, ob, scene, NULL); /* base will be used if found */
@@ -316,13 +316,13 @@ static int group_remove_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_group_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Group";
- ot->idname= "OBJECT_OT_group_remove";
+ ot->name = "Remove Group";
+ ot->idname = "OBJECT_OT_group_remove";
/* api callbacks */
- ot->exec= group_remove_exec;
+ 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 eb128ad3025..7bb2be8e248 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -79,9 +79,9 @@ static int return_editmesh_indexar(BMEditMesh *em, int *tot, int **indexar, floa
int *index, nr, totvert=0;
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- if(BM_elem_flag_test(eve, BM_ELEM_SELECT)) totvert++;
+ 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;
@@ -89,7 +89,7 @@ static int return_editmesh_indexar(BMEditMesh *em, int *tot, int **indexar, floa
zero_v3(cent);
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- if(BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
*index= nr; index++;
add_v3_v3(cent, eve->co);
}
@@ -105,7 +105,7 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
{
zero_v3(cent);
- if(obedit->actdef) {
+ if (obedit->actdef) {
const int defgrp_index= obedit->actdef-1;
int totvert=0;
@@ -117,14 +117,14 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
- if(dvert) {
- if(defvert_find_weight(dvert, defgrp_index) > 0.0f) {
+ if (dvert) {
+ if (defvert_find_weight(dvert, defgrp_index) > 0.0f) {
add_v3_v3(cent, eve->co);
totvert++;
}
}
}
- if(totvert) {
+ 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);
@@ -147,9 +147,9 @@ static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
return;
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- if(nr==hmd->indexar[index]) {
+ if (nr==hmd->indexar[index]) {
BM_elem_select_set(em->bm, eve, TRUE);
- if(index < hmd->totindex-1) index++;
+ if (index < hmd->totindex-1) index++;
}
nr++;
@@ -166,25 +166,25 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar
/* count */
a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
bp= editlatt->def;
- while(a--) {
- if(bp->f1 & SELECT) {
- if(bp->hide==0) totvert++;
+ while (a--) {
+ if (bp->f1 & SELECT) {
+ 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;
- cent[0]= cent[1]= cent[2]= 0.0;
+ zero_v3(cent);
a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
bp= editlatt->def;
- while(a--) {
- if(bp->f1 & SELECT) {
- if(bp->hide==0) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
+ if (bp->hide==0) {
*index= nr; index++;
add_v3_v3(cent, bp->vec);
}
@@ -208,10 +208,10 @@ static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
/* count */
a= editlt->pntsu*editlt->pntsv*editlt->pntsw;
bp= editlt->def;
- while(a--) {
- if(hmd->indexar[index]==nr) {
+ while (a--) {
+ if (hmd->indexar[index]==nr) {
bp->f1 |= SELECT;
- if(index < hmd->totindex-1) index++;
+ if (index < hmd->totindex-1) index++;
}
nr++;
bp++;
@@ -226,49 +226,49 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
BezTriple *bezt;
int *index, a, nr, totvert=0;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->f1 & SELECT) totvert++;
- if(bezt->f2 & SELECT) totvert++;
- if(bezt->f3 & SELECT) totvert++;
+ while (a--) {
+ if (bezt->f1 & SELECT) totvert++;
+ if (bezt->f2 & SELECT) totvert++;
+ if (bezt->f3 & SELECT) totvert++;
bezt++;
}
}
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) totvert++;
+ 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;
- cent[0]= cent[1]= cent[2]= 0.0;
+ zero_v3(cent);
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->f1 & SELECT) {
+ while (a--) {
+ if (bezt->f1 & SELECT) {
*index= nr; index++;
add_v3_v3(cent, bezt->vec[0]);
}
nr++;
- if(bezt->f2 & SELECT) {
+ if (bezt->f2 & SELECT) {
*index= nr; index++;
add_v3_v3(cent, bezt->vec[1]);
}
nr++;
- if(bezt->f3 & SELECT) {
+ if (bezt->f3 & SELECT) {
*index= nr; index++;
add_v3_v3(cent, bezt->vec[2]);
}
@@ -279,8 +279,8 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
*index= nr; index++;
add_v3_v3(cent, bp->vec);
}
@@ -314,9 +314,10 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
em = me->edit_btmesh;
/* check selected vertices first */
- if( return_editmesh_indexar(em, tot, indexar, cent_r)) {
+ if ( return_editmesh_indexar(em, tot, indexar, cent_r)) {
return 1;
- } else {
+ }
+ else {
int ret = return_editmesh_vgroup(obedit, em, name, cent_r);
return ret;
}
@@ -342,24 +343,24 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
BezTriple *bezt;
int index=0, a, nr=0;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(nr == hmd->indexar[index]) {
+ 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]) {
+ 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]) {
+ if (nr == hmd->indexar[index]) {
bezt->f3 |= SELECT;
- if(index<hmd->totindex-1) index++;
+ if (index<hmd->totindex-1) index++;
}
nr++;
@@ -369,10 +370,10 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(nr == hmd->indexar[index]) {
+ while (a--) {
+ if (nr == hmd->indexar[index]) {
bp->f1 |= SELECT;
- if(index<hmd->totindex-1) index++;
+ if (index<hmd->totindex-1) index++;
}
nr++;
bp++;
@@ -386,10 +387,10 @@ 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 */
@@ -505,16 +506,16 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
void OBJECT_OT_hook_add_selobj(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Hook to Selected Object";
- ot->description= "Hook selected vertices to the first selected Object";
- ot->idname= "OBJECT_OT_hook_add_selob";
+ ot->name = "Hook to Selected Object";
+ ot->description = "Hook selected vertices to the first selected Object";
+ ot->idname = "OBJECT_OT_hook_add_selob";
/* api callbacks */
- ot->exec= object_add_hook_selob_exec;
- ot->poll= hook_op_edit_poll;
+ ot->exec = object_add_hook_selob_exec;
+ 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))
@@ -533,16 +534,16 @@ static int object_add_hook_newob_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_hook_add_newobj(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Hook to New Object";
- ot->description= "Hook selected vertices to the first selected Object";
- ot->idname= "OBJECT_OT_hook_add_newob";
+ ot->name = "Hook to New Object";
+ ot->description = "Hook selected vertices to the first selected Object";
+ ot->idname = "OBJECT_OT_hook_add_newob";
/* api callbacks */
- ot->exec= object_add_hook_newob_exec;
- ot->poll= hook_op_edit_poll;
+ ot->exec = object_add_hook_newob_exec;
+ 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)
@@ -578,10 +579,10 @@ static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), Pr
ModifierData *md = NULL;
int a, totitem= 0;
- if(!ob)
+ if (!ob)
return DummyRNA_NULL_items;
- for(a=0, md=ob->modifiers.first; md; md= md->next, 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;
@@ -602,24 +603,24 @@ void OBJECT_OT_hook_remove(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Remove Hook";
- ot->idname= "OBJECT_OT_hook_remove";
- ot->description= "Remove a hook from the active object";
+ ot->name = "Remove Hook";
+ ot->idname = "OBJECT_OT_hook_remove";
+ ot->description = "Remove a hook from the active object";
/* api callbacks */
- ot->exec= object_hook_remove_exec;
- ot->invoke= WM_menu_invoke;
- ot->poll= hook_op_edit_poll;
+ ot->exec = object_hook_remove_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->poll = hook_op_edit_poll;
/* 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");
RNA_def_enum_funcs(prop, hook_mod_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
static int object_hook_reset_exec(bContext *C, wmOperator *op)
@@ -643,10 +644,10 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op)
}
/* reset functionality */
- if(hmd->object) {
+ if (hmd->object) {
bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget);
- if(hmd->subtarget[0] && pchan) {
+ if (hmd->subtarget[0] && pchan) {
float imat[4][4], mat[4][4];
/* calculate the world-space matrix for the pose-channel target first, then carry on as usual */
@@ -672,16 +673,16 @@ void OBJECT_OT_hook_reset(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Reset Hook";
- ot->description= "Recalculate and clear offset transformation";
- ot->idname= "OBJECT_OT_hook_reset";
+ ot->name = "Reset Hook";
+ ot->description = "Recalculate and clear offset transformation";
+ ot->idname = "OBJECT_OT_hook_reset";
/* callbacks */
- ot->exec= object_hook_reset_exec;
- ot->poll= hook_op_edit_poll;
+ ot->exec = object_hook_reset_exec;
+ 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");
@@ -728,16 +729,16 @@ void OBJECT_OT_hook_recenter(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Recenter Hook";
- ot->description= "Set hook center to cursor position";
- ot->idname= "OBJECT_OT_hook_recenter";
+ ot->name = "Recenter Hook";
+ ot->description = "Set hook center to cursor position";
+ ot->idname = "OBJECT_OT_hook_recenter";
/* callbacks */
- ot->exec= object_hook_recenter_exec;
- ot->poll= hook_op_edit_poll;
+ ot->exec = object_hook_recenter_exec;
+ 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");
@@ -770,11 +771,11 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
/* assign functionality */
- if(!object_hook_index_array(scene, ob, &tot, &indexar, name, cent)) {
+ if (!object_hook_index_array(scene, ob, &tot, &indexar, name, cent)) {
BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group");
return OPERATOR_CANCELLED;
}
- if(hmd->indexar)
+ if (hmd->indexar)
MEM_freeN(hmd->indexar);
copy_v3_v3(hmd->cent, cent);
@@ -792,18 +793,18 @@ void OBJECT_OT_hook_assign(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Assign to Hook";
- ot->description= "Assign the selected vertices to a hook";
- ot->idname= "OBJECT_OT_hook_assign";
+ ot->name = "Assign to Hook";
+ ot->description = "Assign the selected vertices to a hook";
+ ot->idname = "OBJECT_OT_hook_assign";
/* callbacks */
- ot->exec= object_hook_assign_exec;
- ot->poll= hook_op_edit_poll;
+ ot->exec = object_hook_assign_exec;
+ ot->poll = hook_op_edit_poll;
/* 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");
@@ -843,16 +844,16 @@ void OBJECT_OT_hook_select(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Select Hook";
- ot->description= "Select affected vertices on mesh";
- ot->idname= "OBJECT_OT_hook_select";
+ ot->name = "Select Hook";
+ ot->description = "Select affected vertices on mesh";
+ ot->idname = "OBJECT_OT_hook_select";
/* callbacks */
- ot->exec= object_hook_select_exec;
- ot->poll= hook_op_edit_poll;
+ ot->exec = object_hook_select_exec;
+ 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");
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 9f3bc9bbf37..4ba62541c60 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -70,12 +70,12 @@ void free_editLatt(Object *ob)
{
Lattice *lt= ob->data;
- if(lt->editlatt) {
+ if (lt->editlatt) {
Lattice *editlt= lt->editlatt->latt;
- if(editlt->def)
+ if (editlt->def)
MEM_freeN(editlt->def);
- if(editlt->dvert)
+ if (editlt->dvert)
free_dverts(editlt->dvert, editlt->pntsu*editlt->pntsv*editlt->pntsw);
MEM_freeN(editlt);
@@ -93,20 +93,20 @@ void make_editLatt(Object *obedit)
free_editLatt(obedit);
actkey= ob_get_keyblock(obedit);
- if(actkey)
+ 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);
- if(lt->dvert) {
+ if (lt->dvert) {
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)
@@ -120,19 +120,19 @@ void load_editLatt(Object *obedit)
lt= obedit->data;
editlt= lt->editlatt->latt;
- if(lt->editlatt->shapenr) {
+ if (lt->editlatt->shapenr) {
actkey= BLI_findlink(&lt->key->block, lt->editlatt->shapenr-1);
/* active key: vertices */
tot= editlt->pntsu*editlt->pntsv*editlt->pntsw;
- if(actkey->data) MEM_freeN(actkey->data);
+ if (actkey->data) MEM_freeN(actkey->data);
fp=actkey->data= MEM_callocN(lt->key->elemsize*tot, "actkey->data");
actkey->totelem= tot;
bp= editlt->def;
- while(tot--) {
+ while (tot--) {
copy_v3_v3(fp, bp->vec);
fp+= 3;
bp++;
@@ -154,12 +154,12 @@ void load_editLatt(Object *obedit)
lt->typew= editlt->typew;
}
- if(lt->dvert) {
+ if (lt->dvert) {
free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
lt->dvert= NULL;
}
- if(editlt->dvert) {
+ if (editlt->dvert) {
tot= lt->pntsu*lt->pntsv*lt->pntsw;
lt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
@@ -179,8 +179,8 @@ void ED_setflagsLatt(Object *obedit, int flag)
a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
- while(a--) {
- if(bp->hide==0) {
+ while (a--) {
+ if (bp->hide==0) {
bp->f1= flag;
}
bp++;
@@ -201,9 +201,9 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
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->f1) {
+ while (a--) {
+ if (bp->hide==0) {
+ if (bp->f1) {
action = SEL_DESELECT;
break;
}
@@ -223,8 +223,8 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
bp= lt->editlatt->latt->def;
a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
- while(a--) {
- if(bp->hide==0) {
+ while (a--) {
+ if (bp->hide==0) {
bp->f1 ^= 1;
}
bp++;
@@ -240,16 +240,16 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
void LATTICE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect All";
- ot->description= "Change selection of all UVW control points";
- ot->idname= "LATTICE_OT_select_all";
+ ot->name = "(De)select All";
+ ot->description = "Change selection of all UVW control points";
+ ot->idname = "LATTICE_OT_select_all";
/* api callbacks */
- ot->exec= lattice_select_all_exec;
- ot->poll= ED_operator_editlattice;
+ ot->exec = lattice_select_all_exec;
+ ot->poll = ED_operator_editlattice;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -258,7 +258,7 @@ static int make_regular_poll(bContext *C)
{
Object *ob;
- if(ED_operator_editlattice(C)) return 1;
+ if (ED_operator_editlattice(C)) return 1;
ob= CTX_data_active_object(C);
return (ob && ob->type==OB_LATTICE);
@@ -269,7 +269,7 @@ static int make_regular_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= CTX_data_edit_object(C);
Lattice *lt;
- if(ob) {
+ if (ob) {
lt= ob->data;
resizelattice(lt->editlatt->latt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
}
@@ -288,16 +288,16 @@ static int make_regular_exec(bContext *C, wmOperator *UNUSED(op))
void LATTICE_OT_make_regular(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Regular";
- ot->description= "Set UVW control points a uniform distance apart";
- ot->idname= "LATTICE_OT_make_regular";
+ ot->name = "Make Regular";
+ ot->description = "Set UVW control points a uniform distance apart";
+ ot->idname = "LATTICE_OT_make_regular";
/* api callbacks */
- ot->exec= make_regular_exec;
- ot->poll= make_regular_poll;
+ ot->exec = make_regular_exec;
+ ot->poll = make_regular_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/****************************** Mouse Selection *************************/
@@ -307,10 +307,10 @@ static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, in
struct { BPoint *bp; short dist, select; int mval[2]; } *data = userData;
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;
@@ -343,8 +343,8 @@ int mouse_lattice(bContext *C, const int mval[2], int extend)
view3d_set_viewcontext(C, &vc);
bp= findnearestLattvert(&vc, mval, 1);
- if(bp) {
- if(extend==0) {
+ if (bp) {
+ if (extend==0) {
ED_setflagsLatt(vc.obedit, 0);
bp->f1 |= SELECT;
}
@@ -392,7 +392,7 @@ static void free_undoLatt(void *data)
{
UndoLattice *ult= (UndoLattice*)data;
- if(ult->def) MEM_freeN(ult->def);
+ if (ult->def) MEM_freeN(ult->def);
MEM_freeN(ult);
}
@@ -410,7 +410,7 @@ static void *get_editlatt(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_LATTICE) {
+ 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 de9e3db25b8..cd2fa4f93b6 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -91,19 +91,19 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
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)) {
+ 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);
return NULL;
}
- if(mti->flags&eModifierTypeFlag_Single) {
- if(modifiers_findByType(ob, type)) {
+ if (mti->flags&eModifierTypeFlag_Single) {
+ if (modifiers_findByType(ob, type)) {
BKE_report(reports, RPT_WARNING, "Only one modifier of this type allowed");
return NULL;
}
}
- if(type == eModifierType_ParticleSystem) {
+ if (type == eModifierType_ParticleSystem) {
/* don't need to worry about the new modifier's name, since that is set to the number
* of particle systems which shouldn't have too many duplicates
*/
@@ -113,10 +113,10 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
/* get new modifier data to add */
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);
@@ -124,7 +124,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
else
BLI_addtail(&ob->modifiers, new_md);
- if(name)
+ if (name)
BLI_strncpy(new_md->name, name, sizeof(new_md->name));
/* make sure modifier data has unique name */
@@ -132,22 +132,22 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
modifier_unique_name(&ob->modifiers, new_md);
/* special cases */
- if(type == eModifierType_Softbody) {
- if(!ob->soft) {
+ if (type == eModifierType_Softbody) {
+ if (!ob->soft) {
ob->soft= sbNew(scene);
ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
}
}
- else if(type == eModifierType_Collision) {
- if(!ob->pd)
+ else if (type == eModifierType_Collision) {
+ if (!ob->pd)
ob->pd= object_add_collision_fields(0);
ob->pd->deflect= 1;
DAG_scene_sort(bmain, scene);
}
- else if(type == eModifierType_Surface)
+ else if (type == eModifierType_Surface)
DAG_scene_sort(bmain, scene);
- else if(type == eModifierType_Multires)
+ else if (type == eModifierType_Multires)
/* set totlvl from existing MDISPS layer if object already had it */
multiresModifier_set_levels_from_disps((MultiresModifierData *)new_md, ob);
}
@@ -164,70 +164,60 @@ 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)
+ if (!obmd)
return 0;
/* special cases */
- if(md->type == eModifierType_ParticleSystem) {
+ if (md->type == eModifierType_ParticleSystem) {
ParticleSystemModifierData *psmd=(ParticleSystemModifierData*)md;
BLI_remlink(&ob->particlesystem, psmd->psys);
psys_free(ob, psmd->psys);
psmd->psys= NULL;
}
- else if(md->type == eModifierType_Softbody) {
- if(ob->soft) {
+ else if (md->type == eModifierType_Softbody) {
+ if (ob->soft) {
sbFree(ob->soft);
ob->soft= NULL;
ob->softflag= 0;
}
}
- else if(md->type == eModifierType_Collision) {
- if(ob->pd)
+ else if (md->type == eModifierType_Collision) {
+ if (ob->pd)
ob->pd->deflect= 0;
*sort_depsgraph = 1;
}
- else if(md->type == eModifierType_Surface) {
- if(ob->pd && ob->pd->shape == PFIELD_SHAPE_SURFACE)
+ else if (md->type == eModifierType_Surface) {
+ if (ob->pd && ob->pd->shape == PFIELD_SHAPE_SURFACE)
ob->pd->shape = PFIELD_SHAPE_PLANE;
*sort_depsgraph = 1;
}
- else if(md->type == eModifierType_Smoke) {
+ else if (md->type == eModifierType_Smoke) {
ob->dt = OB_TEXTURE;
}
- else if(md->type == eModifierType_Multires) {
+ else if (md->type == eModifierType_Multires) {
int ok= 1;
- Mesh *me= ob->data;
ModifierData *tmpmd;
- /* ensure MDISPS CustomData layer is't used by another multires modifiers */
- for(tmpmd= ob->modifiers.first; tmpmd; tmpmd= tmpmd->next)
- if(tmpmd!=md && tmpmd->type == eModifierType_Multires) {
+ /* 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;
break;
}
- if(ok) {
- if(me->edit_btmesh) {
- BMEditMesh *em= me->edit_btmesh;
- /* CustomData_external_remove is used here only to mark layer as non-external
- * for further free-ing, so zero element count looks safer than em->totface */
- CustomData_external_remove(&em->bm->ldata, &me->id, CD_MDISPS, 0);
- BM_data_layer_free(em->bm, &em->bm->ldata, CD_MDISPS);
- } else {
- CustomData_external_remove(&me->ldata, &me->id, CD_MDISPS, me->totloop);
- CustomData_free_layer_active(&me->ldata, CD_MDISPS, me->totloop);
- }
+ if (ok) {
+ multires_customdata_delete(ob->data);
}
}
- if(ELEM(md->type, eModifierType_Softbody, eModifierType_Cloth) &&
+ if (ELEM(md->type, eModifierType_Softbody, eModifierType_Cloth) &&
ob->particlesystem.first == NULL) {
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
}
@@ -245,7 +235,7 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
ok= object_modifier_remove(ob, md, &sort_depsgraph);
- if(!ok) {
+ if (!ok) {
BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", ob->id.name, md->name);
return 0;
}
@@ -253,7 +243,7 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* sorting has to be done after the update so that dynamic systems can react properly */
- if(sort_depsgraph)
+ if (sort_depsgraph)
DAG_scene_sort(bmain, scene);
return 1;
@@ -264,10 +254,10 @@ void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob)
ModifierData *md = ob->modifiers.first;
int sort_depsgraph = 0;
- if(!md)
+ if (!md)
return;
- while(md) {
+ while (md) {
ModifierData *next_md;
next_md= md->next;
@@ -280,19 +270,19 @@ void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* sorting has to be done after the update so that dynamic systems can react properly */
- if(sort_depsgraph)
+ if (sort_depsgraph)
DAG_scene_sort(bmain, scene);
}
int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md)
{
- if(md->prev) {
+ 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;
}
@@ -307,13 +297,13 @@ int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md
int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *md)
{
- if(md->next) {
+ 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;
}
@@ -339,43 +329,43 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
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;
+ if (md->type != eModifierType_ParticleSystem) return 0;
+ if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) return 0;
psys=((ParticleSystemModifierData *)md)->psys;
part= psys->part;
- if(part->ren_as != PART_DRAW_PATH || psys->pathcache == NULL)
+ if (part->ren_as != PART_DRAW_PATH || psys->pathcache == NULL)
return 0;
totpart= psys->totcached;
totchild= psys->totchildcache;
- if(totchild && (part->draw&PART_DRAW_PARENT)==0)
+ if (totchild && (part->draw&PART_DRAW_PARENT)==0)
totpart= 0;
/* count */
cache= psys->pathcache;
- for(a=0; a<totpart; a++) {
+ for (a=0; a<totpart; a++) {
key= cache[a];
- if(key->steps > 0) {
+ if (key->steps > 0) {
totvert+= key->steps+1;
totedge+= key->steps;
}
}
cache= psys->childcache;
- for(a=0; a<totchild; a++) {
+ for (a=0; a<totchild; a++) {
key= cache[a];
- if(key->steps > 0) {
+ if (key->steps > 0) {
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);
@@ -393,12 +383,12 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
/* copy coordinates */
cache= psys->pathcache;
- for(a=0; a<totpart; a++) {
+ for (a=0; a<totpart; a++) {
key= cache[a];
kmax= key->steps;
- for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
+ for (k=0; k<=kmax; k++,key++,cvert++,mvert++) {
copy_v3_v3(mvert->co,key->co);
- if(k) {
+ if (k) {
medge->v1= cvert-1;
medge->v2= cvert;
medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
@@ -412,12 +402,12 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
}
cache=psys->childcache;
- for(a=0; a<totchild; a++) {
+ for (a=0; a<totchild; a++) {
key=cache[a];
kmax=key->steps;
- for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
+ for (k=0; k<=kmax; k++,key++,cvert++,mvert++) {
copy_v3_v3(mvert->co,key->co);
- if(k) {
+ if (k) {
medge->v1=cvert-1;
medge->v2=cvert;
medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
@@ -463,7 +453,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
Key *key=me->key;
KeyBlock *kb;
- if(!modifier_sameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) {
+ if (!modifier_sameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) {
BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to Shapes");
return 0;
}
@@ -474,7 +464,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
return 0;
}
- if(key == NULL) {
+ if (key == NULL) {
key= me->key= add_key((ID *)me);
key->type= KEY_RELATIVE;
/* if that was the first key block added, then it was the basis.
@@ -511,21 +501,22 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
Mesh *me = ob->data;
MultiresModifierData *mmd= find_multires_modifier_before(scene, md);
- if(me->key && mti->type != eModifierTypeType_NonGeometrical) {
+ if (me->key && mti->type != eModifierTypeType_NonGeometrical) {
BKE_report(reports, RPT_ERROR, "Modifier cannot be applied to Mesh with Shape Keys");
return 0;
}
/* Multires: ensure that recent sculpting is applied */
- if(md->type == eModifierType_Multires)
+ 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 (!multiresModifier_reshapeFromDeformMod (scene, mmd, ob, md)) {
BKE_report(reports, RPT_ERROR, "Multires modifier returned error, skipping apply");
return 0;
}
- } else {
+ }
+ else {
dm = mesh_create_derived_for_modifier(scene, ob, md, 1);
if (!dm) {
BKE_report(reports, RPT_ERROR, "Modifier returned error, skipping apply");
@@ -536,10 +527,8 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
dm->release(dm);
- if(md->type == eModifierType_Multires) {
- CustomData_external_remove(&me->ldata, &me->id, CD_MDISPS, me->totloop);
- CustomData_free_layer_active(&me->ldata, CD_MDISPS, me->totloop);
- }
+ if (md->type == eModifierType_Multires)
+ multires_customdata_delete(me);
}
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
@@ -553,7 +542,7 @@ 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 tesselated/bevel vertices");
+ BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices");
vertexCos = curve_getVertexCos(cu, &cu->nurb, &numVerts);
mti->deformVerts(md, ob, NULL, vertexCos, numVerts, 0, 0);
@@ -569,13 +558,13 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
}
/* lattice modifier can be applied to particle system too */
- if(ob->particlesystem.first) {
+ if (ob->particlesystem.first) {
ParticleSystem *psys = ob->particlesystem.first;
- for(; psys; psys=psys->next) {
+ for (; psys; psys=psys->next) {
- if(psys->part->type != PART_HAIR)
+ if (psys->part->type != PART_HAIR)
continue;
psys_apply_hair_lattice(scene, ob, psys);
@@ -592,7 +581,8 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
if (scene->obedit) {
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;
}
@@ -609,7 +599,8 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
md->mode= prev_mode;
return 0;
}
- } else {
+ }
+ else {
if (!modifier_apply_obdata(reports, scene, ob, md)) {
md->mode= prev_mode;
return 0;
@@ -643,7 +634,7 @@ static int modifier_add_exec(bContext *C, wmOperator *op)
Object *ob = ED_object_active_context(C);
int type= RNA_enum_get(op->ptr, "type");
- if(!ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, 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);
@@ -658,20 +649,19 @@ static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr)
ModifierTypeInfo *mti;
int totitem= 0, a;
- if(!ob)
+ if (!ob)
return modifier_type_items;
- for(a=0; modifier_type_items[a].identifier; a++) {
+ for (a=0; modifier_type_items[a].identifier; a++) {
md_item= &modifier_type_items[a];
- if(md_item->identifier[0]) {
+ if (md_item->identifier[0]) {
mti= modifierType_getInfo(md_item->value);
- if(mti->flags & eModifierTypeFlag_NoUserAdd)
+ if (mti->flags & eModifierTypeFlag_NoUserAdd)
continue;
- if(!((mti->flags & eModifierTypeFlag_AcceptsCVs) ||
- (ob->type==OB_MESH && (mti->flags & eModifierTypeFlag_AcceptsMesh))))
+ if (!object_support_modifier_type(ob, md_item->value))
continue;
}
else {
@@ -681,7 +671,7 @@ static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr)
continue;
}
- if(group_item) {
+ if (group_item) {
RNA_enum_item_add(&item, &totitem, group_item);
group_item= NULL;
}
@@ -700,22 +690,22 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Modifier";
+ ot->name = "Add Modifier";
ot->description = "Add a modifier to the active object";
- ot->idname= "OBJECT_OT_modifier_add";
+ ot->idname = "OBJECT_OT_modifier_add";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= modifier_add_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = modifier_add_exec;
+ 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", "");
RNA_def_enum_funcs(prop, modifier_add_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
/************************ generic functions for operators using mod names and data context *********************/
@@ -783,15 +773,15 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
ModifierData *md = edit_modifier_property_get(op, ob, 0);
int mode_orig = ob ? ob->mode : 0;
- if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md))
+ 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);
/* 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)
+ 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);
return OPERATOR_FINISHED;
@@ -807,16 +797,16 @@ static int modifier_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
void OBJECT_OT_modifier_remove(wmOperatorType *ot)
{
- ot->name= "Remove Modifier";
- ot->description= "Remove a modifier from the active object";
- ot->idname= "OBJECT_OT_modifier_remove";
+ ot->name = "Remove Modifier";
+ ot->description = "Remove a modifier from the active object";
+ ot->idname = "OBJECT_OT_modifier_remove";
- ot->invoke= modifier_remove_invoke;
- ot->exec= modifier_remove_exec;
- ot->poll= edit_modifier_poll;
+ ot->invoke = modifier_remove_invoke;
+ ot->exec = modifier_remove_exec;
+ ot->poll = edit_modifier_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -827,7 +817,7 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op)
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
- if(!ob || !md || !ED_object_modifier_move_up(op->reports, ob, md))
+ if (!ob || !md || !ED_object_modifier_move_up(op->reports, ob, md))
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -846,16 +836,16 @@ static int modifier_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
{
- ot->name= "Move Up Modifier";
- ot->description= "Move modifier up in the stack";
- ot->idname= "OBJECT_OT_modifier_move_up";
+ ot->name = "Move Up Modifier";
+ ot->description = "Move modifier up in the stack";
+ ot->idname = "OBJECT_OT_modifier_move_up";
- ot->invoke= modifier_move_up_invoke;
- ot->exec= modifier_move_up_exec;
- ot->poll= edit_modifier_poll;
+ ot->invoke = modifier_move_up_invoke;
+ ot->exec = modifier_move_up_exec;
+ ot->poll = edit_modifier_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -866,7 +856,7 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op)
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
- if(!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md))
+ if (!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md))
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -885,16 +875,16 @@ static int modifier_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
{
- ot->name= "Move Down Modifier";
- ot->description= "Move modifier down in the stack";
- ot->idname= "OBJECT_OT_modifier_move_down";
+ ot->name = "Move Down Modifier";
+ ot->description = "Move modifier down in the stack";
+ ot->idname = "OBJECT_OT_modifier_move_down";
- ot->invoke= modifier_move_down_invoke;
- ot->exec= modifier_move_down_exec;
- ot->poll= edit_modifier_poll;
+ ot->invoke = modifier_move_down_invoke;
+ ot->exec = modifier_move_down_exec;
+ ot->poll = edit_modifier_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -907,7 +897,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
ModifierData *md = edit_modifier_property_get(op, ob, 0);
int apply_as= RNA_enum_get(op->ptr, "apply_as");
- if(!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) {
+ if (!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) {
return OPERATOR_CANCELLED;
}
@@ -932,16 +922,16 @@ static EnumPropertyItem modifier_apply_as_items[] = {
void OBJECT_OT_modifier_apply(wmOperatorType *ot)
{
- ot->name= "Apply Modifier";
- ot->description= "Apply modifier and remove from the stack";
- ot->idname= "OBJECT_OT_modifier_apply";
+ ot->name = "Apply Modifier";
+ ot->description = "Apply modifier and remove from the stack";
+ ot->idname = "OBJECT_OT_modifier_apply";
- ot->invoke= modifier_apply_invoke;
- ot->exec= modifier_apply_exec;
- ot->poll= edit_modifier_poll;
+ ot->invoke = modifier_apply_invoke;
+ ot->exec = modifier_apply_exec;
+ 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);
@@ -956,7 +946,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op)
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
- if(!ob || !md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md))
+ if (!ob || !md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md))
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -975,16 +965,16 @@ static int modifier_convert_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
void OBJECT_OT_modifier_convert(wmOperatorType *ot)
{
- ot->name= "Convert Modifier";
- ot->description= "Convert particles to a mesh object";
- ot->idname= "OBJECT_OT_modifier_convert";
+ ot->name = "Convert Modifier";
+ ot->description = "Convert particles to a mesh object";
+ ot->idname = "OBJECT_OT_modifier_convert";
- ot->invoke= modifier_convert_invoke;
- ot->exec= modifier_convert_exec;
- ot->poll= edit_modifier_poll;
+ ot->invoke = modifier_convert_invoke;
+ ot->exec = modifier_convert_exec;
+ ot->poll = edit_modifier_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -995,7 +985,7 @@ static int modifier_copy_exec(bContext *C, wmOperator *op)
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
- if(!ob || !md || !ED_object_modifier_copy(op->reports, ob, md))
+ if (!ob || !md || !ED_object_modifier_copy(op->reports, ob, md))
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -1014,16 +1004,16 @@ static int modifier_copy_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
void OBJECT_OT_modifier_copy(wmOperatorType *ot)
{
- ot->name= "Copy Modifier";
- ot->description= "Duplicate modifier at the same position in the stack";
- ot->idname= "OBJECT_OT_modifier_copy";
+ ot->name = "Copy Modifier";
+ ot->description = "Duplicate modifier at the same position in the stack";
+ ot->idname = "OBJECT_OT_modifier_copy";
- ot->invoke= modifier_copy_invoke;
- ot->exec= modifier_copy_exec;
- ot->poll= edit_modifier_poll;
+ ot->invoke = modifier_copy_invoke;
+ ot->exec = modifier_copy_exec;
+ ot->poll = edit_modifier_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1059,16 +1049,16 @@ static int multires_higher_levels_delete_invoke(bContext *C, wmOperator *op, wmE
void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot)
{
- ot->name= "Delete Higher Levels";
- ot->description= "Deletes the higher resolution mesh, potential loss of detail";
- ot->idname= "OBJECT_OT_multires_higher_levels_delete";
+ ot->name = "Delete Higher Levels";
+ ot->description = "Deletes the higher resolution mesh, potential loss of detail";
+ ot->idname = "OBJECT_OT_multires_higher_levels_delete";
- ot->poll= multires_poll;
- ot->invoke= multires_higher_levels_delete_invoke;
- ot->exec= multires_higher_levels_delete_exec;
+ ot->poll = multires_poll;
+ ot->invoke = multires_higher_levels_delete_invoke;
+ ot->exec = multires_higher_levels_delete_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1100,16 +1090,16 @@ static int multires_subdivide_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
{
- ot->name= "Multires Subdivide";
- ot->description= "Add a new level of subdivision";
- ot->idname= "OBJECT_OT_multires_subdivide";
+ ot->name = "Multires Subdivide";
+ ot->description = "Add a new level of subdivision";
+ ot->idname = "OBJECT_OT_multires_subdivide";
- ot->poll= multires_poll;
- ot->invoke= multires_subdivide_invoke;
- ot->exec= multires_subdivide_exec;
+ ot->poll = multires_poll;
+ ot->invoke = multires_subdivide_invoke;
+ ot->exec = multires_subdivide_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1124,25 +1114,25 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
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) {
- if(selob->type == OB_MESH && selob != ob) {
+ if (selob->type == OB_MESH && selob != ob) {
secondob= selob;
break;
}
}
CTX_DATA_END;
- if(!secondob) {
+ if (!secondob) {
BKE_report(op->reports, RPT_ERROR, "Second selected mesh object require to copy shape from");
return OPERATOR_CANCELLED;
}
- if(!multiresModifier_reshape(scene, mmd, ob, secondob)) {
+ if (!multiresModifier_reshape(scene, mmd, ob, secondob)) {
BKE_report(op->reports, RPT_ERROR, "Objects do not have the same number of vertices");
return OPERATOR_CANCELLED;
}
@@ -1163,16 +1153,16 @@ static int multires_reshape_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
void OBJECT_OT_multires_reshape(wmOperatorType *ot)
{
- ot->name= "Multires Reshape";
- ot->description= "Copy vertex coordinates from other object";
- ot->idname= "OBJECT_OT_multires_reshape";
+ ot->name = "Multires Reshape";
+ ot->description = "Copy vertex coordinates from other object";
+ ot->idname = "OBJECT_OT_multires_reshape";
- ot->poll= multires_poll;
- ot->invoke= multires_reshape_invoke;
- ot->exec= multires_reshape_exec;
+ ot->poll = multires_poll;
+ ot->invoke = multires_reshape_invoke;
+ ot->exec = multires_reshape_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1187,15 +1177,15 @@ static int multires_external_save_exec(bContext *C, wmOperator *op)
char path[FILE_MAX];
int relative= RNA_boolean_get(op->ptr, "relative_path");
- if(!me)
+ if (!me)
return OPERATOR_CANCELLED;
- if(CustomData_external_test(&me->ldata, CD_MDISPS))
+ if (CustomData_external_test(&me->ldata, CD_MDISPS))
return OPERATOR_CANCELLED;
RNA_string_get(op->ptr, "filepath", path);
- if(relative)
+ if (relative)
BLI_path_rel(path, G.main->name);
CustomData_external_add(&me->ldata, &me->id, CD_MDISPS, me->totloop, path);
@@ -1219,10 +1209,10 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U
if (!mmd)
return OPERATOR_CANCELLED;
- if(CustomData_external_test(&me->ldata, CD_MDISPS))
+ if (CustomData_external_test(&me->ldata, CD_MDISPS))
return OPERATOR_CANCELLED;
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return multires_external_save_exec(C, op);
op->customdata= me;
@@ -1237,17 +1227,17 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U
void OBJECT_OT_multires_external_save(wmOperatorType *ot)
{
- ot->name= "Multires Save External";
- ot->description= "Save displacements to an external file";
- ot->idname= "OBJECT_OT_multires_external_save";
+ ot->name = "Multires Save External";
+ ot->description = "Save displacements to an external file";
+ ot->idname = "OBJECT_OT_multires_external_save";
- // XXX modifier no longer in context after file browser .. ot->poll= multires_poll;
- ot->exec= multires_external_save_exec;
- ot->invoke= multires_external_save_invoke;
- ot->poll= multires_poll;
+ // XXX modifier no longer in context after file browser .. ot->poll = multires_poll;
+ ot->exec = multires_external_save_exec;
+ ot->invoke = multires_external_save_invoke;
+ 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);
edit_modifier_properties(ot);
@@ -1260,7 +1250,7 @@ static int multires_external_pack_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob = ED_object_active_context(C);
Mesh *me= ob->data;
- if(!CustomData_external_test(&me->ldata, CD_MDISPS))
+ if (!CustomData_external_test(&me->ldata, CD_MDISPS))
return OPERATOR_CANCELLED;
// XXX don't remove..
@@ -1271,15 +1261,15 @@ static int multires_external_pack_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_multires_external_pack(wmOperatorType *ot)
{
- ot->name= "Multires Pack External";
- ot->description= "Pack displacements from an external file";
- ot->idname= "OBJECT_OT_multires_external_pack";
+ ot->name = "Multires Pack External";
+ ot->description = "Pack displacements from an external file";
+ ot->idname = "OBJECT_OT_multires_external_pack";
- ot->poll= multires_poll;
- ot->exec= multires_external_pack_exec;
+ ot->poll = multires_poll;
+ ot->exec = multires_external_pack_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************* multires apply base ***********************/
@@ -1310,16 +1300,16 @@ static int multires_base_apply_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
{
- ot->name= "Multires Apply Base";
- ot->description= "Modify the base mesh to conform to the displaced mesh";
- ot->idname= "OBJECT_OT_multires_base_apply";
+ ot->name = "Multires Apply Base";
+ ot->description = "Modify the base mesh to conform to the displaced mesh";
+ ot->idname = "OBJECT_OT_multires_base_apply";
- ot->poll= multires_poll;
- ot->invoke= multires_base_apply_invoke;
- ot->exec= multires_base_apply_exec;
+ ot->poll = multires_poll;
+ ot->invoke = multires_base_apply_invoke;
+ ot->exec = multires_base_apply_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1340,15 +1330,15 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
if (!mmd)
return OPERATOR_CANCELLED;
- if(mmd->bindcagecos) {
+ if (mmd->bindcagecos) {
MEM_freeN(mmd->bindcagecos);
- if(mmd->dyngrid) MEM_freeN(mmd->dyngrid);
- if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
- 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 */
+ if (mmd->dyngrid) MEM_freeN(mmd->dyngrid);
+ if (mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
+ 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;
@@ -1372,17 +1362,17 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
mmd->bindfunc= mesh_deform_bind;
mmd->modifier.mode |= eModifierMode_Realtime;
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
dm= mesh_create_derived_view(scene, ob, 0);
dm->release(dm);
}
- else if(ob->type == OB_LATTICE) {
+ 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)) {
+ else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
makeDispListCurveTypes(scene, ob, 0);
}
@@ -1404,17 +1394,17 @@ static int meshdeform_bind_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
void OBJECT_OT_meshdeform_bind(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mesh Deform Bind";
+ ot->name = "Mesh Deform Bind";
ot->description = "Bind mesh to cage in mesh deform modifier";
- ot->idname= "OBJECT_OT_meshdeform_bind";
+ ot->idname = "OBJECT_OT_meshdeform_bind";
/* api callbacks */
- ot->poll= meshdeform_poll;
- ot->invoke= meshdeform_bind_invoke;
- ot->exec= meshdeform_bind_exec;
+ ot->poll = meshdeform_poll;
+ ot->invoke = meshdeform_bind_invoke;
+ ot->exec = meshdeform_bind_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1452,16 +1442,16 @@ static int explode_refresh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
void OBJECT_OT_explode_refresh(wmOperatorType *ot)
{
- ot->name= "Explode Refresh";
- ot->description= "Refresh data in the Explode modifier";
- ot->idname= "OBJECT_OT_explode_refresh";
+ ot->name = "Explode Refresh";
+ ot->description = "Refresh data in the Explode modifier";
+ ot->idname = "OBJECT_OT_explode_refresh";
- ot->poll= explode_poll;
- ot->invoke= explode_refresh_invoke;
- ot->exec= explode_refresh_exec;
+ ot->poll = explode_poll;
+ ot->invoke = explode_refresh_invoke;
+ ot->exec = explode_refresh_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1667,16 +1657,16 @@ static int ocean_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
void OBJECT_OT_ocean_bake(wmOperatorType *ot)
{
- ot->name= "Bake Ocean";
- ot->description= "Bake an image sequence of ocean data";
- ot->idname= "OBJECT_OT_ocean_bake";
+ ot->name = "Bake Ocean";
+ ot->description = "Bake an image sequence of ocean data";
+ ot->idname = "OBJECT_OT_ocean_bake";
- ot->poll= ocean_bake_poll;
- ot->invoke= ocean_bake_invoke;
- ot->exec= ocean_bake_exec;
+ ot->poll = ocean_bake_poll;
+ ot->invoke = ocean_bake_invoke;
+ 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 2b6707de42b..12387f36ca4 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -221,27 +221,27 @@ void ED_operatormacros_object(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", OPTYPE_UNDO|OPTYPE_REGISTER);
- if(ot) {
+ 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");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
}
/* grr, should be able to pass options on... */
- ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", OPTYPE_UNDO|OPTYPE_REGISTER);
- if(ot) {
+ 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");
+ otmacro = WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
RNA_boolean_set(otmacro->ptr, "linked", TRUE);
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
}
/* XXX */
- ot= WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO|OPTYPE_REGISTER);
- if(ot) {
+ 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");
@@ -263,7 +263,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
int i;
/* Objects, Regardless of Mode -------------------------------------------------- */
- keymap= WM_keymap_find(keyconf, "Object Non-modal", 0, 0);
+ keymap = WM_keymap_find(keyconf, "Object Non-modal", 0, 0);
/* Note: this keymap works disregarding mode */
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
@@ -286,8 +286,8 @@ void ED_keymap_object(wmKeyConfig *keyconf)
/* Object Mode ---------------------------------------------------------------- */
/* Note: this keymap gets disabled in non-objectmode, */
- keymap= WM_keymap_find(keyconf, "Object Mode", 0, 0);
- keymap->poll= object_mode_poll;
+ keymap = WM_keymap_find(keyconf, "Object Mode", 0, 0);
+ keymap->poll = object_mode_poll;
/* object mode supports PET now */
ED_object_generic_keymap(keyconf, keymap, 1);
@@ -391,7 +391,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "VIEW3D_MT_object_specials", WKEY, KM_PRESS, 0, 0);
- for(i=0; i<=5; i++) {
+ 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);
}
@@ -400,11 +400,14 @@ void ED_keymap_object(wmKeyConfig *keyconf)
/* ################################ LATTICE ################################### */
/* ############################################################################ */
- keymap= WM_keymap_find(keyconf, "Lattice", 0, 0);
- keymap->poll= ED_operator_editlattice;
+ keymap = WM_keymap_find(keyconf, "Lattice", 0, 0);
+ keymap->poll = ED_operator_editlattice;
+
+ kmi = WM_keymap_add_item(keymap, "LATTICE_OT_select_all", AKEY, KM_PRESS, 0, 0);
+ RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
+ kmi = WM_keymap_add_item(keymap, "LATTICE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
+ RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
- WM_keymap_add_item(keymap, "LATTICE_OT_select_all", AKEY, KM_PRESS, 0, 0);
-
WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
/* menus */
@@ -418,7 +421,7 @@ void ED_object_generic_keymap(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyM
wmKeyMapItem *kmi;
/* used by mesh, curve & lattice only */
- if(do_pet) {
+ if (do_pet) {
/* context ops */
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_enum", OKEY, KM_PRESS, KM_SHIFT, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit_falloff");
@@ -429,7 +432,8 @@ void ED_object_generic_keymap(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyM
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_proportional_edit_objects");
- } else { // Edit mode
+ }
+ else { // Edit mode
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit");
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index a388e465a21..341ba368729 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -124,7 +124,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
/* we need 1 to 3 selected vertices */
- if(obedit->type==OB_MESH) {
+ if (obedit->type==OB_MESH) {
Mesh *me= obedit->data;
BMEditMesh *em;
@@ -139,31 +139,31 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
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)) {
+ else if (ELEM(obedit->type, OB_SURF, OB_CURVE)) {
ListBase *editnurb= object_editcurve_get(obedit);
cu= obedit->data;
nu= editnurb->first;
- while(nu) {
- if(nu->type == CU_BEZIER) {
+ while (nu) {
+ if (nu->type == CU_BEZIER) {
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;
+ 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;
else break;
}
nr++;
@@ -173,12 +173,12 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
else {
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;
+ 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;
else break;
}
nr++;
@@ -188,17 +188,17 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
nu= nu->next;
}
}
- else if(obedit->type==OB_LATTICE) {
+ 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;
- 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;
+ 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;
else break;
}
nr++;
@@ -206,28 +206,28 @@ 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) {
- if(ob != obedit) {
+ if (ob != obedit) {
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
par= obedit->parent;
- while(par) {
- if(par==ob) break;
+ while (par) {
+ if (par==ob) break;
par= par->parent;
}
- if(par) {
+ if (par) {
BKE_report(op->reports, RPT_ERROR, "Loop in parents");
}
else {
Object workob;
ob->parent= BASACT->object;
- if(v3) {
+ if (v3) {
ob->partype= PARVERT3;
ob->par1= v1-1;
ob->par2= v2-1;
@@ -260,17 +260,17 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_parent_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Vertex Parent";
+ ot->name = "Make Vertex Parent";
ot->description = "Parent selected objects to the selected vertices";
- ot->idname= "OBJECT_OT_vertex_parent_set";
+ ot->idname = "OBJECT_OT_vertex_parent_set";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->poll= vertex_parent_set_poll;
- ot->exec= vertex_parent_set_exec;
+ ot->invoke = WM_operator_confirm;
+ ot->poll = vertex_parent_set_poll;
+ ot->exec = vertex_parent_set_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** Make Proxy Operator *************************/
@@ -375,7 +375,7 @@ static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSE
Object *ob= ED_object_active_context(C);
GroupObject *go;
- if(!ob || !ob->dup_group)
+ if (!ob || !ob->dup_group)
return DummyRNA_DEFAULT_items;
/* find the object to affect */
@@ -396,22 +396,22 @@ void OBJECT_OT_proxy_make (wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Make Proxy";
- ot->idname= "OBJECT_OT_proxy_make";
- ot->description= "Add empty object to become local replacement data of a library-linked object";
+ ot->name = "Make Proxy";
+ ot->idname = "OBJECT_OT_proxy_make";
+ ot->description = "Add empty object to become local replacement data of a library-linked object";
/* callbacks */
- ot->invoke= make_proxy_invoke;
- ot->exec= make_proxy_exec;
- ot->poll= ED_operator_object_active;
+ ot->invoke = make_proxy_invoke;
+ ot->exec = make_proxy_exec;
+ 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 */
RNA_def_enum_funcs(prop, proxy_group_object_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
/********************** Clear Parent Operator ******************* */
@@ -430,17 +430,17 @@ void ED_object_parent_clear(bContext *C, int type)
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
{
- if(ob->parent == NULL)
+ if (ob->parent == NULL)
continue;
- if(type == 0) {
+ if (type == 0) {
ob->parent= NULL;
}
- else if(type == 1) {
+ else if (type == 1) {
ob->parent= NULL;
object_apply_mat4(ob, ob->obmat, TRUE, FALSE);
}
- else if(type == 2)
+ else if (type == 2)
unit_m4(ob->parentinv);
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
@@ -464,20 +464,20 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
void OBJECT_OT_parent_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Parent";
+ ot->name = "Clear Parent";
ot->description = "Clear the object's parenting";
- ot->idname= "OBJECT_OT_parent_clear";
+ ot->idname = "OBJECT_OT_parent_clear";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= parent_clear_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = parent_clear_exec;
- ot->poll= ED_operator_object_active_editable;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_clear_parent_types, 0, "Type", "");
}
/* ******************** Make Parent Operator *********************** */
@@ -524,20 +524,20 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
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;
- if((cu->flag & CU_PATH)==0) {
+ 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;
/* if follow, add F-Curve for ctime (i.e. "eval_time") so that path-follow works */
- if(partype == PAR_FOLLOW) {
+ if (partype == PAR_FOLLOW) {
/* get or create F-Curve */
bAction *act = verify_adt_action(&cu->id, 1);
FCurve *fcu = verify_fcurve(act, NULL, "eval_time", 0, 1);
@@ -548,14 +548,14 @@ 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)
+ if (partype == PAR_FOLLOW)
partype= PAR_OBJECT;
}
}
- else if(partype==PAR_BONE) {
+ 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;
}
@@ -620,7 +620,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
ob->partype= PAROBJECT; /* note, dna define, not operator property */
/* constraint */
- if(partype == PAR_PATH_CONST) {
+ if (partype == PAR_PATH_CONST) {
bConstraint *con;
bFollowPathConstraint *data;
float cmat[4][4], vec[3];
@@ -637,12 +637,12 @@ 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) {
- if(partype == PAR_ARMATURE_NAME)
+ 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)
+ else if (partype == PAR_ARMATURE_ENVELOPE)
create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_ENVELOPE, 0);
- else if(partype == PAR_ARMATURE_AUTO) {
+ else if (partype == PAR_ARMATURE_AUTO) {
WM_cursor_wait(1);
create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_AUTO, 0);
WM_cursor_wait(0);
@@ -705,19 +705,19 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSE
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);
}
- else if(ob->type == OB_LATTICE) {
+ else if (ob->type == OB_LATTICE) {
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_LATTICE);
}
@@ -730,18 +730,18 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSE
void OBJECT_OT_parent_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Parent";
+ ot->name = "Make Parent";
ot->description = "Set the object's parenting";
- ot->idname= "OBJECT_OT_parent_set";
+ ot->idname = "OBJECT_OT_parent_set";
/* api callbacks */
- ot->invoke= parent_set_invoke;
- ot->exec= parent_set_exec;
+ ot->invoke = parent_set_invoke;
+ ot->exec = parent_set_exec;
- ot->poll= ED_operator_object_active;
+ 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", "");
}
@@ -787,17 +787,17 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Parent without Inverse";
+ ot->name = "Make Parent without Inverse";
ot->description = "Set the object's parenting without setting the inverse parent correction";
- ot->idname= "OBJECT_OT_parent_no_inverse_set";
+ ot->idname = "OBJECT_OT_parent_no_inverse_set";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= parent_noinv_set_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = parent_noinv_set_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ Clear Slow Parent Operator *********************/
@@ -808,8 +808,8 @@ static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene= CTX_data_scene(C);
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if(ob->parent) {
- if(ob->partype & PARSLOW) {
+ if (ob->parent) {
+ if (ob->partype & PARSLOW) {
ob->partype -= PARSLOW;
where_is_object(scene, ob);
ob->partype |= PARSLOW;
@@ -829,17 +829,17 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Slow Parent";
+ ot->name = "Clear Slow Parent";
ot->description = "Clear the object's slow parent";
- ot->idname= "OBJECT_OT_slow_parent_clear";
+ ot->idname = "OBJECT_OT_slow_parent_clear";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= object_slow_parent_clear_exec;
- ot->poll= ED_operator_view3d_active;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = object_slow_parent_clear_exec;
+ ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** Make Slow Parent Operator *********************/
@@ -850,7 +850,7 @@ static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene= CTX_data_scene(C);
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if(ob->parent)
+ if (ob->parent)
ob->partype |= PARSLOW;
ob->recalc |= OB_RECALC_OB;
@@ -868,17 +868,17 @@ void OBJECT_OT_slow_parent_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Slow Parent";
+ ot->name = "Set Slow Parent";
ot->description = "Set the object's slow parent";
- ot->idname= "OBJECT_OT_slow_parent_set";
+ ot->idname = "OBJECT_OT_slow_parent_set";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= object_slow_parent_set_exec;
- ot->poll= ED_operator_view3d_active;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = object_slow_parent_set_exec;
+ ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Clear Track Operator ******************* */
@@ -896,7 +896,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
int type= RNA_enum_get(op->ptr, "type");
- if(CTX_data_edit_object(C)) {
+ if (CTX_data_edit_object(C)) {
BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode");
return OPERATOR_CANCELLED;
}
@@ -914,7 +914,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
remove_constraint(&ob->constraints, con);
}
- if(type == 1)
+ if (type == 1)
object_apply_mat4(ob, ob->obmat, TRUE, TRUE);
}
CTX_DATA_END;
@@ -929,20 +929,20 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
void OBJECT_OT_track_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear track";
+ ot->name = "Clear track";
ot->description = "Clear tracking constraint or flag from object";
- ot->idname= "OBJECT_OT_track_clear";
+ ot->idname = "OBJECT_OT_track_clear";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= object_track_clear_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = object_track_clear_exec;
- ot->poll= ED_operator_objectmode;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_clear_track_types, 0, "Type", "");
}
/************************** Make Track Operator *****************************/
@@ -962,12 +962,12 @@ static int track_set_exec(bContext *C, wmOperator *op)
int type= RNA_enum_get(op->ptr, "type");
- if(type == 1) {
+ if (type == 1) {
bConstraint *con;
bDampTrackConstraint *data;
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if(ob!=obact) {
+ if (ob!=obact) {
con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_DAMPTRACK);
data = con->data;
@@ -981,12 +981,12 @@ static int track_set_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
}
- else if(type == 2) {
+ else if (type == 2) {
bConstraint *con;
bTrackToConstraint *data;
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if(ob!=obact) {
+ if (ob!=obact) {
con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
data = con->data;
@@ -1002,12 +1002,12 @@ static int track_set_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
}
- else if(type == 3) {
+ else if (type == 3) {
bConstraint *con;
bLockTrackConstraint *data;
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if(ob!=obact) {
+ if (ob!=obact) {
con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_LOCKTRACK);
data = con->data;
@@ -1034,21 +1034,21 @@ static int track_set_exec(bContext *C, wmOperator *op)
void OBJECT_OT_track_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Track";
+ ot->name = "Make Track";
ot->description = "Make the object track another object, either by constraint or old way or locked track";
- ot->idname= "OBJECT_OT_track_set";
+ ot->idname = "OBJECT_OT_track_set";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= track_set_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = track_set_exec;
- ot->poll= ED_operator_objectmode;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_make_track_types, 0, "Type", "");
}
/************************** Move to Layer Operator *****************************/
@@ -1058,14 +1058,14 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op)
int values[20], a;
unsigned int lay= 0;
- if(!RNA_struct_property_is_set(op->ptr, "layers")) {
+ 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) {
lay |= base->lay;
}
CTX_DATA_END;
- for(a=0; a<20; a++)
+ for (a=0; a<20; a++)
values[a]= (lay & (1<<a));
RNA_boolean_set_array(op->ptr, "layers", values);
@@ -1073,8 +1073,8 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op)
else {
RNA_boolean_get_array(op->ptr, "layers", values);
- for(a=0; a<20; a++)
- if(values[a])
+ for (a=0; a<20; a++)
+ if (values[a])
lay |= (1 << a);
}
@@ -1084,7 +1084,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);
- if(v3d && v3d->localvd) {
+ if (v3d && v3d->localvd) {
return WM_operator_confirm_message(C, op, "Move from localview");
}
else {
@@ -1104,9 +1104,9 @@ static int move_to_layer_exec(bContext *C, wmOperator *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) {
+ 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) {
@@ -1115,7 +1115,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
base->object->lay= lay;
base->object->flag &= ~SELECT;
base->flag &= ~SELECT;
- /* if(base->object->type==OB_LAMP) islamp= 1; */
+ /* if (base->object->type==OB_LAMP) islamp= 1; */
}
CTX_DATA_END;
}
@@ -1127,7 +1127,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
local= base->lay & 0xFF000000;
base->lay= lay + local;
base->object->lay= lay;
- /* if(base->object->type==OB_LAMP) islamp= 1; */
+ /* if (base->object->type==OB_LAMP) islamp= 1; */
}
CTX_DATA_END;
}
@@ -1145,17 +1145,17 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
void OBJECT_OT_move_to_layer(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move to Layer";
+ ot->name = "Move to Layer";
ot->description = "Move the object to different layers";
- ot->idname= "OBJECT_OT_move_to_layer";
+ ot->idname = "OBJECT_OT_move_to_layer";
/* api callbacks */
- ot->invoke= move_to_layer_invoke;
- ot->exec= move_to_layer_exec;
- ot->poll= ED_operator_objectmode;
+ ot->invoke = move_to_layer_invoke;
+ ot->exec = move_to_layer_exec;
+ 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", "");
@@ -1169,11 +1169,11 @@ static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
Scene *sce= (Scene*) BLI_findlink(&bmain->scene, G.curscreen->scenenr-1);
Base *base, *nbase;
- if(sce==0) return;
- if(sce->id.lib) return;
+ if (sce==0) return;
+ if (sce->id.lib) return;
- for(base= FIRSTBASE; base; base= base->next) {
- if(TESTBASE(v3d, base)) {
+ for (base= FIRSTBASE; base; base= base->next) {
+ if (TESTBASE(v3d, base)) {
nbase= MEM_mallocN( sizeof(Base), "newbase");
*nbase= *base;
@@ -1189,24 +1189,24 @@ 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"));
- if(scene_to==NULL) {
+ if (scene_to==NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene not found");
return OPERATOR_CANCELLED;
}
- if(scene_to == CTX_data_scene(C)) {
+ if (scene_to == CTX_data_scene(C)) {
BKE_report(op->reports, RPT_ERROR, "Can't link objects into the same scene");
return OPERATOR_CANCELLED;
}
- if(scene_to->id.lib) {
+ if (scene_to->id.lib) {
BKE_report(op->reports, RPT_ERROR, "Can't link objects into a linked scene");
return OPERATOR_CANCELLED;
}
CTX_DATA_BEGIN(C, Base*, base, selected_bases)
{
- if(!object_in_scene(base->object, scene_to)) {
+ if (!object_in_scene(base->object, scene_to)) {
Base *nbase= MEM_mallocN( sizeof(Base), "newbase");
*nbase= *base;
BLI_addhead( &(scene_to->base), nbase);
@@ -1266,7 +1266,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
ob= ED_object_active_context(C);
CTX_DATA_BEGIN(C, Object*, obt, selected_editable_objects) {
- if(ob != obt) {
+ if (ob != obt) {
if (allow_make_links_data(event, ob, obt)) {
switch(event) {
case MAKE_LINKS_OBDATA: /* obdata */
@@ -1284,7 +1284,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
break;
case MAKE_LINKS_MATERIALS:
/* new approach, using functions from kernel */
- for(a=0; a<ob->totcol; a++) {
+ 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 */
}
@@ -1295,7 +1295,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
break;
case MAKE_LINKS_DUPLIGROUP:
obt->dup_group= ob->dup_group;
- if(obt->dup_group) {
+ if (obt->dup_group) {
id_lib_extern(&obt->dup_group->id);
obt->transflag |= OB_DUPLIGROUP;
}
@@ -1323,22 +1323,22 @@ void OBJECT_OT_make_links_scene(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Link Objects to Scene";
+ ot->name = "Link Objects to Scene";
ot->description = "Link selection to another scene";
- ot->idname= "OBJECT_OT_make_links_scene";
+ ot->idname = "OBJECT_OT_make_links_scene";
/* api callbacks */
- ot->invoke= WM_enum_search_invoke;
- ot->exec= make_links_scene_exec;
+ ot->invoke = WM_enum_search_invoke;
+ ot->exec = make_links_scene_exec;
/* 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", "");
RNA_def_enum_funcs(prop, RNA_scene_local_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
void OBJECT_OT_make_links_data(wmOperatorType *ot)
@@ -1352,19 +1352,19 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Link Data";
+ ot->name = "Link Data";
ot->description = "Make links from the active object to other selected objects";
- ot->idname= "OBJECT_OT_make_links_data";
+ ot->idname = "OBJECT_OT_make_links_data";
/* api callbacks */
- ot->exec= make_links_data_exec;
- ot->poll= ED_operator_object_active;
+ ot->exec = make_links_data_exec;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", make_links_items, 0, "Type", "");
}
@@ -1378,7 +1378,7 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag)
clear_sca_new_poins(); /* sensor/contr/act */
/* duplicate (must set newid) */
- for(base= FIRSTBASE; base; base= base->next) {
+ for (base= FIRSTBASE; base; base= base->next) {
ob= base->object;
/* newid may still have some trash from Outliner tree building,
@@ -1386,8 +1386,8 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag)
*/
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;
@@ -1397,10 +1397,10 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag)
}
ID_NEW(scene->camera);
- if(v3d) ID_NEW(v3d->camera);
+ if (v3d) ID_NEW(v3d->camera);
/* object pointers */
- for(base= FIRSTBASE; base; base= base->next) {
+ for (base= FIRSTBASE; base; base= base->next) {
object_relink(base->object);
}
@@ -1413,8 +1413,8 @@ 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;
+ for (base= FIRSTBASE; base; base= base->next) {
+ if (base->object == ob) base->flag |= OB_DONE;
else base->flag &= ~OB_DONE;
}
@@ -1426,15 +1426,15 @@ static void new_id_matar(Material **matar, int totcol)
ID *id;
int a;
- for(a=0; a<totcol; a++) {
+ for (a=0; a<totcol; a++) {
id= (ID *)matar[a];
- if(id && id->lib == NULL) {
- if(id->newid) {
+ if (id && id->lib == NULL) {
+ if (id->newid) {
matar[a]= (Material *)id->newid;
id_us_plus(id->newid);
id->us--;
}
- else if(id->us>1) {
+ else if (id->us>1) {
matar[a]= copy_material(matar[a]);
id->us--;
id->newid= (ID *)matar[a];
@@ -1454,12 +1454,12 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
ID *id;
int a;
- for(base= FIRSTBASE; base; base= base->next) {
+ for (base= FIRSTBASE; base; base= base->next) {
ob= base->object;
- if(ob->id.lib==NULL && (base->flag & flag)==flag ) {
+ if (ob->id.lib==NULL && (base->flag & flag)==flag ) {
id= ob->data;
- if(id && id->us>1 && id->lib==NULL) {
+ if (id && id->us>1 && id->lib==NULL) {
ob->recalc= OB_RECALC_DATA;
BKE_copy_animdata_id_action(id);
@@ -1467,8 +1467,8 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
switch(ob->type) {
case OB_LAMP:
ob->data= la= copy_lamp(ob->data);
- for(a=0; a<MAX_MTEX; a++) {
- if(la->mtex[a]) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (la->mtex[a]) {
ID_NEW(la->mtex[a]->object);
}
}
@@ -1518,7 +1518,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
}
me= bmain->mesh.first;
- while(me) {
+ while (me) {
ID_NEW(me->texcomesh);
me= me->id.next;
}
@@ -1529,9 +1529,9 @@ static void single_object_action_users(Scene *scene, int flag)
Object *ob;
Base *base;
- for(base= FIRSTBASE; base; base= base->next) {
+ for (base= FIRSTBASE; base; base= base->next) {
ob= base->object;
- if(ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
+ if (ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
ob->recalc= OB_RECALC_DATA;
BKE_copy_animdata_id_action(&ob->id);
}
@@ -1546,26 +1546,26 @@ static void single_mat_users(Scene *scene, int flag, int do_textures)
Tex *tex;
int a, b;
- for(base= FIRSTBASE; base; base= base->next) {
+ for (base= FIRSTBASE; base; base= base->next) {
ob= base->object;
- if(ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
+ if (ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
- for(a=1; a<=ob->totcol; a++) {
+ for (a=1; a<=ob->totcol; a++) {
ma= give_current_material(ob, a);
- if(ma) {
+ if (ma) {
/* do not test for LIB_NEW: this functions guaranteed delivers single_users! */
- if(ma->id.us>1) {
+ if (ma->id.us>1) {
man= copy_material(ma);
BKE_copy_animdata_id_action(&man->id);
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) {
+ if (do_textures) {
+ 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);
BKE_copy_animdata_id_action(&tex->id);
@@ -1586,14 +1586,14 @@ static void do_single_tex_user(Tex **from)
Tex *tex, *texn;
tex= *from;
- if(tex==NULL) return;
+ if (tex==NULL) return;
- if(tex->id.newid) {
+ if (tex->id.newid) {
*from= (Tex *)tex->id.newid;
id_us_plus(tex->id.newid);
tex->id.us--;
}
- else if(tex->id.us>1) {
+ else if (tex->id.us>1) {
texn= copy_texture(tex);
BKE_copy_animdata_id_action(&texn->id);
tex->id.newid= (ID *)texn;
@@ -1610,30 +1610,30 @@ static void single_tex_users_expand(Main *bmain)
World *wo;
int b;
- for(ma= bmain->mat.first; ma; ma=ma->id.next) {
- if(ma->id.flag & LIB_NEW) {
- for(b=0; b<MAX_MTEX; b++) {
- if(ma->mtex[b] && ma->mtex[b]->tex) {
+ for (ma= bmain->mat.first; ma; ma=ma->id.next) {
+ if (ma->id.flag & LIB_NEW) {
+ for (b=0; b<MAX_MTEX; b++) {
+ if (ma->mtex[b] && ma->mtex[b]->tex) {
do_single_tex_user( &(ma->mtex[b]->tex) );
}
}
}
}
- for(la= bmain->lamp.first; la; la=la->id.next) {
- if(la->id.flag & LIB_NEW) {
- for(b=0; b<MAX_MTEX; b++) {
- if(la->mtex[b] && la->mtex[b]->tex) {
+ for (la= bmain->lamp.first; la; la=la->id.next) {
+ if (la->id.flag & LIB_NEW) {
+ for (b=0; b<MAX_MTEX; b++) {
+ if (la->mtex[b] && la->mtex[b]->tex) {
do_single_tex_user( &(la->mtex[b]->tex) );
}
}
}
}
- for(wo= bmain->world.first; wo; wo=wo->id.next) {
- if(wo->id.flag & LIB_NEW) {
- for(b=0; b<MAX_MTEX; b++) {
- if(wo->mtex[b] && wo->mtex[b]->tex) {
+ for (wo= bmain->world.first; wo; wo=wo->id.next) {
+ if (wo->id.flag & LIB_NEW) {
+ for (b=0; b<MAX_MTEX; b++) {
+ if (wo->mtex[b] && wo->mtex[b]->tex) {
do_single_tex_user( &(wo->mtex[b]->tex) );
}
}
@@ -1651,27 +1651,27 @@ static void single_mat_users_expand(Main *bmain)
Material *ma;
int a;
- for(ob=bmain->object.first; ob; ob=ob->id.next)
- if(ob->id.flag & LIB_NEW)
+ 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)
- if(me->id.flag & LIB_NEW)
+ 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)
- if(cu->id.flag & LIB_NEW)
+ 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)
- if(mb->id.flag & LIB_NEW)
+ 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)
- if(ma->id.flag & LIB_NEW)
- for(a=0; a<MAX_MTEX; a++)
- if(ma->mtex[a])
+ for (ma=bmain->mat.first; ma; ma=ma->id.next)
+ if (ma->id.flag & LIB_NEW)
+ for (a=0; a<MAX_MTEX; a++)
+ if (ma->mtex[a])
ID_NEW(ma->mtex[a]->object);
}
@@ -1680,7 +1680,7 @@ void ED_object_single_users(Main *bmain, Scene *scene, int full)
{
single_object_users(scene, NULL, 0);
- if(full) {
+ if (full) {
single_obdata_users(bmain, scene, 0);
single_object_action_users(scene, 0);
single_mat_users_expand(bmain);
@@ -1700,12 +1700,12 @@ static void make_local_makelocalmaterial(Material *ma)
id_make_local(&ma->id, 0);
- for(b=0; b<MAX_MTEX; b++)
- if(ma->mtex[b] && ma->mtex[b]->tex)
+ 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);
- if(adt) BKE_animdata_make_local(adt);
+ if (adt) BKE_animdata_make_local(adt);
/* nodetree? XXX */
}
@@ -1720,7 +1720,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
ID *id;
int a, b, mode= RNA_enum_get(op->ptr, "type");
- if(mode==3) {
+ 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;
@@ -1729,14 +1729,14 @@ static int make_local_exec(bContext *C, wmOperator *op)
clear_id_newpoins();
CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
- if(ob->id.lib)
+ 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) {
+ if (ob->id.lib==NULL) {
ID_NEW(ob->parent);
}
}
@@ -1745,51 +1745,51 @@ static int make_local_exec(bContext *C, wmOperator *op)
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);
- if(adt) BKE_animdata_make_local(adt);
+ if (adt) BKE_animdata_make_local(adt);
/* tag indirect data direct */
matarar= (Material ***)give_matarar(ob);
- if(matarar) {
- for(a=0; a<ob->totcol; a++) {
+ if (matarar) {
+ for (a=0; a<ob->totcol; a++) {
ma= (*matarar)[a];
- if(ma)
+ 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);
- if(adt) BKE_animdata_make_local(adt);
+ if (adt) BKE_animdata_make_local(adt);
}
CTX_DATA_END;
- if(mode>1) {
+ if (mode>1) {
CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
- if(ob->type==OB_LAMP) {
+ if (ob->type==OB_LAMP) {
la= ob->data;
- for(b=0; b<MAX_MTEX; b++)
- if(la->mtex[b] && la->mtex[b]->tex)
+ 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++) {
+ for (a=0; a<ob->totcol; a++) {
ma= ob->mat[a];
- if(ma)
+ if (ma)
make_local_makelocalmaterial(ma);
}
matarar= (Material ***)give_matarar(ob);
- if(matarar) {
- for(a=0; a<ob->totcol; a++) {
+ if (matarar) {
+ for (a=0; a<ob->totcol; a++) {
ma= (*matarar)[a];
- if(ma)
+ if (ma)
make_local_makelocalmaterial(ma);
}
}
@@ -1812,20 +1812,20 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Make Local";
+ ot->name = "Make Local";
ot->description = "Make library linked datablocks local to this file";
- ot->idname= "OBJECT_OT_make_local";
+ ot->idname = "OBJECT_OT_make_local";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= make_local_exec;
- ot->poll= ED_operator_objectmode;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = make_local_exec;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
}
static int make_single_user_exec(bContext *C, wmOperator *op)
@@ -1835,20 +1835,20 @@ static int make_single_user_exec(bContext *C, wmOperator *op)
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"))
+ if (RNA_boolean_get(op->ptr, "object"))
single_object_users(scene, v3d, flag);
- if(RNA_boolean_get(op->ptr, "obdata"))
+ if (RNA_boolean_get(op->ptr, "obdata"))
single_obdata_users(bmain, scene, flag);
- if(RNA_boolean_get(op->ptr, "material"))
+ if (RNA_boolean_get(op->ptr, "material"))
single_mat_users(scene, flag, RNA_boolean_get(op->ptr, "texture"));
#if 0 /* can't do this separate from materials */
- if(RNA_boolean_get(op->ptr, "texture"))
+ if (RNA_boolean_get(op->ptr, "texture"))
single_mat_users(scene, flag, TRUE);
#endif
- if(RNA_boolean_get(op->ptr, "animation"))
+ if (RNA_boolean_get(op->ptr, "animation"))
single_object_action_users(scene, flag);
clear_id_newpoins();
@@ -1865,20 +1865,20 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Make Single User";
+ ot->name = "Make Single User";
ot->description = "Make linked data local to each object";
- ot->idname= "OBJECT_OT_make_single_user";
+ ot->idname = "OBJECT_OT_make_single_user";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= make_single_user_exec;
- ot->poll= ED_operator_objectmode;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = make_single_user_exec;
+ 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", type_items, SELECT, "Type", "");
RNA_def_boolean(ot->srna, "object", 0, "Object", "Make single user objects");
RNA_def_boolean(ot->srna, "obdata", 0, "Object Data", "Make single user object data");
@@ -1896,7 +1896,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even
RNA_string_get(op->ptr, "name", name);
ma= (Material *)find_id("MA", name);
- if(base==NULL || ma==NULL)
+ if (base==NULL || ma==NULL)
return OPERATOR_CANCELLED;
assign_material(base->object, ma, 1);
@@ -1913,16 +1913,16 @@ void OBJECT_OT_drop_named_material(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Drop Named Material on Object";
+ ot->name = "Drop Named Material on Object";
ot->description = "";
- ot->idname= "OBJECT_OT_drop_named_material";
+ ot->idname = "OBJECT_OT_drop_named_material";
/* api callbacks */
- ot->invoke= drop_named_material_invoke;
- ot->poll= ED_operator_objectmode;
+ ot->invoke = drop_named_material_invoke;
+ ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
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 9e11146db70..53726d70cf9 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -107,7 +107,7 @@ void ED_base_object_activate(bContext *C, Base *base)
/* sets scene->basact */
BASACT= base;
- if(base) {
+ if (base) {
/* XXX old signals, remember to handle notifiers now! */
// select_actionchannel_by_name(base->object->action, "Object", 1);
@@ -126,9 +126,9 @@ static int objects_selectable_poll(bContext *C)
* still allowed then for inspection of scene */
Object *obact= CTX_data_active_object(C);
- if(CTX_data_edit_object(C))
+ if (CTX_data_edit_object(C))
return 0;
- if(obact && obact->mode)
+ if (obact && obact->mode)
return 0;
return 1;
@@ -151,7 +151,7 @@ static int object_select_by_type_exec(bContext *C, wmOperator *op)
}
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if(base->object->type==obtype) {
+ if (base->object->type==obtype) {
ED_base_object_select(base, BA_SELECT);
}
}
@@ -165,21 +165,21 @@ static int object_select_by_type_exec(bContext *C, wmOperator *op)
void OBJECT_OT_select_by_type(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select By Type";
+ ot->name = "Select By Type";
ot->description = "Select all visible objects that are of a type";
- ot->idname= "OBJECT_OT_select_by_type";
+ ot->idname = "OBJECT_OT_select_by_type";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= object_select_by_type_exec;
- ot->poll= objects_selectable_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = object_select_by_type_exec;
+ 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");
- ot->prop= RNA_def_enum(ot->srna, "type", object_type_items, 1, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", object_type_items, 1, "Type", "");
}
/*********************** Selection by Links *********************/
@@ -225,67 +225,67 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
}
ob= OBACT;
- if(ob==NULL){
+ if (ob==NULL) {
BKE_report(op->reports, RPT_ERROR, "No Active Object");
return OPERATOR_CANCELLED;
}
- if(nr==1) {
+ 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;
+ else if (nr==2) {
+ if (ob->data==NULL) return OPERATOR_CANCELLED;
obdata= ob->data;
}
- else if(nr==3 || nr==4) {
+ 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;
+ 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) {
+ 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) {
+ else if (nr==3 || nr==4) {
ob= base->object;
- for(a=1; a<=ob->totcol; a++) {
+ for (a=1; a<=ob->totcol; a++) {
mat1= give_current_material(ob, a);
- if(nr==3) {
- if(mat1==mat) base->flag |= SELECT;
+ if (nr==3) {
+ if (mat1==mat) base->flag |= SELECT;
changed = 1;
}
- else if(mat1 && nr==4) {
- for(b=0; b<MAX_MTEX; b++) {
- if(mat1->mtex[b]) {
- if(tex==mat1->mtex[b]->tex) {
+ else if (mat1 && nr==4) {
+ for (b=0; b<MAX_MTEX; b++) {
+ if (mat1->mtex[b]) {
+ 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,14 +320,14 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
}
}
}
- else if(nr==7) {
- if(ob->id.lib == base->object->id.lib) {
+ else if (nr==7) {
+ if (ob->id.lib == base->object->id.lib) {
base->flag |= SELECT;
changed= 1;
}
}
- else if(nr==8) {
- if(base->object->data && ((ID *)ob->data)->lib == ((ID *)base->object->data)->lib) {
+ else if (nr==8) {
+ if (base->object->data && ((ID *)ob->data)->lib == ((ID *)base->object->data)->lib) {
base->flag |= SELECT;
changed= 1;
}
@@ -347,21 +347,21 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
void OBJECT_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Linked";
+ ot->name = "Select Linked";
ot->description = "Select all visible objects that are linked";
- ot->idname= "OBJECT_OT_select_linked";
+ ot->idname = "OBJECT_OT_select_linked";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= object_select_linked_exec;
- ot->poll= objects_selectable_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = object_select_linked_exec;
+ 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");
- ot->prop= RNA_def_enum(ot->srna, "type", prop_select_linked_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_select_linked_types, 0, "Type", "");
}
/*********************** Selected Grouped ********************/
@@ -414,7 +414,7 @@ static short select_grouped_parent(bContext *C) /* Makes parent active and de-se
baspar= object_in_scene(basact->object->parent, scene);
/* can be NULL if parent in other scene */
- if(baspar && BASE_SELECTABLE(v3d, baspar)) {
+ if (baspar && BASE_SELECTABLE(v3d, baspar)) {
ED_base_object_select(basact, BA_DESELECT);
ED_base_object_select(baspar, BA_SELECT);
ED_base_object_activate(C, baspar);
@@ -569,7 +569,7 @@ 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 ) {
+ for ( prop= a->prop.first; prop; prop = prop->next ) {
if ( get_ob_property(b, prop->name) )
return 1;
}
@@ -644,23 +644,23 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
}
ob= OBACT;
- if(ob==NULL) {
+ 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));
@@ -673,21 +673,21 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
void OBJECT_OT_select_grouped(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Grouped";
+ ot->name = "Select Grouped";
ot->description = "Select all visible objects grouped by various properties";
- ot->idname= "OBJECT_OT_select_grouped";
+ ot->idname = "OBJECT_OT_select_grouped";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= object_select_grouped_exec;
- ot->poll= objects_selectable_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = object_select_grouped_exec;
+ 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");
- ot->prop= RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
}
/************************* Select by Layer **********************/
@@ -708,7 +708,7 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op)
}
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if(base->lay == (1<< (layernum -1)))
+ if (base->lay == (1<< (layernum -1)))
ED_base_object_select(base, BA_SELECT);
}
CTX_DATA_END;
@@ -722,17 +722,17 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op)
void OBJECT_OT_select_by_layer(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select by Layer";
+ ot->name = "Select by Layer";
ot->description = "Select all visible objects on a layer";
- ot->idname= "OBJECT_OT_select_by_layer";
+ ot->idname = "OBJECT_OT_select_by_layer";
/* api callbacks */
/*ot->invoke = XXX - need a int grid popup*/
- ot->exec= object_select_by_layer_exec;
- ot->poll= objects_selectable_poll;
+ ot->exec = object_select_by_layer_exec;
+ 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");
@@ -770,7 +770,8 @@ static int object_select_all_exec(bContext *C, wmOperator *op)
case SEL_INVERT:
if (base->flag & SELECT) {
ED_base_object_select(base, BA_DESELECT);
- } else {
+ }
+ else {
ED_base_object_select(base, BA_SELECT);
}
break;
@@ -787,16 +788,16 @@ void OBJECT_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect All";
+ ot->name = "(De)select All";
ot->description = "Change selection of all visible objects in scene";
- ot->idname= "OBJECT_OT_select_all";
+ ot->idname = "OBJECT_OT_select_all";
/* api callbacks */
- ot->exec= object_select_all_exec;
- ot->poll= objects_selectable_poll;
+ ot->exec = object_select_all_exec;
+ ot->poll = objects_selectable_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -836,16 +837,16 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Same Group";
+ ot->name = "Select Same Group";
ot->description = "Select object in the same group";
- ot->idname= "OBJECT_OT_select_same_group";
+ ot->idname = "OBJECT_OT_select_same_group";
/* api callbacks */
- ot->exec= object_select_same_group_exec;
- ot->poll= objects_selectable_poll;
+ ot->exec = object_select_same_group_exec;
+ 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");
}
@@ -863,12 +864,12 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op)
flip_side_name(tmpname, primbase->object->id.name+2, TRUE);
- if(strcmp(tmpname, primbase->object->id.name+2)!=0) { /* names differ */
+ if (strcmp(tmpname, primbase->object->id.name+2)!=0) { /* names differ */
Object *ob= (Object *)find_id("OB", tmpname);
- if(ob) {
+ if (ob) {
Base *secbase= object_in_scene(ob, scene);
- if(secbase) {
+ if (secbase) {
ED_base_object_select(secbase, BA_SELECT);
}
}
@@ -889,16 +890,16 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Mirror";
+ ot->name = "Select Mirror";
ot->description = "Select the Mirror objects of the selected object eg. L.sword -> R.sword";
- ot->idname= "OBJECT_OT_select_mirror";
+ ot->idname = "OBJECT_OT_select_mirror";
/* api callbacks */
- ot->exec= object_select_mirror_exec;
- ot->poll= objects_selectable_poll;
+ ot->exec = object_select_mirror_exec;
+ 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");
}
@@ -936,17 +937,17 @@ static int object_select_random_exec(bContext *C, wmOperator *op)
void OBJECT_OT_select_random(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Random";
+ ot->name = "Select Random";
ot->description = "Set select on random visible objects";
- ot->idname= "OBJECT_OT_select_random";
+ ot->idname = "OBJECT_OT_select_random";
/* api callbacks */
- /*ot->invoke= object_select_random_invoke XXX - need a number popup ;*/
+ /*ot->invoke = object_select_random_invoke XXX - need a number popup ;*/
ot->exec = object_select_random_exec;
- ot->poll= objects_selectable_poll;
+ 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 b186f788bbf..959bda22263 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -76,7 +76,7 @@
static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int from_mix)
{
- if(object_insert_shape_key(scene, ob, NULL, from_mix)) {
+ if (object_insert_shape_key(scene, ob, NULL, from_mix)) {
Key *key= ob_get_key(ob);
ob->shapenr= BLI_countlist(&key->block);
@@ -94,22 +94,22 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
//IpoCurve *icu;
key= ob_get_key(ob);
- if(key==NULL)
+ if (key==NULL)
return 0;
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)
+ if (kb) {
+ 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) {
+ if (key->refkey== kb) {
key->refkey= key->block.first;
- if(key->refkey) {
+ if (key->refkey) {
/* apply new basis key on original data */
switch(ob->type) {
case OB_MESH:
@@ -126,36 +126,36 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
}
}
- if(kb->data) MEM_freeN(kb->data);
+ if (kb->data) MEM_freeN(kb->data);
MEM_freeN(kb);
- for(kb= key->block.first; kb; kb= kb->next)
- if(kb->adrcode>=ob->shapenr)
+ for (kb= key->block.first; kb; kb= kb->next)
+ if (kb->adrcode>=ob->shapenr)
kb->adrcode--;
#if 0 // XXX old animation system
- if(key->ipo) {
+ if (key->ipo) {
- for(icu= key->ipo->curve.first; icu; icu= icu->next) {
- if(icu->adrcode==ob->shapenr-1) {
+ for (icu= key->ipo->curve.first; icu; icu= icu->next) {
+ if (icu->adrcode==ob->shapenr-1) {
BLI_remlink(&key->ipo->curve, icu);
free_ipo_curve(icu);
break;
}
}
- for(icu= key->ipo->curve.first; icu; icu= icu->next)
- if(icu->adrcode>=ob->shapenr)
+ for (icu= key->ipo->curve.first; icu; icu= icu->next)
+ if (icu->adrcode>=ob->shapenr)
icu->adrcode--;
}
#endif // XXX old animation system
- if(ob->shapenr>1) ob->shapenr--;
+ if (ob->shapenr>1) ob->shapenr--;
}
- 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);
}
@@ -172,33 +172,33 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
Key *key;
key= ob_get_key(ob);
- if(key==NULL)
+ if (key==NULL)
return 0;
kb= BLI_findlink(&key->block, ob->shapenr-1);
- if(kb) {
+ if (kb) {
int i1, i2;
float *fp1, *fp2;
float tvec[3];
char *tag_elem= MEM_callocN(sizeof(char) * kb->totelem, "shape_key_mirror");
- if(ob->type==OB_MESH) {
+ 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++) {
+ for (i1=0, mv=me->mvert; i1<me->totvert; i1++, mv++) {
i2= mesh_get_x_mirror_vert(ob, i1);
- if(i2==i1) {
+ if (i2==i1) {
fp1= ((float *)kb->data) + i1*3;
fp1[0] = -fp1[0];
tag_elem[i1]= 1;
}
- else if(i2 != -1) {
- if(tag_elem[i1]==0 && tag_elem[i2]==0) {
+ 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;
@@ -224,17 +224,17 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
/* half but found up odd value */
const int pntsu_half = (lt->pntsu / 2) + (lt->pntsu % 2);
- /* currently editmode isnt supported by mesh so
+ /* currently editmode isn't supported by mesh so
* ignore here for now too */
- /* if(lt->editlatt) lt= lt->editlatt->latt; */
+ /* 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++) {
+ 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) {
+ if (u == u_inv) {
i1= LT_INDEX(lt, u, v, w);
fp1= ((float *)kb->data) + i1*3;
fp1[0]= -fp1[0];
@@ -296,16 +296,16 @@ static int shape_key_add_exec(bContext *C, wmOperator *op)
void OBJECT_OT_shape_key_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Shape Key";
- ot->idname= "OBJECT_OT_shape_key_add";
- ot->description= "Add shape key to the object";
+ ot->name = "Add Shape Key";
+ ot->idname = "OBJECT_OT_shape_key_add";
+ ot->description = "Add shape key to the object";
/* api callbacks */
- ot->poll= shape_key_mode_poll;
- ot->exec= shape_key_add_exec;
+ ot->poll = shape_key_mode_poll;
+ 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");
@@ -315,7 +315,7 @@ static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= ED_object_context(C);
- if(!ED_object_shape_key_remove(C, ob))
+ if (!ED_object_shape_key_remove(C, ob))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -324,16 +324,16 @@ static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Shape Key";
- ot->idname= "OBJECT_OT_shape_key_remove";
- ot->description= "Remove shape key from the object";
+ ot->name = "Remove Shape Key";
+ ot->idname = "OBJECT_OT_shape_key_remove";
+ ot->description = "Remove shape key from the object";
/* api callbacks */
- ot->poll= shape_key_mode_poll;
- ot->exec= shape_key_remove_exec;
+ ot->poll = shape_key_mode_poll;
+ 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))
@@ -342,10 +342,10 @@ static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
Key *key= ob_get_key(ob);
KeyBlock *kb= ob_get_keyblock(ob);
- if(!key || !kb)
+ 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->curval= 0.0f;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -357,23 +357,23 @@ static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_shape_key_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Shape Keys";
- ot->description= "Clear weights for all shape keys";
- ot->idname= "OBJECT_OT_shape_key_clear";
+ ot->name = "Clear Shape Keys";
+ ot->description = "Clear weights for all shape keys";
+ ot->idname = "OBJECT_OT_shape_key_clear";
/* api callbacks */
- ot->poll= shape_key_poll;
- ot->exec= shape_key_clear_exec;
+ ot->poll = shape_key_poll;
+ ot->exec = shape_key_clear_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);
- if(!object_shape_key_mirror(C, ob))
+ if (!object_shape_key_mirror(C, ob))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -382,15 +382,15 @@ static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_shape_key_mirror(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mirror Shape Key";
- ot->idname= "OBJECT_OT_shape_key_mirror";
+ ot->name = "Mirror Shape Key";
+ ot->idname = "OBJECT_OT_shape_key_mirror";
/* api callbacks */
- ot->poll= shape_key_mode_poll;
- ot->exec= shape_key_mirror_exec;
+ ot->poll = shape_key_mode_poll;
+ ot->exec = shape_key_mirror_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -401,26 +401,26 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
int type= RNA_enum_get(op->ptr, "type");
Key *key= ob_get_key(ob);
- if(key) {
+ 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);
- 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) {
- if(kb_other->relative == shapenr_act) {
+ for (kb_other= key->block.first; kb_other; kb_other= kb_other->next) {
+ if (kb_other->relative == shapenr_act) {
kb_other->relative += type;
}
- else if(kb_other->relative == shapenr_swap) {
+ else if (kb_other->relative == shapenr_swap) {
kb_other->relative -= type;
}
}
- if(type==-1) {
+ if (type==-1) {
/* move back */
kb_other= kb->prev;
BLI_remlink(&key->block, kb);
@@ -451,15 +451,15 @@ void OBJECT_OT_shape_key_move(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Move Shape Key";
- ot->idname= "OBJECT_OT_shape_key_move";
+ ot->name = "Move Shape Key";
+ ot->idname = "OBJECT_OT_shape_key_move";
/* api callbacks */
- ot->poll= shape_key_mode_poll;
- ot->exec= shape_key_move_exec;
+ ot->poll = shape_key_mode_poll;
+ 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 d66f16b0adb..8200bbef2ee 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -40,6 +40,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_group_types.h"
+#include "DNA_lattice_types.h"
#include "BLI_math.h"
#include "BLI_listbase.h"
@@ -259,16 +260,16 @@ static int object_location_clear_exec(bContext *C, wmOperator *op)
void OBJECT_OT_location_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Location";
+ ot->name = "Clear Location";
ot->description = "Clear the object's location";
- ot->idname= "OBJECT_OT_location_clear";
+ ot->idname = "OBJECT_OT_location_clear";
/* api callbacks */
- ot->exec= object_location_clear_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->exec = object_location_clear_exec;
+ 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)
@@ -279,16 +280,16 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op)
void OBJECT_OT_rotation_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Rotation";
+ ot->name = "Clear Rotation";
ot->description = "Clear the object's rotation";
- ot->idname= "OBJECT_OT_rotation_clear";
+ ot->idname = "OBJECT_OT_rotation_clear";
/* api callbacks */
- ot->exec= object_rotation_clear_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->exec = object_rotation_clear_exec;
+ 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)
@@ -299,16 +300,16 @@ static int object_scale_clear_exec(bContext *C, wmOperator *op)
void OBJECT_OT_scale_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Scale";
+ ot->name = "Clear Scale";
ot->description = "Clear the object's scale";
- ot->idname= "OBJECT_OT_scale_clear";
+ ot->idname = "OBJECT_OT_scale_clear";
/* api callbacks */
- ot->exec= object_scale_clear_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->exec = object_scale_clear_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* --------------- */
@@ -345,16 +346,16 @@ static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_origin_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Origin";
+ ot->name = "Clear Origin";
ot->description = "Clear the object's origin";
- ot->idname= "OBJECT_OT_origin_clear";
+ ot->idname = "OBJECT_OT_origin_clear";
/* api callbacks */
- ot->exec= object_origin_clear_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->exec = object_origin_clear_exec;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/*************************** Apply Transformation ****************************/
@@ -367,8 +368,8 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob )
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) {
- if(ob_child->parent == ob) {
+ 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);
invert_m4_m4(ob_child->parentinv, workob.obmat);
@@ -386,33 +387,39 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
/* first check if we can execute */
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if(ob->type==OB_MESH) {
- if(ID_REAL_USERS(ob->data) > 1) {
+ 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) {
- if(ID_REAL_USERS(ob->data) > 1) {
+ 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;
}
}
- else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ else if (ob->type == OB_LATTICE) {
+ if (ID_REAL_USERS(ob->data) > 1) {
+ BKE_report(reports, RPT_ERROR, "Can't apply to a multi user lattice, doing nothing");
+ return OPERATOR_CANCELLED;
+ }
+ }
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu;
- if(ID_REAL_USERS(ob->data) > 1) {
+ if (ID_REAL_USERS(ob->data) > 1) {
BKE_report(reports, RPT_ERROR, "Can't apply to a multi user curve, doing nothing");
return OPERATOR_CANCELLED;
}
cu= ob->data;
- if(!(cu->flag & CU_3D) && (apply_rot || apply_loc)) {
+ 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");
return OPERATOR_CANCELLED;
}
- if(cu->key) {
+ if (cu->key) {
BKE_report(reports, RPT_ERROR, "Can't apply to a curve with vertex keys, doing nothing");
return OPERATOR_CANCELLED;
}
@@ -424,11 +431,11 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
/* calculate rotation/scale matrix */
- if(apply_scale && apply_rot)
+ if (apply_scale && apply_rot)
object_to_mat3(ob, rsmat);
- else if(apply_scale)
+ else if (apply_scale)
object_scale_to_mat3(ob, rsmat);
- else if(apply_rot) {
+ else if (apply_rot) {
float tmat[3][3], timat[3][3];
/* simple rotation matrix */
@@ -446,10 +453,10 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
copy_m4_m3(mat, rsmat);
/* calculate translation */
- if(apply_loc) {
+ if (apply_loc) {
copy_v3_v3(mat[3], ob->loc);
- if(!(apply_scale && apply_rot)) {
+ if (!(apply_scale && apply_rot)) {
/* correct for scale and rotation that is still applied */
object_to_mat3(ob, obmat);
invert_m3_m3(iobmat, obmat);
@@ -459,7 +466,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
}
/* apply to object data */
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
Mesh *me= ob->data;
MVert *mvert;
@@ -467,16 +474,16 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
/* adjust data */
mvert= me->mvert;
- for(a=0; a<me->totvert; a++, mvert++)
+ for (a=0; a<me->totvert; a++, mvert++)
mul_m4_v3(mat, mvert->co);
- if(me->key) {
+ if (me->key) {
KeyBlock *kb;
- for(kb=me->key->block.first; kb; kb=kb->next) {
+ 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);
}
}
@@ -487,7 +494,17 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
else if (ob->type==OB_ARMATURE) {
ED_armature_apply_transform(ob, mat);
}
- else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ else if (ob->type == OB_LATTICE) {
+ Lattice *lt = ob->data;
+ BPoint *bp = lt->def;
+ int a = lt->pntsu * lt->pntsv * lt->pntsw;
+
+ while (a--) {
+ mul_m4_v3(mat, bp->vec);
+ bp++;
+ }
+ }
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu= ob->data;
Nurb *nu;
@@ -496,10 +513,10 @@ 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) {
- if(nu->type == CU_BEZIER) {
+ for (nu=cu->nurb.first; nu; nu=nu->next) {
+ if (nu->type == CU_BEZIER) {
a= nu->pntsu;
- for(bezt= nu->bezt; a--; bezt++) {
+ 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]);
@@ -509,7 +526,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
}
else {
a= nu->pntsu*nu->pntsv;
- for(bp= nu->bp; a--; bp++)
+ for (bp= nu->bp; a--; bp++)
mul_m4_v3(mat, bp->vec);
}
}
@@ -517,18 +534,18 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
else
continue;
- if(apply_loc)
+ if (apply_loc)
zero_v3(ob->loc);
- if(apply_scale)
+ if (apply_scale)
ob->size[0]= ob->size[1]= ob->size[2]= 1.0f;
- if(apply_rot) {
+ if (apply_rot) {
zero_v3(ob->rot);
unit_qt(ob->quat);
unit_axis_angle(ob->rotAxis, &ob->rotAngle);
}
where_is_object(scene, ob);
- if(ob->type==OB_ARMATURE) {
+ if (ob->type==OB_ARMATURE) {
where_is_pose(scene, ob); /* needed for bone parents */
}
@@ -540,7 +557,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
}
CTX_DATA_END;
- if(!change)
+ if (!change)
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
@@ -564,7 +581,7 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
}
CTX_DATA_END;
- if(!change)
+ if (!change)
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
@@ -574,16 +591,16 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_visual_transform_apply(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Apply Visual Transform";
+ ot->name = "Apply Visual Transform";
ot->description = "Apply the object's visual transformation to its data";
- ot->idname= "OBJECT_OT_visual_transform_apply";
+ ot->idname = "OBJECT_OT_visual_transform_apply";
/* api callbacks */
- ot->exec= visual_transform_apply_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->exec = visual_transform_apply_exec;
+ 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)
@@ -592,7 +609,7 @@ static int object_transform_apply_exec(bContext *C, wmOperator *op)
const int rot= RNA_boolean_get(op->ptr, "rotation");
const int sca= RNA_boolean_get(op->ptr, "scale");
- if(loc || rot || sca) {
+ if (loc || rot || sca) {
return apply_objects_internal(C, op->reports, loc, rot, sca);
}
else {
@@ -603,16 +620,16 @@ static int object_transform_apply_exec(bContext *C, wmOperator *op)
void OBJECT_OT_transform_apply(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Apply Object Transform";
+ ot->name = "Apply Object Transform";
ot->description = "Apply the object's transformation to its data";
- ot->idname= "OBJECT_OT_transform_apply";
+ ot->idname = "OBJECT_OT_transform_apply";
/* api callbacks */
- ot->exec= object_transform_apply_exec;
- ot->poll= ED_operator_objectmode;
+ ot->exec = object_transform_apply_exec;
+ 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", "");
@@ -645,32 +662,33 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
else {
- /* get the view settings if 'around' isnt set and the view is available */
+ /* get the view settings if 'around' isn't set and the view is available */
View3D *v3d= CTX_wm_view3d(C);
copy_v3_v3(cursor, give_cursor(scene, v3d));
- if(v3d && !RNA_struct_property_is_set(op->ptr, "center"))
+ if (v3d && !RNA_struct_property_is_set(op->ptr, "center"))
around= v3d->around;
}
zero_v3(cent);
- if(obedit) {
+ if (obedit) {
INIT_MINMAX(min, max);
- if(obedit->type==OB_MESH) {
+ if (obedit->type==OB_MESH) {
Mesh *me= obedit->data;
BMEditMesh *em = me->edit_btmesh;
BMVert *eve;
BMIter iter;
int total = 0;
- if(centermode == ORIGIN_TO_CURSOR) {
+ if (centermode == ORIGIN_TO_CURSOR) {
copy_v3_v3(cent, cursor);
invert_m4_m4(obedit->imat, obedit->obmat);
mul_m4_v3(obedit->imat, cent);
- } else {
+ }
+ else {
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- if(around==V3D_CENTROID) {
+ if (around==V3D_CENTROID) {
total++;
add_v3_v3(cent, eve->co);
mul_v3_fl(cent, 1.0f/(float)total);
@@ -699,31 +717,31 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
for (tob= bmain->object.first; tob; tob= tob->id.next) {
- if(tob->data)
+ if (tob->data)
((ID *)tob->data)->flag &= ~LIB_DOIT;
- if(tob->dup_group)
+ 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) {
+ if ((ob->flag & OB_DONE)==0) {
int do_inverse_offset = FALSE;
ob->flag |= OB_DONE;
- if(centermode == ORIGIN_TO_CURSOR) {
+ if (centermode == ORIGIN_TO_CURSOR) {
copy_v3_v3(cent, cursor);
invert_m4_m4(ob->imat, ob->obmat);
mul_m4_v3(ob->imat, cent);
}
- if(ob->data == NULL) {
+ 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->dup_group->id.lib) {
+ 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++;
}
else {
- if(centermode == ORIGIN_TO_CURSOR) { /* done */ }
+ if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
else {
/* only bounds support */
INIT_MINMAX(min, max);
@@ -745,11 +763,11 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
tot_lib_error++;
}
- if(obedit==NULL && ob->type==OB_MESH) {
+ 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); }
+ if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
+ else if (around==V3D_CENTROID) { mesh_center_median(me, cent); }
else { mesh_center_bounds(me, cent); }
negate_v3_v3(cent_neg, cent);
@@ -762,12 +780,12 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu= ob->data;
- if(centermode == ORIGIN_TO_CURSOR) { /* done */ }
- else if(around==V3D_CENTROID) { curve_center_median(cu, cent); }
+ if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
+ 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))
+ if ((ob->type == OB_CURVE) && !(cu->flag & CU_3D))
cent[2] = 0.0;
negate_v3_v3(cent_neg, cent);
@@ -777,23 +795,23 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
cu->id.flag |= LIB_DOIT;
do_inverse_offset= TRUE;
- if(obedit) {
+ if (obedit) {
if (centermode == GEOMETRY_TO_ORIGIN) {
DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
}
break;
}
}
- else if(ob->type==OB_FONT) {
+ else if (ob->type==OB_FONT) {
/* get from bb */
Curve *cu= ob->data;
- if(cu->bb==NULL && (centermode != ORIGIN_TO_CURSOR)) {
+ if (cu->bb==NULL && (centermode != ORIGIN_TO_CURSOR)) {
/* do nothing*/
}
else {
- if(centermode == ORIGIN_TO_CURSOR) {
+ if (centermode == ORIGIN_TO_CURSOR) {
/* done */
}
else {
@@ -811,10 +829,10 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
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) {
+ if (ID_REAL_USERS(arm) > 1) {
#if 0
BKE_report(op->reports, RPT_ERROR, "Can't apply to a multi user armature");
return;
@@ -836,15 +854,15 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
ignore_parent_tx(bmain, scene, ob);
- if(obedit)
+ if (obedit)
break;
}
}
else if (ob->type == OB_MBALL) {
MetaBall *mb = ob->data;
- if(centermode == ORIGIN_TO_CURSOR) { /* done */ }
- else if(around==V3D_CENTROID) { BKE_metaball_center_median(mb, cent); }
+ if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
+ else if (around==V3D_CENTROID) { BKE_metaball_center_median(mb, cent); }
else { BKE_metaball_center_bounds(mb, cent); }
negate_v3_v3(cent_neg, cent);
@@ -854,7 +872,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
mb->id.flag |= LIB_DOIT;
do_inverse_offset= TRUE;
- if(obedit) {
+ if (obedit) {
if (centermode == GEOMETRY_TO_ORIGIN) {
DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
}
@@ -863,7 +881,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
/* offset other selected objects */
- if(do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) {
+ if (do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) {
/* was the object data modified
* note: the functions above must set 'cent' */
copy_v3_v3(centn, cent);
@@ -871,7 +889,7 @@ 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 */
}
@@ -879,7 +897,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
/* other users? */
CTX_DATA_BEGIN(C, Object*, ob_other, selected_editable_objects) {
- if( (ob_other->flag & OB_DONE)==0 &&
+ 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) )
) {
@@ -891,7 +909,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
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);
@@ -904,7 +922,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
for (tob= bmain->object.first; tob; tob= tob->id.next)
- if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT))
+ if (tob->data && (((ID *)tob->data)->flag & LIB_DOIT))
DAG_id_tag_update(&tob->id, OB_RECALC_OB|OB_RECALC_DATA);
if (tot_change) {
@@ -940,20 +958,20 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Set Origin";
+ ot->name = "Set Origin";
ot->description = "Set the object's origin, by either moving the data, or set to center of data, or use 3d cursor";
- ot->idname= "OBJECT_OT_origin_set";
+ ot->idname = "OBJECT_OT_origin_set";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= object_origin_set_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = object_origin_set_exec;
- ot->poll= ED_operator_scene_editable;
+ 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", "");
+ 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 7328cbb2e7a..cc8f91e4558 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -91,9 +91,9 @@ static Lattice *vgroup_edit_lattice(Object *ob)
int ED_vgroup_object_is_edit_mode(Object *ob)
{
- if(ob->type == OB_MESH)
+ if (ob->type == OB_MESH)
return (BMEdit_FromObject(ob) != NULL);
- else if(ob->type == OB_LATTICE)
+ else if (ob->type == OB_LATTICE)
return (((Lattice*)ob->data)->editlatt != NULL);
return 0;
@@ -103,7 +103,7 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name)
{
bDeformGroup *defgroup;
- if(!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type))
+ if (!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type))
return NULL;
defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup");
@@ -136,7 +136,7 @@ void ED_vgroup_delete(Object *ob, bDeformGroup *defgroup)
if (dg == NULL)
return;
- if(ED_vgroup_object_is_edit_mode(ob))
+ if (ED_vgroup_object_is_edit_mode(ob))
vgroup_delete_edit_mode(ob, dg);
else
vgroup_delete_object_mode(ob, dg);
@@ -150,7 +150,7 @@ void ED_vgroup_clear(Object *ob)
while (dg) {
bDeformGroup *next_dg= dg->next;
- if(edit_mode)
+ if (edit_mode)
vgroup_delete_edit_mode(ob, dg);
else
vgroup_delete_object_mode(ob, dg);
@@ -163,12 +163,12 @@ int ED_vgroup_data_create(ID *id)
{
/* create deform verts */
- if(GS(id->name)==ID_ME) {
+ 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) {
+ 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;
@@ -183,13 +183,13 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
*dvert_tot = 0;
*dvert_arr = NULL;
- if(id) {
+ if (id) {
switch(GS(id->name)) {
case ID_ME:
{
Mesh *me = (Mesh *)id;
- if(me->edit_btmesh) {
+ if (me->edit_btmesh) {
BMEditMesh *em = me->edit_btmesh;
BMIter iter;
BMVert *eve;
@@ -221,7 +221,7 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
return 1;
}
- else if(me->dvert) {
+ else if (me->dvert) {
MVert *mvert= me->mvert;
MDeformVert *dvert= me->dvert;
int i;
@@ -254,7 +254,7 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
Lattice *lt= (Lattice *)id;
lt= (lt->editlatt)? lt->editlatt->latt: lt;
- if(lt->dvert) {
+ 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");
@@ -286,7 +286,7 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
/* returns true if the id type supports weights */
int ED_vgroup_give_array(ID *id, MDeformVert **dvert_arr, int *dvert_tot)
{
- if(id) {
+ if (id) {
switch(GS(id->name)) {
case ID_ME:
{
@@ -326,16 +326,16 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
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)) {
+ 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;
}
- 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);
- if(new_vgroup == TRUE) {
+ if (new_vgroup == TRUE) {
/* free the newly added vgroup since it wasn't compatible */
vgroup_delete_all(ob);
}
@@ -347,11 +347,11 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
BLI_duplicatelist(&ob->defbase, &ob_from->defbase);
ob->actdef= ob_from->actdef;
- if(defbase_tot_from < defbase_tot) {
+ 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 */
+ 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);
@@ -360,13 +360,13 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
dvf= dvert_array_from;
dv= dvert_array;
- for(i=0; i<dvert_tot; i++, dvf++, dv++) {
- if((*dv)->dw)
+ for (i=0; i<dvert_tot; i++, dvf++, dv++) {
+ if ((*dv)->dw)
MEM_freeN((*dv)->dw);
*(*dv)= *(*dvf);
- if((*dv)->dw)
+ if ((*dv)->dw)
(*dv)->dw= MEM_dupallocN((*dv)->dw);
}
@@ -392,7 +392,7 @@ static void ED_vgroup_nr_vert_add(Object *ob,
/* 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 */
@@ -418,7 +418,7 @@ static void ED_vgroup_nr_vert_add(Object *ob,
break;
case WEIGHT_ADD:
dw->weight += weight;
- if(dw->weight >= 1.0f)
+ if (dw->weight >= 1.0f)
dw->weight = 1.0f;
break;
case WEIGHT_SUBTRACT:
@@ -426,7 +426,7 @@ static void ED_vgroup_nr_vert_add(Object *ob,
/* if the weight is zero or less then
* remove the vert from the deform group
*/
- if(dw->weight <= 0.0f) {
+ if (dw->weight <= 0.0f) {
defvert_remove_group(dv, dw);
}
break;
@@ -471,11 +471,11 @@ void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight,
/* get the deform group number, exit if
* it can't be found
*/
- if(def_nr < 0) return;
+ if (def_nr < 0) return;
/* 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
@@ -493,7 +493,7 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
/* 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);
- if(def_nr != -1) {
+ if (def_nr != -1) {
MDeformVert *dvert= NULL;
int tot;
@@ -502,7 +502,7 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
*/
ED_vgroup_give_array(ob->data, &dvert, &tot);
- if(dvert) {
+ if (dvert) {
MDeformVert *dv= &dvert[vertnum];
MDeformWeight *dw;
@@ -519,28 +519,28 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
Mesh *me;
/* get the deform vertices corresponding to the vertnum */
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
me= ob->data;
- if(me->edit_btmesh) {
+ if (me->edit_btmesh) {
eve= BM_vert_at_index(me->edit_btmesh->bm, vertnum);
- if(!eve) {
+ if (!eve) {
return 0.0f;
}
dv= CustomData_bmesh_get(&me->edit_btmesh->bm->vdata, eve->head.data, CD_MDEFORMVERT);
}
else {
- if(vertnum >= me->totvert) {
+ if (vertnum >= me->totvert) {
return 0.0f;
}
dv = &me->dvert[vertnum];
}
}
- else if(ob->type==OB_LATTICE) {
+ else if (ob->type==OB_LATTICE) {
Lattice *lt= vgroup_edit_lattice(ob);
- if(lt->dvert) {
- if(vertnum >= lt->pntsu*lt->pntsv*lt->pntsw) {
+ if (lt->dvert) {
+ if (vertnum >= lt->pntsu*lt->pntsv*lt->pntsw) {
return 0.0f;
}
dv = &lt->dvert[vertnum];
@@ -561,7 +561,7 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
{
const int def_nr= BLI_findindex(&ob->defbase, dg);
- if(def_nr == -1) {
+ if (def_nr == -1) {
return -1;
}
@@ -585,7 +585,7 @@ static void vgroup_select_verts(Object *ob, int select)
return;
}
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
Mesh *me= ob->data;
if (me->edit_btmesh) {
@@ -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 {
@@ -628,17 +628,17 @@ static void vgroup_select_verts(Object *ob, int select)
}
}
}
- else if(ob->type == OB_LATTICE) {
+ else if (ob->type == OB_LATTICE) {
Lattice *lt= vgroup_edit_lattice(ob);
- if(lt->dvert) {
+ if (lt->dvert) {
BPoint *bp;
int a, tot;
dv= lt->dvert;
tot= lt->pntsu*lt->pntsv*lt->pntsw;
- for(a=0, bp= lt->def; a<tot; a++, bp++, dv++) {
+ 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;
@@ -657,10 +657,10 @@ static void vgroup_duplicate(Object *ob)
int i, idg, icdg, dvert_tot=0;
dg = BLI_findlink(&ob->defbase, (ob->actdef-1));
- if(!dg)
+ if (!dg)
return;
- if(!strstr(dg->name, "_copy")) {
+ if (!strstr(dg->name, "_copy")) {
BLI_snprintf(name, sizeof(name), "%s_copy", dg->name);
}
else {
@@ -681,10 +681,10 @@ static void vgroup_duplicate(Object *ob)
ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, FALSE);
if (dvert_array) {
- for(i = 0; i < dvert_tot; i++) {
+ for (i = 0; i < dvert_tot; i++) {
MDeformVert *dv= dvert_array[i];
dw_org = defvert_find_index(dv, idg);
- if(dw_org) {
+ if (dw_org) {
/* defvert_verify_index re-allocs org so need to store the weight first */
dw_cpy = defvert_verify_index(dv, icdg);
dw_cpy->weight = dw_org->weight;
@@ -713,7 +713,7 @@ static void vgroup_normalize(Object *ob)
if (dvert_array) {
float weight_max = 0.0f;
- for(i = 0; i < dvert_tot; i++) {
+ for (i = 0; i < dvert_tot; i++) {
/* in case its not selected */
if (!(dv = dvert_array[i])) {
@@ -721,13 +721,13 @@ static void vgroup_normalize(Object *ob)
}
dw = defvert_find_index(dv, def_nr);
- if(dw) {
+ if (dw) {
weight_max = MAX2(dw->weight, weight_max);
}
}
- if(weight_max > 0.0f) {
- for(i = 0; i < dvert_tot; i++) {
+ if (weight_max > 0.0f) {
+ for (i = 0; i < dvert_tot; i++) {
/* in case its not selected */
if (!(dv = dvert_array[i])) {
@@ -735,7 +735,7 @@ static void vgroup_normalize(Object *ob)
}
dw = defvert_find_index(dv, def_nr);
- if(dw) {
+ if (dw) {
dw->weight /= weight_max;
/* in case of division errors with very low weights */
@@ -762,21 +762,21 @@ static int* getSurroundingVerts(Mesh *me, int vert, int *count)
BLI_array_declare(verts);
BLI_array_reserve(verts, 8);
- while(i--) {
+ while (i--) {
int j = mp->totloop;
int first_l = mp->totloop - 1;
MLoop *ml = &me->mloop[mp->loopstart];
- while(j--) {
+ while (j--) {
/* XXX This assume a vert can only be once in a poly, even though
* it seems logical to me, not totally sure of that. */
if (ml->v == vert) {
int a, b, k;
- if(j == first_l) {
+ if (j == first_l) {
/* We are on the first corner. */
a = ml[1].v;
b = ml[j].v;
}
- else if(!j) {
+ else if (!j) {
/* We are on the last corner. */
a = (ml-1)->v;
b = me->mloop[mp->loopstart].v;
@@ -789,15 +789,15 @@ static int* getSurroundingVerts(Mesh *me, int vert, int *count)
/* Append a and b verts to array, if not yet present. */
k = BLI_array_count(verts);
/* XXX Maybe a == b is enough? */
- while(k-- && !(a == b && a == -1)) {
- if(verts[k] == a)
+ while (k-- && !(a == b && a == -1)) {
+ if (verts[k] == a)
a = -1;
- else if(verts[k] == b)
+ else if (verts[k] == b)
b = -1;
}
- if(a != -1)
+ if (a != -1)
BLI_array_append(verts, a);
- if(b != -1)
+ if (b != -1)
BLI_array_append(verts, b);
/* Vert found in this poly, we can go to next one! */
@@ -820,7 +820,7 @@ static void getSingleCoordinate(MVert *points, int count, float coord[3])
{
int i;
zero_v3(coord);
- for(i = 0; i < count; i++) {
+ for (i = 0; i < count; i++) {
add_v3_v3(coord, points[i].co);
}
mul_v3_fl(coord, 1.0f/count);
@@ -853,12 +853,12 @@ 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;
}
- else if(dm) {
+ else if (dm) {
dm->needsFree = 1;
dm->release(dm);
}
@@ -911,56 +911,59 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
copy_v3_v3(oldPos, m.co);
distToStart = dot_v3v3(norm, oldPos) + d;
- if(distToBe == originalDistToBe) {
+ if (distToBe == originalDistToBe) {
distToBe += distToStart - distToStart*strength;
}
- for(i = 0; i < totweight; i++) {
+ for (i = 0; i < totweight; i++) {
dwIndices[i] = i;
dw = (dvert->dw+i);
vc = hc = 0;
- if(!dw->weight) {
+ if (!dw->weight) {
changes[i][0] = 0;
changes[i][1] = 0;
dists[i] = distToStart;
continue;
}
- for(k = 0; k < 2; k++) {
- if(dm) {
+ for (k = 0; k < 2; k++) {
+ if (dm) {
dm_deform_clear(dm, ob); dm = NULL;
}
oldw = dw->weight;
- if(k) {
+ if (k) {
dw->weight *= 1+cp;
- } else {
+ }
+ else {
dw->weight /= 1+cp;
}
- if(dw->weight == oldw) {
+ if (dw->weight == oldw) {
changes[i][0] = 0;
changes[i][1] = 0;
dists[i] = distToStart;
break;
}
- if(dw->weight > 1) {
+ if (dw->weight > 1) {
dw->weight = 1;
}
dm = dm_deform_recalc(scene, ob);
dm->getVert(dm, index, &m);
getVerticalAndHorizontalChange(norm, d, coord, oldPos, distToStart, m.co, changes, dists, i);
dw->weight = oldw;
- if(!k) {
+ if (!k) {
vc = changes[i][0];
hc = changes[i][1];
dist = dists[i];
- } else {
- if(fabs(dist - distToBe) < fabs(dists[i] - distToBe)) {
+ }
+ else {
+ if (fabs(dist - distToBe) < fabs(dists[i] - distToBe)) {
upDown[i] = 0;
changes[i][0] = vc;
changes[i][1] = hc;
dists[i] = dist;
- } else {
+ }
+ else {
upDown[i] = 1;
}
- if(fabs(dists[i] - distToBe) > fabs(distToStart - distToBe)) {
+ if (fabs(dists[i] - distToBe) > fabs(distToStart - distToBe)) {
changes[i][0] = 0;
changes[i][1] = 0;
dists[i] = distToStart;
@@ -969,19 +972,19 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
}
}
// sort the changes by the vertical change
- for(k = 0; k < totweight; k++) {
+ for (k = 0; k < totweight; k++) {
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])) {
+ if (fabs(dist) > fabs(dists[i])) {
bestIndex = i;
}
}
// switch with k
- if(bestIndex != k) {
+ if (bestIndex != k) {
ti = upDown[k];
upDown[k] = upDown[bestIndex];
upDown[bestIndex] = ti;
@@ -1005,18 +1008,18 @@ 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)) {
+ for (i = 0; i < totweight; i++) {
+ if (fabs(changes[i][0]) > fabs(changes[i][1]*2.0f)) {
bestIndex = i;
break;
}
}
- if(bestIndex != -1) {
+ if (bestIndex != -1) {
wasChange = TRUE;
// it is a good place to stop if it tries to move the opposite direction
// (relative to the plane) of last time
- if(lastIndex != -1) {
- if(wasUp != upDown[bestIndex]) {
+ if (lastIndex != -1) {
+ if (wasUp != upDown[bestIndex]) {
wasChange = FALSE;
}
}
@@ -1024,22 +1027,23 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
wasUp = upDown[bestIndex];
dw = (dvert->dw+dwIndices[bestIndex]);
oldw = dw->weight;
- if(upDown[bestIndex]) {
+ if (upDown[bestIndex]) {
dw->weight *= 1+cp;
- } else {
+ }
+ else {
dw->weight /= 1+cp;
}
- if(dw->weight > 1) {
+ if (dw->weight > 1) {
dw->weight = 1;
}
- if(oldw == dw->weight) {
+ if (oldw == dw->weight) {
wasChange = FALSE;
}
- if(dm) {
+ if (dm) {
dm_deform_clear(dm, ob); dm = NULL;
}
}
- } while(wasChange && (distToStart-distToBe)/fabsf(distToStart-distToBe) ==
+ } while (wasChange && (distToStart-distToBe)/fabsf(distToStart-distToBe) ==
(dists[bestIndex]-distToBe)/fabsf(dists[bestIndex]-distToBe));
MEM_freeN(upDown);
MEM_freeN(changes);
@@ -1056,24 +1060,24 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength,
Mesh *me = ob->data;
MVert *mvert = me->mvert;
int *verts = NULL;
- if(!(me->editflag & ME_EDIT_VERT_SEL))
+ if (!(me->editflag & ME_EDIT_VERT_SEL))
return;
- for(i = 0; i < me->totvert && mvert; i++, mvert++) {
- if(mvert->flag & SELECT) {
+ for (i = 0; i < me->totvert && mvert; i++, mvert++) {
+ if (mvert->flag & SELECT) {
int count=0;
- if((verts = getSurroundingVerts(me, i, &count))) {
+ if ((verts = getSurroundingVerts(me, i, &count))) {
MVert m;
MVert *p = MEM_callocN(sizeof(MVert)*(count), "deformedPoints");
int k;
DerivedMesh *dm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
k = count;
- while(k--) {
+ while (k--) {
dm->getVert(dm, verts[k], &m);
p[k] = m;
}
- if(count >= 3) {
+ if (count >= 3) {
float d /*, dist */ /* UNUSED */, mag;
float coord[3];
float norm[3];
@@ -1081,7 +1085,7 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength,
dm->getVert(dm, i, &m);
sub_v3_v3v3(norm, m.co, coord);
mag= normalize_v3(norm);
- if(mag) { /* zeros fix */
+ if (mag) { /* zeros fix */
d = -dot_v3v3(norm, coord);
/* dist = (dot_v3v3(norm, m.co) + d); */ /* UNUSED */
moveCloserToDistanceFromPlane(scene, ob, me, i, norm, coord, d, distToBe, strength, cp);
@@ -1111,7 +1115,7 @@ static void vgroup_levels(Object *ob, float offset, float gain)
ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, use_vert_sel);
if (dvert_array) {
- for(i = 0; i < dvert_tot; i++) {
+ for (i = 0; i < dvert_tot; i++) {
/* in case its not selected */
if (!(dv = dvert_array[i])) {
@@ -1119,7 +1123,7 @@ static void vgroup_levels(Object *ob, float offset, float gain)
}
dw = defvert_find_index(dv, def_nr);
- if(dw) {
+ if (dw) {
dw->weight = gain * (dw->weight + offset);
CLAMP(dw->weight, 0.0f, 1.0f);
@@ -1146,9 +1150,9 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, use_vert_sel);
if (dvert_array) {
- if(lock_active) {
+ if (lock_active) {
- for(i = 0; i < dvert_tot; i++) {
+ for (i = 0; i < dvert_tot; i++) {
/* in case its not selected */
if (!(dv = dvert_array[i])) {
continue;
@@ -1158,7 +1162,7 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
}
}
else {
- for(i = 0; i < dvert_tot; i++) {
+ for (i = 0; i < dvert_tot; i++) {
/* in case its not selected */
if (!(dv = dvert_array[i])) {
@@ -1178,17 +1182,17 @@ static void vgroup_lock_all(Object *ob, int action)
{
bDeformGroup *dg;
- if(action == SEL_TOGGLE) {
+ if (action == SEL_TOGGLE) {
action= SEL_SELECT;
- for(dg= ob->defbase.first; dg; dg= dg->next) {
- if(dg->flag & DG_LOCK_WEIGHT) {
+ for (dg= ob->defbase.first; dg; dg= dg->next) {
+ if (dg->flag & DG_LOCK_WEIGHT) {
action= SEL_DESELECT;
break;
}
}
}
- for(dg= ob->defbase.first; dg; dg= dg->next) {
+ for (dg= ob->defbase.first; dg; dg= dg->next) {
switch(action) {
case SEL_SELECT:
dg->flag |= DG_LOCK_WEIGHT;
@@ -1218,7 +1222,7 @@ static void vgroup_invert(Object *ob, const short auto_assign, const short auto_
ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, use_vert_sel);
if (dvert_array) {
- for(i = 0; i < dvert_tot; i++) {
+ for (i = 0; i < dvert_tot; i++) {
/* in case its not selected */
if (!(dv = dvert_array[i])) {
@@ -1232,10 +1236,10 @@ static void vgroup_invert(Object *ob, const short auto_assign, const short auto_
dw= defvert_find_index(dv, def_nr);
}
- if(dw) {
+ if (dw) {
dw->weight = 1.0f - dw->weight;
- if(auto_remove && dw->weight <= 0.0f) {
+ if (auto_remove && dw->weight <= 0.0f) {
defvert_remove_group(dv, dw);
}
}
@@ -1280,9 +1284,9 @@ static void vgroup_blend(Object *ob)
sel1= BM_elem_flag_test(eed->v1, BM_ELEM_SELECT);
sel2= BM_elem_flag_test(eed->v2, BM_ELEM_SELECT);
- if(sel1 != sel2) {
+ if (sel1 != sel2) {
/* i1 is always the selected one */
- if(sel1==TRUE && sel2==FALSE) {
+ if (sel1==TRUE && sel2==FALSE) {
i1= BM_elem_index_get(eed->v1);
i2= BM_elem_index_get(eed->v2);
eve= eed->v2;
@@ -1308,7 +1312,7 @@ static void vgroup_blend(Object *ob)
dw = defvert_find_index(dvert, def_nr);
- if(dw) {
+ if (dw) {
vg_weights[i1] += dw->weight;
}
}
@@ -1316,9 +1320,9 @@ static void vgroup_blend(Object *ob)
i= 0;
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- if(BM_elem_flag_test(eve, BM_ELEM_SELECT) && vg_users[i] > 0) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && vg_users[i] > 0) {
/* TODO, we may want object mode blending */
- if(em) dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ if (em) dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
else dvert= dvert_array+i;
dw= defvert_verify_index(dvert, def_nr);
@@ -1351,7 +1355,7 @@ static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
if (dvert_array) {
/* only the active group */
- for(i = 0; i < dvert_tot; i++) {
+ for (i = 0; i < dvert_tot; i++) {
/* in case its not selected */
if (!(dv = dvert_array[i])) {
@@ -1362,7 +1366,7 @@ static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
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 */
}
}
@@ -1385,7 +1389,7 @@ static void vgroup_clean_all(Object *ob, const float epsilon, const int keep_sin
MDeformVert *dv;
MDeformWeight *dw;
- for(i = 0; i < dvert_tot; i++) {
+ for (i = 0; i < dvert_tot; i++) {
int j;
/* in case its not selected */
@@ -1395,14 +1399,14 @@ static void vgroup_clean_all(Object *ob, const float epsilon, const int keep_sin
j= dv->totweight;
- while(j--) {
+ while (j--) {
- if(keep_single && dv->totweight == 1)
+ if (keep_single && dv->totweight == 1)
break;
dw= dv->dw + j;
- if(dw->weight <= epsilon) {
+ if (dw->weight <= epsilon) {
defvert_remove_group(dv, dw);
}
}
@@ -1421,9 +1425,9 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
{
BLI_assert(sel || sel_mirr);
- if(sel_mirr && sel) {
+ if (sel_mirr && sel) {
/* swap */
- if(mirror_weights) {
+ if (mirror_weights) {
if (all_vgroups) {
SWAP(MDeformVert, *dvert, *dvert_mirr);
}
@@ -1442,18 +1446,18 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
}
}
- if(flip_vgroups) {
+ if (flip_vgroups) {
defvert_flip(dvert, flip_map, flip_map_len);
defvert_flip(dvert_mirr, flip_map, flip_map_len);
}
}
else {
/* dvert should always be the target, only swaps pointer */
- if(sel_mirr) {
+ if (sel_mirr) {
SWAP(MDeformVert *, dvert, dvert_mirr);
}
- if(mirror_weights) {
+ if (mirror_weights) {
if (all_vgroups) {
defvert_copy(dvert, dvert_mirr);
}
@@ -1463,7 +1467,7 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
}
/* flip map already modified for 'all_vgroups' */
- if(flip_vgroups) {
+ if (flip_vgroups) {
defvert_flip(dvert, flip_map, flip_map_len);
}
}
@@ -1512,14 +1516,14 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
}
/* only the active group */
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
Mesh *me= ob->data;
BMEditMesh *em = me->edit_btmesh;
if (em) {
BMIter iter;
- if(!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT)) {
+ if (!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT)) {
goto cleanup;
}
@@ -1527,14 +1531,14 @@ 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(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- if((eve_mirr= EDBM_GetMirrorVert(em, eve))) {
+ if ((eve_mirr= EDBM_GetMirrorVert(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)) {
+ 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);
- if(dvert && dvert_mirr) {
+ if (dvert && dvert_mirr) {
VGROUP_MIRR_OP;
}
}
@@ -1561,11 +1565,11 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
}
/* 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 != vidx_mirr) &&
@@ -1597,7 +1601,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
int pntsu_half;
/* half but found up odd value */
- if(lt->pntsu == 1 || lt->dvert == NULL) {
+ if (lt->pntsu == 1 || lt->dvert == NULL) {
goto cleanup;
}
@@ -1606,11 +1610,11 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
* ok in this case */
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++) {
+ 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) {
+ if (u != u_inv) {
BPoint *bp, *bp_mirr;
i1= LT_INDEX(lt, u, v, w);
@@ -1622,7 +1626,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
sel= bp->f1 & SELECT;
sel_mirr= bp_mirr->f1 & SELECT;
- if(sel || sel_mirr) {
+ if (sel || sel_mirr) {
dvert= &lt->dvert[i1];
dvert_mirr= &lt->dvert[i2];
@@ -1653,19 +1657,19 @@ static void vgroup_remap_update_users(Object *ob, int *map)
/* these cases don't use names to refer to vertex groups, so when
* they get deleted the numbers get out of sync, this corrects that */
- if(ob->soft)
+ if (ob->soft)
ob->soft->vertgroup= map[ob->soft->vertgroup];
- for(md=ob->modifiers.first; md; md=md->next) {
- if(md->type == eModifierType_Explode) {
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type == eModifierType_Explode) {
emd= (ExplodeModifierData*)md;
emd->vgroup= map[emd->vgroup];
}
- else if(md->type == eModifierType_Cloth) {
+ else if (md->type == eModifierType_Cloth) {
clmd= (ClothModifierData*)md;
clsim= clmd->sim_parms;
- if(clsim) {
+ if (clsim) {
clsim->vgroup_mass= map[clsim->vgroup_mass];
clsim->vgroup_bend= map[clsim->vgroup_bend];
clsim->vgroup_struct= map[clsim->vgroup_struct];
@@ -1673,8 +1677,8 @@ static void vgroup_remap_update_users(Object *ob, int *map)
}
}
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
- for(a=0; a<PSYS_TOT_VG; 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]];
}
}
@@ -1686,8 +1690,8 @@ static void vgroup_delete_update_users(Object *ob, int id)
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;
+ 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);
@@ -1704,18 +1708,18 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
ED_vgroup_give_array(ob->data, &dvert_array, &dvert_tot);
- if(dvert_array) {
+ 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);
defvert_remove_group(dv, dw); /* dw can be NULL */
/* inline, make into a function if anything else needs to do this */
- for(j = 0; j < dv->totweight; j++) {
- if(dv->dw[j].def_nr > def_nr) {
+ for (j = 0; j < dv->totweight; j++) {
+ if (dv->dw[j].def_nr > def_nr) {
dv->dw[j].def_nr--;
}
}
@@ -1729,9 +1733,9 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
BLI_freelinkN(&ob->defbase, dg);
/* Update the active deform index if necessary */
- if(ob->actdef > def_nr)
+ if (ob->actdef > def_nr)
ob->actdef--;
- if(ob->actdef < 1 && ob->defbase.first)
+ if (ob->actdef < 1 && ob->defbase.first)
ob->actdef= 1;
}
@@ -1743,7 +1747,7 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
MDeformVert *dv;
const int def_nr= BLI_findindex(&ob->defbase, dg);
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
Mesh *me= ob->data;
if (me->edit_btmesh) {
@@ -1754,7 +1758,7 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
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))) {
+ if (dv && dv->dw && (allverts || BM_elem_flag_test(eve, BM_ELEM_SELECT))) {
MDeformWeight *dw = defvert_find_index(dv, def_nr);
defvert_remove_group(dv, dw); /* dw can be NULL */
}
@@ -1782,15 +1786,15 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
}
}
}
- else if(ob->type == OB_LATTICE) {
+ else if (ob->type == OB_LATTICE) {
Lattice *lt= vgroup_edit_lattice(ob);
- if(lt->dvert) {
+ if (lt->dvert) {
BPoint *bp;
int i, tot= lt->pntsu*lt->pntsv*lt->pntsw;
- for(i=0, bp= lt->def; i<tot; i++, bp++) {
- if(allverts || (bp->f1 & SELECT)) {
+ for (i=0, bp= lt->def; i<tot; i++, bp++) {
+ if (allverts || (bp->f1 & SELECT)) {
MDeformWeight *dw;
dv= &lt->dvert[i];
@@ -1814,7 +1818,7 @@ 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) {
+ if (ob->type==OB_MESH) {
Mesh *me= ob->data;
BMEditMesh *em = me->edit_btmesh;
BMIter iter;
@@ -1824,23 +1828,23 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
- if(dvert)
- for(i=0; i<dvert->totweight; i++)
- if(dvert->dw[i].def_nr > dg_index)
+ if (dvert)
+ 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) {
+ else if (ob->type==OB_LATTICE) {
Lattice *lt= vgroup_edit_lattice(ob);
BPoint *bp;
MDeformVert *dvert= lt->dvert;
int a, tot;
- if(dvert) {
+ 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++){
- if(dvert->dw[i].def_nr > dg_index)
+ 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--;
}
}
@@ -1853,21 +1857,21 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
BLI_freelinkN (&ob->defbase, dg);
/* Update the active deform index if necessary */
- if(ob->actdef > dg_index)
+ if (ob->actdef > dg_index)
ob->actdef--;
- if(ob->actdef < 1 && ob->defbase.first)
+ if (ob->actdef < 1 && ob->defbase.first)
ob->actdef= 1;
/* remove all dverts */
- if(ob->defbase.first == NULL) {
- if(ob->type==OB_MESH) {
+ if (ob->defbase.first == NULL) {
+ if (ob->type==OB_MESH) {
Mesh *me= ob->data;
CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
me->dvert= NULL;
}
- else if(ob->type==OB_LATTICE) {
+ else if (ob->type==OB_LATTICE) {
Lattice *lt= vgroup_edit_lattice(ob);
- if(lt->dvert) {
+ if (lt->dvert) {
MEM_freeN(lt->dvert);
lt->dvert= NULL;
}
@@ -1877,9 +1881,9 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
static int vgroup_object_in_edit_mode(Object *ob)
{
- if(ob->type == OB_MESH)
+ if (ob->type == OB_MESH)
return (BMEdit_FromObject(ob) != NULL);
- else if(ob->type == OB_LATTICE)
+ else if (ob->type == OB_LATTICE)
return (((Lattice*)ob->data)->editlatt != NULL);
return 0;
@@ -1900,10 +1904,10 @@ 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);
- if(!dg)
+ if (!dg)
return;
- if(vgroup_object_in_edit_mode(ob))
+ if (vgroup_object_in_edit_mode(ob))
vgroup_delete_edit_mode(ob, dg);
else
vgroup_delete_object_mode(ob, dg);
@@ -1912,14 +1916,14 @@ static void vgroup_delete(Object *ob)
static void vgroup_delete_all(Object *ob)
{
/* Remove all DVerts */
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
Mesh *me= ob->data;
CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
me->dvert= NULL;
}
- else if(ob->type==OB_LATTICE) {
+ else if (ob->type==OB_LATTICE) {
Lattice *lt= vgroup_edit_lattice(ob);
- if(lt->dvert) {
+ if (lt->dvert) {
MEM_freeN(lt->dvert);
lt->dvert= NULL;
}
@@ -1938,10 +1942,10 @@ static void vgroup_assign_verts(Object *ob, const float weight)
MDeformVert *dv;
const int def_nr= ob->actdef-1;
- if(!BLI_findlink(&ob->defbase, def_nr))
+ if (!BLI_findlink(&ob->defbase, def_nr))
return;
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
Mesh *me= ob->data;
if (me->edit_btmesh) {
@@ -1949,7 +1953,7 @@ static void vgroup_assign_verts(Object *ob, const float weight)
BMIter iter;
BMVert *eve;
- if(!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT))
+ if (!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT))
BM_data_layer_add(em->bm, &em->bm->vdata, CD_MDEFORMVERT);
/* Go through the list of editverts and assign them */
@@ -1987,19 +1991,19 @@ static void vgroup_assign_verts(Object *ob, const float weight)
}
}
}
- else if(ob->type == OB_LATTICE) {
+ else if (ob->type == OB_LATTICE) {
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;
tot= lt->pntsu*lt->pntsv*lt->pntsw;
- for(a=0, bp= lt->def; a<tot; a++, bp++, dv++) {
- if(bp->f1 & SELECT) {
+ for (a=0, bp= lt->def; a<tot; a++, bp++, dv++) {
+ if (bp->f1 & SELECT) {
MDeformWeight *dw;
dw= defvert_verify_index(dv, def_nr);
@@ -2020,7 +2024,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);
}
}
@@ -2039,7 +2043,7 @@ static int vertex_group_poll_edit(bContext *C)
Object *ob= ED_object_context(C);
ID *data= (ob)? ob->data: NULL;
- if(!(ob && !ob->id.lib && data && !data->lib))
+ if (!(ob && !ob->id.lib && data && !data->lib))
return 0;
return vgroup_object_in_edit_mode(ob);
@@ -2051,7 +2055,7 @@ static int vertex_group_poll_edit_or_wpaint_vert_select(bContext *C)
Object *ob= ED_object_context(C);
ID *data= (ob)? ob->data: NULL;
- if(!(ob && !ob->id.lib && data && !data->lib))
+ if (!(ob && !ob->id.lib && data && !data->lib))
return 0;
return ( vgroup_object_in_edit_mode(ob) ||
@@ -2073,22 +2077,22 @@ static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_add";
+ ot->name = "Add Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_add";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_add_exec;
+ ot->poll = vertex_group_poll;
+ 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);
- if(RNA_boolean_get(op->ptr, "all"))
+ if (RNA_boolean_get(op->ptr, "all"))
vgroup_delete_all(ob);
else
vgroup_delete(ob);
@@ -2103,18 +2107,18 @@ static int vertex_group_remove_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_remove";
+ ot->name = "Remove Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_remove";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_remove_exec;
+ ot->poll = vertex_group_poll;
+ ot->exec = vertex_group_remove_exec;
/* flags */
/* 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");
@@ -2125,7 +2129,7 @@ static int vertex_group_assign_exec(bContext *C, wmOperator *op)
ToolSettings *ts= CTX_data_tool_settings(C);
Object *ob= ED_object_context(C);
- if(RNA_boolean_get(op->ptr, "new"))
+ if (RNA_boolean_get(op->ptr, "new"))
ED_vgroup_add(ob);
vgroup_assign_verts(ob, ts->vgroup_weight);
@@ -2138,18 +2142,18 @@ static int vertex_group_assign_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_assign(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Assign Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_assign";
+ ot->name = "Assign Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_assign";
/* api callbacks */
- ot->poll= vertex_group_poll_edit_or_wpaint_vert_select;
- ot->exec= vertex_group_assign_exec;
+ ot->poll = vertex_group_poll_edit_or_wpaint_vert_select;
+ ot->exec = vertex_group_assign_exec;
/* flags */
/* 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");
@@ -2159,12 +2163,12 @@ static int vertex_group_remove_from_exec(bContext *C, wmOperator *op)
{
Object *ob= ED_object_context(C);
- if(RNA_boolean_get(op->ptr, "all"))
+ if (RNA_boolean_get(op->ptr, "all"))
vgroup_remove_verts(ob, 0);
else {
bDeformGroup *dg= BLI_findlink(&ob->defbase, ob->actdef - 1);
- if(dg == NULL) {
+ if (dg == NULL) {
return OPERATOR_CANCELLED;
}
@@ -2180,18 +2184,18 @@ static int vertex_group_remove_from_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove from Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_remove_from";
+ ot->name = "Remove from Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_remove_from";
/* api callbacks */
- ot->poll= vertex_group_poll_edit_or_wpaint_vert_select;
- ot->exec= vertex_group_remove_from_exec;
+ ot->poll = vertex_group_poll_edit_or_wpaint_vert_select;
+ ot->exec = vertex_group_remove_from_exec;
/* flags */
/* 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");
@@ -2201,7 +2205,7 @@ static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= ED_object_context(C);
- if(!ob || ob->id.lib)
+ if (!ob || ob->id.lib)
return OPERATOR_CANCELLED;
vgroup_select_verts(ob, 1);
@@ -2213,15 +2217,15 @@ static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_select";
+ ot->name = "Select Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_select";
/* api callbacks */
- ot->poll= vertex_group_poll_edit_or_wpaint_vert_select;
- ot->exec= vertex_group_select_exec;
+ ot->poll = vertex_group_poll_edit_or_wpaint_vert_select;
+ 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))
@@ -2237,15 +2241,15 @@ static int vertex_group_deselect_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Deselect Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_deselect";
+ ot->name = "Deselect Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_deselect";
/* api callbacks */
- ot->poll= vertex_group_poll_edit_or_wpaint_vert_select;
- ot->exec= vertex_group_deselect_exec;
+ ot->poll = vertex_group_poll_edit_or_wpaint_vert_select;
+ 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))
@@ -2263,15 +2267,15 @@ static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_copy";
+ ot->name = "Copy Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_copy";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_copy_exec;
+ ot->poll = vertex_group_poll;
+ 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)
@@ -2293,15 +2297,15 @@ static int vertex_group_levels_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_levels(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Vertex Group Levels";
- ot->idname= "OBJECT_OT_vertex_group_levels";
+ ot->name = "Vertex Group Levels";
+ ot->idname = "OBJECT_OT_vertex_group_levels";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_levels_exec;
+ ot->poll = vertex_group_poll;
+ 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);
@@ -2323,15 +2327,15 @@ static int vertex_group_normalize_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_normalize(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Normalize Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_normalize";
+ ot->name = "Normalize Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_normalize";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_normalize_exec;
+ ot->poll = vertex_group_poll;
+ 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)
@@ -2351,15 +2355,15 @@ static int vertex_group_normalize_all_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_normalize_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Normalize All Vertex Groups";
- ot->idname= "OBJECT_OT_vertex_group_normalize_all";
+ ot->name = "Normalize All Vertex Groups";
+ ot->idname = "OBJECT_OT_vertex_group_normalize_all";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_normalize_all_exec;
+ ot->poll = vertex_group_poll;
+ 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");
@@ -2375,14 +2379,14 @@ static int vertex_group_fix_exec(bContext *C, wmOperator *op)
float cp= RNA_float_get(op->ptr, "accuracy");
ModifierData *md= ob->modifiers.first;
- while(md) {
- if(md->type == eModifierType_Mirror && (md->mode&eModifierMode_Realtime)) {
+ while (md) {
+ if (md->type == eModifierType_Mirror && (md->mode&eModifierMode_Realtime)) {
break;
}
md = md->next;
}
- if(md && md->type == eModifierType_Mirror) {
+ if (md && md->type == eModifierType_Mirror) {
BKE_report(op->reports, RPT_ERROR_INVALID_CONTEXT, "This operator does not support an active mirror modifier");
return OPERATOR_CANCELLED;
}
@@ -2398,17 +2402,17 @@ static int vertex_group_fix_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_fix(wmOperatorType *ot)
{
/* identifiers */
- 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 "
+ 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)";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_fix_exec;
+ 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);
@@ -2431,15 +2435,15 @@ static int vertex_group_lock_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change the Lock On Vertex Groups";
- ot->idname= "OBJECT_OT_vertex_group_lock";
+ ot->name = "Change the Lock On Vertex Groups";
+ ot->idname = "OBJECT_OT_vertex_group_lock";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_lock_exec;
+ ot->poll = vertex_group_poll;
+ 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);
}
@@ -2461,15 +2465,15 @@ static int vertex_group_invert_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_invert(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Invert Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_invert";
+ ot->name = "Invert Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_invert";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_invert_exec;
+ ot->poll = vertex_group_poll;
+ 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");
@@ -2494,16 +2498,16 @@ static int vertex_group_blend_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_blend(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Blend Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_blend";
- ot->description= "";
+ ot->name = "Blend Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_blend";
+ ot->description = "";
/* api callbacks */
- ot->poll= vertex_group_poll_edit; /* TODO - add object mode support */
- ot->exec= vertex_group_blend_exec;
+ ot->poll = vertex_group_poll_edit; /* TODO - add object mode support */
+ ot->exec = vertex_group_blend_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -2515,7 +2519,7 @@ static int vertex_group_clean_exec(bContext *C, wmOperator *op)
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);
+ 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);
@@ -2528,16 +2532,16 @@ static int vertex_group_clean_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_clean(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clean Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_clean";
- ot->description= "Remove Vertex Group assignments which aren't required";
+ ot->name = "Clean Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_clean";
+ ot->description = "Remove Vertex Group assignments which aren't required";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_clean_exec;
+ ot->poll = vertex_group_poll;
+ 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");
@@ -2565,17 +2569,17 @@ static int vertex_group_mirror_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot)
{
/* identifiers */
- 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, "
+ 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";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_mirror_exec;
+ 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");
@@ -2591,9 +2595,9 @@ static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op))
Base *base;
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;
@@ -2613,16 +2617,16 @@ static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Vertex Groups to Linked";
- ot->idname= "OBJECT_OT_vertex_group_copy_to_linked";
- ot->description= "Copy Vertex Groups to all users of the same Geometry data";
+ ot->name = "Copy Vertex Groups to Linked";
+ ot->idname = "OBJECT_OT_vertex_group_copy_to_linked";
+ ot->description = "Copy Vertex Groups to all users of the same Geometry data";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_copy_to_linked_exec;
+ ot->poll = vertex_group_poll;
+ 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)
@@ -2633,14 +2637,14 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
{
- if(obact != ob) {
- if(ED_vgroup_copy_array(ob, obact)) change++;
+ if (obact != ob) {
+ if (ED_vgroup_copy_array(ob, obact)) change++;
else fail++;
}
}
CTX_DATA_END;
- if((change == 0 && fail == 0) || fail) {
+ if ((change == 0 && fail == 0) || fail) {
BKE_reportf(op->reports, RPT_ERROR,
"Copy to VGroups to Selected warning done %d, failed %d, object data must have matching indices",
change, fail);
@@ -2653,16 +2657,16 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_copy_to_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Vertex Group to Selected";
- ot->idname= "OBJECT_OT_vertex_group_copy_to_selected";
- ot->description= "Copy Vertex Groups to other selected objects with matching indices";
+ ot->name = "Copy Vertex Group to Selected";
+ ot->idname = "OBJECT_OT_vertex_group_copy_to_selected";
+ ot->description = "Copy Vertex Groups to other selected objects with matching indices";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_copy_to_selected_exec;
+ ot->poll = vertex_group_poll;
+ 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[]= {
@@ -2690,10 +2694,10 @@ static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), Prop
bDeformGroup *def;
int a, totitem= 0;
- if(!ob)
+ if (!ob)
return vgroup_items;
- for(a=0, def=ob->defbase.first; def; def=def->next, a++) {
+ for (a=0, def=ob->defbase.first; def; def=def->next, a++) {
tmp.value= a;
tmp.icon= ICON_GROUP_VERTEX;
tmp.identifier= def->name;
@@ -2712,22 +2716,22 @@ void OBJECT_OT_vertex_group_set_active(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Set Active Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_set_active";
- ot->description= "Set the active vertex group";
+ ot->name = "Set Active Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_set_active";
+ ot->description = "Set the active vertex group";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= set_active_group_exec;
- ot->invoke= WM_menu_invoke;
+ ot->poll = vertex_group_poll;
+ ot->exec = set_active_group_exec;
+ 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");
RNA_def_enum_funcs(prop, vgroup_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
/* creates the name_array parameter for vgroup_do_remap, call this before fiddling
@@ -2740,7 +2744,7 @@ static char *vgroup_init_remap(Object *ob)
char *name;
name= name_array;
- for(def = ob->defbase.first; def; def=def->next) {
+ for (def = ob->defbase.first; def; def=def->next) {
BLI_strncpy(name, def->name, MAX_VGROUP_NAME);
name += MAX_VGROUP_NAME;
}
@@ -2762,28 +2766,28 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
int i;
name= name_array;
- for(def= ob->defbase.first, i=0; def; def=def->next, i++){
+ 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->mode == OB_MODE_EDIT) {
+ if (ob->type==OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(ob);
BMIter iter;
BMVert *eve;
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
- if(dvert && dvert->totweight){
+ if (dvert && dvert->totweight) {
defvert_remap(dvert, sort_map, defbase_tot);
}
}
}
else {
- BKE_report(op->reports, RPT_ERROR, "Editmode lattice isnt supported yet");
+ BKE_report(op->reports, RPT_ERROR, "Editmode lattice isn't supported yet");
MEM_freeN(sort_map_update);
return OPERATOR_CANCELLED;
}
@@ -2794,15 +2798,15 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
ED_vgroup_give_array(ob->data, &dvert, &dvert_tot);
/*create as necessary*/
- while(dvert && dvert_tot--) {
- if(dvert->totweight)
+ while (dvert && dvert_tot--) {
+ if (dvert->totweight)
defvert_remap(dvert, sort_map, defbase_tot);
dvert++;
}
}
/* update users */
- for(i=0; i<defbase_tot; i++)
+ for (i=0; i<defbase_tot; i++)
sort_map[i]++;
sort_map_update[0]= 0;
@@ -2851,16 +2855,16 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_sort(wmOperatorType *ot)
{
- ot->name= "Sort Vertex Groups";
- ot->idname= "OBJECT_OT_vertex_group_sort";
- ot->description= "Sorts vertex groups alphabetically";
+ ot->name = "Sort Vertex Groups";
+ ot->idname = "OBJECT_OT_vertex_group_sort";
+ ot->description = "Sorts vertex groups alphabetically";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vertex_group_sort_exec;
+ ot->poll = vertex_group_poll;
+ 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)
@@ -2882,7 +2886,8 @@ static int vgroup_move_exec(bContext *C, wmOperator *op)
BLI_remlink(&ob->defbase, def);
BLI_insertlinkbefore(&ob->defbase, prev, def);
- } else { /*down*/
+ }
+ else { /*down*/
void *next = def->next;
BLI_remlink(&ob->defbase, def);
@@ -2910,15 +2915,15 @@ void OBJECT_OT_vertex_group_move(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Move Vertex Group";
- ot->idname= "OBJECT_OT_vertex_group_move";
+ ot->name = "Move Vertex Group";
+ ot->idname = "OBJECT_OT_vertex_group_move";
/* api callbacks */
- ot->poll= vertex_group_poll;
- ot->exec= vgroup_move_exec;
+ ot->poll = vertex_group_poll;
+ 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 abb596e450f..417cddb74fe 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -73,7 +73,7 @@ static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
/* set preview for this surface only and set active */
canvas->active_sur = 0;
- for(surface=surface->prev; surface; surface=surface->prev) {
+ for (surface=surface->prev; surface; surface=surface->prev) {
surface->flags &= ~MOD_DPAINT_PREVIEW;
canvas->active_sur++;
}
@@ -85,16 +85,16 @@ static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
void DPAINT_OT_surface_slot_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Surface Slot";
- ot->idname= "DPAINT_OT_surface_slot_add";
- ot->description="Add a new Dynamic Paint surface slot";
+ ot->name = "Add Surface Slot";
+ ot->idname = "DPAINT_OT_surface_slot_add";
+ ot->description = "Add a new Dynamic Paint surface slot";
/* api callbacks */
- ot->exec= surface_slot_add_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = surface_slot_add_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op))
@@ -113,8 +113,8 @@ static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op))
surface = canvas->surfaces.first;
/* find active surface and remove it */
- for(; surface; surface=surface->next) {
- if(id == canvas->active_sur) {
+ for (; surface; surface=surface->next) {
+ if (id == canvas->active_sur) {
canvas->active_sur -= 1;
dynamicPaint_freeSurface(surface);
break;
@@ -133,16 +133,16 @@ static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op))
void DPAINT_OT_surface_slot_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Surface Slot";
- ot->idname= "DPAINT_OT_surface_slot_remove";
- ot->description="Remove the selected surface slot";
+ ot->name = "Remove Surface Slot";
+ ot->idname = "DPAINT_OT_surface_slot_remove";
+ ot->description = "Remove the selected surface slot";
/* api callbacks */
- ot->exec= surface_slot_remove_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = surface_slot_remove_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int type_toggle_exec(bContext *C, wmOperator *op)
@@ -181,20 +181,20 @@ void DPAINT_OT_type_toggle(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Toggle Type Active";
- ot->idname= "DPAINT_OT_type_toggle";
+ ot->name = "Toggle Type Active";
+ ot->idname = "DPAINT_OT_type_toggle";
ot->description = "Toggle whether given type is active or not";
/* api callbacks */
- ot->exec= type_toggle_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = type_toggle_exec;
+ 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", prop_dynamicpaint_type_items, MOD_DYNAMICPAINT_TYPE_CANVAS, "Type", "");
- ot->prop= prop;
+ ot->prop = prop;
}
static int output_toggle_exec(bContext *C, wmOperator *op)
@@ -249,19 +249,19 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Toggle Output Layer";
- ot->idname= "DPAINT_OT_output_toggle";
+ ot->name = "Toggle Output Layer";
+ ot->idname = "DPAINT_OT_output_toggle";
ot->description = "Add or remove Dynamic Paint output data layer";
/* api callbacks */
- ot->exec= output_toggle_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = output_toggle_exec;
+ 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, "output", prop_output_toggle_types, 0, "Output Toggle", "");
+ ot->prop = RNA_def_enum(ot->srna, "output", prop_output_toggle_types, 0, "Output Toggle", "");
}
@@ -408,7 +408,7 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
static int dynamicpaint_bake_exec(bContext *C, wmOperator *op)
{
/* Bake dynamic paint */
- if(!dynamicPaint_initBake(C, op)) {
+ if (!dynamicPaint_initBake(C, op)) {
return OPERATOR_CANCELLED;}
return OPERATOR_FINISHED;
@@ -417,11 +417,11 @@ static int dynamicpaint_bake_exec(bContext *C, wmOperator *op)
void DPAINT_OT_bake(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Dynamic Paint Bake";
- ot->description= "Bake dynamic paint image sequence surface";
- ot->idname= "DPAINT_OT_bake";
+ ot->name = "Dynamic Paint Bake";
+ ot->description = "Bake dynamic paint image sequence surface";
+ ot->idname = "DPAINT_OT_bake";
/* api callbacks */
- ot->exec= dynamicpaint_bake_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = dynamicpaint_bake_exec;
+ ot->poll = ED_operator_object_active_editable;
}
diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c
index 54bd19164e0..7a7c16b23ff 100644
--- a/source/blender/editors/physics/particle_boids.c
+++ b/source/blender/editors/physics/particle_boids.c
@@ -65,7 +65,7 @@ static int rule_add_exec(bContext *C, wmOperator *op)
BoidRule *rule;
BoidState *state;
- if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+ if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
part = psys->part;
@@ -73,7 +73,7 @@ static int rule_add_exec(bContext *C, wmOperator *op)
state = boid_get_current_state(part->boids);
- for(rule=state->rules.first; rule; rule=rule->next)
+ for (rule=state->rules.first; rule; rule=rule->next)
rule->flag &= ~BOIDRULE_CURRENT;
rule = boid_new_rule(type);
@@ -90,18 +90,18 @@ static int rule_add_exec(bContext *C, wmOperator *op)
void BOID_OT_rule_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Boid Rule";
+ ot->name = "Add Boid Rule";
ot->description = "Add a boid rule to the current boid state";
- ot->idname= "BOID_OT_rule_add";
+ ot->idname = "BOID_OT_rule_add";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= rule_add_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = rule_add_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
- ot->prop= RNA_def_enum(ot->srna, "type", boidrule_type_items, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", boidrule_type_items, 0, "Type", "");
}
static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -113,14 +113,14 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
BoidRule *rule;
BoidState *state;
- if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+ if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
state = boid_get_current_state(psys->part->boids);
- for(rule=state->rules.first; rule; rule=rule->next) {
- if(rule->flag & BOIDRULE_CURRENT) {
+ for (rule=state->rules.first; rule; rule=rule->next) {
+ if (rule->flag & BOIDRULE_CURRENT) {
BLI_remlink(&state->rules, rule);
MEM_freeN(rule);
break;
@@ -129,7 +129,7 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
}
rule = state->rules.first;
- if(rule)
+ if (rule)
rule->flag |= BOIDRULE_CURRENT;
DAG_scene_sort(bmain, scene);
@@ -143,14 +143,14 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
void BOID_OT_rule_del(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Boid Rule";
- ot->idname= "BOID_OT_rule_del";
+ ot->name = "Remove Boid Rule";
+ ot->idname = "BOID_OT_rule_del";
/* api callbacks */
- ot->exec= rule_del_exec;
+ ot->exec = rule_del_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ move up/down boid rule operators *********************/
@@ -162,12 +162,12 @@ static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op))
BoidRule *rule;
BoidState *state;
- if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+ if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
state = boid_get_current_state(psys->part->boids);
- for(rule = state->rules.first; rule; rule=rule->next) {
- if(rule->flag & BOIDRULE_CURRENT && rule->prev) {
+ for (rule = state->rules.first; rule; rule=rule->next) {
+ if (rule->flag & BOIDRULE_CURRENT && rule->prev) {
BLI_remlink(&state->rules, rule);
BLI_insertlink(&state->rules, rule->prev->prev, rule);
@@ -182,14 +182,14 @@ static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op))
void BOID_OT_rule_move_up(wmOperatorType *ot)
{
- ot->name= "Move Up Boid Rule";
- ot->description= "Move boid rule up in the list";
- ot->idname= "BOID_OT_rule_move_up";
+ ot->name = "Move Up Boid Rule";
+ ot->description = "Move boid rule up in the list";
+ ot->idname = "BOID_OT_rule_move_up";
- ot->exec= rule_move_up_exec;
+ ot->exec = rule_move_up_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
@@ -200,12 +200,12 @@ static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
BoidRule *rule;
BoidState *state;
- if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+ if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
state = boid_get_current_state(psys->part->boids);
- for(rule = state->rules.first; rule; rule=rule->next) {
- if(rule->flag & BOIDRULE_CURRENT && rule->next) {
+ for (rule = state->rules.first; rule; rule=rule->next) {
+ if (rule->flag & BOIDRULE_CURRENT && rule->next) {
BLI_remlink(&state->rules, rule);
BLI_insertlink(&state->rules, rule->next, rule);
@@ -220,14 +220,14 @@ static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
void BOID_OT_rule_move_down(wmOperatorType *ot)
{
- ot->name= "Move Down Boid Rule";
- ot->description= "Move boid rule down in the list";
- ot->idname= "BOID_OT_rule_move_down";
+ ot->name = "Move Down Boid Rule";
+ ot->description = "Move boid rule down in the list";
+ ot->idname = "BOID_OT_rule_move_down";
- ot->exec= rule_move_down_exec;
+ ot->exec = rule_move_down_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -240,12 +240,12 @@ static int state_add_exec(bContext *C, wmOperator *UNUSED(op))
ParticleSettings *part;
BoidState *state;
- if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+ if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
part = psys->part;
- for(state=part->boids->states.first; state; state=state->next)
+ for (state=part->boids->states.first; state; state=state->next)
state->flag &= ~BOIDSTATE_CURRENT;
state = boid_new_state(part->boids);
@@ -261,15 +261,15 @@ static int state_add_exec(bContext *C, wmOperator *UNUSED(op))
void BOID_OT_state_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Boid State";
+ ot->name = "Add Boid State";
ot->description = "Add a boid state to the particle system";
- ot->idname= "BOID_OT_state_add";
+ ot->idname = "BOID_OT_state_add";
/* api callbacks */
- ot->exec= state_add_exec;
+ ot->exec = state_add_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -281,13 +281,13 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
ParticleSettings *part;
BoidState *state;
- if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+ if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
part = psys->part;
- for(state=part->boids->states.first; state; state=state->next) {
- if(state->flag & BOIDSTATE_CURRENT) {
+ for (state=part->boids->states.first; state; state=state->next) {
+ if (state->flag & BOIDSTATE_CURRENT) {
BLI_remlink(&part->boids->states, state);
MEM_freeN(state);
break;
@@ -296,7 +296,7 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
}
/* there must be at least one state */
- if(!part->boids->states.first) {
+ if (!part->boids->states.first) {
state = boid_new_state(part->boids);
BLI_addtail(&part->boids->states, state);
}
@@ -316,14 +316,14 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
void BOID_OT_state_del(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Boid State";
- ot->idname= "BOID_OT_state_del";
+ ot->name = "Remove Boid State";
+ ot->idname = "BOID_OT_state_del";
/* api callbacks */
- ot->exec= state_del_exec;
+ ot->exec = state_del_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ move up/down boid state operators *********************/
@@ -335,13 +335,13 @@ static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op))
BoidSettings *boids;
BoidState *state;
- if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+ if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
boids = psys->part->boids;
- for(state = boids->states.first; state; state=state->next) {
- if(state->flag & BOIDSTATE_CURRENT && state->prev) {
+ for (state = boids->states.first; state; state=state->next) {
+ if (state->flag & BOIDSTATE_CURRENT && state->prev) {
BLI_remlink(&boids->states, state);
BLI_insertlink(&boids->states, state->prev->prev, state);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
@@ -354,14 +354,14 @@ static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op))
void BOID_OT_state_move_up(wmOperatorType *ot)
{
- ot->name= "Move Up Boid State";
- ot->description= "Move boid state up in the list";
- ot->idname= "BOID_OT_state_move_up";
+ ot->name = "Move Up Boid State";
+ ot->description = "Move boid state up in the list";
+ ot->idname = "BOID_OT_state_move_up";
- ot->exec= state_move_up_exec;
+ ot->exec = state_move_up_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
@@ -371,13 +371,13 @@ static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
BoidSettings *boids;
BoidState *state;
- if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+ if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
boids = psys->part->boids;
- for(state = boids->states.first; state; state=state->next) {
- if(state->flag & BOIDSTATE_CURRENT && state->next) {
+ for (state = boids->states.first; state; state=state->next) {
+ if (state->flag & BOIDSTATE_CURRENT && state->next) {
BLI_remlink(&boids->states, state);
BLI_insertlink(&boids->states, state->next, state);
DAG_id_tag_update(&psys->part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
@@ -390,13 +390,13 @@ static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
void BOID_OT_state_move_down(wmOperatorType *ot)
{
- ot->name= "Move Down Boid State";
- ot->description= "Move boid state down in the list";
- ot->idname= "BOID_OT_state_move_down";
+ ot->name = "Move Down Boid State";
+ ot->description = "Move boid state down in the list";
+ ot->idname = "BOID_OT_state_move_down";
- ot->exec= state_move_down_exec;
+ ot->exec = state_move_down_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index e08139e9a78..bf3a9fff4e2 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -89,16 +89,16 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys);
#define KEY_K PTCacheEditKey *key; int k
#define POINT_P PTCacheEditPoint *point; int p
-#define LOOP_POINTS for(p=0, point=edit->points; p<edit->totpoint; p++, point++)
-#define LOOP_VISIBLE_POINTS for(p=0, point=edit->points; p<edit->totpoint; p++, point++) if(!(point->flag & PEP_HIDE))
-#define LOOP_SELECTED_POINTS for(p=0, point=edit->points; p<edit->totpoint; p++, point++) if(point_is_selected(point))
-#define LOOP_UNSELECTED_POINTS for(p=0, point=edit->points; p<edit->totpoint; p++, point++) if(!point_is_selected(point))
-#define LOOP_EDITED_POINTS for(p=0, point=edit->points; p<edit->totpoint; p++, point++) if(point->flag & PEP_EDIT_RECALC)
-#define LOOP_TAGGED_POINTS for(p=0, point=edit->points; p<edit->totpoint; p++, point++) if(point->flag & PEP_TAG)
-#define LOOP_KEYS for(k=0, key=point->keys; k<point->totkey; k++, key++)
-#define LOOP_VISIBLE_KEYS for(k=0, key=point->keys; k<point->totkey; k++, key++) if(!(key->flag & PEK_HIDE))
-#define LOOP_SELECTED_KEYS for(k=0, key=point->keys; k<point->totkey; k++, key++) if((key->flag & PEK_SELECT) && !(key->flag & PEK_HIDE))
-#define LOOP_TAGGED_KEYS for(k=0, key=point->keys; k<point->totkey; k++, key++) if(key->flag & PEK_TAG)
+#define LOOP_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++)
+#define LOOP_VISIBLE_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (!(point->flag & PEP_HIDE))
+#define LOOP_SELECTED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point_is_selected(point))
+#define LOOP_UNSELECTED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (!point_is_selected(point))
+#define LOOP_EDITED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point->flag & PEP_EDIT_RECALC)
+#define LOOP_TAGGED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point->flag & PEP_TAG)
+#define LOOP_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++)
+#define LOOP_VISIBLE_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if (!(key->flag & PEK_HIDE))
+#define LOOP_SELECTED_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if ((key->flag & PEK_SELECT) && !(key->flag & PEK_HIDE))
+#define LOOP_TAGGED_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if (key->flag & PEK_TAG)
#define KEY_WCO (key->flag & PEK_USE_WCO ? key->world_co : key->co)
@@ -109,7 +109,7 @@ int PE_poll(bContext *C)
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
- if(!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
+ if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
return 0;
return (PE_get_current(scene, ob) != NULL);
@@ -121,7 +121,7 @@ int PE_hair_poll(bContext *C)
Object *ob= CTX_data_active_object(C);
PTCacheEdit *edit;
- if(!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
+ if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
return 0;
edit= PE_get_current(scene, ob);
@@ -139,28 +139,28 @@ void PE_free_ptcache_edit(PTCacheEdit *edit)
{
POINT_P;
- if(edit==0) return;
+ if (edit==0) return;
PTCacheUndo_clear(edit);
- if(edit->points) {
+ if (edit->points) {
LOOP_POINTS {
- if(point->keys)
+ if (point->keys)
MEM_freeN(point->keys);
}
MEM_freeN(edit->points);
}
- if(edit->mirror_cache)
+ if (edit->mirror_cache)
MEM_freeN(edit->mirror_cache);
- if(edit->emitter_cosnos) {
+ if (edit->emitter_cosnos) {
MEM_freeN(edit->emitter_cosnos);
edit->emitter_cosnos= 0;
}
- if(edit->emitter_field) {
+ if (edit->emitter_field) {
BLI_kdtree_free(edit->emitter_field);
edit->emitter_field= 0;
}
@@ -176,9 +176,9 @@ void PE_free_ptcache_edit(PTCacheEdit *edit)
int PE_start_edit(PTCacheEdit *edit)
{
- if(edit) {
+ if (edit) {
edit->edited = 1;
- if(edit->psys)
+ if (edit->psys)
edit->psys->flag |= PSYS_EDITED;
return 1;
}
@@ -202,7 +202,7 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
ListBase pidlist;
PTCacheID *pid;
- if(pset==NULL || ob==NULL)
+ if (pset==NULL || ob==NULL)
return NULL;
pset->scene = scene;
@@ -211,7 +211,7 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
/* in the case of only one editable thing, set pset->edittype accordingly */
- if(pidlist.first && pidlist.first == pidlist.last) {
+ if (pidlist.first && pidlist.first == pidlist.last) {
pid = pidlist.first;
switch(pid->type) {
case PTCACHE_TYPE_PARTICLES:
@@ -226,25 +226,25 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
}
}
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pset->edittype == PE_TYPE_PARTICLES && pid->type == PTCACHE_TYPE_PARTICLES) {
+ for (pid=pidlist.first; pid; pid=pid->next) {
+ if (pset->edittype == PE_TYPE_PARTICLES && pid->type == PTCACHE_TYPE_PARTICLES) {
ParticleSystem *psys = pid->calldata;
- if(psys->flag & PSYS_CURRENT) {
- if(psys->part && psys->part->type == PART_HAIR) {
- if(psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED) {
- if(create && !psys->pointcache->edit)
+ if (psys->flag & PSYS_CURRENT) {
+ if (psys->part && psys->part->type == PART_HAIR) {
+ if (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED) {
+ if (create && !psys->pointcache->edit)
PE_create_particle_edit(scene, ob, pid->cache, NULL);
edit = pid->cache->edit;
}
else {
- if(create && !psys->edit && psys->flag & PSYS_HAIR_DONE)
+ if (create && !psys->edit && psys->flag & PSYS_HAIR_DONE)
PE_create_particle_edit(scene, ob, NULL, psys);
edit = psys->edit;
}
}
else {
- if(create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit)
+ if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit)
PE_create_particle_edit(scene, ob, pid->cache, psys);
edit = pid->cache->edit;
}
@@ -272,7 +272,7 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
}
}
- if(edit)
+ if (edit)
edit->pid = *pid;
BLI_freelistN(&pidlist);
@@ -292,7 +292,7 @@ PTCacheEdit *PE_create_current(Scene *scene, Object *ob)
void PE_current_changed(Scene *scene, Object *ob)
{
- if(ob->mode == OB_MODE_PARTICLE_EDIT)
+ if (ob->mode == OB_MODE_PARTICLE_EDIT)
PE_create_current(scene, ob);
}
@@ -302,10 +302,10 @@ void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra)
POINT_P; KEY_K;
- if(pset->flag & PE_FADE_TIME && pset->selectmode==SCE_SELECT_POINT) {
+ if (pset->flag & PE_FADE_TIME && pset->selectmode==SCE_SELECT_POINT) {
LOOP_POINTS {
LOOP_KEYS {
- if(fabs(cfra-*key->time) < pset->fade_frames)
+ if (fabs(cfra-*key->time) < pset->fade_frames)
key->flag &= ~PEK_HIDE;
else {
key->flag |= PEK_HIDE;
@@ -325,7 +325,7 @@ void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra)
static int pe_x_mirror(Object *ob)
{
- if(ob->type == OB_MESH)
+ if (ob->type == OB_MESH)
return (((Mesh*)ob->data)->editflag & ME_EDIT_MIRROR_X);
return 0;
@@ -380,8 +380,8 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
/* note, the object argument means the modelview matrix does not account for the objects matrix, use viewmat rather than (obmat * viewmat) */
view3d_get_transformation(data->vc.ar, data->vc.rv3d, NULL, &data->mats);
- if((data->vc.v3d->drawtype>OB_WIRE) && (data->vc.v3d->flag & V3D_ZBUF_SELECT)) {
- if(data->vc.v3d->flag & V3D_INVALID_BACKBUF) {
+ if ((data->vc.v3d->drawtype>OB_WIRE) && (data->vc.v3d->flag & V3D_ZBUF_SELECT)) {
+ if (data->vc.v3d->flag & V3D_INVALID_BACKBUF) {
/* needed or else the draw matrix can be incorrect */
view3d_operator_needs_opengl(C);
@@ -404,12 +404,12 @@ static int key_test_depth(PEData *data, const float co[3])
short wco[3], x,y;
/* nothing to do */
- if((v3d->drawtype<=OB_WIRE) || (v3d->flag & V3D_ZBUF_SELECT)==0)
+ if ((v3d->drawtype<=OB_WIRE) || (v3d->flag & V3D_ZBUF_SELECT)==0)
return 1;
project_short(data->vc.ar, co, wco);
- if(wco[0] == IS_CLIPPED)
+ if (wco[0] == IS_CLIPPED)
return 0;
gluProject(co[0],co[1],co[2], data->mats.modelview, data->mats.projection,
@@ -434,7 +434,7 @@ static int key_test_depth(PEData *data, const float co[3])
}
#endif
- if((float)uz - 0.00001f > depth)
+ if ((float)uz - 0.00001f > depth)
return 0;
else
return 1;
@@ -447,18 +447,18 @@ static int key_inside_circle(PEData *data, float rad, const float co[3], float *
project_int(data->vc.ar, co, sco);
- if(sco[0] == IS_CLIPPED)
+ if (sco[0] == IS_CLIPPED)
return 0;
dx= data->mval[0] - sco[0];
dy= data->mval[1] - sco[1];
dist= sqrt(dx*dx + dy*dy);
- if(dist > rad)
+ if (dist > rad)
return 0;
- if(key_test_depth(data, co)) {
- if(distance)
+ if (key_test_depth(data, co)) {
+ if (distance)
*distance=dist;
return 1;
@@ -473,10 +473,10 @@ static int key_inside_rect(PEData *data, const float co[3])
project_int(data->vc.ar, co,sco);
- if(sco[0] == IS_CLIPPED)
+ if (sco[0] == IS_CLIPPED)
return 0;
- if(sco[0] > data->rect->xmin && sco[0] < data->rect->xmax &&
+ if (sco[0] > data->rect->xmin && sco[0] < data->rect->xmax &&
sco[1] > data->rect->ymin && sco[1] < data->rect->ymax)
return key_test_depth(data, co);
@@ -485,7 +485,7 @@ static int key_inside_rect(PEData *data, const float co[3])
static int key_inside_test(PEData *data, const float co[3])
{
- if(data->mval)
+ if (data->mval)
return key_inside_circle(data, data->rad, co, NULL);
else
return key_inside_rect(data, co);
@@ -495,7 +495,7 @@ static int point_is_selected(PTCacheEditPoint *point)
{
KEY_K;
- if(point->flag & PEP_HIDE)
+ if (point->flag & PEP_HIDE)
return 0;
LOOP_SELECTED_KEYS {
@@ -520,43 +520,43 @@ static void for_mouse_hit_keys(PEData *data, ForKeyFunc func, int nearest)
float dist= data->rad;
/* in path select mode we have no keys */
- if(pset->selectmode==SCE_SELECT_PATH)
+ if (pset->selectmode==SCE_SELECT_PATH)
return;
nearest_point= -1;
nearest_key= -1;
LOOP_VISIBLE_POINTS {
- if(pset->selectmode == SCE_SELECT_END) {
+ if (pset->selectmode == SCE_SELECT_END) {
/* only do end keys */
key= point->keys + point->totkey-1;
- if(nearest) {
- if(key_inside_circle(data, dist, KEY_WCO, &dist)) {
+ if (nearest) {
+ if (key_inside_circle(data, dist, KEY_WCO, &dist)) {
nearest_point= p;
nearest_key= point->totkey-1;
}
}
- else if(key_inside_test(data, KEY_WCO))
+ else if (key_inside_test(data, KEY_WCO))
func(data, p, point->totkey-1);
}
else {
/* do all keys */
LOOP_VISIBLE_KEYS {
- if(nearest) {
- if(key_inside_circle(data, dist, KEY_WCO, &dist)) {
+ if (nearest) {
+ if (key_inside_circle(data, dist, KEY_WCO, &dist)) {
nearest_point= p;
nearest_key= k;
}
}
- else if(key_inside_test(data, KEY_WCO))
+ else if (key_inside_test(data, KEY_WCO))
func(data, p, k);
}
}
}
/* do nearest only */
- if(nearest && nearest_point > -1)
+ if (nearest && nearest_point > -1)
func(data, nearest_point, nearest_key);
}
@@ -567,23 +567,23 @@ static void foreach_mouse_hit_point(PEData *data, ForPointFunc func, int selecte
POINT_P; KEY_K;
/* all is selected in path mode */
- if(pset->selectmode==SCE_SELECT_PATH)
+ if (pset->selectmode==SCE_SELECT_PATH)
selected=0;
LOOP_VISIBLE_POINTS {
- if(pset->selectmode==SCE_SELECT_END) {
+ if (pset->selectmode==SCE_SELECT_END) {
/* only do end keys */
key= point->keys + point->totkey - 1;
- if(selected==0 || key->flag & PEK_SELECT)
- if(key_inside_circle(data, data->rad, KEY_WCO, &data->dist))
+ if (selected==0 || key->flag & PEK_SELECT)
+ if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist))
func(data, p);
}
else {
/* do all keys */
LOOP_VISIBLE_KEYS {
- if(selected==0 || key->flag & PEK_SELECT) {
- if(key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
+ if (selected==0 || key->flag & PEK_SELECT) {
+ if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
func(data, p);
break;
}
@@ -602,21 +602,21 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
POINT_P; KEY_K;
float mat[4][4]= MAT4_UNITY, imat[4][4]= MAT4_UNITY;
- if(edit->psys)
+ if (edit->psys)
psmd= psys_get_modifier(data->ob, edit->psys);
/* all is selected in path mode */
- if(pset->selectmode==SCE_SELECT_PATH)
+ if (pset->selectmode==SCE_SELECT_PATH)
selected= 0;
LOOP_VISIBLE_POINTS {
- if(pset->selectmode==SCE_SELECT_END) {
+ if (pset->selectmode==SCE_SELECT_END) {
/* only do end keys */
key= point->keys + point->totkey-1;
- if(selected==0 || key->flag & PEK_SELECT) {
- if(key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
- if(edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
+ if (selected==0 || key->flag & PEK_SELECT) {
+ if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
+ if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, psys->particles + p, mat);
invert_m4_m4(imat,mat);
}
@@ -628,9 +628,9 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
else {
/* do all keys */
LOOP_VISIBLE_KEYS {
- if(selected==0 || key->flag & PEK_SELECT) {
- if(key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
- if(edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
+ if (selected==0 || key->flag & PEK_SELECT) {
+ if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
+ if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, psys->particles + p, mat);
invert_m4_m4(imat,mat);
}
@@ -682,14 +682,14 @@ static int count_selected_keys(Scene *scene, PTCacheEdit *edit)
int sel= 0;
LOOP_VISIBLE_POINTS {
- if(pset->selectmode==SCE_SELECT_POINT) {
+ if (pset->selectmode==SCE_SELECT_POINT) {
LOOP_SELECTED_KEYS {
sel++;
}
}
- else if(pset->selectmode==SCE_SELECT_END) {
+ else if (pset->selectmode==SCE_SELECT_END) {
key = point->keys + point->totkey - 1;
- if(key->flag & PEK_SELECT)
+ if (key->flag & PEK_SELECT)
sel++;
}
}
@@ -716,7 +716,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
psmd= psys_get_modifier(ob, psys);
totpart= psys->totpart;
- if(!psmd->dm)
+ if (!psmd->dm)
return;
tree= BLI_kdtree_new(totpart);
@@ -733,7 +733,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
BLI_kdtree_balance(tree);
/* lookup particles and set in mirror cache */
- if(!edit->mirror_cache)
+ if (!edit->mirror_cache)
edit->mirror_cache= MEM_callocN(sizeof(int)*totpart, "PE mirror cache");
LOOP_PARTICLES {
@@ -746,7 +746,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
index= BLI_kdtree_find_nearest(tree, co, NULL, &nearest);
/* this needs a custom threshold still, duplicated for editmode mirror */
- if(index != -1 && index != p && (nearest.dist <= 0.0002f))
+ if (index != -1 && index != p && (nearest.dist <= 0.0002f))
edit->mirror_cache[p]= index;
else
edit->mirror_cache[p]= -1;
@@ -754,9 +754,9 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
/* make sure mirrors are in two directions */
LOOP_PARTICLES {
- if(edit->mirror_cache[p]) {
+ if (edit->mirror_cache[p]) {
index= edit->mirror_cache[p];
- if(edit->mirror_cache[index] != p)
+ if (edit->mirror_cache[index] != p)
edit->mirror_cache[p]= -1;
}
}
@@ -777,15 +777,15 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
i= pa - psys->particles;
/* find mirrored particle if needed */
- if(!mpa) {
- if(!edit->mirror_cache)
+ if (!mpa) {
+ if (!edit->mirror_cache)
PE_update_mirror_cache(ob, psys);
- if(!edit->mirror_cache)
+ if (!edit->mirror_cache)
return; /* something went wrong! */
mi= edit->mirror_cache[i];
- if(mi == -1)
+ if (mi == -1)
return;
mpa= psys->particles + mi;
}
@@ -796,9 +796,9 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
mpoint = edit->points + mi;
/* make sure they have the same amount of keys */
- if(pa->totkey != mpa->totkey) {
- if(mpa->hair) MEM_freeN(mpa->hair);
- if(mpoint->keys) MEM_freeN(mpoint->keys);
+ if (pa->totkey != mpa->totkey) {
+ if (mpa->hair) MEM_freeN(mpa->hair);
+ if (mpoint->keys) MEM_freeN(mpoint->keys);
mpa->hair= MEM_dupallocN(pa->hair);
mpa->totkey= pa->totkey;
@@ -807,7 +807,7 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
mhkey= mpa->hair;
mkey= mpoint->keys;
- for(k=0; k<mpa->totkey; k++, mkey++, mhkey++) {
+ for (k=0; k<mpa->totkey; k++, mkey++, mhkey++) {
mkey->co= mhkey->co;
mkey->time= &mhkey->time;
mkey->flag &= ~PEK_SELECT;
@@ -823,21 +823,21 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
mhkey=mpa->hair;
key= point->keys;
mkey= mpoint->keys;
- for(k=0; k<pa->totkey; k++, hkey++, mhkey++, key++, mkey++) {
+ for (k=0; k<pa->totkey; k++, hkey++, mhkey++, key++, mkey++) {
copy_v3_v3(mhkey->co, hkey->co);
mul_m4_v3(mat, mhkey->co);
mhkey->co[0]= -mhkey->co[0];
mul_m4_v3(immat, mhkey->co);
- if(key->flag & PEK_TAG)
+ if (key->flag & PEK_TAG)
mkey->flag |= PEK_TAG;
mkey->length = key->length;
}
- if(point->flag & PEP_TAG)
+ if (point->flag & PEP_TAG)
mpoint->flag |= PEP_TAG;
- if(point->flag & PEP_EDIT_RECALC)
+ if (point->flag & PEP_EDIT_RECALC)
mpoint->flag |= PEP_EDIT_RECALC;
}
@@ -847,35 +847,35 @@ static void PE_apply_mirror(Object *ob, ParticleSystem *psys)
ParticleSystemModifierData *psmd;
POINT_P;
- if(!psys)
+ if (!psys)
return;
edit= psys->edit;
psmd= psys_get_modifier(ob, psys);
- if(!psmd->dm)
+ if (!psmd->dm)
return;
- if(!edit->mirror_cache)
+ if (!edit->mirror_cache)
PE_update_mirror_cache(ob, psys);
- if(!edit->mirror_cache)
+ if (!edit->mirror_cache)
return; /* something went wrong */
/* we delay settings the PARS_EDIT_RECALC for mirrored particles
* to avoid doing mirror twice */
LOOP_POINTS {
- if(point->flag & PEP_EDIT_RECALC) {
+ if (point->flag & PEP_EDIT_RECALC) {
PE_mirror_particle(ob, psmd->dm, psys, psys->particles + p, NULL);
- if(edit->mirror_cache[p] != -1)
+ if (edit->mirror_cache[p] != -1)
edit->points[edit->mirror_cache[p]].flag &= ~PEP_EDIT_RECALC;
}
}
LOOP_POINTS {
- if(point->flag & PEP_EDIT_RECALC)
- if(edit->mirror_cache[p] != -1)
+ if (point->flag & PEP_EDIT_RECALC)
+ if (edit->mirror_cache[p] != -1)
edit->points[edit->mirror_cache[p]].flag |= PEP_EDIT_RECALC;
}
}
@@ -894,13 +894,13 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
float *vec, *nor, dvec[3], dot, dist_1st=0.0f;
float hairimat[4][4], hairmat[4][4];
- if(edit==NULL || edit->psys==NULL || (pset->flag & PE_DEFLECT_EMITTER)==0 || (edit->psys->flag & PSYS_GLOBAL_HAIR))
+ if (edit==NULL || edit->psys==NULL || (pset->flag & PE_DEFLECT_EMITTER)==0 || (edit->psys->flag & PSYS_GLOBAL_HAIR))
return;
psys = edit->psys;
psmd = psys_get_modifier(ob,psys);
- if(!psmd->dm)
+ if (!psmd->dm)
return;
LOOP_EDITED_POINTS {
@@ -911,7 +911,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
}
LOOP_KEYS {
- if(k==0) {
+ if (k==0) {
dist_1st = len_v3v3((key+1)->co, key->co);
dist_1st *= 0.75f * pset->emitterdist;
}
@@ -926,8 +926,8 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
dot=dot_v3v3(dvec,nor);
copy_v3_v3(dvec,nor);
- if(dot>0.0f) {
- if(dot<dist_1st) {
+ if (dot>0.0f) {
+ if (dot<dist_1st) {
normalize_v3(dvec);
mul_v3_fl(dvec,dist_1st-dot);
add_v3_v3(key->co, dvec);
@@ -938,7 +938,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
mul_v3_fl(dvec,dist_1st-dot);
add_v3_v3(key->co, dvec);
}
- if(k==1)
+ if (k==1)
dist_1st*=1.3333f;
}
}
@@ -958,15 +958,15 @@ static void PE_apply_lengths(Scene *scene, PTCacheEdit *edit)
POINT_P; KEY_K;
float dv1[3];
- if(edit==0 || (pset->flag & PE_KEEP_LENGTHS)==0)
+ if (edit==0 || (pset->flag & PE_KEEP_LENGTHS)==0)
return;
- if(edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
+ if (edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
return;
LOOP_EDITED_POINTS {
LOOP_KEYS {
- if(k) {
+ if (k) {
sub_v3_v3v3(dv1, key->co, (key - 1)->co);
normalize_v3(dv1);
mul_v3_fl(dv1, (key - 1)->length);
@@ -987,17 +987,17 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit)
float dv1[3]= {0.0f, 0.0f, 0.0f};
float dv2[3]= {0.0f, 0.0f, 0.0f};
- if(edit==0 || (pset->flag & PE_KEEP_LENGTHS)==0)
+ if (edit==0 || (pset->flag & PE_KEEP_LENGTHS)==0)
return;
- if(edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
+ if (edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
return;
LOOP_EDITED_POINTS {
- for(j=1; j<point->totkey; j++) {
+ for (j=1; j<point->totkey; j++) {
float mul= 1.0f / (float)point->totkey;
- if(pset->flag & PE_LOCK_FIRST) {
+ if (pset->flag & PE_LOCK_FIRST) {
key= point->keys + 1;
k= 1;
dv1[0]= dv1[1]= dv1[2]= 0.0;
@@ -1008,20 +1008,20 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit)
dv0[0]= dv0[1]= dv0[2]= 0.0;
}
- for(; k<point->totkey; k++, key++) {
- if(k) {
+ for (; k<point->totkey; k++, key++) {
+ if (k) {
sub_v3_v3v3(dv0, (key - 1)->co, key->co);
tlen= normalize_v3(dv0);
mul_v3_fl(dv0, (mul * (tlen - (key - 1)->length)));
}
- if(k < point->totkey - 1) {
+ if (k < point->totkey - 1) {
sub_v3_v3v3(dv2, (key + 1)->co, key->co);
tlen= normalize_v3(dv2);
mul_v3_fl(dv2, mul * (tlen - key->length));
}
- if(k) {
+ if (k) {
add_v3_v3((key-1)->co, dv1);
}
@@ -1035,12 +1035,12 @@ static void recalc_lengths(PTCacheEdit *edit)
{
POINT_P; KEY_K;
- if(edit==0)
+ if (edit==0)
return;
LOOP_EDITED_POINTS {
key= point->keys;
- for(k=0; k<point->totkey-1; k++, key++) {
+ for (k=0; k<point->totkey-1; k++, key++) {
key->length= len_v3v3(key->co, (key + 1)->co);
}
}
@@ -1054,10 +1054,10 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
float *vec, *nor;
int i, totface /*, totvert*/;
- if(!dm)
+ if (!dm)
return;
- if(edit->emitter_cosnos)
+ if (edit->emitter_cosnos)
MEM_freeN(edit->emitter_cosnos);
BLI_kdtree_free(edit->emitter_field);
@@ -1072,7 +1072,7 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
vec=edit->emitter_cosnos;
nor=vec+3;
- for(i=0; i<totface; i++, vec+=6, nor+=6) {
+ for (i=0; i<totface; i++, vec+=6, nor+=6) {
MFace *mface=dm->getTessFaceData(dm,i,CD_MFACE);
MVert *mvert;
@@ -1088,7 +1088,7 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
add_v3_v3v3(vec,vec,mvert->co);
VECADD(nor,nor,mvert->no);
- if(mface->v4) {
+ if (mface->v4) {
mvert=dm->getVertData(dm,mface->v4,CD_MVERT);
add_v3_v3v3(vec,vec,mvert->co);
VECADD(nor,nor,mvert->no);
@@ -1113,13 +1113,13 @@ static void PE_update_selection(Scene *scene, Object *ob, int useflag)
POINT_P; KEY_K;
/* flag all particles to be updated if not using flag */
- if(!useflag)
+ if (!useflag)
LOOP_POINTS
point->flag |= PEP_EDIT_RECALC;
/* flush edit key flag to hair key flag to preserve selection
* on save */
- if(edit->psys) LOOP_POINTS {
+ if (edit->psys) LOOP_POINTS {
hkey = edit->psys->particles[p].hair;
LOOP_KEYS {
hkey->editflag= key->flag;
@@ -1142,16 +1142,16 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit)
POINT_P; KEY_K;
float hairmat[4][4];
- if(psys==0 || psys->edit==0 || psmd->dm==NULL)
+ if (psys==0 || psys->edit==0 || psmd->dm==NULL)
return;
LOOP_POINTS {
- if(!(psys->flag & PSYS_GLOBAL_HAIR))
+ if (!(psys->flag & PSYS_GLOBAL_HAIR))
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, hairmat);
LOOP_KEYS {
copy_v3_v3(key->world_co,key->co);
- if(!(psys->flag & PSYS_GLOBAL_HAIR))
+ if (!(psys->flag & PSYS_GLOBAL_HAIR))
mul_m4_v3(hairmat, key->world_co);
}
}
@@ -1163,37 +1163,37 @@ static void update_velocities(PTCacheEdit *edit)
POINT_P; KEY_K;
/* hair doesn't use velocities */
- if(edit->psys || !edit->points || !edit->points->keys->vel)
+ if (edit->psys || !edit->points || !edit->points->keys->vel)
return;
frs_sec = edit->pid.flag & PTCACHE_VEL_PER_SEC ? 25.0f : 1.0f;
LOOP_EDITED_POINTS {
LOOP_KEYS {
- if(k==0) {
+ if (k==0) {
dfra = *(key+1)->time - *key->time;
- if(dfra <= 0.0f)
+ if (dfra <= 0.0f)
continue;
sub_v3_v3v3(key->vel, (key+1)->co, key->co);
- if(point->totkey>2) {
+ if (point->totkey>2) {
sub_v3_v3v3(vec1, (key+1)->co, (key+2)->co);
project_v3_v3v3(vec2, vec1, key->vel);
sub_v3_v3v3(vec2, vec1, vec2);
madd_v3_v3fl(key->vel, vec2, 0.5f);
}
}
- else if(k==point->totkey-1) {
+ else if (k==point->totkey-1) {
dfra = *key->time - *(key-1)->time;
- if(dfra <= 0.0f)
+ if (dfra <= 0.0f)
continue;
sub_v3_v3v3(key->vel, key->co, (key-1)->co);
- if(point->totkey>2) {
+ if (point->totkey>2) {
sub_v3_v3v3(vec1, (key-2)->co, (key-1)->co);
project_v3_v3v3(vec2, vec1, key->vel);
sub_v3_v3v3(vec2, vec1, vec2);
@@ -1203,7 +1203,7 @@ static void update_velocities(PTCacheEdit *edit)
else {
dfra = *(key+1)->time - *(key-1)->time;
- if(dfra <= 0.0f)
+ if (dfra <= 0.0f)
continue;
sub_v3_v3v3(key->vel, (key+1)->co, (key-1)->co);
@@ -1221,11 +1221,11 @@ void PE_update_object(Scene *scene, Object *ob, int useflag)
PTCacheEdit *edit = PE_get_current(scene, ob);
POINT_P;
- if(!edit)
+ if (!edit)
return;
/* flag all particles to be updated if not using flag */
- if(!useflag)
+ if (!useflag)
LOOP_POINTS {
point->flag |= PEP_EDIT_RECALC;
}
@@ -1234,11 +1234,11 @@ void PE_update_object(Scene *scene, Object *ob, int useflag)
pe_iterate_lengths(scene, edit);
pe_deflect_emitter(scene, ob, edit);
PE_apply_lengths(scene, edit);
- if(pe_x_mirror(ob))
+ if (pe_x_mirror(ob))
PE_apply_mirror(ob,edit->psys);
- if(edit->psys)
+ if (edit->psys)
update_world_cos(ob, edit);
- if(pset->flag & PE_AUTO_VELOCITY)
+ if (pset->flag & PE_AUTO_VELOCITY)
update_velocities(edit);
PE_hide_keys_time(scene, edit, CFRA);
@@ -1250,7 +1250,7 @@ void PE_update_object(Scene *scene, Object *ob, int useflag)
point->flag &= ~PEP_EDIT_RECALC;
}
- if(edit->psys)
+ if (edit->psys)
edit->psys->flag &= ~PSYS_HAIR_UPDATED;
}
@@ -1266,7 +1266,7 @@ static void select_key(PEData *data, int point_index, int key_index)
PTCacheEditPoint *point = edit->points + point_index;
PTCacheEditKey *key = point->keys + key_index;
- if(data->select)
+ if (data->select)
key->flag |= PEK_SELECT;
else
key->flag &= ~PEK_SELECT;
@@ -1281,7 +1281,7 @@ static void select_keys(PEData *data, int point_index, int UNUSED(key_index))
KEY_K;
LOOP_KEYS {
- if(data->select)
+ if (data->select)
key->flag |= PEK_SELECT;
else
key->flag &= ~PEK_SELECT;
@@ -1342,7 +1342,8 @@ static int pe_select_all_exec(bContext *C, wmOperator *op)
if ((key->flag & PEK_SELECT) == 0) {
key->flag |= PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
- } else {
+ }
+ else {
key->flag &= ~PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
}
@@ -1360,15 +1361,15 @@ static int pe_select_all_exec(bContext *C, wmOperator *op)
void PARTICLE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Selection of all particles";
- ot->idname= "PARTICLE_OT_select_all";
+ ot->name = "(De)select All";
+ ot->idname = "PARTICLE_OT_select_all";
/* api callbacks */
- ot->exec= pe_select_all_exec;
- ot->poll= PE_poll;
+ ot->exec = pe_select_all_exec;
+ ot->poll = PE_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -1383,10 +1384,10 @@ int PE_mouse_particles(bContext *C, const int mval[2], int extend)
PTCacheEdit *edit= PE_get_current(scene, ob);
POINT_P; KEY_K;
- if(!PE_start_edit(edit))
+ if (!PE_start_edit(edit))
return OPERATOR_CANCELLED;
- if(!extend) {
+ if (!extend) {
LOOP_VISIBLE_POINTS {
LOOP_SELECTED_KEYS {
key->flag &= ~PEK_SELECT;
@@ -1434,15 +1435,15 @@ static int select_roots_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_select_roots(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Roots";
- ot->idname= "PARTICLE_OT_select_roots";
+ ot->name = "Select Roots";
+ ot->idname = "PARTICLE_OT_select_roots";
/* api callbacks */
- ot->exec= select_roots_exec;
- ot->poll= PE_poll;
+ ot->exec = select_roots_exec;
+ ot->poll = PE_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ select last operator ************************/
@@ -1474,15 +1475,15 @@ static int select_tips_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_select_tips(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Tips";
- ot->idname= "PARTICLE_OT_select_tips";
+ ot->name = "Select Tips";
+ ot->idname = "PARTICLE_OT_select_tips";
/* api callbacks */
- ot->exec= select_tips_exec;
- ot->poll= PE_poll;
+ ot->exec = select_tips_exec;
+ ot->poll = PE_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ select linked operator ************************/
@@ -1518,16 +1519,16 @@ static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *event)
void PARTICLE_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Linked";
- ot->idname= "PARTICLE_OT_select_linked";
+ ot->name = "Select Linked";
+ ot->idname = "PARTICLE_OT_select_linked";
/* api callbacks */
- ot->exec= select_linked_exec;
- ot->invoke= select_linked_invoke;
- ot->poll= PE_poll_view3d;
+ ot->exec = select_linked_exec;
+ ot->invoke = select_linked_invoke;
+ ot->poll = PE_poll_view3d;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect linked keys rather than selecting them");
@@ -1554,7 +1555,7 @@ int PE_border_select(bContext *C, rcti *rect, int select, int extend)
PTCacheEdit *edit= PE_get_current(scene, ob);
PEData data;
- if(!PE_start_edit(edit))
+ if (!PE_start_edit(edit))
return OPERATOR_CANCELLED;
if (extend == 0 && select)
@@ -1581,7 +1582,7 @@ int PE_circle_select(bContext *C, int selecting, const int mval[2], float rad)
PTCacheEdit *edit= PE_get_current(scene, ob);
PEData data;
- if(!PE_start_edit(edit))
+ if (!PE_start_edit(edit))
return OPERATOR_FINISHED;
PE_set_view3d_data(C, &data);
@@ -1614,7 +1615,7 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho
PEData data;
- if(!PE_start_edit(edit))
+ if (!PE_start_edit(edit))
return OPERATOR_CANCELLED;
if (extend == 0 && select)
@@ -1624,38 +1625,38 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho
PE_set_view3d_data(C, &data);
LOOP_VISIBLE_POINTS {
- if(edit->psys && !(psys->flag & PSYS_GLOBAL_HAIR))
+ if (edit->psys && !(psys->flag & PSYS_GLOBAL_HAIR))
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + p, mat);
- if(pset->selectmode==SCE_SELECT_POINT) {
+ if (pset->selectmode==SCE_SELECT_POINT) {
LOOP_KEYS {
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
project_int(ar, co, vertco);
- if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
- if(select && !(key->flag & PEK_SELECT)) {
+ 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;
}
- else if(key->flag & PEK_SELECT) {
+ else if (key->flag & PEK_SELECT) {
key->flag &= ~PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
}
}
}
}
- else if(pset->selectmode==SCE_SELECT_END) {
+ else if (pset->selectmode==SCE_SELECT_END) {
key= point->keys + point->totkey - 1;
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
project_int(ar, co,vertco);
- if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
- if(select && !(key->flag & PEK_SELECT)) {
+ 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;
}
- else if(key->flag & PEK_SELECT) {
+ else if (key->flag & PEK_SELECT) {
key->flag &= ~PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
}
@@ -1678,7 +1679,7 @@ static int hide_exec(bContext *C, wmOperator *op)
PTCacheEdit *edit= PE_get_current(scene, ob);
POINT_P; KEY_K;
- if(RNA_enum_get(op->ptr, "unselected")) {
+ if (RNA_enum_get(op->ptr, "unselected")) {
LOOP_UNSELECTED_POINTS {
point->flag |= PEP_HIDE;
point->flag |= PEP_EDIT_RECALC;
@@ -1706,15 +1707,15 @@ static int hide_exec(bContext *C, wmOperator *op)
void PARTICLE_OT_hide(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Hide Selected";
- ot->idname= "PARTICLE_OT_hide";
+ ot->name = "Hide Selected";
+ ot->idname = "PARTICLE_OT_hide";
/* api callbacks */
- ot->exec= hide_exec;
- ot->poll= PE_poll;
+ ot->exec = hide_exec;
+ ot->poll = PE_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
@@ -1730,7 +1731,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
POINT_P; KEY_K;
LOOP_POINTS {
- if(point->flag & PEP_HIDE) {
+ if (point->flag & PEP_HIDE) {
point->flag &= ~PEP_HIDE;
point->flag |= PEP_EDIT_RECALC;
@@ -1748,15 +1749,15 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_reveal(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reveal";
- ot->idname= "PARTICLE_OT_reveal";
+ ot->name = "Reveal";
+ ot->idname = "PARTICLE_OT_reveal";
/* api callbacks */
- ot->exec= reveal_exec;
- ot->poll= PE_poll;
+ ot->exec = reveal_exec;
+ ot->poll = PE_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ select less operator ************************/
@@ -1768,22 +1769,22 @@ static void select_less_keys(PEData *data, int point_index)
KEY_K;
LOOP_SELECTED_KEYS {
- if(k==0) {
- if(((key+1)->flag&PEK_SELECT)==0)
+ if (k==0) {
+ if (((key+1)->flag&PEK_SELECT)==0)
key->flag |= PEK_TAG;
}
- else if(k==point->totkey-1) {
- if(((key-1)->flag&PEK_SELECT)==0)
+ else if (k==point->totkey-1) {
+ if (((key-1)->flag&PEK_SELECT)==0)
key->flag |= PEK_TAG;
}
else {
- if((((key-1)->flag & (key+1)->flag) & PEK_SELECT)==0)
+ if ((((key-1)->flag & (key+1)->flag) & PEK_SELECT)==0)
key->flag |= PEK_TAG;
}
}
LOOP_KEYS {
- if(key->flag&PEK_TAG) {
+ if (key->flag&PEK_TAG) {
key->flag &= ~(PEK_TAG|PEK_SELECT);
point->flag |= PEP_EDIT_RECALC; /* redraw selection only */
}
@@ -1806,15 +1807,15 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_select_less(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Less";
- ot->idname= "PARTICLE_OT_select_less";
+ ot->name = "Select Less";
+ ot->idname = "PARTICLE_OT_select_less";
/* api callbacks */
- ot->exec= select_less_exec;
- ot->poll= PE_poll;
+ ot->exec = select_less_exec;
+ ot->poll = PE_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ select more operator ************************/
@@ -1826,24 +1827,24 @@ static void select_more_keys(PEData *data, int point_index)
KEY_K;
LOOP_KEYS {
- if(key->flag & PEK_SELECT) continue;
+ if (key->flag & PEK_SELECT) continue;
- if(k==0) {
- if((key+1)->flag&PEK_SELECT)
+ if (k==0) {
+ if ((key+1)->flag&PEK_SELECT)
key->flag |= PEK_TAG;
}
- else if(k==point->totkey-1) {
- if((key-1)->flag&PEK_SELECT)
+ else if (k==point->totkey-1) {
+ if ((key-1)->flag&PEK_SELECT)
key->flag |= PEK_TAG;
}
else {
- if(((key-1)->flag | (key+1)->flag) & PEK_SELECT)
+ if (((key-1)->flag | (key+1)->flag) & PEK_SELECT)
key->flag |= PEK_TAG;
}
}
LOOP_KEYS {
- if(key->flag&PEK_TAG) {
+ if (key->flag&PEK_TAG) {
key->flag &= ~PEK_TAG;
key->flag |= PEK_SELECT;
point->flag |= PEP_EDIT_RECALC; /* redraw selection only */
@@ -1867,15 +1868,15 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_select_more(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select More";
- ot->idname= "PARTICLE_OT_select_more";
+ ot->name = "Select More";
+ ot->idname = "PARTICLE_OT_select_more";
/* api callbacks */
- ot->exec= select_more_exec;
- ot->poll= PE_poll;
+ ot->exec = select_more_exec;
+ ot->poll = PE_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ rekey operator ************************/
@@ -1911,7 +1912,7 @@ static void rekey_particle(PEData *data, int pa_index)
dval= (end - sta) / (float)(data->totrekey - 1);
/* interpolate new keys from old ones */
- for(k=1,key++; k<data->totrekey-1; k++,key++) {
+ for (k=1,key++; k<data->totrekey-1; k++,key++) {
state.time= (float)k / (float)(data->totrekey-1);
psys_get_particle_on_path(&sim, pa_index, &state, 0);
copy_v3_v3(key->co, state.co);
@@ -1919,22 +1920,22 @@ static void rekey_particle(PEData *data, int pa_index)
}
/* replace keys */
- if(pa->hair)
+ if (pa->hair)
MEM_freeN(pa->hair);
pa->hair= new_keys;
point->totkey=pa->totkey=data->totrekey;
- if(point->keys)
+ if (point->keys)
MEM_freeN(point->keys);
ekey= point->keys= MEM_callocN(pa->totkey * sizeof(PTCacheEditKey),"Hair re-key edit keys");
- for(k=0, key=pa->hair; k<pa->totkey; k++, key++, ekey++) {
+ for (k=0, key=pa->hair; k<pa->totkey; k++, key++, ekey++) {
ekey->co= key->co;
ekey->time= &key->time;
ekey->flag |= PEK_SELECT;
- if(!(psys->flag & PSYS_GLOBAL_HAIR))
+ if (!(psys->flag & PSYS_GLOBAL_HAIR))
ekey->flag |= PEK_USE_WCO;
}
@@ -1963,16 +1964,16 @@ static int rekey_exec(bContext *C, wmOperator *op)
void PARTICLE_OT_rekey(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Rekey";
- ot->idname= "PARTICLE_OT_rekey";
+ ot->name = "Rekey";
+ ot->idname = "PARTICLE_OT_rekey";
/* api callbacks */
- ot->exec= rekey_exec;
- ot->invoke= WM_operator_props_popup;
- ot->poll= PE_poll;
+ ot->exec = rekey_exec;
+ ot->invoke = WM_operator_props_popup;
+ ot->poll = PE_hair_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_int(ot->srna, "keys", 2, 2, INT_MAX, "Number of Keys", "", 2, 100);
@@ -1989,7 +1990,7 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float
PTCacheEditKey *ekey;
int k;
- if(!edit || !edit->psys) return;
+ if (!edit || !edit->psys) return;
psys = edit->psys;
@@ -2004,19 +2005,19 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float
key= new_keys= MEM_dupallocN(pa->hair);
/* interpolate new keys from old ones (roots stay the same) */
- for(k=1, key++; k < pa->totkey; k++, key++) {
+ for (k=1, key++; k < pa->totkey; k++, key++) {
state.time= path_time * (float)k / (float)(pa->totkey-1);
psys_get_particle_on_path(&sim, pa_index, &state, 0);
copy_v3_v3(key->co, state.co);
}
/* replace hair keys */
- if(pa->hair)
+ if (pa->hair)
MEM_freeN(pa->hair);
pa->hair= new_keys;
/* update edit pointers */
- for(k=0, key=pa->hair, ekey=edit->points[pa_index].keys; k<pa->totkey; k++, key++, ekey++) {
+ for (k=0, key=pa->hair, ekey=edit->points[pa_index].keys; k<pa->totkey; k++, key++, ekey++) {
ekey->co= key->co;
ekey->time= &key->time;
}
@@ -2035,7 +2036,7 @@ static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
ParticleSystemModifierData *psmd;
int i, new_totpart= psys->totpart, removed= 0;
- if(mirror) {
+ if (mirror) {
/* mirror tags */
psmd= psys_get_modifier(ob, psys);
@@ -2049,16 +2050,16 @@ static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
removed++;
}
- if(new_totpart != psys->totpart) {
- if(new_totpart) {
+ if (new_totpart != psys->totpart) {
+ if (new_totpart) {
npa= new_pars= MEM_callocN(new_totpart * sizeof(ParticleData), "ParticleData array");
npoint= new_points= MEM_callocN(new_totpart * sizeof(PTCacheEditPoint), "PTCacheEditKey array");
- if(ELEM(NULL, new_pars, new_points)) {
+ if (ELEM(NULL, new_pars, new_points)) {
/* allocation error! */
- if(new_pars)
+ if (new_pars)
MEM_freeN(new_pars);
- if(new_points)
+ if (new_points)
MEM_freeN(new_points);
return 0;
}
@@ -2066,11 +2067,11 @@ static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
pa= psys->particles;
point= edit->points;
- for(i=0; i<psys->totpart; i++, pa++, point++) {
- if(point->flag & PEP_TAG) {
- if(point->keys)
+ for (i=0; i<psys->totpart; i++, pa++, point++) {
+ if (point->flag & PEP_TAG) {
+ if (point->keys)
MEM_freeN(point->keys);
- if(pa->hair)
+ if (pa->hair)
MEM_freeN(pa->hair);
}
else {
@@ -2081,18 +2082,18 @@ static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
}
}
- if(psys->particles) MEM_freeN(psys->particles);
+ if (psys->particles) MEM_freeN(psys->particles);
psys->particles= new_pars;
- if(edit->points) MEM_freeN(edit->points);
+ if (edit->points) MEM_freeN(edit->points);
edit->points= new_points;
- if(edit->mirror_cache) {
+ if (edit->mirror_cache) {
MEM_freeN(edit->mirror_cache);
edit->mirror_cache= NULL;
}
- if(psys->child) {
+ if (psys->child) {
MEM_freeN(psys->child);
psys->child= NULL;
psys->totchild=0;
@@ -2114,7 +2115,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
ParticleSystemModifierData *psmd;
short new_totkey;
- if(pe_x_mirror(ob)) {
+ if (pe_x_mirror(ob)) {
/* mirror key tags */
psmd= psys_get_modifier(ob, psys);
@@ -2132,7 +2133,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
new_totkey--;
}
/* we can't have elements with less than two keys*/
- if(new_totkey < 2)
+ if (new_totkey < 2)
point->flag |= PEP_TAG;
}
remove_tagged_particles(ob, psys, pe_x_mirror(ob));
@@ -2145,18 +2146,18 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
new_totkey--;
}
- if(new_totkey != pa->totkey) {
+ if (new_totkey != pa->totkey) {
nhkey= new_hkeys= MEM_callocN(new_totkey*sizeof(HairKey), "HairKeys");
nkey= new_keys= MEM_callocN(new_totkey*sizeof(PTCacheEditKey), "particle edit keys");
hkey= pa->hair;
LOOP_KEYS {
- while(key->flag & PEK_TAG && hkey < pa->hair + pa->totkey) {
+ while (key->flag & PEK_TAG && hkey < pa->hair + pa->totkey) {
key++;
hkey++;
}
- if(hkey < pa->hair + pa->totkey) {
+ if (hkey < pa->hair + pa->totkey) {
copy_v3_v3(nhkey->co, hkey->co);
nhkey->editflag = hkey->editflag;
nhkey->time= hkey->time;
@@ -2175,10 +2176,10 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
hkey++;
}
- if(pa->hair)
+ if (pa->hair)
MEM_freeN(pa->hair);
- if(point->keys)
+ if (point->keys)
MEM_freeN(point->keys);
pa->hair= new_hkeys;
@@ -2214,12 +2215,12 @@ static void subdivide_particle(PEData *data, int pa_index)
sim.ob= data->ob;
sim.psys= edit->psys;
- for(k=0, ekey=point->keys; k<pa->totkey-1; k++,ekey++) {
- if(ekey->flag&PEK_SELECT && (ekey+1)->flag&PEK_SELECT)
+ for (k=0, ekey=point->keys; k<pa->totkey-1; k++,ekey++) {
+ if (ekey->flag&PEK_SELECT && (ekey+1)->flag&PEK_SELECT)
totnewkey++;
}
- if(totnewkey==0) return;
+ if (totnewkey==0) return;
pa->flag |= PARS_REKEY;
@@ -2229,7 +2230,7 @@ static void subdivide_particle(PEData *data, int pa_index)
key = pa->hair;
endtime= key[pa->totkey-1].time;
- for(k=0, ekey=point->keys; k<pa->totkey-1; k++, key++, ekey++) {
+ for (k=0, ekey=point->keys; k<pa->totkey-1; k++, key++, ekey++) {
memcpy(nkey,key,sizeof(HairKey));
memcpy(nekey,ekey,sizeof(PTCacheEditKey));
@@ -2240,7 +2241,7 @@ static void subdivide_particle(PEData *data, int pa_index)
nkey++;
nekey++;
- if(ekey->flag & PEK_SELECT && (ekey+1)->flag & PEK_SELECT) {
+ if (ekey->flag & PEK_SELECT && (ekey+1)->flag & PEK_SELECT) {
nkey->time= (key->time + (key+1)->time)*0.5f;
state.time= (endtime != 0.0f)? nkey->time/endtime: 0.0f;
psys_get_particle_on_path(&sim, pa_index, &state, 0);
@@ -2249,7 +2250,7 @@ static void subdivide_particle(PEData *data, int pa_index)
nekey->co= nkey->co;
nekey->time= &nkey->time;
nekey->flag |= PEK_SELECT;
- if(!(psys->flag & PSYS_GLOBAL_HAIR))
+ if (!(psys->flag & PSYS_GLOBAL_HAIR))
nekey->flag |= PEK_USE_WCO;
nekey++;
@@ -2263,11 +2264,11 @@ static void subdivide_particle(PEData *data, int pa_index)
nekey->co= nkey->co;
nekey->time= &nkey->time;
- if(pa->hair)
+ if (pa->hair)
MEM_freeN(pa->hair);
pa->hair= new_keys;
- if(point->keys)
+ if (point->keys)
MEM_freeN(point->keys);
point->keys= new_ekeys;
@@ -2293,15 +2294,15 @@ static int subdivide_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_subdivide(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Subdivide";
- ot->idname= "PARTICLE_OT_subdivide";
+ ot->name = "Subdivide";
+ ot->idname = "PARTICLE_OT_subdivide";
/* api callbacks */
- ot->exec= subdivide_exec;
- ot->poll= PE_poll;
+ ot->exec = subdivide_exec;
+ ot->poll = PE_hair_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ remove doubles opertor *********************/
@@ -2319,7 +2320,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
float mat[4][4], co[3], threshold= RNA_float_get(op->ptr, "threshold");
int n, totn, removed, totremoved;
- if(psys->flag & PSYS_GLOBAL_HAIR)
+ if (psys->flag & PSYS_GLOBAL_HAIR)
return OPERATOR_CANCELLED;
edit= psys->edit;
@@ -2349,10 +2350,10 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
totn= BLI_kdtree_find_n_nearest(tree,10,co,NULL,nearest);
- for(n=0; n<totn; n++) {
+ for (n=0; n<totn; n++) {
/* this needs a custom threshold still */
- if(nearest[n].index > p && nearest[n].dist < threshold) {
- if(!(point->flag & PEP_TAG)) {
+ if (nearest[n].index > p && nearest[n].dist < threshold) {
+ if (!(point->flag & PEP_TAG)) {
point->flag |= PEP_TAG;
removed++;
}
@@ -2365,9 +2366,9 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
/* remove tagged particles - don't do mirror here! */
remove_tagged_particles(ob, psys, 0);
totremoved += removed;
- } while(removed);
+ } while (removed);
- if(totremoved == 0)
+ if (totremoved == 0)
return OPERATOR_CANCELLED;
BKE_reportf(op->reports, RPT_INFO, "Remove %d double particles", totremoved);
@@ -2381,15 +2382,15 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
void PARTICLE_OT_remove_doubles(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Doubles";
- ot->idname= "PARTICLE_OT_remove_doubles";
+ ot->name = "Remove Doubles";
+ ot->idname = "PARTICLE_OT_remove_doubles";
/* api callbacks */
- ot->exec= remove_doubles_exec;
- ot->poll= PE_poll;
+ ot->exec = remove_doubles_exec;
+ ot->poll = PE_hair_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_float(ot->srna, "threshold", 0.0002f, 0.0f, FLT_MAX, "Threshold", "Threshold distance withing which particles are removed", 0.00001f, 0.1f);
@@ -2431,15 +2432,15 @@ static int weight_set_exec(bContext *C, wmOperator *op)
void PARTICLE_OT_weight_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Weight Set";
- ot->idname= "PARTICLE_OT_weight_set";
+ ot->name = "Weight Set";
+ ot->idname = "PARTICLE_OT_weight_set";
/* api callbacks */
- ot->exec= weight_set_exec;
- ot->poll= PE_poll;
+ ot->exec = weight_set_exec;
+ ot->poll = PE_hair_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_float(ot->srna, "factor", 1, 0, 1, "Factor", "", 0, 1);
}
@@ -2451,12 +2452,12 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
ParticleEditSettings *pset= PE_settings(CTX_data_scene(C));
ParticleBrushData *brush;
- if(pset->brushtype < 0)
+ if (pset->brushtype < 0)
return;
brush= &pset->brush[pset->brushtype];
- if(brush) {
+ if (brush) {
glPushMatrix();
glTranslatef((float)x, (float)y, 0.0f);
@@ -2476,11 +2477,11 @@ static void toggle_particle_cursor(bContext *C, int enable)
{
ParticleEditSettings *pset= PE_settings(CTX_data_scene(C));
- if(pset->paintcursor && !enable) {
+ if (pset->paintcursor && !enable) {
WM_paint_cursor_end(CTX_wm_manager(C), pset->paintcursor);
pset->paintcursor = NULL;
}
- else if(enable)
+ else if (enable)
pset->paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), PE_poll_view3d, brush_drawcursor, NULL);
}
@@ -2514,12 +2515,12 @@ static int delete_exec(bContext *C, wmOperator *op)
PE_set_data(C, &data);
- if(type == DEL_KEY) {
+ if (type == DEL_KEY) {
foreach_selected_key(&data, set_delete_particle_key);
remove_tagged_keys(data.ob, data.edit->psys);
recalc_lengths(data.edit);
}
- else if(type == DEL_PARTICLE) {
+ else if (type == DEL_PARTICLE) {
foreach_selected_point(&data, set_delete_particle);
remove_tagged_particles(data.ob, data.edit->psys, pe_x_mirror(data.ob));
recalc_lengths(data.edit);
@@ -2534,19 +2535,19 @@ static int delete_exec(bContext *C, wmOperator *op)
void PARTICLE_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete";
- ot->idname= "PARTICLE_OT_delete";
+ ot->name = "Delete";
+ ot->idname = "PARTICLE_OT_delete";
/* api callbacks */
- ot->exec= delete_exec;
- ot->invoke= WM_menu_invoke;
- ot->poll= PE_hair_poll;
+ ot->exec = delete_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->poll = PE_hair_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= RNA_def_enum(ot->srna, "type", delete_type_items, DEL_PARTICLE, "Type", "Delete a full particle or only keys");
+ ot->prop = RNA_def_enum(ot->srna, "type", delete_type_items, DEL_PARTICLE, "Type", "Delete a full particle or only keys");
}
/*************************** mirror operator **************************/
@@ -2564,25 +2565,25 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
int *mirrorfaces = NULL;
int rotation, totpart, newtotpart;
- if(psys->flag & PSYS_GLOBAL_HAIR)
+ if (psys->flag & PSYS_GLOBAL_HAIR)
return;
psmd= psys_get_modifier(ob, psys);
- if(!psmd->dm)
+ if (!psmd->dm)
return;
mirrorfaces= mesh_get_x_mirror_faces(ob, NULL);
- if(!edit->mirror_cache)
+ if (!edit->mirror_cache)
PE_update_mirror_cache(ob, psys);
totpart= psys->totpart;
newtotpart= psys->totpart;
LOOP_VISIBLE_POINTS {
pa = psys->particles + p;
- if(!tagged) {
- if(point_is_selected(point)) {
- if(edit->mirror_cache[p] != -1) {
+ if (!tagged) {
+ if (point_is_selected(point)) {
+ if (edit->mirror_cache[p] != -1) {
/* already has a mirror, don't need to duplicate */
PE_mirror_particle(ob, psmd->dm, psys, pa, NULL);
continue;
@@ -2592,28 +2593,28 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
}
}
- if((point->flag & PEP_TAG) && mirrorfaces[pa->num*2] != -1)
+ if ((point->flag & PEP_TAG) && mirrorfaces[pa->num*2] != -1)
newtotpart++;
}
- if(newtotpart != psys->totpart) {
+ if (newtotpart != psys->totpart) {
/* allocate new arrays and copy existing */
new_pars= MEM_callocN(newtotpart*sizeof(ParticleData), "ParticleData new");
new_points= MEM_callocN(newtotpart*sizeof(PTCacheEditPoint), "PTCacheEditPoint new");
- if(psys->particles) {
+ if (psys->particles) {
memcpy(new_pars, psys->particles, totpart*sizeof(ParticleData));
MEM_freeN(psys->particles);
}
psys->particles= new_pars;
- if(edit->points) {
+ if (edit->points) {
memcpy(new_points, edit->points, totpart*sizeof(PTCacheEditPoint));
MEM_freeN(edit->points);
}
edit->points= new_points;
- if(edit->mirror_cache) {
+ if (edit->mirror_cache) {
MEM_freeN(edit->mirror_cache);
edit->mirror_cache= NULL;
}
@@ -2624,19 +2625,19 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
newpa= psys->particles + totpart;
newpoint= edit->points + totpart;
- for(p=0, point=edit->points; p<totpart; p++, point++) {
+ for (p=0, point=edit->points; p<totpart; p++, point++) {
pa = psys->particles + p;
- if(point->flag & PEP_HIDE)
+ if (point->flag & PEP_HIDE)
continue;
- if(!(point->flag & PEP_TAG) || mirrorfaces[pa->num*2] == -1)
+ if (!(point->flag & PEP_TAG) || mirrorfaces[pa->num*2] == -1)
continue;
/* duplicate */
*newpa= *pa;
*newpoint= *point;
- if(pa->hair) newpa->hair= MEM_dupallocN(pa->hair);
- if(point->keys) newpoint->keys= MEM_dupallocN(point->keys);
+ if (pa->hair) newpa->hair= MEM_dupallocN(pa->hair);
+ if (point->keys) newpoint->keys= MEM_dupallocN(point->keys);
/* rotate weights according to vertex index rotation */
rotation= mirrorfaces[pa->num*2+1];
@@ -2644,11 +2645,13 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
newpa->fuv[1]= pa->fuv[1];
newpa->fuv[2]= pa->fuv[0];
newpa->fuv[3]= pa->fuv[3];
- while(rotation-- > 0)
- if(me->mface[pa->num].v4)
- SHIFT4(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2], newpa->fuv[3])
- else
- SHIFT3(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2])
+ while (rotation-- > 0)
+ if (me->mface[pa->num].v4) {
+ SHIFT4(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2], newpa->fuv[3]);
+ }
+ else {
+ SHIFT3(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2]);
+ }
/* assign face inddex */
newpa->num= mirrorfaces[pa->num*2];
@@ -2656,7 +2659,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
/* update edit key pointers */
key= newpoint->keys;
- for(k=0, hkey=newpa->hair; k<newpa->totkey; k++, hkey++, key++) {
+ for (k=0, hkey=newpa->hair; k<newpa->totkey; k++, hkey++, key++) {
key->co= hkey->co;
key->time= &hkey->time;
}
@@ -2694,15 +2697,15 @@ static int mirror_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_mirror(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mirror";
- ot->idname= "PARTICLE_OT_mirror";
+ ot->name = "Mirror";
+ ot->idname = "PARTICLE_OT_mirror";
/* api callbacks */
- ot->exec= mirror_exec;
- ot->poll= PE_poll;
+ ot->exec = mirror_exec;
+ ot->poll = PE_hair_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************* brush edit callbacks ********************/
@@ -2712,7 +2715,7 @@ static void brush_comb(PEData *data, float UNUSED(mat[][4]), float imat[][4], in
ParticleEditSettings *pset= PE_settings(data->scene);
float cvec[3], fac;
- if(pset->flag & PE_LOCK_FIRST && key_index == 0) return;
+ if (pset->flag & PE_LOCK_FIRST && key_index == 0) return;
fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->combfac);
@@ -2737,10 +2740,10 @@ static void brush_cut(PEData *data, int pa_index)
int vertco[2];
/* blunt scissors */
- if(BLI_frand() > data->cutfac) return;
+ if (BLI_frand() > data->cutfac) return;
/* don't cut hidden */
- if(edit->points[pa_index].flag & PEP_HIDE)
+ if (edit->points[pa_index].flag & PEP_HIDE)
return;
rad2= data->rad * data->rad;
@@ -2758,16 +2761,16 @@ static void brush_cut(PEData *data, int pa_index)
xo1= x1 - o1;
/* check if root is inside circle */
- if(xo0*xo0 + xo1*xo1 < rad2 && key_test_depth(data, key->co)) {
+ if (xo0*xo0 + xo1*xo1 < rad2 && key_test_depth(data, key->co)) {
cut_time= -1.0f;
cut= 1;
}
else {
/* calculate path time closest to root that was inside the circle */
- for(k=1, key++; k<=keys; k++, key++) {
+ for (k=1, key++; k<=keys; k++, key++) {
project_int_noclip(ar, key->co, vertco);
- if(key_test_depth(data, key->co) == 0) {
+ if (key_test_depth(data, key->co) == 0) {
x0= (float)vertco[0];
x1= (float)vertco[1];
@@ -2785,15 +2788,15 @@ static void brush_cut(PEData *data, int pa_index)
d= dv * rad2 - d*d;
- if(d > 0.0f) {
+ if (d > 0.0f) {
d= sqrt(d);
cut_time= -(v0*xo0 + v1*xo1 + d);
- if(cut_time > 0.0f) {
+ if (cut_time > 0.0f) {
cut_time /= dv;
- if(cut_time < 1.0f) {
+ if (cut_time < 1.0f) {
cut_time += (float)(k-1);
cut_time /= (float)keys;
cut= 1;
@@ -2810,8 +2813,8 @@ static void brush_cut(PEData *data, int pa_index)
}
}
- if(cut) {
- if(cut_time < 0.0f) {
+ if (cut) {
+ if (cut_time < 0.0f) {
edit->points[pa_index].flag |= PEP_TAG;
}
else {
@@ -2829,7 +2832,7 @@ static void brush_length(PEData *data, int point_index)
float dvec[3],pvec[3] = {0.0f, 0.0f, 0.0f};
LOOP_KEYS {
- if(k==0) {
+ if (k==0) {
copy_v3_v3(pvec,key->co);
}
else {
@@ -2861,7 +2864,7 @@ static void brush_puff(PEData *data, int point_index)
puff_volume = brush->flag & PE_BRUSH_DATA_PUFF_VOLUME;
}
- if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+ if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(data->ob, data->dm, psys->part->from, psys->particles + point_index, mat);
invert_m4_m4(imat,mat);
}
@@ -2871,14 +2874,14 @@ static void brush_puff(PEData *data, int point_index)
}
LOOP_KEYS {
- if(k==0) {
+ if (k==0) {
/* find root coordinate and normal on emitter */
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
mul_v3_m4v3(kco, data->ob->imat, co); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL);
- if(point_index == -1) return;
+ if (point_index == -1) return;
copy_v3_v3(rootco, co);
copy_v3_v3(nor, &edit->emitter_cosnos[point_index*6+3]);
@@ -2889,7 +2892,7 @@ static void brush_puff(PEData *data, int point_index)
fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->pufffac);
fac *= 0.025f;
- if(data->invert)
+ if (data->invert)
fac= -fac;
}
else {
@@ -2899,7 +2902,7 @@ static void brush_puff(PEData *data, int point_index)
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
length += len_v3v3(lastco, co);
- if((data->select==0 || (key->flag & PEK_SELECT)) && !(key->flag & PEK_HIDE)) {
+ if ((data->select==0 || (key->flag & PEK_SELECT)) && !(key->flag & PEK_HIDE)) {
madd_v3_v3v3fl(kco, rootco, nor, length);
/* blend between the current and straight position */
@@ -2911,7 +2914,7 @@ static void brush_puff(PEData *data, int point_index)
mul_v3_m4v3(key->co, imat, co);
- if(puff_volume) {
+ if (puff_volume) {
/* accumulate the total distance moved to apply to unselected
* keys that come after */
ofs[0] += key->co[0] - dco[0];
@@ -2922,13 +2925,13 @@ static void brush_puff(PEData *data, int point_index)
}
else {
- if(puff_volume) {
+ if (puff_volume) {
#if 0
/* this is simple but looks bad, adds annoying kinks */
add_v3_v3(key->co, ofs);
#else
/* translate (not rotate) the rest of the hair if its not selected */
- if(ofs[0] || ofs[1] || ofs[2]) {
+ if (ofs[0] || ofs[1] || ofs[2]) {
#if 0 /* kindof works but looks worse then whats below */
/* Move the unselected point on a vector based on the
@@ -2953,7 +2956,7 @@ static void brush_puff(PEData *data, int point_index)
mul_v3_m4v3(kco, data->ob->imat, oco); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL);
- if(point_index != -1) {
+ if (point_index != -1) {
copy_v3_v3(onor, &edit->emitter_cosnos[point_index*6+3]);
mul_mat3_m4_v3(data->ob->obmat, onor); /* normal into worldspace */
mul_mat3_m4_v3(imat, onor); /* worldspace into particle space */
@@ -2971,7 +2974,7 @@ static void brush_puff(PEData *data, int point_index)
}
}
- if(change)
+ if (change)
point->flag |= PEP_EDIT_RECALC;
}
@@ -2979,7 +2982,7 @@ static void brush_puff(PEData *data, int point_index)
static void brush_weight(PEData *data, float UNUSED(mat[][4]), float UNUSED(imat[][4]), int point_index, int key_index, PTCacheEditKey *UNUSED(key))
{
/* roots have full weight allways */
- if(key_index) {
+ if (key_index) {
PTCacheEdit *edit = data->edit;
ParticleSystem *psys = edit->psys;
@@ -2992,7 +2995,7 @@ static void brush_weight(PEData *data, float UNUSED(mat[][4]), float UNUSED(imat
static void brush_smooth_get(PEData *data, float mat[][4], float UNUSED(imat[][4]), int UNUSED(point_index), int key_index, PTCacheEditKey *key)
{
- if(key_index) {
+ if (key_index) {
float dvec[3];
sub_v3_v3v3(dvec,key->co,(key-1)->co);
@@ -3006,7 +3009,7 @@ static void brush_smooth_do(PEData *data, float UNUSED(mat[][4]), float imat[][4
{
float vec[3], dvec[3];
- if(key_index) {
+ if (key_index) {
copy_v3_v3(vec, data->vec);
mul_mat3_m4_v3(imat,vec);
@@ -3052,16 +3055,16 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
float cur_d, cur_uv[2], v1[3], v2[3], v3[3], v4[3], min[3], max[3], p_min[3],p_max[3];
float cur_ipoint[3];
- if(dm == NULL){
+ if (dm == NULL) {
psys_disable_all(ob);
dm=mesh_get_derived_final(scene, ob, 0);
- if(dm == NULL)
+ if (dm == NULL)
dm=mesh_get_derived_deform(scene, ob, 0);
psys_enable_all(ob);
- if(dm == NULL)
+ if (dm == NULL)
return 0;
}
@@ -3069,12 +3072,12 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
DM_ensure_tessface(dm);
- if(pa_minmax==0){
+ if (pa_minmax==0) {
INIT_MINMAX(p_min,p_max);
DO_MINMAX(co1,p_min,p_max);
DO_MINMAX(co2,p_min,p_max);
}
- else{
+ else {
copy_v3_v3(p_min,pa_minmax);
copy_v3_v3(p_max,pa_minmax+3);
}
@@ -3084,51 +3087,51 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
mvert=dm->getVertDataArray(dm,CD_MVERT);
/* lets intersect the faces */
- for(i=0; i<totface; i++,mface++){
- if(vert_cos){
+ for (i=0; i<totface; i++,mface++) {
+ if (vert_cos) {
copy_v3_v3(v1,vert_cos+3*mface->v1);
copy_v3_v3(v2,vert_cos+3*mface->v2);
copy_v3_v3(v3,vert_cos+3*mface->v3);
- if(mface->v4)
+ if (mface->v4)
copy_v3_v3(v4,vert_cos+3*mface->v4);
}
- else{
+ else {
copy_v3_v3(v1,mvert[mface->v1].co);
copy_v3_v3(v2,mvert[mface->v2].co);
copy_v3_v3(v3,mvert[mface->v3].co);
- if(mface->v4)
+ if (mface->v4)
copy_v3_v3(v4,mvert[mface->v4].co);
}
- if(face_minmax==0){
+ if (face_minmax==0) {
INIT_MINMAX(min,max);
DO_MINMAX(v1,min,max);
DO_MINMAX(v2,min,max);
DO_MINMAX(v3,min,max);
- if(mface->v4)
- DO_MINMAX(v4,min,max)
- if(isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
+ if (mface->v4)
+ DO_MINMAX(v4, min, max);
+ if (isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
continue;
}
- else{
+ else {
copy_v3_v3(min, face_minmax+6*i);
copy_v3_v3(max, face_minmax+6*i+3);
- if(isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
+ if (isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
continue;
}
- if(radius>0.0f){
- if(isect_sweeping_sphere_tri_v3(co1, co2, radius, v2, v3, v1, &cur_d, cur_ipoint)){
- if(cur_d<*min_d){
+ if (radius>0.0f) {
+ if (isect_sweeping_sphere_tri_v3(co1, co2, radius, v2, v3, v1, &cur_d, cur_ipoint)) {
+ if (cur_d<*min_d) {
*min_d=cur_d;
copy_v3_v3(ipoint,cur_ipoint);
*min_face=i;
intersect=1;
}
}
- if(mface->v4){
- if(isect_sweeping_sphere_tri_v3(co1, co2, radius, v4, v1, v3, &cur_d, cur_ipoint)){
- if(cur_d<*min_d){
+ if (mface->v4) {
+ if (isect_sweeping_sphere_tri_v3(co1, co2, radius, v4, v1, v3, &cur_d, cur_ipoint)) {
+ if (cur_d<*min_d) {
*min_d=cur_d;
copy_v3_v3(ipoint,cur_ipoint);
*min_face=i;
@@ -3137,23 +3140,23 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
}
}
}
- else{
- if(isect_line_tri_v3(co1, co2, v1, v2, v3, &cur_d, cur_uv)){
- if(cur_d<*min_d){
+ else {
+ if (isect_line_tri_v3(co1, co2, v1, v2, v3, &cur_d, cur_uv)) {
+ if (cur_d<*min_d) {
*min_d=cur_d;
min_w[0]= 1.0f - cur_uv[0] - cur_uv[1];
min_w[1]= cur_uv[0];
min_w[2]= cur_uv[1];
min_w[3]= 0.0f;
- if(mface->v4)
+ if (mface->v4)
intersect_dm_quad_weights(v1, v2, v3, v4, min_w);
*min_face=i;
intersect=1;
}
}
- if(mface->v4){
- if(isect_line_tri_v3(co1, co2, v1, v3, v4, &cur_d, cur_uv)){
- if(cur_d<*min_d){
+ if (mface->v4) {
+ if (isect_line_tri_v3(co1, co2, v1, v3, v4, &cur_d, cur_uv)) {
+ if (cur_d<*min_d) {
*min_d=cur_d;
min_w[0]= 1.0f - cur_uv[0] - cur_uv[1];
min_w[1]= 0.0f;
@@ -3190,7 +3193,7 @@ static int brush_add(PEData *data, short number)
DerivedMesh *dm=0;
invert_m4_m4(imat,ob->obmat);
- if(psys->flag & PSYS_GLOBAL_HAIR)
+ if (psys->flag & PSYS_GLOBAL_HAIR)
return 0;
BLI_srandom(psys->seed+data->mval[0]+data->mval[1]);
@@ -3203,15 +3206,15 @@ static int brush_add(PEData *data, short number)
timestep= psys_get_timestep(&sim);
/* painting onto the deformed mesh, could be an option? */
- if(psmd->dm->deformedOnly)
+ if (psmd->dm->deformedOnly)
dm= psmd->dm;
else
dm= mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
- for(i=0; i<number; i++) {
- if(number>1) {
+ for (i=0; i<number; i++) {
+ if (number>1) {
dmx=dmy=size;
- while(dmx*dmx+dmy*dmy>size2) {
+ while (dmx*dmx+dmy*dmy>size2) {
dmx=(short)((2.0f*BLI_frand()-1.0f)*size);
dmy=(short)((2.0f*BLI_frand()-1.0f)*size);
}
@@ -3226,12 +3229,12 @@ static int brush_add(PEData *data, short number)
min_d=2.0;
/* warning, returns the derived mesh face */
- if(particle_intersect_dm(scene, ob,dm,0,co1,co2,&min_d,&add_pars[n].num,add_pars[n].fuv,0,0,0,0)) {
+ if (particle_intersect_dm(scene, ob,dm,0,co1,co2,&min_d,&add_pars[n].num,add_pars[n].fuv,0,0,0,0)) {
add_pars[n].num_dmcache= psys_particle_dm_face_lookup(ob,psmd->dm,add_pars[n].num,add_pars[n].fuv,NULL);
n++;
}
}
- if(n) {
+ if (n) {
int newtotpart=totpart+n;
float hairmat[4][4], cur_co[3];
KDTree *tree=0;
@@ -3245,22 +3248,22 @@ static int brush_add(PEData *data, short number)
memcpy(new_points, edit->points, totpart * sizeof(PTCacheEditPoint));
/* change old arrays to new ones */
- if(psys->particles) MEM_freeN(psys->particles);
+ if (psys->particles) MEM_freeN(psys->particles);
psys->particles= new_pars;
- if(edit->points) MEM_freeN(edit->points);
+ if (edit->points) MEM_freeN(edit->points);
edit->points= new_points;
- if(edit->mirror_cache) {
+ if (edit->mirror_cache) {
MEM_freeN(edit->mirror_cache);
edit->mirror_cache= NULL;
}
/* create tree for interpolation */
- if(pset->flag & PE_INTERPOLATE_ADDED && psys->totpart) {
+ if (pset->flag & PE_INTERPOLATE_ADDED && psys->totpart) {
tree=BLI_kdtree_new(psys->totpart);
- for(i=0, pa=psys->particles; i<totpart; i++, pa++) {
+ for (i=0, pa=psys->particles; i<totpart; i++, pa++) {
psys_particle_on_dm(psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,cur_co,0,0,0,0,0);
BLI_kdtree_insert(tree, i, cur_co, NULL);
}
@@ -3274,17 +3277,17 @@ static int brush_add(PEData *data, short number)
pa= psys->particles + totpart;
point= edit->points + totpart;
- for(i=totpart; i<newtotpart; i++, pa++, point++) {
+ for (i=totpart; i<newtotpart; i++, pa++, point++) {
memcpy(pa, add_pars + i - totpart, sizeof(ParticleData));
pa->hair= MEM_callocN(pset->totaddkey * sizeof(HairKey), "BakeKey key add");
key= point->keys= MEM_callocN(pset->totaddkey * sizeof(PTCacheEditKey), "PTCacheEditKey add");
point->totkey= pa->totkey= pset->totaddkey;
- for(k=0, hkey=pa->hair; k<pa->totkey; k++, hkey++, key++) {
+ for (k=0, hkey=pa->hair; k<pa->totkey; k++, hkey++, key++) {
key->co= hkey->co;
key->time= &hkey->time;
- if(!(psys->flag & PSYS_GLOBAL_HAIR))
+ if (!(psys->flag & PSYS_GLOBAL_HAIR))
key->flag |= PEK_USE_WCO;
}
@@ -3292,12 +3295,12 @@ static int brush_add(PEData *data, short number)
initialize_particle(&sim, pa,i);
reset_particle(&sim, pa, 0.0, 1.0);
point->flag |= PEP_EDIT_RECALC;
- if(pe_x_mirror(ob))
+ if (pe_x_mirror(ob))
point->flag |= PEP_TAG; /* signal for duplicate */
framestep= pa->lifetime/(float)(pset->totaddkey-1);
- if(tree) {
+ if (tree) {
ParticleData *ppa;
HairKey *thkey;
ParticleKey key3[3];
@@ -3310,20 +3313,20 @@ static int brush_add(PEData *data, short number)
maxd= ptn[maxw-1].dist;
- for(w=0; w<maxw; w++) {
+ for (w=0; w<maxw; w++) {
weight[w]= (float)pow(2.0, (double)(-6.0f * ptn[w].dist / maxd));
totw += weight[w];
}
- for(;w<3; w++) {
+ for (;w<3; w++) {
weight[w]= 0.0f;
}
- for(w=0; w<maxw; w++)
+ for (w=0; w<maxw; w++)
weight[w] /= totw;
ppa= psys->particles+ptn[0].index;
- for(k=0; k<pset->totaddkey; k++) {
+ for (k=0; k<pset->totaddkey; k++) {
thkey= (HairKey*)pa->hair + k;
thkey->time= pa->time + k * framestep;
@@ -3334,13 +3337,13 @@ static int brush_add(PEData *data, short number)
/* TODO: interpolatint the weight would be nicer */
thkey->weight= (ppa->hair+MIN2(k, ppa->totkey-1))->weight;
- if(maxw>1) {
+ if (maxw>1) {
key3[1].time= key3[0].time;
psys_get_particle_on_path(&sim, ptn[1].index, &key3[1], 0);
mul_v3_fl(key3[1].co, weight[1]);
add_v3_v3(key3[0].co, key3[1].co);
- if(maxw>2) {
+ if (maxw>2) {
key3[2].time= key3[0].time;
psys_get_particle_on_path(&sim, ptn[2].index, &key3[2], 0);
mul_v3_fl(key3[2].co, weight[2]);
@@ -3348,7 +3351,7 @@ static int brush_add(PEData *data, short number)
}
}
- if(k==0)
+ if (k==0)
sub_v3_v3v3(co1, pa->state.co, key3[0].co);
add_v3_v3v3(thkey->co, key3[0].co, co1);
@@ -3357,26 +3360,26 @@ static int brush_add(PEData *data, short number)
}
}
else {
- for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
+ for (k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
madd_v3_v3v3fl(hkey->co, pa->state.co, pa->state.vel, k * framestep * timestep);
hkey->time += k * framestep;
hkey->weight = 1.f - (float)k/(float)(pset->totaddkey-1);
}
}
- for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
+ for (k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
invert_m4_m4(imat,hairmat);
mul_m4_v3(imat, hkey->co);
}
}
- if(tree)
+ if (tree)
BLI_kdtree_free(tree);
}
- if(add_pars)
+ if (add_pars)
MEM_freeN(add_pars);
- if(!psmd->dm->deformedOnly)
+ if (!psmd->dm->deformedOnly)
dm->release(dm);
return n;
@@ -3405,7 +3408,7 @@ static int brush_edit_init(bContext *C, wmOperator *op)
ARegion *ar= CTX_wm_region(C);
BrushEdit *bedit;
- if(pset->brushtype < 0)
+ if (pset->brushtype < 0)
return 0;
initgrabz(ar->regiondata, ob->obmat[3][0], ob->obmat[3][1], ob->obmat[3][2]);
@@ -3440,7 +3443,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
float dx, dy, dmax;
int lock_root = pset->flag & PE_LOCK_FIRST;
- if(!PE_start_edit(edit))
+ if (!PE_start_edit(edit))
return;
RNA_float_get_array(itemptr, "mouse", mousef);
@@ -3448,7 +3451,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
mouse[1] = mousef[1];
flip= RNA_boolean_get(itemptr, "pen_flip");
- if(bedit->first) {
+ if (bedit->first) {
bedit->lastmouse[0]= mouse[0];
bedit->lastmouse[1]= mouse[1];
}
@@ -3461,10 +3464,10 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
/* disable locking temporatily for disconnected hair */
- if(edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
+ if (edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
pset->flag &= ~PE_LOCK_FIRST;
- if(((pset->brushtype == PE_BRUSH_ADD) ?
+ if (((pset->brushtype == PE_BRUSH_ADD) ?
(sqrt(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0))
|| bedit->first) {
PEData data= bedit->data;
@@ -3478,7 +3481,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
dx /= (float)tot_steps;
dy /= (float)tot_steps;
- for(step = 1; step<=tot_steps; step++) {
+ for (step = 1; step<=tot_steps; step++) {
mval[0] = bedit->lastmouse[0] + step*dx;
mval[1] = bedit->lastmouse[1] + step*dy;
@@ -3490,7 +3493,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
data.rad= (float)brush->size;
data.combfac= (brush->strength - 0.5f) * 2.0f;
- if(data.combfac < 0.0f)
+ if (data.combfac < 0.0f)
data.combfac= 1.0f - 9.0f * data.combfac;
else
data.combfac= 1.0f - data.combfac;
@@ -3507,18 +3510,18 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
}
case PE_BRUSH_CUT:
{
- if(edit->psys && edit->pathcache) {
+ if (edit->psys && edit->pathcache) {
data.mval= mval;
data.rad= (float)brush->size;
data.cutfac= brush->strength;
- if(selected)
+ if (selected)
foreach_selected_point(&data, brush_cut);
else
foreach_point(&data, brush_cut);
removed= remove_tagged_particles(ob, edit->psys, pe_x_mirror(ob));
- if(pset->flag & PE_KEEP_LENGTHS)
+ if (pset->flag & PE_KEEP_LENGTHS)
recalc_lengths(edit);
}
else
@@ -3533,27 +3536,27 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
data.rad= (float)brush->size;
data.growfac= brush->strength / 50.0f;
- if(brush->invert ^ flip)
+ if (brush->invert ^ flip)
data.growfac= 1.0f - data.growfac;
else
data.growfac= 1.0f + data.growfac;
foreach_mouse_hit_point(&data, brush_length, selected);
- if(pset->flag & PE_KEEP_LENGTHS)
+ if (pset->flag & PE_KEEP_LENGTHS)
recalc_lengths(edit);
break;
}
case PE_BRUSH_PUFF:
{
- if(edit->psys) {
+ if (edit->psys) {
data.dm= psmd->dm;
data.mval= mval;
data.rad= (float)brush->size;
data.select= selected;
data.pufffac= (brush->strength - 0.5f) * 2.0f;
- if(data.pufffac < 0.0f)
+ if (data.pufffac < 0.0f)
data.pufffac= 1.0f - 9.0f * data.pufffac;
else
data.pufffac= 1.0f - data.pufffac;
@@ -3567,12 +3570,12 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
}
case PE_BRUSH_ADD:
{
- if(edit->psys && edit->psys->part->from==PART_FROM_FACE) {
+ if (edit->psys && edit->psys->part->from==PART_FROM_FACE) {
data.mval= mval;
added= brush_add(&data, brush->count);
- if(pset->flag & PE_KEEP_LENGTHS)
+ if (pset->flag & PE_KEEP_LENGTHS)
recalc_lengths(edit);
}
else
@@ -3593,7 +3596,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
foreach_mouse_hit_key(&data, brush_smooth_get, selected);
- if(data.tot) {
+ if (data.tot) {
mul_v3_fl(data.vec, 1.0f / (float)data.tot);
foreach_mouse_hit_key(&data, brush_smooth_do, selected);
}
@@ -3602,7 +3605,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
}
case PE_BRUSH_WEIGHT:
{
- if(edit->psys) {
+ if (edit->psys) {
data.dm= psmd->dm;
data.mval= mval;
data.rad= (float)brush->size;
@@ -3615,11 +3618,11 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
break;
}
}
- if((pset->flag & PE_KEEP_LENGTHS)==0)
+ if ((pset->flag & PE_KEEP_LENGTHS)==0)
recalc_lengths(edit);
- if(ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_CUT) && (added || removed)) {
- if(pset->brushtype == PE_BRUSH_ADD && pe_x_mirror(ob))
+ if (ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_CUT) && (added || removed)) {
+ if (pset->brushtype == PE_BRUSH_ADD && pe_x_mirror(ob))
PE_mirror_x(scene, ob, 1);
update_world_cos(ob,edit);
@@ -3655,7 +3658,7 @@ static void brush_edit_exit(wmOperator *op)
static int brush_edit_exec(bContext *C, wmOperator *op)
{
- if(!brush_edit_init(C, op))
+ if (!brush_edit_init(C, op))
return OPERATOR_CANCELLED;
RNA_BEGIN(op->ptr, itemptr, "stroke") {
@@ -3687,7 +3690,7 @@ static void brush_edit_apply_event(bContext *C, wmOperator *op, wmEvent *event)
static int brush_edit_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!brush_edit_init(C, op))
+ if (!brush_edit_init(C, op))
return OPERATOR_CANCELLED;
brush_edit_apply_event(C, op, event);
@@ -3723,18 +3726,18 @@ static int brush_edit_cancel(bContext *UNUSED(C), wmOperator *op)
void PARTICLE_OT_brush_edit(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Brush Edit";
- ot->idname= "PARTICLE_OT_brush_edit";
+ ot->name = "Brush Edit";
+ ot->idname = "PARTICLE_OT_brush_edit";
/* api callbacks */
- ot->exec= brush_edit_exec;
- ot->invoke= brush_edit_invoke;
- ot->modal= brush_edit_modal;
- ot->cancel= brush_edit_cancel;
- ot->poll= PE_poll_view3d;
+ ot->exec = brush_edit_exec;
+ ot->invoke = brush_edit_invoke;
+ ot->modal = brush_edit_modal;
+ ot->cancel = brush_edit_cancel;
+ ot->poll = PE_poll_view3d;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* properties */
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
@@ -3747,16 +3750,16 @@ static void free_PTCacheUndo(PTCacheUndo *undo)
PTCacheEditPoint *point;
int i;
- for(i=0, point=undo->points; i<undo->totpoint; i++, point++) {
- if(undo->particles && (undo->particles + i)->hair)
+ for (i=0, point=undo->points; i<undo->totpoint; i++, point++) {
+ if (undo->particles && (undo->particles + i)->hair)
MEM_freeN((undo->particles + i)->hair);
- if(point->keys)
+ if (point->keys)
MEM_freeN(point->keys);
}
- if(undo->points)
+ if (undo->points)
MEM_freeN(undo->points);
- if(undo->particles)
+ if (undo->particles)
MEM_freeN(undo->particles);
BKE_ptcache_free_mem(&undo->mem_cache);
@@ -3769,12 +3772,12 @@ static void make_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
undo->totpoint= edit->totpoint;
- if(edit->psys) {
+ if (edit->psys) {
ParticleData *pa;
pa= undo->particles= MEM_dupallocN(edit->psys->particles);
- for(i=0; i<edit->totpoint; i++, pa++)
+ for (i=0; i<edit->totpoint; i++, pa++)
pa->hair= MEM_dupallocN(pa->hair);
undo->psys_flag = edit->psys->flag;
@@ -3785,8 +3788,8 @@ static void make_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
BLI_duplicatelist(&undo->mem_cache, &edit->pid.cache->mem_cache);
pm = undo->mem_cache.first;
- for(; pm; pm=pm->next) {
- for(i=0; i<BPHYS_TOT_DATA; i++)
+ for (; pm; pm=pm->next) {
+ for (i=0; i<BPHYS_TOT_DATA; i++)
pm->data[i] = MEM_dupallocN(pm->data[i]);
}
}
@@ -3794,7 +3797,7 @@ static void make_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
point= undo->points = MEM_dupallocN(edit->points);
undo->totpoint = edit->totpoint;
- for(i=0; i<edit->totpoint; i++, point++) {
+ for (i=0; i<edit->totpoint; i++, point++) {
point->keys= MEM_dupallocN(point->keys);
/* no need to update edit key->co & key->time pointers here */
}
@@ -3808,17 +3811,17 @@ static void get_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
POINT_P; KEY_K;
LOOP_POINTS {
- if(psys && psys->particles[p].hair)
+ if (psys && psys->particles[p].hair)
MEM_freeN(psys->particles[p].hair);
- if(point->keys)
+ if (point->keys)
MEM_freeN(point->keys);
}
- if(psys && psys->particles)
+ if (psys && psys->particles)
MEM_freeN(psys->particles);
- if(edit->points)
+ if (edit->points)
MEM_freeN(edit->points);
- if(edit->mirror_cache) {
+ if (edit->mirror_cache) {
MEM_freeN(edit->mirror_cache);
edit->mirror_cache= NULL;
}
@@ -3830,7 +3833,7 @@ static void get_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
point->keys= MEM_dupallocN(point->keys);
}
- if(psys) {
+ if (psys) {
psys->particles= MEM_dupallocN(undo->particles);
psys->totpart= undo->totpoint;
@@ -3858,15 +3861,15 @@ static void get_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
pm = edit->pid.cache->mem_cache.first;
- for(; pm; pm=pm->next) {
- for(i=0; i<BPHYS_TOT_DATA; i++)
+ for (; pm; pm=pm->next) {
+ for (i=0; i<BPHYS_TOT_DATA; i++)
pm->data[i] = MEM_dupallocN(pm->data[i]);
BKE_ptcache_mem_pointers_init(pm);
LOOP_POINTS {
LOOP_KEYS {
- if((int)key->ftime == (int)pm->frame) {
+ if ((int)key->ftime == (int)pm->frame) {
key->co = pm->cur[BPHYS_DATA_LOCATION];
key->vel = pm->cur[BPHYS_DATA_VELOCITY];
key->rot = pm->cur[BPHYS_DATA_ROTATION];
@@ -3885,10 +3888,10 @@ void PE_undo_push(Scene *scene, const char *str)
PTCacheUndo *undo;
int nr;
- if(!edit) return;
+ if (!edit) return;
/* remove all undos after (also when curundo==NULL) */
- while(edit->undo.last != edit->curundo) {
+ while (edit->undo.last != edit->curundo) {
undo= edit->undo.last;
BLI_remlink(&edit->undo, undo);
free_PTCacheUndo(undo);
@@ -3903,13 +3906,13 @@ void PE_undo_push(Scene *scene, const char *str)
/* and limit amount to the maximum */
nr= 0;
undo= edit->undo.last;
- while(undo) {
+ while (undo) {
nr++;
- if(nr==U.undosteps) break;
+ if (nr==U.undosteps) break;
undo= undo->prev;
}
- if(undo) {
- while(edit->undo.first!=undo) {
+ if (undo) {
+ while (edit->undo.first!=undo) {
PTCacheUndo *first= edit->undo.first;
BLI_remlink(&edit->undo, first);
free_PTCacheUndo(first);
@@ -3925,16 +3928,16 @@ void PE_undo_step(Scene *scene, int step)
{
PTCacheEdit *edit= PE_get_current(scene, OBACT);
- if(!edit) return;
+ if (!edit) return;
- if(step==0) {
+ if (step==0) {
get_PTCacheUndo(edit,edit->curundo);
}
- else if(step==1) {
+ else if (step==1) {
- if(edit->curundo==NULL || edit->curundo->prev==NULL);
+ if (edit->curundo==NULL || edit->curundo->prev==NULL);
else {
- if(G.f & G_DEBUG) printf("undo %s\n", edit->curundo->name);
+ if (G.f & G_DEBUG) printf("undo %s\n", edit->curundo->name);
edit->curundo= edit->curundo->prev;
get_PTCacheUndo(edit, edit->curundo);
}
@@ -3942,11 +3945,11 @@ void PE_undo_step(Scene *scene, int step)
else {
/* curundo has to remain current situation! */
- if(edit->curundo==NULL || edit->curundo->next==NULL);
+ if (edit->curundo==NULL || edit->curundo->next==NULL);
else {
get_PTCacheUndo(edit, edit->curundo->next);
edit->curundo= edit->curundo->next;
- if(G.f & G_DEBUG) printf("redo %s\n", edit->curundo->name);
+ if (G.f & G_DEBUG) printf("redo %s\n", edit->curundo->name);
}
}
@@ -3957,7 +3960,7 @@ int PE_undo_valid(Scene *scene)
{
PTCacheEdit *edit= PE_get_current(scene, OBACT);
- if(edit) {
+ if (edit) {
return (edit->undo.last != edit->undo.first);
}
return 0;
@@ -3967,10 +3970,10 @@ static void PTCacheUndo_clear(PTCacheEdit *edit)
{
PTCacheUndo *undo;
- if(edit==NULL) return;
+ if (edit==NULL) return;
undo= edit->undo.first;
- while(undo) {
+ while (undo) {
free_PTCacheUndo(undo);
undo= undo->next;
}
@@ -3994,8 +3997,8 @@ void PE_undo_number(Scene *scene, int nr)
PTCacheUndo *undo;
int a=0;
- for(undo= edit->undo.first; undo; undo= undo->next, a++) {
- if(a==nr) break;
+ for (undo= edit->undo.first; undo; undo= undo->next, a++) {
+ if (a==nr) break;
}
edit->curundo= undo;
PE_undo_step(scene, 0);
@@ -4009,12 +4012,12 @@ const char *PE_undo_get_name(Scene *scene, int nr, int *active)
PTCacheEdit *edit= PE_get_current(scene, OBACT);
PTCacheUndo *undo;
- if(active) *active= 0;
+ if (active) *active= 0;
- if(edit) {
+ if (edit) {
undo= BLI_findlink(&edit->undo, nr);
- if(undo) {
- if(active && undo==edit->curundo)
+ if (undo) {
+ if (active && undo==edit->curundo)
*active= 1;
return undo->name;
}
@@ -4034,15 +4037,15 @@ int PE_minmax(Scene *scene, float min[3], float max[3])
float co[3], mat[4][4];
int ok= 0;
- if(!edit) return ok;
+ if (!edit) return ok;
- if((psys = edit->psys))
+ if ((psys = edit->psys))
psmd= psys_get_modifier(ob, psys);
else
unit_m4(mat);
LOOP_VISIBLE_POINTS {
- if(psys)
+ if (psys)
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, mat);
LOOP_SELECTED_KEYS {
@@ -4053,7 +4056,7 @@ int PE_minmax(Scene *scene, float min[3], float max[3])
}
}
- if(!ok) {
+ if (!ok) {
minmax_object(ob, min, max);
ok= 1;
}
@@ -4074,23 +4077,23 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
int totpoint;
/* no psmd->dm happens in case particle system modifier is not enabled */
- if(!(psys && psmd && psmd->dm) && !cache)
+ if (!(psys && psmd && psmd->dm) && !cache)
return;
- if(cache && cache->flag & PTCACHE_DISK_CACHE)
+ if (cache && cache->flag & PTCACHE_DISK_CACHE)
return;
- if(psys == NULL && cache->mem_cache.first == NULL)
+ if (psys == NULL && cache->mem_cache.first == NULL)
return;
- if(!edit) {
+ if (!edit) {
totpoint = psys ? psys->totpart : (int)((PTCacheMem*)cache->mem_cache.first)->totpoint;
edit= MEM_callocN(sizeof(PTCacheEdit), "PE_create_particle_edit");
edit->points=MEM_callocN(totpoint*sizeof(PTCacheEditPoint),"PTCacheEditPoints");
edit->totpoint = totpoint;
- if(psys && !cache) {
+ if (psys && !cache) {
psys->edit= edit;
edit->psys = psys;
@@ -4110,7 +4113,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
key->co= hkey->co;
key->time= &hkey->time;
key->flag= hkey->editflag;
- if(!(psys->flag & PSYS_GLOBAL_HAIR)) {
+ if (!(psys->flag & PSYS_GLOBAL_HAIR)) {
key->flag |= PEK_USE_WCO;
hkey->editflag |= PEK_USE_WCO;
}
@@ -4129,15 +4132,15 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
cache->free_edit= PE_free_ptcache_edit;
edit->psys = NULL;
- for(pm=cache->mem_cache.first; pm; pm=pm->next)
+ for (pm=cache->mem_cache.first; pm; pm=pm->next)
totframe++;
- for(pm=cache->mem_cache.first; pm; pm=pm->next) {
+ for (pm=cache->mem_cache.first; pm; pm=pm->next) {
LOOP_POINTS {
- if(BKE_ptcache_mem_pointers_seek(p, pm) == 0)
+ if (BKE_ptcache_mem_pointers_seek(p, pm) == 0)
continue;
- if(!point->totkey) {
+ if (!point->totkey) {
key = point->keys = MEM_callocN(totframe*sizeof(PTCacheEditKey),"ParticleEditKeys");
point->flag |= PEP_EDIT_RECALC;
}
@@ -4161,7 +4164,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
UI_GetThemeColor3ubv(TH_WIRE, edit->nosel_col);
recalc_lengths(edit);
- if(psys && !cache)
+ if (psys && !cache)
recalc_emitter_field(ob, psys);
PE_update_object(scene, ob, 1);
@@ -4175,7 +4178,7 @@ static int particle_edit_toggle_poll(bContext *C)
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
- if(!scene || !ob || ob->id.lib)
+ if (!scene || !ob || ob->id.lib)
return 0;
return (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody));
@@ -4186,14 +4189,14 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
- if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
+ if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
PTCacheEdit *edit;
ob->mode |= OB_MODE_PARTICLE_EDIT;
edit= PE_create_current(scene, ob);
/* mesh may have changed since last entering editmode.
* note, this may have run before if the edit data was just created, so could avoid this and speed up a little */
- if(edit && edit->psys)
+ if (edit && edit->psys)
recalc_emitter_field(ob, edit->psys);
toggle_particle_cursor(C, 1);
@@ -4213,15 +4216,15 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_particle_edit_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Particle Edit Toggle";
- ot->idname= "PARTICLE_OT_particle_edit_toggle";
+ ot->name = "Particle Edit Toggle";
+ ot->idname = "PARTICLE_OT_particle_edit_toggle";
/* api callbacks */
- ot->exec= particle_edit_toggle_exec;
- ot->poll= particle_edit_toggle_poll;
+ ot->exec = particle_edit_toggle_exec;
+ ot->poll = particle_edit_toggle_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -4232,8 +4235,8 @@ static int clear_edited_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= CTX_data_active_object(C);
ParticleSystem *psys = psys_get_current(ob);
- if(psys->edit) {
- if(psys->edit->edited || 1) { // XXX okee("Lose changes done in particle mode?"))
+ if (psys->edit) {
+ if (psys->edit->edited || 1) { // XXX okee("Lose changes done in particle mode?"))
PE_free_ptcache_edit(psys->edit);
psys->edit = NULL;
@@ -4262,14 +4265,14 @@ static int clear_edited_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_edited_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Edited";
- ot->idname= "PARTICLE_OT_edited_clear";
+ ot->name = "Clear Edited";
+ ot->idname = "PARTICLE_OT_edited_clear";
/* api callbacks */
- ot->exec= clear_edited_exec;
- ot->poll= particle_edit_toggle_poll;
+ ot->exec = clear_edited_exec;
+ ot->poll = particle_edit_toggle_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index da3f7e1f7c1..1e71cf61817 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -70,7 +70,7 @@ static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= ED_object_context(C);
Scene *scene = CTX_data_scene(C);
- if(!scene || !ob)
+ if (!scene || !ob)
return OPERATOR_CANCELLED;
object_add_particle_system(scene, ob, NULL);
@@ -84,16 +84,16 @@ static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_particle_system_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Particle System Slot";
- ot->idname= "OBJECT_OT_particle_system_add";
- ot->description="Add a particle system";
+ ot->name = "Add Particle System Slot";
+ ot->idname = "OBJECT_OT_particle_system_add";
+ ot->description = "Add a particle system";
/* api callbacks */
- ot->poll= ED_operator_object_active_editable;
- ot->exec= particle_system_add_exec;
+ ot->poll = ED_operator_object_active_editable;
+ ot->exec = particle_system_add_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
@@ -101,7 +101,7 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= ED_object_context(C);
Scene *scene = CTX_data_scene(C);
int mode_orig = ob->mode;
- if(!scene || !ob)
+ if (!scene || !ob)
return OPERATOR_CANCELLED;
object_remove_particle_system(scene, ob);
@@ -109,9 +109,9 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
/* possible this isn't the active object
* object_remove_particle_system() clears the mode on the last psys
* */
- if(mode_orig & OB_MODE_PARTICLE_EDIT)
- if((ob->mode & OB_MODE_PARTICLE_EDIT)==0)
- if(scene->basact && scene->basact->object==ob)
+ 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);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
@@ -123,16 +123,16 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_particle_system_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Particle System Slot";
- ot->idname= "OBJECT_OT_particle_system_remove";
- ot->description="Remove the selected particle system";
+ ot->name = "Remove Particle System Slot";
+ ot->idname = "OBJECT_OT_particle_system_remove";
+ ot->description = "Remove the selected particle system";
/* api callbacks */
- ot->poll= ED_operator_object_active_editable;
- ot->exec= particle_system_remove_exec;
+ ot->poll = ED_operator_object_active_editable;
+ ot->exec = particle_system_remove_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** new particle settings operator *********************/
@@ -157,14 +157,14 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
psys = ptr.data;
/* add or copy particle setting */
- if(psys->part)
+ if (psys->part)
part= psys_copy_settings(psys->part);
else
part= psys_new_settings("ParticleSettings", bmain);
ob= ptr.id.data;
- if(psys->part)
+ if (psys->part)
psys->part->id.us--;
psys->part = part;
@@ -182,16 +182,16 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_new(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "New Particle Settings";
- ot->idname= "PARTICLE_OT_new";
- ot->description="Add new particle settings";
+ ot->name = "New Particle Settings";
+ ot->idname = "PARTICLE_OT_new";
+ ot->description = "Add new particle settings";
/* api callbacks */
- ot->exec= new_particle_settings_exec;
- ot->poll= psys_poll;
+ ot->exec = new_particle_settings_exec;
+ ot->poll = psys_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** keyed particle target operators *********************/
@@ -206,11 +206,11 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
ParticleTarget *pt;
- if(!psys)
+ if (!psys)
return OPERATOR_CANCELLED;
pt = psys->targets.first;
- for(; pt; pt=pt->next)
+ for (; pt; pt=pt->next)
pt->flag &= ~PTARGET_CURRENT;
pt = MEM_callocN(sizeof(ParticleTarget), "keyed particle target");
@@ -231,15 +231,15 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_new_target(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "New Particle Target";
- ot->idname= "PARTICLE_OT_new_target";
- ot->description="Add a new particle target";
+ ot->name = "New Particle Target";
+ ot->idname = "PARTICLE_OT_new_target";
+ ot->description = "Add a new particle target";
/* api callbacks */
- ot->exec= new_particle_target_exec;
+ ot->exec = new_particle_target_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
@@ -252,12 +252,12 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
ParticleTarget *pt;
- if(!psys)
+ if (!psys)
return OPERATOR_CANCELLED;
pt = psys->targets.first;
- for(; pt; pt=pt->next) {
- if(pt->flag & PTARGET_CURRENT) {
+ for (; pt; pt=pt->next) {
+ if (pt->flag & PTARGET_CURRENT) {
BLI_remlink(&psys->targets, pt);
MEM_freeN(pt);
break;
@@ -266,7 +266,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
}
pt = psys->targets.last;
- if(pt)
+ if (pt)
pt->flag |= PTARGET_CURRENT;
DAG_scene_sort(bmain, scene);
@@ -280,15 +280,15 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_target_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Particle Target";
- ot->idname= "PARTICLE_OT_target_remove";
- ot->description="Remove the selected particle target";
+ ot->name = "Remove Particle Target";
+ ot->idname = "PARTICLE_OT_target_remove";
+ ot->description = "Remove the selected particle target";
/* api callbacks */
- ot->exec= remove_particle_target_exec;
+ ot->exec = remove_particle_target_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ move up particle target operator *********************/
@@ -300,12 +300,12 @@ static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob = ptr.id.data;
ParticleTarget *pt;
- if(!psys)
+ if (!psys)
return OPERATOR_CANCELLED;
pt = psys->targets.first;
- for(; pt; pt=pt->next) {
- if(pt->flag & PTARGET_CURRENT && pt->prev) {
+ for (; pt; pt=pt->next) {
+ if (pt->flag & PTARGET_CURRENT && pt->prev) {
BLI_remlink(&psys->targets, pt);
BLI_insertlink(&psys->targets, pt->prev->prev, pt);
@@ -320,14 +320,14 @@ static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_target_move_up(wmOperatorType *ot)
{
- ot->name= "Move Up Target";
- ot->idname= "PARTICLE_OT_target_move_up";
- ot->description= "Move particle target up in the list";
+ ot->name = "Move Up Target";
+ ot->idname = "PARTICLE_OT_target_move_up";
+ ot->description = "Move particle target up in the list";
- ot->exec= target_move_up_exec;
+ ot->exec = target_move_up_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ move down particle target operator *********************/
@@ -339,11 +339,11 @@ static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob = ptr.id.data;
ParticleTarget *pt;
- if(!psys)
+ if (!psys)
return OPERATOR_CANCELLED;
pt = psys->targets.first;
- for(; pt; pt=pt->next) {
- if(pt->flag & PTARGET_CURRENT && pt->next) {
+ for (; pt; pt=pt->next) {
+ if (pt->flag & PTARGET_CURRENT && pt->next) {
BLI_remlink(&psys->targets, pt);
BLI_insertlink(&psys->targets, pt->next, pt);
@@ -358,14 +358,14 @@ static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_target_move_down(wmOperatorType *ot)
{
- ot->name= "Move Down Target";
- ot->idname= "PARTICLE_OT_target_move_down";
- ot->description= "Move particle target down in the list";
+ ot->name = "Move Down Target";
+ ot->idname = "PARTICLE_OT_target_move_down";
+ ot->description = "Move particle target down in the list";
- ot->exec= target_move_down_exec;
+ ot->exec = target_move_down_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ move up particle dupliweight operator *********************/
@@ -377,12 +377,12 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
ParticleSettings *part;
ParticleDupliWeight *dw;
- if(!psys)
+ if (!psys)
return OPERATOR_CANCELLED;
part = psys->part;
- for(dw=part->dupliweights.first; dw; dw=dw->next) {
- if(dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
+ for (dw=part->dupliweights.first; dw; dw=dw->next) {
+ if (dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
BLI_remlink(&part->dupliweights, dw);
BLI_insertlink(&part->dupliweights, dw->prev->prev, dw);
@@ -396,14 +396,14 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot)
{
- ot->name= "Move Up Dupli Object";
- ot->idname= "PARTICLE_OT_dupliob_move_up";
- ot->description= "Move dupli object up in the list";
+ ot->name = "Move Up Dupli Object";
+ ot->idname = "PARTICLE_OT_dupliob_move_up";
+ ot->description = "Move dupli object up in the list";
- ot->exec= dupliob_move_up_exec;
+ ot->exec = dupliob_move_up_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** particle dupliweight operators *********************/
@@ -415,11 +415,11 @@ static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
ParticleSettings *part;
ParticleDupliWeight *dw;
- if(!psys)
+ if (!psys)
return OPERATOR_CANCELLED;
part = psys->part;
- for(dw=part->dupliweights.first; dw; dw=dw->next) {
- if(dw->flag & PART_DUPLIW_CURRENT) {
+ for (dw=part->dupliweights.first; dw; dw=dw->next) {
+ if (dw->flag & PART_DUPLIW_CURRENT) {
dw->flag &= ~PART_DUPLIW_CURRENT;
dw = MEM_dupallocN(dw);
dw->flag |= PART_DUPLIW_CURRENT;
@@ -436,15 +436,15 @@ static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_dupliob_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Particle Dupliob";
- ot->idname= "PARTICLE_OT_dupliob_copy";
- ot->description="Duplicate the current dupliobject";
+ ot->name = "Copy Particle Dupliob";
+ ot->idname = "PARTICLE_OT_dupliob_copy";
+ ot->description = "Duplicate the current dupliobject";
/* api callbacks */
- ot->exec= copy_particle_dupliob_exec;
+ ot->exec = copy_particle_dupliob_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
@@ -454,12 +454,12 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
ParticleSettings *part;
ParticleDupliWeight *dw;
- if(!psys)
+ if (!psys)
return OPERATOR_CANCELLED;
part = psys->part;
- for(dw=part->dupliweights.first; dw; dw=dw->next) {
- if(dw->flag & PART_DUPLIW_CURRENT) {
+ for (dw=part->dupliweights.first; dw; dw=dw->next) {
+ if (dw->flag & PART_DUPLIW_CURRENT) {
BLI_remlink(&part->dupliweights, dw);
MEM_freeN(dw);
break;
@@ -468,7 +468,7 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
}
dw = part->dupliweights.last;
- if(dw)
+ if (dw)
dw->flag |= PART_DUPLIW_CURRENT;
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
@@ -479,15 +479,15 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_dupliob_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Particle Dupliobject";
- ot->idname= "PARTICLE_OT_dupliob_remove";
- ot->description="Remove the selected dupliobject";
+ ot->name = "Remove Particle Dupliobject";
+ ot->idname = "PARTICLE_OT_dupliob_remove";
+ ot->description = "Remove the selected dupliobject";
/* api callbacks */
- ot->exec= remove_particle_dupliob_exec;
+ ot->exec = remove_particle_dupliob_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ move down particle dupliweight operator *********************/
@@ -499,12 +499,12 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
ParticleSettings *part;
ParticleDupliWeight *dw;
- if(!psys)
+ if (!psys)
return OPERATOR_CANCELLED;
part = psys->part;
- for(dw=part->dupliweights.first; dw; dw=dw->next) {
- if(dw->flag & PART_DUPLIW_CURRENT && dw->next) {
+ for (dw=part->dupliweights.first; dw; dw=dw->next) {
+ if (dw->flag & PART_DUPLIW_CURRENT && dw->next) {
BLI_remlink(&part->dupliweights, dw);
BLI_insertlink(&part->dupliweights, dw->next, dw);
@@ -518,14 +518,14 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot)
{
- ot->name= "Move Down Dupli Object";
- ot->idname= "PARTICLE_OT_dupliob_move_down";
- ot->description= "Move dupli object down in the list";
+ ot->name = "Move Down Dupli Object";
+ ot->idname = "PARTICLE_OT_dupliob_move_down";
+ ot->description = "Move dupli object down in the list";
- ot->exec= dupliob_move_down_exec;
+ ot->exec = dupliob_move_down_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************************ connect/disconnect hair operators *********************/
@@ -542,27 +542,27 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
int i, k;
float hairmat[4][4];
- if(!ob || !psys || psys->flag & PSYS_GLOBAL_HAIR)
+ if (!ob || !psys || psys->flag & PSYS_GLOBAL_HAIR)
return;
- if(!psys->part || psys->part->type != PART_HAIR)
+ if (!psys->part || psys->part->type != PART_HAIR)
return;
edit = psys->edit;
point= edit ? edit->points : NULL;
- for(i=0, pa=psys->particles; i<psys->totpart; i++,pa++) {
- if(point) {
+ for (i=0, pa=psys->particles; i<psys->totpart; i++,pa++) {
+ if (point) {
ekey = point->keys;
point++;
}
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
- for(k=0,key=pa->hair; k<pa->totkey; k++,key++) {
+ for (k=0,key=pa->hair; k<pa->totkey; k++,key++) {
mul_m4_v3(hairmat,key->co);
- if(ekey) {
+ if (ekey) {
ekey->flag &= ~PEK_USE_WCO;
ekey++;
}
@@ -573,7 +573,7 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
psys->flag |= PSYS_GLOBAL_HAIR;
- if(ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_PUFF))
+ if (ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_PUFF))
pset->brushtype = PE_BRUSH_NONE;
PE_update_object(scene, ob, 0);
@@ -587,11 +587,11 @@ static int disconnect_hair_exec(bContext *C, wmOperator *op)
ParticleSystem *psys= NULL;
int all = RNA_boolean_get(op->ptr, "all");
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
- if(all) {
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+ if (all) {
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
disconnect_hair(scene, ob, psys);
}
}
@@ -608,14 +608,14 @@ static int disconnect_hair_exec(bContext *C, wmOperator *op)
void PARTICLE_OT_disconnect_hair(wmOperatorType *ot)
{
- ot->name= "Disconnect Hair";
- ot->description= "Disconnect hair from the emitter mesh";
- ot->idname= "PARTICLE_OT_disconnect_hair";
+ ot->name = "Disconnect Hair";
+ ot->description = "Disconnect hair from the emitter mesh";
+ ot->idname = "PARTICLE_OT_disconnect_hair";
- ot->exec= disconnect_hair_exec;
+ ot->exec = disconnect_hair_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "all", 0, "All hair", "Disconnect all hair systems from the emitter mesh");
}
@@ -637,13 +637,13 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
float hairmat[4][4], imat[4][4];
float v[4][3], vec[3];
- if(!psys || !psys->part || psys->part->type != PART_HAIR)
+ if (!psys || !psys->part || psys->part->type != PART_HAIR)
return;
edit= psys->edit;
point= edit ? edit->points : NULL;
- if(psmd->dm->deformedOnly)
+ if (psmd->dm->deformedOnly)
/* we don't want to mess up psmd->dm when converting to global coordinates below */
dm= CDDM_copy(psmd->dm);
else
@@ -661,7 +661,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
bvhtree_from_mesh_faces(&bvhtree, dm, 0.0, 2, 6);
- for(i=0, pa= psys->particles; i<psys->totpart; i++,pa++) {
+ for (i=0, pa= psys->particles; i<psys->totpart; i++,pa++) {
key = pa->hair;
nearest.index = -1;
@@ -669,7 +669,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
BLI_bvhtree_find_nearest(bvhtree.tree, key->co, &nearest, bvhtree.nearest_callback, &bvhtree);
- if(nearest.index == -1) {
+ if (nearest.index == -1) {
if (G.f & G_DEBUG)
printf("No nearest point found for hair root!");
continue;
@@ -680,7 +680,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
copy_v3_v3(v[0], CDDM_get_vert(dm,mface->v1)->co);
copy_v3_v3(v[1], CDDM_get_vert(dm,mface->v2)->co);
copy_v3_v3(v[2], CDDM_get_vert(dm,mface->v3)->co);
- if(mface->v4) {
+ if (mface->v4) {
copy_v3_v3(v[3], CDDM_get_vert(dm,mface->v4)->co);
interp_weights_poly_v3( pa->fuv,v, 4, nearest.co);
}
@@ -695,16 +695,16 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
sub_v3_v3v3(vec, nearest.co, key->co);
- if(point) {
+ if (point) {
ekey = point->keys;
point++;
}
- for(k=0,key=pa->hair; k<pa->totkey; k++,key++) {
+ for (k=0,key=pa->hair; k<pa->totkey; k++,key++) {
add_v3_v3(key->co, vec);
mul_m4_v3(imat,key->co);
- if(ekey) {
+ if (ekey) {
ekey->flag |= PEK_USE_WCO;
ekey++;
}
@@ -729,11 +729,11 @@ static int connect_hair_exec(bContext *C, wmOperator *op)
ParticleSystem *psys= NULL;
int all = RNA_boolean_get(op->ptr, "all");
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
- if(all) {
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+ if (all) {
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
connect_hair(scene, ob, psys);
}
}
@@ -750,14 +750,14 @@ static int connect_hair_exec(bContext *C, wmOperator *op)
void PARTICLE_OT_connect_hair(wmOperatorType *ot)
{
- ot->name= "Connect Hair";
- ot->description= "Connect hair to the emitter mesh";
- ot->idname= "PARTICLE_OT_connect_hair";
+ ot->name = "Connect Hair";
+ ot->description = "Connect hair to the emitter mesh";
+ ot->idname = "PARTICLE_OT_connect_hair";
- ot->exec= connect_hair_exec;
+ ot->exec = connect_hair_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "all", 0, "All hair", "Connect all hair systems to the emitter mesh");
}
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 96a59ee4542..23765b03d35 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -129,7 +129,8 @@ static void get_fluid_gravity(float *gravity, Scene *scene, FluidsimSettings *fs
{
if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
copy_v3_v3(gravity, scene->physics_settings.gravity);
- } else {
+ }
+ else {
copy_v3_v3(gravity, fss->grav);
}
}
@@ -138,7 +139,8 @@ static float get_fluid_size_m(Scene *scene, Object *domainob, FluidsimSettings *
{
if (!scene->unit.system) {
return fss->realsize;
- } else {
+ }
+ else {
float dim[3];
float longest_axis;
@@ -212,20 +214,22 @@ static void fluidsimPrintChannel(FILE *file, float *channel, int paramsize, char
int i,j;
int channelSize = paramsize;
- if(entries==3) {
+ if (entries==3) {
elbeemSimplifyChannelVec3( channel, &channelSize);
- } else if(entries==1) {
+ }
+ else if (entries==1) {
elbeemSimplifyChannelFloat( channel, &channelSize);
- } else {
+ }
+ else {
// invalid, cant happen?
}
fprintf(file, " CHANNEL %s = \n", str);
- for(i=0; i<channelSize;i++) {
+ for (i=0; i<channelSize;i++) {
fprintf(file," ");
- for(j=0;j<=entries;j++) { // also print time value
+ for (j=0;j<=entries;j++) { // also print time value
fprintf(file," %f ", channel[i*(entries+1)+j] );
- if(j==entries-1){ fprintf(file," "); }
+ if (j==entries-1) { fprintf(file," "); }
}
fprintf(file," \n");
}
@@ -298,7 +302,7 @@ static void set_vertex_channel(float *channel, float time, struct Scene *scene,
}
/* fill frame of channel with vertex locations */
- for(j=0; j < (3*numVerts); j++) {
+ for (j=0; j < (3*numVerts); j++) {
channel[i*framesize + j] = verts[j];
}
channel[i*framesize + framesize-1] = time;
@@ -468,7 +472,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
/* init euler rotation values and convert to elbeem format */
/* get the rotation from ob->obmat rather than ob->rot to account for parent animations */
- if(i) {
+ if (i) {
copy_v3_v3(old_rot, fobj->Rotation + 4*(i-1));
mul_v3_fl(old_rot, -M_PI/180.f);
}
@@ -538,16 +542,16 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
fsmesh.channelScale = fobj->Scale;
fsmesh.channelActive = fobj->Active;
- if( ELEM(fsmesh.type, OB_FLUIDSIM_FLUID, OB_FLUIDSIM_INFLOW)) {
+ if ( ELEM(fsmesh.type, OB_FLUIDSIM_FLUID, OB_FLUIDSIM_INFLOW)) {
fsmesh.channelInitialVel = fobj->InitialVelocity;
fsmesh.localInivelCoords = ((fluidmd->fss->typeFlags & OB_FSINFLOW_LOCALCOORD)?1:0);
}
- if(fluidmd->fss->typeFlags & OB_FSBND_NOSLIP)
+ if (fluidmd->fss->typeFlags & OB_FSBND_NOSLIP)
fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP;
- else if(fluidmd->fss->typeFlags & OB_FSBND_PARTSLIP)
+ else if (fluidmd->fss->typeFlags & OB_FSBND_PARTSLIP)
fsmesh.obstacleType = FLUIDSIM_OBSTACLE_PARTSLIP;
- else if(fluidmd->fss->typeFlags & OB_FSBND_FREESLIP)
+ else if (fluidmd->fss->typeFlags & OB_FSBND_FREESLIP)
fsmesh.obstacleType = FLUIDSIM_OBSTACLE_FREESLIP;
fsmesh.obstaclePartslip = fluidmd->fss->partSlipValue;
@@ -578,7 +582,7 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
}
/* animated meshes */
- if(deform) {
+ if (deform) {
fsmesh.channelSizeVertices = length;
fsmesh.channelVertices = fobj->VertexCache;
@@ -590,8 +594,8 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
elbeemAddMesh(&fsmesh);
- if(verts) MEM_freeN(verts);
- if(tris) MEM_freeN(tris);
+ if (verts) MEM_freeN(verts);
+ if (tris) MEM_freeN(tris);
}
}
@@ -602,7 +606,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom
int channelObjCount = 0;
int fluidInputCount = 0;
- for(base=scene->base.first; base; base= base->next)
+ for (base=scene->base.first; base; base= base->next)
{
Object *ob = base->object;
FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
@@ -610,7 +614,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom
/* only find objects with fluid modifiers */
if (!fluidmdtmp || ob->type != OB_MESH) continue;
- if(fluidmdtmp->fss->type == OB_FLUIDSIM_DOMAIN) {
+ if (fluidmdtmp->fss->type == OB_FLUIDSIM_DOMAIN) {
/* if no initial domain object given, find another potential domain */
if (!fsDomain) {
newdomain = ob;
@@ -654,6 +658,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom
#define FLUID_SUFFIX_CONFIG "fluidsim.cfg"
+#define FLUID_SUFFIX_CONFIG_TMP (FLUID_SUFFIX_CONFIG ".tmp")
#define FLUID_SUFFIX_SURFACE "fluidsurface"
static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetFile, char *debugStrBuffer)
@@ -663,7 +668,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
FILE *fileCfg;
int dirExist = 0;
char newSurfdataPath[FILE_MAX]; // modified output settings
- const char *suffixConfig = FLUID_SUFFIX_CONFIG;
+ const char *suffixConfigTmp = FLUID_SUFFIX_CONFIG_TMP;
int outStringsChanged = 0;
// prepare names...
@@ -673,9 +678,8 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
BLI_strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR); /* if 0'd out below, this value is never used! */
BLI_path_abs(targetDir, relbase); // fixed #frame-no
- BLI_join_dirfile(targetFile, FILE_MAX, targetDir, suffixConfig);
- /* .tmp: dont overwrite/delete original file */
- strncat(targetFile, ".tmp", FILE_MAX);
+ /* .tmp: don't overwrite/delete original file */
+ BLI_join_dirfile(targetFile, FILE_MAX, targetDir, suffixConfigTmp);
// make sure all directories exist
// as the bobjs use the same dir, this only needs to be checked
@@ -684,14 +688,14 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
// check selected directory
// simply try to open cfg file for writing to test validity of settings
- fileCfg = fopen(targetFile, "w");
- if(fileCfg) {
+ fileCfg = BLI_fopen(targetFile, "w");
+ if (fileCfg) {
dirExist = 1; fclose(fileCfg);
// remove cfg dummy from directory test
BLI_delete(targetFile, 0,0);
}
- if(targetDir[0] == '\0' || (!dirExist)) {
+ if (targetDir[0] == '\0' || (!dirExist)) {
char blendDir[FILE_MAX];
char blendFile[FILE_MAX];
@@ -709,7 +713,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
// check if modified output dir is ok
#if 0
- if(outStringsChanged) {
+ if (outStringsChanged) {
char dispmsg[FILE_MAX+256];
int selection=0;
BLI_strncpy(dispmsg,"Output settings set to: '", sizeof(dispmsg));
@@ -718,7 +722,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
// ask user if thats what he/she wants...
selection = pupmenu(dispmsg);
- if(selection<1) return 0; // 0 from menu, or -1 aborted
+ if (selection<1) return 0; // 0 from menu, or -1 aborted
BLI_strncpy(targetDir, newSurfdataPath, sizeof(targetDir));
strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR);
BLI_path_abs(targetDir, G.main->name); // fixed #frame-no
@@ -751,7 +755,7 @@ static int fluidbake_breakjob(void *customdata)
{
FluidBakeJob *fb= (FluidBakeJob *)customdata;
- if(fb->stop && *(fb->stop))
+ if (fb->stop && *(fb->stop))
return 1;
/* this is not nice yet, need to make the jobs list template better
@@ -865,7 +869,7 @@ static void fluidsim_delete_until_lastframe(FluidsimSettings *fss, const char *r
BLI_delete(targetFileVel, 0, 0);
BLI_delete(previewFile, 0, 0);
}
- } while(exists);
+ } while (exists);
return;
}
@@ -881,7 +885,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
int gridlevels = 0;
const char *relbase= modifier_path_relbase(fsDomain);
const char *strEnvName = "BLENDER_ELBEEMDEBUG"; // from blendercall.cpp
- const char *suffixConfig = FLUID_SUFFIX_CONFIG;
+ const char *suffixConfigTmp = FLUID_SUFFIX_CONFIG_TMP;
const char *suffixSurface = FLUID_SUFFIX_SURFACE;
char targetDir[FILE_MAX]; // store & modify output settings
@@ -904,7 +908,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
fb= MEM_callocN(sizeof(FluidBakeJob), "fluid bake job");
- if(getenv(strEnvName)) {
+ if (getenv(strEnvName)) {
int dlevel = atoi(getenv(strEnvName));
elbeemSetDebugLevel(dlevel);
BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName);
@@ -913,7 +917,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
/* make sure it corresponds to startFrame setting (old: noFrames = scene->r.efra - scene->r.sfra +1) */;
noFrames = scene->r.efra - 0;
- if(noFrames<=0) {
+ if (noFrames<=0) {
BKE_report(reports, RPT_ERROR, "No frames to export - check your animation range settings");
fluidbake_free_data(channels, fobjects, fsset, fb);
return 0;
@@ -943,7 +947,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
fluidsim_delete_until_lastframe(domainSettings, relbase);
/* rough check of settings... */
- if(domainSettings->previewresxyz > domainSettings->resolutionxyz) {
+ if (domainSettings->previewresxyz > domainSettings->resolutionxyz) {
BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz);
elbeemDebugOut(debugStrBuffer);
domainSettings->previewresxyz = domainSettings->resolutionxyz;
@@ -952,16 +956,19 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
// this should do as an approximation, with in/outflow
// doing this more accurate would be overkill
// perhaps add manual setting?
- if(domainSettings->maxRefine <0) {
- if(domainSettings->resolutionxyz>128) {
+ if (domainSettings->maxRefine <0) {
+ if (domainSettings->resolutionxyz>128) {
gridlevels = 2;
- } else
- if(domainSettings->resolutionxyz>64) {
+ }
+ else
+ if (domainSettings->resolutionxyz>64) {
gridlevels = 1;
- } else {
+ }
+ else {
gridlevels = 0;
}
- } else {
+ }
+ else {
gridlevels = domainSettings->maxRefine;
}
BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels );
@@ -983,7 +990,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
/* ******** init domain object's matrix ******** */
copy_m4_m4(domainMat, fsDomain->obmat);
- if(!invert_m4_m4(invDomMat, domainMat)) {
+ if (!invert_m4_m4(invDomMat, domainMat)) {
BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::error - Invalid obj matrix?\n");
elbeemDebugOut(debugStrBuffer);
BKE_report(reports, RPT_ERROR, "Invalid object matrix");
@@ -993,12 +1000,11 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
}
/* ******** start writing / exporting ******** */
- // use .tmp, dont overwrite/delete original file
- BLI_join_dirfile(targetFile, sizeof(targetFile), targetDir, suffixConfig);
- strncat(targetFile, ".tmp", sizeof(targetFile));
+ // use .tmp, don't overwrite/delete original file
+ BLI_join_dirfile(targetFile, sizeof(targetFile), targetDir, suffixConfigTmp);
// make sure these directories exist as well
- if(outStringsChanged) {
+ if (outStringsChanged) {
BLI_make_existing_file(targetFile);
}
@@ -1052,7 +1058,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
fsset->domainobsPartslip = domainSettings->partSlipValue;
/* use domainobsType also for surface generation flag (bit: >=64) */
- if(domainSettings->typeFlags & OB_FSSG_NOOBS)
+ if (domainSettings->typeFlags & OB_FSSG_NOOBS)
fsset->mFsSurfGenSetting = FLUIDSIM_FSSG_NOOBS;
else
fsset->mFsSurfGenSetting = 0; // "normal" mode
@@ -1061,8 +1067,8 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
// init blender domain transform matrix
{ int j;
- for(i=0; i<4; i++) {
- for(j=0; j<4; j++) {
+ for (i=0; i<4; i++) {
+ for (j=0; j<4; j++) {
fsset->surfaceTrafo[i*4+j] = invDomMat[j][i];
}
} }
@@ -1077,7 +1083,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
/* custom data for fluid bake job */
fb->settings = fsset;
- if(do_job) {
+ if (do_job) {
wmJob *steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Fluid Simulation", WM_JOB_PROGRESS);
/* setup job */
@@ -1140,10 +1146,10 @@ static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object
static int fluid_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
/* only one bake job at a time */
- if(WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+ if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
return OPERATOR_CANCELLED;
- if(!fluidsimBake(C, op->reports, CTX_data_active_object(C), TRUE))
+ if (!fluidsimBake(C, op->reports, CTX_data_active_object(C), TRUE))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -1151,7 +1157,7 @@ static int fluid_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
static int fluid_bake_exec(bContext *C, wmOperator *op)
{
- if(!fluidsimBake(C, op->reports, CTX_data_active_object(C), FALSE))
+ if (!fluidsimBake(C, op->reports, CTX_data_active_object(C), FALSE))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -1160,13 +1166,13 @@ static int fluid_bake_exec(bContext *C, wmOperator *op)
void FLUID_OT_bake(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Fluid Simulation Bake";
- ot->description= "Bake fluid simulation";
- ot->idname= "FLUID_OT_bake";
+ ot->name = "Fluid Simulation Bake";
+ ot->description = "Bake fluid simulation";
+ ot->idname = "FLUID_OT_bake";
/* api callbacks */
- ot->invoke= fluid_bake_invoke;
- ot->exec= fluid_bake_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->invoke = fluid_bake_invoke;
+ ot->exec = fluid_bake_exec;
+ ot->poll = ED_operator_object_active_editable;
}
diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c
index 473ed50b5e2..272e13e2a62 100644
--- a/source/blender/editors/physics/physics_ops.c
+++ b/source/blender/editors/physics/physics_ops.c
@@ -93,8 +93,8 @@ static void keymap_particle(wmKeyConfig *keyconf)
wmKeyMapItem *kmi;
wmKeyMap *keymap;
- keymap= WM_keymap_find(keyconf, "Particle", 0, 0);
- keymap->poll= PE_poll;
+ keymap = WM_keymap_find(keyconf, "Particle", 0, 0);
+ keymap->poll = PE_poll;
kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", AKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
@@ -187,7 +187,7 @@ static void operatortypes_dynamicpaint(void)
//static void keymap_pointcache(wmWindowManager *wm)
//{
-// wmKeyMap *keymap= WM_keymap_find(wm, "Pointcache", 0, 0);
+// wmKeyMap *keymap = WM_keymap_find(wm, "Pointcache", 0, 0);
//
// WM_keymap_add_item(keymap, "PHYSICS_OT_bake_all", AKEY, KM_PRESS, 0, 0);
// WM_keymap_add_item(keymap, "PHYSICS_OT_free_all", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index 62e0e5e201d..6573647aaee 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -67,7 +67,7 @@ static int ptcache_bake_all_poll(bContext *C)
{
Scene *scene= CTX_data_scene(C);
- if(!scene)
+ if (!scene)
return 0;
return 1;
@@ -114,7 +114,8 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op)
baker.progressbar = (void (*)(void *, int))WM_timecursor;
baker.progressend = (void (*)(void *))WM_cursor_restore;
baker.progresscontext = win;
- } else {
+ }
+ else {
baker.progressbar = bake_console_progress;
baker.progressend = bake_console_progress_end;
baker.progresscontext = NULL;
@@ -134,10 +135,10 @@ static int ptcache_free_bake_all_exec(bContext *C, wmOperator *UNUSED(op))
PTCacheID *pid;
ListBase pidlist;
- for(base=scene->base.first; base; base= base->next) {
+ for (base=scene->base.first; base; base= base->next) {
BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
- for(pid=pidlist.first; pid; pid=pid->next) {
+ for (pid=pidlist.first; pid; pid=pid->next) {
pid->cache->flag &= ~PTCACHE_BAKED;
}
@@ -154,31 +155,31 @@ static int ptcache_free_bake_all_exec(bContext *C, wmOperator *UNUSED(op))
void PTCACHE_OT_bake_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Bake All Physics";
- ot->description= "Bake all physics";
- ot->idname= "PTCACHE_OT_bake_all";
+ ot->name = "Bake All Physics";
+ ot->description = "Bake all physics";
+ ot->idname = "PTCACHE_OT_bake_all";
/* api callbacks */
- ot->exec= ptcache_bake_all_exec;
- ot->poll= ptcache_bake_all_poll;
+ ot->exec = ptcache_bake_all_exec;
+ ot->poll = ptcache_bake_all_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "bake", 1, "Bake", "");
}
void PTCACHE_OT_free_bake_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Free All Physics Bakes";
- ot->idname= "PTCACHE_OT_free_bake_all";
+ ot->name = "Free All Physics Bakes";
+ ot->idname = "PTCACHE_OT_free_bake_all";
/* api callbacks */
- ot->exec= ptcache_free_bake_all_exec;
- ot->poll= ptcache_bake_all_poll;
+ ot->exec = ptcache_free_bake_all_exec;
+ ot->poll = ptcache_bake_all_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int ptcache_bake_exec(bContext *C, wmOperator *op)
{
@@ -194,8 +195,8 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op)
BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pid->cache == cache)
+ for (pid=pidlist.first; pid; pid=pid->next) {
+ if (pid->cache == cache)
break;
}
@@ -216,7 +217,8 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op)
baker.progressbar = (void (*)(void *, int))WM_timecursor;
baker.progressend = (void (*)(void *))WM_cursor_restore;
baker.progresscontext = win;
- } else {
+ }
+ else {
printf("\n"); /* empty first line before console reports */
baker.progressbar = bake_console_progress;
baker.progressend = bake_console_progress_end;
@@ -238,8 +240,8 @@ static int ptcache_free_bake_exec(bContext *C, wmOperator *UNUSED(op))
PointCache *cache= ptr.data;
Object *ob= ptr.id.data;
- if(cache->edit) {
- if(!cache->edit->edited || 1) {// XXX okee("Lose changes done in particle mode?")) {
+ if (cache->edit) {
+ if (!cache->edit->edited || 1) {// XXX okee("Lose changes done in particle mode?")) {
PE_free_ptcache_edit(cache->edit);
cache->edit = NULL;
cache->flag &= ~PTCACHE_BAKED;
@@ -267,46 +269,46 @@ static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *UNUSED(op))
void PTCACHE_OT_bake(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Bake Physics";
- ot->description= "Bake physics";
- ot->idname= "PTCACHE_OT_bake";
+ ot->name = "Bake Physics";
+ ot->description = "Bake physics";
+ ot->idname = "PTCACHE_OT_bake";
/* api callbacks */
- ot->exec= ptcache_bake_exec;
- ot->poll= ptcache_poll;
+ ot->exec = ptcache_bake_exec;
+ ot->poll = ptcache_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "bake", 0, "Bake", "");
}
void PTCACHE_OT_free_bake(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Free Physics Bake";
- ot->description= "Free physics bake";
- ot->idname= "PTCACHE_OT_free_bake";
+ ot->name = "Free Physics Bake";
+ ot->description = "Free physics bake";
+ ot->idname = "PTCACHE_OT_free_bake";
/* api callbacks */
- ot->exec= ptcache_free_bake_exec;
- ot->poll= ptcache_poll;
+ ot->exec = ptcache_free_bake_exec;
+ ot->poll = ptcache_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
void PTCACHE_OT_bake_from_cache(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Bake From Cache";
- ot->description= "Bake from cache";
- ot->idname= "PTCACHE_OT_bake_from_cache";
+ ot->name = "Bake From Cache";
+ ot->description = "Bake from cache";
+ ot->idname = "PTCACHE_OT_bake_from_cache";
/* api callbacks */
- ot->exec= ptcache_bake_from_cache_exec;
- ot->poll= ptcache_poll;
+ ot->exec = ptcache_bake_from_cache_exec;
+ ot->poll = ptcache_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op))
@@ -320,8 +322,8 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op))
BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pid->cache == cache) {
+ for (pid=pidlist.first; pid; pid=pid->next) {
+ if (pid->cache == cache) {
PointCache *cache = BKE_ptcache_add(pid->ptcaches);
cache->step = pid->default_step;
*(pid->cache_ptr) = cache;
@@ -347,9 +349,9 @@ static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op))
BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pid->cache == cache) {
- if(pid->ptcaches->first == pid->ptcaches->last)
+ for (pid=pidlist.first; pid; pid=pid->next) {
+ if (pid->cache == cache) {
+ if (pid->ptcaches->first == pid->ptcaches->last)
continue; /* don't delete last cache */
BLI_remlink(pid->ptcaches, pid->cache);
@@ -369,29 +371,29 @@ static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op))
void PTCACHE_OT_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add New Cache";
- ot->description= "Add new cache";
- ot->idname= "PTCACHE_OT_add";
+ ot->name = "Add New Cache";
+ ot->description = "Add new cache";
+ ot->idname = "PTCACHE_OT_add";
/* api callbacks */
- ot->exec= ptcache_add_new_exec;
- ot->poll= ptcache_poll; // ptcache_bake_all_poll;
+ ot->exec = ptcache_add_new_exec;
+ ot->poll = ptcache_poll; // ptcache_bake_all_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
void PTCACHE_OT_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Current Cache";
- ot->description= "Delete current cache";
- ot->idname= "PTCACHE_OT_remove";
+ ot->name = "Delete Current Cache";
+ ot->description = "Delete current cache";
+ ot->idname = "PTCACHE_OT_remove";
/* api callbacks */
- ot->exec= ptcache_remove_exec;
- ot->poll= ptcache_poll;
+ ot->exec = ptcache_remove_exec;
+ ot->poll = ptcache_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 4fbc5085b2d..465a2e37269 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -82,22 +82,22 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
unsigned char *rectc;
/* if renrect argument, we only refresh scanlines */
- if(renrect) {
+ if (renrect) {
/* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */
- if(rr->renlay==NULL || renrect->ymax>=rr->recty)
+ if (rr->renlay==NULL || renrect->ymax>=rr->recty)
return;
/* xmin here is first subrect x coord, xmax defines subrect width */
xmin = renrect->xmin + rr->crop;
xmax = renrect->xmax - xmin + rr->crop;
- if(xmax<2)
+ if (xmax<2)
return;
ymin= renrect->ymin + rr->crop;
ymax= renrect->ymax - ymin + rr->crop;
- if(ymax<2)
+ if (ymax<2)
return;
- renrect->ymin= renrect->ymax;
+ renrect->ymin = renrect->ymax;
}
else {
@@ -108,37 +108,37 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
/* xmin ymin is in tile coords. transform to ibuf */
rxmin= rr->tilerect.xmin + xmin;
- if(rxmin >= ibuf->x) return;
+ if (rxmin >= ibuf->x) return;
rymin= rr->tilerect.ymin + ymin;
- if(rymin >= ibuf->y) return;
+ if (rymin >= ibuf->y) return;
- if(rxmin + xmax > ibuf->x)
+ if (rxmin + xmax > ibuf->x)
xmax= ibuf->x - rxmin;
- if(rymin + ymax > ibuf->y)
+ if (rymin + ymax > ibuf->y)
ymax= ibuf->y - rymin;
- if(xmax < 1 || ymax < 1) return;
+ if (xmax < 1 || ymax < 1) return;
/* find current float rect for display, first case is after composite... still weak */
- if(rr->rectf)
+ if (rr->rectf)
rectf= rr->rectf;
else {
- if(rr->rect32)
+ if (rr->rect32)
return;
else {
- if(rr->renlay==NULL || rr->renlay->rectf==NULL) return;
+ if (rr->renlay==NULL || rr->renlay->rectf==NULL) return;
rectf= rr->renlay->rectf;
}
}
- if(rectf==NULL) return;
+ if (rectf==NULL) return;
- if(ibuf->rect==NULL)
+ if (ibuf->rect==NULL)
imb_addrectImBuf(ibuf);
rectf+= 4*(rr->rectx*ymin + xmin);
rectc= (unsigned char*)(ibuf->rect + ibuf->x*rymin + rxmin);
- if(scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)) {
+ if (scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)) {
profile_from= IB_PROFILE_LINEAR_RGB;
predivide= (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
}
@@ -160,7 +160,7 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **scene, SceneRenderLayer **srl)
{
/* single layer re-render */
- if(RNA_struct_property_is_set(op->ptr, "scene")) {
+ if (RNA_struct_property_is_set(op->ptr, "scene")) {
Scene *scn;
char scene_name[MAX_ID_NAME-2];
@@ -176,7 +176,7 @@ static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **s
}
}
- if(RNA_struct_property_is_set(op->ptr, "layer")) {
+ if (RNA_struct_property_is_set(op->ptr, "layer")) {
SceneRenderLayer *rl;
char rl_name[RE_MAXNAME];
@@ -205,7 +205,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
/* custom scene and single layer re-render */
screen_render_scene_layer_set(op, mainp, &scene, &srl);
- if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
return OPERATOR_CANCELLED;
}
@@ -228,7 +228,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
RE_SetReports(re, op->reports);
- if(is_animation)
+ if (is_animation)
RE_BlenderAnim(re, mainp, scene, camera_override, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
else
RE_BlenderFrame(re, mainp, scene, srl, camera_override, lay, scene->r.cfra, is_write_still);
@@ -283,40 +283,40 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str)
mmap_used_memory= (mmap_in_use)/(1024.0*1024.0);
megs_peak_memory = (peak_memory)/(1024.0*1024.0);
- if(scene->lay & 0xFF000000)
+ if (scene->lay & 0xFF000000)
spos+= sprintf(spos, "Localview | ");
- else if(scene->r.scemode & R_SINGLE_LAYER)
+ else if (scene->r.scemode & R_SINGLE_LAYER)
spos+= sprintf(spos, "Single Layer | ");
- if(rs->statstr) {
+ if (rs->statstr) {
spos+= sprintf(spos, "%s ", rs->statstr);
}
else {
spos+= sprintf(spos, "Fra:%d ", (scene->r.cfra));
- if(rs->totvert) spos+= sprintf(spos, "Ve:%d ", rs->totvert);
- if(rs->totface) spos+= sprintf(spos, "Fa:%d ", rs->totface);
- if(rs->tothalo) spos+= sprintf(spos, "Ha:%d ", rs->tothalo);
- if(rs->totstrand) spos+= sprintf(spos, "St:%d ", rs->totstrand);
- if(rs->totlamp) spos+= sprintf(spos, "La:%d ", rs->totlamp);
+ if (rs->totvert) spos+= sprintf(spos, "Ve:%d ", rs->totvert);
+ if (rs->totface) spos+= sprintf(spos, "Fa:%d ", rs->totface);
+ if (rs->tothalo) spos+= sprintf(spos, "Ha:%d ", rs->tothalo);
+ if (rs->totstrand) spos+= sprintf(spos, "St:%d ", rs->totstrand);
+ if (rs->totlamp) spos+= sprintf(spos, "La:%d ", rs->totlamp);
spos+= sprintf(spos, "Mem:%.2fM (%.2fM, peak %.2fM) ", megs_used_memory, mmap_used_memory, megs_peak_memory);
- if(rs->curfield)
+ if (rs->curfield)
spos+= sprintf(spos, "Field %d ", rs->curfield);
- if(rs->curblur)
+ if (rs->curblur)
spos+= sprintf(spos, "Blur %d ", rs->curblur);
}
BLI_timestr(rs->lastframetime, info_time_str);
spos+= sprintf(spos, "Time:%s ", info_time_str);
- if(rs->curfsa)
+ if (rs->curfsa)
spos+= sprintf(spos, "| Full Sample %d ", rs->curfsa);
- if(rs->infostr && rs->infostr[0])
+ if (rs->infostr && rs->infostr[0])
spos+= sprintf(spos, "| %s ", rs->infostr);
/* very weak... but 512 characters is quite safe */
- if(spos >= str+IMA_MAX_RENDER_TEXT)
+ if (spos >= str+IMA_MAX_RENDER_TEXT)
if (G.f & G_DEBUG)
printf("WARNING! renderwin text beyond limit \n");
@@ -329,9 +329,9 @@ static void image_renderinfo_cb(void *rjv, RenderStats *rs)
rr= RE_AcquireResultRead(rj->re);
- if(rr) {
+ if (rr) {
/* malloc OK here, stats_draw is not in tile threads */
- if(rr->text==NULL)
+ if (rr->text==NULL)
rr->text= MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext");
make_renderinfo_string(rs, rj->scene, rr->text);
@@ -348,7 +348,7 @@ static void render_progress_update(void *rjv, float progress)
{
RenderJob *rj= rjv;
- if(rj->progress && *rj->progress != progress) {
+ if (rj->progress && *rj->progress != progress) {
*rj->progress = progress;
/* make jobs timer to send notifier */
@@ -364,11 +364,11 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec
void *lock;
/* only update if we are displaying the slot being rendered */
- if(ima->render_slot != ima->last_render_slot)
+ if (ima->render_slot != ima->last_render_slot)
return;
ibuf= BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
- if(ibuf) {
+ if (ibuf) {
image_buffer_rect_update(rj->scene, rr, ibuf, renrect);
/* make jobs timer to send notifier */
@@ -387,7 +387,7 @@ static void render_startjob(void *rjv, short *stop, short *do_update, float *pro
RE_SetReports(rj->re, rj->reports);
- if(rj->anim)
+ if (rj->anim)
RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->camera_override, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step);
else
RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->camera_override, rj->lay, rj->scene->r.cfra, rj->write_still);
@@ -403,11 +403,11 @@ static void render_endjob(void *rjv)
* would be re-assigned. assign dummy callbacks to avoid referencing freed renderjobs bug [#24508] */
RE_InitRenderCB(rj->re);
- if(rj->main != G.main)
+ if (rj->main != G.main)
free_main(rj->main);
/* else the frame will not update for the original value */
- if(!(rj->scene->r.scemode & R_NO_FRAME_UPDATE))
+ if (!(rj->scene->r.scemode & R_NO_FRAME_UPDATE))
ED_update_for_newframe(G.main, rj->scene, rj->win->screen, 1);
/* XXX above function sets all tags in nodes */
@@ -416,7 +416,7 @@ static void render_endjob(void *rjv)
/* potentially set by caller */
rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE;
- if(rj->srl) {
+ if (rj->srl) {
nodeUpdateID(rj->scene->nodetree, &rj->scene->id);
WM_main_add_notifier(NC_NODE|NA_EDITED, rj->scene);
}
@@ -431,9 +431,9 @@ static int render_breakjob(void *rjv)
{
RenderJob *rj= rjv;
- if(G.afbreek)
+ if (G.afbreek)
return 1;
- if(rj->stop && *(rj->stop))
+ if (rj->stop && *(rj->stop))
return 1;
return 0;
}
@@ -450,7 +450,7 @@ static void render_drawlock(void *UNUSED(rjv), int lock)
static int screen_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))) {
+ if (0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
@@ -483,14 +483,14 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
const char *name;
/* only one render job at a time */
- if(WM_jobs_test(CTX_wm_manager(C), scene))
+ if (WM_jobs_test(CTX_wm_manager(C), scene))
return OPERATOR_CANCELLED;
- if(!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
+ if (!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
return OPERATOR_CANCELLED;
}
- if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
return OPERATOR_CANCELLED;
}
@@ -499,7 +499,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
WM_jobs_stop_all(CTX_wm_manager(C));
/* get main */
- if(G.rt == 101) {
+ if (G.rt == 101) {
/* thread-safety experiment, copy main from the undo buffer */
mainp= BKE_undo_get_main(&scene);
}
@@ -537,7 +537,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* custom scene and single layer re-render */
screen_render_scene_layer_set(op, mainp, &scene, &srl);
- if(RNA_struct_property_is_set(op->ptr, "layer"))
+ if (RNA_struct_property_is_set(op->ptr, "layer"))
jobflag |= WM_JOB_SUSPEND;
/* job custom data */
@@ -555,7 +555,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
rj->reports= op->reports;
/* setup job */
- if(RE_seq_render_active(scene, &scene->r)) name= "Sequence Render";
+ if (RE_seq_render_active(scene, &scene->r)) name= "Sequence Render";
else name= "Render";
steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag);
@@ -600,16 +600,16 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
void RENDER_OT_render(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Render";
- ot->description= "Render active scene";
- ot->idname= "RENDER_OT_render";
+ ot->name = "Render";
+ ot->description = "Render active scene";
+ ot->idname = "RENDER_OT_render";
/* api callbacks */
- ot->invoke= screen_render_invoke;
- ot->modal= screen_render_modal;
- ot->exec= screen_render_exec;
+ ot->invoke = screen_render_invoke;
+ ot->modal = screen_render_modal;
+ ot->exec = screen_render_exec;
- /*ot->poll= ED_operator_screenactive;*/ /* this isnt needed, causes failer in background mode */
+ /*ot->poll = ED_operator_screenactive;*/ /* this isn't needed, causes failer in background mode */
RNA_def_boolean(ot->srna, "animation", 0, "Animation", "Render files from the animation range of this scene");
RNA_def_boolean(ot->srna, "write_still", 0, "Write Image", "Save rendered the image to the output path (used only when animation is disabled)");
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 79832e2a9d1..26996893ae5 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -104,7 +104,7 @@ typedef struct OGLRender {
/* added because v3d is not always valid */
static unsigned int screen_opengl_layers(OGLRender *oglrender)
{
- if(oglrender->v3d) {
+ if (oglrender->v3d) {
return oglrender->scene->lay | oglrender->v3d->lay;
}
else {
@@ -129,11 +129,11 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
rr= RE_AcquireResultRead(oglrender->re);
- if(view_context) {
+ if (view_context) {
GPU_offscreen_bind(oglrender->ofs); /* bind */
/* render 3d view */
- if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
+ if (rv3d->persp==RV3D_CAMOB && v3d->camera) {
/*int is_ortho= scene->r.mode & R_ORTHO;*/
camera= v3d->camera;
RE_GetCameraWindow(oglrender->re, camera, scene->r.cfra, winmat);
@@ -144,11 +144,11 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
float clipsta, clipend;
int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend);
- if(is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
+ if (is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
}
- if((scene->r.mode & R_OSA) == 0) {
+ if ((scene->r.mode & R_OSA) == 0) {
ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat, TRUE);
GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, rr->rectf);
}
@@ -167,7 +167,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_buffer);
/* skip the first sample */
- for(j=1; j < scene->r.osa; j++) {
+ for (j=1; j < scene->r.osa; j++) {
copy_m4_m4(winmat_jitter, winmat);
window_translate_m4(winmat_jitter, rv3d->persmat,
(jit_ofs[j][0] * 2.0f) / sizex,
@@ -192,7 +192,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, TRUE, err_out);
camera= scene->camera;
- if(ibuf_view) {
+ if (ibuf_view) {
memcpy(rr->rectf, ibuf_view->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey);
IMB_freeImBuf(ibuf_view);
}
@@ -203,7 +203,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
/* rr->rectf is now filled with image data */
- if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
+ if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
BKE_stamp_buf(scene, camera, NULL, rr->rectf, rr->rectx, rr->recty, 4);
/* note on color management:
@@ -214,7 +214,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
* sRGB again, and so that e.g. openexr saving also saves the correct linear
* float buffer. */
- if(oglrender->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
+ if (oglrender->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
int predivide= 0; /* no alpha */
IMB_buffer_float_from_float(rr->rectf, rr->rectf,
@@ -227,20 +227,20 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
/* update byte from float buffer */
ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
- if(ibuf) {
+ if (ibuf) {
image_buffer_rect_update(scene, rr, ibuf, NULL);
- if(oglrender->write_still) {
+ if (oglrender->write_still) {
char name[FILE_MAX];
int ok;
- if(scene->r.im_format.planes == R_IMF_CHAN_DEPTH_8) {
+ if (scene->r.im_format.planes == R_IMF_CHAN_DEPTH_8) {
IMB_color_to_bw(ibuf);
}
BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, FALSE);
ok= BKE_write_ibuf_as(ibuf, name, &scene->r.im_format, TRUE); /* no need to stamp here */
- if(ok) printf("OpenGL Render written to '%s'\n", name);
+ if (ok) printf("OpenGL Render written to '%s'\n", name);
else printf("OpenGL Render failed to write '%s'\n", name);
}
}
@@ -263,28 +263,28 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
char err_out[256]= "unknown";
- if(G.background) {
+ if (G.background) {
BKE_report(op->reports, RPT_ERROR, "Can't use OpenGL render in background mode (no opengl context)");
return 0;
}
/* ensure we have a 3d view */
- if(!ED_view3d_context_activate(C)) {
+ if (!ED_view3d_context_activate(C)) {
RNA_boolean_set(op->ptr, "view_context", FALSE);
is_view_context = 0;
}
/* only one render job at a time */
- if(WM_jobs_test(CTX_wm_manager(C), scene))
+ if (WM_jobs_test(CTX_wm_manager(C), scene))
return 0;
- if(!is_view_context && scene->camera==NULL) {
+ if (!is_view_context && scene->camera==NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene has no camera");
return 0;
}
- if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
return 0;
}
@@ -302,7 +302,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
/* corrects render size with actual size, not every card supports non-power-of-two dimensions */
ofs= GPU_offscreen_create(sizex, sizey, err_out);
- if(!ofs) {
+ if (!ofs) {
BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer, %s", err_out);
return 0;
}
@@ -326,7 +326,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
oglrender->prevsa= prevsa;
oglrender->prevar= prevar;
- if(is_view_context) {
+ if (is_view_context) {
ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar); /* so quad view renders camera */
oglrender->rv3d= oglrender->ar->regiondata;
@@ -355,7 +355,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
RE_InitState(oglrender->re, NULL, &scene->r, NULL, sizex, sizey, NULL);
rr= RE_AcquireResultWrite(oglrender->re);
- if(rr->rectf==NULL)
+ if (rr->rectf==NULL)
rr->rectf= MEM_callocN(sizeof(float)*4*sizex*sizey, "screen_opengl_render_init rect");
RE_ReleaseResult(oglrender->re);
@@ -367,12 +367,12 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
Main *bmain= CTX_data_main(C);
Scene *scene= oglrender->scene;
- if(oglrender->mh) {
- if(BKE_imtype_is_movie(scene->r.im_format.imtype))
+ if (oglrender->mh) {
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype))
oglrender->mh->end_movie();
}
- if(oglrender->timer) { /* exec will not have a timer */
+ if (oglrender->timer) { /* exec will not have a timer */
scene->r.cfra= oglrender->cfrao;
scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
@@ -413,8 +413,8 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
oglrender->reports= op->reports;
oglrender->mh= BKE_get_movie_handle(scene->r.im_format.imtype);
- if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
- if(!oglrender->mh->start_movie(scene, &scene->r, oglrender->sizex, oglrender->sizey, oglrender->reports)) {
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (!oglrender->mh->start_movie(scene, &scene->r, oglrender->sizex, oglrender->sizey, oglrender->reports)) {
screen_opengl_render_end(C, oglrender);
return 0;
}
@@ -439,14 +439,14 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
Object *camera= NULL;
/* update animated image textures for gpu, etc,
- * call before scene_update_for_newframe so modifiers with textuers dont lag 1 frame */
+ * call before scene_update_for_newframe so modifiers with textuers don't lag 1 frame */
ED_image_update_frame(bmain, scene->r.cfra);
/* go to next frame */
- while(CFRA<oglrender->nfra) {
+ while (CFRA<oglrender->nfra) {
unsigned int lay= screen_opengl_layers(oglrender);
- if(lay & 0xFF000000)
+ if (lay & 0xFF000000)
lay &= 0xFF000000;
scene_update_for_newframe(bmain, scene, lay);
@@ -455,11 +455,11 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
- if(view_context) {
- if(oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) {
+ if (view_context) {
+ if (oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) {
/* since scene_update_for_newframe() is used rather
* then ED_update_for_newframe() the camera needs to be set */
- if(scene_camera_switch_update(scene)) {
+ if (scene_camera_switch_update(scene)) {
oglrender->v3d->camera= scene->camera;
}
@@ -478,10 +478,10 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
/* save to disk */
ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
- if(ibuf) {
+ if (ibuf) {
/* color -> greyscale */
/* editing directly would alter the render view */
- if(scene->r.im_format.planes == R_IMF_PLANES_BW) {
+ if (scene->r.im_format.planes == R_IMF_PLANES_BW) {
ImBuf *ibuf_bw= IMB_dupImBuf(ibuf);
IMB_color_to_bw(ibuf_bw);
// IMB_freeImBuf(ibuf); /* owned by the image */
@@ -497,10 +497,10 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
ibuf= ibuf_cpy;
}
- if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
ok= oglrender->mh->append_movie(&scene->r, SFRA, CFRA, (int*)ibuf->rect,
oglrender->sizex, oglrender->sizey, oglrender->reports);
- if(ok) {
+ if (ok) {
printf("Append frame %d", scene->r.cfra);
BKE_reportf(op->reports, RPT_INFO, "Appended frame: %d", scene->r.cfra);
}
@@ -509,7 +509,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE);
ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format);
- if(ok==0) {
+ if (ok==0) {
printf("Write error: cannot save %s\n", name);
BKE_reportf(op->reports, RPT_ERROR, "Write error: cannot save %s", name);
}
@@ -533,7 +533,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
scene->r.cfra++;
/* stop at the end or on error */
- if(scene->r.cfra > PEFRA || !ok) {
+ if (scene->r.cfra > PEFRA || !ok) {
screen_opengl_render_end(C, op->customdata);
return 0;
}
@@ -555,7 +555,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *even
return OPERATOR_FINISHED;
case TIMER:
/* render frame? */
- if(oglrender->timer == event->customdata)
+ if (oglrender->timer == event->customdata)
break;
default:
/* nothing to do */
@@ -565,7 +565,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *even
/* run first because screen_opengl_render_anim_step can free oglrender */
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, oglrender->scene);
- if(anim == 0) {
+ if (anim == 0) {
screen_opengl_render_apply(op->customdata);
screen_opengl_render_end(C, op->customdata);
return OPERATOR_FINISHED;
@@ -574,7 +574,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *even
ret= screen_opengl_render_anim_step(C, op);
/* stop at the end or on error */
- if(ret == 0) {
+ if (ret == 0) {
return OPERATOR_FINISHED;
}
@@ -586,11 +586,11 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, wmEvent *eve
OGLRender *oglrender;
int anim= RNA_boolean_get(op->ptr, "animation");
- if(!screen_opengl_render_init(C, op))
+ if (!screen_opengl_render_init(C, op))
return OPERATOR_CANCELLED;
- if(anim) {
- if(!screen_opengl_render_anim_initialize(C, op))
+ if (anim) {
+ if (!screen_opengl_render_anim_initialize(C, op))
return OPERATOR_CANCELLED;
}
@@ -608,10 +608,10 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
{
const short is_animation= RNA_boolean_get(op->ptr, "animation");
- if(!screen_opengl_render_init(C, op))
+ if (!screen_opengl_render_init(C, op))
return OPERATOR_CANCELLED;
- if(!is_animation) { /* same as invoke */
+ if (!is_animation) { /* same as invoke */
/* render image */
screen_opengl_render_apply(op->customdata);
screen_opengl_render_end(C, op->customdata);
@@ -621,10 +621,10 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
else {
int ret= 1;
- if(!screen_opengl_render_anim_initialize(C, op))
+ if (!screen_opengl_render_anim_initialize(C, op))
return OPERATOR_CANCELLED;
- while(ret) {
+ while (ret) {
ret= screen_opengl_render_anim_step(C, op);
}
}
@@ -639,17 +639,17 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
void RENDER_OT_opengl(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "OpenGL Render";
- ot->description= "OpenGL render active viewport";
- ot->idname= "RENDER_OT_opengl";
+ ot->name = "OpenGL Render";
+ ot->description = "OpenGL render active viewport";
+ ot->idname = "RENDER_OT_opengl";
/* api callbacks */
- ot->invoke= screen_opengl_render_invoke;
- ot->exec= screen_opengl_render_exec; /* blocking */
- ot->modal= screen_opengl_render_modal;
- ot->cancel= screen_opengl_render_cancel;
+ ot->invoke = screen_opengl_render_invoke;
+ ot->exec = screen_opengl_render_exec; /* blocking */
+ ot->modal = screen_opengl_render_modal;
+ ot->cancel = screen_opengl_render_cancel;
- ot->poll= ED_operator_screenactive;
+ ot->poll = ED_operator_screenactive;
RNA_def_boolean(ot->srna, "animation", 0, "Animation", "Render files from the animation range of this scene");
RNA_def_boolean(ot->srna, "write_still", 0, "Write Image", "Save rendered the image to the output path (used only when animation is disabled)");
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index f0ef7c633cb..9ba961302f1 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -202,29 +202,29 @@ void ED_preview_init_dbase(void)
void ED_preview_free_dbase(void)
{
- if(pr_main)
+ if (pr_main)
free_main(pr_main);
}
static int preview_mat_has_sss(Material *mat, bNodeTree *ntree)
{
- if(mat) {
- if(mat->sss_flag & MA_DIFF_SSS)
+ if (mat) {
+ if (mat->sss_flag & MA_DIFF_SSS)
return 1;
- if(mat->nodetree)
- if( preview_mat_has_sss(NULL, mat->nodetree))
+ if (mat->nodetree)
+ if ( preview_mat_has_sss(NULL, mat->nodetree))
return 1;
}
- else if(ntree) {
+ else if (ntree) {
bNode *node;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==NODE_GROUP && node->id) {
- if( preview_mat_has_sss(NULL, (bNodeTree *)node->id))
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type==NODE_GROUP && node->id) {
+ if ( preview_mat_has_sss(NULL, (bNodeTree *)node->id))
return 1;
}
- else if(node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
+ else if (node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
mat= (Material *)node->id;
- if(mat->sss_flag & MA_DIFF_SSS)
+ if (mat->sss_flag & MA_DIFF_SSS)
return 1;
}
}
@@ -239,17 +239,17 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
Scene *sce;
Base *base;
- if(pr_main==NULL) return NULL;
+ if (pr_main==NULL) return NULL;
sce= pr_main->scene.first;
- if(sce) {
+ if (sce) {
/* this flag tells render to not execute depsgraph or ipos etc */
sce->r.scemode |= R_PREVIEWBUTS;
/* set world always back, is used now */
sce->world= pr_main->world.first;
/* now: exposure copy */
- if(scene->world) {
+ if (scene->world) {
sce->world->exp= scene->world->exp;
sce->world->range= scene->world->range;
}
@@ -257,16 +257,16 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->r.color_mgt_flag = scene->r.color_mgt_flag;
/* prevent overhead for small renders and icons (32) */
- if(id && sp->sizex < 40)
+ if (id && sp->sizex < 40)
sce->r.xparts= sce->r.yparts= 1;
else
sce->r.xparts= sce->r.yparts= 4;
/* exception: don't color manage texture previews or icons */
- if((id && sp->pr_method==PR_ICON_RENDER) || id_type == ID_TE)
+ if ((id && sp->pr_method==PR_ICON_RENDER) || id_type == ID_TE)
sce->r.color_mgt_flag &= ~R_COLOR_MANAGEMENT;
- if((id && sp->pr_method==PR_ICON_RENDER) && id_type != ID_WO)
+ if ((id && sp->pr_method==PR_ICON_RENDER) && id_type != ID_WO)
sce->r.alphamode= R_ALPHAPREMUL;
else
sce->r.alphamode= R_ADDSKY;
@@ -274,10 +274,10 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->r.cfra= scene->r.cfra;
BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine));
- if(id_type==ID_MA) {
+ if (id_type==ID_MA) {
Material *mat= NULL, *origmat= (Material *)id;
- if(origmat) {
+ if (origmat) {
/* work on a copy */
mat= localize_material(origmat);
sp->matcopy= mat;
@@ -287,27 +287,27 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
end_render_material(mat);
/* un-useful option */
- if(sp->pr_method==PR_ICON_RENDER)
+ if (sp->pr_method==PR_ICON_RENDER)
mat->shade_flag &= ~MA_OBCOLOR;
/* turn on raytracing if needed */
- if(mat->mode_l & MA_RAYMIRROR)
+ if (mat->mode_l & MA_RAYMIRROR)
sce->r.mode |= R_RAYTRACE;
- if(mat->material_type == MA_TYPE_VOLUME)
+ if (mat->material_type == MA_TYPE_VOLUME)
sce->r.mode |= R_RAYTRACE;
- if((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP))
+ if ((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP))
sce->r.mode |= R_RAYTRACE;
- if(preview_mat_has_sss(mat, NULL))
+ if (preview_mat_has_sss(mat, NULL))
sce->r.mode |= R_SSS;
/* turn off fake shadows if needed */
/* this only works in a specific case where the preview.blend contains
* an object starting with 'c' which has a material linked to it (not the obdata)
* and that material has a fake shadow texture in the active texture slot */
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='c') {
+ for (base= sce->base.first; base; base= base->next) {
+ if (base->object->id.name[2]=='c') {
Material *shadmat= give_current_material(base->object, base->object->actcol);
- if(shadmat) {
+ if (shadmat) {
if (mat->mode & MA_SHADBUF) shadmat->septex = 0;
else shadmat->septex |= 1;
}
@@ -316,11 +316,11 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
/* turn off bounce lights for volume,
* doesn't make much visual difference and slows it down too */
- if(mat->material_type == MA_TYPE_VOLUME) {
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->type == OB_LAMP) {
+ if (mat->material_type == MA_TYPE_VOLUME) {
+ for (base= sce->base.first; base; base= base->next) {
+ if (base->object->type == OB_LAMP) {
/* if doesn't match 'Lamp.002' --> main key light */
- if( strcmp(base->object->id.name+2, "Lamp.002") != 0 ) {
+ if ( strcmp(base->object->id.name+2, "Lamp.002") != 0 ) {
base->object->restrictflag |= OB_RESTRICT_RENDER;
}
}
@@ -328,7 +328,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
- if(sp->pr_method==PR_ICON_RENDER) {
+ if (sp->pr_method==PR_ICON_RENDER) {
if (mat->material_type == MA_TYPE_HALO) {
sce->lay= 1<<MA_FLAT;
}
@@ -338,7 +338,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
else {
sce->lay= 1<<mat->pr_type;
- if(mat->nodetree && sp->pr_method==PR_NODE_RENDER) {
+ if (mat->nodetree && sp->pr_method==PR_NODE_RENDER) {
/* two previews, they get copied by wmJob */
ntreeInitPreview(mat->nodetree, sp->sizex, sp->sizey);
ntreeInitPreview(origmat->nodetree, sp->sizex, sp->sizey);
@@ -350,45 +350,46 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='p') {
+ for (base= sce->base.first; base; base= base->next) {
+ if (base->object->id.name[2]=='p') {
/* copy over object color, in case material uses it */
copy_v4_v4(base->object->col, sp->col);
- if(OB_TYPE_SUPPORT_MATERIAL(base->object->type)) {
+ if (OB_TYPE_SUPPORT_MATERIAL(base->object->type)) {
/* don't use assign_material, it changed mat->id.us, which shows in the UI */
Material ***matar= give_matarar(base->object);
int actcol= MAX2(base->object->actcol > 0, 1) - 1;
- if(matar && actcol < base->object->totcol)
+ if (matar && actcol < base->object->totcol)
(*matar)[actcol]= mat;
- } else if (base->object->type == OB_LAMP) {
+ }
+ else if (base->object->type == OB_LAMP) {
base->object->restrictflag &= ~OB_RESTRICT_RENDER;
}
}
}
}
- else if(id_type==ID_TE) {
+ else if (id_type==ID_TE) {
Tex *tex= NULL, *origtex= (Tex *)id;
- if(origtex) {
+ if (origtex) {
tex= localize_texture(origtex);
sp->texcopy= tex;
BLI_addtail(&pr_main->tex, tex);
}
sce->lay= 1<<MA_TEXTURE;
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='t') {
+ for (base= sce->base.first; base; base= base->next) {
+ if (base->object->id.name[2]=='t') {
Material *mat= give_current_material(base->object, base->object->actcol);
- if(mat && mat->mtex[0]) {
+ if (mat && mat->mtex[0]) {
mat->mtex[0]->tex= tex;
- if(tex && sp->slot)
+ if (tex && sp->slot)
mat->mtex[0]->which_output = sp->slot->which_output;
/* show alpha in this case */
- if(tex==NULL || (tex->flag & TEX_PRV_ALPHA)) {
+ if (tex==NULL || (tex->flag & TEX_PRV_ALPHA)) {
mat->mtex[0]->mapto |= MAP_ALPHA;
mat->alpha= 0.0f;
}
@@ -400,23 +401,23 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
}
- if(tex && tex->nodetree && sp->pr_method==PR_NODE_RENDER) {
+ if (tex && tex->nodetree && sp->pr_method==PR_NODE_RENDER) {
/* two previews, they get copied by wmJob */
ntreeInitPreview(origtex->nodetree, sp->sizex, sp->sizey);
ntreeInitPreview(tex->nodetree, sp->sizex, sp->sizey);
}
}
- else if(id_type==ID_LA) {
+ else if (id_type==ID_LA) {
Lamp *la= NULL, *origla= (Lamp *)id;
/* work on a copy */
- if(origla) {
+ if (origla) {
la= localize_lamp(origla);
sp->lampcopy= la;
BLI_addtail(&pr_main->lamp, la);
}
- if(la && la->type==LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) {
+ if (la && la->type==LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) {
sce->lay= 1<<MA_ATMOS;
sce->world= scene->world;
sce->camera= (Object *)BLI_findstring(&pr_main->object, "CameraAtmo", offsetof(ID, name)+2);
@@ -428,23 +429,23 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
sce->r.mode &= ~R_SHADOW;
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='p') {
- if(base->object->type==OB_LAMP)
+ for (base= sce->base.first; base; base= base->next) {
+ if (base->object->id.name[2]=='p') {
+ if (base->object->type==OB_LAMP)
base->object->data= la;
}
}
- if(la && la->nodetree && sp->pr_method==PR_NODE_RENDER) {
+ if (la && la->nodetree && sp->pr_method==PR_NODE_RENDER) {
/* two previews, they get copied by wmJob */
ntreeInitPreview(origla->nodetree, sp->sizex, sp->sizey);
ntreeInitPreview(la->nodetree, sp->sizex, sp->sizey);
}
}
- else if(id_type==ID_WO) {
+ else if (id_type==ID_WO) {
World *wrld= NULL, *origwrld= (World *)id;
- if(origwrld) {
+ if (origwrld) {
wrld= localize_world(origwrld);
sp->worldcopy= wrld;
BLI_addtail(&pr_main->world, wrld);
@@ -453,7 +454,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->lay= 1<<MA_SKY;
sce->world= wrld;
- if(wrld && wrld->nodetree && sp->pr_method==PR_NODE_RENDER) {
+ if (wrld && wrld->nodetree && sp->pr_method==PR_NODE_RENDER) {
/* two previews, they get copied by wmJob */
ntreeInitPreview(wrld->nodetree, sp->sizex, sp->sizey);
ntreeInitPreview(origwrld->nodetree, sp->sizex, sp->sizey);
@@ -484,11 +485,11 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
}
}
- if(!split || first) sprintf(name, "Preview %p", (void *)sa);
+ if (!split || first) sprintf(name, "Preview %p", (void *)sa);
else sprintf(name, "SecondPreview %p", (void *)sa);
- if(split) {
- if(first) {
+ if (split) {
+ if (first) {
offx= 0;
newx= newx/2;
}
@@ -501,14 +502,14 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
re= RE_GetRender(name);
RE_AcquireResultImage(re, &rres);
- if(rres.rectf) {
+ if (rres.rectf) {
- if(ABS(rres.rectx-newx)<2 && ABS(rres.recty-newy)<2) {
+ if (ABS(rres.rectx-newx)<2 && ABS(rres.recty-newy)<2) {
- newrect->xmax= MAX2(newrect->xmax, rect->xmin + rres.rectx + offx);
- newrect->ymax= MAX2(newrect->ymax, rect->ymin + rres.recty);
+ newrect->xmax = MAX2(newrect->xmax, rect->xmin + rres.rectx + offx);
+ newrect->ymax = MAX2(newrect->ymax, rect->ymin + rres.recty);
- if(rres.rectx && rres.recty) {
+ if (rres.rectx && rres.recty) {
/* temporary conversion to byte for drawing */
float fx= rect->xmin + offx;
float fy= rect->ymin;
@@ -538,7 +539,7 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, rcti *rect)
{
- if(idp) {
+ if (idp) {
ScrArea *sa= CTX_wm_area(C);
Scene *sce = CTX_data_scene(C);
ID *id = (ID *)idp;
@@ -549,28 +550,28 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
int ok;
int newx= rect->xmax-rect->xmin, newy= rect->ymax-rect->ymin;
- newrect.xmin= rect->xmin;
- newrect.xmax= rect->xmin;
- newrect.ymin= rect->ymin;
- newrect.ymax= rect->ymin;
+ newrect.xmin = rect->xmin;
+ newrect.xmax = rect->xmin;
+ newrect.ymin = rect->ymin;
+ newrect.ymax = rect->ymin;
- if(parent) {
+ if (parent) {
ok = ed_preview_draw_rect(sa, sce, id, 1, 1, rect, &newrect);
ok &= ed_preview_draw_rect(sa, sce, parent, 1, 0, rect, &newrect);
}
else
ok = ed_preview_draw_rect(sa, sce, id, 0, 0, rect, &newrect);
- if(ok)
+ if (ok)
*rect= newrect;
/* check for spacetype... */
- if(sbuts->spacetype==SPACE_BUTS && sbuts->preview) {
+ if (sbuts->spacetype==SPACE_BUTS && sbuts->preview) {
sbuts->preview= 0;
ok= 0;
}
- if(ok==0) {
+ if (ok==0) {
ED_preview_shader_job(C, sa, id, parent, slot, newx, newy, PR_BUTS_RENDER);
}
}
@@ -599,30 +600,30 @@ static void shader_preview_updatejob(void *spv)
{
ShaderPreview *sp= spv;
- if(sp->id) {
- if(sp->pr_method==PR_NODE_RENDER) {
- if( GS(sp->id->name) == ID_MA) {
+ if (sp->id) {
+ if (sp->pr_method==PR_NODE_RENDER) {
+ if ( GS(sp->id->name) == ID_MA) {
Material *mat= (Material *)sp->id;
- if(sp->matcopy && mat->nodetree && sp->matcopy->nodetree)
+ if (sp->matcopy && mat->nodetree && sp->matcopy->nodetree)
ntreeLocalSync(sp->matcopy->nodetree, mat->nodetree);
}
- else if( GS(sp->id->name) == ID_TE) {
+ else if ( GS(sp->id->name) == ID_TE) {
Tex *tex= (Tex *)sp->id;
- if(sp->texcopy && tex->nodetree && sp->texcopy->nodetree)
+ if (sp->texcopy && tex->nodetree && sp->texcopy->nodetree)
ntreeLocalSync(sp->texcopy->nodetree, tex->nodetree);
}
- else if( GS(sp->id->name) == ID_WO) {
+ else if ( GS(sp->id->name) == ID_WO) {
World *wrld= (World *)sp->id;
- if(sp->worldcopy && wrld->nodetree && sp->worldcopy->nodetree)
+ if (sp->worldcopy && wrld->nodetree && sp->worldcopy->nodetree)
ntreeLocalSync(sp->worldcopy->nodetree, wrld->nodetree);
}
- else if( GS(sp->id->name) == ID_LA) {
+ else if ( GS(sp->id->name) == ID_LA) {
Lamp *la= (Lamp *)sp->id;
- if(sp->lampcopy && la->nodetree && sp->lampcopy->nodetree)
+ if (sp->lampcopy && la->nodetree && sp->lampcopy->nodetree)
ntreeLocalSync(sp->lampcopy->nodetree, la->nodetree);
}
}
@@ -640,27 +641,27 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
/* get the stuff from the builtin preview dbase */
sce= preview_prepare_scene(sp->scene, id, idtype, sp); // XXX sizex
- if(sce==NULL) return;
+ if (sce==NULL) return;
- if(!split || first) sprintf(name, "Preview %p", sp->owner);
+ if (!split || first) sprintf(name, "Preview %p", sp->owner);
else sprintf(name, "SecondPreview %p", sp->owner);
re= RE_GetRender(name);
/* full refreshed render from first tile */
- if(re==NULL)
+ if (re==NULL)
re= RE_NewRender(name);
/* sce->r gets copied in RE_InitState! */
sce->r.scemode &= ~(R_MATNODE_PREVIEW|R_TEXNODE_PREVIEW);
sce->r.scemode &= ~R_NO_IMAGE_LOAD;
- if(sp->pr_method==PR_ICON_RENDER) {
+ if (sp->pr_method==PR_ICON_RENDER) {
sce->r.scemode |= R_NO_IMAGE_LOAD;
sce->r.mode |= R_OSA;
}
- else if(sp->pr_method==PR_NODE_RENDER) {
- if(idtype == ID_MA) sce->r.scemode |= R_MATNODE_PREVIEW;
- else if(idtype == ID_TE) sce->r.scemode |= R_TEXNODE_PREVIEW;
+ else if (sp->pr_method==PR_NODE_RENDER) {
+ if (idtype == ID_MA) sce->r.scemode |= R_MATNODE_PREVIEW;
+ else if (idtype == ID_TE) sce->r.scemode |= R_TEXNODE_PREVIEW;
sce->r.mode &= ~R_OSA;
}
else { /* PR_BUTS_RENDER */
@@ -668,8 +669,8 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
}
/* in case of split preview, use border render */
- if(split) {
- if(first) sizex= sp->sizex/2;
+ if (split) {
+ if (first) sizex= sp->sizex/2;
else sizex= sp->sizex - sp->sizex/2;
}
else sizex= sp->sizex;
@@ -680,7 +681,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
sce->r.size= 100;
/* callbacs are cleared on GetRender() */
- if(ELEM(sp->pr_method, PR_BUTS_RENDER, PR_NODE_RENDER)) {
+ if (ELEM(sp->pr_method, PR_BUTS_RENDER, PR_NODE_RENDER)) {
RE_display_draw_cb(re, sp, shader_preview_draw);
}
/* set this for all previews, default is react to G.afbreek still */
@@ -688,7 +689,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
/* lens adjust */
oldlens= ((Camera *)sce->camera->data)->lens;
- if(sizex > sp->sizey)
+ if (sizex > sp->sizey)
((Camera *)sce->camera->data)->lens *= (float)sp->sizey/(float)sizex;
/* entire cycle for render engine */
@@ -697,10 +698,10 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
((Camera *)sce->camera->data)->lens= oldlens;
/* handle results */
- if(sp->pr_method==PR_ICON_RENDER) {
+ if (sp->pr_method==PR_ICON_RENDER) {
// char *rct= (char *)(sp->pr_rect + 32*16 + 16);
- if(sp->pr_rect)
+ if (sp->pr_rect)
RE_ResultGet32(re, sp->pr_rect);
}
else {
@@ -714,9 +715,9 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
preview_prepare_scene(sp->scene, NULL, GS(id->name), sp);
/* XXX bad exception, end-exec is not being called in render, because it uses local main */
-// if(idtype == ID_TE) {
+// if (idtype == ID_TE) {
// Tex *tex= (Tex *)id;
-// if(tex->use_nodes && tex->nodetree)
+// if (tex->use_nodes && tex->nodetree)
// ntreeEndExecTree(tex->nodetree);
// }
@@ -730,7 +731,7 @@ static void shader_preview_startjob(void *customdata, short *stop, short *do_upd
sp->stop= stop;
sp->do_update= do_update;
- if(sp->parent) {
+ if (sp->parent) {
shader_preview_render(sp, sp->id, 1, 1);
shader_preview_render(sp, sp->parent, 1, 0);
}
@@ -744,7 +745,7 @@ static void shader_preview_free(void *customdata)
{
ShaderPreview *sp= customdata;
- if(sp->matcopy) {
+ if (sp->matcopy) {
struct IDProperty *properties;
int a;
@@ -755,9 +756,9 @@ static void shader_preview_free(void *customdata)
BLI_remlink(&pr_main->mat, sp->matcopy);
/* free_material decrements texture, prevent this. hack alert! */
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
MTex *mtex= sp->matcopy->mtex[a];
- if(mtex && mtex->tex) mtex->tex= NULL;
+ if (mtex && mtex->tex) mtex->tex= NULL;
}
free_material(sp->matcopy);
@@ -769,7 +770,7 @@ static void shader_preview_free(void *customdata)
}
MEM_freeN(sp->matcopy);
}
- if(sp->texcopy) {
+ if (sp->texcopy) {
struct IDProperty *properties;
/* node previews */
shader_preview_updatejob(sp);
@@ -785,7 +786,7 @@ static void shader_preview_free(void *customdata)
}
MEM_freeN(sp->texcopy);
}
- if(sp->worldcopy) {
+ if (sp->worldcopy) {
struct IDProperty *properties;
/* node previews */
shader_preview_updatejob(sp);
@@ -801,7 +802,7 @@ static void shader_preview_free(void *customdata)
}
MEM_freeN(sp->worldcopy);
}
- if(sp->lampcopy) {
+ if (sp->lampcopy) {
struct IDProperty *properties;
/* node previews */
shader_preview_updatejob(sp);
@@ -831,7 +832,7 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned
short ex, ey, dx, dy;
/* paranoia test */
- if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
+ if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
return;
/* waste of cpu cyles... but the imbuf API has no other way to scale fast (ton) */
@@ -858,14 +859,14 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned
IMB_scalefastImBuf(ima, ex, ey);
/* if needed, convert to 32 bits */
- if(ima->rect==NULL)
+ if (ima->rect==NULL)
IMB_rect_from_float(ima);
srect = ima->rect;
drect = rect;
drect+= dy*w+dx;
- for (;ey > 0; ey--){
+ for (;ey > 0; ey--) {
memcpy(drect,srect, ex * sizeof(int));
drect += w;
srect += ima->x;
@@ -878,7 +879,7 @@ static void set_alpha(char *cp, int sizex, int sizey, char alpha)
{
int a, size= sizex*sizey;
- for(a=0; a<size; a++, cp+=4)
+ for (a=0; a<size; a++, cp+=4)
cp[3]= alpha;
}
@@ -888,13 +889,13 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
ID *id= sp->id;
short idtype= GS(id->name);
- if(idtype == ID_IM) {
+ if (idtype == ID_IM) {
Image *ima= (Image*)id;
ImBuf *ibuf= NULL;
ImageUser iuser= {NULL};
/* ima->ok is zero when Image cannot load */
- if(ima==NULL || ima->ok==0)
+ if (ima==NULL || ima->ok==0)
return;
/* setup dummy image user */
@@ -905,21 +906,21 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
* already there. Very expensive for large images. Need to find a way to
* only get existing ibuf */
ibuf = BKE_image_get_ibuf(ima, &iuser);
- if(ibuf==NULL || ibuf->rect==NULL)
+ if (ibuf==NULL || ibuf->rect==NULL)
return;
icon_copy_rect(ibuf, sp->sizex, sp->sizey, sp->pr_rect);
*do_update= 1;
}
- else if(idtype == ID_BR) {
+ else if (idtype == ID_BR) {
Brush *br= (Brush*)id;
br->icon_imbuf= get_brush_icon(br);
memset(sp->pr_rect, 0x888888, sp->sizex*sp->sizey*sizeof(unsigned int));
- if(!(br->icon_imbuf) || !(br->icon_imbuf->rect))
+ if (!(br->icon_imbuf) || !(br->icon_imbuf->rect))
return;
icon_copy_rect(br->icon_imbuf, sp->sizex, sp->sizey, sp->pr_rect);
@@ -932,13 +933,13 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
/* world is rendered with alpha=0, so it wasn't displayed
* this could be render option for sky to, for later */
- if(idtype == ID_WO) {
+ if (idtype == ID_WO) {
set_alpha((char*)sp->pr_rect, sp->sizex, sp->sizey, 255);
}
- else if(idtype == ID_MA) {
+ else if (idtype == ID_MA) {
Material* ma = (Material*)id;
- if(ma->material_type == MA_TYPE_HALO)
+ if (ma->material_type == MA_TYPE_HALO)
set_alpha((char*)sp->pr_rect, sp->sizex, sp->sizey, 255);
}
}
@@ -951,7 +952,7 @@ static void common_preview_startjob(void *customdata, short *stop, short *do_upd
{
ShaderPreview *sp= customdata;
- if(sp->pr_method == PR_ICON_RENDER)
+ if (sp->pr_method == PR_ICON_RENDER)
icon_preview_startjob(customdata, stop, do_update);
else
shader_preview_startjob(customdata, stop, do_update);
@@ -1069,7 +1070,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
sp->id = id;
sp->parent= parent;
sp->slot= slot;
- if(ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
+ if (ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
else sp->col[0]= sp->col[1]= sp->col[2]= sp->col[3]= 1.0f;
/* setup job */
@@ -1083,7 +1084,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
void ED_preview_kill_jobs(const struct bContext *C)
{
wmWindowManager *wm= CTX_wm_manager(C);
- if(wm)
+ if (wm)
WM_jobs_kill(wm, NULL, common_preview_startjob);
}
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 7d7063b621c..59886038db6 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -99,7 +99,7 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= ED_object_context(C);
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
object_add_material_slot(ob);
@@ -112,27 +112,27 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_material_slot_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Material Slot";
- ot->idname= "OBJECT_OT_material_slot_add";
- ot->description="Add a new material slot";
+ ot->name = "Add Material Slot";
+ ot->idname = "OBJECT_OT_material_slot_add";
+ ot->description = "Add a new material slot";
/* api callbacks */
- ot->exec= material_slot_add_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = material_slot_add_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int material_slot_remove_exec(bContext *C, wmOperator *op)
{
Object *ob= ED_object_context(C);
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
/* Removing material slots in edit mode screws things up, see bug #21822.*/
- if(ob == CTX_data_edit_object(C)) {
+ if (ob == CTX_data_edit_object(C)) {
BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode");
return OPERATOR_CANCELLED;
}
@@ -148,54 +148,54 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op)
void OBJECT_OT_material_slot_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Material Slot";
- ot->idname= "OBJECT_OT_material_slot_remove";
- ot->description="Remove the selected material slot";
+ ot->name = "Remove Material Slot";
+ ot->idname = "OBJECT_OT_material_slot_remove";
+ ot->description = "Remove the selected material slot";
/* api callbacks */
- ot->exec= material_slot_remove_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = material_slot_remove_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= ED_object_context(C);
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
- if(ob && ob->actcol>0) {
- if(ob->type == OB_MESH) {
+ if (ob && ob->actcol>0) {
+ if (ob->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(ob);
BMFace *efa;
BMIter iter;
- if(em) {
+ if (em) {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(BM_elem_flag_test(efa, BM_ELEM_SELECT))
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT))
efa->mat_nr= ob->actcol-1;
}
}
}
- else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Nurb *nu;
ListBase *nurbs= curve_editnurbs((Curve*)ob->data);
- if(nurbs) {
- for(nu= nurbs->first; nu; nu= nu->next)
- if(isNurbsel(nu))
+ if (nurbs) {
+ for (nu= nurbs->first; nu; nu= nu->next)
+ if (isNurbsel(nu))
nu->mat_nr= nu->charidx= ob->actcol-1;
}
}
- else if(ob->type == OB_FONT) {
+ else if (ob->type == OB_FONT) {
EditFont *ef= ((Curve*)ob->data)->editfont;
int i, selstart, selend;
- if(ef && BKE_font_getselection(ob, &selstart, &selend)) {
- for(i=selstart; i<=selend; i++)
+ if (ef && BKE_font_getselection(ob, &selstart, &selend)) {
+ for (i=selstart; i<=selend; i++)
ef->textbufinfo[i].mat_nr = ob->actcol;
}
}
@@ -210,29 +210,29 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_material_slot_assign(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Assign Material Slot";
- ot->idname= "OBJECT_OT_material_slot_assign";
- ot->description="Assign the material in the selected material slot to the selected vertices";
+ ot->name = "Assign Material Slot";
+ ot->idname = "OBJECT_OT_material_slot_assign";
+ ot->description = "Assign the material in the selected material slot to the selected vertices";
/* api callbacks */
- ot->exec= material_slot_assign_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->exec = material_slot_assign_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int material_slot_de_select(bContext *C, int select)
{
Object *ob = ED_object_context(C);
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(ob);
- if(em) {
+ if (em) {
EDBM_deselect_by_material(em, ob->actcol-1, select);
}
}
@@ -243,15 +243,15 @@ static int material_slot_de_select(bContext *C, int select)
BezTriple *bezt;
int a;
- if(nurbs) {
- for(nu= nurbs->first; nu; nu=nu->next) {
- if(nu->mat_nr==ob->actcol-1) {
- if(nu->bezt) {
+ if (nurbs) {
+ for (nu= nurbs->first; nu; nu=nu->next) {
+ if (nu->mat_nr==ob->actcol-1) {
+ if (nu->bezt) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
- if(bezt->hide==0) {
- if(select) {
+ while (a--) {
+ if (bezt->hide==0) {
+ if (select) {
bezt->f1 |= SELECT;
bezt->f2 |= SELECT;
bezt->f3 |= SELECT;
@@ -265,12 +265,12 @@ static int material_slot_de_select(bContext *C, int select)
bezt++;
}
}
- else if(nu->bp) {
+ else if (nu->bp) {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
- if(bp->hide==0) {
- if(select) bp->f1 |= SELECT;
+ while (a--) {
+ if (bp->hide==0) {
+ if (select) bp->f1 |= SELECT;
else bp->f1 &= ~SELECT;
}
bp++;
@@ -294,15 +294,15 @@ static int material_slot_select_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_material_slot_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Material Slot";
- ot->idname= "OBJECT_OT_material_slot_select";
- ot->description="Select vertices assigned to the selected material slot";
+ ot->name = "Select Material Slot";
+ ot->idname = "OBJECT_OT_material_slot_select";
+ ot->description = "Select vertices assigned to the selected material slot";
/* api callbacks */
- ot->exec= material_slot_select_exec;
+ ot->exec = material_slot_select_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int material_slot_deselect_exec(bContext *C, wmOperator *UNUSED(op))
@@ -313,15 +313,15 @@ static int material_slot_deselect_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_material_slot_deselect(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Deselect Material Slot";
- ot->idname= "OBJECT_OT_material_slot_deselect";
- ot->description="Deselect vertices assigned to the selected material slot";
+ ot->name = "Deselect Material Slot";
+ ot->idname = "OBJECT_OT_material_slot_deselect";
+ ot->description = "Deselect vertices assigned to the selected material slot";
/* api callbacks */
- ot->exec= material_slot_deselect_exec;
+ ot->exec = material_slot_deselect_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -330,15 +330,15 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= ED_object_context(C);
Material ***matar;
- if(!ob || !(matar= give_matarar(ob)))
+ if (!ob || !(matar= give_matarar(ob)))
return OPERATOR_CANCELLED;
CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
- if(ob != ob_iter && give_matarar(ob_iter)) {
+ if (ob != ob_iter && give_matarar(ob_iter)) {
if (ob->data != ob_iter->data)
assign_matarar(ob_iter, matar, ob->totcol);
- if(ob_iter->totcol==ob->totcol) {
+ if (ob_iter->totcol==ob->totcol) {
ob_iter->actcol= ob->actcol;
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob_iter);
}
@@ -353,15 +353,15 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_material_slot_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Material to Others";
- ot->idname= "OBJECT_OT_material_slot_copy";
- ot->description="Copies materials to other selected objects";
+ ot->name = "Copy Material to Others";
+ ot->idname = "OBJECT_OT_material_slot_copy";
+ ot->description = "Copies materials to other selected objects";
/* api callbacks */
- ot->exec= material_slot_copy_exec;
+ ot->exec = material_slot_copy_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** new material operator *********************/
@@ -374,13 +374,13 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
PropertyRNA *prop;
/* add or copy material */
- if(ma) {
+ if (ma) {
ma= copy_material(ma);
}
else {
ma= add_material("Material");
- if(scene_use_new_shading_nodes(scene)) {
+ if (scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(scene, &ma->id);
ma->use_nodes= 1;
}
@@ -389,7 +389,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
- if(prop) {
+ if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
ma->id.us--;
@@ -407,15 +407,15 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
void MATERIAL_OT_new(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "New Material";
- ot->idname= "MATERIAL_OT_new";
- ot->description="Add a new material";
+ ot->name = "New Material";
+ ot->idname = "MATERIAL_OT_new";
+ ot->description = "Add a new material";
/* api callbacks */
- ot->exec= new_material_exec;
+ ot->exec = new_material_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** new texture operator *********************/
@@ -427,7 +427,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
PropertyRNA *prop;
/* add or copy texture */
- if(tex)
+ if (tex)
tex= copy_texture(tex);
else
tex= add_texture("Texture");
@@ -435,7 +435,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
- if(prop) {
+ if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
tex->id.us--;
@@ -453,15 +453,15 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
void TEXTURE_OT_new(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "New Texture";
- ot->idname= "TEXTURE_OT_new";
- ot->description="Add a new texture";
+ ot->name = "New Texture";
+ ot->idname = "TEXTURE_OT_new";
+ ot->description = "Add a new texture";
/* api callbacks */
- ot->exec= new_texture_exec;
+ ot->exec = new_texture_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** new world operator *********************/
@@ -474,13 +474,13 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
PropertyRNA *prop;
/* add or copy world */
- if(wo) {
+ if (wo) {
wo= copy_world(wo);
}
else {
wo= add_world("World");
- if(scene_use_new_shading_nodes(scene)) {
+ if (scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(scene, &wo->id);
wo->use_nodes= 1;
}
@@ -489,7 +489,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
- if(prop) {
+ if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
wo->id.us--;
@@ -507,15 +507,15 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
void WORLD_OT_new(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "New World";
- ot->idname= "WORLD_OT_new";
- ot->description= "Add a new world";
+ ot->name = "New World";
+ ot->idname = "WORLD_OT_new";
+ ot->description = "Add a new world";
/* api callbacks */
- ot->exec= new_world_exec;
+ ot->exec = new_world_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** render layer operators *********************/
@@ -535,15 +535,15 @@ static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op))
void SCENE_OT_render_layer_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Render Layer";
- ot->idname= "SCENE_OT_render_layer_add";
- ot->description="Add a render layer";
+ ot->name = "Add Render Layer";
+ ot->idname = "SCENE_OT_render_layer_add";
+ ot->description = "Add a render layer";
/* api callbacks */
- ot->exec= render_layer_add_exec;
+ ot->exec = render_layer_add_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
@@ -551,7 +551,7 @@ static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene = CTX_data_scene(C);
SceneRenderLayer *rl = BLI_findlink(&scene->r.layers, scene->r.actlay);
- if(!scene_remove_render_layer(CTX_data_main(C), scene, rl))
+ if (!scene_remove_render_layer(CTX_data_main(C), scene, rl))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
@@ -562,15 +562,15 @@ static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
void SCENE_OT_render_layer_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Render Layer";
- ot->idname= "SCENE_OT_render_layer_remove";
- ot->description="Remove the selected render layer";
+ ot->name = "Remove Render Layer";
+ ot->idname = "SCENE_OT_render_layer_remove";
+ ot->description = "Remove the selected render layer";
/* api callbacks */
- ot->exec= render_layer_remove_exec;
+ ot->exec = render_layer_remove_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int freestyle_module_add_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1137,7 +1137,7 @@ static int texture_slot_move(bContext *C, wmOperator *op)
{
ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
- if(id) {
+ if (id) {
MTex **mtex_ar, *mtexswap;
short act;
int type= RNA_enum_get(op->ptr, "type");
@@ -1145,8 +1145,8 @@ static int texture_slot_move(bContext *C, wmOperator *op)
give_active_mtex(id, &mtex_ar, &act);
- if(type == -1) { /* Up */
- if(act > 0) {
+ if (type == -1) { /* Up */
+ if (act > 0) {
mtexswap = mtex_ar[act];
mtex_ar[act] = mtex_ar[act-1];
mtex_ar[act-1] = mtexswap;
@@ -1155,7 +1155,7 @@ static int texture_slot_move(bContext *C, wmOperator *op)
BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, act, act-1, 0);
BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, -1, act, 0);
- if(GS(id->name)==ID_MA) {
+ if (GS(id->name)==ID_MA) {
Material *ma= (Material *)id;
int mtexuse = ma->septex & (1<<act);
ma->septex &= ~(1<<act);
@@ -1168,7 +1168,7 @@ static int texture_slot_move(bContext *C, wmOperator *op)
}
}
else { /* Down */
- if(act < MAX_MTEX-1) {
+ if (act < MAX_MTEX-1) {
mtexswap = mtex_ar[act];
mtex_ar[act] = mtex_ar[act+1];
mtex_ar[act+1] = mtexswap;
@@ -1177,7 +1177,7 @@ static int texture_slot_move(bContext *C, wmOperator *op)
BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, act, act+1, 0);
BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, -1, act, 0);
- if(GS(id->name)==ID_MA) {
+ if (GS(id->name)==ID_MA) {
Material *ma= (Material *)id;
int mtexuse = ma->septex & (1<<act);
ma->septex &= ~(1<<act);
@@ -1206,15 +1206,15 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Move Texture Slot";
- ot->idname= "TEXTURE_OT_slot_move";
- ot->description="Move texture slots up and down";
+ ot->name = "Move Texture Slot";
+ ot->idname = "TEXTURE_OT_slot_move";
+ ot->description = "Move texture slots up and down";
/* api callbacks */
- ot->exec= texture_slot_move;
+ ot->exec = texture_slot_move;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", slot_move, 0, "Type", "");
}
@@ -1250,7 +1250,7 @@ static int envmap_save_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
- if(scene->r.scemode & R_EXTENSION) {
+ if (scene->r.scemode & R_EXTENSION) {
BKE_add_image_extension(path, imtype);
}
@@ -1269,7 +1269,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
{
//Scene *scene= CTX_data_scene(C);
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return envmap_save_exec(C, op);
//RNA_enum_set(op->ptr, "file_type", scene->r.im_format.imtype);
@@ -1297,17 +1297,17 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot)
{
PropertyRNA *prop;
/* identifiers */
- ot->name= "Save Environment Map";
- ot->idname= "TEXTURE_OT_envmap_save";
- ot->description="Save the current generated Environment map to an image file";
+ ot->name = "Save Environment Map";
+ ot->idname = "TEXTURE_OT_envmap_save";
+ ot->description = "Save the current generated Environment map to an image file";
/* api callbacks */
- ot->exec= envmap_save_exec;
- ot->invoke= envmap_save_invoke;
- ot->poll= envmap_save_poll;
+ ot->exec = envmap_save_exec;
+ ot->invoke = envmap_save_invoke;
+ ot->poll = envmap_save_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER; /* no undo since this doesnt modify the env-map */
+ ot->flag = OPTYPE_REGISTER; /* no undo since this doesnt modify the env-map */
/* properties */
prop= RNA_def_float_array(ot->srna, "layout", 12, default_envmap_layout, 0.0f, 0.0f, "File layout", "Flat array describing the X,Y position of each cube face in the output image, where 1 is the size of a face - order is [+Z -Z +Y -X -Y +X] (use -1 to skip a face)", 0.0f, 0.0f);
@@ -1344,16 +1344,16 @@ static int envmap_clear_poll(bContext *C)
void TEXTURE_OT_envmap_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Environment Map";
- ot->idname= "TEXTURE_OT_envmap_clear";
- ot->description="Discard the environment map and free it from memory";
+ ot->name = "Clear Environment Map";
+ ot->idname = "TEXTURE_OT_envmap_clear";
+ ot->description = "Discard the environment map and free it from memory";
/* api callbacks */
- ot->exec= envmap_clear_exec;
- ot->poll= envmap_clear_poll;
+ ot->exec = envmap_clear_exec;
+ ot->poll = envmap_clear_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1373,16 +1373,16 @@ static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op))
void TEXTURE_OT_envmap_clear_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear All Environment Maps";
- ot->idname= "TEXTURE_OT_envmap_clear_all";
- ot->description="Discard all environment maps in the .blend file and free them from memory";
+ ot->name = "Clear All Environment Maps";
+ ot->idname = "TEXTURE_OT_envmap_clear_all";
+ ot->description = "Discard all environment maps in the .blend file and free them from memory";
/* api callbacks */
- ot->exec= envmap_clear_all_exec;
- ot->poll= envmap_clear_poll;
+ ot->exec = envmap_clear_all_exec;
+ ot->poll = envmap_clear_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** material operators *********************/
@@ -1392,7 +1392,7 @@ static int copy_material_exec(bContext *C, wmOperator *UNUSED(op))
{
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
- if(ma==NULL)
+ if (ma==NULL)
return OPERATOR_CANCELLED;
copy_matcopybuf(ma);
@@ -1403,22 +1403,22 @@ static int copy_material_exec(bContext *C, wmOperator *UNUSED(op))
void MATERIAL_OT_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Material";
- ot->idname= "MATERIAL_OT_copy";
- ot->description="Copy the material settings and nodes";
+ ot->name = "Copy Material";
+ ot->idname = "MATERIAL_OT_copy";
+ ot->description = "Copy the material settings and nodes";
/* api callbacks */
- ot->exec= copy_material_exec;
+ ot->exec = copy_material_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER; /* no undo needed since no changes are made to the material */
+ ot->flag = OPTYPE_REGISTER; /* no undo needed since no changes are made to the material */
}
static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
{
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
- if(ma==NULL)
+ if (ma==NULL)
return OPERATOR_CANCELLED;
paste_matcopybuf(ma);
@@ -1431,15 +1431,15 @@ static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
void MATERIAL_OT_paste(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste Material";
- ot->idname= "MATERIAL_OT_paste";
- ot->description="Paste the material settings and nodes";
+ ot->name = "Paste Material";
+ ot->idname = "MATERIAL_OT_paste";
+ ot->description = "Paste the material settings and nodes";
/* api callbacks */
- ot->exec= paste_material_exec;
+ ot->exec = paste_material_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1472,7 +1472,7 @@ static void copy_mtex_copybuf(ID *id)
break;
}
- if(mtex && *mtex) {
+ if (mtex && *mtex) {
memcpy(&mtexcopybuf, *mtex, sizeof(MTex));
mtexcopied= 1;
}
@@ -1485,7 +1485,7 @@ static void paste_mtex_copybuf(ID *id)
{
MTex **mtex= NULL;
- if(mtexcopied == 0 || mtexcopybuf.tex==NULL)
+ if (mtexcopied == 0 || mtexcopybuf.tex==NULL)
return;
switch(GS(id->name)) {
@@ -1508,11 +1508,11 @@ static void paste_mtex_copybuf(ID *id)
return;
}
- if(mtex) {
- if(*mtex==NULL) {
+ if (mtex) {
+ if (*mtex==NULL) {
*mtex= MEM_mallocN(sizeof(MTex), "mtex copy");
}
- else if((*mtex)->tex) {
+ else if ((*mtex)->tex) {
(*mtex)->tex->id.us--;
}
@@ -1527,7 +1527,7 @@ static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op))
{
ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
- if(id==NULL) {
+ if (id==NULL) {
/* copying empty slot */
ED_render_clear_mtex_copybuf();
return OPERATOR_CANCELLED;
@@ -1548,23 +1548,23 @@ static int copy_mtex_poll(bContext *C)
void TEXTURE_OT_slot_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Texture Slot Settings";
- ot->idname= "TEXTURE_OT_slot_copy";
- ot->description="Copy the material texture settings and nodes";
+ ot->name = "Copy Texture Slot Settings";
+ ot->idname = "TEXTURE_OT_slot_copy";
+ ot->description = "Copy the material texture settings and nodes";
/* api callbacks */
- ot->exec= copy_mtex_exec;
- ot->poll= copy_mtex_poll;
+ ot->exec = copy_mtex_exec;
+ ot->poll = copy_mtex_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER; /* no undo needed since no changes are made to the mtex */
+ ot->flag = OPTYPE_REGISTER; /* no undo needed since no changes are made to the mtex */
}
static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
{
ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
- if(id==NULL) {
+ if (id==NULL) {
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
Lamp *la= CTX_data_pointer_get_type(C, "lamp", &RNA_Lamp).data;
World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data;
@@ -1593,14 +1593,14 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
void TEXTURE_OT_slot_paste(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste Texture Slot Settings";
- ot->idname= "TEXTURE_OT_slot_paste";
- ot->description="Copy the texture settings and nodes";
+ ot->name = "Paste Texture Slot Settings";
+ ot->idname = "TEXTURE_OT_slot_paste";
+ ot->description = "Copy the texture settings and nodes";
/* api callbacks */
- ot->exec= paste_mtex_exec;
+ ot->exec = paste_mtex_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index 4483d7d8ba1..72b29c56811 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -77,7 +77,7 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated)
/* don't do this render engine update if we're updating the scene from
* other threads doing e.g. rendering or baking jobs */
- if(!BLI_thread_is_main())
+ if (!BLI_thread_is_main())
return;
C= CTX_create();
@@ -86,22 +86,22 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated)
CTX_wm_manager_set(C, bmain->wm.first);
- for(sc=bmain->screen.first; sc; sc=sc->id.next) {
- for(sa=sc->areabase.first; sa; sa=sa->next) {
- if(sa->spacetype != SPACE_VIEW3D)
+ for (sc=bmain->screen.first; sc; sc=sc->id.next) {
+ for (sa=sc->areabase.first; sa; sa=sa->next) {
+ if (sa->spacetype != SPACE_VIEW3D)
continue;
- for(ar=sa->regionbase.first; ar; ar=ar->next) {
+ for (ar=sa->regionbase.first; ar; ar=ar->next) {
RegionView3D *rv3d;
RenderEngine *engine;
- if(ar->regiontype != RGN_TYPE_WINDOW)
+ if (ar->regiontype != RGN_TYPE_WINDOW)
continue;
rv3d= ar->regiondata;
engine= rv3d->render_engine;
- if(engine && (updated || (engine->flag & RE_ENGINE_DO_UPDATE))) {
+ if (engine && (updated || (engine->flag & RE_ENGINE_DO_UPDATE))) {
CTX_wm_screen_set(C, sc);
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
@@ -123,20 +123,20 @@ void ED_render_engine_changed(Main *bmain)
ScrArea *sa;
ARegion *ar;
- for(sc=bmain->screen.first; sc; sc=sc->id.next) {
- for(sa=sc->areabase.first; sa; sa=sa->next) {
- if(sa->spacetype != SPACE_VIEW3D)
+ for (sc=bmain->screen.first; sc; sc=sc->id.next) {
+ for (sa=sc->areabase.first; sa; sa=sa->next) {
+ if (sa->spacetype != SPACE_VIEW3D)
continue;
- for(ar=sa->regionbase.first; ar; ar=ar->next) {
+ for (ar=sa->regionbase.first; ar; ar=ar->next) {
RegionView3D *rv3d;
- if(ar->regiontype != RGN_TYPE_WINDOW)
+ if (ar->regiontype != RGN_TYPE_WINDOW)
continue;
rv3d= ar->regiondata;
- if(rv3d->render_engine) {
+ if (rv3d->render_engine) {
RE_engine_free(rv3d->render_engine);
rv3d->render_engine= NULL;
}
@@ -154,11 +154,11 @@ static int mtex_use_tex(MTex **mtex, int tot, Tex *tex)
{
int a;
- if(!mtex)
+ if (!mtex)
return 0;
- for(a=0; a<tot; a++)
- if(mtex[a] && mtex[a]->tex == tex)
+ for (a=0; a<tot; a++)
+ if (mtex[a] && mtex[a]->tex == tex)
return 1;
return 0;
@@ -168,17 +168,17 @@ static int nodes_use_tex(bNodeTree *ntree, Tex *tex)
{
bNode *node;
- for(node=ntree->nodes.first; node; node= node->next) {
- if(node->id) {
- if(node->id == (ID*)tex) {
+ for (node=ntree->nodes.first; node; node= node->next) {
+ if (node->id) {
+ if (node->id == (ID*)tex) {
return 1;
}
- else if(GS(node->id->name) == ID_MA) {
- if(mtex_use_tex(((Material*)node->id)->mtex, MAX_MTEX, tex))
+ else if (GS(node->id->name) == ID_MA) {
+ if (mtex_use_tex(((Material*)node->id)->mtex, MAX_MTEX, tex))
return 1;
}
- else if(node->type==NODE_GROUP) {
- if(nodes_use_tex((bNodeTree *)node->id, tex))
+ else if (node->type==NODE_GROUP) {
+ if (nodes_use_tex((bNodeTree *)node->id, tex))
return 1;
}
}
@@ -191,13 +191,13 @@ static int nodes_use_material(bNodeTree *ntree, Material *ma)
{
bNode *node;
- for(node=ntree->nodes.first; node; node= node->next) {
- if(node->id) {
- if(node->id == (ID*)ma) {
+ for (node=ntree->nodes.first; node; node= node->next) {
+ if (node->id) {
+ if (node->id == (ID*)ma) {
return 1;
}
- else if(node->type==NODE_GROUP) {
- if(nodes_use_material((bNodeTree *)node->id, ma))
+ else if (node->type==NODE_GROUP) {
+ if (nodes_use_material((bNodeTree *)node->id, ma))
return 1;
}
}
@@ -214,17 +214,17 @@ static void material_changed(Main *bmain, Material *ma)
BKE_icon_changed(BKE_icon_getid(&ma->id));
/* glsl */
- if(ma->gpumaterial.first)
+ if (ma->gpumaterial.first)
GPU_material_free(ma);
/* find node materials using this */
- for(parent=bmain->mat.first; parent; parent=parent->id.next) {
- if(parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma));
+ for (parent=bmain->mat.first; parent; parent=parent->id.next) {
+ if (parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma));
else continue;
BKE_icon_changed(BKE_icon_getid(&parent->id));
- if(parent->gpumaterial.first)
+ if (parent->gpumaterial.first)
GPU_material_free(parent);
}
}
@@ -241,40 +241,40 @@ static void texture_changed(Main *bmain, Tex *tex)
BKE_icon_changed(BKE_icon_getid(&tex->id));
/* find materials */
- for(ma=bmain->mat.first; ma; ma=ma->id.next) {
- if(mtex_use_tex(ma->mtex, MAX_MTEX, tex));
- else if(ma->use_nodes && ma->nodetree && nodes_use_tex(ma->nodetree, tex));
+ for (ma=bmain->mat.first; ma; ma=ma->id.next) {
+ if (mtex_use_tex(ma->mtex, MAX_MTEX, tex));
+ else if (ma->use_nodes && ma->nodetree && nodes_use_tex(ma->nodetree, tex));
else continue;
BKE_icon_changed(BKE_icon_getid(&ma->id));
- if(ma->gpumaterial.first)
+ if (ma->gpumaterial.first)
GPU_material_free(ma);
}
/* find lamps */
- for(la=bmain->lamp.first; la; la=la->id.next) {
- if(mtex_use_tex(la->mtex, MAX_MTEX, tex));
- else if(la->nodetree && nodes_use_tex(la->nodetree, tex));
+ for (la=bmain->lamp.first; la; la=la->id.next) {
+ if (mtex_use_tex(la->mtex, MAX_MTEX, tex));
+ else if (la->nodetree && nodes_use_tex(la->nodetree, tex));
else continue;
BKE_icon_changed(BKE_icon_getid(&la->id));
}
/* find worlds */
- for(wo=bmain->world.first; wo; wo=wo->id.next) {
- if(mtex_use_tex(wo->mtex, MAX_MTEX, tex));
- else if(wo->nodetree && nodes_use_tex(wo->nodetree, tex));
+ for (wo=bmain->world.first; wo; wo=wo->id.next) {
+ if (mtex_use_tex(wo->mtex, MAX_MTEX, tex));
+ else if (wo->nodetree && nodes_use_tex(wo->nodetree, tex));
else continue;
BKE_icon_changed(BKE_icon_getid(&wo->id));
}
/* find compositing nodes */
- for(scene=bmain->scene.first; scene; scene=scene->id.next) {
- if(scene->use_nodes && scene->nodetree) {
- for(node=scene->nodetree->nodes.first; node; node=node->next) {
- if(node->id == &tex->id)
+ for (scene=bmain->scene.first; scene; scene=scene->id.next) {
+ if (scene->use_nodes && scene->nodetree) {
+ for (node=scene->nodetree->nodes.first; node; node=node->next) {
+ if (node->id == &tex->id)
ED_node_changed_update(&scene->id, node);
}
}
@@ -290,12 +290,12 @@ static void lamp_changed(Main *bmain, Lamp *la)
BKE_icon_changed(BKE_icon_getid(&la->id));
/* glsl */
- for(ob=bmain->object.first; ob; ob=ob->id.next)
- if(ob->data == la && ob->gpulamp.first)
+ for (ob=bmain->object.first; ob; ob=ob->id.next)
+ if (ob->data == la && ob->gpulamp.first)
GPU_lamp_free(ob);
- for(ma=bmain->mat.first; ma; ma=ma->id.next)
- if(ma->gpumaterial.first)
+ for (ma=bmain->mat.first; ma; ma=ma->id.next)
+ if (ma->gpumaterial.first)
GPU_material_free(ma);
}
@@ -307,8 +307,8 @@ static void world_changed(Main *bmain, World *wo)
BKE_icon_changed(BKE_icon_getid(&wo->id));
/* glsl */
- for(ma=bmain->mat.first; ma; ma=ma->id.next)
- if(ma->gpumaterial.first)
+ for (ma=bmain->mat.first; ma; ma=ma->id.next)
+ if (ma->gpumaterial.first)
GPU_material_free(ma);
}
@@ -320,8 +320,8 @@ static void image_changed(Main *bmain, Image *ima)
BKE_icon_changed(BKE_icon_getid(&ima->id));
/* textures */
- for(tex=bmain->tex.first; tex; tex=tex->id.next)
- if(tex->ima == ima)
+ for (tex=bmain->tex.first; tex; tex=tex->id.next)
+ if (tex->ima == ima)
texture_changed(bmain, tex);
}
@@ -331,12 +331,12 @@ static void scene_changed(Main *bmain, Scene *UNUSED(scene))
Material *ma;
/* glsl */
- for(ob=bmain->object.first; ob; ob=ob->id.next)
- if(ob->gpulamp.first)
+ for (ob=bmain->object.first; ob; ob=ob->id.next)
+ if (ob->gpulamp.first)
GPU_lamp_free(ob);
- for(ma=bmain->mat.first; ma; ma=ma->id.next)
- if(ma->gpumaterial.first)
+ for (ma=bmain->mat.first; ma; ma=ma->id.next)
+ if (ma->gpumaterial.first)
GPU_material_free(ma);
}
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index 8850bef286d..31b53fcabe1 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -66,16 +66,16 @@ static ScrArea *biggest_non_image_area(bContext *C)
int size, maxsize= 0, bwmaxsize= 0;
short foundwin= 0;
- for(sa= sc->areabase.first; sa; sa= sa->next) {
- if(sa->winx > 30 && sa->winy > 30) {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ if (sa->winx > 30 && sa->winy > 30) {
size= sa->winx*sa->winy;
- if(sa->spacetype == SPACE_BUTS) {
- if(foundwin == 0 && size > bwmaxsize) {
+ if (sa->spacetype == SPACE_BUTS) {
+ if (foundwin == 0 && size > bwmaxsize) {
bwmaxsize= size;
big= sa;
}
}
- else if(sa->spacetype != SPACE_IMAGE && size > maxsize) {
+ else if (sa->spacetype != SPACE_IMAGE && size > maxsize) {
maxsize= size;
big= sa;
foundwin= 1;
@@ -93,15 +93,15 @@ static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win)
SpaceImage *sima;
/* find an imagewindow showing render result */
- for(*win=wm->windows.first; *win; *win= (*win)->next) {
- for(sa= (*win)->screen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_IMAGE) {
+ for (*win=wm->windows.first; *win; *win= (*win)->next) {
+ for (sa= (*win)->screen->areabase.first; sa; sa= sa->next) {
+ if (sa->spacetype==SPACE_IMAGE) {
sima= sa->spacedata.first;
- if(sima->image && sima->image->type==IMA_TYPE_R_RESULT)
+ if (sima->image && sima->image->type==IMA_TYPE_R_RESULT)
break;
}
}
- if(sa)
+ if (sa)
break;
}
@@ -115,10 +115,10 @@ static ScrArea *find_area_image_empty(bContext *C)
SpaceImage *sima;
/* find an imagewindow showing render result */
- for(sa=sc->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_IMAGE) {
+ for (sa=sc->areabase.first; sa; sa= sa->next) {
+ if (sa->spacetype==SPACE_IMAGE) {
sima= sa->spacedata.first;
- if(!sima->image)
+ if (!sima->image)
break;
}
}
@@ -137,10 +137,10 @@ void render_view_open(bContext *C, int mx, int my)
SpaceImage *sima;
int area_was_image=0;
- if(scene->r.displaymode==R_OUTPUT_NONE)
+ if (scene->r.displaymode==R_OUTPUT_NONE)
return;
- if(scene->r.displaymode==R_OUTPUT_WINDOW) {
+ if (scene->r.displaymode==R_OUTPUT_WINDOW) {
rcti rect;
int sizex, sizey;
@@ -148,21 +148,21 @@ void render_view_open(bContext *C, int mx, int my)
sizey= 40 + (scene->r.ysch*scene->r.size)/100;
/* arbitrary... miniature image window views don't make much sense */
- if(sizex < 320) sizex= 320;
- if(sizey < 256) sizey= 256;
+ if (sizex < 320) sizex= 320;
+ if (sizey < 256) sizey= 256;
/* XXX some magic to calculate postition */
- rect.xmin= mx + win->posx - sizex/2;
- rect.ymin= my + win->posy - sizey/2;
- rect.xmax= rect.xmin + sizex;
- rect.ymax= rect.ymin + sizey;
+ rect.xmin = mx + win->posx - sizex/2;
+ rect.ymin = my + win->posy - sizey/2;
+ rect.xmax = rect.xmin + sizex;
+ rect.ymax = rect.ymin + sizey;
/* changes context! */
WM_window_open_temp(C, &rect, WM_WINDOW_RENDER);
sa= CTX_wm_area(C);
}
- else if(scene->r.displaymode==R_OUTPUT_SCREEN) {
+ else if (scene->r.displaymode==R_OUTPUT_SCREEN) {
if (CTX_wm_area(C) && CTX_wm_area(C)->spacetype == SPACE_IMAGE)
area_was_image = 1;
@@ -170,19 +170,19 @@ void render_view_open(bContext *C, int mx, int my)
sa= ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE);
}
- if(!sa) {
+ if (!sa) {
sa= find_area_showing_r_result(C, &win);
- if(sa==NULL)
+ if (sa==NULL)
sa= find_area_image_empty(C);
/* if area found in other window, we make that one show in front */
- if(win && win!=CTX_wm_window(C))
+ if (win && win!=CTX_wm_window(C))
wm_window_raise(win);
- if(sa==NULL) {
+ if (sa==NULL) {
/* find largest open non-image area */
sa= biggest_non_image_area(C);
- if(sa) {
+ if (sa) {
ED_area_newspace(C, sa, SPACE_IMAGE);
sima= sa->spacedata.first;
@@ -192,7 +192,7 @@ void render_view_open(bContext *C, int mx, int my)
else {
/* use any area of decent size */
sa= BKE_screen_find_big_area(CTX_wm_screen(C), -1, 0);
- if(sa->spacetype!=SPACE_IMAGE) {
+ if (sa->spacetype!=SPACE_IMAGE) {
// XXX newspace(sa, SPACE_IMAGE);
sima= sa->spacedata.first;
@@ -210,7 +210,7 @@ void render_view_open(bContext *C, int mx, int my)
/* if we're rendering to full screen, set appropriate hints on image editor
* so it can restore properly on pressing esc */
- if(sa->full) {
+ if (sa->full) {
sima->flag |= SI_FULLWINDOW;
/* Tell the image editor to revert to previous space in space list on close
@@ -234,15 +234,15 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
SpaceImage *sima= sa->spacedata.first;
/* test if we have a temp screen in front */
- if(CTX_wm_window(C)->screen->temp) {
+ if (CTX_wm_window(C)->screen->temp) {
wm_window_lower(CTX_wm_window(C));
return OPERATOR_FINISHED;
}
/* determine if render already shows */
- else if(sima->flag & SI_PREVSPACE) {
+ else if (sima->flag & SI_PREVSPACE) {
sima->flag &= ~SI_PREVSPACE;
- if(sima->flag & SI_FULLWINDOW) {
+ if (sima->flag & SI_FULLWINDOW) {
sima->flag &= ~SI_FULLWINDOW;
ED_screen_full_prevspace(C, sa);
}
@@ -251,7 +251,7 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
- else if(sima->flag & SI_FULLWINDOW) {
+ else if (sima->flag & SI_FULLWINDOW) {
sima->flag &= ~SI_FULLWINDOW;
ED_screen_full_toggle(C, win, sa);
return OPERATOR_FINISHED;
@@ -263,13 +263,13 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
void RENDER_OT_view_cancel(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Cancel Render View";
- ot->description= "Cancel show render view";
- ot->idname= "RENDER_OT_view_cancel";
+ ot->name = "Cancel Render View";
+ ot->description = "Cancel show render view";
+ ot->idname = "RENDER_OT_view_cancel";
/* api callbacks */
- ot->exec= render_view_cancel_exec;
- ot->poll= ED_operator_image_active;
+ ot->exec = render_view_cancel_exec;
+ ot->poll = ED_operator_image_active;
}
/************************* show render viewer *****************/
@@ -279,7 +279,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
wmWindow *wincur = CTX_wm_window(C);
/* test if we have currently a temp screen active */
- if(wincur->screen->temp) {
+ if (wincur->screen->temp) {
wm_window_lower(wincur);
}
else {
@@ -287,30 +287,30 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
ScrArea *sa= find_area_showing_r_result(C, &winshow);
/* is there another window showing result? */
- for(win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
- if(win->screen->temp || (win==winshow && winshow!=wincur)) {
+ for (win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
+ if (win->screen->temp || (win==winshow && winshow!=wincur)) {
wm_window_raise(win);
return OPERATOR_FINISHED;
}
}
/* determine if render already shows */
- if(sa) {
+ if (sa) {
/* but don't close it when rendering */
- if(!G.rendering) {
+ if (!G.rendering) {
SpaceImage *sima= sa->spacedata.first;
- if(sima->flag & SI_PREVSPACE) {
+ if (sima->flag & SI_PREVSPACE) {
sima->flag &= ~SI_PREVSPACE;
- if(sima->flag & SI_FULLWINDOW) {
+ if (sima->flag & SI_FULLWINDOW) {
sima->flag &= ~SI_FULLWINDOW;
ED_screen_full_prevspace(C, sa);
}
- else if(sima->next) {
+ else if (sima->next) {
/* workaround for case of double prevspace, render window
* with a file browser on top of it (same as in ED_area_prevspace) */
- if(sima->next->spacetype == SPACE_FILE && sima->next->next)
+ if (sima->next->spacetype == SPACE_FILE && sima->next->next)
ED_area_newspace(C, sa, sima->next->next->spacetype);
else
ED_area_newspace(C, sa, sima->next->spacetype);
@@ -330,12 +330,12 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
void RENDER_OT_view_show(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Show/Hide Render View";
- ot->description= "Toggle show render view";
- ot->idname= "RENDER_OT_view_show";
+ ot->name = "Show/Hide Render View";
+ ot->description = "Toggle show render view";
+ ot->idname = "RENDER_OT_view_show";
/* api callbacks */
- ot->invoke= render_view_show_invoke;
- ot->poll= ED_operator_screenactive;
+ ot->invoke = render_view_show_invoke;
+ ot->poll = ED_operator_screenactive;
}
diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt
index 79a805cfa6e..33373354aa4 100644
--- a/source/blender/editors/screen/CMakeLists.txt
+++ b/source/blender/editors/screen/CMakeLists.txt
@@ -47,4 +47,8 @@ set(SRC
screen_intern.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_screen "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/screen/SConscript b/source/blender/editors/screen/SConscript
index ade26a0b80f..038a86328a3 100644
--- a/source/blender/editors/screen/SConscript
+++ b/source/blender/editors/screen/SConscript
@@ -8,7 +8,7 @@ incs += ' ../../blenloader ../../windowmanager ../../makesrna ../../gpu'
incs += ' ../../render/extern/include ../../bmesh'
incs += ' #/intern/guardedalloc #/extern/glew/include'
-defs = ''
+defs = []
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
@@ -17,4 +17,7 @@ if env['OURPLATFORM'] == 'linux':
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
env.BlenderLib ( 'bf_editors_screen', sources, Split(incs), Split(defs), libtype=['core'], priority=[105] )
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 57b65ad5223..8f429321fbb 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -74,10 +74,10 @@ static void region_draw_emboss(ARegion *ar, rcti *scirct)
rcti rect;
/* translate scissor rect to region space */
- rect.xmin= scirct->xmin - ar->winrct.xmin;
- rect.ymin= scirct->ymin - ar->winrct.ymin;
- rect.xmax= scirct->xmax - ar->winrct.xmin;
- rect.ymax= scirct->ymax - ar->winrct.ymin;
+ rect.xmin = scirct->xmin - ar->winrct.xmin;
+ rect.ymin = scirct->ymin - ar->winrct.ymin;
+ rect.xmax = scirct->xmax - ar->winrct.xmin;
+ rect.ymax = scirct->ymax - ar->winrct.ymin;
/* set transp line */
glEnable( GL_BLEND );
@@ -117,7 +117,7 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
/* generic notes first */
switch(note->category) {
case NC_WM:
- if(note->data==ND_FILEREAD)
+ if (note->data==ND_FILEREAD)
ED_region_tag_redraw(ar);
break;
case NC_WINDOW:
@@ -125,7 +125,7 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
break;
}
- if(ar->type && ar->type->listener)
+ if (ar->type && ar->type->listener)
ar->type->listener(ar, note);
}
@@ -133,7 +133,7 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
void ED_area_do_listen(ScrArea *sa, wmNotifier *note)
{
/* no generic notes? */
- if(sa->type && sa->type->listener) {
+ if (sa->type && sa->type->listener) {
sa->type->listener(sa, note);
}
}
@@ -142,7 +142,7 @@ void ED_area_do_listen(ScrArea *sa, wmNotifier *note)
void ED_area_do_refresh(bContext *C, ScrArea *sa)
{
/* no generic notes? */
- if(sa->type && sa->type->refresh) {
+ if (sa->type && sa->type->refresh) {
sa->type->refresh(C, sa);
}
sa->do_refresh= 0;
@@ -154,14 +154,14 @@ void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar)
{
AZone *az;
- for(az= sa->actionzones.first; az; az= az->next) {
+ for (az= sa->actionzones.first; az; az= az->next) {
int xs, ys;
xs= (az->x1+az->x2)/2;
ys= (az->y1+az->y2)/2;
/* test if inside */
- if(BLI_in_rcti(&ar->winrct, xs, ys)) {
+ if (BLI_in_rcti(&ar->winrct, xs, ys)) {
az->do_draw= 1;
}
}
@@ -360,22 +360,23 @@ void ED_area_overdraw(bContext *C)
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
- for(sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
AZone *az;
- for(az= sa->actionzones.first; az; az= az->next) {
- if(az->do_draw) {
- if(az->type==AZONE_AREA) {
+ for (az= sa->actionzones.first; az; az= az->next) {
+ if (az->do_draw) {
+ if (az->type==AZONE_AREA) {
area_draw_azone(az->x1, az->y1, az->x2, az->y2);
- } else if(az->type==AZONE_REGION) {
+ }
+ else if (az->type==AZONE_REGION) {
- if(az->ar) {
+ if (az->ar) {
/* only display tab or icons when the region is hidden */
if (az->ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
- if(G.rt==3)
+ if (G.rt==3)
region_draw_azone_icon(az);
- else if(G.rt==2)
+ else if (G.rt==2)
region_draw_azone_tria(az);
- else if(G.rt==1)
+ else if (G.rt==1)
region_draw_azone_tab(az);
else
region_draw_azone_tab_plus(az);
@@ -396,20 +397,20 @@ void region_scissor_winrct(ARegion *ar, rcti *winrct)
{
*winrct= ar->winrct;
- if(ELEM(ar->alignment, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT))
+ if (ELEM(ar->alignment, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT))
return;
- while(ar->prev) {
+ while (ar->prev) {
ar= ar->prev;
- if(BLI_isect_rcti(winrct, &ar->winrct, NULL)) {
- if(ar->flag & RGN_FLAG_HIDDEN);
- else if(ar->alignment & RGN_SPLIT_PREV);
- else if(ar->alignment==RGN_OVERLAP_LEFT) {
- winrct->xmin= ar->winrct.xmax + 1;
+ if (BLI_isect_rcti(winrct, &ar->winrct, NULL)) {
+ if (ar->flag & RGN_FLAG_HIDDEN);
+ else if (ar->alignment & RGN_SPLIT_PREV);
+ else if (ar->alignment==RGN_OVERLAP_LEFT) {
+ winrct->xmin = ar->winrct.xmax + 1;
}
- else if(ar->alignment==RGN_OVERLAP_RIGHT) {
- winrct->xmax= ar->winrct.xmin - 1;
+ else if (ar->alignment==RGN_OVERLAP_RIGHT) {
+ winrct->xmax = ar->winrct.xmin - 1;
}
else break;
}
@@ -447,21 +448,21 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
rcti winrct;
/* see BKE_spacedata_draw_locks() */
- if(at->do_lock)
+ if (at->do_lock)
return;
/* checks other overlapping regions */
region_scissor_winrct(ar, &winrct);
/* if no partial draw rect set, full rect */
- if(ar->drawrct.xmin == ar->drawrct.xmax)
+ if (ar->drawrct.xmin == ar->drawrct.xmax)
ar->drawrct= winrct;
else {
/* extra clip for safety */
- ar->drawrct.xmin= MAX2(winrct.xmin, ar->drawrct.xmin);
- ar->drawrct.ymin= MAX2(winrct.ymin, ar->drawrct.ymin);
- ar->drawrct.xmax= MIN2(winrct.xmax, ar->drawrct.xmax);
- ar->drawrct.ymax= MIN2(winrct.ymax, ar->drawrct.ymax);
+ ar->drawrct.xmin = MAX2(winrct.xmin, ar->drawrct.xmin);
+ ar->drawrct.ymin = MAX2(winrct.ymin, ar->drawrct.ymin);
+ ar->drawrct.xmax = MIN2(winrct.xmax, ar->drawrct.xmax);
+ ar->drawrct.ymax = MIN2(winrct.ymax, ar->drawrct.ymax);
}
/* note; this sets state, so we can use wmOrtho and friends */
@@ -470,14 +471,14 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0);
/* optional header info instead? */
- if(ar->headerstr) {
+ if (ar->headerstr) {
UI_ThemeClearColor(TH_HEADER);
glClear(GL_COLOR_BUFFER_BIT);
UI_ThemeColor(TH_TEXT);
BLF_draw_default(20, 8, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
}
- else if(at->draw) {
+ else if (at->draw) {
at->draw(C, ar);
}
@@ -491,7 +492,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
uiFreeInactiveBlocks(C, &ar->uiblocks);
- if(sa)
+ if (sa)
region_draw_emboss(ar, &winrct);
}
@@ -502,7 +503,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
void ED_region_tag_redraw(ARegion *ar)
{
- if(ar) {
+ if (ar) {
/* zero region means full region redraw */
ar->do_draw= RGN_DRAW;
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
@@ -511,24 +512,24 @@ void ED_region_tag_redraw(ARegion *ar)
void ED_region_tag_redraw_overlay(ARegion *ar)
{
- if(ar)
+ if (ar)
ar->do_draw_overlay= RGN_DRAW;
}
void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct)
{
- if(ar) {
- if(!ar->do_draw) {
+ if (ar) {
+ if (!ar->do_draw) {
/* no redraw set yet, set partial region */
ar->do_draw= RGN_DRAW_PARTIAL;
ar->drawrct= *rct;
}
- else if(ar->drawrct.xmin != ar->drawrct.xmax) {
+ else if (ar->drawrct.xmin != ar->drawrct.xmax) {
/* partial redraw already set, expand region */
- ar->drawrct.xmin= MIN2(ar->drawrct.xmin, rct->xmin);
- ar->drawrct.ymin= MIN2(ar->drawrct.ymin, rct->ymin);
- ar->drawrct.xmax= MAX2(ar->drawrct.xmax, rct->xmax);
- ar->drawrct.ymax= MAX2(ar->drawrct.ymax, rct->ymax);
+ ar->drawrct.xmin = MIN2(ar->drawrct.xmin, rct->xmin);
+ ar->drawrct.ymin = MIN2(ar->drawrct.ymin, rct->ymin);
+ ar->drawrct.xmax = MAX2(ar->drawrct.xmax, rct->xmax);
+ ar->drawrct.ymax = MAX2(ar->drawrct.ymax, rct->ymax);
}
}
}
@@ -537,8 +538,8 @@ void ED_area_tag_redraw(ScrArea *sa)
{
ARegion *ar;
- if(sa)
- for(ar= sa->regionbase.first; ar; ar= ar->next)
+ if (sa)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
ED_region_tag_redraw(ar);
}
@@ -546,9 +547,9 @@ void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype)
{
ARegion *ar;
- if(sa) {
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype == regiontype) {
+ if (sa) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == regiontype) {
ED_region_tag_redraw(ar);
}
}
@@ -557,7 +558,7 @@ void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype)
void ED_area_tag_refresh(ScrArea *sa)
{
- if(sa)
+ if (sa)
sa->do_refresh= 1;
}
@@ -569,17 +570,17 @@ void ED_area_headerprint(ScrArea *sa, const char *str)
ARegion *ar;
/* happens when running transform operators in backround mode */
- if(sa == NULL)
+ if (sa == NULL)
return;
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype==RGN_TYPE_HEADER) {
- if(str) {
- if(ar->headerstr==NULL)
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype==RGN_TYPE_HEADER) {
+ if (str) {
+ if (ar->headerstr==NULL)
ar->headerstr= MEM_mallocN(256, "headerprint");
BLI_strncpy(ar->headerstr, str, 256);
}
- else if(ar->headerstr) {
+ else if (ar->headerstr) {
MEM_freeN(ar->headerstr);
ar->headerstr= NULL;
}
@@ -660,8 +661,8 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
/* count how many actionzones with along same edge are available.
* This allows for adding more action zones in the future without
* having to worry about correct offset */
- for(azt= sa->actionzones.first; azt; azt= azt->next) {
- if(azt->edge == az->edge) tot++;
+ for (azt= sa->actionzones.first; azt; azt= azt->next) {
+ if (azt->edge == az->edge) tot++;
}
switch(az->edge) {
@@ -694,14 +695,14 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
/* if more azones on 1 spot, set offset */
- for(azt= sa->actionzones.first; azt; azt= azt->next) {
- if(az!=azt) {
- if( ABS(az->x1-azt->x1) < 2 && ABS(az->y1-azt->y1) < 2) {
- if(az->edge==AE_TOP_TO_BOTTOMRIGHT || az->edge==AE_BOTTOM_TO_TOPLEFT) {
+ for (azt= sa->actionzones.first; azt; azt= azt->next) {
+ if (az!=azt) {
+ if ( ABS(az->x1-azt->x1) < 2 && ABS(az->y1-azt->y1) < 2) {
+ if (az->edge==AE_TOP_TO_BOTTOMRIGHT || az->edge==AE_BOTTOM_TO_TOPLEFT) {
az->x1+= AZONESPOT;
az->x2+= AZONESPOT;
}
- else{
+ else {
az->y1-= AZONESPOT;
az->y2-= AZONESPOT;
}
@@ -720,13 +721,13 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
AZone *azt;
int tot= 0, add;
- for(azt= sa->actionzones.first; azt; azt= azt->next) {
- if(azt->edge == az->edge) tot++;
+ for (azt= sa->actionzones.first; azt; azt= azt->next) {
+ if (azt->edge == az->edge) tot++;
}
switch(az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+ if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
az->y1= ar->winrct.ymax - add;
az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW;
@@ -765,13 +766,13 @@ static void region_azone_tab(ScrArea *sa, AZone *az, ARegion *ar)
AZone *azt;
int tot= 0, add;
- for(azt= sa->actionzones.first; azt; azt= azt->next) {
- if(azt->edge == az->edge) tot++;
+ for (azt= sa->actionzones.first; azt; azt= azt->next) {
+ if (azt->edge == az->edge) tot++;
}
switch(az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+ if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
az->x1= ar->winrct.xmax - 2*AZONEPAD_TABW;
az->y1= ar->winrct.ymax - add;
az->x2= ar->winrct.xmax - AZONEPAD_TABW;
@@ -810,13 +811,13 @@ static void region_azone_tria(ScrArea *sa, AZone *az, ARegion *ar)
AZone *azt;
int tot= 0, add;
- for(azt= sa->actionzones.first; azt; azt= azt->next) {
- if(azt->edge == az->edge) tot++;
+ for (azt= sa->actionzones.first; azt; azt= azt->next) {
+ if (azt->edge == az->edge) tot++;
}
switch(az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+ if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
az->x1= ar->winrct.xmax - 2*AZONEPAD_TRIAW;
az->y1= ar->winrct.ymax - add;
az->x2= ar->winrct.xmax - AZONEPAD_TRIAW;
@@ -857,15 +858,16 @@ static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge)
az->edge= edge;
if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
- if(G.rt==3)
+ if (G.rt==3)
region_azone_icon(sa, az, ar);
- else if(G.rt==2)
+ else if (G.rt==2)
region_azone_tria(sa, az, ar);
- else if(G.rt==1)
+ else if (G.rt==1)
region_azone_tab(sa, az, ar);
else
region_azone_tab_plus(sa, az, ar);
- } else {
+ }
+ else {
region_azone_edge(az, ar);
}
@@ -878,20 +880,20 @@ static void region_azone_add(ScrArea *sa, ARegion *ar, int alignment)
{
/* edge code (t b l r) is along which area edge azone will be drawn */
- if(alignment==RGN_ALIGN_TOP)
+ if (alignment==RGN_ALIGN_TOP)
region_azone_initialize(sa, ar, AE_BOTTOM_TO_TOPLEFT);
- else if(alignment==RGN_ALIGN_BOTTOM)
+ else if (alignment==RGN_ALIGN_BOTTOM)
region_azone_initialize(sa, ar, AE_TOP_TO_BOTTOMRIGHT);
- else if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
+ else if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
region_azone_initialize(sa, ar, AE_LEFT_TO_TOPRIGHT);
- else if(ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
+ else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
region_azone_initialize(sa, ar, AE_RIGHT_TO_TOPLEFT);
}
/* dir is direction to check, not the splitting edge direction! */
static int rct_fits(rcti *rect, char dir, int size)
{
- if(dir=='h') {
+ if (dir=='h') {
return rect->xmax-rect->xmin - size;
}
else { // 'v'
@@ -905,15 +907,15 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
int prefsizex, prefsizey;
int alignment;
- if(ar==NULL)
+ if (ar==NULL)
return;
/* no returns in function, winrct gets set in the end again */
BLI_init_rcti(&ar->winrct, 0, 0, 0, 0);
/* for test; allow split of previously defined region */
- if(ar->alignment & RGN_SPLIT_PREV)
- if(ar->prev)
+ if (ar->alignment & RGN_SPLIT_PREV)
+ if (ar->prev)
remainder= &ar->prev->winrct;
alignment = ar->alignment & ~RGN_SPLIT_PREV;
@@ -921,118 +923,118 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
/* clear state flags first */
ar->flag &= ~RGN_FLAG_TOO_SMALL;
/* user errors */
- if(ar->next==NULL && alignment!=RGN_ALIGN_QSPLIT)
+ if (ar->next==NULL && alignment!=RGN_ALIGN_QSPLIT)
alignment= RGN_ALIGN_NONE;
/* prefsize, for header we stick to exception */
prefsizex= ar->sizex?ar->sizex:ar->type->prefsizex;
- if(ar->regiontype==RGN_TYPE_HEADER)
+ if (ar->regiontype==RGN_TYPE_HEADER)
prefsizey= ar->type->prefsizey;
- else if(ar->regiontype==RGN_TYPE_UI && sa->spacetype == SPACE_FILE) {
+ else if (ar->regiontype==RGN_TYPE_UI && sa->spacetype == SPACE_FILE) {
prefsizey= UI_UNIT_Y * 2 + (UI_UNIT_Y/2);
}
else
prefsizey= ar->sizey?ar->sizey:ar->type->prefsizey;
/* hidden is user flag */
- if(ar->flag & RGN_FLAG_HIDDEN);
+ if (ar->flag & RGN_FLAG_HIDDEN);
/* XXX floating area region, not handled yet here */
- else if(alignment == RGN_ALIGN_FLOAT);
+ else if (alignment == RGN_ALIGN_FLOAT);
/* remainder is too small for any usage */
- else if( rct_fits(remainder, 'v', 1)<0 || rct_fits(remainder, 'h', 1) < 0 ) {
+ else if ( rct_fits(remainder, 'v', 1)<0 || rct_fits(remainder, 'h', 1) < 0 ) {
ar->flag |= RGN_FLAG_TOO_SMALL;
}
- else if(alignment==RGN_ALIGN_NONE) {
+ else if (alignment==RGN_ALIGN_NONE) {
/* typically last region */
ar->winrct= *remainder;
BLI_init_rcti(remainder, 0, 0, 0, 0);
}
- else if(alignment==RGN_ALIGN_TOP || alignment==RGN_ALIGN_BOTTOM) {
+ else if (alignment==RGN_ALIGN_TOP || alignment==RGN_ALIGN_BOTTOM) {
- if( rct_fits(remainder, 'v', prefsizey) < 0 ) {
+ if ( rct_fits(remainder, 'v', prefsizey) < 0 ) {
ar->flag |= RGN_FLAG_TOO_SMALL;
}
else {
int fac= rct_fits(remainder, 'v', prefsizey);
- if(fac < 0 )
+ if (fac < 0 )
prefsizey += fac;
ar->winrct= *remainder;
- if(alignment==RGN_ALIGN_TOP) {
- ar->winrct.ymin= ar->winrct.ymax - prefsizey + 1;
- remainder->ymax= ar->winrct.ymin - 1;
+ if (alignment==RGN_ALIGN_TOP) {
+ ar->winrct.ymin = ar->winrct.ymax - prefsizey + 1;
+ remainder->ymax = ar->winrct.ymin - 1;
}
else {
- ar->winrct.ymax= ar->winrct.ymin + prefsizey - 1;
- remainder->ymin= ar->winrct.ymax + 1;
+ ar->winrct.ymax = ar->winrct.ymin + prefsizey - 1;
+ remainder->ymin = ar->winrct.ymax + 1;
}
}
}
- else if( ELEM4(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT)) {
+ else if ( ELEM4(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT)) {
- if( rct_fits(remainder, 'h', prefsizex) < 0 ) {
+ if ( rct_fits(remainder, 'h', prefsizex) < 0 ) {
ar->flag |= RGN_FLAG_TOO_SMALL;
}
else {
int fac= rct_fits(remainder, 'h', prefsizex);
- if(fac < 0 )
+ if (fac < 0 )
prefsizex += fac;
ar->winrct= *remainder;
- if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT)) {
- ar->winrct.xmin= ar->winrct.xmax - prefsizex + 1;
- if(alignment==RGN_ALIGN_RIGHT)
- remainder->xmax= ar->winrct.xmin - 1;
+ if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT)) {
+ ar->winrct.xmin = ar->winrct.xmax - prefsizex + 1;
+ if (alignment==RGN_ALIGN_RIGHT)
+ remainder->xmax = ar->winrct.xmin - 1;
}
else {
- ar->winrct.xmax= ar->winrct.xmin + prefsizex - 1;
- if(alignment==RGN_ALIGN_LEFT)
- remainder->xmin= ar->winrct.xmax + 1;
+ ar->winrct.xmax = ar->winrct.xmin + prefsizex - 1;
+ if (alignment==RGN_ALIGN_LEFT)
+ remainder->xmin = ar->winrct.xmax + 1;
}
}
}
- else if(alignment==RGN_ALIGN_VSPLIT || alignment==RGN_ALIGN_HSPLIT) {
+ else if (alignment==RGN_ALIGN_VSPLIT || alignment==RGN_ALIGN_HSPLIT) {
/* percentage subdiv*/
ar->winrct= *remainder;
- if(alignment==RGN_ALIGN_HSPLIT) {
- if( rct_fits(remainder, 'h', prefsizex) > 4) {
- ar->winrct.xmax= (remainder->xmin+remainder->xmax)/2;
- remainder->xmin= ar->winrct.xmax+1;
+ if (alignment==RGN_ALIGN_HSPLIT) {
+ if ( rct_fits(remainder, 'h', prefsizex) > 4) {
+ ar->winrct.xmax = (remainder->xmin+remainder->xmax)/2;
+ remainder->xmin = ar->winrct.xmax+1;
}
else {
BLI_init_rcti(remainder, 0, 0, 0, 0);
}
}
else {
- if( rct_fits(remainder, 'v', prefsizey) > 4) {
- ar->winrct.ymax= (remainder->ymin+remainder->ymax)/2;
- remainder->ymin= ar->winrct.ymax+1;
+ if ( rct_fits(remainder, 'v', prefsizey) > 4) {
+ ar->winrct.ymax = (remainder->ymin+remainder->ymax)/2;
+ remainder->ymin = ar->winrct.ymax+1;
}
else {
BLI_init_rcti(remainder, 0, 0, 0, 0);
}
}
}
- else if(alignment==RGN_ALIGN_QSPLIT) {
+ else if (alignment==RGN_ALIGN_QSPLIT) {
ar->winrct= *remainder;
/* test if there's still 4 regions left */
- if(quad==0) {
+ if (quad==0) {
ARegion *artest= ar->next;
int count= 1;
- while(artest) {
+ while (artest) {
artest->alignment= RGN_ALIGN_QSPLIT;
artest= artest->next;
count++;
}
- if(count!=4) {
+ if (count!=4) {
/* let's stop adding regions */
BLI_init_rcti(remainder, 0, 0, 0, 0);
if (G.f & G_DEBUG)
@@ -1040,16 +1042,16 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
}
else quad= 1;
}
- if(quad) {
- if(quad==1) { /* left bottom */
+ if (quad) {
+ if (quad==1) { /* left bottom */
ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
}
- else if(quad==2) { /* left top */
+ else if (quad==2) { /* left top */
ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax)/2;
}
- else if(quad==3) { /* right bottom */
+ else if (quad==3) { /* right bottom */
ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax)/2;
ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
}
@@ -1068,24 +1070,24 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
/* set winrect for azones */
- if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
+ if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
ar->winrct= *remainder;
- if(alignment==RGN_ALIGN_TOP)
- ar->winrct.ymin= ar->winrct.ymax;
- else if(alignment==RGN_ALIGN_BOTTOM)
- ar->winrct.ymax= ar->winrct.ymin;
- else if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
- ar->winrct.xmin= ar->winrct.xmax;
- else if(ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
- ar->winrct.xmax= ar->winrct.xmin;
+ if (alignment==RGN_ALIGN_TOP)
+ ar->winrct.ymin = ar->winrct.ymax;
+ else if (alignment==RGN_ALIGN_BOTTOM)
+ ar->winrct.ymax = ar->winrct.ymin;
+ else if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
+ ar->winrct.xmin = ar->winrct.xmax;
+ else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
+ ar->winrct.xmax = ar->winrct.xmin;
else /* prevent winrct to be valid */
- ar->winrct.xmax= ar->winrct.xmin;
+ ar->winrct.xmax = ar->winrct.xmin;
}
/* restore prev-split exception */
- if(ar->alignment & RGN_SPLIT_PREV) {
- if(ar->prev) {
+ if (ar->alignment & RGN_SPLIT_PREV) {
+ if (ar->prev) {
remainder= remainder_prev;
ar->prev->winx= ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
ar->prev->winy= ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
@@ -1093,7 +1095,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
}
/* in end, add azones, where appropriate */
- if(ar->regiontype == RGN_TYPE_HEADER && ar->winy + 6 > sa->winy) {
+ if (ar->regiontype == RGN_TYPE_HEADER && ar->winy + 6 > sa->winy) {
/* The logic for this is: when the header takes up the full area,
* disallow hiding it to view the main window.
*
@@ -1113,15 +1115,15 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
{
short rt= 0; // CLAMPIS(G.rt, 0, 16);
- if(sa->v1->vec.x>0) sa->totrct.xmin= sa->v1->vec.x+1+rt;
- else sa->totrct.xmin= sa->v1->vec.x;
- if(sa->v4->vec.x<sizex-1) sa->totrct.xmax= sa->v4->vec.x-1-rt;
- else sa->totrct.xmax= sa->v4->vec.x;
+ if (sa->v1->vec.x>0) sa->totrct.xmin = sa->v1->vec.x+1+rt;
+ else sa->totrct.xmin = sa->v1->vec.x;
+ if (sa->v4->vec.x<sizex-1) sa->totrct.xmax = sa->v4->vec.x-1-rt;
+ else sa->totrct.xmax = sa->v4->vec.x;
- if(sa->v1->vec.y>0) sa->totrct.ymin= sa->v1->vec.y+1+rt;
- else sa->totrct.ymin= sa->v1->vec.y;
- if(sa->v2->vec.y<sizey-1) sa->totrct.ymax= sa->v2->vec.y-1-rt;
- else sa->totrct.ymax= sa->v2->vec.y;
+ if (sa->v1->vec.y>0) sa->totrct.ymin = sa->v1->vec.y+1+rt;
+ else sa->totrct.ymin = sa->v1->vec.y;
+ if (sa->v2->vec.y<sizey-1) sa->totrct.ymax = sa->v2->vec.y-1-rt;
+ else sa->totrct.ymax = sa->v2->vec.y;
/* for speedup */
sa->winx= sa->totrct.xmax-sa->totrct.xmin+1;
@@ -1132,12 +1134,12 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
/* used for area initialize below */
static void region_subwindow(wmWindow *win, ARegion *ar)
{
- if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
- if(ar->swinid)
+ if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
+ if (ar->swinid)
wm_subwindow_close(win, ar->swinid);
ar->swinid= 0;
}
- else if(ar->swinid==0)
+ else if (ar->swinid==0)
ar->swinid= wm_subwindow_open(win, &ar->winrct);
else
wm_subwindow_position(win, ar->swinid, &ar->winrct);
@@ -1148,49 +1150,49 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand
/* note, add-handler checks if it already exists */
// XXX it would be good to have boundbox checks for some of these...
- if(flag & ED_KEYMAP_UI) {
+ if (flag & ED_KEYMAP_UI) {
/* user interface widgets */
UI_add_region_handlers(handlers);
}
- if(flag & ED_KEYMAP_VIEW2D) {
+ if (flag & ED_KEYMAP_VIEW2D) {
/* 2d-viewport handling+manipulation */
- wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "View2D", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "View2D", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
- if(flag & ED_KEYMAP_MARKERS) {
+ if (flag & ED_KEYMAP_MARKERS) {
/* time-markers */
- wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
/* time space only has this keymap, the others get a boundbox restricted map */
- if(sa->spacetype!=SPACE_TIME) {
+ if (sa->spacetype!=SPACE_TIME) {
ARegion *ar;
static rcti rect= {0, 10000, 0, 30}; /* same local check for all areas */
ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if(ar) {
+ if (ar) {
WM_event_add_keymap_handler_bb(handlers, keymap, &rect, &ar->winrct);
}
}
else
WM_event_add_keymap_handler(handlers, keymap);
}
- if(flag & ED_KEYMAP_ANIMATION) {
+ if (flag & ED_KEYMAP_ANIMATION) {
/* frame changing and timeline operators (for time spaces) */
- wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Animation", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Animation", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
- if(flag & ED_KEYMAP_FRAMES) {
+ if (flag & ED_KEYMAP_FRAMES) {
/* frame changing/jumping (for all spaces) */
- wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
- if(flag & ED_KEYMAP_GPENCIL) {
+ if (flag & ED_KEYMAP_GPENCIL) {
/* grease pencil */
- wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Grease Pencil", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Grease Pencil", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
- if(flag & ED_KEYMAP_HEADER) {
+ if (flag & ED_KEYMAP_HEADER) {
/* standard keymap for headers regions */
- wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Header", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Header", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
}
@@ -1205,12 +1207,12 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
/* set typedefinitions */
sa->type= BKE_spacetype_from_id(sa->spacetype);
- if(sa->type==NULL) {
+ if (sa->type==NULL) {
sa->butspacetype= sa->spacetype= SPACE_VIEW3D;
sa->type= BKE_spacetype_from_id(sa->spacetype);
}
- for(ar= sa->regionbase.first; ar; ar= ar->next)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
ar->type= BKE_regiontype_from_id(sa->type, ar->regiontype);
/* area sizes */
@@ -1226,18 +1228,18 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
/* default area handlers */
ed_default_handlers(wm, sa, &sa->handlers, sa->type->keymapflag);
/* checks spacedata, adds own handlers */
- if(sa->type->init)
+ if (sa->type->init)
sa->type->init(wm, sa);
/* region windows, default and own handlers */
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
region_subwindow(win, ar);
- if(ar->swinid) {
+ if (ar->swinid) {
/* default region handlers */
ed_default_handlers(wm, sa, &ar->handlers, ar->type->keymapflag);
/* own handlers */
- if(ar->type->init)
+ if (ar->type->init)
ar->type->init(wm, ar);
}
else {
@@ -1246,7 +1248,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
}
/* rechecks 2d matrix for header on dpi changing, do not do for other regions, it resets view && blocks view2d operator polls (ton) */
- if(ar->regiontype==RGN_TYPE_HEADER)
+ if (ar->regiontype==RGN_TYPE_HEADER)
ar->v2d.flag &= ~V2D_IS_INITIALISED;
}
}
@@ -1273,7 +1275,7 @@ void ED_region_toggle_hidden(bContext *C, ARegion *ar)
ar->flag ^= RGN_FLAG_HIDDEN;
- if(ar->flag & RGN_FLAG_HIDDEN)
+ if (ar->flag & RGN_FLAG_HIDDEN)
WM_event_remove_handlers(C, &ar->handlers);
ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
@@ -1292,10 +1294,10 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
sa1->spacetype= sa2->spacetype;
sa1->butspacetype= sa2->butspacetype;
- if(swap_space == 1) {
+ if (swap_space == 1) {
SWAP(ListBase, sa1->spacedata, sa2->spacedata);
/* exception: ensure preview is reset */
-// if(sa1->spacetype==SPACE_VIEW3D)
+// if (sa1->spacetype==SPACE_VIEW3D)
// XXX BIF_view3d_previewrender_free(sa1->spacedata.first);
}
else if (swap_space == 2) {
@@ -1309,19 +1311,19 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
/* Note; SPACE_EMPTY is possible on new screens */
/* regions */
- if(swap_space == 1) {
+ if (swap_space == 1) {
SWAP(ListBase, sa1->regionbase, sa2->regionbase);
}
else {
- if(swap_space<2) {
+ if (swap_space<2) {
st= BKE_spacetype_from_id(spacetype);
- for(ar= sa1->regionbase.first; ar; ar= ar->next)
+ for (ar= sa1->regionbase.first; ar; ar= ar->next)
BKE_area_region_free(st, ar);
BLI_freelistN(&sa1->regionbase);
}
st= BKE_spacetype_from_id(sa2->spacetype);
- for(ar= sa2->regionbase.first; ar; ar= ar->next) {
+ for (ar= sa2->regionbase.first; ar; ar= ar->next) {
ARegion *newar= BKE_area_region_copy(st, ar);
BLI_addtail(&sa1->regionbase, newar);
}
@@ -1357,7 +1359,7 @@ void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2)
void ED_area_newspace(bContext *C, ScrArea *sa, int type)
{
- if(sa->spacetype != type) {
+ if (sa->spacetype != type) {
SpaceType *st;
SpaceLink *slold;
SpaceLink *sl;
@@ -1373,14 +1375,14 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
/* check previously stored space */
for (sl= sa->spacedata.first; sl; sl= sl->next)
- if(sl->spacetype==type)
+ if (sl->spacetype==type)
break;
/* old spacedata... happened during work on 2.50, remove */
- if(sl && sl->regionbase.first==NULL) {
+ if (sl && sl->regionbase.first==NULL) {
st->free(sl);
BLI_freelinkN(&sa->spacedata, sl);
- if(slold == sl) {
+ if (slold == sl) {
slold= NULL;
}
sl= NULL;
@@ -1399,12 +1401,12 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
}
else {
/* new space */
- if(st) {
+ if (st) {
sl= st->new(C);
BLI_addhead(&sa->spacedata, sl);
/* swap regions */
- if(slold)
+ if (slold)
slold->regionbase= sa->regionbase;
sa->regionbase= sl->regionbase;
sl->regionbase.first= sl->regionbase.last= NULL;
@@ -1430,10 +1432,10 @@ void ED_area_prevspace(bContext *C, ScrArea *sa)
{
SpaceLink *sl = (sa) ? sa->spacedata.first : CTX_wm_space_data(C);
- if(sl->next) {
+ if (sl->next) {
/* workaround for case of double prevspace, render window
* with a file browser on top of it */
- if(sl->next->spacetype == SPACE_FILE && sl->next->next)
+ if (sl->next->spacetype == SPACE_FILE && sl->next->next)
ED_area_newspace(C, sa, sl->next->next->spacetype);
else
ED_area_newspace(C, sa, sl->next->spacetype);
@@ -1505,7 +1507,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
uiBut *but;
int xco= 8;
- but= uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D,
+ but = uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D,
editortype_pup(), xco, yco, UI_UNIT_X+10, UI_UNIT_Y,
&(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0,
TIP_("Displays current editor type. Click for menu of available types"));
@@ -1527,14 +1529,14 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
uiBlockSetEmboss(block, UI_EMBOSSN);
if (sa->flag & HEADER_NO_PULLDOWN) {
- but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
+ but = uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
ICON_DISCLOSURE_TRI_RIGHT,
xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
&(sa->flag), 0, 0, 0, 0,
"Show pulldown menus");
}
else {
- but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
+ but = uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
ICON_DISCLOSURE_TRI_DOWN,
xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
&(sa->flag), 0, 0, 0, 0,
@@ -1561,10 +1563,10 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
View2DScrollers *scrollers;
int x, y, xco, yco, w, em, triangle, open, newcontext= 0;
- if(contextnr >= 0)
+ if (contextnr >= 0)
newcontext= UI_view2d_tab_set(v2d, contextnr);
- if(vertical) {
+ if (vertical) {
w= v2d->cur.xmax - v2d->cur.xmin;
em= (ar->type->prefsizex)? UI_UNIT_Y/2: UI_UNIT_Y;
}
@@ -1579,21 +1581,21 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(v2d);
- for(pt= ar->type->paneltypes.first; pt; pt= pt->next) {
+ for (pt= ar->type->paneltypes.first; pt; pt= pt->next) {
/* verify context */
- if(context)
- if(pt->context[0] && strcmp(context, pt->context) != 0)
+ if (context)
+ if (pt->context[0] && strcmp(context, pt->context) != 0)
continue;
/* draw panel */
- if(pt->draw && (!pt->poll || pt->poll(C, pt))) {
+ if (pt->draw && (!pt->poll || pt->poll(C, pt))) {
block= uiBeginBlock(C, ar, pt->idname, UI_EMBOSS);
panel= uiBeginPanel(sa, ar, block, pt, &open);
/* bad fixed values */
triangle= (int)(UI_UNIT_Y * 1.1f);
- if(pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) {
+ if (pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) {
/* for enabled buttons */
panel->layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER,
triangle, UI_UNIT_Y+style->panelspace+2, UI_UNIT_Y, 1, style);
@@ -1608,7 +1610,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
panel->labelofs= 0;
}
- if(open) {
+ if (open) {
short panelContext;
/* panel context can either be toolbar region or normal panels region */
@@ -1645,7 +1647,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
glClear(GL_COLOR_BUFFER_BIT);
/* before setting the view */
- if(vertical) {
+ if (vertical) {
/* only allow scrolling in vertical direction */
v2d->keepofs |= V2D_LOCKOFS_X|V2D_KEEPOFS_Y;
v2d->keepofs &= ~(V2D_LOCKOFS_Y|V2D_KEEPOFS_X);
@@ -1653,7 +1655,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
v2d->scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
// don't jump back when panels close or hide
- if(!newcontext)
+ if (!newcontext)
y= MAX2(-y, -v2d->cur.ymin);
else
y= -y;
@@ -1669,7 +1671,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
v2d->scroll &= ~V2D_SCROLL_HORIZONTAL_HIDE;
// don't jump back when panels close or hide
- if(!newcontext)
+ if (!newcontext)
x= MAX2(x, v2d->cur.xmax);
y= -y;
}
@@ -1703,13 +1705,13 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
ar->v2d.scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
ar->v2d.keepzoom |= V2D_KEEPZOOM;
- // correctly initialised User-Prefs?
- if(!(ar->v2d.align & V2D_ALIGN_NO_POS_Y))
+ // correctly initialized User-Prefs?
+ if (!(ar->v2d.align & V2D_ALIGN_NO_POS_Y))
ar->v2d.flag &= ~V2D_IS_INITIALISED;
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
- keymap= WM_keymap_find(wm->defaultconf, "View2D Buttons List", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "View2D Buttons List", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -1734,25 +1736,25 @@ void ED_region_header(const bContext *C, ARegion *ar)
yco= headery-4;
/* draw all headers types */
- for(ht= ar->type->headertypes.first; ht; ht= ht->next) {
+ for (ht= ar->type->headertypes.first; ht; ht= ht->next) {
block= uiBeginBlock(C, ar, ht->idname, UI_EMBOSS);
layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, style);
- if(ht->draw) {
+ if (ht->draw) {
header.type= ht;
header.layout= layout;
ht->draw(C, &header);
/* for view2d */
xco= uiLayoutGetWidth(layout);
- if(xco > maxco)
+ if (xco > maxco)
maxco= xco;
}
uiBlockLayoutResolve(block, &xco, &yco);
/* for view2d */
- if(xco > maxco)
+ if (xco > maxco)
maxco= xco;
uiEndBlock(C, block);
@@ -1788,17 +1790,17 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
/* background box */
rect= ar->winrct;
- rect.xmin= 0;
- rect.ymin= ar->winrct.ymax - ar->winrct.ymin - header_height;
+ rect.xmin = 0;
+ rect.ymin = ar->winrct.ymax - ar->winrct.ymin - header_height;
- if(block) {
- rect.xmax= ar->winrct.xmax - ar->winrct.xmin;
+ if (block) {
+ rect.xmax = ar->winrct.xmax - ar->winrct.xmin;
}
else {
- rect.xmax= rect.xmin + BLF_width(fontid, text) + 24;
+ rect.xmax = rect.xmin + BLF_width(fontid, text) + 24;
}
- rect.ymax= ar->winrct.ymax - ar->winrct.ymin;
+ rect.ymax = ar->winrct.ymax - ar->winrct.ymin;
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 2608e9e3482..28fe8caf34b 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -150,7 +150,7 @@ void fdrawbezier(float vec[4][3])
glBegin(GL_LINE_STRIP);
while (spline_step < 1.000001f) {
#if 0
- if(do_shaded)
+ if (do_shaded)
UI_ThemeColorBlend(th_col1, th_col2, spline_step);
#endif
glEvalCoord1f(spline_step);
@@ -261,7 +261,7 @@ void sdrawbox(short x1, short y1, short x2, short y2)
void setlinestyle(int nr)
{
- if(nr==0) {
+ if (nr==0) {
glDisable(GL_LINE_STIPPLE);
}
else {
@@ -284,7 +284,7 @@ void set_inverted_drawing(int enable)
void sdrawXORline(int x0, int y0, int x1, int y1)
{
- if(x0==x1 && y0==y1) return;
+ if (x0==x1 && y0==y1) return;
set_inverted_drawing(1);
@@ -306,7 +306,7 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
set_inverted_drawing(1);
glBegin(GL_LINES);
- if(nr== -1) { /* flush */
+ if (nr== -1) { /* flush */
for (nr=0; nr<4; nr++) {
if (flags[nr]) {
glVertex2sv(old[nr][0]);
@@ -314,9 +314,10 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
flags[nr]= 0;
}
}
- } else {
- if(nr>=0 && nr<4) {
- if(flags[nr]) {
+ }
+ else {
+ if (nr>=0 && nr<4) {
+ if (flags[nr]) {
glVertex2sv(old[nr][0]);
glVertex2sv(old[nr][1]);
}
@@ -339,7 +340,7 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
void fdrawXORellipse(float xofs, float yofs, float hw, float hh)
{
- if(hw==0) return;
+ if (hw==0) return;
set_inverted_drawing(1);
@@ -502,28 +503,28 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format,
float rast_y= y+subpart_y*offset_y*yzoom;
/* check if we already got these because we always get 2 more when doing seamless*/
- if(subpart_w<=seamless || subpart_h<=seamless)
+ if (subpart_w<=seamless || subpart_h<=seamless)
continue;
- if(format==GL_FLOAT) {
+ if (format==GL_FLOAT) {
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y*offset_y*img_w*4 + subpart_x*offset_x*4]);
/* add an extra border of pixels so linear looks ok at edges of full image. */
- if(subpart_w<tex_w)
+ if (subpart_w<tex_w)
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y*offset_y*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
- if(subpart_h<tex_h)
+ if (subpart_h<tex_h)
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + subpart_x*offset_x*4]);
- if(subpart_w<tex_w && subpart_h<tex_h)
+ if (subpart_w<tex_w && subpart_h<tex_h)
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
}
else {
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y*offset_y*img_w*4 + subpart_x*offset_x*4]);
- if(subpart_w<tex_w)
+ if (subpart_w<tex_w)
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y*offset_y*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
- if(subpart_h<tex_h)
+ if (subpart_h<tex_h)
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + subpart_x*offset_x*4]);
- if(subpart_w<tex_w && subpart_h<tex_h)
+ if (subpart_w<tex_w && subpart_h<tex_h)
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
}
@@ -608,27 +609,28 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
/* Don't use safe RasterPos (slower) if we can avoid it. */
if (rast_x>=0 && rast_y>=0) {
glRasterPos2f(rast_x, rast_y);
- } else {
+ }
+ else {
glaRasterPosSafe2f(rast_x, rast_y, 0, 0);
}
glPixelStorei(GL_UNPACK_ROW_LENGTH, row_w);
- if(format==GL_LUMINANCE || format==GL_RED) {
- if(type==GL_FLOAT) {
+ if (format==GL_LUMINANCE || format==GL_RED) {
+ if (type==GL_FLOAT) {
float *f_rect= (float *)rect;
glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*row_w + off_x));
}
- else if(type==GL_INT || type==GL_UNSIGNED_INT) {
+ else if (type==GL_INT || type==GL_UNSIGNED_INT) {
int *i_rect= (int *)rect;
glDrawPixels(draw_w, draw_h, format, type, i_rect + (off_y*row_w + off_x));
}
}
else { /* RGBA */
- if(type==GL_FLOAT) {
+ if (type==GL_FLOAT) {
float *f_rect= (float *)rect;
glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*row_w + off_x)*4);
}
- else if(type==GL_UNSIGNED_BYTE) {
+ else if (type==GL_UNSIGNED_BYTE) {
unsigned char *uc_rect= (unsigned char *) rect;
glDrawPixels(draw_w, draw_h, format, type, uc_rect + (off_y*row_w + off_x)*4);
}
@@ -709,11 +711,12 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
di->screen_rect= *screen_rect;
if (world_rect) {
di->world_rect= *world_rect;
- } else {
- di->world_rect.xmin= di->screen_rect.xmin;
- di->world_rect.ymin= di->screen_rect.ymin;
- di->world_rect.xmax= di->screen_rect.xmax;
- di->world_rect.ymax= di->screen_rect.ymax;
+ }
+ else {
+ di->world_rect.xmin = di->screen_rect.xmin;
+ di->world_rect.ymin = di->screen_rect.ymin;
+ di->world_rect.xmax = di->screen_rect.xmax;
+ di->world_rect.ymax = di->screen_rect.ymax;
}
sc_w= (di->screen_rect.xmax-di->screen_rect.xmin);
@@ -765,13 +768,13 @@ void bglBegin(int mode)
{
curmode= mode;
- if(mode==GL_POINTS) {
+ if (mode==GL_POINTS) {
float value[4];
glGetFloatv(GL_POINT_SIZE_RANGE, value);
- if(value[1] < 2.0f) {
+ if (value[1] < 2.0f) {
glGetFloatv(GL_POINT_SIZE, value);
pointhack= floor(value[0] + 0.5f);
- if(pointhack>4) pointhack= 4;
+ if (pointhack>4) pointhack= 4;
}
else glBegin(mode);
}
@@ -782,10 +785,10 @@ int bglPointHack(void)
float value[4];
int pointhack_px;
glGetFloatv(GL_POINT_SIZE_RANGE, value);
- if(value[1] < 2.0f) {
+ if (value[1] < 2.0f) {
glGetFloatv(GL_POINT_SIZE, value);
pointhack_px= floorf(value[0]+0.5f);
- if(pointhack_px>4) pointhack_px= 4;
+ if (pointhack_px>4) pointhack_px= 4;
return pointhack_px;
}
return 0;
@@ -795,7 +798,7 @@ void bglVertex3fv(const float vec[3])
{
switch(curmode) {
case GL_POINTS:
- if(pointhack) {
+ if (pointhack) {
glRasterPos3fv(vec);
glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot);
}
@@ -808,7 +811,7 @@ void bglVertex3f(float x, float y, float z)
{
switch(curmode) {
case GL_POINTS:
- if(pointhack) {
+ if (pointhack) {
glRasterPos3f(x, y, z);
glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot);
}
@@ -821,7 +824,7 @@ void bglVertex2fv(const float vec[2])
{
switch(curmode) {
case GL_POINTS:
- if(pointhack) {
+ if (pointhack) {
glRasterPos2fv(vec);
glBitmap(pointhack, pointhack, (float)pointhack/2, pointhack/2, 0.0, 0.0, Squaredot);
}
@@ -833,7 +836,7 @@ void bglVertex2fv(const float vec[2])
void bglEnd(void)
{
- if(pointhack) pointhack= 0;
+ if (pointhack) pointhack= 0;
else glEnd();
}
@@ -849,10 +852,10 @@ 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 &&
+ if (mats->modelview[0] < badvalue &&
mats->modelview[0] > -badvalue)
mats->modelview[0]= 0;
- if(mats->modelview[5] < badvalue &&
+ if (mats->modelview[5] < badvalue &&
mats->modelview[5] > -badvalue)
mats->modelview[5]= 0;
@@ -868,7 +871,7 @@ void bglPolygonOffset(float viewdist, float dist)
{
static float winmat[16], offset=0.0;
- if(dist != 0.0f) {
+ if (dist != 0.0f) {
float offs;
// glEnable(GL_POLYGON_OFFSET_FILL);
@@ -880,7 +883,7 @@ void bglPolygonOffset(float viewdist, float dist)
/* dist is from camera to center point */
- if(winmat[15]>0.5f) offs= 0.00001f*dist*viewdist; // ortho tweaking
+ if (winmat[15]>0.5f) offs= 0.00001f*dist*viewdist; // ortho tweaking
else offs= 0.0005f*dist; // should be clipping value or so...
winmat[14]-= offs;
@@ -903,7 +906,7 @@ void bglFlush(void)
{
glFlush();
#ifdef __APPLE__
-// if(GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_OFFICIAL))
+// if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_OFFICIAL))
// XXX myswapbuffers(); //hack to get mac intel graphics to show frontbuffer
#endif
}
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 9e2a2f54e0b..9e044068468 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -87,20 +87,20 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
base= BASACT;
#endif
- if(CTX_data_dir(member)) {
+ if (CTX_data_dir(member)) {
CTX_data_dir_set(result, screen_context_dir);
return 1;
}
- else if(CTX_data_equals(member, "scene")) {
+ else if (CTX_data_equals(member, "scene")) {
CTX_data_id_pointer_set(result, &scene->id);
return 1;
}
- else if(CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
+ else if (CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
int visible_objects= CTX_data_equals(member, "visible_objects");
- for(base=scene->base.first; base; base=base->next) {
- if(((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) && (base->lay & scene->lay)) {
- if(visible_objects)
+ for (base=scene->base.first; base; base=base->next) {
+ if (((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) && (base->lay & scene->lay)) {
+ if (visible_objects)
CTX_data_id_list_add(result, &base->object->id);
else
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -109,13 +109,13 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
- else if(CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
+ else if (CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
int selectable_objects= CTX_data_equals(member, "selectable_objects");
- for(base=scene->base.first; base; base=base->next) {
- if(base->lay & lay) {
- if((base->object->restrictflag & OB_RESTRICT_VIEW)==0 && (base->object->restrictflag & OB_RESTRICT_SELECT)==0) {
- if(selectable_objects)
+ for (base=scene->base.first; base; base=base->next) {
+ if (base->lay & lay) {
+ if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0 && (base->object->restrictflag & OB_RESTRICT_SELECT)==0) {
+ if (selectable_objects)
CTX_data_id_list_add(result, &base->object->id);
else
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -125,12 +125,12 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
- else if(CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
+ else if (CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
int selected_objects= CTX_data_equals(member, "selected_objects");
- for(base=scene->base.first; base; base=base->next) {
- if((base->flag & SELECT) && (base->lay & scene->lay)) {
- if(selected_objects)
+ for (base=scene->base.first; base; base=base->next) {
+ if ((base->flag & SELECT) && (base->lay & scene->lay)) {
+ if (selected_objects)
CTX_data_id_list_add(result, &base->object->id);
else
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -139,14 +139,14 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
- else if(CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
+ else if (CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
int selected_editable_objects= CTX_data_equals(member, "selected_editable_objects");
- for(base=scene->base.first; base; base=base->next) {
- if((base->flag & SELECT) && (base->lay & scene->lay)) {
- if((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
- if(0==object_is_libdata(base->object)) {
- if(selected_editable_objects)
+ for (base=scene->base.first; base; base=base->next) {
+ if ((base->flag & SELECT) && (base->lay & scene->lay)) {
+ if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
+ if (0==object_is_libdata(base->object)) {
+ if (selected_editable_objects)
CTX_data_id_list_add(result, &base->object->id);
else
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -157,7 +157,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
- else if(CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) {
+ else if (CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) {
bArmature *arm= (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
EditBone *ebone, *flipbone=NULL;
int editable_bones= CTX_data_equals(member, "editable_bones");
@@ -199,7 +199,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
}
- else if(CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) {
+ else if (CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) {
bArmature *arm= (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
EditBone *ebone, *flipbone=NULL;
int selected_editable_bones= CTX_data_equals(member, "selected_editable_bones");
@@ -241,7 +241,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
}
- else if(CTX_data_equals(member, "visible_pose_bones")) {
+ else if (CTX_data_equals(member, "visible_pose_bones")) {
Object *obpose= object_pose_armature_get(obact);
bArmature *arm= (obpose) ? obpose->data : NULL;
bPoseChannel *pchan;
@@ -257,7 +257,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
}
- else if(CTX_data_equals(member, "selected_pose_bones")) {
+ else if (CTX_data_equals(member, "selected_pose_bones")) {
Object *obpose= object_pose_armature_get(obact);
bArmature *arm= (obpose) ? obpose->data : NULL;
bPoseChannel *pchan;
@@ -274,24 +274,24 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
}
- else if(CTX_data_equals(member, "active_bone")) {
- if(obact && obact->type == OB_ARMATURE) {
+ else if (CTX_data_equals(member, "active_bone")) {
+ if (obact && obact->type == OB_ARMATURE) {
bArmature *arm= obact->data;
- if(arm->edbo) {
- if(arm->act_edbone) {
+ if (arm->edbo) {
+ if (arm->act_edbone) {
CTX_data_pointer_set(result, &arm->id, &RNA_EditBone, arm->act_edbone);
return 1;
}
}
else {
- if(arm->act_bone) {
+ if (arm->act_bone) {
CTX_data_pointer_set(result, &arm->id, &RNA_Bone, arm->act_bone);
return 1;
}
}
}
}
- else if(CTX_data_equals(member, "active_pose_bone")) {
+ else if (CTX_data_equals(member, "active_pose_bone")) {
bPoseChannel *pchan;
Object *obpose= object_pose_armature_get(obact);
@@ -301,64 +301,64 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
}
- else if(CTX_data_equals(member, "active_base")) {
- if(base)
+ else if (CTX_data_equals(member, "active_base")) {
+ if (base)
CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, base);
return 1;
}
- else if(CTX_data_equals(member, "active_object")) {
- if(obact)
+ else if (CTX_data_equals(member, "active_object")) {
+ if (obact)
CTX_data_id_pointer_set(result, &obact->id);
return 1;
}
- else if(CTX_data_equals(member, "object")) {
- if(obact)
+ else if (CTX_data_equals(member, "object")) {
+ if (obact)
CTX_data_id_pointer_set(result, &obact->id);
return 1;
}
- else if(CTX_data_equals(member, "edit_object")) {
+ else if (CTX_data_equals(member, "edit_object")) {
/* convenience for now, 1 object per scene in editmode */
- if(obedit)
+ if (obedit)
CTX_data_id_pointer_set(result, &obedit->id);
return 1;
}
- else if(CTX_data_equals(member, "sculpt_object")) {
- if(obact && (obact->mode & OB_MODE_SCULPT))
+ else if (CTX_data_equals(member, "sculpt_object")) {
+ if (obact && (obact->mode & OB_MODE_SCULPT))
CTX_data_id_pointer_set(result, &obact->id);
return 1;
}
- else if(CTX_data_equals(member, "vertex_paint_object")) {
- if(obact && (obact->mode & OB_MODE_VERTEX_PAINT))
+ else if (CTX_data_equals(member, "vertex_paint_object")) {
+ if (obact && (obact->mode & OB_MODE_VERTEX_PAINT))
CTX_data_id_pointer_set(result, &obact->id);
return 1;
}
- else if(CTX_data_equals(member, "weight_paint_object")) {
- if(obact && (obact->mode & OB_MODE_WEIGHT_PAINT))
+ else if (CTX_data_equals(member, "weight_paint_object")) {
+ if (obact && (obact->mode & OB_MODE_WEIGHT_PAINT))
CTX_data_id_pointer_set(result, &obact->id);
return 1;
}
- else if(CTX_data_equals(member, "image_paint_object")) {
- if(obact && (obact->mode & OB_MODE_TEXTURE_PAINT))
+ else if (CTX_data_equals(member, "image_paint_object")) {
+ if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT))
CTX_data_id_pointer_set(result, &obact->id);
return 1;
}
- else if(CTX_data_equals(member, "particle_edit_object")) {
- if(obact && (obact->mode & OB_MODE_PARTICLE_EDIT))
+ else if (CTX_data_equals(member, "particle_edit_object")) {
+ if (obact && (obact->mode & OB_MODE_PARTICLE_EDIT))
CTX_data_id_pointer_set(result, &obact->id);
return 1;
}
- else if(CTX_data_equals(member, "sequences")) {
+ else if (CTX_data_equals(member, "sequences")) {
Editing *ed= seq_give_editing(scene, FALSE);
- if(ed) {
+ if (ed) {
Sequence *seq;
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
@@ -367,9 +367,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
}
- else if(CTX_data_equals(member, "selected_sequences")) {
+ else if (CTX_data_equals(member, "selected_sequences")) {
Editing *ed= seq_give_editing(scene, FALSE);
- if(ed) {
+ if (ed) {
Sequence *seq;
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if (seq->flag & SELECT) {
@@ -380,9 +380,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
}
- else if(CTX_data_equals(member, "selected_editable_sequences")) {
+ else if (CTX_data_equals(member, "selected_editable_sequences")) {
Editing *ed= seq_give_editing(scene, FALSE);
- if(ed) {
+ if (ed) {
Sequence *seq;
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
@@ -393,11 +393,11 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
}
- else if(CTX_data_equals(member, "active_operator")) {
+ else if (CTX_data_equals(member, "active_operator")) {
wmOperator *op= NULL;
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile) {
+ if (sfile) {
op= sfile->op;
}
else if ((op= uiContextActiveOperator(C))) {
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 6288f39367e..9deb64ef60a 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -111,7 +111,7 @@ ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2)
sortscrvert(&v1, &v2);
for (se= sc->edgebase.first; se; se= se->next)
- if(se->v1==v1 && se->v2==v2)
+ if (se->v1==v1 && se->v2==v2)
return se;
return NULL;
@@ -124,12 +124,12 @@ void removedouble_scrverts(bScreen *sc)
ScrArea *sa;
verg= sc->vertbase.first;
- while(verg) {
- if(verg->newv==NULL) { /* !!! */
+ while (verg) {
+ if (verg->newv==NULL) { /* !!! */
v1= verg->next;
- while(v1) {
- if(v1->newv==NULL) { /* !?! */
- if(v1->vec.x==verg->vec.x && v1->vec.y==verg->vec.y) {
+ while (v1) {
+ if (v1->newv==NULL) { /* !?! */
+ if (v1->vec.x==verg->vec.x && v1->vec.y==verg->vec.y) {
/* printf("doublevert\n"); */
v1->newv= verg;
}
@@ -142,27 +142,27 @@ void removedouble_scrverts(bScreen *sc)
/* replace pointers in edges and faces */
se= sc->edgebase.first;
- while(se) {
- if(se->v1->newv) se->v1= se->v1->newv;
- if(se->v2->newv) se->v2= se->v2->newv;
+ while (se) {
+ if (se->v1->newv) se->v1= se->v1->newv;
+ if (se->v2->newv) se->v2= se->v2->newv;
/* edges changed: so.... */
sortscrvert(&(se->v1), &(se->v2));
se= se->next;
}
sa= sc->areabase.first;
- while(sa) {
- if(sa->v1->newv) sa->v1= sa->v1->newv;
- if(sa->v2->newv) sa->v2= sa->v2->newv;
- if(sa->v3->newv) sa->v3= sa->v3->newv;
- if(sa->v4->newv) sa->v4= sa->v4->newv;
+ while (sa) {
+ if (sa->v1->newv) sa->v1= sa->v1->newv;
+ if (sa->v2->newv) sa->v2= sa->v2->newv;
+ if (sa->v3->newv) sa->v3= sa->v3->newv;
+ if (sa->v4->newv) sa->v4= sa->v4->newv;
sa= sa->next;
}
/* remove */
verg= sc->vertbase.first;
- while(verg) {
+ while (verg) {
v1= verg->next;
- if(verg->newv) {
+ if (verg->newv) {
BLI_remlink(&sc->vertbase, verg);
MEM_freeN(verg);
}
@@ -179,16 +179,16 @@ void removenotused_scrverts(bScreen *sc)
/* we assume edges are ok */
se= sc->edgebase.first;
- while(se) {
+ while (se) {
se->v1->flag= 1;
se->v2->flag= 1;
se= se->next;
}
sv= sc->vertbase.first;
- while(sv) {
+ while (sv) {
svn= sv->next;
- if(sv->flag==0) {
+ if (sv->flag==0) {
BLI_remlink(&sc->vertbase, sv);
MEM_freeN(sv);
}
@@ -203,11 +203,11 @@ void removedouble_scredges(bScreen *sc)
/* compare */
verg= sc->edgebase.first;
- while(verg) {
+ while (verg) {
se= verg->next;
- while(se) {
+ while (se) {
sn= se->next;
- if(verg->v1==se->v1 && verg->v2==se->v2) {
+ if (verg->v1==se->v1 && verg->v2==se->v2) {
BLI_remlink(&sc->edgebase, se);
MEM_freeN(se);
}
@@ -225,26 +225,26 @@ void removenotused_scredges(bScreen *sc)
/* sets flags when edge is used in area */
sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
se= screen_findedge(sc, sa->v1, sa->v2);
- if(se==NULL) printf("error: area %d edge 1 doesn't exist\n", a);
+ if (se==NULL) printf("error: area %d edge 1 doesn't exist\n", a);
else se->flag= 1;
se= screen_findedge(sc, sa->v2, sa->v3);
- if(se==NULL) printf("error: area %d edge 2 doesn't exist\n", a);
+ if (se==NULL) printf("error: area %d edge 2 doesn't exist\n", a);
else se->flag= 1;
se= screen_findedge(sc, sa->v3, sa->v4);
- if(se==NULL) printf("error: area %d edge 3 doesn't exist\n", a);
+ if (se==NULL) printf("error: area %d edge 3 doesn't exist\n", a);
else se->flag= 1;
se= screen_findedge(sc, sa->v4, sa->v1);
- if(se==NULL) printf("error: area %d edge 4 doesn't exist\n", a);
+ if (se==NULL) printf("error: area %d edge 4 doesn't exist\n", a);
else se->flag= 1;
sa= sa->next;
a++;
}
se= sc->edgebase.first;
- while(se) {
+ while (se) {
sen= se->next;
- if(se->flag==0) {
+ if (se->flag==0) {
BLI_remlink(&sc->edgebase, se);
MEM_freeN(se);
}
@@ -320,18 +320,18 @@ static short testsplitpoint(ScrArea *sa, char dir, float fac)
short x, y;
// area big enough?
- if(dir=='v' && (sa->v4->vec.x- sa->v1->vec.x <= 2*AREAMINX)) return 0;
- if(dir=='h' && (sa->v2->vec.y- sa->v1->vec.y <= 2*AREAMINY)) return 0;
+ if (dir=='v' && (sa->v4->vec.x- sa->v1->vec.x <= 2*AREAMINX)) return 0;
+ if (dir=='h' && (sa->v2->vec.y- sa->v1->vec.y <= 2*AREAMINY)) return 0;
// to be sure
CLAMP(fac, 0.0f, 1.0f);
- if(dir=='h') {
+ if (dir=='h') {
y= sa->v1->vec.y+ fac*(sa->v2->vec.y- sa->v1->vec.y);
- if(y- sa->v1->vec.y < AREAMINY)
+ if (y- sa->v1->vec.y < AREAMINY)
y= sa->v1->vec.y+ AREAMINY;
- else if(sa->v2->vec.y- y < AREAMINY)
+ else if (sa->v2->vec.y- y < AREAMINY)
y= sa->v2->vec.y- AREAMINY;
else y-= (y % AREAGRID);
@@ -340,9 +340,9 @@ static short testsplitpoint(ScrArea *sa, char dir, float fac)
else {
x= sa->v1->vec.x+ fac*(sa->v4->vec.x- sa->v1->vec.x);
- if(x- sa->v1->vec.x < AREAMINX)
+ if (x- sa->v1->vec.x < AREAMINX)
x= sa->v1->vec.x+ AREAMINX;
- else if(sa->v4->vec.x- x < AREAMINX)
+ else if (sa->v4->vec.x- x < AREAMINX)
x= sa->v4->vec.x- AREAMINX;
else x-= (x % AREAGRID);
@@ -356,12 +356,12 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
ScrVert *sv1, *sv2;
short split;
- if(sa==NULL) return NULL;
+ if (sa==NULL) return NULL;
split= testsplitpoint(sa, dir, fac);
- if(split==0) return NULL;
+ if (split==0) return NULL;
- if(dir=='h') {
+ if (dir=='h') {
/* new vertices */
sv1= screen_addvert(sc, sa->v1->vec.x, split);
sv2= screen_addvert(sc, sa->v4->vec.x, split);
@@ -404,7 +404,7 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
}
/* remove double vertices en edges */
- if(merge)
+ if (merge)
removedouble_scrverts(sc);
removedouble_scredges(sc);
removenotused_scredges(sc);
@@ -456,18 +456,18 @@ static void screen_copy(bScreen *to, bScreen *from)
to->regionbase.first= to->regionbase.last= NULL;
s2= to->vertbase.first;
- for(s1= from->vertbase.first; s1; s1= s1->next, s2= s2->next) {
+ for (s1= from->vertbase.first; s1; s1= s1->next, s2= s2->next) {
s1->newv= s2;
}
- for(se= to->edgebase.first; se; se= se->next) {
+ for (se= to->edgebase.first; se; se= se->next) {
se->v1= se->v1->newv;
se->v2= se->v2->newv;
sortscrvert(&(se->v1), &(se->v2));
}
saf= from->areabase.first;
- for(sa= to->areabase.first; sa; sa= sa->next, saf= saf->next) {
+ for (sa= to->areabase.first; sa; sa= sa->next, saf= saf->next) {
sa->v1= sa->v1->newv;
sa->v2= sa->v2->newv;
sa->v3= sa->v3->newv;
@@ -482,7 +482,7 @@ static void screen_copy(bScreen *to, bScreen *from)
}
/* put at zero (needed?) */
- for(s1= from->vertbase.first; s1; s1= s1->next)
+ for (s1= from->vertbase.first; s1; s1= s1->next)
s1->newv= NULL;
}
@@ -496,7 +496,7 @@ int area_getorientation(ScrArea *sa, ScrArea *sb)
ScrVert *sav1, *sav2, *sav3, *sav4;
ScrVert *sbv1, *sbv2, *sbv3, *sbv4;
- if(sa==NULL || sb==NULL) return -1;
+ if (sa==NULL || sb==NULL) return -1;
sav1= sa->v1;
sav2= sa->v2;
@@ -507,16 +507,16 @@ int area_getorientation(ScrArea *sa, ScrArea *sb)
sbv3= sb->v3;
sbv4= sb->v4;
- if(sav1==sbv4 && sav2==sbv3) { /* sa to right of sb = W */
+ if (sav1==sbv4 && sav2==sbv3) { /* sa to right of sb = W */
return 0;
}
- else if(sav2==sbv1 && sav3==sbv4) { /* sa to bottom of sb = N */
+ else if (sav2==sbv1 && sav3==sbv4) { /* sa to bottom of sb = N */
return 1;
}
- else if(sav3==sbv2 && sav4==sbv1) { /* sa to left of sb = E */
+ else if (sav3==sbv2 && sav4==sbv1) { /* sa to left of sb = E */
return 2;
}
- else if(sav1==sbv2 && sav4==sbv3) { /* sa on top of sb = S*/
+ else if (sav1==sbv2 && sav4==sbv3) { /* sa on top of sb = S*/
return 3;
}
@@ -539,25 +539,25 @@ int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2)
return 0;
}
- if(dir == 0) {
+ if (dir == 0) {
sa1->v1= sa2->v1;
sa1->v2= sa2->v2;
screen_addedge(scr, sa1->v2, sa1->v3);
screen_addedge(scr, sa1->v1, sa1->v4);
}
- else if(dir == 1) {
+ else if (dir == 1) {
sa1->v2= sa2->v2;
sa1->v3= sa2->v3;
screen_addedge(scr, sa1->v1, sa1->v2);
screen_addedge(scr, sa1->v3, sa1->v4);
}
- else if(dir == 2) {
+ else if (dir == 2) {
sa1->v3= sa2->v3;
sa1->v4= sa2->v4;
screen_addedge(scr, sa1->v2, sa1->v3);
screen_addedge(scr, sa1->v1, sa1->v4);
}
- else if(dir == 3) {
+ else if (dir == 3) {
sa1->v1= sa2->v1;
sa1->v4= sa2->v4;
screen_addedge(scr, sa1->v1, sa1->v2);
@@ -581,11 +581,11 @@ void select_connected_scredge(bScreen *sc, ScrEdge *edge)
/* select connected, only in the right direction */
/* 'dir' is the direction of EDGE */
- if(edge->v1->vec.x==edge->v2->vec.x) dir= 'v';
+ if (edge->v1->vec.x==edge->v2->vec.x) dir= 'v';
else dir= 'h';
sv= sc->vertbase.first;
- while(sv) {
+ while (sv) {
sv->flag = 0;
sv= sv->next;
}
@@ -594,16 +594,16 @@ void select_connected_scredge(bScreen *sc, ScrEdge *edge)
edge->v2->flag= 1;
oneselected= 1;
- while(oneselected) {
+ while (oneselected) {
se= sc->edgebase.first;
oneselected= 0;
- while(se) {
- if(se->v1->flag + se->v2->flag==1) {
- if(dir=='h') if(se->v1->vec.y==se->v2->vec.y) {
+ while (se) {
+ if (se->v1->flag + se->v2->flag==1) {
+ if (dir=='h') if (se->v1->vec.y==se->v2->vec.y) {
se->v1->flag= se->v2->flag= 1;
oneselected= 1;
}
- if(dir=='v') if(se->v1->vec.x==se->v2->vec.x) {
+ if (dir=='v') if (se->v1->vec.x==se->v2->vec.x) {
se->v1->flag= se->v2->flag= 1;
oneselected= 1;
}
@@ -625,7 +625,7 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
min[0]= min[1]= 10000.0f;
max[0]= max[1]= 0.0f;
- for(sv= sc->vertbase.first; sv; sv= sv->next) {
+ for (sv= sc->vertbase.first; sv; sv= sv->next) {
min[0]= MIN2(min[0], sv->vec.x);
min[1]= MIN2(min[1], sv->vec.y);
max[0]= MAX2(max[0], sv->vec.x);
@@ -633,7 +633,7 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
}
/* always make 0.0 left under */
- for(sv= sc->vertbase.first; sv; sv= sv->next) {
+ for (sv= sc->vertbase.first; sv; sv= sv->next) {
sv->vec.x -= min[0];
sv->vec.y -= min[1];
}
@@ -641,14 +641,14 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
sizex= max[0]-min[0];
sizey= max[1]-min[1];
- if(sizex!= winsizex || sizey!= winsizey) {
+ if (sizex!= winsizex || sizey!= winsizey) {
facx= winsizex;
facx/= (float)sizex;
facy= winsizey;
facy/= (float)sizey;
/* make sure it fits! */
- for(sv= sc->vertbase.first; sv; sv= sv->next) {
+ for (sv= sc->vertbase.first; sv; sv= sv->next) {
/* FIXME, this re-sizing logic is no good when re-sizing the window + redrawing [#24428]
* need some way to store these as floats internally and re-apply from there. */
tempf= ((float)sv->vec.x)*facx;
@@ -671,13 +671,13 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
/* ton: removed option now, it needs Context... */
/* make each window at least ED_area_headersize() high */
- for(sa= sc->areabase.first; sa; sa= sa->next) {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
int headery= ED_area_headersize()+1;
- if(sa->v1->vec.y+headery > sa->v2->vec.y) {
+ if (sa->v1->vec.y+headery > sa->v2->vec.y) {
/* lower edge */
ScrEdge *se= screen_findedge(sc, sa->v4, sa->v1);
- if(se && sa->v1!=sa->v2 ) {
+ if (se && sa->v1!=sa->v2 ) {
int yval;
select_connected_scredge(sc, se);
@@ -685,10 +685,10 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
/* all selected vertices get the right offset */
yval= sa->v2->vec.y-headery;
sv= sc->vertbase.first;
- while(sv) {
+ while (sv) {
/* if is a collapsed area */
- if(sv!=sa->v2 && sv!=sa->v3) {
- if(sv->flag) sv->vec.y= yval;
+ if (sv!=sa->v2 && sv!=sa->v3) {
+ if (sv->flag) sv->vec.y= yval;
}
sv= sv->next;
}
@@ -714,7 +714,7 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir)
float width = sa->v3->vec.x - sa->v1->vec.x;
float height = sa->v3->vec.y - sa->v1->vec.y;
- if(height<width) {
+ if (height<width) {
h = height/8;
w = height/4;
}
@@ -753,10 +753,10 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir)
points[9].x = sa->v4->vec.x;
points[9].y = sa->v4->vec.y + height/2 + h;
- if(dir=='l') {
+ if (dir=='l') {
/* when direction is left, then we flip direction of arrow */
float cx = sa->v1->vec.x + width;
- for(i=0;i<10;i++) {
+ for (i=0;i<10;i++) {
points[i].x -= cx;
points[i].x = -points[i].x;
points[i].x += sa->v1->vec.x;
@@ -764,11 +764,11 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir)
}
glBegin(GL_POLYGON);
- for(i=0;i<5;i++)
+ for (i=0;i<5;i++)
glVertex2f(points[i].x, points[i].y);
glEnd();
glBegin(GL_POLYGON);
- for(i=4;i<8;i++)
+ for (i=4;i<8;i++)
glVertex2f(points[i].x, points[i].y);
glVertex2f(points[0].x, points[0].y);
glEnd();
@@ -786,7 +786,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
float width = sa->v3->vec.x - sa->v1->vec.x;
float height = sa->v3->vec.y - sa->v1->vec.y;
- if(height<width) {
+ if (height<width) {
h = height/4;
w = height/8;
}
@@ -825,10 +825,10 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
points[9].x = sa->v1->vec.x + width/2 + w;
points[9].y = sa->v1->vec.y;
- if(dir=='u') {
+ if (dir=='u') {
/* when direction is up, then we flip direction of arrow */
float cy = sa->v1->vec.y + height;
- for(i=0;i<10;i++) {
+ for (i=0;i<10;i++) {
points[i].y -= cy;
points[i].y = -points[i].y;
points[i].y += sa->v1->vec.y;
@@ -836,11 +836,11 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
}
glBegin(GL_POLYGON);
- for(i=0;i<5;i++)
+ for (i=0;i<5;i++)
glVertex2f(points[i].x, points[i].y);
glEnd();
glBegin(GL_POLYGON);
- for(i=4;i<8;i++)
+ for (i=4;i<8;i++)
glVertex2f(points[i].x, points[i].y);
glVertex2f(points[0].x, points[0].y);
glEnd();
@@ -852,7 +852,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
/* draw join shape due to direction of joining */
static void draw_join_shape(ScrArea *sa, char dir)
{
- if(dir=='u' || dir=='d')
+ if (dir=='u' || dir=='d')
draw_vertical_join_shape(sa, dir);
else
draw_horizontal_join_shape(sa, dir);
@@ -883,19 +883,19 @@ static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir))
static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, short x2, short y2, short a)
{
/* right border area */
- if(x2<sizex-1)
+ if (x2<sizex-1)
sdrawline(x2+a, y1, x2+a, y2);
/* left border area */
- if(x1>0) /* otherwise it draws the emboss of window over */
+ if (x1>0) /* otherwise it draws the emboss of window over */
sdrawline(x1+a, y1, x1+a, y2);
/* top border area */
- if(y2<sizey-1)
+ if (y2<sizey-1)
sdrawline(x1, y2+a, x2, y2+a);
/* bottom border area */
- if(y1>0)
+ if (y1>0)
sdrawline(x1, y1+a, x2, y1+a);
}
@@ -911,10 +911,10 @@ static void drawscredge_area(ScrArea *sa, int sizex, int sizey, int center)
rt= 0; // CLAMPIS(G.rt, 0, 16);
- if(center==0) {
+ if (center==0) {
cpack(0x505050);
- for(a=-rt; a<=rt; a++)
- if(a!=0)
+ for (a=-rt; a<=rt; a++)
+ if (a!=0)
drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, a);
}
else {
@@ -929,7 +929,7 @@ bScreen *ED_screen_duplicate(wmWindow *win, bScreen *sc)
{
bScreen *newsc;
- if(sc->full != SCREENNORMAL) return NULL; /* XXX handle this case! */
+ if (sc->full != SCREENNORMAL) return NULL; /* XXX handle this case! */
/* make new empty screen: */
newsc= ED_screen_add(win, sc->scene, sc->id.name+2);
@@ -944,11 +944,11 @@ static void region_cursor_set(wmWindow *win, int swinid)
{
ScrArea *sa= win->screen->areabase.first;
- for(;sa; sa= sa->next) {
+ for (;sa; sa= sa->next) {
ARegion *ar= sa->regionbase.first;
- for(;ar; ar= ar->next) {
- if(ar->swinid == swinid) {
- if(ar->type && ar->type->cursor)
+ for (;ar; ar= ar->next) {
+ if (ar->swinid == swinid) {
+ if (ar->type && ar->type->cursor)
ar->type->cursor(win, sa, ar);
else
WM_cursor_set(win, CURSOR_STD);
@@ -965,20 +965,20 @@ void ED_screen_do_listen(bContext *C, wmNotifier *note)
/* generic notes */
switch(note->category) {
case NC_WM:
- if(note->data==ND_FILEREAD)
+ if (note->data==ND_FILEREAD)
win->screen->do_draw= 1;
break;
case NC_WINDOW:
win->screen->do_draw= 1;
break;
case NC_SCREEN:
- if(note->data==ND_SUBWINACTIVE)
+ if (note->data==ND_SUBWINACTIVE)
uiFreeActiveButtons(C, win->screen);
- if(note->action==NA_EDITED)
+ if (note->action==NA_EDITED)
win->screen->do_draw= win->screen->do_refresh= 1;
break;
case NC_SCENE:
- if(note->data==ND_MODE)
+ if (note->data==ND_MODE)
region_cursor_set(win, note->swinid);
break;
}
@@ -996,13 +996,13 @@ void ED_screen_draw(wmWindow *win)
wmSubWindowSet(win, win->screen->mainwin);
- for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+ for (sa= win->screen->areabase.first; sa; sa= sa->next) {
if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa;
if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa;
if (sa->flag & (AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V)) sa3 = sa;
drawscredge_area(sa, win->sizex, win->sizey, 0);
}
- for(sa= win->screen->areabase.first; sa; sa= sa->next)
+ for (sa= win->screen->areabase.first; sa; sa= sa->next)
drawscredge_area(sa, win->sizex, win->sizey, 1);
/* blended join arrow */
@@ -1033,11 +1033,11 @@ void ED_screen_draw(wmWindow *win)
}
/* splitpoint */
- if(sa3) {
+ if (sa3) {
glEnable(GL_BLEND);
glColor4ub(255, 255, 255, 100);
- if(sa3->flag & AREA_FLAG_DRAWSPLIT_H) {
+ if (sa3->flag & AREA_FLAG_DRAWSPLIT_H) {
sdrawline(sa3->totrct.xmin, win->eventstate->y, sa3->totrct.xmax, win->eventstate->y);
glColor4ub(0, 0, 0, 100);
sdrawline(sa3->totrct.xmin, win->eventstate->y+1, sa3->totrct.xmax, win->eventstate->y+1);
@@ -1060,9 +1060,9 @@ static void screen_refresh_headersizes(void)
const ListBase *lb= BKE_spacetypes_list();
SpaceType *st;
- for(st= lb->first; st; st= st->next) {
+ for (st= lb->first; st; st= st->next) {
ARegionType *art= BKE_regiontype_from_id(st, RGN_TYPE_HEADER);
- if(art) art->prefsizey= ED_area_headersize();
+ if (art) art->prefsizey= ED_area_headersize();
}
}
@@ -1075,14 +1075,14 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
ScrArea *sa;
rcti winrct;
- winrct.xmin= 0;
- winrct.xmax= win->sizex-1;
- winrct.ymin= 0;
- winrct.ymax= win->sizey-1;
+ winrct.xmin = 0;
+ winrct.xmax = win->sizex-1;
+ winrct.ymin = 0;
+ winrct.ymax = win->sizey-1;
screen_test_scale(win->screen, win->sizex, win->sizey);
- if(win->screen->mainwin==0)
+ if (win->screen->mainwin==0)
win->screen->mainwin= wm_subwindow_open(win, &winrct);
else
wm_subwindow_position(win, win->screen->mainwin, &winrct);
@@ -1090,18 +1090,18 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
/* header size depends on DPI, let's verify */
screen_refresh_headersizes();
- for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+ for (sa= win->screen->areabase.first; sa; sa= sa->next) {
/* set spacetype and region callbacks, calls init() */
/* sets subwindows for regions, adds handlers */
ED_area_initialize(wm, win, sa);
}
/* wake up animtimer */
- if(win->screen->animtimer)
+ if (win->screen->animtimer)
WM_event_timer_sleep(wm, win, win->screen->animtimer, 0);
}
- if(G.f & G_DEBUG) printf("set screen\n");
+ if (G.f & G_DEBUG) printf("set screen\n");
win->screen->do_refresh= 0;
win->screen->context= ed_screen_context;
@@ -1112,9 +1112,9 @@ void ED_screens_initialize(wmWindowManager *wm)
{
wmWindow *win;
- for(win= wm->windows.first; win; win= win->next) {
+ for (win= wm->windows.first; win; win= win->next) {
- if(win->screen==NULL)
+ if (win->screen==NULL)
win->screen= G.main->screen.first;
ED_screen_refresh(wm, win);
@@ -1130,11 +1130,11 @@ void ED_region_exit(bContext *C, ARegion *ar)
CTX_wm_region_set(C, ar);
WM_event_remove_handlers(C, &ar->handlers);
- if(ar->swinid)
+ if (ar->swinid)
wm_subwindow_close(CTX_wm_window(C), ar->swinid);
ar->swinid= 0;
- if(ar->headerstr)
+ if (ar->headerstr)
MEM_freeN(ar->headerstr);
ar->headerstr= NULL;
@@ -1148,13 +1148,13 @@ void ED_area_exit(bContext *C, ScrArea *sa)
if (sa->spacetype == SPACE_FILE) {
SpaceLink *sl= sa->spacedata.first;
- if(sl && sl->spacetype == SPACE_FILE) {
+ if (sl && sl->spacetype == SPACE_FILE) {
ED_fileselect_exit(C, (SpaceFile *)sl);
}
}
CTX_wm_area_set(C, sa);
- for(ar= sa->regionbase.first; ar; ar= ar->next)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
ED_region_exit(C, ar);
WM_event_remove_handlers(C, &sa->handlers);
@@ -1170,19 +1170,19 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
CTX_wm_window_set(C, window);
- if(screen->animtimer)
+ if (screen->animtimer)
WM_event_remove_timer(wm, window, screen->animtimer);
screen->animtimer= NULL;
- if(screen->mainwin)
+ if (screen->mainwin)
wm_subwindow_close(window, screen->mainwin);
screen->mainwin= 0;
screen->subwinactive= 0;
- for(ar= screen->regionbase.first; ar; ar= ar->next)
+ for (ar= screen->regionbase.first; ar; ar= ar->next)
ED_region_exit(C, ar);
- for(sa= screen->areabase.first; sa; sa= sa->next)
+ for (sa= screen->areabase.first; sa; sa= sa->next)
ED_area_exit(C, sa);
/* mark it available for use for other windows */
@@ -1191,7 +1191,8 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
if (prevwin->screen->temp == 0) {
/* use previous window if possible */
CTX_wm_window_set(C, prevwin);
- } else {
+ }
+ else {
/* none otherwise */
CTX_wm_window_set(C, NULL);
}
@@ -1206,15 +1207,15 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
AZone *az= NULL;
ScrArea *sa;
- for(sa= win->screen->areabase.first; sa; sa= sa->next)
- if((az=is_in_area_actionzone(sa, event->x, event->y)))
+ for (sa= win->screen->areabase.first; sa; sa= sa->next)
+ if ((az=is_in_area_actionzone(sa, event->x, event->y)))
break;
- if(sa) {
- if(az->type==AZONE_AREA)
+ if (sa) {
+ if (az->type==AZONE_AREA)
WM_cursor_set(win, CURSOR_EDIT);
- else if(az->type==AZONE_REGION) {
- if(az->edge == AE_LEFT_TO_TOPRIGHT || az->edge == AE_RIGHT_TO_TOPLEFT)
+ else if (az->type==AZONE_REGION) {
+ if (az->edge == AE_LEFT_TO_TOPRIGHT || az->edge == AE_RIGHT_TO_TOPLEFT)
WM_cursor_set(win, CURSOR_X_MOVE);
else
WM_cursor_set(win, CURSOR_Y_MOVE);
@@ -1224,7 +1225,7 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
ScrEdge *actedge= screen_find_active_scredge(win->screen, event->x, event->y);
if (actedge) {
- if(scredge_is_horizontal(actedge))
+ if (scredge_is_horizontal(actedge))
WM_cursor_set(win, CURSOR_Y_MOVE);
else
WM_cursor_set(win, CURSOR_X_MOVE);
@@ -1241,21 +1242,21 @@ void ED_screen_set_subwinactive(bContext *C, wmEvent *event)
{
wmWindow *win= CTX_wm_window(C);
- if(win->screen) {
+ if (win->screen) {
bScreen *scr= win->screen;
ScrArea *sa;
ARegion *ar;
int oldswin= scr->subwinactive;
- for(sa= scr->areabase.first; sa; sa= sa->next) {
- if(event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
- if(event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
- if(NULL==is_in_area_actionzone(sa, event->x, event->y))
+ for (sa= scr->areabase.first; sa; sa= sa->next) {
+ if (event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
+ if (event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
+ if (NULL==is_in_area_actionzone(sa, event->x, event->y))
break;
}
- if(sa) {
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
- if(BLI_in_rcti(&ar->winrct, event->x, event->y))
+ if (sa) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (BLI_in_rcti(&ar->winrct, event->x, event->y))
scr->subwinactive= ar->swinid;
}
}
@@ -1263,28 +1264,28 @@ void ED_screen_set_subwinactive(bContext *C, wmEvent *event)
scr->subwinactive= scr->mainwin;
/* check for redraw headers */
- if(oldswin!=scr->subwinactive) {
+ if (oldswin!=scr->subwinactive) {
- for(sa= scr->areabase.first; sa; sa= sa->next) {
+ for (sa= scr->areabase.first; sa; sa= sa->next) {
int do_draw= 0;
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->swinid==oldswin || ar->swinid==scr->subwinactive)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
+ if (ar->swinid==oldswin || ar->swinid==scr->subwinactive)
do_draw= 1;
- if(do_draw) {
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_HEADER)
+ if (do_draw) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
+ if (ar->regiontype==RGN_TYPE_HEADER)
ED_region_tag_redraw(ar);
}
}
}
/* cursors, for time being set always on edges, otherwise aregion doesnt switch */
- if(scr->subwinactive==scr->mainwin) {
+ if (scr->subwinactive==scr->mainwin) {
screen_cursor_set(win, event);
}
- else if(oldswin!=scr->subwinactive) {
+ else if (oldswin!=scr->subwinactive) {
region_cursor_set(win, scr->subwinactive);
WM_event_add_notifier(C, NC_SCREEN|ND_SUBWINACTIVE, scr);
}
@@ -1297,15 +1298,15 @@ int ED_screen_area_active(const bContext *C)
bScreen *sc= CTX_wm_screen(C);
ScrArea *sa= CTX_wm_area(C);
- if(win && sc && sa) {
+ if (win && sc && sa) {
AZone *az= is_in_area_actionzone(sa, win->eventstate->x, win->eventstate->y);
ARegion *ar;
if (az && az->type == AZONE_REGION)
return 1;
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->swinid == sc->subwinactive)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
+ if (ar->swinid == sc->subwinactive)
return 1;
}
return 0;
@@ -1321,21 +1322,21 @@ void ED_screen_set(bContext *C, bScreen *sc)
ID *id;
/* validate screen, it's called with notifier reference */
- for(id= CTX_data_main(C)->screen.first; id; id= id->next)
- if(sc == (bScreen *)id)
+ for (id= CTX_data_main(C)->screen.first; id; id= id->next)
+ if (sc == (bScreen *)id)
break;
- if(id==NULL)
+ if (id==NULL)
return;
/* check for valid winid */
- if(sc->winid!=0 && sc->winid!=win->winid)
+ if (sc->winid!=0 && sc->winid!=win->winid)
return;
- if(sc->full) { /* find associated full */
+ if (sc->full) { /* find associated full */
bScreen *sc1;
- for(sc1= CTX_data_main(C)->screen.first; sc1; sc1= sc1->id.next) {
+ for (sc1= CTX_data_main(C)->screen.first; sc1; sc1= sc1->id.next) {
ScrArea *sa= sc1->areabase.first;
- if(sa->full==sc) {
+ if (sa->full==sc) {
sc= sc1;
break;
}
@@ -1347,13 +1348,13 @@ void ED_screen_set(bContext *C, bScreen *sc)
ScrArea *sa;
/* remove handlers referencing areas in old screen */
- for(sa = oldscreen->areabase.first; sa; sa = sa->next) {
+ for (sa = oldscreen->areabase.first; sa; sa = sa->next) {
WM_event_remove_area_handler(&win->modalhandlers, sa);
}
/* we put timer to sleep, so screen_exit has to think there's no timer */
oldscreen->animtimer= NULL;
- if(wt)
+ if (wt)
WM_event_timer_sleep(wm, win, wt, 1);
ED_screen_exit(C, win, oldscreen);
@@ -1378,8 +1379,8 @@ static int ed_screen_used(wmWindowManager *wm, bScreen *sc)
{
wmWindow *win;
- for(win=wm->windows.first; win; win=win->next)
- if(win->screen == sc)
+ for (win=wm->windows.first; win; win=win->next)
+ if (win->screen == sc)
return 1;
return 0;
@@ -1404,22 +1405,22 @@ void ED_screen_delete(bContext *C, bScreen *sc)
* long as we are able to find a screen that is unused, we
* can safely assume ours is not in use anywhere an delete it */
- for(newsc= sc->id.prev; newsc; newsc=newsc->id.prev)
- if(!ed_screen_used(wm, newsc))
+ for (newsc= sc->id.prev; newsc; newsc=newsc->id.prev)
+ if (!ed_screen_used(wm, newsc))
break;
- if(!newsc) {
- for(newsc= sc->id.next; newsc; newsc=newsc->id.next)
- if(!ed_screen_used(wm, newsc))
+ if (!newsc) {
+ for (newsc= sc->id.next; newsc; newsc=newsc->id.next)
+ if (!ed_screen_used(wm, newsc))
break;
}
- if(!newsc)
+ if (!newsc)
return;
ED_screen_set(C, newsc);
- if(delete && win->screen != sc)
+ if (delete && win->screen != sc)
free_libblock(&bmain->screen, sc);
}
@@ -1429,19 +1430,19 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene)
Main *bmain= CTX_data_main(C);
bScreen *sc;
- if(screen == NULL)
+ if (screen == NULL)
return;
- if(ed_screen_used(CTX_wm_manager(C), screen))
+ if (ed_screen_used(CTX_wm_manager(C), screen))
ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
- for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
- if((U.flag & USER_SCENEGLOBAL) || sc==screen) {
+ for (sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
+ if ((U.flag & USER_SCENEGLOBAL) || sc==screen) {
- if(scene != sc->scene) {
+ if (scene != sc->scene) {
/* all areas endlocalview */
// XXX ScrArea *sa= sc->areabase.first;
- // while(sa) {
+ // while (sa) {
// endlocalview(sa);
// sa= sa->next;
// }
@@ -1454,13 +1455,13 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene)
// copy_view3d_lock(0); /* space.c */
/* are there cameras in the views that are not in the scene? */
- for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
- if( (U.flag & USER_SCENEGLOBAL) || sc==screen) {
+ for (sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
+ if ( (U.flag & USER_SCENEGLOBAL) || sc==screen) {
ScrArea *sa= sc->areabase.first;
- while(sa) {
+ while (sa) {
SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ while (sl) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D*) sl;
BKE_screen_view3d_sync(v3d, scene);
@@ -1470,11 +1471,11 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene)
// XXX if (sc==curscreen) handle_view3d_lock();
if (!v3d->camera) {
ARegion *ar;
- for(ar=v3d->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW) {
+ for (ar=v3d->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d= ar->regiondata;
- if(rv3d->persp==RV3D_CAMOB)
+ if (rv3d->persp==RV3D_CAMOB)
rv3d->persp= RV3D_PERSP;
}
}
@@ -1505,9 +1506,9 @@ void ED_screen_delete_scene(bContext *C, Scene *scene)
Main *bmain= CTX_data_main(C);
Scene *newscene;
- if(scene->id.prev)
+ if (scene->id.prev)
newscene= scene->id.prev;
- else if(scene->id.next)
+ else if (scene->id.next)
newscene= scene->id.next;
else
return;
@@ -1523,11 +1524,11 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
bScreen *screen= CTX_wm_screen(C);
ScrArea *newsa= NULL;
- if(!sa || sa->full==NULL) {
+ if (!sa || sa->full==NULL) {
newsa= ED_screen_full_toggle(C, win, sa);
}
- if(!newsa) {
+ if (!newsa) {
if (sa->full) {
/* if this has been called from the temporary info header generated in
* temp fullscreen layouts, find the correct fullscreen area to change
@@ -1536,8 +1537,10 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
if (!(sa->flag & AREA_TEMP_INFO))
break;
}
- } else
- newsa= sa;
+ }
+ else {
+ newsa = sa;
+ }
}
ED_area_newspace(C, newsa, type);
@@ -1551,7 +1554,7 @@ void ED_screen_full_prevspace(bContext *C, ScrArea *sa)
ED_area_prevspace(C, sa);
- if(sa->full)
+ if (sa->full)
ED_screen_full_toggle(C, win, sa);
}
@@ -1584,10 +1587,13 @@ void ED_screen_full_restore(bContext *C, ScrArea *sa)
sima->flag &= ~SI_FULLWINDOW;
ED_screen_full_prevspace(C, sa);
}
- } else if (sl->spacetype == SPACE_FILE) {
+ }
+ else if (sl->spacetype == SPACE_FILE) {
ED_screen_full_prevspace(C, sa);
- } else
+ }
+ else {
ED_screen_full_toggle(C, win, sa);
+ }
}
/* otherwise just tile the area again */
else {
@@ -1601,18 +1607,18 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
bScreen *sc, *oldscreen;
ARegion *ar;
- if(sa) {
+ if (sa) {
/* ensure we don't have a button active anymore, can crash when
* switching screens with tooltip open because region and tooltip
* are no longer in the same screen */
- for(ar=sa->regionbase.first; ar; ar=ar->next)
+ for (ar=sa->regionbase.first; ar; ar=ar->next)
uiFreeBlocks(C, &ar->uiblocks);
/* prevent hanging header prints */
ED_area_headerprint(sa, NULL);
}
- if(sa && sa->full) {
+ if (sa && sa->full) {
ScrArea *old;
/*short fulltype;*/ /*UNUSED*/
@@ -1625,9 +1631,9 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
/* removed: SCREENAUTOPLAY exception here */
/* find old area */
- for(old= sc->areabase.first; old; old= old->next)
- if(old->full) break;
- if(old==NULL) {
+ for (old= sc->areabase.first; old; old= old->next)
+ if (old->full) break;
+ if (old==NULL) {
if (G.f & G_DEBUG)
printf("something wrong in areafullscreen\n");
return NULL;
@@ -1656,7 +1662,7 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
/* nothing wrong with having only 1 area, as far as I can see...
* is there only 1 area? */
#if 0
- if(oldscreen->areabase.first==oldscreen->areabase.last)
+ if (oldscreen->areabase.first==oldscreen->areabase.last)
return NULL;
#endif
@@ -1675,7 +1681,7 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
/* use random area when we have no active one, e.g. when the
* mouse is outside of the window and we open a file browser */
- if(!sa)
+ if (!sa)
sa= oldscreen->areabase.first;
/* copy area */
@@ -1732,11 +1738,11 @@ void ED_screen_animation_timer(bContext *C, int redraws, int refresh, int sync,
wmWindow *win= CTX_wm_window(C);
Scene *scene= CTX_data_scene(C);
- if(screen->animtimer)
+ if (screen->animtimer)
WM_event_remove_timer(wm, win, screen->animtimer);
screen->animtimer= NULL;
- if(enable) {
+ if (enable) {
ScreenAnimData *sad= MEM_callocN(sizeof(ScreenAnimData), "ScreenAnimData");
screen->animtimer= WM_event_add_timer(wm, win, TIMER0, (1.0/FPS));
@@ -1744,7 +1750,7 @@ void ED_screen_animation_timer(bContext *C, int redraws, int refresh, int sync,
sad->ar= CTX_wm_region(C);
/* if startframe is larger than current frame, we put currentframe on startframe.
* note: first frame then is not drawn! (ton) */
- if(scene->r.sfra > scene->r.cfra) {
+ if (scene->r.sfra > scene->r.cfra) {
sad->sfra= scene->r.cfra;
scene->r.cfra= scene->r.sfra;
}
@@ -1769,12 +1775,12 @@ static ARegion *time_top_left_3dwindow(bScreen *screen)
ScrArea *sa;
int min= 10000;
- for(sa= screen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_VIEW3D) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ if (sa->spacetype==SPACE_VIEW3D) {
ARegion *ar;
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype==RGN_TYPE_WINDOW) {
- if(ar->winrct.xmin - ar->winrct.ymin < min) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype==RGN_TYPE_WINDOW) {
+ if (ar->winrct.xmin - ar->winrct.ymin < min) {
aret= ar;
min= ar->winrct.xmin - ar->winrct.ymin;
}
@@ -1788,14 +1794,14 @@ static ARegion *time_top_left_3dwindow(bScreen *screen)
void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh)
{
- if(screen && screen->animtimer) {
+ if (screen && screen->animtimer) {
wmTimer *wt= screen->animtimer;
ScreenAnimData *sad= wt->customdata;
sad->redraws= redraws;
sad->refresh= refresh;
sad->ar= NULL;
- if(redraws & TIME_REGION)
+ if (redraws & TIME_REGION)
sad->ar= time_top_left_3dwindow(screen);
}
}
@@ -1806,11 +1812,11 @@ void ED_update_for_newframe(Main *bmain, Scene *scene, bScreen *screen, int UNUS
{
#ifdef DURIAN_CAMERA_SWITCH
void *camera= scene_camera_switch_find(scene);
- if(camera && scene->camera != camera) {
+ if (camera && scene->camera != camera) {
bScreen *sc;
scene->camera= camera;
/* are there cameras in the views that are not in the scene? */
- for(sc= bmain->screen.first; sc; sc= sc->id.next) {
+ for (sc= bmain->screen.first; sc; sc= sc->id.next) {
BKE_screen_view3d_scene_sync(sc);
}
}
@@ -1819,7 +1825,7 @@ void ED_update_for_newframe(Main *bmain, Scene *scene, bScreen *screen, int UNUS
//extern void audiostream_scrub(unsigned int frame); /* seqaudio.c */
/* update animated image textures for gpu, etc,
- * call before scene_update_for_newframe so modifiers with textuers dont lag 1 frame */
+ * call before scene_update_for_newframe so modifiers with textuers don't lag 1 frame */
ED_image_update_frame(bmain, scene->r.cfra);
ED_clip_update_frame(bmain, scene->r.cfra);
@@ -1838,15 +1844,15 @@ void ED_update_for_newframe(Main *bmain, Scene *scene, bScreen *screen, int UNUS
//BIF_image_update_frame();
/* composite */
- if(scene->use_nodes && scene->nodetree)
+ if (scene->use_nodes && scene->nodetree)
ntreeCompositTagAnimated(scene->nodetree);
/* update animated texture nodes */
{
Tex *tex;
- for(tex= bmain->tex.first; tex; tex= tex->id.next)
- if( tex->use_nodes && tex->nodetree ) {
- ntreeTexTagAnimated( tex->nodetree );
+ for (tex= bmain->tex.first; tex; tex= tex->id.next)
+ if (tex->use_nodes && tex->nodetree) {
+ ntreeTexTagAnimated(tex->nodetree);
}
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index b1d718f08b5..d6a74cc19ce 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -89,42 +89,42 @@
int ED_operator_regionactive(bContext *C)
{
- if(CTX_wm_window(C)==NULL) return 0;
- if(CTX_wm_screen(C)==NULL) return 0;
- if(CTX_wm_region(C)==NULL) return 0;
+ if (CTX_wm_window(C)==NULL) return 0;
+ if (CTX_wm_screen(C)==NULL) return 0;
+ if (CTX_wm_region(C)==NULL) return 0;
return 1;
}
int ED_operator_areaactive(bContext *C)
{
- if(CTX_wm_window(C)==NULL) return 0;
- if(CTX_wm_screen(C)==NULL) return 0;
- if(CTX_wm_area(C)==NULL) return 0;
+ if (CTX_wm_window(C)==NULL) return 0;
+ if (CTX_wm_screen(C)==NULL) return 0;
+ if (CTX_wm_area(C)==NULL) return 0;
return 1;
}
int ED_operator_screenactive(bContext *C)
{
- if(CTX_wm_window(C)==NULL) return 0;
- if(CTX_wm_screen(C)==NULL) return 0;
+ if (CTX_wm_window(C)==NULL) return 0;
+ if (CTX_wm_screen(C)==NULL) return 0;
return 1;
}
/* XXX added this to prevent anim state to change during renders */
static int ED_operator_screenactive_norender(bContext *C)
{
- if(G.rendering) return 0;
- if(CTX_wm_window(C)==NULL) return 0;
- if(CTX_wm_screen(C)==NULL) return 0;
+ if (G.rendering) return 0;
+ if (CTX_wm_window(C)==NULL) return 0;
+ if (CTX_wm_screen(C)==NULL) return 0;
return 1;
}
static int screen_active_editable(bContext *C)
{
- if(ED_operator_screenactive(C)) {
+ if (ED_operator_screenactive(C)) {
/* no full window splitting allowed */
- if(CTX_wm_screen(C)->full != SCREENNORMAL)
+ if (CTX_wm_screen(C)->full != SCREENNORMAL)
return 0;
return 1;
}
@@ -134,8 +134,8 @@ static int screen_active_editable(bContext *C)
/* when mouse is over area-edge */
int ED_operator_screen_mainwinactive(bContext *C)
{
- if(CTX_wm_window(C)==NULL) return 0;
- if(CTX_wm_screen(C)==NULL) return 0;
+ if (CTX_wm_window(C)==NULL) return 0;
+ if (CTX_wm_screen(C)==NULL) return 0;
if (CTX_wm_screen(C)->subwinactive!=CTX_wm_screen(C)->mainwin) return 0;
return 1;
}
@@ -143,7 +143,7 @@ int ED_operator_screen_mainwinactive(bContext *C)
int ED_operator_scene_editable(bContext *C)
{
Scene *scene= CTX_data_scene(C);
- if(scene && scene->id.lib==NULL)
+ if (scene && scene->id.lib==NULL)
return 1;
return 0;
}
@@ -153,13 +153,13 @@ int ED_operator_objectmode(bContext *C)
Scene *scene= CTX_data_scene(C);
Object *obact= CTX_data_active_object(C);
- if(scene==NULL || scene->id.lib)
+ if (scene==NULL || scene->id.lib)
return 0;
- if( CTX_data_edit_object(C) )
+ if ( CTX_data_edit_object(C) )
return 0;
/* add a check for ob->mode too? */
- if(obact && obact->mode)
+ if (obact && obact->mode)
return 0;
return 1;
@@ -168,7 +168,7 @@ int ED_operator_objectmode(bContext *C)
static int ed_spacetype_test(bContext *C, int type)
{
- if(ED_operator_areaactive(C)) {
+ if (ED_operator_areaactive(C)) {
SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C);
return sl && (sl->spacetype == type);
}
@@ -182,7 +182,7 @@ int ED_operator_view3d_active(bContext *C)
int ED_operator_region_view3d_active(bContext *C)
{
- if(CTX_wm_region_view3d(C))
+ if (CTX_wm_region_view3d(C))
return TRUE;
CTX_wm_operator_poll_msg_set(C, "expected a view3d region");
@@ -192,7 +192,7 @@ int ED_operator_region_view3d_active(bContext *C)
/* generic for any view2d which uses anim_ops */
int ED_operator_animview_active(bContext *C)
{
- if(ED_operator_areaactive(C)) {
+ if (ED_operator_areaactive(C)) {
SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C);
if (sl && (ELEM5(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_IPO, SPACE_TIME)))
return TRUE;
@@ -214,10 +214,10 @@ int ED_operator_outliner_active(bContext *C)
int ED_operator_outliner_active_no_editobject(bContext *C)
{
- if(ed_spacetype_test(C, SPACE_OUTLINER)) {
+ if (ed_spacetype_test(C, SPACE_OUTLINER)) {
Object *ob = ED_object_active_context(C);
Object *obedit= CTX_data_edit_object(C);
- if(ob && ob == obedit)
+ if (ob && ob == obedit)
return 0;
else
return 1;
@@ -244,7 +244,7 @@ int ED_operator_node_active(bContext *C)
{
SpaceNode *snode= CTX_wm_space_node(C);
- if(snode && snode->edittree)
+ if (snode && snode->edittree)
return 1;
return 0;
@@ -314,7 +314,7 @@ int ED_operator_object_active_editable_font(bContext *C)
int ED_operator_editmesh(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_MESH)
+ if (obedit && obedit->type==OB_MESH)
return NULL != BMEdit_FromObject(obedit);
return 0;
}
@@ -326,7 +326,7 @@ int ED_operator_editmesh_view3d(bContext *C)
int ED_operator_editmesh_region_view3d(bContext *C)
{
- if(ED_operator_editmesh(C) && CTX_wm_region_view3d(C))
+ if (ED_operator_editmesh(C) && CTX_wm_region_view3d(C))
return 1;
CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editmesh");
@@ -336,7 +336,7 @@ int ED_operator_editmesh_region_view3d(bContext *C)
int ED_operator_editarmature(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_ARMATURE)
+ if (obedit && obedit->type==OB_ARMATURE)
return NULL != ((bArmature *)obedit->data)->edbo;
return 0;
}
@@ -347,8 +347,8 @@ int ED_operator_posemode(bContext *C)
if (obact && !(obact->mode & OB_MODE_EDIT)) {
Object *obpose;
- if((obpose= object_pose_armature_get(obact))) {
- if((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) {
+ if ((obpose= object_pose_armature_get(obact))) {
+ if ((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) {
return 1;
}
}
@@ -370,11 +370,11 @@ int ED_operator_uvmap(bContext *C)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = NULL;
- if(obedit && obedit->type == OB_MESH) {
+ if (obedit && obedit->type == OB_MESH) {
em = BMEdit_FromObject(obedit);
}
- if(em && (em->bm->totface)) {
+ if (em && (em->bm->totface)) {
return TRUE;
}
@@ -384,14 +384,14 @@ int ED_operator_uvmap(bContext *C)
int ED_operator_editsurfcurve(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && ELEM(obedit->type, OB_CURVE, OB_SURF))
+ if (obedit && ELEM(obedit->type, OB_CURVE, OB_SURF))
return NULL != ((Curve *)obedit->data)->editnurb;
return 0;
}
int ED_operator_editsurfcurve_region_view3d(bContext *C)
{
- if(ED_operator_editsurfcurve(C) && CTX_wm_region_view3d(C))
+ if (ED_operator_editsurfcurve(C) && CTX_wm_region_view3d(C))
return 1;
CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editcurve");
@@ -401,7 +401,7 @@ int ED_operator_editsurfcurve_region_view3d(bContext *C)
int ED_operator_editcurve(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_CURVE)
+ if (obedit && obedit->type==OB_CURVE)
return NULL != ((Curve *)obedit->data)->editnurb;
return 0;
}
@@ -409,7 +409,7 @@ int ED_operator_editcurve(bContext *C)
int ED_operator_editcurve_3d(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_CURVE) {
+ if (obedit && obedit->type==OB_CURVE) {
Curve *cu= (Curve *)obedit->data;
return (cu->flag&CU_3D) && (NULL != cu->editnurb);
@@ -420,7 +420,7 @@ int ED_operator_editcurve_3d(bContext *C)
int ED_operator_editsurf(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_SURF)
+ if (obedit && obedit->type==OB_SURF)
return NULL != ((Curve *)obedit->data)->editnurb;
return 0;
}
@@ -428,7 +428,7 @@ int ED_operator_editsurf(bContext *C)
int ED_operator_editfont(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_FONT)
+ if (obedit && obedit->type==OB_FONT)
return NULL != ((Curve *)obedit->data)->editfont;
return 0;
}
@@ -436,7 +436,7 @@ int ED_operator_editfont(bContext *C)
int ED_operator_editlattice(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_LATTICE)
+ if (obedit && obedit->type==OB_LATTICE)
return NULL != ((Lattice *)obedit->data)->editlatt;
return 0;
}
@@ -444,7 +444,7 @@ int ED_operator_editlattice(bContext *C)
int ED_operator_editmball(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_MBALL)
+ if (obedit && obedit->type==OB_MBALL)
return NULL != ((MetaBall *)obedit->data)->editelems;
return 0;
}
@@ -484,8 +484,8 @@ static ScrArea *screen_areahascursor(bScreen *scr, int x, int y)
{
ScrArea *sa= NULL;
sa= scr->areabase.first;
- while(sa) {
- if(BLI_in_rcti(&sa->totrct, x, y)) break;
+ while (sa) {
+ if (BLI_in_rcti(&sa->totrct, x, y)) break;
sa= sa->next;
}
@@ -498,13 +498,13 @@ static int actionzone_area_poll(bContext *C)
wmWindow *win= CTX_wm_window(C);
ScrArea *sa= CTX_wm_area(C);
- if(sa && win) {
+ if (sa && win) {
AZone *az;
int x= win->eventstate->x;
int y= win->eventstate->y;
- for(az= sa->actionzones.first; az; az= az->next)
- if(BLI_in_rcti(&az->rect, x, y))
+ for (az= sa->actionzones.first; az; az= az->next)
+ if (BLI_in_rcti(&az->rect, x, y))
return 1;
}
return 0;
@@ -514,16 +514,16 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
{
AZone *az= NULL;
- for(az= sa->actionzones.first; az; az= az->next) {
- if(BLI_in_rcti(&az->rect, x, y)) {
- if(az->type == AZONE_AREA) {
+ for (az= sa->actionzones.first; az; az= az->next) {
+ if (BLI_in_rcti(&az->rect, x, y)) {
+ if (az->type == AZONE_AREA) {
/* no triangle intersect but a hotspot circle based on corner */
int radius= (x-az->x1)*(x-az->x1) + (y-az->y1)*(y-az->y1);
- if(radius <= AZONESPOT*AZONESPOT)
+ if (radius <= AZONESPOT*AZONESPOT)
break;
}
- else if(az->type == AZONE_REGION) {
+ else if (az->type == AZONE_REGION) {
break;
}
}
@@ -535,7 +535,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
static void actionzone_exit(wmOperator *op)
{
- if(op->customdata)
+ if (op->customdata)
MEM_freeN(op->customdata);
op->customdata= NULL;
}
@@ -550,7 +550,7 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type)
sad->modifier= RNA_int_get(op->ptr, "modifier");
event= *(win->eventstate); /* XXX huh huh? make api call */
- if(type==AZONE_AREA)
+ if (type==AZONE_AREA)
event.type= EVT_ACTIONZONE_AREA;
else
event.type= EVT_ACTIONZONE_REGION;
@@ -567,7 +567,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event)
sActionzoneData *sad;
/* quick escape */
- if(az==NULL)
+ if (az==NULL)
return OPERATOR_PASS_THROUGH;
/* ok we do the actionzone */
@@ -577,7 +577,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event)
sad->x= event->x; sad->y= event->y;
/* region azone directly reacts on mouse clicks */
- if(sad->az->type==AZONE_REGION) {
+ if (sad->az->type==AZONE_REGION) {
actionzone_apply(C, op, AZONE_REGION);
actionzone_exit(op);
return OPERATOR_FINISHED;
@@ -603,17 +603,17 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event)
deltax= (event->x - sad->x);
deltay= (event->y - sad->y);
- if(deltay > ABS(deltax))
+ if (deltay > ABS(deltax))
sad->gesture_dir= 'n';
- else if(deltax > ABS(deltay))
+ else if (deltax > ABS(deltay))
sad->gesture_dir= 'e';
- else if(deltay < -ABS(deltax))
+ else if (deltay < -ABS(deltax))
sad->gesture_dir= 's';
else
sad->gesture_dir= 'w';
/* gesture is large enough? */
- if(ABS(deltax) > mindelta || ABS(deltay) > mindelta) {
+ if (ABS(deltax) > mindelta || ABS(deltay) > mindelta) {
/* second area, for join */
sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
@@ -646,16 +646,16 @@ static int actionzone_cancel(bContext *UNUSED(C), wmOperator *op)
static void SCREEN_OT_actionzone(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Handle area action zones";
- ot->description= "Handle area action zones for mouse actions/gestures";
- ot->idname= "SCREEN_OT_actionzone";
+ ot->name = "Handle area action zones";
+ ot->description = "Handle area action zones for mouse actions/gestures";
+ ot->idname = "SCREEN_OT_actionzone";
- ot->invoke= actionzone_invoke;
- ot->modal= actionzone_modal;
- ot->poll= actionzone_area_poll;
- ot->cancel= actionzone_cancel;
+ ot->invoke = actionzone_invoke;
+ ot->modal = actionzone_modal;
+ ot->poll = actionzone_area_poll;
+ ot->cancel = actionzone_cancel;
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
RNA_def_int(ot->srna, "modifier", 0, 0, 2, "Modifier", "Modifier state", 0, 2);
}
@@ -691,7 +691,7 @@ static int area_swap_init(wmOperator *op, wmEvent *event)
sAreaSwapData *sd= NULL;
sActionzoneData *sad= event->customdata;
- if(sad==NULL || sad->sa1==NULL)
+ if (sad==NULL || sad->sa1==NULL)
return 0;
sd= MEM_callocN(sizeof(sAreaSwapData), "sAreaSwapData");
@@ -706,7 +706,7 @@ static int area_swap_init(wmOperator *op, wmEvent *event)
static void area_swap_exit(bContext *C, wmOperator *op)
{
WM_cursor_restore(CTX_wm_window(C));
- if(op->customdata)
+ if (op->customdata)
MEM_freeN(op->customdata);
op->customdata= NULL;
}
@@ -720,7 +720,7 @@ static int area_swap_cancel(bContext *C, wmOperator *op)
static int area_swap_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!area_swap_init(op, event))
+ if (!area_swap_init(op, event))
return OPERATOR_PASS_THROUGH;
/* add modal handler */
@@ -741,8 +741,8 @@ static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event)
sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
break;
case LEFTMOUSE: /* release LMB */
- if(event->val==KM_RELEASE) {
- if(!sad->sa2 || sad->sa1 == sad->sa2) {
+ if (event->val==KM_RELEASE) {
+ if (!sad->sa2 || sad->sa1 == sad->sa2) {
return area_swap_cancel(C, op);
}
@@ -768,16 +768,16 @@ static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event)
static void SCREEN_OT_area_swap(wmOperatorType *ot)
{
- ot->name= "Swap areas";
- ot->description= "Swap selected areas screen positions";
- ot->idname= "SCREEN_OT_area_swap";
+ ot->name = "Swap areas";
+ ot->description = "Swap selected areas screen positions";
+ ot->idname = "SCREEN_OT_area_swap";
- ot->invoke= area_swap_invoke;
- ot->modal= area_swap_modal;
- ot->poll= ED_operator_areaactive;
- ot->cancel= area_swap_cancel;
+ ot->invoke = area_swap_invoke;
+ ot->modal = area_swap_modal;
+ ot->poll = ED_operator_areaactive;
+ ot->cancel = area_swap_cancel;
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
}
/* *********** Duplicate area as new window operator ****************** */
@@ -795,18 +795,18 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
sa= CTX_wm_area(C);
/* XXX hrmf! */
- if(event->type==EVT_ACTIONZONE_AREA) {
+ if (event->type==EVT_ACTIONZONE_AREA) {
sActionzoneData *sad= event->customdata;
- if(sad==NULL)
+ if (sad==NULL)
return OPERATOR_PASS_THROUGH;
sa= sad->sa1;
}
/* poll() checks area context, but we don't accept full-area windows */
- if(sc->full != SCREENNORMAL) {
- if(event->type==EVT_ACTIONZONE_AREA)
+ if (sc->full != SCREENNORMAL) {
+ if (event->type==EVT_ACTIONZONE_AREA)
actionzone_exit(op);
return OPERATOR_CANCELLED;
}
@@ -828,7 +828,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* screen, areas init */
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
- if(event->type==EVT_ACTIONZONE_AREA)
+ if (event->type==EVT_ACTIONZONE_AREA)
actionzone_exit(op);
return OPERATOR_FINISHED;
@@ -836,12 +836,12 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void SCREEN_OT_area_dupli(wmOperatorType *ot)
{
- ot->name= "Duplicate Area into New Window";
- ot->description= "Duplicate selected area into new window";
- ot->idname= "SCREEN_OT_area_dupli";
+ ot->name = "Duplicate Area into New Window";
+ ot->description = "Duplicate selected area into new window";
+ ot->idname = "SCREEN_OT_area_dupli";
- ot->invoke= area_dupli_invoke;
- ot->poll= ED_operator_areaactive;
+ ot->invoke = area_dupli_invoke;
+ ot->poll = ED_operator_areaactive;
}
@@ -889,23 +889,23 @@ static void area_move_set_limits(bScreen *sc, int dir, int *bigger, int *smaller
/* we check all areas and test for free space with MINSIZE */
*bigger= *smaller= 100000;
- for(sa= sc->areabase.first; sa; sa= sa->next) {
- if(dir=='h') {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ if (dir=='h') {
int y1= sa->v2->vec.y - sa->v1->vec.y-areaminy;
/* if top or down edge selected, test height */
- if(sa->v1->flag && sa->v4->flag)
+ if (sa->v1->flag && sa->v4->flag)
*bigger= MIN2(*bigger, y1);
- else if(sa->v2->flag && sa->v3->flag)
+ else if (sa->v2->flag && sa->v3->flag)
*smaller= MIN2(*smaller, y1);
}
else {
int x1= sa->v4->vec.x - sa->v1->vec.x-AREAMINX;
/* if left or right edge selected, test width */
- if(sa->v1->flag && sa->v2->flag)
+ if (sa->v1->flag && sa->v2->flag)
*bigger= MIN2(*bigger, x1);
- else if(sa->v3->flag && sa->v4->flag)
+ else if (sa->v3->flag && sa->v4->flag)
*smaller= MIN2(*smaller, x1);
}
}
@@ -926,13 +926,13 @@ static int area_move_init (bContext *C, wmOperator *op)
/* setup */
actedge= screen_find_active_scredge(sc, x, y);
- if(actedge==NULL) return 0;
+ if (actedge==NULL) return 0;
md= MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData");
op->customdata= md;
md->dir= scredge_is_horizontal(actedge)?'h':'v';
- if(md->dir=='h') md->origval= actedge->v1->vec.y;
+ if (md->dir=='h') md->origval= actedge->v1->vec.y;
else md->origval= actedge->v1->vec.x;
select_connected_scredge(sc, actedge);
@@ -957,25 +957,25 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int
for (v1= sc->vertbase.first; v1; v1= v1->next) {
if (v1->flag) {
/* that way a nice AREAGRID */
- if((dir=='v') && v1->vec.x>0 && v1->vec.x<win->sizex-1) {
+ if ((dir=='v') && v1->vec.x>0 && v1->vec.x<win->sizex-1) {
v1->vec.x= origval + delta;
- if(delta != bigger && delta != -smaller) v1->vec.x-= (v1->vec.x % AREAGRID);
+ if (delta != bigger && delta != -smaller) v1->vec.x-= (v1->vec.x % AREAGRID);
}
- if((dir=='h') && v1->vec.y>0 && v1->vec.y<win->sizey-1) {
+ if ((dir=='h') && v1->vec.y>0 && v1->vec.y<win->sizey-1) {
v1->vec.y= origval + delta;
v1->vec.y+= AREAGRID-1;
v1->vec.y-= (v1->vec.y % AREAGRID);
/* prevent too small top header */
- if(v1->vec.y > win->sizey-areaminy)
+ if (v1->vec.y > win->sizey-areaminy)
v1->vec.y= win->sizey-areaminy;
}
}
}
- for(sa= sc->areabase.first; sa; sa= sa->next) {
- if(sa->v1->flag || sa->v2->flag || sa->v3->flag || sa->v4->flag)
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ if (sa->v1->flag || sa->v2->flag || sa->v3->flag || sa->v4->flag)
ED_area_tag_redraw(sa);
}
@@ -993,7 +993,7 @@ static void area_move_apply(bContext *C, wmOperator *op)
static void area_move_exit(bContext *C, wmOperator *op)
{
- if(op->customdata)
+ if (op->customdata)
MEM_freeN(op->customdata);
op->customdata= NULL;
@@ -1004,7 +1004,7 @@ static void area_move_exit(bContext *C, wmOperator *op)
static int area_move_exec(bContext *C, wmOperator *op)
{
- if(!area_move_init(C, op))
+ if (!area_move_init(C, op))
return OPERATOR_CANCELLED;
area_move_apply(C, op);
@@ -1019,7 +1019,7 @@ static int area_move_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "x", event->x);
RNA_int_set(op->ptr, "y", event->y);
- if(!area_move_init(C, op))
+ if (!area_move_init(C, op))
return OPERATOR_PASS_THROUGH;
/* add temp handler */
@@ -1052,7 +1052,7 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event)
y= RNA_int_get(op->ptr, "y");
delta= (md->dir == 'v')? event->x - x: event->y - y;
- if(md->step) delta= delta - (delta % md->step);
+ if (md->step) delta= delta - (delta % md->step);
RNA_int_set(op->ptr, "delta", delta);
area_move_apply(C, op);
@@ -1083,17 +1083,17 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event)
static void SCREEN_OT_area_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move area edges";
- ot->description= "Move selected area edges";
- ot->idname= "SCREEN_OT_area_move";
+ ot->name = "Move area edges";
+ ot->description = "Move selected area edges";
+ ot->idname = "SCREEN_OT_area_move";
- ot->exec= area_move_exec;
- ot->invoke= area_move_invoke;
- ot->cancel= area_move_cancel;
- ot->modal= area_move_modal;
- ot->poll= ED_operator_screen_mainwinactive; /* when mouse is over area-edge */
+ ot->exec = area_move_exec;
+ ot->invoke = area_move_invoke;
+ ot->cancel = area_move_cancel;
+ ot->modal = area_move_modal;
+ ot->poll = ED_operator_screen_mainwinactive; /* when mouse is over area-edge */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
/* rna */
RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
@@ -1166,10 +1166,10 @@ static int area_split_menu_init(bContext *C, wmOperator *op)
sd->sarea= CTX_wm_area(C);
- if(sd->sarea) {
+ if (sd->sarea) {
int dir= RNA_enum_get(op->ptr, "direction");
- if(dir=='h')
+ if (dir=='h')
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
else
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
@@ -1186,14 +1186,14 @@ static int area_split_init(bContext *C, wmOperator *op)
int dir;
/* required context */
- if(sa==NULL) return 0;
+ if (sa==NULL) return 0;
/* required properties */
dir= RNA_enum_get(op->ptr, "direction");
/* minimal size */
- if(dir=='v' && sa->winx < 2*AREAMINX) return 0;
- if(dir=='h' && sa->winy < 2*areaminy) return 0;
+ if (dir=='v' && sa->winx < 2*AREAMINX) return 0;
+ if (dir=='h' && sa->winy < 2*areaminy) return 0;
/* custom data */
sd= (sAreaSplitData*)MEM_callocN(sizeof (sAreaSplitData), "op_area_split");
@@ -1219,16 +1219,16 @@ static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *sa, ScrArea *sb)
ScrVert *sbv3= sb->v3;
ScrVert *sbv4= sb->v4;
- if(sav1==sbv4 && sav2==sbv3) { /* sa to right of sb = W */
+ if (sav1==sbv4 && sav2==sbv3) { /* sa to right of sb = W */
return screen_findedge(screen, sav1, sav2);
}
- else if(sav2==sbv1 && sav3==sbv4) { /* sa to bottom of sb = N */
+ else if (sav2==sbv1 && sav3==sbv4) { /* sa to bottom of sb = N */
return screen_findedge(screen, sav2, sav3);
}
- else if(sav3==sbv2 && sav4==sbv1) { /* sa to left of sb = E */
+ else if (sav3==sbv2 && sav4==sbv1) { /* sa to left of sb = E */
return screen_findedge(screen, sav3, sav4);
}
- else if(sav1==sbv2 && sav4==sbv3) { /* sa on top of sb = S*/
+ else if (sav1==sbv2 && sav4==sbv3) { /* sa on top of sb = S*/
return screen_findedge(screen, sav1, sav4);
}
@@ -1249,19 +1249,19 @@ static int area_split_apply(bContext *C, wmOperator *op)
sd->narea= area_split(sc, sd->sarea, dir, fac, 0); /* 0 = no merge */
- if(sd->narea) {
+ if (sd->narea) {
ScrVert *sv;
sd->nedge= area_findsharededge(sc, sd->sarea, sd->narea);
/* select newly created edge, prepare for moving edge */
- for(sv= sc->vertbase.first; sv; sv= sv->next)
+ for (sv= sc->vertbase.first; sv; sv= sv->next)
sv->flag = 0;
sd->nedge->v1->flag= 1;
sd->nedge->v2->flag= 1;
- if(dir=='h') sd->origval= sd->nedge->v1->vec.y;
+ if (dir=='h') sd->origval= sd->nedge->v1->vec.y;
else sd->origval= sd->nedge->v1->vec.x;
ED_area_tag_redraw(sd->sarea);
@@ -1279,10 +1279,10 @@ static void area_split_exit(bContext *C, wmOperator *op)
{
if (op->customdata) {
sAreaSplitData *sd= (sAreaSplitData *)op->customdata;
- if(sd->sarea) ED_area_tag_redraw(sd->sarea);
- if(sd->narea) ED_area_tag_redraw(sd->narea);
+ if (sd->sarea) ED_area_tag_redraw(sd->sarea);
+ if (sd->narea) ED_area_tag_redraw(sd->narea);
- if(sd->sarea)
+ if (sd->sarea)
sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
MEM_freeN(op->customdata);
@@ -1305,26 +1305,26 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
int dir;
/* no full window splitting allowed */
- if(CTX_wm_screen(C)->full != SCREENNORMAL)
+ if (CTX_wm_screen(C)->full != SCREENNORMAL)
return OPERATOR_CANCELLED;
- if(event->type==EVT_ACTIONZONE_AREA) {
+ if (event->type==EVT_ACTIONZONE_AREA) {
sActionzoneData *sad= event->customdata;
- if(sad->modifier>0) {
+ if (sad->modifier>0) {
return OPERATOR_PASS_THROUGH;
}
/* verify *sad itself */
- if(sad==NULL || sad->sa1==NULL || sad->az==NULL)
+ if (sad==NULL || sad->sa1==NULL || sad->az==NULL)
return OPERATOR_PASS_THROUGH;
/* is this our *sad? if areas not equal it should be passed on */
- if(CTX_wm_area(C)!=sad->sa1 || sad->sa1!=sad->sa2)
+ if (CTX_wm_area(C)!=sad->sa1 || sad->sa1!=sad->sa2)
return OPERATOR_PASS_THROUGH;
/* prepare operator state vars */
- if(sad->gesture_dir=='n' || sad->gesture_dir=='s') {
+ if (sad->gesture_dir=='n' || sad->gesture_dir=='s') {
dir= 'h';
RNA_float_set(op->ptr, "factor", ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx);
}
@@ -1335,7 +1335,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_enum_set(op->ptr, "direction", dir);
/* general init, also non-UI case, adds customdata, sets area and defaults */
- if(!area_split_init(C, op))
+ if (!area_split_init(C, op))
return OPERATOR_PASS_THROUGH;
}
@@ -1344,18 +1344,18 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
int x, y;
/* retrieve initial mouse coord, so we can find the active edge */
- if(RNA_struct_property_is_set(op->ptr, "mouse_x"))
+ if (RNA_struct_property_is_set(op->ptr, "mouse_x"))
x= RNA_int_get(op->ptr, "mouse_x");
else
x= event->x;
- if(RNA_struct_property_is_set(op->ptr, "mouse_y"))
+ if (RNA_struct_property_is_set(op->ptr, "mouse_y"))
y= RNA_int_get(op->ptr, "mouse_y");
else
y= event->x;
actedge= screen_find_active_scredge(CTX_wm_screen(C), x, y);
- if(actedge==NULL)
+ if (actedge==NULL)
return OPERATOR_CANCELLED;
dir= scredge_is_horizontal(actedge)?'v':'h';
@@ -1363,7 +1363,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_enum_set(op->ptr, "direction", dir);
/* special case, adds customdata, sets defaults */
- if(!area_split_menu_init(C, op))
+ if (!area_split_menu_init(C, op))
return OPERATOR_CANCELLED;
}
@@ -1373,10 +1373,10 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
sd->x= event->x;
sd->y= event->y;
- if(event->type==EVT_ACTIONZONE_AREA) {
+ if (event->type==EVT_ACTIONZONE_AREA) {
/* do the split */
- if(area_split_apply(C, op)) {
+ if (area_split_apply(C, op)) {
area_move_set_limits(CTX_wm_screen(C), dir, &sd->bigger, &sd->smaller);
/* add temp handler for edge move or cancel */
@@ -1401,7 +1401,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int area_split_exec(bContext *C, wmOperator *op)
{
- if(!area_split_init(C, op))
+ if (!area_split_init(C, op))
return OPERATOR_CANCELLED;
area_split_apply(C, op);
@@ -1415,7 +1415,7 @@ static int area_split_cancel(bContext *C, wmOperator *op)
{
sAreaSplitData *sd= (sAreaSplitData *)op->customdata;
- if(sd->previewmode) {
+ if (sd->previewmode) {
}
else {
if (screen_area_join(C, CTX_wm_screen(C), sd->sarea, sd->narea)) {
@@ -1443,16 +1443,16 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
dir= RNA_enum_get(op->ptr, "direction");
sd->delta= (dir == 'v')? event->x - sd->origval: event->y - sd->origval;
- if(sd->previewmode==0)
+ if (sd->previewmode==0)
area_move_apply_do(C, sd->origval, sd->delta, dir, sd->bigger, sd->smaller);
else {
- if(sd->sarea) {
+ if (sd->sarea) {
sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
ED_area_tag_redraw(sd->sarea);
}
sd->sarea= screen_areahascursor(CTX_wm_screen(C), event->x, event->y); /* area context not set */
- if(sd->sarea) {
+ if (sd->sarea) {
ED_area_tag_redraw(sd->sarea);
if (dir=='v') {
sd->origsize= sd->sarea->winx;
@@ -1476,13 +1476,13 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
case LEFTMOUSE:
- if(sd->previewmode) {
+ if (sd->previewmode) {
area_split_apply(C, op);
area_split_exit(C, op);
return OPERATOR_FINISHED;
}
else {
- if(event->val==KM_RELEASE) { /* mouse up */
+ if (event->val==KM_RELEASE) { /* mouse up */
area_split_exit(C, op);
return OPERATOR_FINISHED;
}
@@ -1491,23 +1491,23 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
case MIDDLEMOUSE:
case TABKEY:
- if (sd->previewmode==0){
+ if (sd->previewmode==0) {
}
- else{
+ else {
dir = RNA_enum_get(op->ptr, "direction");
- if(event->val==KM_PRESS){
- if (sd->sarea){
+ if (event->val==KM_PRESS) {
+ if (sd->sarea) {
sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
ED_area_tag_redraw(sd->sarea);
- if (dir=='v'){
+ if (dir=='v') {
RNA_enum_set(op->ptr, "direction", 'h');
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
WM_cursor_set(CTX_wm_window(C),CURSOR_X_MOVE);
}
- else{
+ else {
RNA_enum_set(op->ptr, "direction", 'v');
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
@@ -1535,16 +1535,16 @@ static EnumPropertyItem prop_direction_items[] = {
static void SCREEN_OT_area_split(wmOperatorType *ot)
{
ot->name = "Split area";
- ot->description= "Split selected area into new windows";
+ ot->description = "Split selected area into new windows";
ot->idname = "SCREEN_OT_area_split";
- ot->exec= area_split_exec;
- ot->invoke= area_split_invoke;
- ot->modal= area_split_modal;
- ot->cancel= area_split_cancel;
+ ot->exec = area_split_exec;
+ ot->invoke = area_split_invoke;
+ ot->modal = area_split_modal;
+ ot->cancel = area_split_cancel;
- ot->poll= screen_active_editable;
- ot->flag= OPTYPE_BLOCKING;
+ ot->poll = screen_active_editable;
+ ot->flag = OPTYPE_BLOCKING;
/* rna */
RNA_def_enum(ot->srna, "direction", prop_direction_items, 'h', "Direction", "");
@@ -1574,9 +1574,10 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
ARegion *ar;
int dist;
- if(edge==AE_RIGHT_TO_TOPLEFT || edge==AE_LEFT_TO_TOPRIGHT) {
+ if (edge==AE_RIGHT_TO_TOPLEFT || edge==AE_LEFT_TO_TOPRIGHT) {
dist = sa->totrct.xmax - sa->totrct.xmin;
- } else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
+ }
+ else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
dist = sa->totrct.ymax - sa->totrct.ymin;
}
@@ -1611,14 +1612,14 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
sActionzoneData *sad= event->customdata;
AZone *az;
- if(event->type!=EVT_ACTIONZONE_REGION) {
+ if (event->type!=EVT_ACTIONZONE_REGION) {
BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone");
return OPERATOR_CANCELLED;
}
az = sad->az;
- if(az->ar) {
+ if (az->ar) {
RegionMoveData *rmd= MEM_callocN(sizeof(RegionMoveData), "RegionMoveData");
int maxsize;
@@ -1633,15 +1634,16 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
rmd->maxsize = area_max_regionsize(rmd->sa, rmd->ar, rmd->edge);
/* if not set we do now, otherwise it uses type */
- if(rmd->ar->sizex==0)
+ if (rmd->ar->sizex==0)
rmd->ar->sizex= rmd->ar->type->prefsizex;
- if(rmd->ar->sizey==0)
+ if (rmd->ar->sizey==0)
rmd->ar->sizey= rmd->ar->type->prefsizey;
/* now copy to regionmovedata */
- if(rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
+ if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
rmd->origval= rmd->ar->sizex;
- } else {
+ }
+ else {
rmd->origval= rmd->ar->sizey;
}
@@ -1666,11 +1668,11 @@ static int region_scale_get_maxsize(RegionMoveData *rmd)
{
int maxsize= 0;
- if(rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
+ if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
return rmd->sa->winx - UI_UNIT_X;
}
- if(rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) {
+ if (rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) {
/* this calculation seems overly verbose
* can someone explain why this method is necessary? - campbell */
maxsize = rmd->maxsize - ((rmd->sa->headertype==HEADERTOP)?UI_UNIT_Y*2:UI_UNIT_Y) - (UI_UNIT_Y/4);
@@ -1681,18 +1683,18 @@ static int region_scale_get_maxsize(RegionMoveData *rmd)
static void region_scale_validate_size(RegionMoveData *rmd)
{
- if((rmd->ar->flag & RGN_FLAG_HIDDEN)==0) {
+ if ((rmd->ar->flag & RGN_FLAG_HIDDEN)==0) {
short *size, maxsize= -1;
- if(rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT)
+ if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT)
size= &rmd->ar->sizex;
else
size= &rmd->ar->sizey;
maxsize= region_scale_get_maxsize(rmd);
- if(*size > maxsize && maxsize > 0)
+ if (*size > maxsize && maxsize > 0)
*size= maxsize;
}
}
@@ -1712,25 +1714,25 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
switch(event->type) {
case MOUSEMOVE:
- if(rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
+ if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
delta= event->x - rmd->origx;
- if(rmd->edge==AE_LEFT_TO_TOPRIGHT) delta= -delta;
+ if (rmd->edge==AE_LEFT_TO_TOPRIGHT) delta= -delta;
rmd->ar->sizex= rmd->origval + delta;
CLAMP(rmd->ar->sizex, 0, rmd->maxsize);
- if(rmd->ar->sizex < UI_UNIT_X) {
+ if (rmd->ar->sizex < UI_UNIT_X) {
rmd->ar->sizex= rmd->origval;
- if(!(rmd->ar->flag & RGN_FLAG_HIDDEN))
+ if (!(rmd->ar->flag & RGN_FLAG_HIDDEN))
region_scale_toggle_hidden(C, rmd);
}
- else if(rmd->ar->flag & RGN_FLAG_HIDDEN)
+ else if (rmd->ar->flag & RGN_FLAG_HIDDEN)
region_scale_toggle_hidden(C, rmd);
}
else {
int maxsize= region_scale_get_maxsize(rmd);
delta= event->y - rmd->origy;
- if(rmd->edge==AE_BOTTOM_TO_TOPLEFT) delta= -delta;
+ if (rmd->edge==AE_BOTTOM_TO_TOPLEFT) delta= -delta;
rmd->ar->sizey= rmd->origval + delta;
CLAMP(rmd->ar->sizey, 0, rmd->maxsize);
@@ -1738,14 +1740,14 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
/* note, 'UI_UNIT_Y/4' means you need to drag the header almost
* all the way down for it to become hidden, this is done
* otherwise its too easy to do this by accident */
- if(rmd->ar->sizey < UI_UNIT_Y/4) {
+ if (rmd->ar->sizey < UI_UNIT_Y/4) {
rmd->ar->sizey= rmd->origval;
- if(!(rmd->ar->flag & RGN_FLAG_HIDDEN))
+ if (!(rmd->ar->flag & RGN_FLAG_HIDDEN))
region_scale_toggle_hidden(C, rmd);
}
- else if(maxsize > 0 && (rmd->ar->sizey > maxsize))
+ else if (maxsize > 0 && (rmd->ar->sizey > maxsize))
rmd->ar->sizey= maxsize;
- else if(rmd->ar->flag & RGN_FLAG_HIDDEN)
+ else if (rmd->ar->flag & RGN_FLAG_HIDDEN)
region_scale_toggle_hidden(C, rmd);
}
ED_area_tag_redraw(rmd->sa);
@@ -1754,13 +1756,13 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
case LEFTMOUSE:
- if(event->val==KM_RELEASE) {
+ if (event->val==KM_RELEASE) {
- if(ABS(event->x - rmd->origx) < 2 && ABS(event->y - rmd->origy) < 2) {
- if(rmd->ar->flag & RGN_FLAG_HIDDEN) {
+ if (ABS(event->x - rmd->origx) < 2 && ABS(event->y - rmd->origy) < 2) {
+ if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
region_scale_toggle_hidden(C, rmd);
}
- else if(rmd->ar->flag & RGN_FLAG_TOO_SMALL) {
+ else if (rmd->ar->flag & RGN_FLAG_TOO_SMALL) {
region_scale_validate_size(rmd);
}
@@ -1792,17 +1794,17 @@ static int region_scale_cancel(bContext *UNUSED(C), wmOperator *op)
static void SCREEN_OT_region_scale(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Scale Region Size";
- ot->description= "Scale selected area";
- ot->idname= "SCREEN_OT_region_scale";
+ ot->name = "Scale Region Size";
+ ot->description = "Scale selected area";
+ ot->idname = "SCREEN_OT_region_scale";
- ot->invoke= region_scale_invoke;
- ot->modal= region_scale_modal;
- ot->cancel= region_scale_cancel;
+ ot->invoke = region_scale_invoke;
+ ot->modal = region_scale_modal;
+ ot->cancel = region_scale_cancel;
- ot->poll= ED_operator_areaactive;
+ ot->poll = ED_operator_areaactive;
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
}
@@ -1833,10 +1835,10 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot)
ot->name = "Frame Offset";
ot->idname = "SCREEN_OT_frame_offset";
- ot->exec= frame_offset_exec;
+ ot->exec = frame_offset_exec;
- ot->poll= ED_operator_screenactive_norender;
- ot->flag= 0;
+ ot->poll = ED_operator_screenactive_norender;
+ ot->flag = 0;
/* rna */
RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
@@ -1854,7 +1856,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
* first/last frame not to be actually shown (bad since for example physics
* simulations aren't reset properly).
*/
- if(animtimer) {
+ if (animtimer) {
ScreenAnimData *sad = animtimer->customdata;
sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME;
@@ -1881,13 +1883,13 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
static void SCREEN_OT_frame_jump(wmOperatorType *ot)
{
ot->name = "Jump to Endpoint";
- ot->description= "Jump to first/last frame in frame range";
+ ot->description = "Jump to first/last frame in frame range";
ot->idname = "SCREEN_OT_frame_jump";
- ot->exec= frame_jump_exec;
+ ot->exec = frame_jump_exec;
- ot->poll= ED_operator_screenactive_norender;
- ot->flag= OPTYPE_UNDO;
+ ot->poll = ED_operator_screenactive_norender;
+ ot->flag = OPTYPE_UNDO;
/* rna */
RNA_def_boolean(ot->srna, "end", 0, "Last Frame", "Jump to the last frame of the frame range");
@@ -1964,13 +1966,13 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
{
ot->name = "Jump to Keyframe";
- ot->description= "Jump to previous/next keyframe";
+ ot->description = "Jump to previous/next keyframe";
ot->idname = "SCREEN_OT_keyframe_jump";
- ot->exec= keyframe_jump_exec;
+ ot->exec = keyframe_jump_exec;
- ot->poll= ED_operator_screenactive_norender;
- ot->flag= OPTYPE_UNDO;
+ ot->poll = ED_operator_screenactive_norender;
+ ot->flag = OPTYPE_UNDO;
/* rna */
RNA_def_boolean(ot->srna, "next", 1, "Next Keyframe", "");
@@ -1990,22 +1992,22 @@ static int screen_set_exec(bContext *C, wmOperator *op)
int delta= RNA_int_get(op->ptr, "delta");
/* temp screens are for userpref or render display */
- if(screen->temp)
+ if (screen->temp)
return OPERATOR_CANCELLED;
- if(delta==1) {
- while(tot--) {
+ if (delta==1) {
+ while (tot--) {
screen= screen->id.next;
- if(screen==NULL) screen= CTX_data_main(C)->screen.first;
- if(screen->winid==0 && screen->full==0 && screen != screen_prev)
+ if (screen==NULL) screen= CTX_data_main(C)->screen.first;
+ if (screen->winid==0 && screen->full==0 && screen != screen_prev)
break;
}
}
- else if(delta== -1) {
- while(tot--) {
+ else if (delta== -1) {
+ while (tot--) {
screen= screen->id.prev;
- if(screen==NULL) screen= CTX_data_main(C)->screen.last;
- if(screen->winid==0 && screen->full==0 && screen != screen_prev)
+ if (screen==NULL) screen= CTX_data_main(C)->screen.last;
+ if (screen->winid==0 && screen->full==0 && screen != screen_prev)
break;
}
}
@@ -2013,9 +2015,9 @@ static int screen_set_exec(bContext *C, wmOperator *op)
screen= NULL;
}
- if(screen && screen_prev != screen) {
+ if (screen && screen_prev != screen) {
/* return to previous state before switching screens */
- if(sa && sa->full) {
+ if (sa && sa->full) {
ED_screen_full_restore(C, sa); /* may free 'screen_prev' */
}
@@ -2028,11 +2030,11 @@ static int screen_set_exec(bContext *C, wmOperator *op)
static void SCREEN_OT_screen_set(wmOperatorType *ot)
{
ot->name = "Set Screen";
- ot->description= "Cycle through available screens";
+ ot->description = "Cycle through available screens";
ot->idname = "SCREEN_OT_screen_set";
- ot->exec= screen_set_exec;
- ot->poll= ED_operator_screenactive;
+ ot->exec = screen_set_exec;
+ ot->poll = ED_operator_screenactive;
/* rna */
RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
@@ -2053,7 +2055,7 @@ static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op))
if (sa->full) break;
}
- if(sa==NULL) sa= CTX_wm_area(C);
+ if (sa==NULL) sa= CTX_wm_area(C);
ED_screen_full_toggle(C, CTX_wm_window(C), sa);
return OPERATOR_FINISHED;
@@ -2062,12 +2064,12 @@ static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op))
static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
{
ot->name = "Toggle Full Screen";
- ot->description= "Toggle display selected area as fullscreen";
+ ot->description = "Toggle display selected area as fullscreen";
ot->idname = "SCREEN_OT_screen_full_area";
- ot->exec= screen_full_area_exec;
- ot->poll= ED_operator_areaactive;
- ot->flag= 0;
+ ot->exec = screen_full_area_exec;
+ ot->poll = ED_operator_areaactive;
+ ot->flag = 0;
}
@@ -2130,15 +2132,15 @@ static int area_join_init(bContext *C, wmOperator *op)
sa1 = screen_areahascursor(CTX_wm_screen(C), x1, y1);
sa2 = screen_areahascursor(CTX_wm_screen(C), x2, y2);
- if(sa1==NULL || sa2==NULL || sa1==sa2)
+ if (sa1==NULL || sa2==NULL || sa1==sa2)
return 0;
/* do areas share an edge? */
- if(sa1->v1==sa2->v1 || sa1->v1==sa2->v2 || sa1->v1==sa2->v3 || sa1->v1==sa2->v4) shared++;
- if(sa1->v2==sa2->v1 || sa1->v2==sa2->v2 || sa1->v2==sa2->v3 || sa1->v2==sa2->v4) shared++;
- if(sa1->v3==sa2->v1 || sa1->v3==sa2->v2 || sa1->v3==sa2->v3 || sa1->v3==sa2->v4) shared++;
- if(sa1->v4==sa2->v1 || sa1->v4==sa2->v2 || sa1->v4==sa2->v3 || sa1->v4==sa2->v4) shared++;
- if(shared!=2) {
+ if (sa1->v1==sa2->v1 || sa1->v1==sa2->v2 || sa1->v1==sa2->v3 || sa1->v1==sa2->v4) shared++;
+ if (sa1->v2==sa2->v1 || sa1->v2==sa2->v2 || sa1->v2==sa2->v3 || sa1->v2==sa2->v4) shared++;
+ if (sa1->v3==sa2->v1 || sa1->v3==sa2->v2 || sa1->v3==sa2->v3 || sa1->v3==sa2->v4) shared++;
+ if (sa1->v4==sa2->v1 || sa1->v4==sa2->v2 || sa1->v4==sa2->v3 || sa1->v4==sa2->v4) shared++;
+ if (shared!=2) {
printf("areas don't share edge\n");
return 0;
}
@@ -2161,7 +2163,7 @@ static int area_join_apply(bContext *C, wmOperator *op)
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
if (!jd) return 0;
- if(!screen_area_join(C, CTX_wm_screen(C), jd->sa1, jd->sa2)){
+ if (!screen_area_join(C, CTX_wm_screen(C), jd->sa1, jd->sa2)) {
return 0;
}
if (CTX_wm_area(C) == jd->sa2) {
@@ -2188,7 +2190,7 @@ static void area_join_exit(bContext *C, wmOperator *op)
static int area_join_exec(bContext *C, wmOperator *op)
{
- if(!area_join_init(C, op))
+ if (!area_join_init(C, op))
return OPERATOR_CANCELLED;
area_join_apply(C, op);
@@ -2201,19 +2203,19 @@ static int area_join_exec(bContext *C, wmOperator *op)
static int area_join_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(event->type==EVT_ACTIONZONE_AREA) {
+ if (event->type==EVT_ACTIONZONE_AREA) {
sActionzoneData *sad= event->customdata;
- if(sad->modifier>0) {
+ if (sad->modifier>0) {
return OPERATOR_PASS_THROUGH;
}
/* verify *sad itself */
- if(sad==NULL || sad->sa1==NULL || sad->sa2==NULL)
+ if (sad==NULL || sad->sa1==NULL || sad->sa2==NULL)
return OPERATOR_PASS_THROUGH;
/* is this our *sad? if areas equal it should be passed on */
- if(sad->sa1==sad->sa2)
+ if (sad->sa1==sad->sa2)
return OPERATOR_PASS_THROUGH;
/* prepare operator state vars */
@@ -2224,7 +2226,7 @@ static int area_join_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
- if(!area_join_init(C, op))
+ if (!area_join_init(C, op))
return OPERATOR_PASS_THROUGH;
/* add temp handler */
@@ -2325,7 +2327,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
}
break;
case LEFTMOUSE:
- if(event->val==KM_RELEASE) {
+ if (event->val==KM_RELEASE) {
ED_area_tag_redraw(jd->sa1);
ED_area_tag_redraw(jd->sa2);
@@ -2348,18 +2350,18 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
static void SCREEN_OT_area_join(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Join area";
- ot->description= "Join selected areas into new window";
- ot->idname= "SCREEN_OT_area_join";
+ ot->name = "Join area";
+ ot->description = "Join selected areas into new window";
+ ot->idname = "SCREEN_OT_area_join";
/* api callbacks */
- ot->exec= area_join_exec;
- ot->invoke= area_join_invoke;
- ot->modal= area_join_modal;
- ot->poll= screen_active_editable;
- ot->cancel= area_join_cancel;
+ ot->exec = area_join_exec;
+ ot->invoke = area_join_invoke;
+ ot->modal = area_join_modal;
+ ot->poll = screen_active_editable;
+ ot->cancel = area_join_cancel;
- ot->flag= OPTYPE_BLOCKING|OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_INTERNAL;
/* rna */
RNA_def_int(ot->srna, "min_x", -100, INT_MIN, INT_MAX, "X 1", "", INT_MIN, INT_MAX);
@@ -2377,7 +2379,7 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, wmEvent *even
PointerRNA ptr1, ptr2;
ScrEdge *actedge= screen_find_active_scredge(CTX_wm_screen(C), event->x, event->y);
- if(actedge==NULL) return OPERATOR_CANCELLED;
+ if (actedge==NULL) return OPERATOR_CANCELLED;
pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
layout= uiPupMenuLayout(pup);
@@ -2407,14 +2409,14 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, wmEvent *even
static void SCREEN_OT_area_options(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Area Options";
- ot->description= "Operations for splitting and merging";
- ot->idname= "SCREEN_OT_area_options";
+ ot->name = "Area Options";
+ ot->description = "Operations for splitting and merging";
+ ot->idname = "SCREEN_OT_area_options";
/* api callbacks */
- ot->invoke= screen_area_options_invoke;
+ ot->invoke = screen_area_options_invoke;
- ot->poll= ED_operator_screen_mainwinactive;
+ ot->poll = ED_operator_screen_mainwinactive;
}
@@ -2428,9 +2430,9 @@ static int spacedata_cleanup(bContext *C, wmOperator *op)
ScrArea *sa;
int tot= 0;
- for(screen= bmain->screen.first; screen; screen= screen->id.next) {
- for(sa= screen->areabase.first; sa; sa= sa->next) {
- if(sa->spacedata.first != sa->spacedata.last) {
+ for (screen= bmain->screen.first; screen; screen= screen->id.next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ if (sa->spacedata.first != sa->spacedata.last) {
SpaceLink *sl= sa->spacedata.first;
BLI_remlink(&sa->spacedata, sl);
@@ -2448,13 +2450,13 @@ static int spacedata_cleanup(bContext *C, wmOperator *op)
static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clean-up space-data";
- ot->description= "Remove unused settings for invisible editors";
- ot->idname= "SCREEN_OT_spacedata_cleanup";
+ ot->name = "Clean-up space-data";
+ ot->description = "Remove unused settings for invisible editors";
+ ot->idname = "SCREEN_OT_spacedata_cleanup";
/* api callbacks */
- ot->exec= spacedata_cleanup;
- ot->poll= WM_operator_winactive;
+ ot->exec = spacedata_cleanup;
+ ot->poll = WM_operator_winactive;
}
@@ -2464,7 +2466,7 @@ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
{
wmOperator *lastop= CTX_wm_manager(C)->operators.last;
- if(lastop)
+ if (lastop)
WM_operator_repeat(C, lastop);
return OPERATOR_CANCELLED;
@@ -2473,14 +2475,14 @@ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
static void SCREEN_OT_repeat_last(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Repeat Last";
- ot->description= "Repeat last action";
- ot->idname= "SCREEN_OT_repeat_last";
+ ot->name = "Repeat Last";
+ ot->description = "Repeat last action";
+ ot->idname = "SCREEN_OT_repeat_last";
/* api callbacks */
- ot->exec= repeat_last_exec;
+ ot->exec = repeat_last_exec;
- ot->poll= ED_operator_screenactive;
+ ot->poll = ED_operator_screenactive;
}
@@ -2493,7 +2495,7 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
int items, i;
items= BLI_countlist(&wm->operators);
- if(items==0)
+ if (items==0)
return OPERATOR_CANCELLED;
pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
@@ -2512,7 +2514,7 @@ static int repeat_history_exec(bContext *C, wmOperator *op)
wmWindowManager *wm= CTX_wm_manager(C);
op= BLI_findlink(&wm->operators, RNA_int_get(op->ptr, "index"));
- if(op) {
+ if (op) {
/* let's put it as last operator in list */
BLI_remlink(&wm->operators, op);
BLI_addtail(&wm->operators, op);
@@ -2526,15 +2528,15 @@ static int repeat_history_exec(bContext *C, wmOperator *op)
static void SCREEN_OT_repeat_history(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Repeat History";
- ot->description= "Display menu for previous actions performed";
- ot->idname= "SCREEN_OT_repeat_history";
+ ot->name = "Repeat History";
+ ot->description = "Display menu for previous actions performed";
+ ot->idname = "SCREEN_OT_repeat_history";
/* api callbacks */
- ot->invoke= repeat_history_invoke;
- ot->exec= repeat_history_exec;
+ ot->invoke = repeat_history_invoke;
+ ot->exec = repeat_history_exec;
- ot->poll= ED_operator_screenactive;
+ ot->poll = ED_operator_screenactive;
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000);
}
@@ -2545,7 +2547,7 @@ static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED
{
wmOperator *lastop= WM_operator_last_redo(C);
- if(lastop)
+ if (lastop)
WM_operator_redo_popup(C, lastop);
return OPERATOR_CANCELLED;
@@ -2554,14 +2556,14 @@ static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED
static void SCREEN_OT_redo_last(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Redo Last";
- ot->description= "Display menu for last action performed";
- ot->idname= "SCREEN_OT_redo_last";
+ ot->name = "Redo Last";
+ ot->description = "Display menu for last action performed";
+ ot->idname = "SCREEN_OT_redo_last";
/* api callbacks */
- ot->invoke= redo_last_invoke;
+ ot->invoke = redo_last_invoke;
- ot->poll= ED_operator_screenactive;
+ ot->poll = ED_operator_screenactive;
}
/* ************** region four-split operator ***************************** */
@@ -2572,24 +2574,24 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
ARegion *ar= CTX_wm_region(C);
/* some rules... */
- if(ar->regiontype!=RGN_TYPE_WINDOW)
+ if (ar->regiontype!=RGN_TYPE_WINDOW)
BKE_report(op->reports, RPT_ERROR, "Only window region can be 4-splitted");
- else if(ar->alignment==RGN_ALIGN_QSPLIT) {
+ else if (ar->alignment==RGN_ALIGN_QSPLIT) {
ScrArea *sa= CTX_wm_area(C);
ARegion *arn;
/* keep current region */
ar->alignment= 0;
- if(sa->spacetype==SPACE_VIEW3D) {
+ if (sa->spacetype==SPACE_VIEW3D) {
RegionView3D *rv3d= ar->regiondata;
rv3d->viewlock= 0;
rv3d->rflag &= ~RV3D_CLIPPING;
}
- for(ar= sa->regionbase.first; ar; ar= arn) {
+ for (ar= sa->regionbase.first; ar; ar= arn) {
arn= ar->next;
- if(ar->alignment==RGN_ALIGN_QSPLIT) {
+ if (ar->alignment==RGN_ALIGN_QSPLIT) {
ED_region_exit(C, ar);
BKE_area_region_free(sa->type, ar);
BLI_remlink(&sa->regionbase, ar);
@@ -2599,7 +2601,7 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
ED_area_tag_redraw(sa);
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
}
- else if(ar->next)
+ else if (ar->next)
BKE_report(op->reports, RPT_ERROR, "Only last region can be 4-splitted");
else {
ScrArea *sa= CTX_wm_area(C);
@@ -2608,13 +2610,13 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
ar->alignment= RGN_ALIGN_QSPLIT;
- for(count=0; count<3; count++) {
+ for (count=0; count<3; count++) {
newar= BKE_area_region_copy(sa->type, ar);
BLI_addtail(&sa->regionbase, newar);
}
/* lock views and set them */
- if(sa->spacetype==SPACE_VIEW3D) {
+ if (sa->spacetype==SPACE_VIEW3D) {
/* run ED_view3d_lock() so the correct 'rv3d->viewquat' is set,
* otherwise when restoring rv3d->localvd the 'viewquat' won't
* match the 'view', set on entering localview See: [#26315],
@@ -2657,15 +2659,15 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
static void SCREEN_OT_region_quadview(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Quad View";
- ot->description= "Split selected area into camera, front, right & top views";
- ot->idname= "SCREEN_OT_region_quadview";
+ ot->name = "Toggle Quad View";
+ ot->description = "Split selected area into camera, front, right & top views";
+ ot->idname = "SCREEN_OT_region_quadview";
/* api callbacks */
- // ot->invoke= WM_operator_confirm;
- ot->exec= region_quadview_exec;
- ot->poll= ED_operator_region_view3d_active;
- ot->flag= 0;
+ // ot->invoke = WM_operator_confirm;
+ ot->exec = region_quadview_exec;
+ ot->poll = ED_operator_region_view3d_active;
+ ot->flag = 0;
}
@@ -2680,13 +2682,13 @@ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
if (!ar)
return OPERATOR_CANCELLED;
- if(ar->alignment==RGN_ALIGN_TOP)
+ if (ar->alignment==RGN_ALIGN_TOP)
ar->alignment= RGN_ALIGN_BOTTOM;
- else if(ar->alignment==RGN_ALIGN_BOTTOM)
+ else if (ar->alignment==RGN_ALIGN_BOTTOM)
ar->alignment= RGN_ALIGN_TOP;
- else if(ar->alignment==RGN_ALIGN_LEFT)
+ else if (ar->alignment==RGN_ALIGN_LEFT)
ar->alignment= RGN_ALIGN_RIGHT;
- else if(ar->alignment==RGN_ALIGN_RIGHT)
+ else if (ar->alignment==RGN_ALIGN_RIGHT)
ar->alignment= RGN_ALIGN_LEFT;
ED_area_tag_redraw(CTX_wm_area(C));
@@ -2699,13 +2701,13 @@ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
static void SCREEN_OT_region_flip(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Flip Region";
- ot->idname= "SCREEN_OT_region_flip";
+ ot->name = "Flip Region";
+ ot->idname = "SCREEN_OT_region_flip";
/* api callbacks */
- ot->exec= region_flip_exec;
- ot->poll= ED_operator_areaactive;
- ot->flag= 0;
+ ot->exec = region_flip_exec;
+ ot->poll = ED_operator_areaactive;
+ ot->flag = 0;
}
/* ************** header flip operator ***************************** */
@@ -2718,23 +2720,23 @@ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op))
/* find the header region
* - try context first, but upon failing, search all regions in area...
*/
- if((ar == NULL) || (ar->regiontype != RGN_TYPE_HEADER)) {
+ if ((ar == NULL) || (ar->regiontype != RGN_TYPE_HEADER)) {
ScrArea *sa= CTX_wm_area(C);
ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* don't do anything if no region */
- if(ar == NULL)
+ if (ar == NULL)
return OPERATOR_CANCELLED;
}
/* copied from SCREEN_OT_region_flip */
- if(ar->alignment==RGN_ALIGN_TOP)
+ if (ar->alignment==RGN_ALIGN_TOP)
ar->alignment= RGN_ALIGN_BOTTOM;
- else if(ar->alignment==RGN_ALIGN_BOTTOM)
+ else if (ar->alignment==RGN_ALIGN_BOTTOM)
ar->alignment= RGN_ALIGN_TOP;
- else if(ar->alignment==RGN_ALIGN_LEFT)
+ else if (ar->alignment==RGN_ALIGN_LEFT)
ar->alignment= RGN_ALIGN_RIGHT;
- else if(ar->alignment==RGN_ALIGN_RIGHT)
+ else if (ar->alignment==RGN_ALIGN_RIGHT)
ar->alignment= RGN_ALIGN_LEFT;
ED_area_tag_redraw(CTX_wm_area(C));
@@ -2748,14 +2750,14 @@ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op))
static void SCREEN_OT_header_flip(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Flip Header Region";
- ot->idname= "SCREEN_OT_header_flip";
+ ot->name = "Flip Header Region";
+ ot->idname = "SCREEN_OT_header_flip";
/* api callbacks */
- ot->exec= header_flip_exec;
+ ot->exec = header_flip_exec;
- ot->poll= ED_operator_areaactive;
- ot->flag= 0;
+ ot->poll = ED_operator_areaactive;
+ ot->flag = 0;
}
/* ************** header tools operator ***************************** */
@@ -2794,12 +2796,12 @@ static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *U
static void SCREEN_OT_header_toolbox(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Header Toolbox";
- ot->description="Display header region toolbox";
- ot->idname= "SCREEN_OT_header_toolbox";
+ ot->name = "Header Toolbox";
+ ot->description = "Display header region toolbox";
+ ot->idname = "SCREEN_OT_header_toolbox";
/* api callbacks */
- ot->invoke= header_toolbox_invoke;
+ ot->invoke = header_toolbox_invoke;
}
/* ****************** anim player, with timer ***************** */
@@ -2818,49 +2820,49 @@ static int match_area_with_refresh(int spacetype, int refresh)
static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
{
- if(regiontype==RGN_TYPE_WINDOW) {
+ if (regiontype==RGN_TYPE_WINDOW) {
switch (spacetype) {
case SPACE_VIEW3D:
- if(redraws & TIME_ALL_3D_WIN)
+ if (redraws & TIME_ALL_3D_WIN)
return 1;
break;
case SPACE_IPO:
case SPACE_ACTION:
case SPACE_NLA:
- if(redraws & TIME_ALL_ANIM_WIN)
+ if (redraws & TIME_ALL_ANIM_WIN)
return 1;
break;
case SPACE_TIME:
/* if only 1 window or 3d windows, we do timeline too */
- if(redraws & (TIME_ALL_ANIM_WIN|TIME_REGION|TIME_ALL_3D_WIN))
+ if (redraws & (TIME_ALL_ANIM_WIN|TIME_REGION|TIME_ALL_3D_WIN))
return 1;
break;
case SPACE_BUTS:
- if(redraws & TIME_ALL_BUTS_WIN)
+ if (redraws & TIME_ALL_BUTS_WIN)
return 1;
break;
case SPACE_SEQ:
- if(redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
+ if (redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
return 1;
break;
case SPACE_NODE:
- if(redraws & (TIME_NODES))
+ if (redraws & (TIME_NODES))
return 1;
break;
case SPACE_IMAGE:
- if(redraws & TIME_ALL_IMAGE_WIN)
+ if (redraws & TIME_ALL_IMAGE_WIN)
return 1;
break;
case SPACE_CLIP:
- if(redraws & TIME_CLIPS)
+ if (redraws & TIME_CLIPS)
return 1;
break;
}
}
- else if(regiontype==RGN_TYPE_UI) {
- if(spacetype==SPACE_CLIP) {
+ else if (regiontype==RGN_TYPE_UI) {
+ if (spacetype==SPACE_CLIP) {
/* Track Preview button is on Properties Editor in SpaceClip,
* and it's very common case when users want it be refreshing
* during playback, so asking people to enable special option
@@ -2869,17 +2871,17 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
return 1;
}
- if(redraws & TIME_ALL_BUTS_WIN)
+ if (redraws & TIME_ALL_BUTS_WIN)
return 1;
}
- else if(regiontype==RGN_TYPE_HEADER) {
- if(spacetype==SPACE_TIME)
+ else if (regiontype==RGN_TYPE_HEADER) {
+ if (spacetype==SPACE_TIME)
return 1;
}
else if (regiontype==RGN_TYPE_PREVIEW) {
switch (spacetype) {
case SPACE_SEQ:
- if(redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
+ if (redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
return 1;
break;
case SPACE_CLIP:
@@ -2893,7 +2895,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
{
bScreen *screen= CTX_wm_screen(C);
- if(screen->animtimer && screen->animtimer==event->customdata) {
+ if (screen->animtimer && screen->animtimer==event->customdata) {
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
wmTimer *wt= screen->animtimer;
@@ -2915,13 +2917,12 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
}
else {
if (sync) {
- int step = floor(wt->duration * FPS);
+ int step = floor((wt->duration - sad->last_duration) * FPS);
/* skip frames */
if (sad->flag & ANIMPLAY_FLAG_REVERSE)
scene->r.cfra -= step;
else
scene->r.cfra += step;
- wt->duration -= ((double)step)/FPS;
}
else {
/* one frame +/- */
@@ -2932,6 +2933,8 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
}
}
+ sad->last_duration = wt->duration;
+
/* reset 'jumped' flag before checking if we need to jump... */
sad->flag &= ~ANIMPLAY_FLAG_JUMPED;
@@ -2967,7 +2970,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
}
/* next frame overriden by user action (pressed jump to first/last frame) */
- if(sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) {
+ if (sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) {
scene->r.cfra = sad->nextfra;
sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME;
sad->flag |= ANIMPLAY_FLAG_JUMPED;
@@ -3013,14 +3016,14 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
static void SCREEN_OT_animation_step(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Animation Step";
- ot->description= "Step through animation by position";
- ot->idname= "SCREEN_OT_animation_step";
+ ot->name = "Animation Step";
+ ot->description = "Step through animation by position";
+ ot->idname = "SCREEN_OT_animation_step";
/* api callbacks */
- ot->invoke= screen_animation_step;
+ ot->invoke = screen_animation_step;
- ot->poll= ED_operator_screenactive_norender;
+ ot->poll = ED_operator_screenactive_norender;
}
@@ -3070,14 +3073,14 @@ static int screen_animation_play_exec(bContext *C, wmOperator *op)
static void SCREEN_OT_animation_play(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Play Animation";
- ot->description= "Play animation";
- ot->idname= "SCREEN_OT_animation_play";
+ ot->name = "Play Animation";
+ ot->description = "Play animation";
+ ot->idname = "SCREEN_OT_animation_play";
/* api callbacks */
- ot->exec= screen_animation_play_exec;
+ ot->exec = screen_animation_play_exec;
- ot->poll= ED_operator_screenactive_norender;
+ ot->poll = ED_operator_screenactive_norender;
RNA_def_boolean(ot->srna, "reverse", 0, "Play in Reverse", "Animation is played backwards");
RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate");
@@ -3088,7 +3091,7 @@ static int screen_animation_cancel_exec(bContext *C, wmOperator *op)
bScreen *screen= CTX_wm_screen(C);
if (screen->animtimer) {
- if(RNA_boolean_get(op->ptr, "restore_frame")) {
+ if (RNA_boolean_get(op->ptr, "restore_frame")) {
ScreenAnimData *sad= screen->animtimer->customdata;
Scene *scene= CTX_data_scene(C);
@@ -3110,14 +3113,14 @@ static int screen_animation_cancel_exec(bContext *C, wmOperator *op)
static void SCREEN_OT_animation_cancel(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Cancel Animation";
- ot->description= "Cancel animation, returning to the original frame";
- ot->idname= "SCREEN_OT_animation_cancel";
+ ot->name = "Cancel Animation";
+ ot->description = "Cancel animation, returning to the original frame";
+ ot->idname = "SCREEN_OT_animation_cancel";
/* api callbacks */
- ot->exec= screen_animation_cancel_exec;
+ ot->exec = screen_animation_cancel_exec;
- ot->poll= ED_operator_screenactive;
+ ot->poll = ED_operator_screenactive;
RNA_def_boolean(ot->srna, "restore_frame", TRUE, "Restore Frame", "Restore the frame when animation was initialized");
}
@@ -3147,9 +3150,9 @@ static int border_select_do(bContext *C, wmOperator *op)
{
int event_type= RNA_int_get(op->ptr, "event_type");
- if(event_type==LEFTMOUSE)
+ if (event_type==LEFTMOUSE)
printf("border select do select\n");
- else if(event_type==RIGHTMOUSE)
+ else if (event_type==RIGHTMOUSE)
printf("border select deselect\n");
else
printf("border select do something\n");
@@ -3160,16 +3163,16 @@ static int border_select_do(bContext *C, wmOperator *op)
static void SCREEN_OT_border_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border select";
- ot->idname= "SCREEN_OT_border_select";
+ ot->name = "Border select";
+ ot->idname = "SCREEN_OT_border_select";
/* api callbacks */
- ot->exec= border_select_do;
- ot->invoke= WM_border_select_invoke;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->exec = border_select_do;
+ ot->invoke = WM_border_select_invoke;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= ED_operator_areaactive;
+ ot->poll = ED_operator_areaactive;
/* rna */
RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
@@ -3206,13 +3209,13 @@ static int fullscreen_back_exec(bContext *C, wmOperator *op)
static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Back to Previous Screen";
- ot->description= "Revert back to the original screen layout, before fullscreen area overlay";
- ot->idname= "SCREEN_OT_back_to_previous";
+ ot->name = "Back to Previous Screen";
+ ot->description = "Revert back to the original screen layout, before fullscreen area overlay";
+ ot->idname = "SCREEN_OT_back_to_previous";
/* api callbacks */
- ot->exec= fullscreen_back_exec;
- ot->poll= ED_operator_screenactive;
+ ot->exec = fullscreen_back_exec;
+ ot->poll = ED_operator_screenactive;
}
/* *********** show user pref window ****** */
@@ -3226,10 +3229,10 @@ static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
sizey= 480;
/* some magic to calculate postition */
- rect.xmin= event->x + CTX_wm_window(C)->posx - sizex/2;
- rect.ymin= event->y + CTX_wm_window(C)->posy - sizey/2;
- rect.xmax= rect.xmin + sizex;
- rect.ymax= rect.ymin + sizey;
+ rect.xmin = event->x + CTX_wm_window(C)->posx - sizex/2;
+ rect.ymin = event->y + CTX_wm_window(C)->posy - sizey/2;
+ rect.xmax = rect.xmin + sizex;
+ rect.ymax = rect.ymin + sizey;
/* changes context! */
WM_window_open_temp(C, &rect, WM_WINDOW_USERPREFS);
@@ -3241,13 +3244,13 @@ static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
static void SCREEN_OT_userpref_show(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Show/Hide User Preferences";
- ot->description= "Show/hide user preferences";
- ot->idname= "SCREEN_OT_userpref_show";
+ ot->name = "Show/Hide User Preferences";
+ ot->description = "Show/hide user preferences";
+ ot->idname = "SCREEN_OT_userpref_show";
/* api callbacks */
- ot->invoke= userpref_show_invoke;
- ot->poll= ED_operator_screenactive;
+ ot->invoke = userpref_show_invoke;
+ ot->poll = ED_operator_screenactive;
}
/********************* new screen operator *********************/
@@ -3266,16 +3269,16 @@ static int screen_new_exec(bContext *C, wmOperator *UNUSED(op))
static void SCREEN_OT_new(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "New Screen";
- ot->description= "Add a new screen";
- ot->idname= "SCREEN_OT_new";
+ ot->name = "New Screen";
+ ot->description = "Add a new screen";
+ ot->idname = "SCREEN_OT_new";
/* api callbacks */
- ot->exec= screen_new_exec;
- ot->poll= WM_operator_winactive;
+ ot->exec = screen_new_exec;
+ ot->poll = WM_operator_winactive;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************* delete screen operator *********************/
@@ -3292,15 +3295,15 @@ static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op))
static void SCREEN_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Screen"; //was scene
- ot->description= "Delete active screen";
- ot->idname= "SCREEN_OT_delete";
+ ot->name = "Delete Screen"; //was scene
+ ot->description = "Delete active screen";
+ ot->idname = "SCREEN_OT_delete";
/* api callbacks */
- ot->exec= screen_delete_exec;
+ ot->exec = screen_delete_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************* new scene operator *********************/
@@ -3311,17 +3314,17 @@ static int scene_new_exec(bContext *C, wmOperator *op)
Main *bmain= CTX_data_main(C);
int type= RNA_enum_get(op->ptr, "type");
- if(type == SCE_COPY_NEW) {
+ if (type == SCE_COPY_NEW) {
newscene= add_scene("Scene");
}
else { /* different kinds of copying */
newscene= copy_scene(scene, type);
/* these can't be handled in blenkernel curently, so do them here */
- if(type == SCE_COPY_LINK_DATA) {
+ if (type == SCE_COPY_LINK_DATA) {
ED_object_single_users(bmain, newscene, 0);
}
- else if(type == SCE_COPY_FULL) {
+ else if (type == SCE_COPY_FULL) {
ED_object_single_users(bmain, newscene, 1);
}
}
@@ -3344,19 +3347,19 @@ static void SCENE_OT_new(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "New Scene";
- ot->description= "Add new scene by type";
- ot->idname= "SCENE_OT_new";
+ ot->name = "New Scene";
+ ot->description = "Add new scene by type";
+ ot->idname = "SCENE_OT_new";
/* api callbacks */
- ot->exec= scene_new_exec;
- ot->invoke= WM_menu_invoke;
+ ot->exec = scene_new_exec;
+ ot->invoke = WM_menu_invoke;
/* 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", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
}
/********************* delete scene operator *********************/
@@ -3367,7 +3370,7 @@ static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op))
ED_screen_delete_scene(C, scene);
- if(G.f & G_DEBUG)
+ if (G.f & G_DEBUG)
printf("scene delete %p\n", scene);
WM_event_add_notifier(C, NC_SCENE|NA_REMOVED, scene);
@@ -3378,15 +3381,15 @@ static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op))
static void SCENE_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Scene";
- ot->description= "Delete active scene";
- ot->idname= "SCENE_OT_delete";
+ ot->name = "Delete Scene";
+ ot->description = "Delete active scene";
+ ot->idname = "SCENE_OT_delete";
/* api callbacks */
- ot->exec= scene_delete_exec;
+ ot->exec = scene_delete_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* **************** Assigning operatortypes to global list, adding handlers **************** */
@@ -3471,8 +3474,8 @@ static void keymap_modal_set(wmKeyConfig *keyconf)
static int open_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if(drag->type==WM_DRAG_PATH) {
- if(drag->icon==ICON_FILE_BLEND)
+ if (drag->type==WM_DRAG_PATH) {
+ if (drag->icon==ICON_FILE_BLEND)
return 1;
}
return 0;
@@ -3494,7 +3497,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
wmKeyMapItem *kmi;
/* Screen Editing ------------------------------------------------ */
- keymap= WM_keymap_find(keyconf, "Screen Editing", 0, 0);
+ keymap = WM_keymap_find(keyconf, "Screen Editing", 0, 0);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "modifier", 0);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "modifier", 1);
@@ -3513,12 +3516,12 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
/* Header Editing ------------------------------------------------ */
- keymap= WM_keymap_find(keyconf, "Header", 0, 0);
+ keymap = WM_keymap_find(keyconf, "Header", 0, 0);
WM_keymap_add_item(keymap, "SCREEN_OT_header_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0);
/* Screen General ------------------------------------------------ */
- keymap= WM_keymap_find(keyconf, "Screen", 0, 0);
+ keymap = WM_keymap_find(keyconf, "Screen", 0, 0);
/* standard timers */
WM_keymap_add_item(keymap, "SCREEN_OT_animation_step", TIMER0, KM_ANY, KM_ANY, 0);
@@ -3572,7 +3575,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
/* Anim Playback ------------------------------------------------ */
- keymap= WM_keymap_find(keyconf, "Frames", 0, 0);
+ keymap = WM_keymap_find(keyconf, "Frames", 0, 0);
/* frame offsets */
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", UPARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "delta", 10);
@@ -3588,10 +3591,15 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", TRUE);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", FALSE);
- WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", UPARROWKEY, KM_PRESS, 0, 0);
- RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "next", FALSE);
+ kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", UPARROWKEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(kmi->ptr, "next", TRUE);
+
+ kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", DOWNARROWKEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(kmi->ptr, "next", FALSE);
- WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIALAST, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIALAST, KM_PRESS, 0, 0);
+ RNA_boolean_set(kmi->ptr, "next", TRUE);
+
kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIAFIRST, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "next", FALSE);
@@ -3605,7 +3613,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
/* Alternative keys for animation and sequencer playing */
#if 0 // XXX: disabled for restoring later... bad implementation
- keymap= WM_keymap_find(keyconf, "Frames", 0, 0);
+ keymap = WM_keymap_find(keyconf, "Frames", 0, 0);
kmi = WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE);
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index deeb3061ad5..e12e6b0ef82 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -106,14 +106,14 @@ static int screenshot_data_create(bContext *C, wmOperator *op)
dumprect= screenshot(C, &dumpsx, &dumpsy);
- if(dumprect) {
+ if (dumprect) {
ScreenshotData *scd= MEM_callocN(sizeof(ScreenshotData), "screenshot");
ScrArea *sa= CTX_wm_area(C);
scd->dumpsx= dumpsx;
scd->dumpsy= dumpsy;
scd->dumprect= dumprect;
- if(sa)
+ if (sa)
scd->crop= sa->totrct;
op->customdata= scd;
@@ -129,8 +129,8 @@ static void screenshot_data_free(wmOperator *op)
{
ScreenshotData *scd= op->customdata;
- if(scd) {
- if(scd->dumprect)
+ if (scd) {
+ if (scd->dumprect)
MEM_freeN(scd->dumprect);
MEM_freeN(scd);
op->customdata= NULL;
@@ -143,8 +143,8 @@ static void screenshot_crop(ImBuf *ibuf, rcti crop)
unsigned int *from= ibuf->rect + crop.ymin*ibuf->x + crop.xmin;
int y, cropw= crop.xmax - crop.xmin, croph = crop.ymax - crop.ymin;
- if(cropw > 0 && croph > 0) {
- for(y=0; y<croph; y++, to+=cropw, from+=ibuf->x)
+ if (cropw > 0 && croph > 0) {
+ for (y=0; y<croph; y++, to+=cropw, from+=ibuf->x)
memmove(to, from, sizeof(unsigned int)*cropw);
ibuf->x= cropw;
@@ -156,14 +156,14 @@ static int screenshot_exec(bContext *C, wmOperator *op)
{
ScreenshotData *scd= op->customdata;
- if(scd == NULL) {
+ if (scd == NULL) {
/* when running exec directly */
screenshot_data_create(C, op);
scd= op->customdata;
}
- if(scd) {
- if(scd->dumprect) {
+ if (scd) {
+ if (scd->dumprect) {
Scene *scene= CTX_data_scene(C);
ImBuf *ibuf;
char path[FILE_MAX];
@@ -174,15 +174,15 @@ static int screenshot_exec(bContext *C, wmOperator *op)
BLI_path_abs(path, G.main->name);
/* BKE_add_image_extension() checks for if extension was already set */
- if(scene->r.scemode & R_EXTENSION)
- if(strlen(path)<FILE_MAX-5)
+ if (scene->r.scemode & R_EXTENSION)
+ if (strlen(path)<FILE_MAX-5)
BKE_add_image_extension(path, scene->r.im_format.imtype);
ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
ibuf->rect= scd->dumprect;
/* crop to show only single editor */
- if(!RNA_boolean_get(op->ptr, "full"))
+ if (!RNA_boolean_get(op->ptr, "full"))
screenshot_crop(ibuf, scd->crop);
BKE_write_ibuf(ibuf, path, &scene->r.im_format);
@@ -197,8 +197,8 @@ static int screenshot_exec(bContext *C, wmOperator *op)
static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- if(screenshot_data_create(C, op)) {
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (screenshot_data_create(C, op)) {
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return screenshot_exec(C, op);
RNA_string_set(op->ptr, "filepath", G.ima);
@@ -218,15 +218,15 @@ static int screenshot_cancel(bContext *UNUSED(C), wmOperator *op)
void SCREEN_OT_screenshot(wmOperatorType *ot)
{
- ot->name= "Save Screenshot"; /* weak: opname starting with 'save' makes filewindow give save-over */
- ot->idname= "SCREEN_OT_screenshot";
+ ot->name = "Save Screenshot"; /* weak: opname starting with 'save' makes filewindow give save-over */
+ ot->idname = "SCREEN_OT_screenshot";
- ot->invoke= screenshot_invoke;
- ot->exec= screenshot_exec;
- ot->poll= WM_operator_winactive;
- ot->cancel= screenshot_cancel;
+ ot->invoke = screenshot_invoke;
+ ot->exec = screenshot_exec;
+ ot->poll = WM_operator_winactive;
+ ot->cancel = screenshot_cancel;
- ot->flag= 0;
+ ot->flag = 0;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "");
@@ -249,7 +249,7 @@ static void screenshot_freejob(void *sjv)
{
ScreenshotJob *sj= sjv;
- if(sj->dumprect)
+ if (sj->dumprect)
MEM_freeN(sj->dumprect);
MEM_freeN(sj);
@@ -262,7 +262,7 @@ static void screenshot_updatejob(void *sjv)
ScreenshotJob *sj= sjv;
unsigned int *dumprect;
- if(sj->dumprect==NULL) {
+ if (sj->dumprect==NULL) {
dumprect= MEM_mallocN(sizeof(int) * sj->dumpsx * sj->dumpsy, "dumprect");
glReadPixels(sj->x, sj->y, sj->dumpsx, sj->dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
glFinish();
@@ -283,8 +283,8 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
rd.frs_sec= U.scrcastfps;
rd.frs_sec_base= 1.0f;
- if(BKE_imtype_is_movie(rd.im_format.imtype)) {
- if(!mh->start_movie(sj->scene, &rd, sj->dumpsx, sj->dumpsy, &sj->reports)) {
+ if (BKE_imtype_is_movie(rd.im_format.imtype)) {
+ if (!mh->start_movie(sj->scene, &rd, sj->dumpsx, sj->dumpsy, &sj->reports)) {
printf("screencast job stopped\n");
return;
}
@@ -297,18 +297,20 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
*do_update= 1; // wait for opengl rect
- while(*stop==0) {
+ while (*stop==0) {
- if(sj->dumprect) {
+ if (sj->dumprect) {
- if(mh) {
- if(mh->append_movie(&rd, rd.sfra, rd.cfra, (int *)sj->dumprect,
+ if (mh) {
+ if (mh->append_movie(&rd, rd.sfra, rd.cfra, (int *)sj->dumprect,
sj->dumpsx, sj->dumpsy, &sj->reports))
{
BKE_reportf(&sj->reports, RPT_INFO, "Appended frame: %d", rd.cfra);
printf("Appended frame %d\n", rd.cfra);
- } else
+ }
+ else {
break;
+ }
}
else {
ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.im_format.planes, 0);
@@ -320,7 +322,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
ibuf->rect= sj->dumprect;
ok= BKE_write_ibuf(ibuf, name, &rd.im_format);
- if(ok==0) {
+ if (ok==0) {
printf("Write error: cannot save %s\n", name);
BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s\n", name);
break;
@@ -346,7 +348,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
PIL_sleep_ms(U.scrcastwait);
}
- if(mh)
+ if (mh)
mh->end_movie();
BKE_report(&sj->reports, RPT_INFO, "Screencast job stopped");
@@ -359,7 +361,7 @@ static int screencast_exec(bContext *C, wmOperator *op)
ScreenshotJob *sj= MEM_callocN(sizeof(ScreenshotJob), "screenshot job");
/* setup sj */
- if(RNA_boolean_get(op->ptr, "full")) {
+ if (RNA_boolean_get(op->ptr, "full")) {
wmWindow *win= CTX_wm_window(C);
sj->x= 0;
sj->y= 0;
@@ -392,14 +394,14 @@ static int screencast_exec(bContext *C, wmOperator *op)
void SCREEN_OT_screencast(wmOperatorType *ot)
{
- ot->name= "Make Screencast";
- ot->idname= "SCREEN_OT_screencast";
+ ot->name = "Make Screencast";
+ ot->idname = "SCREEN_OT_screencast";
- ot->invoke= WM_operator_confirm;
- ot->exec= screencast_exec;
- ot->poll= WM_operator_winactive;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = screencast_exec;
+ ot->poll = WM_operator_winactive;
- ot->flag= 0;
+ ot->flag = 0;
RNA_def_property(ot->srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "");
diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index 8a6a236d10f..cf8179b4d0e 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -40,6 +40,7 @@ set(INC_SYS
set(SRC
paint_cursor.c
+ paint_hide.c
paint_image.c
paint_ops.c
paint_stroke.c
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index ea1e3eb47af..be50b842914 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -341,7 +341,7 @@ static int sculpt_get_brush_geometry(bContext* C, ViewContext *vc,
window[0] = x + vc->ar->winrct.xmin;
window[1] = y + vc->ar->winrct.ymin;
- if(vc->obact->sculpt && vc->obact->sculpt->pbvh &&
+ if (vc->obact->sculpt && vc->obact->sculpt->pbvh &&
sculpt_stroke_get_location(C, location, window)) {
*pixel_radius =
project_brush_radius(vc,
@@ -375,7 +375,7 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
rctf quad;
/* check for overlay mode */
- if(!(brush->flag & BRUSH_TEXTURE_OVERLAY) ||
+ if (!(brush->flag & BRUSH_TEXTURE_OVERLAY) ||
!(ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_FIXED, MTEX_MAP_MODE_TILED)))
return;
@@ -392,7 +392,7 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
GL_VIEWPORT_BIT|
GL_TEXTURE_BIT);
- if(load_tex(sd, brush, vc)) {
+ if (load_tex(sd, brush, vc)) {
glEnable(GL_BLEND);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
@@ -403,7 +403,7 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
glPushMatrix();
glLoadIdentity();
- if(brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
+ if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
/* brush rotation */
glTranslatef(0.5, 0.5, 0);
glRotatef((double)RAD2DEGF((brush->flag & BRUSH_RAKE) ?
@@ -412,13 +412,13 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
glTranslatef(-0.5f, -0.5f, 0);
/* scale based on tablet pressure */
- if(sd->draw_pressure && brush_use_size_pressure(vc->scene, brush)) {
+ if (sd->draw_pressure && brush_use_size_pressure(vc->scene, brush)) {
glTranslatef(0.5f, 0.5f, 0);
glScalef(1.0f/sd->pressure_value, 1.0f/sd->pressure_value, 1);
glTranslatef(-0.5f, -0.5f, 0);
}
- if(sd->draw_anchored) {
+ if (sd->draw_anchored) {
const float *aim = sd->anchored_initial_mouse;
const rcti *win = &vc->ar->winrct;
quad.xmin = aim[0]-sd->anchored_size - win->xmin;
@@ -473,12 +473,12 @@ static void paint_cursor_on_hit(Sculpt *sd, Brush *brush, ViewContext *vc,
float unprojected_radius, projected_radius;
/* update the brush's cached 3D radius */
- if(!brush_use_locked_size(vc->scene, brush)) {
+ if (!brush_use_locked_size(vc->scene, brush)) {
/* get 2D brush radius */
- if(sd->draw_anchored)
+ if (sd->draw_anchored)
projected_radius = sd->anchored_size;
else {
- if(brush->flag & BRUSH_ANCHORED)
+ if (brush->flag & BRUSH_ANCHORED)
projected_radius = 8;
else
projected_radius = brush_size(vc->scene, brush);
@@ -489,7 +489,7 @@ static void paint_cursor_on_hit(Sculpt *sd, Brush *brush, ViewContext *vc,
projected_radius);
/* scale 3D brush radius by pressure */
- if(sd->draw_pressure && brush_use_size_pressure(vc->scene, brush))
+ if (sd->draw_pressure && brush_use_size_pressure(vc->scene, brush))
unprojected_radius *= sd->pressure_value;
/* set cached value in either Brush or UnifiedPaintSettings */
@@ -515,7 +515,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
final_radius = brush_size(scene, brush);
/* check that brush drawing is enabled */
- if(!(paint->flags & PAINT_SHOW_BRUSH))
+ if (!(paint->flags & PAINT_SHOW_BRUSH))
return;
/* can't use stroke vc here because this will be called during
@@ -524,7 +524,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
/* TODO: as sculpt and other paint modes are unified, this
* special mode of drawing will go away */
- if(vc.obact->sculpt) {
+ if (vc.obact->sculpt) {
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
float location[3];
int pixel_radius, hit;
@@ -541,7 +541,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
const float dx = sd->last_x - x;
const float dy = sd->last_y - y;
- if(dx*dx + dy*dy >= r*r) {
+ if (dx*dx + dy*dy >= r*r) {
sd->last_angle = atan2(dx, dy);
sd->last_x = u*sd->last_x + v*x;
@@ -555,13 +555,13 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
/* draw overlay */
paint_draw_alpha_overlay(sd, brush, &vc, x, y);
- if(brush_use_locked_size(scene, brush))
+ if (brush_use_locked_size(scene, brush))
brush_set_size(scene, brush, pixel_radius);
/* check if brush is subtracting, use different color then */
/* TODO: no way currently to know state of pen flip or
* invert key modifier without starting a stroke */
- if((!(brush->flag & BRUSH_INVERTED) ^
+ if ((!(brush->flag & BRUSH_INVERTED) ^
!(brush->flag & BRUSH_DIR_IN)) &&
ELEM5(brush->sculpt_tool, SCULPT_TOOL_DRAW,
SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
@@ -569,10 +569,10 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
outline_col = brush->sub_col;
/* only do if brush is over the mesh */
- if(hit)
+ if (hit)
paint_cursor_on_hit(sd, brush, &vc, location);
- if(sd->draw_anchored) {
+ if (sd->draw_anchored) {
final_radius = sd->anchored_size;
translation[0] = sd->anchored_initial_mouse[0] - vc.ar->winrct.xmin;
translation[1] = sd->anchored_initial_mouse[1] - vc.ar->winrct.ymin;
@@ -602,6 +602,6 @@ void paint_cursor_start(bContext *C, int (*poll)(bContext *C))
{
Paint *p = paint_get_active(CTX_data_scene(C));
- if(p && !p->paint_cursor)
+ if (p && !p->paint_cursor)
p->paint_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), poll, paint_draw_cursor, NULL);
}
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
new file mode 100644
index 00000000000..fcf7d2eba68
--- /dev/null
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -0,0 +1,392 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2010 by Nicholas Bishop
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ * Implements the PBVH node hiding operator
+ *
+ */
+
+/** \file blender/editors/sculpt_paint/paint_hide.c
+ * \ingroup edsculpt
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_bitmap.h"
+#include "BLI_listbase.h"
+#include "BLI_math_vector.h"
+#include "BLI_pbvh.h"
+#include "BLI_utildefines.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "BKE_context.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_mesh.h"
+#include "BKE_multires.h"
+#include "BKE_paint.h"
+#include "BKE_subsurf.h"
+
+#include "BIF_glutil.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ED_screen.h"
+#include "ED_view3d.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "paint_intern.h"
+#include "sculpt_intern.h" /* for undo push */
+
+#include <assert.h>
+
+static int planes_contain_v3(float (*planes)[4], int totplane, const float p[3])
+{
+ int i;
+
+ for (i = 0; i < totplane; i++) {
+ if (dot_v3v3(planes[i], p) + planes[i][3] > 0)
+ return 0;
+ }
+
+ return 1;
+}
+
+/* return true if the element should be hidden/shown */
+static int is_effected(PartialVisArea area,
+ float planes[4][4],
+ const float co[3])
+{
+ if (area == PARTIALVIS_ALL)
+ return 1;
+ else {
+ int inside = planes_contain_v3(planes, 4, co);
+ return ((inside && area == PARTIALVIS_INSIDE) ||
+ (!inside && area == PARTIALVIS_OUTSIDE));
+ }
+}
+
+static void partialvis_update_mesh(Object *ob,
+ PBVH *pbvh,
+ PBVHNode *node,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4])
+{
+ MVert *mvert;
+ int *vert_indices;
+ int any_changed = 0, any_visible = 0, totvert, i;
+
+ BLI_pbvh_node_num_verts(pbvh, node, NULL, &totvert);
+ BLI_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
+
+ sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
+
+ for (i = 0; i < totvert; i++) {
+ MVert *v = &mvert[vert_indices[i]];
+
+ /* hide vertex if in the hide volume */
+ if (is_effected(area, planes, v->co)) {
+ if (action == PARTIALVIS_HIDE)
+ v->flag |= ME_HIDE;
+ else
+ v->flag &= ~ME_HIDE;
+ any_changed = 1;
+ }
+
+ if (!(v->flag & ME_HIDE))
+ any_visible = 1;
+ }
+
+ if (any_changed) {
+ BLI_pbvh_node_mark_rebuild_draw(node);
+ BLI_pbvh_node_fully_hidden_set(node, !any_visible);
+ }
+}
+
+/* Hide or show elements in multires grids with a special GridFlags
+ customdata layer. */
+static void partialvis_update_grids(Object *ob,
+ PBVH *pbvh,
+ PBVHNode *node,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4])
+{
+ DMGridData **grids;
+ BLI_bitmap *grid_hidden;
+ int any_visible = 0;
+ int *grid_indices, gridsize, totgrid, any_changed, i;
+
+ /* get PBVH data */
+ BLI_pbvh_node_get_grids(pbvh, node,
+ &grid_indices, &totgrid, NULL, &gridsize,
+ &grids, NULL);
+ grid_hidden = BLI_pbvh_grid_hidden(pbvh);
+
+ sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
+
+ any_changed = 0;
+ for (i = 0; i < totgrid; i++) {
+ int any_hidden = 0;
+ int g = grid_indices[i], x, y;
+ BLI_bitmap gh = grid_hidden[g];
+
+ if (!gh) {
+ switch(action) {
+ case PARTIALVIS_HIDE:
+ /* create grid flags data */
+ gh = grid_hidden[g] = BLI_BITMAP_NEW(gridsize * gridsize,
+ "partialvis_update_grids");
+ break;
+ case PARTIALVIS_SHOW:
+ /* entire grid is visible, nothing to show */
+ continue;
+ }
+ }
+ else if (action == PARTIALVIS_SHOW && area == PARTIALVIS_ALL) {
+ /* special case if we're showing all, just free the
+ grid */
+ MEM_freeN(gh);
+ grid_hidden[g] = NULL;
+ any_changed = 1;
+ any_visible = 1;
+ continue;
+ }
+
+ for (y = 0; y < gridsize; y++) {
+ for (x = 0; x < gridsize; x++) {
+ const float *co = grids[g][y * gridsize + x].co;
+
+ /* skip grid element if not in the effected area */
+ if (is_effected(area, planes, co)) {
+ /* set or clear the hide flag */
+ BLI_BITMAP_MODIFY(gh, y * gridsize + x,
+ action == PARTIALVIS_HIDE);
+
+ any_changed = 1;
+ }
+
+ /* keep track of whether any elements are still hidden */
+ if (BLI_BITMAP_GET(gh, y * gridsize + x))
+ any_hidden = 1;
+ else
+ any_visible = 1;
+ }
+ }
+
+ /* if everything in the grid is now visible, free the grid
+ flags */
+ if (!any_hidden) {
+ MEM_freeN(gh);
+ grid_hidden[g] = NULL;
+ }
+ }
+
+ /* mark updates if anything was hidden/shown */
+ if (any_changed) {
+ BLI_pbvh_node_mark_rebuild_draw(node);
+ BLI_pbvh_node_fully_hidden_set(node, !any_visible);
+ multires_mark_as_modified(ob, MULTIRES_HIDDEN_MODIFIED);
+ }
+}
+
+static void rect_from_props(rcti *rect, PointerRNA *ptr)
+{
+ rect->xmin = RNA_int_get(ptr, "xmin");
+ rect->ymin = RNA_int_get(ptr, "ymin");
+ rect->xmax = RNA_int_get(ptr, "xmax");
+ rect->ymax = RNA_int_get(ptr, "ymax");
+}
+
+static void clip_planes_from_rect(bContext *C,
+ float clip_planes[4][4],
+ const rcti *rect)
+{
+ ViewContext vc;
+ BoundBox bb;
+ bglMats mats= {{0}};
+
+ view3d_operator_needs_opengl(C);
+ view3d_set_viewcontext(C, &vc);
+ view3d_get_transformation(vc.ar, vc.rv3d, vc.obact, &mats);
+ ED_view3d_calc_clipping(&bb, clip_planes, &mats, rect);
+ mul_m4_fl(clip_planes, -1.0f);
+}
+
+/* If mode is inside, get all PBVH nodes that lie at least partially
+ inside the clip_planes volume. If mode is outside, get all nodes
+ that lie at least partially outside the volume. If showing all, get
+ all nodes. */
+static void get_pbvh_nodes(PBVH *pbvh,
+ PBVHNode ***nodes,
+ int *totnode,
+ float clip_planes[4][4],
+ PartialVisArea mode)
+{
+ BLI_pbvh_SearchCallback cb;
+
+ /* select search callback */
+ switch(mode) {
+ case PARTIALVIS_INSIDE:
+ cb = BLI_pbvh_node_planes_contain_AABB;
+ break;
+ case PARTIALVIS_OUTSIDE:
+ cb = BLI_pbvh_node_planes_exclude_AABB;
+ break;
+ case PARTIALVIS_ALL:
+ cb = NULL;
+ }
+
+ BLI_pbvh_search_gather(pbvh, cb, clip_planes, nodes, totnode);
+}
+
+static int hide_show_exec(bContext *C, wmOperator *op)
+{
+ ARegion *ar = CTX_wm_region(C);
+ Object *ob = CTX_data_active_object(C);
+ Mesh *me = ob->data;
+ PartialVisAction action;
+ PartialVisArea area;
+ PBVH *pbvh;
+ PBVHNode **nodes;
+ DerivedMesh *dm;
+ PBVHType pbvh_type;
+ float clip_planes[4][4];
+ rcti rect;
+ int totnode, i;
+
+ /* read operator properties */
+ action = RNA_enum_get(op->ptr, "action");
+ area = RNA_enum_get(op->ptr, "area");
+ rect_from_props(&rect, op->ptr);
+
+ clip_planes_from_rect(C, clip_planes, &rect);
+
+ dm = mesh_get_derived_final(CTX_data_scene(C), ob, CD_MASK_BAREMESH);
+ pbvh = dm->getPBVH(ob, dm);
+ ob->sculpt->pbvh = pbvh;
+
+ get_pbvh_nodes(pbvh, &nodes, &totnode, clip_planes, area);
+ pbvh_type = BLI_pbvh_type(pbvh);
+
+ /* start undo */
+ switch(action) {
+ case PARTIALVIS_HIDE:
+ sculpt_undo_push_begin("Hide area");
+ break;
+ case PARTIALVIS_SHOW:
+ sculpt_undo_push_begin("Show area");
+ break;
+ }
+
+ for (i = 0; i < totnode; i++) {
+ switch(pbvh_type) {
+ case PBVH_FACES:
+ partialvis_update_mesh(ob, pbvh, nodes[i], action, area, clip_planes);
+ break;
+ case PBVH_GRIDS:
+ partialvis_update_grids(ob, pbvh, nodes[i], action, area, clip_planes);
+ break;
+ }
+ }
+
+ if (nodes)
+ MEM_freeN(nodes);
+
+ /* end undo */
+ sculpt_undo_push_end();
+
+ /* ensure that edges and faces get hidden as well (not used by
+ sculpt but it looks wrong when entering editmode otherwise) */
+ if (pbvh_type == PBVH_FACES) {
+ mesh_flush_hidden_from_verts(me->mvert, me->mloop,
+ me->medge, me->totedge,
+ me->mpoly, me->totpoly);
+ }
+
+ ED_region_tag_redraw(ar);
+
+ return OPERATOR_FINISHED;
+}
+
+static int hide_show_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ PartialVisArea area = RNA_enum_get(op->ptr, "area");
+
+ if (area != PARTIALVIS_ALL)
+ return WM_border_select_invoke(C, op, event);
+ else
+ return op->type->exec(C, op);
+}
+
+void PAINT_OT_hide_show(struct wmOperatorType *ot)
+{
+ static EnumPropertyItem action_items[] = {
+ {PARTIALVIS_HIDE, "HIDE", 0, "Hide", "Hide vertices"},
+ {PARTIALVIS_SHOW, "SHOW", 0, "Show", "Show vertices"},
+ {0}};
+
+ static EnumPropertyItem area_items[] = {
+ {PARTIALVIS_OUTSIDE, "OUTSIDE", 0, "Outside",
+ "Hide or show vertices outside the selection"},
+ {PARTIALVIS_INSIDE, "INSIDE", 0, "Inside",
+ "Hide or show vertices inside the selection"},
+ {PARTIALVIS_ALL, "ALL", 0, "All",
+ "Hide or show all vertices"},
+ {0}};
+
+ /* identifiers */
+ ot->name = "Hide/Show";
+ ot->idname = "PAINT_OT_hide_show";
+
+ /* api callbacks */
+ ot->invoke = hide_show_invoke;
+ ot->modal = WM_border_select_modal;
+ ot->exec = hide_show_exec;
+ /* sculpt-only for now */
+ ot->poll = sculpt_mode_poll;
+
+ ot->flag = OPTYPE_REGISTER;
+
+ /* rna */
+ RNA_def_enum(ot->srna, "action", action_items, PARTIALVIS_HIDE,
+ "Action", "Whether to hide or show vertices");
+ RNA_def_enum(ot->srna, "area", area_items, PARTIALVIS_INSIDE,
+ "Area", "Which vertices to hide or show");
+
+ RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index f8a9516c97e..40b04437cdf 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -403,13 +403,14 @@ static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, int
IMB_rectcpy(tmpibuf, ibuf, 0, 0, tile->x*IMAPAINT_TILE_SIZE,
tile->y*IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
- if(ibuf->rect_float) {
+ if (ibuf->rect_float) {
SWAP(void*, tmpibuf->rect_float, tile->rect);
- } else {
+ }
+ else {
SWAP(void*, tmpibuf->rect, tile->rect);
}
- if(restore)
+ if (restore)
IMB_rectcpy(ibuf, tmpibuf, tile->x*IMAPAINT_TILE_SIZE,
tile->y*IMAPAINT_TILE_SIZE, 0, 0, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
}
@@ -421,10 +422,10 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
int allocsize;
short use_float = ibuf->rect_float ? 1 : 0;
- for(tile=lb->first; tile; tile=tile->next)
- if(tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source)
- if(tile->use_float == use_float)
- if(strcmp(tile->idname, ima->id.name)==0 && strcmp(tile->ibufname, ibuf->name)==0)
+ for (tile=lb->first; tile; tile=tile->next)
+ if (tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source)
+ if (tile->use_float == use_float)
+ if (strcmp(tile->idname, ima->id.name)==0 && strcmp(tile->ibufname, ibuf->name)==0)
return tile->rect;
if (*tmpibuf==NULL)
@@ -463,11 +464,11 @@ static void image_undo_restore(bContext *C, ListBase *lb)
tmpibuf= IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
IB_rectfloat|IB_rect);
- for(tile=lb->first; tile; tile=tile->next) {
+ for (tile=lb->first; tile; tile=tile->next) {
short use_float;
/* find image based on name, pointer becomes invalid with global undo */
- if(ima && strcmp(tile->idname, ima->id.name)==0) {
+ if (ima && strcmp(tile->idname, ima->id.name)==0) {
/* ima is valid */
}
else {
@@ -476,7 +477,7 @@ static void image_undo_restore(bContext *C, ListBase *lb)
ibuf= BKE_image_get_ibuf(ima, NULL);
- if(ima && ibuf && strcmp(tile->ibufname, ibuf->name)!=0) {
+ if (ima && ibuf && strcmp(tile->ibufname, ibuf->name)!=0) {
/* current ImBuf filename was changed, probably current frame
* was changed when paiting on image sequence, rather than storing
* full image user (which isn't so obvious, btw) try to find ImBuf with
@@ -499,9 +500,9 @@ static void image_undo_restore(bContext *C, ListBase *lb)
undo_copy_tile(tile, tmpibuf, ibuf, 1);
GPU_free_image(ima); /* force OpenGL reload */
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */
- if(ibuf->mipmap[0])
+ if (ibuf->mipmap[0])
ibuf->userflags |= IB_MIPMAP_INVALID; /* force mipmap recreatiom */
}
@@ -513,7 +514,7 @@ static void image_undo_free(ListBase *lb)
{
UndoImageTile *tile;
- for(tile=lb->first; tile; tile=tile->next)
+ for (tile=lb->first; tile; tile=tile->next)
MEM_freeN(tile->rect);
}
@@ -523,7 +524,7 @@ static Image *imapaint_face_image(const ImagePaintState *s, int face_index)
{
Image *ima;
- if(scene_use_new_shading_nodes(s->scene)) {
+ if (scene_use_new_shading_nodes(s->scene)) {
MFace *mf = s->me->mface+face_index;
ED_object_get_active_image(s->ob, mf->mat_nr, &ima, NULL, NULL);
}
@@ -539,7 +540,7 @@ static Image *project_paint_face_image(const ProjPaintState *ps, MTFace *dm_mtfa
{
Image *ima;
- if(ps->do_new_shading_nodes) { /* cached scene_use_new_shading_nodes result */
+ if (ps->do_new_shading_nodes) { /* cached scene_use_new_shading_nodes result */
MFace *mf = ps->dm_mface+face_index;
ED_object_get_active_image(ps->ob, mf->mat_nr, &ima, NULL, NULL);
}
@@ -815,7 +816,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float
static int project_paint_occlude_ptv(float pt[3], float v1[4], float v2[4], float v3[4], float w[3], int is_ortho)
{
/* if all are behind us, return false */
- if(v1[2] > pt[2] && v2[2] > pt[2] && v3[2] > pt[2])
+ if (v1[2] > pt[2] && v2[2] > pt[2] && v3[2] > pt[2])
return 0;
/* do a 2D point in try intersection */
@@ -825,7 +826,7 @@ static int project_paint_occlude_ptv(float pt[3], float v1[4], float v2[4], floa
/* From here on we know there IS an intersection */
/* if ALL of the verts are infront of us then we know it intersects ? */
- if(v1[2] < pt[2] && v2[2] < pt[2] && v3[2] < pt[2]) {
+ if (v1[2] < pt[2] && v2[2] < pt[2] && v3[2] < pt[2]) {
return 1;
}
else {
@@ -889,14 +890,14 @@ static int project_bucket_point_occluded(const ProjPaintState *ps, LinkNode *buc
if (orig_face != face_index) {
mf = ps->dm_mface + face_index;
- if(do_clip)
+ if (do_clip)
isect_ret = project_paint_occlude_ptv_clip(ps, mf, pixelScreenCo, ps->screenCoords[mf->v1], ps->screenCoords[mf->v2], ps->screenCoords[mf->v3], 0);
else
isect_ret = project_paint_occlude_ptv(pixelScreenCo, ps->screenCoords[mf->v1], ps->screenCoords[mf->v2], ps->screenCoords[mf->v3], w, ps->is_ortho);
- /* Note, if isect_ret==-1 then we dont want to test the other side of the quad */
+ /* Note, if isect_ret==-1 then we don't want to test the other side of the quad */
if (isect_ret==0 && mf->v4) {
- if(do_clip)
+ if (do_clip)
isect_ret = project_paint_occlude_ptv_clip(ps, mf, pixelScreenCo, ps->screenCoords[mf->v1], ps->screenCoords[mf->v3], ps->screenCoords[mf->v4], 1);
else
isect_ret = project_paint_occlude_ptv(pixelScreenCo, ps->screenCoords[mf->v1], ps->screenCoords[mf->v3], ps->screenCoords[mf->v4], w, ps->is_ortho);
@@ -1352,7 +1353,7 @@ static void project_face_pixel(const MTFace *tf_other, ImBuf *ibuf_other, const
}
-/* run this outside project_paint_uvpixel_init since pixels with mask 0 dont need init */
+/* run this outside project_paint_uvpixel_init since pixels with mask 0 don't need init */
static float project_paint_uvpixel_mask(
const ProjPaintState *ps,
const int face_index,
@@ -1392,7 +1393,8 @@ static float project_paint_uvpixel_mask(
else {
return 0.0f;
}
- } else {
+ }
+ else {
mask = 1.0f;
}
@@ -1452,7 +1454,7 @@ static float project_paint_uvpixel_mask(
}
// This only works when the opacity dosnt change while painting, stylus pressure messes with this
- // so dont use it.
+ // so don't use it.
// if (ps->is_airbrush==0) mask *= brush_alpha(ps->brush);
return mask;
@@ -1506,7 +1508,7 @@ static ProjPixel *project_paint_uvpixel_init(
projPixel->origColor.uint = projPixel->newColor.uint = *projPixel->pixel.uint_pt;
}
- /* screenspace unclamped, we could keep its z and w values but dont need them at the moment */
+ /* screenspace unclamped, we could keep its z and w values but don't need them at the moment */
copy_v2_v2(projPixel->projCoSS, pixelScreenCo);
projPixel->x_px = x_px;
@@ -1745,7 +1747,7 @@ static int line_clip_rect2f(
/* scale the quad & tri about its center
* scaling by PROJ_FACE_SCALE_SEAM (0.99x) is used for getting fake UV pixel coords that are on the
- * edge of the face but slightly inside it occlusion tests dont return hits on adjacent faces */
+ * edge of the face but slightly inside it occlusion tests don't return hits on adjacent faces */
#ifndef PROJ_DEBUG_NOSEAMBLEED
static void scale_quad(float insetCos[4][3], float *origCos[4], const float inset)
{
@@ -1984,7 +1986,7 @@ static void project_bucket_clip_face(
inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v3coSS[0], v3coSS[1]) << 2;
if (inside_bucket_flag == ISECT_ALL3) {
- /* all screenspace points are inside the bucket bounding box, this means we dont need to clip and can simply return the UVs */
+ /* all screenspace points are inside the bucket bounding box, this means we don't need to clip and can simply return the UVs */
if (flip) { /* facing the back? */
copy_v2_v2(bucket_bounds_uv[0], uv3co);
copy_v2_v2(bucket_bounds_uv[1], uv2co);
@@ -2095,7 +2097,7 @@ static void project_bucket_clip_face(
/* now we have all points we need, collect their angles and sort them clockwise */
- for(i=0; i<(*tot); i++) {
+ for (i=0; i<(*tot); i++) {
cent[0] += isectVCosSS[i][0];
cent[1] += isectVCosSS[i][1];
}
@@ -2108,7 +2110,7 @@ static void project_bucket_clip_face(
#if 0 /* uses a few more cycles then the above loop */
- for(i=0; i<(*tot); i++) {
+ for (i=0; i<(*tot); i++) {
isectVCosSS[i][2] = angle_2d_clockwise(up, cent, isectVCosSS[i]);
}
#endif
@@ -2116,7 +2118,7 @@ static void project_bucket_clip_face(
v1_clipSS[0] = cent[0]; /* Abuse this var for the loop below */
v1_clipSS[1] = cent[1] + 1.0f;
- for(i=0; i<(*tot); i++) {
+ for (i=0; i<(*tot); i++) {
v2_clipSS[0] = isectVCosSS[i][0] - cent[0];
v2_clipSS[1] = isectVCosSS[i][1] - cent[1];
isectVCosSS[i][2] = atan2f(v1_clipSS[0]*v2_clipSS[1] - v1_clipSS[1]*v2_clipSS[0], v1_clipSS[0]*v2_clipSS[0]+v1_clipSS[1]*v2_clipSS[1]);
@@ -2141,12 +2143,12 @@ static void project_bucket_clip_face(
doubles = TRUE;
while (doubles==TRUE) {
doubles = FALSE;
- for(i=1; i<(*tot); i++) {
+ for (i=1; i<(*tot); i++) {
if (fabsf(isectVCosSS[i-1][0]-isectVCosSS[i][0]) < PROJ_GEOM_TOLERANCE &&
fabsf(isectVCosSS[i-1][1]-isectVCosSS[i][1]) < PROJ_GEOM_TOLERANCE)
{
int j;
- for(j=i+1; j<(*tot); j++) {
+ for (j=i+1; j<(*tot); j++) {
isectVCosSS[j-1][0] = isectVCosSS[j][0];
isectVCosSS[j-1][1] = isectVCosSS[j][1];
}
@@ -2165,13 +2167,13 @@ static void project_bucket_clip_face(
if (is_ortho) {
- for(i=0; i<(*tot); i++) {
+ for (i=0; i<(*tot); i++) {
barycentric_weights_v2(v1coSS, v2coSS, v3coSS, isectVCosSS[i], w);
interp_v2_v2v2v2(bucket_bounds_uv[i], uv1co, uv2co, uv3co, w);
}
}
else {
- for(i=0; i<(*tot); i++) {
+ for (i=0; i<(*tot); i++) {
barycentric_weights_v2_persp(v1coSS, v2coSS, v3coSS, isectVCosSS[i], w);
interp_v2_v2v2v2(bucket_bounds_uv[i], uv1co, uv2co, uv3co, w);
}
@@ -2405,12 +2407,12 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
if (pixel_bounds_array(uv_clip, &bounds_px, ibuf->x, ibuf->y, uv_clip_tot)) {
- if(clamp_u) {
+ if (clamp_u) {
CLAMP(bounds_px.xmin, 0, ibuf->x);
CLAMP(bounds_px.xmax, 0, ibuf->x);
}
- if(clamp_v) {
+ if (clamp_v) {
CLAMP(bounds_px.ymin, 0, ibuf->y);
CLAMP(bounds_px.ymax, 0, ibuf->y);
}
@@ -2429,7 +2431,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
/* Note about IsectPoly2Df_twoside, checking the face or uv flipping doesnt work,
* could check the poly direction but better to do this */
- if( (do_backfacecull && IsectPoly2Df(uv, uv_clip, uv_clip_tot)) ||
+ if ( (do_backfacecull && IsectPoly2Df(uv, uv_clip, uv_clip_tot)) ||
(do_backfacecull==0 && IsectPoly2Df_twoside(uv, uv_clip, uv_clip_tot))) {
has_x_isect = has_isect = 1;
@@ -2438,7 +2440,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
else screen_px_from_persp(uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo, w);
/* a pity we need to get the worldspace pixel location here */
- if(do_clip) {
+ if (do_clip) {
interp_v3_v3v3v3(wco, ps->dm_mvert[ (*(&mf->v1 + i1)) ].co, ps->dm_mvert[ (*(&mf->v1 + i2)) ].co, ps->dm_mvert[ (*(&mf->v1 + i3)) ].co, w);
if (ED_view3d_clipping_test(ps->rv3d, wco, TRUE)) {
continue; /* Watch out that no code below this needs to run */
@@ -2479,7 +2481,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
#endif
}
}
- } while(side--);
+ } while (side--);
@@ -2641,7 +2643,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
else {
barycentric_weights_v2(tf_uv_pxoffset[0], tf_uv_pxoffset[1], tf_uv_pxoffset[2], uv_close, w);
}
-#else /* this is buggy with quads, dont use for now */
+#else /* this is buggy with quads, don't use for now */
/* Cheat, we know where we are along the edge so work out the weights from that */
fac = fac1 + (fac * (fac2-fac1));
@@ -2659,7 +2661,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
}
/* a pity we need to get the worldspace pixel location here */
- if(do_clip) {
+ if (do_clip) {
if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w);
else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w);
@@ -2852,7 +2854,7 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
return 0;
}
-/* Add faces to the bucket but dont initialize its pixels
+/* Add faces to the bucket but don't initialize its pixels
* TODO - when painting occluded, sort the faces on their min-Z and only add faces that faces that are not occluded */
static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const int face_index)
{
@@ -2952,7 +2954,7 @@ static void project_paint_begin(ProjPaintState *ps)
/* ---- end defines ---- */
- if(ps->source==PROJ_SRC_VIEW)
+ if (ps->source==PROJ_SRC_VIEW)
ED_view3d_clipping_local(ps->rv3d, ps->ob->obmat); /* faster clipping lookups */
/* paint onto the derived mesh */
@@ -2963,7 +2965,7 @@ static void project_paint_begin(ProjPaintState *ps)
ps->dm = mesh_create_derived_render(ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE);
ps->dm_release= TRUE;
}
- else if(ps->ob->derivedFinal && CustomData_has_layer( &ps->ob->derivedFinal->faceData, CD_MTFACE)) {
+ else if (ps->ob->derivedFinal && CustomData_has_layer( &ps->ob->derivedFinal->faceData, CD_MTFACE)) {
ps->dm = ps->ob->derivedFinal;
ps->dm_release= FALSE;
}
@@ -2974,7 +2976,7 @@ static void project_paint_begin(ProjPaintState *ps)
if ( !CustomData_has_layer( &ps->dm->faceData, CD_MTFACE) ) {
- if(ps->dm_release)
+ if (ps->dm_release)
ps->dm->release(ps->dm);
ps->dm = NULL;
@@ -3019,7 +3021,7 @@ static void project_paint_begin(ProjPaintState *ps)
}
/* when using subsurf or multires, mface arrays are thrown away, we need to keep a copy */
- if(ps->dm->type != DM_TYPE_CDDM) {
+ if (ps->dm->type != DM_TYPE_CDDM) {
ps->dm_mvert= MEM_dupallocN(ps->dm_mvert);
ps->dm_mface= MEM_dupallocN(ps->dm_mface);
/* looks like these are ok for now.*/
@@ -3040,7 +3042,7 @@ static void project_paint_begin(ProjPaintState *ps)
invert_m4_m4(ps->ob->imat, ps->ob->obmat);
- if(ps->source==PROJ_SRC_VIEW) {
+ if (ps->source==PROJ_SRC_VIEW) {
/* normal drawing */
ps->winx= ps->ar->winx;
ps->winy= ps->ar->winy;
@@ -3126,7 +3128,7 @@ static void project_paint_begin(ProjPaintState *ps)
projScreenCo= *ps->screenCoords;
if (ps->is_ortho) {
- for(a=0, mv=ps->dm_mvert; a < ps->dm_totvert; a++, mv++, projScreenCo+=4) {
+ for (a=0, mv=ps->dm_mvert; a < ps->dm_totvert; a++, mv++, projScreenCo+=4) {
mul_v3_m4v3(projScreenCo, ps->projectMat, mv->co);
/* screen space, not clamped */
@@ -3136,7 +3138,7 @@ static void project_paint_begin(ProjPaintState *ps)
}
}
else {
- for(a=0, mv=ps->dm_mvert; a < ps->dm_totvert; a++, mv++, projScreenCo+=4) {
+ for (a=0, mv=ps->dm_mvert; a < ps->dm_totvert; a++, mv++, projScreenCo+=4) {
copy_v3_v3(projScreenCo, mv->co);
projScreenCo[3] = 1.0f;
@@ -3169,7 +3171,7 @@ static void project_paint_begin(ProjPaintState *ps)
ps->screenMax[1] += projMargin;
ps->screenMin[1] -= projMargin;
- if(ps->source==PROJ_SRC_VIEW) {
+ if (ps->source==PROJ_SRC_VIEW) {
#ifdef PROJ_DEBUG_WINCLIP
CLAMP(ps->screenMin[0], (float)(-diameter), (float)(ps->winx + diameter));
CLAMP(ps->screenMax[0], (float)(-diameter), (float)(ps->winx + diameter));
@@ -3235,7 +3237,7 @@ static void project_paint_begin(ProjPaintState *ps)
ps->vertFlags = MEM_callocN(sizeof(char) * ps->dm_totvert, "paint-vertFlags");
- for(a=0, mv=ps->dm_mvert; a < ps->dm_totvert; a++, mv++) {
+ for (a=0, mv=ps->dm_mvert; a < ps->dm_totvert; a++, mv++) {
normal_short_to_float_v3(no, mv->no);
if (ps->is_ortho) {
@@ -3254,7 +3256,7 @@ static void project_paint_begin(ProjPaintState *ps)
}
- for(face_index = 0, tf = ps->dm_mtface, mf = ps->dm_mface; face_index < ps->dm_totface; mf++, tf++, face_index++) {
+ for (face_index = 0, tf = ps->dm_mtface, mf = ps->dm_mface; face_index < ps->dm_totface; mf++, tf++, face_index++) {
#ifndef PROJ_DEBUG_NOSEAMBLEED
/* add face user if we have bleed enabled, set the UV seam flags later */
@@ -3400,7 +3402,7 @@ static void project_paint_end(ProjPaintState *ps)
int a;
/* build undo data from original pixel colors */
- if(U.uiflag & USER_GLOBALUNDO) {
+ if (U.uiflag & USER_GLOBALUNDO) {
ProjPixel *projPixel;
ImBuf *tmpibuf = NULL, *tmpibuf_float = NULL;
LinkNode *pixel_node;
@@ -3419,7 +3421,7 @@ static void project_paint_end(ProjPaintState *ps)
int last_image_index = -1;
int last_tile_width=0;
- for(a=0, last_projIma=ps->projImages; a < ps->image_tot; a++, last_projIma++) {
+ for (a=0, last_projIma=ps->projImages; a < ps->image_tot; a++, last_projIma++) {
int size = sizeof(void **) * IMAPAINT_TILE_NUMBER(last_projIma->ibuf->x) * IMAPAINT_TILE_NUMBER(last_projIma->ibuf->y);
last_projIma->undoRect = (void **) BLI_memarena_alloc(arena, size);
memset(last_projIma->undoRect, 0, size);
@@ -3428,7 +3430,7 @@ static void project_paint_end(ProjPaintState *ps)
for (bucket_index = 0; bucket_index < bucket_tot; bucket_index++) {
/* loop through all pixels */
- for(pixel_node= ps->bucketRect[bucket_index]; pixel_node; pixel_node= pixel_node->next) {
+ for (pixel_node= ps->bucketRect[bucket_index]; pixel_node; pixel_node= pixel_node->next) {
/* ok we have a pixel, was it modified? */
projPixel = (ProjPixel *)pixel_node->link;
@@ -3506,18 +3508,18 @@ static void project_paint_end(ProjPaintState *ps)
}
/* copy for subsurf/multires, so throw away */
- if(ps->dm->type != DM_TYPE_CDDM) {
- if(ps->dm_mvert) MEM_freeN(ps->dm_mvert);
- if(ps->dm_mface) MEM_freeN(ps->dm_mface);
- /* looks like these dont need copying */
+ if (ps->dm->type != DM_TYPE_CDDM) {
+ if (ps->dm_mvert) MEM_freeN(ps->dm_mvert);
+ if (ps->dm_mface) MEM_freeN(ps->dm_mface);
+ /* looks like these don't need copying */
#if 0
- if(ps->dm_mtface) MEM_freeN(ps->dm_mtface);
- if(ps->dm_mtface_clone) MEM_freeN(ps->dm_mtface_clone);
- if(ps->dm_mtface_stencil) MEM_freeN(ps->dm_mtface_stencil);
+ if (ps->dm_mtface) MEM_freeN(ps->dm_mtface);
+ if (ps->dm_mtface_clone) MEM_freeN(ps->dm_mtface_clone);
+ if (ps->dm_mtface_stencil) MEM_freeN(ps->dm_mtface_stencil);
#endif
}
- if(ps->dm_release)
+ if (ps->dm_release)
ps->dm->release(ps->dm);
}
@@ -3589,11 +3591,11 @@ static int project_image_refresh_tagged(ProjPaintState *ps)
/* run this per painting onto each mouse location */
static int project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2])
{
- if(ps->source==PROJ_SRC_VIEW) {
+ if (ps->source==PROJ_SRC_VIEW) {
float min_brush[2], max_brush[2];
const float radius = (float)brush_size(ps->scene, ps->brush);
- /* so we dont have a bucket bounds that is way too small to paint into */
+ /* so we don't have a bucket bounds that is way too small to paint into */
// if (radius < 1.0f) radius = 1.0f; // this doesn't work yet :/
min_brush[0] = mval_f[0] - radius;
@@ -3791,17 +3793,17 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo
{
if (ps->is_texbrush) {
/* rgba already holds a texture result here from higher level function */
- if(use_color_correction){
+ if (use_color_correction) {
float rgba_br[3];
srgb_to_linearrgb_v3_v3(rgba_br, ps->brush->rgb);
mul_v3_v3(rgba, rgba_br);
}
- else{
+ else {
mul_v3_v3(rgba, ps->brush->rgb);
}
}
else {
- if(use_color_correction){
+ if (use_color_correction) {
srgb_to_linearrgb_v3_v3(rgba, ps->brush->rgb);
}
else {
@@ -3879,7 +3881,7 @@ static void *do_projectpaint_thread(void *ph_v)
project_bucket_init(ps, thread_index, bucket_index, &bucket_bounds);
}
- if(ps->source != PROJ_SRC_VIEW) {
+ if (ps->source != PROJ_SRC_VIEW) {
/* Re-Projection, simple, no brushes! */
@@ -3887,7 +3889,7 @@ static void *do_projectpaint_thread(void *ph_v)
projPixel = (ProjPixel *)node->link;
bicubic_interpolation_color(ps->reproject_ibuf, projPixel->newColor.ch, NULL, projPixel->projCoSS[0], projPixel->projCoSS[1]);
- if(projPixel->newColor.ch[3]) {
+ if (projPixel->newColor.ch[3]) {
mask = ((float)projPixel->mask)/65535.0f;
blend_color_mix_accum(projPixel->pixel.ch_pt, projPixel->origColor.ch, projPixel->newColor.ch, (int)(mask*projPixel->newColor.ch[3]));
@@ -3914,7 +3916,8 @@ static void *do_projectpaint_thread(void *ph_v)
/* note, for clone and smear, we only use the alpha, could be a special function */
brush_sample_tex(ps->scene, ps->brush, projPixel->projCoSS, rgba, thread_index);
alpha = rgba[3];
- } else {
+ }
+ else {
alpha = 1.0f;
}
@@ -3964,12 +3967,12 @@ static void *do_projectpaint_thread(void *ph_v)
case PAINT_TOOL_CLONE:
if (is_floatbuf) {
if (((ProjPixelClone *)projPixel)->clonepx.f[3]) {
- do_projectpaint_clone_f(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */
+ do_projectpaint_clone_f(ps, projPixel, alpha, mask); /* rgba isn't used for cloning, only alpha */
}
}
else {
if (((ProjPixelClone*)projPixel)->clonepx.ch[3]) {
- do_projectpaint_clone(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */
+ do_projectpaint_clone(ps, projPixel, alpha, mask); /* rgba isn't used for cloning, only alpha */
}
}
break;
@@ -3986,7 +3989,7 @@ static void *do_projectpaint_thread(void *ph_v)
}
}
- if(lock_alpha) {
+ if (lock_alpha) {
if (is_floatbuf) projPixel->pixel.f_pt[3]= projPixel->origColor.f[3];
else projPixel->pixel.ch_pt[3]= projPixel->origColor.ch[3];
}
@@ -4035,7 +4038,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), const float lastp
BLI_init_threads(&threads, do_projectpaint_thread, ps->thread_tot);
/* get the threads running */
- for(a=0; a < ps->thread_tot; a++) {
+ for (a=0; a < ps->thread_tot; a++) {
/* set defaults in handles */
//memset(&handles[a], 0, sizeof(BakeShade));
@@ -4068,9 +4071,9 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), const float lastp
/* move threaded bounds back into ps->projectPartialRedraws */
- for(i=0; i < ps->image_tot; i++) {
+ for (i=0; i < ps->image_tot; i++) {
int touch = 0;
- for(a=0; a < ps->thread_tot; a++) {
+ for (a=0; a < ps->thread_tot; a++) {
touch |= partial_redraw_array_merge(ps->projImages[i].partRedrawRect, handles[a].projImages[i].partRedrawRect, PROJ_BOUNDBOX_SQUARED);
}
@@ -4112,7 +4115,7 @@ static int project_paint_stroke(ProjPaintState *ps, BrushPainter *painter, const
redraw= project_paint_sub_stroke(ps, painter, prevmval_i, mval_i, time, pressure);
- if(project_image_refresh_tagged(ps))
+ if (project_image_refresh_tagged(ps))
return redraw;
return 0;
@@ -4166,14 +4169,14 @@ static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w,
static void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint)
{
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */
- if(ibuf->mipmap[0])
+ if (ibuf->mipmap[0])
ibuf->userflags |= IB_MIPMAP_INVALID;
/* todo: should set_tpage create ->rect? */
- if(texpaint || (sima && sima->lock)) {
+ if (texpaint || (sima && sima->lock)) {
int w = imapaintpartial.x2 - imapaintpartial.x1;
int h = imapaintpartial.y2 - imapaintpartial.y1;
/* Testing with partial update in uv editor too */
@@ -4197,7 +4200,8 @@ static void imapaint_ibuf_get_set_rgb(ImBuf *ibuf, int x, int y, short torus, sh
if (set) {
IMAPAINT_FLOAT_RGB_COPY(rrgbf, rgb);
- } else {
+ }
+ else {
IMAPAINT_FLOAT_RGB_COPY(rgb, rrgbf);
}
}
@@ -4206,7 +4210,8 @@ static void imapaint_ibuf_get_set_rgb(ImBuf *ibuf, int x, int y, short torus, sh
if (set) {
IMAPAINT_FLOAT_RGB_TO_CHAR(rrgb, rgb)
- } else {
+ }
+ else {
IMAPAINT_CHAR_RGB_TO_FLOAT(rgb, rrgb)
}
}
@@ -4340,7 +4345,7 @@ static void imapaint_lift_smear(ImBuf *ibuf, ImBuf *ibufb, int *pos)
imapaint_set_region(region, 0, 0, pos[0], pos[1], ibufb->x, ibufb->y);
tot= imapaint_torus_split_region(region, ibufb, ibuf);
- for(a=0; a<tot; a++)
+ for (a=0; a<tot; a++)
IMB_rectblend(ibufb, ibuf, region[a].destx, region[a].desty,
region[a].srcx, region[a].srcy,
region[a].width, region[a].height, IMB_BLEND_COPY_RGB);
@@ -4385,17 +4390,17 @@ static int imapaint_paint_op(void *state, ImBuf *ibufb, const float lastpos[2],
imapaint_convert_brushco(ibufb, pos, bpos);
/* lift from canvas */
- if(s->tool == PAINT_TOOL_SOFTEN) {
+ if (s->tool == PAINT_TOOL_SOFTEN) {
imapaint_lift_soften(s->canvas, ibufb, bpos, torus);
}
- else if(s->tool == PAINT_TOOL_SMEAR) {
+ else if (s->tool == PAINT_TOOL_SMEAR) {
if (lastpos[0]==pos[0] && lastpos[1]==pos[1])
return 0;
imapaint_convert_brushco(ibufb, lastpos, blastpos);
imapaint_lift_smear(s->canvas, ibufb, blastpos);
}
- else if(s->tool == PAINT_TOOL_CLONE && s->clonecanvas) {
+ else if (s->tool == PAINT_TOOL_CLONE && s->clonecanvas) {
liftpos[0]= pos[0] - offset[0]*s->canvas->x;
liftpos[1]= pos[1] - offset[1]*s->canvas->y;
@@ -4405,7 +4410,7 @@ static int imapaint_paint_op(void *state, ImBuf *ibufb, const float lastpos[2],
frombuf= (clonebuf)? clonebuf: ibufb;
- if(torus) {
+ if (torus) {
imapaint_set_region(region, bpos[0], bpos[1], 0, 0, frombuf->x, frombuf->y);
tot= imapaint_torus_split_region(region, s->canvas, frombuf);
}
@@ -4415,7 +4420,7 @@ static int imapaint_paint_op(void *state, ImBuf *ibufb, const float lastpos[2],
}
/* blend into canvas */
- for(a=0; a<tot; a++) {
+ for (a=0; a<tot; a++) {
imapaint_dirty_region(s->image, s->canvas,
region[a].destx, region[a].desty,
region[a].width, region[a].height);
@@ -4426,7 +4431,7 @@ static int imapaint_paint_op(void *state, ImBuf *ibufb, const float lastpos[2],
region[a].width, region[a].height, blend);
}
- if(clonebuf) IMB_freeImBuf(clonebuf);
+ if (clonebuf) IMB_freeImBuf(clonebuf);
return 1;
}
@@ -4453,35 +4458,35 @@ static int imapaint_canvas_set(ImagePaintState *s, Image *ima)
ImBuf *ibuf= BKE_image_get_ibuf(ima, s->sima? &s->sima->iuser: NULL);
/* verify that we can paint and set canvas */
- if(ima==NULL) {
+ if (ima==NULL) {
return 0;
}
- else if(ima->packedfile && ima->rr) {
+ else if (ima->packedfile && ima->rr) {
s->warnpackedfile = ima->id.name + 2;
return 0;
}
- else if(ibuf && ibuf->channels!=4) {
+ else if (ibuf && ibuf->channels!=4) {
s->warnmultifile = ima->id.name + 2;
return 0;
}
- else if(!ibuf || !(ibuf->rect || ibuf->rect_float))
+ else if (!ibuf || !(ibuf->rect || ibuf->rect_float))
return 0;
s->image= ima;
s->canvas= ibuf;
/* set clone canvas */
- if(s->tool == PAINT_TOOL_CLONE) {
+ if (s->tool == PAINT_TOOL_CLONE) {
ima= s->brush->clone.image;
ibuf= BKE_image_get_ibuf(ima, s->sima? &s->sima->iuser: NULL);
- if(!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
+ if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
return 0;
s->clonecanvas= ibuf;
/* temporarily add float rect for cloning */
- if(s->canvas->rect_float && !s->clonecanvas->rect_float) {
+ if (s->canvas->rect_float && !s->clonecanvas->rect_float) {
int profile = IB_PROFILE_NONE;
/* Don't want to color manage, but don't disturb existing profiles */
@@ -4492,7 +4497,7 @@ static int imapaint_canvas_set(ImagePaintState *s, Image *ima)
SWAP(int, s->clonecanvas->profile, profile);
}
- else if(!s->canvas->rect_float && !s->clonecanvas->rect)
+ else if (!s->canvas->rect_float && !s->clonecanvas->rect)
IMB_rect_from_float(s->clonecanvas);
}
@@ -4510,7 +4515,7 @@ static int imapaint_paint_sub_stroke(ImagePaintState *s, BrushPainter *painter,
ImBuf *ibuf= BKE_image_get_ibuf(image, s->sima? &s->sima->iuser: NULL);
float pos[2];
- if(!ibuf)
+ if (!ibuf)
return 0;
pos[0] = uv[0]*ibuf->x;
@@ -4543,7 +4548,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
newimage = imapaint_face_image(s, newfaceindex);
ibuf= BKE_image_get_ibuf(newimage, s->sima? &s->sima->iuser: NULL);
- if(ibuf && ibuf->rect)
+ if (ibuf && ibuf->rect)
imapaint_pick_uv(s->scene, s->ob, newfaceindex, mval, newuv);
else {
newimage = NULL;
@@ -4621,7 +4626,7 @@ static Brush *uv_sculpt_brush(bContext *C)
Scene *scene= CTX_data_scene(C);
ToolSettings *settings= scene->toolsettings;
- if(!settings->uvsculpt)
+ if (!settings->uvsculpt)
return NULL;
return paint_brush(&settings->uvsculpt->paint);
}
@@ -4630,19 +4635,19 @@ static int image_paint_poll(bContext *C)
{
Object *obact = CTX_data_active_object(C);
- if(!image_paint_brush(C))
+ if (!image_paint_brush(C))
return 0;
- if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) {
+ if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) {
return 1;
}
else {
SpaceImage *sima= CTX_wm_space_image(C);
- if(sima) {
+ if (sima) {
ARegion *ar= CTX_wm_region(C);
- if((sima->flag & SI_DRAWTOOL) && ar->regiontype==RGN_TYPE_WINDOW)
+ if ((sima->flag & SI_DRAWTOOL) && ar->regiontype==RGN_TYPE_WINDOW)
return 1;
}
}
@@ -4659,15 +4664,15 @@ static int uv_sculpt_brush_poll(bContext *C)
Scene *scene = CTX_data_scene(C);
ToolSettings *toolsettings = scene->toolsettings;
- if(!uv_sculpt_brush(C) || !obedit || obedit->type != OB_MESH)
+ if (!uv_sculpt_brush(C) || !obedit || obedit->type != OB_MESH)
return 0;
em = BMEdit_FromObject(obedit);
ret = EDBM_texFaceCheck(em);
- if(ret && sima) {
+ if (ret && sima) {
ARegion *ar= CTX_wm_region(C);
- if((toolsettings->use_uv_sculpt) && ar->regiontype==RGN_TYPE_WINDOW)
+ if ((toolsettings->use_uv_sculpt) && ar->regiontype==RGN_TYPE_WINDOW)
return 1;
}
@@ -4676,7 +4681,7 @@ static int uv_sculpt_brush_poll(bContext *C)
static int image_paint_3d_poll(bContext *C)
{
- if(CTX_wm_region_view3d(C))
+ if (CTX_wm_region_view3d(C))
return image_paint_poll(C);
return 0;
@@ -4686,9 +4691,9 @@ static int image_paint_2d_clone_poll(bContext *C)
{
Brush *brush= image_paint_brush(C);
- if(!CTX_wm_region_view3d(C) && image_paint_poll(C))
- if(brush && (brush->imagepaint_tool == PAINT_TOOL_CLONE))
- if(brush->clone.image)
+ if (!CTX_wm_region_view3d(C) && image_paint_poll(C))
+ if (brush && (brush->imagepaint_tool == PAINT_TOOL_CLONE))
+ if (brush->clone.image)
return 1;
return 0;
@@ -4711,7 +4716,7 @@ typedef struct PaintOperation {
int first;
int prevmouse[2];
- float prev_pressure; /* need this since we dont get tablet events for pressure change */
+ float prev_pressure; /* need this since we don't get tablet events for pressure change */
int orig_brush_size;
double starttime;
@@ -4723,15 +4728,15 @@ typedef struct PaintOperation {
static void paint_redraw(bContext *C, ImagePaintState *s, int final)
{
- if(final) {
- if(s->image)
+ if (final) {
+ if (s->image)
GPU_free_image(s->image);
/* compositor listener deals with updating */
WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, s->image);
}
else {
- if(!s->sima || !s->sima->lock)
+ if (!s->sima || !s->sima->lock)
ED_region_tag_redraw(CTX_wm_region(C));
else
WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, s->image);
@@ -4779,7 +4784,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps)
ps->seam_bleed_px = settings->imapaint.seam_bleed; /* pixel num to bleed */
#endif
- if(ps->do_mask_normal) {
+ if (ps->do_mask_normal) {
ps->normal_angle_inner = settings->imapaint.normal_angle;
ps->normal_angle = (ps->normal_angle_inner + 90.0f) * 0.5f;
}
@@ -4791,16 +4796,16 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps)
ps->normal_angle *= (float)(M_PI_2 / 90);
ps->normal_angle_range = ps->normal_angle - ps->normal_angle_inner;
- if(ps->normal_angle_range <= 0.0f)
+ if (ps->normal_angle_range <= 0.0f)
ps->do_mask_normal = 0; /* no need to do blending */
}
static void paint_brush_init_tex(Brush *brush)
{
/* init mtex nodes */
- if(brush) {
+ if (brush) {
MTex *mtex= &brush->mtex;
- if(mtex->tex && mtex->tex->nodetree)
+ if (mtex->tex && mtex->tex->nodetree)
ntreeTexBeginExecTree(mtex->tex->nodetree, 1); /* has internal flag to detect it only does it once */
}
@@ -4818,16 +4823,16 @@ static int texture_paint_init(bContext *C, wmOperator *op)
/* XXX: Soften tool does not support projection painting atm, so just disable
* projection for this brush */
- if(brush->imagepaint_tool == PAINT_TOOL_SOFTEN) {
+ if (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) {
settings->imapaint.flag |= IMAGEPAINT_PROJECT_DISABLE;
pop->restore_projection = 1;
}
/* initialize from context */
- if(CTX_wm_region_view3d(C)) {
+ if (CTX_wm_region_view3d(C)) {
pop->mode= PAINT_MODE_3D;
- if(!(settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE))
+ if (!(settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE))
pop->mode= PAINT_MODE_3D_PROJECT;
else
view3d_set_viewcontext(C, &pop->vc);
@@ -4842,12 +4847,12 @@ static int texture_paint_init(bContext *C, wmOperator *op)
pop->s.brush = brush;
pop->s.tool = brush->imagepaint_tool;
- if(pop->mode == PAINT_MODE_3D && (pop->s.tool == PAINT_TOOL_CLONE))
+ if (pop->mode == PAINT_MODE_3D && (pop->s.tool == PAINT_TOOL_CLONE))
pop->s.tool = PAINT_TOOL_DRAW;
pop->s.blend = brush->blend;
pop->orig_brush_size= brush_size(scene, brush);
- if(pop->mode != PAINT_MODE_2D) {
+ if (pop->mode != PAINT_MODE_2D) {
pop->s.ob = OBACT;
pop->s.me = get_mesh(pop->s.ob);
if (!pop->s.me) return 0;
@@ -4855,10 +4860,10 @@ static int texture_paint_init(bContext *C, wmOperator *op)
else {
pop->s.image = pop->s.sima->image;
- if(!imapaint_canvas_set(&pop->s, pop->s.image)) {
- if(pop->s.warnmultifile)
+ if (!imapaint_canvas_set(&pop->s, pop->s.image)) {
+ if (pop->s.warnmultifile)
BKE_report(op->reports, RPT_WARNING, "Image requires 4 color channels to paint");
- if(pop->s.warnpackedfile)
+ if (pop->s.warnpackedfile)
BKE_report(op->reports, RPT_WARNING, "Packed MultiLayer files cannot be painted");
return 0;
@@ -4868,7 +4873,7 @@ static int texture_paint_init(bContext *C, wmOperator *op)
paint_brush_init_tex(pop->s.brush);
/* note, if we have no UVs on the derived mesh, then we must return here */
- if(pop->mode == PAINT_MODE_3D_PROJECT) {
+ if (pop->mode == PAINT_MODE_3D_PROJECT) {
/* initialize all data from the context */
project_state_init(C, OBACT, &pop->ps);
@@ -4880,14 +4885,14 @@ static int texture_paint_init(bContext *C, wmOperator *op)
if (pop->ps.ob==NULL || !(pop->ps.ob->lay & pop->ps.v3d->lay))
return 0;
- /* Dont allow brush size below 2 */
+ /* Don't allow brush size below 2 */
if (brush_size(scene, brush) < 2)
brush_set_size(scene, brush, 2);
/* allocate and initialize spacial data structures */
project_paint_begin(&pop->ps);
- if(pop->ps.dm==NULL)
+ if (pop->ps.dm==NULL)
return 0;
}
@@ -4914,13 +4919,13 @@ static void paint_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
time= RNA_float_get(itemptr, "time");
pressure= RNA_float_get(itemptr, "pressure");
- if(pop->first)
+ if (pop->first)
project_paint_begin_clone(&pop->ps, mouse);
- if(pop->mode == PAINT_MODE_3D)
+ if (pop->mode == PAINT_MODE_3D)
view3d_operator_needs_opengl(C);
- if(pop->mode == PAINT_MODE_3D_PROJECT) {
+ if (pop->mode == PAINT_MODE_3D_PROJECT) {
redraw= project_paint_stroke(&pop->ps, pop->painter, pop->prevmouse, mouse, time, pressure);
pop->prevmouse[0]= mouse[0];
pop->prevmouse[1]= mouse[1];
@@ -4932,7 +4937,7 @@ static void paint_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
pop->prevmouse[1]= mouse[1];
}
- if(redraw)
+ if (redraw)
paint_redraw(C, &pop->s, 0);
pop->first= 0;
@@ -4940,9 +4945,9 @@ static void paint_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
static void paint_brush_exit_tex(Brush *brush)
{
- if(brush) {
+ if (brush) {
MTex *mtex= &brush->mtex;
- if(mtex->tex && mtex->tex->nodetree)
+ if (mtex->tex && mtex->tex->nodetree)
ntreeTexEndExecTree(mtex->tex->nodetree->execdata, 1);
}
}
@@ -4953,10 +4958,10 @@ static void paint_exit(bContext *C, wmOperator *op)
ToolSettings *settings= scene->toolsettings;
PaintOperation *pop= op->customdata;
- if(pop->timer)
+ if (pop->timer)
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), pop->timer);
- if(pop->restore_projection)
+ if (pop->restore_projection)
settings->imapaint.flag &= ~IMAGEPAINT_PROJECT_DISABLE;
paint_brush_exit_tex(pop->s.brush);
@@ -4965,7 +4970,7 @@ static void paint_exit(bContext *C, wmOperator *op)
imapaint_canvas_free(&pop->s);
brush_painter_free(pop->painter);
- if(pop->mode == PAINT_MODE_3D_PROJECT) {
+ if (pop->mode == PAINT_MODE_3D_PROJECT) {
brush_set_size(scene, pop->ps.brush, pop->orig_brush_size);
paint_brush_exit_tex(pop->ps.brush);
@@ -4975,9 +4980,9 @@ static void paint_exit(bContext *C, wmOperator *op)
paint_redraw(C, &pop->s, 1);
undo_paint_push_end(UNDO_PAINT_IMAGE);
- if(pop->s.warnmultifile)
+ if (pop->s.warnmultifile)
BKE_reportf(op->reports, RPT_WARNING, "Image requires 4 color channels to paint: %s", pop->s.warnmultifile);
- if(pop->s.warnpackedfile)
+ if (pop->s.warnpackedfile)
BKE_reportf(op->reports, RPT_WARNING, "Packed MultiLayer files cannot be painted: %s", pop->s.warnpackedfile);
MEM_freeN(pop);
@@ -4985,7 +4990,7 @@ static void paint_exit(bContext *C, wmOperator *op)
static int paint_exec(bContext *C, wmOperator *op)
{
- if(!texture_paint_init(C, op)) {
+ if (!texture_paint_init(C, op)) {
MEM_freeN(op->customdata);
return OPERATOR_CANCELLED;
}
@@ -5015,19 +5020,19 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event)
tablet= 0;
pop->s.blend= pop->s.brush->blend;
- if(event->custom == EVT_DATA_TABLET) {
+ if (event->custom == EVT_DATA_TABLET) {
wmtab= event->customdata;
tablet= (wmtab->Active != EVT_TABLET_NONE);
pressure= wmtab->Pressure;
- if(wmtab->Active == EVT_TABLET_ERASER)
+ if (wmtab->Active == EVT_TABLET_ERASER)
pop->s.blend= IMB_BLEND_ERASE_ALPHA;
}
else { /* otherwise airbrush becomes 1.0 pressure instantly */
pressure= pop->prev_pressure ? pop->prev_pressure : 1.0f;
}
- if(pop->first) {
+ if (pop->first) {
pop->prevmouse[0]= event->mval[0];
pop->prevmouse[1]= event->mval[1];
pop->starttime= time;
@@ -5064,7 +5069,7 @@ static int paint_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
PaintOperation *pop;
- if(!texture_paint_init(C, op)) {
+ if (!texture_paint_init(C, op)) {
MEM_freeN(op->customdata);
return OPERATOR_CANCELLED;
}
@@ -5074,7 +5079,7 @@ static int paint_invoke(bContext *C, wmOperator *op, wmEvent *event)
pop= op->customdata;
WM_event_add_modal_handler(C, op);
- if(pop->s.brush->flag & BRUSH_AIRBRUSH)
+ if (pop->s.brush->flag & BRUSH_AIRBRUSH)
pop->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
return OPERATOR_RUNNING_MODAL;
@@ -5095,7 +5100,7 @@ static int paint_modal(bContext *C, wmOperator *op, wmEvent *event)
paint_apply_event(C, op, event);
break;
case TIMER:
- if(event->customdata == pop->timer)
+ if (event->customdata == pop->timer)
paint_apply_event(C, op, event);
break;
}
@@ -5113,18 +5118,18 @@ static int paint_cancel(bContext *C, wmOperator *op)
void PAINT_OT_image_paint(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Image Paint";
- ot->idname= "PAINT_OT_image_paint";
+ ot->name = "Image Paint";
+ ot->idname = "PAINT_OT_image_paint";
/* api callbacks */
- ot->exec= paint_exec;
- ot->invoke= paint_invoke;
- ot->modal= paint_modal;
- ot->cancel= paint_cancel;
- ot->poll= image_paint_poll;
+ ot->exec = paint_exec;
+ ot->invoke = paint_invoke;
+ ot->modal = paint_modal;
+ ot->cancel = paint_cancel;
+ ot->poll = image_paint_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* properties */
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
@@ -5134,7 +5139,7 @@ int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
{
RegionView3D *rv3d= CTX_wm_region_view3d(C);
- if(!rv3d) {
+ if (!rv3d) {
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -5160,17 +5165,19 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
Paint *paint= paint_get_active(scene);
Brush *brush= paint_brush(paint);
- if(paint && brush && paint->flags & PAINT_SHOW_BRUSH) {
+ if (paint && brush && paint->flags & PAINT_SHOW_BRUSH) {
ToolSettings *ts;
float zoomx, zoomy;
const float size= (float)brush_size(scene, brush);
- const short use_zoom= get_imapaint_zoom(C, &zoomx, &zoomy);
+ short use_zoom;
float pixel_size;
float alpha= 0.5f;
ts = scene->toolsettings;
+ use_zoom= get_imapaint_zoom(C, &zoomx, &zoomy)
+ && !(ts->use_uv_sculpt && (scene->basact->object->mode == OB_MODE_EDIT));
- if(use_zoom && !ts->use_uv_sculpt){
+ if (use_zoom) {
pixel_size = MAX2(size * zoomx, size * zoomy);
}
else {
@@ -5178,7 +5185,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
}
/* fade out the brush (cheap trick to work around brush interfearing with sampling [#])*/
- if(pixel_size < PX_SIZE_FADE_MIN) {
+ if (pixel_size < PX_SIZE_FADE_MIN) {
return;
}
else if (pixel_size < PX_SIZE_FADE_MAX) {
@@ -5190,7 +5197,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
glTranslatef((float)x, (float)y, 0.0f);
/* No need to scale for uv sculpting, on the contrary it might be useful to keep unscaled */
- if(use_zoom && !ts->use_uv_sculpt)
+ if (use_zoom)
glScalef(zoomx, zoomy, 1.0f);
glColor4f(brush->add_col[0], brush->add_col[1], brush->add_col[2], alpha);
@@ -5212,11 +5219,11 @@ static void toggle_paint_cursor(bContext *C, int enable)
Scene *scene = CTX_data_scene(C);
ToolSettings *settings= scene->toolsettings;
- if(settings->imapaint.paintcursor && !enable) {
+ if (settings->imapaint.paintcursor && !enable) {
WM_paint_cursor_end(wm, settings->imapaint.paintcursor);
settings->imapaint.paintcursor = NULL;
}
- else if(enable)
+ else if (enable)
settings->imapaint.paintcursor= WM_paint_cursor_activate(wm, image_paint_poll, brush_drawcursor, NULL);
}
@@ -5229,7 +5236,7 @@ void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings)
{
ImagePaintSettings *imapaint = &settings->imapaint;
- if(!imapaint->paintcursor) {
+ if (!imapaint->paintcursor) {
imapaint->paintcursor =
WM_paint_cursor_activate(wm, image_paint_poll,
brush_drawcursor, NULL);
@@ -5239,8 +5246,8 @@ void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings)
void ED_space_image_uv_sculpt_update(wmWindowManager *wm, ToolSettings *settings)
{
- if(settings->use_uv_sculpt) {
- if(!settings->uvsculpt) {
+ if (settings->use_uv_sculpt) {
+ if (!settings->uvsculpt) {
settings->uvsculpt = MEM_callocN(sizeof(*settings->uvsculpt), "UV Smooth paint");
settings->uv_sculpt_tool = UV_SCULPT_TOOL_GRAB;
settings->uv_sculpt_settings = UV_SCULPT_LOCK_BORDERS | UV_SCULPT_ALL_ISLANDS;
@@ -5253,7 +5260,7 @@ void ED_space_image_uv_sculpt_update(wmWindowManager *wm, ToolSettings *settings
brush_drawcursor, NULL);
}
else {
- if(settings->uvsculpt)
+ if (settings->uvsculpt)
settings->uvsculpt->paint.flags &= ~PAINT_SHOW_BRUSH;
}
}
@@ -5338,18 +5345,18 @@ static int grab_clone_cancel(bContext *UNUSED(C), wmOperator *op)
void PAINT_OT_grab_clone(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Grab Clone";
- ot->idname= "PAINT_OT_grab_clone";
+ ot->name = "Grab Clone";
+ ot->idname = "PAINT_OT_grab_clone";
/* api callbacks */
- ot->exec= grab_clone_exec;
- ot->invoke= grab_clone_invoke;
- ot->modal= grab_clone_modal;
- ot->cancel= grab_clone_cancel;
- ot->poll= image_paint_2d_clone_poll;
+ ot->exec = grab_clone_exec;
+ ot->invoke = grab_clone_invoke;
+ ot->modal = grab_clone_modal;
+ ot->cancel = grab_clone_cancel;
+ ot->poll = image_paint_2d_clone_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* properties */
RNA_def_float_vector(ot->srna, "delta", 2, NULL, -FLT_MAX, FLT_MAX, "Delta", "Delta offset of clone image in 0.0..1.0 coordinates", -1.0f, 1.0f);
@@ -5400,12 +5407,12 @@ static int sample_color_modal(bContext *C, wmOperator *op, wmEvent *event)
/* same as image_paint_poll but fail when face mask mode is enabled */
static int image_paint_sample_color_poll(bContext *C)
{
- if(image_paint_poll(C)) {
- if(CTX_wm_view3d(C)) {
+ if (image_paint_poll(C)) {
+ if (CTX_wm_view3d(C)) {
Object *obact = CTX_data_active_object(C);
if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
Mesh *me= get_mesh(obact);
- if(me) {
+ if (me) {
return !(me->editflag & ME_EDIT_PAINT_MASK);
}
}
@@ -5420,17 +5427,17 @@ static int image_paint_sample_color_poll(bContext *C)
void PAINT_OT_sample_color(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Sample Color";
- ot->idname= "PAINT_OT_sample_color";
+ ot->name = "Sample Color";
+ ot->idname = "PAINT_OT_sample_color";
/* api callbacks */
- ot->exec= sample_color_exec;
- ot->invoke= sample_color_invoke;
- ot->modal= sample_color_modal;
- ot->poll= image_paint_sample_color_poll;
+ ot->exec = sample_color_exec;
+ ot->invoke = sample_color_invoke;
+ ot->modal = sample_color_modal;
+ ot->poll = image_paint_sample_color_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_int_vector(ot->srna, "location", 2, NULL, 0, INT_MAX, "Location", "Cursor location in region coordinates", 0, 16384);
@@ -5460,7 +5467,7 @@ static int set_clone_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
view3d_operator_needs_opengl(C);
- if(!ED_view3d_autodist(scene, ar, v3d, event->mval, location))
+ if (!ED_view3d_autodist(scene, ar, v3d, event->mval, location))
return OPERATOR_CANCELLED;
RNA_float_set_array(op->ptr, "location", location);
@@ -5471,16 +5478,16 @@ static int set_clone_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
void PAINT_OT_clone_cursor_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Clone Cursor";
- ot->idname= "PAINT_OT_clone_cursor_set";
+ ot->name = "Set Clone Cursor";
+ ot->idname = "PAINT_OT_clone_cursor_set";
/* api callbacks */
- ot->exec= set_clone_cursor_exec;
- ot->invoke= set_clone_cursor_invoke;
- ot->poll= image_paint_3d_poll;
+ ot->exec = set_clone_cursor_exec;
+ ot->invoke = set_clone_cursor_invoke;
+ ot->poll = image_paint_3d_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_float_vector(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in world space coordinates", -10000.0f, 10000.0f);
@@ -5490,9 +5497,9 @@ void PAINT_OT_clone_cursor_set(wmOperatorType *ot)
static int texture_paint_toggle_poll(bContext *C)
{
- if(CTX_data_edit_object(C))
+ if (CTX_data_edit_object(C))
return 0;
- if(CTX_data_active_object(C)==NULL)
+ if (CTX_data_active_object(C)==NULL)
return 0;
return 1;
@@ -5504,7 +5511,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
Object *ob= CTX_data_active_object(C);
Mesh *me= NULL;
- if(ob==NULL)
+ if (ob==NULL)
return OPERATOR_CANCELLED;
if (object_data_is_libdata(ob)) {
@@ -5514,15 +5521,15 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
me= get_mesh(ob);
- if(!(ob->mode & OB_MODE_TEXTURE_PAINT) && !me) {
+ if (!(ob->mode & OB_MODE_TEXTURE_PAINT) && !me) {
BKE_report(op->reports, RPT_ERROR, "Can only enter texture paint mode for mesh objects");
return OPERATOR_CANCELLED;
}
- if(ob->mode & OB_MODE_TEXTURE_PAINT) {
+ if (ob->mode & OB_MODE_TEXTURE_PAINT) {
ob->mode &= ~OB_MODE_TEXTURE_PAINT;
- if(U.glreslimit != 0)
+ if (U.glreslimit != 0)
GPU_free_images();
GPU_paint_set_mipmap(1);
@@ -5531,13 +5538,13 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
else {
ob->mode |= OB_MODE_TEXTURE_PAINT;
- if(me->mtface==NULL)
+ if (me->mtface==NULL)
me->mtface= CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT,
NULL, me->totface);
paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT);
- if(U.glreslimit != 0)
+ if (U.glreslimit != 0)
GPU_free_images();
GPU_paint_set_mipmap(0);
@@ -5553,21 +5560,21 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Texture Paint Toggle";
- ot->idname= "PAINT_OT_texture_paint_toggle";
+ ot->name = "Texture Paint Toggle";
+ ot->idname = "PAINT_OT_texture_paint_toggle";
/* api callbacks */
- ot->exec= texture_paint_toggle_exec;
- ot->poll= texture_paint_toggle_poll;
+ ot->exec = texture_paint_toggle_exec;
+ ot->poll = texture_paint_toggle_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int texture_paint_poll(bContext *C)
{
- if(texture_paint_toggle_poll(C))
- if(CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT)
+ if (texture_paint_toggle_poll(C))
+ if (CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT)
return 1;
return 0;
@@ -5609,12 +5616,12 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
project_state_init(C, OBACT, &ps);
- if(ps.ob==NULL || ps.ob->type != OB_MESH) {
+ if (ps.ob==NULL || ps.ob->type != OB_MESH) {
BKE_report(op->reports, RPT_ERROR, "No active mesh object");
return OPERATOR_CANCELLED;
}
- if(image==NULL) {
+ if (image==NULL) {
BKE_report(op->reports, RPT_ERROR, "Image could not be found");
return OPERATOR_CANCELLED;
}
@@ -5622,31 +5629,31 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
ps.reproject_image= image;
ps.reproject_ibuf= BKE_image_get_ibuf(image, NULL);
- if(ps.reproject_ibuf==NULL || ps.reproject_ibuf->rect==NULL) {
+ if (ps.reproject_ibuf==NULL || ps.reproject_ibuf->rect==NULL) {
BKE_report(op->reports, RPT_ERROR, "Image data could not be found");
return OPERATOR_CANCELLED;
}
idgroup= IDP_GetProperties(&image->id, 0);
- if(idgroup) {
+ if (idgroup) {
view_data= IDP_GetPropertyTypeFromGroup(idgroup, PROJ_VIEW_DATA_ID, IDP_ARRAY);
/* type check to make sure its ok */
- if(view_data->len != PROJ_VIEW_DATA_SIZE || view_data->subtype != IDP_FLOAT) {
+ if (view_data->len != PROJ_VIEW_DATA_SIZE || view_data->subtype != IDP_FLOAT) {
BKE_report(op->reports, RPT_ERROR, "Image project data invalid");
return OPERATOR_CANCELLED;
}
}
- if(view_data) {
+ if (view_data) {
/* image has stored view projection info */
ps.source= PROJ_SRC_IMAGE_VIEW;
}
else {
ps.source= PROJ_SRC_IMAGE_CAM;
- if(scene->camera==NULL) {
+ if (scene->camera==NULL) {
BKE_report(op->reports, RPT_ERROR, "No active camera set");
return OPERATOR_CANCELLED;
}
@@ -5668,7 +5675,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
/* allocate and initialize spacial data structures */
project_paint_begin(&ps);
- if(ps.dm==NULL) {
+ if (ps.dm==NULL) {
brush_set_size(scene, ps.brush, orig_brush_size);
return OPERATOR_CANCELLED;
}
@@ -5703,20 +5710,20 @@ void PAINT_OT_project_image(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Project Image";
- ot->idname= "PAINT_OT_project_image";
- ot->description= "Project an edited render from the active camera back onto the object";
+ ot->name = "Project Image";
+ ot->idname = "PAINT_OT_project_image";
+ ot->description = "Project an edited render from the active camera back onto the object";
/* api callbacks */
- ot->invoke= WM_enum_search_invoke;
- ot->exec= texture_paint_camera_project_exec;
+ ot->invoke = WM_enum_search_invoke;
+ ot->exec = texture_paint_camera_project_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
prop= RNA_def_enum(ot->srna, "image", DummyRNA_NULL_items, 0, "Image", "");
RNA_def_enum_funcs(prop, RNA_image_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
@@ -5736,11 +5743,11 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
- if(w > maxsize) w= maxsize;
- if(h > maxsize) h= maxsize;
+ if (w > maxsize) w= maxsize;
+ if (h > maxsize) h= maxsize;
ibuf= ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect, FALSE, err_out);
- if(!ibuf) {
+ if (!ibuf) {
/* Mostly happens when OpenGL offscreen buffer was failed to create, */
/* but could be other reasons. Should be handled in the future. nazgul */
BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer: %s", err_out);
@@ -5749,7 +5756,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
image= BKE_add_image_imbuf(ibuf);
- if(image) {
+ if (image) {
/* now for the trickyness. store the view projection here!
* re-projection will reuse this */
View3D *v3d= CTX_wm_view3d(C);
@@ -5782,16 +5789,16 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
void PAINT_OT_image_from_view(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Image from View";
- ot->idname= "PAINT_OT_image_from_view";
- ot->description= "Make an image from the current 3D view for re-projection";
+ ot->name = "Image from View";
+ ot->idname = "PAINT_OT_image_from_view";
+ ot->description = "Make an image from the current 3D view for re-projection";
/* api callbacks */
- ot->exec= texture_paint_image_from_view_exec;
- ot->poll= ED_operator_region_view3d_active;
+ ot->exec = texture_paint_image_from_view_exec;
+ ot->poll = ED_operator_region_view3d_active;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File Path", "Name of the file");
}
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index bae433bdb55..eb9dbe6eba1 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -168,5 +168,19 @@ struct ListBase *undo_paint_push_get_list(int type);
void undo_paint_push_count_alloc(int type, int size);
void undo_paint_push_end(int type);
-#endif /* __PAINT_INTERN_H__ */
+/* paint_hide.c */
+
+typedef enum {
+ PARTIALVIS_HIDE,
+ PARTIALVIS_SHOW
+} PartialVisAction;
+
+typedef enum {
+ PARTIALVIS_INSIDE,
+ PARTIALVIS_OUTSIDE,
+ PARTIALVIS_ALL
+} PartialVisArea;
+void PAINT_OT_hide_show(struct wmOperatorType *ot);
+
+#endif /* __PAINT_INTERN_H__ */
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 757f501d296..046a3b374ba 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -75,15 +75,15 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op))
static void BRUSH_OT_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Brush";
- ot->description= "Add brush by mode type";
- ot->idname= "BRUSH_OT_add";
+ ot->name = "Add Brush";
+ ot->description = "Add brush by mode type";
+ ot->idname = "BRUSH_OT_add";
/* api callbacks */
- ot->exec= brush_add_exec;
+ ot->exec = brush_add_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -131,15 +131,15 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op)
static void BRUSH_OT_scale_size(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Scale Sculpt/Paint Brush Size";
- ot->description= "Change brush size by a scalar";
- ot->idname= "BRUSH_OT_scale_size";
+ ot->name = "Scale Sculpt/Paint Brush Size";
+ ot->description = "Change brush size by a scalar";
+ ot->idname = "BRUSH_OT_scale_size";
/* api callbacks */
- ot->exec= brush_scale_size_exec;
+ ot->exec = brush_scale_size_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_float(ot->srna, "scalar", 1, 0, 2, "Scalar", "Factor to scale brush size by", 0, 2);
}
@@ -158,15 +158,15 @@ static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op))
static void PAINT_OT_vertex_color_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Vertex Colors";
- ot->idname= "PAINT_OT_vertex_color_set";
+ ot->name = "Set Vertex Colors";
+ ot->idname = "PAINT_OT_vertex_color_set";
/* api callbacks */
- ot->exec= vertex_color_set_exec;
- ot->poll= vertex_paint_mode_poll;
+ ot->exec = vertex_color_set_exec;
+ ot->poll = vertex_paint_mode_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
@@ -175,9 +175,9 @@ static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
struct Brush *brush = paint_brush(paint);
Object *ob = CTX_data_active_object(C);
- if(!ob) return OPERATOR_CANCELLED;
+ if (!ob) return OPERATOR_CANCELLED;
- if(ob->mode & OB_MODE_SCULPT)
+ if (ob->mode & OB_MODE_SCULPT)
brush_reset_sculpt(brush);
/* TODO: other modes */
@@ -187,15 +187,20 @@ static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
static void BRUSH_OT_reset(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reset Brush";
- ot->description= "Return brush to defaults based on current tool";
- ot->idname= "BRUSH_OT_reset";
+ ot->name = "Reset Brush";
+ ot->description = "Return brush to defaults based on current tool";
+ ot->idname = "BRUSH_OT_reset";
/* api callbacks */
- ot->exec= brush_reset_exec;
+ ot->exec = brush_reset_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int brush_tool(const Brush *brush, size_t tool_offset)
+{
+ return *(((char *)brush) + tool_offset);
}
/* generic functions for setting the active brush based on the tool */
@@ -203,24 +208,21 @@ static Brush *brush_tool_cycle(Main *bmain, Brush *brush_orig, const int tool, c
{
struct Brush *brush;
- if(!brush_orig && !(brush_orig= bmain->brush.first)) {
+ if (!brush_orig && !(brush_orig= bmain->brush.first)) {
return NULL;
}
/* get the next brush with the active tool */
- for( brush= brush_orig->id.next ? brush_orig->id.next : bmain->brush.first;
- brush != brush_orig;
- brush= brush->id.next ? brush->id.next : bmain->brush.first)
- {
- if( (brush->ob_mode & ob_mode) &&
- (*(((char *)brush) + tool_offset) == tool)
- ) {
+ for (brush= brush_orig->id.next ? brush_orig->id.next : bmain->brush.first;
+ brush != brush_orig;
+ brush= brush->id.next ? brush->id.next : bmain->brush.first) {
+ if ((brush->ob_mode & ob_mode) &&
+ (brush_tool(brush, tool_offset) == tool)) {
return brush;
}
}
return NULL;
-
}
static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool, const size_t tool_offset, const int ob_mode)
@@ -229,7 +231,7 @@ static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool, con
brush= brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode);
- if(brush) {
+ if (brush) {
paint_brush_set(paint, brush);
WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
return OPERATOR_FINISHED;
@@ -239,107 +241,113 @@ static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool, con
}
}
-static int brush_sculpt_tool_set_exec(bContext *C, wmOperator *op)
-{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
-
- return brush_generic_tool_set(bmain, &scene->toolsettings->sculpt->paint, RNA_enum_get(op->ptr, "tool"), offsetof(Brush, sculpt_tool), OB_MODE_SCULPT);
-}
-
-static void BRUSH_OT_sculpt_tool_set(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Sculpt Tool Set";
- ot->description= "Set the sculpt tool";
- ot->idname= "BRUSH_OT_sculpt_tool_set";
-
- /* api callbacks */
- ot->exec= brush_sculpt_tool_set_exec;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* props */
- ot->prop= RNA_def_enum(ot->srna, "tool", brush_sculpt_tool_items, 0, "Tool", "");
-}
+/* used in the PAINT_OT_brush_select operator */
+#define OB_MODE_ACTIVE 0
-static int brush_vertex_tool_set_exec(bContext *C, wmOperator *op)
+static int brush_select_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
-
- return brush_generic_tool_set(bmain, &scene->toolsettings->vpaint->paint, RNA_enum_get(op->ptr, "tool"), offsetof(Brush, vertexpaint_tool), OB_MODE_VERTEX_PAINT);
-}
-
-static void BRUSH_OT_vertex_tool_set(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Vertex Paint Tool Set";
- ot->description= "Set the vertex paint tool";
- ot->idname= "BRUSH_OT_vertex_tool_set";
-
- /* api callbacks */
- ot->exec= brush_vertex_tool_set_exec;
+ ToolSettings *toolsettings= CTX_data_tool_settings(C);
+ Paint *paint= NULL;
+ int tool, paint_mode= RNA_enum_get(op->ptr, "paint_mode");
+ size_t tool_offset;
+
+ if (paint_mode == OB_MODE_ACTIVE) {
+ /* select current paint mode */
+ paint_mode = CTX_data_active_object(C)->mode &
+ (OB_MODE_SCULPT|
+ OB_MODE_VERTEX_PAINT|
+ OB_MODE_WEIGHT_PAINT|
+ OB_MODE_TEXTURE_PAINT);
+ }
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ switch(paint_mode) {
+ case OB_MODE_SCULPT:
+ paint= &toolsettings->sculpt->paint;
+ tool_offset= offsetof(Brush, sculpt_tool);
+ tool= RNA_enum_get(op->ptr, "sculpt_tool");
+ break;
+ case OB_MODE_VERTEX_PAINT:
+ paint= &toolsettings->vpaint->paint;
+ tool_offset= offsetof(Brush, vertexpaint_tool);
+ tool= RNA_enum_get(op->ptr, "vertex_paint_tool");
+ break;
+ case OB_MODE_WEIGHT_PAINT:
+ paint= &toolsettings->wpaint->paint;
+ /* vertexpaint_tool is used for weight paint mode */
+ tool_offset= offsetof(Brush, vertexpaint_tool);
+ tool= RNA_enum_get(op->ptr, "weight_paint_tool");
+ break;
+ case OB_MODE_TEXTURE_PAINT:
+ paint= &toolsettings->imapaint.paint;
+ tool_offset= offsetof(Brush, imagepaint_tool);
+ tool= RNA_enum_get(op->ptr, "texture_paint_tool");
+ break;
+ default:
+ /* invalid paint mode */
+ return OPERATOR_CANCELLED;
+ }
- /* props */
- ot->prop= RNA_def_enum(ot->srna, "tool", brush_vertex_tool_items, 0, "Tool", "");
+ return brush_generic_tool_set(bmain, paint, tool, tool_offset, paint_mode);
}
-static int brush_weight_tool_set_exec(bContext *C, wmOperator *op)
+static void PAINT_OT_brush_select(wmOperatorType *ot)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- /* vertexpaint_tool is used for weight paint mode */
- return brush_generic_tool_set(bmain, &scene->toolsettings->wpaint->paint, RNA_enum_get(op->ptr, "tool"), offsetof(Brush, vertexpaint_tool), OB_MODE_WEIGHT_PAINT);
-}
+ static EnumPropertyItem paint_mode_items[] = {
+ {OB_MODE_ACTIVE, "ACTIVE", 0, "Current", "Set brush for active paint mode"},
+ {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""},
+ {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
+ {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
+ {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
+ {0, NULL, 0, NULL, NULL}};
-static void BRUSH_OT_weight_tool_set(wmOperatorType *ot)
-{
/* identifiers */
- ot->name= "Weight Paint Tool Set";
- ot->description= "Set the weight paint tool";
- ot->idname= "BRUSH_OT_weight_tool_set";
+ ot->name = "Brush Select";
+ ot->description = "Select a paint mode's brush by tool type";
+ ot->idname = "PAINT_OT_brush_select";
/* api callbacks */
- ot->exec= brush_weight_tool_set_exec;
+ ot->exec = brush_select_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- ot->prop= RNA_def_enum(ot->srna, "tool", brush_vertex_tool_items, 0, "Tool", "");
+ RNA_def_enum(ot->srna, "paint_mode", paint_mode_items, OB_MODE_ACTIVE, "Paint Mode", "");
+ RNA_def_enum(ot->srna, "sculpt_tool", brush_sculpt_tool_items, 0, "Sculpt Tool", "");
+ RNA_def_enum(ot->srna, "vertex_paint_tool", brush_vertex_tool_items, 0, "Vertex Paint Tool", "");
+ RNA_def_enum(ot->srna, "weight_paint_tool", brush_vertex_tool_items, 0, "Weight Paint Tool", "");
+ RNA_def_enum(ot->srna, "texture_paint_tool", brush_image_tool_items, 0, "Texture Paint Tool", "");
}
-static int brush_image_tool_set_exec(bContext *C, wmOperator *op)
+static wmKeyMapItem *keymap_brush_select(wmKeyMap *keymap, int paint_mode,
+ int tool, int keymap_type,
+ int keymap_modifier)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
-
- return brush_generic_tool_set(bmain, &scene->toolsettings->imapaint.paint, RNA_enum_get(op->ptr, "tool"), offsetof(Brush, imagepaint_tool), OB_MODE_TEXTURE_PAINT);
-}
-
-static void BRUSH_OT_image_tool_set(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Image Paint Tool Set";
- ot->description= "Set the image tool";
- ot->idname= "BRUSH_OT_image_tool_set";
-
- /* api callbacks */
- ot->exec= brush_image_tool_set_exec;
+ wmKeyMapItem *kmi;
+ kmi = WM_keymap_add_item(keymap, "PAINT_OT_brush_select",
+ keymap_type, KM_PRESS, keymap_modifier, 0);
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ RNA_enum_set(kmi->ptr, "paint_mode", paint_mode);
+
+ switch(paint_mode) {
+ case OB_MODE_SCULPT:
+ RNA_enum_set(kmi->ptr, "sculpt_tool", tool);
+ break;
+ case OB_MODE_VERTEX_PAINT:
+ RNA_enum_set(kmi->ptr, "vertex_paint_tool", tool);
+ break;
+ case OB_MODE_WEIGHT_PAINT:
+ RNA_enum_set(kmi->ptr, "weight_paint_tool", tool);
+ break;
+ case OB_MODE_TEXTURE_PAINT:
+ RNA_enum_set(kmi->ptr, "texture_paint_tool", tool);
+ break;
+ }
- /* props */
- ot->prop= RNA_def_enum(ot->srna, "tool", brush_image_tool_items, 0, "Tool", "");
+ return kmi;
}
-
static int brush_uv_sculpt_tool_set_exec(bContext *C, wmOperator *op)
{
Brush *brush;
@@ -384,10 +392,7 @@ void ED_operatortypes_paint(void)
WM_operatortype_append(BRUSH_OT_reset);
/* note, particle uses a different system, can be added with existing operators in wm.py */
- WM_operatortype_append(BRUSH_OT_sculpt_tool_set);
- WM_operatortype_append(BRUSH_OT_vertex_tool_set);
- WM_operatortype_append(BRUSH_OT_weight_tool_set);
- WM_operatortype_append(BRUSH_OT_image_tool_set);
+ WM_operatortype_append(PAINT_OT_brush_select);
WM_operatortype_append(BRUSH_OT_uv_sculpt_tool_set);
/* image */
@@ -426,6 +431,9 @@ void ED_operatortypes_paint(void)
WM_operatortype_append(PAINT_OT_face_select_inverse);
WM_operatortype_append(PAINT_OT_face_select_hide);
WM_operatortype_append(PAINT_OT_face_select_reveal);
+
+ /* partial visibility */
+ WM_operatortype_append(PAINT_OT_hide_show);
}
@@ -435,7 +443,7 @@ static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *mode)
int i;
/* index 0-9 (zero key is tenth), shift key for index 10-19 */
for (i = 0; i < 20; i++) {
- kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set",
+ kmi = WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set",
ZEROKEY + ((i + 1) % 10), KM_PRESS, i < 10 ? 0 : KM_SHIFT, 0);
RNA_string_set(kmi->ptr, "mode", mode);
RNA_int_set(kmi->ptr, "index", i);
@@ -446,10 +454,10 @@ static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path
{
wmKeyMapItem *kmi;
- kmi= WM_keymap_add_item(keymap, "BRUSH_OT_scale_size", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "BRUSH_OT_scale_size", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_float_set(kmi->ptr, "scalar", 0.9);
- kmi= WM_keymap_add_item(keymap, "BRUSH_OT_scale_size", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "BRUSH_OT_scale_size", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
RNA_float_set(kmi->ptr, "scalar", 10.0/9.0); // 1.1111....
}
@@ -479,7 +487,7 @@ static void set_brush_rc_props(PointerRNA *ptr, const char *paint,
brush_path = BLI_sprintfN("tool_settings.%s.brush", paint);
set_brush_rc_path(ptr, brush_path, "data_path_primary", prop);
- if(secondary_prop) {
+ if (secondary_prop) {
set_brush_rc_path(ptr, ups_path, "use_secondary", secondary_prop);
set_brush_rc_path(ptr, ups_path, "data_path_secondary", prop);
}
@@ -491,11 +499,11 @@ static void set_brush_rc_props(PointerRNA *ptr, const char *paint,
set_brush_rc_path(ptr, brush_path, "rotation_path", "texture_slot.angle");
RNA_string_set(ptr, "image_id", brush_path);
- if(flags & RC_COLOR)
+ if (flags & RC_COLOR)
set_brush_rc_path(ptr, brush_path, "fill_color_path", "color");
else
RNA_string_set(ptr, "fill_color_path", "");
- if(flags & RC_ZOOM)
+ if (flags & RC_ZOOM)
RNA_string_set(ptr, "zoom_path", "space_data.zoom");
else
RNA_string_set(ptr, "zoom_path", "");
@@ -514,12 +522,28 @@ static void ed_keymap_paint_brush_radial_control(wmKeyMap *keymap, const char *p
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0);
set_brush_rc_props(kmi->ptr, paint, "strength", "use_unified_strength", flags);
- if(flags & RC_ROTATION) {
+ if (flags & RC_ROTATION) {
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0);
set_brush_rc_props(kmi->ptr, paint, "texture_slot.angle", NULL, flags);
}
}
+void paint_partial_visibility_keys(wmKeyMap *keymap)
+{
+ wmKeyMapItem *kmi;
+
+ /* Partial visiblity */
+ kmi = WM_keymap_add_item(keymap, "PAINT_OT_hide_show", HKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_enum_set(kmi->ptr, "action", PARTIALVIS_SHOW);
+ RNA_enum_set(kmi->ptr, "area", PARTIALVIS_INSIDE);
+ kmi = WM_keymap_add_item(keymap, "PAINT_OT_hide_show", HKEY, KM_PRESS, 0, 0);
+ RNA_enum_set(kmi->ptr, "action", PARTIALVIS_HIDE);
+ RNA_enum_set(kmi->ptr, "area", PARTIALVIS_INSIDE);
+ kmi = WM_keymap_add_item(keymap, "PAINT_OT_hide_show", HKEY, KM_PRESS, KM_ALT, 0);
+ RNA_enum_set(kmi->ptr, "action", PARTIALVIS_SHOW);
+ RNA_enum_set(kmi->ptr, "area", PARTIALVIS_ALL);
+}
+
void ED_keymap_paint(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
@@ -527,22 +551,25 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
int i;
/* Sculpt mode */
- keymap= WM_keymap_find(keyconf, "Sculpt", 0, 0);
- keymap->poll= sculpt_poll;
+ keymap = WM_keymap_find(keyconf, "Sculpt", 0, 0);
+ keymap->poll = sculpt_poll;
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", BRUSH_STROKE_NORMAL);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "mode", BRUSH_STROKE_INVERT);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", BRUSH_STROKE_SMOOTH);
- for(i=0; i<=5; i++)
+ /* Partial visibility, sculpt-only for now */
+ paint_partial_visibility_keys(keymap);
+
+ for (i=0; i<=5; i++)
RNA_int_set(WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY+i, KM_PRESS, KM_CTRL, 0)->ptr, "level", i);
/* multires switch */
- kmi= WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEUPKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEUPKEY, KM_PRESS, 0, 0);
RNA_int_set(kmi->ptr, "level", 1);
RNA_boolean_set(kmi->ptr, "relative", TRUE);
- kmi= WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEDOWNKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEDOWNKEY, KM_PRESS, 0, 0);
RNA_int_set(kmi->ptr, "level", -1);
RNA_boolean_set(kmi->ptr, "relative", TRUE);
@@ -550,15 +577,15 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
ed_keymap_paint_brush_size(keymap, "tool_settings.sculpt.brush.size");
ed_keymap_paint_brush_radial_control(keymap, "sculpt", RC_ROTATION);
- RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", DKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_DRAW);
- RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", SKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_SMOOTH);
- RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", PKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_PINCH);
- RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", IKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_INFLATE);
- RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", GKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_GRAB);
- RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", LKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_LAYER);
- RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", TKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "tool", SCULPT_TOOL_FLATTEN); /* was just TKEY in 2.4x */
- RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", CKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_CLAY);
- RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", CKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "tool", SCULPT_TOOL_CREASE);
+ keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_DRAW, DKEY, 0);
+ keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_SMOOTH, SKEY, 0);
+ keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_PINCH, PKEY, 0);
+ keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_INFLATE, IKEY, 0);
+ keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_GRAB, GKEY, 0);
+ keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_LAYER, LKEY, 0);
+ keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_FLATTEN, TKEY, KM_SHIFT);
+ keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CLAY, CKEY, 0);
+ keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CREASE, CKEY, KM_SHIFT);
/* */
kmi = WM_keymap_add_item(keymap, "WM_OT_context_menu_enum", AKEY, KM_PRESS, 0, 0);
@@ -571,8 +598,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.texture_angle_source_random");
/* Vertex Paint mode */
- keymap= WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
- keymap->poll= vertex_paint_mode_poll;
+ keymap = WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
+ keymap->poll = vertex_paint_mode_poll;
WM_keymap_verify_item(keymap, "PAINT_OT_vertex_paint", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0);
@@ -588,8 +615,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
RNA_string_set(kmi->ptr, "data_path", "vertex_paint_object.data.use_paint_mask");
/* Weight Paint mode */
- keymap= WM_keymap_find(keyconf, "Weight Paint", 0, 0);
- keymap->poll= weight_paint_mode_poll;
+ keymap = WM_keymap_find(keyconf, "Weight Paint", 0, 0);
+ keymap->poll = weight_paint_mode_poll;
WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0);
@@ -615,8 +642,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
/*Weight paint's Vertex Selection Mode */
- keymap= WM_keymap_find(keyconf, "Weight Paint Vertex Selection", 0, 0);
- keymap->poll= vert_paint_poll;
+ keymap = WM_keymap_find(keyconf, "Weight Paint Vertex Selection", 0, 0);
+ keymap->poll = vert_paint_poll;
WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_vert_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0);
@@ -627,8 +654,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
/* Image/Texture Paint mode */
- keymap= WM_keymap_find(keyconf, "Image Paint", 0, 0);
- keymap->poll= image_texture_paint_poll;
+ keymap = WM_keymap_find(keyconf, "Image Paint", 0, 0);
+ keymap->poll = image_texture_paint_poll;
WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_grab_clone", RIGHTMOUSE, KM_PRESS, 0, 0);
@@ -643,8 +670,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
RNA_string_set(kmi->ptr, "data_path", "image_paint_object.data.use_paint_mask");
/* face-mask mode */
- keymap= WM_keymap_find(keyconf, "Face Mask", 0, 0);
- keymap->poll= facemask_paint_poll;
+ keymap = WM_keymap_find(keyconf, "Face Mask", 0, 0);
+ keymap->poll = facemask_paint_poll;
WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_face_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
@@ -657,8 +684,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked_pick", LKEY, KM_PRESS, 0, 0);
- keymap= WM_keymap_find(keyconf, "UV Sculpt", 0, 0);
- keymap->poll= uv_sculpt_poll;
+ keymap = WM_keymap_find(keyconf, "UV Sculpt", 0, 0);
+ keymap->poll = uv_sculpt_poll;
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", QKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_uv_sculpt");
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index d306abef9d0..28fee887cd8 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -95,7 +95,7 @@ static void paint_draw_smooth_stroke(bContext *C, int x, int y, void *customdata
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
- if(stroke && brush && (brush->flag & BRUSH_SMOOTH_STROKE)) {
+ if (stroke && brush && (brush->flag & BRUSH_SMOOTH_STROKE)) {
ARegion *ar = CTX_wm_region(C);
sdrawline(x, y, (int)stroke->last_mouse_position[0] - ar->winrct.xmin,
(int)stroke->last_mouse_position[1] - ar->winrct.ymin);
@@ -112,14 +112,14 @@ static float event_tablet_data(wmEvent *event, int *pen_flip)
int erasor = 0;
float pressure = 1;
- if(event->custom == EVT_DATA_TABLET) {
+ if (event->custom == EVT_DATA_TABLET) {
wmTabletData *wmtab= event->customdata;
erasor = (wmtab->Active == EVT_TABLET_ERASER);
pressure = (wmtab->Active != EVT_TABLET_NONE) ? wmtab->Pressure : 1;
}
- if(pen_flip)
+ if (pen_flip)
(*pen_flip) = erasor;
return pressure;
@@ -143,7 +143,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
/* TODO: as sculpt and other paint modes are unified, this
* separation will go away */
- if(stroke->vc.obact->sculpt) {
+ if (stroke->vc.obact->sculpt) {
float delta[2];
brush_jitter_pos(scene, brush, mouse_in, mouse);
@@ -151,7 +151,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
/* XXX: meh, this is round about because
* brush_jitter_pos isn't written in the best way to
* be reused here */
- if(brush->flag & BRUSH_JITTER_PRESSURE) {
+ if (brush->flag & BRUSH_JITTER_PRESSURE) {
sub_v2_v2v2(delta, mouse, mouse_in);
mul_v2_fl(delta, pressure);
add_v2_v2v2(mouse, mouse_in, delta);
@@ -162,7 +162,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
}
/* TODO: can remove the if statement once all modes have this */
- if(stroke->get_location)
+ if (stroke->get_location)
stroke->get_location(C, location, mouse);
else
zero_v3(location);
@@ -197,7 +197,7 @@ static int paint_smooth_stroke(PaintStroke *stroke, float output[2], wmEvent *ev
/* If the mouse is moving within the radius of the last move,
* don't update the mouse position. This allows sharp turns. */
- if(dx*dx + dy*dy < stroke->brush->smooth_stroke_radius * stroke->brush->smooth_stroke_radius)
+ if (dx*dx + dy*dy < stroke->brush->smooth_stroke_radius * stroke->brush->smooth_stroke_radius)
return 0;
output[0] = event->x * v + stroke->last_mouse_position[0] * u;
@@ -214,7 +214,7 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const
PaintStroke *stroke = op->customdata;
int cnt = 0;
- if(paint_space_stroke_enabled(stroke->brush)) {
+ if (paint_space_stroke_enabled(stroke->brush)) {
float mouse[2];
float vec[2];
float length, scale;
@@ -224,24 +224,24 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const
length = len_v2(vec);
- if(length > FLT_EPSILON) {
+ if (length > FLT_EPSILON) {
const Scene *scene = CTX_data_scene(C);
int steps;
int i;
float pressure= 1.0f;
/* XXX mysterious :) what has 'use size' do with this here... if you don't check for it, pressure fails */
- if(brush_use_size_pressure(scene, stroke->brush))
+ if (brush_use_size_pressure(scene, stroke->brush))
pressure = event_tablet_data(event, NULL);
- if(pressure > FLT_EPSILON) {
+ if (pressure > FLT_EPSILON) {
scale = (brush_size(scene, stroke->brush)*pressure*stroke->brush->spacing/50.0f) / length;
- if(scale > FLT_EPSILON) {
+ if (scale > FLT_EPSILON) {
mul_v2_fl(vec, scale);
steps = (int)(1.0f / scale);
- for(i = 0; i < steps; ++i, ++cnt) {
+ for (i = 0; i < steps; ++i, ++cnt) {
add_v2_v2(mouse, vec);
paint_brush_stroke_add_step(C, op, event, mouse);
}
@@ -302,16 +302,16 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
if (event->type == NDOF_MOTION)
return OPERATOR_PASS_THROUGH;
- if(!stroke->stroke_started) {
+ if (!stroke->stroke_started) {
stroke->last_mouse_position[0] = event->x;
stroke->last_mouse_position[1] = event->y;
stroke->stroke_started = stroke->test_start(C, op, event);
- if(stroke->stroke_started) {
+ if (stroke->stroke_started) {
stroke->smooth_stroke_cursor =
WM_paint_cursor_activate(CTX_wm_manager(C), paint_poll, paint_draw_smooth_stroke, stroke);
- if(stroke->brush->flag & BRUSH_AIRBRUSH)
+ if (stroke->brush->flag & BRUSH_AIRBRUSH)
stroke->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, stroke->brush->rate);
}
@@ -319,26 +319,26 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
//ED_region_tag_redraw(ar);
}
- if(event->type == stroke->event_type && event->val == KM_RELEASE) {
+ if (event->type == stroke->event_type && event->val == KM_RELEASE) {
/* exit stroke, free data */
- if(stroke->smooth_stroke_cursor)
+ if (stroke->smooth_stroke_cursor)
WM_paint_cursor_end(CTX_wm_manager(C), stroke->smooth_stroke_cursor);
- if(stroke->timer)
+ if (stroke->timer)
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), stroke->timer);
stroke->done(C, stroke);
MEM_freeN(stroke);
return OPERATOR_FINISHED;
}
- else if( (first) ||
+ else if ( (first) ||
(ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) ||
(event->type == TIMER && (event->customdata == stroke->timer)) )
{
- if(stroke->stroke_started) {
- if(paint_smooth_stroke(stroke, mouse, event)) {
- if(paint_space_stroke_enabled(stroke->brush)) {
- if(!paint_space_stroke(C, op, event, mouse)) {
+ if (stroke->stroke_started) {
+ if (paint_smooth_stroke(stroke, mouse, event)) {
+ if (paint_space_stroke_enabled(stroke->brush)) {
+ if (!paint_space_stroke(C, op, event, mouse)) {
//ED_region_tag_redraw(ar);
}
}
@@ -354,7 +354,7 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
/* we want the stroke to have the first daub at the start location
* instead of waiting till we have moved the space distance */
- if(first &&
+ if (first &&
stroke->stroke_started &&
paint_space_stroke_enabled(stroke->brush) &&
!(stroke->brush->flag & BRUSH_ANCHORED) &&
@@ -371,7 +371,7 @@ int paint_stroke_exec(bContext *C, wmOperator *op)
PaintStroke *stroke = op->customdata;
/* only when executed for the first time */
- if(stroke->stroke_started == 0) {
+ if (stroke->stroke_started == 0) {
/* XXX stroke->last_mouse_position is unset, this may cause problems */
stroke->test_start(C, op, NULL);
stroke->stroke_started= 1;
@@ -394,7 +394,7 @@ int paint_stroke_cancel(bContext *C, wmOperator *op)
{
PaintStroke *stroke = op->customdata;
- if(stroke->done)
+ if (stroke->done)
stroke->done(C, stroke);
MEM_freeN(stroke);
diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c
index b00910195ff..8406c8b20af 100644
--- a/source/blender/editors/sculpt_paint/paint_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_undo.c
@@ -71,13 +71,13 @@ static UndoStack MeshUndoStack = {UNDO_PAINT_MESH, {NULL, NULL}, NULL};
static void undo_restore(bContext *C, UndoStack *UNUSED(stack), UndoElem *uel)
{
- if(uel && uel->restore)
+ if (uel && uel->restore)
uel->restore(C, &uel->elems);
}
static void undo_elem_free(UndoStack *UNUSED(stack), UndoElem *uel)
{
- if(uel && uel->free) {
+ if (uel && uel->free) {
uel->free(&uel->elems);
BLI_freelistN(&uel->elems);
}
@@ -93,7 +93,7 @@ static void undo_stack_push_begin(UndoStack *stack, const char *name, UndoRestor
* know how much memory the undo used to remove old undo elements */
/* remove all undos after (also when stack->current==NULL) */
- while(stack->elems.last != stack->current) {
+ while (stack->elems.last != stack->current) {
uel= stack->elems.last;
undo_elem_free(stack, uel);
BLI_freelinkN(&stack->elems, uel);
@@ -111,13 +111,13 @@ static void undo_stack_push_begin(UndoStack *stack, const char *name, UndoRestor
/* limit amount to the maximum amount*/
nr= 0;
uel= stack->elems.last;
- while(uel) {
+ while (uel) {
nr++;
- if(nr==U.undosteps) break;
+ if (nr==U.undosteps) break;
uel= uel->prev;
}
- if(uel) {
- while(stack->elems.first!=uel) {
+ if (uel) {
+ while (stack->elems.first!=uel) {
UndoElem *first= stack->elems.first;
undo_elem_free(stack, first);
BLI_freelinkN(&stack->elems, first);
@@ -130,20 +130,20 @@ static void undo_stack_push_end(UndoStack *stack)
UndoElem *uel;
uintptr_t totmem, maxmem;
- if(U.undomemory != 0) {
+ if (U.undomemory != 0) {
/* limit to maximum memory (afterwards, we can't know in advance) */
totmem= 0;
maxmem= ((uintptr_t)U.undomemory)*1024*1024;
uel= stack->elems.last;
- while(uel) {
+ while (uel) {
totmem+= uel->undosize;
- if(totmem>maxmem) break;
+ if (totmem>maxmem) break;
uel= uel->prev;
}
- if(uel) {
- while(stack->elems.first!=uel) {
+ if (uel) {
+ while (stack->elems.first!=uel) {
UndoElem *first= stack->elems.first;
undo_elem_free(stack, first);
BLI_freelinkN(&stack->elems, first);
@@ -156,25 +156,25 @@ static int undo_stack_step(bContext *C, UndoStack *stack, int step, const char *
{
UndoElem *undo;
- if(step==1) {
- if(stack->current==NULL);
+ if (step==1) {
+ if (stack->current==NULL);
else {
- if(!name || strcmp(stack->current->name, name) == 0) {
- if(G.f & G_DEBUG) printf("undo %s\n", stack->current->name);
+ if (!name || strcmp(stack->current->name, name) == 0) {
+ if (G.f & G_DEBUG) printf("undo %s\n", stack->current->name);
undo_restore(C, stack, stack->current);
stack->current= stack->current->prev;
return 1;
}
}
}
- else if(step==-1) {
- if((stack->current!=NULL && stack->current->next==NULL) || stack->elems.first==NULL);
+ else if (step==-1) {
+ if ((stack->current!=NULL && stack->current->next==NULL) || stack->elems.first==NULL);
else {
- if(!name || strcmp(stack->current->name, name) == 0) {
+ if (!name || strcmp(stack->current->name, name) == 0) {
undo= (stack->current && stack->current->next)? stack->current->next: stack->elems.first;
undo_restore(C, stack, undo);
stack->current= undo;
- if(G.f & G_DEBUG) printf("redo %s\n", undo->name);
+ if (G.f & G_DEBUG) printf("redo %s\n", undo->name);
return 1;
}
}
@@ -187,7 +187,7 @@ static void undo_stack_free(UndoStack *stack)
{
UndoElem *uel;
- for(uel=stack->elems.first; uel; uel=uel->next)
+ for (uel=stack->elems.first; uel; uel=uel->next)
undo_elem_free(stack, uel);
BLI_freelistN(&stack->elems);
@@ -198,20 +198,20 @@ static void undo_stack_free(UndoStack *stack)
void undo_paint_push_begin(int type, const char *name, UndoRestoreCb restore, UndoFreeCb free)
{
- if(type == UNDO_PAINT_IMAGE)
+ if (type == UNDO_PAINT_IMAGE)
undo_stack_push_begin(&ImageUndoStack, name, restore, free);
- else if(type == UNDO_PAINT_MESH)
+ else if (type == UNDO_PAINT_MESH)
undo_stack_push_begin(&MeshUndoStack, name, restore, free);
}
ListBase *undo_paint_push_get_list(int type)
{
- if(type == UNDO_PAINT_IMAGE) {
- if(ImageUndoStack.current)
+ if (type == UNDO_PAINT_IMAGE) {
+ if (ImageUndoStack.current)
return &ImageUndoStack.current->elems;
}
- else if(type == UNDO_PAINT_MESH) {
- if(MeshUndoStack.current)
+ else if (type == UNDO_PAINT_MESH) {
+ if (MeshUndoStack.current)
return &MeshUndoStack.current->elems;
}
@@ -220,25 +220,25 @@ ListBase *undo_paint_push_get_list(int type)
void undo_paint_push_count_alloc(int type, int size)
{
- if(type == UNDO_PAINT_IMAGE)
+ if (type == UNDO_PAINT_IMAGE)
ImageUndoStack.current->undosize += size;
- else if(type == UNDO_PAINT_MESH)
+ else if (type == UNDO_PAINT_MESH)
MeshUndoStack.current->undosize += size;
}
void undo_paint_push_end(int type)
{
- if(type == UNDO_PAINT_IMAGE)
+ if (type == UNDO_PAINT_IMAGE)
undo_stack_push_end(&ImageUndoStack);
- else if(type == UNDO_PAINT_MESH)
+ else if (type == UNDO_PAINT_MESH)
undo_stack_push_end(&MeshUndoStack);
}
int ED_undo_paint_step(bContext *C, int type, int step, const char *name)
{
- if(type == UNDO_PAINT_IMAGE)
+ if (type == UNDO_PAINT_IMAGE)
return undo_stack_step(C, &ImageUndoStack, step, name);
- else if(type == UNDO_PAINT_MESH)
+ else if (type == UNDO_PAINT_MESH)
return undo_stack_step(C, &MeshUndoStack, step, name);
return 0;
@@ -248,16 +248,16 @@ int ED_undo_paint_valid(int type, const char *name)
{
UndoStack *stack;
- if(type == UNDO_PAINT_IMAGE)
+ if (type == UNDO_PAINT_IMAGE)
stack= &ImageUndoStack;
- else if(type == UNDO_PAINT_MESH)
+ else if (type == UNDO_PAINT_MESH)
stack= &MeshUndoStack;
else
return 0;
- if(stack->current==NULL);
+ if (stack->current==NULL);
else {
- if(name && strcmp(stack->current->name, name) == 0)
+ if (name && strcmp(stack->current->name, name) == 0)
return 1;
else
return stack->elems.first != stack->elems.last;
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index dcd7554b7b8..8cdacea9bd7 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -84,14 +84,14 @@ int paint_convert_bb_to_rect(rcti *rect,
rect->xmax = rect->ymax = INT_MIN;
/* return zero if the bounding box has non-positive volume */
- if(bb_min[0] > bb_max[0] || bb_min[1] > bb_max[1] || bb_min[2] > bb_max[2])
+ if (bb_min[0] > bb_max[0] || bb_min[1] > bb_max[1] || bb_min[2] > bb_max[2])
return 0;
ED_view3d_ob_project_mat_get(rv3d, ob, projection_mat);
- for(i = 0; i < 2; ++i) {
- for(j = 0; j < 2; ++j) {
- for(k = 0; k < 2; ++k) {
+ for (i = 0; i < 2; ++i) {
+ for (j = 0; j < 2; ++j) {
+ for (k = 0; k < 2; ++k) {
float vec[3], proj[2];
vec[0] = i ? bb_min[0] : bb_max[0];
vec[1] = j ? bb_min[1] : bb_max[1];
@@ -229,7 +229,7 @@ static void imapaint_tri_weights(Object *ob,
h[1]= (co[1] - view[1])*2.0f/view[3] - 1;
h[2]= 1.0f;
- /* solve for(w1,w2,w3)/perspdiv in:
+ /* solve for (w1,w2,w3)/perspdiv in:
* h * perspdiv = Project * Model * (w1 * v1 + w2 * v2 + w3 * v3) */
wmat[0][0]= pv1[0]; wmat[1][0]= pv2[0]; wmat[2][0]= pv3[0];
@@ -243,7 +243,7 @@ static void imapaint_tri_weights(Object *ob,
/* w is still divided by perspdiv, make it sum to one */
divw= w[0] + w[1] + w[2];
- if(divw != 0.0f) {
+ if (divw != 0.0f) {
mul_v3_fl(w, 1.0f/divw);
}
}
@@ -263,16 +263,16 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
uv[0] = uv[1] = 0.0;
/* test all faces in the derivedmesh with the original index of the picked face */
- for(a = 0; a < numfaces; a++) {
+ for (a = 0; a < numfaces; a++) {
findex= index ? index[a]: a;
- if(findex == faceindex) {
+ if (findex == faceindex) {
dm->getTessFace(dm, a, &mf);
dm->getVert(dm, mf.v1, &mv[0]);
dm->getVert(dm, mf.v2, &mv[1]);
dm->getVert(dm, mf.v3, &mv[2]);
- if(mf.v4)
+ if (mf.v4)
dm->getVert(dm, mf.v4, &mv[3]);
tf= &tface[a];
@@ -280,12 +280,12 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
p[0]= xy[0];
p[1]= xy[1];
- if(mf.v4) {
+ if (mf.v4) {
/* the triangle with the largest absolute values is the one
* with the most negative weights */
imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[3].co, p, w);
absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
- if(absw < minabsw) {
+ if (absw < minabsw) {
uv[0]= tf->uv[0][0]*w[0] + tf->uv[1][0]*w[1] + tf->uv[3][0]*w[2];
uv[1]= tf->uv[0][1]*w[0] + tf->uv[1][1]*w[1] + tf->uv[3][1]*w[2];
minabsw = absw;
@@ -293,7 +293,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
imapaint_tri_weights(ob, mv[1].co, mv[2].co, mv[3].co, p, w);
absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
- if(absw < minabsw) {
+ if (absw < minabsw) {
uv[0]= tf->uv[1][0]*w[0] + tf->uv[2][0]*w[1] + tf->uv[3][0]*w[2];
uv[1]= tf->uv[1][1]*w[0] + tf->uv[2][1]*w[1] + tf->uv[3][1]*w[2];
minabsw = absw;
@@ -302,7 +302,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
else {
imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[2].co, p, w);
absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
- if(absw < minabsw) {
+ if (absw < minabsw) {
uv[0]= tf->uv[0][0]*w[0] + tf->uv[1][0]*w[1] + tf->uv[2][0]*w[2];
uv[1]= tf->uv[0][1]*w[0] + tf->uv[1][1]*w[1] + tf->uv[2][1]*w[2];
minabsw = absw;
@@ -317,13 +317,13 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
///* returns 0 if not found, otherwise 1 */
int imapaint_pick_face(ViewContext *vc, Mesh *me, const int mval[2], unsigned int *index)
{
- if(!me || me->totface==0)
+ if (!me || me->totface==0)
return 0;
/* sample only on the exact position */
*index = view3d_sample_backbuf(vc, mval[0], mval[1]);
- if((*index)<=0 || (*index)>(unsigned int)me->totface)
+ if ((*index)<=0 || (*index)>(unsigned int)me->totface)
return 0;
(*index)--;
@@ -347,7 +347,7 @@ void paint_sample_color(Scene *scene, ARegion *ar, int x, int y) /* frontbuf */
cp = (char *)&col;
- if(br) {
+ if (br) {
br->rgb[0]= cp[0]/255.0f;
br->rgb[1]= cp[1]/255.0f;
br->rgb[2]= cp[2]/255.0f;
@@ -380,14 +380,14 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot)
{CURVE_PRESET_ROOT, "ROOT", 0, "Root", ""},
{0, NULL, 0, NULL, NULL}};
- ot->name= "Preset";
- ot->description= "Set brush shape";
- ot->idname= "BRUSH_OT_curve_preset";
+ ot->name = "Preset";
+ ot->description = "Set brush shape";
+ ot->idname = "BRUSH_OT_curve_preset";
- ot->exec= brush_curve_preset_exec;
- ot->poll= brush_curve_preset_poll;
+ ot->exec = brush_curve_preset_exec;
+ ot->poll = brush_curve_preset_poll;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_enum(ot->srna, "shape", prop_shape_items, CURVE_PRESET_SMOOTH, "Mode", "");
}
@@ -403,14 +403,14 @@ static int paint_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
void PAINT_OT_face_select_linked(wmOperatorType *ot)
{
- ot->name= "Select Linked";
- ot->description= "Select linked faces";
- ot->idname= "PAINT_OT_face_select_linked";
+ ot->name = "Select Linked";
+ ot->description = "Select linked faces";
+ ot->idname = "PAINT_OT_face_select_linked";
- ot->exec= paint_select_linked_exec;
- ot->poll= facemask_paint_poll;
+ ot->exec = paint_select_linked_exec;
+ ot->poll = facemask_paint_poll;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -423,14 +423,14 @@ static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent
void PAINT_OT_face_select_linked_pick(wmOperatorType *ot)
{
- ot->name= "Select Linked Pick";
- ot->description= "Select linked faces";
- ot->idname= "PAINT_OT_face_select_linked_pick";
+ ot->name = "Select Linked Pick";
+ ot->description = "Select linked faces";
+ ot->idname = "PAINT_OT_face_select_linked_pick";
- ot->invoke= paint_select_linked_pick_invoke;
- ot->poll= facemask_paint_poll;
+ ot->invoke = paint_select_linked_pick_invoke;
+ ot->poll = facemask_paint_poll;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the existing selection");
}
@@ -447,14 +447,14 @@ static int face_select_all_exec(bContext *C, wmOperator *op)
void PAINT_OT_face_select_all(wmOperatorType *ot)
{
- ot->name= "Face Selection";
- ot->description= "Change selection for all faces";
- ot->idname= "PAINT_OT_face_select_all";
+ ot->name = "Face Selection";
+ ot->description = "Change selection for all faces";
+ ot->idname = "PAINT_OT_face_select_all";
- ot->exec= face_select_all_exec;
- ot->poll= facemask_paint_poll;
+ ot->exec = face_select_all_exec;
+ ot->poll = facemask_paint_poll;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -471,14 +471,14 @@ static int vert_select_all_exec(bContext *C, wmOperator *op)
void PAINT_OT_vert_select_all(wmOperatorType *ot)
{
- ot->name= "Vertex Selection";
- ot->description= "Change selection for all vertices";
- ot->idname= "PAINT_OT_vert_select_all";
+ ot->name = "Vertex Selection";
+ ot->description = "Change selection for all vertices";
+ ot->idname = "PAINT_OT_vert_select_all";
- ot->exec= vert_select_all_exec;
- ot->poll= vert_paint_poll;
+ ot->exec = vert_select_all_exec;
+ ot->poll = vert_paint_poll;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -493,14 +493,14 @@ static int vert_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
void PAINT_OT_vert_select_inverse(wmOperatorType *ot)
{
- ot->name= "Vertex Select Invert";
- ot->description= "Invert selection of vertices";
- ot->idname= "PAINT_OT_vert_select_inverse";
+ ot->name = "Vertex Select Invert";
+ ot->description = "Invert selection of vertices";
+ ot->idname = "PAINT_OT_vert_select_inverse";
- ot->exec= vert_select_inverse_exec;
- ot->poll= vert_paint_poll;
+ ot->exec = vert_select_inverse_exec;
+ ot->poll = vert_paint_poll;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int face_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -513,14 +513,14 @@ static int face_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
void PAINT_OT_face_select_inverse(wmOperatorType *ot)
{
- ot->name= "Face Select Invert";
- ot->description= "Invert selection of faces";
- ot->idname= "PAINT_OT_face_select_inverse";
+ ot->name = "Face Select Invert";
+ ot->description = "Invert selection of faces";
+ ot->idname = "PAINT_OT_face_select_inverse";
- ot->exec= face_select_inverse_exec;
- ot->poll= facemask_paint_poll;
+ ot->exec = face_select_inverse_exec;
+ ot->poll = facemask_paint_poll;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int face_select_hide_exec(bContext *C, wmOperator *op)
@@ -534,14 +534,14 @@ static int face_select_hide_exec(bContext *C, wmOperator *op)
void PAINT_OT_face_select_hide(wmOperatorType *ot)
{
- ot->name= "Face Select Hide";
- ot->description= "Hide selected faces";
- ot->idname= "PAINT_OT_face_select_hide";
+ ot->name = "Face Select Hide";
+ ot->description = "Hide selected faces";
+ ot->idname = "PAINT_OT_face_select_hide";
- ot->exec= face_select_hide_exec;
- ot->poll= facemask_paint_poll;
+ ot->exec = face_select_hide_exec;
+ ot->poll = facemask_paint_poll;
- 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");
}
@@ -556,14 +556,14 @@ static int face_select_reveal_exec(bContext *C, wmOperator *UNUSED(op))
void PAINT_OT_face_select_reveal(wmOperatorType *ot)
{
- ot->name= "Face Select Reveal";
- ot->description= "Reveal hidden faces";
- ot->idname= "PAINT_OT_face_select_reveal";
+ ot->name = "Face Select Reveal";
+ ot->description = "Reveal hidden faces";
+ ot->idname = "PAINT_OT_face_select_reveal";
- ot->exec= face_select_reveal_exec;
- ot->poll= facemask_paint_poll;
+ ot->exec = face_select_reveal_exec;
+ ot->poll = facemask_paint_poll;
- 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");
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index dcd89a52a80..54f4d0c1a26 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -103,7 +103,7 @@ static int vertex_paint_use_fast_update_check(Object *ob)
}
/* if the polygons from the mesh and the 'derivedFinal' match
- * we can assume that no modifiers are applied and that its worth adding tesselated faces
+ * we can assume that no modifiers are applied and that its worth adding tessellated faces
* so 'vertex_paint_use_fast_update_check()' returns TRUE */
static int vertex_paint_use_tessface_check(Object *ob)
{
@@ -129,12 +129,12 @@ int vertex_paint_mode_poll(bContext *C)
int vertex_paint_poll(bContext *C)
{
- if(vertex_paint_mode_poll(C) &&
+ if (vertex_paint_mode_poll(C) &&
paint_brush(&CTX_data_tool_settings(C)->vpaint->paint)) {
- ScrArea *sa= CTX_wm_area(C);
- if(sa->spacetype==SPACE_VIEW3D) {
- ARegion *ar= CTX_wm_region(C);
- if(ar->regiontype==RGN_TYPE_WINDOW)
+ ScrArea *sa = CTX_wm_area(C);
+ if (sa->spacetype == SPACE_VIEW3D) {
+ ARegion *ar = CTX_wm_region(C);
+ if (ar->regiontype == RGN_TYPE_WINDOW)
return 1;
}
}
@@ -150,17 +150,17 @@ int weight_paint_mode_poll(bContext *C)
int weight_paint_poll(bContext *C)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
ScrArea *sa;
- if( (ob != NULL) &&
- (ob->mode & OB_MODE_WEIGHT_PAINT) &&
- (paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != NULL) &&
- (sa= CTX_wm_area(C)) &&
- (sa->spacetype == SPACE_VIEW3D)
- ) {
- ARegion *ar= CTX_wm_region(C);
- if(ar->regiontype==RGN_TYPE_WINDOW) {
+ if ((ob != NULL) &&
+ (ob->mode & OB_MODE_WEIGHT_PAINT) &&
+ (paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != NULL) &&
+ (sa = CTX_wm_area(C)) &&
+ (sa->spacetype == SPACE_VIEW3D))
+ {
+ ARegion *ar = CTX_wm_region(C);
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
return 1;
}
}
@@ -169,54 +169,28 @@ int weight_paint_poll(bContext *C)
static VPaint *new_vpaint(int wpaint)
{
- VPaint *vp= MEM_callocN(sizeof(VPaint), "VPaint");
+ VPaint *vp = MEM_callocN(sizeof(VPaint), "VPaint");
- vp->flag= VP_AREA+VP_SPRAY;
+ vp->flag = VP_AREA + VP_SPRAY;
- if(wpaint)
- vp->flag= VP_AREA;
+ if (wpaint)
+ vp->flag = VP_AREA;
return vp;
}
static int *get_indexarray(Mesh *me)
{
- return MEM_mallocN(sizeof(int)*(me->totpoly+1), "vertexpaint");
-}
-
-
-/* in contradiction to cpack drawing colors, the MCOL colors (vpaint colors) are per byte!
- * so not endian sensitive. Mcol = ABGR!!! so be cautious with cpack calls */
-
-static unsigned int rgba_to_mcol(float r, float g, float b, float a)
-{
- int ir, ig, ib, ia;
- unsigned int col;
- char *cp;
-
- ir= floor(255.0f * r);
- if(ir<0) ir= 0; else if(ir>255) ir= 255;
- ig= floor(255.0f * g);
- if(ig<0) ig= 0; else if(ig>255) ig= 255;
- ib= floor(255.0f * b);
- if(ib<0) ib= 0; else if(ib>255) ib= 255;
- ia= floor(255.0f * a);
- if(ia<0) ia= 0; else if(ia>255) ia= 255;
-
- cp= (char *)&col;
- cp[0]= ia;
- cp[1]= ib;
- cp[2]= ig;
- cp[3]= ir;
-
- return col;
-
+ return MEM_mallocN(sizeof(int) * (me->totpoly + 1), "vertexpaint");
}
unsigned int vpaint_get_current_col(VPaint *vp)
{
Brush *brush = paint_brush(&vp->paint);
- return rgba_to_mcol(brush->rgb[0], brush->rgb[1], brush->rgb[2], 1.0f);
+ unsigned char col[4];
+ rgb_float_to_uchar(col, brush->rgb);
+ col[3] = 255; /* alpha isn't used, could even be removed to speedup paint a little */
+ return *(unsigned int *)col;
}
static void do_shared_vertex_tesscol(Mesh *me)
@@ -229,57 +203,57 @@ static void do_shared_vertex_tesscol(Mesh *me)
short *scolmain, *scol;
char *mcol;
- if(me->mcol==NULL || me->totvert==0 || me->totface==0) return;
-
- 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) {
- scol= scolmain+4*mface->v1;
- scol[0]++; scol[1]+= mcol[1]; scol[2]+= mcol[2]; scol[3]+= mcol[3];
- scol= scolmain+4*mface->v2;
- scol[0]++; scol[1]+= mcol[5]; scol[2]+= mcol[6]; scol[3]+= mcol[7];
- scol= scolmain+4*mface->v3;
- scol[0]++; scol[1]+= mcol[9]; scol[2]+= mcol[10]; scol[3]+= mcol[11];
- if(mface->v4) {
- scol= scolmain+4*mface->v4;
- scol[0]++; scol[1]+= mcol[13]; scol[2]+= mcol[14]; scol[3]+= mcol[15];
+ if (me->mcol == NULL || me->totvert == 0 || me->totface == 0) return;
+
+ 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) {
+ scol = scolmain + 4 * mface->v1;
+ scol[0]++; scol[1] += mcol[1]; scol[2] += mcol[2]; scol[3] += mcol[3];
+ scol = scolmain + 4 * mface->v2;
+ scol[0]++; scol[1] += mcol[5]; scol[2] += mcol[6]; scol[3] += mcol[7];
+ scol = scolmain + 4 * mface->v3;
+ scol[0]++; scol[1] += mcol[9]; scol[2] += mcol[10]; scol[3] += mcol[11];
+ if (mface->v4) {
+ scol = scolmain + 4 * mface->v4;
+ scol[0]++; scol[1] += mcol[13]; scol[2] += mcol[14]; scol[3] += mcol[15];
}
}
- if(tface) tface++;
- }
-
- a= me->totvert;
- scol= scolmain;
- while(a--) {
- if(scol[0]>1) {
- scol[1]/= scol[0];
- scol[2]/= scol[0];
- scol[3]/= scol[0];
- }
- 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) {
- scol= scolmain+4*mface->v1;
- mcol[1]= scol[1]; mcol[2]= scol[2]; mcol[3]= scol[3];
- scol= scolmain+4*mface->v2;
- mcol[5]= scol[1]; mcol[6]= scol[2]; mcol[7]= scol[3];
- scol= scolmain+4*mface->v3;
- mcol[9]= scol[1]; mcol[10]= scol[2]; mcol[11]= scol[3];
- if(mface->v4) {
- scol= scolmain+4*mface->v4;
- mcol[13]= scol[1]; mcol[14]= scol[2]; mcol[15]= scol[3];
+ if (tface) tface++;
+ }
+
+ a = me->totvert;
+ scol = scolmain;
+ while (a--) {
+ if (scol[0] > 1) {
+ scol[1] /= scol[0];
+ scol[2] /= scol[0];
+ scol[3] /= scol[0];
+ }
+ 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) {
+ scol = scolmain + 4 * mface->v1;
+ mcol[1] = scol[1]; mcol[2] = scol[2]; mcol[3] = scol[3];
+ scol = scolmain + 4 * mface->v2;
+ mcol[5] = scol[1]; mcol[6] = scol[2]; mcol[7] = scol[3];
+ scol = scolmain + 4 * mface->v3;
+ mcol[9] = scol[1]; mcol[10] = scol[2]; mcol[11] = scol[3];
+ if (mface->v4) {
+ scol = scolmain + 4 * mface->v4;
+ mcol[13] = scol[1]; mcol[14] = scol[2]; mcol[15] = scol[3];
}
}
- if(tface) tface++;
+ if (tface) tface++;
}
MEM_freeN(scolmain);
@@ -297,17 +271,17 @@ void do_shared_vertexcol(Mesh *me, int do_tessface)
/* if no mloopcol: do not do */
/* if mtexpoly: only the involved faces, otherwise all */
- if(me->mloopcol==0 || me->totvert==0 || me->totpoly==0) return;
+ if (me->mloopcol == 0 || me->totvert == 0 || me->totpoly == 0) return;
- scol = MEM_callocN(sizeof(float)*me->totvert*5, "scol");
+ scol = MEM_callocN(sizeof(float) * me->totvert * 5, "scol");
- for (i=0; i<me->totloop; i++, ml++, lcol++) {
+ for (i = 0; i < me->totloop; i++, ml++, lcol++) {
if (i >= mp->loopstart + mp->totloop) {
mp++;
if (mtp) mtp++;
}
- if (!(mtp && (mtp->mode & TF_SHAREDCOL)) && (me->editflag & ME_EDIT_PAINT_MASK)!=0)
+ if (!(mtp && (mtp->mode & TF_SHAREDCOL)) && (me->editflag & ME_EDIT_PAINT_MASK) != 0)
continue;
scol[ml->v][0] += lcol->r;
@@ -319,7 +293,7 @@ void do_shared_vertexcol(Mesh *me, int do_tessface)
}
if (has_shared) {
- for (i=0; i<me->totvert; i++) {
+ for (i = 0; i < me->totvert; i++) {
if (!scol[i][4]) continue;
scol[i][0] /= scol[i][4];
@@ -330,7 +304,7 @@ void do_shared_vertexcol(Mesh *me, int do_tessface)
ml = me->mloop;
lcol = me->mloopcol;
- for (i=0; i<me->totloop; i++, ml++, lcol++) {
+ for (i = 0; i < me->totloop; i++, ml++, lcol++) {
if (!scol[ml->v][4]) continue;
lcol->r = scol[ml->v][0];
@@ -350,14 +324,14 @@ void do_shared_vertexcol(Mesh *me, int do_tessface)
static void make_vertexcol(Object *ob) /* single ob */
{
Mesh *me;
- if(!ob || ob->id.lib) return;
- me= get_mesh(ob);
- if(me==NULL) return;
- if(me->edit_btmesh) return;
+ if (!ob || ob->id.lib) return;
+ me = get_mesh(ob);
+ if (me == NULL) return;
+ if (me->edit_btmesh) return;
/* copies from shadedisplist to mcol */
if (!me->mloopcol) {
- if(!me->mcol) {
+ if (!me->mcol) {
CustomData_add_layer(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface);
}
if (!me->mloopcol) {
@@ -371,10 +345,10 @@ static void make_vertexcol(Object *ob) /* single ob */
if (!me->mcol || !me->mface) {
/* should always be true */
if (me->mcol) {
- memset(me->mcol, 255, 4*sizeof(MCol)*me->totface);
+ memset(me->mcol, 255, 4 * sizeof(MCol) * me->totface);
}
- /* create tessfaces because they will be used for drawing & fast updates*/
+ /* create tessfaces because they will be used for drawing & fast updates */
BKE_mesh_tessface_calc(me); /* does own call to update pointers */
}
}
@@ -396,31 +370,31 @@ static void make_vertexcol(Object *ob) /* single ob */
/* mirror_vgroup is set to -1 when invalid */
static int wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active)
{
- bDeformGroup *defgroup= BLI_findlink(&ob->defbase, vgroup_active);
+ bDeformGroup *defgroup = BLI_findlink(&ob->defbase, vgroup_active);
- if(defgroup) {
+ if (defgroup) {
bDeformGroup *curdef;
int mirrdef;
char name[MAXBONENAME];
flip_side_name(name, defgroup->name, FALSE);
- if(strcmp(name, defgroup->name) != 0) {
- for (curdef= ob->defbase.first, mirrdef= 0; curdef; curdef=curdef->next, mirrdef++) {
+ if (strcmp(name, defgroup->name) != 0) {
+ for (curdef = ob->defbase.first, mirrdef = 0; curdef; curdef = curdef->next, mirrdef++) {
if (!strcmp(curdef->name, name)) {
break;
}
}
- if(curdef==NULL) {
- int olddef= ob->actdef; /* tsk, ED_vgroup_add sets the active defgroup */
- curdef= ED_vgroup_add_name(ob, name);
- ob->actdef= olddef;
+ if (curdef == NULL) {
+ int olddef = ob->actdef; /* tsk, ED_vgroup_add sets the active defgroup */
+ curdef = ED_vgroup_add_name(ob, name);
+ ob->actdef = olddef;
}
/* curdef should never be NULL unless this is
* a lamp and ED_vgroup_add_name fails */
- if(curdef) {
+ if (curdef) {
return mirrdef;
}
}
@@ -431,16 +405,16 @@ static int wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active)
static void copy_vpaint_prev(VPaint *vp, unsigned int *lcol, int tot)
{
- if(vp->vpaint_prev) {
+ if (vp->vpaint_prev) {
MEM_freeN(vp->vpaint_prev);
- vp->vpaint_prev= NULL;
+ vp->vpaint_prev = NULL;
}
- vp->tot= tot;
+ vp->tot = tot;
- if(lcol==NULL || tot==0) return;
+ if (lcol == NULL || tot == 0) return;
- vp->vpaint_prev= MEM_mallocN(sizeof(int)*tot, "vpaint_prev");
- memcpy(vp->vpaint_prev, lcol, sizeof(int)*tot);
+ vp->vpaint_prev = MEM_mallocN(sizeof(int) * tot, "vpaint_prev");
+ memcpy(vp->vpaint_prev, lcol, sizeof(int) * tot);
}
@@ -448,12 +422,12 @@ static void copy_wpaint_prev (VPaint *wp, MDeformVert *dverts, int dcount)
{
if (wp->wpaint_prev) {
free_dverts(wp->wpaint_prev, wp->tot);
- wp->wpaint_prev= NULL;
+ wp->wpaint_prev = NULL;
}
- if(dverts && dcount) {
+ if (dverts && dcount) {
- wp->wpaint_prev = MEM_mallocN (sizeof(MDeformVert)*dcount, "wpaint prev");
+ wp->wpaint_prev = MEM_mallocN (sizeof(MDeformVert) * dcount, "wpaint prev");
wp->tot = dcount;
copy_dverts (wp->wpaint_prev, dverts, dcount);
}
@@ -467,24 +441,23 @@ void vpaint_fill(Object *ob, unsigned int paintcol)
MLoopCol *lcol;
int i, j, selected;
- me= get_mesh(ob);
- if(me==NULL || me->totpoly==0) return;
+ me = get_mesh(ob);
+ if (me == NULL || me->totpoly == 0) return;
- if(!me->mloopcol) make_vertexcol(ob);
- if(!me->mloopcol) return; /* possible we can't make mcol's */
+ if (!me->mloopcol) make_vertexcol(ob);
+ if (!me->mloopcol) return; /* possible we can't make mcol's */
- selected= (me->editflag & ME_EDIT_PAINT_MASK);
+ selected = (me->editflag & ME_EDIT_PAINT_MASK);
mp = me->mpoly;
- lcol = me->mloopcol;
- for (i=0; i<me->totpoly; i++, mp++) {
+ for (i = 0; i < me->totpoly; i++, mp++) {
if (!(!selected || mp->flag & ME_FACE_SEL))
continue;
lcol = me->mloopcol + mp->loopstart;
- for (j=0; j<mp->totloop; j++, lcol++) {
- *(int*)lcol = paintcol;
+ for (j = 0; j < mp->totloop; j++, lcol++) {
+ *(int *)lcol = paintcol;
}
}
@@ -498,73 +471,74 @@ void vpaint_fill(Object *ob, unsigned int paintcol)
/* fills in the selected faces with the current weight and vertex group */
void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
{
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
MPoly *mf;
MDeformWeight *dw, *dw_prev;
- int vgroup_active, vgroup_mirror= -1;
+ int vgroup_active, vgroup_mirror = -1;
unsigned int index;
/* mutually exclusive, could be made into a */
- const short paint_selmode= ME_EDIT_PAINT_SEL_MODE(me);
+ const short paint_selmode = ME_EDIT_PAINT_SEL_MODE(me);
- if(me->totpoly==0 || me->dvert==NULL || !me->mpoly) return;
+ if (me->totpoly == 0 || me->dvert == NULL || !me->mpoly) return;
vgroup_active = ob->actdef - 1;
/* if mirror painting, find the other group */
- if(me->editflag & ME_EDIT_MIRROR_X) {
- vgroup_mirror= wpaint_mirror_vgroup_ensure(ob, vgroup_active);
+ if (me->editflag & ME_EDIT_MIRROR_X) {
+ vgroup_mirror = wpaint_mirror_vgroup_ensure(ob, vgroup_active);
}
copy_wpaint_prev(wp, me->dvert, me->totvert);
- for(index=0, mf= me->mpoly; index < me->totpoly; index++, mf++) {
- unsigned int fidx= mf->totloop - 1;
+ for (index = 0, mf = me->mpoly; index < me->totpoly; index++, mf++) {
+ unsigned int fidx = mf->totloop - 1;
if ((paint_selmode == SCE_SELECT_FACE) && !(mf->flag & ME_FACE_SEL)) {
continue;
}
do {
- unsigned int vidx= me->mloop[mf->loopstart + fidx].v;
+ unsigned int vidx = me->mloop[mf->loopstart + fidx].v;
- if(!me->dvert[vidx].flag) {
- if((paint_selmode == SCE_SELECT_VERTEX) && !(me->mvert[vidx].flag & SELECT)) {
+ if (!me->dvert[vidx].flag) {
+ if ((paint_selmode == SCE_SELECT_VERTEX) && !(me->mvert[vidx].flag & SELECT)) {
continue;
}
- dw= defvert_verify_index(&me->dvert[vidx], vgroup_active);
- if(dw) {
- dw_prev= defvert_verify_index(wp->wpaint_prev+vidx, vgroup_active);
- dw_prev->weight= dw->weight; /* set the undo weight */
- dw->weight= paintweight;
+ dw = defvert_verify_index(&me->dvert[vidx], vgroup_active);
+ if (dw) {
+ dw_prev = defvert_verify_index(wp->wpaint_prev + vidx, vgroup_active);
+ dw_prev->weight = dw->weight; /* set the undo weight */
+ dw->weight = paintweight;
- if(me->editflag & ME_EDIT_MIRROR_X) { /* x mirror painting */
- int j= mesh_get_x_mirror_vert(ob, vidx);
- if(j>=0) {
+ if (me->editflag & ME_EDIT_MIRROR_X) { /* x mirror painting */
+ int j = mesh_get_x_mirror_vert(ob, vidx);
+ if (j >= 0) {
/* copy, not paint again */
- if(vgroup_mirror != -1) {
- dw= defvert_verify_index(me->dvert+j, vgroup_mirror);
- dw_prev= defvert_verify_index(wp->wpaint_prev+j, vgroup_mirror);
- } else {
- dw= defvert_verify_index(me->dvert+j, vgroup_active);
- dw_prev= defvert_verify_index(wp->wpaint_prev+j, vgroup_active);
+ if (vgroup_mirror != -1) {
+ dw = defvert_verify_index(me->dvert + j, vgroup_mirror);
+ dw_prev = defvert_verify_index(wp->wpaint_prev + j, vgroup_mirror);
}
- dw_prev->weight= dw->weight; /* set the undo weight */
- dw->weight= paintweight;
+ else {
+ dw = defvert_verify_index(me->dvert + j, vgroup_active);
+ dw_prev = defvert_verify_index(wp->wpaint_prev + j, vgroup_active);
+ }
+ dw_prev->weight = dw->weight; /* set the undo weight */
+ dw->weight = paintweight;
}
}
}
- me->dvert[vidx].flag= 1;
+ me->dvert[vidx].flag = 1;
}
} while (fidx--);
}
{
- MDeformVert *dv= me->dvert;
- for(index= me->totvert; index != 0; index--, dv++) {
- dv->flag= 0;
+ MDeformVert *dv = me->dvert;
+ for (index = me->totvert; index != 0; index--, dv++) {
+ dv->flag = 0;
}
}
@@ -577,190 +551,210 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
#if 0
void vpaint_dogamma(Scene *scene)
{
- VPaint *vp= scene->toolsettings->vpaint;
+ VPaint *vp = scene->toolsettings->vpaint;
Mesh *me;
Object *ob;
float igam, fac;
int a, temp;
unsigned char *cp, gamtab[256];
- ob= OBACT;
- me= get_mesh(ob);
+ ob = OBACT;
+ me = get_mesh(ob);
- if(!(ob->mode & OB_MODE_VERTEX_PAINT)) return;
- if(me==0 || me->mcol==0 || me->totface==0) return;
+ if (!(ob->mode & OB_MODE_VERTEX_PAINT)) return;
+ if (me == 0 || me->mcol == 0 || me->totface == 0) return;
- igam= 1.0/vp->gamma;
- for(a=0; a<256; a++) {
+ igam = 1.0 / vp->gamma;
+ for (a = 0; a < 256; a++) {
- fac= ((float)a)/255.0;
- fac= vp->mul*pow( fac, igam);
+ fac = ((float)a) / 255.0;
+ fac = vp->mul * pow( fac, igam);
- temp= 255.9*fac;
+ temp = 255.9 * fac;
- if(temp<=0) gamtab[a]= 0;
- else if(temp>=255) gamtab[a]= 255;
- else gamtab[a]= temp;
+ if (temp <= 0) gamtab[a] = 0;
+ else if (temp >= 255) gamtab[a] = 255;
+ else gamtab[a] = temp;
}
- a= 4*me->totface;
- cp= (unsigned char *)me->mcol;
- while(a--) {
+ a = 4 * me->totface;
+ cp = (unsigned char *)me->mcol;
+ while (a--) {
- cp[1]= gamtab[ cp[1] ];
- cp[2]= gamtab[ cp[2] ];
- cp[3]= gamtab[ cp[3] ];
+ cp[1] = gamtab[ cp[1] ];
+ cp[2] = gamtab[ cp[2] ];
+ cp[3] = gamtab[ cp[3] ];
- cp+= 4;
+ cp += 4;
}
}
#endif
-BM_INLINE unsigned int mcol_blend(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_blend(unsigned int col1, unsigned int col2, int fac)
{
- char *cp1, *cp2, *cp;
+ unsigned char *cp1, *cp2, *cp;
int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
- if(fac>=255) return col2;
+ unsigned int col = 0;
+
+ if (fac == 0) {
+ return col1;
+ }
+
+ if (fac >= 255) {
+ return col2;
+ }
+
+ mfac = 255 - fac;
+
+ cp1 = (unsigned char *)&col1;
+ cp2 = (unsigned char *)&col2;
+ cp = (unsigned char *)&col;
+
+ cp[0] = (mfac * cp1[0] + fac * cp2[0]) / 255;
+ cp[1] = (mfac * cp1[1] + fac * cp2[1]) / 255;
+ cp[2] = (mfac * cp1[2] + fac * cp2[2]) / 255;
+ cp[3] = 255;
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- cp[0]= 255;
- cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
- cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
- cp[3]= (mfac*cp1[3]+fac*cp2[3])/255;
-
return col;
}
-BM_INLINE unsigned int mcol_add(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_add(unsigned int col1, unsigned int col2, int fac)
{
- char *cp1, *cp2, *cp;
+ unsigned char *cp1, *cp2, *cp;
int temp;
- unsigned int col=0;
-
- if(fac==0) return col1;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- cp[0]= 255;
- temp= cp1[1] + ((fac*cp2[1])/255);
- if(temp>254) cp[1]= 255; else cp[1]= temp;
- temp= cp1[2] + ((fac*cp2[2])/255);
- if(temp>254) cp[2]= 255; else cp[2]= temp;
- temp= cp1[3] + ((fac*cp2[3])/255);
- if(temp>254) cp[3]= 255; else cp[3]= temp;
+ unsigned int col = 0;
+
+ if (fac == 0) {
+ return col1;
+ }
+
+ cp1 = (unsigned char *)&col1;
+ cp2 = (unsigned char *)&col2;
+ cp = (unsigned char *)&col;
+
+ temp = cp1[0] + ((fac * cp2[0]) / 255);
+ cp[0] = (temp > 254) ? 255 : temp;
+ temp = cp1[1] + ((fac * cp2[1]) / 255);
+ cp[1] = (temp > 254) ? 255 : temp;
+ temp = cp1[2] + ((fac * cp2[2]) / 255);
+ cp[2] = (temp > 254) ? 255 : temp;
+ cp[3] = 255;
return col;
}
-BM_INLINE unsigned int mcol_sub(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_sub(unsigned int col1, unsigned int col2, int fac)
{
- char *cp1, *cp2, *cp;
+ unsigned char *cp1, *cp2, *cp;
int temp;
- unsigned int col=0;
-
- if(fac==0) return col1;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- cp[0]= 255;
- temp= cp1[1] - ((fac*cp2[1])/255);
- if(temp<0) cp[1]= 0; else cp[1]= temp;
- temp= cp1[2] - ((fac*cp2[2])/255);
- if(temp<0) cp[2]= 0; else cp[2]= temp;
- temp= cp1[3] - ((fac*cp2[3])/255);
- if(temp<0) cp[3]= 0; else cp[3]= temp;
-
+ unsigned int col = 0;
+
+ if (fac == 0) {
+ return col1;
+ }
+
+ cp1 = (unsigned char *)&col1;
+ cp2 = (unsigned char *)&col2;
+ cp = (unsigned char *)&col;
+
+ temp = cp1[0] - ((fac * cp2[0]) / 255);
+ cp1[0] = (temp < 0) ? 0 : temp;
+ temp = cp1[1] - ((fac * cp2[1]) / 255);
+ cp1[1] = (temp < 0) ? 0 : temp;
+ temp = cp1[2] - ((fac * cp2[2]) / 255);
+ cp1[2] = (temp < 0) ? 0 : temp;
+ cp[3] = 255;
+
return col;
}
-BM_INLINE unsigned int mcol_mul(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_mul(unsigned int col1, unsigned int col2, int fac)
{
- char *cp1, *cp2, *cp;
+ unsigned char *cp1, *cp2, *cp;
int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
+ unsigned int col = 0;
+
+ if (fac == 0) {
+ return col1;
+ }
+
+ mfac = 255 - fac;
+
+ cp1 = (unsigned char *)&col1;
+ cp2 = (unsigned char *)&col2;
+ cp = (unsigned char *)&col;
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
/* first mul, then blend the fac */
- cp[0]= 255;
- cp[1]= (mfac*cp1[1] + fac*((cp2[1]*cp1[1])/255) )/255;
- cp[2]= (mfac*cp1[2] + fac*((cp2[2]*cp1[2])/255) )/255;
- cp[3]= (mfac*cp1[3] + fac*((cp2[3]*cp1[3])/255) )/255;
+ cp[0] = (mfac * cp1[0] + fac * ((cp2[0] * cp1[0]) / 255)) / 255;
+ cp[1] = (mfac * cp1[1] + fac * ((cp2[1] * cp1[1]) / 255)) / 255;
+ cp[2] = (mfac * cp1[2] + fac * ((cp2[2] * cp1[2]) / 255)) / 255;
+ cp[3] = 255;
-
return col;
}
-BM_INLINE unsigned int mcol_lighten(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_lighten(unsigned int col1, unsigned int col2, int fac)
{
- char *cp1, *cp2, *cp;
+ unsigned char *cp1, *cp2, *cp;
int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
- if(fac>=255) return col2;
+ unsigned int col = 0;
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- /* See if are lighter, if so mix, else dont do anything.
+ if (fac == 0) {
+ return col1;
+ }
+ else if (fac >= 255) {
+ return col2;
+ }
+
+ mfac = 255 - fac;
+
+ cp1 = (unsigned char *)&col1;
+ cp2 = (unsigned char *)&col2;
+ cp = (unsigned char *)&col;
+
+ /* See if are lighter, if so mix, else don't do anything.
* if the paint col is darker then the original, then ignore */
- if (cp1[1]+cp1[2]+cp1[3] > cp2[1]+cp2[2]+cp2[3])
+ if (rgb_to_grayscale_byte(cp1) > rgb_to_grayscale_byte(cp2)) {
return col1;
-
- cp[0]= 255;
- cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
- cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
- cp[3]= (mfac*cp1[3]+fac*cp2[3])/255;
-
+ }
+
+ cp[0] = (mfac * cp1[0] + fac * cp2[0]) / 255;
+ cp[1] = (mfac * cp1[1] + fac * cp2[1]) / 255;
+ cp[2] = (mfac * cp1[2] + fac * cp2[2]) / 255;
+ cp[3] = 255;
+
return col;
}
-BM_INLINE unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fac)
{
- char *cp1, *cp2, *cp;
+ unsigned char *cp1, *cp2, *cp;
int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
- if(fac>=255) return col2;
+ unsigned int col = 0;
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- /* See if were darker, if so mix, else dont do anything.
+ if (fac == 0) {
+ return col1;
+ }
+ else if (fac >= 255) {
+ return col2;
+ }
+
+ mfac = 255 - fac;
+
+ cp1 = (unsigned char *)&col1;
+ cp2 = (unsigned char *)&col2;
+ cp = (unsigned char *)&col;
+
+ /* See if were darker, if so mix, else don't do anything.
* if the paint col is brighter then the original, then ignore */
- if (cp1[1]+cp1[2]+cp1[3] < cp2[1]+cp2[2]+cp2[3])
+ if (rgb_to_grayscale_byte(cp1) < rgb_to_grayscale_byte(cp2)) {
return col1;
-
- cp[0]= 255;
- cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
- cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
- cp[3]= (mfac*cp1[3]+fac*cp2[3])/255;
+ }
+
+ cp[0] = (mfac * cp1[0] + fac * cp2[0]) / 255;
+ cp[1] = (mfac * cp1[1] + fac * cp2[1]) / 255;
+ cp[2] = (mfac * cp1[2] + fac * cp2[2]) / 255;
+ cp[3] = 255;
return col;
}
@@ -794,24 +788,24 @@ static unsigned int vpaint_blend(VPaint *vp, unsigned int col, unsigned int colo
col = vpaint_blend_tool(tool, col, paintcol, alpha_i);
/* if no spray, clip color adding with colorig & orig alpha */
- if((vp->flag & VP_SPRAY)==0) {
+ if ((vp->flag & VP_SPRAY) == 0) {
unsigned int testcol, a;
char *cp, *ct, *co;
testcol = vpaint_blend_tool(tool, colorig, paintcol, brush_alpha_value_i);
- cp= (char *)&col;
- ct= (char *)&testcol;
- co= (char *)&colorig;
+ cp = (char *)&col;
+ ct = (char *)&testcol;
+ co = (char *)&colorig;
- for(a=0; a<4; a++) {
- if( ct[a]<co[a] ) {
- if( cp[a]<ct[a] ) cp[a]= ct[a];
- else if( cp[a]>co[a] ) cp[a]= co[a];
+ for (a = 0; a < 4; a++) {
+ if ( ct[a] < co[a] ) {
+ if ( cp[a] < ct[a] ) cp[a] = ct[a];
+ else if ( cp[a] > co[a] ) cp[a] = co[a];
}
else {
- if( cp[a]<co[a] ) cp[a]= co[a];
- else if( cp[a]>ct[a] ) cp[a]= ct[a];
+ if ( cp[a] < co[a] ) cp[a] = co[a];
+ else if ( cp[a] > ct[a] ) cp[a] = ct[a];
}
}
}
@@ -823,32 +817,32 @@ static unsigned int vpaint_blend(VPaint *vp, unsigned int col, unsigned int colo
static int sample_backbuf_area(ViewContext *vc, int *indexar, int totface, int x, int y, float size)
{
struct ImBuf *ibuf;
- int a, tot=0, index;
+ int a, tot = 0, index;
/* brecht: disabled this because it obviously fails for
* brushes with size > 64, why is this here? */
- /*if(size>64.0) size= 64.0;*/
+ /*if(size > 64.0) size = 64.0;*/
- ibuf= view3d_read_backbuf(vc, x-size, y-size, x+size, y+size);
- if(ibuf) {
- unsigned int *rt= ibuf->rect;
+ ibuf = view3d_read_backbuf(vc, x - size, y - size, x + size, y + size);
+ if (ibuf) {
+ unsigned int *rt = ibuf->rect;
- memset(indexar, 0, sizeof(int)*(totface+1));
+ memset(indexar, 0, sizeof(int) * (totface + 1));
- size= ibuf->x*ibuf->y;
- while(size--) {
+ size = ibuf->x * ibuf->y;
+ while (size--) {
- if(*rt) {
- index= WM_framebuffer_to_index(*rt);
- if(index>0 && index<=totface)
+ if (*rt) {
+ index = WM_framebuffer_to_index(*rt);
+ if (index > 0 && index <= totface)
indexar[index] = 1;
}
rt++;
}
- for(a=1; a<=totface; a++) {
- if(indexar[a]) indexar[tot++]= a;
+ for (a = 1; a <= totface; a++) {
+ if (indexar[a]) indexar[tot++] = a;
}
IMB_freeImBuf(ibuf);
@@ -867,7 +861,7 @@ static float calc_vp_strength_dl(VPaint *vp, ViewContext *vc, const float *vert_
project_float_noclip(vc->ar, vert_nor, vertco);
sub_v2_v2v2(delta, mval, vertco);
- dist_squared= dot_v2v2(delta, delta); /* len squared */
+ dist_squared = dot_v2v2(delta, delta); /* len squared */
if (dist_squared > brush_size_pressure * brush_size_pressure) {
return 0.0f;
}
@@ -885,11 +879,11 @@ static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc,
float strength = calc_vp_strength_dl(vp, vc, vert_nor, mval, brush_size_pressure);
if (strength > 0.0f) {
- float alpha= brush_alpha_pressure * strength;
+ float alpha = brush_alpha_pressure * strength;
- if(vp->flag & VP_NORMALS) {
+ if (vp->flag & VP_NORMALS) {
float dvec[3];
- const float *no= vert_nor + 3;
+ const float *no = vert_nor + 3;
/* transpose ! */
dvec[2] = dot_v3v3(vpimat[2], no);
@@ -911,27 +905,27 @@ static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc,
}
-BM_INLINE float wval_blend(const float weight, const float paintval, const float alpha)
+BLI_INLINE float wval_blend(const float weight, const float paintval, const float alpha)
{
return (paintval * alpha) + (weight * (1.0f - alpha));
}
-BM_INLINE float wval_add(const float weight, const float paintval, const float alpha)
+BLI_INLINE float wval_add(const float weight, const float paintval, const float alpha)
{
return weight + (paintval * alpha);
}
-BM_INLINE float wval_sub(const float weight, const float paintval, const float alpha)
+BLI_INLINE float wval_sub(const float weight, const float paintval, const float alpha)
{
return weight - (paintval * alpha);
}
-BM_INLINE float wval_mul(const float weight, const float paintval, const float alpha)
+BLI_INLINE float wval_mul(const float weight, const float paintval, const float alpha)
{ /* first mul, then blend the fac */
return ((1.0f - alpha) + (alpha * paintval)) * weight;
}
-BM_INLINE float wval_lighten(const float weight, const float paintval, const float alpha)
+BLI_INLINE float wval_lighten(const float weight, const float paintval, const float alpha)
{
return (weight < paintval) ? wval_blend(weight, paintval, alpha) : weight;
}
-BM_INLINE float wval_darken(const float weight, const float paintval, const float alpha)
+BLI_INLINE float wval_darken(const float weight, const float paintval, const float alpha)
{
return (weight > paintval) ? wval_blend(weight, paintval, alpha) : weight;
}
@@ -972,32 +966,32 @@ static float wpaint_blend(VPaint *wp, float weight, float weight_prev,
case PAINT_BLEND_MIX:
paintval = 1.f - paintval; break;
case PAINT_BLEND_ADD:
- tool= PAINT_BLEND_SUB; break;
+ tool = PAINT_BLEND_SUB; break;
case PAINT_BLEND_SUB:
- tool= PAINT_BLEND_ADD; break;
+ tool = PAINT_BLEND_ADD; break;
case PAINT_BLEND_LIGHTEN:
- tool= PAINT_BLEND_DARKEN; break;
+ tool = PAINT_BLEND_DARKEN; break;
case PAINT_BLEND_DARKEN:
- tool= PAINT_BLEND_LIGHTEN; break;
+ tool = PAINT_BLEND_LIGHTEN; break;
}
}
weight = wpaint_blend_tool(tool, weight, paintval, alpha);
/* delay clamping until the end so multi-paint can function when the active group is at the limits */
- if(do_multipaint_totsel == FALSE) {
+ if (do_multipaint_totsel == FALSE) {
CLAMP(weight, 0.0f, 1.0f);
}
/* if no spray, clip result with orig weight & orig alpha */
if ((wp->flag & VP_SPRAY) == 0) {
- if(do_multipaint_totsel == FALSE) {
+ if (do_multipaint_totsel == FALSE) {
float testw = wpaint_blend_tool(tool, weight_prev, paintval, brush_alpha_value);
CLAMP(testw, 0.0f, 1.0f);
if (testw < weight_prev) {
- if(weight < testw) weight = testw;
- else if(weight > weight_prev) weight = weight_prev;
+ if (weight < testw) weight = testw;
+ else if (weight > weight_prev) weight = weight_prev;
}
else {
if (weight > testw) weight = testw;
@@ -1018,59 +1012,59 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ViewContext vc;
Mesh *me;
- short change= FALSE;
+ short change = FALSE;
view3d_set_viewcontext(C, &vc);
- me= get_mesh(vc.obact);
+ me = get_mesh(vc.obact);
if (me && me->dvert && vc.v3d && vc.rv3d) {
int index;
view3d_operator_needs_opengl(C);
- index= view3d_sample_backbuf(&vc, event->mval[0], event->mval[1]);
+ index = view3d_sample_backbuf(&vc, event->mval[0], event->mval[1]);
- if(index && index<=me->totpoly) {
- DerivedMesh *dm= mesh_get_derived_final(vc.scene, vc.obact, CD_MASK_BAREMESH);
+ if (index && index <= me->totpoly) {
+ DerivedMesh *dm = mesh_get_derived_final(vc.scene, vc.obact, CD_MASK_BAREMESH);
- if(dm->getVertCo==NULL) {
+ if (dm->getVertCo == NULL) {
BKE_report(op->reports, RPT_WARNING, "The modifier used does not support deformed locations");
}
else {
- MPoly *mf= ((MPoly *)me->mpoly) + index-1;
- const int vgroup_active= vc.obact->actdef - 1;
- ToolSettings *ts= vc.scene->toolsettings;
+ MPoly *mf = ((MPoly *)me->mpoly) + index - 1;
+ const int vgroup_active = vc.obact->actdef - 1;
+ ToolSettings *ts = vc.scene->toolsettings;
float mval_f[2];
- int v_idx_best= -1;
+ int v_idx_best = -1;
int fidx;
- float len_best= FLT_MAX;
+ float len_best = FLT_MAX;
- mval_f[0]= (float)event->mval[0];
- mval_f[1]= (float)event->mval[1];
+ mval_f[0] = (float)event->mval[0];
+ mval_f[1] = (float)event->mval[1];
- fidx= mf->totloop - 1;
+ fidx = mf->totloop - 1;
do {
float co[3], sco[3], len;
- const int v_idx= me->mloop[mf->loopstart + fidx].v;
+ const int v_idx = me->mloop[mf->loopstart + fidx].v;
dm->getVertCo(dm, v_idx, co);
project_float_noclip(vc.ar, co, sco);
- len= len_squared_v2v2(mval_f, sco);
- if(len < len_best) {
- len_best= len;
- v_idx_best= v_idx;
+ len = len_squared_v2v2(mval_f, sco);
+ if (len < len_best) {
+ len_best = len;
+ v_idx_best = v_idx;
}
} while (fidx--);
- if(v_idx_best != -1) { /* should always be valid */
- ts->vgroup_weight= defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
- change= TRUE;
+ if (v_idx_best != -1) { /* should always be valid */
+ ts->vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
+ change = TRUE;
}
}
dm->release(dm);
}
}
- if(change) {
+ if (change) {
/* not really correct since the brush didnt change, but redraws the toolbar */
WM_main_add_notifier(NC_BRUSH|NA_EDITED, NULL); /* ts->wpaint->paint.brush */
@@ -1084,74 +1078,74 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
void PAINT_OT_weight_sample(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Weight Paint Sample Weight";
- ot->idname= "PAINT_OT_weight_sample";
+ ot->name = "Weight Paint Sample Weight";
+ ot->idname = "PAINT_OT_weight_sample";
/* api callbacks */
- ot->invoke= weight_sample_invoke;
- ot->poll= weight_paint_mode_poll;
+ ot->invoke = weight_sample_invoke;
+ ot->poll = weight_paint_mode_poll;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
}
/* samples cursor location, and gives menu with vertex groups to activate */
static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
if (C) {
- wmWindow *win= CTX_wm_window(C);
- if(win && win->eventstate) {
+ wmWindow *win = CTX_wm_window(C);
+ if (win && win->eventstate) {
ViewContext vc;
Mesh *me;
view3d_set_viewcontext(C, &vc);
- me= get_mesh(vc.obact);
+ me = get_mesh(vc.obact);
if (me && me->dvert && vc.v3d && vc.rv3d) {
int index;
view3d_operator_needs_opengl(C);
- index= view3d_sample_backbuf(&vc, win->eventstate->x - vc.ar->winrct.xmin, win->eventstate->y - vc.ar->winrct.ymin);
+ index = view3d_sample_backbuf(&vc, win->eventstate->x - vc.ar->winrct.xmin, win->eventstate->y - vc.ar->winrct.ymin);
- if(index && index<=me->totpoly) {
- const int defbase_tot= BLI_countlist(&vc.obact->defbase);
- if(defbase_tot) {
- MPoly *mf= ((MPoly *)me->mpoly) + index-1;
- unsigned int fidx= mf->totloop - 1;
- int *groups= MEM_callocN(defbase_tot*sizeof(int), "groups");
- int found= FALSE;
+ if (index && index <= me->totpoly) {
+ const int defbase_tot = BLI_countlist(&vc.obact->defbase);
+ if (defbase_tot) {
+ MPoly *mf = ((MPoly *)me->mpoly) + index - 1;
+ unsigned int fidx = mf->totloop - 1;
+ int *groups = MEM_callocN(defbase_tot * sizeof(int), "groups");
+ int found = FALSE;
do {
- MDeformVert *dvert= me->dvert + me->mloop[mf->loopstart + fidx].v;
- int i= dvert->totweight;
+ MDeformVert *dvert = me->dvert + me->mloop[mf->loopstart + fidx].v;
+ int i = dvert->totweight;
MDeformWeight *dw;
- for(dw= dvert->dw; i > 0; dw++, i--) {
+ for (dw = dvert->dw; i > 0; dw++, i--) {
if (dw->def_nr < defbase_tot) {
- groups[dw->def_nr]= TRUE;
- found= TRUE;
+ groups[dw->def_nr] = TRUE;
+ found = TRUE;
}
}
} while (fidx--);
- if(found==FALSE) {
+ if (found == FALSE) {
MEM_freeN(groups);
}
else {
- EnumPropertyItem *item= NULL, item_tmp= {0};
- int totitem= 0;
- int i= 0;
+ EnumPropertyItem *item = NULL, item_tmp = {0};
+ int totitem = 0;
+ int i = 0;
bDeformGroup *dg;
- for(dg= vc.obact->defbase.first; dg && i<defbase_tot; i++, dg= dg->next) {
- if(groups[i]) {
- item_tmp.identifier= item_tmp.name= dg->name;
- item_tmp.value= i;
+ for (dg = vc.obact->defbase.first; dg && i < defbase_tot; i++, dg = dg->next) {
+ if (groups[i]) {
+ item_tmp.identifier = item_tmp.name = dg->name;
+ item_tmp.value = i;
RNA_enum_item_add(&item, &totitem, &item_tmp);
}
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
MEM_freeN(groups);
return item;
@@ -1167,12 +1161,12 @@ static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA
static int weight_sample_group_exec(bContext *C, wmOperator *op)
{
- int type= RNA_enum_get(op->ptr, "group");
+ int type = RNA_enum_get(op->ptr, "group");
ViewContext vc;
view3d_set_viewcontext(C, &vc);
BLI_assert(type + 1 >= 0);
- vc.obact->actdef= type + 1;
+ vc.obact->actdef = type + 1;
DAG_id_tag_update(&vc.obact->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, vc.obact);
@@ -1182,33 +1176,33 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op)
/* TODO, we could make this a menu into OBJECT_OT_vertex_group_set_active rather than its own operator */
void PAINT_OT_weight_sample_group(wmOperatorType *ot)
{
- PropertyRNA *prop= NULL;
+ PropertyRNA *prop = NULL;
/* identifiers */
- ot->name= "Weight Paint Sample Group";
- ot->idname= "PAINT_OT_weight_sample_group";
+ ot->name = "Weight Paint Sample Group";
+ ot->idname = "PAINT_OT_weight_sample_group";
/* api callbacks */
- ot->exec= weight_sample_group_exec;
- ot->invoke= WM_menu_invoke;
- ot->poll= weight_paint_mode_poll;
+ ot->exec = weight_sample_group_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->poll = weight_paint_mode_poll;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* keyingset to use (dynamic enum) */
- prop= RNA_def_enum(ot->srna, "group", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+ prop = RNA_def_enum(ot->srna, "group", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
RNA_def_enum_funcs(prop, weight_paint_sample_enum_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
static void do_weight_paint_normalize_all(MDeformVert *dvert, const int defbase_tot, const char *vgroup_validmap)
{
- float sum= 0.0f, fac;
- unsigned int i, tot=0;
+ float sum = 0.0f, fac;
+ unsigned int i, tot = 0;
MDeformWeight *dw;
- for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
tot++;
sum += dw->weight;
@@ -1220,9 +1214,9 @@ static void do_weight_paint_normalize_all(MDeformVert *dvert, const int defbase_
}
if (sum != 0.0f) {
- fac= 1.0f / sum;
+ fac = 1.0f / sum;
- for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
dw->weight *= fac;
}
@@ -1232,7 +1226,7 @@ static void do_weight_paint_normalize_all(MDeformVert *dvert, const int defbase_
/* hrmf, not a factor in this case */
fac = 1.0f / tot;
- for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
dw->weight = fac;
}
@@ -1247,12 +1241,12 @@ static void do_weight_paint_normalize_all(MDeformVert *dvert, const int defbase_
static void do_weight_paint_normalize_all_active(MDeformVert *dvert, const int defbase_tot, const char *vgroup_validmap,
const int vgroup_active)
{
- float sum= 0.0f, fac;
- unsigned int i, tot=0;
+ float sum = 0.0f, fac;
+ unsigned int i, tot = 0;
MDeformWeight *dw;
float act_weight = 0.0f;
- for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
if (dw->def_nr != vgroup_active) {
sum += dw->weight;
@@ -1271,7 +1265,7 @@ static void do_weight_paint_normalize_all_active(MDeformVert *dvert, const int d
if (sum != 0.0f) {
fac = (1.0f / sum) * (1.0f - act_weight);
- for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
if (dw->def_nr != vgroup_active) {
dw->weight *= fac;
@@ -1291,7 +1285,7 @@ static void do_weight_paint_normalize_all_active(MDeformVert *dvert, const int d
/* paranoid but possibly with float error */
CLAMP(fac, 0.0f, 1.0f);
- for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
if (dw->def_nr != vgroup_active) {
dw->weight = fac;
@@ -1310,7 +1304,7 @@ static char has_locked_group(MDeformVert *dvert, const int defbase_tot,
int i;
MDeformWeight *dw;
- for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
if (dw->def_nr < defbase_tot) {
if (bone_groups[dw->def_nr] && lock_flags[dw->def_nr] && dw->weight > 0.0f) {
return TRUE;
@@ -1323,15 +1317,15 @@ static char has_locked_group(MDeformVert *dvert, const int defbase_tot,
* gen_lck_flags gets the status of "flag" for each bDeformGroup
*in ob->defbase and returns an array containing them
*/
-static char *gen_lock_flags(Object* ob, int defbase_tot)
+static char *gen_lock_flags(Object *ob, int defbase_tot)
{
char is_locked = FALSE;
int i;
//int defbase_tot = BLI_countlist(&ob->defbase);
- char *lock_flags = MEM_mallocN(defbase_tot*sizeof(char), "defflags");
+ char *lock_flags = MEM_mallocN(defbase_tot * sizeof(char), "defflags");
bDeformGroup *defgroup;
- for(i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
+ for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
lock_flags[i] = ((defgroup->flag & DG_LOCK_WEIGHT) != 0);
is_locked |= lock_flags[i];
}
@@ -1346,8 +1340,8 @@ static char *gen_lock_flags(Object* ob, int defbase_tot)
static int has_locked_group_selected(int defbase_tot, const char *defbase_sel, const char *lock_flags)
{
int i;
- for(i = 0; i < defbase_tot; i++) {
- if(defbase_sel[i] && lock_flags[i]) {
+ for (i = 0; i < defbase_tot; i++) {
+ if (defbase_sel[i] && lock_flags[i]) {
return TRUE;
}
}
@@ -1359,11 +1353,11 @@ static int has_locked_group_selected(int defbase_tot, const char *defbase_sel, c
static int has_unselected_unlocked_bone_group(int defbase_tot, char *defbase_sel, int selected, char *lock_flags, char *vgroup_validmap)
{
int i;
- if(defbase_tot == selected) {
+ if (defbase_tot == selected) {
return FALSE;
}
- for(i = 0; i < defbase_tot; i++) {
- if(vgroup_validmap[i] && !defbase_sel[i] && !lock_flags[i]) {
+ for (i = 0; i < defbase_tot; i++) {
+ if (vgroup_validmap[i] && !defbase_sel[i] && !lock_flags[i]) {
return TRUE;
}
}
@@ -1378,30 +1372,30 @@ static void multipaint_selection(MDeformVert *dvert, const int defbase_tot, floa
MDeformWeight *dw;
float val;
/* make sure they are all at most 1 after the change */
- for(i = 0; i < defbase_tot; i++) {
- if(defbase_sel[i]) {
+ for (i = 0; i < defbase_tot; i++) {
+ if (defbase_sel[i]) {
dw = defvert_find_index(dvert, i);
- if(dw && dw->weight) {
+ if (dw && dw->weight) {
val = dw->weight * change;
- if(val > 1) {
+ if (val > 1) {
/* TODO: when the change is reduced, you need to recheck
* the earlier values to make sure they are not 0
* (precision error) */
- change = 1.0f/dw->weight;
+ change = 1.0f / dw->weight;
}
/* the value should never reach zero while multi-painting if it
* was nonzero beforehand */
- if(val <= 0) {
+ if (val <= 0) {
return;
}
}
}
}
/* apply the valid change */
- for(i = 0; i < defbase_tot; i++) {
- if(defbase_sel[i]) {
+ for (i = 0; i < defbase_tot; i++) {
+ if (defbase_sel[i]) {
dw = defvert_find_index(dvert, i);
- if(dw && dw->weight) {
+ if (dw && dw->weight) {
dw->weight = dw->weight * change;
}
}
@@ -1425,25 +1419,25 @@ static float redistribute_change(MDeformVert *ndv, const int defbase_tot,
/* assume there is no change until you see one */
was_change = FALSE;
/* change each group by the same amount each time */
- change = totchange/total_valid;
- for(i = 0; i < ndv->totweight && total_valid && totchange; i++) {
- ndw = (ndv->dw+i);
+ change = totchange / total_valid;
+ for (i = 0; i < ndv->totweight && total_valid && totchange; i++) {
+ ndw = (ndv->dw + i);
/* ignore anything outside the value range */
if (ndw->def_nr < defbase_tot) {
/* change only the groups with a valid status */
- if(change_status[ndw->def_nr] == change_me) {
+ if (change_status[ndw->def_nr] == change_me) {
oldval = ndw->weight;
/* if auto normalize is active, don't worry about upper bounds */
- if(do_auto_normalize == FALSE && ndw->weight + change > 1) {
- totchange -= 1-ndw->weight;
- ndw->weight = 1;
+ if (do_auto_normalize == FALSE && ndw->weight + change > 1) {
+ totchange -= 1.0f - ndw->weight;
+ ndw->weight = 1.0f;
/* stop the changes to this group */
change_status[ndw->def_nr] = changeto;
total_valid--;
}
- else if(ndw->weight + change < 0) { /* check the lower bound */
+ else if (ndw->weight + change < 0) { /* check the lower bound */
totchange -= ndw->weight;
ndw->weight = 0;
change_status[ndw->def_nr] = changeto;
@@ -1454,7 +1448,7 @@ static float redistribute_change(MDeformVert *ndv, const int defbase_tot,
ndw->weight += change;
}
/* see if there was a change */
- if(oldval != ndw->weight) {
+ if (oldval != ndw->weight) {
was_change = TRUE;
}
}
@@ -1462,7 +1456,7 @@ static float redistribute_change(MDeformVert *ndv, const int defbase_tot,
}
/* don't go again if there was no change, if there is no valid group,
* or there is no change left */
- } while(was_change && total_valid && totchange);
+ } while (was_change && total_valid && totchange);
/* left overs */
return totchange;
}
@@ -1489,17 +1483,17 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
char *change_status;
- if(!lock_flags || !has_locked_group(ndv, defbase_tot, vgroup_validmap, lock_flags)) {
+ if (!lock_flags || !has_locked_group(ndv, defbase_tot, vgroup_validmap, lock_flags)) {
return;
}
/* record if a group was changed, unlocked and not changed, or locked */
- change_status = MEM_callocN(sizeof(char)*defbase_tot, "unlocked_unchanged");
+ change_status = MEM_callocN(sizeof(char) * defbase_tot, "unlocked_unchanged");
- for(i = 0; i < defbase_tot; i++) {
+ for (i = 0; i < defbase_tot; i++) {
ndw = defvert_find_index(ndv, i);
odw = defvert_find_index(odv, i);
/* the weights are zero, so we can assume a lot */
- if(!ndw || !odw) {
+ if (!ndw || !odw) {
if (!lock_flags[i] && vgroup_validmap[i]) {
defvert_verify_index(odv, i);
defvert_verify_index(ndv, i);
@@ -1509,10 +1503,10 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
continue;
}
/* locked groups should not be changed */
- if(lock_flags[i]) {
+ if (lock_flags[i]) {
ndw->weight = odw->weight;
}
- else if(ndw->weight != odw->weight) { /* changed groups are handled here */
+ else if (ndw->weight != odw->weight) { /* changed groups are handled here */
totchange += ndw->weight - odw->weight;
changed_sum += ndw->weight;
change_status[i] = 2; /* was altered already */
@@ -1525,26 +1519,26 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
}
}
/* if there was any change, redistribute it */
- if(total_changed) {
+ if (total_changed) {
/* auto normalize will allow weights to temporarily go above 1 in redistribution */
- if(vgroup_validmap && total_changed < 0 && total_valid) {
+ if (vgroup_validmap && total_changed < 0 && total_valid) {
totchange_allowed = total_valid;
}
- /* the way you modify the unlocked+unchanged groups is different depending
+ /* the way you modify the unlocked + unchanged groups is different depending
* on whether or not you are painting the weight(s) up or down */
- if(totchange < 0) {
+ if (totchange < 0) {
totchange_allowed = total_valid - totchange_allowed;
}
else {
totchange_allowed *= -1;
}
/* there needs to be change allowed, or you should not bother */
- if(totchange_allowed) {
+ if (totchange_allowed) {
left_over = 0;
- if(fabsf(totchange_allowed) < fabsf(totchange)) {
+ if (fabsf(totchange_allowed) < fabsf(totchange)) {
/* this amount goes back onto the changed, unlocked weights */
left_over = fabsf(fabsf(totchange) - fabsf(totchange_allowed));
- if(totchange > 0) {
+ if (totchange > 0) {
left_over *= -1;
}
}
@@ -1555,9 +1549,9 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
/* move the weight evenly between the allowed groups, move excess back onto the used groups based on the change */
totchange_allowed = redistribute_change(ndv, defbase_tot, change_status, 1, -1, totchange_allowed, total_valid, do_auto_normalize);
left_over += totchange_allowed;
- if(left_over) {
+ if (left_over) {
/* more than one nonzero weights were changed with the same ratio with multipaint, so keep them changed that way! */
- if(total_changed > 1 && do_multipaint) {
+ if (total_changed > 1 && do_multipaint) {
float undo_change = get_mp_change(ndv, defbase_tot, defbase_sel, left_over);
multipaint_selection(ndv, defbase_tot, undo_change, defbase_sel);
}
@@ -1570,11 +1564,11 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
else {
/* reset the weights */
unsigned int i;
- MDeformWeight *dw_old= odv->dw;
- MDeformWeight *dw_new= ndv->dw;
+ MDeformWeight *dw_old = odv->dw;
+ MDeformWeight *dw_new = ndv->dw;
- for (i= odv->totweight; i != 0; i--, dw_old++, dw_new++) {
- dw_new->weight= dw_old->weight;
+ for (i = odv->totweight; i != 0; i--, dw_old++, dw_new++) {
+ dw_new->weight = dw_old->weight;
}
}
}
@@ -1587,17 +1581,17 @@ static float get_mp_change(MDeformVert *odv, const int defbase_tot, const char *
{
float selwsum = 0.0f;
unsigned int i;
- MDeformWeight *dw= odv->dw;
+ MDeformWeight *dw = odv->dw;
- for (i= odv->totweight; i != 0; i--, dw++) {
+ for (i = odv->totweight; i != 0; i--, dw++) {
if (dw->def_nr < defbase_tot) {
- if(defbase_sel[dw->def_nr]) {
+ if (defbase_sel[dw->def_nr]) {
selwsum += dw->weight;
}
}
}
- if(selwsum && selwsum+brush_change > 0) {
- return (selwsum+brush_change)/selwsum;
+ if (selwsum && selwsum + brush_change > 0) {
+ return (selwsum + brush_change) / selwsum;
}
return 0.0f;
}
@@ -1606,11 +1600,11 @@ static float get_mp_change(MDeformVert *odv, const int defbase_tot, const char *
* it assumes you already have the correct pointer index */
static void defvert_reset_to_prev(MDeformVert *dv_prev, MDeformVert *dv)
{
- MDeformWeight *dw= dv->dw;
+ MDeformWeight *dw = dv->dw;
MDeformWeight *dw_prev;
unsigned int i;
- for (i= dv->totweight; i != 0; i--, dw++) {
- dw_prev= defvert_find_index(dv_prev, dw->def_nr);
+ for (i = dv->totweight; i != 0; i--, dw++) {
+ dw_prev = defvert_find_index(dv_prev, dw->def_nr);
/* if there was no w when there is a d, then the old weight was 0 */
dw->weight = dw_prev ? dw_prev->weight : 0.0f;
}
@@ -1618,9 +1612,9 @@ static void defvert_reset_to_prev(MDeformVert *dv_prev, MDeformVert *dv)
static void clamp_weights(MDeformVert *dvert)
{
- MDeformWeight *dw= dvert->dw;
+ MDeformWeight *dw = dvert->dw;
unsigned int i;
- for (i= dvert->totweight; i != 0; i--, dw++) {
+ for (i = dvert->totweight; i != 0; i--, dw++) {
CLAMP(dw->weight, 0.0f, 1.0f);
}
}
@@ -1667,10 +1661,10 @@ static int apply_mp_locks_normalize(Mesh *me, const WeightPaintInfo *wpi,
float change, float oldChange,
float oldw, float neww)
{
- MDeformVert *dv= &me->dvert[index];
- MDeformVert dv_test= {NULL};
+ MDeformVert *dv = &me->dvert[index];
+ MDeformVert dv_test = {NULL};
- dv_test.dw= MEM_dupallocN(dv->dw);
+ dv_test.dw = MEM_dupallocN(dv->dw);
dv_test.flag = dv->flag;
dv_test.totweight = dv->totweight;
/* do not multi-paint if a locked group is selected or the active group is locked
@@ -1679,8 +1673,8 @@ static int apply_mp_locks_normalize(Mesh *me, const WeightPaintInfo *wpi,
((wpi->lock_flags[dw->def_nr] == FALSE) && /* def_nr range has to be checked for by caller */
has_locked_group_selected(wpi->defbase_tot, wpi->defbase_sel, wpi->lock_flags) == FALSE))
{
- if(wpi->do_multipaint && wpi->defbase_tot_sel > 1) {
- if(change && change!=1) {
+ if (wpi->do_multipaint && wpi->defbase_tot_sel > 1) {
+ if (change && change != 1) {
multipaint_selection(dv, wpi->defbase_tot, change, wpi->defbase_sel);
}
}
@@ -1697,16 +1691,16 @@ static int apply_mp_locks_normalize(Mesh *me, const WeightPaintInfo *wpi,
do_weight_paint_normalize_all(dv, wpi->defbase_tot, wpi->vgroup_validmap);
}
- if(oldChange && wpi->do_multipaint && wpi->defbase_tot_sel > 1) {
- if(tdw->weight != oldw) {
- if(neww > oldw) {
- if(tdw->weight <= oldw) {
+ if (oldChange && wpi->do_multipaint && wpi->defbase_tot_sel > 1) {
+ if (tdw->weight != oldw) {
+ if (neww > oldw) {
+ if (tdw->weight <= oldw) {
MEM_freeN(dv_test.dw);
return TRUE;
}
}
else {
- if(tdw->weight >= oldw) {
+ if (tdw->weight >= oldw) {
MEM_freeN(dv_test.dw);
return TRUE;
}
@@ -1722,8 +1716,8 @@ static int apply_mp_locks_normalize(Mesh *me, const WeightPaintInfo *wpi,
static int get_first_selected_nonzero_weight(MDeformVert *dvert, const int defbase_tot, const char *defbase_sel)
{
int i;
- MDeformWeight *dw= dvert->dw;
- for(i=0; i< dvert->totweight; i++, dw++) {
+ MDeformWeight *dw = dvert->dw;
+ for (i = 0; i < dvert->totweight; i++, dw++) {
if (dw->def_nr < defbase_tot) {
if (defbase_sel[dw->def_nr] && dw->weight > 0.0f) {
return i;
@@ -1743,8 +1737,8 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
const unsigned int index, float alpha, float paintweight
)
{
- Mesh *me= ob->data;
- MDeformVert *dv= &me->dvert[index];
+ Mesh *me = ob->data;
+ MDeformVert *dv = &me->dvert[index];
MDeformWeight *dw, *dw_prev;
@@ -1757,16 +1751,16 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
const short do_multipaint_totsel = (wpi->do_multipaint && wpi->defbase_tot_sel > 1);
- if(wp->flag & VP_ONLYVGROUP) {
- dw= defvert_find_index(dv, wpi->vgroup_active);
- dw_prev= defvert_find_index(wp->wpaint_prev+index, wpi->vgroup_active);
+ if (wp->flag & VP_ONLYVGROUP) {
+ dw = defvert_find_index(dv, wpi->vgroup_active);
+ dw_prev = defvert_find_index(wp->wpaint_prev + index, wpi->vgroup_active);
}
else {
- dw= defvert_verify_index(dv, wpi->vgroup_active);
- dw_prev= defvert_verify_index(wp->wpaint_prev+index, wpi->vgroup_active);
+ dw = defvert_verify_index(dv, wpi->vgroup_active);
+ dw_prev = defvert_verify_index(wp->wpaint_prev + index, wpi->vgroup_active);
}
- if(dw==NULL || dw_prev==NULL) {
+ if (dw == NULL || dw_prev == NULL) {
return;
}
@@ -1836,7 +1830,7 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
* can give wrong results [#26193], least confusing if normalize is done last */
/* apply mirror */
- if(index_mirr != -1) {
+ if (index_mirr != -1) {
/* copy, not paint again */
dw_mirr->weight = dw->weight;
}
@@ -1887,12 +1881,12 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
/* use locks and/or multipaint */
float oldw;
float neww;
- float testw=0;
+ float testw = 0;
float change = 0;
float oldChange = 0;
int i;
MDeformWeight *tdw = NULL, *tdw_prev;
- MDeformVert dv_copy= {NULL};
+ MDeformVert dv_copy = {NULL};
oldw = dw->weight;
neww = wpaint_blend(wp, dw->weight, dw_prev->weight, alpha, paintweight,
@@ -1900,16 +1894,16 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
/* setup multi-paint */
if (do_multipaint_totsel) {
- dv_copy.dw= MEM_dupallocN(dv->dw);
+ dv_copy.dw = MEM_dupallocN(dv->dw);
dv_copy.flag = dv->flag;
dv_copy.totweight = dv->totweight;
tdw = dw;
tdw_prev = dw_prev;
change = get_mp_change(&wp->wpaint_prev[index], wpi->defbase_tot, wpi->defbase_sel, neww - oldw);
- if(change) {
- if(!tdw->weight) {
+ if (change) {
+ if (!tdw->weight) {
i = get_first_selected_nonzero_weight(dv, wpi->defbase_tot, wpi->defbase_sel);
- if(i>=0) {
+ if (i >= 0) {
tdw = &(dv->dw[i]);
tdw_prev = defvert_verify_index(&wp->wpaint_prev[index], tdw->def_nr);
}
@@ -1917,14 +1911,14 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
change = 0;
}
}
- if(change && tdw_prev->weight && tdw_prev->weight * change) {
- if(tdw->weight != tdw_prev->weight) {
- oldChange = tdw->weight/tdw_prev->weight;
- testw = tdw_prev->weight*change;
- if( testw > tdw_prev->weight ) {
- if(change > oldChange) {
+ if (change && tdw_prev->weight && tdw_prev->weight * change) {
+ if (tdw->weight != tdw_prev->weight) {
+ oldChange = tdw->weight / tdw_prev->weight;
+ testw = tdw_prev->weight * change;
+ if ( testw > tdw_prev->weight ) {
+ if (change > oldChange) {
/* reset the weights and use the new change */
- defvert_reset_to_prev(wp->wpaint_prev+index, dv);
+ defvert_reset_to_prev(wp->wpaint_prev + index, dv);
}
else {
/* the old change was more significant, so set
@@ -1933,8 +1927,8 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
}
}
else {
- if(change < oldChange) {
- defvert_reset_to_prev(wp->wpaint_prev+index, dv);
+ if (change < oldChange) {
+ defvert_reset_to_prev(wp->wpaint_prev + index, dv);
}
else {
change = 0;
@@ -1948,12 +1942,12 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
}
}
- if(apply_mp_locks_normalize(me, wpi, index, dw, tdw, change, oldChange, oldw, neww)) {
+ if (apply_mp_locks_normalize(me, wpi, index, dw, tdw, change, oldChange, oldw, neww)) {
defvert_reset_to_prev(&dv_copy, dv);
change = 0;
oldChange = 0;
}
- if(dv_copy.dw) {
+ if (dv_copy.dw) {
MEM_freeN(dv_copy.dw);
}
#if 0
@@ -1966,7 +1960,7 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
#endif
/* x mirror painting */
- if(index_mirr != -1) {
+ if (index_mirr != -1) {
/* copy, not paint again */
/* dw_mirr->weight = dw->weight; */ /* TODO, explain the logic in not assigning weight! - campbell */
@@ -1980,15 +1974,15 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */
{
- Object *ob= CTX_data_active_object(C);
- Scene *scene= CTX_data_scene(C);
- VPaint *wp= scene->toolsettings->wpaint;
+ Object *ob = CTX_data_active_object(C);
+ Scene *scene = CTX_data_scene(C);
+ VPaint *wp = scene->toolsettings->wpaint;
Mesh *me;
- me= get_mesh(ob);
- if(ob->id.lib || me==NULL) return OPERATOR_PASS_THROUGH;
+ me = get_mesh(ob);
+ if (ob->id.lib || me == NULL) return OPERATOR_PASS_THROUGH;
- if(ob->mode & OB_MODE_WEIGHT_PAINT) ob->mode &= ~OB_MODE_WEIGHT_PAINT;
+ if (ob->mode & OB_MODE_WEIGHT_PAINT) ob->mode &= ~OB_MODE_WEIGHT_PAINT;
else ob->mode |= OB_MODE_WEIGHT_PAINT;
@@ -1999,11 +1993,11 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */
*/
DAG_id_tag_update(&me->id, 0);
- if(ob->mode & OB_MODE_WEIGHT_PAINT) {
+ if (ob->mode & OB_MODE_WEIGHT_PAINT) {
Object *par;
- if(wp==NULL)
- wp= scene->toolsettings->wpaint= new_vpaint(1);
+ if (wp == NULL)
+ wp = scene->toolsettings->wpaint = new_vpaint(1);
paint_init(&wp->paint, PAINT_CURSOR_WEIGHT_PAINT);
paint_cursor_start(C, weight_paint_poll);
@@ -2011,11 +2005,11 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */
mesh_octree_table(ob, NULL, NULL, 's');
/* verify if active weight group is also active bone */
- par= modifiers_isDeformedByArmature(ob);
- if(par && (par->mode & OB_MODE_POSE)) {
- bArmature *arm= par->data;
+ par = modifiers_isDeformedByArmature(ob);
+ if (par && (par->mode & OB_MODE_POSE)) {
+ bArmature *arm = par->data;
- if(arm->act_bone)
+ if (arm->act_bone)
ED_vgroup_select_by_name(ob, arm->act_bone->name);
}
}
@@ -2032,12 +2026,12 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */
/* for switching to/from mode */
static int paint_poll_test(bContext *C)
{
- Object *ob= CTX_data_active_object(C);
- if(CTX_data_edit_object(C))
+ Object *ob = CTX_data_active_object(C);
+ if (CTX_data_edit_object(C))
return 0;
- if(CTX_data_active_object(C)==NULL)
+ if (CTX_data_active_object(C) == NULL)
return 0;
- if(!ob->data || ((ID *)ob->data)->lib)
+ if (!ob->data || ((ID *)ob->data)->lib)
return 0;
return 1;
}
@@ -2046,15 +2040,15 @@ void PAINT_OT_weight_paint_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Weight Paint Mode";
- ot->idname= "PAINT_OT_weight_paint_toggle";
+ ot->name = "Weight Paint Mode";
+ ot->idname = "PAINT_OT_weight_paint_toggle";
/* api callbacks */
- ot->exec= set_wpaint;
- ot->poll= paint_poll_test;
+ ot->exec = set_wpaint;
+ ot->poll = paint_poll_test;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -2068,8 +2062,8 @@ struct WPaintData {
float *vertexcosnos;
float wpimat[3][3];
- /*variables for auto normalize*/
- const char *vgroup_validmap; /*stores if vgroups tie to deforming bones or not*/
+ /* variables for auto normalize */
+ const char *vgroup_validmap; /* stores if vgroups tie to deforming bones or not */
const char *lock_flags;
int defbase_tot;
};
@@ -2080,32 +2074,32 @@ static char *wpaint_make_validmap(Object *ob)
ModifierData *md;
char *vgroup_validmap;
GHash *gh;
- int i, step1=1;
+ int i, step1 = 1;
- if(ob->defbase.first == NULL) {
+ if (ob->defbase.first == NULL) {
return NULL;
}
- gh= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wpaint_make_validmap gh");
+ gh = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wpaint_make_validmap gh");
- /*add all names to a hash table*/
- for (dg=ob->defbase.first; dg; dg=dg->next) {
+ /* add all names to a hash table */
+ for (dg = ob->defbase.first; dg; dg = dg->next) {
BLI_ghash_insert(gh, dg->name, NULL);
}
- /*now loop through the armature modifiers and identify deform bones*/
- for (md = ob->modifiers.first; md; md= !md->next && step1 ? (step1=0), modifiers_getVirtualModifierList(ob) : md->next) {
+ /* now loop through the armature modifiers and identify deform bones */
+ for (md = ob->modifiers.first; md; md = !md->next && step1 ? (step1 = 0), modifiers_getVirtualModifierList(ob) : md->next) {
if (!(md->mode & (eModifierMode_Realtime|eModifierMode_Virtual)))
continue;
if (md->type == eModifierType_Armature) {
- ArmatureModifierData *amd= (ArmatureModifierData*) md;
+ ArmatureModifierData *amd = (ArmatureModifierData *) md;
- if(amd->object && amd->object->pose) {
- bPose *pose= amd->object->pose;
+ if (amd->object && amd->object->pose) {
+ bPose *pose = amd->object->pose;
bPoseChannel *chan;
- for (chan=pose->chanbase.first; chan; chan=chan->next) {
+ for (chan = pose->chanbase.first; chan; chan = chan->next) {
if (chan->bone->flag & BONE_NO_DEFORM)
continue;
@@ -2118,11 +2112,11 @@ static char *wpaint_make_validmap(Object *ob)
}
}
- vgroup_validmap= MEM_mallocN(BLI_ghash_size(gh), "wpaint valid map");
+ vgroup_validmap = MEM_mallocN(BLI_ghash_size(gh), "wpaint valid map");
- /*add all names to a hash table*/
- for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) {
- vgroup_validmap[i]= (BLI_ghash_lookup(gh, dg->name) != NULL);
+ /* add all names to a hash table */
+ for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) {
+ vgroup_validmap[i] = (BLI_ghash_lookup(gh, dg->name) != NULL);
}
BLI_assert(i == BLI_ghash_size(gh));
@@ -2134,23 +2128,23 @@ static char *wpaint_make_validmap(Object *ob)
static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
struct PaintStroke *stroke = op->customdata;
- ToolSettings *ts= scene->toolsettings;
- VPaint *wp= ts->wpaint;
- Object *ob= CTX_data_active_object(C);
+ ToolSettings *ts = scene->toolsettings;
+ VPaint *wp = ts->wpaint;
+ Object *ob = CTX_data_active_object(C);
struct WPaintData *wpd;
Mesh *me;
bDeformGroup *dg;
float mat[4][4], imat[4][4];
- if(scene->obedit) {
+ if (scene->obedit) {
return FALSE;
}
- me= get_mesh(ob);
- if(me==NULL || me->totpoly==0) return OPERATOR_PASS_THROUGH;
+ me = get_mesh(ob);
+ if (me == NULL || me->totpoly == 0) return OPERATOR_PASS_THROUGH;
/* if nothing was added yet, we make dverts and a vertex deform group */
if (!me->dvert) {
@@ -2161,30 +2155,30 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
/* this happens on a Bone select, when no vgroup existed yet */
if (ob->actdef <= 0) {
Object *modob;
- if((modob = modifiers_isDeformedByArmature(ob))) {
- Bone *actbone= ((bArmature *)modob->data)->act_bone;
- if(actbone) {
- bPoseChannel *pchan= get_pose_channel(modob->pose, actbone->name);
-
- if(pchan) {
- bDeformGroup *dg= defgroup_find_name(ob, pchan->name);
- if(dg==NULL) {
- dg= ED_vgroup_add_name(ob, pchan->name); /* sets actdef */
+ if ((modob = modifiers_isDeformedByArmature(ob))) {
+ Bone *actbone = ((bArmature *)modob->data)->act_bone;
+ if (actbone) {
+ bPoseChannel *pchan = get_pose_channel(modob->pose, actbone->name);
+
+ if (pchan) {
+ bDeformGroup *dg = defgroup_find_name(ob, pchan->name);
+ if (dg == NULL) {
+ dg = ED_vgroup_add_name(ob, pchan->name); /* sets actdef */
}
else {
int actdef = 1 + BLI_findindex(&ob->defbase, dg);
BLI_assert(actdef >= 0);
- ob->actdef= actdef;
+ ob->actdef = actdef;
}
}
}
}
}
- if(ob->defbase.first==NULL) {
+ if (ob->defbase.first == NULL) {
ED_vgroup_add(ob);
}
- /* ensure we dont try paint onto an invalid group */
+ /* ensure we don't try paint onto an invalid group */
if (ob->actdef <= 0) {
BKE_report(op->reports, RPT_WARNING, "No active vertex group for painting, aborting");
return FALSE;
@@ -2192,7 +2186,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
/* check if we are attempting to paint onto a locked vertex group,
* and other options disallow it from doing anything useful */
- dg = BLI_findlink(&ob->defbase, (ob->actdef-1));
+ dg = BLI_findlink(&ob->defbase, (ob->actdef - 1));
if (dg->flag & DG_LOCK_WEIGHT) {
BKE_report(op->reports, RPT_WARNING, "Active group is locked, aborting");
return FALSE;
@@ -2200,7 +2194,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
/* ALLOCATIONS! no return after this line */
/* make mode data storage */
- wpd= MEM_callocN(sizeof(struct WPaintData), "WPaintData");
+ wpd = MEM_callocN(sizeof(struct WPaintData), "WPaintData");
paint_stroke_set_mode_data(stroke, wpd);
view3d_set_viewcontext(C, &wpd->vc);
@@ -2208,7 +2202,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
wpd->vgroup_mirror = -1;
/* set up auto-normalize, and generate map for detecting which
- * vgroups affect deform bones*/
+ * vgroups affect deform bones */
wpd->defbase_tot = BLI_countlist(&ob->defbase);
wpd->lock_flags = gen_lock_flags(ob, wpd->defbase_tot);
if (ts->auto_normalize || ts->multipaint || wpd->lock_flags) {
@@ -2216,8 +2210,8 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
}
/* painting on subsurfs should give correct points too, this returns me->totvert amount */
- wpd->vertexcosnos= mesh_get_mapped_verts_nors(scene, ob);
- wpd->indexar= get_indexarray(me);
+ wpd->vertexcosnos = mesh_get_mapped_verts_nors(scene, ob);
+ wpd->indexar = get_indexarray(me);
copy_wpaint_prev(wp, me->dvert, me->totvert);
/* imat for normals */
@@ -2226,7 +2220,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
copy_m3_m4(wpd->wpimat, imat);
/* if mirror painting, find the other group */
- if(me->editflag & ME_EDIT_MIRROR_X) {
+ if (me->editflag & ME_EDIT_MIRROR_X) {
wpd->vgroup_mirror = wpaint_mirror_vgroup_ensure(ob, wpd->vgroup_active);
}
@@ -2235,11 +2229,11 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr)
{
- Scene *scene= CTX_data_scene(C);
- ToolSettings *ts= CTX_data_tool_settings(C);
- VPaint *wp= ts->wpaint;
+ Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ VPaint *wp = ts->wpaint;
Brush *brush = paint_brush(&wp->paint);
- struct WPaintData *wpd= paint_stroke_mode_data(stroke);
+ struct WPaintData *wpd = paint_stroke_mode_data(stroke);
ViewContext *vc;
Object *ob;
Mesh *me;
@@ -2258,7 +2252,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
const float brush_alpha_value = brush_alpha(scene, brush);
const float brush_alpha_pressure = brush_alpha_value * (brush_use_alpha_pressure(scene, brush) ? pressure : 1.0f);
- /* intentionally dont initialize as NULL, make sure we initialize all members below */
+ /* intentionally don't initialize as NULL, make sure we initialize all members below */
WeightPaintInfo wpi;
/* cannot paint if there is no stroke data */
@@ -2269,10 +2263,10 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
return;
}
- vc= &wpd->vc;
- ob= vc->obact;
- me= ob->data;
- indexar= wpd->indexar;
+ vc = &wpd->vc;
+ ob = vc->obact;
+ me = ob->data;
+ indexar = wpd->indexar;
view3d_operator_needs_opengl(C);
@@ -2280,93 +2274,93 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
mult_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat);
RNA_float_get_array(itemptr, "mouse", mval);
- mval[0]-= vc->ar->winrct.xmin;
- mval[1]-= vc->ar->winrct.ymin;
+ mval[0] -= vc->ar->winrct.xmin;
+ mval[1] -= vc->ar->winrct.ymin;
/* *** setup WeightPaintInfo - pass onto do_weight_paint_vertex *** */
- wpi.defbase_tot= wpd->defbase_tot;
- defbase_sel= MEM_mallocN(wpi.defbase_tot*sizeof(char), "wpi.defbase_sel");
- wpi.defbase_tot_sel= get_selected_defgroups(ob, defbase_sel, wpi.defbase_tot);
- wpi.defbase_sel= defbase_sel; /* so we can stay const */
- if(wpi.defbase_tot_sel == 0 && ob->actdef > 0) wpi.defbase_tot_sel = 1;
-
- wpi.defbase_tot_unsel= wpi.defbase_tot - wpi.defbase_tot_sel;
- wpi.vgroup_active= wpd->vgroup_active;
- wpi.vgroup_mirror= wpd->vgroup_mirror;
- wpi.lock_flags= wpd->lock_flags;
- wpi.vgroup_validmap= wpd->vgroup_validmap;
- wpi.do_flip= RNA_boolean_get(itemptr, "pen_flip");
- wpi.do_multipaint= (ts->multipaint != 0);
- wpi.do_auto_normalize= ((ts->auto_normalize != 0) && (wpi.vgroup_validmap != NULL));
- wpi.brush_alpha_value= brush_alpha_value;
+ wpi.defbase_tot = wpd->defbase_tot;
+ defbase_sel = MEM_mallocN(wpi.defbase_tot * sizeof(char), "wpi.defbase_sel");
+ wpi.defbase_tot_sel = get_selected_defgroups(ob, defbase_sel, wpi.defbase_tot);
+ wpi.defbase_sel = defbase_sel; /* so we can stay const */
+ if (wpi.defbase_tot_sel == 0 && ob->actdef > 0) wpi.defbase_tot_sel = 1;
+
+ wpi.defbase_tot_unsel = wpi.defbase_tot - wpi.defbase_tot_sel;
+ wpi.vgroup_active = wpd->vgroup_active;
+ wpi.vgroup_mirror = wpd->vgroup_mirror;
+ wpi.lock_flags = wpd->lock_flags;
+ wpi.vgroup_validmap = wpd->vgroup_validmap;
+ wpi.do_flip = RNA_boolean_get(itemptr, "pen_flip");
+ wpi.do_multipaint = (ts->multipaint != 0);
+ wpi.do_auto_normalize = ((ts->auto_normalize != 0) && (wpi.vgroup_validmap != NULL));
+ wpi.brush_alpha_value = brush_alpha_value;
/* *** done setting up WeightPaintInfo *** */
swap_m4m4(wpd->vc.rv3d->persmat, mat);
- use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+ use_vert_sel = (me->editflag & ME_EDIT_VERT_SEL) != 0;
/* which faces are involved */
- if(wp->flag & VP_AREA) {
+ if (wp->flag & VP_AREA) {
/* Ugly hack, to avoid drawing vertex index when getting the face index buffer - campbell */
me->editflag &= ~ME_EDIT_VERT_SEL;
- totindex= sample_backbuf_area(vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure);
+ totindex = sample_backbuf_area(vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure);
me->editflag |= use_vert_sel ? ME_EDIT_VERT_SEL : 0;
}
else {
- indexar[0]= view3d_sample_backbuf(vc, mval[0], mval[1]);
- if(indexar[0]) totindex= 1;
- else totindex= 0;
+ indexar[0] = view3d_sample_backbuf(vc, mval[0], mval[1]);
+ if (indexar[0]) totindex = 1;
+ else totindex = 0;
}
- if(wp->flag & VP_COLINDEX) {
- for(index=0; index<totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totpoly) {
- MPoly *mpoly= ((MPoly *)me->mpoly) + (indexar[index]-1);
+ if (wp->flag & VP_COLINDEX) {
+ for (index = 0; index < totindex; index++) {
+ if (indexar[index] && indexar[index] <= me->totpoly) {
+ MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1);
- if(mpoly->mat_nr!=ob->actcol-1) {
- indexar[index]= 0;
+ if (mpoly->mat_nr != ob->actcol - 1) {
+ indexar[index] = 0;
}
}
}
}
- if((me->editflag & ME_EDIT_PAINT_MASK) && me->mpoly) {
- for(index=0; index<totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totpoly) {
- MPoly *mpoly= ((MPoly *)me->mpoly) + (indexar[index]-1);
+ if ((me->editflag & ME_EDIT_PAINT_MASK) && me->mpoly) {
+ for (index = 0; index < totindex; index++) {
+ if (indexar[index] && indexar[index] <= me->totpoly) {
+ MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1);
- if((mpoly->flag & ME_FACE_SEL)==0) {
- indexar[index]= 0;
+ if ((mpoly->flag & ME_FACE_SEL) == 0) {
+ indexar[index] = 0;
}
- }
+ }
}
}
-
+
/* make sure each vertex gets treated only once */
/* and calculate filter weight */
- totw= 0.0f;
+ totw = 0.0f;
if (brush->vertexpaint_tool == PAINT_BLEND_BLUR)
- paintweight= 0.0f;
+ paintweight = 0.0f;
else
- paintweight= ts->vgroup_weight;
+ paintweight = ts->vgroup_weight;
- for(index=0; index<totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totpoly) {
- MPoly *mpoly= me->mpoly + (indexar[index]-1);
+ for (index = 0; index < totindex; index++) {
+ if (indexar[index] && indexar[index] <= me->totpoly) {
+ MPoly *mpoly = me->mpoly + (indexar[index] - 1);
MLoop *ml = me->mloop + mpoly->loopstart;
int i;
- if(use_vert_sel) {
- for (i=0; i<mpoly->totloop; i++, ml++) {
+ if (use_vert_sel) {
+ for (i = 0; i < mpoly->totloop; i++, ml++) {
me->dvert[ml->v].flag = (me->mvert[ml->v].flag & SELECT);
}
}
else {
- for (i=0; i<mpoly->totloop; i++, ml++) {
+ for (i = 0; i < mpoly->totloop; i++, ml++) {
me->dvert[ml->v].flag = 1;
}
}
@@ -2374,15 +2368,15 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
MDeformWeight *dw, *(*dw_func)(MDeformVert *, const int);
- if(wp->flag & VP_ONLYVGROUP)
- dw_func= (MDeformWeight *(*)(MDeformVert *, const int))defvert_find_index;
+ if (wp->flag & VP_ONLYVGROUP)
+ dw_func = (MDeformWeight *(*)(MDeformVert *, const int))defvert_find_index;
else
- dw_func= defvert_verify_index;
+ dw_func = defvert_verify_index;
ml = me->mloop + mpoly->loopstart;
- for (i=0; i<mpoly->totloop; i++, ml++) {
- unsigned int vidx= ml->v;
- const float fac = calc_vp_strength_dl(wp, vc, wpd->vertexcosnos+6*vidx, mval, brush_size_pressure);
+ for (i = 0; i < mpoly->totloop; i++, ml++) {
+ unsigned int vidx = ml->v;
+ const float fac = calc_vp_strength_dl(wp, vc, wpd->vertexcosnos + 6 * vidx, mval, brush_size_pressure);
if (fac > 0.0f) {
dw = dw_func(&me->dvert[vidx], wpi.vgroup_active);
paintweight += dw ? (dw->weight * fac) : 0.0f;
@@ -2397,23 +2391,23 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
paintweight /= totw;
}
- for(index=0; index<totindex; index++) {
+ for (index = 0; index < totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totpoly) {
- MPoly *mpoly= me->mpoly + (indexar[index]-1);
- MLoop *ml=me->mloop+mpoly->loopstart;
+ if (indexar[index] && indexar[index] <= me->totpoly) {
+ MPoly *mpoly = me->mpoly + (indexar[index] - 1);
+ MLoop *ml = me->mloop + mpoly->loopstart;
int i;
- for (i=0; i<mpoly->totloop; i++, ml++) {
- unsigned int vidx= ml->v;
+ for (i = 0; i < mpoly->totloop; i++, ml++) {
+ unsigned int vidx = ml->v;
if (me->dvert[vidx].flag) {
- alpha= calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos+6*vidx,
+ alpha = calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos + 6 * vidx,
mval, brush_size_pressure, brush_alpha_pressure);
- if(alpha) {
+ if (alpha) {
do_weight_paint_vertex(wp, ob, &wpi, vidx, alpha, paintweight);
}
- me->dvert[vidx].flag= 0;
+ me->dvert[vidx].flag = 0;
}
}
}
@@ -2422,7 +2416,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
/* *** free wpi members */
MEM_freeN((void *)wpi.defbase_sel);
- /* *** dont freeing wpi members */
+ /* *** don't freeing wpi members */
swap_m4m4(vc->rv3d->persmat, mat);
@@ -2433,18 +2427,18 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
static void wpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
{
- ToolSettings *ts= CTX_data_tool_settings(C);
- Object *ob= CTX_data_active_object(C);
- struct WPaintData *wpd= paint_stroke_mode_data(stroke);
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ Object *ob = CTX_data_active_object(C);
+ struct WPaintData *wpd = paint_stroke_mode_data(stroke);
- if(wpd) {
- if(wpd->vertexcosnos)
+ if (wpd) {
+ if (wpd->vertexcosnos)
MEM_freeN(wpd->vertexcosnos);
MEM_freeN(wpd->indexar);
if (wpd->vgroup_validmap)
MEM_freeN((void *)wpd->vgroup_validmap);
- if(wpd->lock_flags)
+ if (wpd->lock_flags)
MEM_freeN((void *)wpd->lock_flags);
MEM_freeN(wpd);
@@ -2454,13 +2448,13 @@ static void wpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
copy_wpaint_prev(ts->wpaint, NULL, 0);
/* and particles too */
- if(ob->particlesystem.first) {
+ if (ob->particlesystem.first) {
ParticleSystem *psys;
int i;
- for(psys= ob->particlesystem.first; psys; psys= psys->next) {
- for(i=0; i<PSYS_TOT_VG; i++) {
- if(psys->vgroup[i]==ob->actdef) {
+ for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+ for (i = 0; i < PSYS_TOT_VG; i++) {
+ if (psys->vgroup[i] == ob->actdef) {
psys->recalc |= PSYS_RECALC_RESET;
break;
}
@@ -2498,25 +2492,25 @@ void PAINT_OT_weight_paint(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Weight Paint";
- ot->idname= "PAINT_OT_weight_paint";
+ ot->name = "Weight Paint";
+ ot->idname = "PAINT_OT_weight_paint";
/* api callbacks */
- ot->invoke= wpaint_invoke;
- ot->modal= paint_stroke_modal;
- /* ot->exec= vpaint_exec; <-- needs stroke property */
- ot->poll= weight_paint_poll;
- ot->cancel= wpaint_cancel;
+ ot->invoke = wpaint_invoke;
+ ot->modal = paint_stroke_modal;
+ /* ot->exec = vpaint_exec; <-- needs stroke property */
+ ot->poll = weight_paint_poll;
+ ot->cancel = wpaint_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
}
static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op))
{
- struct Scene *scene= CTX_data_scene(C);
+ struct Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
wpaint_fill(scene->toolsettings->wpaint, obact, scene->toolsettings->vgroup_weight);
@@ -2527,15 +2521,15 @@ static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op))
void PAINT_OT_weight_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Weight";
- ot->idname= "PAINT_OT_weight_set";
+ ot->name = "Set Weight";
+ ot->idname = "PAINT_OT_weight_set";
/* api callbacks */
- ot->exec= weight_paint_set_exec;
- ot->poll= mask_paint_poll; /* it was facemask_paint_poll */
+ ot->exec = weight_paint_set_exec;
+ ot->poll = mask_paint_poll; /* it was facemask_paint_poll */
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************ set / clear vertex paint mode ********** */
@@ -2543,22 +2537,24 @@ void PAINT_OT_weight_set(wmOperatorType *ot)
static int set_vpaint(bContext *C, wmOperator *op) /* toggle */
{
- Object *ob= CTX_data_active_object(C);
- Scene *scene= CTX_data_scene(C);
- VPaint *vp= scene->toolsettings->vpaint;
+ Object *ob = CTX_data_active_object(C);
+ Scene *scene = CTX_data_scene(C);
+ VPaint *vp = scene->toolsettings->vpaint;
Mesh *me;
- me= get_mesh(ob);
+ me = get_mesh(ob);
- if(me==NULL || object_data_is_libdata(ob)) {
+ if (me == NULL || object_data_is_libdata(ob)) {
ob->mode &= ~OB_MODE_VERTEX_PAINT;
return OPERATOR_PASS_THROUGH;
}
- if(me && me->mloopcol==NULL) make_vertexcol(ob);
+ if (me && me->mloopcol == NULL) {
+ make_vertexcol(ob);
+ }
/* toggle: end vpaint */
- if(ob->mode & OB_MODE_VERTEX_PAINT) {
+ if (ob->mode & OB_MODE_VERTEX_PAINT) {
ob->mode &= ~OB_MODE_VERTEX_PAINT;
}
@@ -2568,8 +2564,8 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */
if (ob->mode & OB_MODE_WEIGHT_PAINT)
set_wpaint(C, op);
- if(vp==NULL)
- vp= scene->toolsettings->vpaint= new_vpaint(0);
+ if (vp == NULL)
+ vp = scene->toolsettings->vpaint = new_vpaint(0);
paint_cursor_start(C, vertex_paint_poll);
@@ -2589,15 +2585,15 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Vertex Paint Mode";
- ot->idname= "PAINT_OT_vertex_paint_toggle";
+ ot->name = "Vertex Paint Mode";
+ ot->idname = "PAINT_OT_vertex_paint_toggle";
/* api callbacks */
- ot->exec= set_vpaint;
- ot->poll= paint_poll_test;
+ ot->exec = set_vpaint;
+ ot->poll = paint_poll_test;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -2638,7 +2634,7 @@ typedef struct VPaintData {
* otherwise we need to refresh the modifier stack */
int use_fast_update;
- /*mpoly -> mface mapping*/
+ /* mpoly -> mface mapping */
MemArena *polyfacemap_arena;
ListBase *polyfacemap;
} VPaintData;
@@ -2650,10 +2646,10 @@ static void vpaint_build_poly_facemap(struct VPaintData *vd, Mesh *me)
int *origIndex;
int i;
- vd->polyfacemap_arena = BLI_memarena_new(1<<13, "vpaint tmp");
+ vd->polyfacemap_arena = BLI_memarena_new(1 << 13, "vpaint tmp");
BLI_memarena_use_calloc(vd->polyfacemap_arena);
- vd->polyfacemap = BLI_memarena_alloc(vd->polyfacemap_arena, sizeof(ListBase)*me->totpoly);
+ vd->polyfacemap = BLI_memarena_alloc(vd->polyfacemap_arena, sizeof(ListBase) * me->totpoly);
origIndex = CustomData_get_layer(&me->fdata, CD_POLYINDEX);
mf = me->mface;
@@ -2661,7 +2657,7 @@ static void vpaint_build_poly_facemap(struct VPaintData *vd, Mesh *me)
if (!origIndex)
return;
- for (i=0; i<me->totface; i++, mf++, origIndex++) {
+ for (i = 0; i < me->totface; i++, mf++, origIndex++) {
if (*origIndex == ORIGINDEX_NONE)
continue;
@@ -2674,32 +2670,32 @@ static void vpaint_build_poly_facemap(struct VPaintData *vd, Mesh *me)
static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent *UNUSED(event))
{
- ToolSettings *ts= CTX_data_tool_settings(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
struct PaintStroke *stroke = op->customdata;
- VPaint *vp= ts->vpaint;
+ VPaint *vp = ts->vpaint;
struct VPaintData *vpd;
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
Mesh *me;
float mat[4][4], imat[4][4];
/* context checks could be a poll() */
- me= get_mesh(ob);
- if(me==NULL || me->totpoly==0)
+ me = get_mesh(ob);
+ if (me == NULL || me->totpoly == 0)
return OPERATOR_PASS_THROUGH;
- if(me->mloopcol==NULL)
+ if (me->mloopcol == NULL)
make_vertexcol(ob);
- if(me->mloopcol==NULL)
+ if (me->mloopcol == NULL)
return OPERATOR_CANCELLED;
/* make mode data storage */
- vpd= MEM_callocN(sizeof(struct VPaintData), "VPaintData");
+ vpd = MEM_callocN(sizeof(struct VPaintData), "VPaintData");
paint_stroke_set_mode_data(stroke, vpd);
view3d_set_viewcontext(C, &vpd->vc);
- vpd->vertexcosnos= mesh_get_mapped_verts_nors(vpd->vc.scene, ob);
- vpd->indexar= get_indexarray(me);
- vpd->paintcol= vpaint_get_current_col(vp);
+ vpd->vertexcosnos = mesh_get_mapped_verts_nors(vpd->vc.scene, ob);
+ vpd->indexar = get_indexarray(me);
+ vpd->paintcol = vpaint_get_current_col(vp);
/* are we painting onto a modified mesh?,
@@ -2732,36 +2728,36 @@ static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob,
ViewContext *vc = &vpd->vc;
Brush *brush = paint_brush(&vp->paint);
Mesh *me = get_mesh(ob);
- MFace *mface= &me->mface[index];
- unsigned int *mcol= ((unsigned int*)me->mcol) + 4*index;
- unsigned int *mcolorig= ((unsigned int*)vp->vpaint_prev) + 4*index;
+ MFace *mface = &me->mface[index];
+ unsigned int *mcol = ((unsigned int *)me->mcol) + 4 * index;
+ unsigned int *mcolorig = ((unsigned int *)vp->vpaint_prev) + 4 * index;
float alpha;
int i;
int brush_alpha_pressure_i;
- if((vp->flag & VP_COLINDEX && mface->mat_nr!=ob->actcol-1) ||
+ if ((vp->flag & VP_COLINDEX && mface->mat_nr != ob->actcol - 1) ||
((me->editflag & ME_EDIT_PAINT_MASK) && !(mface->flag & ME_FACE_SEL)))
return;
if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
- unsigned int fcol1= mcol_blend( mcol[0], mcol[1], 128);
- if(mface->v4) {
- unsigned int fcol2= mcol_blend( mcol[2], mcol[3], 128);
- vpd->paintcol= mcol_blend( fcol1, fcol2, 128);
+ unsigned int fcol1 = mcol_blend( mcol[0], mcol[1], 128);
+ if (mface->v4) {
+ unsigned int fcol2 = mcol_blend( mcol[2], mcol[3], 128);
+ vpd->paintcol = mcol_blend( fcol1, fcol2, 128);
}
else {
- vpd->paintcol= mcol_blend( mcol[2], fcol1, 170);
+ vpd->paintcol = mcol_blend( mcol[2], fcol1, 170);
}
}
- brush_alpha_pressure_i = (int)(brush_alpha_pressure*255.0f);
+ brush_alpha_pressure_i = (int)(brush_alpha_pressure * 255.0f);
- for(i = 0; i < (mface->v4 ? 4 : 3); ++i) {
- alpha = calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*(&mface->v1)[i],
+ for (i = 0; i < (mface->v4 ? 4 : 3); ++i) {
+ alpha = calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos + 6 * (&mface->v1)[i],
mval, brush_size_pressure, brush_alpha_pressure);
if (alpha) {
- const int alpha_i = (int)(alpha*255.0f);
+ const int alpha_i = (int)(alpha * 255.0f);
mcol[i] = vpaint_blend(vp, mcol[i], mcolorig[i], vpd->paintcol, alpha_i, brush_alpha_pressure_i);
}
}
@@ -2779,25 +2775,25 @@ static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Object *ob,
ViewContext *vc = &vpd->vc;
Brush *brush = paint_brush(&vp->paint);
Mesh *me = get_mesh(ob);
- MPoly *mpoly= &me->mpoly[index];
+ MPoly *mpoly = &me->mpoly[index];
MFace *mf;
MCol *mc;
MLoop *ml;
MLoopCol *mlc;
polyfacemap_e *e;
- unsigned int *lcol = ((unsigned int*)me->mloopcol) + mpoly->loopstart;
- unsigned int *lcolorig = ((unsigned int*)vp->vpaint_prev) + mpoly->loopstart;
+ unsigned int *lcol = ((unsigned int *)me->mloopcol) + mpoly->loopstart;
+ unsigned int *lcolorig = ((unsigned int *)vp->vpaint_prev) + mpoly->loopstart;
float alpha;
int i, j;
- int brush_alpha_pressure_i = (int)(brush_alpha_pressure*255.0f);
+ int brush_alpha_pressure_i = (int)(brush_alpha_pressure * 255.0f);
- if(brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
+ if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
unsigned int blend[4] = {0};
unsigned int tcol;
char *col;
- for (j=0; j<mpoly->totloop; j++) {
+ for (j = 0; j < mpoly->totloop; j++) {
col = (char *)(lcol + j);
blend[0] += col[0];
blend[1] += col[1];
@@ -2819,12 +2815,12 @@ static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Object *ob,
}
ml = me->mloop + mpoly->loopstart;
- for (i=0; i<mpoly->totloop; i++, ml++) {
- alpha= calc_vp_alpha_dl(vp, vc, vpd->vpimat,
- vpd->vertexcosnos+6*ml->v, mval,
- brush_size_pressure, brush_alpha_pressure);
- if(alpha > 0.0f) {
- const int alpha_i = (int)(alpha*255.0f);
+ for (i = 0; i < mpoly->totloop; i++, ml++) {
+ alpha = calc_vp_alpha_dl(vp, vc, vpd->vpimat,
+ vpd->vertexcosnos + 6 * ml->v, mval,
+ brush_size_pressure, brush_alpha_pressure);
+ if (alpha > 0.0f) {
+ const int alpha_i = (int)(alpha * 255.0f);
lcol[i] = vpaint_blend(vp, lcol[i], lcolorig[i], vpd->paintcol, alpha_i, brush_alpha_pressure_i);
}
}
@@ -2840,19 +2836,19 @@ static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Object *ob,
* rather then regenerating the tessellation altogether */
for (e = vpd->polyfacemap[index].first; e; e = e->next) {
mf = me->mface + e->facenr;
- mc = me->mcol + e->facenr*4;
+ mc = me->mcol + e->facenr * 4;
ml = me->mloop + mpoly->loopstart;
mlc = me->mloopcol + mpoly->loopstart;
- for (j=0; j<mpoly->totloop; j++, ml++, mlc++) {
+ for (j = 0; j < mpoly->totloop; j++, ml++, mlc++) {
if (ml->v == mf->v1)
CPYCOL(mc, mlc);
else if (ml->v == mf->v2)
- CPYCOL(mc+1, mlc);
+ CPYCOL(mc + 1, mlc);
else if (ml->v == mf->v3)
- CPYCOL(mc+2, mlc);
+ CPYCOL(mc + 2, mlc);
else if (mf->v4 && ml->v == mf->v4)
- CPYCOL(mc+3, mlc);
+ CPYCOL(mc + 3, mlc);
}
}
@@ -2863,16 +2859,16 @@ static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Object *ob,
static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr)
{
- Scene *scene= CTX_data_scene(C);
- ToolSettings *ts= CTX_data_tool_settings(C);
+ Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
struct VPaintData *vpd = paint_stroke_mode_data(stroke);
- VPaint *vp= ts->vpaint;
+ VPaint *vp = ts->vpaint;
Brush *brush = paint_brush(&vp->paint);
- ViewContext *vc= &vpd->vc;
- Object *ob= vc->obact;
- Mesh *me= ob->data;
+ ViewContext *vc = &vpd->vc;
+ Object *ob = vc->obact;
+ Mesh *me = ob->data;
float mat[4][4];
- int *indexar= vpd->indexar;
+ int *indexar = vpd->indexar;
int totindex, index, flip;
float mval[2];
@@ -2890,40 +2886,40 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
/* load projection matrix */
mult_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat);
- mval[0]-= vc->ar->winrct.xmin;
- mval[1]-= vc->ar->winrct.ymin;
+ mval[0] -= vc->ar->winrct.xmin;
+ mval[1] -= vc->ar->winrct.ymin;
/* which faces are involved */
- if(vp->flag & VP_AREA) {
- totindex= sample_backbuf_area(vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure);
+ if (vp->flag & VP_AREA) {
+ totindex = sample_backbuf_area(vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure);
}
else {
- indexar[0]= view3d_sample_backbuf(vc, mval[0], mval[1]);
- if(indexar[0]) totindex= 1;
- else totindex= 0;
+ indexar[0] = view3d_sample_backbuf(vc, mval[0], mval[1]);
+ if (indexar[0]) totindex = 1;
+ else totindex = 0;
}
- if(vp->flag & VP_COLINDEX) {
- for(index=0; index<totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totpoly) {
- MPoly *mpoly= ((MPoly *)me->mpoly) + (indexar[index]-1);
+ if (vp->flag & VP_COLINDEX) {
+ for (index = 0; index < totindex; index++) {
+ if (indexar[index] && indexar[index] <= me->totpoly) {
+ MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1);
- if(mpoly->mat_nr!=ob->actcol-1) {
- indexar[index]= 0;
+ if (mpoly->mat_nr != ob->actcol - 1) {
+ indexar[index] = 0;
}
}
}
}
- if((me->editflag & ME_EDIT_PAINT_MASK) && me->mpoly) {
- for(index=0; index<totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totpoly) {
- MPoly *mpoly= ((MPoly *)me->mpoly) + (indexar[index]-1);
+ if ((me->editflag & ME_EDIT_PAINT_MASK) && me->mpoly) {
+ for (index = 0; index < totindex; index++) {
+ if (indexar[index] && indexar[index] <= me->totpoly) {
+ MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1);
- if((mpoly->flag & ME_FACE_SEL)==0)
- indexar[index]= 0;
+ if ((mpoly->flag & ME_FACE_SEL) == 0)
+ indexar[index] = 0;
}
}
}
@@ -2931,17 +2927,17 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
swap_m4m4(vc->rv3d->persmat, mat);
- for(index=0; index<totindex; index++) {
+ for (index = 0; index < totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totpoly) {
- vpaint_paint_poly(vp, vpd, ob, indexar[index]-1, mval, brush_size_pressure, brush_alpha_pressure, flip);
+ if (indexar[index] && indexar[index] <= me->totpoly) {
+ vpaint_paint_poly(vp, vpd, ob, indexar[index] - 1, mval, brush_size_pressure, brush_alpha_pressure, flip);
}
}
swap_m4m4(vc->rv3d->persmat, mat);
/* was disabled because it is slow, but necessary for blur */
- if(brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
+ if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
int do_tessface = vpd->use_fast_update;
do_shared_vertexcol(me, do_tessface);
}
@@ -2957,10 +2953,10 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
static void vpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
{
- ToolSettings *ts= CTX_data_tool_settings(C);
- struct VPaintData *vpd= paint_stroke_mode_data(stroke);
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ struct VPaintData *vpd = paint_stroke_mode_data(stroke);
- if(vpd->vertexcosnos)
+ if (vpd->vertexcosnos)
MEM_freeN(vpd->vertexcosnos);
MEM_freeN(vpd->indexar);
@@ -2999,18 +2995,18 @@ static int vpaint_cancel(bContext *C, wmOperator *op)
void PAINT_OT_vertex_paint(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Vertex Paint";
- ot->idname= "PAINT_OT_vertex_paint";
+ ot->name = "Vertex Paint";
+ ot->idname = "PAINT_OT_vertex_paint";
/* api callbacks */
- ot->invoke= vpaint_invoke;
- ot->modal= paint_stroke_modal;
- /* ot->exec= vpaint_exec; <-- needs stroke property */
- ot->poll= vertex_paint_poll;
- ot->cancel= vpaint_cancel;
+ ot->invoke = vpaint_invoke;
+ ot->modal = paint_stroke_modal;
+ /* ot->exec = vpaint_exec; <-- needs stroke property */
+ ot->poll = vertex_paint_poll;
+ ot->cancel = vpaint_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
}
@@ -3019,18 +3015,18 @@ void PAINT_OT_vertex_paint(wmOperatorType *ot)
static int weight_from_bones_poll(bContext *C)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
return (ob && (ob->mode & OB_MODE_WEIGHT_PAINT) && modifiers_isDeformedByArmature(ob));
}
static int weight_from_bones_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
- Object *armob= modifiers_isDeformedByArmature(ob);
- Mesh *me= ob->data;
- int type= RNA_enum_get(op->ptr, "type");
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
+ Object *armob = modifiers_isDeformedByArmature(ob);
+ Mesh *me = ob->data;
+ int type = RNA_enum_get(op->ptr, "type");
create_vgroups_from_armature(op->reports, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X));
@@ -3042,24 +3038,23 @@ static int weight_from_bones_exec(bContext *C, wmOperator *op)
void PAINT_OT_weight_from_bones(wmOperatorType *ot)
{
- static EnumPropertyItem type_items[]= {
+ static EnumPropertyItem type_items[] = {
{ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights froms bones"},
{ARM_GROUPS_ENVELOPE, "ENVELOPES", 0, "From Envelopes", "Weights from envelopes with user defined radius"},
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Weight from Bones";
- ot->idname= "PAINT_OT_weight_from_bones";
+ ot->name = "Weight from Bones";
+ ot->idname = "PAINT_OT_weight_from_bones";
/* api callbacks */
- ot->exec= weight_from_bones_exec;
- ot->invoke= WM_menu_invoke;
- ot->poll= weight_from_bones_poll;
+ ot->exec = weight_from_bones_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->poll = weight_from_bones_poll;
/* 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", "Method to use for assigning weights");
+ ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "Method to use for assigning weights");
}
-
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c7b27742969..e91f26fc9ba 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -64,6 +64,7 @@
#include "BKE_report.h"
#include "BKE_lattice.h" /* for armature_deform_verts */
#include "BKE_node.h"
+#include "BKE_subsurf.h"
#include "BIF_glutil.h"
@@ -96,7 +97,7 @@ void ED_sculpt_force_update(bContext *C)
{
Object *ob= CTX_data_active_object(C);
- if(ob && (ob->mode & OB_MODE_SCULPT))
+ if (ob && (ob->mode & OB_MODE_SCULPT))
multires_force_update(ob);
}
@@ -107,19 +108,19 @@ struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
Mesh *me= (Mesh*)ob->data;
ModifierData *md;
- if(!CustomData_get_layer(&me->ldata, CD_MDISPS)) {
+ if (!CustomData_get_layer(&me->ldata, CD_MDISPS)) {
/* multires can't work without displacement layer */
return NULL;
}
- for(md= modifiers_getVirtualModifierList(ob); md; md= md->next) {
- if(md->type == eModifierType_Multires) {
+ for (md= modifiers_getVirtualModifierList(ob); md; md= md->next) {
+ if (md->type == eModifierType_Multires) {
MultiresModifierData *mmd= (MultiresModifierData*)md;
- if(!modifier_isEnabled(scene, md, eModifierMode_Realtime))
+ if (!modifier_isEnabled(scene, md, eModifierMode_Realtime))
continue;
- if(mmd->sculptlvl > 0) return mmd;
+ if (mmd->sculptlvl > 0) return mmd;
else return NULL;
}
}
@@ -135,8 +136,8 @@ static int sculpt_has_active_modifiers(Scene *scene, Object *ob)
md= modifiers_getVirtualModifierList(ob);
/* exception for shape keys because we can edit those */
- for(; md; md= md->next) {
- if(modifier_isEnabled(scene, md, eModifierMode_Realtime))
+ for (; md; md= md->next) {
+ if (modifier_isEnabled(scene, md, eModifierMode_Realtime))
return 1;
}
@@ -150,22 +151,22 @@ static int sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob)
Mesh *me= (Mesh*)ob->data;
MultiresModifierData *mmd= sculpt_multires_active(scene, ob);
- if(mmd) return 0;
+ if (mmd) return 0;
/* non-locked shape keys could be handled in the same way as deformed mesh */
- if((ob->shapeflag&OB_SHAPE_LOCK)==0 && me->key && ob->shapenr)
+ if ((ob->shapeflag&OB_SHAPE_LOCK)==0 && me->key && ob->shapenr)
return 1;
md= modifiers_getVirtualModifierList(ob);
/* exception for shape keys because we can edit those */
- for(; md; md= md->next) {
+ for (; md; md= md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
- if(md->type==eModifierType_ShapeKey) continue;
+ if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+ if (md->type==eModifierType_ShapeKey) continue;
- if(mti->type==eModifierTypeType_OnlyDeform) return 1;
- else if((sd->flags & SCULPT_ONLY_DEFORM)==0) return 1;
+ if (mti->type==eModifierTypeType_OnlyDeform) return 1;
+ else if ((sd->flags & SCULPT_ONLY_DEFORM)==0) return 1;
}
return 0;
@@ -193,7 +194,6 @@ typedef struct StrokeCache {
/* Variants */
float radius;
float radius_squared;
- //float traced_location[3];
float true_location[3];
float location[3];
@@ -254,13 +254,13 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d,
PBVH *pbvh= ob->sculpt->pbvh;
float bb_min[3], bb_max[3];
- if(!pbvh)
+ if (!pbvh)
return 0;
BLI_pbvh_redraw_BB(pbvh, bb_min, bb_max);
/* convert 3D bounding box to screen space */
- if(!paint_convert_bb_to_rect(rect,
+ if (!paint_convert_bb_to_rect(rect,
bb_min,
bb_max,
ar,
@@ -276,8 +276,8 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d,
* optimized PBVH draw function and 3d view redraw (if not -- some
* mesh parts could disappear from screen (sergey) */
ss = ob->sculpt;
- if(ss->cache) {
- if(!BLI_rcti_is_empty(&ss->cache->previous_r))
+ if (ss->cache) {
+ if (!BLI_rcti_is_empty(&ss->cache->previous_r))
BLI_union_rcti(rect, &ss->cache->previous_r);
}
@@ -295,7 +295,7 @@ void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar,
paint_calc_redraw_planes(planes, ar, rv3d, ob, &rect);
/* clear redraw flag from nodes */
- if(pbvh)
+ if (pbvh)
BLI_pbvh_update(pbvh, PBVH_UpdateRedraw, NULL);
}
@@ -318,7 +318,7 @@ static int sculpt_brush_test(SculptBrushTest *test, float co[3])
{
float distsq = len_squared_v3v3(co, test->location);
- if(distsq <= test->radius_squared) {
+ if (distsq <= test->radius_squared) {
test->dist = sqrt(distsq);
return 1;
}
@@ -331,7 +331,7 @@ static int sculpt_brush_test_sq(SculptBrushTest *test, float co[3])
{
float distsq = len_squared_v3v3(co, test->location);
- if(distsq <= test->radius_squared) {
+ if (distsq <= test->radius_squared) {
test->dist = distsq;
return 1;
}
@@ -347,8 +347,7 @@ static int sculpt_brush_test_fast(SculptBrushTest *test, float co[3])
static int sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float local[4][4])
{
- static const float side = 0.70710678118654752440084436210485; // sqrt(.5);
-
+ float side = M_SQRT1_2;
float local_co[3];
mul_v3_m4v3(local_co, local, co);
@@ -358,7 +357,11 @@ static int sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float loca
local_co[2] = fabs(local_co[2]);
if (local_co[0] <= side && local_co[1] <= side && local_co[2] <= side) {
- test->dist = MAX3(local_co[0], local_co[1], local_co[2]) / side;
+ float p = 4;
+
+ test->dist = ((powf(local_co[0], p) +
+ powf(local_co[1], p) +
+ powf(local_co[2], p)) / pow(side, p));
return 1;
}
@@ -448,7 +451,7 @@ static float integrate_overlap(Brush* br)
float max;
max= 0;
- for(i= 0; i < m; i++) {
+ for (i= 0; i < m; i++) {
float overlap= overlapped_curve(br, i*g);
if (overlap > max)
@@ -461,15 +464,15 @@ static float integrate_overlap(Brush* br)
/* Uses symm to selectively flip any axis of a coordinate. */
static void flip_coord(float out[3], float in[3], const char symm)
{
- if(symm & SCULPT_SYMM_X)
+ if (symm & SCULPT_SYMM_X)
out[0]= -in[0];
else
out[0]= in[0];
- if(symm & SCULPT_SYMM_Y)
+ if (symm & SCULPT_SYMM_Y)
out[1]= -in[1];
else
out[1]= in[1];
- if(symm & SCULPT_SYMM_Z)
+ if (symm & SCULPT_SYMM_Z)
out[2]= -in[2];
else
out[2]= in[2];
@@ -480,16 +483,16 @@ static float calc_overlap(StrokeCache *cache, const char symm, const char axis,
float mirror[3];
float distsq;
- //flip_coord(mirror, cache->traced_location, symm);
+ /* flip_coord(mirror, cache->traced_location, symm); */
flip_coord(mirror, cache->true_location, symm);
- if(axis != 0) {
+ if (axis != 0) {
float mat[4][4]= MAT4_UNITY;
rotate_m4(mat, axis, angle);
mul_m4_v3(mat, mirror);
}
- //distsq = len_squared_v3v3(mirror, cache->traced_location);
+ /* distsq = len_squared_v3v3(mirror, cache->traced_location); */
distsq = len_squared_v3v3(mirror, cache->true_location);
if (distsq <= 4.0f*(cache->radius_squared))
@@ -504,7 +507,7 @@ static float calc_radial_symmetry_feather(Sculpt *sd, StrokeCache *cache, const
float overlap;
overlap = 0;
- for(i = 1; i < sd->radial_symm[axis-'X']; ++i) {
+ for (i = 1; i < sd->radial_symm[axis-'X']; ++i) {
const float angle = 2*M_PI*i/sd->radial_symm[axis-'X'];
overlap += calc_overlap(cache, symm, axis, angle);
}
@@ -521,7 +524,7 @@ static float calc_symmetry_feather(Sculpt *sd, StrokeCache* cache)
overlap = 0;
for (i = 0; i <= symm; i++) {
- if(i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) {
+ if (i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) {
overlap += calc_overlap(cache, i, 0, 0);
@@ -562,9 +565,9 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
(brush->spacing < 100)) ? 1.0f/accum : 1;
float flip = dir * invert * pen_flip;
- switch(brush->sculpt_tool){
+ switch(brush->sculpt_tool) {
case SCULPT_TOOL_CLAY:
- case SCULPT_TOOL_CLAY_TUBES:
+ case SCULPT_TOOL_CLAY_STRIPS:
case SCULPT_TOOL_DRAW:
case SCULPT_TOOL_LAYER:
return alpha * flip * pressure * overlap * feather;
@@ -635,10 +638,10 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3],
MTex *mtex = &br->mtex;
float avg= 1;
- if(!mtex->tex) {
+ if (!mtex->tex) {
avg= 1;
}
- else if(mtex->brush_map_mode == MTEX_MAP_MODE_3D) {
+ else if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) {
float jnk;
/* Get strength by feeding the vertex
@@ -646,7 +649,7 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3],
externtex(mtex, point, &avg,
&jnk, &jnk, &jnk, &jnk, 0);
}
- else if(ss->texcache) {
+ else if (ss->texcache) {
float rotation = -mtex->rot;
float symm_point[3], point_2d[2];
float x, y;
@@ -665,13 +668,14 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3],
ED_view3d_project_float_v2(ss->cache->vc->ar, symm_point, point_2d, ss->cache->projection_mat);
/* if fixed mode, keep coordinates relative to mouse */
- if(mtex->brush_map_mode == MTEX_MAP_MODE_FIXED) {
+ if (mtex->brush_map_mode == MTEX_MAP_MODE_FIXED) {
rotation += ss->cache->special_rotation;
point_2d[0] -= ss->cache->tex_mouse[0];
point_2d[1] -= ss->cache->tex_mouse[1];
- radius = ss->cache->pixel_radius; // use pressure adjusted size for fixed mode
+ /* use pressure adjusted size for fixed mode */
+ radius = ss->cache->pixel_radius;
x = point_2d[0] + ss->cache->vc->ar->winrct.xmin;
y = point_2d[1] + ss->cache->vc->ar->winrct.ymin;
@@ -679,7 +683,8 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3],
else /* else (mtex->brush_map_mode == MTEX_MAP_MODE_TILED) */
/* leave the coordinates relative to the screen */
{
- radius = brush_size(ss->cache->vc->scene, br); // use unadjusted size for tiled mode
+ /* use unadjusted size for tiled mode */
+ radius = brush_size(ss->cache->vc->scene, br);
x = point_2d[0];
y = point_2d[1];
@@ -741,15 +746,15 @@ static int sculpt_search_sphere_cb(PBVHNode *node, void *data_v)
float t[3], bb_min[3], bb_max[3];
int i;
- if(data->original)
+ if (data->original)
BLI_pbvh_node_get_original_BB(node, bb_min, bb_max);
else
BLI_pbvh_node_get_BB(node, bb_min, bb_max);
- for(i = 0; i < 3; ++i) {
- if(bb_min[i] > center[i])
+ for (i = 0; i < 3; ++i) {
+ if (bb_min[i] > center[i])
nearest[i] = bb_min[i];
- else if(bb_max[i] < center[i])
+ else if (bb_max[i] < center[i])
nearest[i] = bb_max[i];
else
nearest[i] = center[i];
@@ -765,11 +770,11 @@ static void sculpt_clip(Sculpt *sd, SculptSession *ss, float *co, const float va
{
int i;
- for(i=0; i<3; ++i) {
- if(sd->flags & (SCULPT_LOCK_X << i))
+ for (i=0; i<3; ++i) {
+ if (sd->flags & (SCULPT_LOCK_X << i))
continue;
- if((ss->cache->flag & (CLIP_X << i)) && (fabsf(co[i]) <= ss->cache->clip_tolerance[i]))
+ if ((ss->cache->flag & (CLIP_X << i)) && (fabsf(co[i]) <= ss->cache->clip_tolerance[i]))
co[i]= 0.0f;
else
co[i]= val[i];
@@ -778,9 +783,10 @@ static void sculpt_clip(Sculpt *sd, SculptSession *ss, float *co, const float va
static void add_norm_if(float view_vec[3], float out[3], float out_flip[3], float fno[3])
{
- if((dot_v3v3(view_vec, fno)) > 0) {
+ if ((dot_v3v3(view_vec, fno)) > 0) {
add_v3_v3(out, fno);
- } else {
+ }
+ else {
add_v3_v3(out_flip, fno); /* out_flip is used when out is {0,0,0} */
}
}
@@ -797,19 +803,19 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
zero_v3(an);
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
+ for (n=0; n<totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
SculptUndoNode *unode;
float private_an[3] = {0.0f, 0.0f, 0.0f};
float private_out_flip[3] = {0.0f, 0.0f, 0.0f};
- unode = sculpt_undo_push_node(ob, nodes[n]);
+ unode = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
sculpt_brush_test_init(ss, &test);
- if(ss->cache->original) {
+ if (ss->cache->original) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test_fast(&test, unode->co[vd.i])) {
+ if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
float fno[3];
normal_short_to_float_v3(fno, unode->no[vd.i]);
@@ -820,8 +826,8 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
}
else {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test_fast(&test, vd.co)) {
- if(vd.no) {
+ if (sculpt_brush_test_fast(&test, vd.co)) {
+ if (vd.no) {
float fno[3];
normal_short_to_float_v3(fno, vd.no);
@@ -903,28 +909,27 @@ static void calc_sculpt_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **n
* polygon.) */
static void neighbor_average(SculptSession *ss, float avg[3], unsigned vert)
{
- const int ncount = BLI_countlist(&ss->pmap[vert]);
+ const MeshElemMap *vert_map = &ss->pmap[vert];
const MVert *mvert = ss->mvert;
float (*deform_co)[3] = ss->deform_cos;
zero_v3(avg);
/* Don't modify corner vertices */
- if(ncount != 1) {
- IndexNode *node;
- int total = 0;
+ if (vert_map->count > 1) {
+ int i, total = 0;
- for(node = ss->pmap[vert].first; node; node = node->next) {
- const MPoly *p= &ss->mpoly[node->index];
+ for (i = 0; i < vert_map->count; i++) {
+ const MPoly *p= &ss->mpoly[vert_map->indices[i]];
unsigned f_adj_v[3];
- if(poly_get_adj_loops_from_vert(f_adj_v, p, ss->mloop, vert) != -1) {
- int i;
+ if (poly_get_adj_loops_from_vert(f_adj_v, p, ss->mloop, vert) != -1) {
+ int j;
- for (i = 0; i < 3; i++) {
- if (ncount != 2 || BLI_countlist(&ss->pmap[f_adj_v[i]]) <= 2) {
- add_v3_v3(avg, deform_co ? deform_co[f_adj_v[i]] :
- mvert[f_adj_v[i]].co);
+ for (j = 0; j < 3; j++) {
+ if (vert_map->count != 2 || ss->pmap[f_adj_v[j]].count <= 2) {
+ add_v3_v3(avg, deform_co ? deform_co[f_adj_v[j]] :
+ mvert[f_adj_v[j]].co);
total++;
}
@@ -932,7 +937,7 @@ static void neighbor_average(SculptSession *ss, float avg[3], unsigned vert)
}
}
- if(total > 0) {
+ if (total > 0) {
mul_v3_fl(avg, 1.0f / total);
return;
}
@@ -952,7 +957,7 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test(&test, vd.co)) {
+ if (sculpt_brush_test(&test, vd.co)) {
const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
ss->cache->view_normal, vd.no, vd.fno);
float avg[3], val[3];
@@ -965,7 +970,7 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
sculpt_clip(sd, ss, vd.co, val);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -995,7 +1000,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
tmprow= MEM_mallocN(sizeof(float)*3*gridsize, "tmprow");
}
- for(i = 0; i < totgrid; ++i) {
+ for (i = 0; i < totgrid; ++i) {
data = griddata[grid_indices[i]];
adj = &gridadj[grid_indices[i]];
@@ -1024,29 +1029,29 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
}
/* blend with existing coordinates */
- for(y = 0; y < gridsize; ++y) {
- for(x = 0; x < gridsize; ++x) {
+ for (y = 0; y < gridsize; ++y) {
+ for (x = 0; x < gridsize; ++x) {
float *co;
float *fno;
int index;
- if(x == 0 && adj->index[0] == -1)
+ if (x == 0 && adj->index[0] == -1)
continue;
- if(x == gridsize - 1 && adj->index[2] == -1)
+ if (x == gridsize - 1 && adj->index[2] == -1)
continue;
- if(y == 0 && adj->index[3] == -1)
+ if (y == 0 && adj->index[3] == -1)
continue;
- if(y == gridsize - 1 && adj->index[1] == -1)
+ if (y == gridsize - 1 && adj->index[1] == -1)
continue;
index = x + y*gridsize;
co= data[index].co;
fno= data[index].no;
- if(sculpt_brush_test(&test, co)) {
+ if (sculpt_brush_test(&test, co)) {
const float fade = bstrength*tex_strength(ss, brush, co, test.dist,
ss->cache->view_normal, NULL, fno);
float *avg, val[3];
@@ -1056,10 +1061,10 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
n = 1/16.0f;
- if(x == 0 || x == gridsize - 1)
+ if (x == 0 || x == gridsize - 1)
n *= 2;
- if(y == 0 || y == gridsize - 1)
+ if (y == 0 || y == gridsize - 1)
n *= 2;
mul_v3_fl(avg, n);
@@ -1095,17 +1100,17 @@ static void smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float
count = (int)(bstrength*max_iterations);
last = max_iterations*(bstrength - count*fract);
- for(iteration = 0; iteration <= count; ++iteration) {
+ for (iteration = 0; iteration <= count; ++iteration) {
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
- if(ss->multires) {
+ for (n=0; n<totnode; n++) {
+ if (ss->multires) {
do_multires_smooth_brush(sd, ss, nodes[n], iteration != count ? 1.0f : last);
}
- else if(ss->pmap)
+ else if (ss->pmap)
do_mesh_smooth_brush(sd, ss, nodes[n], iteration != count ? 1.0f : last);
}
- if(ss->multires)
+ if (ss->multires)
multires_stitch_grids(ob);
}
}
@@ -1133,7 +1138,7 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
/* threaded loop over nodes */
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
+ for (n=0; n<totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
float (*proxy)[3];
@@ -1150,7 +1155,7 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
mul_v3_v3fl(proxy[vd.i], offset, fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -1177,7 +1182,7 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
/* we divide out the squared alpha and multiply by the squared crease to give us the pinch strength */
- if(brush_alpha(scene, brush) > 0.0f)
+ if (brush_alpha(scene, brush) > 0.0f)
crease_correction = brush->crease_pinch_factor*brush->crease_pinch_factor/(brush_alpha(scene, brush)*brush_alpha(scene, brush));
else
crease_correction = brush->crease_pinch_factor*brush->crease_pinch_factor;
@@ -1185,11 +1190,11 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
/* we always want crease to pinch or blob to relax even when draw is negative */
flippedbstrength = (bstrength < 0) ? -crease_correction*bstrength : crease_correction*bstrength;
- if(brush->sculpt_tool == SCULPT_TOOL_BLOB) flippedbstrength *= -1.0f;
+ if (brush->sculpt_tool == SCULPT_TOOL_BLOB) flippedbstrength *= -1.0f;
/* threaded loop over nodes */
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
+ for (n=0; n<totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
float (*proxy)[3];
@@ -1199,7 +1204,7 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test(&test, vd.co)) {
+ if (sculpt_brush_test(&test, vd.co)) {
/* offset vertex */
const float fade = tex_strength(ss, brush, vd.co, test.dist,
area_normal, vd.no, vd.fno);
@@ -1208,7 +1213,6 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
/* first we pinch */
sub_v3_v3v3(val1, test.location, vd.co);
- //mul_v3_v3(val1, ss->cache->scale);
mul_v3_fl(val1, fade*flippedbstrength);
/* then we draw */
@@ -1216,7 +1220,7 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
add_v3_v3v3(proxy[vd.i], val1, val2);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -1232,7 +1236,7 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
int n;
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
+ for (n=0; n<totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
float (*proxy)[3];
@@ -1242,7 +1246,7 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test(&test, vd.co)) {
+ if (sculpt_brush_test(&test, vd.co)) {
float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
ss->cache->view_normal, vd.no, vd.fno);
float val[3];
@@ -1250,7 +1254,7 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sub_v3_v3v3(val, test.location, vd.co);
mul_v3_v3fl(proxy[vd.i], val, fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -1286,7 +1290,7 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
}
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
+ for (n=0; n<totnode; n++) {
PBVHVertexIter vd;
SculptUndoNode* unode;
SculptBrushTest test;
@@ -1294,7 +1298,7 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
short (*origno)[3];
float (*proxy)[3];
- unode= sculpt_undo_push_node(ob, nodes[n]);
+ unode= sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
origco= unode->co;
origno= unode->no;
@@ -1303,13 +1307,13 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test(&test, origco[vd.i])) {
+ if (sculpt_brush_test(&test, origco[vd.i])) {
const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
an, origno[vd.i], NULL);
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -1335,7 +1339,7 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
cross_v3_v3v3(cono, tmp, an);
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n = 0; n < totnode; n++) {
+ for (n = 0; n < totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
float (*proxy)[3];
@@ -1345,13 +1349,13 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test(&test, vd.co)) {
+ if (sculpt_brush_test(&test, vd.co)) {
const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
an, vd.no, vd.fno);
mul_v3_v3fl(proxy[vd.i], cono, fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -1385,7 +1389,7 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
}
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n = 0; n < totnode; n++) {
+ for (n = 0; n < totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
float (*proxy)[3];
@@ -1395,13 +1399,13 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test(&test, vd.co)) {
+ if (sculpt_brush_test(&test, vd.co)) {
const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
an, vd.no, vd.fno);
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -1427,7 +1431,7 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
cross_v3_v3v3(cono, tmp, an);
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n = 0; n < totnode; n++) {
+ for (n = 0; n < totnode; n++) {
PBVHVertexIter vd;
SculptUndoNode* unode;
SculptBrushTest test;
@@ -1435,7 +1439,7 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
short (*origno)[3];
float (*proxy)[3];
- unode= sculpt_undo_push_node(ob, nodes[n]);
+ unode= sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
origco= unode->co;
origno= unode->no;
@@ -1444,13 +1448,13 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test(&test, origco[vd.i])) {
+ if (sculpt_brush_test(&test, origco[vd.i])) {
const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
an, origno[vd.i], NULL);
mul_v3_v3fl(proxy[vd.i], cono, fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -1481,7 +1485,7 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
mul_serie_m4(m, lmat, rot, ilmat, NULL, NULL, NULL, NULL, NULL);
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
+ for (n=0; n<totnode; n++) {
PBVHVertexIter vd;
SculptUndoNode* unode;
SculptBrushTest test;
@@ -1489,7 +1493,7 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
short (*origno)[3];
float (*proxy)[3];
- unode= sculpt_undo_push_node(ob, nodes[n]);
+ unode= sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
origco= unode->co;
origno= unode->no;
@@ -1498,7 +1502,7 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test(&test, origco[vd.i])) {
+ if (sculpt_brush_test(&test, origco[vd.i])) {
const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
an, origno[vd.i], NULL);
@@ -1506,7 +1510,7 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
sub_v3_v3(proxy[vd.i], origco[vd.i]);
mul_v3_fl(proxy[vd.i], fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -1523,7 +1527,7 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
float lim= brush->height;
int n;
- if(bstrength < 0)
+ if (bstrength < 0)
lim = -lim;
calc_sculpt_normal(sd, ob, area_normal, nodes, totnode);
@@ -1531,16 +1535,15 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
mul_v3_v3v3(offset, ss->cache->scale, area_normal);
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
+ for (n=0; n<totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
SculptUndoNode *unode;
float (*origco)[3], *layer_disp;
- //float (*proxy)[3]; // XXX layer brush needs conversion to proxy but its more complicated
-
- //proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+ /* XXX: layer brush needs conversion to proxy but its more complicated */
+ /* proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co; */
- unode= sculpt_undo_push_node(ob, nodes[n]);
+ unode= sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
origco=unode->co;
if (!unode->layer_disp) {
#pragma omp critical
@@ -1552,7 +1555,7 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test(&test, origco[vd.i])) {
+ if (sculpt_brush_test(&test, origco[vd.i])) {
const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
area_normal, vd.no, vd.fno);
float *disp= &layer_disp[vd.i];
@@ -1561,12 +1564,12 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
*disp+= fade;
/* Don't let the displacement go past the limit */
- if((lim < 0 && *disp < lim) || (lim >= 0 && *disp > lim))
+ if ((lim < 0 && *disp < lim) || (lim >= 0 && *disp > lim))
*disp = lim;
mul_v3_v3fl(val, offset, *disp);
- if(ss->layer_co && (brush->flag & BRUSH_PERSISTENT)) {
+ if (ss->layer_co && (brush->flag & BRUSH_PERSISTENT)) {
int index= vd.vert_indices[vd.i];
/* persistent base */
@@ -1578,7 +1581,7 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_clip(sd, ss, vd.co, val);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -1594,7 +1597,7 @@ static void do_inflate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
int n;
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
+ for (n=0; n<totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
float (*proxy)[3];
@@ -1604,18 +1607,18 @@ static void do_inflate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test(&test, vd.co)) {
+ if (sculpt_brush_test(&test, vd.co)) {
const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
ss->cache->view_normal, vd.no, vd.fno);
float val[3];
- if(vd.fno) copy_v3_v3(val, vd.fno);
+ if (vd.fno) copy_v3_v3(val, vd.fno);
else normal_short_to_float_v3(val, vd.no);
mul_v3_fl(val, fade * ss->cache->radius);
mul_v3_v3v3(proxy[vd.i], val, ss->cache->scale);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -1635,19 +1638,19 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
zero_v3(fc);
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
+ for (n=0; n<totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
SculptUndoNode *unode;
float private_fc[3] = {0.0f, 0.0f, 0.0f};
int private_count = 0;
- unode = sculpt_undo_push_node(ob, nodes[n]);
+ unode = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
sculpt_brush_test_init(ss, &test);
- if(ss->cache->original) {
+ if (ss->cache->original) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test_fast(&test, unode->co[vd.i])) {
+ if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
add_v3_v3(private_fc, unode->co[vd.i]);
private_count++;
}
@@ -1656,7 +1659,7 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
}
else {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test_fast(&test, vd.co)) {
+ if (sculpt_brush_test_fast(&test, vd.co)) {
add_v3_v3(private_fc, vd.co);
private_count++;
}
@@ -1683,22 +1686,22 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
SculptSession *ss = ob->sculpt;
int n;
- // an
+ /* for area normal */
float out_flip[3] = {0.0f, 0.0f, 0.0f};
- // fc
+ /* for flatten center */
float count = 0;
(void)sd; /* unused w/o openmp */
- // an
+ /* for area normal */
zero_v3(an);
- // fc
+ /* for flatten center */
zero_v3(fc);
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
+ for (n=0; n<totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
SculptUndoNode *unode;
@@ -1707,19 +1710,19 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
float private_fc[3] = {0.0f, 0.0f, 0.0f};
int private_count = 0;
- unode = sculpt_undo_push_node(ob, nodes[n]);
+ unode = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
sculpt_brush_test_init(ss, &test);
- if(ss->cache->original) {
+ if (ss->cache->original) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test_fast(&test, unode->co[vd.i])) {
- // an
+ if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
+ /* for area normal */
float fno[3];
normal_short_to_float_v3(fno, unode->no[vd.i]);
add_norm_if(ss->cache->view_normal, private_an, private_out_flip, fno);
- // fc
+ /* for flatten center */
add_v3_v3(private_fc, unode->co[vd.i]);
private_count++;
}
@@ -1728,9 +1731,9 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
}
else {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- if(sculpt_brush_test_fast(&test, vd.co)) {
- // an
- if(vd.no) {
+ if (sculpt_brush_test_fast(&test, vd.co)) {
+ /* for area normal */
+ if (vd.no) {
float fno[3];
normal_short_to_float_v3(fno, vd.no);
@@ -1740,7 +1743,7 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
add_norm_if(ss->cache->view_normal, private_an, private_out_flip, vd.fno);
}
- // fc
+ /* for flatten center */
add_v3_v3(private_fc, vd.co);
private_count++;
}
@@ -1750,23 +1753,23 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
#pragma omp critical
{
- // an
+ /* for area normal */
add_v3_v3(an, private_an);
add_v3_v3(out_flip, private_out_flip);
- // fc
+ /* for flatten center */
add_v3_v3(fc, private_fc);
count += private_count;
}
}
- // an
+ /* for area normal */
if (is_zero_v3(an))
copy_v3_v3(an, out_flip);
normalize_v3(an);
- // fc
+ /* for flatten center */
if (count != 0) {
mul_v3_fl(fc, 1.0f / count);
}
@@ -1814,34 +1817,34 @@ static void calc_sculpt_plane(Sculpt *sd, Object *ob, PBVHNode **nodes, int totn
break;
}
- // fc
+ /* for flatten center */
/* flatten center has not been calculated yet if we are not using the area normal */
if (brush->sculpt_plane != SCULPT_DISP_DIR_AREA)
calc_flatten_center(sd, ob, nodes, totnode, fc);
- // an
+ /* for area normal */
copy_v3_v3(ss->cache->last_area_normal, an);
- // fc
+ /* for flatten center */
copy_v3_v3(ss->cache->last_center, fc);
}
else {
- // an
+ /* for area normal */
copy_v3_v3(an, ss->cache->last_area_normal);
- // fc
+ /* for flatten center */
copy_v3_v3(fc, ss->cache->last_center);
- // an
+ /* for area normal */
flip_coord(an, an, ss->cache->mirror_symmetry_pass);
- // fc
+ /* for flatten center */
flip_coord(fc, fc, ss->cache->mirror_symmetry_pass);
- // an
+ /* for area normal */
mul_m4_v3(ss->cache->symm_rot_mat, an);
- // fc
+ /* for flatten center */
mul_m4_v3(ss->cache->symm_rot_mat, fc);
}
}
@@ -1921,7 +1924,7 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
add_v3_v3(fc, temp);
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n = 0; n < totnode; n++) {
+ for (n = 0; n < totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
float (*proxy)[3];
@@ -1945,7 +1948,7 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
mul_v3_v3fl(proxy[vd.i], val, fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -1965,13 +1968,12 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
float displace;
- float an[3]; // area normal
- float fc[3]; // flatten center
+ float an[3];
+ float fc[3];
int n;
float temp[3];
- //float p[3];
int flip;
@@ -1990,7 +1992,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
mul_v3_fl(temp, displace);
add_v3_v3(fc, temp);
- //add_v3_v3v3(p, ss->cache->location, an);
+ /* add_v3_v3v3(p, ss->cache->location, an); */
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
for (n = 0; n < totnode; n++) {
@@ -2005,7 +2007,6 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if (sculpt_brush_test_sq(&test, vd.co)) {
if (plane_point_side_flip(vd.co, an, fc, flip)) {
- //if (sculpt_brush_test_cyl(&test, vd.co, ss->cache->location, p)) {
float intr[3];
float val[3];
@@ -2020,7 +2021,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
mul_v3_v3fl(proxy[vd.i], val, fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -2030,7 +2031,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
}
}
-static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
+static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
{
SculptSession *ss = ob->sculpt;
Brush *brush = paint_brush(&sd->paint);
@@ -2041,9 +2042,9 @@ static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
float displace;
- float sn[3]; // sculpt normal
- float an[3]; // area normal
- float fc[3]; // flatten center
+ float sn[3];
+ float an[3];
+ float fc[3];
int n;
@@ -2061,8 +2062,9 @@ static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
else
copy_v3_v3(an, sn);
+ /* delay the first daub because grab delta is not setup */
if (ss->cache->first_time)
- return; // delay the first daub because grab delta is not setup
+ return;
flip = bstrength < 0;
@@ -2077,11 +2079,18 @@ static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
mul_v3_fl(temp, displace);
add_v3_v3(fc, temp);
- cross_v3_v3v3(mat[0], an, ss->cache->grab_delta_symmetry); mat[0][3] = 0;
- cross_v3_v3v3(mat[1], an, mat[0]); mat[1][3] = 0;
- copy_v3_v3(mat[2], an); mat[2][3] = 0;
- copy_v3_v3(mat[3], ss->cache->location); mat[3][3] = 1;
+ /* init mat */
+ cross_v3_v3v3(mat[0], an, ss->cache->grab_delta_symmetry);
+ mat[0][3] = 0;
+ cross_v3_v3v3(mat[1], an, mat[0]);
+ mat[1][3] = 0;
+ copy_v3_v3(mat[2], an);
+ mat[2][3] = 0;
+ copy_v3_v3(mat[3], ss->cache->location);
+ mat[3][3] = 1;
normalize_m4(mat);
+
+ /* scale mat */
scale_m4_fl(scale, ss->cache->radius);
mult_m4_m4m4(tmat, mat, scale);
invert_m4_m4(mat, tmat);
@@ -2113,7 +2122,7 @@ static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
mul_v3_v3fl(proxy[vd.i], val, fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -2176,7 +2185,7 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
mul_v3_v3fl(proxy[vd.i], val, fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -2239,7 +2248,7 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
mul_v3_v3fl(proxy[vd.i], val, fade);
- if(vd.mvert)
+ if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
@@ -2259,7 +2268,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
/* for relative keys editing of base should update other keys */
if (me->key->type == KEY_RELATIVE)
for (currkey = me->key->block.first; currkey; currkey= currkey->next)
- if(ob->shapenr-1 == currkey->relative) {
+ if (ob->shapenr-1 == currkey->relative) {
is_basis= 1;
break;
}
@@ -2318,12 +2327,12 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
if (totnode) {
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
for (n= 0; n < totnode; n++) {
- sculpt_undo_push_node(ob, nodes[n]);
+ sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
BLI_pbvh_node_mark_update(nodes[n]);
}
/* Apply one type of brush action */
- switch(brush->sculpt_tool){
+ switch(brush->sculpt_tool) {
case SCULPT_TOOL_DRAW:
do_draw_brush(sd, ob, nodes, totnode);
break;
@@ -2366,8 +2375,8 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
case SCULPT_TOOL_CLAY:
do_clay_brush(sd, ob, nodes, totnode);
break;
- case SCULPT_TOOL_CLAY_TUBES:
- do_clay_tubes_brush(sd, ob, nodes, totnode);
+ case SCULPT_TOOL_CLAY_STRIPS:
+ do_clay_strips_brush(sd, ob, nodes, totnode);
break;
case SCULPT_TOOL_FILL:
do_fill_brush(sd, ob, nodes, totnode);
@@ -2405,7 +2414,7 @@ static void sculpt_flush_pbvhvert_deform(Object *ob, PBVHVertexIter *vd)
copy_v3_v3(ss->deform_cos[index], vd->co);
copy_v3_v3(ss->orig_cos[index], newco);
- if(!ss->kb)
+ if (!ss->kb)
copy_v3_v3(me->mvert[index].co, newco);
}
@@ -2418,7 +2427,7 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
BLI_pbvh_gather_proxies(ss->pbvh, &nodes, &totnode);
- if(!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
+ if (!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
/* these brushes start from original coordinates */
const int use_orco = (ELEM3(brush->sculpt_tool, SCULPT_TOOL_GRAB,
SCULPT_TOOL_ROTATE, SCULPT_TOOL_THUMB));
@@ -2430,8 +2439,8 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
int proxy_count;
float (*orco)[3];
- if(use_orco)
- orco= sculpt_undo_push_node(ob, nodes[n])->co;
+ if (use_orco)
+ orco= sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS)->co;
BLI_pbvh_node_get_proxies(nodes[n], &proxies, &proxy_count);
@@ -2439,7 +2448,7 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
float val[3];
int p;
- if(use_orco)
+ if (use_orco)
copy_v3_v3(val, orco[vd.i]);
else
copy_v3_v3(val, vd.co);
@@ -2449,7 +2458,7 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
sculpt_clip(sd, ss, vd.co, val);
- if(ss->modifiers_active)
+ if (ss->modifiers_active)
sculpt_flush_pbvhvert_deform(ob, &vd);
}
BLI_pbvh_vertex_iter_end;
@@ -2470,13 +2479,13 @@ static void sculpt_update_keyblock(Object *ob)
/* Keyblock update happens after hadning deformation caused by modifiers,
* so ss->orig_cos would be updated with new stroke */
- if(ss->orig_cos) vertCos = ss->orig_cos;
+ if (ss->orig_cos) vertCos = ss->orig_cos;
else vertCos = BLI_pbvh_get_vertCos(ss->pbvh);
if (vertCos) {
sculpt_vertcos_to_key(ob, ss->kb, vertCos);
- if(vertCos != ss->orig_cos)
+ if (vertCos != ss->orig_cos)
MEM_freeN(vertCos);
}
}
@@ -2487,7 +2496,7 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
SculptSession *ss = ob->sculpt;
Brush *brush= paint_brush(&sd->paint);
- if(ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
+ if (ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
/* this brushes aren't using proxies, so sculpt_combine_proxies() wouldn't
* propagate needed deformation to original base */
@@ -2496,7 +2505,7 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
PBVHNode** nodes;
float (*vertCos)[3]= NULL;
- if(ss->kb)
+ if (ss->kb)
vertCos= MEM_callocN(sizeof(*vertCos)*me->totvert, "flushStrokeDeofrm keyVerts");
BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
@@ -2508,7 +2517,7 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
sculpt_flush_pbvhvert_deform(ob, &vd);
- if(vertCos) {
+ if (vertCos) {
int index= vd.vert_indices[vd.i];
copy_v3_v3(vertCos[index], ss->orig_cos[index]);
}
@@ -2516,7 +2525,7 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
BLI_pbvh_vertex_iter_end;
}
- if(vertCos) {
+ if (vertCos) {
sculpt_vertcos_to_key(ob, ss->kb, vertCos);
MEM_freeN(vertCos);
}
@@ -2527,27 +2536,12 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
* Note, then if sculpting happens on locked key, normals should be re-calculated
* after applying coords from keyblock on base mesh */
mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL);
- } else if (ss->kb)
+ }
+ else if (ss->kb) {
sculpt_update_keyblock(ob);
+ }
}
-//static int max_overlap_count(Sculpt *sd)
-//{
-// int count[3];
-// int i, j;
-//
-// for (i= 0; i < 3; i++) {
-// count[i] = sd->radial_symm[i];
-//
-// for (j= 0; j < 3; j++) {
-// if (i != j && sd->flags & (SCULPT_SYMM_X<<i))
-// count[i] *= 2;
-// }
-// }
-//
-// return MAX3(count[0], count[1], count[2]);
-//}
-
/* Flip all the editdata across the axis/axes specified by symm. Used to
* calculate multiple modifications to the mesh when symmetry is enabled. */
static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
@@ -2560,22 +2554,22 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
flip_coord(cache->grab_delta_symmetry, cache->grab_delta, symm);
flip_coord(cache->view_normal, cache->true_view_normal, symm);
- // XXX This reduces the length of the grab delta if it approaches the line of symmetry
- // XXX However, a different approach appears to be needed
- //if (sd->flags & SCULPT_SYMMETRY_FEATHER) {
- // float frac = 1.0f/max_overlap_count(sd);
- // float reduce = (feather-frac)/(1-frac);
+ /* XXX This reduces the length of the grab delta if it approaches the line of symmetry
+ XXX However, a different approach appears to be needed
+ if (sd->flags & SCULPT_SYMMETRY_FEATHER) {
+ float frac = 1.0f/max_overlap_count(sd);
+ float reduce = (feather-frac)/(1-frac);
- // printf("feather: %f frac: %f reduce: %f\n", feather, frac, reduce);
+ printf("feather: %f frac: %f reduce: %f\n", feather, frac, reduce);
- // if (frac < 1)
- // mul_v3_fl(cache->grab_delta_symmetry, reduce);
- //}
+ if (frac < 1)
+ mul_v3_fl(cache->grab_delta_symmetry, reduce);
+ } */
unit_m4(cache->symm_rot_mat);
unit_m4(cache->symm_rot_mat_inv);
- if(axis) { /* expects XYZ */
+ if (axis) { /* expects XYZ */
rotate_m4(cache->symm_rot_mat, axis, angle);
rotate_m4(cache->symm_rot_mat_inv, axis, -angle);
}
@@ -2591,7 +2585,7 @@ static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush,
SculptSession *ss = ob->sculpt;
int i;
- for(i = 1; i < sd->radial_symm[axis-'X']; ++i) {
+ for (i = 1; i < sd->radial_symm[axis-'X']; ++i) {
const float angle = 2*M_PI*i/sd->radial_symm[axis-'X'];
ss->cache->radial_symmetry_pass= i;
calc_brushdata_symm(sd, ss->cache, symm, axis, angle, feather);
@@ -2608,7 +2602,7 @@ static void sculpt_fix_noise_tear(Sculpt *sd, Object *ob)
Brush *brush = paint_brush(&sd->paint);
MTex *mtex = &brush->mtex;
- if(ss->multires && mtex->tex && mtex->tex->type == TEX_NOISE)
+ if (ss->multires && mtex->tex && mtex->tex->type == TEX_NOISE)
multires_stitch_grids(ob);
}
@@ -2627,8 +2621,8 @@ static void do_symmetrical_brush_actions(Sculpt *sd, Object *ob)
cache->symmetry= symm;
/* symm is a bit combination of XYZ - 1 is mirror X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
- for(i = 0; i <= symm; ++i) {
- if(i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) {
+ for (i = 0; i <= symm; ++i) {
+ if (i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) {
cache->mirror_symmetry_pass= i;
cache->radial_symmetry_pass= 0;
@@ -2657,14 +2651,14 @@ static void sculpt_update_tex(const Scene *scene, Sculpt *sd, SculptSession *ss)
Brush *brush = paint_brush(&sd->paint);
const int radius= brush_size(scene, brush);
- if(ss->texcache) {
+ if (ss->texcache) {
MEM_freeN(ss->texcache);
ss->texcache= NULL;
}
/* Need to allocate a bigger buffer for bigger brush size */
ss->texcache_side = 2*radius;
- if(!ss->texcache || ss->texcache_side > ss->texcache_actual) {
+ if (!ss->texcache || ss->texcache_side > ss->texcache_actual) {
ss->texcache = brush_gen_texture_cache(brush, radius);
ss->texcache_actual = ss->texcache_side;
}
@@ -2678,10 +2672,10 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
ss->modifiers_active= sculpt_modifiers_active(scene, sd, ob);
- if(!mmd) ss->kb= ob_get_keyblock(ob);
+ if (!mmd) ss->kb= ob_get_keyblock(ob);
else ss->kb= NULL;
- if(mmd) {
+ if (mmd) {
ss->multires = mmd;
ss->totvert = dm->getNumVerts(dm);
ss->totpoly = dm->getNumPolys(dm);
@@ -2707,22 +2701,23 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
ss->pbvh = dm->getPBVH(ob, dm);
ss->pmap = (need_pmap && dm->getPolyMap)? dm->getPolyMap(ob, dm): NULL;
- if(ss->modifiers_active) {
- if(!ss->orig_cos) {
+ if (ss->modifiers_active) {
+ if (!ss->orig_cos) {
int a;
free_sculptsession_deformMats(ss);
- if(ss->kb) ss->orig_cos = key_to_vertcos(ob, ss->kb);
+ if (ss->kb) ss->orig_cos = key_to_vertcos(ob, ss->kb);
else ss->orig_cos = mesh_getVertexCos(ob->data, NULL);
crazyspace_build_sculpt(scene, ob, &ss->deform_imats, &ss->deform_cos);
BLI_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos);
- for(a = 0; a < ((Mesh*)ob->data)->totvert; ++a)
+ for (a = 0; a < ((Mesh*)ob->data)->totvert; ++a)
invert_m3(ss->deform_imats[a]);
}
- } else free_sculptsession_deformMats(ss);
+ }
+ else free_sculptsession_deformMats(ss);
/* if pbvh is deformed, key block is already applied to it */
if (ss->kb && !BLI_pbvh_isDeformed(ss->pbvh)) {
@@ -2736,7 +2731,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
}
}
-static int sculpt_mode_poll(bContext *C)
+int sculpt_mode_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
return ob && ob->mode & OB_MODE_SCULPT;
@@ -2776,8 +2771,8 @@ static const char *sculpt_tool_name(Sculpt *sd)
return "Flatten Brush"; break;
case SCULPT_TOOL_CLAY:
return "Clay Brush"; break;
- case SCULPT_TOOL_CLAY_TUBES:
- return "Clay Tubes Brush"; break;
+ case SCULPT_TOOL_CLAY_STRIPS:
+ return "Clay Strips Brush"; break;
case SCULPT_TOOL_FILL:
return "Fill Brush"; break;
case SCULPT_TOOL_SCRAPE:
@@ -2793,7 +2788,7 @@ static const char *sculpt_tool_name(Sculpt *sd)
static void sculpt_cache_free(StrokeCache *cache)
{
- if(cache->face_norms)
+ if (cache->face_norms)
MEM_freeN(cache->face_norms);
MEM_freeN(cache);
}
@@ -2804,20 +2799,20 @@ static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss)
ModifierData *md;
int i;
- for(md= ob->modifiers.first; md; md= md->next) {
- if(md->type==eModifierType_Mirror &&
+ for (md= ob->modifiers.first; md; md= md->next) {
+ if (md->type==eModifierType_Mirror &&
(md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*)md;
- if(mmd->flag & MOD_MIR_CLIPPING) {
+ if (mmd->flag & MOD_MIR_CLIPPING) {
/* check each axis for mirroring */
- for(i = 0; i < 3; ++i) {
- if(mmd->flag & (MOD_MIR_AXIS_X << i)) {
+ for (i = 0; i < 3; ++i) {
+ if (mmd->flag & (MOD_MIR_AXIS_X << i)) {
/* enable sculpt clipping */
ss->cache->flag |= CLIP_X << i;
/* update the clip tolerance */
- if(mmd->tolerance >
+ if (mmd->tolerance >
ss->cache->clip_tolerance[i])
ss->cache->clip_tolerance[i] =
mmd->tolerance;
@@ -2867,7 +2862,7 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
/* not very nice, but with current events system implementation
* we can't handle brush appearance inversion hotkey separately (sergey) */
- if(cache->invert) brush->flag |= BRUSH_INVERTED;
+ if (cache->invert) brush->flag |= BRUSH_INVERTED;
else brush->flag &= ~BRUSH_INVERTED;
/* Alt-Smooth */
@@ -2878,7 +2873,7 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
BLI_strncpy(cache->saved_active_brush_name, brush->id.name+2, sizeof(cache->saved_active_brush_name));
br= (Brush *)find_id("BR", "Smooth");
- if(br) {
+ if (br) {
paint_brush_set(p, br);
brush = br;
}
@@ -2898,16 +2893,16 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
ED_view3d_global_to_vector(cache->vc->rv3d, cache->vc->rv3d->twmat[3], cache->true_view_normal);
/* Initialize layer brush displacements and persistent coords */
- if(brush->sculpt_tool == SCULPT_TOOL_LAYER) {
+ if (brush->sculpt_tool == SCULPT_TOOL_LAYER) {
/* not supported yet for multires */
- if(!ss->multires && !ss->layer_co && (brush->flag & BRUSH_PERSISTENT)) {
- if(!ss->layer_co)
+ if (!ss->multires && !ss->layer_co && (brush->flag & BRUSH_PERSISTENT)) {
+ if (!ss->layer_co)
ss->layer_co= MEM_mallocN(sizeof(float) * 3 * ss->totvert,
"sculpt mesh vertices copy");
- if(ss->deform_cos) memcpy(ss->layer_co, ss->deform_cos, ss->totvert);
+ if (ss->deform_cos) memcpy(ss->layer_co, ss->deform_cos, ss->totvert);
else {
- for(i = 0; i < ss->totvert; ++i) {
+ for (i = 0; i < ss->totvert; ++i) {
copy_v3_v3(ss->layer_co[i], ss->mvert[i].co);
}
}
@@ -2915,27 +2910,25 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
}
/* Make copies of the mesh vertex locations and normals for some tools */
- if(brush->flag & BRUSH_ANCHORED) {
- if(ss->face_normals) {
+ if (brush->flag & BRUSH_ANCHORED) {
+ if (ss->face_normals) {
float *fn = ss->face_normals;
cache->face_norms= MEM_mallocN(sizeof(float) * 3 * ss->totpoly, "Sculpt face norms");
- for(i = 0; i < ss->totpoly; ++i, fn += 3)
+ for (i = 0; i < ss->totpoly; ++i, fn += 3)
copy_v3_v3(cache->face_norms[i], fn);
}
cache->original = 1;
}
- if(ELEM8(brush->sculpt_tool,
+ if (ELEM8(brush->sculpt_tool,
SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB,
SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
- SCULPT_TOOL_CLAY_TUBES, SCULPT_TOOL_ROTATE))
- if(!(brush->flag & BRUSH_ACCUMULATE))
+ SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_ROTATE))
+ if (!(brush->flag & BRUSH_ACCUMULATE))
cache->original = 1;
cache->special_rotation = (brush->flag & BRUSH_RAKE) ? sd->last_angle : 0;
- //cache->last_rake[0] = sd->last_x;
- //cache->last_rake[1] = sd->last_y;
cache->first_time= 1;
@@ -2946,29 +2939,33 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
{
SculptSession *ss = ob->sculpt;
StrokeCache *cache = ss->cache;
+ float mouse[2] = {
+ cache->mouse[0] - cache->vc->ar->winrct.xmin,
+ cache->mouse[1] - cache->vc->ar->winrct.ymin
+ };
int tool = brush->sculpt_tool;
- if(ELEM5(tool,
+ if (ELEM5(tool,
SCULPT_TOOL_GRAB, SCULPT_TOOL_NUDGE,
- SCULPT_TOOL_CLAY_TUBES, SCULPT_TOOL_SNAKE_HOOK,
+ SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_SNAKE_HOOK,
SCULPT_TOOL_THUMB)) {
float grab_location[3], imat[4][4], delta[3], loc[3];
- if(cache->first_time) {
+ if (cache->first_time) {
copy_v3_v3(cache->orig_grab_location,
cache->true_location);
}
- else if(tool == SCULPT_TOOL_SNAKE_HOOK)
+ else if (tool == SCULPT_TOOL_SNAKE_HOOK)
add_v3_v3(cache->true_location, cache->grab_delta);
/* compute 3d coordinate at same z from original location + mouse */
mul_v3_m4v3(loc, ob->obmat, cache->orig_grab_location);
initgrabz(cache->vc->rv3d, loc[0], loc[1], loc[2]);
- ED_view3d_win_to_delta(cache->vc->ar, cache->mouse, grab_location);
+ ED_view3d_win_to_3d(cache->vc->ar, loc, mouse, grab_location);
/* compute delta to move verts by */
- if(!cache->first_time) {
+ if (!cache->first_time) {
switch(tool) {
case SCULPT_TOOL_GRAB:
case SCULPT_TOOL_THUMB:
@@ -2977,14 +2974,19 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
mul_mat3_m4_v3(imat, delta);
add_v3_v3(cache->grab_delta, delta);
break;
- case SCULPT_TOOL_CLAY_TUBES:
+ case SCULPT_TOOL_CLAY_STRIPS:
case SCULPT_TOOL_NUDGE:
- sub_v3_v3v3(cache->grab_delta, grab_location, cache->old_grab_location);
- invert_m4_m4(imat, ob->obmat);
- mul_mat3_m4_v3(imat, cache->grab_delta);
- break;
case SCULPT_TOOL_SNAKE_HOOK:
- sub_v3_v3v3(cache->grab_delta, grab_location, cache->old_grab_location);
+ if (brush->flag & BRUSH_ANCHORED) {
+ float orig[3];
+ mul_v3_m4v3(orig, ob->obmat, cache->orig_grab_location);
+ sub_v3_v3v3(cache->grab_delta, grab_location, orig);
+ }
+ else {
+ sub_v3_v3v3(cache->grab_delta, grab_location,
+ cache->old_grab_location);
+ }
+
invert_m4_m4(imat, ob->obmat);
mul_mat3_m4_v3(imat, cache->grab_delta);
break;
@@ -2996,12 +2998,12 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
copy_v3_v3(cache->old_grab_location, grab_location);
- if(tool == SCULPT_TOOL_GRAB)
+ if (tool == SCULPT_TOOL_GRAB)
copy_v3_v3(sd->anchored_location, cache->true_location);
- else if(tool == SCULPT_TOOL_THUMB)
+ else if (tool == SCULPT_TOOL_THUMB)
copy_v3_v3(sd->anchored_location, cache->orig_grab_location);
- if(ELEM(tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB)) {
+ if (ELEM(tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB)) {
/* location stays the same for finding vertices in brush radius */
copy_v3_v3(cache->true_location, cache->orig_grab_location);
@@ -3024,7 +3026,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
int dx, dy;
- //RNA_float_get_array(ptr, "location", cache->traced_location);
+ /* RNA_float_get_array(ptr, "location", cache->traced_location); */
if (cache->first_time ||
!((brush->flag & BRUSH_ANCHORED)||
@@ -3043,7 +3045,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
* brush coord/pressure/etc.
* It's more an events design issue, which doesn't split coordinate/pressure/angle
* changing events. We should avoid this after events system re-design */
- if(paint_space_stroke_enabled(brush) || cache->first_time)
+ if (paint_space_stroke_enabled(brush) || cache->first_time)
cache->pressure = RNA_float_get(ptr, "pressure");
/* Truly temporary data that isn't stored in properties */
@@ -3054,7 +3056,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
cache->previous_pixel_radius = cache->pixel_radius;
cache->pixel_radius = brush_size(scene, brush);
- if(cache->first_time) {
+ if (cache->first_time) {
if (!brush_use_locked_size(scene, brush)) {
cache->initial_radius= paint_calc_object_space_radius(cache->vc, cache->true_location, brush_size(scene, brush));
brush_set_unprojected_radius(scene, brush, cache->initial_radius);
@@ -3064,7 +3066,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
}
}
- if(brush_use_size_pressure(scene, brush)) {
+ if (brush_use_size_pressure(scene, brush)) {
cache->pixel_radius *= cache->pressure;
cache->radius= cache->initial_radius * cache->pressure;
}
@@ -3073,7 +3075,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
cache->radius_squared = cache->radius*cache->radius;
- if(!(brush->flag & BRUSH_ANCHORED ||
+ if (!(brush->flag & BRUSH_ANCHORED ||
ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK,
SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) {
copy_v2_v2(cache->tex_mouse, cache->mouse);
@@ -3086,7 +3088,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
}
}
- if(brush->flag & BRUSH_ANCHORED) {
+ if (brush->flag & BRUSH_ANCHORED) {
int hit = 0;
dx = cache->mouse[0] - cache->initial_mouse[0];
@@ -3126,7 +3128,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
sd->draw_anchored = 1;
}
- else if(brush->flag & BRUSH_RAKE) {
+ else if (brush->flag & BRUSH_RAKE) {
const float u = 0.5f;
const float v = 1 - u;
const float r = 20;
@@ -3147,7 +3149,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
sculpt_update_brush_delta(sd, ob, brush);
- if(brush->sculpt_tool == SCULPT_TOOL_ROTATE) {
+ if (brush->sculpt_tool == SCULPT_TOOL_ROTATE) {
dx = cache->mouse[0] - cache->initial_mouse[0];
dy = cache->mouse[1] - cache->initial_mouse[1];
@@ -3166,7 +3168,7 @@ static void sculpt_stroke_modifiers_check(bContext *C, Object *ob)
{
SculptSession *ss = ob->sculpt;
- if(ss->modifiers_active) {
+ if (ss->modifiers_active) {
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
Brush *brush = paint_brush(&sd->paint);
@@ -3188,7 +3190,7 @@ static void sculpt_raycast_cb(PBVHNode *node, void *data_v, float* tmin)
SculptRaycastData *srd = data_v;
float (*origco)[3]= NULL;
- if(srd->original && srd->ss->cache) {
+ if (srd->original && srd->ss->cache) {
/* intersect with coordinates from before we started stroke */
SculptUndoNode *unode= sculpt_undo_get_node(node);
origco= (unode)? unode->co: NULL;
@@ -3258,7 +3260,7 @@ static void sculpt_brush_init_tex(const Scene *scene, Sculpt *sd, SculptSession
MTex *mtex= &brush->mtex;
/* init mtex nodes */
- if(mtex->tex && mtex->tex->nodetree)
+ if (mtex->tex && mtex->tex->nodetree)
ntreeTexBeginExecTree(mtex->tex->nodetree, 1); /* has internal flag to detect it only does it once */
/* TODO: Shouldn't really have to do this at the start of every
@@ -3293,7 +3295,7 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
Brush *brush = paint_brush(&sd->paint);
/* Restore the mesh before continuing with anchored stroke */
- if((brush->flag & BRUSH_ANCHORED) ||
+ if ((brush->flag & BRUSH_ANCHORED) ||
(brush->sculpt_tool == SCULPT_TOOL_GRAB &&
brush_use_size_pressure(ss->cache->vc->scene, brush)) ||
(brush->flag & BRUSH_RESTORE_MESH))
@@ -3307,19 +3309,19 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for(n=0; n<totnode; n++) {
+ for (n=0; n<totnode; n++) {
SculptUndoNode *unode;
unode= sculpt_undo_get_node(nodes[n]);
- if(unode) {
+ if (unode) {
PBVHVertexIter vd;
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
copy_v3_v3(vd.co, unode->co[vd.i]);
- if(vd.no) copy_v3_v3_short(vd.no, unode->no[vd.i]);
+ if (vd.no) copy_v3_v3_short(vd.no, unode->no[vd.i]);
else normal_short_to_float_v3(vd.fno, unode->no[vd.i]);
- if(vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ if (vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
BLI_pbvh_vertex_iter_end;
@@ -3327,13 +3329,13 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
}
}
- if(ss->face_normals) {
+ if (ss->face_normals) {
float *fn = ss->face_normals;
- for(i = 0; i < ss->totpoly; ++i, fn += 3)
+ for (i = 0; i < ss->totpoly; ++i, fn += 3)
copy_v3_v3(fn, cache->face_norms[i]);
}
- if(nodes)
+ if (nodes)
MEM_freeN(nodes);
}
}
@@ -3345,12 +3347,12 @@ static void sculpt_flush_update(bContext *C)
ARegion *ar = CTX_wm_region(C);
MultiresModifierData *mmd = ss->multires;
- if(mmd)
- multires_mark_as_modified(ob);
- if(ob->derivedFinal) /* VBO no longer valid */
+ if (mmd)
+ multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
+ if (ob->derivedFinal) /* VBO no longer valid */
GPU_drawobject_free(ob->derivedFinal);
- if(ss->modifiers_active) {
+ if (ss->modifiers_active) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
ED_region_tag_redraw(ar);
}
@@ -3390,7 +3392,7 @@ static int sculpt_stroke_test_start(bContext *C, struct wmOperator *op,
{
/* Don't start the stroke until mouse goes over the mesh.
* note: event will only be null when re-executing the saved stroke. */
- if(event==NULL || over_mesh(C, op, event->x, event->y)) {
+ if (event==NULL || over_mesh(C, op, event->x, event->y)) {
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
@@ -3440,7 +3442,7 @@ static void sculpt_brush_exit_tex(Sculpt *sd)
Brush *brush= paint_brush(&sd->paint);
MTex *mtex= &brush->mtex;
- if(mtex->tex && mtex->tex->nodetree)
+ if (mtex->tex && mtex->tex->nodetree)
ntreeTexEndExecTree(mtex->tex->nodetree->execdata, 1);
}
@@ -3450,13 +3452,13 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *UNUSED(stroke))
SculptSession *ss = ob->sculpt;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
- // reset values used to draw brush after completing the stroke
+ /* reset values used to draw brush after completing the stroke */
sd->draw_anchored= 0;
sd->draw_pressure= 0;
sd->special_rotation= 0;
/* Finished */
- if(ss->cache) {
+ if (ss->cache) {
Brush *brush= paint_brush(&sd->paint);
brush->flag &= ~BRUSH_INVERTED;
@@ -3466,7 +3468,7 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *UNUSED(stroke))
if (ss->cache->alt_smooth) {
Paint *p= &sd->paint;
brush= (Brush *)find_id("BR", ss->cache->saved_active_brush_name);
- if(brush) {
+ if (brush) {
paint_brush_set(p, brush);
}
}
@@ -3481,12 +3483,12 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *UNUSED(stroke))
/* optimization: if there is locked key and active modifiers present in */
/* the stack, keyblock is updating at each step. otherwise we could update */
/* keyblock only when stroke is finished */
- if(ss->kb && !ss->modifiers_active) sculpt_update_keyblock(ob);
+ if (ss->kb && !ss->modifiers_active) sculpt_update_keyblock(ob);
ss->partial_redraw = 0;
/* try to avoid calling this, only for e.g. linked duplicates now */
- if(((Mesh*)ob->data)->id.us > 1)
+ if (((Mesh*)ob->data)->id.us > 1)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
@@ -3500,7 +3502,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even
struct PaintStroke *stroke;
int ignore_background_click;
- if(!sculpt_brush_stroke_init(C, op))
+ if (!sculpt_brush_stroke_init(C, op))
return OPERATOR_CANCELLED;
stroke = paint_stroke_new(C, sculpt_stroke_get_location,
@@ -3514,7 +3516,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even
ignore_background_click = RNA_boolean_get(op->ptr,
"ignore_background_click");
- if(ignore_background_click && !over_mesh(C, op, event->x, event->y)) {
+ if (ignore_background_click && !over_mesh(C, op, event->x, event->y)) {
paint_stroke_free(stroke);
return OPERATOR_PASS_THROUGH;
}
@@ -3529,7 +3531,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even
static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op)
{
- if(!sculpt_brush_stroke_init(C, op))
+ if (!sculpt_brush_stroke_init(C, op))
return OPERATOR_CANCELLED;
op->customdata = paint_stroke_new(C, sculpt_stroke_get_location, sculpt_stroke_test_start,
@@ -3549,7 +3551,7 @@ static int sculpt_brush_stroke_cancel(bContext *C, wmOperator *op)
paint_stroke_cancel(C, op);
- if(ss->cache) {
+ if (ss->cache) {
sculpt_cache_free(ss->cache);
ss->cache = NULL;
}
@@ -3569,18 +3571,18 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Sculpt Mode";
- ot->idname= "SCULPT_OT_brush_stroke";
+ ot->name = "Sculpt Mode";
+ ot->idname = "SCULPT_OT_brush_stroke";
/* api callbacks */
- ot->invoke= sculpt_brush_stroke_invoke;
- ot->modal= paint_stroke_modal;
- ot->exec= sculpt_brush_stroke_exec;
- ot->poll= sculpt_poll;
- ot->cancel= sculpt_brush_stroke_cancel;
+ ot->invoke = sculpt_brush_stroke_invoke;
+ ot->modal = paint_stroke_modal;
+ ot->exec = sculpt_brush_stroke_exec;
+ ot->poll = sculpt_poll;
+ ot->cancel = sculpt_brush_stroke_cancel;
/* flags (sculpt does own undo? (ton) */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
/* properties */
@@ -3602,8 +3604,8 @@ static int sculpt_set_persistent_base(bContext *C, wmOperator *UNUSED(op))
{
SculptSession *ss = CTX_data_active_object(C)->sculpt;
- if(ss) {
- if(ss->layer_co)
+ if (ss) {
+ if (ss->layer_co)
MEM_freeN(ss->layer_co);
ss->layer_co = NULL;
}
@@ -3614,14 +3616,14 @@ static int sculpt_set_persistent_base(bContext *C, wmOperator *UNUSED(op))
static void SCULPT_OT_set_persistent_base(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Persistent Base";
- ot->idname= "SCULPT_OT_set_persistent_base";
+ ot->name = "Set Persistent Base";
+ ot->idname = "SCULPT_OT_set_persistent_base";
/* api callbacks */
- ot->exec= sculpt_set_persistent_base;
- ot->poll= sculpt_mode_poll;
+ ot->exec = sculpt_set_persistent_base;
+ ot->poll = sculpt_mode_poll;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/**** Toggle operator for turning sculpt mode on or off ****/
@@ -3646,11 +3648,11 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
/* if object has got active modifiers, it's dm could be different in sculpt mode */
flush_recalc |= sculpt_has_active_modifiers(scene, ob);
- if(ob->mode & OB_MODE_SCULPT) {
- if(mmd)
+ if (ob->mode & OB_MODE_SCULPT) {
+ if (mmd)
multires_force_update(ob);
- if(flush_recalc)
+ if (flush_recalc)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* Leave sculptmode */
@@ -3662,11 +3664,11 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
/* Enter sculptmode */
ob->mode |= OB_MODE_SCULPT;
- if(flush_recalc)
+ if (flush_recalc)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* Create persistent sculpt mode data */
- if(!ts->sculpt) {
+ if (!ts->sculpt) {
ts->sculpt = MEM_callocN(sizeof(Sculpt), "sculpt mode data");
/* Turn on X plane mirror symmetry by default */
@@ -3674,7 +3676,7 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
}
/* Create sculpt mode session data */
- if(ob->sculpt)
+ if (ob->sculpt)
free_sculptsession(ob);
sculpt_init_session(scene, ob);
@@ -3692,14 +3694,14 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Sculpt Mode";
- ot->idname= "SCULPT_OT_sculptmode_toggle";
+ ot->name = "Sculpt Mode";
+ ot->idname = "SCULPT_OT_sculptmode_toggle";
/* api callbacks */
- ot->exec= sculpt_toggle_mode;
- ot->poll= ED_operator_object_active_editable_mesh;
+ ot->exec = sculpt_toggle_mode;
+ ot->poll = ED_operator_object_active_editable_mesh;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
void ED_operatortypes_sculpt(void)
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 8ece42b7d2f..8ccf55ec4fb 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -37,6 +37,7 @@
#include "DNA_vec_types.h"
#include "DNA_key_types.h"
+#include "BLI_bitmap.h"
#include "BLI_pbvh.h"
struct bContext;
@@ -54,6 +55,7 @@ struct MultiresModifierData *sculpt_multires_active(struct Scene *scene, struct
void sculpt(Sculpt *sd);
+int sculpt_mode_poll(struct bContext *C);
int sculpt_poll(struct bContext *C);
void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob, int need_pmap);
@@ -65,9 +67,16 @@ int sculpt_stroke_get_location(bContext *C, float out[3], float mouse[2]);
/* Undo */
+typedef enum {
+ SCULPT_UNDO_COORDS,
+ SCULPT_UNDO_HIDDEN
+} SculptUndoType;
+
typedef struct SculptUndoNode {
struct SculptUndoNode *next, *prev;
+ SculptUndoType type;
+
char idname[MAX_ID_NAME]; /* name instead of pointer*/
void *node; /* only during push, not valid afterwards! */
@@ -79,12 +88,14 @@ typedef struct SculptUndoNode {
/* non-multires */
int maxvert; /* to verify if totvert it still the same */
int *index; /* to restore into right location */
+ BLI_bitmap vert_hidden;
/* multires */
int maxgrid; /* same for grid */
int gridsize; /* same for grid */
int totgrid; /* to restore into right location */
int *grids; /* to restore into right location */
+ BLI_bitmap *grid_hidden;
/* layer brush */
float *layer_disp;
@@ -93,7 +104,7 @@ typedef struct SculptUndoNode {
char shapeName[sizeof(((KeyBlock *)0))->name];
} SculptUndoNode;
-SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node);
+SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node, SculptUndoType type);
SculptUndoNode *sculpt_undo_get_node(PBVHNode *node);
void sculpt_undo_push_begin(const char *name);
void sculpt_undo_push_end(void);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 84b8b5a8bce..73fa546b357 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -55,6 +55,7 @@
#include "BKE_paint.h"
#include "BKE_key.h"
#include "BKE_mesh.h"
+#include "BKE_subsurf.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -67,17 +68,23 @@
/************************** Undo *************************/
-static void update_cb(PBVHNode *node, void *UNUSED(unused))
+static void update_cb(PBVHNode *node, void *rebuild)
{
BLI_pbvh_node_mark_update(node);
+ if (*((int*)rebuild))
+ BLI_pbvh_node_mark_rebuild_draw(node);
+ BLI_pbvh_node_fully_hidden_set(node, 0);
}
static void sculpt_undo_restore_deformed(SculptSession *ss, SculptUndoNode *unode, int uindex, int oindex, float coord[3])
{
- if(unode->orig_co) {
+ if (unode->orig_co) {
swap_v3_v3(coord, unode->orig_co[uindex]);
copy_v3_v3(unode->co[uindex], ss->deform_cos[oindex]);
- } else swap_v3_v3(coord, unode->co[uindex]);
+ }
+ else {
+ swap_v3_v3(coord, unode->co[uindex]);
+ }
}
static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNode *unode)
@@ -89,7 +96,7 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
MVert *mvert;
int *index, i, j;
- if(unode->maxvert) {
+ if (unode->maxvert) {
/* regular mesh restore */
if (ss->kb && strcmp(ss->kb->name, unode->shapeName)) {
@@ -103,7 +110,8 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
sculpt_update_mesh_elements(scene, sd, ob, 0);
WM_event_add_notifier(C, NC_OBJECT|ND_DATA, ob);
- } else {
+ }
+ else {
/* key has been removed -- skip this undo node */
return 0;
}
@@ -116,10 +124,10 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
float (*vertCos)[3];
vertCos= key_to_vertcos(ob, ss->kb);
- for(i=0; i<unode->totvert; i++) {
- if(ss->modifiers_active) sculpt_undo_restore_deformed(ss, unode, i, index[i], vertCos[index[i]]);
+ for (i=0; i<unode->totvert; i++) {
+ if (ss->modifiers_active) sculpt_undo_restore_deformed(ss, unode, i, index[i], vertCos[index[i]]);
else {
- if(unode->orig_co) swap_v3_v3(vertCos[index[i]], unode->orig_co[i]);
+ if (unode->orig_co) swap_v3_v3(vertCos[index[i]], unode->orig_co[i]);
else swap_v3_v3(vertCos[index[i]], unode->co[i]);
}
}
@@ -132,18 +140,19 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
BLI_pbvh_apply_vertCos(ss->pbvh, vertCos);
MEM_freeN(vertCos);
- } else {
- for(i=0; i<unode->totvert; i++) {
- if(ss->modifiers_active) sculpt_undo_restore_deformed(ss, unode, i, index[i], mvert[index[i]].co);
+ }
+ else {
+ for (i=0; i<unode->totvert; i++) {
+ if (ss->modifiers_active) sculpt_undo_restore_deformed(ss, unode, i, index[i], mvert[index[i]].co);
else {
- if(unode->orig_co) swap_v3_v3(mvert[index[i]].co, unode->orig_co[i]);
+ if (unode->orig_co) swap_v3_v3(mvert[index[i]].co, unode->orig_co[i]);
else swap_v3_v3(mvert[index[i]].co, unode->co[i]);
}
mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE;
}
}
}
- else if(unode->maxgrid && dm->getGridData) {
+ else if (unode->maxgrid && dm->getGridData) {
/* multires restore */
DMGridData **grids, *grid;
float (*co)[3];
@@ -153,10 +162,10 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
gridsize= dm->getGridSize(dm);
co = unode->co;
- for(j=0; j<unode->totgrid; j++) {
+ for (j=0; j<unode->totgrid; j++) {
grid= grids[unode->grids[j]];
- for(i=0; i<gridsize*gridsize; i++, co++)
+ for (i=0; i<gridsize*gridsize; i++, co++)
swap_v3_v3(grid[i].co, co[0]);
}
}
@@ -164,6 +173,44 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
return 1;
}
+static int sculpt_undo_restore_hidden(bContext *C, DerivedMesh *dm,
+ SculptUndoNode *unode)
+{
+ Object *ob = CTX_data_active_object(C);
+ SculptSession *ss = ob->sculpt;
+ int i;
+
+ if (unode->maxvert) {
+ MVert *mvert= ss->mvert;
+
+ for (i=0; i<unode->totvert; i++) {
+ MVert *v = &mvert[unode->index[i]];
+ int uval= BLI_BITMAP_GET(unode->vert_hidden, i);
+
+ BLI_BITMAP_MODIFY(unode->vert_hidden, i,
+ v->flag & ME_HIDE);
+ if (uval)
+ v->flag |= ME_HIDE;
+ else
+ v->flag &= ~ME_HIDE;
+
+ v->flag |= ME_VERT_PBVH_UPDATE;
+ }
+ }
+ else if (unode->maxgrid && dm->getGridData) {
+ BLI_bitmap *grid_hidden = dm->getGridHidden(dm);
+
+ for (i=0; i<unode->totgrid; i++) {
+ SWAP(BLI_bitmap,
+ unode->grid_hidden[i],
+ grid_hidden[unode->grids[i]]);
+
+ }
+ }
+
+ return 1;
+}
+
static void sculpt_undo_restore(bContext *C, ListBase *lb)
{
Scene *scene = CTX_data_scene(C);
@@ -173,22 +220,22 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
SculptSession *ss = ob->sculpt;
SculptUndoNode *unode;
MultiresModifierData *mmd;
- int update= 0;
+ int update= 0, rebuild= 1;
sculpt_update_mesh_elements(scene, sd, ob, 0);
- for(unode=lb->first; unode; unode=unode->next) {
- if(!(strcmp(unode->idname, ob->id.name)==0))
+ for (unode=lb->first; unode; unode=unode->next) {
+ if (!(strcmp(unode->idname, ob->id.name)==0))
continue;
/* check if undo data matches current data well enough to
* continue */
- if(unode->maxvert) {
- if(ss->totvert != unode->maxvert)
+ if (unode->maxvert) {
+ if (ss->totvert != unode->maxvert)
continue;
}
- else if(unode->maxgrid && dm->getGridData) {
- if((dm->getNumGrids(dm) != unode->maxgrid) ||
+ else if (unode->maxgrid && dm->getGridData) {
+ if ((dm->getNumGrids(dm) != unode->maxgrid) ||
(dm->getGridSize(dm) != unode->gridsize))
continue;
}
@@ -196,24 +243,36 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
continue;
}
- if(sculpt_undo_restore_coords(C, dm, unode))
- update= 1;
+ switch(unode->type) {
+ case SCULPT_UNDO_COORDS:
+ if (sculpt_undo_restore_coords(C, dm, unode))
+ update= 1;
+ break;
+ case SCULPT_UNDO_HIDDEN:
+ if (sculpt_undo_restore_hidden(C, dm, unode))
+ rebuild= 1;
+ break;
+ }
}
- if(update) {
+ if (update || rebuild) {
int tag_update= 0;
/* we update all nodes still, should be more clever, but also
* needs to work correct when exiting/entering sculpt mode and
* the nodes get recreated, though in that case it could do all */
- BLI_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb, NULL);
+ BLI_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb, &rebuild);
BLI_pbvh_update(ss->pbvh, PBVH_UpdateBB|PBVH_UpdateOriginalBB|PBVH_UpdateRedraw, NULL);
- if((mmd=sculpt_multires_active(scene, ob)))
- multires_mark_as_modified(ob);
+ if ((mmd=sculpt_multires_active(scene, ob))) {
+ if (rebuild)
+ multires_mark_as_modified(ob, MULTIRES_HIDDEN_MODIFIED);
+ else
+ multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
+ }
tag_update= ((Mesh*)ob->data)->id.us > 1;
- if(ss->modifiers_active) {
+ if (ss->modifiers_active) {
Mesh *mesh= ob->data;
mesh_calc_normals_mapping(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, NULL, NULL, 0, NULL, NULL);
@@ -221,7 +280,7 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
tag_update|= 1;
}
- if(tag_update)
+ if (tag_update)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* for non-PBVH drawing, need to recreate VBOs */
@@ -232,20 +291,30 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
static void sculpt_undo_free(ListBase *lb)
{
SculptUndoNode *unode;
+ int i;
- for(unode=lb->first; unode; unode=unode->next) {
- if(unode->co)
+ for (unode=lb->first; unode; unode=unode->next) {
+ if (unode->co)
MEM_freeN(unode->co);
- if(unode->no)
+ if (unode->no)
MEM_freeN(unode->no);
- if(unode->index)
+ if (unode->index)
MEM_freeN(unode->index);
- if(unode->grids)
+ if (unode->grids)
MEM_freeN(unode->grids);
- if(unode->layer_disp)
+ if (unode->layer_disp)
MEM_freeN(unode->layer_disp);
- if(unode->orig_co)
+ if (unode->orig_co)
MEM_freeN(unode->orig_co);
+ if (unode->vert_hidden)
+ MEM_freeN(unode->vert_hidden);
+ if (unode->grid_hidden) {
+ for (i=0; i<unode->totgrid; i++) {
+ if (unode->grid_hidden[i])
+ MEM_freeN(unode->grid_hidden[i]);
+ }
+ MEM_freeN(unode->grid_hidden);
+ }
}
}
@@ -254,17 +323,41 @@ SculptUndoNode *sculpt_undo_get_node(PBVHNode *node)
ListBase *lb= undo_paint_push_get_list(UNDO_PAINT_MESH);
SculptUndoNode *unode;
- if(!lb)
+ if (!lb)
return NULL;
- for(unode=lb->first; unode; unode=unode->next)
- if(unode->node == node)
+ for (unode=lb->first; unode; unode=unode->next)
+ if (unode->node == node)
return unode;
return NULL;
}
-SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node)
+static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh,
+ SculptUndoNode *unode)
+{
+ PBVHNode *node= unode->node;
+ BLI_bitmap *grid_hidden;
+ int i, *grid_indices, totgrid;
+
+ grid_hidden= BLI_pbvh_grid_hidden(pbvh);
+
+ BLI_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid,
+ NULL, NULL, NULL, NULL);
+
+ unode->grid_hidden= MEM_mapallocN(sizeof(BLI_bitmap) * totgrid,
+ "unode->grid_hidden");
+
+ for (i = 0; i < totgrid; i++) {
+ if (grid_hidden[grid_indices[i]])
+ unode->grid_hidden[i] = MEM_dupallocN(grid_hidden[grid_indices[i]]);
+ else
+ unode->grid_hidden[i] = NULL;
+ }
+}
+
+static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node,
+ SculptUndoType type)
{
ListBase *lb= undo_paint_push_get_list(UNDO_PAINT_MESH);
SculptUndoNode *unode;
@@ -273,6 +366,7 @@ SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node)
unode= MEM_callocN(sizeof(SculptUndoNode), "SculptUndoNode");
BLI_strncpy(unode->idname, ob->id.name, sizeof(unode->idname));
+ unode->type= type;
unode->node= node;
BLI_pbvh_node_num_verts(ss->pbvh, node, &totvert, &allvert);
@@ -280,13 +374,28 @@ SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node)
&maxgrid, &gridsize, NULL, NULL);
unode->totvert= totvert;
+
/* we will use this while sculpting, is mapalloc slow to access then? */
- unode->co= MEM_mapallocN(sizeof(float)*3*allvert, "SculptUndoNode.co");
- unode->no= MEM_mapallocN(sizeof(short)*3*allvert, "SculptUndoNode.no");
- undo_paint_push_count_alloc(UNDO_PAINT_MESH, (sizeof(float)*3 + sizeof(short)*3 + sizeof(int))*allvert);
+
+ /* general TODO, fix count_alloc */
+ switch(type) {
+ case SCULPT_UNDO_COORDS:
+ unode->co= MEM_mapallocN(sizeof(float)*3*allvert, "SculptUndoNode.co");
+ unode->no= MEM_mapallocN(sizeof(short)*3*allvert, "SculptUndoNode.no");
+ undo_paint_push_count_alloc(UNDO_PAINT_MESH, (sizeof(float)*3 + sizeof(short)*3 + sizeof(int))*allvert);
+ break;
+ case SCULPT_UNDO_HIDDEN:
+ if (maxgrid)
+ sculpt_undo_alloc_and_store_hidden(ss->pbvh, unode);
+ else
+ unode->vert_hidden= BLI_BITMAP_NEW(allvert, "SculptUndoNode.vert_hidden");
+
+ break;
+ }
+
BLI_addtail(lb, unode);
- if(maxgrid) {
+ if (maxgrid) {
/* multires */
unode->maxgrid= maxgrid;
unode->totgrid= totgrid;
@@ -299,13 +408,52 @@ SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node)
unode->index= MEM_mapallocN(sizeof(int)*allvert, "SculptUndoNode.index");
}
- if(ss->modifiers_active)
+ if (ss->modifiers_active)
unode->orig_co= MEM_callocN(allvert*sizeof(*unode->orig_co), "undoSculpt orig_cos");
return unode;
}
-SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node)
+static void sculpt_undo_store_coords(Object *ob, SculptUndoNode *unode)
+{
+ SculptSession *ss = ob->sculpt;
+ PBVHVertexIter vd;
+
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL) {
+ copy_v3_v3(unode->co[vd.i], vd.co);
+ if (vd.no) copy_v3_v3_short(unode->no[vd.i], vd.no);
+ else normal_float_to_short_v3(unode->no[vd.i], vd.fno);
+
+ if (ss->modifiers_active)
+ copy_v3_v3(unode->orig_co[vd.i], ss->orig_cos[unode->index[vd.i]]);
+ }
+ BLI_pbvh_vertex_iter_end;
+}
+
+static void sculpt_undo_store_hidden(Object *ob, SculptUndoNode *unode)
+{
+ PBVH *pbvh= ob->sculpt->pbvh;
+ PBVHNode *node= unode->node;
+
+ if (unode->grids) {
+ /* already stored during allocation */
+ }
+ else {
+ MVert *mvert;
+ int *vert_indices, allvert;
+ int i;
+
+ BLI_pbvh_node_num_verts(pbvh, node, NULL, &allvert);
+ BLI_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
+ for (i = 0; i < allvert; i++) {
+ BLI_BITMAP_MODIFY(unode->vert_hidden, i,
+ mvert[vert_indices[i]].flag & ME_HIDE);
+ }
+ }
+}
+
+SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node,
+ SculptUndoType type)
{
SculptSession *ss = ob->sculpt;
SculptUndoNode *unode;
@@ -313,40 +461,40 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node)
/* list is manipulated by multiple threads, so we lock */
BLI_lock_thread(LOCK_CUSTOM1);
- if((unode= sculpt_undo_get_node(node))) {
+ if ((unode= sculpt_undo_get_node(node))) {
BLI_unlock_thread(LOCK_CUSTOM1);
return unode;
}
- unode= sculpt_undo_alloc_node(ob, node);
-
+ unode= sculpt_undo_alloc_node(ob, node, type);
+
BLI_unlock_thread(LOCK_CUSTOM1);
/* copy threaded, hopefully this is the performance critical part */
- {
- PBVHVertexIter vd;
-
- BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_ALL) {
- copy_v3_v3(unode->co[vd.i], vd.co);
- if(vd.no) copy_v3_v3_short(unode->no[vd.i], vd.no);
- else normal_float_to_short_v3(unode->no[vd.i], vd.fno);
- if(vd.vert_indices) unode->index[vd.i]= vd.vert_indices[vd.i];
-
- if(ss->modifiers_active)
- copy_v3_v3(unode->orig_co[vd.i], ss->orig_cos[unode->index[vd.i]]);
- }
- BLI_pbvh_vertex_iter_end;
+ switch(type) {
+ case SCULPT_UNDO_COORDS:
+ sculpt_undo_store_coords(ob, unode);
+ break;
+ case SCULPT_UNDO_HIDDEN:
+ sculpt_undo_store_hidden(ob, unode);
+ break;
}
- if(unode->grids) {
+ if (unode->grids) {
int totgrid, *grids;
BLI_pbvh_node_get_grids(ss->pbvh, node, &grids, &totgrid,
NULL, NULL, NULL, NULL);
memcpy(unode->grids, grids, sizeof(int)*totgrid);
}
+ else {
+ int *vert_indices, allvert;
+ BLI_pbvh_node_num_verts(ss->pbvh, node, NULL, &allvert);
+ BLI_pbvh_node_get_verts(ss->pbvh, node, &vert_indices, NULL);
+ memcpy(unode->index, vert_indices, sizeof(int)*unode->totvert);
+ }
/* store active shape key */
- if(ss->kb) BLI_strncpy(unode->shapeName, ss->kb->name, sizeof(ss->kb->name));
+ if (ss->kb) BLI_strncpy(unode->shapeName, ss->kb->name, sizeof(ss->kb->name));
else unode->shapeName[0]= '\0';
return unode;
@@ -364,13 +512,13 @@ void sculpt_undo_push_end(void)
SculptUndoNode *unode;
/* we don't need normals in the undo stack */
- for(unode=lb->first; unode; unode=unode->next) {
- if(unode->no) {
+ for (unode=lb->first; unode; unode=unode->next) {
+ if (unode->no) {
MEM_freeN(unode->no);
unode->no= NULL;
}
- if(unode->layer_disp) {
+ if (unode->layer_disp) {
MEM_freeN(unode->layer_disp);
unode->layer_disp= NULL;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 72e9f861aa9..240a8feeb88 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -372,7 +372,8 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, wmEvent *event,
unsigned int method = toolsettings->uv_relax_method;
if (method == UV_SCULPT_TOOL_RELAX_HC) {
HC_relaxation_iteration_uv(em, sculptdata, co, alpha, radius, aspectRatio);
- }else{
+ }
+ else {
laplacian_relaxation_iteration_uv(em, sculptdata, co, alpha, radius, aspectRatio);
}
}
@@ -501,13 +502,16 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
/* We will need island information */
if (ts->uv_flag & UV_SYNC_SELECTION) {
data->elementMap = EDBM_make_uv_element_map(em, 0, 1);
- }else{
+ }
+ else {
data->elementMap = EDBM_make_uv_element_map(em, 1, 1);
}
- }else {
+ }
+ else {
if (ts->uv_flag & UV_SYNC_SELECTION) {
data->elementMap = EDBM_make_uv_element_map(em, 0, 0);
- }else{
+ }
+ else {
data->elementMap = EDBM_make_uv_element_map(em, 1, 0);
}
}
@@ -610,7 +614,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
edges[counter].uv1 = offset1;
edges[counter].uv2 = offset2;
}
- else{
+ else {
edges[counter].uv1 = offset2;
edges[counter].uv2 = offset1;
}
@@ -619,7 +623,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
char *flag = BLI_ghash_lookup(edgeHash, &edges[counter]);
*flag = 1;
}
- else{
+ else {
/* Hack mentioned */
BLI_ghash_insert(edgeHash, &edges[counter], &edges[counter].flag);
}
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 8f6a01dc6cd..f7598045f81 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -105,11 +105,11 @@ static int sound_open_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
sound = sound_new_file(bmain, path);
- if(!op->customdata)
+ if (!op->customdata)
sound_open_init(C, op);
if (sound==NULL || sound->playback_handle == NULL) {
- if(op->customdata) MEM_freeN(op->customdata);
+ if (op->customdata) MEM_freeN(op->customdata);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
}
@@ -118,12 +118,12 @@ static int sound_open_exec(bContext *C, wmOperator *op)
if (info.specs.channels == AUD_CHANNELS_INVALID) {
sound_delete(bmain, sound);
- if(op->customdata) MEM_freeN(op->customdata);
+ if (op->customdata) MEM_freeN(op->customdata);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
}
- if(RNA_boolean_get(op->ptr, "mono")) {
+ if (RNA_boolean_get(op->ptr, "mono")) {
sound->flags |= SOUND_FLAGS_MONO;
sound_load(bmain, sound);
}
@@ -135,7 +135,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
/* hook into UI */
pprop= op->customdata;
- if(pprop->prop) {
+ if (pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
sound->id.us--;
@@ -145,7 +145,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
RNA_property_update(C, &pprop->ptr, pprop->prop);
}
- if(op->customdata) MEM_freeN(op->customdata);
+ if (op->customdata) MEM_freeN(op->customdata);
return OPERATOR_FINISHED;
}
@@ -162,7 +162,7 @@ static int sound_open_exec(bContext *UNUSED(C), wmOperator *op)
static int sound_open_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return sound_open_exec(C, op);
sound_open_init(C, op);
@@ -173,17 +173,17 @@ static int sound_open_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void SOUND_OT_open(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Open Sound";
- ot->description= "Load a sound file";
- ot->idname= "SOUND_OT_open";
+ ot->name = "Open Sound";
+ ot->description = "Load a sound file";
+ ot->idname = "SOUND_OT_open";
/* api callbacks */
- ot->exec= sound_open_exec;
- ot->invoke= sound_open_invoke;
- ot->cancel= sound_open_cancel;
+ ot->exec = sound_open_exec;
+ ot->invoke = sound_open_invoke;
+ ot->cancel = sound_open_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -194,17 +194,17 @@ static void SOUND_OT_open(wmOperatorType *ot)
static void SOUND_OT_open_mono(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Open Sound Mono";
- ot->description= "Load a sound file as mono";
- ot->idname= "SOUND_OT_open_mono";
+ ot->name = "Open Sound Mono";
+ ot->description = "Load a sound file as mono";
+ ot->idname = "SOUND_OT_open_mono";
/* api callbacks */
- ot->exec= sound_open_exec;
- ot->invoke= sound_open_invoke;
- ot->cancel= sound_open_cancel;
+ ot->exec = sound_open_exec;
+ ot->invoke = sound_open_invoke;
+ ot->cancel = sound_open_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -223,19 +223,19 @@ static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)
SEQ_BEGIN(scene->ed, seq) {
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, &driven);
- if(fcu || driven)
+ if (fcu || driven)
seq->flag |= SEQ_AUDIO_VOLUME_ANIMATED;
else
seq->flag &= ~SEQ_AUDIO_VOLUME_ANIMATED;
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pitch", 0, &driven);
- if(fcu || driven)
+ if (fcu || driven)
seq->flag |= SEQ_AUDIO_PITCH_ANIMATED;
else
seq->flag &= ~SEQ_AUDIO_PITCH_ANIMATED;
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pan", 0, &driven);
- if(fcu || driven)
+ if (fcu || driven)
seq->flag |= SEQ_AUDIO_PAN_ANIMATED;
else
seq->flag &= ~SEQ_AUDIO_PAN_ANIMATED;
@@ -243,7 +243,7 @@ static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)
SEQ_END
fcu = id_data_find_fcurve(&scene->id, scene, &RNA_Scene, "audio_volume", 0, &driven);
- if(fcu || driven)
+ if (fcu || driven)
scene->audio.flag |= AUDIO_VOLUME_ANIMATED;
else
scene->audio.flag &= ~AUDIO_VOLUME_ANIMATED;
@@ -261,15 +261,15 @@ static void SOUND_OT_update_animation_flags(wmOperatorType *ot)
*/
/* identifiers */
- ot->name= "Update animation";
- ot->description= "Update animation flags";
- ot->idname= "SOUND_OT_update_animation_flags";
+ ot->name = "Update animation";
+ ot->description = "Update animation flags";
+ ot->idname = "SOUND_OT_update_animation_flags";
/* api callbacks */
- ot->exec= sound_update_animation_flags_exec;
+ ot->exec = sound_update_animation_flags_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
/* ******************************************************* */
@@ -283,7 +283,7 @@ static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
sound_update_animation_flags_exec(C, NULL);
- for(cfra = scene->r.sfra > 0 ? scene->r.sfra - 1 : 0; cfra <= scene->r.efra + 1; cfra++)
+ for (cfra = scene->r.sfra > 0 ? scene->r.sfra - 1 : 0; cfra <= scene->r.efra + 1; cfra++)
{
scene->r.cfra = cfra;
scene_update_for_newframe(bmain, scene, scene->lay);
@@ -298,15 +298,15 @@ static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
static void SOUND_OT_bake_animation(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Update animation cache";
- ot->description= "Update the audio animation cache";
- ot->idname= "SOUND_OT_bake_animation";
+ ot->name = "Update animation cache";
+ ot->description = "Update the audio animation cache";
+ ot->idname = "SOUND_OT_bake_animation";
/* api callbacks */
- ot->exec= sound_bake_animation_exec;
+ ot->exec = sound_bake_animation_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
@@ -358,7 +358,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
static int sound_mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return sound_mixdown_exec(C, op);
return WM_operator_filesel(C, op, event);
@@ -571,19 +571,19 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
#endif // WITH_AUDASPACE
/* identifiers */
- ot->name= "Mixdown";
- ot->description= "Mixes the scene's audio to a sound file";
- ot->idname= "SOUND_OT_mixdown";
+ ot->name = "Mixdown";
+ ot->description = "Mixes the scene's audio to a sound file";
+ ot->idname = "SOUND_OT_mixdown";
/* api callbacks */
- ot->exec= sound_mixdown_exec;
- ot->invoke= sound_mixdown_invoke;
+ ot->exec = sound_mixdown_exec;
+ ot->invoke = sound_mixdown_invoke;
#ifdef WITH_AUDASPACE
- ot->ui= sound_mixdown_draw;
+ ot->ui = sound_mixdown_draw;
#endif
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -602,7 +602,7 @@ static int sound_poll(bContext *C)
{
Editing* ed = CTX_data_scene(C)->ed;
- if(!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
+ if (!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
return 0;
return 1;
@@ -615,12 +615,12 @@ static int sound_pack_exec(bContext *C, wmOperator *op)
Editing* ed = CTX_data_scene(C)->ed;
bSound* sound;
- if(!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
+ if (!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
return OPERATOR_CANCELLED;
sound = ed->act_seq->sound;
- if(!sound || sound->packedfile)
+ if (!sound || sound->packedfile)
return OPERATOR_CANCELLED;
sound->packedfile= newPackedFile(op->reports, sound->name, ID_BLEND_PATH(bmain, &sound->id));
@@ -632,16 +632,16 @@ static int sound_pack_exec(bContext *C, wmOperator *op)
static void SOUND_OT_pack(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Pack Sound";
- ot->description= "Pack the sound into the current blend file";
- ot->idname= "SOUND_OT_pack";
+ ot->name = "Pack Sound";
+ ot->description = "Pack the sound into the current blend file";
+ ot->idname = "SOUND_OT_pack";
/* api callbacks */
- ot->exec= sound_pack_exec;
- ot->poll= sound_poll;
+ ot->exec = sound_pack_exec;
+ ot->poll = sound_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************* unpack operator *********************/
@@ -658,10 +658,10 @@ static int sound_unpack_exec(bContext *C, wmOperator *op)
sound = BLI_findstring(&CTX_data_main(C)->sound, sndname, offsetof(ID, name) + 2);
}
- if(!sound || !sound->packedfile)
+ if (!sound || !sound->packedfile)
return OPERATOR_CANCELLED;
- if(G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_AUTOPACK)
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
unpackSound(CTX_data_main(C), op->reports, sound, method);
@@ -674,18 +674,18 @@ static int sound_unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
Editing* ed = CTX_data_scene(C)->ed;
bSound* sound;
- if(RNA_struct_property_is_set(op->ptr, "id"))
+ if (RNA_struct_property_is_set(op->ptr, "id"))
return sound_unpack_exec(C, op);
- if(!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
+ if (!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
return OPERATOR_CANCELLED;
sound = ed->act_seq->sound;
- if(!sound || !sound->packedfile)
+ if (!sound || !sound->packedfile)
return OPERATOR_CANCELLED;
- if(G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_AUTOPACK)
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
unpack_menu(C, "SOUND_OT_unpack", sound->id.name+2, sound->name, "sounds", sound->packedfile);
@@ -696,17 +696,17 @@ static int sound_unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
static void SOUND_OT_unpack(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Unpack Sound";
- ot->description= "Unpack the sound to the samples filename";
- ot->idname= "SOUND_OT_unpack";
+ ot->name = "Unpack Sound";
+ ot->description = "Unpack the sound to the samples filename";
+ ot->idname = "SOUND_OT_unpack";
/* api callbacks */
- ot->exec= sound_unpack_exec;
- ot->invoke= sound_unpack_invoke;
- ot->poll= sound_poll;
+ ot->exec = sound_unpack_exec;
+ ot->invoke = sound_unpack_invoke;
+ ot->poll = sound_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "method", unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack");
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index f29dba4c568..024a9ffb57d 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -93,7 +93,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
/* don't use totrect set, as the width stays the same
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
- v2d->tot.ymin= (float)(-height);
+ v2d->tot.ymin = (float)(-height);
}
/* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */
UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY);
@@ -209,7 +209,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
/* don't use totrect set, as the width stays the same
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
- v2d->tot.ymin= (float)(-height);
+ v2d->tot.ymin = (float)(-height);
/* first backdrop strips */
y= (float)(-ACHANNEL_HEIGHT);
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index a044651652e..b8c310f8477 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -124,17 +124,17 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op))
void ACTION_OT_new (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "New Action";
- ot->idname= "ACTION_OT_new";
- ot->description= "Create new action";
+ ot->name = "New Action";
+ ot->idname = "ACTION_OT_new";
+ ot->description = "Create new action";
/* api callbacks */
- ot->exec= act_new_exec;
+ ot->exec = act_new_exec;
// NOTE: this is used in the NLA too...
- //ot->poll= ED_operator_action_active;
+ //ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************************************************************** */
@@ -207,16 +207,16 @@ static int act_markers_make_local_exec (bContext *C, wmOperator *UNUSED(op))
void ACTION_OT_markers_make_local (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Markers Local";
- ot->idname= "ACTION_OT_markers_make_local";
- ot->description= "Move selected scene markers to the active Action as local 'pose' markers";
+ ot->name = "Make Markers Local";
+ ot->idname = "ACTION_OT_markers_make_local";
+ ot->description = "Move selected scene markers to the active Action as local 'pose' markers";
/* callbacks */
ot->exec = act_markers_make_local_exec;
ot->poll = act_markers_make_local_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************************************************************** */
@@ -322,16 +322,16 @@ static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
void ACTION_OT_previewrange_set (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Auto-Set Preview Range";
- ot->idname= "ACTION_OT_previewrange_set";
- ot->description= "Set Preview Range based on extents of selected Keyframes";
+ ot->name = "Auto-Set Preview Range";
+ ot->idname = "ACTION_OT_previewrange_set";
+ ot->description = "Set Preview Range based on extents of selected Keyframes";
/* api callbacks */
- ot->exec= actkeys_previewrange_exec;
- ot->poll= ED_operator_action_active;
+ ot->exec = actkeys_previewrange_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ****************** View-All Operator ****************** */
@@ -355,8 +355,8 @@ static int actkeys_viewall(bContext *C, const short onlySel)
v2d->cur.xmax += extra;
/* set vertical range */
- v2d->cur.ymax= 0.0f;
- v2d->cur.ymin= (float)-(v2d->mask.ymax - v2d->mask.ymin);
+ v2d->cur.ymax = 0.0f;
+ v2d->cur.ymin = (float)-(v2d->mask.ymax - v2d->mask.ymin);
/* do View2D syncing */
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
@@ -384,31 +384,31 @@ static int actkeys_viewsel_exec(bContext *C, wmOperator *UNUSED(op))
void ACTION_OT_view_all (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View All";
- ot->idname= "ACTION_OT_view_all";
- ot->description= "Reset viewable area to show full keyframe range";
+ ot->name = "View All";
+ ot->idname = "ACTION_OT_view_all";
+ ot->description = "Reset viewable area to show full keyframe range";
/* api callbacks */
- ot->exec= actkeys_viewall_exec;
- ot->poll= ED_operator_action_active;
+ ot->exec = actkeys_viewall_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
void ACTION_OT_view_selected (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Selected";
- ot->idname= "ACTION_OT_view_selected";
- ot->description= "Reset viewable area to show selected keyframes range";
+ ot->name = "View Selected";
+ ot->idname = "ACTION_OT_view_selected";
+ ot->description = "Reset viewable area to show selected keyframes range";
/* api callbacks */
- ot->exec= actkeys_viewsel_exec;
- ot->poll= ED_operator_action_active;
+ ot->exec = actkeys_viewsel_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************************************************************** */
@@ -487,16 +487,16 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op)
void ACTION_OT_copy (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Keyframes";
- ot->idname= "ACTION_OT_copy";
- ot->description= "Copy selected keyframes to the copy/paste buffer";
+ ot->name = "Copy Keyframes";
+ ot->idname = "ACTION_OT_copy";
+ ot->description = "Copy selected keyframes to the copy/paste buffer";
/* api callbacks */
- ot->exec= actkeys_copy_exec;
- ot->poll= ED_operator_action_active;
+ ot->exec = actkeys_copy_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int actkeys_paste_exec(bContext *C, wmOperator *op)
@@ -538,17 +538,17 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
void ACTION_OT_paste (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste Keyframes";
- ot->idname= "ACTION_OT_paste";
- ot->description= "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
+ ot->name = "Paste Keyframes";
+ ot->idname = "ACTION_OT_paste";
+ ot->description = "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
/* api callbacks */
-// ot->invoke= WM_operator_props_popup; // better wait for action redo panel
- ot->exec= actkeys_paste_exec;
- ot->poll= ED_operator_action_active;
+// ot->invoke = WM_operator_props_popup; // better wait for action redo panel
+ ot->exec = actkeys_paste_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
@@ -639,20 +639,20 @@ static int actkeys_insertkey_exec(bContext *C, wmOperator *op)
void ACTION_OT_keyframe_insert (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Insert Keyframes";
- ot->idname= "ACTION_OT_keyframe_insert";
- ot->description= "Insert keyframes for the specified channels";
+ ot->name = "Insert Keyframes";
+ ot->idname = "ACTION_OT_keyframe_insert";
+ ot->description = "Insert keyframes for the specified channels";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= actkeys_insertkey_exec;
- ot->poll= ED_operator_action_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = actkeys_insertkey_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_actkeys_insertkey_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_insertkey_types, 0, "Type", "");
}
/* ******************** Duplicate Keyframes Operator ************************* */
@@ -715,17 +715,17 @@ static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
void ACTION_OT_duplicate (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Duplicate Keyframes";
- ot->idname= "ACTION_OT_duplicate";
- ot->description= "Make a copy of all selected keyframes";
+ ot->name = "Duplicate Keyframes";
+ ot->idname = "ACTION_OT_duplicate";
+ ot->description = "Make a copy of all selected keyframes";
/* api callbacks */
- ot->invoke= actkeys_duplicate_invoke;
- ot->exec= actkeys_duplicate_exec;
- ot->poll= ED_operator_action_active;
+ ot->invoke = actkeys_duplicate_invoke;
+ ot->exec = actkeys_duplicate_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Delete Keyframes Operator ************************* */
@@ -790,17 +790,17 @@ static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
void ACTION_OT_delete (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Keyframes";
- ot->idname= "ACTION_OT_delete";
- ot->description= "Remove all selected keyframes";
+ ot->name = "Delete Keyframes";
+ ot->idname = "ACTION_OT_delete";
+ ot->description = "Remove all selected keyframes";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= actkeys_delete_exec;
- ot->poll= ED_operator_action_active;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = actkeys_delete_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Clean Keyframes Operator ************************* */
@@ -854,20 +854,20 @@ static int actkeys_clean_exec(bContext *C, wmOperator *op)
void ACTION_OT_clean (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clean Keyframes";
- ot->idname= "ACTION_OT_clean";
- ot->description= "Simplify F-Curves by removing closely spaced keyframes";
+ ot->name = "Clean Keyframes";
+ ot->idname = "ACTION_OT_clean";
+ ot->description = "Simplify F-Curves by removing closely spaced keyframes";
/* api callbacks */
- //ot->invoke= // XXX we need that number popup for this!
- ot->exec= actkeys_clean_exec;
- ot->poll= ED_operator_action_active;
+ //ot->invoke = // XXX we need that number popup for this!
+ ot->exec = actkeys_clean_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
+ ot->prop = RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
}
/* ******************** Sample Keyframes Operator *********************** */
@@ -918,16 +918,16 @@ static int actkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
void ACTION_OT_sample (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Sample Keyframes";
- ot->idname= "ACTION_OT_sample";
- ot->description= "Add keyframes on every frame between the selected keyframes";
+ ot->name = "Sample Keyframes";
+ ot->idname = "ACTION_OT_sample";
+ ot->description = "Add keyframes on every frame between the selected keyframes";
/* api callbacks */
- ot->exec= actkeys_sample_exec;
- ot->poll= ED_operator_action_active;
+ ot->exec = actkeys_sample_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************************************************************** */
@@ -1028,20 +1028,20 @@ static int actkeys_expo_exec(bContext *C, wmOperator *op)
void ACTION_OT_extrapolation_type (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Keyframe Extrapolation";
- ot->idname= "ACTION_OT_extrapolation_type";
- ot->description= "Set extrapolation mode for selected F-Curves";
+ ot->name = "Set Keyframe Extrapolation";
+ ot->idname = "ACTION_OT_extrapolation_type";
+ ot->description = "Set extrapolation mode for selected F-Curves";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= actkeys_expo_exec;
- ot->poll= ED_operator_action_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = actkeys_expo_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_actkeys_expo_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_expo_types, 0, "Type", "");
}
/* ******************** Set Interpolation-Type Operator *********************** */
@@ -1099,20 +1099,20 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op)
void ACTION_OT_interpolation_type (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Keyframe Interpolation";
- ot->idname= "ACTION_OT_interpolation_type";
- ot->description= "Set interpolation mode for the F-Curve segments starting from the selected keyframes";
+ ot->name = "Set Keyframe Interpolation";
+ ot->idname = "ACTION_OT_interpolation_type";
+ ot->description = "Set interpolation mode for the F-Curve segments starting from the selected keyframes";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= actkeys_ipo_exec;
- ot->poll= ED_operator_action_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = actkeys_ipo_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", beztriple_interpolation_mode_items, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", beztriple_interpolation_mode_items, 0, "Type", "");
}
/* ******************** Set Handle-Type Operator *********************** */
@@ -1179,20 +1179,20 @@ static int actkeys_handletype_exec(bContext *C, wmOperator *op)
void ACTION_OT_handle_type (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Keyframe Handle Type";
- ot->idname= "ACTION_OT_handle_type";
- ot->description= "Set type of handle for selected keyframes";
+ ot->name = "Set Keyframe Handle Type";
+ ot->idname = "ACTION_OT_handle_type";
+ ot->description = "Set type of handle for selected keyframes";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= actkeys_handletype_exec;
- ot->poll= ED_operator_action_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = actkeys_handletype_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", "");
}
/* ******************** Set Keyframe-Type Operator *********************** */
@@ -1250,20 +1250,20 @@ static int actkeys_keytype_exec(bContext *C, wmOperator *op)
void ACTION_OT_keyframe_type (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Keyframe Type";
- ot->idname= "ACTION_OT_keyframe_type";
- ot->description= "Set type of keyframe for the selected keyframes";
+ ot->name = "Set Keyframe Type";
+ ot->idname = "ACTION_OT_keyframe_type";
+ ot->description = "Set type of keyframe for the selected keyframes";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= actkeys_keytype_exec;
- ot->poll= ED_operator_action_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = actkeys_keytype_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", beztriple_keyframe_type_items, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", beztriple_keyframe_type_items, 0, "Type", "");
}
/* ************************************************************************** */
@@ -1318,16 +1318,16 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
void ACTION_OT_frame_jump (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Jump to Frame";
- ot->idname= "ACTION_OT_frame_jump";
- ot->description= "Set the current frame to the average frame of the selected keyframes";
+ ot->name = "Jump to Frame";
+ ot->idname = "ACTION_OT_frame_jump";
+ ot->description = "Set the current frame to the average frame of the selected keyframes";
/* api callbacks */
- ot->exec= actkeys_framejump_exec;
- ot->poll= ED_operator_action_active;
+ ot->exec = actkeys_framejump_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Snap Keyframes Operator *********************** */
@@ -1418,20 +1418,20 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op)
void ACTION_OT_snap (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Snap Keys";
- ot->idname= "ACTION_OT_snap";
- ot->description= "Snap selected keyframes to the times specified";
+ ot->name = "Snap Keys";
+ ot->idname = "ACTION_OT_snap";
+ ot->description = "Snap selected keyframes to the times specified";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= actkeys_snap_exec;
- ot->poll= ED_operator_action_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = actkeys_snap_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_actkeys_snap_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_snap_types, 0, "Type", "");
}
/* ******************** Mirror Keyframes Operator *********************** */
@@ -1532,20 +1532,20 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op)
void ACTION_OT_mirror (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mirror Keys";
- ot->idname= "ACTION_OT_mirror";
- ot->description= "Flip selected keyframes over the selected mirror line";
+ ot->name = "Mirror Keys";
+ ot->idname = "ACTION_OT_mirror";
+ ot->description = "Flip selected keyframes over the selected mirror line";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= actkeys_mirror_exec;
- ot->poll= ED_operator_action_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = actkeys_mirror_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_actkeys_mirror_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_mirror_types, 0, "Type", "");
}
/* ************************************************************************** */
diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c
index d4e44dee9c3..f502a97967f 100644
--- a/source/blender/editors/space_action/action_ops.c
+++ b/source/blender/editors/space_action/action_ops.c
@@ -93,11 +93,11 @@ void ED_operatormacros_action(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot= WM_operatortype_append_macro("ACTION_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("ACTION_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
if (ot) {
- ot->description= "Make a copy of all selected keyframes and move them";
+ ot->description = "Make a copy of all selected keyframes and move them";
WM_operatortype_macro_define(ot, "ACTION_OT_duplicate");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE);
}
@@ -114,13 +114,13 @@ static void action_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "column", FALSE);
- kmi= WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "column", TRUE);
- kmi= WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "column", FALSE);
- kmi= WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "column", TRUE);
@@ -128,14 +128,14 @@ static void action_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_TEST);
- kmi= WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_TEST);
- kmi= WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_LEFT);
- kmi= WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_RIGHT);
@@ -225,7 +225,7 @@ void action_keymap(wmKeyConfig *keyconf)
*/
/* keyframes */
- keymap= WM_keymap_find(keyconf, "Dopesheet", SPACE_ACTION, 0);
+ keymap = WM_keymap_find(keyconf, "Dopesheet", SPACE_ACTION, 0);
action_keymap_keyframes(keyconf, keymap);
}
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 1b0b305b7aa..630bb75ed5d 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -161,19 +161,19 @@ static int actkeys_deselectall_exec(bContext *C, wmOperator *op)
void ACTION_OT_select_all_toggle (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select All";
- ot->idname= "ACTION_OT_select_all_toggle";
- ot->description= "Toggle selection of all keyframes";
+ ot->name = "Select All";
+ ot->idname = "ACTION_OT_select_all_toggle";
+ ot->description = "Toggle selection of all keyframes";
/* api callbacks */
- ot->exec= actkeys_deselectall_exec;
- ot->poll= ED_operator_action_active;
+ ot->exec = actkeys_deselectall_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+ ot->prop = RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
}
/* ******************** Border Select Operator **************************** */
@@ -281,10 +281,10 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
deselect_action_keys(&ac, 1, SELECT_SUBTRACT);
/* get settings from operator */
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
if (gesture_mode == GESTURE_MODAL_SELECT)
@@ -319,25 +319,25 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
void ACTION_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Select";
- ot->idname= "ACTION_OT_select_border";
- ot->description= "Select all keyframes within the specified region";
+ ot->name = "Border Select";
+ ot->idname = "ACTION_OT_select_border";
+ ot->description = "Select all keyframes within the specified region";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= actkeys_borderselect_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = actkeys_borderselect_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= ED_operator_action_active;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, TRUE);
- ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+ ot->prop = RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
}
/* ******************** Column Select Operator **************************** */
@@ -527,19 +527,19 @@ static int actkeys_columnselect_exec(bContext *C, wmOperator *op)
void ACTION_OT_select_column (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select All";
- ot->idname= "ACTION_OT_select_column";
- ot->description= "Select all keyframes on the specified frame(s)";
+ ot->name = "Select All";
+ ot->idname = "ACTION_OT_select_column";
+ ot->description = "Select all keyframes on the specified frame(s)";
/* api callbacks */
- ot->exec= actkeys_columnselect_exec;
- ot->poll= ED_operator_action_active;
+ ot->exec = actkeys_columnselect_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- ot->prop= RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
+ ot->prop = RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
}
/* ******************** Select Linked Operator *********************** */
@@ -586,15 +586,15 @@ void ACTION_OT_select_linked (wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Linked";
- ot->idname= "ACTION_OT_select_linked";
+ ot->idname = "ACTION_OT_select_linked";
ot->description = "Select keyframes occurring in the same F-Curves as selected ones";
/* api callbacks */
- ot->exec= actkeys_select_linked_exec;
- ot->poll= ED_operator_action_active;
+ ot->exec = actkeys_select_linked_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
}
/* ******************** Select More/Less Operators *********************** */
@@ -663,15 +663,15 @@ void ACTION_OT_select_more (wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select More";
- ot->idname= "ACTION_OT_select_more";
+ ot->idname = "ACTION_OT_select_more";
ot->description = "Select keyframes beside already selected ones";
/* api callbacks */
- ot->exec= actkeys_select_more_exec;
- ot->poll= ED_operator_action_active;
+ ot->exec = actkeys_select_more_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
}
/* ----------------- */
@@ -697,15 +697,15 @@ void ACTION_OT_select_less (wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Less";
- ot->idname= "ACTION_OT_select_less";
+ ot->idname = "ACTION_OT_select_less";
ot->description = "Deselect keyframes on ends of selection islands";
/* api callbacks */
- ot->exec= actkeys_select_less_exec;
- ot->poll= ED_operator_action_active;
+ ot->exec = actkeys_select_less_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
}
/* ******************** Select Left/Right Operator ************************* */
@@ -785,7 +785,7 @@ static void actkeys_select_leftright (bAnimContext *ac, short leftright, short s
TimeMarker *marker;
for (marker= markers->first; marker; marker= marker->next) {
- if( ((leftright == ACTKEYS_LRSEL_LEFT) && (marker->frame < CFRA)) ||
+ if ( ((leftright == ACTKEYS_LRSEL_LEFT) && (marker->frame < CFRA)) ||
((leftright == ACTKEYS_LRSEL_RIGHT) && (marker->frame >= CFRA)) )
{
marker->flag |= SELECT;
@@ -863,20 +863,20 @@ static int actkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
void ACTION_OT_select_leftright (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Left/Right";
- ot->idname= "ACTION_OT_select_leftright";
- ot->description= "Select keyframes to the left or the right of the current frame";
+ ot->name = "Select Left/Right";
+ ot->idname = "ACTION_OT_select_leftright";
+ ot->description = "Select keyframes to the left or the right of the current frame";
/* api callbacks */
- ot->invoke= actkeys_select_leftright_invoke;
- ot->exec= actkeys_select_leftright_exec;
- ot->poll= ED_operator_action_active;
+ ot->invoke = actkeys_select_leftright_invoke;
+ ot->exec = actkeys_select_leftright_exec;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "mode", prop_actkeys_leftright_select_types, ACTKEYS_LRSEL_TEST, "Mode", "");
+ ot->prop = RNA_def_enum(ot->srna, "mode", prop_actkeys_leftright_select_types, ACTKEYS_LRSEL_TEST, "Mode", "");
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
}
@@ -1177,16 +1177,16 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
void ACTION_OT_clickselect (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mouse Select Keys";
- ot->idname= "ACTION_OT_clickselect";
- ot->description= "Select keyframes by clicking on them";
+ ot->name = "Mouse Select Keys";
+ ot->idname = "ACTION_OT_clickselect";
+ ot->description = "Select keyframes by clicking on them";
/* api callbacks - absolutely no exec() this yet... */
- ot->invoke= actkeys_clickselect_invoke;
- ot->poll= ED_operator_action_active;
+ ot->invoke = actkeys_clickselect_invoke;
+ ot->poll = ED_operator_action_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 7bda0c9a510..9d0dab7d34e 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -101,10 +101,10 @@ static SpaceLink *action_new(const bContext *C)
BLI_addtail(&saction->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin= -10.0f;
- ar->v2d.tot.ymin= (float)(-sa->winy)/3.0f;
- ar->v2d.tot.xmax= (float)(sa->winx);
- ar->v2d.tot.ymax= 0.0f;
+ ar->v2d.tot.xmin = -10.0f;
+ ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
+ ar->v2d.tot.xmax = (float)(sa->winx);
+ ar->v2d.tot.ymax = 0.0f;
ar->v2d.cur = ar->v2d.tot;
@@ -160,7 +160,7 @@ static void action_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Dopesheet", SPACE_ACTION, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Dopesheet", SPACE_ACTION, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -223,7 +223,7 @@ static void action_channel_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -289,17 +289,17 @@ static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case ND_MODIFIER:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
}
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
default:
- if(wmn->data==ND_KEYS)
+ if (wmn->data==ND_KEYS)
ED_region_tag_redraw(ar);
}
}
@@ -341,12 +341,12 @@ static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
default:
- if(wmn->data==ND_KEYS)
+ if (wmn->data==ND_KEYS)
ED_region_tag_redraw(ar);
}
}
@@ -438,7 +438,7 @@ static void action_header_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
}
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index b876003c059..31243184961 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -117,8 +117,8 @@ void ED_spacetypes_init(void)
/* register operators */
spacetypes = BKE_spacetypes_list();
- for(type=spacetypes->first; type; type=type->next) {
- if(type->operatortypes)
+ for (type=spacetypes->first; type; type=type->next) {
+ if (type->operatortypes)
type->operatortypes();
}
@@ -136,8 +136,8 @@ void ED_spacetypes_init(void)
/* register dropboxes (can use macros) */
spacetypes = BKE_spacetypes_list();
- for(type=spacetypes->first; type; type=type->next) {
- if(type->dropboxes)
+ for (type=spacetypes->first; type; type=type->next) {
+ if (type->dropboxes)
type->dropboxes();
}
@@ -169,11 +169,11 @@ void ED_spacetypes_keymap(wmKeyConfig *keyconf)
UI_view2d_keymap(keyconf);
spacetypes = BKE_spacetypes_list();
- for(stype=spacetypes->first; stype; stype=stype->next) {
- if(stype->keymap)
+ for (stype=spacetypes->first; stype; stype=stype->next) {
+ if (stype->keymap)
stype->keymap(keyconf);
- for(atype=stype->regiontypes.first; atype; atype=atype->next) {
- if(atype->keymap)
+ for (atype=stype->regiontypes.first; atype; atype=atype->next) {
+ if (atype->keymap)
atype->keymap(keyconf);
}
}
@@ -209,8 +209,8 @@ void ED_region_draw_cb_exit(ARegionType *art, void *handle)
{
RegionDrawCB *rdc;
- for(rdc= art->drawcalls.first; rdc; rdc= rdc->next) {
- if(rdc==(RegionDrawCB *)handle) {
+ for (rdc= art->drawcalls.first; rdc; rdc= rdc->next) {
+ if (rdc==(RegionDrawCB *)handle) {
BLI_remlink(&art->drawcalls, rdc);
MEM_freeN(rdc);
return;
@@ -227,8 +227,8 @@ void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type)
{
RegionDrawCB *rdc;
- for(rdc= ar->type->drawcalls.first; rdc; rdc= rdc->next) {
- if(rdc->type==type)
+ for (rdc= ar->type->drawcalls.first; rdc; rdc= rdc->next) {
+ if (rdc->type==type)
rdc->draw(C, ar, rdc->customdata);
}
}
diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt
index ee118f12062..7233d4623d1 100644
--- a/source/blender/editors/space_buttons/CMakeLists.txt
+++ b/source/blender/editors/space_buttons/CMakeLists.txt
@@ -44,4 +44,8 @@ set(SRC
buttons_intern.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_space_buttons "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_buttons/SConscript b/source/blender/editors/space_buttons/SConscript
index 7bc588c627c..92579b6dedf 100644
--- a/source/blender/editors/space_buttons/SConscript
+++ b/source/blender/editors/space_buttons/SConscript
@@ -9,4 +9,7 @@ incs += ' ../../bmesh ../../makesrna ../../render/extern/include ../../blenloade
defs = []
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
env.BlenderLib ( 'bf_editors_space_buttons', sources, Split(incs), defs, libtype=['core'], priority=[120] )
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 2b63e455e11..b698ec03668 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -70,10 +70,10 @@ static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, S
PointerRNA *ptr;
int a;
- for(a=0; a<path->len; a++) {
+ for (a=0; a<path->len; a++) {
ptr= &path->ptr[a];
- if(RNA_struct_is_a(ptr->type, type)) {
+ if (RNA_struct_is_a(ptr->type, type)) {
CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data);
return 1;
}
@@ -87,10 +87,10 @@ static PointerRNA *get_pointer_type(ButsContextPath *path, StructRNA *type)
PointerRNA *ptr;
int a;
- for(a=0; a<path->len; a++) {
+ for (a=0; a<path->len; a++) {
ptr= &path->ptr[a];
- if(RNA_struct_is_a(ptr->type, type))
+ if (RNA_struct_is_a(ptr->type, type))
return ptr;
}
@@ -116,15 +116,15 @@ static int buttons_context_path_world(ButsContextPath *path)
PointerRNA *ptr= &path->ptr[path->len-1];
/* if we already have a (pinned) world, we're done */
- if(RNA_struct_is_a(ptr->type, &RNA_World)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_World)) {
return 1;
}
/* if we have a scene, use the scene's world */
- else if(buttons_context_path_scene(path)) {
+ else if (buttons_context_path_scene(path)) {
scene= path->ptr[path->len-1].data;
world= scene->world;
- if(world) {
+ if (world) {
RNA_id_pointer_create(&scene->world->id, &path->ptr[path->len]);
path->len++;
return 1;
@@ -146,15 +146,15 @@ static int buttons_context_path_object(ButsContextPath *path)
PointerRNA *ptr= &path->ptr[path->len-1];
/* if we already have a (pinned) object, we're done */
- if(RNA_struct_is_a(ptr->type, &RNA_Object)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Object)) {
return 1;
}
/* if we have a scene, use the scene's active object */
- else if(buttons_context_path_scene(path)) {
+ else if (buttons_context_path_scene(path)) {
scene= path->ptr[path->len-1].data;
ob= (scene->basact)? scene->basact->object: NULL;
- if(ob) {
+ if (ob) {
RNA_id_pointer_create(&ob->id, &path->ptr[path->len]);
path->len++;
@@ -172,19 +172,19 @@ static int buttons_context_path_data(ButsContextPath *path, int type)
PointerRNA *ptr= &path->ptr[path->len-1];
/* if we already have a data, we're done */
- if(RNA_struct_is_a(ptr->type, &RNA_Mesh) && (type == -1 || type == OB_MESH)) return 1;
- else if(RNA_struct_is_a(ptr->type, &RNA_Curve) && (type == -1 || ELEM3(type, OB_CURVE, OB_SURF, OB_FONT))) return 1;
- else if(RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) return 1;
- else if(RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) return 1;
- else if(RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) return 1;
- else if(RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) return 1;
- else if(RNA_struct_is_a(ptr->type, &RNA_Lamp) && (type == -1 || type == OB_LAMP)) return 1;
- else if(RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) return 1;
+ if (RNA_struct_is_a(ptr->type, &RNA_Mesh) && (type == -1 || type == OB_MESH)) return 1;
+ else if (RNA_struct_is_a(ptr->type, &RNA_Curve) && (type == -1 || ELEM3(type, OB_CURVE, OB_SURF, OB_FONT))) return 1;
+ else if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) return 1;
+ else if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) return 1;
+ else if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) return 1;
+ else if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) return 1;
+ else if (RNA_struct_is_a(ptr->type, &RNA_Lamp) && (type == -1 || type == OB_LAMP)) return 1;
+ else if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) return 1;
/* try to get an object in the path, no pinning supported here */
- else if(buttons_context_path_object(path)) {
+ else if (buttons_context_path_object(path)) {
ob= path->ptr[path->len-1].data;
- if(ob && (type == -1 || type == ob->type)) {
+ if (ob && (type == -1 || type == ob->type)) {
RNA_id_pointer_create(ob->data, &path->ptr[path->len]);
path->len++;
@@ -200,10 +200,10 @@ static int buttons_context_path_modifier(ButsContextPath *path)
{
Object *ob;
- if(buttons_context_path_object(path)) {
+ if (buttons_context_path_object(path)) {
ob= path->ptr[path->len-1].data;
- if(ob && ELEM5(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_LATTICE))
+ if (ob && ELEM5(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_LATTICE))
return 1;
}
@@ -217,23 +217,23 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture)
Material *ma;
/* if we already have a (pinned) material, we're done */
- if(RNA_struct_is_a(ptr->type, &RNA_Material)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Material)) {
return 1;
}
/* if we have an object, use the object material slot */
- else if(buttons_context_path_object(path)) {
+ else if (buttons_context_path_object(path)) {
ob= path->ptr[path->len-1].data;
- if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
+ if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
ma= give_current_material(ob, ob->actcol);
RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
path->len++;
- if(for_texture && give_current_material_texture_node(ma))
+ if (for_texture && give_current_material_texture_node(ma))
return 1;
ma= give_node_material(ma);
- if(ma) {
+ if (ma) {
RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
path->len++;
}
@@ -251,11 +251,11 @@ static int buttons_context_path_bone(ButsContextPath *path)
EditBone *edbo;
/* if we have an armature, get the active bone */
- if(buttons_context_path_data(path, OB_ARMATURE)) {
+ if (buttons_context_path_data(path, OB_ARMATURE)) {
arm= path->ptr[path->len-1].data;
- if(arm->edbo) {
- if(arm->act_edbone) {
+ if (arm->edbo) {
+ if (arm->act_edbone) {
edbo= arm->act_edbone;
RNA_pointer_create(&arm->id, &RNA_EditBone, edbo, &path->ptr[path->len]);
path->len++;
@@ -263,7 +263,7 @@ static int buttons_context_path_bone(ButsContextPath *path)
}
}
else {
- if(arm->act_bone) {
+ if (arm->act_bone) {
RNA_pointer_create(&arm->id, &RNA_Bone, arm->act_bone, &path->ptr[path->len]);
path->len++;
return 1;
@@ -280,22 +280,22 @@ static int buttons_context_path_pose_bone(ButsContextPath *path)
PointerRNA *ptr= &path->ptr[path->len-1];
/* if we already have a (pinned) PoseBone, we're done */
- if(RNA_struct_is_a(ptr->type, &RNA_PoseBone)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_PoseBone)) {
return 1;
}
/* if we have an armature, get the active bone */
- if(buttons_context_path_object(path)) {
+ if (buttons_context_path_object(path)) {
Object *ob= path->ptr[path->len-1].data;
bArmature *arm= ob->data; /* path->ptr[path->len-1].data - works too */
- if(ob->type != OB_ARMATURE || arm->edbo) {
+ if (ob->type != OB_ARMATURE || arm->edbo) {
return 0;
}
else {
- if(arm->act_bone) {
+ if (arm->act_bone) {
bPoseChannel *pchan= get_pose_channel(ob->pose, arm->act_bone->name);
- if(pchan) {
+ if (pchan) {
RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]);
path->len++;
return 1;
@@ -316,14 +316,14 @@ static int buttons_context_path_particle(ButsContextPath *path)
PointerRNA *ptr= &path->ptr[path->len-1];
/* if we already have (pinned) particle settings, we're done */
- if(RNA_struct_is_a(ptr->type, &RNA_ParticleSettings)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_ParticleSettings)) {
return 1;
}
/* if we have an object, get the active particle system */
- if(buttons_context_path_object(path)) {
+ if (buttons_context_path_object(path)) {
ob= path->ptr[path->len-1].data;
- if(ob && ob->type == OB_MESH) {
+ if (ob && ob->type == OB_MESH) {
psys= psys_get_current(ob);
RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &path->ptr[path->len]);
@@ -343,17 +343,17 @@ static int buttons_context_path_brush(ButsContextPath *path)
PointerRNA *ptr= &path->ptr[path->len-1];
/* if we already have a (pinned) brush, we're done */
- if(RNA_struct_is_a(ptr->type, &RNA_Brush)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Brush)) {
return 1;
}
/* if we have a scene, use the toolsettings brushes */
- else if(buttons_context_path_scene(path)) {
+ else if (buttons_context_path_scene(path)) {
scene= path->ptr[path->len-1].data;
- if(scene)
+ if (scene)
br= paint_brush(paint_get_active(scene));
- if(br) {
+ if (br) {
RNA_id_pointer_create((ID *)br, &path->ptr[path->len]);
path->len++;
@@ -367,36 +367,36 @@ static int buttons_context_path_brush(ButsContextPath *path)
static int buttons_context_path_texture(ButsContextPath *path, ButsContextTexture *ct)
{
- if(ct) {
+ if (ct) {
/* new shading system */
PointerRNA *ptr= &path->ptr[path->len-1];
ID *id;
/* if we already have a (pinned) texture, we're done */
- if(RNA_struct_is_a(ptr->type, &RNA_Texture))
+ if (RNA_struct_is_a(ptr->type, &RNA_Texture))
return 1;
- if(!ct->user)
+ if (!ct->user)
return 0;
id= ct->user->id;
- if(id) {
- if(GS(id->name) == ID_BR)
+ if (id) {
+ if (GS(id->name) == ID_BR)
buttons_context_path_brush(path);
- else if(GS(id->name) == ID_MA)
+ else if (GS(id->name) == ID_MA)
buttons_context_path_material(path, 0);
- else if(GS(id->name) == ID_WO)
+ else if (GS(id->name) == ID_WO)
buttons_context_path_world(path);
- else if(GS(id->name) == ID_LA)
+ else if (GS(id->name) == ID_LA)
buttons_context_path_data(path, OB_LAMP);
- else if(GS(id->name) == ID_PA)
+ else if (GS(id->name) == ID_PA)
buttons_context_path_particle(path);
- else if(GS(id->name) == ID_OB)
+ else if (GS(id->name) == ID_OB)
buttons_context_path_object(path);
}
- if(ct->texture) {
+ if (ct->texture) {
RNA_id_pointer_create(&ct->texture->id, &path->ptr[path->len]);
path->len++;
}
@@ -415,14 +415,14 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
int orig_len = path->len;
/* if we already have a (pinned) texture, we're done */
- if(RNA_struct_is_a(ptr->type, &RNA_Texture)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Texture)) {
return 1;
}
/* try brush */
- if((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) {
+ if ((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) {
br= path->ptr[path->len-1].data;
- if(br) {
+ if (br) {
tex= give_current_brush_texture(br);
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -431,10 +431,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
}
}
/* try world */
- if((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) {
+ if ((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) {
wo= path->ptr[path->len-1].data;
- if(wo && GS(wo->id.name)==ID_WO) {
+ if (wo && GS(wo->id.name)==ID_WO) {
tex= give_current_world_texture(wo);
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -443,8 +443,8 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
}
}
/* try particles */
- if((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) {
- if(path->ptr[path->len-1].type == &RNA_ParticleSettings) {
+ if ((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) {
+ if (path->ptr[path->len-1].type == &RNA_ParticleSettings) {
ParticleSettings *part = path->ptr[path->len-1].data;
tex= give_current_particle_texture(part);
@@ -455,7 +455,7 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
else {
psys= path->ptr[path->len-1].data;
- if(psys && psys->part && GS(psys->part->id.name)==ID_PA) {
+ if (psys && psys->part && GS(psys->part->id.name)==ID_PA) {
tex= give_current_particle_texture(psys->part);
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -465,10 +465,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
}
}
/* try material */
- if(buttons_context_path_material(path, 1)) {
+ if (buttons_context_path_material(path, 1)) {
ma= path->ptr[path->len-1].data;
- if(ma) {
+ if (ma) {
tex= give_current_material_texture(ma);
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -477,10 +477,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
}
}
/* try lamp */
- if(buttons_context_path_data(path, OB_LAMP)) {
+ if (buttons_context_path_data(path, OB_LAMP)) {
la= path->ptr[path->len-1].data;
- if(la) {
+ if (la) {
tex= give_current_lamp_texture(la);
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -490,10 +490,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
}
/* try brushes again in case of no material, lamp, etc */
path->len = orig_len;
- if(buttons_context_path_brush(path)) {
+ if (buttons_context_path_brush(path)) {
br= path->ptr[path->len-1].data;
- if(br) {
+ if (br) {
tex= give_current_brush_texture(br);
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -519,7 +519,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
path->tex_ctx = sbuts->texture_context;
/* if some ID datablock is pinned, set the root pointer */
- if(sbuts->pinid) {
+ if (sbuts->pinid) {
id= sbuts->pinid;
RNA_id_pointer_create(id, &path->ptr[0]);
@@ -527,7 +527,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
}
/* no pinned root, use scene as root */
- if(path->len == 0) {
+ if (path->len == 0) {
id= (ID*)CTX_data_scene(C);
RNA_id_pointer_create(id, &path->ptr[0]);
path->len++;
@@ -565,7 +565,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
break;
case BCONTEXT_BONE:
found= buttons_context_path_bone(path);
- if(!found)
+ if (!found)
found= buttons_context_path_data(path, OB_ARMATURE);
break;
case BCONTEXT_BONE_CONSTRAINT:
@@ -583,9 +583,9 @@ static int buttons_shading_context(const bContext *C, int mainb)
{
Object *ob= CTX_data_active_object(C);
- if(ELEM3(mainb, BCONTEXT_MATERIAL, BCONTEXT_WORLD, BCONTEXT_TEXTURE))
+ if (ELEM3(mainb, BCONTEXT_MATERIAL, BCONTEXT_WORLD, BCONTEXT_TEXTURE))
return 1;
- if(mainb == BCONTEXT_DATA && ob && ELEM(ob->type, OB_LAMP, OB_CAMERA))
+ if (mainb == BCONTEXT_DATA && ob && ELEM(ob->type, OB_LAMP, OB_CAMERA))
return 1;
return 0;
@@ -595,11 +595,11 @@ static int buttons_shading_new_context(const bContext *C, int flag)
{
Object *ob= CTX_data_active_object(C);
- if(flag & (1 << BCONTEXT_MATERIAL))
+ if (flag & (1 << BCONTEXT_MATERIAL))
return BCONTEXT_MATERIAL;
- else if(ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA)))
+ else if (ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA)))
return BCONTEXT_DATA;
- else if(flag & (1 << BCONTEXT_WORLD))
+ else if (flag & (1 << BCONTEXT_WORLD))
return BCONTEXT_WORLD;
return BCONTEXT_RENDER;
@@ -613,22 +613,22 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
buttons_texture_context_compute(C, sbuts);
- if(!sbuts->path)
+ if (!sbuts->path)
sbuts->path= MEM_callocN(sizeof(ButsContextPath), "ButsContextPath");
path= sbuts->path;
/* for each context, see if we can compute a valid path to it, if
* this is the case, we know we have to display the button */
- for(a=0; a<BCONTEXT_TOT; a++) {
- if(buttons_context_path(C, path, a, pflag)) {
+ for (a=0; a<BCONTEXT_TOT; a++) {
+ if (buttons_context_path(C, path, a, pflag)) {
flag |= (1<<a);
/* setting icon for data context */
- if(a == BCONTEXT_DATA) {
+ if (a == BCONTEXT_DATA) {
ptr= &path->ptr[path->len-1];
- if(ptr->type)
+ if (ptr->type)
sbuts->dataicon= RNA_struct_ui_icon(ptr->type);
else
sbuts->dataicon= ICON_EMPTY_DATA;
@@ -642,17 +642,17 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
sbuts->mainb= sbuts->mainbuser;
/* in case something becomes invalid, change */
- if((flag & (1 << sbuts->mainb)) == 0) {
- if(sbuts->flag & SB_SHADING_CONTEXT) {
+ if ((flag & (1 << sbuts->mainb)) == 0) {
+ if (sbuts->flag & SB_SHADING_CONTEXT) {
/* try to keep showing shading related buttons */
sbuts->mainb= buttons_shading_new_context(C, flag);
}
- else if(flag & BCONTEXT_OBJECT) {
+ else if (flag & BCONTEXT_OBJECT) {
sbuts->mainb= BCONTEXT_OBJECT;
}
else {
- for(a=0; a<BCONTEXT_TOT; a++) {
- if(flag & (1 << a)) {
+ for (a=0; a<BCONTEXT_TOT; a++) {
+ if (flag & (1 << a)) {
sbuts->mainb= a;
break;
}
@@ -662,14 +662,14 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
buttons_context_path(C, path, sbuts->mainb, pflag);
- if(!(flag & (1 << sbuts->mainb))) {
- if(flag & (1 << BCONTEXT_OBJECT))
+ if (!(flag & (1 << sbuts->mainb))) {
+ if (flag & (1 << BCONTEXT_OBJECT))
sbuts->mainb= BCONTEXT_OBJECT;
else
sbuts->mainb= BCONTEXT_SCENE;
}
- if(buttons_shading_context(C, sbuts->mainb))
+ if (buttons_shading_context(C, sbuts->mainb))
sbuts->flag |= SB_SHADING_CONTEXT;
else
sbuts->flag &= ~SB_SHADING_CONTEXT;
@@ -691,62 +691,62 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
SpaceButs *sbuts= CTX_wm_space_buts(C);
ButsContextPath *path= sbuts?sbuts->path:NULL;
- if(!path)
+ if (!path)
return 0;
/* here we handle context, getting data from precomputed path */
- if(CTX_data_dir(member)) {
+ if (CTX_data_dir(member)) {
CTX_data_dir_set(result, buttons_context_dir);
return 1;
}
- else if(CTX_data_equals(member, "world")) {
+ else if (CTX_data_equals(member, "world")) {
set_pointer_type(path, result, &RNA_World);
return 1;
}
- else if(CTX_data_equals(member, "object")) {
+ else if (CTX_data_equals(member, "object")) {
set_pointer_type(path, result, &RNA_Object);
return 1;
}
- else if(CTX_data_equals(member, "mesh")) {
+ else if (CTX_data_equals(member, "mesh")) {
set_pointer_type(path, result, &RNA_Mesh);
return 1;
}
- else if(CTX_data_equals(member, "armature")) {
+ else if (CTX_data_equals(member, "armature")) {
set_pointer_type(path, result, &RNA_Armature);
return 1;
}
- else if(CTX_data_equals(member, "lattice")) {
+ else if (CTX_data_equals(member, "lattice")) {
set_pointer_type(path, result, &RNA_Lattice);
return 1;
}
- else if(CTX_data_equals(member, "curve")) {
+ else if (CTX_data_equals(member, "curve")) {
set_pointer_type(path, result, &RNA_Curve);
return 1;
}
- else if(CTX_data_equals(member, "meta_ball")) {
+ else if (CTX_data_equals(member, "meta_ball")) {
set_pointer_type(path, result, &RNA_MetaBall);
return 1;
}
- else if(CTX_data_equals(member, "lamp")) {
+ else if (CTX_data_equals(member, "lamp")) {
set_pointer_type(path, result, &RNA_Lamp);
return 1;
}
- else if(CTX_data_equals(member, "camera")) {
+ else if (CTX_data_equals(member, "camera")) {
set_pointer_type(path, result, &RNA_Camera);
return 1;
}
- else if(CTX_data_equals(member, "speaker")) {
+ else if (CTX_data_equals(member, "speaker")) {
set_pointer_type(path, result, &RNA_Speaker);
return 1;
}
- else if(CTX_data_equals(member, "material")) {
+ else if (CTX_data_equals(member, "material")) {
set_pointer_type(path, result, &RNA_Material);
return 1;
}
- else if(CTX_data_equals(member, "texture")) {
+ else if (CTX_data_equals(member, "texture")) {
ButsContextTexture *ct= sbuts->texuser;
- if(ct) {
+ if (ct) {
/* new shading system */
CTX_data_pointer_set(result, &ct->texture->id, &RNA_Texture, ct->texture);
}
@@ -757,41 +757,41 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
- else if(CTX_data_equals(member, "material_slot")) {
+ else if (CTX_data_equals(member, "material_slot")) {
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
- if(ptr) {
+ if (ptr) {
Object *ob= ptr->data;
- if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) {
+ if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) {
/* a valid actcol isn't ensured [#27526] */
int matnr= ob->actcol-1;
- if(matnr < 0) matnr= 0;
+ if (matnr < 0) matnr= 0;
CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, &ob->mat[matnr]);
}
}
return 1;
}
- else if(CTX_data_equals(member, "texture_user")) {
+ else if (CTX_data_equals(member, "texture_user")) {
ButsContextTexture *ct= sbuts->texuser;
- if(!ct)
+ if (!ct)
return -1; /* old shading system (found but not available) */
- if(ct->user && ct->user->ptr.data) {
+ if (ct->user && ct->user->ptr.data) {
ButsTextureUser *user= ct->user;
CTX_data_pointer_set(result, user->ptr.id.data, user->ptr.type, user->ptr.data);
}
return 1;
}
- else if(CTX_data_equals(member, "texture_node")) {
+ else if (CTX_data_equals(member, "texture_node")) {
ButsContextTexture *ct= sbuts->texuser;
- if(ct) {
+ if (ct) {
/* new shading system */
- if(ct->user && ct->user->node)
+ if (ct->user && ct->user->node)
CTX_data_pointer_set(result, &ct->user->ntree->id, &RNA_Node, ct->user->node);
return 1;
@@ -800,10 +800,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
/* old shading system */
PointerRNA *ptr;
- if((ptr=get_pointer_type(path, &RNA_Material))) {
+ if ((ptr=get_pointer_type(path, &RNA_Material))) {
Material *ma= ptr->data;
- if(ma) {
+ if (ma) {
bNode *node= give_current_material_texture_node(ma);
CTX_data_pointer_set(result, &ma->nodetree->id, &RNA_Node, node);
}
@@ -812,18 +812,18 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
}
- else if(CTX_data_equals(member, "texture_slot")) {
+ else if (CTX_data_equals(member, "texture_slot")) {
ButsContextTexture *ct= sbuts->texuser;
PointerRNA *ptr;
- if(ct)
+ if (ct)
return 0; /* new shading system */
- if((ptr=get_pointer_type(path, &RNA_Material))) {
+ if ((ptr=get_pointer_type(path, &RNA_Material))) {
Material *ma= ptr->data;
/* if we have a node material, get slot from material in material node */
- if(ma && ma->use_nodes && ma->nodetree) {
+ if (ma && ma->use_nodes && ma->nodetree) {
/* if there's an active texture node in the node tree,
* then that texture is in context directly, without a texture slot */
if (give_current_material_texture_node(ma))
@@ -834,84 +834,85 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]);
else
return 0;
- } else if(ma) {
+ }
+ else if (ma) {
CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]);
}
}
- else if((ptr=get_pointer_type(path, &RNA_Lamp))) {
+ else if ((ptr=get_pointer_type(path, &RNA_Lamp))) {
Lamp *la= ptr->data;
- if(la)
+ if (la)
CTX_data_pointer_set(result, &la->id, &RNA_LampTextureSlot, la->mtex[(int)la->texact]);
}
- else if((ptr=get_pointer_type(path, &RNA_World))) {
+ else if ((ptr=get_pointer_type(path, &RNA_World))) {
World *wo= ptr->data;
- if(wo)
+ if (wo)
CTX_data_pointer_set(result, &wo->id, &RNA_WorldTextureSlot, wo->mtex[(int)wo->texact]);
}
- else if((ptr=get_pointer_type(path, &RNA_Brush))) { /* how to get this into context? */
+ else if ((ptr=get_pointer_type(path, &RNA_Brush))) { /* how to get this into context? */
Brush *br= ptr->data;
- if(br)
+ if (br)
CTX_data_pointer_set(result, &br->id, &RNA_BrushTextureSlot, &br->mtex);
}
- else if((ptr=get_pointer_type(path, &RNA_ParticleSystem))) {
+ else if ((ptr=get_pointer_type(path, &RNA_ParticleSystem))) {
ParticleSettings *part= ((ParticleSystem *)ptr->data)->part;
- if(part)
+ if (part)
CTX_data_pointer_set(result, &part->id, &RNA_ParticleSettingsTextureSlot, part->mtex[(int)part->texact]);
}
return 1;
}
- else if(CTX_data_equals(member, "bone")) {
+ else if (CTX_data_equals(member, "bone")) {
set_pointer_type(path, result, &RNA_Bone);
return 1;
}
- else if(CTX_data_equals(member, "edit_bone")) {
+ else if (CTX_data_equals(member, "edit_bone")) {
set_pointer_type(path, result, &RNA_EditBone);
return 1;
}
- else if(CTX_data_equals(member, "pose_bone")) {
+ else if (CTX_data_equals(member, "pose_bone")) {
set_pointer_type(path, result, &RNA_PoseBone);
return 1;
}
- else if(CTX_data_equals(member, "particle_system")) {
+ else if (CTX_data_equals(member, "particle_system")) {
set_pointer_type(path, result, &RNA_ParticleSystem);
return 1;
}
- else if(CTX_data_equals(member, "particle_system_editable")) {
- if(PE_poll((bContext*)C))
+ else if (CTX_data_equals(member, "particle_system_editable")) {
+ if (PE_poll((bContext*)C))
set_pointer_type(path, result, &RNA_ParticleSystem);
else
CTX_data_pointer_set(result, NULL, &RNA_ParticleSystem, NULL);
return 1;
}
- else if(CTX_data_equals(member, "cloth")) {
+ else if (CTX_data_equals(member, "cloth")) {
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
- if(ptr && ptr->data) {
+ if (ptr && ptr->data) {
Object *ob= ptr->data;
ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth);
CTX_data_pointer_set(result, &ob->id, &RNA_ClothModifier, md);
return 1;
}
}
- else if(CTX_data_equals(member, "soft_body")) {
+ else if (CTX_data_equals(member, "soft_body")) {
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
- if(ptr && ptr->data) {
+ if (ptr && ptr->data) {
Object *ob= ptr->data;
ModifierData *md= modifiers_findByType(ob, eModifierType_Softbody);
CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodyModifier, md);
return 1;
}
}
- else if(CTX_data_equals(member, "fluid")) {
+ else if (CTX_data_equals(member, "fluid")) {
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
- if(ptr && ptr->data) {
+ if (ptr && ptr->data) {
Object *ob= ptr->data;
ModifierData *md= modifiers_findByType(ob, eModifierType_Fluidsim);
CTX_data_pointer_set(result, &ob->id, &RNA_FluidSimulationModifier, md);
@@ -919,34 +920,34 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
}
- else if(CTX_data_equals(member, "smoke")) {
+ else if (CTX_data_equals(member, "smoke")) {
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
- if(ptr && ptr->data) {
+ if (ptr && ptr->data) {
Object *ob= ptr->data;
ModifierData *md= modifiers_findByType(ob, eModifierType_Smoke);
CTX_data_pointer_set(result, &ob->id, &RNA_SmokeModifier, md);
return 1;
}
}
- else if(CTX_data_equals(member, "collision")) {
+ else if (CTX_data_equals(member, "collision")) {
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
- if(ptr && ptr->data) {
+ if (ptr && ptr->data) {
Object *ob= ptr->data;
ModifierData *md= modifiers_findByType(ob, eModifierType_Collision);
CTX_data_pointer_set(result, &ob->id, &RNA_CollisionModifier, md);
return 1;
}
}
- else if(CTX_data_equals(member, "brush")) {
+ else if (CTX_data_equals(member, "brush")) {
set_pointer_type(path, result, &RNA_Brush);
return 1;
}
- else if(CTX_data_equals(member, "dynamic_paint")) {
+ else if (CTX_data_equals(member, "dynamic_paint")) {
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
- if(ptr && ptr->data) {
+ if (ptr && ptr->data) {
Object *ob= ptr->data;
ModifierData *md= modifiers_findByType(ob, eModifierType_DynamicPaint);
CTX_data_pointer_set(result, &ob->id, &RNA_DynamicPaintModifier, md);
@@ -966,7 +967,7 @@ static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
SpaceButs *sbuts= CTX_wm_space_buts(C);
- if(sbuts->flag & SB_PIN_CONTEXT) {
+ if (sbuts->flag & SB_PIN_CONTEXT) {
sbuts->pinid= buttons_context_id_path(C);
}
else
@@ -986,7 +987,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
char namebuf[128], *name;
int a, icon;
- if(!path)
+ if (!path)
return;
row= uiLayoutRow(layout, 1);
@@ -994,27 +995,27 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
block= uiLayoutGetBlock(row);
uiBlockSetEmboss(block, UI_EMBOSSN);
- but= uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed");
+ but = uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed");
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
uiButSetFunc(but, pin_cb, NULL, NULL);
- for(a=0; a<path->len; a++) {
+ for (a=0; a<path->len; a++) {
ptr= &path->ptr[a];
- if(a != 0)
+ if (a != 0)
uiItemL(row, "", VICO_SMALL_TRI_RIGHT_VEC);
- if(ptr->data) {
+ if (ptr->data) {
icon= RNA_struct_ui_icon(ptr->type);
name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL);
- if(name) {
- if(!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE) && ptr->type == &RNA_Scene)
+ if (name) {
+ if (!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE) && ptr->type == &RNA_Scene)
uiItemLDrag(row, ptr, "", icon); /* save some space */
else
uiItemLDrag(row, ptr, name, icon);
- if(name != namebuf)
+ if (name != namebuf)
MEM_freeN(name);
}
else
@@ -1047,19 +1048,19 @@ ID *buttons_context_id_path(const bContext *C)
PointerRNA *ptr;
int a;
- if(path->len) {
- for(a=path->len-1; a>=0; a--) {
+ if (path->len) {
+ for (a=path->len-1; a>=0; a--) {
ptr= &path->ptr[a];
/* pin particle settings instead of system, since only settings are an idblock*/
- if(sbuts->mainb == BCONTEXT_PARTICLE && sbuts->flag & SB_PIN_CONTEXT) {
- if(ptr->type == &RNA_ParticleSystem && ptr->data) {
+ if (sbuts->mainb == BCONTEXT_PARTICLE && sbuts->flag & SB_PIN_CONTEXT) {
+ if (ptr->type == &RNA_ParticleSystem && ptr->data) {
ParticleSystem *psys = (ParticleSystem *)ptr->data;
return &psys->part->id;
}
}
- if(ptr->id.data) {
+ if (ptr->id.data) {
return ptr->id.data;
}
}
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 6777e2c2d85..fcc5b488ca9 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -63,7 +63,7 @@ static void set_texture_context(bContext *C, SpaceButs *sbuts)
case BCONTEXT_DATA:
{
Object *ob = CTX_data_active_object(C);
- if(ob && ob->type==OB_LAMP)
+ if (ob && ob->type==OB_LAMP)
sbuts->texture_context = SB_TEXC_MAT_OR_LAMP;
break;
}
@@ -80,7 +80,7 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
{
SpaceButs *sbuts= CTX_wm_space_buts(C);
- if(!sbuts) /* editor type switch */
+ if (!sbuts) /* editor type switch */
return;
switch(event) {
@@ -122,8 +122,8 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
uiBlockBeginAlign(block);
#define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \
- if(sbuts->pathflag & (1<<_ctx)) { \
- but= uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, TIP_(_tip)); \
+ if (sbuts->pathflag & (1<<_ctx)) { \
+ but = uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, TIP_(_tip)); \
uiButClearFlag(but, UI_BUT_UNDO); \
} \
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 26516bcda99..ec1c74013e0 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -81,13 +81,13 @@ static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(e
void BUTTONS_OT_toolbox(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toolbox";
- ot->description="Display button panel toolbox";
- ot->idname= "BUTTONS_OT_toolbox";
+ ot->name = "Toolbox";
+ ot->description = "Display button panel toolbox";
+ ot->idname = "BUTTONS_OT_toolbox";
/* api callbacks */
- ot->invoke= toolbox_invoke;
- ot->poll= ED_operator_buttons_active;
+ ot->invoke = toolbox_invoke;
+ ot->poll = ED_operator_buttons_active;
}
/********************** filebrowse operator *********************/
@@ -110,7 +110,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
str= RNA_string_get_alloc(op->ptr, path_prop, NULL, 0);
/* add slash for directories, important for some properties */
- if(RNA_property_subtype(fbo->prop) == PROP_DIRPATH) {
+ if (RNA_property_subtype(fbo->prop) == PROP_DIRPATH) {
char name[FILE_MAX];
id = fbo->ptr.id.data;
@@ -118,7 +118,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
BLI_strncpy(path, str, FILE_MAX);
BLI_path_abs(path, id ? ID_BLEND_PATH(G.main, id) : G.main->name);
- if(BLI_is_dir(path)) {
+ if (BLI_is_dir(path)) {
str = MEM_reallocN(str, strlen(str)+2);
BLI_add_slash(str);
}
@@ -134,8 +134,8 @@ static int file_browse_exec(bContext *C, wmOperator *op)
/* special, annoying exception, filesel on redo panel [#26618] */
{
wmOperator *redo_op= WM_operator_last_redo(C);
- if(redo_op) {
- if(fbo->ptr.data == redo_op->ptr->data) {
+ if (redo_op) {
+ if (fbo->ptr.data == redo_op->ptr->data) {
ED_undo_operator_repeat(C, redo_op);
}
}
@@ -168,19 +168,19 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
uiFileBrowseContextProperty(C, &ptr, &prop);
- if(!prop)
+ if (!prop)
return OPERATOR_CANCELLED;
str= RNA_property_string_get_alloc(&ptr, prop, NULL, 0, NULL);
/* useful yet irritating feature, Shift+Click to open the file
* Alt+Click to browse a folder in the OS's browser */
- if(event->shift || event->alt) {
+ if (event->shift || event->alt) {
PointerRNA props_ptr;
- if(event->alt) {
+ if (event->alt) {
char *lslash= BLI_last_slash(str);
- if(lslash)
+ if (lslash)
*lslash= '\0';
}
@@ -205,8 +205,8 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* normally ED_fileselect_get_params would handle this but we need to because of stupid
* user-prefs exception - campbell */
- if(RNA_struct_find_property(op->ptr, "relative_path")) {
- if(!RNA_struct_property_is_set(op->ptr, "relative_path")) {
+ if (RNA_struct_find_property(op->ptr, "relative_path")) {
+ if (!RNA_struct_property_is_set(op->ptr, "relative_path")) {
/* annoying exception!, if were dealign with the user prefs, default relative to be off */
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS && (ptr.data != &U));
}
@@ -220,14 +220,14 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
void BUTTONS_OT_file_browse(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Accept";
- ot->description="Open a file browser, Hold Shift to open the file, Alt to browse containing directory";
- ot->idname= "BUTTONS_OT_file_browse";
+ ot->name = "Accept";
+ ot->description = "Open a file browser, Hold Shift to open the file, Alt to browse containing directory";
+ ot->idname = "BUTTONS_OT_file_browse";
/* api callbacks */
- ot->invoke= file_browse_invoke;
- ot->exec= file_browse_exec;
- ot->cancel= file_browse_cancel;
+ ot->invoke = file_browse_invoke;
+ ot->exec = file_browse_exec;
+ ot->cancel = file_browse_cancel;
/* properties */
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -237,14 +237,14 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot)
void BUTTONS_OT_directory_browse(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Accept";
- ot->description="Open a directory browser, Hold Shift to open the file, Alt to browse containing directory";
- ot->idname= "BUTTONS_OT_directory_browse";
+ ot->name = "Accept";
+ ot->description = "Open a directory browser, Hold Shift to open the file, Alt to browse containing directory";
+ ot->idname = "BUTTONS_OT_directory_browse";
/* api callbacks */
- ot->invoke= file_browse_invoke;
- ot->exec= file_browse_exec;
- ot->cancel= file_browse_cancel;
+ ot->invoke = file_browse_invoke;
+ ot->exec = file_browse_exec;
+ ot->cancel = file_browse_cancel;
/* properties */
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c
index fb46dd55a12..ba37cb8a892 100644
--- a/source/blender/editors/space_buttons/buttons_texture.c
+++ b/source/blender/editors/space_buttons/buttons_texture.c
@@ -111,9 +111,9 @@ static void buttons_texture_users_find_nodetree(ListBase *users, ID *id,
{
bNode *node;
- if(ntree) {
- for(node=ntree->nodes.first; node; node=node->next) {
- if(node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
+ if (ntree) {
+ for (node=ntree->nodes.first; node; node=node->next) {
+ if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
PointerRNA ptr;
/* PropertyRNA *prop; */ /* UNUSED */
@@ -123,7 +123,7 @@ static void buttons_texture_users_find_nodetree(ListBase *users, ID *id,
buttons_texture_user_node_add(users, id, ntree, node,
category, RNA_struct_ui_icon(ptr.type), node->name);
}
- else if(node->type == NODE_GROUP && node->id) {
+ else if (node->type == NODE_GROUP && node->id) {
buttons_texture_users_find_nodetree(users, id, (bNodeTree*)node->id, category);
}
}
@@ -154,46 +154,46 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
ID *pinid = sbuts->pinid;
/* get data from context */
- if(pinid) {
- if(GS(pinid->name) == ID_SCE)
+ if (pinid) {
+ if (GS(pinid->name) == ID_SCE)
scene= (Scene*)pinid;
- else if(GS(pinid->name) == ID_OB)
+ else if (GS(pinid->name) == ID_OB)
ob= (Object*)pinid;
- else if(GS(pinid->name) == ID_LA)
+ else if (GS(pinid->name) == ID_LA)
la= (Lamp*)pinid;
- else if(GS(pinid->name) == ID_WO)
+ else if (GS(pinid->name) == ID_WO)
wrld= (World*)pinid;
- else if(GS(pinid->name) == ID_MA)
+ else if (GS(pinid->name) == ID_MA)
ma= (Material*)pinid;
- else if(GS(pinid->name) == ID_BR)
+ else if (GS(pinid->name) == ID_BR)
brush= (Brush*)pinid;
}
- if(!scene)
+ if (!scene)
scene= CTX_data_scene(C);
- if(!(pinid || pinid == &scene->id)) {
+ if (!(pinid || pinid == &scene->id)) {
ob= (scene->basact)? scene->basact->object: NULL;
wrld= scene->world;
brush= paint_brush(paint_get_active(scene));
}
- if(ob && ob->type == OB_LAMP && !la)
+ if (ob && ob->type == OB_LAMP && !la)
la= ob->data;
- if(ob && !ma)
+ if (ob && !ma)
ma= give_current_material(ob, ob->actcol);
/* fill users */
users->first = users->last = NULL;
- if(ma)
+ if (ma)
buttons_texture_users_find_nodetree(users, &ma->id, ma->nodetree, "Material");
- if(la)
+ if (la)
buttons_texture_users_find_nodetree(users, &la->id, la->nodetree, "Lamp");
- if(wrld)
+ if (wrld)
buttons_texture_users_find_nodetree(users, &wrld->id, wrld->nodetree, "World");
- if(ob) {
+ if (ob) {
ParticleSystem *psys= psys_get_current(ob);
MTex *mtex;
int a;
@@ -202,12 +202,12 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
modifiers_foreachTexLink(ob, buttons_texture_modifier_foreach, users);
/* particle systems */
- if(psys) {
+ if (psys) {
/* todo: these slots are not in the UI */
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
mtex = psys->part->mtex[a];
- if(mtex) {
+ if (mtex) {
PointerRNA ptr;
PropertyRNA *prop;
@@ -221,7 +221,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
}
/* field */
- if(ob->pd && ob->pd->forcefield == PFIELD_TEXTURE) {
+ if (ob->pd && ob->pd->forcefield == PFIELD_TEXTURE) {
PointerRNA ptr;
PropertyRNA *prop;
@@ -234,7 +234,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
}
/* brush */
- if(brush) {
+ if (brush) {
PointerRNA ptr;
PropertyRNA *prop;
@@ -253,8 +253,8 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
ButsContextTexture *ct= sbuts->texuser;
Scene *scene= CTX_data_scene(C);
- if(!scene_use_new_shading_nodes(scene)) {
- if(ct) {
+ if (!scene_use_new_shading_nodes(scene)) {
+ if (ct) {
BLI_freelistN(&ct->users);
MEM_freeN(ct);
sbuts->texuser= NULL;
@@ -263,7 +263,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
return;
}
- if(!ct) {
+ if (!ct) {
ct= MEM_callocN(sizeof(ButsContextTexture), "ButsContextTexture");
sbuts->texuser= ct;
}
@@ -274,14 +274,14 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
buttons_texture_users_from_context(&ct->users, C, sbuts);
/* set one user as active based on active index */
- if(ct->index >= BLI_countlist(&ct->users))
+ if (ct->index >= BLI_countlist(&ct->users))
ct->index= 0;
ct->user = BLI_findlink(&ct->users, ct->index);
ct->texture = NULL;
- if(ct->user) {
- if(ct->user->ptr.data) {
+ if (ct->user) {
+ if (ct->user->ptr.data) {
PointerRNA texptr;
Tex *tex;
@@ -291,14 +291,14 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
ct->texture = tex;
}
- else if(ct->user->node && !(ct->user->node->flag & NODE_ACTIVE_TEXTURE)) {
+ else if (ct->user->node && !(ct->user->node->flag & NODE_ACTIVE_TEXTURE)) {
ButsTextureUser *user;
/* detect change of active texture node in same node tree, in that
* case we also automatically switch to the other node */
- for(user=ct->users.first; user; user=user->next) {
- if(user->ntree == ct->user->ntree && user->node != ct->user->node) {
- if(user->node->flag & NODE_ACTIVE_TEXTURE) {
+ for (user=ct->users.first; user; user=user->next) {
+ if (user->ntree == ct->user->ntree && user->node != ct->user->node) {
+ if (user->node->flag & NODE_ACTIVE_TEXTURE) {
ct->user = user;
ct->index = BLI_findindex(&ct->users, user);
break;
@@ -318,11 +318,11 @@ static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg)
PointerRNA texptr;
Tex *tex;
- if(!ct)
+ if (!ct)
return;
/* set user as active */
- if(user->node) {
+ if (user->node) {
ED_node_set_active(CTX_data_main(C), user->ntree, user->node);
ct->texture = NULL;
}
@@ -346,12 +346,12 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS
uiBlock *block = uiLayoutGetBlock(layout);
const char *last_category = NULL;
- for(user=ct->users.first; user; user=user->next) {
+ for (user=ct->users.first; user; user=user->next) {
uiBut *but;
char name[UI_MAX_NAME_STR];
/* add label per category */
- if(!last_category || strcmp(last_category, user->category) != 0) {
+ if (!last_category || strcmp(last_category, user->category) != 0) {
uiItemL(layout, user->category, ICON_NONE);
but= block->buttons.last;
but->flag= UI_TEXT_LEFT;
@@ -380,13 +380,13 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
ButsTextureUser *user;
char name[UI_MAX_NAME_STR];
- if(!ct)
+ if (!ct)
return;
/* get current user */
user= ct->user;
- if(!user) {
+ if (!user) {
uiItemL(layout, "No textures in context.", ICON_NONE);
return;
}
@@ -394,12 +394,12 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
/* create button */
BLI_snprintf(name, UI_MAX_NAME_STR, "%s", user->name);
- if(user->icon) {
- but= uiDefIconTextMenuBut(block, template_texture_user_menu, NULL,
+ if (user->icon) {
+ but = uiDefIconTextMenuBut(block, template_texture_user_menu, NULL,
user->icon, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
}
else {
- but= uiDefMenuBut(block, template_texture_user_menu, NULL,
+ but = uiDefMenuBut(block, template_texture_user_menu, NULL,
name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
}
@@ -417,14 +417,14 @@ static void template_texture_show(bContext *C, void *data_p, void *prop_p)
ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL;
ButsTextureUser *user;
- if(!ct)
+ if (!ct)
return;
- for(user=ct->users.first; user; user=user->next)
- if(user->ptr.data == data_p && user->prop == prop_p)
+ for (user=ct->users.first; user; user=user->next)
+ if (user->ptr.data == data_p && user->prop == prop_p)
break;
- if(user) {
+ if (user) {
/* select texture */
template_texture_select(C, user, NULL);
@@ -446,20 +446,20 @@ void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, Prope
ButsTextureUser *user;
/* only show button in other tabs in properties editor */
- if(!ct || sbuts->mainb == BCONTEXT_TEXTURE)
+ if (!ct || sbuts->mainb == BCONTEXT_TEXTURE)
return;
/* find corresponding texture user */
- for(user=ct->users.first; user; user=user->next)
- if(user->ptr.data == ptr->data && user->prop == prop)
+ for (user=ct->users.first; user; user=user->next)
+ if (user->ptr.data == ptr->data && user->prop == prop)
break;
/* draw button */
- if(user) {
+ if (user) {
uiBlock *block = uiLayoutGetBlock(layout);
uiBut *but;
- but= uiDefIconBut(block, BUT, 0, ICON_BUTS, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ but = uiDefIconBut(block, BUT, 0, ICON_BUTS, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, "Show texture in texture tab");
uiButSetFunc(but, template_texture_show, user->ptr.data, user->prop);
}
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 23dd99ab73d..b29e79aeb67 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -97,10 +97,10 @@ static void buttons_free(SpaceLink *sl)
{
SpaceButs *sbuts= (SpaceButs*) sl;
- if(sbuts->path)
+ if (sbuts->path)
MEM_freeN(sbuts->path);
- if(sbuts->texuser) {
+ if (sbuts->texuser) {
ButsContextTexture *ct= sbuts->texuser;
BLI_freelistN(&ct->users);
MEM_freeN(ct);
@@ -113,8 +113,8 @@ static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
SpaceButs *sbuts= sa->spacedata.first;
/* auto-align based on size */
- if(sbuts->align == BUT_AUTO || !sbuts->align) {
- if(sa->winx > sa->winy)
+ if (sbuts->align == BUT_AUTO || !sbuts->align) {
+ if (sa->winx > sa->winy)
sbuts->align= BUT_HORIZONTAL;
else
sbuts->align= BUT_VERTICAL;
@@ -139,7 +139,7 @@ static void buttons_main_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap= WM_keymap_find(wm->defaultconf, "Property Editor", SPACE_BUTS, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Property Editor", SPACE_BUTS, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -151,31 +151,31 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
buttons_context_compute(C, sbuts);
- if(sbuts->mainb == BCONTEXT_SCENE)
+ if (sbuts->mainb == BCONTEXT_SCENE)
ED_region_panels(C, ar, vertical, "scene", sbuts->mainb);
- else if(sbuts->mainb == BCONTEXT_RENDER)
+ else if (sbuts->mainb == BCONTEXT_RENDER)
ED_region_panels(C, ar, vertical, "render", sbuts->mainb);
- else if(sbuts->mainb == BCONTEXT_WORLD)
+ else if (sbuts->mainb == BCONTEXT_WORLD)
ED_region_panels(C, ar, vertical, "world", sbuts->mainb);
- else if(sbuts->mainb == BCONTEXT_OBJECT)
+ else if (sbuts->mainb == BCONTEXT_OBJECT)
ED_region_panels(C, ar, vertical, "object", sbuts->mainb);
- else if(sbuts->mainb == BCONTEXT_DATA)
+ else if (sbuts->mainb == BCONTEXT_DATA)
ED_region_panels(C, ar, vertical, "data", sbuts->mainb);
- else if(sbuts->mainb == BCONTEXT_MATERIAL)
+ else if (sbuts->mainb == BCONTEXT_MATERIAL)
ED_region_panels(C, ar, vertical, "material", sbuts->mainb);
- else if(sbuts->mainb == BCONTEXT_TEXTURE)
+ else if (sbuts->mainb == BCONTEXT_TEXTURE)
ED_region_panels(C, ar, vertical, "texture", sbuts->mainb);
- else if(sbuts->mainb == BCONTEXT_PARTICLE)
+ else if (sbuts->mainb == BCONTEXT_PARTICLE)
ED_region_panels(C, ar, vertical, "particle", sbuts->mainb);
- else if(sbuts->mainb == BCONTEXT_PHYSICS)
+ else if (sbuts->mainb == BCONTEXT_PHYSICS)
ED_region_panels(C, ar, vertical, "physics", sbuts->mainb);
- else if(sbuts->mainb == BCONTEXT_BONE)
+ else if (sbuts->mainb == BCONTEXT_BONE)
ED_region_panels(C, ar, vertical, "bone", sbuts->mainb);
- else if(sbuts->mainb == BCONTEXT_MODIFIER)
+ else if (sbuts->mainb == BCONTEXT_MODIFIER)
ED_region_panels(C, ar, vertical, "modifier", sbuts->mainb);
else if (sbuts->mainb == BCONTEXT_CONSTRAINT)
ED_region_panels(C, ar, vertical, "constraint", sbuts->mainb);
- else if(sbuts->mainb == BCONTEXT_BONE_CONSTRAINT)
+ else if (sbuts->mainb == BCONTEXT_BONE_CONSTRAINT)
ED_region_panels(C, ar, vertical, "bone_constraint", sbuts->mainb);
sbuts->re_align= 0;
@@ -191,7 +191,7 @@ static void buttons_operatortypes(void)
static void buttons_keymap(struct wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Property Editor", SPACE_BUTS, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Property Editor", SPACE_BUTS, 0);
WM_keymap_add_item(keymap, "BUTTONS_OT_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0);
}
@@ -224,7 +224,7 @@ static void buttons_area_redraw(ScrArea *sa, short buttons)
SpaceButs *sbuts= sa->spacedata.first;
/* if the area's current button set is equal to the one to redraw */
- if(sbuts->mainb == buttons)
+ if (sbuts->mainb == buttons)
ED_area_tag_redraw(sa);
}
@@ -273,9 +273,10 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
case ND_BONE_SELECT:
buttons_area_redraw(sa, BCONTEXT_BONE);
buttons_area_redraw(sa, BCONTEXT_BONE_CONSTRAINT);
+ buttons_area_redraw(sa, BCONTEXT_DATA);
break;
case ND_MODIFIER:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_area_tag_redraw(sa);
else
buttons_area_redraw(sa, BCONTEXT_MODIFIER);
@@ -341,11 +342,11 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
sbuts->preview= 1;
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_PROPERTIES)
+ if (wmn->data == ND_SPACE_PROPERTIES)
ED_area_tag_redraw(sa);
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_area_tag_redraw(sa);
break;
case NC_ANIMATION:
@@ -357,10 +358,10 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_NODE:
- if(wmn->action==NA_SELECTED) {
+ if (wmn->action==NA_SELECTED) {
ED_area_tag_redraw(sa);
/* new active node, update texture preview */
- if(sbuts->mainb == BCONTEXT_TEXTURE)
+ if (sbuts->mainb == BCONTEXT_TEXTURE)
sbuts->preview= 1;
}
break;
@@ -375,7 +376,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
break;
}
- if(wmn->data == ND_KEYS)
+ if (wmn->data == ND_KEYS)
ED_area_tag_redraw(sa);
}
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index ddfd403806c..bb816d1b8b2 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -85,17 +85,17 @@ void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
uiLayout *row, *split;
uiBlock *block;
- if(!ptr->data)
+ if (!ptr->data)
return;
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
printf("%s: property not found: %s.%s\n",
__func__, RNA_struct_identifier(ptr->type), propname);
return;
}
- if(RNA_property_type(prop) != PROP_POINTER) {
+ if (RNA_property_type(prop) != PROP_POINTER) {
printf("%s: expected pointer property for %s.%s\n",
__func__, RNA_struct_identifier(ptr->type), propname);
return;
@@ -106,10 +106,10 @@ void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
uiLayoutSetContextPointer(layout, "edit_movieclip", &clipptr);
- if(!compact)
+ if (!compact)
uiTemplateID(layout, C, ptr, propname, NULL, "CLIP_OT_open", NULL);
- if(clip) {
+ if (clip) {
row= uiLayoutRow(layout, 0);
block= uiLayoutGetBlock(row);
uiDefBut(block, LABEL, 0, "File Path:", 0, 19, 145, 19, NULL, 0, 0, 0, 0, "");
@@ -133,17 +133,17 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
rctf rect;
MovieClipScopes *scopes;
- if(!ptr->data)
+ if (!ptr->data)
return;
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
printf("%s: property not found: %s.%s\n",
__func__, RNA_struct_identifier(ptr->type), propname);
return;
}
- if(RNA_property_type(prop) != PROP_POINTER) {
+ if (RNA_property_type(prop) != PROP_POINTER) {
printf("%s: expected pointer property for %s.%s\n",
__func__, RNA_struct_identifier(ptr->type), propname);
return;
@@ -152,8 +152,8 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
scopesptr= RNA_property_pointer_get(ptr, prop);
scopes= (MovieClipScopes *)scopesptr.data;
- rect.xmin= 0; rect.xmax= 200;
- rect.ymin= 0; rect.ymax= 120;
+ rect.xmin = 0; rect.xmax = 200;
+ rect.ymin = 0; rect.ymax = 120;
block= uiLayoutAbsoluteBlock(layout);
@@ -198,7 +198,7 @@ static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
MarkerUpdateCb *cb= (MarkerUpdateCb*) arg_cb;
MovieTrackingMarker *marker;
- if(!cb->compact)
+ if (!cb->compact)
return;
marker= BKE_tracking_ensure_marker(cb->track, cb->framenr);
@@ -218,7 +218,7 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
marker= BKE_tracking_ensure_marker(cb->track, cb->framenr);
- if(event==B_MARKER_POS) {
+ if (event==B_MARKER_POS) {
marker->pos[0]= cb->marker_pos[0]/width;
marker->pos[1]= cb->marker_pos[1]/height;
@@ -228,7 +228,7 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
ok= 1;
}
- else if(event==B_MARKER_PAT_DIM) {
+ else if (event==B_MARKER_PAT_DIM) {
float dim[2], pat_dim[2];
sub_v2_v2v2(pat_dim, cb->track->pat_max, cb->track->pat_min);
@@ -249,7 +249,7 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
ok= 1;
}
- else if(event==B_MARKER_SEARCH_POS) {
+ else if (event==B_MARKER_SEARCH_POS) {
float delta[2], side[2];
sub_v2_v2v2(side, cb->track->search_max, cb->track->search_min);
@@ -265,7 +265,7 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
ok= 1;
}
- else if(event==B_MARKER_SEARCH_DIM) {
+ else if (event==B_MARKER_SEARCH_DIM) {
float dim[2], search_dim[2];
sub_v2_v2v2(search_dim, cb->track->search_max, cb->track->search_min);
@@ -285,11 +285,13 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
BKE_tracking_clamp_track(cb->track, CLAMP_SEARCH_DIM);
ok= 1;
- } else if(event==B_MARKER_FLAG) {
+ }
+ else if (event==B_MARKER_FLAG) {
marker->flag= cb->marker_flag;
ok= 1;
- } else if(event==B_MARKER_OFFSET) {
+ }
+ else if (event==B_MARKER_OFFSET) {
float offset[2], delta[2];
int i;
@@ -299,7 +301,7 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
sub_v2_v2v2(delta, offset, cb->track->offset);
copy_v2_v2(cb->track->offset, offset);
- for(i=0; i<cb->track->markersnr; i++)
+ for (i=0; i<cb->track->markersnr; i++)
sub_v2_v2(cb->track->markers[i].pos, delta);
/* to update position of "parented" objects */
@@ -309,7 +311,7 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
ok= 1;
}
- if(ok)
+ if (ok)
WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, cb->clip);
}
@@ -326,17 +328,17 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
MarkerUpdateCb *cb;
const char *tip;
- if(!ptr->data)
+ if (!ptr->data)
return;
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
printf("%s: property not found: %s.%s\n",
__func__, RNA_struct_identifier(ptr->type), propname);
return;
}
- if(RNA_property_type(prop) != PROP_POINTER) {
+ if (RNA_property_type(prop) != PROP_POINTER) {
printf("%s: expected pointer property for %s.%s\n",
__func__, RNA_struct_identifier(ptr->type), propname);
return;
@@ -357,24 +359,25 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
cb->marker_flag= marker->flag;
cb->framenr= user->framenr;
- if(compact) {
+ if (compact) {
block= uiLayoutGetBlock(layout);
- if(cb->marker_flag&MARKER_DISABLED)
+ if (cb->marker_flag&MARKER_DISABLED)
tip= "Marker is disabled at current frame";
else
tip= "Marker is enabled at current frame";
bt= uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, &cb->marker_flag, 0, 0, 1, 0, tip);
uiButSetNFunc(bt, marker_update_cb, cb, NULL);
- } else {
+ }
+ else {
int width, height, step, digits;
float pat_dim[2], pat_pos[2], search_dim[2], search_pos[2];
uiLayout *col;
BKE_movieclip_get_size(clip, user, &width, &height);
- if(track->flag&TRACK_LOCKED) {
+ if (track->flag&TRACK_LOCKED) {
uiLayoutSetActive(layout, 0);
block= uiLayoutAbsoluteBlock(layout);
uiDefBut(block, LABEL, 0, "Track is locked", 0, 0, 300, 19, NULL, 0, 0, 0, 0, "");
@@ -406,7 +409,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
uiBlockSetHandleFunc(block, marker_block_handler, cb);
uiBlockSetNFunc(block, marker_update_cb, cb, NULL);
- if(cb->marker_flag&MARKER_DISABLED)
+ if (cb->marker_flag&MARKER_DISABLED)
tip= "Marker is disabled at current frame";
else
tip= "Marker is enabled at current frame";
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 920b8dc3ccb..ef83a62c290 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -107,10 +107,10 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
/* cached segments -- could be usefu lto debug caching strategies */
BKE_movieclip_get_cache_segments(clip, &sc->user, &totseg, &points);
- if(totseg) {
+ if (totseg) {
glColor4ub(128, 128, 255, 128);
- for(a= 0; a<totseg; a++) {
+ for (a= 0; a<totseg; a++) {
float x1, x2;
x1= (points[a*2]-sfra)/(efra-sfra+1)*ar->winx;
@@ -121,31 +121,31 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
}
/* track */
- if(act_track) {
+ if (act_track) {
MovieTrackingTrack *track= act_track;
- for(i= sfra, a= 0; i <= efra; i++) {
+ for (i= sfra, a= 0; i <= efra; i++) {
int framenr;
MovieTrackingMarker *marker;
- while(a<track->markersnr) {
- if(track->markers[a].framenr>=i)
+ while (a<track->markersnr) {
+ if (track->markers[a].framenr>=i)
break;
- if(a<track->markersnr-1 && track->markers[a+1].framenr>i)
+ if (a<track->markersnr-1 && track->markers[a+1].framenr>i)
break;
a++;
}
- if(a<track->markersnr) marker= &track->markers[a];
+ if (a<track->markersnr) marker= &track->markers[a];
else marker= &track->markers[track->markersnr-1];
- if((marker->flag&MARKER_DISABLED)==0) {
+ if ((marker->flag&MARKER_DISABLED)==0) {
framenr= marker->framenr;
- if(framenr!=i) glColor4ub(128, 128, 0, 96);
- else if((marker->flag&MARKER_TRACKED)==0) glColor4ub(255, 255, 0, 196);
+ if (framenr!=i) glColor4ub(128, 128, 0, 96);
+ else if ((marker->flag&MARKER_TRACKED)==0) glColor4ub(255, 255, 0, 196);
else glColor4ub(255, 255, 0, 96);
glRecti((i-sfra)*framelen, 0, (i-sfra+1)*framelen, 4);
@@ -154,28 +154,28 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
}
/* failed frames */
- if(reconstruction->flag&TRACKING_RECONSTRUCTED) {
+ if (reconstruction->flag&TRACKING_RECONSTRUCTED) {
int n= reconstruction->camnr;
MovieReconstructedCamera *cameras= reconstruction->cameras;
glColor4ub(255, 0, 0, 96);
- for(i= sfra, a= 0; i <= efra; i++) {
+ for (i= sfra, a= 0; i <= efra; i++) {
int ok= 0;
- while(a<n) {
- if(cameras[a].framenr==i) {
+ while (a<n) {
+ if (cameras[a].framenr==i) {
ok= 1;
break;
}
- else if(cameras[a].framenr>i) {
+ else if (cameras[a].framenr>i) {
break;
}
a++;
}
- if(!ok)
+ if (!ok)
glRecti((i-sfra)*framelen, 0, (i-sfra+1)*framelen, 8);
}
}
@@ -198,15 +198,16 @@ static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar)
char str[256]= {0};
int block= 0;
- if(tracking->stats) {
+ if (tracking->stats) {
BLI_strncpy(str, tracking->stats->message, sizeof(str));
block= 1;
- } else {
- if(sc->flag&SC_LOCK_SELECTION)
+ }
+ else {
+ if (sc->flag&SC_LOCK_SELECTION)
strcpy(str, "Locked");
}
- if(str[0])
+ if (str[0])
ED_region_info_draw(ar, str, block, 0.6f);
}
@@ -222,20 +223,21 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf,
/* find window pixel coordinates of origin */
UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
- if(sc->flag&SC_MUTE_FOOTAGE) {
+ if (sc->flag&SC_MUTE_FOOTAGE) {
glColor3f(0.0f, 0.0f, 0.0f);
glRectf(x, y, x+zoomx*width, y+zoomy*height);
- } else {
- if(ibuf->rect_float && !ibuf->rect) {
+ }
+ else {
+ if (ibuf->rect_float && !ibuf->rect) {
IMB_rect_from_float(ibuf);
}
- if(ibuf->rect)
+ if (ibuf->rect)
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
}
/* draw boundary border for frame if stabilization is enabled */
- if(sc->flag&SC_SHOW_STABLE && clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) {
+ if (sc->flag&SC_SHOW_STABLE && clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) {
glColor3f(0.0f, 0.0f, 0.0f);
glLineStipple(3, 0xaaaa);
glEnable(GL_LINE_STIPPLE);
@@ -274,63 +276,66 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
int tiny= sc->flag&SC_SHOW_TINY_MARKER, framenr;
MovieTrackingMarker *marker;
- if(count==0)
+ if (count==0)
return;
marker= BKE_tracking_get_marker(track, sc->user.framenr);
- if(marker->framenr!=sc->user.framenr || marker->flag&MARKER_DISABLED)
+ if (marker->framenr!=sc->user.framenr || marker->flag&MARKER_DISABLED)
return;
framenr= marker->framenr;
a= count;
i= framenr-1;
- while(i>=framenr-count) {
+ while (i>=framenr-count) {
marker= BKE_tracking_get_marker(track, i);
- if(!marker || marker->flag&MARKER_DISABLED)
+ if (!marker || marker->flag&MARKER_DISABLED)
break;
- if(marker->framenr==i) {
+ if (marker->framenr==i) {
add_v2_v2v2(path[--a], marker->pos, track->offset);
ED_clip_point_undistorted_pos(sc, path[a], path[a]);
- if(marker->framenr==sc->user.framenr)
+ if (marker->framenr==sc->user.framenr)
curindex= a;
- } else
+ }
+ else {
break;
+ }
i--;
}
b= count;
i= framenr;
- while(i<=framenr+count) {
+ while (i<=framenr+count) {
marker= BKE_tracking_get_marker(track, i);
- if(!marker || marker->flag&MARKER_DISABLED)
+ if (!marker || marker->flag&MARKER_DISABLED)
break;
- if(marker->framenr==i) {
- if(marker->framenr==sc->user.framenr)
+ if (marker->framenr==i) {
+ if (marker->framenr==sc->user.framenr)
curindex= b;
add_v2_v2v2(path[b++], marker->pos, track->offset);
ED_clip_point_undistorted_pos(sc, path[b-1], path[b-1]);
- } else
+ }
+ else
break;
i++;
}
- if(!tiny) {
+ if (!tiny) {
UI_ThemeColor(TH_MARKER_OUTLINE);
- if(TRACK_VIEW_SELECTED(sc, track)) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
glPointSize(5.0f);
glBegin(GL_POINTS);
- for(i= a; i<b; i++) {
- if(i!=curindex)
+ for (i= a; i<b; i++) {
+ if (i!=curindex)
glVertex2f(path[i][0], path[i][1]);
}
glEnd();
@@ -338,7 +343,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
glLineWidth(3.0f);
glBegin(GL_LINE_STRIP);
- for(i= a; i<b; i++)
+ for (i= a; i<b; i++)
glVertex2f(path[i][0], path[i][1]);
glEnd();
glLineWidth(1.0f);
@@ -346,14 +351,14 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
UI_ThemeColor(TH_PATH_BEFORE);
- if(TRACK_VIEW_SELECTED(sc, track)) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
glPointSize(3.0f);
glBegin(GL_POINTS);
- for(i= a; i<b; i++) {
- if(i==count+1)
+ for (i= a; i<b; i++) {
+ if (i==count+1)
UI_ThemeColor(TH_PATH_AFTER);
- if(i!=curindex)
+ if (i!=curindex)
glVertex2f(path[i][0], path[i][1]);
}
glEnd();
@@ -362,8 +367,8 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
UI_ThemeColor(TH_PATH_BEFORE);
glBegin(GL_LINE_STRIP);
- for(i= a; i<b; i++) {
- if(i==count+1)
+ for (i= a; i<b; i++) {
+ if (i==count+1)
UI_ThemeColor(TH_PATH_AFTER);
glVertex2f(path[i][0], path[i][1]);
@@ -383,7 +388,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
px[0]= 1.0f/width/sc->zoom;
px[1]= 1.0f/height/sc->zoom;
- if((marker->flag&MARKER_DISABLED)==0) {
+ if ((marker->flag&MARKER_DISABLED)==0) {
float pos[2];
rctf r;
@@ -392,15 +397,16 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
ED_clip_point_undistorted_pos(sc, pos, pos);
- if(BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) {
- if(tiny) glPointSize(3.0f);
+ if (BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) {
+ if (tiny) glPointSize(3.0f);
else glPointSize(4.0f);
glBegin(GL_POINTS);
glVertex2f(pos[0], pos[1]);
glEnd();
glPointSize(1.0f);
- } else {
- if(!tiny) glLineWidth(3.0f);
+ }
+ else {
+ if (!tiny) glLineWidth(3.0f);
glBegin(GL_LINES);
glVertex2f(pos[0] + px[0]*2, pos[1]);
glVertex2f(pos[0] + px[0]*8, pos[1]);
@@ -414,7 +420,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
glVertex2f(pos[0], pos[1] + px[1]*2);
glVertex2f(pos[0], pos[1] + px[1]*8);
glEnd();
- if(!tiny) glLineWidth(1.0f);
+ if (!tiny) glLineWidth(1.0f);
}
}
@@ -422,9 +428,9 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
glPushMatrix();
glTranslatef(marker_pos[0], marker_pos[1], 0);
- if(!tiny) glLineWidth(3.0f);
+ if (!tiny) glLineWidth(3.0f);
- if(sc->flag&SC_SHOW_MARKER_PATTERN) {
+ if (sc->flag&SC_SHOW_MARKER_PATTERN) {
glBegin(GL_LINE_LOOP);
glVertex2f(track->pat_min[0], track->pat_min[1]);
glVertex2f(track->pat_max[0], track->pat_min[1]);
@@ -434,7 +440,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
}
show_search= TRACK_VIEW_SELECTED(sc, track) && ((marker->flag&MARKER_DISABLED)==0 || (sc->flag&SC_SHOW_MARKER_PATTERN)==0);
- if(sc->flag&SC_SHOW_MARKER_SEARCH && show_search) {
+ if (sc->flag&SC_SHOW_MARKER_SEARCH && show_search) {
glBegin(GL_LINE_LOOP);
glVertex2f(track->search_min[0], track->search_min[1]);
glVertex2f(track->search_max[0], track->search_min[1]);
@@ -444,20 +450,21 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
}
glPopMatrix();
- if(!tiny) glLineWidth(1.0f);
+ if (!tiny) glLineWidth(1.0f);
}
static void track_colors(MovieTrackingTrack *track, int act, float col[3], float scol[3])
{
- if(track->flag&TRACK_CUSTOMCOLOR) {
- if(act) UI_GetThemeColor3fv(TH_ACT_MARKER, scol);
+ if (track->flag&TRACK_CUSTOMCOLOR) {
+ if (act) UI_GetThemeColor3fv(TH_ACT_MARKER, scol);
else copy_v3_v3(scol, track->color);
mul_v3_v3fl(col, track->color, 0.5f);
- } else {
+ }
+ else {
UI_GetThemeColor3fv(TH_MARKER, col);
- if(act) UI_GetThemeColor3fv(TH_ACT_MARKER, scol);
+ if (act) UI_GetThemeColor3fv(TH_ACT_MARKER, scol);
else UI_GetThemeColor3fv(TH_SEL_MARKER, scol);
}
}
@@ -474,16 +481,17 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
px[1]= 1.0f/height/sc->zoom;
/* marker position and offset position */
- if((track->flag&SELECT)==sel && (marker->flag&MARKER_DISABLED)==0) {
+ if ((track->flag&SELECT)==sel && (marker->flag&MARKER_DISABLED)==0) {
float pos[2];
rctf r;
- if(track->flag&TRACK_LOCKED) {
- if(act) UI_ThemeColor(TH_ACT_MARKER);
- else if(track->flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
+ if (track->flag&TRACK_LOCKED) {
+ if (act) UI_ThemeColor(TH_ACT_MARKER);
+ else if (track->flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
else UI_ThemeColor(TH_LOCK_MARKER);
- } else {
- if(track->flag&SELECT) glColor3fv(scol);
+ }
+ else {
+ if (track->flag&SELECT) glColor3fv(scol);
else glColor3fv(col);
}
@@ -491,13 +499,14 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
add_v2_v2v2(pos, marker->pos, track->offset);
ED_clip_point_undistorted_pos(sc, pos, pos);
- if(BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) {
- if(!tiny) glPointSize(2.0f);
+ if (BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) {
+ if (!tiny) glPointSize(2.0f);
glBegin(GL_POINTS);
glVertex2f(pos[0], pos[1]);
glEnd();
- if(!tiny) glPointSize(1.0f);
- } else {
+ if (!tiny) glPointSize(1.0f);
+ }
+ else {
glBegin(GL_LINES);
glVertex2f(pos[0] + px[0]*3, pos[1]);
glVertex2f(pos[0] + px[0]*7, pos[1]);
@@ -532,23 +541,24 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
glPushMatrix();
glTranslatef(marker_pos[0], marker_pos[1], 0);
- if(tiny) {
+ if (tiny) {
glLineStipple(3, 0xaaaa);
glEnable(GL_LINE_STIPPLE);
}
- if((track->pat_flag&SELECT)==sel && (sc->flag&SC_SHOW_MARKER_PATTERN)) {
- if(track->flag&TRACK_LOCKED) {
- if(act) UI_ThemeColor(TH_ACT_MARKER);
- else if(track->pat_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
+ if ((track->pat_flag&SELECT)==sel && (sc->flag&SC_SHOW_MARKER_PATTERN)) {
+ if (track->flag&TRACK_LOCKED) {
+ if (act) UI_ThemeColor(TH_ACT_MARKER);
+ else if (track->pat_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
else UI_ThemeColor(TH_LOCK_MARKER);
}
- else if(marker->flag&MARKER_DISABLED) {
- if(act) UI_ThemeColor(TH_ACT_MARKER);
- else if(track->pat_flag&SELECT) UI_ThemeColorShade(TH_DIS_MARKER, 128);
+ else if (marker->flag&MARKER_DISABLED) {
+ if (act) UI_ThemeColor(TH_ACT_MARKER);
+ else if (track->pat_flag&SELECT) UI_ThemeColorShade(TH_DIS_MARKER, 128);
else UI_ThemeColor(TH_DIS_MARKER);
- } else {
- if(track->pat_flag&SELECT) glColor3fv(scol);
+ }
+ else {
+ if (track->pat_flag&SELECT) glColor3fv(scol);
else glColor3fv(col);
}
@@ -562,18 +572,19 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
/* search */
show_search= TRACK_VIEW_SELECTED(sc, track) && ((marker->flag&MARKER_DISABLED)==0 || (sc->flag&SC_SHOW_MARKER_PATTERN)==0);
- if((track->search_flag&SELECT)==sel && (sc->flag&SC_SHOW_MARKER_SEARCH) && show_search) {
- if(track->flag&TRACK_LOCKED) {
- if(act) UI_ThemeColor(TH_ACT_MARKER);
- else if(track->search_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
+ if ((track->search_flag&SELECT)==sel && (sc->flag&SC_SHOW_MARKER_SEARCH) && show_search) {
+ if (track->flag&TRACK_LOCKED) {
+ if (act) UI_ThemeColor(TH_ACT_MARKER);
+ else if (track->search_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
else UI_ThemeColor(TH_LOCK_MARKER);
}
- else if(marker->flag&MARKER_DISABLED) {
- if(act) UI_ThemeColor(TH_ACT_MARKER);
- else if(track->search_flag&SELECT) UI_ThemeColorShade(TH_DIS_MARKER, 128);
+ else if (marker->flag&MARKER_DISABLED) {
+ if (act) UI_ThemeColor(TH_ACT_MARKER);
+ else if (track->search_flag&SELECT) UI_ThemeColorShade(TH_DIS_MARKER, 128);
else UI_ThemeColor(TH_DIS_MARKER);
- } else {
- if(track->search_flag&SELECT) glColor3fv(scol);
+ }
+ else {
+ if (track->search_flag&SELECT) glColor3fv(scol);
else glColor3fv(col);
}
@@ -586,18 +597,19 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
}
/* pyramid */
- if(sel && TRACK_VIEW_SELECTED(sc, track) && (track->tracker==TRACKER_KLT) && (marker->flag&MARKER_DISABLED)==0) {
- if(track->flag&TRACK_LOCKED) {
- if(act) UI_ThemeColor(TH_ACT_MARKER);
- else if(track->pat_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
+ if (sel && TRACK_VIEW_SELECTED(sc, track) && (track->tracker==TRACKER_KLT) && (marker->flag&MARKER_DISABLED)==0) {
+ if (track->flag&TRACK_LOCKED) {
+ if (act) UI_ThemeColor(TH_ACT_MARKER);
+ else if (track->pat_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
else UI_ThemeColor(TH_LOCK_MARKER);
}
- else if(marker->flag&MARKER_DISABLED) {
- if(act) UI_ThemeColor(TH_ACT_MARKER);
- else if(track->pat_flag&SELECT) UI_ThemeColorShade(TH_DIS_MARKER, 128);
+ else if (marker->flag&MARKER_DISABLED) {
+ if (act) UI_ThemeColor(TH_ACT_MARKER);
+ else if (track->pat_flag&SELECT) UI_ThemeColorShade(TH_DIS_MARKER, 128);
else UI_ThemeColor(TH_DIS_MARKER);
- } else {
- if(track->pat_flag&SELECT) glColor3fv(scol);
+ }
+ else {
+ if (track->pat_flag&SELECT) glColor3fv(scol);
else glColor3fv(col);
}
@@ -620,7 +632,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
}
}
- if(tiny)
+ if (tiny)
glDisable(GL_LINE_STIPPLE);
glPopMatrix();
@@ -633,15 +645,15 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
int tiny= sc->flag&SC_SHOW_TINY_MARKER;
float col[3], scol[3], px[2];
- if((tiny && outline) || (marker->flag&MARKER_DISABLED))
+ if ((tiny && outline) || (marker->flag&MARKER_DISABLED))
return;
- if(!TRACK_VIEW_SELECTED(sc, track) || track->flag&TRACK_LOCKED)
+ if (!TRACK_VIEW_SELECTED(sc, track) || track->flag&TRACK_LOCKED)
return;
track_colors(track, act, col, scol);
- if(outline) {
+ if (outline) {
glLineWidth(3.0f);
UI_ThemeColor(TH_MARKER_OUTLINE);
}
@@ -661,9 +673,9 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
px[0]= 1.0f/sc->zoom/width/sc->scale;
px[1]= 1.0f/sc->zoom/height/sc->scale;
- if((sc->flag&SC_SHOW_MARKER_SEARCH) && ((track->search_flag&SELECT)==sel || outline)) {
- if(!outline) {
- if(track->search_flag&SELECT) glColor3fv(scol);
+ if ((sc->flag&SC_SHOW_MARKER_SEARCH) && ((track->search_flag&SELECT)==sel || outline)) {
+ if (!outline) {
+ if (track->search_flag&SELECT) glColor3fv(scol);
else glColor3fv(col);
}
@@ -674,7 +686,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
tdx= searchdx;
tdy= searchdy;
- if(outline) {
+ if (outline) {
tdx+= px[0];
tdy+= px[1];
}
@@ -693,7 +705,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
tdx= searchdx*2.0f;
tdy= searchdy*2.0f;
- if(outline) {
+ if (outline) {
tdx+= px[0];
tdy+= px[1];
}
@@ -705,9 +717,9 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
glEnd();
}
- if((sc->flag&SC_SHOW_MARKER_PATTERN) && ((track->pat_flag&SELECT)==sel || outline)) {
- if(!outline) {
- if(track->pat_flag&SELECT) glColor3fv(scol);
+ if ((sc->flag&SC_SHOW_MARKER_PATTERN) && ((track->pat_flag&SELECT)==sel || outline)) {
+ if (!outline) {
+ if (track->pat_flag&SELECT) glColor3fv(scol);
else glColor3fv(col);
}
@@ -718,7 +730,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
tdx= patdx;
tdy= patdy;
- if(outline) {
+ if (outline) {
tdx+= px[0];
tdy+= px[1];
}
@@ -737,7 +749,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
tdx= patdx*2.0f;
tdy= patdy*2.0f;
- if(outline) {
+ if (outline) {
tdx+= px[0];
tdy+= px[1];
}
@@ -751,7 +763,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
glPopMatrix();
- if(outline)
+ if (outline)
glLineWidth(1.0f);
}
@@ -763,26 +775,28 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
uiStyle *style= U.uistyles.first;
int fontid= style->widget.uifont_id;
- if(!TRACK_VIEW_SELECTED(sc, track))
+ if (!TRACK_VIEW_SELECTED(sc, track))
return;
BLF_size(fontid, 11.0f, U.dpi);
fontsize= BLF_height_max(fontid);
- if(marker->flag&MARKER_DISABLED) {
- if(act) UI_ThemeColor(TH_ACT_MARKER);
+ if (marker->flag&MARKER_DISABLED) {
+ if (act) UI_ThemeColor(TH_ACT_MARKER);
else UI_ThemeColorShade(TH_DIS_MARKER, 128);
- } else {
- if(act) UI_ThemeColor(TH_ACT_MARKER);
+ }
+ else {
+ if (act) UI_ThemeColor(TH_ACT_MARKER);
else UI_ThemeColor(TH_SEL_MARKER);
}
- if((sc->flag&SC_SHOW_MARKER_SEARCH) &&
+ if ((sc->flag&SC_SHOW_MARKER_SEARCH) &&
((marker->flag&MARKER_DISABLED)==0 || (sc->flag&SC_SHOW_MARKER_PATTERN)==0))
{
dx= track->search_min[0];
dy= track->search_min[1];
- } else if(sc->flag&SC_SHOW_MARKER_PATTERN) {
+ }
+ else if (sc->flag&SC_SHOW_MARKER_PATTERN) {
dx= track->pat_min[0];
dy= track->pat_min[1];
}
@@ -796,12 +810,12 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
pos[0]= pos[0]*zoomx;
pos[1]= pos[1]*zoomy - fontsize;
- if(marker->flag&MARKER_DISABLED) strcpy(state, "disabled");
- else if(marker->framenr!=sc->user.framenr) strcpy(state, "estimated");
- else if(marker->flag&MARKER_TRACKED) strcpy(state, "tracked");
+ if (marker->flag&MARKER_DISABLED) strcpy(state, "disabled");
+ else if (marker->framenr!=sc->user.framenr) strcpy(state, "estimated");
+ else if (marker->flag&MARKER_TRACKED) strcpy(state, "tracked");
else strcpy(state, "keyframed");
- if(state[0])
+ if (state[0])
BLI_snprintf(str, sizeof(str), "%s: %s", track->name, state);
else
BLI_snprintf(str, sizeof(str), "%s", track->name);
@@ -810,14 +824,14 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
BLF_draw(fontid, str, sizeof(str));
pos[1]-= fontsize;
- if(track->flag&TRACK_HAS_BUNDLE) {
+ if (track->flag&TRACK_HAS_BUNDLE) {
BLI_snprintf(str, sizeof(str), "Average error: %.3f", track->error);
BLF_position(fontid, pos[0], pos[1], 0.0f);
BLF_draw(fontid, str, sizeof(str));
pos[1]-= fontsize;
}
- if(track->flag&TRACK_LOCKED) {
+ if (track->flag&TRACK_LOCKED) {
BLF_position(fontid, pos[0], pos[1], 0.0f);
BLF_draw(fontid, "locked", 6);
}
@@ -865,16 +879,16 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
act_track= BKE_tracking_active_track(tracking);
- if(sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
+ if (sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
int count= 0;
/* count */
track= tracksbase->first;
- while(track) {
- if((track->flag&TRACK_HIDDEN)==0) {
+ while (track) {
+ if ((track->flag&TRACK_HIDDEN)==0) {
marker= BKE_tracking_get_marker(track, framenr);
- if(MARKER_VISIBLE(sc, marker))
+ if (MARKER_VISIBLE(sc, marker))
count++;
}
@@ -882,19 +896,19 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
}
/* undistort */
- if(count) {
+ if (count) {
marker_pos= MEM_callocN(2*sizeof(float)*count, "draw_tracking_tracks marker_pos");
track= tracksbase->first;
fp= marker_pos;
- while(track) {
- if((track->flag&TRACK_HIDDEN)==0) {
+ while (track) {
+ if ((track->flag&TRACK_HIDDEN)==0) {
marker= BKE_tracking_get_marker(track, framenr);
- if(MARKER_VISIBLE(sc, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
ED_clip_point_undistorted_pos(sc, marker->pos, fp);
- if(track==act_track)
+ if (track==act_track)
active_pos= fp;
fp+= 2;
@@ -906,10 +920,10 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
}
}
- if(sc->flag&SC_SHOW_TRACK_PATH) {
+ if (sc->flag&SC_SHOW_TRACK_PATH) {
track= tracksbase->first;
- while(track) {
- if((track->flag&TRACK_HIDDEN)==0)
+ while (track) {
+ if ((track->flag&TRACK_HIDDEN)==0)
draw_track_path(sc, clip, track);
track= track->next;
@@ -919,11 +933,11 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
/* markers outline and non-selected areas */
track= tracksbase->first;
fp= marker_pos;
- while(track) {
- if((track->flag&TRACK_HIDDEN)==0) {
+ while (track) {
+ if ((track->flag&TRACK_HIDDEN)==0) {
marker= BKE_tracking_get_marker(track, framenr);
- if(MARKER_VISIBLE(sc, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
copy_v2_v2(cur_pos, fp ? fp : marker->pos);
draw_marker_outline(sc, track, marker, cur_pos, width, height);
@@ -931,7 +945,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
draw_marker_slide_zones(sc, track, marker, cur_pos, 1, 0, 0, width, height);
draw_marker_slide_zones(sc, track, marker, cur_pos, 0, 0, 0, width, height);
- if(fp)
+ if (fp)
fp+= 2;
}
}
@@ -943,20 +957,20 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
* non-selected areas */
track= tracksbase->first;
fp= marker_pos;
- while(track) {
- if((track->flag&TRACK_HIDDEN)==0) {
+ while (track) {
+ if ((track->flag&TRACK_HIDDEN)==0) {
int act= track==act_track;
marker= BKE_tracking_get_marker(track, framenr);
- if(MARKER_VISIBLE(sc, marker)) {
- if(!act) {
+ if (MARKER_VISIBLE(sc, marker)) {
+ if (!act) {
copy_v2_v2(cur_pos, fp ? fp : marker->pos);
draw_marker_areas(sc, track, marker, cur_pos, width, height, 0, 1);
draw_marker_slide_zones(sc, track, marker, cur_pos, 0, 1, 0, width, height);
}
- if(fp)
+ if (fp)
fp+= 2;
}
}
@@ -965,11 +979,11 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
}
/* active marker would be displayed on top of everything else */
- if(act_track) {
- if((act_track->flag&TRACK_HIDDEN)==0) {
+ if (act_track) {
+ if ((act_track->flag&TRACK_HIDDEN)==0) {
marker= BKE_tracking_get_marker(act_track, framenr);
- if(MARKER_VISIBLE(sc, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
copy_v2_v2(cur_pos, active_pos ? active_pos : marker->pos);
draw_marker_areas(sc, act_track, marker, cur_pos, width, height, 1, 1);
@@ -978,7 +992,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
}
}
- if(sc->flag&SC_SHOW_BUNDLES) {
+ if (sc->flag&SC_SHOW_BUNDLES) {
MovieTrackingObject *object= BKE_tracking_active_object(tracking);
float pos[4], vec[4], mat[4][4], aspy;
@@ -989,11 +1003,11 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
BKE_tracking_projection_matrix(tracking, object, framenr, width, height, mat);
track= tracksbase->first;
- while(track) {
- if((track->flag&TRACK_HIDDEN)==0 && track->flag&TRACK_HAS_BUNDLE) {
+ while (track) {
+ if ((track->flag&TRACK_HIDDEN)==0 && track->flag&TRACK_HAS_BUNDLE) {
marker= BKE_tracking_get_marker(track, framenr);
- if(MARKER_VISIBLE(sc, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
float npos[2];
copy_v4_v4(vec, track->bundle_pos);
vec[3]=1;
@@ -1005,17 +1019,17 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
BKE_tracking_apply_intrinsics(tracking, pos, npos);
- if(npos[0]>=0.0f && npos[1]>=0.0f && npos[0]<=width && npos[1]<=height*aspy) {
+ if (npos[0]>=0.0f && npos[1]>=0.0f && npos[0]<=width && npos[1]<=height*aspy) {
vec[0]= (marker->pos[0]+track->offset[0])*width;
vec[1]= (marker->pos[1]+track->offset[1])*height*aspy;
sub_v2_v2(vec, npos);
- if(len_v2(vec)<3) glColor3f(0.0f, 1.0f, 0.0f);
+ if (len_v2(vec)<3) glColor3f(0.0f, 1.0f, 0.0f);
else glColor3f(1.0f, 0.0f, 0.0f);
glBegin(GL_POINTS);
- if(undistort) glVertex3f(pos[0]/width, pos[1]/(height*aspy), 0);
+ if (undistort) glVertex3f(pos[0]/width, pos[1]/(height*aspy), 0);
else glVertex3f(npos[0]/width, npos[1]/(height*aspy), 0);
glEnd();
}
@@ -1031,22 +1045,22 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
glPopMatrix();
- if(sc->flag&SC_SHOW_NAMES) {
+ if (sc->flag&SC_SHOW_NAMES) {
/* scaling should be cleared before drawing texts, otherwise font would also be scaled */
track= tracksbase->first;
fp= marker_pos;
- while(track) {
- if((track->flag&TRACK_HIDDEN)==0) {
+ while (track) {
+ if ((track->flag&TRACK_HIDDEN)==0) {
marker= BKE_tracking_get_marker(track, framenr);
- if(MARKER_VISIBLE(sc, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
int act= track==act_track;
copy_v2_v2(cur_pos, fp ? fp : marker->pos);
draw_marker_texts(sc, track, marker, cur_pos, act, width, height, zoomx, zoomy);
- if(fp) fp+= 2;
+ if (fp) fp+= 2;
}
}
@@ -1056,7 +1070,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
glPopMatrix();
- if(marker_pos)
+ if (marker_pos)
MEM_freeN(marker_pos);
}
@@ -1070,13 +1084,13 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
float aspy= 1.0f/tracking->camera.pixel_aspect;
float dx= (float)width/n, dy= (float)height/n*aspy;
- if(sc->mode!=SC_MODE_DISTORTION)
+ if (sc->mode!=SC_MODE_DISTORTION)
return;
- if(!tracking->camera.focal)
+ if (!tracking->camera.focal)
return;
- if((sc->flag&SC_SHOW_GRID)==0 && (sc->flag&SC_MANUAL_CALIBRATION)==0)
+ if ((sc->flag&SC_SHOW_GRID)==0 && (sc->flag&SC_MANUAL_CALIBRATION)==0)
return;
view2d_to_region_float(&ar->v2d, 0.0f, 0.0f, &x, &y);
@@ -1088,28 +1102,28 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
glScalef(width, height, 0);
/* grid */
- if(sc->flag&SC_SHOW_GRID) {
+ if (sc->flag&SC_SHOW_GRID) {
float val[4][2], idx[4][2];
float min[2], max[2];
- for(a=0; a<4; a++) {
- if(a<2) val[a][a%2]= FLT_MAX;
+ for (a=0; a<4; a++) {
+ if (a<2) val[a][a%2]= FLT_MAX;
else val[a][a%2]= -FLT_MAX;
}
zero_v2(pos);
- for(i= 0; i<=n; i++) {
- for(j= 0; j<=n; j++) {
- if(i==0 || j==0 || i==n || j==n) {
+ for (i= 0; i<=n; i++) {
+ for (j= 0; j<=n; j++) {
+ if (i==0 || j==0 || i==n || j==n) {
BKE_tracking_apply_intrinsics(tracking, pos, tpos);
- for(a=0; a<4; a++) {
+ for (a=0; a<4; a++) {
int ok;
- if(a<2) ok= tpos[a%2] < val[a][a%2];
+ if (a<2) ok= tpos[a%2] < val[a][a%2];
else ok= tpos[a%2] > val[a][a%2];
- if(ok) {
+ if (ok) {
copy_v2_v2(val[a], tpos);
idx[a][0]= j;
idx[a][1]= i;
@@ -1126,7 +1140,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
INIT_MINMAX2(min, max);
- for(a= 0; a<4; a++) {
+ for (a= 0; a<4; a++) {
pos[0]= idx[a][0]*dx;
pos[1]= idx[a][1]*dy;
@@ -1139,8 +1153,8 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
dx= (max[0]-min[0])/n;
dy= (max[1]-min[1])/n;
- for(i= 0; i<=n; i++) {
- for(j= 0; j<=n; j++) {
+ for (i= 0; i<=n; i++) {
+ for (j= 0; j<=n; j++) {
BKE_tracking_apply_intrinsics(tracking, pos, grid[i][j]);
grid[i][j][0]/= width;
@@ -1155,30 +1169,30 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
glColor3f(1.0f, 0.0f, 0.0f);
- for(i= 0; i<=n; i++) {
+ for (i= 0; i<=n; i++) {
glBegin(GL_LINE_STRIP);
- for(j= 0; j<=n; j++) {
+ for (j= 0; j<=n; j++) {
glVertex2fv(grid[i][j]);
}
glEnd();
}
- for(j= 0; j<=n; j++) {
+ for (j= 0; j<=n; j++) {
glBegin(GL_LINE_STRIP);
- for(i= 0; i<=n; i++) {
+ for (i= 0; i<=n; i++) {
glVertex2fv(grid[i][j]);
}
glEnd();
}
}
- if(sc->flag&SC_MANUAL_CALIBRATION && clip->gpd) {
+ if (sc->flag&SC_MANUAL_CALIBRATION && clip->gpd) {
bGPDlayer *layer= clip->gpd->layers.first;
- while(layer) {
+ while (layer) {
bGPDframe *frame= layer->frames.first;
- if(layer->flag & GP_LAYER_HIDE) {
+ if (layer->flag & GP_LAYER_HIDE) {
layer= layer->next;
continue;
}
@@ -1187,14 +1201,14 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
glLineWidth(layer->thickness);
glPointSize((float)(layer->thickness + 2));
- while(frame) {
+ while (frame) {
bGPDstroke *stroke= frame->strokes.first;
- while(stroke) {
- if(stroke->flag&GP_STROKE_2DSPACE) {
- if(stroke->totpoints>1) {
+ while (stroke) {
+ if (stroke->flag&GP_STROKE_2DSPACE) {
+ if (stroke->totpoints>1) {
glBegin(GL_LINE_STRIP);
- for(i= 0; i<stroke->totpoints-1; i++) {
+ for (i= 0; i<stroke->totpoints-1; i++) {
float npos[2], dpos[2], len;
int steps;
@@ -1208,7 +1222,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
steps= ceil(len/5.0f);
/* we want to distort only long straight lines */
- if(stroke->totpoints==2) {
+ if (stroke->totpoints==2) {
BKE_tracking_invert_intrinsics(tracking, pos, pos);
BKE_tracking_invert_intrinsics(tracking, npos, npos);
}
@@ -1216,7 +1230,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
sub_v2_v2v2(dpos, npos, pos);
mul_v2_fl(dpos, 1.0f/steps);
- for(j= 0; j<=steps; j++) {
+ for (j= 0; j<=steps; j++) {
BKE_tracking_apply_intrinsics(tracking, pos, tpos);
glVertex2f(tpos[0]/width, tpos[1]/(height*aspy));
@@ -1225,7 +1239,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
}
glEnd();
}
- else if(stroke->totpoints==1) {
+ else if (stroke->totpoints==1) {
glBegin(GL_POINTS);
glVertex2f(stroke->points[0].x, stroke->points[0].y);
glEnd();
@@ -1256,22 +1270,22 @@ void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
float zoomx, zoomy;
/* if no clip, nothing to do */
- if(!clip)
+ if (!clip)
return;
ED_space_clip_size(sc, &width, &height);
ED_space_clip_zoom(sc, ar, &zoomx, &zoomy);
- if(sc->flag&SC_SHOW_STABLE) {
+ if (sc->flag&SC_SHOW_STABLE) {
float smat[4][4], ismat[4][4];
ibuf= ED_space_clip_get_stable_buffer(sc, sc->loc, &sc->scale, &sc->angle);
- if(ibuf) {
+ if (ibuf) {
float loc[2];
float aspect= clip->tracking.camera.pixel_aspect;
- if(width != ibuf->x)
+ if (width != ibuf->x)
mul_v2_v2fl(loc, sc->loc, (float)width / ibuf->x);
else
copy_v2_v2(loc, sc->loc);
@@ -1285,7 +1299,8 @@ void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
mul_serie_m4(sc->unistabmat, smat, sc->stabmat, ismat, NULL, NULL, NULL, NULL, NULL);
}
- } else {
+ }
+ else {
ibuf= ED_space_clip_get_buffer(sc);
zero_v2(sc->loc);
@@ -1294,7 +1309,7 @@ void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
unit_m4(sc->unistabmat);
}
- if(ibuf) {
+ if (ibuf) {
draw_movieclip_buffer(sc, ar, ibuf, width, height, zoomx, zoomy);
IMB_freeImBuf(ibuf);
@@ -1313,16 +1328,16 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d)
MovieClip *clip= ED_space_clip(sc);
ImBuf *ibuf;
- if(!clip)
+ if (!clip)
return;
- if(onlyv2d) {
+ if (onlyv2d) {
/* if manual calibration is used then grease pencil data is already
* drawed in draw_distortion */
- if((sc->flag&SC_MANUAL_CALIBRATION)==0 || sc->mode!=SC_MODE_DISTORTION) {
+ if ((sc->flag&SC_MANUAL_CALIBRATION)==0 || sc->mode!=SC_MODE_DISTORTION) {
ibuf= ED_space_clip_get_buffer(sc);
- if(ibuf) {
+ if (ibuf) {
glPushMatrix();
glMultMatrixf(sc->unistabmat);
draw_gpencil_2dimage(C, ibuf);
@@ -1331,7 +1346,8 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d)
glPopMatrix();
}
}
- } else {
+ }
+ else {
draw_gpencil_view2d(C, 0);
}
}
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 35d870022a4..87b0ac1aac1 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -59,7 +59,7 @@ int ED_space_clip_poll(bContext *C)
{
SpaceClip *sc= CTX_wm_space_clip(C);
- if(sc && sc->clip)
+ if (sc && sc->clip)
return 1;
return 0;
@@ -69,10 +69,10 @@ void ED_space_clip_set(bContext *C, SpaceClip *sc, MovieClip *clip)
{
sc->clip= clip;
- if(sc->clip && sc->clip->id.us==0)
+ if (sc->clip && sc->clip->id.us==0)
sc->clip->id.us= 1;
- if(C)
+ if (C)
WM_event_add_notifier(C, NC_MOVIECLIP|NA_SELECTED, sc->clip);
}
@@ -83,15 +83,15 @@ MovieClip *ED_space_clip(SpaceClip *sc)
ImBuf *ED_space_clip_get_buffer(SpaceClip *sc)
{
- if(sc->clip) {
+ if (sc->clip) {
ImBuf *ibuf;
ibuf= BKE_movieclip_get_postprocessed_ibuf(sc->clip, &sc->user, sc->postproc_flag);
- if(ibuf && (ibuf->rect || ibuf->rect_float))
+ if (ibuf && (ibuf->rect || ibuf->rect_float))
return ibuf;
- if(ibuf)
+ if (ibuf)
IMB_freeImBuf(ibuf);
}
@@ -100,15 +100,15 @@ ImBuf *ED_space_clip_get_buffer(SpaceClip *sc)
ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale, float *angle)
{
- if(sc->clip) {
+ if (sc->clip) {
ImBuf *ibuf;
ibuf= BKE_movieclip_get_stable_ibuf(sc->clip, &sc->user, loc, scale, angle, sc->postproc_flag);
- if(ibuf && (ibuf->rect || ibuf->rect_float))
+ if (ibuf && (ibuf->rect || ibuf->rect_float))
return ibuf;
- if(ibuf)
+ if (ibuf)
IMB_freeImBuf(ibuf);
}
@@ -117,11 +117,12 @@ ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale
void ED_space_clip_size(SpaceClip *sc, int *width, int *height)
{
- if(!sc->clip) {
- *width= 0;
- *height= 0;
- } else
+ if (!sc->clip) {
+ *width = *height = 0;
+ }
+ else {
BKE_movieclip_get_size(sc->clip, &sc->user, width, height);
+ }
}
void ED_space_clip_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy)
@@ -138,7 +139,7 @@ void ED_space_clip_aspect(SpaceClip *sc, float *aspx, float *aspy)
{
MovieClip *clip= ED_space_clip(sc);
- if(clip)
+ if (clip)
BKE_movieclip_aspect(clip, aspx, aspy);
else
*aspx= *aspy= 1.0f;
@@ -150,11 +151,11 @@ void ED_clip_update_frame(const Main *mainp, int cfra)
wmWindow *win;
/* image window, compo node users */
- for(wm=mainp->wm.first; wm; wm= wm->id.next) { /* only 1 wm */
- for(win= wm->windows.first; win; win= win->next) {
+ for (wm=mainp->wm.first; wm; wm= wm->id.next) { /* only 1 wm */
+ for (win= wm->windows.first; win; win= win->next) {
ScrArea *sa;
- for(sa= win->screen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_CLIP) {
+ for (sa= win->screen->areabase.first; sa; sa= sa->next) {
+ if (sa->spacetype==SPACE_CLIP) {
SpaceClip *sc= sa->spacedata.first;
sc->scopes.ok= 0;
@@ -178,11 +179,11 @@ static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
ED_space_clip_size(sc, &width, &height);
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track)) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr);
- if(marker) {
+ if (marker) {
float pos[3];
pos[0]= marker->pos[0]+track->offset[0];
@@ -190,7 +191,7 @@ static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
pos[2]= 0.0f;
/* undistortion happens for normalized coords */
- if(sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT)
+ if (sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT)
/* undistortion happens for normalized coords */
ED_clip_point_undistorted_pos(sc, pos, pos);
@@ -218,9 +219,9 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
ED_space_clip_size(sc, &frame_width, &frame_height);
- if(frame_width==0 || frame_height==0) return 0;
+ if (frame_width==0 || frame_height==0) return 0;
- if(!selected_boundbox(sc, min, max))
+ if (!selected_boundbox(sc, min, max))
return 0;
/* center view */
@@ -230,7 +231,7 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
h= max[1]-min[1];
/* set zoom to see all selection */
- if(w>0 && h>0) {
+ if (w>0 && h>0) {
int width, height;
float zoomx, zoomy, newzoom, aspx, aspy;
@@ -244,7 +245,7 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
newzoom= 1.0f/power_of_2(1/MIN2(zoomx, zoomy));
- if(fit || sc->zoom>newzoom)
+ if (fit || sc->zoom>newzoom)
sc->zoom= newzoom;
}
@@ -255,7 +256,7 @@ void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2])
{
copy_v2_v2(nco, co);
- if(sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
+ if (sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
MovieClip *clip= ED_space_clip(sc);
float aspy= 1.0f/clip->tracking.camera.pixel_aspect;
int width, height;
@@ -292,7 +293,7 @@ void ED_clip_point_stable_pos(bContext *C, float x, float y, float *xr, float *y
*xr= pos[0]/width;
*yr= pos[1]/height;
- if(sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
+ if (sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
MovieClip *clip= ED_space_clip(sc);
MovieTracking *tracking= &clip->tracking;
float aspy= 1.0f/tracking->camera.pixel_aspect;
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index 1e21d0e5120..c1089d2bbcf 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -155,10 +155,11 @@ void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, int co
copy_v3_v3(col, colors[coord]);
- if(track==userdata) {
+ if (track==userdata) {
col[3]= 1.0f;
glLineWidth(2.0f);
- } else {
+ }
+ else {
col[3]= 0.5f;
glLineWidth(1.0f);
}
@@ -181,14 +182,14 @@ static void tracking_segment_knot_cb(void *userdata, MovieTrackingTrack *track,
struct { MovieTrackingTrack *act_track; int sel; float xscale, yscale, hsize; } *data = userdata;
int sel= 0, sel_flag;
- if(track!=data->act_track)
+ if (track!=data->act_track)
return;
sel_flag= coord == 0 ? MARKER_GRAPH_SEL_X : MARKER_GRAPH_SEL_Y;
sel= (marker->flag & sel_flag) ? 1 : 0;
- if(sel == data->sel) {
- if(sel) UI_ThemeColor(TH_HANDLE_VERTEX_SELECT);
+ if (sel == data->sel) {
+ if (sel) UI_ThemeColor(TH_HANDLE_VERTEX_SELECT);
else UI_ThemeColor(TH_HANDLE_VERTEX);
draw_curve_knot(marker->framenr, val, data->xscale, data->yscale, data->hsize);
@@ -205,7 +206,7 @@ static void draw_tracks_curves(View2D *v2d, SpaceClip *sc)
BKE_movieclip_get_size(clip, &sc->user, &width, &height);
- if(!width || !height)
+ if (!width || !height)
return;
/* non-selected knot handles */
@@ -234,15 +235,15 @@ static void draw_frame_curves(SpaceClip *sc)
glColor3f(0.0f, 0.0f, 1.0f);
- for(i= 0; i<reconstruction->camnr; i++) {
+ for (i= 0; i<reconstruction->camnr; i++) {
MovieReconstructedCamera *camera= &reconstruction->cameras[i];
- if(lines && camera->framenr!=prevfra+1) {
+ if (lines && camera->framenr!=prevfra+1) {
glEnd();
lines= 0;
}
- if(!lines) {
+ if (!lines) {
glBegin(GL_LINE_STRIP);
lines= 1;
}
@@ -252,7 +253,7 @@ static void draw_frame_curves(SpaceClip *sc)
prevfra= camera->framenr;
}
- if(lines)
+ if (lines)
glEnd();
}
@@ -268,11 +269,11 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL);
UI_view2d_grid_free(grid);
- if(clip) {
- if(sc->flag&SC_SHOW_GRAPH_TRACKS)
+ if (clip) {
+ if (sc->flag&SC_SHOW_GRAPH_TRACKS)
draw_tracks_curves(v2d, sc);
- if(sc->flag&SC_SHOW_GRAPH_FRAMES)
+ if (sc->flag&SC_SHOW_GRAPH_FRAMES)
draw_frame_curves(sc);
}
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index aecce3b1ba1..4a1f2c56ee0 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -65,7 +65,7 @@ static int ED_space_clip_graph_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- if(sc && sc->clip) {
+ if (sc && sc->clip) {
ARegion *ar = CTX_wm_region(C);
return ar->regiontype == RGN_TYPE_PREVIEW;
@@ -116,10 +116,10 @@ static void find_nearest_tracking_segment_cb(void *userdata, MovieTrackingTrack
MouseSelectUserData *data= userdata;
float co[2]= {marker->framenr, val};
- if(data->has_prev) {
+ if (data->has_prev) {
float d= dist_to_line_segment_v2(data->mouse_co, data->prev_co, co);
- if(data->track==NULL || d<data->min_dist) {
+ if (data->track==NULL || d<data->min_dist) {
data->track= track;
data->min_dist= d;
data->coord= coord;
@@ -145,7 +145,7 @@ static void find_nearest_tracking_knot_cb(void *userdata, MovieTrackingTrack *tr
float dx= marker->framenr-data->mouse_co[0], dy= val-data->mouse_co[1];
float d= dx*dx+dy*dy;
- if(data->marker==NULL || d<data->min_dist) {
+ if (data->marker==NULL || d<data->min_dist) {
float co[2]= {marker->framenr, val};
data->track= track;
@@ -174,26 +174,26 @@ static int mouse_select_knot(bContext *C, float co[2], int extend)
MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
static const int delta= 6;
- if(act_track) {
+ if (act_track) {
MouseSelectUserData userdata;
mouse_select_init_data(&userdata, co);
clip_graph_tracking_values_iterate_track(sc, act_track,
&userdata, find_nearest_tracking_knot_cb, NULL, NULL);
- if(userdata.marker) {
+ if (userdata.marker) {
int x1, y1, x2, y2;
UI_view2d_view_to_region(v2d, co[0], co[1], &x1, &y1);
UI_view2d_view_to_region(v2d, userdata.min_co[0], userdata.min_co[1], &x2, &y2);
- if(abs(x2-x1)<=delta && abs(y2-y1)<=delta) {
- if(!extend) {
+ if (abs(x2-x1)<=delta && abs(y2-y1)<=delta) {
+ if (!extend) {
SelectUserData selectdata = {SEL_DESELECT};
clip_graph_tracking_iterate(sc, &selectdata, toggle_selection_cb);
}
- if(userdata.coord==0)
+ if (userdata.coord==0)
userdata.marker->flag|= MARKER_GRAPH_SEL_X;
else
userdata.marker->flag|= MARKER_GRAPH_SEL_Y;
@@ -217,14 +217,14 @@ static int mouse_select_curve(bContext *C, float co[2], int extend)
mouse_select_init_data(&userdata, co);
clip_graph_tracking_values_iterate(sc, &userdata, find_nearest_tracking_segment_cb, NULL, find_nearest_tracking_segment_end_cb);
- if(userdata.track) {
- if(extend) {
- if(act_track==userdata.track) {
+ if (userdata.track) {
+ if (extend) {
+ if (act_track==userdata.track) {
/* currently only single curve can be selected (selected curve represents active track) */
act_track= NULL;
}
}
- else if(act_track!=userdata.track) {
+ else if (act_track!=userdata.track) {
MovieTrackingMarker *marker;
SelectUserData selectdata = {SEL_DESELECT};
@@ -252,12 +252,12 @@ static int mouse_select(bContext *C, float co[2], int extend)
/* first try to select knot on selected curves */
sel= mouse_select_knot(C, co, extend);
- if(!sel) {
+ if (!sel) {
/* if there's no close enough knot to mouse osition, select nearest curve */
sel= mouse_select_curve(C, co, extend);
}
- if(sel)
+ if (sel)
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
return OPERATOR_FINISHED;
@@ -287,17 +287,17 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
void CLIP_OT_graph_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select";
- ot->description= "Select graph curves";
- ot->idname= "CLIP_OT_graph_select";
+ ot->name = "Select";
+ ot->description = "Select graph curves";
+ ot->idname = "CLIP_OT_graph_select";
/* api callbacks */
- ot->exec= select_exec;
- ot->invoke= select_invoke;
- ot->poll= ED_space_clip_graph_poll;
+ ot->exec = select_exec;
+ ot->invoke = select_invoke;
+ ot->poll = ED_space_clip_graph_poll;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
@@ -444,7 +444,7 @@ static int graph_select_all_markers_exec(bContext *C, wmOperator *op)
void CLIP_OT_graph_select_all_markers(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Select or Deselect All Markers";
+ ot->name = "(De)select All Markers";
ot->description = "Change selection of all markers of active track";
ot->idname = "CLIP_OT_graph_select_all_markers";
@@ -453,7 +453,7 @@ void CLIP_OT_graph_select_all_markers(wmOperatorType *ot)
ot->poll = ED_space_clip_graph_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -468,7 +468,7 @@ static int delete_curve_exec(bContext *C, wmOperator *UNUSED(op))
ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
- if(act_track)
+ if (act_track)
clip_delete_track(C, clip, tracksbase, act_track);
return OPERATOR_FINISHED;
@@ -477,17 +477,17 @@ static int delete_curve_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_graph_delete_curve(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Curve";
- ot->description= "Delete selected curves";
- ot->idname= "CLIP_OT_graph_delete_curve";
+ ot->name = "Delete Curve";
+ ot->description = "Delete selected curves";
+ ot->idname = "CLIP_OT_graph_delete_curve";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= delete_curve_exec;
- ot->poll= ED_space_clip_poll;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = delete_curve_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/******************** delete knot operator ********************/
@@ -500,13 +500,13 @@ static int delete_knot_exec(bContext *C, wmOperator *UNUSED(op))
ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
- if(act_track) {
+ if (act_track) {
int a= 0;
- while(a<act_track->markersnr) {
+ while (a<act_track->markersnr) {
MovieTrackingMarker *marker= &act_track->markers[a];
- if(marker->flag & MARKER_GRAPH_SEL)
+ if (marker->flag & MARKER_GRAPH_SEL)
clip_delete_marker(C, clip, tracksbase, act_track, marker);
else
a++;
@@ -519,16 +519,16 @@ static int delete_knot_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_graph_delete_knot(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Knot";
- ot->description= "Delete curve knots";
- ot->idname= "CLIP_OT_graph_delete_knot";
+ ot->name = "Delete Knot";
+ ot->description = "Delete curve knots";
+ ot->idname = "CLIP_OT_graph_delete_knot";
/* api callbacks */
- ot->exec= delete_knot_exec;
- ot->poll= ED_space_clip_graph_poll;
+ ot->exec = delete_knot_exec;
+ ot->poll = ED_space_clip_graph_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/******************** view all operator ********************/
@@ -542,8 +542,8 @@ static void view_all_cb(void *userdata, MovieTrackingTrack *UNUSED(track), Movie
{
ViewAllUserData *data = (ViewAllUserData *)userdata;
- if(val < data->min) data->min = val;
- if(val > data->max) data->max = val;
+ if (val < data->min) data->min = val;
+ if (val > data->max) data->max = val;
}
static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
@@ -656,7 +656,7 @@ static int graph_disable_markers_exec(bContext *C, wmOperator *op)
if (marker->flag & MARKER_GRAPH_SEL) {
if (action==0)
marker->flag |= MARKER_DISABLED;
- else if(action==1)
+ else if (action==1)
marker->flag &= ~MARKER_DISABLED;
else
marker->flag ^= MARKER_DISABLED;
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 552c62936b6..ff8feb69bd9 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -82,15 +82,15 @@ static void sclip_zoom_set(SpaceClip *sc, ARegion *ar, float zoom, float locatio
width*= sc->zoom;
height*= sc->zoom;
- if((width < 4) && (height < 4))
+ if ((width < 4) && (height < 4))
sc->zoom= oldzoom;
- else if((ar->winrct.xmax - ar->winrct.xmin) <= sc->zoom)
+ else if ((ar->winrct.xmax - ar->winrct.xmin) <= sc->zoom)
sc->zoom= oldzoom;
- else if((ar->winrct.ymax - ar->winrct.ymin) <= sc->zoom)
+ else if ((ar->winrct.ymax - ar->winrct.ymin) <= sc->zoom)
sc->zoom= oldzoom;
}
- if((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
+ if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
ED_space_clip_size(sc, &width, &height);
sc->xof+= ((location[0]-0.5f)*width-sc->xof)*(sc->zoom-oldzoom)/sc->zoom;
@@ -158,8 +158,8 @@ static int open_exec(bContext *C, wmOperator *op)
clip= BKE_add_movieclip_file(str);
- if(!clip) {
- if(op->customdata)
+ if (!clip) {
+ if (op->customdata)
MEM_freeN(op->customdata);
BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", str, errno ? strerror(errno) : "Unsupported movie clip format");
@@ -167,13 +167,13 @@ static int open_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if(!op->customdata)
+ if (!op->customdata)
open_init(C, op);
/* hook into UI */
pprop= op->customdata;
- if(pprop->prop) {
+ if (pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
clip->id.us--;
@@ -182,7 +182,7 @@ static int open_exec(bContext *C, wmOperator *op)
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
RNA_property_update(C, &pprop->ptr, pprop->prop);
}
- else if(sc) {
+ else if (sc) {
ED_space_clip_set(C, sc, clip);
}
@@ -199,16 +199,16 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
char *path= U.textudir;
MovieClip *clip= NULL;
- if(sc)
+ if (sc)
clip= ED_space_clip(sc);
- if(clip)
+ if (clip)
path= clip->name;
- if(!RNA_struct_property_is_set(op->ptr, "relative_path"))
+ if (!RNA_struct_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return open_exec(C, op);
open_init(C, op);
@@ -221,17 +221,17 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
void CLIP_OT_open(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Open Clip";
- ot->description= "Load a sequence of frames or a movie file";
- ot->idname= "CLIP_OT_open";
+ ot->name = "Open Clip";
+ ot->description = "Load a sequence of frames or a movie file";
+ ot->idname = "CLIP_OT_open";
/* api callbacks */
- ot->exec= open_exec;
- ot->invoke= open_invoke;
- ot->cancel= open_cancel;
+ ot->exec = open_exec;
+ ot->invoke = open_invoke;
+ ot->cancel = open_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -243,7 +243,7 @@ static int reload_exec(bContext *C, wmOperator *UNUSED(op))
{
MovieClip *clip= CTX_data_edit_movieclip(C);
- if(!clip)
+ if (!clip)
return OPERATOR_CANCELLED;
BKE_movieclip_reload(clip);
@@ -256,12 +256,12 @@ static int reload_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_reload(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reload Clip";
- ot->description= "Reload clip";
- ot->idname= "CLIP_OT_reload";
+ ot->name = "Reload Clip";
+ ot->description = "Reload clip";
+ ot->idname = "CLIP_OT_reload";
/* api callbacks */
- ot->exec= reload_exec;
+ ot->exec = reload_exec;
}
/********************** view pan operator *********************/
@@ -284,7 +284,7 @@ static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event)
vpd->x= event->x;
vpd->y= event->y;
- if(sc->flag&SC_LOCK_SELECTION) vpd->vec= &sc->xlockof;
+ if (sc->flag&SC_LOCK_SELECTION) vpd->vec= &sc->xlockof;
else vpd->vec= &sc->xof;
copy_v2_v2(&vpd->xof, vpd->vec);
@@ -299,7 +299,7 @@ static void view_pan_exit(bContext *C, wmOperator *op, int cancel)
{
ViewPanData *vpd= op->customdata;
- if(cancel) {
+ if (cancel) {
copy_v2_v2(vpd->vec, &vpd->xorig);
ED_region_tag_redraw(CTX_wm_region(C));
@@ -316,10 +316,11 @@ static int view_pan_exec(bContext *C, wmOperator *op)
RNA_float_get_array(op->ptr, "offset", offset);
- if(sc->flag&SC_LOCK_SELECTION) {
+ if (sc->flag&SC_LOCK_SELECTION) {
sc->xlockof+= offset[0];
sc->ylockof+= offset[1];
- } else {
+ }
+ else {
sc->xof+= offset[0];
sc->yof+= offset[1];
}
@@ -370,7 +371,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
view_pan_exit(C, op, 0);
return OPERATOR_FINISHED;
default:
- if(event->type==vpd->event_type && event->val==KM_RELEASE) {
+ if (event->type==vpd->event_type && event->val==KM_RELEASE) {
view_pan_exit(C, op, 0);
return OPERATOR_FINISHED;
}
@@ -390,18 +391,18 @@ static int view_pan_cancel(bContext *C, wmOperator *op)
void CLIP_OT_view_pan(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Pan";
- ot->idname= "CLIP_OT_view_pan";
+ ot->name = "View Pan";
+ ot->idname = "CLIP_OT_view_pan";
/* api callbacks */
- ot->exec= view_pan_exec;
- ot->invoke= view_pan_invoke;
- ot->modal= view_pan_modal;
- ot->cancel= view_pan_cancel;
- ot->poll= ED_space_clip_poll;
+ ot->exec = view_pan_exec;
+ ot->invoke = view_pan_invoke;
+ ot->modal = view_pan_modal;
+ ot->cancel = view_pan_cancel;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
/* properties */
RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX,
@@ -440,7 +441,7 @@ static void view_zoom_exit(bContext *C, wmOperator *op, int cancel)
SpaceClip *sc= CTX_wm_space_clip(C);
ViewZoomData *vpd= op->customdata;
- if(cancel) {
+ if (cancel) {
sc->zoom= vpd->zoom;
ED_region_tag_redraw(CTX_wm_region(C));
}
@@ -495,7 +496,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
ED_region_tag_redraw(CTX_wm_region(C));
break;
default:
- if(event->type==vpd->event_type && event->val==KM_RELEASE) {
+ if (event->type==vpd->event_type && event->val==KM_RELEASE) {
view_zoom_exit(C, op, 0);
return OPERATOR_FINISHED;
}
@@ -514,18 +515,18 @@ static int view_zoom_cancel(bContext *C, wmOperator *op)
void CLIP_OT_view_zoom(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Zoom";
- ot->idname= "CLIP_OT_view_zoom";
+ ot->name = "View Zoom";
+ ot->idname = "CLIP_OT_view_zoom";
/* api callbacks */
- ot->exec= view_zoom_exec;
- ot->invoke= view_zoom_invoke;
- ot->modal= view_zoom_modal;
- ot->cancel= view_zoom_cancel;
- ot->poll= ED_space_clip_poll;
+ ot->exec = view_zoom_exec;
+ ot->invoke = view_zoom_invoke;
+ ot->modal = view_zoom_modal;
+ ot->cancel = view_zoom_cancel;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
/* properties */
RNA_def_float(ot->srna, "factor", 0.0f, 0.0f, FLT_MAX,
@@ -562,13 +563,13 @@ static int view_zoom_in_invoke(bContext *C, wmOperator *op, wmEvent *event)
void CLIP_OT_view_zoom_in(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Zoom In";
- ot->idname= "CLIP_OT_view_zoom_in";
+ ot->name = "View Zoom In";
+ ot->idname = "CLIP_OT_view_zoom_in";
/* api callbacks */
- ot->exec= view_zoom_in_exec;
- ot->invoke= view_zoom_in_invoke;
- ot->poll= ED_space_clip_poll;
+ ot->exec = view_zoom_in_exec;
+ ot->invoke = view_zoom_in_invoke;
+ ot->poll = ED_space_clip_poll;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
@@ -602,13 +603,13 @@ static int view_zoom_out_invoke(bContext *C, wmOperator *op, wmEvent *event)
void CLIP_OT_view_zoom_out(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Zoom Out";
- ot->idname= "CLIP_OT_view_zoom_out";
+ ot->name = "View Zoom Out";
+ ot->idname = "CLIP_OT_view_zoom_out";
/* api callbacks */
- ot->exec= view_zoom_out_exec;
- ot->invoke= view_zoom_out_invoke;
- ot->poll= ED_space_clip_poll;
+ ot->exec = view_zoom_out_exec;
+ ot->invoke = view_zoom_out_invoke;
+ ot->poll = ED_space_clip_poll;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f);
@@ -635,12 +636,12 @@ static int view_zoom_ratio_exec(bContext *C, wmOperator *op)
void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Zoom Ratio";
- ot->idname= "CLIP_OT_view_zoom_ratio";
+ ot->name = "View Zoom Ratio";
+ ot->idname = "CLIP_OT_view_zoom_ratio";
/* api callbacks */
- ot->exec= view_zoom_ratio_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = view_zoom_ratio_exec;
+ ot->poll = ED_space_clip_poll;
/* properties */
RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX,
@@ -672,7 +673,7 @@ static int view_all_exec(bContext *C, wmOperator *op)
width= ar->winrct.xmax - ar->winrct.xmin + 1;
height= ar->winrct.ymax - ar->winrct.ymin + 1;
- if(fit_view) {
+ if (fit_view) {
const int margin = 5; /* margin from border */
zoomx= (float)width / (w + 2*margin);
@@ -681,7 +682,7 @@ static int view_all_exec(bContext *C, wmOperator *op)
sclip_zoom_set(sc, ar, MIN2(zoomx, zoomy), NULL);
}
else {
- if((w >= width || h >= height) && (width > 0 && height > 0)) {
+ if ((w >= width || h >= height) && (width > 0 && height > 0)) {
zoomx= (float)width/w;
zoomy= (float)height/h;
@@ -702,12 +703,12 @@ static int view_all_exec(bContext *C, wmOperator *op)
void CLIP_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View All";
- ot->idname= "CLIP_OT_view_all";
+ ot->name = "View All";
+ ot->idname = "CLIP_OT_view_all";
/* api callbacks */
- ot->exec= view_all_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = view_all_exec;
+ ot->poll = ED_space_clip_poll;
/* properties */
RNA_def_boolean(ot->srna, "fit_view", 0, "Fit View", "Fit frame to the viewport");
@@ -732,12 +733,12 @@ static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_view_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Selected";
- ot->idname= "CLIP_OT_view_selected";
+ ot->name = "View Selected";
+ ot->idname = "CLIP_OT_view_selected";
/* api callbacks */
- ot->exec= view_selected_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = view_selected_exec;
+ ot->poll = ED_space_clip_poll;
}
/********************** change frame operator *********************/
@@ -745,7 +746,7 @@ void CLIP_OT_view_selected(wmOperatorType *ot)
static int change_frame_poll(bContext *C)
{
/* prevent changes during render */
- if(G.rendering)
+ if (G.rendering)
return 0;
return ED_space_clip_poll(C);
@@ -778,11 +779,12 @@ static int frame_from_event(bContext *C, wmEvent *event)
Scene *scene= CTX_data_scene(C);
int framenr= 0;
- if(ar->regiontype == RGN_TYPE_WINDOW) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
float sfra= SFRA, efra= EFRA, framelen= ar->winx/(efra-sfra+1);
framenr= sfra+event->mval[0]/framelen;
- } else {
+ }
+ else {
float viewx, viewy;
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
@@ -797,8 +799,8 @@ static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
- if(ar->regiontype == RGN_TYPE_WINDOW) {
- if(event->mval[1]>16)
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (event->mval[1]>16)
return OPERATOR_PASS_THROUGH;
}
@@ -836,18 +838,18 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
void CLIP_OT_change_frame(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change frame";
- ot->idname= "CLIP_OT_change_frame";
- ot->description= "Interactively change the current frame number";
+ ot->name = "Change frame";
+ ot->idname = "CLIP_OT_change_frame";
+ ot->description = "Interactively change the current frame number";
/* api callbacks */
- ot->exec= change_frame_exec;
- ot->invoke= change_frame_invoke;
- ot->modal= change_frame_modal;
- ot->poll= change_frame_poll;
+ ot->exec = change_frame_exec;
+ ot->invoke = change_frame_invoke;
+ ot->modal = change_frame_modal;
+ ot->poll = change_frame_poll;
/* flags */
- ot->flag= OPTYPE_BLOCKING|OPTYPE_UNDO;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_UNDO;
/* rna */
RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
@@ -875,18 +877,18 @@ static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undisto
int build_count = 0;
int size_flags[2][4] = {{MCLIP_PROXY_SIZE_25,
MCLIP_PROXY_SIZE_50,
- MCLIP_PROXY_SIZE_75,
- MCLIP_PROXY_SIZE_100},
- {MCLIP_PROXY_UNDISTORTED_SIZE_25,
- MCLIP_PROXY_UNDISTORTED_SIZE_50,
- MCLIP_PROXY_UNDISTORTED_SIZE_75,
- MCLIP_PROXY_UNDISTORTED_SIZE_100}};
+ MCLIP_PROXY_SIZE_75,
+ MCLIP_PROXY_SIZE_100},
+ {MCLIP_PROXY_UNDISTORTED_SIZE_25,
+ MCLIP_PROXY_UNDISTORTED_SIZE_50,
+ MCLIP_PROXY_UNDISTORTED_SIZE_75,
+ MCLIP_PROXY_UNDISTORTED_SIZE_100}};
int size_nr = undistort ? 1 : 0;
- if(size_flag & size_flags[size_nr][0]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_25;
- if(size_flag & size_flags[size_nr][1]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_50;
- if(size_flag & size_flags[size_nr][2]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_75;
- if(size_flag & size_flags[size_nr][3]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_100;
+ if (size_flag & size_flags[size_nr][0]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_25;
+ if (size_flag & size_flags[size_nr][1]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_50;
+ if (size_flag & size_flags[size_nr][2]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_75;
+ if (size_flag & size_flags[size_nr][3]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_100;
return build_count;
}
@@ -908,11 +910,11 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
build_count= proxy_bitflag_to_array(size_flag, build_sizes, 0);
build_undistort_count= proxy_bitflag_to_array(size_flag, build_undistort_sizes, 1);
- if(clip->source == MCLIP_SRC_MOVIE) {
+ if (clip->source == MCLIP_SRC_MOVIE) {
if (pj->index_context)
IMB_anim_index_rebuild(pj->index_context, stop, do_update, progress);
- if(!build_undistort_count) {
+ if (!build_undistort_count) {
if (*stop)
pj->stop = 1;
@@ -924,23 +926,23 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
}
}
- if(build_undistort_count)
+ if (build_undistort_count)
distortion= BKE_tracking_distortion_create();
- for(cfra= sfra; cfra<=efra; cfra++) {
- if(clip->source != MCLIP_SRC_MOVIE)
+ for (cfra= sfra; cfra<=efra; cfra++) {
+ if (clip->source != MCLIP_SRC_MOVIE)
BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, NULL, cfra, build_sizes, build_count, 0);
BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, 1);
- if(*stop || G.afbreek)
+ if (*stop || G.afbreek)
break;
*do_update= 1;
*progress= ((float)cfra)/(efra-sfra);
}
- if(distortion)
+ if (distortion)
BKE_tracking_distortion_destroy(distortion);
if (*stop)
@@ -971,7 +973,7 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
SpaceClip *sc= CTX_wm_space_clip(C);
MovieClip *clip= ED_space_clip(sc);
- if((clip->flag&MCLIP_USE_PROXY)==0)
+ if ((clip->flag&MCLIP_USE_PROXY)==0)
return OPERATOR_CANCELLED;
steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
@@ -1002,16 +1004,16 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_rebuild_proxy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Rebuild Proxy and Timecode Indices";
- ot->idname= "CLIP_OT_rebuild_proxy";
- ot->description= "Rebuild all selected proxies and timecode indices in the background";
+ ot->name = "Rebuild Proxy and Timecode Indices";
+ ot->idname = "CLIP_OT_rebuild_proxy";
+ ot->description = "Rebuild all selected proxies and timecode indices in the background";
/* api callbacks */
- ot->exec= clip_rebuild_proxy_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = clip_rebuild_proxy_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
/********************** mode set operator *********************/
@@ -1022,10 +1024,11 @@ static int mode_set_exec(bContext *C, wmOperator *op)
int mode= RNA_enum_get(op->ptr, "mode");
int toggle= RNA_boolean_get(op->ptr, "toggle");
- if(sc->mode==mode) {
- if(toggle)
+ if (sc->mode==mode) {
+ if (toggle)
sc->mode= SC_MODE_TRACKING;
- } else {
+ }
+ else {
sc->mode= mode;
}
@@ -1044,14 +1047,14 @@ void CLIP_OT_mode_set(wmOperatorType *ot)
/* identifiers */
- ot->name= "Set Clip Mode";
+ ot->name = "Set Clip Mode";
ot->description = "Set the clip interaction mode";
- ot->idname= "CLIP_OT_mode_set";
+ ot->idname = "CLIP_OT_mode_set";
/* api callbacks */
- ot->exec= mode_set_exec;
+ ot->exec = mode_set_exec;
- ot->poll= ED_space_clip_poll;
+ ot->poll = ED_space_clip_poll;
/* properties */
RNA_def_enum(ot->srna, "mode", mode_items, SC_MODE_TRACKING, "Mode", "");
@@ -1065,15 +1068,15 @@ void ED_operatormacros_clip(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot= WM_operatortype_append_macro("CLIP_OT_add_marker_move", "Add Marker and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("CLIP_OT_add_marker_move", "Add Marker and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Add new marker and move it on movie";
WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_struct_idprops_unset(otmacro->ptr, "release_confirm");
- ot= WM_operatortype_append_macro("CLIP_OT_add_marker_slide", "Add Marker and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("CLIP_OT_add_marker_slide", "Add Marker and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Add new marker and slide it with mouse until mouse button release";
WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_boolean_set(otmacro->ptr, "release_confirm", TRUE);
}
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index d90f429a206..b42b4137ea0 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -61,14 +61,14 @@ static ARegion *clip_has_properties_region(ScrArea *sa)
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if(ar)
+ if (ar)
return ar;
/* add subdiv level; after header */
ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if(ar==NULL)
+ if (ar==NULL)
return NULL;
arnew= MEM_callocN(sizeof(ARegion), "clip properties region");
@@ -92,7 +92,7 @@ static int properties_exec(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= clip_has_properties_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -101,13 +101,13 @@ static int properties_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_properties(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Properties";
- ot->description= "Toggle clip properties panel";
- ot->idname= "CLIP_OT_properties";
+ ot->name = "Properties";
+ ot->description = "Toggle clip properties panel";
+ ot->idname = "CLIP_OT_properties";
/* api callbacks */
- ot->exec= properties_exec;
- ot->poll= properties_poll;
+ ot->exec = properties_exec;
+ ot->poll = properties_poll;
}
/************************** tools ******************************/
@@ -116,23 +116,23 @@ static ARegion *clip_has_tools_region(ScrArea *sa)
{
ARegion *ar, *artool=NULL, *arprops=NULL, *arhead;
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype==RGN_TYPE_TOOLS)
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype==RGN_TYPE_TOOLS)
artool= ar;
- if(ar->regiontype==RGN_TYPE_TOOL_PROPS)
+ if (ar->regiontype==RGN_TYPE_TOOL_PROPS)
arprops= ar;
}
/* tool region hide/unhide also hides props */
- if(arprops && artool)
+ if (arprops && artool)
return artool;
- if(artool==NULL) {
+ if (artool==NULL) {
/* add subdiv level; after header */
arhead= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if(arhead==NULL)
+ if (arhead==NULL)
return NULL;
artool= MEM_callocN(sizeof(ARegion), "clip tools region");
@@ -144,7 +144,7 @@ static ARegion *clip_has_tools_region(ScrArea *sa)
artool->flag= RGN_FLAG_HIDDEN;
}
- if(arprops==NULL) {
+ if (arprops==NULL) {
/* add extra subdivided region for tool properties */
arprops= MEM_callocN(sizeof(ARegion), "tool props for clip");
@@ -166,7 +166,7 @@ static int tools_exec(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= clip_has_tools_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -175,13 +175,13 @@ static int tools_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_tools(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Tools";
- ot->description= "Toggle clip tools panel";
- ot->idname= "CLIP_OT_tools";
+ ot->name = "Tools";
+ ot->description = "Toggle clip tools panel";
+ ot->idname = "CLIP_OT_tools";
/* api callbacks */
- ot->exec= tools_exec;
- ot->poll= tools_poll;
+ ot->exec = tools_exec;
+ ot->poll = tools_poll;
}
/************************** redo panel ******************************/
@@ -195,14 +195,14 @@ static void clip_panel_operator_redo_header(const bContext *C, Panel *pa)
{
wmOperator *op= WM_operator_last_redo(C);
- if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
+ if (op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
else BLI_strncpy(pa->drawname, "Operator", sizeof(pa->drawname));
}
static void clip_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op)
{
- if(op->type->flag & OPTYPE_MACRO) {
- for(op= op->macro.first; op; op= op->next) {
+ if (op->type->flag & OPTYPE_MACRO) {
+ for (op= op->macro.first; op; op= op->next) {
uiItemL(pa->layout, op->type->name, ICON_NONE);
clip_panel_operator_redo_operator(C, pa, op);
}
@@ -218,9 +218,9 @@ static void clip_panel_operator_redo(const bContext *C, Panel *pa)
wmOperator *op= WM_operator_last_redo(C);
uiBlock *block;
- if(op==NULL)
+ if (op==NULL)
return;
- if(WM_operator_poll((bContext*)C, op->type) == 0)
+ if (WM_operator_poll((bContext*)C, op->type) == 0)
return;
block= uiLayoutGetBlock(pa->layout);
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 46442d39a7b..c637bffe3ad 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -67,17 +67,17 @@ void clip_graph_tracking_values_iterate_track(SpaceClip *sc, MovieTrackingTrack
BKE_movieclip_get_size(clip, &sc->user, &width, &height);
- for(coord= 0; coord<2; coord++) {
+ for (coord= 0; coord<2; coord++) {
int i, open= 0, prevfra= 0;
float prevval= 0.0f;
- for(i= 0; i<track->markersnr; i++) {
+ for (i= 0; i<track->markersnr; i++) {
MovieTrackingMarker *marker= &track->markers[i];
float val;
- if(marker->flag&MARKER_DISABLED) {
- if(open) {
- if(segment_end)
+ if (marker->flag&MARKER_DISABLED) {
+ if (open) {
+ if (segment_end)
segment_end(userdata);
open= 0;
@@ -86,8 +86,8 @@ void clip_graph_tracking_values_iterate_track(SpaceClip *sc, MovieTrackingTrack
continue;
}
- if(!open) {
- if(segment_start)
+ if (!open) {
+ if (segment_start)
segment_start(userdata, track, coord);
open= 1;
@@ -98,15 +98,15 @@ void clip_graph_tracking_values_iterate_track(SpaceClip *sc, MovieTrackingTrack
val= (marker->pos[coord] - prevval) * ((coord==0) ? (width) : (height));
val/= marker->framenr-prevfra;
- if(func)
+ if (func)
func(userdata, track, marker, coord, val);
prevval= marker->pos[coord];
prevfra= marker->framenr;
}
- if(open) {
- if(segment_end)
+ if (open) {
+ if (segment_end)
segment_end(userdata);
}
}
@@ -123,8 +123,8 @@ void clip_graph_tracking_values_iterate(SpaceClip *sc, void *userdata,
MovieTrackingTrack *track;
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track)) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
clip_graph_tracking_values_iterate_track(sc, track, userdata, func, segment_start, segment_end);
}
@@ -141,17 +141,17 @@ void clip_graph_tracking_iterate(SpaceClip *sc, void *userdata,
MovieTrackingTrack *track;
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track)) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
int i;
- for(i= 0; i<track->markersnr; i++) {
+ for (i= 0; i<track->markersnr; i++) {
MovieTrackingMarker *marker= &track->markers[i];
- if(marker->flag&MARKER_DISABLED)
+ if (marker->flag&MARKER_DISABLED)
continue;
- if(func)
+ if (func)
func(userdata, marker);
}
}
@@ -168,17 +168,17 @@ void clip_delete_track(bContext *C, MovieClip *clip, ListBase *tracksbase, Movie
int has_bundle= 0, update_stab= 0;
- if(track==act_track)
+ if (track==act_track)
tracking->act_track= NULL;
- if(track==stab->rot_track) {
+ if (track==stab->rot_track) {
stab->rot_track= NULL;
update_stab= 1;
}
/* handle reconstruction display in 3d viewport */
- if(track->flag&TRACK_HAS_BUNDLE)
+ if (track->flag&TRACK_HAS_BUNDLE)
has_bundle= 1;
BKE_tracking_free_track(track);
@@ -186,20 +186,20 @@ void clip_delete_track(bContext *C, MovieClip *clip, ListBase *tracksbase, Movie
WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
- if(update_stab) {
+ if (update_stab) {
tracking->stabilization.ok= 0;
DAG_id_tag_update(&clip->id, 0);
WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
}
- if(has_bundle)
+ if (has_bundle)
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
}
void clip_delete_marker(bContext *C, MovieClip *clip, ListBase *tracksbase, MovieTrackingTrack *track, MovieTrackingMarker *marker)
{
- if(track->markersnr==1) {
+ if (track->markersnr==1) {
clip_delete_track(C, clip, tracksbase, track);
}
else {
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index a92830e1992..ca66248682c 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -77,10 +77,10 @@ static void init_preview_region(const bContext *C, ARegion *ar)
ar->alignment= RGN_ALIGN_TOP;
ar->flag|= RGN_FLAG_HIDDEN;
- ar->v2d.tot.xmin= 0.0f;
- ar->v2d.tot.ymin= -10.0f;
- ar->v2d.tot.xmax= (float)scene->r.efra;
- ar->v2d.tot.ymax= 10.0f;
+ ar->v2d.tot.xmin = 0.0f;
+ ar->v2d.tot.ymin = -10.0f;
+ ar->v2d.tot.xmax = (float)scene->r.efra;
+ ar->v2d.tot.ymax = 10.0f;
ar->v2d.cur= ar->v2d.tot;
@@ -101,14 +101,14 @@ static ARegion *clip_has_preview_region(const bContext *C, ScrArea *sa)
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
- if(ar)
+ if (ar)
return ar;
/* add subdiv level; after header */
ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
/* is error! */
- if(ar==NULL)
+ if (ar==NULL)
return NULL;
arnew= MEM_callocN(sizeof(ARegion), "clip preview region");
@@ -124,7 +124,7 @@ static void clip_scopes_tag_refresh(ScrArea *sa)
SpaceClip *sc= (SpaceClip *)sa->spacedata.first;
ARegion *ar;
- if(sc->mode!=SC_MODE_TRACKING)
+ if (sc->mode!=SC_MODE_TRACKING)
return;
/* only while proeprties are visible */
@@ -141,7 +141,7 @@ static void clip_stabilization_tag_refresh(ScrArea *sa)
SpaceClip *sc= (SpaceClip *)sa->spacedata.first;
MovieClip *clip= ED_space_clip(sc);
- if(clip) {
+ if (clip) {
MovieTrackingStabilization *stab= &clip->tracking.stabilization;
stab->ok= 0;
@@ -212,7 +212,7 @@ static void clip_free(SpaceLink *sl)
sc->clip= NULL;
- if(sc->scopes.track_preview)
+ if (sc->scopes.track_preview)
IMB_freeImBuf(sc->scopes.track_preview);
}
@@ -278,12 +278,12 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_SCREEN:
- if(wmn->data==ND_ANIMPLAY) {
+ if (wmn->data==ND_ANIMPLAY) {
ED_area_tag_redraw(sa);
}
break;
case NC_SPACE:
- if(wmn->data==ND_SPACE_CLIP) {
+ if (wmn->data==ND_SPACE_CLIP) {
clip_scopes_tag_refresh(sa);
clip_stabilization_tag_refresh(sa);
ED_area_tag_redraw(sa);
@@ -400,7 +400,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
/* ******** Global hotkeys avalaible for all regions ******** */
- keymap= WM_keymap_find(keyconf, "Clip", SPACE_CLIP, 0);
+ keymap = WM_keymap_find(keyconf, "Clip", SPACE_CLIP, 0);
WM_keymap_add_item(keymap, "CLIP_OT_open", OKEY, KM_PRESS, KM_ALT, 0);
@@ -408,23 +408,25 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CLIP_OT_properties", NKEY, KM_PRESS, 0, 0);
/* 2d tracking */
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_track_markers", LEFTARROWKEY, KM_PRESS, KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", LEFTARROWKEY, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "backwards", TRUE);
RNA_boolean_set(kmi->ptr, "sequence", FALSE);
- WM_keymap_add_item(keymap, "CLIP_OT_track_markers", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0);
+ RNA_boolean_set(kmi->ptr, "backwards", FALSE);
+ RNA_boolean_set(kmi->ptr, "sequence", FALSE);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "backwards", FALSE);
RNA_boolean_set(kmi->ptr, "sequence", TRUE);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "backwards", TRUE);
RNA_boolean_set(kmi->ptr, "sequence", TRUE);
/* mode */
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", SC_MODE_RECONSTRUCTION);
RNA_boolean_set(kmi->ptr, "toggle", TRUE);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "mode", SC_MODE_DISTORTION);
RNA_boolean_set(kmi->ptr, "toggle", TRUE);
@@ -437,7 +439,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
/* ******** Hotkeys avalaible for main region only ******** */
- keymap= WM_keymap_find(keyconf, "Clip Editor", SPACE_CLIP, 0);
+ keymap = WM_keymap_find(keyconf, "Clip Editor", SPACE_CLIP, 0);
/* ** View/navigation ** */
@@ -468,16 +470,16 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CLIP_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
/* jump to special frame */
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "position", 0);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "position", 1);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "position", 2);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "position", 3);
/* "timeline" */
@@ -504,23 +506,23 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CLIP_OT_slide_marker", LEFTMOUSE, KM_PRESS, 0, 0);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_disable_markers", DKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_disable_markers", DKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "action", 2); /* toggle */
/* tracks */
WM_keymap_add_item(keymap, "CLIP_OT_delete_track", DELKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CLIP_OT_delete_track", XKEY, KM_PRESS, 0, 0);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "action", 0); /* lock */
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_ALT, 0);
RNA_enum_set(kmi->ptr, "action", 1); /* unlock */
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_hide_tracks", HKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_hide_tracks", HKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "unselected", FALSE);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_hide_tracks", HKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_hide_tracks", HKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "unselected", TRUE);
WM_keymap_add_item(keymap, "CLIP_OT_hide_tracks_clear", HKEY, KM_PRESS, KM_ALT, 0);
@@ -532,34 +534,34 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "CLIP_MT_tracking_specials", WKEY, KM_PRESS, 0, 0);
/* display */
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.lock_selection");
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", DKEY, KM_PRESS, KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", DKEY, KM_PRESS, KM_ALT, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.show_disabled");
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_ALT, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.show_marker_search");
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.use_mute_footage");
transform_keymap_for_space(keyconf, keymap, SPACE_CLIP);
/* clean-up */
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT, 0);
RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_REMAINED);
RNA_boolean_set(kmi->ptr, "clear_active", FALSE);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_UPTO);
RNA_boolean_set(kmi->ptr, "clear_active", FALSE);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL);
RNA_boolean_set(kmi->ptr, "clear_active", FALSE);
/* ******** Hotkeys avalaible for preview region only ******** */
- keymap= WM_keymap_find(keyconf, "Clip Graph Editor", SPACE_CLIP, 0);
+ keymap = WM_keymap_find(keyconf, "Clip Graph Editor", SPACE_CLIP, 0);
/* "timeline" */
WM_keymap_add_item(keymap, "CLIP_OT_change_frame", ACTIONMOUSE, KM_PRESS, 0, 0);
@@ -588,22 +590,22 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CLIP_OT_graph_view_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CLIP_OT_graph_center_current_frame", PADPERIOD, KM_PRESS, 0, 0);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.lock_time_cursor");
/* clean-up */
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT, 0);
RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_REMAINED);
RNA_boolean_set(kmi->ptr, "clear_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_UPTO);
RNA_boolean_set(kmi->ptr, "clear_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL);
RNA_boolean_set(kmi->ptr, "clear_active", TRUE);
/* tracks */
- kmi= WM_keymap_add_item(keymap, "CLIP_OT_graph_disable_markers", DKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_disable_markers", DKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "action", 2); /* toggle */
transform_keymap_for_space(keyconf, keymap, SPACE_CLIP);
@@ -615,11 +617,11 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
{
SpaceClip *sc= CTX_wm_space_clip(C);
- if(CTX_data_dir(member)) {
+ if (CTX_data_dir(member)) {
CTX_data_dir_set(result, clip_context_dir);
return 1;
}
- else if(CTX_data_equals(member, "edit_movieclip")) {
+ else if (CTX_data_equals(member, "edit_movieclip")) {
CTX_data_id_pointer_set(result, &sc->clip->id);
return 1;
}
@@ -682,7 +684,7 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
break;
}
- if(view_changed) {
+ if (view_changed) {
ED_area_initialize(wm, window, sa);
ED_area_tag_redraw(sa);
}
@@ -704,20 +706,20 @@ static void movieclip_main_area_set_view2d(SpaceClip *sc, ARegion *ar)
w= width;
h= height;
- if(clip)
+ if (clip)
h*= clip->aspy/clip->aspx/clip->tracking.camera.pixel_aspect;
winx= ar->winrct.xmax - ar->winrct.xmin + 1;
winy= ar->winrct.ymax - ar->winrct.ymin + 1;
- ar->v2d.tot.xmin= 0;
- ar->v2d.tot.ymin= 0;
- ar->v2d.tot.xmax= w;
- ar->v2d.tot.ymax= h;
+ ar->v2d.tot.xmin = 0;
+ ar->v2d.tot.ymin = 0;
+ ar->v2d.tot.xmax = w;
+ ar->v2d.tot.ymax = h;
- ar->v2d.mask.xmin= ar->v2d.mask.ymin= 0;
- ar->v2d.mask.xmax= winx;
- ar->v2d.mask.ymax= winy;
+ ar->v2d.mask.xmin = ar->v2d.mask.ymin = 0;
+ ar->v2d.mask.xmax = winx;
+ ar->v2d.mask.ymax = winy;
/* which part of the image space do we see? */
x1= ar->winrct.xmin+(winx-sc->zoom*w)/2.0f;
@@ -727,12 +729,12 @@ static void movieclip_main_area_set_view2d(SpaceClip *sc, ARegion *ar)
y1-= sc->zoom*sc->yof;
/* relative display right */
- ar->v2d.cur.xmin= ((ar->winrct.xmin - (float)x1)/sc->zoom);
- ar->v2d.cur.xmax= ar->v2d.cur.xmin + ((float)winx/sc->zoom);
+ ar->v2d.cur.xmin = ((ar->winrct.xmin - (float)x1)/sc->zoom);
+ ar->v2d.cur.xmax = ar->v2d.cur.xmin + ((float)winx/sc->zoom);
/* relative display left */
- ar->v2d.cur.ymin= ((ar->winrct.ymin-(float)y1)/sc->zoom);
- ar->v2d.cur.ymax= ar->v2d.cur.ymin + ((float)winy/sc->zoom);
+ ar->v2d.cur.ymin = ((ar->winrct.ymin-(float)y1)/sc->zoom);
+ ar->v2d.cur.ymax = ar->v2d.cur.ymin + ((float)winy/sc->zoom);
/* normalize 0.0..1.0 */
ar->v2d.cur.xmin /= w;
@@ -749,10 +751,10 @@ static void clip_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap= WM_keymap_find(wm->defaultconf, "Clip Editor", SPACE_CLIP, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Clip Editor", SPACE_CLIP, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -765,22 +767,22 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
/* if tracking is in progress, we should synchronize framenr from clipuser
* so latest tracked frame would be shown */
- if(clip && clip->tracking_context)
+ if (clip && clip->tracking_context)
BKE_tracking_sync_user(&sc->user, clip->tracking_context);
- if(sc->flag&SC_LOCK_SELECTION) {
+ if (sc->flag&SC_LOCK_SELECTION) {
ImBuf *tmpibuf= NULL;
- if(clip && clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) {
+ if (clip && clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) {
tmpibuf= ED_space_clip_get_stable_buffer(sc, NULL, NULL, NULL);
}
- if(ED_clip_view_selection(sc, ar, 0)) {
+ if (ED_clip_view_selection(sc, ar, 0)) {
sc->xof+= sc->xlockof;
sc->yof+= sc->ylockof;
}
- if(tmpibuf)
+ if (tmpibuf)
IMB_freeImBuf(tmpibuf);
}
@@ -823,10 +825,10 @@ static void clip_preview_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap= WM_keymap_find(wm->defaultconf, "Clip Graph Editor", SPACE_CLIP, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Clip Graph Editor", SPACE_CLIP, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -838,7 +840,7 @@ static void clip_preview_area_draw(const bContext *C, ARegion *ar)
Scene *scene= CTX_data_scene(C);
short unitx= V2D_UNIT_FRAMESCALE, unity= V2D_UNIT_VALUES;
- if(sc->flag & SC_LOCK_TIMECURSOR)
+ if (sc->flag & SC_LOCK_TIMECURSOR)
ED_clip_graph_center_current_frame(scene, ar);
/* clear and setup matrix */
@@ -896,19 +898,19 @@ static void clip_props_area_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch(wmn->category) {
case NC_WM:
- if(wmn->data == ND_HISTORY)
+ if (wmn->data == ND_HISTORY)
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- if(wmn->data == ND_MODE)
+ if (wmn->data == ND_MODE)
ED_region_tag_redraw(ar);
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_CLIP)
+ if (wmn->data == ND_SPACE_CLIP)
ED_region_tag_redraw(ar);
break;
case NC_SCREEN:
- if(wmn->data == ND_GPENCIL)
+ if (wmn->data == ND_GPENCIL)
ED_region_tag_redraw(ar);
break;
}
@@ -923,7 +925,7 @@ static void clip_properties_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap= WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -945,7 +947,7 @@ static void clip_properties_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_BRUSH:
- if(wmn->action==NA_EDITED)
+ if (wmn->action==NA_EDITED)
ED_region_tag_redraw(ar);
break;
}
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index b4990180b19..6cb7536b1ae 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -82,10 +82,10 @@ static int space_clip_frame_poll(bContext *C)
{
SpaceClip *sc= CTX_wm_space_clip(C);
- if(sc) {
+ if (sc) {
MovieClip *clip= ED_space_clip(sc);
- if(clip)
+ if (clip)
return BKE_movieclip_has_frame(clip, &sc->user);
}
@@ -119,7 +119,7 @@ static int add_marker_exec(bContext *C, wmOperator *op)
int width, height;
ED_space_clip_size(sc, &width, &height);
- if(!width || !height)
+ if (!width || !height)
return OPERATOR_CANCELLED;
RNA_float_get_array(op->ptr, "location", pos);
@@ -149,17 +149,17 @@ static int add_marker_invoke(bContext *C, wmOperator *op, wmEvent *event)
void CLIP_OT_add_marker(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Marker";
- ot->idname= "CLIP_OT_add_marker";
- ot->description= "Place new marker at specified location";
+ ot->name = "Add Marker";
+ ot->idname = "CLIP_OT_add_marker";
+ ot->description = "Place new marker at specified location";
/* api callbacks */
- ot->invoke= add_marker_invoke;
- ot->exec= add_marker_exec;
- ot->poll= space_clip_frame_poll;
+ ot->invoke = add_marker_invoke;
+ ot->exec = add_marker_exec;
+ ot->poll = space_clip_frame_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MIN, FLT_MAX,
@@ -176,10 +176,10 @@ static int delete_track_exec(bContext *C, wmOperator *UNUSED(op))
ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
MovieTrackingTrack *track= tracksbase->first, *next;
- while(track) {
+ while (track) {
next= track->next;
- if(TRACK_VIEW_SELECTED(sc, track))
+ if (TRACK_VIEW_SELECTED(sc, track))
clip_delete_track(C, clip, tracksbase, track);
track= next;
@@ -194,17 +194,17 @@ static int delete_track_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_delete_track(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Track";
- ot->idname= "CLIP_OT_delete_track";
- ot->description= "Delete selected tracks";
+ ot->name = "Delete Track";
+ ot->idname = "CLIP_OT_delete_track";
+ ot->description = "Delete selected tracks";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= delete_track_exec;
- ot->poll= ED_space_clip_poll;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = delete_track_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** delete marker operator *********************/
@@ -218,13 +218,13 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op))
int framenr= sc->user.framenr;
int has_selection= 0;
- while(track) {
+ while (track) {
next= track->next;
- if(TRACK_VIEW_SELECTED(sc, track)) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
MovieTrackingMarker *marker= BKE_tracking_exact_marker(track, framenr);
- if(marker) {
+ if (marker) {
has_selection|= track->markersnr>1;
clip_delete_marker(C, clip, tracksbase, track, marker);
@@ -234,7 +234,7 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op))
track= next;
}
- if(!has_selection) {
+ if (!has_selection) {
/* nothing selected now, unlock view so it can be scrolled nice again */
sc->flag&= ~SC_LOCK_SELECTION;
}
@@ -245,17 +245,17 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_delete_marker(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Marker";
- ot->idname= "CLIP_OT_delete_marker";
- ot->description= "Delete marker for current frame from selected tracks";
+ ot->name = "Delete Marker";
+ ot->idname = "CLIP_OT_delete_marker";
+ ot->description = "Delete marker for current frame from selected tracks";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= delete_marker_exec;
- ot->poll= ED_space_clip_poll;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = delete_marker_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** slide marker operator *********************/
@@ -290,16 +290,18 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTra
data->track= track;
data->marker= marker;
- if(area==TRACK_AREA_POINT) {
+ if (area==TRACK_AREA_POINT) {
data->pos= marker->pos;
data->offset= track->offset;
copy_v2_v2(data->spos, marker->pos);
copy_v2_v2(data->soff, track->offset);
- } else if(area==TRACK_AREA_PAT) {
- if(action==SLIDE_ACTION_SIZE) {
+ }
+ else if (area==TRACK_AREA_PAT) {
+ if (action==SLIDE_ACTION_SIZE) {
data->min= track->pat_min;
data->max= track->pat_max;
- } else {
+ }
+ else {
int a;
data->pos= marker->pos;
@@ -308,15 +310,16 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTra
copy_v2_v2(data->soff, track->offset);
data->smarkers= MEM_callocN(sizeof(*data->smarkers)*track->markersnr, "slide marekrs");
- for(a= 0; a<track->markersnr; a++)
+ for (a= 0; a<track->markersnr; a++)
copy_v2_v2(data->smarkers[a], track->markers[a].pos);
}
- } else if(area==TRACK_AREA_SEARCH) {
+ }
+ else if (area==TRACK_AREA_SEARCH) {
data->min= track->search_min;
data->max= track->search_max;
}
- if(area==TRACK_AREA_SEARCH || (area==TRACK_AREA_PAT && action!=SLIDE_ACTION_OFFSET)) {
+ if (area==TRACK_AREA_SEARCH || (area==TRACK_AREA_PAT && action!=SLIDE_ACTION_OFFSET)) {
copy_v2_v2(data->smin, data->min);
copy_v2_v2(data->smax, data->max);
}
@@ -327,7 +330,7 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTra
data->width= width;
data->height= height;
- if(action==SLIDE_ACTION_SIZE)
+ if (action==SLIDE_ACTION_SIZE)
data->lock= 1;
return data;
@@ -343,10 +346,11 @@ static int mouse_on_corner(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki
float min[2], max[2];
float crn[2], dx, dy, tdx, tdy;
- if(area==TRACK_AREA_SEARCH) {
+ if (area==TRACK_AREA_SEARCH) {
copy_v2_v2(min, track->search_min);
copy_v2_v2(max, track->search_max);
- } else {
+ }
+ else {
copy_v2_v2(min, track->pat_min);
copy_v2_v2(max, track->pat_max);
}
@@ -360,12 +364,13 @@ static int mouse_on_corner(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki
dx= MIN2(dx, (max[0]-min[0])/6.0f) + tdx;
dy= MIN2(dy, (max[1]-min[1])/6.0f) + tdy;
- if(corner==0) {
+ if (corner==0) {
crn[0]= marker->pos[0]+max[0];
crn[1]= marker->pos[1]+min[1];
inside= co[0]>=crn[0]-dx && co[0]<=crn[0]+tdx && co[1]>=crn[1]-tdy && co[1]<=crn[1]+dy;
- } else {
+ }
+ else {
crn[0]= marker->pos[0]+min[0];
crn[1]= marker->pos[1]+max[1];
@@ -417,37 +422,37 @@ static void *slide_marker_customdata(bContext *C, wmEvent *event)
ED_space_clip_size(sc, &width, &height);
- if(width==0 || height==0)
+ if (width==0 || height==0)
return NULL;
ED_clip_mouse_pos(C, event, co);
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr);
- if((marker->flag&MARKER_DISABLED)==0) {
- if(!customdata)
- if(mouse_on_offset(sc, track, marker, co, width, height))
+ if ((marker->flag&MARKER_DISABLED)==0) {
+ if (!customdata)
+ if (mouse_on_offset(sc, track, marker, co, width, height))
customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_POINT, SLIDE_ACTION_POS, width, height);
- if(sc->flag&SC_SHOW_MARKER_SEARCH) {
- if(mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 1, width, height))
+ if (sc->flag&SC_SHOW_MARKER_SEARCH) {
+ if (mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 1, width, height))
customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_OFFSET, width, height);
- else if(mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 0, width, height))
+ else if (mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 0, width, height))
customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_SIZE, width, height);
}
- if(!customdata && sc->flag&SC_SHOW_MARKER_PATTERN) {
- if(mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 1, width, height))
+ if (!customdata && sc->flag&SC_SHOW_MARKER_PATTERN) {
+ if (mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 1, width, height))
customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, SLIDE_ACTION_OFFSET, width, height);
- if(!customdata && mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 0, width, height))
+ if (!customdata && mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 0, width, height))
customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, SLIDE_ACTION_SIZE, width, height);
}
- if(customdata)
+ if (customdata)
break;
}
}
@@ -462,7 +467,7 @@ static int slide_marker_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SlideMarkerData *slidedata= slide_marker_customdata(C, event);
- if(slidedata) {
+ if (slidedata) {
SpaceClip *sc= CTX_wm_space_clip(C);
MovieClip *clip= ED_space_clip(sc);
MovieTracking *tracking= &clip->tracking;
@@ -485,19 +490,21 @@ static int slide_marker_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void cancel_mouse_slide(SlideMarkerData *data)
{
/* cancel sliding */
- if(data->area == TRACK_AREA_POINT) {
- if(data->action==SLIDE_ACTION_OFFSET)
+ if (data->area == TRACK_AREA_POINT) {
+ if (data->action==SLIDE_ACTION_OFFSET)
copy_v2_v2(data->offset, data->soff);
else
copy_v2_v2(data->pos, data->spos);
- } else {
- if(data->action==SLIDE_ACTION_SIZE) {
+ }
+ else {
+ if (data->action==SLIDE_ACTION_SIZE) {
copy_v2_v2(data->min, data->smin);
copy_v2_v2(data->max, data->smax);
- } else {
+ }
+ else {
int a;
- for(a= 0; a<data->track->markersnr; a++)
+ for (a= 0; a<data->track->markersnr; a++)
copy_v2_v2(data->track->markers[a].pos, data->smarkers[a]);
copy_v2_v2(data->offset, data->soff);
@@ -507,7 +514,7 @@ static void cancel_mouse_slide(SlideMarkerData *data)
static void free_slide_data(SlideMarkerData *data)
{
- if(data->smarkers) MEM_freeN(data->smarkers);
+ if (data->smarkers) MEM_freeN(data->smarkers);
MEM_freeN(data);
}
@@ -522,11 +529,11 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
case RIGHTCTRLKEY:
case LEFTSHIFTKEY:
case RIGHTSHIFTKEY:
- if(data->action==SLIDE_ACTION_SIZE)
- if(ELEM(event->type, LEFTCTRLKEY, RIGHTCTRLKEY))
+ if (data->action==SLIDE_ACTION_SIZE)
+ if (ELEM(event->type, LEFTCTRLKEY, RIGHTCTRLKEY))
data->lock= event->val==KM_RELEASE;
- if(ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY))
+ if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY))
data->accurate= event->val==KM_PRESS;
/* no break! update area size */
@@ -537,19 +544,20 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
dx= mdelta[0]/data->width/sc->zoom;
- if(data->lock) dy= -dx/data->height*data->width;
+ if (data->lock) dy= -dx/data->height*data->width;
else dy= mdelta[1]/data->height/sc->zoom;
- if(data->accurate) {
+ if (data->accurate) {
dx/= 5;
dy/= 5;
}
- if(data->area==TRACK_AREA_POINT) {
- if(data->action==SLIDE_ACTION_OFFSET) {
+ if (data->area==TRACK_AREA_POINT) {
+ if (data->action==SLIDE_ACTION_OFFSET) {
data->offset[0]= data->soff[0]+dx;
data->offset[1]= data->soff[1]+dy;
- } else {
+ }
+ else {
data->pos[0]= data->spos[0]+dx;
data->pos[1]= data->spos[1]+dy;
@@ -558,32 +566,35 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
DAG_id_tag_update(&sc->clip->id, 0);
- } else {
- if(data->action==SLIDE_ACTION_SIZE) {
+ }
+ else {
+ if (data->action==SLIDE_ACTION_SIZE) {
data->min[0]= data->smin[0]-dx;
data->max[0]= data->smax[0]+dx;
data->min[1]= data->smin[1]+dy;
data->max[1]= data->smax[1]-dy;
- if(data->area==TRACK_AREA_SEARCH) BKE_tracking_clamp_track(data->track, CLAMP_SEARCH_DIM);
+ if (data->area==TRACK_AREA_SEARCH) BKE_tracking_clamp_track(data->track, CLAMP_SEARCH_DIM);
else BKE_tracking_clamp_track(data->track, CLAMP_PAT_DIM);
- } else {
+ }
+ else {
float d[2]={dx, dy};
- if(data->area==TRACK_AREA_SEARCH) {
+ if (data->area==TRACK_AREA_SEARCH) {
add_v2_v2v2(data->min, data->smin, d);
add_v2_v2v2(data->max, data->smax, d);
- } else {
+ }
+ else {
int a;
- for(a= 0; a<data->track->markersnr; a++)
+ for (a= 0; a<data->track->markersnr; a++)
add_v2_v2v2(data->track->markers[a].pos, data->smarkers[a], d);
sub_v2_v2v2(data->offset, data->soff, d);
}
- if(data->area==TRACK_AREA_SEARCH)
+ if (data->area==TRACK_AREA_SEARCH)
BKE_tracking_clamp_track(data->track, CLAMP_SEARCH_POS);
}
}
@@ -593,7 +604,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
case LEFTMOUSE:
- if(event->val==KM_RELEASE) {
+ if (event->val==KM_RELEASE) {
free_slide_data(op->customdata);
show_cursor(C);
@@ -621,17 +632,17 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
void CLIP_OT_slide_marker(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Slide Marker";
- ot->description= "Slide marker areas";
- ot->idname= "CLIP_OT_slide_marker";
+ ot->name = "Slide Marker";
+ ot->description = "Slide marker areas";
+ ot->idname = "CLIP_OT_slide_marker";
/* api callbacks */
- ot->poll= space_clip_frame_poll;
- ot->invoke= slide_marker_invoke;
- ot->modal= slide_marker_modal;
+ ot->poll = space_clip_frame_poll;
+ ot->invoke = slide_marker_invoke;
+ ot->modal = slide_marker_modal;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING;
/* properties */
RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX,
@@ -642,8 +653,8 @@ void CLIP_OT_slide_marker(wmOperatorType *ot)
static int mouse_on_side(float co[2], float x1, float y1, float x2, float y2, float epsx, float epsy)
{
- if(x1>x2) SWAP(float, x1, x2);
- if(y1>y2) SWAP(float, y1, y2);
+ if (x1>x2) SWAP(float, x1, x2);
+ if (y1>y2) SWAP(float, y1, y2);
return (co[0]>=x1-epsx && co[0]<=x2+epsx) && (co[1]>=y1-epsy && co[1]<=y2+epsy);
}
@@ -672,19 +683,19 @@ static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *trac
epsx= MAX2(epsx, 2.0f / width);
epsy= MAX2(epsy, 2.0f / height);
- if(sc->flag&SC_SHOW_MARKER_SEARCH)
- if(mouse_on_rect(co, marker->pos, track->search_min, track->search_max, epsx, epsy))
+ if (sc->flag&SC_SHOW_MARKER_SEARCH)
+ if (mouse_on_rect(co, marker->pos, track->search_min, track->search_max, epsx, epsy))
return TRACK_AREA_SEARCH;
- if((marker->flag&MARKER_DISABLED)==0) {
- if(sc->flag&SC_SHOW_MARKER_PATTERN)
- if(mouse_on_rect(co, marker->pos, track->pat_min, track->pat_max, epsx, epsy))
+ if ((marker->flag&MARKER_DISABLED)==0) {
+ if (sc->flag&SC_SHOW_MARKER_PATTERN)
+ if (mouse_on_rect(co, marker->pos, track->pat_min, track->pat_max, epsx, epsy))
return TRACK_AREA_PAT;
epsx= 12.0f/width;
epsy= 12.0f/height;
- if(fabsf(co[0]-marker->pos[0]-track->offset[0])< epsx && fabsf(co[1]-marker->pos[1]-track->offset[1])<=epsy)
+ if (fabsf(co[0]-marker->pos[0]-track->offset[0])< epsx && fabsf(co[1]-marker->pos[1]-track->offset[1])<=epsy)
return TRACK_AREA_POINT;
}
@@ -712,27 +723,27 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbas
float mindist= 0.0f;
cur= tracksbase->first;
- while(cur) {
+ while (cur) {
MovieTrackingMarker *marker= BKE_tracking_get_marker(cur, sc->user.framenr);
- if(((cur->flag&TRACK_HIDDEN)==0) && MARKER_VISIBLE(sc, marker)) {
+ if (((cur->flag&TRACK_HIDDEN)==0) && MARKER_VISIBLE(sc, marker)) {
float dist, d1, d2=FLT_MAX, d3=FLT_MAX;
d1= sqrtf((co[0]-marker->pos[0]-cur->offset[0])*(co[0]-marker->pos[0]-cur->offset[0])+
(co[1]-marker->pos[1]-cur->offset[1])*(co[1]-marker->pos[1]-cur->offset[1])); /* distance to marker point */
/* distance to pattern boundbox */
- if(sc->flag&SC_SHOW_MARKER_PATTERN)
+ if (sc->flag&SC_SHOW_MARKER_PATTERN)
d2= dist_to_rect(co, marker->pos, cur->pat_min, cur->pat_max);
/* distance to search boundbox */
- if(sc->flag&SC_SHOW_MARKER_SEARCH && TRACK_VIEW_SELECTED(sc, cur))
+ if (sc->flag&SC_SHOW_MARKER_SEARCH && TRACK_VIEW_SELECTED(sc, cur))
d3= dist_to_rect(co, marker->pos, cur->search_min, cur->search_max);
/* choose minimal distance. useful for cases of overlapped markers. */
dist= MIN3(d1, d2, d3);
- if(track==NULL || dist<mindist) {
+ if (track==NULL || dist<mindist) {
track= cur;
mindist= dist;
}
@@ -755,19 +766,20 @@ static int mouse_select(bContext *C, float co[2], int extend)
track= find_nearest_track(sc, tracksbase, co);
- if(track) {
+ if (track) {
int area= track_mouse_area(sc, co, track);
- if(!extend || !TRACK_VIEW_SELECTED(sc, track))
+ if (!extend || !TRACK_VIEW_SELECTED(sc, track))
area= TRACK_AREA_ALL;
- if(extend && TRACK_AREA_SELECTED(track, area)) {
- if(track==act_track)
+ if (extend && TRACK_AREA_SELECTED(track, area)) {
+ if (track==act_track)
BKE_tracking_deselect_track(track, area);
else
clip->tracking.act_track= track;
- } else {
- if(area==TRACK_AREA_POINT)
+ }
+ else {
+ if (area==TRACK_AREA_POINT)
area= TRACK_AREA_ALL;
BKE_tracking_select_track(tracksbase, track, area, extend);
@@ -775,7 +787,7 @@ static int mouse_select(bContext *C, float co[2], int extend)
}
}
- if(!extend) {
+ if (!extend) {
sc->xlockof= 0.0f;
sc->ylockof= 0.0f;
}
@@ -801,10 +813,10 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
float co[2];
int extend= RNA_boolean_get(op->ptr, "extend");
- if(!extend) {
+ if (!extend) {
SlideMarkerData *slidedata= slide_marker_customdata(C, event);
- if(slidedata) {
+ if (slidedata) {
SpaceClip *sc= CTX_wm_space_clip(C);
MovieClip *clip= ED_space_clip(sc);
@@ -827,17 +839,17 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
void CLIP_OT_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select";
- ot->description= "Select tracking markers";
- ot->idname= "CLIP_OT_select";
+ ot->name = "Select";
+ ot->description = "Select tracking markers";
+ ot->idname = "CLIP_OT_select";
/* api callbacks */
- ot->exec= select_exec;
- ot->invoke= select_invoke;
- ot->poll= ED_space_clip_poll;
+ ot->exec = select_exec;
+ ot->invoke = select_invoke;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", 0,
@@ -859,10 +871,10 @@ static int border_select_exec(bContext *C, wmOperator *op)
int change= 0, mode, extend;
/* get rectangle from operator */
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
ED_clip_point_stable_pos(C, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
ED_clip_point_stable_pos(C, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
@@ -872,15 +884,15 @@ static int border_select_exec(bContext *C, wmOperator *op)
/* do actual selection */
track= tracksbase->first;
- while(track) {
- if((track->flag&TRACK_HIDDEN)==0) {
+ while (track) {
+ if ((track->flag&TRACK_HIDDEN)==0) {
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr);
- if(MARKER_VISIBLE(sc, marker)) {
- if(BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
+ if (MARKER_VISIBLE(sc, marker)) {
+ if (BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT);
}
- else if(!extend) {
+ else if (!extend) {
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, 1);
}
@@ -891,7 +903,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
track= track->next;
}
- if(change) {
+ if (change) {
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
return OPERATOR_FINISHED;
@@ -903,18 +915,18 @@ static int border_select_exec(bContext *C, wmOperator *op)
void CLIP_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Select";
- ot->description= "Select markers using border selection";
- ot->idname= "CLIP_OT_select_border";
+ ot->name = "Border Select";
+ ot->description = "Select markers using border selection";
+ ot->idname = "CLIP_OT_select_border";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= border_select_exec;
- ot->modal= WM_border_select_modal;
- ot->poll= ED_space_clip_poll;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = border_select_exec;
+ ot->modal = WM_border_select_modal;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
WM_operator_properties_gesture_border(ot, TRUE);
@@ -961,11 +973,11 @@ static int circle_select_exec(bContext *C, wmOperator *op)
/* do selection */
track= tracksbase->first;
- while(track) {
- if((track->flag&TRACK_HIDDEN)==0) {
+ while (track) {
+ if ((track->flag&TRACK_HIDDEN)==0) {
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr);
- if(MARKER_VISIBLE(sc, marker) && marker_inside_ellipse(marker, offset, ellipse)) {
+ if (MARKER_VISIBLE(sc, marker) && marker_inside_ellipse(marker, offset, ellipse)) {
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT);
change= 1;
@@ -975,7 +987,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
track= track->next;
}
- if(change) {
+ if (change) {
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
return OPERATOR_FINISHED;
@@ -987,18 +999,18 @@ static int circle_select_exec(bContext *C, wmOperator *op)
void CLIP_OT_select_circle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Circle Select";
- ot->description= "Select markers using circle selection";
- ot->idname= "CLIP_OT_select_circle";
+ ot->name = "Circle Select";
+ ot->description = "Select markers using circle selection";
+ ot->idname = "CLIP_OT_select_circle";
/* api callbacks */
- ot->invoke= WM_gesture_circle_invoke;
- ot->modal= WM_gesture_circle_modal;
- ot->exec= circle_select_exec;
- ot->poll= ED_space_clip_poll;
+ ot->invoke = WM_gesture_circle_invoke;
+ ot->modal = WM_gesture_circle_modal;
+ ot->exec = circle_select_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
@@ -1020,14 +1032,14 @@ static int select_all_exec(bContext *C, wmOperator *op)
int framenr= sc->user.framenr;
int has_selection= 0;
- if(action == SEL_TOGGLE){
+ if (action == SEL_TOGGLE) {
action= SEL_SELECT;
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track)) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
marker= BKE_tracking_get_marker(track, framenr);
- if(MARKER_VISIBLE(sc, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
action= SEL_DESELECT;
break;
}
@@ -1038,11 +1050,11 @@ static int select_all_exec(bContext *C, wmOperator *op)
}
track= tracksbase->first;
- while(track) {
- if((track->flag&TRACK_HIDDEN)==0) {
+ while (track) {
+ if ((track->flag&TRACK_HIDDEN)==0) {
marker= BKE_tracking_get_marker(track, framenr);
- if(MARKER_VISIBLE(sc, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
switch (action) {
case SEL_SELECT:
track->flag|= SELECT;
@@ -1063,13 +1075,13 @@ static int select_all_exec(bContext *C, wmOperator *op)
}
}
- if(TRACK_VIEW_SELECTED(sc, track))
+ if (TRACK_VIEW_SELECTED(sc, track))
has_selection= 1;
track= track->next;
}
- if(!has_selection)
+ if (!has_selection)
sc->flag&= ~SC_LOCK_SELECTION;
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
@@ -1080,16 +1092,16 @@ static int select_all_exec(bContext *C, wmOperator *op)
void CLIP_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect All";
- ot->description= "Change selection of all tracking markers";
- ot->idname= "CLIP_OT_select_all";
+ ot->name = "(De)select All";
+ ot->description = "Change selection of all tracking markers";
+ ot->idname = "CLIP_OT_select_all";
/* api callbacks */
- ot->exec= select_all_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = select_all_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -1107,44 +1119,44 @@ static int select_groped_exec(bContext *C, wmOperator *op)
int group= RNA_enum_get(op->ptr, "group");
track= tracksbase->first;
- while(track) {
+ while (track) {
int ok= 0;
marker= BKE_tracking_get_marker(track, sc->user.framenr);
- if(group==0) { /* Keyframed */
+ if (group==0) { /* Keyframed */
ok= marker->framenr==sc->user.framenr && (marker->flag&MARKER_TRACKED)==0;
}
- else if(group==1) { /* Estimated */
+ else if (group==1) { /* Estimated */
ok= marker->framenr!=sc->user.framenr;
}
- else if(group==2) { /* tracked */
+ else if (group==2) { /* tracked */
ok= marker->framenr==sc->user.framenr && (marker->flag&MARKER_TRACKED);
}
- else if(group==3) { /* locked */
+ else if (group==3) { /* locked */
ok= track->flag&TRACK_LOCKED;
}
- else if(group==4) { /* disabled */
+ else if (group==4) { /* disabled */
ok= marker->flag&MARKER_DISABLED;
}
- else if(group==5) { /* color */
+ else if (group==5) { /* color */
MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
- if(act_track) {
+ if (act_track) {
ok= (track->flag&TRACK_CUSTOMCOLOR) == (act_track->flag&TRACK_CUSTOMCOLOR);
- if(ok && track->flag&TRACK_CUSTOMCOLOR)
+ if (ok && track->flag&TRACK_CUSTOMCOLOR)
ok= equals_v3v3(track->color, act_track->color);
}
}
- else if(group==6) { /* failed */
+ else if (group==6) { /* failed */
ok= (track->flag&TRACK_HAS_BUNDLE) == 0;
}
- if(ok) {
+ if (ok) {
track->flag|= SELECT;
- if(sc->flag&SC_SHOW_MARKER_PATTERN) track->pat_flag|= SELECT;
- if(sc->flag&SC_SHOW_MARKER_SEARCH) track->search_flag|= SELECT;
+ if (sc->flag&SC_SHOW_MARKER_PATTERN) track->pat_flag|= SELECT;
+ if (sc->flag&SC_SHOW_MARKER_SEARCH) track->search_flag|= SELECT;
}
track= track->next;
@@ -1169,16 +1181,16 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Select Grouped";
- ot->description= "Select all tracks from specified group";
- ot->idname= "CLIP_OT_select_grouped";
+ ot->name = "Select Grouped";
+ ot->description = "Select all tracks from specified group";
+ ot->idname = "CLIP_OT_select_grouped";
/* api callbacks */
- ot->exec= select_groped_exec;
- ot->poll= space_clip_frame_poll;
+ ot->exec = select_groped_exec;
+ ot->poll = space_clip_frame_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* proeprties */
RNA_def_enum(ot->srna, "group", select_group_items, TRACK_CLEAR_REMAINED, "Action", "Clear action to execute");
@@ -1211,8 +1223,8 @@ static int track_count_markers(SpaceClip *sc, MovieClip *clip)
int framenr= sc->user.framenr;
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
if (!marker || (marker->flag&MARKER_DISABLED) == 0)
@@ -1239,7 +1251,7 @@ static void clear_invisible_track_selection(SpaceClip *sc, MovieClip *clip)
if (hidden) {
MovieTrackingTrack *track = tracksbase->first;
- while(track) {
+ while (track) {
if ((track->flag & TRACK_HIDDEN) == 0)
BKE_tracking_track_flag(track, hidden, SELECT, 1);
@@ -1258,13 +1270,13 @@ static void track_init_markers(SpaceClip *sc, MovieClip *clip, int *frames_limit
clear_invisible_track_selection(sc, clip);
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track)) {
- if((track->flag&TRACK_HIDDEN)==0 && (track->flag&TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
+ if ((track->flag&TRACK_HIDDEN)==0 && (track->flag&TRACK_LOCKED)==0) {
BKE_tracking_ensure_marker(track, framenr);
- if(track->frames_limit) {
- if(frames_limit==0)
+ if (track->frames_limit) {
+ if (frames_limit==0)
frames_limit= track->frames_limit;
else
frames_limit= MIN2(frames_limit, track->frames_limit);
@@ -1280,11 +1292,11 @@ static void track_init_markers(SpaceClip *sc, MovieClip *clip, int *frames_limit
static int track_markers_check_direction(int backwards, int curfra, int efra)
{
- if(backwards) {
- if(curfra<efra) return 0;
+ if (backwards) {
+ if (curfra<efra) return 0;
}
else {
- if(curfra>efra) return 0;
+ if (curfra>efra) return 0;
}
return 1;
@@ -1304,21 +1316,21 @@ static int track_markers_initjob(bContext *C, TrackMarkersJob *tmj, int backward
tmj->clip= clip;
tmj->backwards= backwards;
- if(backwards) tmj->efra= SFRA;
+ if (backwards) tmj->efra= SFRA;
else tmj->efra= EFRA;
/* limit frames to be tracked by user setting */
- if(frames_limit) {
- if(backwards) tmj->efra= MAX2(tmj->efra, tmj->sfra-frames_limit);
+ if (frames_limit) {
+ if (backwards) tmj->efra= MAX2(tmj->efra, tmj->sfra-frames_limit);
else tmj->efra= MIN2(tmj->efra, tmj->sfra+frames_limit);
}
- if(settings->speed!=TRACKING_SPEED_FASTEST) {
+ if (settings->speed!=TRACKING_SPEED_FASTEST) {
tmj->delay= 1.0f/scene->r.frs_sec*1000.0f;
- if(settings->speed==TRACKING_SPEED_HALF) tmj->delay*= 2;
- else if(settings->speed==TRACKING_SPEED_QUARTER) tmj->delay*= 4;
- else if(settings->speed==TRACKING_SPEED_DOUBLE) tmj->delay/= 2;
+ if (settings->speed==TRACKING_SPEED_HALF) tmj->delay*= 2;
+ else if (settings->speed==TRACKING_SPEED_QUARTER) tmj->delay*= 4;
+ else if (settings->speed==TRACKING_SPEED_DOUBLE) tmj->delay/= 2;
}
tmj->context= BKE_tracking_context_new(clip, &sc->user, backwards, 1);
@@ -1345,8 +1357,8 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo
int framenr= tmj->sfra;
//double t= PIL_check_seconds_timer();
- while(framenr != tmj->efra) {
- if(tmj->delay>0) {
+ while (framenr != tmj->efra) {
+ if (tmj->delay>0) {
/* tracking should happen with fixed fps. Calculate time
* using current timer value before tracking frame and after.
*
@@ -1355,24 +1367,25 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo
double start_time= PIL_check_seconds_timer(), exec_time;
- if(!BKE_tracking_next(tmj->context))
+ if (!BKE_tracking_next(tmj->context))
break;
exec_time= PIL_check_seconds_timer()-start_time;
- if(tmj->delay > (float)exec_time)
+ if (tmj->delay > (float)exec_time)
PIL_sleep_ms(tmj->delay-(float)exec_time);
- } else if(!BKE_tracking_next(tmj->context))
+ }
+ else if (!BKE_tracking_next(tmj->context))
break;
*do_update= 1;
*progress=(float)(framenr-tmj->sfra) / (tmj->efra-tmj->sfra);
- if(tmj->backwards) framenr--;
+ if (tmj->backwards) framenr--;
else framenr++;
tmj->lastfra= framenr;
- if(*stop || track_markers_testbreak())
+ if (*stop || track_markers_testbreak())
break;
}
@@ -1414,34 +1427,34 @@ static int track_markers_exec(bContext *C, wmOperator *op)
int sequence= RNA_boolean_get(op->ptr, "sequence");
int frames_limit;
- if(track_count_markers(sc, clip)==0)
+ if (track_count_markers(sc, clip)==0)
return OPERATOR_CANCELLED;
track_init_markers(sc, clip, &frames_limit);
- if(backwards) efra= SFRA;
+ if (backwards) efra= SFRA;
else efra= EFRA;
/* limit frames to be tracked by user setting */
- if(frames_limit) {
- if(backwards) efra= MAX2(efra, sfra-frames_limit);
+ if (frames_limit) {
+ if (backwards) efra= MAX2(efra, sfra-frames_limit);
else efra= MIN2(efra, sfra+frames_limit);
}
- if(!track_markers_check_direction(backwards, framenr, efra))
+ if (!track_markers_check_direction(backwards, framenr, efra))
return OPERATOR_CANCELLED;
/* do not disable tracks due to threshold when tracking frame-by-frame */
context= BKE_tracking_context_new(clip, &sc->user, backwards, sequence);
- while(framenr != efra) {
- if(!BKE_tracking_next(context))
+ while (framenr != efra) {
+ if (!BKE_tracking_next(context))
break;
- if(backwards) framenr--;
+ if (backwards) framenr--;
else framenr++;
- if(!sequence)
+ if (!sequence)
break;
}
@@ -1467,22 +1480,22 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
int backwards= RNA_boolean_get(op->ptr, "backwards");
int sequence= RNA_boolean_get(op->ptr, "sequence");
- if(WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
+ if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
/* only one tracking is allowed at a time */
return OPERATOR_CANCELLED;
}
- if(clip->tracking_context)
+ if (clip->tracking_context)
return OPERATOR_CANCELLED;
- if(track_count_markers(sc, clip)==0)
+ if (track_count_markers(sc, clip)==0)
return OPERATOR_CANCELLED;
- if(!sequence)
+ if (!sequence)
return track_markers_exec(C, op);
tmj= MEM_callocN(sizeof(TrackMarkersJob), "TrackMarkersJob data");
- if(!track_markers_initjob(C, tmj, backwards)) {
+ if (!track_markers_initjob(C, tmj, backwards)) {
track_markers_freejob(tmj);
return OPERATOR_CANCELLED;
@@ -1496,7 +1509,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
* with fixed FPS. To deal with editor refresh we have to synchronize
* tracks from job and tracks in clip. Do this in timer callback
* to prevent threading conflicts. */
- if(tmj->delay>0) WM_jobs_timer(steve, tmj->delay/1000.0f, NC_MOVIECLIP|NA_EVALUATED, 0);
+ if (tmj->delay>0) WM_jobs_timer(steve, tmj->delay/1000.0f, NC_MOVIECLIP|NA_EVALUATED, 0);
else WM_jobs_timer(steve, 0.2, NC_MOVIECLIP|NA_EVALUATED, 0);
WM_jobs_callbacks(steve, track_markers_startjob, NULL, track_markers_updatejob, NULL);
@@ -1515,7 +1528,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
/* no running tracking, remove handler and pass through */
- if(0==WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+ if (0==WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
/* running tracking */
@@ -1531,18 +1544,18 @@ static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
void CLIP_OT_track_markers(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Track Markers";
- ot->description= "Track selected markers";
- ot->idname= "CLIP_OT_track_markers";
+ ot->name = "Track Markers";
+ ot->description = "Track selected markers";
+ ot->idname = "CLIP_OT_track_markers";
/* api callbacks */
- ot->exec= track_markers_exec;
- ot->invoke= track_markers_invoke;
- ot->poll= space_clip_frame_poll;
- ot->modal= track_markers_modal;
+ ot->exec = track_markers_exec;
+ ot->invoke = track_markers_invoke;
+ ot->poll = space_clip_frame_poll;
+ ot->modal = track_markers_modal;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "backwards", 0, "Backwards", "Do backwards tracking");
@@ -1573,7 +1586,7 @@ static int solve_camera_initjob(bContext *C, SolveCameraJob *scj, wmOperator *op
MovieTrackingObject *object= BKE_tracking_active_object(tracking);
int width, height;
- if(!BKE_tracking_can_reconstruct(tracking, object, error_msg, max_error))
+ if (!BKE_tracking_can_reconstruct(tracking, object, error_msg, max_error))
return 0;
/* could fail if footage uses images with different sizes */
@@ -1616,7 +1629,7 @@ static void solve_camera_freejob(void *scv)
MovieClip *clip= scj->clip;
int solved;
- if(!scj->context) {
+ if (!scj->context) {
/* job weren't fully initialized due to some error */
MEM_freeN(scj);
return;
@@ -1624,20 +1637,20 @@ static void solve_camera_freejob(void *scv)
solved= BKE_tracking_finish_reconstruction(scj->context, tracking);
- if(!solved)
+ if (!solved)
BKE_report(scj->reports, RPT_WARNING, "Some data failed to reconstruct, see console for details");
else
BKE_reportf(scj->reports, RPT_INFO, "Average re-projection error %.3f", tracking->reconstruction.error);
/* set currently solved clip as active for scene */
- if(scene->clip)
+ if (scene->clip)
id_us_min(&clip->id);
scene->clip= clip;
id_us_plus(&clip->id);
/* set blender camera focal length so result would look fine there */
- if(scene->camera) {
+ if (scene->camera) {
Camera *camera= (Camera*)scene->camera->data;
int width, height;
@@ -1669,8 +1682,8 @@ static int solve_camera_exec(bContext *C, wmOperator *op)
char error_msg[256]= "\0";
scj= MEM_callocN(sizeof(SolveCameraJob), "SolveCameraJob data");
- if(!solve_camera_initjob(C, scj, op, error_msg, sizeof(error_msg))) {
- if(error_msg[0])
+ if (!solve_camera_initjob(C, scj, op, error_msg, sizeof(error_msg))) {
+ if (error_msg[0])
BKE_report(op->reports, RPT_ERROR, error_msg);
solve_camera_freejob(scj);
@@ -1696,14 +1709,14 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
wmJob *steve;
char error_msg[256]= "\0";
- if(WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
+ if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
/* only one solve is allowed at a time */
return OPERATOR_CANCELLED;
}
scj= MEM_callocN(sizeof(SolveCameraJob), "SolveCameraJob data");
- if(!solve_camera_initjob(C, scj, op, error_msg, sizeof(error_msg))) {
- if(error_msg[0])
+ if (!solve_camera_initjob(C, scj, op, error_msg, sizeof(error_msg))) {
+ if (error_msg[0])
BKE_report(op->reports, RPT_ERROR, error_msg);
solve_camera_freejob(scj);
@@ -1737,7 +1750,7 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
/* no running solver, remove handler and pass through */
- if(0==WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+ if (0==WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
/* running tracking */
@@ -1753,18 +1766,18 @@ static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *even
void CLIP_OT_solve_camera(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Solve Camera";
- ot->description= "Solve camera motion from tracks";
- ot->idname= "CLIP_OT_solve_camera";
+ ot->name = "Solve Camera";
+ ot->description = "Solve camera motion from tracks";
+ ot->idname = "CLIP_OT_solve_camera";
/* api callbacks */
- ot->exec= solve_camera_exec;
- ot->invoke= solve_camera_invoke;
- ot->modal= solve_camera_modal;
- ot->poll= ED_space_clip_poll;
+ ot->exec = solve_camera_exec;
+ ot->invoke = solve_camera_invoke;
+ ot->modal = solve_camera_modal;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** clear solution operator *********************/
@@ -1778,13 +1791,13 @@ static int clear_solution_exec(bContext *C, wmOperator *UNUSED(op))
MovieTrackingReconstruction *reconstruction= BKE_tracking_get_reconstruction(tracking);
MovieTrackingTrack *track= tracksbase->first;
- while(track) {
+ while (track) {
track->flag&= ~TRACK_HAS_BUNDLE;
track= track->next;
}
- if(reconstruction->cameras)
+ if (reconstruction->cameras)
MEM_freeN(reconstruction->cameras);
reconstruction->cameras= NULL;
@@ -1803,16 +1816,16 @@ static int clear_solution_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_clear_solution(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Solution";
- ot->description= "Clear all calculated data";
- ot->idname= "CLIP_OT_clear_solution";
+ ot->name = "Clear Solution";
+ ot->description = "Clear all calculated data";
+ ot->idname = "CLIP_OT_clear_solution";
/* api callbacks */
- ot->exec= clear_solution_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = clear_solution_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** clear track operator *********************/
@@ -1832,8 +1845,8 @@ static int clear_track_path_exec(bContext *C, wmOperator *op)
}
else {
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track))
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track))
BKE_tracking_clear_path(track, sc->user.framenr, action);
track= track->next;
@@ -1855,16 +1868,16 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Clear Track Path";
- ot->description= "Clear tracks after/before current position or clear the whole track";
- ot->idname= "CLIP_OT_clear_track_path";
+ ot->name = "Clear Track Path";
+ ot->description = "Clear tracks after/before current position or clear the whole track";
+ ot->idname = "CLIP_OT_clear_track_path";
/* api callbacks */
- ot->exec= clear_track_path_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = clear_track_path_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* proeprties */
RNA_def_enum(ot->srna, "action", clear_path_actions, TRACK_CLEAR_REMAINED, "Action", "Clear action to execute");
@@ -1882,12 +1895,12 @@ static int disable_markers_exec(bContext *C, wmOperator *op)
MovieTrackingTrack *track= tracksbase->first;
int action= RNA_enum_get(op->ptr, "action");
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
MovieTrackingMarker *marker= BKE_tracking_ensure_marker(track, sc->user.framenr);
- if(action==0) marker->flag|= MARKER_DISABLED;
- else if(action==1) marker->flag&= ~MARKER_DISABLED;
+ if (action==0) marker->flag|= MARKER_DISABLED;
+ else if (action==1) marker->flag&= ~MARKER_DISABLED;
else marker->flag^= MARKER_DISABLED;
}
@@ -1911,16 +1924,16 @@ void CLIP_OT_disable_markers(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Disable Markers";
- ot->description= "Disable/enable selected markers";
- ot->idname= "CLIP_OT_disable_markers";
+ ot->name = "Disable Markers";
+ ot->description = "Disable/enable selected markers";
+ ot->idname = "CLIP_OT_disable_markers";
/* api callbacks */
- ot->exec= disable_markers_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = disable_markers_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Disable action to execute");
@@ -1933,13 +1946,13 @@ static Object *get_camera_with_movieclip(Scene *scene, MovieClip *clip)
Object *camera= scene->camera;
Base *base;
- if(camera && object_get_movieclip(scene, camera, 0)==clip)
+ if (camera && object_get_movieclip(scene, camera, 0)==clip)
return camera;
base= scene->base.first;
- while(base) {
- if(base->object->type == OB_CAMERA) {
- if(object_get_movieclip(scene, base->object, 0)==clip) {
+ while (base) {
+ if (base->object->type == OB_CAMERA) {
+ if (object_get_movieclip(scene, base->object, 0)==clip) {
camera= base->object;
break;
}
@@ -1960,14 +1973,14 @@ static Object *get_orientation_object(bContext *C)
MovieTrackingObject *tracking_object= BKE_tracking_active_object(tracking);
Object *object= NULL;
- if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+ if (tracking_object->flag&TRACKING_OBJECT_CAMERA) {
object= get_camera_with_movieclip(scene, clip);
}
else {
object= OBACT;
}
- if(object && object->parent)
+ if (object && object->parent)
object= object->parent;
return object;
@@ -1975,14 +1988,14 @@ static Object *get_orientation_object(bContext *C)
static int set_orientation_poll(bContext *C)
{
- if(space_clip_frame_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);
MovieTracking *tracking= &clip->tracking;
MovieTrackingObject *tracking_object= BKE_tracking_active_object(tracking);
- if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+ if (tracking_object->flag&TRACKING_OBJECT_CAMERA) {
return 1;
}
else {
@@ -2002,8 +2015,8 @@ static int count_selected_bundles(bContext *C)
int tot= 0;
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_HAS_BUNDLE))
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_HAS_BUNDLE))
tot++;
track= track->next;
@@ -2020,13 +2033,13 @@ static void object_solver_inverted_matrix(Scene *scene, Object *ob, float invmat
for (con= ob->constraints.first; con; con=con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- if(!cti)
+ if (!cti)
continue;
- if(cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
+ if (cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
bObjectSolverConstraint *data= (bObjectSolverConstraint *)con->data;
- if(!found) {
+ if (!found) {
Object *cam= data->camera ? data->camera : scene->camera;
where_is_object_mat(scene, cam, invmat);
@@ -2038,7 +2051,7 @@ static void object_solver_inverted_matrix(Scene *scene, Object *ob, float invmat
}
}
- if(found)
+ if (found)
invert_m4(invmat);
else
unit_m4(invmat);
@@ -2051,10 +2064,10 @@ static Object *object_solver_camera(Scene *scene, Object *ob)
for (con= ob->constraints.first; con; con=con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- if(!cti)
+ if (!cti)
continue;
- if(cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
+ if (cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
bObjectSolverConstraint *data= (bObjectSolverConstraint *)con->data;
return data->camera ? data->camera : scene->camera;
@@ -2078,14 +2091,14 @@ static int set_origin_exec(bContext *C, wmOperator *op)
float mat[4][4], vec[3], median[3];
int selected_count= count_selected_bundles(C);
- if(selected_count==0) {
+ if (selected_count==0) {
BKE_report(op->reports, RPT_ERROR, "At least one track with bundle should be selected to define origin position");
return OPERATOR_CANCELLED;
}
object= get_orientation_object(C);
- if(!object) {
+ if (!object) {
BKE_report(op->reports, RPT_ERROR, "No object to apply orientation on");
return OPERATOR_CANCELLED;
@@ -2097,8 +2110,8 @@ static int set_origin_exec(bContext *C, wmOperator *op)
track= tracksbase->first;
zero_v3(median);
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_HAS_BUNDLE)) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_HAS_BUNDLE)) {
add_v3_v3(median, track->bundle_pos);
}
@@ -2110,7 +2123,7 @@ static int set_origin_exec(bContext *C, wmOperator *op)
mul_v3_m4v3(vec, mat, median);
- if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+ if (tracking_object->flag&TRACKING_OBJECT_CAMERA) {
sub_v3_v3(object->loc, vec);
}
else {
@@ -2131,16 +2144,16 @@ static int set_origin_exec(bContext *C, wmOperator *op)
void CLIP_OT_set_origin(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Origin";
- ot->description= "Set active marker as origin by moving camera (or it's parent if present) in 3D space";
- ot->idname= "CLIP_OT_set_origin";
+ ot->name = "Set Origin";
+ ot->description = "Set active marker as origin by moving camera (or it's parent if present) in 3D space";
+ ot->idname = "CLIP_OT_set_origin";
/* api callbacks */
- ot->exec= set_origin_exec;
- ot->poll= set_orientation_poll;
+ ot->exec = set_origin_exec;
+ ot->poll = set_orientation_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "use_median", 0, "Use Median", "Set origin to median point of selected bundles");
@@ -2162,7 +2175,7 @@ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingOb
mul_v3_m4v3(vec, mat, track->bundle_pos);
copy_v3_v3(dvec, vec);
- if(!is_camera) {
+ if (!is_camera) {
float imat[4][4];
object_solver_inverted_matrix(scene, ob, imat);
@@ -2174,22 +2187,23 @@ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingOb
sub_v3_v3(vec, obmat[3]);
}
- if(len_v2(vec) < 1e-3f)
+ if (len_v2(vec) < 1e-3f)
return;
unit_m4(mat);
- if(axis=='X') {
- if(fabsf(dvec[1])<1e-3f) {
+ if (axis=='X') {
+ if (fabsf(dvec[1])<1e-3f) {
flip= 1;
mat[0][0]= -1.0f; mat[0][1]= 0.0f; mat[0][2]= 0.0f;
mat[1][0]= 0.0f; mat[1][1]= -1.0f; mat[1][2]= 0.0f;
mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f;
- } else {
+ }
+ else {
copy_v3_v3(mat[0], vec);
- if(is_camera || fabsf(vec[2])<1e-3f) {
+ if (is_camera || fabsf(vec[2])<1e-3f) {
mat[0][2]= 0.0f;
mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f;
cross_v3_v3v3(mat[1], mat[2], mat[0]);
@@ -2201,17 +2215,19 @@ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingOb
cross_v3_v3v3(mat[2], mat[0], mat[1]);
}
}
- } else {
- if(fabsf(dvec[0])<1e-3f) {
+ }
+ else {
+ if (fabsf(dvec[0])<1e-3f) {
flip= 1;
mat[0][0]= -1.0f; mat[0][1]= 0.0f; mat[0][2]= 0.0f;
mat[1][0]= 0.0f; mat[1][1]= -1.0f; mat[1][2]= 0.0f;
mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f;
- } else {
+ }
+ else {
copy_v3_v3(mat[1], vec);
- if(is_camera || fabsf(vec[2])<1e-3f) {
+ if (is_camera || fabsf(vec[2])<1e-3f) {
mat[1][2]= 0.0f;
mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f;
cross_v3_v3v3(mat[0], mat[1], mat[2]);
@@ -2229,13 +2245,13 @@ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingOb
normalize_v3(mat[1]);
normalize_v3(mat[2]);
- if(is_camera) {
+ if (is_camera) {
invert_m4(mat);
mult_m4_m4m4(mat, mat, obmat);
}
else {
- if(!flip) {
+ if (!flip) {
float lmat[4][4], ilmat[4][4], rmat[3][3];
object_rot_to_mat3(ob, rmat);
@@ -2275,7 +2291,7 @@ static int set_plane_exec(bContext *C, wmOperator *op)
{1.0f, 0.0f, 0.0f, 0.0f},
{0.0f, 0.0f, 0.0f, 1.0f}}; /* 90 degrees Y-axis rotation matrix */
- if(count_selected_bundles(C)!=3) {
+ if (count_selected_bundles(C)!=3) {
BKE_report(op->reports, RPT_ERROR, "Three tracks with bundles are needed to orient the floor");
return OPERATOR_CANCELLED;
@@ -2286,7 +2302,7 @@ static int set_plane_exec(bContext *C, wmOperator *op)
act_track= BKE_tracking_active_track(tracking);
object= get_orientation_object(C);
- if(!object) {
+ if (!object) {
BKE_report(op->reports, RPT_ERROR, "No object to apply orientation on");
return OPERATOR_CANCELLED;
@@ -2296,11 +2312,11 @@ static int set_plane_exec(bContext *C, wmOperator *op)
/* get 3 bundles to use as reference */
track= tracksbase->first;
- while(track && tot<3) {
- if(track->flag&TRACK_HAS_BUNDLE && TRACK_VIEW_SELECTED(sc, track)) {
+ while (track && tot<3) {
+ if (track->flag&TRACK_HAS_BUNDLE && TRACK_VIEW_SELECTED(sc, track)) {
mul_v3_m4v3(vec[tot], mat, track->bundle_pos);
- if(tot==0 || track==act_track)
+ if (tot==0 || track==act_track)
copy_v3_v3(orig, vec[tot]);
else
axis_track= track;
@@ -2337,7 +2353,7 @@ static int set_plane_exec(bContext *C, wmOperator *op)
mat[3][1]= orig[1];
mat[3][2]= orig[2];
- if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+ if (tracking_object->flag&TRACKING_OBJECT_CAMERA) {
invert_m4(mat);
object_to_mat4(object, obmat);
@@ -2346,7 +2362,7 @@ static int set_plane_exec(bContext *C, wmOperator *op)
object_apply_mat4(object, newmat, 0, 0);
/* make camera have positive z-coordinate */
- if(object->loc[2]<0) {
+ if (object->loc[2]<0) {
invert_m4(rot);
mult_m4_m4m4(newmat, rot, mat);
object_apply_mat4(object, newmat, 0, 0);
@@ -2377,16 +2393,16 @@ void CLIP_OT_set_plane(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Set Plane";
- ot->description= "Set plane based on 3 selected bundles by moving camera (or it's parent if present) in 3D space";
- ot->idname= "CLIP_OT_set_plane";
+ ot->name = "Set Plane";
+ ot->description = "Set plane based on 3 selected bundles by moving camera (or it's parent if present) in 3D space";
+ ot->idname = "CLIP_OT_set_plane";
/* api callbacks */
- ot->exec= set_plane_exec;
- ot->poll= set_orientation_poll;
+ ot->exec = set_plane_exec;
+ ot->poll = set_orientation_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "plane", plane_items, 0, "Plane", "Plane to be sued for orientation");
@@ -2406,14 +2422,14 @@ static int set_axis_exec(bContext *C, wmOperator *op)
ListBase *tracksbase;
int axis= RNA_enum_get(op->ptr, "axis");
- if(count_selected_bundles(C)!=1) {
+ if (count_selected_bundles(C)!=1) {
BKE_report(op->reports, RPT_ERROR, "Single track with bundle should be selected to define axis");
return OPERATOR_CANCELLED;
}
object= get_orientation_object(C);
- if(!object) {
+ if (!object) {
BKE_report(op->reports, RPT_ERROR, "No object to apply orientation on");
return OPERATOR_CANCELLED;
@@ -2422,8 +2438,8 @@ static int set_axis_exec(bContext *C, wmOperator *op)
tracksbase= BKE_tracking_object_tracks(tracking, tracking_object);
track=tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track))
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track))
break;
track= track->next;
@@ -2449,16 +2465,16 @@ void CLIP_OT_set_axis(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Set Axis";
- ot->description= "Set direction of scene axis rotating camera (or it's parent if present) and assuming selected track lies on real axis joining it with the origin";
- ot->idname= "CLIP_OT_set_axis";
+ ot->name = "Set Axis";
+ ot->description = "Set direction of scene axis rotating camera (or it's parent if present) and assuming selected track lies on real axis joining it with the origin";
+ ot->idname = "CLIP_OT_set_axis";
/* api callbacks */
- ot->exec= set_axis_exec;
- ot->poll= set_orientation_poll;
+ ot->exec = set_axis_exec;
+ ot->poll = set_orientation_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "axis", axis_actions, 0, "Axis", "Axis to use to align bundle along");
@@ -2481,14 +2497,14 @@ static int do_set_scale(bContext *C, wmOperator *op, int scale_solution)
float vec[2][3], mat[4][4], scale;
float dist= RNA_float_get(op->ptr, "distance");
- if(count_selected_bundles(C)!=2) {
+ if (count_selected_bundles(C)!=2) {
BKE_report(op->reports, RPT_ERROR, "Two tracks with bundles should be selected to set scale");
return OPERATOR_CANCELLED;
}
object= get_orientation_object(C);
- if(!object) {
+ if (!object) {
BKE_report(op->reports, RPT_ERROR, "No object to apply orientation on");
return OPERATOR_CANCELLED;
@@ -2497,8 +2513,8 @@ static int do_set_scale(bContext *C, wmOperator *op, int scale_solution)
BKE_get_tracking_mat(scene, camera, mat);
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track)) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
mul_v3_m4v3(vec[tot], mat, track->bundle_pos);
tot++;
}
@@ -2508,19 +2524,19 @@ static int do_set_scale(bContext *C, wmOperator *op, int scale_solution)
sub_v3_v3(vec[0], vec[1]);
- if(len_v3(vec[0])>1e-5f) {
+ if (len_v3(vec[0])>1e-5f) {
scale= dist / len_v3(vec[0]);
- if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+ if (tracking_object->flag&TRACKING_OBJECT_CAMERA) {
mul_v3_fl(object->size, scale);
mul_v3_fl(object->loc, scale);
}
- else if(!scale_solution){
+ else if (!scale_solution) {
Object *solver_camera= object_solver_camera(scene, object);
object->size[0]= object->size[1]= object->size[2]= 1.0f/scale;
- if(solver_camera) {
+ if (solver_camera) {
object->size[0]/= solver_camera->size[0];
object->size[1]/= solver_camera->size[1];
object->size[2]/= solver_camera->size[2];
@@ -2532,7 +2548,7 @@ static int do_set_scale(bContext *C, wmOperator *op, int scale_solution)
DAG_id_tag_update(&clip->id, 0);
- if(object)
+ if (object)
DAG_id_tag_update(&object->id, OB_RECALC_OB);
WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
@@ -2552,7 +2568,7 @@ static int set_scale_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
SpaceClip *sc= CTX_wm_space_clip(C);
MovieClip *clip= ED_space_clip(sc);
- if(!RNA_struct_property_is_set(op->ptr, "distance"))
+ if (!RNA_struct_property_is_set(op->ptr, "distance"))
RNA_float_set(op->ptr, "distance", clip->tracking.settings.dist);
return set_scale_exec(C, op);
@@ -2561,17 +2577,17 @@ static int set_scale_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
void CLIP_OT_set_scale(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Scale";
- ot->description= "Set scale of scene by scaling camera (or it's parent if present)";
- ot->idname= "CLIP_OT_set_scale";
+ ot->name = "Set Scale";
+ ot->description = "Set scale of scene by scaling camera (or it's parent if present)";
+ ot->idname = "CLIP_OT_set_scale";
/* api callbacks */
- ot->exec= set_scale_exec;
- ot->invoke= set_scale_invoke;
- ot->poll= set_orientation_poll;
+ ot->exec = set_scale_exec;
+ ot->invoke = set_scale_invoke;
+ ot->poll = set_orientation_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_float(ot->srna, "distance", 0.0f, -FLT_MAX, FLT_MAX,
@@ -2582,7 +2598,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
static int set_solution_scale_poll(bContext *C)
{
- if(space_clip_frame_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;
@@ -2604,7 +2620,7 @@ static int set_solution_scale_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
SpaceClip *sc= CTX_wm_space_clip(C);
MovieClip *clip= ED_space_clip(sc);
- if(!RNA_struct_property_is_set(op->ptr, "distance"))
+ if (!RNA_struct_property_is_set(op->ptr, "distance"))
RNA_float_set(op->ptr, "distance", clip->tracking.settings.object_distance);
return set_solution_scale_exec(C, op);
@@ -2613,17 +2629,17 @@ static int set_solution_scale_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
void CLIP_OT_set_solution_scale(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Solution Scale";
- ot->description= "Set object solution scale using distance between two selected tracks";
- ot->idname= "CLIP_OT_set_solution_scale";
+ ot->name = "Set Solution Scale";
+ ot->description = "Set object solution scale using distance between two selected tracks";
+ ot->idname = "CLIP_OT_set_solution_scale";
/* api callbacks */
- ot->exec= set_solution_scale_exec;
- ot->invoke= set_solution_scale_invoke;
- ot->poll= set_solution_scale_poll;
+ ot->exec = set_solution_scale_exec;
+ ot->invoke = set_solution_scale_invoke;
+ ot->poll = set_solution_scale_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_float(ot->srna, "distance", 0.0f, -FLT_MAX, FLT_MAX,
@@ -2640,7 +2656,7 @@ static int set_center_principal_exec(bContext *C, wmOperator *UNUSED(op))
BKE_movieclip_get_size(clip, &sc->user, &width, &height);
- if(width==0 || height==0)
+ if (width==0 || height==0)
return OPERATOR_CANCELLED;
clip->tracking.camera.principal[0]= ((float)width)/2.0f;
@@ -2654,16 +2670,16 @@ static int set_center_principal_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_set_center_principal(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Principal to Center";
- ot->description= "Set optical center to center of footage";
- ot->idname= "CLIP_OT_set_center_principal";
+ ot->name = "Set Principal to Center";
+ ot->description = "Set optical center to center of footage";
+ ot->idname = "CLIP_OT_set_center_principal";
/* api callbacks */
- ot->exec= set_center_principal_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = set_center_principal_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** hide tracks operator *********************/
@@ -2681,20 +2697,21 @@ static int hide_tracks_exec(bContext *C, wmOperator *op)
unselected= RNA_boolean_get(op->ptr, "unselected");
track= tracksbase->first;
- while(track) {
- if(unselected==0 && TRACK_VIEW_SELECTED(sc, track)) {
+ while (track) {
+ if (unselected==0 && TRACK_VIEW_SELECTED(sc, track)) {
track->flag|= TRACK_HIDDEN;
- } else if(unselected==1 && !TRACK_VIEW_SELECTED(sc, track)) {
+ }
+ else if (unselected==1 && !TRACK_VIEW_SELECTED(sc, track)) {
track->flag|= TRACK_HIDDEN;
}
track= track->next;
}
- if(act_track && act_track->flag&TRACK_HIDDEN)
+ if (act_track && act_track->flag&TRACK_HIDDEN)
clip->tracking.act_track= NULL;
- if(unselected==0) {
+ if (unselected==0) {
/* no selection on screen now, unlock view so it can be scrolled nice again */
sc->flag&= ~SC_LOCK_SELECTION;
}
@@ -2707,16 +2724,16 @@ static int hide_tracks_exec(bContext *C, wmOperator *op)
void CLIP_OT_hide_tracks(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Hide Tracks";
- ot->description= "Hide selected tracks";
- ot->idname= "CLIP_OT_hide_tracks";
+ ot->name = "Hide Tracks";
+ ot->description = "Hide selected tracks";
+ ot->idname = "CLIP_OT_hide_tracks";
/* api callbacks */
- ot->exec= hide_tracks_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = hide_tracks_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected tracks");
@@ -2732,7 +2749,7 @@ static int hide_tracks_clear_exec(bContext *C, wmOperator *UNUSED(op))
MovieTrackingTrack *track;
track= tracksbase->first;
- while(track) {
+ while (track) {
track->flag&= ~TRACK_HIDDEN;
track= track->next;
@@ -2746,16 +2763,16 @@ static int hide_tracks_clear_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_hide_tracks_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Hide Tracks Clear";
- ot->description= "Clear hide selected tracks";
- ot->idname= "CLIP_OT_hide_tracks_clear";
+ ot->name = "Hide Tracks Clear";
+ ot->description = "Clear hide selected tracks";
+ ot->idname = "CLIP_OT_hide_tracks_clear";
/* api callbacks */
- ot->exec= hide_tracks_clear_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = hide_tracks_clear_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** detect features operator *********************/
@@ -2764,12 +2781,12 @@ static bGPDlayer *detect_get_layer(MovieClip *clip)
{
bGPDlayer *layer;
- if(!clip->gpd)
+ if (!clip->gpd)
return NULL;
layer= clip->gpd->layers.first;
- while(layer) {
- if(layer->flag&GP_LAYER_ACTIVE)
+ while (layer) {
+ if (layer->flag&GP_LAYER_ACTIVE)
return layer;
layer= layer->next;
@@ -2794,13 +2811,13 @@ static int detect_features_exec(bContext *C, wmOperator *op)
int place_outside_layer= 0;
bGPDlayer *layer= NULL;
- if(placement!=0) {
+ if (placement!=0) {
layer= detect_get_layer(clip);
place_outside_layer= placement==2;
}
/* deselect existing tracks */
- while(track) {
+ while (track) {
track->flag&= ~SELECT;
track->pat_flag&= ~SELECT;
track->search_flag&= ~SELECT;
@@ -2828,16 +2845,16 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Detect Features";
- ot->description= "Automatically detect features and place markers to track";
- ot->idname= "CLIP_OT_detect_features";
+ ot->name = "Detect Features";
+ ot->description = "Automatically detect features and place markers to track";
+ ot->idname = "CLIP_OT_detect_features";
/* api callbacks */
- ot->exec= detect_features_exec;
- ot->poll= space_clip_frame_poll;
+ ot->exec = detect_features_exec;
+ ot->poll = space_clip_frame_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "placement", placement_items, 0, "Placement", "Placement for detected features");
@@ -2857,25 +2874,25 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
int pos= RNA_enum_get(op->ptr, "position");
int delta;
- if(pos<=1) { /* jump to path */
+ if (pos<=1) { /* jump to path */
track= BKE_tracking_active_track(&clip->tracking);
- if(!track)
+ if (!track)
return OPERATOR_CANCELLED;
delta= pos == 1 ? 1 : -1;
- while(sc->user.framenr+delta >= SFRA && sc->user.framenr+delta <= EFRA) {
+ while (sc->user.framenr+delta >= SFRA && sc->user.framenr+delta <= EFRA) {
MovieTrackingMarker *marker= BKE_tracking_exact_marker(track, sc->user.framenr+delta);
- if(!marker || marker->flag&MARKER_DISABLED)
+ if (!marker || marker->flag&MARKER_DISABLED)
break;
sc->user.framenr+= delta;
}
}
else { /* to to failed frame */
- if(clip->tracking.reconstruction.flag&TRACKING_RECONSTRUCTED) {
+ if (clip->tracking.reconstruction.flag&TRACKING_RECONSTRUCTED) {
int a= sc->user.framenr;
MovieTracking *tracking= &clip->tracking;
MovieTrackingObject *object= BKE_tracking_active_object(tracking);
@@ -2884,12 +2901,12 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
a+= delta;
- while(a+delta >= SFRA && a+delta <= EFRA) {
+ while (a+delta >= SFRA && a+delta <= EFRA) {
MovieReconstructedCamera *cam;
cam= BKE_tracking_get_reconstructed_camera(tracking, object, a);
- if(!cam) {
+ if (!cam) {
sc->user.framenr= a;
break;
@@ -2900,7 +2917,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
}
}
- if(CFRA!=sc->user.framenr) {
+ if (CFRA!=sc->user.framenr) {
CFRA= sc->user.framenr;
sound_seek_scene(CTX_data_main(C), CTX_data_scene(C));
@@ -2923,19 +2940,19 @@ void CLIP_OT_frame_jump(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Jump to Frame";
- ot->description= "Jump to special frame";
- ot->idname= "CLIP_OT_frame_jump";
+ ot->name = "Jump to Frame";
+ ot->description = "Jump to special frame";
+ ot->idname = "CLIP_OT_frame_jump";
/* api callbacks */
- ot->exec= frame_jump_exec;
- ot->poll= space_clip_frame_poll;
+ ot->exec = frame_jump_exec;
+ ot->poll = space_clip_frame_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_enum(ot->srna, "position", position_items, 0, "Position", "Position to jumo to");
+ RNA_def_enum(ot->srna, "position", position_items, 0, "Position", "Position to jump to");
}
/********************** join tracks operator *********************/
@@ -2950,31 +2967,19 @@ static int join_tracks_exec(bContext *C, wmOperator *op)
act_track= BKE_tracking_active_track(tracking);
- if(!act_track) {
+ if (!act_track) {
BKE_report(op->reports, RPT_ERROR, "No active track to join to");
return OPERATOR_CANCELLED;
}
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && track!=act_track) {
- if(!BKE_tracking_test_join_tracks(act_track, track)) {
- BKE_report(op->reports, RPT_ERROR, "Some selected tracks have got keyframed markers to the same frame");
- return OPERATOR_CANCELLED;
- }
- }
-
- track= track->next;
- }
-
- track= tracksbase->first;
- while(track) {
+ while (track) {
next= track->next;
- if(TRACK_VIEW_SELECTED(sc, track) && track!=act_track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && track!=act_track) {
BKE_tracking_join_tracks(act_track, track);
- if(tracking->stabilization.rot_track == track)
+ if (tracking->stabilization.rot_track == track)
tracking->stabilization.rot_track= act_track;
BKE_tracking_free_track(track);
@@ -2992,16 +2997,16 @@ static int join_tracks_exec(bContext *C, wmOperator *op)
void CLIP_OT_join_tracks(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Join Tracks";
- ot->description= "Join selected tracks";
- ot->idname= "CLIP_OT_join_tracks";
+ ot->name = "Join Tracks";
+ ot->description = "Join selected tracks";
+ ot->idname = "CLIP_OT_join_tracks";
/* api callbacks */
- ot->exec= join_tracks_exec;
- ot->poll= space_clip_frame_poll;
+ ot->exec = join_tracks_exec;
+ ot->poll = space_clip_frame_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** lock tracks operator *********************/
@@ -3015,10 +3020,10 @@ static int lock_tracks_exec(bContext *C, wmOperator *op)
MovieTrackingTrack *track= tracksbase->first;
int action= RNA_enum_get(op->ptr, "action");
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track)) {
- if(action==0) track->flag|= TRACK_LOCKED;
- else if(action==1) track->flag&= ~TRACK_LOCKED;
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
+ if (action==0) track->flag|= TRACK_LOCKED;
+ else if (action==1) track->flag&= ~TRACK_LOCKED;
else track->flag^= TRACK_LOCKED;
}
@@ -3040,16 +3045,16 @@ void CLIP_OT_lock_tracks(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Lock Tracks";
- ot->description= "Lock/unlock selected tracks";
- ot->idname= "CLIP_OT_lock_tracks";
+ ot->name = "Lock Tracks";
+ ot->description = "Lock/unlock selected tracks";
+ ot->idname = "CLIP_OT_lock_tracks";
/* api callbacks */
- ot->exec= lock_tracks_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = lock_tracks_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Lock action to execute");
@@ -3065,15 +3070,15 @@ static int track_copy_color_exec(bContext *C, wmOperator *UNUSED(op))
ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
MovieTrackingTrack *track, *act_track= BKE_tracking_active_track(tracking);
- if(!act_track)
+ if (!act_track)
return OPERATOR_CANCELLED;
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && track!=act_track) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && track!=act_track) {
track->flag&= ~TRACK_CUSTOMCOLOR;
- if(act_track->flag&TRACK_CUSTOMCOLOR) {
+ if (act_track->flag&TRACK_CUSTOMCOLOR) {
copy_v3_v3(track->color, act_track->color);
track->flag|= TRACK_CUSTOMCOLOR;
}
@@ -3090,16 +3095,16 @@ static int track_copy_color_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_track_copy_color(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Color";
- ot->description= "Copy color to all selected tracks";
- ot->idname= "CLIP_OT_track_copy_color";
+ ot->name = "Copy Color";
+ ot->description = "Copy color to all selected tracks";
+ ot->idname = "CLIP_OT_track_copy_color";
/* api callbacks */
- ot->exec= track_copy_color_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = track_copy_color_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** add 2d stabilization tracks operator *********************/
@@ -3115,8 +3120,8 @@ static int stabilize_2d_add_exec(bContext *C, wmOperator *UNUSED(op))
int update= 0;
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_USE_2D_STAB)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_USE_2D_STAB)==0) {
track->flag|= TRACK_USE_2D_STAB;
stab->tot_track++;
@@ -3126,7 +3131,7 @@ static int stabilize_2d_add_exec(bContext *C, wmOperator *UNUSED(op))
track= track->next;
}
- if(update) {
+ if (update) {
stab->ok= 0;
DAG_id_tag_update(&clip->id, 0);
@@ -3139,16 +3144,16 @@ static int stabilize_2d_add_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_stabilize_2d_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Stabilization Tracks";
- ot->description= "Add selected tracks to 2D stabilization tool";
- ot->idname= "CLIP_OT_stabilize_2d_add";
+ ot->name = "Add Stabilization Tracks";
+ ot->description = "Add selected tracks to 2D stabilization tool";
+ ot->idname = "CLIP_OT_stabilize_2d_add";
/* api callbacks */
- ot->exec= stabilize_2d_add_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = stabilize_2d_add_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** remove 2d stabilization tracks operator *********************/
@@ -3164,15 +3169,15 @@ static int stabilize_2d_remove_exec(bContext *C, wmOperator *UNUSED(op))
int a= 0, update= 0;
track= tracksbase->first;
- while(track) {
- if(track->flag&TRACK_USE_2D_STAB) {
- if(a==stab->act_track) {
+ while (track) {
+ if (track->flag&TRACK_USE_2D_STAB) {
+ if (a==stab->act_track) {
track->flag&= ~TRACK_USE_2D_STAB;
stab->act_track--;
stab->tot_track--;
- if(stab->act_track<0)
+ if (stab->act_track<0)
stab->act_track= 0;
update= 1;
@@ -3186,7 +3191,7 @@ static int stabilize_2d_remove_exec(bContext *C, wmOperator *UNUSED(op))
track= track->next;
}
- if(update) {
+ if (update) {
stab->ok= 0;
DAG_id_tag_update(&clip->id, 0);
@@ -3199,16 +3204,16 @@ static int stabilize_2d_remove_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_stabilize_2d_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Stabilization Track";
- ot->description= "Remove selected track from stabilization";
- ot->idname= "CLIP_OT_stabilize_2d_remove";
+ ot->name = "Remove Stabilization Track";
+ ot->description = "Remove selected track from stabilization";
+ ot->idname = "CLIP_OT_stabilize_2d_remove";
/* api callbacks */
- ot->exec= stabilize_2d_remove_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = stabilize_2d_remove_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** select 2d stabilization tracks operator *********************/
@@ -3223,8 +3228,8 @@ static int stabilize_2d_select_exec(bContext *C, wmOperator *UNUSED(op))
int update= 0;
track= tracksbase->first;
- while(track) {
- if(track->flag&TRACK_USE_2D_STAB) {
+ while (track) {
+ if (track->flag&TRACK_USE_2D_STAB) {
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, 0);
update= 1;
@@ -3233,7 +3238,7 @@ static int stabilize_2d_select_exec(bContext *C, wmOperator *UNUSED(op))
track= track->next;
}
- if(update)
+ if (update)
WM_event_add_notifier(C, NC_MOVIECLIP|ND_SELECT, clip);
return OPERATOR_FINISHED;
@@ -3242,16 +3247,16 @@ static int stabilize_2d_select_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_stabilize_2d_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Stabilization Tracks";
- ot->description= "Select track which are used for stabilization";
- ot->idname= "CLIP_OT_stabilize_2d_select";
+ ot->name = "Select Stabilization Tracks";
+ ot->description = "Select track which are used for stabilization";
+ ot->idname = "CLIP_OT_stabilize_2d_select";
/* api callbacks */
- ot->exec= stabilize_2d_select_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = stabilize_2d_select_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** set 2d stabilization rotation track operator *********************/
@@ -3263,7 +3268,7 @@ static int stabilize_2d_set_rotation_exec(bContext *C, wmOperator *UNUSED(op))
MovieTracking *tracking= &clip->tracking;
MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
- if(act_track) {
+ if (act_track) {
MovieTrackingStabilization *stab= &tracking->stabilization;
stab->rot_track= act_track;
@@ -3279,16 +3284,16 @@ static int stabilize_2d_set_rotation_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_stabilize_2d_set_rotation(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Rotation Track";
- ot->description= "Use active track to compensate rotation when doing 2D stabilization";
- ot->idname= "CLIP_OT_stabilize_2d_set_rotation";
+ ot->name = "Set Rotation Track";
+ ot->description = "Use active track to compensate rotation when doing 2D stabilization";
+ ot->idname = "CLIP_OT_stabilize_2d_set_rotation";
/* api callbacks */
- ot->exec= stabilize_2d_set_rotation_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = stabilize_2d_set_rotation_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** clean tracks operator *********************/
@@ -3300,53 +3305,53 @@ static int is_track_clean(MovieTrackingTrack *track, int frames, int del)
int start_disabled= 0;
int markersnr= track->markersnr;
- if(del)
+ if (del)
new_markers= MEM_callocN(markersnr*sizeof(MovieTrackingMarker), "track cleaned markers");
- for(a= 0; a<markersnr; a++) {
+ for (a= 0; a<markersnr; a++) {
int end= 0;
- if(prev==-1) {
- if((markers[a].flag&MARKER_DISABLED)==0)
+ if (prev==-1) {
+ if ((markers[a].flag&MARKER_DISABLED)==0)
prev= a;
else
start_disabled= 1;
}
- if(prev >= 0) {
+ if (prev >= 0) {
end= a == markersnr-1;
end|= (a < markersnr-1) && (markers[a].framenr != markers[a+1].framenr-1 ||
markers[a].flag&MARKER_DISABLED);
}
- if(end) {
+ if (end) {
int segok= 1, len= 0;
- if(a != prev && markers[a].framenr != markers[a-1].framenr+1)
+ if (a != prev && markers[a].framenr != markers[a-1].framenr+1)
len= a-prev;
- else if(markers[a].flag&MARKER_DISABLED)
+ else if (markers[a].flag&MARKER_DISABLED)
len= a-prev;
else len= a-prev+1;
- if(frames) {
- if(len < frames) {
+ if (frames) {
+ if (len < frames) {
segok= 0;
ok= 0;
- if(!del)
+ if (!del)
break;
}
}
- if(del) {
- if(segok) {
+ if (del) {
+ if (segok) {
int t= len;
- if(markers[a].flag&MARKER_DISABLED)
+ if (markers[a].flag&MARKER_DISABLED)
t++;
/* place disabled marker in front of current segment */
- if(start_disabled) {
+ if (start_disabled) {
memcpy(new_markers+count, markers+prev, sizeof(MovieTrackingMarker));
new_markers[count].framenr--;
new_markers[count].flag|= MARKER_DISABLED;
@@ -3358,7 +3363,7 @@ static int is_track_clean(MovieTrackingTrack *track, int frames, int del)
memcpy(new_markers+count, markers+prev, t*sizeof(MovieTrackingMarker));
count+= t;
}
- else if(markers[a].flag&MARKER_DISABLED) {
+ else if (markers[a].flag&MARKER_DISABLED) {
/* current segment which would be deleted was finished by disabled marker,
* so next segment should be started from disabled marker */
start_disabled= 1;
@@ -3369,10 +3374,10 @@ static int is_track_clean(MovieTrackingTrack *track, int frames, int del)
}
}
- if(del) {
+ if (del) {
MEM_freeN(track->markers);
- if(count) {
+ if (count) {
track->markers= new_markers;
}
else {
@@ -3397,25 +3402,25 @@ static int clean_tracks_exec(bContext *C, wmOperator *op)
int action= RNA_enum_get(op->ptr, "action");
float error= RNA_float_get(op->ptr, "error");
- if(error && action==TRACKING_CLEAN_DELETE_SEGMENT)
+ if (error && action==TRACKING_CLEAN_DELETE_SEGMENT)
action= TRACKING_CLEAN_DELETE_TRACK;
track= tracksbase->first;
- while(track) {
+ while (track) {
next= track->next;
- if((track->flag&TRACK_HIDDEN)==0 && (track->flag&TRACK_LOCKED)==0) {
+ if ((track->flag&TRACK_HIDDEN)==0 && (track->flag&TRACK_LOCKED)==0) {
int ok= 1;
ok= (is_track_clean(track, frames, action==TRACKING_CLEAN_DELETE_SEGMENT)) &&
(error == 0.0f || (track->flag&TRACK_HAS_BUNDLE)==0 || track->error < error);
- if(!ok) {
- if(action==TRACKING_CLEAN_SELECT) {
+ if (!ok) {
+ if (action==TRACKING_CLEAN_SELECT) {
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, 0);
}
- else if(action==TRACKING_CLEAN_DELETE_TRACK) {
- if(track==act_track)
+ else if (action==TRACKING_CLEAN_DELETE_TRACK) {
+ if (track==act_track)
clip->tracking.act_track= NULL;
BKE_tracking_free_track(track);
@@ -3424,8 +3429,8 @@ static int clean_tracks_exec(bContext *C, wmOperator *op)
}
/* happens when all tracking segments are not long enough */
- if(track && track->markersnr==0) {
- if(track==act_track)
+ if (track && track->markersnr==0) {
+ if (track==act_track)
clip->tracking.act_track= NULL;
BKE_tracking_free_track(track);
@@ -3447,13 +3452,13 @@ static int clean_tracks_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
SpaceClip *sc= CTX_wm_space_clip(C);
MovieClip *clip= ED_space_clip(sc);
- if(!RNA_struct_property_is_set(op->ptr, "frames"))
+ if (!RNA_struct_property_is_set(op->ptr, "frames"))
RNA_int_set(op->ptr, "frames", clip->tracking.settings.clean_frames);
- if(!RNA_struct_property_is_set(op->ptr, "error"))
+ if (!RNA_struct_property_is_set(op->ptr, "error"))
RNA_float_set(op->ptr, "error", clip->tracking.settings.clean_error);
- if(!RNA_struct_property_is_set(op->ptr, "action"))
+ if (!RNA_struct_property_is_set(op->ptr, "action"))
RNA_enum_set(op->ptr, "action", clip->tracking.settings.clean_action);
return clean_tracks_exec(C, op);
@@ -3469,17 +3474,17 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot)
};
/* identifiers */
- ot->name= "Clean Tracks";
- ot->description= "Clean tracks with high error values or few frames";
- ot->idname= "CLIP_OT_clean_tracks";
+ ot->name = "Clean Tracks";
+ ot->description = "Clean tracks with high error values or few frames";
+ ot->idname = "CLIP_OT_clean_tracks";
/* api callbacks */
- ot->exec= clean_tracks_exec;
- ot->invoke= clean_tracks_invoke;
- ot->poll= ED_space_clip_poll;
+ ot->exec = clean_tracks_exec;
+ ot->invoke = clean_tracks_invoke;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_int(ot->srna, "frames", 0, 0, INT_MAX, "Tracked Frames", "Effect on tracks which are tracked less than specified amount of frames", 0, INT_MAX);
@@ -3505,16 +3510,16 @@ static int tracking_object_new_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_tracking_object_new(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Tracking Object";
- ot->description= "Add new object for tracking";
- ot->idname= "CLIP_OT_tracking_object_new";
+ ot->name = "Add Tracking Object";
+ ot->description = "Add new object for tracking";
+ ot->idname = "CLIP_OT_tracking_object_new";
/* api callbacks */
- ot->exec= tracking_object_new_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = tracking_object_new_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** remove tracking object *********************/
@@ -3528,7 +3533,7 @@ static int tracking_object_remove_exec(bContext *C, wmOperator *op)
object= BKE_tracking_active_object(tracking);
- if(object->flag&TRACKING_OBJECT_CAMERA) {
+ if (object->flag&TRACKING_OBJECT_CAMERA) {
BKE_report(op->reports, RPT_WARNING, "Object used for camera tracking can't be deleted");
return OPERATOR_CANCELLED;
}
@@ -3543,16 +3548,16 @@ static int tracking_object_remove_exec(bContext *C, wmOperator *op)
void CLIP_OT_tracking_object_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Movie Tracking Object";
- ot->description= "Remove object for tracking";
- ot->idname= "CLIP_OT_tracking_object_remove";
+ ot->name = "Movie Tracking Object";
+ ot->description = "Remove object for tracking";
+ ot->idname = "CLIP_OT_tracking_object_remove";
/* api callbacks */
- ot->exec= tracking_object_remove_exec;
- ot->poll= ED_space_clip_poll;
+ ot->exec = tracking_object_remove_exec;
+ ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************** copy tracks to clipboard operator *********************/
@@ -3583,7 +3588,7 @@ void CLIP_OT_copy_tracks(wmOperatorType *ot)
ot->poll = ED_space_clip_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
/********************** paste tracks from clipboard operator *********************/
@@ -3623,5 +3628,5 @@ void CLIP_OT_paste_tracks(wmOperatorType *ot)
ot->poll = paste_tracks_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 4855121a4de..1bfdcee1aae 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -153,7 +153,7 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
ConsoleLine *cl_iter= (ConsoleLine *)tvc->iter;
/* annoying hack, to draw the prompt */
- if(tvc->iter_index == 0) {
+ if (tvc->iter_index == 0) {
const SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
const ConsoleLine *cl= (ConsoleLine *)sc->history.last;
const int prompt_len= strlen(sc->prompt);
@@ -163,7 +163,7 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
xy[1] += tvc->lheight/6;
/* account for wrapping */
- if(cl->len < tvc->console_width) {
+ if (cl->len < tvc->console_width) {
/* simple case, no wrapping */
pen[0]= tvc->cwidth * cursor_loc;
pen[1]= -2;
@@ -214,8 +214,8 @@ static int console_textview_main__internal(struct SpaceConsole *sc, struct ARegi
tvc.sel_start= sc->sel_start;
tvc.sel_end= sc->sel_end;
tvc.lheight= sc->lheight;
- tvc.ymin= v2d->cur.ymin;
- tvc.ymax= v2d->cur.ymax;
+ tvc.ymin = v2d->cur.ymin;
+ tvc.ymax = v2d->cur.ymax;
tvc.winx= ar->winx;
console_scrollback_prompt_begin(sc, &cl_dummy);
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index b52bc75eac8..425cee38af0 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -94,7 +94,7 @@ static void console_scrollback_limit(SpaceConsole *sc)
if (U.scrollback < 32) U.scrollback= 256; // XXX - save in user defaults
- for(tot= BLI_countlist(&sc->scrollback); tot > U.scrollback; tot--)
+ for (tot= BLI_countlist(&sc->scrollback); tot > U.scrollback; tot--)
console_scrollback_free(sc, sc->scrollback.first);
}
@@ -102,11 +102,11 @@ static ConsoleLine * console_history_find(SpaceConsole *sc, const char *str, Con
{
ConsoleLine *cl;
- for(cl= sc->history.last; cl; cl= cl->prev) {
+ for (cl= sc->history.last; cl; cl= cl->prev) {
if (cl==cl_ignore)
continue;
- if(strcmp(str, cl->line)==0)
+ if (strcmp(str, cl->line)==0)
return cl;
}
@@ -136,7 +136,7 @@ static void console_lb_debug__internal(ListBase *lb)
ConsoleLine *cl;
printf("%d: ", BLI_countlist(lb));
- for(cl= lb->first; cl; cl= cl->next)
+ for (cl= lb->first; cl; cl= cl->next)
printf("<%s> ", cl->line);
printf("\n");
@@ -155,14 +155,15 @@ static ConsoleLine *console_lb_add__internal(ListBase *lb, ConsoleLine *from)
{
ConsoleLine *ci= MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
- if(from) {
+ if (from) {
ci->line= BLI_strdup(from->line);
ci->len= strlen(ci->line);
ci->len_alloc= ci->len;
ci->cursor= from->cursor;
ci->type= from->type;
- } else {
+ }
+ else {
ci->line= MEM_callocN(64, "console-in-line");
ci->len_alloc= 64;
ci->len= 0;
@@ -191,7 +192,7 @@ static ConsoleLine *console_scrollback_add(const bContext *C, ConsoleLine *from)
static ConsoleLine *console_lb_add_str__internal(ListBase *lb, char *str, int own)
{
ConsoleLine *ci= MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
- if(own) ci->line= str;
+ if (own) ci->line= str;
else ci->line= BLI_strdup(str);
ci->len = ci->len_alloc = strlen(str);
@@ -214,7 +215,7 @@ ConsoleLine *console_history_verify(const bContext *C)
{
SpaceConsole *sc= CTX_wm_space_console(C);
ConsoleLine *ci= sc->history.last;
- if(ci==NULL)
+ if (ci==NULL)
ci= console_history_add(C, NULL);
return ci;
@@ -224,7 +225,7 @@ ConsoleLine *console_history_verify(const bContext *C)
static void console_line_verify_length(ConsoleLine *ci, int len)
{
/* resize the buffer if needed */
- if(len >= ci->len_alloc) {
+ if (len >= ci->len_alloc) {
int new_len= len * 2; /* new length */
char *new_line= MEM_callocN(new_len, "console line");
memcpy(new_line, ci->line, ci->len);
@@ -239,12 +240,12 @@ static int console_line_insert(ConsoleLine *ci, char *str)
{
int len = strlen(str);
- if(len>0 && str[len-1]=='\n') {/* stop new lines being pasted at the end of lines */
+ if (len>0 && str[len-1]=='\n') {/* stop new lines being pasted at the end of lines */
str[len-1]= '\0';
len--;
}
- if(len==0)
+ if (len==0)
return 0;
console_line_verify_length(ci, len + ci->len);
@@ -326,7 +327,7 @@ static int console_move_exec(bContext *C, wmOperator *op)
break;
}
- if(done) {
+ if (done) {
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
@@ -341,13 +342,13 @@ static int console_move_exec(bContext *C, wmOperator *op)
void CONSOLE_OT_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Cursor";
- ot->description= "Move cursor position";
- ot->idname= "CONSOLE_OT_move";
+ ot->name = "Move Cursor";
+ ot->description = "Move cursor position";
+ ot->idname = "CONSOLE_OT_move";
/* api callbacks */
- ot->exec= console_move_exec;
- ot->poll= ED_operator_console_active;
+ ot->exec = console_move_exec;
+ ot->poll = ED_operator_console_active;
/* properties */
RNA_def_enum(ot->srna, "type", console_move_type_items, LINE_BEGIN, "Type", "Where to move cursor to");
@@ -363,7 +364,7 @@ static int console_insert_exec(bContext *C, wmOperator *op)
int len;
// XXX, alligned tab key hack
- if(str[0]=='\t' && str[1]=='\0') {
+ if (str[0]=='\t' && str[1]=='\0') {
len= TAB_LENGTH - (ci->cursor % TAB_LENGTH);
MEM_freeN(str);
str= MEM_mallocN(len + 1, "insert_exec");
@@ -375,7 +376,7 @@ static int console_insert_exec(bContext *C, wmOperator *op)
MEM_freeN(str);
- if(len==0) {
+ if (len==0) {
return OPERATOR_CANCELLED;
}
else {
@@ -392,10 +393,10 @@ static int console_insert_exec(bContext *C, wmOperator *op)
static int console_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- // if(!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
- if(!RNA_string_length(op->ptr, "text")) {
+ // if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
+ if (!RNA_string_length(op->ptr, "text")) {
/* if alt/ctrl/super are pressed pass through */
- if(event->ctrl || event->oskey) {
+ if (event->ctrl || event->oskey) {
return OPERATOR_PASS_THROUGH;
}
else {
@@ -411,18 +412,21 @@ static int console_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
void CONSOLE_OT_insert(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
- ot->name= "Insert";
- ot->description= "Insert text at cursor position";
- ot->idname= "CONSOLE_OT_insert";
+ ot->name = "Insert";
+ ot->description = "Insert text at cursor position";
+ ot->idname = "CONSOLE_OT_insert";
/* api callbacks */
- ot->exec= console_insert_exec;
- ot->invoke= console_insert_invoke;
- ot->poll= ED_operator_console_active;
+ ot->exec = console_insert_exec;
+ ot->invoke = console_insert_invoke;
+ ot->poll = ED_operator_console_active;
/* properties */
- RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
+ prop = RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
@@ -442,20 +446,20 @@ static int console_delete_exec(bContext *C, wmOperator *op)
const short type= RNA_enum_get(op->ptr, "type");
int done = 0;
- if(ci->len==0) {
+ if (ci->len==0) {
return OPERATOR_CANCELLED;
}
switch(type) {
case DEL_NEXT_CHAR:
- if(ci->cursor < ci->len) {
+ if (ci->cursor < ci->len) {
memmove(ci->line + ci->cursor, ci->line + ci->cursor+1, (ci->len - ci->cursor)+1);
ci->len--;
done= 1;
}
break;
case DEL_PREV_CHAR:
- if(ci->cursor > 0) {
+ if (ci->cursor > 0) {
ci->cursor--; /* same as above */
memmove(ci->line + ci->cursor, ci->line + ci->cursor+1, (ci->len - ci->cursor)+1);
ci->len--;
@@ -464,7 +468,7 @@ static int console_delete_exec(bContext *C, wmOperator *op)
break;
}
- if(!done) {
+ if (!done) {
return OPERATOR_CANCELLED;
}
else {
@@ -483,13 +487,13 @@ static int console_delete_exec(bContext *C, wmOperator *op)
void CONSOLE_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete";
- ot->description= "Delete text by cursor position";
- ot->idname= "CONSOLE_OT_delete";
+ ot->name = "Delete";
+ ot->description = "Delete text by cursor position";
+ ot->idname = "CONSOLE_OT_delete";
/* api callbacks */
- ot->exec= console_delete_exec;
- ot->poll= ED_operator_console_active;
+ ot->exec = console_delete_exec;
+ ot->poll = ED_operator_console_active;
/* properties */
RNA_def_enum(ot->srna, "type", console_delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete");
@@ -507,13 +511,13 @@ static int console_clear_exec(bContext *C, wmOperator *op)
/*ConsoleLine *ci= */ console_history_verify(C);
- if(scrollback) { /* last item in mistory */
- while(sc->scrollback.first)
+ if (scrollback) { /* last item in mistory */
+ while (sc->scrollback.first)
console_scrollback_free(sc, sc->scrollback.first);
}
- if(history) {
- while(sc->history.first)
+ if (history) {
+ while (sc->history.first)
console_history_free(sc, sc->history.first);
}
@@ -526,13 +530,13 @@ static int console_clear_exec(bContext *C, wmOperator *op)
void CONSOLE_OT_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear";
- ot->description= "Clear text by type";
- ot->idname= "CONSOLE_OT_clear";
+ ot->name = "Clear";
+ ot->description = "Clear text by type";
+ ot->idname = "CONSOLE_OT_clear";
/* api callbacks */
- ot->exec= console_clear_exec;
- ot->poll= ED_operator_console_active;
+ ot->exec = console_clear_exec;
+ ot->poll = ED_operator_console_active;
/* properties */
RNA_def_boolean(ot->srna, "scrollback", 1, "Scrollback", "Clear the scrollback history");
@@ -553,14 +557,14 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
/* keep a copy of the line above so when history is cycled
* this is the only function that needs to know about the double-up */
- if(ci->prev) {
+ if (ci->prev) {
ConsoleLine *ci_prev= (ConsoleLine *)ci->prev;
- if(strcmp(ci->line, ci_prev->line)==0)
+ if (strcmp(ci->line, ci_prev->line)==0)
console_history_free(sc, ci_prev);
}
- if(reverse) { /* last item in mistory */
+ if (reverse) { /* last item in mistory */
ci= sc->history.last;
BLI_remlink(&sc->history, ci);
BLI_addhead(&sc->history, ci);
@@ -573,7 +577,7 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
{ /* add a duplicate of the new arg and remove all other instances */
ConsoleLine *cl;
- while((cl= console_history_find(sc, ci->line, ci)))
+ while ((cl= console_history_find(sc, ci->line, ci)))
console_history_free(sc, cl);
console_history_add(C, (ConsoleLine *)sc->history.last);
@@ -594,13 +598,13 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
void CONSOLE_OT_history_cycle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "History Cycle";
- ot->description= "Cycle through history";
- ot->idname= "CONSOLE_OT_history_cycle";
+ ot->name = "History Cycle";
+ ot->description = "Cycle through history";
+ ot->idname = "CONSOLE_OT_history_cycle";
/* api callbacks */
- ot->exec= console_history_cycle_exec;
- ot->poll= ED_operator_console_active;
+ ot->exec = console_history_cycle_exec;
+ ot->poll = ED_operator_console_active;
/* properties */
RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "Reverse cycle history");
@@ -614,18 +618,18 @@ static int console_history_append_exec(bContext *C, wmOperator *op)
ARegion *ar= CTX_wm_region(C);
ScrArea *sa= CTX_wm_area(C);
ConsoleLine *ci= console_history_verify(C);
- char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */
+ char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, don't free */
int cursor= RNA_int_get(op->ptr, "current_character");
short rem_dupes= RNA_boolean_get(op->ptr, "remove_duplicates");
int prev_len= ci->len;
- if(rem_dupes) {
+ if (rem_dupes) {
ConsoleLine *cl;
- while((cl= console_history_find(sc, ci->line, ci)))
+ while ((cl= console_history_find(sc, ci->line, ci)))
console_history_free(sc, cl);
- if(strcmp(str, ci->line)==0) {
+ if (strcmp(str, ci->line)==0) {
MEM_freeN(str);
return OPERATOR_FINISHED;
}
@@ -649,13 +653,13 @@ static int console_history_append_exec(bContext *C, wmOperator *op)
void CONSOLE_OT_history_append(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "History Append";
- ot->description= "Append history at cursor position";
- ot->idname= "CONSOLE_OT_history_append";
+ ot->name = "History Append";
+ ot->description = "Append history at cursor position";
+ ot->idname = "CONSOLE_OT_history_append";
/* api callbacks */
- ot->exec= console_history_append_exec;
- ot->poll= ED_operator_console_active;
+ ot->exec = console_history_append_exec;
+ ot->poll = ED_operator_console_active;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
@@ -671,7 +675,7 @@ static int console_scrollback_append_exec(bContext *C, wmOperator *op)
ARegion *ar= CTX_wm_region(C);
ConsoleLine *ci;
- char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */
+ char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, don't free */
int type= RNA_enum_get(op->ptr, "type");
console_history_verify(C);
@@ -683,7 +687,7 @@ static int console_scrollback_append_exec(bContext *C, wmOperator *op)
/* 'ar' can be null depending on the operator that runs
* rendering with invoke default for eg causes this */
- if(ar) {
+ if (ar) {
console_textview_update_rect(sc, ar);
}
@@ -703,13 +707,13 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Scrollback Append";
- ot->description= "Append scrollback text by type";
- ot->idname= "CONSOLE_OT_scrollback_append";
+ ot->name = "Scrollback Append";
+ ot->description = "Append scrollback text by type";
+ ot->idname = "CONSOLE_OT_scrollback_append";
/* api callbacks */
- ot->exec= console_scrollback_append_exec;
- ot->poll= ED_operator_console_active;
+ ot->exec = console_scrollback_append_exec;
+ ot->poll = ED_operator_console_active;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
@@ -732,22 +736,22 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
#if 0
/* copy whole file */
- for(cl= sc->scrollback.first; cl; cl= cl->next) {
+ for (cl= sc->scrollback.first; cl; cl= cl->next) {
BLI_dynstr_append(buf_dyn, cl->line);
BLI_dynstr_append(buf_dyn, "\n");
}
#endif
- if(sc->sel_start == sc->sel_end)
+ if (sc->sel_start == sc->sel_end)
return OPERATOR_CANCELLED;
console_scrollback_prompt_begin(sc, &cl_dummy);
- for(cl= sc->scrollback.first; cl; cl= cl->next) {
+ for (cl= sc->scrollback.first; cl; cl= cl->next) {
offset += cl->len + 1;
}
- if(offset==0) {
+ if (offset==0) {
console_scrollback_prompt_end(sc, &cl_dummy);
return OPERATOR_CANCELLED;
}
@@ -756,12 +760,12 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
sel[0]= offset - sc->sel_end;
sel[1]= offset - sc->sel_start;
- for(cl= sc->scrollback.first; cl; cl= cl->next) {
- if(sel[0] <= cl->len && sel[1] >= 0) {
+ for (cl= sc->scrollback.first; cl; cl= cl->next) {
+ if (sel[0] <= cl->len && sel[1] >= 0) {
int sta= MAX2(sel[0], 0);
int end= MIN2(sel[1], cl->len);
- if(BLI_dynstr_get_len(buf_dyn))
+ if (BLI_dynstr_get_len(buf_dyn))
BLI_dynstr_append(buf_dyn, "\n");
BLI_dynstr_nappend(buf_dyn, cl->line + sta, end - sta);
@@ -786,13 +790,13 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
void CONSOLE_OT_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy to Clipboard";
- ot->description= "Copy selected text to clipboard";
- ot->idname= "CONSOLE_OT_copy";
+ ot->name = "Copy to Clipboard";
+ ot->description = "Copy selected text to clipboard";
+ ot->idname = "CONSOLE_OT_copy";
/* api callbacks */
- ot->poll= ED_operator_console_active;
- ot->exec= console_copy_exec;
+ ot->poll = ED_operator_console_active;
+ ot->exec = console_copy_exec;
/* properties */
}
@@ -806,19 +810,19 @@ static int console_paste_exec(bContext *C, wmOperator *UNUSED(op))
char *buf_str= WM_clipboard_text_get(0);
char *buf_step, *buf_next;
- if(buf_str==NULL)
+ if (buf_str==NULL)
return OPERATOR_CANCELLED;
buf_step= buf_str;
- while((buf_next=buf_step) && buf_next[0] != '\0') {
+ while ((buf_next=buf_step) && buf_next[0] != '\0') {
buf_step= strchr(buf_next, '\n');
- if(buf_step) {
+ if (buf_step) {
*buf_step= '\0';
buf_step++;
}
- if(buf_next != buf_str) {
+ if (buf_next != buf_str) {
WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL);
ci= console_history_verify(C);
}
@@ -839,13 +843,13 @@ static int console_paste_exec(bContext *C, wmOperator *UNUSED(op))
void CONSOLE_OT_paste(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste from Clipboard";
- ot->description= "Paste text from clipboard";
- ot->idname= "CONSOLE_OT_paste";
+ ot->name = "Paste from Clipboard";
+ ot->description = "Paste text from clipboard";
+ ot->idname = "CONSOLE_OT_paste";
/* api callbacks */
- ot->poll= ED_operator_console_active;
- ot->exec= console_paste_exec;
+ ot->poll = ED_operator_console_active;
+ ot->exec = console_paste_exec;
/* properties */
}
@@ -861,7 +865,7 @@ static void console_cursor_set_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleC
int pos;
pos= console_char_pick(sc, ar, mval);
- if(scu->sel_init == INT_MAX) {
+ if (scu->sel_init == INT_MAX) {
scu->sel_init= pos;
sc->sel_start = sc->sel_end = pos;
return;
@@ -897,7 +901,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *eve
console_cursor_set_to_pos(sc, ar, scu, mval, TRUE);
/* only redraw if the selection changed */
- if(sel_prev[0] != sc->sel_start || sel_prev[1] != sc->sel_end) {
+ if (sel_prev[0] != sc->sel_start || sel_prev[1] != sc->sel_end) {
ED_area_tag_redraw(CTX_wm_area(C));
}
}
@@ -908,7 +912,7 @@ static void console_cursor_set_exit(bContext *UNUSED(C), wmOperator *op)
SetConsoleCursor *scu= op->customdata;
#if 0
- if(txt_has_sel(text)) {
+ if (txt_has_sel(text)) {
buffer = txt_sel_to_buf(text);
WM_clipboard_text_set(buffer, 1);
MEM_freeN(buffer);
@@ -964,13 +968,13 @@ static int console_modal_select_cancel(bContext *C, wmOperator *op)
void CONSOLE_OT_select_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Selection";
- ot->idname= "CONSOLE_OT_select_set";
- ot->description= "Set the console selection";
+ ot->name = "Set Selection";
+ ot->idname = "CONSOLE_OT_select_set";
+ ot->description = "Set the console selection";
/* api callbacks */
- ot->invoke= console_modal_select_invoke;
- ot->modal= console_modal_select;
- ot->cancel= console_modal_select_cancel;
- ot->poll= ED_operator_console_active;
+ ot->invoke = console_modal_select_invoke;
+ ot->modal = console_modal_select;
+ ot->cancel = console_modal_select_cancel;
+ ot->poll = ED_operator_console_active;
}
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index d781179249b..1867f93b1ef 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -101,10 +101,10 @@ static void console_free(SpaceLink *sl)
{
SpaceConsole *sc= (SpaceConsole*) sl;
- while(sc->scrollback.first)
+ while (sc->scrollback.first)
console_scrollback_free(sc, sc->scrollback.first);
- while(sc->history.first)
+ while (sc->history.first)
console_history_free(sc, sc->history.first);
}
@@ -141,14 +141,14 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* always keep the bottom part of the view aligned, less annoying */
- if(prev_y_min != ar->v2d.cur.ymin) {
+ if (prev_y_min != ar->v2d.cur.ymin) {
const float cur_y_range= ar->v2d.cur.ymax - ar->v2d.cur.ymin;
- ar->v2d.cur.ymin= prev_y_min;
- ar->v2d.cur.ymax= prev_y_min + cur_y_range;
+ ar->v2d.cur.ymin = prev_y_min;
+ ar->v2d.cur.ymax = prev_y_min + cur_y_range;
}
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Console", SPACE_CONSOLE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Console", SPACE_CONSOLE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
/* add drop boxes */
@@ -163,7 +163,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
// SpaceConsole *sc= CTX_wm_space_console(C);
- if(drag->type==WM_DRAG_ID)
+ if (drag->type==WM_DRAG_ID)
return 1;
return 0;
}
@@ -185,7 +185,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
// SpaceConsole *sc= CTX_wm_space_console(C);
- if(drag->type==WM_DRAG_PATH)
+ if (drag->type==WM_DRAG_PATH)
return 1;
return 0;
}
@@ -216,7 +216,7 @@ static void console_main_area_draw(const bContext *C, ARegion *ar)
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
- if(sc->scrollback.first==NULL)
+ if (sc->scrollback.first==NULL)
WM_operator_name_call((bContext *)C, "CONSOLE_OT_banner", WM_OP_EXEC_DEFAULT, NULL);
/* clear and setup matrix */
@@ -260,7 +260,7 @@ static void console_operatortypes(void)
static void console_keymap(struct wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Console", SPACE_CONSOLE, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Console", SPACE_CONSOLE, 0);
wmKeyMapItem *kmi;
#ifdef __APPLE__
@@ -293,9 +293,8 @@ static void console_keymap(struct wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", PREV_CHAR);
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", RIGHTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", NEXT_CHAR);
- kmi = WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", UPARROWKEY, KM_PRESS, 0, 0);
- RNA_boolean_set(kmi->ptr, "reverse", TRUE);
- WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", DOWNARROWKEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", UPARROWKEY, KM_PRESS, 0, 0)->ptr, "reverse", TRUE);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "reverse", FALSE);
#if 0
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", PREV_WORD);
@@ -358,7 +357,7 @@ static void console_main_area_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch(wmn->category) {
case NC_SPACE:
- if(wmn->data == ND_SPACE_CONSOLE) { /* generic redraw request */
+ if (wmn->data == ND_SPACE_CONSOLE) { /* generic redraw request */
ED_region_tag_redraw(ar);
}
break;
diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt
index 6d959d0b739..98e147413ff 100644
--- a/source/blender/editors/space_file/CMakeLists.txt
+++ b/source/blender/editors/space_file/CMakeLists.txt
@@ -78,4 +78,8 @@ if(WITH_IMAGE_HDR)
add_definitions(-DWITH_HDR)
endif()
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_space_file "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript
index ad96840f7b9..ad8bcba39d6 100644
--- a/source/blender/editors/space_file/SConscript
+++ b/source/blender/editors/space_file/SConscript
@@ -19,11 +19,14 @@ if env['WITH_BF_OPENEXR']:
if env['WITH_BF_TIFF']:
defs.append('WITH_TIFF')
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
-
+
env.BlenderLib ( 'bf_editors_space_file', sources, Split(incs), defs, libtype=['core'], priority=[115] )
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 462e7030805..4d764bff311 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -157,7 +157,8 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
if (available_w <= loadbutton + separator + input_minw
|| params->title[0] == 0) {
loadbutton = 0;
- } else {
+ }
+ else {
line1_w -= (loadbutton + separator);
line2_w = line1_w;
}
@@ -166,7 +167,8 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
fnumbuttons = 2 * btn_fn_w;
if (!loadbutton || line2_w <= fnumbuttons + separator + input_minw) {
fnumbuttons = 0;
- } else {
+ }
+ else {
line2_w -= (fnumbuttons + separator);
}
@@ -183,16 +185,17 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
uiButSetCompleteFunc(but, autocomplete_directory, NULL);
uiButSetFlag(but, UI_BUT_NO_UTF8);
- if((params->flag & FILE_DIRSEL_ONLY) == 0) {
+ if ((params->flag & FILE_DIRSEL_ONLY) == 0) {
but = uiDefBut(block, TEX, B_FS_FILENAME, "",
min_x, line2_y, line2_w-chan_offs, btn_h,
params->file, 0.0, (float)FILE_MAXFILE, 0, 0,
TIP_(overwrite_alert ?N_("File name, overwrite existing") : N_("File name")));
uiButSetCompleteFunc(but, autocomplete_file, NULL);
uiButSetFlag(but, UI_BUT_NO_UTF8);
+ uiButClearFlag(but, UI_BUT_UNDO); /* operator button above does this automatic */
/* check if this overrides a file and if the operator option is used */
- if(overwrite_alert) {
+ if (overwrite_alert) {
uiButSetFlag(but, UI_BUT_REDALERT);
}
}
@@ -219,7 +222,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
}
/* Execute / cancel buttons. */
- if(loadbutton) {
+ if (loadbutton) {
uiDefButO(block, BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, IFACE_(params->title),
max_x - loadbutton, line1_y, loadbutton, btn_h, TIP_(params->title));
@@ -246,7 +249,7 @@ static int get_file_icon(struct direntry *file)
if ( strcmp(file->relname, "..") == 0) {
return ICON_FILE_PARENT;
}
- if(file->flags & BLENDERFILE) {
+ if (file->flags & BLENDERFILE) {
return ICON_FILE_BLEND;
}
return ICON_FILE_FOLDER;
@@ -284,7 +287,7 @@ static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon,
/*if (icon == ICON_FILE_BLANK) alpha = 0.375f;*/
- but= uiDefIconBut(block, LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, 0.0f, 0.0f, "");
+ but = uiDefIconBut(block, LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, 0.0f, 0.0f, "");
uiButSetDragPath(but, path);
}
@@ -342,7 +345,8 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
scaledx = ( (float)imb->x/(float)imb->y )*layout->prv_h;
scale = scaledy/imb->y;
}
- } else {
+ }
+ else {
scaledx = (float)imb->x;
scaledy = (float)imb->y;
scale = 1.0;
@@ -375,7 +379,7 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
}
/* dragregion */
- but= uiDefBut(block, LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, "");
+ but = uiDefBut(block, LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, "");
uiButSetDragImage(but, file->path, get_file_icon(file), imb, scale);
glDisable(GL_BLEND);
@@ -395,7 +399,7 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename);
- if( strcmp(orgname, newname) != 0 ) {
+ if ( strcmp(orgname, newname) != 0 ) {
if (!BLI_exists(newname)) {
BLI_rename(orgname, newname);
/* to make sure we show what is on disk */
@@ -476,7 +480,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
/* adjust, so the next row is already drawn when scrolling */
if (layout->flag & FILE_LAYOUT_HOR) {
numfiles_layout += layout->rows;
- } else {
+ }
+ else {
numfiles_layout += layout->columns;
}
@@ -514,7 +519,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE));
- } else {
+ }
+ else {
file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE);
sx += ICON_DEFAULT_WIDTH_SCALE + 4;
}
@@ -526,6 +532,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,"");
uiButSetRenameFunc(but, renamebutton_cb, file);
uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
+ uiButClearFlag(but, UI_BUT_UNDO);
if ( 0 == uiButActiveOnly(C, block, but)) {
file->selflag &= ~EDITING_FILE;
}
@@ -542,7 +549,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);
sx += (int)layout->column_widths[COLUMN_SIZE] + 12;
}
- } else if (params->display == FILE_LONGDISPLAY) {
+ }
+ else if (params->display == FILE_LONGDISPLAY) {
sx += (int)layout->column_widths[COLUMN_NAME] + 12;
#ifndef WIN32
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index f663307507a..62b7aafb187 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -170,7 +170,7 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
{
params->active_file = selected_idx;
- if(S_ISDIR(file->type)) {
+ if (S_ISDIR(file->type)) {
/* the path is too long and we are not going up! */
if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) {
// XXX error("Path too long, cannot enter this directory");
@@ -240,12 +240,12 @@ static int file_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
result= WM_border_select_modal(C, op, event);
- if(result==OPERATOR_RUNNING_MODAL) {
+ if (result==OPERATOR_RUNNING_MODAL) {
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect);
@@ -257,7 +257,8 @@ static int file_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
}
params->sel_first = sel.first; params->sel_last = sel.last;
- }else {
+ }
+ else {
params->active_file = -1;
params->sel_first = params->sel_last = -1;
file_deselect_all(sfile, HILITED_FILE);
@@ -275,12 +276,12 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
int extend= RNA_boolean_get(op->ptr, "extend");
short select= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
- if(!extend) {
+ if (!extend) {
SpaceFile *sfile= CTX_wm_space_file(C);
file_deselect_all(sfile, SELECTED_FILE);
@@ -291,7 +292,8 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, 0);
if (FILE_SELECT_DIR == ret) {
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
- } else if (FILE_SELECT_FILE == ret) {
+ }
+ else if (FILE_SELECT_FILE == ret) {
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
}
return OPERATOR_FINISHED;
@@ -300,16 +302,16 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
void FILE_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Activate/Select File";
- ot->description= "Activate/select the file(s) contained in the border";
- ot->idname= "FILE_OT_select_border";
+ ot->name = "Activate/Select File";
+ ot->description = "Activate/select the file(s) contained in the border";
+ ot->idname = "FILE_OT_select_border";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= file_border_select_exec;
- ot->modal= file_border_select_modal;
- ot->poll= ED_operator_file_active;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = file_border_select_exec;
+ ot->modal = file_border_select_modal;
+ ot->poll = ED_operator_file_active;
+ ot->cancel = WM_border_select_cancel;
/* rna */
WM_operator_properties_gesture_border(ot, 1);
@@ -324,13 +326,13 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
int extend = RNA_boolean_get(op->ptr, "extend");
int fill = RNA_boolean_get(op->ptr, "fill");
- if(ar->regiontype != RGN_TYPE_WINDOW)
+ if (ar->regiontype != RGN_TYPE_WINDOW)
return OPERATOR_CANCELLED;
rect.xmin = rect.xmax = event->mval[0];
rect.ymin = rect.ymax = event->mval[1];
- if(!BLI_in_rcti(&ar->v2d.mask, rect.xmin, rect.ymin))
+ if (!BLI_in_rcti(&ar->v2d.mask, rect.xmin, rect.ymin))
return OPERATOR_CANCELLED;
/* single select, deselect all selected first */
@@ -351,13 +353,13 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
void FILE_OT_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Activate/Select File";
- ot->description= "Activate/select file";
- ot->idname= "FILE_OT_select";
+ ot->name = "Activate/Select File";
+ ot->description = "Activate/select file";
+ ot->idname = "FILE_OT_select";
/* api callbacks */
- ot->invoke= file_select_invoke;
- ot->poll= ED_operator_file_active;
+ ot->invoke = file_select_invoke;
+ ot->poll = ED_operator_file_active;
/* rna */
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
@@ -398,13 +400,13 @@ static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op))
void FILE_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select/Deselect All Files";
- ot->description= "Select/deselect all files";
- ot->idname= "FILE_OT_select_all_toggle";
+ ot->name = "(De)select All Files";
+ ot->description = "Select or deselect all files";
+ ot->idname = "FILE_OT_select_all_toggle";
/* api callbacks */
- ot->exec= file_select_all_exec;
- ot->poll= ED_operator_file_active;
+ ot->exec = file_select_all_exec;
+ ot->poll = ED_operator_file_active;
/* rna */
@@ -417,7 +419,7 @@ static int bookmark_select_exec(bContext *C, wmOperator *op)
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(RNA_struct_find_property(op->ptr, "dir")) {
+ if (RNA_struct_find_property(op->ptr, "dir")) {
char entry[256];
FileSelectParams* params = sfile->params;
@@ -435,13 +437,13 @@ static int bookmark_select_exec(bContext *C, wmOperator *op)
void FILE_OT_select_bookmark(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Directory";
- ot->description= "Select a bookmarked directory";
- ot->idname= "FILE_OT_select_bookmark";
+ ot->name = "Select Directory";
+ ot->description = "Select a bookmarked directory";
+ ot->idname = "FILE_OT_select_bookmark";
/* api callbacks */
- ot->exec= bookmark_select_exec;
- ot->poll= ED_operator_file_active;
+ ot->exec = bookmark_select_exec;
+ ot->poll = ED_operator_file_active;
RNA_def_string(ot->srna, "dir", "", 256, "Dir", "");
}
@@ -468,13 +470,13 @@ static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op))
void FILE_OT_bookmark_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Bookmark";
- ot->description= "Add a bookmark for the selected/active directory";
- ot->idname= "FILE_OT_bookmark_add";
+ ot->name = "Add Bookmark";
+ ot->description = "Add a bookmark for the selected/active directory";
+ ot->idname = "FILE_OT_bookmark_add";
/* api callbacks */
- ot->exec= bookmark_add_exec;
- ot->poll= ED_operator_file_active;
+ ot->exec = bookmark_add_exec;
+ ot->poll = ED_operator_file_active;
}
static int bookmark_delete_exec(bContext *C, wmOperator *op)
@@ -483,7 +485,7 @@ static int bookmark_delete_exec(bContext *C, wmOperator *op)
struct FSMenu* fsmenu = fsmenu_get();
int nentries = fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS);
- if(RNA_struct_find_property(op->ptr, "index")) {
+ if (RNA_struct_find_property(op->ptr, "index")) {
int index = RNA_int_get(op->ptr, "index");
if ( (index >-1) && (index < nentries)) {
char name[FILE_MAX];
@@ -501,13 +503,13 @@ static int bookmark_delete_exec(bContext *C, wmOperator *op)
void FILE_OT_delete_bookmark(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Bookmark";
- ot->description= "Delete selected bookmark";
- ot->idname= "FILE_OT_delete_bookmark";
+ ot->name = "Delete Bookmark";
+ ot->description = "Delete selected bookmark";
+ ot->idname = "FILE_OT_delete_bookmark";
/* api callbacks */
- ot->exec= bookmark_delete_exec;
- ot->poll= ED_operator_file_active;
+ ot->exec = bookmark_delete_exec;
+ ot->poll = ED_operator_file_active;
RNA_def_int(ot->srna, "index", -1, -1, 20000, "Index", "", -1, 20000);
}
@@ -518,7 +520,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
FileSelectParams* params;
int numfiles, origfile;
- if(sfile==NULL || sfile->files==NULL) return 0;
+ if (sfile==NULL || sfile->files==NULL) return 0;
numfiles = filelist_numfiles(sfile->files);
params = ED_fileselect_get_params(sfile);
@@ -528,7 +530,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
mx -= ar->winrct.xmin;
my -= ar->winrct.ymin;
- if(BLI_in_rcti(&ar->v2d.mask, mx, my)) {
+ if (BLI_in_rcti(&ar->v2d.mask, mx, my)) {
float fx, fy;
int active_file;
@@ -536,7 +538,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
active_file = ED_fileselect_layout_offset(sfile->layout, (int)(v2d->tot.xmin + fx), (int)(v2d->tot.ymax - fy));
- if((active_file >= 0) && (active_file < numfiles))
+ if ((active_file >= 0) && (active_file < numfiles))
params->active_file=active_file;
else
params->active_file= -1;
@@ -552,7 +554,7 @@ static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *e
ARegion *ar= CTX_wm_region(C);
SpaceFile *sfile= CTX_wm_space_file(C);
- if(!file_hilight_set(sfile, ar, event->x, event->y))
+ if (!file_hilight_set(sfile, ar, event->x, event->y))
return OPERATOR_CANCELLED;
ED_area_tag_redraw(CTX_wm_area(C));
@@ -563,13 +565,13 @@ static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *e
void FILE_OT_highlight(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Highlight File";
- ot->description= "Highlight selected file(s)";
- ot->idname= "FILE_OT_highlight";
+ ot->name = "Highlight File";
+ ot->description = "Highlight selected file(s)";
+ ot->idname = "FILE_OT_highlight";
/* api callbacks */
- ot->invoke= file_highlight_invoke;
- ot->poll= ED_operator_file_active;
+ ot->invoke = file_highlight_invoke;
+ ot->poll = ED_operator_file_active;
}
int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused))
@@ -597,32 +599,32 @@ static int file_operator_poll(bContext *C)
void FILE_OT_cancel(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Cancel File Load";
- ot->description= "Cancel loading of selected file";
- ot->idname= "FILE_OT_cancel";
+ ot->name = "Cancel File Load";
+ ot->description = "Cancel loading of selected file";
+ ot->idname = "FILE_OT_cancel";
/* api callbacks */
- ot->exec= file_cancel_exec;
- ot->poll= file_operator_poll;
+ ot->exec = file_cancel_exec;
+ ot->poll = file_operator_poll;
}
void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
{
BLI_join_dirfile(filepath, FILE_MAX, sfile->params->dir, sfile->params->file); /* XXX, not real length */
- if(RNA_struct_find_property(op->ptr, "relative_path")) {
- if(RNA_boolean_get(op->ptr, "relative_path")) {
+ if (RNA_struct_find_property(op->ptr, "relative_path")) {
+ if (RNA_boolean_get(op->ptr, "relative_path")) {
BLI_path_rel(filepath, G.main->name);
}
}
- if(RNA_struct_find_property(op->ptr, "filename")) {
+ if (RNA_struct_find_property(op->ptr, "filename")) {
RNA_string_set(op->ptr, "filename", sfile->params->file);
}
- if(RNA_struct_find_property(op->ptr, "directory")) {
+ if (RNA_struct_find_property(op->ptr, "directory")) {
RNA_string_set(op->ptr, "directory", sfile->params->dir);
}
- if(RNA_struct_find_property(op->ptr, "filepath")) {
+ if (RNA_struct_find_property(op->ptr, "filepath")) {
RNA_string_set(op->ptr, "filepath", filepath);
}
@@ -635,7 +637,7 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
PropertyRNA *prop_dirs= RNA_struct_find_property(op->ptr, "dirs");
int i, numfiles = filelist_numfiles(sfile->files);
- if(prop_files) {
+ if (prop_files) {
RNA_property_collection_clear(op->ptr, prop_files);
for (i=0; i<numfiles; i++) {
if (filelist_is_selected(sfile->files, i, CHECK_FILES)) {
@@ -646,7 +648,7 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
}
}
- if(prop_dirs) {
+ if (prop_dirs) {
RNA_property_collection_clear(op->ptr, prop_dirs);
for (i=0; i<numfiles; i++) {
if (filelist_is_selected(sfile->files, i, CHECK_DIRS)) {
@@ -666,16 +668,16 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op)
PropertyRNA *prop;
/* If neither of the above are set, split the filepath back */
- if((prop= RNA_struct_find_property(op->ptr, "filepath"))) {
+ if ((prop= RNA_struct_find_property(op->ptr, "filepath"))) {
char filepath[FILE_MAX];
RNA_property_string_get(op->ptr, prop, filepath);
BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file));
}
else {
- if((prop= RNA_struct_find_property(op->ptr, "filename"))) {
+ if ((prop= RNA_struct_find_property(op->ptr, "filename"))) {
RNA_property_string_get(op->ptr, prop, sfile->params->file);
}
- if((prop= RNA_struct_find_property(op->ptr, "directory"))) {
+ if ((prop= RNA_struct_find_property(op->ptr, "directory"))) {
RNA_property_string_get(op->ptr, prop, sfile->params->dir);
}
}
@@ -691,13 +693,13 @@ void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
SpaceFile *sfile= CTX_wm_space_file(C);
wmOperator *op= sfile->op;
- if(op) { /* fail on reload */
- if(op->type->check) {
+ if (op) { /* fail on reload */
+ if (op->type->check) {
char filepath[FILE_MAX];
file_sfile_to_operator(op, sfile, filepath);
/* redraw */
- if(op->type->check(C, op)) {
+ if (op->type->check(C, op)) {
file_operator_to_sfile(sfile, op);
/* redraw, else the changed settings wont get updated */
@@ -709,12 +711,12 @@ void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
int file_draw_check_exists(SpaceFile *sfile)
{
- if(sfile->op) { /* fails on reload */
- if(RNA_struct_find_property(sfile->op->ptr, "check_existing")) {
- if(RNA_boolean_get(sfile->op->ptr, "check_existing")) {
+ if (sfile->op) { /* fails on reload */
+ if (RNA_struct_find_property(sfile->op->ptr, "check_existing")) {
+ if (RNA_boolean_get(sfile->op->ptr, "check_existing")) {
char filepath[FILE_MAX];
BLI_join_dirfile(filepath, sizeof(filepath), sfile->params->dir, sfile->params->file);
- if(BLI_is_file(filepath)) {
+ if (BLI_is_file(filepath)) {
return TRUE;
}
}
@@ -730,7 +732,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
SpaceFile *sfile= CTX_wm_space_file(C);
char filepath[FILE_MAX];
- if(sfile->op) {
+ if (sfile->op) {
wmOperator *op= sfile->op;
/* when used as a macro, for doubleclick,
@@ -739,7 +741,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
int i, active=0;
for (i=0; i<filelist_numfiles(sfile->files); i++) {
- if(filelist_is_selected(sfile->files, i, CHECK_ALL)) {
+ if (filelist_is_selected(sfile->files, i, CHECK_ALL)) {
active=1;
break;
}
@@ -766,16 +768,20 @@ int file_exec(bContext *C, wmOperator *exec_op)
void FILE_OT_execute(struct wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
- ot->name= "Execute File Window";
- ot->description= "Execute selected file";
- ot->idname= "FILE_OT_execute";
+ ot->name = "Execute File Window";
+ ot->description = "Execute selected file";
+ ot->idname = "FILE_OT_execute";
/* api callbacks */
- ot->exec= file_exec;
- ot->poll= file_operator_poll;
+ ot->exec = file_exec;
+ ot->poll = file_operator_poll;
- RNA_def_boolean(ot->srna, "need_active", 0, "Need Active", "Only execute if there's an active selected file in the file list");
+ prop = RNA_def_boolean(ot->srna, "need_active", 0, "Need Active",
+ "Only execute if there's an active selected file in the file list");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
@@ -783,7 +789,7 @@ int file_parent_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile->params) {
+ if (sfile->params) {
if (BLI_has_parent(sfile->params->dir)) {
BLI_parent_dir(sfile->params->dir);
BLI_cleanup_dir(G.main->name, sfile->params->dir);
@@ -800,13 +806,13 @@ int file_parent_exec(bContext *C, wmOperator *UNUSED(unused))
void FILE_OT_parent(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Parent File";
- ot->description= "Move to parent directory";
- ot->idname= "FILE_OT_parent";
+ ot->name = "Parent File";
+ ot->description = "Move to parent directory";
+ ot->idname = "FILE_OT_parent";
/* api callbacks */
- ot->exec= file_parent_exec;
- ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+ ot->exec = file_parent_exec;
+ ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
}
@@ -825,20 +831,20 @@ static int file_refresh_exec(bContext *C, wmOperator *UNUSED(unused))
void FILE_OT_previous(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Previous Folder";
- ot->description= "Move to previous folder";
- ot->idname= "FILE_OT_previous";
+ ot->name = "Previous Folder";
+ ot->description = "Move to previous folder";
+ ot->idname = "FILE_OT_previous";
/* api callbacks */
- ot->exec= file_previous_exec;
- ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+ ot->exec = file_previous_exec;
+ ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
}
int file_previous_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile->params) {
+ if (sfile->params) {
if (!sfile->folders_next)
sfile->folders_next = folderlist_new();
@@ -856,19 +862,19 @@ int file_previous_exec(bContext *C, wmOperator *UNUSED(unused))
void FILE_OT_next(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Next Folder";
- ot->description= "Move to next folder";
- ot->idname= "FILE_OT_next";
+ ot->name = "Next Folder";
+ ot->description = "Move to next folder";
+ ot->idname = "FILE_OT_next";
/* api callbacks */
- ot->exec= file_next_exec;
- ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+ ot->exec = file_next_exec;
+ ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
}
int file_next_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile->params) {
+ if (sfile->params) {
if (!sfile->folders_next)
sfile->folders_next = folderlist_new();
@@ -898,7 +904,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
int i;
/* escape if not our timer */
- if(sfile->smoothscroll_timer==NULL || sfile->smoothscroll_timer!=event->customdata)
+ if (sfile->smoothscroll_timer==NULL || sfile->smoothscroll_timer!=event->customdata)
return OPERATOR_PASS_THROUGH;
numfiles = filelist_numfiles(sfile->files);
@@ -935,7 +941,8 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
if (sfile->layout->flag & FILE_LAYOUT_HOR) {
sfile->scroll_offset = (edit_idx/sfile->layout->rows)*sfile->layout->rows;
if (sfile->scroll_offset <= offset) sfile->scroll_offset -= sfile->layout->rows;
- } else {
+ }
+ else {
sfile->scroll_offset = (edit_idx/sfile->layout->columns)*sfile->layout->columns;
if (sfile->scroll_offset <= offset) sfile->scroll_offset -= sfile->layout->columns;
}
@@ -958,14 +965,17 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
if (sfile->scroll_offset < offset) {
if (sfile->layout->flag & FILE_LAYOUT_HOR) {
WM_operator_name_call(C, "VIEW2D_OT_scroll_left", 0, NULL);
- } else {
+ }
+ else {
WM_operator_name_call(C, "VIEW2D_OT_scroll_up", 0, NULL);
}
- } else {
+ }
+ else {
if (sfile->layout->flag & FILE_LAYOUT_HOR) {
WM_operator_name_call(C, "VIEW2D_OT_scroll_right", 0, NULL);
- } else {
+ }
+ else {
WM_operator_name_call(C, "VIEW2D_OT_scroll_down", 0, NULL);
}
}
@@ -983,14 +993,14 @@ void FILE_OT_smoothscroll(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Smooth Scroll";
- ot->idname= "FILE_OT_smoothscroll";
- ot->description="Smooth scroll to make editable file visible";
+ ot->name = "Smooth Scroll";
+ ot->idname = "FILE_OT_smoothscroll";
+ ot->description = "Smooth scroll to make editable file visible";
/* api callbacks */
- ot->invoke= file_smoothscroll_invoke;
+ ot->invoke = file_smoothscroll_invoke;
- ot->poll= ED_operator_file_active;
+ ot->poll = ED_operator_file_active;
}
@@ -1024,14 +1034,14 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
SpaceFile *sfile= CTX_wm_space_file(C);
- if(!sfile->params) {
+ if (!sfile->params) {
BKE_report(op->reports,RPT_WARNING, "No parent directory given");
return OPERATOR_CANCELLED;
}
path[0] = '\0';
- if(RNA_struct_find_property(op->ptr, "directory")) {
+ if (RNA_struct_find_property(op->ptr, "directory")) {
RNA_string_get(op->ptr, "directory", path);
if (path[0] != '\0') generate_name= 0;
}
@@ -1070,14 +1080,14 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
void FILE_OT_directory_new(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Create New Directory";
- ot->description= "Create a new directory";
- ot->idname= "FILE_OT_directory_new";
+ ot->name = "Create New Directory";
+ ot->description = "Create a new directory";
+ ot->idname = "FILE_OT_directory_new";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= file_directory_new_exec;
- ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+ ot->invoke = WM_operator_confirm;
+ ot->exec = file_directory_new_exec;
+ ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
RNA_def_string_dir_path(ot->srna, "directory", "", FILE_MAX, "Directory", "Name of new directory");
@@ -1088,7 +1098,7 @@ static void file_expand_directory(bContext *C)
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile->params) {
+ if (sfile->params) {
if ( sfile->params->dir[0] == '~' ) {
char tmpstr[sizeof(sfile->params->dir)-1];
BLI_strncpy(tmpstr, sfile->params->dir+1, sizeof(tmpstr));
@@ -1122,7 +1132,7 @@ static int file_directory_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile->params) {
+ if (sfile->params) {
file_expand_directory(C);
if (!BLI_exists(sfile->params->dir)) {
@@ -1141,7 +1151,7 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile->params) {
+ if (sfile->params) {
file_expand_directory(C);
if (!BLI_exists(sfile->params->dir)) {
@@ -1149,7 +1159,7 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
}
/* special case, user may have pasted a filepath into the directory */
- if(BLI_is_file(sfile->params->dir)) {
+ if (BLI_is_file(sfile->params->dir)) {
char path[sizeof(sfile->params->dir)];
BLI_strncpy(path, sfile->params->dir, sizeof(path));
BLI_split_dirfile(path, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file));
@@ -1192,33 +1202,33 @@ static int file_directory_poll(bContext *C)
void FILE_OT_directory(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Enter Directory Name";
- ot->description= "Enter a directory name";
- ot->idname= "FILE_OT_directory";
+ ot->name = "Enter Directory Name";
+ ot->description = "Enter a directory name";
+ ot->idname = "FILE_OT_directory";
/* api callbacks */
- ot->invoke= file_directory_invoke;
- ot->exec= file_directory_exec;
- ot->poll= file_directory_poll; /* <- important, handler is on window level */
+ ot->invoke = file_directory_invoke;
+ ot->exec = file_directory_exec;
+ ot->poll = file_directory_poll; /* <- important, handler is on window level */
}
void FILE_OT_refresh(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Refresh Filelist";
- ot->description= "Refresh the file list";
- ot->idname= "FILE_OT_refresh";
+ ot->name = "Refresh Filelist";
+ ot->description = "Refresh the file list";
+ ot->idname = "FILE_OT_refresh";
/* api callbacks */
- ot->exec= file_refresh_exec;
- ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+ ot->exec = file_refresh_exec;
+ ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
}
static int file_hidedot_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile->params) {
+ if (sfile->params) {
sfile->params->flag ^= FILE_HIDE_DOT;
ED_fileselect_clear(C, sfile);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
@@ -1231,30 +1241,30 @@ static int file_hidedot_exec(bContext *C, wmOperator *UNUSED(unused))
void FILE_OT_hidedot(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Hide Dot Files";
- ot->description= "Toggle hide hidden dot files";
- ot->idname= "FILE_OT_hidedot";
+ ot->name = "Toggle Hide Dot Files";
+ ot->description = "Toggle hide hidden dot files";
+ ot->idname = "FILE_OT_hidedot";
/* api callbacks */
- ot->exec= file_hidedot_exec;
- ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+ ot->exec = file_hidedot_exec;
+ ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
}
struct ARegion *file_buttons_region(struct ScrArea *sa)
{
ARegion *ar, *arnew;
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_CHANNELS)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
+ if (ar->regiontype==RGN_TYPE_CHANNELS)
return ar;
/* add subdiv level; after header */
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_HEADER)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
+ if (ar->regiontype==RGN_TYPE_HEADER)
break;
/* is error! */
- if(ar==NULL) return NULL;
+ if (ar==NULL) return NULL;
arnew= MEM_callocN(sizeof(ARegion), "buttons for file panels");
@@ -1272,7 +1282,7 @@ static int file_bookmark_toggle_exec(bContext *C, wmOperator *UNUSED(unused))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= file_buttons_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -1281,13 +1291,13 @@ static int file_bookmark_toggle_exec(bContext *C, wmOperator *UNUSED(unused))
void FILE_OT_bookmark_toggle(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Bookmarks";
- ot->description= "Toggle bookmarks display";
- ot->idname= "FILE_OT_bookmark_toggle";
+ ot->name = "Toggle Bookmarks";
+ ot->description = "Toggle bookmarks display";
+ ot->idname = "FILE_OT_bookmark_toggle";
/* api callbacks */
- ot->exec= file_bookmark_toggle_exec;
- ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+ ot->exec = file_bookmark_toggle_exec;
+ ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
}
@@ -1297,7 +1307,7 @@ static int file_filenum_exec(bContext *C, wmOperator *op)
ScrArea *sa= CTX_wm_area(C);
int inc = RNA_int_get(op->ptr, "increment");
- if(sfile->params && (inc != 0)) {
+ if (sfile->params && (inc != 0)) {
BLI_newname(sfile->params->file, inc);
ED_area_tag_redraw(sa);
file_draw_check_cb(C, NULL, NULL);
@@ -1311,13 +1321,13 @@ static int file_filenum_exec(bContext *C, wmOperator *op)
void FILE_OT_filenum(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Increment Number in Filename";
- ot->description= "Increment number in filename";
- ot->idname= "FILE_OT_filenum";
+ ot->name = "Increment Number in Filename";
+ ot->description = "Increment number in filename";
+ ot->idname = "FILE_OT_filenum";
/* api callbacks */
- ot->exec= file_filenum_exec;
- ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+ ot->exec = file_filenum_exec;
+ ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
/* props */
RNA_def_int(ot->srna, "increment", 1, -100, 100, "Increment", "", -100,100);
@@ -1328,7 +1338,7 @@ static int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
- if(sfile->params) {
+ if (sfile->params) {
int idx = sfile->params->active_file;
int numfiles = filelist_numfiles(sfile->files);
if ( (0<=idx) && (idx<numfiles) ) {
@@ -1352,7 +1362,8 @@ static int file_rename_poll(bContext *C)
if (sfile && sfile->params) {
if (sfile->params->active_file < 0) {
poll= 0;
- } else {
+ }
+ else {
char dir[FILE_MAX], group[FILE_MAX];
if (filelist_islibrary(sfile->files, dir, group)) poll= 0;
}
@@ -1365,13 +1376,13 @@ static int file_rename_poll(bContext *C)
void FILE_OT_rename(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Rename File or Directory";
- ot->description= "Rename file or file directory";
- ot->idname= "FILE_OT_rename";
+ ot->name = "Rename File or Directory";
+ ot->description = "Rename file or file directory";
+ ot->idname = "FILE_OT_rename";
/* api callbacks */
- ot->exec= file_rename_exec;
- ot->poll= file_rename_poll;
+ ot->exec = file_rename_exec;
+ ot->poll = file_rename_poll;
}
@@ -1384,7 +1395,8 @@ static int file_delete_poll(bContext *C)
if (sfile && sfile->params) {
if (sfile->params->active_file < 0) {
poll= 0;
- } else {
+ }
+ else {
char dir[FILE_MAX], group[FILE_MAX];
if (filelist_islibrary(sfile->files, dir, group)) poll= 0;
file = filelist_file(sfile->files, sfile->params->active_file);
@@ -1417,14 +1429,14 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op))
void FILE_OT_delete(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete File";
- ot->description= "Delete selected file";
- ot->idname= "FILE_OT_delete";
+ ot->name = "Delete File";
+ ot->description = "Delete selected file";
+ ot->idname = "FILE_OT_delete";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= file_delete_exec;
- ot->poll= file_delete_poll; /* <- important, handler is on window level */
+ ot->invoke = WM_operator_confirm;
+ ot->exec = file_delete_exec;
+ ot->poll = file_delete_poll; /* <- important, handler is on window level */
}
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index a7cb800e5a7..596721bff07 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -80,7 +80,7 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
*nr= -1;
/* hide if no entries */
- if(nentries == 0)
+ if (nentries == 0)
return;
/* layout */
@@ -100,8 +100,8 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
entry = fsmenu_get_entry(fsmenu, category, i);
/* set this list item as active if we have a match */
- if(sfile->params) {
- if(BLI_path_cmp(sfile->params->dir, entry) == 0) {
+ if (sfile->params) {
+ if (BLI_path_cmp(sfile->params->dir, entry) == 0) {
*nr= i;
}
}
@@ -112,16 +112,16 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
BLI_getlastdir(temp, dir, FILE_MAX);
BLI_del_slash(dir);
- if(dir[0] == 0)
+ if (dir[0] == 0)
BLI_strncpy(dir, entry, FILE_MAX);
/* create list item */
- but= uiDefIconTextButS(block, LISTROW, 0, icon, dir, 0,0,UI_UNIT_X*10,UI_UNIT_Y, nr, 0, i, 0, 0, entry);
+ but = uiDefIconTextButS(block, LISTROW, 0, icon, dir, 0,0,UI_UNIT_X*10,UI_UNIT_Y, nr, 0, i, 0, 0, entry);
uiButSetFunc(but, file_panel_cb, entry, NULL);
uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT);
/* create delete button */
- if(allow_delete && fsmenu_can_save(fsmenu, category, i)) {
+ if (allow_delete && fsmenu_can_save(fsmenu, category, i)) {
uiBlockSetEmboss(block, UI_EMBOSSN);
uiItemIntO(layout, "", ICON_X, "FILE_OT_delete_bookmark", "index", i);
uiBlockSetEmboss(block, UI_EMBOSS);
@@ -133,7 +133,7 @@ static void file_panel_system(const bContext *C, Panel *pa)
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile)
+ if (sfile)
file_panel_category(C, pa, FS_CATEGORY_SYSTEM, &sfile->systemnr, ICON_DISK_DRIVE, 0, 0);
}
@@ -142,7 +142,7 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa)
SpaceFile *sfile= CTX_wm_space_file(C);
uiLayout *row;
- if(sfile) {
+ if (sfile) {
row= uiLayoutRow(pa->layout, 0);
uiItemO(row, IFACE_("Add"), ICON_ZOOMIN, "file.bookmark_add");
uiItemL(row, NULL, ICON_NONE);
@@ -155,7 +155,7 @@ static void file_panel_recent(const bContext *C, Panel *pa)
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile) {
+ if (sfile) {
if ( !(U.uiflag & USER_HIDE_RECENT) ) {
file_panel_category(C, pa, FS_CATEGORY_RECENT, &sfile->recentnr, ICON_FILE_FOLDER, 0, 1);
}
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 8632abd3410..694664f1f62 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -158,24 +158,26 @@ static int compare_name(const void *a1, const void *a2)
/* type is equal to stat.st_mode */
- if (S_ISDIR(entry1->type)){
+ if (S_ISDIR(entry1->type)) {
if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
+ }
+ else {
if (S_ISDIR(entry2->type)) return (1);
}
- if (S_ISREG(entry1->type)){
+ if (S_ISREG(entry1->type)) {
if (S_ISREG(entry2->type)==0) return (-1);
- } else{
+ }
+ else {
if (S_ISREG(entry2->type)) return (1);
}
if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
/* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
- if( strcmp(entry2->relname, "..")==0 ) return (1);
+ if ( strcmp(entry1->relname, ".")==0 ) return (-1);
+ if ( strcmp(entry2->relname, ".")==0 ) return (1);
+ if ( strcmp(entry1->relname, "..")==0 ) return (-1);
+ if ( strcmp(entry2->relname, "..")==0 ) return (1);
return (BLI_natstrcmp(entry1->relname,entry2->relname));
}
@@ -186,24 +188,26 @@ static int compare_date(const void *a1, const void *a2)
/* type is equal to stat.st_mode */
- if (S_ISDIR(entry1->type)){
+ if (S_ISDIR(entry1->type)) {
if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
+ }
+ else {
if (S_ISDIR(entry2->type)) return (1);
}
- if (S_ISREG(entry1->type)){
+ if (S_ISREG(entry1->type)) {
if (S_ISREG(entry2->type)==0) return (-1);
- } else{
+ }
+ else {
if (S_ISREG(entry2->type)) return (1);
}
if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
/* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
- if( strcmp(entry2->relname, "..")==0 ) return (1);
+ if ( strcmp(entry1->relname, ".")==0 ) return (-1);
+ if ( strcmp(entry2->relname, ".")==0 ) return (1);
+ if ( strcmp(entry1->relname, "..")==0 ) return (-1);
+ if ( strcmp(entry2->relname, "..")==0 ) return (1);
if ( entry1->s.st_mtime < entry2->s.st_mtime) return 1;
if ( entry1->s.st_mtime > entry2->s.st_mtime) return -1;
@@ -217,24 +221,26 @@ static int compare_size(const void *a1, const void *a2)
/* type is equal to stat.st_mode */
- if (S_ISDIR(entry1->type)){
+ if (S_ISDIR(entry1->type)) {
if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
+ }
+ else {
if (S_ISDIR(entry2->type)) return (1);
}
- if (S_ISREG(entry1->type)){
+ if (S_ISREG(entry1->type)) {
if (S_ISREG(entry2->type)==0) return (-1);
- } else{
+ }
+ else {
if (S_ISREG(entry2->type)) return (1);
}
if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
/* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
- if( strcmp(entry2->relname, "..")==0 ) return (1);
+ if ( strcmp(entry1->relname, ".")==0 ) return (-1);
+ if ( strcmp(entry2->relname, ".")==0 ) return (1);
+ if ( strcmp(entry1->relname, "..")==0 ) return (-1);
+ if ( strcmp(entry2->relname, "..")==0 ) return (1);
if ( entry1->s.st_size < entry2->s.st_size) return 1;
if ( entry1->s.st_size > entry2->s.st_size) return -1;
@@ -256,24 +262,26 @@ static int compare_extension(const void *a1, const void *a2)
/* type is equal to stat.st_mode */
- if (S_ISDIR(entry1->type)){
+ if (S_ISDIR(entry1->type)) {
if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
+ }
+ else {
if (S_ISDIR(entry2->type)) return (1);
}
- if (S_ISREG(entry1->type)){
+ if (S_ISREG(entry1->type)) {
if (S_ISREG(entry2->type)==0) return (-1);
- } else{
+ }
+ else {
if (S_ISREG(entry2->type)) return (1);
}
if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
/* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
- if( strcmp(entry2->relname, "..")==0 ) return (1);
+ if ( strcmp(entry1->relname, ".")==0 ) return (-1);
+ if ( strcmp(entry2->relname, ".")==0 ) return (1);
+ if ( strcmp(entry1->relname, "..")==0 ) return (-1);
+ if ( strcmp(entry2->relname, "..")==0 ) return (1);
return (BLI_strcasecmp(sufix1, sufix2));
}
@@ -283,17 +291,20 @@ static int is_hidden_file(const char* filename, short hide_dot)
int is_hidden=0;
if (hide_dot) {
- if(filename[0]=='.' && filename[1]!='.' && filename[1]!=0) {
+ if (filename[0]=='.' && filename[1]!='.' && filename[1]!=0) {
is_hidden=1; /* ignore .file */
- } else if (((filename[0] == '.') && (filename[1] == 0) )) {
+ }
+ else if (((filename[0] == '.') && (filename[1] == 0) )) {
is_hidden=1; /* ignore . */
- } else {
+ }
+ else {
int len=strlen(filename);
- if( (len>0) && (filename[len-1]=='~') ) {
+ if ( (len>0) && (filename[len-1]=='~') ) {
is_hidden=1; /* ignore file~ */
}
}
- } else {
+ }
+ else {
if (((filename[0] == '.') && (filename[1] == 0) )) {
is_hidden=1; /* ignore . */
}
@@ -307,12 +318,14 @@ static int is_filtered_file(struct direntry* file, const char* UNUSED(dir), unsi
if (filter) {
if (file->flags & filter) {
is_filtered=1;
- } else if (file->type & S_IFDIR) {
+ }
+ else if (file->type & S_IFDIR) {
if (filter & FOLDERFILE) {
is_filtered = 1;
}
}
- } else {
+ }
+ else {
is_filtered = 1;
}
return is_filtered && !is_hidden_file(file->relname, hide_dot);
@@ -324,7 +337,8 @@ static int is_filtered_lib(struct direntry* file, const char* dir, unsigned int
char tdir[FILE_MAX], tgroup[GROUP_MAX];
if (BLO_is_a_library(dir, tdir, tgroup)) {
is_filtered = !is_hidden_file(file->relname, hide_dot);
- } else {
+ }
+ else {
is_filtered = is_filtered_file(file, dir, filter, hide_dot);
}
return is_filtered;
@@ -415,13 +429,13 @@ void folderlist_popdir(struct ListBase* folderlist, char *dir)
struct FolderList *folder;
folder = folderlist->last;
- if(folder){
+ if (folder) {
// remove the current directory
MEM_freeN(folder->foldername);
BLI_freelinkN(folderlist, folder);
folder = folderlist->last;
- if(folder){
+ if (folder) {
prev_dir = folder->foldername;
BLI_strncpy(dir, prev_dir, FILE_MAXDIR);
}
@@ -435,8 +449,8 @@ void folderlist_pushdir(ListBase* folderlist, const char *dir)
previous_folder = folderlist->last;
// check if already exists
- if(previous_folder && previous_folder->foldername){
- if(BLI_path_cmp(previous_folder->foldername, dir)==0){
+ if (previous_folder && previous_folder->foldername) {
+ if (BLI_path_cmp(previous_folder->foldername, dir)==0) {
return;
}
}
@@ -472,9 +486,9 @@ int folderlist_clear_next(struct SpaceFile *sfile)
/* not listbase itself */
void folderlist_free(ListBase* folderlist)
{
- if (folderlist){
+ if (folderlist) {
FolderList *folder;
- for(folder= folderlist->first; folder; folder= folder->next)
+ for (folder= folderlist->first; folder; folder= folder->next)
MEM_freeN(folder->foldername);
BLI_freelistN(folderlist);
}
@@ -489,7 +503,7 @@ ListBase *folderlist_duplicate(ListBase* folderlist)
BLI_duplicatelist(folderlistn, folderlist);
- for(folder= folderlistn->first; folder; folder= folder->next) {
+ for (folder= folderlistn->first; folder; folder= folder->next) {
folder->foldername= MEM_dupallocN(folder->foldername);
}
return folderlistn;
@@ -564,7 +578,7 @@ void filelist_free(struct FileList* filelist)
void filelist_freelib(struct FileList* filelist)
{
- if(filelist->libfiledata)
+ if (filelist->libfiledata)
BLO_blendhandle_close(filelist->libfiledata);
filelist->libfiledata= NULL;
}
@@ -626,28 +640,37 @@ struct ImBuf * filelist_geticon(struct FileList* filelist, int index)
if (file->type & S_IFDIR) {
if ( strcmp(filelist->filelist[fidx].relname, "..") == 0) {
ibuf = gSpecialFileImages[SPECIAL_IMG_PARENT];
- } else if ( strcmp(filelist->filelist[fidx].relname, ".") == 0) {
+ }
+ else if ( strcmp(filelist->filelist[fidx].relname, ".") == 0) {
ibuf = gSpecialFileImages[SPECIAL_IMG_REFRESH];
- } else {
+ }
+ else {
ibuf = gSpecialFileImages[SPECIAL_IMG_FOLDER];
}
- } else {
+ }
+ else {
ibuf = gSpecialFileImages[SPECIAL_IMG_UNKNOWNFILE];
}
if (file->flags & BLENDERFILE) {
ibuf = gSpecialFileImages[SPECIAL_IMG_BLENDFILE];
- } else if ( (file->flags & MOVIEFILE) || (file->flags & MOVIEFILE_ICON) ) {
+ }
+ else if ( (file->flags & MOVIEFILE) || (file->flags & MOVIEFILE_ICON) ) {
ibuf = gSpecialFileImages[SPECIAL_IMG_MOVIEFILE];
- } else if (file->flags & SOUNDFILE) {
+ }
+ else if (file->flags & SOUNDFILE) {
ibuf = gSpecialFileImages[SPECIAL_IMG_SOUNDFILE];
- } else if (file->flags & PYSCRIPTFILE) {
+ }
+ else if (file->flags & PYSCRIPTFILE) {
ibuf = gSpecialFileImages[SPECIAL_IMG_PYTHONFILE];
- } else if (file->flags & FTFONTFILE) {
+ }
+ else if (file->flags & FTFONTFILE) {
ibuf = gSpecialFileImages[SPECIAL_IMG_FONTFILE];
- } else if (file->flags & TEXTFILE) {
+ }
+ else if (file->flags & TEXTFILE) {
ibuf = gSpecialFileImages[SPECIAL_IMG_TEXTFILE];
- } else if (file->flags & IMAGEFILE) {
+ }
+ else if (file->flags & IMAGEFILE) {
ibuf = gSpecialFileImages[SPECIAL_IMG_LOADING];
}
@@ -677,7 +700,7 @@ int filelist_find(struct FileList* filelist, const char *filename)
for (i = 0; i < filelist->numfiles; ++i) {
- if ( strcmp(filelist->filelist[i].relname, filename) == 0) { /* not dealing with user input so dont need BLI_path_cmp */
+ if ( strcmp(filelist->filelist[i].relname, filename) == 0) { /* not dealing with user input so don't need BLI_path_cmp */
index = i;
break;
}
@@ -715,17 +738,17 @@ static int file_is_blend_backup(const char *str)
a= strlen(str);
b= 7;
- if(a==0 || b>=a);
+ if (a==0 || b>=a);
else {
char *loc;
- if(a > b+1)
+ if (a > b+1)
b++;
/* allow .blend1 .blend2 .blend32 */
loc= BLI_strcasestr(str+a-b, ".blend");
- if(loc)
+ if (loc)
retval= 1;
}
@@ -735,32 +758,41 @@ static int file_is_blend_backup(const char *str)
static int file_extension_type(const char *relname)
{
- if(BLO_has_bfile_extension(relname)) {
+ if (BLO_has_bfile_extension(relname)) {
return BLENDERFILE;
- } else if(file_is_blend_backup(relname)) {
+ }
+ else if (file_is_blend_backup(relname)) {
return BLENDERFILE_BACKUP;
- } else if(BLI_testextensie(relname, ".py")) {
+ }
+ else if (BLI_testextensie(relname, ".py")) {
return PYSCRIPTFILE;
- } else if(BLI_testextensie(relname, ".txt")
+ }
+ else if (BLI_testextensie(relname, ".txt")
|| BLI_testextensie(relname, ".glsl")
|| BLI_testextensie(relname, ".data")) {
return TEXTFILE;
- } else if( BLI_testextensie(relname, ".ttf")
+ }
+ else if ( BLI_testextensie(relname, ".ttf")
|| BLI_testextensie(relname, ".ttc")
|| BLI_testextensie(relname, ".pfb")
|| BLI_testextensie(relname, ".otf")
|| BLI_testextensie(relname, ".otc")) {
return FTFONTFILE;
- } else if(BLI_testextensie(relname, ".btx")) {
+ }
+ else if (BLI_testextensie(relname, ".btx")) {
return BTXFILE;
- } else if(BLI_testextensie(relname, ".dae")) {
+ }
+ else if (BLI_testextensie(relname, ".dae")) {
return COLLADAFILE;
- } else if(BLI_testextensie_array(relname, imb_ext_image)
+ }
+ else if (BLI_testextensie_array(relname, imb_ext_image)
|| (G.have_quicktime && BLI_testextensie_array(relname, imb_ext_image_qt))) {
return IMAGEFILE;
- } else if(BLI_testextensie_array(relname, imb_ext_movie)) {
+ }
+ else if (BLI_testextensie_array(relname, imb_ext_movie)) {
return MOVIEFILE;
- } else if(BLI_testextensie_array(relname, imb_ext_audio)) {
+ }
+ else if (BLI_testextensie_array(relname, imb_ext_audio)) {
return SOUNDFILE;
}
return 0;
@@ -797,7 +829,7 @@ static void filelist_setfiletypes(struct FileList* filelist)
file= filelist->filelist;
- for(num=0; num<filelist->numfiles; num++, file++) {
+ for (num=0; num<filelist->numfiles; num++, file++) {
file->type= file->s.st_mode; /* restore the mess below */
/* Don't check extensions for directories */
@@ -806,7 +838,7 @@ static void filelist_setfiletypes(struct FileList* filelist)
}
file->flags = file_extension_type(file->relname);
- if(filelist->filter_glob
+ if (filelist->filter_glob
&& BLI_testextensie_glob(file->relname, filelist->filter_glob)) {
file->flags= OPERATORFILE;
}
@@ -827,7 +859,7 @@ static void filelist_read_dir(struct FileList* filelist)
BLI_cleanup_dir(G.main->name, filelist->dir);
filelist->numfiles = BLI_dir_contents(filelist->dir, &(filelist->filelist));
- if(!chdir(wdir)) {} /* fix warning about not checking return value */
+ if (!chdir(wdir)) {} /* fix warning about not checking return value */
filelist_setfiletypes(filelist);
filelist_filter(filelist);
}
@@ -843,15 +875,15 @@ static void filelist_read_library(struct FileList* filelist)
if (!filelist) return;
BLI_cleanup_dir(G.main->name, filelist->dir);
filelist_from_library(filelist);
- if(!filelist->libfiledata) {
+ if (!filelist->libfiledata) {
int num;
struct direntry *file;
BLI_make_exist(filelist->dir);
filelist_read_dir(filelist);
file = filelist->filelist;
- for(num=0; num<filelist->numfiles; num++, file++) {
- if(BLO_has_bfile_extension(file->relname)) {
+ for (num=0; num<filelist->numfiles; num++, file++) {
+ if (BLO_has_bfile_extension(file->relname)) {
char name[FILE_MAX];
BLI_join_dirfile(name, sizeof(name), filelist->dir, file->relname);
@@ -994,7 +1026,7 @@ void filelist_from_library(struct FileList* filelist)
ok= filelist_islibrary(filelist, dir, group);
if (!ok) {
/* free */
- if(filelist->libfiledata) BLO_blendhandle_close(filelist->libfiledata);
+ if (filelist->libfiledata) BLO_blendhandle_close(filelist->libfiledata);
filelist->libfiledata= NULL;
return;
}
@@ -1005,7 +1037,7 @@ void filelist_from_library(struct FileList* filelist)
/* for the time being only read filedata when libfiledata==0 */
if (filelist->libfiledata == NULL) {
filelist->libfiledata= BLO_blendhandle_from_file(dir, NULL);
- if(filelist->libfiledata == NULL) return;
+ if (filelist->libfiledata == NULL) return;
}
idcode= groupname_to_code(group);
@@ -1019,7 +1051,8 @@ void filelist_from_library(struct FileList* filelist)
BLO_blendhandle_close(filelist->libfiledata);
filelist->libfiledata= BLO_blendhandle_from_file(dir, NULL);
- } else {
+ }
+ else {
previews= NULL;
nprevs= 0;
names= BLO_blendhandle_get_linkable_groups(filelist->libfiledata);
@@ -1039,15 +1072,16 @@ void filelist_from_library(struct FileList* filelist)
filelist->filelist[i + 1].relname= BLI_strdup(blockname);
if (idcode) {
filelist->filelist[i + 1].type |= S_IFREG;
- } else {
+ }
+ else {
filelist->filelist[i + 1].type |= S_IFDIR;
}
}
- if(previews && (nnames != nprevs)) {
+ if (previews && (nnames != nprevs)) {
printf("filelist_from_library: error, found %d items, %d previews\n", nnames, nprevs);
}
- else if(previews) {
+ else if (previews) {
for (i=0, l= previews; i<nnames; i++, l= l->next) {
PreviewImage *img= l->link;
@@ -1092,20 +1126,20 @@ void filelist_from_main(struct FileList *filelist)
// filelist->type = FILE_MAIN; // XXXXX TODO: add modes to filebrowser
- if(filelist->dir[0]=='/') filelist->dir[0]= 0;
+ if (filelist->dir[0]=='/') filelist->dir[0]= 0;
- if(filelist->dir[0]) {
+ if (filelist->dir[0]) {
idcode= groupname_to_code(filelist->dir);
- if(idcode==0) filelist->dir[0]= 0;
+ if (idcode==0) filelist->dir[0]= 0;
}
- if( filelist->dir[0]==0) {
+ if ( filelist->dir[0]==0) {
/* make directories */
filelist->numfiles= 25;
filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
- for(a=0; a<filelist->numfiles; a++) {
+ for (a=0; a<filelist->numfiles; a++) {
memset( &(filelist->filelist[a]), 0 , sizeof(struct direntry));
filelist->filelist[a].type |= S_IFDIR;
}
@@ -1142,11 +1176,11 @@ void filelist_from_main(struct FileList *filelist)
idcode= groupname_to_code(filelist->dir);
lb= which_libbase(G.main, idcode );
- if(lb == NULL) return;
+ if (lb == NULL) return;
id= lb->first;
filelist->numfiles= 0;
- while(id) {
+ while (id) {
if (!filelist->hide_dot || id->name[2] != '.') {
filelist->numfiles++;
}
@@ -1171,12 +1205,12 @@ void filelist_from_main(struct FileList *filelist)
id= lb->first;
totlib= totbl= 0;
- while(id) {
+ while (id) {
ok = 1;
- if(ok) {
+ if (ok) {
if (!filelist->hide_dot || id->name[2] != '.') {
memset( files, 0 , sizeof(struct direntry));
- if(id->lib==NULL)
+ if (id->lib==NULL)
files->relname= BLI_strdup(id->name+2);
else {
files->relname= MEM_mallocN(FILE_MAX+32, "filename for lib");
@@ -1184,28 +1218,28 @@ void filelist_from_main(struct FileList *filelist)
}
files->type |= S_IFREG;
#if 0 // XXXXX TODO show the selection status of the objects
- if(!filelist->has_func) { /* F4 DATA BROWSE */
- if(idcode==ID_OB) {
- if( ((Object *)id)->flag & SELECT) files->selflag |= SELECTED_FILE;
+ if (!filelist->has_func) { /* F4 DATA BROWSE */
+ if (idcode==ID_OB) {
+ if ( ((Object *)id)->flag & SELECT) files->selflag |= SELECTED_FILE;
}
- else if(idcode==ID_SCE) {
- if( ((Scene *)id)->r.scemode & R_BG_RENDER) files->selflag |= SELECTED_FILE;
+ else if (idcode==ID_SCE) {
+ if ( ((Scene *)id)->r.scemode & R_BG_RENDER) files->selflag |= SELECTED_FILE;
}
}
#endif
files->nr= totbl+1;
files->poin= id;
fake= id->flag & LIB_FAKEUSER;
- if(idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || idcode == ID_IM) {
+ if (idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || idcode == ID_IM) {
files->flags |= IMAGEFILE;
}
- if(id->lib && fake) BLI_snprintf(files->extra, sizeof(files->extra), "LF %d", id->us);
- else if(id->lib) BLI_snprintf(files->extra, sizeof(files->extra), "L %d", id->us);
- else if(fake) BLI_snprintf(files->extra, sizeof(files->extra), "F %d", id->us);
+ if (id->lib && fake) BLI_snprintf(files->extra, sizeof(files->extra), "LF %d", id->us);
+ else if (id->lib) BLI_snprintf(files->extra, sizeof(files->extra), "L %d", id->us);
+ else if (fake) BLI_snprintf(files->extra, sizeof(files->extra), "F %d", id->us);
else BLI_snprintf(files->extra, sizeof(files->extra), " %d", id->us);
- if(id->lib) {
- if(totlib==0) firstlib= files;
+ if (id->lib) {
+ if (totlib==0) firstlib= files;
totlib++;
}
@@ -1218,7 +1252,7 @@ void filelist_from_main(struct FileList *filelist)
}
/* only qsort of library blocks */
- if(totlib>1) {
+ if (totlib>1) {
qsort(firstlib, totlib, sizeof(struct direntry), compare_name);
}
}
@@ -1231,7 +1265,7 @@ static void thumbnail_joblist_free(ThumbnailJob *tj)
FileImage* limg = tj->loadimages.first;
/* free the images not yet copied to the filelist -> these will get freed with the filelist */
- for( ; limg; limg= limg->next) {
+ for ( ; limg; limg= limg->next) {
if ((limg->img) && (!limg->done)) {
IMB_freeImBuf(limg->img);
}
@@ -1250,9 +1284,11 @@ static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float
while ( (*stop==0) && (limg) ) {
if ( limg->flags & IMAGEFILE ) {
limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_IMAGE);
- } else if ( limg->flags & BLENDERFILE ) {
+ }
+ else if ( limg->flags & BLENDERFILE ) {
limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_BLEND);
- } else if ( limg->flags & MOVIEFILE ) {
+ }
+ else if ( limg->flags & MOVIEFILE ) {
limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_MOVIE);
if (!limg->img) {
/* remember that file can't be loaded via IMB_open_anim */
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index fa2874f4842..3ed3c0690a2 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -125,7 +125,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
BLI_strncpy(params->title, op->type->name, sizeof(params->title));
- if(RNA_struct_find_property(op->ptr, "filemode"))
+ if (RNA_struct_find_property(op->ptr, "filemode"))
params->type = RNA_int_get(op->ptr, "filemode");
else
params->type = FILE_SPECIAL;
@@ -152,12 +152,12 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
}
- if(params->dir[0]) {
+ if (params->dir[0]) {
BLI_cleanup_dir(G.main->name, params->dir);
BLI_path_abs(params->dir, G.main->name);
}
- if(is_directory==TRUE && is_filename==FALSE && is_filepath==FALSE && is_files==FALSE) {
+ if (is_directory==TRUE && is_filename==FALSE && is_filepath==FALSE && is_files==FALSE) {
params->flag |= FILE_DIRSEL_ONLY;
}
else {
@@ -165,27 +165,27 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
params->filter = 0;
- if(RNA_struct_find_property(op->ptr, "filter_blender"))
+ if (RNA_struct_find_property(op->ptr, "filter_blender"))
params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0;
- if(RNA_struct_find_property(op->ptr, "filter_image"))
+ if (RNA_struct_find_property(op->ptr, "filter_image"))
params->filter |= RNA_boolean_get(op->ptr, "filter_image") ? IMAGEFILE : 0;
- if(RNA_struct_find_property(op->ptr, "filter_movie"))
+ if (RNA_struct_find_property(op->ptr, "filter_movie"))
params->filter |= RNA_boolean_get(op->ptr, "filter_movie") ? MOVIEFILE : 0;
- if(RNA_struct_find_property(op->ptr, "filter_text"))
+ if (RNA_struct_find_property(op->ptr, "filter_text"))
params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
- if(RNA_struct_find_property(op->ptr, "filter_python"))
+ if (RNA_struct_find_property(op->ptr, "filter_python"))
params->filter |= RNA_boolean_get(op->ptr, "filter_python") ? PYSCRIPTFILE : 0;
- if(RNA_struct_find_property(op->ptr, "filter_font"))
+ if (RNA_struct_find_property(op->ptr, "filter_font"))
params->filter |= RNA_boolean_get(op->ptr, "filter_font") ? FTFONTFILE : 0;
- if(RNA_struct_find_property(op->ptr, "filter_sound"))
+ if (RNA_struct_find_property(op->ptr, "filter_sound"))
params->filter |= RNA_boolean_get(op->ptr, "filter_sound") ? SOUNDFILE : 0;
- if(RNA_struct_find_property(op->ptr, "filter_text"))
+ if (RNA_struct_find_property(op->ptr, "filter_text"))
params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
- if(RNA_struct_find_property(op->ptr, "filter_folder"))
+ if (RNA_struct_find_property(op->ptr, "filter_folder"))
params->filter |= RNA_boolean_get(op->ptr, "filter_folder") ? FOLDERFILE : 0;
- if(RNA_struct_find_property(op->ptr, "filter_btx"))
+ if (RNA_struct_find_property(op->ptr, "filter_btx"))
params->filter |= RNA_boolean_get(op->ptr, "filter_btx") ? BTXFILE : 0;
- if(RNA_struct_find_property(op->ptr, "filter_collada"))
+ if (RNA_struct_find_property(op->ptr, "filter_collada"))
params->filter |= RNA_boolean_get(op->ptr, "filter_collada") ? COLLADAFILE : 0;
if (RNA_struct_find_property(op->ptr, "filter_glob")) {
RNA_string_get(op->ptr, "filter_glob", params->filter_glob);
@@ -198,14 +198,16 @@ short ED_fileselect_set_params(SpaceFile *sfile)
if (params->filter != 0) {
if (U.uiflag & USER_FILTERFILEEXTS) {
params->flag |= FILE_FILTER;
- } else {
+ }
+ else {
params->flag &= ~FILE_FILTER;
}
}
if (U.uiflag & USER_HIDE_DOT) {
params->flag |= FILE_HIDE_DOT;
- } else {
+ }
+ else {
params->flag &= ~FILE_HIDE_DOT;
}
@@ -216,16 +218,17 @@ short ED_fileselect_set_params(SpaceFile *sfile)
params->flag |= RNA_boolean_get(op->ptr, "active_layer") ? FILE_ACTIVELAY : 0;
}
- if(RNA_struct_find_property(op->ptr, "display_type"))
+ if (RNA_struct_find_property(op->ptr, "display_type"))
params->display= RNA_enum_get(op->ptr, "display_type");
- if(params->display==FILE_DEFAULTDISPLAY) {
+ if (params->display==FILE_DEFAULTDISPLAY) {
if (U.uiflag & USER_SHOW_THUMBNAILS) {
- if(params->filter & (IMAGEFILE|MOVIEFILE))
+ if (params->filter & (IMAGEFILE|MOVIEFILE))
params->display= FILE_IMGDISPLAY;
else
params->display= FILE_SHORTDISPLAY;
- } else {
+ }
+ else {
params->display= FILE_SHORTDISPLAY;
}
}
@@ -276,7 +279,8 @@ int ED_fileselect_layout_numfiles(FileLayout* layout, struct ARegion *ar)
int width = (int)(ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*layout->tile_border_x);
numfiles = (int)((float)width / (float)layout->tile_w + 0.5f);
return numfiles*layout->rows;
- } else {
+ }
+ else {
int height = (int)(ar->v2d.cur.ymax - ar->v2d.cur.ymin - 2*layout->tile_border_y);
numfiles = (int)((float)height/(float)layout->tile_h + 0.5f);
return numfiles*layout->columns;
@@ -312,7 +316,8 @@ FileSelection ED_fileselect_layout_offset_rect(FileLayout* layout, const rcti* r
if ( (colmin > layout->columns-1) || (rowmin > layout->rows-1) ) {
sel.first = -1;
- } else {
+ }
+ else {
if (layout->flag & FILE_LAYOUT_HOR)
sel.first = layout->rows*colmin + rowmin;
else
@@ -320,7 +325,8 @@ FileSelection ED_fileselect_layout_offset_rect(FileLayout* layout, const rcti* r
}
if ( (colmax > layout->columns-1) || (rowmax > layout->rows-1) ) {
sel.last = -1;
- } else {
+ }
+ else {
if (layout->flag & FILE_LAYOUT_HOR)
sel.last = layout->rows*colmax + rowmax;
else
@@ -356,7 +362,8 @@ void ED_fileselect_layout_tilepos(FileLayout* layout, int tile, int *x, int *y)
if (layout->flag == FILE_LAYOUT_HOR) {
*x = layout->tile_border_x + (tile/layout->rows)*(layout->tile_w+2*layout->tile_border_x);
*y = layout->tile_border_y + (tile%layout->rows)*(layout->tile_h+2*layout->tile_border_y);
- } else {
+ }
+ else {
*x = layout->tile_border_x + ((tile)%layout->columns)*(layout->tile_w+2*layout->tile_border_x);
*y = layout->tile_border_y + ((tile)/layout->columns)*(layout->tile_h+2*layout->tile_border_y);
}
@@ -393,7 +400,8 @@ float file_shorten_string(char* string, float w, int front)
temp[slen+4] = '\0';
BLI_strncpy(string, temp, slen+4);
}
- } else {
+ }
+ else {
char *s = string;
while (sw>w) {
int slen = strlen(string);
@@ -482,7 +490,8 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
if (sfile->layout == NULL) {
sfile->layout = MEM_callocN(sizeof(struct FileLayout), "file_layout");
sfile->layout->dirty = TRUE;
- } else if (sfile->layout->dirty == FALSE) {
+ }
+ else if (sfile->layout->dirty == FALSE) {
return;
}
@@ -502,7 +511,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
layout->tile_h = layout->prv_h + 2*layout->prv_border_y + textheight;
layout->width= (int)(v2d->cur.xmax - v2d->cur.xmin - 2*layout->tile_border_x);
layout->columns= layout->width / (layout->tile_w + 2*layout->tile_border_x);
- if(layout->columns > 0)
+ if (layout->columns > 0)
layout->rows= numfiles/layout->columns + 1; // XXX dirty, modulo is zero
else {
layout->columns = 1;
@@ -510,7 +519,8 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
}
layout->height= sfile->layout->rows*(layout->tile_h+2*layout->tile_border_y) + layout->tile_border_y*2;
layout->flag = FILE_LAYOUT_VER;
- } else {
+ }
+ else {
layout->prv_w = 0;
layout->prv_h = 0;
layout->tile_border_x = 8;
@@ -527,7 +537,8 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
(int)layout->column_widths[COLUMN_NAME] + 12 +
(int)layout->column_widths[COLUMN_SIZE] + 12;
- } else {
+ }
+ else {
maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
(int)layout->column_widths[COLUMN_NAME] + 12 +
#ifndef WIN32
@@ -542,7 +553,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
}
layout->tile_w = maxlen;
- if(layout->rows > 0)
+ if (layout->rows > 0)
layout->columns = numfiles/layout->rows + 1; // XXX dirty, modulo is zero
else {
layout->rows = 1;
@@ -570,13 +581,13 @@ void file_change_dir(bContext *C, int checkdir)
ED_fileselect_clear(C, sfile);
- if(checkdir && BLI_is_dir(sfile->params->dir)==0) {
+ if (checkdir && BLI_is_dir(sfile->params->dir)==0) {
BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
/* could return but just refresh the current dir */
}
filelist_setdir(sfile->files, sfile->params->dir);
- if(folderlist_clear_next(sfile))
+ if (folderlist_clear_next(sfile))
folderlist_free(sfile->folders_next);
folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
@@ -608,7 +619,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
SpaceFile *sfile= CTX_wm_space_file(C);
/* search if str matches the beginning of name */
- if(str[0] && sfile->files) {
+ if (str[0] && sfile->files) {
char dirname[FILE_MAX];
DIR *dir;
@@ -618,7 +629,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
dir = opendir(dirname);
- if(dir) {
+ if (dir) {
AutoComplete *autocpl= autocomplete_begin(str, FILE_MAX);
while ((de = readdir(dir)) != NULL) {
@@ -643,7 +654,8 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
autocomplete_end(autocpl, str);
if (BLI_exists(str)) {
BLI_add_slash(str);
- } else {
+ }
+ else {
BLI_strncpy(sfile->params->dir, str, sizeof(sfile->params->dir));
}
}
@@ -655,12 +667,12 @@ void autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v))
SpaceFile *sfile= CTX_wm_space_file(C);
/* search if str matches the beginning of name */
- if(str[0] && sfile->files) {
+ if (str[0] && sfile->files) {
AutoComplete *autocpl= autocomplete_begin(str, FILE_MAX);
int nentries = filelist_numfiles(sfile->files);
int i;
- for(i= 0; i<nentries; ++i) {
+ for (i= 0; i<nentries; ++i) {
struct direntry* file = filelist_file(sfile->files, i);
if (file && S_ISREG(file->type)) {
autocomplete_do_name(autocpl, file->relname);
@@ -685,8 +697,8 @@ void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile)
void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile)
{
- if(!sfile) return;
- if(sfile->op) {
+ if (!sfile) return;
+ if (sfile->op) {
WM_event_fileselect_event(C, sfile->op, EVT_FILESELECT_EXTERNAL_CANCEL);
sfile->op = NULL;
}
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 4c9d2be791b..ddd4b31d145 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -177,7 +177,8 @@ void fsmenu_insert_entry(struct FSMenu* fsmenu, FSMenuCategory category, const c
else if (sorted && cmp_ret < 0) {
break;
}
- } else {
+ }
+ else {
// if we're bookmarking this, file should come
// before the last separator, only automatically added
// current dir go after the last sep.
@@ -194,7 +195,8 @@ void fsmenu_insert_entry(struct FSMenu* fsmenu, FSMenuCategory category, const c
if (prev) {
fsme->next= prev->next;
prev->next= fsme;
- } else {
+ }
+ else {
fsme->next= fsms;
fsmenu_set_category(fsmenu, category, fsme);
}
@@ -217,7 +219,8 @@ void fsmenu_remove_entry(struct FSMenu* fsmenu, FSMenuCategory category, int idx
/* remove fsme from list */
if (prev) {
prev->next= fsme->next;
- } else {
+ }
+ else {
fsms= fsme->next;
fsmenu_set_category(fsmenu, category, fsms);
}
@@ -233,7 +236,7 @@ void fsmenu_write_file(struct FSMenu* fsmenu, const char *filename)
FSMenuEntry *fsme= NULL;
int nskip= 0;
- FILE *fp = fopen(filename, "w");
+ FILE *fp = BLI_fopen(filename, "w");
if (!fp) return;
fprintf(fp, "[Bookmarks]\n");
@@ -262,16 +265,18 @@ void fsmenu_read_bookmarks(struct FSMenu* fsmenu, const char *filename)
FSMenuCategory category = FS_CATEGORY_BOOKMARKS;
FILE *fp;
- fp = fopen(filename, "r");
+ fp = BLI_fopen(filename, "r");
if (!fp) return;
while ( fgets ( line, 256, fp ) != NULL ) /* read a line */
{
- if (strncmp(line, "[Bookmarks]", 11)==0){
+ if (strncmp(line, "[Bookmarks]", 11)==0) {
category = FS_CATEGORY_BOOKMARKS;
- } else if (strncmp(line, "[Recent]", 8)==0){
+ }
+ else if (strncmp(line, "[Recent]", 8)==0) {
category = FS_CATEGORY_RECENT;
- } else {
+ }
+ else {
int len = strlen(line);
if (len>0) {
if (line[len-1] == '\n') {
@@ -344,7 +349,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
* assume they are the standard ones
* TODO : replace hardcoded paths with proper BLI_get_folder calls */
home = getenv("HOME");
- if(home) {
+ if (home) {
BLI_snprintf(line, 256, "%s/", home);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
BLI_snprintf(line, 256, "%s/Desktop/", home);
@@ -465,7 +470,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
{
const char *home= getenv("HOME");
- if(home) {
+ if (home) {
BLI_snprintf(line, FILE_MAXDIR, "%s/", home);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
BLI_snprintf(line, FILE_MAXDIR, "%s/Desktop/", home);
@@ -489,11 +494,11 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
else {
while ((mnt = getmntent (fp))) {
/* not sure if this is right, but seems to give the relevant mnts */
- if(strncmp(mnt->mnt_fsname, "/dev", 4))
+ if (strncmp(mnt->mnt_fsname, "/dev", 4))
continue;
len= strlen(mnt->mnt_dir);
- if(len && mnt->mnt_dir[len-1] != '/') {
+ if (len && mnt->mnt_dir[len-1] != '/') {
BLI_snprintf(line, FILE_MAXDIR, "%s/", mnt->mnt_dir);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, line, 1, 0);
}
@@ -509,7 +514,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
#endif
/* fallback */
- if(!found)
+ if (!found)
fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, "/", 1, 0);
}
}
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 9eafd4533d2..0cf15c22efa 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -113,7 +113,7 @@ static void file_free(SpaceLink *sl)
{
SpaceFile *sfile= (SpaceFile *) sl;
- if(sfile->files) {
+ if (sfile->files) {
// XXXXX would need to do thumbnails_stop here, but no context available
filelist_freelib(sfile->files);
filelist_free(sfile->files);
@@ -121,13 +121,13 @@ static void file_free(SpaceLink *sl)
sfile->files= NULL;
}
- if(sfile->folders_prev) {
+ if (sfile->folders_prev) {
folderlist_free(sfile->folders_prev);
MEM_freeN(sfile->folders_prev);
sfile->folders_prev= NULL;
}
- if(sfile->folders_next) {
+ if (sfile->folders_next) {
folderlist_free(sfile->folders_next);
MEM_freeN(sfile->folders_next);
sfile->folders_next= NULL;
@@ -151,7 +151,7 @@ static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
//printf("file_init\n");
- if(sfile->layout) sfile->layout->dirty= TRUE;
+ if (sfile->layout) sfile->layout->dirty= TRUE;
}
@@ -169,10 +169,10 @@ static SpaceLink *file_duplicate(SpaceLink *sl)
filelist_setdir(sfilen->files, sfilen->params->dir);
}
- if(sfileo->folders_prev)
+ if (sfileo->folders_prev)
sfilen->folders_prev = folderlist_duplicate(sfileo->folders_prev);
- if(sfileo->folders_next)
+ if (sfileo->folders_next)
sfilen->folders_next = folderlist_duplicate(sfileo->folders_next);
if (sfileo->layout) {
@@ -200,26 +200,29 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
if (filelist_empty(sfile->files)) {
thumbnails_stop(sfile->files, C);
filelist_readdir(sfile->files);
- if(params->sort!=FILE_SORT_NONE) {
+ if (params->sort!=FILE_SORT_NONE) {
filelist_sort(sfile->files, params->sort);
}
BLI_strncpy(params->dir, filelist_dir(sfile->files), FILE_MAX);
- if(params->display == FILE_IMGDISPLAY) {
+ if (params->display == FILE_IMGDISPLAY) {
thumbnails_start(sfile->files, C);
}
- } else {
- if(params->sort!=FILE_SORT_NONE) {
+ }
+ else {
+ if (params->sort!=FILE_SORT_NONE) {
thumbnails_stop(sfile->files, C);
filelist_sort(sfile->files, params->sort);
- if(params->display == FILE_IMGDISPLAY) {
+ if (params->display == FILE_IMGDISPLAY) {
thumbnails_start(sfile->files, C);
}
- } else {
- if(params->display == FILE_IMGDISPLAY) {
+ }
+ else {
+ if (params->display == FILE_IMGDISPLAY) {
if (!thumbnails_running(sfile->files,C)) {
thumbnails_start(sfile->files, C);
}
- } else {
+ }
+ else {
/* stop any running thumbnail jobs if we're not
* displaying them - speedup for NFS */
thumbnails_stop(sfile->files, C);
@@ -272,10 +275,10 @@ static void file_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymaps */
- keymap= WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap= WM_keymap_find(wm->defaultconf, "File Browser Main", SPACE_FILE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "File Browser Main", SPACE_FILE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
@@ -333,9 +336,9 @@ static void file_main_area_draw(const bContext *C, ARegion *ar)
/* XXX this happens on scaling down Screen (like from startup.blend) */
/* view2d has no type specific for filewindow case, which doesnt scroll vertically */
- if(v2d->cur.ymax < 0) {
+ if (v2d->cur.ymax < 0) {
v2d->cur.ymin -= v2d->cur.ymax;
- v2d->cur.ymax= 0;
+ v2d->cur.ymax = 0;
}
}
/* v2d has initialized flag, so this call will only set the mask correct */
@@ -395,7 +398,7 @@ static void file_keymap(struct wmKeyConfig *keyconf)
{
wmKeyMapItem *kmi;
/* keys for all areas */
- wmKeyMap *keymap= WM_keymap_find(keyconf, "File Browser", SPACE_FILE, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "File Browser", SPACE_FILE, 0);
WM_keymap_add_item(keymap, "FILE_OT_bookmark_toggle", NKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "FILE_OT_parent", PKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "FILE_OT_bookmark_add", BKEY, KM_PRESS, KM_CTRL, 0);
@@ -408,8 +411,8 @@ static void file_keymap(struct wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "FILE_OT_smoothscroll", TIMER1, KM_ANY, KM_ANY, 0);
/* keys for main area */
- keymap= WM_keymap_find(keyconf, "File Browser Main", SPACE_FILE, 0);
- kmi= WM_keymap_add_item(keymap, "FILE_OT_execute", LEFTMOUSE, KM_DBL_CLICK, 0, 0);
+ keymap = WM_keymap_find(keyconf, "File Browser Main", SPACE_FILE, 0);
+ kmi = WM_keymap_add_item(keymap, "FILE_OT_execute", LEFTMOUSE, KM_DBL_CLICK, 0, 0);
RNA_boolean_set(kmi->ptr, "need_active", TRUE);
WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_CLICK, 0, 0);
kmi = WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_CLICK, KM_SHIFT, 0);
@@ -438,7 +441,7 @@ static void file_keymap(struct wmKeyConfig *keyconf)
/* keys for button area (top) */
- keymap= WM_keymap_find(keyconf, "File Browser Buttons", SPACE_FILE, 0);
+ keymap = WM_keymap_find(keyconf, "File Browser Buttons", SPACE_FILE, 0);
kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, 0, 0);
RNA_int_set(kmi->ptr, "increment", 1);
kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, KM_SHIFT, 0);
@@ -461,7 +464,7 @@ static void file_channel_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
/* own keymaps */
- keymap= WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -485,7 +488,7 @@ static void file_header_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_header_init(ar);
- keymap= WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -502,10 +505,10 @@ static void file_ui_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap= WM_keymap_find(wm->defaultconf, "File Browser Buttons", SPACE_FILE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "File Browser Buttons", SPACE_FILE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -518,8 +521,8 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
/* scrolling here is just annoying, disable it */
- ar->v2d.cur.ymax= ar->v2d.cur.ymax - ar->v2d.cur.ymin;
- ar->v2d.cur.ymin= 0;
+ ar->v2d.cur.ymax = ar->v2d.cur.ymax - ar->v2d.cur.ymin;
+ ar->v2d.cur.ymin = 0;
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(&ar->v2d);
diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt
index 50ab985d1e0..5b39604809c 100644
--- a/source/blender/editors/space_graph/CMakeLists.txt
+++ b/source/blender/editors/space_graph/CMakeLists.txt
@@ -53,4 +53,8 @@ if(WITH_AUDASPACE)
add_definitions(-DWITH_AUDASPACE)
endif()
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_graph/SConscript b/source/blender/editors/space_graph/SConscript
index fe8846d2c30..83239a5480a 100644
--- a/source/blender/editors/space_graph/SConscript
+++ b/source/blender/editors/space_graph/SConscript
@@ -7,4 +7,9 @@ incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' #/intern/audaspace/intern ../../blenloader'
-env.BlenderLib ( 'bf_editors_space_graph', sources, Split(incs), [], libtype=['core'], priority=[50] )
+defs = []
+
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_space_graph', sources, Split(incs), defs, libtype=['core'], priority=[50] )
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 642d43f2e71..4d2fe2cd568 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -108,12 +108,12 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **
/* try to find 'active' F-Curve */
elem= get_active_fcurve_channel(&ac);
- if(elem == NULL)
+ if (elem == NULL)
return 0;
- if(fcu)
+ if (fcu)
*fcu= (FCurve*)elem->data;
- if(ale)
+ if (ale)
*ale= elem;
else
MEM_freeN(elem);
@@ -452,7 +452,7 @@ static int graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceIpo *sipo= CTX_wm_space_graph(C);
- if(sipo->mode != SIPO_MODE_DRIVERS)
+ if (sipo->mode != SIPO_MODE_DRIVERS)
return 0;
return graph_panel_context(C, NULL, NULL);
@@ -614,11 +614,11 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
/* general actions - management */
col= uiLayoutColumn(pa->layout, 0);
block= uiLayoutGetBlock(col);
- but= uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Update Dependencies"), 0, 0, 10*UI_UNIT_X, 22,
+ but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Update Dependencies"), 0, 0, 10*UI_UNIT_X, 22,
NULL, 0.0, 0.0, 0, 0, TIP_("Force updates of dependencies"));
uiButSetFunc(but, driver_update_flags_cb, fcu, NULL);
- but= uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Remove Driver"), 0, 0, 10*UI_UNIT_X, 18,
+ but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Remove Driver"), 0, 0, 10*UI_UNIT_X, 18,
NULL, 0.0, 0.0, 0, 0, TIP_("Remove this driver"));
uiButSetNFunc(but, driver_remove_cb, MEM_dupallocN(ale), NULL);
@@ -662,7 +662,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
/* add driver variables */
col= uiLayoutColumn(pa->layout, 0);
block= uiLayoutGetBlock(col);
- but= uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Add Variable"), 0, 0, 10*UI_UNIT_X, UI_UNIT_Y,
+ but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Add Variable"), 0, 0, 10*UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0, 0, TIP_("Add a new target variable for this Driver"));
uiButSetFunc(but, driver_add_var_cb, driver, NULL);
@@ -686,7 +686,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
/* remove button */
uiBlockSetEmboss(block, UI_EMBOSSN);
- but= uiDefIconBut(block, BUT, B_IPO_DEPCHANGE, ICON_X, 290, 0, UI_UNIT_X, UI_UNIT_Y,
+ but = uiDefIconBut(block, BUT, B_IPO_DEPCHANGE, ICON_X, 290, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, IFACE_("Delete target variable"));
uiButSetFunc(but, driver_delete_var_cb, driver, dvar);
uiBlockSetEmboss(block, UI_EMBOSS);
@@ -831,7 +831,7 @@ static int graph_properties(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= graph_has_buttons_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -839,13 +839,13 @@ static int graph_properties(bContext *C, wmOperator *UNUSED(op))
void GRAPH_OT_properties(wmOperatorType *ot)
{
- ot->name= "Properties";
- ot->idname= "GRAPH_OT_properties";
- ot->description= "Toggle display properties panel";
+ ot->name = "Properties";
+ ot->idname = "GRAPH_OT_properties";
+ ot->description = "Toggle display properties panel";
- ot->exec= graph_properties;
- ot->poll= ED_operator_graphedit_active;
+ ot->exec = graph_properties;
+ ot->poll = ED_operator_graphedit_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 8af16bd1aec..279e6ce0400 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -48,6 +48,7 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
+#include "DNA_userdef_types.h"
#include "BKE_context.h"
#include "BKE_curve.h"
@@ -72,7 +73,7 @@
* drawing components for some F-Curve (fcu)
* - selected F-Curves should be more visible than partially visible ones
*/
-#define drawFCurveFade(fcu) ( ((fcu)->flag & FCURVE_SELECTED)? 1.0f : 0.25f )
+#define drawFCurveFade(fcu) ( ((fcu)->flag & FCURVE_SELECTED)? 1.0f : U.fcu_inactive_alpha )
/* set the color for some point from some value given packed into an int
* - intV: integer value containing color info packed into an int
@@ -498,7 +499,7 @@ static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2
/* when opening a blend file on a different sized screen or while dragging the toolbar this can happen
* best just bail out in this case */
UI_view2d_grid_size(grid, &dx, &dy);
- if(dx <= 0.0f)
+ if (dx <= 0.0f)
return;
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 9a965c3a109..c0cd2a882c8 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -184,16 +184,16 @@ static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
void GRAPH_OT_previewrange_set (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Auto-Set Preview Range";
- ot->idname= "GRAPH_OT_previewrange_set";
- ot->description= "Automatically set Preview Range based on range of keyframes";
+ ot->name = "Auto-Set Preview Range";
+ ot->idname = "GRAPH_OT_previewrange_set";
+ ot->description = "Automatically set Preview Range based on range of keyframes";
/* api callbacks */
- ot->exec= graphkeys_previewrange_exec;
- ot->poll= ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
+ ot->exec = graphkeys_previewrange_exec;
+ ot->poll = ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ****************** View-All Operator ****************** */
@@ -246,31 +246,31 @@ static int graphkeys_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
void GRAPH_OT_view_all (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View All";
- ot->idname= "GRAPH_OT_view_all";
- ot->description= "Reset viewable area to show full keyframe range";
+ ot->name = "View All";
+ ot->idname = "GRAPH_OT_view_all";
+ ot->description = "Reset viewable area to show full keyframe range";
/* api callbacks */
- ot->exec= graphkeys_viewall_exec;
- ot->poll= ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
+ ot->exec = graphkeys_viewall_exec;
+ ot->poll = ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
void GRAPH_OT_view_selected (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Selected";
- ot->idname= "GRAPH_OT_view_selected";
- ot->description= "Reset viewable area to show selected keyframe range";
+ ot->name = "View Selected";
+ ot->idname = "GRAPH_OT_view_selected";
+ ot->description = "Reset viewable area to show selected keyframe range";
/* api callbacks */
- ot->exec= graphkeys_view_selected_exec;
- ot->poll= ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
+ ot->exec = graphkeys_view_selected_exec;
+ ot->poll = ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Create Ghost-Curves Operator *********************** */
@@ -376,16 +376,16 @@ static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)
void GRAPH_OT_ghost_curves_create (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Create Ghost Curves";
- ot->idname= "GRAPH_OT_ghost_curves_create";
- ot->description= "Create snapshot (Ghosts) of selected F-Curves as background aid for active Graph Editor";
+ ot->name = "Create Ghost Curves";
+ ot->idname = "GRAPH_OT_ghost_curves_create";
+ ot->description = "Create snapshot (Ghosts) of selected F-Curves as background aid for active Graph Editor";
/* api callbacks */
- ot->exec= graphkeys_create_ghostcurves_exec;
- ot->poll= graphop_visible_keyframes_poll;
+ ot->exec = graphkeys_create_ghostcurves_exec;
+ ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
// todo: add props for start/end frames
}
@@ -419,16 +419,16 @@ static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
void GRAPH_OT_ghost_curves_clear (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Ghost Curves";
- ot->idname= "GRAPH_OT_ghost_curves_clear";
- ot->description= "Clear F-Curve snapshots (Ghosts) for active Graph Editor";
+ ot->name = "Clear Ghost Curves";
+ ot->idname = "GRAPH_OT_ghost_curves_clear";
+ ot->description = "Clear F-Curve snapshots (Ghosts) for active Graph Editor";
/* api callbacks */
- ot->exec= graphkeys_clear_ghostcurves_exec;
- ot->poll= ED_operator_graphedit_active;
+ ot->exec = graphkeys_clear_ghostcurves_exec;
+ ot->poll = ED_operator_graphedit_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************************************************************** */
@@ -514,20 +514,20 @@ static int graphkeys_insertkey_exec(bContext *C, wmOperator *op)
void GRAPH_OT_keyframe_insert (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Insert Keyframes";
- ot->idname= "GRAPH_OT_keyframe_insert";
- ot->description= "Insert keyframes for the specified channels";
+ ot->name = "Insert Keyframes";
+ ot->idname = "GRAPH_OT_keyframe_insert";
+ ot->description = "Insert keyframes for the specified channels";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= graphkeys_insertkey_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = graphkeys_insertkey_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_graphkeys_insertkey_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_insertkey_types, 0, "Type", "");
}
/* ******************** Click-Insert Keyframes Operator ************************* */
@@ -621,17 +621,17 @@ static int graphkeys_click_insert_invoke (bContext *C, wmOperator *op, wmEvent *
void GRAPH_OT_click_insert (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Click-Insert Keyframes";
- ot->idname= "GRAPH_OT_click_insert";
- ot->description= "Insert new keyframe at the cursor position for the active F-Curve";
+ ot->name = "Click-Insert Keyframes";
+ ot->idname = "GRAPH_OT_click_insert";
+ ot->description = "Insert new keyframe at the cursor position for the active F-Curve";
/* api callbacks */
- ot->invoke= graphkeys_click_insert_invoke;
- ot->exec= graphkeys_click_insert_exec;
- ot->poll= graphop_active_fcurve_poll;
+ ot->invoke = graphkeys_click_insert_invoke;
+ ot->exec = graphkeys_click_insert_exec;
+ ot->poll = graphop_active_fcurve_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_float(ot->srna, "frame", 1.0f, -FLT_MAX, FLT_MAX, "Frame Number", "Frame to insert keyframe on", 0, 100);
@@ -704,16 +704,16 @@ static int graphkeys_copy_exec(bContext *C, wmOperator *op)
void GRAPH_OT_copy (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Keyframes";
- ot->idname= "GRAPH_OT_copy";
- ot->description= "Copy selected keyframes to the copy/paste buffer";
+ ot->name = "Copy Keyframes";
+ ot->idname = "GRAPH_OT_copy";
+ ot->description = "Copy selected keyframes to the copy/paste buffer";
/* api callbacks */
- ot->exec= graphkeys_copy_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->exec = graphkeys_copy_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -749,17 +749,17 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
void GRAPH_OT_paste (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste Keyframes";
- ot->idname= "GRAPH_OT_paste";
- ot->description= "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
+ ot->name = "Paste Keyframes";
+ ot->idname = "GRAPH_OT_paste";
+ ot->description = "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
/* api callbacks */
-// ot->invoke= WM_operator_props_popup; // better wait for graph redo panel
- ot->exec= graphkeys_paste_exec;
- ot->poll= graphop_editable_keyframes_poll;
+// ot->invoke = WM_operator_props_popup; // better wait for graph redo panel
+ ot->exec = graphkeys_paste_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing");
@@ -818,17 +818,17 @@ static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
void GRAPH_OT_duplicate (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Duplicate Keyframes";
- ot->idname= "GRAPH_OT_duplicate";
- ot->description= "Make a copy of all selected keyframes";
+ ot->name = "Duplicate Keyframes";
+ ot->idname = "GRAPH_OT_duplicate";
+ ot->description = "Make a copy of all selected keyframes";
/* api callbacks */
- ot->invoke= graphkeys_duplicate_invoke;
- ot->exec= graphkeys_duplicate_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->invoke = graphkeys_duplicate_invoke;
+ ot->exec = graphkeys_duplicate_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* to give to transform */
RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -888,17 +888,17 @@ static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
void GRAPH_OT_delete (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Keyframes";
- ot->idname= "GRAPH_OT_delete";
- ot->description= "Remove all selected keyframes";
+ ot->name = "Delete Keyframes";
+ ot->idname = "GRAPH_OT_delete";
+ ot->description = "Remove all selected keyframes";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= graphkeys_delete_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = graphkeys_delete_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Clean Keyframes Operator ************************* */
@@ -950,20 +950,20 @@ static int graphkeys_clean_exec(bContext *C, wmOperator *op)
void GRAPH_OT_clean (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clean Keyframes";
- ot->idname= "GRAPH_OT_clean";
- ot->description= "Simplify F-Curves by removing closely spaced keyframes";
+ ot->name = "Clean Keyframes";
+ ot->idname = "GRAPH_OT_clean";
+ ot->description = "Simplify F-Curves by removing closely spaced keyframes";
/* api callbacks */
- //ot->invoke= // XXX we need that number popup for this!
- ot->exec= graphkeys_clean_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ //ot->invoke = // XXX we need that number popup for this!
+ ot->exec = graphkeys_clean_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
+ ot->prop = RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
}
/* ******************** Bake F-Curve Operator *********************** */
@@ -1033,17 +1033,17 @@ static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op))
void GRAPH_OT_bake (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Bake Curve";
- ot->idname= "GRAPH_OT_bake";
- ot->description= "Bake selected F-Curves to a set of sampled points defining a similar curve";
+ ot->name = "Bake Curve";
+ ot->idname = "GRAPH_OT_bake";
+ ot->description = "Bake selected F-Curves to a set of sampled points defining a similar curve";
/* api callbacks */
- ot->invoke= WM_operator_confirm; // FIXME...
- ot->exec= graphkeys_bake_exec;
- ot->poll= graphop_selected_fcurve_poll;
+ ot->invoke = WM_operator_confirm; // FIXME...
+ ot->exec = graphkeys_bake_exec;
+ ot->poll = graphop_selected_fcurve_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
// todo: add props for start/end frames
}
@@ -1074,7 +1074,7 @@ static float fcurve_samplingcb_sound (FCurve *UNUSED(fcu), void *data, float eva
tSoundBakeInfo *sbi= (tSoundBakeInfo *)data;
int position = evaltime - sbi->cfra;
- if((position < 0) || (position >= sbi->length))
+ if ((position < 0) || (position >= sbi->length))
return 0.0f;
return sbi->samples[position];
@@ -1177,17 +1177,17 @@ static int graphkeys_sound_bake_invoke (bContext *C, wmOperator *op, wmEvent *ev
void GRAPH_OT_sound_bake (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Bake Sound to F-Curves";
- ot->idname= "GRAPH_OT_sound_bake";
- ot->description= "Bakes a sound wave to selected F-Curves";
+ ot->name = "Bake Sound to F-Curves";
+ ot->idname = "GRAPH_OT_sound_bake";
+ ot->description = "Bakes a sound wave to selected F-Curves";
/* api callbacks */
- ot->invoke= graphkeys_sound_bake_invoke;
- ot->exec= graphkeys_sound_bake_exec;
- ot->poll= graphop_selected_fcurve_poll;
+ ot->invoke = graphkeys_sound_bake_invoke;
+ ot->exec = graphkeys_sound_bake_exec;
+ ot->poll = graphop_selected_fcurve_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -1251,16 +1251,16 @@ static int graphkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
void GRAPH_OT_sample (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Sample Keyframes";
- ot->idname= "GRAPH_OT_sample";
- ot->description= "Add keyframes on every frame between the selected keyframes";
+ ot->name = "Sample Keyframes";
+ ot->idname = "GRAPH_OT_sample";
+ ot->description = "Add keyframes on every frame between the selected keyframes";
/* api callbacks */
- ot->exec= graphkeys_sample_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->exec = graphkeys_sample_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1360,20 +1360,20 @@ static int graphkeys_expo_exec(bContext *C, wmOperator *op)
void GRAPH_OT_extrapolation_type (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Keyframe Extrapolation";
- ot->idname= "GRAPH_OT_extrapolation_type";
- ot->description= "Set extrapolation mode for selected F-Curves";
+ ot->name = "Set Keyframe Extrapolation";
+ ot->idname = "GRAPH_OT_extrapolation_type";
+ ot->description = "Set extrapolation mode for selected F-Curves";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= graphkeys_expo_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = graphkeys_expo_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_graphkeys_expo_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_expo_types, 0, "Type", "");
}
/* ******************** Set Interpolation-Type Operator *********************** */
@@ -1429,20 +1429,20 @@ static int graphkeys_ipo_exec(bContext *C, wmOperator *op)
void GRAPH_OT_interpolation_type (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Keyframe Interpolation";
- ot->idname= "GRAPH_OT_interpolation_type";
- ot->description= "Set interpolation mode for the F-Curve segments starting from the selected keyframes";
+ ot->name = "Set Keyframe Interpolation";
+ ot->idname = "GRAPH_OT_interpolation_type";
+ ot->description = "Set interpolation mode for the F-Curve segments starting from the selected keyframes";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= graphkeys_ipo_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = graphkeys_ipo_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", beztriple_interpolation_mode_items, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", beztriple_interpolation_mode_items, 0, "Type", "");
}
/* ******************** Set Handle-Type Operator *********************** */
@@ -1506,20 +1506,20 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
void GRAPH_OT_handle_type (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Keyframe Handle Type";
- ot->idname= "GRAPH_OT_handle_type";
- ot->description= "Set type of handle for selected keyframes";
+ ot->name = "Set Keyframe Handle Type";
+ ot->idname = "GRAPH_OT_handle_type";
+ ot->description = "Set type of handle for selected keyframes";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= graphkeys_handletype_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = graphkeys_handletype_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", "");
}
/* ************************************************************************** */
@@ -1700,16 +1700,16 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
void GRAPH_OT_euler_filter (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Euler Discontinuity Filter";
- ot->idname= "GRAPH_OT_euler_filter";
- ot->description= "Fixes the most common causes of gimbal lock in the selected Euler Rotation F-Curves";
+ ot->name = "Euler Discontinuity Filter";
+ ot->idname = "GRAPH_OT_euler_filter";
+ ot->description = "Fixes the most common causes of gimbal lock in the selected Euler Rotation F-Curves";
/* api callbacks */
- ot->exec= graphkeys_euler_filter_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->exec = graphkeys_euler_filter_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ***************** Jump to Selected Frames Operator *********************** */
@@ -1774,16 +1774,16 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
void GRAPH_OT_frame_jump (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Jump to Frame";
- ot->idname= "GRAPH_OT_frame_jump";
- ot->description= "Set the current frame to the average frame of the selected keyframes";
+ ot->name = "Jump to Frame";
+ ot->idname = "GRAPH_OT_frame_jump";
+ ot->description = "Set the current frame to the average frame of the selected keyframes";
/* api callbacks */
- ot->exec= graphkeys_framejump_exec;
- ot->poll= graphop_visible_keyframes_poll;
+ ot->exec = graphkeys_framejump_exec;
+ ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Snap Keyframes Operator *********************** */
@@ -1878,20 +1878,20 @@ static int graphkeys_snap_exec(bContext *C, wmOperator *op)
void GRAPH_OT_snap (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Snap Keys";
- ot->idname= "GRAPH_OT_snap";
- ot->description= "Snap selected keyframes to the chosen times/values";
+ ot->name = "Snap Keys";
+ ot->idname = "GRAPH_OT_snap";
+ ot->description = "Snap selected keyframes to the chosen times/values";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= graphkeys_snap_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = graphkeys_snap_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_graphkeys_snap_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_snap_types, 0, "Type", "");
}
/* ******************** Mirror Keyframes Operator *********************** */
@@ -1996,20 +1996,20 @@ static int graphkeys_mirror_exec(bContext *C, wmOperator *op)
void GRAPH_OT_mirror (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mirror Keys";
- ot->idname= "GRAPH_OT_mirror";
- ot->description= "Flip selected keyframes over the selected mirror line";
+ ot->name = "Mirror Keys";
+ ot->idname = "GRAPH_OT_mirror";
+ ot->description = "Flip selected keyframes over the selected mirror line";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= graphkeys_mirror_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = graphkeys_mirror_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_graphkeys_mirror_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_mirror_types, 0, "Type", "");
}
/* ******************** Smooth Keyframes Operator *********************** */
@@ -2051,16 +2051,16 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op))
void GRAPH_OT_smooth (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Smooth Keys";
- ot->idname= "GRAPH_OT_smooth";
- ot->description= "Apply weighted moving means to make selected F-Curves less bumpy";
+ ot->name = "Smooth Keys";
+ ot->idname = "GRAPH_OT_smooth";
+ ot->description = "Apply weighted moving means to make selected F-Curves less bumpy";
/* api callbacks */
- ot->exec= graphkeys_smooth_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->exec = graphkeys_smooth_exec;
+ ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************************************************************** */
@@ -2155,20 +2155,20 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
void GRAPH_OT_fmodifier_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add F-Curve Modifier";
- ot->idname= "GRAPH_OT_fmodifier_add";
- ot->description= "Add F-Modifiers to the selected F-Curves";
+ ot->name = "Add F-Curve Modifier";
+ ot->idname = "GRAPH_OT_fmodifier_add";
+ ot->description = "Add F-Modifiers to the selected F-Curves";
/* api callbacks */
- ot->invoke= graph_fmodifier_add_invoke;
- ot->exec= graph_fmodifier_add_exec;
- ot->poll= graphop_selected_fcurve_poll;
+ ot->invoke = graph_fmodifier_add_invoke;
+ ot->exec = graph_fmodifier_add_exec;
+ ot->poll = graphop_selected_fcurve_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
RNA_def_boolean(ot->srna, "only_active", 1, "Only Active", "Only add F-Modifier to active F-Curve");
}
@@ -2213,16 +2213,16 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op)
void GRAPH_OT_fmodifier_copy (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy F-Modifiers";
- ot->idname= "GRAPH_OT_fmodifier_copy";
- ot->description= "Copy the F-Modifier(s) of the active F-Curve";
+ ot->name = "Copy F-Modifiers";
+ ot->idname = "GRAPH_OT_fmodifier_copy";
+ ot->description = "Copy the F-Modifier(s) of the active F-Curve";
/* api callbacks */
- ot->exec= graph_fmodifier_copy_exec;
- ot->poll= graphop_active_fcurve_poll;
+ ot->exec = graph_fmodifier_copy_exec;
+ ot->poll = graphop_active_fcurve_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
//ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All F-Modifiers", "Copy all the F-Modifiers, instead of just the active one");
@@ -2275,16 +2275,16 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
void GRAPH_OT_fmodifier_paste (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste F-Modifiers";
- ot->idname= "GRAPH_OT_fmodifier_paste";
- ot->description= "Add copied F-Modifiers to the selected F-Curves";
+ ot->name = "Paste F-Modifiers";
+ ot->idname = "GRAPH_OT_fmodifier_paste";
+ ot->description = "Add copied F-Modifiers to the selected F-Curves";
/* api callbacks */
- ot->exec= graph_fmodifier_paste_exec;
- ot->poll= graphop_active_fcurve_poll;
+ ot->exec = graph_fmodifier_paste_exec;
+ ot->poll = graphop_active_fcurve_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************************************************************** */
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index aba58098563..2887fa1c881 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -164,18 +164,18 @@ static int graphview_cursor_modal(bContext *C, wmOperator *op, wmEvent *event)
static void GRAPH_OT_cursor_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Cursor";
- ot->idname= "GRAPH_OT_cursor_set";
- ot->description= "Interactively set the current frame number and value cursor";
+ ot->name = "Set Cursor";
+ ot->idname = "GRAPH_OT_cursor_set";
+ ot->description = "Interactively set the current frame number and value cursor";
/* api callbacks */
- ot->exec= graphview_cursor_exec;
- ot->invoke= graphview_cursor_invoke;
- ot->modal= graphview_cursor_modal;
- ot->poll= ED_operator_graphedit_active;
+ ot->exec = graphview_cursor_exec;
+ ot->invoke = graphview_cursor_invoke;
+ ot->modal = graphview_cursor_modal;
+ ot->poll = ED_operator_graphedit_active;
/* flags */
- ot->flag= OPTYPE_BLOCKING|OPTYPE_UNDO;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_UNDO;
/* rna */
RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
@@ -241,11 +241,11 @@ void ED_operatormacros_graph(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot= WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
if (ot) {
- ot->description= "Make a copy of all selected keyframes and move them";
+ ot->description = "Make a copy of all selected keyframes and move them";
WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate");
- otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE);
}
}
@@ -273,23 +273,23 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "curves", FALSE);
RNA_boolean_set(kmi->ptr, "column", FALSE);
- kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "curves", FALSE);
RNA_boolean_set(kmi->ptr, "column", TRUE);
- kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "curves", FALSE);
RNA_boolean_set(kmi->ptr, "column", FALSE);
- kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "curves", FALSE);
RNA_boolean_set(kmi->ptr, "column", TRUE);
- kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "curves", TRUE);
RNA_boolean_set(kmi->ptr, "column", FALSE);
- kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT|KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "curves", TRUE);
RNA_boolean_set(kmi->ptr, "column", FALSE);
@@ -298,14 +298,14 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_TEST);
- kmi= WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_TEST);
- kmi= WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_LEFT);
- kmi= WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT);
@@ -406,7 +406,7 @@ void graphedit_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap;
/* keymap for all regions */
- keymap= WM_keymap_find(keyconf, "Graph Editor Generic", SPACE_IPO, 0);
+ keymap = WM_keymap_find(keyconf, "Graph Editor Generic", SPACE_IPO, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_properties", NKEY, KM_PRESS, 0, 0);
/* extrapolation works on channels, not keys */
WM_keymap_add_item(keymap, "GRAPH_OT_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0);
@@ -418,7 +418,7 @@ void graphedit_keymap(wmKeyConfig *keyconf)
*/
/* keyframes */
- keymap= WM_keymap_find(keyconf, "Graph Editor", SPACE_IPO, 0);
+ keymap = WM_keymap_find(keyconf, "Graph Editor", SPACE_IPO, 0);
graphedit_keymap_keyframes(keyconf, keymap);
}
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index bdd3497a931..864708a873a 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -169,19 +169,19 @@ static int graphkeys_deselectall_exec(bContext *C, wmOperator *op)
void GRAPH_OT_select_all_toggle (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select All";
- ot->idname= "GRAPH_OT_select_all_toggle";
- ot->description= "Toggle selection of all keyframes";
+ ot->name = "Select All";
+ ot->idname = "GRAPH_OT_select_all_toggle";
+ ot->description = "Toggle selection of all keyframes";
/* api callbacks */
- ot->exec= graphkeys_deselectall_exec;
- ot->poll= graphop_visible_keyframes_poll;
+ ot->exec = graphkeys_deselectall_exec;
+ ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
/* props */
- ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+ ot->prop = RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
}
/* ******************** Border Select Operator **************************** */
@@ -316,10 +316,10 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
incl_handles = RNA_boolean_get(op->ptr, "include_handles");
/* get settings from operator */
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
/* selection 'mode' depends on whether borderselect region only matters on one axis */
if (RNA_boolean_get(op->ptr, "axis_range")) {
@@ -348,25 +348,25 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
void GRAPH_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Select";
- ot->idname= "GRAPH_OT_select_border";
- ot->description= "Select all keyframes within the specified region";
+ ot->name = "Border Select";
+ ot->idname = "GRAPH_OT_select_border";
+ ot->description = "Select all keyframes within the specified region";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= graphkeys_borderselect_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = graphkeys_borderselect_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= graphop_visible_keyframes_poll;
+ ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
/* rna */
WM_operator_properties_gesture_border(ot, TRUE);
- ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+ ot->prop = RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
RNA_def_boolean(ot->srna, "include_handles", 0, "Include Handles", "Are handles tested individually against the selection criteria");
}
@@ -538,19 +538,19 @@ static int graphkeys_columnselect_exec(bContext *C, wmOperator *op)
void GRAPH_OT_select_column (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select All";
- ot->idname= "GRAPH_OT_select_column";
- ot->description= "Select all keyframes on the specified frame(s)";
+ ot->name = "Select All";
+ ot->idname = "GRAPH_OT_select_column";
+ ot->description = "Select all keyframes on the specified frame(s)";
/* api callbacks */
- ot->exec= graphkeys_columnselect_exec;
- ot->poll= graphop_visible_keyframes_poll;
+ ot->exec = graphkeys_columnselect_exec;
+ ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
/* props */
- ot->prop= RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
+ ot->prop = RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
}
/* ******************** Select Linked Operator *********************** */
@@ -597,15 +597,15 @@ void GRAPH_OT_select_linked (wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Linked";
- ot->idname= "GRAPH_OT_select_linked";
+ ot->idname = "GRAPH_OT_select_linked";
ot->description = "Select keyframes occurring in the same F-Curves as selected ones";
/* api callbacks */
- ot->exec= graphkeys_select_linked_exec;
- ot->poll= graphop_visible_keyframes_poll;
+ ot->exec = graphkeys_select_linked_exec;
+ ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
}
/* ******************** Select More/Less Operators *********************** */
@@ -675,15 +675,15 @@ void GRAPH_OT_select_more (wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select More";
- ot->idname= "GRAPH_OT_select_more";
+ ot->idname = "GRAPH_OT_select_more";
ot->description = "Select keyframes beside already selected ones";
/* api callbacks */
- ot->exec= graphkeys_select_more_exec;
- ot->poll= graphop_visible_keyframes_poll;
+ ot->exec = graphkeys_select_more_exec;
+ ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
}
/* ----------------- */
@@ -709,15 +709,15 @@ void GRAPH_OT_select_less (wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Less";
- ot->idname= "GRAPH_OT_select_less";
+ ot->idname = "GRAPH_OT_select_less";
ot->description = "Deselect keyframes on ends of selection islands";
/* api callbacks */
- ot->exec= graphkeys_select_less_exec;
- ot->poll= graphop_visible_keyframes_poll;
+ ot->exec = graphkeys_select_less_exec;
+ ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
}
/* ******************** Select Left/Right Operator ************************* */
@@ -849,20 +849,20 @@ static int graphkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEve
void GRAPH_OT_select_leftright (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Left/Right";
- ot->idname= "GRAPH_OT_select_leftright";
- ot->description= "Select keyframes to the left or the right of the current frame";
+ ot->name = "Select Left/Right";
+ ot->idname = "GRAPH_OT_select_leftright";
+ ot->description = "Select keyframes to the left or the right of the current frame";
/* api callbacks */
ot->invoke= graphkeys_select_leftright_invoke;
- ot->exec= graphkeys_select_leftright_exec;
- ot->poll= graphop_visible_keyframes_poll;
+ ot->exec = graphkeys_select_leftright_exec;
+ ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "mode", prop_graphkeys_leftright_select_types, GRAPHKEYS_LRSEL_TEST, "Mode", "");
+ ot->prop = RNA_def_enum(ot->srna, "mode", prop_graphkeys_leftright_select_types, GRAPHKEYS_LRSEL_TEST, "Mode", "");
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
}
@@ -1334,13 +1334,13 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
void GRAPH_OT_clickselect (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mouse Select Keys";
- ot->idname= "GRAPH_OT_clickselect";
- ot->description= "Select keyframes by clicking on them";
+ ot->name = "Mouse Select Keys";
+ ot->idname = "GRAPH_OT_clickselect";
+ ot->description = "Select keyframes by clicking on them";
/* api callbacks */
- ot->invoke= graphkeys_clickselect_invoke;
- ot->poll= graphop_visible_keyframes_poll;
+ ot->invoke = graphkeys_clickselect_invoke;
+ ot->poll = graphop_visible_keyframes_poll;
/* id-props */
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 08f21a3f5aa..37cdbd4963a 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -70,7 +70,7 @@ ARegion *graph_has_buttons_region(ScrArea *sa)
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if(ar) return ar;
+ if (ar) return ar;
/* add subdiv level; after main */
ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
@@ -142,10 +142,10 @@ static SpaceLink *graph_new(const bContext *C)
BLI_addtail(&sipo->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin= 0.0f;
- ar->v2d.tot.ymin= (float)scene->r.sfra - 10.0f;
- ar->v2d.tot.xmax= (float)scene->r.efra;
- ar->v2d.tot.ymax= 10.0f;
+ ar->v2d.tot.xmin = 0.0f;
+ ar->v2d.tot.ymin = (float)scene->r.sfra - 10.0f;
+ ar->v2d.tot.xmax = (float)scene->r.efra;
+ ar->v2d.tot.ymax = 10.0f;
ar->v2d.cur= ar->v2d.tot;
@@ -211,9 +211,9 @@ static void graph_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Graph Editor", SPACE_IPO, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Graph Editor", SPACE_IPO, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap= WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -310,9 +310,9 @@ static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap= WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -362,7 +362,7 @@ static void graph_buttons_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap= WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -400,7 +400,7 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case ND_MODIFIER:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
}
@@ -414,11 +414,11 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
default:
- if(wmn->data==ND_KEYS)
+ if (wmn->data==ND_KEYS)
ED_region_tag_redraw(ar);
}
@@ -474,13 +474,13 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_GRAPH)
+ if (wmn->data == ND_SPACE_GRAPH)
ED_area_tag_redraw(sa);
break;
// XXX: restore the case below if not enough updates occur...
//default:
- // if(wmn->data==ND_KEYS)
+ // if (wmn->data==ND_KEYS)
// ED_area_tag_redraw(sa);
}
}
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index d54468f64ea..dbee8f207ec 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -101,15 +101,15 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf,
str[0]= 0;
- if(ima==NULL) return;
+ if (ima==NULL) return;
- if(ibuf==NULL) {
+ if (ibuf==NULL) {
ofs+= sprintf(str, "Can't Load Image");
}
else {
- if(ima->source==IMA_SRC_MOVIE) {
+ if (ima->source==IMA_SRC_MOVIE) {
ofs+= sprintf(str, "Movie");
- if(ima->anim)
+ if (ima->anim)
ofs+= sprintf(str+ofs, "%d frs", IMB_anim_get_duration(ima->anim, IMB_TC_RECORD_RUN));
}
else
@@ -117,34 +117,34 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf,
ofs+= sprintf(str+ofs, ": size %d x %d,", ibuf->x, ibuf->y);
- if(ibuf->rect_float) {
- if(ibuf->channels!=4) {
+ if (ibuf->rect_float) {
+ if (ibuf->channels!=4) {
ofs+= sprintf(str+ofs, "%d float channel(s)", ibuf->channels);
}
- else if(ibuf->planes == R_IMF_PLANES_RGBA)
+ else if (ibuf->planes == R_IMF_PLANES_RGBA)
ofs+= sprintf(str+ofs, " RGBA float");
else
ofs+= sprintf(str+ofs, " RGB float");
}
else {
- if(ibuf->planes == R_IMF_PLANES_RGBA)
+ if (ibuf->planes == R_IMF_PLANES_RGBA)
ofs+= sprintf(str+ofs, " RGBA byte");
else
ofs+= sprintf(str+ofs, " RGB byte");
}
- if(ibuf->zbuf || ibuf->zbuf_float)
+ if (ibuf->zbuf || ibuf->zbuf_float)
ofs+= sprintf(str+ofs, " + Z");
- if(ima->source==IMA_SRC_SEQUENCE) {
+ if (ima->source==IMA_SRC_SEQUENCE) {
char *file= BLI_last_slash(ibuf->name);
- if(file==NULL) file= ibuf->name;
+ if (file==NULL) file= ibuf->name;
else file++;
ofs+= sprintf(str+ofs, ", %s", file);
}
}
/* the frame number, even if we cant */
- if(ima->source==IMA_SRC_SEQUENCE) {
+ if (ima->source==IMA_SRC_SEQUENCE) {
/* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
const int framenr= BKE_image_user_get_frame(iuser, CFRA, 0);
ofs+= sprintf(str+ofs, ", Frame: %d", framenr);
@@ -158,10 +158,10 @@ struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree)
{
bNode *node;
- if(ntree)
- for(node= ntree->nodes.first; node; node= node->next)
- if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
- if(node->flag & NODE_DO_OUTPUT)
+ if (ntree)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+ if (node->flag & NODE_DO_OUTPUT)
return node->storage;
return NULL;
}
@@ -196,8 +196,8 @@ static void image_panel_curves(const bContext *C, Panel *pa)
ibuf= ED_space_image_acquire_buffer(sima, &lock);
- if(ibuf) {
- if(sima->cumap==NULL)
+ if (ibuf) {
+ if (sima->cumap==NULL)
sima->cumap= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
/* curvemap black/white levels only works for RGBA */
@@ -220,12 +220,12 @@ void image_preview_event(int event)
{
int exec= 0;
- if(event==0) {
+ if (event==0) {
G.scene->r.scemode &= ~R_COMP_CROP;
exec= 1;
}
else {
- if(image_preview_active(curarea, NULL, NULL)) {
+ if (image_preview_active(curarea, NULL, NULL)) {
G.scene->r.scemode |= R_COMP_CROP;
exec= 1;
}
@@ -233,7 +233,7 @@ void image_preview_event(int event)
G.scene->r.scemode &= ~R_COMP_CROP;
}
- if(exec && G.scene->nodetree) {
+ if (exec && G.scene->nodetree) {
/* should work when no node editor in screen..., so we execute right away */
ntreeCompositTagGenerators(G.scene->nodetree);
@@ -267,7 +267,7 @@ static void preview_cb(struct ScrArea *sa, struct uiBlock *block)
int winy= (G.scene->r.size*G.scene->r.ysch)/100;
int mval[2];
- if(G.scene->r.mode & R_BORDER) {
+ if (G.scene->r.mode & R_BORDER) {
winx*= (G.scene->r.border.xmax - G.scene->r.border.xmin);
winy*= (G.scene->r.border.ymax - G.scene->r.border.ymin);
}
@@ -289,10 +289,10 @@ static void preview_cb(struct ScrArea *sa, struct uiBlock *block)
areamouseco_to_ipoco(v2d, mval, &dispf.xmax, &dispf.ymax);
/* map to render coordinates */
- disprect->xmin= dispf.xmin;
- disprect->xmax= dispf.xmax;
- disprect->ymin= dispf.ymin;
- disprect->ymax= dispf.ymax;
+ disprect->xmin = dispf.xmin;
+ disprect->xmax = dispf.xmax;
+ disprect->ymin = dispf.ymin;
+ disprect->ymax = dispf.ymax;
CLAMP(disprect->xmin, 0, winx);
CLAMP(disprect->xmax, 0, winx);
@@ -308,14 +308,14 @@ static int is_preview_allowed(ScrArea *cur)
ScrArea *sa;
/* check if another areawindow has preview set */
- for(sa=G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa!=cur && sa->spacetype==SPACE_IMAGE) {
- if(image_preview_active(sa, NULL, NULL))
+ for (sa=G.curscreen->areabase.first; sa; sa= sa->next) {
+ if (sa!=cur && sa->spacetype==SPACE_IMAGE) {
+ if (image_preview_active(sa, NULL, NULL))
return 0;
}
}
/* check image type */
- if(sima->image==NULL || sima->image->type!=IMA_TYPE_COMPOSITE)
+ if (sima->image==NULL || sima->image->type!=IMA_TYPE_COMPOSITE)
return 0;
return 1;
@@ -328,7 +328,7 @@ static void image_panel_preview(ScrArea *sa, short cntrl) // IMAGE_HANDLER_PREVI
SpaceImage *sima= sa->spacedata.first;
int ofsx, ofsy;
- if(is_preview_allowed(sa)==0) {
+ if (is_preview_allowed(sa)==0) {
rem_blockhandler(sa, IMAGE_HANDLER_PREVIEW);
G.scene->r.scemode &= ~R_COMP_CROP; /* quite weak */
return;
@@ -340,7 +340,7 @@ static void image_panel_preview(ScrArea *sa, short cntrl) // IMAGE_HANDLER_PREVI
ofsx= -150+(sa->winx/2)/sima->blockscale;
ofsy= -100+(sa->winy/2)/sima->blockscale;
- if(uiNewPanel(C, ar, block, "Preview", "Image", ofsx, ofsy, 300, 200)==0) return;
+ if (uiNewPanel(C, ar, block, "Preview", "Image", ofsx, ofsy, 300, 200)==0) return;
uiBlockSetDrawExtraFunc(block, preview_cb);
@@ -360,7 +360,7 @@ static char *slot_menu(void)
strcpy(str, "Slot %t");
a= strlen(str);
- for(slot=0; slot<IMA_MAX_RENDER_SLOT; slot++)
+ for (slot=0; slot<IMA_MAX_RENDER_SLOT; slot++)
a += sprintf(str+a, "|Slot %d %%x%d", slot+1, slot);
return str;
@@ -378,15 +378,15 @@ static char *layer_menu(RenderResult *rr, short *UNUSED(curlay))
a= strlen(str);
/* compo result */
- if(rr->rectf) {
+ if (rr->rectf) {
a+= sprintf(str+a, "|Composite %%x0");
nr= 1;
}
- else if(rr->rect32) {
+ else if (rr->rect32) {
a+= sprintf(str+a, "|Sequence %%x0");
nr= 1;
}
- for(rl= rr->layers.first; rl; rl= rl->next, nr++) {
+ for (rl= rr->layers.first; rl; rl= rl->next, nr++) {
a+= sprintf(str+a, "|%s %%x%d", rl->name, nr);
}
@@ -407,16 +407,16 @@ static char *pass_menu(RenderLayer *rl, short *curpass)
a= strlen(str);
/* rendered results don't have a Combined pass */
- if(rl==NULL || rl->rectf) {
+ if (rl==NULL || rl->rectf) {
a+= sprintf(str+a, "|Combined %%x0");
nr= 1;
}
- if(rl)
- for(rpass= rl->passes.first; rpass; rpass= rpass->next, nr++)
+ if (rl)
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next, nr++)
a+= sprintf(str+a, "|%s %%x%d", rpass->name, nr);
- if(*curpass >= nr)
+ if (*curpass >= nr)
*curpass= 0;
return str;
@@ -428,7 +428,7 @@ static void set_frames_cb(bContext *C, void *ima_v, void *iuser_v)
Image *ima= ima_v;
ImageUser *iuser= iuser_v;
- if(ima->anim) {
+ if (ima->anim) {
iuser->frames = IMB_anim_get_duration(ima->anim, IMB_TC_RECORD_RUN);
BKE_image_user_calc_frame(iuser, scene->r.cfra, 0);
}
@@ -448,10 +448,10 @@ static void image_multi_inclay_cb(bContext *C, void *rr_v, void *iuser_v)
ImageUser *iuser= iuser_v;
int tot= BLI_countlist(&rr->layers);
- if(rr->rectf || rr->rect32)
+ if (rr->rectf || rr->rect32)
tot++; /* fake compo/sequencer layer */
- if(iuser->layer<tot-1) {
+ if (iuser->layer<tot-1) {
iuser->layer++;
BKE_image_multilayer_index(rr, iuser);
WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
@@ -461,7 +461,7 @@ static void image_multi_declay_cb(bContext *C, void *rr_v, void *iuser_v)
{
ImageUser *iuser= iuser_v;
- if(iuser->layer>0) {
+ if (iuser->layer>0) {
iuser->layer--;
BKE_image_multilayer_index(rr_v, iuser);
WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
@@ -473,13 +473,13 @@ static void image_multi_incpass_cb(bContext *C, void *rr_v, void *iuser_v)
ImageUser *iuser= iuser_v;
RenderLayer *rl= BLI_findlink(&rr->layers, iuser->layer);
- if(rl) {
+ if (rl) {
int tot= BLI_countlist(&rl->passes);
- if(rr->rectf || rr->rect32)
+ if (rr->rectf || rr->rect32)
tot++; /* fake compo/sequencer layer */
- if(iuser->pass<tot-1) {
+ if (iuser->pass<tot-1) {
iuser->pass++;
BKE_image_multilayer_index(rr, iuser);
WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
@@ -490,7 +490,7 @@ static void image_multi_decpass_cb(bContext *C, void *rr_v, void *iuser_v)
{
ImageUser *iuser= iuser_v;
- if(iuser->pass>0) {
+ if (iuser->pass>0) {
iuser->pass--;
BKE_image_multilayer_index(rr_v, iuser);
WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
@@ -530,26 +530,26 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, Image
wmenu3= (3*w)/6;
/* menu buts */
- if(render_slot) {
+ if (render_slot) {
strp= slot_menu();
- but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu1, UI_UNIT_Y, render_slot, 0,0,0,0, "Select Slot");
+ but = uiDefButS(block, MENU, 0, strp, 0, 0, wmenu1, UI_UNIT_Y, render_slot, 0,0,0,0, "Select Slot");
uiButSetFunc(but, image_multi_cb, rr, iuser);
MEM_freeN(strp);
}
- if(rr) {
+ if (rr) {
strp= layer_menu(rr, &iuser->layer);
- but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu2, UI_UNIT_Y, &iuser->layer, 0,0,0,0, "Select Layer");
+ but = uiDefButS(block, MENU, 0, strp, 0, 0, wmenu2, UI_UNIT_Y, &iuser->layer, 0,0,0,0, "Select Layer");
uiButSetFunc(but, image_multi_cb, rr, iuser);
MEM_freeN(strp);
layer = iuser->layer;
- if(rr->rectf || rr->rect32)
+ if (rr->rectf || rr->rect32)
layer--; /* fake compo/sequencer layer */
rl= BLI_findlink(&rr->layers, layer); /* return NULL is meant to be */
strp= pass_menu(rl, &iuser->pass);
- but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu3, UI_UNIT_Y, &iuser->pass, 0,0,0,0, "Select Pass");
+ but = uiDefButS(block, MENU, 0, strp, 0, 0, wmenu3, UI_UNIT_Y, &iuser->pass, 0,0,0,0, "Select Pass");
uiButSetFunc(but, image_multi_cb, rr, iuser);
MEM_freeN(strp);
}
@@ -564,25 +564,25 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr,
row= uiLayoutRow(layout, 1);
- if(rr==NULL || iuser==NULL)
+ if (rr==NULL || iuser==NULL)
return;
- if(rr->layers.first==NULL) {
+ if (rr->layers.first==NULL) {
uiItemL(row, "No Layers in Render Result", ICON_NONE);
return;
}
/* decrease, increase arrows */
- but= uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0,0,17,20, NULL, 0, 0, 0, 0, "Previous Layer");
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0,0,17,20, NULL, 0, 0, 0, 0, "Previous Layer");
uiButSetFunc(but, image_multi_declay_cb, rr, iuser);
- but= uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0,0,18,20, NULL, 0, 0, 0, 0, "Next Layer");
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0,0,18,20, NULL, 0, 0, 0, 0, "Next Layer");
uiButSetFunc(but, image_multi_inclay_cb, rr, iuser);
uiblock_layer_pass_buttons(row, rr, iuser, 230 * dpi_fac, render_slot);
/* decrease, increase arrows */
- but= uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0,0,17,20, NULL, 0, 0, 0, 0, "Previous Pass");
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0,0,17,20, NULL, 0, 0, 0, 0, "Previous Pass");
uiButSetFunc(but, image_multi_decpass_cb, rr, iuser);
- but= uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0,0,18,20, NULL, 0, 0, 0, 0, "Next Pass");
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0,0,18,20, NULL, 0, 0, 0, 0, "Next Pass");
uiButSetFunc(but, image_multi_incpass_cb, rr, iuser);
uiBlockEndAlign(block);
@@ -626,17 +626,17 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
char str[128];
void *lock;
- if(!ptr->data)
+ if (!ptr->data)
return;
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
printf("%s: property not found: %s.%s\n",
__func__, RNA_struct_identifier(ptr->type), propname);
return;
}
- if(RNA_property_type(prop) != PROP_POINTER) {
+ if (RNA_property_type(prop) != PROP_POINTER) {
printf("%s: expected pointer property for %s.%s\n",
__func__, RNA_struct_identifier(ptr->type), propname);
return;
@@ -655,13 +655,13 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
uiLayoutSetContextPointer(layout, "edit_image", &imaptr);
- if(!compact)
+ if (!compact)
uiTemplateID(layout, C, ptr, propname, "IMAGE_OT_new", "IMAGE_OT_open", NULL);
- if(ima) {
+ if (ima) {
uiBlockSetNFunc(block, rna_update_cb, MEM_dupallocN(cb), NULL);
- if(ima->source == IMA_SRC_VIEWER) {
+ if (ima->source == IMA_SRC_VIEWER) {
ibuf= BKE_image_acquire_ibuf(ima, iuser, &lock);
image_info(scene, iuser, ima, ibuf, str);
BKE_image_release_ibuf(ima, lock);
@@ -669,18 +669,18 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
uiItemL(layout, ima->id.name+2, ICON_NONE);
uiItemL(layout, str, ICON_NONE);
- if(ima->type==IMA_TYPE_COMPOSITE) {
+ if (ima->type==IMA_TYPE_COMPOSITE) {
// XXX not working yet
#if 0
iuser= ntree_get_active_iuser(scene->nodetree);
- if(iuser) {
+ if (iuser) {
uiBlockBeginAlign(block);
uiDefIconTextBut(block, BUT, B_SIMA_RECORD, ICON_REC, "Record", 10,120,100,20, 0, 0, 0, 0, 0, "");
uiDefIconTextBut(block, BUT, B_SIMA_PLAY, ICON_PLAY, "Play", 110,120,100,20, 0, 0, 0, 0, 0, "");
- but= uiDefBut(block, BUT, B_NOP, "Free Cache", 210,120,100,20, 0, 0, 0, 0, 0, "");
+ but = uiDefBut(block, BUT, B_NOP, "Free Cache", 210,120,100,20, 0, 0, 0, 0, 0, "");
uiButSetFunc(but, image_freecache_cb, ima, NULL);
- if(iuser->frames)
+ if (iuser->frames)
BLI_snprintf(str, sizeof(str), "(%d) Frames:", iuser->framenr);
else strcpy(str, "Frames:");
uiBlockBeginAlign(block);
@@ -689,7 +689,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
}
#endif
}
- else if(ima->type==IMA_TYPE_R_RESULT) {
+ else if (ima->type==IMA_TYPE_R_RESULT) {
/* browse layer/passes */
Render *re= RE_GetRender(scene->id.name);
RenderResult *rr= RE_AcquireResultRead(re);
@@ -700,7 +700,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
else {
uiItemR(layout, &imaptr, "source", 0, NULL, ICON_NONE);
- if(ima->source != IMA_SRC_GENERATED) {
+ if (ima->source != IMA_SRC_GENERATED) {
row= uiLayoutRow(layout, 1);
if (ima->packedfile)
uiItemO(row, "", ICON_PACKAGE, "image.unpack");
@@ -716,8 +716,8 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
// XXX what was this for?
#if 0
/* check for re-render, only buttons */
- if(imagechanged==B_IMAGECHANGED) {
- if(iuser->flag & IMA_ANIM_REFRESHED) {
+ if (imagechanged==B_IMAGECHANGED) {
+ if (iuser->flag & IMA_ANIM_REFRESHED) {
iuser->flag &= ~IMA_ANIM_REFRESHED;
WM_event_add_notifier(C, NC_IMAGE, ima);
}
@@ -725,11 +725,11 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
#endif
/* multilayer? */
- if(ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
+ if (ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
uiblock_layer_pass_arrow_buttons(layout, ima->rr, iuser, NULL);
}
- else if(ima->source != IMA_SRC_GENERATED) {
- if(compact == 0) {
+ else if (ima->source != IMA_SRC_GENERATED) {
+ if (compact == 0) {
ibuf= BKE_image_acquire_ibuf(ima, iuser, &lock);
image_info(scene, iuser, ima, ibuf, str);
BKE_image_release_ibuf(ima, lock);
@@ -737,8 +737,8 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
}
}
- if(ima->source != IMA_SRC_GENERATED) {
- if(compact == 0) { /* background image view doesnt need these */
+ if (ima->source != IMA_SRC_GENERATED) {
+ if (compact == 0) { /* background image view doesnt need these */
uiItemS(layout);
split= uiLayoutSplit(layout, 0, 0);
@@ -755,7 +755,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
}
}
- if(ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ if (ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
uiItemS(layout);
split= uiLayoutSplit(layout, 0, 0);
@@ -764,9 +764,9 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
BLI_snprintf(str, sizeof(str), "(%d) Frames", iuser->framenr);
uiItemR(col, userptr, "frame_duration", 0, str, ICON_NONE);
- if(ima->anim) {
+ if (ima->anim) {
block= uiLayoutGetBlock(col);
- but= uiDefBut(block, BUT, 0, "Match Movie Length", 0, 0, UI_UNIT_X*2, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Set the number of frames to match the movie or sequence");
+ but = uiDefBut(block, BUT, 0, "Match Movie Length", 0, 0, UI_UNIT_X*2, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Set the number of frames to match the movie or sequence");
uiButSetFunc(but, set_frames_cb, ima, iuser);
}
@@ -780,7 +780,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
uiItemR(col, userptr, "use_auto_refresh", 0, NULL, ICON_NONE);
uiItemR(col, userptr, "use_cyclic", 0, NULL, ICON_NONE);
}
- else if(ima->source==IMA_SRC_GENERATED) {
+ else if (ima->source==IMA_SRC_GENERATED) {
split= uiLayoutSplit(layout, 0, 0);
col= uiLayoutColumn(split, 1);
@@ -818,7 +818,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
uiItemR(sub, imfptr, "color_mode", UI_ITEM_R_EXPAND, "Color", ICON_NONE);
/* only display depth setting if multiple depths can be used */
- if((ELEM6(depth_ok,
+ if ((ELEM6(depth_ok,
R_IMF_CHAN_DEPTH_1,
R_IMF_CHAN_DEPTH_8,
R_IMF_CHAN_DEPTH_12,
@@ -877,7 +877,7 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser
RenderResult *rr;
/* render layers and passes */
- if(ima && iuser) {
+ if (ima && iuser) {
const float dpi_fac= UI_DPI_FAC;
rr= BKE_image_acquire_renderresult(scene, ima);
uiblock_layer_pass_buttons(layout, rr, iuser, 160 * dpi_fac, (ima->type==IMA_TYPE_R_RESULT)? &ima->render_slot: NULL);
@@ -909,7 +909,7 @@ static int image_properties(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= image_has_buttons_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -917,15 +917,15 @@ static int image_properties(bContext *C, wmOperator *UNUSED(op))
void IMAGE_OT_properties(wmOperatorType *ot)
{
- ot->name= "Properties";
- ot->idname= "IMAGE_OT_properties";
- ot->description= "Toggle display properties panel";
+ ot->name = "Properties";
+ ot->idname = "IMAGE_OT_properties";
+ ot->description = "Toggle display properties panel";
- ot->exec= image_properties;
- ot->poll= ED_operator_image_active;
+ ot->exec = image_properties;
+ ot->poll = ED_operator_image_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
static int image_scopes(bContext *C, wmOperator *UNUSED(op))
@@ -933,7 +933,7 @@ static int image_scopes(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= image_has_scope_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -941,14 +941,14 @@ static int image_scopes(bContext *C, wmOperator *UNUSED(op))
void IMAGE_OT_scopes(wmOperatorType *ot)
{
- ot->name= "Scopes";
- ot->idname= "IMAGE_OT_scopes";
- ot->description= "Toggle display scopes panel";
+ ot->name = "Scopes";
+ ot->idname = "IMAGE_OT_scopes";
+ ot->description = "Toggle display scopes panel";
- ot->exec= image_scopes;
- ot->poll= ED_operator_image_active;
+ ot->exec = image_scopes;
+ ot->poll = ED_operator_image_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index e91a44e0358..59ca1925abf 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -80,14 +80,14 @@ static void image_verify_buffer_float(Image *ima, ImBuf *ibuf, int color_manage)
{
/* detect if we need to redo the curve map.
* ibuf->rect is zero for compositor and render results after change
- * convert to 32 bits always... drawing float rects isnt supported well (atis)
+ * convert to 32 bits always... drawing float rects isn't supported well (atis)
*
* NOTE: if float buffer changes, we have to manually remove the rect
*/
- if(ibuf->rect_float && (ibuf->rect==NULL || (ibuf->userflags & IB_RECT_INVALID)) ) {
- if(color_manage) {
- if(ima && ima->source == IMA_SRC_VIEWER)
+ if (ibuf->rect_float && (ibuf->rect==NULL || (ibuf->userflags & IB_RECT_INVALID)) ) {
+ if (color_manage) {
+ if (ima && ima->source == IMA_SRC_VIEWER)
ibuf->profile = IB_PROFILE_LINEAR_RGB;
}
else
@@ -103,7 +103,7 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar)
rr= BKE_image_acquire_renderresult(scene, ima);
- if(rr && rr->text) {
+ if (rr && rr->text) {
ED_region_info_draw(ar, rr->text, 1, 0.25);
}
@@ -147,14 +147,14 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
- if(zp) {
+ if (zp) {
glColor3ub(255, 255, 255);
BLI_snprintf(str, sizeof(str), " Z:%-.4f |", 0.5f+0.5f*(((float)*zp)/(float)0x7fffffff));
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
- if(zpf) {
+ if (zpf) {
glColor3ub(255, 255, 255);
BLI_snprintf(str, sizeof(str), " Z:%-.3f |", *zpf);
BLF_position(blf_mono_font, dx, 6, 0);
@@ -162,7 +162,7 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
dx += BLF_width(blf_mono_font, str);
}
- if(channels >= 3) {
+ if (channels >= 3) {
glColor3ubv(red);
if (fp)
BLI_snprintf(str, sizeof(str), " R:%-.4f", fp[0]);
@@ -196,7 +196,7 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
- if(channels == 4) {
+ if (channels == 4) {
glColor3ub(255, 255, 255);
if (fp)
BLI_snprintf(str, sizeof(str), " A:%-.4f", fp[3]);
@@ -265,10 +265,20 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
glVertex2f(dx+30, 17);
glVertex2f(dx+30, 3);
glEnd();
+
+ /* draw outline */
+ glColor3ub(128, 128, 128);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(dx, 3);
+ glVertex2f(dx, 17);
+ glVertex2f(dx+30, 17);
+ glVertex2f(dx+30, 3);
+ glEnd();
+
dx += 35;
glColor3ub(255, 255, 255);
- if(channels == 1) {
+ if (channels == 1) {
if (fp) {
rgb_to_hsv(fp[0], fp[0], fp[0], &hue, &sat, &val);
rgb_to_yuv(fp[0], fp[0], fp[0], &lum, &u, &v);
@@ -288,7 +298,7 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
- else if(channels >= 3) {
+ else if (channels >= 3) {
if (fp) {
rgb_to_hsv(fp[0], fp[1], fp[2], &hue, &sat, &val);
rgb_to_yuv(fp[0], fp[1], fp[2], &lum, &u, &v);
@@ -339,16 +349,16 @@ static void draw_image_grid(ARegion *ar, float zoomx, float zoomy)
/* gridsize adapted to zoom level */
gridsize= 0.5f*(zoomx+zoomy);
- if(gridsize<=0.0f) return;
+ if (gridsize<=0.0f) return;
- if(gridsize<1.0f) {
- while(gridsize<1.0f) {
+ if (gridsize<1.0f) {
+ while (gridsize<1.0f) {
gridsize*= 4.0f;
gridstep*= 4.0f;
}
}
else {
- while(gridsize>=4.0f) {
+ while (gridsize>=4.0f) {
gridsize/= 4.0f;
gridstep/= 4.0f;
}
@@ -361,7 +371,7 @@ static void draw_image_grid(ARegion *ar, float zoomx, float zoomy)
fac= 0.0f;
glBegin(GL_LINES);
- while(fac<1.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);
@@ -373,7 +383,7 @@ static void draw_image_grid(ARegion *ar, float zoomx, float zoomy)
UI_ThemeColor(TH_BACK);
fac= 0.0f;
- while(fac<1.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);
@@ -411,7 +421,7 @@ static void sima_draw_alpha_pixels(float x1, float y1, int rectx, int recty, uns
{
/* swap bytes, so alpha is most significant one, then just draw it as luminance int */
- if(ENDIAN_ORDER == B_ENDIAN)
+ if (ENDIAN_ORDER == B_ENDIAN)
glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_UNSIGNED_INT, recti);
@@ -423,7 +433,7 @@ static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, fl
float *trectf= MEM_mallocN(rectx*recty*4, "temp");
int a, b;
- for(a= rectx*recty -1, b= 4*a+3; a>=0; a--, b-=4)
+ for (a= rectx*recty -1, b= 4*a+3; a>=0; a--, b-=4)
trectf[a]= rectf[b];
glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_FLOAT, trectf);
@@ -463,7 +473,7 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rec
float bias, scale, *rectf, clipend;
int a;
- if(scene->camera && scene->camera->type==OB_CAMERA) {
+ if (scene->camera && scene->camera->type==OB_CAMERA) {
bias= ((Camera *)scene->camera->data)->clipsta;
clipend= ((Camera *)scene->camera->data)->clipend;
scale= 1.0f/(clipend-bias);
@@ -475,10 +485,10 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rec
}
rectf= MEM_mallocN(rectx*recty*4, "temp");
- for(a= rectx*recty -1; a>=0; a--) {
- if(rect_float[a]>clipend)
+ for (a= rectx*recty -1; a>=0; a--) {
+ if (rect_float[a]>clipend)
rectf[a]= 0.0f;
- else if(rect_float[a]<bias)
+ else if (rect_float[a]<bias)
rectf[a]= 1.0f;
else {
rectf[a]= 1.0f - (rect_float[a]-bias)*scale;
@@ -502,22 +512,22 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image
UI_view2d_to_region_no_clip(&ar->v2d, fx, fy, &x, &y);
/* this part is generic image display */
- if(sima->flag & SI_SHOW_ALPHA) {
- if(ibuf->rect)
+ if (sima->flag & SI_SHOW_ALPHA) {
+ if (ibuf->rect)
sima_draw_alpha_pixels(x, y, ibuf->x, ibuf->y, ibuf->rect);
- else if(ibuf->rect_float && ibuf->channels==4)
+ else if (ibuf->rect_float && ibuf->channels==4)
sima_draw_alpha_pixelsf(x, y, ibuf->x, ibuf->y, ibuf->rect_float);
}
- else if(sima->flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1))) {
- if(ibuf->zbuf)
+ else if (sima->flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1))) {
+ if (ibuf->zbuf)
sima_draw_zbuf_pixels(x, y, ibuf->x, ibuf->y, ibuf->zbuf);
- else if(ibuf->zbuf_float)
+ else if (ibuf->zbuf_float)
sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->zbuf_float);
- else if(ibuf->channels==1)
+ else if (ibuf->channels==1)
sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->rect_float);
}
else {
- if(sima->flag & SI_USE_ALPHA) {
+ if (sima->flag & SI_USE_ALPHA) {
unsigned char col1[3]= {100, 100, 100}, col2[3]= {160, 160, 160};
sima_draw_alpha_backdrop(x, y, ibuf->x, ibuf->y, zoomx, zoomy, col1, col2);
@@ -529,14 +539,14 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image
* convert them, and optionally apply curves */
image_verify_buffer_float(ima, ibuf, color_manage);
- if(ibuf->rect)
+ if (ibuf->rect)
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
#if 0
else
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_FLOAT, ibuf->rect_float);
#endif
- if(sima->flag & SI_USE_ALPHA)
+ if (sima->flag & SI_USE_ALPHA)
glDisable(GL_BLEND);
}
@@ -558,7 +568,7 @@ static unsigned int *get_part_from_ibuf(ImBuf *ibuf, short startx, short starty,
rp=rectmain= MEM_mallocN(heigth*len*sizeof(int), "rect");
- for(y=0; y<heigth; y++) {
+ for (y=0; y<heigth; y++) {
memcpy(rp, rt, len*4);
rt+= ibuf->x;
rp+= len;
@@ -573,12 +583,12 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene,
int color_manage = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
/* verify valid values, just leave this a while */
- if(ima->xrep<1) return;
- if(ima->yrep<1) return;
+ if (ima->xrep<1) return;
+ if (ima->yrep<1) return;
glPixelZoom(zoomx, zoomy);
- if(sima->curtile >= ima->xrep*ima->yrep)
+ if (sima->curtile >= ima->xrep*ima->yrep)
sima->curtile = ima->xrep*ima->yrep - 1;
/* create char buffer from float if needed */
@@ -592,8 +602,8 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene,
rect= get_part_from_ibuf(ibuf, sx, sy, sx+dx, sy+dy);
/* draw repeated */
- for(sy=0; sy+dy<=ibuf->y; sy+= dy) {
- for(sx=0; sx+dx<=ibuf->x; sx+= dx) {
+ for (sy=0; sy+dy<=ibuf->y; sy+= dy) {
+ for (sx=0; sx+dx<=ibuf->x; sx+= dx) {
UI_view2d_to_region_no_clip(&ar->v2d, fx + (float)sx/(float)ibuf->x, fy + (float)sy/(float)ibuf->y, &x, &y);
glaDrawPixelsSafe(x, y, dx, dy, dx, GL_RGBA, GL_UNSIGNED_BYTE, rect);
@@ -616,16 +626,16 @@ static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *sce
int x;
- for(x=xmin; x<xmax; x++) {
+ for (x=xmin; x<xmax; x++) {
int y;
- for(y=ymin; y<ymax; y++) {
- if(ima && (ima->tpageflag & IMA_TILES))
+ for (y=ymin; y<ymax; y++) {
+ if (ima && (ima->tpageflag & IMA_TILES))
draw_image_buffer_tiled(sima, ar, scene, ima, ibuf, x, y, zoomx, zoomy);
else
draw_image_buffer(sima, ar, scene, ima, ibuf, x, y, zoomx, zoomy);
/* only draw until running out of time */
- if((PIL_check_seconds_timer() - time_current) > 0.25)
+ if ((PIL_check_seconds_timer() - time_current) > 0.25)
return;
}
}
@@ -669,15 +679,15 @@ static void draw_image_view_tool(Scene *scene)
float radius;
int draw= 0;
- if(brush) {
- if(settings->imapaint.flag & IMAGEPAINT_DRAWING) {
- if(settings->imapaint.flag & IMAGEPAINT_DRAW_TOOL_DRAWING)
+ if (brush) {
+ if (settings->imapaint.flag & IMAGEPAINT_DRAWING) {
+ if (settings->imapaint.flag & IMAGEPAINT_DRAW_TOOL_DRAWING)
draw= 1;
}
- else if(settings->imapaint.flag & IMAGEPAINT_DRAW_TOOL)
+ else if (settings->imapaint.flag & IMAGEPAINT_DRAW_TOOL)
draw= 1;
- if(draw) {
+ if (draw) {
getmouseco_areawin(mval);
radius= brush_size(brush)*G.sima->zoom;
@@ -699,16 +709,16 @@ static unsigned char *get_alpha_clone_image(Scene *scene, int *width, int *heigh
unsigned int size, alpha;
unsigned char *rect, *cp;
- if(!brush || !brush->clone.image)
+ if (!brush || !brush->clone.image)
return NULL;
ibuf= BKE_image_get_ibuf(brush->clone.image, NULL);
- if(!ibuf || !ibuf->rect)
+ if (!ibuf || !ibuf->rect)
return NULL;
rect= MEM_dupallocN(ibuf->rect);
- if(!rect)
+ if (!rect)
return NULL;
*width= ibuf->x;
@@ -718,7 +728,7 @@ static unsigned char *get_alpha_clone_image(Scene *scene, int *width, int *heigh
alpha= (unsigned char)255*brush->clone.alpha;
cp= rect;
- while(size-- > 0) {
+ while (size-- > 0) {
cp[3]= alpha;
cp += 4;
}
@@ -734,12 +744,12 @@ static void draw_image_paint_helpers(ARegion *ar, Scene *scene, float zoomx, flo
brush= paint_brush(&scene->toolsettings->imapaint.paint);
- if(brush && (brush->imagepaint_tool == PAINT_TOOL_CLONE)) {
+ if (brush && (brush->imagepaint_tool == PAINT_TOOL_CLONE)) {
/* this is not very efficient, but glDrawPixels doesn't allow
* drawing with alpha */
clonerect= get_alpha_clone_image(scene, &w, &h);
- if(clonerect) {
+ if (clonerect) {
UI_view2d_to_region_no_clip(&ar->v2d, brush->clone.offset[0], brush->clone.offset[1], &x, &y);
glPixelZoom(zoomx, zoomy);
@@ -770,13 +780,13 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
#if 0
what_image(sima);
- if(sima->image) {
+ if (sima->image) {
ED_image_aspect(sima->image, &xuser_asp, &yuser_asp);
/* UGLY hack? until now iusers worked fine... but for flipbook viewer we need this */
- if(sima->image->type==IMA_TYPE_COMPOSITE) {
+ if (sima->image->type==IMA_TYPE_COMPOSITE) {
ImageUser *iuser= ntree_get_active_iuser(scene->nodetree);
- if(iuser) {
+ if (iuser) {
BKE_image_user_calc_imanr(iuser, scene->r.cfra, 0);
sima->iuser= *iuser;
}
@@ -795,26 +805,26 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
show_render= (show_viewer && ima->type == IMA_TYPE_R_RESULT);
/* draw the image or grid */
- if(ibuf==NULL)
+ if (ibuf==NULL)
draw_image_grid(ar, zoomx, zoomy);
- else if(sima->flag & SI_DRAW_TILE)
+ 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))
+ else if (ima && (ima->tpageflag & IMA_TILES))
draw_image_buffer_tiled(sima, ar, scene, ima, ibuf, 0.0f, 0.0, zoomx, zoomy);
else
draw_image_buffer(sima, ar, scene, ima, ibuf, 0.0f, 0.0f, zoomx, zoomy);
/* paint helpers */
- if(sima->flag & SI_DRAWTOOL)
+ if (sima->flag & SI_DRAWTOOL)
draw_image_paint_helpers(ar, scene, zoomx, zoomy);
/* XXX integrate this code */
#if 0
- if(ibuf) {
+ if (ibuf) {
float xoffs=0.0f, yoffs= 0.0f;
- if(image_preview_active(sa, &xim, &yim)) {
+ if (image_preview_active(sa, &xim, &yim)) {
xoffs= scene->r.disprect.xmin;
yoffs= scene->r.disprect.ymin;
glColor3ub(0,0,0);
@@ -829,7 +839,7 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
ED_space_image_release_buffer(sima, lock);
/* render info */
- if(ima && show_render)
+ if (ima && show_render)
draw_render_info(scene, ima, ar);
}
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index ae47125fa84..be53b03bec6 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -96,15 +96,15 @@ static void sima_zoom_set(SpaceImage *sima, ARegion *ar, float zoom, float locat
width *= sima->zoom;
height *= sima->zoom;
- if((width < 4) && (height < 4))
+ if ((width < 4) && (height < 4))
sima->zoom= oldzoom;
- else if((ar->winrct.xmax - ar->winrct.xmin) <= sima->zoom)
+ else if ((ar->winrct.xmax - ar->winrct.xmin) <= sima->zoom)
sima->zoom= oldzoom;
- else if((ar->winrct.ymax - ar->winrct.ymin) <= sima->zoom)
+ else if ((ar->winrct.ymax - ar->winrct.ymin) <= sima->zoom)
sima->zoom= oldzoom;
}
- if((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
+ if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
float aspx, aspy, w, h;
ED_space_image_size(sima, &width, &height);
@@ -133,15 +133,15 @@ static int image_poll(bContext *C)
static int space_image_buffer_exists_poll(bContext *C)
{
SpaceImage *sima= CTX_wm_space_image(C);
- if(sima && sima->spacetype==SPACE_IMAGE)
- if(ED_space_image_has_buffer(sima))
+ if (sima && sima->spacetype==SPACE_IMAGE)
+ if (ED_space_image_has_buffer(sima))
return 1;
return 0;
}
static int space_image_file_exists_poll(bContext *C)
{
- if(space_image_buffer_exists_poll(C)) {
+ if (space_image_buffer_exists_poll(C)) {
Main *bmain= CTX_data_main(C);
SpaceImage *sima= CTX_wm_space_image(C);
ImBuf *ibuf;
@@ -150,11 +150,11 @@ static int space_image_file_exists_poll(bContext *C)
char name[FILE_MAX];
ibuf= ED_space_image_acquire_buffer(sima, &lock);
- if(ibuf) {
+ if (ibuf) {
BLI_strncpy(name, ibuf->name, FILE_MAX);
BLI_path_abs(name, bmain->name);
- if(BLI_exists(name) == FALSE) {
+ if (BLI_exists(name) == FALSE) {
CTX_wm_operator_poll_msg_set(C, "image file not found");
}
else if (BLI_file_is_writable(name) == FALSE) {
@@ -174,7 +174,7 @@ static int space_image_file_exists_poll(bContext *C)
static int space_image_poll(bContext *C)
{
SpaceImage *sima= CTX_wm_space_image(C);
- if(sima && sima->spacetype==SPACE_IMAGE && sima->image)
+ if (sima && sima->spacetype==SPACE_IMAGE && sima->image)
return 1;
return 0;
}
@@ -184,7 +184,7 @@ int space_image_main_area_poll(bContext *C)
SpaceImage *sima= CTX_wm_space_image(C);
// XXX ARegion *ar= CTX_wm_region(C);
- if(sima)
+ if (sima)
return 1; // XXX (ar && ar->type->regionid == RGN_TYPE_WINDOW);
return 0;
@@ -196,7 +196,7 @@ int space_image_main_area_not_uv_brush_poll(bContext *C)
SpaceImage *sima= CTX_wm_space_image(C);
ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
- if(sima && !toolsettings->uvsculpt)
+ if (sima && !toolsettings->uvsculpt)
return 1;
return 0;
@@ -208,8 +208,8 @@ static int space_image_image_sample_poll(bContext *C)
Object *obedit= CTX_data_edit_object(C);
ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
- if(obedit){
- if(ED_space_image_show_uvedit(sima, obedit) && (toolsettings->use_uv_sculpt))
+ if (obedit) {
+ if (ED_space_image_show_uvedit(sima, obedit) && (toolsettings->use_uv_sculpt))
return 0;
}
return space_image_main_area_poll(C);
@@ -244,7 +244,7 @@ static void image_view_pan_exit(bContext *C, wmOperator *op, int cancel)
SpaceImage *sima= CTX_wm_space_image(C);
ViewPanData *vpd= op->customdata;
- if(cancel) {
+ if (cancel) {
sima->xof= vpd->xof;
sima->yof= vpd->yof;
ED_region_tag_redraw(CTX_wm_region(C));
@@ -267,7 +267,7 @@ static int image_view_pan_exec(bContext *C, wmOperator *op)
/* XXX notifier? */
#if 0
- if(image_preview_active(curarea, NULL, NULL)) {
+ if (image_preview_active(curarea, NULL, NULL)) {
/* recalculates new preview rect */
scrarea_do_windraw(curarea);
image_preview_event(2);
@@ -312,7 +312,7 @@ static int image_view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
image_view_pan_exec(C, op);
break;
default:
- if(event->type==vpd->event_type && event->val==KM_RELEASE) {
+ if (event->type==vpd->event_type && event->val==KM_RELEASE) {
image_view_pan_exit(C, op, 0);
return OPERATOR_FINISHED;
}
@@ -331,18 +331,18 @@ static int image_view_pan_cancel(bContext *C, wmOperator *op)
void IMAGE_OT_view_pan(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Pan";
- ot->idname= "IMAGE_OT_view_pan";
+ ot->name = "View Pan";
+ ot->idname = "IMAGE_OT_view_pan";
/* api callbacks */
- ot->exec= image_view_pan_exec;
- ot->invoke= image_view_pan_invoke;
- ot->modal= image_view_pan_modal;
- ot->cancel= image_view_pan_cancel;
- ot->poll= space_image_main_area_poll;
+ ot->exec = image_view_pan_exec;
+ ot->invoke = image_view_pan_invoke;
+ ot->modal = image_view_pan_modal;
+ ot->cancel = image_view_pan_cancel;
+ ot->poll = space_image_main_area_poll;
/* flags */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
/* properties */
RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX,
@@ -382,7 +382,7 @@ static void image_view_zoom_exit(bContext *C, wmOperator *op, int cancel)
SpaceImage *sima= CTX_wm_space_image(C);
ViewZoomData *vpd= op->customdata;
- if(cancel) {
+ if (cancel) {
sima->zoom= vpd->zoom;
ED_region_tag_redraw(CTX_wm_region(C));
}
@@ -402,7 +402,7 @@ static int image_view_zoom_exec(bContext *C, wmOperator *op)
/* XXX notifier? */
#if 0
- if(image_preview_active(curarea, NULL, NULL)) {
+ if (image_preview_active(curarea, NULL, NULL)) {
/* recalculates new preview rect */
scrarea_do_windraw(curarea);
image_preview_event(2);
@@ -449,7 +449,7 @@ static int image_view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
ED_region_tag_redraw(CTX_wm_region(C));
break;
default:
- if(event->type==vpd->event_type && event->val==KM_RELEASE) {
+ if (event->type==vpd->event_type && event->val==KM_RELEASE) {
image_view_zoom_exit(C, op, 0);
return OPERATOR_FINISHED;
}
@@ -468,18 +468,18 @@ static int image_view_zoom_cancel(bContext *C, wmOperator *op)
void IMAGE_OT_view_zoom(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Zoom";
- ot->idname= "IMAGE_OT_view_zoom";
+ ot->name = "View Zoom";
+ ot->idname = "IMAGE_OT_view_zoom";
/* api callbacks */
- ot->exec= image_view_zoom_exec;
- ot->invoke= image_view_zoom_invoke;
- ot->modal= image_view_zoom_modal;
- ot->cancel= image_view_zoom_cancel;
- ot->poll= space_image_main_area_poll;
+ ot->exec = image_view_zoom_exec;
+ ot->invoke = image_view_zoom_invoke;
+ ot->modal = image_view_zoom_modal;
+ ot->cancel = image_view_zoom_cancel;
+ ot->poll = space_image_main_area_poll;
/* flags */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
/* properties */
RNA_def_float(ot->srna, "factor", 0.0f, 0.0f, FLT_MAX,
@@ -536,11 +536,11 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *
void IMAGE_OT_view_ndof(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "NDOF Pan/Zoom";
- ot->idname= "IMAGE_OT_view_ndof";
+ ot->name = "NDOF Pan/Zoom";
+ ot->idname = "IMAGE_OT_view_ndof";
/* api callbacks */
- ot->invoke= image_view_ndof_invoke;
+ ot->invoke = image_view_ndof_invoke;
}
/********************** view all operator *********************/
@@ -570,7 +570,7 @@ static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op))
width = ar->winrct.xmax - ar->winrct.xmin + 1;
height = ar->winrct.ymax - ar->winrct.ymin + 1;
- if((w >= width || h >= height) && (width > 0 && height > 0)) {
+ if ((w >= width || h >= height) && (width > 0 && height > 0)) {
/* find the zoom value that will fit the image in the image space */
zoomx= width/w;
zoomy= height/h;
@@ -589,12 +589,12 @@ static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op))
void IMAGE_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View All";
- ot->idname= "IMAGE_OT_view_all";
+ ot->name = "View All";
+ ot->idname = "IMAGE_OT_view_all";
/* api callbacks */
- ot->exec= image_view_all_exec;
- ot->poll= space_image_main_area_poll;
+ ot->exec = image_view_all_exec;
+ ot->poll = space_image_main_area_poll;
}
/********************** view selected operator *********************/
@@ -623,7 +623,7 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
height= height*aspy;
/* get bounds */
- if(!ED_uvedit_minmax(scene, ima, obedit, min, max))
+ if (!ED_uvedit_minmax(scene, ima, obedit, min, max))
return OPERATOR_CANCELLED;
/* adjust offset and zoom */
@@ -634,7 +634,7 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
d[1]= max[1] - min[1];
size= 0.5f*MAX2(d[0], d[1])*MAX2(width, height)/256.0f;
- if(size<=0.01f) size= 0.01f;
+ if (size<=0.01f) size= 0.01f;
sima_zoom_set(sima, ar, 0.7f/size, NULL);
ED_region_tag_redraw(CTX_wm_region(C));
@@ -650,12 +650,12 @@ static int image_view_selected_poll(bContext *C)
void IMAGE_OT_view_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Center";
- ot->idname= "IMAGE_OT_view_selected";
+ ot->name = "View Center";
+ ot->idname = "IMAGE_OT_view_selected";
/* api callbacks */
- ot->exec= image_view_selected_exec;
- ot->poll= image_view_selected_poll;
+ ot->exec = image_view_selected_exec;
+ ot->poll = image_view_selected_poll;
}
/********************** view zoom in/out operator *********************/
@@ -689,13 +689,13 @@ static int image_view_zoom_in_invoke(bContext *C, wmOperator *op, wmEvent *event
void IMAGE_OT_view_zoom_in(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Zoom In";
- ot->idname= "IMAGE_OT_view_zoom_in";
+ ot->name = "View Zoom In";
+ ot->idname = "IMAGE_OT_view_zoom_in";
/* api callbacks */
- ot->invoke= image_view_zoom_in_invoke;
- ot->exec= image_view_zoom_in_exec;
- ot->poll= space_image_main_area_poll;
+ ot->invoke = image_view_zoom_in_invoke;
+ ot->exec = image_view_zoom_in_exec;
+ ot->poll = space_image_main_area_poll;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
@@ -730,13 +730,13 @@ static int image_view_zoom_out_invoke(bContext *C, wmOperator *op, wmEvent *even
void IMAGE_OT_view_zoom_out(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Zoom Out";
- ot->idname= "IMAGE_OT_view_zoom_out";
+ ot->name = "View Zoom Out";
+ ot->idname = "IMAGE_OT_view_zoom_out";
/* api callbacks */
- ot->invoke= image_view_zoom_out_invoke;
- ot->exec= image_view_zoom_out_exec;
- ot->poll= space_image_main_area_poll;
+ ot->invoke = image_view_zoom_out_invoke;
+ ot->exec = image_view_zoom_out_exec;
+ ot->poll = space_image_main_area_poll;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
@@ -757,7 +757,7 @@ static int image_view_zoom_ratio_exec(bContext *C, wmOperator *op)
/* XXX notifier? */
#if 0
- if(image_preview_active(curarea, NULL, NULL)) {
+ if (image_preview_active(curarea, NULL, NULL)) {
/* recalculates new preview rect */
scrarea_do_windraw(curarea);
image_preview_event(2);
@@ -772,12 +772,12 @@ static int image_view_zoom_ratio_exec(bContext *C, wmOperator *op)
void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Zoom Ratio";
- ot->idname= "IMAGE_OT_view_zoom_ratio";
+ ot->name = "View Zoom Ratio";
+ ot->idname = "IMAGE_OT_view_zoom_ratio";
/* api callbacks */
- ot->exec= image_view_zoom_ratio_exec;
- ot->poll= space_image_main_area_poll;
+ ot->exec = image_view_zoom_ratio_exec;
+ ot->poll = space_image_main_area_poll;
/* properties */
RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX,
@@ -826,19 +826,19 @@ static int image_open_exec(bContext *C, wmOperator *op)
ima= BKE_add_image_file(str);
- if(!ima) {
- if(op->customdata) MEM_freeN(op->customdata);
+ if (!ima) {
+ if (op->customdata) MEM_freeN(op->customdata);
BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s", str, errno ? strerror(errno) : "Unsupported image format");
return OPERATOR_CANCELLED;
}
- if(!op->customdata)
+ if (!op->customdata)
image_open_init(C, op);
/* hook into UI */
pprop= op->customdata;
- if(pprop->prop) {
+ if (pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
ima->id.us--;
@@ -847,19 +847,19 @@ static int image_open_exec(bContext *C, wmOperator *op)
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
RNA_property_update(C, &pprop->ptr, pprop->prop);
}
- else if(sima) {
+ else if (sima) {
ED_space_image_set(sima, scene, obedit, ima);
iuser= &sima->iuser;
}
else {
Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
- if(tex && tex->type==TEX_IMAGE)
+ if (tex && tex->type==TEX_IMAGE)
iuser= &tex->iuser;
}
/* initialize because of new image */
- if(iuser) {
+ if (iuser) {
iuser->sfra= 1;
iuser->offset= 0;
iuser->fie_ima= 2;
@@ -882,20 +882,20 @@ static int image_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
char *path=U.textudir;
Image *ima= NULL;
- if(sima) {
+ if (sima) {
ima= sima->image;
}
if (ima==NULL) {
Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
- if(tex && tex->type==TEX_IMAGE)
+ if (tex && tex->type==TEX_IMAGE)
ima= tex->ima;
}
- if(ima)
+ if (ima)
path= ima->name;
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return image_open_exec(C, op);
image_open_init(C, op);
@@ -909,17 +909,17 @@ static int image_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
void IMAGE_OT_open(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Open Image";
- ot->description= "Open image";
- ot->idname= "IMAGE_OT_open";
+ ot->name = "Open Image";
+ ot->description = "Open image";
+ ot->idname = "IMAGE_OT_open";
/* api callbacks */
- ot->exec= image_open_exec;
- ot->invoke= image_open_invoke;
- ot->cancel= image_open_cancel;
+ ot->exec = image_open_exec;
+ ot->invoke = image_open_invoke;
+ ot->cancel = image_open_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -932,7 +932,7 @@ static int image_replace_exec(bContext *C, wmOperator *op)
SpaceImage *sima= CTX_wm_space_image(C);
char str[FILE_MAX];
- if(!sima->image)
+ if (!sima->image)
return OPERATOR_CANCELLED;
RNA_string_get(op->ptr, "filepath", str);
@@ -958,13 +958,13 @@ static int image_replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
{
SpaceImage *sima= CTX_wm_space_image(C);
- if(!sima->image)
+ if (!sima->image)
return OPERATOR_CANCELLED;
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return image_replace_exec(C, op);
- if(!RNA_struct_property_is_set(op->ptr, "relative_path"))
+ if (!RNA_struct_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", (strncmp(sima->image->name, "//", 2))==0);
image_filesel(C, op, sima->image->name);
@@ -975,16 +975,16 @@ static int image_replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
void IMAGE_OT_replace(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Replace Image";
- ot->idname= "IMAGE_OT_replace";
+ ot->name = "Replace Image";
+ ot->idname = "IMAGE_OT_replace";
/* api callbacks */
- ot->exec= image_replace_exec;
- ot->invoke= image_replace_invoke;
- ot->poll= space_image_poll;
+ ot->exec = image_replace_exec;
+ ot->invoke = image_replace_invoke;
+ ot->poll = space_image_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -1035,13 +1035,13 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
void *lock;
ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
- if(ibuf) {
+ if (ibuf) {
Image *ima= sima->image;
short is_depth_set= FALSE;
simopts->im_format.planes= ibuf->planes;
- if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
+ if (ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
/* imtype */
simopts->im_format= scene->r.im_format;
is_depth_set= TRUE;
@@ -1069,16 +1069,17 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
simopts->im_format.depth= imtype_best_depth(ibuf, simopts->im_format.imtype);
}
- /* some formats dont use quality so fallback to scenes quality */
+ /* some formats don't use quality so fallback to scenes quality */
if (simopts->im_format.quality == 0) {
simopts->im_format.quality= scene->r.im_format.quality;
}
/* check for empty path */
- if(guess_path && simopts->filepath[0]==0) {
+ if (guess_path && simopts->filepath[0]==0) {
if ( (G.ima[0] == '/') && (G.ima[1] == '/') && (G.ima[2] == '\0') ) {
BLI_strncpy(simopts->filepath, "//untitled", FILE_MAX);
- } else {
+ }
+ else {
BLI_strncpy(simopts->filepath, G.ima, FILE_MAX);
}
BLI_path_abs(simopts->filepath, G.main->name);
@@ -1130,27 +1131,27 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
WM_cursor_wait(1);
- if(ima->type == IMA_TYPE_R_RESULT) {
+ if (ima->type == IMA_TYPE_R_RESULT) {
/* enforce user setting for RGB or RGBA, but skip BW */
- if(simopts->im_format.planes==R_IMF_PLANES_RGBA) {
+ if (simopts->im_format.planes==R_IMF_PLANES_RGBA) {
ibuf->planes= R_IMF_PLANES_RGBA;
}
- else if(simopts->im_format.planes==R_IMF_PLANES_RGB) {
+ else if (simopts->im_format.planes==R_IMF_PLANES_RGB) {
ibuf->planes= R_IMF_PLANES_RGB;
}
}
else {
/* TODO, better solution, if a 24bit image is painted onto it may contain alpha */
- if(ibuf->userflags & IB_BITMAPDIRTY) { /* it has been painted onto */
+ if (ibuf->userflags & IB_BITMAPDIRTY) { /* it has been painted onto */
/* checks each pixel, not ideal */
ibuf->planes= BKE_alphatest_ibuf(ibuf) ? 32 : 24;
}
}
- if(simopts->im_format.imtype==R_IMF_IMTYPE_MULTILAYER) {
+ if (simopts->im_format.imtype==R_IMF_IMTYPE_MULTILAYER) {
Scene *scene= CTX_data_scene(C);
RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
- if(rr) {
+ if (rr) {
RE_WriteRenderResult(op->reports, rr, simopts->filepath, simopts->im_format.quality);
ok= TRUE;
}
@@ -1166,8 +1167,8 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
}
if (ok) {
- if(!save_copy) {
- if(do_newpath) {
+ if (!save_copy) {
+ if (do_newpath) {
BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name));
BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name));
}
@@ -1175,28 +1176,28 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
ibuf->userflags &= ~IB_BITMAPDIRTY;
/* change type? */
- if(ima->type==IMA_TYPE_R_RESULT) {
+ if (ima->type==IMA_TYPE_R_RESULT) {
ima->type= IMA_TYPE_IMAGE;
/* workaround to ensure the render result buffer is no longer used
* by this image, otherwise can crash when a new render result is
* created. */
- if(ibuf->rect && !(ibuf->mall & IB_rect))
+ if (ibuf->rect && !(ibuf->mall & IB_rect))
imb_freerectImBuf(ibuf);
- if(ibuf->rect_float && !(ibuf->mall & IB_rectfloat))
+ if (ibuf->rect_float && !(ibuf->mall & IB_rectfloat))
imb_freerectfloatImBuf(ibuf);
- if(ibuf->zbuf && !(ibuf->mall & IB_zbuf))
+ if (ibuf->zbuf && !(ibuf->mall & IB_zbuf))
IMB_freezbufImBuf(ibuf);
- if(ibuf->zbuf_float && !(ibuf->mall & IB_zbuffloat))
+ if (ibuf->zbuf_float && !(ibuf->mall & IB_zbuffloat))
IMB_freezbuffloatImBuf(ibuf);
}
- if( ELEM(ima->source, IMA_SRC_GENERATED, IMA_SRC_VIEWER)) {
+ if ( ELEM(ima->source, IMA_SRC_GENERATED, IMA_SRC_VIEWER)) {
ima->source= IMA_SRC_FILE;
ima->type= IMA_TYPE_IMAGE;
}
/* only image path, never ibuf */
- if(relative) {
+ if (relative) {
BLI_path_rel(ima->name, relbase); /* only after saving */
}
}
@@ -1247,7 +1248,7 @@ static int image_save_as_check(bContext *UNUSED(C), wmOperator *op)
ImageFormatData *imf= op->customdata;
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
- if(BKE_add_image_extension(filepath, imf->imtype)) {
+ if (BKE_add_image_extension(filepath, imf->imtype)) {
RNA_string_set(op->ptr, "filepath", filepath);
return TRUE;
}
@@ -1261,7 +1262,7 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
Scene *scene= CTX_data_scene(C);
SaveImageOptions simopts;
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return image_save_as_exec(C, op);
if (save_image_options_init(&simopts, sima, scene, TRUE) == 0)
@@ -1269,7 +1270,7 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
save_image_options_to_op(&simopts, op);
/* enable save_copy by default for render results */
- if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_struct_property_is_set(op->ptr, "copy")) {
+ if (ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_struct_property_is_set(op->ptr, "copy")) {
RNA_boolean_set(op->ptr, "copy", TRUE);
}
@@ -1320,19 +1321,19 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
// PropertyRNA *prop;
/* identifiers */
- ot->name= "Save As Image";
- ot->idname= "IMAGE_OT_save_as";
+ ot->name = "Save As Image";
+ ot->idname = "IMAGE_OT_save_as";
/* api callbacks */
- ot->exec= image_save_as_exec;
- ot->check= image_save_as_check;
- ot->invoke= image_save_as_invoke;
- ot->cancel= image_save_as_cancel;
- ot->ui= image_save_as_draw;
- ot->poll= space_image_buffer_exists_poll;
+ ot->exec = image_save_as_exec;
+ ot->check = image_save_as_check;
+ ot->invoke = image_save_as_invoke;
+ ot->cancel = image_save_as_cancel;
+ ot->ui = image_save_as_draw;
+ ot->poll = space_image_buffer_exists_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender");
@@ -1366,15 +1367,15 @@ static int image_save_exec(bContext *C, wmOperator *op)
void IMAGE_OT_save(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Save Image";
- ot->idname= "IMAGE_OT_save";
+ ot->name = "Save Image";
+ ot->idname = "IMAGE_OT_save";
/* api callbacks */
- ot->exec= image_save_exec;
- ot->poll= space_image_file_exists_poll;
+ ot->exec = image_save_exec;
+ ot->poll = space_image_file_exists_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/******************* save sequence operator ********************/
@@ -1387,32 +1388,32 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
int tot= 0;
char di[FILE_MAX], fi[FILE_MAX];
- if(sima->image==NULL)
+ if (sima->image==NULL)
return OPERATOR_CANCELLED;
- if(sima->image->source!=IMA_SRC_SEQUENCE) {
+ if (sima->image->source!=IMA_SRC_SEQUENCE) {
BKE_report(op->reports, RPT_ERROR, "Can only save sequence on image sequences");
return OPERATOR_CANCELLED;
}
- if(sima->image->type==IMA_TYPE_MULTILAYER) {
+ if (sima->image->type==IMA_TYPE_MULTILAYER) {
BKE_report(op->reports, RPT_ERROR, "Can't save multilayer sequences");
return OPERATOR_CANCELLED;
}
/* get total */
- for(ibuf= sima->image->ibufs.first; ibuf; ibuf= ibuf->next)
- if(ibuf->userflags & IB_BITMAPDIRTY)
+ for (ibuf= sima->image->ibufs.first; ibuf; ibuf= ibuf->next)
+ if (ibuf->userflags & IB_BITMAPDIRTY)
tot++;
- if(tot==0) {
+ if (tot==0) {
BKE_report(op->reports, RPT_WARNING, "No images have been changed");
return OPERATOR_CANCELLED;
}
/* get a filename for menu */
- for(ibuf= sima->image->ibufs.first; ibuf; ibuf= ibuf->next)
- if(ibuf->userflags & IB_BITMAPDIRTY)
+ for (ibuf= sima->image->ibufs.first; ibuf; ibuf= ibuf->next)
+ if (ibuf->userflags & IB_BITMAPDIRTY)
break;
BLI_strncpy(di, ibuf->name, FILE_MAX);
@@ -1420,14 +1421,14 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
BKE_reportf(op->reports, RPT_INFO, "%d Image(s) will be saved in %s", tot, di);
- for(ibuf= sima->image->ibufs.first; ibuf; ibuf= ibuf->next) {
- if(ibuf->userflags & IB_BITMAPDIRTY) {
+ for (ibuf= sima->image->ibufs.first; ibuf; ibuf= ibuf->next) {
+ if (ibuf->userflags & IB_BITMAPDIRTY) {
char name[FILE_MAX];
BLI_strncpy(name, ibuf->name, sizeof(name));
BLI_path_abs(name, bmain->name);
- if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
+ if (0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s", name);
break;
}
@@ -1443,15 +1444,15 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
void IMAGE_OT_save_sequence(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Save Sequence";
- ot->idname= "IMAGE_OT_save_sequence";
+ ot->name = "Save Sequence";
+ ot->idname = "IMAGE_OT_save_sequence";
/* api callbacks */
- ot->exec= image_save_sequence_exec;
- ot->poll= space_image_buffer_exists_poll;
+ ot->exec = image_save_sequence_exec;
+ ot->poll = space_image_buffer_exists_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/******************** reload image operator ********************/
@@ -1461,7 +1462,7 @@ static int image_reload_exec(bContext *C, wmOperator *UNUSED(op))
Image *ima= CTX_data_edit_image(C);
SpaceImage *sima= CTX_wm_space_image(C);
- if(!ima)
+ if (!ima)
return OPERATOR_CANCELLED;
/* XXX unpackImage frees image buffers */
@@ -1478,14 +1479,14 @@ static int image_reload_exec(bContext *C, wmOperator *UNUSED(op))
void IMAGE_OT_reload(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reload Image";
- ot->idname= "IMAGE_OT_reload";
+ ot->name = "Reload Image";
+ ot->idname = "IMAGE_OT_reload";
/* api callbacks */
- ot->exec= image_reload_exec;
+ ot->exec = image_reload_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER; /* no undo, image buffer is not handled by undo */
+ ot->flag = OPTYPE_REGISTER; /* no undo, image buffer is not handled by undo */
}
/********************** new image operator *********************/
@@ -1518,18 +1519,18 @@ static int image_new_exec(bContext *C, wmOperator *op)
if (!floatbuf && scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
linearrgb_to_srgb_v3_v3(color, color);
- if(!alpha)
+ if (!alpha)
color[3]= 1.0f;
ima = BKE_add_image_size(width, height, name, alpha ? 32 : 24, floatbuf, uvtestgrid, color);
- if(!ima)
+ if (!ima)
return OPERATOR_CANCELLED;
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
- if(prop) {
+ if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
ima->id.us--;
@@ -1538,7 +1539,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
RNA_property_pointer_set(&ptr, prop, idptr);
RNA_property_update(C, &ptr, prop);
}
- else if(sima)
+ else if (sima)
ED_space_image_set(sima, scene, obedit, ima);
// XXX other users?
@@ -1560,16 +1561,16 @@ void IMAGE_OT_new(wmOperatorType *ot)
static float default_color[4]= {0.0f, 0.0f, 0.0f, 1.0f};
/* identifiers */
- ot->name= "New Image";
- ot->description= "Create a new image";
- ot->idname= "IMAGE_OT_new";
+ ot->name = "New Image";
+ ot->description = "Create a new image";
+ ot->idname = "IMAGE_OT_new";
/* api callbacks */
- ot->exec= image_new_exec;
- ot->invoke= image_new_invoke;
+ ot->exec = image_new_exec;
+ ot->invoke = image_new_invoke;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
RNA_def_string(ot->srna, "name", "untitled", MAX_ID_NAME-2, "Name", "Image datablock name");
@@ -1589,7 +1590,7 @@ static int image_invert_poll(bContext *C)
Image *ima= CTX_data_edit_image(C);
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- if( ibuf != NULL )
+ if ( ibuf != NULL )
return 1;
return 0;
}
@@ -1607,32 +1608,32 @@ static int image_invert_exec(bContext *C, wmOperator *op)
int i;
- if( ibuf == NULL) // TODO: this should actually never happen, but does for render-results -> cleanup
+ if ( ibuf == NULL) // TODO: this should actually never happen, but does for render-results -> cleanup
return OPERATOR_CANCELLED;
/* TODO: make this into an IMB_invert_channels(ibuf,r,g,b,a) method!? */
if (ibuf->rect_float) {
float *fp = (float *) ibuf->rect_float;
- for( i = ibuf->x * ibuf->y; i > 0; i--, fp+=4 ) {
- if( r ) fp[0] = 1.0f - fp[0];
- if( g ) fp[1] = 1.0f - fp[1];
- if( b ) fp[2] = 1.0f - fp[2];
- if( a ) fp[3] = 1.0f - fp[3];
+ for ( i = ibuf->x * ibuf->y; i > 0; i--, fp+=4 ) {
+ if ( r ) fp[0] = 1.0f - fp[0];
+ if ( g ) fp[1] = 1.0f - fp[1];
+ if ( b ) fp[2] = 1.0f - fp[2];
+ if ( a ) fp[3] = 1.0f - fp[3];
}
- if(ibuf->rect) {
+ if (ibuf->rect) {
IMB_rect_from_float(ibuf);
}
}
- else if(ibuf->rect) {
+ else if (ibuf->rect) {
char *cp = (char *) ibuf->rect;
- for( i = ibuf->x * ibuf->y; i > 0; i--, cp+=4 ) {
- if( r ) cp[0] = 255 - cp[0];
- if( g ) cp[1] = 255 - cp[1];
- if( b ) cp[2] = 255 - cp[2];
- if( a ) cp[3] = 255 - cp[3];
+ for ( i = ibuf->x * ibuf->y; i > 0; i--, cp+=4 ) {
+ if ( r ) cp[0] = 255 - cp[0];
+ if ( g ) cp[1] = 255 - cp[1];
+ if ( b ) cp[2] = 255 - cp[2];
+ if ( a ) cp[3] = 255 - cp[3];
}
}
else {
@@ -1640,7 +1641,7 @@ static int image_invert_exec(bContext *C, wmOperator *op)
}
ibuf->userflags |= IB_BITMAPDIRTY;
- if(ibuf->mipmap[0])
+ if (ibuf->mipmap[0])
ibuf->userflags |= IB_MIPMAP_INVALID;
WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
@@ -1650,12 +1651,12 @@ static int image_invert_exec(bContext *C, wmOperator *op)
void IMAGE_OT_invert(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Invert Channels";
- ot->idname= "IMAGE_OT_invert";
+ ot->name = "Invert Channels";
+ ot->idname = "IMAGE_OT_invert";
/* api callbacks */
- ot->exec= image_invert_exec;
- ot->poll= image_invert_poll;
+ ot->exec = image_invert_exec;
+ ot->poll = image_invert_poll;
/* properties */
RNA_def_boolean(ot->srna, "invert_r", 0, "Red", "Invert Red Channel");
@@ -1664,7 +1665,7 @@ void IMAGE_OT_invert(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "invert_a", 0, "Alpha", "Invert Alpha Channel");
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************* pack operator *********************/
@@ -1674,12 +1675,12 @@ static int image_pack_test(bContext *C, wmOperator *op)
Image *ima= CTX_data_edit_image(C);
int as_png= RNA_boolean_get(op->ptr, "as_png");
- if(!ima)
+ if (!ima)
return 0;
- if(!as_png && ima->packedfile)
+ if (!as_png && ima->packedfile)
return 0;
- if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
+ if (ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
BKE_report(op->reports, RPT_ERROR, "Packing movies or image sequences not supported");
return 0;
}
@@ -1694,15 +1695,15 @@ static int image_pack_exec(bContext *C, wmOperator *op)
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
int as_png= RNA_boolean_get(op->ptr, "as_png");
- if(!image_pack_test(C, op))
+ if (!image_pack_test(C, op))
return OPERATOR_CANCELLED;
- if(!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
+ if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
BKE_report(op->reports, RPT_ERROR, "Can't pack edited image from disk, only as internal PNG");
return OPERATOR_CANCELLED;
}
- if(as_png)
+ if (as_png)
BKE_image_memorypack(ima);
else
ima->packedfile= newPackedFile(op->reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
@@ -1720,10 +1721,10 @@ static int image_pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
uiLayout *layout;
int as_png= RNA_boolean_get(op->ptr, "as_png");
- if(!image_pack_test(C, op))
+ if (!image_pack_test(C, op))
return OPERATOR_CANCELLED;
- if(!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
+ if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
pup= uiPupMenuBegin(C, "OK", ICON_QUESTION);
layout= uiPupMenuLayout(pup);
uiItemBooleanO(layout, "Can't pack edited image from disk. Pack as internal PNG?", ICON_NONE, op->idname, "as_png", 1);
@@ -1738,16 +1739,16 @@ static int image_pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
void IMAGE_OT_pack(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Pack Image";
- ot->description= "Pack an image as embedded data into the .blend file";
- ot->idname= "IMAGE_OT_pack";
+ ot->name = "Pack Image";
+ ot->description = "Pack an image as embedded data into the .blend file";
+ ot->idname = "IMAGE_OT_pack";
/* api callbacks */
- ot->exec= image_pack_exec;
- ot->invoke= image_pack_invoke;
+ ot->exec = image_pack_exec;
+ ot->invoke = image_pack_invoke;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "as_png", 0, "Pack As PNG", "Pack image as lossless PNG");
@@ -1768,15 +1769,15 @@ static int image_unpack_exec(bContext *C, wmOperator *op)
if (!ima) ima = CTX_data_edit_image(C);
}
- if(!ima || !ima->packedfile)
+ if (!ima || !ima->packedfile)
return OPERATOR_CANCELLED;
- if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
+ if (ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported");
return OPERATOR_CANCELLED;
}
- if(G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_AUTOPACK)
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
/* XXX unpackImage frees image buffers */
@@ -1793,18 +1794,18 @@ static int image_unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
{
Image *ima= CTX_data_edit_image(C);
- if(RNA_struct_property_is_set(op->ptr, "id"))
+ if (RNA_struct_property_is_set(op->ptr, "id"))
return image_unpack_exec(C, op);
- if(!ima || !ima->packedfile)
+ if (!ima || !ima->packedfile)
return OPERATOR_CANCELLED;
- if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
+ if (ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported");
return OPERATOR_CANCELLED;
}
- if(G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_AUTOPACK)
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
unpack_menu(C, "IMAGE_OT_unpack", ima->id.name+2, ima->name, "textures", ima->packedfile);
@@ -1815,16 +1816,16 @@ static int image_unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
void IMAGE_OT_unpack(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Unpack Image";
- ot->description= "Save an image packed in the .blend file to disk";
- ot->idname= "IMAGE_OT_unpack";
+ ot->name = "Unpack Image";
+ ot->description = "Save an image packed in the .blend file to disk";
+ ot->idname = "IMAGE_OT_unpack";
/* api callbacks */
- ot->exec= image_unpack_exec;
- ot->invoke= image_unpack_invoke;
+ ot->exec = image_unpack_exec;
+ ot->invoke = image_unpack_invoke;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "method", unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack");
@@ -1855,7 +1856,7 @@ typedef struct ImageSampleInfo {
static void image_sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info)
{
ImageSampleInfo *info= arg_info;
- if(info->draw) {
+ if (info->draw) {
/* no color management needed for images (color_manage=0) */
ED_image_draw_info(ar, 0, info->channels, info->x, info->y, info->colp, info->colfp, info->zp, info->zfp);
}
@@ -1870,14 +1871,14 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
ImageSampleInfo *info= op->customdata;
float fx, fy;
- if(ibuf == NULL) {
+ if (ibuf == NULL) {
ED_space_image_release_buffer(sima, lock);
return;
}
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);
- if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
+ if (fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
float *fp;
unsigned char *cp;
int x= (int)(fx*ibuf->x), y= (int)(fy*ibuf->y);
@@ -1895,7 +1896,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
info->zp= NULL;
info->zfp= NULL;
- if(ibuf->rect) {
+ if (ibuf->rect) {
cp= (unsigned char *)(ibuf->rect + y*ibuf->x + x);
info->col[0]= cp[0];
@@ -1910,7 +1911,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
info->colf[3]= (float)cp[3]/255.0f;
info->colfp= info->colf;
}
- if(ibuf->rect_float) {
+ if (ibuf->rect_float) {
fp= (ibuf->rect_float + (ibuf->channels)*(y*ibuf->x + x));
info->colf[0]= fp[0];
@@ -1920,28 +1921,28 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
info->colfp= info->colf;
}
- if(ibuf->zbuf) {
+ if (ibuf->zbuf) {
info->z= ibuf->zbuf[y*ibuf->x + x];
info->zp= &info->z;
}
- if(ibuf->zbuf_float) {
+ if (ibuf->zbuf_float) {
info->zf= ibuf->zbuf_float[y*ibuf->x + x];
info->zfp= &info->zf;
}
- if(sima->cumap && ibuf->channels==4) {
+ if (sima->cumap && ibuf->channels==4) {
/* we reuse this callback for set curves point operators */
- if(RNA_struct_find_property(op->ptr, "point")) {
+ if (RNA_struct_find_property(op->ptr, "point")) {
int point= RNA_enum_get(op->ptr, "point");
- if(point == 1) {
+ if (point == 1) {
curvemapping_set_black_white(sima->cumap, NULL, info->colfp);
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
curvemapping_do_ibuf(sima->cumap, ibuf);
}
- else if(point == 0) {
+ else if (point == 0) {
curvemapping_set_black_white(sima->cumap, info->colfp, NULL);
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
curvemapping_do_ibuf(sima->cumap, ibuf);
}
}
@@ -1953,8 +1954,8 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
ScrArea *sa, *cur= curarea;
node_curvemap_sample(fp); /* sends global to node editor */
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_NODE) {
+ for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
+ if (sa->spacetype==SPACE_NODE) {
areawinset(sa->win);
scrarea_do_windraw(sa);
}
@@ -1986,7 +1987,7 @@ static int image_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
ARegion *ar= CTX_wm_region(C);
ImageSampleInfo *info;
- if(!ED_space_image_has_buffer(sima))
+ if (!ED_space_image_has_buffer(sima))
return OPERATOR_CANCELLED;
info= MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
@@ -2025,17 +2026,17 @@ static int image_sample_cancel(bContext *C, wmOperator *op)
void IMAGE_OT_sample(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Sample Color";
- ot->idname= "IMAGE_OT_sample";
+ ot->name = "Sample Color";
+ ot->idname = "IMAGE_OT_sample";
/* api callbacks */
- ot->invoke= image_sample_invoke;
- ot->modal= image_sample_modal;
- ot->cancel= image_sample_cancel;
- ot->poll= space_image_image_sample_poll;
+ ot->invoke = image_sample_invoke;
+ ot->modal = image_sample_modal;
+ ot->cancel = image_sample_cancel;
+ ot->poll = space_image_image_sample_poll;
/* flags */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
}
/******************** sample line operator ********************/
@@ -2089,7 +2090,8 @@ static int image_sample_line_exec(bContext *C, wmOperator *op)
if (x<0 || y<0 || x>=ibuf->x || y>=ibuf->y) {
hist->data_luma[i] = hist->data_r[i] = hist->data_g[i]= hist->data_b[i] = 0.0f;
- } else {
+ }
+ else {
if (ibuf->rect_float) {
fp= (ibuf->rect_float + (ibuf->channels)*(y*ibuf->x + x));
@@ -2124,7 +2126,7 @@ static int image_sample_line_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceImage *sima= CTX_wm_space_image(C);
- if(!ED_space_image_has_buffer(sima))
+ if (!ED_space_image_has_buffer(sima))
return OPERATOR_CANCELLED;
return WM_gesture_straightline_invoke(C, op, event);
@@ -2133,18 +2135,18 @@ static int image_sample_line_invoke(bContext *C, wmOperator *op, wmEvent *event)
void IMAGE_OT_sample_line(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Sample Line";
- ot->idname= "IMAGE_OT_sample_line";
+ ot->name = "Sample Line";
+ ot->idname = "IMAGE_OT_sample_line";
/* api callbacks */
- ot->invoke= image_sample_line_invoke;
- ot->modal= WM_gesture_straightline_modal;
- ot->exec= image_sample_line_exec;
- ot->poll= space_image_main_area_poll;
- ot->cancel= WM_gesture_straightline_cancel;
+ ot->invoke = image_sample_line_invoke;
+ ot->modal = WM_gesture_straightline_modal;
+ ot->exec = image_sample_line_exec;
+ ot->poll = space_image_main_area_poll;
+ ot->cancel = WM_gesture_straightline_cancel;
/* flags */
- ot->flag= 0; /* no undo/register since this operates on the space */
+ ot->flag = 0; /* no undo/register since this operates on the space */
WM_operator_properties_gesture_straightline(ot, CURSOR_EDIT);
}
@@ -2159,17 +2161,17 @@ void IMAGE_OT_curves_point_set(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Set Curves Point";
- ot->idname= "IMAGE_OT_curves_point_set";
+ ot->name = "Set Curves Point";
+ ot->idname = "IMAGE_OT_curves_point_set";
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->invoke= image_sample_invoke;
- ot->modal= image_sample_modal;
- ot->cancel= image_sample_cancel;
- ot->poll= space_image_main_area_not_uv_brush_poll;
+ ot->invoke = image_sample_invoke;
+ ot->modal = image_sample_modal;
+ ot->cancel = image_sample_cancel;
+ ot->poll = space_image_main_area_not_uv_brush_poll;
/* properties */
RNA_def_enum(ot->srna, "point", point_items, 0, "Point", "Set black point or white point for curves");
@@ -2203,7 +2205,7 @@ static int image_record_composite_apply(bContext *C, wmOperator *op)
ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
/* save memory in flipbooks */
- if(ibuf)
+ if (ibuf)
imb_freerectfloatImBuf(ibuf);
scene->r.cfra++;
@@ -2217,9 +2219,9 @@ static int image_record_composite_init(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
RecordCompositeData *rcd;
- if(sima->iuser.frames < 2)
+ if (sima->iuser.frames < 2)
return 0;
- if(scene->nodetree == NULL)
+ if (scene->nodetree == NULL)
return 0;
op->customdata= rcd= MEM_callocN(sizeof(RecordCompositeData), "ImageRecordCompositeData");
@@ -2242,7 +2244,7 @@ static void image_record_composite_exit(bContext *C, wmOperator *op)
WM_cursor_restore(CTX_wm_window(C));
- if(rcd->timer)
+ if (rcd->timer)
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), rcd->timer);
WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, sima->image);
@@ -2255,10 +2257,10 @@ static void image_record_composite_exit(bContext *C, wmOperator *op)
static int image_record_composite_exec(bContext *C, wmOperator *op)
{
- if(!image_record_composite_init(C, op))
+ if (!image_record_composite_init(C, op))
return OPERATOR_CANCELLED;
- while(image_record_composite_apply(C, op))
+ while (image_record_composite_apply(C, op))
;
image_record_composite_exit(C, op);
@@ -2270,14 +2272,14 @@ static int image_record_composite_invoke(bContext *C, wmOperator *op, wmEvent *U
{
RecordCompositeData *rcd;
- if(!image_record_composite_init(C, op))
+ if (!image_record_composite_init(C, op))
return OPERATOR_CANCELLED;
rcd= op->customdata;
rcd->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.0f);
WM_event_add_modal_handler(C, op);
- if(!image_record_composite_apply(C, op))
+ if (!image_record_composite_apply(C, op))
return OPERATOR_FINISHED;
return OPERATOR_RUNNING_MODAL;
@@ -2289,8 +2291,8 @@ static int image_record_composite_modal(bContext *C, wmOperator *op, wmEvent *ev
switch(event->type) {
case TIMER:
- if(rcd->timer == event->customdata) {
- if(!image_record_composite_apply(C, op)) {
+ if (rcd->timer == event->customdata) {
+ if (!image_record_composite_apply(C, op)) {
image_record_composite_exit(C, op);
return OPERATOR_FINISHED;
}
@@ -2313,15 +2315,15 @@ static int image_record_composite_cancel(bContext *C, wmOperator *op)
void IMAGE_OT_record_composite(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Record Composite";
- ot->idname= "IMAGE_OT_record_composite";
+ ot->name = "Record Composite";
+ ot->idname = "IMAGE_OT_record_composite";
/* api callbacks */
- ot->exec= image_record_composite_exec;
- ot->invoke= image_record_composite_invoke;
- ot->modal= image_record_composite_modal;
- ot->cancel= image_record_composite_cancel;
- ot->poll= space_image_buffer_exists_poll;
+ ot->exec = image_record_composite_exec;
+ ot->invoke = image_record_composite_invoke;
+ ot->modal = image_record_composite_modal;
+ ot->cancel = image_record_composite_cancel;
+ ot->poll = space_image_buffer_exists_poll;
}
/********************* cycle render slot operator *********************/
@@ -2339,27 +2341,27 @@ static int image_cycle_render_slot_exec(bContext *C, wmOperator *op)
int a, slot, cur= ima->render_slot;
const short use_reverse= RNA_boolean_get(op->ptr, "reverse");
- for(a=1; a<IMA_MAX_RENDER_SLOT; a++) {
+ for (a=1; a<IMA_MAX_RENDER_SLOT; a++) {
slot= (cur + (use_reverse ? -a:a))%IMA_MAX_RENDER_SLOT;
- if(slot<0) slot+=IMA_MAX_RENDER_SLOT;
+ if (slot<0) slot+=IMA_MAX_RENDER_SLOT;
- if(ima->renders[slot] || slot == ima->last_render_slot) {
+ if (ima->renders[slot] || slot == ima->last_render_slot) {
ima->render_slot= slot;
break;
}
- else if((slot - 1) == ima->last_render_slot && slot < IMA_MAX_RENDER_SLOT) {
+ else if ((slot - 1) == ima->last_render_slot && slot < IMA_MAX_RENDER_SLOT) {
ima->render_slot= slot;
break;
}
}
- if(a == IMA_MAX_RENDER_SLOT)
+ if (a == IMA_MAX_RENDER_SLOT)
ima->render_slot= ((cur == 1)? 0: 1);
WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
/* no undo push for browsing existing */
- if(ima->renders[ima->render_slot] || ima->render_slot==ima->last_render_slot)
+ if (ima->renders[ima->render_slot] || ima->render_slot==ima->last_render_slot)
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -2368,15 +2370,15 @@ static int image_cycle_render_slot_exec(bContext *C, wmOperator *op)
void IMAGE_OT_cycle_render_slot(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Cycle Render Slot";
- ot->idname= "IMAGE_OT_cycle_render_slot";
+ ot->name = "Cycle Render Slot";
+ ot->idname = "IMAGE_OT_cycle_render_slot";
/* api callbacks */
- ot->exec= image_cycle_render_slot_exec;
- ot->poll= image_cycle_render_slot_poll;
+ ot->exec = image_cycle_render_slot_exec;
+ ot->poll = image_cycle_render_slot_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "reverse", 0, "Cycle in Reverse", "");
}
@@ -2394,42 +2396,42 @@ void ED_image_update_frame(const Main *mainp, int cfra)
Tex *tex;
/* texture users */
- for(tex= mainp->tex.first; tex; tex= tex->id.next) {
- if(tex->type==TEX_IMAGE && tex->ima) {
- if(ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
- if(tex->iuser.flag & IMA_ANIM_ALWAYS)
+ for (tex= mainp->tex.first; tex; tex= tex->id.next) {
+ if (tex->type==TEX_IMAGE && tex->ima) {
+ if (ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ if (tex->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_calc_frame(&tex->iuser, cfra, 0);
}
}
}
/* image window, compo node users */
- for(wm=mainp->wm.first; wm; wm= wm->id.next) { /* only 1 wm */
- for(win= wm->windows.first; win; win= win->next) {
+ for (wm=mainp->wm.first; wm; wm= wm->id.next) { /* only 1 wm */
+ for (win= wm->windows.first; win; win= win->next) {
ScrArea *sa;
- for(sa= win->screen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_VIEW3D) {
+ for (sa= win->screen->areabase.first; sa; sa= sa->next) {
+ if (sa->spacetype==SPACE_VIEW3D) {
View3D *v3d= sa->spacedata.first;
BGpic *bgpic;
- for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
- if(bgpic->iuser.flag & IMA_ANIM_ALWAYS)
+ for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
+ if (bgpic->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_calc_frame(&bgpic->iuser, cfra, 0);
}
- else if(sa->spacetype==SPACE_IMAGE) {
+ else if (sa->spacetype==SPACE_IMAGE) {
SpaceImage *sima= sa->spacedata.first;
- if(sima->iuser.flag & IMA_ANIM_ALWAYS)
+ if (sima->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_calc_frame(&sima->iuser, cfra, 0);
}
- else if(sa->spacetype==SPACE_NODE) {
+ else if (sa->spacetype==SPACE_NODE) {
SpaceNode *snode= sa->spacedata.first;
- if((snode->treetype==NTREE_COMPOSIT) && (snode->nodetree)) {
+ if ((snode->treetype==NTREE_COMPOSIT) && (snode->nodetree)) {
bNode *node;
- for(node= snode->nodetree->nodes.first; node; node= node->next) {
- if(node->id && node->type==CMP_NODE_IMAGE) {
+ for (node= snode->nodetree->nodes.first; node; node= node->next) {
+ if (node->id && node->type==CMP_NODE_IMAGE) {
Image *ima= (Image *)node->id;
ImageUser *iuser= node->storage;
- if(ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
- if(iuser->flag & IMA_ANIM_ALWAYS)
+ if (ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
+ if (iuser->flag & IMA_ANIM_ALWAYS)
BKE_image_user_calc_frame(iuser, cfra, 0);
}
}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 1af37a66022..f1967477d7a 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -92,16 +92,16 @@ void ED_space_image_set(SpaceImage *sima, Scene *scene, Object *obedit, Image *i
* to check if the face is displayed in UV-localview */
sima->image= ima;
- if(ima == NULL || ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
+ if (ima == NULL || ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
sima->flag &= ~SI_DRAWTOOL;
- if(sima->image)
+ if (sima->image)
BKE_image_signal(sima->image, &sima->iuser, IMA_SIGNAL_USER_NEW_IMAGE);
- if(sima->image && sima->image->id.us==0)
+ if (sima->image && sima->image->id.us==0)
sima->image->id.us= 1;
- if(obedit)
+ if (obedit)
WM_main_add_notifier(NC_GEOM|ND_DATA, obedit->data);
WM_main_add_notifier(NC_SPACE|ND_SPACE_IMAGE, NULL);
@@ -111,15 +111,15 @@ ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **lock_r)
{
ImBuf *ibuf;
- if(sima && sima->image) {
+ if (sima && sima->image) {
#if 0
- if(sima->image->type==IMA_TYPE_R_RESULT && BIF_show_render_spare())
+ if (sima->image->type==IMA_TYPE_R_RESULT && BIF_show_render_spare())
return BIF_render_spare_imbuf();
else
#endif
ibuf= BKE_image_acquire_ibuf(sima->image, &sima->iuser, lock_r);
- if(ibuf && (ibuf->rect || ibuf->rect_float))
+ if (ibuf && (ibuf->rect || ibuf->rect_float))
return ibuf;
}
@@ -128,7 +128,7 @@ ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **lock_r)
void ED_space_image_release_buffer(SpaceImage *sima, void *lock)
{
- if(sima && sima->image)
+ if (sima && sima->image)
BKE_image_release_ibuf(sima->image, lock);
}
@@ -150,10 +150,10 @@ void ED_image_size(Image *ima, int *width, int *height)
ImBuf *ibuf= NULL;
void *lock;
- if(ima)
+ if (ima)
ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
- if(ibuf && ibuf->x > 0 && ibuf->y > 0) {
+ if (ibuf && ibuf->x > 0 && ibuf->y > 0) {
*width= ibuf->x;
*height= ibuf->y;
}
@@ -162,7 +162,7 @@ void ED_image_size(Image *ima, int *width, int *height)
*height= 256;
}
- if(ima)
+ if (ima)
BKE_image_release_ibuf(ima, lock);
}
@@ -174,23 +174,23 @@ void ED_space_image_size(SpaceImage *sima, int *width, int *height)
ibuf= ED_space_image_acquire_buffer(sima, &lock);
- if(ibuf && ibuf->x > 0 && ibuf->y > 0) {
+ if (ibuf && ibuf->x > 0 && ibuf->y > 0) {
*width= ibuf->x;
*height= ibuf->y;
}
- else if(sima->image && sima->image->type==IMA_TYPE_R_RESULT && scene) {
+ else if (sima->image && sima->image->type==IMA_TYPE_R_RESULT && scene) {
/* not very important, just nice */
*width= (scene->r.xsch*scene->r.size)/100;
*height= (scene->r.ysch*scene->r.size)/100;
- if((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) {
+ if ((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) {
*width *= (scene->r.border.xmax - scene->r.border.xmin);
*height *= (scene->r.border.ymax - scene->r.border.ymin);
}
}
/* I know a bit weak... but preview uses not actual image size */
- // XXX else if(image_preview_active(sima, width, height));
+ // XXX else if (image_preview_active(sima, width, height));
else {
*width= 256;
*height= 256;
@@ -203,7 +203,7 @@ void ED_image_aspect(Image *ima, float *aspx, float *aspy)
{
*aspx= *aspy= 1.0;
- if((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) ||
+ if ((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) ||
(ima->aspx==0.0f || ima->aspy==0.0f))
return;
@@ -236,7 +236,7 @@ void ED_space_image_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
*aspx *= (float)w;
*aspy *= (float)h;
- if(*aspx < *aspy) {
+ if (*aspx < *aspy) {
*aspy= *aspy / *aspx;
*aspx= 1.0f;
}
@@ -264,7 +264,7 @@ int ED_space_image_show_render(SpaceImage *sima)
int ED_space_image_show_paint(SpaceImage *sima)
{
- if(ED_space_image_show_render(sima))
+ if (ED_space_image_show_render(sima))
return 0;
return (sima->flag & SI_DRAWTOOL);
@@ -272,10 +272,10 @@ int ED_space_image_show_paint(SpaceImage *sima)
int ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit)
{
- if(sima && (ED_space_image_show_render(sima) || ED_space_image_show_paint(sima)))
+ if (sima && (ED_space_image_show_render(sima) || ED_space_image_show_paint(sima)))
return 0;
- if(obedit && obedit->type == OB_MESH) {
+ if (obedit && obedit->type == OB_MESH) {
struct BMEditMesh *em = BMEdit_FromObject(obedit);
int ret;
@@ -289,11 +289,11 @@ int ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit)
int ED_space_image_show_uvshadow(SpaceImage *sima, Object *obedit)
{
- if(ED_space_image_show_render(sima))
+ if (ED_space_image_show_render(sima))
return 0;
- if(ED_space_image_show_paint(sima))
- if(obedit && obedit->type == OB_MESH) {
+ if (ED_space_image_show_paint(sima))
+ if (obedit && obedit->type == OB_MESH) {
struct BMEditMesh *em = BMEdit_FromObject(obedit);
int ret;
@@ -328,13 +328,13 @@ ARegion *image_has_buttons_region(ScrArea *sa)
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if(ar) return ar;
+ if (ar) return ar;
/* add subdiv level; after header */
ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if(ar==NULL) return NULL;
+ if (ar==NULL) return NULL;
arnew= MEM_callocN(sizeof(ARegion), "buttons for image");
@@ -352,13 +352,13 @@ ARegion *image_has_scope_region(ScrArea *sa)
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
- if(ar) return ar;
+ if (ar) return ar;
/* add subdiv level; after buttons */
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
/* is error! */
- if(ar==NULL) return NULL;
+ if (ar==NULL) return NULL;
arnew= MEM_callocN(sizeof(ARegion), "scopes for image");
@@ -429,7 +429,7 @@ static void image_free(SpaceLink *sl)
{
SpaceImage *simage= (SpaceImage*) sl;
- if(simage->cumap)
+ if (simage->cumap)
curvemapping_free(simage->cumap);
scopes_free(&simage->scopes);
}
@@ -450,7 +450,7 @@ static SpaceLink *image_duplicate(SpaceLink *sl)
SpaceImage *simagen= MEM_dupallocN(sl);
/* clear or remove stuff from old */
- if(simagen->cumap)
+ if (simagen->cumap)
simagen->cumap= curvemapping_copy(simagen->cumap);
scopes_new(&simagen->scopes);
@@ -495,7 +495,7 @@ static void image_operatortypes(void)
static void image_keymap(struct wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0);
wmKeyMapItem *kmi;
WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0);
@@ -509,7 +509,7 @@ static void image_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, 0, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, KM_ALT, 0)->ptr, "reverse", TRUE);
- keymap= WM_keymap_find(keyconf, "Image", SPACE_IMAGE, 0);
+ keymap = WM_keymap_find(keyconf, "Image", SPACE_IMAGE, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
@@ -540,7 +540,7 @@ static void image_keymap(struct wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "IMAGE_OT_curves_point_set", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "point", 1);
/* toggle editmode is handy to have while UV unwrapping */
- kmi= WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", OB_MODE_EDIT);
RNA_boolean_set(kmi->ptr, "toggle", TRUE);
}
@@ -548,8 +548,8 @@ static void image_keymap(struct wmKeyConfig *keyconf)
/* dropboxes */
static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if(drag->type==WM_DRAG_PATH)
- if(ELEM3(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
+ if (drag->type==WM_DRAG_PATH)
+ if (ELEM3(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
return 1;
return 0;
}
@@ -579,25 +579,25 @@ static void image_refresh(const bContext *C, ScrArea *UNUSED(sa))
ima= ED_space_image(sima);
- if(sima->iuser.flag & IMA_ANIM_ALWAYS)
+ if (sima->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_calc_frame(&sima->iuser, scene->r.cfra, 0);
/* check if we have to set the image from the editmesh */
- if(ima && (ima->source==IMA_SRC_VIEWER || sima->pin));
- else if(obedit && obedit->type == OB_MESH) {
+ if (ima && (ima->source==IMA_SRC_VIEWER || sima->pin));
+ else if (obedit && obedit->type == OB_MESH) {
Mesh *me= (Mesh*)obedit->data;
struct BMEditMesh *em= me->edit_btmesh;
int sloppy= 1; /* partially selected face is ok */
- if(scene_use_new_shading_nodes(scene)) {
+ if (scene_use_new_shading_nodes(scene)) {
/* new shading system, get image from material */
BMFace *efa = BM_active_face_get(em->bm, sloppy);
- if(efa) {
+ if (efa) {
Image *node_ima;
ED_object_get_active_image(obedit, efa->mat_nr, &node_ima, NULL, NULL);
- if(node_ima)
+ if (node_ima)
sima->image= node_ima;
}
}
@@ -605,16 +605,16 @@ static void image_refresh(const bContext *C, ScrArea *UNUSED(sa))
/* old shading system, we set texface */
MTexPoly *tf;
- if(em && EDBM_texFaceCheck(em)) {
+ if (em && EDBM_texFaceCheck(em)) {
sima->image= NULL;
tf = EDBM_get_active_mtexpoly(em, NULL, TRUE); /* partially selected face is ok */
- if(tf) {
+ if (tf) {
/* don't need to check for pin here, see above */
sima->image= tf->tpage;
- if(sima->flag & SI_EDITTILE);
+ if (sima->flag & SI_EDITTILE);
else sima->curtile= tf->tile;
}
}
@@ -653,7 +653,7 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_IMAGE) {
+ if (wmn->data == ND_SPACE_IMAGE) {
image_scopes_tag_refresh(sa);
ED_area_tag_redraw(sa);
}
@@ -673,7 +673,7 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
switch(wmn->data) {
case ND_TRANSFORM:
case ND_MODIFIER:
- if(ob && (ob->mode & OB_MODE_EDIT) && sima->lock && (sima->flag & SI_DRAWSHADOW)) {
+ if (ob && (ob->mode & OB_MODE_EDIT) && sima->lock && (sima->flag & SI_DRAWSHADOW)) {
ED_area_tag_refresh(sa);
ED_area_tag_redraw(sa);
}
@@ -689,10 +689,10 @@ static int image_context(const bContext *C, const char *member, bContextDataResu
{
SpaceImage *sima= CTX_wm_space_image(C);
- if(CTX_data_dir(member)) {
+ if (CTX_data_dir(member)) {
CTX_data_dir_set(result, image_context_dir);
}
- else if(CTX_data_equals(member, "edit_image")) {
+ else if (CTX_data_equals(member, "edit_image")) {
CTX_data_id_pointer_set(result, (ID*)ED_space_image(sima));
return 1;
}
@@ -710,7 +710,7 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar)
int width, height, winx, winy;
#if 0
- if(image_preview_active(curarea, &width, &height));
+ if (image_preview_active(curarea, &width, &height));
else
#endif
ED_space_image_size(sima, &width, &height);
@@ -718,20 +718,20 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar)
w= width;
h= height;
- if(ima)
+ if (ima)
h *= ima->aspy/ima->aspx;
winx= ar->winrct.xmax - ar->winrct.xmin + 1;
winy= ar->winrct.ymax - ar->winrct.ymin + 1;
- ar->v2d.tot.xmin= 0;
- ar->v2d.tot.ymin= 0;
- ar->v2d.tot.xmax= w;
- ar->v2d.tot.ymax= h;
+ ar->v2d.tot.xmin = 0;
+ ar->v2d.tot.ymin = 0;
+ ar->v2d.tot.xmax = w;
+ ar->v2d.tot.ymax = h;
- ar->v2d.mask.xmin= ar->v2d.mask.ymin= 0;
- ar->v2d.mask.xmax= winx;
- ar->v2d.mask.ymax= winy;
+ ar->v2d.mask.xmin = ar->v2d.mask.ymin = 0;
+ ar->v2d.mask.xmax = winx;
+ ar->v2d.mask.ymax = winy;
/* which part of the image space do we see? */
x1= ar->winrct.xmin+(winx-sima->zoom*w)/2.0f;
@@ -741,12 +741,12 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar)
y1-= sima->zoom*sima->yof;
/* relative display right */
- ar->v2d.cur.xmin= ((ar->winrct.xmin - (float)x1)/sima->zoom);
- ar->v2d.cur.xmax= ar->v2d.cur.xmin + ((float)winx/sima->zoom);
+ ar->v2d.cur.xmin = ((ar->winrct.xmin - (float)x1)/sima->zoom);
+ ar->v2d.cur.xmax = ar->v2d.cur.xmin + ((float)winx/sima->zoom);
/* relative display left */
- ar->v2d.cur.ymin= ((ar->winrct.ymin-(float)y1)/sima->zoom);
- ar->v2d.cur.ymax= ar->v2d.cur.ymin + ((float)winy/sima->zoom);
+ ar->v2d.cur.ymin = ((ar->winrct.ymin-(float)y1)/sima->zoom);
+ ar->v2d.cur.ymax = ar->v2d.cur.ymin + ((float)winy/sima->zoom);
/* normalize 0.0..1.0 */
ar->v2d.cur.xmin /= w;
@@ -764,19 +764,19 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
// UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
/* image paint polls for mode */
- keymap= WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap= WM_keymap_find(wm->defaultconf, "UV Editor", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "UV Editor", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "UV Sculpt", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "UV Sculpt", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* own keymaps */
- keymap= WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Image", SPACE_IMAGE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Image", SPACE_IMAGE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -851,7 +851,7 @@ static void image_buttons_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap= WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -869,7 +869,7 @@ static void image_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_BRUSH:
- if(wmn->action==NA_EDITED)
+ if (wmn->action==NA_EDITED)
ED_region_tag_redraw(ar);
break;
case NC_TEXTURE:
@@ -890,7 +890,7 @@ static void image_scope_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap= WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -900,7 +900,7 @@ static void image_scope_area_draw(const bContext *C, ARegion *ar)
Scene *scene= CTX_data_scene(C);
void *lock;
ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
- if(ibuf) {
+ if (ibuf) {
scopes_update(&sima->scopes, ibuf, scene->r.color_mgt_flag & R_COLOR_MANAGEMENT );
}
ED_space_image_release_buffer(sima, lock);
diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt
index 7cf5b1fc3fb..94b40a9f40a 100644
--- a/source/blender/editors/space_info/CMakeLists.txt
+++ b/source/blender/editors/space_info/CMakeLists.txt
@@ -48,4 +48,8 @@ set(SRC
textview.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_space_info "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_info/SConscript b/source/blender/editors/space_info/SConscript
index 746edadccc2..e4746aefa0c 100644
--- a/source/blender/editors/space_info/SConscript
+++ b/source/blender/editors/space_info/SConscript
@@ -8,4 +8,7 @@ incs += ' ../../bmesh ../../windowmanager #/intern/guardedalloc #/extern/glew/in
defs = []
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
env.BlenderLib ( 'bf_editors_space_info', sources, Split(incs), defs, libtype=['core'], priority=[70] )
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index d2be3bd2812..c06a778951d 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -65,9 +65,9 @@
static void info_report_color(unsigned char *fg, unsigned char *bg, Report *report, int bool)
{
- if(report->flag & SELECT) {
+ if (report->flag & SELECT) {
fg[0]=255; fg[1]=255; fg[2]=255;
- if(bool) {
+ if (bool) {
bg[0]=96; bg[1]=128; bg[2]=255;
}
else {
@@ -114,7 +114,7 @@ static void report_textview_init__internal(TextViewContext *tvc)
const char *str= report->message;
const char *next_str= strchr(str + tvc->iter_char, '\n');
- if(next_str) {
+ if (next_str) {
tvc->iter_char_next= (int)(next_str - str);
}
else {
@@ -151,7 +151,7 @@ static int report_textview_begin(TextViewContext *tvc)
#ifdef USE_INFO_NEWLINE
tvc->iter_tmp= 0;
- if(tvc->iter && report_textview_skip__internal(tvc)) {
+ if (tvc->iter && report_textview_skip__internal(tvc)) {
/* init the newline iterator */
tvc->iter_char= 0;
report_textview_init__internal(tvc);
@@ -177,9 +177,9 @@ static int report_textview_step(TextViewContext *tvc)
/* simple case, but no newline support */
Report *report= (Report *)tvc->iter;
- if(report->len <= tvc->iter_char_next) {
+ if (report->len <= tvc->iter_char_next) {
tvc->iter= (void *)((Link *)tvc->iter)->prev;
- if(tvc->iter && report_textview_skip__internal(tvc)) {
+ if (tvc->iter && report_textview_skip__internal(tvc)) {
tvc->iter_tmp++;
tvc->iter_char= 0; /* reset start */
@@ -270,8 +270,8 @@ static int info_textview_main__internal(struct SpaceInfo *sinfo, struct ARegion
tvc.sel_start= 0;
tvc.sel_end= 0;
tvc.lheight= 14; //sc->lheight;
- tvc.ymin= v2d->cur.ymin;
- tvc.ymax= v2d->cur.ymax;
+ tvc.ymin = v2d->cur.ymin;
+ tvc.ymax = v2d->cur.ymax;
tvc.winx= ar->winx;
ret= textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index e4febdef73b..3157b920ff0 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -85,16 +85,16 @@ static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
ImBuf *ibuf;
// first check for dirty images
- for(ima=bmain->image.first; ima; ima=ima->id.next) {
- if(ima->ibufs.first) { /* XXX FIX */
+ for (ima=bmain->image.first; ima; ima=ima->id.next) {
+ if (ima->ibufs.first) { /* XXX FIX */
ibuf= BKE_image_get_ibuf(ima, NULL);
- if(ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
+ if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
break;
}
}
- if(ima) {
+ if (ima) {
uiPupMenuOkee(C, "FILE_OT_pack_all", "Some images are painted on. These changes will be lost. Continue?");
return OPERATOR_CANCELLED;
}
@@ -105,15 +105,15 @@ static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
void FILE_OT_pack_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Pack All";
- ot->idname= "FILE_OT_pack_all";
+ ot->name = "Pack All";
+ ot->idname = "FILE_OT_pack_all";
/* api callbacks */
- ot->exec= pack_all_exec;
- ot->invoke= pack_all_invoke;
+ ot->exec = pack_all_exec;
+ ot->invoke = pack_all_invoke;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************* unpack all operator *********************/
@@ -132,7 +132,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op)
Main *bmain= CTX_data_main(C);
int method= RNA_enum_get(op->ptr, "method");
- if(method != PF_KEEP) unpackAll(bmain, op->reports, method); /* XXX PF_ASK can't work here */
+ if (method != PF_KEEP) unpackAll(bmain, op->reports, method); /* XXX PF_ASK can't work here */
G.fileflags &= ~G_AUTOPACK;
return OPERATOR_FINISHED;
@@ -148,13 +148,13 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
count = countPackedFiles(bmain);
- if(!count) {
+ if (!count) {
BKE_report(op->reports, RPT_WARNING, "No packed files. Autopack disabled");
G.fileflags &= ~G_AUTOPACK;
return OPERATOR_CANCELLED;
}
- if(count == 1)
+ if (count == 1)
strcpy(title, "Unpack 1 file");
else
BLI_snprintf(title, sizeof(title), "Unpack %d files", count);
@@ -173,15 +173,15 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
void FILE_OT_unpack_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Unpack All";
- ot->idname= "FILE_OT_unpack_all";
+ ot->name = "Unpack All";
+ ot->idname = "FILE_OT_unpack_all";
/* api callbacks */
- ot->exec= unpack_all_exec;
- ot->invoke= unpack_all_invoke;
+ ot->exec = unpack_all_exec;
+ ot->invoke = unpack_all_invoke;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "method", unpack_all_method_items, PF_USE_LOCAL, "Method", "How to unpack");
@@ -193,7 +193,7 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
- if(!G.relbase_valid) {
+ if (!G.relbase_valid) {
BKE_report(op->reports, RPT_WARNING, "Can't set relative paths with an unsaved blend file");
return OPERATOR_CANCELLED;
}
@@ -209,14 +209,14 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op)
void FILE_OT_make_paths_relative(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make All Paths Relative";
- ot->idname= "FILE_OT_make_paths_relative";
+ ot->name = "Make All Paths Relative";
+ ot->idname = "FILE_OT_make_paths_relative";
/* api callbacks */
- ot->exec= make_paths_relative_exec;
+ ot->exec = make_paths_relative_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************* make paths absolute operator *********************/
@@ -225,7 +225,7 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
- if(!G.relbase_valid) {
+ if (!G.relbase_valid) {
BKE_report(op->reports, RPT_WARNING, "Can't set absolute paths with an unsaved blend file");
return OPERATOR_CANCELLED;
}
@@ -241,14 +241,14 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op)
void FILE_OT_make_paths_absolute(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make All Paths Absolute";
- ot->idname= "FILE_OT_make_paths_absolute";
+ ot->name = "Make All Paths Absolute";
+ ot->idname = "FILE_OT_make_paths_absolute";
/* api callbacks */
- ot->exec= make_paths_absolute_exec;
+ ot->exec = make_paths_absolute_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/********************* report missing files operator *********************/
@@ -266,14 +266,14 @@ static int report_missing_files_exec(bContext *C, wmOperator *op)
void FILE_OT_report_missing_files(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Report Missing Files";
- ot->idname= "FILE_OT_report_missing_files";
+ ot->name = "Report Missing Files";
+ ot->idname = "FILE_OT_report_missing_files";
/* api callbacks */
- ot->exec= report_missing_files_exec;
+ ot->exec = report_missing_files_exec;
/* flags */
- ot->flag= 0; /* only reports so no need to undo/register */
+ ot->flag = 0; /* only reports so no need to undo/register */
}
/********************* find missing files operator *********************/
@@ -298,15 +298,15 @@ static int find_missing_files_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
void FILE_OT_find_missing_files(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Find Missing Files";
- ot->idname= "FILE_OT_find_missing_files";
+ ot->name = "Find Missing Files";
+ ot->idname = "FILE_OT_find_missing_files";
/* api callbacks */
- ot->exec= find_missing_files_exec;
- ot->invoke= find_missing_files_invoke;
+ ot->exec = find_missing_files_exec;
+ ot->invoke = find_missing_files_invoke;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -339,7 +339,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm
int send_note= 0;
/* escape if not our timer */
- if( (reports->reporttimer==NULL) ||
+ if ( (reports->reporttimer==NULL) ||
(reports->reporttimer != event->customdata) ||
((report= BKE_reports_last_displayable(reports))==NULL) /* may have been deleted */
) {
@@ -363,15 +363,17 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm
if (rti->widthfac == 0.0f) {
/* initialize colors based on report type */
- if(report->type & RPT_ERROR_ALL) {
+ if (report->type & RPT_ERROR_ALL) {
rti->col[0] = 1.0;
rti->col[1] = 0.2;
rti->col[2] = 0.0;
- } else if(report->type & RPT_WARNING_ALL) {
+ }
+ else if (report->type & RPT_WARNING_ALL) {
rti->col[0] = 1.0;
rti->col[1] = 1.0;
rti->col[2] = 0.0;
- } else if(report->type & RPT_INFO_ALL) {
+ }
+ else if (report->type & RPT_INFO_ALL) {
rti->col[0] = 0.3;
rti->col[1] = 0.45;
rti->col[2] = 0.7;
@@ -384,7 +386,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm
color_progress = (float)reports->reporttimer->duration / color_timeout;
/* save us from too many draws */
- if(color_progress <= 1.0f) {
+ if (color_progress <= 1.0f) {
send_note= 1;
/* fade colors out sharply according to progress through fade-out duration */
@@ -399,7 +401,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm
send_note= 1;
}
- if(send_note) {
+ if (send_note) {
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO, NULL);
}
@@ -409,14 +411,14 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm
void INFO_OT_reports_display_update(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Update Reports Display";
- ot->idname= "INFO_OT_reports_display_update";
+ ot->name = "Update Reports Display";
+ ot->idname = "INFO_OT_reports_display_update";
/* api callbacks */
- ot->invoke= update_reports_display_invoke;
+ ot->invoke = update_reports_display_invoke;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
/* properties */
}
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index a1ea0449128..4e6ccf2f2b1 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -53,11 +53,11 @@ int info_report_mask(SpaceInfo *UNUSED(sinfo))
#if 0
int report_mask = 0;
- if(sinfo->rpt_mask & INFO_RPT_DEBUG) report_mask |= RPT_DEBUG_ALL;
- if(sinfo->rpt_mask & INFO_RPT_INFO) report_mask |= RPT_INFO_ALL;
- if(sinfo->rpt_mask & INFO_RPT_OP) report_mask |= RPT_OPERATOR_ALL;
- if(sinfo->rpt_mask & INFO_RPT_WARN) report_mask |= RPT_WARNING_ALL;
- if(sinfo->rpt_mask & INFO_RPT_ERR) report_mask |= RPT_ERROR_ALL;
+ if (sinfo->rpt_mask & INFO_RPT_DEBUG) report_mask |= RPT_DEBUG_ALL;
+ if (sinfo->rpt_mask & INFO_RPT_INFO) report_mask |= RPT_INFO_ALL;
+ if (sinfo->rpt_mask & INFO_RPT_OP) report_mask |= RPT_OPERATOR_ALL;
+ if (sinfo->rpt_mask & INFO_RPT_WARN) report_mask |= RPT_WARNING_ALL;
+ if (sinfo->rpt_mask & INFO_RPT_ERR) report_mask |= RPT_ERROR_ALL;
return report_mask;
#endif
@@ -76,8 +76,8 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op))
#if 0
sc->type= CONSOLE_TYPE_PYTHON;
- for(report=reports->list.last; report; report=report->prev) {
- if((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL) && (report->flag & SELECT)) {
+ for (report=reports->list.last; report; report=report->prev) {
+ if ((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL) && (report->flag & SELECT)) {
console_history_add_str(sc, report->message, 0);
WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL);
@@ -95,16 +95,16 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op))
void INFO_OT_report_replay(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Replay Operators";
- ot->description= "Replay selected reports";
- ot->idname= "INFO_OT_report_replay";
+ ot->name = "Replay Operators";
+ ot->description = "Replay selected reports";
+ ot->idname = "INFO_OT_report_replay";
/* api callbacks */
- ot->poll= ED_operator_info_active;
- ot->exec= report_replay_exec;
+ ot->poll = ED_operator_info_active;
+ ot->exec = report_replay_exec;
/* flags */
- /* ot->flag= OPTYPE_REGISTER; */
+ /* ot->flag = OPTYPE_REGISTER; */
/* properties */
}
@@ -114,7 +114,7 @@ static int select_report_pick_exec(bContext *C, wmOperator *op)
int report_index= RNA_int_get(op->ptr, "report_index");
Report *report= BLI_findlink(&CTX_wm_reports(C)->list, report_index);
- if(!report)
+ if (!report)
return OPERATOR_CANCELLED;
report->flag ^= SELECT; /* toggle */
@@ -145,17 +145,17 @@ static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
void INFO_OT_select_pick(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select report";
- ot->description= "Select reports by index";
- ot->idname= "INFO_OT_select_pick";
+ ot->name = "Select report";
+ ot->description = "Select reports by index";
+ ot->idname = "INFO_OT_select_pick";
/* api callbacks */
- ot->poll= ED_operator_info_active;
- ot->invoke= select_report_pick_invoke;
- ot->exec= select_report_pick_exec;
+ ot->poll = ED_operator_info_active;
+ ot->invoke = select_report_pick_invoke;
+ ot->exec = select_report_pick_exec;
/* flags */
- /* ot->flag= OPTYPE_REGISTER; */
+ /* ot->flag = OPTYPE_REGISTER; */
/* properties */
RNA_def_int(ot->srna, "report_index", 0, 0, INT_MAX, "Report", "Index of the report", 0, INT_MAX);
@@ -172,22 +172,22 @@ static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
Report *report;
- for(report=reports->list.last; report; report=report->prev) {
- if((report->type & report_mask) && (report->flag & SELECT)) {
+ for (report=reports->list.last; report; report=report->prev) {
+ if ((report->type & report_mask) && (report->flag & SELECT)) {
deselect= 1;
break;
}
}
- if(deselect) {
- for(report=reports->list.last; report; report=report->prev)
- if(report->type & report_mask)
+ if (deselect) {
+ for (report=reports->list.last; report; report=report->prev)
+ if (report->type & report_mask)
report->flag &= ~SELECT;
}
else {
- for(report=reports->list.last; report; report=report->prev)
- if(report->type & report_mask)
+ for (report=reports->list.last; report; report=report->prev)
+ if (report->type & report_mask)
report->flag |= SELECT;
}
@@ -199,16 +199,16 @@ static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
void INFO_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "(De)Select All";
- ot->description= "(de)select all reports";
- ot->idname= "INFO_OT_select_all_toggle";
+ ot->name = "(De)select All";
+ ot->description = "Select or deselect all reports";
+ ot->idname = "INFO_OT_select_all_toggle";
/* api callbacks */
- ot->poll= ED_operator_info_active;
- ot->exec= report_select_all_toggle_exec;
+ ot->poll = ED_operator_info_active;
+ ot->exec = report_select_all_toggle_exec;
/* flags */
- /*ot->flag= OPTYPE_REGISTER;*/
+ /*ot->flag = OPTYPE_REGISTER;*/
/* properties */
}
@@ -231,10 +231,10 @@ static int borderselect_exec(bContext *C, wmOperator *op)
short selecting= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
//int mval[2];
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
#if 0
mval[0]= rect.xmin;
@@ -245,10 +245,10 @@ static int borderselect_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
#endif
- if(!extend) {
- for(report= reports->list.first; report; report= report->next) {
+ if (!extend) {
+ for (report= reports->list.first; report; report= report->next) {
- if((report->type & report_mask)==0)
+ if ((report->type & report_mask)==0)
continue;
report->flag &= ~SELECT;
@@ -259,35 +259,35 @@ static int borderselect_exec(bContext *C, wmOperator *op)
report_max= info_text_pick(sinfo, ar, reports, rect.ymin);
/* get the first report if none found */
- if(report_min==NULL) {
+ if (report_min==NULL) {
// printf("find_min\n");
- for(report=reports->list.first; report; report=report->next) {
- if(report->type & report_mask) {
+ for (report=reports->list.first; report; report=report->next) {
+ if (report->type & report_mask) {
report_min= report;
break;
}
}
}
- if(report_max==NULL) {
+ if (report_max==NULL) {
// printf("find_max\n");
- for(report=reports->list.last; report; report=report->prev) {
- if(report->type & report_mask) {
+ for (report=reports->list.last; report; report=report->prev) {
+ if (report->type & report_mask) {
report_max= report;
break;
}
}
}
- if(report_min==NULL || report_max==NULL)
+ if (report_min==NULL || report_max==NULL)
return OPERATOR_CANCELLED;
- for(report= report_min; (report != report_max->next); report= report->next) {
+ for (report= report_min; (report != report_max->next); report= report->next) {
- if((report->type & report_mask)==0)
+ if ((report->type & report_mask)==0)
continue;
- if(selecting)
+ if (selecting)
report->flag |= SELECT;
else
report->flag &= ~SELECT;
@@ -303,20 +303,20 @@ static int borderselect_exec(bContext *C, wmOperator *op)
void INFO_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Select";
- ot->description= "Toggle border selection";
- ot->idname= "INFO_OT_select_border";
+ ot->name = "Border Select";
+ ot->description = "Toggle border selection";
+ ot->idname = "INFO_OT_select_border";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= borderselect_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = borderselect_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= ED_operator_info_active;
+ ot->poll = ED_operator_info_active;
/* flags */
- /* ot->flag= OPTYPE_REGISTER; */
+ /* ot->flag = OPTYPE_REGISTER; */
/* rna */
WM_operator_properties_gesture_border(ot, TRUE);
@@ -333,11 +333,11 @@ static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
Report *report, *report_next;
- for(report=reports->list.first; report; ) {
+ for (report=reports->list.first; report; ) {
report_next=report->next;
- if((report->type & report_mask) && (report->flag & SELECT)) {
+ if ((report->type & report_mask) && (report->flag & SELECT)) {
BLI_remlink(&reports->list, report);
MEM_freeN((void *)report->message);
MEM_freeN(report);
@@ -354,16 +354,16 @@ static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
void INFO_OT_report_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Reports";
- ot->description= "Delete selected reports";
- ot->idname= "INFO_OT_report_delete";
+ ot->name = "Delete Reports";
+ ot->description = "Delete selected reports";
+ ot->idname = "INFO_OT_report_delete";
/* api callbacks */
- ot->poll= ED_operator_info_active;
- ot->exec= report_delete_exec;
+ ot->poll = ED_operator_info_active;
+ ot->exec = report_delete_exec;
/* flags */
- /*ot->flag= OPTYPE_REGISTER;*/
+ /*ot->flag = OPTYPE_REGISTER;*/
/* properties */
}
@@ -380,8 +380,8 @@ static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
DynStr *buf_dyn= BLI_dynstr_new();
char *buf_str;
- for(report=reports->list.first; report; report= report->next) {
- if((report->type & report_mask) && (report->flag & SELECT)) {
+ for (report=reports->list.first; report; report= report->next) {
+ if ((report->type & report_mask) && (report->flag & SELECT)) {
BLI_dynstr_append(buf_dyn, report->message);
BLI_dynstr_append(buf_dyn, "\n");
}
@@ -399,16 +399,16 @@ static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
void INFO_OT_report_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Reports to Clipboard";
- ot->description= "Copy selected reports to Clipboard";
- ot->idname= "INFO_OT_report_copy";
+ ot->name = "Copy Reports to Clipboard";
+ ot->description = "Copy selected reports to Clipboard";
+ ot->idname = "INFO_OT_report_copy";
/* api callbacks */
- ot->poll= ED_operator_info_active;
- ot->exec= report_copy_exec;
+ ot->poll = ED_operator_info_active;
+ ot->exec = report_copy_exec;
/* flags */
- /*ot->flag= OPTYPE_REGISTER;*/
+ /*ot->flag = OPTYPE_REGISTER;*/
/* properties */
}
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 120783db340..59e4a1aaf04 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -76,7 +76,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
stats->totmesh +=totob;
- if(dm) {
+ if (dm) {
totvert = dm->getNumVerts(dm);
totedge = dm->getNumEdges(dm);
totface = dm->getNumPolys(dm);
@@ -85,7 +85,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
stats->totedge += totedge*totob;
stats->totface += totface*totob;
- if(sel) {
+ if (sel) {
stats->totvertsel += totvert;
stats->totfacesel += totface;
}
@@ -102,7 +102,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
stats->totcurve += totob;
- if(ob->disp.first)
+ if (ob->disp.first)
count_displist(&ob->disp, &tot, &totf);
tot *= totob;
@@ -111,7 +111,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
stats->totvert+= tot;
stats->totface+= totf;
- if(sel) {
+ if (sel) {
stats->totvertsel += tot;
stats->totfacesel += totf;
}
@@ -128,7 +128,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
stats->totvert += tot;
stats->totface += totf;
- if(sel) {
+ if (sel) {
stats->totvertsel += tot;
stats->totfacesel += totf;
}
@@ -139,7 +139,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
static void stats_object_edit(Object *obedit, SceneStats *stats)
{
- if(obedit->type==OB_MESH) {
+ if (obedit->type==OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(obedit);
stats->totvert = em->bm->totvert;
@@ -151,26 +151,26 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
stats->totface = em->bm->totface;
stats->totfacesel = em->bm->totfacesel;
}
- else if(obedit->type==OB_ARMATURE){
+ else if (obedit->type==OB_ARMATURE) {
/* Armature Edit */
bArmature *arm= obedit->data;
EditBone *ebo;
- for(ebo=arm->edbo->first; ebo; ebo=ebo->next){
+ for (ebo=arm->edbo->first; ebo; ebo=ebo->next) {
stats->totbone++;
- if((ebo->flag & BONE_CONNECTED) && ebo->parent)
+ if ((ebo->flag & BONE_CONNECTED) && ebo->parent)
stats->totvert--;
- if(ebo->flag & BONE_TIPSEL)
+ if (ebo->flag & BONE_TIPSEL)
stats->totvertsel++;
- if(ebo->flag & BONE_ROOTSEL)
+ if (ebo->flag & BONE_ROOTSEL)
stats->totvertsel++;
- if(ebo->flag & BONE_SELECTED) stats->totbonesel++;
+ if (ebo->flag & BONE_SELECTED) stats->totbonesel++;
/* if this is a connected child and it's parent is being moved, remove our root */
- if((ebo->flag & BONE_CONNECTED)&& (ebo->flag & BONE_ROOTSEL) && ebo->parent && (ebo->parent->flag & BONE_TIPSEL))
+ if ((ebo->flag & BONE_CONNECTED)&& (ebo->flag & BONE_ROOTSEL) && ebo->parent && (ebo->parent->flag & BONE_TIPSEL))
stats->totvertsel--;
stats->totvert+=2;
@@ -185,40 +185,40 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
int a;
ListBase *nurbs= curve_editnurbs(cu);
- for(nu=nurbs->first; nu; nu=nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu=nurbs->first; nu; nu=nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
stats->totvert+=3;
- if(bezt->f1) stats->totvertsel++;
- if(bezt->f2) stats->totvertsel++;
- if(bezt->f3) stats->totvertsel++;
+ if (bezt->f1) stats->totvertsel++;
+ if (bezt->f2) stats->totvertsel++;
+ if (bezt->f3) stats->totvertsel++;
bezt++;
}
}
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
+ while (a--) {
stats->totvert++;
- if(bp->f1 & SELECT) stats->totvertsel++;
+ if (bp->f1 & SELECT) stats->totvertsel++;
bp++;
}
}
}
}
- else if(obedit->type==OB_MBALL) {
+ else if (obedit->type==OB_MBALL) {
/* MetaBall Edit */
MetaBall *mball= obedit->data;
MetaElem *ml;
- for(ml= mball->editelems->first; ml; ml=ml->next) {
+ for (ml= mball->editelems->first; ml; ml=ml->next) {
stats->totvert++;
- if(ml->flag & SELECT) stats->totvertsel++;
+ if (ml->flag & SELECT) stats->totvertsel++;
}
}
- else if(obedit->type==OB_LATTICE) {
+ else if (obedit->type==OB_LATTICE) {
/* Lattice Edit */
Lattice *lt= obedit->data;
Lattice *editlatt= lt->editlatt->latt;
@@ -228,9 +228,9 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
bp= editlatt->def;
a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
- while(a--) {
+ while (a--) {
stats->totvert++;
- if(bp->f1 & SELECT) stats->totvertsel++;
+ if (bp->f1 & SELECT) stats->totvertsel++;
bp++;
}
}
@@ -238,53 +238,43 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
static void stats_object_pose(Object *ob, SceneStats *stats)
{
- if(ob->pose) {
+ if (ob->pose) {
bArmature *arm= ob->data;
bPoseChannel *pchan;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
stats->totbone++;
- if(pchan->bone && (pchan->bone->flag & BONE_SELECTED))
- if(pchan->bone->layer & arm->layer)
+ if (pchan->bone && (pchan->bone->flag & BONE_SELECTED))
+ if (pchan->bone->layer & arm->layer)
stats->totbonesel++;
}
}
}
-static void stats_object_paint(Object *ob, SceneStats *stats)
-{
- if(ob->type == OB_MESH) {
- Mesh *me= ob->data;
-
- stats->totface= me->totface;
- stats->totvert= me->totvert;
- }
-}
-
static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats)
{
- if(base->flag & SELECT) stats->totobjsel++;
+ if (base->flag & SELECT) stats->totobjsel++;
- if(ob->transflag & OB_DUPLIPARTS) {
+ if (ob->transflag & OB_DUPLIPARTS) {
/* Dupli Particles */
ParticleSystem *psys;
ParticleSettings *part;
- for(psys=ob->particlesystem.first; psys; psys=psys->next){
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
part=psys->part;
- if(part->draw_as==PART_DRAW_OB && part->dup_ob){
+ if (part->draw_as==PART_DRAW_OB && part->dup_ob) {
int tot=count_particles(psys);
stats_object(part->dup_ob, 0, tot, stats);
}
- else if(part->draw_as==PART_DRAW_GR && part->dup_group){
+ else if (part->draw_as==PART_DRAW_GR && part->dup_group) {
GroupObject *go;
int tot, totgroup=0, cur=0;
- for(go= part->dup_group->gobject.first; go; go=go->next)
+ for (go= part->dup_group->gobject.first; go; go=go->next)
totgroup++;
- for(go= part->dup_group->gobject.first; go; go=go->next) {
+ for (go= part->dup_group->gobject.first; go; go=go->next) {
tot=count_particles_mod(psys,totgroup,cur);
stats_object(go->ob, 0, tot, stats);
cur++;
@@ -295,19 +285,19 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats)
stats_object(ob, base->flag & SELECT, 1, stats);
stats->totobj++;
}
- else if(ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS|OB_DUPLIFACES))) {
+ else if (ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS|OB_DUPLIFACES))) {
/* Dupli Verts/Faces */
int tot= count_duplilist(ob->parent);
stats->totobj+=tot;
stats_object(ob, base->flag & SELECT, tot, stats);
}
- else if(ob->transflag & OB_DUPLIFRAMES) {
+ else if (ob->transflag & OB_DUPLIFRAMES) {
/* Dupli Frames */
int tot= count_duplilist(ob);
stats->totobj+=tot;
stats_object(ob, base->flag & SELECT, tot, stats);
}
- else if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
+ else if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
/* Dupli Group */
int tot= count_duplilist(ob);
stats->totobj+=tot;
@@ -327,26 +317,22 @@ static void stats_update(Scene *scene)
Object *ob= (scene->basact)? scene->basact->object: NULL;
Base *base;
- if(scene->obedit) {
+ if (scene->obedit) {
/* Edit Mode */
stats_object_edit(scene->obedit, &stats);
}
- else if(ob && (ob->mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
/* Pose Mode */
stats_object_pose(ob, &stats);
}
- else if(ob && (ob->flag & OB_MODE_ALL_PAINT)) {
- /* Sculpt and Paint Mode */
- stats_object_paint(ob, &stats);
- }
else {
/* Objects */
- for(base= scene->base.first; base; base=base->next)
- if(scene->lay & base->lay)
+ for (base= scene->base.first; base; base=base->next)
+ if (scene->lay & base->lay)
stats_dupli_object(base, base->object, &stats);
}
- if(!scene->stats)
+ if (!scene->stats)
scene->stats= MEM_callocN(sizeof(SceneStats), "SceneStats");
*(scene->stats)= stats;
@@ -365,28 +351,28 @@ static void stats_string(Scene *scene)
/* get memory statistics */
s= memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use-mmap_in_use)>>10)/1024.0);
- if(mmap_in_use)
+ if (mmap_in_use)
sprintf(s, " (%.2fM)", (double)((mmap_in_use)>>10)/1024.0);
s= stats->infostr;
s+= sprintf(s, "%s | ", versionstr);
- if(scene->obedit) {
- if(ob_get_keyblock(scene->obedit))
+ if (scene->obedit) {
+ if (ob_get_keyblock(scene->obedit))
s+= sprintf(s, "(Key) ");
- if(scene->obedit->type==OB_MESH) {
- if(scene->toolsettings->selectmode & SCE_SELECT_VERTEX)
+ if (scene->obedit->type==OB_MESH) {
+ if (scene->toolsettings->selectmode & SCE_SELECT_VERTEX)
s+= sprintf(s, "Ve:%d-%d | Ed:%d-%d | Fa:%d-%d",
stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface);
- else if(scene->toolsettings->selectmode & SCE_SELECT_EDGE)
+ else if (scene->toolsettings->selectmode & SCE_SELECT_EDGE)
s+= sprintf(s, "Ed:%d-%d | Fa:%d-%d",
stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface);
else
s+= sprintf(s, "Fa:%d-%d", stats->totfacesel, stats->totface);
}
- else if(scene->obedit->type==OB_ARMATURE) {
+ else if (scene->obedit->type==OB_ARMATURE) {
s+= sprintf(s, "Ve:%d-%d | Bo:%d-%d", stats->totvertsel, stats->totvert, stats->totbonesel, stats->totbone);
}
else {
@@ -395,7 +381,7 @@ static void stats_string(Scene *scene)
strcat(s, memstr);
}
- else if(ob && (ob->mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
s += sprintf(s, "Bo:%d-%d %s",
stats->totbonesel, stats->totbone, memstr);
}
@@ -404,13 +390,13 @@ static void stats_string(Scene *scene)
stats->totvert, stats->totface, stats->totobjsel, stats->totobj, stats->totlamp, memstr);
}
- if(ob)
+ if (ob)
sprintf(s, " | %s", ob->id.name+2);
}
void ED_info_stats_clear(Scene *scene)
{
- if(scene->stats) {
+ if (scene->stats) {
MEM_freeN(scene->stats);
scene->stats= NULL;
}
@@ -418,7 +404,7 @@ void ED_info_stats_clear(Scene *scene)
const char *ED_info_stats_string(Scene *scene)
{
- if(!scene->stats)
+ if (!scene->stats)
stats_update(scene);
stats_string(scene);
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index b9ef57e6850..9dc58537145 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -131,7 +131,7 @@ static void info_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Info", SPACE_INFO, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Info", SPACE_INFO, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -155,7 +155,7 @@ static void info_main_area_draw(const bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
/* quick way to avoid drawing if not bug enough */
- if(ar->winy < 16)
+ if (ar->winy < 16)
return;
info_textview_update_rect(C, ar);
@@ -196,12 +196,12 @@ static void info_operatortypes(void)
static void info_keymap(struct wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Window", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Window", 0, 0);
WM_keymap_verify_item(keymap, "INFO_OT_reports_display_update", TIMERREPORT, KM_ANY, KM_ANY, 0);
/* info space */
- keymap= WM_keymap_find(keyconf, "Info", SPACE_INFO, 0);
+ keymap = WM_keymap_find(keyconf, "Info", SPACE_INFO, 0);
/* report selection */
@@ -233,7 +233,7 @@ static void info_main_area_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch(wmn->category) {
case NC_SPACE:
- if(wmn->data == ND_SPACE_INFO_REPORT) {
+ if (wmn->data == ND_SPACE_INFO_REPORT) {
/* redraw also but only for report view, could do less redraws by checking the type */
ED_region_tag_redraw(ar);
}
@@ -246,23 +246,23 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch(wmn->category) {
case NC_SCREEN:
- if(ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY))
+ if (ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY))
ED_region_tag_redraw(ar);
break;
case NC_WM:
- if(wmn->data == ND_JOB)
+ if (wmn->data == ND_JOB)
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- if(wmn->data==ND_RENDER_RESULT)
+ if (wmn->data==ND_RENDER_RESULT)
ED_region_tag_redraw(ar);
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_INFO)
+ if (wmn->data == ND_SPACE_INFO)
ED_region_tag_redraw(ar);
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
}
@@ -274,10 +274,11 @@ static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu)
uiLayout *layout= menu->layout;
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
if (G.recent_files.first) {
- for(recent = G.recent_files.first; (recent); recent = recent->next) {
+ for (recent = G.recent_files.first; (recent); recent = recent->next) {
uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
}
- } else {
+ }
+ else {
uiItemL(layout, IFACE_("No Recent Files"), ICON_NONE);
}
}
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index 177b72567e5..c55ba069e11 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -65,7 +65,7 @@ typedef struct ConsoleDrawContext {
static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight)
{
- if(sel[0] <= str_len_draw && sel[1] >= 0) {
+ if (sel[0] <= str_len_draw && sel[1] >= 0) {
int sta = MAX2(sel[0], 0);
int end = MIN2(sel[1], str_len_draw);
@@ -95,19 +95,20 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
const int mono= blf_mono_font;
/* just advance the height */
- if(cdc->draw==0) {
- if(cdc->pos_pick && (cdc->mval[1] != INT_MAX)) {
- if(cdc->xy[1] <= cdc->mval[1]) {
- if((y_next >= cdc->mval[1])) {
+ if (cdc->draw==0) {
+ if (cdc->pos_pick && (cdc->mval[1] != INT_MAX)) {
+ if (cdc->xy[1] <= cdc->mval[1]) {
+ if ((y_next >= cdc->mval[1])) {
int ofs = (int)floor(((float)cdc->mval[0] / (float)cdc->cwidth));
/* wrap */
- if(str_len > cdc->console_width)
+ if (str_len > cdc->console_width)
ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next-cdc->xy[1])) * tot_lines))));
CLAMP(ofs, 0, str_len);
*cdc->pos_pick += str_len - ofs;
- } else
+ }
+ else
*cdc->pos_pick += str_len + 1;
}
}
@@ -120,14 +121,14 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
cdc->xy[1]= y_next;
/* adjust selection even if not drawing */
- if(cdc->sel[0] != cdc->sel[1]) {
+ if (cdc->sel[0] != cdc->sel[1]) {
STEP_SEL(-(str_len + 1));
}
return 1;
}
- if(str_len > cdc->console_width) { /* wrap? */
+ if (str_len > cdc->console_width) { /* wrap? */
const int initial_offset= ((tot_lines-1) * cdc->console_width);
const char *line_stride= str + initial_offset; /* advance to the last line and draw it first */
@@ -138,7 +139,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
cdc->sel[0] = str_len - sel_orig[1];
cdc->sel[1] = str_len - sel_orig[0];
- if(bg) {
+ if (bg) {
glColor3ubv(bg);
glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, (cdc->xy[1]+(cdc->lheight*tot_lines))+rct_ofs);
}
@@ -149,7 +150,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
BLF_draw(mono, line_stride, str_len - initial_offset);
- if(cdc->sel[0] != cdc->sel[1]) {
+ if (cdc->sel[0] != cdc->sel[1]) {
STEP_SEL(-initial_offset);
// glColor4ub(255, 0, 0, 96); // debug
console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight);
@@ -161,11 +162,11 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
line_stride -= cdc->console_width;
- for(; line_stride >= str; line_stride -= cdc->console_width) {
+ for (; line_stride >= str; line_stride -= cdc->console_width) {
BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
BLF_draw(mono, line_stride, cdc->console_width);
- if(cdc->sel[0] != cdc->sel[1]) {
+ if (cdc->sel[0] != cdc->sel[1]) {
// glColor4ub(0, 255, 0, 96); // debug
console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight);
STEP_SEL(cdc->console_width);
@@ -175,7 +176,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
cdc->xy[1] += cdc->lheight;
/* check if were out of view bounds */
- if(cdc->xy[1] > cdc->ymax)
+ if (cdc->xy[1] > cdc->ymax)
return 0;
}
@@ -184,7 +185,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
}
else { /* simple, no wrap */
- if(bg) {
+ if (bg) {
glColor3ubv(bg);
glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, cdc->xy[1]+cdc->lheight-rct_ofs);
}
@@ -194,7 +195,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
BLF_draw(mono, str, str_len);
- if(cdc->sel[0] != cdc->sel[1]) {
+ if (cdc->sel[0] != cdc->sel[1]) {
int isel[2];
isel[0]= str_len - cdc->sel[1];
@@ -207,7 +208,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
cdc->xy[1] += cdc->lheight;
- if(cdc->xy[1] > cdc->ymax)
+ if (cdc->xy[1] > cdc->ymax)
return 0;
}
@@ -232,10 +233,10 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick
xy[0]= x_orig; xy[1]= y_orig;
- if(mval[1] != INT_MAX)
+ if (mval[1] != INT_MAX)
mval[1] += (tvc->ymin + CONSOLE_DRAW_MARGIN);
- if(pos_pick)
+ if (pos_pick)
*pos_pick = 0;
/* constants for the sequencer context */
@@ -245,8 +246,8 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick
cdc.console_width= (tvc->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN*2) ) / cdc.cwidth;
CLAMP(cdc.console_width, 1, INT_MAX); /* avoid divide by zero on small windows */
cdc.winx= tvc->winx-(CONSOLE_DRAW_MARGIN+CONSOLE_DRAW_SCROLL);
- cdc.ymin= tvc->ymin;
- cdc.ymax= tvc->ymax;
+ cdc.ymin = tvc->ymin;
+ cdc.ymax = tvc->ymax;
cdc.xy= xy;
cdc.sel= sel;
cdc.pos_pick= pos_pick;
@@ -258,12 +259,12 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick
tvc->console_width= cdc.console_width;
tvc->iter_index= 0;
- if(tvc->sel_start != tvc->sel_end) {
+ if (tvc->sel_start != tvc->sel_end) {
sel[0]= tvc->sel_start;
sel[1]= tvc->sel_end;
}
- if(tvc->begin(tvc)) {
+ if (tvc->begin(tvc)) {
do {
const char *ext_line;
@@ -272,26 +273,26 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick
y_prev= xy[1];
- if(draw)
+ if (draw)
color_flag= tvc->line_color(tvc, fg, bg);
tvc->line_get(tvc, &ext_line, &ext_len);
- if(!console_draw_string(&cdc, ext_line, ext_len, (color_flag & TVC_LINE_FG) ? fg : NULL, (color_flag & TVC_LINE_BG) ? bg : NULL)) {
+ if (!console_draw_string(&cdc, ext_line, ext_len, (color_flag & TVC_LINE_FG) ? fg : NULL, (color_flag & TVC_LINE_BG) ? bg : NULL)) {
/* when drawing, if we pass v2d->cur.ymax, then quit */
- if(draw) {
+ if (draw) {
break; /* past the y limits */
}
}
- if((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) {
+ if ((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) {
*mouse_pick= (void *)tvc->iter;
break;
}
tvc->iter_index++;
- } while(tvc->step(tvc));
+ } while (tvc->step(tvc));
}
tvc->end(tvc);
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
index 388f9470cb5..b98e6995f46 100644
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -108,7 +108,7 @@ static int logic_properties(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= logic_has_buttons_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -116,15 +116,15 @@ static int logic_properties(bContext *C, wmOperator *UNUSED(op))
void LOGIC_OT_properties(wmOperatorType *ot)
{
- ot->name= "Properties";
- ot->description= "Toggle display properties panel";
- ot->idname= "LOGIC_OT_properties";
+ ot->name = "Properties";
+ ot->description = "Toggle display properties panel";
+ ot->idname = "LOGIC_OT_properties";
- ot->exec= logic_properties;
- ot->poll= ED_operator_logic_active;
+ ot->exec = logic_properties;
+ ot->poll = ED_operator_logic_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
/* Remove Logic Bricks Connections */
@@ -137,15 +137,15 @@ static int cut_links_intersect(uiLinkLine *line, float mcoords[][2], int tot)
int i, b;
rcti rectlink;
- rectlink.xmin= (int) (line->from->x1 + line->from->x2) / 2;
- rectlink.ymin= (int) (line->from->y1 + line->from->y2) / 2;
- rectlink.xmax= (int) (line->to->x1 + line->to->x2) / 2;
- rectlink.ymax= (int) (line->to->y1 + line->to->y2) / 2;
+ rectlink.xmin = (int) (line->from->x1 + line->from->x2) / 2;
+ rectlink.ymin = (int) (line->from->y1 + line->from->y2) / 2;
+ rectlink.xmax = (int) (line->to->x1 + line->to->x2) / 2;
+ rectlink.ymax = (int) (line->to->y1 + line->to->y2) / 2;
- if(ui_link_bezier_points(&rectlink, coord_array, LINK_RESOL)){
- for(i=0; i<tot-1; i++)
- for(b=0; b<LINK_RESOL-1; b++)
- if(isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0)
+ if (ui_link_bezier_points(&rectlink, coord_array, LINK_RESOL)) {
+ for (i=0; i<tot-1; i++)
+ for (b=0; b<LINK_RESOL-1; b++)
+ if (isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0)
return 1;
}
return 0;
@@ -164,7 +164,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(&ar->v2d, (short)loc[0], (short)loc[1],
&mcoords[i][0], &mcoords[i][1]);
i++;
- if(i>= 256) break;
+ if (i>= 256) break;
}
RNA_END;
@@ -172,15 +172,15 @@ 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) {
- for(line= but->link->lines.first; line; line= nline) {
+ while (but) {
+ if (but->type==LINK && but->link) {
+ for (line= but->link->lines.first; line; line= nline) {
nline= line->next;
- if(cut_links_intersect(line, mcoords, i)) {
+ if (cut_links_intersect(line, mcoords, i)) {
ui_delete_linkline(line, but);
}
}
@@ -197,19 +197,19 @@ void LOGIC_OT_links_cut(wmOperatorType *ot)
{
PropertyRNA *prop;
- ot->name= "Cut links";
- ot->idname= "LOGIC_OT_links_cut";
- ot->description= "Remove logic brick connections";
+ ot->name = "Cut links";
+ ot->idname = "LOGIC_OT_links_cut";
+ ot->description = "Remove logic brick connections";
- ot->invoke= WM_gesture_lines_invoke;
- ot->modal= WM_gesture_lines_modal;
- ot->exec= cut_links_exec;
- ot->cancel= WM_gesture_lines_cancel;
+ ot->invoke = WM_gesture_lines_invoke;
+ ot->modal = WM_gesture_lines_modal;
+ ot->exec = cut_links_exec;
+ ot->cancel = WM_gesture_lines_cancel;
- ot->poll= ED_operator_logic_active;
+ ot->poll = ED_operator_logic_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c
index 86ac2d0c369..cac4fe04765 100644
--- a/source/blender/editors/space_logic/logic_ops.c
+++ b/source/blender/editors/space_logic/logic_ops.c
@@ -258,16 +258,16 @@ static int sensor_remove_exec(bContext *C, wmOperator *op)
static void LOGIC_OT_sensor_remove(wmOperatorType *ot)
{
- ot->name= "Remove Sensor";
- ot->description= "Remove a sensor from the active object";
- ot->idname= "LOGIC_OT_sensor_remove";
+ ot->name = "Remove Sensor";
+ ot->description = "Remove a sensor from the active object";
+ ot->idname = "LOGIC_OT_sensor_remove";
- ot->invoke= sensor_remove_invoke;
- ot->exec= sensor_remove_exec;
- ot->poll= edit_sensor_poll;
+ ot->invoke = sensor_remove_invoke;
+ ot->exec = sensor_remove_exec;
+ ot->poll = edit_sensor_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_sensor_properties(ot);
}
@@ -293,7 +293,7 @@ static int sensor_add_exec(bContext *C, wmOperator *op)
prop = RNA_struct_find_property(&sens_ptr, "type");
RNA_string_get(op->ptr, "name", name);
- if(BLI_strnlen(name, MAX_NAME) < 1){
+ if (BLI_strnlen(name, MAX_NAME) < 1) {
RNA_property_enum_name(C, &sens_ptr, prop, RNA_property_enum_get(&sens_ptr, prop), &sens_name);
BLI_strncpy(sens->name, sens_name, sizeof(sens->name));
}
@@ -313,20 +313,20 @@ static void LOGIC_OT_sensor_add(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Sensor";
+ ot->name = "Add Sensor";
ot->description = "Add a sensor to the active object";
- ot->idname= "LOGIC_OT_sensor_add";
+ ot->idname = "LOGIC_OT_sensor_add";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= sensor_add_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = sensor_add_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add");
+ ot->prop = prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add");
RNA_def_enum_funcs(prop, rna_Sensor_type_itemf);
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Sensor to add");
RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Sensor to");
@@ -361,16 +361,16 @@ static int controller_remove_exec(bContext *C, wmOperator *op)
static void LOGIC_OT_controller_remove(wmOperatorType *ot)
{
- ot->name= "Remove Controller";
- ot->description= "Remove a controller from the active object";
- ot->idname= "LOGIC_OT_controller_remove";
+ ot->name = "Remove Controller";
+ ot->description = "Remove a controller from the active object";
+ ot->idname = "LOGIC_OT_controller_remove";
- ot->invoke= controller_remove_invoke;
- ot->exec= controller_remove_exec;
- ot->poll= edit_controller_poll;
+ ot->invoke = controller_remove_invoke;
+ ot->exec = controller_remove_exec;
+ ot->poll = edit_controller_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_controller_properties(ot);
}
@@ -386,7 +386,7 @@ static int controller_add_exec(bContext *C, wmOperator *op)
int type= RNA_enum_get(op->ptr, "type");
ob= edit_object_property_get(C, op);
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
cont= new_controller(type);
@@ -397,7 +397,7 @@ static int controller_add_exec(bContext *C, wmOperator *op)
prop = RNA_struct_find_property(&cont_ptr, "type");
RNA_string_get(op->ptr, "name", name);
- if(BLI_strnlen(name, MAX_NAME) < 1){
+ if (BLI_strnlen(name, MAX_NAME) < 1) {
RNA_property_enum_name(C, &cont_ptr, prop, RNA_property_enum_get(&cont_ptr, prop), &cont_name);
BLI_strncpy(cont->name, cont_name, sizeof(cont->name));
}
@@ -428,20 +428,20 @@ static int controller_add_exec(bContext *C, wmOperator *op)
static void LOGIC_OT_controller_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Controller";
+ ot->name = "Add Controller";
ot->description = "Add a controller to the active object";
- ot->idname= "LOGIC_OT_controller_add";
+ ot->idname = "LOGIC_OT_controller_add";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= controller_add_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = controller_add_exec;
+ 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", controller_type_items, CONT_LOGIC_AND, "Type", "Type of controller to add");
+ ot->prop = RNA_def_enum(ot->srna, "type", controller_type_items, CONT_LOGIC_AND, "Type", "Type of controller to add");
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Controller to add");
RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Controller to");
}
@@ -475,16 +475,16 @@ static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
static void LOGIC_OT_actuator_remove(wmOperatorType *ot)
{
- ot->name= "Remove Actuator";
- ot->description= "Remove an actuator from the active object";
- ot->idname= "LOGIC_OT_actuator_remove";
+ ot->name = "Remove Actuator";
+ ot->description = "Remove an actuator from the active object";
+ ot->idname = "LOGIC_OT_actuator_remove";
- ot->invoke= actuator_remove_invoke;
- ot->exec= actuator_remove_exec;
- ot->poll= edit_actuator_poll;
+ ot->invoke = actuator_remove_invoke;
+ ot->exec = actuator_remove_exec;
+ ot->poll = edit_actuator_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
edit_actuator_properties(ot);
}
@@ -499,7 +499,7 @@ static int actuator_add_exec(bContext *C, wmOperator *op)
int type= RNA_enum_get(op->ptr, "type");
ob= edit_object_property_get(C, op);
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
act= new_actuator(type);
@@ -510,7 +510,7 @@ static int actuator_add_exec(bContext *C, wmOperator *op)
prop = RNA_struct_find_property(&act_ptr, "type");
RNA_string_get(op->ptr, "name", name);
- if (BLI_strnlen(name, MAX_NAME) < 1){
+ if (BLI_strnlen(name, MAX_NAME) < 1) {
RNA_property_enum_name(C, &act_ptr, prop, RNA_property_enum_get(&act_ptr, prop), &act_name);
BLI_strncpy(act->name, act_name, sizeof(act->name));
}
@@ -530,20 +530,20 @@ static void LOGIC_OT_actuator_add(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Actuator";
+ ot->name = "Add Actuator";
ot->description = "Add an actuator to the active object";
- ot->idname= "LOGIC_OT_actuator_add";
+ ot->idname = "LOGIC_OT_actuator_add";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= actuator_add_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = actuator_add_exec;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add");
+ ot->prop = prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add");
RNA_def_enum_funcs(prop, rna_Actuator_type_itemf);
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Actuator to add");
RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Actuator to");
@@ -584,17 +584,17 @@ static int sensor_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
static void LOGIC_OT_sensor_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Sensor";
+ ot->name = "Move Sensor";
ot->description = "Move Sensor";
- ot->idname= "LOGIC_OT_sensor_move";
+ ot->idname = "LOGIC_OT_sensor_move";
/* api callbacks */
- ot->invoke= sensor_move_invoke;
- ot->exec= sensor_move_exec;
- ot->poll= edit_sensor_poll;
+ ot->invoke = sensor_move_invoke;
+ ot->exec = sensor_move_exec;
+ ot->poll = edit_sensor_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
edit_sensor_properties(ot);
@@ -629,17 +629,17 @@ static int controller_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
static void LOGIC_OT_controller_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Controller";
+ ot->name = "Move Controller";
ot->description = "Move Controller";
- ot->idname= "LOGIC_OT_controller_move";
+ ot->idname = "LOGIC_OT_controller_move";
/* api callbacks */
- ot->invoke= controller_move_invoke;
- ot->exec= controller_move_exec;
- ot->poll= edit_controller_poll;
+ ot->invoke = controller_move_invoke;
+ ot->exec = controller_move_exec;
+ ot->poll = edit_controller_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
edit_controller_properties(ot);
@@ -674,17 +674,17 @@ static int actuator_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
static void LOGIC_OT_actuator_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Actuator";
+ ot->name = "Move Actuator";
ot->description = "Move Actuator";
- ot->idname= "LOGIC_OT_actuator_move";
+ ot->idname = "LOGIC_OT_actuator_move";
/* api callbacks */
- ot->invoke= actuator_move_invoke;
- ot->exec= actuator_move_exec;
- ot->poll= edit_actuator_poll;
+ ot->invoke = actuator_move_invoke;
+ ot->exec = actuator_move_exec;
+ ot->poll = edit_actuator_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
edit_actuator_properties(ot);
@@ -708,17 +708,17 @@ static int texface_convert_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
static void LOGIC_OT_texface_convert(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "TexFace to Material Converter";
+ ot->name = "TexFace to Material Converter";
ot->description = "Convert old texface settings into material. It may create new materials if needed";
- ot->idname= "LOGIC_OT_texface_convert";
+ ot->idname = "LOGIC_OT_texface_convert";
/* api callbacks */
- ot->invoke= texface_convert_invoke;
- ot->exec= texface_convert_exec;
-// ot->poll= texface_convert_poll;
+ ot->invoke = texface_convert_invoke;
+ ot->exec = texface_convert_exec;
+// ot->poll = texface_convert_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 4a301277ff3..37b284a030d 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -132,15 +132,15 @@ void make_unique_prop_names(bContext *C, char *str)
/* for each object, make properties and sca names unique */
/* count total names */
- for(a=0; a<obcount; a++) {
+ for (a=0; a<obcount; a++) {
ob= (Object *)idar[a];
propcount+= BLI_countlist(&ob->prop);
propcount+= BLI_countlist(&ob->sensors);
propcount+= BLI_countlist(&ob->controllers);
propcount+= BLI_countlist(&ob->actuators);
}
- if(propcount==0) {
- if(idar) MEM_freeN(idar);
+ if (propcount==0) {
+ if (idar) MEM_freeN(idar);
return;
}
@@ -149,25 +149,25 @@ void make_unique_prop_names(bContext *C, char *str)
/* count total names */
nr= 0;
- for(a=0; a<obcount; a++) {
+ for (a=0; a<obcount; a++) {
ob= (Object *)idar[a];
prop= ob->prop.first;
- while(prop) {
+ while (prop) {
names[nr++]= prop->name;
prop= prop->next;
}
sens= ob->sensors.first;
- while(sens) {
+ while (sens) {
names[nr++]= sens->name;
sens= sens->next;
}
cont= ob->controllers.first;
- while(cont) {
+ while (cont) {
names[nr++]= cont->name;
cont= cont->next;
}
act= ob->actuators.first;
- while(act) {
+ while (act) {
names[nr++]= act->name;
act= act->next;
}
@@ -177,8 +177,8 @@ void make_unique_prop_names(bContext *C, char *str)
/* now we check for double names, and change them */
- for(nr=0; nr<propcount; nr++) {
- if(names[nr]!=str && strcmp( names[nr], str )==0 ) {
+ for (nr=0; nr<propcount; nr++) {
+ if (names[nr]!=str && strcmp( names[nr], str )==0 ) {
BLI_newname(str, +1);
}
}
@@ -208,19 +208,19 @@ static void old_sca_move_sensor(bContext *C, void *datav, void *move_up)
// val= pupmenu("Move up%x1|Move down %x2");
val = move_up ? 1:2;
- if(val>0) {
+ if (val>0) {
/* now find out which object has this ... */
base= FIRSTBASE;
- while(base) {
+ while (base) {
sens= base->object->sensors.first;
- while(sens) {
- if(sens == sens_to_delete) break;
+ while (sens) {
+ if (sens == sens_to_delete) break;
sens= sens->next;
}
- if(sens) {
- if( val==1 && sens->prev) {
+ if (sens) {
+ if ( val==1 && sens->prev) {
for (tmp=sens->prev; tmp; tmp=tmp->prev) {
if (tmp->flag & SENS_VISIBLE)
break;
@@ -230,7 +230,7 @@ static void old_sca_move_sensor(bContext *C, void *datav, void *move_up)
BLI_insertlinkbefore(&base->object->sensors, tmp, sens);
}
}
- else if( val==2 && sens->next) {
+ else if ( val==2 && sens->next) {
for (tmp=sens->next; tmp; tmp=tmp->next) {
if (tmp->flag & SENS_VISIBLE)
break;
@@ -261,23 +261,23 @@ static void old_sca_move_controller(bContext *C, void *datav, void *move_up)
//val= pupmenu("Move up%x1|Move down %x2");
val = move_up ? 1:2;
- if(val>0) {
+ if (val>0) {
/* now find out which object has this ... */
base= FIRSTBASE;
- while(base) {
+ while (base) {
cont= base->object->controllers.first;
- while(cont) {
- if(cont == controller_to_del) break;
+ while (cont) {
+ if (cont == controller_to_del) break;
cont= cont->next;
}
- if(cont) {
- if( val==1 && cont->prev) {
+ if (cont) {
+ if ( val==1 && cont->prev) {
/* locate the controller that has the same state mask but is earlier in the list */
tmp = cont->prev;
- while(tmp) {
- if(tmp->state_mask & cont->state_mask)
+ while (tmp) {
+ if (tmp->state_mask & cont->state_mask)
break;
tmp = tmp->prev;
}
@@ -286,10 +286,10 @@ static void old_sca_move_controller(bContext *C, void *datav, void *move_up)
BLI_insertlinkbefore(&base->object->controllers, tmp, cont);
}
}
- else if( val==2 && cont->next) {
+ else if ( val==2 && cont->next) {
tmp = cont->next;
- while(tmp) {
- if(tmp->state_mask & cont->state_mask)
+ while (tmp) {
+ if (tmp->state_mask & cont->state_mask)
break;
tmp = tmp->next;
}
@@ -317,19 +317,19 @@ static void old_sca_move_actuator(bContext *C, void *datav, void *move_up)
//val= pupmenu("Move up%x1|Move down %x2");
val = move_up ? 1:2;
- if(val>0) {
+ if (val>0) {
/* now find out which object has this ... */
base= FIRSTBASE;
- while(base) {
+ while (base) {
act= base->object->actuators.first;
- while(act) {
- if(act == actuator_to_move) break;
+ while (act) {
+ if (act == actuator_to_move) break;
act= act->next;
}
- if(act) {
- if( val==1 && act->prev) {
+ if (act) {
+ if ( val==1 && act->prev) {
/* locate the first visible actuators before this one */
for (tmp = act->prev; tmp; tmp=tmp->prev) {
if (tmp->flag & ACT_VISIBLE)
@@ -340,7 +340,7 @@ static void old_sca_move_actuator(bContext *C, void *datav, void *move_up)
BLI_insertlinkbefore(&base->object->actuators, tmp, act);
}
}
- else if( val==2 && act->next) {
+ else if ( val==2 && act->next) {
for (tmp=act->next; tmp; tmp=tmp->next) {
if (tmp->flag & ACT_VISIBLE)
break;
@@ -369,7 +369,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
int didit, bit;
ob= CTX_data_active_object(C);
- if(ob==NULL) return;
+ if (ob==NULL) return;
switch(event) {
@@ -385,8 +385,8 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
case B_ADD_SENS:
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
- if(ob->scaflag & OB_ADDSENS) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
+ if (ob->scaflag & OB_ADDSENS) {
ob->scaflag &= ~OB_ADDSENS;
sens= new_sensor(SENS_ALWAYS);
BLI_addtail(&(ob->sensors), sens);
@@ -399,10 +399,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
case B_CHANGE_SENS:
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
sens= ob->sensors.first;
- while(sens) {
- if(sens->type != sens->otype) {
+ while (sens) {
+ if (sens->type != sens->otype) {
init_sensor(sens);
sens->otype= sens->type;
break;
@@ -413,10 +413,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
case B_DEL_SENS:
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
sens= ob->sensors.first;
- while(sens) {
- if(sens->flag & SENS_DEL) {
+ while (sens) {
+ if (sens->flag & SENS_DEL) {
BLI_remlink(&(ob->sensors), sens);
free_sensor(sens);
break;
@@ -428,8 +428,8 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
case B_ADD_CONT:
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
- if(ob->scaflag & OB_ADDCONT) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
+ if (ob->scaflag & OB_ADDCONT) {
ob->scaflag &= ~OB_ADDCONT;
cont= new_controller(CONT_LOGIC_AND);
make_unique_prop_names(C, cont->name);
@@ -453,8 +453,8 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
case B_SET_STATE_BIT:
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
- if(ob->scaflag & OB_ALLSTATE) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
+ if (ob->scaflag & OB_ALLSTATE) {
ob->scaflag &= ~OB_ALLSTATE;
ob->state = 0x3FFFFFFF;
}
@@ -462,8 +462,8 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
case B_INIT_STATE_BIT:
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
- if(ob->scaflag & OB_INITSTBIT) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
+ if (ob->scaflag & OB_INITSTBIT) {
ob->scaflag &= ~OB_INITSTBIT;
ob->state = ob->init_state;
if (!ob->state)
@@ -473,10 +473,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
case B_CHANGE_CONT:
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
cont= ob->controllers.first;
- while(cont) {
- if(cont->type != cont->otype) {
+ while (cont) {
+ if (cont->type != cont->otype) {
init_controller(cont);
cont->otype= cont->type;
break;
@@ -488,10 +488,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
case B_DEL_CONT:
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
cont= ob->controllers.first;
- while(cont) {
- if(cont->flag & CONT_DEL) {
+ while (cont) {
+ if (cont->flag & CONT_DEL) {
BLI_remlink(&(ob->controllers), cont);
unlink_controller(cont);
free_controller(cont);
@@ -504,8 +504,8 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
case B_ADD_ACT:
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
- if(ob->scaflag & OB_ADDACT) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
+ if (ob->scaflag & OB_ADDACT) {
ob->scaflag &= ~OB_ADDACT;
act= new_actuator(ACT_OBJECT);
make_unique_prop_names(C, act->name);
@@ -517,10 +517,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
case B_CHANGE_ACT:
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
act= ob->actuators.first;
- while(act) {
- if(act->type != act->otype) {
+ while (act) {
+ if (act->type != act->otype) {
init_actuator(act);
act->otype= act->type;
break;
@@ -531,10 +531,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
case B_DEL_ACT:
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
act= ob->actuators.first;
- while(act) {
- if(act->flag & ACT_DEL) {
+ while (act) {
+ if (act->flag & ACT_DEL) {
BLI_remlink(&(ob->actuators), act);
unlink_actuator(act);
free_actuator(act);
@@ -549,38 +549,38 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
case B_SOUNDACT_BROWSE:
/* since we don't know which... */
didit= 0;
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
act= ob->actuators.first;
- while(act)
+ while (act)
{
- if(act->type==ACT_SOUND)
+ if (act->type==ACT_SOUND)
{
bSoundActuator *sa= act->data;
- if(sa->sndnr)
+ if (sa->sndnr)
{
ID *sound= bmain->sound.first;
int nr= 1;
- if(sa->sndnr == -2) {
+ if (sa->sndnr == -2) {
// XXX activate_databrowse((ID *)bmain->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE,
// &sa->sndnr, do_logic_buts);
break;
}
- while(sound)
+ while (sound)
{
- if(nr==sa->sndnr)
+ if (nr==sa->sndnr)
break;
nr++;
sound= sound->next;
}
- if(sa->sound)
+ if (sa->sound)
((ID *)sa->sound)->us--;
sa->sound= (struct bSound *)sound;
- if(sound)
+ if (sound)
sound->us++;
sa->sndnr= 0;
@@ -589,7 +589,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
}
act= act->next;
}
- if(didit)
+ if (didit)
break;
}
@@ -759,12 +759,12 @@ static void set_sca_ob(Object *ob)
bActuator *act;
cont= ob->controllers.first;
- while(cont) {
+ while (cont) {
cont->mynew= (bController *)ob;
cont= cont->next;
}
act= ob->actuators.first;
- while(act) {
+ while (act) {
act->mynew= (bActuator *)ob;
act= act->next;
}
@@ -788,10 +788,10 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
*count= 0;
- if(scene==NULL) return NULL;
+ if (scene==NULL) return NULL;
ob= bmain->object.first;
- while(ob) {
+ while (ob) {
ob->scavisflag= 0;
set_sca_ob(ob);
ob= ob->id.next;
@@ -801,78 +801,78 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
lay= scene->lay;
base= FIRSTBASE;
- while(base) {
- if(base->lay & lay) {
- if(base->flag & SELECT) {
- if(scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS;
- if(scavisflag & BUTS_CONT_SEL) base->object->scavisflag |= OB_VIS_CONT;
- if(scavisflag & BUTS_ACT_SEL) base->object->scavisflag |= OB_VIS_ACT;
+ while (base) {
+ if (base->lay & lay) {
+ if (base->flag & SELECT) {
+ if (scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS;
+ if (scavisflag & BUTS_CONT_SEL) base->object->scavisflag |= OB_VIS_CONT;
+ if (scavisflag & BUTS_ACT_SEL) base->object->scavisflag |= OB_VIS_ACT;
}
}
base= base->next;
}
- if(obact) {
- if(scavisflag & BUTS_SENS_ACT) obact->scavisflag |= OB_VIS_SENS;
- if(scavisflag & BUTS_CONT_ACT) obact->scavisflag |= OB_VIS_CONT;
- if(scavisflag & BUTS_ACT_ACT) obact->scavisflag |= OB_VIS_ACT;
+ if (obact) {
+ if (scavisflag & BUTS_SENS_ACT) obact->scavisflag |= OB_VIS_SENS;
+ if (scavisflag & BUTS_CONT_ACT) obact->scavisflag |= OB_VIS_CONT;
+ if (scavisflag & BUTS_ACT_ACT) obact->scavisflag |= OB_VIS_ACT;
}
/* BUTS_XXX_STATE are similar to BUTS_XXX_LINK for selecting the object */
- if(scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK|BUTS_SENS_STATE|BUTS_ACT_STATE)) {
+ if (scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK|BUTS_SENS_STATE|BUTS_ACT_STATE)) {
doit= 1;
- while(doit) {
+ while (doit) {
doit= 0;
ob= bmain->object.first;
- while(ob) {
+ while (ob) {
/* 1st case: select sensor when controller selected */
- if((scavisflag & (BUTS_SENS_LINK|BUTS_SENS_STATE)) && (ob->scavisflag & OB_VIS_SENS)==0) {
+ if ((scavisflag & (BUTS_SENS_LINK|BUTS_SENS_STATE)) && (ob->scavisflag & OB_VIS_SENS)==0) {
sens= ob->sensors.first;
- while(sens) {
- for(a=0; a<sens->totlinks; a++) {
- if(sens->links[a]) {
+ while (sens) {
+ for (a=0; a<sens->totlinks; a++) {
+ if (sens->links[a]) {
obt= (Object *)sens->links[a]->mynew;
- if(obt && (obt->scavisflag & OB_VIS_CONT)) {
+ if (obt && (obt->scavisflag & OB_VIS_CONT)) {
doit= 1;
ob->scavisflag |= OB_VIS_SENS;
break;
}
}
}
- if(doit) break;
+ if (doit) break;
sens= sens->next;
}
}
/* 2nd case: select cont when act selected */
- if((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_CONT)==0) {
+ if ((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_CONT)==0) {
cont= ob->controllers.first;
- while(cont) {
- for(a=0; a<cont->totlinks; a++) {
- if(cont->links[a]) {
+ while (cont) {
+ for (a=0; a<cont->totlinks; a++) {
+ if (cont->links[a]) {
obt= (Object *)cont->links[a]->mynew;
- if(obt && (obt->scavisflag & OB_VIS_ACT)) {
+ if (obt && (obt->scavisflag & OB_VIS_ACT)) {
doit= 1;
ob->scavisflag |= OB_VIS_CONT;
break;
}
}
}
- if(doit) break;
+ if (doit) break;
cont= cont->next;
}
}
/* 3rd case: select controller when sensor selected */
- if((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_SENS)) {
+ if ((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_SENS)) {
sens= ob->sensors.first;
- while(sens) {
- for(a=0; a<sens->totlinks; a++) {
- if(sens->links[a]) {
+ while (sens) {
+ for (a=0; a<sens->totlinks; a++) {
+ if (sens->links[a]) {
obt= (Object *)sens->links[a]->mynew;
- if(obt && (obt->scavisflag & OB_VIS_CONT)==0) {
+ if (obt && (obt->scavisflag & OB_VIS_CONT)==0) {
doit= 1;
obt->scavisflag |= OB_VIS_CONT;
}
@@ -883,13 +883,13 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
}
/* 4th case: select actuator when controller selected */
- if( (scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE)) && (ob->scavisflag & OB_VIS_CONT)) {
+ if ( (scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE)) && (ob->scavisflag & OB_VIS_CONT)) {
cont= ob->controllers.first;
- while(cont) {
- for(a=0; a<cont->totlinks; a++) {
- if(cont->links[a]) {
+ while (cont) {
+ for (a=0; a<cont->totlinks; a++) {
+ if (cont->links[a]) {
obt= (Object *)cont->links[a]->mynew;
- if(obt && (obt->scavisflag & OB_VIS_ACT)==0) {
+ if (obt && (obt->scavisflag & OB_VIS_ACT)==0) {
doit= 1;
obt->scavisflag |= OB_VIS_ACT;
}
@@ -906,13 +906,13 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
/* now we count */
ob= bmain->object.first;
- while(ob) {
- if( ob->scavisflag ) (*count)++;
+ while (ob) {
+ if ( ob->scavisflag ) (*count)++;
ob= ob->id.next;
}
- if(*count==0) return NULL;
- if(*count>24) *count= 24; /* temporal */
+ if (*count==0) return NULL;
+ if (*count>24) *count= 24; /* temporal */
idar= MEM_callocN( (*count)*sizeof(void *), "idar");
@@ -925,12 +925,12 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
nr++;
}
- while(ob) {
- if( (ob->scavisflag) && (ob != obact)) {
+ while (ob) {
+ if ( (ob->scavisflag) && (ob != obact)) {
idar[nr]= (ID *)ob;
nr++;
}
- if(nr>=24) break;
+ if (nr>=24) break;
ob= ob->id.next;
}
@@ -975,8 +975,8 @@ static void verify_logicbutton_func(bContext *UNUSED(C), void *data1, void *data
{
bSensor *sens= (bSensor*)data1;
- if(sens->level && sens->tap) {
- if(data2 == &(sens->level))
+ if (sens->level && sens->tap) {
+ if (data2 == &(sens->level))
sens->tap= 0;
else
sens->level= 0;
@@ -991,7 +991,7 @@ static void test_scriptpoin_but(struct bContext *C, const char *name, ID **idpp)
static void test_actionpoin_but(struct bContext *C, const char *name, ID **idpp)
{
*idpp= BLI_findstring(&CTX_data_main(C)->action, name, offsetof(ID, name) + 2);
- if(*idpp)
+ if (*idpp)
id_us_plus(*idpp);
}
@@ -999,28 +999,28 @@ static void test_actionpoin_but(struct bContext *C, const char *name, ID **idpp)
static void test_obpoin_but(struct bContext *C, const char *name, ID **idpp)
{
*idpp= BLI_findstring(&CTX_data_main(C)->object, name, offsetof(ID, name) + 2);
- if(*idpp)
+ if (*idpp)
id_lib_extern(*idpp); /* checks lib data, sets correct flag for saving then */
}
static void test_meshpoin_but(struct bContext *C, const char *name, ID **idpp)
{
*idpp= BLI_findstring(&CTX_data_main(C)->mesh, name, offsetof(ID, name) + 2);
- if(*idpp)
+ if (*idpp)
id_us_plus(*idpp);
}
static void test_matpoin_but(struct bContext *C, const char *name, ID **idpp)
{
*idpp= BLI_findstring(&CTX_data_main(C)->mat, name, offsetof(ID, name) + 2);
- if(*idpp)
+ if (*idpp)
id_us_plus(*idpp);
}
static void test_scenepoin_but(struct bContext *C, const char *name, ID **idpp)
{
*idpp= BLI_findstring(&CTX_data_main(C)->scene, name, offsetof(ID, name) + 2);
- if(*idpp)
+ if (*idpp)
id_us_plus(*idpp);
}
@@ -1028,11 +1028,11 @@ static void test_keyboard_event(struct bContext *UNUSED(C), void *arg_ks, void *
{
bKeyboardSensor *ks= (bKeyboardSensor*)arg_ks;
- if(!ISKEYBOARD(ks->key))
+ if (!ISKEYBOARD(ks->key))
ks->key= 0;
- if(!ISKEYBOARD(ks->qual))
+ if (!ISKEYBOARD(ks->qual))
ks->qual= 0;
- if(!ISKEYBOARD(ks->qual2))
+ if (!ISKEYBOARD(ks->qual2))
ks->qual2= 0;
}
@@ -1067,12 +1067,12 @@ static void draw_default_sensor_header(bSensor *sens,
/* value or shift? */
uiBlockBeginAlign(block);
- but= uiDefButS(block, TOG, 1, "Level",
+ but = uiDefButS(block, TOG, 1, "Level",
(short)(x + 10 + 0.5 * (w-20)), (short)(y - 21), (short)(0.20 * (w-20)), 19,
&sens->level, 0.0, 0.0, 0, 0,
"Level detector, trigger controllers of new states (only applicable upon logic state transition)");
uiButSetFunc(but, verify_logicbutton_func, sens, &(sens->level));
- but= uiDefButS(block, TOG, 1, "Tap",
+ but = uiDefButS(block, TOG, 1, "Tap",
(short)(x + 10 + 0.702 * (w-20)), (short)(y - 21), (short)(0.12 * (w-20)), 19,
&sens->tap, 0.0, 0.0, 0, 0,
"Trigger controllers only for an instant, even while the sensor remains true");
@@ -1090,9 +1090,9 @@ static void get_armature_bone_constraint(Object *ob, const char *posechannel, co
/* check that bone exist in the active object */
if (ob->type == OB_ARMATURE && ob->pose) {
bPoseChannel *pchan= get_pose_channel(ob->pose, posechannel);
- if(pchan) {
+ if (pchan) {
bConstraint *con= BLI_findstring(&pchan->constraints, constraint_name, offsetof(bConstraint, name));
- if(con) {
+ if (con) {
*constraint= con;
}
}
@@ -1218,7 +1218,8 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
uiDefBut(block, TEX, 1, "Material:", (short)(xco + 10 + 0.40 * (width-20)),
(short)(yco-44), (short)(0.6*(width-20)), 19, &cs->materialName, 0, MAX_NAME, 0, 0,
"Only look for Objects with this material");
- } else {
+ }
+ else {
uiDefBut(block, TEX, 1, "Property:", (short)(xco + 10 + 0.40 * (width-20)), (short)(yco-44),
(short)(0.6*(width-20)), 19, &cs->name, 0, MAX_NAME, 0, 0,
"Only look for Objects with this property");
@@ -1302,14 +1303,14 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
if ((ks->type&1)==0) { /* is All Keys option off? */
/* line 2: hotkey and allkeys toggle */
- but= uiDefKeyevtButS(block, 0, "", xco+40, yco-44, (width)/2, 19, &ks->key, "Key code");
+ but = uiDefKeyevtButS(block, 0, "", xco+40, yco-44, (width)/2, 19, &ks->key, "Key code");
uiButSetFunc(but, test_keyboard_event, ks, NULL);
/* line 3: two key modifyers (qual1, qual2) */
uiDefBut(block, LABEL, 0, "Hold", xco, yco-68, 40, 19, NULL, 0, 0, 0, 0, "");
- but= uiDefKeyevtButS(block, 0, "", xco+40, yco-68, (width-50)/2, 19, &ks->qual, "Modifier key code");
+ but = uiDefKeyevtButS(block, 0, "", xco+40, yco-68, (width-50)/2, 19, &ks->qual, "Modifier key code");
uiButSetFunc(but, test_keyboard_event, ks, NULL);
- but= uiDefKeyevtButS(block, 0, "", xco+40+(width-50)/2, yco-68, (width-50)/2, 19, &ks->qual2, "Second Modifier key code");
+ but = uiDefKeyevtButS(block, 0, "", xco+40+(width-50)/2, yco-68, (width-50)/2, 19, &ks->qual2, "Second Modifier key code");
uiButSetFunc(but, test_keyboard_event, ks, NULL);
}
@@ -1352,14 +1353,14 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
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,
ps->maxvalue, 0, MAX_NAME, 0, 0, "check for max value");
}
- else if(ps->type == SENS_PROP_CHANGED) {
+ else if (ps->type == SENS_PROP_CHANGED) {
/* pass */
}
else {
@@ -1469,7 +1470,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
&ms->type, 0, 31, 0, 0,
"Specify the type of event this mouse sensor should trigger on");
- if(ms->type==32) {
+ if (ms->type==32) {
uiDefButBitS(block, TOG, SENS_MOUSE_FOCUS_PULSE, B_REDR, "Pulse",(short)(xco + 10) + (width*0.8f)-20,(short)(yco - 44),
(short)(0.20 * (width-20)), 19, &ms->flag, 0.0, 0.0, 0, 0,
"Moving the mouse over a different object generates a pulse");
@@ -1599,7 +1600,8 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
str = "All Hat Events";
break;
}
- } else {
+ }
+ else {
str = "All";
}
@@ -1608,7 +1610,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
&joy->flag, 0, 0, 0, 0,
"Triggered by all events on this joysticks current type (axis/button/hat)");
}
- if(joy->type == SENS_JOY_BUTTON)
+ if (joy->type == SENS_JOY_BUTTON)
{
if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
uiDefButI(block, NUM, 1, "Number:", xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
@@ -1616,7 +1618,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
"Specify which button to use");
}
}
- else if(joy->type == SENS_JOY_AXIS) {
+ else if (joy->type == SENS_JOY_AXIS) {
uiDefButS(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
&joy->axis, 1, 8.0, 100, 0,
"Specify which axis pair to use, 1 is useually the main direction input");
@@ -1689,7 +1691,7 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
case CONT_PYTHON:
ysize= 28;
- if(cont->data==NULL) init_controller(cont);
+ if (cont->data==NULL) init_controller(cont);
pc= cont->data;
UI_ThemeColor(TH_PANEL);
@@ -1699,7 +1701,7 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
uiBlockBeginAlign(block);
uiDefButI(block, MENU, B_REDR, "Execution Method%t|Script%x0|Module%x1", xco+4,yco-23, 66, 19, &pc->mode, 0, 0, 0, 0, "Python script type (textblock or module - faster)");
- if(pc->mode==0)
+ if (pc->mode==0)
uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, "", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a script");
else {
uiDefBut(block, TEX, 1, "", xco+70,yco-23,(width-70)-25, 19, pc->module, 0, sizeof(pc->module), 0, 0, "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
@@ -1945,7 +1947,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;
@@ -2026,7 +2029,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
&aa->end_reset, 0.0, 0.0, 0, 0, "Restore last frame when switching on/off, otherwise play from the start each time");
- if(aa->type == ACT_ACTION_FROM_PROP) {
+ if (aa->type == ACT_ACTION_FROM_PROP) {
uiDefBut(block, TEX, 0, "Prop: ",xco+10, yco-44, width-20, 19, aa->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Action position");
}
else {
@@ -2084,7 +2087,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
"Let the ipo acts in local coordinates, used in Force and Add mode");
}
- if(ia->type==ACT_IPO_FROM_PROP) {
+ if (ia->type==ACT_IPO_FROM_PROP) {
uiDefBut(block, TEX, 0,
"Prop: ", xco+10, yco-44, width-80, 19,
ia->name, 0.0, MAX_NAME, 0, 0,
@@ -2127,11 +2130,11 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-44,width-60, 19, pa->name, 0, MAX_NAME, 0, 0, "Property name");
- if(pa->type==ACT_PROP_TOGGLE) {
+ if (pa->type==ACT_PROP_TOGGLE) {
/* no ui */
ysize -= 22;
}
- else if(pa->type==ACT_PROP_COPY) {
+ else if (pa->type==ACT_PROP_COPY) {
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-64, (width-20)/2, 19, &(pa->ob), "Copy from this Object");
uiDefBut(block, TEX, 1, "Prop: ", xco+10+(width-20)/2, yco-64, (width-20)/2, 19, pa->value, 0, MAX_NAME, 0, 0, "Copy this property");
}
@@ -2147,7 +2150,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
sa = act->data;
sa->sndnr = 0;
- if(sa->flag & ACT_SND_3D_SOUND)
+ if (sa->flag & ACT_SND_3D_SOUND)
ysize = 180;
else
ysize = 92;
@@ -2156,7 +2159,7 @@ 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);
- if(bmain->sound.first) {
+ if (bmain->sound.first) {
IDnames_to_pupstring(&str, "Sound files", NULL, &(bmain->sound), (ID *)sa->sound, &(sa->sndnr));
/* reset this value, it is for handling the event */
sa->sndnr = 0;
@@ -2164,7 +2167,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButO(block, BUT, "sound.open", 0, "Load Sound", xco+wval+10, yco-22, wval, 19,
"Load a sound file (remember to set caching on for small sounds that are played often)");
- if(sa->sound) {
+ if (sa->sound) {
char dummy_str[] = "Sound mode %t|Play Stop %x0|Play End %x1|Loop Stop %x2|"
"Loop End %x3|Loop Ping Pong Stop %x5|Loop Ping Pong %x4";
uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,wval-20,19,
@@ -2177,7 +2180,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
12.0, 0, 0, "Sets the pitch of this sound");
uiDefButS(block, TOG | BIT, 0, "3D Sound", xco+10, yco-88, width-20, 19,
&sa->flag, 0.0, 1.0, 0.0, 0.0, "Plays the sound positioned in 3D space");
- if(sa->flag & ACT_SND_3D_SOUND) {
+ if (sa->flag & ACT_SND_3D_SOUND) {
uiDefButF(block, NUM, 0, "Minimum Gain: ", xco+10, yco-110, wval, 19,
&sa->sound3D.min_gain, 0.0, 1.0, 0.0, 0.0,
"The minimum gain of the sound, no matter how far it is away");
@@ -2229,7 +2232,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButF(block, NUM, 0, "Min:", xco+10, yco-44, (width-60)/2, 19, &ca->min, 0.0, 20.0, 0, 0, "");
- if(ca->axis==0) ca->axis= 'x';
+ if (ca->axis==0) ca->axis= 'x';
uiDefButS(block, ROW, 0, "X", xco+10+(width-60)/2, yco-44, 20, 19, &ca->axis, 4.0, (float)'x', 0, 0, "Camera tries to get behind the X axis");
uiDefButS(block, ROW, 0, "Y", xco+30+(width-60)/2, yco-44, 20, 19, &ca->axis, 4.0, (float)'y', 0, 0, "Camera tries to get behind the Y axis");
@@ -2243,7 +2246,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
eoa= act->data;
- if(eoa->type==ACT_EDOB_ADD_OBJECT) {
+ if (eoa->type==ACT_EDOB_ADD_OBJECT) {
ysize = 92;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
@@ -2287,12 +2290,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
}
- else if(eoa->type==ACT_EDOB_END_OBJECT) {
+ else if (eoa->type==ACT_EDOB_END_OBJECT) {
ysize= 28;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
}
- else if(eoa->type==ACT_EDOB_REPLACE_MESH) {
+ else if (eoa->type==ACT_EDOB_REPLACE_MESH) {
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
@@ -2302,7 +2305,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButBitS(block, TOGN, ACT_EDOB_REPLACE_MESH_NOGFX, 0, "Gfx", xco+40 + (width-80)/2, yco-44, (width-80)/4, 19, &eoa->flag, 0, 0, 0, 0, "Replace the display mesh");
uiDefButBitS(block, TOG, ACT_EDOB_REPLACE_MESH_PHYS, 0, "Phys", xco+40 + (width-80)/2 +(width-80)/4, yco-44, (width-80)/4, 19, &eoa->flag, 0, 0, 0, 0, "Replace the physics mesh (triangle bounds only. compound shapes not supported)");
}
- else if(eoa->type==ACT_EDOB_TRACK_TO) {
+ else if (eoa->type==ACT_EDOB_TRACK_TO) {
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
@@ -2311,14 +2314,14 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButI(block, NUM, 0, "Time:", xco+10+(width-20)/2, yco-44, (width-20)/2-40, 19, &eoa->time, 0.0, 2000.0, 0, 0, "Duration the tracking takes");
uiDefButS(block, TOG, 0, "3D", xco+width-50, yco-44, 40, 19, &eoa->flag, 0.0, 0.0, 0, 0, "Enable 3D tracking");
}
- else if(eoa->type==ACT_EDOB_DYNAMICS) {
+ else if (eoa->type==ACT_EDOB_DYNAMICS) {
ysize= 69;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
str= "Dynamic Operation %t|Restore Dynamics %x0|Suspend Dynamics %x1|Enable Rigid Body %x2|Disable Rigid Body %x3|Set Mass %x4";
uiDefButS(block, MENU, B_REDR, str, xco+40, yco-44, (width-80), 19, &(eoa->dyn_operation), 0.0, 0.0, 0, 0, "");
- if(eoa->dyn_operation==4) {
+ if (eoa->dyn_operation==4) {
uiDefButF(block, NUM, 0, "", xco+40, yco-63, width-80, 19,
&eoa->mass, 0.0, 10000.0, 10, 0,
"Mass for object");
@@ -2351,16 +2354,17 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefBut(block, LABEL, 0, "Min", xco+80, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
uiDefBut(block, LABEL, 0, "Max", xco+80+(width-90)/2, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
- if(coa->flag & ACT_CONST_LOCX) fp= coa->minloc;
- else if(coa->flag & ACT_CONST_LOCY) fp= coa->minloc+1;
- else if(coa->flag & ACT_CONST_LOCZ) fp= coa->minloc+2;
- else if(coa->flag & ACT_CONST_ROTX) fp= coa->minrot;
- else if(coa->flag & ACT_CONST_ROTY) fp= coa->minrot+1;
+ if (coa->flag & ACT_CONST_LOCX) fp= coa->minloc;
+ else if (coa->flag & ACT_CONST_LOCY) fp= coa->minloc+1;
+ else if (coa->flag & ACT_CONST_LOCZ) fp= coa->minloc+2;
+ else if (coa->flag & ACT_CONST_ROTX) fp= coa->minrot;
+ else if (coa->flag & ACT_CONST_ROTY) fp= coa->minrot+1;
else fp= coa->minrot+2;
uiDefButF(block, NUM, 0, "", xco+80, yco-65, (width-90)/2, 19, fp, -2000.0, 2000.0, 10, 0, "");
uiDefButF(block, NUM, 0, "", xco+80+(width-90)/2, yco-65, (width-90)/2, 19, fp+3, -2000.0, 2000.0, 10, 0, "");
- } else if (coa->type == ACT_CONST_TYPE_DIST) {
+ }
+ else if (coa->type == ACT_CONST_TYPE_DIST) {
ysize= 106;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2375,8 +2379,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButBitS(block, TOG, ACT_CONST_LOCAL, 0, "L", xco+80+(width-115), yco-45, 25, 19,
&coa->flag, 0.0, 0.0, 0, 0, "Set ray along object's axis or global axis");
- if(coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
- else if(coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
+ if (coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
+ else if (coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
else fp= coa->minloc+2;
uiDefButF(block, NUM, 0, "", xco+80, yco-65, (width-115)/2, 19, fp+3, 0.0, 2000.0, 10, 0, "Maximum length of ray");
@@ -2400,7 +2404,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
&coa->flag, 0.0, 0.0, 0, 0, "Persistent actuator: stays active even if ray does not reach target");
uiDefButS(block, NUM, 0, "time", xco+50, yco-103, (width-60)/2, 19, &(coa->time), 0.0, 1000.0, 0, 0, "Maximum activation time in frame, 0 for unlimited");
uiDefButS(block, NUM, 0, "rotDamp", xco+50+(width-60)/2, yco-103, (width-60)/2, 19, &(coa->rotdamp), 0.0, 100.0, 0, 0, "Use a different damping for orientation");
- } else if (coa->type == ACT_CONST_TYPE_ORI) {
+ }
+ else if (coa->type == ACT_CONST_TYPE_ORI) {
ysize= 87;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2421,7 +2426,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButS(block, NUM, 0, "time", xco+10, yco-84, 70, 19, &(coa->time), 0.0, 1000.0, 0, 0, "Maximum activation time in frame, 0 for unlimited");
uiDefButF(block, NUM, 0, "min", xco+80, yco-84, (width-115)/2, 19, &(coa->minloc[0]), 0.0, 180.0, 10, 1, "Minimum angle (in degree) to maintain with target direction. No correction is done if angle with target direction is between min and max");
uiDefButF(block, NUM, 0, "max", xco+80+(width-115)/2, yco-84, (width-115)/2, 19, &(coa->maxloc[0]), 0.0, 180.0, 10, 1, "Maximum angle (in degree) allowed with target direction. No correction is done if angle with target direction is between min and max");
- } else if (coa->type == ACT_CONST_TYPE_FH) {
+ }
+ else if (coa->type == ACT_CONST_TYPE_FH) {
ysize= 106;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2430,8 +2436,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4|-X axis %x8|-Y axis %x16|-Z axis %x32";
uiDefButS(block, MENU, B_REDR, str, xco+10, yco-65, 70, 19, &coa->mode, 0.0, 0.0, 0, 0, "Set the direction of the ray (in world coordinate)");
- if(coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
- else if(coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
+ if (coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
+ else if (coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
else fp= coa->minloc+2;
uiDefButF(block, NUM, 0, "damp", xco+10, yco-45, (width-70)/2, 19, &coa->maxrot[0], 0.0, 1.0, 1, 0, "Damping factor of the Fh spring force");
@@ -2466,12 +2472,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
case ACT_SCENE:
sca= act->data;
- if(sca->type==ACT_SCENE_RESTART) {
+ if (sca->type==ACT_SCENE_RESTART) {
ysize= 28;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
}
- else if(sca->type==ACT_SCENE_CAMERA) {
+ else if (sca->type==ACT_SCENE_CAMERA) {
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2479,7 +2485,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+40, yco-44, (width-80), 19, &(sca->camera), "Set this Camera. Leave empty to refer to self object");
}
- else if(sca->type==ACT_SCENE_SET) {
+ else if (sca->type==ACT_SCENE_SET) {
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2487,7 +2493,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Set this Scene");
}
- else if(sca->type==ACT_SCENE_ADD_FRONT) {
+ else if (sca->type==ACT_SCENE_ADD_FRONT) {
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2495,7 +2501,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Add an Overlay Scene");
}
- else if(sca->type==ACT_SCENE_ADD_BACK) {
+ else if (sca->type==ACT_SCENE_ADD_BACK) {
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2503,7 +2509,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Add a Background Scene");
}
- else if(sca->type==ACT_SCENE_REMOVE) {
+ else if (sca->type==ACT_SCENE_REMOVE) {
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2511,7 +2517,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Remove a Scene");
}
- else if(sca->type==ACT_SCENE_SUSPEND) {
+ else if (sca->type==ACT_SCENE_SUSPEND) {
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2519,7 +2525,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Pause a Scene");
}
- else if(sca->type==ACT_SCENE_RESUME) {
+ else if (sca->type==ACT_SCENE_RESUME) {
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2578,11 +2584,11 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
str= "GroupKey types %t|Set Key %x6|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x5";
uiDefButS(block, MENU, 1, str, xco+20, yco-24, width-40, 19, &ga->type, 0, 0, 0, 0, "");
- if(ga->type==ACT_GROUP_SET) {
+ if (ga->type==ACT_GROUP_SET) {
uiDefBut(block, TEX, 0, "Key: ", xco+20, yco-44, (width-10)/2, 19, ga->name, 0.0, MAX_NAME, 0, 0, "This name defines groupkey to be set");
uiDefButI(block, NUM, 0, "Frame:", xco+20+(width-10)/2, yco-44, (width-70)/2, 19, &ga->sta, 0.0, 2500.0, 0, 0, "Set this frame");
}
- else if(ga->type==ACT_GROUP_FROM_PROP) {
+ else if (ga->type==ACT_GROUP_FROM_PROP) {
uiDefBut(block, TEX, 0, "Prop: ", xco+20, yco-44, width-40, 19, ga->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Group position");
}
else {
@@ -2860,7 +2866,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
case ACT_PARENT:
parAct = act->data;
- if(parAct->type==ACT_PARENT_SET) {
+ if (parAct->type==ACT_PARENT_SET) {
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2879,7 +2885,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
"Make this object ghost while parented (only if not compound)");
uiBlockEndAlign(block);
}
- else if(parAct->type==ACT_PARENT_REMOVE) {
+ else if (parAct->type==ACT_PARENT_REMOVE) {
ysize= 28;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2958,23 +2964,23 @@ static void do_sensor_menu(bContext *C, void *UNUSED(arg), int event)
idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
ob= (Object *)idar[a];
- if(event==0 || event==2) ob->scaflag |= OB_SHOWSENS;
- else if(event==1) ob->scaflag &= ~OB_SHOWSENS;
+ if (event==0 || event==2) ob->scaflag |= OB_SHOWSENS;
+ else if (event==1) ob->scaflag &= ~OB_SHOWSENS;
}
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
ob= (Object *)idar[a];
sens= ob->sensors.first;
- while(sens) {
- if(event==2) sens->flag |= SENS_SHOW;
- else if(event==3) sens->flag &= ~SENS_SHOW;
+ while (sens) {
+ if (event==2) sens->flag |= SENS_SHOW;
+ else if (event==3) sens->flag &= ~SENS_SHOW;
sens= sens->next;
}
}
- if(idar) MEM_freeN(idar);
+ if (idar) MEM_freeN(idar);
}
static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
@@ -3007,23 +3013,23 @@ static void do_controller_menu(bContext *C, void *UNUSED(arg), int event)
idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
ob= (Object *)idar[a];
- if(event==0 || event==2) ob->scaflag |= OB_SHOWCONT;
- else if(event==1) ob->scaflag &= ~OB_SHOWCONT;
+ if (event==0 || event==2) ob->scaflag |= OB_SHOWCONT;
+ else if (event==1) ob->scaflag &= ~OB_SHOWCONT;
}
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
ob= (Object *)idar[a];
cont= ob->controllers.first;
- while(cont) {
- if(event==2) cont->flag |= CONT_SHOW;
- else if(event==3) cont->flag &= ~CONT_SHOW;
+ while (cont) {
+ if (event==2) cont->flag |= CONT_SHOW;
+ else if (event==3) cont->flag &= ~CONT_SHOW;
cont= cont->next;
}
}
- if(idar) MEM_freeN(idar);
+ if (idar) MEM_freeN(idar);
}
static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
@@ -3056,23 +3062,23 @@ static void do_actuator_menu(bContext *C, void *UNUSED(arg), int event)
idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
ob= (Object *)idar[a];
- if(event==0 || event==2) ob->scaflag |= OB_SHOWACT;
- else if(event==1) ob->scaflag &= ~OB_SHOWACT;
+ if (event==0 || event==2) ob->scaflag |= OB_SHOWACT;
+ else if (event==1) ob->scaflag &= ~OB_SHOWACT;
}
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
ob= (Object *)idar[a];
act= ob->actuators.first;
- while(act) {
- if(event==2) act->flag |= ACT_SHOW;
- else if(event==3) act->flag &= ~ACT_SHOW;
+ while (act) {
+ if (event==2) act->flag |= ACT_SHOW;
+ else if (event==3) act->flag &= ~ACT_SHOW;
act= act->next;
}
}
- if(idar) MEM_freeN(idar);
+ if (idar) MEM_freeN(idar);
}
static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
@@ -3212,10 +3218,11 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo
row= uiLayoutRow(box, 0);
uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
- if(RNA_boolean_get(ptr, "show_expanded")) {
+ if (RNA_boolean_get(ptr, "show_expanded")) {
uiItemR(row, ptr, "type", 0, "", ICON_NONE);
uiItemR(row, ptr, "name", 0, "", ICON_NONE);
- } else {
+ }
+ else {
uiItemL(row, sensor_name(sens->type), ICON_NONE);
uiItemL(row, sens->name, ICON_NONE);
}
@@ -3225,7 +3232,7 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo
&& RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
- if(RNA_boolean_get(ptr, "show_expanded")==0) {
+ if (RNA_boolean_get(ptr, "show_expanded")==0) {
sub= uiLayoutRow(row, 1);
uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up
uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down
@@ -3276,7 +3283,7 @@ static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr)
PropertyRNA *bones_prop= NULL;
uiLayout *row;
- if(ob->type != OB_ARMATURE){
+ if (ob->type != OB_ARMATURE) {
uiItemL(layout, "Sensor only available for armatures", ICON_NONE);
return;
}
@@ -3569,12 +3576,13 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i
row= uiLayoutRow(box, 0);
uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
- if(RNA_boolean_get(ptr, "show_expanded")) {
+ if (RNA_boolean_get(ptr, "show_expanded")) {
uiItemR(row, ptr, "type", 0, "", ICON_NONE);
uiItemR(row, ptr, "name", 0, "", ICON_NONE);
/* XXX provisory for Blender 2.50Beta */
uiDefBlockBut(uiLayoutGetBlock(layout), controller_state_mask_menu, cont, state, (short)(xco+width-44), yco, 22+22, UI_UNIT_Y, "Set controller state index (from 1 to 30)");
- } else {
+ }
+ else {
uiItemL(row, controller_name(cont->type), ICON_NONE);
uiItemL(row, cont->name, ICON_NONE);
uiItemL(row, state, ICON_NONE);
@@ -3582,7 +3590,7 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i
uiItemR(row, ptr, "use_priority", 0, "", ICON_NONE);
- if(RNA_boolean_get(ptr, "show_expanded")==0) {
+ if (RNA_boolean_get(ptr, "show_expanded")==0) {
sub= uiLayoutRow(row, 1);
uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up
uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down
@@ -3659,10 +3667,11 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *
row= uiLayoutRow(box, 0);
uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
- if(RNA_boolean_get(ptr, "show_expanded")) {
+ if (RNA_boolean_get(ptr, "show_expanded")) {
uiItemR(row, ptr, "type", 0, "", ICON_NONE);
uiItemR(row, ptr, "name", 0, "", ICON_NONE);
- } else {
+ }
+ else {
uiItemL(row, actuator_name(act->type), ICON_NONE);
uiItemL(row, act->name, ICON_NONE);
}
@@ -3672,7 +3681,7 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *
&& RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
- if(RNA_boolean_get(ptr, "show_expanded")==0) {
+ if (RNA_boolean_get(ptr, "show_expanded")==0) {
sub= uiLayoutRow(row, 1);
uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up
uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down
@@ -3704,7 +3713,7 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE);
row= uiLayoutRow(layout, 0);
- if((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP))
+ if ((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP))
uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
else {
@@ -3738,7 +3747,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
PointerRNA pose_ptr, pchan_ptr;
PropertyRNA *bones_prop = NULL;
- if(ob->type != OB_ARMATURE){
+ if (ob->type != OB_ARMATURE) {
uiItemL(layout, "Actuator only available for armatures", ICON_NONE);
return;
}
@@ -3945,7 +3954,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
case ACT_EDOB_END_OBJECT:
break;
case ACT_EDOB_REPLACE_MESH:
- if(ob->type != OB_MESH) {
+ if (ob->type != OB_MESH) {
uiItemL(layout, "Mode only available for mesh objects", ICON_NONE);
break;
}
@@ -3963,7 +3972,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
uiItemR(sub, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
break;
case ACT_EDOB_DYNAMICS:
- if(ob->type != OB_MESH) {
+ if (ob->type != OB_MESH) {
uiItemL(layout, "Mode only available for mesh objects", ICON_NONE);
break;
}
@@ -4022,7 +4031,7 @@ static void draw_actuator_message(uiLayout *layout, PointerRNA *ptr, bContext *C
row= uiLayoutRow(layout, 1);
uiItemR(row, ptr, "body_type", 0, NULL, ICON_NONE);
- if(RNA_enum_get(ptr, "body_type") == ACT_MESG_MESG)
+ if (RNA_enum_get(ptr, "body_type") == ACT_MESG_MESG)
uiItemR(row, ptr, "body_message", 0, "", ICON_NONE);
else // mode == ACT_MESG_PROP
uiItemPointerR(row, ptr, "body_property", &settings_ptr, "properties", "", ICON_NONE);
@@ -4199,7 +4208,7 @@ static void draw_actuator_random(uiLayout *layout, PointerRNA *ptr)
row = uiLayoutRow(layout, 0);
- switch (RNA_enum_get(ptr, "distribution")){
+ switch (RNA_enum_get(ptr, "distribution")) {
case ACT_RANDOM_BOOL_CONST:
uiItemR(row, ptr, "use_always_true", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
break;
@@ -4267,7 +4276,7 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr)
PointerRNA settings_ptr;
uiLayout *row;
- if(ob->type != OB_MESH){
+ if (ob->type != OB_MESH) {
uiItemL(layout, "Actuator only available for mesh objects", ICON_NONE);
return;
}
@@ -4280,7 +4289,7 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE);
row= uiLayoutRow(layout, 0);
- if((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP))
+ if ((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP))
uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
else {
@@ -4481,7 +4490,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
short a, count;
int xco, yco, width;
- if(ob==NULL) return;
+ if (ob==NULL) return;
RNA_pointer_create(NULL, &RNA_SpaceLogicEditor, slogic, &logic_ptr);
idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
@@ -4491,7 +4500,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
uiBlockSetHandleFunc(block, do_logic_buts, NULL);
/* loop over all objects and set visible/linked flags for the logic bricks */
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
bActuator *act;
bSensor *sens;
bController *cont;
@@ -4502,20 +4511,20 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
/* clean ACT_LINKED and ACT_VISIBLE of all potentially visible actuators so that we can determine which is actually linked/visible */
act = ob->actuators.first;
- while(act) {
+ while (act) {
act->flag &= ~(ACT_LINKED|ACT_VISIBLE);
act = act->next;
}
/* same for sensors */
sens= ob->sensors.first;
- while(sens) {
+ while (sens) {
sens->flag &= ~(SENS_VISIBLE);
sens = sens->next;
}
/* mark the linked and visible actuators */
cont= ob->controllers.first;
- while(cont) {
+ while (cont) {
flag = ACT_LINKED;
/* this controller is visible, mark all its actuator */
@@ -4543,7 +4552,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, "Act", ICON_NONE);
uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, "Link", ICON_NONE);
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
bController *cont;
PointerRNA ptr;
uiLayout *split, *subsplit, *col;
@@ -4552,7 +4561,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
ob= (Object *)idar[a];
/* only draw the controller common header if "use_visible" */
- if( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
+ if ( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
/* Drawing the Controller Header common to all Selected Objects */
@@ -4595,7 +4604,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
uiItemS(layout);
- for(cont= ob->controllers.first; cont; cont=cont->next) {
+ for (cont= ob->controllers.first; cont; cont=cont->next) {
RNA_pointer_create((ID *)ob, &RNA_Controller, cont, &ptr);
if (!(ob->scaflag & OB_ALLSTATE) && !(ob->state & cont->state_mask))
@@ -4627,7 +4636,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
/* put link button to the right */
col = uiLayoutColumn(subsplit, 0);
uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT);
- but= uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
}
}
@@ -4647,14 +4656,14 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, "Link", ICON_NONE);
uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, "State", ICON_NONE);
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
bSensor *sens;
PointerRNA ptr;
ob= (Object *)idar[a];
/* only draw the sensor common header if "use_visible" */
- if((ob->scavisflag & OB_VIS_SENS) == 0) continue;
+ if ((ob->scavisflag & OB_VIS_SENS) == 0) continue;
row = uiLayoutRow(layout, 1);
uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
@@ -4665,7 +4674,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
uiItemS(layout);
- for(sens= ob->sensors.first; sens; sens=sens->next) {
+ for (sens= ob->sensors.first; sens; sens=sens->next) {
RNA_pointer_create((ID *)ob, &RNA_Sensor, sens, &ptr);
if ((ob->scaflag & OB_ALLSTATE) ||
@@ -4693,7 +4702,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
/* put link button to the right */
col = uiLayoutColumn(split, 0);
/* use old-school uiButtons for links for now */
- but= uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiSetButLink(but, NULL, (void ***)&(sens->links), &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER);
}
}
@@ -4713,14 +4722,14 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, "Link", ICON_NONE);
uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, "State", ICON_NONE);
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
bActuator *act;
PointerRNA ptr;
ob= (Object *)idar[a];
/* only draw the actuator common header if "use_visible" */
- if( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
+ if ( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
row = uiLayoutRow(layout, 1);
uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
@@ -4731,7 +4740,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
uiItemS(layout);
- for(act= ob->actuators.first; act; act=act->next) {
+ for (act= ob->actuators.first; act; act=act->next) {
RNA_pointer_create((ID *)ob, &RNA_Actuator, act, &ptr);
@@ -4773,7 +4782,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
uiEndBlock(C, block);
uiDrawBlock(C, block);
- if(idar) MEM_freeN(idar);
+ if (idar) MEM_freeN(idar);
}
void logic_buttons(bContext *C, ARegion *ar)
@@ -4801,7 +4810,7 @@ void logic_buttons(bContext *C, ARegion *ar)
return;
}
- if(ob==NULL) return;
+ if (ob==NULL) return;
// uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
BLI_snprintf(numstr, sizeof(numstr), "buttonswin %p", (void *)ar);
@@ -4814,16 +4823,16 @@ void logic_buttons(bContext *C, ARegion *ar)
/* clean ACT_LINKED and ACT_VISIBLE of all potentially visible actuators so that
* we can determine which is actually linked/visible */
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
ob= (Object *)idar[a];
act= ob->actuators.first;
- while(act) {
+ while (act) {
act->flag &= ~(ACT_LINKED|ACT_VISIBLE);
act = act->next;
}
/* same for sensors */
sens= ob->sensors.first;
- while(sens) {
+ while (sens) {
sens->flag &= ~(SENS_VISIBLE);
sens = sens->next;
}
@@ -4841,19 +4850,19 @@ void logic_buttons(bContext *C, ARegion *ar)
uiDefButBitS(block, TOG, BUTS_CONT_LINK, B_REDR, "Link", xco+110+2*(width-100)/3, yco+35, (width-100)/3, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Sensor/Actuator");
uiBlockEndAlign(block);
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
unsigned int controller_state_mask = 0; /* store a bitmask for states that are used */
ob= (Object *)idar[a];
// uiClearButLock();
// uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- if( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
+ if ( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
/* presume it is only objects for now */
uiBlockBeginAlign(block);
-// if(ob->controllers.first) uiSetCurFont(block, UI_HELVB);
+// if (ob->controllers.first) uiSetCurFont(block, UI_HELVB);
uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Active Object name");
-// if(ob->controllers.first) uiSetCurFont(block, UI_HELV);
+// if (ob->controllers.first) uiSetCurFont(block, UI_HELV);
uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller");
uiBlockEndAlign(block);
yco-=20;
@@ -4862,7 +4871,7 @@ void logic_buttons(bContext *C, ARegion *ar)
/* note that some of these actuators could be from objects that are not in the display list.
* It's ok because those actuators will not be displayed here */
cont= ob->controllers.first;
- while(cont) {
+ while (cont) {
for (iact=0; iact<cont->totlinks; iact++) {
act = cont->links[iact];
if (act)
@@ -4872,7 +4881,7 @@ void logic_buttons(bContext *C, ARegion *ar)
cont = cont->next;
}
- if(ob->scaflag & OB_SHOWCONT) {
+ if (ob->scaflag & OB_SHOWCONT) {
/* first show the state */
uiDefBlockBut(block, object_state_mask_menu, ob, "State", (short)(xco-10), (short)(yco-10), 36, UI_UNIT_Y, "Object state menu: store and retrieve initial state");
@@ -4909,7 +4918,7 @@ void logic_buttons(bContext *C, ARegion *ar)
yco -= 6;
}
cont= ob->controllers.first;
- while(cont) {
+ while (cont) {
if (cont->state_mask & (1<<stbit)) {
/* this controller is visible, mark all its actuator */
for (iact=0; iact<cont->totlinks; iact++) {
@@ -4924,35 +4933,35 @@ void logic_buttons(bContext *C, ARegion *ar)
sprintf(numstr, "%d", first_bit(cont->state_mask)+1);
uiDefBlockBut(block, controller_state_mask_menu, cont, numstr, (short)(xco+width-44), yco, 22, UI_UNIT_Y, "Set controller state index (from 1 to 30)");
- if(cont->flag & CONT_SHOW) {
+ if (cont->flag & CONT_SHOW) {
cont->otype= cont->type;
uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 70, UI_UNIT_Y, &cont->type, 0, 0, 0, 0, "Controller type");
- but= uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont->name, 0, MAX_NAME, 0, 0, "Controller name");
+ but = uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont->name, 0, MAX_NAME, 0, 0, "Controller name");
uiButSetFunc(but, make_unique_prop_names_cb, cont->name, (void*) 0);
ycoo= yco;
yco= draw_controllerbuttons(cont, block, xco, yco, width);
- if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
+ if (yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
}
else {
cpack(0x999999);
glRecti(xco+22, yco, xco+width-22,yco+19);
- but= uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller type");
+ but = uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller type");
//uiButSetFunc(but, old_sca_move_controller, cont, NULL);
- but= uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name");
+ but = uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name");
//uiButSetFunc(but, old_sca_move_controller, cont, NULL);
uiBlockBeginAlign(block);
- but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(110+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
+ but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(110+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
uiButSetFunc(but, old_sca_move_controller, cont, (void *)TRUE);
- but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(88+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
+ but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(88+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
uiButSetFunc(but, old_sca_move_controller, cont, (void *)FALSE);
uiBlockEndAlign(block);
ycoo= yco;
}
- but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ but = uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, "");
@@ -4980,26 +4989,26 @@ void logic_buttons(bContext *C, ARegion *ar)
uiDefButBitS(block, TOG, BUTS_SENS_STATE, B_REDR, "State", xco+80+3*(width-70)/4, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show only sensors connected to active states");
uiBlockEndAlign(block);
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
ob= (Object *)idar[a];
// uiClearButLock();
// uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- if( (ob->scavisflag & OB_VIS_SENS) == 0) continue;
+ if ( (ob->scavisflag & OB_VIS_SENS) == 0) continue;
/* presume it is only objects for now */
uiBlockBeginAlign(block);
-// if(ob->sensors.first) uiSetCurFont(block, UI_HELVB);
+// if (ob->sensors.first) uiSetCurFont(block, UI_HELVB);
uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
-// if(ob->sensors.first) uiSetCurFont(block, UI_HELV);
+// if (ob->sensors.first) uiSetCurFont(block, UI_HELV);
uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor");
uiBlockEndAlign(block);
yco-=20;
- if(ob->scaflag & OB_SHOWSENS) {
+ if (ob->scaflag & OB_SHOWSENS) {
sens= ob->sensors.first;
- while(sens) {
+ while (sens) {
if (!(slogic->scaflag & BUTS_SENS_STATE) ||
(sens->totlinks == 0) || /* always display sensor without links so that is can be edited */
(sens->flag & SENS_PIN && slogic->scaflag & BUTS_SENS_STATE) || /* states can hide some sensors, pinned sensors ignore the visible state */
@@ -5018,30 +5027,30 @@ void logic_buttons(bContext *C, ARegion *ar)
ycoo= yco;
if (sens->flag & SENS_SHOW) {
uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(), (short)(xco+22), yco, 80, UI_UNIT_Y, &sens->type, 0, 0, 0, 0, "Sensor type");
- but= uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens->name, 0, MAX_NAME, 0, 0, "Sensor name");
+ but = uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens->name, 0, MAX_NAME, 0, 0, "Sensor name");
uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0);
sens->otype= sens->type;
yco= draw_sensorbuttons(ob, sens, block, xco, yco, width);
- if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
+ if (yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
}
else {
set_col_sensor(sens->type, 1);
glRecti(xco+22, yco, xco+width-22,yco+19);
- but= uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, "");
+ but = uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, "");
//uiButSetFunc(but, old_sca_move_sensor, sens, NULL);
- but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, MAX_NAME, 0, 0, "");
+ but = uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, MAX_NAME, 0, 0, "");
//uiButSetFunc(but, old_sca_move_sensor, sens, NULL);
uiBlockBeginAlign(block);
- but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
+ but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
uiButSetFunc(but, old_sca_move_sensor, sens, (void *)TRUE);
- but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
+ but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
uiButSetFunc(but, old_sca_move_sensor, sens, (void *)FALSE);
uiBlockEndAlign(block);
}
- but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ but = uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiSetButLink(but, NULL, (void ***)&(sens->links), &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER);
yco-=20;
@@ -5061,25 +5070,25 @@ void logic_buttons(bContext *C, ARegion *ar)
uiDefButBitS(block, TOG, BUTS_ACT_LINK, B_REDR, "Link", xco+110+2*(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller");
uiDefButBitS(block, TOG, BUTS_ACT_STATE, B_REDR, "State", xco+110+3*(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show only actuators connected to active states");
uiBlockEndAlign(block);
- for(a=0; a<count; a++) {
+ for (a=0; a<count; a++) {
ob= (Object *)idar[a];
// uiClearButLock();
// uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- if( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
+ if ( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
/* presume it is only objects for now */
uiBlockBeginAlign(block);
-// if(ob->actuators.first) uiSetCurFont(block, UI_HELVB);
+// if (ob->actuators.first) uiSetCurFont(block, UI_HELVB);
uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco,(short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
-// if(ob->actuators.first) uiSetCurFont(block, UI_HELV);
+// if (ob->actuators.first) uiSetCurFont(block, UI_HELV);
uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator");
uiBlockEndAlign(block);
yco-=20;
- if(ob->scaflag & OB_SHOWACT) {
+ if (ob->scaflag & OB_SHOWACT) {
act= ob->actuators.first;
- while(act) {
+ while (act) {
if (!(slogic->scaflag & BUTS_ACT_STATE) ||
!(act->flag & ACT_LINKED) || /* always display actuators without links so that is can be edited */
(act->flag & ACT_VISIBLE) || /* this actuator has visible connection, display it */
@@ -5093,15 +5102,15 @@ void logic_buttons(bContext *C, ARegion *ar)
uiDefIconButBitS(block, ICONTOG, ACT_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
uiDefIconButBitS(block, ICONTOG, ACT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Display the actuator");
- if(act->flag & ACT_SHOW) {
+ if (act->flag & ACT_SHOW) {
act->otype= act->type;
uiDefButS(block, MENU, B_CHANGE_ACT, actuator_pup(ob), (short)(xco+22), yco, 90, UI_UNIT_Y, &act->type, 0, 0, 0, 0, "Actuator type");
- but= uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act->name, 0, MAX_NAME, 0, 0, "Actuator name");
+ but = uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act->name, 0, MAX_NAME, 0, 0, "Actuator name");
uiButSetFunc(but, make_unique_prop_names_cb, act->name, (void*) 0);
ycoo= yco;
yco= draw_actuatorbuttons(bmain, ob, act, block, xco, yco, width);
- if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
+ if (yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
}
else {
set_col_actuator(act->type, 1);
@@ -5112,9 +5121,9 @@ void logic_buttons(bContext *C, ARegion *ar)
// uiButSetFunc(but, old_sca_move_actuator, act, NULL);
uiBlockBeginAlign(block);
- but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
+ but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
uiButSetFunc(but, old_sca_move_actuator, act, (void *)TRUE);
- but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
+ but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
uiButSetFunc(but, old_sca_move_actuator, act, (void *)FALSE);
uiBlockEndAlign(block);
@@ -5136,7 +5145,7 @@ void logic_buttons(bContext *C, ARegion *ar)
uiEndBlock(C, block);
uiDrawBlock(C, block);
- if(idar) MEM_freeN(idar);
+ if (idar) MEM_freeN(idar);
}
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
index a9b1acbcc04..1b6d72cbc3e 100644
--- a/source/blender/editors/space_logic/space_logic.c
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -63,13 +63,13 @@ ARegion *logic_has_buttons_region(ScrArea *sa)
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if(ar) return ar;
+ if (ar) return ar;
/* add subdiv level; after header */
ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if(ar==NULL) return NULL;
+ if (ar==NULL) return NULL;
arnew= MEM_callocN(sizeof(ARegion), "buttons for image");
@@ -119,15 +119,15 @@ static SpaceLink *logic_new(const bContext *UNUSED(C))
BLI_addtail(&slogic->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin= 0.0f;
- ar->v2d.tot.ymin= 0.0f;
- ar->v2d.tot.xmax= 1280;
- ar->v2d.tot.ymax= 240.0f;
+ ar->v2d.tot.xmin = 0.0f;
+ ar->v2d.tot.ymin = 0.0f;
+ ar->v2d.tot.xmax = 1280;
+ ar->v2d.tot.ymax = 240.0f;
- ar->v2d.cur.xmin= 0.0f;
- ar->v2d.cur.ymin= 0.0f;
- ar->v2d.cur.xmax= 1280.0f;
- ar->v2d.cur.ymax= 240.0f;
+ ar->v2d.cur.xmin = 0.0f;
+ ar->v2d.cur.ymin = 0.0f;
+ ar->v2d.cur.xmax = 1280.0f;
+ ar->v2d.cur.ymax = 240.0f;
ar->v2d.min[0]= 1.0f;
ar->v2d.min[1]= 1.0f;
@@ -151,7 +151,7 @@ static void logic_free(SpaceLink *UNUSED(sl))
{
// Spacelogic *slogic= (SpaceLogic*) sl;
-// if(slogic->gpd)
+// if (slogic->gpd)
// XXX free_gpencil_data(slogic->gpd);
}
@@ -178,7 +178,7 @@ static void logic_operatortypes(void)
static void logic_keymap(struct wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Logic Editor", SPACE_LOGIC, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Logic Editor", SPACE_LOGIC, 0);
WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "LOGIC_OT_links_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
@@ -213,7 +213,7 @@ static void logic_listener(ARegion *ar, wmNotifier *wmn)
case NC_OBJECT:
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
}
@@ -236,7 +236,7 @@ static void logic_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymaps */
- keymap= WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -275,7 +275,7 @@ static void logic_buttons_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap= WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt
index cae31f86388..aa3598e8e1f 100644
--- a/source/blender/editors/space_nla/CMakeLists.txt
+++ b/source/blender/editors/space_nla/CMakeLists.txt
@@ -46,4 +46,8 @@ set(SRC
nla_intern.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_nla/SConscript b/source/blender/editors/space_nla/SConscript
index 6738f3380b4..ee010e6856f 100644
--- a/source/blender/editors/space_nla/SConscript
+++ b/source/blender/editors/space_nla/SConscript
@@ -6,4 +6,9 @@ sources = env.Glob('*.c')
incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../blenloader'
-env.BlenderLib ( 'bf_editors_space_nla', sources, Split(incs), [], libtype=['core'], priority=[85] )
+defs = []
+
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_space_nla', sources, Split(incs), defs, libtype=['core'], priority=[85] )
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 6086496b00b..e6f2a947a11 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -519,7 +519,7 @@ static int nla_properties(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= nla_has_buttons_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -527,13 +527,13 @@ static int nla_properties(bContext *C, wmOperator *UNUSED(op))
void NLA_OT_properties(wmOperatorType *ot)
{
- ot->name= "Properties";
- ot->idname= "NLA_OT_properties";
- ot->description= "Toggle display properties panel";
+ ot->name = "Properties";
+ ot->idname = "NLA_OT_properties";
+ ot->description = "Toggle display properties panel";
- ot->exec= nla_properties;
- ot->poll= ED_operator_nla_active;
+ ot->exec = nla_properties;
+ ot->poll = ED_operator_nla_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 7cbe5058190..0b65866298a 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -345,16 +345,16 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
void NLA_OT_channels_click (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mouse Click on NLA Channels";
- ot->idname= "NLA_OT_channels_click";
- ot->description= "Handle clicks to select NLA channels";
+ ot->name = "Mouse Click on NLA Channels";
+ ot->idname = "NLA_OT_channels_click";
+ ot->description = "Handle clicks to select NLA channels";
/* api callbacks */
- ot->invoke= nlachannels_mouseclick_invoke;
- ot->poll= ED_operator_nla_active;
+ ot->invoke = nlachannels_mouseclick_invoke;
+ ot->poll = ED_operator_nla_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
@@ -419,16 +419,16 @@ static int nlaedit_add_tracks_exec (bContext *C, wmOperator *op)
void NLA_OT_tracks_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Track(s)";
- ot->idname= "NLA_OT_tracks_add";
- ot->description= "Add NLA-Tracks above/after the selected tracks";
+ ot->name = "Add Track(s)";
+ ot->idname = "NLA_OT_tracks_add";
+ ot->description = "Add NLA-Tracks above/after the selected tracks";
/* api callbacks */
- ot->exec= nlaedit_add_tracks_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_add_tracks_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "above_selected", 0, "Above Selected", "Add a new NLA Track above every existing selected one");
@@ -455,7 +455,7 @@ static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op))
/* delete tracks */
for (ale= anim_data.first; ale; ale= ale->next) {
- if(ale->type == ANIMTYPE_NLATRACK) {
+ if (ale->type == ANIMTYPE_NLATRACK) {
NlaTrack *nlt= (NlaTrack *)ale->data;
AnimData *adt= ale->adt;
@@ -483,16 +483,16 @@ static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_delete_tracks (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Tracks";
- ot->idname= "NLA_OT_delete_tracks";
- ot->description= "Delete selected NLA-Tracks and the strips they contain";
+ ot->name = "Delete Tracks";
+ ot->idname = "NLA_OT_delete_tracks";
+ ot->description = "Delete selected NLA-Tracks and the strips they contain";
/* api callbacks */
- ot->exec= nlaedit_delete_tracks_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_delete_tracks_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* *********************************************** */
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index f94918e4b4a..0b8565b93a2 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -498,10 +498,10 @@ static void nla_draw_strip_text (AnimData *adt, NlaTrack *nlt, NlaStrip *strip,
* - padding of 2 'units' on either side
*/
// TODO: make this centered?
- rect.xmin= strip->start + xofs;
- rect.ymin= yminc;
- rect.xmax= strip->end - xofs;
- rect.ymax= ymaxc;
+ rect.xmin = strip->start + xofs;
+ rect.ymin = yminc;
+ rect.xmax = strip->end - xofs;
+ rect.ymax = ymaxc;
/* add this string to the cache of texts to draw */
UI_view2d_text_cache_rectf(v2d, &rect, str, col);
@@ -559,7 +559,7 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* don't use totrect set, as the width stays the same
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
- v2d->tot.ymin= (float)(-height);
+ v2d->tot.ymin = (float)(-height);
/* loop through channels, and set up drawing depending on their type */
y= (float)(-NLACHANNEL_HEIGHT(snla));
@@ -946,7 +946,7 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar)
/* don't use totrect set, as the width stays the same
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
- v2d->tot.ymin= (float)(-height);
+ v2d->tot.ymin = (float)(-height);
/* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */
UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY);
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index c0e9b7a3a57..d191f1d1d35 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -158,16 +158,16 @@ static int nlaedit_enable_tweakmode_exec (bContext *C, wmOperator *op)
void NLA_OT_tweakmode_enter (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Enter Tweak Mode";
- ot->idname= "NLA_OT_tweakmode_enter";
- ot->description= "Enter tweaking mode for the action referenced by the active strip";
+ ot->name = "Enter Tweak Mode";
+ ot->idname = "NLA_OT_tweakmode_enter";
+ ot->description = "Enter tweaking mode for the action referenced by the active strip";
/* api callbacks */
- ot->exec= nlaedit_enable_tweakmode_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_enable_tweakmode_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ------------- */
@@ -223,16 +223,16 @@ static int nlaedit_disable_tweakmode_exec (bContext *C, wmOperator *op)
void NLA_OT_tweakmode_exit (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Exit Tweak Mode";
- ot->idname= "NLA_OT_tweakmode_exit";
- ot->description= "Exit tweaking mode for the action referenced by the active strip";
+ ot->name = "Exit Tweak Mode";
+ ot->idname = "NLA_OT_tweakmode_exit";
+ ot->description = "Exit tweaking mode for the action referenced by the active strip";
/* api callbacks */
- ot->exec= nlaedit_disable_tweakmode_exec;
- ot->poll= nlaop_poll_tweakmode_on;
+ ot->exec = nlaedit_disable_tweakmode_exec;
+ ot->poll = nlaop_poll_tweakmode_on;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* *********************************************** */
@@ -309,8 +309,8 @@ static int nlaedit_viewall(bContext *C, const short onlySel)
v2d->cur.xmax += extra;
/* set vertical range */
- v2d->cur.ymax= 0.0f;
- v2d->cur.ymin= (float)-(v2d->mask.ymax - v2d->mask.ymin);
+ v2d->cur.ymax = 0.0f;
+ v2d->cur.ymin = (float)-(v2d->mask.ymax - v2d->mask.ymin);
/* do View2D syncing */
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
@@ -338,31 +338,31 @@ static int nlaedit_viewsel_exec(bContext *C, wmOperator *UNUSED(op))
void NLA_OT_view_all (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View All";
- ot->idname= "NLA_OT_view_all";
- ot->description= "Reset viewable area to show full strips range";
+ ot->name = "View All";
+ ot->idname = "NLA_OT_view_all";
+ ot->description = "Reset viewable area to show full strips range";
/* api callbacks */
- ot->exec= nlaedit_viewall_exec;
- ot->poll= ED_operator_nla_active;
+ ot->exec = nlaedit_viewall_exec;
+ ot->poll = ED_operator_nla_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
void NLA_OT_view_selected (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Selected";
- ot->idname= "NLA_OT_view_selected";
- ot->description= "Reset viewable area to show selected strips range";
+ ot->name = "View Selected";
+ ot->idname = "NLA_OT_view_selected";
+ ot->description = "Reset viewable area to show selected strips range";
/* api callbacks */
- ot->exec= nlaedit_viewsel_exec;
- ot->poll= ED_operator_nla_active;
+ ot->exec = nlaedit_viewsel_exec;
+ ot->poll = ED_operator_nla_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* *********************************************** */
@@ -473,23 +473,23 @@ void NLA_OT_actionclip_add (wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Action Strip";
- ot->idname= "NLA_OT_actionclip_add";
- ot->description= "Add an Action-Clip strip (i.e. an NLA Strip referencing an Action) to the active track";
+ ot->name = "Add Action Strip";
+ ot->idname = "NLA_OT_actionclip_add";
+ ot->description = "Add an Action-Clip strip (i.e. an NLA Strip referencing an Action) to the active track";
/* api callbacks */
- ot->invoke= WM_enum_search_invoke;
- ot->exec= nlaedit_add_actionclip_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->invoke = WM_enum_search_invoke;
+ ot->exec = nlaedit_add_actionclip_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
// TODO: this would be nicer as an ID-pointer...
prop= RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", "");
RNA_def_enum_funcs(prop, RNA_action_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
/* ******************** Add Transition Operator ***************************** */
@@ -598,16 +598,16 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
void NLA_OT_transition_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Transition";
- ot->idname= "NLA_OT_transition_add";
- ot->description= "Add a transition strip between two adjacent selected strips";
+ ot->name = "Add Transition";
+ ot->idname = "NLA_OT_transition_add";
+ ot->description = "Add a transition strip between two adjacent selected strips";
/* api callbacks */
- ot->exec= nlaedit_add_transition_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_add_transition_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Add Sound Clip Operator ***************************** */
@@ -683,16 +683,16 @@ static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_soundclip_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Sound Clip";
- ot->idname= "NLA_OT_soundclip_add";
- ot->description= "Add a strip for controlling when speaker plays its sound clip";
+ ot->name = "Add Sound Clip";
+ ot->idname = "NLA_OT_soundclip_add";
+ ot->description = "Add a strip for controlling when speaker plays its sound clip";
/* api callbacks */
- ot->exec= nlaedit_add_sound_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_add_sound_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Add Meta-Strip Operator ***************************** */
@@ -745,16 +745,16 @@ static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_meta_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Meta-Strips";
- ot->idname= "NLA_OT_meta_add";
- ot->description= "Add new meta-strips incorporating the selected strips";
+ ot->name = "Add Meta-Strips";
+ ot->idname = "NLA_OT_meta_add";
+ ot->description = "Add new meta-strips incorporating the selected strips";
/* api callbacks */
- ot->exec= nlaedit_add_meta_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_add_meta_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Remove Meta-Strip Operator ***************************** */
@@ -797,16 +797,16 @@ static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_meta_remove (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Meta-Strips";
- ot->idname= "NLA_OT_meta_remove";
- ot->description= "Separate out the strips held by the selected meta-strips";
+ ot->name = "Remove Meta-Strips";
+ ot->idname = "NLA_OT_meta_remove";
+ ot->description = "Separate out the strips held by the selected meta-strips";
/* api callbacks */
- ot->exec= nlaedit_remove_meta_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_remove_meta_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Duplicate Strips Operator ************************** */
@@ -900,17 +900,17 @@ static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
void NLA_OT_duplicate (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Duplicate Strips";
- ot->idname= "NLA_OT_duplicate";
- ot->description= "Duplicate selected NLA-Strips, adding the new strips in new tracks above the originals";
+ ot->name = "Duplicate Strips";
+ ot->idname = "NLA_OT_duplicate";
+ ot->description = "Duplicate selected NLA-Strips, adding the new strips in new tracks above the originals";
/* api callbacks */
- ot->invoke= nlaedit_duplicate_invoke;
- ot->exec= nlaedit_duplicate_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->invoke = nlaedit_duplicate_invoke;
+ ot->exec = nlaedit_duplicate_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* to give to transform */
RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -975,16 +975,16 @@ static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_delete (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Strips";
- ot->idname= "NLA_OT_delete";
- ot->description= "Delete selected strips";
+ ot->name = "Delete Strips";
+ ot->idname = "NLA_OT_delete";
+ ot->description = "Delete selected strips";
/* api callbacks */
- ot->exec= nlaedit_delete_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_delete_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Split Strips Operator ***************************** */
@@ -1120,16 +1120,16 @@ static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_split (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Split Strips";
- ot->idname= "NLA_OT_split";
- ot->description= "Split selected strips at their midpoints";
+ ot->name = "Split Strips";
+ ot->idname = "NLA_OT_split";
+ ot->description = "Split selected strips at their midpoints";
/* api callbacks */
- ot->exec= nlaedit_split_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_split_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Bake Strips Operator ***************************** */
@@ -1173,16 +1173,16 @@ static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_bake (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Bake Strips";
- ot->idname= "NLA_OT_bake";
- ot->description= "Bake all strips of selected AnimData blocks";
+ ot->name = "Bake Strips";
+ ot->idname = "NLA_OT_bake";
+ ot->description = "Bake all strips of selected AnimData blocks";
/* api callbacks */
- ot->exec= nlaedit_bake_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_bake_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* *********************************************** */
@@ -1235,16 +1235,16 @@ static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_mute_toggle (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Muting";
- ot->idname= "NLA_OT_mute_toggle";
- ot->description= "Mute or un-mute selected strips";
+ ot->name = "Toggle Muting";
+ ot->idname = "NLA_OT_mute_toggle";
+ ot->description = "Mute or un-mute selected strips";
/* api callbacks */
- ot->exec= nlaedit_toggle_mute_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_toggle_mute_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Swap Strips Operator ************************** */
@@ -1392,16 +1392,16 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
void NLA_OT_swap (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Swap Strips";
- ot->idname= "NLA_OT_swap";
- ot->description= "Swap order of selected strips within tracks";
+ ot->name = "Swap Strips";
+ ot->idname = "NLA_OT_swap";
+ ot->description = "Swap order of selected strips within tracks";
/* api callbacks */
- ot->exec= nlaedit_swap_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_swap_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Move Strips Up Operator ************************** */
@@ -1466,16 +1466,16 @@ static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_move_up (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Strips Up";
- ot->idname= "NLA_OT_move_up";
- ot->description= "Move selected strips up a track if there's room";
+ ot->name = "Move Strips Up";
+ ot->idname = "NLA_OT_move_up";
+ ot->description = "Move selected strips up a track if there's room";
/* api callbacks */
- ot->exec= nlaedit_move_up_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_move_up_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Move Strips Down Operator ************************** */
@@ -1540,16 +1540,16 @@ static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_move_down (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Strips Down";
- ot->idname= "NLA_OT_move_down";
- ot->description= "Move selected strips down a track if there's room";
+ ot->name = "Move Strips Down";
+ ot->idname = "NLA_OT_move_down";
+ ot->description = "Move selected strips down a track if there's room";
/* api callbacks */
- ot->exec= nlaedit_move_down_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_move_down_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Sync Action Length Operator ***************************** */
@@ -1616,19 +1616,19 @@ static int nlaedit_sync_actlen_exec (bContext *C, wmOperator *op)
void NLA_OT_action_sync_length (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Sync Action Length";
- ot->idname= "NLA_OT_action_sync_length";
- ot->description= "Synchronize the length of the referenced Action with the length used in the strip";
+ ot->name = "Sync Action Length";
+ ot->idname = "NLA_OT_action_sync_length";
+ ot->description = "Synchronize the length of the referenced Action with the length used in the strip";
/* api callbacks */
- ot->exec= nlaedit_sync_actlen_exec;
- ot->poll= ED_operator_nla_active; // XXX: is this satisfactory... probably requires a check for active strip...
+ ot->exec = nlaedit_sync_actlen_exec;
+ ot->poll = ED_operator_nla_active; // XXX: is this satisfactory... probably requires a check for active strip...
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= RNA_def_boolean(ot->srna, "active", 1, "Active Strip Only", "Only sync the active length for the active strip");
+ ot->prop = RNA_def_boolean(ot->srna, "active", 1, "Active Strip Only", "Only sync the active length for the active strip");
}
/* ******************** Apply Scale Operator ***************************** */
@@ -1716,16 +1716,16 @@ static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_apply_scale (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Apply Scale";
- ot->idname= "NLA_OT_apply_scale";
- ot->description= "Apply scaling of selected strips to their referenced Actions";
+ ot->name = "Apply Scale";
+ ot->idname = "NLA_OT_apply_scale";
+ ot->description = "Apply scaling of selected strips to their referenced Actions";
/* api callbacks */
- ot->exec= nlaedit_apply_scale_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_apply_scale_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Clear Scale Operator ***************************** */
@@ -1779,16 +1779,16 @@ static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op))
void NLA_OT_clear_scale (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Scale";
- ot->idname= "NLA_OT_clear_scale";
- ot->description= "Reset scaling of selected strips";
+ ot->name = "Clear Scale";
+ ot->idname = "NLA_OT_clear_scale";
+ ot->description = "Reset scaling of selected strips";
/* api callbacks */
- ot->exec= nlaedit_clear_scale_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_clear_scale_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ******************** Snap Strips Operator ************************** */
@@ -1920,20 +1920,20 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op)
void NLA_OT_snap (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Snap Strips";
- ot->idname= "NLA_OT_snap";
- ot->description= "Move start of strips to specified time";
+ ot->name = "Snap Strips";
+ ot->idname = "NLA_OT_snap";
+ ot->description = "Move start of strips to specified time";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= nlaedit_snap_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = nlaedit_snap_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop= RNA_def_enum(ot->srna, "type", prop_nlaedit_snap_types, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_nlaedit_snap_types, 0, "Type", "");
}
/* *********************************************** */
@@ -2039,20 +2039,20 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
void NLA_OT_fmodifier_add (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add F-Modifier";
- ot->idname= "NLA_OT_fmodifier_add";
- ot->description= "Add a F-Modifier of the specified type to the selected NLA-Strips";
+ ot->name = "Add F-Modifier";
+ ot->idname = "NLA_OT_fmodifier_add";
+ ot->description = "Add a F-Modifier of the specified type to the selected NLA-Strips";
/* api callbacks */
- ot->invoke= nla_fmodifier_add_invoke;
- ot->exec= nla_fmodifier_add_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->invoke = nla_fmodifier_add_invoke;
+ ot->exec = nla_fmodifier_add_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
RNA_def_boolean(ot->srna, "only_active", 0, "Only Active", "Only add a F-Modifier of the specified type to the active strip");
}
@@ -2103,16 +2103,16 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op)
void NLA_OT_fmodifier_copy (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy F-Modifiers";
- ot->idname= "NLA_OT_fmodifier_copy";
- ot->description= "Copy the F-Modifier(s) of the active NLA-Strip";
+ ot->name = "Copy F-Modifiers";
+ ot->idname = "NLA_OT_fmodifier_copy";
+ ot->description = "Copy the F-Modifier(s) of the active NLA-Strip";
/* api callbacks */
- ot->exec= nla_fmodifier_copy_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nla_fmodifier_copy_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
//ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All F-Modifiers", "Copy all the F-Modifiers, instead of just the active one");
@@ -2165,16 +2165,16 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op)
void NLA_OT_fmodifier_paste (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste F-Modifiers";
- ot->idname= "NLA_OT_fmodifier_paste";
- ot->description= "Add copied F-Modifiers to the selected NLA-Strips";
+ ot->name = "Paste F-Modifiers";
+ ot->idname = "NLA_OT_fmodifier_paste";
+ ot->description = "Add copied F-Modifiers to the selected NLA-Strips";
/* api callbacks */
- ot->exec= nla_fmodifier_paste_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nla_fmodifier_paste_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* *********************************************** */
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 55831de876c..78fb92f2ee4 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -200,21 +200,21 @@ static void nla_keymap_main (wmKeyConfig *keyconf, wmKeyMap *keymap)
/* click select */
kmi = WM_keymap_add_item(keymap, "NLA_OT_click_select", SELECTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
- kmi= WM_keymap_add_item(keymap, "NLA_OT_click_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "NLA_OT_click_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
/* select left/right */
kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_TEST);
- kmi= WM_keymap_add_item(keymap, "NLA_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_TEST);
- kmi= WM_keymap_add_item(keymap, "NLA_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_LEFT);
- kmi= WM_keymap_add_item(keymap, "NLA_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_RIGHT);
@@ -301,7 +301,7 @@ void nla_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap;
/* keymap for all regions */
- keymap= WM_keymap_find(keyconf, "NLA Generic", SPACE_NLA, 0);
+ keymap = WM_keymap_find(keyconf, "NLA Generic", SPACE_NLA, 0);
WM_keymap_add_item(keymap, "NLA_OT_properties", NKEY, KM_PRESS, 0, 0);
/* channels */
@@ -311,11 +311,11 @@ void nla_keymap(wmKeyConfig *keyconf)
*
* However, those operations which involve clicking on channels and/or the placement of them in the view are implemented here instead
*/
- keymap= WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0);
+ keymap = WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0);
nla_keymap_channels(keymap);
/* data */
- keymap= WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0);
+ keymap = WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0);
nla_keymap_main(keyconf, keymap);
}
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index 6ad83f6591a..1434bd8ddc2 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -186,16 +186,16 @@ static int nlaedit_deselectall_exec(bContext *C, wmOperator *op)
void NLA_OT_select_all_toggle (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect All";
- ot->idname= "NLA_OT_select_all_toggle";
- ot->description= "(De)Select all NLA-Strips";
+ ot->name = "(De)select All";
+ ot->idname = "NLA_OT_select_all_toggle";
+ ot->description = "Select or deselect all NLA-Strips";
/* api callbacks */
- ot->exec= nlaedit_deselectall_exec;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->exec = nlaedit_deselectall_exec;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
/* props */
RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
@@ -294,10 +294,10 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT);
/* get settings from operator */
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
if (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT)
selectmode = SELECT_ADD;
@@ -331,20 +331,20 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
void NLA_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Select";
- ot->idname= "NLA_OT_select_border";
- ot->description= "Use box selection to grab NLA-Strips";
+ ot->name = "Border Select";
+ ot->idname = "NLA_OT_select_border";
+ ot->description = "Use box selection to grab NLA-Strips";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= nlaedit_borderselect_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = nlaedit_borderselect_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, 1);
@@ -484,20 +484,20 @@ static int nlaedit_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
void NLA_OT_select_leftright (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Left/Right";
- ot->idname= "NLA_OT_select_leftright";
- ot->description= "Select strips to the left or the right of the current frame";
+ ot->name = "Select Left/Right";
+ ot->idname = "NLA_OT_select_leftright";
+ ot->description = "Select strips to the left or the right of the current frame";
/* api callbacks */
- ot->invoke= nlaedit_select_leftright_invoke;
- ot->exec= nlaedit_select_leftright_exec;
- ot->poll= ED_operator_nla_active;
+ ot->invoke = nlaedit_select_leftright_invoke;
+ ot->exec = nlaedit_select_leftright_exec;
+ ot->poll = ED_operator_nla_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- ot->prop= RNA_def_enum(ot->srna, "mode", prop_nlaedit_leftright_select_types, NLAEDIT_LRSEL_TEST, "Mode", "");
+ ot->prop = RNA_def_enum(ot->srna, "mode", prop_nlaedit_leftright_select_types, NLAEDIT_LRSEL_TEST, "Mode", "");
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
}
@@ -646,16 +646,16 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
void NLA_OT_click_select (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mouse Select";
- ot->idname= "NLA_OT_click_select";
- ot->description= "Handle clicks to select NLA Strips";
+ ot->name = "Mouse Select";
+ ot->idname = "NLA_OT_click_select";
+ ot->description = "Handle clicks to select NLA Strips";
/* api callbacks - absolutely no exec() this yet... */
- ot->invoke= nlaedit_clickselect_invoke;
- ot->poll= ED_operator_nla_active;
+ ot->invoke = nlaedit_clickselect_invoke;
+ ot->poll = ED_operator_nla_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 2f0d39c5f91..4dc3aef7d2c 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -69,7 +69,7 @@ ARegion *nla_has_buttons_region(ScrArea *sa)
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if(ar) return ar;
+ if (ar) return ar;
/* add subdiv level; after main */
ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
@@ -140,10 +140,10 @@ static SpaceLink *nla_new(const bContext *C)
BLI_addtail(&snla->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin= (float)(SFRA-10);
- ar->v2d.tot.ymin= (float)(-sa->winy)/3.0f;
- ar->v2d.tot.xmax= (float)(EFRA+10);
- ar->v2d.tot.ymax= 0.0f;
+ ar->v2d.tot.xmin = (float)(SFRA-10);
+ ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
+ ar->v2d.tot.xmax = (float)(EFRA+10);
+ ar->v2d.tot.ymax = 0.0f;
ar->v2d.cur = ar->v2d.tot;
@@ -210,13 +210,13 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar)
/* own keymap */
/* own channels map first to override some channel keymaps */
- keymap= WM_keymap_find(wm->defaultconf, "NLA Channels", SPACE_NLA, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "NLA Channels", SPACE_NLA, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
/* now generic channels map for everything else that can apply */
- keymap= WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -256,9 +256,9 @@ static void nla_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "NLA Editor", SPACE_NLA, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "NLA Editor", SPACE_NLA, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -336,7 +336,7 @@ static void nla_buttons_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -371,7 +371,7 @@ static void nla_region_listener(ARegion *ar, wmNotifier *wmn)
}
break;
default:
- if(wmn->data==ND_KEYS)
+ if (wmn->data==ND_KEYS)
ED_region_tag_redraw(ar);
break;
}
@@ -413,11 +413,11 @@ static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
default:
- if(wmn->data==ND_KEYS)
+ if (wmn->data==ND_KEYS)
ED_region_tag_redraw(ar);
}
}
@@ -446,12 +446,12 @@ static void nla_channel_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
default:
- if(wmn->data==ND_KEYS)
+ if (wmn->data==ND_KEYS)
ED_region_tag_redraw(ar);
}
}
@@ -487,7 +487,7 @@ static void nla_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_NLA)
+ if (wmn->data == ND_SPACE_NLA)
ED_area_tag_redraw(sa);
break;
}
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index f33b784c5d2..8c3397b9ddd 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -54,4 +54,8 @@ set(SRC
node_intern.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_node/SConscript b/source/blender/editors/space_node/SConscript
index ec4ed971a76..58fae203cf5 100644
--- a/source/blender/editors/space_node/SConscript
+++ b/source/blender/editors/space_node/SConscript
@@ -14,7 +14,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
if env['CC'] == 'gcc':
#cf.append('-Werror')
pass
-
+
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'
@@ -22,4 +22,7 @@ if env['OURPLATFORM'] == 'linux':
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
env.BlenderLib ( 'bf_editors_space_node', sources, Split(incs), defs, libtype=['core'], priority=[55], compileflags=cf )
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 64af846a79b..7176c86cb11 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -79,17 +79,13 @@
#include "node_intern.h"
-
-// XXX interface.h
-extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
-
/* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */
static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v)
{
SpaceNode *snode= snode_v;
- if(snode->treetype==NTREE_SHADER) {
+ if (snode->treetype==NTREE_SHADER) {
nodeShaderSynchronizeID(node_v, 1);
// allqueue(REDRAWBUTSSHADING, 0);
}
@@ -287,7 +283,7 @@ static void node_draw_socket_new(bNodeSocket *sock, float size)
glColor3ub(180, 180, 180);
glBegin(GL_POLYGON);
- for(a=0; a<16; a++)
+ for (a=0; a<16; a++)
glVertex2f(x+size*si[a], y+size*co[a]);
glEnd();
@@ -295,7 +291,7 @@ static void node_draw_socket_new(bNodeSocket *sock, float size)
glEnable(GL_BLEND);
glEnable( GL_LINE_SMOOTH );
glBegin(GL_LINE_LOOP);
- for(a=0; a<16; a++)
+ for (a=0; a<16; a++)
glVertex2f(x+size*si[a], y+size*co[a]);
glEnd();
glDisable( GL_LINE_SMOOTH );
@@ -340,7 +336,7 @@ static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA
row= uiLayoutRow(layout, 1);
uiItemR(row, ptr, "blend_type", 0, "", ICON_NONE);
- if(ntree->type == NTREE_COMPOSIT)
+ if (ntree->type == NTREE_COMPOSIT)
uiItemR(row, ptr, "use_alpha", 0, "", ICON_IMAGE_RGB_ALPHA);
}
@@ -352,9 +348,9 @@ static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *pt
bNode *node= ptr->data;
CurveMapping *cumap= node->storage;
- if(cumap) {
+ if (cumap) {
cumap->flag |= CUMA_DRAW_CFRA;
- if(node->custom1<node->custom2)
+ if (node->custom1<node->custom2)
cumap->sample[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
}
#endif
@@ -389,7 +385,7 @@ static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA
bNode *node= ptr->data;
CurveMapping *cumap= node->storage;
- if(_sample_col) {
+ if (_sample_col) {
cumap->flag |= CUMA_DRAW_SAMPLE;
copy_v3_v3(cumap->sample, _sample_col);
}
@@ -431,9 +427,9 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
bNode *node= node_v;
Tex *tex;
- if(node->menunr<1) return;
+ if (node->menunr<1) return;
- if(node->id) {
+ if (node->id) {
node->id->us--;
node->id= NULL;
}
@@ -445,7 +441,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
nodeSetActive(ntree, node);
- if( ntree->type == NTREE_TEXTURE )
+ if ( ntree->type == NTREE_TEXTURE )
ntreeTexCheckCyclics( ntree );
// allqueue(REDRAWBUTSSHADING, 0);
@@ -500,7 +496,7 @@ static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA
uiItemR(layout, ptr, "texture", 0, "", ICON_NONE);
- if(multi) {
+ if (multi) {
/* Number Drawing not optimal here, better have a list*/
uiItemR(layout, ptr, "node_output", 0, "", ICON_NONE);
}
@@ -516,15 +512,15 @@ static int node_resize_area_default(bNode *node, int x, int y)
if (node->flag & NODE_HIDDEN) {
rctf totr= node->totr;
/* right part of node */
- totr.xmin= node->totr.xmax-20.0f;
+ totr.xmin = node->totr.xmax-20.0f;
return BLI_in_rctf(&totr, x, y);
}
else {
/* rect we're interested in is just the bottom right corner */
rctf totr= node->totr;
/* bottom right corner */
- totr.xmin= totr.xmax-10.0f;
- totr.ymax= totr.ymin+10.0f;
+ totr.xmin = totr.xmax-10.0f;
+ totr.ymax = totr.ymin+10.0f;
return BLI_in_rctf(&totr, x, y);
}
}
@@ -563,8 +559,8 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
rect->ymin = rect->ymax = locy;
counter= 1;
- for(node= ngroup->nodes.first; node; node= node->next) {
- if(counter) {
+ for (node= ngroup->nodes.first; node; node= node->next) {
+ if (counter) {
*rect= node->totr;
counter= 0;
}
@@ -956,13 +952,13 @@ static void node_update_frame(const bContext *UNUSED(C), bNodeTree *UNUSED(ntree
/* get "global" coords */
nodeSpaceCoords(node, &locx, &locy);
- node->prvr.xmin= locx + NODE_DYS;
- node->prvr.xmax= locx + node->width- NODE_DYS;
+ node->prvr.xmin = locx + NODE_DYS;
+ node->prvr.xmax = locx + node->width- NODE_DYS;
- node->totr.xmin= locx;
- node->totr.xmax= locx + node->width;
- node->totr.ymax= locy;
- node->totr.ymin= locy - node->height;
+ node->totr.xmin = locx;
+ node->totr.xmax = locx + node->width;
+ node->totr.ymax = locy;
+ node->totr.ymin = locy - node->height;
}
static void node_common_set_butfunc(bNodeType *ntype)
@@ -998,9 +994,9 @@ static void node_browse_text_cb(bContext *C, void *ntree_v, void *node_v)
bNode *node= node_v;
/* ID *oldid; */ /* UNUSED */
- if(node->menunr<1) return;
+ if (node->menunr<1) return;
- if(node->id) {
+ if (node->id) {
node->id->us--;
}
/* oldid= node->id; */ /* UNUSED */
@@ -1025,7 +1021,7 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA
uiTemplateID(layout, C, ptr, "material", "MATERIAL_OT_new", NULL, NULL);
- if(!node->id) return;
+ if (!node->id) return;
col= uiLayoutColumn(layout, 0);
uiItemR(col, ptr, "use_diffuse", 0, NULL, ICON_NONE);
@@ -1070,7 +1066,7 @@ static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA
col= uiLayoutColumn(layout, 0);
- if(obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
+ if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
PointerRNA dataptr= RNA_pointer_get(&obptr, "data");
uiItemPointerR(col, ptr, "uv_layer", &dataptr, "uv_textures", "", ICON_NONE);
@@ -1150,7 +1146,7 @@ static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *
int xoff=0;
/* B_NODE_EXEC is handled in butspace.c do_node_buts */
- if(!node->id) {
+ if (!node->id) {
const char *strp;
IDnames_to_pupstring(&strp, NULL, "", &(bmain->text), NULL, NULL);
node->menunr= 0;
@@ -1159,7 +1155,7 @@ static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *
&node->menunr, 0, 0, 0, 0, "Browses existing choices");
uiButSetFunc(bt, node_browse_text_cb, ntree, node);
xoff=19;
- if(strp) MEM_freeN((void *)strp);
+ if (strp) MEM_freeN((void *)strp);
}
else {
bt = uiDefBut(block, BUT, B_NOP, "Update",
@@ -1273,7 +1269,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
- if(!node->id) return;
+ if (!node->id) return;
prop = RNA_struct_find_property(ptr, "image");
if (!prop || RNA_property_type(prop) != PROP_POINTER) return;
@@ -1285,7 +1281,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
source= RNA_enum_get(&imaptr, "source");
- if(source == IMA_SRC_SEQUENCE) {
+ if (source == IMA_SRC_SEQUENCE) {
/* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
Scene *scene= CTX_data_scene(C);
ImageUser *iuser= node->storage;
@@ -1325,7 +1321,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point
uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL);
- if(!node->id) return;
+ if (!node->id) return;
col= uiLayoutColumn(layout, 0);
row = uiLayoutRow(col, 0);
@@ -1538,12 +1534,13 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), Point
uiItemR(layout, ptr, "relative", 0, NULL, ICON_NONE);
col= uiLayoutColumn(layout, 1);
- if (RNA_boolean_get(ptr, "relative")){
+ if (RNA_boolean_get(ptr, "relative")) {
uiItemR(col, ptr, "rel_min_x", 0, "Left", ICON_NONE);
uiItemR(col, ptr, "rel_max_x", 0, "Right", ICON_NONE);
uiItemR(col, ptr, "rel_min_y", 0, "Up", ICON_NONE);
uiItemR(col, ptr, "rel_max_y", 0, "Down", ICON_NONE);
- } else {
+ }
+ else {
uiItemR(col, ptr, "min_x", 0, "Left", ICON_NONE);
uiItemR(col, ptr, "max_x", 0, "Right", ICON_NONE);
uiItemR(col, ptr, "min_y", 0, "Up", ICON_NONE);
@@ -1656,7 +1653,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C)
col= uiLayoutColumn(layout, 0);
uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NONE);
- if(RNA_enum_get(ptr, "limit_method")==0) {
+ if (RNA_enum_get(ptr, "limit_method")==0) {
uiItemL(col, "Limiting Channel:", ICON_NONE);
row=uiLayoutRow(col,0);
uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -1711,7 +1708,7 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(
col = uiLayoutColumn(layout, 0);
uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NONE);
- if(RNA_enum_get(ptr, "limit_method")==0) {
+ if (RNA_enum_get(ptr, "limit_method")==0) {
uiItemL(col, "Limiting Channel:", ICON_NONE);
row=uiLayoutRow(col,0);
uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -1847,7 +1844,8 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C
row = uiLayoutRow(col, 0);
uiItemR(row, ptr, "gain", 0, NULL, ICON_NONE);
- } else {
+ }
+ else {
split = uiLayoutSplit(layout, 0, 0);
col = uiLayoutColumn(split, 0);
@@ -1881,7 +1879,8 @@ static void node_composit_buts_colorbalance_but(uiLayout *layout, bContext *UNUS
uiTemplateColorWheel(layout, ptr, "gain", 1, 1, 1, 1);
uiItemR(layout, ptr, "gain", 0, NULL, ICON_NONE);
- } else {
+ }
+ else {
uiTemplateColorWheel(layout, ptr, "offset", 1, 1, 0, 1);
uiItemR(layout, ptr, "offset", 0, NULL, ICON_NONE);
@@ -1915,7 +1914,7 @@ static void node_composit_buts_stabilize2d(uiLayout *layout, bContext *C, Pointe
uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL);
- if(!node->id)
+ if (!node->id)
return;
uiItemR(layout, ptr, "filter_type", 0, "", 0);
@@ -1932,7 +1931,7 @@ static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, Po
uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL);
- if(!node->id)
+ if (!node->id)
return;
uiItemR(layout, ptr, "distortion_type", 0, "", 0);
@@ -2198,7 +2197,7 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe
break;
case TEX_VORONOI:
uiItemR(col, &tex_ptr, "distance_metric", 0, "", ICON_NONE);
- if(tex->vn_distm == TEX_MINKOVSKY) {
+ if (tex->vn_distm == TEX_MINKOVSKY) {
uiItemR(col, &tex_ptr, "minkovsky_exponent", 0, NULL, ICON_NONE);
}
uiItemR(col, &tex_ptr, "color_mode", 0, "", ICON_NONE);
@@ -2220,7 +2219,7 @@ static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), Poin
static void node_texture_set_butfunc(bNodeType *ntype)
{
ntype->uifuncbut = NULL;
- if( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) {
+ if ( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) {
ntype->uifunc = node_texture_buts_proc;
}
else switch(ntype->type) {
@@ -2333,11 +2332,11 @@ void ED_init_node_butfuncs(void)
void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
{
- if((snode->flag & SNODE_BACKDRAW) && snode->treetype==NTREE_COMPOSIT) {
+ if ((snode->flag & SNODE_BACKDRAW) && snode->treetype==NTREE_COMPOSIT) {
Image *ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
void *lock;
ImBuf *ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
- if(ibuf) {
+ if (ibuf) {
float x, y;
glMatrixMode(GL_PROJECTION);
@@ -2346,7 +2345,7 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
glPushMatrix();
/* keep this, saves us from a version patch */
- if(snode->zoom==0.0f) snode->zoom= 1.0f;
+ if (snode->zoom==0.0f) snode->zoom= 1.0f;
/* somehow the offset has to be calculated inverse */
@@ -2357,26 +2356,27 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
x = (ar->winx-snode->zoom*ibuf->x)/2 + snode->xof;
y = (ar->winy-snode->zoom*ibuf->y)/2 + snode->yof;
- if(!ibuf->rect) {
- if(color_manage)
+ if (!ibuf->rect) {
+ if (color_manage)
ibuf->profile = IB_PROFILE_LINEAR_RGB;
else
ibuf->profile = IB_PROFILE_NONE;
IMB_rect_from_float(ibuf);
}
- if(ibuf->rect) {
+ if (ibuf->rect) {
if (snode->flag & SNODE_SHOW_ALPHA) {
glPixelZoom(snode->zoom, snode->zoom);
/* swap bytes, so alpha is most significant one, then just draw it as luminance int */
- if(ENDIAN_ORDER == B_ENDIAN)
+ if (ENDIAN_ORDER == B_ENDIAN)
glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ibuf->rect);
glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
glPixelZoom(1.0f, 1.0f);
- } else if (snode->flag & SNODE_USE_ALPHA) {
+ }
+ else if (snode->flag & SNODE_USE_ALPHA) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPixelZoom(snode->zoom, snode->zoom);
@@ -2385,7 +2385,8 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
glPixelZoom(1.0f, 1.0f);
glDisable(GL_BLEND);
- } else {
+ }
+ else {
glPixelZoom(snode->zoom, snode->zoom);
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
@@ -2411,10 +2412,10 @@ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
draw_nodespace_grid(snode);
- if(snode->flag & SNODE_BACKDRAW) {
+ if (snode->flag & SNODE_BACKDRAW) {
Image *ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- if(ibuf) {
+ if (ibuf) {
int x, y;
float zoom = 1.0;
@@ -2425,7 +2426,7 @@ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
glaDefine2DArea(&sa->winrct);
- if(ibuf->x > sa->winx || ibuf->y > sa->winy) {
+ if (ibuf->x > sa->winx || ibuf->y > sa->winy) {
float zoomx, zoomy;
zoomx= (float)sa->winx/ibuf->x;
zoomy= (float)sa->winy/ibuf->y;
@@ -2438,9 +2439,9 @@ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
glPixelZoom(zoom, zoom);
glColor4f(1.0, 1.0, 1.0, 1.0);
- if(ibuf->rect)
+ if (ibuf->rect)
glaDrawPixelsTex(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect);
- else if(ibuf->channels==4)
+ else if (ibuf->channels==4)
glaDrawPixelsTex(x, y, ibuf->x, ibuf->y, GL_FLOAT, ibuf->rect_float);
glPixelZoom(1.0, 1.0);
@@ -2460,21 +2461,21 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
float dist, vec[4][2];
/* in v0 and v3 we put begin/end points */
- if(link->fromsock) {
+ if (link->fromsock) {
vec[0][0]= link->fromsock->locx;
vec[0][1]= link->fromsock->locy;
}
else {
- if(snode==NULL) return 0;
+ if (snode==NULL) return 0;
vec[0][0]= snode->mx;
vec[0][1]= snode->my;
}
- if(link->tosock) {
+ if (link->tosock) {
vec[3][0]= link->tosock->locx;
vec[3][1]= link->tosock->locy;
}
else {
- if(snode==NULL) return 0;
+ if (snode==NULL) return 0;
vec[3][0]= snode->mx;
vec[3][1]= snode->my;
}
@@ -2488,7 +2489,7 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
vec[2][0]= vec[3][0]-dist;
vec[2][1]= vec[3][1];
- if(v2d && MIN4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax); /* clipped */
+ if (v2d && MIN4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax); /* clipped */
else if (v2d && MAX4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin); /* clipped */
else {
@@ -2506,7 +2507,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
{
float coord_array[LINK_RESOL+1][2];
- if(node_link_bezier_points(v2d, snode, link, coord_array, LINK_RESOL)) {
+ if (node_link_bezier_points(v2d, snode, link, coord_array, LINK_RESOL)) {
float dist, spline_step = 0.0f;
int i;
@@ -2519,12 +2520,12 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
glEnable(GL_LINE_SMOOTH);
- if(do_triple) {
+ if (do_triple) {
UI_ThemeColorShadeAlpha(th_col3, -80, -120);
glLineWidth(4.0f);
glBegin(GL_LINE_STRIP);
- for(i=0; i<=LINK_RESOL; i++) {
+ for (i=0; i<=LINK_RESOL; i++) {
glVertex2fv(coord_array[i]);
}
glEnd();
@@ -2535,9 +2536,9 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
* changing color in begin/end blocks.
*/
glLineWidth(1.5f);
- if(do_shaded) {
+ if (do_shaded) {
glBegin(GL_LINES);
- for(i=0; i<LINK_RESOL; i++) {
+ for (i=0; i<LINK_RESOL; i++) {
UI_ThemeColorBlend(th_col1, th_col2, spline_step);
glVertex2fv(coord_array[i]);
@@ -2551,7 +2552,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
else {
UI_ThemeColor(th_col1);
glBegin(GL_LINE_STRIP);
- for(i=0; i<=LINK_RESOL; i++) {
+ for (i=0; i<=LINK_RESOL; i++) {
glVertex2fv(coord_array[i]);
}
glEnd();
@@ -2566,21 +2567,21 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
static void node_link_straight_points(View2D *UNUSED(v2d), SpaceNode *snode, bNodeLink *link, float coord_array[][2])
{
- if(link->fromsock) {
+ if (link->fromsock) {
coord_array[0][0]= link->fromsock->locx;
coord_array[0][1]= link->fromsock->locy;
}
else {
- if(snode==NULL) return;
+ if (snode==NULL) return;
coord_array[0][0]= snode->mx;
coord_array[0][1]= snode->my;
}
- if(link->tosock) {
+ if (link->tosock) {
coord_array[1][0]= link->tosock->locx;
coord_array[1][1]= link->tosock->locy;
}
else {
- if(snode==NULL) return;
+ if (snode==NULL) return;
coord_array[1][0]= snode->mx;
coord_array[1][1]= snode->my;
}
@@ -2599,7 +2600,7 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int
glEnable(GL_LINE_SMOOTH);
- if(do_triple) {
+ if (do_triple) {
UI_ThemeColorShadeAlpha(th_col3, -80, -120);
glLineWidth(4.0f);
@@ -2616,7 +2617,7 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int
* for Intel hardware, this breaks with GL_LINE_STRIP and
* changing color in begin/end blocks.
*/
- if(do_shaded) {
+ if (do_shaded) {
glBegin(GL_LINES);
for (i=0; i < LINK_RESOL-1; ++i) {
float t= (float)i/(float)(LINK_RESOL-1);
@@ -2650,38 +2651,38 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link)
int do_shaded= 0, th_col1= TH_HEADER, th_col2= TH_HEADER;
int do_triple= 0, th_col3= TH_WIRE;
- if(link->fromsock==NULL && link->tosock==NULL)
+ if (link->fromsock==NULL && link->tosock==NULL)
return;
/* new connection */
- if(!link->fromsock || !link->tosock) {
+ if (!link->fromsock || !link->tosock) {
th_col1 = TH_ACTIVE;
do_triple = 1;
}
else {
/* going to give issues once... */
- if(link->tosock->flag & SOCK_UNAVAIL)
+ if (link->tosock->flag & SOCK_UNAVAIL)
return;
- if(link->fromsock->flag & SOCK_UNAVAIL)
+ if (link->fromsock->flag & SOCK_UNAVAIL)
return;
/* a bit ugly... but thats how we detect the internal group links */
- if(!link->fromnode || !link->tonode) {
+ if (!link->fromnode || !link->tonode) {
UI_ThemeColorBlend(TH_BACK, TH_WIRE, 0.5f);
do_shaded= 0;
}
else {
/* check cyclic */
- if((link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) && (link->flag & NODE_LINK_VALID)) {
+ if ((link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) && (link->flag & NODE_LINK_VALID)) {
/* special indicated link, on drop-node */
- if(link->flag & NODE_LINKFLAG_HILITE) {
+ if (link->flag & NODE_LINKFLAG_HILITE) {
th_col1= th_col2= TH_ACTIVE;
}
else {
/* regular link */
- if(link->fromnode->flag & SELECT)
+ if (link->fromnode->flag & SELECT)
th_col1= TH_EDGE_SELECT;
- if(link->tonode->flag & SELECT)
+ if (link->tonode->flag & SELECT)
th_col2= TH_EDGE_SELECT;
}
do_shaded= 1;
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index 1b5f2417384..19eebe4d320 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -142,10 +142,10 @@ static void node_sockets_panel(const bContext *C, Panel *pa)
uiLayout *layout= pa->layout, *split;
char name[UI_MAX_NAME_STR];
- if(ELEM(NULL, ntree, node))
+ if (ELEM(NULL, ntree, node))
return;
- for(sock=node->inputs.first; sock; sock=sock->next) {
+ for (sock=node->inputs.first; sock; sock=sock->next) {
BLI_snprintf(name, sizeof(name), "%s:", sock->name);
split = uiLayoutSplit(layout, 0.35f, 0);
@@ -187,7 +187,7 @@ static int node_properties(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= node_has_buttons_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -202,13 +202,13 @@ static int node_properties_poll(bContext *C)
void NODE_OT_properties(wmOperatorType *ot)
{
- ot->name= "Properties";
- ot->description= "Toggles the properties panel display";
- ot->idname= "NODE_OT_properties";
+ ot->name = "Properties";
+ ot->description = "Toggles the properties panel display";
+ ot->idname = "NODE_OT_properties";
- ot->exec= node_properties;
- ot->poll= node_properties_poll;
+ ot->exec = node_properties;
+ ot->poll = node_properties_poll;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index a2775832c1d..23b700e5b64 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -49,6 +49,8 @@
#include "BLI_threads.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_main.h"
@@ -88,7 +90,7 @@ void ED_node_tree_update(SpaceNode *snode, Scene *scene)
{
snode_set_context(snode, scene);
- if(snode->nodetree && snode->nodetree->id.us==0)
+ if (snode->nodetree && snode->nodetree->id.us==0)
snode->nodetree->id.us= 1;
}
@@ -99,28 +101,28 @@ void ED_node_changed_update(ID *id, bNode *node)
node_tree_from_ID(id, &nodetree, &edittree, &treetype);
- if(treetype==NTREE_SHADER) {
+ if (treetype==NTREE_SHADER) {
DAG_id_tag_update(id, 0);
- if(GS(id->name) == ID_MA)
+ if (GS(id->name) == ID_MA)
WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, id);
- else if(GS(id->name) == ID_LA)
+ else if (GS(id->name) == ID_LA)
WM_main_add_notifier(NC_LAMP|ND_LIGHTING_DRAW, id);
- else if(GS(id->name) == ID_WO)
+ else if (GS(id->name) == ID_WO)
WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, id);
}
- else if(treetype==NTREE_COMPOSIT) {
- if(node)
+ else if (treetype==NTREE_COMPOSIT) {
+ if (node)
nodeUpdate(edittree, node);
/* don't use NodeTagIDChanged, it gives far too many recomposites for image, scene layers, ... */
node= node_tree_get_editgroup(nodetree);
- if(node)
+ if (node)
nodeUpdateID(nodetree, node->id);
WM_main_add_notifier(NC_SCENE|ND_NODES, id);
}
- else if(treetype==NTREE_TEXTURE) {
+ else if (treetype==NTREE_TEXTURE) {
DAG_id_tag_update(id, 0);
WM_main_add_notifier(NC_TEXTURE|ND_NODES, id);
}
@@ -130,12 +132,12 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
{
bNode *node;
- if(ntree == lookup)
+ 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))
+ 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;
@@ -161,15 +163,15 @@ void ED_node_generic_update(Main *bmain, bNodeTree *ntree, bNode *node)
/* look through all datablocks, to support groups */
tti->foreach_nodetree(bmain, &cd, node_generic_update_cb);
- if(ntree->type == NTREE_TEXTURE)
+ if (ntree->type == NTREE_TEXTURE)
ntreeTexCheckCyclics(ntree);
}
static void do_node_internal_buttons(bContext *C, void *node_v, int event)
{
- if(event==B_NODE_EXEC) {
+ if (event==B_NODE_EXEC) {
SpaceNode *snode= CTX_wm_space_node(C);
- if(snode && snode->id)
+ if (snode && snode->id)
ED_node_changed_update(snode->id, node_v);
}
}
@@ -228,41 +230,41 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
dy-= NODE_DY;
/* little bit space in top */
- if(node->outputs.first)
+ if (node->outputs.first)
dy-= NODE_DYS/2;
/* output sockets */
- for(nsock= node->outputs.first; nsock; nsock= nsock->next) {
- if(!nodeSocketIsHidden(nsock)) {
+ for (nsock= node->outputs.first; nsock; nsock= nsock->next) {
+ if (!nodeSocketIsHidden(nsock)) {
nsock->locx= locx + node->width;
nsock->locy= dy - NODE_DYS;
dy-= NODE_DY;
}
}
- node->prvr.xmin= locx + NODE_DYS;
- node->prvr.xmax= locx + node->width- NODE_DYS;
+ node->prvr.xmin = locx + NODE_DYS;
+ node->prvr.xmax = locx + node->width- NODE_DYS;
/* preview rect? */
- if(node->flag & NODE_PREVIEW) {
+ if (node->flag & NODE_PREVIEW) {
/* only recalculate size when there's a preview actually, otherwise we use stored result */
BLI_lock_thread(LOCK_PREVIEW);
- if(node->preview && node->preview->rect) {
+ if (node->preview && node->preview->rect) {
float aspect= 1.0f;
- if(node->preview && node->preview->xsize && node->preview->ysize)
+ if (node->preview && node->preview->xsize && node->preview->ysize)
aspect= (float)node->preview->ysize/(float)node->preview->xsize;
dy-= NODE_DYS/2;
- node->prvr.ymax= dy;
+ node->prvr.ymax = dy;
- if(aspect <= 1.0f)
- node->prvr.ymin= dy - aspect*(node->width-NODE_DY);
+ if (aspect <= 1.0f)
+ node->prvr.ymin = dy - aspect*(node->width-NODE_DY);
else {
float dx= (node->width - NODE_DYS) - (node->width- NODE_DYS)/aspect; /* width correction of image */
- node->prvr.ymin= dy - (node->width-NODE_DY);
+ node->prvr.ymin = dy - (node->width-NODE_DY);
node->prvr.xmin+= 0.5f*dx;
node->prvr.xmax-= 0.5f*dx;
@@ -271,16 +273,16 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
dy= node->prvr.ymin - NODE_DYS/2;
/* make sure that maximums are bigger or equal to minimums */
- if(node->prvr.xmax < node->prvr.xmin) SWAP(float, node->prvr.xmax, node->prvr.xmin);
- if(node->prvr.ymax < node->prvr.ymin) SWAP(float, node->prvr.ymax, node->prvr.ymin);
+ if (node->prvr.xmax < node->prvr.xmin) SWAP(float, node->prvr.xmax, node->prvr.xmin);
+ if (node->prvr.ymax < node->prvr.ymin) SWAP(float, node->prvr.ymax, node->prvr.ymin);
}
else {
float oldh= node->prvr.ymax - node->prvr.ymin;
- if(oldh==0.0f)
+ if (oldh==0.0f)
oldh= 0.6f*node->width-NODE_DY;
dy-= NODE_DYS/2;
- node->prvr.ymax= dy;
- node->prvr.ymin= dy - oldh;
+ node->prvr.ymax = dy;
+ node->prvr.ymin = dy - oldh;
dy= node->prvr.ymin - NODE_DYS/2;
}
@@ -288,14 +290,14 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
}
/* buttons rect? */
- if((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
+ if ((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
dy-= NODE_DYS/2;
/* set this for uifunc() that don't use layout engine yet */
- node->butr.xmin= 0;
- node->butr.xmax= node->width - 2*NODE_DYS;
- node->butr.ymin= 0;
- node->butr.ymax= 0;
+ node->butr.xmin = 0;
+ node->butr.xmax = node->width - 2*NODE_DYS;
+ node->butr.ymin = 0;
+ node->butr.ymax = 0;
RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
@@ -311,8 +313,8 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
}
/* input sockets */
- for(nsock= node->inputs.first; nsock; nsock= nsock->next) {
- if(!nodeSocketIsHidden(nsock)) {
+ for (nsock= node->inputs.first; nsock; nsock= nsock->next) {
+ if (!nodeSocketIsHidden(nsock)) {
nsock->locx= locx;
nsock->locy= dy - NODE_DYS;
dy-= NODE_DY;
@@ -320,13 +322,13 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
}
/* little bit space in end */
- if(node->inputs.first || (node->flag & (NODE_OPTIONS|NODE_PREVIEW))==0 )
+ if (node->inputs.first || (node->flag & (NODE_OPTIONS|NODE_PREVIEW))==0 )
dy-= NODE_DYS/2;
- node->totr.xmin= locx;
- node->totr.xmax= locx + node->width;
- node->totr.ymax= locy;
- node->totr.ymin= MIN2(dy, locy-2*NODE_DY);
+ node->totr.xmin = locx;
+ node->totr.xmax = locx + node->width;
+ node->totr.ymax = locy;
+ node->totr.ymin = MIN2(dy, locy-2*NODE_DY);
/* Set the block bounds to clip mouse events from underlying nodes.
* Add a margin for sockets on each side.
@@ -350,28 +352,28 @@ static void node_update_hidden(bNode *node)
nodeSpaceCoords(node, &locx, &locy);
/* calculate minimal radius */
- for(nsock= node->inputs.first; nsock; nsock= nsock->next)
- if(!nodeSocketIsHidden(nsock))
+ for (nsock= node->inputs.first; nsock; nsock= nsock->next)
+ if (!nodeSocketIsHidden(nsock))
totin++;
- for(nsock= node->outputs.first; nsock; nsock= nsock->next)
- if(!nodeSocketIsHidden(nsock))
+ for (nsock= node->outputs.first; nsock; nsock= nsock->next)
+ if (!nodeSocketIsHidden(nsock))
totout++;
tot= MAX2(totin, totout);
- if(tot>4) {
+ if (tot>4) {
hiddenrad += 5.0f*(float)(tot-4);
}
- node->totr.xmin= locx;
- node->totr.xmax= locx + 3*hiddenrad + node->miniwidth;
- node->totr.ymax= locy + (hiddenrad - 0.5f*NODE_DY);
- node->totr.ymin= node->totr.ymax - 2*hiddenrad;
+ node->totr.xmin = locx;
+ node->totr.xmax = locx + 3*hiddenrad + node->miniwidth;
+ node->totr.ymax = locy + (hiddenrad - 0.5f*NODE_DY);
+ node->totr.ymin = node->totr.ymax - 2*hiddenrad;
/* output sockets */
rad=drad= (float)M_PI/(1.0f + (float)totout);
- for(nsock= node->outputs.first; nsock; nsock= nsock->next) {
- if(!nodeSocketIsHidden(nsock)) {
+ for (nsock= node->outputs.first; nsock; nsock= nsock->next) {
+ if (!nodeSocketIsHidden(nsock)) {
nsock->locx= node->totr.xmax - hiddenrad + (float)sin(rad)*hiddenrad;
nsock->locy= node->totr.ymin + hiddenrad + (float)cos(rad)*hiddenrad;
rad+= drad;
@@ -381,8 +383,8 @@ static void node_update_hidden(bNode *node)
/* input sockets */
rad=drad= - (float)M_PI/(1.0f + (float)totin);
- for(nsock= node->inputs.first; nsock; nsock= nsock->next) {
- if(!nodeSocketIsHidden(nsock)) {
+ for (nsock= node->inputs.first; nsock; nsock= nsock->next) {
+ if (!nodeSocketIsHidden(nsock)) {
nsock->locx= node->totr.xmin + hiddenrad + (float)sin(rad)*hiddenrad;
nsock->locy= node->totr.ymin + hiddenrad + (float)cos(rad)*hiddenrad;
rad+= drad;
@@ -401,7 +403,7 @@ static void node_update_hidden(bNode *node)
void node_update_default(const bContext *C, bNodeTree *ntree, bNode *node)
{
- if(node->flag & NODE_HIDDEN)
+ if (node->flag & NODE_HIDDEN)
node_update_hidden(node);
else
node_update_basis(C, ntree, node);
@@ -409,19 +411,19 @@ void node_update_default(const bContext *C, bNodeTree *ntree, bNode *node)
static int node_get_colorid(bNode *node)
{
- if(node->typeinfo->nclass==NODE_CLASS_INPUT)
+ if (node->typeinfo->nclass==NODE_CLASS_INPUT)
return TH_NODE_IN_OUT;
- if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
- if(node->flag & NODE_DO_OUTPUT)
+ if (node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+ if (node->flag & NODE_DO_OUTPUT)
return TH_NODE_IN_OUT;
else
return TH_NODE;
}
- if(node->typeinfo->nclass==NODE_CLASS_CONVERTOR)
+ if (node->typeinfo->nclass==NODE_CLASS_CONVERTOR)
return TH_NODE_CONVERTOR;
- if(ELEM3(node->typeinfo->nclass, NODE_CLASS_OP_COLOR, NODE_CLASS_OP_VECTOR, NODE_CLASS_OP_FILTER))
+ if (ELEM3(node->typeinfo->nclass, NODE_CLASS_OP_COLOR, NODE_CLASS_OP_VECTOR, NODE_CLASS_OP_FILTER))
return TH_NODE_OPERATOR;
- if(node->typeinfo->nclass==NODE_CLASS_GROUP)
+ if (node->typeinfo->nclass==NODE_CLASS_GROUP)
return TH_NODE_GROUP;
return TH_NODE;
}
@@ -434,7 +436,7 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
ListBase links;
bNodeLink *link;
- if(node->typeinfo->internal_connect == NULL)
+ if (node->typeinfo->internal_connect == NULL)
return;
/* Get default muting links. */
@@ -443,7 +445,7 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
- for(link = links.first; link; link = link->next)
+ for (link = links.first; link; link = link->next)
node_draw_link_bezier(v2d, snode, link, TH_REDALERT, 0, TH_WIRE, 0, TH_WIRE);
glDisable(GL_BLEND);
@@ -474,7 +476,7 @@ static void node_circle_draw(float x, float y, float size, char *col, int highli
glColor3ub(col[0], col[1], col[2]);
glBegin(GL_POLYGON);
- for(a=0; a<16; a++)
+ for (a=0; a<16; a++)
glVertex2f(x+size*si[a], y+size*co[a]);
glEnd();
@@ -488,7 +490,7 @@ static void node_circle_draw(float x, float y, float size, char *col, int highli
glEnable(GL_BLEND);
glEnable( GL_LINE_SMOOTH );
glBegin(GL_LINE_LOOP);
- for(a=0; a<16; a++)
+ for (a=0; a<16; a++)
glVertex2f(x+size*si[a], y+size*co[a]);
glEnd();
glDisable( GL_LINE_SMOOTH );
@@ -517,25 +519,25 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
glRectf(prv->xmin, prv->ymin, prv->xmax, prv->ymax);
glColor3ub(160, 160, 160);
- for(y=prv->ymin; y<prv->ymax; y+=tile*2) {
- for(x=prv->xmin; x<prv->xmax; x+=tile*2) {
+ for (y=prv->ymin; y<prv->ymax; y+=tile*2) {
+ for (x=prv->xmin; x<prv->xmax; x+=tile*2) {
float tilex= tile, tiley= tile;
- if(x+tile > prv->xmax)
+ if (x+tile > prv->xmax)
tilex= prv->xmax-x;
- if(y+tile > prv->ymax)
+ if (y+tile > prv->ymax)
tiley= prv->ymax-y;
glRectf(x, y, x + tilex, y + tiley);
}
}
- for(y=prv->ymin+tile; y<prv->ymax; y+=tile*2) {
- for(x=prv->xmin+tile; x<prv->xmax; x+=tile*2) {
+ for (y=prv->ymin+tile; y<prv->ymax; y+=tile*2) {
+ for (x=prv->xmin+tile; x<prv->xmax; x+=tile*2) {
float tilex= tile, tiley= tile;
- if(x+tile > prv->xmax)
+ if (x+tile > prv->xmax)
tilex= prv->xmax-x;
- if(y+tile > prv->ymax)
+ if (y+tile > prv->ymax)
tiley= prv->ymax-y;
glRectf(x, y, x + tilex, y + tiley);
@@ -582,7 +584,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
View2D *v2d = &ar->v2d;
/* hurmf... another candidate for callback, have to see how this works first */
- if(node->id && node->block && snode->treetype==NTREE_SHADER)
+ if (node->id && node->block && snode->treetype==NTREE_SHADER)
nodeShaderSynchronizeID(node, 0);
/* skip if out of view */
@@ -598,12 +600,12 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
ui_dropshadow(rct, BASIS_RAD, snode->aspect, node->flag & SELECT);
/* header */
- if(color_id==TH_NODE)
+ if (color_id==TH_NODE)
UI_ThemeColorShade(color_id, -20);
else
UI_ThemeColor(color_id);
- if(node->flag & NODE_MUTED)
+ if (node->flag & NODE_MUTED)
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
@@ -613,7 +615,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
iconofs= rct->xmax - 7.0f;
/* preview */
- if(node->typeinfo->flag & NODE_PREVIEW) {
+ if (node->typeinfo->flag & NODE_PREVIEW) {
uiBut *but;
iconofs-=iconbutw;
uiBlockSetEmboss(node->block, UI_EMBOSSN);
@@ -629,7 +631,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
uiBlockSetEmboss(node->block, UI_EMBOSS);
}
/* group edit */
- if(node->type == NODE_GROUP) {
+ if (node->type == NODE_GROUP) {
uiBut *but;
iconofs-=iconbutw;
uiBlockSetEmboss(node->block, UI_EMBOSSN);
@@ -640,7 +642,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
}
/* title */
- if(node->flag & SELECT)
+ if (node->flag & SELECT)
UI_ThemeColor(TH_TEXT_HI);
else
UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10);
@@ -662,7 +664,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* this isn't doing anything for the label, so commenting out */
#if 0
- if(node->flag & SELECT)
+ if (node->flag & SELECT)
UI_ThemeColor(TH_TEXT_HI);
else
UI_ThemeColor(TH_TEXT);
@@ -671,7 +673,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
//if(node->flag & NODE_MUTED)
- // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - dont print into self!
+ // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - don't print into self!
uiDefBut(node->block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(rct->ymax-NODE_DY),
(int)(iconofs - rct->xmin-18.0f), NODE_DY, NULL, 0, 0, 0, 0, "");
@@ -687,11 +689,11 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
node_scaling_widget(TH_NODE, snode->aspect, rct->xmax-BASIS_RAD*snode->aspect, rct->ymin, rct->xmax, rct->ymin+BASIS_RAD*snode->aspect);
/* outline active and selected emphasis */
- if( node->flag & (NODE_ACTIVE|SELECT) ) {
+ if ( node->flag & (NODE_ACTIVE|SELECT) ) {
glEnable(GL_BLEND);
glEnable( GL_LINE_SMOOTH );
/* using different shades of TH_TEXT_HI for the empasis, like triangle */
- if( node->flag & NODE_ACTIVE )
+ if ( node->flag & NODE_ACTIVE )
UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
else
UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120);
@@ -703,51 +705,53 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
}
/* disable lines */
- if(node->flag & NODE_MUTED)
+ if (node->flag & NODE_MUTED)
node_draw_mute_line(v2d, snode, node);
/* socket inputs, buttons */
- for(sock= node->inputs.first; sock; sock= sock->next) {
+ for (sock= node->inputs.first; sock; sock= sock->next) {
bNodeSocketType *stype= ntreeGetSocketType(sock->type);
- if(nodeSocketIsHidden(sock))
+ if (nodeSocketIsHidden(sock))
continue;
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE);
if (stype->buttonfunc)
- stype->buttonfunc(C, node->block, ntree, node, sock, sock->name, sock->locx+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY);
+ stype->buttonfunc(C, node->block, ntree, node, sock, IFACE_(sock->name), sock->locx+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY);
}
/* socket outputs */
- for(sock= node->outputs.first; sock; sock= sock->next) {
+ for (sock= node->outputs.first; sock; sock= sock->next) {
PointerRNA sockptr;
- float slen;
- int ofs;
RNA_pointer_create((ID*)ntree, &RNA_NodeSocket, sock, &sockptr);
- if(nodeSocketIsHidden(sock))
+ if (nodeSocketIsHidden(sock))
continue;
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE);
- ofs= 0;
- UI_ThemeColor(TH_TEXT);
- slen= snode->aspect*UI_GetStringWidth(sock->name);
- while(slen > node->width) {
- ofs++;
- slen= snode->aspect*UI_GetStringWidth(sock->name+ofs);
+ {
+ const char *name = IFACE_(sock->name);
+ float slen;
+ int ofs = 0;
+ UI_ThemeColor(TH_TEXT);
+ slen= snode->aspect*UI_GetStringWidth(name);
+ while (slen > node->width) {
+ ofs++;
+ slen= snode->aspect*UI_GetStringWidth(name+ofs);
+ }
+ uiDefBut(node->block, LABEL, 0, name+ofs, (short)(sock->locx-15.0f-slen), (short)(sock->locy-9.0f),
+ (short)(node->width-NODE_DY), NODE_DY, NULL, 0, 0, 0, 0, "");
}
- uiDefBut(node->block, LABEL, 0, sock->name+ofs, (short)(sock->locx-15.0f-slen), (short)(sock->locy-9.0f),
- (short)(node->width-NODE_DY), NODE_DY, NULL, 0, 0, 0, 0, "");
}
/* preview */
- if(node->flag & NODE_PREVIEW) {
+ if (node->flag & NODE_PREVIEW) {
BLI_lock_thread(LOCK_PREVIEW);
- if(node->preview && node->preview->rect && !BLI_rctf_is_empty(&node->prvr))
+ if (node->preview && node->preview->rect && !BLI_rctf_is_empty(&node->prvr))
node_draw_preview(node->preview, &node->prvr);
BLI_unlock_thread(LOCK_PREVIEW);
}
@@ -775,16 +779,16 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
/* body */
UI_ThemeColor(color_id);
- if(node->flag & NODE_MUTED)
+ if (node->flag & NODE_MUTED)
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
/* outline active and selected emphasis */
- if( node->flag & (NODE_ACTIVE|SELECT) ) {
+ if ( node->flag & (NODE_ACTIVE|SELECT) ) {
glEnable(GL_BLEND);
glEnable( GL_LINE_SMOOTH );
/* using different shades of TH_TEXT_HI for the empasis, like triangle */
- if( node->flag & NODE_ACTIVE )
+ if ( node->flag & NODE_ACTIVE )
UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
else
UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120);
@@ -794,7 +798,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
}
/* title */
- if(node->flag & SELECT)
+ if (node->flag & SELECT)
UI_ThemeColor(TH_TEXT_HI);
else
UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10);
@@ -815,19 +819,19 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
}
/* disable lines */
- if(node->flag & NODE_MUTED)
+ if (node->flag & NODE_MUTED)
node_draw_mute_line(&ar->v2d, snode, node);
- if(node->flag & SELECT)
+ if (node->flag & SELECT)
UI_ThemeColor(TH_TEXT_HI);
else
UI_ThemeColor(TH_TEXT);
- if(node->miniwidth>0.0f) {
+ if (node->miniwidth>0.0f) {
BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
//if(node->flag & NODE_MUTED)
- // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - dont print into self!
+ // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - don't print into self!
uiDefBut(node->block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(centy-10),
(int)(rct->xmax - rct->xmin-18.0f -12.0f), NODE_DY, NULL, 0, 0, 0, 0, "");
@@ -845,13 +849,13 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
fdrawline(rct->xmax-dx-3.0f*snode->aspect, centy-4.0f, rct->xmax-dx-3.0f*snode->aspect, centy+4.0f);
/* sockets */
- for(sock= node->inputs.first; sock; sock= sock->next) {
- if(!nodeSocketIsHidden(sock))
+ for (sock= node->inputs.first; sock; sock= sock->next) {
+ if (!nodeSocketIsHidden(sock))
node_socket_circle_draw(snode->nodetree, sock, socket_size);
}
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(!nodeSocketIsHidden(sock))
+ for (sock= node->outputs.first; sock; sock= sock->next) {
+ if (!nodeSocketIsHidden(sock))
node_socket_circle_draw(snode->nodetree, sock, socket_size);
}
@@ -862,7 +866,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
void node_draw_default(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
{
- if(node->flag & NODE_HIDDEN)
+ if (node->flag & NODE_HIDDEN)
node_draw_hidden(C, ar, snode, node);
else
node_draw_basis(C, ar, snode, ntree, node);
@@ -878,7 +882,7 @@ void node_update_nodetree(const bContext *C, bNodeTree *ntree, float offsetx, fl
{
bNode *node;
- for(node= ntree->nodes.first; node; node= node->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
/* XXX little hack */
node->locx += offsetx;
node->locy += offsety;
@@ -902,18 +906,18 @@ void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeT
bNodeLink *link;
int a;
- if(ntree==NULL) return; /* groups... */
+ if (ntree==NULL) return; /* groups... */
/* node lines */
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
- for(link= ntree->links.first; link; link= link->next)
+ for (link= ntree->links.first; link; link= link->next)
node_draw_link(&ar->v2d, snode, link);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
/* draw nodes, last nodes in front */
- for(a=0, node= ntree->nodes.first; node; node=node->next, a++) {
+ for (a=0, node= ntree->nodes.first; node; node=node->next, a++) {
node->nr= a; /* index of node in list, used for exec event code */
node_draw(C, ar, snode, ntree, node);
}
@@ -949,7 +953,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
/* nodes */
snode_set_context(snode, CTX_data_scene(C));
- if(snode->nodetree) {
+ if (snode->nodetree) {
bNode *node;
node_uiblocks_init(C, snode->nodetree);
@@ -957,8 +961,8 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
/* uiBlocks must be initialized in drawing order for correct event clipping.
* Node group internal blocks added after the main group block.
*/
- for(node= snode->nodetree->nodes.first; node; node= node->next) {
- if(node->flag & NODE_GROUP_EDIT)
+ for (node= snode->nodetree->nodes.first; node; node= node->next) {
+ if (node->flag & NODE_GROUP_EDIT)
node_uiblocks_init(C, (bNodeTree *)node->id);
}
@@ -967,8 +971,8 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
#if 0
/* active group */
- for(node= snode->nodetree->nodes.first; node; node= node->next) {
- if(node->flag & NODE_GROUP_EDIT)
+ for (node= snode->nodetree->nodes.first; node; node= node->next) {
+ if (node->flag & NODE_GROUP_EDIT)
node_draw_group(C, ar, snode, snode->nodetree, node);
}
#endif
@@ -977,7 +981,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
/* temporary links */
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
- for(nldrag= snode->linkdrag.first; nldrag; nldrag= nldrag->next)
+ for (nldrag= snode->linkdrag.first; nldrag; nldrag= nldrag->next)
node_draw_link(&ar->v2d, snode, nldrag->link);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 8587133976d..d95947142f9 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -132,7 +132,7 @@ static void compo_freejob(void *cjv)
{
CompoJob *cj= cjv;
- if(cj->localtree) {
+ if (cj->localtree) {
ntreeLocalMerge(cj->localtree, cj->ntree);
}
MEM_freeN(cj);
@@ -169,7 +169,7 @@ static void compo_startjob(void *cjv, short *stop, short *do_update, float *prog
CompoJob *cj= cjv;
bNodeTree *ntree= cj->localtree;
- if(cj->scene->use_nodes==0)
+ if (cj->scene->use_nodes==0)
return;
cj->stop= stop;
@@ -220,9 +220,9 @@ void snode_composite_job(const bContext *C, ScrArea *sa)
/* operator poll callback */
static int composite_node_active(bContext *C)
{
- if( ED_operator_node_active(C)) {
+ if ( ED_operator_node_active(C)) {
SpaceNode *snode= CTX_wm_space_node(C);
- if(snode->treetype==NTREE_COMPOSIT)
+ if (snode->treetype==NTREE_COMPOSIT)
return 1;
}
return 0;
@@ -234,10 +234,10 @@ static bNode *editnode_get_active(bNodeTree *ntree)
bNode *node;
/* check for edited group */
- for(node= ntree->nodes.first; node; node= node->next)
- if(nodeGroupEditGet(node))
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (nodeGroupEditGet(node))
break;
- if(node)
+ if (node)
return nodeGetActive((bNodeTree *)node->id);
else
return nodeGetActive(ntree);
@@ -252,11 +252,11 @@ void snode_notify(bContext *C, SpaceNode *snode)
{
WM_event_add_notifier(C, NC_NODE|NA_EDITED, NULL);
- if(snode->treetype==NTREE_SHADER)
+ if (snode->treetype==NTREE_SHADER)
WM_event_add_notifier(C, NC_MATERIAL|ND_NODES, snode->id);
- else if(snode->treetype==NTREE_COMPOSIT)
+ else if (snode->treetype==NTREE_COMPOSIT)
WM_event_add_notifier(C, NC_SCENE|ND_NODES, snode->id);
- else if(snode->treetype==NTREE_TEXTURE)
+ else if (snode->treetype==NTREE_TEXTURE)
WM_event_add_notifier(C, NC_TEXTURE|ND_NODES, snode->id);
}
@@ -265,8 +265,8 @@ bNode *node_tree_get_editgroup(bNodeTree *nodetree)
bNode *gnode;
/* get the groupnode */
- for(gnode= nodetree->nodes.first; gnode; gnode= gnode->next)
- if(nodeGroupEditGet(gnode))
+ for (gnode= nodetree->nodes.first; gnode; gnode= gnode->next)
+ if (nodeGroupEditGet(gnode))
break;
return gnode;
}
@@ -289,7 +289,7 @@ void ED_node_shader_default(Scene *scene, ID *id)
Material *ma= (Material*)id;
ma->nodetree = ntree;
- if(scene_use_new_shading_nodes(scene)) {
+ if (scene_use_new_shading_nodes(scene)) {
output_type = SH_NODE_OUTPUT_MATERIAL;
shader_type = SH_NODE_BSDF_DIFFUSE;
}
@@ -321,7 +321,7 @@ void ED_node_shader_default(Scene *scene, ID *id)
shader_type = SH_NODE_EMISSION;
copy_v3_v3(color, &la->r);
- if(la->type == LA_LOCAL || la->type == LA_SPOT || la->type == LA_AREA)
+ if (la->type == LA_LOCAL || la->type == LA_SPOT || la->type == LA_AREA)
strength= 100.0f;
else
strength= 1.0f;
@@ -347,11 +347,11 @@ void ED_node_shader_default(Scene *scene, ID *id)
nodeAddLink(ntree, in, fromsock, out, tosock);
/* default values */
- if(scene_use_new_shading_nodes(scene)) {
+ if (scene_use_new_shading_nodes(scene)) {
sock= in->inputs.first;
copy_v3_v3(((bNodeSocketValueRGBA*)sock->default_value)->value, color);
- if(strength != 0.0f) {
+ if (strength != 0.0f) {
sock= in->inputs.last;
((bNodeSocketValueFloat*)sock->default_value)->value= strength;
}
@@ -369,7 +369,7 @@ void ED_node_composit_default(Scene *sce)
bNodeTemplate ntemp;
/* but lets check it anyway */
- if(sce->nodetree) {
+ if (sce->nodetree) {
if (G.f & G_DEBUG)
printf("error in composite initialize\n");
return;
@@ -409,7 +409,7 @@ void ED_node_texture_default(Tex *tx)
bNodeTemplate ntemp;
/* but lets check it anyway */
- if(tx->nodetree) {
+ if (tx->nodetree) {
if (G.f & G_DEBUG)
printf("error in texture initialize\n");
return;
@@ -440,43 +440,43 @@ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *tre
bNode *node= NULL;
short idtype= GS(id->name);
- if(idtype == ID_NT) {
+ if (idtype == ID_NT) {
*ntree= (bNodeTree*)id;
- if(treetype) *treetype= (*ntree)->type;
+ if (treetype) *treetype= (*ntree)->type;
}
- else if(idtype == ID_MA) {
+ else if (idtype == ID_MA) {
*ntree= ((Material*)id)->nodetree;
- if(treetype) *treetype= NTREE_SHADER;
+ if (treetype) *treetype= NTREE_SHADER;
}
- else if(idtype == ID_LA) {
+ else if (idtype == ID_LA) {
*ntree= ((Lamp*)id)->nodetree;
- if(treetype) *treetype= NTREE_SHADER;
+ if (treetype) *treetype= NTREE_SHADER;
}
- else if(idtype == ID_WO) {
+ else if (idtype == ID_WO) {
*ntree= ((World*)id)->nodetree;
- if(treetype) *treetype= NTREE_SHADER;
+ if (treetype) *treetype= NTREE_SHADER;
}
- else if(idtype == ID_SCE) {
+ else if (idtype == ID_SCE) {
*ntree= ((Scene*)id)->nodetree;
- if(treetype) *treetype= NTREE_COMPOSIT;
+ if (treetype) *treetype= NTREE_COMPOSIT;
}
- else if(idtype == ID_TE) {
+ else if (idtype == ID_TE) {
*ntree= ((Tex*)id)->nodetree;
- if(treetype) *treetype= NTREE_TEXTURE;
+ if (treetype) *treetype= NTREE_TEXTURE;
}
else {
- if(treetype) *treetype= 0;
+ if (treetype) *treetype= 0;
return;
}
/* find editable group */
- if(edittree) {
- if(*ntree)
- for(node= (*ntree)->nodes.first; node; node= node->next)
- if(nodeGroupEditGet(node))
+ if (edittree) {
+ if (*ntree)
+ for (node= (*ntree)->nodes.first; node; node= node->next)
+ if (nodeGroupEditGet(node))
break;
- if(node && node->id)
+ if (node && node->id)
*edittree= (bNodeTree *)node->id;
else
*edittree= *ntree;
@@ -485,7 +485,7 @@ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *tre
else {
*ntree= NULL;
*edittree= NULL;
- if(treetype) *treetype= 0;
+ if (treetype) *treetype= 0;
}
}
@@ -496,17 +496,17 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
snode->id= snode->from= NULL;
- if(snode->treetype==NTREE_SHADER) {
+ if (snode->treetype==NTREE_SHADER) {
/* need active object, or we allow pinning... */
- if(snode->shaderfrom == SNODE_SHADER_OBJECT) {
- if(ob) {
- if(ob->type == OB_LAMP) {
+ if (snode->shaderfrom == SNODE_SHADER_OBJECT) {
+ if (ob) {
+ if (ob->type == OB_LAMP) {
snode->from= &ob->id;
snode->id= ob->data;
}
else {
Material *ma= give_current_material(ob, ob->actcol);
- if(ma) {
+ if (ma) {
snode->from= &ob->id;
snode->id= &ma->id;
}
@@ -514,26 +514,26 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
}
}
else { /* SNODE_SHADER_WORLD */
- if(scene->world) {
+ if (scene->world) {
snode->from= NULL;
snode->id= &scene->world->id;
}
}
}
- else if(snode->treetype==NTREE_COMPOSIT) {
+ else if (snode->treetype==NTREE_COMPOSIT) {
snode->id= &scene->id;
/* update output sockets based on available layers */
ntreeCompositForceHidden(scene->nodetree, scene);
}
- else if(snode->treetype==NTREE_TEXTURE) {
+ else if (snode->treetype==NTREE_TEXTURE) {
Tex *tx= NULL;
- if(snode->texfrom==SNODE_TEX_OBJECT) {
- if(ob) {
+ if (snode->texfrom==SNODE_TEX_OBJECT) {
+ if (ob) {
tx= give_current_object_texture(ob);
- if(ob->type == OB_LAMP)
+ if (ob->type == OB_LAMP)
snode->from= (ID*)ob->data;
else
snode->from= (ID*)give_current_material(ob, ob->actcol);
@@ -542,7 +542,7 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
snode->id= &tx->id;
}
}
- else if(snode->texfrom==SNODE_TEX_WORLD) {
+ else if (snode->texfrom==SNODE_TEX_WORLD) {
tx= give_current_world_texture(scene->world);
snode->from= (ID *)scene->world;
snode->id= &tx->id;
@@ -550,7 +550,7 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
else {
struct Brush *brush= NULL;
- if(ob && (ob->mode & OB_MODE_SCULPT))
+ if (ob && (ob->mode & OB_MODE_SCULPT))
brush= paint_brush(&scene->toolsettings->sculpt->paint);
else
brush= paint_brush(&scene->toolsettings->imapaint.paint);
@@ -581,7 +581,7 @@ static void snode_update(SpaceNode *snode, bNode *node)
/* if inside group, tag entire group */
gnode= node_tree_get_editgroup(snode->nodetree);
- if(gnode)
+ if (gnode)
nodeUpdateID(snode->nodetree, gnode->id);
}
@@ -589,12 +589,12 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
{
bNode *node;
- if(ntree == lookup)
+ 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))
+ 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;
@@ -606,72 +606,72 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
nodeSetActive(ntree, node);
- if(node->type!=NODE_GROUP) {
+ if (node->type!=NODE_GROUP) {
int was_output= (node->flag & NODE_DO_OUTPUT);
/* tree specific activate calls */
- if(ntree->type==NTREE_SHADER) {
+ if (ntree->type==NTREE_SHADER) {
/* when we select a material, active texture is cleared, for buttons */
- if(node->id && ELEM3(GS(node->id->name), ID_MA, ID_LA, ID_WO))
+ if (node->id && ELEM3(GS(node->id->name), ID_MA, ID_LA, ID_WO))
nodeClearActiveID(ntree, ID_TE);
- if(node->type==SH_NODE_OUTPUT) {
+ if (node->type==SH_NODE_OUTPUT) {
bNode *tnode;
- for(tnode= ntree->nodes.first; tnode; tnode= tnode->next)
- if( tnode->type==SH_NODE_OUTPUT)
+ for (tnode= ntree->nodes.first; tnode; tnode= tnode->next)
+ if ( tnode->type==SH_NODE_OUTPUT)
tnode->flag &= ~NODE_DO_OUTPUT;
node->flag |= NODE_DO_OUTPUT;
- if(was_output==0)
+ if (was_output==0)
ED_node_generic_update(bmain, ntree, node);
}
/* if active texture changed, free glsl materials */
- if((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) {
+ if ((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) {
Material *ma;
- for(ma=bmain->mat.first; ma; ma=ma->id.next)
- if(ma->nodetree && ma->use_nodes && has_nodetree(ma->nodetree, ntree))
+ for (ma=bmain->mat.first; ma; ma=ma->id.next)
+ if (ma->nodetree && ma->use_nodes && has_nodetree(ma->nodetree, ntree))
GPU_material_free(ma);
}
WM_main_add_notifier(NC_MATERIAL|ND_NODES, node->id);
}
- else if(ntree->type==NTREE_COMPOSIT) {
+ else if (ntree->type==NTREE_COMPOSIT) {
/* make active viewer, currently only 1 supported... */
- if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+ if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
bNode *tnode;
- for(tnode= ntree->nodes.first; tnode; tnode= tnode->next)
- if( ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+ for (tnode= ntree->nodes.first; tnode; tnode= tnode->next)
+ if ( ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
tnode->flag &= ~NODE_DO_OUTPUT;
node->flag |= NODE_DO_OUTPUT;
- if(was_output==0)
+ if (was_output==0)
ED_node_generic_update(bmain, ntree, node);
/* addnode() doesnt link this yet... */
node->id= (ID *)BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
}
- else if(node->type==CMP_NODE_R_LAYERS) {
+ else if (node->type==CMP_NODE_R_LAYERS) {
Scene *scene;
- for(scene=bmain->scene.first; scene; scene=scene->id.next) {
- if(scene->nodetree && scene->use_nodes && has_nodetree(scene->nodetree, ntree)) {
- if(node->id==NULL || node->id==(ID *)scene) {
+ for (scene=bmain->scene.first; scene; scene=scene->id.next) {
+ if (scene->nodetree && scene->use_nodes && has_nodetree(scene->nodetree, ntree)) {
+ if (node->id==NULL || node->id==(ID *)scene) {
scene->r.actlay= node->custom1;
}
}
}
}
- else if(node->type==CMP_NODE_COMPOSITE) {
+ else if (node->type==CMP_NODE_COMPOSITE) {
if (was_output==0) {
bNode *tnode;
- for(tnode= ntree->nodes.first; tnode; tnode= tnode->next)
- if( tnode->type==CMP_NODE_COMPOSITE)
+ for (tnode= ntree->nodes.first; tnode; tnode= tnode->next)
+ if ( tnode->type==CMP_NODE_COMPOSITE)
tnode->flag &= ~NODE_DO_OUTPUT;
node->flag |= NODE_DO_OUTPUT;
@@ -679,10 +679,10 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
}
}
}
- else if(ntree->type==NTREE_TEXTURE) {
+ else if (ntree->type==NTREE_TEXTURE) {
// XXX
#if 0
- if(node->id)
+ if (node->id)
; // XXX BIF_preview_changed(-1);
// allqueue(REDRAWBUTSSHADING, 1);
// allqueue(REDRAWIPO, 0);
@@ -811,12 +811,12 @@ void snode_make_group_editable(SpaceNode *snode, bNode *gnode)
bNode *node;
/* make sure nothing has group editing on */
- for(node=snode->nodetree->nodes.first; node; node=node->next)
+ for (node=snode->nodetree->nodes.first; node; node=node->next)
nodeGroupEditClear(node);
- if(gnode==NULL) {
+ if (gnode==NULL) {
/* with NULL argument we do a toggle */
- if(snode->edittree==snode->nodetree)
+ if (snode->edittree==snode->nodetree)
gnode= nodeGetActive(snode->nodetree);
}
@@ -824,9 +824,9 @@ void snode_make_group_editable(SpaceNode *snode, bNode *gnode)
snode->edittree = nodeGroupEditSet(gnode, 1);
/* deselect all other nodes, so we can also do grabbing of entire subtree */
- for(node= snode->nodetree->nodes.first; node; node= node->next)
- node->flag &= ~SELECT;
- gnode->flag |= SELECT;
+ for (node= snode->nodetree->nodes.first; node; node= node->next)
+ node_deselect(node);
+ node_select(gnode);
}
else
snode->edittree= snode->nodetree;
@@ -858,7 +858,7 @@ static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
/* XXX callback? */
if (snode->nodetree==snode->edittree) {
gnode = nodeGetActive(snode->edittree);
- if(gnode && gnode->id && GS(gnode->id->name)==ID_NT && gnode->id->lib) {
+ if (gnode && gnode->id && GS(gnode->id->name)==ID_NT && gnode->id->lib) {
uiPupMenuOkee(C, op->type->idname, "Make group local?");
return OPERATOR_CANCELLED;
}
@@ -1138,18 +1138,18 @@ static int node_group_ungroup_exec(bContext *C, wmOperator *op)
/* are we inside of a group? */
gnode= node_tree_get_editgroup(snode->nodetree);
- if(gnode)
+ if (gnode)
snode_make_group_editable(snode, NULL);
gnode= nodeGetActive(snode->edittree);
- if(gnode==NULL)
+ if (gnode==NULL)
return OPERATOR_CANCELLED;
- if(gnode->type!=NODE_GROUP) {
+ if (gnode->type!=NODE_GROUP) {
BKE_report(op->reports, RPT_WARNING, "Not a group");
return OPERATOR_CANCELLED;
}
- else if(!node_group_ungroup(snode->edittree, gnode)) {
+ else if (!node_group_ungroup(snode->edittree, gnode)) {
BKE_report(op->reports, RPT_WARNING, "Can't ungroup");
return OPERATOR_CANCELLED;
}
@@ -1182,8 +1182,8 @@ static bNode *visible_node(SpaceNode *snode, rctf *rct)
{
bNode *node;
- for(node=snode->edittree->nodes.last; node; node=node->prev) {
- if(BLI_isect_rctf(&node->totr, rct, NULL))
+ for (node=snode->edittree->nodes.last; node; node=node->prev) {
+ if (BLI_isect_rctf(&node->totr, rct, NULL))
break;
}
return node;
@@ -1245,7 +1245,7 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
- if(ibuf == NULL) {
+ if (ibuf == NULL) {
BKE_image_release_ibuf(ima, lock);
return OPERATOR_CANCELLED;
}
@@ -1279,18 +1279,18 @@ static int snode_bg_viewmove_cancel(bContext *UNUSED(C), wmOperator *op)
void NODE_OT_backimage_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Background Image Move";
+ ot->name = "Background Image Move";
ot->description = "Move Node backdrop";
- ot->idname= "NODE_OT_backimage_move";
+ ot->idname = "NODE_OT_backimage_move";
/* api callbacks */
- ot->invoke= snode_bg_viewmove_invoke;
- ot->modal= snode_bg_viewmove_modal;
- ot->poll= composite_node_active;
- ot->cancel= snode_bg_viewmove_cancel;
+ ot->invoke = snode_bg_viewmove_invoke;
+ ot->modal = snode_bg_viewmove_modal;
+ ot->poll = composite_node_active;
+ ot->cancel = snode_bg_viewmove_cancel;
/* flags */
- ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
}
static int backimage_zoom(bContext *C, wmOperator *op)
@@ -1310,15 +1310,15 @@ void NODE_OT_backimage_zoom(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Background Image Zoom";
- ot->idname= "NODE_OT_backimage_zoom";
+ ot->name = "Background Image Zoom";
+ ot->idname = "NODE_OT_backimage_zoom";
/* api callbacks */
- ot->exec= backimage_zoom;
- ot->poll= composite_node_active;
+ ot->exec = backimage_zoom;
+ ot->poll = composite_node_active;
/* flags */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
/* internal */
RNA_def_float(ot->srna, "factor", 1.2f, 0.0f, 10.0f, "Factor", "", 0.0f, 10.0f);
@@ -1362,11 +1362,11 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
- if(!ibuf)
+ if (!ibuf)
return;
- if(!ibuf->rect) {
- if(info->color_manage)
+ if (!ibuf->rect) {
+ if (info->color_manage)
ibuf->profile = IB_PROFILE_LINEAR_RGB;
else
ibuf->profile = IB_PROFILE_NONE;
@@ -1379,7 +1379,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f*ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f*ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
- if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
+ if (fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
float *fp;
char *cp;
int x= (int)(fx*ibuf->x), y= (int)(fy*ibuf->y);
@@ -1392,7 +1392,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
info->draw= 1;
info->channels= ibuf->channels;
- if(ibuf->rect) {
+ if (ibuf->rect) {
cp= (char *)(ibuf->rect + y*ibuf->x + x);
info->col[0]= cp[0];
@@ -1405,7 +1405,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
info->colf[2]= (float)cp[2]/255.0f;
info->colf[3]= (float)cp[3]/255.0f;
}
- if(ibuf->rect_float) {
+ if (ibuf->rect_float) {
fp= (ibuf->rect_float + (ibuf->channels)*(y*ibuf->x + x));
info->colf[0]= fp[0];
@@ -1437,7 +1437,7 @@ static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
ARegion *ar= CTX_wm_region(C);
ImageSampleInfo *info;
- if(snode->treetype!=NTREE_COMPOSIT || !(snode->flag & SNODE_BACKDRAW))
+ if (snode->treetype!=NTREE_COMPOSIT || !(snode->flag & SNODE_BACKDRAW))
return OPERATOR_CANCELLED;
info= MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
@@ -1476,17 +1476,17 @@ static int sample_cancel(bContext *C, wmOperator *op)
void NODE_OT_backimage_sample(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Backimage Sample";
- ot->idname= "NODE_OT_backimage_sample";
+ ot->name = "Backimage Sample";
+ ot->idname = "NODE_OT_backimage_sample";
/* api callbacks */
- ot->invoke= sample_invoke;
- ot->modal= sample_modal;
- ot->cancel= sample_cancel;
- ot->poll= ED_operator_node_active;
+ ot->invoke = sample_invoke;
+ ot->modal = sample_modal;
+ ot->cancel = sample_cancel;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
}
/* ********************** size widget operator ******************** */
@@ -1512,7 +1512,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event)
&mx, &my);
if (node) {
- if(node->flag & NODE_HIDDEN) {
+ if (node->flag & NODE_HIDDEN) {
node->miniwidth= nsw->oldminiwidth + mx - nsw->mxstart;
CLAMP(node->miniwidth, 0.0f, 100.0f);
}
@@ -1550,12 +1550,12 @@ static int node_resize_invoke(bContext *C, wmOperator *op, wmEvent *event)
ARegion *ar= CTX_wm_region(C);
bNode *node= editnode_get_active(snode->edittree);
- if(node) {
+ if (node) {
/* convert mouse coordinates to v2d space */
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
&snode->mx, &snode->my);
- if(node->typeinfo->resize_area_func(node, snode->mx, snode->my)) {
+ if (node->typeinfo->resize_area_func(node, snode->mx, snode->my)) {
NodeSizeWidget *nsw= MEM_callocN(sizeof(NodeSizeWidget), "size widget op data");
op->customdata= nsw;
@@ -1587,17 +1587,17 @@ static int node_resize_cancel(bContext *UNUSED(C), wmOperator *op)
void NODE_OT_resize(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Resize Node";
- ot->idname= "NODE_OT_resize";
+ ot->name = "Resize Node";
+ ot->idname = "NODE_OT_resize";
/* api callbacks */
- ot->invoke= node_resize_invoke;
- ot->modal= node_resize_modal;
- ot->poll= ED_operator_node_active;
- ot->cancel= node_resize_cancel;
+ ot->invoke = node_resize_invoke;
+ ot->modal = node_resize_modal;
+ ot->poll = ED_operator_node_active;
+ ot->cancel = node_resize_cancel;
/* flags */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
}
@@ -1607,11 +1607,11 @@ int node_has_hidden_sockets(bNode *node, short flag)
{
bNodeSocket *sock;
- for(sock= node->inputs.first; sock; sock= sock->next)
- if(sock->flag & flag)
+ for (sock= node->inputs.first; sock; sock= sock->next)
+ if (sock->flag & flag)
return 1;
- for(sock= node->outputs.first; sock; sock= sock->next)
- if(sock->flag & flag)
+ for (sock= node->outputs.first; sock; sock= sock->next)
+ if (sock->flag & flag)
return 1;
return 0;
}
@@ -1620,20 +1620,20 @@ void node_set_hidden_sockets(SpaceNode *snode, bNode *node, short flag, int set)
{
bNodeSocket *sock;
- if(set==0) {
- for(sock= node->inputs.first; sock; sock= sock->next)
+ if (set==0) {
+ for (sock= node->inputs.first; sock; sock= sock->next)
sock->flag &= ~flag;
- for(sock= node->outputs.first; sock; sock= sock->next)
+ for (sock= node->outputs.first; sock; sock= sock->next)
sock->flag &= ~flag;
}
else {
/* hide unused sockets */
- for(sock= node->inputs.first; sock; sock= sock->next) {
- if(sock->link==NULL)
+ for (sock= node->inputs.first; sock; sock= sock->next) {
+ if (sock->link==NULL)
sock->flag |= flag;
}
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(nodeCountSocketLinks(snode->edittree, sock)==0)
+ for (sock= node->outputs.first; sock; sock= sock->next) {
+ if (nodeCountSocketLinks(snode->edittree, sock)==0)
sock->flag |= flag;
}
}
@@ -1647,20 +1647,20 @@ static int node_link_viewer(const bContext *C, bNode *tonode)
bNodeSocket *sock;
/* context check */
- if(tonode==NULL || tonode->outputs.first==NULL)
+ if (tonode==NULL || tonode->outputs.first==NULL)
return OPERATOR_CANCELLED;
- if( ELEM(tonode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+ if ( ELEM(tonode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
return OPERATOR_CANCELLED;
/* get viewer */
- for(node= snode->edittree->nodes.first; node; node= node->next)
- if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
- if(node->flag & NODE_DO_OUTPUT)
+ for (node= snode->edittree->nodes.first; node; node= node->next)
+ if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+ if (node->flag & NODE_DO_OUTPUT)
break;
/* no viewer, we make one active */
- if(node==NULL) {
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+ if (node==NULL) {
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
node->flag |= NODE_DO_OUTPUT;
break;
}
@@ -1672,32 +1672,32 @@ static int node_link_viewer(const bContext *C, bNode *tonode)
/* try to find an already connected socket to cycle to the next */
if (node) {
link = NULL;
- for(link= snode->edittree->links.first; link; link= link->next)
- if(link->tonode==node && link->fromnode==tonode)
- if(link->tosock==node->inputs.first)
+ for (link= snode->edittree->links.first; link; link= link->next)
+ if (link->tonode==node && link->fromnode==tonode)
+ if (link->tosock==node->inputs.first)
break;
- if(link) {
+ if (link) {
/* unlink existing connection */
sock= link->fromsock;
nodeRemLink(snode->edittree, link);
/* find a socket after the previously connected socket */
- for(sock=sock->next; sock; sock= sock->next)
- if(!nodeSocketIsHidden(sock))
+ for (sock=sock->next; sock; sock= sock->next)
+ if (!nodeSocketIsHidden(sock))
break;
}
}
/* find a socket starting from the first socket */
- if(!sock) {
- for(sock= tonode->outputs.first; sock; sock= sock->next)
- if(!nodeSocketIsHidden(sock))
+ if (!sock) {
+ for (sock= tonode->outputs.first; sock; sock= sock->next)
+ if (!nodeSocketIsHidden(sock))
break;
}
- if(sock) {
+ if (sock) {
/* add a new viewer if none exists yet */
- if(!node) {
+ if (!node) {
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
bNodeTemplate ntemp;
@@ -1712,12 +1712,12 @@ static int node_link_viewer(const bContext *C, bNode *tonode)
}
else {
/* get link to viewer */
- for(link= snode->edittree->links.first; link; link= link->next)
- if(link->tonode==node && link->tosock==node->inputs.first)
+ for (link= snode->edittree->links.first; link; link= link->next)
+ if (link->tonode==node && link->tosock==node->inputs.first)
break;
}
- if(link==NULL) {
+ if (link==NULL) {
nodeAddLink(snode->edittree, tonode, sock, node, node->inputs.first);
}
else {
@@ -1739,7 +1739,7 @@ static int node_active_link_viewer(bContext *C, wmOperator *UNUSED(op))
node= editnode_get_active(snode->edittree);
- if(!node)
+ if (!node)
return OPERATOR_CANCELLED;
ED_preview_kill_jobs(C);
@@ -1757,16 +1757,16 @@ static int node_active_link_viewer(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_link_viewer(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Link to Viewer Node";
+ ot->name = "Link to Viewer Node";
ot->description = "Link to viewer node";
- ot->idname= "NODE_OT_link_viewer";
+ ot->idname = "NODE_OT_link_viewer";
/* api callbacks */
- ot->exec= node_active_link_viewer;
- ot->poll= composite_node_active;
+ ot->exec = node_active_link_viewer;
+ ot->poll = composite_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1779,17 +1779,17 @@ static int UNUSED_FUNCTION(node_mouse_groupheader)(SpaceNode *snode)
// XXX int mval[2];
gnode= node_tree_get_editgroup(snode->nodetree);
- if(gnode==NULL) return 0;
+ if (gnode==NULL) return 0;
// XXX getmouseco_areawin(mval);
// XXX areamouseco_to_ipoco(G.v2d, mval, &mx, &my);
/* click in header or outside? */
- if(BLI_in_rctf(&gnode->totr, mx, my)==0) {
+ if (BLI_in_rctf(&gnode->totr, mx, my)==0) {
rctf rect= gnode->totr;
rect.ymax += NODE_DY;
- if(BLI_in_rctf(&rect, mx, my)==0)
+ if (BLI_in_rctf(&rect, mx, my)==0)
snode_make_group_editable(snode, NULL); /* toggles, so exits editmode */
// else
// XXX transform_nodes(snode->nodetree, 'g', "Move group");
@@ -1811,7 +1811,7 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
*sockp= NULL;
/* check if we click in a socket */
- for(node= snode->edittree->nodes.first; node; node= node->next) {
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
rect.xmin = snode->mx - (NODE_SOCKSIZE+4);
rect.ymin = snode->my - (NODE_SOCKSIZE+4);
@@ -1823,17 +1823,18 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
if (in_out == SOCK_IN) {
rect.xmax += NODE_SOCKSIZE;
rect.xmin -= NODE_SOCKSIZE*4;
- } else if (in_out == SOCK_OUT) {
+ }
+ else if (in_out == SOCK_OUT) {
rect.xmax += NODE_SOCKSIZE*4;
rect.xmin -= NODE_SOCKSIZE;
}
}
- if(in_out & SOCK_IN) {
- for(sock= node->inputs.first; sock; sock= sock->next) {
- if(!nodeSocketIsHidden(sock)) {
- if(BLI_in_rctf(&rect, sock->locx, sock->locy)) {
- if(node == visible_node(snode, &rect)) {
+ if (in_out & SOCK_IN) {
+ for (sock= node->inputs.first; sock; sock= sock->next) {
+ if (!nodeSocketIsHidden(sock)) {
+ if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+ if (node == visible_node(snode, &rect)) {
*nodep= node;
*sockp= sock;
return 1;
@@ -1842,11 +1843,11 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
}
}
}
- if(in_out & SOCK_OUT) {
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(!nodeSocketIsHidden(sock)) {
- if(BLI_in_rctf(&rect, sock->locx, sock->locy)) {
- if(node == visible_node(snode, &rect)) {
+ if (in_out & SOCK_OUT) {
+ for (sock= node->outputs.first; sock; sock= sock->next) {
+ if (!nodeSocketIsHidden(sock)) {
+ if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+ if (node == visible_node(snode, &rect)) {
*nodep= node;
*sockp= sock;
return 1;
@@ -1860,10 +1861,10 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
/* check group sockets
* NB: using ngroup->outputs as input sockets and vice versa here!
*/
- if(in_out & SOCK_IN) {
- for(sock= snode->edittree->outputs.first; sock; sock= sock->next) {
- if(!nodeSocketIsHidden(sock)) {
- if(BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+ if (in_out & SOCK_IN) {
+ for (sock= snode->edittree->outputs.first; sock; sock= sock->next) {
+ if (!nodeSocketIsHidden(sock)) {
+ if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
*nodep= NULL; /* NULL node pointer indicates group socket */
*sockp= sock;
return 1;
@@ -1871,10 +1872,10 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
}
}
}
- if(in_out & SOCK_OUT) {
- for(sock= snode->edittree->inputs.first; sock; sock= sock->next) {
- if(!nodeSocketIsHidden(sock)) {
- if(BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+ if (in_out & SOCK_OUT) {
+ for (sock= snode->edittree->inputs.first; sock; sock= sock->next) {
+ if (!nodeSocketIsHidden(sock)) {
+ if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
*nodep= NULL; /* NULL node pointer indicates group socket */
*sockp= sock;
return 1;
@@ -2031,8 +2032,8 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
bNode *node;
int i, numlinks=0;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->flag & NODE_SELECT) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->flag & NODE_SELECT) {
nli = MEM_mallocN(sizeof(bNodeListItem), "temporary node list item");
nli->node = node;
BLI_addtail(nodelist, nli);
@@ -2112,13 +2113,13 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate
node = nodeAddNode(snode->edittree, ntemp);
/* generics */
- if(node) {
+ if (node) {
node->locx= locx;
node->locy= locy + 60.0f; // arbitrary.. so its visible, (0,0) is top of node
- node->flag |= SELECT;
+ node_select(node);
gnode= node_tree_get_editgroup(snode->nodetree);
- if(gnode) {
+ if (gnode) {
node->locx -= gnode->locx;
node->locy -= gnode->locy;
}
@@ -2126,24 +2127,24 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate
ntreeUpdateTree(snode->edittree);
ED_node_set_active(bmain, snode->edittree, node);
- if(snode->nodetree->type==NTREE_COMPOSIT) {
- if(ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE)) {
+ if (snode->nodetree->type==NTREE_COMPOSIT) {
+ if (ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE)) {
node->id = &scene->id;
}
- else if(ELEM3(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_MOVIEDISTORTION, CMP_NODE_STABILIZE2D)) {
+ else if (ELEM3(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_MOVIEDISTORTION, CMP_NODE_STABILIZE2D)) {
node->id = (ID *)scene->clip;
}
ntreeCompositForceHidden(snode->edittree, scene);
}
- if(node->id)
+ if (node->id)
id_us_plus(node->id);
snode_update(snode, node);
}
- if(snode->nodetree->type==NTREE_TEXTURE) {
+ if (snode->nodetree->type==NTREE_TEXTURE) {
ntreeTexCheckCyclics(snode->edittree);
}
@@ -2157,19 +2158,18 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
SpaceNode *snode= CTX_wm_space_node(C);
bNodeTree *ntree= snode->edittree;
bNode *node, *newnode, *lastnode;
- bNodeSocket *sock;
bNodeLink *link, *newlink, *lastlink;
int keep_inputs = RNA_boolean_get(op->ptr, "keep_inputs");
ED_preview_kill_jobs(C);
lastnode = ntree->nodes.last;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->flag & SELECT) {
newnode = nodeCopyNode(ntree, node);
- if(newnode->id) {
- /* simple id user adjustment, node internal functions dont touch this
+ if (newnode->id) {
+ /* simple id user adjustment, node internal functions don't touch this
* but operators and readfile.c do. */
id_us_plus(newnode->id);
/* to ensure redraws or rerenders happen */
@@ -2215,19 +2215,14 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
}
/* deselect old nodes, select the copies instead */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->flag & SELECT) {
/* has been set during copy above */
newnode = node->new_node;
- node->flag &= ~(NODE_SELECT|NODE_ACTIVE);
- newnode->flag |= NODE_SELECT;
-
- /* deselect old node sockets */
- for (sock=node->inputs.first; sock; sock=sock->next)
- sock->flag &= ~SELECT;
- for (sock=node->outputs.first; sock; sock=sock->next)
- sock->flag &= ~SELECT;
+ node_deselect(node);
+ node->flag &= ~NODE_ACTIVE;
+ node_select(newnode);
}
/* make sure we don't copy new nodes again! */
@@ -2246,16 +2241,16 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
void NODE_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Duplicate Nodes";
+ ot->name = "Duplicate Nodes";
ot->description = "Duplicate selected nodes";
- ot->idname= "NODE_OT_duplicate";
+ ot->idname = "NODE_OT_duplicate";
/* api callbacks */
- ot->exec= node_duplicate_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = node_duplicate_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "keep_inputs", 0, "Keep Inputs", "Keep the input links to duplicated nodes");
}
@@ -2267,22 +2262,22 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeSocket *tsock, bNodeL
bNodeLink *tlink;
bNodeSocket *sock;
- if(tsock && nodeCountSocketLinks(snode->edittree, link->tosock) > tsock->limit) {
+ if (tsock && nodeCountSocketLinks(snode->edittree, link->tosock) > tsock->limit) {
- for(tlink= snode->edittree->links.first; tlink; tlink= tlink->next) {
- if(link!=tlink && tlink->tosock==link->tosock)
+ for (tlink= snode->edittree->links.first; tlink; tlink= tlink->next) {
+ if (link!=tlink && tlink->tosock==link->tosock)
break;
}
- if(tlink) {
+ if (tlink) {
/* try to move the existing link to the next available socket */
if (tlink->tonode) {
/* is there a free input socket with the target type? */
- for(sock= tlink->tonode->inputs.first; sock; sock= sock->next) {
- if(sock->type==tlink->tosock->type)
- if(nodeCountSocketLinks(snode->edittree, sock) < sock->limit)
+ for (sock= tlink->tonode->inputs.first; sock; sock= sock->next) {
+ if (sock->type==tlink->tosock->type)
+ if (nodeCountSocketLinks(snode->edittree, sock) < sock->limit)
break;
}
- if(sock) {
+ if (sock) {
tlink->tosock= sock;
sock->flag &= ~(SOCK_HIDDEN|SOCK_AUTO_HIDDEN);
}
@@ -2321,13 +2316,13 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
switch (event->type) {
case MOUSEMOVE:
- if(in_out==SOCK_OUT) {
+ if (in_out==SOCK_OUT) {
/* only target socket becomes hilighted */
node_deselect_all_input_sockets(snode, 0);
- if(node_find_indicated_socket(snode, &tnode, &tsock, SOCK_IN)) {
- if(nodeFindLink(snode->edittree, sock, tsock)==NULL) {
- if( link->tosock!= tsock && (!tnode || (tnode!=node && link->tonode!=tnode)) ) {
+ if (node_find_indicated_socket(snode, &tnode, &tsock, SOCK_IN)) {
+ if (nodeFindLink(snode->edittree, sock, tsock)==NULL) {
+ if ( link->tosock!= tsock && (!tnode || (tnode!=node && link->tonode!=tnode)) ) {
link->tonode= tnode;
link->tosock= tsock;
if (link->prev==NULL && link->next==NULL) {
@@ -2340,7 +2335,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
}
/* hilight target socket */
- tsock->flag |= SELECT;
+ node_socket_select(tnode, tsock);
}
else {
if (link->tonode || link->tosock) {
@@ -2358,10 +2353,10 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
/* only target socket becomes hilighted */
node_deselect_all_output_sockets(snode, 0);
- if(node_find_indicated_socket(snode, &tnode, &tsock, SOCK_OUT)) {
- if(nodeFindLink(snode->edittree, sock, tsock)==NULL) {
- if(nodeCountSocketLinks(snode->edittree, tsock) < tsock->limit) {
- if( link->fromsock!= tsock && (!tnode || (tnode!=node && link->fromnode!=tnode)) ) {
+ if (node_find_indicated_socket(snode, &tnode, &tsock, SOCK_OUT)) {
+ if (nodeFindLink(snode->edittree, sock, tsock)==NULL) {
+ if (nodeCountSocketLinks(snode->edittree, tsock) < tsock->limit) {
+ if ( link->fromsock!= tsock && (!tnode || (tnode!=node && link->fromnode!=tnode)) ) {
link->fromnode= tnode;
link->fromsock= tsock;
if (link->prev==NULL && link->next==NULL) {
@@ -2375,7 +2370,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
}
/* hilight target socket */
- tsock->flag |= SELECT;
+ node_socket_select(tnode, tsock);
}
else {
if (link->tonode || link->tosock) {
@@ -2395,12 +2390,12 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
case LEFTMOUSE:
case RIGHTMOUSE:
case MIDDLEMOUSE:
- if(link->tosock && link->fromsock) {
+ if (link->tosock && link->fromsock) {
/* send changed events for original tonode and new */
snode_update(snode, link->tonode);
/* we might need to remove a link */
- if(in_out==SOCK_OUT)
+ if (in_out==SOCK_OUT)
node_remove_extra_links(snode, link->tosock, link);
/* deselect sockets after successful linking */
@@ -2459,16 +2454,16 @@ static int node_link_init(SpaceNode *snode, bNodeLinkDrag *nldrag)
int in_out = 0;
/* output indicated? */
- if(node_find_indicated_socket(snode, &nldrag->node, &nldrag->sock, SOCK_OUT)) {
- if(nodeCountSocketLinks(snode->edittree, nldrag->sock) < nldrag->sock->limit)
+ if (node_find_indicated_socket(snode, &nldrag->node, &nldrag->sock, SOCK_OUT)) {
+ if (nodeCountSocketLinks(snode->edittree, nldrag->sock) < nldrag->sock->limit)
in_out = SOCK_OUT;
else {
/* find if we break a link */
- for(link= snode->edittree->links.first; link; link= link->next) {
- if(link->fromsock==nldrag->sock)
+ for (link= snode->edittree->links.first; link; link= link->next) {
+ if (link->fromsock==nldrag->sock)
break;
}
- if(link) {
+ if (link) {
nldrag->node= link->tonode;
nldrag->sock= link->tosock;
nodeRemLink(snode->edittree, link);
@@ -2478,21 +2473,21 @@ static int node_link_init(SpaceNode *snode, bNodeLinkDrag *nldrag)
/* hilight source socket only */
node_deselect_all_output_sockets(snode, 0);
- nldrag->sock->flag |= SELECT;
+ node_socket_select(nldrag->node, nldrag->sock);
}
/* or an input? */
- else if(node_find_indicated_socket(snode, &nldrag->node, &nldrag->sock, SOCK_IN)) {
- if(nodeCountSocketLinks(snode->edittree, nldrag->sock) < nldrag->sock->limit)
+ else if (node_find_indicated_socket(snode, &nldrag->node, &nldrag->sock, SOCK_IN)) {
+ if (nodeCountSocketLinks(snode->edittree, nldrag->sock) < nldrag->sock->limit)
in_out = SOCK_IN;
else {
/* find if we break a link */
- for(link= snode->edittree->links.first; link; link= link->next) {
- if(link->tosock==nldrag->sock)
+ for (link= snode->edittree->links.first; link; link= link->next) {
+ if (link->tosock==nldrag->sock)
break;
}
- if(link) {
+ if (link) {
/* send changed event to original tonode */
- if(link->tonode)
+ if (link->tonode)
snode_update(snode, link->tonode);
nldrag->node= link->fromnode;
@@ -2504,7 +2499,7 @@ static int node_link_init(SpaceNode *snode, bNodeLinkDrag *nldrag)
/* hilight source socket only */
node_deselect_all_input_sockets(snode, 0);
- nldrag->sock->flag |= SELECT;
+ node_socket_select(nldrag->node, nldrag->sock);
}
return in_out;
@@ -2524,11 +2519,11 @@ static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event)
nldrag->in_out= node_link_init(snode, nldrag);
- if(nldrag->in_out) {
+ if (nldrag->in_out) {
op->customdata= nldrag;
/* we make a temporal link */
- if(nldrag->in_out==SOCK_OUT) {
+ if (nldrag->in_out==SOCK_OUT) {
nldrag->link= MEM_callocN(sizeof(bNodeLink), "link");
nldrag->link->fromnode= nldrag->node;
nldrag->link->fromsock= nldrag->sock;
@@ -2570,18 +2565,18 @@ static int node_link_cancel(bContext *C, wmOperator *op)
void NODE_OT_link(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Link Nodes";
- ot->idname= "NODE_OT_link";
+ ot->name = "Link Nodes";
+ ot->idname = "NODE_OT_link";
/* api callbacks */
- ot->invoke= node_link_invoke;
- ot->modal= node_link_modal;
-// ot->exec= node_link_exec;
- ot->poll= ED_operator_node_active;
- ot->cancel= node_link_cancel;
+ ot->invoke = node_link_invoke;
+ ot->modal = node_link_modal;
+// ot->exec = node_link_exec;
+ ot->poll = ED_operator_node_active;
+ ot->cancel = node_link_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
}
/* ********************** Make Link operator ***************** */
@@ -2610,16 +2605,16 @@ static int node_make_link_exec(bContext *C, wmOperator *op)
void NODE_OT_link_make(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Links";
- ot->description= "Makes a link between selected output in input sockets";
- ot->idname= "NODE_OT_link_make";
+ ot->name = "Make Links";
+ ot->description = "Makes a link between selected output in input sockets";
+ ot->idname = "NODE_OT_link_make";
/* callbacks */
- ot->exec= node_make_link_exec;
- ot->poll= ED_operator_node_active; // XXX we need a special poll which checks that there are selected input/output sockets
+ ot->exec = node_make_link_exec;
+ ot->poll = ED_operator_node_active; // XXX we need a special poll which checks that there are selected input/output sockets
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "replace", 0, "Replace", "Replace socket connections with the new links");
}
@@ -2632,11 +2627,11 @@ static int cut_links_intersect(bNodeLink *link, float mcoords[][2], int tot)
float coord_array[LINK_RESOL+1][2];
int i, b;
- if(node_link_bezier_points(NULL, NULL, link, coord_array, LINK_RESOL)) {
+ if (node_link_bezier_points(NULL, NULL, link, coord_array, LINK_RESOL)) {
- for(i=0; i<tot-1; i++)
- for(b=0; b<LINK_RESOL; b++)
- if(isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0)
+ for (i=0; i<tot-1; i++)
+ for (b=0; b<LINK_RESOL; b++)
+ if (isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0)
return 1;
}
return 0;
@@ -2656,19 +2651,19 @@ static int cut_links_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(&ar->v2d, (short)loc[0], (short)loc[1],
&mcoords[i][0], &mcoords[i][1]);
i++;
- if(i>= 256) break;
+ if (i>= 256) break;
}
RNA_END;
- if(i>1) {
+ if (i>1) {
bNodeLink *link, *next;
ED_preview_kill_jobs(C);
- for(link= snode->edittree->links.first; link; link= next) {
+ for (link= snode->edittree->links.first; link; link= next) {
next= link->next;
- if(cut_links_intersect(link, mcoords, i)) {
+ if (cut_links_intersect(link, mcoords, i)) {
snode_update(snode, link->tonode);
nodeRemLink(snode->edittree, link);
}
@@ -2688,18 +2683,18 @@ void NODE_OT_links_cut(wmOperatorType *ot)
{
PropertyRNA *prop;
- ot->name= "Cut links";
- ot->idname= "NODE_OT_links_cut";
+ ot->name = "Cut links";
+ ot->idname = "NODE_OT_links_cut";
- ot->invoke= WM_gesture_lines_invoke;
- ot->modal= WM_gesture_lines_modal;
- ot->exec= cut_links_exec;
- ot->cancel= WM_gesture_lines_cancel;
+ ot->invoke = WM_gesture_lines_invoke;
+ ot->modal = WM_gesture_lines_modal;
+ ot->exec = cut_links_exec;
+ ot->cancel = WM_gesture_lines_cancel;
- ot->poll= ED_operator_node_active;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
@@ -2717,8 +2712,8 @@ static int detach_links_exec(bContext *C, wmOperator *UNUSED(op))
ED_preview_kill_jobs(C);
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->flag & SELECT) {
nodeInternalRelink(ntree, node);
}
}
@@ -2733,14 +2728,14 @@ static int detach_links_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_links_detach(wmOperatorType *ot)
{
- ot->name= "Detach Links";
- ot->idname= "NODE_OT_links_detach";
+ ot->name = "Detach Links";
+ ot->idname = "NODE_OT_links_detach";
- ot->exec= detach_links_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = detach_links_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ********************* automatic node insert on dragging ******************* */
@@ -2757,8 +2752,8 @@ static bNodeSocket *socket_best_match(ListBase *sockets)
/* try all types, starting from 'highest' (i.e. colors, vectors, values) */
for (type=maxtype; type >= 0; --type) {
- for(sock= sockets->first; sock; sock= sock->next) {
- if(!nodeSocketIsHidden(sock) && type==sock->type) {
+ for (sock= sockets->first; sock; sock= sock->next) {
+ if (!nodeSocketIsHidden(sock) && type==sock->type) {
return sock;
}
}
@@ -2766,8 +2761,8 @@ static bNodeSocket *socket_best_match(ListBase *sockets)
/* no visible sockets, unhide first of highest type */
for (type=maxtype; type >= 0; --type) {
- for(sock= sockets->first; sock; sock= sock->next) {
- if(type==sock->type) {
+ for (sock= sockets->first; sock; sock= sock->next) {
+ if (type==sock->type) {
sock->flag &= ~(SOCK_HIDDEN|SOCK_AUTO_HIDDEN);
return sock;
}
@@ -2785,27 +2780,27 @@ static SpaceNode *ed_node_link_conditions(ScrArea *sa, bNode **select)
bNodeLink *link;
/* no unlucky accidents */
- if(sa==NULL || sa->spacetype!=SPACE_NODE) return NULL;
+ if (sa==NULL || sa->spacetype!=SPACE_NODE) return NULL;
*select= NULL;
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
- if(*select)
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if (node->flag & SELECT) {
+ if (*select)
break;
else
*select= node;
}
}
/* only one selected */
- if(node || *select==NULL) return NULL;
+ if (node || *select==NULL) return NULL;
/* correct node */
- if((*select)->inputs.first==NULL || (*select)->outputs.first==NULL) return NULL;
+ if ((*select)->inputs.first==NULL || (*select)->outputs.first==NULL) return NULL;
/* test node for links */
- for(link= snode->edittree->links.first; link; link=link->next) {
- if(link->tonode == *select || link->fromnode == *select)
+ for (link= snode->edittree->links.first; link; link=link->next) {
+ if (link->tonode == *select || link->fromnode == *select)
return NULL;
}
@@ -2820,14 +2815,14 @@ void ED_node_link_insert(ScrArea *sa)
bNodeLink *link;
bNodeSocket *sockto;
- if(snode==NULL) return;
+ if (snode==NULL) return;
/* get the link */
- for(link= snode->edittree->links.first; link; link=link->next)
- if(link->flag & NODE_LINKFLAG_HILITE)
+ for (link= snode->edittree->links.first; link; link=link->next)
+ if (link->flag & NODE_LINKFLAG_HILITE)
break;
- if(link) {
+ if (link) {
node= link->tonode;
sockto= link->tosock;
@@ -2851,13 +2846,13 @@ void ED_node_link_intersect_test(ScrArea *sa, int test)
bNodeLink *link, *selink=NULL;
float mcoords[6][2];
- if(snode==NULL) return;
+ if (snode==NULL) return;
/* clear flags */
- for(link= snode->edittree->links.first; link; link=link->next)
+ for (link= snode->edittree->links.first; link; link=link->next)
link->flag &= ~NODE_LINKFLAG_HILITE;
- if(test==0) return;
+ if (test==0) return;
/* okay, there's 1 node, without links, now intersect */
mcoords[0][0]= select->totr.xmin;
@@ -2875,16 +2870,16 @@ void ED_node_link_intersect_test(ScrArea *sa, int test)
/* we only tag a single link for intersect now */
/* idea; use header dist when more? */
- for(link= snode->edittree->links.first; link; link=link->next) {
+ for (link= snode->edittree->links.first; link; link=link->next) {
- if(cut_links_intersect(link, mcoords, 5)) { /* intersect code wants edges */
- if(selink)
+ if (cut_links_intersect(link, mcoords, 5)) { /* intersect code wants edges */
+ if (selink)
break;
selink= link;
}
}
- if(link==NULL && selink)
+ if (link==NULL && selink)
selink->flag |= NODE_LINKFLAG_HILITE;
}
@@ -2904,13 +2899,13 @@ static int node_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op))
ED_preview_kill_jobs(C);
/* first tag scenes unread */
- for(scene= bmain->scene.first; scene; scene= scene->id.next)
+ for (scene= bmain->scene.first; scene; scene= scene->id.next)
scene->id.flag |= LIB_DOIT;
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS) {
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if (node->type==CMP_NODE_R_LAYERS) {
ID *id= node->id;
- if(id->flag & LIB_DOIT) {
+ if (id->flag & LIB_DOIT) {
RE_ReadRenderResult(curscene, (Scene *)id);
ntreeCompositTagRender((Scene *)id);
id->flag &= ~LIB_DOIT;
@@ -2927,15 +2922,15 @@ static int node_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_read_renderlayers(wmOperatorType *ot)
{
- ot->name= "Read Render Layers";
- ot->idname= "NODE_OT_read_renderlayers";
+ ot->name = "Read Render Layers";
+ ot->idname = "NODE_OT_read_renderlayers";
- ot->exec= node_read_renderlayers_exec;
+ ot->exec = node_read_renderlayers_exec;
- ot->poll= composite_node_active;
+ ot->poll = composite_node_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op))
@@ -2960,15 +2955,15 @@ static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_read_fullsamplelayers(wmOperatorType *ot)
{
- ot->name= "Read Full Sample Layers";
- ot->idname= "NODE_OT_read_fullsamplelayers";
+ ot->name = "Read Full Sample Layers";
+ ot->idname = "NODE_OT_read_fullsamplelayers";
- ot->exec= node_read_fullsamplelayers_exec;
+ ot->exec = node_read_fullsamplelayers_exec;
- ot->poll= composite_node_active;
+ ot->poll = composite_node_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op))
@@ -2976,15 +2971,15 @@ int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op))
Scene *sce= CTX_data_scene(C);
bNode *node;
- for(node= sce->nodetree->nodes.first; node; node= node->next) {
- if(node->id==(ID *)sce && node->need_exec) {
+ for (node= sce->nodetree->nodes.first; node; node= node->next) {
+ if (node->id==(ID *)sce && node->need_exec) {
break;
}
}
- if(node) {
+ if (node) {
SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
- if(srl) {
+ if (srl) {
PointerRNA op_ptr;
WM_operator_properties_create(&op_ptr, "RENDER_OT_render");
@@ -3008,15 +3003,15 @@ int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_render_changed(wmOperatorType *ot)
{
- ot->name= "Render Changed Layer";
- ot->idname= "NODE_OT_render_changed";
+ ot->name = "Render Changed Layer";
+ ot->idname = "NODE_OT_render_changed";
- ot->exec= node_render_changed_exec;
+ ot->exec = node_render_changed_exec;
- ot->poll= composite_node_active;
+ ot->poll = composite_node_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
@@ -3027,20 +3022,20 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
SpaceNode *snode = CTX_wm_space_node(C);
bNode *gnode;
- if(snode->edittree!=snode->nodetree) {
+ if (snode->edittree!=snode->nodetree) {
BKE_report(op->reports, RPT_WARNING, "Can not add a new Group in a Group");
return OPERATOR_CANCELLED;
}
/* for time being... is too complex to handle */
- if(snode->treetype==NTREE_COMPOSIT) {
- for(gnode=snode->nodetree->nodes.first; gnode; gnode= gnode->next) {
- if(gnode->flag & SELECT)
- if(gnode->type==CMP_NODE_R_LAYERS)
+ if (snode->treetype==NTREE_COMPOSIT) {
+ for (gnode=snode->nodetree->nodes.first; gnode; gnode= gnode->next) {
+ if (gnode->flag & SELECT)
+ if (gnode->type==CMP_NODE_R_LAYERS)
break;
}
- if(gnode) {
+ if (gnode) {
BKE_report(op->reports, RPT_WARNING, "Can not add RenderLayer in a Group");
return OPERATOR_CANCELLED;
}
@@ -3049,7 +3044,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
ED_preview_kill_jobs(C);
gnode= node_group_make_from_selected(snode->nodetree);
- if(gnode==NULL) {
+ if (gnode==NULL) {
BKE_report(op->reports, RPT_WARNING, "Can not make Group");
return OPERATOR_CANCELLED;
}
@@ -3090,29 +3085,29 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag)
* If the flag is set on all nodes it is unset.
* If the flag is not set on all nodes, it is set.
*/
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if (node->flag & SELECT) {
- if(toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
+ if (toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
continue;
- if(toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
+ if (toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
continue;
- if(node->flag & toggle_flag)
+ if (node->flag & toggle_flag)
tot_eq++;
else
tot_neq++;
}
}
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if (node->flag & SELECT) {
- if(toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
+ if (toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
continue;
- if(toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
+ if (toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
continue;
- if( (tot_eq && tot_neq) || tot_eq==0) {
+ if ( (tot_eq && tot_neq) || tot_eq==0) {
node->flag |= toggle_flag;
/* hide/unhide node also toggles unlinked socket display */
@@ -3135,7 +3130,7 @@ static int node_hide_toggle_exec(bContext *C, wmOperator *UNUSED(op))
SpaceNode *snode= CTX_wm_space_node(C);
/* sanity checking (poll callback checks this already) */
- if((snode == NULL) || (snode->edittree == NULL))
+ if ((snode == NULL) || (snode->edittree == NULL))
return OPERATOR_CANCELLED;
node_flag_toggle_exec(snode, NODE_HIDDEN);
@@ -3148,16 +3143,16 @@ static int node_hide_toggle_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_hide_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Hide";
- ot->description= "Toggle hiding of selected nodes";
- ot->idname= "NODE_OT_hide_toggle";
+ ot->name = "Hide";
+ ot->description = "Toggle hiding of selected nodes";
+ ot->idname = "NODE_OT_hide_toggle";
/* callbacks */
- ot->exec= node_hide_toggle_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = node_hide_toggle_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int node_preview_toggle_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3165,7 +3160,7 @@ static int node_preview_toggle_exec(bContext *C, wmOperator *UNUSED(op))
SpaceNode *snode= CTX_wm_space_node(C);
/* sanity checking (poll callback checks this already) */
- if((snode == NULL) || (snode->edittree == NULL))
+ if ((snode == NULL) || (snode->edittree == NULL))
return OPERATOR_CANCELLED;
ED_preview_kill_jobs(C);
@@ -3180,16 +3175,16 @@ static int node_preview_toggle_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_preview_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Node Preview";
- ot->description= "Toggle preview display for selected nodes";
- ot->idname= "NODE_OT_preview_toggle";
+ ot->name = "Toggle Node Preview";
+ ot->description = "Toggle preview display for selected nodes";
+ ot->idname = "NODE_OT_preview_toggle";
/* callbacks */
- ot->exec= node_preview_toggle_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = node_preview_toggle_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3197,7 +3192,7 @@ static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op))
SpaceNode *snode= CTX_wm_space_node(C);
/* sanity checking (poll callback checks this already) */
- if((snode == NULL) || (snode->edittree == NULL))
+ if ((snode == NULL) || (snode->edittree == NULL))
return OPERATOR_CANCELLED;
node_flag_toggle_exec(snode, NODE_OPTIONS);
@@ -3210,16 +3205,16 @@ static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_options_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Node Options";
- ot->description= "Toggle option buttons display for selected nodes";
- ot->idname= "NODE_OT_options_toggle";
+ ot->name = "Toggle Node Options";
+ ot->description = "Toggle option buttons display for selected nodes";
+ ot->idname = "NODE_OT_options_toggle";
/* callbacks */
- ot->exec= node_options_toggle_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = node_options_toggle_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3229,24 +3224,24 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
int hidden;
/* sanity checking (poll callback checks this already) */
- if((snode == NULL) || (snode->edittree == NULL))
+ if ((snode == NULL) || (snode->edittree == NULL))
return OPERATOR_CANCELLED;
ED_preview_kill_jobs(C);
/* Toggle for all selected nodes */
hidden = 0;
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
- if(node_has_hidden_sockets(node, SOCK_HIDDEN)) {
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if (node->flag & SELECT) {
+ if (node_has_hidden_sockets(node, SOCK_HIDDEN)) {
hidden= 1;
break;
}
}
}
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if (node->flag & SELECT) {
node_set_hidden_sockets(snode, node, SOCK_HIDDEN, !hidden);
}
}
@@ -3261,16 +3256,16 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_hide_socket_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Hidden Node Sockets";
- ot->description= "Toggle unused node socket display";
- ot->idname= "NODE_OT_hide_socket_toggle";
+ ot->name = "Toggle Hidden Node Sockets";
+ ot->description = "Toggle unused node socket display";
+ ot->idname = "NODE_OT_hide_socket_toggle";
/* callbacks */
- ot->exec= node_socket_toggle_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = node_socket_toggle_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ****************** Mute operator *********************** */
@@ -3282,7 +3277,7 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
ED_preview_kill_jobs(C);
- for(node= snode->edittree->nodes.first; node; node= node->next) {
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
/* Only allow muting of nodes having a mute func! */
if ((node->flag & SELECT) && node->typeinfo->internal_connect) {
node->flag ^= NODE_MUTED;
@@ -3299,16 +3294,16 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_mute_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Node Mute";
- ot->description= "Toggle muting of the nodes";
- ot->idname= "NODE_OT_mute_toggle";
+ ot->name = "Toggle Node Mute";
+ ot->description = "Toggle muting of the nodes";
+ ot->idname = "NODE_OT_mute_toggle";
/* callbacks */
- ot->exec= node_mute_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = node_mute_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ****************** Delete operator ******************* */
@@ -3320,11 +3315,11 @@ static int node_delete_exec(bContext *C, wmOperator *UNUSED(op))
ED_preview_kill_jobs(C);
- for(node= snode->edittree->nodes.first; node; node= next) {
+ for (node= snode->edittree->nodes.first; node; node= next) {
next= node->next;
- if(node->flag & SELECT) {
+ if (node->flag & SELECT) {
/* check id user here, nodeFreeNode is called for free dbase too */
- if(node->id)
+ if (node->id)
node->id->us--;
nodeFreeNode(snode->edittree, node);
}
@@ -3341,16 +3336,16 @@ static int node_delete_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete";
+ ot->name = "Delete";
ot->description = "Delete selected nodes";
- ot->idname= "NODE_OT_delete";
+ ot->idname = "NODE_OT_delete";
/* api callbacks */
- ot->exec= node_delete_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = node_delete_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ****************** Delete with reconnect ******************* */
@@ -3361,13 +3356,13 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op))
ED_preview_kill_jobs(C);
- for(node= snode->edittree->nodes.first; node; node= next) {
+ for (node= snode->edittree->nodes.first; node; node= next) {
next= node->next;
- if(node->flag & SELECT) {
+ if (node->flag & SELECT) {
nodeInternalRelink(snode->edittree, node);
/* check id user here, nodeFreeNode is called for free dbase too */
- if(node->id)
+ if (node->id)
node->id->us--;
nodeFreeNode(snode->edittree, node);
}
@@ -3384,16 +3379,16 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_delete_reconnect(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete with reconnect";
+ ot->name = "Delete with reconnect";
ot->description = "Delete nodes; will reconnect nodes as if deletion was muted";
- ot->idname= "NODE_OT_delete_reconnect";
+ ot->idname = "NODE_OT_delete_reconnect";
/* api callbacks */
- ot->exec= node_delete_reconnect_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = node_delete_reconnect_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ****************** Show Cyclic Dependencies Operator ******************* */
@@ -3412,16 +3407,16 @@ static int node_show_cycles_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_show_cyclic_dependencies(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Show Cyclic Dependencies";
- ot->description= "Sort the nodes and show the cyclic dependencies between the nodes";
- ot->idname= "NODE_OT_show_cyclic_dependencies";
+ ot->name = "Show Cyclic Dependencies";
+ ot->description = "Sort the nodes and show the cyclic dependencies between the nodes";
+ ot->idname = "NODE_OT_show_cyclic_dependencies";
/* callbacks */
- ot->exec= node_show_cycles_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = node_show_cycles_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ****************** Add File Node Operator ******************* */
@@ -3435,8 +3430,6 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
Image *ima= NULL;
bNodeTemplate ntemp;
- ntemp.type = -1;
-
/* check input variables */
if (RNA_struct_property_is_set(op->ptr, "filepath")) {
char path[FILE_MAX];
@@ -3446,17 +3439,17 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
ima= BKE_add_image_file(path);
- if(!ima) {
+ if (!ima) {
BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s", path, errno ? strerror(errno) : "Unsupported image format");
return OPERATOR_CANCELLED;
}
}
- else if(RNA_struct_property_is_set(op->ptr, "name")) {
+ else if (RNA_struct_property_is_set(op->ptr, "name")) {
char name[MAX_ID_NAME-2];
RNA_string_get(op->ptr, "name", name);
ima= (Image *)find_id("IM", name);
- if(!ima) {
+ if (!ima) {
BKE_reportf(op->reports, RPT_ERROR, "Image named \"%s\", not found", name);
return OPERATOR_CANCELLED;
}
@@ -3464,12 +3457,20 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
node_deselect_all(snode);
- if (snode->nodetree->type==NTREE_COMPOSIT)
- ntemp.type = CMP_NODE_IMAGE;
-
- if (ntemp.type < 0)
- return OPERATOR_CANCELLED;
-
+ switch (snode->nodetree->type) {
+ case NTREE_SHADER:
+ ntemp.type = SH_NODE_TEX_IMAGE;
+ break;
+ case NTREE_TEXTURE:
+ ntemp.type = TEX_NODE_IMAGE;
+ break;
+ case NTREE_COMPOSIT:
+ ntemp.type = CMP_NODE_IMAGE;
+ break;
+ default:
+ return OPERATOR_CANCELLED;
+ }
+
ED_preview_kill_jobs(C);
node = node_add_node(snode, bmain, scene, &ntemp, snode->mx, snode->my);
@@ -3505,17 +3506,17 @@ static int node_add_file_invoke(bContext *C, wmOperator *op, wmEvent *event)
void NODE_OT_add_file(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add File Node";
- ot->description= "Add a file node to the current node editor";
- ot->idname= "NODE_OT_add_file";
+ ot->name = "Add File Node";
+ ot->description = "Add a file node to the current node editor";
+ ot->idname = "NODE_OT_add_file";
/* callbacks */
- ot->exec= node_add_file_exec;
- ot->invoke= node_add_file_invoke;
- ot->poll= composite_node_active;
+ ot->exec = node_add_file_exec;
+ ot->invoke = node_add_file_invoke;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); //XXX TODO, relative_path
RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME-2, "Name", "Datablock name to assign");
@@ -3544,13 +3545,13 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "name", treename);
ntree = ntreeAddTree(treename, treetype, 0);
- if(!ntree)
+ if (!ntree)
return OPERATOR_CANCELLED;
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
- if(prop) {
+ if (prop) {
RNA_id_pointer_create(&ntree->id, &idptr);
RNA_property_pointer_set(&ptr, prop, idptr);
/* RNA_property_pointer_set increases the user count,
@@ -3559,7 +3560,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
--ntree->id.us;
RNA_property_update(C, &ptr, prop);
}
- else if(snode) {
+ else if (snode) {
Scene *scene= CTX_data_scene(C);
snode->nodetree = ntree;
@@ -3572,15 +3573,15 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
void NODE_OT_new_node_tree(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "New node tree";
- ot->idname= "NODE_OT_new_node_tree";
+ ot->name = "New node tree";
+ ot->idname = "NODE_OT_new_node_tree";
/* api callbacks */
- ot->exec= new_node_tree_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = new_node_tree_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", nodetree_type_items, NTREE_COMPOSIT, "Tree Type", "");
RNA_def_string(ot->srna, "name", "NodeTree", MAX_ID_NAME-2, "Name", "");
@@ -3610,16 +3611,16 @@ static int node_output_file_add_socket_exec(bContext *C, wmOperator *op)
void NODE_OT_output_file_add_socket(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add File Node Socket";
- ot->description= "Add a new input to a file output node";
- ot->idname= "NODE_OT_output_file_add_socket";
+ ot->name = "Add File Node Socket";
+ ot->description = "Add a new input to a file output node";
+ ot->idname = "NODE_OT_output_file_add_socket";
/* callbacks */
- ot->exec= node_output_file_add_socket_exec;
- ot->poll= composite_node_active;
+ ot->exec = node_output_file_add_socket_exec;
+ ot->poll = composite_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_string(ot->srna, "file_path", "Image", MAX_NAME, "File Path", "Sub-path of the output file");
}
@@ -3646,14 +3647,14 @@ static int node_output_file_remove_active_socket_exec(bContext *C, wmOperator *U
void NODE_OT_output_file_remove_active_socket(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove File Node Socket";
- ot->description= "Remove active input from a file output node";
- ot->idname= "NODE_OT_output_file_remove_active_socket";
+ ot->name = "Remove File Node Socket";
+ ot->description = "Remove active input from a file output node";
+ ot->idname = "NODE_OT_output_file_remove_active_socket";
/* callbacks */
- ot->exec= node_output_file_remove_active_socket_exec;
- ot->poll= composite_node_active;
+ ot->exec = node_output_file_remove_active_socket_exec;
+ ot->poll = composite_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index df83afc143e..7ddc4bdf857 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -75,33 +75,33 @@ static void do_node_add(bContext *C, bNodeTemplate *ntemp)
bNode *node;
/* get location to add node at mouse */
- for(ar=sa->regionbase.first; ar; ar=ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW) {
+ for (ar=sa->regionbase.first; ar; ar=ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
wmWindow *win= CTX_wm_window(C);
int x= win->eventstate->x - ar->winrct.xmin;
int y= win->eventstate->y - ar->winrct.ymin;
- if(y < 60) y+= 60;
+ if (y < 60) y+= 60;
UI_view2d_region_to_view(&ar->v2d, x, y, &snode->mx, &snode->my);
}
}
/* store selection in temp test flag */
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->flag & NODE_SELECT) node->flag |= NODE_TEST;
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if (node->flag & NODE_SELECT) node->flag |= NODE_TEST;
else node->flag &= ~NODE_TEST;
}
/* node= */ node_add_node(snode, bmain, scene, ntemp, snode->mx, snode->my);
/* select previous selection before autoconnect */
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->flag & NODE_TEST) node->flag |= NODE_SELECT;
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if (node->flag & NODE_TEST) node->flag |= NODE_SELECT;
}
/* deselect after autoconnection */
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->flag & NODE_TEST) node->flag &= ~NODE_SELECT;
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if (node->flag & NODE_TEST) node->flag &= ~NODE_SELECT;
}
snode_notify(C, snode);
@@ -195,13 +195,13 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
ntree = snode->nodetree;
- if(!ntree) {
+ if (!ntree) {
uiItemS(layout);
return;
}
- if(ntree->type == NTREE_SHADER) {
- if(scene_use_new_shading_nodes(scene))
+ if (ntree->type == NTREE_SHADER) {
+ if (scene_use_new_shading_nodes(scene))
compatibility= NODE_NEW_SHADING;
else
compatibility= NODE_OLD_SHADING;
@@ -214,14 +214,14 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
/* XXX hack: negative numbers used for empty group types */
if (node_tree_has_type(ntree->type, NODE_GROUP))
- uiItemV(layout, "New Group", 0, -NODE_GROUP);
+ uiItemV(layout, IFACE_("New Group"), 0, -NODE_GROUP);
if (node_tree_has_type(ntree->type, NODE_FORLOOP))
- uiItemV(layout, "New For Loop", 0, -NODE_FORLOOP);
+ uiItemV(layout, IFACE_("New For Loop"), 0, -NODE_FORLOOP);
if (node_tree_has_type(ntree->type, NODE_WHILELOOP))
- uiItemV(layout, "New While Loop", 0, -NODE_WHILELOOP);
+ uiItemV(layout, IFACE_("New While Loop"), 0, -NODE_WHILELOOP);
uiItemS(layout);
- for(ngroup=bmain->nodetree.first, event=0; ngroup; ngroup= ngroup->id.next, ++event) {
+ for (ngroup=bmain->nodetree.first, event=0; ngroup; ngroup= ngroup->id.next, ++event) {
/* only use group trees */
if (ngroup->type==ntree->type && ELEM3(ngroup->nodetype, NODE_GROUP, NODE_FORLOOP, NODE_WHILELOOP)) {
uiItemV(layout, ngroup->id.name+2, 0, event);
@@ -239,7 +239,7 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
for (ntype=ntreeGetType(ntree->type)->node_types.first; ntype; ntype=ntype->next) {
if (ntype->nclass==nodeclass && ntype->name)
if (!compatibility || (ntype->compatibility & compatibility))
- uiItemV(layout, ntype->name, 0, ntype->type);
+ uiItemV(layout, IFACE_(ntype->name), 0, ntype->type);
}
}
}
@@ -247,7 +247,7 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
static void node_menu_add_foreach_cb(void *calldata, int nclass, const char *name)
{
uiLayout *layout= calldata;
- uiItemMenuF(layout, name, 0, node_add_menu, SET_INT_IN_POINTER(nclass));
+ uiItemMenuF(layout, IFACE_(name), 0, node_add_menu, SET_INT_IN_POINTER(nclass));
}
static void node_menu_add(const bContext *C, Menu *menu)
@@ -257,10 +257,10 @@ static void node_menu_add(const bContext *C, Menu *menu)
uiLayout *layout= menu->layout;
bNodeTreeType *ntreetype= ntreeGetType(snode->treetype);
- if(!snode->nodetree)
+ if (!snode->nodetree)
uiLayoutSetActive(layout, 0);
- if(ntreetype && ntreetype->foreach_nodeclass)
+ if (ntreetype && ntreetype->foreach_nodeclass)
ntreetype->foreach_nodeclass(scene, layout, node_menu_add_foreach_cb);
}
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index c2a418af064..ea8fdd8059b 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -81,7 +81,11 @@ void node_operatortypes(void);
void node_keymap(wmKeyConfig *keyconf);
/* node_select.c */
+void node_select(struct bNode *node);
+void node_deselect(struct bNode *node);
void node_deselect_all(struct SpaceNode *snode);
+void node_socket_select(struct bNode *node, struct bNodeSocket *sock);
+void node_socket_deselect(struct bNode *node, struct bNodeSocket *sock, int deselect_node);
void node_deselect_all_input_sockets(struct SpaceNode *snode, int deselect_nodes);
void node_deselect_all_output_sockets(struct SpaceNode *snode, int deselect_nodes);
int node_select_same_type(struct SpaceNode *snode);
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index 93263a2e54b..e1493b5b1a5 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -110,24 +110,24 @@ void ED_operatormacros_node(void)
wmOperatorType *ot;
wmOperatorTypeMacro *mot;
- ot= WM_operatortype_append_macro("NODE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("NODE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Duplicate selected nodes and move them";
WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
/* modified operator call for duplicating with input links */
- ot= WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Duplicate selected nodes keeping input links and move them";
mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
RNA_boolean_set(mot->ptr, "keep_inputs", TRUE);
WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
- ot= WM_operatortype_append_macro("NODE_OT_select_link_viewer", "Link Viewer", OPTYPE_UNDO);
+ ot = WM_operatortype_append_macro("NODE_OT_select_link_viewer", "Link Viewer", OPTYPE_UNDO);
ot->description = "Select node and link it to a viewer node";
WM_operatortype_macro_define(ot, "NODE_OT_select");
WM_operatortype_macro_define(ot, "NODE_OT_link_viewer");
- ot= WM_operatortype_append_macro("NODE_OT_move_detach_links", "Detach", OPTYPE_UNDO|OPTYPE_REGISTER);
+ 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");
mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
@@ -140,12 +140,12 @@ void node_keymap(struct wmKeyConfig *keyconf)
wmKeyMapItem *kmi;
/* Entire Editor only ----------------- */
- keymap= WM_keymap_find(keyconf, "Node Generic", SPACE_NODE, 0);
+ keymap = WM_keymap_find(keyconf, "Node Generic", SPACE_NODE, 0);
WM_keymap_add_item(keymap, "NODE_OT_properties", NKEY, KM_PRESS, 0, 0);
/* Main Area only ----------------- */
- keymap= WM_keymap_find(keyconf, "Node Editor", SPACE_NODE, 0);
+ keymap = WM_keymap_find(keyconf, "Node Editor", SPACE_NODE, 0);
/* mouse select in nodes used to be both keys, but perhaps this should be reduced?
* NOTE: mouse-clicks on left-mouse will fall through to allow transform-tweak, but also link/resize
@@ -170,9 +170,9 @@ void node_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "NODE_OT_select_link_viewer", LEFTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
WM_keymap_add_item(keymap, "NODE_OT_backimage_move", MIDDLEMOUSE, KM_PRESS, KM_ALT, 0);
- kmi= WM_keymap_add_item(keymap, "NODE_OT_backimage_zoom", VKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "NODE_OT_backimage_zoom", VKEY, KM_PRESS, 0, 0);
RNA_float_set(kmi->ptr, "factor", 0.83333f);
- kmi= WM_keymap_add_item(keymap, "NODE_OT_backimage_zoom", VKEY, KM_PRESS, KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "NODE_OT_backimage_zoom", VKEY, KM_PRESS, KM_ALT, 0);
RNA_float_set(kmi->ptr, "factor", 1.2f);
WM_keymap_add_item(keymap, "NODE_OT_backimage_sample", ACTIONMOUSE, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index e2f3e7b51f2..15d7986a5c4 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -62,7 +62,7 @@ static bNode *node_under_mouse(bNodeTree *ntree, int mx, int my)
{
bNode *node;
- for(node=ntree->nodes.last; node; node=node->prev) {
+ for (node=ntree->nodes.last; node; node=node->prev) {
/* node body (header and scale are in other operators) */
if (BLI_in_rctf(&node->totr, mx, my))
return node;
@@ -173,12 +173,12 @@ static void node_sort(bNodeTree *ntree)
}
}
-static void node_select(bNode *node)
+void node_select(bNode *node)
{
node->flag |= SELECT;
}
-static void node_deselect(bNode *node)
+void node_deselect(bNode *node)
{
bNodeSocket *sock;
@@ -199,7 +199,7 @@ static void node_toggle(bNode *node)
node_select(node);
}
-static void node_socket_select(bNode *node, bNodeSocket *sock)
+void node_socket_select(bNode *node, bNodeSocket *sock)
{
sock->flag |= SELECT;
@@ -208,7 +208,7 @@ static void node_socket_select(bNode *node, bNodeSocket *sock)
node->flag |= SELECT;
}
-static void node_socket_deselect(bNode *node, bNodeSocket *sock, int deselect_node)
+void node_socket_deselect(bNode *node, bNodeSocket *sock, int deselect_node)
{
sock->flag &= ~SELECT;
@@ -247,7 +247,7 @@ void node_deselect_all(SpaceNode *snode)
{
bNode *node;
- for(node= snode->edittree->nodes.first; node; node= node->next)
+ for (node= snode->edittree->nodes.first; node; node= node->next)
node_deselect(node);
}
@@ -419,6 +419,7 @@ static int node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const i
bNode *node, *tnode;
bNodeSocket *sock, *tsock;
float mx, my;
+ int selected = 0;
/* get mouse coordinates in view2d space */
UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &mx, &my);
@@ -426,63 +427,61 @@ static int node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const i
snode->mx = mx;
snode->my = my;
- /* first do socket selection, these generally overlap with nodes */
- if (node_find_indicated_socket(snode, &node, &sock, SOCK_IN)) {
- if (extend) {
+ if (extend) {
+ /* first do socket selection, these generally overlap with nodes.
+ * socket selection only in extend mode.
+ */
+ if (node_find_indicated_socket(snode, &node, &sock, SOCK_IN)) {
node_socket_toggle(node, sock, 1);
+ selected = 1;
}
- else {
- node_deselect_all_input_sockets(snode, 1);
- node_socket_select(node, sock);
- }
-
- return 1;
- }
- else if (node_find_indicated_socket(snode, &node, &sock, SOCK_OUT)) {
- if (extend) {
+ else if (node_find_indicated_socket(snode, &node, &sock, SOCK_OUT)) {
if (sock->flag & SELECT) {
node_socket_deselect(node, sock, 1);
}
else {
- /* still only allow one selected output per node when extending, for sensible linking.
- * extend allows selecting outputs from different nodes though.
- */
+ /* only allow one selected output per node, for sensible linking.
+ * allows selecting outputs from different nodes though.
+ */
if (node) {
for (tsock=node->outputs.first; tsock; tsock=tsock->next)
node_socket_deselect(node, tsock, 1);
}
node_socket_select(node, sock);
}
+ selected = 1;
}
else {
- node_deselect_all_output_sockets(snode, 1);
- node_socket_select(node, sock);
+ /* find the closest visible node */
+ node = node_under_mouse(snode->edittree, mx, my);
+
+ if (node) {
+ node_toggle(node);
+
+ ED_node_set_active(bmain, snode->edittree, node);
+ selected = 1;
+ }
}
-
- return 1;
}
- else {
+ else { /* extend==0 */
+
/* find the closest visible node */
node = node_under_mouse(snode->edittree, mx, my);
if (node) {
- if (extend == 0) {
- for (tnode=snode->edittree->nodes.first; tnode; tnode=tnode->next)
- if (tnode!=node)
- node_deselect(tnode);
- node_select(node);
- }
- else {
- node_toggle(node);
- }
-
+ for (tnode=snode->edittree->nodes.first; tnode; tnode=tnode->next)
+ node_deselect(tnode);
+ node_select(node);
ED_node_set_active(bmain, snode->edittree, node);
- node_sort(snode->edittree);
- return 1;
+ selected = 1;
}
-
- return 0;
}
+
+ /* update node order */
+ if (selected)
+ node_sort(snode->edittree);
+
+ return selected;
}
static int node_select_exec(bContext *C, wmOperator *op)
@@ -525,16 +524,16 @@ static int node_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
void NODE_OT_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select";
- ot->idname= "NODE_OT_select";
- ot->description= "Select the node under the cursor";
+ ot->name = "Select";
+ ot->idname = "NODE_OT_select";
+ ot->description = "Select the node under the cursor";
/* api callbacks */
- ot->invoke= node_select_invoke;
- ot->poll= ED_operator_node_active;
+ ot->invoke = node_select_invoke;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_int(ot->srna, "mouse_x", 0, INT_MIN, INT_MAX, "Mouse X", "", INT_MIN, INT_MAX);
@@ -554,22 +553,22 @@ static int node_borderselect_exec(bContext *C, wmOperator *op)
int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
int extend= RNA_boolean_get(op->ptr, "extend");
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
UI_view2d_region_to_view(&ar->v2d, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(BLI_isect_rctf(&rectf, &node->totr, NULL)) {
- if(gesture_mode==GESTURE_MODAL_SELECT)
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if (BLI_isect_rctf(&rectf, &node->totr, NULL)) {
+ if (gesture_mode==GESTURE_MODAL_SELECT)
node_select(node);
else
node_deselect(node);
}
- else if(!extend) {
+ else if (!extend) {
node_deselect(node);
}
}
@@ -604,20 +603,20 @@ static int node_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event
void NODE_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Select";
- ot->idname= "NODE_OT_select_border";
- ot->description= "Use box selection to select nodes";
+ ot->name = "Border Select";
+ ot->idname = "NODE_OT_select_border";
+ ot->description = "Use box selection to select nodes";
/* api callbacks */
- ot->invoke= node_border_select_invoke;
- ot->exec= node_borderselect_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = node_border_select_invoke;
+ ot->exec = node_borderselect_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= ED_operator_node_active;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, TRUE);
@@ -633,16 +632,16 @@ static int node_select_all_exec(bContext *C, wmOperator *UNUSED(op))
bNode *node;
int count= 0;
- for(node=first; node; node=node->next)
- if(node->flag & NODE_SELECT)
+ for (node=first; node; node=node->next)
+ if (node->flag & NODE_SELECT)
count++;
- if(count) {
- for(node=first; node; node=node->next)
+ if (count) {
+ for (node=first; node; node=node->next)
node_deselect(node);
}
else {
- for(node=first; node; node=node->next)
+ for (node=first; node; node=node->next)
node_select(node);
}
@@ -655,7 +654,7 @@ static int node_select_all_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Select or Deselect All";
+ ot->name = "(De)select All";
ot->description = "(De)select all nodes";
ot->idname = "NODE_OT_select_all";
@@ -717,16 +716,16 @@ static int node_select_linked_from_exec(bContext *C, wmOperator *UNUSED(op))
bNodeLink *link;
bNode *node;
- for(node=snode->edittree->nodes.first; node; node=node->next)
+ for (node=snode->edittree->nodes.first; node; node=node->next)
node->flag &= ~NODE_TEST;
- for(link=snode->edittree->links.first; link; link=link->next) {
- if(link->fromnode && link->tonode && (link->tonode->flag & NODE_SELECT))
+ for (link=snode->edittree->links.first; link; link=link->next) {
+ if (link->fromnode && link->tonode && (link->tonode->flag & NODE_SELECT))
link->fromnode->flag |= NODE_TEST;
}
- for(node=snode->edittree->nodes.first; node; node=node->next) {
- if(node->flag & NODE_TEST)
+ for (node=snode->edittree->nodes.first; node; node=node->next) {
+ if (node->flag & NODE_TEST)
node_select(node);
}
diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c
index 58623e17b10..5463d4a8ff0 100644
--- a/source/blender/editors/space_node/node_state.c
+++ b/source/blender/editors/space_node/node_state.c
@@ -67,13 +67,13 @@ static void snode_home(ScrArea *UNUSED(sa), ARegion *ar, SpaceNode* snode)
oldwidth= cur->xmax - cur->xmin;
oldheight= cur->ymax - cur->ymin;
- cur->xmin= cur->ymin= 0.0f;
+ cur->xmin = cur->ymin = 0.0f;
cur->xmax=ar->winx;
cur->ymax=ar->winy;
- if(snode->edittree) {
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(first) {
+ if (snode->edittree) {
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
+ if (first) {
first= 0;
ar->v2d.cur= node->totr;
}
@@ -88,17 +88,17 @@ static void snode_home(ScrArea *UNUSED(sa), ARegion *ar, SpaceNode* snode)
width= cur->xmax - cur->xmin;
height= cur->ymax- cur->ymin;
- if(width > height) {
+ if (width > height) {
float newheight;
newheight= oldheight * width/oldwidth;
- cur->ymin= cur->ymin - newheight/4;
- cur->ymax= cur->ymax + newheight/4;
+ cur->ymin = cur->ymin - newheight/4;
+ cur->ymax = cur->ymax + newheight/4;
}
else {
float newwidth;
newwidth= oldwidth * height/oldheight;
- cur->xmin= cur->xmin - newwidth/4;
- cur->xmax= cur->xmax + newwidth/4;
+ cur->xmin = cur->xmin - newwidth/4;
+ cur->xmax = cur->xmax + newwidth/4;
}
ar->v2d.tot= ar->v2d.cur;
@@ -120,14 +120,14 @@ static int node_view_all_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View All";
- ot->idname= "NODE_OT_view_all";
- ot->description= "Resize view so you can see all nodes";
+ ot->name = "View All";
+ ot->idname = "NODE_OT_view_all";
+ ot->description = "Resize view so you can see all nodes";
/* api callbacks */
- ot->exec= node_view_all_exec;
- ot->poll= ED_operator_node_active;
+ ot->exec = node_view_all_exec;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 781f37918fd..3d841b05632 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -59,6 +59,7 @@
#include "../interface/interface_intern.h"
#include "ED_node.h"
+#include "ED_util.h"
/************************* Node Socket Manipulation **************************/
@@ -66,13 +67,13 @@ static void node_tag_recursive(bNode *node)
{
bNodeSocket *input;
- if(!node || (node->flag & NODE_TEST))
+ if (!node || (node->flag & NODE_TEST))
return; /* in case of cycles */
node->flag |= NODE_TEST;
- for(input=node->inputs.first; input; input=input->next)
- if(input->link)
+ for (input=node->inputs.first; input; input=input->next)
+ if (input->link)
node_tag_recursive(input->link->fromnode);
}
@@ -80,13 +81,13 @@ static void node_clear_recursive(bNode *node)
{
bNodeSocket *input;
- if(!node || !(node->flag & NODE_TEST))
+ if (!node || !(node->flag & NODE_TEST))
return; /* in case of cycles */
node->flag &= ~NODE_TEST;
- for(input=node->inputs.first; input; input=input->next)
- if(input->link)
+ for (input=node->inputs.first; input; input=input->next)
+ if (input->link)
node_clear_recursive(input->link->fromnode);
}
@@ -95,28 +96,28 @@ static void node_remove_linked(bNodeTree *ntree, bNode *rem_node)
bNode *node, *next;
bNodeSocket *sock;
- if(!rem_node)
+ if (!rem_node)
return;
/* tag linked nodes to be removed */
- for(node=ntree->nodes.first; node; node=node->next)
+ for (node=ntree->nodes.first; node; node=node->next)
node->flag &= ~NODE_TEST;
node_tag_recursive(rem_node);
/* clear tags on nodes that are still used by other nodes */
- for(node=ntree->nodes.first; node; node=node->next)
- if(!(node->flag & NODE_TEST))
- for(sock=node->inputs.first; sock; sock=sock->next)
- if(sock->link && sock->link->fromnode != rem_node)
+ for (node=ntree->nodes.first; node; node=node->next)
+ if (!(node->flag & NODE_TEST))
+ for (sock=node->inputs.first; sock; sock=sock->next)
+ if (sock->link && sock->link->fromnode != rem_node)
node_clear_recursive(sock->link->fromnode);
/* remove nodes */
- for(node=ntree->nodes.first; node; node=next) {
+ for (node=ntree->nodes.first; node; node=next) {
next = node->next;
- if(node->flag & NODE_TEST) {
- if(node->id)
+ if (node->flag & NODE_TEST) {
+ if (node->id)
node->id->us--;
nodeFreeNode(ntree, node);
}
@@ -126,7 +127,7 @@ static void node_remove_linked(bNodeTree *ntree, bNode *rem_node)
/* disconnect socket from the node it is connected to */
static void node_socket_disconnect(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to)
{
- if(!sock_to->link)
+ if (!sock_to->link)
return;
nodeRemLink(ntree, sock_to->link);
@@ -140,7 +141,7 @@ static void node_socket_disconnect(Main *bmain, bNodeTree *ntree, bNode *node_to
/* remove all nodes connected to this socket, if they aren't connected to other nodes */
static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to)
{
- if(!sock_to->link)
+ if (!sock_to->link)
return;
node_remove_linked(ntree, sock_to->link->fromnode);
@@ -159,31 +160,31 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
bNode *node_prev = NULL;
/* unlink existing node */
- if(sock_to->link) {
+ if (sock_to->link) {
node_prev = sock_to->link->fromnode;
nodeRemLink(ntree, sock_to->link);
}
/* find existing node that we can use */
- for(node_from=ntree->nodes.first; node_from; node_from=node_from->next)
- if(node_from->type == ntemp->type)
+ for (node_from=ntree->nodes.first; node_from; node_from=node_from->next)
+ if (node_from->type == ntemp->type)
break;
- if(node_from)
- if(!(node_from->inputs.first == NULL && !(node_from->typeinfo->flag & NODE_OPTIONS)))
+ if (node_from)
+ if (!(node_from->inputs.first == NULL && !(node_from->typeinfo->flag & NODE_OPTIONS)))
node_from = NULL;
- if(node_prev && node_prev->type == ntemp->type &&
+ if (node_prev && node_prev->type == ntemp->type &&
(ntemp->type != NODE_GROUP || node_prev->id == &ntemp->ngroup->id)) {
/* keep the previous node if it's the same type */
node_from = node_prev;
}
- else if(!node_from) {
+ else if (!node_from) {
node_from= nodeAddNode(ntree, ntemp);
node_from->locx = node_to->locx - (node_from->typeinfo->width + 50);
node_from->locy = node_to->locy;
- if(node_from->id)
+ if (node_from->id)
id_us_plus(node_from->id);
}
@@ -194,15 +195,18 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
nodeAddLink(ntree, node_from, sock_from, node_to, sock_to);
/* copy input sockets from previous node */
- if(node_prev && node_from != node_prev) {
+ if (node_prev && node_from != node_prev) {
bNodeSocket *sock_prev, *sock_from;
- for(sock_prev=node_prev->inputs.first; sock_prev; sock_prev=sock_prev->next) {
- for(sock_from=node_from->inputs.first; sock_from; sock_from=sock_from->next) {
- if(strcmp(sock_prev->name, sock_from->name) == 0 && sock_prev->type == sock_from->type) {
+ for (sock_prev=node_prev->inputs.first; sock_prev; sock_prev=sock_prev->next) {
+ for (sock_from=node_from->inputs.first; sock_from; sock_from=sock_from->next) {
+ if (nodeCountSocketLinks(ntree, sock_from) >= sock_from->limit)
+ continue;
+
+ if (strcmp(sock_prev->name, sock_from->name) == 0 && sock_prev->type == sock_from->type) {
bNodeLink *link = sock_prev->link;
- if(link && link->fromnode) {
+ if (link && link->fromnode) {
nodeAddLink(ntree, link->fromnode, link->fromsock, node_from, sock_from);
nodeRemLink(ntree, link);
}
@@ -215,7 +219,7 @@ 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 &&
+ if (node_from->typeinfo->nclass == NODE_CLASS_TEXTURE &&
node_prev->typeinfo->nclass == NODE_CLASS_TEXTURE)
memcpy(node_from->storage, node_prev->storage, sizeof(NodeTexBase));
@@ -250,7 +254,7 @@ typedef struct NodeLinkArg {
uiLayout *layout;
} NodeLinkArg;
-static void ui_node_link(bContext *UNUSED(C), void *arg_p, void *event_p)
+static void ui_node_link(bContext *C, void *arg_p, void *event_p)
{
NodeLinkArg *arg = (NodeLinkArg*)arg_p;
Main *bmain = arg->bmain;
@@ -263,21 +267,23 @@ static void ui_node_link(bContext *UNUSED(C), void *arg_p, void *event_p)
ntemp.type = arg->type;
ntemp.ngroup = arg->ngroup;
- if(event == UI_NODE_LINK_DISCONNECT)
+ if (event == UI_NODE_LINK_DISCONNECT)
node_socket_disconnect(bmain, ntree, node_to, sock_to);
- else if(event == UI_NODE_LINK_REMOVE)
+ else if (event == UI_NODE_LINK_REMOVE)
node_socket_remove(bmain, ntree, node_to, sock_to);
else
node_socket_add_replace(bmain, ntree, node_to, sock_to, &ntemp, arg->output);
+
+ ED_undo_push(C, "Node input modify");
}
static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
{
- if(sock->link && sock->link->fromnode) {
+ if (sock->link && sock->link->fromnode) {
bNode *node = sock->link->fromnode;
char node_name[UI_MAX_NAME_STR];
- if(node->type == NODE_GROUP) {
+ if (node->type == NODE_GROUP) {
if (node->id)
BLI_strncpy(node_name, node->id->name+2, UI_MAX_NAME_STR);
else
@@ -286,14 +292,14 @@ static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
else
BLI_strncpy(node_name, node->typeinfo->name, UI_MAX_NAME_STR);
- if(node->inputs.first == NULL &&
+ if (node->inputs.first == NULL &&
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
BLI_strncpy(name, node_name, UI_MAX_NAME_STR);
}
- else if(sock->type == SOCK_SHADER)
+ else if (sock->type == SOCK_SHADER)
BLI_strncpy(name, "None", UI_MAX_NAME_STR);
else
BLI_strncpy(name, "Default", UI_MAX_NAME_STR);
@@ -319,31 +325,31 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
int first = 1;
int compatibility= 0;
- if(ntree->type == NTREE_SHADER) {
- if(scene_use_new_shading_nodes(arg->scene))
+ if (ntree->type == NTREE_SHADER) {
+ if (scene_use_new_shading_nodes(arg->scene))
compatibility= NODE_NEW_SHADING;
else
compatibility= NODE_OLD_SHADING;
}
- if(nclass == NODE_CLASS_GROUP) {
- for(ngroup=bmain->nodetree.first; ngroup; ngroup=ngroup->id.next) {
+ if (nclass == NODE_CLASS_GROUP) {
+ for (ngroup=bmain->nodetree.first; ngroup; ngroup=ngroup->id.next) {
bNodeSocket *gsock;
char name[UI_MAX_NAME_STR];
int i, j, num = 0;
- if(ngroup->type != ntree->type)
+ if (ngroup->type != ntree->type)
continue;
- for(gsock=ngroup->inputs.first; gsock; gsock=gsock->next)
- if(ui_compatible_sockets(gsock->type, sock->type))
+ for (gsock=ngroup->inputs.first; gsock; gsock=gsock->next)
+ if (ui_compatible_sockets(gsock->type, sock->type))
num++;
- for(i=0, j=0, gsock=ngroup->outputs.first; gsock; gsock=gsock->next, i++) {
- if(!ui_compatible_sockets(gsock->type, sock->type))
+ for (i=0, j=0, gsock=ngroup->outputs.first; gsock; gsock=gsock->next, i++) {
+ if (!ui_compatible_sockets(gsock->type, sock->type))
continue;
- if(first) {
+ if (first) {
column= uiLayoutColumn(layout, 0);
uiBlockSetCurLayout(block, column);
@@ -354,8 +360,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
first = 0;
}
- if(num > 1) {
- if(j == 0) {
+ if (num > 1) {
+ if (j == 0) {
uiItemL(column, ngroup->id.name+2, ICON_NODE);
but= block->buttons.last;
but->flag= UI_TEXT_LEFT;
@@ -381,26 +387,26 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
else {
bNodeTreeType *ttype= ntreeGetType(ntree->type);
- for(ntype=ttype->node_types.first; ntype; ntype=ntype->next) {
+ for (ntype=ttype->node_types.first; ntype; ntype=ntype->next) {
bNodeSocketTemplate *stemp;
char name[UI_MAX_NAME_STR];
int i, j, num = 0;
- if(compatibility && !(ntype->compatibility & compatibility))
+ if (compatibility && !(ntype->compatibility & compatibility))
continue;
- if(ntype->nclass != nclass)
+ if (ntype->nclass != nclass)
continue;
- for(i=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
- if(ui_compatible_sockets(stemp->type, sock->type))
+ for (i=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
+ if (ui_compatible_sockets(stemp->type, sock->type))
num++;
- for(i=0, j=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
- if(!ui_compatible_sockets(stemp->type, sock->type))
+ for (i=0, j=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
+ if (!ui_compatible_sockets(stemp->type, sock->type))
continue;
- if(first) {
+ if (first) {
column= uiLayoutColumn(layout, 0);
uiBlockSetCurLayout(block, column);
@@ -411,8 +417,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
first = 0;
}
- if(num > 1) {
- if(j == 0) {
+ if (num > 1) {
+ if (j == 0) {
uiItemL(column, ntype->name, ICON_NODE);
but= block->buttons.last;
but->flag= UI_TEXT_LEFT;
@@ -440,7 +446,7 @@ static void node_menu_column_foreach_cb(void *calldata, int nclass, const char *
{
NodeLinkArg *arg = (NodeLinkArg*)calldata;
- if(!ELEM(nclass, NODE_CLASS_GROUP, NODE_CLASS_LAYOUT))
+ if (!ELEM(nclass, NODE_CLASS_GROUP, NODE_CLASS_LAYOUT))
ui_node_menu_column(arg, nclass, name);
}
@@ -462,13 +468,13 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_
arg->scene= scene;
arg->layout= split;
- if(ntreetype && ntreetype->foreach_nodeclass)
+ if (ntreetype && ntreetype->foreach_nodeclass)
ntreetype->foreach_nodeclass(scene, arg, node_menu_column_foreach_cb);
column= uiLayoutColumn(split, 0);
uiBlockSetCurLayout(block, column);
- if(sock->link) {
+ if (sock->link) {
uiItemL(column, "Link", ICON_NONE);
but= block->buttons.last;
but->flag= UI_TEXT_LEFT;
@@ -500,21 +506,21 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo
uiBlockSetCurLayout(block, layout);
- if(sock->link || sock->type == SOCK_SHADER || (sock->flag & SOCK_HIDE_VALUE)) {
+ if (sock->link || sock->type == SOCK_SHADER || (sock->flag & SOCK_HIDE_VALUE)) {
char name[UI_MAX_NAME_STR];
ui_node_sock_name(sock, name);
- but= uiDefMenuBut(block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
+ but = uiDefMenuBut(block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
}
else
- but= uiDefIconMenuBut(block, ui_template_node_link_menu, NULL, ICON_NONE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "");
+ but = uiDefIconMenuBut(block, ui_template_node_link_menu, NULL, ICON_NONE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "");
but->type= MENU;
but->flag |= UI_TEXT_LEFT|UI_BUT_NODE_LINK;
but->poin= (char*)but;
but->func_argN = arg;
- if(sock->link && sock->link->fromnode)
- if(sock->link->fromnode->flag & NODE_ACTIVE_TEXTURE)
+ if (sock->link && sock->link->fromnode)
+ if (sock->link->fromnode->flag & NODE_ACTIVE_TEXTURE)
but->flag |= UI_BUT_NODE_ACTIVE;
}
@@ -531,8 +537,8 @@ static void ui_node_draw_node(uiLayout *layout, bContext *C, bNodeTree *ntree, b
RNA_pointer_create(&ntree->id, &RNA_Node, node, &nodeptr);
- if(node->typeinfo->uifunc) {
- if(node->type != NODE_GROUP) {
+ if (node->typeinfo->uifunc) {
+ if (node->type != NODE_GROUP) {
split = uiLayoutSplit(layout, 0.35f, 0);
col = uiLayoutColumn(split, 0);
col = uiLayoutColumn(split, 0);
@@ -541,7 +547,7 @@ static void ui_node_draw_node(uiLayout *layout, bContext *C, bNodeTree *ntree, b
}
}
- for(input=node->inputs.first; input; input=input->next)
+ for (input=node->inputs.first; input; input=input->next)
ui_node_draw_input(layout, C, ntree, node, input, depth+1);
}
@@ -556,7 +562,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
int indent = (depth > 1)? 2*(depth - 1): 0;
int dependency_loop;
- if(input->flag & SOCK_UNAVAIL)
+ if (input->flag & SOCK_UNAVAIL)
return;
/* to avoid eternal loops on cyclic dependencies */
@@ -564,7 +570,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
lnode = (input->link)? input->link->fromnode: NULL;
dependency_loop = (lnode && (lnode->flag & NODE_TEST));
- if(dependency_loop)
+ if (dependency_loop)
lnode = NULL;
/* socket RNA pointer */
@@ -580,10 +586,10 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
row = uiLayoutRow(split, 1);
- if(depth > 0) {
+ if (depth > 0) {
uiBlockSetEmboss(block, UI_EMBOSSN);
- if(lnode && (lnode->inputs.first || (lnode->typeinfo->uifunc && lnode->type != NODE_GROUP))) {
+ if (lnode && (lnode->inputs.first || (lnode->typeinfo->uifunc && lnode->type != NODE_GROUP))) {
int icon = (input->flag & SOCK_COLLAPSED)? ICON_DISCLOSURE_TRI_RIGHT: ICON_DISCLOSURE_TRI_DOWN;
uiItemR(row, &inputptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", icon);
}
@@ -600,16 +606,16 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
bt= block->buttons.last;
bt->flag= UI_TEXT_LEFT;
- if(dependency_loop) {
+ if (dependency_loop) {
row = uiLayoutRow(split, 0);
uiItemL(row, "Dependency Loop", ICON_ERROR);
}
- else if(lnode) {
+ else if (lnode) {
/* input linked to a node */
uiTemplateNodeLink(split, ntree, node, input);
- if(!(input->flag & SOCK_COLLAPSED)) {
- if(depth == 0)
+ if (!(input->flag & SOCK_COLLAPSED)) {
+ if (depth == 0)
uiItemS(layout);
ui_node_draw_node(layout, C, ntree, lnode, depth);
@@ -617,8 +623,8 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
}
else {
/* input not linked, show value */
- if(input->type != SOCK_SHADER && !(input->flag & SOCK_HIDE_VALUE)) {
- if(input->type == SOCK_VECTOR) {
+ if (input->type != SOCK_SHADER && !(input->flag & SOCK_HIDE_VALUE)) {
+ if (input->type == SOCK_VECTOR) {
row = uiLayoutRow(split, 0);
col = uiLayoutColumn(row, 0);
@@ -643,14 +649,14 @@ void uiTemplateNodeView(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *
{
bNode *tnode;
- if(!ntree)
+ if (!ntree)
return;
/* clear for cycle check */
- for(tnode=ntree->nodes.first; tnode; tnode=tnode->next)
+ for (tnode=ntree->nodes.first; tnode; tnode=tnode->next)
tnode->flag &= ~NODE_TEST;
- if(input)
+ if (input)
ui_node_draw_input(layout, C, ntree, node, input, 0);
else
ui_node_draw_node(layout, C, ntree, node, 0);
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 93d3b22e092..fca9927b0f5 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -72,13 +72,13 @@ ARegion *node_has_buttons_region(ScrArea *sa)
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if(ar) return ar;
+ if (ar) return ar;
/* add subdiv level; after header */
ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if(ar==NULL) return NULL;
+ if (ar==NULL) return NULL;
arnew= MEM_callocN(sizeof(ARegion), "buttons for node");
@@ -125,15 +125,15 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
BLI_addtail(&snode->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin= -256.0f;
- ar->v2d.tot.ymin= -256.0f;
- ar->v2d.tot.xmax= 768.0f;
- ar->v2d.tot.ymax= 768.0f;
+ ar->v2d.tot.xmin = -256.0f;
+ ar->v2d.tot.ymin = -256.0f;
+ ar->v2d.tot.xmax = 768.0f;
+ ar->v2d.tot.ymax = 768.0f;
- ar->v2d.cur.xmin= -256.0f;
- ar->v2d.cur.ymin= -256.0f;
- ar->v2d.cur.xmax= 768.0f;
- ar->v2d.cur.ymax= 768.0f;
+ ar->v2d.cur.xmin = -256.0f;
+ ar->v2d.cur.ymin = -256.0f;
+ ar->v2d.cur.xmax = 768.0f;
+ ar->v2d.cur.ymax = 768.0f;
ar->v2d.min[0]= 1.0f;
ar->v2d.min[1]= 1.0f;
@@ -183,8 +183,8 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
case ND_TRANSFORM_DONE:
- if(type==NTREE_COMPOSIT) {
- if(snode->flag & SNODE_AUTO_RENDER) {
+ if (type==NTREE_COMPOSIT) {
+ if (snode->flag & SNODE_AUTO_RENDER) {
snode->recalc= 1;
ED_area_tag_refresh(sa);
}
@@ -193,48 +193,48 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_WM:
- if(wmn->data==ND_FILEREAD)
+ if (wmn->data==ND_FILEREAD)
ED_area_tag_refresh(sa);
break;
/* future: add ID checks? */
case NC_MATERIAL:
- if(type==NTREE_SHADER) {
- if(wmn->data==ND_SHADING)
+ if (type==NTREE_SHADER) {
+ if (wmn->data==ND_SHADING)
ED_area_tag_refresh(sa);
- else if(wmn->data==ND_SHADING_DRAW)
+ else if (wmn->data==ND_SHADING_DRAW)
ED_area_tag_refresh(sa);
- else if(wmn->action==NA_ADDED && snode->edittree)
+ else if (wmn->action==NA_ADDED && snode->edittree)
nodeSetActiveID(snode->edittree, ID_MA, wmn->reference);
}
break;
case NC_TEXTURE:
- if(type==NTREE_SHADER || type==NTREE_TEXTURE) {
- if(wmn->data==ND_NODES)
+ if (type==NTREE_SHADER || type==NTREE_TEXTURE) {
+ if (wmn->data==ND_NODES)
ED_area_tag_refresh(sa);
}
break;
case NC_WORLD:
- if(type==NTREE_SHADER && shader_type==SNODE_SHADER_WORLD) {
+ if (type==NTREE_SHADER && shader_type==SNODE_SHADER_WORLD) {
ED_area_tag_refresh(sa);
}
break;
case NC_OBJECT:
- if(type==NTREE_SHADER) {
- if(wmn->data==ND_OB_SHADING)
+ if (type==NTREE_SHADER) {
+ if (wmn->data==ND_OB_SHADING)
ED_area_tag_refresh(sa);
}
break;
case NC_TEXT:
/* pynodes */
- if(wmn->data==ND_SHADING)
+ if (wmn->data==ND_SHADING)
ED_area_tag_refresh(sa);
break;
case NC_SPACE:
- if(wmn->data==ND_SPACE_NODE)
+ if (wmn->data==ND_SPACE_NODE)
ED_area_tag_refresh(sa);
- else if(wmn->data==ND_SPACE_NODE_VIEW)
+ else if (wmn->data==ND_SPACE_NODE_VIEW)
ED_area_tag_redraw(sa);
break;
case NC_NODE:
@@ -253,11 +253,11 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
case NC_IMAGE:
if (wmn->action == NA_EDITED) {
- if(type==NTREE_COMPOSIT) {
+ if (type==NTREE_COMPOSIT) {
/* note that nodeUpdateID is already called by BKE_image_signal() on all
* scenes so really this is just to know if the images is used in the compo else
* painting on images could become very slow when the compositor is open. */
- if(nodeUpdateID(snode->nodetree, wmn->reference))
+ if (nodeUpdateID(snode->nodetree, wmn->reference))
ED_area_tag_refresh(sa);
}
}
@@ -272,29 +272,29 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
snode_set_context(snode, CTX_data_scene(C));
- if(snode->nodetree) {
- if(snode->treetype==NTREE_SHADER) {
- if(GS(snode->id->name) == ID_MA) {
+ if (snode->nodetree) {
+ if (snode->treetype==NTREE_SHADER) {
+ if (GS(snode->id->name) == ID_MA) {
Material *ma= (Material *)snode->id;
- if(ma->use_nodes)
+ if (ma->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
- else if(GS(snode->id->name) == ID_LA) {
+ else if (GS(snode->id->name) == ID_LA) {
Lamp *la= (Lamp *)snode->id;
- if(la->use_nodes)
+ if (la->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
- else if(GS(snode->id->name) == ID_WO) {
+ else if (GS(snode->id->name) == ID_WO) {
World *wo= (World *)snode->id;
- if(wo->use_nodes)
+ if (wo->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
}
- else if(snode->treetype==NTREE_COMPOSIT) {
+ else if (snode->treetype==NTREE_COMPOSIT) {
Scene *scene= (Scene *)snode->id;
- if(scene->use_nodes) {
+ if (scene->use_nodes) {
/* recalc is set on 3d view changes for auto compo */
- if(snode->recalc) {
+ if (snode->recalc) {
snode->recalc= 0;
node_render_changed_exec((struct bContext*)C, NULL);
}
@@ -302,9 +302,9 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
snode_composite_job(C, sa);
}
}
- else if(snode->treetype==NTREE_TEXTURE) {
+ else if (snode->treetype==NTREE_TEXTURE) {
Tex *tex= (Tex *)snode->id;
- if(tex->use_nodes) {
+ if (tex->use_nodes) {
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
}
@@ -330,7 +330,7 @@ static void node_buttons_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap= WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -348,10 +348,10 @@ static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymaps */
- keymap= WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Node Editor", SPACE_NODE, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Node Editor", SPACE_NODE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
/* add drop boxes */
@@ -372,13 +372,13 @@ static void node_main_area_draw(const bContext *C, ARegion *ar)
static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if(drag->type==WM_DRAG_ID) {
+ if (drag->type==WM_DRAG_ID) {
ID *id= (ID *)drag->poin;
- if( GS(id->name)==ID_IM )
+ if ( GS(id->name)==ID_IM )
return 1;
}
- else if(drag->type==WM_DRAG_PATH){
- if(ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
+ else if (drag->type==WM_DRAG_PATH) {
+ if (ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
return 1;
}
return 0;
@@ -388,7 +388,7 @@ static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
{
ID *id= (ID *)drag->poin;
- if(id) {
+ if (id) {
RNA_string_set(drop->ptr, "name", id->name+2);
}
if (drag->path[0]) {
@@ -431,11 +431,11 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch(wmn->category) {
case NC_SPACE:
- if(wmn->data==ND_SPACE_NODE)
+ if (wmn->data==ND_SPACE_NODE)
ED_region_tag_redraw(ar);
break;
case NC_SCREEN:
- if(wmn->data == ND_GPENCIL)
+ if (wmn->data == ND_GPENCIL)
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
@@ -445,11 +445,11 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_OBJECT:
- if(wmn->data==ND_OB_SHADING)
+ if (wmn->data==ND_OB_SHADING)
ED_region_tag_redraw(ar);
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
}
@@ -461,16 +461,16 @@ static int node_context(const bContext *C, const char *member, bContextDataResul
{
SpaceNode *snode= CTX_wm_space_node(C);
- if(CTX_data_dir(member)) {
+ if (CTX_data_dir(member)) {
CTX_data_dir_set(result, node_context_dir);
return 1;
}
- else if(CTX_data_equals(member, "selected_nodes")) {
+ else if (CTX_data_equals(member, "selected_nodes")) {
bNode *node;
- if(snode->edittree) {
- for(node=snode->edittree->nodes.last; node; node=node->prev) {
- if(node->flag & NODE_SELECT) {
+ if (snode->edittree) {
+ for (node=snode->edittree->nodes.last; node; node=node->prev) {
+ if (node->flag & NODE_SELECT) {
CTX_data_list_add(result, &snode->edittree->id, &RNA_Node, node);
}
}
@@ -478,12 +478,12 @@ static int node_context(const bContext *C, const char *member, bContextDataResul
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
- else if(CTX_data_equals(member, "active_node")) {
+ else if (CTX_data_equals(member, "active_node")) {
bNode *node;
- if(snode->edittree) {
- for(node=snode->edittree->nodes.last; node; node=node->prev) {
- if(node->flag & NODE_ACTIVE) {
+ if (snode->edittree) {
+ for (node=snode->edittree->nodes.last; node; node=node->prev) {
+ if (node->flag & NODE_ACTIVE) {
CTX_data_pointer_set(result, &snode->edittree->id, &RNA_Node, node);
break;
}
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index f0115170525..73289dce968 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -95,9 +95,9 @@
static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
{
TreeElement *te= lb->first;
- while(te) {
+ while (te) {
TreeStoreElem *tselem= TREESTORE(te);
- if(TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem,soops))
outliner_height(soops, &te->subtree, h);
(*h) += UI_UNIT_Y;
te= te->next;
@@ -108,11 +108,11 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
{
TreeElement *te= lb->first;
- while(te) {
+ while (te) {
// TreeStoreElem *tselem= TREESTORE(te);
// XXX fixme... te->xend is not set yet
- if(!TSELEM_OPEN(tselem,soops)) {
+ if (!TSELEM_OPEN(tselem,soops)) {
if (te->xend > *w)
*w = te->xend;
}
@@ -125,19 +125,19 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int startx)
{
TreeElement *te= lb->first;
- while(te) {
+ while (te) {
TreeStoreElem *tselem= TREESTORE(te);
// XXX fixme... (currently, we're using a fixed length of 100)!
#if 0
- if(te->xend) {
- if(te->xend > *w)
+ if (te->xend) {
+ if (te->xend > *w)
*w = te->xend;
}
#endif
- if(startx+100 > *w)
+ if (startx+100 > *w)
*w = startx+100;
- if(TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem,soops))
outliner_rna_width(soops, &te->subtree, w, startx+UI_UNIT_X);
te= te->next;
}
@@ -150,7 +150,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
Scene *scene = (Scene *)poin;
Object *ob = (Object *)poin2;
- if(!common_restrict_check(C, ob)) return;
+ if (!common_restrict_check(C, ob)) return;
/* deselect objects that are invisible */
if (ob->restrictflag & OB_RESTRICT_VIEW) {
@@ -167,7 +167,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
Scene *scene = (Scene *)poin;
Object *ob = (Object *)poin2;
- if(!common_restrict_check(C, ob)) return;
+ if (!common_restrict_check(C, ob)) return;
/* if select restriction has just been turned on */
if (ob->restrictflag & OB_RESTRICT_SELECT) {
@@ -201,7 +201,7 @@ static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *po
static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2)
{
Bone *bone= (Bone *)poin2;
- if(bone && (bone->flag & BONE_HIDDEN_P))
+ if (bone && (bone->flag & BONE_HIDDEN_P))
bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
}
@@ -209,7 +209,7 @@ static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2)
static void restrictbutton_ebone_cb(bContext *C, void *UNUSED(poin), void *poin2)
{
EditBone *ebone= (EditBone *)poin2;
- if(ebone && (ebone->flag & BONE_HIDDEN_A))
+ if (ebone && (ebone->flag & BONE_HIDDEN_A))
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
@@ -219,8 +219,8 @@ static int group_restrict_flag(Group *gr, int flag)
{
GroupObject *gob;
- for(gob= gr->gobject.first; gob; gob= gob->next) {
- if((gob->ob->restrictflag & flag) == 0)
+ for (gob= gr->gobject.first; gob; gob= gob->next) {
+ if ((gob->ob->restrictflag & flag) == 0)
return 0;
}
@@ -231,8 +231,8 @@ static int group_select_flag(Group *gr)
{
GroupObject *gob;
- for(gob= gr->gobject.first; gob; gob= gob->next)
- if((gob->ob->flag & SELECT))
+ for (gob= gr->gobject.first; gob; gob= gob->next)
+ if ((gob->ob->flag & SELECT))
return 1;
return 0;
@@ -244,23 +244,23 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
GroupObject *gob;
Group *gr = (Group *)poin2;
- if(group_restrict_flag(gr, flag)) {
- for(gob= gr->gobject.first; gob; gob= gob->next) {
+ if (group_restrict_flag(gr, flag)) {
+ for (gob= gr->gobject.first; gob; gob= gob->next) {
gob->ob->restrictflag &= ~flag;
- if(flag==OB_RESTRICT_VIEW)
- if(gob->ob->flag & SELECT)
+ if (flag==OB_RESTRICT_VIEW)
+ if (gob->ob->flag & SELECT)
ED_base_object_select(object_in_scene(gob->ob, scene), BA_DESELECT);
}
}
else {
- for(gob= gr->gobject.first; gob; gob= gob->next) {
+ for (gob= gr->gobject.first; gob; gob= gob->next) {
/* not in editmode */
- if(scene->obedit!=gob->ob) {
+ if (scene->obedit!=gob->ob) {
gob->ob->restrictflag |= flag;
- if(flag==OB_RESTRICT_VIEW)
- if((gob->ob->flag & SELECT) == 0)
+ if (flag==OB_RESTRICT_VIEW)
+ if ((gob->ob->flag & SELECT) == 0)
ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT);
}
}
@@ -292,10 +292,10 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
TreeStore *ts= soops->treestore;
TreeStoreElem *tselem= tsep;
- if(ts && tselem) {
+ if (ts && tselem) {
TreeElement *te= outliner_find_tse(soops, tselem);
- if(tselem->type==0) {
+ if (tselem->type==0) {
test_idbutton(tselem->id->name+2); // library.c, unique name and alpha sort
switch(GS(tselem->id->name)) {
@@ -335,7 +335,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
case TSE_EBONE:
{
bArmature *arm= (bArmature *)tselem->id;
- if(arm->edbo) {
+ if (arm->edbo) {
EditBone *ebone= te->directdata;
char newname[sizeof(ebone->name)];
@@ -407,11 +407,11 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
Object *ob = NULL;
Group *gr = NULL;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
+ if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
/* objects have toggle-able restriction flags */
- if(tselem->type==0 && te->idcode==ID_OB) {
+ if (tselem->type==0 && te->idcode==ID_OB) {
PointerRNA ptr;
ob = (Object *)tselem->id;
@@ -436,7 +436,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSS);
}
- if(tselem->type==0 && te->idcode==ID_GR){
+ if (tselem->type==0 && te->idcode==ID_GR) {
int restrict_bool;
gr = (Group *)tselem->id;
@@ -457,7 +457,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSS);
}
/* scene render layers and passes have toggle-able flags too! */
- else if(tselem->type==TSE_R_LAYER) {
+ else if (tselem->type==TSE_R_LAYER) {
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT-1,
@@ -466,7 +466,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSS);
}
- else if(tselem->type==TSE_R_PASS) {
+ else if (tselem->type==TSE_R_PASS) {
int *layflag= te->directdata;
int passflag= 1<<tselem->nr;
@@ -478,14 +478,14 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
layflag++; /* is lay_xor */
- if(ELEM8(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT))
+ if (ELEM8(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT))
bt= uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag)?ICON_DOT:ICON_BLANK1,
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined");
uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
uiBlockSetEmboss(block, UI_EMBOSS);
}
- else if(tselem->type==TSE_MODIFIER) {
+ else if (tselem->type==TSE_MODIFIER) {
ModifierData *md= (ModifierData *)te->directdata;
ob = (Object *)tselem->id;
@@ -498,7 +498,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow renderability");
uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob);
}
- else if(tselem->type==TSE_POSE_CHANNEL) {
+ else if (tselem->type==TSE_POSE_CHANNEL) {
bPoseChannel *pchan= (bPoseChannel *)te->directdata;
Bone *bone = pchan->bone;
@@ -511,7 +511,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL);
}
- else if(tselem->type==TSE_EBONE) {
+ else if (tselem->type==TSE_EBONE) {
EditBone *ebone= (EditBone *)te->directdata;
uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -525,7 +525,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
}
}
- if(TSELEM_OPEN(tselem,soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem,soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
}
}
@@ -534,7 +534,7 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex)
View2D *v2d= &ar->v2d;
float miny = v2d->cur.ymin-V2D_SCROLL_HEIGHT;
- if(miny<v2d->tot.ymin) miny = v2d->tot.ymin;
+ if (miny<v2d->tot.ymin) miny = v2d->tot.ymin;
UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
@@ -559,17 +559,17 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
uiBlockSetEmboss(block, UI_EMBOSST);
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
- if(tselem->type == TSE_RNA_PROPERTY) {
+ if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
+ if (tselem->type == TSE_RNA_PROPERTY) {
ptr= &te->rnaptr;
prop= te->directdata;
- if(!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem,soops))) )
+ if (!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem,soops))) )
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y-1);
}
- else if(tselem->type == TSE_RNA_ARRAY_ELEM) {
+ else if (tselem->type == TSE_RNA_ARRAY_ELEM) {
ptr= &te->rnaptr;
prop= te->directdata;
@@ -577,16 +577,16 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
}
}
- if(TSELEM_OPEN(tselem,soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree);
+ if (TSELEM_OPEN(tselem,soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree);
}
}
static void operator_call_cb(struct bContext *UNUSED(C), void *arg_kmi, void *arg2)
{
wmOperatorType *ot= arg2;
- wmKeyMapItem *kmi= arg_kmi;
+ wmKeyMapItem *kmi = arg_kmi;
- if(ot)
+ if (ot)
BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME);
}
@@ -594,16 +594,16 @@ static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(ar
{
GHashIterator *iter= WM_operatortype_iter();
- for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+ for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
- if(BLI_strcasestr(ot->idname, str)) {
+ if (BLI_strcasestr(ot->idname, str)) {
char name[OP_MAX_TYPENAME];
/* display name for menu */
WM_operator_py_idname(name, ot->idname);
- if(0==uiSearchItemAdd(items, name, ot, 0))
+ if (0==uiSearchItemAdd(items, name, ot, 0))
break;
}
}
@@ -616,7 +616,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
static char search[OP_MAX_TYPENAME];
wmEvent event;
wmWindow *win= CTX_wm_window(C);
- wmKeyMapItem *kmi= arg_kmi;
+ wmKeyMapItem *kmi = arg_kmi;
wmOperatorType *ot= WM_operatortype_find(kmi->idname, 0);
uiBlock *block;
uiBut *but;
@@ -630,7 +630,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
/* fake button, it holds space for search items */
uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
- but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, UI_UNIT_Y, 0, 0, "");
+ but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, UI_UNIT_Y, 0, 0, "");
uiButSetSearchFunc(but, operator_search_cb, arg_kmi, operator_call_cb, ot);
uiBoundsBlock(block, 6);
@@ -654,9 +654,9 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
static short keymap_menu_type(short type)
{
- if(ISKEYBOARD(type)) return OL_KM_KEYBOARD;
- if(ISTWEAK(type)) return OL_KM_TWEAK;
- if(ISMOUSE(type)) return OL_KM_MOUSE;
+ if (ISKEYBOARD(type)) return OL_KM_KEYBOARD;
+ if (ISTWEAK(type)) return OL_KM_TWEAK;
+ if (ISMOUSE(type)) return OL_KM_MOUSE;
// return OL_KM_SPECIALS;
return 0;
}
@@ -735,10 +735,10 @@ static const char *keymap_tweak_dir_menu(void)
static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v))
{
- wmKeyMapItem *kmi= kmi_v;
+ wmKeyMapItem *kmi = kmi_v;
short maptype= keymap_menu_type(kmi->type);
- if(maptype!=kmi->maptype) {
+ if (maptype!=kmi->maptype) {
switch(kmi->maptype) {
case OL_KM_KEYBOARD:
kmi->type= AKEY;
@@ -767,9 +767,9 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
uiBlockSetEmboss(block, UI_EMBOSST);
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
+ if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
uiBut *but;
const char *str;
int xstart= 240;
@@ -777,11 +777,11 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
int butw2= 90; /* event type, menus */
int butw3= 43; /* modifiers */
- if(tselem->type == TSE_KEYMAP_ITEM) {
- wmKeyMapItem *kmi= te->directdata;
+ if (tselem->type == TSE_KEYMAP_ITEM) {
+ wmKeyMapItem *kmi = te->directdata;
/* modal map? */
- if(kmi->propvalue);
+ if (kmi->propvalue);
else {
uiDefBlockBut(block, operator_search_menu, kmi, "", xstart, (int)te->ys+1, butw1, UI_UNIT_Y-1, "Assign new Operator");
}
@@ -791,7 +791,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
kmi->maptype= keymap_menu_type(kmi->type);
str= keymap_type_menu();
- but= uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->maptype, 0, 0, 0, 0, "Event type");
+ but = uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->maptype, 0, 0, 0, 0, "Event type");
uiButSetFunc(but, keymap_type_cb, kmi, NULL);
xstart+= butw2+5;
@@ -826,7 +826,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
xstart+= butw3+5;
/* rna property */
- if(kmi->ptr && kmi->ptr->data) {
+ if (kmi->ptr && kmi->ptr->data) {
uiDefBut(block, LABEL, 0, "(RNA property)", xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->oskey, 0, 0, 0, 0, ""); xstart+= butw2;
}
@@ -834,7 +834,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
}
}
- if(TSELEM_OPEN(tselem,soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem,soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree);
}
}
@@ -846,38 +846,38 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
TreeStoreElem *tselem;
int spx, dx, len;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
+ if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
- if(tselem->flag & TSE_TEXTBUT) {
+ if (tselem->flag & TSE_TEXTBUT) {
/* If we add support to rename Sequence.
* need change this.
*/
- if(tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature
+ if (tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature
- if(tselem->type==TSE_EBONE) len = sizeof(((EditBone*) 0)->name);
+ if (tselem->type==TSE_EBONE) len = sizeof(((EditBone*) 0)->name);
else if (tselem->type==TSE_MODIFIER) len = sizeof(((ModifierData*) 0)->name);
- else if(tselem->id && GS(tselem->id->name)==ID_LI) len = sizeof(((Library*) 0)->name);
+ else if (tselem->id && GS(tselem->id->name)==ID_LI) len = sizeof(((Library*) 0)->name);
else len= MAX_ID_NAME-2;
dx= (int)UI_GetStringWidth(te->name);
- if(dx<100) dx= 100;
+ if (dx<100) dx= 100;
spx=te->xs+2*UI_UNIT_X-4;
- if(spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10;
+ if (spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10;
bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (int)te->ys, dx+10, UI_UNIT_Y-1, (void *)te->name, 1.0, (float)len, 0, 0, "");
uiButSetRenameFunc(bt, namebutton_cb, tselem);
/* returns false if button got removed */
- if( 0 == uiButActiveOnly(C, block, bt) )
+ if ( 0 == uiButActiveOnly(C, block, bt) )
tselem->flag &= ~TSE_TEXTBUT;
}
}
- if(TSELEM_OPEN(tselem,soops)) outliner_buttons(C, block, ar, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem,soops)) outliner_buttons(C, block, ar, soops, &te->subtree);
}
}
@@ -895,16 +895,17 @@ struct DrawIconArg {
static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon)
{
/* restrict column clip... it has been coded by simply overdrawing, doesnt work for buttons */
- if(arg->x >= arg->xmax) {
+ if (arg->x >= arg->xmax) {
glEnable(GL_BLEND);
UI_icon_draw_aspect(arg->x, arg->y, icon, 1.0f, arg->alpha);
glDisable(GL_BLEND);
- } else {
+ }
+ else {
/* XXX investigate: button placement of icons is way different than UI_icon_draw? */
float ufac= UI_UNIT_X/20.0f;
- uiBut *but= uiDefIconBut(arg->block, LABEL, 0, icon, arg->x-3.0f*ufac, arg->y, UI_UNIT_X-4.0f*ufac, UI_UNIT_Y-4.0f*ufac, NULL, 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : "");
+ uiBut *but = uiDefIconBut(arg->block, LABEL, 0, icon, arg->x-3.0f*ufac, arg->y, UI_UNIT_X-4.0f*ufac, UI_UNIT_Y-4.0f*ufac, NULL, 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : "");
- if(arg->id)
+ if (arg->id)
uiButSetDragID(but, arg->id);
}
@@ -917,12 +918,12 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
/* make function calls a bit compacter */
arg.block= block;
arg.id= tselem->id;
- arg.xmax= xmax;
+ arg.xmax = xmax;
arg.x= x;
arg.y= y;
arg.alpha= alpha;
- if(tselem->type) {
+ if (tselem->type) {
switch( tselem->type) {
case TSE_ANIM_DATA:
UI_icon_draw(x, y, ICON_ANIM_DATA); break; // xxx
@@ -1052,15 +1053,15 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
case TSE_POSEGRP_BASE:
UI_icon_draw(x, y, ICON_VERTEXSEL); break;
case TSE_SEQUENCE:
- if(te->idcode==SEQ_MOVIE)
+ if (te->idcode==SEQ_MOVIE)
UI_icon_draw(x, y, ICON_SEQUENCE);
- else if(te->idcode==SEQ_META)
+ else if (te->idcode==SEQ_META)
UI_icon_draw(x, y, ICON_DOT);
- else if(te->idcode==SEQ_SCENE)
+ else if (te->idcode==SEQ_SCENE)
UI_icon_draw(x, y, ICON_SCENE);
- else if(te->idcode==SEQ_SOUND)
+ else if (te->idcode==SEQ_SOUND)
UI_icon_draw(x, y, ICON_SOUND);
- else if(te->idcode==SEQ_IMAGE)
+ else if (te->idcode==SEQ_IMAGE)
UI_icon_draw(x, y, ICON_IMAGE_COL);
else
UI_icon_draw(x, y, ICON_PARTICLES);
@@ -1072,7 +1073,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
UI_icon_draw(x, y, ICON_OBJECT_DATA);
break;
case TSE_RNA_STRUCT:
- if(RNA_struct_is_ID(te->rnaptr.type)) {
+ if (RNA_struct_is_ID(te->rnaptr.type)) {
arg.id= (ID *)te->rnaptr.data;
tselem_draw_icon_uibut(&arg, RNA_struct_ui_icon(te->rnaptr.type));
}
@@ -1180,26 +1181,26 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
TreeStoreElem *tselem;
int active;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
/* exit drawing early */
- if((*offsx) - UI_UNIT_X > xmax)
+ if ((*offsx) - UI_UNIT_X > xmax)
break;
tselem= TREESTORE(te);
/* object hierarchy always, further constrained on level */
- if(level<1 || (tselem->type==0 && te->idcode==ID_OB)) {
+ if (level<1 || (tselem->type==0 && te->idcode==ID_OB)) {
/* active blocks get white circle */
- if(tselem->type==0) {
- if(te->idcode==ID_OB) active= (OBACT==(Object *)tselem->id);
- else if(scene->obedit && scene->obedit->data==tselem->id) active= 1; // XXX use context?
+ if (tselem->type==0) {
+ if (te->idcode==ID_OB) active= (OBACT==(Object *)tselem->id);
+ else if (scene->obedit && scene->obedit->data==tselem->id) active= 1; // XXX use context?
else active= tree_element_active(C, scene, soops, te, 0);
}
else active= tree_element_type_active(NULL, scene, soops, te, tselem, 0);
- if(active) {
+ if (active) {
float ufac= UI_UNIT_X/20.0f;
uiSetRoundBox(UI_CNR_ALL);
@@ -1217,8 +1218,8 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
(*offsx) += UI_UNIT_X;
}
- /* this tree element always has same amount of branches, so dont draw */
- if(tselem->type!=TSE_R_LAYER)
+ /* this tree element always has same amount of branches, so don't draw */
+ if (tselem->type!=TSE_R_LAYER)
outliner_draw_iconrow(C, block, scene, soops, &te->subtree, level+1, xmax, offsx, ys);
}
@@ -1233,7 +1234,7 @@ static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement *te, i
te->xs= (float)startx;
te->ys= (float)(*starty);
- for(ten= te->subtree.first; ten; ten= ten->next) {
+ for (ten= te->subtree.first; ten; ten= ten->next) {
outliner_set_coord_tree_element(soops, ten, startx+UI_UNIT_X, starty);
}
}
@@ -1248,11 +1249,11 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
tselem= TREESTORE(te);
- if(*starty+2*UI_UNIT_Y >= ar->v2d.cur.ymin && *starty<= ar->v2d.cur.ymax) {
+ if (*starty+2*UI_UNIT_Y >= ar->v2d.cur.ymin && *starty<= ar->v2d.cur.ymax) {
int xmax= ar->v2d.cur.xmax;
- /* icons can be ui buts, we dont want it to overlap with restrict */
- if((soops->flag & SO_HIDE_RESTRICTCOLS)==0)
+ /* icons can be ui buts, we don't want it to overlap with restrict */
+ if ((soops->flag & SO_HIDE_RESTRICTCOLS)==0)
xmax-= OL_TOGW+UI_UNIT_X;
glEnable(GL_BLEND);
@@ -1272,17 +1273,17 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
}
/* colors for active/selected data */
- if(tselem->type==0) {
- if(te->idcode==ID_SCE) {
- if(tselem->id == (ID *)scene) {
+ if (tselem->type==0) {
+ if (te->idcode==ID_SCE) {
+ if (tselem->id == (ID *)scene) {
glColor4ub(255, 255, 255, 100);
active= 2;
}
}
- else if(te->idcode==ID_GR) {
+ else if (te->idcode==ID_GR) {
Group *gr = (Group *)tselem->id;
- if(group_select_flag(gr)) {
+ if (group_select_flag(gr)) {
char col[4];
UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
col[3]= 100;
@@ -1291,24 +1292,24 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
active= 2;
}
}
- else if(te->idcode==ID_OB) {
+ else if (te->idcode==ID_OB) {
Object *ob= (Object *)tselem->id;
- if(ob==OBACT || (ob->flag & SELECT)) {
+ if (ob==OBACT || (ob->flag & SELECT)) {
char col[4]= {0, 0, 0, 0};
/* outliner active ob: always white text, circle color now similar to view3d */
active= 2; /* means it draws a color circle */
- if(ob==OBACT) {
- if(ob->flag & SELECT) {
+ if (ob==OBACT) {
+ if (ob->flag & SELECT) {
UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col);
col[3]= 100;
}
active= 1; /* means it draws white text */
}
- else if(ob->flag & SELECT) {
+ else if (ob->flag & SELECT) {
UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
col[3]= 100;
}
@@ -1317,24 +1318,24 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
}
}
- else if(scene->obedit && scene->obedit->data==tselem->id) {
+ else if (scene->obedit && scene->obedit->data==tselem->id) {
glColor4ub(255, 255, 255, 100);
active= 2;
}
else {
- if(tree_element_active(C, scene, soops, te, 0)) {
+ if (tree_element_active(C, scene, soops, te, 0)) {
glColor4ub(220, 220, 255, 100);
active= 2;
}
}
}
else {
- if( tree_element_type_active(NULL, scene, soops, te, tselem, 0) ) active= 2;
+ if ( tree_element_type_active(NULL, scene, soops, te, tselem, 0) ) active= 2;
glColor4ub(220, 220, 255, 100);
}
/* active circle */
- if(active) {
+ if (active) {
uiSetRoundBox(UI_CNR_ALL);
uiRoundBox( (float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
glEnable(GL_BLEND); /* roundbox disables it */
@@ -1343,15 +1344,15 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
}
/* open/close icon, only when sublevels, except for scene */
- if(te->subtree.first || (tselem->type==0 && te->idcode==ID_SCE) || (te->flag & TE_LAZY_CLOSED)) {
+ if (te->subtree.first || (tselem->type==0 && te->idcode==ID_SCE) || (te->flag & TE_LAZY_CLOSED)) {
int icon_x;
- if(tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE))
+ if (tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE))
icon_x = startx;
else
icon_x = startx+5*ufac;
// icons a bit higher
- if(TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem,soops))
UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_DOWN);
else
UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_RIGHT);
@@ -1360,7 +1361,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
/* datatype icon */
- if(!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))) {
+ if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))) {
// icons a bit higher
tselem_draw_icon(block, xmax, (float)startx+offsx - 0.5f*ufac, (float)*starty+2.0f*ufac, tselem, te, 1.0f);
@@ -1369,9 +1370,9 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
else
offsx+= 2*ufac;
- if(tselem->type==0 && tselem->id->lib) {
+ if (tselem->type==0 && tselem->id->lib) {
glPixelTransferf(GL_ALPHA_SCALE, 0.5f);
- if(tselem->id->flag & LIB_INDIRECT)
+ if (tselem->id->flag & LIB_INDIRECT)
UI_icon_draw((float)startx+offsx, (float)*starty+2*ufac, ICON_LIBRARY_DATA_INDIRECT);
else
UI_icon_draw((float)startx+offsx, (float)*starty+2*ufac, ICON_LIBRARY_DATA_DIRECT);
@@ -1381,8 +1382,8 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
glDisable(GL_BLEND);
/* name */
- if(active==1) UI_ThemeColor(TH_TEXT_HI);
- else if(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f);
+ if (active==1) UI_ThemeColor(TH_TEXT_HI);
+ else if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f);
else UI_ThemeColor(TH_TEXT);
UI_DrawString(startx+offsx, *starty+5*ufac, te->name);
@@ -1390,10 +1391,10 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
offsx+= (int)(UI_UNIT_X + UI_GetStringWidth(te->name));
/* closed item, we draw the icons, not when it's a scene, or master-server list though */
- if(!TSELEM_OPEN(tselem,soops)) {
- if(te->subtree.first) {
- if(tselem->type==0 && te->idcode==ID_SCE);
- else if(tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so dont draw */
+ if (!TSELEM_OPEN(tselem,soops)) {
+ if (te->subtree.first) {
+ if (tselem->type==0 && te->idcode==ID_SCE);
+ else if (tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so don't draw */
int tempx= startx+offsx;
// divider
@@ -1416,14 +1417,14 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
te->ys= (float)*starty;
te->xend= startx+offsx;
- if(TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem,soops)) {
*starty-= UI_UNIT_Y;
- for(ten= te->subtree.first; ten; ten= ten->next)
+ for (ten= te->subtree.first; ten; ten= ten->next)
outliner_draw_tree_element(C, block, scene, ar, soops, ten, startx+UI_UNIT_X, starty);
}
else {
- for(ten= te->subtree.first; ten; ten= ten->next)
+ for (ten= te->subtree.first; ten; ten= ten->next)
outliner_set_coord_tree_element(soops, te, startx, starty);
*starty-= UI_UNIT_Y;
@@ -1436,28 +1437,28 @@ static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx,
TreeStoreElem *tselem;
int y1, y2;
- if(lb->first==NULL) return;
+ if (lb->first==NULL) return;
y1=y2= *starty; /* for vertical lines between objects */
- for(te=lb->first; te; te= te->next) {
+ for (te=lb->first; te; te= te->next) {
y2= *starty;
tselem= TREESTORE(te);
/* horizontal line? */
- if(tselem->type==0 && (te->idcode==ID_OB || te->idcode==ID_SCE))
+ if (tselem->type==0 && (te->idcode==ID_OB || te->idcode==ID_SCE))
glRecti(startx, *starty, startx+UI_UNIT_X, *starty-1);
*starty-= UI_UNIT_Y;
- if(TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem,soops))
outliner_draw_hierarchy(soops, &te->subtree, startx+UI_UNIT_X, starty);
}
/* vertical line */
te= lb->last;
- if(te->parent || lb->first!=lb->last) {
+ if (te->parent || lb->first!=lb->last) {
tselem= TREESTORE(te);
- if(tselem->type==0 && te->idcode==ID_OB) {
+ if (tselem->type==0 && te->idcode==ID_OB) {
glRecti(startx, y1+UI_UNIT_Y, startx+1, y2);
}
@@ -1469,18 +1470,18 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
TreeElement *te;
TreeStoreElem *tselem;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
/* selection status */
- if(TSELEM_OPEN(tselem,soops))
- if(tselem->type == TSE_RNA_STRUCT)
+ if (TSELEM_OPEN(tselem,soops))
+ if (tselem->type == TSE_RNA_STRUCT)
glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+UI_UNIT_Y-1);
*starty-= UI_UNIT_Y;
- if(TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem,soops)) {
outliner_draw_struct_marks(ar, soops, &te->subtree, starty);
- if(tselem->type == TSE_RNA_STRUCT)
+ if (tselem->type == TSE_RNA_STRUCT)
fdrawline(0, (float)*starty+UI_UNIT_Y, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+UI_UNIT_Y);
}
}
@@ -1491,15 +1492,15 @@ static void outliner_draw_selection(ARegion *ar, SpaceOops *soops, ListBase *lb,
TreeElement *te;
TreeStoreElem *tselem;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
/* selection status */
- if(tselem->flag & TSE_SELECTED) {
+ if (tselem->flag & TSE_SELECTED) {
glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1);
}
*starty-= UI_UNIT_Y;
- if(TSELEM_OPEN(tselem,soops)) outliner_draw_selection(ar, soops, &te->subtree, starty);
+ if (TSELEM_OPEN(tselem,soops)) outliner_draw_selection(ar, soops, &te->subtree, starty);
}
}
@@ -1535,7 +1536,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
// items themselves
starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y-OL_Y_OFFSET;
startx= 0;
- for(te= soops->tree.first; te; te= te->next) {
+ for (te= soops->tree.first; te; te= te->next) {
outliner_draw_tree_element(C, block, scene, ar, soops, te, startx, &starty);
}
}
@@ -1549,7 +1550,7 @@ static void outliner_back(ARegion *ar)
ystart= (int)ar->v2d.tot.ymax;
ystart= UI_UNIT_Y*(ystart/(UI_UNIT_Y))-OL_Y_OFFSET;
- while(ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) {
+ while (ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) {
glRecti(0, ystart, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, ystart+UI_UNIT_Y);
ystart-= 2*UI_UNIT_Y;
}
@@ -1567,7 +1568,7 @@ static void outliner_draw_restrictcols(ARegion *ar)
ystart= (int)ar->v2d.tot.ymax;
ystart= UI_UNIT_Y*(ystart/(UI_UNIT_Y))-OL_Y_OFFSET;
- while(ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) {
+ while (ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) {
glRecti((int)ar->v2d.cur.xmax-OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart+UI_UNIT_Y);
ystart-= 2*UI_UNIT_Y;
}
@@ -1660,12 +1661,12 @@ void draw_outliner(const bContext *C)
block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
outliner_draw_tree((bContext *)C, block, scene, ar, soops);
- if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
+ if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
/* draw rna buttons */
outliner_draw_rnacols(ar, sizex_rna);
outliner_draw_rnabuts(block, scene, ar, soops, sizex_rna, &soops->tree);
}
- else if(soops->outlinevis == SO_KEYMAP) {
+ else if (soops->outlinevis == SO_KEYMAP) {
outliner_draw_keymapbuts(block, ar, soops, &soops->tree);
}
else if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) {
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index e844688b6c2..c59cd626a93 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -158,24 +158,24 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te
static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, int all, const float mval[2])
{
- if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
+ if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
TreeStoreElem *tselem= TREESTORE(te);
/* all below close/open? */
- if(all) {
+ if (all) {
tselem->flag &= ~TSE_CLOSED;
outliner_set_flag(soops, &te->subtree, TSE_CLOSED, !outliner_has_one_flag(soops, &te->subtree, TSE_CLOSED, 1));
}
else {
- if(tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED;
+ if (tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED;
else tselem->flag |= TSE_CLOSED;
}
return 1;
}
- for(te= te->subtree.first; te; te= te->next) {
- if(do_outliner_item_openclose(C, soops, te, all, mval))
+ for (te= te->subtree.first; te; te= te->next) {
+ if (do_outliner_item_openclose(C, soops, te, all, mval))
return 1;
}
return 0;
@@ -193,8 +193,8 @@ static int outliner_item_openclose(bContext *C, wmOperator *op, wmEvent *event)
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
- for(te= soops->tree.first; te; te= te->next) {
- if(do_outliner_item_openclose(C, soops, te, all, fmval))
+ for (te= soops->tree.first; te; te= te->next) {
+ if (do_outliner_item_openclose(C, soops, te, all, fmval))
break;
}
@@ -205,13 +205,13 @@ static int outliner_item_openclose(bContext *C, wmOperator *op, wmEvent *event)
void OUTLINER_OT_item_openclose(wmOperatorType *ot)
{
- ot->name= "Open/Close Item";
- ot->idname= "OUTLINER_OT_item_openclose";
- ot->description= "Toggle whether item under cursor is enabled or closed";
+ ot->name = "Open/Close Item";
+ ot->idname = "OUTLINER_OT_item_openclose";
+ ot->description = "Toggle whether item under cursor is enabled or closed";
- ot->invoke= outliner_item_openclose;
+ ot->invoke = outliner_item_openclose;
- ot->poll= ED_operator_outliner_active;
+ ot->poll = ED_operator_outliner_active;
RNA_def_boolean(ot->srna, "all", 1, "All", "Close or open all items");
}
@@ -221,21 +221,21 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
{
/* can't rename rna datablocks entries */
- if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
+ if (ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
/* do nothing */;
}
- else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE,
+ else if (ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE,
TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
{
BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
}
- else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
+ else if (ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
BKE_report(reports, RPT_WARNING, "Cannot edit sequence name");
}
- else if(tselem->id->lib) {
+ else if (tselem->id->lib) {
// XXX error_libdata();
}
- else if(te->idcode == ID_LI && te->parent) {
+ else if (te->idcode == ID_LI && te->parent) {
BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly linked library");
}
else {
@@ -255,19 +255,19 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T
{
ReportList *reports= CTX_wm_reports(C); // XXX
- if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
+ if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
TreeStoreElem *tselem= TREESTORE(te);
/* name and first icon */
- if(mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
+ if (mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
do_item_rename(ar, te, tselem, reports);
}
return 1;
}
- for(te= te->subtree.first; te; te= te->next) {
- if(do_outliner_item_rename(C, ar, soops, te, mval)) return 1;
+ for (te= te->subtree.first; te; te= te->next) {
+ if (do_outliner_item_rename(C, ar, soops, te, mval)) return 1;
}
return 0;
}
@@ -281,8 +281,8 @@ static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
- for(te= soops->tree.first; te; te= te->next) {
- if(do_outliner_item_rename(C, ar, soops, te, fmval)) break;
+ for (te= soops->tree.first; te; te= te->next) {
+ if (do_outliner_item_rename(C, ar, soops, te, fmval)) break;
}
return OPERATOR_FINISHED;
@@ -291,13 +291,13 @@ static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
void OUTLINER_OT_item_rename(wmOperatorType *ot)
{
- ot->name= "Rename Item";
- ot->idname= "OUTLINER_OT_item_rename";
- ot->description= "Rename item under cursor";
+ ot->name = "Rename Item";
+ ot->idname = "OUTLINER_OT_item_rename";
+ ot->description = "Rename item under cursor";
- ot->invoke= outliner_item_rename;
+ ot->invoke = outliner_item_rename;
- ot->poll= ED_operator_outliner_active;
+ ot->poll = ED_operator_outliner_active;
}
/* ************************************************************** */
@@ -313,10 +313,10 @@ static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel)
TreeElement *te;
int level=curlevel, lev;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
lev= outliner_count_levels(soops, &te->subtree, curlevel+1);
- if(lev>level) level= lev;
+ if (lev>level) level= lev;
}
return level;
}
@@ -327,12 +327,12 @@ int outliner_has_one_flag(SpaceOops *soops, ListBase *lb, short flag, short curl
TreeStoreElem *tselem;
int level;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(tselem->flag & flag) return curlevel;
+ if (tselem->flag & flag) return curlevel;
level= outliner_has_one_flag(soops, &te->subtree, flag, curlevel+1);
- if(level) return level;
+ if (level) return level;
}
return 0;
}
@@ -342,9 +342,9 @@ void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short set)
TreeElement *te;
TreeStoreElem *tselem;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(set==0) tselem->flag &= ~flag;
+ if (set==0) tselem->flag &= ~flag;
else tselem->flag |= flag;
outliner_set_flag(soops, &te->subtree, flag, set);
}
@@ -385,10 +385,10 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre
Object *ob = (Object *)tselem->id;
/* add check for edit mode */
- if(!common_restrict_check(C, ob)) return;
+ if (!common_restrict_check(C, ob)) return;
- if(base || (base= object_in_scene(ob, scene))) {
- if((base->object->restrictflag ^= OB_RESTRICT_VIEW)) {
+ if (base || (base= object_in_scene(ob, scene))) {
+ if ((base->object->restrictflag ^= OB_RESTRICT_VIEW)) {
ED_base_object_select(base, BA_DESELECT);
}
}
@@ -417,15 +417,15 @@ static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op))
void OUTLINER_OT_visibility_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Visibility";
- ot->idname= "OUTLINER_OT_visibility_toggle";
- ot->description= "Toggle the visibility of selected items";
+ ot->name = "Toggle Visibility";
+ ot->idname = "OUTLINER_OT_visibility_toggle";
+ ot->description = "Toggle the visibility of selected items";
/* callbacks */
- ot->exec= outliner_toggle_visibility_exec;
- ot->poll= ED_operator_outliner_active_no_editobject;
+ ot->exec = outliner_toggle_visibility_exec;
+ ot->poll = ED_operator_outliner_active_no_editobject;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* Toggle Selectability ---------------------------------------- */
@@ -434,8 +434,8 @@ void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme
{
Base *base= (Base *)te->directdata;
- if(base==NULL) base= object_in_scene((Object *)tselem->id, scene);
- if(base) {
+ if (base==NULL) base= object_in_scene((Object *)tselem->id, scene);
+ if (base) {
base->object->restrictflag^=OB_RESTRICT_SELECT;
}
}
@@ -463,15 +463,15 @@ static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op
void OUTLINER_OT_selectability_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Selectability";
- ot->idname= "OUTLINER_OT_selectability_toggle";
- ot->description= "Toggle the selectability";
+ ot->name = "Toggle Selectability";
+ ot->idname = "OUTLINER_OT_selectability_toggle";
+ ot->description = "Toggle the selectability";
/* callbacks */
- ot->exec= outliner_toggle_selectability_exec;
- ot->poll= ED_operator_outliner_active_no_editobject;
+ ot->exec = outliner_toggle_selectability_exec;
+ ot->poll = ED_operator_outliner_active_no_editobject;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* Toggle Renderability ---------------------------------------- */
@@ -480,8 +480,8 @@ void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme
{
Base *base= (Base *)te->directdata;
- if(base==NULL) base= object_in_scene((Object *)tselem->id, scene);
- if(base) {
+ if (base==NULL) base= object_in_scene((Object *)tselem->id, scene);
+ if (base) {
base->object->restrictflag^=OB_RESTRICT_RENDER;
}
}
@@ -507,15 +507,15 @@ static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op
void OUTLINER_OT_renderability_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Renderability";
- ot->idname= "OUTLINER_OT_renderability_toggle";
- ot->description= "Toggle the renderability of selected items";
+ ot->name = "Toggle Renderability";
+ ot->idname = "OUTLINER_OT_renderability_toggle";
+ ot->description = "Toggle the renderability of selected items";
/* callbacks */
- ot->exec= outliner_toggle_renderability_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->exec = outliner_toggle_renderability_exec;
+ ot->poll = ED_operator_outliner_active;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* =============================================== */
@@ -541,13 +541,13 @@ static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op))
void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Expand/Collapse All";
- ot->idname= "OUTLINER_OT_expanded_toggle";
- ot->description= "Expand/Collapse all items";
+ ot->name = "Expand/Collapse All";
+ ot->idname = "OUTLINER_OT_expanded_toggle";
+ ot->description = "Expand/Collapse all items";
/* callbacks */
- ot->exec= outliner_toggle_expanded_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->exec = outliner_toggle_expanded_exec;
+ ot->poll = ED_operator_outliner_active;
/* no undo or registry, UI option */
}
@@ -576,13 +576,13 @@ static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op))
void OUTLINER_OT_selected_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Selected";
- ot->idname= "OUTLINER_OT_selected_toggle";
- ot->description= "Toggle the Outliner selection of items";
+ ot->name = "Toggle Selected";
+ ot->idname = "OUTLINER_OT_selected_toggle";
+ ot->description = "Toggle the Outliner selection of items";
/* callbacks */
- ot->exec= outliner_toggle_selected_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->exec = outliner_toggle_selected_exec;
+ ot->poll = ED_operator_outliner_active;
/* no undo or registry, UI option */
}
@@ -612,8 +612,8 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
ytop= (int)(te->ys + (v2d->mask.ymax - v2d->mask.ymin)/2);
if (ytop>0) ytop= 0;
- v2d->cur.ymax= (float)ytop;
- v2d->cur.ymin= (float)(ytop-(v2d->mask.ymax - v2d->mask.ymin));
+ v2d->cur.ymax = (float)ytop;
+ v2d->cur.ymin = (float)(ytop-(v2d->mask.ymax - v2d->mask.ymin));
/* make te->xs ==> te->xend center of view */
xdelta = (int)(te->xs - v2d->cur.xmin);
@@ -631,13 +631,13 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
void OUTLINER_OT_show_active(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Show Active";
- ot->idname= "OUTLINER_OT_show_active";
- ot->description= "Adjust the view so that the active Object is shown centered";
+ ot->name = "Show Active";
+ ot->idname = "OUTLINER_OT_show_active";
+ ot->description = "Adjust the view so that the active Object is shown centered";
/* callbacks */
- ot->exec= outliner_show_active_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->exec = outliner_show_active_exec;
+ ot->poll = ED_operator_outliner_active;
}
/* View Panning --------------------------------------------------- */
@@ -648,10 +648,10 @@ static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
int dy= ar->v2d.mask.ymax - ar->v2d.mask.ymin;
int up= 0;
- if(RNA_boolean_get(op->ptr, "up"))
+ if (RNA_boolean_get(op->ptr, "up"))
up= 1;
- if(up == 0) dy= -dy;
+ if (up == 0) dy= -dy;
ar->v2d.cur.ymin+= dy;
ar->v2d.cur.ymax+= dy;
@@ -664,13 +664,13 @@ static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_scroll_page(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Scroll Page";
- ot->idname= "OUTLINER_OT_scroll_page";
- ot->description= "Scroll page up or down";
+ ot->name = "Scroll Page";
+ ot->idname = "OUTLINER_OT_scroll_page";
+ ot->description = "Scroll page up or down";
/* callbacks */
- ot->exec= outliner_scroll_page_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->exec = outliner_scroll_page_exec;
+ ot->poll = ED_operator_outliner_active;
/* properties */
RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page");
@@ -691,9 +691,9 @@ static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te,
te->ys= (float)(*starty);
*starty-= UI_UNIT_Y;
- if(TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem,soops)) {
TreeElement *ten;
- for(ten= te->subtree.first; ten; ten= ten->next) {
+ for (ten= te->subtree.first; ten; ten= ten->next) {
outliner_set_coordinates_element(soops, ten, startx+UI_UNIT_X, starty);
}
}
@@ -707,7 +707,7 @@ static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops)
int starty= (int)(ar->v2d.tot.ymax)-UI_UNIT_Y;
int startx= 0;
- for(te= soops->tree.first; te; te= te->next) {
+ for (te= soops->tree.first; te; te= te->next) {
outliner_set_coordinates_element(soops, te, startx, &starty);
}
}
@@ -720,7 +720,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na
for (te= lb->first; te; te= te->next) {
int found = outliner_filter_has_name(te, name, flags);
- if(found) {
+ if (found) {
/* name is right, but is element the previous one? */
if (prev) {
if ((te != prev) && (*prevFound))
@@ -734,7 +734,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na
}
tes= outliner_find_named(soops, &te->subtree, name, flags, prev, prevFound);
- if(tes) return tes;
+ if (tes) return tes;
}
/* nothing valid found */
@@ -781,7 +781,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
tselem= TREESTORE(te);
if (tselem) {
/* expand branches so that it will be visible, we need to get correct coordinates */
- if( outliner_open_back(soops, te))
+ if ( outliner_open_back(soops, te))
outliner_set_coordinates(ar, soops);
/* deselect all visible, and select found element */
@@ -790,9 +790,9 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
/* make te->ys center of view */
ytop= (int)(te->ys + (ar->v2d.mask.ymax-ar->v2d.mask.ymin)/2);
- if(ytop>0) ytop= 0;
- ar->v2d.cur.ymax= (float)ytop;
- ar->v2d.cur.ymin= (float)(ytop-(ar->v2d.mask.ymax-ar->v2d.mask.ymin));
+ if (ytop>0) ytop= 0;
+ ar->v2d.cur.ymax = (float)ytop;
+ ar->v2d.cur.ymin = (float)(ytop-(ar->v2d.mask.ymax-ar->v2d.mask.ymin));
/* make te->xs ==> te->xend center of view */
xdelta = (int)(te->xs - ar->v2d.cur.xmin);
@@ -824,14 +824,14 @@ static void outliner_openclose_level(SpaceOops *soops, ListBase *lb, int curleve
TreeElement *te;
TreeStoreElem *tselem;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(open) {
- if(curlevel<=level) tselem->flag &= ~TSE_CLOSED;
+ if (open) {
+ if (curlevel<=level) tselem->flag &= ~TSE_CLOSED;
}
else {
- if(curlevel>=level) tselem->flag |= TSE_CLOSED;
+ if (curlevel>=level) tselem->flag |= TSE_CLOSED;
}
outliner_openclose_level(soops, &te->subtree, curlevel+1, level, open);
@@ -846,12 +846,12 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op)
int level;
level= outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1);
- if(add==1) {
- if(level) outliner_openclose_level(soops, &soops->tree, 1, level, 1);
+ if (add==1) {
+ if (level) outliner_openclose_level(soops, &soops->tree, 1, level, 1);
}
else {
- if(level==0) level= outliner_count_levels(soops, &soops->tree, 0);
- if(level) outliner_openclose_level(soops, &soops->tree, 1, level-1, 0);
+ if (level==0) level= outliner_count_levels(soops, &soops->tree, 0);
+ if (level) outliner_openclose_level(soops, &soops->tree, 1, level-1, 0);
}
ED_region_tag_redraw(ar);
@@ -862,13 +862,13 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_show_one_level(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Show/Hide One Level";
- ot->idname= "OUTLINER_OT_show_one_level";
- ot->description= "Expand/collapse all entries by one level";
+ ot->name = "Show/Hide One Level";
+ ot->idname = "OUTLINER_OT_show_one_level";
+ ot->description = "Expand/collapse all entries by one level";
/* callbacks */
- ot->exec= outliner_one_level_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->exec = outliner_one_level_exec;
+ ot->poll = ED_operator_outliner_active;
/* no undo or registry, UI option */
@@ -884,10 +884,10 @@ static int subtree_has_objects(SpaceOops *soops, ListBase *lb)
TreeElement *te;
TreeStoreElem *tselem;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(tselem->type==0 && te->idcode==ID_OB) return 1;
- if( subtree_has_objects(soops, &te->subtree)) return 1;
+ if (tselem->type==0 && te->idcode==ID_OB) return 1;
+ if ( subtree_has_objects(soops, &te->subtree)) return 1;
}
return 0;
}
@@ -899,22 +899,22 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
TreeStoreElem *tselem;
/* open all object elems, close others */
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(tselem->type==0) {
- if(te->idcode==ID_SCE) {
- if(tselem->id!=(ID *)scene) tselem->flag |= TSE_CLOSED;
+ if (tselem->type==0) {
+ if (te->idcode==ID_SCE) {
+ if (tselem->id!=(ID *)scene) tselem->flag |= TSE_CLOSED;
else tselem->flag &= ~TSE_CLOSED;
}
- else if(te->idcode==ID_OB) {
- if(subtree_has_objects(soops, &te->subtree)) tselem->flag &= ~TSE_CLOSED;
+ else if (te->idcode==ID_OB) {
+ if (subtree_has_objects(soops, &te->subtree)) tselem->flag &= ~TSE_CLOSED;
else tselem->flag |= TSE_CLOSED;
}
}
else tselem->flag |= TSE_CLOSED;
- if(TSELEM_OPEN(tselem,soops)) tree_element_show_hierarchy(scene, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem,soops)) tree_element_show_hierarchy(scene, soops, &te->subtree);
}
}
@@ -936,13 +936,13 @@ static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op))
void OUTLINER_OT_show_hierarchy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Show Hierarchy";
- ot->idname= "OUTLINER_OT_show_hierarchy";
- ot->description= "Open all object entries and close all others";
+ ot->name = "Show Hierarchy";
+ ot->idname = "OUTLINER_OT_show_hierarchy";
+ ot->description = "Open all object entries and close all others";
/* callbacks */
- ot->exec= outliner_show_hierarchy_exec;
- ot->poll= ED_operator_outliner_active; // TODO: shouldn't be allowed in RNA views...
+ ot->exec = outliner_show_hierarchy_exec;
+ ot->poll = ED_operator_outliner_active; // TODO: shouldn't be allowed in RNA views...
/* no undo or registry, UI option */
}
@@ -1013,12 +1013,12 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
/* just 'append' property to path
* - to prevent memory leaks, we must write to newpath not path, then free old path + swap them
*/
- if(tse->type == TSE_RNA_PROPERTY) {
- if(RNA_property_type(prop) == PROP_POINTER) {
+ if (tse->type == TSE_RNA_PROPERTY) {
+ if (RNA_property_type(prop) == PROP_POINTER) {
/* for pointer we just append property name */
newpath= RNA_path_append(*path, ptr, prop, 0, NULL);
}
- else if(RNA_property_type(prop) == PROP_COLLECTION) {
+ else if (RNA_property_type(prop) == PROP_COLLECTION) {
char buf[128], *name;
temnext= (TreeElement*)(ld->next->data);
@@ -1027,19 +1027,19 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
nextptr= &temnext->rnaptr;
name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), NULL);
- if(name) {
+ if (name) {
/* if possible, use name as a key in the path */
newpath= RNA_path_append(*path, NULL, prop, 0, name);
- if(name != buf)
+ if (name != buf)
MEM_freeN(name);
}
else {
/* otherwise use index */
int index= 0;
- for(temsub=tem->subtree.first; temsub; temsub=temsub->next, index++)
- if(temsub == temnext)
+ for (temsub=tem->subtree.first; temsub; temsub=temsub->next, index++)
+ if (temsub == temnext)
break;
newpath= RNA_path_append(*path, NULL, prop, index, NULL);
@@ -1049,7 +1049,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
}
}
- if(newpath) {
+ if (newpath) {
if (*path) MEM_freeN(*path);
*path= newpath;
newpath= NULL;
@@ -1059,11 +1059,11 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
/* no ID, so check if entry is RNA-struct, and if that RNA-struct is an ID datablock to extract info from */
if (tse->type == TSE_RNA_STRUCT) {
/* ptr->data not ptr->id.data seems to be the one we want, since ptr->data is sometimes the owner of this ID? */
- if(RNA_struct_is_ID(ptr->type)) {
+ if (RNA_struct_is_ID(ptr->type)) {
*id= (ID *)ptr->data;
/* clear path */
- if(*path) {
+ if (*path) {
MEM_freeN(*path);
path= NULL;
}
@@ -1206,13 +1206,13 @@ static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
{
/* api callbacks */
- ot->idname= "OUTLINER_OT_drivers_add_selected";
- ot->name= "Add Drivers for Selected";
- ot->description= "Add drivers to selected items";
+ ot->idname = "OUTLINER_OT_drivers_add_selected";
+ ot->name = "Add Drivers for Selected";
+ ot->description = "Add drivers to selected items";
/* api callbacks */
- ot->exec= outliner_drivers_addsel_exec;
- ot->poll= ed_operator_outliner_datablocks_active;
+ ot->exec = outliner_drivers_addsel_exec;
+ ot->poll = ed_operator_outliner_datablocks_active;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1241,13 +1241,13 @@ static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_drivers_delete_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->idname= "OUTLINER_OT_drivers_delete_selected";
- ot->name= "Delete Drivers for Selected";
- ot->description= "Delete drivers assigned to selected items";
+ ot->idname = "OUTLINER_OT_drivers_delete_selected";
+ ot->name = "Delete Drivers for Selected";
+ ot->description = "Delete drivers assigned to selected items";
/* api callbacks */
- ot->exec= outliner_drivers_deletesel_exec;
- ot->poll= ed_operator_outliner_datablocks_active;
+ ot->exec = outliner_drivers_deletesel_exec;
+ ot->poll = ed_operator_outliner_datablocks_active;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1380,13 +1380,13 @@ static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->idname= "OUTLINER_OT_keyingset_add_selected";
- ot->name= "Keying Set Add Selected";
- ot->description= "Add selected items (blue-grey rows) to active Keying Set";
+ ot->idname = "OUTLINER_OT_keyingset_add_selected";
+ ot->name = "Keying Set Add Selected";
+ ot->description = "Add selected items (blue-grey rows) to active Keying Set";
/* api callbacks */
- ot->exec= outliner_keyingset_additems_exec;
- ot->poll= ed_operator_outliner_datablocks_active;
+ ot->exec = outliner_keyingset_additems_exec;
+ ot->poll = ed_operator_outliner_datablocks_active;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1417,13 +1417,13 @@ static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(o
void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->idname= "OUTLINER_OT_keyingset_remove_selected";
- ot->name= "Keying Set Remove Selected";
+ ot->idname = "OUTLINER_OT_keyingset_remove_selected";
+ ot->name = "Keying Set Remove Selected";
ot->description = "Remove selected items (blue-grey rows) from active Keying Set";
/* api callbacks */
- ot->exec= outliner_keyingset_removeitems_exec;
- ot->poll= ed_operator_outliner_datablocks_active;
+ ot->exec = outliner_keyingset_removeitems_exec;
+ ot->poll = ed_operator_outliner_datablocks_active;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1508,7 +1508,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (te_found) break;
}
- if(te_found) {
+ if (te_found) {
RNA_string_set(op->ptr, "parent", te_found->name);
/* Identify parent and child */
RNA_string_get(op->ptr, "child", childname);
@@ -1624,18 +1624,18 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
void OUTLINER_OT_parent_drop(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Drop to Set Parent";
+ ot->name = "Drop to Set Parent";
ot->description = "Drag to parent in Outliner";
- ot->idname= "OUTLINER_OT_parent_drop";
+ ot->idname = "OUTLINER_OT_parent_drop";
/* api callbacks */
- ot->invoke= parent_drop_invoke;
- ot->exec= parent_drop_exec;
+ ot->invoke = parent_drop_invoke;
+ ot->exec = parent_drop_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->poll = ED_operator_outliner_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_string(ot->srna, "child", "Object", MAX_ID_NAME, "Child", "Child Object");
@@ -1702,17 +1702,17 @@ static int parent_clear_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
void OUTLINER_OT_parent_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Drop to Clear Parent";
+ ot->name = "Drop to Clear Parent";
ot->description = "Drag to clear parent in Outliner";
- ot->idname= "OUTLINER_OT_parent_clear";
+ ot->idname = "OUTLINER_OT_parent_clear";
/* api callbacks */
- ot->invoke= parent_clear_invoke;
+ ot->invoke = parent_clear_invoke;
- ot->poll= ED_operator_outliner_active;
+ ot->poll = ED_operator_outliner_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_string(ot->srna, "dragged_obj", "Object", MAX_ID_NAME, "Child", "Child Object");
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index 17434d0f6c9..d2ef4573ccf 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -84,7 +84,7 @@ void outliner_operatortypes(void)
void outliner_keymap(wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Outliner", SPACE_OUTLINER, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Outliner", SPACE_OUTLINER, 0);
wmKeyMapItem *kmi;
WM_keymap_add_item(keymap, "OUTLINER_OT_item_rename", LEFTMOUSE, KM_DBL_CLICK, 0, 0);
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 4814edf585e..c7aa4dc4e92 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -159,11 +159,11 @@ static int tree_element_active_renderlayer(bContext *C, TreeElement *te, TreeSto
Scene *sce;
/* paranoia check */
- if(te->idcode!=ID_SCE)
+ if (te->idcode!=ID_SCE)
return 0;
sce= (Scene *)tselem->id;
- if(set) {
+ if (set) {
sce->r.actlay= tselem->nr;
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, sce);
}
@@ -181,25 +181,25 @@ static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops
Object *ob= NULL;
/* if id is not object, we search back */
- if(te->idcode==ID_OB) ob= (Object *)tselem->id;
+ if (te->idcode==ID_OB) ob= (Object *)tselem->id;
else {
ob= (Object *)outliner_search_back(soops, te, ID_OB);
- if(ob==OBACT) return 0;
+ if (ob==OBACT) return 0;
}
- if(ob==NULL) return 0;
+ if (ob==NULL) return 0;
sce= (Scene *)outliner_search_back(soops, te, ID_SCE);
- if(sce && scene != sce) {
+ if (sce && scene != sce) {
ED_screen_set_scene(C, CTX_wm_screen(C), sce);
}
/* find associated base in current scene */
base= object_in_scene(ob, scene);
- if(base) {
- if(set==2) {
+ if (base) {
+ if (set==2) {
/* swap select */
- if(base->flag & SELECT)
+ if (base->flag & SELECT)
ED_base_object_select(base, BA_DESELECT);
else
ED_base_object_select(base, BA_SELECT);
@@ -209,13 +209,13 @@ static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops
scene_deselect_all(scene);
ED_base_object_select(base, BA_SELECT);
}
- if(C) {
+ if (C) {
ED_base_object_activate(C, base); /* adds notifier */
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
}
- if(ob!=scene->obedit)
+ if (ob!=scene->obedit)
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
return 1;
@@ -229,32 +229,32 @@ static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *so
/* we search for the object parent */
ob= (Object *)outliner_search_back(soops, te, ID_OB);
// note: ob->matbits can be NULL when a local object points to a library mesh.
- if(ob==NULL || ob!=OBACT || ob->matbits==NULL) return 0; // just paranoia
+ if (ob==NULL || ob!=OBACT || ob->matbits==NULL) return 0; // just paranoia
/* searching in ob mat array? */
tes= te->parent;
- if(tes->idcode==ID_OB) {
- if(set) {
+ if (tes->idcode==ID_OB) {
+ if (set) {
ob->actcol= te->index+1;
ob->matbits[te->index]= 1; // make ob material active too
}
else {
- if(ob->actcol == te->index+1)
- if(ob->matbits[te->index]) return 1;
+ if (ob->actcol == te->index+1)
+ if (ob->matbits[te->index]) return 1;
}
}
/* or we search for obdata material */
else {
- if(set) {
+ if (set) {
ob->actcol= te->index+1;
ob->matbits[te->index]= 0; // make obdata material active too
}
else {
- if(ob->actcol == te->index+1)
- if(ob->matbits[te->index]==0) return 1;
+ if (ob->actcol == te->index+1)
+ if (ob->matbits[te->index]==0) return 1;
}
}
- if(set) {
+ if (set) {
WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, NULL);
}
return 0;
@@ -267,7 +267,7 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
Object *ob=OBACT;
SpaceButs *sbuts=NULL;
- if(ob==NULL) return 0; // no active object
+ if (ob==NULL) return 0; // no active object
/*tselem= TREESTORE(te);*/ /*UNUSED*/
@@ -278,25 +278,25 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
tep= te->parent;
tselemp= TREESTORE(tep);
- if(tep->idcode==ID_WO) {
+ if (tep->idcode==ID_WO) {
World *wrld= (World *)tselemp->id;
- if(set) {
- if(sbuts) {
+ if (set) {
+ if (sbuts) {
// XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
// XXX sbuts->texfrom= 1;
}
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
wrld->texact= te->index;
}
- else if(tselemp->id == (ID *)(scene->world)) {
- if(wrld->texact==te->index) return 1;
+ else if (tselemp->id == (ID *)(scene->world)) {
+ if (wrld->texact==te->index) return 1;
}
}
- else if(tep->idcode==ID_LA) {
+ else if (tep->idcode==ID_LA) {
Lamp *la= (Lamp *)tselemp->id;
- if(set) {
- if(sbuts) {
+ if (set) {
+ if (sbuts) {
// XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
// XXX sbuts->texfrom= 2;
}
@@ -304,15 +304,15 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
la->texact= te->index;
}
else {
- if(tselemp->id == ob->data) {
- if(la->texact==te->index) return 1;
+ if (tselemp->id == ob->data) {
+ if (la->texact==te->index) return 1;
}
}
}
- else if(tep->idcode==ID_MA) {
+ else if (tep->idcode==ID_MA) {
Material *ma= (Material *)tselemp->id;
- if(set) {
- if(sbuts) {
+ if (set) {
+ if (sbuts) {
//sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
// XXX sbuts->texfrom= 0;
}
@@ -322,12 +322,12 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
/* also set active material */
ob->actcol= tep->index+1;
}
- else if(tep->flag & TE_ACTIVE) { // this is active material
- if(ma->texact==te->index) return 1;
+ else if (tep->flag & TE_ACTIVE) { // this is active material
+ if (ma->texact==te->index) return 1;
}
}
- if(set)
+ if (set)
WM_event_add_notifier(C, NC_TEXTURE, NULL);
return 0;
@@ -340,9 +340,9 @@ static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops
/* we search for the object parent */
ob= (Object *)outliner_search_back(soops, te, ID_OB);
- if(ob==NULL || ob!=OBACT) return 0; // just paranoia
+ if (ob==NULL || ob!=OBACT) return 0; // just paranoia
- if(set) {
+ if (set) {
// XXX extern_set_butspace(F5KEY, 0);
}
else return 1;
@@ -354,7 +354,7 @@ static int tree_element_active_camera(bContext *UNUSED(C), Scene *scene, SpaceOo
{
Object *ob= (Object *)outliner_search_back(soops, te, ID_OB);
- if(set)
+ if (set)
return 0;
return scene->camera == ob;
@@ -367,19 +367,19 @@ static int tree_element_active_world(bContext *C, Scene *scene, SpaceOops *soops
Scene *sce=NULL;
tep= te->parent;
- if(tep) {
+ if (tep) {
tselem= TREESTORE(tep);
sce= (Scene *)tselem->id;
}
- if(set) { // make new scene active
- if(sce && scene != sce) {
+ if (set) { // make new scene active
+ if (sce && scene != sce) {
ED_screen_set_scene(C, CTX_wm_screen(C), sce);
}
}
- if(tep==NULL || tselem->id == (ID *)scene) {
- if(set) {
+ if (tep==NULL || tselem->id == (ID *)scene) {
+ if (set) {
// XXX extern_set_butspace(F8KEY, 0);
}
else {
@@ -395,7 +395,7 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *
/* id in tselem is object */
ob= (Object *)tselem->id;
- if(set) {
+ if (set) {
BLI_assert(te->index+1 >= 0);
ob->actdef= te->index+1;
@@ -403,8 +403,8 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
}
else {
- if(ob==OBACT)
- if(ob->actdef== te->index+1) return 1;
+ if (ob==OBACT)
+ if (ob->actdef== te->index+1) return 1;
}
return 0;
}
@@ -413,14 +413,14 @@ static int tree_element_active_posegroup(bContext *C, Scene *scene, TreeElement
{
Object *ob= (Object *)tselem->id;
- if(set) {
+ if (set) {
if (ob->pose) {
ob->pose->active_group= te->index+1;
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
}
}
else {
- if(ob==OBACT && ob->pose) {
+ if (ob==OBACT && ob->pose) {
if (ob->pose->active_group== te->index+1) return 1;
}
}
@@ -433,15 +433,16 @@ static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElemen
bArmature *arm= ob->data;
bPoseChannel *pchan= te->directdata;
- if(set) {
- if(!(pchan->bone->flag & BONE_HIDDEN_P)) {
+ if (set) {
+ if (!(pchan->bone->flag & BONE_HIDDEN_P)) {
- if(set==2) ED_pose_deselectall(ob, 2); // 2 = clear active tag
+ if (set==2) ED_pose_deselectall(ob, 2); // 2 = clear active tag
else ED_pose_deselectall(ob, 0); // 0 = deselect
- if(set==2 && (pchan->bone->flag & BONE_SELECTED)) {
+ if (set==2 && (pchan->bone->flag & BONE_SELECTED)) {
pchan->bone->flag &= ~BONE_SELECTED;
- } else {
+ }
+ else {
pchan->bone->flag |= BONE_SELECTED;
arm->act_bone= pchan->bone;
}
@@ -451,7 +452,7 @@ static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElemen
}
}
else {
- if(ob==OBACT && ob->pose) {
+ if (ob==OBACT && ob->pose) {
if (pchan->bone->flag & BONE_SELECTED) return 1;
}
}
@@ -463,14 +464,15 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
bArmature *arm= (bArmature *)tselem->id;
Bone *bone= te->directdata;
- if(set) {
- if(!(bone->flag & BONE_HIDDEN_P)) {
- if(set==2) ED_pose_deselectall(OBACT, 2); // 2 is clear active tag
+ if (set) {
+ if (!(bone->flag & BONE_HIDDEN_P)) {
+ if (set==2) ED_pose_deselectall(OBACT, 2); // 2 is clear active tag
else ED_pose_deselectall(OBACT, 0);
- if(set==2 && (bone->flag & BONE_SELECTED)) {
+ if (set==2 && (bone->flag & BONE_SELECTED)) {
bone->flag &= ~BONE_SELECTED;
- } else {
+ }
+ else {
bone->flag |= BONE_SELECTED;
arm->act_bone= bone;
}
@@ -481,7 +483,7 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
else {
Object *ob= OBACT;
- if(ob && ob->data==arm) {
+ if (ob && ob->data==arm) {
if (bone->flag & BONE_SELECTED) return 1;
}
}
@@ -492,16 +494,16 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
/* ebones only draw in editmode armature */
static void tree_element_active_ebone__sel(bContext *C, Scene *scene, bArmature *arm, EditBone *ebone, short sel)
{
- if(sel) {
+ if (sel) {
ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL;
arm->act_edbone= ebone;
// flush to parent?
- if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
+ if (ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
}
else {
ebone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL);
// flush to parent?
- if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL;
+ if (ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL;
}
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, scene->obedit);
@@ -511,16 +513,16 @@ static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te,
bArmature *arm= scene->obedit->data;
EditBone *ebone= te->directdata;
- if(set==1) {
- if(!(ebone->flag & BONE_HIDDEN_A)) {
+ if (set==1) {
+ if (!(ebone->flag & BONE_HIDDEN_A)) {
ED_armature_deselect_all(scene->obedit, 0); // deselect
tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
return 1;
}
}
else if (set==2) {
- if(!(ebone->flag & BONE_HIDDEN_A)) {
- if(!(ebone->flag & BONE_SELECTED)) {
+ if (!(ebone->flag & BONE_HIDDEN_A)) {
+ if (!(ebone->flag & BONE_SELECTED)) {
tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
return 1;
}
@@ -539,7 +541,7 @@ static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te,
static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
{
- if(set) {
+ if (set) {
Object *ob= (Object *)tselem->id;
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
@@ -552,7 +554,7 @@ static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), Tr
static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
{
- if(set) {
+ if (set) {
Object *ob= (Object *)tselem->id;
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
@@ -565,7 +567,7 @@ static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeEleme
static int tree_element_active_constraint(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
{
- if(set) {
+ if (set) {
Object *ob= (Object *)tselem->id;
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
@@ -586,17 +588,17 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUS
Object *ob= (Object *)tselem->id;
Base *base= object_in_scene(ob, scene);
- if(set) {
- if(scene->obedit)
+ if (set) {
+ if (scene->obedit)
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
- if(ob->mode & OB_MODE_POSE)
+ if (ob->mode & OB_MODE_POSE)
ED_armature_exit_posemode(C, base);
else
ED_armature_enter_posemode(C, base);
}
else {
- if(ob->mode & OB_MODE_POSE) return 1;
+ if (ob->mode & OB_MODE_POSE) return 1;
}
return 0;
}
@@ -605,11 +607,11 @@ static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(t
{
Sequence *seq= (Sequence*) te->directdata;
- if(set) {
+ if (set) {
// XXX select_single_seq(seq, 1);
}
else {
- if(seq->flag & SELECT)
+ if (seq->flag & SELECT)
return(1);
}
return(0);
@@ -621,21 +623,21 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS
Editing *ed= seq_give_editing(scene, FALSE);
seq= (Sequence*)te->directdata;
- if(set==0) {
- if(seq->flag & SELECT)
+ if (set==0) {
+ if (seq->flag & SELECT)
return(1);
return(0);
}
// XXX select_single_seq(seq, 1);
p= ed->seqbasep->first;
- while(p) {
- if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+ while (p) {
+ if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
p= p->next;
continue;
}
-// if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
+// if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
// XXX select_single_seq(p, 0);
p= p->next;
}
@@ -644,10 +646,10 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS
static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
{
- wmKeyMapItem *kmi= te->directdata;
+ wmKeyMapItem *kmi = te->directdata;
- if(set==0) {
- if(kmi->flag & KMI_INACTIVE) return 0;
+ if (set==0) {
+ if (kmi->flag & KMI_INACTIVE) return 0;
return 1;
}
else {
@@ -695,8 +697,8 @@ int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeEl
case TSE_MODIFIER:
return tree_element_active_modifier(C, te, tselem, set);
case TSE_LINKED_OB:
- if(set) tree_element_set_active_object(C, scene, soops, te, set);
- else if(tselem->id==(ID *)OBACT) return 1;
+ if (set) tree_element_set_active_object(C, scene, soops, te, set);
+ else if (tselem->id==(ID *)OBACT) return 1;
break;
case TSE_LINKED_PSYS:
return tree_element_active_psys(C, scene, te, tselem, set);
@@ -726,24 +728,24 @@ int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeEl
static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, const float mval[2])
{
- if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
+ if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
TreeStoreElem *tselem= TREESTORE(te);
int openclose= 0;
/* open close icon */
- if((te->flag & TE_ICONROW)==0) { // hidden icon, no open/close
- if( mval[0]>te->xs && mval[0]<te->xs+UI_UNIT_X)
+ if ((te->flag & TE_ICONROW)==0) { // hidden icon, no open/close
+ if ( mval[0]>te->xs && mval[0]<te->xs+UI_UNIT_X)
openclose= 1;
}
- if(openclose) {
+ if (openclose) {
/* all below close/open? */
- if(extend) {
+ if (extend) {
tselem->flag &= ~TSE_CLOSED;
outliner_set_flag(soops, &te->subtree, TSE_CLOSED, !outliner_has_one_flag(soops, &te->subtree, TSE_CLOSED, 1));
}
else {
- if(tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED;
+ if (tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED;
else tselem->flag |= TSE_CLOSED;
}
@@ -751,50 +753,51 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa
return 1;
}
/* name and first icon */
- else if(mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
+ else if (mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
/* always makes active object */
- if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP)
+ if (tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP)
tree_element_set_active_object(C, scene, soops, te, 1 + (extend!=0 && tselem->type==0));
- if(tselem->type==0) { // the lib blocks
+ if (tselem->type==0) { // the lib blocks
/* editmode? */
- if(te->idcode==ID_SCE) {
- if(scene!=(Scene *)tselem->id) {
+ if (te->idcode==ID_SCE) {
+ if (scene!=(Scene *)tselem->id) {
ED_screen_set_scene(C, CTX_wm_screen(C), (Scene *)tselem->id);
}
}
- else if(te->idcode==ID_GR) {
+ else if (te->idcode==ID_GR) {
Group *gr= (Group *)tselem->id;
GroupObject *gob;
- if(extend) {
+ if (extend) {
int sel= BA_SELECT;
- for(gob= gr->gobject.first; gob; gob= gob->next) {
- if(gob->ob->flag & SELECT) {
+ for (gob= gr->gobject.first; gob; gob= gob->next) {
+ if (gob->ob->flag & SELECT) {
sel= BA_DESELECT;
break;
}
}
- for(gob= gr->gobject.first; gob; gob= gob->next) {
+ for (gob= gr->gobject.first; gob; gob= gob->next) {
ED_base_object_select(object_in_scene(gob->ob, scene), sel);
}
}
else {
scene_deselect_all(scene);
- for(gob= gr->gobject.first; gob; gob= gob->next) {
- if((gob->ob->flag & SELECT) == 0)
+ for (gob= gr->gobject.first; gob; gob= gob->next) {
+ if ((gob->ob->flag & SELECT) == 0)
ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT);
}
}
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
- else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
+ else if (ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
- } else { // rest of types
+ }
+ else { // rest of types
tree_element_active(C, scene, soops, te, 1);
}
@@ -805,8 +808,8 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa
}
}
- for(te= te->subtree.first; te; te= te->next) {
- if(do_outliner_item_activate(C, scene, ar, soops, te, extend, mval)) return 1;
+ for (te= te->subtree.first; te; te= te->next) {
+ if (do_outliner_item_activate(C, scene, ar, soops, te, extend, mval)) return 1;
}
return 0;
}
@@ -830,11 +833,11 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_CANCELLED;
}
- for(te= soops->tree.first; te; te= te->next) {
- if(do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break;
+ for (te= soops->tree.first; te; te= te->next) {
+ if (do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break;
}
- if(te) {
+ if (te) {
ED_undo_push(C, "Outliner click event");
}
else {
@@ -846,7 +849,7 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
fmval[0], fmval[1], NULL, &row);
/* select relevant row */
- if(outliner_select(soops, &soops->tree, &row, &selecting)) {
+ if (outliner_select(soops, &soops->tree, &row, &selecting)) {
soops->storeflag |= SO_TREESTORE_REDRAW;
@@ -863,13 +866,13 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
void OUTLINER_OT_item_activate(wmOperatorType *ot)
{
- ot->name= "Activate Item";
- ot->idname= "OUTLINER_OT_item_activate";
- ot->description= "Handle mouse clicks to activate/select items";
+ ot->name = "Activate Item";
+ ot->idname = "OUTLINER_OT_item_activate";
+ ot->description = "Handle mouse clicks to activate/select items";
- ot->invoke= outliner_item_activate;
+ ot->invoke = outliner_item_activate;
- ot->poll= ED_operator_outliner_active;
+ ot->poll = ED_operator_outliner_active;
RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection for activation");
}
@@ -909,15 +912,15 @@ static int outliner_border_select_exec(bContext *C, wmOperator *op)
rctf rectf;
int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
UI_view2d_region_to_view(&ar->v2d, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
- for(te= soops->tree.first; te; te= te->next) {
+ for (te= soops->tree.first; te; te= te->next) {
outliner_item_border_select(scene, soops, &rectf, te, gesture_mode);
}
@@ -930,20 +933,20 @@ static int outliner_border_select_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Select";
- ot->idname= "OUTLINER_OT_select_border";
- ot->description= "Use box selection to select tree elements";
+ ot->name = "Border Select";
+ ot->idname = "OUTLINER_OT_select_border";
+ ot->description = "Use box selection to select tree elements";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= outliner_border_select_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = outliner_border_select_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= ED_operator_outliner_active;
+ ot->poll = ED_operator_outliner_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, FALSE);
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index b44e363090f..45830eed223 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -115,13 +115,13 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
TreeElement *te;
TreeStoreElem *tselem;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(tselem->flag & TSE_SELECTED) {
- if(tselem->type) {
- if(*datalevel==0)
+ if (tselem->flag & TSE_SELECTED) {
+ if (tselem->type) {
+ if (*datalevel==0)
*datalevel= tselem->type;
- else if(*datalevel!=tselem->type)
+ else if (*datalevel!=tselem->type)
*datalevel= -1;
}
else {
@@ -139,13 +139,13 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
case ID_MA: case ID_TE: case ID_IP: case ID_IM:
case ID_SO: case ID_KE: case ID_WO: case ID_AC:
case ID_NLA: case ID_TXT: case ID_GR:
- if(*idlevel==0) *idlevel= idcode;
- else if(*idlevel!=idcode) *idlevel= -1;
+ if (*idlevel==0) *idlevel= idcode;
+ else if (*idlevel!=idcode) *idlevel= -1;
break;
}
}
}
- if(TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem,soops)) {
set_operation_types(soops, &te->subtree,
scenelevel, objectlevel, idlevel, datalevel);
}
@@ -163,29 +163,29 @@ static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEl
Material **matar=NULL;
int a, totcol=0;
- if( GS(tsep->id->name)==ID_OB) {
+ if ( GS(tsep->id->name)==ID_OB) {
Object *ob= (Object *)tsep->id;
totcol= ob->totcol;
matar= ob->mat;
}
- else if( GS(tsep->id->name)==ID_ME) {
+ else if ( GS(tsep->id->name)==ID_ME) {
Mesh *me= (Mesh *)tsep->id;
totcol= me->totcol;
matar= me->mat;
}
- else if( GS(tsep->id->name)==ID_CU) {
+ else if ( GS(tsep->id->name)==ID_CU) {
Curve *cu= (Curve *)tsep->id;
totcol= cu->totcol;
matar= cu->mat;
}
- else if( GS(tsep->id->name)==ID_MB) {
+ else if ( GS(tsep->id->name)==ID_MB) {
MetaBall *mb= (MetaBall *)tsep->id;
totcol= mb->totcol;
matar= mb->mat;
}
- for(a=0; a<totcol; a++) {
- if(a==te->index && matar[a]) {
+ for (a=0; a<totcol; a++) {
+ if (a==te->index && matar[a]) {
matar[a]->id.us--;
matar[a]= NULL;
}
@@ -197,23 +197,23 @@ static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEle
MTex **mtex= NULL;
int a;
- if( GS(tsep->id->name)==ID_MA) {
+ if ( GS(tsep->id->name)==ID_MA) {
Material *ma= (Material *)tsep->id;
mtex= ma->mtex;
}
- else if( GS(tsep->id->name)==ID_LA) {
+ else if ( GS(tsep->id->name)==ID_LA) {
Lamp *la= (Lamp *)tsep->id;
mtex= la->mtex;
}
- else if( GS(tsep->id->name)==ID_WO) {
+ else if ( GS(tsep->id->name)==ID_WO) {
World *wrld= (World *)tsep->id;
mtex= wrld->mtex;
}
else return;
- for(a=0; a<MAX_MTEX; a++) {
- if(a==te->index && mtex[a]) {
- if(mtex[a]->tex) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (a==te->index && mtex[a]) {
+ if (mtex[a]->tex) {
mtex[a]->tex->id.us--;
mtex[a]->tex= NULL;
}
@@ -225,8 +225,8 @@ static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEleme
{
Group *group= (Group *)tselem->id;
- if(tsep) {
- if( GS(tsep->id->name)==ID_OB) {
+ if (tsep) {
+ if ( GS(tsep->id->name)==ID_OB) {
Object *ob= (Object *)tsep->id;
ob->dup_group= NULL;
}
@@ -252,15 +252,15 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *
TreeElement *te;
TreeStoreElem *tselem;
- for(te=lb->first; te; te= te->next) {
+ for (te=lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(tselem->flag & TSE_SELECTED) {
- if(tselem->type==0) {
+ if (tselem->flag & TSE_SELECTED) {
+ if (tselem->type==0) {
TreeStoreElem *tsep= TREESTORE(te->parent);
operation_cb(C, scene, te, tsep, tselem);
}
}
- if(TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem,soops)) {
outliner_do_libdata_operation(C, scene, soops, &te->subtree, operation_cb);
}
}
@@ -272,8 +272,8 @@ static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te,
{
Base *base= (Base *)te->directdata;
- if(base==NULL) base= object_in_scene((Object *)tselem->id, scene);
- if(base && ((base->object->restrictflag & OB_RESTRICT_VIEW)==0)) {
+ if (base==NULL) base= object_in_scene((Object *)tselem->id, scene);
+ if (base && ((base->object->restrictflag & OB_RESTRICT_VIEW)==0)) {
base->flag |= SELECT;
base->object->flag |= SELECT;
}
@@ -283,8 +283,8 @@ static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *t
{
Base *base= (Base *)te->directdata;
- if(base==NULL) base= object_in_scene((Object *)tselem->id, scene);
- if(base) {
+ if (base==NULL) base= object_in_scene((Object *)tselem->id, scene);
+ if (base) {
base->flag &= ~SELECT;
base->object->flag &= ~SELECT;
}
@@ -294,11 +294,11 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
{
Base *base= (Base *)te->directdata;
- if(base==NULL)
+ if (base==NULL)
base= object_in_scene((Object *)tselem->id, scene);
- if(base) {
+ if (base) {
// check also library later
- if(scene->obedit==base->object)
+ if (scene->obedit==base->object)
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
ED_base_object_free_and_unlink(CTX_data_main(C), scene, base);
@@ -378,12 +378,13 @@ static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElemen
GroupObject *gob;
Base *base;
- for(gob=group->gobject.first; gob; gob=gob->next) {
+ for (gob=group->gobject.first; gob; gob=gob->next) {
base= object_in_scene(gob->ob, scene);
if (base) {
base->object->flag |= SELECT;
base->flag |= SELECT;
- } else {
+ }
+ else {
/* link to scene */
base= MEM_callocN( sizeof(Base), "add_base");
BLI_addhead(&scene->base, base);
@@ -402,22 +403,22 @@ void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soop
TreeElement *te;
TreeStoreElem *tselem;
- for(te=lb->first; te; te= te->next) {
+ for (te=lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(tselem->flag & TSE_SELECTED) {
- if(tselem->type==0 && te->idcode==ID_OB) {
+ if (tselem->flag & TSE_SELECTED) {
+ if (tselem->type==0 && te->idcode==ID_OB) {
// when objects selected in other scenes... dunno if that should be allowed
Scene *scene_owner= (Scene *)outliner_search_back(soops, te, ID_SCE);
- if(scene_owner && scene_act != scene_owner) {
+ if (scene_owner && scene_act != scene_owner) {
ED_screen_set_scene(C, CTX_wm_screen(C), scene_owner);
}
/* important to use 'scene_owner' not scene_act else deleting objects can crash.
* only use 'scene_act' when 'scene_owner' is NULL, which can happen when the
- * outliner isnt showing scenes: Visible Layer draw mode for eg. */
+ * outliner isn't showing scenes: Visible Layer draw mode for eg. */
operation_cb(C, scene_owner ? scene_owner : scene_act, te, NULL, tselem);
}
}
- if(TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem,soops)) {
outliner_do_object_operation(C, scene_act, soops, &te->subtree, operation_cb);
}
}
@@ -459,15 +460,15 @@ static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
bPoseChannel *pchan= (bPoseChannel *)te->directdata;
- if(event==1)
+ if (event==1)
pchan->bone->flag |= BONE_SELECTED;
- else if(event==2)
+ else if (event==2)
pchan->bone->flag &= ~BONE_SELECTED;
- else if(event==3) {
+ else if (event==3) {
pchan->bone->flag |= BONE_HIDDEN_P;
pchan->bone->flag &= ~BONE_SELECTED;
}
- else if(event==4)
+ else if (event==4)
pchan->bone->flag &= ~BONE_HIDDEN_P;
}
@@ -475,15 +476,15 @@ static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
Bone *bone= (Bone *)te->directdata;
- if(event==1)
+ if (event==1)
bone->flag |= BONE_SELECTED;
- else if(event==2)
+ else if (event==2)
bone->flag &= ~BONE_SELECTED;
- else if(event==3) {
+ else if (event==3) {
bone->flag |= BONE_HIDDEN_P;
bone->flag &= ~BONE_SELECTED;
}
- else if(event==4)
+ else if (event==4)
bone->flag &= ~BONE_HIDDEN_P;
}
@@ -491,22 +492,22 @@ static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
EditBone *ebone= (EditBone *)te->directdata;
- if(event==1)
+ if (event==1)
ebone->flag |= BONE_SELECTED;
- else if(event==2)
+ else if (event==2)
ebone->flag &= ~BONE_SELECTED;
- else if(event==3) {
+ else if (event==3) {
ebone->flag |= BONE_HIDDEN_A;
ebone->flag &= ~BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
}
- else if(event==4)
+ else if (event==4)
ebone->flag &= ~BONE_HIDDEN_A;
}
static void sequence_cb(int event, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tselem))
{
// Sequence *seq= (Sequence*) te->directdata;
- if(event==1) {
+ if (event==1) {
// XXX select_single_seq(seq, 1);
}
}
@@ -517,14 +518,14 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li
TreeElement *te;
TreeStoreElem *tselem;
- for(te=lb->first; te; te= te->next) {
+ for (te=lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(tselem->flag & TSE_SELECTED) {
- if(tselem->type==type) {
+ if (tselem->flag & TSE_SELECTED) {
+ if (tselem->type==type) {
operation_cb(event, te, tselem);
}
}
- if(TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem,soops)) {
outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb);
}
}
@@ -557,22 +558,22 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
event= RNA_enum_get(op->ptr, "type");
- if(event==1) {
+ if (event==1) {
Scene *sce= scene; // to be able to delete, scenes are set...
outliner_do_object_operation(C, scene, soops, &soops->tree, object_select_cb);
- if(scene != sce) {
+ if (scene != sce) {
ED_screen_set_scene(C, CTX_wm_screen(C), sce);
}
str= "Select Objects";
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
- else if(event==2) {
+ else if (event==2) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_deselect_cb);
str= "Deselect Objects";
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
- else if(event==4) {
+ else if (event==4) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb);
/* XXX: tree management normally happens from draw_outliner(), but when
@@ -586,26 +587,26 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
str= "Delete Objects";
WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
}
- else if(event==5) { /* disabled, see above enum (ton) */
+ else if (event==5) { /* disabled, see above enum (ton) */
outliner_do_object_operation(C, scene, soops, &soops->tree, id_local_cb);
str= "Localized Objects";
}
- else if(event==6) {
+ else if (event==6) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb);
str= "Toggle Visibility";
WM_event_add_notifier(C, NC_SCENE|ND_OB_VISIBLE, scene);
}
- else if(event==7) {
+ else if (event==7) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb);
str= "Toggle Selectability";
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
- else if(event==8) {
+ else if (event==8) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb);
str= "Toggle Renderability";
WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, scene);
}
- else if(event==9) {
+ else if (event==9) {
outliner_do_object_operation(C, scene, soops, &soops->tree, item_rename_cb);
str= "Rename Object";
}
@@ -619,18 +620,18 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_object_operation(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Outliner Object Operation";
- ot->idname= "OUTLINER_OT_object_operation";
- ot->description= "";
+ ot->name = "Outliner Object Operation";
+ ot->idname = "OUTLINER_OT_object_operation";
+ ot->description = "";
/* callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= outliner_object_operation_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = outliner_object_operation_exec;
+ ot->poll = ED_operator_outliner_active;
- ot->flag= 0;
+ ot->flag = 0;
- ot->prop= RNA_def_enum(ot->srna, "type", prop_object_op_types, 0, "Object Operation", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_object_op_types, 0, "Object Operation", "");
}
/* **************************************** */
@@ -659,31 +660,31 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op)
event= RNA_enum_get(op->ptr, "type");
- if(event==1) {
+ if (event==1) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb);
str= "Unlink group";
}
- else if(event==2) {
+ else if (event==2) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb);
str= "Localized Data";
}
- else if(event==3) {
+ else if (event==3) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb);
str= "Link Group Objects to Scene";
}
- else if(event==4) {
+ else if (event==4) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb);
str= "Toggle Visibility";
}
- else if(event==5) {
+ else if (event==5) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb);
str= "Toggle Selectability";
}
- else if(event==6) {
+ else if (event==6) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb);
str= "Toggle Renderability";
}
- else if(event==7) {
+ else if (event==7) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
str= "Rename";
}
@@ -699,18 +700,18 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_group_operation(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Outliner Group Operation";
- ot->idname= "OUTLINER_OT_group_operation";
- ot->description= "";
+ ot->name = "Outliner Group Operation";
+ ot->idname = "OUTLINER_OT_group_operation";
+ ot->description = "";
/* callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= outliner_group_operation_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = outliner_group_operation_exec;
+ ot->poll = ED_operator_outliner_active;
- ot->flag= 0;
+ ot->flag = 0;
- ot->prop= RNA_def_enum(ot->srna, "type", prop_group_op_types, 0, "Group Operation", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_group_op_types, 0, "Group Operation", "");
}
/* **************************************** */
@@ -869,18 +870,18 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_id_operation(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Outliner ID data Operation";
- ot->idname= "OUTLINER_OT_id_operation";
- ot->description= "";
+ ot->name = "Outliner ID data Operation";
+ ot->idname = "OUTLINER_OT_id_operation";
+ ot->description = "";
/* callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= outliner_id_operation_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = outliner_id_operation_exec;
+ ot->poll = ED_operator_outliner_active;
- ot->flag= 0;
+ ot->flag = 0;
- ot->prop= RNA_def_enum(ot->srna, "type", prop_id_op_types, 0, "ID data Operation", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_id_op_types, 0, "ID data Operation", "");
}
/* **************************************** */
@@ -894,7 +895,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l
for (te=lb->first; te; te= te->next) {
tselem= TREESTORE(te);
if (tselem->flag & TSE_SELECTED) {
- if(tselem->type==type) {
+ if (tselem->type==type) {
TreeStoreElem *tsep = TREESTORE(te->parent);
operation_cb(te, tselem, tsep, newid);
}
@@ -972,23 +973,23 @@ void OUTLINER_OT_action_set(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Outliner Set Action";
- ot->idname= "OUTLINER_OT_action_set";
- ot->description= "Change the active action used";
+ ot->name = "Outliner Set Action";
+ ot->idname = "OUTLINER_OT_action_set";
+ ot->description = "Change the active action used";
/* api callbacks */
- ot->invoke= WM_enum_search_invoke;
- ot->exec= outliner_action_set_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->invoke = WM_enum_search_invoke;
+ ot->exec = outliner_action_set_exec;
+ ot->poll = ED_operator_outliner_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
/* props */
// TODO: this would be nicer as an ID-pointer...
prop= RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", "");
RNA_def_enum_funcs(prop, RNA_action_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
/* **************************************** */
@@ -1087,18 +1088,18 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_animdata_operation(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Outliner Animation Data Operation";
- ot->idname= "OUTLINER_OT_animdata_operation";
- ot->description= "";
+ ot->name = "Outliner Animation Data Operation";
+ ot->idname = "OUTLINER_OT_animdata_operation";
+ ot->description = "";
/* callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= outliner_animdata_operation_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = outliner_animdata_operation_exec;
+ ot->poll = ED_operator_outliner_active;
- ot->flag= 0;
+ ot->flag = 0;
- ot->prop= RNA_def_enum(ot->srna, "type", prop_animdata_op_types, 0, "Animation Operation", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_animdata_op_types, 0, "Animation Operation", "");
}
/* **************************************** */
@@ -1124,29 +1125,29 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op)
event= RNA_enum_get(op->ptr, "type");
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
- if(datalevel==TSE_POSE_CHANNEL) {
- if(event>0) {
+ if (datalevel==TSE_POSE_CHANNEL) {
+ if (event>0) {
outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb);
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
ED_undo_push(C, "PoseChannel operation");
}
}
- else if(datalevel==TSE_BONE) {
- if(event>0) {
+ else if (datalevel==TSE_BONE) {
+ if (event>0) {
outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb);
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
ED_undo_push(C, "Bone operation");
}
}
- else if(datalevel==TSE_EBONE) {
- if(event>0) {
+ else if (datalevel==TSE_EBONE) {
+ if (event>0) {
outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb);
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
ED_undo_push(C, "EditBone operation");
}
}
- else if(datalevel==TSE_SEQUENCE) {
- if(event>0) {
+ else if (datalevel==TSE_SEQUENCE) {
+ if (event>0) {
outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb);
}
}
@@ -1158,18 +1159,18 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_data_operation(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Outliner Data Operation";
- ot->idname= "OUTLINER_OT_data_operation";
- ot->description= "";
+ ot->name = "Outliner Data Operation";
+ ot->idname = "OUTLINER_OT_data_operation";
+ ot->description = "";
/* callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= outliner_data_operation_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = outliner_data_operation_exec;
+ ot->poll = ED_operator_outliner_active;
- ot->flag= 0;
+ ot->flag = 0;
- ot->prop= RNA_def_enum(ot->srna, "type", prop_data_op_types, 0, "Data Operation", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_data_op_types, 0, "Data Operation", "");
}
@@ -1180,7 +1181,7 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
{
ReportList *reports = CTX_wm_reports(C); // XXX...
- if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
+ if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
TreeStoreElem *tselem= TREESTORE(te);
@@ -1198,15 +1199,15 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
- if(scenelevel) {
+ if (scenelevel) {
//if(objectlevel || datalevel || idlevel) error("Mixed selection");
//else pupmenu("Scene Operations%t|Delete");
}
- else if(objectlevel) {
+ else if (objectlevel) {
WM_operator_name_call(C, "OUTLINER_OT_object_operation", WM_OP_INVOKE_REGION_WIN, NULL);
}
- else if(idlevel) {
- if(idlevel==-1 || datalevel) BKE_report(reports, RPT_WARNING, "Mixed selection");
+ else if (idlevel) {
+ if (idlevel==-1 || datalevel) BKE_report(reports, RPT_WARNING, "Mixed selection");
else {
if (idlevel==ID_GR)
WM_operator_name_call(C, "OUTLINER_OT_group_operation", WM_OP_INVOKE_REGION_WIN, NULL);
@@ -1214,8 +1215,8 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
WM_operator_name_call(C, "OUTLINER_OT_id_operation", WM_OP_INVOKE_REGION_WIN, NULL);
}
}
- else if(datalevel) {
- if(datalevel==-1) BKE_report(reports, RPT_WARNING, "Mixed selection");
+ else if (datalevel) {
+ if (datalevel==-1) BKE_report(reports, RPT_WARNING, "Mixed selection");
else {
if (datalevel == TSE_ANIM_DATA)
WM_operator_name_call(C, "OUTLINER_OT_animdata_operation", WM_OP_INVOKE_REGION_WIN, NULL);
@@ -1231,8 +1232,8 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
return 1;
}
- for(te= te->subtree.first; te; te= te->next) {
- if(do_outliner_operation_event(C, scene, ar, soops, te, event, mval))
+ for (te= te->subtree.first; te; te= te->next) {
+ if (do_outliner_operation_event(C, scene, ar, soops, te, event, mval))
return 1;
}
return 0;
@@ -1249,8 +1250,8 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *even
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
- for(te= soops->tree.first; te; te= te->next) {
- if(do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) break;
+ for (te= soops->tree.first; te; te= te->next) {
+ if (do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) break;
}
return OPERATOR_FINISHED;
@@ -1259,13 +1260,13 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *even
/* Menu only! Calls other operators */
void OUTLINER_OT_operation(wmOperatorType *ot)
{
- ot->name= "Execute Operation";
- ot->idname= "OUTLINER_OT_operation";
- ot->description= "Context menu for item operations";
+ ot->name = "Execute Operation";
+ ot->idname = "OUTLINER_OT_operation";
+ ot->description = "Context menu for item operations";
- ot->invoke= outliner_operation;
+ ot->invoke = outliner_operation;
- ot->poll= ED_operator_outliner_active;
+ ot->poll = ED_operator_outliner_active;
}
/* ****************************************************** */
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 56cfcf9e18a..e83fce0cf05 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -115,23 +115,23 @@ static void outliner_storage_cleanup(SpaceOops *soops)
{
TreeStore *ts= soops->treestore;
- if(ts) {
+ if (ts) {
TreeStoreElem *tselem;
int a, unused= 0;
/* each element used once, for ID blocks with more users to have each a treestore */
- for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) tselem->used= 0;
+ for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) tselem->used= 0;
/* cleanup only after reading file or undo step, and always for
* RNA datablocks view in order to save memory */
- if(soops->storeflag & SO_TREESTORE_CLEANUP) {
+ if (soops->storeflag & SO_TREESTORE_CLEANUP) {
- for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
- if(tselem->id==NULL) unused++;
+ for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
+ if (tselem->id==NULL) unused++;
}
- if(unused) {
- if(ts->usedelem == unused) {
+ if (unused) {
+ if (ts->usedelem == unused) {
MEM_freeN(ts->data);
ts->data= NULL;
ts->usedelem= ts->totelem= 0;
@@ -140,8 +140,8 @@ static void outliner_storage_cleanup(SpaceOops *soops)
TreeStoreElem *tsnewar, *tsnew;
tsnew=tsnewar= MEM_mallocN((ts->usedelem-unused)*sizeof(TreeStoreElem), "new tselem");
- for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
- if(tselem->id) {
+ for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
+ if (tselem->id) {
*tsnew= *tselem;
tsnew++;
}
@@ -163,16 +163,16 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
int a;
/* case 1; no TreeStore */
- if(soops->treestore==NULL) {
+ if (soops->treestore==NULL) {
soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore");
}
ts= soops->treestore;
/* check if 'te' is in treestore */
tselem= ts->data;
- for(a=0; a<ts->usedelem; a++, tselem++) {
- if(tselem->id==id && tselem->used==0) {
- if((type==0 && tselem->type==0) ||(tselem->type==type && tselem->nr==nr)) {
+ for (a=0; a<ts->usedelem; a++, tselem++) {
+ if (tselem->id==id && tselem->used==0) {
+ if ((type==0 && tselem->type==0) ||(tselem->type==type && tselem->nr==nr)) {
te->store_index= a;
tselem->used= 1;
return;
@@ -181,11 +181,11 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
}
/* add 1 element to treestore */
- if(ts->usedelem==ts->totelem) {
+ if (ts->usedelem==ts->totelem) {
TreeStoreElem *tsnew;
tsnew= MEM_mallocN((ts->totelem+TS_CHUNK)*sizeof(TreeStoreElem), "treestore data");
- if(ts->data) {
+ if (ts->data) {
memcpy(tsnew, ts->data, ts->totelem*sizeof(TreeStoreElem));
MEM_freeN(ts->data);
}
@@ -196,7 +196,7 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
tselem= ts->data+ts->usedelem;
tselem->type= type;
- if(type) tselem->nr= nr; // we're picky! :)
+ if (type) tselem->nr= nr; // we're picky! :)
else tselem->nr= 0;
tselem->id= id;
tselem->used = 0;
@@ -211,13 +211,13 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
void outliner_free_tree(ListBase *lb)
{
- while(lb->first) {
+ while (lb->first) {
TreeElement *te= lb->first;
outliner_free_tree(&te->subtree);
BLI_remlink(lb, te);
- if(te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name);
+ if (te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name);
MEM_freeN(te);
}
}
@@ -232,10 +232,10 @@ void outliner_cleanup_tree(SpaceOops *soops)
static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index)
{
TreeElement *te= lb->first, *tes;
- while(te) {
- if(te->store_index==store_index) return te;
+ while (te) {
+ if (te->store_index==store_index) return te;
tes= outliner_find_tree_element(&te->subtree, store_index);
- if(tes) return tes;
+ if (tes) return tes;
te= te->next;
}
return NULL;
@@ -248,18 +248,18 @@ TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse)
TreeStoreElem *tselem;
int a;
- if(tse->id==NULL) return NULL;
+ if (tse->id==NULL) return NULL;
/* check if 'tse' is in treestore */
tselem= ts->data;
- for(a=0; a<ts->usedelem; a++, tselem++) {
- if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) {
- if(tselem->id==tse->id) {
+ for (a=0; a<ts->usedelem; a++, tselem++) {
+ if ((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) {
+ if (tselem->id==tse->id) {
break;
}
}
}
- if(tselem)
+ if (tselem)
return outliner_find_tree_element(&soops->tree, a);
return NULL;
@@ -271,14 +271,14 @@ TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id)
TreeElement *te, *tes;
TreeStoreElem *tselem;
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
- if(tselem->type==0) {
- if(tselem->id==id) return te;
+ if (tselem->type==0) {
+ if (tselem->id==id) return te;
/* only deeper on scene or object */
- if( te->idcode==ID_OB || te->idcode==ID_SCE || (soops->outlinevis == SO_GROUPS && te->idcode==ID_GR)) {
+ if ( te->idcode==ID_OB || te->idcode==ID_SCE || (soops->outlinevis == SO_GROUPS && te->idcode==ID_GR)) {
tes= outliner_find_id(soops, &te->subtree, id);
- if(tes) return tes;
+ if (tes) return tes;
}
}
}
@@ -291,9 +291,9 @@ ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode)
TreeStoreElem *tselem;
te= te->parent;
- while(te) {
+ while (te) {
tselem= TREESTORE(te);
- if(tselem->type==0 && te->idcode==idcode) return tselem->id;
+ if (tselem->type==0 && te->idcode==idcode) return tselem->id;
te= te->parent;
}
return NULL;
@@ -318,7 +318,7 @@ static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curB
te->name= curBone->name;
te->directdata= curBone;
- for(curBone= curBone->childbase.first; curBone; curBone=curBone->next) {
+ for (curBone= curBone->childbase.first; curBone; curBone=curBone->next) {
outliner_add_bone(soops, &te->subtree, id, curBone, te, a);
}
}
@@ -341,7 +341,7 @@ static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, Sc
/* save cpu cycles, but we add the first to invoke an open/close triangle */
tselem = TREESTORE(tenla);
- if(tselem->flag & TSE_CLOSED)
+ if (tselem->flag & TSE_CLOSED)
return;
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_Z));
@@ -422,14 +422,14 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s
int a;
tenla->name= "RenderLayers";
- for(a=0, srl= sce->r.layers.first; srl; srl= srl->next, a++) {
+ for (a=0, srl= sce->r.layers.first; srl; srl= srl->next, a++) {
TreeElement *tenlay= outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
tenlay->name= srl->name;
tenlay->directdata= &srl->passflag;
- if(srl->light_override)
+ if (srl->light_override)
outliner_add_element(soops, &tenlay->subtree, srl->light_override, tenlay, TSE_LINKED_LAMP, 0);
- if(srl->mat_override)
+ if (srl->mat_override)
outliner_add_element(soops, &tenlay->subtree, srl->mat_override, tenlay, TSE_LINKED_MAT, 0);
outliner_add_passes(soops, tenlay, &sce->id, srl);
@@ -469,13 +469,13 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
if ((arm->edbo == NULL) && (ob->mode & OB_MODE_POSE)) {
int a= 0, const_index= 1000; /* ensure unique id for bone constraints */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, a++) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, a++) {
ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a);
ten->name= pchan->name;
ten->directdata= pchan;
pchan->temp= (void *)ten;
- if(pchan->constraints.first) {
+ if (pchan->constraints.first) {
//Object *target;
bConstraint *con;
TreeElement *ten1;
@@ -483,12 +483,12 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
//char *str;
tenla1->name= "Constraints";
- for(con= pchan->constraints.first; con; con= con->next, const_index++) {
+ for (con= pchan->constraints.first; con; con= con->next, const_index++) {
ten1= outliner_add_element(soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index);
#if 0 /* disabled as it needs to be reworked for recoded constraints system */
target= get_constraint_target(con, &str);
- if(str && str[0]) ten1->name= str;
- else if(target) ten1->name= target->id.name+2;
+ if (str && str[0]) ten1->name= str;
+ else if (target) ten1->name= target->id.name+2;
else ten1->name= con->name;
#endif
ten1->name= con->name;
@@ -499,12 +499,12 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
}
/* make hierarchy */
ten= tenla->subtree.first;
- while(ten) {
+ while (ten) {
TreeElement *nten= ten->next, *par;
tselem= TREESTORE(ten);
- if(tselem->type==TSE_POSE_CHANNEL) {
+ if (tselem->type==TSE_POSE_CHANNEL) {
pchan= (bPoseChannel *)ten->directdata;
- if(pchan->parent) {
+ if (pchan->parent) {
BLI_remlink(&tenla->subtree, ten);
par= (TreeElement *)pchan->parent->temp;
BLI_addtail(&par->subtree, ten);
@@ -516,7 +516,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
}
/* Pose Groups */
- if(ob->pose->agroups.first) {
+ if (ob->pose->agroups.first) {
bActionGroup *agrp;
TreeElement *ten;
TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
@@ -531,10 +531,10 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
}
}
- for(a=0; a<ob->totcol; a++)
+ for (a=0; a<ob->totcol; a++)
outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a);
- if(ob->constraints.first) {
+ if (ob->constraints.first) {
//Object *target;
bConstraint *con;
TreeElement *ten;
@@ -546,8 +546,8 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a);
#if 0 /* disabled due to constraints system targets recode... code here needs review */
target= get_constraint_target(con, &str);
- if(str && str[0]) ten->name= str;
- else if(target) ten->name= target->id.name+2;
+ if (str && str[0]) ten->name= str;
+ else if (target) ten->name= target->id.name+2;
else ten->name= con->name;
#endif
ten->name= con->name;
@@ -641,7 +641,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
outliner_add_element(soops, &te->subtree, me, te, TSE_ANIM_DATA, 0);
outliner_add_element(soops, &te->subtree, me->key, te, 0, 0);
- for(a=0; a<me->totcol; a++)
+ for (a=0; a<me->totcol; a++)
outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a);
/* could do tfaces with image links, but the images are not grouped nicely.
* would require going over all tfaces, sort images in use. etc... */
@@ -655,7 +655,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
if (cu->adt)
outliner_add_element(soops, &te->subtree, cu, te, TSE_ANIM_DATA, 0);
- for(a=0; a<cu->totcol; a++)
+ for (a=0; a<cu->totcol; a++)
outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a);
}
break;
@@ -667,7 +667,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
if (mb->adt)
outliner_add_element(soops, &te->subtree, mb, te, TSE_ANIM_DATA, 0);
- for(a=0; a<mb->totcol; a++)
+ for (a=0; a<mb->totcol; a++)
outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a);
}
break;
@@ -679,8 +679,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
if (ma->adt)
outliner_add_element(soops, &te->subtree, ma, te, TSE_ANIM_DATA, 0);
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a);
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a);
}
}
break;
@@ -710,8 +710,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
if (la->adt)
outliner_add_element(soops, &te->subtree, la, te, TSE_ANIM_DATA, 0);
- for(a=0; a<MAX_MTEX; a++) {
- if(la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a);
+ for (a=0; a<MAX_MTEX; a++) {
+ if (la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a);
}
}
break;
@@ -719,7 +719,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
{
Speaker *spk= (Speaker *)id;
- if(spk->adt)
+ if (spk->adt)
outliner_add_element(soops, &te->subtree, spk, te, TSE_ANIM_DATA, 0);
}
break;
@@ -731,8 +731,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
if (wrld->adt)
outliner_add_element(soops, &te->subtree, wrld, te, TSE_ANIM_DATA, 0);
- for(a=0; a<MAX_MTEX; a++) {
- if(wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
+ for (a=0; a<MAX_MTEX; a++) {
+ if (wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
}
}
break;
@@ -758,7 +758,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
if (arm->adt)
outliner_add_element(soops, &te->subtree, arm, te, TSE_ANIM_DATA, 0);
- if(arm->edbo) {
+ if (arm->edbo) {
EditBone *ebone;
TreeElement *ten;
@@ -770,10 +770,10 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
}
/* make hierarchy */
ten= arm->edbo->first ? ((EditBone *)arm->edbo->first)->temp : NULL;
- while(ten) {
+ while (ten) {
TreeElement *nten= ten->next, *par;
ebone= (EditBone *)ten->directdata;
- if(ebone->parent) {
+ if (ebone->parent) {
BLI_remlink(&te->subtree, ten);
par= ebone->parent->temp;
BLI_addtail(&par->subtree, ten);
@@ -785,10 +785,10 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
else {
/* do not extend Armature when we have posemode */
tselem= TREESTORE(te->parent);
- if( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE);
+ if ( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE);
else {
Bone *curBone;
- for (curBone=arm->bonebase.first; curBone; curBone=curBone->next){
+ for (curBone=arm->bonebase.first; curBone; curBone=curBone->next) {
outliner_add_bone(soops, &te->subtree, id, curBone, te, &a);
}
}
@@ -807,12 +807,12 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
ID *id= idv;
int a = 0;
- if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
+ if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
id= ((PointerRNA*)idv)->id.data;
- if(!id) id= ((PointerRNA*)idv)->data;
+ if (!id) id= ((PointerRNA*)idv)->data;
}
- if(id==NULL) return NULL;
+ if (id==NULL) return NULL;
te= MEM_callocN(sizeof(TreeElement), "tree elem");
/* add to the visual tree */
@@ -822,24 +822,24 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
tselem= TREESTORE(te);
/* if we are searching for something expand to see child elements */
- if(SEARCHING_OUTLINER(soops))
+ if (SEARCHING_OUTLINER(soops))
tselem->flag |= TSE_CHILDSEARCH;
te->parent= parent;
te->index= index; // for data arays
- if(ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP));
- else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM));
- else if(type==TSE_ANIM_DATA);
+ if (ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP));
+ else if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM));
+ else if (type==TSE_ANIM_DATA);
else {
te->name= id->name+2; // default, can be overridden by Library or non-ID data
te->idcode= GS(id->name);
}
- if(type==0) {
+ if (type==0) {
/* ID datablock */
outliner_add_id_contents(soops, te, tselem, id);
}
- else if(type==TSE_ANIM_DATA) {
+ else if (type==TSE_ANIM_DATA) {
IdAdtTemplate *iat = (IdAdtTemplate *)idv;
AnimData *adt= (AnimData *)iat->adt;
@@ -897,12 +897,12 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
for (strip=nlt->strips.first; strip; strip=strip->next, b++) {
ten= outliner_add_element(soops, &tenlt->subtree, strip->act, tenlt, TSE_NLA_ACTION, b);
- if(ten) ten->directdata= strip;
+ if (ten) ten->directdata= strip;
}
}
}
}
- else if(type==TSE_SEQUENCE) {
+ else if (type==TSE_SEQUENCE) {
Sequence *seq= (Sequence*) idv;
Sequence *p;
@@ -914,25 +914,25 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->idcode= seq->type;
te->directdata= seq;
- if(seq->type<7) {
+ if (seq->type<7) {
/*
* This work like the sequence.
* If the sequence have a name (not default name)
* show it, in other case put the filename.
*/
- if(strcmp(seq->name, "SQ"))
+ if (strcmp(seq->name, "SQ"))
te->name= seq->name;
else {
- if((seq->strip) && (seq->strip->stripdata))
+ if ((seq->strip) && (seq->strip->stripdata))
te->name= seq->strip->stripdata->name;
else
te->name= "SQ None";
}
- if(seq->type==SEQ_META) {
+ if (seq->type==SEQ_META) {
te->name= "Meta Strip";
p= seq->seqbase.first;
- while(p) {
+ while (p) {
outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index);
p= p->next;
}
@@ -943,23 +943,23 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
else
te->name= "Effect";
}
- else if(type==TSE_SEQ_STRIP) {
+ else if (type==TSE_SEQ_STRIP) {
Strip *strip= (Strip *)idv;
- if(strip->dir)
+ if (strip->dir)
te->name= strip->dir;
else
te->name= "Strip None";
te->directdata= strip;
}
- else if(type==TSE_SEQUENCE_DUP) {
+ else if (type==TSE_SEQUENCE_DUP) {
Sequence *seq= (Sequence*)idv;
te->idcode= seq->type;
te->directdata= seq;
te->name= seq->strip->stripdata->name;
}
- else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
+ else if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
PointerRNA pptr, propptr, *ptr= (PointerRNA*)idv;
PropertyRNA *prop, *iterprop;
PropertyType proptype;
@@ -967,39 +967,39 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
/* we do lazy build, for speed and to avoid infinite recusion */
- if(ptr->data == NULL) {
+ if (ptr->data == NULL) {
te->name= "(empty)";
}
- else if(type == TSE_RNA_STRUCT) {
+ else if (type == TSE_RNA_STRUCT) {
/* struct */
te->name= RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
- if(te->name)
+ if (te->name)
te->flag |= TE_FREE_NAME;
else
te->name= RNA_struct_ui_name(ptr->type);
/* If searching don't expand RNA entries */
- if(SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
+ if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
iterprop= RNA_struct_iterator_property(ptr->type);
tot= RNA_property_collection_length(ptr, iterprop);
/* auto open these cases */
- if(!parent || (RNA_property_type(parent->directdata)) == PROP_POINTER)
- if(!tselem->used)
+ if (!parent || (RNA_property_type(parent->directdata)) == PROP_POINTER)
+ if (!tselem->used)
tselem->flag &= ~TSE_CLOSED;
- if(TSELEM_OPEN(tselem,soops)) {
- for(a=0; a<tot; a++)
+ if (TSELEM_OPEN(tselem,soops)) {
+ for (a=0; a<tot; a++)
outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_PROPERTY, a);
}
- else if(tot)
+ else if (tot)
te->flag |= TE_LAZY_CLOSED;
te->rnaptr= *ptr;
}
- else if(type == TSE_RNA_PROPERTY) {
+ else if (type == TSE_RNA_PROPERTY) {
/* property */
iterprop= RNA_struct_iterator_property(ptr->type);
RNA_property_collection_lookup_int(ptr, iterprop, index, &propptr);
@@ -1012,42 +1012,42 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->rnaptr= *ptr;
/* If searching don't expand RNA entries */
- if(SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
+ if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
- if(proptype == PROP_POINTER) {
+ if (proptype == PROP_POINTER) {
pptr= RNA_property_pointer_get(ptr, prop);
- if(pptr.data) {
- if(TSELEM_OPEN(tselem,soops))
+ if (pptr.data) {
+ if (TSELEM_OPEN(tselem,soops))
outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, -1);
else
te->flag |= TE_LAZY_CLOSED;
}
}
- else if(proptype == PROP_COLLECTION) {
+ else if (proptype == PROP_COLLECTION) {
tot= RNA_property_collection_length(ptr, prop);
- if(TSELEM_OPEN(tselem,soops)) {
- for(a=0; a<tot; a++) {
+ if (TSELEM_OPEN(tselem,soops)) {
+ for (a=0; a<tot; a++) {
RNA_property_collection_lookup_int(ptr, prop, a, &pptr);
outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, a);
}
}
- else if(tot)
+ else if (tot)
te->flag |= TE_LAZY_CLOSED;
}
- else if(ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
+ else if (ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
tot= RNA_property_array_length(ptr, prop);
- if(TSELEM_OPEN(tselem,soops)) {
- for(a=0; a<tot; a++)
+ if (TSELEM_OPEN(tselem,soops)) {
+ for (a=0; a<tot; a++)
outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_ARRAY_ELEM, a);
}
- else if(tot)
+ else if (tot)
te->flag |= TE_LAZY_CLOSED;
}
}
- else if(type == TSE_RNA_ARRAY_ELEM) {
+ else if (type == TSE_RNA_ARRAY_ELEM) {
char c;
prop= parent->directdata;
@@ -1059,12 +1059,12 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
c= RNA_property_array_item_char(prop, index);
te->name= MEM_callocN(sizeof(char)*20, "OutlinerRNAArrayName");
- if(c) sprintf((char *)te->name, " %c", c);
+ if (c) sprintf((char *)te->name, " %c", c);
else sprintf((char *)te->name, " %d", index+1);
te->flag |= TE_FREE_NAME;
}
}
- else if(type == TSE_KEYMAP) {
+ else if (type == TSE_KEYMAP) {
wmKeyMap *km= (wmKeyMap *)idv;
wmKeyMapItem *kmi;
char opname[OP_MAX_TYPENAME];
@@ -1072,24 +1072,24 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->directdata= idv;
te->name= km->idname;
- if(TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem,soops)) {
a= 0;
- for (kmi= km->items.first; kmi; kmi= kmi->next, a++) {
+ for (kmi = km->items.first; kmi; kmi = kmi->next, a++) {
const char *key= WM_key_event_string(kmi->type);
- if(key[0]) {
+ if (key[0]) {
wmOperatorType *ot= NULL;
- if(kmi->propvalue);
+ if (kmi->propvalue);
else ot= WM_operatortype_find(kmi->idname, 0);
- if(ot || kmi->propvalue) {
+ if (ot || kmi->propvalue) {
TreeElement *ten= outliner_add_element(soops, &te->subtree, kmi, te, TSE_KEYMAP_ITEM, a);
ten->directdata= kmi;
- if(kmi->propvalue) {
+ if (kmi->propvalue) {
ten->name= "Modal map, not yet";
}
else {
@@ -1116,7 +1116,7 @@ static int need_add_seq_dup(Sequence *seq)
{
Sequence *p;
- if((!seq->strip) || (!seq->strip->stripdata) || (!seq->strip->stripdata->name))
+ if ((!seq->strip) || (!seq->strip->stripdata) || (!seq->strip->stripdata->name))
return(1);
/*
@@ -1124,25 +1124,25 @@ static int need_add_seq_dup(Sequence *seq)
* sequence before this, don't need it, just return.
*/
p= seq->prev;
- while(p) {
- if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+ while (p) {
+ if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
p= p->prev;
continue;
}
- if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
+ if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
return(2);
p= p->prev;
}
p= seq->next;
- while(p) {
- if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+ while (p) {
+ if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
p= p->next;
continue;
}
- if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
+ if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
return(0);
p= p->next;
}
@@ -1155,13 +1155,13 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t
Sequence *p;
p= seq;
- while(p) {
- if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+ while (p) {
+ if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
p= p->next;
continue;
}
- if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
+ if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
/* ch= */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index);
p= p->next;
}
@@ -1181,18 +1181,18 @@ static void outliner_make_hierarchy(SpaceOops *soops, ListBase *lb)
/* build hierarchy */
// XXX also, set extents here...
te= lb->first;
- while(te) {
+ while (te) {
ten= te->next;
tselem= TREESTORE(te);
- if(tselem->type==0 && te->idcode==ID_OB) {
+ if (tselem->type==0 && te->idcode==ID_OB) {
Object *ob= (Object *)tselem->id;
- if(ob->parent && ob->parent->id.newid) {
+ if (ob->parent && ob->parent->id.newid) {
BLI_remlink(lb, te);
tep= (TreeElement *)ob->parent->id.newid;
BLI_addtail(&tep->subtree, te);
// set correct parent pointers
- for(te=tep->subtree.first; te; te= te->next) te->parent= tep;
+ for (te=tep->subtree.first; te; te= te->next) te->parent= tep;
}
}
te= ten;
@@ -1216,15 +1216,15 @@ static int treesort_alpha(const void *v1, const void *v2)
/* first put objects last (hierarchy) */
comp= (x1->idcode==ID_OB);
- if(x2->idcode==ID_OB) comp+=2;
+ if (x2->idcode==ID_OB) comp+=2;
- if(comp==1) return 1;
- else if(comp==2) return -1;
- else if(comp==3) {
+ if (comp==1) return 1;
+ else if (comp==2) return -1;
+ else if (comp==3) {
comp= strcmp(x1->name, x2->name);
- if( comp>0 ) return 1;
- else if( comp<0) return -1;
+ if ( comp>0 ) return 1;
+ else if ( comp<0) return -1;
return 0;
}
return 0;
@@ -1237,20 +1237,20 @@ static int treesort_obtype_alpha(const void *v1, const void *v2)
const tTreeSort *x1= v1, *x2= v2;
/* first put objects last (hierarchy) */
- if(x1->idcode==ID_OB && x2->idcode!=ID_OB) return 1;
- else if(x2->idcode==ID_OB && x1->idcode!=ID_OB) return -1;
+ if (x1->idcode==ID_OB && x2->idcode!=ID_OB) return 1;
+ else if (x2->idcode==ID_OB && x1->idcode!=ID_OB) return -1;
else {
/* 2nd we check ob type */
- if(x1->idcode==ID_OB && x2->idcode==ID_OB) {
- if( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1;
- else if( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1;
+ if (x1->idcode==ID_OB && x2->idcode==ID_OB) {
+ if ( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1;
+ else if ( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1;
else return 0;
}
else {
int comp= strcmp(x1->name, x2->name);
- if( comp>0 ) return 1;
- else if( comp<0) return -1;
+ if ( comp>0 ) return 1;
+ else if ( comp<0) return -1;
return 0;
}
}
@@ -1265,38 +1265,38 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb)
int totelem=0;
te= lb->last;
- if(te==NULL) return;
+ if (te==NULL) return;
tselem= TREESTORE(te);
/* sorting rules; only object lists or deformgroups */
- if( (tselem->type==TSE_DEFGROUP) || (tselem->type==0 && te->idcode==ID_OB)) {
+ if ( (tselem->type==TSE_DEFGROUP) || (tselem->type==0 && te->idcode==ID_OB)) {
/* count first */
- for(te= lb->first; te; te= te->next) totelem++;
+ for (te= lb->first; te; te= te->next) totelem++;
- if(totelem>1) {
+ if (totelem>1) {
tTreeSort *tear= MEM_mallocN(totelem*sizeof(tTreeSort), "tree sort array");
tTreeSort *tp=tear;
int skip= 0;
- for(te= lb->first; te; te= te->next, tp++) {
+ for (te= lb->first; te; te= te->next, tp++) {
tselem= TREESTORE(te);
tp->te= te;
tp->name= te->name;
tp->idcode= te->idcode;
- if(tselem->type && tselem->type!=TSE_DEFGROUP) tp->idcode= 0; // dont sort this
+ if (tselem->type && tselem->type!=TSE_DEFGROUP) tp->idcode= 0; // don't sort this
tp->id= tselem->id;
}
/* keep beginning of list */
- for(tp= tear, skip=0; skip<totelem; skip++, tp++)
- if(tp->idcode) break;
+ for (tp= tear, skip=0; skip<totelem; skip++, tp++)
+ if (tp->idcode) break;
- if(skip<totelem)
+ if (skip<totelem)
qsort(tear+skip, totelem-skip, sizeof(tTreeSort), treesort_alpha);
lb->first=lb->last= NULL;
tp= tear;
- while(totelem--) {
+ while (totelem--) {
BLI_addtail(lb, tp->te);
tp++;
}
@@ -1304,7 +1304,7 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb)
}
}
- for(te= lb->first; te; te= te->next) {
+ for (te= lb->first; te; te= te->next) {
outliner_sort(soops, &te->subtree);
}
}
@@ -1379,7 +1379,7 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)
outliner_free_tree(&te->subtree);
BLI_remlink(lb, te);
- if(te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name);
+ if (te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name);
MEM_freeN(te);
}
}
@@ -1414,35 +1414,35 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
/* Are we looking for something - we want to tag parents to filter child matches
* - NOT in datablocks view - searching all datablocks takes way too long to be useful
* - this variable is only set once per tree build */
- if(soops->search_string[0]!=0 && soops->outlinevis!=SO_DATABLOCKS)
+ if (soops->search_string[0]!=0 && soops->outlinevis!=SO_DATABLOCKS)
soops->search_flags |= SO_SEARCH_RECURSIVE;
else
soops->search_flags &= ~SO_SEARCH_RECURSIVE;
- if(soops->tree.first && (soops->storeflag & SO_TREESTORE_REDRAW))
+ if (soops->tree.first && (soops->storeflag & SO_TREESTORE_REDRAW))
return;
outliner_free_tree(&soops->tree);
outliner_storage_cleanup(soops);
/* clear ob id.new flags */
- for(ob= mainvar->object.first; ob; ob= ob->id.next) ob->id.newid= NULL;
+ for (ob= mainvar->object.first; ob; ob= ob->id.next) ob->id.newid= NULL;
/* options */
- if(soops->outlinevis == SO_LIBRARIES) {
+ if (soops->outlinevis == SO_LIBRARIES) {
Library *lib;
- for(lib= mainvar->library.first; lib; lib= lib->id.next) {
+ for (lib= mainvar->library.first; lib; lib= lib->id.next) {
ten= outliner_add_element(soops, &soops->tree, lib, NULL, 0, 0);
lib->id.newid= (ID *)ten;
}
/* make hierarchy */
ten= soops->tree.first;
- while(ten) {
+ while (ten) {
TreeElement *nten= ten->next, *par;
tselem= TREESTORE(ten);
lib= (Library *)tselem->id;
- if(lib->parent) {
+ if (lib->parent) {
BLI_remlink(&soops->tree, ten);
par= (TreeElement *)lib->parent->id.newid;
BLI_addtail(&par->subtree, ten);
@@ -1451,67 +1451,67 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
ten= nten;
}
/* restore newid pointers */
- for(lib= mainvar->library.first; lib; lib= lib->id.next)
+ for (lib= mainvar->library.first; lib; lib= lib->id.next)
lib->id.newid= NULL;
}
- else if(soops->outlinevis == SO_ALL_SCENES) {
+ else if (soops->outlinevis == SO_ALL_SCENES) {
Scene *sce;
- for(sce= mainvar->scene.first; sce; sce= sce->id.next) {
+ for (sce= mainvar->scene.first; sce; sce= sce->id.next) {
te= outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
tselem= TREESTORE(te);
- if(sce==scene && show_opened)
+ if (sce==scene && show_opened)
tselem->flag &= ~TSE_CLOSED;
- for(base= sce->base.first; base; base= base->next) {
+ for (base= sce->base.first; base; base= base->next) {
ten= outliner_add_element(soops, &te->subtree, base->object, te, 0, 0);
ten->directdata= base;
}
outliner_make_hierarchy(soops, &te->subtree);
/* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */
- for(base= sce->base.first; base; base= base->next) base->object->id.newid= NULL;
+ for (base= sce->base.first; base; base= base->next) base->object->id.newid= NULL;
}
}
- else if(soops->outlinevis == SO_CUR_SCENE) {
+ else if (soops->outlinevis == SO_CUR_SCENE) {
outliner_add_scene_contents(soops, &soops->tree, scene, NULL);
- for(base= scene->base.first; base; base= base->next) {
+ for (base= scene->base.first; base; base= base->next) {
ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
ten->directdata= base;
}
outliner_make_hierarchy(soops, &soops->tree);
}
- else if(soops->outlinevis == SO_VISIBLE) {
- for(base= scene->base.first; base; base= base->next) {
- if(base->lay & scene->lay)
+ else if (soops->outlinevis == SO_VISIBLE) {
+ for (base= scene->base.first; base; base= base->next) {
+ if (base->lay & scene->lay)
outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
}
outliner_make_hierarchy(soops, &soops->tree);
}
- else if(soops->outlinevis == SO_GROUPS) {
+ else if (soops->outlinevis == SO_GROUPS) {
Group *group;
GroupObject *go;
- for(group= mainvar->group.first; group; group= group->id.next) {
- if(group->gobject.first) {
+ for (group= mainvar->group.first; group; group= group->id.next) {
+ if (group->gobject.first) {
te= outliner_add_element(soops, &soops->tree, group, NULL, 0, 0);
- for(go= group->gobject.first; go; go= go->next) {
+ for (go= group->gobject.first; go; go= go->next) {
ten= outliner_add_element(soops, &te->subtree, go->ob, te, 0, 0);
ten->directdata= NULL; /* eh, why? */
}
outliner_make_hierarchy(soops, &te->subtree);
/* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */
- for(go= group->gobject.first; go; go= go->next) go->ob->id.newid= NULL;
+ for (go= group->gobject.first; go; go= go->next) go->ob->id.newid= NULL;
}
}
}
- else if(soops->outlinevis == SO_SAME_TYPE) {
+ else if (soops->outlinevis == SO_SAME_TYPE) {
Object *ob= OBACT;
- if(ob) {
- for(base= scene->base.first; base; base= base->next) {
- if(base->object->type==ob->type) {
+ if (ob) {
+ for (base= scene->base.first; base; base= base->next) {
+ if (base->object->type==ob->type) {
ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
ten->directdata= base;
}
@@ -1519,10 +1519,10 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
outliner_make_hierarchy(soops, &soops->tree);
}
}
- else if(soops->outlinevis == SO_SELECTED) {
- for(base= scene->base.first; base; base= base->next) {
- if(base->lay & scene->lay) {
- if(base==BASACT || (base->flag & SELECT)) {
+ else if (soops->outlinevis == SO_SELECTED) {
+ for (base= scene->base.first; base; base= base->next) {
+ if (base->lay & scene->lay) {
+ if (base==BASACT || (base->flag & SELECT)) {
ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
ten->directdata= base;
}
@@ -1530,65 +1530,65 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
}
outliner_make_hierarchy(soops, &soops->tree);
}
- else if(soops->outlinevis==SO_SEQUENCE) {
+ else if (soops->outlinevis==SO_SEQUENCE) {
Sequence *seq;
Editing *ed= seq_give_editing(scene, FALSE);
int op;
- if(ed==NULL)
+ if (ed==NULL)
return;
seq= ed->seqbasep->first;
- if(!seq)
+ if (!seq)
return;
- while(seq) {
+ while (seq) {
op= need_add_seq_dup(seq);
- if(op==1) {
+ if (op==1) {
/* ten= */ outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE, 0);
}
- else if(op==0) {
+ else if (op==0) {
ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE_DUP, 0);
outliner_add_seq_dup(soops, seq, ten, 0);
}
seq= seq->next;
}
}
- else if(soops->outlinevis==SO_DATABLOCKS) {
+ else if (soops->outlinevis==SO_DATABLOCKS) {
PointerRNA mainptr;
RNA_main_pointer_create(mainvar, &mainptr);
ten= outliner_add_element(soops, &soops->tree, (void*)&mainptr, NULL, TSE_RNA_STRUCT, -1);
- if(show_opened) {
+ if (show_opened) {
tselem= TREESTORE(ten);
tselem->flag &= ~TSE_CLOSED;
}
}
- else if(soops->outlinevis==SO_USERDEF) {
+ else if (soops->outlinevis==SO_USERDEF) {
PointerRNA userdefptr;
RNA_pointer_create(NULL, &RNA_UserPreferences, &U, &userdefptr);
ten= outliner_add_element(soops, &soops->tree, (void*)&userdefptr, NULL, TSE_RNA_STRUCT, -1);
- if(show_opened) {
+ if (show_opened) {
tselem= TREESTORE(ten);
tselem->flag &= ~TSE_CLOSED;
}
}
- else if(soops->outlinevis==SO_KEYMAP) {
+ else if (soops->outlinevis==SO_KEYMAP) {
wmWindowManager *wm= mainvar->wm.first;
wmKeyMap *km;
- for(km= wm->defaultconf->keymaps.first; km; km= km->next) {
+ for (km= wm->defaultconf->keymaps.first; km; km= km->next) {
/* ten= */ outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0);
}
}
else {
ten= outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0);
- if(ten) ten->directdata= BASACT;
+ if (ten) ten->directdata= BASACT;
}
outliner_sort(soops, &soops->tree);
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index ebbe28e62fa..ed050b7f93d 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -66,7 +66,7 @@ static void outliner_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0);
/* don't pass on view2d mask, it's always set with scrollbar space, hide fails */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, NULL, &ar->winrct);
@@ -83,15 +83,15 @@ static int outliner_parent_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
float fmval[2];
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
- if(drag->type == WM_DRAG_ID) {
+ if (drag->type == WM_DRAG_ID) {
ID *id = (ID *)drag->poin;
- if( GS(id->name) == ID_OB ) {
+ if ( GS(id->name) == ID_OB ) {
/* Ensure item under cursor is valid drop target */
/* Find object hovered over */
- for(te= soops->tree.first; te; te= te->next) {
+ for (te= soops->tree.first; te; te= te->next) {
TreeElement *te_valid;
te_valid= outliner_dropzone_parent(C, event, te, fmval);
- if(te_valid) return 1;
+ if (te_valid) return 1;
}
}
}
@@ -114,20 +114,20 @@ static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, wmEvent *event)
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
- if(drag->type == WM_DRAG_ID) {
+ if (drag->type == WM_DRAG_ID) {
ID *id = (ID *)drag->poin;
- if( GS(id->name) == ID_OB ) {
+ if ( GS(id->name) == ID_OB ) {
//TODO: Check if no parent?
/* Ensure location under cursor is valid dropzone */
- for(te= soops->tree.first; te; te= te->next) {
- if(outliner_dropzone_parent_clear(C, event, te, fmval)) return 1;
+ for (te= soops->tree.first; te; te= te->next) {
+ if (outliner_dropzone_parent_clear(C, event, te, fmval)) return 1;
}
/* Check if mouse cursor is below the tree */
te= soops->tree.last;
- while(((te->flag & TE_LAZY_CLOSED)==0) && (te->subtree.last)) {
+ while (((te->flag & TE_LAZY_CLOSED)==0) && (te->subtree.last)) {
te= te->subtree.last;
}
- if(fmval[1] < te->ys) return 1;
+ if (fmval[1] < te->ys) return 1;
}
}
return 0;
@@ -232,15 +232,15 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
break;
case NC_LAMP:
/* For updating lamp icons, when changing lamp type */
- if(wmn->data == ND_LIGHTING_DRAW)
+ if (wmn->data == ND_LIGHTING_DRAW)
ED_region_tag_redraw(ar);
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_OUTLINER)
+ if (wmn->data == ND_SPACE_OUTLINER)
ED_region_tag_redraw(ar);
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
case NC_MATERIAL:
@@ -269,7 +269,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case ND_ANIMCHAN:
- if(wmn->action==NA_SELECTED)
+ if (wmn->action==NA_SELECTED)
ED_region_tag_redraw(ar);
break;
}
@@ -301,11 +301,11 @@ static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch(wmn->category) {
case NC_SCENE:
- if(wmn->data == ND_KEYINGSET)
+ if (wmn->data == ND_KEYINGSET)
ED_region_tag_redraw(ar);
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_OUTLINER)
+ if (wmn->data == ND_SPACE_OUTLINER)
ED_region_tag_redraw(ar);
break;
}
@@ -349,8 +349,8 @@ static void outliner_free(SpaceLink *sl)
SpaceOops *soutliner= (SpaceOops*)sl;
outliner_free_tree(&soutliner->tree);
- if(soutliner->treestore) {
- if(soutliner->treestore->data) MEM_freeN(soutliner->treestore->data);
+ if (soutliner->treestore) {
+ if (soutliner->treestore->data) MEM_freeN(soutliner->treestore->data);
MEM_freeN(soutliner->treestore);
}
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 7702e952e24..4ff0c7ba5b3 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -57,7 +57,7 @@ static int run_pyfile_exec(bContext *C, wmOperator *op)
char path[512];
RNA_string_get(op->ptr, "filepath", path);
#ifdef WITH_PYTHON
- if(BPY_filepath_exec(C, path, op->reports)) {
+ if (BPY_filepath_exec(C, path, op->reports)) {
ARegion *ar= CTX_wm_region(C);
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
@@ -71,16 +71,16 @@ static int run_pyfile_exec(bContext *C, wmOperator *op)
void SCRIPT_OT_python_file_run(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Run python file";
- ot->description= "Run Python file";
- ot->idname= "SCRIPT_OT_python_file_run";
+ ot->name = "Run python file";
+ ot->description = "Run Python file";
+ ot->idname = "SCRIPT_OT_python_file_run";
ot->flag = OPTYPE_UNDO;
/* api callbacks */
- ot->exec= run_pyfile_exec;
- ot->poll= ED_operator_areaactive;
+ ot->exec = run_pyfile_exec;
+ ot->poll = ED_operator_areaactive;
- RNA_def_string_file_path(ot->srna, "filepath", "", 512, "Path", "");
+ RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, "Path", "");
}
@@ -103,10 +103,10 @@ static int script_reload_exec(bContext *C, wmOperator *UNUSED(op))
void SCRIPT_OT_reload(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reload Scripts";
- ot->description= "Reload Scripts";
- ot->idname= "SCRIPT_OT_reload";
+ ot->name = "Reload Scripts";
+ ot->description = "Reload Scripts";
+ ot->idname = "SCRIPT_OT_reload";
/* api callbacks */
- ot->exec= script_reload_exec;
+ ot->exec = script_reload_exec;
}
diff --git a/source/blender/editors/space_script/script_ops.c b/source/blender/editors/space_script/script_ops.c
index 3ae89eefda3..0c99d9b34c4 100644
--- a/source/blender/editors/space_script/script_ops.c
+++ b/source/blender/editors/space_script/script_ops.c
@@ -60,7 +60,7 @@ void script_operatortypes(void)
void script_keymap(wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Script", SPACE_SCRIPT, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Script", SPACE_SCRIPT, 0);
/* TODO - this is just while we have no way to load a text datablock */
RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0)->ptr, "filepath", "test.py");
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index dbda276b20c..bad9a01fbcf 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -135,7 +135,7 @@ static void script_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Script", SPACE_SCRIPT, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Script", SPACE_SCRIPT, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 96e837eb95b..7c5f1a1543f 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -52,9 +52,9 @@
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_sequencer.h"
+#include "BKE_movieclip.h"
#include "BKE_report.h"
-
#include "WM_api.h"
#include "WM_types.h"
@@ -88,10 +88,10 @@
static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
{
- if(flag & SEQPROP_STARTFRAME)
+ if (flag & SEQPROP_STARTFRAME)
RNA_def_int(ot->srna, "frame_start", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX);
- if(flag & SEQPROP_ENDFRAME)
+ if (flag & SEQPROP_ENDFRAME)
RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX); /* not usual since most strips have a fixed length */
RNA_def_int(ot->srna, "channel", 1, 1, MAXSEQ, "Channel", "Channel to place this strip into", 1, MAXSEQ);
@@ -103,10 +103,10 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, const char *identifier)
{
- if(RNA_struct_find_property(op->ptr, identifier)) {
+ if (RNA_struct_find_property(op->ptr, identifier)) {
Scene *scene= CTX_data_scene(C);
Sequence *last_seq= seq_active_get(scene);
- if(last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
+ if (last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
char path[sizeof(last_seq->strip->dir)];
BLI_strncpy(path, last_seq->strip->dir, sizeof(path));
BLI_path_abs(path, G.main->name);
@@ -123,8 +123,8 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w
UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &mval_v2d[0], &mval_v2d[1]);
- /* effect strips dont need a channel initialized from the mouse */
- if(!(flag & SEQPROP_NOCHAN)) {
+ /* effect strips don't need a channel initialized from the mouse */
+ if (!(flag & SEQPROP_NOCHAN)) {
RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f);
}
@@ -149,17 +149,18 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
seq_load->end_frame= seq_load->start_frame; /* un-set */
seq_load->channel= RNA_int_get(op->ptr, "channel");
- seq_load->len= 1; // images only, if endframe isnt set!
+ seq_load->len= 1; // images only, if endframe isn't set!
- if(RNA_struct_find_property(op->ptr, "filepath")) {
+ if (RNA_struct_find_property(op->ptr, "filepath")) {
RNA_string_get(op->ptr, "filepath", seq_load->path); /* full path, file is set by the caller */
is_file= 1;
- } else if (RNA_struct_find_property(op->ptr, "directory")) {
+ }
+ else if (RNA_struct_find_property(op->ptr, "directory")) {
RNA_string_get(op->ptr, "directory", seq_load->path); /* full path, file is set by the caller */
is_file= 0;
}
- if((is_file != -1) && relative)
+ if ((is_file != -1) && relative)
BLI_path_rel(seq_load->path, G.main->name);
@@ -180,10 +181,10 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE;
- if(is_file==1) {
+ if (is_file==1) {
BLI_strncpy(seq_load->name, BLI_path_basename(seq_load->path), sizeof(seq_load->name));
}
- else if(RNA_struct_find_property(op->ptr, "files")) {
+ else if (RNA_struct_find_property(op->ptr, "files")) {
/* used for image strip */
/* best guess, first images name */
RNA_BEGIN(op->ptr, itemptr, "files") {
@@ -224,19 +225,16 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
seq->scene= sce_seq;
- seq->sfra= sce_seq->r.sfra;
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len = seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
+ seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
strip->us= 1;
- strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
-
BLI_strncpy(seq->name+2, sce_seq->id.name+2, sizeof(seq->name)-2);
seqbase_unique_name_recursive(&ed->seqbase, seq);
- seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + strip->len, 0);
+ seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + seq->len, 0);
calc_sequence_disp(scene, seq);
sort_seq(scene);
@@ -247,8 +245,8 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
seq->flag |= SELECT;
}
- if(RNA_boolean_get(op->ptr, "overlap") == FALSE) {
- if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+ if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
+ if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
@@ -259,12 +257,12 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!ED_operator_sequencer_active(C)) {
+ if (!ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
}
- if(!RNA_struct_property_is_set(op->ptr, "scene"))
+ if (!RNA_struct_property_is_set(op->ptr, "scene"))
return WM_enum_search_invoke(C, op, event);
sequencer_generic_invoke_xy__internal(C, op, event, 0);
@@ -279,25 +277,122 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Add Scene Strip";
- ot->idname= "SEQUENCER_OT_scene_strip_add";
- ot->description= "Add a strip to the sequencer using a blender scene as a source";
+ ot->name = "Add Scene Strip";
+ ot->idname = "SEQUENCER_OT_scene_strip_add";
+ ot->description = "Add a strip to the sequencer using a blender scene as a source";
/* api callbacks */
- ot->invoke= sequencer_add_scene_strip_invoke;
- ot->exec= sequencer_add_scene_strip_exec;
+ ot->invoke = sequencer_add_scene_strip_invoke;
+ ot->exec = sequencer_add_scene_strip_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
RNA_def_enum_funcs(prop, RNA_scene_itemf);
- ot->prop= prop;
+ ot->prop = prop;
}
+/* add movieclip operator */
+static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ Editing *ed= seq_give_editing(scene, TRUE);
+
+ MovieClip *clip;
+
+ Sequence *seq; /* generic strip vars */
+ Strip *strip;
+
+ int start_frame, channel; /* operator props */
+
+ start_frame= RNA_int_get(op->ptr, "frame_start");
+ channel= RNA_int_get(op->ptr, "channel");
+
+ clip= BLI_findlink(&CTX_data_main(C)->movieclip, RNA_enum_get(op->ptr, "clip"));
+
+ if (clip == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "MovieClip not found");
+ return OPERATOR_CANCELLED;
+ }
+
+ seq = alloc_sequence(ed->seqbasep, start_frame, channel);
+ seq->type= SEQ_MOVIECLIP;
+ seq->blend_mode= SEQ_CROSS;
+ seq->clip = clip;
+
+ /* basic defaults */
+ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
+ seq->len = BKE_movieclip_get_duration(clip);
+ strip->us= 1;
+
+ BLI_strncpy(seq->name+2, clip->id.name+2, sizeof(seq->name)-2);
+ seqbase_unique_name_recursive(&ed->seqbase, seq);
+
+ calc_sequence_disp(scene, seq);
+ sort_seq(scene);
+
+ if (RNA_boolean_get(op->ptr, "replace_sel")) {
+ deselect_all_seq(scene);
+ seq_active_set(scene, seq);
+ seq->flag |= SELECT;
+ }
+
+ if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
+ if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+ }
+
+ WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+
+ return OPERATOR_FINISHED;
+}
+
+
+static int sequencer_add_movieclip_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ if (!ED_operator_sequencer_active(C)) {
+ BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
+ return OPERATOR_CANCELLED;
+ }
+
+ if (!RNA_struct_property_is_set(op->ptr, "clip"))
+ return WM_enum_search_invoke(C, op, event);
+
+ sequencer_generic_invoke_xy__internal(C, op, event, 0);
+ return sequencer_add_movieclip_strip_exec(C, op);
+ // needs a menu
+ // return WM_menu_invoke(C, op, event);
+}
+
+
+void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name = "Add MovieClip Strip";
+ ot->idname = "SEQUENCER_OT_movieclip_strip_add";
+ ot->description = "Add a movieclip strip to the sequencer";
+
+ /* api callbacks */
+ ot->invoke = sequencer_add_movieclip_strip_invoke;
+ ot->exec = sequencer_add_movieclip_strip_exec;
+
+ ot->poll = ED_operator_scene_editable;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
+ prop= RNA_def_enum(ot->srna, "clip", DummyRNA_NULL_items, 0, "Clip", "");
+ RNA_def_enum_funcs(prop, RNA_movieclip_itemf);
+ ot->prop = prop;
+}
+
+
static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func)
{
Scene *scene= CTX_data_scene(C); /* only for sound */
@@ -314,7 +409,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
tot_files= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
- if(tot_files) {
+ if (tot_files) {
/* multiple files */
char dir_only[FILE_MAX];
char file_only[FILE_MAX];
@@ -327,8 +422,8 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
seq = seq_load_func(C, ed->seqbasep, &seq_load);
if (seq) {
- if(overlap == FALSE) {
- if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+ if (overlap == FALSE) {
+ if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
}
}
}
@@ -338,8 +433,8 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
/* single file */
seq = seq_load_func(C, ed->seqbasep, &seq_load);
if (seq) {
- if(overlap == FALSE) {
- if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+ if (overlap == FALSE) {
+ if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
}
}
}
@@ -367,13 +462,15 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!ED_operator_sequencer_active(C)) {
+ if (!ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
}
/* This is for drag and drop */
- if(RNA_collection_length(op->ptr, "files") || RNA_struct_property_is_set(op->ptr, "filepath")) {
+ if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) ||
+ RNA_struct_property_is_set(op->ptr, "filepath"))
+ {
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS);
return sequencer_add_movie_strip_exec(C, op);
}
@@ -391,18 +488,18 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Movie Strip";
- ot->idname= "SEQUENCER_OT_movie_strip_add";
- ot->description= "Add a movie strip to the sequencer";
+ ot->name = "Add Movie Strip";
+ ot->idname = "SEQUENCER_OT_movie_strip_add";
+ ot->description = "Add a movie strip to the sequencer";
/* api callbacks */
- ot->invoke= sequencer_add_movie_strip_invoke;
- ot->exec= sequencer_add_movie_strip_exec;
+ ot->invoke = sequencer_add_movie_strip_invoke;
+ ot->exec = sequencer_add_movie_strip_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
@@ -419,13 +516,15 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!ED_operator_sequencer_active(C)) {
+ if (!ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
}
/* This is for drag and drop */
- if(RNA_collection_length(op->ptr, "files") || RNA_struct_property_is_set(op->ptr, "filepath")) {
+ if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) ||
+ RNA_struct_property_is_set(op->ptr, "filepath"))
+ {
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS);
return sequencer_add_sound_strip_exec(C, op);
}
@@ -443,18 +542,18 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Sound Strip";
- ot->idname= "SEQUENCER_OT_sound_strip_add";
- ot->description= "Add a sound strip to the sequencer";
+ ot->name = "Add Sound Strip";
+ ot->idname = "SEQUENCER_OT_sound_strip_add";
+ ot->description = "Add a sound strip to the sequencer";
/* api callbacks */
- ot->invoke= sequencer_add_sound_strip_invoke;
- ot->exec= sequencer_add_sound_strip_exec;
+ ot->invoke = sequencer_add_sound_strip_invoke;
+ ot->exec = sequencer_add_sound_strip_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
@@ -479,10 +578,10 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
/* images are unique in how they handle this - 1 per strip elem */
seq_load.len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
- if(seq_load.len==0)
+ if (seq_load.len==0)
return OPERATOR_CANCELLED;
- if(seq_load.flag & SEQ_LOAD_REPLACE_SEL)
+ if (seq_load.flag & SEQ_LOAD_REPLACE_SEL)
deselect_all_seq(scene);
@@ -499,8 +598,8 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
}
RNA_END;
- if(seq_load.len == 1) {
- if(seq_load.start_frame < seq_load.end_frame) {
+ if (seq_load.len == 1) {
+ if (seq_load.start_frame < seq_load.end_frame) {
seq->endstill= seq_load.end_frame - seq_load.start_frame;
}
}
@@ -512,8 +611,8 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
/* last active name */
strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR-1);
- if(RNA_boolean_get(op->ptr, "overlap") == FALSE) {
- if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+ if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
+ if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
@@ -524,14 +623,14 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!ED_operator_sequencer_active(C)) {
+ if (!ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
}
/* drag drop has set the names */
- if(RNA_collection_length(op->ptr, "files")) {
+ if (RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) {
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME|SEQPROP_NOPATHS);
return sequencer_add_image_strip_exec(C, op);
}
@@ -547,18 +646,18 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Image Strip";
- ot->idname= "SEQUENCER_OT_image_strip_add";
- ot->description= "Add an image or image sequence to the sequencer";
+ ot->name = "Add Image Strip";
+ ot->idname = "SEQUENCER_OT_image_strip_add";
+ ot->description = "Add an image or image sequence to the sequencer";
/* api callbacks */
- ot->invoke= sequencer_add_image_strip_invoke;
- ot->exec= sequencer_add_image_strip_exec;
+ ot->invoke = sequencer_add_image_strip_invoke;
+ ot->exec = sequencer_add_image_strip_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
@@ -587,7 +686,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
type= RNA_enum_get(op->ptr, "type");
// XXX move to invoke
- if(!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) {
+ if (!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) {
BKE_report(op->reports, RPT_ERROR, error_msg);
return OPERATOR_CANCELLED;
}
@@ -624,10 +723,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len = seq->len;
strip->us= 1;
- if(seq->len>0)
- strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
if (seq->type==SEQ_PLUGIN) {
char path[FILE_MAX];
@@ -635,35 +731,37 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
sh.init_plugin(seq, path);
- if(seq->plugin==NULL) {
+ if (seq->plugin==NULL) {
BLI_remlink(ed->seqbasep, seq);
seq_free_sequence(scene, seq);
BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load", path);
return OPERATOR_CANCELLED;
}
- } else if (seq->type == SEQ_COLOR) {
+ }
+ else if (seq->type == SEQ_COLOR) {
SolidColorVars *colvars= (SolidColorVars *)seq->effectdata;
RNA_float_get_array(op->ptr, "color", colvars->col);
seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
- } else if (seq->type == SEQ_ADJUSTMENT) {
+ }
+ else if (seq->type == SEQ_ADJUSTMENT) {
seq->blend_mode= SEQ_CROSS;
}
/* an unset channel is a special case where we automatically go above
* the other strips. */
- if(!RNA_struct_property_is_set(op->ptr, "channel")) {
- if(seq->seq1) {
+ if (!RNA_struct_property_is_set(op->ptr, "channel")) {
+ if (seq->seq1) {
int chan= MAX3( seq->seq1 ? seq->seq1->machine : 0,
seq->seq2 ? seq->seq2->machine : 0,
seq->seq3 ? seq->seq3->machine : 0);
- if(chan < MAXSEQ)
+ if (chan < MAXSEQ)
seq->machine= chan;
}
}
- if(RNA_boolean_get(op->ptr, "overlap") == FALSE) {
- if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+ if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
+ if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
}
update_changed_seq_and_deps(scene, seq, 1, 1); /* runs calc_sequence */
@@ -692,19 +790,19 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven
int type= -1;
int prop_flag= SEQPROP_ENDFRAME;
- if(!ED_operator_sequencer_active(C)) {
+ if (!ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
}
- if(is_type_set) {
+ if (is_type_set) {
type= RNA_enum_get(op->ptr, "type");
/* when invoking an effect strip which uses inputs,
* skip initializing the channel from the mouse.
* Instead leave the property unset so exec() initializes it to be
* above the strips its applied to. */
- if(get_sequence_effect_num_inputs(type) != 0) {
+ if (get_sequence_effect_num_inputs(type) != 0) {
prop_flag |= SEQPROP_NOCHAN;
}
}
@@ -724,18 +822,18 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven
void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Effect Strip";
- ot->idname= "SEQUENCER_OT_effect_strip_add";
- ot->description= "Add an effect to the sequencer, most are applied on top of existing strips";
+ ot->name = "Add Effect Strip";
+ ot->idname = "SEQUENCER_OT_effect_strip_add";
+ ot->description = "Add an effect to the sequencer, most are applied on top of existing strips";
/* api callbacks */
- ot->invoke= sequencer_add_effect_strip_invoke;
- ot->exec= sequencer_add_effect_strip_exec;
+ ot->invoke = sequencer_add_effect_strip_invoke;
+ ot->exec = sequencer_add_effect_strip_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index 9aefdea9fb0..ee1a0a7ef6d 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -99,7 +99,7 @@ static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= sequencer_has_buttons_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -107,14 +107,14 @@ static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_properties(wmOperatorType *ot)
{
- ot->name= "Properties";
- ot->idname= "SEQUENCER_OT_properties";
- ot->description= "Open sequencer properties panel";
+ ot->name = "Properties";
+ ot->idname = "SEQUENCER_OT_properties";
+ ot->description = "Open sequencer properties panel";
- ot->exec= sequencer_properties;
- ot->poll= ED_operator_sequencer_active;
+ ot->exec = sequencer_properties;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 1bbf4b670b5..d29af06bbcd 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -72,7 +72,7 @@
#define SEQ_RIGHTHANDLE 2
-/* Note, Dont use SEQ_BEGIN/SEQ_END while drawing!
+/* Note, Don't use SEQ_BEGIN/SEQ_END while drawing!
* it messes up transform, - Campbell */
static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2);
@@ -93,11 +93,15 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[
case SEQ_MOVIE:
UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col);
break;
+
+ case SEQ_MOVIECLIP:
+ UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, col);
+ break;
case SEQ_SCENE:
UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
- if(seq->scene==curscene) {
+ if (seq->scene==curscene) {
UI_GetColorPtrShade3ubv(col, col, 20);
}
break;
@@ -144,7 +148,8 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[
case SEQ_COLOR:
if (colvars->col) {
rgb_float_to_uchar(col, colvars->col);
- } else {
+ }
+ else {
col[0] = col[1] = col[2] = 128;
}
break;
@@ -156,7 +161,7 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[
case SEQ_SOUND:
UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col);
blendcol[0] = blendcol[1] = blendcol[2] = 128;
- if(seq->flag & SEQ_MUTE) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20);
+ if (seq->flag & SEQ_MUTE) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20);
break;
default:
@@ -171,7 +176,7 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
* x2 the end x value, same for y1 and y2
* stepsize is width of a pixel.
*/
- if(seq->flag & SEQ_AUDIO_DRAW_WAVEFORM) {
+ if (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM) {
int i, j, pos;
int length = floor((x2-x1)/stepsize)+1;
float ymid = (y1+y2)/2;
@@ -182,34 +187,34 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
SoundWaveform* waveform;
- if(!seq->sound->waveform)
+ if (!seq->sound->waveform)
sound_read_waveform(seq->sound);
- if(!seq->sound->waveform)
+ if (!seq->sound->waveform)
return; /* zero length sound */
waveform = seq->sound->waveform;
- if(!waveform)
+ if (!waveform)
return;
startsample = floor((seq->startofs + seq->anim_startofs)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
samplestep = (endsample-startsample) * stepsize / (x2-x1);
- if(length > floor((waveform->length - startsample) / samplestep))
+ if (length > floor((waveform->length - startsample) / samplestep))
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])
+ if (value > waveform->data[j * 3])
value = waveform->data[j * 3];
}
@@ -218,15 +223,15 @@ 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])
+ if (value < waveform->data[j * 3 + 1])
value = waveform->data[j * 3 + 1];
}
@@ -238,7 +243,7 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
static void drawmeta_stipple(int value)
{
- if(value) {
+ if (value) {
glEnable(GL_POLYGON_STIPPLE);
glPolygonStipple(stipple_halftone);
@@ -269,7 +274,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- if(seqm->flag & SEQ_MUTE)
+ if (seqm->flag & SEQ_MUTE)
drawmeta_stipple(1);
for (seq= seqm->seqbase.first; seq; seq= seq->next) {
@@ -283,13 +288,13 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
col[3]= 196; /* alpha, used for all meta children */
for (seq= seqm->seqbase.first; seq; seq= seq->next) {
- if((seq->startdisp > x2 || seq->enddisp < x1) == 0) {
+ if ((seq->startdisp > x2 || seq->enddisp < x1) == 0) {
float y_chan= (seq->machine - chan_min) / (float)(chan_range) * draw_range;
float x1_chan= seq->startdisp;
float x2_chan= seq->enddisp;
float y1_chan, y2_chan;
- if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
+ if ((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
drawmeta_stipple(1);
get_seq_color3ubv(scene, seq, col);
@@ -297,8 +302,8 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
glColor4ubv(col);
/* clamp within parent sequence strip bounds */
- if(x1_chan < x1) x1_chan= x1;
- if(x2_chan > x2) x2_chan= x2;
+ if (x1_chan < x1) x1_chan= x1;
+ if (x2_chan > x2) x2_chan= x2;
y1_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM);
y2_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSTOP);
@@ -309,7 +314,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
glColor4ubv(col);
fdrawbox(x1_chan, y1_chan, x2_chan, y2_chan);
- if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
+ if ((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
drawmeta_stipple(0);
}
}
@@ -352,7 +357,8 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire
v3[0]= v2[0] + handsize/4; v3[1]= (y1+y2)/2.0f;
whichsel = SEQ_LEFTSEL;
- } else if (direction == SEQ_RIGHTHANDLE) {
+ }
+ else if (direction == SEQ_RIGHTHANDLE) {
rx1 = x2-handsize*0.75f;
rx2 = x2;
@@ -364,19 +370,19 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire
}
/* draw! */
- if(seq->type < SEQ_EFFECT ||
+ if (seq->type < SEQ_EFFECT ||
get_sequence_effect_num_inputs(seq->type) == 0) {
glEnable( GL_BLEND );
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- if(seq->flag & whichsel) glColor4ub(0, 0, 0, 80);
+ if (seq->flag & whichsel) glColor4ub(0, 0, 0, 80);
else if (seq->flag & SELECT) glColor4ub(255, 255, 255, 30);
else glColor4ub(0, 0, 0, 22);
glRectf(rx1, y1, rx2, y2);
- if(seq->flag & whichsel) glColor4ub(255, 255, 255, 200);
+ if (seq->flag & whichsel) glColor4ub(255, 255, 255, 200);
else glColor4ub(0, 0, 0, 50);
glEnable( GL_POLYGON_SMOOTH );
@@ -388,13 +394,14 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire
glDisable( GL_BLEND );
}
- if(G.moving || (seq->flag & whichsel)) {
+ if (G.moving || (seq->flag & whichsel)) {
const char col[4]= {255, 255, 255, 255};
if (direction == SEQ_LEFTHANDLE) {
BLI_snprintf(numstr, sizeof(numstr),"%d", seq->startdisp);
x1= rx1;
y1 -= 0.45f;
- } else {
+ }
+ else {
BLI_snprintf(numstr, sizeof(numstr), "%d", seq->enddisp - 1);
x1= x2 - handsize*0.75f;
y1= y2 + 0.05f;
@@ -409,7 +416,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
unsigned char col[3], blendcol[3];
View2D *v2d= &ar->v2d;
- if(seq->type >= SEQ_EFFECT) return;
+ if (seq->type >= SEQ_EFFECT) return;
x1= seq->startdisp;
x2= seq->enddisp;
@@ -419,11 +426,11 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
pixely = (v2d->cur.ymax - v2d->cur.ymin)/(v2d->mask.ymax - v2d->mask.ymin);
- if(pixely <= 0) return; /* can happen when the view is split/resized */
+ if (pixely <= 0) return; /* can happen when the view is split/resized */
blendcol[0] = blendcol[1] = blendcol[2] = 120;
- if(seq->startofs) {
+ if (seq->startofs) {
glEnable( GL_BLEND );
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -432,7 +439,8 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
if (seq->flag & SELECT) {
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
glColor4ub(col[0], col[1], col[2], 170);
- } else {
+ }
+ else {
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
glColor4ub(col[0], col[1], col[2], 110);
}
@@ -446,7 +454,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
glDisable( GL_BLEND );
}
- if(seq->endofs) {
+ if (seq->endofs) {
glEnable( GL_BLEND );
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -455,7 +463,8 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
if (seq->flag & SELECT) {
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
glColor4ub(col[0], col[1], col[2], 170);
- } else {
+ }
+ else {
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
glColor4ub(col[0], col[1], col[2], 110);
}
@@ -469,7 +478,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
glDisable( GL_BLEND );
}
- if(seq->startstill) {
+ if (seq->startstill) {
get_seq_color3ubv(scene, seq, col);
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
glColor3ubv((GLubyte *)col);
@@ -483,11 +492,11 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
glColor3ubv((GLubyte *)col);
- for(a=y1; a< y2; a+= pixely * 2.0f) {
+ for (a=y1; a< y2; a+= pixely * 2.0f) {
fdrawline(x1, a, (float)(seq->start), a);
}
}
- if(seq->endstill) {
+ if (seq->endstill) {
get_seq_color3ubv(scene, seq, col);
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
glColor3ubv((GLubyte *)col);
@@ -501,7 +510,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
glColor3ubv((GLubyte *)col);
- for(a=y1; a< y2; a+= pixely * 2.0f) {
+ for (a=y1; a< y2; a+= pixely * 2.0f) {
fdrawline((float)(seq->start+seq->len), a, x2, a);
}
}
@@ -516,17 +525,18 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
char col[4];
/* note, all strings should include 'name' */
- if(name[0]=='\0')
+ if (name[0]=='\0')
name= give_seqname(seq);
- if(seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) {
+ if (seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) {
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
}
- else if(seq->type == SEQ_SCENE) {
- if(seq->scene) {
- if(seq->scene_camera) {
+ else if (seq->type == SEQ_SCENE) {
+ if (seq->scene) {
+ if (seq->scene_camera) {
BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)", seq->len, name, seq->scene->id.name+2, ((ID *)seq->scene_camera)->name+2);
- } else {
+ }
+ else {
BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->scene->id.name+2);
}
}
@@ -534,17 +544,25 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
}
}
- else if(seq->type == SEQ_MULTICAM) {
+ else if (seq->type == SEQ_MOVIECLIP) {
+ if (seq->clip && strcmp(name, seq->clip->id.name+2) != 0) {
+ BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->clip->id.name+2);
+ }
+ else {
+ BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
+ }
+ }
+ else if (seq->type == SEQ_MULTICAM) {
BLI_snprintf(str, sizeof(str), "Cam | %s: %d", name, seq->multicam_source);
}
- else if(seq->type == SEQ_IMAGE) {
+ else if (seq->type == SEQ_IMAGE) {
BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
}
- else if(seq->type & SEQ_EFFECT) {
+ else if (seq->type & SEQ_EFFECT) {
int can_float = (seq->type != SEQ_PLUGIN)
|| (seq->plugin && seq->plugin->version >= 4);
- if(seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3)
+ if (seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3)
BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d (use %d)%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine, can_float ? "" : " No float, upgrade plugin!");
else if (seq->seq1 && seq->seq2)
BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, can_float ? "" : " No float, upgrade plugin!");
@@ -552,7 +570,7 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
}
else if (seq->type == SEQ_SOUND) {
- if(seq->sound)
+ if (seq->sound)
BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->sound->name);
else
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
@@ -561,19 +579,21 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
}
- if(seq->flag & SELECT){
+ if (seq->flag & SELECT) {
col[0]= col[1]= col[2]= 255;
- }else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50){
+ }
+ else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50) {
col[0]= col[1]= col[2]= 80; /* use lighter text color for dark background */
- }else{
+ }
+ else {
col[0]= col[1]= col[2]= 0;
}
col[3]= 255;
- rect.xmin= x1;
- rect.ymin= y1;
- rect.xmax= x2;
- rect.ymax= y2;
+ rect.xmin = x1;
+ rect.ymin = y1;
+ rect.xmax = x2;
+ rect.ymax = y2;
UI_view2d_text_cache_rectf(v2d, &rect, str, col);
}
@@ -593,8 +613,8 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
glShadeModel(GL_SMOOTH);
glBegin(GL_QUADS);
- if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
- else if(seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -50);
+ if (seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
+ else if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -50);
/* else UI_GetColorPtrShade3ubv(col, col, 0); */ /* DO NOTHING */
glColor3ubv(col);
@@ -602,8 +622,8 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
glVertex2f(x1,y1);
glVertex2f(x2,y1);
- if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
- else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5);
+ if (seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
+ else if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5);
else UI_GetColorPtrShade3ubv(col, col, -5);
glColor3ubv((GLubyte *)col);
@@ -620,7 +640,7 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
glVertex2f(x1,ymid2);
glVertex2f(x2,ymid2);
- if(seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -15);
+ if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -15);
else UI_GetColorPtrShade3ubv(col, col, 25);
glColor3ubv((GLubyte *)col);
@@ -650,10 +670,10 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
is_single_image = (char)seq_single_check(seq);
/* body */
- if(seq->startstill) x1= seq->start;
+ if (seq->startstill) x1= seq->start;
else x1= seq->startdisp;
y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
- if(seq->endstill) x2= seq->start+seq->len;
+ if (seq->endstill) x2= seq->start+seq->len;
else x2= seq->enddisp;
y2= seq->machine+SEQ_STRIP_OFSTOP;
@@ -680,10 +700,10 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
x2= seq->enddisp;
/* draw sound wave */
- if(seq->type == SEQ_SOUND) drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin)/ar->winx);
+ if (seq->type == SEQ_SOUND) drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin)/ar->winx);
/* draw lock */
- if(seq->flag & SEQ_LOCK) {
+ if (seq->flag & SEQ_LOCK) {
glEnable(GL_POLYGON_STIPPLE);
glEnable(GL_BLEND);
@@ -703,7 +723,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
get_seq_color3ubv(scene, seq, col);
if (G.moving && (seq->flag & SELECT)) {
- if(seq->flag & SEQ_OVERLAP) {
+ if (seq->flag & SEQ_OVERLAP) {
col[0]= 255; col[1]= col[2]= 40;
}
else
@@ -725,20 +745,20 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
glDisable(GL_LINE_STIPPLE);
}
- if(seq->type==SEQ_META) drawmeta_contents(scene, seq, x1, y1, x2, y2);
+ if (seq->type==SEQ_META) drawmeta_contents(scene, seq, x1, y1, x2, y2);
/* calculate if seq is long enough to print a name */
x1= seq->startdisp+seq->handsize;
x2= seq->enddisp-seq->handsize;
/* info text on the strip */
- if(x1<v2d->cur.xmin) x1= v2d->cur.xmin;
- else if(x1>v2d->cur.xmax) x1= v2d->cur.xmax;
- if(x2<v2d->cur.xmin) x2= v2d->cur.xmin;
- else if(x2>v2d->cur.xmax) x2= v2d->cur.xmax;
+ if (x1<v2d->cur.xmin) x1= v2d->cur.xmin;
+ else if (x1>v2d->cur.xmax) x1= v2d->cur.xmax;
+ if (x2<v2d->cur.xmin) x2= v2d->cur.xmin;
+ else if (x2>v2d->cur.xmax) x2= v2d->cur.xmax;
/* nice text here would require changing the view matrix for texture text */
- if( (x2-x1) / pixelx > 32) {
+ if ( (x2-x1) / pixelx > 32) {
draw_seq_text(v2d, seq, x1, x2, y1, y2, background_col);
}
}
@@ -750,7 +770,7 @@ static void UNUSED_FUNCTION(set_special_seq_update)(int val)
// int x;
/* if mouse over a sequence && LEFTMOUSE */
- if(val) {
+ if (val) {
// XXX special_seq_update= find_nearest_seq(&x);
}
else special_seq_update= NULL;
@@ -766,6 +786,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
float viewrectx, viewrecty;
float render_size = 0.0;
float proxy_size = 100.0;
+ float col[3];
GLuint texid;
GLuint last_texid;
SeqRenderData context;
@@ -773,7 +794,8 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
render_size = sseq->render_size;
if (render_size == 0) {
render_size = scene->r.size;
- } else {
+ }
+ else {
proxy_size = render_size;
}
if (render_size < 0) {
@@ -792,9 +814,9 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
viewrecty /= proxy_size / 100.0f;
}
- if(frame_ofs == 0) {
- /* XXX TODO: take color from theme */
- glClearColor(0.0, 0.0, 0.0, 0.0);
+ if (frame_ofs == 0) {
+ UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
+ glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
}
@@ -805,7 +827,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
UI_view2d_curRect_validate(v2d);
/* only initialize the preview if a render is in progress */
- if(G.rendering)
+ if (G.rendering)
return;
context = seq_new_render_data(bmain, scene, rectx, recty, proxy_size);
@@ -817,10 +839,10 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
else
ibuf= (ImBuf *)give_ibuf_seq_threaded(context, cfra + frame_ofs, sseq->chanshown);
- if(ibuf==NULL)
+ if (ibuf==NULL)
return;
- if(ibuf->rect==NULL && ibuf->rect_float == NULL)
+ if (ibuf->rect==NULL && ibuf->rect_float == NULL)
return;
switch(sseq->mainb) {
@@ -832,7 +854,8 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
case SEQ_DRAW_IMG_WAVEFORM:
if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
scope = make_sep_waveform_view_from_ibuf(ibuf);
- } else {
+ }
+ else {
scope = make_waveform_view_from_ibuf(ibuf);
}
break;
@@ -849,7 +872,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
ibuf = scope;
}
- if(ibuf->rect_float && ibuf->rect==NULL) {
+ if (ibuf->rect_float && ibuf->rect==NULL) {
IMB_rect_from_float(ibuf);
}
@@ -868,12 +891,12 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
glBegin(GL_QUADS);
- if(frame_ofs) {
+ if (frame_ofs) {
rctf tot_clip;
- tot_clip.xmin= v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmin);
- tot_clip.ymin= v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymin);
- tot_clip.xmax= v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax);
- tot_clip.ymax= v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax);
+ tot_clip.xmin = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmin);
+ tot_clip.ymin = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymin);
+ tot_clip.xmax = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax);
+ tot_clip.ymax = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax);
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin);glVertex2f(tot_clip.xmin, tot_clip.ymin);
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax);glVertex2f(tot_clip.xmin, tot_clip.ymax);
@@ -891,7 +914,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
glDisable(GL_TEXTURE_2D);
glDeleteTextures(1, &texid);
- if(sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
+ if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
float x1 = v2d->tot.xmin;
float y1 = v2d->tot.ymin;
@@ -956,7 +979,8 @@ void drawprefetchseqspace(Scene *scene, ARegion *UNUSED(ar), SpaceSeq *sseq)
int proxy_size = 100.0;
if (render_size == 0) {
render_size = scene->r.size;
- } else {
+ }
+ else {
proxy_size = render_size;
}
if (render_size < 0) {
@@ -966,7 +990,7 @@ void drawprefetchseqspace(Scene *scene, ARegion *UNUSED(ar), SpaceSeq *sseq)
rectx= (render_size*scene->r.xsch)/100;
recty= (render_size*scene->r.ysch)/100;
- if(sseq->mainb != SEQ_DRAW_SEQUENCE) {
+ if (sseq->mainb != SEQ_DRAW_SEQUENCE) {
give_ibuf_prefetch_request(
rectx, recty, (scene->r.cfra), sseq->chanshown,
proxy_size);
@@ -1138,7 +1162,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
ANIM_draw_previewrange(C, v2d);
/* overlap playhead */
- if(scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) {
+ if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) {
int cfra_over= (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs;
glColor3f(0.2, 0.2, 0.2);
// glRectf(cfra_over, v2d->cur.ymin, scene->ed->over_ofs + scene->r.cfra + 1, v2d->cur.ymax);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 2815297eb13..bcc2c358529 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -55,6 +55,7 @@
#include "BKE_sequencer.h"
#include "BKE_report.h"
#include "BKE_sound.h"
+#include "BKE_movieclip.h"
#include "IMB_imbuf.h"
@@ -75,9 +76,6 @@
/* own include */
#include "sequencer_intern.h"
-static int okee(const char *UNUSED(dummy)) {return 0;}
-
-
/* XXX */
/* RNA Enums, used in multiple files */
EnumPropertyItem sequencer_prop_effect_types[] = {
@@ -225,12 +223,12 @@ static void seq_proxy_build_job(const bContext *C)
void seq_rectf(Sequence *seq, rctf *rectf)
{
- if(seq->startstill) rectf->xmin= seq->start;
- else rectf->xmin= seq->startdisp;
- rectf->ymin= seq->machine+SEQ_STRIP_OFSBOTTOM;
- if(seq->endstill) rectf->xmax= seq->start+seq->len;
- else rectf->xmax= seq->enddisp;
- rectf->ymax= seq->machine+SEQ_STRIP_OFSTOP;
+ if (seq->startstill) rectf->xmin = seq->start;
+ else rectf->xmin = seq->startdisp;
+ rectf->ymin = seq->machine+SEQ_STRIP_OFSBOTTOM;
+ if (seq->endstill) rectf->xmax = seq->start+seq->len;
+ else rectf->xmax = seq->enddisp;
+ rectf->ymax = seq->machine+SEQ_STRIP_OFSTOP;
}
static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* called from fileselect */
@@ -239,7 +237,7 @@ static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* calle
struct SeqEffectHandle sh;
Sequence *last_seq= seq_active_get(scene);
- if(last_seq==NULL || last_seq->type != SEQ_PLUGIN) return;
+ if (last_seq==NULL || last_seq->type != SEQ_PLUGIN) return;
sh = get_sequence_effect(last_seq);
sh.free(last_seq);
@@ -249,7 +247,7 @@ static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* calle
last_seq->seq2->machine,
last_seq->seq3->machine);
- if( seq_test_overlap(ed->seqbasep, last_seq) ) shuffle_seq(ed->seqbasep, last_seq, scene);
+ if ( seq_test_overlap(ed->seqbasep, last_seq) ) shuffle_seq(ed->seqbasep, last_seq, scene);
}
@@ -261,7 +259,7 @@ void boundbox_seq(Scene *scene, rctf *rect)
float min[2], max[2];
- if(ed==NULL) return;
+ if (ed==NULL) return;
min[0]= 0.0;
max[0]= EFRA+1;
@@ -269,19 +267,19 @@ void boundbox_seq(Scene *scene, rctf *rect)
max[1]= 8.0;
seq= ed->seqbasep->first;
- while(seq) {
+ while (seq) {
- if( min[0] > seq->startdisp-1) min[0]= seq->startdisp-1;
- if( max[0] < seq->enddisp+1) max[0]= seq->enddisp+1;
- if( max[1] < seq->machine+2) max[1]= seq->machine+2;
+ if ( min[0] > seq->startdisp-1) min[0]= seq->startdisp-1;
+ if ( max[0] < seq->enddisp+1) max[0]= seq->enddisp+1;
+ if ( max[1] < seq->machine+2) max[1]= seq->machine+2;
seq= seq->next;
}
- rect->xmin= min[0];
- rect->xmax= max[0];
- rect->ymin= min[1];
- rect->ymax= max[1];
+ rect->xmin = min[0];
+ rect->xmax = max[0];
+ rect->ymin = min[1];
+ rect->ymax = max[1];
}
@@ -306,12 +304,12 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se
Sequence *seq;
Editing *ed= seq_give_editing(scene, FALSE);
- if(ed==NULL) return NULL;
+ if (ed==NULL) return NULL;
if (sel>0) sel = SELECT;
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
- if( (seq!=test) &&
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if ( (seq!=test) &&
(test->machine==seq->machine) &&
((sel == -1) || (sel && (seq->flag & SELECT)) || (sel==0 && (seq->flag & SELECT)==0) ))
{
@@ -342,11 +340,11 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
best_dist = MAXFRAME*2;
- if(ed==NULL) return NULL;
+ if (ed==NULL) return NULL;
seq= ed->seqbasep->first;
- while(seq) {
- if( (seq!=test) &&
+ while (seq) {
+ if ( (seq!=test) &&
(test->machine==seq->machine) &&
(test->depth==seq->depth) &&
((sel == -1) || (sel==(seq->flag & SELECT))))
@@ -369,7 +367,8 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
if (dist==0) {
best_seq = seq;
break;
- } else if (dist < best_dist) {
+ }
+ else if (dist < best_dist) {
best_dist = dist;
best_seq = seq;
}
@@ -391,7 +390,7 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[
*hand= SEQ_SIDE_NONE;
- if(ed==NULL) return NULL;
+ if (ed==NULL) return NULL;
pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
@@ -399,32 +398,33 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[
seq= ed->seqbasep->first;
- while(seq) {
- if(seq->machine == (int)y) {
+ while (seq) {
+ if (seq->machine == (int)y) {
/* check for both normal strips, and strips that have been flipped horizontally */
- if( ((seq->startdisp < seq->enddisp) && (seq->startdisp<=x && seq->enddisp>=x)) ||
+ if ( ((seq->startdisp < seq->enddisp) && (seq->startdisp<=x && seq->enddisp>=x)) ||
((seq->startdisp > seq->enddisp) && (seq->startdisp>=x && seq->enddisp<=x)) )
{
- if(seq_tx_test(seq)) {
+ if (seq_tx_test(seq)) {
/* clamp handles to defined size in pixel space */
handsize = seq->handsize;
displen = (float)abs(seq->startdisp - seq->enddisp);
- if (displen / pixelx > 16) { /* dont even try to grab the handles of small strips */
+ if (displen / pixelx > 16) { /* don't even try to grab the handles of small strips */
/* Set the max value to handle to 1/3 of the total len when its less then 28.
* This is important because otherwise selecting handles happens even when you click in the middle */
if ((displen/3) < 30*pixelx) {
handsize = displen/3;
- } else {
+ }
+ else {
CLAMP(handsize, 7*pixelx, 30*pixelx);
}
- if( handsize+seq->startdisp >=x )
+ if ( handsize+seq->startdisp >=x )
*hand= SEQ_SIDE_LEFT;
- else if( -handsize+seq->enddisp <=x )
+ else if ( -handsize+seq->enddisp <=x )
*hand= SEQ_SIDE_RIGHT;
}
}
@@ -445,11 +445,11 @@ static int seq_is_parent(Sequence *par, Sequence *seq)
static int seq_is_predecessor(Sequence *pred, Sequence *seq)
{
if (!pred) return 0;
- if(pred == seq) return 0;
- else if(seq_is_parent(pred, seq)) return 1;
- else if(pred->seq1 && seq_is_predecessor(pred->seq1, seq)) return 1;
- else if(pred->seq2 && seq_is_predecessor(pred->seq2, seq)) return 1;
- else if(pred->seq3 && seq_is_predecessor(pred->seq3, seq)) return 1;
+ if (pred == seq) return 0;
+ else if (seq_is_parent(pred, seq)) return 1;
+ else if (pred->seq1 && seq_is_predecessor(pred->seq1, seq)) return 1;
+ else if (pred->seq2 && seq_is_predecessor(pred->seq2, seq)) return 1;
+ else if (pred->seq3 && seq_is_predecessor(pred->seq3, seq)) return 1;
return 0;
}
@@ -460,7 +460,7 @@ void deselect_all_seq(Scene *scene)
Editing *ed= seq_give_editing(scene, FALSE);
- if(ed==NULL) return;
+ if (ed==NULL) return;
SEQP_BEGIN(ed, seq) {
seq->flag &= ~SEQ_ALLSEL;
@@ -474,13 +474,13 @@ void recurs_sel_seq(Sequence *seqm)
Sequence *seq;
seq= seqm->seqbase.first;
- while(seq) {
+ while (seq) {
- if(seqm->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL)) seq->flag &= ~SEQ_ALLSEL;
- else if(seqm->flag & SELECT) seq->flag |= SELECT;
+ if (seqm->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL)) seq->flag &= ~SEQ_ALLSEL;
+ else if (seqm->flag & SELECT) seq->flag |= SELECT;
else seq->flag &= ~SEQ_ALLSEL;
- if(seq->seqbase.first) recurs_sel_seq(seq);
+ if (seq->seqbase.first) recurs_sel_seq(seq);
seq= seq->next;
}
@@ -496,16 +496,16 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
if (!activeseq)
seq2= seq_active_get(scene);
- for(seq=ed->seqbasep->first; seq; seq=seq->next) {
- if(seq->flag & SELECT) {
+ for (seq=ed->seqbasep->first; seq; seq=seq->next) {
+ if (seq->flag & SELECT) {
if (seq->type == SEQ_SOUND && get_sequence_effect_num_inputs(type) != 0) {
*error_str= "Can't apply effects to audio sequence strips";
return 0;
}
- if((seq != activeseq) && (seq != seq2)) {
- if(seq2 == NULL) seq2= seq;
- else if(seq1 == NULL) seq1= seq;
- else if(seq3 == NULL) seq3= seq;
+ if ((seq != activeseq) && (seq != seq2)) {
+ if (seq2 == NULL) seq2= seq;
+ else if (seq1 == NULL) seq1= seq;
+ else if (seq3 == NULL) seq3= seq;
else {
*error_str= "Can't apply effect to more than 3 sequence strips";
return 0;
@@ -528,18 +528,18 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
*selseq1 = *selseq2 = *selseq3 = NULL;
return 1; /* succsess */
case 1:
- if(seq2==NULL) {
+ if (seq2==NULL) {
*error_str= "Need at least one selected sequence strip";
return 0;
}
- if(seq1==NULL) seq1= seq2;
- if(seq3==NULL) seq3= seq2;
+ if (seq1==NULL) seq1= seq2;
+ if (seq3==NULL) seq3= seq2;
case 2:
- if(seq1==NULL || seq2==NULL) {
+ if (seq1==NULL || seq2==NULL) {
*error_str= "Need 2 selected sequence strips";
return 0;
}
- if(seq3 == NULL) seq3= seq2;
+ if (seq3 == NULL) seq3= seq2;
}
if (seq1==NULL && seq2==NULL && seq3==NULL) {
@@ -561,18 +561,18 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq)
/* try to find a replacement input sequence, and flag for later deletion if
* no replacement can be found */
- if(!seq)
+ if (!seq)
return NULL;
- else if(!(seq->type & SEQ_EFFECT))
+ else if (!(seq->type & SEQ_EFFECT))
return ((seq->flag & SELECT)? NULL: seq);
- else if(!(seq->flag & SELECT)) {
+ else if (!(seq->flag & SELECT)) {
/* try to find replacement for effect inputs */
seq1= del_seq_find_replace_recurs(scene, seq->seq1);
seq2= del_seq_find_replace_recurs(scene, seq->seq2);
seq3= del_seq_find_replace_recurs(scene, seq->seq3);
- if(seq1==seq->seq1 && seq2==seq->seq2 && seq3==seq->seq3);
- else if(seq1 || seq2 || seq3) {
+ if (seq1==seq->seq1 && seq2==seq->seq2 && seq3==seq->seq3);
+ else if (seq1 || seq2 || seq3) {
seq->seq1= (seq1)? seq1: (seq2)? seq2: seq3;
seq->seq2= (seq2)? seq2: (seq1)? seq1: seq3;
seq->seq3= (seq3)? seq3: (seq1)? seq1: seq2;
@@ -584,9 +584,9 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq)
}
if (seq->flag & SELECT) {
- if((seq1 = del_seq_find_replace_recurs(scene, seq->seq1))) return seq1;
- if((seq2 = del_seq_find_replace_recurs(scene, seq->seq2))) return seq2;
- if((seq3 = del_seq_find_replace_recurs(scene, seq->seq3))) return seq3;
+ if ((seq1 = del_seq_find_replace_recurs(scene, seq->seq1))) return seq1;
+ if ((seq2 = del_seq_find_replace_recurs(scene, seq->seq2))) return seq2;
+ if ((seq3 = del_seq_find_replace_recurs(scene, seq->seq3))) return seq3;
else return NULL;
}
else
@@ -599,12 +599,12 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de
Sequence *last_seq = seq_active_get(scene);
seq= lb->first;
- while(seq) {
+ while (seq) {
seqn= seq->next;
- if((seq->flag & flag) || deleteall) {
+ if ((seq->flag & flag) || deleteall) {
BLI_remlink(lb, seq);
- if(seq==last_seq) seq_active_set(scene, NULL);
- if(seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1);
+ if (seq==last_seq) seq_active_set(scene, NULL);
+ if (seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1);
seq_free_sequence(scene, seq);
}
seq= seqn;
@@ -639,7 +639,8 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
if (seq->type == SEQ_META) {
skip_dup = TRUE;
seq->startstill = seq->start - cutframe;
- } else {
+ }
+ else {
seq->start= cutframe -1;
seq->startstill= cutframe -seq->startdisp -1;
seq->anim_endofs += seq->len - 1;
@@ -663,7 +664,6 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
reload_sequence_new_file(scene, seq, FALSE);
calc_sequence(scene, seq);
- new_tstripdata(seq);
if (!skip_dup) {
/* Duplicate AFTER the first change */
@@ -704,7 +704,6 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
reload_sequence_new_file(scene, seqn, FALSE);
calc_sequence(scene, seqn);
- new_tstripdata(seqn);
}
return seqn;
}
@@ -736,7 +735,8 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
if (seq->type == SEQ_META) {
skip_dup = TRUE;
seq->startstill = seq->start - cutframe;
- } else {
+ }
+ else {
seq->start= cutframe -1;
seq->startstill= cutframe -seq->startdisp -1;
seq->endofs = seq->len - 1;
@@ -757,7 +757,6 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
}
calc_sequence(scene, seq);
- new_tstripdata(seq);
if (!skip_dup) {
/* Duplicate AFTER the first change */
@@ -793,7 +792,6 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
}
calc_sequence(scene, seqn);
- new_tstripdata(seqn);
}
return seqn;
}
@@ -809,21 +807,23 @@ static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe
seq= old->first;
- while(seq) {
+ while (seq) {
seq_next_iter = seq->next; /* we need this because we may remove seq */
seq->tmp= NULL;
- if(seq->flag & SELECT) {
- if(cutframe > seq->startdisp &&
+ if (seq->flag & SELECT) {
+ if (cutframe > seq->startdisp &&
cutframe < seq->enddisp) {
Sequence * seqn = cut_seq(scene, seq, cutframe);
if (seqn) {
BLI_addtail(new, seqn);
}
did_something = TRUE;
- } else if (seq->enddisp <= cutframe) {
+ }
+ else if (seq->enddisp <= cutframe) {
/* do nothing */
- } else if (seq->startdisp >= cutframe) {
+ }
+ else if (seq->startdisp >= cutframe) {
/* move into new list */
BLI_remlink(old, seq);
BLI_addtail(new, seq);
@@ -842,10 +842,10 @@ static int insert_gap(Scene *scene, int gap, int cfra)
/* all strips >= cfra are shifted */
- if(ed==NULL) return 0;
+ if (ed==NULL) return 0;
SEQP_BEGIN(ed, seq) {
- if(seq->startdisp >= cfra) {
+ if (seq->startdisp >= cfra) {
seq->start+= gap;
calc_sequence(scene, seq);
done= 1;
@@ -864,16 +864,16 @@ static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene)
/* touch all strips with movies */
- if(ed==NULL) return;
+ if (ed==NULL) return;
- if(okee("Touch and print selected movies")==0) return;
+ // XXX25 if (okee("Touch and print selected movies")==0) return;
WM_cursor_wait(1);
SEQP_BEGIN(ed, seq) {
- if(seq->flag & SELECT) {
- if(seq->type==SEQ_MOVIE) {
- if(seq->strip && seq->strip->stripdata) {
+ if (seq->flag & SELECT) {
+ if (seq->type==SEQ_MOVIE) {
+ if (seq->strip && seq->strip->stripdata) {
BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name);
BLI_file_touch(seq->name);
}
@@ -893,13 +893,13 @@ static void set_filter_seq(Scene *scene)
Editing *ed= seq_give_editing(scene, FALSE);
- if(ed==NULL) return;
+ if (ed==NULL) return;
- if(okee("Set Deinterlace")==0) return;
+ if (okee("Set Deinterlace")==0) return;
SEQP_BEGIN(ed, seq) {
- if(seq->flag & SELECT) {
- if(seq->type==SEQ_MOVIE) {
+ if (seq->flag & SELECT) {
+ if (seq->type==SEQ_MOVIE) {
seq->flag |= SEQ_FILTERY;
reload_sequence_new_file(scene, seq, FALSE);
calc_sequence(scene, seq);
@@ -918,7 +918,7 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
char from[FILE_MAX], to[FILE_MAX], stripped[FILE_MAX];
- if(last_seq==NULL)
+ if (last_seq==NULL)
return;
BLI_strncpy(from, last_seq->strip->dir, sizeof(from));
@@ -933,8 +933,8 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
return;
SEQP_BEGIN(ed, seq) {
- if(seq->flag & SELECT) {
- if(strncmp(seq->strip->dir, from, strlen(from))==0) {
+ if (seq->flag & SELECT) {
+ if (strncmp(seq->strip->dir, from, strlen(from))==0) {
printf("found %s\n", seq->strip->dir);
/* strip off the beginning */
@@ -958,19 +958,19 @@ static void UNUSED_FUNCTION(no_gaps)(Scene *scene)
int cfra, first= 0, done;
- if(ed==NULL) return;
+ if (ed==NULL) return;
- for(cfra= CFRA; cfra<=EFRA; cfra++) {
- if(first==0) {
- if( evaluate_seq_frame(scene, cfra) ) first= 1;
+ for (cfra= CFRA; cfra<=EFRA; cfra++) {
+ if (first==0) {
+ if ( evaluate_seq_frame(scene, cfra) ) first= 1;
}
else {
done= 1;
- while( evaluate_seq_frame(scene, cfra) == 0) {
+ while ( evaluate_seq_frame(scene, cfra) == 0) {
done= insert_gap(scene, -1, cfra);
- if(done==0) break;
+ if (done==0) break;
}
- if(done==0) break;
+ if (done==0) break;
}
}
@@ -1033,18 +1033,20 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
snap_frame= RNA_int_get(op->ptr, "frame");
/* also check metas */
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if (seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK) &&
seq_tx_test(seq)) {
- if((seq->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))==0) {
+ if ((seq->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))==0) {
/* simple but no anim update */
/* seq->start= snap_frame-seq->startofs+seq->startstill; */
seq_translate(scene, seq, (snap_frame-seq->startofs+seq->startstill) - seq->start);
- } else {
- if(seq->flag & SEQ_LEFTSEL) {
+ }
+ else {
+ if (seq->flag & SEQ_LEFTSEL) {
seq_tx_set_final_left(seq, snap_frame);
- } else { /* SEQ_RIGHTSEL */
+ }
+ else { /* SEQ_RIGHTSEL */
seq_tx_set_final_right(seq, snap_frame);
}
seq_tx_handle_xlimits(seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL);
@@ -1054,20 +1056,20 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
}
/* test for effects and overlap
- * dont use SEQP_BEGIN since that would be recursive */
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
- if(seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK)) {
+ * don't use SEQP_BEGIN since that would be recursive */
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if (seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK)) {
seq->flag &= ~SEQ_OVERLAP;
- if( seq_test_overlap(ed->seqbasep, seq) ) {
+ if ( seq_test_overlap(ed->seqbasep, seq) ) {
shuffle_seq(ed->seqbasep, seq, scene);
}
}
- else if(seq->type & SEQ_EFFECT) {
- if(seq->seq1 && (seq->seq1->flag & SELECT))
+ else if (seq->type & SEQ_EFFECT) {
+ if (seq->seq1 && (seq->seq1->flag & SELECT))
calc_sequence(scene, seq);
- else if(seq->seq2 && (seq->seq2->flag & SELECT))
+ else if (seq->seq2 && (seq->seq2->flag & SELECT))
calc_sequence(scene, seq);
- else if(seq->seq3 && (seq->seq3->flag & SELECT))
+ else if (seq->seq3 && (seq->seq3->flag & SELECT))
calc_sequence(scene, seq);
}
}
@@ -1095,17 +1097,17 @@ static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
void SEQUENCER_OT_snap(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Snap strips";
- ot->idname= "SEQUENCER_OT_snap";
- ot->description="Frame where selected strips will be snapped";
+ ot->name = "Snap strips";
+ ot->idname = "SEQUENCER_OT_snap";
+ ot->description = "Frame where selected strips will be snapped";
/* api callbacks */
- ot->invoke= sequencer_snap_invoke;
- ot->exec= sequencer_snap_exec;
- ot->poll= sequencer_edit_poll;
+ ot->invoke = sequencer_snap_invoke;
+ ot->exec = sequencer_snap_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be snapped", INT_MIN, INT_MAX);
}
@@ -1120,14 +1122,14 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op)
selected= !RNA_boolean_get(op->ptr, "unselected");
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if ((seq->flag & SEQ_LOCK)==0) {
- if(selected){ /* mute unselected */
- if(seq->flag & SELECT)
+ if (selected) { /* mute unselected */
+ if (seq->flag & SELECT)
seq->flag |= SEQ_MUTE;
}
else {
- if((seq->flag & SELECT)==0)
+ if ((seq->flag & SELECT)==0)
seq->flag |= SEQ_MUTE;
}
}
@@ -1142,16 +1144,16 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_mute(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mute Strips";
- ot->idname= "SEQUENCER_OT_mute";
- ot->description="Mute selected strips";
+ ot->name = "Mute Strips";
+ ot->idname = "SEQUENCER_OT_mute";
+ ot->description = "Mute selected strips";
/* api callbacks */
- ot->exec= sequencer_mute_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_mute_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Mute unselected rather than selected strips");
}
@@ -1167,14 +1169,14 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op)
selected= !RNA_boolean_get(op->ptr, "unselected");
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if ((seq->flag & SEQ_LOCK)==0) {
- if(selected){ /* unmute unselected */
- if(seq->flag & SELECT)
+ if (selected) { /* unmute unselected */
+ if (seq->flag & SELECT)
seq->flag &= ~SEQ_MUTE;
}
else {
- if((seq->flag & SELECT)==0)
+ if ((seq->flag & SELECT)==0)
seq->flag &= ~SEQ_MUTE;
}
}
@@ -1189,16 +1191,16 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Un-Mute Strips";
- ot->idname= "SEQUENCER_OT_unmute";
- ot->description="Un-Mute unselected rather than selected strips";
+ ot->name = "Un-Mute Strips";
+ ot->idname = "SEQUENCER_OT_unmute";
+ ot->description = "Un-Mute unselected rather than selected strips";
/* api callbacks */
- ot->exec= sequencer_unmute_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_unmute_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "UnMute unselected rather than selected strips");
}
@@ -1211,7 +1213,7 @@ static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op))
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if (seq->flag & SELECT) {
seq->flag |= SEQ_LOCK;
}
@@ -1225,16 +1227,16 @@ static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_lock(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Lock Strips";
- ot->idname= "SEQUENCER_OT_lock";
- ot->description="Lock the active strip so that it can't be transformed";
+ ot->name = "Lock Strips";
+ ot->idname = "SEQUENCER_OT_lock";
+ ot->description = "Lock the active strip so that it can't be transformed";
/* api callbacks */
- ot->exec= sequencer_lock_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_lock_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* unlock operator */
@@ -1244,7 +1246,7 @@ static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op))
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if (seq->flag & SELECT) {
seq->flag &= ~SEQ_LOCK;
}
@@ -1258,16 +1260,16 @@ static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_unlock(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "UnLock Strips";
- ot->idname= "SEQUENCER_OT_unlock";
- ot->description="Unlock the active strip so that it can't be transformed";
+ ot->name = "UnLock Strips";
+ ot->idname = "SEQUENCER_OT_unlock";
+ ot->description = "Unlock the active strip so that it can't be transformed";
/* api callbacks */
- ot->exec= sequencer_unlock_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_unlock_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* reload operator */
@@ -1277,8 +1279,8 @@ static int sequencer_reload_exec(bContext *C, wmOperator *UNUSED(op))
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
- if(seq->flag & SELECT) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if (seq->flag & SELECT) {
update_changed_seq_and_deps(scene, seq, 0, 1);
}
}
@@ -1291,16 +1293,16 @@ static int sequencer_reload_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_reload(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reload Strips";
- ot->idname= "SEQUENCER_OT_reload";
- ot->description="Reload strips in the sequencer";
+ ot->name = "Reload Strips";
+ ot->idname = "SEQUENCER_OT_reload";
+ ot->description = "Reload strips in the sequencer";
/* api callbacks */
- ot->exec= sequencer_reload_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_reload_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER; /* no undo, the data changed is stored outside 'main' */
+ ot->flag = OPTYPE_REGISTER; /* no undo, the data changed is stored outside 'main' */
}
/* reload operator */
@@ -1319,13 +1321,13 @@ static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Refresh Sequencer";
- ot->idname= "SEQUENCER_OT_refresh_all";
- ot->description="Refresh the sequencer editor";
+ ot->name = "Refresh Sequencer";
+ ot->idname = "SEQUENCER_OT_refresh_all";
+ ot->description = "Refresh the sequencer editor";
/* api callbacks */
- ot->exec= sequencer_refresh_all_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_refresh_all_exec;
+ ot->poll = sequencer_edit_poll;
}
static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
@@ -1334,12 +1336,12 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
Sequence *seq1, *seq2, *seq3, *last_seq = seq_active_get(scene);
const char *error_msg;
- if(!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) {
+ if (!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) {
BKE_report(op->reports, RPT_ERROR, error_msg);
return OPERATOR_CANCELLED;
}
/* see reassigning would create a cycle */
- if( seq_is_predecessor(seq1, last_seq) ||
+ if ( seq_is_predecessor(seq1, last_seq) ||
seq_is_predecessor(seq2, last_seq) ||
seq_is_predecessor(seq3, last_seq)
) {
@@ -1363,9 +1365,9 @@ static int sequencer_effect_poll(bContext *C)
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
- if(ed) {
+ if (ed) {
Sequence *last_seq= seq_active_get(scene);
- if(last_seq && (last_seq->type & SEQ_EFFECT)) {
+ if (last_seq && (last_seq->type & SEQ_EFFECT)) {
return 1;
}
}
@@ -1376,16 +1378,16 @@ static int sequencer_effect_poll(bContext *C)
void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reassign Inputs";
- ot->idname= "SEQUENCER_OT_reassign_inputs";
- ot->description="Reassign the inputs for the effect strip";
+ ot->name = "Reassign Inputs";
+ ot->idname = "SEQUENCER_OT_reassign_inputs";
+ ot->description = "Reassign the inputs for the effect strip";
/* api callbacks */
- ot->exec= sequencer_reassign_inputs_exec;
- ot->poll= sequencer_effect_poll;
+ ot->exec = sequencer_reassign_inputs_exec;
+ ot->poll = sequencer_effect_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1394,7 +1396,7 @@ static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
Sequence *seq, *last_seq = seq_active_get(scene);
- if(last_seq->seq1==NULL || last_seq->seq2 == NULL) {
+ if (last_seq->seq1==NULL || last_seq->seq2 == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap");
return OPERATOR_CANCELLED;
}
@@ -1412,16 +1414,16 @@ static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Swap Inputs";
- ot->idname= "SEQUENCER_OT_swap_inputs";
- ot->description="Swap the first two inputs for the effect strip";
+ ot->name = "Swap Inputs";
+ ot->idname = "SEQUENCER_OT_swap_inputs";
+ ot->description = "Swap the first two inputs for the effect strip";
/* api callbacks */
- ot->exec= sequencer_swap_inputs_exec;
- ot->poll= sequencer_effect_poll;
+ ot->exec = sequencer_swap_inputs_exec;
+ ot->poll = sequencer_effect_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1449,7 +1451,8 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
if (cut_hard==SEQ_CUT_HARD) {
changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard);
- } else {
+ }
+ else {
changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_soft);
}
@@ -1463,7 +1466,8 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
if ( seq->startdisp >= cut_frame ) {
seq->flag &= ~SEQ_ALLSEL;
}
- } else {
+ }
+ else {
if ( seq->enddisp <= cut_frame ) {
seq->flag &= ~SEQ_ALLSEL;
}
@@ -1475,7 +1479,7 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
sort_seq(scene);
}
- if(changed) {
+ if (changed) {
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1507,17 +1511,17 @@ static int sequencer_cut_invoke(bContext *C, wmOperator *op, wmEvent *event)
void SEQUENCER_OT_cut(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Cut Strips";
- ot->idname= "SEQUENCER_OT_cut";
- ot->description="Cut the selected strips";
+ ot->name = "Cut Strips";
+ ot->idname = "SEQUENCER_OT_cut";
+ ot->description = "Cut the selected strips";
/* api callbacks */
- ot->invoke= sequencer_cut_invoke;
- ot->exec= sequencer_cut_exec;
- ot->poll= sequencer_edit_poll;
+ ot->invoke = sequencer_cut_invoke;
+ ot->exec = sequencer_cut_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be cut", INT_MIN, INT_MAX);
RNA_def_enum(ot->srna, "type", prop_cut_types, SEQ_CUT_SOFT, "Type", "The type of cut operation to perform on strips");
@@ -1544,17 +1548,17 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
ListBase nseqbase= {NULL, NULL};
- if(ed==NULL)
+ if (ed==NULL)
return OPERATOR_CANCELLED;
seqbase_dupli_recursive(scene, NULL, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT);
- if(nseqbase.first) {
+ if (nseqbase.first) {
Sequence * seq= nseqbase.first;
/* rely on the nseqbase list being added at the end */
BLI_movelisttolist(ed->seqbasep, &nseqbase);
- for( ; seq; seq= seq->next)
+ for ( ; seq; seq= seq->next)
seq_recursive_apply(seq, apply_unique_name_cb, scene);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
@@ -1577,17 +1581,17 @@ static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *
void SEQUENCER_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Duplicate Strips";
- ot->idname= "SEQUENCER_OT_duplicate";
- ot->description="Duplicate the selected strips";
+ ot->name = "Duplicate Strips";
+ ot->idname = "SEQUENCER_OT_duplicate";
+ ot->description = "Duplicate the selected strips";
/* api callbacks */
- ot->invoke= sequencer_add_duplicate_invoke;
- ot->exec= sequencer_add_duplicate_exec;
- ot->poll= ED_operator_sequencer_active;
+ ot->invoke = sequencer_add_duplicate_invoke;
+ ot->exec = sequencer_add_duplicate_exec;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* to give to transform */
RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -1605,7 +1609,8 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
seq=seq_active_get(scene);
if (seq && seq->flag & SELECT) { /* avoid a loop since this is likely to be selected */
nothingSelected = FALSE;
- } else {
+ }
+ else {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
nothingSelected = FALSE;
@@ -1618,8 +1623,8 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
/* for effects, try to find a replacement input */
- for(seq=ed->seqbasep->first; seq; seq=seq->next)
- if((seq->type & SEQ_EFFECT) && !(seq->flag & SELECT))
+ for (seq=ed->seqbasep->first; seq; seq=seq->next)
+ if ((seq->type & SEQ_EFFECT) && !(seq->flag & SELECT))
del_seq_find_replace_recurs(scene, seq);
/* delete all selected strips */
@@ -1627,15 +1632,14 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* updates lengths etc */
seq= ed->seqbasep->first;
- while(seq) {
+ while (seq) {
calc_sequence(scene, seq);
seq= seq->next;
}
/* free parent metas */
ms= ed->metastack.last;
- while(ms) {
- ms->parseq->strip->len= 0; /* force new alloc */
+ while (ms) {
calc_sequence(scene, ms->parseq);
ms= ms->prev;
}
@@ -1650,17 +1654,17 @@ void SEQUENCER_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Erase Strips";
- ot->idname= "SEQUENCER_OT_delete";
- ot->description="Erase selected strips from the sequencer";
+ ot->name = "Erase Strips";
+ ot->idname = "SEQUENCER_OT_delete";
+ ot->description = "Erase selected strips from the sequencer";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= sequencer_delete_exec;
- ot->poll= sequencer_edit_poll;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = sequencer_delete_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1672,22 +1676,22 @@ static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op))
Sequence *seq;
/* for effects, try to find a replacement input */
- for(seq=ed->seqbasep->first; seq; seq=seq->next) {
- if((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) {
+ for (seq=ed->seqbasep->first; seq; seq=seq->next) {
+ if ((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) {
seq->startofs= seq->endofs= seq->startstill= seq->endstill= 0;
}
}
/* updates lengths etc */
seq= ed->seqbasep->first;
- while(seq) {
+ while (seq) {
calc_sequence(scene, seq);
seq= seq->next;
}
- for(seq=ed->seqbasep->first; seq; seq=seq->next) {
- if((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) {
- if(seq_test_overlap(ed->seqbasep, seq)) {
+ for (seq=ed->seqbasep->first; seq; seq=seq->next) {
+ if ((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) {
+ if (seq_test_overlap(ed->seqbasep, seq)) {
shuffle_seq(ed->seqbasep, seq, scene);
}
}
@@ -1703,16 +1707,16 @@ void SEQUENCER_OT_offset_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Strip Offset";
- ot->idname= "SEQUENCER_OT_offset_clear";
- ot->description="Clear strip offsets from the start and end frames";
+ ot->name = "Clear Strip Offset";
+ ot->idname = "SEQUENCER_OT_offset_clear";
+ ot->description = "Clear strip offsets from the start and end frames";
/* api callbacks */
- ot->exec= sequencer_offset_clear_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_offset_clear_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1731,11 +1735,11 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
seq= ed->seqbasep->first; /* poll checks this is valid */
while (seq) {
- if((seq->flag & SELECT) && (seq->type == SEQ_IMAGE) && (seq->len > 1)) {
- /* remove seq so overlap tests dont conflict,
+ if ((seq->flag & SELECT) && (seq->type == SEQ_IMAGE) && (seq->len > 1)) {
+ /* remove seq so overlap tests don't conflict,
* see seq_free_sequence below for the real free'ing */
BLI_remlink(ed->seqbasep, seq);
- /* if(seq->ipo) seq->ipo->id.us--; */
+ /* if (seq->ipo) seq->ipo->id.us--; */
/* XXX, remove fcurve and assign to split image strips */
start_ofs = cfra = seq_tx_get_final_left(seq, 0);
@@ -1755,7 +1759,6 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* new strip */
strip_new= seq_new->strip;
- strip_new->len= 1;
strip_new->us= 1;
/* new stripdata */
@@ -1763,7 +1766,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
BLI_strncpy(se_new->name, se->name, sizeof(se_new->name));
calc_sequence(scene, seq_new);
- if(step > 1) {
+ if (step > 1) {
seq_new->flag &= ~SEQ_OVERLAP;
if (seq_test_overlap(ed->seqbasep, seq_new)) {
shuffle_seq(ed->seqbasep, seq_new, scene);
@@ -1778,7 +1781,8 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
seq_free_sequence(scene, seq);
seq = seq->next;
- } else {
+ }
+ else {
seq = seq->next;
}
}
@@ -1795,16 +1799,16 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_images_separate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Separate Images";
- ot->idname= "SEQUENCER_OT_images_separate";
- ot->description="On image sequence strips, it returns a strip for each image";
+ ot->name = "Separate Images";
+ ot->idname = "SEQUENCER_OT_images_separate";
+ ot->description = "On image sequence strips, it returns a strip for each image";
/* api callbacks */
- ot->exec= sequencer_separate_images_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_separate_images_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_int(ot->srna, "length", 1, 1, 1000, "Length", "Length of each frame", 1, INT_MAX);
}
@@ -1820,7 +1824,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
Sequence *last_seq= seq_active_get(scene);
MetaStack *ms;
- if(last_seq && last_seq->type==SEQ_META && last_seq->flag & SELECT) {
+ if (last_seq && last_seq->type==SEQ_META && last_seq->flag & SELECT) {
/* Enter Metastrip */
ms= MEM_mallocN(sizeof(MetaStack), "metastack");
BLI_addtail(&ed->metastack, ms);
@@ -1837,7 +1841,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
Sequence *seq;
- if(ed->metastack.first==NULL)
+ if (ed->metastack.first==NULL)
return OPERATOR_CANCELLED;
ms= ed->metastack.last;
@@ -1846,7 +1850,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
ed->seqbasep= ms->oldbasep;
/* recalc all: the meta can have effects connected to it */
- for(seq= ed->seqbasep->first; seq; seq= seq->next)
+ for (seq= ed->seqbasep->first; seq; seq= seq->next)
calc_sequence(scene, seq);
seq_active_set(scene, ms->parseq);
@@ -1867,16 +1871,16 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_meta_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Meta Strip";
- ot->idname= "SEQUENCER_OT_meta_toggle";
- ot->description="Toggle a metastrip (to edit enclosed strips)";
+ ot->name = "Toggle Meta Strip";
+ ot->idname = "SEQUENCER_OT_meta_toggle";
+ ot->description = "Toggle a metastrip (to edit enclosed strips)";
/* api callbacks */
- ot->exec= sequencer_meta_toggle_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_meta_toggle_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1889,7 +1893,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
Sequence *seq, *seqm, *next, *last_seq = seq_active_get(scene);
int channel_max= 1;
- if(seqbase_isolated_sel_check(ed->seqbasep)==FALSE) {
+ if (seqbase_isolated_sel_check(ed->seqbasep)==FALSE) {
BKE_report(op->reports, RPT_ERROR, "Please select all related strips");
return OPERATOR_CANCELLED;
}
@@ -1902,9 +1906,9 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
seqm->flag= SELECT;
seq= ed->seqbasep->first;
- while(seq) {
+ while (seq) {
next= seq->next;
- if(seq!=seqm && (seq->flag & SELECT)) {
+ if (seq!=seqm && (seq->flag & SELECT)) {
channel_max= MAX2(seq->machine, channel_max);
BLI_remlink(ed->seqbasep, seq);
BLI_addtail(&seqm->seqbase, seq);
@@ -1915,12 +1919,11 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
calc_sequence(scene, seqm);
seqm->strip= MEM_callocN(sizeof(Strip), "metastrip");
- seqm->strip->len= seqm->len;
seqm->strip->us= 1;
seq_active_set(scene, seqm);
- if( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene);
+ if ( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene);
seq_update_muting(ed);
@@ -1934,17 +1937,17 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_meta_make(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Meta Strip";
- ot->idname= "SEQUENCER_OT_meta_make";
- ot->description="Group selected strips into a metastrip";
+ ot->name = "Make Meta Strip";
+ ot->idname = "SEQUENCER_OT_meta_make";
+ ot->description = "Group selected strips into a metastrip";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= sequencer_meta_make_exec;
- ot->poll= sequencer_edit_poll;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = sequencer_meta_make_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -1965,7 +1968,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
Sequence *seq, *last_seq = seq_active_get(scene); /* last_seq checks ed==NULL */
- if(last_seq==NULL || last_seq->type!=SEQ_META)
+ if (last_seq==NULL || last_seq->type!=SEQ_META)
return OPERATOR_CANCELLED;
BLI_movelisttolist(ed->seqbasep, &last_seq->seqbase);
@@ -1977,18 +1980,18 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
seq_free_sequence(scene, last_seq);
/* emtpy meta strip, delete all effects depending on it */
- for(seq=ed->seqbasep->first; seq; seq=seq->next)
- if((seq->type & SEQ_EFFECT) && seq_depends_on_meta(seq, last_seq))
+ for (seq=ed->seqbasep->first; seq; seq=seq->next)
+ if ((seq->type & SEQ_EFFECT) && seq_depends_on_meta(seq, last_seq))
seq->flag |= SEQ_FLAG_DELETE;
recurs_del_seq_flag(scene, ed->seqbasep, SEQ_FLAG_DELETE, 0);
/* test for effects and overlap
- * dont use SEQP_BEGIN since that would be recursive */
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
- if(seq->flag & SELECT) {
+ * don't use SEQP_BEGIN since that would be recursive */
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if (seq->flag & SELECT) {
seq->flag &= ~SEQ_OVERLAP;
- if(seq_test_overlap(ed->seqbasep, seq)) {
+ if (seq_test_overlap(ed->seqbasep, seq)) {
shuffle_seq(ed->seqbasep, seq, scene);
}
}
@@ -2005,17 +2008,17 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_meta_separate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "UnMeta Strip";
- ot->idname= "SEQUENCER_OT_meta_separate";
- ot->description="Put the contents of a metastrip back in the sequencer";
+ ot->name = "UnMeta Strip";
+ ot->idname = "SEQUENCER_OT_meta_separate";
+ ot->description = "Put the contents of a metastrip back in the sequencer";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
- ot->exec= sequencer_meta_separate_exec;
- ot->poll= sequencer_edit_poll;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = sequencer_meta_separate_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* view_all operator */
@@ -2038,16 +2041,16 @@ static int sequencer_view_all_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View All";
- ot->idname= "SEQUENCER_OT_view_all";
- ot->description="View all the strips in the sequencer";
+ ot->name = "View All";
+ ot->idname = "SEQUENCER_OT_view_all";
+ ot->description = "View all the strips in the sequencer";
/* api callbacks */
- ot->exec= sequencer_view_all_exec;
- ot->poll= ED_operator_sequencer_active;
+ ot->exec = sequencer_view_all_exec;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
/* view_all operator */
@@ -2104,16 +2107,16 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_view_all_preview(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View All";
- ot->idname= "SEQUENCER_OT_view_all_preview";
- ot->description="Zoom preview to fit in the area";
+ ot->name = "View All";
+ ot->idname = "SEQUENCER_OT_view_all_preview";
+ ot->description = "Zoom preview to fit in the area";
/* api callbacks */
- ot->exec= sequencer_view_all_preview_exec;
- ot->poll= ED_operator_sequencer_active;
+ ot->exec = sequencer_view_all_preview_exec;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
@@ -2140,13 +2143,13 @@ static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_view_zoom_ratio(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Sequencer View Zoom Ratio";
- ot->idname= "SEQUENCER_OT_view_zoom_ratio";
+ ot->name = "Sequencer View Zoom Ratio";
+ ot->idname = "SEQUENCER_OT_view_zoom_ratio";
ot->description = "Change zoom ratio of sequencer preview";
/* api callbacks */
- ot->exec= sequencer_view_zoom_ratio_exec;
- ot->poll= ED_operator_sequencer_active;
+ ot->exec = sequencer_view_zoom_ratio_exec;
+ ot->poll = ED_operator_sequencer_active;
/* properties */
RNA_def_float(ot->srna, "ratio", 1.0f, 0.0f, FLT_MAX,
@@ -2178,16 +2181,16 @@ static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_view_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Toggle";
- ot->idname= "SEQUENCER_OT_view_toggle";
- ot->description="Toggle between sequencer views (sequence, preview, both)";
+ ot->name = "View Toggle";
+ ot->idname = "SEQUENCER_OT_view_toggle";
+ ot->description = "Toggle between sequencer views (sequence, preview, both)";
/* api callbacks */
- ot->exec= sequencer_view_toggle_exec;
- ot->poll= ED_operator_sequencer_active;
+ ot->exec = sequencer_view_toggle_exec;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
@@ -2210,11 +2213,11 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
int ymargin= 1;
int xmargin= FPS;
- if(ed==NULL)
+ if (ed==NULL)
return OPERATOR_CANCELLED;
- for(seq=ed->seqbasep->first; seq; seq=seq->next) {
- if(seq->flag & SELECT) {
+ for (seq=ed->seqbasep->first; seq; seq=seq->next) {
+ if (seq->flag & SELECT) {
xmin= MIN2(xmin, seq->startdisp);
xmax= MAX2(xmax, seq->enddisp);
@@ -2232,18 +2235,18 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
orig_height= v2d->cur.ymax - v2d->cur.ymin;
- v2d->cur.xmin= xmin;
- v2d->cur.xmax= xmax;
+ v2d->cur.xmin = xmin;
+ v2d->cur.xmax = xmax;
- v2d->cur.ymin= ymin;
- v2d->cur.ymax= ymax;
+ v2d->cur.ymin = ymin;
+ v2d->cur.ymax = ymax;
/* only zoom out vertically */
if (orig_height > v2d->cur.ymax - v2d->cur.ymin) {
ymid= (v2d->cur.ymax + v2d->cur.ymin) / 2;
- v2d->cur.ymin= ymid - (orig_height/2);
- v2d->cur.ymax= ymid + (orig_height/2);
+ v2d->cur.ymin = ymid - (orig_height/2);
+ v2d->cur.ymax = ymid + (orig_height/2);
}
UI_view2d_curRect_validate(v2d);
@@ -2258,16 +2261,16 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_view_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Selected";
- ot->idname= "SEQUENCER_OT_view_selected";
- ot->description="Zoom the sequencer on the selected strips";
+ ot->name = "View Selected";
+ ot->idname = "SEQUENCER_OT_view_selected";
+ ot->description = "Zoom the sequencer on the selected strips";
/* api callbacks */
- ot->exec= sequencer_view_selected_exec;
- ot->poll= ED_operator_sequencer_active;
+ ot->exec = sequencer_view_selected_exec;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
@@ -2279,9 +2282,9 @@ static int find_next_prev_edit(Scene *scene, int cfra, int side)
int dist, best_dist;
best_dist = MAXFRAME*2;
- if(ed==NULL) return cfra;
+ if (ed==NULL) return cfra;
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
dist = MAXFRAME*2;
switch (side) {
@@ -2293,7 +2296,8 @@ static int find_next_prev_edit(Scene *scene, int cfra, int side)
case SEQ_SIDE_RIGHT:
if (seq->startdisp > cfra) {
dist = seq->startdisp - cfra;
- } else if (seq->startdisp == cfra) {
+ }
+ else if (seq->startdisp == cfra) {
frame_seq=seq;
}
break;
@@ -2332,7 +2336,7 @@ static int sequencer_next_edit_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
- if(!next_prev_edit_internal(scene, SEQ_SIDE_RIGHT))
+ if (!next_prev_edit_internal(scene, SEQ_SIDE_RIGHT))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
@@ -2343,16 +2347,16 @@ static int sequencer_next_edit_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_next_edit(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Next Edit";
- ot->idname= "SEQUENCER_OT_next_edit";
- ot->description="Move frame to next edit point";
+ ot->name = "Next Edit";
+ ot->idname = "SEQUENCER_OT_next_edit";
+ ot->description = "Move frame to next edit point";
/* api callbacks */
- ot->exec= sequencer_next_edit_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_next_edit_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
}
@@ -2362,7 +2366,7 @@ static int sequencer_previous_edit_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
- if(!next_prev_edit_internal(scene, SEQ_SIDE_LEFT))
+ if (!next_prev_edit_internal(scene, SEQ_SIDE_LEFT))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
@@ -2373,16 +2377,16 @@ static int sequencer_previous_edit_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_previous_edit(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Previous Edit";
- ot->idname= "SEQUENCER_OT_previous_edit";
- ot->description="Move frame to previous edit point";
+ ot->name = "Previous Edit";
+ ot->idname = "SEQUENCER_OT_previous_edit";
+ ot->description = "Move frame to previous edit point";
/* api callbacks */
- ot->exec= sequencer_previous_edit_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_previous_edit_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
}
@@ -2403,9 +2407,9 @@ static Sequence* sequence_find_parent(Scene* scene, Sequence* child)
Sequence *parent= NULL;
Sequence *seq;
- if(ed==NULL) return NULL;
+ if (ed==NULL) return NULL;
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if ( (seq != child) && seq_is_parent(seq, child) ) {
parent = seq;
break;
@@ -2424,11 +2428,11 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
Sequence *seq, *iseq;
int side= RNA_enum_get(op->ptr, "side");
- if(active_seq==NULL) return OPERATOR_CANCELLED;
+ if (active_seq==NULL) return OPERATOR_CANCELLED;
seq = find_next_prev_sequence(scene, active_seq, side, -1);
- if(seq) {
+ if (seq) {
/* disallow effect strips */
if (get_sequence_effect_num_inputs(seq->type) >= 1 && (seq->effectdata || seq->seq1 || seq->seq2 || seq->seq3))
@@ -2446,17 +2450,17 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
}
// XXX - should be a generic function
- for(iseq= scene->ed->seqbasep->first; iseq; iseq= iseq->next) {
- if((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
+ for (iseq= scene->ed->seqbasep->first; iseq; iseq= iseq->next) {
+ if ((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
calc_sequence(scene, iseq);
}
}
/* do this in a new loop since both effects need to be calculated first */
- for(iseq= scene->ed->seqbasep->first; iseq; iseq= iseq->next) {
- if((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
+ for (iseq= scene->ed->seqbasep->first; iseq; iseq= iseq->next) {
+ if ((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
/* this may now overlap */
- if( seq_test_overlap(ed->seqbasep, iseq) ) {
+ if ( seq_test_overlap(ed->seqbasep, iseq) ) {
shuffle_seq(ed->seqbasep, iseq, scene);
}
}
@@ -2477,16 +2481,16 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_swap(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Swap Strip";
- ot->idname= "SEQUENCER_OT_swap";
- ot->description="Swap active strip with strip to the right or left";
+ ot->name = "Swap Strip";
+ ot->idname = "SEQUENCER_OT_swap";
+ ot->description = "Swap active strip with strip to the right or left";
/* api callbacks */
- ot->exec= sequencer_swap_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_swap_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "side", prop_side_lr_types, SEQ_SIDE_RIGHT, "Side", "Side of the strip to swap");
@@ -2499,7 +2503,7 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
Sequence *active_seq = seq_active_get(scene);
StripElem *se = NULL;
- if(active_seq==NULL)
+ if (active_seq==NULL)
return OPERATOR_CANCELLED;
@@ -2536,29 +2540,29 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_rendersize(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Render Size";
- ot->idname= "SEQUENCER_OT_rendersize";
- ot->description="Set render size and aspect from active sequence";
+ ot->name = "Set Render Size";
+ ot->idname = "SEQUENCER_OT_rendersize";
+ ot->description = "Set render size and aspect from active sequence";
/* api callbacks */
- ot->exec= sequencer_rendersize_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_rendersize_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
}
static void seq_copy_del_sound(Scene *scene, Sequence *seq)
{
- if(seq->type == SEQ_META) {
+ if (seq->type == SEQ_META) {
Sequence *iseq;
- for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
+ for (iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
seq_copy_del_sound(scene, iseq);
}
}
- else if(seq->scene_sound) {
+ else if (seq->scene_sound) {
sound_remove_scene_sound(scene, seq->scene_sound);
seq->scene_sound = NULL;
}
@@ -2575,7 +2579,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
seq_free_clipboard();
- if(seqbase_isolated_sel_check(ed->seqbasep)==FALSE) {
+ if (seqbase_isolated_sel_check(ed->seqbasep)==FALSE) {
BKE_report(op->reports, RPT_ERROR, "Please select all related strips");
return OPERATOR_CANCELLED;
}
@@ -2585,17 +2589,17 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
/* To make sure the copied strips have unique names between each other add
* them temporarily to the end of the original seqbase. (bug 25932)
*/
- if(nseqbase.first) {
+ if (nseqbase.first) {
Sequence *seq, *first_seq = nseqbase.first;
BLI_movelisttolist(ed->seqbasep, &nseqbase);
- for(seq=first_seq; seq; seq=seq->next)
+ for (seq=first_seq; seq; seq=seq->next)
seq_recursive_apply(seq, apply_unique_name_cb, scene);
seqbase_clipboard.first = first_seq;
seqbase_clipboard.last = ed->seqbasep->last;
- if(first_seq->prev) {
+ if (first_seq->prev) {
first_seq->prev->next = NULL;
ed->seqbasep->last = first_seq->prev;
first_seq->prev = NULL;
@@ -2605,7 +2609,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
seqbase_clipboard_frame= scene->r.cfra;
/* Need to remove anything that references the current scene */
- for(seq= seqbase_clipboard.first; seq; seq= seq->next) {
+ for (seq= seqbase_clipboard.first; seq; seq= seq->next) {
seq_copy_del_sound(scene, seq);
}
@@ -2615,29 +2619,29 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy";
- ot->idname= "SEQUENCER_OT_copy";
- ot->description="";
+ ot->name = "Copy";
+ ot->idname = "SEQUENCER_OT_copy";
+ ot->description = "";
/* api callbacks */
- ot->exec= sequencer_copy_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_copy_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
/* properties */
}
static void seq_paste_add_sound(Scene *scene, Sequence *seq)
{
- if(seq->type == SEQ_META) {
+ if (seq->type == SEQ_META) {
Sequence *iseq;
- for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
+ for (iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
seq_paste_add_sound(scene, iseq);
}
}
- else if(seq->type == SEQ_SOUND) {
+ else if (seq->type == SEQ_SOUND) {
seq->scene_sound = sound_add_scene_sound_defaults(scene, seq);
}
}
@@ -2656,8 +2660,8 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
seqbase_dupli_recursive(scene, NULL, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME);
/* transform pasted strips before adding */
- if(ofs) {
- for(iseq= nseqbase.first; iseq; iseq= iseq->next) {
+ if (ofs) {
+ for (iseq= nseqbase.first; iseq; iseq= iseq->next) {
seq_translate(scene, iseq, ofs);
seq_sound_init(scene, iseq);
}
@@ -2668,7 +2672,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
BLI_movelisttolist(ed->seqbasep, &nseqbase);
/* make sure the pasted strips have unique names between them */
- for(; iseq; iseq=iseq->next) {
+ for (; iseq; iseq=iseq->next) {
seq_recursive_apply(iseq, apply_unique_name_cb, scene);
/* restore valid sound_scene for newly added strips */
@@ -2683,16 +2687,16 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_paste(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste";
- ot->idname= "SEQUENCER_OT_paste";
- ot->description="";
+ ot->name = "Paste";
+ ot->idname = "SEQUENCER_OT_paste";
+ ot->description = "";
/* api callbacks */
- ot->exec= sequencer_paste_exec;
- ot->poll= ED_operator_sequencer_active;
+ ot->exec = sequencer_paste_exec;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
}
@@ -2704,12 +2708,12 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
Sequence *seq_other;
const char *error_msg;
- if(seq_active_pair_get(scene, &seq_act, &seq_other) == 0) {
+ if (seq_active_pair_get(scene, &seq_act, &seq_other) == 0) {
BKE_report(op->reports, RPT_ERROR, "Must select 2 strips");
return OPERATOR_CANCELLED;
}
- if(seq_swap(seq_act, seq_other, &error_msg) == 0) {
+ if (seq_swap(seq_act, seq_other, &error_msg) == 0) {
BKE_report(op->reports, RPT_ERROR, error_msg);
return OPERATOR_CANCELLED;
}
@@ -2723,8 +2727,8 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
calc_sequence(scene, seq_act);
calc_sequence(scene, seq_other);
- if(seq_act->sound) sound_add_scene_sound_defaults(scene, seq_act);
- if(seq_other->sound) sound_add_scene_sound_defaults(scene, seq_other);
+ if (seq_act->sound) sound_add_scene_sound_defaults(scene, seq_act);
+ if (seq_other->sound) sound_add_scene_sound_defaults(scene, seq_other);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
@@ -2734,16 +2738,16 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_swap_data(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Sequencer Swap Data";
- ot->idname= "SEQUENCER_OT_swap_data";
- ot->description="Swap 2 sequencer strips";
+ ot->name = "Sequencer Swap Data";
+ ot->idname = "SEQUENCER_OT_swap_data";
+ ot->description = "Swap 2 sequencer strips";
/* api callbacks */
- ot->exec= sequencer_swap_data_exec;
- ot->poll= ED_operator_sequencer_active;
+ ot->exec = sequencer_swap_data_exec;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
}
@@ -2761,7 +2765,7 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmin"), RNA_int_get(op->ptr, "ymin"), &rect.xmin, &rect.ymin);
UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmax"), RNA_int_get(op->ptr, "ymax"), &rect.xmax, &rect.ymax);
- if(ed==NULL)
+ if (ed==NULL)
return OPERATOR_CANCELLED;
rect.xmin /= (float)(ABS(v2d->tot.xmax - v2d->tot.xmin));
@@ -2791,19 +2795,19 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Offset View";
- ot->idname= "SEQUENCER_OT_view_ghost_border";
- ot->description="Enable border select mode";
+ ot->name = "Border Offset View";
+ ot->idname = "SEQUENCER_OT_view_ghost_border";
+ ot->description = "Enable border select mode";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= view_ghost_border_exec;
- ot->modal= WM_border_select_modal;
- ot->poll= sequencer_view_poll;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = view_ghost_border_exec;
+ ot->modal = WM_border_select_modal;
+ ot->poll = sequencer_view_poll;
+ ot->cancel = WM_border_select_cancel;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
/* rna */
WM_operator_properties_gesture_border(ot, FALSE);
@@ -2820,16 +2824,16 @@ static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Rebuild Proxy and Timecode Indices";
- ot->idname= "SEQUENCER_OT_rebuild_proxy";
- ot->description="Rebuild all selected proxies and timecode indeces using the job system";
+ ot->name = "Rebuild Proxy and Timecode Indices";
+ ot->idname = "SEQUENCER_OT_rebuild_proxy";
+ ot->description = "Rebuild all selected proxies and timecode indeces using the job system";
/* api callbacks */
- ot->exec= sequencer_rebuild_proxy_exec;
- ot->poll= ED_operator_sequencer_active;
+ ot->exec = sequencer_rebuild_proxy_exec;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag = OPTYPE_REGISTER;
}
/* change ops */
@@ -2864,7 +2868,7 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
break;
}
- if(*seq_1 == NULL || *seq_2 == NULL) {
+ if (*seq_1 == NULL || *seq_2 == NULL) {
BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, can't swap");
return OPERATOR_CANCELLED;
}
@@ -2874,7 +2878,7 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
update_changed_seq_and_deps(scene, seq, 0, 1);
- /* important else we dont get the imbuf cache flushed */
+ /* important else we don't get the imbuf cache flushed */
free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
@@ -2885,18 +2889,18 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_change_effect_input(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change Effect Input";
- ot->idname= "SEQUENCER_OT_change_effect_input";
- ot->description="";
+ ot->name = "Change Effect Input";
+ ot->idname = "SEQUENCER_OT_change_effect_input";
+ ot->description = "";
/* api callbacks */
- ot->exec= sequencer_change_effect_input_exec;
- ot->poll= sequencer_effect_poll;
+ ot->exec = sequencer_change_effect_input_exec;
+ ot->poll = sequencer_effect_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
- ot->prop= RNA_def_enum(ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap");
+ ot->prop = RNA_def_enum(ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap");
}
static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
@@ -2934,7 +2938,7 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
/* update */
update_changed_seq_and_deps(scene, seq, 0, 1);
- /* important else we dont get the imbuf cache flushed */
+ /* important else we don't get the imbuf cache flushed */
free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
@@ -2945,18 +2949,18 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change Effect Type";
- ot->idname= "SEQUENCER_OT_change_effect_type";
- ot->description="";
+ ot->name = "Change Effect Type";
+ ot->idname = "SEQUENCER_OT_change_effect_type";
+ ot->description = "";
/* api callbacks */
- ot->exec= sequencer_change_effect_type_exec;
- ot->poll= sequencer_effect_poll;
+ ot->exec = sequencer_change_effect_type_exec;
+ ot->poll = sequencer_effect_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
- ot->prop= RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
+ ot->prop = RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
}
static int sequencer_change_path_exec(bContext *C, wmOperator *op)
@@ -2967,12 +2971,12 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
Sequence *seq= seq_active_get(scene);
const int is_relative_path= RNA_boolean_get(op->ptr, "relative_path");
- if(seq->type == SEQ_IMAGE) {
+ if (seq->type == SEQ_IMAGE) {
char directory[FILE_MAX];
const int len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
StripElem *se;
- if(len==0)
+ if (len==0)
return OPERATOR_CANCELLED;
RNA_string_get(op->ptr, "directory", directory);
@@ -2984,7 +2988,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
}
BLI_strncpy(seq->strip->dir, directory, sizeof(seq->strip->dir));
- if(seq->strip->stripdata) {
+ if (seq->strip->stripdata) {
MEM_freeN(seq->strip->stripdata);
}
seq->strip->stripdata= se= MEM_callocN(len*sizeof(StripElem), "stripelem");
@@ -3000,13 +3004,13 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
/* reset these else we wont see all the images */
seq->anim_startofs= seq->anim_endofs= 0;
- /* correct start/end frames so we dont move
+ /* correct start/end frames so we don't move
* important not to set seq->len= len; allow the function to handle it */
reload_sequence_new_file(scene, seq, TRUE);
calc_sequence(scene, seq);
- /* important else we dont get the imbuf cache flushed */
+ /* important else we don't get the imbuf cache flushed */
free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
}
else {
@@ -3036,7 +3040,7 @@ static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UN
RNA_string_set(op->ptr, "directory", seq->strip->dir);
/* set default display depending on seq type */
- if(seq->type == SEQ_IMAGE) {
+ if (seq->type == SEQ_IMAGE) {
RNA_boolean_set(op->ptr, "filter_movie", FALSE);
}
else {
@@ -3051,17 +3055,79 @@ static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UN
void SEQUENCER_OT_change_path(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change Data/Files";
- ot->idname= "SEQUENCER_OT_change_path";
- ot->description="";
+ ot->name = "Change Data/Files";
+ ot->idname = "SEQUENCER_OT_change_path";
+ ot->description = "";
/* api callbacks */
- ot->exec= sequencer_change_path_exec;
- ot->invoke= sequencer_change_path_invoke;
- ot->poll= sequencer_strip_has_path_poll;
+ ot->exec = sequencer_change_path_exec;
+ ot->invoke = sequencer_change_path_invoke;
+ ot->poll = sequencer_strip_has_path_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILEPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
}
+
+static int sequencer_update_strip_length_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+ Editing *ed = seq_give_editing(scene, FALSE);
+ Sequence *seq;
+ int update = FALSE;
+
+ SEQP_BEGIN(ed, seq) {
+ if ((seq->flag & SELECT)) {
+ int changed = FALSE;
+
+ switch (seq->type) {
+ case SEQ_SCENE:
+ seq->len = seq->scene->r.efra - seq->scene->r.sfra + 1;
+ changed = TRUE;
+ break;
+ case SEQ_MOVIECLIP:
+ seq->len = BKE_movieclip_get_duration(seq->clip);
+ changed = TRUE;
+ break;
+ case SEQ_MOVIE:
+ seq->len = IMB_anim_get_duration(seq->anim, IMB_TC_RECORD_RUN);
+ changed = TRUE;
+ break;
+ }
+
+ if (changed) {
+ calc_sequence_disp(scene, seq);
+
+ if (seq_test_overlap(ed->seqbasep, seq))
+ shuffle_seq(ed->seqbasep, seq, scene);
+
+ update = TRUE;
+ }
+ }
+ }
+ SEQ_END
+
+ if (update) {
+ free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_update_strip_length(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Update Strip Length";
+ ot->idname = "SEQUENCER_OT_update_strip_length";
+ ot->description = "Update actual content length for selected strips";
+
+ /* api callbacks */
+ ot->exec = sequencer_update_strip_length_exec;
+ ot->poll = ED_operator_sequencer_active;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+}
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 2d98278e163..7acaaf76c62 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -117,6 +117,8 @@ void SEQUENCER_OT_paste(struct wmOperatorType *ot);
void SEQUENCER_OT_rebuild_proxy(struct wmOperatorType *ot);
+void SEQUENCER_OT_update_strip_length(struct wmOperatorType *ot);
+
/* preview specific operators */
void SEQUENCER_OT_view_all_preview(struct wmOperatorType *ot);
@@ -136,6 +138,7 @@ void SEQUENCER_OT_select_grouped(struct wmOperatorType *ot);
/* sequencer_select.c */
void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot);
void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot);
+void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot);
void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot);
void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot);
void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index e53d06c9786..2e24a8be346 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -104,6 +104,7 @@ void sequencer_operatortypes(void)
/* sequencer_add.c */
WM_operatortype_append(SEQUENCER_OT_scene_strip_add);
+ WM_operatortype_append(SEQUENCER_OT_movieclip_strip_add);
WM_operatortype_append(SEQUENCER_OT_movie_strip_add);
WM_operatortype_append(SEQUENCER_OT_sound_strip_add);
WM_operatortype_append(SEQUENCER_OT_image_strip_add);
@@ -112,6 +113,8 @@ void sequencer_operatortypes(void)
WM_operatortype_append(SEQUENCER_OT_copy);
WM_operatortype_append(SEQUENCER_OT_paste);
+
+ WM_operatortype_append(SEQUENCER_OT_update_strip_length);
}
@@ -123,14 +126,14 @@ void sequencer_keymap(wmKeyConfig *keyconf)
/* Common items ------------------------------------------------------------------ */
keymap = WM_keymap_find(keyconf, "SequencerCommon", SPACE_SEQ, 0);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, KM_SHIFT, 0);
RNA_string_set(kmi->ptr, "data_path", "scene.sequence_editor.show_overlay");
/* operators common to sequence and preview view */
WM_keymap_add_item(keymap, "SEQUENCER_OT_view_toggle", TABKEY, KM_PRESS, KM_CTRL, 0);
/* Strips Region --------------------------------------------------------------- */
- keymap= WM_keymap_find(keyconf, "Sequencer", SPACE_SEQ, 0);
+ keymap = WM_keymap_find(keyconf, "Sequencer", SPACE_SEQ, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0);
@@ -221,20 +224,20 @@ void sequencer_keymap(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
- kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "linked_left", TRUE);
RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
- kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL|KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL|KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_left", TRUE);
RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
- kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_left", TRUE);
- kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
#endif
@@ -246,21 +249,21 @@ void sequencer_keymap(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
- kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_handle", TRUE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
/* match action editor */
- kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
RNA_boolean_set(kmi->ptr, "left_right", TRUE); /* grr, these conflict - only use left_right if not over an active seq */
RNA_boolean_set(kmi->ptr, "linked_time", TRUE);
/* adjusted since 2.4 */
- kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
@@ -284,7 +287,7 @@ void sequencer_keymap(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "SEQUENCER_MT_change", CKEY, KM_PRESS, 0, 0);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", OKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_int", OKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "scene.sequence_editor.overlay_frame");
RNA_int_set(kmi->ptr, "value", 0);
@@ -295,7 +298,7 @@ void sequencer_keymap(wmKeyConfig *keyconf)
/* Preview Region ----------------------------------------------------------- */
- keymap= WM_keymap_find(keyconf, "SequencerPreview", SPACE_SEQ, 0);
+ keymap = WM_keymap_find(keyconf, "SequencerPreview", SPACE_SEQ, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all_preview", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c
index c13a5202c19..2e36c233f8e 100644
--- a/source/blender/editors/space_sequencer/sequencer_scopes.c
+++ b/source/blender/editors/space_sequencer/sequencer_scopes.c
@@ -240,7 +240,8 @@ struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf)
{
if (ibuf->rect_float) {
return make_waveform_view_from_ibuf_float(ibuf);
- } else {
+ }
+ else {
return make_waveform_view_from_ibuf_byte(ibuf);
}
}
@@ -353,7 +354,8 @@ struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf * ibuf)
{
if (ibuf->rect_float) {
return make_sep_waveform_view_from_ibuf_float(ibuf);
- } else {
+ }
+ else {
return make_sep_waveform_view_from_ibuf_byte(ibuf);
}
}
@@ -426,7 +428,8 @@ struct ImBuf * make_zebra_view_from_ibuf(struct ImBuf * src, float perc)
if (src->rect_float) {
draw_zebra_float(src, ibuf, perc);
- } else {
+ }
+ else {
draw_zebra_byte(src, ibuf, perc);
}
return ibuf;
@@ -508,7 +511,8 @@ static int get_bin_float(float f)
{
if (f < -0.25f) {
f = -0.25f;
- } else if (f > 1.25f) {
+ }
+ else if (f > 1.25f) {
f = 1.25f;
}
@@ -561,7 +565,8 @@ struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf)
{
if (ibuf->rect_float) {
return make_histogram_view_from_ibuf_float(ibuf);
- } else {
+ }
+ else {
return make_histogram_view_from_ibuf_byte(ibuf);
}
}
@@ -696,7 +701,8 @@ struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf * ibuf)
{
if (ibuf->rect_float) {
return make_vectorscope_view_from_ibuf_float(ibuf);
- } else {
+ }
+ else {
return make_vectorscope_view_from_ibuf_byte(ibuf);
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 32c7be99e94..00c2caea258 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -89,8 +89,8 @@ static void select_active_side(ListBase *seqbase, int sel_side, int channel, int
{
Sequence *seq;
- for(seq= seqbase->first; seq; seq=seq->next) {
- if(channel==seq->machine) {
+ for (seq= seqbase->first; seq; seq=seq->next) {
+ if (channel==seq->machine) {
switch(sel_side) {
case SEQ_SIDE_LEFT:
if (frame > (seq->startdisp)) {
@@ -117,27 +117,27 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link)
{
Sequence *seq;
- for(seq= seqbase->first; seq; seq=seq->next) {
- if(seq_link->machine != seq->machine) {
+ for (seq= seqbase->first; seq; seq=seq->next) {
+ if (seq_link->machine != seq->machine) {
int left_match = (seq->startdisp == seq_link->startdisp) ? 1:0;
int right_match = (seq->enddisp == seq_link->enddisp) ? 1:0;
- if(left_match && right_match) {
+ if (left_match && right_match) {
/* a direct match, copy the selection settinhs */
seq->flag &= ~(SELECT|SEQ_LEFTSEL|SEQ_RIGHTSEL);
seq->flag |= seq_link->flag & (SELECT|SEQ_LEFTSEL|SEQ_RIGHTSEL);
recurs_sel_seq(seq);
}
- else if(seq_link->flag & SELECT && (left_match || right_match)) {
+ else if (seq_link->flag & SELECT && (left_match || right_match)) {
/* clear for reselection */
seq->flag &= ~(SEQ_LEFTSEL|SEQ_RIGHTSEL);
- if(left_match && seq_link->flag & SEQ_LEFTSEL)
+ if (left_match && seq_link->flag & SEQ_LEFTSEL)
seq->flag |= SELECT|SEQ_LEFTSEL;
- if(right_match && seq_link->flag & SEQ_RIGHTSEL)
+ if (right_match && seq_link->flag & SEQ_RIGHTSEL)
seq->flag |= SELECT|SEQ_RIGHTSEL;
recurs_sel_seq(seq);
@@ -163,16 +163,16 @@ static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int
{
Editing *ed= seq_give_editing(scene, FALSE);
- if(deselect_all)
+ if (deselect_all)
deselect_all_seq(scene);
seq_active_set(scene, seq);
- if((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) {
- if(seq->strip)
+ if ((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) {
+ if (seq->strip)
BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR);
}
- else if(seq->type==SEQ_SOUND) {
- if(seq->strip)
+ else if (seq->type==SEQ_SOUND) {
+ if (seq->strip)
BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR);
}
seq->flag|= SELECT;
@@ -259,16 +259,16 @@ static int sequencer_de_select_all_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_select_all(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect All";
- ot->idname= "SEQUENCER_OT_select_all";
- ot->description="Select or deselect all strips";
+ ot->name = "(De)select All";
+ ot->idname = "SEQUENCER_OT_select_all";
+ ot->description = "Select or deselect all strips";
/* api callbacks */
- ot->exec= sequencer_de_select_all_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_de_select_all_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -281,7 +281,7 @@ static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
- for(seq= ed->seqbasep->first; seq; seq=seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq=seq->next) {
if (seq->flag & SELECT) {
seq->flag &= ~SEQ_ALLSEL;
}
@@ -299,16 +299,16 @@ static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Inverse";
- ot->idname= "SEQUENCER_OT_select_inverse";
- ot->description="Select unselected strips";
+ ot->name = "Select Inverse";
+ ot->idname = "SEQUENCER_OT_select_inverse";
+ ot->description = "Select unselected strips";
/* api callbacks */
- ot->exec= sequencer_select_inverse_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_select_inverse_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -325,7 +325,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
int hand,sel_side;
TimeMarker *marker;
- if(ed==NULL)
+ if (ed==NULL)
return OPERATOR_CANCELLED;
marker=find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now
@@ -333,7 +333,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
seq= find_nearest_seq(scene, v2d, &hand, event->mval);
// XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip
- if(seq && linked_time && left_right)
+ if (seq && linked_time && left_right)
left_right= FALSE;
@@ -352,7 +352,8 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
marker->flag |= SELECT;
}
- } else if (left_right) {
+ }
+ else if (left_right) {
/* use different logic for this */
float x;
deselect_all_seq(scene);
@@ -360,13 +361,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
SEQP_BEGIN(ed, seq) {
if (x < CFRA) {
- if(seq->enddisp < CFRA) {
+ if (seq->enddisp < CFRA) {
seq->flag |= SELECT;
recurs_sel_seq(seq);
}
}
else {
- if(seq->startdisp > CFRA) {
+ if (seq->startdisp > CFRA) {
seq->flag |= SELECT;
recurs_sel_seq(seq);
}
@@ -380,7 +381,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
TimeMarker *tmarker;
for (tmarker= scene->markers.first; tmarker; tmarker= tmarker->next) {
- if( ((x < CFRA) && tmarker->frame < CFRA) ||
+ if ( ((x < CFRA) && tmarker->frame < CFRA) ||
((x >= CFRA) && tmarker->frame >= CFRA)
) {
tmarker->flag |= SELECT;
@@ -391,29 +392,31 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
}
}
- } else {
+ }
+ else {
// seq= find_nearest_seq(scene, v2d, &hand, mval);
act_orig= ed->act_seq;
- if(extend == 0 && linked_handle==0)
+ if (extend == 0 && linked_handle==0)
deselect_all_seq(scene);
- if(seq) {
+ if (seq) {
seq_active_set(scene, seq);
if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) {
- if(seq->strip) {
+ if (seq->strip) {
BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR);
}
- } else
+ }
+ else
if (seq->type == SEQ_SOUND) {
- if(seq->strip) {
+ if (seq->strip) {
BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR);
}
}
- if(extend && (seq->flag & SELECT) && ed->act_seq == act_orig ) {
+ if (extend && (seq->flag & SELECT) && ed->act_seq == act_orig ) {
switch(hand) {
case SEQ_SIDE_NONE:
if (linked_handle==0)
@@ -429,13 +432,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
else {
seq->flag |= SELECT;
- if(hand==SEQ_SIDE_LEFT) seq->flag |= SEQ_LEFTSEL;
- if(hand==SEQ_SIDE_RIGHT) seq->flag |= SEQ_RIGHTSEL;
+ if (hand==SEQ_SIDE_LEFT) seq->flag |= SEQ_LEFTSEL;
+ if (hand==SEQ_SIDE_RIGHT) seq->flag |= SEQ_RIGHTSEL;
}
/* On Alt selection, select the strip and bordering handles */
if (linked_handle && !ELEM(hand, SEQ_SIDE_LEFT, SEQ_SIDE_RIGHT)) {
- if(extend==0) deselect_all_seq(scene);
+ if (extend==0) deselect_all_seq(scene);
seq->flag |= SELECT;
select_surrounding_handles(scene, seq);
}
@@ -451,12 +454,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
switch (sel_side) {
case SEQ_SIDE_LEFT:
if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) {
- if(extend==0) deselect_all_seq(scene);
+ if (extend==0) deselect_all_seq(scene);
seq->flag |= SELECT;
select_active_side(ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, seq->startdisp);
- } else {
- if(extend==0) deselect_all_seq(scene);
+ }
+ else {
+ if (extend==0) deselect_all_seq(scene);
seq->flag |= SELECT;
neighbor->flag |= SELECT;
@@ -467,12 +471,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
break;
case SEQ_SIDE_RIGHT:
if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) {
- if(extend==0) deselect_all_seq(scene);
+ if (extend==0) deselect_all_seq(scene);
seq->flag |= SELECT;
select_active_side(ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, seq->startdisp);
- } else {
- if(extend==0) deselect_all_seq(scene);
+ }
+ else {
+ if (extend==0) deselect_all_seq(scene);
seq->flag |= SELECT;
neighbor->flag |= SELECT;
@@ -482,14 +487,15 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
break;
}
- } else {
- if(extend==0) deselect_all_seq(scene);
+ }
+ else {
+ if (extend==0) deselect_all_seq(scene);
select_active_side(ed->seqbasep, sel_side, seq->machine, seq->startdisp);
}
}
recurs_sel_seq(seq);
- if(linked_time) {
+ if (linked_time) {
select_linked_time(ed->seqbasep, seq);
}
}
@@ -503,9 +509,9 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
xo= mval[0];
yo= mval[1];
- while(get_mbut()) {
+ while (get_mbut()) {
// getmouseco_areawin(mval);
- if(abs(mval[0]-xo)+abs(mval[1]-yo) > 4) {
+ if (abs(mval[0]-xo)+abs(mval[1]-yo) > 4) {
transform_markers('g', 0);
return;
}
@@ -522,21 +528,21 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
void SEQUENCER_OT_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Activate/Select";
- ot->idname= "SEQUENCER_OT_select";
- ot->description="Select a strip (last selected becomes the \"active strip\")";
+ ot->name = "Activate/Select";
+ ot->idname = "SEQUENCER_OT_select";
+ ot->description = "Select a strip (last selected becomes the \"active strip\")";
/* api callbacks */
- ot->invoke= sequencer_select_invoke;
- ot->poll= ED_operator_sequencer_active;
+ ot->invoke = sequencer_select_invoke;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
RNA_def_boolean(ot->srna, "linked_handle", 0, "Linked Handle", "Select handles next to the active strip");
- /* for animation this is an enum but atm having an enum isnt useful for us */
+ /* for animation this is an enum but atm having an enum isn't useful for us */
RNA_def_boolean(ot->srna, "left_right", 0, "Left/Right", "Select based on the current frame side the cursor is on");
RNA_def_boolean(ot->srna, "linked_time", 0, "Linked Time", "Select other strips at the same time");
}
@@ -552,25 +558,26 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked)
int change=0;
int isel;
- if(ed==NULL) return 0;
+ if (ed==NULL) return 0;
if (sel) {
sel = SELECT;
isel = 0;
- } else {
+ }
+ else {
sel = 0;
isel = SELECT;
}
if (!linked) {
/* if not linked we only want to touch each seq once, newseq */
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
seq->tmp = NULL;
}
}
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
- if((int)(seq->flag & SELECT) == sel) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if ((int)(seq->flag & SELECT) == sel) {
if ((linked==0 && seq->tmp)==0) {
/* only get unselected nabours */
neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, isel);
@@ -601,7 +608,7 @@ static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
- if(!select_more_less_seq__internal(scene, 0, 0))
+ if (!select_more_less_seq__internal(scene, 0, 0))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
@@ -612,16 +619,16 @@ static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_select_more(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select More";
- ot->idname= "SEQUENCER_OT_select_more";
- ot->description="Select more strips adjacent to the current selection";
+ ot->name = "Select More";
+ ot->idname = "SEQUENCER_OT_select_more";
+ ot->description = "Select more strips adjacent to the current selection";
/* api callbacks */
- ot->exec= sequencer_select_more_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_select_more_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
}
@@ -632,7 +639,7 @@ static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
- if(!select_more_less_seq__internal(scene, 1, 0))
+ if (!select_more_less_seq__internal(scene, 1, 0))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
@@ -643,16 +650,16 @@ static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_select_less(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Less";
- ot->idname= "SEQUENCER_OT_select_less";
- ot->description="Shrink the current selection of adjacent selected strips";
+ ot->name = "Select Less";
+ ot->idname = "SEQUENCER_OT_select_less";
+ ot->description = "Shrink the current selection of adjacent selected strips";
/* api callbacks */
- ot->exec= sequencer_select_less_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_select_less_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
}
@@ -693,16 +700,16 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv
void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select pick linked";
- ot->idname= "SEQUENCER_OT_select_linked_pick";
- ot->description="Select a chain of linked strips nearest to the mouse pointer";
+ ot->name = "Select pick linked";
+ ot->idname = "SEQUENCER_OT_select_linked_pick";
+ ot->description = "Select a chain of linked strips nearest to the mouse pointer";
/* api callbacks */
- ot->invoke= sequencer_select_linked_pick_invoke;
- ot->poll= ED_operator_sequencer_active;
+ ot->invoke = sequencer_select_linked_pick_invoke;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
@@ -728,16 +735,16 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select linked";
- ot->idname= "SEQUENCER_OT_select_linked";
- ot->description="Select all strips adjacent to the current selection";
+ ot->name = "Select linked";
+ ot->idname = "SEQUENCER_OT_select_linked";
+ ot->description = "Select all strips adjacent to the current selection";
/* api callbacks */
- ot->exec= sequencer_select_linked_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_select_linked_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
}
@@ -752,7 +759,7 @@ static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
int sel_side= RNA_enum_get(op->ptr, "side");
- for(seq= ed->seqbasep->first; seq; seq=seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq=seq->next) {
if (seq->flag & SELECT) {
switch(sel_side) {
case SEQ_SIDE_LEFT:
@@ -778,16 +785,16 @@ static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_select_handles(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Handles";
- ot->idname= "SEQUENCER_OT_select_handles";
- ot->description="Select manipulator handles on the sides of the selected strip";
+ ot->name = "Select Handles";
+ ot->idname = "SEQUENCER_OT_select_handles";
+ ot->description = "Select manipulator handles on the sides of the selected strip";
/* api callbacks */
- ot->exec= sequencer_select_handles_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_select_handles_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side of the handle that is selected");
@@ -815,16 +822,16 @@ static int sequencer_select_active_side_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_select_active_side(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Active Side";
- ot->idname= "SEQUENCER_OT_select_active_side";
- ot->description="Select strips on the nominated side of the active strip";
+ ot->name = "Select Active Side";
+ ot->idname = "SEQUENCER_OT_select_active_side";
+ ot->description = "Select strips on the nominated side of the active strip";
/* api callbacks */
- ot->exec= sequencer_select_active_side_exec;
- ot->poll= sequencer_edit_poll;
+ ot->exec = sequencer_select_active_side_exec;
+ ot->poll = sequencer_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side of the handle that is selected");
@@ -845,13 +852,13 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
int extend = RNA_boolean_get(op->ptr, "extend");
int mval[2];
- if(ed==NULL)
+ if (ed==NULL)
return OPERATOR_CANCELLED;
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
mval[0]= rect.xmin;
mval[1]= rect.ymin;
@@ -860,15 +867,15 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
mval[1]= rect.ymax;
UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
seq_rectf(seq, &rq);
- if(BLI_isect_rctf(&rq, &rectf, NULL)) {
- if(selecting) seq->flag |= SELECT;
+ if (BLI_isect_rctf(&rq, &rectf, NULL)) {
+ if (selecting) seq->flag |= SELECT;
else seq->flag &= ~SEQ_ALLSEL;
recurs_sel_seq(seq);
}
- else if(!extend) {
+ else if (!extend) {
seq->flag &= ~SEQ_ALLSEL;
recurs_sel_seq(seq);
}
@@ -884,20 +891,20 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Select";
- ot->idname= "SEQUENCER_OT_select_border";
- ot->description="Enable border select mode";
+ ot->name = "Border Select";
+ ot->idname = "SEQUENCER_OT_select_border";
+ ot->description = "Enable border select mode";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= sequencer_borderselect_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = sequencer_borderselect_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= ED_operator_sequencer_active;
+ ot->poll = ED_operator_sequencer_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, TRUE);
@@ -1025,9 +1032,9 @@ static short select_grouped_effect(Editing *ed, Sequence *actseq)
SEQP_BEGIN(ed, seq) {
if (effects[seq->type]) {
- if(seq->seq1) seq->seq1->flag |= SELECT;
- if(seq->seq2) seq->seq2->flag |= SELECT;
- if(seq->seq3) seq->seq3->flag |= SELECT;
+ if (seq->seq1) seq->seq1->flag |= SELECT;
+ if (seq->seq2) seq->seq2->flag |= SELECT;
+ if (seq->seq3) seq->seq3->flag |= SELECT;
changed = TRUE;
}
}
@@ -1069,7 +1076,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
actseq->tmp= SET_INT_IN_POINTER(TRUE);
- for(seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) {
+ for (seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) {
seq = iter.seq;
/* Ignore all seqs already selected! */
@@ -1133,13 +1140,13 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
SEQ_END;
}
- if(type==1) changed |= select_grouped_type(ed, actseq);
- else if(type==2) changed |= select_grouped_type_basic(ed, actseq);
- else if(type==3) changed |= select_grouped_type_effect(ed, actseq);
- else if(type==4) changed |= select_grouped_data(ed, actseq);
- else if(type==5) changed |= select_grouped_effect(ed, actseq);
- else if(type==6) changed |= select_grouped_effect_link(ed, actseq);
- else if(type==7) changed |= select_grouped_time_overlap(ed, actseq);
+ if (type==1) changed |= select_grouped_type(ed, actseq);
+ else if (type==2) changed |= select_grouped_type_basic(ed, actseq);
+ else if (type==3) changed |= select_grouped_type_effect(ed, actseq);
+ else if (type==4) changed |= select_grouped_data(ed, actseq);
+ else if (type==5) changed |= select_grouped_effect(ed, actseq);
+ else if (type==6) changed |= select_grouped_effect_link(ed, actseq);
+ else if (type==7) changed |= select_grouped_time_overlap(ed, actseq);
if (changed) {
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index e3e362c53a8..fe6ff40922e 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -65,13 +65,13 @@ ARegion *sequencer_has_buttons_region(ScrArea *sa)
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if(ar) return ar;
+ if (ar) return ar;
/* add subdiv level; after header */
ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if(ar==NULL) return NULL;
+ if (ar==NULL) return NULL;
arnew= MEM_callocN(sizeof(ARegion), "buttons for sequencer");
@@ -88,8 +88,8 @@ static ARegion *sequencer_find_region(ScrArea *sa, short type)
{
ARegion *ar=NULL;
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==type)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
+ if (ar->regiontype==type)
return ar;
return ar;
@@ -134,10 +134,10 @@ static SpaceLink *sequencer_new(const bContext *C)
ar->v2d.keepzoom= V2D_KEEPASPECT | V2D_KEEPZOOM;
ar->v2d.minzoom= 0.00001f;
ar->v2d.maxzoom= 100000.0f;
- ar->v2d.tot.xmin= -960.0f; /* 1920 width centered */
- ar->v2d.tot.ymin= -540.0f; /* 1080 height centered */
- ar->v2d.tot.xmax= 960.0f;
- ar->v2d.tot.ymax= 540.0f;
+ ar->v2d.tot.xmin = -960.0f; /* 1920 width centered */
+ ar->v2d.tot.ymin = -540.0f; /* 1080 height centered */
+ ar->v2d.tot.xmax = 960.0f;
+ ar->v2d.tot.ymax = 540.0f;
ar->v2d.min[0]= 0.0f;
ar->v2d.min[1]= 0.0f;
ar->v2d.max[0]= 12000.0f;
@@ -156,10 +156,10 @@ static SpaceLink *sequencer_new(const bContext *C)
/* seq space goes from (0,8) to (0, efra) */
- ar->v2d.tot.xmin= 0.0f;
- ar->v2d.tot.ymin= 0.0f;
- ar->v2d.tot.xmax= scene->r.efra;
- ar->v2d.tot.ymax= 8.0f;
+ ar->v2d.tot.xmin = 0.0f;
+ ar->v2d.tot.ymin = 0.0f;
+ ar->v2d.tot.xmax = scene->r.efra;
+ ar->v2d.tot.ymax = 8.0f;
ar->v2d.cur= ar->v2d.tot;
@@ -186,7 +186,7 @@ static void sequencer_free(SpaceLink *UNUSED(sl))
{
// SpaceSeq *sseq= (SpaceSequencer*) sl;
-// XXX if(sseq->gpd) free_gpencil_data(sseq->gpd);
+// XXX if (sseq->gpd) free_gpencil_data(sseq->gpd);
}
@@ -273,7 +273,7 @@ static void sequencer_refresh(const bContext *C, ScrArea *sa)
break;
}
- if(view_changed) {
+ if (view_changed) {
ED_area_initialize(wm, window, sa);
ED_area_tag_redraw(sa);
}
@@ -300,11 +300,11 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
- keymap= WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Sequencer", SPACE_SEQ, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Sequencer", SPACE_SEQ, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
/* add drop boxes */
@@ -326,24 +326,24 @@ static void sequencer_main_area_draw(const bContext *C, ARegion *ar)
static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if(drag->type==WM_DRAG_PATH)
- if(ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
+ if (drag->type==WM_DRAG_PATH)
+ if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
return 1;
return 0;
}
static int movie_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if(drag->type==WM_DRAG_PATH)
- if(ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
+ if (drag->type==WM_DRAG_PATH)
+ if (ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
return 1;
return 0;
}
static int sound_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if(drag->type==WM_DRAG_PATH)
- if(ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */
+ if (drag->type==WM_DRAG_PATH)
+ if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */
return 1;
return 0;
}
@@ -351,10 +351,10 @@ static int sound_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(ev
static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop)
{
/* copy drag path to properties */
- if(RNA_struct_find_property(drop->ptr, "filepath"))
+ if (RNA_struct_find_property(drop->ptr, "filepath"))
RNA_string_set(drop->ptr, "filepath", drag->path);
- if(RNA_struct_find_property(drop->ptr, "directory")) {
+ if (RNA_struct_find_property(drop->ptr, "directory")) {
PointerRNA itemptr;
char dir[FILE_MAX], file[FILE_MAX];
@@ -407,11 +407,11 @@ static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_SEQUENCER)
+ if (wmn->data == ND_SPACE_SEQUENCER)
ED_region_tag_redraw(ar);
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
}
@@ -424,11 +424,11 @@ static void sequencer_preview_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
- keymap= WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -443,15 +443,15 @@ static void sequencer_preview_area_draw(const bContext *C, ARegion *ar)
draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0);
- if(scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
+ if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
int over_cfra;
- if(scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
+ if (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
over_cfra= scene->ed->over_cfra;
else
over_cfra= scene->r.cfra + scene->ed->over_ofs;
- if(over_cfra != scene->r.cfra)
+ if (over_cfra != scene->r.cfra)
draw_image_seq(C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra);
}
@@ -471,7 +471,7 @@ static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_SEQUENCER)
+ if (wmn->data == ND_SPACE_SEQUENCER)
ED_region_tag_redraw(ar);
break;
case NC_ID:
@@ -512,11 +512,11 @@ static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_SEQUENCER)
+ if (wmn->data == ND_SPACE_SEQUENCER)
ED_region_tag_redraw(ar);
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
}
@@ -590,7 +590,7 @@ void ED_spacetype_sequencer(void)
BKE_spacetype_register(st);
/* set the sequencer callback when not in background mode */
- if(G.background==0) {
+ if (G.background==0) {
sequencer_view3d_cb = ED_view3d_draw_offscreen_imbuf_simple;
}
}
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index a416e9cf973..cc9ce10d017 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -129,7 +129,7 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn)
/* check if active text was changed, no need to redraw if text isn't active
* reference==NULL means text was unlinked, should update anyway for this
* case -- no way to know was text active before unlinking or not */
- if(wmn->reference && wmn->reference != st->text)
+ if (wmn->reference && wmn->reference != st->text)
break;
switch(wmn->data) {
@@ -137,7 +137,7 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
case ND_CURSOR:
- if(st->text && st->text == wmn->reference)
+ if (st->text && st->text == wmn->reference)
text_scroll_to_cursor(st, sa);
ED_area_tag_redraw(sa);
@@ -146,7 +146,7 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn)
switch(wmn->action) {
case NA_EDITED:
- if(st->text) {
+ if (st->text) {
text_drawcache_tag_update(st, 1);
text_update_edited(st->text);
}
@@ -158,7 +158,7 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
case NA_SELECTED:
- if(st->text && st->text == wmn->reference)
+ if (st->text && st->text == wmn->reference)
text_scroll_to_cursor(st, sa);
break;
@@ -166,7 +166,7 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn)
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_TEXT)
+ if (wmn->data == ND_SPACE_TEXT)
ED_area_tag_redraw(sa);
break;
}
@@ -235,7 +235,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
wmKeyMap *keymap;
wmKeyMapItem *kmi;
- keymap= WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0);
+ keymap = WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0);
#ifdef __APPLE__
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", LEFTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
@@ -298,7 +298,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "TEXT_OT_copy", INSERTKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "TEXT_OT_paste", INSERTKEY, KM_PRESS, KM_SHIFT, 0);
- if(U.uiflag & USER_MMB_PASTE) { // XXX not dynamic
+ if (U.uiflag & USER_MMB_PASTE) { // XXX not dynamic
kmi = WM_keymap_add_item(keymap, "TEXT_OT_paste", MIDDLEMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "selection", TRUE);
}
@@ -388,11 +388,11 @@ static int text_context(const bContext *C, const char *member, bContextDataResul
{
SpaceText *st= CTX_wm_space_text(C);
- if(CTX_data_dir(member)) {
+ if (CTX_data_dir(member)) {
CTX_data_dir_set(result, text_context_dir);
return 1;
}
- else if(CTX_data_equals(member, "edit_text")) {
+ else if (CTX_data_equals(member, "edit_text")) {
CTX_data_id_pointer_set(result, &st->text->id);
return 1;
}
@@ -411,7 +411,7 @@ static void text_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Text", SPACE_TEXT, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Text", SPACE_TEXT, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
/* add drop boxes */
@@ -452,8 +452,8 @@ static void text_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar))
static int text_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if(drag->type==WM_DRAG_PATH)
- if(ELEM(drag->icon, ICON_FILE_SCRIPT, ICON_FILE_BLANK)) /* rule might not work? */
+ if (drag->type==WM_DRAG_PATH)
+ if (ELEM(drag->icon, ICON_FILE_SCRIPT, ICON_FILE_BLANK)) /* rule might not work? */
return 1;
return 0;
}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index e9062b052e6..b2259aac035 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -111,7 +111,7 @@ static void flatten_string_append(FlattenString *fs, const char *c, int accum, i
{
int i;
- if(fs->pos+len > fs->len) {
+ if (fs->pos+len > fs->len) {
char *nbuf; int *naccum;
fs->len*= 2;
@@ -121,7 +121,7 @@ static void flatten_string_append(FlattenString *fs, const char *c, int accum, i
memcpy(nbuf, fs->buf, fs->pos * sizeof(*fs->buf));
memcpy(naccum, fs->accum, fs->pos * sizeof(*fs->accum));
- if(fs->buf != fs->fixedbuf) {
+ if (fs->buf != fs->fixedbuf) {
MEM_freeN(fs->buf);
MEM_freeN(fs->accum);
}
@@ -148,12 +148,12 @@ int flatten_string(SpaceText *st, FlattenString *fs, const char *in)
fs->accum= fs->fixedaccum;
fs->len = sizeof(fs->fixedbuf);
- for(r = 0, i = 0; *in; r++) {
- if(*in=='\t') {
+ for (r = 0, i = 0; *in; r++) {
+ if (*in=='\t') {
i= st->tabnumber - (total%st->tabnumber);
total+= i;
- while(i--)
+ while (i--)
flatten_string_append(fs, " ", r, 1);
in++;
@@ -173,9 +173,9 @@ int flatten_string(SpaceText *st, FlattenString *fs, const char *in)
void flatten_string_free(FlattenString *fs)
{
- if(fs->buf != fs->fixedbuf)
+ if (fs->buf != fs->fixedbuf)
MEM_freeN(fs->buf);
- if(fs->accum != fs->fixedaccum)
+ if (fs->accum != fs->fixedaccum)
MEM_freeN(fs->accum);
}
@@ -195,25 +195,25 @@ static int find_builtinfunc(char *string)
"is", "lambda", "not", "or", "pass", "print",
"raise", "return", "try", "while", "yield", "with"};
- for(a=0; a < sizeof(builtinfuncs)/sizeof(builtinfuncs[0]); a++) {
+ for (a=0; a < sizeof(builtinfuncs)/sizeof(builtinfuncs[0]); a++) {
i = 0;
- while(1) {
+ while (1) {
/* If we hit the end of a keyword... (eg. "def") */
- if(builtinfuncs[a][i]=='\0') {
+ if (builtinfuncs[a][i]=='\0') {
/* If we still have identifier chars in the source (eg. "definate") */
- if(text_check_identifier(string[i]))
+ if (text_check_identifier(string[i]))
i = -1; /* No match */
break; /* Next keyword if no match, otherwise we're done */
/* If chars mismatch, move on to next keyword */
}
- else if(string[i]!=builtinfuncs[a][i]) {
+ else if (string[i]!=builtinfuncs[a][i]) {
i = -1;
break; /* Break inner loop, start next keyword */
}
i++;
}
- if(i>0) break; /* If we have a match, we're done */
+ if (i>0) break; /* If we have a match, we're done */
}
return i;
}
@@ -229,22 +229,22 @@ static int find_specialvar(char *string)
{
int i = 0;
/* Check for "def" */
- if(string[0]=='d' && string[1]=='e' && string[2]=='f')
+ if (string[0]=='d' && string[1]=='e' && string[2]=='f')
i = 3;
/* Check for "class" */
- else if(string[0]=='c' && string[1]=='l' && string[2]=='a' && string[3]=='s' && string[4]=='s')
+ else if (string[0]=='c' && string[1]=='l' && string[2]=='a' && string[3]=='s' && string[4]=='s')
i = 5;
/* If next source char is an identifier (eg. 'i' in "definate") no match */
- if(i==0 || text_check_identifier(string[i]))
+ if (i==0 || text_check_identifier(string[i]))
return -1;
return i;
}
static int find_decorator(char *string)
{
- if(string[0] == '@') {
+ if (string[0] == '@') {
int i = 1;
- while(text_check_identifier(string[i])) {
+ while (text_check_identifier(string[i])) {
i++;
}
return i;
@@ -256,16 +256,16 @@ static int find_bool(char *string)
{
int i = 0;
/* Check for "False" */
- if(string[0]=='F' && string[1]=='a' && string[2]=='l' && string[3]=='s' && string[4]=='e')
+ if (string[0]=='F' && string[1]=='a' && string[2]=='l' && string[3]=='s' && string[4]=='e')
i = 5;
/* Check for "True" */
- else if(string[0]=='T' && string[1]=='r' && string[2]=='u' && string[3]=='e')
+ else if (string[0]=='T' && string[1]=='r' && string[2]=='u' && string[3]=='e')
i = 4;
/* Check for "None" */
- else if(string[0]=='N' && string[1]=='o' && string[2]=='n' && string[3]=='e')
+ else if (string[0]=='N' && string[1]=='o' && string[2]=='n' && string[3]=='e')
i = 4;
/* If next source char is an identifier (eg. 'i' in "definate") no match */
- if(i==0 || text_check_identifier(string[i]))
+ if (i==0 || text_check_identifier(string[i]))
return -1;
return i;
}
@@ -274,16 +274,16 @@ static int find_bool(char *string)
* as needed. Allocation is done here, alone, to ensure consistency. */
static int text_check_format_len(TextLine *line, unsigned int len)
{
- if(line->format) {
- if(strlen(line->format) < len) {
+ if (line->format) {
+ if (strlen(line->format) < len) {
MEM_freeN(line->format);
line->format = MEM_mallocN(len+2, "SyntaxFormat");
- if(!line->format) return 0;
+ if (!line->format) return 0;
}
}
else {
line->format = MEM_mallocN(len+2, "SyntaxFormat");
- if(!line->format) return 0;
+ if (!line->format) return 0;
}
return 1;
@@ -310,14 +310,14 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
int len, i;
/* Get continuation from previous line */
- if(line->prev && line->prev->format != NULL) {
+ if (line->prev && line->prev->format != NULL) {
fmt= line->prev->format;
cont = fmt[strlen(fmt)+1]; /* Just after the null-terminator */
}
else cont = 0;
/* Get original continuation from this line */
- if(line->format != NULL) {
+ if (line->format != NULL) {
fmt= line->format;
orig = fmt[strlen(fmt)+1]; /* Just after the null-terminator */
}
@@ -325,26 +325,26 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
len = flatten_string(st, &fs, line->line);
str = fs.buf;
- if(!text_check_format_len(line, len)) {
+ if (!text_check_format_len(line, len)) {
flatten_string_free(&fs);
return;
}
fmt = line->format;
- while(*str) {
+ while (*str) {
/* Handle escape sequences by skipping both \ and next char */
- if(*str == '\\') {
+ if (*str == '\\') {
*fmt = prev; fmt++; str++;
- if(*str == '\0') break;
+ if (*str == '\0') break;
*fmt = prev; fmt++; str += BLI_str_utf8_size(str);
continue;
}
/* Handle continuations */
- else if(cont) {
+ else if (cont) {
/* Triple strings ("""...""" or '''...''') */
- if(cont & TXT_TRISTR) {
+ if (cont & TXT_TRISTR) {
find = (cont & TXT_DBLQUOTSTR) ? '"' : '\'';
- if(*str==find && *(str+1)==find && *(str+2)==find) {
+ if (*str==find && *(str+1)==find && *(str+2)==find) {
*fmt = 'l'; fmt++; str++;
*fmt = 'l'; fmt++; str++;
cont = 0;
@@ -353,7 +353,7 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
}
else {
find = (cont & TXT_DBLQUOTSTR) ? '"' : '\'';
- if(*str == find) cont = 0;
+ if (*str == find) cont = 0;
}
*fmt = 'l';
@@ -362,14 +362,15 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
/* Not in a string... */
else {
/* Deal with comments first */
- if(prev == '#' || *str == '#') {
+ if (prev == '#' || *str == '#') {
*fmt = '#';
str += BLI_str_utf8_size(str) - 1;
- } else if(*str == '"' || *str == '\'') {
+ }
+ else if (*str == '"' || *str == '\'') {
/* Strings */
find = *str;
cont = (*str== '"') ? TXT_DBLQUOTSTR : TXT_SNGQUOTSTR;
- if(*(str+1) == find && *(str+2) == find) {
+ if (*(str+1) == find && *(str+2) == find) {
*fmt = 'l'; fmt++; str++;
*fmt = 'l'; fmt++; str++;
cont |= TXT_TRISTR;
@@ -377,15 +378,15 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
*fmt = 'l';
}
/* Whitespace (all ws. has been converted to spaces) */
- else if(*str == ' ')
+ else if (*str == ' ')
*fmt = '_';
/* Numbers (digits not part of an identifier and periods followed by digits) */
- else if((prev != 'q' && text_check_digit(*str)) || (*str == '.' && text_check_digit(*(str+1))))
+ else if ((prev != 'q' && text_check_digit(*str)) || (*str == '.' && text_check_digit(*(str+1))))
*fmt = 'n';
/* Booleans */
- else if(prev != 'q' && (i=find_bool(str)) != -1)
- if(i>0) {
- while(i>1) {
+ else if (prev != 'q' && (i=find_bool(str)) != -1)
+ if (i>0) {
+ while (i>1) {
*fmt = 'n'; fmt++; str++;
i--;
}
@@ -396,24 +397,24 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
*fmt = 'q';
}
/* Punctuation */
- else if(text_check_delim(*str))
+ else if (text_check_delim(*str))
*fmt = '!';
/* Identifiers and other text (no previous ws. or delims. so text continues) */
- else if(prev == 'q') {
+ else if (prev == 'q') {
str += BLI_str_utf8_size(str) - 1;
*fmt = 'q';
}
/* Not ws, a digit, punct, or continuing text. Must be new, check for special words */
else {
/* Special vars(v) or built-in keywords(b) */
- if((i=find_specialvar(str)) != -1)
+ if ((i=find_specialvar(str)) != -1)
prev = 'v';
- else if((i=find_builtinfunc(str)) != -1)
+ else if ((i=find_builtinfunc(str)) != -1)
prev = 'b';
- else if((i=find_decorator(str)) != -1)
+ else if ((i=find_decorator(str)) != -1)
prev = 'v'; /* could have a new color for this */
- if(i>0) {
- while(i>1) {
+ if (i>0) {
+ while (i>1) {
*fmt = prev; fmt++; str++;
i--;
}
@@ -435,7 +436,7 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
*fmt = cont;
/* If continuation has changed and we're allowed, process the next line */
- if(cont!=orig && do_next && line->next) {
+ if (cont!=orig && do_next && line->next) {
txt_format_line(st, line->next, do_next);
}
@@ -448,9 +449,9 @@ static void txt_format_text(SpaceText *st)
{
TextLine *linep;
- if(!st->text) return;
+ if (!st->text) return;
- for(linep=st->text->lines.first; linep; linep=linep->next)
+ for (linep=st->text->lines.first; linep; linep=linep->next)
txt_format_line(st, linep, 0);
}
#endif
@@ -532,27 +533,28 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *
*offl= *offc= 0;
- if(!st->text) return;
- if(!st->wordwrap) return;
+ if (!st->text) return;
+ if (!st->wordwrap) return;
text= st->text;
/* Move pointer to first visible line (top) */
linep= text->lines.first;
i= st->top;
- while(i>0 && linep) {
+ while (i>0 && linep) {
int lines= text_get_visible_lines(st, ar, linep->line);
/* Line before top */
- if(linep == linein) {
- if(lines <= i)
+ if (linep == linein) {
+ if (lines <= i)
/* no visible part of line */
return;
}
if (i-lines<0) {
break;
- } else {
+ }
+ else {
linep= linep->next;
(*offl)+= lines-1;
i-= lines;
@@ -562,28 +564,28 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *
max= wrap_width(st, ar);
cursin = txt_utf8_offset_to_index(linein->line, cursin);
- while(linep) {
+ while (linep) {
start= 0;
end= max;
chop= 1;
*offc= 0;
- for(i=0, j=0; linep->line[j]; j+=BLI_str_utf8_size(linep->line+j)) {
+ for (i=0, j=0; linep->line[j]; j+=BLI_str_utf8_size(linep->line+j)) {
int chars;
/* Mimic replacement of tabs */
ch= linep->line[j];
- if(ch=='\t') {
+ if (ch=='\t') {
chars= st->tabnumber-i%st->tabnumber;
- if(linep==linein && i<cursin) cursin += chars-1;
+ if (linep==linein && i<cursin) cursin += chars-1;
ch= ' ';
}
else {
chars= 1;
}
- while(chars--) {
- if(i-start>=max) {
- if(chop && linep==linein && i >= cursin) {
+ while (chars--) {
+ if (i-start>=max) {
+ if (chop && linep==linein && i >= cursin) {
if (i==cursin) {
(*offl)++;
*offc -= end-start;
@@ -599,16 +601,16 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *
end += max;
chop= 1;
}
- else if(ch==' ' || ch=='-') {
+ else if (ch==' ' || ch=='-') {
end = i+1;
chop= 0;
- if(linep==linein && i >= cursin)
+ if (linep==linein && i >= cursin)
return;
}
i++;
}
}
- if(linep==linein) break;
+ if (linep==linein) break;
linep= linep->next;
}
}
@@ -621,8 +623,8 @@ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursi
*offl= *offc= 0;
- if(!st->text) return;
- if(!st->wordwrap) return;
+ if (!st->text) return;
+ if (!st->wordwrap) return;
max= wrap_width(st, ar);
@@ -632,21 +634,21 @@ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursi
*offc= 0;
cursin = txt_utf8_offset_to_index(linein->line, cursin);
- for(i=0, j=0; linein->line[j]; j += BLI_str_utf8_size(linein->line + j)) {
+ for (i=0, j=0; linein->line[j]; j += BLI_str_utf8_size(linein->line + j)) {
/* Mimic replacement of tabs */
ch= linein->line[j];
- if(ch=='\t') {
+ if (ch=='\t') {
chars= st->tabnumber-i%st->tabnumber;
- if(i<cursin) cursin += chars-1;
+ if (i<cursin) cursin += chars-1;
ch= ' ';
}
else
chars= 1;
- while(chars--) {
- if(i-start>=max) {
- if(chop && i >= cursin) {
+ while (chars--) {
+ if (i-start>=max) {
+ if (chop && i >= cursin) {
if (i==cursin) {
(*offl)++;
*offc -= end-start;
@@ -662,10 +664,10 @@ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursi
end += max;
chop= 1;
}
- else if(ch==' ' || ch=='-') {
+ else if (ch==' ' || ch=='-') {
end = i+1;
chop= 0;
- if(i >= cursin)
+ if (i >= cursin)
return;
}
i++;
@@ -677,8 +679,8 @@ int text_get_char_pos(SpaceText *st, const char *line, int cur)
{
int a=0, i;
- for(i=0; i<cur && line[i]; i += BLI_str_utf8_size(line + i)) {
- if(line[i]=='\t')
+ for (i=0; i<cur && line[i]; i += BLI_str_utf8_size(line + i)) {
+ if (line[i]=='\t')
a += st->tabnumber-a%st->tabnumber;
else
a++;
@@ -704,17 +706,17 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w
flatten_string(st, &fs, str);
str= fs.buf;
max= w/st->cwidth;
- if(max<8) max= 8;
+ if (max<8) max= 8;
basex= x;
lines= 1;
start= 0; mstart= 0;
end= max; mend= txt_utf8_get_nth(str, max) - str;
- for(i=0, mi=0; str[mi]; i++, mi+=BLI_str_utf8_size(str+mi)) {
- if(i-start >= max) {
+ for (i=0, mi=0; str[mi]; i++, mi+=BLI_str_utf8_size(str+mi)) {
+ if (i-start >= max) {
/* skip hidden part of line */
- if(skip) {
+ if (skip) {
skip--;
start= end; mstart= mend;
end += max; mend= txt_utf8_get_nth(str+mend, max) - str;
@@ -722,8 +724,8 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w
}
/* Draw the visible portion of text on the overshot line */
- for(a=start, ma=mstart; a<end; a++, ma+=BLI_str_utf8_size(str+ma)) {
- if(st->showsyntax && format) format_draw_color(format[a]);
+ for (a=start, ma=mstart; a<end; a++, ma+=BLI_str_utf8_size(str+ma)) {
+ if (st->showsyntax && format) format_draw_color(format[a]);
x += text_font_draw_character_utf8(st, x, y, str + ma);
}
y -= st->lheight;
@@ -732,16 +734,16 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w
start= end; mstart= mend;
end += max; mend= txt_utf8_get_nth(str+mend, max) - str;
- if(y<=0) break;
+ if (y<=0) break;
}
- else if(str[mi]==' ' || str[mi]=='-') {
+ else if (str[mi]==' ' || str[mi]=='-') {
end = i+1; mend = mi+1;
}
}
/* Draw the remaining text */
- for(a=start, ma=mstart; str[ma] && y > 0; a++, ma+=BLI_str_utf8_size(str+ma)) {
- if(st->showsyntax && format)
+ for (a=start, ma=mstart; str[ma] && y > 0; a++, ma+=BLI_str_utf8_size(str+ma)) {
+ if (st->showsyntax && format)
format_draw_color(format[a]);
x += text_font_draw_character_utf8(st, x, y, str+ma);
@@ -759,7 +761,7 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra
const char *in;
int w= flatten_string(st, &fs, str);
- if(w < cshift) {
+ if (w < cshift) {
flatten_string_free(&fs);
return 0; /* String is shorter than shift */
}
@@ -768,14 +770,14 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra
acc= fs.accum+cshift;
w= w-cshift;
- if(draw) {
+ if (draw) {
int amount = maxwidth ? MIN2(w, maxwidth) : w;
- if(st->showsyntax && format) {
+ if (st->showsyntax && format) {
int a, str_shift= 0;
format = format+cshift;
- for(a = 0; a < amount; a++) {
+ for (a = 0; a < amount; a++) {
format_draw_color(format[a]);
x += text_font_draw_character_utf8(st, x, y, in + str_shift);
str_shift += BLI_str_utf8_size(in + str_shift);
@@ -784,15 +786,15 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra
else text_font_draw(st, x, y, in);
}
else {
- while(w-- && *acc++ < maxwidth)
+ while (w-- && *acc++ < maxwidth)
r+= st->cwidth;
}
flatten_string_free(&fs);
- if(cshift && r==0)
+ if (cshift && r==0)
return 0;
- else if(st->showlinenrs)
+ else if (st->showlinenrs)
return r+TXT_OFFSET+TEXTXLOC;
else
return r+TXT_OFFSET;
@@ -832,7 +834,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
int full_update= 0, nlines= 0;
Text *txt= st->text;
- if(!st->drawcache) text_drawcache_init(st);
+ if (!st->drawcache) text_drawcache_init(st);
text_update_character_width(st);
@@ -848,15 +850,15 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
full_update|= drawcache->cwidth != st->cwidth; /* word-wrapping option was toggled */
full_update|= strncmp(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */
- if(st->wordwrap) {
+ if (st->wordwrap) {
/* update line heights */
- if(full_update || !drawcache->line_height) {
+ if (full_update || !drawcache->line_height) {
drawcache->valid_head = 0;
drawcache->valid_tail = 0;
drawcache->update_flag = 1;
}
- if(drawcache->update_flag) {
+ if (drawcache->update_flag) {
TextLine *line= st->text->lines.first;
int lineno= 0, size, lines_count;
int *fp= drawcache->line_height, *new_tail, *old_tail;
@@ -864,7 +866,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
nlines= BLI_countlist(&txt->lines);
size= sizeof(int)*nlines;
- if(fp) fp= MEM_reallocN(fp, size);
+ if (fp) fp= MEM_reallocN(fp, size);
else fp= MEM_callocN(size, "text drawcache line_height");
drawcache->valid_tail= drawcache->valid_head= 0;
@@ -874,16 +876,18 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
drawcache->total_lines= 0;
- if(st->showlinenrs)
+ if (st->showlinenrs)
st->linenrs_tot= (int)floor(log10((float)nlines)) + 1;
- while(line) {
- if(drawcache->valid_head) { /* we're inside valid head lines */
+ while (line) {
+ if (drawcache->valid_head) { /* we're inside valid head lines */
lines_count= fp[lineno];
drawcache->valid_head--;
- } else if (lineno > new_tail - fp) { /* we-re inside valid tail lines */
+ }
+ else if (lineno > new_tail - fp) { /* we-re inside valid tail lines */
lines_count= fp[lineno];
- } else {
+ }
+ else {
lines_count= text_get_visible_lines(st, ar, line->line);
}
@@ -896,16 +900,17 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
drawcache->line_height= fp;
}
- } else {
- if(drawcache->line_height) {
+ }
+ else {
+ if (drawcache->line_height) {
MEM_freeN(drawcache->line_height);
drawcache->line_height= NULL;
}
- if(full_update || drawcache->update_flag) {
+ if (full_update || drawcache->update_flag) {
nlines= BLI_countlist(&txt->lines);
- if(st->showlinenrs)
+ if (st->showlinenrs)
st->linenrs_tot= (int)floor(log10((float)nlines)) + 1;
}
@@ -936,24 +941,25 @@ void text_drawcache_tag_update(SpaceText *st, int full)
if (st == NULL)
return;
- if(st->drawcache) {
+ if (st->drawcache) {
DrawCache *drawcache= (DrawCache *)st->drawcache;
Text *txt= st->text;
- if(drawcache->update_flag) {
+ if (drawcache->update_flag) {
/* happens when tagging update from space listener */
/* should do nothing to prevent locally tagged cache be fully recalculated */
return;
}
- if(!full) {
+ if (!full) {
int sellno= BLI_findindex(&txt->lines, txt->sell);
int curlno= BLI_findindex(&txt->lines, txt->curl);
- if(curlno < sellno) {
+ if (curlno < sellno) {
drawcache->valid_head= curlno;
drawcache->valid_tail= drawcache->nlines - sellno - 1;
- } else {
+ }
+ else {
drawcache->valid_head= sellno;
drawcache->valid_tail= drawcache->nlines - curlno - 1;
}
@@ -961,9 +967,10 @@ void text_drawcache_tag_update(SpaceText *st, int full)
/* quick cache recalculation is also used in delete operator,
* which could merge lines which are adjacent to current selection lines
* expand recalculate area to this lines */
- if(drawcache->valid_head>0) drawcache->valid_head--;
- if(drawcache->valid_tail>0) drawcache->valid_tail--;
- } else {
+ if (drawcache->valid_head>0) drawcache->valid_head--;
+ if (drawcache->valid_tail>0) drawcache->valid_tail--;
+ }
+ else {
drawcache->valid_head= 0;
drawcache->valid_tail= 0;
}
@@ -976,8 +983,8 @@ void text_free_caches(SpaceText *st)
{
DrawCache *drawcache= (DrawCache *)st->drawcache;
- if(drawcache) {
- if(drawcache->line_height)
+ if (drawcache) {
+ if (drawcache->line_height)
MEM_freeN(drawcache->line_height);
MEM_freeN(drawcache);
@@ -1003,22 +1010,22 @@ int text_get_visible_lines(SpaceText *st, ARegion *ar, const char *str)
lines= 1;
start= 0;
end= max;
- for(i= 0, j= 0; str[j]; j+=BLI_str_utf8_size(str+j)) {
+ for (i= 0, j= 0; str[j]; j+=BLI_str_utf8_size(str+j)) {
/* Mimic replacement of tabs */
ch= str[j];
- if(ch=='\t') {
+ if (ch=='\t') {
chars= st->tabnumber-i%st->tabnumber;
ch= ' ';
}
else chars= 1;
- while(chars--) {
- if(i-start >= max) {
+ while (chars--) {
+ if (i-start >= max) {
lines++;
start= end;
end += max;
}
- else if(ch==' ' || ch=='-') {
+ else if (ch==' ' || ch=='-') {
end= i+1;
}
@@ -1031,7 +1038,7 @@ int text_get_visible_lines(SpaceText *st, ARegion *ar, const char *str)
int text_get_span_wrap(SpaceText *st, ARegion *ar, TextLine *from, TextLine *to)
{
- if(st->wordwrap) {
+ if (st->wordwrap) {
int ret=0;
TextLine *tmp= from;
@@ -1043,7 +1050,8 @@ int text_get_span_wrap(SpaceText *st, ARegion *ar, TextLine *from, TextLine *to)
}
return ret;
- } else return txt_get_span(from, to);
+ }
+ else return txt_get_span(from, to);
}
int text_get_total_lines(SpaceText *st, ARegion *ar)
@@ -1065,23 +1073,25 @@ static TextLine *first_visible_line(SpaceText *st, ARegion *ar, int *wrap_top)
text_update_drawcache(st, ar);
- if(wrap_top) *wrap_top= 0;
+ if (wrap_top) *wrap_top= 0;
- if(st->wordwrap) {
- while(i>0 && pline) {
+ if (st->wordwrap) {
+ while (i>0 && pline) {
int lines= text_get_visible_lines_no(st, lineno);
if (i-lines<0) {
- if(wrap_top) *wrap_top= i;
+ if (wrap_top) *wrap_top= i;
break;
- } else {
+ }
+ else {
pline= pline->next;
i-= lines;
lineno++;
}
}
- } else {
- for(i=st->top; pline->next && i>0; i--)
+ }
+ else {
+ for (i=st->top; pline->next && i>0; i--)
pline= pline->next;
}
@@ -1103,18 +1113,18 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
blank_lines = st->viewlines / 2;
/* nicer code: use scroll rect for entire bar */
- back->xmin= ar->winx -18;
- back->xmax= ar->winx;
- back->ymin= 0;
- back->ymax= ar->winy;
+ back->xmin = ar->winx -18;
+ back->xmax = ar->winx;
+ back->ymin = 0;
+ back->ymax = ar->winy;
- scroll->xmin= ar->winx - 17;
- scroll->xmax= ar->winx - 5;
- scroll->ymin= 4;
- scroll->ymax= 4+pix_available;
+ scroll->xmin = ar->winx - 17;
+ scroll->xmax = ar->winx - 5;
+ scroll->ymin = 4;
+ scroll->ymax = 4+pix_available;
/* when re-sizing a view-port with the bar at the bottom to a greater height more blank lines will be added */
- if(ltexth + blank_lines < st->top + st->viewlines) {
+ if (ltexth + blank_lines < st->top + st->viewlines) {
blank_lines = st->top + st->viewlines - ltexth;
}
@@ -1122,7 +1132,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
barheight = (ltexth > 0)? (st->viewlines*pix_available)/ltexth: 0;
pix_bardiff = 0;
- if(barheight < 20) {
+ if (barheight < 20) {
pix_bardiff = 20 - barheight; /* take into account the now non-linear sizing of the bar */
barheight = 20;
}
@@ -1136,52 +1146,52 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
CLAMP(st->txtbar.ymax, pix_bottom_margin, ar->winy - pix_top_margin);
st->pix_per_line= (pix_available > 0)? (float) ltexth/pix_available: 0;
- if(st->pix_per_line < 0.1f) st->pix_per_line=0.1f;
+ if (st->pix_per_line < 0.1f) st->pix_per_line=0.1f;
curl_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->curl);
sell_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->sell);
lhlstart = MIN2(curl_off, sell_off);
lhlend = MAX2(curl_off, sell_off);
- if(ltexth > 0) {
+ if (ltexth > 0) {
hlstart = (lhlstart * pix_available)/ltexth;
hlend = (lhlend * pix_available)/ltexth;
/* the scrollbar is non-linear sized */
- if(pix_bardiff > 0) {
+ if (pix_bardiff > 0) {
/* the start of the highlight is in the current viewport */
- if(ltexth && st->viewlines && lhlstart >= st->top && lhlstart <= st->top + st->viewlines) {
+ if (ltexth && st->viewlines && lhlstart >= st->top && lhlstart <= st->top + st->viewlines) {
/* speed the progresion of the start of the highlight through the scrollbar */
hlstart = ( ( (pix_available - pix_bardiff) * lhlstart) / ltexth) + (pix_bardiff * (lhlstart - st->top) / st->viewlines);
}
- else if(lhlstart > st->top + st->viewlines && hlstart < barstart + barheight && hlstart > barstart) {
+ else if (lhlstart > st->top + st->viewlines && hlstart < barstart + barheight && hlstart > barstart) {
/* push hl start down */
hlstart = barstart + barheight;
}
- else if(lhlend > st->top && lhlstart < st->top && hlstart > barstart) {
+ else if (lhlend > st->top && lhlstart < st->top && hlstart > barstart) {
/*fill out start */
hlstart = barstart;
}
- if(hlend <= hlstart) {
+ if (hlend <= hlstart) {
hlend = hlstart + 2;
}
/* the end of the highlight is in the current viewport */
- if(ltexth && st->viewlines && lhlend >= st->top && lhlend <= st->top + st->viewlines) {
+ if (ltexth && st->viewlines && lhlend >= st->top && lhlend <= st->top + st->viewlines) {
/* speed the progresion of the end of the highlight through the scrollbar */
hlend = (((pix_available - pix_bardiff )*lhlend)/ltexth) + (pix_bardiff * (lhlend - st->top)/st->viewlines);
}
- else if(lhlend < st->top && hlend >= barstart - 2 && hlend < barstart + barheight) {
+ else if (lhlend < st->top && hlend >= barstart - 2 && hlend < barstart + barheight) {
/* push hl end up */
hlend = barstart;
}
- else if(lhlend > st->top + st->viewlines && lhlstart < st->top + st->viewlines && hlend < barstart + barheight) {
+ else if (lhlend > st->top + st->viewlines && lhlstart < st->top + st->viewlines && hlend < barstart + barheight) {
/* fill out end */
hlend = barstart + barheight;
}
- if(hlend <= hlstart) {
+ if (hlend <= hlstart) {
hlstart = hlend - 2;
}
}
@@ -1191,13 +1201,13 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
hlend = 0;
}
- if(hlend - hlstart < 2) {
+ if (hlend - hlstart < 2) {
hlend = hlstart + 2;
}
st->txtscroll= *scroll;
- st->txtscroll.ymax= ar->winy - pix_top_margin - hlstart;
- st->txtscroll.ymin= ar->winy - pix_top_margin - hlend;
+ st->txtscroll.ymax = ar->winy - pix_top_margin - hlstart;
+ st->txtscroll.ymin = ar->winy - pix_top_margin - hlend;
CLAMP(st->txtscroll.ymin, pix_bottom_margin, ar->winy - pix_top_margin);
CLAMP(st->txtscroll.ymax, pix_bottom_margin, ar->winy - pix_top_margin);
@@ -1241,16 +1251,16 @@ static void draw_markers(SpaceText *st, ARegion *ar)
topy= txt_get_span(text->lines.first, top);
- for(marker= text->markers.first; marker; marker= next) {
+ for (marker= text->markers.first; marker; marker= next) {
next= marker->next;
/* invisible line (before top) */
- if(marker->lineno<topi) continue;
+ if (marker->lineno<topi) continue;
line= BLI_findlink(&text->lines, marker->lineno);
/* Remove broken markers */
- if(marker->end>line->len || marker->start>marker->end) {
+ if (marker->end>line->len || marker->start>marker->end) {
BLI_freelinkN(&text->markers, marker);
continue;
}
@@ -1264,13 +1274,13 @@ static void draw_markers(SpaceText *st, ARegion *ar)
x2 = text_get_char_pos(st, line->line, marker->end) - st->left + offc;
/* invisible part of line (before top, after last visible line) */
- if(y2 < 0 || y1 > st->top+st->viewlines) continue;
+ if (y2 < 0 || y1 > st->top+st->viewlines) continue;
glColor3ubv(marker->color);
x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
y= ar->winy-3;
- if(y1==y2) {
+ if (y1==y2) {
y -= y1*st->lheight;
glBegin(GL_LINE_LOOP);
glVertex2i(x+x2*st->cwidth+1, y);
@@ -1289,7 +1299,7 @@ static void draw_markers(SpaceText *st, ARegion *ar)
glEnd();
y-=st->lheight;
- for(i=y1+1; i<y2; i++) {
+ for (i=y1+1; i<y2; i++) {
glBegin(GL_LINES);
glVertex2i(x, y);
glVertex2i(ar->winx, y);
@@ -1318,24 +1328,24 @@ static void draw_documentation(SpaceText *st, ARegion *ar)
int i, br, lines;
int boxw, boxh, l, x, y /* , top */ /* UNUSED */;
- if(!st || !st->text) return;
- if(!texttool_text_is_active(st->text)) return;
+ if (!st || !st->text) return;
+ if (!texttool_text_is_active(st->text)) return;
docs = texttool_docs_get();
- if(!docs) return;
+ if (!docs) return;
/* Count the visible lines to the cursor */
- for(tmp=st->text->curl, l=-st->top; tmp; tmp=tmp->prev, l++);
- if(l<0) return;
+ for (tmp=st->text->curl, l=-st->top; tmp; tmp=tmp->prev, l++);
+ if (l<0) return;
- if(st->showlinenrs) {
+ if (st->showlinenrs) {
x= st->cwidth*(st->text->curc-st->left) + TXT_OFFSET + TEXTXLOC - 4;
}
else {
x= st->cwidth*(st->text->curc-st->left) + TXT_OFFSET - 4;
}
- if(texttool_suggest_first()) {
+ if (texttool_suggest_first()) {
x += SUGG_LIST_WIDTH*st->cwidth + 50;
}
@@ -1366,32 +1376,32 @@ static void draw_documentation(SpaceText *st, ARegion *ar)
UI_ThemeColor(TH_TEXT);
i= 0; br= DOC_WIDTH; lines= 0; // XXX -doc_scroll;
- for(p=docs; *p; p++) {
- if(*p == '\r' && *(++p) != '\n') *(--p)= '\n'; /* Fix line endings */
- if(*p == ' ' || *p == '\t')
+ for (p=docs; *p; p++) {
+ if (*p == '\r' && *(++p) != '\n') *(--p)= '\n'; /* Fix line endings */
+ if (*p == ' ' || *p == '\t')
br= i;
- else if(*p == '\n') {
+ else if (*p == '\n') {
buf[i]= '\0';
- if(lines>=0) {
+ if (lines>=0) {
y -= st->lheight;
text_draw(st, buf, 0, 0, 1, x+4, y-3, NULL);
}
i= 0; br= DOC_WIDTH; lines++;
}
buf[i++]= *p;
- if(i == DOC_WIDTH) { /* Reached the width, go to last break and wrap there */
+ if (i == DOC_WIDTH) { /* Reached the width, go to last break and wrap there */
buf[br]= '\0';
- if(lines>=0) {
+ if (lines>=0) {
y -= st->lheight;
text_draw(st, buf, 0, 0, 1, x+4, y-3, NULL);
}
p -= i-br-1; /* Rewind pointer to last break */
i= 0; br= DOC_WIDTH; lines++;
}
- if(lines >= DOC_HEIGHT) break;
+ if (lines >= DOC_HEIGHT) break;
}
- if(0 /* XXX doc_scroll*/ > 0 && lines < DOC_HEIGHT) {
+ if (0 /* XXX doc_scroll*/ > 0 && lines < DOC_HEIGHT) {
// XXX doc_scroll--;
draw_documentation(st, ar);
}
@@ -1406,23 +1416,23 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar)
char str[SUGG_LIST_WIDTH+1];
int w, boxw=0, boxh, i, l, x, y, b, *top;
- if(!st || !st->text) return;
- if(!texttool_text_is_active(st->text)) return;
+ if (!st || !st->text) return;
+ if (!texttool_text_is_active(st->text)) return;
first = texttool_suggest_first();
last = texttool_suggest_last();
- if(!first || !last) return;
+ if (!first || !last) return;
text_pop_suggest_list();
sel = texttool_suggest_selected();
top = texttool_suggest_top();
/* Count the visible lines to the cursor */
- for(tmp=st->text->curl, l=-st->top; tmp; tmp=tmp->prev, l++);
- if(l<0) return;
+ for (tmp=st->text->curl, l=-st->top; tmp; tmp=tmp->prev, l++);
+ if (l<0) return;
- if(st->showlinenrs) {
+ if (st->showlinenrs) {
x = st->cwidth*(st->text->curc-st->left) + TXT_OFFSET + TEXTXLOC - 4;
}
else {
@@ -1439,9 +1449,9 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar)
glRecti(x, y, x+boxw, y-boxh);
/* Set the top 'item' of the visible list */
- for(i=0, item=first; i<*top && item->next; i++, item=item->next);
+ for (i=0, item=first; i<*top && item->next; i++, item=item->next);
- for(i=0; i<SUGG_LIST_SIZE && item; i++, item=item->next) {
+ for (i=0; i<SUGG_LIST_SIZE && item; i++, item=item->next) {
y -= st->lheight;
@@ -1449,7 +1459,7 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar)
w = BLF_width(mono, str);
- if(item == sel) {
+ if (item == sel) {
UI_ThemeColor(TH_SHADE2);
glRecti(x+16, y-3, x+16+w, y+st->lheight-3);
}
@@ -1461,13 +1471,13 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar)
case 'v': UI_ThemeColor(TH_SYNTAX_N); break;
case '?': UI_ThemeColor(TH_TEXT); b=0; break;
}
- if(b) {
+ if (b) {
glRecti(x+8, y+2, x+11, y+5);
UI_ThemeColor(TH_TEXT);
}
text_draw(st, str, 0, 0, 1, x+16, y-1, NULL);
- if(item == last) break;
+ if (item == last) break;
}
}
@@ -1480,7 +1490,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
int x, y, w, i;
/* Draw the selection */
- if(text->curl!=text->sell || text->curc!=text->selc) {
+ if (text->curl!=text->sell || text->curc!=text->selc) {
int offl, offc;
/* Convert all to view space character coordinates */
wrap_offset(st, ar, text->curl, text->curc, &offl, &offc);
@@ -1490,16 +1500,16 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl;
vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc;
- if(vcurc<0) vcurc=0;
- if(vselc<0) vselc=0, hidden=1;
+ if (vcurc<0) vcurc=0;
+ if (vselc<0) vselc=0, hidden=1;
UI_ThemeColor(TH_SHADE2);
x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
y= ar->winy-2;
- if(vcurl==vsell) {
+ if (vcurl==vsell) {
y -= vcurl*st->lheight;
- if(vcurc < vselc)
+ if (vcurc < vselc)
glRecti(x+vcurc*st->cwidth-1, y, x+vselc*st->cwidth, y-st->lheight);
else
glRecti(x+vselc*st->cwidth-1, y, x+vcurc*st->cwidth, y-st->lheight);
@@ -1507,7 +1517,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
else {
int froml, fromc, tol, toc;
- if(vcurl < vsell) {
+ if (vcurl < vsell) {
froml= vcurl; tol= vsell;
fromc= vcurc; toc= vselc;
}
@@ -1518,7 +1528,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
y -= froml*st->lheight;
glRecti(x+fromc*st->cwidth-1, y, ar->winx, y-st->lheight); y-=st->lheight;
- for(i=froml+1; i<tol; i++)
+ for (i=froml+1; i<tol; i++)
glRecti(x-4, y, ar->winx, y-st->lheight), y-=st->lheight;
glRecti(x-4, y, x+toc*st->cwidth, y-st->lheight); y-=st->lheight;
@@ -1530,16 +1540,16 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl;
vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc;
- if(vselc<0) {
+ if (vselc<0) {
vselc= 0;
hidden= 1;
}
}
- if(st->line_hlight) {
+ if (st->line_hlight) {
int x1, x2, y1, y2;
- if(st->wordwrap) {
+ if (st->wordwrap) {
int visible_lines = text_get_visible_lines(st, ar, text->sell->line);
int offl, offc;
@@ -1547,12 +1557,13 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
y1= ar->winy-2 - (vsell-offl)*st->lheight;
y2= y1-st->lheight*visible_lines+1;
- } else {
+ }
+ else {
y1= ar->winy-2 - vsell*st->lheight;
y2= y1-st->lheight+1;
}
- if(!(y1<0 || y2 > ar->winy)) { /* check we need to draw */
+ if (!(y1<0 || y2 > ar->winy)) { /* check we need to draw */
x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
x2= x1 + ar->winx;
@@ -1565,17 +1576,17 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
}
}
- if(!hidden) {
+ if (!hidden) {
/* Draw the cursor itself (we draw the sel. cursor as this is the leading edge) */
x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
x += vselc*st->cwidth;
y= ar->winy-2 - vsell*st->lheight;
- if(st->overwrite) {
+ if (st->overwrite) {
char ch= text->sell->line[text->selc];
w= st->cwidth;
- if(ch=='\t') w*= st->tabnumber-(vselc+st->left)%st->tabnumber;
+ if (ch=='\t') w*= st->tabnumber-(vselc+st->left)%st->tabnumber;
UI_ThemeColor(TH_HILITE);
glRecti(x, y-st->lheight-1, x+w, y-st->lheight+1);
@@ -1599,13 +1610,13 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
char ch;
// showsyntax must be on or else the format string will be null
- if(!text->curl || !st->showsyntax) return;
+ if (!text->curl || !st->showsyntax) return;
startl= text->curl;
startc= text->curc;
b= text_check_bracket(startl->line[startc]);
- if(b==0 && startc>0) b = text_check_bracket(startl->line[--startc]);
- if(b==0) return;
+ if (b==0 && startc>0) b = text_check_bracket(startl->line[--startc]);
+ if (b==0) return;
linep= startl;
c= startc;
@@ -1615,34 +1626,34 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
find= -b;
stack= 0;
- /* Dont highlight backets if syntax HL is off or bracket in string or comment. */
- if(!linep->format || linep->format[fc] == 'l' || linep->format[fc] == '#')
+ /* Don't highlight backets if syntax HL is off or bracket in string or comment. */
+ if (!linep->format || linep->format[fc] == 'l' || linep->format[fc] == '#')
return;
- if(b>0) {
+ if (b>0) {
/* opening bracket, search forward for close */
fc++;
c+= BLI_str_utf8_size(linep->line+c);
- while(linep) {
- while(c<linep->len) {
- if(linep->format && linep->format[fc] != 'l' && linep->format[fc] != '#') {
+ while (linep) {
+ while (c<linep->len) {
+ if (linep->format && linep->format[fc] != 'l' && linep->format[fc] != '#') {
b= text_check_bracket(linep->line[c]);
- if(b==find) {
- if(stack==0) {
+ if (b==find) {
+ if (stack==0) {
endl= linep;
endc= c;
break;
}
stack--;
}
- else if(b==-find) {
+ else if (b==-find) {
stack++;
}
}
fc++;
c+= BLI_str_utf8_size(linep->line+c);
}
- if(endl) break;
+ if (endl) break;
linep= linep->next;
c= 0;
fc= 0;
@@ -1652,28 +1663,28 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
/* closing bracket, search backward for open */
fc--;
if (c>0) c -= linep->line+c-BLI_str_prev_char_utf8(linep->line+c);
- while(linep) {
- while(fc>=0) {
- if(linep->format && linep->format[fc] != 'l' && linep->format[fc] != '#') {
+ while (linep) {
+ while (fc>=0) {
+ if (linep->format && linep->format[fc] != 'l' && linep->format[fc] != '#') {
b= text_check_bracket(linep->line[c]);
- if(b==find) {
- if(stack==0) {
+ if (b==find) {
+ if (stack==0) {
endl= linep;
endc= c;
break;
}
stack--;
}
- else if(b==-find) {
+ else if (b==-find) {
stack++;
}
}
fc--;
if (c>0) c -= linep->line+c-BLI_str_prev_char_utf8(linep->line+c);
}
- if(endl) break;
+ if (endl) break;
linep= linep->prev;
- if(linep) {
+ if (linep) {
if (linep->format) fc= strlen(linep->format)-1;
else fc= -1;
if (linep->len) c= BLI_str_prev_char_utf8(linep->line+linep->len)-linep->line;
@@ -1682,7 +1693,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
}
}
- if(!endl || endc==-1)
+ if (!endl || endc==-1)
return;
UI_ThemeColor(TH_HILITE);
@@ -1694,7 +1705,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
wrap_offset(st, ar, startl, startc, &offl, &offc);
viewc= text_get_char_pos(st, startl->line, startc) - st->left + offc;
- if(viewc >= 0){
+ if (viewc >= 0) {
viewl= txt_get_span(text->lines.first, startl) - st->top + offl;
text_font_draw_character(st, x+viewc*st->cwidth, y-viewl*st->lheight, ch);
@@ -1706,7 +1717,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
wrap_offset(st, ar, endl, endc, &offl, &offc);
viewc= text_get_char_pos(st, endl->line, endc) - st->left + offc;
- if(viewc >= 0) {
+ if (viewc >= 0) {
viewl= txt_get_span(text->lines.first, endl) - st->top + offl;
text_font_draw_character(st, x+viewc*st->cwidth, y-viewl*st->lheight, ch);
@@ -1725,17 +1736,17 @@ void draw_text_main(SpaceText *st, ARegion *ar)
int i, x, y, winx, linecount= 0, lineno= 0;
int wraplinecount= 0, wrap_skip= 0;
- if(st->lheight) st->viewlines= (int)ar->winy/st->lheight;
+ if (st->lheight) st->viewlines= (int)ar->winy/st->lheight;
else st->viewlines= 0;
/* if no text, nothing to do */
- if(!text)
+ if (!text)
return;
text_update_drawcache(st, ar);
/* make sure all the positional pointers exist */
- if(!text->curl || !text->sell || !text->lines.first || !text->lines.last)
+ if (!text->curl || !text->sell || !text->lines.first || !text->lines.last)
txt_clean_text(text);
/* update rects for scroll */
@@ -1744,22 +1755,24 @@ void draw_text_main(SpaceText *st, ARegion *ar)
/* update syntax formatting if needed */
tmp= text->lines.first;
lineno= 0;
- for(i= 0; i<st->top && tmp; i++) {
- if(st->showsyntax && !tmp->format)
+ for (i= 0; i<st->top && tmp; i++) {
+ if (st->showsyntax && !tmp->format)
txt_format_line(st, tmp, 0);
- if(st->wordwrap) {
+ if (st->wordwrap) {
int lines= text_get_visible_lines_no(st, lineno);
if (wraplinecount+lines>st->top) {
wrap_skip= st->top-wraplinecount;
break;
- } else {
+ }
+ else {
wraplinecount+= lines;
tmp= tmp->next;
linecount++;
}
- } else {
+ }
+ else {
tmp= tmp->next;
linecount++;
}
@@ -1772,7 +1785,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
st->cwidth= MAX2(st->cwidth, 1);
/* draw line numbers background */
- if(st->showlinenrs) {
+ if (st->showlinenrs) {
x= TXT_OFFSET + TEXTXLOC;
UI_ThemeColor(TH_GRID);
@@ -1791,13 +1804,13 @@ void draw_text_main(SpaceText *st, ARegion *ar)
/* draw the text */
UI_ThemeColor(TH_TEXT);
- for(i=0; y>0 && i<st->viewlines && tmp; i++, tmp= tmp->next) {
- if(st->showsyntax && !tmp->format)
+ for (i=0; y>0 && i<st->viewlines && tmp; i++, tmp= tmp->next) {
+ if (st->showsyntax && !tmp->format)
txt_format_line(st, tmp, 0);
- if(st->showlinenrs && !wrap_skip) {
+ if (st->showlinenrs && !wrap_skip) {
/* draw line number */
- if(tmp == text->curl)
+ if (tmp == text->curl)
UI_ThemeColor(TH_HILITE);
else
UI_ThemeColor(TH_TEXT);
@@ -1809,7 +1822,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
UI_ThemeColor(TH_TEXT);
}
- if(st->wordwrap) {
+ if (st->wordwrap) {
/* draw word wrapped text */
int lines = text_draw_wrapped(st, tmp->line, x, y, winx-x, tmp->format, wrap_skip);
y -= lines*st->lheight;
@@ -1823,7 +1836,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
wrap_skip= 0;
}
- if(st->flags&ST_SHOW_MARGIN) {
+ if (st->flags&ST_SHOW_MARGIN) {
UI_ThemeColor(TH_HILITE);
glBegin(GL_LINES);
@@ -1854,19 +1867,19 @@ void text_update_character_width(SpaceText *st)
}
/* Moves the view to the cursor location,
- * also used to make sure the view isnt outside the file */
+ * also used to make sure the view isn't outside the file */
void text_scroll_to_cursor(SpaceText *st, ScrArea *sa)
{
Text *text;
ARegion *ar= NULL;
int i, x, winx= 0;
- if(ELEM3(NULL, st, st->text, st->text->curl)) return;
+ if (ELEM3(NULL, st, st->text, st->text->curl)) return;
text= st->text;
- for(ar=sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_WINDOW) {
+ for (ar=sa->regionbase.first; ar; ar= ar->next)
+ if (ar->regiontype==RGN_TYPE_WINDOW) {
winx= ar->winx;
break;
}
@@ -1876,27 +1889,27 @@ void text_scroll_to_cursor(SpaceText *st, ScrArea *sa)
text_update_character_width(st);
i= txt_get_span(text->lines.first, text->sell);
- if(st->wordwrap) {
+ if (st->wordwrap) {
int offl, offc;
wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
i+= offl;
}
- if(st->top+st->viewlines <= i || st->top > i)
+ if (st->top+st->viewlines <= i || st->top > i)
st->top= i - st->viewlines/2;
- if(st->wordwrap) {
+ if (st->wordwrap) {
st->left= 0;
}
else {
x= text_draw(st, text->sell->line, st->left, text->selc, 0, 0, 0, NULL);
- if(x==0 || x>winx)
+ if (x==0 || x>winx)
st->left= text->curc-0.5*winx/st->cwidth;
}
- if(st->top < 0) st->top= 0;
- if(st->left <0) st->left= 0;
+ if (st->top < 0) st->top= 0;
+ if (st->left <0) st->left= 0;
}
void text_update_cursor_moved(bContext *C)
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index b8e53f752e2..f4f92ac8db3 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -79,13 +79,13 @@ static ARegion *text_has_properties_region(ScrArea *sa)
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if(ar) return ar;
+ if (ar) return ar;
/* add subdiv level; after header */
ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if(ar==NULL) return NULL;
+ if (ar==NULL) return NULL;
arnew= MEM_callocN(sizeof(ARegion), "properties region");
@@ -108,7 +108,7 @@ static int text_properties_exec(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= text_has_properties_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -117,13 +117,13 @@ static int text_properties_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_properties(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Properties";
- ot->description= "Toggle text properties panel";
- ot->idname= "TEXT_OT_properties";
+ ot->name = "Properties";
+ ot->description = "Toggle text properties panel";
+ ot->idname = "TEXT_OT_properties";
/* api callbacks */
- ot->exec= text_properties_exec;
- ot->poll= text_properties_poll;
+ ot->exec = text_properties_exec;
+ ot->poll = text_properties_poll;
}
/******************** XXX popup menus *******************/
@@ -134,9 +134,9 @@ void TEXT_OT_properties(wmOperatorType *ot)
uiPopupMenu *pup;
- if(text) {
+ if (text) {
pup= uiPupMenuBegin(C, "Text", ICON_NONE);
- if(txt_has_sel(text)) {
+ if (txt_has_sel(text)) {
uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_cut");
uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_copy");
}
@@ -173,7 +173,7 @@ void TEXT_OT_properties(wmOperatorType *ot)
uiPopupMenu *pup;
- if(text) {
+ if (text) {
pup= uiPupMenuBegin(C, "Text", ICON_NONE);
uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_new");
uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_open");
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 17857275d36..de26fa1f8ca 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -74,7 +74,7 @@
/************************ poll ***************************/
-BM_INLINE int text_pixel_x_to_index(SpaceText *st, const int x)
+BLI_INLINE int text_pixel_x_to_index(SpaceText *st, const int x)
{
/* add half the char width so mouse cursor selection is inbetween letters */
return (x + (st->cwidth / 2)) / st->cwidth;
@@ -89,10 +89,10 @@ static int text_edit_poll(bContext *C)
{
Text *text= CTX_data_edit_text(C);
- if(!text)
+ if (!text)
return 0;
- if(text->id.lib) {
+ if (text->id.lib) {
// BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
return 0;
}
@@ -105,10 +105,10 @@ static int text_space_edit_poll(bContext *C)
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
- if(!st || !text)
+ if (!st || !text)
return 0;
- if(text->id.lib) {
+ if (text->id.lib) {
// BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
return 0;
}
@@ -122,13 +122,13 @@ static int text_region_edit_poll(bContext *C)
Text *text= CTX_data_edit_text(C);
ARegion *ar= CTX_wm_region(C);
- if(!st || !text)
+ if (!st || !text)
return 0;
- if(!ar || ar->regiontype != RGN_TYPE_WINDOW)
+ if (!ar || ar->regiontype != RGN_TYPE_WINDOW)
return 0;
- if(text->id.lib) {
+ if (text->id.lib) {
// BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
return 0;
}
@@ -140,11 +140,11 @@ static int text_region_edit_poll(bContext *C)
void text_update_line_edited(TextLine *line)
{
- if(!line)
+ if (!line)
return;
/* we just free format here, and let it rebuild during draw */
- if(line->format) {
+ if (line->format) {
MEM_freeN(line->format);
line->format= NULL;
}
@@ -154,7 +154,7 @@ void text_update_edited(Text *text)
{
TextLine *line;
- for(line=text->lines.first; line; line=line->next)
+ for (line=text->lines.first; line; line=line->next)
text_update_line_edited(line);
}
@@ -172,18 +172,18 @@ static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
- if(prop) {
+ if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
/* doesnt always seem to happen... (ton) */
- if(text->id.us>1)
+ if (text->id.us>1)
text->id.us--;
RNA_id_pointer_create(&text->id, &idptr);
RNA_property_pointer_set(&ptr, prop, idptr);
RNA_property_update(C, &ptr, prop);
}
- else if(st) {
+ else if (st) {
st->text= text;
st->top= 0;
text_drawcache_tag_update(st, 1);
@@ -197,16 +197,16 @@ static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_new(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Create Text Block";
- ot->idname= "TEXT_OT_new";
- ot->description= "Create a new text data block";
+ ot->name = "Create Text Block";
+ ot->idname = "TEXT_OT_new";
+ ot->description = "Create a new text data block";
/* api callbacks */
- ot->exec= text_new_exec;
- ot->poll= text_new_poll;
+ ot->exec = text_new_exec;
+ ot->poll = text_new_poll;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
}
/******************* open operator *********************/
@@ -238,18 +238,18 @@ static int text_open_exec(bContext *C, wmOperator *op)
text= add_text(str, G.main->name);
- if(!text) {
- if(op->customdata) MEM_freeN(op->customdata);
+ if (!text) {
+ if (op->customdata) MEM_freeN(op->customdata);
return OPERATOR_CANCELLED;
}
- if(!op->customdata)
+ if (!op->customdata)
text_open_init(C, op);
/* hook into UI */
pprop= op->customdata;
- if(pprop->prop) {
+ if (pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
text->id.us--;
@@ -258,13 +258,13 @@ static int text_open_exec(bContext *C, wmOperator *op)
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
RNA_property_update(C, &pprop->ptr, pprop->prop);
}
- else if(st) {
+ else if (st) {
st->text= text;
st->top= 0;
}
if (internal) {
- if(text->name)
+ if (text->name)
MEM_freeN(text->name);
text->name = NULL;
@@ -283,7 +283,7 @@ static int text_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
Text *text= CTX_data_edit_text(C);
char *path= (text && text->name)? text->name: G.main->name;
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return text_open_exec(C, op);
text_open_init(C, op);
@@ -296,18 +296,18 @@ static int text_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
void TEXT_OT_open(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Open Text Block";
- ot->idname= "TEXT_OT_open";
- ot->description= "Open a new text data block";
+ ot->name = "Open Text Block";
+ ot->idname = "TEXT_OT_open";
+ ot->description = "Open a new text data block";
/* api callbacks */
- ot->exec= text_open_exec;
- ot->invoke= text_open_invoke;
- ot->cancel= text_open_cancel;
- ot->poll= text_new_poll;
+ ot->exec = text_open_exec;
+ ot->invoke = text_open_invoke;
+ ot->cancel = text_open_cancel;
+ ot->poll = text_new_poll;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); //XXX TODO, relative_path
@@ -320,13 +320,13 @@ static int text_reload_exec(bContext *C, wmOperator *op)
{
Text *text= CTX_data_edit_text(C);
- if(!reopen_text(text)) {
+ if (!reopen_text(text)) {
BKE_report(op->reports, RPT_ERROR, "Could not reopen file");
return OPERATOR_CANCELLED;
}
#ifdef WITH_PYTHON
- if(text->compiled)
+ if (text->compiled)
BPY_text_free_code(text);
#endif
@@ -341,14 +341,14 @@ static int text_reload_exec(bContext *C, wmOperator *op)
void TEXT_OT_reload(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reload";
- ot->idname= "TEXT_OT_reload";
- ot->description= "Reload active text data block from its file";
+ ot->name = "Reload";
+ ot->idname = "TEXT_OT_reload";
+ ot->description = "Reload active text data block from its file";
/* api callbacks */
- ot->exec= text_reload_exec;
- ot->invoke= WM_operator_confirm;
- ot->poll= text_edit_poll;
+ ot->exec = text_reload_exec;
+ ot->invoke = WM_operator_confirm;
+ ot->poll = text_edit_poll;
}
/******************* delete operator *********************/
@@ -366,13 +366,13 @@ static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op))
Text *text= CTX_data_edit_text(C);
/* make the previous text active, if its not there make the next text active */
- if(st) {
- if(text->id.prev) {
+ if (st) {
+ if (text->id.prev) {
st->text = text->id.prev;
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
}
- else if(text->id.next) {
+ else if (text->id.next) {
st->text = text->id.next;
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
@@ -391,17 +391,17 @@ static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_unlink(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Unlink";
- ot->idname= "TEXT_OT_unlink";
- ot->description= "Unlink active text data block";
+ ot->name = "Unlink";
+ ot->idname = "TEXT_OT_unlink";
+ ot->description = "Unlink active text data block";
/* api callbacks */
- ot->exec= text_unlink_exec;
- ot->invoke= WM_operator_confirm;
- ot->poll= text_unlink_poll;
+ ot->exec = text_unlink_exec;
+ ot->invoke = WM_operator_confirm;
+ ot->poll = text_unlink_poll;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
}
/******************* make internal operator *********************/
@@ -412,7 +412,7 @@ static int text_make_internal_exec(bContext *C, wmOperator *UNUSED(op))
text->flags |= TXT_ISMEM | TXT_ISDIRTY;
- if(text->name) {
+ if (text->name) {
MEM_freeN(text->name);
text->name= NULL;
}
@@ -426,16 +426,16 @@ static int text_make_internal_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_make_internal(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Internal";
- ot->idname= "TEXT_OT_make_internal";
- ot->description= "Make active text file internal";
+ ot->name = "Make Internal";
+ ot->idname = "TEXT_OT_make_internal";
+ ot->description = "Make active text file internal";
/* api callbacks */
- ot->exec= text_make_internal_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_make_internal_exec;
+ ot->poll = text_edit_poll;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
}
/******************* save operator *********************/
@@ -444,7 +444,7 @@ static int text_save_poll(bContext *C)
{
Text *text= CTX_data_edit_text(C);
- if(!text_edit_poll(C))
+ if (!text_edit_poll(C))
return 0;
return (text->name != NULL && !(text->flags & TXT_ISMEM));
@@ -460,15 +460,15 @@ static void txt_write_file(Text *text, ReportList *reports)
BLI_strncpy(filepath, text->name, FILE_MAX);
BLI_path_abs(filepath, G.main->name);
- fp= fopen(filepath, "w");
- if(fp==NULL) {
+ fp= BLI_fopen(filepath, "w");
+ if (fp==NULL) {
BKE_reportf(reports, RPT_ERROR, "Unable to save \"%s\": %s", filepath, errno ? strerror(errno) : "Unknown error writing file");
return;
}
tmp= text->lines.first;
- while(tmp) {
- if(tmp->next) fprintf(fp, "%s\n", tmp->line);
+ while (tmp) {
+ if (tmp->next) fprintf(fp, "%s\n", tmp->line);
else fprintf(fp, "%s", tmp->line);
tmp= tmp->next;
@@ -476,7 +476,7 @@ static void txt_write_file(Text *text, ReportList *reports)
fclose (fp);
- if(stat(filepath, &st) == 0) {
+ if (stat(filepath, &st) == 0) {
text->mtime= st.st_mtime;
}
else {
@@ -484,7 +484,7 @@ static void txt_write_file(Text *text, ReportList *reports)
BKE_reportf(reports, RPT_WARNING, "Unable to stat \"%s\": %s", filepath, errno ? strerror(errno) : "Unknown error starrng file");
}
- if(text->flags & TXT_ISDIRTY)
+ if (text->flags & TXT_ISDIRTY)
text->flags ^= TXT_ISDIRTY;
}
@@ -503,13 +503,13 @@ static int text_save_exec(bContext *C, wmOperator *op)
void TEXT_OT_save(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Save";
- ot->idname= "TEXT_OT_save";
- ot->description= "Save active text data block";
+ ot->name = "Save";
+ ot->idname = "TEXT_OT_save";
+ ot->description = "Save active text data block";
/* api callbacks */
- ot->exec= text_save_exec;
- ot->poll= text_save_poll;
+ ot->exec = text_save_exec;
+ ot->poll = text_save_poll;
}
/******************* save as operator *********************/
@@ -519,12 +519,12 @@ static int text_save_as_exec(bContext *C, wmOperator *op)
Text *text= CTX_data_edit_text(C);
char str[FILE_MAX];
- if(!text)
+ if (!text)
return OPERATOR_CANCELLED;
RNA_string_get(op->ptr, "filepath", str);
- if(text->name) MEM_freeN(text->name);
+ if (text->name) MEM_freeN(text->name);
text->name= BLI_strdup(str);
text->flags &= ~TXT_ISMEM;
@@ -541,12 +541,12 @@ static int text_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
Text *text= CTX_data_edit_text(C);
char *str;
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return text_save_as_exec(C, op);
- if(text->name)
+ if (text->name)
str= text->name;
- else if(text->flags & TXT_ISMEM)
+ else if (text->flags & TXT_ISMEM)
str= text->id.name+2;
else
str= G.main->name;
@@ -560,14 +560,14 @@ static int text_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
void TEXT_OT_save_as(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Save As";
- ot->idname= "TEXT_OT_save_as";
- ot->description= "Save active text file with options";
+ ot->name = "Save As";
+ ot->idname = "TEXT_OT_save_as";
+ ot->description = "Save active text file with options";
/* api callbacks */
- ot->exec= text_save_as_exec;
- ot->invoke= text_save_as_invoke;
- ot->poll= text_edit_poll;
+ ot->exec = text_save_as_exec;
+ ot->invoke = text_save_as_invoke;
+ ot->poll = text_edit_poll;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); //XXX TODO, relative_path
@@ -591,16 +591,16 @@ static int text_run_script(bContext *C, ReportList *reports)
int curc_prev= text->curc;
if (BPY_text_exec(C, text, reports, !is_live)) {
- if(is_live) {
+ if (is_live) {
/* for nice live updates */
WM_event_add_notifier(C, NC_WINDOW|NA_EDITED, NULL);
}
return OPERATOR_FINISHED;
}
- /* Dont report error messages while live editing */
- if(!is_live) {
- if(text->curl != curl_prev || curc_prev != text->curc) {
+ /* Don't report error messages while live editing */
+ if (!is_live) {
+ if (text->curl != curl_prev || curc_prev != text->curc) {
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
}
@@ -630,16 +630,16 @@ static int text_run_script_exec(bContext *C, wmOperator *op)
void TEXT_OT_run_script(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Run Script";
- ot->idname= "TEXT_OT_run_script";
- ot->description= "Run active script";
+ ot->name = "Run Script";
+ ot->idname = "TEXT_OT_run_script";
+ ot->description = "Run active script";
/* api callbacks */
- ot->poll= text_run_script_poll;
- ot->exec= text_run_script_exec;
+ ot->poll = text_run_script_poll;
+ ot->exec = text_run_script_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/******************* refresh pyconstraints operator *********************/
@@ -654,30 +654,30 @@ static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUS
short update;
/* check all pyconstraints */
- for(ob= CTX_data_main(C)->object.first; ob; ob= ob->id.next) {
+ for (ob= CTX_data_main(C)->object.first; ob; ob= ob->id.next) {
update = 0;
- if(ob->type==OB_ARMATURE && ob->pose) {
+ if (ob->type==OB_ARMATURE && ob->pose) {
bPoseChannel *pchan;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- for(con = pchan->constraints.first; con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_PYTHON) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (con = pchan->constraints.first; con; con= con->next) {
+ if (con->type==CONSTRAINT_TYPE_PYTHON) {
bPythonConstraint *data = con->data;
- if(data->text==text) BPY_pyconstraint_update(ob, con);
+ if (data->text==text) BPY_pyconstraint_update(ob, con);
update = 1;
}
}
}
}
- for(con = ob->constraints.first; con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_PYTHON) {
+ for (con = ob->constraints.first; con; con= con->next) {
+ if (con->type==CONSTRAINT_TYPE_PYTHON) {
bPythonConstraint *data = con->data;
- if(data->text==text) BPY_pyconstraint_update(ob, con);
+ if (data->text==text) BPY_pyconstraint_update(ob, con);
update = 1;
}
}
- if(update) {
+ if (update) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
}
@@ -690,13 +690,13 @@ static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUS
void TEXT_OT_refresh_pyconstraints(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Refresh PyConstraints";
- ot->idname= "TEXT_OT_refresh_pyconstraints";
- ot->description= "Refresh all pyconstraints";
+ ot->name = "Refresh PyConstraints";
+ ot->idname = "TEXT_OT_refresh_pyconstraints";
+ ot->description = "Refresh all pyconstraints";
/* api callbacks */
- ot->exec= text_refresh_pyconstraints_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_refresh_pyconstraints_exec;
+ ot->poll = text_edit_poll;
}
/******************* paste operator *********************/
@@ -707,25 +707,25 @@ static char *txt_copy_selected(Text *text)
char *buf= NULL;
int charf, charl, length= 0;
- if(!text) return NULL;
- if(!text->curl) return NULL;
- if(!text->sell) return NULL;
+ if (!text) return NULL;
+ if (!text->curl) return NULL;
+ if (!text->sell) return NULL;
- if(!txt_has_sel(text)) return NULL;
+ if (!txt_has_sel(text)) return NULL;
- if(text->curl==text->sell) {
+ if (text->curl==text->sell) {
linef= linel= text->curl;
- if(text->curc < text->selc) {
+ if (text->curc < text->selc) {
charf= text->curc;
charl= text->selc;
}
- else{
+ else {
charf= text->selc;
charl= text->curc;
}
}
- else if(txt_get_span(text->curl, text->sell)<0) {
+ else if (txt_get_span(text->curl, text->sell)<0) {
linef= text->sell;
linel= text->curl;
@@ -740,7 +740,7 @@ static char *txt_copy_selected(Text *text)
charl= text->selc;
}
- if(linef == linel) {
+ if (linef == linel) {
length= charl-charf;
buf= MEM_callocN(length+1, "cut buffera");
@@ -753,7 +753,7 @@ static char *txt_copy_selected(Text *text)
length++; /* For the '\n' */
tmp= linef->next;
- while(tmp && tmp!= linel) {
+ while (tmp && tmp!= linel) {
length+= tmp->len+1;
tmp= tmp->next;
}
@@ -766,7 +766,7 @@ static char *txt_copy_selected(Text *text)
buf[length++]='\n';
tmp= linef->next;
- while(tmp && tmp!=linel) {
+ while (tmp && tmp!=linel) {
strncpy(buf+length, tmp->line, tmp->len);
length+= tmp->len;
@@ -791,7 +791,7 @@ static int text_paste_exec(bContext *C, wmOperator *op)
buf= WM_clipboard_text_get(selection);
- if(!buf)
+ if (!buf)
return OPERATOR_CANCELLED;
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
@@ -805,7 +805,7 @@ static int text_paste_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
/* run the script while editing, evil but useful */
- if(CTX_wm_space_text(C)->live_edit)
+ if (CTX_wm_space_text(C)->live_edit)
text_run_script(C, NULL);
return OPERATOR_FINISHED;
@@ -814,13 +814,13 @@ static int text_paste_exec(bContext *C, wmOperator *op)
void TEXT_OT_paste(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Paste";
- ot->idname= "TEXT_OT_paste";
- ot->description= "Paste text from clipboard";
+ ot->name = "Paste";
+ ot->idname = "TEXT_OT_paste";
+ ot->description = "Paste text from clipboard";
/* api callbacks */
- ot->exec= text_paste_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_paste_exec;
+ ot->poll = text_edit_poll;
/* properties */
RNA_def_boolean(ot->srna, "selection", 0, "Selection", "Paste text selected elsewhere rather than copied (X11 only)");
@@ -834,7 +834,7 @@ static void txt_copy_clipboard(Text *text)
buf= txt_copy_selected(text);
- if(buf) {
+ if (buf) {
WM_clipboard_text_set(buf, 0);
MEM_freeN(buf);
}
@@ -852,13 +852,13 @@ static int text_copy_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy";
- ot->idname= "TEXT_OT_copy";
- ot->description= "Copy selected text to clipboard";
+ ot->name = "Copy";
+ ot->idname = "TEXT_OT_copy";
+ ot->description = "Copy selected text to clipboard";
/* api callbacks */
- ot->exec= text_copy_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_copy_exec;
+ ot->poll = text_edit_poll;
}
/******************* cut operator *********************/
@@ -876,7 +876,7 @@ static int text_cut_exec(bContext *C, wmOperator *UNUSED(op))
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
/* run the script while editing, evil but useful */
- if(CTX_wm_space_text(C)->live_edit)
+ if (CTX_wm_space_text(C)->live_edit)
text_run_script(C, NULL);
return OPERATOR_FINISHED;
@@ -885,13 +885,13 @@ static int text_cut_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_cut(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Cut";
- ot->idname= "TEXT_OT_cut";
- ot->description= "Cut selected text to clipboard";
+ ot->name = "Cut";
+ ot->idname = "TEXT_OT_cut";
+ ot->description = "Cut selected text to clipboard";
/* api callbacks */
- ot->exec= text_cut_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_cut_exec;
+ ot->poll = text_edit_poll;
}
/******************* indent operator *********************/
@@ -902,7 +902,7 @@ static int text_indent_exec(bContext *C, wmOperator *UNUSED(op))
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
- if(txt_has_sel(text)) {
+ if (txt_has_sel(text)) {
txt_order_cursors(text);
txt_indent(text);
}
@@ -920,13 +920,13 @@ static int text_indent_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_indent(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Indent";
- ot->idname= "TEXT_OT_indent";
- ot->description= "Indent selected text";
+ ot->name = "Indent";
+ ot->idname = "TEXT_OT_indent";
+ ot->description = "Indent selected text";
/* api callbacks */
- ot->exec= text_indent_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_indent_exec;
+ ot->poll = text_edit_poll;
}
/******************* unindent operator *********************/
@@ -935,7 +935,7 @@ static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
- if(txt_has_sel(text)) {
+ if (txt_has_sel(text)) {
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
txt_order_cursors(text);
@@ -955,13 +955,13 @@ static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_unindent(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Unindent";
- ot->idname= "TEXT_OT_unindent";
- ot->description= "Unindent selected text";
+ ot->name = "Unindent";
+ ot->idname = "TEXT_OT_unindent";
+ ot->description = "Unindent selected text";
/* api callbacks */
- ot->exec= text_unindent_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_unindent_exec;
+ ot->poll = text_edit_poll;
}
/******************* line break operator *********************/
@@ -979,16 +979,17 @@ static int text_line_break_exec(bContext *C, wmOperator *UNUSED(op))
curts= setcurr_tab_spaces(text, space);
txt_split_curline(text);
- for(a=0; a < curts; a++) {
+ for (a=0; a < curts; a++) {
if (text->flags & TXT_TABSTOSPACES) {
txt_add_char(text, ' ');
- } else {
+ }
+ else {
txt_add_char(text, '\t');
}
}
- if(text->curl) {
- if(text->curl->prev)
+ if (text->curl) {
+ if (text->curl->prev)
text_update_line_edited(text->curl->prev);
text_update_line_edited(text->curl);
}
@@ -1002,13 +1003,13 @@ static int text_line_break_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_line_break(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Line Break";
- ot->idname= "TEXT_OT_line_break";
- ot->description= "Insert line break at cursor position";
+ ot->name = "Line Break";
+ ot->idname = "TEXT_OT_line_break";
+ ot->description = "Insert line break at cursor position";
/* api callbacks */
- ot->exec= text_line_break_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_line_break_exec;
+ ot->poll = text_edit_poll;
}
/******************* comment operator *********************/
@@ -1017,7 +1018,7 @@ static int text_comment_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
- if(txt_has_sel(text)) {
+ if (txt_has_sel(text)) {
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
txt_order_cursors(text);
@@ -1035,13 +1036,13 @@ static int text_comment_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_comment(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Comment";
- ot->idname= "TEXT_OT_comment";
- ot->description= "Convert selected text to comment";
+ ot->name = "Comment";
+ ot->idname = "TEXT_OT_comment";
+ ot->description = "Convert selected text to comment";
/* api callbacks */
- ot->exec= text_comment_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_comment_exec;
+ ot->poll = text_edit_poll;
}
/******************* uncomment operator *********************/
@@ -1050,7 +1051,7 @@ static int text_uncomment_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
- if(txt_has_sel(text)) {
+ if (txt_has_sel(text)) {
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
txt_order_cursors(text);
@@ -1069,13 +1070,13 @@ static int text_uncomment_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_uncomment(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Uncomment";
- ot->idname= "TEXT_OT_uncomment";
- ot->description= "Convert selected comment to text";
+ ot->name = "Uncomment";
+ ot->idname = "TEXT_OT_uncomment";
+ ot->description = "Convert selected comment to text";
/* api callbacks */
- ot->exec= text_uncomment_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_uncomment_exec;
+ ot->poll = text_edit_poll;
}
/******************* convert whitespace operator *********************/
@@ -1100,16 +1101,16 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
tmp = text->lines.first;
//first convert to all space, this make it a lot easier to convert to tabs because there is no mixtures of ' ' && '\t'
- while(tmp) {
+ while (tmp) {
text_check_line = tmp->line;
number = flatten_string(st, &fs, text_check_line)+1;
flatten_string_free(&fs);
new_line = MEM_callocN(number, "Converted_Line");
j = 0;
- for(a=0; a < strlen(text_check_line); a++) { //foreach char in line
- if(text_check_line[a] == '\t') { //checking for tabs
+ for (a=0; a < strlen(text_check_line); a++) { //foreach char in line
+ if (text_check_line[a] == '\t') { //checking for tabs
//get the number of spaces this tabs is showing
- //i dont like doing it this way but will look into it later
+ //i don't like doing it this way but will look into it later
new_line[j] = '\0';
number = flatten_string(st, &fs, new_line);
flatten_string_free(&fs);
@@ -1118,7 +1119,7 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
number = flatten_string(st, &fs, new_line)-number;
flatten_string_free(&fs);
- for(extra = 0; extra < number; extra++) {
+ for (extra = 0; extra < number; extra++) {
new_line[j] = ' ';
j++;
}
@@ -1130,8 +1131,8 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
}
new_line[j] = '\0';
// put new_line in the tmp->line spot still need to try and set the curc correctly
- if(tmp->line) MEM_freeN(tmp->line);
- if(tmp->format) MEM_freeN(tmp->format);
+ if (tmp->line) MEM_freeN(tmp->line);
+ if (tmp->format) MEM_freeN(tmp->format);
tmp->line = new_line;
tmp->len = strlen(new_line);
@@ -1143,38 +1144,38 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
//start over from the beginning
tmp = text->lines.first;
- while(tmp) {
+ while (tmp) {
text_check_line = tmp->line;
extra = 0;
- for(a = 0; a < strlen(text_check_line); a++) {
+ for (a = 0; a < strlen(text_check_line); a++) {
number = 0;
- for(j = 0; j < (size_t)st->tabnumber; j++) {
- if((a+j) <= strlen(text_check_line)) { //check to make sure we are not pass the end of the line
- if(text_check_line[a+j] != ' ') {
+ for (j = 0; j < (size_t)st->tabnumber; j++) {
+ if ((a+j) <= strlen(text_check_line)) { //check to make sure we are not pass the end of the line
+ if (text_check_line[a+j] != ' ') {
number = 1;
}
}
}
- if(!number) { //found all number of space to equal a tab
+ if (!number) { //found all number of space to equal a tab
a = a+(st->tabnumber-1);
extra = extra+1;
}
}
- if( extra > 0 ) { //got tabs make malloc and do what you have to do
+ if ( extra > 0 ) { //got tabs make malloc and do what you have to do
new_line = MEM_callocN(strlen(text_check_line)-(((st->tabnumber*extra)-extra)-1), "Converted_Line");
extra = 0; //reuse vars
- for(a = 0; a < strlen(text_check_line); a++) {
+ for (a = 0; a < strlen(text_check_line); a++) {
number = 0;
- for(j = 0; j < (size_t)st->tabnumber; j++) {
- if((a+j) <= strlen(text_check_line)) { //check to make sure we are not pass the end of the line
- if(text_check_line[a+j] != ' ') {
+ for (j = 0; j < (size_t)st->tabnumber; j++) {
+ if ((a+j) <= strlen(text_check_line)) { //check to make sure we are not pass the end of the line
+ if (text_check_line[a+j] != ' ') {
number = 1;
}
}
}
- if(!number) { //found all number of space to equal a tab
+ if (!number) { //found all number of space to equal a tab
new_line[extra] = '\t';
a = a+(st->tabnumber-1);
++extra;
@@ -1187,8 +1188,8 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
}
new_line[extra] = '\0';
// put new_line in the tmp->line spot still need to try and set the curc correctly
- if(tmp->line) MEM_freeN(tmp->line);
- if(tmp->format) MEM_freeN(tmp->format);
+ if (tmp->line) MEM_freeN(tmp->line);
+ if (tmp->format) MEM_freeN(tmp->format);
tmp->line = new_line;
tmp->len = strlen(new_line);
@@ -1209,13 +1210,13 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
void TEXT_OT_convert_whitespace(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Convert Whitespace";
- ot->idname= "TEXT_OT_convert_whitespace";
- ot->description= "Convert whitespaces by type";
+ ot->name = "Convert Whitespace";
+ ot->idname = "TEXT_OT_convert_whitespace";
+ ot->description = "Convert whitespaces by type";
/* api callbacks */
- ot->exec= text_convert_whitespace_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_convert_whitespace_exec;
+ ot->poll = text_edit_poll;
/* properties */
RNA_def_enum(ot->srna, "type", whitespace_type_items, TO_SPACES, "Type", "Type of whitespace to convert to");
@@ -1238,13 +1239,13 @@ static int text_select_all_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select All";
- ot->idname= "TEXT_OT_select_all";
- ot->description= "Select all text";
+ ot->name = "Select All";
+ ot->idname = "TEXT_OT_select_all";
+ ot->description = "Select all text";
/* api callbacks */
- ot->exec= text_select_all_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_select_all_exec;
+ ot->poll = text_edit_poll;
}
/******************* select line operator *********************/
@@ -1264,13 +1265,13 @@ static int text_select_line_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_select_line(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Line";
- ot->idname= "TEXT_OT_select_line";
- ot->description= "Select text by line";
+ ot->name = "Select Line";
+ ot->idname = "TEXT_OT_select_line";
+ ot->description = "Select text by line";
/* api callbacks */
- ot->exec= text_select_line_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_select_line_exec;
+ ot->poll = text_edit_poll;
}
/******************* select word operator *********************/
@@ -1291,13 +1292,13 @@ static int text_select_word_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_select_word(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Word";
- ot->idname= "TEXT_OT_select_word";
- ot->description= "Select word under cursor";
+ ot->name = "Select Word";
+ ot->idname = "TEXT_OT_select_word";
+ ot->description = "Select word under cursor";
/* api callbacks */
- ot->exec= text_select_word_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_select_word_exec;
+ ot->poll = text_edit_poll;
}
/******************* previous marker operator *********************/
@@ -1310,10 +1311,10 @@ static int text_previous_marker_exec(bContext *C, wmOperator *UNUSED(op))
lineno= txt_get_span(text->lines.first, text->curl);
mrk= text->markers.last;
- while(mrk && (mrk->lineno>lineno || (mrk->lineno==lineno && mrk->end > text->curc)))
+ while (mrk && (mrk->lineno>lineno || (mrk->lineno==lineno && mrk->end > text->curc)))
mrk= mrk->prev;
- if(!mrk) mrk= text->markers.last;
- if(mrk) {
+ if (!mrk) mrk= text->markers.last;
+ if (mrk) {
txt_move_to(text, mrk->lineno, mrk->start, 0);
txt_move_to(text, mrk->lineno, mrk->end, 1);
}
@@ -1327,13 +1328,13 @@ static int text_previous_marker_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_previous_marker(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Previous Marker";
- ot->idname= "TEXT_OT_previous_marker";
- ot->description= "Move to previous marker";
+ ot->name = "Previous Marker";
+ ot->idname = "TEXT_OT_previous_marker";
+ ot->description = "Move to previous marker";
/* api callbacks */
- ot->exec= text_previous_marker_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_previous_marker_exec;
+ ot->poll = text_edit_poll;
}
/******************* next marker operator *********************/
@@ -1346,10 +1347,10 @@ static int text_next_marker_exec(bContext *C, wmOperator *UNUSED(op))
lineno= txt_get_span(text->lines.first, text->curl);
mrk= text->markers.first;
- while(mrk && (mrk->lineno<lineno || (mrk->lineno==lineno && mrk->start <= text->curc)))
+ while (mrk && (mrk->lineno<lineno || (mrk->lineno==lineno && mrk->start <= text->curc)))
mrk= mrk->next;
- if(!mrk) mrk= text->markers.first;
- if(mrk) {
+ if (!mrk) mrk= text->markers.first;
+ if (mrk) {
txt_move_to(text, mrk->lineno, mrk->start, 0);
txt_move_to(text, mrk->lineno, mrk->end, 1);
}
@@ -1363,13 +1364,13 @@ static int text_next_marker_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_next_marker(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Next Marker";
- ot->idname= "TEXT_OT_next_marker";
- ot->description= "Move to next marker";
+ ot->name = "Next Marker";
+ ot->idname = "TEXT_OT_next_marker";
+ ot->description = "Move to next marker";
/* api callbacks */
- ot->exec= text_next_marker_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_next_marker_exec;
+ ot->poll = text_edit_poll;
}
/******************* clear all markers operator *********************/
@@ -1389,13 +1390,13 @@ static int text_clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_markers_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear All Markers";
- ot->idname= "TEXT_OT_markers_clear";
- ot->description= "Clear all markers";
+ ot->name = "Clear All Markers";
+ ot->idname = "TEXT_OT_markers_clear";
+ ot->description = "Clear all markers";
/* api callbacks */
- ot->exec= text_clear_all_markers_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_clear_all_markers_exec;
+ ot->poll = text_edit_poll;
}
/************************ move operator ************************/
@@ -1427,60 +1428,60 @@ static int text_get_cursor_rel(SpaceText* st, ARegion *ar, TextLine *linein, int
end= max;
chop= loop= 1;
- for(i=0, j=0; loop; j+=BLI_str_utf8_size(linein->line+j)) {
+ for (i=0, j=0; loop; j+=BLI_str_utf8_size(linein->line+j)) {
int chars;
/* Mimic replacement of tabs */
ch= linein->line[j];
- if(ch=='\t') {
+ if (ch=='\t') {
chars= st->tabnumber-i%st->tabnumber;
ch= ' ';
}
else chars= 1;
- while(chars--) {
- if(rell==0 && i-start==relc) {
+ while (chars--) {
+ if (rell==0 && i-start==relc) {
/* current position could be wrapped to next line */
/* this should be checked when end of current line would be reached */
selc= j;
found= 1;
}
- else if(i-end==relc) {
+ else if (i-end==relc) {
curs= j;
}
- if(i-start>=max) {
- if(found) {
+ if (i-start>=max) {
+ if (found) {
/* exact cursor position was found, check if it's */
/* still on needed line (hasn't been wrapped) */
- if(selc>endj && !chop) selc= endj;
+ if (selc>endj && !chop) selc= endj;
loop= 0;
break;
}
- if(chop) endj= j;
+ if (chop) endj= j;
start= end;
end += max;
chop= 1;
rell--;
- if(rell==0 && i-start>=relc) {
+ if (rell==0 && i-start>=relc) {
selc= curs;
loop= 0;
break;
}
}
else if (ch=='\0') {
- if(!found) selc= linein->len;
+ if (!found) selc= linein->len;
loop= 0;
break;
}
- else if(ch==' ' || ch=='-') {
- if(found) {
+ else if (ch==' ' || ch=='-') {
+ if (found) {
loop= 0;
break;
}
- if(rell==0 && i-start>=relc) {
+ if (rell==0 && i-start>=relc) {
selc= curs;
loop= 0;
break;
@@ -1506,12 +1507,12 @@ static int cursor_skip_find_line(SpaceText* st, ARegion *ar,
*rell= lines;
/* handle current line */
- if(lines>0) {
+ if (lines>0) {
visible_lines= text_get_visible_lines(st, ar, (*linep)->line);
- if(*rell-visible_lines+offl>=0) {
- if(!(*linep)->next) {
- if(offl < visible_lines-1) {
+ if (*rell-visible_lines+offl>=0) {
+ if (!(*linep)->next) {
+ if (offl < visible_lines-1) {
*rell= visible_lines-1;
return 1;
}
@@ -1522,14 +1523,16 @@ static int cursor_skip_find_line(SpaceText* st, ARegion *ar,
*rell-= visible_lines-offl;
*linep=(*linep)->next;
- } else {
+ }
+ else {
*rell+= offl;
return 1;
}
- } else {
- if(*rell+offl<=0) {
- if(!(*linep)->prev) {
- if(offl) {
+ }
+ else {
+ if (*rell+offl<=0) {
+ if (!(*linep)->prev) {
+ if (offl) {
*rell= 0;
return 1;
}
@@ -1540,33 +1543,35 @@ static int cursor_skip_find_line(SpaceText* st, ARegion *ar,
*rell+= offl;
*linep=(*linep)->prev;
- } else {
+ }
+ else {
*rell+= offl;
return 1;
}
}
/* skip lines and find destination line and offsets */
- while(*linep) {
+ while (*linep) {
visible_lines= text_get_visible_lines(st, ar, (*linep)->line);
- if(lines<0) { /* moving top */
- if(*rell+visible_lines >= 0) {
+ if (lines<0) { /* moving top */
+ if (*rell+visible_lines >= 0) {
*rell+= visible_lines;
break;
}
- if(!(*linep)->prev) {
+ if (!(*linep)->prev) {
*rell= 0;
break;
}
*rell+= visible_lines;
*linep=(*linep)->prev;
- } else { /* moving bottom */
- if(*rell-visible_lines < 0) break;
+ }
+ else { /* moving bottom */
+ if (*rell-visible_lines < 0) break;
- if(!(*linep)->next) {
+ if (!(*linep)->next) {
*rell= visible_lines-1;
break;
}
@@ -1602,34 +1607,34 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
chop= loop= 1;
*charp= 0;
- for(i=0, j=0; loop; j+=BLI_str_utf8_size((*linep)->line+j)) {
+ for (i=0, j=0; loop; j+=BLI_str_utf8_size((*linep)->line+j)) {
int chars;
/* Mimic replacement of tabs */
ch= (*linep)->line[j];
- if(ch=='\t') {
+ if (ch=='\t') {
chars= st->tabnumber-i%st->tabnumber;
ch= ' ';
}
else chars= 1;
- while(chars--) {
- if(i-start>=max) {
+ while (chars--) {
+ if (i-start>=max) {
*charp= endj;
- if(j>=oldc) {
- if(ch=='\0') *charp= txt_utf8_index_to_offset((*linep)->line, start);
+ if (j>=oldc) {
+ if (ch=='\0') *charp= txt_utf8_index_to_offset((*linep)->line, start);
loop= 0;
break;
}
- if(chop) endj= j;
+ if (chop) endj= j;
start= end;
end += max;
chop= 1;
}
- else if(ch==' ' || ch=='-' || ch=='\0') {
- if(j>=oldc) {
+ else if (ch==' ' || ch=='-' || ch=='\0') {
+ if (j>=oldc) {
*charp= txt_utf8_index_to_offset((*linep)->line, start);
loop= 0;
break;
@@ -1670,22 +1675,22 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
chop= loop= 1;
*charp= 0;
- for(i=0, j=0; loop; j+=BLI_str_utf8_size((*linep)->line+j)) {
+ for (i=0, j=0; loop; j+=BLI_str_utf8_size((*linep)->line+j)) {
int chars;
/* Mimic replacement of tabs */
ch= (*linep)->line[j];
- if(ch=='\t') {
+ if (ch=='\t') {
chars= st->tabnumber-i%st->tabnumber;
ch= ' ';
}
else chars= 1;
- while(chars--) {
- if(i-start>=max) {
- if(chop) endj= BLI_str_prev_char_utf8((*linep)->line+j)-(*linep)->line;
+ while (chars--) {
+ if (i-start>=max) {
+ if (chop) endj= BLI_str_prev_char_utf8((*linep)->line+j)-(*linep)->line;
- if(endj>=oldc) {
- if(ch=='\0') *charp= (*linep)->len;
+ if (endj>=oldc) {
+ if (ch=='\0') *charp= (*linep)->len;
else *charp= endj;
loop= 0;
break;
@@ -1694,11 +1699,13 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
start= end;
end += max;
chop= 1;
- } else if(ch=='\0') {
+ }
+ else if (ch=='\0') {
*charp= (*linep)->len;
loop= 0;
break;
- } else if(ch==' ' || ch=='-') {
+ }
+ else if (ch==' ' || ch=='-') {
end= i+1;
endj= j;
chop= 0;
@@ -1729,18 +1736,20 @@ static void txt_wrap_move_up(SpaceText *st, ARegion *ar, short sel)
wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
col= text_get_char_pos(st, (*linep)->line, *charp) + offc;
- if(offl) {
+ if (offl) {
*charp= text_get_cursor_rel(st, ar, *linep, offl-1, col);
newl= BLI_findindex(&text->lines, linep);
- } else {
- if((*linep)->prev) {
+ }
+ else {
+ if ((*linep)->prev) {
int visible_lines;
*linep= (*linep)->prev;
visible_lines= text_get_visible_lines(st, ar, (*linep)->line);
*charp= text_get_cursor_rel(st, ar, *linep, visible_lines-1, col);
newl--;
- } else *charp= 0;
+ }
+ else *charp= 0;
}
if (!sel) txt_pop_sel(text);
@@ -1766,15 +1775,17 @@ static void txt_wrap_move_down(SpaceText *st, ARegion *ar, short sel)
wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
col= text_get_char_pos(st, (*linep)->line, *charp) + offc;
visible_lines= text_get_visible_lines(st, ar, (*linep)->line);
- if(offl<visible_lines-1) {
+ if (offl<visible_lines-1) {
*charp= text_get_cursor_rel(st, ar, *linep, offl+1, col);
newl= BLI_findindex(&text->lines, linep);
- } else {
- if((*linep)->next) {
+ }
+ else {
+ if ((*linep)->next) {
*linep= (*linep)->next;
*charp= text_get_cursor_rel(st, ar, *linep, 0, col);
newl++;
- } else *charp= (*linep)->len;
+ }
+ else *charp= (*linep)->len;
}
if (!sel) txt_pop_sel(text);
@@ -1797,13 +1808,14 @@ static void cursor_skip(SpaceText* st, ARegion *ar, Text *text, int lines, int s
oldl= txt_get_span(text->lines.first, *linep);
oldc= *charp;
- if(st && ar && st->wordwrap) {
+ if (st && ar && st->wordwrap) {
int rell, relc;
/* find line and offsets inside it needed to set cursor position */
- if(cursor_skip_find_line(st, ar, lines, linep, charp, &rell, &relc))
+ if (cursor_skip_find_line(st, ar, lines, linep, charp, &rell, &relc))
*charp= text_get_cursor_rel (st, ar, *linep, rell, relc);
- } else {
+ }
+ else {
while (lines>0 && (*linep)->next) {
*linep= (*linep)->next;
lines--;
@@ -1827,17 +1839,17 @@ static int text_move_cursor(bContext *C, int type, int select)
ARegion *ar= CTX_wm_region(C);
/* ensure we have the right region, it's optional */
- if(ar && ar->regiontype != RGN_TYPE_WINDOW)
+ if (ar && ar->regiontype != RGN_TYPE_WINDOW)
ar= NULL;
switch(type) {
case LINE_BEGIN:
- if(st && st->wordwrap && ar) txt_wrap_move_bol(st, ar, select);
+ if (st && st->wordwrap && ar) txt_wrap_move_bol(st, ar, select);
else txt_move_bol(text, select);
break;
case LINE_END:
- if(st && st->wordwrap && ar) txt_wrap_move_eol(st, ar, select);
+ if (st && st->wordwrap && ar) txt_wrap_move_eol(st, ar, select);
else txt_move_eol(text, select);
break;
@@ -1866,22 +1878,22 @@ static int text_move_cursor(bContext *C, int type, int select)
break;
case PREV_LINE:
- if(st && st->wordwrap && ar) txt_wrap_move_up(st, ar, select);
+ if (st && st->wordwrap && ar) txt_wrap_move_up(st, ar, select);
else txt_move_up(text, select);
break;
case NEXT_LINE:
- if(st && st->wordwrap && ar) txt_wrap_move_down(st, ar, select);
+ if (st && st->wordwrap && ar) txt_wrap_move_down(st, ar, select);
else txt_move_down(text, select);
break;
case PREV_PAGE:
- if(st) cursor_skip(st, ar, st->text, -st->viewlines, select);
+ if (st) cursor_skip(st, ar, st->text, -st->viewlines, select);
else cursor_skip(NULL, NULL, text, -10, select);
break;
case NEXT_PAGE:
- if(st) cursor_skip(st, ar, st->text, st->viewlines, select);
+ if (st) cursor_skip(st, ar, st->text, st->viewlines, select);
else cursor_skip(NULL, NULL, text, 10, select);
break;
}
@@ -1902,13 +1914,13 @@ static int text_move_exec(bContext *C, wmOperator *op)
void TEXT_OT_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Cursor";
- ot->idname= "TEXT_OT_move";
- ot->description= "Move cursor to position type";
+ ot->name = "Move Cursor";
+ ot->idname = "TEXT_OT_move";
+ ot->description = "Move cursor to position type";
/* api callbacks */
- ot->exec= text_move_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_move_exec;
+ ot->poll = text_edit_poll;
/* properties */
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to");
@@ -1926,13 +1938,13 @@ static int text_move_select_exec(bContext *C, wmOperator *op)
void TEXT_OT_move_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Select";
- ot->idname= "TEXT_OT_move_select";
- ot->description= "Make selection from current cursor position to new cursor position type";
+ ot->name = "Move Select";
+ ot->idname = "TEXT_OT_move_select";
+ ot->description = "Make selection from current cursor position to new cursor position type";
/* api callbacks */
- ot->exec= text_move_select_exec;
- ot->poll= text_space_edit_poll;
+ ot->exec = text_move_select_exec;
+ ot->poll = text_space_edit_poll;
/* properties */
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to, to make a selection");
@@ -1946,9 +1958,9 @@ static int text_jump_exec(bContext *C, wmOperator *op)
int line= RNA_int_get(op->ptr, "line");
short nlines= txt_get_span(text->lines.first, text->lines.last)+1;
- if(line < 1)
+ if (line < 1)
txt_move_toline(text, 1, 0);
- else if(line > nlines)
+ else if (line > nlines)
txt_move_toline(text, nlines-1, 0);
else
txt_move_toline(text, line-1, 0);
@@ -1968,14 +1980,14 @@ static int text_jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
void TEXT_OT_jump(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Jump";
- ot->idname= "TEXT_OT_jump";
- ot->description= "Jump cursor to line";
+ ot->name = "Jump";
+ ot->idname = "TEXT_OT_jump";
+ ot->description = "Jump cursor to line";
/* api callbacks */
- ot->invoke= text_jump_invoke;
- ot->exec= text_jump_exec;
- ot->poll= text_edit_poll;
+ ot->invoke = text_jump_invoke;
+ ot->exec = text_jump_exec;
+ ot->poll = text_edit_poll;
/* properties */
RNA_def_int(ot->srna, "line", 1, 1, INT_MAX, "Line", "Line number to jump to", 1, 10000);
@@ -1997,13 +2009,13 @@ static int text_delete_exec(bContext *C, wmOperator *op)
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
- if(type == DEL_PREV_WORD)
+ if (type == DEL_PREV_WORD)
txt_backspace_word(text);
- else if(type == DEL_PREV_CHAR)
+ else if (type == DEL_PREV_CHAR)
txt_backspace_char(text);
- else if(type == DEL_NEXT_WORD)
+ else if (type == DEL_NEXT_WORD)
txt_delete_word(text);
- else if(type == DEL_NEXT_CHAR)
+ else if (type == DEL_NEXT_CHAR)
txt_delete_char(text);
text_update_line_edited(text->curl);
@@ -2012,7 +2024,7 @@ static int text_delete_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
/* run the script while editing, evil but useful */
- if(CTX_wm_space_text(C)->live_edit)
+ if (CTX_wm_space_text(C)->live_edit)
text_run_script(C, NULL);
return OPERATOR_FINISHED;
@@ -2021,13 +2033,13 @@ static int text_delete_exec(bContext *C, wmOperator *op)
void TEXT_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete";
- ot->idname= "TEXT_OT_delete";
- ot->description= "Delete text by cursor position";
+ ot->name = "Delete";
+ ot->idname = "TEXT_OT_delete";
+ ot->description = "Delete text by cursor position";
/* api callbacks */
- ot->exec= text_delete_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_delete_exec;
+ ot->poll = text_edit_poll;
/* properties */
RNA_def_enum(ot->srna, "type", delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete");
@@ -2049,13 +2061,13 @@ static int text_toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_overwrite_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Overwrite";
- ot->idname= "TEXT_OT_overwrite_toggle";
- ot->description= "Toggle overwrite while typing";
+ ot->name = "Toggle Overwrite";
+ ot->idname = "TEXT_OT_overwrite_toggle";
+ ot->description = "Toggle overwrite while typing";
/* api callbacks */
- ot->exec= text_toggle_overwrite_exec;
- ot->poll= text_space_edit_poll;
+ ot->exec = text_toggle_overwrite_exec;
+ ot->poll = text_space_edit_poll;
}
/******************* scroll operator **********************/
@@ -2070,8 +2082,8 @@ static void txt_screen_skip(SpaceText *st, ARegion *ar, int lines)
last= text_get_total_lines(st, ar);
last= last - (st->viewlines/2);
- if(st->top>last) st->top= last;
- if(st->top<0) st->top= 0;
+ if (st->top>last) st->top= last;
+ if (st->top<0) st->top= 0;
}
/* quick enum for tsc->zone (scroller handles) */
@@ -2104,7 +2116,7 @@ static int text_scroll_exec(bContext *C, wmOperator *op)
int lines= RNA_int_get(op->ptr, "lines");
- if(lines == 0)
+ if (lines == 0)
return OPERATOR_CANCELLED;
txt_screen_skip(st, ar, lines*U.wheellinescroll);
@@ -2124,7 +2136,7 @@ static void text_scroll_apply(bContext *C, wmOperator *op, wmEvent *event)
text_update_character_width(st);
- if(tsc->first) {
+ if (tsc->first) {
tsc->old[0]= mval[0];
tsc->old[1]= mval[1];
tsc->first= 0;
@@ -2133,7 +2145,7 @@ static void text_scroll_apply(bContext *C, wmOperator *op, wmEvent *event)
tsc->delta[0]+= mval[0] - tsc->old[0];
tsc->delta[1]+= mval[1] - tsc->old[1];
- if(!tsc->scrollbar) {
+ if (!tsc->scrollbar) {
txtdelta[0]= -tsc->delta[0]/st->cwidth;
txtdelta[1]= tsc->delta[1]/st->lheight;
@@ -2145,15 +2157,15 @@ static void text_scroll_apply(bContext *C, wmOperator *op, wmEvent *event)
tsc->delta[1]+= txtdelta[1]/st->pix_per_line;
}
- if(txtdelta[0] || txtdelta[1]) {
+ if (txtdelta[0] || txtdelta[1]) {
txt_screen_skip(st, ar, txtdelta[1]);
- if(st->wordwrap) {
+ if (st->wordwrap) {
st->left= 0;
}
else {
st->left+= txtdelta[0];
- if(st->left<0) st->left= 0;
+ if (st->left<0) st->left= 0;
}
ED_area_tag_redraw(CTX_wm_area(C));
@@ -2179,13 +2191,13 @@ static int text_scroll_modal(bContext *C, wmOperator *op, wmEvent *event)
switch(event->type) {
case MOUSEMOVE:
- if(tsc->zone == SCROLLHANDLE_BAR)
+ if (tsc->zone == SCROLLHANDLE_BAR)
text_scroll_apply(C, op, event);
break;
case LEFTMOUSE:
case RIGHTMOUSE:
case MIDDLEMOUSE:
- if(ELEM(tsc->zone, SCROLLHANDLE_MIN_OUTSIDE, SCROLLHANDLE_MAX_OUTSIDE)) {
+ if (ELEM(tsc->zone, SCROLLHANDLE_MIN_OUTSIDE, SCROLLHANDLE_MAX_OUTSIDE)) {
int last;
st->top+= st->viewlines * (tsc->zone==SCROLLHANDLE_MIN_OUTSIDE ? 1 : -1);
@@ -2216,7 +2228,7 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
SpaceText *st= CTX_wm_space_text(C);
TextScroll *tsc;
- if(RNA_struct_property_is_set(op->ptr, "lines"))
+ if (RNA_struct_property_is_set(op->ptr, "lines"))
return text_scroll_exec(C, op);
tsc= MEM_callocN(sizeof(TextScroll), "TextScroll");
@@ -2249,22 +2261,22 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
void TEXT_OT_scroll(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Scroll";
+ ot->name = "Scroll";
/* don't really see the difference between this and
* scroll_bar. Both do basically the same thing (aside
* from keymaps).*/
- ot->idname= "TEXT_OT_scroll";
- ot->description= "Scroll text screen";
+ ot->idname = "TEXT_OT_scroll";
+ ot->description = "Scroll text screen";
/* api callbacks */
- ot->exec= text_scroll_exec;
- ot->invoke= text_scroll_invoke;
- ot->modal= text_scroll_modal;
- ot->cancel= text_scroll_cancel;
- ot->poll= text_scroll_poll;
+ ot->exec = text_scroll_exec;
+ ot->invoke = text_scroll_invoke;
+ ot->modal = text_scroll_modal;
+ ot->cancel = text_scroll_cancel;
+ ot->poll = text_scroll_poll;
/* flags */
- ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
/* properties */
RNA_def_int(ot->srna, "lines", 1, INT_MIN, INT_MAX, "Lines", "Number of lines to scroll", -100, 100);
@@ -2279,10 +2291,10 @@ static int text_region_scroll_poll(bContext *C)
Text *text= CTX_data_edit_text(C);
ARegion *ar= CTX_wm_region(C);
- if(!st || !text)
+ if (!st || !text)
return 0;
- if(!ar || ar->regiontype != RGN_TYPE_WINDOW)
+ if (!ar || ar->regiontype != RGN_TYPE_WINDOW)
return 0;
return 1;
@@ -2296,22 +2308,22 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
const int *mval= event->mval;
int zone= -1;
- if(RNA_struct_property_is_set(op->ptr, "lines"))
+ if (RNA_struct_property_is_set(op->ptr, "lines"))
return text_scroll_exec(C, op);
/* verify we are in the right zone */
- if(mval[0]>st->txtbar.xmin && mval[0]<st->txtbar.xmax) {
- if(mval[1]>=st->txtbar.ymin && mval[1]<=st->txtbar.ymax) {
+ if (mval[0]>st->txtbar.xmin && mval[0]<st->txtbar.xmax) {
+ if (mval[1]>=st->txtbar.ymin && mval[1]<=st->txtbar.ymax) {
/* mouse inside scroll handle */
zone = SCROLLHANDLE_BAR;
}
- else if(mval[1]>TXT_SCROLL_SPACE && mval[1]<ar->winy-TXT_SCROLL_SPACE) {
- if(mval[1]<st->txtbar.ymin) zone= SCROLLHANDLE_MIN_OUTSIDE;
+ else if (mval[1]>TXT_SCROLL_SPACE && mval[1]<ar->winy-TXT_SCROLL_SPACE) {
+ if (mval[1]<st->txtbar.ymin) zone= SCROLLHANDLE_MIN_OUTSIDE;
else zone= SCROLLHANDLE_MAX_OUTSIDE;
}
}
- if(zone == -1) {
+ if (zone == -1) {
/* we are outside slider - nothing to do */
return OPERATOR_PASS_THROUGH;
}
@@ -2343,21 +2355,21 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
void TEXT_OT_scroll_bar(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Scrollbar";
+ ot->name = "Scrollbar";
/* don't really see the difference between this and
* scroll. Both do basically the same thing (aside
* from keymaps).*/
- ot->idname= "TEXT_OT_scroll_bar";
- ot->description= "Scroll text screen";
+ ot->idname = "TEXT_OT_scroll_bar";
+ ot->description = "Scroll text screen";
/* api callbacks */
- ot->invoke= text_scroll_bar_invoke;
- ot->modal= text_scroll_modal;
- ot->cancel= text_scroll_cancel;
- ot->poll= text_region_scroll_poll;
+ ot->invoke = text_scroll_bar_invoke;
+ ot->modal = text_scroll_modal;
+ ot->cancel = text_scroll_cancel;
+ ot->poll = text_region_scroll_poll;
/* flags */
- ot->flag= OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_BLOCKING;
/* properties */
RNA_def_int(ot->srna, "lines", 1, INT_MIN, INT_MAX, "Lines", "Number of lines to scroll", -100, 100);
@@ -2375,8 +2387,8 @@ static int flatten_len(SpaceText *st, const char *str)
{
int i, total = 0;
- for(i = 0; str[i]; i += BLI_str_utf8_size(str+i)) {
- if(str[i]=='\t') {
+ for (i = 0; str[i]; i += BLI_str_utf8_size(str+i)) {
+ if (str[i]=='\t') {
total += st->tabnumber - total%st->tabnumber;
}
else total++;
@@ -2389,7 +2401,7 @@ static int flatten_index_to_offset(SpaceText *st, const char *str, int index)
{
int i, j;
for (i= 0, j= 0; i < index; j += BLI_str_utf8_size(str+j))
- if(str[j]=='\t')
+ if (str[j]=='\t')
i += st->tabnumber - i%st->tabnumber;
else
i++;
@@ -2407,7 +2419,8 @@ static TextLine *get_first_visible_line(SpaceText *st, ARegion *ar, int *y)
if (i-lines < 0) {
*y += i;
break;
- } else {
+ }
+ else {
linep = linep->next;
i -= lines;
}
@@ -2426,7 +2439,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
/* Point to first visible line */
TextLine *linep = get_first_visible_line(st, ar, &y);
- while(loop && linep) {
+ while (loop && linep) {
int i = 0, start = 0, end = max; /* view */
int j = 0, curs = 0, endj = 0; /* mem */
int chop = 1; /* flags */
@@ -2436,7 +2449,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
/* Mimic replacement of tabs */
ch = linep->line[j];
- if(ch == '\t') {
+ if (ch == '\t') {
chars = st->tabnumber - i%st->tabnumber;
ch = ' ';
}
@@ -2457,7 +2470,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
found = 1;
/* Prepare curs for next wrap */
}
- else if(i - end == x) {
+ else if (i - end == x) {
curs = j;
}
if (i - start >= max) {
@@ -2469,11 +2482,11 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
break;
}
- if(chop) endj = j;
+ if (chop) endj = j;
start = end;
end += max;
- if(j < linep->len)
+ if (j < linep->len)
y--;
chop = 1;
@@ -2489,7 +2502,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
break;
}
- if(y == 0 && i-start >= x) {
+ if (y == 0 && i-start >= x) {
charp = curs;
loop = 0;
break;
@@ -2501,12 +2514,12 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
i++;
}
- if(ch == '\0') break;
+ if (ch == '\0') break;
}
- if(!loop || found) break;
+ if (!loop || found) break;
- if(!linep->next) {
+ if (!linep->next) {
charp = linep->len;
break;
}
@@ -2522,7 +2535,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
}
if (linep && charp != -1) {
- if(sel) { text->sell = linep; text->selc = charp; }
+ if (sel) { text->sell = linep; text->selc = charp; }
else { text->curl = linep; text->curc = charp; }
}
}
@@ -2533,13 +2546,13 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int
text_update_character_width(st);
y= (ar->winy - 2 - y)/st->lheight;
- if(st->showlinenrs) x-= TXT_OFFSET+TEXTXLOC;
+ if (st->showlinenrs) x-= TXT_OFFSET+TEXTXLOC;
else x-= TXT_OFFSET;
- if(x<0) x= 0;
+ if (x<0) x= 0;
x = text_pixel_x_to_index(st, x) + st->left;
- if(st->wordwrap) {
+ if (st->wordwrap) {
text_cursor_set_to_pos_wrapped(st, ar, x, y, sel);
}
else {
@@ -2547,24 +2560,24 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int
int *charp;
int w;
- if(sel) { linep= &text->sell; charp= &text->selc; }
+ if (sel) { linep= &text->sell; charp= &text->selc; }
else { linep= &text->curl; charp= &text->curc; }
y-= txt_get_span(text->lines.first, *linep) - st->top;
- if(y>0) {
- while(y-- != 0) if((*linep)->next) *linep= (*linep)->next;
+ if (y>0) {
+ while (y-- != 0) if ((*linep)->next) *linep= (*linep)->next;
}
- else if(y<0) {
- while(y++ != 0) if((*linep)->prev) *linep= (*linep)->prev;
+ else if (y<0) {
+ while (y++ != 0) if ((*linep)->prev) *linep= (*linep)->prev;
}
w= flatten_len(st, (*linep)->line);
- if(x<w) *charp= flatten_index_to_offset(st, (*linep)->line, x);
+ if (x<w) *charp= flatten_index_to_offset(st, (*linep)->line, x);
else *charp= (*linep)->len;
}
- if(!sel) txt_pop_sel(text);
+ if (!sel) txt_pop_sel(text);
}
static void text_cursor_set_apply(bContext *C, wmOperator *op, wmEvent *event)
@@ -2573,18 +2586,18 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, wmEvent *event)
ARegion *ar= CTX_wm_region(C);
SetSelection *ssel= op->customdata;
- if(event->mval[1]<0 || event->mval[1]>ar->winy) {
+ if (event->mval[1]<0 || event->mval[1]>ar->winy) {
int d= (ssel->old[1]-event->mval[1])*st->pix_per_line;
- if(d) txt_screen_skip(st, ar, d);
+ if (d) txt_screen_skip(st, ar, d);
text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1]<0?0:ar->winy, 1);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
}
- else if(!st->wordwrap && (event->mval[0]<0 || event->mval[0]>ar->winx)) {
- if(event->mval[0]>ar->winx) st->left++;
- else if(event->mval[0]<0 && st->left>0) st->left--;
+ else if (!st->wordwrap && (event->mval[0]<0 || event->mval[0]>ar->winx)) {
+ if (event->mval[0]>ar->winx) st->left++;
+ else if (event->mval[0]<0 && st->left>0) st->left--;
text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1], 1);
@@ -2611,7 +2624,7 @@ static void text_cursor_set_exit(bContext *C, wmOperator *op)
int linep2, charp2;
char *buffer;
- if(txt_has_sel(text)) {
+ if (txt_has_sel(text)) {
buffer = txt_sel_to_buf(text);
WM_clipboard_text_set(buffer, 1);
MEM_freeN(buffer);
@@ -2620,7 +2633,7 @@ static void text_cursor_set_exit(bContext *C, wmOperator *op)
linep2= txt_get_span(st->text->lines.first, st->text->sell);
charp2= st->text->selc;
- if(ssel->sell!=linep2 || ssel->selc!=charp2)
+ if (ssel->sell!=linep2 || ssel->selc!=charp2)
txt_undo_add_toop(st->text, UNDO_STO, ssel->sell, ssel->selc, linep2, charp2);
text_update_cursor_moved(C);
@@ -2634,7 +2647,7 @@ static int text_set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event
SpaceText *st= CTX_wm_space_text(C);
SetSelection *ssel;
- if(event->mval[0]>=st->txtbar.xmin)
+ if (event->mval[0]>=st->txtbar.xmin)
return OPERATOR_PASS_THROUGH;
op->customdata= MEM_callocN(sizeof(SetSelection), "SetCursor");
@@ -2679,15 +2692,15 @@ static int text_set_selection_cancel(bContext *C, wmOperator *op)
void TEXT_OT_selection_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Selection";
- ot->idname= "TEXT_OT_selection_set";
- ot->description= "Set cursor selection";
+ ot->name = "Set Selection";
+ ot->idname = "TEXT_OT_selection_set";
+ ot->description = "Set cursor selection";
/* api callbacks */
- ot->invoke= text_set_selection_invoke;
- ot->modal= text_set_selection_modal;
- ot->cancel= text_set_selection_cancel;
- ot->poll= text_region_edit_poll;
+ ot->invoke = text_set_selection_invoke;
+ ot->modal = text_set_selection_modal;
+ ot->cancel = text_set_selection_cancel;
+ ot->poll = text_region_edit_poll;
/* properties */
RNA_def_boolean(ot->srna, "select", 0, "Select", "Set selection end rather than cursor");
@@ -2721,7 +2734,7 @@ static int text_cursor_set_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceText *st= CTX_wm_space_text(C);
- if(event->mval[0]>=st->txtbar.xmin)
+ if (event->mval[0]>=st->txtbar.xmin)
return OPERATOR_PASS_THROUGH;
RNA_int_set(op->ptr, "x", event->mval[0]);
@@ -2733,14 +2746,14 @@ static int text_cursor_set_invoke(bContext *C, wmOperator *op, wmEvent *event)
void TEXT_OT_cursor_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Cursor";
- ot->idname= "TEXT_OT_cursor_set";
- ot->description= "Set cursor position";
+ ot->name = "Set Cursor";
+ ot->idname = "TEXT_OT_cursor_set";
+ ot->description = "Set cursor position";
/* api callbacks */
- ot->invoke= text_cursor_set_invoke;
- ot->exec= text_cursor_set_exec;
- ot->poll= text_region_edit_poll;
+ ot->invoke = text_cursor_set_invoke;
+ ot->exec = text_cursor_set_exec;
+ ot->poll = text_region_edit_poll;
/* properties */
RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
@@ -2761,17 +2774,17 @@ static int text_line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
text_update_character_width(st);
- if(!st->showlinenrs)
+ if (!st->showlinenrs)
return OPERATOR_PASS_THROUGH;
- if(!(mval[0]>2 && mval[0]<(TXT_OFFSET + TEXTXLOC) && mval[1]>2 && mval[1]<ar->winy-2))
+ if (!(mval[0]>2 && mval[0]<(TXT_OFFSET + TEXTXLOC) && mval[1]>2 && mval[1]<ar->winy-2))
return OPERATOR_PASS_THROUGH;
- if(!(event->ascii>='0' && event->ascii<='9'))
+ if (!(event->ascii>='0' && event->ascii<='9'))
return OPERATOR_PASS_THROUGH;
time = PIL_check_seconds_timer();
- if(last_jump < time-1)
+ if (last_jump < time-1)
jump_to= 0;
jump_to *= 10;
@@ -2789,13 +2802,13 @@ static int text_line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
void TEXT_OT_line_number(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Line Number";
- ot->idname= "TEXT_OT_line_number";
- ot->description= "The current line number";
+ ot->name = "Line Number";
+ ot->idname = "TEXT_OT_line_number";
+ ot->description = "The current line number";
/* api callbacks */
- ot->invoke= text_line_number_invoke;
- ot->poll= text_region_edit_poll;
+ ot->invoke = text_line_number_invoke;
+ ot->poll = text_region_edit_poll;
}
/******************* insert operator **********************/
@@ -2813,12 +2826,13 @@ static int text_insert_exec(bContext *C, wmOperator *op)
str= RNA_string_get_alloc(op->ptr, "text", NULL, 0);
- if(st && st->overwrite) {
+ if (st && st->overwrite) {
while (str[i]) {
code = BLI_str_utf8_as_unicode_step(str, &i);
done |= txt_replace_char(text, code);
}
- } else {
+ }
+ else {
while (str[i]) {
code = BLI_str_utf8_as_unicode_step(str, &i);
done |= txt_add_char(text, code);
@@ -2827,7 +2841,7 @@ static int text_insert_exec(bContext *C, wmOperator *op)
MEM_freeN(str);
- if(!done)
+ if (!done)
return OPERATOR_CANCELLED;
text_update_line_edited(text->curl);
@@ -2842,10 +2856,10 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
int ret;
- // if(!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
- if(!RNA_string_length(op->ptr, "text")) {
+ // if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
+ if (!RNA_string_length(op->ptr, "text")) {
/* if alt/ctrl/super are pressed pass through */
- if(event->ctrl || event->oskey) {
+ if (event->ctrl || event->oskey) {
return OPERATOR_PASS_THROUGH;
}
else {
@@ -2855,7 +2869,8 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (event->utf8_buf[0]) {
len = BLI_str_utf8_size(event->utf8_buf);
memcpy(str, event->utf8_buf, len);
- } else {
+ }
+ else {
/* in theory, ghost can set value to extended ascii here */
len = BLI_str_utf8_from_unicode(event->ascii, str);
}
@@ -2867,7 +2882,7 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
ret = text_insert_exec(C, op);
/* run the script while editing, evil but useful */
- if(ret==OPERATOR_FINISHED && CTX_wm_space_text(C)->live_edit)
+ if (ret==OPERATOR_FINISHED && CTX_wm_space_text(C)->live_edit)
text_run_script(C, NULL);
return ret;
@@ -2875,18 +2890,21 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
void TEXT_OT_insert(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
- ot->name= "Insert";
- ot->idname= "TEXT_OT_insert";
- ot->description= "Insert text at cursor position";
+ ot->name = "Insert";
+ ot->idname = "TEXT_OT_insert";
+ ot->description = "Insert text at cursor position";
/* api callbacks */
- ot->exec= text_insert_exec;
- ot->invoke= text_insert_invoke;
- ot->poll= text_edit_poll;
+ ot->exec = text_insert_exec;
+ ot->invoke = text_insert_invoke;
+ ot->poll = text_edit_poll;
/* properties */
- RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
+ prop = RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/******************* find operator *********************/
@@ -2905,18 +2923,18 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
int found = 0;
char *tmp;
- if(!st->findstr[0] || (mode == TEXT_REPLACE && !st->replacestr[0]))
+ if (!st->findstr[0] || (mode == TEXT_REPLACE && !st->replacestr[0]))
return OPERATOR_CANCELLED;
flags= st->flags;
- if(flags & ST_FIND_ALL)
+ if (flags & ST_FIND_ALL)
flags ^= ST_FIND_WRAP;
do {
int proceed= 0;
- if(first) {
- if(text->markers.first)
+ if (first) {
+ if (text->markers.first)
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
txt_clear_markers(text, TMARK_GRP_FINDALL, 0);
@@ -2925,16 +2943,16 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
first= 0;
/* Replace current */
- if(mode!=TEXT_FIND && txt_has_sel(text)) {
+ if (mode!=TEXT_FIND && txt_has_sel(text)) {
tmp= txt_sel_to_buf(text);
- if(flags & ST_MATCH_CASE) proceed= strcmp(st->findstr, tmp)==0;
+ if (flags & ST_MATCH_CASE) proceed= strcmp(st->findstr, tmp)==0;
else proceed= BLI_strcasecmp(st->findstr, tmp)==0;
- if(proceed) {
- if(mode==TEXT_REPLACE) {
+ if (proceed) {
+ if (mode==TEXT_REPLACE) {
txt_insert_buf(text, st->replacestr);
- if(text->curl && text->curl->format) {
+ if (text->curl && text->curl->format) {
MEM_freeN(text->curl->format);
text->curl->format= NULL;
}
@@ -2942,12 +2960,12 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
text_drawcache_tag_update(CTX_wm_space_text(C), 1);
}
- else if(mode==TEXT_MARK_ALL) {
+ else if (mode==TEXT_MARK_ALL) {
unsigned char color[4];
UI_GetThemeColor4ubv(TH_SHADE2, color);
- if(txt_find_marker(text, text->curl, text->selc, TMARK_GRP_FINDALL, 0)) {
- if(tmp) MEM_freeN(tmp), tmp=NULL;
+ if (txt_find_marker(text, text->curl, text->selc, TMARK_GRP_FINDALL, 0)) {
+ if (tmp) MEM_freeN(tmp), tmp=NULL;
break;
}
@@ -2961,14 +2979,14 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
}
/* Find next */
- if(txt_find_string(text, st->findstr, flags & ST_FIND_WRAP, flags & ST_MATCH_CASE)) {
+ if (txt_find_string(text, st->findstr, flags & ST_FIND_WRAP, flags & ST_MATCH_CASE)) {
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
}
- else if(flags & ST_FIND_ALL) {
- if(text==start) break;
- if(!start) start= text;
- if(text->id.next)
+ else if (flags & ST_FIND_ALL) {
+ if (text==start) break;
+ if (!start) start= text;
+ if (text->id.next)
text= st->text= text->id.next;
else
text= st->text= bmain->text.first;
@@ -2978,11 +2996,11 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
first= 1;
}
else {
- if(!found && !proceed) BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr);
+ if (!found && !proceed) BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr);
break;
}
found = 1;
- } while(mode==TEXT_MARK_ALL);
+ } while (mode==TEXT_MARK_ALL);
return OPERATOR_FINISHED;
}
@@ -2995,13 +3013,13 @@ static int text_find_exec(bContext *C, wmOperator *op)
void TEXT_OT_find(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Find";
- ot->idname= "TEXT_OT_find";
- ot->description= "Find specified text";
+ ot->name = "Find";
+ ot->idname = "TEXT_OT_find";
+ ot->description = "Find specified text";
/* api callbacks */
- ot->exec= text_find_exec;
- ot->poll= text_space_edit_poll;
+ ot->exec = text_find_exec;
+ ot->poll = text_space_edit_poll;
}
/******************* replace operator *********************/
@@ -3014,13 +3032,13 @@ static int text_replace_exec(bContext *C, wmOperator *op)
void TEXT_OT_replace(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Replace";
- ot->idname= "TEXT_OT_replace";
- ot->description= "Replace text with the specified text";
+ ot->name = "Replace";
+ ot->idname = "TEXT_OT_replace";
+ ot->description = "Replace text with the specified text";
/* api callbacks */
- ot->exec= text_replace_exec;
- ot->poll= text_space_edit_poll;
+ ot->exec = text_replace_exec;
+ ot->poll = text_space_edit_poll;
}
/******************* mark all operator *********************/
@@ -3033,13 +3051,13 @@ static int text_mark_all_exec(bContext *C, wmOperator *op)
void TEXT_OT_mark_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mark All";
- ot->idname= "TEXT_OT_mark_all";
- ot->description= "Mark all specified text";
+ ot->name = "Mark All";
+ ot->idname = "TEXT_OT_mark_all";
+ ot->description = "Mark all specified text";
/* api callbacks */
- ot->exec= text_mark_all_exec;
- ot->poll= text_space_edit_poll;
+ ot->exec = text_mark_all_exec;
+ ot->poll = text_space_edit_poll;
}
/******************* find set selected *********************/
@@ -3054,7 +3072,7 @@ static int text_find_set_selected_exec(bContext *C, wmOperator *op)
BLI_strncpy(st->findstr, tmp, ST_MAX_FIND_STR);
MEM_freeN(tmp);
- if(!st->findstr[0])
+ if (!st->findstr[0])
return OPERATOR_FINISHED;
return text_find_and_replace(C, op, TEXT_FIND);
@@ -3063,13 +3081,13 @@ static int text_find_set_selected_exec(bContext *C, wmOperator *op)
void TEXT_OT_find_set_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Find Set Selected";
- ot->idname= "TEXT_OT_find_set_selected";
- ot->description= "Find specified text and set as selected";
+ ot->name = "Find Set Selected";
+ ot->idname = "TEXT_OT_find_set_selected";
+ ot->description = "Find specified text and set as selected";
/* api callbacks */
- ot->exec= text_find_set_selected_exec;
- ot->poll= text_space_edit_poll;
+ ot->exec = text_find_set_selected_exec;
+ ot->poll = text_space_edit_poll;
}
/******************* replace set selected *********************/
@@ -3090,13 +3108,13 @@ static int text_replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_replace_set_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Replace Set Selected";
- ot->idname= "TEXT_OT_replace_set_selected";
- ot->description= "Replace text with specified text and set as selected";
+ ot->name = "Replace Set Selected";
+ ot->idname = "TEXT_OT_replace_set_selected";
+ ot->description = "Replace text with specified text and set as selected";
/* api callbacks */
- ot->exec= text_replace_set_selected_exec;
- ot->poll= text_space_edit_poll;
+ ot->exec = text_replace_set_selected_exec;
+ ot->poll = text_space_edit_poll;
}
/****************** resolve conflict operator ******************/
@@ -3120,24 +3138,24 @@ int text_file_modified(Text *text)
int result;
char file[FILE_MAX];
- if(!text || !text->name)
+ if (!text || !text->name)
return 0;
BLI_strncpy(file, text->name, FILE_MAX);
BLI_path_abs(file, G.main->name);
- if(!BLI_exists(file))
+ if (!BLI_exists(file))
return 2;
result = stat(file, &st);
- if(result == -1)
+ if (result == -1)
return -1;
- if((st.st_mode & S_IFMT) != S_IFREG)
+ if ((st.st_mode & S_IFMT) != S_IFREG)
return -1;
- if(st.st_mtime > text->mtime)
+ if (st.st_mtime > text->mtime)
return 1;
return 0;
@@ -3149,16 +3167,16 @@ static void text_ignore_modified(Text *text)
int result;
char file[FILE_MAX];
- if(!text || !text->name) return;
+ if (!text || !text->name) return;
BLI_strncpy(file, text->name, FILE_MAX);
BLI_path_abs(file, G.main->name);
- if(!BLI_exists(file)) return;
+ if (!BLI_exists(file)) return;
result = stat(file, &st);
- if(result == -1 || (st.st_mode & S_IFMT) != S_IFREG)
+ if (result == -1 || (st.st_mode & S_IFMT) != S_IFREG)
return;
text->mtime= st.st_mtime;
@@ -3192,7 +3210,7 @@ static int text_resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UN
switch(text_file_modified(text)) {
case 1:
- if(text->flags & TXT_ISDIRTY) {
+ if (text->flags & TXT_ISDIRTY) {
/* modified locally and externally, ahhh. offer more possibilites. */
pup= uiPupMenuBegin(C, "File Modified Outside and Inside Blender", ICON_NONE);
layout= uiPupMenuLayout(pup);
@@ -3225,14 +3243,14 @@ static int text_resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UN
void TEXT_OT_resolve_conflict(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Resolve Conflict";
- ot->idname= "TEXT_OT_resolve_conflict";
- ot->description= "When external text is out of sync, resolve the conflict";
+ ot->name = "Resolve Conflict";
+ ot->idname = "TEXT_OT_resolve_conflict";
+ ot->description = "When external text is out of sync, resolve the conflict";
/* api callbacks */
- ot->exec= text_resolve_conflict_exec;
- ot->invoke= text_resolve_conflict_invoke;
- ot->poll= text_save_poll;
+ ot->exec = text_resolve_conflict_exec;
+ ot->invoke = text_resolve_conflict_invoke;
+ ot->poll = text_save_poll;
/* properties */
RNA_def_enum(ot->srna, "resolution", resolution_items, RESOLVE_IGNORE, "Resolution", "How to solve conflict due to differences in internal and external text");
@@ -3253,16 +3271,16 @@ static int text_to_3d_object_exec(bContext *C, wmOperator *op)
void TEXT_OT_to_3d_object(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "To 3D Object";
- ot->idname= "TEXT_OT_to_3d_object";
- ot->description= "Create 3d text object from active text data block";
+ ot->name = "To 3D Object";
+ ot->idname = "TEXT_OT_to_3d_object";
+ ot->description = "Create 3d text object from active text data block";
/* api callbacks */
- ot->exec= text_to_3d_object_exec;
- ot->poll= text_edit_poll;
+ ot->exec = text_to_3d_object_exec;
+ ot->poll = text_edit_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "split_lines", 0, "Split Lines", "Create one object per line in the text");
@@ -3275,12 +3293,12 @@ void ED_text_undo_step(bContext *C, int step)
{
Text *text= CTX_data_edit_text(C);
- if(!text)
+ if (!text)
return;
- if(step==1)
+ if (step==1)
txt_do_undo(text);
- else if(step==-1)
+ else if (step==-1)
txt_do_redo(text);
text_update_edited(text);
diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c
index 88bd6b9c4c0..452f74e8826 100644
--- a/source/blender/editors/space_text/text_python.c
+++ b/source/blender/editors/space_text/text_python.c
@@ -55,24 +55,24 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar)
int tgti, *top;
int mval[2] = {0, 0};
- if(!st || !st->text) return 0;
- if(!texttool_text_is_active(st->text)) return 0;
+ if (!st || !st->text) return 0;
+ if (!texttool_text_is_active(st->text)) return 0;
first = texttool_suggest_first();
last = texttool_suggest_last();
/* sel = texttool_suggest_selected(); */ /* UNUSED */
top = texttool_suggest_top();
- if(!last || !first)
+ if (!last || !first)
return 0;
/* Count the visible lines to the cursor */
- for(tmp=st->text->curl, l=-st->top; tmp; tmp=tmp->prev, l++);
- if(l<0) return 0;
+ for (tmp=st->text->curl, l=-st->top; tmp; tmp=tmp->prev, l++);
+ if (l<0) return 0;
text_update_character_width(st);
- if(st->showlinenrs) {
+ if (st->showlinenrs) {
x = st->cwidth*(st->text->curc-st->left) + TXT_OFFSET + TEXTXLOC - 4;
}
else {
@@ -85,19 +85,19 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar)
// XXX getmouseco_areawin(mval);
- if(mval[0]<x || x+w<mval[0] || mval[1]<y-h || y<mval[1])
+ if (mval[0]<x || x+w<mval[0] || mval[1]<y-h || y<mval[1])
return 0;
/* Work out which of the items is at the top of the visible list */
- for(i=0, item=first; i<*top && item->next; i++, item=item->next);
+ for (i=0, item=first; i<*top && item->next; i++, item=item->next);
/* Work out the target item index in the visible list */
tgti = (y-mval[1]-4) / st->lheight;
- if(tgti<0 || tgti>SUGG_LIST_SIZE)
+ if (tgti<0 || tgti>SUGG_LIST_SIZE)
return 1;
- for(i=tgti; i>0 && item->next; i--, item=item->next);
- if(item)
+ for (i=tgti; i>0 && item->next; i--, item=item->next);
+ if (item)
texttool_suggest_select(item);
return 1;
}
@@ -112,13 +112,13 @@ void text_pop_suggest_list(void)
top= texttool_suggest_top();
i= 0;
- while(item && item != sel) {
+ while (item && item != sel) {
item= item->next;
i++;
}
- if(i > *top+SUGG_LIST_SIZE-1)
+ if (i > *top+SUGG_LIST_SIZE-1)
*top= i-SUGG_LIST_SIZE+1;
- else if(i < *top)
+ else if (i < *top)
*top= i;
}
@@ -127,16 +127,16 @@ static void get_suggest_prefix(Text *text, int offset)
int i, len;
char *line, tmp[256];
- if(!text) return;
- if(!texttool_text_is_active(text)) return;
+ if (!text) return;
+ if (!texttool_text_is_active(text)) return;
line= text->curl->line;
- for(i=text->curc-1+offset; i>=0; i--)
- if(!text_check_identifier(line[i]))
+ for (i=text->curc-1+offset; i>=0; i--)
+ if (!text_check_identifier(line[i]))
break;
i++;
len= text->curc-i+offset;
- if(len > 255) {
+ if (len > 255) {
printf("Suggestion prefix too long\n");
len = 255;
}
@@ -151,29 +151,29 @@ static void confirm_suggestion(Text *text, int skipleft)
int i, over=0;
char *line;
- if(!text) return;
- if(!texttool_text_is_active(text)) return;
+ if (!text) return;
+ if (!texttool_text_is_active(text)) return;
sel = texttool_suggest_selected();
- if(!sel) return;
+ if (!sel) return;
line= text->curl->line;
i=text->curc-skipleft-1;
- while(i>=0) {
- if(!text_check_identifier(line[i]))
+ while (i>=0) {
+ if (!text_check_identifier(line[i]))
break;
over++;
i--;
}
- for(i=0; i<skipleft; i++)
+ for (i=0; i<skipleft; i++)
txt_move_left(text, 0);
- for(i=0; i<over; i++)
+ for (i=0; i<over; i++)
txt_move_left(text, 1);
txt_insert_buf(text, sel->name);
- for(i=0; i<skipleft; i++)
+ for (i=0; i<skipleft; i++)
txt_move_right(text, 0);
texttool_text_clear();
@@ -196,78 +196,78 @@ static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned s
ARegion *ar= NULL; // XXX
int qual= 0; // XXX
int draw=0, tools=0, swallow=0, scroll=1;
- if(!texttool_text_is_active(st->text)) return 0;
- if(!st->text || st->text->id.lib) return 0;
+ if (!texttool_text_is_active(st->text)) return 0;
+ if (!st->text || st->text->id.lib) return 0;
- if(st->doplugins && texttool_text_is_active(st->text)) {
- if(texttool_suggest_first()) tools |= TOOL_SUGG_LIST;
- if(texttool_docs_get()) tools |= TOOL_DOCUMENT;
+ if (st->doplugins && texttool_text_is_active(st->text)) {
+ if (texttool_suggest_first()) tools |= TOOL_SUGG_LIST;
+ if (texttool_docs_get()) tools |= TOOL_DOCUMENT;
}
- if(ascii) {
- if(tools & TOOL_SUGG_LIST) {
- if((ascii != '_' && ascii != '*' && ispunct(ascii)) || text_check_whitespace(ascii)) {
+ if (ascii) {
+ if (tools & TOOL_SUGG_LIST) {
+ if ((ascii != '_' && ascii != '*' && ispunct(ascii)) || text_check_whitespace(ascii)) {
confirm_suggestion(st->text, 0);
text_update_line_edited(st->text->curl);
}
- else if((st->overwrite && txt_replace_char(st->text, ascii)) || txt_add_char(st->text, ascii)) {
+ else if ((st->overwrite && txt_replace_char(st->text, ascii)) || txt_add_char(st->text, ascii)) {
get_suggest_prefix(st->text, 0);
text_pop_suggest_list();
swallow= 1;
draw= 1;
}
}
- if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0, draw= 1;
+ if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0, draw= 1;
}
- else if(val==1 && evnt) {
+ else if (val==1 && evnt) {
switch (evnt) {
case LEFTMOUSE:
- if(text_do_suggest_select(st, ar))
+ if (text_do_suggest_select(st, ar))
swallow= 1;
else {
- if(tools & TOOL_SUGG_LIST) texttool_suggest_clear();
- if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
+ if (tools & TOOL_SUGG_LIST) texttool_suggest_clear();
+ if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
}
draw= 1;
break;
case MIDDLEMOUSE:
- if(text_do_suggest_select(st, ar)) {
+ if (text_do_suggest_select(st, ar)) {
confirm_suggestion(st->text, 0);
text_update_line_edited(st->text->curl);
swallow= 1;
}
else {
- if(tools & TOOL_SUGG_LIST) texttool_suggest_clear();
- if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
+ if (tools & TOOL_SUGG_LIST) texttool_suggest_clear();
+ if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
}
draw= 1;
break;
case ESCKEY:
draw= swallow= 1;
- if(tools & TOOL_SUGG_LIST) texttool_suggest_clear();
- else if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
+ if (tools & TOOL_SUGG_LIST) texttool_suggest_clear();
+ else if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
else draw= swallow= 0;
break;
case RETKEY:
- if(tools & TOOL_SUGG_LIST) {
+ if (tools & TOOL_SUGG_LIST) {
confirm_suggestion(st->text, 0);
text_update_line_edited(st->text->curl);
swallow= 1;
draw= 1;
}
- if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0, draw= 1;
+ if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0, draw= 1;
break;
case LEFTARROWKEY:
case BACKSPACEKEY:
- if(tools & TOOL_SUGG_LIST) {
- if(qual)
+ if (tools & TOOL_SUGG_LIST) {
+ if (qual)
texttool_suggest_clear();
else {
/* Work out which char we are about to delete/pass */
- if(st->text->curl && st->text->curc > 0) {
+ if (st->text->curl && st->text->curc > 0) {
char ch= st->text->curl->line[st->text->curc-1];
- if((ch=='_' || !ispunct(ch)) && !text_check_whitespace(ch)) {
+ if ((ch=='_' || !ispunct(ch)) && !text_check_whitespace(ch)) {
get_suggest_prefix(st->text, -1);
text_pop_suggest_list();
}
@@ -278,17 +278,17 @@ static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned s
texttool_suggest_clear();
}
}
- if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
+ if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
break;
case RIGHTARROWKEY:
- if(tools & TOOL_SUGG_LIST) {
- if(qual)
+ if (tools & TOOL_SUGG_LIST) {
+ if (qual)
texttool_suggest_clear();
else {
/* Work out which char we are about to pass */
- if(st->text->curl && st->text->curc < st->text->curl->len) {
+ if (st->text->curl && st->text->curc < st->text->curl->len) {
char ch= st->text->curl->line[st->text->curc+1];
- if((ch=='_' || !ispunct(ch)) && !text_check_whitespace(ch)) {
+ if ((ch=='_' || !ispunct(ch)) && !text_check_whitespace(ch)) {
get_suggest_prefix(st->text, 1);
text_pop_suggest_list();
}
@@ -299,24 +299,24 @@ static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned s
texttool_suggest_clear();
}
}
- if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
+ if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
break;
case PAGEDOWNKEY:
scroll= SUGG_LIST_SIZE-1;
case WHEELDOWNMOUSE:
case DOWNARROWKEY:
- if(tools & TOOL_DOCUMENT) {
+ if (tools & TOOL_DOCUMENT) {
doc_scroll++;
swallow= 1;
draw= 1;
break;
}
- else if(tools & TOOL_SUGG_LIST) {
+ else if (tools & TOOL_SUGG_LIST) {
SuggItem *sel = texttool_suggest_selected();
- if(!sel) {
+ if (!sel) {
texttool_suggest_select(texttool_suggest_first());
}
- else while(sel && sel!=texttool_suggest_last() && sel->next && scroll--) {
+ else while (sel && sel!=texttool_suggest_last() && sel->next && scroll--) {
texttool_suggest_select(sel->next);
sel= sel->next;
}
@@ -329,15 +329,15 @@ static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned s
scroll= SUGG_LIST_SIZE-1;
case WHEELUPMOUSE:
case UPARROWKEY:
- if(tools & TOOL_DOCUMENT) {
- if(doc_scroll>0) doc_scroll--;
+ if (tools & TOOL_DOCUMENT) {
+ if (doc_scroll>0) doc_scroll--;
swallow= 1;
draw= 1;
break;
}
- else if(tools & TOOL_SUGG_LIST) {
+ else if (tools & TOOL_SUGG_LIST) {
SuggItem *sel = texttool_suggest_selected();
- while(sel && sel!=texttool_suggest_first() && sel->prev && scroll--) {
+ while (sel && sel!=texttool_suggest_first() && sel->prev && scroll--) {
texttool_suggest_select(sel->prev);
sel= sel->prev;
}
@@ -350,8 +350,8 @@ static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned s
case LEFTSHIFTKEY:
break;
default:
- if(tools & TOOL_SUGG_LIST) texttool_suggest_clear(), draw= 1;
- if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0, draw= 1;
+ if (tools & TOOL_SUGG_LIST) texttool_suggest_clear(), draw= 1;
+ if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0, draw= 1;
}
}
@@ -365,13 +365,13 @@ static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned s
#if 0
#ifdef WITH_PYTHON
/* Run text plugin scripts if enabled */
- if(st->doplugins && event && val) {
- if(BPY_menu_do_shortcut(PYMENU_TEXTPLUGIN, event, qual)) {
+ if (st->doplugins && event && val) {
+ if (BPY_menu_do_shortcut(PYMENU_TEXTPLUGIN, event, qual)) {
do_draw= 1;
}
}
#endif
- if(do_draw)
+ if (do_draw)
; // XXX redraw_alltext();
#endif
@@ -383,26 +383,26 @@ static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned
int qual= 0; // XXX
text= st->text;
- if(!text || text->id.lib || text->curl != text->sell) return 0;
+ if (!text || text->id.lib || text->curl != text->sell) return 0;
marker= txt_find_marker(text, text->sell, text->selc, 0, 0);
- if(marker && (marker->start > text->curc || marker->end < text->curc))
+ if (marker && (marker->start > text->curc || marker->end < text->curc))
marker= NULL;
- if(!marker) {
+ if (!marker) {
/* Find the next temporary marker */
- if(evnt==TABKEY) {
+ if (evnt==TABKEY) {
int lineno= txt_get_span(text->lines.first, text->curl);
mrk= text->markers.first;
- while(mrk) {
- if(!marker && (mrk->flags & TMARK_TEMP)) marker= mrk;
- if((mrk->flags & TMARK_TEMP) && (mrk->lineno > lineno || (mrk->lineno==lineno && mrk->end > text->curc))) {
+ while (mrk) {
+ if (!marker && (mrk->flags & TMARK_TEMP)) marker= mrk;
+ if ((mrk->flags & TMARK_TEMP) && (mrk->lineno > lineno || (mrk->lineno==lineno && mrk->end > text->curc))) {
marker= mrk;
break;
}
mrk= mrk->next;
}
- if(marker) {
+ if (marker) {
txt_move_to(text, marker->lineno, marker->start, 0);
txt_move_to(text, marker->lineno, marker->end, 1);
// XXX text_update_cursor_moved(C);
@@ -412,60 +412,60 @@ static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned
swallow= 1;
}
}
- else if(evnt==ESCKEY) {
- if(txt_clear_markers(text, 0, TMARK_TEMP)) swallow= 1;
- else if(txt_clear_markers(text, 0, 0)) swallow= 1;
+ else if (evnt==ESCKEY) {
+ if (txt_clear_markers(text, 0, TMARK_TEMP)) swallow= 1;
+ else if (txt_clear_markers(text, 0, 0)) swallow= 1;
else return 0;
evnt= ascii= val= 0;
draw= 1;
}
- if(!swallow) return 0;
+ if (!swallow) return 0;
}
- if(ascii) {
- if(marker->flags & TMARK_EDITALL) {
+ if (ascii) {
+ if (marker->flags & TMARK_EDITALL) {
c= text->curc-marker->start;
s= text->selc-marker->start;
- if(s<0 || s>marker->end-marker->start) return 0;
+ if (s<0 || s>marker->end-marker->start) return 0;
mrk= txt_next_marker(text, marker);
- while(mrk) {
+ while (mrk) {
nxt=txt_next_marker(text, mrk); /* mrk may become invalid */
txt_move_to(text, mrk->lineno, mrk->start+c, 0);
- if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1);
- if(st->overwrite) {
- if(txt_replace_char(text, ascii))
+ if (s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1);
+ if (st->overwrite) {
+ if (txt_replace_char(text, ascii))
text_update_line_edited(st->text->curl);
}
else {
- if(txt_add_char(text, ascii)) {
+ if (txt_add_char(text, ascii)) {
text_update_line_edited(st->text->curl);
}
}
- if(mrk==marker || mrk==nxt) break;
+ if (mrk==marker || mrk==nxt) break;
mrk=nxt;
}
swallow= 1;
draw= 1;
}
}
- else if(val) {
+ else if (val) {
switch(evnt) {
case BACKSPACEKEY:
- if(marker->flags & TMARK_EDITALL) {
+ if (marker->flags & TMARK_EDITALL) {
c= text->curc-marker->start;
s= text->selc-marker->start;
- if(s<0 || s>marker->end-marker->start) return 0;
+ if (s<0 || s>marker->end-marker->start) return 0;
mrk= txt_next_marker(text, marker);
- while(mrk) {
+ while (mrk) {
nxt= txt_next_marker(text, mrk); /* mrk may become invalid */
txt_move_to(text, mrk->lineno, mrk->start+c, 0);
- if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1);
+ if (s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1);
txt_backspace_char(text);
text_update_line_edited(st->text->curl);
- if(mrk==marker || mrk==nxt) break;
+ if (mrk==marker || mrk==nxt) break;
mrk= nxt;
}
swallow= 1;
@@ -473,19 +473,19 @@ static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned
}
break;
case DELKEY:
- if(marker->flags & TMARK_EDITALL) {
+ if (marker->flags & TMARK_EDITALL) {
c= text->curc-marker->start;
s= text->selc-marker->start;
- if(s<0 || s>marker->end-marker->start) return 0;
+ if (s<0 || s>marker->end-marker->start) return 0;
mrk= txt_next_marker(text, marker);
- while(mrk) {
+ while (mrk) {
nxt= txt_next_marker(text, mrk); /* mrk may become invalid */
txt_move_to(text, mrk->lineno, mrk->start+c, 0);
- if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1);
+ if (s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1);
txt_delete_char(text);
text_update_line_edited(st->text->curl);
- if(mrk==marker || mrk==nxt) break;
+ if (mrk==marker || mrk==nxt) break;
mrk= nxt;
}
swallow= 1;
@@ -493,20 +493,20 @@ static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned
}
break;
case TABKEY:
- if(qual & LR_SHIFTKEY) {
+ if (qual & LR_SHIFTKEY) {
nxt= marker->prev;
- if(!nxt) nxt= text->markers.last;
+ if (!nxt) nxt= text->markers.last;
}
else {
nxt= marker->next;
- if(!nxt) nxt= text->markers.first;
+ if (!nxt) nxt= text->markers.first;
}
- if(marker->flags & TMARK_TEMP) {
- if(nxt==marker) nxt= NULL;
+ if (marker->flags & TMARK_TEMP) {
+ if (nxt==marker) nxt= NULL;
BLI_freelinkN(&text->markers, marker);
}
mrk= nxt;
- if(mrk) {
+ if (mrk) {
txt_move_to(text, mrk->lineno, mrk->start, 0);
txt_move_to(text, mrk->lineno, mrk->end, 1);
// XXX text_update_cursor_moved(C);
@@ -517,11 +517,11 @@ static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned
break;
/* Events that should clear markers */
- case UKEY: if(!(qual & LR_ALTKEY)) break;
- case ZKEY: if(evnt==ZKEY && !(qual & LR_CTRLKEY)) break;
+ case UKEY: if (!(qual & LR_ALTKEY)) break;
+ case ZKEY: if (evnt==ZKEY && !(qual & LR_CTRLKEY)) break;
case RETKEY:
case ESCKEY:
- if(marker->flags & (TMARK_EDITALL | TMARK_TEMP))
+ if (marker->flags & (TMARK_EDITALL | TMARK_TEMP))
txt_clear_markers(text, marker->group, 0);
else
BLI_freelinkN(&text->markers, marker);
@@ -532,11 +532,11 @@ static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned
case LEFTMOUSE:
break;
case FKEY: /* Allow find */
- if(qual & LR_SHIFTKEY) swallow= 1;
+ if (qual & LR_SHIFTKEY) swallow= 1;
break;
default:
- if(qual!=0 && qual!=LR_SHIFTKEY)
+ if (qual!=0 && qual!=LR_SHIFTKEY)
swallow= 1; /* Swallow all other shortcut events */
}
}
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index bf1b1ddc18a..5e56dfa728e 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -106,7 +106,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob)
/* iterate over pointcaches on the active object,
* add spacetimecache and vertex array for each */
- for(pid=pidlist.first; pid; pid=pid->next) {
+ for (pid=pidlist.first; pid; pid=pid->next) {
float col[4], *fp;
int i, sta = pid->cache->startframe, end = pid->cache->endframe;
int len = (end - sta + 1)*4;
@@ -130,12 +130,12 @@ static void time_draw_cache(SpaceTime *stime, Object *ob)
break;
}
- if(pid->cache->cached_frames == NULL)
+ if (pid->cache->cached_frames == NULL)
continue;
/* make sure we have stc with correct array length */
- if(stc == NULL || MEM_allocN_len(stc->array) != len*2*sizeof(float)) {
- if(stc) {
+ if (stc == NULL || MEM_allocN_len(stc->array) != len*2*sizeof(float)) {
+ if (stc) {
MEM_freeN(stc->array);
}
else {
@@ -227,7 +227,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob)
BLI_freelistN(&pidlist);
/* free excessive caches */
- while(stc) {
+ while (stc) {
SpaceTimeCache *tmp = stc->next;
BLI_remlink(&stime->caches, stc);
MEM_freeN(stc->array);
@@ -380,7 +380,7 @@ static void time_refresh(const bContext *UNUSED(C), ScrArea *sa)
{
/* find the main timeline region and refresh cache display*/
ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if(ar) {
+ if (ar) {
SpaceTime *stime = (SpaceTime *)sa->spacedata.first;
time_cache_refresh(stime);
}
@@ -416,8 +416,8 @@ static void time_listener(ScrArea *sa, wmNotifier *wmn)
for (ar= sa->regionbase.first; ar; ar= ar->next) {
if (ar->regiontype==RGN_TYPE_WINDOW) {
- ar->v2d.tot.xmin= (float)(SFRA - 4);
- ar->v2d.tot.xmax= (float)(EFRA + 4);
+ ar->v2d.tot.xmin = (float)(SFRA - 4);
+ ar->v2d.tot.xmax = (float)(EFRA + 4);
break;
}
}
@@ -449,7 +449,7 @@ static void time_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Timeline", SPACE_TIME, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Timeline", SPACE_TIME, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -511,7 +511,7 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch(wmn->category) {
case NC_SPACE:
- if(wmn->data == ND_SPACE_TIME)
+ if (wmn->data == ND_SPACE_TIME)
ED_region_tag_redraw(ar);
break;
@@ -551,7 +551,7 @@ static void time_header_area_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch(wmn->category) {
case NC_SCREEN:
- if(wmn->data==ND_ANIMPLAY)
+ if (wmn->data==ND_ANIMPLAY)
ED_region_tag_redraw(ar);
break;
@@ -567,7 +567,7 @@ static void time_header_area_listener(ARegion *ar, wmNotifier *wmn)
}
case NC_SPACE:
- if(wmn->data == ND_SPACE_TIME)
+ if (wmn->data == ND_SPACE_TIME)
ED_region_tag_redraw(ar);
break;
}
@@ -599,10 +599,10 @@ static SpaceLink *time_new(const bContext *C)
BLI_addtail(&stime->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin= (float)(SFRA - 4);
- ar->v2d.tot.ymin= 0.0f;
- ar->v2d.tot.xmax= (float)(EFRA + 4);
- ar->v2d.tot.ymax= 50.0f;
+ ar->v2d.tot.xmin = (float)(SFRA - 4);
+ ar->v2d.tot.ymin = 0.0f;
+ ar->v2d.tot.xmax = (float)(EFRA + 4);
+ ar->v2d.tot.ymax = 50.0f;
ar->v2d.cur= ar->v2d.tot;
diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c
index 78d903a2997..3eaf2b8100e 100644
--- a/source/blender/editors/space_time/time_ops.c
+++ b/source/blender/editors/space_time/time_ops.c
@@ -56,17 +56,20 @@ static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
frame= CFRA;
- /* if 'end frame' (Preview Range or Actual) is less than 'frame',
- * clamp 'frame' to 'end frame'
- */
- if (PEFRA < frame) frame= PEFRA;
-
+
/* if Preview Range is defined, set the 'start' frame for that */
if (PRVRANGEON)
scene->r.psfra= frame;
else
scene->r.sfra= frame;
+ if (PEFRA < frame) {
+ if (PRVRANGEON)
+ scene->r.pefra= frame;
+ else
+ scene->r.efra= frame;
+ }
+
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
return OPERATOR_FINISHED;
@@ -75,16 +78,16 @@ static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op))
static void TIME_OT_start_frame_set (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Start Frame";
- ot->idname= "TIME_OT_start_frame_set";
- ot->description="Set the start frame";
+ ot->name = "Set Start Frame";
+ ot->idname = "TIME_OT_start_frame_set";
+ ot->description = "Set the start frame";
/* api callbacks */
- ot->exec= time_set_sfra_exec;
- ot->poll= ED_operator_timeline_active;
+ ot->exec = time_set_sfra_exec;
+ ot->poll = ED_operator_timeline_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -98,16 +101,18 @@ static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op))
frame= CFRA;
- /* if 'start frame' (Preview Range or Actual) is greater than 'frame',
- * clamp 'frame' to 'end frame'
- */
- if (PSFRA > frame) frame= PSFRA;
-
/* if Preview Range is defined, set the 'end' frame for that */
if (PRVRANGEON)
scene->r.pefra= frame;
else
scene->r.efra= frame;
+
+ if (PSFRA > frame) {
+ if (PRVRANGEON)
+ scene->r.psfra= frame;
+ else
+ scene->r.sfra= frame;
+ }
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
@@ -117,16 +122,16 @@ static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op))
static void TIME_OT_end_frame_set (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set End Frame";
- ot->idname= "TIME_OT_end_frame_set";
- ot->description="Set the end frame";
+ ot->name = "Set End Frame";
+ ot->idname = "TIME_OT_end_frame_set";
+ ot->description = "Set the end frame";
/* api callbacks */
- ot->exec= time_set_efra_exec;
- ot->poll= ED_operator_timeline_active;
+ ot->exec = time_set_efra_exec;
+ ot->poll = ED_operator_timeline_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************ View All Operator *******************************/
@@ -142,8 +147,8 @@ static int time_view_all_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* set extents of view to start/end frames (Preview Range too) */
- v2d->cur.xmin= (float)PSFRA;
- v2d->cur.xmax= (float)PEFRA;
+ v2d->cur.xmin = (float)PSFRA;
+ v2d->cur.xmax = (float)PEFRA;
/* we need an extra "buffer" factor on either side so that the endpoints are visible */
extra= 0.01f * (v2d->cur.xmax - v2d->cur.xmin);
@@ -159,16 +164,16 @@ static int time_view_all_exec (bContext *C, wmOperator *UNUSED(op))
static void TIME_OT_view_all (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View All";
- ot->idname= "TIME_OT_view_all";
- ot->description= "Show the entire playable frame range";
+ ot->name = "View All";
+ ot->idname = "TIME_OT_view_all";
+ ot->description = "Show the entire playable frame range";
/* api callbacks */
- ot->exec= time_view_all_exec;
- ot->poll= ED_operator_timeline_active;
+ ot->exec = time_view_all_exec;
+ ot->poll = ED_operator_timeline_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ************************** registration **********************************/
@@ -182,7 +187,7 @@ void time_operatortypes(void)
void time_keymap(wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Timeline", SPACE_TIME, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Timeline", SPACE_TIME, 0);
WM_keymap_add_item(keymap, "TIME_OT_start_frame_set", SKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "TIME_OT_end_frame_set", EKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index e78bad62ba5..1bba237ed5c 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -69,4 +69,8 @@ endif()
add_definitions(-DGLEW_STATIC)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_space_view3d "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_view3d/SConscript b/source/blender/editors/space_view3d/SConscript
index 53bd7828b63..e412927f8ca 100644
--- a/source/blender/editors/space_view3d/SConscript
+++ b/source/blender/editors/space_view3d/SConscript
@@ -16,4 +16,7 @@ if env['WITH_BF_GAMEENGINE']:
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
env.BlenderLib ( 'bf_editors_space_view3d', sources, Split(incs), defines = defs, libtype=['core'], priority=[40] )
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index e15252056cc..545ec42e72f 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -79,7 +79,7 @@ void draw_motion_paths_init(View3D *v3d, ARegion *ar)
}
/* Draw the given motion path for an Object or a Bone
- * - assumes that the viewport has already been initialised properly
+ * - assumes that the viewport has already been initialized properly
* i.e. draw_motion_paths_init() has been called
*/
void draw_motion_path_instance(Scene *scene,
@@ -210,7 +210,7 @@ void draw_motion_path_instance(Scene *scene,
UI_ThemeColor(TH_TEXT_HI);
}
- // XXX, this isnt up to date but probably should be kept so.
+ // XXX, this isn't up to date but probably should be kept so.
invert_m4_m4(ob->imat, ob->obmat);
/* Draw frame numbers at each framestep value */
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 54dff3e4786..aae0348de20 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -170,10 +170,18 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag)
glColor3ubv(cp);
}
else {
- if (boneflag & BONE_DRAW_ACTIVE && boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorBlend(TH_WIRE, TH_BONE_POSE, 0.15f); /* unselected active */
- else if (boneflag & BONE_SELECTED) UI_ThemeColor(TH_BONE_POSE);
- else UI_ThemeColor(TH_WIRE);
+ if ((boneflag & BONE_DRAW_ACTIVE) && (boneflag & BONE_SELECTED)) {
+ UI_ThemeColorShade(TH_BONE_POSE, 40);
+ }
+ else if (boneflag & BONE_DRAW_ACTIVE) {
+ UI_ThemeColorBlend(TH_WIRE, TH_BONE_POSE, 0.15f); /* unselected active */
+ }
+ else if (boneflag & BONE_SELECTED) {
+ UI_ThemeColor(TH_BONE_POSE);
+ }
+ else {
+ UI_ThemeColor(TH_WIRE);
+ }
}
return 1;
@@ -290,10 +298,18 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag)
static void set_ebone_glColor(const unsigned int boneflag)
{
- if (boneflag & BONE_DRAW_ACTIVE && boneflag & BONE_SELECTED) UI_ThemeColor(TH_EDGE_SELECT);
- else if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, 0.15f); /* unselected active */
- else if (boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_EDGE_SELECT, -20);
- else UI_ThemeColor(TH_WIRE);
+ if ((boneflag & BONE_DRAW_ACTIVE) && (boneflag & BONE_SELECTED)) {
+ UI_ThemeColor(TH_EDGE_SELECT);
+ }
+ else if (boneflag & BONE_DRAW_ACTIVE) {
+ UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, 0.15f); /* unselected active */
+ }
+ else if (boneflag & BONE_SELECTED) {
+ UI_ThemeColorShade(TH_EDGE_SELECT, -20);
+ }
+ else {
+ UI_ThemeColor(TH_WIRE);
+ }
}
/* *************** Armature drawing, helper calls for parts ******************* */
@@ -1749,16 +1765,21 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
OB_SOLID, arm->flag, flag, index, bone->length);
}
}
- else if (arm->drawtype==ARM_LINE)
- ; /* nothing in solid */
- else if (arm->drawtype==ARM_WIRE)
- ; /* nothing in solid */
- else if (arm->drawtype==ARM_ENVELOPE)
+ else if (arm->drawtype == ARM_LINE) {
+ /* nothing in solid */
+ }
+ else if (arm->drawtype == ARM_WIRE) {
+ /* nothing in solid */
+ }
+ else if (arm->drawtype == ARM_ENVELOPE) {
draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
- else if (arm->drawtype==ARM_B_BONE)
+ }
+ else if (arm->drawtype == ARM_B_BONE) {
draw_b_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
- else
+ }
+ else {
draw_bone(OB_SOLID, arm->flag, flag, 0, index, bone->length);
+ }
glPopMatrix();
}
@@ -1843,7 +1864,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (index != -1)
index+= 0x10000; // pose bones count in higher 2 bytes only
}
- /* stick or wire bones have not been drawn yet so dont clear object selection in this case */
+ /* stick or wire bones have not been drawn yet so don't clear object selection in this case */
if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)==0 && draw_wire) {
/* object tag, for bordersel optim */
glLoadName(index & 0xFFFF);
@@ -1937,8 +1958,9 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* set color-set to use */
set_pchan_colorset(ob, pchan);
- if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM))
- ; // custom bone shapes should not be drawn here!
+ if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
+ /* custom bone shapes should not be drawn here! */
+ }
else if (arm->drawtype==ARM_ENVELOPE) {
if (dt < OB_SOLID)
draw_sphere_bone_wire(smat, imat, arm->flag, flag, constflag, index, pchan, NULL);
@@ -1973,7 +1995,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
draw_pose_dofs(ob);
/* finally names and axes */
- if (arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES) && is_outline == 0) {
+ if ((arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES)) && (is_outline == 0)) {
/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
if ((G.f & G_PICKSEL) == 0) {
float vec[3];
@@ -2543,7 +2565,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
draw_ebones(v3d, ar, ob, dt);
arm->flag &= ~ARM_EDITMODE;
}
- else{
+ else {
/* Draw Pose */
if (ob->pose && ob->pose->chanbase.first) {
/* drawing posemode selection indices or colors only in these cases */
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 651b0edb123..0ec9e9664f6 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -152,7 +152,7 @@ static DMDrawOption draw_mesh_face_select__setHiddenOpts(void *userData, int ind
else
return DM_DRAW_OPTION_SKIP;
}
- else if(flags & eEdge_Select)
+ else if (flags & eEdge_Select)
return DM_DRAW_OPTION_NORMAL;
else
return DM_DRAW_OPTION_SKIP;
@@ -294,7 +294,8 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
if (textured!=c_textured || texface!=c_texface) {
if (textured ) {
c_badtex= !GPU_set_tpage(texface, !(litob->mode & OB_MODE_TEXTURE_PAINT), alphablend);
- }else {
+ }
+ else {
GPU_set_tpage(NULL, 0, 0);
c_badtex= 0;
}
@@ -404,7 +405,7 @@ static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int
glColor3ub(0xFF, 0x00, 0xFF);
return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
}
- else if (ma && ma->shade_flag&MA_OBCOLOR) {
+ else if (ma && (ma->shade_flag&MA_OBCOLOR)) {
glColor3ubv(Gtexdraw.obcol);
return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
}
@@ -444,7 +445,7 @@ static DMDrawOption draw_tface__set_draw(MTFace *tface, int has_mcol, int matnr)
if (tface && set_draw_settings_cached(0, tface, ma, Gtexdraw)) {
return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
}
- else if (tface && tface->mode&TF_OBCOL) {
+ else if (tface && (tface->mode & TF_OBCOL)) {
return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
}
else if (!has_mcol) {
@@ -461,7 +462,7 @@ static void add_tface_color_layer(DerivedMesh *dm)
MFace *mface = dm->getTessFaceArray(dm);
MCol *finalCol;
int i,j;
- MCol *mcol = dm->getTessFaceDataArray(dm, CD_WEIGHT_MCOL);
+ MCol *mcol = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
if (!mcol)
mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
@@ -486,7 +487,7 @@ static void add_tface_color_layer(DerivedMesh *dm)
finalCol[i*4+j].r = 255;
}
}
- else if (tface && tface->mode&TF_OBCOL) {
+ else if (tface && (tface->mode & TF_OBCOL)) {
for (j=0;j<4;j++) {
finalCol[i*4+j].b = FTOCHAR(Gtexdraw.obcol[0]);
finalCol[i*4+j].g = FTOCHAR(Gtexdraw.obcol[1]);
@@ -694,10 +695,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
lcol = &mloopcol[mp->loopstart];
for (j = 0; j <= totloop_clamp; j++, lcol++) {
- tmp_mcol[j].a = lcol->a;
- tmp_mcol[j].r = lcol->r;
- tmp_mcol[j].g = lcol->g;
- tmp_mcol[j].b = lcol->b;
+ MESH_MLOOPCOL_TO_MCOL(lcol, &tmp_mcol[j]);
}
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 925e8703577..2b45c73c961 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -56,6 +56,7 @@
#include "BLI_utildefines.h"
#include "BKE_anim.h" //for the where_on_path function
+#include "BKE_armature.h"
#include "BKE_camera.h"
#include "BKE_constraint.h" // for the get_constraint_target function
#include "BKE_curve.h"
@@ -193,11 +194,11 @@ static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
if ((vd->flag & V3D_ZBUF_SELECT) == 0)
return 1;
- /* if its drawing textures with zbuf sel, then dont draw dots */
+ /* if its drawing textures with zbuf sel, then don't draw dots */
if (dt==OB_TEXTURE && vd->drawtype==OB_TEXTURE)
return 0;
- if (vd->drawtype>=OB_SOLID && vd->flag2 & V3D_SOLID_TEX)
+ if ((vd->drawtype >= OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX))
return 0;
return 1;
@@ -525,103 +526,105 @@ void drawaxes(float size, char drawtype)
float v3[3]= {0.0, 0.0, 0.0};
switch(drawtype) {
-
- case OB_PLAINAXES:
- for (axis=0; axis<3; axis++) {
+
+ case OB_PLAINAXES:
+ for (axis=0; axis<3; axis++) {
+ glBegin(GL_LINES);
+
+ v1[axis]= size;
+ v2[axis]= -size;
+ glVertex3fv(v1);
+ glVertex3fv(v2);
+
+ /* reset v1 & v2 to zero */
+ v1[axis]= v2[axis]= 0.0f;
+
+ glEnd();
+ }
+ break;
+ case OB_SINGLE_ARROW:
+
glBegin(GL_LINES);
-
- v1[axis]= size;
- v2[axis]= -size;
+ /* in positive z direction only */
+ v1[2]= size;
glVertex3fv(v1);
glVertex3fv(v2);
+ glEnd();
- /* reset v1 & v2 to zero */
- v1[axis]= v2[axis]= 0.0f;
+ /* square pyramid */
+ glBegin(GL_TRIANGLES);
+
+ v2[0]= size * 0.035f; v2[1] = size * 0.035f;
+ v3[0]= size * -0.035f; v3[1] = size * 0.035f;
+ v2[2]= v3[2]= size * 0.75f;
+
+ for (axis=0; axis<4; axis++) {
+ if (axis % 2 == 1) {
+ v2[0] = -v2[0];
+ v3[1] = -v3[1];
+ }
+ else {
+ v2[1] = -v2[1];
+ v3[0] = -v3[0];
+ }
+
+ glVertex3fv(v1);
+ glVertex3fv(v2);
+ glVertex3fv(v3);
- glEnd();
- }
- break;
- case OB_SINGLE_ARROW:
-
- glBegin(GL_LINES);
- /* in positive z direction only */
- v1[2]= size;
- glVertex3fv(v1);
- glVertex3fv(v2);
- glEnd();
-
- /* square pyramid */
- glBegin(GL_TRIANGLES);
-
- v2[0]= size * 0.035f; v2[1] = size * 0.035f;
- v3[0]= size * -0.035f; v3[1] = size * 0.035f;
- v2[2]= v3[2]= size * 0.75f;
-
- for (axis=0; axis<4; axis++) {
- if (axis % 2 == 1) {
- v2[0] = -v2[0];
- v3[1] = -v3[1];
- }
- else {
- v2[1] = -v2[1];
- v3[0] = -v3[0];
}
-
- glVertex3fv(v1);
- glVertex3fv(v2);
- glVertex3fv(v3);
-
- }
- glEnd();
-
- break;
- case OB_CUBE:
- drawcube_size(size);
- break;
-
- case OB_CIRCLE:
- drawcircle_size(size);
- break;
-
- case OB_EMPTY_SPHERE:
- draw_empty_sphere(size);
- break;
+ glEnd();
- case OB_EMPTY_CONE:
- draw_empty_cone(size);
- break;
+ break;
+ case OB_CUBE:
+ drawcube_size(size);
+ break;
- case OB_ARROWS:
- default:
- for (axis=0; axis<3; axis++) {
- const int arrow_axis= (axis==0) ? 1:0;
+ case OB_CIRCLE:
+ drawcircle_size(size);
+ break;
- glBegin(GL_LINES);
-
- v2[axis]= size;
- glVertex3fv(v1);
- glVertex3fv(v2);
+ case OB_EMPTY_SPHERE:
+ draw_empty_sphere(size);
+ break;
+
+ case OB_EMPTY_CONE:
+ draw_empty_cone(size);
+ break;
+
+ case OB_ARROWS:
+ default:
+ {
+ for (axis=0; axis<3; axis++) {
+ const int arrow_axis= (axis==0) ? 1:0;
+
+ glBegin(GL_LINES);
+
+ v2[axis]= size;
+ glVertex3fv(v1);
+ glVertex3fv(v2);
- v1[axis]= size*0.85f;
- v1[arrow_axis]= -size*0.08f;
- glVertex3fv(v1);
- glVertex3fv(v2);
+ v1[axis]= size*0.85f;
+ v1[arrow_axis]= -size*0.08f;
+ glVertex3fv(v1);
+ glVertex3fv(v2);
- v1[arrow_axis]= size*0.08f;
- glVertex3fv(v1);
- glVertex3fv(v2);
-
- glEnd();
+ v1[arrow_axis]= size*0.08f;
+ glVertex3fv(v1);
+ glVertex3fv(v2);
+
+ glEnd();
- v2[axis]+= size*0.125f;
-
- draw_xyz_wire(v2, size, axis);
-
-
- /* reset v1 & v2 to zero */
- v1[arrow_axis]= v1[axis]= v2[axis]= 0.0f;
+ v2[axis]+= size*0.125f;
+
+ draw_xyz_wire(v2, size, axis);
+
+
+ /* reset v1 & v2 to zero */
+ v1[arrow_axis]= v1[axis]= v2[axis]= 0.0f;
+ }
+ break;
}
- break;
}
}
@@ -939,21 +942,21 @@ static void drawcube(void)
{
glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
- glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
- glVertex3fv(cube[7]); glVertex3fv(cube[4]);
+ glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
+ glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
+ glVertex3fv(cube[7]); glVertex3fv(cube[4]);
glEnd();
glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[1]); glVertex3fv(cube[5]);
+ glVertex3fv(cube[1]); glVertex3fv(cube[5]);
glEnd();
glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[2]); glVertex3fv(cube[6]);
+ glVertex3fv(cube[2]); glVertex3fv(cube[6]);
glEnd();
glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[3]); glVertex3fv(cube[7]);
+ glVertex3fv(cube[3]); glVertex3fv(cube[7]);
glEnd();
}
@@ -963,25 +966,25 @@ static void drawcube(void)
static void drawcube_size(float size)
{
glBegin(GL_LINE_STRIP);
- glVertex3f(-size,-size,-size); glVertex3f(-size,-size,size);
- glVertex3f(-size,size,size); glVertex3f(-size,size,-size);
+ glVertex3f(-size,-size,-size); glVertex3f(-size,-size,size);
+ glVertex3f(-size,size,size); glVertex3f(-size,size,-size);
- glVertex3f(-size,-size,-size); glVertex3f(size,-size,-size);
- glVertex3f(size,-size,size); glVertex3f(size,size,size);
+ glVertex3f(-size,-size,-size); glVertex3f(size,-size,-size);
+ glVertex3f(size,-size,size); glVertex3f(size,size,size);
- glVertex3f(size,size,-size); glVertex3f(size,-size,-size);
+ glVertex3f(size,size,-size); glVertex3f(size,-size,-size);
glEnd();
glBegin(GL_LINE_STRIP);
- glVertex3f(-size,-size,size); glVertex3f(size,-size,size);
+ glVertex3f(-size,-size,size); glVertex3f(size,-size,size);
glEnd();
glBegin(GL_LINE_STRIP);
- glVertex3f(-size,size,size); glVertex3f(size,size,size);
+ glVertex3f(-size,size,size); glVertex3f(size,size,size);
glEnd();
glBegin(GL_LINE_STRIP);
- glVertex3f(-size,size,-size); glVertex3f(size,size,-size);
+ glVertex3f(-size,size,-size); glVertex3f(size,size,-size);
glEnd();
}
@@ -995,21 +998,21 @@ static void drawcube_size(const float size[3])
glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
- glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
- glVertex3fv(cube[7]); glVertex3fv(cube[4]);
+ glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
+ glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
+ glVertex3fv(cube[7]); glVertex3fv(cube[4]);
glEnd();
glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[1]); glVertex3fv(cube[5]);
+ glVertex3fv(cube[1]); glVertex3fv(cube[5]);
glEnd();
glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[2]); glVertex3fv(cube[6]);
+ glVertex3fv(cube[2]); glVertex3fv(cube[6]);
glEnd();
glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[3]); glVertex3fv(cube[7]);
+ glVertex3fv(cube[3]); glVertex3fv(cube[7]);
glEnd();
glPopMatrix();
@@ -1027,8 +1030,8 @@ static void drawshadbuflimits(Lamp *la, float mat[][4])
madd_v3_v3v3fl(end, mat[3], lavec, la->clipend);
glBegin(GL_LINE_STRIP);
- glVertex3fv(sta);
- glVertex3fv(end);
+ glVertex3fv(sta);
+ glVertex3fv(end);
glEnd();
glPointSize(3.0);
@@ -1150,7 +1153,7 @@ static void draw_transp_spot_volume(Lamp *la, float x, float z)
/* draw front side lighting */
glCullFace(GL_BACK);
- glBlendFunc(GL_ONE, GL_ONE);
+ glBlendFunc(GL_ONE, GL_ONE);
glColor4f(0.2f, 0.2f, 0.2f, 1.0f);
draw_spot_cone(la, x, z);
@@ -1224,7 +1227,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* restore */
if (ob->id.us>1)
glColor4fv(curcol);
-
+
/* Outer circle */
circrad = 3.0f*lampsize;
setlinestyle(3);
@@ -1233,9 +1236,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* draw dashed outer circle if shadow is on. remember some lamps can't have certain shadows! */
if (la->type!=LA_HEMI) {
- if ( (la->mode & LA_SHAD_RAY) ||
- ((la->mode & LA_SHAD_BUF) && (la->type==LA_SPOT))
- ) {
+ if ((la->mode & LA_SHAD_RAY) || ((la->mode & LA_SHAD_BUF) && (la->type == LA_SPOT))) {
drawcircball(GL_LINE_LOOP, vec, circrad + 3.0f*pixsize, imat);
}
}
@@ -1273,7 +1274,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
glTranslatef(-vec[0], -vec[1], -vec[2]);
- }
+ }
if (la->type==LA_LOCAL) {
if (la->mode & LA_SPHERE) {
@@ -1289,7 +1290,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* skip drawing extra info */
}
else if ((la->type==LA_SPOT) || (la->type==LA_YF_PHOTON)) {
- lvec[0]=lvec[1]= 0.0;
+ lvec[0]=lvec[1]= 0.0;
lvec[2] = 1.0;
x = rv3d->persmat[0][2];
y = rv3d->persmat[1][2];
@@ -1306,9 +1307,9 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* draw the angled sides of the cone */
glBegin(GL_LINE_STRIP);
- glVertex3fv(vvec);
- glVertex3fv(vec);
- glVertex3fv(lvec);
+ glVertex3fv(vvec);
+ glVertex3fv(vec);
+ glVertex3fv(lvec);
glEnd();
z = x*sqrtf(1.0f - y*y);
@@ -1324,13 +1325,13 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
tvec[2]= 0.0;
glBegin(GL_LINE_LOOP);
- glVertex3fv(tvec);
- tvec[1]= -z_abs; /* neg */
- glVertex3fv(tvec);
- tvec[0]= -z_abs; /* neg */
- glVertex3fv(tvec);
- tvec[1]= z_abs; /* pos */
- glVertex3fv(tvec);
+ glVertex3fv(tvec);
+ tvec[1]= -z_abs; /* neg */
+ glVertex3fv(tvec);
+ tvec[0]= -z_abs; /* neg */
+ glVertex3fv(tvec);
+ tvec[1]= z_abs; /* pos */
+ glVertex3fv(tvec);
glEnd();
}
else circ(0.0, 0.0, fabsf(z));
@@ -1359,8 +1360,8 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
interp_v3_v3v3(vvec_clip, vec, vvec, clipsta_fac);
glBegin(GL_LINE_STRIP);
- glVertex3fv(lvec_clip);
- glVertex3fv(vvec_clip);
+ glVertex3fv(lvec_clip);
+ glVertex3fv(vvec_clip);
glEnd();
}
}
@@ -1368,10 +1369,10 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* draw the line from the circle along the dist */
glBegin(GL_LINE_STRIP);
- vec[2] = -circrad;
- glVertex3fv(vec);
- vec[2]= -la->dist;
- glVertex3fv(vec);
+ vec[2] = -circrad;
+ glVertex3fv(vec);
+ vec[2]= -la->dist;
+ glVertex3fv(vec);
glEnd();
if (la->type==LA_HEMI) {
@@ -1390,17 +1391,16 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
glBegin(GL_LINE_STRIP);
for (steps=0; steps<6; steps++) {
- if (axis == 0 || axis == 1) { /* x axis up, x axis down */
+ if (axis == 0 || axis == 1) { /* x axis up, x axis down */
/* make the arcs start at the edge of the energy circle */
if (steps == 0) v[0] = dir*circrad;
else v[0] = v[0] + dir*(steps*outdist);
}
else if (axis == 2 || axis == 3) { /* y axis up, y axis down */
/* make the arcs start at the edge of the energy circle */
- if (steps == 0) v[1] = dir*circrad;
- else v[1] = v[1] + dir*(steps*outdist);
+ v[1] = (steps == 0) ? (dir * circrad) : (v[1] + dir * (steps * outdist));
}
-
+
v[2] = v[2] - steps*zdist;
glVertex3fv(v);
@@ -1421,7 +1421,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
else if (la->area_shape==LA_AREA_RECT)
fdrawbox(-la->area_size*0.5f, -la->area_sizey*0.5f, la->area_size*0.5f, la->area_sizey*0.5f);
- glBegin(GL_LINE_STRIP);
+ glBegin(GL_LINE_STRIP);
glVertex3f(0.0,0.0,-circrad);
glVertex3f(0.0,0.0,-la->dist);
glEnd();
@@ -1439,21 +1439,21 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
UI_GetThemeColor4ubv(TH_LAMP, col);
glColor4ubv(col);
-
+
glEnable(GL_BLEND);
if (vec[2]>0) vec[2] -= circrad;
else vec[2] += circrad;
glBegin(GL_LINE_STRIP);
- glVertex3fv(vec);
- vec[2]= 0;
- glVertex3fv(vec);
+ glVertex3fv(vec);
+ vec[2]= 0;
+ glVertex3fv(vec);
glEnd();
glPointSize(2.0);
glBegin(GL_POINTS);
- glVertex3fv(vec);
+ glVertex3fv(vec);
glEnd();
glPointSize(1.0);
@@ -1524,8 +1524,8 @@ static void draw_bundle_sphere(void)
}
static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D *v3d,
- MovieClip *clip, MovieTrackingObject *tracking_object, int flag,
- int *global_track_index, int draw_selected)
+ MovieClip *clip, MovieTrackingObject *tracking_object, int flag,
+ int *global_track_index, int draw_selected)
{
MovieTracking *tracking= &clip->tracking;
MovieTrackingTrack *track;
@@ -1572,65 +1572,65 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
glLoadName(base->selcol + (tracknr<<16));
glPushMatrix();
- glTranslatef(track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]);
- glScalef(v3d->bundle_size/0.05f, v3d->bundle_size/0.05f, v3d->bundle_size/0.05f);
+ glTranslatef(track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]);
+ glScalef(v3d->bundle_size/0.05f, v3d->bundle_size/0.05f, v3d->bundle_size/0.05f);
- if (v3d->drawtype==OB_WIRE) {
- glDisable(GL_LIGHTING);
+ if (v3d->drawtype==OB_WIRE) {
+ glDisable(GL_LIGHTING);
+
+ if (selected) {
+ if (base==BASACT) UI_ThemeColor(TH_ACTIVE);
+ else UI_ThemeColor(TH_SELECT);
+ }
+ else {
+ if (track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
+ else UI_ThemeColor(TH_WIRE);
+ }
+ drawaxes(0.05f, v3d->bundle_drawtype);
+
+ glEnable(GL_LIGHTING);
+ }
+ else if (v3d->drawtype>OB_WIRE) {
+ if (v3d->bundle_drawtype==OB_EMPTY_SPHERE) {
+ /* selection outline */
if (selected) {
if (base==BASACT) UI_ThemeColor(TH_ACTIVE);
else UI_ThemeColor(TH_SELECT);
- }
- else {
- if (track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
- else UI_ThemeColor(TH_WIRE);
- }
- drawaxes(0.05f, v3d->bundle_drawtype);
-
- glEnable(GL_LIGHTING);
- }
- else if (v3d->drawtype>OB_WIRE) {
- if (v3d->bundle_drawtype==OB_EMPTY_SPHERE) {
- /* selection outline */
- if (selected) {
- if (base==BASACT) UI_ThemeColor(TH_ACTIVE);
- else UI_ThemeColor(TH_SELECT);
+ glLineWidth(2.f);
+ glDisable(GL_LIGHTING);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glLineWidth(2.f);
- glDisable(GL_LIGHTING);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ draw_bundle_sphere();
- draw_bundle_sphere();
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ glEnable(GL_LIGHTING);
+ glLineWidth(1.f);
+ }
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- glEnable(GL_LIGHTING);
- glLineWidth(1.f);
- }
+ if (track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
+ else UI_ThemeColor(TH_BUNDLE_SOLID);
- if (track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
- else UI_ThemeColor(TH_BUNDLE_SOLID);
+ draw_bundle_sphere();
+ }
+ else {
+ glDisable(GL_LIGHTING);
- draw_bundle_sphere();
+ if (selected) {
+ if (base==BASACT) UI_ThemeColor(TH_ACTIVE);
+ else UI_ThemeColor(TH_SELECT);
}
else {
- glDisable(GL_LIGHTING);
-
- if (selected) {
- if (base==BASACT) UI_ThemeColor(TH_ACTIVE);
- else UI_ThemeColor(TH_SELECT);
- }
- else {
- if (track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
- else UI_ThemeColor(TH_WIRE);
- }
+ if (track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
+ else UI_ThemeColor(TH_WIRE);
+ }
- drawaxes(0.05f, v3d->bundle_drawtype);
+ drawaxes(0.05f, v3d->bundle_drawtype);
- glEnable(GL_LIGHTING);
- }
+ glEnable(GL_LIGHTING);
}
+ }
glPopMatrix();
@@ -1662,13 +1662,13 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
glLineWidth(2.0f);
glBegin(GL_LINE_STRIP);
- for (a= 0; a<reconstruction->camnr; a++, camera++) {
- glVertex3fv(camera->mat[3]);
- }
- glEnd();
+ for (a= 0; a<reconstruction->camnr; a++, camera++) {
+ glVertex3fv(camera->mat[3]);
+ }
+ glEnd();
- glLineWidth(1.0f);
- glEnable(GL_LIGHTING);
+ glLineWidth(1.0f);
+ glEnable(GL_LIGHTING);
}
}
}
@@ -1679,7 +1679,7 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
}
static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d, MovieClip *clip,
- int flag, int draw_selected)
+ int flag, int draw_selected)
{
MovieTracking *tracking= &clip->tracking;
MovieTrackingObject *tracking_object;
@@ -1702,7 +1702,7 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d,
tracking_object= tracking->objects.first;
while (tracking_object) {
draw_viewport_object_reconstruction(scene, base, v3d, clip, tracking_object,
- flag, &global_track_index, draw_selected);
+ flag, &global_track_index, draw_selected);
tracking_object= tracking_object->next;
}
@@ -1787,7 +1787,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
/* draw an outline arrow for inactive cameras and filled
* for active cameras. We actually draw both outline+filled
- * for active cameras so the wire can be seen side-on */
+ * for active cameras so the wire can be seen side-on */
for (i=0;i<2;i++) {
if (i==0) glBegin(GL_LINE_LOOP);
else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES);
@@ -1803,7 +1803,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
tvec[0]= shift[0];
tvec[1]= shift[1] + ((1.1f * drawsize * (asp[1] + 0.7f)) * scale[1]);
glVertex3fv(tvec); /* top */
-
+
glEnd();
}
@@ -1811,7 +1811,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
if (cam->flag & (CAM_SHOWLIMITS+CAM_SHOWMIST)) {
float nobmat[4][4];
World *wrld;
-
+
/* draw in normalized object matrix space */
copy_m4_m4(nobmat, ob->obmat);
normalize_m4(nobmat);
@@ -1829,7 +1829,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
wrld= scene->world;
if (cam->flag & CAM_SHOWMIST)
if (wrld) draw_limit_line(wrld->miststa, wrld->miststa+wrld->mistdist, 0xFFFFFF);
-
+
glPopMatrix();
}
}
@@ -1905,7 +1905,7 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel)
}
glPointSize(1.0);
- bglEnd();
+ bglEnd();
}
void lattice_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, BPoint *bp, int x, int y), void *userData)
@@ -1996,7 +1996,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
}
}
}
- }
+ }
glEnd();
/* restoration for weight colors */
@@ -2017,7 +2017,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
/* Note! - foreach funcs should be called while drawing or directly after
* if not, ED_view3d_init_mats_rv3d() can be used for selection tools
- * but would not give correct results with dupli's for eg. which dont
+ * but would not give correct results with dupli's for eg. which don't
* use the object matrix in the usual way */
static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
@@ -2092,11 +2092,11 @@ static void drawSelectedVertices(DerivedMesh *dm, Mesh *me)
}
static int is_co_in_region(ARegion *ar, const short co[2])
{
- return ( (co[0] != IS_CLIPPED) && /* may be the only initialized value, check first */
- (co[0] >= 0) &&
- (co[0] < ar->winx) &&
- (co[1] >= 0) &&
- (co[1] < ar->winy));
+ return ((co[0] != IS_CLIPPED) && /* may be the only initialized value, check first */
+ (co[0] >= 0) &&
+ (co[0] < ar->winx) &&
+ (co[1] >= 0) &&
+ (co[1] < ar->winy));
}
static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0co, float *v1co)
{
@@ -2374,7 +2374,7 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, int sel, BMVert *eve_
bglEnd();
}
- /* Draw edges with color set based on selection */
+/* Draw edges with color set based on selection */
static DMDrawOption draw_dm_edges_sel__setDrawOptions(void *userData, int index)
{
BMEdge *eed;
@@ -2408,7 +2408,7 @@ static DMDrawOption draw_dm_edges_sel__setDrawOptions(void *userData, int index)
}
}
static void draw_dm_edges_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol,
- unsigned char *selCol, unsigned char *actCol, BMEdge *eed_act)
+ unsigned char *selCol, unsigned char *actCol, BMEdge *eed_act)
{
drawDMEdgesSel_userData data;
@@ -2420,7 +2420,7 @@ static void draw_dm_edges_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *ba
dm->drawMappedEdges(dm, draw_dm_edges_sel__setDrawOptions, &data);
}
- /* Draw edges */
+/* Draw edges */
static DMDrawOption draw_dm_edges__setDrawOptions(void *userData, int index)
{
if (BM_elem_flag_test(EDBM_get_edge_for_index(userData, index), BM_ELEM_HIDDEN))
@@ -2434,7 +2434,7 @@ static void draw_dm_edges(BMEditMesh *em, DerivedMesh *dm)
dm->drawMappedEdges(dm, draw_dm_edges__setDrawOptions, em);
}
- /* Draw edges with color interpolated based on selection */
+/* Draw edges with color interpolated based on selection */
static DMDrawOption draw_dm_edges_sel_interp__setDrawOptions(void *userData, int index)
{
if (BM_elem_flag_test(EDBM_get_edge_for_index(((void**)userData)[0], index), BM_ELEM_HIDDEN))
@@ -2449,10 +2449,10 @@ static void draw_dm_edges_sel_interp__setDrawInterpOptions(void *userData, int i
unsigned char *col0 = cols[(BM_elem_flag_test(eed->v1, BM_ELEM_SELECT))?2:1];
unsigned char *col1 = cols[(BM_elem_flag_test(eed->v2, BM_ELEM_SELECT))?2:1];
- glColor4ub( col0[0] + (col1[0]-col0[0])*t,
- col0[1] + (col1[1]-col0[1])*t,
- col0[2] + (col1[2]-col0[2])*t,
- col0[3] + (col1[3]-col0[3])*t);
+ glColor4ub(col0[0] + (col1[0] - col0[0]) * t,
+ col0[1] + (col1[1] - col0[1]) * t,
+ col0[2] + (col1[2] - col0[2]) * t,
+ col0[3] + (col1[3] - col0[3]) * t);
}
static void draw_dm_edges_sel_interp(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol)
@@ -2462,7 +2462,7 @@ static void draw_dm_edges_sel_interp(BMEditMesh *em, DerivedMesh *dm, unsigned c
dm->drawMappedEdgesInterp(dm, draw_dm_edges_sel_interp__setDrawOptions, draw_dm_edges_sel_interp__setDrawInterpOptions, cols);
}
- /* Draw only seam edges */
+/* Draw only seam edges */
static DMDrawOption draw_dm_edges_seams__setDrawOptions(void *userData, int index)
{
BMEdge *eed = EDBM_get_edge_for_index(userData, index);
@@ -2478,7 +2478,7 @@ static void draw_dm_edges_seams(BMEditMesh *em, DerivedMesh *dm)
dm->drawMappedEdges(dm, draw_dm_edges_seams__setDrawOptions, em);
}
- /* Draw only sharp edges */
+/* Draw only sharp edges */
static DMDrawOption draw_dm_edges_sharp__setDrawOptions(void *userData, int index)
{
BMEdge *eed = EDBM_get_edge_for_index(userData, index);
@@ -2494,7 +2494,7 @@ static void draw_dm_edges_sharp(BMEditMesh *em, DerivedMesh *dm)
dm->drawMappedEdges(dm, draw_dm_edges_sharp__setDrawOptions, em);
}
- /* Draw only Freestyle feature edges */
+/* Draw only Freestyle feature edges */
static int draw_dm_edges_freestyle__setDrawOptions(void *userData, int index)
{
BMEdge *eed = EDBM_get_edge_for_index(userData, index);
@@ -2506,7 +2506,7 @@ static void draw_dm_edges_freestyle(BMEditMesh *em, DerivedMesh *dm)
dm->drawMappedEdges(dm, draw_dm_edges_freestyle__setDrawOptions, em);
}
- /* Draw faces with color set based on selection
+/* Draw faces with color set based on selection
* return 2 for the active face so it renders with stipple enabled */
static DMDrawOption draw_dm_faces_sel__setDrawOptions(void *userData, int index)
{
@@ -2565,7 +2565,7 @@ static int draw_dm_faces_sel__compareDrawOptions(void *userData, int index, int
/* also draws the active face */
static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol,
- unsigned char *selCol, unsigned char *markCol, unsigned char *actCol, BMFace *efa_act)
+ unsigned char *selCol, unsigned char *markCol, unsigned char *actCol, BMFace *efa_act)
{
drawDMFacesSel_userData data;
data.dm= dm;
@@ -2683,7 +2683,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit,
if (pass==0) {
if (v3d->zbuf && !(v3d->flag&V3D_ZBUF_SELECT)) {
glDisable(GL_DEPTH_TEST);
-
+
glEnable(GL_BLEND);
}
else {
@@ -2697,7 +2697,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit,
else {
col[3] = fcol[3] = 255;
}
-
+
if (ts->selectmode & SCE_SELECT_VERTEX) {
glPointSize(size);
glColor4ubv(col);
@@ -2734,13 +2734,13 @@ static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
UI_GetThemeColor4ubv(TH_WIRE, wireCol);
UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, actCol);
- /* when sel only is used, dont render wire, only selected, this is used for
+ /* when sel only is used, don't render wire, only selected, this is used for
* textured draw mode when the 'edges' option is disabled */
if (sel_only)
wireCol[3] = 0;
for (pass=0; pass<2; pass++) {
- /* show wires in transparant when no zbuf clipping for select */
+ /* show wires in transparant when no zbuf clipping for select */
if (pass==0) {
if (v3d->zbuf && (v3d->flag & V3D_ZBUF_SELECT)==0) {
glEnable(GL_BLEND);
@@ -2759,7 +2759,7 @@ static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
if (ts->selectmode == SCE_SELECT_FACE) {
draw_dm_edges_sel(em, cageDM, wireCol, selCol, actCol, eed_act);
- }
+ }
else if ( (me->drawflag & ME_DRAWEDGES) || (ts->selectmode & SCE_SELECT_EDGE) ) {
if (cageDM->drawMappedEdgesInterp && (ts->selectmode & SCE_SELECT_VERTEX)) {
glShadeModel(GL_SMOOTH);
@@ -2906,15 +2906,16 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
for (efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
- efa; efa=BM_iter_step(&iter)) {
+ efa; efa=BM_iter_step(&iter))
+ {
BMIter liter;
BMLoop *loop;
BM_face_center_bounds_calc(em->bm, efa, vmid);
for (loop = BM_iter_new(&liter, em->bm, BM_LOOPS_OF_FACE, efa);
- loop; loop = BM_iter_step(&liter)) {
-
+ loop; loop = BM_iter_step(&liter))
+ {
float v1[3], v2[3], v3[3];
copy_v3_v3(v1, loop->prev->v->co);
@@ -3071,14 +3072,14 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
glDisable(GL_LIGHTING);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
}
-
+
// Setup for drawing wire over, disable zbuffer
// write to show selected edge wires better
UI_ThemeColor(TH_WIRE);
bglPolygonOffset(rv3d->dist, 1.0);
glDepthMask(0);
- }
+ }
else {
if (cageDM!=finalDM) {
UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7);
@@ -3088,7 +3089,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
if (me->drawflag & ME_DRAWFACES) { /* transp faces */
unsigned char col1[4], col2[4], col3[4], col4[4];
-
+
UI_GetThemeColor4ubv(TH_FACE, col1);
UI_GetThemeColor4ubv(TH_FACE_SELECT, col2);
UI_GetThemeColor4ubv(TH_FREESTYLE_FACE_MARK, col3);
@@ -3097,8 +3098,8 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
glEnable(GL_BLEND);
glDepthMask(0); // disable write in zbuffer, needed for nice transp
- /* dont draw unselected faces, only selected, this is MUCH nicer when texturing */
- if CHECK_OB_DRAWTEXTURE(v3d, dt)
+ /* don't draw unselected faces, only selected, this is MUCH nicer when texturing */
+ if (CHECK_OB_DRAWTEXTURE(v3d, dt))
col1[3] = 0;
if (!(me->drawflag & ME_DRAW_FREESTYLE_FACE))
@@ -3114,7 +3115,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
* Make all other faces zero alpha except for the active
* */
unsigned char col1[4], col2[4], col3[4], col4[4];
- col1[3] = col2[3] = col3[3] = 0; /* dont draw */
+ col1[3] = col2[3] = col3[3] = 0; /* don't draw */
UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col4);
glEnable(GL_BLEND);
@@ -3129,7 +3130,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
/* here starts all fancy draw-extra over */
if ((me->drawflag & ME_DRAWEDGES)==0 && CHECK_OB_DRAWTEXTURE(v3d, dt)) {
- /* we are drawing textures and 'ME_DRAWEDGES' is disabled, dont draw any edges */
+ /* we are drawing textures and 'ME_DRAWEDGES' is disabled, don't draw any edges */
/* only draw selected edges otherwise there is no way of telling if a face is selected */
draw_em_fancy_edges(em, scene, v3d, me, cageDM, 1, eed_act);
@@ -3139,9 +3140,9 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
if (me->drawflag & ME_DRAWSEAMS) {
UI_ThemeColor(TH_EDGE_SEAM);
glLineWidth(2);
-
+
draw_dm_edges_seams(em, cageDM);
-
+
glColor3ub(0,0,0);
glLineWidth(1);
}
@@ -3149,13 +3150,13 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
if (me->drawflag & ME_DRAWSHARP) {
UI_ThemeColor(TH_EDGE_SHARP);
glLineWidth(2);
-
+
draw_dm_edges_sharp(em, cageDM);
-
+
glColor3ub(0,0,0);
glLineWidth(1);
}
-
+
if(me->drawflag & ME_DRAW_FREESTYLE_EDGE) {
UI_ThemeColor(TH_FREESTYLE_EDGE_MARK);
glLineWidth(2);
@@ -3222,7 +3223,7 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
/* if transparent, we cannot draw the edges for solid select... edges have no material info.
* drawFacesSolid() doesn't draw the transparent faces */
if (ob->dtx & OB_DRAWTRANSP) {
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
GPU_disable_material();
@@ -3230,7 +3231,7 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
else {
dm->drawEdges(dm, 0, 1);
}
-
+
glLineWidth(1.0);
glDepthMask(1);
}
@@ -3253,7 +3254,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
/* Check to draw dynamic paint colors (or weights from WeightVG modifiers).
* Note: Last "preview-active" modifier in stack will win! */
- if (DM_get_tessface_data_layer(dm, CD_WEIGHT_MCOL) && modifiers_isPreview(ob))
+ if (DM_get_tessface_data_layer(dm, CD_PREVIEW_MCOL) && modifiers_isPreview(ob))
draw_flags |= DRAW_MODIFIERS_PREVIEW;
/* Unwanted combination */
@@ -3272,7 +3273,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
if (dt==OB_BOUNDBOX) {
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+ if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_WIRE)==0)
draw_bounding_volume(scene, ob, ob->boundtype);
}
else if (hasHaloMat || (totface==0 && totedge==0)) {
@@ -3325,8 +3326,8 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
* rather than the shading, this is also forced in wire view */
GPU_enable_material(0, NULL);
dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, me->mpoly,
- DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
-
+ DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
+
bglPolygonOffset(rv3d->dist, 1.0);
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
@@ -3344,7 +3345,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
GPU_disable_material();
- /* since we already draw wire as wp guide, dont draw over the top */
+ /* since we already draw wire as wp guide, don't draw over the top */
draw_wire= OBDRAW_WIRE_OFF;
}
else if (draw_flags & DRAW_MODIFIERS_PREVIEW) {
@@ -3454,7 +3455,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glEnable(GL_COLOR_MATERIAL);
dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, me->mpoly,
- DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
+ DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
@@ -3463,11 +3464,11 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
else if (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) {
if (me->mloopcol)
dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, NULL,
- DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
+ 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);
+ DM_DRAW_ALWAYS_SMOOTH);
}
}
}
@@ -3486,7 +3487,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glColor3ub(80,80,80);
}
else {
- if (ob->flag & OB_FROMGROUP)
+ if (ob->flag & OB_FROMGROUP)
UI_ThemeColor(TH_GROUP);
else {
if (ob->dtx & OB_DRAWWIRE && flag==DRAW_CONSTCOLOR)
@@ -3524,7 +3525,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
}
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
+ if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_SOLID)==0)
dm->drawEdges(dm, (dt==OB_WIRE || totface==0), me->drawflag & ME_ALLEDGES);
if (dt!=OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) {
@@ -3566,8 +3567,8 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
if (obedit && ob!=obedit && ob->data==obedit->data) {
- if (ob_get_key(ob) || ob_get_key(obedit));
- else if (ob->modifiers.first || obedit->modifiers.first);
+ if (ob_get_key(ob) || ob_get_key(obedit)) {}
+ else if (ob->modifiers.first || obedit->modifiers.first) {}
else drawlinked= 1;
}
@@ -3578,7 +3579,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
finalDM = cageDM = editbmesh_get_derived_base(ob, em);
else
cageDM = editbmesh_get_derived_cage_and_final(scene, ob, em, &finalDM,
- scene->customdata_mask);
+ scene->customdata_mask);
if (dt>OB_WIRE) {
glsl = draw_glsl_material(scene, ob, v3d, dt);
@@ -3601,7 +3602,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
if (dt==OB_SOLID || glsl) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl,
- (check_alpha)? &do_alpha_after: NULL);
+ (check_alpha)? &do_alpha_after: NULL);
}
draw_mesh_fancy(scene, ar, v3d, rv3d, base, dt, flag);
@@ -3646,84 +3647,84 @@ static int drawDispListwire(ListBase *dlbase)
if (dlbase==NULL) return 1;
glEnableClientState(GL_VERTEX_ARRAY);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
for (dl= dlbase->first; dl; dl= dl->next) {
if (dl->parts==0 || dl->nr==0)
continue;
data= dl->verts;
-
+
switch(dl->type) {
- case DL_SEGM:
-
- glVertexPointer(3, GL_FLOAT, 0, data);
-
- for (parts=0; parts<dl->parts; parts++)
- glDrawArrays(GL_LINE_STRIP, parts*dl->nr, dl->nr);
-
- break;
- case DL_POLY:
-
- glVertexPointer(3, GL_FLOAT, 0, data);
-
- for (parts=0; parts<dl->parts; parts++)
- glDrawArrays(GL_LINE_LOOP, parts*dl->nr, dl->nr);
-
- break;
- case DL_SURF:
-
- glVertexPointer(3, GL_FLOAT, 0, data);
-
- for (parts=0; parts<dl->parts; parts++) {
- if (dl->flag & DL_CYCL_U)
- glDrawArrays(GL_LINE_LOOP, parts*dl->nr, dl->nr);
- else
+ case DL_SEGM:
+
+ glVertexPointer(3, GL_FLOAT, 0, data);
+
+ for (parts=0; parts<dl->parts; parts++)
glDrawArrays(GL_LINE_STRIP, parts*dl->nr, dl->nr);
- }
-
- for (nr=0; nr<dl->nr; nr++) {
- int ofs= 3*dl->nr;
- data= ( dl->verts )+3*nr;
- parts= dl->parts;
+ break;
+ case DL_POLY:
- if (dl->flag & DL_CYCL_V) glBegin(GL_LINE_LOOP);
- else glBegin(GL_LINE_STRIP);
-
- while (parts--) {
- glVertex3fv(data);
- data+=ofs;
+ glVertexPointer(3, GL_FLOAT, 0, data);
+
+ for (parts=0; parts<dl->parts; parts++)
+ glDrawArrays(GL_LINE_LOOP, parts*dl->nr, dl->nr);
+
+ break;
+ case DL_SURF:
+
+ glVertexPointer(3, GL_FLOAT, 0, data);
+
+ for (parts=0; parts<dl->parts; parts++) {
+ if (dl->flag & DL_CYCL_U)
+ glDrawArrays(GL_LINE_LOOP, parts*dl->nr, dl->nr);
+ else
+ glDrawArrays(GL_LINE_STRIP, parts*dl->nr, dl->nr);
}
- glEnd();
-
- /* (ton) this code crashes for me when resolv is 86 or higher... no clue */
+
+ for (nr=0; nr<dl->nr; nr++) {
+ int ofs= 3*dl->nr;
+
+ data= ( dl->verts )+3*nr;
+ parts= dl->parts;
+
+ if (dl->flag & DL_CYCL_V) glBegin(GL_LINE_LOOP);
+ else glBegin(GL_LINE_STRIP);
+
+ while (parts--) {
+ glVertex3fv(data);
+ data+=ofs;
+ }
+ glEnd();
+
+/* (ton) this code crashes for me when resolv is 86 or higher... no clue */
// glVertexPointer(3, GL_FLOAT, sizeof(float)*3*dl->nr, data + 3*nr);
// if (dl->flag & DL_CYCL_V)
// glDrawArrays(GL_LINE_LOOP, 0, dl->parts);
// else
// glDrawArrays(GL_LINE_STRIP, 0, dl->parts);
- }
- break;
-
- case DL_INDEX3:
- if (draw_index_wire) {
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
- }
- break;
-
- case DL_INDEX4:
- if (draw_index_wire) {
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
- }
- break;
+ }
+ break;
+
+ case DL_INDEX3:
+ if (draw_index_wire) {
+ glVertexPointer(3, GL_FLOAT, 0, dl->verts);
+ glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
+ }
+ break;
+
+ case DL_INDEX4:
+ if (draw_index_wire) {
+ glVertexPointer(3, GL_FLOAT, 0, dl->verts);
+ glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
+ }
+ break;
}
}
glDisableClientState(GL_VERTEX_ARRAY);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
return 0;
}
@@ -3756,88 +3757,88 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
ndata= dl->nors;
switch(dl->type) {
- case DL_SEGM:
- if (ob->type==OB_SURF) {
- int nr;
+ case DL_SEGM:
+ if (ob->type==OB_SURF) {
+ int nr;
- glDisable(GL_LIGHTING);
- glColor3fv(curcol);
-
- // glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- // glDrawArrays(GL_LINE_STRIP, 0, dl->nr);
+ glDisable(GL_LIGHTING);
+ glColor3fv(curcol);
- glBegin(GL_LINE_STRIP);
- for (nr= dl->nr; nr; nr--, data+=3)
- glVertex3fv(data);
- glEnd();
+ // glVertexPointer(3, GL_FLOAT, 0, dl->verts);
+ // glDrawArrays(GL_LINE_STRIP, 0, dl->nr);
- glEnable(GL_LIGHTING);
- }
- break;
- case DL_POLY:
- if (ob->type==OB_SURF) {
- int nr;
+ glBegin(GL_LINE_STRIP);
+ for (nr= dl->nr; nr; nr--, data+=3)
+ glVertex3fv(data);
+ glEnd();
- glDisable(GL_LIGHTING);
-
- /* for some reason glDrawArrays crashes here in half of the platforms (not osx) */
- //glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- //glDrawArrays(GL_LINE_LOOP, 0, dl->nr);
-
- glBegin(GL_LINE_LOOP);
- for (nr= dl->nr; nr; nr--, data+=3)
- glVertex3fv(data);
- glEnd();
-
- glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHTING);
+ }
break;
- }
- case DL_SURF:
-
- if (dl->index) {
+ case DL_POLY:
+ if (ob->type==OB_SURF) {
+ int nr;
+
+ glDisable(GL_LIGHTING);
+
+ /* for some reason glDrawArrays crashes here in half of the platforms (not osx) */
+ //glVertexPointer(3, GL_FLOAT, 0, dl->verts);
+ //glDrawArrays(GL_LINE_LOOP, 0, dl->nr);
+
+ glBegin(GL_LINE_LOOP);
+ for (nr= dl->nr; nr; nr--, data+=3)
+ glVertex3fv(data);
+ glEnd();
+
+ glEnable(GL_LIGHTING);
+ break;
+ }
+ case DL_SURF:
+
+ if (dl->index) {
+ GPU_enable_material(dl->col+1, (glsl)? &gattribs: NULL);
+
+ if (dl->rt & CU_SMOOTH) glShadeModel(GL_SMOOTH);
+ else glShadeModel(GL_FLAT);
+
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, dl->verts);
+ glNormalPointer(GL_FLOAT, 0, dl->nors);
+ glDrawElements(GL_QUADS, 4*dl->totindex, GL_UNSIGNED_INT, dl->index);
+ glDisableClientState(GL_NORMAL_ARRAY);
+ }
+ break;
+
+ case DL_INDEX3:
GPU_enable_material(dl->col+1, (glsl)? &gattribs: NULL);
-
- if (dl->rt & CU_SMOOTH) glShadeModel(GL_SMOOTH);
- else glShadeModel(GL_FLAT);
- glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glNormalPointer(GL_FLOAT, 0, dl->nors);
- glDrawElements(GL_QUADS, 4*dl->totindex, GL_UNSIGNED_INT, dl->index);
- glDisableClientState(GL_NORMAL_ARRAY);
- }
- break;
- case DL_INDEX3:
- GPU_enable_material(dl->col+1, (glsl)? &gattribs: NULL);
-
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-
- /* voor polys only one normal needed */
- if (index3_nors_incr) {
+ /* voor polys only one normal needed */
+ if (index3_nors_incr) {
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glNormalPointer(GL_FLOAT, 0, dl->nors);
+ }
+ else
+ glNormal3fv(ndata);
+
+ glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
+
+ if (index3_nors_incr)
+ glDisableClientState(GL_NORMAL_ARRAY);
+
+ break;
+
+ case DL_INDEX4:
+ GPU_enable_material(dl->col+1, (glsl)? &gattribs: NULL);
+
glEnableClientState(GL_NORMAL_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, dl->verts);
glNormalPointer(GL_FLOAT, 0, dl->nors);
- }
- else
- glNormal3fv(ndata);
-
- glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
-
- if (index3_nors_incr)
+ glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
glDisableClientState(GL_NORMAL_ARRAY);
- break;
-
- case DL_INDEX4:
- GPU_enable_material(dl->col+1, (glsl)? &gattribs: NULL);
-
- glEnableClientState(GL_NORMAL_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glNormalPointer(GL_FLOAT, 0, dl->nors);
- glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
- glDisableClientState(GL_NORMAL_ARRAY);
-
- break;
+ break;
}
dl= dl->next;
}
@@ -3879,7 +3880,7 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B
GPU_end_object_materials();
}
else {
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
+ if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_SOLID)==0)
drawCurveDMWired (ob);
}
@@ -3902,88 +3903,64 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
}
switch(ob->type) {
- case OB_FONT:
- case OB_CURVE:
- cu= ob->data;
-
- lb= &ob->disp;
-
- if (solid) {
- dl= lb->first;
- if (dl==NULL) return 1;
+ case OB_FONT:
+ case OB_CURVE:
+ cu= ob->data;
- if (dl->nors==NULL) addnormalsDispList(lb);
- index3_nors_incr= 0;
-
- if ( displist_has_faces(lb)==0) {
- if (!render_only) {
- draw_index_wire= 0;
- drawDispListwire(lb);
- draw_index_wire= 1;
- }
- }
- else {
- if (draw_glsl_material(scene, ob, v3d, dt)) {
- GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
- drawDispListsolid(lb, ob, 1);
- GPU_end_object_materials();
+ lb= &ob->disp;
+
+ if (solid) {
+ dl= lb->first;
+ if (dl==NULL) return 1;
+
+ if (dl->nors==NULL) addnormalsDispList(lb);
+ index3_nors_incr= 0;
+
+ if ( displist_has_faces(lb)==0) {
+ if (!render_only) {
+ draw_index_wire= 0;
+ drawDispListwire(lb);
+ draw_index_wire= 1;
+ }
}
else {
- GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
- drawDispListsolid(lb, ob, 0);
- GPU_end_object_materials();
+ if (draw_glsl_material(scene, ob, v3d, dt)) {
+ GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
+ drawDispListsolid(lb, ob, 1);
+ GPU_end_object_materials();
+ }
+ else {
+ GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
+ drawDispListsolid(lb, ob, 0);
+ GPU_end_object_materials();
+ }
+ if (cu->editnurb && cu->bevobj==NULL && cu->taperobj==NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) {
+ cpack(0);
+ draw_index_wire= 0;
+ drawDispListwire(lb);
+ draw_index_wire= 1;
+ }
}
- if (cu->editnurb && cu->bevobj==NULL && cu->taperobj==NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) {
- cpack(0);
+ index3_nors_incr= 1;
+ }
+ else {
+ if (!render_only || (render_only && displist_has_faces(lb))) {
draw_index_wire= 0;
- drawDispListwire(lb);
+ retval= drawDispListwire(lb);
draw_index_wire= 1;
}
}
- index3_nors_incr= 1;
- }
- else {
- if (!render_only || (render_only && displist_has_faces(lb))) {
- draw_index_wire= 0;
- retval= drawDispListwire(lb);
- draw_index_wire= 1;
- }
- }
- break;
- case OB_SURF:
+ break;
+ case OB_SURF:
- lb= &ob->disp;
-
- if (solid) {
- dl= lb->first;
- if (dl==NULL) return 1;
-
- if (dl->nors==NULL) addnormalsDispList(lb);
-
- if (draw_glsl_material(scene, ob, v3d, dt)) {
- GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
- drawDispListsolid(lb, ob, 1);
- GPU_end_object_materials();
- }
- else {
- GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
- drawDispListsolid(lb, ob, 0);
- GPU_end_object_materials();
- }
- }
- else {
- retval= drawDispListwire(lb);
- }
- break;
- case OB_MBALL:
-
- if ( is_basis_mball(ob)) {
lb= &ob->disp;
- if (lb->first==NULL) makeDispListMBall(scene, ob);
- if (lb->first==NULL) return 1;
-
+
if (solid) {
-
+ dl= lb->first;
+ if (dl==NULL) return 1;
+
+ if (dl->nors==NULL) addnormalsDispList(lb);
+
if (draw_glsl_material(scene, ob, v3d, dt)) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
drawDispListsolid(lb, ob, 1);
@@ -3995,12 +3972,36 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
GPU_end_object_materials();
}
}
- else{
- /* MetaBalls use DL_INDEX4 type of DispList */
+ else {
retval= drawDispListwire(lb);
}
- }
- break;
+ break;
+ case OB_MBALL:
+
+ if ( is_basis_mball(ob)) {
+ lb= &ob->disp;
+ if (lb->first==NULL) makeDispListMBall(scene, ob);
+ if (lb->first==NULL) return 1;
+
+ if (solid) {
+
+ if (draw_glsl_material(scene, ob, v3d, dt)) {
+ GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
+ drawDispListsolid(lb, ob, 1);
+ GPU_end_object_materials();
+ }
+ else {
+ GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
+ drawDispListsolid(lb, ob, 0);
+ GPU_end_object_materials();
+ }
+ }
+ else {
+ /* MetaBalls use DL_INDEX4 type of DispList */
+ retval= drawDispListwire(lb);
+ }
+ }
+ break;
}
return retval;
@@ -4022,7 +4023,7 @@ static void draw_particle_arrays(int draw_as, int totpoint, int ob_dt, int selec
if (ob_dt<=OB_WIRE || select)
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
else
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDrawArrays(GL_QUADS, 0, 4*totpoint);
break;
@@ -4093,13 +4094,13 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
add_v3_v3(vec, state->co);
copy_v3_v3(pdd->vd,vec); pdd->vd+=3;
copy_v3_v3(pdd->vd,vec2); pdd->vd+=3;
-
+
vec[1]=2.0f*pixsize;
vec[0]=vec[2]=0.0;
mul_qt_v3(state->rot,vec);
if (draw_as==PART_DRAW_AXIS) {
copy_v3_v3(vec2,state->co);
- }
+ }
else sub_v3_v3v3(vec2, state->co, vec);
add_v3_v3(vec, state->co);
@@ -4220,7 +4221,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* don't draw normal paths in edit mode */
if (psys_in_edit_mode(scene, psys) && (pset->flag & PE_DRAW_PART)==0)
return;
-
+
if (part->draw_as == PART_DRAW_REND)
draw_as = part->ren_as;
else
@@ -4356,8 +4357,10 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
}
if (ELEM3(draw_as, PART_DRAW_DOT, PART_DRAW_CROSS, PART_DRAW_LINE)
- && part->draw_col > PART_DRAW_COL_MAT)
+ && part->draw_col > PART_DRAW_COL_MAT)
+ {
create_cdata = 1;
+ }
if (!create_cdata && pdd && pdd->cdata) {
MEM_freeN(pdd->cdata);
@@ -4436,8 +4439,9 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* circles don't use drawdata, so have to add a special case here */
if ((pdd || draw_as==PART_DRAW_CIRC) && draw_as!=PART_DRAW_PATH) {
/* 5. */
- if (pdd && (pdd->flag & PARTICLE_DRAW_DATA_UPDATED)
- && (pdd->vedata || part->draw & (PART_DRAW_SIZE|PART_DRAW_NUM|PART_DRAW_HEALTH))==0) {
+ if (pdd && (pdd->flag & PARTICLE_DRAW_DATA_UPDATED) &&
+ (pdd->vedata || part->draw & (PART_DRAW_SIZE|PART_DRAW_NUM|PART_DRAW_HEALTH))==0)
+ {
totpoint = pdd->totpoint; /* draw data is up to date */
}
else for (a=0,pa=pars; a<totpart+totchild; a++, pa++) {
@@ -4473,7 +4477,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
weight_to_rgb(ma_col, intensity);
}
}
- else{
+ else {
ChildParticle *cpa= &psys->child[a-totpart];
pa_time=psys_get_child_time(psys,cpa,cfra,&pa_birthtime,&pa_dietime);
@@ -4754,7 +4758,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glNormalPointer(GL_FLOAT, 0, pdd->ndata);
glEnable(GL_LIGHTING);
}
- else{
+ else {
glDisableClientState(GL_NORMAL_ARRAY);
glDisable(GL_LIGHTING);
}
@@ -4921,7 +4925,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
if (key->flag&PEK_SELECT) {
copy_v3_v3(cd,sel_col);
}
- else{
+ else {
copy_v3_v3(cd,nosel_col);
}
@@ -4934,7 +4938,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
cd=cdata;
pd=pdata;
for (i=0, point=edit->points; i<totpoint; i++, point++) {
- if (point->flag & PEP_HIDE)
+ if (point->flag & PEP_HIDE || point->totkey == 0)
continue;
if (point->keys->flag & PEK_USE_WCO)
@@ -4954,7 +4958,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
}
else if (pset->selectmode == SCE_SELECT_END) {
for (i=0, point=edit->points; i<totpoint; i++, point++) {
- if ((point->flag & PEP_HIDE)==0) {
+ if ((point->flag & PEP_HIDE)==0 && point->totkey) {
key = point->keys + point->totkey - 1;
if (key->flag & PEK_SELECT)
glColor3fv(sel_col);
@@ -4997,12 +5001,12 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
root[0] = -drw_size;
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
+ glVertex3fv(root);
tip[1] = tip[2] = 0.0f;
tip[0] = drw_size;
mul_m3_v3(tr,tip);
add_v3_v3(tip, com);
- glVertex3fv(tip);
+ glVertex3fv(tip);
glEnd();
root[1] =0.0f; root[2] = tw;
@@ -5010,8 +5014,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
root[1] =0.0f; root[2] = -tw;
@@ -5019,8 +5023,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
root[1] = tw; root[2] = 0.0f;
@@ -5028,8 +5032,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
root[1] =-tw; root[2] = 0.0f;
@@ -5037,8 +5041,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
glColor4ub(0x00, 0x7F, 0x00, 155);
@@ -5048,12 +5052,12 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
root[1] = -drw_size;
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
+ glVertex3fv(root);
tip[0] = tip[2] = 0.0f;
tip[1] = drw_size;
mul_m3_v3(tr,tip);
add_v3_v3(tip, com);
- glVertex3fv(tip);
+ glVertex3fv(tip);
glEnd();
root[0] =0.0f; root[2] = tw;
@@ -5061,8 +5065,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
root[0] = 0.0f; root[2] = -tw;
@@ -5070,8 +5074,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
root[0] = tw; root[2] = 0.0f;
@@ -5079,8 +5083,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
root[0] =-tw; root[2] = 0.0f;
@@ -5088,8 +5092,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
glColor4ub(0x00, 0x00, 0x7F, 155);
@@ -5098,12 +5102,12 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
root[2] = -drw_size;
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
+ glVertex3fv(root);
tip[0] = tip[1] = 0.0f;
tip[2] = drw_size;
mul_m3_v3(tr,tip);
add_v3_v3(tip, com);
- glVertex3fv(tip);
+ glVertex3fv(tip);
glEnd();
root[0] =0.0f; root[1] = tw;
@@ -5111,8 +5115,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
root[0] =0.0f; root[1] = -tw;
@@ -5120,8 +5124,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
root[0] = tw; root[1] = 0.0f;
@@ -5129,8 +5133,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
root[0] = -tw; root[1] = 0.0f;
@@ -5138,8 +5142,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
- glVertex3fv(root);
- glVertex3fv(tip);
+ glVertex3fv(root);
+ glVertex3fv(tip);
glEnd();
}
@@ -5153,12 +5157,12 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles)
if (nu->hide || hide_handles) return;
- glBegin(GL_LINES);
+ glBegin(GL_LINES);
if (nu->type == CU_BEZIER) {
#define TH_HANDLE_COL_TOT ((TH_HANDLE_SEL_FREE - TH_HANDLE_FREE) + 1)
- /* use MIN2 when indexing to ensure newer files dont read outside the array */
+ /* use MIN2 when indexing to ensure newer files don't read outside the array */
unsigned char handle_cols[TH_HANDLE_COL_TOT][3];
const int basecol= sel ? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE;
@@ -5175,25 +5179,25 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles)
glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]);
glVertex3fv(fp);
- glVertex3fv(fp+3);
+ glVertex3fv(fp+3);
glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT-1)]);
- glVertex3fv(fp+3);
- glVertex3fv(fp+6);
+ glVertex3fv(fp+3);
+ glVertex3fv(fp+6);
}
else if ( (bezt->f1 & SELECT)==sel) {
fp= bezt->vec[0];
glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]);
- glVertex3fv(fp);
- glVertex3fv(fp+3);
+ glVertex3fv(fp);
+ glVertex3fv(fp+3);
}
else if ( (bezt->f3 & SELECT)==sel) {
fp= bezt->vec[1];
glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT-1)]);
- glVertex3fv(fp);
- glVertex3fv(fp+3);
+ glVertex3fv(fp);
+ glVertex3fv(fp+3);
}
}
bezt++;
@@ -5391,87 +5395,56 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
while (nu) {
if (nu->hide==0) {
switch(nu->type) {
- case CU_POLY:
- if (!sel && index== cu->actnu) {
- /* we should draw active spline highlight below everything */
- editnurb_draw_active_poly(nu);
- }
-
- UI_ThemeColor(TH_NURB_ULINE);
- bp= nu->bp;
- for (b=0; b<nu->pntsv; b++) {
- if (nu->flagu & 1) glBegin(GL_LINE_LOOP);
- else glBegin(GL_LINE_STRIP);
-
- for (a=0; a<nu->pntsu; a++, bp++) {
- glVertex3fv(bp->vec);
+ case CU_POLY:
+ if (!sel && index== cu->actnu) {
+ /* we should draw active spline highlight below everything */
+ editnurb_draw_active_poly(nu);
}
- glEnd();
- }
- break;
- case CU_NURBS:
- if (!sel && index== cu->actnu) {
- /* we should draw active spline highlight below everything */
- editnurb_draw_active_nurbs(nu);
- }
+ UI_ThemeColor(TH_NURB_ULINE);
+ bp= nu->bp;
+ for (b=0; b<nu->pntsv; b++) {
+ if (nu->flagu & 1) glBegin(GL_LINE_LOOP);
+ else glBegin(GL_LINE_STRIP);
- bp= nu->bp;
- for (b=0; b<nu->pntsv; b++) {
- bp1= bp;
- bp++;
- for (a=nu->pntsu-1; a>0; a--, bp++) {
- if (bp->hide==0 && bp1->hide==0) {
- if (sel) {
- if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT ) ) {
- UI_ThemeColor(TH_NURB_SEL_ULINE);
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(bp->vec);
- glVertex3fv(bp1->vec);
- glEnd();
- }
- }
- else {
- if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
- else {
- UI_ThemeColor(TH_NURB_ULINE);
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(bp->vec);
- glVertex3fv(bp1->vec);
- glEnd();
- }
- }
+ for (a=0; a<nu->pntsu; a++, bp++) {
+ glVertex3fv(bp->vec);
}
- bp1= bp;
+
+ glEnd();
+ }
+ break;
+ case CU_NURBS:
+ if (!sel && index== cu->actnu) {
+ /* we should draw active spline highlight below everything */
+ editnurb_draw_active_nurbs(nu);
}
- }
- if (nu->pntsv > 1) { /* surface */
- ofs= nu->pntsu;
- for (b=0; b<nu->pntsu; b++) {
- bp1= nu->bp+b;
- bp= bp1+ofs;
- for (a=nu->pntsv-1; a>0; a--, bp+=ofs) {
+ bp= nu->bp;
+ for (b=0; b<nu->pntsv; b++) {
+ bp1= bp;
+ bp++;
+ for (a=nu->pntsu-1; a>0; a--, bp++) {
if (bp->hide==0 && bp1->hide==0) {
if (sel) {
- if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) ) {
- UI_ThemeColor(TH_NURB_SEL_VLINE);
-
+ if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT ) ) {
+ UI_ThemeColor(TH_NURB_SEL_ULINE);
+
glBegin(GL_LINE_STRIP);
- glVertex3fv(bp->vec);
+ glVertex3fv(bp->vec);
glVertex3fv(bp1->vec);
glEnd();
}
}
else {
- if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
+ if ((bp->f1 & SELECT) && (bp1->f1 & SELECT)) {
+ /* pass */
+ }
else {
- UI_ThemeColor(TH_NURB_VLINE);
-
+ UI_ThemeColor(TH_NURB_ULINE);
+
glBegin(GL_LINE_STRIP);
- glVertex3fv(bp->vec);
+ glVertex3fv(bp->vec);
glVertex3fv(bp1->vec);
glEnd();
}
@@ -5480,9 +5453,44 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
bp1= bp;
}
}
+ if (nu->pntsv > 1) { /* surface */
+
+ ofs= nu->pntsu;
+ for (b=0; b<nu->pntsu; b++) {
+ bp1= nu->bp+b;
+ bp= bp1+ofs;
+ for (a=nu->pntsv-1; a>0; a--, bp+=ofs) {
+ if (bp->hide==0 && bp1->hide==0) {
+ if (sel) {
+ if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) ) {
+ UI_ThemeColor(TH_NURB_SEL_VLINE);
+
+ glBegin(GL_LINE_STRIP);
+ glVertex3fv(bp->vec);
+ glVertex3fv(bp1->vec);
+ glEnd();
+ }
+ }
+ else {
+ if ((bp->f1 & SELECT) && (bp1->f1 & SELECT)) {
+ /* pass */
+ }
+ else {
+ UI_ThemeColor(TH_NURB_VLINE);
+
+ glBegin(GL_LINE_STRIP);
+ glVertex3fv(bp->vec);
+ glVertex3fv(bp1->vec);
+ glEnd();
+ }
+ }
+ }
+ bp1= bp;
+ }
+ }
- }
- break;
+ }
+ break;
}
}
@@ -5529,12 +5537,12 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
/* direction vectors for 3d curve paths
- * when at its lowest, dont render normals */
- if (cu->flag & CU_3D && ts->normalsize > 0.0015f && (cu->drawflag & CU_HIDE_NORMALS)==0) {
+ * when at its lowest, don't render normals */
+ if ((cu->flag & CU_3D) && (ts->normalsize > 0.0015f) && (cu->drawflag & CU_HIDE_NORMALS)==0) {
UI_ThemeColor(TH_WIRE);
for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) {
- BevPoint *bevp= (BevPoint *)(bl+1);
+ BevPoint *bevp= (BevPoint *)(bl + 1);
int nr= bl->nr;
int skip= nu->resolu/16;
@@ -5593,8 +5601,8 @@ static void draw_empty_sphere (float size)
glPushMatrix();
- qobj = gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
+ qobj = gluNewQuadric();
+ gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
gluDisk(qobj, 0.0, 1, 16, 1);
glRotatef(90, 0, 1, 0);
@@ -5603,7 +5611,7 @@ static void draw_empty_sphere (float size)
glRotatef(90, 1, 0, 0);
gluDisk(qobj, 0.0, 1, 16, 1);
- gluDeleteQuadric(qobj);
+ gluDeleteQuadric(qobj);
glPopMatrix();
glEndList();
@@ -5619,8 +5627,8 @@ static void draw_empty_cone (float size)
{
float cent=0;
float radius;
- GLUquadricObj *qobj = gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
+ GLUquadricObj *qobj = gluNewQuadric();
+ gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
glPushMatrix();
@@ -5633,7 +5641,7 @@ static void draw_empty_cone (float size)
glPopMatrix();
- gluDeleteQuadric(qobj);
+ gluDeleteQuadric(qobj);
}
/* draw points on curve speed handles */
@@ -5649,7 +5657,7 @@ static void curve_draw_speed(Scene *scene, Object *ob)
if (cu->ipo==NULL)
return;
- icu= cu->ipo->curve.first;
+ icu= cu->ipo->curve.first;
if (icu==NULL || icu->totvert<2)
return;
@@ -5783,14 +5791,14 @@ static void drawtube(const float vec[3], float radius, float height, float tmat[
drawcircball(GL_LINE_LOOP, cur, radius, tmat);
glBegin(GL_LINES);
- glVertex3f(vec[0]+radius,vec[1],vec[2]);
- glVertex3f(cur[0]+radius,cur[1],cur[2]);
- glVertex3f(vec[0]-radius,vec[1],vec[2]);
- glVertex3f(cur[0]-radius,cur[1],cur[2]);
- glVertex3f(vec[0],vec[1]+radius,vec[2]);
- glVertex3f(cur[0],cur[1]+radius,cur[2]);
- glVertex3f(vec[0],vec[1]-radius,vec[2]);
- glVertex3f(cur[0],cur[1]-radius,cur[2]);
+ glVertex3f(vec[0]+radius,vec[1],vec[2]);
+ glVertex3f(cur[0]+radius,cur[1],cur[2]);
+ glVertex3f(vec[0]-radius,vec[1],vec[2]);
+ glVertex3f(cur[0]-radius,cur[1],cur[2]);
+ glVertex3f(vec[0],vec[1]+radius,vec[2]);
+ glVertex3f(cur[0],cur[1]+radius,cur[2]);
+ glVertex3f(vec[0],vec[1]-radius,vec[2]);
+ glVertex3f(cur[0],cur[1]-radius,cur[2]);
glEnd();
}
/* needs fixing if non-identity matrice used */
@@ -5804,14 +5812,14 @@ static void drawcone(const float vec[3], float radius, float height, float tmat[
drawcircball(GL_LINE_LOOP, cur, radius, tmat);
glBegin(GL_LINES);
- glVertex3f(vec[0],vec[1],vec[2]);
- glVertex3f(cur[0]+radius,cur[1],cur[2]);
- glVertex3f(vec[0],vec[1],vec[2]);
- glVertex3f(cur[0]-radius,cur[1],cur[2]);
- glVertex3f(vec[0],vec[1],vec[2]);
- glVertex3f(cur[0],cur[1]+radius,cur[2]);
- glVertex3f(vec[0],vec[1],vec[2]);
- glVertex3f(cur[0],cur[1]-radius,cur[2]);
+ glVertex3f(vec[0],vec[1],vec[2]);
+ glVertex3f(cur[0]+radius,cur[1],cur[2]);
+ glVertex3f(vec[0],vec[1],vec[2]);
+ glVertex3f(cur[0]-radius,cur[1],cur[2]);
+ glVertex3f(vec[0],vec[1],vec[2]);
+ glVertex3f(cur[0],cur[1]+radius,cur[2]);
+ glVertex3f(vec[0],vec[1],vec[2]);
+ glVertex3f(cur[0],cur[1]-radius,cur[2]);
glEnd();
}
/* return 1 if nothing was drawn */
@@ -5852,7 +5860,7 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
normalize_v3(imat[1]);
while (ml) {
-
+
/* draw radius */
if (mb->editelems) {
if ((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0);
@@ -5895,7 +5903,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
if (ob==OBACT) curcol= TH_ACTIVE;
else curcol= TH_SELECT;
}
- else curcol= TH_WIRE;
+ else curcol= TH_EMPTY;
/* scale size of circle etc with the empty drawsize */
if (ob->type == OB_EMPTY) size = ob->empty_drawsize;
@@ -5914,8 +5922,10 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
//if (has_ipo_code(ob->ipo, OB_PD_FSTR))
// force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, scene->r.cfra);
- //else
+ //else
+ {
force_val = pd->f_strength;
+ }
force_val *= 0.1f;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
vec[2]= 0.5f * force_val;
@@ -5930,10 +5940,12 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
else if (pd->forcefield == PFIELD_FORCE) {
float ffall_val;
- //if (has_ipo_code(ob->ipo, OB_PD_FFALL))
+ //if (has_ipo_code(ob->ipo, OB_PD_FFALL))
// ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, scene->r.cfra);
- //else
+ //else
+ {
ffall_val = pd->f_power;
+ }
UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
drawcircball(GL_LINE_LOOP, vec, size, imat);
@@ -5946,15 +5958,17 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
float /*ffall_val,*/ force_val;
unit_m4(tmat);
- //if (has_ipo_code(ob->ipo, OB_PD_FFALL))
+ //if (has_ipo_code(ob->ipo, OB_PD_FFALL))
// ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, scene->r.cfra);
- //else
+ //else
// ffall_val = pd->f_power;
//if (has_ipo_code(ob->ipo, OB_PD_FSTR))
// force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, scene->r.cfra);
- //else
+ //else
+ {
force_val = pd->f_strength;
+ }
UI_ThemeColorBlend(curcol, TH_BACK, 0.7f);
if (force_val < 0) {
@@ -5973,8 +5987,10 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
//if (has_ipo_code(ob->ipo, OB_PD_FSTR))
// mindist = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, scene->r.cfra);
- //else
+ //else
+ {
mindist = pd->f_strength;
+ }
/*path end*/
setlinestyle(3);
@@ -5998,7 +6014,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
if (pd->falloff==PFIELD_FALL_SPHERE) {
/* as last, guide curve alters it */
if (pd->flag & PFIELD_USEMAX)
- drawcircball(GL_LINE_LOOP, vec, pd->maxdist, imat);
+ drawcircball(GL_LINE_LOOP, vec, pd->maxdist, imat);
if (pd->flag & PFIELD_USEMIN)
drawcircball(GL_LINE_LOOP, vec, pd->mindist, imat);
@@ -6091,9 +6107,9 @@ static void get_local_bounds(Object *ob, float center[3], float size[3])
static void draw_bb_quadric(BoundBox *bb, char type)
{
float size[3], cent[3];
- GLUquadricObj *qobj = gluNewQuadric();
+ GLUquadricObj *qobj = gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
+ gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
size[0]= 0.5f*fabsf(bb->vec[0][0] - bb->vec[4][0]);
size[1]= 0.5f*fabsf(bb->vec[0][1] - bb->vec[2][1]);
@@ -6108,7 +6124,7 @@ static void draw_bb_quadric(BoundBox *bb, char type)
glTranslatef(cent[0], cent[1], cent[2]);
glScalef(size[0], size[1], size[2]);
gluSphere(qobj, 1.0, 8, 5);
- }
+ }
else if (type==OB_BOUND_CYLINDER) {
float radius = size[0] > size[1] ? size[0] : size[1];
glTranslatef(cent[0], cent[1], cent[2]-size[2]);
@@ -6123,7 +6139,7 @@ static void draw_bb_quadric(BoundBox *bb, char type)
}
glPopMatrix();
- gluDeleteQuadric(qobj);
+ gluDeleteQuadric(qobj);
}
static void draw_bounding_volume(Scene *scene, Object *ob, char type)
@@ -6145,6 +6161,9 @@ static void draw_bounding_volume(Scene *scene, Object *ob, char type)
}
}
}
+ else if (ob->type == OB_ARMATURE) {
+ bb = BKE_armature_get_bb(ob);
+ }
else {
drawcube();
return;
@@ -6352,7 +6371,7 @@ static void drawRBpivot(bRigidBodyJointConstraint *data)
mul_m4_v3(mat,dir);
add_v3_v3(v, dir);
glVertex3fv(&data->pivX);
- glVertex3fv(v);
+ glVertex3fv(v);
glEnd();
view3d_cached_text_draw_add(v, axis_str[axis], 0, V3D_CACHE_TEXT_ASCII, tcol);
@@ -6380,11 +6399,14 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (ob!=scene->obedit) {
- if (ob->restrictflag & OB_RESTRICT_VIEW)
+ if (ob->restrictflag & OB_RESTRICT_VIEW) {
return;
- if ((ob->restrictflag & OB_RESTRICT_RENDER) &&
- (v3d->flag2 & V3D_RENDER_OVERRIDE))
+ }
+ else if ((ob->restrictflag & OB_RESTRICT_RENDER) &&
+ (v3d->flag2 & V3D_RENDER_OVERRIDE))
+ {
return;
+ }
}
/* XXX particles are not safe for simultaneous threaded render */
@@ -6438,9 +6460,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
project_short(ar, ob->obmat[3], &base->sx);
- if ( (scene->obedit == NULL) &&
- (G.moving & G_TRANSFORM_OBJ) &&
- (base->flag & (SELECT+BA_WAS_SEL)))
+ if ((scene->obedit == NULL) &&
+ (G.moving & G_TRANSFORM_OBJ) &&
+ (base->flag & (SELECT+BA_WAS_SEL)))
{
theme_id= TH_TRANSFORM;
}
@@ -6479,6 +6501,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
else {
if (ob->type==OB_LAMP) theme_id= TH_LAMP;
else if (ob->type==OB_SPEAKER) theme_id= TH_SPEAKER;
+ else if (ob->type==OB_CAMERA) theme_id= TH_CAMERA;
+ else if (ob->type==OB_EMPTY) theme_id= TH_EMPTY;
/* fallback to TH_WIRE */
}
}
@@ -6588,9 +6612,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
vec1[1] += cu->linedist * cu->fsize;
vec2[1] -= cu->lines * cu->linedist * cu->fsize;
setlinestyle(3);
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec1);
- glVertex2fv(vec2);
+ glBegin(GL_LINE_STRIP);
+ glVertex2fv(vec1);
+ glVertex2fv(vec2);
glEnd();
setlinestyle(0);
}
@@ -6646,7 +6670,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
}
else if (dt==OB_BOUNDBOX) {
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE) == 0) {
+ if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_WIRE) == 0) {
draw_bounding_volume(scene, ob, ob->boundtype);
}
}
@@ -6664,8 +6688,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
drawnurb(scene, v3d, rv3d, base, nurbs->first, dt);
}
else if (dt==OB_BOUNDBOX) {
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+ if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && (v3d->drawtype >= OB_WIRE)) == 0) {
draw_bounding_volume(scene, ob, ob->boundtype);
+ }
}
else if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
@@ -6681,10 +6706,11 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if (mb->editelems)
drawmball(scene, v3d, rv3d, base, dt);
else if (dt==OB_BOUNDBOX) {
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+ if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && (v3d->drawtype >= OB_WIRE)) == 0) {
draw_bounding_volume(scene, ob, ob->boundtype);
+ }
}
- else
+ else
empty_object= drawmball(scene, v3d, rv3d, base, dt);
break;
}
@@ -6705,12 +6731,12 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
break;
case OB_CAMERA:
- if ( (v3d->flag2 & V3D_RENDER_OVERRIDE)==0 ||
- (rv3d->persp==RV3D_CAMOB && v3d->camera==ob)) /* special exception for active camera */
- {
- drawcamera(scene, v3d, rv3d, base, flag);
- break;
- }
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0 ||
+ (rv3d->persp==RV3D_CAMOB && v3d->camera==ob)) /* special exception for active camera */
+ {
+ drawcamera(scene, v3d, rv3d, base, flag);
+ break;
+ }
case OB_SPEAKER:
if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
drawspeaker(scene, v3d, rv3d, ob, flag);
@@ -6721,10 +6747,20 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
break;
case OB_ARMATURE:
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
- if (dt>OB_WIRE) GPU_enable_material(0, NULL); // we use default material
- empty_object= draw_armature(scene, v3d, ar, base, dt, flag, FALSE);
- if (dt>OB_WIRE) GPU_disable_material();
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+ /* Do not allow boundbox in edit nor pose mode! */
+ if ((dt == OB_BOUNDBOX) && (ob->mode & (OB_MODE_EDIT | OB_MODE_POSE)))
+ dt = OB_WIRE;
+ if (dt == OB_BOUNDBOX) {
+ draw_bounding_volume(scene, ob, ob->boundtype);
+ }
+ else {
+ if (dt>OB_WIRE)
+ GPU_enable_material(0, NULL); /* we use default material */
+ empty_object = draw_armature(scene, v3d, ar, base, dt, flag, FALSE);
+ if (dt>OB_WIRE)
+ GPU_disable_material();
+ }
}
break;
default:
@@ -6736,7 +6772,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
if (ob->soft /*&& flag & OB_SBMOTION*/) {
- float mrt[3][3],msc[3][3],mtr[3][3];
+ float mrt[3][3],msc[3][3],mtr[3][3];
SoftBody *sb= NULL;
float tipw = 0.5f, tiph = 0.5f,drawsize = 4.0f;
if ((sb= ob->soft)) {
@@ -6745,7 +6781,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
glLoadMatrixf(rv3d->viewmat);
copy_m3_m3(msc,sb->lscale);
copy_m3_m3(mrt,sb->lrot);
- mul_m3_m3m3(mtr,mrt,msc);
+ mul_m3_m3m3(mtr,mrt,msc);
ob_draw_RE_motion(sb->lcom,mtr,tipw,tiph,drawsize);
glMultMatrixf(ob->obmat);
}
@@ -6758,11 +6794,12 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
/* code for new particle system */
- if ( (warning_recursive==0) &&
- (ob->particlesystem.first) &&
- (flag & DRAW_PICKING)==0 &&
- (ob!=scene->obedit)
- ) {
+ if ((warning_recursive==0) &&
+ (ob->particlesystem.first) &&
+ (flag & DRAW_PICKING)==0 &&
+ (ob!=scene->obedit)
+ )
+ {
ParticleSystem *psys;
if (col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */
@@ -6866,7 +6903,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
float *density = smoke_get_density(smd->domain->fluid);
glLoadMatrixf(rv3d->viewmat);
- // glMultMatrixf(ob->obmat);
+ // glMultMatrixf(ob->obmat);
if (col || (ob->flag & SELECT)) cpack(0xFFFFFF);
glDepthMask(GL_FALSE);
@@ -6876,22 +6913,23 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
// glPointSize(3.0);
bglBegin(GL_POINTS);
- for (x = 0; x < smd->domain->res[0]; x++)
- for (y = 0; y < smd->domain->res[1]; y++)
- for (z = 0; z < smd->domain->res[2]; z++)
- {
- float tmp[3];
- int index = smoke_get_index(x, smd->domain->res[0], y, smd->domain->res[1], z);
-
- if (density[index] > FLT_EPSILON) {
- float color[3];
- copy_v3_v3(tmp, smd->domain->p0);
- tmp[0] += smd->domain->dx * x + smd->domain->dx * 0.5;
- tmp[1] += smd->domain->dx * y + smd->domain->dx * 0.5;
- tmp[2] += smd->domain->dx * z + smd->domain->dx * 0.5;
- color[0] = color[1] = color[2] = density[index];
- glColor3fv(color);
- bglVertex3fv(tmp);
+ for (x = 0; x < smd->domain->res[0]; x++) {
+ for (y = 0; y < smd->domain->res[1]; y++) {
+ for (z = 0; z < smd->domain->res[2]; z++) {
+ float tmp[3];
+ int index = smoke_get_index(x, smd->domain->res[0], y, smd->domain->res[1], z);
+
+ if (density[index] > FLT_EPSILON) {
+ float color[3];
+ copy_v3_v3(tmp, smd->domain->p0);
+ tmp[0] += smd->domain->dx * x + smd->domain->dx * 0.5;
+ tmp[1] += smd->domain->dx * y + smd->domain->dx * 0.5;
+ tmp[2] += smd->domain->dx * z + smd->domain->dx * 0.5;
+ color[0] = color[1] = color[2] = density[index];
+ glColor3fv(color);
+ bglVertex3fv(tmp);
+ }
+ }
}
}
@@ -6949,7 +6987,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
if (dtx & OB_DRAWNAME) {
/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
- /* but, we also dont draw names for sets or duplicators */
+ /* but, we also don't draw names for sets or duplicators */
if (flag == 0) {
float zero[3]= {0,0,0};
float curcol[4];
@@ -7003,7 +7041,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
int do_draw_center= -1; /* defines below are zero or positive... */
if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
- /* dont draw */
+ /* don't draw */
}
else if ((scene->basact)==base)
do_draw_center= ACTIVE;
@@ -7018,7 +7056,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
glBegin(GL_POINTS);
glVertex3fv(ob->obmat[3]);
glEnd();
- }
+ }
else if ((flag & DRAW_CONSTCOLOR)==0) {
/* we don't draw centers for duplicators and sets */
if (U.obcenter_dia > 0) {
@@ -7097,7 +7135,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
for (ct= targets.first; ct; ct= ct->next) {
/* calculate target's matrix */
- if (cti->get_target_matrix)
+ if (cti->get_target_matrix)
cti->get_target_matrix(curcon, cob, ct, BKE_curframe(scene));
else
unit_m4(ct->matrix);
@@ -7231,7 +7269,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
if (check_ob_drawface_dot(scene, v3d, ob->dt)) {
glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE));
-
+
bglBegin(GL_POINTS);
dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, ptrs);
bglEnd();
@@ -7299,64 +7337,64 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
glEnable(GL_DEPTH_TEST);
switch( ob->type) {
- case OB_MESH:
- if (ob->mode & OB_MODE_EDIT) {
- Mesh *me= ob->data;
- BMEditMesh *em= me->edit_btmesh;
+ case OB_MESH:
+ if (ob->mode & OB_MODE_EDIT) {
+ Mesh *me= ob->data;
+ BMEditMesh *em= me->edit_btmesh;
- DerivedMesh *dm = editbmesh_get_derived_cage(scene, ob, em, CD_MASK_BAREMESH);
+ DerivedMesh *dm = editbmesh_get_derived_cage(scene, ob, em, CD_MASK_BAREMESH);
- EDBM_init_index_arrays(em, 1, 1, 1);
+ EDBM_init_index_arrays(em, 1, 1, 1);
- bbs_mesh_solid_EM(em, scene, v3d, ob, dm, ts->selectmode & SCE_SELECT_FACE);
- if (ts->selectmode & SCE_SELECT_FACE)
- bm_solidoffs = 1+em->bm->totface;
- else
- bm_solidoffs= 1;
-
- bglPolygonOffset(rv3d->dist, 1.0);
-
- // we draw edges always, for loop (select) tools
- bbs_mesh_wire(em, dm, bm_solidoffs);
- bm_wireoffs= bm_solidoffs + em->bm->totedge;
-
- // we draw verts if vert select mode or if in transform (for snap).
- if (ts->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT) {
- bbs_mesh_verts(em, dm, bm_wireoffs);
- bm_vertoffs= bm_wireoffs + em->bm->totvert;
- }
- else bm_vertoffs= bm_wireoffs;
-
- bglPolygonOffset(rv3d->dist, 0.0);
+ bbs_mesh_solid_EM(em, scene, v3d, ob, dm, ts->selectmode & SCE_SELECT_FACE);
+ if (ts->selectmode & SCE_SELECT_FACE)
+ bm_solidoffs = 1+em->bm->totface;
+ else
+ bm_solidoffs= 1;
- dm->release(dm);
+ bglPolygonOffset(rv3d->dist, 1.0);
- EDBM_free_index_arrays(em);
- }
- else {
- Mesh *me= ob->data;
- if ( (me->editflag & ME_EDIT_VERT_SEL) &&
- /* currently vertex select only supports weight paint */
- (ob->mode & OB_MODE_WEIGHT_PAINT))
- {
- DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
- glColor3ub(0, 0, 0);
+ // we draw edges always, for loop (select) tools
+ bbs_mesh_wire(em, dm, bm_solidoffs);
+ bm_wireoffs= bm_solidoffs + em->bm->totedge;
- dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, GPU_enable_material, NULL, me, 0);
+ // we draw verts if vert select mode or if in transform (for snap).
+ if ((ts->selectmode & SCE_SELECT_VERTEX) || (G.moving & G_TRANSFORM_EDIT)) {
+ bbs_mesh_verts(em, dm, bm_wireoffs);
+ bm_vertoffs= bm_wireoffs + em->bm->totvert;
+ }
+ else bm_vertoffs= bm_wireoffs;
+
+ bglPolygonOffset(rv3d->dist, 0.0);
-
- bbs_obmode_mesh_verts(ob, dm, 1);
- bm_vertoffs = me->totvert+1;
dm->release(dm);
+
+ EDBM_free_index_arrays(em);
}
else {
- bbs_mesh_solid(scene, ob);
+ Mesh *me= ob->data;
+ if ( (me->editflag & ME_EDIT_VERT_SEL) &&
+ /* currently vertex select only supports weight paint */
+ (ob->mode & OB_MODE_WEIGHT_PAINT))
+ {
+ DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
+ glColor3ub(0, 0, 0);
+
+ dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, GPU_enable_material, NULL, me, 0);
+
+
+ bbs_obmode_mesh_verts(ob, dm, 1);
+ bm_vertoffs = me->totvert+1;
+ dm->release(dm);
+ }
+ else {
+ bbs_mesh_solid(scene, ob);
+ }
}
- }
- break;
- case OB_CURVE:
- case OB_SURF:
- break;
+ break;
+ case OB_CURVE:
+ case OB_SURF:
+ break;
}
glLoadMatrixf(rv3d->viewmat);
@@ -7368,7 +7406,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
/* helper function for drawing object instances - meshes */
static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d,
- Object *ob, int dt, int outline)
+ Object *ob, int dt, int outline)
{
Mesh *me= ob->data;
DerivedMesh *dm=NULL, *edm=NULL;
@@ -7376,14 +7414,14 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
if (ob->mode & OB_MODE_EDIT)
edm= editbmesh_get_derived_base(ob, me->edit_btmesh);
- else
+ else
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
if (dt<=OB_WIRE) {
if (dm)
dm->drawEdges(dm, 1, 0);
else if (edm)
- edm->drawEdges(edm, 1, 0);
+ edm->drawEdges(edm, 1, 0);
}
else {
if (outline)
@@ -7418,9 +7456,9 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int dt, int outline)
{
- if (ob == NULL)
+ if (ob == NULL)
return;
-
+
switch (ob->type) {
case OB_MESH:
draw_object_mesh_instance(scene, v3d, rv3d, ob, dt, outline);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 405ce80323b..0d0d1bd3139 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -384,72 +384,72 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
/* object ops. */
/* important to be before Pose keymap since they can both be enabled at once */
- keymap= WM_keymap_find(wm->defaultconf, "Face Mask", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Face Mask", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Weight Paint Vertex Selection", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Weight Paint Vertex Selection", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* pose is not modal, operator poll checks for this */
- keymap= WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Object Mode", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Object Mode", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Vertex Paint", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Vertex Paint", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Weight Paint", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Weight Paint", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Sculpt", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Sculpt", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Mesh", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Mesh", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Curve", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Curve", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Armature", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Armature", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Metaball", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Metaball", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Lattice", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Lattice", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* armature sketching needs to take over mouse */
- keymap= WM_keymap_find(wm->defaultconf, "Armature Sketch", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Armature Sketch", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Particle", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Particle", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* editfont keymap swallows all... */
- keymap= WM_keymap_find(wm->defaultconf, "Font", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Font", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Object Non-modal", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Object Non-modal", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* own keymap, last so modes can override it */
- keymap= WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "3D View", SPACE_VIEW3D, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "3D View", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* add drop boxes */
@@ -812,7 +812,7 @@ static void view3d_main_area_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion
/* add handlers, stuff you only do once or on area/region changes */
static void view3d_header_area_init(wmWindowManager *wm, ARegion *ar)
{
- wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
+ wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
@@ -856,7 +856,7 @@ static void view3d_buttons_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap= WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -955,7 +955,7 @@ static void view3d_tools_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap= WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index a9521a61eb2..953f22a2b65 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -1004,11 +1004,11 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
uiDefBut(block, LABEL, 0, "Location:", 0, 240, 100, 20, 0, 0, 0, 0, 0, "");
uiBlockBeginAlign(block);
- but= uiDefButF(block, NUM, B_ARMATUREPANEL2, "X:", 0, 220, 120, 19, pchan->loc, -lim, lim, 100, 3, "");
+ but = uiDefButF(block, NUM, B_ARMATUREPANEL2, "X:", 0, 220, 120, 19, pchan->loc, -lim, lim, 100, 3, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
- but= uiDefButF(block, NUM, B_ARMATUREPANEL2, "Y:", 0, 200, 120, 19, pchan->loc+1, -lim, lim, 100, 3, "");
+ but = uiDefButF(block, NUM, B_ARMATUREPANEL2, "Y:", 0, 200, 120, 19, pchan->loc+1, -lim, lim, 100, 3, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
- but= uiDefButF(block, NUM, B_ARMATUREPANEL2, "Z:", 0, 180, 120, 19, pchan->loc+2, -lim, lim, 100, 3, "");
+ but = uiDefButF(block, NUM, B_ARMATUREPANEL2, "Z:", 0, 180, 120, 19, pchan->loc+2, -lim, lim, 100, 3, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
uiBlockEndAlign(block);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 3d570252126..1f6ec45f908 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -541,7 +541,7 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
int mx, my, co[2];
int flag;
- /* we dont want the clipping for cursor */
+ /* we don't want the clipping for cursor */
flag= v3d->flag;
v3d->flag= 0;
project_int(ar, give_cursor(scene, v3d), co);
@@ -956,10 +956,10 @@ static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionV
rect_camera= params.viewplane;
/* get camera border within viewport */
- viewborder_r->xmin= ((rect_camera.xmin - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx;
- viewborder_r->xmax= ((rect_camera.xmax - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx;
- viewborder_r->ymin= ((rect_camera.ymin - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy;
- viewborder_r->ymax= ((rect_camera.ymax - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy;
+ viewborder_r->xmin = ((rect_camera.xmin - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx;
+ viewborder_r->xmax = ((rect_camera.xmax - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx;
+ viewborder_r->ymin = ((rect_camera.ymin - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy;
+ viewborder_r->ymax = ((rect_camera.ymax - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy;
}
void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, float size_r[2])
@@ -1236,19 +1236,19 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
float sensor_scale = (x2i-x1i) / sensor_x;
float sensor_height = sensor_scale * sensor_y;
- rect.xmin= x1i;
- rect.xmax= x2i;
- rect.ymin= (y1i + y2i)*0.5f - sensor_height*0.5f;
- rect.ymax= rect.ymin + sensor_height;
+ rect.xmin = x1i;
+ rect.xmax = x2i;
+ rect.ymin = (y1i + y2i)*0.5f - sensor_height*0.5f;
+ rect.ymax = rect.ymin + sensor_height;
}
else {
float sensor_scale = (y2i-y1i) / sensor_y;
float sensor_width = sensor_scale * sensor_x;
- rect.xmin= (x1i + x2i)*0.5f - sensor_width*0.5f;
- rect.xmax= rect.xmin + sensor_width;
- rect.ymin= y1i;
- rect.ymax= y2i;
+ rect.xmin = (x1i + x2i)*0.5f - sensor_width*0.5f;
+ rect.xmax = rect.xmin + sensor_width;
+ rect.ymin = y1i;
+ rect.ymax = y2i;
}
/* draw */
@@ -1488,7 +1488,7 @@ unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int
goto exit;
}
}
- else{
+ else {
*dist= (short) sqrt( (float)distance ); // XXX, this distance is wrong -
index = *tbuf - min+1; // messy yah, but indices start at 1
goto exit;
@@ -1599,7 +1599,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
asp= ( (float)ibuf->y)/(float)ibuf->x;
- vec[0] = vec[1] = vec[2] = 0.0;
+ zero_v3(vec);
ED_view3d_project_float_v2(ar, vec, sco, rv3d->persmat);
cx = sco[0];
cy = sco[1];
@@ -1908,10 +1908,10 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
rcti r;
/* clamp rect by area */
- r.xmin= 0;
- r.xmax= ar->winx-1;
- r.ymin= 0;
- r.ymax= ar->winy-1;
+ r.xmin = 0;
+ r.xmax = ar->winx-1;
+ r.ymin = 0;
+ r.ymax = ar->winy-1;
/* Constrain rect to depth bounds */
BLI_isect_rcti(&r, rect, rect);
@@ -2097,7 +2097,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
}
}
- /* this isnt that nice, draw xray objects as if they are normal */
+ /* this isn't that nice, draw xray objects as if they are normal */
if ( v3d->afterdraw_transp.first ||
v3d->afterdraw_xray.first ||
v3d->afterdraw_xraytransp.first
@@ -2301,7 +2301,7 @@ CustomDataMask ED_view3d_object_datamask(Scene *scene)
}
if (ob->mode & OB_MODE_WEIGHT_PAINT) {
- mask |= CD_MASK_WEIGHT_MCOL;
+ mask |= CD_MASK_PREVIEW_MCOL;
}
}
@@ -2403,10 +2403,10 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
ar->winx= winx;
ar->winy= winy;
- ar->winrct.xmin= 0;
- ar->winrct.ymin= 0;
- ar->winrct.xmax= winx;
- ar->winrct.ymax= winy;
+ ar->winrct.xmin = 0;
+ ar->winrct.ymin = 0;
+ ar->winrct.xmax = winx;
+ ar->winrct.ymax = winy;
/* set flags */
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 0b12db5d290..f8404937f7e 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -476,7 +476,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
ED_view3d_win_to_vector(vod->ar, mval_f, vod->mousevec);
}
- /* lookup, we dont pass on v3d to prevent confusement */
+ /* lookup, we don't pass on v3d to prevent confusement */
vod->grid= vod->v3d->grid;
vod->far= vod->v3d->far;
@@ -517,8 +517,6 @@ static void viewops_data_free(bContext *C, wmOperator *op)
/* ************************** viewrotate **********************************/
-static const float thres = 0.93f; //cos(20 deg);
-
#define COS45 0.7071068
#define SIN45 COS45
@@ -950,18 +948,18 @@ void VIEW3D_OT_rotate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Rotate view";
+ ot->name = "Rotate view";
ot->description = "Rotate the view";
- ot->idname= "VIEW3D_OT_rotate";
+ ot->idname = "VIEW3D_OT_rotate";
/* api callbacks */
- ot->invoke= viewrotate_invoke;
- ot->modal= viewrotate_modal;
- ot->poll= ED_operator_region_view3d_active;
- ot->cancel= viewrotate_cancel;
+ ot->invoke = viewrotate_invoke;
+ ot->modal = viewrotate_modal;
+ ot->poll = ED_operator_region_view3d_active;
+ ot->cancel = viewrotate_cancel;
/* flags */
- ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
}
/* NDOF utility functions
@@ -1377,18 +1375,18 @@ void VIEW3D_OT_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move view";
+ ot->name = "Move view";
ot->description = "Move the view";
- ot->idname= "VIEW3D_OT_move";
+ ot->idname = "VIEW3D_OT_move";
/* api callbacks */
- ot->invoke= viewmove_invoke;
- ot->modal= viewmove_modal;
- ot->poll= ED_operator_view3d_active;
- ot->cancel= viewmove_cancel;
+ ot->invoke = viewmove_invoke;
+ ot->modal = viewmove_modal;
+ ot->poll = ED_operator_view3d_active;
+ ot->cancel = viewmove_cancel;
/* flags */
- ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
}
/* ************************ viewzoom ******************************** */
@@ -1760,19 +1758,19 @@ static int viewzoom_cancel(bContext *C, wmOperator *op)
void VIEW3D_OT_zoom(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Zoom View";
+ ot->name = "Zoom View";
ot->description = "Zoom in/out in the view";
- ot->idname= "VIEW3D_OT_zoom";
+ ot->idname = "VIEW3D_OT_zoom";
/* api callbacks */
- ot->invoke= viewzoom_invoke;
- ot->exec= viewzoom_exec;
- ot->modal= viewzoom_modal;
- ot->poll= ED_operator_region_view3d_active;
- ot->cancel= viewzoom_cancel;
+ ot->invoke = viewzoom_invoke;
+ ot->exec = viewzoom_exec;
+ ot->modal = viewzoom_modal;
+ ot->poll = ED_operator_region_view3d_active;
+ ot->cancel = viewzoom_cancel;
/* flags */
- ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "mx", 0, 0, INT_MAX, "Zoom Position X", "", 0, INT_MAX);
@@ -1993,19 +1991,19 @@ static int viewdolly_cancel(bContext *C, wmOperator *op)
void VIEW3D_OT_dolly(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Dolly view";
+ ot->name = "Dolly view";
ot->description = "Dolly in/out in the view";
- ot->idname= "VIEW3D_OT_dolly";
+ ot->idname = "VIEW3D_OT_dolly";
/* api callbacks */
- ot->invoke= viewdolly_invoke;
- ot->exec= viewdolly_exec;
- ot->modal= viewdolly_modal;
- ot->poll= viewdolly_poll;
- ot->cancel= viewdolly_cancel;
+ ot->invoke = viewdolly_invoke;
+ ot->exec = viewdolly_exec;
+ ot->modal = viewdolly_modal;
+ ot->poll = viewdolly_poll;
+ ot->cancel = viewdolly_cancel;
/* flags */
- ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+ ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "mx", 0, 0, INT_MAX, "Zoom Position X", "", 0, INT_MAX);
@@ -2102,16 +2100,16 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
void VIEW3D_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View All";
+ ot->name = "View All";
ot->description = "View all objects in scene";
- ot->idname= "VIEW3D_OT_view_all";
+ ot->idname = "VIEW3D_OT_view_all";
/* api callbacks */
- ot->exec= view3d_all_exec;
- ot->poll= ED_operator_region_view3d_active;
+ ot->exec = view3d_all_exec;
+ ot->poll = ED_operator_region_view3d_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
RNA_def_boolean(ot->srna, "center", 0, "Center", "");
}
@@ -2135,8 +2133,8 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
INIT_MINMAX(min, max);
- if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
- /* hardcoded exception, we look for the one selected armature */
+ if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
+ /* hard-coded exception, we look for the one selected armature */
/* this is weak code this way, we should make a generic active/selection callback interface once... */
Base *base;
for (base=scene->base.first; base; base= base->next) {
@@ -2204,7 +2202,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
size= MAX3(afm[0], afm[1], afm[2]);
if (!rv3d->is_persp) {
- if (size < 0.0001f) { /* if its a sinble point. dont even re-scale */
+ if (size < 0.0001f) { /* if its a sinble point. don't even re-scale */
ok_dist= 0;
}
else {
@@ -2249,16 +2247,16 @@ void VIEW3D_OT_view_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Selected";
+ ot->name = "View Selected";
ot->description = "Move the view to the selection center";
- ot->idname= "VIEW3D_OT_view_selected";
+ ot->idname = "VIEW3D_OT_view_selected";
/* api callbacks */
- ot->exec= viewselected_exec;
- ot->poll= ED_operator_region_view3d_active;
+ ot->exec = viewselected_exec;
+ ot->poll = ED_operator_region_view3d_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op))
@@ -2284,16 +2282,16 @@ static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op))
void VIEW3D_OT_view_center_cursor(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Center View to Cursor";
- ot->description= "Center the view so that the cursor is in the middle of the view";
- ot->idname= "VIEW3D_OT_view_center_cursor";
+ ot->name = "Center View to Cursor";
+ ot->description = "Center the view so that the cursor is in the middle of the view";
+ ot->idname = "VIEW3D_OT_view_center_cursor";
/* api callbacks */
- ot->exec= viewcenter_cursor_exec;
- ot->poll= ED_operator_view3d_active;
+ ot->exec = viewcenter_cursor_exec;
+ ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */
@@ -2329,16 +2327,16 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was
void VIEW3D_OT_view_center_camera(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Camera Center";
+ ot->name = "View Camera Center";
ot->description = "Center the camera view";
- ot->idname= "VIEW3D_OT_view_center_camera";
+ ot->idname = "VIEW3D_OT_view_center_camera";
/* api callbacks */
- ot->exec= view3d_center_camera_exec;
- ot->poll= view3d_camera_user_poll;
+ ot->exec = view3d_center_camera_exec;
+ ot->poll = view3d_camera_user_poll;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
/* ********************* Set render border operator ****************** */
@@ -2354,18 +2352,18 @@ static int render_border_exec(bContext *C, wmOperator *op)
rctf vb;
/* get border select values using rna */
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
/* calculate range */
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
- scene->r.border.xmin= ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin);
- scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin);
- scene->r.border.xmax= ((float)rect.xmax-vb.xmin)/(vb.xmax-vb.xmin);
- scene->r.border.ymax= ((float)rect.ymax-vb.ymin)/(vb.ymax-vb.ymin);
+ scene->r.border.xmin = ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin);
+ scene->r.border.ymin = ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin);
+ scene->r.border.xmax = ((float)rect.xmax-vb.xmin)/(vb.xmax-vb.xmin);
+ scene->r.border.ymax = ((float)rect.ymax-vb.ymin)/(vb.ymax-vb.ymin);
/* actually set border */
CLAMP(scene->r.border.xmin, 0.0f, 1.0f);
@@ -2395,20 +2393,20 @@ static int render_border_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_render_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Render Border";
+ ot->name = "Set Render Border";
ot->description = "Set the boundaries of the border render and enables border render";
- ot->idname= "VIEW3D_OT_render_border";
+ ot->idname = "VIEW3D_OT_render_border";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= render_border_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = render_border_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= view3d_camera_active_poll;
+ ot->poll = view3d_camera_active_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
@@ -2443,10 +2441,10 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
view3d_operator_needs_opengl(C);
/* get border select values using rna */
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
/* Get Z Depths, needed for perspective, nice for ortho */
bgl_get_mats(&mats);
@@ -2561,20 +2559,20 @@ static int view3d_zoom_border_invoke(bContext *C, wmOperator *op, wmEvent *event
void VIEW3D_OT_zoom_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Zoom";
+ ot->name = "Border Zoom";
ot->description = "Zoom in the view to the nearest object contained in the border";
- ot->idname= "VIEW3D_OT_zoom_border";
+ ot->idname = "VIEW3D_OT_zoom_border";
/* api callbacks */
- ot->invoke= view3d_zoom_border_invoke;
- ot->exec= view3d_zoom_border_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = view3d_zoom_border_invoke;
+ ot->exec = view3d_zoom_border_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= ED_operator_region_view3d_active;
+ ot->poll = ED_operator_region_view3d_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
/* rna */
RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
@@ -2617,16 +2615,16 @@ static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op))
void VIEW3D_OT_zoom_camera_1_to_1(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Zoom Camera 1:1";
+ ot->name = "Zoom Camera 1:1";
ot->description = "Match the camera to 1:1 to the render output";
- ot->idname= "VIEW3D_OT_zoom_camera_1_to_1";
+ ot->idname = "VIEW3D_OT_zoom_camera_1_to_1";
/* api callbacks */
- ot->exec= view3d_zoom_1_to_1_camera_exec;
- ot->poll= view3d_camera_user_poll;
+ ot->exec = view3d_zoom_1_to_1_camera_exec;
+ ot->poll = view3d_camera_user_poll;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
/* ********************* Changing view operator ****************** */
@@ -2681,16 +2679,20 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
/* normal operation */
if (rv3d->viewlock) {
/* only pass on if */
- if (rv3d->view==RV3D_VIEW_FRONT && view==RV3D_VIEW_BACK);
- else if (rv3d->view==RV3D_VIEW_BACK && view==RV3D_VIEW_FRONT);
- else if (rv3d->view==RV3D_VIEW_RIGHT && view==RV3D_VIEW_LEFT);
- else if (rv3d->view==RV3D_VIEW_LEFT && view==RV3D_VIEW_RIGHT);
- else if (rv3d->view==RV3D_VIEW_BOTTOM && view==RV3D_VIEW_TOP);
- else if (rv3d->view==RV3D_VIEW_TOP && view==RV3D_VIEW_BOTTOM);
- else return;
+
+ /* nice confusing if-block */
+ if (!((rv3d->view == RV3D_VIEW_FRONT && view == RV3D_VIEW_BACK) ||
+ (rv3d->view == RV3D_VIEW_BACK && view == RV3D_VIEW_FRONT) ||
+ (rv3d->view == RV3D_VIEW_RIGHT && view == RV3D_VIEW_LEFT) ||
+ (rv3d->view == RV3D_VIEW_LEFT && view == RV3D_VIEW_RIGHT) ||
+ (rv3d->view == RV3D_VIEW_BOTTOM && view == RV3D_VIEW_TOP) ||
+ (rv3d->view == RV3D_VIEW_TOP && view == RV3D_VIEW_BOTTOM)))
+ {
+ return;
+ }
}
- rv3d->view= view;
+ rv3d->view = view;
}
if (rv3d->viewlock) {
@@ -2811,7 +2813,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
}
}
- /* if the camera isnt found, check a number of options */
+ /* if the camera isn't found, check a number of options */
if (v3d->camera==NULL && ob && ob->type==OB_CAMERA)
v3d->camera= ob;
@@ -2822,7 +2824,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
if (v3d->camera==NULL)
return OPERATOR_CANCELLED;
- /* important these dont get out of sync for locked scenes */
+ /* important these don't get out of sync for locked scenes */
if (v3d->scenelock)
scene->camera= v3d->camera;
@@ -2831,7 +2833,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
smooth_view(C, v3d, ar, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
}
- else{
+ else {
/* return to settings of last view */
/* does smooth_view too */
axis_set_view(C, v3d, ar,
@@ -2854,16 +2856,16 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_viewnumpad(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View numpad";
+ ot->name = "View numpad";
ot->description = "Set the view";
- ot->idname= "VIEW3D_OT_viewnumpad";
+ ot->idname = "VIEW3D_OT_viewnumpad";
/* api callbacks */
- ot->exec= viewnumpad_exec;
- ot->poll= ED_operator_rv3d_user_region_poll;
+ ot->exec = viewnumpad_exec;
+ ot->poll = ED_operator_rv3d_user_region_poll;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
RNA_def_enum(ot->srna, "type", prop_view_items, 0, "View", "The Type of view");
RNA_def_boolean(ot->srna, "align_active", 0, "Align Active", "Align to the active object's axis");
@@ -2927,16 +2929,16 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_view_orbit(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Orbit";
+ ot->name = "View Orbit";
ot->description = "Orbit the view";
- ot->idname= "VIEW3D_OT_view_orbit";
+ ot->idname = "VIEW3D_OT_view_orbit";
/* api callbacks */
- ot->exec= vieworbit_exec;
- ot->poll= ED_operator_rv3d_user_region_poll;
+ ot->exec = vieworbit_exec;
+ ot->poll = ED_operator_rv3d_user_region_poll;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
RNA_def_enum(ot->srna, "type", prop_view_orbit_items, 0, "Orbit", "Direction of View Orbit");
}
@@ -2975,16 +2977,16 @@ static int viewpan_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_view_pan(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Pan";
+ ot->name = "View Pan";
ot->description = "Pan the view";
- ot->idname= "VIEW3D_OT_view_pan";
+ ot->idname = "VIEW3D_OT_view_pan";
/* api callbacks */
- ot->exec= viewpan_exec;
- ot->poll= ED_operator_region_view3d_active;
+ ot->exec = viewpan_exec;
+ ot->poll = ED_operator_region_view3d_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
RNA_def_enum(ot->srna, "type", prop_view_pan_items, 0, "Pan", "Direction of View Pan");
}
@@ -3012,16 +3014,16 @@ static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
void VIEW3D_OT_view_persportho(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "View Persp/Ortho";
+ ot->name = "View Persp/Ortho";
ot->description = "Switch the current view from perspective/orthographic";
- ot->idname= "VIEW3D_OT_view_persportho";
+ ot->idname = "VIEW3D_OT_view_persportho";
/* api callbacks */
- ot->exec= viewpersportho_exec;
- ot->poll= ED_operator_rv3d_user_region_poll;
+ ot->exec = viewpersportho_exec;
+ ot->poll = ED_operator_rv3d_user_region_poll;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
@@ -3081,7 +3083,7 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Background Image";
- ot->description= "Add a new background image";
+ ot->description = "Add a new background image";
ot->idname = "VIEW3D_OT_background_image_add";
/* api callbacks */
@@ -3120,7 +3122,7 @@ void VIEW3D_OT_background_image_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Background Image";
- ot->description= "Remove a background image from the 3D view";
+ ot->description = "Remove a background image from the 3D view";
ot->idname = "VIEW3D_OT_background_image_remove";
/* api callbacks */
@@ -3178,10 +3180,10 @@ static int view3d_clipping_exec(bContext *C, wmOperator *op)
bglMats mats;
rcti rect;
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
rv3d->rflag |= RV3D_CLIPPING;
rv3d->clipbb= MEM_callocN(sizeof(BoundBox), "clipbb");
@@ -3218,20 +3220,20 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clipping Border";
+ ot->name = "Clipping Border";
ot->description = "Set the view clipping border";
- ot->idname= "VIEW3D_OT_clip_border";
+ ot->idname = "VIEW3D_OT_clip_border";
/* api callbacks */
- ot->invoke= view3d_clipping_invoke;
- ot->exec= view3d_clipping_exec;
- ot->modal= WM_border_select_modal;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = view3d_clipping_invoke;
+ ot->exec = view3d_clipping_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
- ot->poll= ED_operator_region_view3d_active;
+ ot->poll = ED_operator_region_view3d_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
/* rna */
RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
@@ -3312,17 +3314,17 @@ void VIEW3D_OT_cursor3d(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set 3D Cursor";
+ ot->name = "Set 3D Cursor";
ot->description = "Set the location of the 3D cursor";
- ot->idname= "VIEW3D_OT_cursor3d";
+ ot->idname = "VIEW3D_OT_cursor3d";
/* api callbacks */
- ot->invoke= set_3dcursor_invoke;
+ ot->invoke = set_3dcursor_invoke;
- ot->poll= ED_operator_view3d_active;
+ ot->poll = ED_operator_view3d_active;
/* flags */
-// ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+// ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna later */
@@ -3354,14 +3356,14 @@ void VIEW3D_OT_manipulator(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "3D Manipulator";
+ ot->name = "3D Manipulator";
ot->description = "Manipulate selected item by axis";
- ot->idname= "VIEW3D_OT_manipulator";
+ ot->idname = "VIEW3D_OT_manipulator";
/* api callbacks */
- ot->invoke= manipulator_invoke;
+ ot->invoke = manipulator_invoke;
- ot->poll= ED_operator_view3d_active;
+ ot->poll = ED_operator_view3d_active;
/* properties to pass to transform */
Transform_Properties(ot, P_CONSTRAINT);
@@ -3388,13 +3390,13 @@ static int enable_manipulator_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
void VIEW3D_OT_enable_manipulator(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Enable 3D Manipulator";
+ ot->name = "Enable 3D Manipulator";
ot->description = "Enable the transform manipulator for use";
- ot->idname= "VIEW3D_OT_enable_manipulator";
+ ot->idname = "VIEW3D_OT_enable_manipulator";
/* api callbacks */
- ot->invoke= enable_manipulator_invoke;
- ot->poll= ED_operator_view3d_active;
+ ot->invoke = enable_manipulator_invoke;
+ ot->poll = ED_operator_view3d_active;
/* rna later */
RNA_def_boolean(ot->srna, "translate", 0, "Translate", "Enable the translate manipulator");
@@ -3413,10 +3415,10 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
if (margin==0) {
/* Get Z Depths, needed for perspective, nice for ortho */
- rect.xmin= mval[0];
- rect.ymin= mval[1];
- rect.xmax= mval[0] + 1;
- rect.ymax= mval[1] + 1;
+ rect.xmin = mval[0];
+ rect.ymin = mval[1];
+ rect.xmax = mval[0] + 1;
+ rect.ymax = mval[1] + 1;
}
else {
rect.xmax = mval[0] + margin;
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 614fa45771d..819d3e0ca4a 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -185,7 +185,7 @@ typedef struct FlyInfo {
* 0) disabled
* 1) enabled but not checking because mouse hasn't moved outside the margin since locking was checked an not needed
* when the mouse moves, locking is set to 2 so checks are done.
- * 2) mouse moved and checking needed, if no view altering is donem its changed back to 1 */
+ * 2) mouse moved and checking needed, if no view altering is done its changed back to 1 */
short xlock, zlock;
float xlock_momentum, zlock_momentum; /* nicer dynamics */
float grid; /* world scale 1.0 default */
@@ -314,7 +314,7 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event
#ifdef NDOF_FLY_DRAW_TOOMUCH
fly->redraw= 1;
#endif
- fly->dvec_prev[0] = fly->dvec_prev[1] = fly->dvec_prev[2] = 0.0f;
+ zero_v3(fly->dvec_prev);
fly->timer = WM_event_add_timer(CTX_wm_manager(C), win, TIMER, 0.01f);
@@ -525,7 +525,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
fly->time_lastdraw = PIL_check_seconds_timer();
break;
default:
- ; // should always be one of the above 3
+ break; /* should always be one of the above 3 */
}
}
/* handle modal keymap first */
@@ -813,7 +813,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
/* scale the mouse movement by this value - scales mouse movement to the view size
* moffset[0]/(ar->winx-xmargin*2) - window size minus margin (same for y)
*
- * the mouse moves isnt linear */
+ * the mouse moves isn't linear */
if (moffset[0]) {
moffset[0] /= ar->winx - (xmargin * 2);
@@ -834,7 +834,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
float dvec_tmp[3];
/* time how fast it takes for us to redraw,
- * this is so simple scenes dont fly too fast */
+ * this is so simple scenes don't fly too fast */
double time_current;
float time_redraw;
float time_redraw_clamped;
@@ -946,12 +946,12 @@ static int flyApply(bContext *C, FlyInfo *fly)
fly->zlock_momentum += FLY_ZUP_CORRECT_ACCEL;
}
else {
- fly->zlock = 1; /* dont check until the view rotates again */
+ fly->zlock = 1; /* don't check until the view rotates again */
fly->zlock_momentum = 0.0f;
}
}
- if (fly->xlock == 2 && moffset[1] == 0) { /*only apply xcorrect when mouse isnt applying x rot*/
+ if (fly->xlock == 2 && moffset[1] == 0) { /*only apply xcorrect when mouse isn't applying x rot*/
upvec[0] = 0;
upvec[1] = 0;
upvec[2] = 1;
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 17f5ab68633..c20ea004e9d 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -254,17 +254,17 @@ static int view3d_layers_poll(bContext *C)
void VIEW3D_OT_layers(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Layers";
- ot->description= "Toggle layer(s) visibility";
- ot->idname= "VIEW3D_OT_layers";
+ ot->name = "Layers";
+ ot->description = "Toggle layer(s) visibility";
+ ot->idname = "VIEW3D_OT_layers";
/* api callbacks */
- ot->invoke= view3d_layers_invoke;
- ot->exec= view3d_layers_exec;
- ot->poll= view3d_layers_poll;
+ ot->invoke = view3d_layers_invoke;
+ ot->exec = view3d_layers_exec;
+ ot->poll = view3d_layers_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_int(ot->srna, "nr", 1, 0, 20, "Number", "The layer number to set, zero for all layers", 0, 20);
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Add this layer to the current view layers");
@@ -455,9 +455,9 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
row= uiLayoutRow(layout, 1);
block= uiLayoutGetBlock(row);
- uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
- uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
- uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
+ uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select - Shift-Click for multiple modes");
+ uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select - Shift-Click for multiple modes");
+ uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Face select - Shift-Click for multiple modes");
}
}
@@ -527,7 +527,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
/* pose/object only however we want to allow in weight paint mode too
- * so dont be totally strict and just check not-editmode for now */
+ * so don't be totally strict and just check not-editmode for now */
if (obedit == NULL) {
uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
@@ -538,11 +538,11 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
block= uiLayoutGetBlock(row);
if (v3d->twflag & V3D_USE_MANIPULATOR) {
- but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Translate manipulator mode"));
+ but = uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Translate manipulator - Shift-Click for multiple modes"));
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
- but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Rotate manipulator mode"));
+ but = uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Rotate manipulator - Shift-Click for multiple modes"));
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
- but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Scale manipulator mode"));
+ but = uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Scale manipulator - Shift-Click for multiple modes"));
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
}
@@ -551,7 +551,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
}
str_menu = BIF_menustringTransformOrientation(C, "Orientation");
- but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_("Transform Orientation"));
+ but = uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_("Transform Orientation"));
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
MEM_freeN((void *)str_menu);
}
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 759f3edf20f..e4133723089 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -112,13 +112,13 @@ void view3d_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap;
wmKeyMapItem *kmi;
- keymap= WM_keymap_find(keyconf, "3D View Generic", SPACE_VIEW3D, 0);
+ keymap = WM_keymap_find(keyconf, "3D View Generic", SPACE_VIEW3D, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_toolshelf", TKEY, KM_PRESS, 0, 0);
/* only for region 3D window */
- keymap= WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0);
+ keymap = WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0);
kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0);
RNA_boolean_set(kmi->ptr, "release_confirm", TRUE);
@@ -196,22 +196,22 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
/* active aligned, replaces '*' key in 2.4x */
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_RIGHT);
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_TOP);
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BACK);
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_LEFT);
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BOTTOM);
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
@@ -227,13 +227,13 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_BOTTOM, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_BOTTOM);
/* 3D mouse align */
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_RIGHT, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_RIGHT, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_RIGHT);
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_TOP, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_TOP, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_TOP);
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
@@ -275,12 +275,12 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "center", FALSE);
RNA_boolean_set(kmi->ptr, "object", FALSE);
RNA_boolean_set(kmi->ptr, "enumerate", FALSE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "center", TRUE);
RNA_boolean_set(kmi->ptr, "object", TRUE); /* use Ctrl+Select for 2 purposes */
RNA_boolean_set(kmi->ptr, "enumerate", FALSE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "center", FALSE);
RNA_boolean_set(kmi->ptr, "object", FALSE);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 93cf656dea4..b15dc6ab3c7 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -458,14 +458,14 @@ 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];
+ 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];
+ 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];
}
}
@@ -529,7 +529,7 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
if (extend == 0 && select)
EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT);
- /* for non zbuf projections, dont change the GL state */
+ /* for non zbuf projections, don't change the GL state */
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
glLoadMatrixf(vc->rv3d->viewmat);
@@ -816,12 +816,11 @@ int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int extend)
}
mvert= me->mvert;
- for (a=1; a<=me->totvert; a++, mvert++) {
+ for (a = 1; a <= me->totvert; a++, mvert++) {
if (selar[a]) {
- if (mvert->flag & ME_HIDE);
- else {
- if (select) mvert->flag |= SELECT;
- else mvert->flag &= ~SELECT;
+ if ((mvert->flag & ME_HIDE) == 0) {
+ if (select) mvert->flag |= SELECT;
+ else mvert->flag &= ~SELECT;
}
}
}
@@ -998,18 +997,18 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_select_lasso(wmOperatorType *ot)
{
- ot->name= "Lasso Select";
- ot->description= "Select items using lasso selection";
- ot->idname= "VIEW3D_OT_select_lasso";
+ ot->name = "Lasso Select";
+ ot->description = "Select items using lasso selection";
+ ot->idname = "VIEW3D_OT_select_lasso";
- ot->invoke= WM_gesture_lasso_invoke;
- ot->modal= WM_gesture_lasso_modal;
- ot->exec= view3d_lasso_select_exec;
- ot->poll= view3d_selectable_data;
- ot->cancel= WM_gesture_lasso_cancel;
+ ot->invoke = WM_gesture_lasso_invoke;
+ ot->modal = WM_gesture_lasso_modal;
+ ot->exec = view3d_lasso_select_exec;
+ ot->poll = view3d_selectable_data;
+ ot->cancel = WM_gesture_lasso_cancel;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ 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");
@@ -1087,7 +1086,7 @@ static EnumPropertyItem *object_select_menu_enum_itemf(bContext *C, PointerRNA *
int totitem= 0;
int i= 0;
- /* dont need context but avoid docgen using this */
+ /* don't need context but avoid docgen using this */
if (C == NULL || object_mouse_select_menu_data[i].idname[0] == '\0') {
return DummyRNA_NULL_items;
}
@@ -1151,22 +1150,22 @@ void VIEW3D_OT_select_menu(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name= "Select Menu";
+ ot->name = "Select Menu";
ot->description = "Menu object selection";
- ot->idname= "VIEW3D_OT_select_menu";
+ ot->idname = "VIEW3D_OT_select_menu";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= object_select_menu_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = object_select_menu_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* keyingset to use (dynamic enum) */
prop= RNA_def_enum(ot->srna, "name", DummyRNA_NULL_items, 0, "Object Name", "");
RNA_def_enum_funcs(prop, object_select_menu_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
- ot->prop= prop;
+ ot->prop = prop;
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
}
@@ -1595,7 +1594,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, basact->object);
/* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */
- if (BASACT && BASACT->object->mode & OB_MODE_WEIGHT_PAINT) {
+ if (BASACT && (BASACT->object->mode & OB_MODE_WEIGHT_PAINT)) {
/* prevent activating */
basact= NULL;
}
@@ -1801,7 +1800,7 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
if (extend == 0 && select)
EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT);
- /* for non zbuf projections, dont change the GL state */
+ /* for non zbuf projections, don't change the GL state */
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
glLoadMatrixf(vc->rv3d->viewmat);
@@ -2064,10 +2063,10 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
view3d_set_viewcontext(C, &vc);
select= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
extend = RNA_boolean_get(op->ptr, "extend");
if (vc.obedit) {
@@ -2137,19 +2136,19 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Select";
- ot->description= "Select items using border selection";
- ot->idname= "VIEW3D_OT_select_border";
+ ot->name = "Border Select";
+ ot->description = "Select items using border selection";
+ ot->idname = "VIEW3D_OT_select_border";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= view3d_borderselect_exec;
- ot->modal= WM_border_select_modal;
- ot->poll= view3d_selectable_data;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = view3d_borderselect_exec;
+ ot->modal = WM_border_select_modal;
+ ot->poll = view3d_selectable_data;
+ ot->cancel = WM_border_select_cancel;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, TRUE);
@@ -2270,16 +2269,16 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
void VIEW3D_OT_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Activate/Select";
- ot->description= "Activate/select item(s)";
- ot->idname= "VIEW3D_OT_select";
+ ot->name = "Activate/Select";
+ ot->description = "Activate/select item(s)";
+ ot->idname = "VIEW3D_OT_select";
/* api callbacks */
- ot->invoke= view3d_select_invoke;
- ot->poll= ED_operator_view3d_active;
+ ot->invoke = view3d_select_invoke;
+ ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
@@ -2727,18 +2726,18 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_select_circle(wmOperatorType *ot)
{
- ot->name= "Circle Select";
- ot->description= "Select items using circle selection";
- ot->idname= "VIEW3D_OT_select_circle";
+ ot->name = "Circle Select";
+ ot->description = "Select items using circle selection";
+ ot->idname = "VIEW3D_OT_select_circle";
- ot->invoke= WM_gesture_circle_invoke;
- ot->modal= WM_gesture_circle_modal;
- ot->exec= view3d_circle_select_exec;
- ot->poll= view3d_selectable_data;
- ot->cancel= WM_gesture_circle_cancel;
+ ot->invoke = WM_gesture_circle_invoke;
+ ot->modal = WM_gesture_circle_modal;
+ ot->exec = view3d_circle_select_exec;
+ ot->poll = view3d_selectable_data;
+ ot->cancel = WM_gesture_circle_cancel;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX);
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 5d2f0c432fb..fdaf34e2e3c 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -176,7 +176,7 @@ static void special_transvert_update(Object *obedit)
copy_v3_v3(ebo->head, ebo->parent->tail);
}
/* If this bone has a parent tip that has NOT been moved */
- else{
+ else {
copy_v3_v3(ebo->parent->tail, ebo->head);
}
}
@@ -225,7 +225,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
tottrans= 0; // global!
INIT_MINMAX(min, max);
- centroid[0]=centroid[1]=centroid[2]= 0.0;
+ zero_v3(centroid);
if (obedit->type==OB_MESH) {
Mesh *me= obedit->data;
@@ -331,7 +331,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
if (ebo->layer & arm->layer) {
short tipsel= (ebo->flag & BONE_TIPSEL);
short rootsel= (ebo->flag & BONE_ROOTSEL);
- short rootok= (!(ebo->parent && (ebo->flag & BONE_CONNECTED) && ebo->parent->flag & BONE_TIPSEL));
+ short rootok= (!(ebo->parent && (ebo->flag & BONE_CONNECTED) && (ebo->parent->flag & BONE_TIPSEL)));
if ((tipsel && rootsel) || (rootsel)) {
/* Don't add the tip (unless mode & TM_ALL_JOINTS, for getting all joints),
@@ -635,16 +635,16 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Snap Selection to Grid";
- ot->description= "Snap selected item(s) to nearest grid node";
- ot->idname= "VIEW3D_OT_snap_selected_to_grid";
+ ot->name = "Snap Selection to Grid";
+ ot->description = "Snap selected item(s) to nearest grid node";
+ ot->idname = "VIEW3D_OT_snap_selected_to_grid";
/* api callbacks */
- ot->exec= snap_sel_to_grid;
- ot->poll= ED_operator_region_view3d_active;
+ ot->exec = snap_sel_to_grid;
+ ot->poll = ED_operator_region_view3d_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* *************************************************** */
@@ -759,16 +759,16 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Snap Selection to Cursor";
- ot->description= "Snap selected item(s) to cursor";
- ot->idname= "VIEW3D_OT_snap_selected_to_cursor";
+ ot->name = "Snap Selection to Cursor";
+ ot->description = "Snap selected item(s) to cursor";
+ ot->idname = "VIEW3D_OT_snap_selected_to_cursor";
/* api callbacks */
- ot->exec= snap_sel_to_curs;
- ot->poll= ED_operator_view3d_active;
+ ot->exec = snap_sel_to_curs;
+ ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* *************************************************** */
@@ -795,16 +795,16 @@ static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op))
void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Snap Cursor to Grid";
- ot->description= "Snap cursor to nearest grid node";
- ot->idname= "VIEW3D_OT_snap_cursor_to_grid";
+ ot->name = "Snap Cursor to Grid";
+ ot->description = "Snap cursor to nearest grid node";
+ ot->idname = "VIEW3D_OT_snap_cursor_to_grid";
/* api callbacks */
- ot->exec= snap_curs_to_grid;
- ot->poll= ED_operator_region_view3d_active;
+ ot->exec = snap_curs_to_grid;
+ ot->poll = ED_operator_region_view3d_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* **************************************************** */
@@ -874,7 +874,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
count= 0;
INIT_MINMAX(min, max);
- centroid[0]= centroid[1]= centroid[2]= 0.0;
+ zero_v3(centroid);
if (obedit) {
tottrans=0;
@@ -958,16 +958,16 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Snap Cursor to Selected";
- ot->description= "Snap cursor to center of selected item(s)";
- ot->idname= "VIEW3D_OT_snap_cursor_to_selected";
+ ot->name = "Snap Cursor to Selected";
+ ot->description = "Snap cursor to center of selected item(s)";
+ ot->idname = "VIEW3D_OT_snap_cursor_to_selected";
/* api callbacks */
- ot->exec= snap_curs_to_sel;
- ot->poll= ED_operator_view3d_active;
+ ot->exec = snap_curs_to_sel;
+ ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ********************************************** */
@@ -1008,16 +1008,16 @@ static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op))
void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Snap Cursor to Active";
- ot->description= "Snap cursor to active item";
- ot->idname= "VIEW3D_OT_snap_cursor_to_active";
+ ot->name = "Snap Cursor to Active";
+ ot->description = "Snap cursor to active item";
+ ot->idname = "VIEW3D_OT_snap_cursor_to_active";
/* api callbacks */
- ot->exec= snap_curs_to_active;
- ot->poll= ED_operator_view3d_active;
+ ot->exec = snap_curs_to_active;
+ ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* **************************************************** */
@@ -1041,16 +1041,16 @@ static int snap_curs_to_center(bContext *C, wmOperator *UNUSED(op))
void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Snap Cursor to Center";
- ot->description= "Snap cursor to the Center";
- ot->idname= "VIEW3D_OT_snap_cursor_to_center";
+ ot->name = "Snap Cursor to Center";
+ ot->description = "Snap cursor to the Center";
+ ot->idname = "VIEW3D_OT_snap_cursor_to_center";
/* api callbacks */
- ot->exec= snap_curs_to_center;
- ot->poll= ED_operator_view3d_active;
+ ot->exec = snap_curs_to_center;
+ ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* **************************************************** */
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index 355febcde5d..88a490e23b8 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -176,7 +176,7 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase)
/* fake button, it holds space for search items */
uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
- but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, "");
+ but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, "");
uiButSetSearchFunc(but, operator_search_cb, arg_listbase, operator_call_cb, NULL);
uiBoundsBlock(block, 6);
@@ -257,14 +257,14 @@ static int view3d_toolshelf(bContext *C, wmOperator *UNUSED(op))
void VIEW3D_OT_toolshelf(wmOperatorType *ot)
{
- ot->name= "Tool Shelf";
- ot->description= "Toggles tool shelf display";
- ot->idname= "VIEW3D_OT_toolshelf";
+ ot->name = "Tool Shelf";
+ ot->description = "Toggles tool shelf display";
+ ot->idname = "VIEW3D_OT_toolshelf";
- ot->exec= view3d_toolshelf;
- ot->poll= ED_operator_view3d_active;
+ ot->exec = view3d_toolshelf;
+ ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag= 0;
+ ot->flag = 0;
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 88658b30662..19dc48c648c 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -145,7 +145,7 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec
* we may be changing the view 'as if' there is no active camera, but infact
* there is an active camera which is locked to the view.
*
- * In the case where smooth view is moving _to_ a camera we dont want that
+ * In the case where smooth view is moving _to_ a camera we don't want that
* camera to be moved or changed, so only when the camera is not being set should
* we allow camera option locking to initialize the view settings from the camera.
*/
@@ -334,14 +334,14 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Smooth View";
- ot->idname= "VIEW3D_OT_smoothview";
- ot->description="The time to animate the change of view (in milliseconds)";
+ ot->name = "Smooth View";
+ ot->idname = "VIEW3D_OT_smoothview";
+ ot->description = "The time to animate the change of view (in milliseconds)";
/* api callbacks */
- ot->invoke= view3d_smoothview_invoke;
+ ot->invoke = view3d_smoothview_invoke;
- ot->poll= ED_operator_view3d_active;
+ ot->poll = ED_operator_view3d_active;
}
/* ****************** change view operators ****************** */
@@ -389,16 +389,16 @@ static int view3d_camera_to_view_poll(bContext *C)
void VIEW3D_OT_camera_to_view(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Align Camera To View";
- ot->description= "Set camera view to active view";
- ot->idname= "VIEW3D_OT_camera_to_view";
+ ot->name = "Align Camera To View";
+ ot->description = "Set camera view to active view";
+ ot->idname = "VIEW3D_OT_camera_to_view";
/* api callbacks */
- ot->exec= view3d_camera_to_view_exec;
- ot->poll= view3d_camera_to_view_poll;
+ ot->exec = view3d_camera_to_view_exec;
+ ot->poll = view3d_camera_to_view_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* unlike VIEW3D_OT_view_selected this is for framing a render and not
@@ -456,16 +456,16 @@ static int view3d_camera_to_view_selected_poll(bContext *C)
void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Camera Fit Frame to Selected";
- ot->description= "Move the camera so selected objects are framed";
- ot->idname= "VIEW3D_OT_camera_to_view_selected";
+ ot->name = "Camera Fit Frame to Selected";
+ ot->description = "Move the camera so selected objects are framed";
+ ot->idname = "VIEW3D_OT_camera_to_view_selected";
/* api callbacks */
- ot->exec= view3d_camera_to_view_selected_exec;
- ot->poll= view3d_camera_to_view_selected_poll;
+ ot->exec = view3d_camera_to_view_selected_exec;
+ ot->poll = view3d_camera_to_view_selected_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -510,16 +510,16 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Active Object as Camera";
- ot->description= "Set the active object as the active camera for this view or scene";
- ot->idname= "VIEW3D_OT_object_as_camera";
+ ot->name = "Set Active Object as Camera";
+ ot->description = "Set the active object as the active camera for this view or scene";
+ ot->idname = "VIEW3D_OT_object_as_camera";
/* api callbacks */
- ot->exec= view3d_setobjectascamera_exec;
- ot->poll= ED_operator_rv3d_user_region_poll;
+ ot->exec = view3d_setobjectascamera_exec;
+ ot->poll = ED_operator_rv3d_user_region_poll;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ********************************** */
@@ -807,7 +807,7 @@ void ED_view3d_project_float_v3(ARegion *ar, const float vec[3], float adr[3], f
adr[2] = vec4[2]/vec4[3];
}
else {
- adr[0] = adr[1] = adr[2] = 0.0f;
+ zero_v3(adr);
}
}
@@ -1049,13 +1049,13 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for pick
if (rect) { /* picking */
rect->xmin/= (float)ar->winx;
- rect->xmin= x1+rect->xmin*(x2-x1);
+ rect->xmin = x1+rect->xmin*(x2-x1);
rect->ymin/= (float)ar->winy;
- rect->ymin= y1+rect->ymin*(y2-y1);
+ rect->ymin = y1+rect->ymin*(y2-y1);
rect->xmax/= (float)ar->winx;
- rect->xmax= x1+rect->xmax*(x2-x1);
+ rect->xmax = x1+rect->xmax*(x2-x1);
rect->ymax/= (float)ar->winy;
- rect->ymax= y1+rect->ymax*(y2-y1);
+ rect->ymax = y1+rect->ymax*(y2-y1);
if (orth) wmOrtho(rect->xmin, rect->xmax, rect->ymin, rect->ymax, -clipend, clipend);
else wmFrustum(rect->xmin, rect->xmax, rect->ymin, rect->ymax, clipsta, clipend);
@@ -1075,7 +1075,7 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
float bmat[4][4];
float tmat[3][3];
- rv3d->view= RV3D_VIEW_USER; /* dont show the grid */
+ rv3d->view= RV3D_VIEW_USER; /* don't show the grid */
copy_m4_m4(bmat, ob->obmat);
normalize_m4(bmat);
@@ -1150,7 +1150,7 @@ int ED_view3d_lock(RegionView3D *rv3d)
return TRUE;
}
-/* dont set windows active in here, is used by renderwin too */
+/* don't set windows active in here, is used by renderwin too */
void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
{
if (rv3d->persp==RV3D_CAMOB) { /* obs/camera */
@@ -1210,17 +1210,17 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
G.f |= G_PICKSEL;
/* case not a border select */
- if (input->xmin==input->xmax) {
- rect.xmin= input->xmin-12; // seems to be default value for bones only now
- rect.xmax= input->xmin+12;
- rect.ymin= input->ymin-12;
- rect.ymax= input->ymin+12;
+ if (input->xmin ==input->xmax) {
+ rect.xmin = input->xmin-12; // seems to be default value for bones only now
+ rect.xmax = input->xmin+12;
+ rect.ymin = input->ymin-12;
+ rect.ymax = input->ymin+12;
}
else {
- rect.xmin= input->xmin;
- rect.xmax= input->xmax;
- rect.ymin= input->ymin;
- rect.ymax= input->ymax;
+ rect.xmin = input->xmin;
+ rect.xmax = input->xmax;
+ rect.ymin = input->ymin;
+ rect.ymax = input->ymax;
}
setwinmatrixview3d(ar, v3d, &rect);
@@ -1580,15 +1580,15 @@ void VIEW3D_OT_localview(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Local View";
- ot->description= "Toggle display of selected object(s) separately and centered in view";
- ot->idname= "VIEW3D_OT_localview";
+ ot->name = "Local View";
+ ot->description = "Toggle display of selected object(s) separately and centered in view";
+ ot->idname = "VIEW3D_OT_localview";
/* api callbacks */
- ot->exec= localview_exec;
- ot->flag= OPTYPE_UNDO; /* localview changes object layer bitflags */
+ ot->exec = localview_exec;
+ ot->flag = OPTYPE_UNDO; /* localview changes object layer bitflags */
- ot->poll= ED_operator_view3d_active;
+ ot->poll = ED_operator_view3d_active;
}
#ifdef WITH_GAMEENGINE
@@ -1814,14 +1814,14 @@ void VIEW3D_OT_game_start(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Start Game Engine";
- ot->description= "Start game engine";
- ot->idname= "VIEW3D_OT_game_start";
+ ot->name = "Start Game Engine";
+ ot->description = "Start game engine";
+ ot->idname = "VIEW3D_OT_game_start";
/* api callbacks */
- ot->exec= game_engine_exec;
+ ot->exec = game_engine_exec;
- ot->poll= game_engine_poll;
+ ot->poll = game_engine_poll;
}
/* ************************************** */
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index 98461918151..05a4f6f4ce5 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -49,4 +49,8 @@ set(SRC
transform.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_transform "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/transform/SConscript b/source/blender/editors/transform/SConscript
index 0cf3875aa2e..dbf6179035c 100644
--- a/source/blender/editors/transform/SConscript
+++ b/source/blender/editors/transform/SConscript
@@ -8,4 +8,9 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../render/extern/include'
incs += ' ../../gpu ../../makesrna ../../blenloader ../../bmesh'
-env.BlenderLib ( 'bf_editors_transform', sources, Split(incs), [], libtype=['core'], priority=[40] )
+defs = []
+
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_transform', sources, Split(incs), defs, libtype=['core'], priority=[40] )
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 43427d0dbe8..fe224398980 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -104,7 +104,7 @@ static int doEdgeSlide(TransInfo *t, float perc);
void setTransformViewMatrices(TransInfo *t)
{
- if(t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
+ if (t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d = t->ar->regiondata;
copy_m4_m4(t->viewmat, rv3d->viewmat);
@@ -136,53 +136,53 @@ static void convertViewVec2D(View2D *v2d, float vec[3], int dx, int dy)
vec[2]= 0.0f;
}
-void convertViewVec(TransInfo *t, float vec[3], int dx, int dy)
+void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
{
if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) {
float mval_f[2];
mval_f[0] = dx;
mval_f[1] = dy;
- ED_view3d_win_to_delta(t->ar, mval_f, vec);
+ ED_view3d_win_to_delta(t->ar, mval_f, r_vec);
}
- else if(t->spacetype==SPACE_IMAGE) {
+ else if (t->spacetype==SPACE_IMAGE) {
float aspx, aspy;
- convertViewVec2D(t->view, vec, dx, dy);
+ convertViewVec2D(t->view, r_vec, dx, dy);
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
- vec[0]*= aspx;
- vec[1]*= aspy;
+ r_vec[0] *= aspx;
+ r_vec[1] *= aspy;
}
- else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
- convertViewVec2D(t->view, vec, dx, dy);
+ else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
+ convertViewVec2D(t->view, r_vec, dx, dy);
}
- else if(ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
- convertViewVec2D(&t->ar->v2d, vec, dx, dy);
+ else if (ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
+ convertViewVec2D(&t->ar->v2d, r_vec, dx, dy);
}
- else if(t->spacetype==SPACE_CLIP) {
+ else if (t->spacetype==SPACE_CLIP) {
View2D *v2d = t->view;
float divx, divy;
divx= v2d->mask.xmax-v2d->mask.xmin;
divy= v2d->mask.ymax-v2d->mask.ymin;
- vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
- vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
- vec[2]= 0.0f;
+ r_vec[0] = (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
+ r_vec[1] = (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
+ r_vec[2] = 0.0f;
}
else {
printf("%s: called in an invalid context\n", __func__);
- zero_v3(vec);
+ zero_v3(r_vec);
}
}
-void projectIntView(TransInfo *t, float *vec, int *adr)
+void projectIntView(TransInfo *t, const float vec[3], int adr[2])
{
if (t->spacetype==SPACE_VIEW3D) {
- if(t->ar->regiontype == RGN_TYPE_WINDOW)
+ if (t->ar->regiontype == RGN_TYPE_WINDOW)
project_int_noclip(t->ar, vec, adr);
}
- else if(t->spacetype==SPACE_IMAGE) {
+ else if (t->spacetype==SPACE_IMAGE) {
float aspx, aspy, v[2];
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
@@ -191,7 +191,7 @@ void projectIntView(TransInfo *t, float *vec, int *adr)
UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1);
}
- else if(t->spacetype == SPACE_ACTION) {
+ else if (t->spacetype == SPACE_ACTION) {
int out[2] = {0, 0};
#if 0
SpaceAction *sact = t->sa->spacedata.first;
@@ -210,45 +210,50 @@ void projectIntView(TransInfo *t, float *vec, int *adr)
adr[0]= out[0];
adr[1]= out[1];
}
- else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
+ else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
int out[2] = {0, 0};
UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1);
adr[0]= out[0];
adr[1]= out[1];
}
- else if(t->spacetype==SPACE_SEQ) { /* XXX not tested yet, but should work */
+ else if (t->spacetype==SPACE_SEQ) { /* XXX not tested yet, but should work */
int out[2] = {0, 0};
UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1);
adr[0]= out[0];
adr[1]= out[1];
}
- else if(t->spacetype==SPACE_CLIP) {
+ else if (t->spacetype==SPACE_CLIP) {
UI_view2d_to_region_no_clip(t->view, vec[0], vec[1], adr, adr+1);
}
}
-void projectFloatView(TransInfo *t, float *vec, float *adr)
+void projectFloatView(TransInfo *t, const float vec[3], float adr[2])
{
- if (t->spacetype==SPACE_VIEW3D) {
- if(t->ar->regiontype == RGN_TYPE_WINDOW)
- project_float_noclip(t->ar, vec, adr);
- }
- else if(ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) {
- int a[2];
-
- projectIntView(t, vec, a);
- adr[0]= a[0];
- adr[1]= a[1];
+ switch (t->spacetype) {
+ case SPACE_VIEW3D:
+ {
+ if (t->ar->regiontype == RGN_TYPE_WINDOW) {
+ project_float_noclip(t->ar, vec, adr);
+ return;
+ }
+ break;
+ }
+ case SPACE_IMAGE:
+ case SPACE_CLIP:
+ case SPACE_IPO:
+ case SPACE_NLA:
+ {
+ int a[2];
+ projectIntView(t, vec, a);
+ adr[0] = a[0];
+ adr[1] = a[1];
+ return;
+ }
}
- else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
- int a[2];
- projectIntView(t, vec, a);
- adr[0]= a[0];
- adr[1]= a[1];
- }
+ zero_v2(adr);
}
void applyAspectRatio(TransInfo *t, float *vec)
@@ -257,7 +262,7 @@ void applyAspectRatio(TransInfo *t, float *vec)
SpaceImage *sima= t->sa->spacedata.first;
float aspx, aspy;
- if((sima->flag & SI_COORDFLOATS)==0) {
+ if ((sima->flag & SI_COORDFLOATS)==0) {
int width, height;
ED_space_image_size(sima, &width, &height);
@@ -277,7 +282,7 @@ void removeAspectRatio(TransInfo *t, float *vec)
SpaceImage *sima= t->sa->spacedata.first;
float aspx, aspy;
- if((sima->flag & SI_COORDFLOATS)==0) {
+ if ((sima->flag & SI_COORDFLOATS)==0) {
int width, height;
ED_space_image_size(sima, &width, &height);
@@ -296,7 +301,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
if (t->spacetype == SPACE_VIEW3D)
{
/* Do we need more refined tags? */
- if(t->flag & T_POSE)
+ if (t->flag & T_POSE)
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
else
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
@@ -318,17 +323,17 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
else if (t->spacetype == SPACE_NLA) {
WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
}
- else if(t->spacetype == SPACE_NODE) {
+ else if (t->spacetype == SPACE_NODE) {
//ED_area_tag_redraw(t->sa);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
}
- else if(t->spacetype == SPACE_SEQ) {
+ else if (t->spacetype == SPACE_SEQ) {
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, NULL);
}
else if (t->spacetype==SPACE_IMAGE) {
// XXX how to deal with lock?
SpaceImage *sima= (SpaceImage*)t->sa->spacedata.first;
- if(sima->lock) WM_event_add_notifier(C, NC_GEOM|ND_DATA, t->obedit->data);
+ if (sima->lock) WM_event_add_notifier(C, NC_GEOM|ND_DATA, t->obedit->data);
else ED_area_tag_redraw(t->sa);
}
else if (t->spacetype==SPACE_CLIP) {
@@ -346,7 +351,7 @@ static void viewRedrawPost(bContext *C, TransInfo *t)
{
ED_area_headerprint(t->sa, NULL);
- if(t->spacetype == SPACE_VIEW3D) {
+ if (t->spacetype == SPACE_VIEW3D) {
/* if autokeying is enabled, send notifiers that keyframes were added */
if (IS_AUTOKEY_ON(t->scene))
WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
@@ -357,15 +362,15 @@ static void viewRedrawPost(bContext *C, TransInfo *t)
}
#if 0 // TRANSFORM_FIX_ME
- if(t->spacetype==SPACE_VIEW3D) {
+ if (t->spacetype==SPACE_VIEW3D) {
allqueue(REDRAWBUTSOBJECT, 0);
allqueue(REDRAWVIEW3D, 0);
}
- else if(t->spacetype==SPACE_IMAGE) {
+ else if (t->spacetype==SPACE_IMAGE) {
allqueue(REDRAWIMAGE, 0);
allqueue(REDRAWVIEW3D, 0);
}
- else if(ELEM3(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_IPO)) {
+ else if (ELEM3(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_IPO)) {
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
@@ -388,7 +393,7 @@ void BIF_selectOrientation(void)
val= pupmenu(str_menu);
MEM_freeN(str_menu);
- if(val >= 0) {
+ if (val >= 0) {
G.vd->twmode = val;
}
#endif
@@ -413,23 +418,27 @@ static void view_editmove(unsigned short UNUSED(event))
switch(event) {
case WHEELUPMOUSE:
- if( G.qual & LR_SHIFTKEY ) {
- if( G.qual & LR_ALTKEY ) {
+ if ( G.qual & LR_SHIFTKEY ) {
+ if ( G.qual & LR_ALTKEY ) {
G.qual &= ~LR_SHIFTKEY;
persptoetsen(PAD2);
G.qual |= LR_SHIFTKEY;
- } else {
+ }
+ else {
persptoetsen(PAD2);
}
- } else if( G.qual & LR_CTRLKEY ) {
- if( G.qual & LR_ALTKEY ) {
+ }
+ else if ( G.qual & LR_CTRLKEY ) {
+ if ( G.qual & LR_ALTKEY ) {
G.qual &= ~LR_CTRLKEY;
persptoetsen(PAD4);
G.qual |= LR_CTRLKEY;
- } else {
+ }
+ else {
persptoetsen(PAD4);
}
- } else if(U.uiflag & USER_WHEELZOOMDIR)
+ }
+ else if (U.uiflag & USER_WHEELZOOMDIR)
persptoetsen(PADMINUS);
else
persptoetsen(PADPLUSKEY);
@@ -437,23 +446,27 @@ static void view_editmove(unsigned short UNUSED(event))
refresh = 1;
break;
case WHEELDOWNMOUSE:
- if( G.qual & LR_SHIFTKEY ) {
- if( G.qual & LR_ALTKEY ) {
+ if ( G.qual & LR_SHIFTKEY ) {
+ if ( G.qual & LR_ALTKEY ) {
G.qual &= ~LR_SHIFTKEY;
persptoetsen(PAD8);
G.qual |= LR_SHIFTKEY;
- } else {
+ }
+ else {
persptoetsen(PAD8);
}
- } else if( G.qual & LR_CTRLKEY ) {
- if( G.qual & LR_ALTKEY ) {
+ }
+ else if ( G.qual & LR_CTRLKEY ) {
+ if ( G.qual & LR_ALTKEY ) {
G.qual &= ~LR_CTRLKEY;
persptoetsen(PAD6);
G.qual |= LR_CTRLKEY;
- } else {
+ }
+ else {
persptoetsen(PAD6);
}
- } else if(U.uiflag & USER_WHEELZOOMDIR)
+ }
+ else if (U.uiflag & USER_WHEELZOOMDIR)
persptoetsen(PADPLUSKEY);
else
persptoetsen(PADMINUS);
@@ -526,7 +539,7 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map");
/* this function is called for each spacetype, only needs to add map once */
- if(keymap) return NULL;
+ if (keymap) return NULL;
keymap= WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items);
@@ -602,15 +615,15 @@ int transformEvent(TransInfo *t, wmEvent *event)
break;
case TFM_MODAL_TRANSLATE:
/* only switch when... */
- if( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
+ if ( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
resetTransRestrictions(t);
restoreTransObjects(t);
initTranslation(t);
initSnapping(t, NULL); // need to reinit after mode change
t->redraw |= TREDRAW_HARD;
}
- else if(t->mode == TFM_TRANSLATION) {
- if(t->options&CTX_MOVIECLIP) {
+ else if (t->mode == TFM_TRANSLATION) {
+ if (t->options&CTX_MOVIECLIP) {
restoreTransObjects(t);
t->flag^= T_ALT_TRANSFORM;
@@ -620,8 +633,8 @@ int transformEvent(TransInfo *t, wmEvent *event)
break;
case TFM_MODAL_ROTATE:
/* only switch when... */
- if(!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
- if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
+ if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
+ if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
resetTransRestrictions(t);
@@ -640,7 +653,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
break;
case TFM_MODAL_RESIZE:
/* only switch when... */
- if( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
+ if ( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
resetTransRestrictions(t);
restoreTransObjects(t);
initResize(t);
@@ -752,9 +765,9 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw |= TREDRAW_HARD;
break;
case TFM_MODAL_PROPSIZE_UP:
- if(t->flag & T_PROP_EDIT) {
+ if (t->flag & T_PROP_EDIT) {
t->prop_size*= 1.1f;
- if(t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO)
+ if (t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO)
t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far);
calculatePropRatio(t);
}
@@ -855,7 +868,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
break;
case GKEY:
/* only switch when... */
- if( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
+ if ( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
resetTransRestrictions(t);
restoreTransObjects(t);
initTranslation(t);
@@ -865,7 +878,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
break;
case SKEY:
/* only switch when... */
- if( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
+ if ( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
resetTransRestrictions(t);
restoreTransObjects(t);
initResize(t);
@@ -875,8 +888,8 @@ int transformEvent(TransInfo *t, wmEvent *event)
break;
case RKEY:
/* only switch when... */
- if(!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
- if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
+ if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
+ if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
resetTransRestrictions(t);
@@ -910,21 +923,25 @@ int transformEvent(TransInfo *t, wmEvent *event)
if (t->flag & T_2D_EDIT) {
if (cmode == 'X') {
stopConstraint(t);
- } else {
+ }
+ else {
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along X");
}
- } else {
+ }
+ else {
if (cmode == 'X') {
if (t->con.orientation != V3D_MANIP_GLOBAL) {
stopConstraint(t);
- } else {
+ }
+ else {
short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL;
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
setUserConstraint(t, orientation, (CON_AXIS0), "along %s X");
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
setUserConstraint(t, orientation, (CON_AXIS1|CON_AXIS2), "locking %s X");
}
- } else {
+ }
+ else {
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along %s X");
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
@@ -939,21 +956,25 @@ int transformEvent(TransInfo *t, wmEvent *event)
if (t->flag & T_2D_EDIT) {
if (cmode == 'Y') {
stopConstraint(t);
- } else {
+ }
+ else {
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along Y");
}
- } else {
+ }
+ else {
if (cmode == 'Y') {
if (t->con.orientation != V3D_MANIP_GLOBAL) {
stopConstraint(t);
- } else {
+ }
+ else {
short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL;
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
setUserConstraint(t, orientation, (CON_AXIS1), "along %s Y");
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
setUserConstraint(t, orientation, (CON_AXIS0|CON_AXIS2), "locking %s Y");
}
- } else {
+ }
+ else {
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along %s Y");
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
@@ -968,14 +989,16 @@ int transformEvent(TransInfo *t, wmEvent *event)
if (cmode == 'Z') {
if (t->con.orientation != V3D_MANIP_GLOBAL) {
stopConstraint(t);
- } else {
+ }
+ else {
short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL;
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
setUserConstraint(t, orientation, (CON_AXIS2), "along %s Z");
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
setUserConstraint(t, orientation, (CON_AXIS0|CON_AXIS1), "locking %s Z");
}
- } else {
+ }
+ else {
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS2), "along %s Z");
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
@@ -992,9 +1015,9 @@ int transformEvent(TransInfo *t, wmEvent *event)
}
break;
case PADPLUSKEY:
- if(event->alt && t->flag & T_PROP_EDIT) {
+ if (event->alt && t->flag & T_PROP_EDIT) {
t->prop_size *= 1.1f;
- if(t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO)
+ if (t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO)
t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far);
calculatePropRatio(t);
}
@@ -1009,7 +1032,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw= 1;
break;
case PADMINUS:
- if(event->alt && t->flag & T_PROP_EDIT) {
+ if (event->alt && t->flag & T_PROP_EDIT) {
t->prop_size*= 0.90909090f;
calculatePropRatio(t);
}
@@ -1052,7 +1075,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
break;
// case LEFTMOUSE:
// case RIGHTMOUSE:
-// if(WM_modal_tweak_exit(event, t->event_type))
+// if (WM_modal_tweak_exit(event, t->event_type))
//// if (t->options & CTX_TWEAK)
// t->state = TRANS_CONFIRM;
// break;
@@ -1197,7 +1220,7 @@ 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);
}
@@ -1210,7 +1233,7 @@ static int helpline_poll(bContext *C)
{
ARegion *ar= CTX_wm_region(C);
- if(ar && ar->regiontype==RGN_TYPE_WINDOW)
+ if (ar && ar->regiontype==RGN_TYPE_WINDOW)
return 1;
return 0;
}
@@ -1228,13 +1251,13 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
mval[1]= y;
copy_v3_v3(vecrot, t->center);
- if(t->flag & T_EDIT) {
+ if (t->flag & T_EDIT) {
Object *ob= t->obedit;
- if(ob) mul_m4_v3(ob->obmat, vecrot);
+ if (ob) mul_m4_v3(ob->obmat, vecrot);
}
- else if(t->flag & T_POSE) {
+ else if (t->flag & T_POSE) {
Object *ob=t->poseobj;
- if(ob) mul_m4_v3(ob->obmat, vecrot);
+ if (ob) mul_m4_v3(ob->obmat, vecrot);
}
projectFloatView(t, vecrot, cent); // no overflow in extreme cases
@@ -1428,7 +1451,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
/* do we check for parameter? */
if (t->modifiers & MOD_SNAP) {
ts->snap_flag |= SCE_SNAP;
- } else {
+ }
+ else {
ts->snap_flag &= ~SCE_SNAP;
}
@@ -1466,7 +1490,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
* */
if (t->con.mode & CON_APPLY) {
RNA_enum_set(op->ptr, "constraint_orientation", t->con.orientation);
- } else {
+ }
+ else {
RNA_enum_set(op->ptr, "constraint_orientation", t->current_orientation);
}
@@ -1501,7 +1526,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
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)) {
+ if (RNA_property_boolean_get(op->ptr, prop)) {
options |= CTX_TEXTURE;
}
}
@@ -1532,7 +1557,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
return 0;
}
- if(t->spacetype == SPACE_VIEW3D)
+ if (t->spacetype == SPACE_VIEW3D)
{
//calc_manipulator_stats(curarea);
initTransformOrientation(C, t);
@@ -1542,12 +1567,13 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
//t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t);
}
- else if(t->spacetype == SPACE_IMAGE) {
+ else if (t->spacetype == SPACE_IMAGE) {
unit_m3(t->spacemtx);
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
//t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
+ t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t);
}
- else if(t->spacetype == SPACE_CLIP) {
+ else if (t->spacetype == SPACE_CLIP) {
unit_m3(t->spacemtx);
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
t->options |= CTX_MOVIECLIP;
@@ -1563,7 +1589,7 @@ 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;
@@ -1637,7 +1663,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
case TFM_BONESIZE:
{ /* used for both B-Bone width (bonesize) as for deform-dist (envelope) */
bArmature *arm= t->poseobj->data;
- if(arm->drawtype==ARM_ENVELOPE)
+ if (arm->drawtype==ARM_ENVELOPE)
initBoneEnvelope(t);
else
initBoneSize(t);
@@ -1702,7 +1728,7 @@ 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;
@@ -1714,9 +1740,10 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
{
float values[4]= {0}; /* in case value isn't length 4, avoid uninitialized memory */
- if(RNA_property_array_check(prop)) {
+ if (RNA_property_array_check(prop)) {
RNA_float_get_array(op->ptr, "value", values);
- } else {
+ }
+ else {
values[0]= RNA_float_get(op->ptr, "value");
}
@@ -1778,7 +1805,8 @@ void transformApply(bContext *C, TransInfo *t)
viewRedrawForce(C, t);
}
t->redraw = TREDRAW_NOTHING;
- } else if (t->redraw & TREDRAW_SOFT) {
+ }
+ else if (t->redraw & TREDRAW_SOFT) {
viewRedrawForce(C, t);
}
@@ -1817,10 +1845,10 @@ int transformEnd(bContext *C, TransInfo *t)
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)
+ if (t->mode==TFM_EDGE_SLIDE)
doEdgeSlide(t, 0.0f);
exit_code = OPERATOR_CANCELLED;
@@ -1841,11 +1869,11 @@ int transformEnd(bContext *C, TransInfo *t)
/* Undo as last, certainly after special_trans_update! */
- if(t->state == TRANS_CANCEL) {
-// if(t->undostr) ED_undo_push(C, t->undostr);
+ if (t->state == TRANS_CANCEL) {
+// if (t->undostr) ED_undo_push(C, t->undostr);
}
else {
-// if(t->undostr) ED_undo_push(C, t->undostr);
+// if (t->undostr) ED_undo_push(C, t->undostr);
// else ED_undo_push(C, transform_to_undostr(t));
}
t->undostr= NULL;
@@ -1862,31 +1890,31 @@ int transformEnd(bContext *C, TransInfo *t)
static void protectedTransBits(short protectflag, float *vec)
{
- if(protectflag & OB_LOCK_LOCX)
+ if (protectflag & OB_LOCK_LOCX)
vec[0]= 0.0f;
- if(protectflag & OB_LOCK_LOCY)
+ if (protectflag & OB_LOCK_LOCY)
vec[1]= 0.0f;
- if(protectflag & OB_LOCK_LOCZ)
+ if (protectflag & OB_LOCK_LOCZ)
vec[2]= 0.0f;
}
static void protectedSizeBits(short protectflag, float *size)
{
- if(protectflag & OB_LOCK_SCALEX)
+ if (protectflag & OB_LOCK_SCALEX)
size[0]= 1.0f;
- if(protectflag & OB_LOCK_SCALEY)
+ if (protectflag & OB_LOCK_SCALEY)
size[1]= 1.0f;
- if(protectflag & OB_LOCK_SCALEZ)
+ if (protectflag & OB_LOCK_SCALEZ)
size[2]= 1.0f;
}
static void protectedRotateBits(short protectflag, float *eul, float *oldeul)
{
- if(protectflag & OB_LOCK_ROTX)
+ if (protectflag & OB_LOCK_ROTX)
eul[0]= oldeul[0];
- if(protectflag & OB_LOCK_ROTY)
+ if (protectflag & OB_LOCK_ROTY)
eul[1]= oldeul[1];
- if(protectflag & OB_LOCK_ROTZ)
+ if (protectflag & OB_LOCK_ROTZ)
eul[2]= oldeul[2];
}
@@ -2119,7 +2147,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
continue;
/* only do conversion if necessary, to preserve quats and eulers */
- if(!dolimit) {
+ if (!dolimit) {
constraintob_from_transdata(&cob, td);
dolimit= 1;
}
@@ -2143,7 +2171,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
}
}
- if(dolimit) {
+ if (dolimit) {
/* copy results from cob->matrix */
if (td->ext->rotOrder == ROT_MODE_QUAT) {
/* quats */
@@ -2272,7 +2300,7 @@ void initWarp(TransInfo *t)
t->flag |= T_NO_CONSTRAINT;
/* we need min/max in view space */
- for(i = 0; i < t->total; i++) {
+ for (i = 0; i < t->total; i++) {
float center[3];
copy_v3_v3(center, t->data[i].center);
mul_m3_v3(t->data[i].mtx, center);
@@ -2363,7 +2391,7 @@ int Warp(TransInfo *t, const int UNUSED(mval[2]))
circumfac /= 2; /* only need 180 on each side to make 360 */
- for(i = 0; i < t->total; i++, td++) {
+ for (i = 0; i < t->total; i++, td++) {
float loc[3];
if (td->flag & TD_NOACTION)
break;
@@ -2449,7 +2477,7 @@ int handleEventShear(TransInfo *t, wmEvent *event)
initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_ABSOLUTE);
t->customData = NULL;
}
-
+
status = 1;
}
@@ -2499,7 +2527,7 @@ int Shear(TransInfo *t, const int UNUSED(mval[2]))
mul_m3_m3m3(tmat, smat, persmat);
mul_m3_m3m3(totmat, persinv, tmat);
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -2614,9 +2642,9 @@ static void TransMat3ToSize( float mat[][3], float smat[][3], float *size)
size[2]= normalize_v3(vec);
/* first tried with dotproduct... but the sign flip is crucial */
- if( VECSIGNFLIP(mat[0], smat[0]) ) size[0]= -size[0];
- if( VECSIGNFLIP(mat[1], smat[1]) ) size[1]= -size[1];
- if( VECSIGNFLIP(mat[2], smat[2]) ) size[2]= -size[2];
+ if ( VECSIGNFLIP(mat[0], smat[0]) ) size[0]= -size[0];
+ if ( VECSIGNFLIP(mat[1], smat[1]) ) size[1]= -size[1];
+ if ( VECSIGNFLIP(mat[2], smat[2]) ) size[2]= -size[2];
}
@@ -2668,7 +2696,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3])
protectedSizeBits(td->protectflag, fsize);
if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't resize objects itself
- if((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) {
+ if ((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) {
/* scale val and reset size */
*td->val = td->ival * (1 + (fsize[0] - 1) * td->factor);
@@ -2725,7 +2753,7 @@ int Resize(TransInfo *t, const int mval[2])
char str[200];
/* for manipulator, center handle, the scaling can't be done relative to center */
- if( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0)
+ if ( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0)
{
ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f;
}
@@ -2761,7 +2789,7 @@ int Resize(TransInfo *t, const int mval[2])
headerResize(t, size, str);
- for(i = 0, td=t->data; i < t->total; i++, td++) {
+ for (i = 0, td=t->data; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -2778,7 +2806,7 @@ int Resize(TransInfo *t, const int mval[2])
if (t->con.applySize)
t->con.applySize(t, NULL, mat);
- for(i = 0, td=t->data; i < t->total; i++, td++)
+ for (i = 0, td=t->data; i < t->total; i++, td++)
ElementResize(t, td, mat);
}
@@ -2813,7 +2841,7 @@ void initToSphere(TransInfo *t)
t->flag |= T_NO_CONSTRAINT;
// Calculate average radius
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
t->val += len_v3v3(t->center, td->iloc);
}
@@ -2855,7 +2883,7 @@ int ToSphere(TransInfo *t, const int UNUSED(mval[2]))
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
float tratio;
if (td->flag & TD_NOACTION)
break;
@@ -2947,11 +2975,11 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
add_v3_v3v3(td->loc, td->iloc, vec);
- if(td->flag & TD_USEQUAT) {
+ if (td->flag & TD_USEQUAT) {
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
mat3_to_quat( quat,fmat); // Actual transform
- if(td->ext->quat) {
+ if (td->ext->quat) {
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
/* is there a reason not to have this here? -jahka */
@@ -2992,7 +3020,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
sub_v3_v3v3(vec, vec, td->center); // Translation needed from the initial location
/* special exception, see TD_PBONE_LOCAL_MTX definition comments */
- if(td->flag & TD_PBONE_LOCAL_MTX_P) {
+ if (td->flag & TD_PBONE_LOCAL_MTX_P) {
/* do nothing */
}
else if (td->flag & TD_PBONE_LOCAL_MTX_C) {
@@ -3142,7 +3170,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
vec_rot_to_mat3( mat,axis, angle);
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -3174,7 +3202,8 @@ int Rotation(TransInfo *t, const int UNUSED(mval[2]))
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
t->con.applyRot(t, NULL, t->axis, NULL);
- } else {
+ }
+ else {
/* reset axis if constraint is not set */
copy_v3_v3(t->axis, t->axis_orig);
}
@@ -3245,7 +3274,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
mul_m3_m3m3(mat, smat, totmat);
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -3336,7 +3365,7 @@ void initTranslation(TransInfo *t)
t->num.flag = 0;
t->num.idx_max = t->idx_max;
- if(t->spacetype == SPACE_VIEW3D) {
+ if (t->spacetype == SPACE_VIEW3D) {
RegionView3D *rv3d = t->ar->regiondata;
if (rv3d) {
@@ -3345,7 +3374,7 @@ void initTranslation(TransInfo *t)
t->snap[2] = t->snap[1] * 0.1f;
}
}
- else if(ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) {
+ else if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) {
t->snap[0] = 0.0f;
t->snap[1] = 0.125f;
t->snap[2] = 0.0625f;
@@ -3377,10 +3406,10 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
applyAspectRatio(t, dvec);
dist = len_v3(vec);
- if(!(t->flag & T_2D_EDIT) && t->scene->unit.system) {
+ if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) {
int i, do_split= t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1:0;
- for(i=0; i<3; i++)
+ for (i=0; i<3; i++)
bUnit_AsString(&tvec[i*20], 20, dvec[i]*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1);
}
else {
@@ -3390,17 +3419,17 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
}
}
- if(!(t->flag & T_2D_EDIT) && t->scene->unit.system)
+ if (!(t->flag & T_2D_EDIT) && t->scene->unit.system)
bUnit_AsString(distvec, sizeof(distvec), dist*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, 0);
- else if( dist > 1e10f || dist < -1e10f ) /* prevent string buffer overflow */
+ else if ( dist > 1e10f || dist < -1e10f ) /* prevent string buffer overflow */
sprintf(distvec, "%.4e", dist);
else
sprintf(distvec, "%.4f", dist);
- if(t->flag & T_AUTOIK) {
+ if (t->flag & T_AUTOIK) {
short chainlen= t->settings->autoik_chainlen;
- if(chainlen)
+ if (chainlen)
sprintf(autoik, "AutoIK-Len: %d", chainlen);
else
autoik[0]= '\0';
@@ -3421,7 +3450,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
}
}
else {
- if(t->flag & T_2D_EDIT)
+ if (t->flag & T_2D_EDIT)
spos += sprintf(spos, "Dx: %s Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext);
else
spos += sprintf(spos, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
@@ -3439,7 +3468,7 @@ static void applyTranslation(TransInfo *t, float vec[3])
float tvec[3];
int i;
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -3588,7 +3617,7 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -3658,7 +3687,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2]))
sprintf(str, "Tilt: %.2f %s", RAD2DEGF(final), t->proptext);
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -3725,14 +3754,14 @@ int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
sprintf(str, "Shrink/Fatten: %3f", ratio);
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
if (td->flag & TD_SKIP)
continue;
- if(td->val) {
+ if (td->val) {
// *td->val= ratio;
*td->val= td->ival*ratio;
if (*td->val <= 0.0f) *td->val = 0.001f;
@@ -3796,7 +3825,7 @@ int PushPull(TransInfo *t, const int UNUSED(mval[2]))
t->con.applyRot(t, NULL, axis, NULL);
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -3866,7 +3895,7 @@ void initBevel(TransInfo *t)
int handleEventBevel(TransInfo *t, wmEvent *event)
{
if (event->val==KM_PRESS) {
- if(!G.editBMesh) return 0;
+ if (!G.editBMesh) return 0;
switch (event->type) {
case MIDDLEMOUSE:
@@ -3927,7 +3956,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2]))
}
if (distance < 0) distance = -distance;
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->axismtx[1][0] > 0 && distance > td->axismtx[1][0]) {
d = td->axismtx[1][0];
}
@@ -3999,7 +4028,7 @@ int BevelWeight(TransInfo *t, const int UNUSED(mval[2]))
sprintf(str, "Bevel Weight: %.3f %s", weight, t->proptext);
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -4072,7 +4101,7 @@ int Crease(TransInfo *t, const int UNUSED(mval[2]))
sprintf(str, "Crease: %.3f %s", crease, t->proptext);
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -4193,7 +4222,7 @@ int BoneSize(TransInfo *t, const int mval[2])
headerBoneSize(t, size, str);
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -4255,7 +4284,7 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
sprintf(str, "Envelope: %3f", ratio);
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -4308,7 +4337,8 @@ static BMLoop *get_next_loop(BMesh *UNUSED(bm), BMVert *v, BMLoop *l,
if (l->e == nexte) {
if (i) {
mul_v3_fl(a, 1.0f / (float)i);
- } else {
+ }
+ else {
float f1[3], f2[3], f3[3];
sub_v3_v3v3(f1, BM_edge_other_vert(olde, v)->co, v->co);
@@ -4324,7 +4354,8 @@ static BMLoop *get_next_loop(BMesh *UNUSED(bm), BMVert *v, BMLoop *l,
copy_v3_v3(vec, a);
return l;
- } else {
+ }
+ else {
sub_v3_v3v3(n, BM_edge_other_vert(l->e, v)->co, v->co);
add_v3_v3v3(a, a, n);
i += 1;
@@ -4355,7 +4386,7 @@ static int createSlideVerts(TransInfo *t)
BMEditMesh *em = me->edit_btmesh;
BMesh *bm = em->bm;
BMIter iter, iter2;
- BMEdge *e, *e1, *ee, *le;
+ BMEdge *e, *e1 /*, *ee, *le */ /* UNUSED */;
BMVert *v, *v2, *first;
BMLoop *l, *l1, *l2;
TransDataSlideVert *tempsv;
@@ -4367,13 +4398,14 @@ static int createSlideVerts(TransInfo *t)
ARegion *ar = t->ar;
float projectMat[4][4];
float start[3] = {0.0f, 0.0f, 0.0f}, dir[3], end[3] = {0.0f, 0.0f, 0.0f};
- float vec[3], vec2[3], lastvec[3], size, dis=0.0, z;
+ float vec[3], vec2[3], lastvec[3] /*, size, dis=0.0, z */ /* UNUSED */;
int numsel, i, j;
if (!v3d) {
/*ok, let's try to survive this*/
unit_m4(projectMat);
- } else {
+ }
+ else {
ED_view3d_ob_project_mat_get(rv3d, t->obedit, projectMat);
}
@@ -4474,7 +4506,8 @@ static int createSlideVerts(TransInfo *t)
if (l2 != l1) {
l = BM_face_other_edge_loop(l2->f, l2->e, v);
sub_v3_v3v3(vec2, BM_edge_other_vert(l->e, v)->co, v->co);
- } else {
+ }
+ else {
l2 = NULL;
}
@@ -4541,10 +4574,10 @@ static int createSlideVerts(TransInfo *t)
sld->totsv = j;
/*find mouse vector*/
- dis = z = -1.0f;
- size = 50.0;
+ /* dis = z = -1.0f; */ /* UNUSED */
+ /* size = 50.0; */ /* UNUSED */
zero_v3(lastvec); zero_v3(dir);
- ee = le = NULL;
+ /* ee = le = NULL; */ /* UNUSED */
BM_ITER(e, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
BMIter iter2;
@@ -4552,7 +4585,7 @@ static int createSlideVerts(TransInfo *t)
float vec1[3], dis2, mval[2] = {t->mval[0], t->mval[1]}, d;
/* search cross edges for visible edge to the mouse cursor,
- * then use the shared vertex to calculate screen vector*/
+ * then use the shared vertex to calculate screen vector*/
dis2 = -1.0f;
for (i=0; i<2; i++) {
v = i?e->v1:e->v2;
@@ -4567,14 +4600,16 @@ static int createSlideVerts(TransInfo *t)
if (tempsv[j].down) {
ED_view3d_project_float_v3(ar, tempsv[j].down->co, vec1, projectMat);
- } else {
+ }
+ else {
add_v3_v3v3(vec1, v->co, tempsv[j].downvec);
ED_view3d_project_float_v3(ar, vec1, vec1, projectMat);
}
if (tempsv[j].up) {
ED_view3d_project_float_v3(ar, tempsv[j].up->co, vec2, projectMat);
- } else {
+ }
+ else {
add_v3_v3v3(vec1, v->co, tempsv[j].upvec);
ED_view3d_project_float_v3(ar, vec2, vec2, projectMat);
}
@@ -4582,16 +4617,15 @@ static int createSlideVerts(TransInfo *t)
d = dist_to_line_segment_v2(mval, vec1, vec2);
if (dis2 == -1.0f || d < dis2) {
dis2 = d;
- ee = e2;
- size = len_v3v3(vec1, vec2);
+ /* ee = e2; */ /* UNUSED */
+ /* size = len_v3v3(vec1, vec2); */ /* UNUSED */
sub_v3_v3v3(dir, vec1, vec2);
}
}
}
}
}
-
- em->bm->ob = t->obedit;
+
bmesh_edit_begin(em->bm, BMO_OP_FLAG_UNTAN_MULTIRES);
/*create copies of faces for customdata projection*/
@@ -4661,7 +4695,7 @@ void projectSVData(TransInfo *t, int final)
/* BMESH_TODO, (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)
* currently all vertex data is interpolated which is nice mostly
- * except for shape keys where you dont want to modify UVs for eg.
+ * except for shape keys where you don't want to modify UVs for eg.
* current BMesh code doesnt make it easy to pick which data we interpolate
* - campbell */
@@ -4675,7 +4709,7 @@ void projectSVData(TransInfo *t, int final)
BMIter liter2;
BMFace *copyf, *copyf2;
BMLoop *l2;
- int sel, hide, do_vdata;
+ int sel, hide /*, do_vdata */ /* UNUSED */;
if (BLI_smallhash_haskey(&visit, (uintptr_t)f))
continue;
@@ -4693,19 +4727,20 @@ void projectSVData(TransInfo *t, int final)
/*project onto copied projection face*/
BM_ITER(l2, &liter2, em->bm, BM_LOOPS_OF_FACE, f) {
copyf = copyf2;
- do_vdata = l2->v==tempsv->v;
+ /* do_vdata = l2->v==tempsv->v; */ /* UNUSED */
if (BM_elem_flag_test(l2->e, BM_ELEM_SELECT) || BM_elem_flag_test(l2->prev->e, BM_ELEM_SELECT)) {
BMLoop *l3 = l2;
- do_vdata = 1;
+ /* do_vdata = 1; */ /* UNUSED */
if (!BM_elem_flag_test(l2->e, BM_ELEM_SELECT))
l3 = l3->prev;
if (sld->perc < 0.0 && BM_vert_in_face(l3->radial_next->f, tempsv->down)) {
copyf = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l3->radial_next->f);
- } else if (sld->perc > 0.0 && BM_vert_in_face(l3->radial_next->f, tempsv->up)) {
+ }
+ else if (sld->perc > 0.0 && BM_vert_in_face(l3->radial_next->f, tempsv->up)) {
copyf = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l3->radial_next->f);
}
if (!copyf)
@@ -4737,8 +4772,8 @@ void projectSVData(TransInfo *t, int final)
BLI_smallhash_release(&visit);
}
-void freeSlideTempFaces(SlideData *sld){
- if(sld->origfaces_init){
+void freeSlideTempFaces(SlideData *sld) {
+ if (sld->origfaces_init) {
SmallHashIter hiter;
BMFace *copyf;
@@ -4759,13 +4794,13 @@ void freeSlideVerts(TransInfo *t)
SlideData *sld = t->customData;
#if 0 /*BMESH_TODO*/
- if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
+ if (me->drawflag & ME_DRAWEXTRA_EDGELEN) {
TransDataSlideVert *tempsv;
LinkNode *look = sld->vertlist;
GHash *vertgh = sld->vhash;
- while(look) {
+ while (look) {
tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
- if(tempsv != NULL) {
+ if (tempsv != NULL) {
tempsv->up->f &= !SELECT;
tempsv->down->f &= !SELECT;
}
@@ -4779,7 +4814,6 @@ void freeSlideVerts(TransInfo *t)
freeSlideTempFaces(sld);
- sld->em->bm->ob = t->obedit;
bmesh_edit_end(sld->em->bm, BMO_OP_FLAG_UNTAN_MULTIRES);
BLI_smallhash_release(&sld->vhash);
@@ -4799,7 +4833,7 @@ void initEdgeSlide(TransInfo *t)
t->mode = TFM_EDGE_SLIDE;
t->transform = EdgeSlide;
- if(!createSlideVerts(t)) {
+ if (!createSlideVerts(t)) {
t->state= TRANS_CANCEL;
return;
}
@@ -4989,7 +5023,7 @@ int BakeTime(TransInfo *t, const int mval[2])
float fac = 0.1f;
- if(t->mouse.precision) {
+ if (t->mouse.precision) {
/* calculate ratio for shiftkey pos, and for total, and blend these for precision */
time= (float)(t->center2d[0] - t->mouse.precision_mval[0]) * fac;
time+= 0.1f*((float)(t->center2d[0]*fac - mval[0]) -time);
@@ -5021,7 +5055,7 @@ int BakeTime(TransInfo *t, const int mval[2])
sprintf(str, "Time: %.3f %s", time, t->proptext);
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -5080,7 +5114,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
sprintf(str, "Mirror%s", t->con.text);
- for(i = 0, td=t->data; i < t->total; i++, td++) {
+ for (i = 0, td=t->data; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -5099,7 +5133,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
size_to_mat3( mat,size);
- for(i = 0, td=t->data; i < t->total; i++, td++) {
+ for (i = 0, td=t->data; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
@@ -5111,7 +5145,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- if(t->flag & T_2D_EDIT)
+ if (t->flag & T_2D_EDIT)
ED_area_headerprint(t->sa, "Select a mirror axis (X, Y)");
else
ED_area_headerprint(t->sa, "Select a mirror axis (X, Y, Z)");
@@ -5140,7 +5174,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2]))
/* saving original center */
copy_v3_v3(center, t->center);
- for(i = 0 ; i < t->total; i++, td++)
+ for (i = 0 ; i < t->total; i++, td++)
{
float mat[3][3], invmat[3][3];
@@ -5155,7 +5189,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2]))
copy_v3_v3(t->center, td->center);
}
else {
- if(t->settings->selectmode & SCE_SELECT_FACE) {
+ if (t->settings->selectmode & SCE_SELECT_FACE) {
copy_v3_v3(t->center, td->center);
}
}
@@ -5215,7 +5249,7 @@ static void applySeqSlide(TransInfo *t, float val[2])
TransData *td = t->data;
int i;
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
float tvec[2];
if (td->flag & TD_NOACTION)
@@ -5570,7 +5604,8 @@ void initTimeSlide(TransInfo *t)
/* set flag for drawing stuff */
saction->flag |= SACTION_MOVING;
- } else {
+ }
+ else {
t->state = TRANS_CANCEL;
}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 48c05f00ea8..0bef33149d7 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -444,9 +444,9 @@ void transformApply(struct bContext *C, TransInfo *t);
int transformEnd(struct bContext *C, TransInfo *t);
void setTransformViewMatrices(TransInfo *t);
-void convertViewVec(TransInfo *t, float *vec, int dx, int dy);
-void projectIntView(TransInfo *t, float *vec, int *adr);
-void projectFloatView(TransInfo *t, float *vec, float *adr);
+void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy);
+void projectIntView(TransInfo *t, const float vec[3], int adr[2]);
+void projectFloatView(TransInfo *t, const float vec[3], float adr[2]);
void applyAspectRatio(TransInfo *t, float *vec);
void removeAspectRatio(TransInfo *t, float *vec);
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 017501bd78e..18e9c1a47b8 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -183,21 +183,21 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3])
{
- if(t->spacetype == SPACE_VIEW3D) {
+ if (t->spacetype == SPACE_VIEW3D) {
// View3D *v3d = t->sa->spacedata.first;
const float min_dist= 1.0f; // v3d->near;
float dir[3];
float l;
sub_v3_v3v3(dir, t_con_center, t->viewinv[3]);
- if(dot_v3v3(dir, t->viewinv[2]) < 0.0f) {
+ if (dot_v3v3(dir, t->viewinv[2]) < 0.0f) {
negate_v3(dir);
}
project_v3_v3v3(dir, dir, t->viewinv[2]);
l= len_v3(dir);
- if(l < min_dist) {
+ if (l < min_dist) {
float diff[3];
normalize_v3_v3(diff, t->viewinv[2]);
mul_v3_fl(diff, min_dist - l);
@@ -212,7 +212,7 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
float norm[3], vec[3], factor, angle;
float t_con_center[3];
- if(in[0]==0.0f && in[1]==0.0f && in[2]==0.0f)
+ if (in[0]==0.0f && in[1]==0.0f && in[2]==0.0f)
return;
copy_v3_v3(t_con_center, t->con.center);
@@ -229,11 +229,11 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
/* For when view is parallel to constraint... will cause NaNs otherwise
* So we take vertical motion in 3D space and apply it to the
* constraint axis. Nice for camera grab + MMB */
- if(angle < 5.0f) {
+ if (angle < 5.0f) {
project_v3_v3v3(vec, in, t->viewinv[1]);
factor = dot_v3v3(t->viewinv[1], vec) * 2.0f;
/* since camera distance is quite relative, use quadratic relationship. holding shift can compensate */
- if(factor<0.0f) factor*= -factor;
+ if (factor<0.0f) factor*= -factor;
else factor*= factor;
copy_v3_v3(out, axis);
@@ -261,10 +261,12 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
copy_v3_v3(out, axis);
if (factor > 0) {
mul_v3_fl(out, 1000000000.0f);
- } else {
+ }
+ else {
mul_v3_fl(out, -1000000000.0f);
}
- } else {
+ }
+ else {
add_v3_v3v3(v2, t_con_center, axis);
add_v3_v3v3(v4, v, norm);
@@ -276,9 +278,9 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
/* possible some values become nan when
* viewpoint and object are both zero */
- if(!finite(out[0])) out[0]= 0.0f;
- if(!finite(out[1])) out[1]= 0.0f;
- if(!finite(out[2])) out[2]= 0.0f;
+ if (!finite(out[0])) out[0]= 0.0f;
+ if (!finite(out[1])) out[1]= 0.0f;
+ if (!finite(out[2])) out[2]= 0.0f;
}
}
}
@@ -654,7 +656,7 @@ void drawConstraint(TransInfo *t)
/* nasty exception for Z constraint in camera view */
// TRANSFORM_FIX_ME
-// if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB)
+// if ((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB)
// return;
if (tc->drawExtra) {
@@ -676,7 +678,7 @@ void drawConstraint(TransInfo *t)
glColor3ubv((GLubyte *)col2);
depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);
- if(depth_test_enabled)
+ if (depth_test_enabled)
glDisable(GL_DEPTH_TEST);
setlinestyle(1);
@@ -686,7 +688,7 @@ void drawConstraint(TransInfo *t)
glEnd();
setlinestyle(0);
- if(depth_test_enabled)
+ if (depth_test_enabled)
glEnable(GL_DEPTH_TEST);
}
@@ -712,7 +714,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
UI_ThemeColor(TH_GRID);
- if(t->spacetype == SPACE_VIEW3D && rv3d != NULL) {
+ if (t->spacetype == SPACE_VIEW3D && rv3d != NULL) {
copy_m4_m4(tmat, rv3d->viewmat);
invert_m4_m4(imat, tmat);
}
@@ -725,10 +727,10 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
copy_v3_v3(center, t->center);
- if((t->spacetype == SPACE_VIEW3D) && t->obedit) {
+ if ((t->spacetype == SPACE_VIEW3D) && t->obedit) {
mul_m4_v3(t->obedit->obmat, center); /* because t->center is in local space */
}
- else if(t->spacetype == SPACE_IMAGE) {
+ else if (t->spacetype == SPACE_IMAGE) {
float aspx, aspy;
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
@@ -766,7 +768,7 @@ static void drawObjectConstraint(TransInfo *t)
td++;
- for(i=1;i<t->total;i++,td++) {
+ for (i=1;i<t->total;i++,td++) {
if (t->con.mode & CON_AXIS0) {
drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', 0);
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 4dbf87fb500..6669bfdb3ca 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -56,6 +56,12 @@
#include "MEM_guardedalloc.h"
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_array.h"
+#include "BLI_utildefines.h"
+#include "BLI_smallhash.h"
+
#include "BKE_DerivedMesh.h"
#include "BKE_action.h"
#include "BKE_armature.h"
@@ -103,16 +109,8 @@
#include "UI_view2d.h"
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_array.h"
-#include "BLI_utildefines.h"
-#include "BLI_smallhash.h"
-
#include "RNA_access.h"
-extern ListBase editelems;
-
#include "transform.h"
#include "bmesh.h"
@@ -177,7 +175,7 @@ void sort_trans_data_dist(TransInfo *t)
TransData *start = t->data;
int i = 1;
- while(i < t->total && start->flag & TD_SELECTED) {
+ while (i < t->total && start->flag & TD_SELECTED) {
start++;
i++;
}
@@ -219,11 +217,11 @@ static void set_prop_dist(TransInfo *t, short with_dist)
TransData *tob;
int a;
- for(a=0, tob= t->data; a<t->total; a++, tob++) {
+ for (a=0, tob= t->data; a<t->total; a++, tob++) {
tob->rdist= 0.0f; // init, it was mallocced
- if((tob->flag & TD_SELECTED)==0) {
+ if ((tob->flag & TD_SELECTED)==0) {
TransData *td;
int i;
float dist, vec[3];
@@ -231,7 +229,7 @@ static void set_prop_dist(TransInfo *t, short with_dist)
tob->rdist = -1.0f; // signal for next loop
for (i = 0, td= t->data; i < t->total; i++, td++) {
- if(td->flag & TD_SELECTED) {
+ if (td->flag & TD_SELECTED) {
sub_v3_v3v3(vec, tob->center, td->center);
mul_m3_v3(tob->mtx, vec);
dist = normalize_v3(vec);
@@ -271,7 +269,7 @@ static void createTransTexspace(TransInfo *t)
}
id = ob->data;
- if(id == NULL || !ELEM3( GS(id->name), ID_ME, ID_CU, ID_MB )) {
+ if (id == NULL || !ELEM3( GS(id->name), ID_ME, ID_CU, ID_MB )) {
t->total = 0;
return;
}
@@ -321,7 +319,7 @@ static void createTransEdge(TransInfo *t)
if (countsel == 0)
return;
- if(propmode) {
+ if (propmode) {
t->total = count;
}
else {
@@ -334,7 +332,7 @@ static void createTransEdge(TransInfo *t)
invert_m3_m3(smtx, mtx);
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
- if(!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && (BM_elem_flag_test(eed, BM_ELEM_SELECT) || propmode)) {
+ if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && (BM_elem_flag_test(eed, BM_ELEM_SELECT) || propmode)) {
float *bweight = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_BWEIGHT);
float *crease = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_CREASE);
@@ -373,13 +371,13 @@ static bKinematicConstraint *has_targetless_ik(bPoseChannel *pchan)
{
bConstraint *con= pchan->constraints.first;
- for(;con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) {
+ for (;con; con= con->next) {
+ if (con->type==CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) {
bKinematicConstraint *data= con->data;
- if(data->tar==NULL)
+ if (data->tar==NULL)
return data;
- if(data->tar->type==OB_ARMATURE && data->subtarget[0]==0)
+ if (data->tar->type==OB_ARMATURE && data->subtarget[0]==0)
return data;
}
}
@@ -398,13 +396,13 @@ static short apply_targetless_ik(Object *ob)
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
data= has_targetless_ik(pchan);
- if(data && (data->flag & CONSTRAINT_IK_AUTO)) {
+ if (data && (data->flag & CONSTRAINT_IK_AUTO)) {
/* fill the array with the bones of the chain (armature.c does same, keep it synced) */
segcount= 0;
/* exclude tip from chain? */
- if(!(data->flag & CONSTRAINT_IK_TIP))
+ if (!(data->flag & CONSTRAINT_IK_TIP))
parchan= pchan->parent;
else
parchan= pchan;
@@ -414,9 +412,9 @@ static short apply_targetless_ik(Object *ob)
chanlist[segcount]= parchan;
segcount++;
- if(segcount==data->rootbone || segcount>255) break; // 255 is weak
+ if (segcount==data->rootbone || segcount>255) break; // 255 is weak
}
- for(;segcount;segcount--) {
+ for (;segcount;segcount--) {
Bone *bone;
float rmat[4][4]/*, tmat[4][4], imat[4][4]*/;
@@ -431,7 +429,7 @@ static short apply_targetless_ik(Object *ob)
/* XXX Old code. Will remove it later. */
#if 0
- if(parchan->parent) {
+ if (parchan->parent) {
Bone *parbone= parchan->parent->bone;
float offs_bone[4][4];
@@ -445,7 +443,7 @@ static short apply_targetless_ik(Object *ob)
offs_bone[3][1]+= parbone->length;
/* pose_mat(b-1) * offs_bone */
- if(parchan->bone->flag & BONE_HINGE) {
+ if (parchan->bone->flag & BONE_HINGE) {
/* the rotation of the parent restposition */
copy_m4_m4(rmat, parbone->arm_mat); /* rmat used as temp */
@@ -456,7 +454,7 @@ static short apply_targetless_ik(Object *ob)
mult_m4_m4m4(tmat, rmat, offs_bone);
}
- else if(parchan->bone->flag & BONE_NO_SCALE) {
+ else if (parchan->bone->flag & BONE_NO_SCALE) {
mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone);
normalize_m4(tmat);
}
@@ -614,9 +612,9 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
copy_m3_m3(bmat, pchan->bone->bone_mat);
if (pchan->parent) {
- if(pchan->bone->flag & BONE_HINGE) {
+ if (pchan->bone->flag & BONE_HINGE) {
copy_m3_m4(pmat, pchan->parent->bone->arm_mat);
- if(!(pchan->bone->flag & BONE_NO_SCALE)) {
+ if (!(pchan->bone->flag & BONE_NO_SCALE)) {
float tsize[3], tsmat[3][3];
mat4_to_size(tsize, pchan->parent->pose_mat);
size_to_mat3(tsmat, tsize);
@@ -625,7 +623,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
}
else {
copy_m3_m4(pmat, pchan->parent->pose_mat);
- if(pchan->bone->flag & BONE_NO_SCALE)
+ if (pchan->bone->flag & BONE_NO_SCALE)
normalize_m3(pmat);
}
@@ -653,7 +651,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
/* exceptional case: rotate the pose bone which also applies transformation
* when a parentless bone has BONE_NO_LOCAL_LOCATION [] */
if (!ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) {
- if(pchan->parent) {
+ if (pchan->parent) {
/* same as td->smtx but without pchan->bone->bone_mat */
td->flag |= TD_PBONE_LOCAL_MTX_C;
mul_m3_m3m3(td->ext->l_smtx, pchan->bone->bone_mat, td->smtx);
@@ -671,7 +669,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
if (t->mode==TFM_BONESIZE) {
bArmature *arm= t->poseobj->data;
- if(arm->drawtype==ARM_ENVELOPE) {
+ if (arm->drawtype==ARM_ENVELOPE) {
td->loc= NULL;
td->val= &bone->dist;
td->ival= bone->dist;
@@ -687,8 +685,8 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
/* in this case we can do target-less IK grabbing */
if (t->mode==TFM_TRANSLATION) {
bKinematicConstraint *data= has_targetless_ik(pchan);
- if(data) {
- if(data->flag & CONSTRAINT_IK_TIP) {
+ if (data) {
+ if (data->flag & CONSTRAINT_IK_TIP) {
copy_v3_v3(data->grabtarget, pchan->pose_tail);
}
else {
@@ -712,8 +710,8 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb)
{
Bone *bone= lb->first;
- for(;bone;bone= bone->next) {
- if((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED))
+ for (;bone;bone= bone->next) {
+ if ((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED))
{
bone->flag |= BONE_HINGE_CHILD_TRANSFORM;
}
@@ -759,28 +757,28 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob)
/* make sure no bone can be transformed when a parent is transformed */
/* since pchans are depsgraph sorted, the parents are in beginning of list */
- if(mode != TFM_BONESIZE) {
- for(pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+ if (mode != TFM_BONESIZE) {
+ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
bone = pchan->bone;
- if(bone->flag & BONE_TRANSFORM)
+ if (bone->flag & BONE_TRANSFORM)
bone_children_clear_transflag(mode, around, &bone->childbase);
}
}
/* now count, and check if we have autoIK or have to switch from translate to rotate */
hastranslation = 0;
- for(pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
bone = pchan->bone;
- if(bone->flag & BONE_TRANSFORM) {
+ if (bone->flag & BONE_TRANSFORM) {
total++;
- if(mode == TFM_TRANSLATION) {
- if( has_targetless_ik(pchan)==NULL ) {
- if(pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) {
- if(pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM)
+ if (mode == TFM_TRANSLATION) {
+ if ( has_targetless_ik(pchan)==NULL ) {
+ if (pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) {
+ if (pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM)
hastranslation = 1;
}
- else if((pchan->protectflag & OB_LOCK_LOC)!=OB_LOCK_LOC)
+ else if ((pchan->protectflag & OB_LOCK_LOC)!=OB_LOCK_LOC)
hastranslation = 1;
}
else
@@ -790,7 +788,7 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob)
}
/* if there are no translatable bones, do rotation */
- if(mode == TFM_TRANSLATION && !hastranslation)
+ if (mode == TFM_TRANSLATION && !hastranslation)
{
*out_mode = TFM_ROTATION;
}
@@ -878,7 +876,7 @@ static void pose_grab_with_ik_clear(Object *ob)
continue;
}
pchan->constflag |= PCHAN_HAS_IK;
- if(data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
+ if (data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
pchan->constflag |= PCHAN_HAS_TARGET;
}
}
@@ -1069,7 +1067,7 @@ static void createTransPose(TransInfo *t, Object *ob)
/* set flags and count total (warning, can change transform to rotate) */
t->total = count_set_pose_transflags(&t->mode, t->around, ob);
- if(t->total == 0) return;
+ if (t->total == 0) return;
t->flag |= T_POSE;
t->poseobj= ob; /* we also allow non-active objects to be transformed, in weightpaint */
@@ -1077,7 +1075,7 @@ static void createTransPose(TransInfo *t, Object *ob)
/* init trans data */
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransPoseBone");
tdx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransPoseBoneExt");
- for(i=0; i<t->total; i++, td++, tdx++) {
+ for (i=0; i<t->total; i++, td++, tdx++) {
td->ext= tdx;
td->val = NULL;
}
@@ -1091,7 +1089,7 @@ static void createTransPose(TransInfo *t, Object *ob)
}
}
- if(td != (t->data+t->total)) {
+ if (td != (t->data+t->total)) {
// XXX use transform operator reports
// BKE_report(op->reports, RPT_DEBUG, "Bone selection count error");
}
@@ -1193,7 +1191,7 @@ static void createTransArmatureVerts(TransInfo *t)
}
else if (t->mode==TFM_BONESIZE) {
if (ebo->flag & BONE_SELECTED) {
- if(arm->drawtype==ARM_ENVELOPE)
+ if (arm->drawtype==ARM_ENVELOPE)
{
td->loc= NULL;
td->val= &ebo->dist;
@@ -1307,15 +1305,15 @@ static void createTransMBallVerts(TransInfo *t)
int propmode = t->flag & T_PROP_EDIT;
/* count totals */
- for(ml= mb->editelems->first; ml; ml= ml->next) {
- if(ml->flag & SELECT) countsel++;
- if(propmode) count++;
+ for (ml= mb->editelems->first; ml; ml= ml->next) {
+ if (ml->flag & SELECT) countsel++;
+ if (propmode) count++;
}
/* note: in prop mode we need at least 1 selected */
if (countsel==0) return;
- if(propmode) t->total = count;
+ if (propmode) t->total = count;
else t->total = countsel;
td = t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(MBall EditMode)");
@@ -1324,13 +1322,13 @@ static void createTransMBallVerts(TransInfo *t)
copy_m3_m4(mtx, t->obedit->obmat);
invert_m3_m3(smtx, mtx);
- for(ml= mb->editelems->first; ml; ml= ml->next) {
- if(propmode || (ml->flag & SELECT)) {
+ for (ml= mb->editelems->first; ml; ml= ml->next) {
+ if (propmode || (ml->flag & SELECT)) {
td->loc= &ml->x;
copy_v3_v3(td->iloc, td->loc);
copy_v3_v3(td->center, td->loc);
- if(ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE;
+ if (ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE;
else td->flag= TD_USEQUAT;
copy_m3_m3(td->smtx, smtx);
@@ -1339,11 +1337,11 @@ static void createTransMBallVerts(TransInfo *t)
td->ext = tx;
/* Radius of MetaElem (mass of MetaElem influence) */
- if(ml->flag & MB_SCALE_RAD) {
+ if (ml->flag & MB_SCALE_RAD) {
td->val = &ml->rad;
td->ival = ml->rad;
}
- else{
+ else {
td->val = &ml->s;
td->ival = ml->s;
}
@@ -1376,7 +1374,7 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail)
td_near = td;
td->dist = 0.0f;
}
- else if(td_near) {
+ else if (td_near) {
float dist;
dist = len_v3v3(td_near->center, td->center);
if (dist < (td-1)->dist) {
@@ -1397,7 +1395,7 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail)
td_near = td;
td->dist = 0.0f;
}
- else if(td_near) {
+ else if (td_near) {
float dist;
dist = len_v3v3(td_near->center, td->center);
if (td->flag & TD_NOTCONNECTED || dist < td->dist || (td+1)->dist < td->dist) {
@@ -1442,31 +1440,32 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
ListBase *nurbs;
/* to be sure */
- if(cu->editnurb==NULL) return;
+ if (cu->editnurb==NULL) return;
/* count total of vertices, check identical as in 2nd loop for making transdata! */
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++) {
- if(bezt->hide==0) {
+ for (nu= nurbs->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
+ for (a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
+ if (bezt->hide==0) {
if (hide_handles) {
- if(bezt->f2 & SELECT) countsel+=3;
- if(propmode) count+= 3;
- } else {
- if(bezt->f1 & SELECT) countsel++;
- if(bezt->f2 & SELECT) countsel++;
- if(bezt->f3 & SELECT) countsel++;
- if(propmode) count+= 3;
+ if (bezt->f2 & SELECT) countsel+=3;
+ if (propmode) count+= 3;
+ }
+ else {
+ if (bezt->f1 & SELECT) countsel++;
+ if (bezt->f2 & SELECT) countsel++;
+ if (bezt->f3 & SELECT) countsel++;
+ if (propmode) count+= 3;
}
}
}
}
else {
- for(a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
- if(bp->hide==0) {
- if(propmode) count++;
- if(bp->f1 & SELECT) countsel++;
+ for (a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
+ if (bp->hide==0) {
+ if (propmode) count++;
+ if (bp->f1 & SELECT) countsel++;
}
}
}
@@ -1474,7 +1473,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
/* note: in prop mode we need at least 1 selected */
if (countsel==0) return;
- if(propmode) t->total = count;
+ if (propmode) t->total = count;
else t->total = countsel;
t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Curve EditMode)");
@@ -1482,15 +1481,15 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
invert_m3_m3(smtx, mtx);
td = t->data;
- for(nu= nurbs->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= nurbs->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
TransData *head, *tail;
head = tail = td;
- for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
- if(bezt->hide==0) {
+ for (a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
+ if (bezt->hide==0) {
TransDataCurveHandleFlags *hdata = NULL;
- if( propmode ||
+ if ( propmode ||
((bezt->f2 & SELECT) && hide_handles) ||
((bezt->f1 & SELECT) && hide_handles == 0)
) {
@@ -1498,10 +1497,11 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
td->loc= bezt->vec[0];
copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:0]);
if (hide_handles) {
- if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
+ if (bezt->f2 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
- } else {
- if(bezt->f1 & SELECT) td->flag= TD_SELECTED;
+ }
+ else {
+ if (bezt->f1 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
}
td->ext = NULL;
@@ -1518,21 +1518,23 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
}
/* This is the Curve Point, the other two are handles */
- if(propmode || (bezt->f2 & SELECT)) {
+ if (propmode || (bezt->f2 & SELECT)) {
copy_v3_v3(td->iloc, bezt->vec[1]);
td->loc= bezt->vec[1];
copy_v3_v3(td->center, td->loc);
- if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
+ if (bezt->f2 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
td->ext = NULL;
if (t->mode==TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/ /* TODO - make points scale */
td->val = &(bezt->radius);
td->ival = bezt->radius;
- } else if (t->mode==TFM_TILT) {
+ }
+ else if (t->mode==TFM_TILT) {
td->val = &(bezt->alfa);
td->ival = bezt->alfa;
- } else {
+ }
+ else {
td->val = NULL;
}
@@ -1549,7 +1551,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
count++;
tail++;
}
- if( propmode ||
+ if ( propmode ||
((bezt->f2 & SELECT) && hide_handles) ||
((bezt->f3 & SELECT) && hide_handles == 0)
) {
@@ -1557,10 +1559,11 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
td->loc= bezt->vec[2];
copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:2]);
if (hide_handles) {
- if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
+ if (bezt->f2 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
- } else {
- if(bezt->f3 & SELECT) td->flag= TD_SELECTED;
+ }
+ else {
+ if (bezt->f3 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
}
td->ext = NULL;
@@ -1587,7 +1590,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
calc_distanceCurveVerts(head, tail-1);
/* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles
- * but for now just dont change handle types */
+ * but for now just don't change handle types */
if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0) {
/* sets the handles based on their selection, do this after the data is copied to the TransData */
testhandlesNurb(nu);
@@ -1596,20 +1599,21 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
else {
TransData *head, *tail;
head = tail = td;
- for(a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
- if(bp->hide==0) {
- if(propmode || (bp->f1 & SELECT)) {
+ for (a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
+ if (bp->hide==0) {
+ if (propmode || (bp->f1 & SELECT)) {
copy_v3_v3(td->iloc, bp->vec);
td->loc= bp->vec;
copy_v3_v3(td->center, td->loc);
- if(bp->f1 & SELECT) td->flag= TD_SELECTED;
+ if (bp->f1 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
td->ext = NULL;
if (t->mode==TFM_CURVE_SHRINKFATTEN || t->mode==TFM_RESIZE) {
td->val = &(bp->radius);
td->ival = bp->radius;
- } else {
+ }
+ else {
td->val = &(bp->alfa);
td->ival = bp->alfa;
}
@@ -1647,10 +1651,10 @@ static void createTransLatticeVerts(TransInfo *t)
bp = latt->def;
a = latt->pntsu * latt->pntsv * latt->pntsw;
- while(a--) {
- if(bp->hide==0) {
- if(bp->f1 & SELECT) countsel++;
- if(propmode) count++;
+ while (a--) {
+ if (bp->hide==0) {
+ if (bp->f1 & SELECT) countsel++;
+ if (propmode) count++;
}
bp++;
}
@@ -1658,7 +1662,7 @@ static void createTransLatticeVerts(TransInfo *t)
/* note: in prop mode we need at least 1 selected */
if (countsel==0) return;
- if(propmode) t->total = count;
+ if (propmode) t->total = count;
else t->total = countsel;
t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Lattice EditMode)");
@@ -1668,13 +1672,13 @@ static void createTransLatticeVerts(TransInfo *t)
td = t->data;
bp = latt->def;
a = latt->pntsu * latt->pntsv * latt->pntsw;
- while(a--) {
- if(propmode || (bp->f1 & SELECT)) {
- if(bp->hide==0) {
+ while (a--) {
+ if (propmode || (bp->f1 & SELECT)) {
+ if (bp->hide==0) {
copy_v3_v3(td->iloc, bp->vec);
td->loc= bp->vec;
copy_v3_v3(td->center, td->loc);
- if(bp->f1 & SELECT) td->flag= TD_SELECTED;
+ if (bp->f1 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
copy_m3_m3(td->smtx, smtx);
copy_m3_m3(td->mtx, mtx);
@@ -1708,33 +1712,33 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
int count = 0, hasselected = 0;
int propmode = t->flag & T_PROP_EDIT;
- if(edit==NULL || t->settings->particle.selectmode==SCE_SELECT_PATH) return;
+ if (edit==NULL || t->settings->particle.selectmode==SCE_SELECT_PATH) return;
psys = edit->psys;
- if(psys)
+ if (psys)
psmd = psys_get_modifier(ob,psys);
base->flag |= BA_HAS_RECALC_DATA;
- for(i=0, point=edit->points; i<edit->totpoint; i++, point++) {
+ for (i=0, point=edit->points; i<edit->totpoint; i++, point++) {
point->flag &= ~PEP_TRANSFORM;
transformparticle= 0;
- if((point->flag & PEP_HIDE)==0) {
- for(k=0, key=point->keys; k<point->totkey; k++, key++) {
- if((key->flag&PEK_HIDE)==0) {
- if(key->flag&PEK_SELECT) {
+ if ((point->flag & PEP_HIDE)==0) {
+ for (k=0, key=point->keys; k<point->totkey; k++, key++) {
+ if ((key->flag&PEK_HIDE)==0) {
+ if (key->flag&PEK_SELECT) {
hasselected= 1;
transformparticle= 1;
}
- else if(propmode)
+ else if (propmode)
transformparticle= 1;
}
}
}
- if(transformparticle) {
+ if (transformparticle) {
count += point->totkey;
point->flag |= PEP_TRANSFORM;
}
@@ -1746,7 +1750,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
t->total = count;
td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Particle Mode)");
- if(t->mode == TFM_BAKE_TIME)
+ if (t->mode == TFM_BAKE_TIME)
tx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension), "Particle_TransExtension");
else
tx = t->ext = NULL;
@@ -1755,17 +1759,17 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
invert_m4_m4(ob->imat,ob->obmat);
- for(i=0, point=edit->points; i<edit->totpoint; i++, point++) {
+ for (i=0, point=edit->points; i<edit->totpoint; i++, point++) {
TransData *head, *tail;
head = tail = td;
- if(!(point->flag & PEP_TRANSFORM)) continue;
+ if (!(point->flag & PEP_TRANSFORM)) continue;
- if(psys && !(psys->flag & PSYS_GLOBAL_HAIR))
+ if (psys && !(psys->flag & PSYS_GLOBAL_HAIR))
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat);
- for(k=0, key=point->keys; k<point->totkey; k++, key++) {
- if(key->flag & PEK_USE_WCO) {
+ for (k=0, key=point->keys; k<point->totkey; k++, key++) {
+ if (key->flag & PEK_USE_WCO) {
copy_v3_v3(key->world_co, key->co);
mul_m4_v3(mat, key->world_co);
td->loc = key->world_co;
@@ -1776,34 +1780,34 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
copy_v3_v3(td->iloc, td->loc);
copy_v3_v3(td->center, td->loc);
- if(key->flag & PEK_SELECT)
+ if (key->flag & PEK_SELECT)
td->flag |= TD_SELECTED;
- else if(!propmode)
+ else if (!propmode)
td->flag |= TD_SKIP;
unit_m3(td->mtx);
unit_m3(td->smtx);
/* don't allow moving roots */
- if(k==0 && pset->flag & PE_LOCK_FIRST && (!psys || !(psys->flag & PSYS_GLOBAL_HAIR)))
+ if (k==0 && pset->flag & PE_LOCK_FIRST && (!psys || !(psys->flag & PSYS_GLOBAL_HAIR)))
td->protectflag |= OB_LOCK_LOC;
td->ob = ob;
td->ext = tx;
- if(t->mode == TFM_BAKE_TIME) {
+ if (t->mode == TFM_BAKE_TIME) {
td->val = key->time;
td->ival = *(key->time);
/* abuse size and quat for min/max values */
td->flag |= TD_NO_EXT;
- if(k==0) tx->size = NULL;
+ if (k==0) tx->size = NULL;
else tx->size = (key - 1)->time;
- if(k == point->totkey - 1) tx->quat = NULL;
+ if (k == point->totkey - 1) tx->quat = NULL;
else tx->quat = (key + 1)->time;
}
td++;
- if(tx)
+ if (tx)
tx++;
tail++;
}
@@ -1825,26 +1829,26 @@ void flushTransParticles(TransInfo *t)
float mat[4][4], imat[4][4], co[3];
int i, k, propmode = t->flag & T_PROP_EDIT;
- if(psys)
+ if (psys)
psmd = psys_get_modifier(ob, psys);
/* we do transform in world space, so flush world space position
* back to particle local space (only for hair particles) */
td= t->data;
- for(i=0, point=edit->points; i<edit->totpoint; i++, point++, td++) {
- if(!(point->flag & PEP_TRANSFORM)) continue;
+ for (i=0, point=edit->points; i<edit->totpoint; i++, point++, td++) {
+ if (!(point->flag & PEP_TRANSFORM)) continue;
- if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+ if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat);
invert_m4_m4(imat,mat);
- for(k=0, key=point->keys; k<point->totkey; k++, key++) {
+ for (k=0, key=point->keys; k<point->totkey; k++, key++) {
copy_v3_v3(co, key->world_co);
mul_m4_v3(imat, co);
/* optimization for proportional edit */
- if(!propmode || !compare_v3v3(key->co, co, 0.0001f)) {
+ if (!propmode || !compare_v3v3(key->co, co, 0.0001f)) {
copy_v3_v3(key->co, co);
point->flag |= PEP_EDIT_RECALC;
}
@@ -1987,10 +1991,10 @@ static void VertsToTransData(TransInfo *t, TransData *td, BMEditMesh *em, BMVert
copy_v3_v3(td->center, td->loc);
- if(t->around==V3D_LOCAL) {
- if(em->selectmode & SCE_SELECT_FACE)
+ if (t->around==V3D_LOCAL) {
+ if (em->selectmode & SCE_SELECT_FACE)
get_face_center(td->center, em->bm, eve);
- else if(em->selectmode & SCE_SELECT_EDGE)
+ else if (em->selectmode & SCE_SELECT_EDGE)
get_edge_center(td->center, em->bm, eve);
}
copy_v3_v3(td->iloc, td->loc);
@@ -2046,19 +2050,19 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
* use the values for vertex mirror - campbell */
// transform now requires awareness for select mode, so we tag the f1 flags in verts
- if(selectmode & SCE_SELECT_VERTEX) {
+ if (selectmode & SCE_SELECT_VERTEX) {
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
BM_elem_flag_set(eve, BM_ELEM_TAG, BM_elem_flag_test(eve, BM_ELEM_SELECT));
}
}
- else if(selectmode & SCE_SELECT_EDGE) {
+ else if (selectmode & SCE_SELECT_EDGE) {
BMEdge *eed;
eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
- for( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG);
+ for ( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG);
eed = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL);
- for( ; eed; eed=BM_iter_step(&iter)) {
+ for ( ; eed; eed=BM_iter_step(&iter)) {
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
BM_elem_flag_enable(eed->v1, BM_ELEM_TAG);
BM_elem_flag_enable(eed->v2, BM_ELEM_TAG);
@@ -2068,10 +2072,10 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
else {
BMFace *efa;
eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
- for( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG);
+ for ( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG);
efa = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL);
- for( ; efa; efa=BM_iter_step(&iter)) {
+ for ( ; efa; efa=BM_iter_step(&iter)) {
if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BMIter liter;
BMLoop *l;
@@ -2089,13 +2093,13 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
* verts*/
selstate = MEM_callocN(sizeof(*selstate) * bm->totvert, __func__);
eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
- for(a=0; eve; eve=BM_iter_step(&iter), a++) {
+ for (a=0; eve; eve=BM_iter_step(&iter), a++) {
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
if (BM_elem_flag_test(eve, BM_ELEM_TAG)) {
selstate[a] = 1;
countsel++;
}
- if(propmode) count++;
+ if (propmode) count++;
}
}
@@ -2113,7 +2117,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
}
- if(propmode) {
+ if (propmode) {
t->total = count;
/* allocating scratch arrays */
@@ -2127,13 +2131,13 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
copy_m3_m4(mtx, t->obedit->obmat);
invert_m3_m3(smtx, mtx);
- if(propmode & T_PROP_CONNECTED) {
+ if (propmode & T_PROP_CONNECTED) {
editmesh_set_connectivity_distance(em, mtx, dists);
}
/* detect CrazySpace [tm] */
- if(modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) {
- if(modifiers_isCorrectableDeformed(t->obedit)) {
+ if (modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) {
+ if (modifiers_isCorrectableDeformed(t->obedit)) {
/* check if we can use deform matrices for modifier from the
* start up to stack, they are more accurate than quats */
totleft= editbmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos);
@@ -2141,25 +2145,25 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
/* if we still have more modifiers, also do crazyspace
* correction with quats, relative to the coordinates after
* the modifiers that support deform matrices (defcos) */
- if(totleft > 0) {
+ if (totleft > 0) {
mappedcos= crazyspace_get_mapped_editverts(t->scene, t->obedit);
quats= MEM_mallocN( (t->total)*sizeof(float)*4, "crazy quats");
crazyspace_set_quats_editmesh(em, (float*)defcos, mappedcos, quats); /* BMESH_TODO, abuses vertex index, should use an int array */
- if(mappedcos)
+ if (mappedcos)
MEM_freeN(mappedcos);
}
- if(defcos)
+ if (defcos)
MEM_freeN(defcos);
}
}
/* find out which half we do */
- if(mirror) {
+ if (mirror) {
eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
- for(a=0; eve; eve=BM_iter_step(&iter), a++) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && selstate[a] && eve->co[0]!=0.0f) {
- if(eve->co[0]<0.0f)
+ for (a=0; eve; eve=BM_iter_step(&iter), a++) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && selstate[a] && eve->co[0]!=0.0f) {
+ if (eve->co[0]<0.0f)
{
t->mirror = -1;
mirror = -1;
@@ -2170,37 +2174,38 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
}
eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
- for(a=0; eve; eve=BM_iter_step(&iter), a++) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- if(propmode || selstate[a]) {
+ for (a=0; eve; eve=BM_iter_step(&iter), a++) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+ if (propmode || selstate[a]) {
float *bweight = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_BWEIGHT);
VertsToTransData(t, tob, em, eve, bweight);
/* selected */
- if(selstate[a]) tob->flag |= TD_SELECTED;
+ if (selstate[a]) tob->flag |= TD_SELECTED;
/* active */
- if(eve == eve_act) tob->flag |= TD_ACTIVE;
+ if (eve == eve_act) tob->flag |= TD_ACTIVE;
- if(propmode) {
+ if (propmode) {
if (propmode & T_PROP_CONNECTED) {
tob->dist = dists[a];
- } else {
+ }
+ else {
tob->flag |= TD_NOTCONNECTED;
tob->dist = MAXFLOAT;
}
}
/* CrazySpace */
- if(defmats || (quats && BM_elem_index_get(eve) != -1)) {
+ if (defmats || (quats && BM_elem_index_get(eve) != -1)) {
float mat[3][3], qmat[3][3], imat[3][3];
/* use both or either quat and defmat correction */
- if(quats && BM_elem_index_get(eve) != -1) {
+ if (quats && BM_elem_index_get(eve) != -1) {
quat_to_mat3(qmat, quats + 4*BM_elem_index_get(eve));
- if(defmats)
+ if (defmats)
mul_serie_m3(mat, mtx, qmat, defmats[a],
NULL, NULL, NULL, NULL, NULL);
else
@@ -2220,9 +2225,9 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
}
/* Mirror? */
- if( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
+ if ( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
BMVert *vmir= EDBM_GetMirrorVert(em, eve); //t->obedit, em, eve, tob->iloc, a);
- if(vmir && vmir != eve) {
+ if (vmir && vmir != eve) {
tob->extra = vmir;
}
}
@@ -2234,7 +2239,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
if (mirror != 0)
{
tob = t->data;
- for( a = 0; a < t->total; a++, tob++ )
+ for ( a = 0; a < t->total; a++, tob++ )
{
if (ABS(tob->loc[0]) <= 0.00001f)
{
@@ -2245,9 +2250,9 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
cleanup:
/* crazy space free */
- if(quats)
+ if (quats)
MEM_freeN(quats);
- if(defmats)
+ if (defmats)
MEM_freeN(defmats);
if (dists)
MEM_freeN(dists);
@@ -2267,13 +2272,13 @@ void flushTransNodes(TransInfo *t)
TransData2D *td;
/* flush to 2d vector from internally used 3d vector */
- for(a=0, td= t->data2d; a<t->total; a++, td++) {
+ for (a=0, td= t->data2d; a<t->total; a++, td++) {
td->loc2d[0]= td->loc[0];
td->loc2d[1]= td->loc[1];
}
/* handle intersection with noodles */
- if(t->total==1) {
+ if (t->total==1) {
ED_node_link_intersect_test(t->sa, 1);
}
@@ -2303,7 +2308,7 @@ void flushTransSeq(TransInfo *t)
Sequence *seq_prev= NULL;
/* flush to 2d vector from internally used 3d vector */
- for(a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
+ for (a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
tdsq= (TransDataSeq *)td->extra;
seq= tdsq->seq;
old_start = seq->start;
@@ -2336,17 +2341,17 @@ void flushTransSeq(TransInfo *t)
}
if (seq != seq_prev) {
- if(seq->depth==0) {
+ if (seq->depth==0) {
/* Calculate this strip and all nested strips
* children are ALWAYS transformed first
- * so we dont need to do this in another loop. */
+ * so we don't need to do this in another loop. */
calc_sequence(t->scene, seq);
}
else {
calc_sequence_disp(t->scene, seq);
}
- if(tdsq->sel_flag == SELECT)
+ if (tdsq->sel_flag == SELECT)
seq_offset_animdata(t->scene, seq, seq->start - old_start);
}
seq_prev= seq;
@@ -2372,16 +2377,16 @@ void flushTransSeq(TransInfo *t)
/* need to do the overlap check in a new loop otherwise adjacent strips
* will not be updated and we'll get false positives */
seq_prev= NULL;
- for(a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
+ for (a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
tdsq= (TransDataSeq *)td->extra;
seq= tdsq->seq;
if (seq != seq_prev) {
- if(seq->depth==0) {
+ if (seq->depth==0) {
/* test overlap, displayes red outline */
seq->flag &= ~SEQ_OVERLAP;
- if( seq_test_overlap(seqbasep, seq) ) {
+ if ( seq_test_overlap(seqbasep, seq) ) {
seq->flag |= SEQ_OVERLAP;
}
}
@@ -2417,7 +2422,7 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f
td->ext= NULL; td->val= NULL;
- if(selected) {
+ if (selected) {
td->flag |= TD_SELECTED;
td->dist= 0.0;
}
@@ -2444,13 +2449,13 @@ static void createTransUVs(bContext *C, TransInfo *t)
int count=0, countsel=0;
int propmode = t->flag & T_PROP_EDIT;
- if(!ED_space_image_show_uvedit(sima, t->obedit)) return;
+ if (!ED_space_image_show_uvedit(sima, t->obedit)) return;
/* count */
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf)) {
+ if (!uvedit_face_visible(scene, ima, efa, tf)) {
BM_elem_flag_disable(efa, BM_ELEM_TAG);
continue;
}
@@ -2460,7 +2465,7 @@ static void createTransUVs(bContext *C, TransInfo *t)
if (uvedit_uv_selected(em, scene, l))
countsel++;
- if(propmode)
+ if (propmode)
count++;
}
}
@@ -2474,7 +2479,7 @@ static void createTransUVs(bContext *C, TransInfo *t)
* treated just as if they were 3d verts */
t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "TransObData2D(UV Editing)");
- if(sima->flag & SI_CLIP_UV)
+ if (sima->flag & SI_CLIP_UV)
t->flag |= T_CLIP_UV;
td= t->data;
@@ -2510,11 +2515,11 @@ void flushTransUVs(TransInfo *t)
invy= 1.0f/aspy;
/* flush to 2d vector from internally used 3d vector */
- for(a=0, td= t->data2d; a<t->total; a++, td++) {
+ for (a=0, td= t->data2d; a<t->total; a++, td++) {
td->loc2d[0]= td->loc[0]*invx;
td->loc2d[1]= td->loc[1]*invy;
- if((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
+ if ((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
td->loc2d[0]= (float)floor(width*td->loc2d[0] + 0.5f)/width;
td->loc2d[1]= (float)floor(height*td->loc2d[1] + 0.5f)/height;
}
@@ -2531,36 +2536,36 @@ int clipUVTransform(TransInfo *t, float *vec, int resize)
min[0]= min[1]= 0.0f;
max[0]= aspx; max[1]= aspy;
- for(a=0, td= t->data; a<t->total; a++, td++) {
+ for (a=0, td= t->data; a<t->total; a++, td++) {
DO_MINMAX2(td->loc, min, max);
}
- if(resize) {
- if(min[0] < 0.0f && t->center[0] > 0.0f && t->center[0] < aspx*0.5f)
+ if (resize) {
+ if (min[0] < 0.0f && t->center[0] > 0.0f && t->center[0] < aspx*0.5f)
vec[0] *= t->center[0]/(t->center[0] - min[0]);
- else if(max[0] > aspx && t->center[0] < aspx)
+ else if (max[0] > aspx && t->center[0] < aspx)
vec[0] *= (t->center[0] - aspx)/(t->center[0] - max[0]);
else
clipx= 0;
- if(min[1] < 0.0f && t->center[1] > 0.0f && t->center[1] < aspy*0.5f)
+ if (min[1] < 0.0f && t->center[1] > 0.0f && t->center[1] < aspy*0.5f)
vec[1] *= t->center[1]/(t->center[1] - min[1]);
- else if(max[1] > aspy && t->center[1] < aspy)
+ else if (max[1] > aspy && t->center[1] < aspy)
vec[1] *= (t->center[1] - aspy)/(t->center[1] - max[1]);
else
clipy= 0;
}
else {
- if(min[0] < 0.0f)
+ if (min[0] < 0.0f)
vec[0] -= min[0];
- else if(max[0] > aspx)
+ else if (max[0] > aspx)
vec[0] -= max[0]-aspx;
else
clipx= 0;
- if(min[1] < 0.0f)
+ if (min[1] < 0.0f)
vec[1] -= min[1];
- else if(max[1] > aspy)
+ else if (max[1] > aspy)
vec[1] -= max[1]-aspy;
else
clipy= 0;
@@ -3713,9 +3718,9 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv
td2d->loc2d= (bezts + bezm->newIndex)->vec[1];
/* if only control point is selected, the handle pointers need to be updated as well */
- if(td2d->h1)
+ if (td2d->h1)
td2d->h1= (bezts + bezm->newIndex)->vec[0];
- if(td2d->h2)
+ if (td2d->h2)
td2d->h2= (bezts + bezm->newIndex)->vec[2];
adjusted[j] = 1;
@@ -3723,7 +3728,7 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv
/* the handle type pointer has to be updated too */
if (adjusted[j] && td->flag & TD_BEZTRIPLE && td->hdata) {
- if(bezm->swapHs == 1) {
+ if (bezm->swapHs == 1) {
td->hdata->h1 = &(bezts + bezm->newIndex)->h2;
td->hdata->h2 = &(bezts + bezm->newIndex)->h1;
}
@@ -3840,7 +3845,7 @@ void flushTransGraphData(TransInfo *t)
/* ******************* Sequencer Transform data ******************* */
/* This function applies the rules for transforming a strip so duplicate
- * checks dont need to be added in multiple places.
+ * checks don't need to be added in multiple places.
*
* recursive, count and flag MUST be set.
*
@@ -3892,7 +3897,8 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
else *flag |= SEQ_LEFTSEL;
}
}
- } else {
+ }
+ else {
t->frame_side= 'B';
@@ -3912,7 +3918,8 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
if ((seq->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) == (SEQ_LEFTSEL|SEQ_RIGHTSEL)) {
*flag= seq->flag;
*count= 2; /* we need 2 transdata's */
- } else {
+ }
+ else {
*flag= seq->flag;
*count= 1; /* selected or with a handle selected */
}
@@ -3920,7 +3927,7 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
/* Recursive */
if ((seq->type == SEQ_META) && ((seq->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) == 0)) {
- /* if any handles are selected, dont recurse */
+ /* if any handles are selected, don't recurse */
*recursive = 1;
}
else {
@@ -3938,8 +3945,8 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
#else
if (seq->type == SEQ_META) {
/* Meta's can only directly be moved between channels since they
- * dont have their start and length set directly (children affect that)
- * since this Meta is nested we dont need any of its data infact.
+ * don't have their start and length set directly (children affect that)
+ * since this Meta is nested we don't need any of its data infact.
* calc_sequence() will update its settings when run on the toplevel meta */
*flag= 0;
*count= 0;
@@ -4088,7 +4095,7 @@ static void freeSeqData(TransInfo *t)
{
Editing *ed= seq_give_editing(t->scene, FALSE);
- if(ed != NULL) {
+ if (ed != NULL) {
ListBase *seqbasep= ed->seqbasep;
TransData *td= t->data;
int a;
@@ -4105,7 +4112,7 @@ static void freeSeqData(TransInfo *t)
#if 0 // default 2.4 behavior
/* flush to 2d vector from internally used 3d vector */
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) {
seq= ((TransDataSeq *)td->extra)->seq;
shuffle_seq(seqbasep, seq);
@@ -4118,7 +4125,7 @@ static void freeSeqData(TransInfo *t)
{
int overlap= 0;
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
seq_prev= NULL;
seq= ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) {
@@ -4128,18 +4135,18 @@ static void freeSeqData(TransInfo *t)
seq_prev= seq;
}
- if(overlap) {
+ if (overlap) {
int has_effect= 0;
- for(seq= seqbasep->first; seq; seq= seq->next)
+ for (seq= seqbasep->first; seq; seq= seq->next)
seq->tmp= NULL;
td= t->data;
seq_prev= NULL;
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
seq= ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev)) {
/* check effects strips, we cant change their time */
- if((seq->type & SEQ_EFFECT) && seq->seq1) {
+ if ((seq->type & SEQ_EFFECT) && seq->seq1) {
has_effect= TRUE;
}
else {
@@ -4151,14 +4158,14 @@ static void freeSeqData(TransInfo *t)
shuffle_seq_time(seqbasep, t->scene);
- if(has_effect) {
+ if (has_effect) {
/* update effects strips based on strips just moved in time */
td= t->data;
seq_prev= NULL;
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
seq= ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev)) {
- if((seq->type & SEQ_EFFECT) && seq->seq1) {
+ if ((seq->type & SEQ_EFFECT) && seq->seq1) {
calc_sequence(t->scene, seq);
}
}
@@ -4167,11 +4174,11 @@ static void freeSeqData(TransInfo *t)
/* now if any effects _still_ overlap, we need to move them up */
td= t->data;
seq_prev= NULL;
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
seq= ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev)) {
- if((seq->type & SEQ_EFFECT) && seq->seq1) {
- if(seq_test_overlap(seqbasep, seq)) {
+ if ((seq->type & SEQ_EFFECT) && seq->seq1) {
+ if (seq_test_overlap(seqbasep, seq)) {
shuffle_seq(seqbasep, seq, t->scene);
}
}
@@ -4183,9 +4190,9 @@ static void freeSeqData(TransInfo *t)
}
#endif
- for(seq= seqbasep->first; seq; seq= seq->next) {
+ for (seq= seqbasep->first; seq; seq= seq->next) {
/* We might want to build a list of effects that need to be updated during transform */
- if(seq->type & SEQ_EFFECT) {
+ if (seq->type & SEQ_EFFECT) {
if (seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(t->scene, seq);
else if (seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(t->scene, seq);
else if (seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(t->scene, seq);
@@ -4196,7 +4203,7 @@ static void freeSeqData(TransInfo *t)
}
else {
/* Cancelled, need to update the strips display */
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
seq= ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev) && (seq->depth==0)) {
calc_sequence_disp(t->scene, seq);
@@ -4206,9 +4213,9 @@ static void freeSeqData(TransInfo *t)
}
}
- if (t->customData) {
+ if ((t->customData != NULL) && (t->flag & T_FREE_CUSTOMDATA)) {
MEM_freeN(t->customData);
- t->customData= NULL;
+ t->customData = NULL;
}
if (t->data) {
MEM_freeN(t->data); // XXX postTrans usually does this
@@ -4252,12 +4259,12 @@ static void createTransSeqData(bContext *C, TransInfo *t)
#ifdef XXX_DURIAN_ANIM_TX_HACK
{
Sequence *seq;
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
/* hack */
- if((seq->flag & SELECT)==0 && seq->type & SEQ_EFFECT) {
+ if ((seq->flag & SELECT)==0 && seq->type & SEQ_EFFECT) {
Sequence *seq_user;
int i;
- for(i=0; i<3; i++) {
+ for (i=0; i<3; i++) {
seq_user= *((&seq->seq1) + i);
if ( seq_user && (seq_user->flag & SELECT) &&
!(seq_user->flag & SEQ_LOCK) &&
@@ -4283,7 +4290,8 @@ static void createTransSeqData(bContext *C, TransInfo *t)
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransSeq TransData");
td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransSeq TransData2D");
- tdsq = t->customData= MEM_callocN(t->total*sizeof(TransDataSeq), "TransSeq TransDataSeq");
+ tdsq = t->customData = MEM_callocN(t->total*sizeof(TransDataSeq), "TransSeq TransDataSeq");
+ t->flag |= T_FREE_CUSTOMDATA;
@@ -4459,7 +4467,7 @@ static void set_trans_object_base_flags(TransInfo *t)
Base *base;
/* don't do it if we're not actually going to recalculate anything */
- if(t->mode == TFM_DUMMY)
+ if (t->mode == TFM_DUMMY)
return;
/* makes sure base flags and object flags are identical */
@@ -4467,22 +4475,22 @@ static void set_trans_object_base_flags(TransInfo *t)
/* handle pending update events, otherwise they got copied below */
for (base= scene->base.first; base; base= base->next) {
- if(base->object->recalc)
+ if (base->object->recalc)
object_handle_update(t->scene, base->object);
}
for (base= scene->base.first; base; base= base->next) {
base->flag &= ~BA_WAS_SEL;
- if(TESTBASELIB_BGMODE(v3d, scene, base)) {
+ if (TESTBASELIB_BGMODE(v3d, scene, base)) {
Object *ob= base->object;
Object *parsel= ob->parent;
/* if parent selected, deselect */
- while(parsel) {
- if(parsel->flag & SELECT) {
+ while (parsel) {
+ if (parsel->flag & SELECT) {
Base *parbase = object_in_scene(parsel, scene);
- if(parbase) { /* in rare cases this can fail */
+ if (parbase) { /* in rare cases this can fail */
if TESTBASELIB_BGMODE(v3d, scene, parbase) {
break;
}
@@ -4491,12 +4499,13 @@ 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;
- } else {
+ }
+ else {
base->flag &= ~SELECT;
base->flag |= BA_WAS_SEL;
}
@@ -4512,9 +4521,9 @@ static void set_trans_object_base_flags(TransInfo *t)
/* and we store them temporal in base (only used for transform code) */
/* this because after doing updates, the object->recalc is cleared */
for (base= scene->base.first; base; base= base->next) {
- if(base->object->recalc & OB_RECALC_OB)
+ if (base->object->recalc & OB_RECALC_OB)
base->flag |= BA_HAS_RECALC_OB;
- if(base->object->recalc & OB_RECALC_DATA)
+ if (base->object->recalc & OB_RECALC_DATA)
base->flag |= BA_HAS_RECALC_DATA;
}
}
@@ -4548,11 +4557,11 @@ static int count_proportional_objects(TransInfo *t)
{
/* mark all parents */
for (base= scene->base.first; base; base= base->next) {
- if(TESTBASELIB_BGMODE(v3d, scene, base)) {
+ if (TESTBASELIB_BGMODE(v3d, scene, base)) {
Object *parent = base->object->parent;
/* flag all parents */
- while(parent) {
+ while (parent) {
parent->flag |= BA_TRANSFORM_PARENT;
parent = parent->parent;
}
@@ -4592,9 +4601,9 @@ static int count_proportional_objects(TransInfo *t)
/* and we store them temporal in base (only used for transform code) */
/* this because after doing updates, the object->recalc is cleared */
for (base= scene->base.first; base; base= base->next) {
- if(base->object->recalc & OB_RECALC_OB)
+ if (base->object->recalc & OB_RECALC_OB)
base->flag |= BA_HAS_RECALC_OB;
- if(base->object->recalc & OB_RECALC_DATA)
+ if (base->object->recalc & OB_RECALC_DATA)
base->flag |= BA_HAS_RECALC_DATA;
}
@@ -4608,7 +4617,7 @@ static void clear_trans_object_base_flags(TransInfo *t)
for (base= sce->base.first; base; base = base->next)
{
- if(base->flag & BA_WAS_SEL)
+ if (base->flag & BA_WAS_SEL)
base->flag |= SELECT;
base->flag &= ~(BA_WAS_SEL|BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA|BA_TEMP_TAG|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT);
@@ -4733,7 +4742,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
float cfra= (float)CFRA;
short flag= 0;
- /* flag is initialised from UserPref keyframing settings
+ /* flag is initialized from UserPref keyframing settings
* - special exception for targetless IK - INSERTKEY_MATRIX keyframes should get
* visual keyframes even if flag not set, as it's not that useful otherwise
* (for quick animation recording)
@@ -4869,7 +4878,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (t->obedit) {
if (canceled==0) {
/* we need to delete the temporary faces before automerging */
- if(t->mode == TFM_EDGE_SLIDE){
+ if (t->mode == TFM_EDGE_SLIDE) {
SlideData *sld = t->customData;
/* handle multires re-projection, done
@@ -4911,8 +4920,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* cant use , TFM_TIME_EXTEND
* for some reason EXTEND is changed into TRANSLATE, so use frame_side instead */
- if(t->mode == TFM_SEQ_SLIDE) {
- if(t->frame_side == 'B')
+ if (t->mode == TFM_SEQ_SLIDE) {
+ if (t->frame_side == 'B')
ED_markers_post_apply_transform(&t->scene->markers, t->scene, TFM_TIME_TRANSLATE, t->values[0], t->frame_side);
}
else if (ELEM(t->frame_side, 'L', 'R')) {
@@ -4925,7 +4934,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
SpaceNode *snode= (SpaceNode *)t->sa->spacedata.first;
ED_node_update_hierarchy(C, snode->edittree);
- if(canceled == 0)
+ if (canceled == 0)
ED_node_link_insert(t->sa);
/* clear link line */
@@ -4935,7 +4944,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
SpaceClip *sc= t->sa->spacedata.first;
MovieClip *clip= ED_space_clip(sc);
- if(t->scene->nodetree) {
+ if (t->scene->nodetree) {
/* tracks can be used for stabilization nodes,
* flush update for such nodes */
nodeUpdateID(t->scene->nodetree, &clip->id);
@@ -5105,7 +5114,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
* Note: if the refresh is really needed after cancel then some way
* has to be added to not update handle types (see bug 22289).
*/
- if(!canceled)
+ if (!canceled)
ANIM_editkeyframes_refresh(&ac);
}
else if (t->spacetype == SPACE_NLA) {
@@ -5157,7 +5166,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
ob= t->poseobj;
arm= ob->data;
- if((t->flag & T_AUTOIK) && (t->options & CTX_AUTOCONFIRM)) {
+ if ((t->flag & T_AUTOIK) && (t->options & CTX_AUTOCONFIRM)) {
/* when running transform non-interactively (operator exec),
* we need to update the pose otherwise no updates get called during
* transform and the auto-ik is not applied. see [#26164] */
@@ -5176,7 +5185,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* not forget to clear the auto flag */
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
bKinematicConstraint *data= has_targetless_ik(pchan);
- if(data) data->flag &= ~CONSTRAINT_IK_AUTO;
+ if (data) data->flag &= ~CONSTRAINT_IK_AUTO;
}
}
@@ -5221,8 +5230,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* flag object caches as outdated */
BKE_ptcache_ids_from_object(&pidlist, ob, t->scene, MAX_DUPLI_RECUR);
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
+ 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;
}
BLI_freelistN(&pidlist);
@@ -5256,7 +5265,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* recalculating the frame positions means we loose our original transform if its not auto-keyed [#24451]
* this hack re-applies it, which is annoying, only alternatives are...
- * - dont recalc paths.
+ * - don't recalc paths.
* - have an object_handle_update() which gives is the new transform without touching the objects.
* - only recalc paths on auto-keying.
* - ED_objects_recalculate_paths could backup/restore transforms.
@@ -5271,7 +5280,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
#if 0 // TRANSFORM_FIX_ME
- if(resetslowpar)
+ if (resetslowpar)
reset_slowparents();
#endif
}
@@ -5287,7 +5296,7 @@ static void createTransObject(bContext *C, TransInfo *t)
/* count */
t->total= CTX_DATA_COUNT(C, selected_objects);
- if(!t->total) {
+ if (!t->total) {
/* clear here, main transform function escapes too */
clear_trans_object_base_flags(t);
return;
@@ -5391,7 +5400,7 @@ static void createTransNodeData(bContext *C, TransInfo *t)
SpaceNode *snode= t->sa->spacedata.first;
bNode *node;
- if(!snode->edittree) {
+ if (!snode->edittree) {
t->total= 0;
return;
}
@@ -5446,13 +5455,14 @@ static void markerToTransDataInit(TransData *td, TransData2D *td2d,
tdt->mode = transDataTracking_ModeTracks;
- if(anchor) {
+ if (anchor) {
td2d->loc[0] = rel[0]; /* hold original location */
td2d->loc[1] = rel[1];
tdt->loc= loc;
td2d->loc2d = loc; /* current location */
- } else {
+ }
+ else {
td2d->loc[0] = loc[0]; /* hold original location */
td2d->loc[1] = loc[1];
@@ -5466,8 +5476,8 @@ static void markerToTransDataInit(TransData *td, TransData2D *td2d,
tdt->markersnr= track->markersnr;
tdt->markers= track->markers;
- if(rel) {
- if(!anchor) {
+ if (rel) {
+ if (!anchor) {
td2d->loc[0]+= rel[0];
td2d->loc[1]+= rel[1];
}
@@ -5475,7 +5485,7 @@ static void markerToTransDataInit(TransData *td, TransData2D *td2d,
copy_v2_v2(tdt->srelative, rel);
}
- if(off)
+ if (off)
copy_v2_v2(tdt->soffset, off);
td->flag = 0;
@@ -5505,15 +5515,15 @@ static void trackToTransData(SpaceClip *sc, TransData *td, TransData2D *td2d,
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_POINT, track->offset, marker->pos, track->offset);
- if(track->flag&SELECT)
+ if (track->flag&SELECT)
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_POINT, marker->pos, NULL, NULL);
- if(track->pat_flag&SELECT) {
+ if (track->pat_flag&SELECT) {
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_PAT, track->pat_min, marker->pos, NULL);
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_PAT, track->pat_max, marker->pos, NULL);
}
- if(track->search_flag&SELECT) {
+ if (track->search_flag&SELECT) {
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_SEARCH, track->search_min, marker->pos, NULL);
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_SEARCH, track->search_max, marker->pos, NULL);
}
@@ -5523,8 +5533,8 @@ static void transDataTrackingFree(TransInfo *t)
{
TransDataTracking *tdt= t->customData;
- if(tdt) {
- if(tdt->smarkers) MEM_freeN(tdt->smarkers);
+ if (tdt) {
+ if (tdt->smarkers) MEM_freeN(tdt->smarkers);
MEM_freeN(tdt);
}
}
@@ -5545,21 +5555,21 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
t->total = 0;
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
marker= BKE_tracking_get_marker(track, framenr);
t->total++; /* offset */
- if(track->flag&SELECT) t->total++;
- if(track->pat_flag&SELECT) t->total+= 2;
- if(track->search_flag&SELECT) t->total+= 2;
+ if (track->flag&SELECT) t->total++;
+ if (track->pat_flag&SELECT) t->total+= 2;
+ if (track->search_flag&SELECT) t->total+= 2;
}
track = track->next;
}
- if(t->total==0)
+ if (t->total==0)
return;
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransTracking TransData");
@@ -5570,8 +5580,8 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
/* create actual data */
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
marker= BKE_tracking_get_marker(track, framenr);
trackToTransData(sc, td, td2d, tdt, track);
@@ -5581,17 +5591,17 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
td2d++;
tdt++;
- if((marker->flag&MARKER_DISABLED)==0) {
- if(track->flag&SELECT) {td++; td2d++; tdt++;}
- if(track->pat_flag&SELECT) {td+= 2; td2d+= 2;tdt+=2;}
+ if ((marker->flag&MARKER_DISABLED)==0) {
+ if (track->flag&SELECT) {td++; td2d++; tdt++;}
+ if (track->pat_flag&SELECT) {td+= 2; td2d+= 2;tdt+=2;}
}
- if(track->search_flag&SELECT) {
+ if (track->search_flag&SELECT) {
td+= 2;
td2d+= 2;
tdt+= 2;
- if(marker->flag&MARKER_DISABLED) {
+ if (marker->flag&MARKER_DISABLED) {
td+= 3;
td2d+= 3;
tdt+= 3;
@@ -5659,19 +5669,19 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t)
t->total = 0;
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
- for(i = 1; i < track->markersnr; i++) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+ for (i = 1; i < track->markersnr; i++) {
marker = &track->markers[i];
prev_marker = &track->markers[i-1];
- if((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
+ if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
continue;
- if(marker->flag & MARKER_GRAPH_SEL_X)
+ if (marker->flag & MARKER_GRAPH_SEL_X)
t->total += 1;
- if(marker->flag & MARKER_GRAPH_SEL_Y)
+ if (marker->flag & MARKER_GRAPH_SEL_Y)
t->total += 1;
}
}
@@ -5679,7 +5689,7 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t)
track = track->next;
}
- if(t->total==0)
+ if (t->total==0)
return;
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransTracking TransData");
@@ -5690,23 +5700,23 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t)
/* create actual data */
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
- for(i = 1; i < track->markersnr; i++) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+ for (i = 1; i < track->markersnr; i++) {
marker = &track->markers[i];
prev_marker = &track->markers[i-1];
- if((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
+ if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
continue;
- if(marker->flag & MARKER_GRAPH_SEL_X) {
+ if (marker->flag & MARKER_GRAPH_SEL_X) {
markerToTransCurveDataInit(td, td2d, tdt, marker, &track->markers[i-1], 0, width);
td += 1;
td2d += 1;
tdt += 1;
}
- if(marker->flag & MARKER_GRAPH_SEL_Y) {
+ if (marker->flag & MARKER_GRAPH_SEL_Y) {
markerToTransCurveDataInit(td, td2d, tdt, marker, &track->markers[i-1], 1, height);
td += 1;
@@ -5728,13 +5738,13 @@ static void createTransTrackingData(bContext *C, TransInfo *t)
t->total = 0;
- if(!clip || !BKE_movieclip_has_frame(clip, &sc->user))
+ if (!clip || !BKE_movieclip_has_frame(clip, &sc->user))
return;
- if(!ELEM(t->mode, TFM_RESIZE, TFM_TRANSLATION))
+ if (!ELEM(t->mode, TFM_RESIZE, TFM_TRANSLATION))
return;
- if(ar->regiontype == RGN_TYPE_PREVIEW) {
+ if (ar->regiontype == RGN_TYPE_PREVIEW) {
/* transformation was called from graph editor */
createTransTrackingCurvesData(C, t);
}
@@ -5753,37 +5763,37 @@ static void cancelTransTracking(TransInfo *t)
MovieTrackingMarker *marker;
int a, framenr = sc->user.framenr;
- if(tdt->mode == transDataTracking_ModeTracks) {
+ if (tdt->mode == transDataTracking_ModeTracks) {
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
marker = BKE_tracking_get_marker(track, framenr);
marker->flag = tdt->flag;
tdt++;
- if(track->flag&SELECT) tdt++;
- if(track->pat_flag&SELECT) tdt += 2;
- if(track->search_flag&SELECT) tdt += 2;
+ if (track->flag&SELECT) tdt++;
+ if (track->pat_flag&SELECT) tdt += 2;
+ if (track->search_flag&SELECT) tdt += 2;
}
track = track->next;
}
}
- else if(tdt->mode == transDataTracking_ModeCurves) {
+ else if (tdt->mode == transDataTracking_ModeCurves) {
MovieTrackingMarker *prev_marker;
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
- for(a = 1; a < track->markersnr; a++) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+ for (a = 1; a < track->markersnr; a++) {
marker = &track->markers[a];
prev_marker = &track->markers[a-1];
- if((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
+ if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
continue;
- if(marker->flag & (MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y)) {
+ if (marker->flag & (MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y)) {
marker->flag = tdt->flag;
}
}
@@ -5801,19 +5811,19 @@ void flushTransTracking(TransInfo *t)
TransDataTracking *tdt;
int a;
- if(t->state == TRANS_CANCEL)
+ if (t->state == TRANS_CANCEL)
cancelTransTracking(t);
/* flush to 2d vector from internally used 3d vector */
- for(a=0, td= t->data, td2d= t->data2d, tdt= t->customData; a<t->total; a++, td2d++, td++, tdt++) {
- if(tdt->mode == transDataTracking_ModeTracks) {
- if(t->flag&T_ALT_TRANSFORM) {
- if(tdt->area==TRACK_AREA_POINT && tdt->relative) {
+ for (a=0, td= t->data, td2d= t->data2d, tdt= t->customData; a<t->total; a++, td2d++, td++, tdt++) {
+ if (tdt->mode == transDataTracking_ModeTracks) {
+ if (t->flag&T_ALT_TRANSFORM) {
+ if (tdt->area==TRACK_AREA_POINT && tdt->relative) {
float d[2], d2[2];
- if(!tdt->smarkers) {
+ if (!tdt->smarkers) {
tdt->smarkers= MEM_callocN(sizeof(*tdt->smarkers)*tdt->markersnr, "flushTransTracking markers");
- for(a= 0; a<tdt->markersnr; a++)
+ for (a= 0; a<tdt->markersnr; a++)
copy_v2_v2(tdt->smarkers[a], tdt->markers[a].pos);
}
@@ -5822,22 +5832,22 @@ void flushTransTracking(TransInfo *t)
sub_v2_v2v2(d2, td2d->loc, tdt->srelative);
- for(a= 0; a<tdt->markersnr; a++)
+ for (a= 0; a<tdt->markersnr; a++)
add_v2_v2v2(tdt->markers[a].pos, tdt->smarkers[a], d2);
negate_v2_v2(td2d->loc2d, d);
}
}
- if(tdt->area!=TRACK_AREA_POINT || tdt->relative==0) {
+ if (tdt->area!=TRACK_AREA_POINT || tdt->relative==0) {
td2d->loc2d[0] = td2d->loc[0];
td2d->loc2d[1] = td2d->loc[1];
- if(tdt->relative)
+ if (tdt->relative)
sub_v2_v2(td2d->loc2d, tdt->relative);
}
}
- else if(tdt->mode == transDataTracking_ModeCurves) {
+ else if (tdt->mode == transDataTracking_ModeCurves) {
td2d->loc2d[tdt->coord] = tdt->prev_pos[tdt->coord] + td2d->loc[1] * tdt->scale;
}
}
@@ -5856,7 +5866,7 @@ void createTransData(bContext *C, TransInfo *t)
t->ext = NULL;
t->flag |= T_EDIT;
createTransEdge(t);
- if(t->data && t->flag & T_PROP_EDIT) {
+ if (t->data && t->flag & T_PROP_EDIT) {
sort_trans_data(t); // makes selected become first in array
set_prop_dist(t, 1);
sort_trans_data_dist(t);
@@ -5869,7 +5879,7 @@ void createTransData(bContext *C, TransInfo *t)
else if (t->spacetype == SPACE_IMAGE) {
t->flag |= T_POINTS|T_2D_EDIT;
createTransUVs(C, t);
- if(t->data && (t->flag & T_PROP_EDIT)) {
+ if (t->data && (t->flag & T_PROP_EDIT)) {
sort_trans_data(t); // makes selected become first in array
set_prop_dist(t, 1);
sort_trans_data_dist(t);
@@ -5899,7 +5909,7 @@ void createTransData(bContext *C, TransInfo *t)
}
#endif
}
- else if(t->spacetype == SPACE_NODE) {
+ else if (t->spacetype == SPACE_NODE) {
t->flag |= T_2D_EDIT|T_POINTS;
createTransNodeData(C, t);
if (t->data && (t->flag & T_PROP_EDIT)) {
@@ -5936,7 +5946,7 @@ void createTransData(bContext *C, TransInfo *t)
t->flag |= T_EDIT|T_POINTS;
- if(t->data && t->flag & T_PROP_EDIT) {
+ if (t->data && t->flag & T_PROP_EDIT) {
if (ELEM(t->obedit->type, OB_CURVE, OB_MESH)) {
sort_trans_data(t); // makes selected become first in array
set_prop_dist(t, 0);
@@ -5950,7 +5960,7 @@ void createTransData(bContext *C, TransInfo *t)
}
/* exception... hackish, we want bonesize to use bone orientation matrix (ton) */
- if(t->mode==TFM_BONESIZE) {
+ if (t->mode==TFM_BONESIZE) {
t->flag &= ~(T_EDIT|T_POINTS);
t->flag |= T_POSE;
t->poseobj = ob; /* <- tsk tsk, this is going to give issues one day */
@@ -5965,11 +5975,11 @@ void createTransData(bContext *C, TransInfo *t)
/* important that ob_armature can be set even when its not selected [#23412]
* lines below just check is also visible */
Object *ob_armature= modifiers_isDeformedByArmature(ob);
- if(ob_armature && ob_armature->mode & OB_MODE_POSE) {
+ if (ob_armature && ob_armature->mode & OB_MODE_POSE) {
Base *base_arm= object_in_scene(ob_armature, t->scene);
- if(base_arm) {
+ if (base_arm) {
View3D *v3d = t->view;
- if(BASE_VISIBLE(v3d, base_arm)) {
+ if (BASE_VISIBLE(v3d, base_arm)) {
createTransPose(t, ob_armature);
}
}
@@ -5981,7 +5991,7 @@ void createTransData(bContext *C, TransInfo *t)
createTransParticleVerts(C, t);
t->flag |= T_POINTS;
- if(t->data && t->flag & T_PROP_EDIT) {
+ if (t->data && t->flag & T_PROP_EDIT) {
sort_trans_data(t); // makes selected become first in array
set_prop_dist(t, 1);
sort_trans_data_dist(t);
@@ -5992,13 +6002,13 @@ void createTransData(bContext *C, TransInfo *t)
* transform ops redo clears sculpt/project undo stack.
*
* Could use 'OB_MODE_ALL_PAINT' since there are key conflicts,
- * transform + paint isnt well supported. */
+ * transform + paint isn't well supported. */
}
else {
createTransObject(C, t);
t->flag |= T_OBJECT;
- if(t->data && t->flag & T_PROP_EDIT) {
+ if (t->data && t->flag & T_PROP_EDIT) {
// selected objects are already first, no need to presort
set_prop_dist(t, 1);
sort_trans_data_dist(t);
@@ -6008,7 +6018,7 @@ void createTransData(bContext *C, TransInfo *t)
{
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 d24081ae472..8e22ccd943d 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -50,6 +50,11 @@
#include "DNA_modifier_types.h"
#include "DNA_movieclip_types.h"
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_rand.h"
+#include "BLI_utildefines.h"
+
#include "RNA_access.h"
//#include "BIF_screen.h"
@@ -91,11 +96,6 @@
//#include "BDR_unwrapper.h"
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_rand.h"
-#include "BLI_utildefines.h"
-
#include "WM_types.h"
#include "WM_api.h"
@@ -107,8 +107,6 @@
#include "transform.h"
-extern ListBase editelems;
-
/* ************************** Functions *************************** */
void getViewVector(TransInfo *t, float coord[3], float vec[3])
@@ -149,17 +147,17 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
- if(mmd->flag & MOD_MIR_CLIPPING) {
+ if (mmd->flag & MOD_MIR_CLIPPING) {
axis = 0;
- if(mmd->flag & MOD_MIR_AXIS_X) {
+ if (mmd->flag & MOD_MIR_AXIS_X) {
axis |= 1;
tolerance[0] = mmd->tolerance;
}
- if(mmd->flag & MOD_MIR_AXIS_Y) {
+ if (mmd->flag & MOD_MIR_AXIS_Y) {
axis |= 2;
tolerance[1] = mmd->tolerance;
}
- if(mmd->flag & MOD_MIR_AXIS_Z) {
+ if (mmd->flag & MOD_MIR_AXIS_Z) {
axis |= 4;
tolerance[2] = mmd->tolerance;
}
@@ -176,7 +174,7 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
invert_m4_m4(imtx, mtx);
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
int clip;
float loc[3], iloc[3];
@@ -197,8 +195,8 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
}
clip = 0;
- if(axis & 1) {
- if(fabsf(iloc[0])<=tolerance[0] ||
+ if (axis & 1) {
+ if (fabsf(iloc[0])<=tolerance[0] ||
loc[0]*iloc[0]<0.0f)
{
loc[0]= 0.0f;
@@ -206,16 +204,16 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
}
}
- if(axis & 2) {
- if(fabs(iloc[1])<=tolerance[1] ||
+ if (axis & 2) {
+ if (fabs(iloc[1])<=tolerance[1] ||
loc[1]*iloc[1]<0.0f)
{
loc[1]= 0.0f;
clip = 1;
}
}
- if(axis & 4) {
- if(fabs(iloc[2])<=tolerance[2] ||
+ if (axis & 4) {
+ if (fabs(iloc[2])<=tolerance[2] ||
loc[2]*iloc[2]<0.0f)
{
loc[2]= 0.0f;
@@ -243,7 +241,7 @@ static void editbmesh_apply_to_mirror(TransInfo *t)
BMVert *eve;
int i;
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
if (td->loc==NULL)
@@ -629,7 +627,7 @@ static void recalcData_image(TransInfo *t)
SpaceImage *sima= t->sa->spacedata.first;
flushTransUVs(t);
- if(sima->flag & SI_LIVE_UNWRAP)
+ if (sima->flag & SI_LIVE_UNWRAP)
ED_uvedit_live_unwrap_re_solve();
DAG_id_tag_update(t->obedit->data, 0);
@@ -647,18 +645,18 @@ static void recalcData_clip(TransInfo *t)
flushTransTracking(t);
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
if (t->mode == TFM_TRANSLATION) {
- if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
+ if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
BKE_tracking_clamp_track(track, CLAMP_PAT_POS);
- if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
+ if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
BKE_tracking_clamp_track(track, CLAMP_SEARCH_POS);
}
else if (t->mode == TFM_RESIZE) {
- if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
+ if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
BKE_tracking_clamp_track(track, CLAMP_PAT_DIM);
- if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
+ if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
}
}
@@ -680,7 +678,7 @@ static void recalcData_view3d(TransInfo *t)
ListBase *nurbs= curve_editnurbs(cu);
Nurb *nu= nurbs->first;
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
clipMirrorModifier(t, t->obedit);
applyProject(t);
}
@@ -688,40 +686,40 @@ static void recalcData_view3d(TransInfo *t)
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
if (t->state == TRANS_CANCEL) {
- while(nu) {
+ while (nu) {
calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
nu= nu->next;
}
}
else {
/* Normal updating */
- while(nu) {
+ while (nu) {
test2DNurb(nu);
calchandlesNurb(nu);
nu= nu->next;
}
}
}
- else if(t->obedit->type==OB_LATTICE) {
+ else if (t->obedit->type==OB_LATTICE) {
Lattice *la= t->obedit->data;
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
applyProject(t);
}
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
- if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
+ if (la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
}
else if (t->obedit->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(t->obedit);
/* mirror modifier clipping? */
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
/* apply clipping after so we never project past the clip plane [#25423] */
applyProject(t);
clipMirrorModifier(t, t->obedit);
}
- if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
+ if ((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
editbmesh_apply_to_mirror(t);
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
@@ -729,14 +727,14 @@ static void recalcData_view3d(TransInfo *t)
EDBM_RecalcNormals(em);
BMEdit_RecalcTessellation(em);
}
- else if(t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
+ else if (t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
bArmature *arm= t->obedit->data;
ListBase *edbo = arm->edbo;
EditBone *ebo;
TransData *td = t->data;
int i;
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
applyProject(t);
}
@@ -747,27 +745,27 @@ static void recalcData_view3d(TransInfo *t)
/* If this bone has a parent tip that has been moved */
if (ebo->parent->flag & BONE_TIPSEL) {
copy_v3_v3 (ebo->head, ebo->parent->tail);
- if(t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail;
+ if (t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail;
}
/* If this bone has a parent tip that has NOT been moved */
- else{
+ else {
copy_v3_v3 (ebo->parent->tail, ebo->head);
- if(t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head;
+ if (t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head;
}
}
/* on extrude bones, oldlength==0.0f, so we scale radius of points */
ebo->length= len_v3v3(ebo->head, ebo->tail);
- if(ebo->oldlength==0.0f) {
+ if (ebo->oldlength==0.0f) {
ebo->rad_head= 0.25f*ebo->length;
ebo->rad_tail= 0.10f*ebo->length;
ebo->dist= 0.25f*ebo->length;
- if(ebo->parent) {
- if(ebo->rad_head > ebo->parent->rad_tail)
+ if (ebo->parent) {
+ if (ebo->rad_head > ebo->parent->rad_tail)
ebo->rad_head= ebo->parent->rad_tail;
}
}
- else if(t->mode!=TFM_BONE_ENVELOPE) {
+ else if (t->mode!=TFM_BONE_ENVELOPE) {
/* if bones change length, lets do that for the deform distance as well */
ebo->dist*= ebo->length/ebo->oldlength;
ebo->rad_head*= ebo->length/ebo->oldlength;
@@ -780,7 +778,7 @@ static void recalcData_view3d(TransInfo *t)
if (t->mode != TFM_BONE_ROLL)
{
/* fix roll */
- for(i = 0; i < t->total; i++, td++)
+ for (i = 0; i < t->total; i++, td++)
{
if (td->extra)
{
@@ -806,18 +804,18 @@ static void recalcData_view3d(TransInfo *t)
}
}
- if(arm->flag & ARM_MIRROR_EDIT)
+ if (arm->flag & ARM_MIRROR_EDIT)
transform_armature_mirror_update(t->obedit);
}
else {
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
applyProject(t);
}
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
}
}
- else if( (t->flag & T_POSE) && t->poseobj) {
+ else if ( (t->flag & T_POSE) && t->poseobj) {
Object *ob= t->poseobj;
bArmature *arm= ob->data;
@@ -842,8 +840,8 @@ static void recalcData_view3d(TransInfo *t)
else
where_is_pose(t->scene, ob);
}
- else if(base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, base->object)) {
- if(t->state != TRANS_CANCEL) {
+ else if (base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, base->object)) {
+ if (t->state != TRANS_CANCEL) {
applyProject(t);
}
flushTransParticles(t);
@@ -851,7 +849,7 @@ static void recalcData_view3d(TransInfo *t)
else {
int i;
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
applyProject(t);
}
@@ -967,8 +965,8 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
/* moving: is shown in drawobject() (transform color) */
// TRANSFORM_FIX_ME
-// if(obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
-// else if(G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
+// if (obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
+// else if (G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
// else G.moving= G_TRANSFORM_OBJ;
t->scene = sce;
@@ -1031,7 +1029,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
/* Assign the space type, some exceptions for running in different mode */
- if(sa == NULL) {
+ if (sa == NULL) {
/* background mode */
t->spacetype= SPACE_EMPTY;
}
@@ -1045,7 +1043,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
- if(t->spacetype == SPACE_VIEW3D)
+ if (t->spacetype == SPACE_VIEW3D)
{
View3D *v3d = sa->spacedata.first;
@@ -1059,7 +1057,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
v3d->twtype = 0;
}
- if(v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
+ 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"))
@@ -1076,16 +1074,16 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
/* exceptional case */
- if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
- if(ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
+ if (t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
+ if (ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
t->options |= CTX_NO_PET;
}
}
/* initialize UV transform from */
if (op && RNA_struct_find_property(op->ptr, "correct_uv")) {
- if(RNA_struct_property_is_set(op->ptr, "correct_uv")) {
- if(RNA_boolean_get(op->ptr, "correct_uv")) {
+ if (RNA_struct_property_is_set(op->ptr, "correct_uv")) {
+ if (RNA_boolean_get(op->ptr, "correct_uv")) {
t->settings->uvcalc_flag |= UVCALC_TRANSFORM_CORRECT;
}
else {
@@ -1098,24 +1096,24 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
}
- else if(t->spacetype==SPACE_IMAGE) {
+ else if (t->spacetype==SPACE_IMAGE) {
SpaceImage *sima = sa->spacedata.first;
// XXX for now, get View2D from the active region
t->view = &ar->v2d;
t->around = sima->around;
}
- else if(t->spacetype==SPACE_NODE) {
+ else if (t->spacetype==SPACE_NODE) {
// XXX for now, get View2D from the active region
t->view = &ar->v2d;
t->around = V3D_CENTER;
}
- else if(t->spacetype==SPACE_IPO) {
+ else if (t->spacetype==SPACE_IPO) {
SpaceIpo *sipo= sa->spacedata.first;
t->view = &ar->v2d;
t->around = sipo->around;
}
else {
- if(ar) {
+ if (ar) {
// XXX for now, get View2D from the active region
t->view = &ar->v2d;
// XXX for now, the center point is the midpoint of the data
@@ -1247,7 +1245,7 @@ void postTrans (bContext *C, TransInfo *t)
/* Can take over freeing t->data and data2d etc... */
t->customFree(t);
}
- else if (t->customData) {
+ else if ((t->customData != NULL) && (t->flag & T_FREE_CUSTOMDATA)) {
MEM_freeN(t->customData);
}
@@ -1256,7 +1254,7 @@ void postTrans (bContext *C, TransInfo *t)
int a;
/* free data malloced per trans-data */
- for(a=0, td= t->data; a<t->total; a++, td++) {
+ for (a=0, td= t->data; a<t->total; a++, td++) {
if (td->flag & TD_BEZTRIPLE)
MEM_freeN(td->hdata);
}
@@ -1271,12 +1269,12 @@ void postTrans (bContext *C, TransInfo *t)
t->data2d= NULL;
}
- if(t->spacetype==SPACE_IMAGE) {
+ if (t->spacetype==SPACE_IMAGE) {
SpaceImage *sima= t->sa->spacedata.first;
- if(sima->flag & SI_LIVE_UNWRAP)
+ if (sima->flag & SI_LIVE_UNWRAP)
ED_uvedit_live_unwrap_end(t->state == TRANS_CANCEL);
}
- else if(t->spacetype==SPACE_VIEW3D) {
+ else if (t->spacetype==SPACE_VIEW3D) {
View3D *v3d = t->sa->spacedata.first;
/* restore manipulator */
if (t->flag & T_MODAL) {
@@ -1320,10 +1318,10 @@ static void restoreElement(TransData *td)
if (td->ext->rot) {
copy_v3_v3(td->ext->rot, td->ext->irot);
}
- if(td->ext->rotAngle) {
+ if (td->ext->rotAngle) {
*td->ext->rotAngle= td->ext->irotAngle;
}
- if(td->ext->rotAxis) {
+ if (td->ext->rotAxis) {
copy_v3_v3(td->ext->rotAxis, td->ext->irotAxis);
}
/* XXX, drotAngle & drotAxis not used yet */
@@ -1407,7 +1405,7 @@ void calculateCenterCursor2D(TransInfo *t)
float aspx=1.0, aspy=1.0;
float *cursor= NULL;
- if(t->spacetype==SPACE_IMAGE) {
+ if (t->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)t->sa->spacedata.first;
/* only space supported right now but may change */
ED_space_image_uv_aspect(sima, &aspx, &aspy);
@@ -1440,7 +1438,7 @@ void calculateCenterMedian(TransInfo *t)
int total = 0;
int i;
- for(i = 0; i < t->total; i++) {
+ for (i = 0; i < t->total; i++) {
if (t->data[i].flag & TD_SELECTED) {
if (!(t->data[i].flag & TD_NOCENTER))
{
@@ -1456,7 +1454,7 @@ void calculateCenterMedian(TransInfo *t)
break;
}
}
- if(i)
+ if (i)
mul_v3_fl(partial, 1.0f / total);
copy_v3_v3(t->center, partial);
@@ -1468,7 +1466,7 @@ void calculateCenterBound(TransInfo *t)
float max[3];
float min[3];
int i;
- for(i = 0; i < t->total; i++) {
+ for (i = 0; i < t->total; i++) {
if (i) {
if (t->data[i].flag & TD_SELECTED) {
if (!(t->data[i].flag & TD_NOCENTER))
@@ -1503,9 +1501,9 @@ void calculateCenter(TransInfo *t)
calculateCenterMedian(t);
break;
case V3D_CURSOR:
- if(t->spacetype==SPACE_IMAGE)
+ if (t->spacetype==SPACE_IMAGE)
calculateCenterCursor2D(t);
- else if(t->spacetype==SPACE_IPO)
+ else if (t->spacetype==SPACE_IPO)
calculateCenterCursorGraph2D(t);
else
calculateCenterCursor(t);
@@ -1544,7 +1542,7 @@ void calculateCenter(TransInfo *t)
} /* END EDIT MODE ACTIVE ELEMENT */
calculateCenterMedian(t);
- if((t->flag & (T_EDIT|T_POSE))==0)
+ if ((t->flag & (T_EDIT|T_POSE))==0)
{
Scene *scene = t->scene;
Object *ob= OBACT;
@@ -1585,7 +1583,7 @@ void calculateCenter(TransInfo *t)
projectIntView(t, axis, t->center2d);
/* rotate only needs correct 2d center, grab needs initgrabz() value */
- if(t->mode==TFM_TRANSLATION)
+ if (t->mode==TFM_TRANSLATION)
{
copy_v3_v3(t->center, axis);
copy_v3_v3(t->con.center, t->center);
@@ -1596,7 +1594,7 @@ void calculateCenter(TransInfo *t)
if (t->spacetype==SPACE_VIEW3D) {
/* initgrabz() defines a factor for perspective depth correction, used in window_to_3d_delta() */
- if(t->flag & (T_EDIT|T_POSE)) {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
float vec[3];
@@ -1618,7 +1616,7 @@ void calculatePropRatio(TransInfo *t)
short connected = t->flag & T_PROP_CONNECTED;
if (t->flag & T_PROP_EDIT) {
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_SELECTED) {
td->factor = 1.0f;
}
@@ -1712,7 +1710,7 @@ void calculatePropRatio(TransInfo *t)
}
}
else {
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
td->factor = 1.0;
}
t->proptext[0]= '\0';
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 3faddeb6639..bd3fb20f77f 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -236,7 +236,7 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2],
float dphi;
dphi = saacos((float)deler);
- if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
+ if ( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
/* If the angle is zero, because of lack of precision close to the 1.0 value in acos
* approximate the angle with the opposite side of the normalized triangle
@@ -256,7 +256,7 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2],
dy = dy1 - dy2;
dphi = sqrt(dx*dx + dy*dy);
- if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
+ if ( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
}
if (mi->precision) {
@@ -307,7 +307,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
/* TODO, holding R-key can cause mem leak, but this causes [#28903]
* disable for now. */
#if 0
- if(mi->data) {
+ if (mi->data) {
MEM_freeN(mi->data);
mi->data= NULL;
}
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 9188d048154..eb1d8e1df5c 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -52,6 +52,9 @@
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+
#include "RNA_access.h"
#include "BKE_action.h"
@@ -63,9 +66,6 @@
#include "BKE_pointcache.h"
#include "BKE_tessmesh.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
#include "BIF_gl.h"
#include "WM_api.h"
@@ -120,25 +120,25 @@ static void calc_tw_center(Scene *scene, float *co)
static void protectflag_to_drawflags(short protectflag, short *drawflags)
{
- if(protectflag & OB_LOCK_LOCX)
+ if (protectflag & OB_LOCK_LOCX)
*drawflags &= ~MAN_TRANS_X;
- if(protectflag & OB_LOCK_LOCY)
+ if (protectflag & OB_LOCK_LOCY)
*drawflags &= ~MAN_TRANS_Y;
- if(protectflag & OB_LOCK_LOCZ)
+ if (protectflag & OB_LOCK_LOCZ)
*drawflags &= ~MAN_TRANS_Z;
- if(protectflag & OB_LOCK_ROTX)
+ if (protectflag & OB_LOCK_ROTX)
*drawflags &= ~MAN_ROT_X;
- if(protectflag & OB_LOCK_ROTY)
+ if (protectflag & OB_LOCK_ROTY)
*drawflags &= ~MAN_ROT_Y;
- if(protectflag & OB_LOCK_ROTZ)
+ if (protectflag & OB_LOCK_ROTZ)
*drawflags &= ~MAN_ROT_Z;
- if(protectflag & OB_LOCK_SCALEX)
+ if (protectflag & OB_LOCK_SCALEX)
*drawflags &= ~MAN_SCALE_X;
- if(protectflag & OB_LOCK_SCALEY)
+ if (protectflag & OB_LOCK_SCALEY)
*drawflags &= ~MAN_SCALE_Y;
- if(protectflag & OB_LOCK_SCALEZ)
+ if (protectflag & OB_LOCK_SCALEZ)
*drawflags &= ~MAN_SCALE_Z;
}
@@ -147,7 +147,7 @@ static void stats_pose(Scene *scene, RegionView3D *rv3d, bPoseChannel *pchan)
{
Bone *bone= pchan->bone;
- if(bone) {
+ if (bone) {
if (bone->flag & BONE_TRANSFORM) {
calc_tw_center(scene, pchan->pose_head);
protectflag_to_drawflags(pchan->protectflag, &rv3d->twdrawflag);
@@ -205,9 +205,9 @@ int gimbal_axis(Object *ob, float gmat[][3])
if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan= get_active_posechannel(ob);
- if(pchan) {
+ if (pchan) {
float mat[3][3], tmat[3][3], obmat[3][3];
- if(test_rotmode_euler(pchan->rotmode)) {
+ if (test_rotmode_euler(pchan->rotmode)) {
eulO_to_gimbal_axis(mat, pchan->eul, pchan->rotmode);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
@@ -242,10 +242,10 @@ int gimbal_axis(Object *ob, float gmat[][3])
}
}
else {
- if(test_rotmode_euler(ob->rotmode)) {
+ if (test_rotmode_euler(ob->rotmode)) {
eulO_to_gimbal_axis(gmat, ob->rot, ob->rotmode);
}
- else if(ob->rotmode == ROT_MODE_AXISANGLE) {
+ else if (ob->rotmode == ROT_MODE_AXISANGLE) {
axis_angle_to_gimbal_axis(gmat, ob->rotAxis, ob->rotAngle);
}
else { /* quat */
@@ -287,14 +287,14 @@ int calc_manipulator_stats(const bContext *C)
rv3d->twdrawflag= 0xFFFF;
/* transform widget centroid/center */
- scene->twcent[0]= scene->twcent[1]= scene->twcent[2]= 0.0f;
INIT_MINMAX(scene->twmin, scene->twmax);
+ zero_v3(scene->twcent);
- if(obedit) {
+ if (obedit) {
ob= obedit;
- if((ob->lay & v3d->lay)==0) return 0;
+ if ((ob->lay & v3d->lay)==0) return 0;
- if(obedit->type==OB_MESH) {
+ if (obedit->type==OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(obedit);
BMEditSelection ese;
float vec[3]= {0,0,0};
@@ -314,24 +314,24 @@ int calc_manipulator_stats(const bContext *C)
/* do vertices/edges/faces for center depending on selection
* mode. note we can't use just vertex selection flag because
* it is not flush down on changes */
- if(ts->selectmode & SCE_SELECT_VERTEX) {
+ if (ts->selectmode & SCE_SELECT_VERTEX) {
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- if(BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
totsel++;
calc_tw_center(scene, eve->co);
}
}
}
}
- else if(ts->selectmode & SCE_SELECT_EDGE) {
+ else if (ts->selectmode & SCE_SELECT_EDGE) {
BMIter itersub;
BMEdge *eed;
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
/* check the vertex has a selected edge, only add it once */
BM_ITER(eed, &itersub, bm, BM_EDGES_OF_VERT, eve) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
totsel++;
calc_tw_center(scene, eve->co);
break;
@@ -344,10 +344,10 @@ int calc_manipulator_stats(const bContext *C)
BMIter itersub;
BMFace *efa;
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
/* check the vertex has a selected face, only add it once */
BM_ITER(efa, &itersub, bm, BM_FACES_OF_VERT, eve) {
- if(BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
totsel++;
calc_tw_center(scene, eve->co);
break;
@@ -362,7 +362,7 @@ int calc_manipulator_stats(const bContext *C)
bArmature *arm= obedit->data;
EditBone *ebo;
for (ebo= arm->edbo->first; ebo; ebo=ebo->next) {
- if(EBONE_VISIBLE(arm, ebo)) {
+ if (EBONE_VISIBLE(arm, ebo)) {
if (ebo->flag & BONE_TIPSEL) {
calc_tw_center(scene, ebo->tail);
totsel++;
@@ -392,11 +392,11 @@ int calc_manipulator_stats(const bContext *C)
ListBase *nurbs= curve_editnurbs(cu);
nu= nurbs->first;
- while(nu) {
- if(nu->type == CU_BEZIER) {
+ while (nu) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
/* exceptions
* if handles are hidden then only check the center points.
* If the center knot is selected then only use this as the center point.
@@ -412,11 +412,11 @@ int calc_manipulator_stats(const bContext *C)
totsel++;
}
else {
- if(bezt->f1) {
+ if (bezt->f1) {
calc_tw_center(scene, bezt->vec[0]);
totsel++;
}
- if(bezt->f3) {
+ if (bezt->f3) {
calc_tw_center(scene, bezt->vec[2]);
totsel++;
}
@@ -427,8 +427,8 @@ int calc_manipulator_stats(const bContext *C)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
calc_tw_center(scene, bp->vec);
totsel++;
}
@@ -439,13 +439,13 @@ int calc_manipulator_stats(const bContext *C)
}
}
}
- else if(obedit->type==OB_MBALL) {
+ else if (obedit->type==OB_MBALL) {
MetaBall *mb = (MetaBall*)obedit->data;
MetaElem *ml /* , *ml_sel=NULL */ /* UNUSED */;
ml= mb->editelems->first;
- while(ml) {
- if(ml->flag & SELECT) {
+ while (ml) {
+ if (ml->flag & SELECT) {
calc_tw_center(scene, &ml->x);
/* ml_sel = ml; */ /* UNUSED */
totsel++;
@@ -453,15 +453,15 @@ int calc_manipulator_stats(const bContext *C)
ml= ml->next;
}
}
- else if(obedit->type==OB_LATTICE) {
+ else if (obedit->type==OB_LATTICE) {
BPoint *bp;
Lattice *lt= obedit->data;
bp= lt->editlatt->latt->def;
a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
- while(a--) {
- if(bp->f1 & SELECT) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
calc_tw_center(scene, bp->vec);
totsel++;
}
@@ -470,24 +470,24 @@ int calc_manipulator_stats(const bContext *C)
}
/* selection center */
- if(totsel) {
+ if (totsel) {
mul_v3_fl(scene->twcent, 1.0f/(float)totsel); // centroid!
mul_m4_v3(obedit->obmat, scene->twcent);
mul_m4_v3(obedit->obmat, scene->twmin);
mul_m4_v3(obedit->obmat, scene->twmax);
}
}
- else if(ob && (ob->mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
bPoseChannel *pchan;
int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed
- if((ob->lay & v3d->lay)==0) return 0;
+ if ((ob->lay & v3d->lay)==0) return 0;
totsel = count_set_pose_transflags(&mode, 0, ob);
- if(totsel) {
+ if (totsel) {
/* use channels to get stats */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
stats_pose(scene, rv3d, pchan);
}
@@ -497,22 +497,22 @@ int calc_manipulator_stats(const bContext *C)
mul_m4_v3(ob->obmat, scene->twmax);
}
}
- else if(ob && (ob->mode & OB_MODE_ALL_PAINT)) {
+ else if (ob && (ob->mode & OB_MODE_ALL_PAINT)) {
;
}
- else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
+ else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
PTCacheEdit *edit= PE_get_current(scene, ob);
PTCacheEditPoint *point;
PTCacheEditKey *ek;
int k;
- if(edit) {
+ if (edit) {
point = edit->points;
- for(a=0; a<edit->totpoint; a++,point++) {
- if(point->flag & PEP_HIDE) continue;
+ for (a=0; a<edit->totpoint; a++,point++) {
+ if (point->flag & PEP_HIDE) continue;
- for(k=0, ek=point->keys; k<point->totkey; k++, ek++) {
- if(ek->flag & PEK_SELECT) {
+ for (k=0, ek=point->keys; k<point->totkey; k++, ek++) {
+ if (ek->flag & PEK_SELECT) {
calc_tw_center(scene, ek->flag & PEK_USE_WCO ? ek->world_co : ek->co);
totsel++;
}
@@ -520,7 +520,7 @@ int calc_manipulator_stats(const bContext *C)
}
/* selection center */
- if(totsel)
+ if (totsel)
mul_v3_fl(scene->twcent, 1.0f/(float)totsel); // centroid!
}
}
@@ -528,11 +528,11 @@ int calc_manipulator_stats(const bContext *C)
/* we need the one selected object, if its not active */
ob= OBACT;
- if(ob && !(ob->flag & SELECT)) ob= NULL;
+ if (ob && !(ob->flag & SELECT)) ob= NULL;
- for(base= scene->base.first; base; base= base->next) {
+ for (base= scene->base.first; base; base= base->next) {
if TESTBASELIB(v3d, base) {
- if(ob==NULL)
+ if (ob==NULL)
ob= base->object;
calc_tw_center(scene, base->object->obmat[3]);
protectflag_to_drawflags(base->object->protectflag, &rv3d->twdrawflag);
@@ -541,13 +541,13 @@ int calc_manipulator_stats(const bContext *C)
}
/* selection center */
- if(totsel) {
+ if (totsel) {
mul_v3_fl(scene->twcent, 1.0f/(float)totsel); // centroid!
}
}
/* global, local or normal orientation? */
- if(ob && totsel) {
+ if (ob && totsel) {
switch(v3d->twmode) {
@@ -564,7 +564,7 @@ int calc_manipulator_stats(const bContext *C)
/* if not gimbal, fall through to normal */
}
case V3D_MANIP_NORMAL:
- if(obedit || ob->mode & OB_MODE_POSE) {
+ if (obedit || ob->mode & OB_MODE_POSE) {
float mat[3][3];
ED_getTransformOrientationMatrix(C, mat, (v3d->around == V3D_ACTIVE));
copy_m4_m3(rv3d->twmat, mat);
@@ -664,7 +664,7 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i
float ring_delta, side_delta;
int i, j, docaps= 1;
- if(start==0 && end==nrings) docaps= 0;
+ if (start==0 && end==nrings) docaps= 0;
ring_delta= 2.0f*(float)M_PI/(float)nrings;
side_delta= 2.0f*(float)M_PI/(float)nsides;
@@ -673,15 +673,15 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i
cos_theta= (float)cos(theta);
sin_theta= (float)sin(theta);
- for(i= nrings - 1; i >= 0; i--) {
+ for (i= nrings - 1; i >= 0; i--) {
theta1= theta + ring_delta;
cos_theta1= (float)cos(theta1);
sin_theta1= (float)sin(theta1);
- if(docaps && i==start) { // cap
+ if (docaps && i==start) { // cap
glBegin(GL_POLYGON);
phi= 0.0;
- for(j= nsides; j >= 0; j--) {
+ for (j= nsides; j >= 0; j--) {
float cos_phi, sin_phi, dist;
phi += side_delta;
@@ -693,10 +693,10 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i
}
glEnd();
}
- if(i>=start && i<=end) {
+ if (i>=start && i<=end) {
glBegin(GL_QUAD_STRIP);
phi= 0.0;
- for(j= nsides; j >= 0; j--) {
+ for (j= nsides; j >= 0; j--) {
float cos_phi, sin_phi, dist;
phi += side_delta;
@@ -710,10 +710,10 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i
glEnd();
}
- if(docaps && i==end) { // cap
+ if (docaps && i==end) { // cap
glBegin(GL_POLYGON);
phi= 0.0;
- for(j= nsides; j >= 0; j--) {
+ for (j= nsides; j >= 0; j--) {
float cos_phi, sin_phi, dist;
phi -= side_delta;
@@ -754,22 +754,22 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned c
unsigned char col[4]= {0};
col[3]= alpha;
- if(colcode==MAN_GHOST) {
+ if (colcode==MAN_GHOST) {
col[3]= 70;
}
- else if(colcode==MAN_MOVECOL) {
+ else if (colcode==MAN_MOVECOL) {
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
}
else {
switch(axis) {
case 'C':
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
- if(v3d->twmode == V3D_MANIP_LOCAL) {
+ if (v3d->twmode == V3D_MANIP_LOCAL) {
col[0]= col[0]>200?255:col[0]+55;
col[1]= col[1]>200?255:col[1]+55;
col[2]= col[2]>200?255:col[2]+55;
}
- else if(v3d->twmode == V3D_MANIP_NORMAL) {
+ else if (v3d->twmode == V3D_MANIP_NORMAL) {
col[0]= col[0]<55?0:col[0]-55;
col[1]= col[1]<55?0:col[1]-55;
col[2]= col[2]<55?0:col[2]-55;
@@ -799,27 +799,27 @@ static void draw_manipulator_axes(View3D *v3d, RegionView3D *rv3d, int colcode,
{
/* axes */
- if(flagx) {
+ if (flagx) {
manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0]));
- if(flagx & MAN_SCALE_X) glLoadName(MAN_SCALE_X);
- else if(flagx & MAN_TRANS_X) glLoadName(MAN_TRANS_X);
+ if (flagx & MAN_SCALE_X) glLoadName(MAN_SCALE_X);
+ else if (flagx & MAN_TRANS_X) glLoadName(MAN_TRANS_X);
glBegin(GL_LINES);
glVertex3f(0.2f, 0.0f, 0.0f);
glVertex3f(1.0f, 0.0f, 0.0f);
glEnd();
}
- if(flagy) {
- if(flagy & MAN_SCALE_Y) glLoadName(MAN_SCALE_Y);
- else if(flagy & MAN_TRANS_Y) glLoadName(MAN_TRANS_Y);
+ if (flagy) {
+ if (flagy & MAN_SCALE_Y) glLoadName(MAN_SCALE_Y);
+ else if (flagy & MAN_TRANS_Y) glLoadName(MAN_TRANS_Y);
manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1]));
glBegin(GL_LINES);
glVertex3f(0.0f, 0.2f, 0.0f);
glVertex3f(0.0f, 1.0f, 0.0f);
glEnd();
}
- if(flagz) {
- if(flagz & MAN_SCALE_Z) glLoadName(MAN_SCALE_Z);
- else if(flagz & MAN_TRANS_Z) glLoadName(MAN_TRANS_Z);
+ if (flagz) {
+ if (flagz & MAN_SCALE_Z) glLoadName(MAN_SCALE_Z);
+ else if (flagz & MAN_TRANS_Z) glLoadName(MAN_TRANS_Z);
manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2]));
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.2f);
@@ -859,11 +859,11 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
int colcode;
int ortho;
- if(moving) colcode= MAN_MOVECOL;
+ if (moving) colcode= MAN_MOVECOL;
else colcode= MAN_RGB;
/* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_ROT_C)==0) return;
+ if ((drawflags & MAN_ROT_C)==0) return;
/* Init stuff */
glDisable(GL_DEPTH_TEST);
@@ -877,7 +877,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glPushMatrix();
glTranslatef(rv3d->twmat[3][0], rv3d->twmat[3][1], rv3d->twmat[3][2]);
- if(arcs) {
+ if (arcs) {
/* clipplane makes nice handles, calc here because of multmatrix but with translate! */
copy_v3db_v3fl(plane, rv3d->viewinv[2]);
plane[3]= -0.02f*size; // clip just a bit more
@@ -887,28 +887,28 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glRotatef( -360.0f*saacos(rv3d->viewquat[0])/(float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]);
/* Screen aligned help circle */
- if(arcs) {
- if((G.f & G_PICKSEL)==0) {
+ if (arcs) {
+ if ((G.f & G_PICKSEL)==0) {
UI_ThemeColorShade(TH_BACK, -30);
drawcircball(GL_LINE_LOOP, unitmat[3], size, unitmat);
}
}
/* Screen aligned trackball rot circle */
- if(drawflags & MAN_ROT_T) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_T);
+ if (drawflags & MAN_ROT_T) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_T);
UI_ThemeColor(TH_TRANSFORM);
drawcircball(GL_LINE_LOOP, unitmat[3], 0.2f*size, unitmat);
}
/* Screen aligned view rot circle */
- if(drawflags & MAN_ROT_V) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
+ if (drawflags & MAN_ROT_V) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
UI_ThemeColor(TH_TRANSFORM);
drawcircball(GL_LINE_LOOP, unitmat[3], 1.2f*size, unitmat);
- if(moving) {
+ if (moving) {
float vec[3];
vec[0]= 0; // XXX (float)(t->imval[0] - t->center2d[0]);
vec[1]= 0; // XXX (float)(t->imval[1] - t->center2d[1]);
@@ -927,7 +927,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
ortho = is_orthogonal_m4(rv3d->twmat);
/* apply the transform delta */
- if(moving) {
+ if (moving) {
copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
// XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat);
if (ortho) {
@@ -943,11 +943,11 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
}
/* axes */
- if(arcs==0) {
- if(!(G.f & G_PICKSEL)) {
- if( (combo & V3D_MANIP_SCALE)==0) {
+ if (arcs==0) {
+ if (!(G.f & G_PICKSEL)) {
+ if ( (combo & V3D_MANIP_SCALE)==0) {
/* axis */
- if( (drawflags & MAN_ROT_X) || (moving && (drawflags & MAN_ROT_Z)) ) {
+ if ( (drawflags & MAN_ROT_X) || (moving && (drawflags & MAN_ROT_Z)) ) {
preOrthoFront(ortho, rv3d->twmat, 2);
manipulator_setcolor(v3d, 'X', colcode, 255);
glBegin(GL_LINES);
@@ -956,7 +956,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glEnd();
postOrtho(ortho);
}
- if( (drawflags & MAN_ROT_Y) || (moving && (drawflags & MAN_ROT_X)) ) {
+ if ( (drawflags & MAN_ROT_Y) || (moving && (drawflags & MAN_ROT_X)) ) {
preOrthoFront(ortho, rv3d->twmat, 0);
manipulator_setcolor(v3d, 'Y', colcode, 255);
glBegin(GL_LINES);
@@ -965,7 +965,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glEnd();
postOrtho(ortho);
}
- if( (drawflags & MAN_ROT_Z) || (moving && (drawflags & MAN_ROT_Y)) ) {
+ if ( (drawflags & MAN_ROT_Z) || (moving && (drawflags & MAN_ROT_Y)) ) {
preOrthoFront(ortho, rv3d->twmat, 1);
manipulator_setcolor(v3d, 'Z', colcode, 255);
glBegin(GL_LINES);
@@ -978,20 +978,20 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
}
}
- if(arcs==0 && moving) {
+ if (arcs==0 && moving) {
/* Z circle */
- if(drawflags & MAN_ROT_Z) {
+ if (drawflags & MAN_ROT_Z) {
preOrthoFront(ortho, matt, 2);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
manipulator_setcolor(v3d, 'Z', colcode, 255);
drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
postOrtho(ortho);
}
/* X circle */
- if(drawflags & MAN_ROT_X) {
+ if (drawflags & MAN_ROT_X) {
preOrthoFront(ortho, matt, 0);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
glRotatef(90.0, 0.0, 1.0, 0.0);
manipulator_setcolor(v3d, 'X', colcode, 255);
drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
@@ -999,9 +999,9 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
postOrtho(ortho);
}
/* Y circle */
- if(drawflags & MAN_ROT_Y) {
+ if (drawflags & MAN_ROT_Y) {
preOrthoFront(ortho, matt, 1);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
glRotatef(-90.0, 1.0, 0.0, 0.0);
manipulator_setcolor(v3d, 'Y', colcode, 255);
drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
@@ -1009,24 +1009,24 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
postOrtho(ortho);
}
- if(arcs) glDisable(GL_CLIP_PLANE0);
+ if (arcs) glDisable(GL_CLIP_PLANE0);
}
// donut arcs
- if(arcs) {
+ if (arcs) {
glEnable(GL_CLIP_PLANE0);
/* Z circle */
- if(drawflags & MAN_ROT_Z) {
+ if (drawflags & MAN_ROT_Z) {
preOrthoFront(ortho, rv3d->twmat, 2);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
manipulator_setcolor(v3d, 'Z', colcode, 255);
partial_doughnut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
postOrtho(ortho);
}
/* X circle */
- if(drawflags & MAN_ROT_X) {
+ if (drawflags & MAN_ROT_X) {
preOrthoFront(ortho, rv3d->twmat, 0);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
glRotatef(90.0, 0.0, 1.0, 0.0);
manipulator_setcolor(v3d, 'X', colcode, 255);
partial_doughnut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
@@ -1034,9 +1034,9 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
postOrtho(ortho);
}
/* Y circle */
- if(drawflags & MAN_ROT_Y) {
+ if (drawflags & MAN_ROT_Y) {
preOrthoFront(ortho, rv3d->twmat, 1);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
glRotatef(-90.0, 1.0, 0.0, 0.0);
manipulator_setcolor(v3d, 'Y', colcode, 255);
partial_doughnut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
@@ -1047,13 +1047,13 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glDisable(GL_CLIP_PLANE0);
}
- if(arcs==0) {
+ if (arcs==0) {
/* Z handle on X axis */
- if(drawflags & MAN_ROT_Z) {
+ if (drawflags & MAN_ROT_Z) {
preOrthoFront(ortho, rv3d->twmat, 2);
glPushMatrix();
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
manipulator_setcolor(v3d, 'Z', colcode, 255);
partial_doughnut(0.7f*cusize, 1.0f, 31, 33, 8, 64);
@@ -1063,10 +1063,10 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
}
/* Y handle on X axis */
- if(drawflags & MAN_ROT_Y) {
+ if (drawflags & MAN_ROT_Y) {
preOrthoFront(ortho, rv3d->twmat, 1);
glPushMatrix();
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
manipulator_setcolor(v3d, 'Y', colcode, 255);
glRotatef(90.0, 1.0, 0.0, 0.0);
@@ -1078,10 +1078,10 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
}
/* X handle on Z axis */
- if(drawflags & MAN_ROT_X) {
+ if (drawflags & MAN_ROT_X) {
preOrthoFront(ortho, rv3d->twmat, 0);
glPushMatrix();
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
manipulator_setcolor(v3d, 'X', colcode, 255);
glRotatef(-90.0, 0.0, 1.0, 0.0);
@@ -1097,27 +1097,26 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
/* restore */
glLoadMatrixf(rv3d->viewmat);
gluDeleteQuadric(qobj);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
static void drawsolidcube(float size)
{
static float cube[8][3] = {
- {-1.0, -1.0, -1.0},
- {-1.0, -1.0, 1.0},
- {-1.0, 1.0, 1.0},
- {-1.0, 1.0, -1.0},
- { 1.0, -1.0, -1.0},
- { 1.0, -1.0, 1.0},
- { 1.0, 1.0, 1.0},
- { 1.0, 1.0, -1.0}, };
- float n[3];
+ {-1.0, -1.0, -1.0},
+ {-1.0, -1.0, 1.0},
+ {-1.0, 1.0, 1.0},
+ {-1.0, 1.0, -1.0},
+ { 1.0, -1.0, -1.0},
+ { 1.0, -1.0, 1.0},
+ { 1.0, 1.0, 1.0},
+ { 1.0, 1.0, -1.0}, };
+ float n[3] = {0.0f};
glPushMatrix();
glScalef(size, size, size);
- n[0]=0; n[1]=0; n[2]=0;
glBegin(GL_QUADS);
n[0]= -1.0;
glNormal3fv(n);
@@ -1169,17 +1168,17 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
float cusize= cywid*0.75f, dz;
/* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_SCALE_C)==0) return;
+ if ((drawflags & MAN_SCALE_C)==0) return;
glDisable(GL_DEPTH_TEST);
/* not in combo mode */
- if( (combo & (V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE))==0) {
+ if ( (combo & (V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE))==0) {
float size, unitmat[4][4];
int shift= 0; // XXX
/* center circle, do not add to selection when shift is pressed (planar constraint) */
- if( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_SCALE_C);
+ if ( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_SCALE_C);
manipulator_setcolor(v3d, 'C', colcode, 255);
glPushMatrix();
@@ -1192,7 +1191,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
}
else dz= 1.0f-4.0f*cusize;
- if(moving) {
+ if (moving) {
float matt[4][4];
copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
@@ -1212,31 +1211,31 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
/* Z cube */
glTranslatef(0.0, 0.0, dz);
- if(drawflags & MAN_SCALE_Z) {
- if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Z);
+ if (drawflags & MAN_SCALE_Z) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_Z);
manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2]));
drawsolidcube(cusize);
}
/* X cube */
glTranslatef(dz, 0.0, -dz);
- if(drawflags & MAN_SCALE_X) {
- if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_X);
+ if (drawflags & MAN_SCALE_X) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_X);
manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0]));
drawsolidcube(cusize);
}
/* Y cube */
glTranslatef(-dz, dz, 0.0);
- if(drawflags & MAN_SCALE_Y) {
- if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Y);
+ if (drawflags & MAN_SCALE_Y) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_Y);
manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1]));
drawsolidcube(cusize);
}
/* if shiftkey, center point as last, for selectbuffer order */
- if(G.f & G_PICKSEL) {
+ if (G.f & G_PICKSEL) {
int shift= 0; // XXX
- if(shift) {
+ if (shift) {
glTranslatef(0.0, -dz, 0.0);
glLoadName(MAN_SCALE_C);
glBegin(GL_POINTS);
@@ -1248,7 +1247,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
/* restore */
glLoadMatrixf(rv3d->viewmat);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
glFrontFace(GL_CCW);
}
@@ -1288,16 +1287,16 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
int shift= 0; // XXX
/* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_TRANS_C)==0) return;
+ if ((drawflags & MAN_TRANS_C)==0) return;
- // XXX if(moving) glTranslatef(t->vec[0], t->vec[1], t->vec[2]);
+ // XXX if (moving) glTranslatef(t->vec[0], t->vec[1], t->vec[2]);
glDisable(GL_DEPTH_TEST);
qobj= gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_FILL);
/* center circle, do not add to selection when shift is pressed (planar constraint) */
- if( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_TRANS_C);
+ if ( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_TRANS_C);
manipulator_setcolor(v3d, 'C', colcode, 255);
glPushMatrix();
@@ -1313,26 +1312,26 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
glLoadName(-1);
// translate drawn as last, only axis when no combo with scale, or for ghosting
- if((combo & V3D_MANIP_SCALE)==0 || colcode==MAN_GHOST)
+ if ((combo & V3D_MANIP_SCALE)==0 || colcode==MAN_GHOST)
draw_manipulator_axes(v3d, rv3d, colcode, drawflags & MAN_TRANS_X, drawflags & MAN_TRANS_Y, drawflags & MAN_TRANS_Z);
/* offset in combo mode, for rotate a bit more */
- if(combo & (V3D_MANIP_ROTATE)) dz= 1.0f+2.0f*cylen;
- else if(combo & (V3D_MANIP_SCALE)) dz= 1.0f+0.5f*cylen;
+ if (combo & (V3D_MANIP_ROTATE)) dz= 1.0f+2.0f*cylen;
+ else if (combo & (V3D_MANIP_SCALE)) dz= 1.0f+0.5f*cylen;
else dz= 1.0f;
/* Z Cone */
glTranslatef(0.0, 0.0, dz);
- if(drawflags & MAN_TRANS_Z) {
- if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Z);
+ if (drawflags & MAN_TRANS_Z) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_Z);
manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2]));
draw_cone(qobj, cylen, cywid);
}
/* X Cone */
glTranslatef(dz, 0.0, -dz);
- if(drawflags & MAN_TRANS_X) {
- if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_X);
+ if (drawflags & MAN_TRANS_X) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_X);
glRotatef(90.0, 0.0, 1.0, 0.0);
manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0]));
draw_cone(qobj, cylen, cywid);
@@ -1340,8 +1339,8 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
}
/* Y Cone */
glTranslatef(-dz, dz, 0.0);
- if(drawflags & MAN_TRANS_Y) {
- if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Y);
+ if (drawflags & MAN_TRANS_Y) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_Y);
glRotatef(-90.0, 1.0, 0.0, 0.0);
manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1]));
draw_cone(qobj, cylen, cywid);
@@ -1350,7 +1349,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
gluDeleteQuadric(qobj);
glLoadMatrixf(rv3d->viewmat);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
@@ -1362,7 +1361,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
float cywid= 0.25f*cylen;
/* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_ROT_C)==0) return;
+ if ((drawflags & MAN_ROT_C)==0) return;
/* prepare for screen aligned draw */
glPushMatrix();
@@ -1373,14 +1372,14 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
qobj= gluNewQuadric();
/* Screen aligned view rot circle */
- if(drawflags & MAN_ROT_V) {
+ if (drawflags & MAN_ROT_V) {
float unitmat[4][4]= MAT4_UNITY;
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
UI_ThemeColor(TH_TRANSFORM);
drawcircball(GL_LINE_LOOP, unitmat[3], 1.2f*size, unitmat);
- if(moving) {
+ if (moving) {
float vec[3];
vec[0]= 0; // XXX (float)(t->imval[0] - t->center2d[0]);
vec[1]= 0; // XXX (float)(t->imval[1] - t->center2d[1]);
@@ -1396,7 +1395,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
glPopMatrix();
/* apply the transform delta */
- if(moving) {
+ if (moving) {
float matt[4][4];
copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
// XXX if (t->flag & T_USES_MANIPULATOR) {
@@ -1411,10 +1410,10 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW);
/* axis */
- if( (G.f & G_PICKSEL)==0 ) {
+ if ( (G.f & G_PICKSEL)==0 ) {
// only draw axis when combo didn't draw scale axes
- if((combo & V3D_MANIP_SCALE)==0)
+ if ((combo & V3D_MANIP_SCALE)==0)
draw_manipulator_axes(v3d, rv3d, colcode, drawflags & MAN_ROT_X, drawflags & MAN_ROT_Y, drawflags & MAN_ROT_Z);
/* only has to be set when not in picking */
@@ -1423,15 +1422,15 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
/* Z cyl */
glTranslatef(0.0, 0.0, 1.0);
- if(drawflags & MAN_ROT_Z) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+ if (drawflags & MAN_ROT_Z) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
manipulator_setcolor(v3d, 'Z', colcode, 255);
draw_cylinder(qobj, cylen, cywid);
}
/* X cyl */
glTranslatef(1.0, 0.0, -1.0);
- if(drawflags & MAN_ROT_X) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+ if (drawflags & MAN_ROT_X) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
glRotatef(90.0, 0.0, 1.0, 0.0);
manipulator_setcolor(v3d, 'X', colcode, 255);
draw_cylinder(qobj, cylen, cywid);
@@ -1439,8 +1438,8 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
}
/* Y cylinder */
glTranslatef(-1.0, 1.0, 0.0);
- if(drawflags & MAN_ROT_Y) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+ if (drawflags & MAN_ROT_Y) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
glRotatef(-90.0, 1.0, 0.0, 0.0);
manipulator_setcolor(v3d, 'Y', colcode, 255);
draw_cylinder(qobj, cylen, cywid);
@@ -1451,7 +1450,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
gluDeleteQuadric(qobj);
glLoadMatrixf(rv3d->viewmat);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
@@ -1471,15 +1470,15 @@ void BIF_draw_manipulator(const bContext *C)
RegionView3D *rv3d= ar->regiondata;
int totsel;
- if(!(v3d->twflag & V3D_USE_MANIPULATOR)) return;
-// if(G.moving && (G.moving & G_TRANSFORM_MANIP)==0) return;
+ if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return;
+// if (G.moving && (G.moving & G_TRANSFORM_MANIP)==0) return;
-// if(G.moving==0) {
+// if (G.moving==0) {
{
v3d->twflag &= ~V3D_DRAW_MANIPULATOR;
totsel= calc_manipulator_stats(C);
- if(totsel==0) return;
+ if (totsel==0) return;
v3d->twflag |= V3D_DRAW_MANIPULATOR;
@@ -1490,9 +1489,9 @@ void BIF_draw_manipulator(const bContext *C)
rv3d->twmat[3][0]= (scene->twmin[0] + scene->twmax[0])/2.0f;
rv3d->twmat[3][1]= (scene->twmin[1] + scene->twmax[1])/2.0f;
rv3d->twmat[3][2]= (scene->twmin[2] + scene->twmax[2])/2.0f;
- if(v3d->around==V3D_ACTIVE && scene->obedit==NULL) {
+ if (v3d->around==V3D_ACTIVE && scene->obedit==NULL) {
Object *ob= OBACT;
- if(ob && !(ob->mode & OB_MODE_POSE))
+ if (ob && !(ob->mode & OB_MODE_POSE))
copy_v3_v3(rv3d->twmat[3], ob->obmat[3]);
}
break;
@@ -1511,23 +1510,23 @@ void BIF_draw_manipulator(const bContext *C)
test_manipulator_axis(C);
drawflags= rv3d->twdrawflag; /* set in calc_manipulator_stats */
- if(v3d->twflag & V3D_DRAW_MANIPULATOR) {
+ if (v3d->twflag & V3D_DRAW_MANIPULATOR) {
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- if(v3d->twtype & V3D_MANIP_ROTATE) {
+ if (v3d->twtype & V3D_MANIP_ROTATE) {
- if(G.rt==3) {
- if(G.moving) draw_manipulator_rotate_cyl(v3d, rv3d, 1, drawflags, v3d->twtype, MAN_MOVECOL);
+ if (G.rt==3) {
+ if (G.moving) draw_manipulator_rotate_cyl(v3d, rv3d, 1, drawflags, v3d->twtype, MAN_MOVECOL);
else draw_manipulator_rotate_cyl(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
}
else
draw_manipulator_rotate(v3d, rv3d, 0 /* G.moving*/, drawflags, v3d->twtype);
}
- if(v3d->twtype & V3D_MANIP_SCALE) {
+ if (v3d->twtype & V3D_MANIP_SCALE) {
draw_manipulator_scale(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
}
- if(v3d->twtype & V3D_MANIP_TRANSLATE) {
+ if (v3d->twtype & V3D_MANIP_TRANSLATE) {
draw_manipulator_translate(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
}
@@ -1546,10 +1545,10 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
G.f |= G_PICKSEL;
- rect.xmin= mval[0]-hotspot;
- rect.xmax= mval[0]+hotspot;
- rect.ymin= mval[1]-hotspot;
- rect.ymax= mval[1]+hotspot;
+ rect.xmin = mval[0]-hotspot;
+ rect.xmax = mval[0]+hotspot;
+ rect.ymin = mval[1]-hotspot;
+ rect.ymax = mval[1]+hotspot;
setwinmatrixview3d(ar, v3d, &rect);
mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
@@ -1560,13 +1559,13 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
glPushName(-2);
/* do the drawing */
- if(v3d->twtype & V3D_MANIP_ROTATE) {
- if(G.rt==3) draw_manipulator_rotate_cyl(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
+ if (v3d->twtype & V3D_MANIP_ROTATE) {
+ if (G.rt==3) draw_manipulator_rotate_cyl(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
else draw_manipulator_rotate(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype);
}
- if(v3d->twtype & V3D_MANIP_SCALE)
+ if (v3d->twtype & V3D_MANIP_SCALE)
draw_manipulator_scale(v3d, rv3d, 0, MAN_SCALE_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
- if(v3d->twtype & V3D_MANIP_TRANSLATE)
+ if (v3d->twtype & V3D_MANIP_TRANSLATE)
draw_manipulator_translate(v3d, rv3d, 0, MAN_TRANS_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
glPopName();
@@ -1576,29 +1575,29 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
setwinmatrixview3d(ar, v3d, NULL);
mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
- if(hits==1) return buffer[3];
- else if(hits>1) {
+ if (hits==1) return buffer[3];
+ else if (hits>1) {
GLuint val, dep, mindep=0, mindeprot=0, minval=0, minvalrot=0;
int a;
/* we compare the hits in buffer, but value centers highest */
/* we also store the rotation hits separate (because of arcs) and return hits on other widgets if there are */
- for(a=0; a<hits; a++) {
+ for (a=0; a<hits; a++) {
dep= buffer[4*a + 1];
val= buffer[4*a + 3];
- if(val==MAN_TRANS_C) return MAN_TRANS_C;
- else if(val==MAN_SCALE_C) return MAN_SCALE_C;
+ if (val==MAN_TRANS_C) return MAN_TRANS_C;
+ else if (val==MAN_SCALE_C) return MAN_SCALE_C;
else {
- if(val & MAN_ROT_C) {
- if(minvalrot==0 || dep<mindeprot) {
+ if (val & MAN_ROT_C) {
+ if (minvalrot==0 || dep<mindeprot) {
mindeprot= dep;
minvalrot= val;
}
}
else {
- if(minval==0 || dep<mindep) {
+ if (minval==0 || dep<mindep) {
mindep= dep;
minval= val;
}
@@ -1606,7 +1605,7 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
}
}
- if(minval)
+ if (minval)
return minval;
else
return minvalrot;
@@ -1625,26 +1624,26 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
int val;
int shift = event->shift;
- if(!(v3d->twflag & V3D_USE_MANIPULATOR)) return 0;
- if(!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return 0;
+ if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return 0;
+ if (!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return 0;
/* Force orientation */
RNA_enum_set(op->ptr, "constraint_orientation", v3d->twmode);
// find the hotspots first test narrow hotspot
val= manipulator_selectbuf(sa, ar, event->mval, 0.5f*(float)U.tw_hotspot);
- if(val) {
+ if (val) {
// drawflags still global, for drawing call above
drawflags= manipulator_selectbuf(sa, ar, event->mval, 0.2f*(float)U.tw_hotspot);
- if(drawflags==0) drawflags= val;
+ if (drawflags==0) drawflags= val;
if (drawflags & MAN_TRANS_C) {
switch(drawflags) {
case MAN_TRANS_C:
break;
case MAN_TRANS_X:
- if(shift) {
+ if (shift) {
constraint_axis[1] = 1;
constraint_axis[2] = 1;
}
@@ -1652,7 +1651,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
constraint_axis[0] = 1;
break;
case MAN_TRANS_Y:
- if(shift) {
+ if (shift) {
constraint_axis[0] = 1;
constraint_axis[2] = 1;
}
@@ -1660,7 +1659,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
constraint_axis[1] = 1;
break;
case MAN_TRANS_Z:
- if(shift) {
+ if (shift) {
constraint_axis[0] = 1;
constraint_axis[1] = 1;
}
@@ -1675,7 +1674,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
else if (drawflags & MAN_SCALE_C) {
switch(drawflags) {
case MAN_SCALE_X:
- if(shift) {
+ if (shift) {
constraint_axis[1] = 1;
constraint_axis[2] = 1;
}
@@ -1683,7 +1682,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
constraint_axis[0] = 1;
break;
case MAN_SCALE_Y:
- if(shift) {
+ if (shift) {
constraint_axis[0] = 1;
constraint_axis[2] = 1;
}
@@ -1691,7 +1690,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
constraint_axis[1] = 1;
break;
case MAN_SCALE_Z:
- if(shift) {
+ if (shift) {
constraint_axis[0] = 1;
constraint_axis[1] = 1;
}
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 69d29633972..7c3bcb857eb 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -155,21 +155,21 @@ static int snap_type_exec(bContext *C, wmOperator *op)
static void TRANSFORM_OT_snap_type(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Snap Type";
- ot->description= "Set the snap element type";
- ot->idname= "TRANSFORM_OT_snap_type";
+ ot->name = "Snap Type";
+ ot->description = "Set the snap element type";
+ ot->idname = "TRANSFORM_OT_snap_type";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= snap_type_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = snap_type_exec;
- ot->poll= ED_operator_areaactive;
+ ot->poll = ED_operator_areaactive;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO;
/* props */
- ot->prop= RNA_def_enum(ot->srna, "type", snap_element_items, 0, "Type", "Set the snap element type");
+ ot->prop = RNA_def_enum(ot->srna, "type", snap_element_items, 0, "Type", "Set the snap element type");
}
@@ -203,7 +203,7 @@ static void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot)
/* identifiers */
ot->name = "Select Orientation";
- ot->description= "Select transformation orientation";
+ ot->description = "Select transformation orientation";
ot->idname = "TRANSFORM_OT_select_orientation";
ot->flag = OPTYPE_UNDO;
@@ -245,7 +245,7 @@ static int delete_orientation_poll(bContext *C)
return 0;
- if(v3d) {
+ if (v3d) {
selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
}
@@ -256,7 +256,7 @@ static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Orientation";
- ot->description= "Delete transformation orientation";
+ ot->description = "Delete transformation orientation";
ot->idname = "TRANSFORM_OT_delete_orientation";
ot->flag = OPTYPE_UNDO;
@@ -291,7 +291,7 @@ static void TRANSFORM_OT_create_orientation(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Create Orientation";
- ot->description= "Create transformation orientation from selection";
+ ot->description = "Create transformation orientation from selection";
ot->idname = "TRANSFORM_OT_create_orientation";
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -341,7 +341,7 @@ static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
G.moving = 1;
/* store data */
- if(retval) {
+ if (retval) {
op->customdata = t;
}
else {
@@ -429,7 +429,7 @@ static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_CANCELLED;
}
- if(RNA_struct_property_is_set(op->ptr, "value")) {
+ if (RNA_struct_property_is_set(op->ptr, "value")) {
return transform_exec(C, op);
}
else {
@@ -517,7 +517,7 @@ void TRANSFORM_OT_translate(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Translate";
- ot->description= "Translate selected items";
+ ot->description = "Translate selected items";
ot->idname = OP_TRANSLATION;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -525,7 +525,7 @@ void TRANSFORM_OT_translate(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_screenactive;
RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
@@ -537,7 +537,7 @@ void TRANSFORM_OT_resize(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Resize";
- ot->description= "Resize selected items";
+ ot->description = "Resize selected items";
ot->idname = OP_RESIZE;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -545,7 +545,7 @@ void TRANSFORM_OT_resize(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_screenactive;
RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
@@ -558,7 +558,7 @@ void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Trackball";
- ot->description= "Trackball style rotation of selected items";
+ ot->description = "Trackball style rotation of selected items";
ot->idname = OP_TRACKBALL;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -566,7 +566,7 @@ void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_screenactive;
RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
@@ -578,7 +578,7 @@ void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Rotate";
- ot->description= "Rotate selected items";
+ ot->description = "Rotate selected items";
ot->idname = OP_ROTATION;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -586,7 +586,7 @@ void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_screenactive;
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
@@ -601,7 +601,7 @@ void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
/* optionals -
* "Tilt selected vertices"
* "Specify an extra axis rotation for selected vertices of 3d curve" */
- ot->description= "Tilt selected control vertices of 3d curve";
+ ot->description = "Tilt selected control vertices of 3d curve";
ot->idname = OP_TILT;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -609,7 +609,7 @@ void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_editcurve_3d;
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
@@ -621,7 +621,7 @@ void TRANSFORM_OT_warp(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Warp";
- ot->description= "Warp selected items around the cursor";
+ ot->description = "Warp selected items around the cursor";
ot->idname = OP_WARP;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -629,7 +629,7 @@ void TRANSFORM_OT_warp(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_screenactive;
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
@@ -642,7 +642,7 @@ void TRANSFORM_OT_shear(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Shear";
- ot->description= "Shear selected items along the horizontal screen axis";
+ ot->description = "Shear selected items along the horizontal screen axis";
ot->idname = OP_SHEAR;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -650,7 +650,7 @@ void TRANSFORM_OT_shear(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_screenactive;
RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
@@ -663,7 +663,7 @@ void TRANSFORM_OT_push_pull(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Push/Pull";
- ot->description= "Push/Pull selected items";
+ ot->description = "Push/Pull selected items";
ot->idname = OP_PUSH_PULL;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -671,7 +671,7 @@ void TRANSFORM_OT_push_pull(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_screenactive;
RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX);
@@ -683,7 +683,7 @@ void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Shrink/Fatten";
- ot->description= "Shrink/fatten selected vertices along normals";
+ ot->description = "Shrink/fatten selected vertices along normals";
ot->idname = OP_SHRINK_FATTEN;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -691,7 +691,7 @@ void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_editmesh;
RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
@@ -704,7 +704,7 @@ void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
/* identifiers */
ot->name = "To Sphere";
//added "around mesh center" to differentiate between "MESH_OT_vertices_to_sphere()"
- ot->description= "Move selected vertices outward in a spherical shape around mesh center";
+ ot->description = "Move selected vertices outward in a spherical shape around mesh center";
ot->idname = OP_TOSPHERE;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -712,7 +712,7 @@ void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_screenactive;
RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1);
@@ -724,7 +724,7 @@ void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mirror";
- ot->description= "Mirror selected vertices around one or more axes";
+ ot->description = "Mirror selected vertices around one or more axes";
ot->idname = OP_MIRROR;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -732,7 +732,7 @@ void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_screenactive;
Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL);
@@ -742,7 +742,7 @@ void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Edge Slide";
- ot->description= "Slide an edge loop along a mesh";
+ ot->description = "Slide an edge loop along a mesh";
ot->idname = OP_EDGE_SLIDE;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -750,7 +750,7 @@ void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_editmesh;
RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
@@ -762,7 +762,7 @@ void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Edge Crease";
- ot->description= "Change the crease of edges";
+ ot->description = "Change the crease of edges";
ot->idname = OP_EDGE_CREASE;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -770,7 +770,7 @@ void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_editmesh;
RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
@@ -782,7 +782,7 @@ void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Sequence Slide";
- ot->description= "Slide a sequence strip in time";
+ ot->description = "Slide a sequence strip in time";
ot->idname = OP_SEQ_SLIDE;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -790,7 +790,7 @@ void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_sequencer_active;
RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
@@ -804,15 +804,15 @@ void TRANSFORM_OT_transform(struct wmOperatorType *ot)
/* identifiers */
ot->name = "Transform";
- ot->description= "Transform selected items by mode type";
+ ot->description = "Transform selected items by mode type";
ot->idname = "TRANSFORM_OT_transform";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* api callbacks */
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
- ot->cancel = transform_cancel;
+ ot->cancel = transform_cancel;
ot->poll = ED_operator_screenactive;
prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -897,19 +897,19 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
break;
case SPACE_ACTION:
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_TRANSLATE);
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_TRANSLATE);
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SCALE);
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SLIDE);
break;
case SPACE_IPO:
@@ -917,7 +917,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
@@ -925,24 +925,24 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
break;
case SPACE_NLA:
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TRANSLATION);
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TRANSLATION);
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SCALE);
break;
case SPACE_NODE:
WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
- kmi= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_A, KM_ANY, 0, 0);
+ 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);
+ 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);
@@ -961,7 +961,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
WM_keymap_add_item(keymap, OP_SEQ_SLIDE, EVT_TWEAK_S, KM_ANY, 0, 0);
- kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
break;
case SPACE_IMAGE:
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index ee5182c1a5f..d39be2fd7b5 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -38,6 +38,9 @@
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_armature.h"
#include "BKE_curve.h"
@@ -45,10 +48,6 @@
#include "BKE_tessmesh.h"
#include "BKE_report.h"
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
-
#include "BLF_translation.h"
//#include "BIF_editmesh.h"
@@ -75,7 +74,7 @@ void BIF_clearTransformOrientation(bContext *C)
BLI_freelistN(transform_spaces);
// Need to loop over all view3d
- if(v3d && v3d->twmode >= V3D_MANIP_CUSTOM) {
+ if (v3d && v3d->twmode >= V3D_MANIP_CUSTOM) {
v3d->twmode = V3D_MANIP_GLOBAL; /* fallback to global */
}
}
@@ -298,7 +297,7 @@ void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target)
for (i = 0, ts = transform_spaces->first; ts; ts = ts->next, i++) {
if (ts == target) {
View3D *v3d = CTX_wm_view3d(C);
- if(v3d) {
+ if (v3d) {
int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
// Transform_fix_me NEED TO DO THIS FOR ALL VIEW3D
@@ -324,7 +323,7 @@ void BIF_removeTransformOrientationIndex(bContext *C, int index)
if (ts) {
View3D *v3d = CTX_wm_view3d(C);
- if(v3d) {
+ if (v3d) {
int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
// Transform_fix_me NEED TO DO THIS FOR ALL VIEW3D
@@ -359,7 +358,7 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target)
void BIF_selectTransformOrientationValue(bContext *C, int orientation)
{
View3D *v3d = CTX_wm_view3d(C);
- if(v3d) /* currently using generic poll */
+ if (v3d) /* currently using generic poll */
v3d->twmode = orientation;
}
@@ -382,19 +381,19 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C)
RNA_enum_item_add(&item, &totitem, &local);
RNA_enum_item_add(&item, &totitem, &view);
- if(C) {
+ if (C) {
scene= CTX_data_scene(C);
- if(scene) {
+ if (scene) {
transform_spaces = &scene->transform_spaces;
ts = transform_spaces->first;
}
}
- if(ts)
+ if (ts)
RNA_enum_item_add_separator(&item, &totitem);
- for(; ts; ts = ts->next) {
+ for (; ts; ts = ts->next) {
tmp.identifier = "CUSTOM";
tmp.name= ts->name;
tmp.value = i++;
@@ -470,11 +469,11 @@ static int count_bone_select(bArmature *arm, ListBase *lb, int do_it)
int do_next;
int total = 0;
- for(bone= lb->first; bone; bone= bone->next) {
+ for (bone= lb->first; bone; bone= bone->next) {
bone->flag &= ~BONE_TRANSFORM;
do_next = do_it;
- if(do_it) {
- if(bone->layer & arm->layer) {
+ if (do_it) {
+ if (bone->layer & arm->layer) {
if (bone->flag & BONE_SELECTED) {
bone->flag |= BONE_TRANSFORM;
total++;
@@ -507,7 +506,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
}
/* no gimbal fallthrough to normal */
case V3D_MANIP_NORMAL:
- if(obedit || (ob && ob->mode & OB_MODE_POSE)) {
+ if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
strcpy(t->spacename, "normal");
ED_getTransformOrientationMatrix(C, t->spacemtx, (v3d->around == V3D_ACTIVE));
break;
@@ -516,10 +515,11 @@ void initTransformOrientation(bContext *C, TransInfo *t)
case V3D_MANIP_LOCAL:
strcpy(t->spacename, "local");
- if(ob) {
+ if (ob) {
copy_m3_m4(t->spacemtx, ob->obmat);
normalize_m3(t->spacemtx);
- } else {
+ }
+ else {
unit_m3(t->spacemtx);
}
@@ -599,7 +599,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
BMIter iter;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
add_v3_v3(normal, efa->no);
sub_v3_v3v3(vec,
BM_FACE_FIRST_LOOP(efa)->v->co,
@@ -640,7 +640,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
BMIter iter;
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
sub_v3_v3v3(plane, eed->v2->co, eed->v1->co);
break;
}
@@ -654,7 +654,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
BMIter iter;
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
/* use average vert normals as plane and edge vector as normal */
copy_v3_v3(plane, eed->v1->no);
add_v3_v3(plane, eed->v2->no);
@@ -698,7 +698,8 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
}
else if (em->bm->totvertsel > 3) {
BMIter iter;
- normal[0] = normal[1] = normal[2] = 0.0f;
+
+ zero_v3(normal);
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
@@ -722,7 +723,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
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) {
@@ -748,10 +749,9 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
result = ORIENTATION_NORMAL;
}
}
- else if(obedit->type==OB_MBALL){
+ else if (obedit->type==OB_MBALL) {
#if 0 // XXX
/* editmball.c */
- extern ListBase editelems; /* go away ! */
MetaElem *ml, *ml_sel = NULL;
/* loop and check that only one element is selected */
@@ -820,17 +820,17 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
mul_m3_v3(mat, plane);
}
}
- else if(ob && (ob->mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
bArmature *arm= ob->data;
bPoseChannel *pchan;
int totsel;
totsel = count_bone_select(arm, &arm->bonebase, 1);
- if(totsel) {
+ if (totsel) {
float imat[3][3], mat[3][3];
/* use channels to get stats */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if (pchan->bone && pchan->bone->flag & BONE_TRANSFORM) {
add_v3_v3(normal, pchan->pose_mat[2]);
add_v3_v3(plane, pchan->pose_mat[1]);
@@ -849,17 +849,17 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
result = ORIENTATION_EDGE;
}
}
- else if(ob && (ob->mode & (OB_MODE_ALL_PAINT|OB_MODE_PARTICLE_EDIT))) {
+ else if (ob && (ob->mode & (OB_MODE_ALL_PAINT|OB_MODE_PARTICLE_EDIT))) {
/* pass */
}
else {
/* we need the one selected object, if its not active */
ob = OBACT;
- if(ob && !(ob->flag & SELECT)) ob = NULL;
+ if (ob && !(ob->flag & SELECT)) ob = NULL;
- for(base= scene->base.first; base; base= base->next) {
+ for (base= scene->base.first; base; base= base->next) {
if TESTBASELIB(v3d, base) {
- if(ob == NULL) {
+ if (ob == NULL) {
ob= base->object;
break;
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index c4e871f83c5..7ad7b0f5c40 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -169,7 +169,8 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
for (p = t->tsnap.points.first; p; p = p->next) {
if (p == t->tsnap.selectedPoint) {
glColor4ubv(selectedCol);
- } else {
+ }
+ else {
glColor4ubv(col);
}
@@ -195,7 +196,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
glEnd();
}
- if(v3d->zbuf)
+ if (v3d->zbuf)
glEnable(GL_DEPTH_TEST);
}
else if (t->spacetype==SPACE_IMAGE) {
@@ -265,12 +266,12 @@ void applyProject(TransInfo *t)
float imat[4][4];
int i;
- if(t->flag & (T_EDIT|T_POSE)) {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob = t->obedit?t->obedit:t->poseobj;
invert_m4_m4(imat, ob->obmat);
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
float iloc[3], loc[3], no[3];
float mval[2];
int dist = 1000;
@@ -297,7 +298,7 @@ void applyProject(TransInfo *t)
if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect))
{
-// if(t->flag & (T_EDIT|T_POSE)) {
+// if (t->flag & (T_EDIT|T_POSE)) {
// mul_m4_v3(imat, loc);
// }
//
@@ -476,7 +477,7 @@ void initSnapping(TransInfo *t, wmOperator *op)
}
/* use scene defaults only when transform is modal */
else if (t->flag & T_MODAL) {
- if(ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) {
+ if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) {
if (ts->snap_flag & SCE_SNAP) {
t->modifiers |= MOD_SNAP;
}
@@ -569,7 +570,7 @@ int updateSelectedSnapPoint(TransInfo *t)
int closest_dist = 0;
int screen_loc[2];
- for( p = t->tsnap.points.first; p; p = p->next ) {
+ for ( p = t->tsnap.points.first; p; p = p->next ) {
int dx, dy;
int dist;
@@ -631,7 +632,8 @@ void getSnapPoint(TransInfo *t, float vec[3])
}
mul_v3_fl(vec, 1.0f / total);
- } else {
+ }
+ else {
copy_v3_v3(vec, t->tsnap.snapPoint);
}
}
@@ -681,7 +683,7 @@ static float RotationBetween(TransInfo *t, float p1[3], float p2[3])
float angle, start[3], end[3], center[3];
copy_v3_v3(center, t->center);
- 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, center);
}
@@ -737,7 +739,7 @@ static float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
float d1[3], d2[3], center[3], len_d1;
copy_v3_v3(center, t->center);
- 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, center);
}
@@ -785,7 +787,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
depth_peels.first = depth_peels.last = NULL;
- peelObjectsTransForm(t, &depth_peels, mval);
+ peelObjectsTransForm(t, &depth_peels, mval, t->tsnap.modeSelect);
// if (LAST_SNAP_POINT_VALID)
// {
@@ -897,7 +899,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
UI_view2d_region_to_view(&t->ar->v2d, t->mval[0], t->mval[1], co, co+1);
- if(ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint))
+ if (ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint))
{
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
t->tsnap.snapPoint[0] *= aspx;
@@ -919,7 +921,7 @@ static void TargetSnapCenter(TransInfo *t)
if ((t->tsnap.status & TARGET_INIT) == 0)
{
copy_v3_v3(t->tsnap.snapTarget, t->center);
- 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, t->tsnap.snapTarget);
}
@@ -937,7 +939,7 @@ static void TargetSnapActive(TransInfo *t)
TransData *active_td = NULL;
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++)
{
if (td->flag & TD_ACTIVE)
{
@@ -950,7 +952,7 @@ static void TargetSnapActive(TransInfo *t)
{
copy_v3_v3(t->tsnap.snapTarget, active_td->center);
- 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, t->tsnap.snapTarget);
}
@@ -978,14 +980,14 @@ 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);
}
mul_v3_fl(t->tsnap.snapTarget, 1.0 / i);
- 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, t->tsnap.snapTarget);
}
@@ -1005,7 +1007,7 @@ static void TargetSnapClosest(TransInfo *t)
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);
@@ -1050,13 +1052,13 @@ static void TargetSnapClosest(TransInfo *t)
}
else {
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++) {
float loc[3];
float dist;
copy_v3_v3(loc, td->center);
- 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, loc);
}
@@ -1278,7 +1280,7 @@ 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;
@@ -1381,9 +1383,9 @@ 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) {
+ if (hit.dist/local_scale <= *r_depth) {
*r_depth= hit.dist/local_scale;
copy_v3_v3(r_loc, hit.co);
copy_v3_v3(r_no, hit.no);
@@ -1413,7 +1415,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
EDBM_init_index_arrays(em, 0, 0, 1);
}
- for( i = 0; i < totface; i++) {
+ for ( i = 0; i < totface; i++) {
BMFace *efa = NULL;
MFace *f = faces + i;
@@ -1437,7 +1439,8 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
if (efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
{
test = 0;
- } else if (efa) {
+ }
+ else if (efa) {
BMIter iter;
BMLoop *l;
@@ -1493,7 +1496,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
EDBM_init_index_arrays(em, 1, 0, 0);
}
- for( i = 0; i < totvert; i++) {
+ for ( i = 0; i < totvert; i++) {
BMVert *eve = NULL;
MVert *v = verts + i;
@@ -1548,7 +1551,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
EDBM_init_index_arrays(em, 0, 1, 0);
}
- for( i = 0; i < totedge; i++) {
+ for ( i = 0; i < totedge; i++) {
BMEdge *eed = NULL;
MEdge *e = edges + i;
@@ -1670,7 +1673,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c
DupliObject *dupli_ob;
ListBase *lb = object_duplilist(scene, ob);
- for(dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
+ for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
{
Object *dob = dupli_ob->ob;
@@ -1792,7 +1795,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
MFace *faces = dm->getTessFaceArray(dm);
int i;
- for( i = 0; i < totface; i++) {
+ for ( i = 0; i < totface; i++) {
MFace *f = faces + i;
float lambda;
int result;
@@ -1862,7 +1865,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
return retval;
}
-static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase *depth_peels, const float mval[2])
+static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase *depth_peels, const float mval[2], SnapMode mode)
{
Base *base;
int retval = 0;
@@ -1874,16 +1877,16 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
if ( BASE_SELECTABLE(v3d, base) ) {
Object *ob = base->object;
+#if 0 //BMESH_TODO
if (ob->transflag & OB_DUPLI) {
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) {
-#if 0 //BMESH_TODO
EditMesh *em;
DerivedMesh *dm = NULL;
int val;
@@ -1903,33 +1906,32 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
retval = retval || val;
dm->release(dm);
-#endif
}
}
free_object_duplilist(lb);
}
+#endif
if (ob->type == OB_MESH) {
- BMEditMesh *em;
- DerivedMesh *dm = NULL;
- int val;
+ int val = 0;
- if (ob != obedit) {
- dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
+ if (ob != obedit && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT))) {
+ DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
val = peelDerivedMesh(ob, dm, ob->obmat, ray_start, ray_normal, mval, depth_peels);
+ dm->release(dm);
}
- else {
- em = BMEdit_FromObject(ob);
- dm = editbmesh_get_derived_cage(scene, obedit, em, CD_MASK_BAREMESH);
+ else if (ob == obedit && mode != SNAP_NOT_OBEDIT) {
+ BMEditMesh *em = BMEdit_FromObject(ob);
+ DerivedMesh *dm = editbmesh_get_derived_cage(scene, obedit, em, CD_MASK_BAREMESH);
val = peelDerivedMesh(ob, dm, ob->obmat, ray_start, ray_normal, mval, depth_peels);
+ dm->release(dm);
}
retval = retval || val;
- dm->release(dm);
}
}
}
@@ -1940,17 +1942,17 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
return retval;
}
-int peelObjectsTransForm(TransInfo *t, ListBase *depth_peels, const float mval[2])
+int peelObjectsTransForm(TransInfo *t, ListBase *depth_peels, const float mval[2], SnapMode mode)
{
- return peelObjects(t->scene, t->view, t->ar, t->obedit, depth_peels, mval);
+ return peelObjects(t->scene, t->view, t->ar, t->obedit, depth_peels, mval, mode);
}
-int peelObjectsContext(bContext *C, ListBase *depth_peels, const float mval[2])
+int peelObjectsContext(bContext *C, ListBase *depth_peels, const float mval[2], SnapMode mode)
{
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
- return peelObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), depth_peels, mval);
+ return peelObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), depth_peels, mval, mode);
}
/*================================================================*/
@@ -1993,7 +1995,7 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea
int i;
float asp[3] = {1.0f, 1.0f, 1.0f}; // TODO: Remove hard coded limit here (3)
- if(max_index > 2) {
+ if (max_index > 2) {
printf("applyGrid: invalid index %d, clamping\n", max_index);
max_index= 2;
}
@@ -2003,7 +2005,7 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea
return;
/* evil hack - snapping needs to be adapted for image aspect ratio */
- if((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
+ if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
ED_space_image_uv_aspect(t->sa->spacedata.first, asp, asp+1);
}
diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c
index 06309293f9a..cef440668e6 100644
--- a/source/blender/editors/util/crazyspace.c
+++ b/source/blender/editors/util/crazyspace.c
@@ -38,15 +38,15 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
+#include "BLI_utildefines.h"
+#include "BLI_math.h"
+
#include "BKE_DerivedMesh.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
#include "BKE_mesh.h"
#include "BKE_tessmesh.h"
-#include "BLI_utildefines.h"
-#include "BLI_math.h"
-
#include "ED_util.h"
typedef struct {
@@ -78,7 +78,7 @@ static void make_vertexcos__mapFunc(void *userData, int index, float *co, float
float *vec = mappedData->vertexcos;
vec+= 3*index;
- if(!mappedData->flags[index]) {
+ if (!mappedData->flags[index]) {
/* we need coord from prototype vertex, not it clones or images,
* suppose they stored in the beginning of vertex array stored in DM */
copy_v3_v3(vec, co);
@@ -91,9 +91,9 @@ static int modifiers_disable_subsurf_temporary(Object *ob)
ModifierData *md;
int disabled = 0;
- for(md=ob->modifiers.first; md; md=md->next)
- if(md->type==eModifierType_Subsurf)
- if(md->mode & eModifierMode_OnCage) {
+ for (md=ob->modifiers.first; md; md=md->next)
+ if (md->type==eModifierType_Subsurf)
+ if (md->mode & eModifierMode_OnCage) {
md->mode ^= eModifierMode_DisableTemporary;
disabled= 1;
}
@@ -112,7 +112,7 @@ float *crazyspace_get_mapped_editverts(Scene *scene, Object *obedit)
MappedUserData userData;
/* disable subsurf temporal, get mapped cos, and enable it */
- if(modifiers_disable_subsurf_temporary(obedit)) {
+ if (modifiers_disable_subsurf_temporary(obedit)) {
/* need to make new derivemesh */
makeDerivedMesh(scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH, 0);
}
@@ -194,13 +194,13 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped
intptr_t index= 0;
/* two abused locations in vertices */
- for(eve= em->verts.first; eve; eve= eve->next, index++) {
+ 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) {
+ for (efa= em->faces.first; efa; efa= efa->next) {
/* retrieve mapped coordinates */
v1= mappedcos + 3*(intptr_t)(efa->v1->prev);
@@ -211,39 +211,39 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped
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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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;
@@ -252,7 +252,7 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped
}
/* restore abused prev pointer */
- for(prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next)
+ for (prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next)
eve->prev= prev;
#endif
}
@@ -267,13 +267,13 @@ void crazyspace_set_quats_mesh(Mesh *me, float *origcos, float *mappedcos, float
float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4;
mvert= me->mvert;
- for(i=0; i<me->totvert; i++, mvert++)
+ for (i=0; i<me->totvert; i++, mvert++)
mvert->flag&= ~ME_VERT_TMP_TAG;
/* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
mvert= me->mvert;
mface= me->mface;
- for(i=0; i<me->totface; i++, mface++) {
+ for (i=0; i<me->totface; i++, mface++) {
/* retrieve mapped coordinates */
v1= mappedcos + 3*mface->v1;
@@ -284,34 +284,34 @@ void crazyspace_set_quats_mesh(Mesh *me, float *origcos, float *mappedcos, float
co2= (origcos)? origcos + 3*mface->v2: mvert[mface->v2].co;
co3= (origcos)? origcos + 3*mface->v3: mvert[mface->v3].co;
- if((mvert[mface->v2].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v2].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v2*4], co2, co3, co1, v2, v3, v1);
mvert[mface->v2].flag|= ME_VERT_TMP_TAG;
}
- if(mface->v4) {
+ if (mface->v4) {
v4= mappedcos + 3*mface->v4;
co4= (origcos)? origcos + 3*mface->v4: mvert[mface->v4].co;
- if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co4, v1, v2, v4);
mvert[mface->v1].flag|= ME_VERT_TMP_TAG;
}
- if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v3*4], co3, co4, co2, v3, v4, v2);
mvert[mface->v3].flag|= ME_VERT_TMP_TAG;
}
- if((mvert[mface->v4].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v4].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v4*4], co4, co1, co3, v4, v1, v3);
mvert[mface->v4].flag|= ME_VERT_TMP_TAG;
}
}
else {
- if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co3, v1, v2, v3);
mvert[mface->v1].flag|= ME_VERT_TMP_TAG;
}
- if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v3*4], co3, co1, co2, v3, v1, v2);
mvert[mface->v3].flag|= ME_VERT_TMP_TAG;
}
@@ -336,19 +336,19 @@ int editbmesh_get_first_deform_matrices(Scene *scene, Object *ob, BMEditMesh *em
/* compute the deformation matrices and coordinates for the first
* modifiers with on cage editing that are enabled and support computing
* deform matrices */
- for(i = 0; md && i <= cageIndex; i++, md = md->next) {
+ for (i = 0; md && i <= cageIndex; i++, md = md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- if(!editbmesh_modifier_is_enabled(scene, md, dm))
+ if (!editbmesh_modifier_is_enabled(scene, md, dm))
continue;
- if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) {
- if(!defmats) {
+ if (mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) {
+ if (!defmats) {
dm= getEditDerivedBMesh(em, ob, NULL);
deformedVerts= editbmesh_get_vertex_cos(em, &numVerts);
defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats");
- for(a=0; a<numVerts; a++)
+ for (a=0; a<numVerts; a++)
unit_m3(defmats[a]);
}
@@ -359,11 +359,11 @@ int editbmesh_get_first_deform_matrices(Scene *scene, Object *ob, BMEditMesh *em
break;
}
- for(; md && i <= cageIndex; md = md->next, i++)
- if(editbmesh_modifier_is_enabled(scene, md, dm) && modifier_isCorrectableDeformed(md))
+ for (; md && i <= cageIndex; md = md->next, i++)
+ if (editbmesh_modifier_is_enabled(scene, md, dm) && modifier_isCorrectableDeformed(md))
numleft++;
- if(dm)
+ if (dm)
dm->release(dm);
*deformmats= defmats;
@@ -382,7 +382,7 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma
int has_multires = mmd != NULL && mmd->sculptlvl > 0;
int numleft= 0;
- if(has_multires) {
+ if (has_multires) {
*deformmats= NULL;
*deformcos= NULL;
return numleft;
@@ -391,37 +391,37 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma
dm= NULL;
md= modifiers_getVirtualModifierList(ob);
- for(; md; md= md->next) {
+ for (; md; md= md->next) {
ModifierTypeInfo *mti= modifierType_getInfo(md->type);
- if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+ if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
- if(mti->type==eModifierTypeType_OnlyDeform) {
- if(!defmats) {
+ if (mti->type==eModifierTypeType_OnlyDeform) {
+ if (!defmats) {
Mesh *me= (Mesh*)ob->data;
dm= mesh_create_derived(me, ob, NULL);
deformedVerts= mesh_getVertexCos(me, &numVerts);
defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats");
- for(a=0; a<numVerts; a++)
+ for (a=0; a<numVerts; a++)
unit_m3(defmats[a]);
}
- if(mti->deformMatrices) mti->deformMatrices(md, ob, dm, deformedVerts, defmats, numVerts);
+ if (mti->deformMatrices) mti->deformMatrices(md, ob, dm, deformedVerts, defmats, numVerts);
else break;
}
}
- for(; md; md= md->next) {
+ for (; md; md= md->next) {
ModifierTypeInfo *mti= modifierType_getInfo(md->type);
- if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+ if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
- if(mti->type==eModifierTypeType_OnlyDeform)
+ if (mti->type==eModifierTypeType_OnlyDeform)
numleft++;
}
- if(dm)
+ if (dm)
dm->release(dm);
*deformmats= defmats;
@@ -434,7 +434,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
{
int totleft= sculpt_get_first_deform_matrices(scene, ob, deformmats, deformcos);
- if(totleft) {
+ if (totleft) {
/* there are deformation modifier which doesn't support deformation matrices
* calculation. Need additional crazyspace correction */
@@ -445,15 +445,15 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
ModifierData *md= modifiers_getVirtualModifierList(ob);
Mesh *me= (Mesh*)ob->data;
- for(; md; md= md->next) {
+ for (; md; md= md->next) {
ModifierTypeInfo *mti= modifierType_getInfo(md->type);
- if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+ if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
- if(mti->type==eModifierTypeType_OnlyDeform) {
+ if (mti->type==eModifierTypeType_OnlyDeform) {
/* skip leading modifiers which have been already
* handled in sculpt_get_first_deform_matrices */
- if(mti->deformMatrices && !deformed)
+ if (mti->deformMatrices && !deformed)
continue;
mti->deformVerts(md, ob, NULL, deformedVerts, me->totvert, 0, 0);
@@ -465,7 +465,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
crazyspace_set_quats_mesh(me, (float*)origVerts, (float*)deformedVerts, quats);
- for(i=0; i<me->totvert; i++) {
+ for (i=0; i<me->totvert; i++) {
float qmat[3][3], tmat[3][3];
quat_to_mat3(qmat, &quats[i*4]);
@@ -477,14 +477,14 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
MEM_freeN(quats);
}
- if(!*deformmats) {
+ if (!*deformmats) {
int a, numVerts;
Mesh *me= (Mesh*)ob->data;
*deformcos= mesh_getVertexCos(me, &numVerts);
*deformmats= MEM_callocN(sizeof(*(*deformmats))*numVerts, "defmats");
- for(a=0; a<numVerts; a++)
+ for (a=0; a<numVerts; a++)
unit_m3((*deformmats)[a]);
}
}
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 15dced2f448..fcf95047414 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -75,14 +75,14 @@ void ED_editors_init(bContext *C)
/* toggle on modes for objects that were saved with these enabled. for
* e.g. linked objects we have to ensure that they are actually the
* active object in this scene. */
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
int mode= ob->mode;
- if(mode && (mode != OB_MODE_POSE)) {
+ if (mode && (mode != OB_MODE_POSE)) {
ob->mode= 0;
data= ob->data;
- if(ob == obact && !ob->id.lib && !(data && data->lib))
+ if (ob == obact && !ob->id.lib && !(data && data->lib))
ED_object_toggle_modes(C, mode);
}
}
@@ -94,27 +94,27 @@ void ED_editors_exit(bContext *C)
Main *bmain= CTX_data_main(C);
Scene *sce;
- if(!bmain)
+ if (!bmain)
return;
/* frees all editmode undos */
undo_editmode_clear();
ED_undo_paint_free();
- for(sce=bmain->scene.first; sce; sce= sce->id.next) {
- if(sce->obedit) {
+ for (sce=bmain->scene.first; sce; sce= sce->id.next) {
+ if (sce->obedit) {
Object *ob= sce->obedit;
- if(ob) {
- if(ob->type==OB_MESH) {
+ if (ob) {
+ if (ob->type==OB_MESH) {
Mesh *me= ob->data;
- if(me->edit_btmesh) {
+ if (me->edit_btmesh) {
EDBM_FreeEditBMesh(me->edit_btmesh);
MEM_freeN(me->edit_btmesh);
me->edit_btmesh= NULL;
}
}
- else if(ob->type==OB_ARMATURE) {
+ else if (ob->type==OB_ARMATURE) {
ED_armature_edit_free(ob);
}
}
@@ -135,17 +135,17 @@ void ED_editors_exit(bContext *C)
void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert)
{
/* fac1 is for 'nothing', fac2 for CTRL, fac3 for SHIFT */
- if(invert)
+ if (invert)
ctrl= !ctrl;
- if(ctrl && shift) {
- if(fac3 != 0.0f) *val= fac3*floorf(*val/fac3 +0.5f);
+ if (ctrl && shift) {
+ if (fac3 != 0.0f) *val= fac3*floorf(*val/fac3 +0.5f);
}
- else if(ctrl) {
- if(fac2 != 0.0f) *val= fac2*floorf(*val/fac2 +0.5f);
+ else if (ctrl) {
+ if (fac2 != 0.0f) *val= fac2*floorf(*val/fac2 +0.5f);
}
else {
- if(fac1 != 0.0f) *val= fac1*floorf(*val/fac1 +0.5f);
+ if (fac1 != 0.0f) *val= fac1*floorf(*val/fac1 +0.5f);
}
}
@@ -176,13 +176,13 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
RNA_enum_set(&props_ptr, "method", PF_REMOVE);
RNA_string_set(&props_ptr, "id", id_name);
- if(G.relbase_valid) {
+ if (G.relbase_valid) {
char local_name[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX];
BLI_strncpy(local_name, abs_name, sizeof(local_name));
BLI_splitdirstring(local_name, fi);
BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi);
- if(strcmp(abs_name, local_name)!=0) {
+ if (strcmp(abs_name, local_name)!=0) {
switch(checkPackedFile(local_name, pf)) {
case PF_NOFILE:
BLI_snprintf(line, sizeof(line), "Create %s", local_name);
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 8c0eb06be67..4416228e2d3 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -107,7 +107,7 @@ static UndoElem *curundo= NULL;
static void undo_restore(UndoElem *undo, void *editdata, void *obdata)
{
- if(undo) {
+ if (undo) {
undo->to_editmode(undo->undodata, editdata, obdata);
}
}
@@ -130,7 +130,7 @@ void undo_editmode_push(bContext *C, const char *name,
* this was giving conflicts for example when mesh changed due to keys or apply */
/* remove all undos after (also when curundo==NULL) */
- while(undobase.last != curundo) {
+ while (undobase.last != curundo) {
uel= undobase.last;
uel->freedata(uel->undodata);
BLI_freelinkN(&undobase, uel);
@@ -150,13 +150,13 @@ void undo_editmode_push(bContext *C, const char *name,
/* limit amount to the maximum amount*/
nr= 0;
uel= undobase.last;
- while(uel) {
+ while (uel) {
nr++;
- if(nr==U.undosteps) break;
+ if (nr==U.undosteps) break;
uel= uel->prev;
}
- if(uel) {
- while(undobase.first!=uel) {
+ if (uel) {
+ while (undobase.first!=uel) {
UndoElem *first= undobase.first;
first->freedata(first->undodata);
BLI_freelinkN(&undobase, first);
@@ -172,23 +172,23 @@ void undo_editmode_push(bContext *C, const char *name,
curundo->id= obedit->id;
curundo->type= obedit->type;
- if(U.undomemory != 0) {
+ if (U.undomemory != 0) {
/* limit to maximum memory (afterwards, we can't know in advance) */
totmem= 0;
maxmem= ((uintptr_t)U.undomemory)*1024*1024;
uel= undobase.last;
- while(uel && uel->prev) {
+ while (uel && uel->prev) {
totmem+= uel->undosize;
- if(totmem>maxmem) break;
+ if (totmem>maxmem) break;
uel= uel->prev;
}
- if(uel) {
- if(uel->prev && uel->prev->prev)
+ if (uel) {
+ if (uel->prev && uel->prev->prev)
uel= uel->prev;
- while(undobase.first!=uel) {
+ while (undobase.first!=uel) {
UndoElem *first= undobase.first;
first->freedata(first->undodata);
BLI_freelinkN(&undobase, first);
@@ -207,24 +207,24 @@ static void undo_clean_stack(bContext *C)
/* side effect: when deleting/renaming object and start editing new one with same name */
uel= undobase.first;
- while(uel) {
+ while (uel) {
void *editdata= uel->getdata(C);
int isvalid= 0;
next= uel->next;
/* for when objects are converted, renamed, or global undo changes pointers... */
- if(uel->type==obedit->type) {
- if(strcmp(uel->id.name, obedit->id.name)==0) {
- if(uel->validate_undo==NULL)
+ if (uel->type==obedit->type) {
+ if (strcmp(uel->id.name, obedit->id.name)==0) {
+ if (uel->validate_undo==NULL)
isvalid= 1;
- else if(uel->validate_undo(uel->undodata, editdata))
+ else if (uel->validate_undo(uel->undodata, editdata))
isvalid= 1;
}
}
- if(isvalid)
+ if (isvalid)
uel->ob= obedit;
else {
- if(uel == curundo)
+ if (uel == curundo)
curundo= NULL;
uel->freedata(uel->undodata);
@@ -234,7 +234,7 @@ static void undo_clean_stack(bContext *C)
uel= next;
}
- if(curundo == NULL) curundo= undobase.last;
+ if (curundo == NULL) curundo= undobase.last;
}
/* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */
@@ -245,14 +245,14 @@ void undo_editmode_step(bContext *C, int step)
/* prevent undo to happen on wrong object, stack can be a mix */
undo_clean_stack(C);
- if(step==0) {
+ if (step==0) {
undo_restore(curundo, curundo->getdata(C), obedit->data);
}
- else if(step==1) {
+ else if (step==1) {
- if(curundo==NULL || curundo->prev==NULL) error("No more steps to undo");
+ if (curundo==NULL || curundo->prev==NULL) error("No more steps to undo");
else {
- if(G.f & G_DEBUG) printf("undo %s\n", curundo->name);
+ if (G.f & G_DEBUG) printf("undo %s\n", curundo->name);
curundo= curundo->prev;
undo_restore(curundo, curundo->getdata(C), obedit->data);
}
@@ -260,16 +260,16 @@ void undo_editmode_step(bContext *C, int step)
else {
/* curundo has to remain current situation! */
- if(curundo==NULL || curundo->next==NULL) error("No more steps to redo");
+ if (curundo==NULL || curundo->next==NULL) error("No more steps to redo");
else {
undo_restore(curundo->next, curundo->getdata(C), obedit->data);
curundo= curundo->next;
- if(G.f & G_DEBUG) printf("redo %s\n", curundo->name);
+ if (G.f & G_DEBUG) printf("redo %s\n", curundo->name);
}
}
/* special case for editmesh, mode must be copied back to the scene */
- if(obedit->type == OB_MESH) {
+ if (obedit->type == OB_MESH) {
EDBM_selectmode_to_scene(C);
}
@@ -283,7 +283,7 @@ void undo_editmode_clear(void)
UndoElem *uel;
uel= undobase.first;
- while(uel) {
+ while (uel) {
uel->freedata(uel->undodata);
uel= uel->next;
}
@@ -297,8 +297,8 @@ void undo_editmode_number(bContext *C, int nr)
UndoElem *uel;
int a=1;
- for(uel= undobase.first; uel; uel= uel->next, a++) {
- if(a==nr) break;
+ for (uel= undobase.first; uel; uel= uel->next, a++) {
+ if (a==nr) break;
}
curundo= uel;
undo_editmode_step(C, 0);
@@ -308,11 +308,11 @@ void undo_editmode_name(bContext *C, const char *undoname)
{
UndoElem *uel;
- for(uel= undobase.last; uel; uel= uel->prev) {
- if(strcmp(undoname, uel->name)==0)
+ for (uel= undobase.last; uel; uel= uel->prev) {
+ if (strcmp(undoname, uel->name)==0)
break;
}
- if(uel && uel->prev) {
+ if (uel && uel->prev) {
curundo= uel->prev;
undo_editmode_step(C, 0);
}
@@ -321,11 +321,11 @@ void undo_editmode_name(bContext *C, const char *undoname)
/* undoname optionally, if NULL it just checks for existing undo steps */
int undo_editmode_valid(const char *undoname)
{
- if(undoname) {
+ if (undoname) {
UndoElem *uel;
- for(uel= undobase.last; uel; uel= uel->prev) {
- if(strcmp(undoname, uel->name)==0)
+ for (uel= undobase.last; uel; uel= uel->prev) {
+ if (strcmp(undoname, uel->name)==0)
break;
}
return uel != NULL;
@@ -343,11 +343,11 @@ const char *undo_editmode_get_name(bContext *C, int nr, int *active)
/* prevent wrong numbers to be returned */
undo_clean_stack(C);
- if(active) *active= 0;
+ if (active) *active= 0;
uel= BLI_findlink(&undobase, nr);
- if(uel) {
- if(active && uel==curundo)
+ if (uel) {
+ if (active && uel==curundo)
*active= 1;
return uel->name;
}
@@ -358,6 +358,6 @@ const char *undo_editmode_get_name(bContext *C, int nr, int *active)
void *undo_editmode_get_prev(Object *ob)
{
UndoElem *ue= undobase.last;
- if(ue && ue->prev && ue->prev->ob==ob) return ue->prev->undodata;
+ if (ue && ue->prev && ue->prev->ob==ob) return ue->prev->undodata;
return NULL;
}
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index a477a11e6c7..1d9e053376a 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -84,7 +84,7 @@ void outputNumInput(NumInput *n, char *str)
else
inv[0] = 0;
- if( n->val[i] > 1e10f || n->val[i] < -1e10f )
+ if ( n->val[i] > 1e10f || n->val[i] < -1e10f )
BLI_snprintf(&str[j*20], 20, "%s%.4e%c", inv, n->val[i], cur);
else
switch (n->ctrl[i]) {
@@ -181,7 +181,8 @@ char handleNumInput(NumInput *n, wmEvent *event)
default:
return 0;
}
- } else {
+ }
+ else {
switch (event->type) {
case BACKSPACEKEY:
if (n->ctrl[idx] == 0) {
@@ -217,7 +218,7 @@ char handleNumInput(NumInput *n, wmEvent *event)
}
break;
case PADMINUS:
- if(event->alt)
+ if (event->alt)
break;
case MINUSKEY:
if (n->flag & NUM_NO_NEGATIVE)
@@ -289,7 +290,7 @@ char handleNumInput(NumInput *n, wmEvent *event)
}
else {
/* float resolution breaks when over six digits after comma */
- if( ABS(n->ctrl[idx]) < 10000000) {
+ if ( ABS(n->ctrl[idx]) < 10000000) {
n->val[idx] += Val / (float)n->ctrl[idx];
n->ctrl[idx] *= 10;
}
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index d3049e97f9e..e46fe19d306 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -87,7 +87,7 @@ void ED_undo_push(bContext *C, const char *str)
if (G.f & G_DEBUG)
printf("undo push %s\n", str);
- if(obedit) {
+ if (obedit) {
#ifdef BMESH_EM_UNDO_RECALC_TESSFACE_WORKAROUND
/* undo is causing tessface recalc, so without we need to do explicitly */
@@ -103,7 +103,7 @@ void ED_undo_push(bContext *C, const char *str)
if (U.undosteps == 0) return;
- if(obedit->type==OB_MESH)
+ if (obedit->type==OB_MESH)
undo_push_mesh(C, str);
else if ELEM(obedit->type, OB_CURVE, OB_SURF)
undo_push_curve(C, str);
@@ -116,17 +116,17 @@ void ED_undo_push(bContext *C, const char *str)
else if (obedit->type==OB_ARMATURE)
undo_push_armature(C, str);
}
- else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
+ else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
if (U.undosteps == 0) return;
PE_undo_push(CTX_data_scene(C), str);
}
else {
- if(U.uiflag & USER_GLOBALUNDO)
+ if (U.uiflag & USER_GLOBALUNDO)
BKE_write_undo(C, str);
}
- if(wm->file_saved) {
+ if (wm->file_saved) {
wm->file_saved= 0;
/* notifier that data changed, for save-over warning or header */
WM_event_add_notifier(C, NC_WM|ND_DATACHANGED, NULL);
@@ -147,16 +147,16 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
}
/* grease pencil can be can be used in plenty of spaces, so check it first */
- if(ED_gpencil_session_active()) {
+ if (ED_gpencil_session_active()) {
return ED_undo_gpencil_step(C, step, undoname);
}
- if(sa && sa->spacetype==SPACE_IMAGE) {
+ if (sa && sa->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
- if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
- if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname)
- if(U.uiflag & USER_GLOBALUNDO)
+ if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
+ if (!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname)
+ if (U.uiflag & USER_GLOBALUNDO)
BKE_undo_name(C, undoname);
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -164,12 +164,12 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
}
}
- if(sa && sa->spacetype==SPACE_TEXT) {
+ if (sa && sa->spacetype==SPACE_TEXT) {
ED_text_undo_step(C, step);
}
- else if(obedit) {
+ else if (obedit) {
if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) {
- if(undoname)
+ if (undoname)
undo_editmode_name(C, undoname);
else
undo_editmode_step(C, step);
@@ -180,16 +180,16 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
else {
int do_glob_undo= 0;
- if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
- if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname))
+ if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
+ if (!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname))
do_glob_undo= 1;
}
- else if(obact && obact->mode & OB_MODE_SCULPT) {
- if(!ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname))
+ else if (obact && obact->mode & OB_MODE_SCULPT) {
+ if (!ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname))
do_glob_undo= 1;
}
- else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
- if(step==1)
+ else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
+ if (step==1)
PE_undo(CTX_data_scene(C));
else
PE_redo(CTX_data_scene(C));
@@ -198,13 +198,13 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
do_glob_undo= 1;
}
- if(do_glob_undo) {
- if(U.uiflag & USER_GLOBALUNDO) {
+ if (do_glob_undo) {
+ if (U.uiflag & USER_GLOBALUNDO) {
// note python defines not valid here anymore.
//#ifdef WITH_PYTHON
// XXX BPY_scripts_clear_pyobjects();
//#endif
- if(undoname)
+ if (undoname)
BKE_undo_name(C, undoname);
else
BKE_undo_step(C, step);
@@ -248,18 +248,18 @@ int ED_undo_valid(const bContext *C, const char *undoname)
Object *obact= CTX_data_active_object(C);
ScrArea *sa= CTX_wm_area(C);
- if(sa && sa->spacetype==SPACE_IMAGE) {
+ if (sa && sa->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
- if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
+ if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
return 1;
}
}
- if(sa && sa->spacetype==SPACE_TEXT) {
+ if (sa && sa->spacetype==SPACE_TEXT) {
return 1;
}
- else if(obedit) {
+ else if (obedit) {
if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) {
return undo_editmode_valid(undoname);
}
@@ -268,19 +268,19 @@ int ED_undo_valid(const bContext *C, const char *undoname)
/* if below tests fail, global undo gets executed */
- if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
- if( ED_undo_paint_valid(UNDO_PAINT_IMAGE, undoname) )
+ if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
+ if ( ED_undo_paint_valid(UNDO_PAINT_IMAGE, undoname) )
return 1;
}
- else if(obact && obact->mode & OB_MODE_SCULPT) {
- if( ED_undo_paint_valid(UNDO_PAINT_MESH, undoname) )
+ else if (obact && obact->mode & OB_MODE_SCULPT) {
+ if ( ED_undo_paint_valid(UNDO_PAINT_MESH, undoname) )
return 1;
}
- else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
+ else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
return PE_undo_valid(CTX_data_scene(C));
}
- if(U.uiflag & USER_GLOBALUNDO) {
+ if (U.uiflag & USER_GLOBALUNDO) {
return BKE_undo_valid(undoname);
}
}
@@ -313,26 +313,26 @@ static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op))
void ED_OT_undo(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Undo";
- ot->description= "Undo previous action";
- ot->idname= "ED_OT_undo";
+ ot->name = "Undo";
+ ot->description = "Undo previous action";
+ ot->idname = "ED_OT_undo";
/* api callbacks */
- ot->exec= ed_undo_exec;
- ot->poll= ED_operator_screenactive;
+ ot->exec = ed_undo_exec;
+ ot->poll = ED_operator_screenactive;
}
void ED_OT_undo_push(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Undo Push";
- ot->description= "Add an undo state (internal use only)";
- ot->idname= "ED_OT_undo_push";
+ ot->name = "Undo Push";
+ ot->description = "Add an undo state (internal use only)";
+ ot->idname = "ED_OT_undo_push";
/* api callbacks */
- ot->exec= ed_undo_push_exec;
+ ot->exec = ed_undo_push_exec;
- ot->flag= OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_INTERNAL;
RNA_def_string(ot->srna, "message", "Add an undo step *function may be moved*", MAXUNDONAME, "Undo Message", "");
}
@@ -340,13 +340,13 @@ void ED_OT_undo_push(wmOperatorType *ot)
void ED_OT_redo(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Redo";
- ot->description= "Redo previous action";
- ot->idname= "ED_OT_redo";
+ ot->name = "Redo";
+ ot->description = "Redo previous action";
+ ot->idname = "ED_OT_redo";
/* api callbacks */
- ot->exec= ed_redo_exec;
- ot->poll= ED_operator_screenactive;
+ ot->exec = ed_redo_exec;
+ ot->poll = ED_operator_screenactive;
}
@@ -355,14 +355,14 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
{
int ret= 0;
- if(op) {
+ if (op) {
wmWindowManager *wm= CTX_wm_manager(C);
struct Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C);
ARegion *ar1= BKE_area_find_region_type(CTX_wm_area(C), RGN_TYPE_WINDOW);
- if(ar1)
+ if (ar1)
CTX_wm_region_set(C, ar1);
if ( (WM_operator_repeat_check(C, op)) &&
@@ -380,12 +380,12 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
printf("redo_cb: operator redo %s\n", op->type->name);
ED_undo_pop_op(C, op);
- if(op->type->check) {
+ if (op->type->check) {
op->type->check(C, op); /* ignore return value since its running again anyway */
}
retval= WM_operator_repeat(C, op);
- if((retval & OPERATOR_FINISHED)==0) {
+ if ((retval & OPERATOR_FINISHED)==0) {
if (G.f & G_DEBUG)
printf("redo_cb: operator redo failed: %s, return %d\n", op->type->name, retval);
ED_undo_redo(C);
@@ -435,16 +435,16 @@ static int get_undo_system(bContext *C)
Object *obedit= CTX_data_edit_object(C);
/* find out which undo system */
- if(obedit) {
+ if (obedit) {
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);
- if(obact && obact->mode & OB_MODE_PARTICLE_EDIT)
+ if (obact && obact->mode & OB_MODE_PARTICLE_EDIT)
return UNDOSYSTEM_PARTICLE;
- else if(U.uiflag & USER_GLOBALUNDO)
+ else if (U.uiflag & USER_GLOBALUNDO)
return UNDOSYSTEM_GLOBAL;
}
@@ -457,22 +457,22 @@ static EnumPropertyItem *rna_undo_itemf(bContext *C, int undosys, int *totitem)
EnumPropertyItem item_tmp= {0}, *item= NULL;
int active, i= 0;
- while(TRUE) {
+ while (TRUE) {
const char *name= NULL;
- if(undosys==UNDOSYSTEM_PARTICLE) {
+ if (undosys==UNDOSYSTEM_PARTICLE) {
name= PE_undo_get_name(CTX_data_scene(C), i, &active);
}
- else if(undosys==UNDOSYSTEM_EDITMODE) {
+ else if (undosys==UNDOSYSTEM_EDITMODE) {
name= undo_editmode_get_name(C, i, &active);
}
else {
name= BKE_undo_get_name(i, &active);
}
- if(name) {
+ if (name) {
item_tmp.identifier= item_tmp.name= name;
- if(active)
+ if (active)
item_tmp.icon= ICON_RESTRICT_VIEW_OFF;
else
item_tmp.icon= ICON_NONE;
@@ -495,19 +495,19 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
undosys= get_undo_system(C);
- if(undosys) {
+ if (undosys) {
EnumPropertyItem *item= rna_undo_itemf(C, undosys, &totitem);
- if(totitem > 0) {
+ if (totitem > 0) {
uiPopupMenu *pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
uiLayout *layout= uiPupMenuLayout(pup);
uiLayout *split= uiLayoutSplit(layout, 0, 0), *column = NULL;
int i, c;
- for(c=0, i=totitem-1; i >= 0; i--, c++) {
- if( (c % 20)==0 )
+ for (c=0, i=totitem-1; i >= 0; i--, c++) {
+ if ( (c % 20)==0 )
column= uiLayoutColumn(split, 0);
- if(item[i].identifier)
+ if (item[i].identifier)
uiItemIntO(column, item[i].name, item[i].icon, op->type->idname, "item", item[i].value);
}
@@ -524,14 +524,14 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
/* note: also check ed_undo_step() in top if you change notifiers */
static int undo_history_exec(bContext *C, wmOperator *op)
{
- if(RNA_struct_property_is_set(op->ptr, "item")) {
+ if (RNA_struct_property_is_set(op->ptr, "item")) {
int undosys= get_undo_system(C);
int item= RNA_int_get(op->ptr, "item");
- if(undosys==UNDOSYSTEM_PARTICLE) {
+ if (undosys==UNDOSYSTEM_PARTICLE) {
PE_undo_number(CTX_data_scene(C), item);
}
- else if(undosys==UNDOSYSTEM_EDITMODE) {
+ else if (undosys==UNDOSYSTEM_EDITMODE) {
undo_editmode_number(C, item+1);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, NULL);
}
@@ -549,14 +549,14 @@ static int undo_history_exec(bContext *C, wmOperator *op)
void ED_OT_undo_history(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Undo History";
- ot->description= "Redo specific action in history";
- ot->idname= "ED_OT_undo_history";
+ ot->name = "Undo History";
+ ot->description = "Redo specific action in history";
+ ot->idname = "ED_OT_undo_history";
/* api callbacks */
- ot->invoke= undo_history_invoke;
- ot->exec= undo_history_exec;
- ot->poll= ED_operator_screenactive;
+ ot->invoke = undo_history_invoke;
+ ot->exec = undo_history_exec;
+ ot->poll = ED_operator_screenactive;
RNA_def_int(ot->srna, "item", 0, 0, INT_MAX, "Item", "", 0, INT_MAX);
diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c
index a45a3555b51..ff673fa0eab 100644
--- a/source/blender/editors/uvedit/uvedit_buttons.c
+++ b/source/blender/editors/uvedit/uvedit_buttons.c
@@ -81,7 +81,7 @@ static int uvedit_center(Scene *scene, BMEditMesh *em, Image *UNUSED(ima), float
}
}
- if(tot > 0) {
+ if (tot > 0) {
center[0] /= tot;
center[1] /= tot;
}
@@ -124,15 +124,15 @@ static void uvedit_vertex_buttons(const bContext *C, uiBlock *block)
em = BMEdit_FromObject(obedit);
- if(uvedit_center(scene, em, ima, center)) {
+ if (uvedit_center(scene, em, ima, center)) {
copy_v2_v2(uvedit_old_center, center);
- if(!(sima->flag & SI_COORDFLOATS)) {
+ if (!(sima->flag & SI_COORDFLOATS)) {
uvedit_old_center[0] *= imx;
uvedit_old_center[1] *= imy;
}
- if(sima->flag & SI_COORDFLOATS) {
+ if (sima->flag & SI_COORDFLOATS) {
step= 1;
digits= 3;
}
@@ -158,7 +158,7 @@ static void do_uvedit_vertex(bContext *C, void *UNUSED(arg), int event)
float center[2], delta[2];
int imx, imy;
- if(event != B_UVEDIT_VERTEX)
+ if (event != B_UVEDIT_VERTEX)
return;
em = BMEdit_FromObject(obedit);
@@ -166,7 +166,7 @@ static void do_uvedit_vertex(bContext *C, void *UNUSED(arg), int event)
ED_space_image_size(sima, &imx, &imy);
uvedit_center(scene, em, ima, center);
- if(sima->flag & SI_COORDFLOATS) {
+ if (sima->flag & SI_COORDFLOATS) {
delta[0]= uvedit_old_center[0] - center[0];
delta[1]= uvedit_old_center[1] - center[1];
}
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index 66ba28e70a6..6767d543c5e 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -112,10 +112,10 @@ static int draw_uvs_face_check(Scene *scene)
ToolSettings *ts= scene->toolsettings;
/* checks if we are selecting only faces */
- if(ts->uv_flag & UV_SYNC_SELECTION) {
- if(ts->selectmode == SCE_SELECT_FACE)
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->selectmode == SCE_SELECT_FACE)
return 2;
- else if(ts->selectmode & SCE_SELECT_FACE)
+ else if (ts->selectmode & SCE_SELECT_FACE)
return 1;
else
return 0;
@@ -152,7 +152,7 @@ static int draw_uvs_dm_shadow(DerivedMesh *dm)
{
/* draw shadow mesh - this is the mesh with the modifier applied */
- if(dm && dm->drawUVEdges && CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) {
+ if (dm && dm->drawUVEdges && CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) {
glColor3ub(112, 112, 112);
dm->drawUVEdges(dm);
return 1;
@@ -204,22 +204,22 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
//totuvarea += tf_area(tf, efa->v4!=0);
totuvarea += poly_uv_area(tf_uv, efa->len);
- if(uvedit_face_visible(scene, ima, efa, tf)) {
+ if (uvedit_face_visible(scene, ima, efa, tf)) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
}
else {
- if(tf == activetf)
+ if (tf == activetf)
activetf= NULL;
BM_elem_flag_disable(efa, BM_ELEM_TAG);
}
}
- if(totarea < FLT_EPSILON || totuvarea < FLT_EPSILON) {
+ if (totarea < FLT_EPSILON || totuvarea < FLT_EPSILON) {
col[0] = 1.0;
col[1] = col[2] = 0.0;
glColor3fv(col);
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(BM_elem_flag_test(efa, BM_ELEM_TAG)) {
+ if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
glBegin(GL_POLYGON);
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
@@ -231,7 +231,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
}
else {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(BM_elem_flag_test(efa, BM_ELEM_TAG)) {
+ if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
area = BM_face_area_calc(em->bm, efa) / totarea;
BLI_array_empty(tf_uv);
@@ -253,9 +253,9 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
//uvarea = tf_area(tf, efa->v4!=0) / totuvarea;
uvarea = poly_uv_area(tf_uv, efa->len) / totuvarea;
- if(area < FLT_EPSILON || uvarea < FLT_EPSILON)
+ if (area < FLT_EPSILON || uvarea < FLT_EPSILON)
areadiff = 1.0f;
- else if(area>uvarea)
+ else if (area>uvarea)
areadiff = 1.0f-(uvarea/area);
else
areadiff = 1.0f-(area/uvarea);
@@ -286,13 +286,13 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
glShadeModel(GL_SMOOTH);
- for(efa= em->faces.first; efa; efa= efa->next) {
+ for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->head.data, CD_MTFACE);
- if(uvedit_face_visible(scene, ima, efa, tf)) {
+ if (uvedit_face_visible(scene, ima, efa, tf)) {
efa->tmp.p = tf;
uv_copy_aspect(tf->uv, tf_uv, aspx, aspy);
- if(efa->v4) {
+ if (efa->v4) {
#if 0 /* Simple but slow, better reuse normalized vectors */
uvang1 = RAD2DEG(angle_v2v2v2(tf_uv[3], tf_uv[0], tf_uv[1]));
@@ -410,7 +410,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
glEnd();
}
else {
- if(tf == activetf)
+ if (tf == activetf)
activetf= NULL;
efa->tmp.p = NULL;
}
@@ -430,24 +430,24 @@ static void draw_uvs_other(Scene *scene, Object *obedit, Image *curimage)
glColor3ub(96, 96, 96);
- for(base=scene->base.first; base; base=base->next) {
+ for (base=scene->base.first; base; base=base->next) {
Object *ob= base->object;
- if(!(base->flag & SELECT)) continue;
- if(!(base->lay & scene->lay)) continue;
- if(ob->restrictflag & OB_RESTRICT_VIEW) continue;
+ if (!(base->flag & SELECT)) continue;
+ if (!(base->lay & scene->lay)) continue;
+ if (ob->restrictflag & OB_RESTRICT_VIEW) continue;
- if((ob->type==OB_MESH) && (ob!=obedit)) {
+ if ((ob->type==OB_MESH) && (ob!=obedit)) {
Mesh *me= ob->data;
- if(me->mtface) {
+ if (me->mtface) {
MPoly *mface= me->mpoly;
MTexPoly *tface= me->mtpoly;
MLoopUV *mloopuv;
int a, b;
- for(a=me->totpoly; a>0; a--, tface++, mface++) {
- if(tface->tpage == curimage) {
+ for (a=me->totpoly; a>0; a--, tface++, mface++) {
+ if (tface->tpage == curimage) {
glBegin(GL_LINE_LOOP);
mloopuv = me->mloopuv + mface->loopstart;
@@ -467,19 +467,19 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, Object *ob)
Mesh *me= ob->data;
Image *curimage = ED_space_image(sima);
- if(sima->flag & SI_DRAW_OTHER)
+ if (sima->flag & SI_DRAW_OTHER)
draw_uvs_other(scene, ob, curimage);
glColor3ub(112, 112, 112);
- if(me->mtface) {
+ if (me->mtface) {
MPoly *mface= me->mpoly;
MTexPoly *tface= me->mtpoly;
MLoopUV *mloopuv;
int a, b;
- for(a=me->totpoly; a>0; a--, tface++, mface++) {
- if(tface->tpage == curimage) {
+ for (a=me->totpoly; a>0; a--, tface++, mface++) {
+ if (tface->tpage == curimage) {
glBegin(GL_LINE_LOOP);
mloopuv = me->mloopuv + mface->loopstart;
@@ -517,13 +517,13 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
ts= scene->toolsettings;
drawfaces= draw_uvs_face_check(scene);
- if(ts->uv_flag & UV_SYNC_SELECTION)
+ if (ts->uv_flag & UV_SYNC_SELECTION)
interpedges= (ts->selectmode & SCE_SELECT_VERTEX);
else
interpedges= (ts->uv_selectmode == UV_SELECT_VERTEX);
/* draw other uvs */
- if(sima->flag & SI_DRAW_OTHER) {
+ if (sima->flag & SI_DRAW_OTHER) {
Image *curimage= (activetf)? activetf->tpage: NULL;
draw_uvs_other(scene, obedit, curimage);
@@ -531,29 +531,29 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
/* 1. draw shadow mesh */
- if(sima->flag & SI_DRAWSHADOW) {
+ if (sima->flag & SI_DRAWSHADOW) {
/* first try existing derivedmesh */
- if(!draw_uvs_dm_shadow(em->derivedFinal)) {
+ if (!draw_uvs_dm_shadow(em->derivedFinal)) {
/* create one if it does not exist */
cagedm = editbmesh_get_derived_cage_and_final(scene, obedit, me->edit_btmesh, &finaldm, CD_MASK_BAREMESH|CD_MASK_MTFACE);
/* when sync selection is enabled, all faces are drawn (except for hidden)
* so if cage is the same as the final, theres no point in drawing this */
- if(!((ts->uv_flag & UV_SYNC_SELECTION) && (cagedm == finaldm)))
+ if (!((ts->uv_flag & UV_SYNC_SELECTION) && (cagedm == finaldm)))
draw_uvs_dm_shadow(finaldm);
/* release derivedmesh again */
- if(cagedm != finaldm) cagedm->release(cagedm);
+ if (cagedm != finaldm) cagedm->release(cagedm);
finaldm->release(finaldm);
}
}
/* 2. draw colored faces */
- if(sima->flag & SI_DRAW_STRETCH) {
+ if (sima->flag & SI_DRAW_STRETCH) {
draw_uvs_stretch(sima, scene, em, activetf);
}
- else if(!(sima->flag & SI_NO_DRAWFACES)) {
+ else if (!(sima->flag & SI_NO_DRAWFACES)) {
/* draw transparent faces */
UI_GetThemeColor4ubv(TH_FACE, col1);
UI_GetThemeColor4ubv(TH_FACE_SELECT, col2);
@@ -563,11 +563,11 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(uvedit_face_visible(scene, ima, efa, tf)) {
+ if (uvedit_face_visible(scene, ima, efa, tf)) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
- if(tf==activetf) continue; /* important the temp boolean is set above */
+ if (tf==activetf) continue; /* important the temp boolean is set above */
- if(uvedit_face_selected(scene, em, efa))
+ if (uvedit_face_selected(scene, em, efa))
glColor4ubv((GLubyte *)col2);
else
glColor4ubv((GLubyte *)col1);
@@ -580,7 +580,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
glEnd();
}
else {
- if(tf == activetf)
+ if (tf == activetf)
activetf= NULL;
BM_elem_flag_disable(efa, BM_ELEM_TAG);
}
@@ -593,11 +593,11 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(uvedit_face_visible(scene, ima, efa, tf)) {
+ if (uvedit_face_visible(scene, ima, efa, tf)) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
}
else {
- if(tf == activetf)
+ if (tf == activetf)
activetf= NULL;
BM_elem_flag_disable(efa, BM_ELEM_TAG);
}
@@ -607,7 +607,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
/* 3. draw active face stippled */
- if(activef) {
+ if (activef) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
UI_ThemeColor4(TH_EDITMESH_ACTIVE);
@@ -628,7 +628,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
/* 4. draw edges */
- if(sima->flag & SI_SMOOTH_UV) {
+ if (sima->flag & SI_SMOOTH_UV) {
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -641,7 +641,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
continue;
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(tf) {
+ if (tf) {
cpack(0x111111);
glBegin(GL_LINE_LOOP);
@@ -676,7 +676,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
break;
case SI_UVDT_BLACK: /* black/white */
case SI_UVDT_WHITE:
- if(sima->dt_uv==SI_UVDT_WHITE) glColor3f(1.0f, 1.0f, 1.0f);
+ if (sima->dt_uv==SI_UVDT_WHITE) glColor3f(1.0f, 1.0f, 1.0f);
else glColor3f(0.0f, 0.0f, 0.0f);
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
@@ -711,11 +711,11 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
col2[0] = col2[1] = col2[2] = 192; col2[3] = 255;
glColor4ubv((unsigned char *)col2);
- if(me->drawflag & ME_DRAWEDGES) {
+ if (me->drawflag & ME_DRAWEDGES) {
int sel, lastsel = -1;
UI_GetThemeColor4ubv(TH_VERTEX_SELECT, col1);
- if(interpedges) {
+ if (interpedges) {
glShadeModel(GL_SMOOTH);
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
@@ -743,7 +743,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
glBegin(GL_LINES);
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
sel = (uvedit_edge_selected(em, scene, l)? 1 : 0);
- if(sel != lastsel){
+ if (sel != lastsel) {
glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2);
lastsel = sel;
}
@@ -774,14 +774,14 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
break;
}
- if(sima->flag & SI_SMOOTH_UV) {
+ if (sima->flag & SI_SMOOTH_UV) {
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
/* 5. draw face centers */
- if(drawfaces) {
+ if (drawfaces) {
float cent[2];
pointsize = UI_GetThemeValuef(TH_FACEDOT_SIZE);
@@ -795,7 +795,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
continue;
- if(!uvedit_face_selected(scene, em, efa)) {
+ if (!uvedit_face_selected(scene, em, efa)) {
poly_uv_center(em, efa, cent);
bglVertex2fv(cent);
}
@@ -810,7 +810,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
continue;
- if(uvedit_face_selected(scene, em, efa)) {
+ if (uvedit_face_selected(scene, em, efa)) {
poly_uv_center(em, efa, cent);
bglVertex2fv(cent);
}
@@ -820,7 +820,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
/* 6. draw uv vertices */
- if(drawfaces != 2) { /* 2 means Mesh Face Mode */
+ if (drawfaces != 2) { /* 2 means Mesh Face Mode */
/* unselected uvs */
UI_ThemeColor(TH_VERTEX);
pointsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
@@ -833,7 +833,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- if(!uvedit_uv_selected(em, scene, l))
+ if (!uvedit_uv_selected(em, scene, l))
bglVertex2fv(luv->uv);
}
}
@@ -852,7 +852,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- if(luv->flag & MLOOPUV_PINNED)
+ if (luv->flag & MLOOPUV_PINNED)
bglVertex2fv(luv->uv);
}
}
@@ -870,7 +870,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- if(uvedit_uv_selected(em, scene, l))
+ if (uvedit_uv_selected(em, scene, l))
bglVertex2fv(luv->uv);
}
}
@@ -878,7 +878,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
}
/* finally draw stitch preview */
- if(stitch_preview) {
+ if (stitch_preview) {
int i, index = 0;
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
@@ -891,7 +891,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_static_tris*3);
glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_polys);
- for(i = 0; i < stitch_preview->num_polys; i++){
+ for (i = 0; i < stitch_preview->num_polys; i++) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
UI_ThemeColor4(TH_STITCH_PREVIEW_FACE);
glDrawArrays(GL_POLYGON, index, stitch_preview->uvs_per_polygon[i]);
@@ -934,15 +934,15 @@ void draw_uvedit_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedi
show_uvedit= ED_space_image_show_uvedit(sima, obedit);
show_uvshadow= ED_space_image_show_uvshadow(sima, obedit);
- if(show_uvedit || show_uvshadow || show_texpaint_uvshadow) {
- if(show_uvshadow)
+ if (show_uvedit || show_uvshadow || show_texpaint_uvshadow) {
+ if (show_uvshadow)
draw_uvs_shadow(obedit);
- else if(show_uvedit)
+ else if (show_uvedit)
draw_uvs(sima, scene, obedit);
else
draw_uvs_texpaint(sima, scene, obact);
- if(show_uvedit && !(toolsettings->use_uv_sculpt))
+ if (show_uvedit && !(toolsettings->use_uv_sculpt))
drawcursor_sima(sima, ar);
}
}
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 28981d55793..3e6be67f233 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -94,7 +94,7 @@ int ED_uvedit_test(Object *obedit)
if (!obedit)
return 0;
- if(obedit->type != OB_MESH)
+ if (obedit->type != OB_MESH)
return 0;
em = BMEdit_FromObject(obedit);
@@ -116,10 +116,10 @@ static int UNUSED_FUNCTION(ED_operator_uvmap_mesh)(bContext *C)
{
Object *ob= CTX_data_active_object(C);
- if(ob && ob->type==OB_MESH) {
+ if (ob && ob->type==OB_MESH) {
Mesh *me = ob->data;
- if(CustomData_get_layer(&me->fdata, CD_MTFACE) != NULL)
+ if (CustomData_get_layer(&me->fdata, CD_MTFACE) != NULL)
return 1;
}
@@ -137,16 +137,16 @@ int ED_object_get_active_image(Object *ob, int mat_nr, Image **ima, ImageUser **
Material *ma= give_current_material(ob, mat_nr);
bNode *node= (ma && ma->use_nodes)? nodeGetActiveTexture(ma->nodetree): NULL;
- if(node && is_image_texture_node(node)) {
- if(ima) *ima= (Image*)node->id;
- if(iuser) *iuser= NULL;
- if(node_r) *node_r= node;
+ if (node && is_image_texture_node(node)) {
+ if (ima) *ima= (Image*)node->id;
+ if (iuser) *iuser= NULL;
+ if (node_r) *node_r= node;
return TRUE;
}
- if(ima) *ima= NULL;
- if(iuser) *iuser= NULL;
- if(node_r) *node_r= node;
+ if (ima) *ima= NULL;
+ if (iuser) *iuser= NULL;
+ if (node_r) *node_r= node;
return FALSE;
}
@@ -156,7 +156,7 @@ void ED_object_assign_active_image(Main *bmain, Object *ob, int mat_nr, Image *i
Material *ma= give_current_material(ob, mat_nr);
bNode *node= (ma && ma->use_nodes)? nodeGetActiveTexture(ma->nodetree): NULL;
- if(node && is_image_texture_node(node)) {
+ if (node && is_image_texture_node(node)) {
node->id= &ima->id;
ED_node_generic_update(bmain, ma->nodetree, node);
}
@@ -173,31 +173,31 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im
int update= 0;
/* skip assigning these procedural images... */
- if(ima && (ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE))
+ if (ima && (ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE))
return;
/* verify we have a mesh we can work with */
- if(!obedit || (obedit->type != OB_MESH))
+ if (!obedit || (obedit->type != OB_MESH))
return;
em = BMEdit_FromObject(obedit);
- if(!em || !em->bm->totface) {
+ if (!em || !em->bm->totface) {
return;
}
- if(scene_use_new_shading_nodes(scene)) {
+ if (scene_use_new_shading_nodes(scene)) {
/* new shading system, assign image in material */
int sloppy= 1;
BMFace *efa= BM_active_face_get(em->bm, sloppy);
- if(efa)
+ if (efa)
ED_object_assign_active_image(bmain, obedit, efa->mat_nr, ima);
}
else {
/* old shading system, assign image to selected faces */
/* ensure we have a uv map */
- if(!CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY)) {
+ if (!CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY)) {
BM_data_layer_add(em->bm, &em->bm->pdata, CD_MTEXPOLY);
BM_data_layer_add(em->bm, &em->bm->ldata, CD_MLOOPUV);
update= 1;
@@ -207,11 +207,11 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(uvedit_face_visible(scene, previma, efa, tf)) {
- if(ima) {
+ if (uvedit_face_visible(scene, previma, efa, tf)) {
+ if (ima) {
tf->tpage= ima;
- if(ima->id.us==0) id_us_plus(&ima->id);
+ if (ima->id.us==0) id_us_plus(&ima->id);
else id_lib_extern(&ima->id);
}
else {
@@ -223,7 +223,7 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im
}
/* and update depdency graph */
- if(update)
+ if (update)
DAG_id_tag_update(obedit->data, 0);
}
@@ -239,14 +239,14 @@ static int uvedit_set_tile(Object *obedit, Image *ima, int curtile)
MTexPoly *tf;
/* verify if we have something to do */
- if(!ima || !ED_uvedit_test(obedit))
+ if (!ima || !ED_uvedit_test(obedit))
return 0;
- if((ima->tpageflag & IMA_TILES) == 0)
+ if ((ima->tpageflag & IMA_TILES) == 0)
return 0;
/* skip assigning these procedural images... */
- if(ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
+ if (ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
return 0;
em = BMEdit_FromObject(obedit);
@@ -254,7 +254,7 @@ static int uvedit_set_tile(Object *obedit, Image *ima, int curtile)
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && BM_elem_flag_test(efa, BM_ELEM_SELECT))
+ if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && BM_elem_flag_test(efa, BM_ELEM_SELECT))
tf->tile= curtile; /* set tile index */
}
@@ -269,7 +269,7 @@ static void uvedit_pixel_to_float(SpaceImage *sima, float *dist, float pixeldist
{
int width, height;
- if(sima) {
+ if (sima) {
ED_space_image_size(sima, &width, &height);
}
else {
@@ -287,7 +287,7 @@ int uvedit_face_visible_nolocal(Scene *scene, BMFace *efa)
{
ToolSettings *ts= scene->toolsettings;
- if(ts->uv_flag & UV_SYNC_SELECTION)
+ if (ts->uv_flag & UV_SYNC_SELECTION)
return (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)==0);
else
return (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)==0 && BM_elem_flag_test(efa, BM_ELEM_SELECT));
@@ -297,7 +297,7 @@ int uvedit_face_visible(Scene *scene, Image *ima, BMFace *efa, MTexPoly *tf)
{
ToolSettings *ts= scene->toolsettings;
- if(ts->uv_flag & UV_SHOW_SAME_IMAGE)
+ if (ts->uv_flag & UV_SHOW_SAME_IMAGE)
return (tf->tpage==ima)? uvedit_face_visible_nolocal(scene, efa): 0;
else
return uvedit_face_visible_nolocal(scene, efa);
@@ -307,7 +307,7 @@ int uvedit_face_selected(Scene *scene, BMEditMesh *em, BMFace *efa)
{
ToolSettings *ts= scene->toolsettings;
- if(ts->uv_flag & UV_SYNC_SELECTION)
+ if (ts->uv_flag & UV_SYNC_SELECTION)
return (BM_elem_flag_test(efa, BM_ELEM_SELECT));
else {
BMLoop *l;
@@ -328,7 +328,7 @@ int uvedit_face_select(Scene *scene, BMEditMesh *em, BMFace *efa)
{
ToolSettings *ts= scene->toolsettings;
- if(ts->uv_flag & UV_SYNC_SELECTION)
+ if (ts->uv_flag & UV_SYNC_SELECTION)
BM_elem_select_set(em->bm, efa, TRUE);
else {
BMLoop *l;
@@ -350,7 +350,7 @@ int uvedit_face_deselect(Scene *scene, BMEditMesh *em, BMFace *efa)
{
ToolSettings *ts= scene->toolsettings;
- if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
BM_elem_select_set(em->bm, efa, FALSE);
}
else {
@@ -373,7 +373,7 @@ int uvedit_edge_selected(BMEditMesh *em, Scene *scene, BMLoop *l)
{
ToolSettings *ts= scene->toolsettings;
- if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
if (ts->selectmode & SCE_SELECT_FACE) {
return BM_elem_flag_test(l->f, BM_ELEM_SELECT);
}
@@ -400,10 +400,10 @@ void uvedit_edge_select(BMEditMesh *em, Scene *scene, BMLoop *l)
{
ToolSettings *ts= scene->toolsettings;
- if(ts->uv_flag & UV_SYNC_SELECTION) {
- if(ts->selectmode & SCE_SELECT_FACE)
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->selectmode & SCE_SELECT_FACE)
BM_elem_select_set(em->bm, l->f, TRUE);
- else if(ts->selectmode & SCE_SELECT_EDGE)
+ else if (ts->selectmode & SCE_SELECT_EDGE)
BM_elem_select_set(em->bm, l->e, TRUE);
else {
BM_elem_select_set(em->bm, l->e->v1, TRUE);
@@ -426,10 +426,10 @@ void uvedit_edge_deselect(BMEditMesh *em, Scene *scene, BMLoop *l)
{
ToolSettings *ts= scene->toolsettings;
- if(ts->uv_flag & UV_SYNC_SELECTION) {
- if(ts->selectmode & SCE_SELECT_FACE)
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->selectmode & SCE_SELECT_FACE)
BM_elem_select_set(em->bm, l->f, FALSE);
- else if(ts->selectmode & SCE_SELECT_EDGE)
+ else if (ts->selectmode & SCE_SELECT_EDGE)
BM_elem_select_set(em->bm, l->e, FALSE);
else {
BM_elem_select_set(em->bm, l->e->v1, FALSE);
@@ -451,8 +451,8 @@ int uvedit_uv_selected(BMEditMesh *em, Scene *scene, BMLoop *l)
{
ToolSettings *ts= scene->toolsettings;
- if(ts->uv_flag & UV_SYNC_SELECTION) {
- if(ts->selectmode & SCE_SELECT_FACE)
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->selectmode & SCE_SELECT_FACE)
return BM_elem_flag_test(l->f, BM_ELEM_SELECT);
else
return BM_elem_flag_test(l->v, BM_ELEM_SELECT);
@@ -468,8 +468,8 @@ void uvedit_uv_select(BMEditMesh *em, Scene *scene, BMLoop *l)
{
ToolSettings *ts= scene->toolsettings;
- if(ts->uv_flag & UV_SYNC_SELECTION) {
- if(ts->selectmode & SCE_SELECT_FACE)
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->selectmode & SCE_SELECT_FACE)
BM_elem_select_set(em->bm, l->f, TRUE);
else
BM_elem_select_set(em->bm, l->v, TRUE);
@@ -485,8 +485,8 @@ void uvedit_uv_deselect(BMEditMesh *em, Scene *scene, BMLoop *l)
{
ToolSettings *ts= scene->toolsettings;
- if(ts->uv_flag & UV_SYNC_SELECTION) {
- if(ts->selectmode & SCE_SELECT_FACE)
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->selectmode & SCE_SELECT_FACE)
BM_elem_select_set(em->bm, l->f, FALSE);
else
BM_elem_select_set(em->bm, l->v, FALSE);
@@ -502,7 +502,7 @@ void uvedit_uv_deselect(BMEditMesh *em, Scene *scene, BMLoop *l)
void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit)
{
- if(sima && (sima->flag & SI_LIVE_UNWRAP)) {
+ if (sima && (sima->flag & SI_LIVE_UNWRAP)) {
ED_uvedit_live_unwrap_begin(scene, obedit);
ED_uvedit_live_unwrap_re_solve();
ED_uvedit_live_unwrap_end(0);
@@ -529,7 +529,7 @@ void poly_uv_center(BMEditMesh *em, BMFace *f, float cent[2])
void uv_center(float uv[][2], float cent[2], int quad)
{
- if(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;
}
@@ -541,7 +541,7 @@ void uv_center(float uv[][2], float cent[2], int quad)
float uv_area(float uv[][2], int quad)
{
- if(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]);
@@ -552,7 +552,7 @@ float poly_uv_area(float uv[][2], int len)
//BMESH_TODO: make this not suck
//maybe use scanfill? I dunno.
- if(len >= 4)
+ if (len >= 4)
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]);
@@ -599,7 +599,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float
sel= 0;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -627,7 +627,7 @@ static int ED_uvedit_median(Scene *scene, Image *ima, Object *obedit, float co[3
zero_v3(co);
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -649,8 +649,8 @@ static int uvedit_center(Scene *scene, Image *ima, Object *obedit, float *cent,
float min[2], max[2];
int change= 0;
- if(mode==V3D_CENTER) { /* bounding box */
- if(ED_uvedit_minmax(scene, ima, obedit, min, max)) {
+ if (mode==V3D_CENTER) { /* bounding box */
+ if (ED_uvedit_minmax(scene, ima, obedit, min, max)) {
change = 1;
cent[0]= (min[0]+max[0])/2.0f;
@@ -658,13 +658,13 @@ static int uvedit_center(Scene *scene, Image *ima, Object *obedit, float *cent,
}
}
else {
- if(ED_uvedit_median(scene, ima, obedit, cent)) {
+ if (ED_uvedit_median(scene, ima, obedit, cent)) {
change = 1;
}
}
- if(change) {
+ if (change) {
return 1;
}
@@ -690,7 +690,7 @@ void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, float co[2],
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
i = 0;
@@ -700,7 +700,7 @@ void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, float co[2],
dist= dist_to_line_segment_v2(co, luv->uv, nextluv->uv);
- if(dist < mindist) {
+ if (dist < mindist) {
hit->tf= tf;
hit->efa= efa;
@@ -739,7 +739,7 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
cent[0]= cent[1]= 0.0f;
@@ -753,7 +753,7 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float
cent[1] /= efa->len;
dist= fabs(co[0]- cent[0]) + fabs(co[1]- cent[1]);
- if(dist < mindist) {
+ if (dist < mindist) {
hit->tf= tf;
hit->efa= efa;
mindist= dist;
@@ -767,7 +767,7 @@ static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), i
BMLoop *l;
MLoopUV *luv;
BMIter iter;
- float m[3], v1[3], v2[3], c1, c2, *uv1, *uv2, *uv3;
+ float m[3], v1[3], v2[3], c1, c2, *uv1, /* *uv2, */ /* UNUSED */ *uv3;
int id1, id2, i;
id1= (id+efa->len-1)%efa->len;
@@ -783,7 +783,7 @@ static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), i
if (i == id1)
uv1 = luv->uv;
else if (i == id)
- uv2 = luv->uv;
+ ; /* uv2 = luv->uv; */ /* UNUSED */
else if (i == id2)
uv3 = luv->uv;
@@ -797,7 +797,7 @@ static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), i
c1= v1[0]*m[1] - v1[1]*m[0];
c2= v1[0]*v2[1] - v1[1]*v2[0];
- if(c1*c2 < 0.0f)
+ if (c1*c2 < 0.0f)
return 0;
/* m and v1 on same side of v-v2? */
@@ -830,21 +830,21 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em,
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
i = 0;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- if(penalty && uvedit_uv_selected(em, scene, l))
+ if (penalty && uvedit_uv_selected(em, scene, l))
dist= fabs(co[0]-luv->uv[0])+penalty[0] + fabs(co[1]-luv->uv[1])+penalty[1];
else
dist= fabs(co[0]-luv->uv[0]) + fabs(co[1]-luv->uv[1]);
- if(dist<=mindist) {
- if(dist==mindist)
- if(!nearest_uv_between(em, efa, efa->len, i, co, luv->uv)) {
+ if (dist<=mindist) {
+ if (dist==mindist)
+ if (!nearest_uv_between(em, efa, efa->len, i, co, luv->uv)) {
i++;
continue;
}
@@ -883,14 +883,14 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2],
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
dist= fabs(co[0]-luv->uv[0]) + fabs(co[1]-luv->uv[1]);
- if(dist<=mindist) {
+ if (dist<=mindist) {
mindist= dist;
uv[0]= luv->uv[0];
@@ -910,14 +910,14 @@ static void uv_vertex_loop_flag(UvMapVert *first)
UvMapVert *iterv;
int count= 0;
- for(iterv=first; iterv; iterv=iterv->next) {
- if(iterv->separate && iterv!=first)
+ for (iterv=first; iterv; iterv=iterv->next) {
+ if (iterv->separate && iterv!=first)
break;
count++;
}
- if(count < 5)
+ if (count < 5)
first->flag= 1;
}
@@ -929,10 +929,10 @@ static UvMapVert *uv_vertex_map_get(UvVertMap *vmap, BMFace *efa, int a)
l = BM_iter_at_index(NULL, BM_LOOPS_OF_FACE, efa, a);
first= EDBM_get_uv_map_vert(vmap, BM_elem_index_get(l->v));
- for(iterv=first; iterv; iterv=iterv->next) {
- if(iterv->separate)
+ for (iterv=first; iterv; iterv=iterv->next) {
+ if (iterv->separate)
first= iterv;
- if(iterv->f == BM_elem_index_get(efa))
+ if (iterv->f == BM_elem_index_get(efa))
return first;
}
@@ -945,8 +945,8 @@ UvElement *ED_get_uv_element(UvElementMap *map, BMFace *efa, BMLoop *l)
element = map->vert[BM_elem_index_get(l->v)];
- for(; element; element = element->next)
- if(element->face == efa)
+ for (; element; element = element->next)
+ if (element->face == efa)
return element;
return NULL;
@@ -959,18 +959,18 @@ static int uv_edge_tag_faces(BMEditMesh *em, UvMapVert *first1, UvMapVert *first
int tot = 0;
/* count number of faces this edge has */
- for(iterv1=first1; iterv1; iterv1=iterv1->next) {
- if(iterv1->separate && iterv1 != first1)
+ for (iterv1=first1; iterv1; iterv1=iterv1->next) {
+ if (iterv1->separate && iterv1 != first1)
break;
- for(iterv2=first2; iterv2; iterv2=iterv2->next) {
- if(iterv2->separate && iterv2 != first2)
+ for (iterv2=first2; iterv2; iterv2=iterv2->next) {
+ if (iterv2->separate && iterv2 != first2)
break;
- if(iterv1->f == iterv2->f) {
+ if (iterv1->f == iterv2->f) {
/* if face already tagged, don't do this edge */
efa= EDBM_get_face_for_index(em, iterv1->f);
- if(BMO_elem_flag_test(em->bm, efa, EFA_F1_FLAG))
+ if (BMO_elem_flag_test(em->bm, efa, EFA_F1_FLAG))
return 0;
tot++;
@@ -979,21 +979,21 @@ static int uv_edge_tag_faces(BMEditMesh *em, UvMapVert *first1, UvMapVert *first
}
}
- if(*totface == 0) /* start edge */
+ if (*totface == 0) /* start edge */
*totface= tot;
- else if(tot != *totface) /* check for same number of faces as start edge */
+ else if (tot != *totface) /* check for same number of faces as start edge */
return 0;
/* tag the faces */
- for(iterv1=first1; iterv1; iterv1=iterv1->next) {
- if(iterv1->separate && iterv1 != first1)
+ for (iterv1=first1; iterv1; iterv1=iterv1->next) {
+ if (iterv1->separate && iterv1 != first1)
break;
- for(iterv2=first2; iterv2; iterv2=iterv2->next) {
- if(iterv2->separate && iterv2 != first2)
+ for (iterv2=first2; iterv2; iterv2=iterv2->next) {
+ if (iterv2->separate && iterv2 != first2)
break;
- if(iterv1->f == iterv2->f) {
+ if (iterv1->f == iterv2->f) {
efa= EDBM_get_face_for_index(em, iterv1->f);
BMO_elem_flag_enable(em->bm, efa, EFA_F1_FLAG);
break;
@@ -1022,7 +1022,7 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
count = 0;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(!extend) {
+ if (!extend) {
uvedit_face_deselect(scene, em, efa);
}
@@ -1044,12 +1044,12 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
starttotf= 0;
uv_edge_tag_faces(em, iterv1, iterv2, &starttotf);
- /* sorry, first edge isnt even ok */
- if(iterv1->flag==0 && iterv2->flag==0) looking= 0;
+ /* sorry, first edge isn't even ok */
+ if (iterv1->flag==0 && iterv2->flag==0) looking= 0;
else looking= 1;
/* iterate */
- while(looking) {
+ while (looking) {
looking= 0;
/* find correct valence edges which are not tagged yet, but connect to tagged one */
@@ -1057,9 +1057,9 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!BMO_elem_flag_test(em->bm, efa, EFA_F1_FLAG) && uvedit_face_visible(scene, ima, efa, tf)) {
+ if (!BMO_elem_flag_test(em->bm, efa, EFA_F1_FLAG) && uvedit_face_visible(scene, ima, efa, tf)) {
nverts= efa->len;
- for(a=0; a<nverts; a++) {
+ for (a=0; a<nverts; a++) {
/* check face not hidden and not tagged */
iterv1= uv_vertex_map_get(vmap, efa, a);
iterv2= uv_vertex_map_get(vmap, efa, (a+1)%nverts);
@@ -1068,8 +1068,8 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
continue;
/* check if vertex is tagged and has right valence */
- if(iterv1->flag || iterv2->flag) {
- if(uv_edge_tag_faces(em, iterv1, iterv2, &starttotf)) {
+ if (iterv1->flag || iterv2->flag) {
+ if (uv_edge_tag_faces(em, iterv1, iterv2, &starttotf)) {
looking= 1;
BMO_elem_flag_enable(em->bm, efa, EFA_F1_FLAG);
@@ -1090,8 +1090,8 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
iterv1->flag= 1;
iterv2->flag= 1;
- if(extend) {
- if(uvedit_uv_selected(em, scene, hit->l))
+ if (extend) {
+ if (uvedit_uv_selected(em, scene, hit->l))
select= 0;
else
select= 1;
@@ -1104,8 +1104,8 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
iterv1= uv_vertex_map_get(vmap, efa, a);
- if(iterv1->flag) {
- if(select) uvedit_uv_select(em, scene, l);
+ if (iterv1->flag) {
+ if (select) uvedit_uv_select(em, scene, l);
else uvedit_uv_deselect(em, scene, l);
}
@@ -1131,25 +1131,24 @@ static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[
MLoopUV *luv;
UvVertMap *vmap;
UvMapVert *vlist, *iterv, *startv;
- int i, nverts, stacksize= 0, *stack;
+ int i, stacksize= 0, *stack;
unsigned int a;
char *flag;
EDBM_init_index_arrays(em, 0, 0, 1); /* we can use this too */
vmap= EDBM_make_uv_vert_map(em, 1, 1, limit);
- if(vmap == NULL)
+ if (vmap == NULL)
return;
stack= MEM_mallocN(sizeof(*stack)*(em->bm->totface+1), "UvLinkStack");
flag= MEM_callocN(sizeof(*flag)*em->bm->totface, "UvLinkFlag");
- if(!hit) {
- a = 0;
- BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
+ if (!hit) {
+ BM_ITER_INDEX(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL, a) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(uvedit_face_visible(scene, ima, efa, tf)) {
+ if (uvedit_face_visible(scene, ima, efa, tf)) {
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
@@ -1163,12 +1162,11 @@ static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[
}
}
}
- a++;
}
else {
a = 0;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(efa == hit->efa) {
+ if (efa == hit->efa) {
stack[stacksize]= a;
stacksize++;
flag[a]= 1;
@@ -1179,7 +1177,7 @@ static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[
}
}
- while(stacksize > 0) {
+ while (stacksize > 0) {
int j;
stacksize--;
@@ -1187,14 +1185,12 @@ static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[
j = 0;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(j==a)
+ if (j==a)
break;
j++;
}
- nverts= efa->len;
-
i = 0;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -1203,17 +1199,17 @@ static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[
startv= vlist;
- for(iterv=vlist; iterv; iterv=iterv->next) {
- if(iterv->separate)
+ for (iterv=vlist; iterv; iterv=iterv->next) {
+ if (iterv->separate)
startv= iterv;
- if(iterv->f == a)
+ if (iterv->f == a)
break;
}
- for(iterv=startv; iterv; iterv=iterv->next) {
- if((startv != iterv) && (iterv->separate))
+ for (iterv=startv; iterv; iterv=iterv->next) {
+ if ((startv != iterv) && (iterv->separate))
break;
- else if(!flag[iterv->f]) {
+ else if (!flag[iterv->f]) {
flag[iterv->f]= 1;
stack[stacksize]= iterv->f;
stacksize++;
@@ -1224,7 +1220,7 @@ static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[
}
}
- if(!extend) {
+ if (!extend) {
a = 0;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -1259,7 +1255,7 @@ static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[
a++;
}
- if(efa) {
+ if (efa) {
a = 0;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
if (!flag[a]) {
@@ -1345,20 +1341,20 @@ static void weld_align_uv(bContext *C, int tool)
INIT_MINMAX2(min, max);
- if(tool == 'a') {
+ if (tool == 'a') {
BMFace *efa;
BMLoop *l;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
if (uvedit_uv_selected(em, scene, l)) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- DO_MINMAX2(luv->uv, min, max)
+ DO_MINMAX2(luv->uv, min, max);
}
}
}
@@ -1368,13 +1364,13 @@ static void weld_align_uv(bContext *C, int tool)
uvedit_center(scene, ima, obedit, cent, 0);
- if(tool == 'x' || tool == 'w') {
+ if (tool == 'x' || tool == 'w') {
BMFace *efa;
BMLoop *l;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -1387,13 +1383,13 @@ static void weld_align_uv(bContext *C, int tool)
}
}
- if(tool == 'y' || tool == 'w') {
+ if (tool == 'y' || tool == 'w') {
BMFace *efa;
BMLoop *l;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -1406,7 +1402,7 @@ static void weld_align_uv(bContext *C, int tool)
}
}
- if(tool == 's' || tool == 't' || tool == 'u') {
+ if (tool == 's' || tool == 't' || tool == 'u') {
BMEdge *eed;
BMLoop *l;
BMVert *eve;
@@ -1466,7 +1462,7 @@ static void weld_align_uv(bContext *C, int tool)
/* walk over edges, building an array of verts in a line */
while (eve) {
BLI_array_append(eve_line, eve);
- /* dont touch again */
+ /* don't touch again */
BM_elem_flag_disable(eve, BM_ELEM_TAG);
eve_next = NULL;
@@ -1553,14 +1549,14 @@ static void UV_OT_align(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Align";
- ot->description= "Align selected UV vertices to an axis";
- ot->idname= "UV_OT_align";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Align";
+ ot->description = "Align selected UV vertices to an axis";
+ ot->idname = "UV_OT_align";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= align_exec;
- ot->poll= ED_operator_image_active; /* requires space image */;
+ ot->exec = align_exec;
+ ot->poll = ED_operator_image_active; /* requires space image */;
/* properties */
RNA_def_enum(ot->srna, "axis", axis_items, 'a', "Axis", "Axis to align UV locations on");
@@ -1578,14 +1574,14 @@ static int weld_exec(bContext *C, wmOperator *UNUSED(op))
static void UV_OT_weld(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Weld";
- ot->description= "Weld selected UV vertices together";
- ot->idname= "UV_OT_weld";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Weld";
+ ot->description = "Weld selected UV vertices together";
+ ot->idname = "UV_OT_weld";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= weld_exec;
- ot->poll= ED_operator_uvedit;
+ ot->exec = weld_exec;
+ ot->poll = ED_operator_uvedit;
}
@@ -1610,11 +1606,11 @@ static void select_all_perform(bContext *C, int action)
em = BMEdit_FromObject(obedit);
ima = CTX_data_edit_image(C);
- if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
switch (action) {
case SEL_TOGGLE:
- EDBM_toggle_select_all(BMEdit_FromObject(obedit));
+ EDBM_select_toggle_all(BMEdit_FromObject(obedit));
break;
case SEL_SELECT:
EDBM_flag_enable_all(em, BM_ELEM_SELECT);
@@ -1633,7 +1629,7 @@ static void select_all_perform(bContext *C, int action)
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -1651,7 +1647,7 @@ static void select_all_perform(bContext *C, int action)
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -1688,14 +1684,14 @@ static int select_all_exec(bContext *C, wmOperator *op)
static void UV_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select or Deselect All";
- ot->description= "Change selection of all UV vertices";
- ot->idname= "UV_OT_select_all";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "(De)select All";
+ ot->description = "Change selection of all UV vertices";
+ ot->idname = "UV_OT_select_all";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= select_all_exec;
- ot->poll= ED_operator_uvedit;
+ ot->exec = select_all_exec;
+ ot->poll = ED_operator_uvedit;
WM_operator_properties_select_all(ot);
}
@@ -1708,16 +1704,16 @@ static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], floa
/* this function test if some vertex needs to selected
* in addition to the existing ones due to sticky select */
- if(sticky == SI_STICKY_DISABLE)
+ if (sticky == SI_STICKY_DISABLE)
return 0;
- for(i=0; i<hitlen; i++) {
- if(hitv[i] == v) {
- if(sticky == SI_STICKY_LOC) {
- if(fabsf(hituv[i][0]-uv[0]) < limit[0] && fabsf(hituv[i][1]-uv[1]) < limit[1])
+ for (i=0; i<hitlen; i++) {
+ if (hitv[i] == v) {
+ if (sticky == SI_STICKY_LOC) {
+ if (fabsf(hituv[i][0]-uv[0]) < limit[0] && fabsf(hituv[i][1]-uv[1]) < limit[1])
return 1;
}
- else if(sticky == SI_STICKY_VERTEX)
+ else if (sticky == SI_STICKY_VERTEX)
return 1;
}
}
@@ -1741,7 +1737,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
NearestHit hit;
int i, select = 1, selectmode, sticky, sync, *hitv=NULL, nvert;
BLI_array_declare(hitv);
- int flush = 0, hitlen=0; /* 0 == dont flush, 1 == sel, -1 == desel; only use when selection sync is enabled */
+ int flush = 0, hitlen=0; /* 0 == don't flush, 1 == sel, -1 == desel; only use when selection sync is enabled */
float limit[2], **hituv = NULL;
BLI_array_declare(hituv);
float penalty[2];
@@ -1756,12 +1752,12 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
uvedit_pixel_to_float(sima, penalty, 5.0f / sima->zoom);
/* retrieve operation mode */
- if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
sync= 1;
- if(ts->selectmode & SCE_SELECT_FACE)
+ if (ts->selectmode & SCE_SELECT_FACE)
selectmode= UV_SELECT_FACE;
- else if(ts->selectmode & SCE_SELECT_EDGE)
+ else if (ts->selectmode & SCE_SELECT_EDGE)
selectmode= UV_SELECT_EDGE;
else
selectmode= UV_SELECT_VERTEX;
@@ -1775,10 +1771,10 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
}
/* find nearest element */
- if(loop) {
+ if (loop) {
/* find edge */
uv_find_nearest_edge(scene, ima, em, co, &hit);
- if(hit.efa == NULL) {
+ if (hit.efa == NULL) {
BLI_array_free(hitv);
BLI_array_free(hituv);
return OPERATOR_CANCELLED;
@@ -1786,10 +1782,10 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
hitlen = 0;
}
- else if(selectmode == UV_SELECT_VERTEX) {
+ else if (selectmode == UV_SELECT_VERTEX) {
/* find vertex */
uv_find_nearest_vert(scene, ima, em, co, penalty, &hit);
- if(hit.efa == NULL) {
+ if (hit.efa == NULL) {
BLI_array_free(hitv);
BLI_array_free(hituv);
return OPERATOR_CANCELLED;
@@ -1798,7 +1794,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
/* mark 1 vertex as being hit */
BLI_array_growitems(hitv, hit.efa->len);
BLI_array_growitems(hituv, hit.efa->len);
- for(i=0; i<hit.efa->len; i++) {
+ for (i=0; i<hit.efa->len; i++) {
hitv[i]= 0xFFFFFFFF;
}
@@ -1807,10 +1803,10 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
hitlen = hit.efa->len;
}
- else if(selectmode == UV_SELECT_EDGE) {
+ else if (selectmode == UV_SELECT_EDGE) {
/* find edge */
uv_find_nearest_edge(scene, ima, em, co, &hit);
- if(hit.efa == NULL) {
+ if (hit.efa == NULL) {
BLI_array_free(hitv);
BLI_array_free(hituv);
return OPERATOR_CANCELLED;
@@ -1832,10 +1828,10 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
hitlen = hit.efa->len;
}
- else if(selectmode == UV_SELECT_FACE) {
+ else if (selectmode == UV_SELECT_FACE) {
/* find face */
find_nearest_uv_face(scene, ima, em, co, &hit);
- if(hit.efa == NULL) {
+ if (hit.efa == NULL) {
BLI_array_free(hitv);
BLI_array_free(hituv);
return OPERATOR_CANCELLED;
@@ -1858,10 +1854,10 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
hitlen = hit.efa->len;
}
- else if(selectmode == UV_SELECT_ISLAND) {
+ else if (selectmode == UV_SELECT_ISLAND) {
uv_find_nearest_vert(scene, ima, em, co, NULL, &hit);
- if(hit.efa==NULL) {
+ if (hit.efa==NULL) {
BLI_array_free(hitv);
BLI_array_free(hituv);
return OPERATOR_CANCELLED;
@@ -1877,16 +1873,16 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
}
/* do selection */
- if(loop) {
+ if (loop) {
flush= select_edgeloop(scene, ima, em, &hit, limit, extend);
}
- else if(selectmode == UV_SELECT_ISLAND) {
+ else if (selectmode == UV_SELECT_ISLAND) {
select_linked(scene, ima, em, limit, &hit, extend);
}
- else if(extend) {
- if(selectmode == UV_SELECT_VERTEX) {
+ else if (extend) {
+ if (selectmode == UV_SELECT_VERTEX) {
/* (de)select uv vertex */
- if(uvedit_uv_selected(em, scene, hit.l)) {
+ if (uvedit_uv_selected(em, scene, hit.l)) {
uvedit_uv_deselect(em, scene, hit.l);
select= 0;
}
@@ -1896,9 +1892,9 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
}
flush = 1;
}
- else if(selectmode == UV_SELECT_EDGE) {
+ else if (selectmode == UV_SELECT_EDGE) {
/* (de)select edge */
- if(uvedit_edge_selected(em, scene, hit.l)) {
+ if (uvedit_edge_selected(em, scene, hit.l)) {
uvedit_edge_deselect(em, scene, hit.l);
select= 0;
}
@@ -1908,9 +1904,9 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
}
flush = 1;
}
- else if(selectmode == UV_SELECT_FACE) {
+ else if (selectmode == UV_SELECT_FACE) {
/* (de)select face */
- if(uvedit_face_selected(scene, em, hit.efa)) {
+ if (uvedit_face_selected(scene, em, hit.efa)) {
uvedit_face_deselect(scene, em, hit.efa);
select= 0;
}
@@ -1922,20 +1918,20 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
}
/* (de)select sticky uv nodes */
- if(sticky != SI_STICKY_DISABLE) {
+ if (sticky != SI_STICKY_DISABLE) {
BM_mesh_elem_index_ensure(em->bm, BM_VERT);
/* deselect */
- if(select==0) {
+ if (select==0) {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- if(sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
+ if (sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
uvedit_uv_deselect(em, scene, l);
}
}
@@ -1945,12 +1941,12 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
else {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- if(sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
+ if (sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
uvedit_uv_select(em, scene, l);
}
}
@@ -1965,33 +1961,33 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
uvedit_face_deselect(scene, em, efa);
}
- if(selectmode == UV_SELECT_VERTEX) {
+ if (selectmode == UV_SELECT_VERTEX) {
/* select vertex */
uvedit_uv_select(em, scene, hit.l);
flush= 1;
}
- else if(selectmode == UV_SELECT_EDGE) {
+ else if (selectmode == UV_SELECT_EDGE) {
/* select edge */
uvedit_edge_select(em, scene, hit.l);
flush= 1;
}
- else if(selectmode == UV_SELECT_FACE) {
+ else if (selectmode == UV_SELECT_FACE) {
/* select face */
uvedit_face_select(scene, em, hit.efa);
}
/* select sticky uvs */
- if(sticky != SI_STICKY_DISABLE) {
+ if (sticky != SI_STICKY_DISABLE) {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
- if(sticky == SI_STICKY_DISABLE) continue;
+ if (sticky == SI_STICKY_DISABLE) continue;
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- if(sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
+ if (sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
uvedit_uv_select(em, scene, l);
flush= 1;
@@ -2002,14 +1998,16 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
#if 0 /* BM_elem_select_set API handles all of this? */
- if(sync) {
+ if (sync) {
/* flush for mesh selection */
- if(ts->selectmode != SCE_SELECT_FACE) {
- if(flush==1) EDBM_select_flush(em);
- else if(flush==-1) EDBM_deselect_flush(em);
+ if (ts->selectmode != SCE_SELECT_FACE) {
+ if (flush==1) EDBM_select_flush(em);
+ else if (flush==-1) EDBM_deselect_flush(em);
}
}
-
+#else
+ (void)flush; /* flush is otherwise UNUSED */
+ (void)sync; /* sync is otherwise UNUSED */
#endif
DAG_id_tag_update(obedit->data, 0);
@@ -2047,15 +2045,15 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void UV_OT_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select";
- ot->description= "Select UV vertices";
- ot->idname= "UV_OT_select";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Select";
+ ot->description = "Select UV vertices";
+ ot->idname = "UV_OT_select";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= select_exec;
- ot->invoke= select_invoke;
- ot->poll= ED_operator_image_active; /* requires space image */;
+ ot->exec = select_exec;
+ ot->invoke = select_invoke;
+ ot->poll = ED_operator_image_active; /* requires space image */;
/* properties */
RNA_def_boolean(ot->srna, "extend", 0,
@@ -2092,15 +2090,15 @@ static int select_loop_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void UV_OT_select_loop(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Loop Select";
- ot->description= "Select a loop of connected UV vertices";
- ot->idname= "UV_OT_select_loop";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Loop Select";
+ ot->description = "Select a loop of connected UV vertices";
+ ot->idname = "UV_OT_select_loop";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= select_loop_exec;
- ot->invoke= select_loop_invoke;
- ot->poll= ED_operator_image_active; /* requires space image */;
+ ot->exec = select_loop_exec;
+ ot->invoke = select_loop_invoke;
+ ot->poll = ED_operator_image_active; /* requires space image */;
/* properties */
RNA_def_boolean(ot->srna, "extend", 0,
@@ -2124,7 +2122,7 @@ static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, i
NearestHit hit, *hit_p= NULL;
- if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
BKE_report(op->reports, RPT_ERROR, "Can't select linked when sync selection is enabled");
return OPERATOR_CANCELLED;
}
@@ -2132,10 +2130,10 @@ static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, i
extend= RNA_boolean_get(op->ptr, "extend");
uvedit_pixel_to_float(sima, limit, 0.05f);
- if(pick) {
+ if (pick) {
float co[2];
- if(event) {
+ if (event) {
/* invoke */
ARegion *ar= CTX_wm_region(C);
@@ -2167,14 +2165,14 @@ static int select_linked_exec(bContext *C, wmOperator *op)
static void UV_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Linked";
- ot->description= "Select all UV vertices linked to the active UV map";
- ot->idname= "UV_OT_select_linked";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Select Linked";
+ ot->description = "Select all UV vertices linked to the active UV map";
+ ot->idname = "UV_OT_select_linked";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= select_linked_exec;
- ot->poll= ED_operator_image_active; /* requires space image */
+ ot->exec = select_linked_exec;
+ ot->poll = ED_operator_image_active; /* requires space image */
/* properties */
RNA_def_boolean(ot->srna, "extend", 0,
@@ -2194,15 +2192,15 @@ static int select_linked_pick_exec(bContext *C, wmOperator *op)
static void UV_OT_select_linked_pick(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Linked Pick";
- ot->description= "Select all UV vertices linked under the mouse";
- ot->idname= "UV_OT_select_linked_pick";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Select Linked Pick";
+ ot->description = "Select all UV vertices linked under the mouse";
+ ot->idname = "UV_OT_select_linked_pick";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->invoke= select_linked_pick_invoke;
- ot->exec= select_linked_pick_exec;
- ot->poll= ED_operator_image_active; /* requires space image */;
+ ot->invoke = select_linked_pick_invoke;
+ ot->exec = select_linked_pick_exec;
+ ot->poll = ED_operator_image_active; /* requires space image */;
/* properties */
RNA_def_boolean(ot->srna, "extend", 0,
@@ -2227,7 +2225,7 @@ static int unlink_selection_exec(bContext *C, wmOperator *op)
MTexPoly *tf;
MLoopUV *luv;
- if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
BKE_report(op->reports, RPT_ERROR, "Can't unlink selection when sync selection is enabled");
return OPERATOR_CANCELLED;
}
@@ -2236,7 +2234,7 @@ static int unlink_selection_exec(bContext *C, wmOperator *op)
int desel = 0;
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -2265,14 +2263,14 @@ static int unlink_selection_exec(bContext *C, wmOperator *op)
static void UV_OT_unlink_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Unlink Selection";
- ot->description= "Unlink selected UV vertices from active UV map";
- ot->idname= "UV_OT_unlink_selected";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Unlink Selection";
+ ot->description = "Unlink selected UV vertices from active UV map";
+ ot->idname = "UV_OT_unlink_selected";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= unlink_selection_exec;
- ot->poll= ED_operator_uvedit;
+ ot->exec = unlink_selection_exec;
+ ot->poll = ED_operator_uvedit;
}
/* ******************** border select operator **************** */
@@ -2299,7 +2297,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
BMIter iter, liter;
/* MTexPoly *tf; */
- if((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_VERTEX) {
+ if ((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_VERTEX) {
/* Tag all verts as untouched, then touch the ones that have a face center
* in the loop and select all MLoopUV's that use a touched vert. */
BMVert *eve;
@@ -2330,7 +2328,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
}
}
}
- else if((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_LOC) {
+ else if ((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_LOC) {
BMFace *efa_vlist;
/* MTexPoly *tf_vlist; */ /* UNUSED */
UvMapVert *start_vlist=NULL, *vlist_iter;
@@ -2348,10 +2346,10 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
/* verts are numbered above in make_uv_vert_map_EM, make sure this stays true! */
/* BMESH_TODO - why keep this commented? - campbell */
#if 0
- for(a=0, eve= em->verts.first; eve; a++, eve= eve->next)
+ for (a=0, eve= em->verts.first; eve; a++, eve= eve->next)
eve->tmp.l = a;
#endif
- if(vmap == NULL) {
+ if (vmap == NULL) {
return;
}
@@ -2361,7 +2359,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
/* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
- if(select)
+ if (select)
uvedit_uv_select(em, scene, l);
else
uvedit_uv_deselect(em, scene, l);
@@ -2369,10 +2367,10 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
vlist_iter= EDBM_get_uv_map_vert(vmap, BM_elem_index_get(l->v));
while (vlist_iter) {
- if(vlist_iter->separate)
+ if (vlist_iter->separate)
start_vlist = vlist_iter;
- if(efa_index == vlist_iter->f)
+ if (efa_index == vlist_iter->f)
break;
vlist_iter = vlist_iter->next;
@@ -2381,14 +2379,14 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
vlist_iter = start_vlist;
while (vlist_iter) {
- if(vlist_iter != start_vlist && vlist_iter->separate)
+ if (vlist_iter != start_vlist && vlist_iter->separate)
break;
- if(efa_index != vlist_iter->f) {
+ if (efa_index != vlist_iter->f) {
efa_vlist = EDBM_get_face_for_index(em, vlist_iter->f);
/* tf_vlist = CustomData_bmesh_get(&em->bm->pdata, efa_vlist->head.data, CD_MTEXPOLY); */ /* UNUSED */
- if(select)
+ if (select)
uvedit_uv_select(em, scene, BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa_vlist, vlist_iter->tfindex));
else
uvedit_uv_deselect(em, scene, BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa_vlist, vlist_iter->tfindex));
@@ -2405,7 +2403,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
else { /* SI_STICKY_DISABLE or ts->uv_flag & UV_SYNC_SELECTION */
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
- if(select)
+ if (select)
uvedit_face_select(scene, em, efa);
else
uvedit_face_deselect(scene, em, efa);
@@ -2433,10 +2431,10 @@ static int border_select_exec(bContext *C, wmOperator *op)
int change, pinned, select, faces, extend;
/* get rectangle from operator */
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
+ rect.xmin = RNA_int_get(op->ptr, "xmin");
+ rect.ymin = RNA_int_get(op->ptr, "ymin");
+ rect.xmax = RNA_int_get(op->ptr, "xmax");
+ rect.ymax = RNA_int_get(op->ptr, "ymax");
UI_view2d_region_to_view(&ar->v2d, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
@@ -2446,16 +2444,16 @@ static int border_select_exec(bContext *C, wmOperator *op)
pinned= RNA_boolean_get(op->ptr, "pinned");
extend= RNA_boolean_get(op->ptr, "extend");
- if(!extend)
+ if (!extend)
select_all_perform(C, SEL_DESELECT);
- if(ts->uv_flag & UV_SYNC_SELECTION)
+ if (ts->uv_flag & UV_SYNC_SELECTION)
faces= (ts->selectmode == SCE_SELECT_FACE);
else
faces= (ts->uv_selectmode == UV_SELECT_FACE);
/* do actual selection */
- if(faces && !pinned) {
+ if (faces && !pinned) {
/* handle face selection mode */
float cent[2];
@@ -2466,9 +2464,9 @@ static int border_select_exec(bContext *C, wmOperator *op)
BM_elem_flag_disable(efa, BM_ELEM_TAG);
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(uvedit_face_visible(scene, ima, efa, tf)) {
+ if (uvedit_face_visible(scene, ima, efa, tf)) {
poly_uv_center(em, efa, cent);
- if(BLI_in_rctf(&rectf, cent[0], cent[1])) {
+ if (BLI_in_rctf(&rectf, cent[0], cent[1])) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
change = 1;
}
@@ -2476,7 +2474,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
}
/* (de)selects all tagged faces and deals with sticky modes */
- if(change)
+ if (change)
uv_faces_do_sticky(C, sima, scene, obedit, select);
}
else {
@@ -2485,22 +2483,23 @@ static int border_select_exec(bContext *C, wmOperator *op)
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf))
+ if (!uvedit_face_visible(scene, ima, efa, tf))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- if(!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) {
+ if (!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) {
/* UV_SYNC_SELECTION - can't do pinned selection */
- if(BLI_in_rctf(&rectf, luv->uv[0], luv->uv[1])) {
- if(select) uvedit_uv_select(em, scene, l);
+ if (BLI_in_rctf(&rectf, luv->uv[0], luv->uv[1])) {
+ if (select) uvedit_uv_select(em, scene, l);
else uvedit_uv_deselect(em, scene, l);
}
- } else if(pinned) {
+ }
+ else if (pinned) {
if ((luv->flag & MLOOPUV_PINNED) &&
BLI_in_rctf(&rectf, luv->uv[0], luv->uv[1])) {
- if(select) uvedit_uv_select(em, scene, l);
+ if (select) uvedit_uv_select(em, scene, l);
else uvedit_uv_deselect(em, scene, l);
}
}
@@ -2508,12 +2507,12 @@ static int border_select_exec(bContext *C, wmOperator *op)
}
}
- if(change) {
+ if (change) {
/* make sure newly selected vert selection is updated*/
#if 0 /* BM_elem_select_set API handles all of this? */
- if(ts->uv_flag & UV_SYNC_SELECTION) {
- if(ts->selectmode != SCE_SELECT_FACE) {
- if(select) EDBM_select_flush(em);
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->selectmode != SCE_SELECT_FACE) {
+ if (select) EDBM_select_flush(em);
else EDBM_deselect_flush(em);
}
}
@@ -2530,19 +2529,19 @@ static int border_select_exec(bContext *C, wmOperator *op)
static void UV_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Border Select";
- ot->description= "Select UV vertices using border selection";
- ot->idname= "UV_OT_select_border";
+ ot->name = "Border Select";
+ ot->description = "Select UV vertices using border selection";
+ ot->idname = "UV_OT_select_border";
/* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= border_select_exec;
- ot->modal= WM_border_select_modal;
- ot->poll= ED_operator_image_active; /* requires space image */;
- ot->cancel= WM_border_select_cancel;
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = border_select_exec;
+ ot->modal = WM_border_select_modal;
+ ot->poll = ED_operator_image_active; /* requires space image */;
+ ot->cancel = WM_border_select_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "pinned", 0, "Pinned", "Border select pinned UVs only");
@@ -2565,8 +2564,8 @@ static void select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), S
y= (uv[1] - offset[1])*ell[1];
r2 = x*x + y*y;
- if(r2 < 1.0f) {
- if(select) uvedit_uv_select(em, scene, l);
+ if (r2 < 1.0f) {
+ if (select) uvedit_uv_select(em, scene, l);
else uvedit_uv_deselect(em, scene, l);
}
}
@@ -2611,7 +2610,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
}
#if 0 //I think the BM_elem_select_set api stuff handles all this as necessary?
- if(select) EM_select_flush(em);
+ if (select) EM_select_flush(em);
else EM_deselect_flush(em);
#endif
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
@@ -2622,19 +2621,19 @@ static int circle_select_exec(bContext *C, wmOperator *op)
static void UV_OT_circle_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Circle Select";
- ot->description= "Select UV vertices using circle selection";
- ot->idname= "UV_OT_circle_select";
+ ot->name = "Circle Select";
+ ot->description = "Select UV vertices using circle selection";
+ ot->idname = "UV_OT_circle_select";
/* api callbacks */
- ot->invoke= WM_gesture_circle_invoke;
- ot->modal= WM_gesture_circle_modal;
- ot->exec= circle_select_exec;
- ot->poll= ED_operator_image_active; /* requires space image */;
- ot->cancel= WM_gesture_circle_cancel;
+ ot->invoke = WM_gesture_circle_invoke;
+ ot->modal = WM_gesture_circle_modal;
+ ot->exec = circle_select_exec;
+ ot->poll = ED_operator_image_active; /* requires space image */;
+ ot->cancel = WM_gesture_circle_cancel;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
@@ -2682,7 +2681,7 @@ static int snap_cursor_exec(bContext *C, wmOperator *op)
break;
}
- if(!change)
+ if (!change)
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, sima);
@@ -2698,14 +2697,14 @@ static void UV_OT_snap_cursor(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Snap Cursor";
- ot->description= "Snap cursor to target type";
- ot->idname= "UV_OT_snap_cursor";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Snap Cursor";
+ ot->description = "Snap cursor to target type";
+ ot->idname = "UV_OT_snap_cursor";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= snap_cursor_exec;
- ot->poll= ED_operator_image_active; /* requires space image */;
+ ot->exec = snap_cursor_exec;
+ ot->poll = ED_operator_image_active; /* requires space image */;
/* properties */
RNA_def_enum(ot->srna, "target", target_items, 0, "Target", "Target to snap the selected UVs to");
@@ -2725,11 +2724,11 @@ static int snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, SpaceIma
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tface= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tface))
+ if (!uvedit_face_visible(scene, ima, efa, tface))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
- if(uvedit_uv_selected(em, scene, l)) {
+ if (uvedit_uv_selected(em, scene, l)) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
copy_v2_v2(luv->uv, sima->cursor);
change= 1;
@@ -2767,10 +2766,11 @@ static int snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obe
* get unique indices and to count how much to malloc */
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tface= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tface)) {
+ if (!uvedit_face_visible(scene, ima, efa, tface)) {
BM_elem_flag_disable(efa, BM_ELEM_TAG);
continue;
- } else {
+ }
+ else {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
}
@@ -2793,7 +2793,7 @@ static int snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obe
continue;
tface= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tface))
+ if (!uvedit_face_visible(scene, ima, efa, tface))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -2807,7 +2807,7 @@ static int snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obe
}
/* no other verts selected, bail out */
- if(!change) {
+ if (!change) {
MEM_freeN(coords);
MEM_freeN(usercount);
return change;
@@ -2819,7 +2819,7 @@ static int snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obe
continue;
tface= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tface))
+ if (!uvedit_face_visible(scene, ima, efa, tface))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -2856,7 +2856,7 @@ static int snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit)
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tface= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tface))
+ if (!uvedit_face_visible(scene, ima, efa, tface))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -2892,7 +2892,7 @@ static int snap_selection_exec(bContext *C, wmOperator *op)
break;
}
- if(!change)
+ if (!change)
return OPERATOR_CANCELLED;
uvedit_live_unwrap_update(sima, scene, obedit);
@@ -2911,14 +2911,14 @@ static void UV_OT_snap_selected(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Snap Selection";
- ot->description= "Snap selected UV vertices to target type";
- ot->idname= "UV_OT_snap_selected";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Snap Selection";
+ ot->description = "Snap selected UV vertices to target type";
+ ot->idname = "UV_OT_snap_selected";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= snap_selection_exec;
- ot->poll= ED_operator_image_active; /* requires space image */;
+ ot->exec = snap_selection_exec;
+ ot->poll = ED_operator_image_active; /* requires space image */;
/* properties */
RNA_def_enum(ot->srna, "target", target_items, 0, "Target", "Target to snap the selected UVs to");
@@ -2941,16 +2941,17 @@ static int pin_exec(bContext *C, wmOperator *op)
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tface= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tface))
+ if (!uvedit_face_visible(scene, ima, efa, tface))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- if(!clear) {
+ if (!clear) {
if (uvedit_uv_selected(em, scene, l))
luv->flag |= MLOOPUV_PINNED;
- } else {
+ }
+ else {
if (uvedit_uv_selected(em, scene, l))
luv->flag &= ~MLOOPUV_PINNED;
}
@@ -2965,14 +2966,14 @@ static int pin_exec(bContext *C, wmOperator *op)
static void UV_OT_pin(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Pin";
- ot->description= "Set/clear selected UV vertices as anchored between multiple unwrap operations";
- ot->idname= "UV_OT_pin";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Pin";
+ ot->description = "Set/clear selected UV vertices as anchored between multiple unwrap operations";
+ ot->idname = "UV_OT_pin";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= pin_exec;
- ot->poll= ED_operator_uvedit;
+ ot->exec = pin_exec;
+ ot->poll = ED_operator_uvedit;
/* properties */
RNA_def_boolean(ot->srna, "clear", 0, "Clear", "Clear pinning for the selection instead of setting it");
@@ -2994,7 +2995,7 @@ static int select_pinned_exec(bContext *C, wmOperator *UNUSED(op))
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tface= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tface))
+ if (!uvedit_face_visible(scene, ima, efa, tface))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -3013,14 +3014,14 @@ static int select_pinned_exec(bContext *C, wmOperator *UNUSED(op))
static void UV_OT_select_pinned(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Selected Pinned";
- ot->description= "Select all pinned UV vertices";
- ot->idname= "UV_OT_select_pinned";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Selected Pinned";
+ ot->description = "Select all pinned UV vertices";
+ ot->idname = "UV_OT_select_pinned";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= select_pinned_exec;
- ot->poll= ED_operator_uvedit;
+ ot->exec = select_pinned_exec;
+ ot->poll = ED_operator_uvedit;
}
/********************** hide operator *********************/
@@ -3039,7 +3040,7 @@ static int hide_exec(bContext *C, wmOperator *op)
int swap = RNA_boolean_get(op->ptr, "unselected");
int facemode= sima ? sima->flag & SI_SELACTFACE : 0;
- if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
EDBM_hide_mesh(em, swap);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
@@ -3075,7 +3076,8 @@ static int hide_exec(bContext *C, wmOperator *op)
BM_elem_select_set(em->bm, efa, FALSE);
uvedit_face_deselect(scene, em, efa);
}
- } else if(em->selectmode == SCE_SELECT_FACE) {
+ }
+ else if (em->selectmode == SCE_SELECT_FACE) {
/*check if a UV is selected*/
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
@@ -3084,7 +3086,8 @@ static int hide_exec(bContext *C, wmOperator *op)
}
luv->flag &= ~MLOOPUV_VERTSEL;
}
- } else {
+ }
+ else {
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
if (luv->flag & MLOOPUV_VERTSEL) {
@@ -3106,14 +3109,14 @@ static int hide_exec(bContext *C, wmOperator *op)
static void UV_OT_hide(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Hide Selected";
- ot->description= "Hide (un)selected UV vertices";
- ot->idname= "UV_OT_hide";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Hide Selected";
+ ot->description = "Hide (un)selected UV vertices";
+ ot->idname = "UV_OT_hide";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= hide_exec;
- ot->poll= ED_operator_uvedit;
+ ot->exec = hide_exec;
+ ot->poll = ED_operator_uvedit;
/* props */
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
@@ -3136,14 +3139,14 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
int stickymode= sima ? (sima->sticky != SI_STICKY_DISABLE) : 1;
/* call the mesh function if we are in mesh sync sel */
- if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
EDBM_reveal_mesh(em);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
- if(facemode) {
- if(em->selectmode == SCE_SELECT_FACE) {
+ if (facemode) {
+ if (em->selectmode == SCE_SELECT_FACE) {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BM_elem_select_set(em->bm, efa, TRUE);
@@ -3156,7 +3159,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
}
else {
/* enable adjacent faces to have disconnected UV selections if sticky is disabled */
- if(!stickymode) {
+ if (!stickymode) {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
int totsel=0;
@@ -3174,7 +3177,8 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
}
}
}
- } else {
+ }
+ else {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -3189,7 +3193,8 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
}
}
}
- } else if(em->selectmode == SCE_SELECT_FACE) {
+ }
+ else if (em->selectmode == SCE_SELECT_FACE) {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -3200,7 +3205,8 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
BM_elem_select_set(em->bm, efa, TRUE);
}
}
- } else {
+ }
+ else {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -3223,14 +3229,14 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
static void UV_OT_reveal(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reveal Hidden";
- ot->description= "Reveal all hidden UV vertices";
- ot->idname= "UV_OT_reveal";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Reveal Hidden";
+ ot->description = "Reveal all hidden UV vertices";
+ ot->idname = "UV_OT_reveal";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= reveal_exec;
- ot->poll= ED_operator_uvedit;
+ ot->exec = reveal_exec;
+ ot->poll = ED_operator_uvedit;
}
/******************** set 3d cursor operator ********************/
@@ -3240,7 +3246,7 @@ static int set_2d_cursor_exec(bContext *C, wmOperator *op)
SpaceImage *sima = CTX_wm_space_image(C);
float location[2];
- if(!sima)
+ if (!sima)
return OPERATOR_CANCELLED;
RNA_float_get_array(op->ptr, "location", location);
@@ -3266,17 +3272,17 @@ static int set_2d_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void UV_OT_cursor_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set 2D Cursor";
- ot->description= "Set 2D cursor location";
- ot->idname= "UV_OT_cursor_set";
+ ot->name = "Set 2D Cursor";
+ ot->description = "Set 2D cursor location";
+ ot->idname = "UV_OT_cursor_set";
/* api callbacks */
- ot->exec= set_2d_cursor_exec;
- ot->invoke= set_2d_cursor_invoke;
- ot->poll= ED_operator_image_active; /* requires space image */;
+ ot->exec = set_2d_cursor_exec;
+ ot->invoke = set_2d_cursor_invoke;
+ ot->poll = ED_operator_image_active; /* requires space image */;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f);
@@ -3292,7 +3298,7 @@ static int set_tile_exec(bContext *C, wmOperator *op)
RNA_int_get_array(op->ptr, "tile", tile);
- if(uvedit_set_tile(obedit, ima, tile[0] + ima->xrep*tile[1])) {
+ if (uvedit_set_tile(obedit, ima, tile[0] + ima->xrep*tile[1])) {
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL);
@@ -3310,12 +3316,12 @@ static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event)
float fx, fy;
int tile[2];
- if(!ima || !(ima->tpageflag & IMA_TILES))
+ if (!ima || !(ima->tpageflag & IMA_TILES))
return OPERATOR_CANCELLED;
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);
- if(fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
+ if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
fx= fx*ima->xrep;
fy= fy*ima->yrep;
@@ -3332,17 +3338,17 @@ static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void UV_OT_tile_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Tile";
- ot->description= "Set UV image tile coordinates";
- ot->idname= "UV_OT_tile_set";
+ ot->name = "Set Tile";
+ ot->description = "Set UV image tile coordinates";
+ ot->idname = "UV_OT_tile_set";
/* api callbacks */
- ot->exec= set_tile_exec;
- ot->invoke= set_tile_invoke;
- ot->poll= ED_operator_image_active; /* requires space image */;
+ ot->exec = set_tile_exec;
+ ot->invoke = set_tile_invoke;
+ ot->poll = ED_operator_image_active; /* requires space image */;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_int_vector(ot->srna, "tile", 2, NULL, 0, INT_MAX, "Tile", "Tile coordinate", 0, 10);
@@ -3366,7 +3372,7 @@ static int seams_from_islands_exec(bContext *C, wmOperator *op)
em = me->edit_btmesh;
bm = em->bm;
- if(!EDBM_texFaceCheck(em)) {
+ if (!EDBM_texFaceCheck(em)) {
return OPERATOR_CANCELLED;
}
@@ -3392,34 +3398,34 @@ static int seams_from_islands_exec(bContext *C, wmOperator *op)
UvMapVert *mv2cache = NULL, *mv2sep = NULL;
mvinit1 = vmap->vert[BM_elem_index_get(editedge->v1)];
- if(mark_seams)
+ if (mark_seams)
BM_elem_flag_disable(editedge, BM_ELEM_SEAM);
- for(mv1 = mvinit1; mv1 && !faces_separated; mv1 = mv1->next) {
- if(mv1->separate && commonFaces)
+ for (mv1 = mvinit1; mv1 && !faces_separated; mv1 = mv1->next) {
+ if (mv1->separate && commonFaces)
v1coincident = 0;
separated2 = 0;
efa1 = EDBM_get_face_for_index(em, mv1->f);
mvinit2 = vmap->vert[BM_elem_index_get(editedge->v2)];
- for(mv2 = mvinit2; mv2; mv2 = mv2->next) {
- if(mv2->separate)
+ for (mv2 = mvinit2; mv2; mv2 = mv2->next) {
+ if (mv2->separate)
mv2sep = mv2;
efa2 = EDBM_get_face_for_index(em, mv2->f);
- if(efa1 == efa2) {
+ if (efa1 == efa2) {
/* if v1 is not coincident no point in comparing */
- if(v1coincident) {
+ if (v1coincident) {
/* have we found previously anything? */
- if(mv2cache) {
+ if (mv2cache) {
/* flag seam unless proved to be coincident with previous hit */
separated2 = 1;
- for(mviter = mv2cache; mviter; mviter = mviter->next) {
- if(mviter->separate && mviter != mv2cache)
+ for (mviter = mv2cache; mviter; mviter = mviter->next) {
+ if (mviter->separate && mviter != mv2cache)
break;
/* coincident with previous hit, do not flag seam */
- if(mviter == mv2)
+ if (mviter == mv2)
separated2 = 0;
}
}
@@ -3432,7 +3438,7 @@ static int seams_from_islands_exec(bContext *C, wmOperator *op)
else
separated1 = 1;
- if(separated1 || separated2) {
+ if (separated1 || separated2) {
faces_separated = 1;
break;
}
@@ -3440,10 +3446,10 @@ static int seams_from_islands_exec(bContext *C, wmOperator *op)
}
}
- if(faces_separated) {
- if(mark_seams)
+ if (faces_separated) {
+ if (mark_seams)
BM_elem_flag_enable(editedge, BM_ELEM_SEAM);
- if(mark_sharp)
+ if (mark_sharp)
BM_elem_flag_disable(editedge, BM_ELEM_SMOOTH);
}
}
@@ -3463,16 +3469,16 @@ static int seams_from_islands_exec(bContext *C, wmOperator *op)
static void UV_OT_seams_from_islands(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Seams From Islands";
- ot->description= "Set mesh seams according to island setup in the UV editor";
- ot->idname= "UV_OT_seams_from_islands";
+ ot->name = "Seams From Islands";
+ ot->description = "Set mesh seams according to island setup in the UV editor";
+ ot->idname = "UV_OT_seams_from_islands";
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= seams_from_islands_exec;
- ot->poll= ED_operator_uvedit;
+ ot->exec = seams_from_islands_exec;
+ ot->poll = ED_operator_uvedit;
RNA_def_boolean(ot->srna, "mark_seams", 1, "Mark Seams", "Mark boundary edges as seams");
RNA_def_boolean(ot->srna, "mark_sharp", 0, "Mark Sharp", "Mark boundary edges as sharp");
@@ -3492,7 +3498,7 @@ static int mark_seam_exec(bContext *C, wmOperator *UNUSED(op))
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
BM_ITER(loop, &liter, bm, BM_LOOPS_OF_FACE, efa) {
- if(uvedit_edge_selected(em, scene, loop)) {
+ if (uvedit_edge_selected(em, scene, loop)) {
BM_elem_flag_enable(loop, BM_ELEM_SEAM);
}
}
@@ -3500,7 +3506,7 @@ static int mark_seam_exec(bContext *C, wmOperator *UNUSED(op))
me->drawflag |= ME_DRAWSEAMS;
- if(scene->toolsettings->edge_mode_live_unwrap)
+ if (scene->toolsettings->edge_mode_live_unwrap)
ED_unwrap_lscm(scene, ob, FALSE);
DAG_id_tag_update(&me->id, 0);
@@ -3512,16 +3518,16 @@ static int mark_seam_exec(bContext *C, wmOperator *UNUSED(op))
static void UV_OT_mark_seam(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mark Seams";
- ot->description= "Mark selected UV edges as seams";
- ot->idname= "UV_OT_mark_seam";
+ ot->name = "Mark Seams";
+ ot->description = "Mark selected UV edges as seams";
+ ot->idname = "UV_OT_mark_seam";
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= mark_seam_exec;
- ot->poll= ED_operator_uvedit;
+ ot->exec = mark_seam_exec;
+ ot->poll = ED_operator_uvedit;
}
@@ -3573,8 +3579,8 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
wmKeyMap *keymap;
wmKeyMapItem *kmi;
- keymap= WM_keymap_find(keyconf, "UV Editor", 0, 0);
- keymap->poll= ED_operator_uvedit_can_uv_sculpt;
+ keymap = WM_keymap_find(keyconf, "UV Editor", 0, 0);
+ keymap->poll = ED_operator_uvedit_can_uv_sculpt;
/* Uv sculpt toggle */
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", QKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index d6035b08fd6..7d388e6206c 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -800,12 +800,12 @@ static PBool p_edge_implicit_seam(PEdge *e, PEdge *ep)
uvp2 = ep->orig_uv;
}
- if((fabsf(uv1[0]-uvp1[0]) > limit[0]) || (fabsf(uv1[1]-uvp1[1]) > limit[1])) {
+ if ((fabsf(uv1[0]-uvp1[0]) > limit[0]) || (fabsf(uv1[1]-uvp1[1]) > limit[1])) {
e->flag |= PEDGE_SEAM;
ep->flag |= PEDGE_SEAM;
return P_TRUE;
}
- if((fabsf(uv2[0]-uvp2[0]) > limit[0]) || (fabsf(uv2[1]-uvp2[1]) > limit[1])) {
+ if ((fabsf(uv2[0]-uvp2[0]) > limit[0]) || (fabsf(uv2[1]-uvp2[1]) > limit[1])) {
e->flag |= PEDGE_SEAM;
ep->flag |= PEDGE_SEAM;
return P_TRUE;
@@ -866,7 +866,7 @@ static PBool p_edge_connect_pair(PHandle *handle, PEdge *e, PEdge ***stack, PBoo
{
PEdge *pair = NULL;
- if(!e->pair && p_edge_has_pair(handle, e, &pair, impl)) {
+ if (!e->pair && p_edge_has_pair(handle, e, &pair, impl)) {
if (e->vert == pair->vert)
p_face_flip(pair->face);
@@ -1162,7 +1162,7 @@ static void p_chart_boundaries(PChart *chart, int *nboundaries, PEdge **outer)
be->flag |= PEDGE_DONE;
len += p_edge_length(be);
be = be->next->vert->edge;
- } while(be != e);
+ } while (be != e);
if (outer && (len > maxlen)) {
*outer = e;
@@ -1213,7 +1213,7 @@ static void p_chart_fill_boundary(PChart *chart, PEdge *be, int nedges)
e->u.heaplink = BLI_heap_insert(heap, angle, e);
e = p_boundary_edge_next(e);
- } while(e != be);
+ } while (e != be);
if (nedges == 2) {
/* no real boundary, but an isolated seam */
@@ -1297,7 +1297,7 @@ static void p_chart_fill_boundaries(PChart *chart, PEdge *outer)
be->flag |= PEDGE_FILLED;
be = be->next->vert->edge;
nedges++;
- } while(be != e);
+ } while (be != e);
if (e != outer)
p_chart_fill_boundary(chart, e, nedges);
@@ -2847,7 +2847,7 @@ static PBool p_chart_symmetry_pins(PChart *chart, PEdge *outer, PVert **pin1, PV
lastbe = be;
be = nextbe;
- } while(be != outer);
+ } while (be != outer);
/* make sure we also count a series of splits over the starting point */
if (cure && (cure != outer)) {
@@ -3180,7 +3180,7 @@ static void p_stretch_pin_boundary(PChart *chart)
{
PVert *v;
- for(v=chart->verts; v; v=v->nextlink)
+ for (v=chart->verts; v; v=v->nextlink)
if (v->edge->pair == NULL)
v->flag |= PVERT_PIN;
else
@@ -3261,8 +3261,8 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
float orig_stretch, low, stretch_low, high, stretch_high, mid, stretch;
float orig_uv[2], dir[2], random_angle, trusted_radius;
- for(v=chart->verts; v; v=v->nextlink) {
- if((v->flag & PVERT_PIN) || !(v->flag & PVERT_SELECT))
+ for (v=chart->verts; v; v=v->nextlink) {
+ if ((v->flag & PVERT_PIN) || !(v->flag & PVERT_SELECT))
continue;
orig_stretch = p_stretch_compute_vertex(v);
@@ -3313,7 +3313,7 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
}
/* no luck, stretch has increased, reset to old values */
- if(stretch >= orig_stretch)
+ if (stretch >= orig_stretch)
copy_v2_v2(v->uv, orig_uv);
}
}
@@ -3357,7 +3357,7 @@ static PBool p_chart_convex_hull(PChart *chart, PVert ***verts, int *nverts, int
do {
npoints++;
e = p_boundary_edge_next(e);
- } while(e != be);
+ } while (e != be);
p = points = (PVert**)MEM_mallocN(sizeof(PVert*)*npoints*2, "PCHullpoints");
U = (PVert**)MEM_mallocN(sizeof(PVert*)*npoints, "PCHullU");
@@ -3368,7 +3368,7 @@ static PBool p_chart_convex_hull(PChart *chart, PVert ***verts, int *nverts, int
*p = e->vert;
p++;
e = p_boundary_edge_next(e);
- } while(e != be);
+ } while (e != be);
qsort(points, npoints, sizeof(PVert*), p_compare_geometric_uv);
@@ -3792,7 +3792,7 @@ static void p_smooth(PChart *chart)
nwheel++;
e = e->next->next->pair;
- } while(e && (e != v->edge));
+ } while (e && (e != v->edge));
v->u.distortion /= nwheel;
}
@@ -4344,7 +4344,7 @@ void param_pack(ParamHandle *handle, float margin)
if (phandle->ncharts == 0)
return;
- if(phandle->aspx != phandle->aspy)
+ if (phandle->aspx != phandle->aspy)
param_scale(handle, 1.0f/phandle->aspx, 1.0f/phandle->aspy);
/* we may not use all these boxes */
@@ -4372,11 +4372,11 @@ void param_pack(ParamHandle *handle, float margin)
box->h = chart->u.pack.size[1] + trans[1];
box->index = i; /* warning this index skips PCHART_NOPACK boxes */
- if(margin>0.0f)
+ if (margin>0.0f)
area += sqrt(box->w*box->h);
}
- if(margin>0.0f) {
+ if (margin>0.0f) {
/* multiply the margin by the area to give predictable results not dependent on UV scale,
* ...Without using the area running pack multiple times also gives a bad feedback loop.
* multiply by 0.1 so the margin value from the UI can be from 0.0 to 1.0 but not give a massive margin */
@@ -4417,7 +4417,7 @@ void param_pack(ParamHandle *handle, float margin)
}
MEM_freeN(boxarray);
- if(phandle->aspx != phandle->aspy)
+ if (phandle->aspx != phandle->aspy)
param_scale(handle, phandle->aspx, phandle->aspy);
}
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 676701b9c2a..af87f4d4b07 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -185,24 +185,24 @@ static StitchPreviewer * stitch_preview_init(void)
/* destructor...yeah this should be C++ :) */
static void stitch_preview_delete(void)
{
- if(_stitch_preview) {
- if(_stitch_preview->preview_polys){
+ if (_stitch_preview) {
+ if (_stitch_preview->preview_polys) {
MEM_freeN(_stitch_preview->preview_polys);
_stitch_preview->preview_polys = NULL;
}
- if(_stitch_preview->uvs_per_polygon){
+ if (_stitch_preview->uvs_per_polygon) {
MEM_freeN(_stitch_preview->uvs_per_polygon);
_stitch_preview->uvs_per_polygon = NULL;
}
- if(_stitch_preview->preview_stitchable){
+ if (_stitch_preview->preview_stitchable) {
MEM_freeN(_stitch_preview->preview_stitchable);
_stitch_preview->preview_stitchable = NULL;
}
- if(_stitch_preview->preview_unstitchable){
+ if (_stitch_preview->preview_unstitchable) {
MEM_freeN(_stitch_preview->preview_unstitchable);
_stitch_preview->preview_unstitchable = NULL;
}
- if(_stitch_preview->static_tris){
+ if (_stitch_preview->static_tris) {
MEM_freeN(_stitch_preview->static_tris);
_stitch_preview->static_tris = NULL;
}
@@ -229,7 +229,7 @@ static void stitch_update_header(StitchState *stitch_state, bContext *C)
char msg[HEADER_LENGTH];
ScrArea *sa= CTX_wm_area(C);
- if(sa) {
+ if (sa) {
BLI_snprintf(msg, HEADER_LENGTH, str,
stitch_state->snap_islands? "On" : "Off",
stitch_state->midpoints? "On": "Off",
@@ -242,9 +242,10 @@ static void stitch_update_header(StitchState *stitch_state, bContext *C)
static int getNumOfIslandUvs(UvElementMap *elementMap, int island)
{
- if(island == elementMap->totalIslands-1){
+ if (island == elementMap->totalIslands-1) {
return elementMap->totalUVs - elementMap->islandIndices[island];
- }else{
+ }
+ else {
return elementMap->islandIndices[island+1] - elementMap->islandIndices[island];
}
}
@@ -268,14 +269,14 @@ static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_it
float limit;
int do_limit;
- if(element_iter == element){
+ if (element_iter == element) {
return 0;
}
limit = state->limit_dist;
do_limit = state->use_limit;
- if(do_limit){
+ if (do_limit) {
MLoopUV *luv_orig, *luv_iter;
BMLoop *l_orig, *l_iter;
@@ -285,19 +286,23 @@ static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_it
l_iter = element_iter->l;
luv_iter = CustomData_bmesh_get(&state->em->bm->ldata, l_iter->head.data, CD_MLOOPUV);
- if(fabs(luv_orig->uv[0] - luv_iter->uv[0]) < limit
- && fabs(luv_orig->uv[1] - luv_iter->uv[1]) < limit){
+ if (fabs(luv_orig->uv[0] - luv_iter->uv[0]) < limit
+ && fabs(luv_orig->uv[1] - luv_iter->uv[1]) < limit) {
return 1;
- }else
+ }
+ else {
return 0;
- }else
+ }
+ }
+ else {
return 1;
+ }
}
static int stitch_check_uvs_state_stitchable(UvElement *element, UvElement *element_iter, StitchState *state)
{
- if((state->snap_islands && element->island == element_iter->island) ||
+ if ((state->snap_islands && element->island == element_iter->island) ||
(!state->midpoints && element->island == element_iter->island))
return 0;
@@ -311,12 +316,12 @@ static void stitch_calculate_island_snapping(StitchState *state, PreviewPosition
int i;
UvElement *element;
- for(i = 0; i < state->element_map->totalIslands; i++){
- if(island_stitch_data[i].addedForPreview){
+ for (i = 0; i < state->element_map->totalIslands; i++) {
+ if (island_stitch_data[i].addedForPreview) {
int numOfIslandUVs = 0, j;
/* check to avoid divide by 0 */
- if(island_stitch_data[i].num_rot_elements>0){
+ if (island_stitch_data[i].num_rot_elements>0) {
island_stitch_data[i].rotation /= island_stitch_data[i].num_rot_elements;
island_stitch_data[i].medianPoint[0] /= island_stitch_data[i].numOfElements;
island_stitch_data[i].medianPoint[1] /= island_stitch_data[i].numOfElements;
@@ -325,16 +330,16 @@ static void stitch_calculate_island_snapping(StitchState *state, PreviewPosition
island_stitch_data[i].translation[1] /= island_stitch_data[i].numOfElements;
numOfIslandUVs = getNumOfIslandUvs(state->element_map, i);
element = &state->element_map->buf[state->element_map->islandIndices[i]];
- for(j = 0; j < numOfIslandUVs; j++, element++){
+ for (j = 0; j < numOfIslandUVs; j++, element++) {
/* stitchable uvs have already been processed, don't process */
- if(!(element->flag & STITCH_PROCESSED)){
+ if (!(element->flag & STITCH_PROCESSED)) {
MLoopUV *luv;
BMLoop *l;
l = element->l;
luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
- if(final){
+ if (final) {
stitch_uv_rotate(island_stitch_data[i].rotation, island_stitch_data[i].medianPoint, luv->uv);
@@ -410,7 +415,7 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
float rotation = 0;
BMLoop *l;
- if(element->island == state->static_island && !state->midpoints)
+ if (element->island == state->static_island && !state->midpoints)
return;
l = element->l;
@@ -419,8 +424,8 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
element_iter = state->element_map->vert[index];
- for(; element_iter; element_iter = element_iter->next){
- if(element_iter->separate && stitch_check_uvs_state_stitchable(element, element_iter, state)){
+ for (; element_iter; element_iter = element_iter->next) {
+ if (element_iter->separate && stitch_check_uvs_state_stitchable(element, element_iter, state)) {
int index_tmp1, index_tmp2;
float normal[2];
/* easily possible*/
@@ -437,7 +442,7 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
}
}
- if(state->midpoints)
+ if (state->midpoints)
rotation /= 2.0;
island_stitch_data[element->island].num_rot_elements++;
island_stitch_data[element->island].rotation += rotation;
@@ -446,26 +451,26 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
static void stitch_state_delete(StitchState *stitch_state)
{
- if(stitch_state){
- if(stitch_state->element_map){
+ if (stitch_state) {
+ if (stitch_state->element_map) {
EDBM_free_uv_element_map(stitch_state->element_map);
}
- if(stitch_state->uvs){
+ if (stitch_state->uvs) {
MEM_freeN(stitch_state->uvs);
}
- if(stitch_state->selection_stack){
+ if (stitch_state->selection_stack) {
MEM_freeN(stitch_state->selection_stack);
}
- if(stitch_state->tris_per_island){
+ if (stitch_state->tris_per_island) {
MEM_freeN(stitch_state->tris_per_island);
}
- if(stitch_state->map){
+ if (stitch_state->map) {
MEM_freeN(stitch_state->map);
}
- if(stitch_state->normals){
+ if (stitch_state->normals) {
MEM_freeN(stitch_state->normals);
}
- if(stitch_state->edges){
+ if (stitch_state->edges) {
MEM_freeN(stitch_state->edges);
}
MEM_freeN(stitch_state);
@@ -486,12 +491,12 @@ static void determine_uv_stitchability(UvElement *element, StitchState *state, I
vert_index = BM_elem_index_get(l->v);
element_iter = state->element_map->vert[vert_index];
- for(; element_iter; element_iter = element_iter->next){
- if(element_iter->separate){
- if(element_iter == element){
+ for (; element_iter; element_iter = element_iter->next) {
+ if (element_iter->separate) {
+ if (element_iter == element) {
continue;
}
- if(stitch_check_uvs_stitchable(element, element_iter, state)){
+ if (stitch_check_uvs_stitchable(element, element_iter, state)) {
island_stitch_data[element_iter->island].stitchableCandidate = 1;
island_stitch_data[element->island].stitchableCandidate = 1;
element->flag |= STITCH_STITCHABLE_CANDIDATE;
@@ -506,7 +511,7 @@ static void stitch_set_face_preview_buffer_position(BMFace *efa, StitchPreviewer
{
int index = BM_elem_index_get(efa);
- if(preview_position[index].data_position == STITCH_NO_PREVIEW) {
+ if (preview_position[index].data_position == STITCH_NO_PREVIEW) {
preview_position[index].data_position = preview->preview_uvs*2;
preview_position[index].polycount_position = preview->num_polys++;
preview->preview_uvs += efa->len;
@@ -516,27 +521,27 @@ static void stitch_set_face_preview_buffer_position(BMFace *efa, StitchPreviewer
/* setup face preview for all coincident uvs and their faces */
static void stitch_setup_face_preview_for_uv_group(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data,
- PreviewPosition *preview_position){
+ PreviewPosition *preview_position) {
StitchPreviewer *preview = uv_get_stitch_previewer();
/* static island does not change so returning immediately */
- if(state->snap_islands && !state->midpoints && state->static_island == element->island)
+ if (state->snap_islands && !state->midpoints && state->static_island == element->island)
return;
- if(state->snap_islands){
+ if (state->snap_islands) {
island_stitch_data[element->island].addedForPreview = 1;
}
- do{
+ do {
stitch_set_face_preview_buffer_position(element->face, preview, preview_position);
element = element->next;
- }while(element && !element->separate);
+ } while (element && !element->separate);
}
/* checks if uvs are indeed stitchable and registers so that they can be shown in preview */
static void stitch_validate_stichability (UvElement *element, StitchState *state, IslandStitchData *island_stitch_data,
- PreviewPosition *preview_position){
+ PreviewPosition *preview_position) {
UvElement *element_iter;
StitchPreviewer *preview;
int vert_index;
@@ -549,12 +554,12 @@ static void stitch_validate_stichability (UvElement *element, StitchState *state
preview = uv_get_stitch_previewer();
element_iter = state->element_map->vert[vert_index];
- for(; element_iter; element_iter = element_iter->next){
- if(element_iter->separate){
- if(element_iter == element)
+ for (; element_iter; element_iter = element_iter->next) {
+ if (element_iter->separate) {
+ if (element_iter == element)
continue;
- if(stitch_check_uvs_state_stitchable(element, element_iter, state)){
- if((element_iter->island == state->static_island) || (element->island == state->static_island)){
+ if (stitch_check_uvs_state_stitchable(element, element_iter, state)) {
+ if ((element_iter->island == state->static_island) || (element->island == state->static_island)) {
element->flag |= STITCH_STITCHABLE;
preview->num_stitchable++;
stitch_setup_face_preview_for_uv_group(element, state, island_stitch_data, preview_position);
@@ -565,7 +570,7 @@ static void stitch_validate_stichability (UvElement *element, StitchState *state
}
/* this can happen if the uvs to be stitched are not on a stitchable island */
- if(!(element->flag & STITCH_STITCHABLE)){
+ if (!(element->flag & STITCH_STITCHABLE)) {
preview->num_unstitchable++;
}
}
@@ -589,17 +594,17 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
/* cleanup previous preview */
stitch_preview_delete();
preview = stitch_preview_init();
- if(preview == NULL)
+ if (preview == NULL)
return 0;
preview_position = MEM_mallocN(state->em->bm->totface*sizeof(*preview_position), "stitch_face_preview_position");
/* each face holds its position in the preview buffer in tmp. -1 is uninitialized */
- for(i = 0; i < state->em->bm->totface; i++){
+ for (i = 0; i < state->em->bm->totface; i++) {
preview_position[i].data_position = STITCH_NO_PREVIEW;
}
island_stitch_data = MEM_callocN(sizeof(*island_stitch_data)*state->element_map->totalIslands, "stitch_island_data");
- if(!island_stitch_data){
+ if (!island_stitch_data) {
return 0;
}
@@ -610,27 +615,28 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
* First determine stitchability of uvs *
*****************************************/
- for(i = 0; i < state->selection_size; i++){
+ for (i = 0; i < state->selection_size; i++) {
UvElement *element = state->selection_stack[i];
determine_uv_stitchability(element, state, island_stitch_data);
}
/* set static island to one that is added for preview */
state->static_island %= state->element_map->totalIslands;
- while(!(island_stitch_data[state->static_island].stitchableCandidate)){
+ while (!(island_stitch_data[state->static_island].stitchableCandidate)) {
state->static_island++;
state->static_island %= state->element_map->totalIslands;
/* this is entirely possible if for example limit stitching with no stitchable verts or no selection */
- if(state->static_island == previous_island)
+ if (state->static_island == previous_island)
break;
}
- for(i = 0; i < state->selection_size; i++){
+ for (i = 0; i < state->selection_size; i++) {
UvElement *element = state->selection_stack[i];
- if(element->flag & STITCH_STITCHABLE_CANDIDATE){
+ if (element->flag & STITCH_STITCHABLE_CANDIDATE) {
element->flag &= ~STITCH_STITCHABLE_CANDIDATE;
stitch_validate_stichability(element, state, island_stitch_data, preview_position);
- }else{
+ }
+ else {
/* add to preview for unstitchable */
preview->num_unstitchable++;
}
@@ -639,14 +645,14 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
/*****************************************
* Setup preview for stitchable islands *
*****************************************/
- if(state->snap_islands){
- for(i = 0; i < state->element_map->totalIslands; i++){
- if(island_stitch_data[i].addedForPreview){
+ if (state->snap_islands) {
+ for (i = 0; i < state->element_map->totalIslands; i++) {
+ if (island_stitch_data[i].addedForPreview) {
int numOfIslandUVs = 0, j;
UvElement *element;
numOfIslandUVs = getNumOfIslandUvs(state->element_map, i);
element = &state->element_map->buf[state->element_map->islandIndices[i]];
- for(j = 0; j < numOfIslandUVs; j++, element++){
+ for (j = 0; j < numOfIslandUVs; j++, element++) {
stitch_set_face_preview_buffer_position(element->face, preview, preview_position);
}
}
@@ -656,7 +662,7 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
/*********************************************************************
* Setup the preview buffers and fill them with the appropriate data *
*********************************************************************/
- if(!final){
+ if (!final) {
BMIter liter;
BMLoop *l;
MLoopUV *luv;
@@ -672,7 +678,7 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
preview->num_static_tris = state->tris_per_island[state->static_island];
/* will cause cancel and freeing of all data structures so OK */
- if(!preview->preview_polys || !preview->preview_stitchable || !preview->preview_unstitchable){
+ if (!preview->preview_polys || !preview->preview_stitchable || !preview->preview_unstitchable) {
return 0;
}
@@ -681,11 +687,11 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
/* just to test if face was added for processing. uvs of inselected vertices will return NULL */
UvElement *element = ED_get_uv_element(state->element_map, efa, BM_FACE_FIRST_LOOP(efa));
- if(element){
+ if (element) {
int numoftris = efa->len - 2;
int index = BM_elem_index_get(efa);
int face_preview_pos = preview_position[index].data_position;
- if(face_preview_pos != STITCH_NO_PREVIEW){
+ if (face_preview_pos != STITCH_NO_PREVIEW) {
preview->uvs_per_polygon[preview_position[index].polycount_position] = efa->len;
BM_ITER_INDEX(l, &liter, state->em->bm, BM_LOOPS_OF_FACE, efa, i) {
luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
@@ -693,12 +699,12 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
}
}
- if(element->island == state->static_island){
+ if (element->island == state->static_island) {
BMLoop *fl = BM_FACE_FIRST_LOOP(efa);
MLoopUV *fuv = CustomData_bmesh_get(&state->em->bm->ldata, fl->head.data, CD_MLOOPUV);
BM_ITER_INDEX(l, &liter, state->em->bm, BM_LOOPS_OF_FACE, efa, i) {
- if(i < numoftris){
+ if (i < numoftris) {
/* using next since the first uv is already accounted for */
BMLoop *lnext = l->next;
MLoopUV *luvnext = CustomData_bmesh_get(&state->em->bm->ldata, lnext->next->head.data, CD_MLOOPUV);
@@ -708,16 +714,19 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
memcpy(preview->static_tris + buffer_index + 2, luv->uv, 2*sizeof(float));
memcpy(preview->static_tris + buffer_index + 4, luvnext->uv, 2*sizeof(float));
buffer_index += 6;
- }else break;
+ }
+ else {
+ break;
+ }
}
}
}
}
/* fill the appropriate preview buffers */
- for(i = 0; i < state->total_separate_uvs; i++){
+ for (i = 0; i < state->total_separate_uvs; i++) {
UvElement *element = (UvElement *)state->uvs[i];
- if(element->flag & STITCH_STITCHABLE){
+ if (element->flag & STITCH_STITCHABLE) {
l = element->l;
luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
@@ -725,7 +734,7 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
stitchBufferIndex++;
}
- else if(element->flag & STITCH_SELECTED){
+ else if (element->flag & STITCH_SELECTED) {
l = element->l;
luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
@@ -743,9 +752,9 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
uvfinal_map = MEM_mallocN(state->element_map->totalUVs*sizeof(*uvfinal_map), "stitch_uv_final_map");
/* first pass, calculate final position for stitchable uvs of the static island */
- for(i = 0; i < state->selection_size; i++){
+ for (i = 0; i < state->selection_size; i++) {
UvElement *element = state->selection_stack[i];
- if(element->flag & STITCH_STITCHABLE){
+ if (element->flag & STITCH_STITCHABLE) {
BMLoop *l;
MLoopUV *luv;
UvElement *element_iter;
@@ -759,20 +768,21 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
copy_v2_v2(final_position[i].uv, luv->uv);
final_position[i].count = 1;
- if(state->snap_islands && element->island == state->static_island && !stitch_midpoints)
+ if (state->snap_islands && element->island == state->static_island && !stitch_midpoints)
continue;
element_iter = state->element_map->vert[BM_elem_index_get(l->v)];
- for(;element_iter; element_iter = element_iter->next){
- if(element_iter->separate){
- if(stitch_check_uvs_state_stitchable(element, element_iter, state)){
+ for (;element_iter; element_iter = element_iter->next) {
+ if (element_iter->separate) {
+ if (stitch_check_uvs_state_stitchable(element, element_iter, state)) {
l = element_iter->l;
luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
- if(stitch_midpoints){
+ if (stitch_midpoints) {
add_v2_v2(final_position[i].uv, luv->uv);
final_position[i].count++;
- }else if(element_iter->island == state->static_island){
+ }
+ else if (element_iter->island == state->static_island) {
/* if multiple uvs on the static island exist,
* last checked remains. to disambiguate we need to limit or use
* edge stitch */
@@ -782,17 +792,17 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
}
}
}
- if(stitch_midpoints){
+ if (stitch_midpoints) {
final_position[i].uv[0] /= final_position[i].count;
final_position[i].uv[1] /= final_position[i].count;
}
}
/* second pass, calculate island rotation and translation before modifying any uvs */
- if(state->snap_islands){
- for(i = 0; i < state->selection_size; i++){
+ if (state->snap_islands) {
+ for (i = 0; i < state->selection_size; i++) {
UvElement *element = state->selection_stack[i];
- if(element->flag & STITCH_STITCHABLE){
+ if (element->flag & STITCH_STITCHABLE) {
BMLoop *l;
MLoopUV *luv;
@@ -810,18 +820,18 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
}
/* only calculate rotation when an edge has been fully selected */
- for(i = 0; i < state->total_boundary_edges; i++){
+ for (i = 0; i < state->total_boundary_edges; i++) {
UvEdge *edge = state->edges+i;
- if((state->uvs[edge->uv1]->flag & STITCH_STITCHABLE) && (state->uvs[edge->uv2]->flag & STITCH_STITCHABLE)){
+ if ((state->uvs[edge->uv1]->flag & STITCH_STITCHABLE) && (state->uvs[edge->uv2]->flag & STITCH_STITCHABLE)) {
stitch_island_calculate_edge_rotation(edge, state, final_position, uvfinal_map, island_stitch_data);
island_stitch_data[state->uvs[edge->uv1]->island].use_edge_rotation = 1;
}
}
- for(i = 0; i < state->selection_size; i++){
+ for (i = 0; i < state->selection_size; i++) {
UvElement *element = state->selection_stack[i];
- if(!island_stitch_data[element->island].use_edge_rotation){
- if(element->flag & STITCH_STITCHABLE){
+ if (!island_stitch_data[element->island].use_edge_rotation) {
+ if (element->flag & STITCH_STITCHABLE) {
stitch_island_calculate_vert_rotation(element, state, island_stitch_data);
}
}
@@ -830,12 +840,12 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
}
/* third pass, propagate changes to coincident uvs */
- for(i = 0; i < state->selection_size; i++){
+ for (i = 0; i < state->selection_size; i++) {
UvElement *element = state->selection_stack[i];
- if(element->flag & STITCH_STITCHABLE){
+ if (element->flag & STITCH_STITCHABLE) {
UvElement *element_iter = element;
/* propagate to coincident uvs */
- do{
+ do {
BMLoop *l;
MLoopUV *luv;
@@ -844,30 +854,31 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
element_iter->flag |= STITCH_PROCESSED;
/* either flush to preview or to the MTFace, if final */
- if(final){
+ if (final) {
copy_v2_v2(luv->uv, final_position[i].uv);
uvedit_uv_select(state->em, scene, l);
- }else {
+ }
+ else {
int face_preview_pos = preview_position[BM_elem_index_get(element_iter->face)].data_position;
- if(face_preview_pos != STITCH_NO_PREVIEW){
+ if (face_preview_pos != STITCH_NO_PREVIEW) {
copy_v2_v2(preview->preview_polys + face_preview_pos + 2*element_iter->tfindex,
final_position[i].uv);
}
}
/* end of calculations, keep only the selection flag */
- if( (!state->snap_islands) || ((!stitch_midpoints) && (element_iter->island == state->static_island))) {
+ if ( (!state->snap_islands) || ((!stitch_midpoints) && (element_iter->island == state->static_island))) {
element_iter->flag &= STITCH_SELECTED;
}
element_iter = element_iter->next;
- }while(element_iter && !element_iter->separate);
+ } while (element_iter && !element_iter->separate);
}
}
/* final pass, calculate Island translation/rotation if needed */
- if(state->snap_islands){
+ if (state->snap_islands) {
stitch_calculate_island_snapping(state, preview_position, preview, island_stitch_data, final);
}
@@ -893,7 +904,7 @@ static int uv_edge_compare(const void *a, const void *b)
UvEdge *edge1 = (UvEdge *)a;
UvEdge *edge2 = (UvEdge *)b;
- if((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)){
+ if ((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)) {
return 0;
}
return 1;
@@ -911,23 +922,24 @@ static void stitch_select_uv(UvElement *element, StitchState *state, int always_
element_iter = state->element_map->vert[BM_elem_index_get(l->v)];
/* first deselect all common uvs */
- for(; element_iter; element_iter = element_iter->next){
- if(element_iter->separate){
+ for (; element_iter; element_iter = element_iter->next) {
+ if (element_iter->separate) {
/* only separators go to selection */
- if(element_iter->flag & STITCH_SELECTED){
+ if (element_iter->flag & STITCH_SELECTED) {
int i;
- if(always_select)
+ if (always_select)
continue;
element_iter->flag &= ~STITCH_SELECTED;
- for(i = 0; i < state->selection_size; i++){
- if(selection_stack[i] == element_iter){
+ for (i = 0; i < state->selection_size; i++) {
+ if (selection_stack[i] == element_iter) {
(state->selection_size)--;
selection_stack[i] = selection_stack[state->selection_size];
break;
}
}
- }else{
+ }
+ else {
element_iter->flag |= STITCH_SELECTED;
selection_stack[state->selection_size++] = element_iter;
}
@@ -977,7 +989,7 @@ static int stitch_init(bContext *C, wmOperator *op)
op->customdata = state;
- if(!state)
+ if (!state)
return 0;
/* initialize state */
@@ -988,12 +1000,13 @@ static int stitch_init(bContext *C, wmOperator *op)
state->static_island = RNA_int_get(op->ptr, "static_island");
state->midpoints = RNA_boolean_get(op->ptr, "midpoint_snap");
/* in uv synch selection, all uv's are visible */
- if(ts->uv_flag & UV_SYNC_SELECTION){
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
state->element_map = EDBM_make_uv_element_map(state->em, 0, 1);
- }else{
+ }
+ else {
state->element_map = EDBM_make_uv_element_map(state->em, 1, 1);
}
- if(!state->element_map){
+ if (!state->element_map) {
stitch_state_delete(state);
return 0;
}
@@ -1003,8 +1016,8 @@ static int stitch_init(bContext *C, wmOperator *op)
state->static_island %= state->element_map->totalIslands;
/* Count 'unique' uvs */
- for(i = 0; i < state->element_map->totalUVs; i++){
- if(state->element_map->buf[i].separate){
+ for (i = 0; i < state->element_map->totalUVs; i++) {
+ if (state->element_map->buf[i].separate) {
counter++;
}
}
@@ -1023,7 +1036,7 @@ static int stitch_init(bContext *C, wmOperator *op)
edgeHash = BLI_ghash_new(uv_edge_hash, uv_edge_compare, "stitch_edge_hash");
all_edges = MEM_mallocN(sizeof(*all_edges)*state->element_map->totalUVs, "stitch_all_edges");
- if(!state->selection_stack || !state->uvs || !map || !edgeHash || !all_edges){
+ if (!state->selection_stack || !state->uvs || !map || !edgeHash || !all_edges) {
stitch_state_delete(state);
return 0;
}
@@ -1031,10 +1044,10 @@ static int stitch_init(bContext *C, wmOperator *op)
/* So that we can use this as index for the UvElements */
counter = -1;
/* initialize the unique UVs and map */
- for(i = 0; i < em->bm->totvert; i++){
+ for (i = 0; i < em->bm->totvert; i++) {
UvElement *element = state->element_map->vert[i];
- for(; element; element = element->next){
- if(element->separate){
+ for (; element; element = element->next) {
+ if (element->separate) {
counter++;
state->uvs[counter] = element;
}
@@ -1061,20 +1074,20 @@ static int stitch_init(bContext *C, wmOperator *op)
all_edges[counter].element = element;
/* using an order policy, sort uvs according to address space. This avoids
* Having two different UvEdges with the same uvs on different positions */
- if(offset1 < offset2){
+ if (offset1 < offset2) {
all_edges[counter].uv1 = offset1;
all_edges[counter].uv2 = offset2;
}
- else{
+ else {
all_edges[counter].uv1 = offset2;
all_edges[counter].uv2 = offset1;
}
- if(BLI_ghash_haskey(edgeHash, &all_edges[counter])){
+ if (BLI_ghash_haskey(edgeHash, &all_edges[counter])) {
char *flag = BLI_ghash_lookup(edgeHash, &all_edges[counter]);
*flag = 0;
}
- else{
+ else {
BLI_ghash_insert(edgeHash, &all_edges[counter], &(all_edges[counter].flag));
all_edges[counter].flag = STITCH_BOUNDARY;
}
@@ -1086,14 +1099,14 @@ static int stitch_init(bContext *C, wmOperator *op)
ghi = BLI_ghashIterator_new(edgeHash);
total_edges = 0;
/* fill the edges with data */
- for(; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)){
+ for (; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)) {
UvEdge *edge = ((UvEdge *)BLI_ghashIterator_getKey(ghi));
- if(edge->flag & STITCH_BOUNDARY){
+ if (edge->flag & STITCH_BOUNDARY) {
total_edges++;
}
}
state->edges = edges = MEM_mallocN(sizeof(*edges)*total_edges, "stitch_edges");
- if(!ghi || !edges){
+ if (!ghi || !edges) {
MEM_freeN(all_edges);
stitch_state_delete(state);
return 0;
@@ -1102,9 +1115,9 @@ static int stitch_init(bContext *C, wmOperator *op)
state->total_boundary_edges = total_edges;
/* fill the edges with data */
- for(i = 0, BLI_ghashIterator_init(ghi, edgeHash); !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)){
+ for (i = 0, BLI_ghashIterator_init(ghi, edgeHash); !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)) {
UvEdge *edge = ((UvEdge *)BLI_ghashIterator_getKey(ghi));
- if(edge->flag & STITCH_BOUNDARY){
+ if (edge->flag & STITCH_BOUNDARY) {
edges[i++] = *((UvEdge *)BLI_ghashIterator_getKey(ghi));
}
}
@@ -1123,7 +1136,7 @@ static int stitch_init(bContext *C, wmOperator *op)
* a point "inside" the island, that can be provided by
* the opposite uv for a quad, or the next uv for a triangle. */
- for(i = 0; i < total_edges; i++){
+ for (i = 0; i < total_edges; i++) {
float normal[2];
stitch_calculate_edge_normal(em, edges + i, normal);
@@ -1140,7 +1153,7 @@ static int stitch_init(bContext *C, wmOperator *op)
state->selection_size = 0;
/* Load old selection if redoing operator with different settings */
- if(RNA_struct_property_is_set(op->ptr, "selection")){
+ if (RNA_struct_property_is_set(op->ptr, "selection")) {
int faceIndex, elementIndex;
UvElement *element;
@@ -1159,11 +1172,12 @@ static int stitch_init(bContext *C, wmOperator *op)
/* Clear the selection */
RNA_collection_clear(op->ptr, "selection");
- } else {
+ }
+ else {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
i = 0;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
- if(uvedit_uv_selected(em, scene, l)){
+ if (uvedit_uv_selected(em, scene, l)) {
UvElement *element = ED_get_uv_element(state->element_map, efa, l);
stitch_select_uv(element, state, 1);
}
@@ -1176,19 +1190,19 @@ static int stitch_init(bContext *C, wmOperator *op)
state->tris_per_island = MEM_mallocN(sizeof(*state->tris_per_island)*state->element_map->totalIslands,
"stitch island tris");
- for(i = 0; i < state->element_map->totalIslands; i++){
+ for (i = 0; i < state->element_map->totalIslands; i++) {
state->tris_per_island[i] = 0;
}
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
UvElement *element = ED_get_uv_element(state->element_map, efa, BM_FACE_FIRST_LOOP(efa));
- if(element){
+ if (element) {
state->tris_per_island[element->island] += (efa->len > 2)? efa->len-2 : 0;
}
}
- if(!stitch_process_data(state, scene, 0)){
+ if (!stitch_process_data(state, scene, 0)) {
stitch_state_delete(state);
return 0;
}
@@ -1200,7 +1214,7 @@ static int stitch_init(bContext *C, wmOperator *op)
static int stitch_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Object *obedit = CTX_data_edit_object(C);
- if(!stitch_init(C, op))
+ if (!stitch_init(C, op))
return OPERATOR_CANCELLED;
WM_event_add_modal_handler(C, op);
@@ -1222,7 +1236,7 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
stitch_state = (StitchState *)op->customdata;
- if(finished){
+ if (finished) {
int i;
RNA_float_set(op->ptr, "limit", stitch_state->limit_dist);
@@ -1232,7 +1246,7 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
RNA_boolean_set(op->ptr, "midpoint_snap", stitch_state->midpoints);
/* Store selection for re-execution of stitch */
- for(i = 0; i < stitch_state->selection_size; i++){
+ for (i = 0; i < stitch_state->selection_size; i++) {
PointerRNA itemptr;
UvElement *element = stitch_state->selection_stack[i];
@@ -1247,7 +1261,7 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
uvedit_live_unwrap_update(sima, scene, obedit);
}
- if(sa)
+ if (sa)
ED_area_headerprint(sa, NULL);
DAG_id_tag_update(obedit->data, 0);
@@ -1271,12 +1285,13 @@ static int stitch_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- if(!stitch_init(C, op))
+ if (!stitch_init(C, op))
return OPERATOR_CANCELLED;
- if(stitch_process_data((StitchState *)op->customdata, scene, 1)){
+ if (stitch_process_data((StitchState *)op->customdata, scene, 1)) {
stitch_exit(C, op, 1);
return OPERATOR_FINISHED;
- }else {
+ }
+ else {
return stitch_cancel(C, op);
}
}
@@ -1311,7 +1326,7 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
stitch_state = (StitchState *)op->customdata;
- switch(event->type){
+ switch(event->type) {
case MIDDLEMOUSE:
return OPERATOR_PASS_THROUGH;
@@ -1321,11 +1336,11 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
case LEFTMOUSE:
- if(event->shift && (U.flag & USER_LMOUSESELECT)){
- if(event->val == KM_RELEASE){
+ if (event->shift && (U.flag & USER_LMOUSESELECT)) {
+ if (event->val == KM_RELEASE) {
stitch_select(C, scene, event, stitch_state);
- if(!stitch_process_data(stitch_state, scene, 0)){
+ if (!stitch_process_data(stitch_state, scene, 0)) {
return stitch_cancel(C, op);
}
}
@@ -1333,7 +1348,7 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
}
case PADENTER:
case RETKEY:
- if(stitch_process_data(stitch_state, scene, 1)){
+ if (stitch_process_data(stitch_state, scene, 1)) {
stitch_exit(C, op, 1);
return OPERATOR_FINISHED;
}
@@ -1344,35 +1359,36 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
/* Increase limit */
case PADPLUSKEY:
case WHEELUPMOUSE:
- if(event->alt){
+ if (event->alt) {
stitch_state->limit_dist += 0.01;
- if(!stitch_process_data(stitch_state, scene, 0)){
+ if (!stitch_process_data(stitch_state, scene, 0)) {
return stitch_cancel(C, op);
}
break;
}
- else{
+ else {
return OPERATOR_PASS_THROUGH;
}
/* Decrease limit */
case PADMINUS:
case WHEELDOWNMOUSE:
- if(event->alt){
+ if (event->alt) {
stitch_state->limit_dist -= 0.01;
stitch_state->limit_dist = MAX2(0.01, stitch_state->limit_dist);
- if(!stitch_process_data(stitch_state, scene, 0)){
+ if (!stitch_process_data(stitch_state, scene, 0)) {
return stitch_cancel(C, op);
}
break;
- }else{
+ }
+ else {
return OPERATOR_PASS_THROUGH;
}
/* Use Limit (Default off)*/
case LKEY:
- if(event->val == KM_PRESS){
+ if (event->val == KM_PRESS) {
stitch_state->use_limit = !stitch_state->use_limit;
- if(!stitch_process_data(stitch_state, scene, 0)){
+ if (!stitch_process_data(stitch_state, scene, 0)) {
return stitch_cancel(C, op);
}
break;
@@ -1380,11 +1396,11 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
case IKEY:
- if(event->val == KM_PRESS){
+ if (event->val == KM_PRESS) {
stitch_state->static_island++;
stitch_state->static_island %= stitch_state->element_map->totalIslands;
- if(!stitch_process_data(stitch_state, scene, 0)){
+ if (!stitch_process_data(stitch_state, scene, 0)) {
return stitch_cancel(C, op);
}
break;
@@ -1392,9 +1408,9 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
case MKEY:
- if(event->val == KM_PRESS){
+ if (event->val == KM_PRESS) {
stitch_state->midpoints = !stitch_state->midpoints;
- if(!stitch_process_data(stitch_state, scene, 0)){
+ if (!stitch_process_data(stitch_state, scene, 0)) {
return stitch_cancel(C, op);
}
}
@@ -1402,13 +1418,13 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
/* Select geometry*/
case RIGHTMOUSE:
- if(!event->shift){
+ if (!event->shift) {
return stitch_cancel(C, op);
}
- if(event->val == KM_RELEASE && !(U.flag & USER_LMOUSESELECT)){
+ if (event->val == KM_RELEASE && !(U.flag & USER_LMOUSESELECT)) {
stitch_select(C, scene, event, stitch_state);
- if(!stitch_process_data(stitch_state, scene, 0)){
+ if (!stitch_process_data(stitch_state, scene, 0)) {
return stitch_cancel(C, op);
}
break;
@@ -1417,13 +1433,14 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
/* snap islands on/off */
case SKEY:
- if(event->val == KM_PRESS){
+ if (event->val == KM_PRESS) {
stitch_state->snap_islands = !stitch_state->snap_islands;
- if(!stitch_process_data(stitch_state, scene, 0)){
+ if (!stitch_process_data(stitch_state, scene, 0)) {
return stitch_cancel(C, op);
}
break;
- } else
+ }
+ else
return OPERATOR_RUNNING_MODAL;
default:
@@ -1451,7 +1468,7 @@ void UV_OT_stitch(wmOperatorType *ot)
ot->modal = stitch_modal;
ot->exec = stitch_exec;
ot->cancel = stitch_cancel;
- ot->poll= ED_operator_uvedit;
+ ot->poll = ED_operator_uvedit;
/* properties */
RNA_def_boolean(ot->srna, "use_limit", 0, "Use Limit", "Stitch UVs within a specified limit distance");
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index cfb0128486a..107a92fd3ef 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -98,33 +98,33 @@ static int ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit)
SpaceLink *slink;
SpaceImage *sima;
- if(ED_uvedit_test(obedit)) {
+ if (ED_uvedit_test(obedit)) {
return 1;
}
- if(em && em->bm->totface && !CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY)) {
+ if (em && em->bm->totface && !CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY)) {
BM_data_layer_add(em->bm, &em->bm->pdata, CD_MTEXPOLY);
BM_data_layer_add(em->bm, &em->bm->ldata, CD_MLOOPUV);
}
- if(!ED_uvedit_test(obedit)) {
+ if (!ED_uvedit_test(obedit)) {
return 0;
}
ima= CTX_data_edit_image(C);
- if(!ima) {
+ if (!ima) {
/* no image in context in the 3d view, we find first image window .. */
sc= CTX_wm_screen(C);
- for(sa=sc->areabase.first; sa; sa=sa->next) {
+ for (sa=sc->areabase.first; sa; sa=sa->next) {
slink= sa->spacedata.first;
- if(slink->spacetype == SPACE_IMAGE) {
+ if (slink->spacetype == SPACE_IMAGE) {
sima= (SpaceImage*)slink;
ima= sima->image;
- if(ima) {
- if(ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
+ if (ima) {
+ if (ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
ima= NULL;
else
break;
@@ -133,7 +133,7 @@ static int ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit)
}
}
- if(ima)
+ if (ima)
ED_uvedit_assign_image(bmain, scene, obedit, ima, NULL);
/* select new UV's */
@@ -156,11 +156,11 @@ static int uvedit_have_selection(Scene *scene, BMEditMesh *em, short implicit)
/* verify if we have any selected uv's before unwrapping,
* so we can cancel the operator early */
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
- if(BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
+ if (scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+ if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
continue;
}
- else if(BM_elem_flag_test(efa, BM_ELEM_HIDDEN) || !BM_elem_flag_test(efa, BM_ELEM_SELECT))
+ else if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN) || !BM_elem_flag_test(efa, BM_ELEM_SELECT))
continue;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
@@ -194,16 +194,16 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
handle = param_construct_begin();
- if(correct_aspect) {
+ if (correct_aspect) {
efa = BM_active_face_get(em->bm, TRUE);
- if(efa) {
+ if (efa) {
float aspx, aspy;
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
ED_image_uv_aspect(tf->tpage, &aspx, &aspy);
- if(aspx!=aspy)
+ if (aspx!=aspy)
param_aspect_ratio(handle, aspx, aspy);
}
}
@@ -222,7 +222,7 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
float *uv[4];
int lsel;
- if((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || (sel && BM_elem_flag_test(efa, BM_ELEM_SELECT)==0))
+ if ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || (sel && BM_elem_flag_test(efa, BM_ELEM_SELECT)==0))
continue;
/* tf= (MTexPoly *)CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */
@@ -305,9 +305,9 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
BLI_end_edgefill();
}
- if(!implicit) {
+ if (!implicit) {
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SEAM)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SEAM)) {
ParamKey vkeys[2];
vkeys[0] = (ParamKey)BM_elem_index_get(eed->v1);
vkeys[1] = (ParamKey)BM_elem_index_get(eed->v2);
@@ -332,11 +332,11 @@ static void texface_from_original_index(BMFace *efa, int index, float **uv, Para
*pin = 0;
*select = 1;
- if(index == ORIGINDEX_NONE)
+ if (index == ORIGINDEX_NONE)
return;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
- if(BM_elem_index_get(l->v) == index) {
+ if (BM_elem_index_get(l->v) == index) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
*uv = luv->uv;
*pin = (luv->flag & MLOOPUV_PINNED)? 1 : 0;
@@ -376,17 +376,17 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
handle = param_construct_begin();
- if(correct_aspect) {
+ if (correct_aspect) {
editFace = BM_active_face_get(em->bm, TRUE);
- if(editFace) {
+ if (editFace) {
MTexPoly *tf;
float aspx, aspy;
tf= CustomData_bmesh_get(&em->bm->pdata, editFace->head.data, CD_MTEXPOLY);
ED_image_uv_aspect(tf->tpage, &aspx, &aspy);
- if(aspx!=aspy)
+ if (aspx!=aspy)
param_aspect_ratio(handle, aspx, aspy);
}
}
@@ -419,13 +419,13 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
EDBM_init_index_arrays(em, 0, 1, 1);
/* map subsurfed faces to original editFaces */
- for(i = 0; i < numOfFaces; i++)
+ for (i = 0; i < numOfFaces; i++)
faceMap[i] = EDBM_get_face_for_index(em, origFaceIndices[i]);
edgeMap = MEM_mallocN(numOfEdges*sizeof(BMEdge *), "unwrap_edit_edge_map");
/* map subsurfed edges to original editEdges */
- for(i = 0; i < numOfEdges; i++) {
+ for (i = 0; i < numOfEdges; i++) {
/* not all edges correspond to an old edge */
edgeMap[i] = (origEdgeIndices[i] != -1)?
EDBM_get_edge_for_index(em, origEdgeIndices[i]) : NULL;
@@ -434,7 +434,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
EDBM_free_index_arrays(em);
/* Prepare and feed faces to the solver */
- for(i = 0; i < numOfFaces; i++) {
+ for (i = 0; i < numOfFaces; i++) {
ParamKey key, vkeys[4];
ParamBool pin[4], select[4];
float *co[4];
@@ -443,12 +443,12 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
face = subsurfedFaces+i;
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
- if(BM_elem_flag_test(origFace, BM_ELEM_HIDDEN))
+ if (scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+ if (BM_elem_flag_test(origFace, BM_ELEM_HIDDEN))
continue;
}
else {
- if(BM_elem_flag_test(origFace, BM_ELEM_HIDDEN) || (sel && !BM_elem_flag_test(origFace, BM_ELEM_SELECT)))
+ if (BM_elem_flag_test(origFace, BM_ELEM_HIDDEN) || (sel && !BM_elem_flag_test(origFace, BM_ELEM_SELECT)))
continue;
}
@@ -475,8 +475,8 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
}
/* these are calculated from original mesh too */
- for(edge = subsurfedEdges, i = 0; i < numOfEdges; i++, edge++) {
- if((edgeMap[i] != NULL) && BM_elem_flag_test(edgeMap[i], BM_ELEM_SEAM)) {
+ for (edge = subsurfedEdges, i = 0; i < numOfEdges; i++, edge++) {
+ if ((edgeMap[i] != NULL) && BM_elem_flag_test(edgeMap[i], BM_ELEM_SEAM)) {
ParamKey vkeys[2];
vkeys[0] = (ParamKey)edge->v1;
vkeys[1] = (ParamKey)edge->v2;
@@ -516,7 +516,7 @@ static int minimize_stretch_init(bContext *C, wmOperator *op)
int fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
short implicit = 1;
- if(!uvedit_have_selection(scene, em, implicit)) {
+ if (!uvedit_have_selection(scene, em, implicit)) {
return 0;
}
@@ -531,7 +531,7 @@ static int minimize_stretch_init(bContext *C, wmOperator *op)
ms->lasttime= PIL_check_seconds_timer();
param_stretch_begin(ms->handle);
- if(ms->blend != 0.0f)
+ if (ms->blend != 0.0f)
param_stretch_blend(ms->handle, ms->blend);
op->customdata= ms;
@@ -550,12 +550,12 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, int interact
ms->i++;
RNA_int_set(op->ptr, "iterations", ms->i);
- if(interactive && (PIL_check_seconds_timer() - ms->lasttime > 0.5)) {
+ if (interactive && (PIL_check_seconds_timer() - ms->lasttime > 0.5)) {
char str[100];
param_flush(ms->handle);
- if(sa) {
+ if (sa) {
BLI_snprintf(str, sizeof(str), "Minimize Stretch. Blend %.2f", ms->blend);
ED_area_headerprint(sa, str);
}
@@ -572,12 +572,12 @@ static void minimize_stretch_exit(bContext *C, wmOperator *op, int cancel)
MinStretch *ms= op->customdata;
ScrArea *sa= CTX_wm_area(C);
- if(sa)
+ if (sa)
ED_area_headerprint(sa, NULL);
- if(ms->timer)
+ if (ms->timer)
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), ms->timer);
- if(cancel)
+ if (cancel)
param_flush_restore(ms->handle);
else
param_flush(ms->handle);
@@ -596,11 +596,11 @@ static int minimize_stretch_exec(bContext *C, wmOperator *op)
{
int i, iterations;
- if(!minimize_stretch_init(C, op))
+ if (!minimize_stretch_init(C, op))
return OPERATOR_CANCELLED;
iterations= RNA_int_get(op->ptr, "iterations");
- for(i=0; i<iterations; i++)
+ for (i=0; i<iterations; i++)
minimize_stretch_iteration(C, op, 0);
minimize_stretch_exit(C, op, 0);
@@ -611,7 +611,7 @@ static int minimize_stretch_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
{
MinStretch *ms;
- if(!minimize_stretch_init(C, op))
+ if (!minimize_stretch_init(C, op))
return OPERATOR_CANCELLED;
minimize_stretch_iteration(C, op, 1);
@@ -639,7 +639,7 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_FINISHED;
case PADPLUSKEY:
case WHEELUPMOUSE:
- if(ms->blend < 0.95f) {
+ if (ms->blend < 0.95f) {
ms->blend += 0.1f;
ms->lasttime= 0.0f;
RNA_float_set(op->ptr, "blend", ms->blend);
@@ -648,7 +648,7 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
case PADMINUS:
case WHEELDOWNMOUSE:
- if(ms->blend > 0.05f) {
+ if (ms->blend > 0.05f) {
ms->blend -= 0.1f;
ms->lasttime= 0.0f;
RNA_float_set(op->ptr, "blend", ms->blend);
@@ -656,17 +656,17 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, wmEvent *event)
}
break;
case TIMER:
- if(ms->timer == event->customdata) {
+ if (ms->timer == event->customdata) {
double start= PIL_check_seconds_timer();
do {
minimize_stretch_iteration(C, op, 1);
- } while(PIL_check_seconds_timer() - start < 0.01);
+ } while (PIL_check_seconds_timer() - start < 0.01);
}
break;
}
- if(ms->iterations && ms->i >= ms->iterations) {
+ if (ms->iterations && ms->i >= ms->iterations) {
minimize_stretch_exit(C, op, 0);
return OPERATOR_FINISHED;
}
@@ -684,17 +684,17 @@ static int minimize_stretch_cancel(bContext *C, wmOperator *op)
void UV_OT_minimize_stretch(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Minimize Stretch";
- ot->idname= "UV_OT_minimize_stretch";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING;
- ot->description="Reduce UV stretching by relaxing angles";
+ ot->name = "Minimize Stretch";
+ ot->idname = "UV_OT_minimize_stretch";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING;
+ ot->description = "Reduce UV stretching by relaxing angles";
/* api callbacks */
- ot->exec= minimize_stretch_exec;
- ot->invoke= minimize_stretch_invoke;
- ot->modal= minimize_stretch_modal;
- ot->cancel= minimize_stretch_cancel;
- ot->poll= ED_operator_uvedit;
+ ot->exec = minimize_stretch_exec;
+ ot->invoke = minimize_stretch_invoke;
+ ot->modal = minimize_stretch_modal;
+ ot->cancel = minimize_stretch_cancel;
+ ot->poll = ED_operator_uvedit;
/* properties */
RNA_def_boolean(ot->srna, "fill_holes", 1, "Fill Holes", "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and preserve symmetry");
@@ -712,11 +712,11 @@ static int pack_islands_exec(bContext *C, wmOperator *op)
ParamHandle *handle;
short implicit = 1;
- if(!uvedit_have_selection(scene, em, implicit)) {
+ if (!uvedit_have_selection(scene, em, implicit)) {
return OPERATOR_CANCELLED;
}
- if(RNA_struct_property_is_set(op->ptr, "margin")) {
+ if (RNA_struct_property_is_set(op->ptr, "margin")) {
scene->toolsettings->uvcalc_margin= RNA_float_get(op->ptr, "margin");
}
else {
@@ -737,13 +737,13 @@ static int pack_islands_exec(bContext *C, wmOperator *op)
void UV_OT_pack_islands(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Pack Islands";
- ot->idname= "UV_OT_pack_islands";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Pack Islands";
+ ot->idname = "UV_OT_pack_islands";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= pack_islands_exec;
- ot->poll= ED_operator_uvedit;
+ ot->exec = pack_islands_exec;
+ ot->poll = ED_operator_uvedit;
/* properties */
RNA_def_float_factor(ot->srna, "margin", 0.0f, 0.0f, 1.0f, "Margin", "Space between islands", 0.0f, 1.0f);
@@ -759,7 +759,7 @@ static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
ParamHandle *handle;
short implicit = 1;
- if(!uvedit_have_selection(scene, em, implicit)) {
+ if (!uvedit_have_selection(scene, em, implicit)) {
return OPERATOR_CANCELLED;
}
@@ -777,13 +777,13 @@ static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
void UV_OT_average_islands_scale(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Average Islands Scale";
- ot->idname= "UV_OT_average_islands_scale";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Average Islands Scale";
+ ot->idname = "UV_OT_average_islands_scale";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= average_islands_scale_exec;
- ot->poll= ED_operator_uvedit;
+ ot->exec = average_islands_scale_exec;
+ ot->poll = ED_operator_uvedit;
}
/**************** Live Unwrap *****************/
@@ -797,11 +797,11 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
short use_subsurf = scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF;
- if(!ED_uvedit_test(obedit)) {
+ if (!ED_uvedit_test(obedit)) {
return;
}
- if(use_subsurf)
+ if (use_subsurf)
liveHandle = construct_param_handle_subsurfed(scene, em, fillholes, 0, 1);
else
liveHandle = construct_param_handle(scene, em, 0, fillholes, 0, 1);
@@ -811,7 +811,7 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
void ED_uvedit_live_unwrap_re_solve(void)
{
- if(liveHandle) {
+ if (liveHandle) {
param_lscm_solve(liveHandle);
param_flush(liveHandle);
}
@@ -819,9 +819,9 @@ void ED_uvedit_live_unwrap_re_solve(void)
void ED_uvedit_live_unwrap_end(short cancel)
{
- if(liveHandle) {
+ if (liveHandle) {
param_lscm_end(liveHandle);
- if(cancel)
+ if (cancel)
param_flush_restore(liveHandle);
param_delete(liveHandle);
liveHandle = NULL;
@@ -854,7 +854,7 @@ static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result,
max[0]= max[1]= max[2]= -1e20f;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
DO_MINMAX(l->v->co, min, max);
}
@@ -887,20 +887,20 @@ static void uv_map_rotation_matrix(float result[][4], RegionView3D *rv3d, Object
int k;
/* get rotation of the current view matrix */
- if(rv3d)
+ if (rv3d)
copy_m4_m4(viewmatrix, rv3d->viewmat);
else
unit_m4(viewmatrix);
/* but shifting */
- for(k=0; k<4; k++)
+ for (k=0; k<4; k++)
viewmatrix[3][k] =0.0f;
/* get rotation of the current object matrix */
copy_m4_m4(rotobj,ob->obmat);
/* but shifting */
- for(k=0; k<4; k++)
+ for (k=0; k<4; k++)
rotobj[3][k] =0.0f;
zero_m4(rotup);
@@ -943,18 +943,18 @@ static void uv_map_transform(bContext *C, wmOperator *op, float center[3], float
uv_map_transform_center(scene, v3d, center, obedit, em);
- if(direction == VIEW_ON_EQUATOR) {
+ if (direction == VIEW_ON_EQUATOR) {
upangledeg= 90.0f;
sideangledeg= 0.0f;
}
else {
upangledeg= 0.0f;
- if(align == POLAR_ZY) sideangledeg= 0.0f;
+ if (align == POLAR_ZY) sideangledeg= 0.0f;
else sideangledeg= 90.0f;
}
/* be compatible to the "old" sphere/cylinder mode */
- if(direction == ALIGN_TO_OBJECT)
+ if (direction == ALIGN_TO_OBJECT)
unit_m4(rotmat);
else
uv_map_rotation_matrix(rotmat, rv3d, obedit, upangledeg, sideangledeg, radius);
@@ -979,7 +979,7 @@ static void uv_transform_properties(wmOperatorType *ot, int radius)
"Direction of the sphere or cylinder");
RNA_def_enum(ot->srna, "align", align_items, VIEW_ON_EQUATOR, "Align",
"How to determine rotation around the pole");
- if(radius)
+ if (radius)
RNA_def_float(ot->srna, "radius", 1.0f, 0.0f, FLT_MAX, "Radius",
"Radius of the sphere or cylinder", 0.0001f, 100.0f);
}
@@ -999,10 +999,10 @@ static void correct_uv_aspect(BMEditMesh *em)
ED_image_uv_aspect(tf->tpage, &aspx, &aspy);
}
- if(aspx == aspy)
+ if (aspx == aspy)
return;
- if(aspx > aspy) {
+ if (aspx > aspy) {
scale= aspy/aspx;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
@@ -1054,10 +1054,10 @@ static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op)
int scale_to_bounds= RNA_boolean_get(op->ptr, "scale_to_bounds");
/* correct for image aspect ratio */
- if(correct_aspect)
+ if (correct_aspect)
correct_uv_aspect(em);
- if(scale_to_bounds) {
+ if (scale_to_bounds) {
INIT_MINMAX2(min, max);
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
@@ -1074,9 +1074,9 @@ static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op)
dx= (max[0]-min[0]);
dy= (max[1]-min[1]);
- if(dx > 0.0f)
+ if (dx > 0.0f)
dx= 1.0f/dx;
- if(dy > 0.0f)
+ if (dy > 0.0f)
dy= 1.0f/dy;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
@@ -1091,7 +1091,7 @@ static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op)
}
}
}
- else if(clip_to_bounds) {
+ else if (clip_to_bounds) {
/* clipping and wrapping */
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
@@ -1118,7 +1118,7 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel)
const short correct_aspect= !(scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT);
const short use_subsurf = scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF;
- if(use_subsurf)
+ if (use_subsurf)
handle = construct_param_handle_subsurfed(scene, em, fill_holes, sel, correct_aspect);
else
handle= construct_param_handle(scene, em, 0, fill_holes, sel, correct_aspect);
@@ -1147,17 +1147,17 @@ static int unwrap_exec(bContext *C, wmOperator *op)
float obsize[3], unitsize[3] = {1.0f, 1.0f, 1.0f};
short implicit= 0;
- if(!uvedit_have_selection(scene, em, implicit)) {
+ if (!uvedit_have_selection(scene, em, implicit)) {
return OPERATOR_CANCELLED;
}
/* add uvs if they don't exist yet */
- if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
+ if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
return OPERATOR_CANCELLED;
}
mat4_to_size(obsize, obedit->obmat);
- if(!compare_v3v3(obsize, unitsize, 1e-4f))
+ if (!compare_v3v3(obsize, unitsize, 1e-4f))
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 */
@@ -1165,13 +1165,13 @@ static int unwrap_exec(bContext *C, wmOperator *op)
scene->toolsettings->uv_subsurf_level = subsurf_level;
- if(fill_holes) scene->toolsettings->uvcalc_flag |= UVCALC_FILLHOLES;
+ if (fill_holes) scene->toolsettings->uvcalc_flag |= UVCALC_FILLHOLES;
else scene->toolsettings->uvcalc_flag &= ~UVCALC_FILLHOLES;
- if(correct_aspect) scene->toolsettings->uvcalc_flag &= ~UVCALC_NO_ASPECT_CORRECT;
+ if (correct_aspect) scene->toolsettings->uvcalc_flag &= ~UVCALC_NO_ASPECT_CORRECT;
else scene->toolsettings->uvcalc_flag |= UVCALC_NO_ASPECT_CORRECT;
- if(use_subsurf) scene->toolsettings->uvcalc_flag |= UVCALC_USESUBSURF;
+ if (use_subsurf) scene->toolsettings->uvcalc_flag |= UVCALC_USESUBSURF;
else scene->toolsettings->uvcalc_flag &= ~UVCALC_USESUBSURF;
/* execute unwrap */
@@ -1191,14 +1191,14 @@ void UV_OT_unwrap(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}};
/* identifiers */
- ot->name= "Unwrap";
- ot->description= "Unwrap the mesh of the object being edited";
- ot->idname= "UV_OT_unwrap";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Unwrap";
+ ot->description = "Unwrap the mesh of the object being edited";
+ ot->idname = "UV_OT_unwrap";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= unwrap_exec;
- ot->poll= ED_operator_uvmap;
+ ot->exec = unwrap_exec;
+ ot->poll = ED_operator_uvmap;
/* properties */
RNA_def_enum(ot->srna, "method", method_items, 0, "Method",
@@ -1230,7 +1230,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
float rotmat[4][4];
/* add uvs if they don't exist yet */
- if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
+ if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
return OPERATOR_CANCELLED;
}
@@ -1239,7 +1239,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
camera= v3d->camera->data;
}
- if(RNA_boolean_get(op->ptr, "orthographic")) {
+ if (RNA_boolean_get(op->ptr, "orthographic")) {
uv_map_rotation_matrix(rotmat, rv3d, obedit, 90.0f, 0.0f, 1.0f);
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
@@ -1255,7 +1255,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
else if (camera) {
struct UvCameraInfo *uci= project_camera_info(v3d->camera, obedit->obmat, scene->r.xsch, scene->r.ysch);
- if(uci) {
+ if (uci) {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
continue;
@@ -1295,7 +1295,7 @@ static int uv_from_view_poll(bContext *C)
{
RegionView3D *rv3d= CTX_wm_region_view3d(C);
- if(!ED_operator_uvmap(C))
+ if (!ED_operator_uvmap(C))
return 0;
return (rv3d != NULL);
@@ -1304,13 +1304,13 @@ static int uv_from_view_poll(bContext *C)
void UV_OT_from_view(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Project From View";
- ot->idname= "UV_OT_project_from_view";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Project From View";
+ ot->idname = "UV_OT_project_from_view";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= uv_from_view_exec;
- ot->poll= uv_from_view_poll;
+ ot->exec = uv_from_view_exec;
+ ot->poll = uv_from_view_poll;
/* properties */
RNA_def_boolean(ot->srna, "orthographic", 0, "Orthographic", "Use orthographic projection");
@@ -1343,13 +1343,13 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
void UV_OT_reset(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Reset";
- ot->idname= "UV_OT_reset";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Reset";
+ ot->idname = "UV_OT_reset";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= reset_exec;
- ot->poll= ED_operator_uvmap;
+ ot->exec = reset_exec;
+ ot->poll = ED_operator_uvmap;
}
/****************** Sphere Project operator ***************/
@@ -1364,7 +1364,7 @@ static void uv_sphere_project(float target[2], float source[3], float center[3],
map_to_sphere( &target[0], &target[1],pv[0], pv[1], pv[2]);
/* split line is always zero */
- if(target[0] >= 1.0f)
+ if (target[0] >= 1.0f)
target[0] -= 1.0f;
}
@@ -1386,14 +1386,14 @@ static void uv_map_mirror(BMEditMesh *em, BMFace *efa, MTexPoly *UNUSED(tf))
}
mi = 0;
- for(i=1; i<efa->len; i++)
- if(uvs[i][0] > uvs[mi][0])
+ for (i=1; i<efa->len; i++)
+ if (uvs[i][0] > uvs[mi][0])
mi = i;
- for(i=0; i<efa->len; i++) {
- if(i != mi) {
+ for (i=0; i<efa->len; i++) {
+ if (i != mi) {
dx = uvs[mi][0] - uvs[i][0];
- if(dx > 0.5f) uvs[i][0] += 1.0f;
+ if (dx > 0.5f) uvs[i][0] += 1.0f;
}
}
@@ -1413,7 +1413,7 @@ static int sphere_project_exec(bContext *C, wmOperator *op)
float center[3], rotmat[4][4];
/* add uvs if they don't exist yet */
- if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
+ if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
return OPERATOR_CANCELLED;
}
@@ -1444,13 +1444,13 @@ static int sphere_project_exec(bContext *C, wmOperator *op)
void UV_OT_sphere_project(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Sphere Projection";
- ot->idname= "UV_OT_sphere_project";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Sphere Projection";
+ ot->idname = "UV_OT_sphere_project";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= sphere_project_exec;
- ot->poll= ED_operator_uvmap;
+ ot->exec = sphere_project_exec;
+ ot->poll = ED_operator_uvmap;
/* properties */
uv_transform_properties(ot, 0);
@@ -1469,7 +1469,7 @@ static void uv_cylinder_project(float target[2], float source[3], float center[3
map_to_tube( &target[0], &target[1],pv[0], pv[1], pv[2]);
/* split line is always zero */
- if(target[0] >= 1.0f)
+ if (target[0] >= 1.0f)
target[0] -= 1.0f;
}
@@ -1486,7 +1486,7 @@ static int cylinder_project_exec(bContext *C, wmOperator *op)
float center[3], rotmat[4][4];
/* add uvs if they don't exist yet */
- if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
+ if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
return OPERATOR_CANCELLED;
}
@@ -1517,13 +1517,13 @@ static int cylinder_project_exec(bContext *C, wmOperator *op)
void UV_OT_cylinder_project(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Cylinder Projection";
- ot->idname= "UV_OT_cylinder_project";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Cylinder Projection";
+ ot->idname = "UV_OT_cylinder_project";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= cylinder_project_exec;
- ot->poll= ED_operator_uvmap;
+ ot->exec = cylinder_project_exec;
+ ot->poll = ED_operator_uvmap;
/* properties */
uv_transform_properties(ot, 1);
@@ -1546,7 +1546,7 @@ static int cube_project_exec(bContext *C, wmOperator *op)
int cox, coy;
/* add uvs if they don't exist yet */
- if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
+ if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
return OPERATOR_CANCELLED;
}
@@ -1595,13 +1595,13 @@ static int cube_project_exec(bContext *C, wmOperator *op)
void UV_OT_cube_project(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Cube Projection";
- ot->idname= "UV_OT_cube_project";
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->name = "Cube Projection";
+ ot->idname = "UV_OT_cube_project";
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->exec= cube_project_exec;
- ot->poll= ED_operator_uvmap;
+ ot->exec = cube_project_exec;
+ ot->poll = ED_operator_uvmap;
/* properties */
RNA_def_float(ot->srna, "cube_size", 1.0f, 0.0f, FLT_MAX, "Cube Size", "Size of the cube to project on", 0.001f, 100.0f);
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index 09314351078..cee9039e3f9 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -42,6 +42,7 @@
struct DerivedMesh;
struct DMFlagMat;
struct DMGridData;
+struct CustomData;
struct GHash;
struct DMGridData;
struct GPUVertPointLink;
@@ -123,16 +124,16 @@ void GPU_global_buffer_pool_free(void);
GPUBuffer *GPU_buffer_alloc(int size);
void GPU_buffer_free(GPUBuffer *buffer);
-GPUDrawObject *GPU_drawobject_new( struct DerivedMesh *dm );
-void GPU_drawobject_free( struct DerivedMesh *dm );
+GPUDrawObject *GPU_drawobject_new(struct DerivedMesh *dm );
+void GPU_drawobject_free(struct DerivedMesh *dm );
/* called before drawing */
-void GPU_vertex_setup( struct DerivedMesh *dm );
-void GPU_normal_setup( struct DerivedMesh *dm );
-void GPU_uv_setup( struct DerivedMesh *dm );
-void GPU_color_setup( struct DerivedMesh *dm );
-void GPU_edge_setup( struct DerivedMesh *dm ); /* does not mix with other data */
-void GPU_uvedge_setup( struct DerivedMesh *dm );
+void GPU_vertex_setup(struct DerivedMesh *dm );
+void GPU_normal_setup(struct DerivedMesh *dm );
+void GPU_uv_setup(struct DerivedMesh *dm );
+void GPU_color_setup(struct DerivedMesh *dm );
+void GPU_edge_setup(struct DerivedMesh *dm ); /* does not mix with other data */
+void GPU_uvedge_setup(struct DerivedMesh *dm );
int GPU_attrib_element_size( GPUAttrib data[], int numdata );
void GPU_interleaved_attrib_setup( GPUBuffer *buffer, GPUAttrib data[], int numdata );
@@ -142,7 +143,7 @@ void *GPU_buffer_lock_stream( GPUBuffer *buffer );
void GPU_buffer_unlock( GPUBuffer *buffer );
/* upload three unsigned chars, representing RGB colors, for each vertex. Resets dm->drawObject->colType to -1 */
-void GPU_color3_upload( struct DerivedMesh *dm, unsigned char *data );
+void GPU_color3_upload(struct DerivedMesh *dm, unsigned char *data );
/* switch color rendering on=1/off=0 */
void GPU_color_switch( int mode );
@@ -153,18 +154,20 @@ void GPU_buffer_draw_elements( GPUBuffer *elements, unsigned int mode, int start
void GPU_buffer_unbind(void);
/* used to check whether to use the old (without buffers) code */
-int GPU_buffer_legacy( struct DerivedMesh *dm );
+int GPU_buffer_legacy(struct DerivedMesh *dm );
/* Buffers for non-DerivedMesh drawing */
typedef struct GPU_Buffers GPU_Buffers;
GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
- struct MFace *mface, int *face_indices, int totface);
+ struct MFace *mface, struct MVert *mvert,
+ int *face_indices, int totface);
void GPU_update_mesh_buffers(GPU_Buffers *buffers, struct MVert *mvert,
int *vert_indices, int totvert);
-GPU_Buffers *GPU_build_grid_buffers(int totgrid, int gridsize);
+GPU_Buffers *GPU_build_grid_buffers(int *grid_indices, int totgrid,
+ unsigned int **grid_hidden, int gridsize);
void GPU_update_grid_buffers(GPU_Buffers *buffers, struct DMGridData **grids,
const struct DMFlagMat *grid_flag_mats,
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 23bc79e4187..61d563a54e0 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -38,6 +38,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_bitmap.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
@@ -46,6 +47,8 @@
#include "DNA_meshdata_types.h"
#include "BKE_DerivedMesh.h"
+#include "BKE_paint.h"
+#include "BKE_subsurf.h"
#include "DNA_userdef_types.h"
@@ -70,15 +73,15 @@ static GPUBufferState GLStates = 0;
static GPUAttrib attribData[MAX_GPU_ATTRIB_DATA] = { { -1, 0, 0 } };
/* stores recently-deleted buffers so that new buffers won't have to
- be recreated as often
-
- only one instance of this pool is created, stored in
- gpu_buffer_pool
-
- note that the number of buffers in the pool is usually limited to
- MAX_FREE_GPU_BUFFERS, but this limit may be exceeded temporarily
- when a GPUBuffer is released outside the main thread; due to OpenGL
- restrictions it cannot be immediately released
+ * be recreated as often
+ *
+ * only one instance of this pool is created, stored in
+ * gpu_buffer_pool
+ *
+ * note that the number of buffers in the pool is usually limited to
+ * MAX_FREE_GPU_BUFFERS, but this limit may be exceeded temporarily
+ * when a GPUBuffer is released outside the main thread; due to OpenGL
+ * restrictions it cannot be immediately released
*/
typedef struct GPUBufferPool {
/* number of allocated buffers stored */
@@ -95,7 +98,7 @@ static GPUBufferPool *gpu_buffer_pool_new(void)
GPUBufferPool *pool;
/* enable VBOs if supported */
- if(useVBOs == -1)
+ if (useVBOs == -1)
useVBOs = (GLEW_ARB_vertex_buffer_object ? 1 : 0);
pool = MEM_callocN(sizeof(GPUBufferPool), "GPUBuffer");
@@ -112,15 +115,15 @@ static void gpu_buffer_pool_remove_index(GPUBufferPool *pool, int index)
{
int i;
- if(!pool || index < 0 || index >= pool->totbuf)
+ if (!pool || index < 0 || index >= pool->totbuf)
return;
/* shift entries down, overwriting the buffer at `index' */
- for(i = index; i < pool->totbuf - 1; i++)
+ for (i = index; i < pool->totbuf - 1; i++)
pool->buffers[i] = pool->buffers[i+1];
/* clear the last entry */
- if(pool->totbuf > 0)
+ if (pool->totbuf > 0)
pool->buffers[pool->totbuf - 1] = NULL;
pool->totbuf--;
@@ -131,15 +134,15 @@ static void gpu_buffer_pool_delete_last(GPUBufferPool *pool)
{
GPUBuffer *last;
- if(pool->totbuf <= 0)
+ if (pool->totbuf <= 0)
return;
/* get the last entry */
- if(!(last = pool->buffers[pool->totbuf - 1]))
+ if (!(last = pool->buffers[pool->totbuf - 1]))
return;
/* delete the buffer's data */
- if(useVBOs)
+ if (useVBOs)
glDeleteBuffersARB(1, &last->id);
else
MEM_freeN(last->pointer);
@@ -154,10 +157,10 @@ static void gpu_buffer_pool_delete_last(GPUBufferPool *pool)
GPUBuffers */
static void gpu_buffer_pool_free(GPUBufferPool *pool)
{
- if(!pool)
+ if (!pool)
return;
- while(pool->totbuf)
+ while (pool->totbuf)
gpu_buffer_pool_delete_last(pool);
MEM_freeN(pool->buffers);
@@ -168,7 +171,7 @@ static GPUBufferPool *gpu_buffer_pool = NULL;
static GPUBufferPool *gpu_get_global_buffer_pool(void)
{
/* initialize the pool */
- if(!gpu_buffer_pool)
+ if (!gpu_buffer_pool)
gpu_buffer_pool = gpu_buffer_pool_new();
return gpu_buffer_pool;
@@ -198,21 +201,21 @@ GPUBuffer *GPU_buffer_alloc(int size)
/* check the global buffer pool for a recently-deleted buffer
that is at least as big as the request, but not more than
twice as big */
- for(i = 0; i < pool->totbuf; i++) {
+ for (i = 0; i < pool->totbuf; i++) {
bufsize = pool->buffers[i]->size;
/* check for an exact size match */
- if(bufsize == size) {
+ if (bufsize == size) {
bestfit = i;
break;
}
/* smaller buffers won't fit data and buffers at least
twice as big are a waste of memory */
- else if(bufsize > size && size > (bufsize / 2)) {
+ else if (bufsize > size && size > (bufsize / 2)) {
/* is it closer to the required size than the
last appropriate buffer found. try to save
memory */
- if(bestfit == -1 || pool->buffers[bestfit]->size > bufsize) {
+ if (bestfit == -1 || pool->buffers[bestfit]->size > bufsize) {
bestfit = i;
}
}
@@ -220,7 +223,7 @@ GPUBuffer *GPU_buffer_alloc(int size)
/* if an acceptable buffer was found in the pool, remove it
from the pool and return it */
- if(bestfit != -1) {
+ if (bestfit != -1) {
buf = pool->buffers[bestfit];
gpu_buffer_pool_remove_index(pool, bestfit);
return buf;
@@ -230,7 +233,7 @@ GPUBuffer *GPU_buffer_alloc(int size)
buf = MEM_callocN(sizeof(GPUBuffer), "GPUBuffer");
buf->size = size;
- if(useVBOs == 1) {
+ if (useVBOs == 1) {
/* create a new VBO and initialize it to the requested
size */
glGenBuffersARB(1, &buf->id);
@@ -245,11 +248,11 @@ GPUBuffer *GPU_buffer_alloc(int size)
out-of-memory errors? looks a bit iffy to me
though, at least on Linux I expect malloc() would
just overcommit. --nicholas */
- while(!buf->pointer && pool->totbuf > 0) {
+ while (!buf->pointer && pool->totbuf > 0) {
gpu_buffer_pool_delete_last(pool);
buf->pointer = MEM_mallocN(size, "GPUBuffer.pointer");
}
- if(!buf->pointer)
+ if (!buf->pointer)
return NULL;
}
@@ -264,7 +267,7 @@ void GPU_buffer_free(GPUBuffer *buffer)
GPUBufferPool *pool;
int i;
- if(!buffer)
+ if (!buffer)
return;
pool = gpu_get_global_buffer_pool();
@@ -273,16 +276,16 @@ void GPU_buffer_free(GPUBuffer *buffer)
if we are in the main thread. for e.g. rendering or baking it can
happen that we are in other thread and can't call OpenGL, in that
case cleanup will be done GPU_buffer_pool_free_unused */
- if(BLI_thread_is_main()) {
+ if (BLI_thread_is_main()) {
/* in main thread, safe to decrease size of pool back
down to MAX_FREE_GPU_BUFFERS */
- while(pool->totbuf >= MAX_FREE_GPU_BUFFERS)
+ while (pool->totbuf >= MAX_FREE_GPU_BUFFERS)
gpu_buffer_pool_delete_last(pool);
}
else {
/* outside of main thread, can't safely delete the
buffer, so increase pool size */
- if(pool->maxsize == pool->totbuf) {
+ if (pool->maxsize == pool->totbuf) {
pool->maxsize += MAX_FREE_GPU_BUFFERS;
pool->buffers = MEM_reallocN(pool->buffers,
sizeof(GPUBuffer*) * pool->maxsize);
@@ -290,7 +293,7 @@ void GPU_buffer_free(GPUBuffer *buffer)
}
/* shift pool entries up by one */
- for(i = pool->totbuf; i > 0; i--)
+ for (i = pool->totbuf; i > 0; i--)
pool->buffers[i] = pool->buffers[i-1];
/* insert the buffer into the beginning of the pool */
@@ -313,9 +316,9 @@ static void gpu_drawobject_add_vert_point(GPUDrawObject *gdo, int vert_index, in
lnk = &gdo->vert_points[vert_index];
/* if first link is in use, add a new link at the end */
- if(lnk->point_index != -1) {
+ if (lnk->point_index != -1) {
/* get last link */
- for(; lnk->next; lnk = lnk->next);
+ for (; lnk->next; lnk = lnk->next);
/* add a new link from the pool */
lnk = lnk->next = &gdo->vert_points_mem[gdo->vert_points_usage];
@@ -333,7 +336,7 @@ static void gpu_drawobject_add_triangle(GPUDrawObject *gdo,
int v1, int v2, int v3)
{
int i, v[3] = {v1, v2, v3};
- for(i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
gpu_drawobject_add_vert_point(gdo, v[i], base_point_index + i);
gdo->triangle_to_mface[base_point_index / 3] = face_index;
}
@@ -354,14 +357,14 @@ static void gpu_drawobject_init_vert_points(GPUDrawObject *gdo, MFace *f, int to
/* build a map from the original material indices to the new
GPUBufferMaterial indices */
- for(i = 0; i < gdo->totmaterial; i++)
+ for (i = 0; i < gdo->totmaterial; i++)
mat_orig_to_new[gdo->materials[i].mat_nr] = i;
/* -1 indicates the link is not yet used */
- for(i = 0; i < gdo->totvert; i++)
+ for (i = 0; i < gdo->totvert; i++)
gdo->vert_points[i].point_index = -1;
- for(i = 0; i < totface; i++, f++) {
+ for (i = 0; i < totface; i++, f++) {
mat = &gdo->materials[mat_orig_to_new[f->mat_nr]];
/* add triangle */
@@ -370,7 +373,7 @@ static void gpu_drawobject_init_vert_points(GPUDrawObject *gdo, MFace *f, int to
mat->totpoint += 3;
/* add second triangle for quads */
- if(f->v4) {
+ if (f->v4) {
gpu_drawobject_add_triangle(gdo, mat->start + mat->totpoint,
i, f->v3, f->v4, f->v1);
mat->totpoint += 3;
@@ -378,8 +381,8 @@ static void gpu_drawobject_init_vert_points(GPUDrawObject *gdo, MFace *f, int to
}
/* map any unused vertices to loose points */
- for(i = 0; i < gdo->totvert; i++) {
- if(gdo->vert_points[i].point_index == -1) {
+ for (i = 0; i < gdo->totvert; i++) {
+ if (gdo->vert_points[i].point_index == -1) {
gdo->vert_points[i].point_index = gdo->tot_triangle_point + gdo->tot_loose_point;
gdo->tot_loose_point++;
}
@@ -401,7 +404,7 @@ GPUDrawObject *GPU_drawobject_new( DerivedMesh *dm )
/* get the number of points used by each material, treating
each quad as two triangles */
memset(points_per_mat, 0, sizeof(int)*MAX_MATERIALS);
- for(i = 0; i < totface; i++)
+ for (i = 0; i < totface; i++)
points_per_mat[mface[i].mat_nr] += mface[i].v4 ? 6 : 3;
/* create the GPUDrawObject */
@@ -410,8 +413,8 @@ GPUDrawObject *GPU_drawobject_new( DerivedMesh *dm )
gdo->totedge = dm->getNumEdges(dm);
/* count the number of materials used by this DerivedMesh */
- for(i = 0; i < MAX_MATERIALS; i++) {
- if(points_per_mat[i] > 0)
+ for (i = 0; i < MAX_MATERIALS; i++) {
+ if (points_per_mat[i] > 0)
gdo->totmaterial++;
}
@@ -420,8 +423,8 @@ GPUDrawObject *GPU_drawobject_new( DerivedMesh *dm )
"GPUDrawObject.materials");
/* initialize the materials array */
- for(i = 0, curmat = 0, curpoint = 0; i < MAX_MATERIALS; i++) {
- if(points_per_mat[i] > 0) {
+ for (i = 0, curmat = 0, curpoint = 0; i < MAX_MATERIALS; i++) {
+ if (points_per_mat[i] > 0) {
gdo->materials[curmat].start = curpoint;
gdo->materials[curmat].totpoint = 0;
gdo->materials[curmat].mat_nr = i;
@@ -446,7 +449,7 @@ void GPU_drawobject_free(DerivedMesh *dm)
{
GPUDrawObject *gdo;
- if(!dm || !(gdo = dm->drawObject))
+ if (!dm || !(gdo = dm->drawObject))
return;
MEM_freeN(gdo->materials);
@@ -483,16 +486,16 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
pool = gpu_get_global_buffer_pool();
/* alloc a GPUBuffer; fall back to legacy mode on failure */
- if(!(buffer = GPU_buffer_alloc(size)))
+ if (!(buffer = GPU_buffer_alloc(size)))
dm->drawObject->legacy = 1;
/* nothing to do for legacy mode */
- if(dm->drawObject->legacy)
+ if (dm->drawObject->legacy)
return NULL;
cur_index_per_mat = MEM_mallocN(sizeof(int)*object->totmaterial,
"GPU_buffer_setup.cur_index_per_mat");
- for(i = 0; i < object->totmaterial; i++) {
+ for (i = 0; i < object->totmaterial; i++) {
/* for each material, the current index to copy data to */
cur_index_per_mat[i] = object->materials[i].start * vector_size;
@@ -501,17 +504,17 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
mat_orig_to_new[object->materials[i].mat_nr] = i;
}
- if(useVBOs) {
+ if (useVBOs) {
success = 0;
- while(!success) {
+ while (!success) {
/* bind the buffer and discard previous data,
avoids stalling gpu */
glBindBufferARB(target, buffer->id);
glBufferDataARB(target, buffer->size, NULL, GL_STATIC_DRAW_ARB);
/* attempt to map the buffer */
- if(!(varray = glMapBufferARB(target, GL_WRITE_ONLY_ARB))) {
+ if (!(varray = glMapBufferARB(target, GL_WRITE_ONLY_ARB))) {
/* failed to map the buffer; delete it */
GPU_buffer_free(buffer);
gpu_buffer_pool_delete_last(pool);
@@ -519,14 +522,14 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
/* try freeing an entry from the pool
and reallocating the buffer */
- if(pool->totbuf > 0) {
+ if (pool->totbuf > 0) {
gpu_buffer_pool_delete_last(pool);
buffer = GPU_buffer_alloc(size);
}
/* allocation still failed; fall back
to legacy mode */
- if(!buffer) {
+ if (!buffer) {
dm->drawObject->legacy = 1;
success = 1;
}
@@ -537,10 +540,10 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
}
/* check legacy fallback didn't happen */
- if(dm->drawObject->legacy == 0) {
+ if (dm->drawObject->legacy == 0) {
uploaded = GL_FALSE;
/* attempt to upload the data to the VBO */
- while(uploaded == GL_FALSE) {
+ while (uploaded == GL_FALSE) {
(*copy_f)(dm, varray, cur_index_per_mat, mat_orig_to_new, user);
/* glUnmapBuffer returns GL_FALSE if
* the data store is corrupted; retry
@@ -552,7 +555,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
}
else {
/* VBO not supported, use vertex array fallback */
- if(buffer->pointer) {
+ if (buffer->pointer) {
varray = buffer->pointer;
(*copy_f)(dm, varray, cur_index_per_mat, mat_orig_to_new, user);
}
@@ -576,7 +579,7 @@ static void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, i
f = dm->getTessFaceArray(dm);
totface= dm->getNumTessFaces(dm);
- for(i = 0; i < totface; i++, f++) {
+ for (i = 0; i < totface; i++, f++) {
start = index[mat_orig_to_new[f->mat_nr]];
/* v1 v2 v3 */
@@ -585,7 +588,7 @@ static void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, i
copy_v3_v3(&varray[start+6], mvert[f->v3].co);
index[mat_orig_to_new[f->mat_nr]] += 9;
- if(f->v4) {
+ if (f->v4) {
/* v3 v4 v1 */
copy_v3_v3(&varray[start+9], mvert[f->v3].co);
copy_v3_v3(&varray[start+12], mvert[f->v4].co);
@@ -596,8 +599,8 @@ static void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, i
/* copy loose points */
j = dm->drawObject->tot_triangle_point*3;
- for(i = 0; i < dm->drawObject->totvert; i++) {
- if(dm->drawObject->vert_points[i].point_index >= dm->drawObject->tot_triangle_point) {
+ for (i = 0; i < dm->drawObject->totvert; i++) {
+ if (dm->drawObject->vert_points[i].point_index >= dm->drawObject->tot_triangle_point) {
copy_v3_v3(&varray[j],mvert[i].co);
j+=3;
}
@@ -615,31 +618,31 @@ static void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, i
MFace *f = dm->getTessFaceArray(dm);
totface= dm->getNumTessFaces(dm);
- for(i = 0; i < totface; i++, f++) {
+ for (i = 0; i < totface; i++, f++) {
const int smoothnormal = (f->flag & ME_SMOOTH);
start = index[mat_orig_to_new[f->mat_nr]];
index[mat_orig_to_new[f->mat_nr]] += f->v4 ? 18 : 9;
- if(smoothnormal) {
+ if (smoothnormal) {
/* copy vertex normal */
normal_short_to_float_v3(&varray[start], mvert[f->v1].no);
normal_short_to_float_v3(&varray[start+3], mvert[f->v2].no);
normal_short_to_float_v3(&varray[start+6], mvert[f->v3].no);
- if(f->v4) {
+ if (f->v4) {
normal_short_to_float_v3(&varray[start+9], mvert[f->v3].no);
normal_short_to_float_v3(&varray[start+12], mvert[f->v4].no);
normal_short_to_float_v3(&varray[start+15], mvert[f->v1].no);
}
}
- else if(nors) {
+ else if (nors) {
/* copy cached face normal */
copy_v3_v3(&varray[start], &nors[i*3]);
copy_v3_v3(&varray[start+3], &nors[i*3]);
copy_v3_v3(&varray[start+6], &nors[i*3]);
- if(f->v4) {
+ if (f->v4) {
copy_v3_v3(&varray[start+9], &nors[i*3]);
copy_v3_v3(&varray[start+12], &nors[i*3]);
copy_v3_v3(&varray[start+15], &nors[i*3]);
@@ -647,7 +650,7 @@ static void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, i
}
else {
/* calculate face normal */
- if(f->v4)
+ if (f->v4)
normal_quad_v3(f_no, mvert[f->v1].co, mvert[f->v2].co, mvert[f->v3].co, mvert[f->v4].co);
else
normal_tri_v3(f_no, mvert[f->v1].co, mvert[f->v2].co, mvert[f->v3].co);
@@ -656,7 +659,7 @@ static void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, i
copy_v3_v3(&varray[start+3], f_no);
copy_v3_v3(&varray[start+6], f_no);
- if(f->v4) {
+ if (f->v4) {
copy_v3_v3(&varray[start+9], f_no);
copy_v3_v3(&varray[start+12], f_no);
copy_v3_v3(&varray[start+15], f_no);
@@ -673,12 +676,12 @@ static void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *
MTFace *mtface;
MFace *f;
- if(!(mtface = DM_get_tessface_data_layer(dm, CD_MTFACE)))
+ if (!(mtface = DM_get_tessface_data_layer(dm, CD_MTFACE)))
return;
f = dm->getTessFaceArray(dm);
totface = dm->getNumTessFaces(dm);
- for(i = 0; i < totface; i++, f++) {
+ for (i = 0; i < totface; i++, f++) {
start = index[mat_orig_to_new[f->mat_nr]];
/* v1 v2 v3 */
@@ -687,7 +690,7 @@ static void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *
copy_v2_v2(&varray[start+4],mtface[i].uv[2]);
index[mat_orig_to_new[f->mat_nr]] += 6;
- if(f->v4) {
+ if (f->v4) {
/* v3 v4 v1 */
copy_v2_v2(&varray[start+6],mtface[i].uv[2]);
copy_v2_v2(&varray[start+8],mtface[i].uv[3]);
@@ -706,7 +709,7 @@ static void GPU_buffer_copy_color3(DerivedMesh *dm, float *varray_, int *index,
MFace *f = dm->getTessFaceArray(dm);
totface= dm->getNumTessFaces(dm);
- for(i=0; i < totface; i++, f++) {
+ for (i=0; i < totface; i++, f++) {
int start = index[mat_orig_to_new[f->mat_nr]];
/* v1 v2 v3 */
@@ -715,7 +718,7 @@ static void GPU_buffer_copy_color3(DerivedMesh *dm, float *varray_, int *index,
copy_v3_v3_char(&varray[start+6], &mcol[i*12+6]);
index[mat_orig_to_new[f->mat_nr]] += 9;
- if(f->v4) {
+ if (f->v4) {
/* v3 v4 v1 */
copy_v3_v3_char(&varray[start+9], &mcol[i*12+6]);
copy_v3_v3_char(&varray[start+12], &mcol[i*12+9]);
@@ -741,7 +744,7 @@ static void GPU_buffer_copy_mcol(DerivedMesh *dm, float *varray_, int *index, in
MFace *f = dm->getTessFaceArray(dm);
totface= dm->getNumTessFaces(dm);
- for(i=0; i < totface; i++, f++) {
+ for (i=0; i < totface; i++, f++) {
int start = index[mat_orig_to_new[f->mat_nr]];
/* v1 v2 v3 */
@@ -750,7 +753,7 @@ static void GPU_buffer_copy_mcol(DerivedMesh *dm, float *varray_, int *index, in
copy_mcol_uc3(&varray[start+6], &mcol[i*16+8]);
index[mat_orig_to_new[f->mat_nr]] += 9;
- if(f->v4) {
+ if (f->v4) {
/* v3 v4 v1 */
copy_mcol_uc3(&varray[start+9], &mcol[i*16+8]);
copy_mcol_uc3(&varray[start+12], &mcol[i*16+12]);
@@ -769,7 +772,7 @@ static void GPU_buffer_copy_edge(DerivedMesh *dm, float *varray_, int *UNUSED(in
medge = dm->getEdgeArray(dm);
totedge = dm->getNumEdges(dm);
- for(i = 0; i < totedge; i++, medge++) {
+ for (i = 0; i < totedge; i++, medge++) {
varray[i*2] = dm->drawObject->vert_points[medge->v1].point_index;
varray[i*2+1] = dm->drawObject->vert_points[medge->v2].point_index;
}
@@ -780,10 +783,10 @@ static void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(i
MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
int i, j=0;
- if(!tf)
+ if (!tf)
return;
- for(i = 0; i < dm->numTessFaceData; i++, tf++) {
+ for (i = 0; i < dm->numTessFaceData; i++, tf++) {
MFace mf;
dm->getTessFace(dm,i,&mf);
@@ -793,11 +796,12 @@ static void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(i
copy_v2_v2(&varray[j+4],tf->uv[1]);
copy_v2_v2(&varray[j+6],tf->uv[2]);
- if(!mf.v4) {
+ if (!mf.v4) {
copy_v2_v2(&varray[j+8],tf->uv[2]);
copy_v2_v2(&varray[j+10],tf->uv[0]);
j+=12;
- } else {
+ }
+ else {
copy_v2_v2(&varray[j+8],tf->uv[2]);
copy_v2_v2(&varray[j+10],tf->uv[3]);
@@ -809,7 +813,7 @@ static void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(i
}
/* get the DerivedMesh's MCols; choose (in decreasing order of
- preference) from CD_ID_MCOL, CD_WEIGHT_MCOL, or CD_MCOL */
+ preference) from CD_ID_MCOL, CD_PREVIEW_MCOL, or CD_MCOL */
static MCol *gpu_buffer_color_type(DerivedMesh *dm)
{
MCol *c;
@@ -817,10 +821,10 @@ static MCol *gpu_buffer_color_type(DerivedMesh *dm)
type = CD_ID_MCOL;
c = DM_get_tessface_data_layer(dm, type);
- if(!c) {
- type = CD_WEIGHT_MCOL;
+ if (!c) {
+ type = CD_PREVIEW_MCOL;
c = DM_get_tessface_data_layer(dm, type);
- if(!c) {
+ if (!c) {
type = CD_MCOL;
c = DM_get_tessface_data_layer(dm, type);
}
@@ -911,12 +915,12 @@ static GPUBuffer *gpu_buffer_setup_type(DerivedMesh *dm, GPUBufferType type)
ts = &gpu_buffer_type_settings[type];
/* special handling for MCol and UV buffers */
- if(type == GPU_BUFFER_COLOR) {
- if(!(user_data = gpu_buffer_color_type(dm)))
+ if (type == GPU_BUFFER_COLOR) {
+ if (!(user_data = gpu_buffer_color_type(dm)))
return NULL;
}
- else if(type == GPU_BUFFER_UV) {
- if(!DM_get_tessface_data_layer(dm, CD_MTFACE))
+ else if (type == GPU_BUFFER_UV) {
+ if (!DM_get_tessface_data_layer(dm, CD_MTFACE))
return NULL;
}
@@ -933,11 +937,11 @@ static GPUBuffer *gpu_buffer_setup_common(DerivedMesh *dm, GPUBufferType type)
{
GPUBuffer **buf;
- if(!dm->drawObject)
+ if (!dm->drawObject)
dm->drawObject = GPU_drawobject_new(dm);
buf = gpu_drawobject_buffer_from_type(dm->drawObject, type);
- if(!(*buf))
+ if (!(*buf))
*buf = gpu_buffer_setup_type(dm, type);
return *buf;
@@ -945,11 +949,11 @@ static GPUBuffer *gpu_buffer_setup_common(DerivedMesh *dm, GPUBufferType type)
void GPU_vertex_setup(DerivedMesh *dm)
{
- if(!gpu_buffer_setup_common(dm, GPU_BUFFER_VERTEX))
+ if (!gpu_buffer_setup_common(dm, GPU_BUFFER_VERTEX))
return;
glEnableClientState(GL_VERTEX_ARRAY);
- if(useVBOs) {
+ if (useVBOs) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->points->id);
glVertexPointer(3, GL_FLOAT, 0, 0);
}
@@ -962,11 +966,11 @@ void GPU_vertex_setup(DerivedMesh *dm)
void GPU_normal_setup(DerivedMesh *dm)
{
- if(!gpu_buffer_setup_common(dm, GPU_BUFFER_NORMAL))
+ if (!gpu_buffer_setup_common(dm, GPU_BUFFER_NORMAL))
return;
glEnableClientState(GL_NORMAL_ARRAY);
- if(useVBOs) {
+ if (useVBOs) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->normals->id);
glNormalPointer(GL_FLOAT, 0, 0);
}
@@ -979,11 +983,11 @@ void GPU_normal_setup(DerivedMesh *dm)
void GPU_uv_setup(DerivedMesh *dm)
{
- if(!gpu_buffer_setup_common(dm, GPU_BUFFER_UV))
+ if (!gpu_buffer_setup_common(dm, GPU_BUFFER_UV))
return;
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- if(useVBOs) {
+ if (useVBOs) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->uv->id);
glTexCoordPointer(2, GL_FLOAT, 0, 0);
}
@@ -996,11 +1000,11 @@ void GPU_uv_setup(DerivedMesh *dm)
void GPU_color_setup(DerivedMesh *dm)
{
- if(!gpu_buffer_setup_common(dm, GPU_BUFFER_COLOR))
+ if (!gpu_buffer_setup_common(dm, GPU_BUFFER_COLOR))
return;
glEnableClientState(GL_COLOR_ARRAY);
- if(useVBOs) {
+ if (useVBOs) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->colors->id);
glColorPointer(3, GL_UNSIGNED_BYTE, 0, 0);
}
@@ -1013,14 +1017,14 @@ void GPU_color_setup(DerivedMesh *dm)
void GPU_edge_setup(DerivedMesh *dm)
{
- if(!gpu_buffer_setup_common(dm, GPU_BUFFER_EDGE))
+ if (!gpu_buffer_setup_common(dm, GPU_BUFFER_EDGE))
return;
- if(!gpu_buffer_setup_common(dm, GPU_BUFFER_VERTEX))
+ if (!gpu_buffer_setup_common(dm, GPU_BUFFER_VERTEX))
return;
glEnableClientState(GL_VERTEX_ARRAY);
- if(useVBOs) {
+ if (useVBOs) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->points->id);
glVertexPointer(3, GL_FLOAT, 0, 0);
}
@@ -1030,7 +1034,7 @@ void GPU_edge_setup(DerivedMesh *dm)
GLStates |= GPU_BUFFER_VERTEX_STATE;
- if(useVBOs)
+ if (useVBOs)
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, dm->drawObject->edges->id);
GLStates |= GPU_BUFFER_ELEMENT_STATE;
@@ -1038,11 +1042,11 @@ void GPU_edge_setup(DerivedMesh *dm)
void GPU_uvedge_setup(DerivedMesh *dm)
{
- if(!gpu_buffer_setup_common(dm, GPU_BUFFER_UVEDGE))
+ if (!gpu_buffer_setup_common(dm, GPU_BUFFER_UVEDGE))
return;
glEnableClientState(GL_VERTEX_ARRAY);
- if(useVBOs) {
+ if (useVBOs) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->uvedges->id);
glVertexPointer(2, GL_FLOAT, 0, 0);
}
@@ -1075,9 +1079,9 @@ int GPU_attrib_element_size(GPUAttrib data[], int numdata)
{
int i, elementsize = 0;
- for(i = 0; i < numdata; i++) {
+ for (i = 0; i < numdata; i++) {
int typesize = GPU_typesize(data[i].type);
- if(typesize != 0)
+ if (typesize != 0)
elementsize += typesize*data[i].size;
}
return elementsize;
@@ -1089,8 +1093,8 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
int elementsize;
intptr_t offset = 0;
- for(i = 0; i < MAX_GPU_ATTRIB_DATA; i++) {
- if(attribData[i].index != -1) {
+ for (i = 0; i < MAX_GPU_ATTRIB_DATA; i++) {
+ if (attribData[i].index != -1) {
glDisableVertexAttribArrayARB(attribData[i].index);
}
else
@@ -1098,9 +1102,9 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
}
elementsize = GPU_attrib_element_size(data, numdata);
- if(useVBOs) {
+ if (useVBOs) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer->id);
- for(i = 0; i < numdata; i++) {
+ for (i = 0; i < numdata; i++) {
glEnableVertexAttribArrayARB(data[i].index);
glVertexAttribPointerARB(data[i].index, data[i].size, data[i].type,
GL_FALSE, elementsize, (void *)offset);
@@ -1113,7 +1117,7 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
attribData[numdata].index = -1;
}
else {
- for(i = 0; i < numdata; i++) {
+ for (i = 0; i < numdata; i++) {
glEnableVertexAttribArrayARB(data[i].index);
glVertexAttribPointerARB(data[i].index, data[i].size, data[i].type,
GL_FALSE, elementsize, (char *)buffer->pointer + offset);
@@ -1127,16 +1131,16 @@ void GPU_buffer_unbind(void)
{
int i;
- if(GLStates & GPU_BUFFER_VERTEX_STATE)
+ if (GLStates & GPU_BUFFER_VERTEX_STATE)
glDisableClientState(GL_VERTEX_ARRAY);
- if(GLStates & GPU_BUFFER_NORMAL_STATE)
+ if (GLStates & GPU_BUFFER_NORMAL_STATE)
glDisableClientState(GL_NORMAL_ARRAY);
- if(GLStates & GPU_BUFFER_TEXCOORD_STATE)
+ if (GLStates & GPU_BUFFER_TEXCOORD_STATE)
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- if(GLStates & GPU_BUFFER_COLOR_STATE)
+ if (GLStates & GPU_BUFFER_COLOR_STATE)
glDisableClientState(GL_COLOR_ARRAY);
- if(GLStates & GPU_BUFFER_ELEMENT_STATE) {
- if(useVBOs) {
+ if (GLStates & GPU_BUFFER_ELEMENT_STATE) {
+ if (useVBOs) {
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
}
}
@@ -1144,24 +1148,24 @@ void GPU_buffer_unbind(void)
GPU_BUFFER_TEXCOORD_STATE | GPU_BUFFER_COLOR_STATE |
GPU_BUFFER_ELEMENT_STATE);
- for(i = 0; i < MAX_GPU_ATTRIB_DATA; i++) {
- if(attribData[i].index != -1) {
+ for (i = 0; i < MAX_GPU_ATTRIB_DATA; i++) {
+ if (attribData[i].index != -1) {
glDisableVertexAttribArrayARB(attribData[i].index);
}
else
break;
}
- if(useVBOs)
+ if (useVBOs)
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
/* confusion: code in cdderivedmesh calls both GPU_color_setup and
- GPU_color3_upload; both of these set the `colors' buffer, so seems
- like it will just needlessly overwrite? --nicholas */
+ * GPU_color3_upload; both of these set the `colors' buffer, so seems
+ * like it will just needlessly overwrite? --nicholas */
void GPU_color3_upload(DerivedMesh *dm, unsigned char *data)
{
- if(dm->drawObject == 0)
+ if (dm->drawObject == 0)
dm->drawObject = GPU_drawobject_new(dm);
GPU_buffer_free(dm->drawObject->colors);
@@ -1172,13 +1176,13 @@ void GPU_color3_upload(DerivedMesh *dm, unsigned char *data)
void GPU_color_switch(int mode)
{
- if(mode) {
- if(!(GLStates & GPU_BUFFER_COLOR_STATE))
+ if (mode) {
+ if (!(GLStates & GPU_BUFFER_COLOR_STATE))
glEnableClientState(GL_COLOR_ARRAY);
GLStates |= GPU_BUFFER_COLOR_STATE;
}
else {
- if(GLStates & GPU_BUFFER_COLOR_STATE)
+ if (GLStates & GPU_BUFFER_COLOR_STATE)
glDisableClientState(GL_COLOR_ARRAY);
GLStates &= (!GPU_BUFFER_COLOR_STATE);
}
@@ -1189,10 +1193,10 @@ void GPU_color_switch(int mode)
int GPU_buffer_legacy(DerivedMesh *dm)
{
int test= (U.gameflags & USER_DISABLE_VBO);
- if(test)
+ if (test)
return 1;
- if(dm->drawObject == 0)
+ if (dm->drawObject == 0)
dm->drawObject = GPU_drawobject_new(dm);
return dm->drawObject->legacy;
}
@@ -1201,10 +1205,10 @@ void *GPU_buffer_lock(GPUBuffer *buffer)
{
float *varray;
- if(!buffer)
+ if (!buffer)
return 0;
- if(useVBOs) {
+ if (useVBOs) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer->id);
varray = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
return varray;
@@ -1218,10 +1222,10 @@ void *GPU_buffer_lock_stream(GPUBuffer *buffer)
{
float *varray;
- if(!buffer)
+ if (!buffer)
return 0;
- if(useVBOs) {
+ if (useVBOs) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer->id);
/* discard previous data, avoid stalling gpu */
glBufferDataARB(GL_ARRAY_BUFFER_ARB, buffer->size, 0, GL_STREAM_DRAW_ARB);
@@ -1235,8 +1239,8 @@ void *GPU_buffer_lock_stream(GPUBuffer *buffer)
void GPU_buffer_unlock(GPUBuffer *buffer)
{
- if(useVBOs) {
- if(buffer) {
+ if (useVBOs) {
+ if (buffer) {
/* note: this operation can fail, could return
an error code from this function? */
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
@@ -1278,9 +1282,11 @@ struct GPU_Buffers {
/* grid pointers */
DMGridData **grids;
const DMFlagMat *grid_flag_mats;
+ const BLI_bitmap *grid_hidden;
int *grid_indices;
int totgrid;
int gridsize;
+ int has_hidden;
unsigned int tot_tri, tot_quad;
};
@@ -1291,7 +1297,7 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
VertexBufferFormat *vert_data;
int i;
- if(buffers->vert_buf) {
+ if (buffers->vert_buf) {
/* Build VBO */
glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf);
glBufferDataARB(GL_ARRAY_BUFFER_ARB,
@@ -1299,8 +1305,8 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
NULL, GL_STATIC_DRAW_ARB);
vert_data = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
- if(vert_data) {
- for(i = 0; i < totvert; ++i) {
+ if (vert_data) {
+ for (i = 0; i < totvert; ++i) {
MVert *v = mvert + vert_indices[i];
VertexBufferFormat *out = vert_data + i;
@@ -1322,7 +1328,8 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
}
GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
- MFace *mface, int *face_indices,
+ MFace *mface, MVert *mvert,
+ int *face_indices,
int totface)
{
GPU_Buffers *buffers;
@@ -1332,14 +1339,17 @@ GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
buffers = MEM_callocN(sizeof(GPU_Buffers), "GPU_Buffers");
buffers->index_type = GL_UNSIGNED_SHORT;
- /* Count the number of triangles */
- for(i = 0, tottri = 0; i < totface; ++i)
- tottri += mface[face_indices[i]].v4 ? 2 : 1;
+ /* Count the number of visible triangles */
+ for (i = 0, tottri = 0; i < totface; ++i) {
+ const MFace *f = &mface[face_indices[i]];
+ if (!paint_is_face_hidden(f, mvert))
+ tottri += f->v4 ? 2 : 1;
+ }
- if(GLEW_ARB_vertex_buffer_object && !(U.gameflags & USER_DISABLE_VBO))
+ if (GLEW_ARB_vertex_buffer_object && !(U.gameflags & USER_DISABLE_VBO))
glGenBuffersARB(1, &buffers->index_buf);
- if(buffers->index_buf) {
+ if (buffers->index_buf) {
/* Generate index buffer object */
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffers->index_buf);
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
@@ -1347,17 +1357,21 @@ GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
/* Fill the triangle buffer */
tri_data = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
- if(tri_data) {
- for(i = 0; i < totface; ++i) {
- MFace *f = mface + face_indices[i];
+ if (tri_data) {
+ for (i = 0; i < totface; ++i) {
+ const MFace *f = mface + face_indices[i];
int v[3];
+ /* Skip hidden faces */
+ if (paint_is_face_hidden(f, mvert))
+ continue;
+
v[0]= 0;
v[1]= 1;
v[2]= 2;
- for(j = 0; j < (f->v4 ? 2 : 1); ++j) {
- for(k = 0; k < 3; ++k) {
+ for (j = 0; j < (f->v4 ? 2 : 1); ++j) {
+ for (k = 0; k < 3; ++k) {
*tri_data = face_vert_indices[i][v[k]];
++tri_data;
}
@@ -1376,7 +1390,7 @@ GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
}
- if(buffers->index_buf)
+ if (buffers->index_buf)
glGenBuffersARB(1, &buffers->vert_buf);
buffers->tot_tri = tottri;
@@ -1397,7 +1411,7 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers, DMGridData **grids,
totvert= gridsize*gridsize*totgrid;
/* Build VBO */
- if(buffers->vert_buf) {
+ if (buffers->vert_buf) {
int smooth = grid_flag_mats[grid_indices[0]].flag & ME_SMOOTH;
glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf);
@@ -1405,17 +1419,17 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers, DMGridData **grids,
sizeof(DMGridData) * totvert,
NULL, GL_STATIC_DRAW_ARB);
vert_data = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
- if(vert_data) {
- for(i = 0; i < totgrid; ++i) {
+ if (vert_data) {
+ for (i = 0; i < totgrid; ++i) {
DMGridData *grid= grids[grid_indices[i]];
memcpy(vert_data, grid, sizeof(DMGridData)*gridsize*gridsize);
- if(!smooth) {
+ if (!smooth) {
/* for flat shading, recalc normals and set the last vertex of
each quad in the index buffer to have the flat normal as
that is what opengl will use */
- for(j = 0; j < gridsize-1; ++j) {
- for(k = 0; k < gridsize-1; ++k) {
+ for (j = 0; j < gridsize-1; ++j) {
+ for (k = 0; k < gridsize-1; ++k) {
float fno[3];
normal_quad_v3(fno,
grid[(j+1)*gridsize + k].co,
@@ -1448,34 +1462,79 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers, DMGridData **grids,
//printf("node updated %p\n", buffers);
}
+/* Returns the number of visible quads in the nodes' grids. */
+static int gpu_count_grid_quads(BLI_bitmap *grid_hidden,
+ int *grid_indices, int totgrid,
+ int gridsize)
+{
+ int gridarea = (gridsize-1) * (gridsize-1);
+ int i, x, y, totquad;
+
+ /* grid hidden layer is present, so have to check each grid for
+ visiblity */
+
+ for (i = 0, totquad = 0; i < totgrid; i++) {
+ const BLI_bitmap gh = grid_hidden[grid_indices[i]];
+
+ if (gh) {
+ /* grid hidden are present, have to check each element */
+ for (y = 0; y < gridsize-1; y++) {
+ for (x = 0; x < gridsize-1; x++) {
+ if (!paint_is_grid_face_hidden(gh, gridsize, x, y))
+ totquad++;
+ }
+ }
+ }
+ else
+ totquad += gridarea;
+ }
+
+ return totquad;
+}
+
/* Build the element array buffer of grid indices using either
unsigned shorts or unsigned ints. */
-#define FILL_QUAD_BUFFER(type_) \
+#define FILL_QUAD_BUFFER(type_, tot_quad_, buffer_) \
{ \
type_ *quad_data; \
- int i, j; \
- \
+ int offset = 0; \
+ int i, j, k; \
+ \
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, \
- sizeof(type_) * (*totquad) * 4, NULL, \
+ sizeof(type_) * (tot_quad_) * 4, NULL, \
GL_STATIC_DRAW_ARB); \
- \
+ \
/* Fill the quad buffer */ \
quad_data = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, \
GL_WRITE_ONLY_ARB); \
- if(quad_data) { \
- for(i = 0; i < gridsize-1; ++i) { \
- for(j = 0; j < gridsize-1; ++j) { \
- *(quad_data++)= i*gridsize + j+1; \
- *(quad_data++)= i*gridsize + j; \
- *(quad_data++)= (i+1)*gridsize + j; \
- *(quad_data++)= (i+1)*gridsize + j+1; \
+ if (quad_data) { \
+ for (i = 0; i < totgrid; ++i) { \
+ BLI_bitmap gh = NULL; \
+ if (grid_hidden) \
+ gh = grid_hidden[(grid_indices)[i]]; \
+ \
+ for (j = 0; j < gridsize-1; ++j) { \
+ for (k = 0; k < gridsize-1; ++k) { \
+ /* Skip hidden grid face */ \
+ if (gh && \
+ paint_is_grid_face_hidden(gh, \
+ gridsize, k, j)) \
+ continue; \
+ \
+ *(quad_data++)= offset + j*gridsize + k+1; \
+ *(quad_data++)= offset + j*gridsize + k; \
+ *(quad_data++)= offset + (j+1)*gridsize + k; \
+ *(quad_data++)= offset + (j+1)*gridsize + k+1; \
+ } \
} \
+ \
+ offset += gridsize*gridsize; \
} \
glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB); \
} \
else { \
- glDeleteBuffersARB(1, &buffer); \
- buffer = 0; \
+ glDeleteBuffersARB(1, &(buffer_)); \
+ (buffer_) = 0; \
} \
}
/* end FILL_QUAD_BUFFER */
@@ -1487,16 +1546,21 @@ static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *to
static GLuint buffer = 0;
static unsigned prev_totquad;
+ /* used in the FILL_QUAD_BUFFER macro */
+ const BLI_bitmap *grid_hidden = NULL;
+ int *grid_indices = NULL;
+ int totgrid = 1;
+
/* VBO is disabled; delete the previous buffer (if it exists) and
return an invalid handle */
- if(!GLEW_ARB_vertex_buffer_object || (U.gameflags & USER_DISABLE_VBO)) {
- if(buffer)
+ if (!GLEW_ARB_vertex_buffer_object || (U.gameflags & USER_DISABLE_VBO)) {
+ if (buffer)
glDeleteBuffersARB(1, &buffer);
return 0;
}
/* VBO is already built */
- if(buffer && prev_gridsize == gridsize) {
+ if (buffer && prev_gridsize == gridsize) {
*index_type = prev_index_type;
*totquad = prev_totquad;
return buffer;
@@ -1504,18 +1568,18 @@ static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *to
/* Build new VBO */
glGenBuffersARB(1, &buffer);
- if(buffer) {
+ if (buffer) {
*totquad= (gridsize-1)*(gridsize-1);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffer);
- if(*totquad < USHRT_MAX) {
+ if (gridsize * gridsize < USHRT_MAX) {
*index_type = GL_UNSIGNED_SHORT;
- FILL_QUAD_BUFFER(unsigned short);
+ FILL_QUAD_BUFFER(unsigned short, *totquad, buffer);
}
else {
*index_type = GL_UNSIGNED_INT;
- FILL_QUAD_BUFFER(unsigned int);
+ FILL_QUAD_BUFFER(unsigned int, *totquad, buffer);
}
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
@@ -1527,19 +1591,50 @@ static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *to
return buffer;
}
-GPU_Buffers *GPU_build_grid_buffers(int totgrid, int gridsize)
+GPU_Buffers *GPU_build_grid_buffers(int *grid_indices, int totgrid,
+ BLI_bitmap *grid_hidden, int gridsize)
{
GPU_Buffers *buffers;
+ int totquad;
+ int fully_visible_totquad = (gridsize-1) * (gridsize-1) * totgrid;
buffers = MEM_callocN(sizeof(GPU_Buffers), "GPU_Buffers");
-
- /* Build index VBO */
- buffers->index_buf = gpu_get_grid_buffer(gridsize, &buffers->index_type, &buffers->tot_quad);
- buffers->totgrid = totgrid;
+ buffers->grid_hidden = grid_hidden;
buffers->gridsize = gridsize;
+ buffers->totgrid = totgrid;
+
+ /* Count the number of quads */
+ totquad= gpu_count_grid_quads(grid_hidden, grid_indices, totgrid, gridsize);
+
+ if (totquad == fully_visible_totquad) {
+ buffers->index_buf = gpu_get_grid_buffer(gridsize, &buffers->index_type, &buffers->tot_quad);
+ buffers->has_hidden = 0;
+ }
+ else if (GLEW_ARB_vertex_buffer_object && !(U.gameflags & USER_DISABLE_VBO)) {
+ /* Build new VBO */
+ glGenBuffersARB(1, &buffers->index_buf);
+ if (buffers->index_buf) {
+ buffers->tot_quad= totquad;
+
+ glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffers->index_buf);
+
+ if (totgrid * gridsize * gridsize < USHRT_MAX) {
+ buffers->index_type = GL_UNSIGNED_SHORT;
+ FILL_QUAD_BUFFER(unsigned short, totquad, buffers->index_buf);
+ }
+ else {
+ buffers->index_type = GL_UNSIGNED_INT;
+ FILL_QUAD_BUFFER(unsigned int, totquad, buffers->index_buf);
+ }
+
+ glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
+ }
+
+ buffers->has_hidden = 1;
+ }
/* Build coord/normal VBO */
- if(buffers->index_buf)
+ if (buffers->index_buf)
glGenBuffersARB(1, &buffers->vert_buf);
return buffers;
@@ -1552,15 +1647,18 @@ static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers, int smooth)
const MVert *mvert = buffers->mvert;
int i, j;
- for(i = 0; i < buffers->totface; ++i) {
+ for (i = 0; i < buffers->totface; ++i) {
MFace *f = buffers->mface + buffers->face_indices[i];
int S = f->v4 ? 4 : 3;
unsigned int *fv = &f->v1;
+ if (paint_is_face_hidden(f, buffers->mvert))
+ continue;
+
glBegin((f->v4)? GL_QUADS: GL_TRIANGLES);
- if(smooth) {
- for(j = 0; j < S; j++) {
+ if (smooth) {
+ for (j = 0; j < S; j++) {
glNormal3sv(mvert[fv[j]].no);
glVertex3fv(mvert[fv[j]].co);
}
@@ -1569,7 +1667,7 @@ static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers, int smooth)
float fno[3];
/* calculate face normal */
- if(f->v4) {
+ if (f->v4) {
normal_quad_v3(fno, mvert[fv[0]].co, mvert[fv[1]].co,
mvert[fv[2]].co, mvert[fv[3]].co);
}
@@ -1577,7 +1675,7 @@ static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers, int smooth)
normal_tri_v3(fno, mvert[fv[0]].co, mvert[fv[1]].co, mvert[fv[2]].co);
glNormal3fv(fno);
- for(j = 0; j < S; j++)
+ for (j = 0; j < S; j++)
glVertex3fv(mvert[fv[j]].co);
}
@@ -1587,17 +1685,56 @@ static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers, int smooth)
static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers, int smooth)
{
- int i, x, y, gridsize = buffers->gridsize;
+ int i, j, x, y, gridsize = buffers->gridsize;
- if(smooth) {
- for(i = 0; i < buffers->totgrid; ++i) {
- DMGridData *grid = buffers->grids[buffers->grid_indices[i]];
+ for (i = 0; i < buffers->totgrid; ++i) {
+ int g = buffers->grid_indices[i];
+ const DMGridData *grid = buffers->grids[g];
+ BLI_bitmap gh = buffers->grid_hidden[g];
- for(y = 0; y < gridsize-1; y++) {
+ /* TODO: could use strips with hiding as well */
+
+ if (gh) {
+ glBegin(GL_QUADS);
+
+ for (y = 0; y < gridsize-1; y++) {
+ for (x = 0; x < gridsize-1; x++) {
+ const DMGridData *e[4] = {
+ &grid[y*gridsize + x],
+ &grid[(y+1)*gridsize + x],
+ &grid[(y+1)*gridsize + x+1],
+ &grid[y*gridsize + x+1]
+ };
+
+ /* skip face if any of its corners are hidden */
+ if (paint_is_grid_face_hidden(gh, gridsize, x, y))
+ continue;
+
+ if (smooth) {
+ for (j = 0; j < 4; j++) {
+ glNormal3fv(e[j]->no);
+ glVertex3fv(e[j]->co);
+ }
+ }
+ else {
+ float fno[3];
+ normal_quad_v3(fno, e[0]->co, e[1]->co, e[2]->co, e[3]->co);
+ glNormal3fv(fno);
+
+ for (j = 0; j < 4; j++)
+ glVertex3fv(e[j]->co);
+ }
+ }
+ }
+
+ glEnd();
+ }
+ else if (smooth) {
+ for (y = 0; y < gridsize-1; y++) {
glBegin(GL_QUAD_STRIP);
- for(x = 0; x < gridsize; x++) {
- DMGridData *a = &grid[y*gridsize + x];
- DMGridData *b = &grid[(y+1)*gridsize + x];
+ for (x = 0; x < gridsize; x++) {
+ const DMGridData *a = &grid[y*gridsize + x];
+ const DMGridData *b = &grid[(y+1)*gridsize + x];
glNormal3fv(a->no);
glVertex3fv(a->co);
@@ -1607,20 +1744,16 @@ static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers, int smooth)
glEnd();
}
}
- }
- else {
- for(i = 0; i < buffers->totgrid; ++i) {
- DMGridData *grid = buffers->grids[buffers->grid_indices[i]];
-
- for(y = 0; y < gridsize-1; y++) {
+ else {
+ for (y = 0; y < gridsize-1; y++) {
glBegin(GL_QUAD_STRIP);
- for(x = 0; x < gridsize; x++) {
- DMGridData *a = &grid[y*gridsize + x];
- DMGridData *b = &grid[(y+1)*gridsize + x];
+ for (x = 0; x < gridsize; x++) {
+ const DMGridData *a = &grid[y*gridsize + x];
+ const DMGridData *b = &grid[(y+1)*gridsize + x];
- if(x > 0) {
- DMGridData *c = &grid[y*gridsize + x-1];
- DMGridData *d = &grid[(y+1)*gridsize + x-1];
+ if (x > 0) {
+ const DMGridData *c = &grid[y*gridsize + x-1];
+ const DMGridData *d = &grid[(y+1)*gridsize + x-1];
float fno[3];
normal_quad_v3(fno, d->co, b->co, a->co, c->co);
glNormal3fv(fno);
@@ -1639,34 +1772,34 @@ void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial)
{
int smooth = 0;
- if(buffers->totface) {
+ if (buffers->totface) {
const MFace *f = &buffers->mface[buffers->face_indices[0]];
- if(!setMaterial(f->mat_nr+1, NULL))
+ if (!setMaterial(f->mat_nr+1, NULL))
return;
smooth = f->flag & ME_SMOOTH;
glShadeModel(smooth ? GL_SMOOTH: GL_FLAT);
}
- else if(buffers->totgrid) {
+ else if (buffers->totgrid) {
const DMFlagMat *f = &buffers->grid_flag_mats[buffers->grid_indices[0]];
- if(!setMaterial(f->mat_nr+1, NULL))
+ if (!setMaterial(f->mat_nr+1, NULL))
return;
smooth = f->flag & ME_SMOOTH;
glShadeModel(smooth ? GL_SMOOTH: GL_FLAT);
}
- if(buffers->vert_buf && buffers->index_buf) {
+ if (buffers->vert_buf && buffers->index_buf) {
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffers->index_buf);
- if(buffers->tot_quad) {
+ if (buffers->tot_quad) {
unsigned offset = 0;
- int i;
- for(i = 0; i < buffers->totgrid; i++) {
+ int i, last = buffers->has_hidden ? 1 : buffers->totgrid;
+ for (i = 0; i < last; i++) {
glVertexPointer(3, GL_FLOAT, sizeof(DMGridData), offset + (char*)offsetof(DMGridData, co));
glNormalPointer(GL_FLOAT, sizeof(DMGridData), offset + (char*)offsetof(DMGridData, no));
@@ -1689,20 +1822,20 @@ void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial)
glDisableClientState(GL_NORMAL_ARRAY);
}
/* fallbacks if we are out of memory or VBO is disabled */
- else if(buffers->totface) {
+ else if (buffers->totface) {
gpu_draw_buffers_legacy_mesh(buffers, smooth);
}
- else if(buffers->totgrid) {
+ else if (buffers->totgrid) {
gpu_draw_buffers_legacy_grids(buffers, smooth);
}
}
void GPU_free_buffers(GPU_Buffers *buffers)
{
- if(buffers) {
- if(buffers->vert_buf)
+ if (buffers) {
+ if (buffers->vert_buf)
glDeleteBuffersARB(1, &buffers->vert_buf);
- if(buffers->index_buf && buffers->tot_tri)
+ if (buffers->index_buf && (buffers->tot_tri || buffers->has_hidden))
glDeleteBuffersARB(1, &buffers->index_buf);
MEM_freeN(buffers);
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 07d7568ab95..76291aef584 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -77,8 +77,8 @@ static GHash *FUNCTION_HASH= NULL;
static int gpu_str_prefix(const char *str, const char *prefix)
{
- while(*str && *prefix) {
- if(*str != *prefix)
+ while (*str && *prefix) {
+ if (*str != *prefix)
return 0;
str++;
@@ -93,11 +93,11 @@ static char *gpu_str_skip_token(char *str, char *token, int max)
int len = 0;
/* skip a variable/function name */
- while(*str) {
- if(ELEM7(*str, ' ', '(', ')', ',', '\t', '\n', '\r'))
+ while (*str) {
+ if (ELEM7(*str, ' ', '(', ')', ',', '\t', '\n', '\r'))
break;
else {
- if(token && len < max-1) {
+ if (token && len < max-1) {
*token= *str;
token++;
len++;
@@ -106,13 +106,13 @@ static char *gpu_str_skip_token(char *str, char *token, int max)
}
}
- if(token)
+ if (token)
*token= '\0';
/* skip the next special characters:
* note the missing ')' */
- while(*str) {
- if(ELEM6(*str, ' ', '(', ',', '\t', '\n', '\r'))
+ while (*str) {
+ if (ELEM6(*str, ' ', '(', ',', '\t', '\n', '\r'))
str++;
else
break;
@@ -126,38 +126,38 @@ static void gpu_parse_functions_string(GHash *hash, char *code)
GPUFunction *function;
int i, type, qual;
- while((code = strstr(code, "void "))) {
+ while ((code = strstr(code, "void "))) {
function = MEM_callocN(sizeof(GPUFunction), "GPUFunction");
code = gpu_str_skip_token(code, NULL, 0);
code = gpu_str_skip_token(code, function->name, MAX_FUNCTION_NAME);
/* get parameters */
- while(*code && *code != ')') {
+ while (*code && *code != ')') {
/* test if it's an input or output */
qual = FUNCTION_QUAL_IN;
- if(gpu_str_prefix(code, "out "))
+ if (gpu_str_prefix(code, "out "))
qual = FUNCTION_QUAL_OUT;
- if(gpu_str_prefix(code, "inout "))
+ if (gpu_str_prefix(code, "inout "))
qual = FUNCTION_QUAL_INOUT;
- if((qual != FUNCTION_QUAL_IN) || gpu_str_prefix(code, "in "))
+ if ((qual != FUNCTION_QUAL_IN) || gpu_str_prefix(code, "in "))
code = gpu_str_skip_token(code, NULL, 0);
/* test for type */
type= 0;
- for(i=1; i<=16; i++) {
- if(GPU_DATATYPE_STR[i] && gpu_str_prefix(code, GPU_DATATYPE_STR[i])) {
+ for (i=1; i<=16; i++) {
+ if (GPU_DATATYPE_STR[i] && gpu_str_prefix(code, GPU_DATATYPE_STR[i])) {
type= i;
break;
}
}
- if(!type && gpu_str_prefix(code, "sampler2DShadow"))
+ if (!type && gpu_str_prefix(code, "sampler2DShadow"))
type= GPU_SHADOW2D;
- if(!type && gpu_str_prefix(code, "sampler2D"))
+ if (!type && gpu_str_prefix(code, "sampler2D"))
type= GPU_TEX2D;
- if(type) {
+ if (type) {
/* add paramater */
code = gpu_str_skip_token(code, NULL, 0);
code = gpu_str_skip_token(code, NULL, 0);
@@ -171,7 +171,7 @@ static void gpu_parse_functions_string(GHash *hash, char *code)
}
}
- if(function->name[0] == '\0' || function->totparam == 0) {
+ if (function->name[0] == '\0' || function->totparam == 0) {
fprintf(stderr, "GPU functions parse error.\n");
MEM_freeN(function);
break;
@@ -194,27 +194,27 @@ static char *gpu_generate_function_prototyps(GHash *hash)
* generated code, to avoid have to add the actual code & recompile all */
ghi = BLI_ghashIterator_new(hash);
- for(; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)) {
+ for (; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)) {
name = BLI_ghashIterator_getValue(ghi);
function = BLI_ghashIterator_getValue(ghi);
BLI_dynstr_appendf(ds, "void %s(", name);
- for(a=0; a<function->totparam; a++) {
- if(function->paramqual[a] == FUNCTION_QUAL_OUT)
+ for (a=0; a<function->totparam; a++) {
+ if (function->paramqual[a] == FUNCTION_QUAL_OUT)
BLI_dynstr_append(ds, "out ");
- else if(function->paramqual[a] == FUNCTION_QUAL_INOUT)
+ else if (function->paramqual[a] == FUNCTION_QUAL_INOUT)
BLI_dynstr_append(ds, "inout ");
- if(function->paramtype[a] == GPU_TEX2D)
+ if (function->paramtype[a] == GPU_TEX2D)
BLI_dynstr_append(ds, "sampler2D");
- else if(function->paramtype[a] == GPU_SHADOW2D)
+ else if (function->paramtype[a] == GPU_SHADOW2D)
BLI_dynstr_append(ds, "sampler2DShadow");
else
BLI_dynstr_append(ds, GPU_DATATYPE_STR[function->paramtype[a]]);
//BLI_dynstr_appendf(ds, " param%d", a);
- if(a != function->totparam-1)
+ if (a != function->totparam-1)
BLI_dynstr_append(ds, ", ");
}
BLI_dynstr_append(ds, ");\n");
@@ -231,7 +231,7 @@ static char *gpu_generate_function_prototyps(GHash *hash)
GPUFunction *GPU_lookup_function(const char *name)
{
- if(!FUNCTION_HASH) {
+ if (!FUNCTION_HASH) {
FUNCTION_HASH = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "GPU_lookup_function gh");
gpu_parse_functions_string(FUNCTION_HASH, glsl_material_library);
/*FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH);
@@ -250,15 +250,15 @@ void GPU_codegen_exit(void)
{
extern Material defmaterial; // render module abuse...
- if(defmaterial.gpumaterial.first)
+ if (defmaterial.gpumaterial.first)
GPU_material_free(&defmaterial);
- if(FUNCTION_HASH) {
+ if (FUNCTION_HASH) {
BLI_ghash_free(FUNCTION_HASH, NULL, (GHashValFreeFP)MEM_freeN);
FUNCTION_HASH = NULL;
}
- if(glsl_material_library) {
+ if (glsl_material_library) {
MEM_freeN(glsl_material_library);
glsl_material_library = NULL;
}
@@ -324,9 +324,9 @@ static void codegen_print_datatype(DynStr *ds, int type, float *data)
BLI_dynstr_appendf(ds, "%s(", GPU_DATATYPE_STR[type]);
- for(i=0; i<type; i++) {
+ for (i=0; i<type; i++) {
BLI_dynstr_appendf(ds, "%f", data[i]);
- if(i == type-1)
+ if (i == type-1)
BLI_dynstr_append(ds, ")");
else
BLI_dynstr_append(ds, ", ");
@@ -337,7 +337,7 @@ static int codegen_input_has_texture(GPUInput *input)
{
if (input->link)
return 0;
- else if(input->ima)
+ else if (input->ima)
return 1;
else
return input->tex != NULL;
@@ -345,21 +345,21 @@ static int codegen_input_has_texture(GPUInput *input)
const char *GPU_builtin_name(GPUBuiltin builtin)
{
- if(builtin == GPU_VIEW_MATRIX)
+ if (builtin == GPU_VIEW_MATRIX)
return "unfviewmat";
- else if(builtin == GPU_OBJECT_MATRIX)
+ else if (builtin == GPU_OBJECT_MATRIX)
return "unfobmat";
- else if(builtin == GPU_INVERSE_VIEW_MATRIX)
+ else if (builtin == GPU_INVERSE_VIEW_MATRIX)
return "unfinvviewmat";
- else if(builtin == GPU_INVERSE_OBJECT_MATRIX)
+ else if (builtin == GPU_INVERSE_OBJECT_MATRIX)
return "unfinvobmat";
- else if(builtin == GPU_VIEW_POSITION)
+ else if (builtin == GPU_VIEW_POSITION)
return "varposition";
- else if(builtin == GPU_VIEW_NORMAL)
+ else if (builtin == GPU_VIEW_NORMAL)
return "varnormal";
- else if(builtin == GPU_OBCOLOR)
+ else if (builtin == GPU_OBCOLOR)
return "unfobcolor";
- else if(builtin == GPU_AUTO_BUMPSCALE)
+ else if (builtin == GPU_AUTO_BUMPSCALE)
return "unfobautobumpscale";
else
return "";
@@ -397,7 +397,7 @@ static void codegen_set_unique_ids(ListBase *nodes)
else
input->texid = GET_INT_FROM_POINTER(BLI_ghash_lookup(bindhash, input->link));
}
- else if(input->ima) {
+ else if (input->ima) {
/* input is texture from image, assign only one texid per
buffer to avoid sampling the same texture twice */
if (!BLI_ghash_haskey(bindhash, input->ima)) {
@@ -421,7 +421,7 @@ static void codegen_set_unique_ids(ListBase *nodes)
/* make sure this pixel is defined exactly once */
if (input->source == GPU_SOURCE_TEX_PIXEL) {
- if(input->ima) {
+ if (input->ima) {
if (!BLI_ghash_haskey(definehash, input->ima)) {
input->definetex = 1;
BLI_ghash_insert(definehash, input->ima, SET_INT_IN_POINTER(input->texid));
@@ -463,13 +463,13 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes)
(input->textype == GPU_TEX2D)? "sampler2D": "sampler2DShadow",
input->texid);
}
- else if(input->source == GPU_SOURCE_BUILTIN) {
+ else if (input->source == GPU_SOURCE_BUILTIN) {
/* only define each builting uniform/varying once */
- if(!(builtins & input->builtin)) {
+ if (!(builtins & input->builtin)) {
builtins |= input->builtin;
name = GPU_builtin_name(input->builtin);
- if(gpu_str_prefix(name, "unf")) {
+ if (gpu_str_prefix(name, "unf")) {
BLI_dynstr_appendf(ds, "uniform %s %s;\n",
GPU_DATATYPE_STR[input->type], name);
}
@@ -480,7 +480,7 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes)
}
}
else if (input->source == GPU_SOURCE_VEC_UNIFORM) {
- if(input->dynamicvec) {
+ if (input->dynamicvec) {
/* only create uniforms for dynamic vectors */
BLI_dynstr_appendf(ds, "uniform %s unf%d;\n",
GPU_DATATYPE_STR[input->type], input->id);
@@ -549,10 +549,10 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final
codegen_convert_datatype(ds, input->link->output->type, input->type,
"tmp", input->link->output->id);
}
- else if(input->source == GPU_SOURCE_BUILTIN)
+ else if (input->source == GPU_SOURCE_BUILTIN)
BLI_dynstr_appendf(ds, "%s", GPU_builtin_name(input->builtin));
- else if(input->source == GPU_SOURCE_VEC_UNIFORM) {
- if(input->dynamicvec)
+ else if (input->source == GPU_SOURCE_VEC_UNIFORM) {
+ if (input->dynamicvec)
BLI_dynstr_appendf(ds, "unf%d", input->id);
else
BLI_dynstr_appendf(ds, "cons%d", input->id);
@@ -631,7 +631,7 @@ static char *code_generate_vertex(ListBase *nodes)
for (node=nodes->first; node; node=node->next)
for (input=node->inputs.first; input; input=input->next)
if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
- if(input->attribtype == CD_TANGENT) { /* silly exception */
+ if (input->attribtype == CD_TANGENT) { /* silly exception */
BLI_dynstr_appendf(ds, "\tvar%d.xyz = normalize((gl_ModelViewMatrix * vec4(att%d.xyz, 0)).xyz);\n", input->attribid, input->attribid);
BLI_dynstr_appendf(ds, "\tvar%d.w = att%d.w;\n", input->attribid, input->attribid);
}
@@ -660,12 +660,12 @@ void GPU_code_generate_glsl_lib(void)
DynStr *ds;
/* only initialize the library once */
- if(glsl_material_library)
+ if (glsl_material_library)
return;
ds = BLI_dynstr_new();
- if(GPU_bicubic_bump_support()){
+ if (GPU_bicubic_bump_support()) {
BLI_dynstr_append(ds, "/* These are needed for high quality bump mapping */\n"
"#version 130\n"
"#extension GL_ARB_texture_query_lod: enable\n"
@@ -697,7 +697,7 @@ static void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes)
memset(inputs, 0, sizeof(*inputs));
- if(!shader)
+ if (!shader)
return;
GPU_shader_bind(shader);
@@ -709,7 +709,7 @@ 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 ||
+ if (input->source == GPU_SOURCE_ATTRIB ||
input->source == GPU_SOURCE_BUILTIN)
continue;
@@ -721,18 +721,18 @@ static void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes)
/* pass non-dynamic uniforms to opengl */
extract = 0;
- if(input->ima || input->tex) {
+ if (input->ima || input->tex) {
if (input->bindtex)
extract = 1;
}
- else if(input->dynamicvec)
+ else if (input->dynamicvec)
extract = 1;
- if(extract)
+ if (extract)
input->shaderloc = GPU_shader_get_uniform(shader, input->shadername);
/* extract nodes */
- if(extract) {
+ if (extract) {
BLI_remlink(&node->inputs, input);
BLI_addtail(inputs, input);
}
@@ -758,7 +758,7 @@ void GPU_pass_bind(GPUPass *pass, double time, int mipmap)
if (input->ima)
input->tex = GPU_texture_from_blender(input->ima, input->iuser, time, mipmap);
- if(input->tex && input->bindtex) {
+ if (input->tex && input->bindtex) {
GPU_texture_bind(input->tex, input->texid);
GPU_shader_uniform_texture(shader, input->shaderloc, input->tex);
}
@@ -776,7 +776,7 @@ void GPU_pass_update_uniforms(GPUPass *pass)
/* pass dynamic inputs to opengl, others were removed */
for (input=inputs->first; input; input=input->next)
- if(!(input->ima || input->tex))
+ if (!(input->ima || input->tex))
GPU_shader_uniform_vector(shader, input->shaderloc, input->type, 1,
input->dynamicvec);
}
@@ -791,7 +791,7 @@ void GPU_pass_unbind(GPUPass *pass)
return;
for (input=inputs->first; input; input=input->next) {
- if(input->tex && input->bindtex)
+ if (input->tex && input->bindtex)
GPU_texture_unbind(input->tex);
if (input->ima)
@@ -848,14 +848,14 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
GPUNode *outnode;
const char *name;
- if(link->output) {
+ if (link->output) {
outnode = link->output->node;
name = outnode->name;
- if(strcmp(name, "set_value")==0 || strcmp(name, "set_rgb")==0) {
+ if (strcmp(name, "set_value")==0 || strcmp(name, "set_rgb")==0) {
input = MEM_dupallocN(outnode->inputs.first);
input->type = type;
- if(input->link)
+ if (input->link)
input->link->users++;
BLI_addtail(&node->inputs, input);
return;
@@ -865,7 +865,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
input = MEM_callocN(sizeof(GPUInput), "GPUInput");
input->node = node;
- if(link->builtin) {
+ if (link->builtin) {
/* builtin uniform */
input->type = type;
input->source = GPU_SOURCE_BUILTIN;
@@ -873,14 +873,14 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
MEM_freeN(link);
}
- else if(link->output) {
+ else if (link->output) {
/* link to a node output */
input->type = type;
input->source = GPU_SOURCE_TEX_PIXEL;
input->link = link;
link->users++;
}
- else if(link->dynamictex) {
+ else if (link->dynamictex) {
/* dynamic texture, GPUTexture is updated/deleted externally */
input->type = type;
input->source = GPU_SOURCE_TEX;
@@ -892,7 +892,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
input->dynamicdata = link->ptr2;
MEM_freeN(link);
}
- else if(link->texture) {
+ else if (link->texture) {
/* small texture created on the fly, like for colorbands */
input->type = GPU_VEC4;
input->source = GPU_SOURCE_TEX;
@@ -905,7 +905,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
MEM_freeN(link->ptr1);
MEM_freeN(link);
}
- else if(link->image) {
+ else if (link->image) {
/* blender image */
input->type = GPU_VEC4;
input->source = GPU_SOURCE_TEX;
@@ -916,7 +916,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
input->textype = GPU_TEX2D;
MEM_freeN(link);
}
- else if(link->attribtype) {
+ else if (link->attribtype) {
/* vertex attribute */
input->type = type;
input->source = GPU_SOURCE_ATTRIB;
@@ -931,7 +931,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
input->source = GPU_SOURCE_VEC_UNIFORM;
memcpy(input->vec, link->ptr1, type*sizeof(float));
- if(link->dynamic) {
+ if (link->dynamic) {
input->dynamicvec= link->ptr1;
input->dynamictype= link->dynamictype;
input->dynamicdata= link->ptr2;
@@ -946,7 +946,7 @@ static void gpu_node_input_socket(GPUNode *node, GPUNodeStack *sock)
{
GPUNodeLink *link;
- if(sock->link) {
+ if (sock->link) {
gpu_node_input_link(node, sock->link, sock->type);
}
else {
@@ -979,10 +979,10 @@ static void GPU_inputs_free(ListBase *inputs)
{
GPUInput *input;
- for(input=inputs->first; input; input=input->next) {
- if(input->link)
+ for (input=inputs->first; input; input=input->next) {
+ if (input->link)
GPU_node_link_free(input->link);
- else if(input->tex && !input->dynamictex)
+ else if (input->tex && !input->dynamictex)
GPU_texture_free(input->tex);
}
@@ -1029,16 +1029,16 @@ static void gpu_nodes_get_vertex_attributes(ListBase *nodes, GPUVertexAttribs *a
memset(attribs, 0, sizeof(*attribs));
- for(node=nodes->first; node; node=node->next) {
- for(input=node->inputs.first; input; input=input->next) {
- if(input->source == GPU_SOURCE_ATTRIB) {
- for(a=0; a<attribs->totlayer; a++) {
- if(attribs->layer[a].type == input->attribtype &&
+ for (node=nodes->first; node; node=node->next) {
+ for (input=node->inputs.first; input; input=input->next) {
+ 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)
break;
}
- if(a == attribs->totlayer && a < GPU_MAX_ATTRIB) {
+ if (a == attribs->totlayer && a < GPU_MAX_ATTRIB) {
input->attribid = attribs->totlayer++;
input->attribfirst = 1;
@@ -1061,9 +1061,9 @@ static void gpu_nodes_get_builtin_flag(ListBase *nodes, int *builtin)
*builtin= 0;
- for(node=nodes->first; node; node=node->next)
- for(input=node->inputs.first; input; input=input->next)
- if(input->source == GPU_SOURCE_BUILTIN)
+ for (node=nodes->first; node; node=node->next)
+ for (input=node->inputs.first; input; input=input->next)
+ if (input->source == GPU_SOURCE_BUILTIN)
*builtin |= input->builtin;
}
@@ -1163,7 +1163,7 @@ int GPU_link(GPUMaterial *mat, const char *name, ...)
int i;
function = GPU_lookup_function(name);
- if(!function) {
+ if (!function) {
fprintf(stderr, "GPU failed to find function %s\n", name);
return 0;
}
@@ -1171,8 +1171,8 @@ int GPU_link(GPUMaterial *mat, const char *name, ...)
node = GPU_node_begin(name);
va_start(params, name);
- for(i=0; i<function->totparam; i++) {
- if(function->paramqual[i] != FUNCTION_QUAL_IN) {
+ for (i=0; i<function->totparam; i++) {
+ if (function->paramqual[i] != FUNCTION_QUAL_IN) {
linkptr= va_arg(params, GPUNodeLink**);
GPU_node_output(node, function->paramtype[i], "", linkptr);
}
@@ -1199,7 +1199,7 @@ int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNode
int i, totin, totout;
function = GPU_lookup_function(name);
- if(!function) {
+ if (!function) {
fprintf(stderr, "GPU failed to find function %s\n", name);
return 0;
}
@@ -1208,24 +1208,24 @@ int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNode
totin = 0;
totout = 0;
- if(in) {
- for(i = 0; in[i].type != GPU_NONE; i++) {
+ if (in) {
+ for (i = 0; in[i].type != GPU_NONE; i++) {
gpu_node_input_socket(node, &in[i]);
totin++;
}
}
- if(out) {
- for(i = 0; out[i].type != GPU_NONE; i++) {
+ if (out) {
+ for (i = 0; out[i].type != GPU_NONE; i++) {
GPU_node_output(node, out[i].type, out[i].name, &out[i].link);
totout++;
}
}
va_start(params, out);
- for(i=0; i<function->totparam; i++) {
- if(function->paramqual[i] != FUNCTION_QUAL_IN) {
- if(totout == 0) {
+ for (i=0; i<function->totparam; i++) {
+ if (function->paramqual[i] != FUNCTION_QUAL_IN) {
+ if (totout == 0) {
linkptr= va_arg(params, GPUNodeLink**);
GPU_node_output(node, function->paramtype[i], "", linkptr);
}
@@ -1233,9 +1233,9 @@ int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNode
totout--;
}
else {
- if(totin == 0) {
+ if (totin == 0) {
link= va_arg(params, GPUNodeLink*);
- if(link->socket)
+ if (link->socket)
gpu_node_input_socket(node, link->socket);
else
gpu_node_input_link(node, link, function->paramtype[i]);
@@ -1259,11 +1259,11 @@ int GPU_link_changed(GPUNodeLink *link)
GPUInput *input;
const char *name;
- if(link->output) {
+ if (link->output) {
node = link->output->node;
name = node->name;
- if(strcmp(name, "set_value")==0 || strcmp(name, "set_rgb")==0) {
+ if (strcmp(name, "set_value")==0 || strcmp(name, "set_rgb")==0) {
input = node->inputs.first;
return (input->link != NULL);
}
@@ -1281,16 +1281,16 @@ static void gpu_nodes_tag(GPUNodeLink *link)
GPUNode *node;
GPUInput *input;
- if(!link->output)
+ if (!link->output)
return;
node = link->output->node;
- if(node->tag)
+ if (node->tag)
return;
node->tag= 1;
- for(input=node->inputs.first; input; input=input->next)
- if(input->link)
+ for (input=node->inputs.first; input; input=input->next)
+ if (input->link)
gpu_nodes_tag(input->link);
}
@@ -1298,15 +1298,15 @@ static void gpu_nodes_prune(ListBase *nodes, GPUNodeLink *outlink)
{
GPUNode *node, *next;
- for(node=nodes->first; node; node=node->next)
+ for (node=nodes->first; node; node=node->next)
node->tag= 0;
gpu_nodes_tag(outlink);
- for(node=nodes->first; node; node=next) {
+ for (node=nodes->first; node; node=next) {
next = node->next;
- if(!node->tag) {
+ if (!node->tag) {
BLI_remlink(nodes, node);
GPU_node_free(node);
}
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index a5d6c374a42..01f000e3314 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -154,28 +154,28 @@ void GPU_render_text(MTFace *tface, int mode,
uv[2][1] = (tface->uv[2][1] - centery) * sizey + transy;
glBegin(GL_POLYGON);
- if(glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[0]);
+ if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[0]);
else glTexCoord2fv(uv[0]);
- if(col) gpu_mcol(col[0]);
+ if (col) gpu_mcol(col[0]);
glVertex3f(sizex * v1[0] + movex, sizey * v1[1] + movey, v1[2]);
- if(glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[1]);
+ if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[1]);
else glTexCoord2fv(uv[1]);
- if(col) gpu_mcol(col[1]);
+ if (col) gpu_mcol(col[1]);
glVertex3f(sizex * v2[0] + movex, sizey * v2[1] + movey, v2[2]);
- if(glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[2]);
+ if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[2]);
else glTexCoord2fv(uv[2]);
- if(col) gpu_mcol(col[2]);
+ if (col) gpu_mcol(col[2]);
glVertex3f(sizex * v3[0] + movex, sizey * v3[1] + movey, v3[2]);
- if(v4) {
+ if (v4) {
uv[3][0] = (tface->uv[3][0] - centerx) * sizex + transx;
uv[3][1] = (tface->uv[3][1] - centery) * sizey + transy;
- if(glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[3]);
+ if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[3]);
else glTexCoord2fv(uv[3]);
- if(col) gpu_mcol(col[3]);
+ if (col) gpu_mcol(col[3]);
glVertex3f(sizex * v4[0] + movex, sizey * v4[1] + movey, v4[2]);
}
glEnd();
@@ -263,16 +263,16 @@ static GLenum gpu_get_mipmap_filter(int mag)
{
/* linearmipmap is off by default *when mipmapping is off,
* use unfiltered display */
- if(mag) {
- if(GTS.linearmipmap || GTS.domipmap)
+ if (mag) {
+ if (GTS.linearmipmap || GTS.domipmap)
return GL_LINEAR;
else
return GL_NEAREST;
}
else {
- if(GTS.linearmipmap)
+ if (GTS.linearmipmap)
return GL_LINEAR_MIPMAP_LINEAR;
- else if(GTS.domipmap)
+ else if (GTS.domipmap)
return GL_LINEAR_MIPMAP_NEAREST;
else
return GL_NEAREST;
@@ -305,10 +305,10 @@ static void gpu_make_repbind(Image *ima)
ImBuf *ibuf;
ibuf = BKE_image_get_ibuf(ima, NULL);
- if(ibuf==NULL)
+ if (ibuf==NULL)
return;
- if(ima->repbind) {
+ if (ima->repbind) {
glDeleteTextures(ima->totbind, (GLuint *)ima->repbind);
MEM_freeN(ima->repbind);
ima->repbind= NULL;
@@ -317,19 +317,19 @@ static void gpu_make_repbind(Image *ima)
ima->totbind= ima->xrep*ima->yrep;
- if(ima->totbind>1)
+ if (ima->totbind>1)
ima->repbind= MEM_callocN(sizeof(int)*ima->totbind, "repbind");
}
static void gpu_clear_tpage(void)
{
- if(GTS.lasttface==NULL)
+ if (GTS.lasttface==NULL)
return;
GTS.lasttface= NULL;
GTS.curtile= 0;
GTS.curima= NULL;
- if(GTS.curtilemode!=0) {
+ if (GTS.curtilemode!=0) {
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
@@ -348,17 +348,17 @@ static void gpu_clear_tpage(void)
static void gpu_set_alpha_blend(GPUBlendMode alphablend)
{
- if(alphablend == GPU_BLEND_SOLID) {
+ if (alphablend == GPU_BLEND_SOLID) {
glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
- else if(alphablend==GPU_BLEND_ADD) {
+ else if (alphablend==GPU_BLEND_ADD) {
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
glDisable(GL_ALPHA_TEST);
}
- else if(ELEM(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ALPHA_SORT)) {
+ else if (ELEM(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ALPHA_SORT)) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -366,7 +366,7 @@ static void gpu_set_alpha_blend(GPUBlendMode alphablend)
* turn off alpha test in this case */
/* added after 2.45 to clip alpha */
- if(U.glalphaclip == 1.0f) {
+ if (U.glalphaclip == 1.0f) {
glDisable(GL_ALPHA_TEST);
}
else {
@@ -374,7 +374,7 @@ static void gpu_set_alpha_blend(GPUBlendMode alphablend)
glAlphaFunc(GL_GREATER, U.glalphaclip);
}
}
- else if(alphablend==GPU_BLEND_CLIP) {
+ else if (alphablend==GPU_BLEND_CLIP) {
glDisable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5f);
@@ -384,7 +384,7 @@ static void gpu_set_alpha_blend(GPUBlendMode alphablend)
static void gpu_verify_alpha_blend(int alphablend)
{
/* verify alpha blending modes */
- if(GTS.alphablend == alphablend)
+ if (GTS.alphablend == alphablend)
return;
gpu_set_alpha_blend(alphablend);
@@ -427,83 +427,83 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
GTS.tileYRep = 0;
/* setting current tile according to frame */
- if(ima && (ima->tpageflag & IMA_TWINANIM))
+ if (ima && (ima->tpageflag & IMA_TWINANIM))
GTS.tile= ima->lastframe;
else
GTS.tile= tftile;
GTS.tile = MAX2(0, GTS.tile);
- if(ima) {
+ if (ima) {
GTS.tileXRep = ima->xrep;
GTS.tileYRep = ima->yrep;
}
/* if same image & tile, we're done */
- if(compare && ima == GTS.curima && GTS.curtile == GTS.tile &&
+ if (compare && ima == GTS.curima && GTS.curtile == GTS.tile &&
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 ||
+ if (GTS.tilemode!=GTS.curtilemode || GTS.curtileXRep!=GTS.tileXRep ||
GTS.curtileYRep != GTS.tileYRep) {
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
- if(ima && (ima->tpageflag & IMA_TILES))
+ if (ima && (ima->tpageflag & IMA_TILES))
glScalef(ima->xrep, ima->yrep, 1.0);
glMatrixMode(GL_MODELVIEW);
}
/* check if we have a valid image */
- if(ima==NULL || ima->ok==0)
+ if (ima==NULL || ima->ok==0)
return 0;
/* check if we have a valid image buffer */
ibuf= BKE_image_get_ibuf(ima, iuser);
- if(ibuf==NULL)
+ if (ibuf==NULL)
return 0;
- if(ibuf->rect_float) {
- if(U.use_16bit_textures) {
+ if (ibuf->rect_float) {
+ if (U.use_16bit_textures) {
/* use high precision textures. This is relatively harmless because OpenGL gives us
* a high precision format only if it is available */
use_high_bit_depth = TRUE;
}
/* TODO unneeded when float images are correctly treated as linear always */
- if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
+ if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
do_color_management = TRUE;
- if(ibuf->rect==NULL)
+ if (ibuf->rect==NULL)
IMB_rect_from_float(ibuf);
}
/* currently, tpage refresh is used by ima sequences */
- if(ima->tpageflag & IMA_TPAGE_REFRESH) {
+ if (ima->tpageflag & IMA_TPAGE_REFRESH) {
GPU_free_image(ima);
ima->tpageflag &= ~IMA_TPAGE_REFRESH;
}
- if(GTS.tilemode) {
+ if (GTS.tilemode) {
/* tiled mode */
- if(ima->repbind==NULL) gpu_make_repbind(ima);
- if(GTS.tile>=ima->totbind) GTS.tile= 0;
+ if (ima->repbind==NULL) gpu_make_repbind(ima);
+ if (GTS.tile>=ima->totbind) GTS.tile= 0;
/* this happens when you change repeat buttons */
- if(ima->repbind) bind= &ima->repbind[GTS.tile];
+ if (ima->repbind) bind= &ima->repbind[GTS.tile];
else bind= &ima->bindcode;
- if(*bind==0) {
+ if (*bind==0) {
texwindx= ibuf->x/ima->xrep;
texwindy= ibuf->y/ima->yrep;
- if(GTS.tile>=ima->xrep*ima->yrep)
+ if (GTS.tile>=ima->xrep*ima->yrep)
GTS.tile= ima->xrep*ima->yrep-1;
texwinsy= GTS.tile / ima->xrep;
@@ -515,8 +515,8 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
tpx= texwindx;
tpy= texwindy;
- if(use_high_bit_depth) {
- if(do_color_management) {
+ if (use_high_bit_depth) {
+ if (do_color_management) {
srgb_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(float)*4, "floar_buf_col_cor");
IMB_buffer_float_from_float(srgb_frect, ibuf->rect_float,
ibuf->channels, IB_PROFILE_SRGB, ibuf->profile, 0,
@@ -536,12 +536,12 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
/* regular image mode */
bind= &ima->bindcode;
- if(*bind==0) {
+ if (*bind==0) {
tpx= ibuf->x;
tpy= ibuf->y;
rect= ibuf->rect;
- if(use_high_bit_depth) {
- if(do_color_management) {
+ if (use_high_bit_depth) {
+ if (do_color_management) {
frect = srgb_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(*srgb_frect)*4, "floar_buf_col_cor");
IMB_buffer_float_from_float(srgb_frect, ibuf->rect_float,
ibuf->channels, IB_PROFILE_SRGB, ibuf->profile, 0,
@@ -555,7 +555,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
}
}
- if(*bind != 0) {
+ if (*bind != 0) {
/* enable opengl drawing with textures */
glBindTexture(GL_TEXTURE_2D, *bind);
return *bind;
@@ -566,7 +566,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
/* for tiles, copy only part of image into buffer */
if (GTS.tilemode) {
- if(use_high_bit_depth) {
+ if (use_high_bit_depth) {
float *frectrow, *ftilerectrow;
ftilerect= MEM_mallocN(rectw*recth*sizeof(*ftilerect), "tilerect");
@@ -602,7 +602,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
rectw= smaller_pow2_limit(rectw);
recth= smaller_pow2_limit(recth);
- if(use_high_bit_depth) {
+ if (use_high_bit_depth) {
fscalerect= MEM_mallocN(rectw*recth*sizeof(*fscalerect)*4, "fscalerect");
gluScaleImage(GL_RGBA, tpx, tpy, GL_FLOAT, frect, rectw, recth, GL_FLOAT, fscalerect);
@@ -621,7 +621,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
glBindTexture( GL_TEXTURE_2D, *bind);
if (!(gpu_get_mipmap() && mipmap)) {
- if(use_high_bit_depth)
+ if (use_high_bit_depth)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, rectw, recth, 0, GL_RGBA, GL_FLOAT, frect);
else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
@@ -629,7 +629,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
}
else {
- if(use_high_bit_depth)
+ if (use_high_bit_depth)
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA16, rectw, recth, GL_RGBA, GL_FLOAT, frect);
else
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect);
@@ -677,7 +677,7 @@ int GPU_set_tpage(MTFace *tface, int mipmap, int alphablend)
Image *ima;
/* check if we need to clear the state */
- if(tface==NULL) {
+ if (tface==NULL) {
gpu_clear_tpage();
return 0;
}
@@ -688,7 +688,7 @@ int GPU_set_tpage(MTFace *tface, int mipmap, int alphablend)
gpu_verify_alpha_blend(alphablend);
gpu_verify_reflection(ima);
- if(GPU_verify_image(ima, NULL, tface->tile, 1, mipmap)) {
+ if (GPU_verify_image(ima, NULL, tface->tile, 1, mipmap)) {
GTS.curtile= GTS.tile;
GTS.curima= GTS.ima;
GTS.curtilemode= GTS.tilemode;
@@ -725,13 +725,13 @@ void GPU_paint_set_mipmap(int mipmap)
{
Image* ima;
- if(!GTS.domipmap)
+ if (!GTS.domipmap)
return;
- if(mipmap) {
- for(ima=G.main->image.first; ima; ima=ima->id.next) {
- if(ima->bindcode) {
- if(ima->tpageflag & IMA_MIPMAP_COMPLETE) {
+ if (mipmap) {
+ for (ima=G.main->image.first; ima; ima=ima->id.next) {
+ if (ima->bindcode) {
+ if (ima->tpageflag & IMA_MIPMAP_COMPLETE) {
glBindTexture(GL_TEXTURE_2D, ima->bindcode);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
@@ -745,8 +745,8 @@ void GPU_paint_set_mipmap(int mipmap)
}
else {
- for(ima=G.main->image.first; ima; ima=ima->id.next) {
- if(ima->bindcode) {
+ for (ima=G.main->image.first; ima; ima=ima->id.next) {
+ if (ima->bindcode) {
glBindTexture(GL_TEXTURE_2D, ima->bindcode);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
@@ -779,7 +779,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skip_rows);
/* if color correction is needed, we must update the part that needs updating. */
- if(ibuf->rect_float && (!U.use_16bit_textures || (ibuf->profile == IB_PROFILE_LINEAR_RGB))) {
+ if (ibuf->rect_float && (!U.use_16bit_textures || (ibuf->profile == IB_PROFILE_LINEAR_RGB))) {
float *buffer = MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf");
IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h);
@@ -789,7 +789,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
MEM_freeN(buffer);
- if(ima->tpageflag & IMA_MIPMAP_COMPLETE)
+ if (ima->tpageflag & IMA_MIPMAP_COMPLETE)
ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
return;
@@ -801,7 +801,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
glPixelStorei(GL_UNPACK_SKIP_PIXELS, x);
glPixelStorei(GL_UNPACK_SKIP_ROWS, y);
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA,
GL_FLOAT, ibuf->rect_float);
else
@@ -812,7 +812,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
glPixelStorei(GL_UNPACK_SKIP_PIXELS, skip_pixels);
glPixelStorei(GL_UNPACK_SKIP_ROWS, skip_rows);
- if(ima->tpageflag & IMA_MIPMAP_COMPLETE)
+ if (ima->tpageflag & IMA_MIPMAP_COMPLETE)
ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
}
}
@@ -821,15 +821,15 @@ void GPU_update_images_framechange(void)
{
Image *ima;
- for(ima=G.main->image.first; ima; ima=ima->id.next) {
- if(ima->tpageflag & IMA_TWINANIM) {
- if(ima->twend >= ima->xrep*ima->yrep)
+ for (ima=G.main->image.first; ima; ima=ima->id.next) {
+ if (ima->tpageflag & IMA_TWINANIM) {
+ if (ima->twend >= ima->xrep*ima->yrep)
ima->twend= ima->xrep*ima->yrep-1;
/* check: is bindcode not in the array? free. (to do) */
ima->lastframe++;
- if(ima->lastframe > ima->twend)
+ if (ima->lastframe > ima->twend)
ima->lastframe= ima->twsta;
}
}
@@ -850,8 +850,8 @@ int GPU_update_image_time(Image *ima, double time)
if (ima->lastupdate > (float)time)
ima->lastupdate=(float)time;
- if(ima->tpageflag & IMA_TWINANIM) {
- if(ima->twend >= ima->xrep*ima->yrep) ima->twend= ima->xrep*ima->yrep-1;
+ if (ima->tpageflag & IMA_TWINANIM) {
+ if (ima->twend >= ima->xrep*ima->yrep) ima->twend= ima->xrep*ima->yrep-1;
/* check: is the bindcode not in the array? Then free. (still to do) */
@@ -862,8 +862,8 @@ int GPU_update_image_time(Image *ima, double time)
newframe = ima->lastframe+inc;
- if(newframe > (int)ima->twend) {
- if(ima->twend-ima->twsta != 0)
+ if (newframe > (int)ima->twend) {
+ if (ima->twend-ima->twsta != 0)
newframe = (int)ima->twsta-1 + (newframe-ima->twend)%(ima->twend-ima->twsta);
else
newframe = ima->twsta;
@@ -878,12 +878,12 @@ int GPU_update_image_time(Image *ima, double time)
void GPU_free_smoke(SmokeModifierData *smd)
{
- if(smd->type & MOD_SMOKE_TYPE_DOMAIN && smd->domain) {
- if(smd->domain->tex)
+ if (smd->type & MOD_SMOKE_TYPE_DOMAIN && smd->domain) {
+ if (smd->domain->tex)
GPU_texture_free(smd->domain->tex);
smd->domain->tex = NULL;
- if(smd->domain->tex_shadow)
+ if (smd->domain->tex_shadow)
GPU_texture_free(smd->domain->tex_shadow);
smd->domain->tex_shadow = NULL;
}
@@ -892,9 +892,9 @@ void GPU_free_smoke(SmokeModifierData *smd)
void GPU_create_smoke(SmokeModifierData *smd, int highres)
{
#ifdef WITH_SMOKE
- if(smd->type & MOD_SMOKE_TYPE_DOMAIN && !smd->domain->tex && !highres)
+ if (smd->type & MOD_SMOKE_TYPE_DOMAIN && !smd->domain->tex && !highres)
smd->domain->tex = GPU_texture_create_3D(smd->domain->res[0], smd->domain->res[1], smd->domain->res[2], smoke_get_density(smd->domain->fluid));
- else if(smd->type & MOD_SMOKE_TYPE_DOMAIN && !smd->domain->tex && highres)
+ else if (smd->type & MOD_SMOKE_TYPE_DOMAIN && !smd->domain->tex && highres)
smd->domain->tex = GPU_texture_create_3D(smd->domain->res_wt[0], smd->domain->res_wt[1], smd->domain->res_wt[2], smoke_turbulence_get_density(smd->domain->wt));
smd->domain->tex_shadow = GPU_texture_create_3D(smd->domain->res[0], smd->domain->res[1], smd->domain->res[2], smd->domain->shadow);
@@ -920,13 +920,13 @@ void GPU_free_unused_buffers(void)
{
Image *ima;
- if(!BLI_thread_is_main())
+ if (!BLI_thread_is_main())
return;
BLI_lock_thread(LOCK_OPENGL);
/* images */
- for(ima=image_free_queue.first; ima; ima=ima->id.next)
+ for (ima=image_free_queue.first; ima; ima=ima->id.next)
GPU_free_image(ima);
BLI_freelistN(&image_free_queue);
@@ -940,25 +940,25 @@ void GPU_free_unused_buffers(void)
void GPU_free_image(Image *ima)
{
- if(!BLI_thread_is_main()) {
+ if (!BLI_thread_is_main()) {
gpu_queue_image_for_free(ima);
return;
}
/* free regular image binding */
- if(ima->bindcode) {
+ if (ima->bindcode) {
glDeleteTextures(1, (GLuint *)&ima->bindcode);
ima->bindcode= 0;
}
/* free glsl image binding */
- if(ima->gputexture) {
+ if (ima->gputexture) {
GPU_texture_free(ima->gputexture);
ima->gputexture= NULL;
}
/* free repeated image binding */
- if(ima->repbind) {
+ if (ima->repbind) {
glDeleteTextures(ima->totbind, (GLuint *)ima->repbind);
MEM_freeN(ima->repbind);
@@ -972,8 +972,8 @@ void GPU_free_images(void)
{
Image* ima;
- if(G.main)
- for(ima=G.main->image.first; ima; ima=ima->id.next)
+ if (G.main)
+ for (ima=G.main->image.first; ima; ima=ima->id.next)
GPU_free_image(ima);
}
@@ -982,9 +982,9 @@ void GPU_free_images_anim(void)
{
Image* ima;
- if(G.main)
- for(ima=G.main->image.first; ima; ima=ima->id.next)
- if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
+ if (G.main)
+ for (ima=G.main->image.first; ima; ima=ima->id.next)
+ if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
GPU_free_image(ima);
}
@@ -1025,11 +1025,11 @@ static struct GPUMaterialState {
/* fixed function material, alpha handed by caller */
static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, const int gamma, const Object *ob, const int new_shading_nodes)
{
- if(new_shading_nodes || bmat->mode & MA_SHLESS) {
+ if (new_shading_nodes || bmat->mode & MA_SHLESS) {
copy_v3_v3(smat->diff, &bmat->r);
smat->diff[3]= 1.0;
- if(gamma)
+ if (gamma)
linearrgb_to_srgb_v3_v3(smat->diff, smat->diff);
zero_v4(smat->spec);
@@ -1039,14 +1039,14 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat,
mul_v3_v3fl(smat->diff, &bmat->r, bmat->ref + bmat->emit);
smat->diff[3]= 1.0; /* caller may set this to bmat->alpha */
- if(bmat->shade_flag & MA_OBCOLOR)
+ if (bmat->shade_flag & MA_OBCOLOR)
mul_v3_v3(smat->diff, ob->col);
mul_v3_v3fl(smat->spec, &bmat->specr, bmat->spec);
smat->spec[3]= 1.0; /* always 1 */
smat->hard= CLAMPIS(bmat->har, 0, 128);
- if(gamma) {
+ if (gamma) {
linearrgb_to_srgb_v3_v3(smat->diff, smat->diff);
linearrgb_to_srgb_v3_v3(smat->spec, smat->spec);
}
@@ -1055,10 +1055,10 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat,
static Material *gpu_active_node_material(Material *ma)
{
- if(ma && ma->use_nodes && ma->nodetree) {
+ if (ma && ma->use_nodes && ma->nodetree) {
bNode *node= nodeGetActiveID(ma->nodetree, ID_MA);
- if(node)
+ if (node)
return (Material *)node->id;
else
return NULL;
@@ -1096,10 +1096,10 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
* for solid we don't use transparency at all. */
GMS.use_alpha_pass = (do_alpha_after != NULL);
GMS.is_alpha_pass = (v3d && v3d->transp);
- if(GMS.use_alpha_pass)
+ if (GMS.use_alpha_pass)
*do_alpha_after = 0;
- if(GMS.totmat > FIXEDMAT) {
+ if (GMS.totmat > FIXEDMAT) {
GMS.matbuf= MEM_callocN(sizeof(GPUMaterialFixed)*GMS.totmat, "GMS.matbuf");
GMS.gmatbuf= MEM_callocN(sizeof(*GMS.gmatbuf)*GMS.totmat, "GMS.matbuf");
GMS.alphablend= MEM_callocN(sizeof(*GMS.alphablend)*GMS.totmat, "GMS.matbuf");
@@ -1111,13 +1111,13 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
}
/* no materials assigned? */
- if(ob->totcol==0) {
+ if (ob->totcol==0) {
gpu_material_to_fixed(&GMS.matbuf[0], &defmaterial, 0, ob, new_shading_nodes);
/* do material 1 too, for displists! */
memcpy(&GMS.matbuf[1], &GMS.matbuf[0], sizeof(GPUMaterialFixed));
- if(glsl) {
+ if (glsl) {
GMS.gmatbuf[0]= &defmaterial;
GPU_material_from_blender(GMS.gscene, &defmaterial);
}
@@ -1126,16 +1126,16 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
}
/* setup materials */
- for(a=1; a<=ob->totcol; a++) {
+ for (a=1; a<=ob->totcol; a++) {
/* find a suitable material */
ma= give_current_material(ob, a);
- if(!glsl && !new_shading_nodes) ma= gpu_active_node_material(ma);
- if(ma==NULL) ma= &defmaterial;
+ if (!glsl && !new_shading_nodes) ma= gpu_active_node_material(ma);
+ if (ma==NULL) ma= &defmaterial;
/* create glsl material if requested */
gpumat = (glsl)? GPU_material_from_blender(GMS.gscene, ma): NULL;
- if(gpumat) {
+ if (gpumat) {
/* do glsl only if creating it succeed, else fallback */
GMS.gmatbuf[a]= ma;
alphablend = GPU_material_alpha_blend(gpumat, ob->col);
@@ -1144,7 +1144,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
/* fixed function opengl materials */
gpu_material_to_fixed(&GMS.matbuf[a], ma, gamma, ob, new_shading_nodes);
- if(GMS.use_alpha_pass) {
+ if (GMS.use_alpha_pass) {
GMS.matbuf[a].diff[3]= ma->alpha;
alphablend = (ma->alpha == 1.0f)? GPU_BLEND_SOLID: GPU_BLEND_ALPHA;
}
@@ -1156,8 +1156,8 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
/* setting do_alpha_after = 1 indicates this object needs to be
* drawn in a second alpha pass for improved blending */
- if(do_alpha_after && !GMS.is_alpha_pass)
- if(ELEM3(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT))
+ if (do_alpha_after && !GMS.is_alpha_pass)
+ if (ELEM3(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT))
*do_alpha_after= 1;
GMS.alphablend[a]= alphablend;
@@ -1174,7 +1174,7 @@ int GPU_enable_material(int nr, void *attribs)
GPUBlendMode alphablend;
/* no GPU_begin_object_materials, use default material */
- if(!GMS.matbuf) {
+ if (!GMS.matbuf) {
float diff[4], spec[4];
memset(&GMS, 0, sizeof(GMS));
@@ -1193,19 +1193,19 @@ int GPU_enable_material(int nr, void *attribs)
}
/* prevent index to use un-initialized array items */
- if(nr>=GMS.totmat)
+ if (nr>=GMS.totmat)
nr= 0;
- if(gattribs)
+ if (gattribs)
memset(gattribs, 0, sizeof(*gattribs));
/* keep current material */
- if(nr==GMS.lastmatnr)
+ if (nr==GMS.lastmatnr)
return GMS.lastretval;
/* unbind glsl material */
- if(GMS.gboundmat) {
- if(GMS.is_alpha_pass) glDepthMask(0);
+ if (GMS.gboundmat) {
+ if (GMS.is_alpha_pass) glDepthMask(0);
GPU_material_unbind(GPU_material_from_blender(GMS.gscene, GMS.gboundmat));
GMS.gboundmat= NULL;
}
@@ -1214,19 +1214,19 @@ int GPU_enable_material(int nr, void *attribs)
GMS.lastmatnr = nr;
GMS.lastretval = 1;
- if(GMS.use_alpha_pass) {
+ if (GMS.use_alpha_pass) {
GMS.lastretval = ELEM(GMS.alphablend[nr], GPU_BLEND_SOLID, GPU_BLEND_CLIP);
- if(GMS.is_alpha_pass)
+ if (GMS.is_alpha_pass)
GMS.lastretval = !GMS.lastretval;
}
else
GMS.lastretval = !GMS.is_alpha_pass;
- if(GMS.lastretval) {
+ if (GMS.lastretval) {
/* for alpha pass, use alpha blend */
alphablend = GMS.alphablend[nr];
- if(gattribs && GMS.gmatbuf[nr]) {
+ if (gattribs && GMS.gmatbuf[nr]) {
/* bind glsl material and get attributes */
Material *mat = GMS.gmatbuf[nr];
float auto_bump_scale;
@@ -1241,10 +1241,10 @@ int GPU_enable_material(int nr, void *attribs)
/* for glsl use alpha blend mode, unless it's set to solid and
* we are already drawing in an alpha pass */
- if(mat->game.alpha_blend != GPU_BLEND_SOLID)
+ if (mat->game.alpha_blend != GPU_BLEND_SOLID)
alphablend= mat->game.alpha_blend;
- if(GMS.is_alpha_pass) glDepthMask(1);
+ if (GMS.is_alpha_pass) glDepthMask(1);
}
else {
/* or do fixed function opengl material */
@@ -1262,7 +1262,7 @@ int GPU_enable_material(int nr, void *attribs)
void GPU_set_material_alpha_blend(int alphablend)
{
- if(GMS.lastalphablend == alphablend)
+ if (GMS.lastalphablend == alphablend)
return;
gpu_set_alpha_blend(alphablend);
@@ -1279,8 +1279,8 @@ void GPU_disable_material(void)
GMS.lastmatnr= -1;
GMS.lastretval= 1;
- if(GMS.gboundmat) {
- if(GMS.is_alpha_pass) glDepthMask(0);
+ if (GMS.gboundmat) {
+ if (GMS.is_alpha_pass) glDepthMask(0);
GPU_material_unbind(GPU_material_from_blender(GMS.gscene, GMS.gboundmat));
GMS.gboundmat= NULL;
}
@@ -1292,7 +1292,7 @@ void GPU_end_object_materials(void)
{
GPU_disable_material();
- if(GMS.matbuf && GMS.matbuf != GMS.matbuf_fixed) {
+ if (GMS.matbuf && GMS.matbuf != GMS.matbuf_fixed) {
MEM_freeN(GMS.matbuf);
MEM_freeN(GMS.gmatbuf);
MEM_freeN(GMS.alphablend);
@@ -1303,7 +1303,7 @@ void GPU_end_object_materials(void)
GMS.alphablend= NULL;
/* resetting the texture matrix after the glScale needed for tiled textures */
- if(GTS.tilemode) {
+ if (GTS.tilemode) {
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
@@ -1318,7 +1318,7 @@ int GPU_default_lights(void)
int a, count = 0;
/* initialize */
- if(U.light[0].flag==0 && U.light[1].flag==0 && U.light[2].flag==0) {
+ if (U.light[0].flag==0 && U.light[1].flag==0 && U.light[2].flag==0) {
U.light[0].flag= 1;
U.light[0].vec[0]= -0.3; U.light[0].vec[1]= 0.3; U.light[0].vec[2]= 0.9;
U.light[0].col[0]= 0.8; U.light[0].col[1]= 0.8; U.light[0].col[2]= 0.8;
@@ -1340,9 +1340,9 @@ int GPU_default_lights(void)
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE);
- for(a=0; a<8; a++) {
- if(a<3) {
- if(U.light[a].flag) {
+ for (a=0; a<8; a++) {
+ if (a<3) {
+ if (U.light[a].flag) {
glEnable(GL_LIGHT0+a);
normalize_v3_v3(position, U.light[a].vec);
@@ -1386,7 +1386,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
float position[4], direction[4], energy[4];
/* disable all lights */
- for(count=0; count<8; count++)
+ for (count=0; count<8; count++)
glDisable(GL_LIGHT0+count);
/* view direction for specular is not compute correct by default in
@@ -1395,11 +1395,11 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
count= 0;
- for(base=scene->base.first; base; base=base->next) {
- if(base->object->type!=OB_LAMP)
+ for (base=scene->base.first; base; base=base->next) {
+ if (base->object->type!=OB_LAMP)
continue;
- if(!(base->lay & lay) || !(base->lay & ob->lay))
+ if (!(base->lay & lay) || !(base->lay & ob->lay))
continue;
la= base->object->data;
@@ -1410,7 +1410,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
where_is_object_simul(scene, base->object);
- if(la->type==LA_SUN) {
+ if (la->type==LA_SUN) {
/* sun lamp */
copy_v3_v3(direction, base->object->obmat[2]);
direction[3]= 0.0;
@@ -1427,7 +1427,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
glLightf(GL_LIGHT0+count, GL_LINEAR_ATTENUATION, la->att1/la->dist);
glLightf(GL_LIGHT0+count, GL_QUADRATIC_ATTENUATION, la->att2/(la->dist*la->dist));
- if(la->type==LA_SPOT) {
+ if (la->type==LA_SPOT) {
/* spot lamp */
negate_v3_v3(direction, base->object->obmat[2]);
glLightfv(GL_LIGHT0+count, GL_SPOT_DIRECTION, direction);
@@ -1449,7 +1449,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
glPopMatrix();
count++;
- if(count==8)
+ if (count==8)
break;
}
@@ -1511,9 +1511,9 @@ void GPU_state_init(void)
glDepthRange(0.0, 1.0);
a= 0;
- for(x=0; x<32; x++) {
- for(y=0; y<4; y++) {
- if( (x) & 1) pat[a++]= 0x88;
+ for (x=0; x<32; x++) {
+ for (y=0; y<4; y++) {
+ if ( (x) & 1) pat[a++]= 0x88;
else pat[a++]= 0x22;
}
}
@@ -1543,7 +1543,7 @@ static void gpu_get_print(const char *name, GLenum type)
glGetFloatv(type, value);
printf("%s: ", name);
- for(a=0; a<16; a++)
+ for (a=0; a<16; a++)
printf("%.2f ", value[a]);
printf("\n");
}
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index e1d6f64f661..846ee2850be 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -99,7 +99,7 @@ void GPU_extensions_init(void)
const char *vendor, *renderer;
/* can't avoid calling this multiple times, see wm_window_add_ghostwindow */
- if(gpu_extensions_init) return;
+ if (gpu_extensions_init) return;
gpu_extensions_init= 1;
glewInit();
@@ -123,38 +123,38 @@ void GPU_extensions_init(void)
vendor = (const char*)glGetString(GL_VENDOR);
renderer = (const char*)glGetString(GL_RENDERER);
- if(strstr(vendor, "ATI")) {
+ if (strstr(vendor, "ATI")) {
GG.device = GPU_DEVICE_ATI;
GG.driver = GPU_DRIVER_OFFICIAL;
}
- else if(strstr(vendor, "NVIDIA")) {
+ else if (strstr(vendor, "NVIDIA")) {
GG.device = GPU_DEVICE_NVIDIA;
GG.driver = GPU_DRIVER_OFFICIAL;
}
- else if(strstr(vendor, "Intel") ||
+ else if (strstr(vendor, "Intel") ||
/* src/mesa/drivers/dri/intel/intel_context.c */
strstr(renderer, "Mesa DRI Intel") ||
strstr(renderer, "Mesa DRI Mobile Intel")) {
GG.device = GPU_DEVICE_INTEL;
GG.driver = GPU_DRIVER_OFFICIAL;
}
- else if(strstr(renderer, "Mesa DRI R") || (strstr(renderer, "Gallium ") && strstr(renderer, " on ATI "))) {
+ else if (strstr(renderer, "Mesa DRI R") || (strstr(renderer, "Gallium ") && strstr(renderer, " on ATI "))) {
GG.device = GPU_DEVICE_ATI;
GG.driver = GPU_DRIVER_OPENSOURCE;
}
- else if(strstr(renderer, "Nouveau") || strstr(vendor, "nouveau")) {
+ else if (strstr(renderer, "Nouveau") || strstr(vendor, "nouveau")) {
GG.device = GPU_DEVICE_NVIDIA;
GG.driver = GPU_DRIVER_OPENSOURCE;
}
- else if(strstr(vendor, "Mesa")) {
+ else if (strstr(vendor, "Mesa")) {
GG.device = GPU_DEVICE_SOFTWARE;
GG.driver = GPU_DRIVER_SOFTWARE;
}
- else if(strstr(vendor, "Microsoft")) {
+ else if (strstr(vendor, "Microsoft")) {
GG.device = GPU_DEVICE_SOFTWARE;
GG.driver = GPU_DRIVER_SOFTWARE;
}
- else if(strstr(renderer, "Apple Software Renderer")) {
+ else if (strstr(renderer, "Apple Software Renderer")) {
GG.device = GPU_DEVICE_SOFTWARE;
GG.driver = GPU_DRIVER_SOFTWARE;
}
@@ -163,12 +163,12 @@ void GPU_extensions_init(void)
GG.driver = GPU_DRIVER_ANY;
}
- if(GG.device == GPU_DEVICE_ATI) {
+ if (GG.device == GPU_DEVICE_ATI) {
/* ATI 9500 to X2300 cards support NPoT textures poorly
* Incomplete list http://dri.freedesktop.org/wiki/ATIRadeon
* New IDs from MESA's src/gallium/drivers/r300/r300_screen.c
*/
- if(strstr(renderer, "R3") || strstr(renderer, "RV3") ||
+ 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") ||
@@ -205,7 +205,7 @@ int GPU_glsl_support(void)
int GPU_non_power_of_two_support(void)
{
- if(GG.npotdisabled)
+ if (GG.npotdisabled)
return 0;
return GLEW_ARB_texture_non_power_of_two;
@@ -260,7 +260,7 @@ static void GPU_print_framebuffer_error(GLenum status, char err_out[256])
break;
}
- if(err_out) {
+ if (err_out) {
BLI_snprintf(err_out, 256, "GPUFrameBuffer: framebuffer incomplete error %d '%s'",
(int)status, err);
}
@@ -318,7 +318,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in
GLenum type, format, internalformat;
void *pixels = NULL;
- if(depth && !GLEW_ARB_depth_texture)
+ if (depth && !GLEW_ARB_depth_texture)
return NULL;
tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture");
@@ -332,7 +332,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in
glGenTextures(1, &tex->bindcode);
if (!tex->bindcode) {
- if(err_out) {
+ if (err_out) {
BLI_snprintf(err_out, 256, "GPUTexture: texture create failed: %d",
(int)glGetError());
}
@@ -352,7 +352,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in
tex->number = 0;
glBindTexture(tex->target, tex->bindcode);
- if(depth) {
+ if (depth) {
type = GL_UNSIGNED_BYTE;
format = GL_DEPTH_COMPONENT;
internalformat = GL_DEPTH_COMPONENT;
@@ -396,7 +396,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in
if (pixels)
MEM_freeN(pixels);
- if(depth) {
+ if (depth) {
glTexParameteri(tex->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(tex->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(tex->target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE);
@@ -433,7 +433,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
void *pixels = NULL;
float vfBorderColor[4] = {0.0f, 0.0f, 0.0f, 0.0f};
- if(!GLEW_VERSION_1_2)
+ if (!GLEW_VERSION_1_2)
return NULL;
tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture");
@@ -476,7 +476,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
GPU_print_error("3D glTexImage3D");
if (fpixels) {
- if(!GPU_non_power_of_two_support() && (w != tex->w || h != tex->h || depth != tex->depth)) {
+ if (!GPU_non_power_of_two_support() && (w != tex->w || h != tex->h || depth != tex->depth)) {
/* clear first to avoid unitialized pixels */
float *zero= MEM_callocN(sizeof(float)*tex->w*tex->h*tex->depth, "zero");
glTexSubImage3D(tex->target, 0, 0, 0, 0, tex->w, tex->h, tex->depth, format, type, zero);
@@ -516,13 +516,13 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, double time,
GPU_update_image_time(ima, time);
bindcode = GPU_verify_image(ima, iuser, 0, 0, mipmap);
- if(ima->gputexture) {
+ if (ima->gputexture) {
ima->gputexture->bindcode = bindcode;
glBindTexture(GL_TEXTURE_2D, lastbindcode);
return ima->gputexture;
}
- if(!bindcode) {
+ if (!bindcode) {
glBindTexture(GL_TEXTURE_2D, lastbindcode);
return NULL;
}
@@ -593,7 +593,7 @@ void GPU_texture_bind(GPUTexture *tex, int number)
return;
}
- if(number == -1)
+ if (number == -1)
return;
GPU_print_error("Pre Texture Bind");
@@ -618,7 +618,7 @@ void GPU_texture_unbind(GPUTexture *tex)
return;
}
- if(tex->number == -1)
+ if (tex->number == -1)
return;
GPU_print_error("Pre Texture Unbind");
@@ -714,7 +714,7 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err
GLenum status;
GLenum attachment;
- if(tex->depth)
+ if (tex->depth)
attachment = GL_DEPTH_ATTACHMENT_EXT;
else
attachment = GL_COLOR_ATTACHMENT0_EXT;
@@ -725,7 +725,7 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment,
tex->target, tex->bindcode, 0);
- if(tex->depth) {
+ if (tex->depth) {
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);
}
@@ -742,7 +742,7 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err
return 0;
}
- if(tex->depth)
+ if (tex->depth)
fb->depthtex = tex;
else
fb->colortex = tex;
@@ -756,15 +756,15 @@ void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, GPUTexture *tex)
{
GLenum attachment;
- if(!tex->fb)
+ if (!tex->fb)
return;
- if(GG.currentfb != tex->fb->object) {
+ if (GG.currentfb != tex->fb->object) {
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, tex->fb->object);
GG.currentfb = tex->fb->object;
}
- if(tex->depth) {
+ if (tex->depth) {
fb->depthtex = NULL;
attachment = GL_DEPTH_ATTACHMENT_EXT;
}
@@ -817,12 +817,12 @@ void GPU_framebuffer_texture_unbind(GPUFrameBuffer *UNUSED(fb), GPUTexture *UNUS
void GPU_framebuffer_free(GPUFrameBuffer *fb)
{
- if(fb->depthtex)
+ if (fb->depthtex)
GPU_framebuffer_texture_detach(fb, fb->depthtex);
- if(fb->colortex)
+ if (fb->colortex)
GPU_framebuffer_texture_detach(fb, fb->colortex);
- if(fb->object) {
+ if (fb->object) {
glDeleteFramebuffersEXT(1, &fb->object);
if (GG.currentfb == fb->object) {
@@ -863,29 +863,29 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, char err_out[256])
ofs->h= height;
ofs->fb = GPU_framebuffer_create();
- if(!ofs->fb) {
+ if (!ofs->fb) {
GPU_offscreen_free(ofs);
return NULL;
}
ofs->depth = GPU_texture_create_depth(width, height, err_out);
- if(!ofs->depth) {
+ if (!ofs->depth) {
GPU_offscreen_free(ofs);
return NULL;
}
- if(!GPU_framebuffer_texture_attach(ofs->fb, ofs->depth, err_out)) {
+ if (!GPU_framebuffer_texture_attach(ofs->fb, ofs->depth, err_out)) {
GPU_offscreen_free(ofs);
return NULL;
}
ofs->color = GPU_texture_create_2D(width, height, NULL, err_out);
- if(!ofs->color) {
+ if (!ofs->color) {
GPU_offscreen_free(ofs);
return NULL;
}
- if(!GPU_framebuffer_texture_attach(ofs->fb, ofs->color, err_out)) {
+ if (!GPU_framebuffer_texture_attach(ofs->fb, ofs->color, err_out)) {
GPU_offscreen_free(ofs);
return NULL;
}
@@ -897,11 +897,11 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, char err_out[256])
void GPU_offscreen_free(GPUOffScreen *ofs)
{
- if(ofs->fb)
+ if (ofs->fb)
GPU_framebuffer_free(ofs->fb);
- if(ofs->color)
+ if (ofs->color)
GPU_texture_free(ofs->color);
- if(ofs->depth)
+ if (ofs->depth)
GPU_texture_free(ofs->depth);
MEM_freeN(ofs);
@@ -942,7 +942,7 @@ static void shader_print_errors(const char *task, char *log, const char *code)
fprintf(stderr, "GPUShader: %s error:\n", task);
- if(G.f & G_DEBUG) {
+ if (G.f & G_DEBUG) {
c = code;
while ((c < end) && (pos = strchr(c, '\n'))) {
fprintf(stderr, "%2d ", line);
@@ -971,9 +971,9 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPU
shader = MEM_callocN(sizeof(GPUShader), "GPUShader");
- if(vertexcode)
+ if (vertexcode)
shader->vertex = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
- if(fragcode)
+ if (fragcode)
shader->fragment = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
shader->object = glCreateProgramObjectARB();
@@ -985,7 +985,7 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPU
return NULL;
}
- if(vertexcode) {
+ if (vertexcode) {
glAttachObjectARB(shader->object, shader->vertex);
glShaderSourceARB(shader->vertex, 1, (const char**)&vertexcode, NULL);
@@ -1001,10 +1001,10 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPU
}
}
- if(fragcode) {
+ if (fragcode) {
count = 0;
- if(libcode) fragsource[count++] = libcode;
- if(fragcode) fragsource[count++] = fragcode;
+ if (libcode) fragsource[count++] = libcode;
+ if (fragcode) fragsource[count++] = fragcode;
glAttachObjectARB(shader->object, shader->fragment);
glShaderSourceARB(shader->fragment, count, fragsource, NULL);
@@ -1022,7 +1022,7 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPU
}
#if 0
- if(lib && lib->lib)
+ if (lib && lib->lib)
glAttachObjectARB(shader->object, lib->lib);
#endif
@@ -1113,7 +1113,7 @@ int GPU_shader_get_uniform(GPUShader *shader, const char *name)
void GPU_shader_uniform_vector(GPUShader *UNUSED(shader), int location, int length, int arraysize, float *value)
{
- if(location == -1)
+ if (location == -1)
return;
GPU_print_error("Pre Uniform Vector");
@@ -1137,10 +1137,10 @@ void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), int location, GPUText
return;
}
- if(tex->number == -1)
+ if (tex->number == -1)
return;
- if(location == -1)
+ if (location == -1)
return;
GPU_print_error("Pre Uniform Texture");
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 89b3a7d5f3f..906856cc64c 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -157,13 +157,13 @@ static void gpu_material_set_attrib_id(GPUMaterial *material)
attribs= &material->attribs;
pass= material->pass;
- if(!pass) {
+ if (!pass) {
attribs->totlayer = 0;
return;
}
shader= GPU_pass_shader(pass);
- if(!shader) {
+ if (!shader) {
attribs->totlayer = 0;
return;
}
@@ -172,11 +172,11 @@ static void gpu_material_set_attrib_id(GPUMaterial *material)
* in case the attrib does not get a valid index back, it was probably
* removed by the glsl compiler by dead code elimination */
- for(a=0, b=0; a<attribs->totlayer; a++) {
+ for (a=0, b=0; a<attribs->totlayer; a++) {
BLI_snprintf(name, sizeof(name), "att%d", attribs->layer[a].attribid);
attribs->layer[a].glindex = GPU_shader_get_attribute(shader, name);
- if(attribs->layer[a].glindex >= 0) {
+ if (attribs->layer[a].glindex >= 0) {
attribs->layer[b] = attribs->layer[a];
b++;
}
@@ -195,24 +195,24 @@ static int GPU_material_construct_end(GPUMaterial *material)
material->pass = GPU_generate_pass(&material->nodes, outlink,
&material->attribs, &material->builtins, material->ma->id.name);
- if(!material->pass)
+ if (!material->pass)
return 0;
gpu_material_set_attrib_id(material);
shader = GPU_pass_shader(material->pass);
- if(material->builtins & GPU_VIEW_MATRIX)
+ if (material->builtins & GPU_VIEW_MATRIX)
material->viewmatloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_VIEW_MATRIX));
- if(material->builtins & GPU_INVERSE_VIEW_MATRIX)
+ if (material->builtins & GPU_INVERSE_VIEW_MATRIX)
material->invviewmatloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_INVERSE_VIEW_MATRIX));
- if(material->builtins & GPU_OBJECT_MATRIX)
+ if (material->builtins & GPU_OBJECT_MATRIX)
material->obmatloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_OBJECT_MATRIX));
- if(material->builtins & GPU_INVERSE_OBJECT_MATRIX)
+ if (material->builtins & GPU_INVERSE_OBJECT_MATRIX)
material->invobmatloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_INVERSE_OBJECT_MATRIX));
- if(material->builtins & GPU_OBCOLOR)
+ if (material->builtins & GPU_OBCOLOR)
material->obcolloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_OBCOLOR));
- if(material->builtins & GPU_AUTO_BUMPSCALE)
+ if (material->builtins & GPU_AUTO_BUMPSCALE)
material->obautobumpscaleloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_AUTO_BUMPSCALE));
return 1;
}
@@ -225,18 +225,18 @@ void GPU_material_free(Material *ma)
LinkData *link;
LinkData *nlink, *mlink, *next;
- for(link=ma->gpumaterial.first; link; link=link->next) {
+ for (link=ma->gpumaterial.first; link; link=link->next) {
GPUMaterial *material = link->data;
- if(material->pass)
+ if (material->pass)
GPU_pass_free(material->pass);
- for(nlink=material->lamps.first; nlink; nlink=nlink->next) {
+ for (nlink=material->lamps.first; nlink; nlink=nlink->next) {
GPULamp *lamp = nlink->data;
- for(mlink=lamp->materials.first; mlink; mlink=next) {
+ for (mlink=lamp->materials.first; mlink; mlink=next) {
next = mlink->next;
- if(mlink->data == ma)
+ if (mlink->data == ma)
BLI_freelinkN(&lamp->materials, mlink);
}
}
@@ -251,15 +251,15 @@ void GPU_material_free(Material *ma)
void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time, int mipmap)
{
- if(material->pass) {
+ if (material->pass) {
LinkData *nlink;
GPULamp *lamp;
/* handle layer lamps */
- for(nlink=material->lamps.first; nlink; nlink=nlink->next) {
+ for (nlink=material->lamps.first; nlink; nlink=nlink->next) {
lamp= nlink->data;
- if(!lamp->hide && (lamp->lay & viewlay) && (!(lamp->mode & LA_LAYER) || (lamp->lay & oblay))) {
+ if (!lamp->hide && (lamp->lay & viewlay) && (!(lamp->mode & LA_LAYER) || (lamp->lay & oblay))) {
lamp->dynenergy = lamp->energy;
copy_v3_v3(lamp->dyncol, lamp->col);
}
@@ -276,53 +276,53 @@ void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double tim
void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float viewmat[][4], float viewinv[][4], float obcol[4], float autobumpscale)
{
- if(material->pass) {
+ if (material->pass) {
GPUShader *shader = GPU_pass_shader(material->pass);
LinkData *nlink;
GPULamp *lamp;
float invmat[4][4], col[4];
/* handle builtins */
- if(material->builtins & GPU_VIEW_MATRIX) {
+ if (material->builtins & GPU_VIEW_MATRIX) {
GPU_shader_uniform_vector(shader, material->viewmatloc, 16, 1, (float*)viewmat);
}
- if(material->builtins & GPU_INVERSE_VIEW_MATRIX) {
+ if (material->builtins & GPU_INVERSE_VIEW_MATRIX) {
GPU_shader_uniform_vector(shader, material->invviewmatloc, 16, 1, (float*)viewinv);
}
- if(material->builtins & GPU_OBJECT_MATRIX) {
+ if (material->builtins & GPU_OBJECT_MATRIX) {
GPU_shader_uniform_vector(shader, material->obmatloc, 16, 1, (float*)obmat);
}
- if(material->builtins & GPU_INVERSE_OBJECT_MATRIX) {
+ if (material->builtins & GPU_INVERSE_OBJECT_MATRIX) {
invert_m4_m4(invmat, obmat);
GPU_shader_uniform_vector(shader, material->invobmatloc, 16, 1, (float*)invmat);
}
- if(material->builtins & GPU_OBCOLOR) {
+ if (material->builtins & GPU_OBCOLOR) {
copy_v4_v4(col, obcol);
CLAMP(col[3], 0.0f, 1.0f);
GPU_shader_uniform_vector(shader, material->obcolloc, 4, 1, col);
}
- if(material->builtins & GPU_AUTO_BUMPSCALE) {
+ if (material->builtins & GPU_AUTO_BUMPSCALE) {
GPU_shader_uniform_vector(shader, material->obautobumpscaleloc, 1, 1, &autobumpscale);
}
/* update lamps */
- for(nlink=material->lamps.first; nlink; nlink=nlink->next) {
+ for (nlink=material->lamps.first; nlink; nlink=nlink->next) {
lamp= nlink->data;
- if(material->dynproperty & DYN_LAMP_VEC) {
+ if (material->dynproperty & DYN_LAMP_VEC) {
copy_v3_v3(lamp->dynvec, lamp->vec);
normalize_v3(lamp->dynvec);
negate_v3(lamp->dynvec);
mul_mat3_m4_v3(viewmat, lamp->dynvec);
}
- if(material->dynproperty & DYN_LAMP_CO) {
+ if (material->dynproperty & DYN_LAMP_CO) {
copy_v3_v3(lamp->dynco, lamp->co);
mul_m4_v3(viewmat, lamp->dynco);
}
- if(material->dynproperty & DYN_LAMP_IMAT)
+ if (material->dynproperty & DYN_LAMP_IMAT)
mult_m4_m4m4(lamp->dynimat, lamp->imat, viewinv);
- if(material->dynproperty & DYN_LAMP_PERSMAT)
+ if (material->dynproperty & DYN_LAMP_PERSMAT)
mult_m4_m4m4(lamp->dynpersmat, lamp->persmat, viewinv);
}
@@ -350,7 +350,7 @@ void GPU_material_vertex_attributes(GPUMaterial *material, GPUVertexAttribs *att
void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link)
{
- if(!material->outlink)
+ if (!material->outlink)
material->outlink= link;
}
@@ -361,7 +361,7 @@ void GPU_material_enable_alpha(GPUMaterial *material)
GPUBlendMode GPU_material_alpha_blend(GPUMaterial *material, float obcol[4])
{
- if(material->alpha || (material->obcolalpha && obcol[3] < 1.0f))
+ if (material->alpha || (material->obcolalpha && obcol[3] < 1.0f))
return GPU_BLEND_ALPHA;
else
return GPU_BLEND_SOLID;
@@ -385,7 +385,7 @@ static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNode
GPUNodeLink *visifac, *inpr;
/* from get_lamp_visibility */
- if(lamp->type==LA_SUN || lamp->type==LA_HEMI) {
+ if (lamp->type==LA_SUN || lamp->type==LA_HEMI) {
mat->dynproperty |= DYN_LAMP_VEC;
GPU_link(mat, "lamp_visibility_sun_hemi", GPU_dynamic_uniform(lamp->dynvec, GPU_DYNAMIC_LAMP_DYNVEC, lamp->ob), lv, dist, &visifac);
return visifac;
@@ -394,7 +394,7 @@ static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNode
mat->dynproperty |= DYN_LAMP_CO;
GPU_link(mat, "lamp_visibility_other", GPU_builtin(GPU_VIEW_POSITION), GPU_dynamic_uniform(lamp->dynco, GPU_DYNAMIC_LAMP_DYNCO, lamp->ob), lv, dist, &visifac);
- if(lamp->type==LA_AREA)
+ if (lamp->type==LA_AREA)
return visifac;
switch(lamp->falloff_type)
@@ -421,11 +421,11 @@ static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNode
break;
}
- if(lamp->mode & LA_SPHERE)
+ if (lamp->mode & LA_SPHERE)
GPU_link(mat, "lamp_visibility_sphere", GPU_uniform(&lamp->dist), *dist, visifac, &visifac);
- if(lamp->type == LA_SPOT) {
- if(lamp->mode & LA_SQUARE) {
+ if (lamp->type == LA_SPOT) {
+ if (lamp->mode & LA_SQUARE) {
mat->dynproperty |= DYN_LAMP_VEC|DYN_LAMP_IMAT;
GPU_link(mat, "lamp_visibility_spot_square", GPU_dynamic_uniform(lamp->dynvec, GPU_DYNAMIC_LAMP_DYNVEC, lamp->ob), GPU_dynamic_uniform((float*)lamp->dynimat, GPU_DYNAMIC_LAMP_DYNIMAT, lamp->ob), *lv, &inpr);
}
@@ -511,9 +511,9 @@ static void ramp_diffuse_result(GPUShadeInput *shi, GPUNodeLink **diff)
GPUMaterial *mat= shi->gpumat;
GPUNodeLink *fac;
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS)) {
- if(ma->ramp_col) {
- if(ma->rampin_col==MA_RAMP_IN_RESULT) {
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS)) {
+ if (ma->ramp_col) {
+ if (ma->rampin_col==MA_RAMP_IN_RESULT) {
GPU_link(mat, "ramp_rgbtobw", *diff, &fac);
/* colorband + blend */
@@ -527,10 +527,10 @@ static void add_to_diffuse(GPUMaterial *mat, Material *ma, GPUShadeInput *shi, G
{
GPUNodeLink *fac, *tmp, *addcol;
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) &&
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) &&
ma->ramp_col && (ma->mode & MA_RAMP_COL)) {
/* MA_RAMP_IN_RESULT is exceptional */
- if(ma->rampin_col==MA_RAMP_IN_RESULT) {
+ if (ma->rampin_col==MA_RAMP_IN_RESULT) {
addcol = shi->rgb;
}
else {
@@ -567,7 +567,7 @@ static void ramp_spec_result(GPUShadeInput *shi, GPUNodeLink **spec)
GPUMaterial *mat= shi->gpumat;
GPUNodeLink *fac;
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) &&
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) &&
ma->ramp_spec && ma->rampin_spec==MA_RAMP_IN_RESULT) {
GPU_link(mat, "ramp_rgbtobw", *spec, &fac);
@@ -585,7 +585,7 @@ static void do_specular_ramp(GPUShadeInput *shi, GPUNodeLink *is, GPUNodeLink *t
*spec = shi->specrgb;
/* MA_RAMP_IN_RESULT is exception */
- if(ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) {
+ if (ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) {
/* input */
switch(ma->rampin_spec) {
@@ -623,7 +623,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
GPUNodeLink *outcol, *specfac, *t, *shadfac= NULL;
float one = 1.0f;
- if((lamp->mode & LA_ONLYSHADOW) && !(ma->mode & MA_SHADOW))
+ if ((lamp->mode & LA_ONLYSHADOW) && !(ma->mode & MA_SHADOW))
return;
vn= shi->vn;
@@ -636,14 +636,14 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
GPU_link(mat, "shade_inp", vn, lv, &inp);
- if(lamp->mode & LA_NO_DIFF) {
+ if (lamp->mode & LA_NO_DIFF) {
GPU_link(mat, "shade_is_no_diffuse", &is);
}
- else if(lamp->type == LA_HEMI) {
+ else if (lamp->type == LA_HEMI) {
GPU_link(mat, "shade_is_hemi", inp, &is);
}
else {
- if(lamp->type == LA_AREA) {
+ if (lamp->type == LA_AREA) {
float area[4][4]= {{0.0f}}, areasize= 0.0f;
mat->dynproperty |= DYN_LAMP_VEC|DYN_LAMP_CO;
@@ -653,35 +653,35 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
is= inp; /* Lambert */
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS)) {
- if(ma->diff_shader==MA_DIFF_ORENNAYAR)
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS)) {
+ if (ma->diff_shader==MA_DIFF_ORENNAYAR)
GPU_link(mat, "shade_diffuse_oren_nayer", inp, vn, lv, view, GPU_uniform(&ma->roughness), &is);
- else if(ma->diff_shader==MA_DIFF_TOON)
+ else if (ma->diff_shader==MA_DIFF_TOON)
GPU_link(mat, "shade_diffuse_toon", vn, lv, view, GPU_uniform(&ma->param[0]), GPU_uniform(&ma->param[1]), &is);
- else if(ma->diff_shader==MA_DIFF_MINNAERT)
+ else if (ma->diff_shader==MA_DIFF_MINNAERT)
GPU_link(mat, "shade_diffuse_minnaert", inp, vn, view, GPU_uniform(&ma->darkness), &is);
- else if(ma->diff_shader==MA_DIFF_FRESNEL)
+ else if (ma->diff_shader==MA_DIFF_FRESNEL)
GPU_link(mat, "shade_diffuse_fresnel", vn, lv, view, GPU_uniform(&ma->param[0]), GPU_uniform(&ma->param[1]), &is);
}
}
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS))
- if(ma->shade_flag & MA_CUBIC)
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS))
+ if (ma->shade_flag & MA_CUBIC)
GPU_link(mat, "shade_cubic", is, &is);
i = is;
GPU_link(mat, "shade_visifac", i, visifac, shi->refl, &i);
#if 0
- if(ma->mode & MA_TANGENT_VN)
+ if (ma->mode & MA_TANGENT_VN)
GPU_link(mat, "shade_tangent_v_spec", GPU_attribute(CD_TANGENT, ""), &vn);
#endif
- /* this replaces if(i > 0.0) conditional until that is supported */
+ /* this replaces if (i > 0.0) conditional until that is supported */
// done in shade_visifac now, GPU_link(mat, "mtex_value_clamp_positive", i, &i);
- if((ma->mode & MA_SHADOW) && GPU_lamp_has_shadow_buffer(lamp)) {
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS)) {
+ if ((ma->mode & MA_SHADOW) && GPU_lamp_has_shadow_buffer(lamp)) {
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS)) {
mat->dynproperty |= DYN_LAMP_PERSMAT;
GPU_link(mat, "test_shadowbuf",
@@ -690,15 +690,15 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
GPU_dynamic_uniform((float*)lamp->dynpersmat, GPU_DYNAMIC_LAMP_DYNPERSMAT, lamp->ob),
GPU_uniform(&lamp->bias), inp, &shadfac);
- if(lamp->mode & LA_ONLYSHADOW) {
+ if (lamp->mode & LA_ONLYSHADOW) {
GPU_link(mat, "shade_only_shadow", i, shadfac,
GPU_dynamic_uniform(&lamp->dynenergy, GPU_DYNAMIC_LAMP_DYNENERGY, lamp->ob), &shadfac);
- if(!(lamp->mode & LA_NO_DIFF))
+ if (!(lamp->mode & LA_NO_DIFF))
GPU_link(mat, "shade_only_shadow_diffuse", shadfac, shi->rgb,
shr->diff, &shr->diff);
- if(!(lamp->mode & LA_NO_SPEC))
+ if (!(lamp->mode & LA_NO_SPEC))
GPU_link(mat, "shade_only_shadow_specular", shadfac, shi->specrgb,
shr->spec, &shr->spec);
@@ -710,7 +710,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
GPU_link(mat, "math_multiply", i, shadfac, &i);
}
}
- else if((mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS) && (lamp->mode & LA_ONLYSHADOW)) {
+ else if ((mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS) && (lamp->mode & LA_ONLYSHADOW)) {
add_user_list(&mat->lamps, lamp);
add_user_list(&lamp->materials, shi->gpumat->ma);
return;
@@ -718,40 +718,40 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
else
GPU_link(mat, "set_value", GPU_uniform(&one), &shadfac);
- if(GPU_link_changed(shi->refl) || ma->ref != 0.0f) {
- if(!(lamp->mode & LA_NO_DIFF)) {
+ if (GPU_link_changed(shi->refl) || ma->ref != 0.0f) {
+ if (!(lamp->mode & LA_NO_DIFF)) {
GPUNodeLink *rgb;
GPU_link(mat, "shade_mul_value", i, GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), &rgb);
add_to_diffuse(mat, ma, shi, is, rgb, &shr->diff);
}
}
- if(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS);
- else if(!(lamp->mode & LA_NO_SPEC) && !(lamp->mode & LA_ONLYSHADOW) &&
+ if (mat->scene->gm.flag & GAME_GLSL_NO_SHADERS);
+ else if (!(lamp->mode & LA_NO_SPEC) && !(lamp->mode & LA_ONLYSHADOW) &&
(GPU_link_changed(shi->spec) || ma->spec != 0.0f)) {
- if(lamp->type == LA_HEMI) {
+ if (lamp->type == LA_HEMI) {
GPU_link(mat, "shade_hemi_spec", vn, lv, view, GPU_uniform(&ma->spec), shi->har, visifac, &t);
GPU_link(mat, "shade_add_spec", t, GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), shi->specrgb, &outcol);
GPU_link(mat, "shade_add_clamped", shr->spec, outcol, &shr->spec);
}
else {
- if(ma->spec_shader==MA_SPEC_PHONG)
+ if (ma->spec_shader==MA_SPEC_PHONG)
GPU_link(mat, "shade_phong_spec", vn, lv, view, shi->har, &specfac);
- else if(ma->spec_shader==MA_SPEC_COOKTORR)
+ else if (ma->spec_shader==MA_SPEC_COOKTORR)
GPU_link(mat, "shade_cooktorr_spec", vn, lv, view, shi->har, &specfac);
- else if(ma->spec_shader==MA_SPEC_BLINN)
+ else if (ma->spec_shader==MA_SPEC_BLINN)
GPU_link(mat, "shade_blinn_spec", vn, lv, view, GPU_uniform(&ma->refrac), shi->har, &specfac);
- else if(ma->spec_shader==MA_SPEC_WARDISO)
+ else if (ma->spec_shader==MA_SPEC_WARDISO)
GPU_link(mat, "shade_wardiso_spec", vn, lv, view, GPU_uniform(&ma->rms), &specfac);
else
GPU_link(mat, "shade_toon_spec", vn, lv, view, GPU_uniform(&ma->param[2]), GPU_uniform(&ma->param[3]), &specfac);
- if(lamp->type==LA_AREA)
+ if (lamp->type==LA_AREA)
GPU_link(mat, "shade_spec_area_inp", specfac, inp, &specfac);
GPU_link(mat, "shade_spec_t", shadfac, shi->spec, visifac, specfac, &t);
- if(ma->mode & MA_RAMP_SPEC) {
+ if (ma->mode & MA_RAMP_SPEC) {
GPUNodeLink *spec;
do_specular_ramp(shi, specfac, t, &spec);
GPU_link(mat, "shade_add_spec", t, GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), spec, &outcol);
@@ -775,12 +775,12 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
Scene *sce_iter;
GPULamp *lamp;
- for(SETLOOPER(shi->gpumat->scene, sce_iter, base)) {
+ for (SETLOOPER(shi->gpumat->scene, sce_iter, base)) {
ob= base->object;
- if(ob->type==OB_LAMP) {
+ if (ob->type==OB_LAMP) {
lamp = GPU_lamp_from_blender(shi->gpumat->scene, ob, NULL);
- if(lamp)
+ if (lamp)
shade_one_light(shi, shr, lamp);
}
@@ -788,14 +788,14 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
DupliObject *dob;
ListBase *lb = object_duplilist(shi->gpumat->scene, ob);
- for(dob=lb->first; dob; dob=dob->next) {
+ for (dob=lb->first; dob; dob=dob->next) {
Object *ob_iter = dob->ob;
- if(ob_iter->type==OB_LAMP) {
+ if (ob_iter->type==OB_LAMP) {
copy_m4_m4(ob_iter->obmat, dob->mat);
lamp = GPU_lamp_from_blender(shi->gpumat->scene, ob_iter, ob);
- if(lamp)
+ if (lamp)
shade_one_light(shi, shr, lamp);
}
}
@@ -924,33 +924,33 @@ static void do_material_tex(GPUShadeInput *shi)
orn= texco_norm;
/* go over texture slots */
- for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+ for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
/* separate tex switching */
- if(ma->septex & (1<<tex_nr)) continue;
+ if (ma->septex & (1<<tex_nr)) continue;
- if(ma->mtex[tex_nr]) {
+ if (ma->mtex[tex_nr]) {
mtex= ma->mtex[tex_nr];
tex= mtex->tex;
- if(tex == NULL) continue;
+ if (tex == NULL) continue;
/* which coords */
- if(mtex->texco==TEXCO_ORCO)
+ if (mtex->texco==TEXCO_ORCO)
texco= texco_orco;
- else if(mtex->texco==TEXCO_OBJECT)
+ else if (mtex->texco==TEXCO_OBJECT)
texco= texco_object;
- else if(mtex->texco==TEXCO_NORM)
+ else if (mtex->texco==TEXCO_NORM)
texco= orn;
- else if(mtex->texco==TEXCO_TANGENT)
+ else if (mtex->texco==TEXCO_TANGENT)
texco= texco_object;
- else if(mtex->texco==TEXCO_GLOB)
+ else if (mtex->texco==TEXCO_GLOB)
texco= texco_global;
- else if(mtex->texco==TEXCO_REFL) {
+ else if (mtex->texco==TEXCO_REFL) {
GPU_link(mat, "texco_refl", shi->vn, shi->view, &shi->ref);
texco= shi->ref;
}
- else if(mtex->texco==TEXCO_UV) {
- if(1) { //!(texco_uv && strcmp(mtex->uvname, lastuvname) == 0)) {
+ else if (mtex->texco==TEXCO_UV) {
+ if (1) { //!(texco_uv && strcmp(mtex->uvname, lastuvname) == 0)) {
GPU_link(mat, "texco_uv", GPU_attribute(CD_MTFACE, mtex->uvname), &texco_uv);
/*lastuvname = mtex->uvname;*/ /*UNUSED*/
}
@@ -960,98 +960,98 @@ static void do_material_tex(GPUShadeInput *shi)
continue;
/* in case of uv, this would just undo a multiplication in texco_uv */
- if(mtex->texco != TEXCO_UV)
+ if (mtex->texco != TEXCO_UV)
GPU_link(mat, "mtex_2d_mapping", texco, &texco);
- if(mtex->size[0] != 1.0f || mtex->size[1] != 1.0f || mtex->size[2] != 1.0f)
+ if (mtex->size[0] != 1.0f || mtex->size[1] != 1.0f || mtex->size[2] != 1.0f)
GPU_link(mat, "mtex_mapping_size", texco, GPU_uniform(mtex->size), &texco);
ofs[0] = mtex->ofs[0] + 0.5f - 0.5f*mtex->size[0];
ofs[1] = mtex->ofs[1] + 0.5f - 0.5f*mtex->size[1];
ofs[2] = 0.0f;
- if(ofs[0] != 0.0f || ofs[1] != 0.0f || ofs[2] != 0.0f)
+ if (ofs[0] != 0.0f || ofs[1] != 0.0f || ofs[2] != 0.0f)
GPU_link(mat, "mtex_mapping_ofs", texco, GPU_uniform(ofs), &texco);
talpha = 0;
- if(tex && tex->type == TEX_IMAGE && tex->ima) {
+ if (tex && tex->type == TEX_IMAGE && tex->ima) {
GPU_link(mat, "mtex_image", texco, GPU_image(tex->ima, &tex->iuser), &tin, &trgb);
rgbnor= TEX_RGB;
- if(tex->imaflag & TEX_USEALPHA)
+ if (tex->imaflag & TEX_USEALPHA)
talpha= 1;
}
else continue;
/* texture output */
- if((rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
+ if ((rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
GPU_link(mat, "mtex_rgbtoint", trgb, &tin);
rgbnor -= TEX_RGB;
}
- if(mtex->texflag & MTEX_NEGATIVE) {
- if(rgbnor & TEX_RGB)
+ if (mtex->texflag & MTEX_NEGATIVE) {
+ if (rgbnor & TEX_RGB)
GPU_link(mat, "mtex_rgb_invert", trgb, &trgb);
else
GPU_link(mat, "mtex_value_invert", tin, &tin);
}
- if(mtex->texflag & MTEX_STENCIL) {
- if(rgbnor & TEX_RGB)
+ if (mtex->texflag & MTEX_STENCIL) {
+ if (rgbnor & TEX_RGB)
GPU_link(mat, "mtex_rgb_stencil", stencil, trgb, &stencil, &trgb);
else
GPU_link(mat, "mtex_value_stencil", stencil, tin, &stencil, &tin);
}
/* mapping */
- if(mtex->mapto & (MAP_COL+MAP_COLSPEC)) {
+ if (mtex->mapto & (MAP_COL+MAP_COLSPEC)) {
/* stencil maps on the texture control slider, not texture intensity value */
- if((rgbnor & TEX_RGB)==0) {
+ if ((rgbnor & TEX_RGB)==0) {
GPU_link(mat, "set_rgb", GPU_uniform(&mtex->r), &tcol);
}
else {
GPU_link(mat, "set_rgba", trgb, &tcol);
- if(mtex->mapto & MAP_ALPHA)
+ if (mtex->mapto & MAP_ALPHA)
GPU_link(mat, "set_value", stencil, &tin);
- else if(talpha)
+ else if (talpha)
GPU_link(mat, "mtex_alpha_from_col", trgb, &tin);
else
GPU_link(mat, "set_value_one", &tin);
}
- if(tex->type==TEX_IMAGE)
- if(gpu_do_color_management(mat))
+ if (tex->type==TEX_IMAGE)
+ if (gpu_do_color_management(mat))
GPU_link(mat, "srgb_to_linearrgb", tcol, &tcol);
- if(mtex->mapto & MAP_COL) {
+ if (mtex->mapto & MAP_COL) {
GPUNodeLink *colfac;
- if(mtex->colfac == 1.0f) colfac = stencil;
+ if (mtex->colfac == 1.0f) colfac = stencil;
else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->colfac), stencil, &colfac);
texture_rgb_blend(mat, tcol, shi->rgb, tin, colfac, mtex->blendtype, &shi->rgb);
}
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_COLSPEC)) {
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_COLSPEC)) {
GPUNodeLink *colspecfac;
- if(mtex->colspecfac == 1.0f) colspecfac = stencil;
+ if (mtex->colspecfac == 1.0f) colspecfac = stencil;
else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->colspecfac), stencil, &colspecfac);
texture_rgb_blend(mat, tcol, shi->specrgb, tin, colspecfac, mtex->blendtype, &shi->specrgb);
}
}
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_NORM)) {
- if(tex->type==TEX_IMAGE) {
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_NORM)) {
+ if (tex->type==TEX_IMAGE) {
found_deriv_map = tex->imaflag & TEX_DERIVATIVEMAP;
- if(tex->imaflag & TEX_NORMALMAP) {
+ if (tex->imaflag & TEX_NORMALMAP) {
/* normalmap image */
GPU_link(mat, "mtex_normal", texco, GPU_image(tex->ima, &tex->iuser), &tnor );
- if(mtex->norfac < 0.0f)
+ if (mtex->norfac < 0.0f)
GPU_link(mat, "mtex_negate_texnormal", tnor, &tnor);
if (mtex->normapspace == MTEX_NSPACE_TANGENT) {
@@ -1072,20 +1072,20 @@ static void do_material_tex(GPUShadeInput *shi)
norfac = minf(fabsf(mtex->norfac), 1.0f);
- if(norfac == 1.0f && !GPU_link_changed(stencil)) {
+ if (norfac == 1.0f && !GPU_link_changed(stencil)) {
shi->vn = newnor;
}
else {
tnorfac = GPU_uniform(&norfac);
- if(GPU_link_changed(stencil))
+ if (GPU_link_changed(stencil))
GPU_link(mat, "math_multiply", tnorfac, stencil, &tnorfac);
GPU_link(mat, "mtex_blend_normal", tnorfac, shi->vn, newnor, &shi->vn);
}
}
- else if( (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP)) || found_deriv_map) {
+ else if ( (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP)) || found_deriv_map) {
/* ntap bumpmap image */
int iBumpSpace;
float ima_x, ima_y;
@@ -1099,16 +1099,16 @@ static void do_material_tex(GPUShadeInput *shi)
GPUNodeLink *dBs, *dBt, *fDet;
hScale = 0.1; // compatibility adjustment factor for all bumpspace types
- if( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
+ if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
hScale = 13.0f; // factor for scaling texspace bumps
- else if(found_deriv_map!=0)
+ else if (found_deriv_map!=0)
hScale = 1.0f;
// resolve texture resolution
- if( (mtex->texflag & MTEX_BUMP_TEXTURESPACE) || found_deriv_map ) {
+ if ( (mtex->texflag & MTEX_BUMP_TEXTURESPACE) || found_deriv_map ) {
ImBuf *ibuf= BKE_image_get_ibuf(tex->ima, &tex->iuser);
ima_x= 512.0f; ima_y= 512.f; // prevent calling textureSize, glsl 1.3 only
- if(ibuf) {
+ if (ibuf) {
ima_x= ibuf->x;
ima_y= ibuf->y;
aspect = ((float) ima_y) / ima_x;
@@ -1127,13 +1127,13 @@ static void do_material_tex(GPUShadeInput *shi)
tnorfac = GPU_uniform(&norfac);
- if(found_deriv_map)
+ if (found_deriv_map)
GPU_link(mat, "math_multiply", tnorfac, GPU_builtin(GPU_AUTO_BUMPSCALE), &tnorfac);
- if(GPU_link_changed(stencil))
+ if (GPU_link_changed(stencil))
GPU_link(mat, "math_multiply", tnorfac, stencil, &tnorfac);
- if( !init_done ) {
+ if ( !init_done ) {
// copy shi->vn to vNorg and vNacc, set magnitude to 1
GPU_link(mat, "mtex_bump_normals_init", shi->vn, &vNorg, &vNacc, &fPrevMagnitude);
iBumpSpacePrev = 0;
@@ -1141,17 +1141,17 @@ static void do_material_tex(GPUShadeInput *shi)
}
// find current bump space
- if( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
+ if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
iBumpSpace = 1;
- else if( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
+ else if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
iBumpSpace = 2;
else
iBumpSpace = 4; // ViewSpace
// re-initialize if bump space changed
- if( iBumpSpacePrev != iBumpSpace ) {
+ if ( iBumpSpacePrev != iBumpSpace ) {
- if( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
+ if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
GPU_link( mat, "mtex_bump_init_objspace",
surf_pos, vNorg,
GPU_builtin(GPU_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX),
@@ -1159,7 +1159,7 @@ static void do_material_tex(GPUShadeInput *shi)
&fPrevMagnitude, &vNacc,
&vR1, &vR2, &fDet );
- else if( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
+ else if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
GPU_link( mat, "mtex_bump_init_texturespace",
surf_pos, vNorg,
fPrevMagnitude, vNacc,
@@ -1177,25 +1177,26 @@ static void do_material_tex(GPUShadeInput *shi)
}
- if(found_deriv_map) {
+ if (found_deriv_map) {
GPU_link( mat, "mtex_bump_deriv",
texco, GPU_image(tex->ima, &tex->iuser), GPU_uniform(&ima_x), GPU_uniform(&ima_y), tnorfac,
&dBs, &dBt );
}
- else if( mtex->texflag & MTEX_3TAP_BUMP )
+ else if ( mtex->texflag & MTEX_3TAP_BUMP )
GPU_link( mat, "mtex_bump_tap3",
texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
&dBs, &dBt );
- else if( mtex->texflag & MTEX_5TAP_BUMP )
+ else if ( mtex->texflag & MTEX_5TAP_BUMP )
GPU_link( mat, "mtex_bump_tap5",
texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
&dBs, &dBt );
- else if( mtex->texflag & MTEX_BICUBIC_BUMP ){
- if(GPU_bicubic_bump_support()){
+ else if ( mtex->texflag & MTEX_BICUBIC_BUMP ) {
+ if (GPU_bicubic_bump_support()) {
GPU_link( mat, "mtex_bump_bicubic",
texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
&dBs, &dBt );
- }else{
+ }
+ else {
GPU_link( mat, "mtex_bump_tap5",
texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
&dBs, &dBt );
@@ -1203,14 +1204,15 @@ static void do_material_tex(GPUShadeInput *shi)
}
- if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
+ if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
float imag_tspace_dimension_y = aspect*imag_tspace_dimension_x;
GPU_link( mat, "mtex_bump_apply_texspace",
fDet, dBs, dBt, vR1, vR2,
GPU_image(tex->ima, &tex->iuser), texco,
GPU_uniform(&imag_tspace_dimension_x), GPU_uniform(&imag_tspace_dimension_y), vNacc,
&vNacc, &shi->vn );
- } else
+ }
+ else
GPU_link( mat, "mtex_bump_apply",
fDet, dBs, dBt, vR1, vR2, vNacc,
&vNacc, &shi->vn );
@@ -1221,64 +1223,64 @@ static void do_material_tex(GPUShadeInput *shi)
GPU_link(mat, "vec_math_negate", shi->vn, &orn);
}
- if((mtex->mapto & MAP_VARS)) {
- if(rgbnor & TEX_RGB) {
- if(talpha)
+ if ((mtex->mapto & MAP_VARS)) {
+ if (rgbnor & TEX_RGB) {
+ if (talpha)
GPU_link(mat, "mtex_alpha_from_col", trgb, &tin);
else
GPU_link(mat, "mtex_rgbtoint", trgb, &tin);
}
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_REF) {
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_REF) {
GPUNodeLink *difffac;
- if(mtex->difffac == 1.0f) difffac = stencil;
+ if (mtex->difffac == 1.0f) difffac = stencil;
else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->difffac), stencil, &difffac);
texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->refl, tin, difffac, mtex->blendtype, &shi->refl);
GPU_link(mat, "mtex_value_clamp_positive", shi->refl, &shi->refl);
}
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_SPEC) {
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_SPEC) {
GPUNodeLink *specfac;
- if(mtex->specfac == 1.0f) specfac = stencil;
+ if (mtex->specfac == 1.0f) specfac = stencil;
else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->specfac), stencil, &specfac);
texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->spec, tin, specfac, mtex->blendtype, &shi->spec);
GPU_link(mat, "mtex_value_clamp_positive", shi->spec, &shi->spec);
}
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_EMIT) {
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_EMIT) {
GPUNodeLink *emitfac;
- if(mtex->emitfac == 1.0f) emitfac = stencil;
+ if (mtex->emitfac == 1.0f) emitfac = stencil;
else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->emitfac), stencil, &emitfac);
texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->emit, tin, emitfac, mtex->blendtype, &shi->emit);
GPU_link(mat, "mtex_value_clamp_positive", shi->emit, &shi->emit);
}
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_HAR) {
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_HAR) {
GPUNodeLink *hardfac;
- if(mtex->hardfac == 1.0f) hardfac = stencil;
+ if (mtex->hardfac == 1.0f) hardfac = stencil;
else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->hardfac), stencil, &hardfac);
GPU_link(mat, "mtex_har_divide", shi->har, &shi->har);
texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->har, tin, hardfac, mtex->blendtype, &shi->har);
GPU_link(mat, "mtex_har_multiply_clamp", shi->har, &shi->har);
}
- if(mtex->mapto & MAP_ALPHA) {
+ if (mtex->mapto & MAP_ALPHA) {
GPUNodeLink *alphafac;
- if(mtex->alphafac == 1.0f) alphafac = stencil;
+ if (mtex->alphafac == 1.0f) alphafac = stencil;
else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->alphafac), stencil, &alphafac);
texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->alpha, tin, alphafac, mtex->blendtype, &shi->alpha);
GPU_link(mat, "mtex_value_clamp", shi->alpha, &shi->alpha);
}
- if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_AMB) {
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_AMB) {
GPUNodeLink *ambfac;
- if(mtex->ambfac == 1.0f) ambfac = stencil;
+ if (mtex->ambfac == 1.0f) ambfac = stencil;
else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->ambfac), stencil, &ambfac);
texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->amb, tin, ambfac, mtex->blendtype, &shi->amb);
@@ -1309,7 +1311,7 @@ void GPU_shadeinput_set(GPUMaterial *mat, Material *ma, GPUShadeInput *shi)
GPU_link(mat, "set_value", GPU_uniform(&ma->amb), &shi->amb);
GPU_link(mat, "shade_view", GPU_builtin(GPU_VIEW_POSITION), &shi->view);
GPU_link(mat, "vcol_attribute", GPU_attribute(CD_MCOL, ""), &shi->vcol);
- if(gpu_do_color_management(mat))
+ if (gpu_do_color_management(mat))
GPU_link(mat, "srgb_to_linearrgb", shi->vcol, &shi->vcol);
GPU_link(mat, "texco_refl", shi->vn, shi->view, &shi->ref);
}
@@ -1324,23 +1326,23 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
memset(shr, 0, sizeof(*shr));
- if(ma->mode & MA_VERTEXCOLP)
+ if (ma->mode & MA_VERTEXCOLP)
shi->rgb = shi->vcol;
do_material_tex(shi);
- if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
+ if ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
GPU_material_enable_alpha(mat);
- if((mat->scene->gm.flag & GAME_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) {
+ if ((mat->scene->gm.flag & GAME_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) {
shr->combined = shi->rgb;
shr->alpha = shi->alpha;
GPU_link(mat, "set_rgb", shi->rgb, &shr->diff);
GPU_link(mat, "set_rgb_zero", &shr->spec);
}
else {
- if(GPU_link_changed(shi->emit) || ma->emit != 0.0f) {
- if((ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))== MA_VERTEXCOL) {
+ if (GPU_link_changed(shi->emit) || ma->emit != 0.0f) {
+ if ((ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))== MA_VERTEXCOL) {
GPU_link(mat, "shade_add", shi->emit, shi->vcol, &emit);
GPU_link(mat, "shade_mul", emit, shi->rgb, &shr->diff);
}
@@ -1357,9 +1359,9 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
shr->combined = shr->diff;
shr->alpha = shi->alpha;
- if(world) {
+ if (world) {
/* exposure correction */
- if(world->exp!=0.0f || world->range!=1.0f) {
+ if (world->exp!=0.0f || world->range!=1.0f) {
linfac= 1.0f + powf((2.0f*world->exp + 0.5f), -10);
logfac= logf((linfac-1.0f)/linfac)/world->range;
@@ -1373,26 +1375,26 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
}
/* ambient color */
- if(world->ambr!=0.0f || world->ambg!=0.0f || world->ambb!=0.0f) {
- if(GPU_link_changed(shi->amb) || ma->amb != 0.0f)
+ if (world->ambr!=0.0f || world->ambg!=0.0f || world->ambb!=0.0f) {
+ if (GPU_link_changed(shi->amb) || ma->amb != 0.0f)
GPU_link(mat, "shade_maddf", shr->combined, GPU_uniform(&ma->amb),
GPU_uniform(&world->ambr), &shr->combined);
}
}
- if(ma->mode & MA_RAMP_COL) ramp_diffuse_result(shi, &shr->combined);
- if(ma->mode & MA_RAMP_SPEC) ramp_spec_result(shi, &shr->spec);
+ if (ma->mode & MA_RAMP_COL) ramp_diffuse_result(shi, &shr->combined);
+ if (ma->mode & MA_RAMP_SPEC) ramp_spec_result(shi, &shr->spec);
- if(GPU_link_changed(shi->spec) || ma->spec != 0.0f)
+ if (GPU_link_changed(shi->spec) || ma->spec != 0.0f)
GPU_link(mat, "shade_add", shr->combined, shr->spec, &shr->combined);
}
GPU_link(mat, "mtex_alpha_to_col", shr->combined, shr->alpha, &shr->combined);
- if(ma->shade_flag & MA_OBCOLOR)
+ if (ma->shade_flag & MA_OBCOLOR)
GPU_link(mat, "shade_obcolor", shr->combined, GPU_builtin(GPU_OBCOLOR), &shr->combined);
- if(world && (world->mode & WO_MIST) && !(ma->mode & MA_NOMIST)) {
+ if (world && (world->mode & WO_MIST) && !(ma->mode & MA_NOMIST)) {
misttype = world->mistype;
GPU_link(mat, "shade_mist_factor", GPU_builtin(GPU_VIEW_POSITION),
@@ -1403,15 +1405,15 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
GPU_uniform(&world->horr), &shr->combined);
}
- if(!((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))) {
- if(world && (GPU_link_changed(shr->alpha) || ma->alpha != 1.0f))
+ if (!((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))) {
+ if (world && (GPU_link_changed(shr->alpha) || ma->alpha != 1.0f))
GPU_link(mat, "shade_world_mix", GPU_uniform(&world->horr),
shr->combined, &shr->combined);
GPU_link(mat, "shade_alpha_opaque", shr->combined, &shr->combined);
}
- if(ma->shade_flag & MA_OBCOLOR) {
+ if (ma->shade_flag & MA_OBCOLOR) {
mat->obcolalpha = 1;
GPU_link(mat, "shade_alpha_obcolor", shr->combined, GPU_builtin(GPU_OBCOLOR), &shr->combined);
}
@@ -1434,15 +1436,15 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma)
GPUNodeLink *outlink;
LinkData *link;
- for(link=ma->gpumaterial.first; link; link=link->next)
- if(((GPUMaterial*)link->data)->scene == scene)
+ for (link=ma->gpumaterial.first; link; link=link->next)
+ if (((GPUMaterial*)link->data)->scene == scene)
return link->data;
/* allocate material */
mat = GPU_material_construct_begin(ma);
mat->scene = scene;
- if(!(scene->gm.flag & GAME_GLSL_NO_NODES) && ma->nodetree && ma->use_nodes) {
+ if (!(scene->gm.flag & GAME_GLSL_NO_NODES) && ma->nodetree && ma->use_nodes) {
/* create nodes */
ntreeGPUMaterialNodes(ma->nodetree, mat);
}
@@ -1452,9 +1454,9 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma)
GPU_material_output_link(mat, outlink);
}
- if(!scene_use_new_shading_nodes(scene)) {
- if(gpu_do_color_management(mat))
- if(mat->outlink)
+ if (!scene_use_new_shading_nodes(scene)) {
+ if (gpu_do_color_management(mat))
+ if (mat->outlink)
GPU_link(mat, "linearrgb_to_srgb", mat->outlink, &mat->outlink);
}
@@ -1478,12 +1480,12 @@ void GPU_materials_free(void)
Material *ma;
extern Material defmaterial;
- for(ma=G.main->mat.first; ma; ma=ma->id.next)
+ for (ma=G.main->mat.first; ma; ma=ma->id.next)
GPU_material_free(ma);
GPU_material_free(&defmaterial);
- for(ob=G.main->object.first; ob; ob=ob->id.next)
+ for (ob=G.main->object.first; ob; ob=ob->id.next)
GPU_lamp_free(ob);
}
@@ -1508,7 +1510,7 @@ void GPU_lamp_update(GPULamp *lamp, int lay, int hide, float obmat[][4])
void GPU_lamp_update_colors(GPULamp *lamp, float r, float g, float b, float energy)
{
lamp->energy = energy;
- if(lamp->mode & LA_NEG) lamp->energy= -lamp->energy;
+ if (lamp->mode & LA_NEG) lamp->energy= -lamp->energy;
lamp->col[0]= r* lamp->energy;
lamp->col[1]= g* lamp->energy;
@@ -1529,7 +1531,7 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l
lamp->type = la->type;
lamp->energy = la->energy;
- if(lamp->mode & LA_NEG) lamp->energy= -lamp->energy;
+ if (lamp->mode & LA_NEG) lamp->energy= -lamp->energy;
lamp->col[0]= la->r*lamp->energy;
lamp->col[1]= la->g*lamp->energy;
@@ -1538,8 +1540,8 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l
GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_RENDER), ob->obmat);
lamp->spotsi= la->spotsize;
- if(lamp->mode & LA_HALO)
- if(lamp->spotsi > 170.0f)
+ if (lamp->mode & LA_HALO)
+ if (lamp->spotsi > 170.0f)
lamp->spotsi = 170.0f;
lamp->spotsi= cosf((float)M_PI*lamp->spotsi/360.0f);
lamp->spotbl= (1.0f - lamp->spotsi)*la->spotblend;
@@ -1571,11 +1573,11 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l
static void gpu_lamp_shadow_free(GPULamp *lamp)
{
- if(lamp->tex) {
+ if (lamp->tex) {
GPU_texture_free(lamp->tex);
lamp->tex= NULL;
}
- if(lamp->fb) {
+ if (lamp->fb) {
GPU_framebuffer_free(lamp->fb);
lamp->fb= NULL;
}
@@ -1587,10 +1589,10 @@ GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par)
GPULamp *lamp;
LinkData *link;
- for(link=ob->gpulamp.first; link; link=link->next) {
+ for (link=ob->gpulamp.first; link; link=link->next) {
lamp = (GPULamp*)link->data;
- if(lamp->par == par && lamp->scene == scene)
+ if (lamp->par == par && lamp->scene == scene)
return link->data;
}
@@ -1603,21 +1605,21 @@ 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)) {
/* opengl */
lamp->fb = GPU_framebuffer_create();
- if(!lamp->fb) {
+ if (!lamp->fb) {
gpu_lamp_shadow_free(lamp);
return lamp;
}
lamp->tex = GPU_texture_create_depth(lamp->size, lamp->size, NULL);
- if(!lamp->tex) {
+ if (!lamp->tex) {
gpu_lamp_shadow_free(lamp);
return lamp;
}
- if(!GPU_framebuffer_texture_attach(lamp->fb, lamp->tex, NULL)) {
+ if (!GPU_framebuffer_texture_attach(lamp->fb, lamp->tex, NULL)) {
gpu_lamp_shadow_free(lamp);
return lamp;
}
@@ -1635,15 +1637,15 @@ void GPU_lamp_free(Object *ob)
LinkData *nlink;
Material *ma;
- for(link=ob->gpulamp.first; link; link=link->next) {
+ for (link=ob->gpulamp.first; link; link=link->next) {
lamp = link->data;
- while(lamp->materials.first) {
+ while (lamp->materials.first) {
nlink = lamp->materials.first;
ma = nlink->data;
BLI_freelinkN(&lamp->materials, nlink);
- if(ma->gpumaterial.first)
+ if (ma->gpumaterial.first)
GPU_material_free(ma);
}
@@ -1706,7 +1708,7 @@ void GPU_lamp_shadow_buffer_unbind(GPULamp *lamp)
int GPU_lamp_shadow_layer(GPULamp *lamp)
{
- if(lamp->fb && lamp->tex && (lamp->mode & (LA_LAYER|LA_LAYER_SHADOW)))
+ if (lamp->fb && lamp->tex && (lamp->mode & (LA_LAYER|LA_LAYER_SHADOW)))
return lamp->lay;
else
return -1;
@@ -1739,19 +1741,19 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
GLint lastbindcode;
int i, liblen, fraglen;
- if(!GPU_glsl_support())
+ if (!GPU_glsl_support())
return NULL;
mat = GPU_material_from_blender(scene, ma);
pass = (mat)? mat->pass: NULL;
- if(pass && pass->fragmentcode && pass->vertexcode) {
+ if (pass && pass->fragmentcode && pass->vertexcode) {
shader = MEM_callocN(sizeof(GPUShaderExport), "GPUShaderExport");
- for(input = pass->inputs.first; input; input = input->next) {
+ for (input = pass->inputs.first; input; input = input->next) {
uniform = MEM_callocN(sizeof(GPUInputUniform), "GPUInputUniform");
- if(input->ima) {
+ if (input->ima) {
/* image sampler uniform */
uniform->type = GPU_DYNAMIC_SAMPLER_2DIMAGE;
uniform->datatype = GPU_DATA_1I;
@@ -1759,7 +1761,7 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
uniform->texnumber = input->texid;
BLI_strncpy(uniform->varname, input->shadername, sizeof(uniform->varname));
}
- else if(input->tex) {
+ else if (input->tex) {
/* generated buffer */
uniform->texnumber = input->texid;
uniform->datatype = GPU_DATA_1I;
@@ -1771,7 +1773,7 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
uniform->lamp = input->dynamicdata;
break;
case GPU_TEX2D:
- if(GPU_texture_opengl_bindcode(input->tex)) {
+ if (GPU_texture_opengl_bindcode(input->tex)) {
uniform->type = GPU_DYNAMIC_SAMPLER_2DBUFFER;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode);
glBindTexture(GL_TEXTURE_2D, GPU_texture_opengl_bindcode(input->tex));
@@ -1807,19 +1809,19 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
break;
}
- if(uniform->type >= GPU_DYNAMIC_LAMP_FIRST && uniform->type <= GPU_DYNAMIC_LAMP_LAST)
+ if (uniform->type >= GPU_DYNAMIC_LAMP_FIRST && uniform->type <= GPU_DYNAMIC_LAMP_LAST)
uniform->lamp = input->dynamicdata;
}
- if(uniform->type != GPU_DYNAMIC_NONE)
+ if (uniform->type != GPU_DYNAMIC_NONE)
BLI_addtail(&shader->uniforms, uniform);
else
MEM_freeN(uniform);
}
/* process builtin uniform */
- for(i=0; builtins[i].gputype; i++) {
- if(mat->builtins & builtins[i].gputype) {
+ for (i=0; builtins[i].gputype; i++) {
+ if (mat->builtins & builtins[i].gputype) {
uniform = MEM_callocN(sizeof(GPUInputUniform), "GPUInputUniform");
uniform->type = builtins[i].dynamictype;
uniform->datatype = builtins[i].datatype;
@@ -1833,13 +1835,13 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
liblen = (pass->libcode) ? strlen(pass->libcode) : 0;
fraglen = strlen(pass->fragmentcode);
shader->fragment = (char *)MEM_mallocN(liblen+fraglen+1, "GPUFragShader");
- if(pass->libcode)
+ if (pass->libcode)
memcpy(shader->fragment, pass->libcode, liblen);
memcpy(&shader->fragment[liblen], pass->fragmentcode, fraglen);
shader->fragment[liblen+fraglen] = 0;
// export the attribute
- for(i=0; i<mat->attribs.totlayer; i++) {
+ for (i=0; i<mat->attribs.totlayer; i++) {
attribute = MEM_callocN(sizeof(GPUInputAttribute), "GPUInputAttribute");
attribute->type = mat->attribs.layer[i].type;
attribute->number = mat->attribs.layer[i].glindex;
@@ -1862,7 +1864,7 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
break;
}
- if(attribute->datatype != GPU_DATA_NONE)
+ if (attribute->datatype != GPU_DATA_NONE)
BLI_addtail(&shader->attributes, attribute);
else
MEM_freeN(attribute);
@@ -1879,19 +1881,19 @@ void GPU_free_shader_export(GPUShaderExport *shader)
{
GPUInputUniform *uniform;
- if(shader == NULL)
+ if (shader == NULL)
return;
- for(uniform = shader->uniforms.first; uniform; uniform=uniform->next)
- if(uniform->texpixels)
+ for (uniform = shader->uniforms.first; uniform; uniform=uniform->next)
+ if (uniform->texpixels)
MEM_freeN(uniform->texpixels);
BLI_freelistN(&shader->uniforms);
BLI_freelistN(&shader->attributes);
- if(shader->vertex)
+ if (shader->vertex)
MEM_freeN(shader->vertex);
- if(shader->fragment)
+ if (shader->fragment)
MEM_freeN(shader->fragment);
MEM_freeN(shader);
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c
index 7a96edeaf5f..41700b96acc 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.c
+++ b/source/blender/ikplugin/intern/iksolver_plugin.c
@@ -65,8 +65,8 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
int a, t, segcount= 0, size, newsize, *oldparent, parent;
/* find IK constraint, and validate it */
- for(con= pchan_tip->constraints.first; con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ for (con= pchan_tip->constraints.first; con; con= con->next) {
+ if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
data=(bKinematicConstraint*)con->data;
if (data->flag & CONSTRAINT_IK_AUTO) break;
if (data->tar==NULL) continue;
@@ -74,36 +74,36 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
if ((con->flag & (CONSTRAINT_DISABLE|CONSTRAINT_OFF))==0 && (con->enforce != 0.0f)) break;
}
}
- if(con==NULL) return;
+ if (con==NULL) return;
/* exclude tip from chain? */
- if(!(data->flag & CONSTRAINT_IK_TIP))
+ if (!(data->flag & CONSTRAINT_IK_TIP))
pchan_tip= pchan_tip->parent;
/* Find the chain's root & count the segments needed */
- for (curchan = pchan_tip; curchan; curchan=curchan->parent){
+ for (curchan = pchan_tip; curchan; curchan=curchan->parent) {
pchan_root = curchan;
curchan->flag |= POSE_CHAIN; // don't forget to clear this
chanlist[segcount]=curchan;
segcount++;
- if(segcount==data->rootbone || segcount>255) break; // 255 is weak
+ if (segcount==data->rootbone || segcount>255) break; // 255 is weak
}
if (!segcount) return;
/* setup the chain data */
/* we make tree-IK, unless all existing targets are in this chain */
- for(tree= pchan_root->iktree.first; tree; tree= tree->next) {
- for(target= tree->targets.first; target; target= target->next) {
+ for (tree= pchan_root->iktree.first; tree; tree= tree->next) {
+ for (target= tree->targets.first; target; target= target->next) {
curchan= tree->pchan[target->tip];
- if(curchan->flag & POSE_CHAIN)
+ if (curchan->flag & POSE_CHAIN)
curchan->flag &= ~POSE_CHAIN;
else
break;
}
- if(target) break;
+ if (target) break;
}
/* create a target */
@@ -111,7 +111,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
target->con= con;
pchan_tip->flag &= ~POSE_CHAIN;
- if(tree==NULL) {
+ if (tree==NULL) {
/* make new tree */
tree= MEM_callocN(sizeof(PoseTree), "posetree");
@@ -123,7 +123,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
tree->pchan= MEM_callocN(segcount*sizeof(void*), "ik tree pchan");
tree->parent= MEM_callocN(segcount*sizeof(int), "ik tree parent");
- for(a=0; a<segcount; a++) {
+ for (a=0; a<segcount; a++) {
tree->pchan[a]= chanlist[segcount-a-1];
tree->parent[a]= a-1;
}
@@ -144,19 +144,19 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
for (;t<tree->totchannel && tree->pchan[t]!=chanlist[segcount-a-1];t++);
if (t>=tree->totchannel)
break;
- for(; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++);
+ for (; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++);
}
segcount= segcount-a;
target->tip= tree->totchannel + segcount - 1;
if (segcount > 0) {
- for(parent = a - 1; parent < tree->totchannel; parent++)
- if(tree->pchan[parent] == chanlist[segcount-1]->parent)
+ for (parent = a - 1; parent < tree->totchannel; parent++)
+ if (tree->pchan[parent] == chanlist[segcount-1]->parent)
break;
/* shouldn't happen, but could with dependency cycles */
- if(parent == tree->totchannel)
+ if (parent == tree->totchannel)
parent = a - 1;
/* resize array */
@@ -172,7 +172,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
MEM_freeN(oldparent);
/* add new pose channels at the end, in reverse order */
- for(a=0; a<segcount; a++) {
+ for (a=0; a<segcount; a++) {
tree->pchan[tree->totchannel+a]= chanlist[segcount-a-1];
tree->parent[tree->totchannel+a]= tree->totchannel+a-1;
}
@@ -256,20 +256,20 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
iktree= MEM_mallocN(sizeof(void*)*tree->totchannel, "ik tree");
- for(a=0; a<tree->totchannel; a++) {
+ for (a=0; a<tree->totchannel; a++) {
pchan= tree->pchan[a];
bone= pchan->bone;
/* set DoF flag */
flag= 0;
- if(!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP))
+ if (!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP))
flag |= IK_XDOF;
- if(!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP))
+ if (!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP))
flag |= IK_YDOF;
- if(!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP))
+ if (!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP))
flag |= IK_ZDOF;
- if(tree->stretch && (pchan->ikstretch > 0.0f)) {
+ if (tree->stretch && (pchan->ikstretch > 0.0f)) {
flag |= IK_TRANS_YDOF;
hasstretch = 1;
}
@@ -277,7 +277,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
seg= iktree[a]= IK_CreateSegment(flag);
/* find parent */
- if(a == 0)
+ if (a == 0)
parent= NULL;
else
parent= iktree[tree->parent[a]];
@@ -334,7 +334,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
IK_SetStiffness(seg, IK_Y, pchan->stiffness[1]);
IK_SetStiffness(seg, IK_Z, pchan->stiffness[2]);
- if(tree->stretch && (pchan->ikstretch > 0.0f)) {
+ if (tree->stretch && (pchan->ikstretch > 0.0f)) {
float ikstretch = pchan->ikstretch*pchan->ikstretch;
IK_SetStiffness(seg, IK_TRANS_Y, MIN2(1.0f-ikstretch, 0.99f));
IK_SetLimit(seg, IK_TRANS_Y, 0.001, 1e10);
@@ -377,10 +377,10 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
copy_m3_m4(goalrot, goal);
/* same for pole vector target */
- if(data->poletar) {
+ if (data->poletar) {
get_constraint_target_matrix(scene, target->con, 1, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0);
- if(data->flag & CONSTRAINT_IK_SETANGLE) {
+ if (data->flag & CONSTRAINT_IK_SETANGLE) {
/* don't solve IK when we are setting the pole angle */
break;
}
@@ -395,7 +395,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
resultblend= 1;
resultinf= target->con->enforce;
- if(data->flag & CONSTRAINT_IK_GETANGLE) {
+ if (data->flag & CONSTRAINT_IK_GETANGLE) {
poleangledata= data;
data->flag &= ~CONSTRAINT_IK_GETANGLE;
}
@@ -429,14 +429,14 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
iktarget= iktree[target->tip];
- if(data->weight != 0.0f) {
- if(poleconstrain)
+ if (data->weight != 0.0f) {
+ if (poleconstrain)
IK_SolverSetPoleVectorConstraint(solver, iktarget, goalpos,
polepos, data->poleangle, (poleangledata == data));
IK_SolverAddGoal(solver, iktarget, goalpos, data->weight);
}
- if((data->flag & CONSTRAINT_IK_ROT) && (data->orientweight != 0.0f))
- if((data->flag & CONSTRAINT_IK_AUTO)==0)
+ if ((data->flag & CONSTRAINT_IK_ROT) && (data->orientweight != 0.0f))
+ if ((data->flag & CONSTRAINT_IK_AUTO)==0)
IK_SolverAddGoalOrientation(solver, iktarget, goalrot,
data->orientweight);
}
@@ -444,27 +444,27 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
/* solve */
IK_Solve(solver, 0.0f, tree->iterations);
- if(poleangledata)
+ if (poleangledata)
poleangledata->poleangle= IK_SolverGetPoleAngle(solver);
IK_FreeSolver(solver);
/* gather basis changes */
tree->basis_change= MEM_mallocN(sizeof(float[3][3])*tree->totchannel, "ik basis change");
- if(hasstretch)
+ if (hasstretch)
ikstretch= MEM_mallocN(sizeof(float)*tree->totchannel, "ik stretch");
- for(a=0; a<tree->totchannel; a++) {
+ for (a=0; a<tree->totchannel; a++) {
IK_GetBasisChange(iktree[a], tree->basis_change[a]);
- if(hasstretch) {
+ if (hasstretch) {
/* have to compensate for scaling received from parent */
float parentstretch, stretch;
pchan= tree->pchan[a];
parentstretch= (tree->parent[a] >= 0)? ikstretch[tree->parent[a]]: 1.0f;
- if(tree->stretch && (pchan->ikstretch > 0.0f)) {
+ if (tree->stretch && (pchan->ikstretch > 0.0f)) {
float trans[3], length;
IK_GetTranslationChange(iktree[a], trans);
@@ -482,7 +482,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
mul_v3_fl(tree->basis_change[a][2], stretch);
}
- if(resultblend && resultinf!=1.0f) {
+ if (resultblend && resultinf!=1.0f) {
unit_m3(identity);
blend_m3_m3m3(tree->basis_change[a], identity,
tree->basis_change[a], resultinf);
@@ -492,15 +492,15 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
}
MEM_freeN(iktree);
- if(ikstretch) MEM_freeN(ikstretch);
+ if (ikstretch) MEM_freeN(ikstretch);
}
static void free_posetree(PoseTree *tree)
{
BLI_freelistN(&tree->targets);
- if(tree->pchan) MEM_freeN(tree->pchan);
- if(tree->parent) MEM_freeN(tree->parent);
- if(tree->basis_change) MEM_freeN(tree->basis_change);
+ if (tree->pchan) MEM_freeN(tree->pchan);
+ if (tree->parent) MEM_freeN(tree->parent);
+ if (tree->basis_change) MEM_freeN(tree->basis_change);
MEM_freeN(tree);
}
@@ -511,8 +511,8 @@ void iksolver_initialize_tree(struct Scene *UNUSED(scene), struct Object *ob, fl
{
bPoseChannel *pchan;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->constflag & PCHAN_HAS_IK) // flag is set on editing constraints
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ if (pchan->constflag & PCHAN_HAS_IK) // flag is set on editing constraints
initialize_posetree(ob, pchan); // will attach it to root!
}
ob->pose->flag &= ~POSE_WAS_REBUILT;
@@ -520,7 +520,7 @@ void iksolver_initialize_tree(struct Scene *UNUSED(scene), struct Object *ob, fl
void iksolver_execute_tree(struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime)
{
- while(pchan->iktree.first) {
+ while (pchan->iktree.first) {
PoseTree *tree= pchan->iktree.first;
int a;
@@ -529,8 +529,8 @@ void iksolver_execute_tree(struct Scene *scene, struct Object *ob, struct bPose
return;
/* 4. walk over the tree for regular solving */
- for(a=0; a<tree->totchannel; a++) {
- if(!(tree->pchan[a]->flag & POSE_DONE)) // successive trees can set the flag
+ for (a=0; a<tree->totchannel; a++) {
+ if (!(tree->pchan[a]->flag & POSE_DONE)) // successive trees can set the flag
where_is_pose_bone(scene, ob, tree->pchan[a], ctime, 1);
// tell blender that this channel was controlled by IK, it's cleared on each where_is_pose()
tree->pchan[a]->flag |= POSE_CHAIN;
@@ -540,11 +540,11 @@ void iksolver_execute_tree(struct Scene *scene, struct Object *ob, struct bPose
/* 6. apply the differences to the channels,
* we need to calculate the original differences first */
- for(a=0; a<tree->totchannel; a++) {
+ for (a=0; a<tree->totchannel; a++) {
make_dmats(tree->pchan[a]);
}
- for(a=0; a<tree->totchannel; a++) {
+ for (a=0; a<tree->totchannel; a++) {
/* sets POSE_DONE */
where_is_ik_bone(tree->pchan[a], tree->basis_change[a]);
}
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index 5385366f075..a5e7150328b 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -198,7 +198,7 @@ struct IK_Scene
// delete scene first
if (scene)
delete scene;
- for(std::vector<IK_Target*>::iterator it = targets.begin(); it != targets.end(); ++it)
+ for (std::vector<IK_Target*>::iterator it = targets.begin(); it != targets.end(); ++it)
delete (*it);
targets.clear();
if (channels)
@@ -245,7 +245,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
data=(bKinematicConstraint*)con->data;
/* exclude tip from chain? */
- if(!(data->flag & CONSTRAINT_IK_TIP))
+ if (!(data->flag & CONSTRAINT_IK_TIP))
pchan_tip= pchan_tip->parent;
rootbone = data->rootbone;
@@ -256,7 +256,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
if (++segcount > 255) // 255 is weak
break;
- if(segcount==rootbone){
+ if (segcount==rootbone){
// reached this end of the chain but if the chain is overlapping with a
// previous one, we must go back up to the root of the other chain
if ((curchan->flag & POSE_CHAIN) && curchan->iktree.first == NULL){
@@ -289,7 +289,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
// by contruction there can be only one tree per channel and each channel can be part of at most one tree.
tree = (PoseTree*)pchan_root->iktree.first;
- if(tree==NULL) {
+ if (tree==NULL) {
/* make new tree */
tree= (PoseTree*)MEM_callocN(sizeof(PoseTree), "posetree");
@@ -299,7 +299,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
tree->pchan= (bPoseChannel**)MEM_callocN(segcount*sizeof(void*), "ik tree pchan");
tree->parent= (int*)MEM_callocN(segcount*sizeof(int), "ik tree parent");
- for(a=0; a<segcount; a++) {
+ for (a=0; a<segcount; a++) {
tree->pchan[a]= chanlist[segcount-a-1];
tree->parent[a]= a-1;
}
@@ -322,19 +322,19 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
for (;t<tree->totchannel && tree->pchan[t]!=chanlist[segcount-a-1];t++);
if (t>=tree->totchannel)
break;
- for(; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++);
+ for (; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++);
}
segcount= segcount-a;
target->tip= tree->totchannel + segcount - 1;
if (segcount > 0) {
- for(parent = a - 1; parent < tree->totchannel; parent++)
- if(tree->pchan[parent] == chanlist[segcount-1]->parent)
+ for (parent = a - 1; parent < tree->totchannel; parent++)
+ if (tree->pchan[parent] == chanlist[segcount-1]->parent)
break;
/* shouldn't happen, but could with dependency cycles */
- if(parent == tree->totchannel)
+ if (parent == tree->totchannel)
parent = a - 1;
/* resize array */
@@ -350,7 +350,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
MEM_freeN(oldparent);
/* add new pose channels at the end, in reverse order */
- for(a=0; a<segcount; a++) {
+ for (a=0; a<segcount; a++) {
tree->pchan[tree->totchannel+a]= chanlist[segcount-a-1];
tree->parent[tree->totchannel+a]= tree->totchannel+a-1;
}
@@ -401,8 +401,8 @@ int initialize_scene(Object *ob, bPoseChannel *pchan_tip)
/* find all IK constraints and validate them */
treecount = 0;
- for(con= (bConstraint *)pchan_tip->constraints.first; con; con= (bConstraint *)con->next) {
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ for (con= (bConstraint *)pchan_tip->constraints.first; con; con= (bConstraint *)con->next) {
+ if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
if (constraint_valid(con))
treecount += initialize_chain(ob, pchan_tip, con);
}
@@ -428,13 +428,14 @@ static double EulerAngleFromMatrix(const KDL::Rotation& R, int axis)
if (t > 16.0*KDL::epsilon) {
if (axis == 0) return -KDL::atan2(R(1,2), R(2,2));
- else if(axis == 1) return KDL::atan2(-R(0,2), t);
- else return -KDL::atan2(R(0,1), R(0,0));
- } else {
+ else if (axis == 1) return KDL::atan2(-R(0,2), t);
+ else return -KDL::atan2(R(0,1), R(0,0));
+ }
+ else {
if (axis == 0) return -KDL::atan2(-R(2,1), R(1,1));
- else if(axis == 1) return KDL::atan2(-R(0,2), t);
- else return 0.0f;
- }
+ else if (axis == 1) return KDL::atan2(-R(0,2), t);
+ else return 0.0f;
+ }
}
static double ComputeTwist(const KDL::Rotation& R)
@@ -473,27 +474,29 @@ static void RemoveEulerAngleFromMatrix(KDL::Rotation& R, double angle, int axis)
static void GetEulerXZY(const KDL::Rotation& R, double& X,double& Z,double& Y)
{
if (fabs(R(0,1)) > 1.0 - KDL::epsilon ) {
- X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0));
- Z = -KDL::sign(R(0,1)) * KDL::PI / 2;
- Y = 0.0;
- } else {
- X = KDL::atan2(R(2,1), R(1,1));
- Z = KDL::atan2(-R(0,1), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,2))));
- Y = KDL::atan2(R(0,2), R(0,0));
- }
+ X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0));
+ Z = -KDL::sign(R(0,1)) * KDL::PI / 2;
+ Y = 0.0;
+ }
+ else {
+ X = KDL::atan2(R(2,1), R(1,1));
+ Z = KDL::atan2(-R(0,1), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,2))));
+ Y = KDL::atan2(R(0,2), R(0,0));
+ }
}
static void GetEulerXYZ(const KDL::Rotation& R, double& X,double& Y,double& Z)
{
if (fabs(R(0,2)) > 1.0 - KDL::epsilon ) {
- X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1));
- Y = KDL::sign(R(0,2)) * KDL::PI / 2;
- Z = 0.0;
- } else {
- X = KDL::atan2(-R(1,2), R(2,2));
- Y = KDL::atan2(R(0,2), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,1))));
- Z = KDL::atan2(-R(0,1), R(0,0));
- }
+ X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1));
+ Y = KDL::sign(R(0,2)) * KDL::PI / 2;
+ Z = 0.0;
+ }
+ else {
+ X = KDL::atan2(-R(1,2), R(2,2));
+ Y = KDL::atan2(R(0,2), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,1))));
+ Z = KDL::atan2(-R(0,1), R(0,0));
+ }
}
#endif
@@ -691,7 +694,8 @@ static bool copypose_callback(const iTaSC::Timestamp& timestamp, iTaSC::Constrai
values->action = iTaSC::ACT_ALPHA;
values++;
}
- } else {
+ }
+ else {
if (iktarget->controlType & iTaSC::CopyPose::CTL_POSITION) {
// update error
values->alpha = condata->weight;
@@ -745,7 +749,8 @@ static bool distance_callback(const iTaSC::Timestamp& timestamp, iTaSC::Constrai
// update weight according to mode
if (iktarget->blenderConstraint->flag & CONSTRAINT_OFF) {
values->alpha = 0.0;
- } else {
+ }
+ else {
switch (condata->mode) {
case LIMITDIST_INSIDE:
values->alpha = (values->values[0].y > condata->dist) ? condata->weight : 0.0;
@@ -868,7 +873,7 @@ static int convert_channels(IK_Scene *ikscene, PoseTree *tree)
int a, flag, njoint;
njoint = 0;
- for(a=0, ikchan = ikscene->channels; a<ikscene->numchan; ++a, ++ikchan) {
+ for (a=0, ikchan = ikscene->channels; a<ikscene->numchan; ++a, ++ikchan) {
pchan= tree->pchan[a];
ikchan->pchan = pchan;
ikchan->parent = (a>0) ? tree->parent[a] : -1;
@@ -876,17 +881,17 @@ 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) &&
+ 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) &&
+ 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))
flag |= IK_YDOF;
- if(!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP) &&
+ 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))
flag |= IK_ZDOF;
- if(tree->stretch && (pchan->ikstretch > 0.0)) {
+ if (tree->stretch && (pchan->ikstretch > 0.0)) {
flag |= IK_TRANSY;
}
/*
@@ -989,14 +994,15 @@ static void convert_pose(IK_Scene *ikscene)
// assume uniform scaling and take Y scale as general scale for the armature
scale = len_v3(ikscene->blArmature->obmat[1]);
rot = &ikscene->jointArray(0);
- for(joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) {
+ for (joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) {
pchan= ikchan->pchan;
bone= pchan->bone;
if (pchan->parent) {
unit_m4(bmat);
mul_m4_m4m3(bmat, pchan->parent->pose_mat, bone->bone_mat);
- } else {
+ }
+ else {
copy_m4_m4(bmat, bone->arm_mat);
}
invert_m4_m4(rmat, bmat);
@@ -1029,7 +1035,7 @@ static void rest_pose(IK_Scene *ikscene)
SetToZero(ikscene->jointArray);
// except for transY joints
rot = &ikscene->jointArray(0);
- for(joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) {
+ for (joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) {
pchan= ikchan->pchan;
bone= pchan->bone;
@@ -1076,7 +1082,8 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
if (!ikparam) {
// you must have our own copy
ikparam = &DefIKParam;
- } else if (ingame) {
+ }
+ else if (ingame) {
// tweak the param when in game to have efficient stepping
// using fixed substep is not effecient since frames in the GE are often
// shorter than in animation => move to auto step automatically and set
@@ -1120,12 +1127,13 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
// in the GE, set the initial joint angle to match the current pose
// this will update the jointArray in ikscene
convert_pose(ikscene);
- } else {
+ }
+ else {
// in Blender, the rest pose is always 0 for joints
rest_pose(ikscene);
}
rot = &ikscene->jointArray(0);
- for(a=0, ikchan = ikscene->channels; a<tree->totchannel; ++a, ++ikchan) {
+ for (a=0, ikchan = ikscene->channels; a<tree->totchannel; ++a, ++ikchan) {
pchan= ikchan->pchan;
bone= pchan->bone;
@@ -1393,7 +1401,8 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
// move to the tail and scale to get rest pose of armature base
copy_v3_v3(baseFrame[3], pchan->bone->arm_tail);
invert_m4_m4(invBaseFrame, baseFrame);
- } else {
+ }
+ else {
unit_m4(invBaseFrame);
}
// finally add the constraint
@@ -1491,7 +1500,7 @@ static void create_scene(Scene *scene, Object *ob)
bPoseChannel *pchan;
// create the IK scene
- for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
+ for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
// by construction there is only one tree
PoseTree *tree = (PoseTree*)pchan->iktree.first;
if (tree) {
@@ -1506,9 +1515,9 @@ static void create_scene(Scene *scene, Object *ob)
while(tree) {
BLI_remlink(&pchan->iktree, tree);
BLI_freelistN(&tree->targets);
- if(tree->pchan) MEM_freeN(tree->pchan);
- if(tree->parent) MEM_freeN(tree->parent);
- if(tree->basis_change) MEM_freeN(tree->basis_change);
+ if (tree->pchan) MEM_freeN(tree->pchan);
+ if (tree->parent) MEM_freeN(tree->parent);
+ if (tree->basis_change) MEM_freeN(tree->basis_change);
MEM_freeN(tree);
tree = (PoseTree*)pchan->iktree.first;
}
@@ -1519,7 +1528,7 @@ static void create_scene(Scene *scene, Object *ob)
static void init_scene(Object *ob)
{
if (ob->pose->ikdata) {
- for(IK_Scene* scene = ((IK_Data*)ob->pose->ikdata)->first;
+ for (IK_Scene* scene = ((IK_Data*)ob->pose->ikdata)->first;
scene != NULL;
scene = scene->next) {
scene->channels[0].pchan->flag |= POSE_IKTREE;
@@ -1538,9 +1547,10 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl
ikchan->pchan->flag |= (POSE_DONE|POSE_CHAIN);
ikchan->jointValid = 0;
}
- } else {
+ }
+ else {
// in animation mode, we must get the bone position from action and constraints
- for(i=0, ikchan=ikscene->channels; i<ikscene->numchan; i++, ++ikchan) {
+ for (i=0, ikchan=ikscene->channels; i<ikscene->numchan; i++, ++ikchan) {
if (!(ikchan->pchan->flag & POSE_DONE))
where_is_pose_bone(blscene, ikscene->blArmature, ikchan->pchan, ctime, 1);
// tell blender that this channel was controlled by IK, it's cleared on each where_is_pose()
@@ -1589,7 +1599,8 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl
// the cache is empty before this time, reiterate
if (ikparam->flag & ITASC_INITIAL_REITERATION)
reiterate = true;
- } else {
+ }
+ else {
// can take the cache as a start point.
sts -= cts;
timestep = sts/1000.0;
@@ -1700,8 +1711,8 @@ void itasc_initialize_tree(struct Scene *scene, Object *ob, float ctime)
itasc_clear_data(ob->pose);
// we should handle all the constraint and mark them all disabled
// for blender but we'll start with the IK constraint alone
- for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
- if(pchan->constflag & PCHAN_HAS_IK)
+ for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
+ if (pchan->constflag & PCHAN_HAS_IK)
count += initialize_scene(ob, pchan);
}
// if at least one tree, create the scenes from the PoseTree stored in the channels
@@ -1780,7 +1791,8 @@ void itasc_update_param(struct bPose *pose)
ikscene->scene->setParam(iTaSC::Scene::MAX_TIMESTEP, ikparam->maxstep);
ikscene->solver->setParam(iTaSC::Solver::DLS_QMAX, ikparam->maxvel);
ikscene->armature->setControlParameter(CONSTRAINT_ID_ALL, iTaSC::Armature::ID_JOINT, iTaSC::ACT_FEEDBACK, ikparam->feedback);
- } else {
+ }
+ else {
// in animation mode timestep is 1s by convention =>
// qmax becomes radiant and feedback becomes fraction of error gap corrected in one iteration
ikscene->scene->setParam(iTaSC::Scene::MIN_TIMESTEP, 1.0);
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index 649b7cb1c11..aa4454562b4 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -180,4 +180,10 @@ if(WITH_IMAGE_HDR)
add_definitions(-DWITH_HDR)
endif()
+if(WIN32)
+ list(APPEND INC
+ ../../../intern/utfconv
+ )
+endif()
+
blender_add_lib(bf_imbuf "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index a68bbb97b62..a0c737b44fc 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -375,6 +375,7 @@ void IMB_float_from_rect_simple(struct ImBuf *ibuf); /* no profile conversion */
void IMB_convert_profile(struct ImBuf *ibuf, int profile);
float *IMB_float_profile_ensure(struct ImBuf *ibuf, int profile, int *alloc);
void IMB_color_to_bw(struct ImBuf *ibuf);
+void IMB_saturation(struct ImBuf *ibuf, float sat);
/* converting pixel buffers */
void IMB_buffer_byte_from_float(unsigned char *rect_to, const float *rect_from,
diff --git a/source/blender/imbuf/IMB_thumbs.h b/source/blender/imbuf/IMB_thumbs.h
index 49e90134d21..76c09ec1486 100644
--- a/source/blender/imbuf/IMB_thumbs.h
+++ b/source/blender/imbuf/IMB_thumbs.h
@@ -57,7 +57,7 @@ typedef enum ThumbSource {
THB_SOURCE_BLEND
} ThumbSource;
-/* dont generate thumbs for images bigger then this (100mb) */
+/* don't generate thumbs for images bigger then this (100mb) */
#define THUMB_SIZE_MAX (100 * 1024*1024)
// IB_metadata
diff --git a/source/blender/imbuf/SConscript b/source/blender/imbuf/SConscript
index ca56003845f..b2b526ca17d 100644
--- a/source/blender/imbuf/SConscript
+++ b/source/blender/imbuf/SConscript
@@ -17,6 +17,7 @@ defs = []
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
+ incs += ' ../../../intern/utfconv'
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index d85251a8ccb..2cfdd7bc324 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -51,8 +51,8 @@ void imb_freemipmapImBuf(ImBuf *ibuf)
{
int a;
- for(a=1; a<ibuf->miptot; a++) {
- if(ibuf->mipmap[a-1])
+ for (a=1; a<ibuf->miptot; a++) {
+ if (ibuf->mipmap[a-1])
IMB_freeImBuf(ibuf->mipmap[a-1]);
ibuf->mipmap[a-1]= NULL;
}
@@ -63,9 +63,9 @@ void imb_freemipmapImBuf(ImBuf *ibuf)
/* any free rect frees mipmaps to be sure, creation is in render on first request */
void imb_freerectfloatImBuf(ImBuf *ibuf)
{
- if(ibuf==NULL) return;
+ if (ibuf==NULL) return;
- if(ibuf->rect_float && (ibuf->mall & IB_rectfloat)) {
+ if (ibuf->rect_float && (ibuf->mall & IB_rectfloat)) {
MEM_freeN(ibuf->rect_float);
ibuf->rect_float=NULL;
}
@@ -79,9 +79,9 @@ void imb_freerectfloatImBuf(ImBuf *ibuf)
/* any free rect frees mipmaps to be sure, creation is in render on first request */
void imb_freerectImBuf(ImBuf *ibuf)
{
- if(ibuf==NULL) return;
+ if (ibuf==NULL) return;
- if(ibuf->rect && (ibuf->mall & IB_rect))
+ if (ibuf->rect && (ibuf->mall & IB_rect))
MEM_freeN(ibuf->rect);
ibuf->rect= NULL;
@@ -94,12 +94,12 @@ void imb_freetilesImBuf(ImBuf *ibuf)
{
int tx, ty;
- if(ibuf==NULL) return;
+ if (ibuf==NULL) return;
- if(ibuf->tiles && (ibuf->mall & IB_tiles)) {
- for(ty=0; ty<ibuf->ytiles; ty++) {
- for(tx=0; tx<ibuf->xtiles; tx++) {
- if(ibuf->tiles[ibuf->xtiles*ty + tx]) {
+ if (ibuf->tiles && (ibuf->mall & IB_tiles)) {
+ for (ty=0; ty<ibuf->ytiles; ty++) {
+ for (tx=0; tx<ibuf->xtiles; tx++) {
+ if (ibuf->tiles[ibuf->xtiles*ty + tx]) {
imb_tile_cache_tile_free(ibuf, tx, ty);
MEM_freeN(ibuf->tiles[ibuf->xtiles*ty + tx]);
}
@@ -115,9 +115,9 @@ void imb_freetilesImBuf(ImBuf *ibuf)
static void freeencodedbufferImBuf(ImBuf *ibuf)
{
- if(ibuf==NULL) return;
+ if (ibuf==NULL) return;
- if(ibuf->encodedbuffer && (ibuf->mall & IB_mem))
+ if (ibuf->encodedbuffer && (ibuf->mall & IB_mem))
MEM_freeN(ibuf->encodedbuffer);
ibuf->encodedbuffer = NULL;
@@ -128,9 +128,9 @@ static void freeencodedbufferImBuf(ImBuf *ibuf)
void IMB_freezbufImBuf(ImBuf *ibuf)
{
- if(ibuf==NULL) return;
+ if (ibuf==NULL) return;
- if(ibuf->zbuf && (ibuf->mall & IB_zbuf))
+ if (ibuf->zbuf && (ibuf->mall & IB_zbuf))
MEM_freeN(ibuf->zbuf);
ibuf->zbuf= NULL;
@@ -139,9 +139,9 @@ void IMB_freezbufImBuf(ImBuf *ibuf)
void IMB_freezbuffloatImBuf(ImBuf *ibuf)
{
- if(ibuf==NULL) return;
+ if (ibuf==NULL) return;
- if(ibuf->zbuf_float && (ibuf->mall & IB_zbuffloat))
+ if (ibuf->zbuf_float && (ibuf->mall & IB_zbuffloat))
MEM_freeN(ibuf->zbuf_float);
ibuf->zbuf_float= NULL;
@@ -150,8 +150,8 @@ void IMB_freezbuffloatImBuf(ImBuf *ibuf)
void IMB_freeImBuf(ImBuf *ibuf)
{
- if(ibuf) {
- if(ibuf->refcounter > 0) {
+ if (ibuf) {
+ if (ibuf->refcounter > 0) {
ibuf->refcounter--;
}
else {
@@ -189,12 +189,12 @@ short addzbufImBuf(ImBuf *ibuf)
{
int size;
- if(ibuf==NULL) return FALSE;
+ if (ibuf==NULL) return FALSE;
IMB_freezbufImBuf(ibuf);
size = ibuf->x *ibuf->y *sizeof(unsigned int);
- if((ibuf->zbuf = MEM_mapallocN(size, "addzbufImBuf"))) {
+ if ((ibuf->zbuf = MEM_mapallocN(size, "addzbufImBuf"))) {
ibuf->mall |= IB_zbuf;
ibuf->flags |= IB_zbuf;
return TRUE;
@@ -207,12 +207,12 @@ short addzbuffloatImBuf(ImBuf *ibuf)
{
int size;
- if(ibuf==NULL) return FALSE;
+ if (ibuf==NULL) return FALSE;
IMB_freezbuffloatImBuf(ibuf);
size = ibuf->x *ibuf->y *sizeof(float);
- if((ibuf->zbuf_float = MEM_mapallocN(size, "addzbuffloatImBuf"))) {
+ if ((ibuf->zbuf_float = MEM_mapallocN(size, "addzbuffloatImBuf"))) {
ibuf->mall |= IB_zbuffloat;
ibuf->flags |= IB_zbuffloat;
return TRUE;
@@ -224,16 +224,16 @@ short addzbuffloatImBuf(ImBuf *ibuf)
short imb_addencodedbufferImBuf(ImBuf *ibuf)
{
- if(ibuf==NULL) return FALSE;
+ if (ibuf==NULL) return FALSE;
freeencodedbufferImBuf(ibuf);
- if(ibuf->encodedbuffersize == 0)
+ if (ibuf->encodedbuffersize == 0)
ibuf->encodedbuffersize = 10000;
ibuf->encodedsize = 0;
- if((ibuf->encodedbuffer = MEM_mallocN(ibuf->encodedbuffersize, "addencodedbufferImBuf"))) {
+ if ((ibuf->encodedbuffer = MEM_mallocN(ibuf->encodedbuffersize, "addencodedbufferImBuf"))) {
ibuf->mall |= IB_mem;
ibuf->flags |= IB_mem;
return TRUE;
@@ -248,22 +248,23 @@ short imb_enlargeencodedbufferImBuf(ImBuf *ibuf)
unsigned int newsize, encodedsize;
void *newbuffer;
- if(ibuf==NULL) return FALSE;
+ if (ibuf==NULL) return FALSE;
- if(ibuf->encodedbuffersize < ibuf->encodedsize) {
+ if (ibuf->encodedbuffersize < ibuf->encodedsize) {
printf("imb_enlargeencodedbufferImBuf: error in parameters\n");
return FALSE;
}
newsize = 2 *ibuf->encodedbuffersize;
- if(newsize < 10000) newsize = 10000;
+ if (newsize < 10000) newsize = 10000;
newbuffer = MEM_mallocN(newsize, "enlargeencodedbufferImBuf");
- if(newbuffer == NULL) return FALSE;
+ if (newbuffer == NULL) return FALSE;
- if(ibuf->encodedbuffer) {
+ if (ibuf->encodedbuffer) {
memcpy(newbuffer, ibuf->encodedbuffer, ibuf->encodedsize);
- } else {
+ }
+ else {
ibuf->encodedsize = 0;
}
@@ -284,16 +285,16 @@ short imb_addrectfloatImBuf(ImBuf *ibuf)
{
int size;
- if(ibuf==NULL) return FALSE;
+ if (ibuf==NULL) return FALSE;
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
imb_freerectfloatImBuf(ibuf); /* frees mipmap too, hrm */
size = ibuf->x *ibuf->y;
size = size *4 *sizeof(float);
ibuf->channels= 4;
- if((ibuf->rect_float = MEM_mapallocN(size, "imb_addrectfloatImBuf"))) {
+ if ((ibuf->rect_float = MEM_mapallocN(size, "imb_addrectfloatImBuf"))) {
ibuf->mall |= IB_rectfloat;
ibuf->flags |= IB_rectfloat;
return TRUE;
@@ -307,20 +308,20 @@ short imb_addrectImBuf(ImBuf *ibuf)
{
int size;
- if(ibuf==NULL) return FALSE;
+ if (ibuf==NULL) return FALSE;
/* don't call imb_freerectImBuf, it frees mipmaps, this call is used only too give float buffers display */
- if(ibuf->rect && (ibuf->mall & IB_rect))
+ if (ibuf->rect && (ibuf->mall & IB_rect))
MEM_freeN(ibuf->rect);
ibuf->rect= NULL;
size = ibuf->x*ibuf->y;
size = size*sizeof(unsigned int);
- if((ibuf->rect = MEM_mapallocN(size, "imb_addrectImBuf"))) {
+ if ((ibuf->rect = MEM_mapallocN(size, "imb_addrectImBuf"))) {
ibuf->mall |= IB_rect;
ibuf->flags |= IB_rect;
- if(ibuf->planes > 32) return (addzbufImBuf(ibuf));
+ if (ibuf->planes > 32) return (addzbufImBuf(ibuf));
else return TRUE;
}
@@ -329,10 +330,10 @@ short imb_addrectImBuf(ImBuf *ibuf)
short imb_addtilesImBuf(ImBuf *ibuf)
{
- if(ibuf==NULL) return FALSE;
+ if (ibuf==NULL) return FALSE;
- if(!ibuf->tiles)
- if((ibuf->tiles = MEM_callocN(sizeof(unsigned int*)*ibuf->xtiles*ibuf->ytiles, "imb_tiles")))
+ if (!ibuf->tiles)
+ if ((ibuf->tiles = MEM_callocN(sizeof(unsigned int*)*ibuf->xtiles*ibuf->ytiles, "imb_tiles")))
ibuf->mall |= IB_tiles;
return (ibuf->tiles != NULL);
@@ -344,7 +345,7 @@ ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int
ibuf = MEM_callocN(sizeof(ImBuf), "ImBuf_struct");
- if(ibuf) {
+ if (ibuf) {
ibuf->x= x;
ibuf->y= y;
ibuf->planes= planes;
@@ -352,29 +353,29 @@ ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int
ibuf->channels= 4; /* float option, is set to other values when buffers get assigned */
ibuf->ppm[0]= ibuf->ppm[1]= 150.0 / 0.0254; /* 150dpi -> pixels-per-meter */
- if(flags & IB_rect) {
- if(imb_addrectImBuf(ibuf)==FALSE) {
+ if (flags & IB_rect) {
+ if (imb_addrectImBuf(ibuf)==FALSE) {
IMB_freeImBuf(ibuf);
return NULL;
}
}
- if(flags & IB_rectfloat) {
- if(imb_addrectfloatImBuf(ibuf)==FALSE) {
+ if (flags & IB_rectfloat) {
+ if (imb_addrectfloatImBuf(ibuf)==FALSE) {
IMB_freeImBuf(ibuf);
return NULL;
}
}
- if(flags & IB_zbuf) {
- if(addzbufImBuf(ibuf)==FALSE) {
+ if (flags & IB_zbuf) {
+ if (addzbufImBuf(ibuf)==FALSE) {
IMB_freeImBuf(ibuf);
return NULL;
}
}
- if(flags & IB_zbuffloat) {
- if(addzbuffloatImBuf(ibuf)==FALSE) {
+ if (flags & IB_zbuffloat) {
+ if (addzbuffloatImBuf(ibuf)==FALSE) {
IMB_freeImBuf(ibuf);
return NULL;
}
@@ -390,27 +391,27 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1)
int flags = 0;
int a, x, y;
- if(ibuf1 == NULL) return NULL;
+ if (ibuf1 == NULL) return NULL;
- if(ibuf1->rect) flags |= IB_rect;
- if(ibuf1->rect_float) flags |= IB_rectfloat;
+ if (ibuf1->rect) flags |= IB_rect;
+ if (ibuf1->rect_float) flags |= IB_rectfloat;
x = ibuf1->x;
y = ibuf1->y;
- if(ibuf1->flags & IB_fields) y *= 2;
+ if (ibuf1->flags & IB_fields) y *= 2;
ibuf2 = IMB_allocImBuf(x, y, ibuf1->planes, flags);
- if(ibuf2 == NULL) return NULL;
+ if (ibuf2 == NULL) return NULL;
- if(flags & IB_rect)
+ if (flags & IB_rect)
memcpy(ibuf2->rect, ibuf1->rect, x *y *sizeof(int));
- if(flags & IB_rectfloat)
+ if (flags & IB_rectfloat)
memcpy(ibuf2->rect_float, ibuf1->rect_float, ibuf1->channels *x *y *sizeof(float));
- if(ibuf1->encodedbuffer) {
+ if (ibuf1->encodedbuffer) {
ibuf2->encodedbuffersize = ibuf1->encodedbuffersize;
- if(imb_addencodedbufferImBuf(ibuf2) == FALSE) {
+ if (imb_addencodedbufferImBuf(ibuf2) == FALSE) {
IMB_freeImBuf(ibuf2);
return NULL;
}
@@ -427,7 +428,7 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1)
tbuf.encodedbuffer = ibuf2->encodedbuffer;
tbuf.zbuf= NULL;
tbuf.zbuf_float= NULL;
- for(a=0; a<IB_MIPMAP_LEVELS; a++)
+ for (a=0; a<IB_MIPMAP_LEVELS; a++)
tbuf.mipmap[a]= NULL;
// set malloc flag
@@ -464,7 +465,7 @@ static MEM_CacheLimiterC **get_imbuf_cache_limiter(void)
{
static MEM_CacheLimiterC *c = NULL;
- if(!c)
+ if (!c)
c = new_MEM_CacheLimiter(imbuf_cache_destructor, NULL);
return &c;
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 2719f2e296b..5ef783fe968 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -135,21 +135,23 @@ static int an_stringdec(const char *string, char* head, char *tail, unsigned sho
len=strlen(string);
nume = len;
- for(i=len-1;i>=0;i--){
+ for (i=len-1;i>=0;i--) {
if (string[i]==PATHSEPERATOR) break;
if (isdigit(string[i])) {
- if (found){
+ if (found) {
nums=i;
- } else{
+ }
+ else {
nume=i;
nums=i;
found=TRUE;
}
- } else{
+ }
+ else {
if (found) break;
}
}
- if (found){
+ if (found) {
strcpy(tail ,&string[nume+1]);
strcpy(head, string);
head[nums]= '\0';
@@ -188,7 +190,7 @@ static void free_anim_avi (struct anim *anim)
anim->pgf = NULL;
}
- for (i = 0; i < anim->avistreams; i++){
+ for (i = 0; i < anim->avistreams; i++) {
AVIStreamRelease(anim->pavi[i]);
}
anim->avistreams = 0;
@@ -315,7 +317,8 @@ static int startavi (struct anim *anim)
lpbi = (LPBITMAPINFOHEADER)abFormat;
anim->avi->header->Height = lpbi->biHeight;
anim->avi->header->Width = lpbi->biWidth;
- } else {
+ }
+ else {
FIXCC(avis.fccHandler);
FIXCC(avis.fccType);
printf("Can't find AVI decoder for type : %4.4hs/%4.4hs\n",
@@ -333,11 +336,13 @@ static int startavi (struct anim *anim)
//
if ((anim->avistreams == 0) || (firstvideo == -1)) {
avierror = AVI_ERROR_FORMAT;
- } else {
+ }
+ else {
avierror = AVI_ERROR_NONE;
anim->firstvideo = firstvideo;
}
- } else {
+ }
+ else {
AVIFileExit();
}
}
@@ -386,7 +391,8 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position)
//Oh brother...
}
}
- } else {
+ }
+ else {
#else
if (1) {
#endif
@@ -442,11 +448,11 @@ static int startffmpeg(struct anim * anim)
do_init_ffmpeg();
- if(av_open_input_file(&pFormatCtx, anim->name, NULL, 0, NULL)!=0) {
+ if (av_open_input_file(&pFormatCtx, anim->name, NULL, 0, NULL)!=0) {
return -1;
}
- if(av_find_stream_info(pFormatCtx)<0) {
+ if (av_find_stream_info(pFormatCtx)<0) {
av_close_input_file(pFormatCtx);
return -1;
}
@@ -457,7 +463,7 @@ static int startffmpeg(struct anim * anim)
/* Find the video stream */
videoStream = -1;
- for(i = 0; i < pFormatCtx->nb_streams; i++)
+ for (i = 0; i < pFormatCtx->nb_streams; i++)
if (pFormatCtx->streams[i]->codec->codec_type
== AVMEDIA_TYPE_VIDEO) {
if (streamcount > 0) {
@@ -468,7 +474,7 @@ static int startffmpeg(struct anim * anim)
break;
}
- if(videoStream==-1) {
+ if (videoStream==-1) {
av_close_input_file(pFormatCtx);
return -1;
}
@@ -477,14 +483,14 @@ static int startffmpeg(struct anim * anim)
/* Find the decoder for the video stream */
pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
- if(pCodec == NULL) {
+ if (pCodec == NULL) {
av_close_input_file(pFormatCtx);
return -1;
}
pCodecCtx->workaround_bugs = 1;
- if(avcodec_open(pCodecCtx, pCodec) < 0) {
+ if (avcodec_open(pCodecCtx, pCodec) < 0) {
av_close_input_file(pFormatCtx);
return -1;
}
@@ -554,7 +560,8 @@ static int startffmpeg(struct anim * anim)
if (pCodecCtx->has_b_frames) {
anim->preseek = 25; /* FIXME: detect gopsize ... */
- } else {
+ }
+ else {
anim->preseek = 0;
}
@@ -588,7 +595,7 @@ static int startffmpeg(struct anim * anim)
srcRange = srcRange || anim->pCodecCtx->color_range == AVCOL_RANGE_JPEG;
inv_table = sws_getCoefficients(anim->pCodecCtx->colorspace);
- if(sws_setColorspaceDetails(anim->img_convert_ctx, (int *)inv_table, srcRange,
+ if (sws_setColorspaceDetails(anim->img_convert_ctx, (int *)inv_table, srcRange,
table, dstRange, brightness, contrast, saturation)) {
printf("Warning: Could not set libswscale colorspace details.\n");
@@ -623,7 +630,7 @@ static void ffmpeg_postprocess(struct anim * anim)
/* This means the data wasnt read properly,
* this check stops crashing */
if (input->data[0]==0 && input->data[1]==0
- && input->data[2]==0 && input->data[3]==0){
+ && input->data[2]==0 && input->data[3]==0) {
fprintf(stderr, "ffmpeg_fetchibuf: "
"data not read properly...\n");
return;
@@ -646,7 +653,8 @@ static void ffmpeg_postprocess(struct anim * anim)
anim->pCodecCtx->height)
< 0) {
filter_y = TRUE;
- } else {
+ }
+ else {
input = anim->pFrameDeinterlaced;
}
}
@@ -701,7 +709,8 @@ static void ffmpeg_postprocess(struct anim * anim)
}
top -= 8 * w;
}
- } else {
+ }
+ else {
int * dstStride = anim->pFrameRGB->linesize;
uint8_t** dst = anim->pFrameRGB->data;
int dstStride2[4] = { -dstStride[0], 0, 0, 0 };
@@ -735,7 +744,7 @@ static int ffmpeg_decode_video_frame(struct anim * anim)
anim->next_packet.stream_index = -1;
}
- while((rval = av_read_frame(anim->pFormatCtx, &anim->next_packet)) >= 0) {
+ while ((rval = av_read_frame(anim->pFormatCtx, &anim->next_packet)) >= 0) {
av_log(anim->pFormatCtx,
AV_LOG_DEBUG,
"%sREAD: strID=%d (VID: %d) dts=%lld pts=%lld "
@@ -821,7 +830,8 @@ static void ffmpeg_decode_video_frame_scan(
if (anim->next_pts == pts_to_search) {
av_log(anim->pFormatCtx,
AV_LOG_DEBUG, "SCAN HAPPY: we found our PTS!\n");
- } else {
+ }
+ else {
av_log(anim->pFormatCtx,
AV_LOG_ERROR, "SCAN UNHAPPY: PTS not matched!\n");
}
@@ -900,7 +910,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
tc_index, anim->curposition);
pts_to_search = IMB_indexer_get_pts(
tc_index, new_frame_index);
- } else {
+ }
+ else {
pts_to_search = (long long)
floor(((double) position)
/ pts_time_base / frame_rate + 0.5);
@@ -917,7 +928,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
(long long int)pts_to_search,pts_time_base, frame_rate, st_time);
if (anim->last_frame &&
- anim->last_pts <= pts_to_search && anim->next_pts > pts_to_search){
+ anim->last_pts <= pts_to_search && anim->next_pts > pts_to_search) {
av_log(anim->pFormatCtx, AV_LOG_DEBUG,
"FETCH: frame repeat: last: %lld next: %lld\n",
(long long int)anim->last_pts,
@@ -935,7 +946,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
"FETCH: within preseek interval (no index)\n");
ffmpeg_decode_video_frame_scan(anim, pts_to_search);
- } else if (tc_index &&
+ }
+ else if (tc_index &&
IMB_indexer_can_scan(tc_index, old_frame_index,
new_frame_index)) {
@@ -944,7 +956,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
"(index tells us)\n");
ffmpeg_decode_video_frame_scan(anim, pts_to_search);
- } else if (position != anim->curposition + 1) {
+ }
+ else if (position != anim->curposition + 1) {
long long pos;
int ret;
@@ -969,14 +982,16 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
-1,
pos, AVSEEK_FLAG_BYTE);
av_update_cur_dts(anim->pFormatCtx, v_st, dts);
- } else {
+ }
+ else {
av_log(anim->pFormatCtx, AV_LOG_DEBUG,
"... using DTS pos\n");
ret = av_seek_frame(anim->pFormatCtx,
anim->videoStream,
dts, AVSEEK_FLAG_BACKWARD);
}
- } else {
+ }
+ else {
pos = (long long) (position - anim->preseek)
* AV_TIME_BASE / frame_rate;
@@ -1021,10 +1036,12 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
if (ret >= 0) {
ffmpeg_decode_video_frame_scan(anim, pts_to_search);
}
- } else if (position == 0 && anim->curposition == -1) {
+ }
+ else if (position == 0 && anim->curposition == -1) {
/* first frame without seeking special case... */
ffmpeg_decode_video_frame(anim);
- } else {
+ }
+ else {
av_log(anim->pFormatCtx, AV_LOG_DEBUG,
"FETCH: no seek necessary, just continue...\n");
}
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c
index 1b6184c8b58..768aa518742 100644
--- a/source/blender/imbuf/intern/bmp.c
+++ b/source/blender/imbuf/intern/bmp.c
@@ -78,7 +78,8 @@ static int checkbmp(unsigned char *mem)
if ((mem[0] == 'B') && (mem[1] == 'M')) {
/* skip fileheader */
mem += BMP_FILEHEADER_SIZE;
- } else {
+ }
+ else {
}
/* for systems where an int needs to be 4 bytes aligned */
@@ -138,7 +139,8 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags)
if (flags & IB_test) {
ibuf = IMB_allocImBuf(x, y, depth, 0);
- } else {
+ }
+ else {
ibuf = IMB_allocImBuf(x, y, depth, IB_rect);
bmp = mem + skip;
rect = (unsigned char *) ibuf->rect;
@@ -154,7 +156,8 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags)
rect += 4; bmp += 2;
}
- } else if (depth == 24) {
+ }
+ else if (depth == 24) {
for (i = y; i > 0; i--) {
int j;
for (j = x ; j > 0; j--) {
@@ -168,7 +171,8 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags)
/* for 24-bit images, rows are padded to multiples of 4 */
bmp += x % 4;
}
- } else if (depth == 32) {
+ }
+ else if (depth == 32) {
for (i = x * y; i > 0; i--) {
rect[0] = bmp[2];
rect[1] = bmp[1];
@@ -216,7 +220,7 @@ int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags)
bytesize = (ibuf->x * 3 + extrabytes) * ibuf->y;
data = (uchar *) ibuf->rect;
- ofile = fopen(name,"wb");
+ ofile = BLI_fopen(name,"wb");
if (!ofile) return 0;
putShortLSB(19778,ofile); /* "BM" */
diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c
index 3bac570da4e..ba9b118d185 100644
--- a/source/blender/imbuf/intern/cache.c
+++ b/source/blender/imbuf/intern/cache.c
@@ -106,8 +106,8 @@ static int imb_global_tile_cmp(const void *a_p, const void *b_p)
const ImGlobalTile *a= a_p;
const ImGlobalTile *b= b_p;
- if(a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0;
- else if(a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1;
+ if (a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0;
+ else if (a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1;
else return 1;
}
@@ -123,8 +123,8 @@ static int imb_thread_tile_cmp(const void *a_p, const void *b_p)
const ImThreadTile *a= a_p;
const ImThreadTile *b= b_p;
- if(a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0;
- else if(a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1;
+ if (a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0;
+ else if (a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1;
else return 1;
}
@@ -164,9 +164,9 @@ void imb_tile_cache_tile_free(ImBuf *ibuf, int tx, int ty)
lookuptile.ty = ty;
gtile= BLI_ghash_lookup(GLOBAL_CACHE.tilehash, &lookuptile);
- if(gtile) {
+ if (gtile) {
/* in case another thread is loading this */
- while(gtile->loading)
+ while (gtile->loading)
;
BLI_ghash_remove(GLOBAL_CACHE.tilehash, gtile, NULL, NULL);
@@ -189,7 +189,7 @@ static void imb_thread_cache_init(ImThreadTileCache *cache)
cache->tilehash= BLI_ghash_new(imb_thread_tile_hash, imb_thread_tile_cmp, "imb_thread_cache_init gh");
/* pre-allocate all thread local tiles in unused list */
- for(a=0; a<IB_THREAD_CACHE_SIZE; a++) {
+ for (a=0; a<IB_THREAD_CACHE_SIZE; a++) {
ttile= BLI_memarena_alloc(GLOBAL_CACHE.memarena, sizeof(ImThreadTile));
BLI_addtail(&cache->unused, ttile);
}
@@ -218,17 +218,17 @@ void imb_tile_cache_exit(void)
ImGlobalTile *gtile;
int a;
- if(GLOBAL_CACHE.initialized) {
- for(gtile=GLOBAL_CACHE.tiles.first; gtile; gtile=gtile->next)
+ if (GLOBAL_CACHE.initialized) {
+ for (gtile=GLOBAL_CACHE.tiles.first; gtile; gtile=gtile->next)
imb_global_cache_tile_unload(gtile);
- for(a=0; a<GLOBAL_CACHE.totthread; a++)
+ for (a=0; a<GLOBAL_CACHE.totthread; a++)
imb_thread_cache_exit(&GLOBAL_CACHE.thread_cache[a]);
- if(GLOBAL_CACHE.memarena)
+ if (GLOBAL_CACHE.memarena)
BLI_memarena_free(GLOBAL_CACHE.memarena);
- if(GLOBAL_CACHE.tilehash)
+ if (GLOBAL_CACHE.tilehash)
BLI_ghash_free(GLOBAL_CACHE.tilehash, NULL, NULL);
BLI_mutex_end(&GLOBAL_CACHE.mutex);
@@ -246,7 +246,7 @@ void IMB_tile_cache_params(int totthread, int maxmem)
totthread++;
/* lazy initialize cache */
- if(GLOBAL_CACHE.totthread == totthread && GLOBAL_CACHE.maxmem == maxmem)
+ if (GLOBAL_CACHE.totthread == totthread && GLOBAL_CACHE.maxmem == maxmem)
return;
imb_tile_cache_exit();
@@ -261,7 +261,7 @@ void IMB_tile_cache_params(int totthread, int maxmem)
GLOBAL_CACHE.maxmem= maxmem*1024*1024;
GLOBAL_CACHE.totthread= totthread;
- for(a=0; a<totthread; a++)
+ for (a=0; a<totthread; a++)
imb_thread_cache_init(&GLOBAL_CACHE.thread_cache[a]);
BLI_mutex_init(&GLOBAL_CACHE.mutex);
@@ -275,7 +275,7 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf, int tx, int ty, ImGl
BLI_mutex_lock(&GLOBAL_CACHE.mutex);
- if(replacetile)
+ if (replacetile)
replacetile->refcount--;
/* find tile in global cache */
@@ -284,7 +284,7 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf, int tx, int ty, ImGl
lookuptile.ty = ty;
gtile= BLI_ghash_lookup(GLOBAL_CACHE.tilehash, &lookuptile);
- if(gtile) {
+ if (gtile) {
/* found tile. however it may be in the process of being loaded
* by another thread, in that case we do stupid busy loop waiting
* for the other thread to load the tile */
@@ -292,21 +292,21 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf, int tx, int ty, ImGl
BLI_mutex_unlock(&GLOBAL_CACHE.mutex);
- while(gtile->loading)
+ while (gtile->loading)
;
}
else {
/* not found, let's load it from disk */
/* first check if we hit the memory limit */
- if(GLOBAL_CACHE.maxmem && GLOBAL_CACHE.totmem > GLOBAL_CACHE.maxmem) {
+ if (GLOBAL_CACHE.maxmem && GLOBAL_CACHE.totmem > GLOBAL_CACHE.maxmem) {
/* find an existing tile to unload */
- for(gtile=GLOBAL_CACHE.tiles.last; gtile; gtile=gtile->prev)
- if(gtile->refcount == 0 && gtile->loading == 0)
+ for (gtile=GLOBAL_CACHE.tiles.last; gtile; gtile=gtile->prev)
+ if (gtile->refcount == 0 && gtile->loading == 0)
break;
}
- if(gtile) {
+ if (gtile) {
/* found a tile to unload */
imb_global_cache_tile_unload(gtile);
BLI_ghash_remove(GLOBAL_CACHE.tilehash, gtile, NULL, NULL);
@@ -314,7 +314,7 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf, int tx, int ty, ImGl
}
else {
/* allocate a new tile or reuse unused */
- if(GLOBAL_CACHE.unused.first) {
+ if (GLOBAL_CACHE.unused.first) {
gtile= GLOBAL_CACHE.unused.first;
BLI_remlink(&GLOBAL_CACHE.unused, gtile);
}
@@ -356,9 +356,9 @@ static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache, ImBuf *
int toffs= ibuf->xtiles*ty + tx;
/* test if it is already in our thread local cache */
- if((ttile=cache->tiles.first)) {
+ if ((ttile=cache->tiles.first)) {
/* check last used tile before going to hash */
- if(ttile->ibuf == ibuf && ttile->tx == tx && ttile->ty == ty)
+ if (ttile->ibuf == ibuf && ttile->tx == tx && ttile->ty == ty)
return ibuf->tiles[toffs];
/* find tile in hash */
@@ -366,7 +366,7 @@ static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache, ImBuf *
lookuptile.tx = tx;
lookuptile.ty = ty;
- if((ttile=BLI_ghash_lookup(cache->tilehash, &lookuptile))) {
+ if ((ttile=BLI_ghash_lookup(cache->tilehash, &lookuptile))) {
BLI_remlink(&cache->tiles, ttile);
BLI_addhead(&cache->tiles, ttile);
@@ -375,7 +375,7 @@ static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache, ImBuf *
}
/* not found, have to do slow lookup in global cache */
- if(cache->unused.first == NULL) {
+ if (cache->unused.first == NULL) {
ttile= cache->tiles.last;
replacetile= ttile->global;
BLI_remlink(&cache->tiles, ttile);
@@ -412,12 +412,12 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
unsigned int *to, *from;
int a, tx, ty, y, w, h;
- for(a=0; a<ibuf->miptot; a++) {
+ for (a=0; a<ibuf->miptot; a++) {
mipbuf= IMB_getmipmap(ibuf, a);
/* don't call imb_addrectImBuf, it frees all mipmaps */
- if(!mipbuf->rect) {
- if((mipbuf->rect = MEM_mapallocN(ibuf->x*ibuf->y*sizeof(unsigned int), "imb_addrectImBuf"))) {
+ if (!mipbuf->rect) {
+ if ((mipbuf->rect = MEM_mapallocN(ibuf->x*ibuf->y*sizeof(unsigned int), "imb_addrectImBuf"))) {
mipbuf->mall |= IB_rect;
mipbuf->flags |= IB_rect;
}
@@ -425,8 +425,8 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
break;
}
- for(ty=0; ty<mipbuf->ytiles; ty++) {
- for(tx=0; tx<mipbuf->xtiles; tx++) {
+ for (ty=0; ty<mipbuf->ytiles; ty++) {
+ for (tx=0; tx<mipbuf->xtiles; tx++) {
/* acquire tile through cache, this assumes cache is initialized,
* which it is always now but it's a weak assumption ... */
gtile= imb_global_cache_get_tile(mipbuf, tx, ty, NULL);
@@ -439,7 +439,7 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
w= (tx == mipbuf->xtiles-1)? mipbuf->x - tx*mipbuf->tilex: mipbuf->tilex;
h= (ty == mipbuf->ytiles-1)? mipbuf->y - ty*mipbuf->tiley: mipbuf->tiley;
- for(y=0; y<h; y++) {
+ for (y=0; y<h; y++) {
memcpy(to, from, sizeof(unsigned int)*w);
from += mipbuf->tilex;
to += mipbuf->x;
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index af964bb2bb3..c1222d3cea3 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -154,7 +154,7 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon
if (!logImage) return 0;
- if(logImageSetByteConversion(logImage, &conversion)==0) {
+ if (logImageSetByteConversion(logImage, &conversion)==0) {
printf("error setting args\n");
}
@@ -184,7 +184,7 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon
MEM_freeN(line);
- if(is_alloc) {
+ if (is_alloc) {
MEM_freeN(fbuf);
}
@@ -204,7 +204,7 @@ int imb_is_cineon(unsigned char *buf)
ImBuf *imb_loadcineon(unsigned char *mem, size_t size, int flags)
{
- if(imb_is_cineon(mem))
+ if (imb_is_cineon(mem))
return imb_load_dpx_cineon(mem, 1, size, flags);
return NULL;
}
@@ -221,7 +221,7 @@ int imb_is_dpx(unsigned char *buf)
ImBuf *imb_loaddpx(unsigned char *mem, size_t size, int flags)
{
- if(imb_is_dpx(mem))
+ if (imb_is_dpx(mem))
return imb_load_dpx_cineon(mem, 0, size, flags);
return NULL;
}
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index 810ed7b26a4..ae9f8e0fe97 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -38,6 +38,7 @@
#include <string.h> /* memset */
#include "BLI_utildefines.h"
+#include "BLI_fileops.h"
#include "cin_debug_stuff.h"
#include "logmemfile.h"
@@ -135,7 +136,8 @@ fillCineonImageInfo(CineonFile* cineon, CineonImageInformation* imageInfo) {
if (cineon->depth == 1) {
fillCineonChannelInfo(cineon, &imageInfo->channel[0], 0);
- } else if (cineon->depth == 3) {
+ }
+ else if (cineon->depth == 3) {
fillCineonChannelInfo(cineon, &imageInfo->channel[0], 1);
fillCineonChannelInfo(cineon, &imageInfo->channel[1], 2);
fillCineonChannelInfo(cineon, &imageInfo->channel[2], 3);
@@ -214,7 +216,8 @@ dumpCineonFormatInfo(CineonFormatInformation* formatInfo) {
d_printf("Packing %d,", formatInfo->packing);
if (formatInfo->packing & 0x80) {
d_printf(" multi pixel,");
- } else {
+ }
+ else {
d_printf(" single pixel,");
}
switch (formatInfo->packing & 0x7F) {
@@ -230,13 +233,15 @@ dumpCineonFormatInfo(CineonFormatInformation* formatInfo) {
d_printf("Sign %d,", formatInfo->signage);
if (formatInfo->signage) {
d_printf(" signed\n");
- } else {
+ }
+ else {
d_printf(" unsigned\n");
}
d_printf("Sense %d,", formatInfo->signage);
if (formatInfo->signage) {
d_printf(" negative\n");
- } else {
+ }
+ else {
d_printf(" positive\n");
}
d_printf("End of line padding %ld\n", (intptr_t)ntohl(formatInfo->line_padding));
@@ -361,7 +366,7 @@ cineonGetRowBytes(CineonFile* cineon, unsigned short* row, int y) {
/* extract required pixels */
for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
- if(cineon->params.doLogarithm)
+ if (cineon->params.doLogarithm)
row[pixelIndex] = cineon->lut10_16[cineon->pixelBuffer[pixelIndex]];
else
row[pixelIndex] = cineon->pixelBuffer[pixelIndex] << 6;
@@ -380,7 +385,7 @@ cineonSetRowBytes(CineonFile* cineon, const unsigned short* row, int y) {
/* put new pixels into pixelBuffer */
for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
- if(cineon->params.doLogarithm)
+ if (cineon->params.doLogarithm)
cineon->pixelBuffer[pixelIndex] = cineon->lut16_16[row[pixelIndex]];
else
cineon->pixelBuffer[pixelIndex] = row[pixelIndex] >> 6;
@@ -523,7 +528,7 @@ cineonOpen(const char* filename) {
cineon->memcursor = 0;
cineon->membuffersize = 0;
- cineon->file = fopen(filename, "rb");
+ cineon->file = BLI_fopen(filename, "rb");
if (cineon->file == 0) {
if (verbose) d_printf("Failed to open file \"%s\".\n", filename);
cineonClose(cineon);
@@ -603,7 +608,8 @@ int cineonIsMemFileCineon(unsigned char *mem)
if (num != ntohl(CINEON_FILE_MAGIC)) {
return 0;
- } else return 1;
+ }
+ else return 1;
}
CineonFile*
@@ -727,7 +733,7 @@ cineonCreate(const char* filename, int width, int height, int depth) {
cineon->lineBuffer = 0;
cineon->pixelBuffer = 0;
- cineon->file = fopen(filename, "wb");
+ cineon->file = BLI_fopen(filename, "wb");
if (cineon->file == 0) {
if (verbose) d_printf("Couldn't open file %s\n", filename);
cineonClose(cineon);
@@ -762,7 +768,8 @@ cineonCreate(const char* filename, int width, int height, int depth) {
shortFilename = strrchr(filename, '/');
if (shortFilename == 0) {
shortFilename = filename;
- } else {
+ }
+ else {
++shortFilename;
}
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index a63a2ea1dab..c9b9901a495 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -38,6 +38,7 @@
#include <string.h> /* memset */
#include "cin_debug_stuff.h"
#include "logmemfile.h"
+#include "BLI_fileops.h"
static void
fillDpxChannelInfo(DpxFile* dpx, DpxChannelInformation* chan, int des) {
@@ -141,7 +142,8 @@ fillDpxImageInfo(
if (dpx->depth == 1) {
fillDpxChannelInfo(dpx, &imageInfo->channel[0], 0);
- } else if (dpx->depth == 3) {
+ }
+ else if (dpx->depth == 3) {
fillDpxChannelInfo(dpx, &imageInfo->channel[0], 50);
}
}
@@ -269,7 +271,8 @@ dpxGetRowBytes(DpxFile* dpx, unsigned short* row, int y) {
dpx->pixelBuffer[pixelIndex+2] = t & 0x3ff;
pixelIndex += 3;
}
- } else /* if (dpx->depth == 3) */ {
+ }
+ else /* if (dpx->depth == 3) */ {
for (longIndex = 0; longIndex < readLongs; ++longIndex) {
unsigned int t = ntohl(dpx->lineBuffer[longIndex]);
t = t >> 2;
@@ -285,7 +288,7 @@ dpxGetRowBytes(DpxFile* dpx, unsigned short* row, int y) {
/* extract required pixels */
for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
- if(dpx->params.doLogarithm)
+ if (dpx->params.doLogarithm)
row[pixelIndex] = dpx->lut10_16[dpx->pixelBuffer[pixelIndex]];
else
row[pixelIndex] = dpx->pixelBuffer[pixelIndex] << 6;
@@ -328,7 +331,7 @@ dpxSetRowBytes(DpxFile* dpx, const unsigned short* row, int y) {
/* put new pixels into pixelBuffer */
for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
- if(dpx->params.doLogarithm)
+ if (dpx->params.doLogarithm)
dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = dpx->lut16_16[row[pixelIndex]];
else
dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = row[pixelIndex] >> 6;
@@ -350,7 +353,8 @@ dpxSetRowBytes(DpxFile* dpx, const unsigned short* row, int y) {
dpx->lineBuffer[longIndex] = htonl(t);
pixelIndex += 3;
}
- } else {
+ }
+ else {
for (longIndex = 0; longIndex < writeLongs; ++longIndex) {
unsigned int t = dpx->pixelBuffer[pixelIndex+2] << 2 |
(dpx->pixelBuffer[pixelIndex+1] << 12) |
@@ -401,7 +405,7 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) {
if (mode == LFREALFILE) {
filename = bytestuff;
- dpx->file = fopen(filename, "rb");
+ dpx->file = BLI_fopen(filename, "rb");
if (dpx->file == 0) {
if (verbose) d_printf("Failed to open file \"%s\".\n", filename);
dpxClose(dpx);
@@ -410,7 +414,8 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) {
dpx->membuffer = 0;
dpx->memcursor = 0;
dpx->membuffersize = 0;
- } else if (mode == LFMEMFILE) {
+ }
+ else if (mode == LFMEMFILE) {
dpx->membuffer = (unsigned char *)bytestuff;
dpx->memcursor = (unsigned char *)bytestuff;
dpx->membuffersize = bufsize;
@@ -589,7 +594,7 @@ dpxCreate(const char* filename, int width, int height, int depth) {
dpx->lineBuffer = 0;
dpx->pixelBuffer = 0;
- dpx->file = fopen(filename, "wb");
+ dpx->file = BLI_fopen(filename, "wb");
if (dpx->file == 0) {
if (verbose) d_printf("Couldn't open file %s\n", filename);
dpxClose(dpx);
@@ -624,7 +629,8 @@ dpxCreate(const char* filename, int width, int height, int depth) {
shortFilename = strrchr(filename, '/');
if (shortFilename == 0) {
shortFilename = filename;
- } else {
+ }
+ else {
++shortFilename;
}
initDpxMainHeader(dpx, &header, shortFilename);
@@ -687,7 +693,7 @@ dpxDump(const char* filename) {
DpxMainHeader header;
FILE* file;
- file = fopen(filename, "rb");
+ file = BLI_fopen(filename, "rb");
if (file == 0) {
d_printf("Failed to open file \"%s\".\n", filename);
return;
diff --git a/source/blender/imbuf/intern/cineon/logImageLib.c b/source/blender/imbuf/intern/cineon/logImageLib.c
index 123d0b42979..f97df005fc8 100644
--- a/source/blender/imbuf/intern/cineon/logImageLib.c
+++ b/source/blender/imbuf/intern/cineon/logImageLib.c
@@ -36,6 +36,7 @@
#include <netinet/in.h> /* htonl() */
#endif
#include <string.h> /* memset */
+#include "BLI_fileops.h"
#define MIN_GAMMA 0.01
#define MAX_GAMMA 99.9
@@ -55,7 +56,8 @@ logImageOpen(const char* filename, int cineon)
{
if (cineon) {
return cineonOpen(filename);
- } else {
+ }
+ else {
return dpxOpen(filename);
}
return 0;
@@ -66,7 +68,8 @@ logImageOpenFromMem(unsigned char *buffer, unsigned int size, int cineon)
{
if (cineon) {
return cineonOpenFromMem(buffer, size);
- } else {
+ }
+ else {
return dpxOpenFromMem(buffer, size);
}
return 0;
@@ -77,7 +80,8 @@ logImageCreate(const char* filename, int cineon, int width, int height, int dept
{
if (cineon) {
return cineonCreate(filename, width, height, depth);
- } else {
+ }
+ else {
return dpxCreate(filename, width, height, depth);
}
return 0;
@@ -154,7 +158,7 @@ logImageDump(const char* filename)
U32 magic;
- FILE* foo = fopen(filename, "rb");
+ FILE* foo = BLI_fopen(filename, "rb");
if (foo == 0) {
return;
}
@@ -170,7 +174,8 @@ logImageDump(const char* filename)
#if 0
cineonDump(filename);
#endif
- } else if (magic == ntohl(DPX_FILE_MAGIC)) {
+ }
+ else if (magic == ntohl(DPX_FILE_MAGIC)) {
dpxDump(filename);
}
}
diff --git a/source/blender/imbuf/intern/cineon/logmemfile.c b/source/blender/imbuf/intern/cineon/logmemfile.c
index 289dd0357a4..3db4241cc14 100644
--- a/source/blender/imbuf/intern/cineon/logmemfile.c
+++ b/source/blender/imbuf/intern/cineon/logmemfile.c
@@ -39,10 +39,12 @@ int logimage_fseek(void* logfile, intptr_t offsett, int origin)
if (origin==SEEK_SET) {
if (offset > file->membuffersize) return 1;
file->memcursor = file->membuffer + offset;
- } else if (origin==SEEK_END) {
+ }
+ else if (origin==SEEK_END) {
if (offset > file->membuffersize) return 1;
file->memcursor = (file->membuffer + file->membuffersize) - offset;
- } else if (origin==SEEK_CUR) {
+ }
+ else if (origin==SEEK_CUR) {
uintptr_t pos = (uintptr_t)file->membuffer - (uintptr_t)file->memcursor;
if (pos + offset > file->membuffersize) return 1;
if (pos < 0) return 1;
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp
index 2ea255234e5..f5e9e536e41 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.cpp
+++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp
@@ -90,7 +90,7 @@ uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const
// c.u |= (c.u >> 6) & 0x000300;
// color_array[1].u = c.u;
- if( col0.u > col1.u ) {
+ if ( col0.u > col1.u ) {
// Four-color block: derive the other two colors.
color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3;
color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
@@ -135,27 +135,27 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
color_array[1].b = (3 * col1.b * 22) / 8;
color_array[1].a = 0xFF;
- int gdiff = color_array[1].g - color_array[0].g;
+ int gdiff = color_array[1].g - color_array[0].g;
- if( col0.u > col1.u ) {
+ if ( col0.u > col1.u ) {
// Four-color block: derive the other two colors.
- color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8;
- color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256;
- color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8;
+ color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8;
+ color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256;
+ color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8;
color_array[2].a = 0xFF;
- color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8;
- color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256;
- color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8;
+ color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8;
+ color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256;
+ color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8;
color_array[3].a = 0xFF;
return 4;
}
else {
// Three-color block: derive the other color.
- color_array[2].r = ((col0.r + col1.r) * 33) / 8;
- color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
- color_array[2].b = ((col0.b + col1.b) * 33) / 8;
+ color_array[2].r = ((col0.r + col1.r) * 33) / 8;
+ color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
+ color_array[2].b = ((col0.b + col1.b) * 33) / 8;
color_array[2].a = 0xFF;
// Set all components to 0 to match DXT specs.
@@ -227,8 +227,8 @@ void BlockDXT1::decodeBlock(ColorBlock * block) const
evaluatePalette(color_array);
// Write color block.
- for( uint j = 0; j < 4; j++ ) {
- for( uint i = 0; i < 4; i++ ) {
+ for ( uint j = 0; j < 4; j++ ) {
+ for ( uint i = 0; i < 4; i++ ) {
uint idx = (row[j] >> (2 * i)) & 3;
block->color(i, j) = color_array[idx];
}
@@ -242,8 +242,8 @@ void BlockDXT1::decodeBlockNV5x(ColorBlock * block) const
evaluatePaletteNV5x(color_array);
// Write color block.
- for( uint j = 0; j < 4; j++ ) {
- for( uint i = 0; i < 4; i++ ) {
+ for ( uint j = 0; j < 4; j++ ) {
+ for ( uint i = 0; i < 4; i++ ) {
uint idx = (row[j] >> (2 * i)) & 3;
block->color(i, j) = color_array[idx];
}
@@ -253,7 +253,7 @@ void BlockDXT1::decodeBlockNV5x(ColorBlock * block) const
void BlockDXT1::setIndices(int * idx)
{
indices = 0;
- for(uint i = 0; i < 16; i++) {
+ for (uint i = 0; i < 16; i++) {
indices |= (idx[i] & 3) << (2 * i);
}
}
@@ -423,7 +423,7 @@ void AlphaBlockDXT5::decodeBlock(ColorBlock * block) const
uint8 index_array[16];
indices(index_array);
- for(uint i = 0; i < 16; i++) {
+ for (uint i = 0; i < 16; i++) {
block->color(i).a = alpha_array[index_array[i]];
}
}
@@ -496,7 +496,7 @@ void BlockATI1::decodeBlock(ColorBlock * block) const
uint8 index_array[16];
alpha.indices(index_array);
- for(uint i = 0; i < 16; i++) {
+ for (uint i = 0; i < 16; i++) {
Color32 & c = block->color(i);
c.b = c.g = c.r = alpha_array[index_array[i]];
c.a = 255;
@@ -525,7 +525,7 @@ void BlockATI2::decodeBlock(ColorBlock * block) const
x.evaluatePalette(alpha_array);
x.indices(index_array);
- for(uint i = 0; i < 16; i++) {
+ for (uint i = 0; i < 16; i++) {
Color32 & c = block->color(i);
c.r = alpha_array[index_array[i]];
}
@@ -533,7 +533,7 @@ void BlockATI2::decodeBlock(ColorBlock * block) const
y.evaluatePalette(alpha_array);
y.indices(index_array);
- for(uint i = 0; i < 16; i++) {
+ for (uint i = 0; i < 16; i++) {
Color32 & c = block->color(i);
c.g = alpha_array[index_array[i]];
c.b = 0;
@@ -587,8 +587,8 @@ void BlockCTX1::decodeBlock(ColorBlock * block) const
evaluatePalette(color_array);
// Write color block.
- for( uint j = 0; j < 4; j++ ) {
- for( uint i = 0; i < 4; i++ ) {
+ for ( uint j = 0; j < 4; j++ ) {
+ for ( uint i = 0; i < 4; i++ ) {
uint idx = (row[j] >> (2 * i)) & 3;
block->color(i, j) = color_array[idx];
}
@@ -598,7 +598,7 @@ void BlockCTX1::decodeBlock(ColorBlock * block) const
void BlockCTX1::setIndices(int * idx)
{
indices = 0;
- for(uint i = 0; i < 16; i++) {
+ for (uint i = 0; i < 16; i++) {
indices |= (idx[i] & 3) << (2 * i);
}
}
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp
index b0c4d0a396e..42ef799cf3e 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.cpp
+++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp
@@ -59,7 +59,7 @@ ColorBlock::ColorBlock()
/// Init the color block from an array of colors.
ColorBlock::ColorBlock(const uint * linearImage)
{
- for(uint i = 0; i < 16; i++) {
+ for (uint i = 0; i < 16; i++) {
color(i) = Color32(linearImage[i]);
}
}
@@ -67,7 +67,7 @@ ColorBlock::ColorBlock(const uint * linearImage)
/// Init the color block with the contents of the given block.
ColorBlock::ColorBlock(const ColorBlock & block)
{
- for(uint i = 0; i < 16; i++) {
+ for (uint i = 0; i < 16; i++) {
color(i) = block.color(i);
}
}
@@ -81,7 +81,7 @@ ColorBlock::ColorBlock(const Image * img, uint x, uint y)
void ColorBlock::init(const Image * img, uint x, uint y)
{
- init(img->width(), img->height(), (const uint *)img->pixels(), x, y);
+ init(img->width(), img->height(), (const uint *)img->pixels(), x, y);
}
void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y)
@@ -89,34 +89,34 @@ void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y)
const uint bw = min(w - x, 4U);
const uint bh = min(h - y, 4U);
- // Blocks that are smaller than 4x4 are handled by repeating the pixels.
- // @@ 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.
+ // Blocks that are smaller than 4x4 are handled by repeating the pixels.
+ // @@ 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++)
- {
- const int by = i % bh;
+ for (uint i = 0; i < 4; i++)
+ {
+ const int by = i % bh;
- for (uint e = 0; e < 4; e++)
- {
- const int bx = e % bw;
- const uint idx = (y + by) * w + x + bx;
+ for (uint e = 0; e < 4; e++)
+ {
+ const int bx = e % bw;
+ const uint idx = (y + by) * w + x + bx;
- color(e, i).u = data[idx];
- }
- }
+ color(e, i).u = data[idx];
+ }
+ }
}
void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y)
{
- const uint bw = min(w - x, 4U);
- const uint bh = min(h - y, 4U);
+ const uint bw = min(w - x, 4U);
+ const uint bh = min(h - y, 4U);
// Blocks that are smaller than 4x4 are handled by repeating the pixels.
// @@ 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.
+ // @@ Ideally we should zero the weights of the pixels out of range.
- uint srcPlane = w * h;
+ uint srcPlane = w * h;
for (uint i = 0; i < 4; i++)
{
@@ -125,13 +125,13 @@ void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y)
for (uint e = 0; e < 4; e++)
{
const uint bx = e % bw;
- const uint idx = ((y + by) * w + x + bx);
+ const uint idx = ((y + by) * w + x + bx);
Color32 & c = color(e, i);
- c.r = uint8(255 * clamp(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes?
- c.g = uint8(255 * clamp(data[idx + 1 * srcPlane], 0.0f, 1.0f));
- c.b = uint8(255 * clamp(data[idx + 2 * srcPlane], 0.0f, 1.0f));
- c.a = uint8(255 * clamp(data[idx + 3 * srcPlane], 0.0f, 1.0f));
+ c.r = uint8(255 * clamp(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes?
+ c.g = uint8(255 * clamp(data[idx + 1 * srcPlane], 0.0f, 1.0f));
+ c.b = uint8(255 * clamp(data[idx + 2 * srcPlane], 0.0f, 1.0f));
+ c.a = uint8(255 * clamp(data[idx + 3 * srcPlane], 0.0f, 1.0f));
}
}
}
@@ -181,7 +181,7 @@ bool ColorBlock::isSingleColorNoAlpha() const
{
Color32 c;
int i;
- for(i = 0; i < 16; i++)
+ for (i = 0; i < 16; i++)
{
if (m_color[i].a != 0) c = m_color[i];
}
@@ -189,7 +189,7 @@ bool ColorBlock::isSingleColorNoAlpha() const
Color32 mask(0xFF, 0xFF, 0xFF, 0x00);
uint u = c.u & mask.u;
- for(; i < 16; i++)
+ for (; i < 16; i++)
{
if (u != (m_color[i].u & mask.u))
{
@@ -207,16 +207,16 @@ bool ColorBlock::isSingleColorNoAlpha() const
uint count = 0;
// @@ This does not have to be o(n^2)
- for(int i = 0; i < 16; i++)
+ for (int i = 0; i < 16; i++)
{
bool unique = true;
- for(int j = 0; j < i; j++) {
- if( m_color[i] != m_color[j] ) {
+ for (int j = 0; j < i; j++) {
+ if ( m_color[i] != m_color[j] ) {
unique = false;
}
}
- if( unique ) {
+ if ( unique ) {
count++;
}
}
@@ -230,7 +230,7 @@ Color32 ColorBlock::averageColor() const
uint r, g, b, a;
r = g = b = a = 0;
- for(uint i = 0; i < 16; i++) {
+ for (uint i = 0; i < 16; i++) {
r += m_color[i].r;
g += m_color[i].g;
b += m_color[i].b;
@@ -258,10 +258,10 @@ void ColorBlock::diameterRange(Color32 * start, Color32 * end) const
Color32 c0, c1;
uint best_dist = 0;
- for(int i = 0; i < 16; i++) {
+ for (int i = 0; i < 16; i++) {
for (int j = i+1; j < 16; j++) {
uint dist = colorDistance(m_color[i], m_color[j]);
- if( dist > best_dist ) {
+ if ( dist > best_dist ) {
best_dist = dist;
c0 = m_color[i];
c1 = m_color[j];
@@ -281,7 +281,7 @@ void ColorBlock::luminanceRange(Color32 * start, Color32 * end) const
maxLuminance = minLuminance = colorLuminance(m_color[0]);
- for(uint i = 1; i < 16; i++)
+ for (uint i = 1; i < 16; i++)
{
uint luminance = colorLuminance(m_color[i]);
@@ -305,7 +305,7 @@ void ColorBlock::boundsRange(Color32 * start, Color32 * end) const
Color32 minColor(255, 255, 255);
Color32 maxColor(0, 0, 0);
- for(uint i = 0; i < 16; i++)
+ for (uint i = 0; i < 16; i++)
{
if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; }
if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; }
@@ -339,7 +339,7 @@ void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const
Color32 minColor(255, 255, 255, 255);
Color32 maxColor(0, 0, 0, 0);
- for(uint i = 0; i < 16; i++)
+ for (uint i = 0; i < 16; i++)
{
if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; }
if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; }
@@ -377,14 +377,14 @@ void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const
void ColorBlock::sortColorsByAbsoluteValue()
{
// Dummy selection sort.
- for( uint a = 0; a < 16; a++ ) {
+ for ( uint a = 0; a < 16; a++ ) {
uint max = a;
Color16 cmax(m_color[a]);
- for( uint b = a+1; b < 16; b++ ) {
+ for ( uint b = a+1; b < 16; b++ ) {
Color16 cb(m_color[b]);
- if( cb.u > cmax.u ) {
+ if ( cb.u > cmax.u ) {
max = b;
cmax = cb;
}
@@ -404,16 +404,16 @@ void ColorBlock::computeRange(Vector3::Arg axis, Color32 * start, Color32 * end)
float min, max;
min = max = dot(Vector3(m_color[0].r, m_color[0].g, m_color[0].b), axis);
- for(uint i = 1; i < 16; i++)
+ for (uint i = 1; i < 16; i++)
{
const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
float val = dot(vec, axis);
- if( val < min ) {
+ if ( val < min ) {
mini = i;
min = val;
}
- else if( val > max ) {
+ else if ( val > max ) {
maxi = i;
max = val;
}
@@ -429,16 +429,16 @@ void ColorBlock::sortColors(const Vector3 & axis)
{
float luma_array[16];
- for(uint i = 0; i < 16; i++) {
+ for (uint i = 0; i < 16; i++) {
const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
luma_array[i] = dot(vec, axis);
}
// Dummy selection sort.
- for( uint a = 0; a < 16; a++ ) {
+ for ( uint a = 0; a < 16; a++ ) {
uint min = a;
- for( uint b = a+1; b < 16; b++ ) {
- if( luma_array[b] < luma_array[min] ) {
+ for ( uint b = a+1; b < 16; b++ ) {
+ if ( luma_array[b] < luma_array[min] ) {
min = b;
}
}
@@ -454,7 +454,7 @@ float ColorBlock::volume() const
Box bounds;
bounds.clearBounds();
- for(int i = 0; i < 16; i++) {
+ for (int i = 0; i < 16; i++) {
const Vector3 point(m_color[i].r, m_color[i].g, m_color[i].b);
bounds.addPointToBounds(point);
}
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index f98f37e388c..e2874652f02 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -803,7 +803,7 @@ void DDSHeader::swapBytes()
this->depth = POSH_LittleU32(this->depth);
this->mipmapcount = POSH_LittleU32(this->mipmapcount);
- for(int i = 0; i < 11; i++) {
+ for (int i = 0; i < 11; i++) {
this->reserved[i] = POSH_LittleU32(this->reserved[i]);
}
@@ -899,7 +899,7 @@ bool DirectDrawSurface::isValid() const
}
const uint required = (DDSD_WIDTH|DDSD_HEIGHT/*|DDSD_CAPS|DDSD_PIXELFORMAT*/);
- if( (header.flags & required) != required ) {
+ if ( (header.flags & required) != required ) {
return false;
}
@@ -909,7 +909,7 @@ bool DirectDrawSurface::isValid() const
/* in some files DDSCAPS_TEXTURE is missing: silently ignore */
/*
- if( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) {
+ if ( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) {
return false;
}
*/
diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp
index b7a3d0e43ba..071d94c2076 100644
--- a/source/blender/imbuf/intern/dds/dds_api.cpp
+++ b/source/blender/imbuf/intern/dds/dds_api.cpp
@@ -81,13 +81,13 @@ struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags)
Color32 pixel;
Color32 *pixels = 0;
- if(!imb_is_a_dds(mem))
+ if (!imb_is_a_dds(mem))
return (0);
/* check if DDS is valid and supported */
if (!dds.isValid()) {
/* no need to print error here, just testing if it is a DDS */
- if(flags & IB_test)
+ if (flags & IB_test)
return (0);
printf("DDS: not valid; header follows\n");
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index 45f58ee9d17..8f8c6311b30 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -118,7 +118,7 @@ DitherContext *create_dither_context(int w, float factor)
di->error_buf= MEM_callocN(4*(w+1)*sizeof(int), "dithering error");
di->e= di->error_buf;
- for(i=0; i<4; ++i)
+ for (i=0; i<4; ++i)
di->v[i]= di->v0[i]= di->v1[i]= 1024.0f*(BLI_frand()-0.5f);
return di;
@@ -134,7 +134,7 @@ static void dither_finish_row(DitherContext *di)
{
int i;
- for(i=0; i<4; i++)
+ for (i=0; i<4; i++)
di->v[i]= di->v0[i]= di->v1[i] = 0;
di->e= di->error_buf;
@@ -200,114 +200,114 @@ void IMB_buffer_byte_from_float(uchar *rect_to, const float *rect_from,
BLI_assert(profile_from != IB_PROFILE_NONE);
BLI_init_srgb_conversion();
- if(dither)
+ if (dither)
di= create_dither_context(width, dither);
- for(y = 0; y < height; y++) {
- if(channels_from == 1) {
+ for (y = 0; y < height; y++) {
+ if (channels_from == 1) {
/* single channel input */
const float *from = rect_from + stride_from*y;
uchar *to = rect_to + stride_to*y*4;
- for(x = 0; x < width; x++, from++, to+=4)
+ for (x = 0; x < width; x++, from++, to+=4)
to[0] = to[1] = to[2] = to[3] = FTOCHAR(from[0]);
}
- else if(channels_from == 3) {
+ else if (channels_from == 3) {
/* RGB input */
const float *from = rect_from + stride_from*y*3;
uchar *to = rect_to + stride_to*y*4;
- if(profile_to == profile_from) {
+ if (profile_to == profile_from) {
/* no color space conversion */
- for(x = 0; x < width; x++, from+=3, to+=4) {
+ for (x = 0; x < width; x++, from+=3, to+=4) {
rgb_float_to_uchar(to, from);
to[3] = 255;
}
}
- else if(profile_to == IB_PROFILE_SRGB) {
+ else if (profile_to == IB_PROFILE_SRGB) {
/* convert from linear to sRGB */
- for(x = 0; x < width; x++, from+=3, to+=4) {
+ for (x = 0; x < width; x++, from+=3, to+=4) {
linearrgb_to_srgb_v3_v3(tmp, from);
rgb_float_to_uchar(to, tmp);
to[3] = 255;
}
}
- else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+ else if (profile_to == IB_PROFILE_LINEAR_RGB) {
/* convert from sRGB to linear */
- for(x = 0; x < width; x++, from+=3, to+=4) {
+ for (x = 0; x < width; x++, from+=3, to+=4) {
srgb_to_linearrgb_v3_v3(tmp, from);
rgb_float_to_uchar(to, tmp);
to[3] = 255;
}
}
}
- else if(channels_from == 4) {
+ else if (channels_from == 4) {
/* RGBA input */
const float *from = rect_from + stride_from*y*4;
uchar *to = rect_to + stride_to*y*4;
- if(profile_to == profile_from) {
+ if (profile_to == profile_from) {
/* no color space conversion */
- if(dither) {
- for(x = 0; x < width; x++, from+=4, to+=4)
+ if (dither) {
+ for (x = 0; x < width; x++, from+=4, to+=4)
float_to_byte_dither_v4(to, from, di);
}
else {
- for(x = 0; x < width; x++, from+=4, to+=4)
+ for (x = 0; x < width; x++, from+=4, to+=4)
rgba_float_to_uchar(to, from);
}
}
- else if(profile_to == IB_PROFILE_SRGB) {
+ else if (profile_to == IB_PROFILE_SRGB) {
/* convert from linear to sRGB */
unsigned short us[4];
- if(dither && predivide) {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ if (dither && predivide) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
linearrgb_to_srgb_ushort4_predivide(us, from);
ushort_to_byte_dither_v4(to, us, di);
}
}
- else if(dither) {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ else if (dither) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
linearrgb_to_srgb_ushort4(us, from);
ushort_to_byte_dither_v4(to, us, di);
}
}
- else if(predivide) {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ else if (predivide) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
linearrgb_to_srgb_ushort4_predivide(us, from);
ushort_to_byte_v4(to, us);
}
}
else {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
linearrgb_to_srgb_ushort4(us, from);
ushort_to_byte_v4(to, us);
}
}
}
- else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+ else if (profile_to == IB_PROFILE_LINEAR_RGB) {
/* convert from sRGB to linear */
- if(dither && predivide) {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ if (dither && predivide) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
srgb_to_linearrgb_predivide_v4(tmp, from);
float_to_byte_dither_v4(to, tmp, di);
}
}
- else if(dither) {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ else if (dither) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
srgb_to_linearrgb_v4(tmp, from);
float_to_byte_dither_v4(to, tmp, di);
}
}
- else if(predivide) {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ else if (predivide) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
srgb_to_linearrgb_predivide_v4(tmp, from);
rgba_float_to_uchar(to, tmp);
}
}
else {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
srgb_to_linearrgb_v4(tmp, from);
rgba_float_to_uchar(to, tmp);
}
@@ -315,11 +315,11 @@ void IMB_buffer_byte_from_float(uchar *rect_to, const float *rect_from,
}
}
- if(dither)
+ if (dither)
dither_finish_row(di);
}
- if(dither)
+ if (dither)
clear_dither_context(di);
}
@@ -338,38 +338,38 @@ void IMB_buffer_float_from_byte(float *rect_to, const uchar *rect_from,
BLI_init_srgb_conversion();
/* RGBA input */
- for(y = 0; y < height; y++) {
+ for (y = 0; y < height; y++) {
const uchar *from = rect_from + stride_from*y*4;
float *to = rect_to + stride_to*y*4;
- if(profile_to == profile_from) {
+ if (profile_to == profile_from) {
/* no color space conversion */
- for(x = 0; x < width; x++, from+=4, to+=4)
+ for (x = 0; x < width; x++, from+=4, to+=4)
rgba_uchar_to_float(to, from);
}
- else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+ else if (profile_to == IB_PROFILE_LINEAR_RGB) {
/* convert sRGB to linear */
- if(predivide) {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ if (predivide) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
srgb_to_linearrgb_uchar4_predivide(to, from);
}
}
else {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
srgb_to_linearrgb_uchar4(to, from);
}
}
}
- else if(profile_to == IB_PROFILE_SRGB) {
+ else if (profile_to == IB_PROFILE_SRGB) {
/* convert linear to sRGB */
- if(predivide) {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ if (predivide) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
rgba_uchar_to_float(tmp, from);
linearrgb_to_srgb_predivide_v4(to, tmp);
}
}
else {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
rgba_uchar_to_float(tmp, from);
linearrgb_to_srgb_v4(to, tmp);
}
@@ -389,74 +389,74 @@ void IMB_buffer_float_from_float(float *rect_to, const float *rect_from,
BLI_assert(profile_to != IB_PROFILE_NONE);
BLI_assert(profile_from != IB_PROFILE_NONE);
- if(channels_from==1) {
+ if (channels_from==1) {
/* single channel input */
- for(y = 0; y < height; y++) {
+ for (y = 0; y < height; y++) {
const float *from = rect_from + stride_from*y;
float *to = rect_to + stride_to*y*4;
- for(x = 0; x < width; x++, from++, to+=4)
+ for (x = 0; x < width; x++, from++, to+=4)
to[0] = to[1] = to[2] = to[3] = from[0];
}
}
- else if(channels_from == 3) {
+ else if (channels_from == 3) {
/* RGB input */
- for(y = 0; y < height; y++) {
+ for (y = 0; y < height; y++) {
const float *from = rect_from + stride_from*y*3;
float *to = rect_to + stride_to*y*4;
- if(profile_to == profile_from) {
+ if (profile_to == profile_from) {
/* no color space conversion */
- for(x = 0; x < width; x++, from+=3, to+=4) {
+ for (x = 0; x < width; x++, from+=3, to+=4) {
copy_v3_v3(to, from);
to[3] = 1.0f;
}
}
- else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+ else if (profile_to == IB_PROFILE_LINEAR_RGB) {
/* convert from sRGB to linear */
- for(x = 0; x < width; x++, from+=3, to+=4) {
+ for (x = 0; x < width; x++, from+=3, to+=4) {
srgb_to_linearrgb_v3_v3(to, from);
to[3] = 1.0f;
}
}
- else if(profile_to == IB_PROFILE_SRGB) {
+ else if (profile_to == IB_PROFILE_SRGB) {
/* convert from linear to sRGB */
- for(x = 0; x < width; x++, from+=3, to+=4) {
+ for (x = 0; x < width; x++, from+=3, to+=4) {
linearrgb_to_srgb_v3_v3(to, from);
to[3] = 1.0f;
}
}
}
}
- else if(channels_from == 4) {
+ else if (channels_from == 4) {
/* RGBA input */
- for(y = 0; y < height; y++) {
+ for (y = 0; y < height; y++) {
const float *from = rect_from + stride_from*y*4;
float *to = rect_to + stride_to*y*4;
- if(profile_to == profile_from) {
+ if (profile_to == profile_from) {
/* same profile, copy */
memcpy(to, from, sizeof(float)*4*width);
}
- else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+ else if (profile_to == IB_PROFILE_LINEAR_RGB) {
/* convert to sRGB to linear */
- if(predivide) {
- for(x = 0; x < width; x++, from+=4, to+=4)
+ if (predivide) {
+ for (x = 0; x < width; x++, from+=4, to+=4)
srgb_to_linearrgb_predivide_v4(to, from);
}
else {
- for(x = 0; x < width; x++, from+=4, to+=4)
+ for (x = 0; x < width; x++, from+=4, to+=4)
srgb_to_linearrgb_v4(to, from);
}
}
- else if(profile_to == IB_PROFILE_SRGB) {
+ else if (profile_to == IB_PROFILE_SRGB) {
/* convert from linear to sRGB */
- if(predivide) {
- for(x = 0; x < width; x++, from+=4, to+=4)
+ if (predivide) {
+ for (x = 0; x < width; x++, from+=4, to+=4)
linearrgb_to_srgb_predivide_v4(to, from);
}
else {
- for(x = 0; x < width; x++, from+=4, to+=4)
+ for (x = 0; x < width; x++, from+=4, to+=4)
linearrgb_to_srgb_v4(to, from);
}
}
@@ -477,42 +477,42 @@ void IMB_buffer_byte_from_byte(uchar *rect_to, const uchar *rect_from,
BLI_assert(profile_from != IB_PROFILE_NONE);
/* always RGBA input */
- for(y = 0; y < height; y++) {
+ for (y = 0; y < height; y++) {
const uchar *from = rect_from + stride_from*y*4;
uchar *to = rect_to + stride_to*y*4;
- if(profile_to == profile_from) {
+ if (profile_to == profile_from) {
/* same profile, copy */
memcpy(to, from, sizeof(uchar)*4*width);
}
- else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+ else if (profile_to == IB_PROFILE_LINEAR_RGB) {
/* convert to sRGB to linear */
- if(predivide) {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ if (predivide) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
rgba_uchar_to_float(tmp, from);
srgb_to_linearrgb_predivide_v4(tmp, tmp);
rgba_float_to_uchar(to, tmp);
}
}
else {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
rgba_uchar_to_float(tmp, from);
srgb_to_linearrgb_v4(tmp, tmp);
rgba_float_to_uchar(to, tmp);
}
}
}
- else if(profile_to == IB_PROFILE_SRGB) {
+ else if (profile_to == IB_PROFILE_SRGB) {
/* convert from linear to sRGB */
- if(predivide) {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ if (predivide) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
rgba_uchar_to_float(tmp, from);
linearrgb_to_srgb_predivide_v4(tmp, tmp);
rgba_float_to_uchar(to, tmp);
}
}
else {
- for(x = 0; x < width; x++, from+=4, to+=4) {
+ for (x = 0; x < width; x++, from+=4, to+=4) {
rgba_uchar_to_float(tmp, from);
linearrgb_to_srgb_v4(tmp, tmp);
rgba_float_to_uchar(to, tmp);
@@ -530,17 +530,17 @@ void IMB_rect_from_float(ImBuf *ibuf)
int profile_from;
/* verify we have a float buffer */
- if(ibuf->rect_float==NULL)
+ if (ibuf->rect_float==NULL)
return;
/* create byte rect if it didn't exist yet */
- if(ibuf->rect==NULL)
+ if (ibuf->rect==NULL)
imb_addrectImBuf(ibuf);
/* determine profiles */
- if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
+ if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
profile_from = IB_PROFILE_LINEAR_RGB;
- else if(ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
+ else if (ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
profile_from = IB_PROFILE_SRGB;
else
BLI_assert(0);
@@ -563,17 +563,17 @@ void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w
int profile_from;
/* verify we have a float buffer */
- if(ibuf->rect_float==NULL || buffer==NULL)
+ if (ibuf->rect_float==NULL || buffer==NULL)
return;
/* create byte rect if it didn't exist yet */
- if(ibuf->rect==NULL)
+ if (ibuf->rect==NULL)
imb_addrectImBuf(ibuf);
/* determine profiles */
- if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
+ if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
profile_from = IB_PROFILE_LINEAR_RGB;
- else if(ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
+ else if (ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
profile_from = IB_PROFILE_SRGB;
else
BLI_assert(0);
@@ -600,15 +600,15 @@ void IMB_float_from_rect(ImBuf *ibuf)
int profile_from;
/* verify if we byte and float buffers */
- if(ibuf->rect==NULL)
+ if (ibuf->rect==NULL)
return;
- if(ibuf->rect_float==NULL)
- if(imb_addrectfloatImBuf(ibuf) == 0)
+ if (ibuf->rect_float==NULL)
+ if (imb_addrectfloatImBuf(ibuf) == 0)
return;
/* determine profiles */
- if(ibuf->profile == IB_PROFILE_NONE)
+ if (ibuf->profile == IB_PROFILE_NONE)
profile_from = IB_PROFILE_LINEAR_RGB;
else
profile_from = IB_PROFILE_SRGB;
@@ -624,7 +624,7 @@ void IMB_float_from_rect_simple(ImBuf *ibuf)
{
int predivide= (ibuf->flags & IB_cm_predivide);
- if(ibuf->rect_float==NULL)
+ if (ibuf->rect_float==NULL)
imb_addrectfloatImBuf(ibuf);
IMB_buffer_float_from_byte(ibuf->rect_float, (uchar*)ibuf->rect,
@@ -637,22 +637,22 @@ void IMB_convert_profile(ImBuf *ibuf, int profile)
int predivide= (ibuf->flags & IB_cm_predivide);
int profile_from, profile_to;
- if(ibuf->profile == profile)
+ if (ibuf->profile == profile)
return;
/* determine profiles */
- if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
+ if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
profile_from = IB_PROFILE_LINEAR_RGB;
- else if(ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
+ else if (ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
profile_from = IB_PROFILE_SRGB;
else {
BLI_assert(0);
profile_from = IB_PROFILE_SRGB; /* dummy, should never happen */
}
- if(profile == IB_PROFILE_LINEAR_RGB)
+ if (profile == IB_PROFILE_LINEAR_RGB)
profile_to = IB_PROFILE_LINEAR_RGB;
- else if(ELEM(profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
+ else if (ELEM(profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
profile_to = IB_PROFILE_SRGB;
else {
BLI_assert(0);
@@ -660,13 +660,13 @@ void IMB_convert_profile(ImBuf *ibuf, int profile)
}
/* do conversion */
- if(ibuf->rect_float) {
+ if (ibuf->rect_float) {
IMB_buffer_float_from_float(ibuf->rect_float, ibuf->rect_float,
4, profile_to, profile_from, predivide,
ibuf->x, ibuf->y, ibuf->x, ibuf->x);
}
- if(ibuf->rect) {
+ if (ibuf->rect) {
IMB_buffer_byte_from_byte((uchar*)ibuf->rect, (uchar*)ibuf->rect,
profile_to, profile_from, predivide,
ibuf->x, ibuf->y, ibuf->x, ibuf->x);
@@ -684,21 +684,21 @@ float *IMB_float_profile_ensure(ImBuf *ibuf, int profile, int *alloc)
int profile_from, profile_to;
/* determine profiles */
- if(ibuf->profile == IB_PROFILE_NONE)
+ if (ibuf->profile == IB_PROFILE_NONE)
profile_from = IB_PROFILE_LINEAR_RGB;
else
profile_from = IB_PROFILE_SRGB;
- if(profile == IB_PROFILE_NONE)
+ if (profile == IB_PROFILE_NONE)
profile_to = IB_PROFILE_LINEAR_RGB;
else
profile_to = IB_PROFILE_SRGB;
- if(profile_from == profile_to) {
+ if (profile_from == profile_to) {
/* simple case, just allocate the buffer and return */
*alloc= 0;
- if(ibuf->rect_float == NULL)
+ if (ibuf->rect_float == NULL)
IMB_float_from_rect(ibuf);
return ibuf->rect_float;
@@ -708,7 +708,7 @@ float *IMB_float_profile_ensure(ImBuf *ibuf, int profile, int *alloc)
float *fbuf= MEM_mallocN(ibuf->x * ibuf->y * sizeof(float) * 4, "IMB_float_profile_ensure");
*alloc= 1;
- if(ibuf->rect_float == NULL) {
+ if (ibuf->rect_float == NULL) {
IMB_buffer_float_from_byte(fbuf, (uchar*)ibuf->rect,
profile_to, profile_from, predivide,
ibuf->x, ibuf->y, ibuf->x, ibuf->x);
@@ -732,13 +732,13 @@ void IMB_color_to_bw(ImBuf *ibuf)
uchar *rct= (uchar*)ibuf->rect;
int i;
- if(rctf) {
- for(i = ibuf->x * ibuf->y; i > 0; i--, rctf+=4)
+ if (rctf) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--, rctf+=4)
rctf[0]= rctf[1]= rctf[2]= rgb_to_grayscale(rctf);
}
- if(rct) {
- for(i = ibuf->x * ibuf->y; i > 0; i--, rct+=4)
+ if (rct) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--, rct+=4)
rct[0]= rct[1]= rct[2]= rgb_to_grayscale_byte(rct);
}
}
@@ -746,7 +746,34 @@ void IMB_color_to_bw(ImBuf *ibuf)
void IMB_buffer_float_clamp(float *buf, int width, int height)
{
int i, total = width*height*4;
- for(i = 0; i < total; i++){
+ for (i = 0; i < total; i++) {
buf[i] = MIN2(1.0, buf[i]);
}
}
+
+/**************************** alter saturation *****************************/
+
+void IMB_saturation(ImBuf * ibuf, float sat)
+{
+ int i;
+ unsigned char *rct= (unsigned char *)ibuf->rect;
+ float *rctf= ibuf->rect_float;
+ float hsv[3];
+
+ if (rct) {
+ float rgb[3];
+ for (i = ibuf->x * ibuf->y; i > 0; i--, rct+=4) {
+ rgb_uchar_to_float(rgb, rct);
+ rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rgb, rgb+1, rgb+2);
+ rgb_float_to_uchar(rct, rgb);
+ }
+ }
+
+ if (rctf) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--, rctf+=4) {
+ rgb_to_hsv(rctf[0], rctf[1], rctf[2], hsv, hsv+1, hsv+2);
+ hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rctf, rctf+1, rctf+2);
+ }
+ }
+}
diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c
index c03736f4b0a..9ece4bd9f6d 100644
--- a/source/blender/imbuf/intern/filetype.c
+++ b/source/blender/imbuf/intern/filetype.c
@@ -94,8 +94,8 @@ void imb_filetypes_init(void)
{
ImFileType *type;
- for(type=IMB_FILE_TYPES; type->is_a; type++)
- if(type->init)
+ for (type=IMB_FILE_TYPES; type->is_a; type++)
+ if (type->init)
type->init();
}
@@ -103,8 +103,8 @@ void imb_filetypes_exit(void)
{
ImFileType *type;
- for(type=IMB_FILE_TYPES; type->is_a; type++)
- if(type->exit)
+ for (type=IMB_FILE_TYPES; type->is_a; type++)
+ if (type->exit)
type->exit();
}
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 0d821126492..0e6567d2c6b 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -54,10 +54,10 @@ static void filtrow(unsigned char *point, int x)
{
unsigned int c1,c2,c3,error;
- if (x>1){
+ if (x>1) {
c1 = c2 = *point;
error = 2;
- for(x--;x>0;x--){
+ for (x--;x>0;x--) {
c3 = point[4];
c1 += (c2<<1) + c3 + error;
error = c1 & 3;
@@ -74,9 +74,9 @@ static void filtrowf(float *point, int x)
{
float c1,c2,c3;
- if (x>1){
+ if (x>1) {
c1 = c2 = *point;
- for(x--;x>0;x--){
+ for (x--;x>0;x--) {
c3 = point[4];
c1 += (c2 * 2) + c3;
*point = 0.25f*c1;
@@ -95,11 +95,11 @@ static void filtcolum(unsigned char *point, int y, int skip)
unsigned int c1,c2,c3,error;
unsigned char *point2;
- if (y>1){
+ if (y>1) {
c1 = c2 = *point;
point2 = point;
error = 2;
- for(y--;y>0;y--){
+ for (y--;y>0;y--) {
point2 += skip;
c3 = *point2;
c1 += (c2<<1) + c3 +error;
@@ -117,10 +117,10 @@ static void filtcolumf(float *point, int y, int skip)
{
float c1,c2,c3, *point2;
- if (y>1){
+ if (y>1) {
c1 = c2 = *point;
point2 = point;
- for(y--;y>0;y--){
+ for (y--;y>0;y--) {
point2 += skip;
c3 = *point2;
c1 += (c2 * 2) + c3;
@@ -146,7 +146,7 @@ void IMB_filtery(struct ImBuf *ibuf)
y = ibuf->y;
skip = x<<2;
- for (;x>0;x--){
+ for (;x>0;x--) {
if (point) {
if (ibuf->planes > 24) filtcolum(point,y,skip);
point++;
@@ -184,7 +184,7 @@ void imb_filterx(struct ImBuf *ibuf)
y = ibuf->y;
skip = (x<<2) - 3;
- for (;y>0;y--){
+ for (;y>0;y--) {
if (point) {
if (ibuf->planes > 24) filtrow(point,x);
point++;
@@ -216,7 +216,7 @@ void IMB_filterN(ImBuf *out, ImBuf *in)
rowlen= in->x;
- for(y=0; y<in->y; y++) {
+ for (y=0; y<in->y; y++) {
/* setup rows */
row2= (char*)(in->rect + y*rowlen);
row1= (y == 0)? row2: row2 - 4*rowlen;
@@ -224,8 +224,8 @@ void IMB_filterN(ImBuf *out, ImBuf *in)
cp= (char *)(out->rect + y*rowlen);
- for(x=0; x<rowlen; x++) {
- if(x == 0) {
+ for (x=0; x<rowlen; x++) {
+ if (x == 0) {
r11 = row1;
r21 = row1;
r31 = row1;
@@ -236,7 +236,7 @@ void IMB_filterN(ImBuf *out, ImBuf *in)
r31 = row1-4;
}
- if(x == rowlen-1) {
+ if (x == rowlen-1) {
r13 = row1;
r23 = row1;
r33 = row1;
@@ -273,26 +273,27 @@ void IMB_mask_filter_extend(char *mask, int width, int height)
/* make a copy, to prevent flooding */
temprect= MEM_dupallocN(mask);
- for(y=1; y<=height; y++) {
+ for (y=1; y<=height; y++) {
/* setup rows */
row1= (char *)(temprect + (y-2)*rowlen);
row2= row1 + rowlen;
row3= row2 + rowlen;
- if(y==1)
+ if (y==1)
row1= row2;
- else if(y==height)
+ else if (y==height)
row3= row2;
- for(x=0; x<rowlen; x++) {
+ for (x=0; x<rowlen; x++) {
if (mask[((y-1)*rowlen)+x]==0) {
if (*row1 || *row2 || *row3 || *(row1+1) || *(row3+1) ) {
mask[((y-1)*rowlen)+x] = FILTER_MASK_MARGIN;
- } else if((x!=rowlen-1) && (*(row1+2) || *(row2+2) || *(row3+2)) ) {
+ }
+ else if ((x!=rowlen-1) && (*(row1+2) || *(row2+2) || *(row3+2)) ) {
mask[((y-1)*rowlen)+x] = FILTER_MASK_MARGIN;
}
}
- if(x!=0) {
+ if (x!=0) {
row1++; row2++; row3++;
}
}
@@ -305,18 +306,19 @@ void IMB_mask_clear(ImBuf *ibuf, char *mask, int val)
{
int x,y;
if (ibuf->rect_float) {
- for(x=0; x<ibuf->x; x++) {
- for(y=0; y<ibuf->y; y++) {
+ for (x=0; x<ibuf->x; x++) {
+ for (y=0; y<ibuf->y; y++) {
if (mask[ibuf->x*y + x] == val) {
float *col= ibuf->rect_float + 4*(ibuf->x*y + x);
col[0] = col[1] = col[2] = col[3] = 0.0f;
}
}
}
- } else {
+ }
+ else {
/* char buffer */
- for(x=0; x<ibuf->x; x++) {
- for(y=0; y<ibuf->y; y++) {
+ for (x=0; x<ibuf->x; x++) {
+ for (y=0; y<ibuf->y; y++) {
if (mask[ibuf->x*y + x] == val) {
char *col= (char *)(ibuf->rect + ibuf->x*y + x);
col[0] = col[1] = col[2] = col[3] = 0;
@@ -328,7 +330,7 @@ void IMB_mask_clear(ImBuf *ibuf, char *mask, int val)
static int filter_make_index(const int x, const int y, const int w, const int h)
{
- if(x<0 || x>=w || y<0 || y>=h) return -1; /* return bad index */
+ if (x<0 || x>=w || y<0 || y>=h) return -1; /* return bad index */
else return y*w+x;
}
@@ -336,13 +338,13 @@ static int check_pixel_assigned(const void *buffer, const char *mask, const int
{
int res = 0;
- if(index>=0) {
+ if (index>=0) {
const int alpha_index = depth*index+(depth-1);
- if(mask!=NULL) {
+ if (mask!=NULL) {
res = mask[index]!=0 ? 1 : 0;
}
- else if( (is_float && ((const float *) buffer)[alpha_index]!=0.0f) ||
+ else if ( (is_float && ((const float *) buffer)[alpha_index]!=0.0f) ||
(!is_float && ((const unsigned char *) buffer)[alpha_index]!=0) ) {
res=1;
}
@@ -375,8 +377,8 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
#if 0
k= 0;
- for(i = -n; i <= n; i++)
- for(j = -n; j <= n; j++)
+ for (i = -n; i <= n; i++)
+ for (j = -n; j <= n; j++)
weight[k++] = sqrt((float) i * i + j * j);
#endif
@@ -385,16 +387,16 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
weight[6]=1; weight[7]=2; weight[8]=1;
/* run passes */
- for(r = 0; cannot_early_out == 1 && r < filter; r++) {
+ for (r = 0; cannot_early_out == 1 && r < filter; r++) {
int x, y;
cannot_early_out = 0;
- for(y= 0; y<height; y++) {
- for(x= 0; x<width; x++) {
+ for (y= 0; y<height; y++) {
+ for (x= 0; x<width; x++) {
const int index= filter_make_index(x, y, width, height);
/* only update unassigned pixels */
- if(!check_pixel_assigned(srcbuf, srcmask, index, depth, is_float)) {
+ if (!check_pixel_assigned(srcbuf, srcmask, index, depth, is_float)) {
float tmp[4];
float wsum=0;
float acc[4]={0,0,0,0};
@@ -404,24 +406,24 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
check_pixel_assigned(srcbuf, srcmask, filter_make_index(x+1, y, width, height), depth, is_float) ||
check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y-1, width, height), depth, is_float) ||
check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y+1, width, height), depth, is_float)) {
- for(i= -n; i<=n; i++) {
- for(j=-n; j<=n; j++) {
- if(i != 0 || j != 0) {
+ for (i= -n; i<=n; i++) {
+ for (j=-n; j<=n; j++) {
+ if (i != 0 || j != 0) {
const int tmpindex= filter_make_index(x+i, y+j, width, height);
- if(check_pixel_assigned(srcbuf, srcmask, tmpindex, depth, is_float)) {
- if(is_float) {
- for(c=0; c<depth; c++)
+ if (check_pixel_assigned(srcbuf, srcmask, tmpindex, depth, is_float)) {
+ if (is_float) {
+ for (c=0; c<depth; c++)
tmp[c] = ((const float *) srcbuf)[depth*tmpindex+c];
}
else {
- for(c=0; c<depth; c++)
+ for (c=0; c<depth; c++)
tmp[c] = (float) ((const unsigned char *) srcbuf)[depth*tmpindex+c];
}
wsum+= weight[k];
- for(c=0; c<depth; c++)
+ for (c=0; c<depth; c++)
acc[c]+= weight[k] * tmp[c];
}
}
@@ -429,21 +431,21 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
}
}
- if(wsum!=0) {
- for(c=0; c<depth; c++)
+ if (wsum!=0) {
+ for (c=0; c<depth; c++)
acc[c]/= wsum;
- if(is_float) {
- for(c=0; c<depth; c++)
+ if (is_float) {
+ for (c=0; c<depth; c++)
((float *) dstbuf)[depth*index+c] = acc[c];
}
else {
- for(c=0; c<depth; c++) {
+ for (c=0; c<depth; c++) {
((unsigned char *) dstbuf)[depth*index+c]= acc[c] > 255 ? 255 : (acc[c] < 0 ? 0 : ((unsigned char) (acc[c]+0.5f)));
}
}
- if(dstmask!=NULL) dstmask[index]=FILTER_MASK_MARGIN; /* assigned */
+ if (dstmask!=NULL) dstmask[index]=FILTER_MASK_MARGIN; /* assigned */
cannot_early_out = 1;
}
}
@@ -453,12 +455,12 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
/* keep the original buffer up to date. */
memcpy(srcbuf, dstbuf, bsize);
- if(dstmask!=NULL) memcpy(srcmask, dstmask, width*height);
+ if (dstmask!=NULL) memcpy(srcmask, dstmask, width*height);
}
/* free memory */
MEM_freeN(dstbuf);
- if(dstmask!=NULL) MEM_freeN(dstmask);
+ if (dstmask!=NULL) MEM_freeN(dstmask);
}
/* threadsafe version, only recreates existing maps */
@@ -469,11 +471,11 @@ void IMB_remakemipmap(ImBuf *ibuf, int use_filter)
ibuf->miptot= 1;
- while(curmap < IB_MIPMAP_LEVELS) {
+ while (curmap < IB_MIPMAP_LEVELS) {
- if(ibuf->mipmap[curmap]) {
+ if (ibuf->mipmap[curmap]) {
- if(use_filter) {
+ if (use_filter) {
ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect);
IMB_filterN(nbuf, hbuf);
imb_onehalf_no_alloc(ibuf->mipmap[curmap], nbuf);
@@ -485,10 +487,10 @@ void IMB_remakemipmap(ImBuf *ibuf, int use_filter)
ibuf->miptot= curmap+2;
hbuf= ibuf->mipmap[curmap];
- if(hbuf)
+ if (hbuf)
hbuf->miplevel= curmap+1;
- if(!hbuf || (hbuf->x <= 2 && hbuf->y <= 2))
+ if (!hbuf || (hbuf->x <= 2 && hbuf->y <= 2))
break;
curmap++;
@@ -505,8 +507,8 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter)
ibuf->miptot= 1;
- while(curmap < IB_MIPMAP_LEVELS) {
- if(use_filter) {
+ while (curmap < IB_MIPMAP_LEVELS) {
+ if (use_filter) {
ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect);
IMB_filterN(nbuf, hbuf);
ibuf->mipmap[curmap] = IMB_onehalf(nbuf);
@@ -519,7 +521,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter)
hbuf= ibuf->mipmap[curmap];
hbuf->miplevel= curmap+1;
- if(hbuf->x <= 2 && hbuf->y <= 2)
+ if (hbuf->x <= 2 && hbuf->y <= 2)
break;
curmap++;
@@ -537,18 +539,18 @@ void IMB_premultiply_rect(unsigned int *rect, char planes, int w, int h)
char *cp;
int x, y, val;
- if(planes == 24) { /* put alpha at 255 */
+ if (planes == 24) { /* put alpha at 255 */
cp= (char *)(rect);
- for(y=0; y<h; y++)
- for(x=0; x<w; x++, cp+=4)
+ for (y=0; y<h; y++)
+ for (x=0; x<w; x++, cp+=4)
cp[3]= 255;
}
else {
cp= (char *)(rect);
- for(y=0; y<h; y++) {
- for(x=0; x<w; x++, cp+=4) {
+ for (y=0; y<h; y++) {
+ for (x=0; x<w; x++, cp+=4) {
val= cp[3];
cp[0]= (cp[0]*val)>>8;
cp[1]= (cp[1]*val)>>8;
@@ -563,17 +565,17 @@ void IMB_premultiply_rect_float(float *rect_float, char planes, int w, int h)
float val, *cp;
int x, y;
- if(planes==24) { /* put alpha at 1.0 */
+ if (planes==24) { /* put alpha at 1.0 */
cp= rect_float;
- for(y=0; y<h; y++)
- for(x=0; x<w; x++, cp+=4)
+ for (y=0; y<h; y++)
+ for (x=0; x<w; x++, cp+=4)
cp[3]= 1.0;
}
else {
cp= rect_float;
- for(y=0; y<h; y++) {
- for(x=0; x<w; x++, cp+=4) {
+ for (y=0; y<h; y++) {
+ for (x=0; x<w; x++, cp+=4) {
val= cp[3];
cp[0]= cp[0]*val;
cp[1]= cp[1]*val;
@@ -586,13 +588,13 @@ void IMB_premultiply_rect_float(float *rect_float, char planes, int w, int h)
void IMB_premultiply_alpha(ImBuf *ibuf)
{
- if(ibuf==NULL)
+ if (ibuf==NULL)
return;
- if(ibuf->rect)
+ if (ibuf->rect)
IMB_premultiply_rect(ibuf->rect, ibuf->planes, ibuf->x, ibuf->y);
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
IMB_premultiply_rect_float(ibuf->rect_float, ibuf->planes, ibuf->x, ibuf->y);
}
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c
index 0462c998e44..1976242ea4f 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -62,7 +62,7 @@ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
if (ibuf->rect) {
size = ibuf->x * ibuf->y;
- while(size-- > 0) {
+ while (size-- > 0) {
rt= cp[0];
cp[0]= cp[3];
cp[3]= rt;
@@ -76,7 +76,7 @@ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
if (ibuf->rect_float) {
size = ibuf->x * ibuf->y;
- while(size-- > 0) {
+ while (size-- > 0) {
rtf= cpf[0];
cpf[0]= cpf[3];
cpf[3]= rtf;
@@ -156,11 +156,11 @@ void bicubic_interpolation_color(struct ImBuf *in, unsigned char *outI, float *o
wy[2] = P(b- 1);
wy[3] = P(b- 2);
- for(n= -1; n<= 2; n++){
+ for (n= -1; n<= 2; n++) {
x1= i+n;
CLAMP(x1, 0, in->x-1);
wx = P(n-a);
- for(m= -1; m<= 2; m++){
+ for (m= -1; m<= 2; m++) {
y1= j+m;
CLAMP(y1, 0, in->y-1);
/* normally we could do this */
@@ -189,8 +189,8 @@ void bicubic_interpolation_color(struct ImBuf *in, unsigned char *outI, float *o
#if 0
/* older, slower function, works the same as above */
- for(n= -1; n<= 2; n++){
- for(m= -1; m<= 2; m++){
+ for (n= -1; n<= 2; n++) {
+ for (m= -1; m<= 2; m++) {
x1= i+n;
y1= j+m;
if (x1>0 && x1 < in->x && y1>0 && y1<in->y) {
@@ -338,11 +338,11 @@ void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char *outI, fl
if (x2<0 || x1>in->x-1 || y2<0 || y1>in->y-1) return;
/* wrap interpolation pixels - main difference from bilinear_interpolation_color */
- if(x1<0)x1= in->x+x1;
- if(y1<0)y1= in->y+y1;
+ if (x1<0)x1= in->x+x1;
+ if (y1<0)y1= in->y+y1;
- if(x2>=in->x)x2= x2-in->x;
- if(y2>=in->y)y2= y2-in->y;
+ if (x2>=in->x)x2= x2-in->x;
+ if (y2>=in->y)y2= y2-in->y;
if (outF) {
// sample including outside of edges of image
@@ -423,7 +423,8 @@ void neareast_interpolation_color(struct ImBuf *in, unsigned char *outI, float *
outF[2]= 0.0f;
outF[3]= 0.0f;
}
- } else {
+ }
+ else {
dataI= (unsigned char *)in->rect + in->x * y1 * 4 + 4*x1;
if (outI) {
outI[0]= dataI[0];
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index 7a2977da473..e50f8e16ea5 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -61,14 +61,6 @@ static int tc_types[] = { IMB_TC_RECORD_RUN,
#define INDEX_FILE_VERSION 1
-/* ----------------------------------------------------------------------
- - special indexers
- ----------------------------------------------------------------------
- */
-
-extern void IMB_indexer_dv_new(anim_index_builder * idx);
-
-
/* ----------------------------------------------------------------------
- time code index functions
---------------------------------------------------------------------- */
@@ -89,7 +81,7 @@ anim_index_builder * IMB_index_builder_create(const char * name)
BLI_make_existing_file(rv->temp_name);
- rv->fp = fopen(rv->temp_name, "wb");
+ rv->fp = BLI_fopen(rv->temp_name, "wb");
if (!rv->fp) {
fprintf(stderr, "Couldn't open index target: %s! "
@@ -130,7 +122,8 @@ void IMB_index_builder_proc_frame(anim_index_builder * fp,
e.pts = pts;
fp->proc_frame(fp, buffer, data_size, &e);
- } else {
+ }
+ else {
IMB_index_builder_add_entry(fp, frameno, seek_pos,
seek_pos_dts, pts);
}
@@ -146,9 +139,10 @@ void IMB_index_builder_finish(anim_index_builder * fp, int rollback)
if (rollback) {
unlink(fp->temp_name);
- } else {
+ }
+ else {
unlink(fp->name);
- rename(fp->temp_name, fp->name);
+ BLI_rename(fp->temp_name, fp->name);
}
MEM_freeN(fp);
@@ -158,7 +152,7 @@ struct anim_index * IMB_indexer_open(const char * name)
{
char header[13];
struct anim_index * idx;
- FILE * fp = fopen(name, "rb");
+ FILE * fp = BLI_fopen(name, "rb");
int i;
if (!fp) {
@@ -268,14 +262,16 @@ int IMB_indexer_get_frame_index(struct anim_index * idx, int frameno)
first = middle;
++first;
len = len - half - 1;
- } else {
+ }
+ else {
len = half;
}
}
if (first == idx->num_entries) {
return idx->num_entries - 1;
- } else {
+ }
+ else {
return first;
}
}
@@ -369,7 +365,8 @@ static void get_index_dir(struct anim * anim, char * index_dir)
BLI_splitdirstring(index_dir, fname);
BLI_join_dirfile(index_dir, FILE_MAXDIR, index_dir, "BL_proxy");
BLI_join_dirfile(index_dir, FILE_MAXDIR, index_dir, fname);
- } else {
+ }
+ else {
BLI_strncpy(index_dir, anim->index_dir, FILE_MAXDIR);
}
}
@@ -513,7 +510,8 @@ static struct proxy_output_ctx * alloc_proxy_output_ffmpeg(
if (rv->codec->pix_fmts) {
rv->c->pix_fmt = rv->codec->pix_fmts[0];
- } else {
+ }
+ else {
rv->c->pix_fmt = PIX_FMT_YUVJ420P;
}
@@ -641,7 +639,8 @@ static int add_to_proxy_output_ffmpeg(
}
return 1;
- } else {
+ }
+ else {
return 0;
}
}
@@ -694,11 +693,12 @@ static void free_proxy_output_ffmpeg(struct proxy_output_ctx * ctx,
if (rollback) {
unlink(fname_tmp);
- } else {
+ }
+ else {
get_proxy_filename(ctx->anim, ctx->proxy_size,
fname, FALSE);
unlink(fname);
- rename(fname_tmp, fname);
+ BLI_rename(fname_tmp, fname);
}
MEM_freeN(ctx);
@@ -739,7 +739,7 @@ static IndexBuildContext *index_ffmpeg_create_context(struct anim *anim, IMB_Tim
memset(context->proxy_ctx, 0, sizeof(context->proxy_ctx));
memset(context->indexer, 0, sizeof(context->indexer));
- if(av_open_input_file(&context->iFormatCtx, anim->name, NULL, 0, NULL) != 0) {
+ if (av_open_input_file(&context->iFormatCtx, anim->name, NULL, 0, NULL) != 0) {
MEM_freeN(context);
return NULL;
}
@@ -755,7 +755,7 @@ static IndexBuildContext *index_ffmpeg_create_context(struct anim *anim, IMB_Tim
/* Find the video stream */
context->videoStream = -1;
for (i = 0; i < context->iFormatCtx->nb_streams; i++)
- if(context->iFormatCtx->streams[i]->codec->codec_type
+ if (context->iFormatCtx->streams[i]->codec->codec_type
== AVMEDIA_TYPE_VIDEO) {
if (streamcount > 0) {
streamcount--;
@@ -863,7 +863,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
frame_rate = av_q2d(context->iStream->r_frame_rate);
pts_time_base = av_q2d(context->iStream->time_base);
- while(av_read_frame(context->iFormatCtx, &next_packet) >= 0) {
+ while (av_read_frame(context->iFormatCtx, &next_packet) >= 0) {
int frame_finished = 0;
float next_progress = (float)((int)floor(((double) next_packet.pos) * 100 /
((double) stream_size)+0.5)) / 100;
@@ -927,7 +927,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
if (context->tcs_in_use & tc_types[i]) {
int tc_frameno = frameno;
- if(tc_types[i] == IMB_TC_RECORD_RUN_NO_GAPS)
+ if (tc_types[i] == IMB_TC_RECORD_RUN_NO_GAPS)
tc_frameno = frameno_gapless;
IMB_index_builder_proc_frame(
@@ -1056,7 +1056,8 @@ static void index_rebuild_fallback_finish(FallbackIndexBuilderContext *context,
if (stop) {
unlink(fname_tmp);
- } else {
+ }
+ else {
unlink(fname);
rename(fname_tmp, fname);
}
diff --git a/source/blender/imbuf/intern/indexer_dv.c b/source/blender/imbuf/intern/indexer_dv.c
index 4ccd8ec464d..f0c38f6db06 100644
--- a/source/blender/imbuf/intern/indexer_dv.c
+++ b/source/blender/imbuf/intern/indexer_dv.c
@@ -139,7 +139,8 @@ static void parse_packet(indexer_dv_context * This, unsigned char * p)
This->rec_curr_year = parse_bcd(&b, 8);
if (This->rec_curr_year < 25) {
This->rec_curr_year += 2000;
- } else {
+ }
+ else {
This->rec_curr_year += 1900;
}
This->got_record_date = 1;
@@ -201,7 +202,7 @@ static void parse_audio_headers(
{
int i;
- for(i = 0; i < 9; i++) {
+ for (i = 0; i < 9; i++) {
if (target[3] != 0xff) {
parse_packet(This, target + 3);
}
@@ -238,7 +239,8 @@ static void inc_frame(int * frame, time_t * t, int isPAL)
if (isPAL && *frame >= 25) {
(*t)++;
*frame = 0;
- } else if (!isPAL && *frame >= 30) {
+ }
+ else if (!isPAL && *frame >= 30) {
(*t)++;
*frame = 0;
}
@@ -308,7 +310,8 @@ static void proc_frame(indexer_dv_context * This,
if (This->ref_time_read < 0) {
This->ref_time_read = This->ref_time_read_new;
This->curr_frame = 0;
- } else {
+ }
+ else {
if (This->ref_time_read_new - This->ref_time_read == 1) {
This->curr_frame = 0;
This->ref_time_read = This->ref_time_read_new;
@@ -316,9 +319,11 @@ static void proc_frame(indexer_dv_context * This,
fill_gap(This, isPAL);
This->gap_frame = -1;
}
- } else if (This->ref_time_read_new == This->ref_time_read) {
+ }
+ else if (This->ref_time_read_new == This->ref_time_read) {
// do nothing
- } else {
+ }
+ else {
This->gap_start = This->ref_time_read;
This->gap_frame = This->curr_frame;
This->ref_time_read = This->ref_time_read_new;
@@ -347,7 +352,8 @@ static void indexer_dv_proc_frame(anim_index_builder * idx,
if (This->curr_frame >= 0) {
write_index(This, entry);
inc_frame(&This->curr_frame, &This->ref_time_read, isPAL);
- } else {
+ }
+ else {
This->backbuffer[This->fsize++] = *entry;
if (This->fsize >= 31) {
int i;
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index 83351b5e0e4..e775d0f7bbd 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -196,7 +196,7 @@ static int writetab(FILE *outf, unsigned int *tab, int len)
{
int r = 0;
- while(len) {
+ while (len) {
r = putlong(outf,*tab++);
len -= 4;
}
@@ -205,7 +205,7 @@ static int writetab(FILE *outf, unsigned int *tab, int len)
static void readtab(FILE *inf, unsigned int *tab, int len)
{
- while(len) {
+ while (len) {
*tab++ = getlong(inf);
len -= 4;
}
@@ -216,13 +216,13 @@ static void test_endian_zbuf(struct ImBuf *ibuf)
int len;
int *zval;
- if( BIG_LONG(1) == 1 ) return;
- if(ibuf->zbuf == NULL) return;
+ if ( BIG_LONG(1) == 1 ) return;
+ if (ibuf->zbuf == NULL) return;
len= ibuf->x*ibuf->y;
zval= ibuf->zbuf;
- while(len--) {
+ while (len--) {
zval[0]= BIG_LONG(zval[0]);
zval++;
}
@@ -262,7 +262,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
(void)size; /* unused */
- if(!imb_is_a_iris(mem)) return NULL;
+ if (!imb_is_a_iris(mem)) return NULL;
/*printf("new iris\n");*/
@@ -270,14 +270,14 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
file_offset = 0;
readheader(inf, &image);
- if(image.imagic != IMAGIC) {
+ if (image.imagic != IMAGIC) {
fprintf(stderr,"longimagedata: bad magic number in image file\n");
return(NULL);
}
rle = ISRLE(image.type);
bpp = BPP(image.type);
- if(bpp != 1 && bpp != 2) {
+ if (bpp != 1 && bpp != 2) {
fprintf(stderr,"longimagedata: image must have 1 or 2 byte per pix chan\n");
return(NULL);
}
@@ -313,7 +313,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
}
cur = starttab[y+z*ysize];
}
- if(badorder)
+ if (badorder)
break;
}
@@ -325,9 +325,9 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
zbase = (unsigned int *)ibuf->zbuf;
if (badorder) {
- for(z=0; z<zsize; z++) {
+ for (z=0; z<zsize; z++) {
lptr = base;
- for(y=0; y<ysize; y++) {
+ for (y=0; y<ysize; y++) {
file_offset = starttab[y+z*ysize];
rledat = file_data + file_offset;
@@ -337,20 +337,21 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
lptr += xsize;
}
}
- } else {
+ }
+ else {
lptr = base;
zptr = zbase;
- for(y=0; y<ysize; y++) {
+ for (y=0; y<ysize; y++) {
- for(z=0; z<zsize; z++) {
+ for (z=0; z<zsize; z++) {
file_offset = starttab[y+z*ysize];
rledat = file_data + file_offset;
file_offset += lengthtab[y+z*ysize];
- if(z<4) expandrow((uchar *)lptr, rledat, 3-z);
- else if(z<8) expandrow((uchar *)zptr, rledat, 7-z);
+ if (z<4) expandrow((uchar *)lptr, rledat, 3-z);
+ else if (z<8) expandrow((uchar *)zptr, rledat, 7-z);
}
lptr += xsize;
zptr += xsize;
@@ -358,16 +359,17 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
}
- } else { /* bpp == 2 */
+ }
+ else { /* bpp == 2 */
ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat);
fbase = ibuf->rect_float;
if (badorder) {
- for(z=0; z<zsize; z++) {
+ for (z=0; z<zsize; z++) {
fptr = fbase;
- for(y=0; y<ysize; y++) {
+ for (y=0; y<ysize; y++) {
file_offset = starttab[y+z*ysize];
rledat = file_data + file_offset;
@@ -377,12 +379,13 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
fptr += xsize * 4;
}
}
- } else {
+ }
+ else {
fptr = fbase;
- for(y=0; y<ysize; y++) {
+ for (y=0; y<ysize; y++) {
- for(z=0; z<zsize; z++) {
+ for (z=0; z<zsize; z++) {
file_offset = starttab[y+z*ysize];
@@ -400,7 +403,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
MEM_freeN(starttab);
MEM_freeN(lengthtab);
- } else {
+ }
+ else {
if (bpp == 1) {
ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect);
@@ -412,12 +416,12 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
file_offset = 512;
rledat = file_data + file_offset;
- for(z = 0; z < zsize; z++) {
+ for (z = 0; z < zsize; z++) {
- if(z<4) lptr = base;
- else if(z<8) lptr= zbase;
+ if (z<4) lptr = base;
+ else if (z<8) lptr= zbase;
- for(y = 0; y < ysize; y++) {
+ for (y = 0; y < ysize; y++) {
interleaverow((uchar *)lptr, rledat, 3-z, xsize);
rledat += xsize;
@@ -426,7 +430,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
}
}
- } else { /* bpp == 2 */
+ }
+ else { /* bpp == 2 */
ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat);
@@ -435,11 +440,11 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
file_offset = 512;
rledat = file_data + file_offset;
- for(z = 0; z < zsize; z++) {
+ for (z = 0; z < zsize; z++) {
fptr = fbase;
- for(y = 0; y < ysize; y++) {
+ for (y = 0; y < ysize; y++) {
interleaverow2(fptr, rledat, 3-z, xsize);
rledat += xsize * 2;
@@ -455,14 +460,15 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
if (bpp == 1) {
uchar * rect;
- if (image.zsize == 1){
+ if (image.zsize == 1) {
rect = (uchar *) ibuf->rect;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
rect[0] = 255;
rect[1] = rect[2] = rect[3];
rect += 4;
}
- } else if (image.zsize == 2){
+ }
+ else if (image.zsize == 2) {
/* grayscale with alpha */
rect = (uchar *) ibuf->rect;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
@@ -470,7 +476,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
rect[1] = rect[2] = rect[3];
rect += 4;
}
- } else if (image.zsize == 3){
+ }
+ else if (image.zsize == 3) {
/* add alpha */
rect = (uchar *) ibuf->rect;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
@@ -479,16 +486,18 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
}
}
- } else { /* bpp == 2 */
+ }
+ else { /* bpp == 2 */
- if (image.zsize == 1){
+ if (image.zsize == 1) {
fbase = ibuf->rect_float;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
fbase[0] = 1;
fbase[1] = fbase[2] = fbase[3];
fbase += 4;
}
- } else if (image.zsize == 2){
+ }
+ else if (image.zsize == 2) {
/* grayscale with alpha */
fbase = ibuf->rect_float;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
@@ -496,7 +505,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
fbase[1] = fbase[2] = fbase[3];
fbase += 4;
}
- } else if (image.zsize == 3){
+ }
+ else if (image.zsize == 3) {
/* add alpha */
fbase = ibuf->rect_float;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
@@ -530,7 +540,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n)
{
lptr += z;
- while(n--) {
+ while (n--) {
*lptr = *cptr++;
lptr += 4;
}
@@ -539,7 +549,7 @@ static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n
static void interleaverow2(float *lptr, unsigned char *cptr, int z, int n)
{
lptr += z;
- while(n--) {
+ while (n--) {
*lptr = ((cptr[0]<<8) | (cptr[1]<<0)) / (float)0xFFFF;
cptr += 2;
lptr += 4;
@@ -552,14 +562,14 @@ static void expandrow2(float *optr, unsigned char *iptr, int z)
float pixel_f;
optr += z;
- while(1) {
+ while (1) {
pixel = (iptr[0]<<8) | (iptr[1]<<0);
iptr += 2;
if ( !(count = (pixel & 0x7f)) )
return;
- if(pixel & 0x80) {
- while(count>=8) {
+ if (pixel & 0x80) {
+ while (count>=8) {
optr[0*4] = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
optr[1*4] = ((iptr[2]<<8) | (iptr[3]<<0))/(float)0xFFFF;
optr[2*4] = ((iptr[4]<<8) | (iptr[5]<<0))/(float)0xFFFF;
@@ -572,16 +582,17 @@ static void expandrow2(float *optr, unsigned char *iptr, int z)
iptr += 8*2;
count -= 8;
}
- while(count--) {
+ while (count--) {
*optr = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
iptr+=2;
optr+=4;
}
- } else {
+ }
+ else {
pixel_f = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
iptr += 2;
- while(count>=8) {
+ while (count>=8) {
optr[0*4] = pixel_f;
optr[1*4] = pixel_f;
optr[2*4] = pixel_f;
@@ -593,7 +604,7 @@ static void expandrow2(float *optr, unsigned char *iptr, int z)
optr += 8*4;
count -= 8;
}
- while(count--) {
+ while (count--) {
*optr = pixel_f;
optr+=4;
}
@@ -606,12 +617,12 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z)
unsigned char pixel, count;
optr += z;
- while(1) {
+ while (1) {
pixel = *iptr++;
if ( !(count = (pixel & 0x7f)) )
return;
- if(pixel & 0x80) {
- while(count>=8) {
+ if (pixel & 0x80) {
+ while (count>=8) {
optr[0*4] = iptr[0];
optr[1*4] = iptr[1];
optr[2*4] = iptr[2];
@@ -624,13 +635,14 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z)
iptr += 8;
count -= 8;
}
- while(count--) {
+ while (count--) {
*optr = *iptr++;
optr+=4;
}
- } else {
+ }
+ else {
pixel = *iptr++;
- while(count>=8) {
+ while (count>=8) {
optr[0*4] = pixel;
optr[1*4] = pixel;
optr[2*4] = pixel;
@@ -642,7 +654,7 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z)
optr += 8*4;
count -= 8;
}
- while(count--) {
+ while (count--) {
*optr = pixel;
optr+=4;
}
@@ -674,8 +686,8 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
int rlebuflen, goodwrite;
goodwrite = 1;
- outf = fopen(name, "wb");
- if(!outf) return 0;
+ outf = BLI_fopen(name, "wb");
+ if (!outf) return 0;
tablen = ysize*zsize*sizeof(int);
@@ -689,7 +701,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
memset(image, 0, sizeof(IMAGE));
image->imagic = IMAGIC;
image->type = RLE(1);
- if(zsize>1)
+ if (zsize>1)
image->dim = 3;
else
image->dim = 2;
@@ -710,14 +722,14 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
len = compressrow((uchar *)lumbuf,rlebuf,CHANOFFSET(z),xsize);
}
else {
- if(z<4) {
+ if (z<4) {
len = compressrow((uchar *)lptr, rlebuf,CHANOFFSET(z),xsize);
}
- else if(z<8 && zptr) {
+ else if (z<8 && zptr) {
len = compressrow((uchar *)zptr, rlebuf,CHANOFFSET(z-4),xsize);
}
}
- if(len>rlebuflen) {
+ if (len>rlebuflen) {
fprintf(stderr,"output_iris: rlebuf is too small - bad poop\n");
exit(1);
}
@@ -727,7 +739,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
pos += len;
}
lptr += xsize;
- if(zptr) zptr += xsize;
+ if (zptr) zptr += xsize;
}
fseek(outf,512,SEEK_SET);
@@ -739,7 +751,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
MEM_freeN(rlebuf);
MEM_freeN(lumbuf);
fclose(outf);
- if(goodwrite)
+ if (goodwrite)
return 1;
else {
fprintf(stderr,"output_iris: not enough space for image!!\n");
@@ -752,7 +764,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
static void lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n)
{
lumptr += CHANOFFSET(0);
- while(n--) {
+ while (n--) {
*lumptr = ILUM(rgbptr[OFFSET_R],rgbptr[OFFSET_G],rgbptr[OFFSET_B]);
lumptr += 4;
rgbptr += 4;
@@ -770,18 +782,18 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn
ibufend = iptr+cnt*4;
optr = rlebuf;
- while(iptr<ibufend) {
+ while (iptr<ibufend) {
sptr = iptr;
iptr += 8;
- while((iptr<ibufend)&& ((iptr[-8]!=iptr[-4])||(iptr[-4]!=iptr[0])))
+ while ((iptr<ibufend)&& ((iptr[-8]!=iptr[-4])||(iptr[-4]!=iptr[0])))
iptr+=4;
iptr -= 8;
count = (iptr-sptr)/4;
- while(count) {
+ while (count) {
todo = count>126 ? 126:count;
count -= todo;
*optr++ = 0x80|todo;
- while(todo>8) {
+ while (todo>8) {
optr[0] = sptr[0*4];
optr[1] = sptr[1*4];
optr[2] = sptr[2*4];
@@ -795,7 +807,7 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn
sptr += 8*4;
todo -= 8;
}
- while(todo--) {
+ while (todo--) {
*optr++ = *sptr;
sptr += 4;
}
@@ -803,10 +815,10 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn
sptr = iptr;
cc = *iptr;
iptr += 4;
- while( (iptr<ibufend) && (*iptr == cc) )
+ while ( (iptr<ibufend) && (*iptr == cc) )
iptr += 4;
count = (iptr-sptr)/4;
- while(count) {
+ while (count) {
todo = count>126 ? 126:count;
count -= todo;
*optr++ = todo;
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index c2bdb44be10..275d19d518c 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -157,7 +157,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
opj_cio_close(cio);
- if((image->numcomps * image->x1 * image->y1) == 0) {
+ if ((image->numcomps * image->x1 * image->y1) == 0) {
fprintf(stderr,"\nError: invalid raw image parameters\n");
return NULL;
}
@@ -195,7 +195,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
ibuf= IMB_allocImBuf(w, h, planes, use_float ? IB_rectfloat : IB_rect);
if (ibuf==NULL) {
- if(dinfo)
+ if (dinfo)
opj_destroy_decompress(dinfo);
return NULL;
}
@@ -217,7 +217,8 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
else
rect_float[3]= 1.0f;
}
- } else {
+ }
+ else {
/* rgb or rgba 12bits+ */
for (i = 0; i < w * h; i++, rect_float+=4) {
index = w * h - ((i) / (w) + 1) * w + (i) % (w);
@@ -233,7 +234,8 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
}
}
- } else {
+ }
+ else {
unsigned char *rect= (unsigned char *)ibuf->rect;
if (image->numcomps < 3) {
@@ -248,7 +250,8 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
else
rect[3]= 255;
}
- } else {
+ }
+ else {
/* 8bit rgb or rgba */
for (i = 0; i < w * h; i++, rect+=4) {
int index = w * h - ((i) / (w) + 1) * w + (i) % (w);
@@ -266,7 +269,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
}
/* free remaining structures */
- if(dinfo) {
+ if (dinfo) {
opj_destroy_decompress(dinfo);
}
@@ -365,13 +368,13 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
int i;
float temp_rate;
- switch (parameters->cp_cinema){
+ switch (parameters->cp_cinema) {
case CINEMA2K_24:
case CINEMA2K_48:
- if(parameters->numresolution > 6){
+ if (parameters->numresolution > 6) {
parameters->numresolution = 6;
}
- if (!((image->comps[0].w == 2048) || (image->comps[0].h == 1080))){
+ if (!((image->comps[0].w == 2048) || (image->comps[0].h == 1080))) {
fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\nJPEG Digital Cinema Profile-3 "
"(2K profile) compliance requires that at least one of coordinates match 2048 x 1080\n",
image->comps[0].w,image->comps[0].h);
@@ -380,15 +383,16 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
break;
case CINEMA4K_24:
- if(parameters->numresolution < 1){
- parameters->numresolution = 1;
- }else if(parameters->numresolution > 7){
- parameters->numresolution = 7;
- }
- if (!((image->comps[0].w == 4096) || (image->comps[0].h == 2160))){
- fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4"
- "(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n",
- image->comps[0].w,image->comps[0].h);
+ if (parameters->numresolution < 1) {
+ parameters->numresolution = 1;
+ }
+ else if (parameters->numresolution > 7) {
+ parameters->numresolution = 7;
+ }
+ if (!((image->comps[0].w == 4096) || (image->comps[0].h == 2160))) {
+ fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4"
+ "(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n",
+ image->comps[0].w,image->comps[0].h);
parameters->cp_rsiz = STD_RSIZ;
}
parameters->numpocs = initialise_4K_poc(parameters->POC,parameters->numresolution);
@@ -398,21 +402,23 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
break;
}
- switch (parameters->cp_cinema){
+ switch (parameters->cp_cinema) {
case CINEMA2K_24:
case CINEMA4K_24:
- for(i=0 ; i<parameters->tcp_numlayers ; i++){
+ for (i=0 ; i<parameters->tcp_numlayers ; i++) {
temp_rate = 0;
- if (img_fol->rates[i]== 0){
+ if (img_fol->rates[i]== 0) {
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
- }else{
+ }
+ else {
temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
- if (temp_rate > CINEMA_24_CS ){
+ if (temp_rate > CINEMA_24_CS ) {
parameters->tcp_rates[i]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
- }else{
+ }
+ else {
parameters->tcp_rates[i]= img_fol->rates[i];
}
}
@@ -421,18 +427,20 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
break;
case CINEMA2K_48:
- for(i=0 ; i<parameters->tcp_numlayers ; i++){
+ for (i=0 ; i<parameters->tcp_numlayers ; i++) {
temp_rate = 0;
- if (img_fol->rates[i]== 0){
+ if (img_fol->rates[i]== 0) {
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
- }else{
+ }
+ else {
temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
- if (temp_rate > CINEMA_48_CS ){
+ if (temp_rate > CINEMA_48_CS ) {
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
- }else{
+ }
+ else {
parameters->tcp_rates[i]= img_fol->rates[i];
}
}
@@ -477,9 +485,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
parameters->cp_cinema= CINEMA2K_24;
}
}
- if (parameters->cp_cinema){
+ if (parameters->cp_cinema) {
img_fol.rates = (float*)MEM_mallocN(parameters->tcp_numlayers * sizeof(float), "jp2_rates");
- for(i=0; i< parameters->tcp_numlayers; i++){
+ for (i=0; i< parameters->tcp_numlayers; i++) {
img_fol.rates[i] = parameters->tcp_rates[i];
}
cinema_parameters(parameters);
@@ -508,7 +516,7 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
/* initialize image components */
memset(&cmptparm[0], 0, 4 * sizeof(opj_image_cmptparm_t));
- for(i = 0; i < numcomps; i++) {
+ for (i = 0; i < numcomps; i++) {
cmptparm[i].prec = prec;
cmptparm[i].bpp = prec;
cmptparm[i].sgnd = 0;
@@ -519,7 +527,7 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
}
/* create the image */
image = opj_image_create(numcomps, &cmptparm[0], color_space);
- if(!image) {
+ if (!image) {
printf("Error: opj_image_create() failed\n");
return NULL;
}
@@ -545,9 +553,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
switch (prec) {
case 8: /* Convert blenders float color channels to 8,12 or 16bit ints */
- for(y=h-1; y>=0; y--) {
+ for (y=h-1; y>=0; y--) {
y_row = y*w;
- for(x=0; x<w; x++, rect_float+=4) {
+ for (x=0; x<w; x++, rect_float+=4) {
i = y_row + x;
if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
@@ -565,9 +573,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
break;
case 12:
- for(y=h-1; y>=0; y--) {
+ for (y=h-1; y>=0; y--) {
y_row = y*w;
- for(x=0; x<w; x++, rect_float+=4) {
+ for (x=0; x<w; x++, rect_float+=4) {
i = y_row + x;
if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
@@ -584,9 +592,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
}
break;
case 16:
- for(y=h-1; y>=0; y--) {
+ for (y=h-1; y>=0; y--) {
y_row = y*w;
- for(x=0; x<w; x++, rect_float+=4) {
+ for (x=0; x<w; x++, rect_float+=4) {
i = y_row + x;
if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
@@ -603,13 +611,14 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
}
break;
}
- } else {
+ }
+ else {
/* just use rect*/
switch (prec) {
case 8:
- for(y=h-1; y>=0; y--) {
+ for (y=h-1; y>=0; y--) {
y_row = y*w;
- for(x=0; x<w; x++, rect+=4) {
+ for (x=0; x<w; x++, rect+=4) {
i = y_row + x;
image->comps[0].data[i] = rect[0];
@@ -622,9 +631,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
break;
case 12: /* Up Sampling, a bit pointless but best write the bit depth requested */
- for(y=h-1; y>=0; y--) {
+ for (y=h-1; y>=0; y--) {
y_row = y*w;
- for(x=0; x<w; x++, rect+=4) {
+ for (x=0; x<w; x++, rect+=4) {
i = y_row + x;
image->comps[0].data[i]= UPSAMPLE_8_TO_12(rect[0]);
@@ -636,9 +645,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
}
break;
case 16:
- for(y=h-1; y>=0; y--) {
+ for (y=h-1; y>=0; y--) {
y_row = y*w;
- for(x=0; x<w; x++, rect+=4) {
+ for (x=0; x<w; x++, rect+=4) {
i = y_row + x;
image->comps[0].data[i]= UPSAMPLE_8_TO_16(rect[0]);
@@ -655,7 +664,7 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
/* Decide if MCT should be used */
parameters->tcp_mct = image->numcomps == 3 ? 1 : 0;
- if(parameters->cp_cinema){
+ if (parameters->cp_cinema) {
cinema_setup_encoder(parameters,image,&img_fol);
}
@@ -731,7 +740,7 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags)
codestream_length = cio_tell(cio);
/* write the buffer to disk */
- f = fopen(name, "wb");
+ f = BLI_fopen(name, "wb");
if (!f) {
fprintf(stderr, "failed to open %s for writing\n", name);
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 2aab497649a..3f3ebc5872d 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -158,7 +158,7 @@ static void skip_input_data(j_decompress_ptr cinfo, long num_bytes)
{
my_src_ptr src = (my_src_ptr) cinfo->src;
- if(num_bytes > 0) {
+ if (num_bytes > 0) {
// prevent skipping over file end
size_t skip_size = (size_t)num_bytes <= src->pub.bytes_in_buffer ? num_bytes : src->pub.bytes_in_buffer;
@@ -372,8 +372,8 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
}
marker= cinfo->marker_list;
- while(marker) {
- if(marker->marker != JPEG_COM)
+ while (marker) {
+ if (marker->marker != JPEG_COM)
goto next_stamp_marker;
/*
@@ -385,7 +385,7 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
* That is why we need split it to the
* common key/value here.
*/
- if(strncmp((char *) marker->data, "Blender", 7)) {
+ if (strncmp((char *) marker->data, "Blender", 7)) {
/*
* Maybe the file have text that
* we don't know "what it's", in that
@@ -432,7 +432,7 @@ next_stamp_marker:
}
jpeg_destroy((j_common_ptr) cinfo);
- if(ibuf) {
+ if (ibuf) {
ibuf->ftype = ibuf_ftype;
ibuf->profile = IB_PROFILE_SRGB;
}
@@ -447,7 +447,7 @@ ImBuf * imb_load_jpeg (unsigned char * buffer, size_t size, int flags)
struct my_error_mgr jerr;
ImBuf * ibuf;
- if(!imb_is_a_jpeg(buffer)) return NULL;
+ if (!imb_is_a_jpeg(buffer)) return NULL;
cinfo->err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = jpeg_error;
@@ -488,11 +488,11 @@ static void write_jpeg(struct jpeg_compress_struct * cinfo, struct ImBuf * ibuf)
memcpy(neogeo + 6, &ibuf_ftype, 4);
jpeg_write_marker(cinfo, 0xe1, (JOCTET*) neogeo, 10);
- if(ibuf->metadata) {
+ if (ibuf->metadata) {
/* key + max value + "Blender" */
text= MEM_mallocN(530, "stamp info read");
iptr= ibuf->metadata;
- while(iptr) {
+ while (iptr) {
if (!strcmp (iptr->key, "None")) {
jpeg_write_marker(cinfo, JPEG_COM, (JOCTET *) iptr->value, strlen (iptr->value) + 1);
goto next_stamp_info;
@@ -520,11 +520,11 @@ next_stamp_info:
cinfo->input_components *
cinfo->image_width, "jpeg row_pointer");
- for(y = ibuf->y - 1; y >= 0; y--){
+ for (y = ibuf->y - 1; y >= 0; y--) {
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;
@@ -608,7 +608,7 @@ static int save_stdjpeg(const char *name, struct ImBuf *ibuf)
struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo;
struct my_error_mgr jerr;
- if ((outfile = fopen(name, "wb")) == NULL) return 0;
+ if ((outfile = BLI_fopen(name, "wb")) == NULL) return 0;
jpeg_default_quality = 75;
cinfo->err = jpeg_std_error(&jerr.pub);
@@ -642,7 +642,7 @@ static int save_vidjpeg(const char *name, struct ImBuf *ibuf)
struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo;
struct my_error_mgr jerr;
- if ((outfile = fopen(name, "wb")) == NULL) return 0;
+ if ((outfile = BLI_fopen(name, "wb")) == NULL) return 0;
jpeg_default_quality = 90;
cinfo->err = jpeg_std_error(&jerr.pub);
@@ -712,7 +712,7 @@ static int save_maxjpeg(const char *name, struct ImBuf *ibuf)
struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo;
struct my_error_mgr jerr;
- if ((outfile = fopen(name, "wb")) == NULL) return 0;
+ if ((outfile = BLI_fopen(name, "wb")) == NULL) return 0;
jpeg_default_quality = 100;
cinfo->err = jpeg_std_error(&jerr.pub);
diff --git a/source/blender/imbuf/intern/metadata.c b/source/blender/imbuf/intern/metadata.c
index 2b6fed59004..0da7358b55b 100644
--- a/source/blender/imbuf/intern/metadata.c
+++ b/source/blender/imbuf/intern/metadata.c
@@ -95,7 +95,8 @@ int IMB_metadata_add_field(struct ImBuf* img, const char* key, const char* value
if (!img->metadata) {
img->metadata = MEM_callocN(sizeof(ImMetaData), "ImMetaData");
info = img->metadata;
- } else {
+ }
+ else {
info = img->metadata;
last = info;
while (info) {
diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c
index 67d9a602d12..307c634b26a 100644
--- a/source/blender/imbuf/intern/moviecache.c
+++ b/source/blender/imbuf/intern/moviecache.c
@@ -114,13 +114,13 @@ static void check_unused_keys(MovieCache *cache)
GHashIterator *iter;
iter= BLI_ghashIterator_new(cache->hash);
- while(!BLI_ghashIterator_isDone(iter)) {
+ while (!BLI_ghashIterator_isDone(iter)) {
MovieCacheKey *key= BLI_ghashIterator_getKey(iter);
MovieCacheItem *item= BLI_ghashIterator_getValue(iter);
BLI_ghashIterator_step(iter);
- if(!item->ibuf)
+ if (!item->ibuf)
BLI_ghash_remove(cache->hash, key, moviecache_keyfree, moviecache_valfree);
}
@@ -154,22 +154,22 @@ static size_t IMB_get_size_in_memory(ImBuf *ibuf)
size+= sizeof(ImBuf);
- if(ibuf->rect)
+ if (ibuf->rect)
channel_size+= sizeof(char);
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
channel_size+= sizeof(float);
size+= channel_size*ibuf->x*ibuf->y*ibuf->channels;
- if(ibuf->miptot) {
- for(a= 0; a<ibuf->miptot; a++) {
- if(ibuf->mipmap[a])
+ if (ibuf->miptot) {
+ for (a= 0; a<ibuf->miptot; a++) {
+ if (ibuf->mipmap[a])
size+= IMB_get_size_in_memory(ibuf->mipmap[a]);
}
}
- if(ibuf->tiles) {
+ if (ibuf->tiles) {
size+= sizeof(unsigned int)*ibuf->ytiles*ibuf->xtiles;
}
@@ -181,7 +181,7 @@ static size_t get_item_size (void *p)
size_t size= sizeof(MovieCacheItem);
MovieCacheItem *item= (MovieCacheItem *) p;
- if(item->ibuf)
+ if (item->ibuf)
size+= IMB_get_size_in_memory(item->ibuf);
return size;
@@ -194,7 +194,7 @@ void IMB_moviecache_init(void)
void IMB_moviecache_destruct(void)
{
- if(limitor)
+ if (limitor)
delete_MEM_CacheLimiter(limitor);
}
@@ -223,7 +223,7 @@ void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
MovieCacheKey *key;
MovieCacheItem *item;
- if(!limitor)
+ if (!limitor)
IMB_moviecache_init();
IMB_refImBuf(ibuf);
@@ -251,7 +251,7 @@ void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
/* cache limiter can't remove unused keys which points to destoryed values */
check_unused_keys(cache);
- if(cache->points) {
+ if (cache->points) {
MEM_freeN(cache->points);
cache->points= NULL;
}
@@ -266,10 +266,10 @@ ImBuf* IMB_moviecache_get(MovieCache *cache, void *userkey)
key.userkey= userkey;
item= (MovieCacheItem*)BLI_ghash_lookup(cache->hash, &key);
- if(item) {
+ if (item) {
item->last_access= cache->curtime++;
- if(item->ibuf) {
+ if (item->ibuf) {
MEM_CacheLimiter_touch(item->c_handle);
IMB_refImBuf(item->ibuf);
@@ -288,7 +288,7 @@ void IMB_moviecache_free(MovieCache *cache)
BLI_mempool_destroy(cache->items_pool);
BLI_mempool_destroy(cache->userkeys_pool);
- if(cache->points)
+ if (cache->points)
MEM_freeN(cache->points);
MEM_freeN(cache);
@@ -300,20 +300,21 @@ void IMB_moviecache_get_cache_segments(MovieCache *cache, int proxy, int render_
*totseg_r= 0;
*points_r= NULL;
- if(!cache->getdatafp)
+ if (!cache->getdatafp)
return;
- if(cache->proxy!=proxy || cache->render_flags!=render_flags) {
- if(cache->points)
+ if (cache->proxy!=proxy || cache->render_flags!=render_flags) {
+ if (cache->points)
MEM_freeN(cache->points);
cache->points= NULL;
}
- if(cache->points) {
+ if (cache->points) {
*totseg_r= cache->totseg;
*points_r= cache->points;
- } else {
+ }
+ else {
int totframe= BLI_ghash_size(cache->hash);
int *frames= MEM_callocN(totframe*sizeof(int), "movieclip cache frames");
int a, totseg= 0;
@@ -321,15 +322,15 @@ void IMB_moviecache_get_cache_segments(MovieCache *cache, int proxy, int render_
iter= BLI_ghashIterator_new(cache->hash);
a= 0;
- while(!BLI_ghashIterator_isDone(iter)) {
+ while (!BLI_ghashIterator_isDone(iter)) {
MovieCacheKey *key= BLI_ghashIterator_getKey(iter);
MovieCacheItem *item= BLI_ghashIterator_getValue(iter);
int framenr, curproxy, curflags;
- if(item->ibuf) {
+ if (item->ibuf) {
cache->getdatafp(key->userkey, &framenr, &curproxy, &curflags);
- if(curproxy==proxy && curflags==render_flags)
+ if (curproxy==proxy && curflags==render_flags)
frames[a++]= framenr;
}
@@ -341,30 +342,30 @@ void IMB_moviecache_get_cache_segments(MovieCache *cache, int proxy, int render_
qsort(frames, totframe, sizeof(int), compare_int);
/* count */
- for(a= 0; a<totframe; a++) {
- if(a && frames[a]-frames[a-1]!=1)
+ for (a= 0; a<totframe; a++) {
+ if (a && frames[a]-frames[a-1]!=1)
totseg++;
- if(a==totframe-1)
+ if (a==totframe-1)
totseg++;
}
- if(totseg) {
+ if (totseg) {
int b, *points;
points= MEM_callocN(2*sizeof(int)*totseg, "movieclip cache segments");
/* fill */
- for(a= 0, b= 0; a<totframe; a++) {
- if(a==0)
+ for (a= 0, b= 0; a<totframe; a++) {
+ if (a==0)
points[b++]= frames[a];
- if(a && frames[a]-frames[a-1]!=1) {
+ if (a && frames[a]-frames[a-1]!=1) {
points[b++]= frames[a-1];
points[b++]= frames[a];
}
- if(a==totframe-1)
+ if (a==totframe-1)
points[b++]= frames[a];
}
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index bd79a6ea48b..3d90267b030 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -187,7 +187,7 @@ static void openexr_header_metadata(Header *header, struct ImBuf *ibuf)
{
ImMetaData* info;
- for(info= ibuf->metadata; info; info= info->next)
+ for (info= ibuf->metadata; info; info= info->next)
header->insert(info->key, StringAttribute(info->value));
}
@@ -231,7 +231,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
if (write_zbuf)
frameBuffer.insert ("Z", Slice (FLOAT, (char *)(ibuf->zbuf_float + (height-1)*width),
sizeof(float), sizeof(float) * -width));
- if(ibuf->rect_float) {
+ if (ibuf->rect_float) {
float *from;
for (int i = ibuf->y-1; i >= 0; i--)
@@ -251,7 +251,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
else {
unsigned char *from;
- if(ibuf->profile == IB_PROFILE_LINEAR_RGB) {
+ if (ibuf->profile == IB_PROFILE_LINEAR_RGB) {
for (int i = ibuf->y-1; i >= 0; i--)
{
from= (unsigned char *)ibuf->rect + channels*i*width;
@@ -333,7 +333,7 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag
rect[0]= ibuf->rect_float + channels*(height-1)*width;
rect[1]= rect[0]+1;
rect[2]= rect[0]+2;
- rect[3]= (channels >= 4)? rect[0]+3:rect[0]; /* red as alpha, is this needed since alpha isnt written? */
+ rect[3]= (channels >= 4)? rect[0]+3:rect[0]; /* red as alpha, is this needed since alpha isn't written? */
frameBuffer.insert ("R", Slice (FLOAT, (char *)rect[0], xstride, ystride));
frameBuffer.insert ("G", Slice (FLOAT, (char *)rect[1], xstride, ystride));
@@ -451,7 +451,7 @@ void IMB_exr_add_channel(void *handle, const char *layname, const char *passname
echan= (ExrChannel *)MEM_callocN(sizeof(ExrChannel), "exr tile channel");
- if(layname) {
+ if (layname) {
char lay[EXR_LAY_MAXNAME+1], pass[EXR_PASS_MAXNAME+1];
BLI_strncpy(lay, layname, EXR_LAY_MAXNAME);
BLI_strncpy(pass, passname, EXR_PASS_MAXNAME);
@@ -479,7 +479,7 @@ int IMB_exr_begin_write(void *handle, const char *filename, int width, int heigh
data->width= width;
data->height= height;
- for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
+ for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
header.channels().insert (echan->name, Channel (FLOAT));
openexr_header_compression(&header, compress);
@@ -488,7 +488,7 @@ int IMB_exr_begin_write(void *handle, const char *filename, int width, int heigh
header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.55.1 and newer"));
- /* avoid crash/abort when we dont have permission to write here */
+ /* avoid crash/abort when we don't have permission to write here */
try {
data->ofile = new OutputFile(filename, header);
}
@@ -512,7 +512,7 @@ void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int
data->height= height;
data->mipmap= mipmap;
- for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
+ for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
header.channels().insert (echan->name, Channel (FLOAT));
header.setTileDescription (TileDescription (tilex, tiley, (mipmap)? MIPMAP_LEVELS: ONE_LEVEL));
@@ -529,9 +529,9 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig
{
ExrHandle *data= (ExrHandle *)handle;
- if(BLI_exists(filename) && BLI_file_size(filename)>32) { /* 32 is arbitrary, but zero length files crashes exr */
+ if (BLI_exists(filename) && BLI_file_size(filename)>32) { /* 32 is arbitrary, but zero length files crashes exr */
data->ifile = new InputFile(filename);
- if(data->ifile) {
+ if (data->ifile) {
Box2i dw = data->ifile->header().dataWindow();
data->width= *width = dw.max.x - dw.min.x + 1;
data->height= *height = dw.max.y - dw.min.y + 1;
@@ -554,7 +554,7 @@ void IMB_exr_set_channel(void *handle, const char *layname, const char *passname
ExrChannel *echan;
char name[EXR_TOT_MAXNAME + 1];
- if(layname) {
+ if (layname) {
char lay[EXR_LAY_MAXNAME+1], pass[EXR_PASS_MAXNAME+1];
BLI_strncpy(lay, layname, EXR_LAY_MAXNAME);
BLI_strncpy(pass, passname, EXR_PASS_MAXNAME);
@@ -566,7 +566,7 @@ void IMB_exr_set_channel(void *handle, const char *layname, const char *passname
echan= (ExrChannel *)BLI_findstring(&data->channels, name, offsetof(ExrChannel, name));
- if(echan) {
+ if (echan) {
echan->xstride= xstride;
echan->ystride= ystride;
echan->rect= rect;
@@ -587,7 +587,7 @@ void IMB_exrtile_write_channels(void *handle, int partx, int party, int level)
FrameBuffer frameBuffer;
ExrChannel *echan;
- for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
+ for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
float *rect= echan->rect - echan->xstride*partx - echan->ystride*party;
frameBuffer.insert (echan->name, Slice (FLOAT, (char *)rect,
@@ -611,8 +611,8 @@ void IMB_exr_write_channels(void *handle)
FrameBuffer frameBuffer;
ExrChannel *echan;
- if(data->channels.first) {
- for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
+ if (data->channels.first) {
+ for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
/* last scanline, stride negative */
float *rect = echan->rect + echan->xstride*(data->height-1)*data->width;
@@ -643,10 +643,10 @@ void IMB_exr_read_channels(void *handle)
const StringAttribute *ta = data->ifile->header().findTypedAttribute <StringAttribute> ("BlenderMultiChannel");
short flip = (ta && strncmp(ta->value().c_str(), "Blender V2.43", 13)==0); /* 'previous multilayer attribute, flipped */
- for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
+ for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
- if(echan->rect) {
- if(flip)
+ if (echan->rect) {
+ if (flip)
frameBuffer.insert (echan->name, Slice (FLOAT, (char *)echan->rect,
echan->xstride*sizeof(float), echan->ystride*sizeof(float)));
else
@@ -676,15 +676,15 @@ void IMB_exr_multilayer_convert(void *handle, void *base,
ExrLayer *lay;
ExrPass *pass;
- if(data->layers.first==NULL) {
+ if (data->layers.first==NULL) {
printf("cannot convert multilayer, no layers in handle\n");
return;
}
- for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
+ for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
void *laybase= addlayer(base, lay->name);
- if(laybase) {
- for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) {
+ if (laybase) {
+ for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) {
addpass(base, laybase, pass->name, pass->rect, pass->totchan, pass->chan_id);
pass->rect= NULL;
}
@@ -699,11 +699,11 @@ void IMB_exr_close(void *handle)
ExrLayer *lay;
ExrPass *pass;
- if(data->ifile)
+ if (data->ifile)
delete data->ifile;
- else if(data->ofile)
+ else if (data->ofile)
delete data->ofile;
- else if(data->tofile)
+ else if (data->tofile)
delete data->tofile;
data->ifile= NULL;
@@ -712,9 +712,9 @@ void IMB_exr_close(void *handle)
BLI_freelistN(&data->channels);
- for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
- for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next)
- if(pass->rect)
+ for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
+ for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next)
+ if (pass->rect)
MEM_freeN(pass->rect);
BLI_freelistN(&lay->passes);
}
@@ -730,11 +730,11 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa
{
int plen, len= strlen(echan->name);
- if(len < 4) {
+ if (len < 4) {
printf("multilayer read: name too short: %s\n", echan->name);
return 0;
}
- if(echan->name[len-2]!='.') {
+ if (echan->name[len-2]!='.') {
printf("multilayer read: name has no Channel: %s\n", echan->name);
return 0;
}
@@ -742,19 +742,19 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa
len-= 3;
while(len>=0) {
- if(echan->name[len]=='.')
+ if (echan->name[len]=='.')
break;
len--;
}
BLI_strncpy(passname, echan->name+len+1, EXR_PASS_MAXNAME);
plen= strlen(passname);
- if(plen < 3) {
+ if (plen < 3) {
printf("multilayer read: should not happen: %s\n", echan->name);
return 0;
}
passname[plen-2]= 0;
- if(len<1)
+ if (len<1)
layname[0]= 0;
else {
BLI_strncpy(layname, echan->name, EXR_LAY_MAXNAME);
@@ -768,7 +768,7 @@ static ExrLayer *imb_exr_get_layer(ListBase *lb, char *layname)
{
ExrLayer *lay= (ExrLayer *)BLI_findstring(lb, layname, offsetof(ExrLayer, name));
- if(lay==NULL) {
+ if (lay==NULL) {
lay= (ExrLayer *)MEM_callocN(sizeof(ExrLayer), "exr layer");
BLI_addtail(lb, lay);
BLI_strncpy(lay->name, layname, EXR_LAY_MAXNAME);
@@ -781,10 +781,10 @@ static ExrPass *imb_exr_get_pass(ListBase *lb, char *passname)
{
ExrPass *pass= (ExrPass *)BLI_findstring(lb, passname, offsetof(ExrPass, name));
- if(pass==NULL) {
+ if (pass==NULL) {
pass= (ExrPass *)MEM_callocN(sizeof(ExrPass), "exr pass");
- if(strcmp(passname, "Combined")==0)
+ if (strcmp(passname, "Combined")==0)
BLI_addhead(lb, pass);
else
BLI_addtail(lb, pass);
@@ -816,29 +816,29 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height)
/* now try to sort out how to assign memory to the channels */
/* first build hierarchical layer list */
- for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
- if( imb_exr_split_channel_name(echan, layname, passname) ) {
+ for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
+ if ( imb_exr_split_channel_name(echan, layname, passname) ) {
ExrLayer *lay= imb_exr_get_layer(&data->layers, layname);
ExrPass *pass= imb_exr_get_pass(&lay->passes, passname);
pass->chan[pass->totchan]= echan;
pass->totchan++;
- if(pass->totchan>=EXR_PASS_MAXCHAN)
+ if (pass->totchan>=EXR_PASS_MAXCHAN)
break;
}
}
- if(echan) {
+ if (echan) {
printf("error, too many channels in one pass: %s\n", echan->name);
IMB_exr_close(data);
return NULL;
}
/* with some heuristics, try to merge the channels in buffers */
- for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
- for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) {
- if(pass->totchan) {
+ for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
+ for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) {
+ if (pass->totchan) {
pass->rect= (float *)MEM_mapallocN(width*height*pass->totchan*sizeof(float), "pass rect");
- if(pass->totchan==1) {
+ if (pass->totchan==1) {
echan= pass->chan[0];
echan->rect= pass->rect;
echan->xstride= 1;
@@ -851,14 +851,14 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height)
memset(lookup, 0, sizeof(lookup));
/* we can have RGB(A), XYZ(W), UVA */
- if(pass->totchan==3 || pass->totchan==4) {
- if(pass->chan[0]->chan_id=='B' || pass->chan[1]->chan_id=='B' || pass->chan[2]->chan_id=='B') {
+ if (pass->totchan==3 || pass->totchan==4) {
+ if (pass->chan[0]->chan_id=='B' || pass->chan[1]->chan_id=='B' || pass->chan[2]->chan_id=='B') {
lookup[(unsigned int)'R']= 0;
lookup[(unsigned int)'G']= 1;
lookup[(unsigned int)'B']= 2;
lookup[(unsigned int)'A']= 3;
}
- else if(pass->chan[0]->chan_id=='Y' || pass->chan[1]->chan_id=='Y' || pass->chan[2]->chan_id=='Y') {
+ else if (pass->chan[0]->chan_id=='Y' || pass->chan[1]->chan_id=='Y' || pass->chan[2]->chan_id=='Y') {
lookup[(unsigned int)'X']= 0;
lookup[(unsigned int)'Y']= 1;
lookup[(unsigned int)'Z']= 2;
@@ -869,7 +869,7 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height)
lookup[(unsigned int)'V']= 1;
lookup[(unsigned int)'A']= 2;
}
- for(a=0; a<pass->totchan; a++) {
+ for (a=0; a<pass->totchan; a++) {
echan= pass->chan[a];
echan->rect= pass->rect + lookup[(unsigned int)echan->chan_id];
echan->xstride= pass->totchan;
@@ -878,7 +878,7 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height)
}
}
else { /* unknown */
- for(a=0; a<pass->totchan; a++) {
+ for (a=0; a<pass->totchan; a++) {
echan= pass->chan[a];
echan->rect= pass->rect + a;
echan->xstride= pass->totchan;
@@ -928,8 +928,8 @@ static const char *exr_rgba_channelname(InputFile *file, const char *chan)
/* const Channel &channel = i.channel(); */ /* Not used yet */
const char *str= i.name();
int len= strlen(str);
- if(len) {
- if(BLI_strcasecmp(chan, str+len-1)==0) {
+ if (len) {
+ if (BLI_strcasecmp(chan, str+len-1)==0) {
return str;
}
}
@@ -947,8 +947,8 @@ static int exr_has_zbuffer(InputFile *file)
static int exr_is_renderresult(InputFile *file)
{
const StringAttribute *comments= file->header().findTypedAttribute<StringAttribute>("BlenderMultiChannel");
- if(comments)
-// if(comments->value() == "Blender MultiChannel")
+ if (comments)
+// if (comments->value() == "Blender MultiChannel")
return 1;
return 0;
}
@@ -973,13 +973,13 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
//printf("OpenEXR-load: image data window %d %d %d %d\n",
// dw.min.x, dw.min.y, dw.max.x, dw.max.y);
- if(0) // debug
+ if (0) // debug
exr_print_filecontents(file);
is_multi= exr_is_renderresult(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");
}
@@ -993,11 +993,11 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
if (!(flags & IB_test))
{
- if(is_multi) /* only enters with IB_multilayer flag set */
+ 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) {
+ if (handle) {
IMB_exr_read_channels(handle);
ibuf->userdata= handle; /* potential danger, the caller has to check for this! */
return ibuf;
@@ -1026,7 +1026,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
frameBuffer.insert ( exr_rgba_channelname(file, "A"),
Slice (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;
@@ -1046,7 +1046,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
//
// Disabling this because the sequencer frees immediate.
//
- // if(flag & IM_rect)
+ // if (flag & IM_rect)
// IMB_rect_from_float(ibuf);
}
}
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 84f3e18591d..de935c7cc42 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -114,7 +114,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
compression= compression < 0 ? 0 : (compression > 9 ? 9 : compression);
/* for prints */
- if(flags & IB_mem)
+ if (flags & IB_mem)
name= "<memory>";
bytesperpixel = (ibuf->planes + 7) >> 3;
@@ -195,7 +195,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
Flush);
}
else {
- fp = fopen(name, "wb");
+ fp = BLI_fopen(name, "wb");
if (!fp) {
png_destroy_write_struct(&png_ptr, &info_ptr);
MEM_freeN(pixels);
@@ -256,7 +256,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
}
- if(ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) {
+ if (ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) {
png_set_pHYs(png_ptr, info_ptr, (unsigned int)(ibuf->ppm[0] + 0.5), (unsigned int)(ibuf->ppm[1] + 0.5), PNG_RESOLUTION_METER);
}
@@ -366,7 +366,8 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags)
png_set_palette_to_rgb(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
bytesperpixel = 4;
- } else {
+ }
+ else {
bytesperpixel = 3;
}
break;
@@ -392,8 +393,8 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags)
int unit_type;
png_uint_32 xres, yres;
- if(png_get_pHYs(png_ptr, info_ptr, &xres, &yres, &unit_type))
- if(unit_type == PNG_RESOLUTION_METER) {
+ if (png_get_pHYs(png_ptr, info_ptr, &xres, &yres, &unit_type))
+ if (unit_type == PNG_RESOLUTION_METER) {
ibuf->ppm[0]= xres;
ibuf->ppm[1]= yres;
}
@@ -470,7 +471,7 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags)
if (flags & IB_metadata) {
png_text* text_chunks;
int count = png_get_text(png_ptr, info_ptr, &text_chunks, NULL);
- for(i = 0; i < count; i++) {
+ for (i = 0; i < count; i++) {
IMB_metadata_add_field(ibuf, text_chunks[i].key, text_chunks[i].text);
ibuf->flags |= IB_metadata;
}
diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c
index 9265da8d8dc..5b093dc6cac 100644
--- a/source/blender/imbuf/intern/radiance_hdr.c
+++ b/source/blender/imbuf/intern/radiance_hdr.c
@@ -262,7 +262,8 @@ static int fwritecolrs(FILE* file, int width, int channels, unsigned char* ibufs
fcol[RED] = fpscan[j];
fcol[GRN] = (channels >= 2)? fpscan[j+1]: fpscan[j];
fcol[BLU] = (channels >= 3)? fpscan[j+2]: fpscan[j];
- } else {
+ }
+ else {
fcol[RED] = (float)ibufscan[j] / 255.f;
fcol[GRN] = (float)((channels >= 2)? ibufscan[j+1]: ibufscan[j]) / 255.f;
fcol[BLU] = (float)((channels >= 3)? ibufscan[j+2]: ibufscan[j]) / 255.f;
@@ -332,7 +333,7 @@ static void writeHeader(FILE *file, int width, int height)
int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags)
{
- FILE* file = fopen(name, "wb");
+ FILE* file = BLI_fopen(name, "wb");
float *fp= NULL;
int y, width=ibuf->x, height=ibuf->y;
unsigned char *cp= NULL;
@@ -343,9 +344,9 @@ int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags)
writeHeader(file, width, height);
- if(ibuf->rect)
+ if (ibuf->rect)
cp= (unsigned char *)ibuf->rect + ibuf->channels*(height-1)*width;
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
fp= ibuf->rect_float + ibuf->channels*(height-1)*width;
for (y=height-1;y>=0;y--) {
@@ -354,8 +355,8 @@ int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags)
printf("HDR write error\n");
return 0;
}
- if(cp) cp-= ibuf->channels*width;
- if(fp) fp-= ibuf->channels*width;
+ if (cp) cp-= ibuf->channels*width;
+ if (fp) fp-= ibuf->channels*width;
}
fclose(file);
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index c2f73efa63f..61f90f7a97a 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -55,16 +55,16 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, const c
ImBuf *ibuf;
ImFileType *type;
- if(mem == NULL) {
+ if (mem == NULL) {
fprintf(stderr, "%s: NULL pointer\n", __func__);
return NULL;
}
- for(type=IMB_FILE_TYPES; type->is_a; type++) {
- if(type->load) {
+ for (type=IMB_FILE_TYPES; type->is_a; type++) {
+ if (type->load) {
ibuf= type->load(mem, size, flags);
- if(ibuf) {
- if(flags & IB_premul) {
+ if (ibuf) {
+ if (flags & IB_premul) {
IMB_premultiply_alpha(ibuf);
ibuf->flags |= IB_premul;
}
@@ -85,19 +85,19 @@ ImBuf *IMB_loadifffile(int file, int flags, const char *descr)
unsigned char *mem;
size_t size;
- if(file == -1) return NULL;
+ if (file == -1) return NULL;
size= BLI_file_descriptor_size(file);
mem= mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0);
- if(mem==(unsigned char*)-1) {
+ if (mem==(unsigned char*)-1) {
fprintf(stderr, "%s: couldn't get mapping %s\n", __func__, descr);
return NULL;
}
ibuf= IMB_ibImageFromMemory(mem, size, flags, descr);
- if(munmap(mem, size))
+ if (munmap(mem, size))
fprintf(stderr, "%s: couldn't unmap file %s\n", __func__, descr);
return ibuf;
@@ -106,12 +106,12 @@ ImBuf *IMB_loadifffile(int file, int flags, const char *descr)
static void imb_cache_filename(char *filename, const char *name, int flags)
{
/* read .tx instead if it exists and is not older */
- if(flags & IB_tilecache) {
+ if (flags & IB_tilecache) {
BLI_strncpy(filename, name, IB_FILENAME_SIZE);
- if(!BLI_replace_extension(filename, IB_FILENAME_SIZE, ".tx"))
+ if (!BLI_replace_extension(filename, IB_FILENAME_SIZE, ".tx"))
return;
- if(BLI_file_older(name, filename))
+ if (BLI_file_older(name, filename))
return;
}
@@ -126,17 +126,17 @@ ImBuf *IMB_loadiffname(const char *filepath, int flags)
imb_cache_filename(filepath_tx, filepath, flags);
- file = open(filepath_tx, O_BINARY|O_RDONLY);
- if(file < 0) return NULL;
+ file = BLI_open(filepath_tx, O_BINARY|O_RDONLY, 0);
+ if (file < 0) return NULL;
ibuf= IMB_loadifffile(file, flags, filepath_tx);
- if(ibuf) {
+ if (ibuf) {
BLI_strncpy(ibuf->name, filepath, sizeof(ibuf->name));
BLI_strncpy(ibuf->cachename, filepath_tx, sizeof(ibuf->cachename));
- for(a=1; a<ibuf->miptot; a++)
+ for (a=1; a<ibuf->miptot; a++)
BLI_strncpy(ibuf->mipmap[a-1]->cachename, filepath_tx, sizeof(ibuf->cachename));
- if(flags & IB_fields) IMB_de_interlace(ibuf);
+ if (flags & IB_fields) IMB_de_interlace(ibuf);
}
close(file);
@@ -152,12 +152,12 @@ ImBuf *IMB_testiffname(const char *filepath, int flags)
imb_cache_filename(filepath_tx, filepath, flags);
- file = open(filepath_tx,O_BINARY|O_RDONLY);
- if(file < 0) return NULL;
+ file = BLI_open(filepath_tx,O_BINARY|O_RDONLY,0);
+ if (file < 0) return NULL;
ibuf=IMB_loadifffile(file, flags|IB_test|IB_multilayer, filepath_tx);
- if(ibuf) {
+ if (ibuf) {
BLI_strncpy(ibuf->name, filepath, sizeof(ibuf->name));
BLI_strncpy(ibuf->cachename, filepath_tx, sizeof(ibuf->cachename));
}
@@ -173,21 +173,21 @@ static void imb_loadtilefile(ImBuf *ibuf, int file, int tx, int ty, unsigned int
unsigned char *mem;
size_t size;
- if(file == -1) return;
+ if (file == -1) return;
size= BLI_file_descriptor_size(file);
mem= mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0);
- if(mem==(unsigned char*)-1) {
+ if (mem==(unsigned char*)-1) {
fprintf(stderr, "Couldn't get memory mapping for %s\n", ibuf->cachename);
return;
}
- for(type=IMB_FILE_TYPES; type->is_a; type++)
- if(type->load_tile && type->ftype(type, ibuf))
+ for (type=IMB_FILE_TYPES; type->is_a; type++)
+ if (type->load_tile && type->ftype(type, ibuf))
type->load_tile(ibuf, mem, size, tx, ty, rect);
- if(munmap(mem, size))
+ if (munmap(mem, size))
fprintf(stderr, "Couldn't unmap memory for %s.\n", ibuf->cachename);
}
@@ -195,8 +195,8 @@ void imb_loadtile(ImBuf *ibuf, int tx, int ty, unsigned int *rect)
{
int file;
- file = open(ibuf->cachename, O_BINARY|O_RDONLY);
- if(file < 0) return;
+ file = BLI_open(ibuf->cachename, O_BINARY|O_RDONLY, 0);
+ if (file < 0) return;
imb_loadtilefile(ibuf, file, tx, ty, rect);
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index 492d0af2ac8..6ea84fd6717 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -61,11 +61,11 @@ static void blend_color_add(char *cp, char *cp1, char *cp2, int fac)
int temp;
temp= cp1[0] + ((fac*cp2[0])/255);
- if(temp>254) cp[0]= 255; else cp[0]= temp;
+ if (temp>254) cp[0]= 255; else cp[0]= temp;
temp= cp1[1] + ((fac*cp2[1])/255);
- if(temp>254) cp[1]= 255; else cp[1]= temp;
+ if (temp>254) cp[1]= 255; else cp[1]= temp;
temp= cp1[2] + ((fac*cp2[2])/255);
- if(temp>254) cp[2]= 255; else cp[2]= temp;
+ if (temp>254) cp[2]= 255; else cp[2]= temp;
}
static void blend_color_sub(char *cp, char *cp1, char *cp2, int fac)
@@ -73,11 +73,11 @@ static void blend_color_sub(char *cp, char *cp1, char *cp2, int fac)
int temp;
temp= cp1[0] - ((fac*cp2[0])/255);
- if(temp<0) cp[0]= 0; else cp[0]= temp;
+ if (temp<0) cp[0]= 0; else cp[0]= temp;
temp= cp1[1] - ((fac*cp2[1])/255);
- if(temp<0) cp[1]= 0; else cp[1]= temp;
+ if (temp<0) cp[1]= 0; else cp[1]= temp;
temp= cp1[2] - ((fac*cp2[2])/255);
- if(temp<0) cp[2]= 0; else cp[2]= temp;
+ if (temp<0) cp[2]= 0; else cp[2]= temp;
}
static void blend_color_mul(char *cp, char *cp1, char *cp2, int fac)
@@ -92,7 +92,7 @@ static void blend_color_mul(char *cp, char *cp1, char *cp2, int fac)
static void blend_color_lighten(char *cp, char *cp1, char *cp2, int fac)
{
- /* See if are lighter, if so mix, else dont do anything.
+ /* See if are lighter, if so mix, else don't do anything.
* if the paint col is darker then the original, then ignore */
if (cp1[0]+cp1[1]+cp1[2] > cp2[0]+cp2[1]+cp2[2]) {
cp[0]= cp1[0];
@@ -105,7 +105,7 @@ static void blend_color_lighten(char *cp, char *cp1, char *cp2, int fac)
static void blend_color_darken(char *cp, char *cp1, char *cp2, int fac)
{
- /* See if were darker, if so mix, else dont do anything.
+ /* See if were darker, if so mix, else don't do anything.
* if the paint col is brighter then the original, then ignore */
if (cp1[0]+cp1[1]+cp1[2] < cp2[0]+cp2[1]+cp2[2]) {
cp[0]= cp1[0];
@@ -201,7 +201,7 @@ static void blend_color_mul_float(float *cp, float *cp1, float *cp2, float fac)
static void blend_color_lighten_float(float *cp, float *cp1, float *cp2, float fac)
{
- /* See if are lighter, if so mix, else dont do anything.
+ /* See if are lighter, if so mix, else don't do anything.
* if the pafloat col is darker then the original, then ignore */
if (cp1[0]+cp1[1]+cp1[2] > cp2[0]+cp2[1]+cp2[2]) {
cp[0]= cp1[0];
@@ -214,7 +214,7 @@ static void blend_color_lighten_float(float *cp, float *cp1, float *cp2, float f
static void blend_color_darken_float(float *cp, float *cp1, float *cp2, float fac)
{
- /* See if were darker, if so mix, else dont do anything.
+ /* See if were darker, if so mix, else don't do anything.
* if the pafloat col is brighter then the original, then ignore */
if (cp1[0]+cp1[1]+cp1[2] < cp2[0]+cp2[1]+cp2[2]) {
cp[0]= cp1[0];
@@ -348,7 +348,8 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
if (do_char) srect = sbuf->rect + srcy * sbuf->x + srcx;
if (do_float) srectf = sbuf->rect_float + (srcy * sbuf->x + srcx)*4;
srcskip = sbuf->x;
- } else {
+ }
+ else {
srect = drect;
srectf = drectf;
srcskip = destskip;
@@ -452,7 +453,7 @@ void IMB_rectfill(struct ImBuf *drect, const float col[4])
{
int num;
- if(drect->rect) {
+ if (drect->rect) {
unsigned int *rrect = drect->rect;
char ccol[4];
@@ -466,7 +467,7 @@ void IMB_rectfill(struct ImBuf *drect, const float col[4])
*rrect++ = *((unsigned int*)ccol);
}
- if(drect->rect_float) {
+ if (drect->rect_float) {
float *rrectf = drect->rect_float;
num = drect->x * drect->y;
@@ -514,7 +515,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
chr = FTOCHAR(col[0]);
chg = FTOCHAR(col[1]);
chb = FTOCHAR(col[2]);
- } else {
+ }
+ else {
fr = col[0]*a;
fg = col[1]*a;
fb = col[2]*a;
@@ -528,7 +530,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
pixel[1] = chg;
pixel[2] = chb;
pixel[3] = 255;
- } else {
+ }
+ else {
int alphatest;
pixel[0] = (char)((fr + ((float)pixel[0]*aich))*255.0f);
pixel[1] = (char)((fg + ((float)pixel[1]*aich))*255.0f);
@@ -550,7 +553,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
pixel[1] = col[1];
pixel[2] = col[2];
pixel[3] = 1.0f;
- } else {
+ }
+ else {
float alphatest;
pixel[0] = (col[0]*a) + (pixel[0]*ai);
pixel[1] = (col[1]*a) + (pixel[1]*ai);
diff --git a/source/blender/imbuf/intern/rotate.c b/source/blender/imbuf/intern/rotate.c
index 7ca7445569f..8914d4ee64d 100644
--- a/source/blender/imbuf/intern/rotate.c
+++ b/source/blender/imbuf/intern/rotate.c
@@ -62,7 +62,7 @@ void IMB_flipy(struct ImBuf * ibuf)
y >>= 1;
- for(;y>0;y--) {
+ for (;y>0;y--) {
memcpy(line, top, x*sizeof(int));
memcpy(top, bottom, x*sizeof(int));
memcpy(bottom, line, x*sizeof(int));
@@ -85,7 +85,7 @@ void IMB_flipy(struct ImBuf * ibuf)
y >>= 1;
- for(;y>0;y--) {
+ for (;y>0;y--) {
memcpy(linef, topf, 4*x*sizeof(float));
memcpy(topf, bottomf, 4*x*sizeof(float));
memcpy(bottomf, linef, 4*x*sizeof(float));
@@ -108,16 +108,16 @@ void IMB_flipx(struct ImBuf * ibuf)
y = ibuf->y;
if (ibuf->rect) {
- for(yi=y-1;yi>=0;yi--) {
- for(xr=x-1, xl=0; xr>=xl; xr--, xl++) {
+ for (yi=y-1;yi>=0;yi--) {
+ for (xr=x-1, xl=0; xr>=xl; xr--, xl++) {
SWAP(unsigned int, ibuf->rect[(x*yi)+xr], ibuf->rect[(x*yi)+xl]);
}
}
}
if (ibuf->rect_float) {
- for(yi=y-1;yi>=0;yi--) {
- for(xr=x-1, xl=0; xr>=xl; xr--, xl++) {
+ for (yi=y-1;yi>=0;yi--) {
+ for (xr=x-1, xl=0; xr>=xl; xr--, xl++) {
memcpy(&px_f, &ibuf->rect_float[((x*yi)+xr)*4], 4*sizeof(float));
memcpy(&ibuf->rect_float[((x*yi)+xr)*4], &ibuf->rect_float[((x*yi)+xl)*4], 4*sizeof(float));
memcpy(&ibuf->rect_float[((x*yi)+xl)*4], &px_f, 4*sizeof(float));
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index 361faa08b29..a7b994beef9 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -76,10 +76,10 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1)
_p1f = ibuf1->rect_float;
destf= ibuf2->rect_float;
- for(y=ibuf2->y;y>0;y--) {
+ for (y=ibuf2->y;y>0;y--) {
p1 = _p1;
p1f = _p1f;
- for(x = ibuf2->x; x>0; x--) {
+ for (x = ibuf2->x; x>0; x--) {
if (do_rect) {
a = *(p1++);
b = *(p1++);
@@ -136,7 +136,7 @@ struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1)
p1f = (float *)ibuf1->rect_float;
destf = (float *)ibuf2->rect_float;
- for(i = ibuf1->y * ibuf1->x; i > 0; i--) {
+ for (i = ibuf1->y * ibuf1->x; i > 0; i--) {
if (do_rect) {
col = *p1++;
*dest++ = col;
@@ -195,7 +195,7 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1)
_p1f = (float *) ibuf1->rect_float;
destf= (float *) ibuf2->rect_float;
- for(y=ibuf2->y; y>0; y--) {
+ for (y=ibuf2->y; y>0; y--) {
if (do_rect) {
p1 = _p1;
p2 = _p1 + (ibuf1->x << 2);
@@ -204,7 +204,7 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1)
p1f = _p1f;
p2f = _p1f + (ibuf1->x << 2);
}
- for(x = ibuf2->x; x > 0; x--) {
+ for (x = ibuf2->x; x > 0; x--) {
if (do_rect) {
a = *(p1++);
b = *(p1++);
@@ -263,15 +263,15 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1)
p1f = (float *) ibuf1->rect_float;
dest1f= (float *) ibuf2->rect_float;
- for(y = ibuf1->y; y > 0; y--) {
+ for (y = ibuf1->y; y > 0; y--) {
if (do_rect) {
dest2 = dest1 + ibuf2->x;
- for(x = ibuf2->x; x > 0; x--) *dest1++ = *dest2++ = *p1++;
+ for (x = ibuf2->x; x > 0; x--) *dest1++ = *dest2++ = *p1++;
dest1 = dest2;
}
if (do_float) {
dest2f = dest1f + (4*ibuf2->x);
- for(x = ibuf2->x * 4; x > 0; x--) *dest1f++ = *dest2f++ = *p1f++;
+ for (x = ibuf2->x * 4; x > 0; x--) *dest1f++ = *dest2f++ = *p1f++;
dest1f = dest2f;
}
}
@@ -301,7 +301,7 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
const short do_rect= (ibuf1->rect != NULL);
const short do_float= (ibuf1->rect_float != NULL) && (ibuf2->rect_float != NULL);
- if(do_rect && (ibuf2->rect == NULL)) {
+ if (do_rect && (ibuf2->rect == NULL)) {
imb_addrectImBuf(ibuf2);
}
@@ -310,10 +310,10 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
p1 = (uchar *) ibuf1->rect;
dest=(uchar *) ibuf2->rect;
- for(y=ibuf2->y;y>0;y--) {
+ for (y=ibuf2->y;y>0;y--) {
if (do_rect) p2 = p1 + (ibuf1->x << 2);
if (do_float) p2f = p1f + (ibuf1->x << 2);
- for(x=ibuf2->x;x>0;x--) {
+ for (x=ibuf2->x;x>0;x--) {
if (do_rect) {
dest[0] = (p1[0] + p2[0] + p1[4] + p2[4]) >> 2;
dest[1] = (p1[1] + p2[1] + p1[5] + p2[5]) >> 2;
@@ -335,7 +335,7 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
}
if (do_rect) p1=p2;
if (do_float) p1f=p2f;
- if(ibuf1->x & 1) {
+ if (ibuf1->x & 1) {
if (do_rect) p1+=4;
if (do_float) p1f+=4;
}
@@ -567,7 +567,8 @@ static void q_scale_byte(unsigned char* in, unsigned char* out, int in_width,
if (dst_width > in_width && dst_height > in_height) {
enlarge_picture_byte(in, out, in_width, in_height,
dst_width, dst_height);
- } else if (dst_width < in_width && dst_height < in_height) {
+ }
+ else if (dst_width < in_width && dst_height < in_height) {
shrink_picture_byte(in, out, in_width, in_height,
dst_width, dst_height);
}
@@ -767,7 +768,8 @@ static void q_scale_float(float* in, float* out, int in_width,
if (dst_width > in_width && dst_height > in_height) {
enlarge_picture_float(in, out, in_width, in_height,
dst_width, dst_height);
- } else if (dst_width < in_width && dst_height < in_height) {
+ }
+ else if (dst_width < in_width && dst_height < in_height) {
shrink_picture_float(in, out, in_width, in_height,
dst_width, dst_height);
}
@@ -1511,7 +1513,7 @@ struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned
if (newx == ibuf->x && newy == ibuf->y) return(ibuf);
- if(do_rect) {
+ if (do_rect) {
_newrect = MEM_mallocN(newx * newy * sizeof(int), "scalefastimbuf");
if (_newrect==NULL) return(ibuf);
newrect = _newrect;
@@ -1531,7 +1533,7 @@ struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned
ofsy = 32768;
for (y = newy; y > 0; y--) {
- if(do_rect) {
+ if (do_rect) {
rect = ibuf->rect;
rect += (ofsy >> 16) * ibuf->x;
}
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index 895f922a0da..7aceb695d00 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -126,18 +126,18 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI
last = *rect++;
this = *rect++;
copy = last^this;
- while (bytes > 0){
- if (copy){
- do{
+ while (bytes > 0) {
+ if (copy) {
+ do {
last = this;
this = *rect++;
- if (last == this){
- if (this == rect[-3]){ /* three the same? */
+ if (last == this) {
+ if (this == rect[-3]) { /* three the same? */
bytes --; /* set bytes */
break;
}
}
- }while (--bytes != 0);
+ } while (--bytes != 0);
copy = rect-rectstart;
copy --;
@@ -146,22 +146,23 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI
temp = rect;
rect = rectstart;
- while (copy){
+ while (copy) {
last = copy;
if (copy>=128) last = 128;
copy -= last;
if (fputc(last-1,file) == EOF) return(0);
- do{
+ do {
if (out(*rect++,file) == EOF) return(0);
- }while(--last != 0);
+ } while (--last != 0);
}
rectstart = rect;
rect = temp;
last = this;
copy = FALSE;
- } else {
- while (*rect++ == this){ /* seek for first different byte */
+ }
+ else {
+ while (*rect++ == this) { /* seek for first different byte */
if (--bytes == 0) break; /* oor end of line */
}
rect --;
@@ -170,14 +171,16 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI
bytes --;
this = *rect++;
- while (copy){
- if (copy>128){
+ while (copy) {
+ if (copy>128) {
if (fputc(255,file) == EOF) return(0);
copy -= 128;
- } else {
- if (copy == 1){
+ }
+ else {
+ if (copy == 1) {
if (fputc(0,file) == EOF) return(0);
- } else if (fputc(127 + copy,file) == EOF) return(0);
+ }
+ else if (fputc(127 + copy,file) == EOF) return(0);
copy = 0;
}
if (out(last,file) == EOF) return(0);
@@ -201,28 +204,31 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file)
rect = (uchar *) ibuf->rect;
if (ibuf->planes <= 8) {
- while(size > 0){
+ while (size > 0) {
if (putc(*rect, file) == EOF) return (0);
size--;
rect += 4;
}
- } else if (ibuf->planes <= 16) {
- while(size > 0){
+ }
+ else if (ibuf->planes <= 16) {
+ while (size > 0) {
putc(rect[0], file);
if (putc(rect[1], file) == EOF) return (0);
size--;
rect += 4;
}
- } else if (ibuf->planes <= 24) {
- while(size > 0){
+ }
+ else if (ibuf->planes <= 24) {
+ while (size > 0) {
putc(rect[2], file);
putc(rect[1], file);
if (putc(rect[0], file) == EOF) return (0);
size--;
rect += 4;
}
- } else if (ibuf->planes <= 32) {
- while(size > 0){
+ }
+ else if (ibuf->planes <= 32) {
+ while (size > 0) {
putc(rect[2], file);
putc(rect[1], file);
putc(rect[0], file);
@@ -230,7 +236,8 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file)
size--;
rect += 4;
}
- } else return (0);
+ }
+ else return (0);
return (1);
}
@@ -245,9 +252,10 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
(void)flags; /* unused */
buf[16] = (ibuf->planes + 0x7 ) & ~0x7;
- if (ibuf->planes > 8 ){
+ if (ibuf->planes > 8 ) {
buf[2] = 10;
- } else{
+ }
+ else {
buf[2] = 11;
}
@@ -268,7 +276,7 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
if (ibuf->planes==32) {
buf[17] |= 0x08;
}
- fildes = fopen(name,"wb");
+ fildes = BLI_fopen(name,"wb");
if (!fildes) return 0;
if (fwrite(buf, 1, 18,fildes) != 18) {
@@ -278,8 +286,9 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
if (ibuf->ftype == RAWTGA) {
ok = dumptarga(ibuf, fildes);
- } else {
- switch((ibuf->planes + 7) >> 3){
+ }
+ else {
+ switch((ibuf->planes + 7) >> 3) {
case 1:
ok = makebody_tga(ibuf, fildes, tga_out1);
break;
@@ -317,7 +326,7 @@ static int checktarga(TARGA *tga, unsigned char *mem)
tga->imgdes = mem[17];
if (tga->maptyp > 1) return(0);
- switch (tga->imgtyp){
+ switch (tga->imgtyp) {
case 1: /* raw cmap */
case 2: /* raw rgb */
case 3: /* raw b&w */
@@ -346,7 +355,7 @@ int imb_is_a_targa(unsigned char *buf)
static void complete_partial_load(struct ImBuf *ibuf, unsigned int *rect)
{
int size = (ibuf->x * ibuf->y) - (rect - ibuf->rect);
- if(size) {
+ if (size) {
printf("decodetarga: incomplete file, %.1f%% missing\n", 100*((float)size / (ibuf->x * ibuf->y)));
/* not essential but makes displaying partially rendered TGA's less ugly */
@@ -375,18 +384,18 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size,
cp[0] = 0xff;
cp[1] = cp[2] = 0;
- while(size > 0){
+ while (size > 0) {
count = *mem++;
- if(mem>mem_end)
+ if (mem>mem_end)
goto partial_load;
if (count >= 128) {
/*if (count == 128) printf("TARGA: 128 in file !\n");*/
count -= 127;
- if (psize & 2){
- if (psize & 1){
+ if (psize & 2) {
+ if (psize & 1) {
/* order = bgra */
cp[0] = mem[3];
cp[1] = mem[0];
@@ -394,19 +403,22 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size,
cp[3] = mem[2];
/*col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
mem += 4;
- } else{
+ }
+ else {
cp[1] = mem[0];
cp[2] = mem[1];
cp[3] = mem[2];
/*col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
mem += 3;
}
- } else{
- if (psize & 1){
+ }
+ else {
+ if (psize & 1) {
cp[0] = mem[0];
cp[1] = mem[1];
mem += 2;
- } else{
+ }
+ else {
col = *mem++;
}
}
@@ -418,13 +430,14 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size,
count--;
}
}
- } else{
+ }
+ else {
count ++;
size -= count;
if (size >= 0) {
- while (count > 0){
- if (psize & 2){
- if (psize & 1){
+ while (count > 0) {
+ if (psize & 2) {
+ if (psize & 1) {
/* order = bgra */
cp[0] = mem[3];
cp[1] = mem[0];
@@ -432,30 +445,33 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size,
cp[3] = mem[2];
/*col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
mem += 4;
- } else{
+ }
+ else {
cp[1] = mem[0];
cp[2] = mem[1];
cp[3] = mem[2];
/*col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
mem += 3;
}
- } else{
- if (psize & 1){
+ }
+ else {
+ if (psize & 1) {
cp[0] = mem[0];
cp[1] = mem[1];
mem += 2;
- } else{
+ }
+ else {
col = *mem++;
}
}
*rect++ = col;
count --;
- if(mem>mem_end)
+ if (mem>mem_end)
goto partial_load;
}
- if(mem>mem_end)
+ if (mem>mem_end)
goto partial_load;
}
}
@@ -486,12 +502,12 @@ static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, size_t mem_size, in
cp[0] = 0xff;
cp[1] = cp[2] = 0;
- while(size > 0){
- if(mem>mem_end)
+ while (size > 0) {
+ if (mem>mem_end)
goto partial_load;
- if (psize & 2){
- if (psize & 1){
+ if (psize & 2) {
+ if (psize & 1) {
/* order = bgra */
cp[0] = mem[3];
cp[1] = mem[0];
@@ -499,7 +515,8 @@ static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, size_t mem_size, in
cp[3] = mem[2];
/*col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
mem += 4;
- } else{
+ }
+ else {
/* set alpha for 24 bits colors */
cp[1] = mem[0];
cp[2] = mem[1];
@@ -507,12 +524,14 @@ static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, size_t mem_size, in
/*col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
mem += 3;
}
- } else{
- if (psize & 1){
+ }
+ else {
+ if (psize & 1) {
cp[0] = mem[0];
cp[1] = mem[1];
mem += 2;
- } else{
+ }
+ else {
col = *mem++;
}
}
@@ -547,7 +566,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
cp[0] = 0xff;
cp[1] = cp[2] = 0;
- if (tga.mapsize){
+ if (tga.mapsize) {
/* load color map */
/*mincol = tga.maporig;*/ /*UNUSED*/
maxcol = tga.mapsize;
@@ -592,13 +611,13 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
if (flags & IB_test) return (ibuf);
if (tga.imgtyp != 1 && tga.imgtyp != 9) { /* happens sometimes (beuh) */
- if(cmap) {
+ if (cmap) {
MEM_freeN(cmap);
cmap= NULL;
}
}
- switch(tga.imgtyp){
+ switch(tga.imgtyp) {
case 1:
case 2:
case 3:
@@ -617,10 +636,10 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
break;
}
- if(cmap) {
+ if (cmap) {
/* apply color map */
rect = ibuf->rect;
- for(size = ibuf->x * ibuf->y; size>0; --size, ++rect) {
+ for (size = ibuf->x * ibuf->y; size>0; --size, ++rect) {
col = *rect;
if (col >= 0 && col < maxcol) *rect = cmap[col];
}
@@ -630,7 +649,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
if (tga.pixsize == 16) {
rect = ibuf->rect;
- for (size = ibuf->x * ibuf->y; size > 0; --size, ++rect){
+ for (size = ibuf->x * ibuf->y; size > 0; --size, ++rect) {
col = *rect;
cp = (uchar*)rect;
mem = (uchar*)&col;
@@ -646,14 +665,14 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
ibuf->planes = 24;
}
- if (tga.imgtyp == 3 || tga.imgtyp == 11){
+ if (tga.imgtyp == 3 || tga.imgtyp == 11) {
uchar *crect;
unsigned int *lrect, col;
crect = (uchar *) ibuf->rect;
lrect = (unsigned int *) ibuf->rect;
- for (size = ibuf->x * ibuf->y; size > 0; size --){
+ for (size = ibuf->x * ibuf->y; size > 0; size --) {
col = *lrect++;
crect[0] = 255;
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index f863fe8de21..f5c22b67c1b 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -61,6 +61,7 @@
#include <process.h> /* getpid */
#include <direct.h> /* chdir */
#include "BLI_winstuff.h"
+#include "utfconv.h"
#else
#include <unistd.h>
#endif
@@ -70,8 +71,12 @@
static int get_thumb_dir( char* dir , ThumbSize size)
{
#ifdef WIN32
+ wchar_t dir_16 [MAX_PATH];
/* yes, applications shouldn't store data there, but so does GIMP :)*/
- SHGetSpecialFolderPath(0, dir, CSIDL_PROFILE, 0);
+ SHGetSpecialFolderPathW(0, dir_16, CSIDL_PROFILE, 0);
+ conv_utf_16_to_8(dir_16,dir,FILE_MAX);
+
+
#else
const char* home = getenv("HOME");
if (!home) return 0;
@@ -144,7 +149,8 @@ static void escape_uri_string (const char *string, char* escaped_string, int len
*q++ = '%'; /* means hex coming */
*q++ = hex[c >> 4];
*q++ = hex[c & 15];
- } else {
+ }
+ else {
*q++ = *p;
}
}
@@ -167,7 +173,7 @@ static void to_hex_char(char* hexbytes, const unsigned char* bytes, int len)
/** ----- end of adapted code from glib --- */
-static int uri_from_filename( const char *path, char *uri )
+static int uri_from_filename(const char *path, char *uri)
{
char orig_uri[URI_MAX];
const char* dirstart = path;
@@ -275,9 +281,9 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
}
/* exception, skip images over 100mb */
- if(source == THB_SOURCE_IMAGE) {
+ if (source == THB_SOURCE_IMAGE) {
const size_t size= BLI_file_size(path);
- if(size != -1 && size > THUMB_SIZE_MAX) {
+ if (size != -1 && size > THUMB_SIZE_MAX) {
// printf("file too big: %d, skipping %s\n", (int)size, path);
return NULL;
}
@@ -295,12 +301,13 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
if (size == THB_FAIL) {
img = IMB_allocImBuf(1,1,32, IB_rect | IB_metadata);
if (!img) return NULL;
- } else {
+ }
+ else {
if (THB_SOURCE_IMAGE == source || THB_SOURCE_BLEND == source) {
/* only load if we didnt give an image */
- if(img==NULL) {
- if(THB_SOURCE_BLEND == source) {
+ if (img==NULL) {
+ if (THB_SOURCE_BLEND == source) {
img = IMB_loadblend_thumb(path);
}
else {
@@ -314,14 +321,16 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
BLI_snprintf(cwidth, sizeof(cwidth), "%d", img->x);
BLI_snprintf(cheight, sizeof(cheight), "%d", img->y);
}
- } else if (THB_SOURCE_MOVIE == source) {
+ }
+ else if (THB_SOURCE_MOVIE == source) {
struct anim * anim = NULL;
anim = IMB_open_anim(path, IB_rect | IB_metadata, 0);
if (anim != NULL) {
img = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE);
if (img == NULL) {
printf("not an anim; %s\n", path);
- } else {
+ }
+ else {
IMB_freeImBuf(img);
img = IMB_anim_previewframe(anim);
}
@@ -344,8 +353,8 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
ey = (short)scaledy;
/* save some time by only scaling byte buf */
- if(img->rect_float) {
- if(img->rect == NULL) {
+ if (img->rect_float) {
+ if (img->rect == NULL) {
IMB_rect_from_float(img);
}
@@ -438,7 +447,8 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source)
if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) {
if (BLI_path_ncmp(path, thumb, sizeof(thumb)) == 0) {
img = IMB_loadiffname(path, IB_rect);
- } else {
+ }
+ else {
img = IMB_loadiffname(thumb, IB_rect | IB_metadata);
if (img) {
char mtime[40];
@@ -446,7 +456,8 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source)
/* illegal thumb, forget it! */
IMB_freeImBuf(img);
img = NULL;
- } else {
+ }
+ else {
time_t t = atol(mtime);
if (st.st_mtime != t) {
/* recreate all thumbs */
@@ -456,7 +467,7 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source)
IMB_thumb_delete(path, THB_LARGE);
IMB_thumb_delete(path, THB_FAIL);
img = IMB_thumb_create(path, size, source, NULL);
- if(!img){
+ if (!img) {
/* thumb creation failed, write fail thumb */
img = IMB_thumb_create(path, THB_FAIL, source, NULL);
if (img) {
@@ -467,9 +478,10 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source)
}
}
}
- } else {
+ }
+ else {
img = IMB_thumb_create(path, size, source, NULL);
- if(!img){
+ if (!img) {
/* thumb creation failed, write fail thumb */
img = IMB_thumb_create(path, THB_FAIL, source, NULL);
if (img) {
diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c
index 037b4ab63c0..2d477a5f43d 100644
--- a/source/blender/imbuf/intern/thumbs_blend.c
+++ b/source/blender/imbuf/intern/thumbs_blend.c
@@ -30,6 +30,7 @@
#include "zlib.h"
#include "BLI_utildefines.h"
+#include "BLI_fileops.h"
#include "BKE_utildefines.h"
#include "BKE_global.h"
@@ -41,7 +42,7 @@
#include "MEM_guardedalloc.h"
/* extracts the thumbnail from between the 'REND' and the 'GLOB'
- * chunks of the header, dont use typical blend loader because its too slow */
+ * chunks of the header, don't use typical blend loader because its too slow */
static ImBuf *loadblend_thumb(gzFile gzfile)
{
@@ -52,31 +53,31 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
int sizeof_bhead;
/* read the blend file header */
- if(gzread(gzfile, buf, 12) != 12)
+ if (gzread(gzfile, buf, 12) != 12)
return NULL;
- if(strncmp(buf, "BLENDER", 7))
+ if (strncmp(buf, "BLENDER", 7))
return NULL;
- if(buf[7]=='-')
+ if (buf[7]=='-')
pointer_size= 8;
- else if(buf[7]=='_')
+ else if (buf[7]=='_')
pointer_size= 4;
else
return NULL;
sizeof_bhead = 16 + pointer_size;
- if(buf[8]=='V')
+ if (buf[8]=='V')
endian= B_ENDIAN; /* big: PPC */
- else if(buf[8]=='v')
+ else if (buf[8]=='v')
endian= L_ENDIAN; /* little: x86 */
else
return NULL;
endian_switch = ((ENDIAN_ORDER != endian)) ? 1 : 0;
- while(gzread(gzfile, bhead, sizeof_bhead) == sizeof_bhead) {
- if(endian_switch)
+ while (gzread(gzfile, bhead, sizeof_bhead) == sizeof_bhead) {
+ if (endian_switch)
SWITCH_INT(bhead[1]); /* length */
if (bhead[0]==REND) {
@@ -88,14 +89,14 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
}
/* using 'TEST' since new names segfault when loading in old blenders */
- if(bhead[0] == TEST) {
+ if (bhead[0] == TEST) {
ImBuf *img= NULL;
int size[2];
- if(gzread(gzfile, size, sizeof(size)) != sizeof(size))
+ if (gzread(gzfile, size, sizeof(size)) != sizeof(size))
return NULL;
- if(endian_switch) {
+ if (endian_switch) {
SWITCH_INT(size[0]);
SWITCH_INT(size[1]);
}
@@ -103,13 +104,13 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
bhead[1] -= sizeof(int) * 2;
/* inconsistent image size, quit early */
- if(bhead[1] != size[0] * size[1] * sizeof(int))
+ if (bhead[1] != size[0] * size[1] * sizeof(int))
return NULL;
/* finally malloc and read the data */
img= IMB_allocImBuf(size[0], size[1], 32, IB_rect | IB_metadata);
- if(gzread(gzfile, img->rect, bhead[1]) != bhead[1]) {
+ if (gzread(gzfile, img->rect, bhead[1]) != bhead[1]) {
IMB_freeImBuf(img);
img= NULL;
}
@@ -123,9 +124,8 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
ImBuf *IMB_loadblend_thumb(const char *path)
{
gzFile gzfile;
-
/* not necessarily a gzip */
- gzfile = gzopen(path, "rb");
+ gzfile = BLI_gzopen(path, "rb");
if (NULL == gzfile ) {
return NULL;
@@ -151,7 +151,7 @@ void IMB_overlayblend_thumb(unsigned int *thumb, int width, int height, float as
int margin_r = width - MARGIN;
int margin_t = height - MARGIN;
- if(aspect < 1.0f) {
+ if (aspect < 1.0f) {
margin_l= (int)((width - ((float)width * aspect)) / 2.0f);
margin_l += MARGIN;
CLAMP(margin_l, MARGIN, (width/2));
@@ -168,18 +168,19 @@ void IMB_overlayblend_thumb(unsigned int *thumb, int width, int height, float as
int x, y;
int stride_x= (margin_r - margin_l) - 2;
- for(y=0; y < height; y++) {
- for(x=0; x < width; x++, px+=4) {
+ for (y=0; y < height; y++) {
+ for (x=0; x < width; x++, px+=4) {
int hline= 0, vline= 0;
- if((x > margin_l && x < margin_r) && (y > margin_b && y < margin_t)) {
+ if ((x > margin_l && x < margin_r) && (y > margin_b && y < margin_t)) {
/* interior. skip */
x += stride_x;
px += stride_x * 4;
- } else if( (hline=(((x == margin_l || x == margin_r)) && y >= margin_b && y <= margin_t)) ||
- (vline=(((y == margin_b || y == margin_t)) && x >= margin_l && x <= margin_r))
- ) {
+ }
+ else if ((hline=(((x == margin_l || x == margin_r)) && y >= margin_b && y <= margin_t)) ||
+ (vline=(((y == margin_b || y == margin_t)) && x >= margin_l && x <= margin_r)))
+ {
/* dashed line */
- if((hline && y % 2) || (vline && x % 2)) {
+ if ((hline && y % 2) || (vline && x % 2)) {
px[0]= px[1]= px[2]= 0;
px[3] = 255;
}
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index 1e6bc216128..5a8caa8769f 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -128,23 +128,23 @@ static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n)
/* get the pointer to the in-memory file */
mfile = IMB_TIFF_GET_MEMFILE(handle);
- if(!mfile || !mfile->mem) {
+ if (!mfile || !mfile->mem) {
fprintf(stderr, "imb_tiff_ReadProc: !mfile || !mfile->mem!\n");
return 0;
}
/* find the actual number of bytes to read (copy) */
nCopy = n;
- if((tsize_t)mfile->offset >= mfile->size)
+ if ((tsize_t)mfile->offset >= mfile->size)
nRemaining = 0;
else
nRemaining = mfile->size - mfile->offset;
- if(nCopy > nRemaining)
+ if (nCopy > nRemaining)
nCopy = nRemaining;
/* on EOF, return immediately and read (copy) nothing */
- if(nCopy <= 0)
+ if (nCopy <= 0)
return (0);
/* all set -> do the read (copy) */
@@ -195,7 +195,7 @@ static toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence)
/* get the pointer to the in-memory file */
mfile = IMB_TIFF_GET_MEMFILE(handle);
- if(!mfile || !mfile->mem) {
+ if (!mfile || !mfile->mem) {
fprintf(stderr, "imb_tiff_SeekProc: !mfile || !mfile->mem!\n");
return (-1);
}
@@ -241,7 +241,7 @@ static int imb_tiff_CloseProc(thandle_t handle)
/* get the pointer to the in-memory file */
mfile = IMB_TIFF_GET_MEMFILE(handle);
- if(!mfile || !mfile->mem) {
+ if (!mfile || !mfile->mem) {
fprintf(stderr,"imb_tiff_CloseProc: !mfile || !mfile->mem!\n");
return (0);
}
@@ -267,7 +267,7 @@ static toff_t imb_tiff_SizeProc(thandle_t handle)
/* get the pointer to the in-memory file */
mfile = IMB_TIFF_GET_MEMFILE(handle);
- if(!mfile || !mfile->mem) {
+ if (!mfile || !mfile->mem) {
fprintf(stderr,"imb_tiff_SizeProc: !mfile || !mfile->mem!\n");
return (0);
}
@@ -361,7 +361,7 @@ static void imb_read_tiff_resolution(ImBuf *ibuf, TIFF *image)
TIFFGetFieldDefaulted(image, TIFFTAG_XRESOLUTION, &xres);
TIFFGetFieldDefaulted(image, TIFFTAG_YRESOLUTION, &yres);
- if(unit == RESUNIT_CENTIMETER) {
+ if (unit == RESUNIT_CENTIMETER) {
ibuf->ppm[0]= (double)xres * 100.0;
ibuf->ppm[1]= (double)yres * 100.0;
}
@@ -397,10 +397,12 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
if (bitspersample == 32) {
ib_flag = IB_rectfloat;
fbuf = (float *)_TIFFmalloc(scanline);
- } else if (bitspersample == 16) {
+ }
+ else if (bitspersample == 16) {
ib_flag = IB_rectfloat;
sbuf = (unsigned short *)_TIFFmalloc(scanline);
- } else {
+ }
+ else {
ib_flag = IB_rect;
}
@@ -419,13 +421,15 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
success |= TIFFReadScanline(image, fbuf, row, 0);
scanline_contig_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, spp);
- } else if (bitspersample == 16) {
+ }
+ else if (bitspersample == 16) {
success |= TIFFReadScanline(image, sbuf, row, 0);
scanline_contig_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, spp);
}
}
/* separate channels: RRRGGGBBB */
- } else if (config == PLANARCONFIG_SEPARATE) {
+ }
+ else if (config == PLANARCONFIG_SEPARATE) {
/* imbufs always have 4 channels of data, so we iterate over all of them
* but only fill in from the TIFF scanline where necessary. */
@@ -440,7 +444,8 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
success |= TIFFReadScanline(image, fbuf, row, chan);
scanline_separate_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, chan);
- } else if (bitspersample == 16) {
+ }
+ else if (bitspersample == 16) {
if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
memset(sbuf, 65535, sizeof(sbuf));
else
@@ -457,14 +462,14 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
else if (bitspersample == 16)
_TIFFfree(sbuf);
- if(success) {
+ if (success) {
ibuf->profile = (bitspersample==32)?IB_PROFILE_LINEAR_RGB:IB_PROFILE_SRGB;
// Code seems to be not needed for 16 bits tif, on PPC G5 OSX (ton)
- if(bitspersample < 16)
- if(ENDIAN_ORDER == B_ENDIAN)
+ if (bitspersample < 16)
+ if (ENDIAN_ORDER == B_ENDIAN)
IMB_convert_rgba_to_abgr(tmpibuf);
- if(premul) {
+ if (premul) {
IMB_premultiply_alpha(tmpibuf);
ibuf->flags |= IB_premul;
}
@@ -514,16 +519,16 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
int ib_depth;
/* check whether or not we have a TIFF file */
- if(size < IMB_TIFF_NCB) {
+ if (size < IMB_TIFF_NCB) {
fprintf(stderr, "imb_loadtiff: size < IMB_TIFF_NCB\n");
return NULL;
}
- if(imb_is_a_tiff(mem) == 0)
+ if (imb_is_a_tiff(mem) == 0)
return NULL;
image = imb_tiff_client_open(&memFile, mem, size);
- if(image == NULL) {
+ if (image == NULL) {
printf("imb_loadtiff: could not open TIFF IO layer.\n");
return NULL;
}
@@ -536,7 +541,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
ib_depth = (spp==3)?24:32;
ibuf = IMB_allocImBuf(width, height, ib_depth, 0);
- if(ibuf) {
+ if (ibuf) {
ibuf->ftype = TIF;
}
else {
@@ -548,26 +553,26 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
}
/* if testing, we're done */
- if(flags & IB_test) {
+ if (flags & IB_test) {
TIFFClose(image);
return ibuf;
}
/* detect if we are reading a tiled/mipmapped texture, in that case
* we don't read pixels but leave it to the cache to load tiles */
- if(flags & IB_tilecache) {
+ if (flags & IB_tilecache) {
format= NULL;
TIFFGetField(image, TIFFTAG_PIXAR_TEXTUREFORMAT, &format);
- if(format && strcmp(format, "Plain Texture")==0 && TIFFIsTiled(image)) {
+ if (format && strcmp(format, "Plain Texture")==0 && TIFFIsTiled(image)) {
int numlevel = TIFFNumberOfDirectories(image);
/* create empty mipmap levels in advance */
- for(level=0; level<numlevel; level++) {
- if(!TIFFSetDirectory(image, level))
+ for (level=0; level<numlevel; level++) {
+ if (!TIFFSetDirectory(image, level))
break;
- if(level > 0) {
+ if (level > 0) {
width= (width > 1)? width/2: 1;
height= (height > 1)? height/2: 1;
@@ -576,7 +581,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
hbuf->ftype= ibuf->ftype;
ibuf->mipmap[level-1] = hbuf;
- if(flags & IB_premul)
+ if (flags & IB_premul)
hbuf->flags |= IB_premul;
}
else
@@ -598,7 +603,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
}
/* read pixels */
- if(!(ibuf->flags & IB_tilecache) && !imb_read_tiff_pixels(ibuf, image, 0)) {
+ if (!(ibuf->flags & IB_tilecache) && !imb_read_tiff_pixels(ibuf, image, 0)) {
fprintf(stderr, "imb_loadtiff: Failed to read tiff image.\n");
TIFFClose(image);
return NULL;
@@ -619,23 +624,23 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, size_t size, int tx, int
image = imb_tiff_client_open(&memFile, mem, size);
- if(image == NULL) {
+ if (image == NULL) {
printf("imb_loadtiff: could not open TIFF IO layer for loading mipmap level.\n");
return;
}
- if(TIFFSetDirectory(image, ibuf->miplevel)) { /* allocate the image buffer */
+ if (TIFFSetDirectory(image, ibuf->miplevel)) { /* allocate the image buffer */
TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height);
- if(width == ibuf->x && height == ibuf->y) {
- if(rect) {
+ if (width == ibuf->x && height == ibuf->y) {
+ if (rect) {
/* tiff pixels are bottom to top, tiles are top to bottom */
- if(TIFFReadRGBATile(image, tx*ibuf->tilex, (ibuf->ytiles - 1 - ty)*ibuf->tiley, rect) == 1) {
- if(ibuf->tiley > ibuf->y)
+ if (TIFFReadRGBATile(image, tx*ibuf->tilex, (ibuf->ytiles - 1 - ty)*ibuf->tiley, rect) == 1) {
+ if (ibuf->tiley > ibuf->y)
memmove(rect, rect+ibuf->tilex*(ibuf->tiley - ibuf->y), sizeof(int)*ibuf->tilex*ibuf->y);
- if(ibuf->flags & IB_premul)
+ if (ibuf->flags & IB_premul)
IMB_premultiply_rect(rect, 32, ibuf->tilex, ibuf->tiley);
}
else
@@ -686,20 +691,20 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
* the TIFF writer supports 1, 3 or 4 bytes per pixel, corresponding
* to gray, RGB, RGBA respectively. */
samplesperpixel = (uint16)((ibuf->planes + 7) >> 3);
- if((samplesperpixel > 4) || (samplesperpixel == 2)) {
+ if ((samplesperpixel > 4) || (samplesperpixel == 2)) {
fprintf(stderr,
"imb_savetiff: unsupported number of bytes per "
"pixel: %d\n", samplesperpixel);
return (0);
}
- if((ibuf->ftype & TIF_16BIT) && ibuf->rect_float)
+ if ((ibuf->ftype & TIF_16BIT) && ibuf->rect_float)
bitspersample = 16;
else
bitspersample = 8;
/* open TIFF file for writing */
- if(flags & IB_mem) {
+ if (flags & IB_mem) {
/* bork at the creation of a TIFF in memory */
fprintf(stderr,
"imb_savetiff: creation of in-memory TIFF files is "
@@ -710,7 +715,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
/* create image as a file */
image = TIFFOpen(name, "w");
}
- if(image == NULL) {
+ if (image == NULL) {
fprintf(stderr,
"imb_savetiff: could not open TIFF for writing.\n");
return (0);
@@ -718,14 +723,14 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
/* allocate array for pixel data */
npixels = ibuf->x * ibuf->y;
- if(bitspersample == 16)
+ if (bitspersample == 16)
pixels16 = (unsigned short*)_TIFFmalloc(npixels *
samplesperpixel * sizeof(unsigned short));
else
pixels = (unsigned char*)_TIFFmalloc(npixels *
samplesperpixel * sizeof(unsigned char));
- if(pixels == NULL && pixels16 == NULL) {
+ if (pixels == NULL && pixels16 == NULL) {
fprintf(stderr,
"imb_savetiff: could not allocate pixels array.\n");
TIFFClose(image);
@@ -733,7 +738,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
}
/* setup pointers */
- if(bitspersample == 16) {
+ if (bitspersample == 16) {
fromf = ibuf->rect_float;
to16 = pixels16;
}
@@ -746,31 +751,31 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, bitspersample);
TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
- if(samplesperpixel == 4) {
+ if (samplesperpixel == 4) {
/* RGBA images */
TIFFSetField(image, TIFFTAG_EXTRASAMPLES, 1,
extraSampleTypes);
TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
PHOTOMETRIC_RGB);
}
- else if(samplesperpixel == 3) {
+ else if (samplesperpixel == 3) {
/* RGB images */
TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
PHOTOMETRIC_RGB);
}
- else if(samplesperpixel == 1) {
+ else if (samplesperpixel == 1) {
/* greyscale images, 1 channel */
TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
PHOTOMETRIC_MINISBLACK);
}
/* copy pixel data. While copying, we flip the image vertically. */
- for(x = 0; x < ibuf->x; x++) {
- for(y = 0; y < ibuf->y; y++) {
+ for (x = 0; x < ibuf->x; x++) {
+ for (y = 0; y < ibuf->y; y++) {
from_i = 4*(y*ibuf->x+x);
to_i = samplesperpixel*((ibuf->y-y-1)*ibuf->x+x);
- if(pixels16) {
+ if (pixels16) {
/* convert from float source */
float rgb[3];
@@ -790,7 +795,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
}
}
else {
- for(i = 0; i < samplesperpixel; i++, to_i++, from_i++)
+ for (i = 0; i < samplesperpixel; i++, to_i++, from_i++)
to[to_i] = from[from_i];
}
}
@@ -805,7 +810,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
- if(ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) {
+ if (ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) {
xres= (float)(ibuf->ppm[0] * 0.0254);
yres= (float)(ibuf->ppm[1] * 0.0254);
}
@@ -816,20 +821,20 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
TIFFSetField(image, TIFFTAG_XRESOLUTION, xres);
TIFFSetField(image, TIFFTAG_YRESOLUTION, yres);
TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
- if(TIFFWriteEncodedStrip(image, 0,
+ if (TIFFWriteEncodedStrip(image, 0,
(bitspersample == 16)? (unsigned char*)pixels16: pixels,
ibuf->x*ibuf->y*samplesperpixel*bitspersample/8) == -1) {
fprintf(stderr,
"imb_savetiff: Could not write encoded TIFF.\n");
TIFFClose(image);
- if(pixels) _TIFFfree(pixels);
- if(pixels16) _TIFFfree(pixels16);
+ if (pixels) _TIFFfree(pixels);
+ if (pixels16) _TIFFfree(pixels16);
return (1);
}
/* close the TIFF file */
TIFFClose(image);
- if(pixels) _TIFFfree(pixels);
- if(pixels16) _TIFFfree(pixels16);
+ if (pixels) _TIFFfree(pixels);
+ if (pixels16) _TIFFfree(pixels16);
return (1);
}
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index b7eba1002c5..008be2fde74 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -152,17 +152,17 @@ static int IMB_ispic_name(const char *name)
struct stat st;
int fp, buf[10];
- if(UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name);
+ if (UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name);
- if(stat(name,&st) == -1)
+ if (stat(name,&st) == -1)
return FALSE;
- if(((st.st_mode) & S_IFMT) != S_IFREG)
+ if (((st.st_mode) & S_IFMT) != S_IFREG)
return FALSE;
- if((fp = open(name,O_BINARY|O_RDONLY)) < 0)
+ if ((fp = BLI_open(name,O_BINARY|O_RDONLY, 0)) < 0)
return FALSE;
- if(read(fp, buf, 32) != 32) {
+ if (read(fp, buf, 32) != 32) {
close(fp);
return FALSE;
}
@@ -170,11 +170,11 @@ static int IMB_ispic_name(const char *name)
close(fp);
/* XXX move this exception */
- if((BIG_LONG(buf[0]) & 0xfffffff0) == 0xffd8ffe0)
+ if ((BIG_LONG(buf[0]) & 0xfffffff0) == 0xffd8ffe0)
return JPG;
- for(type=IMB_FILE_TYPES; type->is_a; type++)
- if(type->is_a((uchar*)buf))
+ for (type=IMB_FILE_TYPES; type->is_a; type++)
+ if (type->is_a((uchar*)buf))
return type->filetype;
return FALSE;
@@ -182,8 +182,8 @@ static int IMB_ispic_name(const char *name)
int IMB_ispic(const char *filename)
{
- if(U.uiflag & USER_FILTERFILEEXTS) {
- if( (BLI_testextensie_array(filename, imb_ext_image)) ||
+ if (U.uiflag & USER_FILTERFILEEXTS) {
+ if ( (BLI_testextensie_array(filename, imb_ext_image)) ||
(G.have_quicktime && BLI_testextensie_array(filename, imb_ext_image_qt))
) {
return IMB_ispic_name(filename);
@@ -234,7 +234,8 @@ void do_init_ffmpeg(void)
if ((G.f & G_DEBUG) == 0) {
silence_log_ffmpeg(1);
- } else {
+ }
+ else {
silence_log_ffmpeg(0);
}
}
@@ -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") ||
@@ -260,24 +261,24 @@ static int isffmpeg (const char *filename)
BLI_testextensie(filename, ".cin") ||
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");
+ if (av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL)!=0) {
+ if (UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_open_input_file failed\n");
return 0;
}
- if(av_find_stream_info(pFormatCtx)<0) {
- if(UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_find_stream_info failed\n");
+ if (av_find_stream_info(pFormatCtx)<0) {
+ if (UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_find_stream_info failed\n");
av_close_input_file(pFormatCtx);
return 0;
}
- if(UTIL_DEBUG) av_dump_format(pFormatCtx, 0, filename, 0);
+ if (UTIL_DEBUG) av_dump_format(pFormatCtx, 0, filename, 0);
/* Find the first video stream */
videoStream=-1;
- for(i=0; i<pFormatCtx->nb_streams; i++)
- if(pFormatCtx->streams[i] &&
+ for (i=0; i<pFormatCtx->nb_streams; i++)
+ if (pFormatCtx->streams[i] &&
pFormatCtx->streams[i]->codec &&
(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO))
{
@@ -285,7 +286,7 @@ static int isffmpeg (const char *filename)
break;
}
- if(videoStream==-1) {
+ if (videoStream==-1) {
av_close_input_file(pFormatCtx);
return 0;
}
@@ -294,12 +295,12 @@ static int isffmpeg (const char *filename)
/* Find the decoder for the video stream */
pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
- if(pCodec==NULL) {
+ if (pCodec==NULL) {
av_close_input_file(pFormatCtx);
return 0;
}
- if(avcodec_open(pCodecCtx, pCodec)<0) {
+ if (avcodec_open(pCodecCtx, pCodec)<0) {
av_close_input_file(pFormatCtx);
return 0;
}
@@ -329,7 +330,7 @@ int imb_get_anim_type(const char * name)
int type;
struct stat st;
- if(UTIL_DEBUG) printf("in getanimtype: %s\n", name);
+ if (UTIL_DEBUG) printf("in getanimtype: %s\n", name);
#ifndef _WIN32
# ifdef WITH_QUICKTIME
@@ -370,9 +371,9 @@ int IMB_isanim(const char *filename)
{
int type;
- if(U.uiflag & USER_FILTERFILEEXTS) {
- if (G.have_quicktime){
- if( BLI_testextensie(filename, ".avi")
+ if (U.uiflag & USER_FILTERFILEEXTS) {
+ if (G.have_quicktime) {
+ if ( BLI_testextensie(filename, ".avi")
|| BLI_testextensie(filename, ".flc")
|| BLI_testextensie(filename, ".dv")
|| BLI_testextensie(filename, ".r3d")
@@ -380,11 +381,13 @@ int IMB_isanim(const char *filename)
|| BLI_testextensie(filename, ".movie")
|| BLI_testextensie(filename, ".mv")) {
type = imb_get_anim_type(filename);
- } else {
+ }
+ else {
return(FALSE);
}
- } else { // no quicktime
- if( BLI_testextensie(filename, ".avi")
+ }
+ else { // no quicktime
+ if ( BLI_testextensie(filename, ".avi")
|| BLI_testextensie(filename, ".dv")
|| BLI_testextensie(filename, ".r3d")
|| BLI_testextensie(filename, ".mv")) {
@@ -394,7 +397,8 @@ int IMB_isanim(const char *filename)
return(FALSE);
}
}
- } else { // no FILTERFILEEXTS
+ }
+ else { // no FILTERFILEEXTS
type = imb_get_anim_type(filename);
}
diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c
index 8fbed6da32b..60fc7db6465 100644
--- a/source/blender/imbuf/intern/writeimage.c
+++ b/source/blender/imbuf/intern/writeimage.c
@@ -44,13 +44,13 @@ short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags)
{
ImFileType *type;
- if(ibuf == NULL) return (FALSE);
+ if (ibuf == NULL) return (FALSE);
ibuf->flags = flags;
- for(type=IMB_FILE_TYPES; type->is_a; type++) {
- if(type->save && type->ftype(type, ibuf)) {
- if(!(type->flag & IM_FTYPE_FLOAT)) {
- if(ibuf->rect==NULL && ibuf->rect_float)
+ for (type=IMB_FILE_TYPES; type->is_a; type++) {
+ if (type->save && type->ftype(type, ibuf)) {
+ if (!(type->flag & IM_FTYPE_FLOAT)) {
+ if (ibuf->rect==NULL && ibuf->rect_float)
IMB_rect_from_float(ibuf);
}
return type->save(ibuf, name, flags);
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 6abda1f711b..f495b1b4336 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -226,7 +226,7 @@ typedef struct bPoseChannel {
float pose_head[3]; /* actually pose_mat[3] */
float pose_tail[3]; /* also used for drawing help lines... */
- float limitmin[3], limitmax[3]; /* DOF constraint */
+ float limitmin[3], limitmax[3]; /* DOF constraint, note! - these are stored in degrees, not radians */
float stiffness[3]; /* DOF stiffness */
float ikstretch;
float ikrotweight; /* weight of joint rotation constraint */
@@ -511,7 +511,7 @@ typedef enum eAction_Flags {
/* Storage for Dopesheet/Grease-Pencil Editor data */
typedef struct bDopeSheet {
ID *source; /* currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil) */
- ListBase chanbase; /* cache for channels (only initialised when pinned) */ // XXX not used!
+ ListBase chanbase; /* cache for channels (only initialized when pinned) */ // XXX not used!
struct Group *filter_grp; /* object group for ADS_FILTER_ONLYOBGROUP filtering option */
char searchstr[64]; /* string to search for in displayed names of F-Curves for ADS_FILTER_BY_FCU_NAME filtering option */
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index c68592e525c..fd4b86a4155 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -373,7 +373,7 @@ typedef struct ChannelDriver {
* which relates the target 'variables' in some way to yield a single usable value
*/
char expression[256]; /* expression to compile for evaluation */
- void *expr_comp; /* PyObject - compiled expression, dont save this */
+ void *expr_comp; /* PyObject - compiled expression, don't save this */
float curval; /* result of previous evaluation */
float influence; /* influence of driver on result */ // XXX to be implemented... this is like the constraint influence setting
@@ -408,7 +408,7 @@ typedef enum eDriver_Flags {
//DRIVER_FLAG_LAYERING = (1<<2),
/* use when the expression needs to be recompiled */
DRIVER_FLAG_RECOMPILE = (1<<3),
- /* the names are cached so they dont need have python unicode versions created each time */
+ /* the names are cached so they don't need have python unicode versions created each time */
DRIVER_FLAG_RENAMEVAR = (1<<4),
/* intermediate values of driver should be shown in the UI for debugging purposes */
DRIVER_FLAG_SHOWDEBUG = (1<<5)
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index b8b1f7d8b70..8b254b3b044 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -113,7 +113,7 @@ typedef struct bArmature {
} bArmature;
/* armature->flag */
-/* dont use bit 7, was saved in files to disable stuff */
+/* don't use bit 7, was saved in files to disable stuff */
typedef enum eArmature_Flag {
ARM_RESTPOS = (1<<0),
ARM_DRAWXRAY = (1<<1), /* XRAY is here only for backwards converting */
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 9fb24199571..0d06b55f1d3 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -102,58 +102,65 @@ typedef struct Brush {
} Brush;
/* Brush.flag */
-#define BRUSH_AIRBRUSH (1<<0)
-#define BRUSH_TORUS (1<<1)
-#define BRUSH_ALPHA_PRESSURE (1<<2)
-#define BRUSH_SIZE_PRESSURE (1<<3)
-#define BRUSH_JITTER_PRESSURE (1<<4) /* was BRUSH_RAD_PRESSURE */
-#define BRUSH_SPACING_PRESSURE (1<<5)
-#define BRUSH_FIXED_TEX (1<<6)
-#define BRUSH_RAKE (1<<7)
-#define BRUSH_ANCHORED (1<<8)
-#define BRUSH_DIR_IN (1<<9)
-#define BRUSH_SPACE (1<<10)
-#define BRUSH_SMOOTH_STROKE (1<<11)
-#define BRUSH_PERSISTENT (1<<12)
-#define BRUSH_ACCUMULATE (1<<13)
-#define BRUSH_LOCK_ALPHA (1<<14)
-#define BRUSH_ORIGINAL_NORMAL (1<<15)
-#define BRUSH_OFFSET_PRESSURE (1<<16)
-#define BRUSH_SPACE_ATTEN (1<<18)
-#define BRUSH_ADAPTIVE_SPACE (1<<19)
-#define BRUSH_LOCK_SIZE (1<<20)
-#define BRUSH_TEXTURE_OVERLAY (1<<21)
-#define BRUSH_EDGE_TO_EDGE (1<<22)
-#define BRUSH_RESTORE_MESH (1<<23)
-#define BRUSH_INVERSE_SMOOTH_PRESSURE (1<<24)
-#define BRUSH_RANDOM_ROTATION (1<<25)
-#define BRUSH_PLANE_TRIM (1<<26)
-#define BRUSH_FRONTFACE (1<<27)
-#define BRUSH_CUSTOM_ICON (1<<28)
-
-/* temporary flag which sets up automatically for correct
- * brush drawing when inverted modal operator is running */
-#define BRUSH_INVERTED (1<<29)
+typedef enum BrushFlags {
+ BRUSH_AIRBRUSH = (1<<0),
+ BRUSH_TORUS = (1<<1),
+ BRUSH_ALPHA_PRESSURE = (1<<2),
+ BRUSH_SIZE_PRESSURE = (1<<3),
+ BRUSH_JITTER_PRESSURE = (1<<4),
+ BRUSH_SPACING_PRESSURE = (1<<5),
+ BRUSH_FIXED_TEX = (1<<6),
+ BRUSH_RAKE = (1<<7),
+ BRUSH_ANCHORED = (1<<8),
+ BRUSH_DIR_IN = (1<<9),
+ BRUSH_SPACE = (1<<10),
+ BRUSH_SMOOTH_STROKE = (1<<11),
+ BRUSH_PERSISTENT = (1<<12),
+ BRUSH_ACCUMULATE = (1<<13),
+ BRUSH_LOCK_ALPHA = (1<<14),
+ BRUSH_ORIGINAL_NORMAL = (1<<15),
+ BRUSH_OFFSET_PRESSURE = (1<<16),
+ BRUSH_SPACE_ATTEN = (1<<18),
+ BRUSH_ADAPTIVE_SPACE = (1<<19),
+ BRUSH_LOCK_SIZE = (1<<20),
+ BRUSH_TEXTURE_OVERLAY = (1<<21),
+ BRUSH_EDGE_TO_EDGE = (1<<22),
+ BRUSH_RESTORE_MESH = (1<<23),
+ BRUSH_INVERSE_SMOOTH_PRESSURE = (1<<24),
+ BRUSH_RANDOM_ROTATION = (1<<25),
+ BRUSH_PLANE_TRIM = (1<<26),
+ BRUSH_FRONTFACE = (1<<27),
+ BRUSH_CUSTOM_ICON = (1<<28),
+
+ /* temporary flag which sets up automatically for correct brush
+ * drawing when inverted modal operator is running */
+ BRUSH_INVERTED = (1<<29)
+} BrushFlags;
/* Brush.sculpt_tool */
-#define SCULPT_TOOL_DRAW 1
-#define SCULPT_TOOL_SMOOTH 2
-#define SCULPT_TOOL_PINCH 3
-#define SCULPT_TOOL_INFLATE 4
-#define SCULPT_TOOL_GRAB 5
-#define SCULPT_TOOL_LAYER 6
-#define SCULPT_TOOL_FLATTEN 7
-#define SCULPT_TOOL_CLAY 8
-#define SCULPT_TOOL_FILL 9
-#define SCULPT_TOOL_SCRAPE 10
-#define SCULPT_TOOL_NUDGE 11
-#define SCULPT_TOOL_THUMB 12
-#define SCULPT_TOOL_SNAKE_HOOK 13
-#define SCULPT_TOOL_ROTATE 14
-//#define SCULPT_TOOL_WAX 15 // XXX: reuse this slot later
-#define SCULPT_TOOL_CREASE 16
-#define SCULPT_TOOL_BLOB 17
-#define SCULPT_TOOL_CLAY_TUBES 18
+typedef enum BrushSculptTool {
+ SCULPT_TOOL_DRAW = 1,
+ SCULPT_TOOL_SMOOTH = 2,
+ SCULPT_TOOL_PINCH = 3,
+ SCULPT_TOOL_INFLATE = 4,
+ SCULPT_TOOL_GRAB = 5,
+ SCULPT_TOOL_LAYER = 6,
+ SCULPT_TOOL_FLATTEN = 7,
+ SCULPT_TOOL_CLAY = 8,
+ SCULPT_TOOL_FILL = 9,
+ SCULPT_TOOL_SCRAPE = 10,
+ SCULPT_TOOL_NUDGE = 11,
+ SCULPT_TOOL_THUMB = 12,
+ SCULPT_TOOL_SNAKE_HOOK = 13,
+ SCULPT_TOOL_ROTATE = 14,
+
+ /* slot 15 is free for use */
+ /* SCULPT_TOOL_ = 15, */
+
+ SCULPT_TOOL_CREASE = 16,
+ SCULPT_TOOL_BLOB = 17,
+ SCULPT_TOOL_CLAY_STRIPS = 18
+} BrushSculptTool;
/* ImagePaintSettings.tool */
#define PAINT_TOOL_DRAW 0
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index 2a8c4c3a74e..9898f9715a0 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -94,7 +94,7 @@ typedef struct CustomData {
#define CD_MLOOPCOL 17
#define CD_TANGENT 18
#define CD_MDISPS 19
-#define CD_WEIGHT_MCOL 20 /* for displaying weightpaint colors */
+#define CD_PREVIEW_MCOL 20 /* for displaying weightpaint colors */
#define CD_ID_MCOL 21
#define CD_TEXTURE_MCOL 22
#define CD_CLOTH_ORCO 23
@@ -108,7 +108,7 @@ typedef struct CustomData {
#define CD_BWEIGHT 29
#define CD_CREASE 30
#define CD_ORIGSPACE_MLOOP 31
-#define CD_WEIGHT_MLOOPCOL 32
+#define CD_PREVIEW_MLOOPCOL 32
#define CD_BM_ELEM_PYPTR 33
/* BMESH ONLY END */
@@ -135,7 +135,7 @@ typedef struct CustomData {
#define CD_MASK_MLOOPCOL (1 << CD_MLOOPCOL)
#define CD_MASK_TANGENT (1 << CD_TANGENT)
#define CD_MASK_MDISPS (1 << CD_MDISPS)
-#define CD_MASK_WEIGHT_MCOL (1 << CD_WEIGHT_MCOL)
+#define CD_MASK_PREVIEW_MCOL (1 << CD_PREVIEW_MCOL)
#define CD_MASK_CLOTH_ORCO (1 << CD_CLOTH_ORCO)
#define CD_MASK_RECAST (1 << CD_RECAST)
@@ -147,7 +147,7 @@ typedef struct CustomData {
#define CD_MASK_BWEIGHT (1 << CD_BWEIGHT)
#define CD_MASK_CREASE (1 << CD_CREASE)
#define CD_MASK_ORIGSPACE_MLOOP (1 << CD_ORIGSPACE_MLOOP)
-#define CD_MASK_WEIGHT_MLOOPCOL (1LL << CD_WEIGHT_MLOOPCOL)
+#define CD_MASK_PREVIEW_MLOOPCOL (1LL << CD_PREVIEW_MLOOPCOL)
#define CD_MASK_BM_ELEM_PYPTR (1LL << CD_BM_ELEM_PYPTR)
/* BMESH ONLY END */
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 6f3014c0961..3de5372d848 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -132,7 +132,7 @@ typedef struct bGPdata {
int flag; /* settings for this datablock */
/* not-saved stroke buffer data (only used during paint-session)
- * - buffer must be initialised before use, but freed after
+ * - buffer must be initialized before use, but freed after
* whole paint operation is over
*/
short sbuffer_size; /* number of elements currently in cache */
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index e2c2870d305..6952f1a9da7 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -209,7 +209,7 @@ typedef struct Material {
/* maximum number of materials per material array.
* (on object, mesh, lamp, etc.). limited by
* short mat_nr in verts, faces.
- * -1 becayse for active material we store the index + 1 */
+ * -1 because for active material we store the index + 1 */
#define MAXMAT (32767-1)
/* material_type */
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index 4c57cd211dd..eac6fc0d5e0 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -86,7 +86,7 @@ typedef struct Mesh {
struct MEdge *medge; /* array of edges */
struct MDeformVert *dvert; /* deformgroup vertices */
- /* array of colors for the tesselated faces, must be number of tesselated
+ /* array of colors for the tessellated faces, must be number of tessellated
* faces * 4 in length */
struct MCol *mcol;
struct MSticky *msticky;
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index b4c0fa09047..77fd6df610c 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -122,9 +122,30 @@ typedef struct MLoopUV {
/* at the moment alpha is abused for vertex painting
* and not used for transparency, note that red and blue are swapped */
typedef struct MLoopCol {
- char a, r, g, b;
+ char r, g, b, a;
} MLoopCol;
+#define MESH_MLOOPCOL_FROM_MCOL(_mloopcol, _mcol) \
+{ \
+ MLoopCol *mloopcol__tmp = _mloopcol; \
+ const MCol *mcol__tmp = _mcol; \
+ mloopcol__tmp->r = mcol__tmp->b; \
+ mloopcol__tmp->g = mcol__tmp->g; \
+ mloopcol__tmp->b = mcol__tmp->r; \
+ mloopcol__tmp->a = mcol__tmp->a; \
+} (void)0
+
+
+#define MESH_MLOOPCOL_TO_MCOL(_mloopcol, _mcol) \
+{ \
+ const MLoopCol *mloopcol__tmp = _mloopcol; \
+ MCol *mcol__tmp = _mcol; \
+ mcol__tmp->b = mloopcol__tmp->r; \
+ mcol__tmp->g = mloopcol__tmp->g; \
+ mcol__tmp->r = mloopcol__tmp->b; \
+ mcol__tmp->a = mloopcol__tmp->a; \
+} (void)0
+
typedef struct MSticky {
float co[2];
} MSticky;
@@ -164,8 +185,14 @@ typedef struct OrigSpaceLoop {
typedef struct MDisps {
/* Strange bug in SDNA: if disps pointer comes first, it fails to see totdisp */
int totdisp;
- char pad[4];
+ int level;
float (*disps)[3];
+
+ /* Used for hiding parts of a multires mesh. Essentially the multires
+ equivalent of MVert.flag's ME_HIDE bit.
+
+ This is a bitmap, keep in sync with type used in BLI_bitmap.h */
+ unsigned int *hidden;
} MDisps;
/** Multires structs kept for compatibility with old files **/
diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h
index 0e70b5d28e3..6fefd2d672f 100644
--- a/source/blender/makesdna/DNA_object_force.h
+++ b/source/blender/makesdna/DNA_object_force.h
@@ -401,7 +401,7 @@ typedef struct SoftBody {
#define PTCACHE_FRAMES_SKIPPED 256
#define PTCACHE_EXTERNAL 512
#define PTCACHE_READ_INFO 1024
-/* dont use the filename of the blendfile the data is linked from (write a local cache) */
+/* don't use the filename of the blendfile the data is linked from (write a local cache) */
#define PTCACHE_IGNORE_LIBPATH 2048
/* high resolution cache is saved for smoke for backwards compatibility, so set this flag to know it's a "fake" cache */
#define PTCACHE_FAKE_SMOKE (1<<12)
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 220ee69b442..63c4806028a 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -321,7 +321,7 @@ typedef struct ParticleSystem
#define PART_TRAND 128
#define PART_EDISTR 256 /* particle/face from face areas */
-//#define PART_STICKY 512 /*collided particles can stick to collider*/
+#define PART_ROTATIONS 512 /* calculate particle rotations (and store them in pointcache) */
#define PART_DIE_ON_COL (1<<12)
#define PART_SIZE_DEFL (1<<13) /* swept sphere deflections */
#define PART_ROT_DYN (1<<14) /* dynamic rotation */
@@ -463,8 +463,13 @@ typedef struct ParticleSystem
#define PART_ROT_OB_Z 8
/* part->avemode */
-#define PART_AVE_SPIN 1
+#define PART_AVE_VELOCITY 1
#define PART_AVE_RAND 2
+#define PART_AVE_HORIZONTAL 3
+#define PART_AVE_VERTICAL 4
+#define PART_AVE_GLOBAL_X 5
+#define PART_AVE_GLOBAL_Y 6
+#define PART_AVE_GLOBAL_Z 7
/* part->reactevent */
#define PART_EVENT_DEATH 0
@@ -498,7 +503,8 @@ typedef struct ParticleSystem
#define PSYS_KEYED 1024
#define PSYS_EDITED 2048
//#define PSYS_PROTECT_CACHE 4096 /* deprecated */
-#define PSYS_DISABLED 8192
+#define PSYS_DISABLED 8192
+#define PSYS_OB_ANIM_RESTORE 16384 /* runtime flag */
/* pars->flag */
#define PARS_UNEXIST 1
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index cff4e539e6e..ba64f332de5 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -40,6 +40,7 @@
struct Ipo;
struct Scene;
struct bSound;
+struct MovieClip;
/* strlens; 256= FILE_MAXFILE, 768= FILE_MAXDIR */
@@ -88,9 +89,11 @@ typedef struct StripProxy {
typedef struct Strip {
struct Strip *next, *prev;
- int rt, len, us, done;
+ int us, done;
int startstill, endstill;
- StripElem *stripdata;
+ StripElem *stripdata; /* only used as an array in IMAGE sequences(!),
+ and as a 1-element array in MOVIE sequences,
+ NULL for all other strip-types */
char dir[768];
StripProxy *proxy;
StripCrop *crop;
@@ -137,10 +140,11 @@ typedef struct Sequence {
int startdisp, enddisp; /*starting and ending points in the sequence*/
float sat;
float mul, handsize;
- /* is sfra needed anymore? - it looks like its only used in one place */
- int sfra; /* starting frame according to the timeline of the scene. */
- int anim_preseek;
- int streamindex; /* streamindex for movie or sound files with several streams */
+
+ short anim_preseek;
+ short streamindex; /* streamindex for movie or sound files with several streams */
+ int multicam_source; /* for multicam source selection */
+ int clip_flag; /* MOVIECLIP render flags */
Strip *strip;
@@ -148,7 +152,9 @@ typedef struct Sequence {
struct Scene *scene;
struct Object *scene_camera; /* override scene camera */
- struct anim *anim;
+ struct anim *anim; /* for MOVIE strips */
+ struct MovieClip *clip; /* for MOVIECLIP strips */
+
float effect_fader;
float speed_fader;
@@ -164,8 +170,6 @@ typedef struct Sequence {
float volume;
float pitch, pan; /* pitch (-0.1..10), pan -2..2 */
- int scenenr; /* for scene selection */
- int multicam_source; /* for multicam source selection */
float strobe;
void *effectdata; /* Struct pointer for effect settings */
@@ -173,6 +177,7 @@ typedef struct Sequence {
int anim_startofs; /* only use part of animation file */
int anim_endofs; /* is subtle different to startofs / endofs */
+
int blend_mode;
float blend_opacity;
@@ -292,7 +297,7 @@ typedef struct SpeedControlVars {
/* convenience define for all selection flags */
#define SEQ_ALLSEL (SELECT+SEQ_LEFTSEL+SEQ_RIGHTSEL)
-/* deprecated, dont use a flag anymore*/
+/* deprecated, don't use a flag anymore*/
/*#define SEQ_ACTIVE 1048576*/
#define SEQ_COLOR_BALANCE_INVERSE_GAIN 1
@@ -321,6 +326,7 @@ typedef struct SpeedControlVars {
#define SEQ_RAM_SOUND 4
#define SEQ_HD_SOUND 5
#define SEQ_SOUND 4
+#define SEQ_MOVIECLIP 6
#define SEQ_EFFECT 8
#define SEQ_CROSS 8
@@ -346,6 +352,9 @@ typedef struct SpeedControlVars {
#define STRIPELEM_PREVIEW_DONE 1
+#define SEQ_MOVIECLIP_RENDER_UNDISTORTED (1<<0)
+#define SEQ_MOVIECLIP_RENDER_STABILIZED (1<<1)
+
#define SEQ_BLEND_REPLACE 0
/* all other BLEND_MODEs are simple SEQ_EFFECT ids and therefore identical
* to the table above. (Only those effects that handle _exactly_ two inputs,
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 128c1422ed6..cd17d464fd5 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -635,7 +635,7 @@ enum FileSortTypeE {
/* filesel types */
#define FILE_UNIX 8
-#define FILE_BLENDER 8 /* dont display relative paths */
+#define FILE_BLENDER 8 /* don't display relative paths */
#define FILE_SPECIAL 9
#define FILE_LOADLIB 1
@@ -693,7 +693,7 @@ enum FileSortTypeE {
/* SpaceImage->sticky
* Note DISABLE should be 0, however would also need to re-arrange icon order,
- * also, sticky loc is the default mode so this means we dont need to 'do_versons' */
+ * also, sticky loc is the default mode so this means we don't need to 'do_versons' */
#define SI_STICKY_LOC 0
#define SI_STICKY_DISABLE 1
#define SI_STICKY_VERTEX 2
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 1db858b2741..636a3ea97e7 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -151,7 +151,7 @@ typedef struct ThemeUI {
uiWidgetColors wcol_regular, wcol_tool, wcol_text;
uiWidgetColors wcol_radio, wcol_option, wcol_toggle;
uiWidgetColors wcol_num, wcol_numslider;
- uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item;
+ uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item, wcol_tooltip;
uiWidgetColors wcol_box, wcol_scroll, wcol_progress, wcol_list_item;
uiWidgetStateColors wcol_state;
@@ -205,7 +205,7 @@ typedef struct ThemeSpace {
char grid[4];
char wire[4], select[4];
- char lamp[4], speaker[4], pad2[4];
+ char lamp[4], speaker[4], empty[4],camera[4], pad[8];
char active[4], group[4], group_active[4], transform[4];
char vertex[4], vertex_select[4];
char edge[4], edge_select[4];
@@ -237,7 +237,7 @@ typedef struct ThemeSpace {
char syntaxl[4], syntaxn[4], syntaxb[4]; // syntax for textwindow and nodes
char syntaxv[4], syntaxc[4];
- char movie[4], image[4], scene[4], audio[4]; // for sequence editor
+ char movie[4], movieclip[4], image[4], scene[4], audio[4]; // for sequence editor
char effect[4], plugin[4], transition[4], meta[4];
char editmesh_active[4];
@@ -423,6 +423,9 @@ typedef struct UserDef {
int compute_device_type;
int compute_device_id;
+
+ float fcu_inactive_alpha; /* opacity of inactive F-Curves in F-Curve Editor */
+ float pad;
} UserDef;
extern UserDef U; /* from blenkernel blender.c */
@@ -511,6 +514,7 @@ extern UserDef U; /* from blenkernel blender.c */
#define USER_SPLASH_DISABLE (1 << 27)
#define USER_HIDE_RECENT (1 << 28)
#define USER_SHOW_THUMBNAILS (1 << 29)
+#define USER_QUIT_PROMPT (1 << 30)
/* Auto-Keying mode */
/* AUTOKEY_ON is a bitflag */
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index cdb6d8d053c..c86d9d17b1f 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -85,7 +85,7 @@ enum ReportListFlags {
RPT_PRINT = 1,
RPT_STORE = 2,
RPT_FREE = 4,
- RPT_OP_HOLD = 8 /* dont move them into the operator global list (caller will use) */
+ RPT_OP_HOLD = 8 /* don't move them into the operator global list (caller will use) */
};
#
#
@@ -98,7 +98,7 @@ typedef struct Report {
const char *message;
} Report;
-/* saved in the wm, dont remove */
+/* saved in the wm, don't remove */
typedef struct ReportList {
ListBase list;
int printlevel; /* ReportType */
@@ -159,7 +159,7 @@ typedef struct wmWindowManager {
typedef struct wmWindow {
struct wmWindow *next, *prev;
- void *ghostwin; /* dont want to include ghost.h stuff */
+ void *ghostwin; /* don't want to include ghost.h stuff */
int winid; /* winid also in screens, is for retrieving this window after read */
diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h
index 5482566ac41..b3c10406d4c 100644
--- a/source/blender/makesdna/DNA_world_types.h
+++ b/source/blender/makesdna/DNA_world_types.h
@@ -66,7 +66,7 @@ typedef struct World {
/**
* Exposure= mult factor. unused now, but maybe back later. Kept in to be upward compat.
* New is exp/range control. linfac & logfac are constants... don't belong in
- * file, but allocating 8 bytes for temp mem isnt useful either.
+ * file, but allocating 8 bytes for temp mem isn't useful either.
*/
float exposure, exp, range;
float linfac, logfac;
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 2148bc96c04..5e4c244dbc2 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -178,11 +178,11 @@ int DNA_elem_array_size(const char *astr, int len)
memcpy(str, astr, len+1);
- for(a=0; a<len; a++) {
- if( str[a]== '[' ) {
+ for (a=0; a<len; a++) {
+ if ( str[a]== '[' ) {
cp= &(str[a+1]);
}
- else if( str[a]==']' && cp) {
+ else if ( str[a]==']' && cp) {
str[a]= 0;
mul*= atoi(cp);
}
@@ -226,17 +226,17 @@ static int elementsize(SDNA *sdna, short type, short name)
namelen= strlen(cp);
/* is it a pointer or function pointer? */
- if(ispointer(cp)) {
+ if (ispointer(cp)) {
/* has the naam an extra length? (array) */
mul= 1;
- if( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
+ if ( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
len= sdna->pointerlen*mul;
}
- else if( sdna->typelens[type] ) {
+ else if ( sdna->typelens[type] ) {
/* has the naam an extra length? (array) */
mul= 1;
- if( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
+ if ( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
len= mul*sdna->typelens[type];
@@ -258,7 +258,7 @@ static void printstruct(SDNA *sdna, short strnr)
nr= sp[1];
sp+= 2;
- for(b=0; b< nr; b++, sp+= 2) {
+ for (b=0; b< nr; b++, sp+= 2) {
printf(" %s %s\n", sdna->types[sp[0]], sdna->names[sp[1]]);
}
}
@@ -270,11 +270,11 @@ static short *findstruct_name(SDNA *sdna, const char *str)
short *sp= NULL;
- for(a=0; a<sdna->nr_structs; a++) {
+ for (a=0; a<sdna->nr_structs; a++) {
sp= sdna->structs[a];
- if(strcmp( sdna->types[ sp[0] ], str )==0) return sp;
+ if (strcmp( sdna->types[ sp[0] ], str )==0) return sp;
}
return NULL;
@@ -284,9 +284,9 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str)
{
short *sp= NULL;
- if(sdna->lastfind<sdna->nr_structs) {
+ if (sdna->lastfind<sdna->nr_structs) {
sp= sdna->structs[sdna->lastfind];
- if(strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind;
+ if (strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind;
}
#ifdef WITH_DNA_GHASH
@@ -295,11 +295,11 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str)
{
int a;
- for(a=0; a<sdna->nr_structs; a++) {
+ for (a=0; a<sdna->nr_structs; a++) {
sp= sdna->structs[a];
- if(strcmp( sdna->types[ sp[0] ], str )==0) {
+ if (strcmp( sdna->types[ sp[0] ], str )==0) {
sdna->lastfind= a;
return a;
}
@@ -325,16 +325,16 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
data= (int *)sdna->data;
strcpy(str, "SDNA");
- if( *data == *verg ) {
+ if ( *data == *verg ) {
data++;
/* load names array */
strcpy(str, "NAME");
- if( *data == *verg ) {
+ if ( *data == *verg ) {
data++;
- if(do_endian_swap) sdna->nr_names= le_int(*data);
+ if (do_endian_swap) sdna->nr_names= le_int(*data);
else sdna->nr_names= *data;
data++;
@@ -347,20 +347,20 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
nr= 0;
cp= (char *)data;
- while(nr<sdna->nr_names) {
+ while (nr<sdna->nr_names) {
sdna->names[nr]= cp;
/* "float gravity [3]" was parsed wrong giving both "gravity" and
* "[3]" members. we rename "[3]", and later set the type of
* "gravity" to "void" so the offsets work out correct */
- if(*cp == '[' && strcmp(cp, "[3]")==0) {
- if(nr && strcmp(sdna->names[nr-1], "Cvi") == 0) {
+ if (*cp == '[' && strcmp(cp, "[3]")==0) {
+ if (nr && strcmp(sdna->names[nr-1], "Cvi") == 0) {
sdna->names[nr]= "gravity[3]";
gravity_fix= nr;
}
}
- while( *cp) cp++;
+ while ( *cp) cp++;
cp++;
nr++;
}
@@ -371,10 +371,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
/* load type names array */
data= (int *)cp;
strcpy(str, "TYPE");
- if( *data == *verg ) {
+ if ( *data == *verg ) {
data++;
- if(do_endian_swap) sdna->nr_types= le_int(*data);
+ if (do_endian_swap) sdna->nr_types= le_int(*data);
else sdna->nr_types= *data;
data++;
@@ -387,18 +387,18 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
nr= 0;
cp= (char *)data;
- while(nr<sdna->nr_types) {
+ while (nr<sdna->nr_types) {
sdna->types[nr]= cp;
/* this is a patch, to change struct names without a conflict with SDNA */
/* be careful to use it, in this case for a system-struct (opengl/X) */
- if( *cp == 'b') {
+ if ( *cp == 'b') {
/* struct Screen was already used by X, 'bScreen' replaces the old IrisGL 'Screen' struct */
- if( strcmp("bScreen", cp)==0 ) sdna->types[nr]= cp+1;
+ if ( strcmp("bScreen", cp)==0 ) sdna->types[nr]= cp+1;
}
- while( *cp) cp++;
+ while ( *cp) cp++;
cp++;
nr++;
}
@@ -409,16 +409,16 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
/* load typelen array */
data= (int *)cp;
strcpy(str, "TLEN");
- if( *data == *verg ) {
+ if ( *data == *verg ) {
data++;
sp= (short *)data;
sdna->typelens= sp;
- if(do_endian_swap) {
+ if (do_endian_swap) {
short a, *spo= sp;
a= sdna->nr_types;
- while(a--) {
+ while (a--) {
spo[0]= le_short(spo[0]);
spo++;
}
@@ -430,15 +430,15 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
printf("TLEN error in SDNA file\n");
return;
}
- if(sdna->nr_types & 1) sp++; /* prevent BUS error */
+ if (sdna->nr_types & 1) sp++; /* prevent BUS error */
/* load struct array */
data= (int *)sp;
strcpy(str, "STRC");
- if( *data == *verg ) {
+ if ( *data == *verg ) {
data++;
- if(do_endian_swap) sdna->nr_structs= le_int(*data);
+ if (do_endian_swap) sdna->nr_structs= le_int(*data);
else sdna->nr_structs= *data;
data++;
@@ -451,10 +451,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
nr= 0;
sp= (short *)data;
- while(nr<sdna->nr_structs) {
+ while (nr<sdna->nr_structs) {
sdna->structs[nr]= sp;
- if(do_endian_swap) {
+ if (do_endian_swap) {
short a;
sp[0]= le_short(sp[0]);
@@ -462,7 +462,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
a= sp[1];
sp+= 2;
- while(a--) {
+ while (a--) {
sp[0]= le_short(sp[0]);
sp[1]= le_short(sp[1]);
sp+= 2;
@@ -481,17 +481,17 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
sdna->pointerlen= sdna->typelens[ sp[0] ]/2;
- if(sp[1]!=2 || (sdna->pointerlen!=4 && sdna->pointerlen!=8)) {
+ if (sp[1]!=2 || (sdna->pointerlen!=4 && sdna->pointerlen!=8)) {
printf("ListBase struct error! Needs it to calculate pointerize.\n");
exit(0);
/* well, at least sizeof(ListBase) is error proof! (ton) */
}
/* second part of gravity problem, setting "gravity" type to void */
- if(gravity_fix > -1) {
- for(nr=0; nr<sdna->nr_structs; nr++) {
+ if (gravity_fix > -1) {
+ for (nr=0; nr<sdna->nr_structs; nr++) {
sp= sdna->structs[nr];
- if(strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0)
+ if (strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0)
sp[10]= SDNA_TYPE_VOID;
}
}
@@ -500,7 +500,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
/* create a ghash lookup to speed up */
sdna->structs_map= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "init_structDNA gh");
- for(nr = 0; nr < sdna->nr_structs; nr++) {
+ for (nr = 0; nr < sdna->nr_structs; nr++) {
sp= sdna->structs[nr];
BLI_ghash_insert(sdna->structs_map, (void *)sdna->types[sp[0]], (void *)(nr + 1));
}
@@ -537,15 +537,15 @@ static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr)
sp= sdna->structs[structnr];
typenr= sp[0];
- for(a=0; a<sdna->nr_structs; a++) {
- if(a!=structnr && compflags[a]==1) {
+ for (a=0; a<sdna->nr_structs; a++) {
+ if (a!=structnr && compflags[a]==1) {
sp= sdna->structs[a];
elems= sp[1];
sp+= 2;
- for(b=0; b<elems; b++, sp+=2) {
- if(sp[0]==typenr) {
+ for (b=0; b<elems; b++, sp+=2) {
+ if (sp[0]==typenr) {
cp= sdna->names[ sp[1] ];
- if(!ispointer(cp)) {
+ if (!ispointer(cp)) {
compflags[a]= 2;
recurs_test_compflags(sdna, compflags, a);
}
@@ -578,7 +578,7 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
const char *str1, *str2;
char *compflags;
- if(sdna->nr_structs==0) {
+ if (sdna->nr_structs==0) {
printf("error: file without SDNA\n");
return NULL;
}
@@ -589,42 +589,42 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
* the structs in 'newsdna'
*/
- for(a=0; a<sdna->nr_structs; a++) {
+ for (a=0; a<sdna->nr_structs; a++) {
spold= sdna->structs[a];
/* search for type in cur */
spcur= findstruct_name(newsdna, sdna->types[spold[0]]);
- if(spcur) {
+ if (spcur) {
compflags[a]= 2;
/* compare length and amount of elems */
- if( spcur[1] == spold[1]) {
- if( newsdna->typelens[spcur[0]] == sdna->typelens[spold[0]] ) {
+ if ( spcur[1] == spold[1]) {
+ if ( newsdna->typelens[spcur[0]] == sdna->typelens[spold[0]] ) {
/* same length, same amount of elems, now per type and name */
b= spold[1];
spold+= 2;
spcur+= 2;
- while(b > 0) {
+ while (b > 0) {
str1= newsdna->types[spcur[0]];
str2= sdna->types[spold[0]];
- if(strcmp(str1, str2)!=0) break;
+ if (strcmp(str1, str2)!=0) break;
str1= newsdna->names[spcur[1]];
str2= sdna->names[spold[1]];
- if(strcmp(str1, str2)!=0) break;
+ if (strcmp(str1, str2)!=0) break;
/* same type and same name, now pointersize */
- if(ispointer(str1)) {
- if(sdna->pointerlen!=newsdna->pointerlen) break;
+ if (ispointer(str1)) {
+ if (sdna->pointerlen!=newsdna->pointerlen) break;
}
b--;
spold+= 2;
spcur+= 2;
}
- if(b==0) compflags[a]= 1;
+ if (b==0) compflags[a]= 1;
}
}
@@ -640,13 +640,13 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
/* Because structs can be inside structs, we recursively
* set flags when a struct is altered
*/
- for(a=0; a<sdna->nr_structs; a++) {
- if(compflags[a]==2) recurs_test_compflags(sdna, compflags, a);
+ for (a=0; a<sdna->nr_structs; a++) {
+ if (compflags[a]==2) recurs_test_compflags(sdna, compflags, a);
}
#if 0
- for(a=0; a<sdna->nr_structs; a++) {
- if(compflags[a]==2) {
+ for (a=0; a<sdna->nr_structs; a++) {
+ if (compflags[a]==2) {
spold= sdna->structs[a];
printf("changed: %s\n", sdna->types[ spold[0] ]);
}
@@ -659,16 +659,16 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
static eSDNA_Type sdna_type_nr(const char *dna_type)
{
if ((strcmp(dna_type, "char")==0) || (strcmp(dna_type, "const char")==0)) return SDNA_TYPE_CHAR;
- else if((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0)) return SDNA_TYPE_UCHAR;
- else if( strcmp(dna_type, "short")==0) return SDNA_TYPE_SHORT;
- else if((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0)) return SDNA_TYPE_USHORT;
- else if( strcmp(dna_type, "int")==0) return SDNA_TYPE_INT;
- else if( strcmp(dna_type, "long")==0) return SDNA_TYPE_LONG;
- else if((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0)) return SDNA_TYPE_ULONG;
- else if( strcmp(dna_type, "float")==0) return SDNA_TYPE_FLOAT;
- else if( strcmp(dna_type, "double")==0) return SDNA_TYPE_DOUBLE;
- else if( strcmp(dna_type, "int64_t")==0) return SDNA_TYPE_INT64;
- else if( strcmp(dna_type, "uint64_t")==0) return SDNA_TYPE_UINT64;
+ else if ((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0)) return SDNA_TYPE_UCHAR;
+ else if ( strcmp(dna_type, "short")==0) return SDNA_TYPE_SHORT;
+ else if ((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0)) return SDNA_TYPE_USHORT;
+ else if ( strcmp(dna_type, "int")==0) return SDNA_TYPE_INT;
+ else if ( strcmp(dna_type, "long")==0) return SDNA_TYPE_LONG;
+ else if ((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0)) return SDNA_TYPE_ULONG;
+ else if ( strcmp(dna_type, "float")==0) return SDNA_TYPE_FLOAT;
+ else if ( strcmp(dna_type, "double")==0) return SDNA_TYPE_DOUBLE;
+ else if ( strcmp(dna_type, "int64_t")==0) return SDNA_TYPE_INT64;
+ else if ( strcmp(dna_type, "uint64_t")==0) return SDNA_TYPE_UINT64;
else return -1; /* invalid! */
}
@@ -691,7 +691,7 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch
oldlen= DNA_elem_type_size(otypenr);
curlen= DNA_elem_type_size(ctypenr);
- while(arrlen>0) {
+ while (arrlen>0) {
switch(otypenr) {
case SDNA_TYPE_CHAR:
val= *olddata; break;
@@ -733,10 +733,10 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch
case SDNA_TYPE_ULONG:
*( (unsigned int *)curdata)= val; break;
case SDNA_TYPE_FLOAT:
- if(otypenr<2) val/= 255;
+ if (otypenr<2) val/= 255;
*( (float *)curdata)= val; break;
case SDNA_TYPE_DOUBLE:
- if(otypenr<2) val/= 255;
+ if (otypenr<2) val/= 255;
*( (double *)curdata)= val; break;
case SDNA_TYPE_INT64:
*( (int64_t *)curdata)= val; break;
@@ -761,12 +761,12 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
arrlen= DNA_elem_array_size(name, strlen(name));
- while(arrlen>0) {
+ while (arrlen>0) {
- if(curlen==oldlen) {
+ if (curlen==oldlen) {
memcpy(curdata, olddata, curlen);
}
- else if(curlen==4 && oldlen==8) {
+ else if (curlen==4 && oldlen==8) {
#ifdef WIN32
lval= *( (__int64 *)olddata );
#else
@@ -774,7 +774,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
#endif
*((int *)curdata) = lval>>3; /* is of course gambling! */
}
- else if(curlen==8 && oldlen==4) {
+ else if (curlen==8 && oldlen==4) {
#ifdef WIN32
*( (__int64 *)curdata ) = *((int *)olddata);
#else
@@ -799,10 +799,10 @@ static int elem_strcmp(const char *name, const char *oname)
/* strcmp without array part */
- while(1) {
- if(name[a] != oname[a]) return 1;
- if(name[a]=='[') break;
- if(name[a]==0) break;
+ while (1) {
+ if (name[a] != oname[a]) return 1;
+ if (name[a]=='[') break;
+ if (name[a]==0) break;
a++;
}
return 0;
@@ -818,16 +818,16 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol
/* in old is the old struct */
elemcount= old[1];
old+= 2;
- for(a=0; a<elemcount; a++, old+=2) {
+ for (a=0; a<elemcount; a++, old+=2) {
otype= sdna->types[old[0]];
oname= sdna->names[old[1]];
len= elementsize(sdna, old[0], old[1]);
- if( elem_strcmp(name, oname)==0 ) { /* naam equal */
- if( strcmp(type, otype)==0 ) { /* type equal */
- if(sppo) *sppo= old;
+ if ( elem_strcmp(name, oname)==0 ) { /* naam equal */
+ if ( strcmp(type, otype)==0 ) { /* type equal */
+ if (sppo) *sppo= old;
return olddata;
}
@@ -858,53 +858,53 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna,
/* is 'name' an array? */
cp= name;
array= 0;
- while( *cp && *cp!='[') {
+ while ( *cp && *cp!='[') {
cp++; array++;
}
- if( *cp!= '[' ) array= 0;
+ if ( *cp!= '[' ) array= 0;
/* in old is the old struct */
elemcount= old[1];
old+= 2;
- for(a=0; a<elemcount; a++, old+=2) {
+ for (a=0; a<elemcount; a++, old+=2) {
otype= oldsdna->types[old[0]];
oname= oldsdna->names[old[1]];
len= elementsize(oldsdna, old[0], old[1]);
- if( strcmp(name, oname)==0 ) { /* name equal */
+ if ( strcmp(name, oname)==0 ) { /* name equal */
- if(ispointer(name)) { /* pointer of functionpointer afhandelen */
+ if (ispointer(name)) { /* pointer of functionpointer afhandelen */
cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata);
}
- else if( strcmp(type, otype)==0 ) { /* type equal */
+ else if ( strcmp(type, otype)==0 ) { /* type equal */
memcpy(curdata, olddata, len);
}
else cast_elem(type, otype, name, curdata, olddata);
return;
}
- else if(array) { /* name is an array */
+ else if (array) { /* name is an array */
- if(oname[array]=='[' && strncmp(name, oname, array)==0 ) { /* basis equal */
+ if (oname[array]=='[' && strncmp(name, oname, array)==0 ) { /* basis equal */
cursize= DNA_elem_array_size(name, strlen(name));
oldsize= DNA_elem_array_size(oname, strlen(oname));
- if(ispointer(name)) { /* handle pointer or functionpointer */
- if(cursize>oldsize) cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, oname, curdata, olddata);
+ if (ispointer(name)) { /* handle pointer or functionpointer */
+ if (cursize>oldsize) cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, oname, curdata, olddata);
else cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata);
}
- else if(name[0]=='*' || strcmp(type, otype)==0 ) { /* type equal */
+ else if (name[0]=='*' || strcmp(type, otype)==0 ) { /* type equal */
mul= len/oldsize;
mul*= (cursize < oldsize)? cursize: oldsize;
memcpy(curdata, olddata, mul);
/* terminate strings */
- if(oldsize > cursize && strcmp(type, "char")==0)
+ if (oldsize > cursize && strcmp(type, "char")==0)
curdata[mul-1]= 0;
}
else {
- if(cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata);
+ if (cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata);
else cast_elem(type, otype, name, curdata, olddata);
}
return;
@@ -926,10 +926,10 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
char *type, *cpo, *cpc;
const char *name, *nameo;
- if(oldSDNAnr== -1) return;
- if(curSDNAnr== -1) return;
+ if (oldSDNAnr== -1) return;
+ if (curSDNAnr== -1) return;
- if( compflags[oldSDNAnr]==1 ) { /* if recursive: test for equal */
+ if ( compflags[oldSDNAnr]==1 ) { /* if recursive: test for equal */
spo= oldsdna->structs[oldSDNAnr];
elen= oldsdna->typelens[ spo[0] ];
@@ -947,19 +947,19 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
spc+= 2;
cpc= cur;
- for(a=0; a<elemcount; a++, spc+=2) {
+ for (a=0; a<elemcount; a++, spc+=2) {
type= newsdna->types[spc[0]];
name= newsdna->names[spc[1]];
elen= elementsize(newsdna, spc[0], spc[1]);
/* test: is type a struct? */
- if(spc[0]>=firststructtypenr && !ispointer(name)) {
+ if (spc[0]>=firststructtypenr && !ispointer(name)) {
/* where does the old struct data start (and is there an old one?) */
cpo= find_elem(oldsdna, type, name, spo, data, &sppo);
- if(cpo) {
+ if (cpo) {
oldSDNAnr= DNA_struct_find_nr(oldsdna, type);
curSDNAnr= DNA_struct_find_nr(newsdna, type);
@@ -973,14 +973,14 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
elen/= mul;
eleno/= mulo;
- while(mul--) {
+ while (mul--) {
reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc);
cpo+= eleno;
cpc+= elen;
/* new struct array larger than old */
mulo--;
- if(mulo<=0) break;
+ if (mulo<=0) break;
}
}
else cpc+= elen;
@@ -1004,7 +1004,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
char *type, *cpo, *cur, cval;
const char *name;
- if(oldSDNAnr== -1) return;
+ if (oldSDNAnr== -1) return;
firststructtypenr= *(oldsdna->structs[0]);
spo= spc= oldsdna->structs[oldSDNAnr];
@@ -1014,7 +1014,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
spc+= 2;
cur= data;
- for(a=0; a<elemcount; a++, spc+=2) {
+ for (a=0; a<elemcount; a++, spc+=2) {
type= oldsdna->types[spc[0]];
name= oldsdna->names[spc[1]];
@@ -1022,16 +1022,16 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
elen= elementsize(oldsdna, spc[0], spc[1]);
/* test: is type a struct? */
- if(spc[0]>=firststructtypenr && !ispointer(name)) {
+ if (spc[0]>=firststructtypenr && !ispointer(name)) {
/* where does the old data start (is there one?) */
cpo= find_elem(oldsdna, type, name, spo, data, NULL);
- if(cpo) {
+ if (cpo) {
oldSDNAnr= DNA_struct_find_nr(oldsdna, type);
mul= DNA_elem_array_size(name, strlen(name));
elena= elen/mul;
- while(mul--) {
+ while (mul--) {
DNA_struct_switch_endian(oldsdna, oldSDNAnr, cpo);
cpo += elena;
}
@@ -1039,12 +1039,12 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
}
else {
- if(ispointer(name)) {
- if(oldsdna->pointerlen==8) {
+ if (ispointer(name)) {
+ if (oldsdna->pointerlen==8) {
mul= DNA_elem_array_size(name, strlen(name));
cpo= cur;
- while(mul--) {
+ while (mul--) {
cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval;
cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval;
cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval;
@@ -1063,17 +1063,17 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
/* exception: variable called blocktype/ipowin: derived from ID_ */
skip= 0;
- if(name[0]=='b' && name[1]=='l') {
- if(strcmp(name, "blocktype")==0) skip= 1;
+ if (name[0]=='b' && name[1]=='l') {
+ if (strcmp(name, "blocktype")==0) skip= 1;
}
- else if(name[0]=='i' && name[1]=='p') {
- if(strcmp(name, "ipowin")==0) skip= 1;
+ else if (name[0]=='i' && name[1]=='p') {
+ if (strcmp(name, "ipowin")==0) skip= 1;
}
- if(skip==0) {
+ if (skip==0) {
mul= DNA_elem_array_size(name, strlen(name));
cpo= cur;
- while(mul--) {
+ while (mul--) {
cval= cpo[0];
cpo[0]= cpo[1];
cpo[1]= cval;
@@ -1089,7 +1089,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
mul= DNA_elem_array_size(name, strlen(name));
cpo= cur;
- while(mul--) {
+ while (mul--) {
cval= cpo[0];
cpo[0]= cpo[3];
cpo[3]= cval;
@@ -1104,7 +1104,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
{
mul= DNA_elem_array_size(name, strlen(name));
cpo= cur;
- while(mul--) {
+ while (mul--) {
cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval;
cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval;
cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval;
@@ -1132,18 +1132,18 @@ void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int
curSDNAnr= DNA_struct_find_nr(newsdna, type);
/* init data and alloc */
- if(curSDNAnr >= 0) {
+ if (curSDNAnr >= 0) {
spc= newsdna->structs[curSDNAnr];
curlen= newsdna->typelens[ spc[0] ];
}
- if(curlen==0) {
+ if (curlen==0) {
return NULL;
}
cur= MEM_callocN( blocks*curlen, "reconstruct");
cpc= cur;
cpo= data;
- for(a=0; a<blocks; a++) {
+ for (a=0; a<blocks; a++) {
reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc);
cpc+= curlen;
cpo+= oldlen;
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 7dc51446ddc..75591f9737f 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -230,7 +230,7 @@ static int add_type(const char *str, int len)
char *cp;
/* first do validity check */
- if(str[0]==0) {
+ if (str[0]==0) {
return -1;
}
else if (strchr(str, '*')) {
@@ -240,8 +240,8 @@ static int add_type(const char *str, int len)
}
/* search through type array */
- for(nr=0; nr<nr_types; nr++) {
- if(strcmp(str, types[nr])==0) {
+ for (nr=0; nr<nr_types; nr++) {
+ if (strcmp(str, types[nr])==0) {
if (len) {
typelens[nr]= len;
alphalens[nr] = len;
@@ -251,7 +251,7 @@ static int add_type(const char *str, int len)
}
/* append new type */
- if(nr_types==0) cp= typedata;
+ if (nr_types==0) cp= typedata;
else {
cp= types[nr_types-1]+strlen(types[nr_types-1])+1;
}
@@ -260,7 +260,7 @@ static int add_type(const char *str, int len)
typelens[nr_types]= len;
alphalens[nr_types]= len;
- if(nr_types>=maxnr) {
+ if (nr_types>=maxnr) {
printf("too many types\n");
return nr_types-1;
}
@@ -287,7 +287,7 @@ static int add_name(const char *str)
additional_slen_offset = 0;
- if(str[0]==0 /* || (str[1]==0) */) return -1;
+ if (str[0]==0 /* || (str[1]==0) */) return -1;
if (str[0] == '(' && str[1] == '*') {
/* we handle function pointer and special array cases here, e.g.
@@ -323,7 +323,7 @@ static int add_name(const char *str)
if (!isfuncptr) {
/* multidimensional array pointer case */
- if(str[j] == 0) {
+ if (str[j] == 0) {
if (debugSDNA > 3) printf("offsetting for multidim array pointer\n");
}
else
@@ -339,10 +339,12 @@ static int add_name(const char *str)
}
if (debugSDNA > 3) printf("extra offset %d\n", k);
additional_slen_offset = k;
- } else if (str[j] == ')' ) {
+ }
+ else if (str[j] == ')' ) {
if (debugSDNA > 3) printf("offsetting for brace\n");
; /* don't get extra offset */
- } else {
+ }
+ else {
printf("Error during tokening function pointer argument list\n");
}
@@ -370,7 +372,8 @@ static int add_name(const char *str)
buf[i+5] = 'd';
buf[i+6] = ')';
buf[i+7] = 0;
- } else {
+ }
+ else {
buf[i] = ')';
buf[i+1] = '(';
buf[i+2] = ')';
@@ -379,27 +382,28 @@ static int add_name(const char *str)
/* now precede with buf*/
if (debugSDNA > 3) printf("\t\t\t\t\tProposing fp name %s\n", buf);
name = buf;
- } else {
+ }
+ else {
/* normal field: old code */
name = str;
}
/* search name array */
- for(nr=0; nr<nr_names; nr++) {
- if(strcmp(name, names[nr])==0) {
+ for (nr=0; nr<nr_names; nr++) {
+ if (strcmp(name, names[nr])==0) {
return nr;
}
}
/* append new type */
- if(nr_names==0) cp= namedata;
+ if (nr_names==0) cp= namedata;
else {
cp= names[nr_names-1]+strlen(names[nr_names-1])+1;
}
strcpy(cp, name);
names[nr_names]= cp;
- if(nr_names>=maxnr) {
+ if (nr_names>=maxnr) {
printf("too many names\n");
return nr_names-1;
}
@@ -413,7 +417,7 @@ static short *add_struct(int namecode)
int len;
short *sp;
- if(nr_structs==0) {
+ if (nr_structs==0) {
structs[0]= structdata;
}
else {
@@ -425,7 +429,7 @@ static short *add_struct(int namecode)
sp= structs[nr_structs];
sp[0]= namecode;
- if(nr_structs>=maxnr) {
+ if (nr_structs>=maxnr) {
printf("too many structs\n");
return sp;
}
@@ -451,10 +455,11 @@ static int preprocess_include(char *maindata, int len)
cp= temp;
a= len;
comment = 0;
- while(a--) {
- if(cp[0]=='/' && cp[1]=='/') {
+ while (a--) {
+ if (cp[0]=='/' && cp[1]=='/') {
comment = 1;
- } else if (*cp<32) {
+ }
+ else if (*cp<32) {
comment = 0;
}
if (comment || *cp<32 || *cp>128 ) *cp= 32;
@@ -468,21 +473,21 @@ static int preprocess_include(char *maindata, int len)
newlen= 0;
comment= 0;
a= len;
- while(a--) {
+ while (a--) {
- if(cp[0]=='/' && cp[1]=='*') {
+ if (cp[0]=='/' && cp[1]=='*') {
comment= 1;
cp[0]=cp[1]= 32;
}
- if(cp[0]=='*' && cp[1]=='/') {
+ if (cp[0]=='*' && cp[1]=='/') {
comment= 0;
cp[0]=cp[1]= 32;
}
/* do not copy when: */
- if(comment);
- else if( cp[0]==' ' && cp[1]==' ' );
- else if( cp[-1]=='*' && cp[0]==' ' ); /* pointers with a space */
+ if (comment);
+ else if ( cp[0]==' ' && cp[1]==' ' );
+ else if ( cp[-1]=='*' && cp[0]==' ' ); /* pointers with a space */
/* skip special keywords */
else if (strncmp("DNA_DEPRECATED", cp, 14)==0) {
@@ -559,26 +564,26 @@ static int convert_include(char *filename)
/* we look for '{' and then back to 'struct' */
count= 0;
overslaan= 0;
- while(count<filelen) {
+ while (count<filelen) {
/* code for skipping a struct: two hashes on 2 lines. (preprocess added a space) */
- if(md[0]=='#' && md[1]==' ' && md[2]=='#') {
+ if (md[0]=='#' && md[1]==' ' && md[2]=='#') {
overslaan= 1;
}
- if(md[0]=='{') {
+ if (md[0]=='{') {
md[0]= 0;
- if(overslaan) {
+ if (overslaan) {
overslaan= 0;
}
else {
- if(md[-1]==' ') md[-1]= 0;
+ if (md[-1]==' ') md[-1]= 0;
md1= md-2;
- while( *md1!=32) md1--; /* to beginning of word */
+ while ( *md1!=32) md1--; /* to beginning of word */
md1++;
/* we've got a struct name when... */
- if( strncmp(md1-7, "struct", 6)==0 ) {
+ if ( strncmp(md1-7, "struct", 6)==0 ) {
strct = add_type(md1, 0);
if (strct == -1) {
@@ -593,23 +598,23 @@ static int convert_include(char *filename)
/* first lets make it all nice strings */
md1= md+1;
- while(*md1 != '}') {
- if(md1>mainend) break;
+ while (*md1 != '}') {
+ if (md1>mainend) break;
- if(*md1==',' || *md1==' ') *md1= 0;
+ if (*md1==',' || *md1==' ') *md1= 0;
md1++;
}
/* read types and names until first character that is not '}' */
md1= md+1;
- while( *md1 != '}' ) {
- if(md1>mainend) break;
+ while ( *md1 != '}' ) {
+ if (md1>mainend) break;
/* skip when it says 'struct' or 'unsigned' or 'const' */
- if(*md1) {
- if( strncmp(md1, "struct", 6)==0 ) md1+= 7;
- if( strncmp(md1, "unsigned", 8)==0 ) md1+= 9;
- if( strncmp(md1, "const", 5)==0 ) md1+= 6;
+ if (*md1) {
+ if ( strncmp(md1, "struct", 6)==0 ) md1+= 7;
+ if ( strncmp(md1, "unsigned", 8)==0 ) md1+= 9;
+ if ( strncmp(md1, "const", 5)==0 ) md1+= 6;
/* we've got a type! */
type= add_type(md1, 0);
@@ -624,15 +629,15 @@ static int convert_include(char *filename)
/* read until ';' */
- while( *md1 != ';' ) {
- if(md1>mainend) break;
+ while ( *md1 != ';' ) {
+ if (md1>mainend) break;
- if(*md1) {
+ if (*md1) {
/* We've got a name. slen needs
* correction for function
* pointers! */
slen= (int) strlen(md1);
- if( md1[slen-1]==';' ) {
+ if ( md1[slen-1]==';' ) {
md1[slen-1]= 0;
@@ -690,11 +695,11 @@ static int arraysize(char *astr, int len)
memcpy(str, astr, len+1);
- for(a=0; a<len; a++) {
- if( str[a]== '[' ) {
+ for (a=0; a<len; a++) {
+ if ( str[a]== '[' ) {
cp= &(str[a+1]);
}
- else if( str[a]==']' && cp) {
+ else if ( str[a]==']' && cp) {
str[a]= 0;
/* if 'cp' is a preprocessor definition, it will evaluate to 0,
* the caller needs to check for this case and throw an error */
@@ -712,17 +717,17 @@ static int calculate_structlens(int firststruct)
char *cp;
int has_pointer, dna_error = 0;
- while(unknown) {
+ while (unknown) {
lastunknown= unknown;
unknown= 0;
/* check all structs... */
- for(a=0; a<nr_structs; a++) {
+ for (a=0; a<nr_structs; a++) {
structpoin= structs[a];
structtype= structpoin[0];
/* when length is not known... */
- if(typelens[structtype]==0) {
+ if (typelens[structtype]==0) {
sp= structpoin+2;
len= 0;
@@ -730,17 +735,17 @@ static int calculate_structlens(int firststruct)
has_pointer = 0;
/* check all elements in struct */
- for(b=0; b<structpoin[1]; b++, sp+=2) {
+ for (b=0; b<structpoin[1]; b++, sp+=2) {
type= sp[0];
cp= names[sp[1]];
namelen= (int) strlen(cp);
/* is it a pointer or function pointer? */
- if(cp[0]=='*' || cp[1]=='*') {
+ if (cp[0]=='*' || cp[1]=='*') {
has_pointer = 1;
/* has the name an extra length? (array) */
mul= 1;
- if( cp[namelen-1]==']') mul= arraysize(cp, namelen);
+ if ( cp[namelen-1]==']') mul= arraysize(cp, namelen);
if (mul == 0) {
printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp);
@@ -748,12 +753,13 @@ static int calculate_structlens(int firststruct)
}
/* 4-8 aligned/ */
- if(sizeof(void *) == 4) {
+ if (sizeof(void *) == 4) {
if (len % 4) {
printf("Align pointer error in struct (len4): %s %s\n", types[structtype], cp);
dna_error = 1;
}
- } else {
+ }
+ else {
if (len % 8) {
printf("Align pointer error in struct (len8): %s %s\n", types[structtype], cp);
dna_error = 1;
@@ -768,14 +774,16 @@ static int calculate_structlens(int firststruct)
len += sizeof(void *) * mul;
alphalen += 8 * mul;
- } else if(cp[0]=='[') {
+ }
+ else if (cp[0]=='[') {
/* parsing can cause names "var" and "[3]" to be found for "float var [3]" ... */
printf("Parse error in struct, invalid member name: %s %s\n", types[structtype], cp);
dna_error = 1;
- } else if( typelens[type] ) {
+ }
+ else if ( typelens[type] ) {
/* has the name an extra length? (array) */
mul= 1;
- if( cp[namelen-1]==']') mul= arraysize(cp, namelen);
+ if ( cp[namelen-1]==']') mul= arraysize(cp, namelen);
if (mul == 0) {
printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp);
@@ -783,19 +791,19 @@ static int calculate_structlens(int firststruct)
}
/* struct alignment */
- if(type >= firststruct) {
- if(sizeof(void *)==8 && (len % 8) ) {
+ if (type >= firststruct) {
+ if (sizeof(void *)==8 && (len % 8) ) {
printf("Align struct error: %s %s\n", types[structtype],cp);
dna_error = 1;
}
}
/* 2-4 aligned/ */
- if(typelens[type]>3 && (len % 4) ) {
+ if (typelens[type]>3 && (len % 4) ) {
printf("Align 4 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len%4);
dna_error = 1;
}
- else if(typelens[type]==2 && (len % 2) ) {
+ else if (typelens[type]==2 && (len % 2) ) {
printf("Align 2 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len%2);
dna_error = 1;
}
@@ -803,7 +811,8 @@ static int calculate_structlens(int firststruct)
len += mul*typelens[type];
alphalen += mul * alphalens[type];
- } else {
+ }
+ else {
len= 0;
alphalen = 0;
break;
@@ -812,7 +821,8 @@ static int calculate_structlens(int firststruct)
if (len==0) {
unknown++;
- } else {
+ }
+ else {
typelens[structtype]= len;
alphalens[structtype]= alphalen;
// two ways to detect if a struct contains a pointer:
@@ -824,7 +834,7 @@ static int calculate_structlens(int firststruct)
}
}
- if(len % 4) {
+ if (len % 4) {
printf("Sizeerror 4 in struct: %s (add %d bytes)\n", types[structtype], len%4);
dna_error = 1;
}
@@ -833,21 +843,21 @@ static int calculate_structlens(int firststruct)
}
}
- if(unknown==lastunknown) break;
+ if (unknown==lastunknown) break;
}
- if(unknown) {
+ if (unknown) {
printf("ERROR: still %d structs unknown\n", unknown);
if (debugSDNA) {
printf("*** Known structs : \n");
- for(a=0; a<nr_structs; a++) {
+ for (a=0; a<nr_structs; a++) {
structpoin= structs[a];
structtype= structpoin[0];
/* length unknown */
- if(typelens[structtype]!=0) {
+ if (typelens[structtype]!=0) {
printf(" %s\n", types[structtype]);
}
}
@@ -856,12 +866,12 @@ static int calculate_structlens(int firststruct)
printf("*** Unknown structs : \n");
- for(a=0; a<nr_structs; a++) {
+ for (a=0; a<nr_structs; a++) {
structpoin= structs[a];
structtype= structpoin[0];
/* length unknown yet */
- if(typelens[structtype]==0) {
+ if (typelens[structtype]==0) {
printf(" %s\n", types[structtype]);
}
}
@@ -898,12 +908,12 @@ void printStructLenghts(void)
short *structpoin;
printf("\n\n*** All detected structs:\n");
- while(unknown) {
+ while (unknown) {
/*lastunknown= unknown;*/ /*UNUSED*/
unknown= 0;
/* check all structs... */
- for(a=0; a<nr_structs; a++) {
+ for (a=0; a<nr_structs; a++) {
structpoin= structs[a];
structtype= structpoin[0];
printf("\t%s\t:%d\n", types[structtype], typelens[structtype]);
@@ -986,24 +996,24 @@ static int make_structDNA(char *baseDirectory, FILE *file)
short num_types;
printf("nr_names %d nr_types %d nr_structs %d\n", nr_names, nr_types, nr_structs);
- for(a=0; a<nr_names; a++) {
+ for (a=0; a<nr_names; a++) {
printf(" %s \n", names[a]);
}
printf("\n");
sp= typelens;
- for(a=0; a<nr_types; a++, sp++) {
+ for (a=0; a<nr_types; a++, sp++) {
printf(" %s %d\n", types[a], *sp);
}
printf("\n");
- for(a=0; a<nr_structs; a++) {
+ for (a=0; a<nr_structs; a++) {
sp= structs[a];
printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1],typelens[sp[0]]);
num_types = sp[1];
sp+= 2;
/* ? num_types was elem? */
- for(b=0; b< num_types; b++, sp+= 2) {
+ for (b=0; b< num_types; b++, sp+= 2) {
printf(" %s %s\n", types[sp[0]], names[sp[1]]);
}
}
@@ -1013,7 +1023,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
if (debugSDNA > -1) printf("Writing file ... ");
- if(nr_names==0 || nr_structs==0);
+ if (nr_names==0 || nr_structs==0);
else {
strcpy(str, "SDNA");
dna_write(file, str, 4);
@@ -1050,7 +1060,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
dna_write(file, str, 4);
len= 2*nr_types;
- if(nr_types & 1) len+= 2;
+ if (nr_types & 1) len+= 2;
dna_write(file, typelens, len);
/* WRITE STRUCTS */
@@ -1073,7 +1083,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
int a;
fp= fopen("padding.c", "w");
- if(fp==NULL);
+ if (fp==NULL);
else {
// add all include files defined in the global array
@@ -1081,11 +1091,11 @@ static int make_structDNA(char *baseDirectory, FILE *file)
fprintf(fp, "#include \"%s%s\"\n", baseDirectory, includefiles[i]);
}
- fprintf(fp, "main(){\n");
+ fprintf(fp, "main() {\n");
sp = typelens;
sp += firststruct;
- for(a=firststruct; a<nr_types; a++, sp++) {
- if(*sp) {
+ for (a=firststruct; a<nr_types; a++, sp++) {
+ if (*sp) {
fprintf(fp, "\tif(sizeof(struct %s) - %d) printf(\"ALIGN ERROR:", types[a], *sp);
fprintf(fp, "%%d %s %d ", types[a], *sp);
fprintf(fp, "\\n\", sizeof(struct %s) - %d);\n", types[a], *sp);
@@ -1134,17 +1144,20 @@ int main(int argc, char ** argv)
if (argc!=2 && argc!=3) {
printf("Usage: %s outfile.c [base directory]\n", argv[0]);
return_status = 1;
- } else {
+ }
+ else {
file = fopen(argv[1], "w");
if (!file) {
printf ("Unable to open file: %s\n", argv[1]);
return_status = 1;
- } else {
+ }
+ else {
char baseDirectory[256];
if (argc==3) {
strcpy(baseDirectory, argv[2]);
- } else {
+ }
+ else {
strcpy(baseDirectory, BASE_HEADER);
}
@@ -1154,7 +1167,8 @@ int main(int argc, char ** argv)
fclose(file);
make_bad_file(argv[1], __LINE__);
return_status = 1;
- } else {
+ }
+ else {
fprintf(file, "};\n");
fprintf(file, "int DNAlen= sizeof(DNAstr);\n");
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index de84deea3fa..d3a710c4cf4 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -346,8 +346,8 @@ extern StructRNA RNA_MeshColorLayer;
extern StructRNA RNA_MeshLoopColorLayer;
extern StructRNA RNA_MeshDeformModifier;
extern StructRNA RNA_MeshEdge;
-extern StructRNA RNA_MeshFace;
extern StructRNA RNA_MeshPolygon;
+extern StructRNA RNA_MeshTessFace;
extern StructRNA RNA_MeshLoop;
extern StructRNA RNA_MeshFloatProperty;
extern StructRNA RNA_MeshFloatPropertyLayer;
@@ -371,6 +371,7 @@ extern StructRNA RNA_MotionPath;
extern StructRNA RNA_MotionPathVert;
extern StructRNA RNA_MouseSensor;
extern StructRNA RNA_MovieSequence;
+extern StructRNA RNA_MovieClipSequence;
extern StructRNA RNA_MovieTrackingObject;
extern StructRNA RNA_MulticamSequence;
extern StructRNA RNA_MultiresModifier;
@@ -986,6 +987,13 @@ int RNA_property_is_idprop(PropertyRNA *prop);
/* python compatible string representation of this property, (must be freed!) */
char *RNA_property_as_string(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop);
char *RNA_pointer_as_string(struct bContext *C, PointerRNA *ptr);
+char *RNA_pointer_as_string_keywords_ex(struct bContext *C, PointerRNA *ptr, PointerRNA *ptr_default,
+ const short skip_optional_value, const short all_args,
+ PropertyRNA *iterprop);
+char *RNA_pointer_as_string_keywords(struct bContext *C, PointerRNA *ptr, PointerRNA *ptr_default,
+ const short skip_optional_value, const short all_args);
+char *RNA_function_as_string_keywords(struct bContext *C, FunctionRNA *func, PointerRNA *ptr_default,
+ const short as_function, const short all_args);
/* Function */
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index d6c3422c8d4..9939d0839e6 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -66,6 +66,8 @@ void RNA_def_struct_ui_icon(StructRNA *srna, int icon);
void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext);
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna);
+void RNA_def_struct_translation_context(StructRNA *srna, const char *context);
+
/* Compact Property Definitions */
typedef void StructOrFunctionRNA;
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index e595a0e4a1b..04c6f2fa71e 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -141,5 +141,8 @@ EnumPropertyItem *RNA_image_itemf(struct bContext *C, struct PointerRNA *ptr, st
EnumPropertyItem *RNA_image_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
EnumPropertyItem *RNA_scene_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
EnumPropertyItem *RNA_scene_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_movieclip_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_movieclip_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+
#endif /* __RNA_ENUM_TYPES_H__ */
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 194a50df307..efe72c6c98b 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -75,19 +75,19 @@ static int replace_if_different(char *tmpfile, const char *dep_files[])
#define REN_IF_DIFF \
{ \
- FILE *file_test = fopen(orgfile, "rb"); \
- if (file_test) { \
+ FILE *file_test = fopen(orgfile, "rb"); \
+ if (file_test) { \
fclose(file_test); \
- if (fp_org) fclose(fp_org); \
- if (fp_new) fclose(fp_new); \
- if (remove(orgfile) != 0) { \
+ if (fp_org) fclose(fp_org); \
+ if (fp_new) fclose(fp_new); \
+ if (remove(orgfile) != 0) { \
fprintf(stderr, "%s:%d, Remove Error (%s): \"%s\"\n", \
__FILE__, __LINE__, strerror(errno), orgfile); \
return -1; \
} \
} \
} \
- if (rename(tmpfile, orgfile) != 0) { \
+ if (rename(tmpfile, orgfile) != 0) { \
fprintf(stderr, "%s:%d, Rename Error (%s): \"%s\" -> \"%s\"\n", \
__FILE__, __LINE__, strerror(errno), tmpfile, orgfile); \
return -1; \
@@ -304,7 +304,8 @@ static void rna_print_c_string(FILE *f, const char *str)
static void rna_print_data_get(FILE *f, PropertyDefRNA *dp)
{
if (dp->dnastructfromname && dp->dnastructfromprop)
- fprintf(f, " %s *data= (%s*)(((%s*)ptr->data)->%s);\n", dp->dnastructname, dp->dnastructname, dp->dnastructfromname, dp->dnastructfromprop);
+ fprintf(f, " %s *data= (%s*)(((%s*)ptr->data)->%s);\n", dp->dnastructname, dp->dnastructname,
+ dp->dnastructfromname, dp->dnastructfromprop);
else
fprintf(f, " %s *data= (%s*)(ptr->data);\n", dp->dnastructname, dp->dnastructname);
}
@@ -476,7 +477,8 @@ static void rna_int_print(FILE *f, int num)
else fprintf(f, "%d", num);
}
-static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func;
@@ -498,7 +500,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) {
if (prop->subtype != PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */
fprintf(stderr, "%s (1): %s.%s is a '%s' but wrapped as type '%s'.\n",
- __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
+ __func__, srna->identifier, prop->identifier, dp->dnatype,
+ RNA_property_typename(prop->type));
DefRNA.error = 1;
return NULL;
}
@@ -507,7 +510,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
else if (prop->type == PROP_INT || prop->type == PROP_BOOLEAN || prop->type == PROP_ENUM) {
if (IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
fprintf(stderr, "%s (2): %s.%s is a '%s' but wrapped as type '%s'.\n",
- __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
+ __func__, srna->identifier, prop->identifier, dp->dnatype,
+ RNA_property_typename(prop->type));
DefRNA.error = 1;
return NULL;
}
@@ -538,7 +542,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (sprop->maxlength)
fprintf(f, " %s(value, data->%s, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength);
else
- fprintf(f, " %s(value, data->%s, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname);
+ fprintf(f, " %s(value, data->%s, sizeof(data->%s));\n", string_copy_func,
+ dp->dnaname, dp->dnaname);
}
fprintf(f, "}\n\n");
break;
@@ -553,9 +558,11 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
rna_print_data_get(f, dp);
if (dp->dnapointerlevel == 0)
- fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n", (const char*)pprop->type, dp->dnaname);
+ fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n",
+ (const char*)pprop->type, dp->dnaname);
else
- fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n", (const char*)pprop->type, dp->dnaname);
+ fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n",
+ (const char*)pprop->type, dp->dnaname);
}
fprintf(f, "}\n\n");
break;
@@ -567,11 +574,15 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, "{\n");
if (manualfunc) {
if (strcmp(manualfunc, "rna_iterator_listbase_get") == 0 ||
- strcmp(manualfunc, "rna_iterator_array_get") == 0 ||
- strcmp(manualfunc, "rna_iterator_array_dereference_get") == 0)
- fprintf(f, " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n", (cprop->item_type)? (const char*)cprop->item_type: "UnknownType", manualfunc);
- else
+ strcmp(manualfunc, "rna_iterator_array_get") == 0 ||
+ strcmp(manualfunc, "rna_iterator_array_dereference_get") == 0)
+ {
+ fprintf(f, " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n",
+ (cprop->item_type) ? (const char *)cprop->item_type: "UnknownType", manualfunc);
+ }
+ else {
fprintf(f, " return %s(iter);\n", manualfunc);
+ }
}
fprintf(f, "}\n\n");
break;
@@ -581,7 +592,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (prop->flag & PROP_DYNAMIC)
fprintf(f, "void %s(PointerRNA *ptr, %s values[])\n", func, rna_type_type(prop));
else
- fprintf(f, "void %s(PointerRNA *ptr, %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength);
+ fprintf(f, "void %s(PointerRNA *ptr, %s values[%u])\n", func, rna_type_type(prop),
+ prop->totarraylength);
fprintf(f, "{\n");
if (manualfunc) {
@@ -591,35 +603,47 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
rna_print_data_get(f, dp);
if (prop->flag & PROP_DYNAMIC) {
- char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get_length");
+ char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier),
+ "get_length");
fprintf(f, " int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
fprintf(f, " int len= %s(ptr, arraylen);\n\n", lenfunc);
- fprintf(f, " for(i=0; i<len; i++) {\n");
+ fprintf(f, " for (i=0; i<len; i++) {\n");
MEM_freeN(lenfunc);
}
else {
fprintf(f, " int i;\n\n");
- fprintf(f, " for(i=0; i<%u; i++) {\n", prop->totarraylength);
+ fprintf(f, " for (i=0; i<%u; i++) {\n", prop->totarraylength);
}
if (dp->dnaarraylength == 1) {
- if (prop->type == PROP_BOOLEAN && dp->booleanbit)
- fprintf(f, " values[i]= %s((data->%s & (%d<<i)) != 0);\n", (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
- else
- fprintf(f, " values[i]= (%s)%s((&data->%s)[i]);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+ if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
+ fprintf(f, " values[i]= %s((data->%s & (%d<<i)) != 0);\n",
+ (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
+ }
+ else {
+ fprintf(f, " values[i]= (%s)%s((&data->%s)[i]);\n",
+ rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+ }
}
else {
if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " values[i]= %s((data->%s[i] & ", (dp->booleannegative)? "!": "", dp->dnaname);
+ fprintf(f, " values[i]= %s((data->%s[i] & ", (dp->booleannegative)? "!": "",
+ dp->dnaname);
rna_int_print(f, dp->booleanbit);
fprintf(f, ") != 0);\n");
}
- else if (rna_color_quantize(prop, dp))
- fprintf(f, " values[i]= (%s)(data->%s[i]*(1.0f/255.0f));\n", rna_type_type(prop), dp->dnaname);
- else if (dp->dnatype)
- fprintf(f, " values[i]= (%s)%s(((%s*)data->%s)[i]);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnatype, dp->dnaname);
- else
- fprintf(f, " values[i]= (%s)%s((data->%s)[i]);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+ else if (rna_color_quantize(prop, dp)) {
+ fprintf(f, " values[i]= (%s)(data->%s[i]*(1.0f/255.0f));\n",
+ rna_type_type(prop), dp->dnaname);
+ }
+ else if (dp->dnatype) {
+ fprintf(f, " values[i]= (%s)%s(((%s*)data->%s)[i]);\n",
+ rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnatype, dp->dnaname);
+ }
+ else {
+ fprintf(f, " values[i]= (%s)%s((data->%s)[i]);\n",
+ rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+ }
}
fprintf(f, " }\n");
}
@@ -645,7 +669,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, ");\n");
}
else
- fprintf(f, " return (%s)%s(data->%s);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+ fprintf(f, " return (%s)%s(data->%s);\n", rna_type_type(prop),
+ (dp->booleannegative)? "!": "", dp->dnaname);
}
fprintf(f, "}\n\n");
@@ -716,7 +741,8 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
fprintf(f, "value;\n");
}
-static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func;
@@ -758,7 +784,8 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (sprop->maxlength)
fprintf(f, " %s(data->%s, value, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength);
else
- fprintf(f, " %s(data->%s, value, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname);
+ fprintf(f, " %s(data->%s, value, sizeof(data->%s));\n", string_copy_func,
+ dp->dnaname, dp->dnaname);
}
fprintf(f, "}\n\n");
break;
@@ -774,20 +801,20 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (prop->flag & PROP_ID_SELF_CHECK) {
rna_print_id_get(f, dp);
- fprintf(f, " if(id==value.data) return;\n\n");
+ fprintf(f, " if (id==value.data) return;\n\n");
}
if (prop->flag & PROP_ID_REFCOUNT) {
- fprintf(f, "\n if(data->%s)\n", dp->dnaname);
+ fprintf(f, "\n if (data->%s)\n", dp->dnaname);
fprintf(f, " id_us_min((ID*)data->%s);\n", dp->dnaname);
- fprintf(f, " if(value.data)\n");
+ fprintf(f, " if (value.data)\n");
fprintf(f, " id_us_plus((ID*)value.data);\n\n");
}
else {
PointerPropertyRNA *pprop = (PointerPropertyRNA*)dp->prop;
StructRNA *type = rna_find_struct((const char*)pprop->type);
if (type && (type->flag & STRUCT_ID)) {
- fprintf(f, " if(value.data)\n");
+ fprintf(f, " if (value.data)\n");
fprintf(f, " id_lib_extern((ID*)value.data);\n\n");
}
}
@@ -803,7 +830,8 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (prop->flag & PROP_DYNAMIC)
fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop));
else
- fprintf(f, "void %s(PointerRNA *ptr, const %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength);
+ fprintf(f, "void %s(PointerRNA *ptr, const %s values[%u])\n", func,
+ rna_type_type(prop), prop->totarraylength);
fprintf(f, "{\n");
if (manualfunc) {
@@ -813,32 +841,35 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
rna_print_data_get(f, dp);
if (prop->flag & PROP_DYNAMIC) {
- char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set_length");
+ char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier),
+ "set_length");
fprintf(f, " int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
fprintf(f, " int len= %s(ptr, arraylen);\n\n", lenfunc);
rna_clamp_value_range(f, prop);
- fprintf(f, " for(i=0; i<len; i++) {\n");
+ fprintf(f, " for (i=0; i<len; i++) {\n");
MEM_freeN(lenfunc);
}
else {
fprintf(f, " int i;\n\n");
rna_clamp_value_range(f, prop);
- fprintf(f, " for(i=0; i<%u; i++) {\n", prop->totarraylength);
+ fprintf(f, " for (i=0; i<%u; i++) {\n", prop->totarraylength);
}
if (dp->dnaarraylength == 1) {
if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " if(%svalues[i]) data->%s |= (%d<<i);\n", (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
+ fprintf(f, " if (%svalues[i]) data->%s |= (%d<<i);\n",
+ (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
fprintf(f, " else data->%s &= ~(%d<<i);\n", dp->dnaname, dp->booleanbit);
}
else {
- fprintf(f, " (&data->%s)[i]= %s", dp->dnaname, (dp->booleannegative)? "!": "");
+ fprintf(f, " (&data->%s)[i]= %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
rna_clamp_value(f, prop, 1);
}
}
else {
if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " if(%svalues[i]) data->%s[i] |= ", (dp->booleannegative)? "!": "", dp->dnaname);
+ fprintf(f, " if (%svalues[i]) data->%s[i] |= ", (dp->booleannegative) ? "!" : "",
+ dp->dnaname);
rna_int_print(f, dp->booleanbit);
fprintf(f, ";\n");
fprintf(f, " else data->%s[i] &= ~", dp->dnaname);
@@ -850,9 +881,10 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
}
else {
if (dp->dnatype)
- fprintf(f, " ((%s*)data->%s)[i]= %s", dp->dnatype, dp->dnaname, (dp->booleannegative)? "!": "");
+ fprintf(f, " ((%s*)data->%s)[i]= %s", dp->dnatype, dp->dnaname,
+ (dp->booleannegative) ? "!" : "");
else
- fprintf(f, " (data->%s)[i]= %s", dp->dnaname, (dp->booleannegative)? "!": "");
+ fprintf(f, " (data->%s)[i]= %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
rna_clamp_value(f, prop, 1);
}
}
@@ -870,7 +902,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
else {
rna_print_data_get(f, dp);
if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " if(%svalue) data->%s |= ", (dp->booleannegative)? "!": "", dp->dnaname);
+ fprintf(f, " if (%svalue) data->%s |= ", (dp->booleannegative) ? "!" : "", dp->dnaname);
rna_int_print(f, dp->booleanbit);
fprintf(f, ";\n");
fprintf(f, " else data->%s &= ~", dp->dnaname);
@@ -885,7 +917,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
}
else {
rna_clamp_value_range(f, prop);
- fprintf(f, " data->%s= %s", dp->dnaname, (dp->booleannegative)? "!": "");
+ fprintf(f, " data->%s= %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
rna_clamp_value(f, prop, 0);
}
}
@@ -897,7 +929,8 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
return func;
}
-static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func = NULL;
@@ -957,7 +990,8 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA
return func;
}
-static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func, *getfunc;
@@ -991,9 +1025,11 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *
}
else {
if (dp->dnalengthname)
- fprintf(f, "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, 0, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthname);
+ fprintf(f, "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, 0, NULL);\n",
+ dp->dnaname, dp->dnaname, dp->dnalengthname);
else
- fprintf(f, "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, 0, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthfixed);
+ fprintf(f, "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, 0, NULL);\n",
+ dp->dnaname, dp->dnaname, dp->dnalengthfixed);
}
}
else {
@@ -1007,7 +1043,7 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *
getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
- fprintf(f, "\n if(iter->valid)\n");
+ fprintf(f, "\n if (iter->valid)\n");
fprintf(f, " iter->ptr= %s(iter);\n", getfunc);
fprintf(f, "}\n\n");
@@ -1016,7 +1052,8 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *
return func;
}
-static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc, const char *nextfunc)
+static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc, const char *nextfunc)
{
/* note on indices, this is for external functions and ignores skipped values.
* so the the index can only be checked against the length when there is no 'skip' funcion. */
@@ -1050,19 +1087,19 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
fprintf(f, " CollectionPropertyIterator iter;\n\n");
fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
- fprintf(f, " if(iter.valid){\n");
+ fprintf(f, " if (iter.valid) {\n");
if (strcmp(nextfunc, "rna_iterator_array_next") == 0) {
fprintf(f, " ArrayIterator *internal= iter.internal;\n");
- fprintf(f, " if(index < 0 || index >= internal->length) {\n");
+ fprintf(f, " if (index < 0 || index >= internal->length) {\n");
fprintf(f, "#ifdef __GNUC__\n");
fprintf(f, " printf(\"Array iterator out of range: %%s (index %%d)\\n\", __func__, index);\n");
fprintf(f, "#else\n");
fprintf(f, " printf(\"Array iterator out of range: (index %%d)\\n\", index);\n");
fprintf(f, "#endif\n");
fprintf(f, " }\n");
- fprintf(f, " else if(internal->skip) {\n");
- fprintf(f, " while(index-- > 0 && iter.valid) {\n");
+ fprintf(f, " else if (internal->skip) {\n");
+ fprintf(f, " while (index-- > 0 && iter.valid) {\n");
fprintf(f, " rna_iterator_array_next(&iter);\n");
fprintf(f, " }\n");
fprintf(f, " found= (index == -1 && iter.valid);\n");
@@ -1074,20 +1111,20 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
}
else if (strcmp(nextfunc, "rna_iterator_listbase_next") == 0) {
fprintf(f, " ListBaseIterator *internal= iter.internal;\n");
- fprintf(f, " if(internal->skip) {\n");
- fprintf(f, " while(index-- > 0 && iter.valid) {\n");
+ fprintf(f, " if (internal->skip) {\n");
+ fprintf(f, " while (index-- > 0 && iter.valid) {\n");
fprintf(f, " rna_iterator_listbase_next(&iter);\n");
fprintf(f, " }\n");
fprintf(f, " found= (index == -1 && iter.valid);\n");
fprintf(f, " }\n");
fprintf(f, " else {\n");
- fprintf(f, " while(index-- > 0 && internal->link)\n");
+ fprintf(f, " while (index-- > 0 && internal->link)\n");
fprintf(f, " internal->link= internal->link->next;\n");
fprintf(f, " found= (index == -1 && internal->link);\n");
fprintf(f, " }\n");
}
- fprintf(f, " if(found) *r_ptr = %s_%s_get(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, " if (found) *r_ptr = %s_%s_get(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
fprintf(f, " }\n\n");
fprintf(f, " %s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier));
@@ -1099,13 +1136,16 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
if (dp->dnalengthname || dp->dnalengthfixed) {
if (dp->dnalengthname)
- fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), data->%s, index);\n", item_type, dp->dnaname, dp->dnaname, dp->dnalengthname);
+ fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), data->%s, index);\n",
+ item_type, dp->dnaname, dp->dnaname, dp->dnalengthname);
else
- fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), %d, index);\n", item_type, dp->dnaname, dp->dnaname, dp->dnalengthfixed);
+ fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), %d, index);\n",
+ item_type, dp->dnaname, dp->dnaname, dp->dnalengthfixed);
}
else {
if (dp->dnapointerlevel == 0)
- fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, &data->%s, index);\n", item_type, dp->dnaname);
+ fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, &data->%s, index);\n",
+ item_type, dp->dnaname);
else
fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, data->%s, index);\n", item_type, dp->dnaname);
}
@@ -1116,7 +1156,8 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
return func;
}
-static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func, *getfunc;
@@ -1134,7 +1175,7 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p
getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
- fprintf(f, "\n if(iter->valid)\n");
+ fprintf(f, "\n if (iter->valid)\n");
fprintf(f, " iter->ptr= %s(iter);\n", getfunc);
fprintf(f, "}\n\n");
@@ -1142,7 +1183,8 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p
return func;
}
-static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func;
@@ -1303,7 +1345,8 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
cprop->begin = (void*)rna_def_property_begin_func(f, srna, prop, dp, (const char*)cprop->begin);
cprop->next = (void*)rna_def_property_next_func(f, srna, prop, dp, (const char*)cprop->next);
cprop->end = (void*)rna_def_property_end_func(f, srna, prop, dp, (const char*)cprop->end);
- cprop->lookupint = (void*)rna_def_property_lookup_int_func(f, srna, prop, dp, (const char*)cprop->lookupint, nextfunc);
+ cprop->lookupint = (void*)rna_def_property_lookup_int_func(f, srna, prop, dp,
+ (const char*)cprop->lookupint, nextfunc);
if (!(prop->flag & PROP_IDPROPERTY)) {
if (!cprop->begin) {
@@ -1385,7 +1428,8 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
for (i = 0; i<eprop->totitem; i++)
if (eprop->item[i].identifier[0])
- fprintf(f, "\t%s_%s_%s = %d,\n", srna->identifier, prop->identifier, eprop->item[i].identifier, eprop->item[i].value);
+ fprintf(f, "\t%s_%s_%s = %d,\n", srna->identifier, prop->identifier,
+ eprop->item[i].identifier, eprop->item[i].value);
fprintf(f, "};\n\n");
}
@@ -1474,7 +1518,8 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
for (i = 0; i<eprop->totitem; i++)
if (eprop->item[i].identifier[0])
- fprintf(f, "\t\t%s_%s = %d,\n", rna_safe_id(prop->identifier), eprop->item[i].identifier, eprop->item[i].value);
+ fprintf(f, "\t\t%s_%s = %d,\n", rna_safe_id(prop->identifier), eprop->item[i].identifier,
+ eprop->item[i].value);
fprintf(f, "\t};\n");
}
@@ -1499,9 +1544,11 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)dp->prop;
if (cprop->item_type)
- fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->item_type, srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->item_type, srna->identifier,
+ rna_safe_id(prop->identifier));
else
- fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier,
+ rna_safe_id(prop->identifier));
break;
}
}
@@ -1523,25 +1570,29 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
if (!prop->arraydimension)
fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
else if (prop->totarraylength)
- fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+ fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
+ rna_safe_id(prop->identifier));
break;
}
case PROP_INT: {
if (!prop->arraydimension)
fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
else if (prop->totarraylength)
- fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+ fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
+ rna_safe_id(prop->identifier));
break;
}
case PROP_FLOAT: {
if (!prop->arraydimension)
fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
else if (prop->totarraylength)
- fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+ fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
+ rna_safe_id(prop->identifier));
break;
}
case PROP_ENUM: {
- fprintf(f, "\tENUM_PROPERTY(%s_enum, %s, %s)", rna_safe_id(prop->identifier), srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, "\tENUM_PROPERTY(%s_enum, %s, %s)", rna_safe_id(prop->identifier), srna->identifier,
+ rna_safe_id(prop->identifier));
break;
}
@@ -1553,17 +1604,20 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
PointerPropertyRNA *pprop = (PointerPropertyRNA*)dp->prop;
if (pprop->type)
- fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (const char*)pprop->type, srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (const char*)pprop->type, srna->identifier,
+ rna_safe_id(prop->identifier));
else
- fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier,
+ rna_safe_id(prop->identifier));
break;
}
case PROP_COLLECTION: {
#if 0
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop;
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)dp->prop;
- if(cprop->type)
- fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->type, srna->identifier, prop->identifier);
+ if (cprop->type)
+ fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->type, srna->identifier,
+ prop->identifier);
else
fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, prop->identifier);
#endif
@@ -1623,7 +1677,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
/* fixed size arrays and RNA pointers are pre-allocated on the ParameterList stack, pass a pointer to it */
else if (type == PROP_POINTER || dparm->prop->arraydimension)
ptrstr = "*";
- /* PROP_THICK_WRAP strings are pre-allocated on the ParameterList stack, but type name for string props is already char*, so leave empty */
+ /* PROP_THICK_WRAP strings are pre-allocated on the ParameterList stack,
+ * but type name for string props is already char*, so leave empty */
else if (type == PROP_STRING && (flag & PROP_THICK_WRAP))
ptrstr = "";
else
@@ -1633,7 +1688,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
if (flag & PROP_DYNAMIC)
fprintf(f, "\tint %s%s_len;\n", pout ? "*" : "", dparm->prop->identifier);
- fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
+ fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
+ ptrstr, dparm->prop->identifier);
}
if (has_data) {
@@ -1685,7 +1741,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
valstr = "*";
}
- /* this must be kept in sync with RNA_parameter_length_get_data, we could just call the function directly, but this is faster */
+ /* this must be kept in sync with RNA_parameter_length_get_data,
+ * we could just call the function directly, but this is faster */
if (flag & PROP_DYNAMIC) {
fprintf(f, "\t%s_len= %s((int *)_data);\n", dparm->prop->identifier, pout ? "" : "*");
data_str = "(&(((char *)_data)[sizeof(void *)]))";
@@ -1698,7 +1755,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
if (!pout)
fprintf(f, "%s", valstr);
- fprintf(f, "((%s%s%s)%s);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, data_str);
+ fprintf(f, "((%s%s%s)%s);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
+ ptrstr, data_str);
}
if (dparm->next)
@@ -1760,8 +1818,10 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
if (func->c_ret) {
dparm = rna_find_parameter_def(func->c_ret);
- ptrstr = (((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag & PROP_RNAPTR)) || (dparm->prop->arraydimension))? "*": "";
- fprintf(f, "\t*((%s%s%s*)_retdata)= %s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, func->c_ret->identifier);
+ ptrstr = (((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag & PROP_RNAPTR)) ||
+ (dparm->prop->arraydimension)) ? "*" : "";
+ fprintf(f, "\t*((%s%s%s*)_retdata)= %s;\n", rna_type_struct(dparm->prop),
+ rna_parameter_type_name(dparm->prop), ptrstr, func->c_ret->identifier);
}
}
@@ -1868,7 +1928,7 @@ static const char *rna_property_subtypename(PropertySubType type)
case PROP_LAYER: return "PROP_LAYER";
case PROP_LAYER_MEMBER: return "PROP_LAYER_MEMBER";
default: {
- /* in case we dont have a type preset that includes the subtype */
+ /* in case we don't have a type preset that includes the subtype */
if (RNA_SUBTYPE_UNIT(type)) {
return rna_property_subtypename(type & ~RNA_SUBTYPE_UNIT(type));
}
@@ -1930,7 +1990,8 @@ static void rna_generate_property_prototypes(BlenderRNA *brna, StructRNA *srna,
while (base) {
fprintf(f, "\n");
for (prop = base->cont.properties.first; prop; prop = prop->next)
- fprintf(f, "%s%s rna_%s_%s;\n", "extern ", rna_property_structname(prop->type), base->identifier, prop->identifier);
+ fprintf(f, "%s%s rna_%s_%s;\n", "extern ", rna_property_structname(prop->type),
+ base->identifier, prop->identifier);
base = base->base;
}
@@ -1938,7 +1999,8 @@ static void rna_generate_property_prototypes(BlenderRNA *brna, StructRNA *srna,
fprintf(f, "\n");
for (prop = srna->cont.properties.first; prop; prop = prop->next)
- fprintf(f, "%s%s rna_%s_%s;\n", (prop->flag & PROP_EXPORT)? "": "", rna_property_structname(prop->type), srna->identifier, prop->identifier);
+ fprintf(f, "%s%s rna_%s_%s;\n", (prop->flag & PROP_EXPORT)? "": "", rna_property_structname(prop->type),
+ srna->identifier, prop->identifier);
fprintf(f, "\n");
}
@@ -1947,7 +2009,8 @@ static void rna_generate_parameter_prototypes(BlenderRNA *brna, StructRNA *srna,
PropertyRNA *parm;
for (parm = func->cont.properties.first; parm; parm = parm->next)
- fprintf(f, "%s%s rna_%s_%s_%s;\n", "extern ", rna_property_structname(parm->type), srna->identifier, func->identifier, parm->identifier);
+ fprintf(f, "%s%s rna_%s_%s_%s;\n", "extern ", rna_property_structname(parm->type), srna->identifier,
+ func->identifier, parm->identifier);
if (func->cont.properties.first)
fprintf(f, "\n");
@@ -2018,7 +2081,7 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
/* self, context and reports parameters */
if (func->flag & FUNC_USE_SELF_ID) {
fprintf(f, "struct ID *_selfid");
- first = 0;
+ first = 0;
}
if ((func->flag & FUNC_NO_SELF) == 0) {
@@ -2072,9 +2135,11 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier);
if (!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension)
- fprintf(f, "%s%s %s[%u]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->totarraylength);
+ fprintf(f, "%s%s %s[%u]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
+ dparm->prop->identifier, dparm->prop->totarraylength);
else
- fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
+ fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
+ ptrstr, dparm->prop->identifier);
}
@@ -2103,7 +2168,7 @@ static void rna_generate_static_function_prototypes(BlenderRNA *brna, StructRNA
fprintf(f, "\n");
}
-static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, PropertyRNA *prop)
+static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, PropertyRNA *prop)
{
char *strnest = "", *errnest = "";
int len, freenest = 0;
@@ -2126,7 +2191,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
int i, defaultfound = 0, totflag = 0;
if (eprop->item) {
- fprintf(f, "static EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t", srna->identifier, strnest, prop->identifier, eprop->totitem+1);
+ fprintf(f, "static EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t", srna->identifier,
+ strnest, prop->identifier, eprop->totitem+1);
for (i = 0; i<eprop->totitem; i++) {
fprintf(f, "{%d, ", eprop->item[i].value);
@@ -2152,7 +2218,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
if (prop->flag & PROP_ENUM_FLAG) {
if (eprop->defaultvalue & ~totflag) {
fprintf(stderr, "%s: %s%s.%s, enum default includes unused bits (%d).\n",
- __func__, srna->identifier, errnest, prop->identifier, eprop->defaultvalue & ~totflag);
+ __func__, srna->identifier, errnest, prop->identifier,
+ eprop->defaultvalue & ~totflag);
DefRNA.error = 1;
}
}
@@ -2176,7 +2243,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
unsigned int i;
if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+ fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
+ prop->identifier, prop->totarraylength);
for (i = 0; i<prop->totarraylength; i++) {
if (bprop->defaultarray)
@@ -2196,7 +2264,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
unsigned int i;
if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+ fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
+ prop->identifier, prop->totarraylength);
for (i = 0; i<prop->totarraylength; i++) {
if (iprop->defaultarray)
@@ -2216,7 +2285,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
unsigned int i;
if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "static float rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+ fprintf(f, "static float rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
+ prop->identifier, prop->totarraylength);
for (i = 0; i<prop->totarraylength; i++) {
if (fprop->defaultarray)
@@ -2235,7 +2305,10 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
break;
}
- fprintf(f, "%s%s rna_%s%s_%s = {\n", (prop->flag & PROP_EXPORT)? "": "", rna_property_structname(prop->type), srna->identifier, strnest, prop->identifier);
+ fprintf(f, "%s%s rna_%s%s_%s = {\n",
+ (prop->flag & PROP_EXPORT) ? "": "",
+ rna_property_structname(prop->type),
+ srna->identifier, strnest, prop->identifier);
if (prop->next) fprintf(f, "\t{(PropertyRNA*)&rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier);
else fprintf(f, "\t{NULL, ");
@@ -2248,8 +2321,22 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
fprintf(f, "%d,\n", prop->icon);
rna_print_c_string(f, prop->translation_context); fprintf(f, ",\n\t");
- fprintf(f, "\t%s, %s|%s, %s, %u, {%u, %u, %u}, %u,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength);
- fprintf(f, "\t%s%s, %d, %s, %s,\n", (prop->flag & PROP_CONTEXT_UPDATE)? "(UpdateFunc)": "", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable));
+ fprintf(f, "\t%s, %s|%s, %s, %u, {%u, %u, %u}, %u,\n",
+ RNA_property_typename(prop->type),
+ rna_property_subtypename(prop->subtype),
+ rna_property_subtype_unit(prop->subtype),
+ rna_function_string(prop->getlength),
+ prop->arraydimension,
+ prop->arraylength[0],
+ prop->arraylength[1],
+ prop->arraylength[2],
+ prop->totarraylength);
+ fprintf(f, "\t%s%s, %d, %s, %s,\n",
+ (prop->flag & PROP_CONTEXT_UPDATE) ? "(UpdateFunc)": "",
+ rna_function_string(prop->update),
+ prop->noteflag,
+ rna_function_string(prop->editable),
+ rna_function_string(prop->itemeditable));
if (prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop);
else fprintf(f, "\t0, -1");
@@ -2263,27 +2350,44 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
switch (prop->type) {
case PROP_BOOLEAN: {
BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
- fprintf(f, "\t%s, %s, %s, %s, %d, ", rna_function_string(bprop->get), rna_function_string(bprop->set), rna_function_string(bprop->getarray), rna_function_string(bprop->setarray), bprop->defaultvalue);
- if (prop->arraydimension && prop->totarraylength) fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
+ fprintf(f, "\t%s, %s, %s, %s, %d, ",
+ rna_function_string(bprop->get),
+ rna_function_string(bprop->set),
+ rna_function_string(bprop->getarray),
+ rna_function_string(bprop->setarray),
+ bprop->defaultvalue);
+ if (prop->arraydimension && prop->totarraylength)
+ fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
else fprintf(f, "NULL\n");
break;
}
case PROP_INT: {
IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
- fprintf(f, "\t%s, %s, %s, %s, %s,\n\t", rna_function_string(iprop->get), rna_function_string(iprop->set), rna_function_string(iprop->getarray), rna_function_string(iprop->setarray), rna_function_string(iprop->range));
+ fprintf(f, "\t%s, %s, %s, %s, %s,\n\t",
+ rna_function_string(iprop->get),
+ rna_function_string(iprop->set),
+ rna_function_string(iprop->getarray),
+ rna_function_string(iprop->setarray),
+ rna_function_string(iprop->range));
rna_int_print(f, iprop->softmin); fprintf(f, ", ");
rna_int_print(f, iprop->softmax); fprintf(f, ", ");
rna_int_print(f, iprop->hardmin); fprintf(f, ", ");
rna_int_print(f, iprop->hardmax); fprintf(f, ", ");
rna_int_print(f, iprop->step); fprintf(f, ", ");
rna_int_print(f, iprop->defaultvalue); fprintf(f, ", ");
- if (prop->arraydimension && prop->totarraylength) fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
+ if (prop->arraydimension && prop->totarraylength)
+ fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
else fprintf(f, "NULL\n");
break;
}
case PROP_FLOAT: {
FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
- fprintf(f, "\t%s, %s, %s, %s, %s, ", rna_function_string(fprop->get), rna_function_string(fprop->set), rna_function_string(fprop->getarray), rna_function_string(fprop->setarray), rna_function_string(fprop->range));
+ fprintf(f, "\t%s, %s, %s, %s, %s, ",
+ rna_function_string(fprop->get),
+ rna_function_string(fprop->set),
+ rna_function_string(fprop->getarray),
+ rna_function_string(fprop->setarray),
+ rna_function_string(fprop->range));
rna_float_print(f, fprop->softmin); fprintf(f, ", ");
rna_float_print(f, fprop->softmax); fprintf(f, ", ");
rna_float_print(f, fprop->hardmin); fprintf(f, ", ");
@@ -2291,19 +2395,27 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
rna_float_print(f, fprop->step); fprintf(f, ", ");
rna_int_print(f, (int)fprop->precision); fprintf(f, ", ");
rna_float_print(f, fprop->defaultvalue); fprintf(f, ", ");
- if (prop->arraydimension && prop->totarraylength) fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
+ if (prop->arraydimension && prop->totarraylength)
+ fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
else fprintf(f, "NULL\n");
break;
}
case PROP_STRING: {
StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
- fprintf(f, "\t%s, %s, %s, %d, ", rna_function_string(sprop->get), rna_function_string(sprop->length), rna_function_string(sprop->set), sprop->maxlength);
+ fprintf(f, "\t%s, %s, %s, %d, ",
+ rna_function_string(sprop->get),
+ rna_function_string(sprop->length),
+ rna_function_string(sprop->set),
+ sprop->maxlength);
rna_print_c_string(f, sprop->defaultvalue); fprintf(f, "\n");
break;
}
case PROP_ENUM: {
EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
- fprintf(f, "\t%s, %s, %s, NULL, ", rna_function_string(eprop->get), rna_function_string(eprop->set), rna_function_string(eprop->itemf));
+ fprintf(f, "\t%s, %s, %s, NULL, ",
+ rna_function_string(eprop->get),
+ rna_function_string(eprop->set),
+ rna_function_string(eprop->itemf));
if (eprop->item)
fprintf(f, "rna_%s%s_%s_items, ", srna->identifier, strnest, prop->identifier);
else
@@ -2313,14 +2425,25 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
}
case PROP_POINTER: {
PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
- fprintf(f, "\t%s, %s, %s, %s,", rna_function_string(pprop->get), rna_function_string(pprop->set), rna_function_string(pprop->typef), rna_function_string(pprop->poll));
+ fprintf(f, "\t%s, %s, %s, %s,", rna_function_string(pprop->get),
+ rna_function_string(pprop->set),
+ rna_function_string(pprop->typef),
+ rna_function_string(pprop->poll));
if (pprop->type) fprintf(f, "&RNA_%s\n", (const char*)pprop->type);
else fprintf(f, "NULL\n");
break;
}
case PROP_COLLECTION: {
CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
- fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, ", rna_function_string(cprop->begin), rna_function_string(cprop->next), rna_function_string(cprop->end), rna_function_string(cprop->get), rna_function_string(cprop->length), rna_function_string(cprop->lookupint), rna_function_string(cprop->lookupstring), rna_function_string(cprop->assignint));
+ fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, ",
+ rna_function_string(cprop->begin),
+ rna_function_string(cprop->next),
+ rna_function_string(cprop->end),
+ rna_function_string(cprop->get),
+ rna_function_string(cprop->length),
+ rna_function_string(cprop->lookupint),
+ rna_function_string(cprop->lookupstring),
+ rna_function_string(cprop->assignint));
if (cprop->item_type) fprintf(f, "&RNA_%s\n", (const char*)cprop->item_type);
else fprintf(f, "NULL\n");
break;
@@ -2353,10 +2476,16 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
fprintf(f, "%s%s rna_%s_%s_func = {\n", "", "FunctionRNA", srna->identifier, func->identifier);
- if (func->cont.next) fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier, ((FunctionRNA*)func->cont.next)->identifier);
- else fprintf(f, "\t{NULL, ");
- if (func->cont.prev) fprintf(f, "(FunctionRNA*)&rna_%s_%s_func,\n", srna->identifier, ((FunctionRNA*)func->cont.prev)->identifier);
- else fprintf(f, "NULL,\n");
+ if (func->cont.next)
+ fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier,
+ ((FunctionRNA*)func->cont.next)->identifier);
+ else
+ fprintf(f, "\t{NULL, ");
+ if (func->cont.prev)
+ fprintf(f, "(FunctionRNA*)&rna_%s_%s_func,\n", srna->identifier,
+ ((FunctionRNA*)func->cont.prev)->identifier);
+ else
+ fprintf(f, "NULL,\n");
fprintf(f, "\tNULL,\n");
@@ -2377,8 +2506,10 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
if (dfunc->gencall) fprintf(f, "\t%s,\n", dfunc->gencall);
else fprintf(f, "\tNULL,\n");
- if (func->c_ret) fprintf(f, "\t(PropertyRNA*)&rna_%s_%s_%s\n", srna->identifier, func->identifier, func->c_ret->identifier);
- else fprintf(f, "\tNULL\n");
+ if (func->c_ret)
+ fprintf(f, "\t(PropertyRNA*)&rna_%s_%s_%s\n", srna->identifier, func->identifier, func->c_ret->identifier);
+ else
+ fprintf(f, "\tNULL\n");
fprintf(f, "};\n");
fprintf(f, "\n");
@@ -2407,6 +2538,8 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
rna_print_c_string(f, srna->name);
fprintf(f, ", ");
rna_print_c_string(f, srna->description);
+ fprintf(f, ", ");
+ rna_print_c_string(f, srna->translation_context);
fprintf(f, ",\n\t%d,\n", srna->icon);
prop = srna->nameproperty;
@@ -2521,7 +2654,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_userdef.c", NULL, RNA_def_userdef},
{"rna_vfont.c", NULL, RNA_def_vfont},
{"rna_wm.c", "rna_wm_api.c", RNA_def_wm},
- {"rna_world.c", NULL, RNA_def_world},
+ {"rna_world.c", NULL, RNA_def_world},
{"rna_movieclip.c", NULL, RNA_def_movieclip},
{"rna_tracking.c", NULL, RNA_def_tracking},
{NULL, NULL}};
@@ -2622,7 +2755,8 @@ static void rna_generate_header(BlenderRNA *brna, FILE *f)
fprintf(f, "#define FOREACH_BEGIN(property, sptr, itemptr) \\\n");
fprintf(f, " { \\\n");
fprintf(f, " CollectionPropertyIterator rna_macro_iter; \\\n");
- fprintf(f, " for(property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; property##_next(&rna_macro_iter)) { \\\n");
+ fprintf(f, " for (property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; "
+ "property##_next(&rna_macro_iter)) { \\\n");
fprintf(f, " itemptr= rna_macro_iter.ptr;\n\n");
fprintf(f, "#define FOREACH_END(property) \\\n");
@@ -2715,7 +2849,8 @@ static const char *cpp_classes = ""
"\n"
" Array() {}\n"
" Array(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T)*Tsize); }\n"
-" const Array<T, Tsize>& operator=(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T)*Tsize); return *this; }\n"
+" const Array<T, Tsize>& operator=(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T)*Tsize); "
+"return *this; }\n"
"\n"
" operator T*() { return data; }\n"
"};\n"
@@ -2728,7 +2863,7 @@ static const char *cpp_classes = ""
"class CollectionIterator {\n"
"public:\n"
" CollectionIterator() : t(iter.ptr), init(false) { iter.valid= false; }\n"
-" ~CollectionIterator(void) { if(init) Tend(&iter); };\n"
+" ~CollectionIterator(void) { if (init) Tend(&iter); };\n"
"\n"
" operator bool(void)\n"
" { return iter.valid != 0; }\n"
@@ -2736,14 +2871,17 @@ static const char *cpp_classes = ""
"\n"
" T& operator*(void) { return t; }\n"
" T* operator->(void) { return &t; }\n"
-" bool operator==(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) { return iter.valid == other.iter.valid; }\n"
-" bool operator!=(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) { return iter.valid != other.iter.valid; }\n"
+" bool operator==(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
+"{ return iter.valid == other.iter.valid; }\n"
+" bool operator!=(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
+"{ return iter.valid != other.iter.valid; }\n"
"\n"
" void begin(const Pointer& ptr)\n"
-" { if(init) Tend(&iter); Tbegin(&iter, (PointerRNA*)&ptr.ptr); t = T(iter.ptr); init = true; }\n"
+" { if (init) Tend(&iter); Tbegin(&iter, (PointerRNA*)&ptr.ptr); t = T(iter.ptr); init = true; }\n"
"\n"
"private:\n"
-" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator=(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy) {}\n"
+" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator="
+"(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy) {}\n"
""
" CollectionPropertyIterator iter;\n"
" T t;\n"
@@ -2797,7 +2935,8 @@ static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f)
fprintf(f, "class %s : public %s {\n", srna->identifier, (srna->base)? srna->base->identifier: "Pointer");
fprintf(f, "public:\n");
- fprintf(f, "\t%s(const PointerRNA& ptr) :\n\t\t%s(ptr)", srna->identifier, (srna->base)? srna->base->identifier: "Pointer");
+ fprintf(f, "\t%s(const PointerRNA& ptr) :\n\t\t%s(ptr)", srna->identifier,
+ (srna->base)? srna->base->identifier: "Pointer");
for (dp = ds->cont.properties.first; dp; dp = dp->next)
if (!(dp->prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN)))
if (dp->prop->type == PROP_COLLECTION)
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 41775978026..1669972320d 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -40,7 +40,7 @@
#include "rna_internal.h"
-/* enum of ID-block types
+/* enum of ID-block types
* NOTE: need to keep this in line with the other defines for these
*/
EnumPropertyItem id_type_items[] = {
@@ -222,7 +222,9 @@ void rna_PropertyGroup_unregister(Main *UNUSED(bmain), StructRNA *type)
RNA_struct_free(&BLENDER_RNA, type);
}
-StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc UNUSED(call), StructFreeFunc UNUSED(free))
+StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), ReportList *reports, void *data, const char *identifier,
+ StructValidateFunc validate, StructCallbackFunc UNUSED(call),
+ StructFreeFunc UNUSED(free))
{
PointerRNA dummyptr;
@@ -238,7 +240,8 @@ StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), ReportList *reports,
* owns the string pointer which it could potentially free while blender
* is running. */
if (BLI_strnlen(identifier, MAX_IDPROP_NAME) == MAX_IDPROP_NAME) {
- BKE_reportf(reports, RPT_ERROR, "registering id property class: '%s' is too long, maximum length is " STRINGIFY(MAX_IDPROP_NAME), identifier);
+ BKE_reportf(reports, RPT_ERROR, "registering id property class: '%s' is too long, maximum length is "
+ STRINGIFY(MAX_IDPROP_NAME), identifier);
return NULL;
}
@@ -288,7 +291,7 @@ static void rna_ID_update_tag(ID *id, ReportList *reports, int flag)
/* Could add particle updates later */
#if 0
case ID_PA:
- if(flag & ~(OB_RECALC_ALL|PSYS_RECALC)) {
+ if (flag & ~(OB_RECALC_ALL|PSYS_RECALC)) {
BKE_report(reports, RPT_ERROR, "'refresh' incompatible with ParticleSettings ID type");
return;
}
@@ -305,7 +308,7 @@ static void rna_ID_update_tag(ID *id, ReportList *reports, int flag)
void rna_ID_user_clear(ID *id)
{
- id->us = 0; /* dont save */
+ id->us = 0; /* don't save */
id->flag &= ~LIB_FAKEUSER;
}
@@ -394,7 +397,8 @@ static void rna_def_ID_properties(BlenderRNA *brna)
prop = RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "PropertyGroup");
- RNA_def_property_collection_funcs(prop, "rna_IDPArray_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_IDPArray_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_IDPArray_begin", "rna_iterator_array_next", "rna_iterator_array_end",
+ "rna_iterator_array_get", "rna_IDPArray_length", NULL, NULL, NULL);
RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
/* never tested, maybe its useful to have this? */
@@ -419,7 +423,7 @@ static void rna_def_ID_properties(BlenderRNA *brna)
RNA_def_struct_refine_func(srna, "rna_PropertyGroup_refine");
/* important so python types can have their name used in list views
- * however this isnt prefect because it overrides how python would set the name
+ * however this isn't prefect because it overrides how python would set the name
* when we only really want this so RNA_def_struct_name_property() is set to something useful */
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
@@ -467,7 +471,9 @@ static void rna_def_ID(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "ID", NULL);
- RNA_def_struct_ui_text(srna, "ID", "Base type for datablocks, defining a unique name, linking from other libraries and garbage collection");
+ RNA_def_struct_ui_text(srna, "ID",
+ "Base type for datablocks, defining a unique name, linking from other libraries "
+ "and garbage collection");
RNA_def_struct_flag(srna, STRUCT_ID|STRUCT_ID_REFCOUNT);
RNA_def_struct_refine_func(srna, "rna_ID_refine");
RNA_def_struct_idprops_func(srna, "rna_ID_idprops");
@@ -550,7 +556,7 @@ static void rna_def_library(BlenderRNA *brna)
prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Library");
- RNA_def_property_ui_text(prop, "Parent", "");
+ RNA_def_property_ui_text(prop, "Parent", "");
}
void RNA_def_ID(BlenderRNA *brna)
{
@@ -571,4 +577,3 @@ void RNA_def_ID(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 2ccd7d293d3..d2537f9fabd 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -474,12 +474,7 @@ static const char *rna_ensure_property_description(PropertyRNA *prop)
description = ((IDProperty*)prop)->name; /* XXX - not correct */
}
-#ifdef WITH_INTERNATIONAL
- if (description && BLF_translate_tooltips())
- description = BLF_gettext(description);
-#endif
-
- return description;
+ return TIP_(description);
}
static const char *rna_ensure_property_name(PropertyRNA *prop)
@@ -491,16 +486,7 @@ static const char *rna_ensure_property_name(PropertyRNA *prop)
else
name = ((IDProperty*)prop)->name;
-#ifdef WITH_INTERNATIONAL
- if (BLF_translate_iface()) {
- if (prop->translation_context)
- name = BLF_pgettext(prop->translation_context, name);
- else
- name = BLF_gettext(name);
- }
-#endif
-
- return name;
+ return CTX_IFACE_(prop->translation_context, name);
}
/* Structs */
@@ -523,7 +509,7 @@ const char *RNA_struct_identifier(StructRNA *type)
const char *RNA_struct_ui_name(StructRNA *type)
{
- return type->name;
+ return CTX_IFACE_(type->translation_context, type->name);
}
int RNA_struct_ui_icon(StructRNA *type)
@@ -536,7 +522,7 @@ int RNA_struct_ui_icon(StructRNA *type)
const char *RNA_struct_ui_description(StructRNA *type)
{
- return type->description;
+ return TIP_(type->description);
}
PropertyRNA *RNA_struct_name_property(StructRNA *type)
@@ -604,7 +590,8 @@ int RNA_struct_is_a(StructRNA *type, StructRNA *srna)
PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
{
- if (identifier[0] =='[' && identifier[1] =='"') { /* " (dummy comment to avoid confusing some function lists in text editors) */
+ if (identifier[0] =='[' && identifier[1] =='"') { /* " (dummy comment to avoid confusing some
+ * function lists in text editors) */
/* id prop lookup, not so common */
PropertyRNA *r_prop = NULL;
PointerRNA r_ptr; /* only support single level props */
@@ -1009,7 +996,8 @@ void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin
}
}
-void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax, float *step, float *precision)
+void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax,
+ float *step, float *precision)
{
FloatPropertyRNA *fprop = (FloatPropertyRNA*)rna_ensure_property(prop);
float hardmin, hardmax;
@@ -1147,7 +1135,8 @@ EnumPropertyItem DummyRNA_DEFAULT_items[] = {
{0, NULL, 0, NULL, NULL}
};
-void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free)
+void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item,
+ int *totitem, int *free)
{
EnumPropertyRNA *eprop = (EnumPropertyRNA*)rna_ensure_property(prop);
@@ -1177,18 +1166,21 @@ void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, En
}
}
-void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free)
+void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA *prop,
+ EnumPropertyItem **item, int *totitem, int *free)
{
RNA_property_enum_items(C, ptr, prop, item, totitem, free);
#ifdef WITH_INTERNATIONAL
+ /* Note: keep directly using BLF_gettext here, has we have already done tests like BLF_translate_iface... */
if (BLF_translate_iface()) {
int i;
EnumPropertyItem *nitem;
if (*free) {
nitem = *item;
- } else {
+ }
+ else {
int totitem = 0;
/* count */
@@ -1292,7 +1284,8 @@ int RNA_enum_description(EnumPropertyItem *item, const int value, const char **d
return 0;
}
-int RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
+int RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value,
+ const char **identifier)
{
EnumPropertyItem *item = NULL;
int result, free;
@@ -1324,7 +1317,8 @@ int RNA_property_enum_name(bContext *C, PointerRNA *ptr, PropertyRNA *prop, cons
return 0;
}
-int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
+int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value,
+ const char **identifier)
{
EnumPropertyItem *item = NULL;
int result, free;
@@ -1418,7 +1412,7 @@ int RNA_property_animated(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop))
/* this function is to check if its possible to create a valid path from the ID
- * its slow so dont call in a loop */
+ * its slow so don't call in a loop */
int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop)
{
char *path = RNA_path_from_ID_to_property(ptr, prop);
@@ -1430,8 +1424,12 @@ int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA *r_prop;
RNA_id_pointer_create(ptr->id.data, &id_ptr);
- RNA_path_resolve(&id_ptr, path, &r_ptr, &r_prop);
- ret = (prop == r_prop);
+ if (RNA_path_resolve(&id_ptr, path, &r_ptr, &r_prop) == TRUE) {
+ ret = (prop == r_prop);
+ }
+ else {
+ ret = FALSE;
+ }
MEM_freeN(path);
}
@@ -1475,7 +1473,7 @@ static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerR
/* must keep in sync with 'rna_property_update'
* note, its possible this returns a false positive in the case of PROP_CONTEXT_UPDATE
- * but this isnt likely to be a performance problem. */
+ * but this isn't likely to be a performance problem. */
int RNA_property_update_check(PropertyRNA *prop)
{
return (prop->magic != RNA_MAGIC || prop->update || prop->noteflag);
@@ -2724,7 +2722,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
/* py api calls directly */
#if 0
- else if (cprop->add){
+ else if (cprop->add) {
if (!(cprop->add->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
ParameterList params;
RNA_parameter_list_create(&params, ptr, cprop->add);
@@ -2781,7 +2779,7 @@ int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
/* py api calls directly */
#if 0
- else if (cprop->remove){
+ else if (cprop->remove) {
if (!(cprop->remove->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
ParameterList params;
RNA_parameter_list_create(&params, ptr, cprop->remove);
@@ -2998,7 +2996,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
#define RAW_GET(dtype, var, raw, a) \
{ \
- switch (raw.type) { \
+ switch (raw.type) { \
case PROP_RAW_CHAR: var = (dtype)((char*)raw.array)[a]; break; \
case PROP_RAW_SHORT: var = (dtype)((short*)raw.array)[a]; break; \
case PROP_RAW_INT: var = (dtype)((int*)raw.array)[a]; break; \
@@ -3010,7 +3008,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
#define RAW_SET(dtype, raw, a, var) \
{ \
- switch (raw.type) { \
+ switch (raw.type) { \
case PROP_RAW_CHAR: ((char*)raw.array)[a] = (char)var; break; \
case PROP_RAW_SHORT: ((short*)raw.array)[a] = (short)var; break; \
case PROP_RAW_INT: ((int*)raw.array)[a] = (int)var; break; \
@@ -3032,7 +3030,8 @@ int RNA_raw_type_sizeof(RawPropertyType type)
}
}
-static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname, void *inarray, RawPropertyType intype, int inlen, int set)
+static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname,
+ void *inarray, RawPropertyType intype, int inlen, int set)
{
StructRNA *ptype;
PointerRNA itemptr;
@@ -3072,7 +3071,8 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
if (RNA_property_collection_raw_array(ptr, prop, itemprop, &out)) {
int arraylen = (itemlen == 0) ? 1 : itemlen;
if (in.len != arraylen*out.len) {
- BKE_reportf(reports, RPT_ERROR, "Array length mismatch (expected %d, got %d)", out.len*arraylen, in.len);
+ BKE_reportf(reports, RPT_ERROR, "Array length mismatch (expected %d, got %d)",
+ out.len * arraylen, in.len);
return 0;
}
@@ -3334,12 +3334,14 @@ RawPropertyType RNA_property_raw_type(PropertyRNA *prop)
return prop->rawtype;
}
-int RNA_property_collection_raw_get(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname, void *array, RawPropertyType type, int len)
+int RNA_property_collection_raw_get(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname,
+ void *array, RawPropertyType type, int len)
{
return rna_raw_access(reports, ptr, prop, propname, array, type, len, 0);
}
-int RNA_property_collection_raw_set(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname, void *array, RawPropertyType type, int len)
+int RNA_property_collection_raw_set(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname,
+ void *array, RawPropertyType type, int len)
{
return rna_raw_access(reports, ptr, prop, propname, array, type, len, 1);
}
@@ -3396,7 +3398,8 @@ PointerRNA rna_listbase_lookup_int(PointerRNA *ptr, StructRNA *type, struct List
return rna_pointer_inherit_refine(ptr, type, data);
}
-void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, int free_ptr, IteratorSkipFunc skip)
+void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length,
+ int free_ptr, IteratorSkipFunc skip)
{
ArrayIterator *internal;
@@ -3700,7 +3703,7 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
int i, temp_index;
for (i = 0; i<dim; i++) {
- temp_index = -1;
+ temp_index = -1;
/* multi index resolve */
if (*path =='[') {
@@ -3999,7 +4002,8 @@ static char *rna_path_from_ID_to_idpgroup(PointerRNA *ptr)
BLI_assert(ptr->id.data != NULL);
/* TODO, Support Bones/PoseBones. no pointers stored to the bones from here, only the ID. See example in [#25746]
- * unless this is added only way to find this is to also search all bones and pose bones of an armature or object */
+ * Unless this is added only way to find this is to also search all bones and pose bones
+ * of an armature or object */
RNA_id_pointer_create(ptr->id.data, &id_ptr);
haystack = RNA_struct_idprops(&id_ptr, FALSE);
@@ -4028,11 +4032,11 @@ char *RNA_path_from_ID_to_struct(PointerRNA *ptr)
PointerRNA parentptr;
PropertyRNA *userprop;
- /* find the property in the struct we're nested in that references this struct, and
+ /* find the property in the struct we're nested in that references this struct, and
* use its identifier as the first part of the path used...
*/
RNA_id_pointer_create(ptr->id.data, &parentptr);
- userprop = RNA_struct_find_nested(&parentptr, ptr->type);
+ userprop = RNA_struct_find_nested(&parentptr, ptr->type);
if (userprop)
ptrpath = BLI_strdup(RNA_property_identifier(userprop));
@@ -4496,7 +4500,7 @@ char *RNA_pointer_as_string(bContext *C, PointerRNA *ptr)
}
RNA_STRUCT_END;
- BLI_dynstr_append(dynstr, "}");
+ BLI_dynstr_append(dynstr, "}");
cstring = BLI_dynstr_get_cstring(dynstr);
@@ -4504,6 +4508,118 @@ char *RNA_pointer_as_string(bContext *C, PointerRNA *ptr)
return cstring;
}
+
+/* context and ptr_default can be NULL */
+char *RNA_pointer_as_string_keywords_ex(bContext *C, PointerRNA *ptr, PointerRNA *ptr_default,
+ const short as_function, const short all_args,
+ PropertyRNA *iterprop)
+{
+ const char *arg_name = NULL;
+
+ PropertyRNA *prop;
+
+ DynStr *dynstr= BLI_dynstr_new();
+ char *cstring, *buf;
+ int first_iter = TRUE, ok = TRUE;
+ int flag;
+
+ /* only to get the orginal props for comparisons */
+ PropertyRNA *prop_default;
+ char *buf_default;
+
+ RNA_PROP_BEGIN(ptr, propptr, iterprop) {
+ prop = propptr.data;
+
+ flag = RNA_property_flag(prop);
+
+ if (as_function && (flag & PROP_OUTPUT)) {
+ continue;
+ }
+
+ arg_name = RNA_property_identifier(prop);
+
+ if (strcmp(arg_name, "rna_type") == 0) {
+ continue;
+ }
+
+ if (as_function && (flag & PROP_REQUIRED)) {
+ /* required args don't have useful defaults */
+ BLI_dynstr_appendf(dynstr, first_iter ? "%s":", %s", arg_name);
+ first_iter = FALSE;
+ }
+ else {
+ if (as_function && RNA_property_type(prop) == PROP_POINTER) {
+ /* don't expand pointers for functions */
+ if (flag & PROP_NEVER_NULL) {
+ /* we cant really do the right thing here. arg=arg?, hrmf! */
+ buf = BLI_strdup(arg_name);
+ }
+ else {
+ buf = BLI_strdup("None");
+ }
+ }
+ else {
+ buf = RNA_property_as_string(C, ptr, prop);
+ }
+
+ ok = TRUE;
+
+ if (all_args == FALSE && ptr_default) {
+ /* not verbose, so only add in attributes that use non-default values
+ * slow but good for tooltips */
+ prop_default= RNA_struct_find_property(ptr_default, arg_name);
+
+ if (prop_default) {
+ buf_default= RNA_property_as_string(C, ptr_default, prop_default);
+
+ if (strcmp(buf, buf_default) == 0)
+ ok = FALSE; /* values match, don't bother printing */
+
+ MEM_freeN(buf_default);
+ }
+ }
+ if (ok) {
+ BLI_dynstr_appendf(dynstr, first_iter ? "%s=%s":", %s=%s", arg_name, buf);
+ first_iter = FALSE;
+ }
+
+ MEM_freeN(buf);
+ }
+ }
+ RNA_PROP_END;
+
+ cstring = BLI_dynstr_get_cstring(dynstr);
+ BLI_dynstr_free(dynstr);
+ return cstring;
+}
+
+char *RNA_pointer_as_string_keywords(bContext *C, PointerRNA *ptr, PointerRNA *ptr_default,
+ const short as_function, const short all_args)
+{
+ PropertyRNA *iterprop;
+
+ iterprop = RNA_struct_iterator_property(ptr->type);
+
+ return RNA_pointer_as_string_keywords_ex(C, ptr, ptr_default, as_function, all_args,
+ iterprop);
+}
+
+char *RNA_function_as_string_keywords(bContext *C, FunctionRNA *func, PointerRNA *ptr_default,
+ const short as_function, const short all_args)
+{
+ PointerRNA funcptr;
+ PropertyRNA *iterprop;
+
+ RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
+
+ iterprop = RNA_struct_find_property(&funcptr, "parameters");
+
+ RNA_struct_iterator_property(funcptr.type);
+
+ return RNA_pointer_as_string_keywords_ex(C, &funcptr, ptr_default, as_function, all_args,
+ iterprop);
+}
+
char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
{
int type = RNA_property_type(prop);
@@ -4523,7 +4639,8 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
else {
BLI_dynstr_append(dynstr, "(");
for (i = 0; i<len; i++) {
- BLI_dynstr_appendf(dynstr, i?", %s":"%s", RNA_property_boolean_get_index(ptr, prop, i) ? "True" : "False");
+ BLI_dynstr_appendf(dynstr, i ? ", %s" : "%s",
+ RNA_property_boolean_get_index(ptr, prop, i) ? "True" : "False");
}
if (len == 1)
BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
@@ -4576,33 +4693,39 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
}
case PROP_ENUM:
{
- /* string arrays dont exist */
+ /* string arrays don't exist */
const char *identifier;
int val = RNA_property_enum_get(ptr, prop);
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
/* represent as a python set */
- EnumPropertyItem *item = NULL;
- int free;
-
- BLI_dynstr_append(dynstr, "{");
-
- RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- if (item) {
- short is_first = TRUE;
- for (; item->identifier; item++) {
- if (item->identifier[0] && item->value & val) {
- BLI_dynstr_appendf(dynstr, is_first ? "'%s'" : ", '%s'", item->identifier);
- is_first = FALSE;
+ if (val) {
+ EnumPropertyItem *item = NULL;
+ int free;
+
+ BLI_dynstr_append(dynstr, "{");
+
+ RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
+ if (item) {
+ short is_first = TRUE;
+ for (; item->identifier; item++) {
+ if (item->identifier[0] && item->value & val) {
+ BLI_dynstr_appendf(dynstr, is_first ? "'%s'" : ", '%s'", item->identifier);
+ is_first = FALSE;
+ }
}
- }
- if (free) {
- MEM_freeN(item);
+ if (free) {
+ MEM_freeN(item);
+ }
}
- }
- BLI_dynstr_append(dynstr, "}");
+ BLI_dynstr_append(dynstr, "}");
+ }
+ else {
+ /* annoying exception, don't confuse with dictionary syntax above: {} */
+ BLI_dynstr_append(dynstr, "set()");
+ }
}
else if (RNA_property_enum_identifier(C, ptr, prop, val, &identifier)) {
BLI_dynstr_appendf(dynstr, "'%s'", identifier);
@@ -4626,7 +4749,8 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
CollectionPropertyIterator collect_iter;
BLI_dynstr_append(dynstr, "[");
- for (RNA_property_collection_begin(ptr, prop, &collect_iter); collect_iter.valid; RNA_property_collection_next(&collect_iter)) {
+ for (RNA_property_collection_begin(ptr, prop, &collect_iter); collect_iter.valid;
+ RNA_property_collection_next(&collect_iter)) {
PointerRNA itemptr = collect_iter.ptr;
if (first_time == 0)
@@ -4850,7 +4974,7 @@ void RNA_parameter_get(ParameterList *parms, PropertyRNA *parm, void **value)
RNA_parameter_list_begin(parms, &iter);
for (; iter.valid; RNA_parameter_list_next(&iter))
- if (iter.parm == parm)
+ if (iter.parm == parm)
break;
if (iter.valid)
@@ -4881,7 +5005,7 @@ void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, const void *valu
RNA_parameter_list_begin(parms, &iter);
for (; iter.valid; RNA_parameter_list_next(&iter))
- if (iter.parm == parm)
+ if (iter.parm == parm)
break;
if (iter.valid)
@@ -4959,7 +5083,8 @@ int RNA_function_call(bContext *C, ReportList *reports, PointerRNA *ptr, Functio
return -1;
}
-int RNA_function_call_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, ParameterList *parms)
+int RNA_function_call_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier,
+ ParameterList *parms)
{
FunctionRNA *func;
@@ -4971,7 +5096,8 @@ int RNA_function_call_lookup(bContext *C, ReportList *reports, PointerRNA *ptr,
return -1;
}
-int RNA_function_call_direct(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, ...)
+int RNA_function_call_direct(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func,
+ const char *format, ...)
{
va_list args;
int ret;
@@ -4985,7 +5111,8 @@ int RNA_function_call_direct(bContext *C, ReportList *reports, PointerRNA *ptr,
return ret;
}
-int RNA_function_call_direct_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, ...)
+int RNA_function_call_direct_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier,
+ const char *format, ...)
{
FunctionRNA *func;
@@ -5169,7 +5296,8 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
return 0;
}
-int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, va_list args)
+int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func,
+ const char *format, va_list args)
{
PointerRNA funcptr;
ParameterList parms;
@@ -5235,39 +5363,45 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
case PROP_ENUM:
{
int arg = va_arg(args, int);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
+ NULL, tid, fid, pid);
break;
}
case PROP_FLOAT:
{
double arg = va_arg(args, double);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
+ NULL, tid, fid, pid);
break;
}
case PROP_STRING:
{
char *arg = va_arg(args, char*);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
+ NULL, tid, fid, pid);
break;
}
case PROP_POINTER:
{
StructRNA *srna = va_arg(args, StructRNA*);
void *arg = va_arg(args, void*);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, srna, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
+ srna, tid, fid, pid);
break;
}
case PROP_COLLECTION:
{
StructRNA *srna = va_arg(args, StructRNA*);
ListBase *arg = va_arg(args, ListBase*);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, srna, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
+ srna, tid, fid, pid);
break;
}
default:
{
/* handle errors */
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, NULL, NULL, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, NULL,
+ NULL, tid, fid, pid);
break;
}
}
@@ -5301,39 +5435,45 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
case PROP_ENUM:
{
int *arg = va_arg(args, int*);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
+ NULL, tid, fid, pid);
break;
}
case PROP_FLOAT:
{
float *arg = va_arg(args, float*);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
+ NULL, tid, fid, pid);
break;
}
case PROP_STRING:
{
char **arg = va_arg(args, char**);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
+ NULL, tid, fid, pid);
break;
}
case PROP_POINTER:
{
StructRNA *srna = va_arg(args, StructRNA*);
void **arg = va_arg(args, void**);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, srna, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
+ srna, tid, fid, pid);
break;
}
case PROP_COLLECTION:
{
StructRNA *srna = va_arg(args, StructRNA*);
ListBase **arg = va_arg(args, ListBase**);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, srna, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
+ srna, tid, fid, pid);
break;
}
default:
{
/* handle errors */
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, NULL, NULL, NULL, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, NULL, NULL,
+ NULL, tid, fid, pid);
break;
}
}
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 3df868f9afe..382458ac3f5 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -93,7 +93,8 @@ static void rna_Action_groups_remove(bAction *act, ReportList *reports, bActionG
MEM_freeN(agrp);
}
-static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const char *data_path, int index, const char *group)
+static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const char *data_path,
+ int index, const char *group)
{
if (group && group[0] =='\0') group = NULL;
@@ -104,7 +105,8 @@ static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const ch
/* annoying, check if this exists */
if (verify_fcurve(act, group, data_path, index, 0)) {
- BKE_reportf(reports, RPT_ERROR, "F-Curve '%s[%d]' already exists in action '%s'", data_path, index, act->id.name+2);
+ BKE_reportf(reports, RPT_ERROR, "F-Curve '%s[%d]' already exists in action '%s'", data_path,
+ index, act->id.name+2);
return NULL;
}
return verify_fcurve(act, group, data_path, index, 1);
@@ -114,7 +116,8 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve *
{
if (fcu->grp) {
if (BLI_findindex(&act->groups, fcu->grp) == -1) {
- BKE_reportf(reports, RPT_ERROR, "F-Curve's ActionGroup '%s' not found in action '%s'", fcu->grp->name, act->id.name+2);
+ BKE_reportf(reports, RPT_ERROR, "F-Curve's ActionGroup '%s' not found in action '%s'",
+ fcu->grp->name, act->id.name+2);
return;
}
@@ -202,7 +205,7 @@ int rna_Action_id_poll(PointerRNA *ptr, PointerRNA value)
bAction *act = (bAction *)value.id.data;
if (act) {
- /* there can still be actions that will have undefined id-root
+ /* there can still be actions that will have undefined id-root
* (i.e. floating "action-library" members) which we will not
* be able to resolve an idroot for automatically, so let these through
*/
@@ -222,7 +225,7 @@ int rna_Action_actedit_assign_poll(PointerRNA *ptr, PointerRNA value)
bAction *act = (bAction *)value.id.data;
if (act) {
- /* there can still be actions that will have undefined id-root
+ /* there can still be actions that will have undefined id-root
* (i.e. floating "action-library" members) which we will not
* be able to resolve an idroot for automatically, so let these through
*/
@@ -259,12 +262,15 @@ static void rna_def_dopesheet(BlenderRNA *brna)
/* XXX: make this obsolete? */
prop = RNA_def_property(srna, "source", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "ID");
- RNA_def_property_ui_text(prop, "Source", "ID-Block representing source data, currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil)");
+ RNA_def_property_ui_text(prop, "Source",
+ "ID-Block representing source data, currently ID_SCE (for Dopesheet), "
+ "and ID_SC (for Grease Pencil)");
/* Show datablock filters */
prop = RNA_def_property(srna, "show_datablock_filters", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ADS_FLAG_SHOW_DBFILTERS);
- RNA_def_property_ui_text(prop, "Show Datablock Filters", "Show options for whether channels related to certain types of data are included");
+ RNA_def_property_ui_text(prop, "Show Datablock Filters",
+ "Show options for whether channels related to certain types of data are included");
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, -1);
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN, NULL);
@@ -284,7 +290,8 @@ static void rna_def_dopesheet(BlenderRNA *brna)
/* Object Group Filtering Settings */
prop = RNA_def_property(srna, "show_only_group_objects", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYOBGROUP);
- RNA_def_property_ui_text(prop, "Only Objects in Group", "Only include channels from Objects in the specified Group");
+ RNA_def_property_ui_text(prop, "Only Objects in Group",
+ "Only include channels from Objects in the specified Group");
RNA_def_property_ui_icon(prop, ICON_GROUP, 0);
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
@@ -297,7 +304,8 @@ static void rna_def_dopesheet(BlenderRNA *brna)
/* FCurve Display Name Search Settings */
prop = RNA_def_property(srna, "show_only_matching_fcurves", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_BY_FCU_NAME);
- RNA_def_property_ui_text(prop, "Only Matching F-Curves", "Only include F-Curves with names containing search text");
+ RNA_def_property_ui_text(prop, "Only Matching F-Curves",
+ "Only include F-Curves with names containing search text");
RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
@@ -309,7 +317,8 @@ static void rna_def_dopesheet(BlenderRNA *brna)
/* NLA Specific Settings */
prop = RNA_def_property(srna, "show_missing_nla", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT);
- RNA_def_property_ui_text(prop, "Include Missing NLA", "Include Animation Data blocks with no NLA data (NLA Editor only)");
+ RNA_def_property_ui_text(prop, "Include Missing NLA",
+ "Include Animation Data blocks with no NLA data (NLA Editor only)");
RNA_def_property_ui_icon(prop, ICON_ACTION, 0);
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
@@ -322,14 +331,16 @@ static void rna_def_dopesheet(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_expanded_summary", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADS_FLAG_SUMMARY_COLLAPSED);
- RNA_def_property_ui_text(prop, "Collapse Summary", "Collapse summary when shown, so all other channels get hidden (DopeSheet Editors Only)");
+ RNA_def_property_ui_text(prop, "Collapse Summary",
+ "Collapse summary when shown, so all other channels get hidden (DopeSheet Editors Only)");
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
/* General DataType Filtering Settings */
prop = RNA_def_property(srna, "show_transforms", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOOBJ);
- RNA_def_property_ui_text(prop, "Display Transforms", "Include visualization of Object-level Animation data (mostly Transforms)");
+ RNA_def_property_ui_text(prop, "Display Transforms",
+ "Include visualization of Object-level Animation data (mostly Transforms)");
RNA_def_property_ui_icon(prop, ICON_MANIPUL, 0); /* XXX? */
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
@@ -448,8 +459,8 @@ static void rna_def_action_group(BlenderRNA *brna)
* defined like a standard ListBase. Adding/removing channels from this list needs
* extreme care, otherwise the F-Curve list running through adjacent groups does
* not match up with the one stored in the Action, resulting in curves which do not
- * show up in animation editors. In extreme cases, animation may also selectively
- * fail to play back correctly.
+ * show up in animation editors. In extreme cases, animation may also selectively
+ * fail to play back correctly.
*
* If such changes are required, these MUST go through the API functions for manipulating
* these F-Curve groupings. Also, note that groups only apply in actions ONLY.
@@ -571,12 +582,14 @@ static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop)
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "TimelineMarker");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_Action_active_pose_marker_get", "rna_Action_active_pose_marker_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_Action_active_pose_marker_get",
+ "rna_Action_active_pose_marker_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Active Pose Marker", "Active pose marker for this Action");
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "active_marker");
- RNA_def_property_int_funcs(prop, "rna_Action_active_pose_marker_index_get", "rna_Action_active_pose_marker_index_set", "rna_Action_active_pose_marker_index_range");
+ RNA_def_property_int_funcs(prop, "rna_Action_active_pose_marker_index_get",
+ "rna_Action_active_pose_marker_index_set", "rna_Action_active_pose_marker_index_range");
RNA_def_property_ui_text(prop, "Active Pose Marker Index", "Index of active pose marker");
}
@@ -610,15 +623,19 @@ static void rna_def_action(BlenderRNA *brna)
rna_def_action_pose_markers(brna, prop);
/* properties */
- prop = RNA_def_float_vector(srna, "frame_range" , 2 , NULL , 0, 0, "Frame Range" , "The final frame range of all F-Curves within this action" , 0 , 0);
+ prop = RNA_def_float_vector(srna, "frame_range" , 2 , NULL , 0, 0, "Frame Range" ,
+ "The final frame range of all F-Curves within this action" , 0 , 0);
RNA_def_property_float_funcs(prop, "rna_Action_frame_range_get" , NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- /* special "type" limiter - should not really be edited in general, but is still available/editable in 'emergencies' */
+ /* special "type" limiter - should not really be edited in general,
+ * but is still available/editable in 'emergencies' */
prop = RNA_def_property(srna, "id_root", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "idroot");
RNA_def_property_enum_items(prop, id_type_items);
- RNA_def_property_ui_text(prop, "ID Root Type", "Type of ID-block that action can be used on - DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING");
+ RNA_def_property_ui_text(prop, "ID Root Type",
+ "Type of ID-block that action can be used on - "
+ "DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING");
/* API calls */
RNA_api_action(srna);
diff --git a/source/blender/makesrna/intern/rna_action_api.c b/source/blender/makesrna/intern/rna_action_api.c
index 07c42cf0d20..7e95aaab31b 100644
--- a/source/blender/makesrna/intern/rna_action_api.c
+++ b/source/blender/makesrna/intern/rna_action_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Arystanbek Dyussenov
*
* ***** END GPL LICENSE BLOCK *****
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index 78555d2a877..c24b78a155c 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -341,11 +341,13 @@ static void rna_ActionActuator_add_set(struct PointerRNA *ptr, int value)
bActuator *act = (bActuator *)ptr->data;
bActionActuator *aa = act->data;
- if (value == 1){
+ if (value == 1) {
aa->flag &= ~ACT_IPOFORCE;
aa->flag |= ACT_IPOADD;
- }else
+ }
+ else {
aa->flag &= ~ACT_IPOADD;
+ }
}
static void rna_ActionActuator_force_set(struct PointerRNA *ptr, int value)
@@ -353,11 +355,13 @@ static void rna_ActionActuator_force_set(struct PointerRNA *ptr, int value)
bActuator *act = (bActuator *)ptr->data;
bActionActuator *aa = act->data;
- if (value == 1){
+ if (value == 1) {
aa->flag &= ~ACT_IPOADD;
aa->flag |= ACT_IPOFORCE;
- }else
+ }
+ else {
aa->flag &= ~ACT_IPOFORCE;
+ }
}
static void rna_ObjectActuator_type_set(struct PointerRNA *ptr, int value)
@@ -422,9 +426,10 @@ EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, Property
Object *ob = NULL;
int totitem = 0;
- if (ptr->type == &RNA_Actuator || RNA_struct_is_a(ptr->type, &RNA_Actuator)){
+ if (ptr->type == &RNA_Actuator || RNA_struct_is_a(ptr->type, &RNA_Actuator)) {
ob = (Object *)ptr->id.data;
- } else {
+ }
+ else {
/* can't use ob from ptr->id.data because that enum is also used by operators */
ob = CTX_data_active_object(C);
}
@@ -597,7 +602,8 @@ static void rna_def_action_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "end_reset", 1);
- RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time");
+ RNA_def_property_ui_text(prop, "Continue",
+ "Restore last frame when switching on/off, otherwise play from the start each time");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
@@ -625,7 +631,9 @@ static void rna_def_action_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers (with 2 or more actions at once, the overriding channels must be lower in the stack)");
+ RNA_def_property_ui_text(prop, "Priority",
+ "Execution priority - lower numbers will override actions with higher numbers "
+ "(with 2 or more actions at once, the overriding channels must be lower in the stack)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "layer", PROP_INT, PROP_NONE);
@@ -635,7 +643,8 @@ static void rna_def_action_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "layer_weight", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Layer Weight", "How much of the previous layer to blend into this one (0 = add mode)");
+ RNA_def_property_ui_text(prop, "Layer Weight",
+ "How much of the previous layer to blend into this one (0 = add mode)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
@@ -647,13 +656,17 @@ static void rna_def_action_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOADD);
RNA_def_property_boolean_funcs(prop, NULL, "rna_ActionActuator_add_set");
- RNA_def_property_ui_text(prop, "Add", "Action is added to the current loc/rot/scale in global or local coordinate according to Local flag");
+ RNA_def_property_ui_text(prop, "Add",
+ "Action is added to the current loc/rot/scale in global or local coordinate according to "
+ "Local flag");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "use_force", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOFORCE);
RNA_def_property_boolean_funcs(prop, NULL, "rna_ActionActuator_force_set");
- RNA_def_property_ui_text(prop, "Force", "Apply Action as a global or local force depending on the local option (dynamic objects only)");
+ RNA_def_property_ui_text(prop, "Force",
+ "Apply Action as a global or local force depending on the local option "
+ "(dynamic objects only)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "use_local", PROP_BOOLEAN, PROP_NONE);
@@ -701,7 +714,8 @@ static void rna_def_object_actuator(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_pointer_sdna(prop, NULL, "reference");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Reference Object", "Reference object for velocity calculation, leave empty for world reference");
+ RNA_def_property_ui_text(prop, "Reference Object",
+ "Reference object for velocity calculation, leave empty for world reference");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "damping", PROP_INT, PROP_NONE);
@@ -719,7 +733,8 @@ static void rna_def_object_actuator(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "forcerot[1]");
RNA_def_property_ui_range(prop, 0.0, 3.0, 10, 2);
RNA_def_property_float_funcs(prop, NULL, "rna_ObjectActuator_integralcoefficient_set", NULL);
- RNA_def_property_ui_text(prop, "Integral Coefficient", "Low value (0.01) for slow response, high value (0.5) for fast response");
+ RNA_def_property_ui_text(prop, "Integral Coefficient",
+ "Low value (0.01) for slow response, high value (0.5) for fast response");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "derivate_coefficient", PROP_FLOAT, PROP_NONE);
@@ -798,7 +813,9 @@ static void rna_def_object_actuator(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "linearvelocity");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
- RNA_def_property_ui_text(prop, "Linear Velocity", "Linear velocity (in Servo mode it sets the target relative linear velocity, it will be achieved by automatic application of force - Null velocity is a valid target)");
+ RNA_def_property_ui_text(prop, "Linear Velocity",
+ "Linear velocity (in Servo mode it sets the target relative linear velocity, it will be "
+ "achieved by automatic application of force - Null velocity is a valid target)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ);
@@ -990,7 +1007,9 @@ static void rna_def_sound_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "cone_outer_gain_3d", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_outer_gain");
RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
- RNA_def_property_ui_text(prop, "Cone Outer Gain", "The gain outside the outer cone (the gain in the outer cone will be interpolated between this value and the normal gain in the inner cone)");
+ RNA_def_property_ui_text(prop, "Cone Outer Gain",
+ "The gain outside the outer cone (the gain in the outer cone will be interpolated "
+ "between this value and the normal gain in the inner cone)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "cone_outer_angle_3d", PROP_FLOAT, PROP_NONE);
@@ -1130,13 +1149,15 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
/* ACT_CONST_TYPE_LOC */
prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmin_get", "rna_ConstraintActuator_limitmin_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmin_get",
+ "rna_ConstraintActuator_limitmin_set", NULL);
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Min", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmax_get", "rna_ConstraintActuator_limitmax_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmax_get",
+ "rna_ConstraintActuator_limitmax_set", NULL);
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Max", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1155,7 +1176,8 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_distance_get", "rna_ConstraintActuator_distance_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_distance_get",
+ "rna_ConstraintActuator_distance_set", NULL);
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Distance", "Keep this distance to target");
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1202,19 +1224,24 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "minloc[0]");
RNA_def_property_range(prop, 0.0, 180.0);
- RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle (in degree) to maintain with target direction (no correction is done if angle with target direction is between min and max)");
+ RNA_def_property_ui_text(prop, "Min Angle",
+ "Minimum angle (in degree) to maintain with target direction "
+ "(no correction is done if angle with target direction is between min and max)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
/*XXX TODO - use radians internally then change to PROP_ANGLE */
prop = RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "maxloc[0]");
RNA_def_property_range(prop, 0.0, 180.0);
- RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle (in degree) allowed with target direction (no correction is done if angle with target direction is between min and max)");
+ RNA_def_property_ui_text(prop, "Max Angle",
+ "Maximum angle (in degree) allowed with target direction "
+ "(no correction is done if angle with target direction is between min and max)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
/* ACT_CONST_TYPE_FH */
prop = RNA_def_property(srna, "fh_height", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_fhheight_get", "rna_ConstraintActuator_fhheight_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_fhheight_get",
+ "rna_ConstraintActuator_fhheight_set", NULL);
RNA_def_property_ui_range(prop, 0.01, 2000.0, 10, 2);
RNA_def_property_ui_text(prop, "Distance", "Height of the force field area");
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1244,7 +1271,9 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL);
- RNA_def_property_ui_text(prop, "N", "Set object axis along (local axis) or parallel (global axis) to the normal at hit position");
+ RNA_def_property_ui_text(prop, "N",
+ "Set object axis along (local axis) or parallel (global axis) to the normal at "
+ "hit position");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE);
@@ -1325,7 +1354,8 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Mesh");
RNA_def_property_pointer_sdna(prop, NULL, "me");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mesh", "Replace the existing, when left blank 'Phys' will remake the existing physics mesh");
+ RNA_def_property_ui_text(prop, "Mesh",
+ "Replace the existing, when left blank 'Phys' will remake the existing physics mesh");
/* note: custom set function is ONLY to avoid rna setting a user for this. */
RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_editobject_mesh_set", NULL, NULL);
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1373,7 +1403,8 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_replace_physics_mesh", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_PHYS);
- RNA_def_property_ui_text(prop, "Phys", "Replace the physics mesh (triangle bounds only - compound shapes not supported)");
+ RNA_def_property_ui_text(prop, "Phys",
+ "Replace the physics mesh (triangle bounds only - compound shapes not supported)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "use_3d_tracking", PROP_BOOLEAN, PROP_NONE);
@@ -1396,7 +1427,7 @@ static void rna_def_scene_actuator(BlenderRNA *brna)
{ACT_SCENE_REMOVE, "REMOVE", 0, "Remove Scene", ""},
{ACT_SCENE_SUSPEND, "SUSPEND", 0, "Suspend Scene", ""},
{ACT_SCENE_RESUME, "RESUME", 0, "Resume Scene", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "SceneActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Scene Actuator", "");
@@ -1454,7 +1485,7 @@ static void rna_def_random_actuator(BlenderRNA *brna)
{ACT_RANDOM_FLOAT_UNIFORM, "FLOAT_UNIFORM", 0, "Float Uniform", ""},
{ACT_RANDOM_FLOAT_NORMAL, "FLOAT_NORMAL", 0, "Float Normal", ""},
{ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL, "FLOAT_NEGATIVE_EXPONENTIAL", 0, "Float Neg. Exp.", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "RandomActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Random Actuator", "");
@@ -1463,7 +1494,9 @@ static void rna_def_random_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
RNA_def_property_ui_range(prop, 0, 1000, 1, 1);
RNA_def_property_range(prop, 0, MAXFRAME);
- RNA_def_property_ui_text(prop, "Seed", "Initial seed of the random generator, use Python for more freedom (choose 0 for not random)");
+ RNA_def_property_ui_text(prop, "Seed",
+ "Initial seed of the random generator, use Python for more freedom "
+ "(choose 0 for not random)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
@@ -1579,7 +1612,8 @@ static void rna_def_message_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "to_property", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "toPropName");
- RNA_def_property_ui_text(prop, "To", "Optional, send message to objects with this name only, or empty to broadcast");
+ RNA_def_property_ui_text(prop, "To",
+ "Optional, send message to objects with this name only, or empty to broadcast");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE);
@@ -1634,7 +1668,9 @@ static void rna_def_game_actuator(BlenderRNA *brna)
/* ACT_GAME_LOAD */
prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_ui_text(prop, "File", "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
+ RNA_def_property_ui_text(prop, "File",
+ "Load this blend file, use the \"//\" prefix for a path relative to the current "
+ "blend file");
RNA_def_property_update(prop, NC_LOGIC, NULL);
/*XXX to do: an operator that calls file_browse with relative_path on and blender filtering active */
}
@@ -1650,17 +1686,22 @@ static void rna_def_visibility_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_visible", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_VISIBILITY_INVISIBLE);
- RNA_def_property_ui_text(prop, "Visible", "Set the objects visible (initialized from the object render restriction toggle in physics button)");
+ RNA_def_property_ui_text(prop, "Visible",
+ "Set the objects visible (initialized from the object render restriction toggle in "
+ "physics button)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "use_occlusion", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_OCCLUSION);
- RNA_def_property_ui_text(prop, "Occlusion", "Set the object to occlude objects behind it (initialized from the object type in physics button)");
+ RNA_def_property_ui_text(prop, "Occlusion",
+ "Set the object to occlude objects behind it (initialized from the object type in "
+ "physics button)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_RECURSIVE);
- RNA_def_property_ui_text(prop, "Children", "Set all the children of this object to the same visibility/occlusion recursively");
+ RNA_def_property_ui_text(prop, "Children",
+ "Set all the children of this object to the same visibility/occlusion recursively");
RNA_def_property_update(prop, NC_LOGIC, NULL);
}
@@ -1754,7 +1795,9 @@ static void rna_def_parent_actuator(BlenderRNA *brna)
/* booleans */
prop = RNA_def_property(srna, "use_compound", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_PARENT_COMPOUND);
- RNA_def_property_ui_text(prop, "Compound", "Add this object shape to the parent shape (only if the parent shape is already compound)");
+ RNA_def_property_ui_text(prop, "Compound",
+ "Add this object shape to the parent shape "
+ "(only if the parent shape is already compound)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE);
@@ -1801,7 +1844,8 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "end_reset", 1);
- RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time");
+ RNA_def_property_ui_text(prop, "Continue",
+ "Restore last frame when switching on/off, otherwise play from the start each time");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
@@ -1829,7 +1873,9 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers (with 2 or more actions at once, the overriding channels must be lower in the stack)");
+ RNA_def_property_ui_text(prop, "Priority",
+ "Execution priority - lower numbers will override actions with higher numbers "
+ "(with 2 or more actions at once, the overriding channels must be lower in the stack)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
@@ -1919,7 +1965,9 @@ static void rna_def_armature_actuator(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "subtarget");
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Secondary Target", "Set this object as the secondary target of the constraint (only IK polar target at the moment)");
+ RNA_def_property_ui_text(prop, "Secondary Target",
+ "Set this object as the secondary target of the constraint "
+ "(only IK polar target at the moment)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
@@ -2062,4 +2110,3 @@ void RNA_def_actuator(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_actuator_api.c b/source/blender/makesrna/intern/rna_actuator_api.c
index eba2cfafd47..68b2c4f8b52 100644
--- a/source/blender/makesrna/intern/rna_actuator_api.c
+++ b/source/blender/makesrna/intern/rna_actuator_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s):
*
* ***** END GPL LICENSE BLOCK *****
@@ -60,13 +60,13 @@ void RNA_api_actuator(StructRNA *srna)
func = RNA_def_function(srna, "link", "rna_Actuator_link");
RNA_def_function_ui_description(func, "Link the actuator to a controller");
- parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to link to");
+ parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to link to");
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_property_update(parm, NC_LOGIC, NULL);
func = RNA_def_function(srna, "unlink", "rna_Actuator_unlink");
RNA_def_function_ui_description(func, "Unlink the actuator from a controller");
- parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to unlink from");
+ parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to unlink from");
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_property_update(parm, NC_LOGIC, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 56c176256bc..fce618228b3 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -178,7 +178,8 @@ static void rna_KeyingSetInfo_unregister(Main *bmain, StructRNA *type)
ANIM_keyingset_info_unregister(bmain, ksi);
}
-static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, void *data, const char *identifier,
+ StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
KeyingSetInfo dummyksi = {NULL};
KeyingSetInfo *ksi;
@@ -209,7 +210,7 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v
memcpy(ksi, &dummyksi, sizeof(KeyingSetInfo));
/* set RNA-extensions info */
- ksi->ext.srna = RNA_def_struct(&BLENDER_RNA, ksi->idname, "KeyingSetInfo");
+ ksi->ext.srna = RNA_def_struct(&BLENDER_RNA, ksi->idname, "KeyingSetInfo");
ksi->ext.data = data;
ksi->ext.call = call;
ksi->ext.free = free;
@@ -342,7 +343,7 @@ static PointerRNA rna_KeyingSet_typeinfo_get(PointerRNA *ptr)
-static KS_Path *rna_KeyingSet_paths_add(KeyingSet *keyingset, ReportList *reports,
+static KS_Path *rna_KeyingSet_paths_add(KeyingSet *keyingset, ReportList *reports,
ID *id, const char rna_path[], int index, int group_method, const char group_name[])
{
KS_Path *ksp = NULL;
@@ -357,7 +358,7 @@ static KS_Path *rna_KeyingSet_paths_add(KeyingSet *keyingset, ReportList *report
/* if data is valid, call the API function for this */
if (keyingset) {
ksp = BKE_keyingset_add_path(keyingset, id, group_name, rna_path, index, flag, group_method);
- keyingset->active_path = BLI_countlist(&keyingset->paths);
+ keyingset->active_path = BLI_countlist(&keyingset->paths);
}
else {
BKE_report(reports, RPT_ERROR, "Keying Set Path could not be added");
@@ -460,9 +461,13 @@ static void rna_def_common_keying_flags(StructRNA *srna, short reg)
PropertyRNA *prop;
static EnumPropertyItem keying_flag_items[] = {
- {INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves"},
- {INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'"},
- {INSERTKEY_XYZ2RGB, "INSERTKEY_XYZ_TO_RGB", 0, "F-Curve Colors - XYZ to RGB", "Color for newly added transformation F-Curves (Location, Rotation, Scale) and also Color is based on the transform axis"},
+ {INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Insert Keyframes - Only Needed",
+ "Only insert keyframes where they're needed in the relevant F-Curves"},
+ {INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Insert Keyframes - Visual",
+ "Insert keyframes based on 'visual transforms'"},
+ {INSERTKEY_XYZ2RGB, "INSERTKEY_XYZ_TO_RGB", 0, "F-Curve Colors - XYZ to RGB",
+ "Color for newly added transformation F-Curves (Location, Rotation, Scale) "
+ "and also Color is based on the transform axis"},
{0, NULL, 0, NULL, NULL}};
prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
@@ -545,7 +550,7 @@ static void rna_def_keyingset_info(BlenderRNA *brna)
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_pointer(func, "ks", "KeyingSet", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm = RNA_def_pointer(func, "data", "AnyType", "", "");
+ parm = RNA_def_pointer(func, "data", "AnyType", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
}
@@ -564,7 +569,9 @@ static void rna_def_keyingset_path(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_editable_func(prop, "rna_ksPath_id_editable");
RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_ksPath_id_typef", NULL);
- RNA_def_property_ui_text(prop, "ID-Block", "ID-Block that keyframes for Keying Set should be added to (for Absolute Keying Sets only)");
+ RNA_def_property_ui_text(prop, "ID-Block",
+ "ID-Block that keyframes for Keying Set should be added to "
+ "(for Absolute Keying Sets only)");
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
@@ -589,7 +596,8 @@ static void rna_def_keyingset_path(BlenderRNA *brna)
/* Path + Array Index */
prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ksPath_RnaPath_get", "rna_ksPath_RnaPath_length", "rna_ksPath_RnaPath_set");
+ RNA_def_property_string_funcs(prop, "rna_ksPath_RnaPath_get", "rna_ksPath_RnaPath_length",
+ "rna_ksPath_RnaPath_set");
RNA_def_property_ui_text(prop, "Data Path", "Path to property setting");
RNA_def_struct_name_property(srna, prop); /* XXX this is the best indicator for now... */
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL);
@@ -602,7 +610,9 @@ static void rna_def_keyingset_path(BlenderRNA *brna)
/* Flags */
prop = RNA_def_property(srna, "use_entire_array", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KSP_FLAG_WHOLE_ARRAY);
- RNA_def_property_ui_text(prop, "Entire Array", "When an 'array/vector' type is chosen (Location, Rotation, Color, etc.), entire array is to be used");
+ RNA_def_property_ui_text(prop, "Entire Array",
+ "When an 'array/vector' type is chosen (Location, Rotation, Color, etc.), "
+ "entire array is to be used");
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
/* Keyframing Settings */
@@ -634,10 +644,11 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
parm = RNA_def_pointer(func, "ksp", "KeyingSetPath", "New Path", "Path created and added to the Keying Set");
RNA_def_function_return(func, parm);
/* ID-block for target */
- parm = RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID-Datablock for the destination");
+ parm = RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID-Datablock for the destination");
RNA_def_property_flag(parm, PROP_REQUIRED);
/* rna-path */
- parm = RNA_def_string(func, "data_path", "", 256, "Data-Path", "RNA-Path to destination property"); /* xxx hopefully this is long enough */
+ /* XXX hopefully this is long enough */
+ parm = RNA_def_string(func, "data_path", "", 256, "Data-Path", "RNA-Path to destination property");
RNA_def_property_flag(parm, PROP_REQUIRED);
/* index (defaults to -1 for entire array) */
RNA_def_int(func, "index", -1, -1, INT_MAX, "Index",
@@ -655,7 +666,7 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove the given path from the Keying Set");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
/* path to remove */
- parm = RNA_def_pointer(func, "path", "KeyingSetPath", "Path", "");
+ parm = RNA_def_pointer(func, "path", "KeyingSetPath", "Path", "");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
@@ -668,12 +679,14 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_struct_type(prop, "KeyingSetPath");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
- RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get",
+ "rna_KeyingSet_active_ksPath_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "active_path");
- RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set", "rna_KeyingSet_active_ksPath_index_range");
+ RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set",
+ "rna_KeyingSet_active_ksPath_index_range");
RNA_def_property_ui_text(prop, "Active Path Index", "Current Keying Set index");
}
@@ -722,7 +735,9 @@ static void rna_def_keyingset(BlenderRNA *brna)
prop = RNA_def_property(srna, "is_path_absolute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYINGSET_ABSOLUTE);
- RNA_def_property_ui_text(prop, "Absolute", "Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)");
+ RNA_def_property_ui_text(prop, "Absolute",
+ "Keying Set defines specific paths/settings to be keyframed "
+ "(i.e. is not reliant on context info)");
/* Keyframing Flags */
rna_def_common_keying_flags(srna, 0);
@@ -800,7 +815,7 @@ void rna_def_animdata_common(StructRNA *srna)
prop = RNA_def_property(srna, "animation_data", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "adt");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this datablock");
+ RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this datablock");
}
void rna_def_animdata(BlenderRNA *brna)
@@ -821,7 +836,8 @@ void rna_def_animdata(BlenderRNA *brna)
/* Active Action */
prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE); /* this flag as well as the dynamic test must be defined for this to be editable... */
+ /* 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_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");
@@ -831,20 +847,23 @@ void rna_def_animdata(BlenderRNA *brna)
prop = RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "act_extendmode");
RNA_def_property_enum_items(prop, nla_mode_extend_items);
- RNA_def_property_ui_text(prop, "Action Extrapolation", "Action to take for gaps past the Active Action's range (when evaluating with NLA)");
+ RNA_def_property_ui_text(prop, "Action Extrapolation",
+ "Action to take for gaps past the Active Action's range (when evaluating with NLA)");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
prop = RNA_def_property(srna, "action_blend_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "act_blendmode");
RNA_def_property_enum_items(prop, nla_mode_blend_items);
- RNA_def_property_ui_text(prop, "Action Blending", "Method used for combining Active Action's result with result of NLA stack");
+ RNA_def_property_ui_text(prop, "Action Blending",
+ "Method used for combining Active Action's result with result of NLA stack");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
prop = RNA_def_property(srna, "action_influence", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "act_influence");
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Action Influence", "Amount the Active Action contributes to the result of the NLA stack");
+ RNA_def_property_ui_text(prop, "Action Influence",
+ "Amount the Active Action contributes to the result of the NLA stack");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
/* Drivers */
diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c
index f47f8eb88cf..c3c4a1355fd 100644
--- a/source/blender/makesrna/intern/rna_animation_api.c
+++ b/source/blender/makesrna/intern/rna_animation_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Joshua Leung
*
* ***** END GPL LICENSE BLOCK *****
@@ -74,9 +74,10 @@ void RNA_api_keyingset(StructRNA *srna)
/* validate relative Keying Set (used to ensure paths are ok for context) */
func = RNA_def_function(srna, "refresh", "rna_KeyingSet_context_refresh");
- RNA_def_function_ui_description(func, "Refresh Keying Set to ensure that it is valid for the current context. Call before each use of one");
+ RNA_def_function_ui_description(func,
+ "Refresh Keying Set to ensure that it is valid for the current context "
+ "(call before each use of one)");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c
index adc3640dae4..f7065307d87 100644
--- a/source/blender/makesrna/intern/rna_animviz.c
+++ b/source/blender/makesrna/intern/rna_animviz.c
@@ -92,7 +92,7 @@ void rna_def_motionpath_common(StructRNA *srna)
prop = RNA_def_property(srna, "motion_path", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "mpath");
- RNA_def_property_ui_text(prop, "Motion Path", "Motion Path for this element");
+ RNA_def_property_ui_text(prop, "Motion Path", "Motion Path for this element");
}
static void rna_def_animviz_motionpath_vert(BlenderRNA *brna)
@@ -147,7 +147,8 @@ static void rna_def_animviz_motion_path(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_bone_head", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_BHEAD);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* xxx */
- RNA_def_property_ui_text(prop, "Use Bone Heads", "For PoseBone paths, use the bone head location when calculating this path");
+ RNA_def_property_ui_text(prop, "Use Bone Heads",
+ "For PoseBone paths, use the bone head location when calculating this path");
prop = RNA_def_property(srna, "is_modified", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_EDIT);
@@ -184,39 +185,49 @@ static void rna_def_animviz_ghosts(BlenderRNA *brna)
/* Settings */
prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ghost_flag", GHOST_FLAG_ONLYSEL);
- RNA_def_property_ui_text(prop, "On Selected Bones Only", "For Pose-Mode drawing, only draw ghosts for selected bones");
+ RNA_def_property_ui_text(prop, "On Selected Bones Only",
+ "For Pose-Mode drawing, only draw ghosts for selected bones");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "ghost_step");
RNA_def_property_range(prop, 1, 20);
- RNA_def_property_ui_text(prop, "Frame Step", "Number of frames between ghosts shown (not for 'On Keyframes' Onion-skinning method)");
+ RNA_def_property_ui_text(prop, "Frame Step",
+ "Number of frames between ghosts shown (not for 'On Keyframes' Onion-skinning method)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
/* Playback Ranges */
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "ghost_sf");
RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_ghost_start_frame_set", NULL);
- RNA_def_property_ui_text(prop, "Start Frame", "Starting frame of range of Ghosts to display (not for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_ui_text(prop, "Start Frame",
+ "Starting frame of range of Ghosts to display "
+ "(not for 'Around Current Frame' Onion-skinning method)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "ghost_ef");
RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_ghost_end_frame_set", NULL);
- RNA_def_property_ui_text(prop, "End Frame", "End frame of range of Ghosts to display (not for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_ui_text(prop, "End Frame",
+ "End frame of range of Ghosts to display "
+ "(not for 'Around Current Frame' Onion-skinning method)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
/* Around Current Ranges */
prop = RNA_def_property(srna, "frame_before", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "ghost_bc");
RNA_def_property_range(prop, 0, 30);
- RNA_def_property_ui_text(prop, "Before Current", "Number of frames to show before the current frame (only for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_ui_text(prop, "Before Current",
+ "Number of frames to show before the current frame "
+ "(only for 'Around Current Frame' Onion-skinning method)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
prop = RNA_def_property(srna, "frame_after", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "ghost_ac");
RNA_def_property_range(prop, 0, 30);
- RNA_def_property_ui_text(prop, "After Current", "Number of frames to show after the current frame (only for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_ui_text(prop, "After Current",
+ "Number of frames to show after the current frame "
+ "(only for 'Around Current Frame' Onion-skinning method)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
}
@@ -226,7 +237,8 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem prop_type_items[] = {
- {MOTIONPATH_TYPE_ACFRA, "CURRENT_FRAME", 0, "Around Frame", "Display Paths of poses within a fixed number of frames around the current frame"},
+ {MOTIONPATH_TYPE_ACFRA, "CURRENT_FRAME", 0, "Around Frame",
+ "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[] = {
@@ -270,13 +282,16 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_keyframe_action_all", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFACT);
- RNA_def_property_ui_text(prop, "All Action Keyframes", "For bone motion paths, search whole Action for keyframes instead of in group with matching name only (is slower)");
+ RNA_def_property_ui_text(prop, "All Action Keyframes",
+ "For bone motion paths, search whole Action for keyframes instead of in group"
+ " with matching name only (is slower)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "path_step");
RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_text(prop, "Frame Step", "Number of frames between paths shown (not for 'On Keyframes' Onion-skinning method)");
+ RNA_def_property_ui_text(prop, "Frame Step",
+ "Number of frames between paths shown (not for 'On Keyframes' Onion-skinning method)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
@@ -284,26 +299,34 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "path_sf");
RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_path_start_frame_set", NULL);
- RNA_def_property_ui_text(prop, "Start Frame", "Starting frame of range of paths to display/calculate (not for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_ui_text(prop, "Start Frame",
+ "Starting frame of range of paths to display/calculate "
+ "(not for 'Around Current Frame' Onion-skinning method)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "path_ef");
RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_path_end_frame_set", NULL);
- RNA_def_property_ui_text(prop, "End Frame", "End frame of range of paths to display/calculate (not for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_ui_text(prop, "End Frame",
+ "End frame of range of paths to display/calculate "
+ "(not for 'Around Current Frame' Onion-skinning method)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
/* Around Current Ranges */
prop = RNA_def_property(srna, "frame_before", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "path_bc");
RNA_def_property_range(prop, 1, MAXFRAMEF/2);
- RNA_def_property_ui_text(prop, "Before Current", "Number of frames to show before the current frame (only for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_ui_text(prop, "Before Current",
+ "Number of frames to show before the current frame "
+ "(only for 'Around Current Frame' Onion-skinning method)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
prop = RNA_def_property(srna, "frame_after", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "path_ac");
RNA_def_property_range(prop, 1, MAXFRAMEF/2);
- RNA_def_property_ui_text(prop, "After Current", "Number of frames to show after the current frame (only for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_ui_text(prop, "After Current",
+ "Number of frames to show after the current frame "
+ "(only for 'Around Current Frame' Onion-skinning method)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
}
@@ -316,7 +339,7 @@ void rna_def_animviz_common(StructRNA *srna)
prop = RNA_def_property(srna, "animation_visualisation", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "avs");
- RNA_def_property_ui_text(prop, "Animation Visualisation", "Animation data for this datablock");
+ RNA_def_property_ui_text(prop, "Animation Visualisation", "Animation data for this datablock");
}
static void rna_def_animviz(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index b6d07d079f1..208d69f82b8 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -238,7 +238,7 @@ static void rna_Armature_ghost_start_frame_set(PointerRNA *ptr, int value)
data->ghostsf = value;
if (data->ghostsf >= data->ghostef) {
- data->ghostef = MIN2(data->ghostsf + 1, (int)(MAXFRAMEF/2));
+ data->ghostef = MIN2(data->ghostsf, (int)(MAXFRAMEF/2));
}
}
@@ -249,7 +249,7 @@ static void rna_Armature_ghost_end_frame_set(PointerRNA *ptr, int value)
data->ghostef = value;
if (data->ghostsf >= data->ghostef) {
- data->ghostsf = MAX2(data->ghostef - 1, 1);
+ data->ghostsf = MAX2(data->ghostef, 1);
}
}
/* XXX depreceated... old armature only animviz */
@@ -494,7 +494,8 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
prop = RNA_def_property(srna, "use_cyclic_offset", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_CYCLICOFFSET);
- RNA_def_property_ui_text(prop, "Cyclic Offset", "When bone doesn't have a parent, it receives cyclic offset effects");
+ RNA_def_property_ui_text(prop, "Cyclic Offset",
+ "When bone doesn't have a parent, it receives cyclic offset effects");
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
@@ -520,7 +521,8 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
if (editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
else RNA_def_property_update(prop, 0, "rna_Armature_update_data");
RNA_def_property_float_sdna(prop, NULL, "rad_head");
- /*RNA_def_property_range(prop, 0, 1000); *//* XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid); */
+ /* XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid); */
+ /*RNA_def_property_range(prop, 0, 1000); */
RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
RNA_def_property_ui_text(prop, "Envelope Head Radius", "Radius of head of bone (for Envelope deform only)");
@@ -528,7 +530,8 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
if (editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
else RNA_def_property_update(prop, 0, "rna_Armature_update_data");
RNA_def_property_float_sdna(prop, NULL, "rad_tail");
- /*RNA_def_property_range(prop, 0, 1000); *//* XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid); */
+ /* XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid); */
+ /*RNA_def_property_range(prop, 0, 1000); */
RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
RNA_def_property_ui_text(prop, "Envelope Tail Radius", "Radius of tail of bone (for Envelope deform only)");
@@ -592,10 +595,12 @@ static void rna_def_bone(BlenderRNA *brna)
rna_def_bone_common(srna, 0);
- /* XXX should we define this in PoseChannel wrapping code instead? but PoseChannels directly get some of their flags from here... */
+ /* XXX should we define this in PoseChannel wrapping code instead?
+ * But PoseChannels directly get some of their flags from here... */
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_P);
- RNA_def_property_ui_text(prop, "Hide", "Bone is not visible when it is not in Edit Mode (i.e. in Object or Pose Modes)");
+ RNA_def_property_ui_text(prop, "Hide",
+ "Bone is not visible when it is not in Edit Mode (i.e. in Object or Pose Modes)");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
@@ -736,7 +741,8 @@ static void rna_def_edit_bone(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */
RNA_def_property_ui_text(prop, "Editbone Matrix", "Read-only matrix calculated from the roll (armature space)");
- RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", NULL, NULL); /* TODO - this could be made writable also */
+ /* TODO - this could be made writable also */
+ RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", NULL, NULL);
RNA_api_armature_edit_bone(srna);
@@ -824,7 +830,8 @@ static void rna_def_armature(BlenderRNA *brna)
{ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)"},
{ARM_LINE, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"},
{ARM_B_BONE, "BBONE", 0, "B-Bone", "Display bones as boxes, showing subdivision and B-Splines"},
- {ARM_ENVELOPE, "ENVELOPE", 0, "Envelope", "Display bones as extruded spheres, showing deformation influence volume"},
+ {ARM_ENVELOPE, "ENVELOPE", 0, "Envelope",
+ "Display bones as extruded spheres, showing deformation influence volume"},
{ARM_WIRE, "WIRE", 0, "Wire", "Display bones as thin wires, showing subdivision and B-Splines"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_vdeformer[] = {
@@ -911,7 +918,8 @@ static void rna_def_armature(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "layer_protected", 1);
RNA_def_property_array(prop, 32);
RNA_def_property_ui_text(prop, "Layer Proxy Protection",
- "Protected layers in Proxy Instances are restored to Proxy settings on file reload and undo");
+ "Protected layers in Proxy Instances are restored to Proxy settings "
+ "on file reload and undo");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
/* flag */
@@ -978,11 +986,14 @@ static void rna_def_armature(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Dual Quaternion Deformation", "Enable deform rotation with Quaternions");
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
- /*prop= RNA_def_property(srna, "deform_invert_vertexgroups", PROP_BOOLEAN, PROP_NONE); */
- /*RNA_def_property_boolean_negative_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP); */
- /*RNA_def_property_ui_text(prop, "Invert Vertex Group Influence", "Invert Vertex Group influence (only for Modifiers)"); */
- /*RNA_def_property_update(prop, 0, "rna_Armature_update_data"); */
-
+#if 0
+ prop = RNA_def_property(srna, "deform_invert_vertexgroups", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert Vertex Group Influence",
+ "Invert Vertex Group influence (only for Modifiers)");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+#endif
+
/* Number fields */
/* XXX depreceated ....... old animviz for armatures only */
/* ghost/onionskining settings */
@@ -1016,10 +1027,11 @@ static void rna_def_armature(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "ghostef");
RNA_def_property_int_funcs(prop, NULL, "rna_Armature_ghost_end_frame_set", NULL);
RNA_def_property_ui_text(prop, "Ghosting End Frame",
- "End frame of range of Ghosts to display (not for 'Around Current Frame' Onion-skinning method)");
+ "End frame of range of Ghosts to display "
+ "(not for 'Around Current Frame' Onion-skinning method)");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-/* XXX depreceated ....... old animviz for armatures only */
+/* XXX depreceated ....... old animviz for armatures only */
}
void RNA_def_armature(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_armature_api.c b/source/blender/makesrna/intern/rna_armature_api.c
index 08c0a5b54aa..4a872dca952 100644
--- a/source/blender/makesrna/intern/rna_armature_api.c
+++ b/source/blender/makesrna/intern/rna_armature_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
@@ -50,7 +50,8 @@ void rna_EditBone_align_roll(EditBone *ebo, float no[3])
float rna_Bone_do_envelope(Bone *bone, float *vec)
{
float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
- return distfactor_to_bone(vec, bone->arm_head, bone->arm_tail, bone->rad_head * scale, bone->rad_tail * scale, bone->dist * scale);
+ return distfactor_to_bone(vec, bone->arm_head, bone->arm_tail, bone->rad_head * scale,
+ bone->rad_tail * scale, bone->dist * scale);
}
#else
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c
index 0db401334cd..3767a019a62 100644
--- a/source/blender/makesrna/intern/rna_boid.c
+++ b/source/blender/makesrna/intern/rna_boid.c
@@ -49,20 +49,28 @@
EnumPropertyItem boidrule_type_items[] = {
{eBoidRuleType_Goal, "GOAL", 0, "Goal", "Go to assigned object or loudest assigned signal source"},
{eBoidRuleType_Avoid, "AVOID", 0, "Avoid", "Get away from assigned object or loudest assigned signal source"},
- {eBoidRuleType_AvoidCollision, "AVOID_COLLISION", 0, "Avoid Collision", "Manoeuvre to avoid collisions with other boids and deflector objects in near future"},
+ {eBoidRuleType_AvoidCollision, "AVOID_COLLISION", 0, "Avoid Collision",
+ "Manoeuvre to avoid collisions with other boids and deflector objects in "
+ "near future"},
{eBoidRuleType_Separate, "SEPARATE", 0, "Separate", "Keep from going through other boids"},
{eBoidRuleType_Flock, "FLOCK", 0, "Flock", "Move to center of neighbors and match their velocity"},
{eBoidRuleType_FollowLeader, "FOLLOW_LEADER", 0, "Follow Leader", "Follow a boid or assigned object"},
{eBoidRuleType_AverageSpeed, "AVERAGE_SPEED", 0, "Average Speed", "Maintain speed, flight level or wander"},
{eBoidRuleType_Fight, "FIGHT", 0, "Fight", "Go to closest enemy and attack when in range"},
- /*{eBoidRuleType_Protect, "PROTECT", 0, "Protect", "Go to enemy closest to target and attack when in range"}, */
- /*{eBoidRuleType_Hide, "HIDE", 0, "Hide", "Find a deflector move to it's other side from closest enemy"}, */
- /*{eBoidRuleType_FollowPath, "FOLLOW_PATH", 0, "Follow Path", "Move along a assigned curve or closest curve in a group"}, */
- /*{eBoidRuleType_FollowWall, "FOLLOW_WALL", 0, "Follow Wall", "Move next to a deflector object's in direction of it's tangent"}, */
+#if 0
+ {eBoidRuleType_Protect, "PROTECT", 0, "Protect", "Go to enemy closest to target and attack when in range"},
+ {eBoidRuleType_Hide, "HIDE", 0, "Hide", "Find a deflector move to it's other side from closest enemy"},
+ {eBoidRuleType_FollowPath, "FOLLOW_PATH", 0, "Follow Path",
+ "Move along a assigned curve or closest curve in a group"},
+ {eBoidRuleType_FollowWall, "FOLLOW_WALL", 0, "Follow Wall",
+ "Move next to a deflector object's in direction of it's tangent"},
+#endif
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem boidruleset_type_items[] = {
- {eBoidRulesetType_Fuzzy, "FUZZY", 0, "Fuzzy", "Rules are gone through top to bottom. Only the first rule that effect above fuzziness threshold is evaluated"},
+ {eBoidRulesetType_Fuzzy, "FUZZY", 0, "Fuzzy",
+ "Rules are gone through top to bottom (only the first rule which effect is above "
+ "fuzziness threshold is evaluated)"},
{eBoidRulesetType_Random, "RANDOM", 0, "Random", "A random rule is selected for each boid"},
{eBoidRulesetType_Average, "AVERAGE", 0, "Average", "All rules are averaged"},
{0, NULL, 0, NULL, NULL}};
@@ -464,7 +472,9 @@ static void rna_def_boidstate(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active Boid Rule", "");
prop = RNA_def_property(srna, "active_boid_rule_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_BoidState_active_boid_rule_index_get", "rna_BoidState_active_boid_rule_index_set", "rna_BoidState_active_boid_rule_index_range");
+ RNA_def_property_int_funcs(prop, "rna_BoidState_active_boid_rule_index_get",
+ "rna_BoidState_active_boid_rule_index_set",
+ "rna_BoidState_active_boid_rule_index_range");
RNA_def_property_ui_text(prop, "Active Boid Rule Index", "");
prop = RNA_def_property(srna, "rule_fuzzy", PROP_FLOAT, PROP_NONE);
@@ -526,7 +536,9 @@ static void rna_def_boid_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active Boid Rule", "");
prop = RNA_def_property(srna, "active_boid_state_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_BoidSettings_active_boid_state_index_get", "rna_BoidSettings_active_boid_state_index_set", "rna_BoidSettings_active_boid_state_index_range");
+ RNA_def_property_int_funcs(prop, "rna_BoidSettings_active_boid_state_index_get",
+ "rna_BoidSettings_active_boid_state_index_set",
+ "rna_BoidSettings_active_boid_state_index_range");
RNA_def_property_ui_text(prop, "Active Boid State Index", "");
/* character properties */
@@ -577,7 +589,8 @@ static void rna_def_boid_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "air_ave_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "air_max_ave");
RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Max Air Angular Velocity", "Maximum angular velocity in air (relative to 180 degrees)");
+ RNA_def_property_ui_text(prop, "Max Air Angular Velocity",
+ "Maximum angular velocity in air (relative to 180 degrees)");
RNA_def_property_update(prop, 0, "rna_Boids_reset");
prop = RNA_def_property(srna, "air_personal_space", PROP_FLOAT, PROP_NONE);
@@ -599,18 +612,21 @@ static void rna_def_boid_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "land_acc_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "land_max_acc");
RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Max Land Acceleration", "Maximum acceleration on land (relative to maximum speed)");
+ RNA_def_property_ui_text(prop, "Max Land Acceleration",
+ "Maximum acceleration on land (relative to maximum speed)");
RNA_def_property_update(prop, 0, "rna_Boids_reset");
prop = RNA_def_property(srna, "land_ave_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "land_max_ave");
RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Max Land Angular Velocity", "Maximum angular velocity on land (relative to 180 degrees)");
+ RNA_def_property_ui_text(prop, "Max Land Angular Velocity",
+ "Maximum angular velocity on land (relative to 180 degrees)");
RNA_def_property_update(prop, 0, "rna_Boids_reset");
prop = RNA_def_property(srna, "land_personal_space", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_text(prop, "Land Personal Space", "Radius of boids personal space on land (% of particle size)");
+ RNA_def_property_ui_text(prop, "Land Personal Space",
+ "Radius of boids personal space on land (% of particle size)");
RNA_def_property_update(prop, 0, "rna_Boids_reset");
prop = RNA_def_property(srna, "land_stick_force", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 49817e8e4b5..4649ae3f87d 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -51,6 +51,7 @@ static EnumPropertyItem prop_direction_items[] = {
EnumPropertyItem brush_sculpt_tool_items[] = {
{SCULPT_TOOL_BLOB, "BLOB", ICON_BRUSH_BLOB, "Blob", ""},
{SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""},
+ {SCULPT_TOOL_CLAY_STRIPS, "CLAY_STRIPS", ICON_BRUSH_CLAY_STRIPS, "Clay Strips", ""},
{SCULPT_TOOL_CREASE, "CREASE",ICON_BRUSH_CREASE, "Crease", ""},
{SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""},
{SCULPT_TOOL_FILL, "FILL", ICON_BRUSH_FILL, "Fill", ""},
@@ -100,6 +101,126 @@ EnumPropertyItem brush_image_tool_items[] = {
#include "WM_api.h"
+static int rna_SculptCapabilities_has_accumulate_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return ELEM6(br->sculpt_tool,
+ SCULPT_TOOL_BLOB, SCULPT_TOOL_CLAY, SCULPT_TOOL_CREASE,
+ SCULPT_TOOL_DRAW, SCULPT_TOOL_INFLATE, SCULPT_TOOL_LAYER);
+}
+
+static int rna_SculptCapabilities_has_auto_smooth_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return br->sculpt_tool != SCULPT_TOOL_SMOOTH;
+}
+
+static int rna_SculptCapabilities_has_height_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return br->sculpt_tool == SCULPT_TOOL_LAYER;
+}
+
+static int rna_SculptCapabilities_has_jitter_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return (!(br->flag & BRUSH_ANCHORED) &&
+ !(br->flag & BRUSH_RESTORE_MESH) &&
+ !ELEM4(br->sculpt_tool,
+ SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
+}
+
+static int rna_SculptCapabilities_has_normal_weight_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK);
+}
+
+static int rna_SculptCapabilities_has_persistence_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return br->sculpt_tool == SCULPT_TOOL_LAYER;
+}
+
+static int rna_SculptCapabilities_has_pinch_factor_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return ELEM(br->sculpt_tool, SCULPT_TOOL_BLOB, SCULPT_TOOL_CREASE);
+}
+
+static int rna_SculptCapabilities_has_plane_offset_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return ELEM5(br->sculpt_tool, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS,
+ SCULPT_TOOL_FILL, SCULPT_TOOL_FLATTEN, SCULPT_TOOL_SCRAPE);
+}
+
+static int rna_SculptCapabilities_has_random_texture_angle_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return ((br->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) &&
+ !(br->flag & BRUSH_ANCHORED) &&
+ !ELEM4(br->sculpt_tool,
+ SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
+}
+
+static int rna_SculptCapabilities_has_sculpt_plane_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return !ELEM3(br->sculpt_tool, SCULPT_TOOL_INFLATE, SCULPT_TOOL_PINCH,
+ SCULPT_TOOL_SMOOTH);
+}
+
+static int rna_SculptCapabilities_has_secondary_color_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return ELEM10(br->sculpt_tool,
+ SCULPT_TOOL_BLOB, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS,
+ SCULPT_TOOL_CREASE, SCULPT_TOOL_DRAW, SCULPT_TOOL_FILL,
+ SCULPT_TOOL_FLATTEN, SCULPT_TOOL_INFLATE, SCULPT_TOOL_PINCH,
+ SCULPT_TOOL_SCRAPE);
+}
+
+static int rna_SculptCapabilities_has_smooth_stroke_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return (!(br->flag & BRUSH_ANCHORED) &&
+ !(br->flag & BRUSH_RESTORE_MESH) &&
+ !ELEM4(br->sculpt_tool,
+ SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
+}
+
+static int rna_SculptCapabilities_has_space_attenuation_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return ((br->flag & BRUSH_SPACE) &&
+ !ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SMOOTH, SCULPT_TOOL_SNAKE_HOOK));
+}
+
+static int rna_SculptCapabilities_has_spacing_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return (!(br->flag & BRUSH_ANCHORED) &&
+ !ELEM4(br->sculpt_tool,
+ SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
+}
+
+static int rna_SculptCapabilities_has_strength_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush*)ptr->data;
+ return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK);
+}
+
+static PointerRNA rna_Brush_sculpt_capabilities_get(PointerRNA *ptr)
+{
+ return rna_pointer_inherit_refine(ptr, &RNA_SculptCapabilities, ptr->id.data);
+}
+
static void rna_Brush_reset_icon(Brush *br, const char *UNUSED(type))
{
ID *id = &br->id;
@@ -181,7 +302,8 @@ static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value)
brush->unprojected_radius = value;
}
-static EnumPropertyItem *rna_Brush_direction_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Brush_direction_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
static EnumPropertyItem prop_default_items[] = {
{0, NULL, 0, NULL, NULL}};
@@ -271,6 +393,45 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
}
+static void rna_def_sculpt_capabilities(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SculptCapabilities", NULL);
+ RNA_def_struct_sdna(srna, "Brush");
+ RNA_def_struct_nested(brna, srna, "Brush");
+ RNA_def_struct_ui_text(srna, "Sculpt Capabilities",
+ "Read-only indications of which brush operations "
+ "are supported by the current sculpt tool");
+
+#define BRUSH_CAPABILITY(prop_name_, ui_name_) \
+ prop = RNA_def_property(srna, #prop_name_, \
+ PROP_BOOLEAN, PROP_NONE); \
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
+ RNA_def_property_boolean_funcs(prop, "rna_SculptCapabilities_" \
+ #prop_name_ "_get", NULL); \
+ RNA_def_property_ui_text(prop, ui_name_, NULL)
+
+ BRUSH_CAPABILITY(has_accumulate, "Has Accumulate");
+ BRUSH_CAPABILITY(has_auto_smooth, "Has Auto Smooth");
+ BRUSH_CAPABILITY(has_height, "Has Height");
+ BRUSH_CAPABILITY(has_jitter, "Has Jitter");
+ BRUSH_CAPABILITY(has_normal_weight, "Has Crease/Pinch Factor");
+ BRUSH_CAPABILITY(has_persistence, "Has Persistence");
+ BRUSH_CAPABILITY(has_pinch_factor, "Has Pinch Factor");
+ BRUSH_CAPABILITY(has_plane_offset, "Has Plane Offset");
+ BRUSH_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle");
+ BRUSH_CAPABILITY(has_sculpt_plane, "Has Sculpt Plane");
+ BRUSH_CAPABILITY(has_secondary_color, "Has Secondary Color");
+ BRUSH_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke");
+ BRUSH_CAPABILITY(has_space_attenuation, "Has Space Attenuation");
+ BRUSH_CAPABILITY(has_spacing, "Has Spacing");
+ BRUSH_CAPABILITY(has_strength, "Has Strength");
+
+#undef SCULPT_CAPABILITY
+}
+
static void rna_def_brush(BlenderRNA *brna)
{
StructRNA *srna;
@@ -435,14 +596,16 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_float_default(prop, 0);
RNA_def_property_range(prop, -2.0f, 2.0f);
RNA_def_property_ui_range(prop, -0.5f, 0.5f, 0.001, 0.001);
- RNA_def_property_ui_text(prop, "Plane Offset", "Adjust plane on which the brush acts towards or away from the object surface");
+ RNA_def_property_ui_text(prop, "Plane Offset",
+ "Adjust plane on which the brush acts towards or away from the object surface");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "plane_trim", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "plane_trim");
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_range(prop, 0, 1.0f);
- RNA_def_property_ui_text(prop, "Plane Trim", "If a vertex is further away from offset plane than this, then it is not affected");
+ RNA_def_property_ui_text(prop, "Plane Trim",
+ "If a vertex is further away from offset plane than this, then it is not affected");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
@@ -489,7 +652,8 @@ static void rna_def_brush(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_original_normal", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ORIGINAL_NORMAL);
- RNA_def_property_ui_text(prop, "Original Normal", "When locked keep using normal of surface where stroke was initiated");
+ RNA_def_property_ui_text(prop, "Original Normal",
+ "When locked keep using normal of surface where stroke was initiated");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
@@ -578,20 +742,24 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Accumulate", "Accumulate stroke daubs on top of each other");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop = RNA_def_property(srna, "use_space_atten", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_space_attenuation", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE_ATTEN);
- RNA_def_property_ui_text(prop, "Use Automatic Strength Adjustment", "Automatically adjust strength to give consistent results for different spacings");
+ RNA_def_property_ui_text(prop, "Use Automatic Strength Adjustment",
+ "Automatically adjust strength to give consistent results for different spacings");
RNA_def_property_update(prop, 0, "rna_Brush_update");
/* adaptive space is not implemented yet */
prop = RNA_def_property(srna, "use_adaptive_space", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ADAPTIVE_SPACE);
- RNA_def_property_ui_text(prop, "Adaptive Spacing", "Space daubs according to surface orientation instead of screen space");
+ RNA_def_property_ui_text(prop, "Adaptive Spacing",
+ "Space daubs according to surface orientation instead of screen space");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_LOCK_SIZE);
- RNA_def_property_ui_text(prop, "Use Blender Units", "When locked brush stays same size relative to object; when unlocked brush size is given in pixels");
+ RNA_def_property_ui_text(prop, "Use Blender Units",
+ "When locked brush stays same size relative to object; when unlocked brush size is "
+ "given in pixels");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "use_texture_overlay", PROP_BOOLEAN, PROP_NONE);
@@ -636,11 +804,11 @@ static void rna_def_brush(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_paint_weight", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_WEIGHT_PAINT);
- RNA_def_property_ui_text(prop, "Use Weight", "Use this brush in weight paint mode");
+ RNA_def_property_ui_text(prop, "Use Weight", "Use this brush in weight paint mode");
prop = RNA_def_property(srna, "use_paint_image", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_TEXTURE_PAINT);
- RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode");
+ RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode");
/* texture */
prop = RNA_def_property(srna, "texture_slot", PROP_POINTER, PROP_NONE);
@@ -701,6 +869,13 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Clone Offset", "");
RNA_def_property_ui_range(prop, -1.0f , 1.0f, 10.0f, 3);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_update");
+
+ /* brush capabilities (mode-dependent) */
+ prop = RNA_def_property(srna, "sculpt_capabilities", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "SculptCapabilities");
+ RNA_def_property_pointer_funcs(prop, "rna_Brush_sculpt_capabilities_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Sculpt Capabilities", "Brush's capabilities in sculpt mode");
}
@@ -754,12 +929,14 @@ static void rna_def_operator_stroke_element(BlenderRNA *brna)
/* XXX: Tool (this will be for pressing a modifier key for a different brush,
e.g. switching to a Smooth brush in the middle of the stroke */
- /* XXX: i don't think blender currently supports the ability to properly do a remappable modifier in the middle of a stroke */
+ /* XXX: i don't think blender currently supports the ability to properly do a remappable modifier
+ * in the middle of a stroke */
}
void RNA_def_brush(BlenderRNA *brna)
{
rna_def_brush(brna);
+ rna_def_sculpt_capabilities(brna);
rna_def_brush_texture_slot(brna);
rna_def_operator_stroke_element(brna);
}
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index 084e299140d..180479d6f63 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -247,7 +247,8 @@ void RNA_def_camera(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_passepartout", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWPASSEPARTOUT);
- RNA_def_property_ui_text(prop, "Show Passepartout", "Show a darkened overlay outside the image area in Camera view");
+ RNA_def_property_ui_text(prop, "Show Passepartout",
+ "Show a darkened overlay outside the image area in Camera view");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
prop = RNA_def_property(srna, "show_title_safe", PROP_BOOLEAN, PROP_NONE);
@@ -272,7 +273,8 @@ void RNA_def_camera(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_panorama", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_PANORAMA);
- RNA_def_property_ui_text(prop, "Panorama", "Render the scene with a cylindrical camera for pseudo-fisheye lens effects");
+ RNA_def_property_ui_text(prop, "Panorama",
+ "Render the scene with a cylindrical camera for pseudo-fisheye lens effects");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
/* pointers */
@@ -290,4 +292,3 @@ void RNA_def_camera(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_camera_api.c b/source/blender/makesrna/intern/rna_camera_api.c
index 3cd33be1b86..14391e74239 100644
--- a/source/blender/makesrna/intern/rna_camera_api.c
+++ b/source/blender/makesrna/intern/rna_camera_api.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
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index 34a9dc592b9..2f6a31ff8ee 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -222,19 +222,22 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "mingoal");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Goal Minimum", "Goal minimum, vertex group weights are scaled to match this range");
+ RNA_def_property_ui_text(prop, "Goal Minimum",
+ "Goal minimum, vertex group weights are scaled to match this range");
RNA_def_property_update(prop, 0, "rna_cloth_update");
prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "maxgoal");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Goal Maximum", "Goal maximum, vertex group weights are scaled to match this range");
+ RNA_def_property_ui_text(prop, "Goal Maximum",
+ "Goal maximum, vertex group weights are scaled to match this range");
RNA_def_property_update(prop, 0, "rna_cloth_update");
prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "defgoal");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value, when no Vertex Group used");
+ RNA_def_property_ui_text(prop, "Goal Default",
+ "Default Goal (vertex target position) value, when no Vertex Group used");
RNA_def_property_update(prop, 0, "rna_cloth_update");
prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
@@ -328,7 +331,8 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "spring_damping", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "Cdis");
RNA_def_property_range(prop, 0.0f, 50.0f);
- RNA_def_property_ui_text(prop, "Spring Damping", "Damping of cloth velocity (higher = more smooth, less jiggling)");
+ RNA_def_property_ui_text(prop, "Spring Damping",
+ "Damping of cloth velocity (higher = more smooth, less jiggling)");
RNA_def_property_update(prop, 0, "rna_cloth_update");
prop = RNA_def_property(srna, "structural_stiffness", PROP_FLOAT, PROP_NONE);
@@ -345,7 +349,8 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_cloth_update");
prop = RNA_def_property(srna, "vertex_group_structural_stiffness", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ClothSettings_struct_vgroup_get", "rna_ClothSettings_struct_vgroup_length",
+ RNA_def_property_string_funcs(prop, "rna_ClothSettings_struct_vgroup_get",
+ "rna_ClothSettings_struct_vgroup_length",
"rna_ClothSettings_struct_vgroup_set");
RNA_def_property_ui_text(prop, "Structural Stiffness Vertex Group",
"Vertex group for fine control over structural stiffness");
@@ -354,7 +359,8 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "bending_stiffness", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "bending");
RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Bending Stiffness", "Wrinkle coefficient (higher = less smaller but more big wrinkles)");
+ RNA_def_property_ui_text(prop, "Bending Stiffness",
+ "Wrinkle coefficient (higher = less smaller but more big wrinkles)");
RNA_def_property_update(prop, 0, "rna_cloth_update");
prop = RNA_def_property(srna, "bending_stiffness_max", PROP_FLOAT, PROP_NONE);
@@ -367,7 +373,8 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "vertex_group_bending", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_ClothSettings_bend_vgroup_get", "rna_ClothSettings_bend_vgroup_length",
"rna_ClothSettings_bend_vgroup_set");
- RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group", "Vertex group for fine control over bending stiffness");
+ RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group",
+ "Vertex group for fine control over bending stiffness");
RNA_def_property_update(prop, 0, "rna_cloth_update");
prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
@@ -501,7 +508,8 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "self_loop_count");
RNA_def_property_range(prop, 1, 10);
RNA_def_property_ui_text(prop, "Self Collision Quality",
- "How many self collision iterations should be done (higher is better quality but slower)");
+ "How many self collision iterations should be done "
+ "(higher is better quality but slower)");
RNA_def_property_update(prop, 0, "rna_cloth_update");
prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
@@ -517,4 +525,3 @@ void RNA_def_cloth(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index 0d141387deb..1cb286d972a 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -141,11 +141,11 @@ static char *rna_ColorRamp_path(PointerRNA *ptr)
ID *id = ptr->id.data;
switch (GS(id->name)) {
- case ID_MA: /* material has 2 cases - diffuse and specular */
+ case ID_MA: /* material has 2 cases - diffuse and specular */
{
Material *ma = (Material*)id;
- if (ptr->data == ma->ramp_col)
+ if (ptr->data == ma->ramp_col)
return BLI_strdup("diffuse_ramp");
else if (ptr->data == ma->ramp_spec)
return BLI_strdup("specular_ramp");
@@ -173,18 +173,18 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr)
char *path = NULL;
int index;
- /* helper macro for use here to try and get the path
+ /* helper macro for use here to try and get the path
* - this calls the standard code for getting a path to a texture...
*/
#define COLRAMP_GETPATH \
{ \
- prop = RNA_struct_find_property(&ramp_ptr, "elements"); \
+ prop = RNA_struct_find_property(&ramp_ptr, "elements"); \
if (prop) { \
- index = RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr); \
+ index = RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr); \
if (index >= 0) { \
- char *texture_path = rna_ColorRamp_path(&ramp_ptr); \
- path = BLI_sprintfN("%s.elements[%d]", texture_path, index); \
+ char *texture_path = rna_ColorRamp_path(&ramp_ptr); \
+ path = BLI_sprintfN("%s.elements[%d]", texture_path, index); \
MEM_freeN(texture_path); \
} \
} \
@@ -214,7 +214,7 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr)
break;
/* TODO: node trees need special attention */
- case ID_NT:
+ case ID_NT:
{
bNodeTree *ntree = (bNodeTree *)id;
bNode *node;
@@ -402,7 +402,9 @@ static void rna_def_curvemapping(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "CurveMapping", NULL);
- RNA_def_struct_ui_text(srna, "CurveMapping", "Curve mapping to map color, vector and scalar values to other values using a user defined curve");
+ RNA_def_struct_ui_text(srna, "CurveMapping",
+ "Curve mapping to map color, vector and scalar values to other values using "
+ "a user defined curve");
prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_DO_CLIP);
@@ -434,7 +436,9 @@ static void rna_def_curvemapping(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range");
prop = RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_CurveMapping_curves_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_get",
+ "rna_CurveMapping_curves_length", NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "CurveMap");
RNA_def_property_ui_text(prop, "Curves", "");
@@ -550,7 +554,8 @@ static void rna_def_color_ramp(BlenderRNA *brna)
prop = RNA_def_float(func, "position", 1.0f, 0.0f, 1.0f, "Position", "Evaluate ColorRamp at position", 0.0f, 1.0f);
RNA_def_property_flag(prop, PROP_REQUIRED);
/* return */
- prop = RNA_def_float_color(func, "color", 4, NULL, -FLT_MAX, FLT_MAX, "Color", "Color at given position", -FLT_MAX, FLT_MAX);
+ prop = RNA_def_float_color(func, "color", 4, NULL, -FLT_MAX, FLT_MAX, "Color", "Color at given position",
+ -FLT_MAX, FLT_MAX);
RNA_def_property_flag(prop, PROP_THICK_WRAP);
RNA_def_function_output(func, prop);
}
@@ -641,4 +646,3 @@ void RNA_def_color(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 883b72ef832..8c219e94407 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -60,12 +60,15 @@ EnumPropertyItem constraint_type_items[] = {
{CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", ICON_CONSTRAINT_DATA, "Transformation", ""},
{0, "", 0, "Tracking", ""},
{CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", ICON_CONSTRAINT_DATA, "Clamp To", ""},
- {CONSTRAINT_TYPE_DAMPTRACK, "DAMPED_TRACK", ICON_CONSTRAINT_DATA, "Damped Track", "Tracking by taking the shortest path"},
+ {CONSTRAINT_TYPE_DAMPTRACK, "DAMPED_TRACK", ICON_CONSTRAINT_DATA, "Damped Track",
+ "Tracking by taking the shortest path"},
{CONSTRAINT_TYPE_KINEMATIC, "IK", ICON_CONSTRAINT_DATA, "Inverse Kinematics", ""},
- {CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", ICON_CONSTRAINT_DATA, "Locked Track", "Tracking along a single axis"},
+ {CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", ICON_CONSTRAINT_DATA, "Locked Track",
+ "Tracking along a single axis"},
{CONSTRAINT_TYPE_SPLINEIK, "SPLINE_IK", ICON_CONSTRAINT_DATA, "Spline IK", ""},
{CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO",ICON_CONSTRAINT_DATA, "Stretch To", ""},
- {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To", "Legacy tracking constraint prone to twisting artifacts"},
+ {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To",
+ "Legacy tracking constraint prone to twisting artifacts"},
{0, "", 0, "Relationship", ""},
{CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT_DATA, "Action", ""},
{CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", ICON_CONSTRAINT_DATA, "Child Of", ""},
@@ -78,24 +81,39 @@ EnumPropertyItem constraint_type_items[] = {
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem target_space_pchan_items[] = {
- {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world coordinate system"},
- {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space", "The transformation of the target is only evaluated in the Pose Space, the target armature object transformation is ignored"},
- {CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent", "The transformation of the target bone is evaluated relative its local coordinate system, with the parent transformation added"},
- {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", "The transformation of the target is evaluated relative to its local coordinate system"},
+ {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space",
+ "The transformation of the target is evaluated relative to the world "
+ "coordinate system"},
+ {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space",
+ "The transformation of the target is only evaluated in the Pose Space, "
+ "the target armature object transformation is ignored"},
+ {CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent",
+ "The transformation of the target bone is evaluated relative its local "
+ "coordinate system, with the parent transformation added"},
+ {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
+ "The transformation of the target is evaluated relative to its local "
+ "coordinate system"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem owner_space_pchan_items[] = {
- {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The constraint is applied relative to the world coordinate system"},
- {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space", "The constraint is applied in Pose Space, the object transformation is ignored"},
- {CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent", "The constraint is applied relative to the local coordinate system of the object, with the parent transformation added"},
- {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", "The constraint is applied relative to the local coordinate sytem of the object"},
+ {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space",
+ "The constraint is applied relative to the world coordinate system"},
+ {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space",
+ "The constraint is applied in Pose Space, the object transformation is ignored"},
+ {CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent",
+ "The constraint is applied relative to the local coordinate system of the object, "
+ "with the parent transformation added"},
+ {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
+ "The constraint is applied relative to the local coordinate sytem of the object"},
{0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
static EnumPropertyItem space_object_items[] = {
- {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world coordinate system"},
- {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", "The transformation of the target is evaluated relative to its local coordinate system"},
+ {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space",
+ "The transformation of the target is evaluated relative to the world coordinate system"},
+ {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
+ "The transformation of the target is evaluated relative to its local coordinate system"},
{0, NULL, 0, NULL, NULL}};
#include "BKE_animsys.h"
@@ -139,7 +157,7 @@ static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
case CONSTRAINT_TYPE_RIGIDBODYJOINT:
return &RNA_RigidBodyJointConstraint;
case CONSTRAINT_TYPE_CLAMPTO:
- return &RNA_ClampToConstraint;
+ return &RNA_ClampToConstraint;
case CONSTRAINT_TYPE_TRANSFORM:
return &RNA_TransformConstraint;
case CONSTRAINT_TYPE_ROTLIMIT:
@@ -189,7 +207,7 @@ static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
/* if we have the list, check for unique name, otherwise give up */
if (list)
- unique_constraint_name(con, list);
+ unique_constraint_name(con, list);
}
/* fix all the animation data which may link to this */
@@ -204,7 +222,8 @@ static char *rna_Constraint_path(PointerRNA *ptr)
ListBase *lb = get_constraint_lb(ob, con, &pchan);
if (lb == NULL)
- printf("rna_Constraint_path: internal error, constraint '%s' not found in object '%s'\n", con->name, ob->id.name);
+ printf("rna_Constraint_path: internal error, constraint '%s' not found in object '%s'\n",
+ con->name, ob->id.name);
if (pchan) {
return BLI_sprintfN("pose.bones[\"%s\"].constraints[\"%s\"]", pchan->name, con->name);
@@ -251,7 +270,8 @@ static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value)
}
}
-static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
Object *ob = (Object*)ptr->id.data;
bConstraint *con = (bConstraint*)ptr->data;
@@ -262,7 +282,8 @@ static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C), P
return space_object_items;
}
-static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
bConstraint *con = (bConstraint*)ptr->data;
bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
@@ -295,7 +316,8 @@ static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float
if (ELEM3(acon->type, 0, 1, 2)) {
*min = -180.0f;
*max = 180.0f;
- } else {
+ }
+ else {
*min = -1000.f;
*max = 1000.f;
}
@@ -353,7 +375,8 @@ static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr, PointerRNA va
if (ob->type == OB_CAMERA && ob != (Object*)ptr->id.data) {
data->camera = ob;
}
- } else {
+ }
+ else {
data->camera = NULL;
}
}
@@ -368,7 +391,8 @@ static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr, PointerR
if (ob->type == OB_MESH && ob != (Object*)ptr->id.data) {
data->depth_ob = ob;
}
- } else {
+ }
+ else {
data->depth_ob = NULL;
}
}
@@ -396,7 +420,8 @@ static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr, PointerRNA v
if (ob->type == OB_CAMERA && ob != (Object*)ptr->id.data) {
data->camera = ob;
}
- } else {
+ }
+ else {
data->camera = NULL;
}
}
@@ -404,9 +429,15 @@ static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr, PointerRNA v
#else
EnumPropertyItem constraint_distance_items[] = {
- {LIMITDIST_INSIDE, "LIMITDIST_INSIDE", 0, "Inside", "The object is constrained inside a virtual sphere around the target object, with a radius defined by the limit distance"},
- {LIMITDIST_OUTSIDE, "LIMITDIST_OUTSIDE", 0, "Outside", "The object is constrained outside a virtual sphere around the target object, with a radius defined by the limit distance"},
- {LIMITDIST_ONSURFACE, "LIMITDIST_ONSURFACE", 0, "On Surface", "The object is constrained on the surface of a virtual sphere around the target object, with a radius defined by the limit distance"},
+ {LIMITDIST_INSIDE, "LIMITDIST_INSIDE", 0, "Inside",
+ "The object is constrained inside a virtual sphere around the target object, "
+ "with a radius defined by the limit distance"},
+ {LIMITDIST_OUTSIDE, "LIMITDIST_OUTSIDE", 0, "Outside",
+ "The object is constrained outside a virtual sphere around the target object, "
+ "with a radius defined by the limit distance"},
+ {LIMITDIST_ONSURFACE, "LIMITDIST_ONSURFACE", 0, "On Surface",
+ "The object is constrained on the surface of a virtual sphere around the target object, "
+ "with a radius defined by the limit distance"},
{0, NULL, 0, NULL, NULL}
};
@@ -440,9 +471,9 @@ static void rna_def_constraint_childof(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ChildOfConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Child Of Constraint", "Create constraint-based parent-child relationship");
- RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data");
+ srna = RNA_def_struct(brna, "ChildOfConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Child Of Constraint", "Create constraint-based parent-child relationship");
+ RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data");
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "tar");
@@ -621,7 +652,8 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
prop = RNA_def_property(srna, "reference_axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
RNA_def_property_enum_items(prop, constraint_ik_axisref_items);
- RNA_def_property_ui_text(prop, "Axis Reference", "Constraint axis Lock options relative to Bone or Target reference");
+ RNA_def_property_ui_text(prop, "Axis Reference",
+ "Constraint axis Lock options relative to Bone or Target reference");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop = RNA_def_property(srna, "use_location", PROP_BOOLEAN, PROP_NONE);
@@ -926,7 +958,8 @@ static void rna_def_constraint_same_volume(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", "Maintain a constant volume along a single scaling axis");
+ RNA_def_struct_ui_text(srna, "Maintain Volume Constraint",
+ "Maintain a constant volume along a single scaling axis");
RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
prop = RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
@@ -1055,7 +1088,8 @@ static void rna_def_constraint_action(BlenderRNA *brna)
prop = RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, transform_channel_items);
- RNA_def_property_ui_text(prop, "Transform Channel", "Transformation channel from the target that is used to key the Action");
+ RNA_def_property_ui_text(prop, "Transform Channel",
+ "Transformation channel from the target that is used to key the Action");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
@@ -1112,7 +1146,8 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Locked Track Constraint", "Point toward the target along the track axis, while locking the other axis");
+ RNA_def_struct_ui_text(srna, "Locked Track Constraint",
+ "Point toward the target along the track axis, while locking the other axis");
prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -1206,7 +1241,9 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_fixed_location", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_STATIC);
- RNA_def_property_ui_text(prop, "Fixed Position", "Object will stay locked to a single point somewhere along the length of the curve regardless of time");
+ RNA_def_property_ui_text(prop, "Fixed Position",
+ "Object will stay locked to a single point somewhere along the length of the curve "
+ "regardless of time");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
@@ -1285,8 +1322,10 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
static EnumPropertyItem pivot_items[] = {
{CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allow rotations around all axes"},
{CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Work in one plane, allow rotations around one axis only"},
- {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", "Allow rotations around all axes with limits for the cone and twist axes"},
- {CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF", "No constraints by default, limits can be set individually"},
+ {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist",
+ "Allow rotations around all axes with limits for the cone and twist axes"},
+ {CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF",
+ "No constraints by default, limits can be set individually"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "RigidBodyJointConstraint", "Constraint");
@@ -1459,7 +1498,8 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "ClampToConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Clamp To Constraint", "Constrains an object's location to the nearest point along the target path");
+ RNA_def_struct_ui_text(srna, "Clamp To Constraint",
+ "Constrains an object's location to the nearest point along the target path");
RNA_def_struct_sdna_from(srna, "bClampToConstraint", "data");
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -1899,13 +1939,16 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem type_items[] = {
- {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrink the location to the nearest target surface"},
- {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrink the location to the nearest target surface along a given axis"},
- {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrink the location to the nearest target vertex"},
+ {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point",
+ "Shrink the location to the nearest target surface"},
+ {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project",
+ "Shrink the location to the nearest target surface along a given axis"},
+ {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex",
+ "Shrink the location to the nearest target vertex"},
{0, NULL, 0, NULL, NULL}};
- srna = RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship");
+ srna = RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship");
RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -1958,7 +2001,8 @@ static void rna_def_constraint_damped_track(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Damped Track Constraint", "Point toward target by taking the shortest rotation path");
+ RNA_def_struct_ui_text(srna, "Damped Track Constraint",
+ "Point toward target by taking the shortest rotation path");
prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -1992,8 +2036,10 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna)
static EnumPropertyItem splineik_xz_scale_mode[] = {
{CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes (Default)"},
- {CONSTRAINT_SPLINEIK_XZS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original", "Use the original scaling of the bones"},
- {CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC, "VOLUME_PRESERVE", 0, "Volume Preservation", "Scale of the X and Z axes is the inverse of the Y-Scale"},
+ {CONSTRAINT_SPLINEIK_XZS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original",
+ "Use the original scaling of the bones"},
+ {CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC, "VOLUME_PRESERVE", 0, "Volume Preservation",
+ "Scale of the X and Z axes is the inverse of the Y-Scale"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
@@ -2009,9 +2055,11 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna)
prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "chainlen");
- RNA_def_property_range(prop, 1, 255); /* TODO: this should really check the max length of the chain the constraint is attached to */
+ /* TODO: this should really check the max length of the chain the constraint is attached to */
+ RNA_def_property_range(prop, 1, 255);
RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); /* XXX: this update goes wrong... needs extra flush? */
+ /* XXX: this update goes wrong... needs extra flush? */
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
/* direct access to bindings */
/* NOTE: only to be used by experienced users */
@@ -2019,8 +2067,11 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna)
RNA_def_property_array(prop, 32); /* XXX this is the maximum value allowed - why? */
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length");
- RNA_def_property_float_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get", "rna_SplineIKConstraint_joint_bindings_set", NULL);
- RNA_def_property_ui_text(prop, "Joint Bindings", "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain as percentages");
+ RNA_def_property_float_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get",
+ "rna_SplineIKConstraint_joint_bindings_set", NULL);
+ RNA_def_property_ui_text(prop, "Joint Bindings",
+ "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain, "
+ "as percentages");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
/* settings */
@@ -2031,7 +2082,8 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_even_divisions", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_EVENSPLITS);
- RNA_def_property_ui_text(prop, "Even Divisions", "Ignore the relative lengths of the bones when fitting to the curve");
+ RNA_def_property_ui_text(prop, "Even Divisions",
+ "Ignore the relative lengths of the bones when fitting to the curve");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop = RNA_def_property(srna, "use_y_stretch", PROP_BOOLEAN, PROP_NONE);
@@ -2041,13 +2093,16 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_CURVERAD);
- RNA_def_property_ui_text(prop, "Use Curve Radius", "Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, on top of XZ Scale mode");
+ RNA_def_property_ui_text(prop, "Use Curve Radius",
+ "Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, "
+ "on top of XZ Scale mode");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop = RNA_def_property(srna, "xz_scale_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "xzScaleMode");
RNA_def_property_enum_items(prop, splineik_xz_scale_mode);
- RNA_def_property_ui_text(prop, "XZ Scale Mode", "Method used for determining the scaling of the X and Z axes of the bones");
+ RNA_def_property_ui_text(prop, "XZ Scale Mode",
+ "Method used for determining the scaling of the X and Z axes of the bones");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
@@ -2058,9 +2113,12 @@ static void rna_def_constraint_pivot(BlenderRNA *brna)
static EnumPropertyItem pivot_rotAxis_items[] = {
{PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"},
- {PIVOTCON_AXIS_X_NEG, "NX", 0, "-X Rot", "Use the pivot point in the negative rotation range around the X-axis"},
- {PIVOTCON_AXIS_Y_NEG, "NY", 0, "-Y Rot", "Use the pivot point in the negative rotation range around the Y-axis"},
- {PIVOTCON_AXIS_Z_NEG, "NZ", 0, "-Z Rot", "Use the pivot point in the negative rotation range around the Z-axis"},
+ {PIVOTCON_AXIS_X_NEG, "NX", 0, "-X Rot",
+ "Use the pivot point in the negative rotation range around the X-axis"},
+ {PIVOTCON_AXIS_Y_NEG, "NY", 0, "-Y Rot",
+ "Use the pivot point in the negative rotation range around the Y-axis"},
+ {PIVOTCON_AXIS_Z_NEG, "NZ", 0, "-Z Rot",
+ "Use the pivot point in the negative rotation range around the Z-axis"},
{PIVOTCON_AXIS_X, "X", 0, "X Rot", "Use the pivot point in the positive rotation range around the X-axis"},
{PIVOTCON_AXIS_Y, "Y", 0, "Y Rot", "Use the pivot point in the positive rotation range around the Y-axis"},
{PIVOTCON_AXIS_Z, "Z", 0, "Z Rot", "Use the pivot point in the positive rotation range around the Z-axis"},
@@ -2091,12 +2149,15 @@ static void rna_def_constraint_pivot(BlenderRNA *brna)
/* pivot offset */
prop = RNA_def_property(srna, "use_relative_location", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PIVOTCON_FLAG_OFFSET_ABS);
- RNA_def_property_ui_text(prop, "Use Relative Offset", "Offset will be an absolute point in space instead of relative to the target");
+ RNA_def_property_ui_text(prop, "Use Relative Offset",
+ "Offset will be an absolute point in space instead of relative to the target");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_XYZ);
RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_ui_text(prop, "Offset", "Offset of pivot from target (when set), or from owner's location (when Fixed Position is off), or the absolute pivot point");
+ RNA_def_property_ui_text(prop, "Offset",
+ "Offset of pivot from target (when set), or from owner's location "
+ "(when Fixed Position is off), or the absolute pivot point");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
/* rotation-based activation */
@@ -2150,18 +2211,22 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna)
/* camera */
prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "camera");
- RNA_def_property_ui_text(prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
+ RNA_def_property_ui_text(prop, "Camera",
+ "Camera to which motion is parented (if empty active scene camera is used)");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_followTrack_camera_set", NULL, "rna_Constraint_cameraObject_poll");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_followTrack_camera_set", NULL,
+ "rna_Constraint_cameraObject_poll");
/* depth object */
prop = RNA_def_property(srna, "depth_object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "depth_ob");
- RNA_def_property_ui_text(prop, "Depth Object", "Object used to define depth in camera space by projecting onto surface of this object");
+ RNA_def_property_ui_text(prop, "Depth Object",
+ "Object used to define depth in camera space by projecting onto surface of this object");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_followTrack_depthObject_set", NULL, "rna_Constraint_followTrack_depthObject_poll");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_followTrack_depthObject_set", NULL,
+ "rna_Constraint_followTrack_depthObject_poll");
}
static void rna_def_constraint_camera_solver(BlenderRNA *brna)
@@ -2218,10 +2283,12 @@ static void rna_def_constraint_object_solver(BlenderRNA *brna)
/* camera */
prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "camera");
- RNA_def_property_ui_text(prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
+ RNA_def_property_ui_text(prop, "Camera",
+ "Camera to which motion is parented (if empty active scene camera is used)");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_objectSolver_camera_set", NULL, "rna_Constraint_cameraObject_poll");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_objectSolver_camera_set", NULL,
+ "rna_Constraint_cameraObject_poll");
}
/* base struct for constraints */
@@ -2286,7 +2353,8 @@ void RNA_def_constraint(BlenderRNA *brna)
prop = RNA_def_property(srna, "is_proxy_local", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_PROXY_LOCAL);
- RNA_def_property_ui_text(prop, "Proxy Local", "Constraint was added in this proxy instance (i.e. did not belong to source Armature)");
+ RNA_def_property_ui_text(prop, "Proxy Local",
+ "Constraint was added in this proxy instance (i.e. did not belong to source Armature)");
/* values */
prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
@@ -2299,12 +2367,14 @@ void RNA_def_constraint(BlenderRNA *brna)
prop = RNA_def_property(srna, "error_location", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "lin_error");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Lin error", "Amount of residual error in Blender space unit for constraints that work on position");
+ RNA_def_property_ui_text(prop, "Lin error",
+ "Amount of residual error in Blender space unit for constraints that work on position");
prop = RNA_def_property(srna, "error_rotation", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rot_error");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Rot error", "Amount of residual error in radiant for constraints that work on orientation");
+ RNA_def_property_ui_text(prop, "Rot error",
+ "Amount of residual error in radiant for constraints that work on orientation");
/* pointers */
rna_def_constrainttarget(brna);
@@ -2340,4 +2410,3 @@ void RNA_def_constraint(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c
index b066114a0cb..fa18c92b86a 100644
--- a/source/blender/makesrna/intern/rna_controller.c
+++ b/source/blender/makesrna/intern/rna_controller.c
@@ -195,7 +195,8 @@ void RNA_def_controller(BlenderRNA *brna)
srna = RNA_def_struct(brna, "Controller", NULL);
RNA_def_struct_sdna(srna, "bController");
RNA_def_struct_refine_func(srna, "rna_Controller_refine");
- RNA_def_struct_ui_text(srna, "Controller", "Game engine logic brick to process events, connecting sensors to actuators");
+ RNA_def_struct_ui_text(srna, "Controller",
+ "Game engine logic brick to process events, connecting sensors to actuators");
RNA_api_controller(srna);
@@ -215,12 +216,14 @@ void RNA_def_controller(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_SHOW);
RNA_def_property_ui_text(prop, "Expanded", "Set controller expanded in the user interface");
- RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
+ RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "use_priority", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_PRIO);
- RNA_def_property_ui_text(prop, "Priority", "Mark controller for execution before all non-marked controllers (good for startup scripts)");
+ RNA_def_property_ui_text(prop, "Priority",
+ "Mark controller for execution before all non-marked controllers "
+ "(good for startup scripts)");
RNA_def_property_ui_icon(prop, ICON_BOOKMARKS, 1);
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -228,7 +231,9 @@ void RNA_def_controller(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
RNA_def_property_struct_type(prop, "Actuator");
RNA_def_property_ui_text(prop, "Actuators", "The list containing the actuators connected to the controller");
- RNA_def_property_collection_funcs(prop, "rna_Controller_actuators_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", "rna_Controller_actuators_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_Controller_actuators_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_dereference_get",
+ "rna_Controller_actuators_length", NULL, NULL, NULL);
/* State */
@@ -251,7 +256,8 @@ void RNA_def_controller(BlenderRNA *brna)
/* Expression Controller */
srna = RNA_def_struct(brna, "ExpressionController", "Controller");
RNA_def_struct_sdna_from(srna, "bExpressionCont", "data");
- RNA_def_struct_ui_text(srna, "Expression Controller", "Controller passing on events based on the evaluation of an expression");
+ RNA_def_struct_ui_text(srna, "Expression Controller",
+ "Controller passing on events based on the evaluation of an expression");
prop = RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "str");
@@ -276,12 +282,16 @@ void RNA_def_controller(BlenderRNA *brna)
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "module", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Module", "Module name and function to run, e.g. \"someModule.main\" (internal texts and external python files can be used)");
+ RNA_def_property_ui_text(prop, "Module",
+ "Module name and function to run, e.g. \"someModule.main\" "
+ "(internal texts and external python files can be used)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "use_debug", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_PY_DEBUG);
- RNA_def_property_ui_text(prop, "D", "Continuously reload the module from disk for editing external modules without restarting");
+ RNA_def_property_ui_text(prop, "D",
+ "Continuously reload the module from disk for editing external modules "
+ "without restarting");
RNA_def_property_update(prop, NC_LOGIC, NULL);
/* Other Controllers */
@@ -305,4 +315,3 @@ void RNA_def_controller(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_controller_api.c b/source/blender/makesrna/intern/rna_controller_api.c
index 3c517868baf..6fe90e1721b 100644
--- a/source/blender/makesrna/intern/rna_controller_api.c
+++ b/source/blender/makesrna/intern/rna_controller_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s):
*
* ***** END GPL LICENSE BLOCK *****
@@ -67,16 +67,16 @@ void RNA_api_controller(StructRNA *srna)
func = RNA_def_function(srna, "link", "rna_Controller_link");
RNA_def_function_ui_description(func, "Link the controller with a sensor/actuator");
- parm = RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to link the controller to");
+ parm = RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to link the controller to");
RNA_def_property_update(parm, NC_LOGIC, NULL);
- parm = RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to link the controller to");
+ parm = RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to link the controller to");
RNA_def_property_update(parm, NC_LOGIC, NULL);
func = RNA_def_function(srna, "unlink", "rna_Controller_unlink");
RNA_def_function_ui_description(func, "Unlink the controller from a sensor/actuator");
- parm = RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to unlink the controller from");
+ parm = RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to unlink the controller from");
RNA_def_property_update(parm, NC_LOGIC, NULL);
- parm = RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to unlink the controller from");
+ parm = RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to unlink the controller from");
RNA_def_property_update(parm, NC_LOGIC, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index dbd0320bd2f..94ef3018812 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -274,7 +274,8 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value)
update_curve_dimension(cu);
}
-static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
Curve *cu = (Curve*)ptr->id.data;
@@ -298,7 +299,8 @@ static void rna_Nurb_type_set(PointerRNA *ptr, int value)
static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Nurb *nu = (Nurb*)ptr->data;
- rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint), nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL);
+ rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint),
+ nu->pntsv > 0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL);
}
static void rna_Curve_update_data_id(Main *UNUSED(bmain), Scene *UNUSED(scene), ID *id)
@@ -351,7 +353,8 @@ static void rna_Curve_bevelObject_set(PointerRNA *ptr, PointerRNA value)
if (ob->type == OB_CURVE && ob->data != cu) {
cu->bevobj = ob;
}
- } else {
+ }
+ else {
cu->bevobj = NULL;
}
}
@@ -392,7 +395,8 @@ static void rna_Curve_taperObject_set(PointerRNA *ptr, PointerRNA value)
if (ob->type == OB_CURVE && ob->data != cu) {
cu->taperobj = ob;
}
- } else {
+ }
+ else {
cu->taperobj = NULL;
}
}
@@ -459,11 +463,14 @@ void rna_Curve_body_set(PointerRNA *ptr, const char *value)
cu->len = cu->pos = len;
- if (cu->str) MEM_freeN(cu->str);
- if (cu->strinfo) MEM_freeN(cu->strinfo);
+ if (cu->str)
+ MEM_freeN(cu->str);
+ if (cu->strinfo)
+ MEM_freeN(cu->strinfo);
cu->str = MEM_callocN(len + sizeof(wchar_t), "str");
- cu->strinfo = MEM_callocN( (len+4) *sizeof(CharInfo), "strinfo"); /* don't know why this is +4, just duplicating load_editText() */
+ /* don't know why this is +4, just duplicating load_editText() */
+ cu->strinfo = MEM_callocN((len+4) *sizeof(CharInfo), "strinfo");
/*BLI_strncpy_wchar_as_utf8(cu->str, value, len+1); *//* value is not wchar_t */
BLI_strncpy(cu->str, value, len+1);
@@ -475,7 +482,8 @@ static void rna_Nurb_update_cyclic_u(Main *bmain, Scene *scene, PointerRNA *ptr)
if (nu->type == CU_BEZIER) {
calchandlesNurb(nu);
- } else {
+ }
+ else {
nurbs_knot_calc_u(nu);
}
@@ -518,7 +526,8 @@ static void rna_Curve_spline_points_add(ID *id, Nurb *nu, ReportList *reports, i
}
else if (number == 0) {
/* do nothing */
- } else {
+ }
+ else {
addNurbPoints(nu, number);
@@ -536,7 +545,8 @@ static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, ReportList *reports
}
else if (number == 0) {
/* do nothing */
- } else {
+ }
+ else {
addNurbPointsBezier(nu, number);
/* update */
@@ -833,7 +843,9 @@ static void rna_def_path(BlenderRNA *brna, StructRNA *srna)
prop = RNA_def_property(srna, "path_duration", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "pathlen");
RNA_def_property_range(prop, 1, MAXFRAME);
- RNA_def_property_ui_text(prop, "Path Length", "The number of frames that are needed to traverse the path, defining the maximum value for the 'Evaluation Time' setting");
+ RNA_def_property_ui_text(prop, "Path Length",
+ "The number of frames that are needed to traverse the path, "
+ "defining the maximum value for the 'Evaluation Time' setting");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
/* flags */
@@ -857,11 +869,12 @@ static void rna_def_path(BlenderRNA *brna, StructRNA *srna)
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_DEFORM_BOUNDS_OFF);
RNA_def_property_ui_text(prop, "Bounds Clamp", "Option for curve-deform: "
"Use the mesh bounds to clamp the deformation");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "use_time_offset", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_OFFS_PATHDIST);
- RNA_def_property_ui_text(prop, "Offset Path Distance", "Children will use TimeOffs value as path distance offset");
+ RNA_def_property_ui_text(prop, "Offset Path Distance",
+ "Children will use TimeOffs value as path distance offset");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "use_radius", PROP_BOOLEAN, PROP_NONE);
@@ -976,7 +989,10 @@ static void rna_def_font(BlenderRNA *brna, StructRNA *srna)
/* strings */
prop = RNA_def_property(srna, "family", PROP_STRING, PROP_NONE);
RNA_def_property_string_maxlength(prop, MAX_ID_NAME-2);
- RNA_def_property_ui_text(prop, "Object Font", "Use Blender Objects as font characters (give font objects a common name followed by the character they represent, eg. familya, familyb, etc, and turn on Verts Duplication)");
+ RNA_def_property_ui_text(prop, "Object Font",
+ "Use Blender Objects as font characters (give font objects a common name "
+ "followed by the character they represent, eg. familya, familyb, etc, "
+ "and turn on Verts Duplication)");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
@@ -1243,7 +1259,8 @@ static void rna_def_curve(BlenderRNA *brna)
static const EnumPropertyItem curve_axis_items[] = {
{0, "2D", 0, "2D", "Clamp the Z axis of the curve"},
- {CU_3D, "3D", 0, "3D", "Allow editing on the Z axis of this curve, also allows tilt and curve radius to be used"},
+ {CU_3D, "3D", 0, "3D",
+ "Allow editing on the Z axis of this curve, also allows tilt and curve radius to be used"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "Curve", "ID");
@@ -1263,7 +1280,9 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "nurb", NULL);
#else
/* this way we get editmode nurbs too, keyframe in editmode */
- RNA_def_property_collection_funcs(prop, "rna_Curve_splines_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_Curve_splines_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
#endif
RNA_def_property_struct_type(prop, "Spline");
RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object");
@@ -1286,7 +1305,8 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "bevresol");
RNA_def_property_range(prop, 0, 32);
RNA_def_property_ui_range(prop, 0, 32, 1.0, 0);
- RNA_def_property_ui_text(prop, "Bevel Resolution", "Bevel resolution when depth is non-zero and no specific bevel object has been defined");
+ RNA_def_property_ui_text(prop, "Bevel Resolution",
+ "Bevel resolution when depth is non-zero and no specific bevel object has been defined");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
@@ -1327,18 +1347,22 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "resolu_ren");
RNA_def_property_range(prop, 0, SHRT_MAX);
RNA_def_property_ui_range(prop, 0, 64, 1, 0);
- RNA_def_property_ui_text(prop, "Render Resolution U", "Surface resolution in U direction used while rendering (zero skips this property)");
+ RNA_def_property_ui_text(prop, "Render Resolution U",
+ "Surface resolution in U direction used while rendering (zero skips this property)");
prop = RNA_def_property(srna, "render_resolution_v", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "resolv_ren");
RNA_def_property_ui_range(prop, 0, 64, 1, 0);
RNA_def_property_range(prop, 0, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Render Resolution V", "Surface resolution in V direction used while rendering (zero skips this property)");
+ RNA_def_property_ui_text(prop, "Render Resolution V",
+ "Surface resolution in V direction used while rendering (zero skips this property)");
prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ctime");
- RNA_def_property_ui_text(prop, "Evaluation Time", "Parametric position along the length of the curve that Objects 'following' it should be at (position is evaluated by dividing by the 'Path Length' value)");
+ RNA_def_property_ui_text(prop, "Evaluation Time",
+ "Parametric position along the length of the curve that Objects 'following' it should be "
+ "at (position is evaluated by dividing by the 'Path Length' value)");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
/* pointers */
@@ -1348,7 +1372,8 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Bevel Object", "Curve object name that defines the bevel shape");
RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
- RNA_def_property_pointer_funcs(prop, "rna_Curve_bevelObject_get", "rna_Curve_bevelObject_set", NULL, "rna_Curve_otherObject_poll");
+ RNA_def_property_pointer_funcs(prop, "rna_Curve_bevelObject_get", "rna_Curve_bevelObject_set", NULL,
+ "rna_Curve_otherObject_poll");
prop = RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
@@ -1356,7 +1381,8 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Taper Object", "Curve object name that defines the taper (width)");
RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
- RNA_def_property_pointer_funcs(prop, "rna_Curve_taperObject_get", "rna_Curve_taperObject_set", NULL, "rna_Curve_otherObject_poll");
+ RNA_def_property_pointer_funcs(prop, "rna_Curve_taperObject_get", "rna_Curve_taperObject_set", NULL,
+ "rna_Curve_otherObject_poll");
/* Flags */
@@ -1400,14 +1426,15 @@ static void rna_def_curve(BlenderRNA *brna)
/* texture space */
prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "texflag", CU_AUTOSPACE);
- RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjust active object's texture space automatically when transforming object");
+ RNA_def_property_ui_text(prop, "Auto Texture Space",
+ "Adjust active object's texture space automatically when transforming object");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Curve_texspace_set");
prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
- RNA_def_property_float_funcs(prop, "rna_Curve_texspace_loc_get", "rna_Curve_texspace_loc_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_Curve_texspace_loc_get", "rna_Curve_texspace_loc_set", NULL);
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
@@ -1453,12 +1480,15 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
srna = RNA_def_struct(brna, "Spline", NULL);
RNA_def_struct_sdna(srna, "Nurb");
- RNA_def_struct_ui_text(srna, "Spline", "Element of a curve, either NURBS, Bezier or Polyline or a character with text objects");
+ RNA_def_struct_ui_text(srna, "Spline",
+ "Element of a curve, either NURBS, Bezier or Polyline or a character with text objects");
prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "bp", NULL);
RNA_def_property_struct_type(prop, "SplinePoint");
- RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length",
+ NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Points", "Collection of points that make up this poly or nurbs spline");
rna_def_curve_spline_points(brna, prop);
@@ -1503,13 +1533,17 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
prop = RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "orderu");
RNA_def_property_range(prop, 2, 6);
- RNA_def_property_ui_text(prop, "Order U", "NURBS order in the U direction (for splines and surfaces, higher values let points influence a greater area)");
+ RNA_def_property_ui_text(prop, "Order U",
+ "NURBS order in the U direction (for splines and surfaces, higher values "
+ "let points influence a greater area)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
prop = RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "orderv");
RNA_def_property_range(prop, 2, 6);
- RNA_def_property_ui_text(prop, "Order V", "NURBS order in the V direction (for surfaces only, higher values let points influence a greater area)");
+ RNA_def_property_ui_text(prop, "Order V",
+ "NURBS order in the V direction (for surfaces only, higher values "
+ "let points influence a greater area)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
@@ -1541,22 +1575,30 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
/* Note, endpoint and bezier flags should never be on at the same time! */
prop = RNA_def_property(srna, "use_endpoint_u", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_ENDPOINT);
- RNA_def_property_ui_text(prop, "Endpoint U", "Make this nurbs curve or surface meet the endpoints in the U direction (Cyclic U must be disabled)");
+ RNA_def_property_ui_text(prop, "Endpoint U",
+ "Make this nurbs curve or surface meet the endpoints in the U direction "
+ "(Cyclic U must be disabled)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
prop = RNA_def_property(srna, "use_endpoint_v", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_ENDPOINT);
- RNA_def_property_ui_text(prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction (Cyclic V must be disabled)");
+ RNA_def_property_ui_text(prop, "Endpoint V",
+ "Make this nurbs surface meet the endpoints in the V direction "
+ "(Cyclic V must be disabled)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
prop = RNA_def_property(srna, "use_bezier_u", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_BEZIER);
- RNA_def_property_ui_text(prop, "Bezier U", "Make this nurbs curve or surface act like a Bezier spline in the U direction (Order U must be 3 or 4, Cyclic U must be disabled)");
+ RNA_def_property_ui_text(prop, "Bezier U",
+ "Make this nurbs curve or surface act like a Bezier spline in the U direction "
+ "(Order U must be 3 or 4, Cyclic U must be disabled)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
prop = RNA_def_property(srna, "use_bezier_v", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_BEZIER);
- RNA_def_property_ui_text(prop, "Bezier V", "Make this nurbs surface act like a Bezier spline in the V direction (Order V must be 3 or 4, Cyclic V must be disabled)");
+ RNA_def_property_ui_text(prop, "Bezier V",
+ "Make this nurbs surface act like a Bezier spline in the V direction "
+ "(Order V must be 3 or 4, Cyclic V must be disabled)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
@@ -1579,7 +1621,8 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
prop = RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "charidx");
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
- RNA_def_property_ui_text(prop, "Character Index", "Location of this character in the text data (only for text curves)");
+ RNA_def_property_ui_text(prop, "Character Index",
+ "Location of this character in the text data (only for text curves)");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
RNA_def_struct_path_func(srna, "rna_Curve_spline_path");
@@ -1598,4 +1641,3 @@ void RNA_def_curve(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 202418205f3..651b6fd9c16 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -58,9 +58,9 @@ BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1};
/* pedantic check for '.', do this since its a hassle for translators */
#ifndef NDEBUG
# define DESCR_CHECK(description, id1, id2) \
- if (description && (description)[0]) { \
+ if (description && (description)[0]) { \
int i = strlen(description); \
- if ((description)[i - 1] == '.') { \
+ if ((description)[i - 1] == '.') { \
fprintf(stderr, "%s: '%s' '%s' description ends with a '.' !\n", \
__func__, id1 ? id1 : "", id2 ? id2 : ""); \
} \
@@ -508,8 +508,8 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
PropertyRNA *parm, *nextparm;
/*
- if(srna->flag & STRUCT_RUNTIME) {
- if(RNA_struct_py_type_get(srna)) {
+ if (srna->flag & STRUCT_RUNTIME) {
+ if (RNA_struct_py_type_get(srna)) {
fprintf(stderr, "%s '%s' freed while holding a python reference\n", __func__, srna->identifier);
}
} */
@@ -687,7 +687,9 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
if (DefRNA.preprocess) {
RNA_def_property_struct_type(prop, "Property");
- RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", "rna_iterator_listbase_end", "rna_builtin_properties_get", NULL, NULL, "rna_builtin_properties_lookup_string", NULL);
+ RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next",
+ "rna_iterator_listbase_end", "rna_builtin_properties_get", NULL, NULL,
+ "rna_builtin_properties_lookup_string", NULL);
}
else {
#ifdef RNA_RUNTIME
@@ -871,6 +873,11 @@ void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
srna->icon = icon;
}
+void RNA_def_struct_translation_context(StructRNA *srna, const char *context)
+{
+ srna->translation_context = context;
+}
+
/* Property Definition */
PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
@@ -885,7 +892,8 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
char error[512];
if (rna_validate_identifier(identifier, error, 1) == 0) {
- fprintf(stderr, "%s: property identifier \"%s.%s\" - %s\n", __func__, CONTAINER_RNA_ID(cont), identifier, error);
+ fprintf(stderr, "%s: property identifier \"%s.%s\" - %s\n", __func__,
+ CONTAINER_RNA_ID(cont), identifier, error);
DefRNA.error = 1;
}
@@ -1052,19 +1060,22 @@ void RNA_def_property_array(PropertyRNA *prop, int length)
StructRNA *srna = DefRNA.laststruct;
if (length<0) {
- fprintf(stderr, "%s: \"%s.%s\", array length must be zero of greater.\n", __func__, srna->identifier, prop->identifier);
+ fprintf(stderr, "%s: \"%s.%s\", array length must be zero of greater.\n", __func__,
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
return;
}
if (length>RNA_MAX_ARRAY_LENGTH) {
- fprintf(stderr, "%s: \"%s.%s\", array length must be smaller than %d.\n", __func__, srna->identifier, prop->identifier, RNA_MAX_ARRAY_LENGTH);
+ fprintf(stderr, "%s: \"%s.%s\", array length must be smaller than %d.\n", __func__,
+ srna->identifier, prop->identifier, RNA_MAX_ARRAY_LENGTH);
DefRNA.error = 1;
return;
}
if (prop->arraydimension > 1) {
- fprintf(stderr, "%s: \"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.\n", __func__, srna->identifier, prop->identifier, prop->arraydimension);
+ fprintf(stderr, "%s: \"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.\n",
+ __func__, srna->identifier, prop->identifier, prop->arraydimension);
DefRNA.error = 1;
return;
}
@@ -1078,7 +1089,8 @@ void RNA_def_property_array(PropertyRNA *prop, int length)
prop->arraydimension = 1;
break;
default:
- fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n", __func__, srna->identifier, prop->identifier);
+ fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n",
+ __func__, srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1090,7 +1102,8 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le
int i;
if (dimension < 1 || dimension > RNA_MAX_ARRAY_DIMENSION) {
- fprintf(stderr, "%s: \"%s.%s\", array dimension must be between 1 and %d.\n", __func__, srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION);
+ fprintf(stderr, "%s: \"%s.%s\", array dimension must be between 1 and %d.\n",
+ __func__, srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION);
DefRNA.error = 1;
return;
}
@@ -1101,7 +1114,8 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le
case PROP_FLOAT:
break;
default:
- fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n", __func__, srna->identifier, prop->identifier);
+ fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n",
+ __func__, srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1158,7 +1172,8 @@ void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", invalid type for ui range.\n", __func__, srna->identifier, prop->identifier);
+ fprintf(stderr, "%s: \"%s.%s\", invalid type for ui range.\n",
+ __func__, srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1213,7 +1228,8 @@ void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier);
+ fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n",
+ __func__, srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1244,7 +1260,8 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type)
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier);
+ fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n",
+ __func__, srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1279,7 +1296,8 @@ void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier);
+ fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n",
+ __func__, srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1441,7 +1459,8 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value)
}
if (eprop->defaultvalue & ~totflag) {
- fprintf(stderr, "%s: \"%s.%s\", default includes unused bits (%d).\n", __func__, srna->identifier, prop->identifier, eprop->defaultvalue & ~totflag);
+ fprintf(stderr, "%s: \"%s.%s\", default includes unused bits (%d).\n",
+ __func__, srna->identifier, prop->identifier, eprop->defaultvalue & ~totflag);
DefRNA.error = 1;
}
}
@@ -1456,7 +1475,8 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value)
eprop->defaultvalue = eprop->item[0].value;
}
else {
- fprintf(stderr, "%s: \"%s.%s\", default is not in items.\n", __func__, srna->identifier, prop->identifier);
+ fprintf(stderr, "%s: \"%s.%s\", default is not in items.\n",
+ __func__, srna->identifier, prop->identifier);
DefRNA.error = 1;
}
}
@@ -1553,7 +1573,8 @@ void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, co
if (DefRNA.silent == 0) {
/* error check to ensure floats are not wrapped as ints/bools */
if (dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
- fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
+ fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n",
+ __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
DefRNA.error = 1;
return;
}
@@ -1563,7 +1584,8 @@ void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, co
}
}
-void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int booleanbit)
+void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname,
+ const char *propname, int booleanbit)
{
PropertyDefRNA *dp;
@@ -1597,7 +1619,8 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const
/* error check to ensure floats are not wrapped as ints/bools */
if (DefRNA.silent == 0) {
if (dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
- fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
+ fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n",
+ __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
DefRNA.error = 1;
return;
}
@@ -1647,7 +1670,9 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, cons
if (DefRNA.silent == 0) {
if (dp->dnatype && *dp->dnatype && IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) {
if (prop->subtype != PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */
- fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
+ fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n",
+ __func__, srna->identifier, prop->identifier, dp->dnatype,
+ RNA_property_typename(prop->type));
DefRNA.error = 1;
return;
}
@@ -1685,7 +1710,8 @@ void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const
prop->totarraylength = 0;
if (!DefRNA.silent) {
- fprintf(stderr, "%s: \"%s.%s\", array not supported for enum type.\n", __func__, structname, propname);
+ fprintf(stderr, "%s: \"%s.%s\", array not supported for enum type.\n",
+ __func__, structname, propname);
DefRNA.error = 1;
}
}
@@ -1752,14 +1778,16 @@ void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, co
prop->totarraylength = 0;
if (!DefRNA.silent) {
- fprintf(stderr, "%s: \"%s.%s\", array not supported for pointer type.\n", __func__, structname, propname);
+ fprintf(stderr, "%s: \"%s.%s\", array not supported for pointer type.\n",
+ __func__, structname, propname);
DefRNA.error = 1;
}
}
}
}
-void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
+void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname,
+ const char *lengthpropname)
{
PropertyDefRNA *dp;
CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
@@ -1782,7 +1810,8 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
prop->totarraylength = 0;
if (!DefRNA.silent) {
- fprintf(stderr, "%s: \"%s.%s\", array of collections not supported.\n", __func__, structname, propname);
+ fprintf(stderr, "%s: \"%s.%s\", array of collections not supported.\n",
+ __func__, structname, propname);
DefRNA.error = 1;
}
}
@@ -1816,7 +1845,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
cprop->next = (PropCollectionNextFunc)"rna_iterator_array_next";
cprop->end = (PropCollectionEndFunc)"rna_iterator_array_end";
- if (dp->dnapointerlevel >= 2)
+ if (dp->dnapointerlevel >= 2)
cprop->get = (PropCollectionGetFunc)"rna_iterator_array_dereference_get";
else
cprop->get = (PropCollectionGetFunc)"rna_iterator_array_get";
@@ -2031,7 +2060,8 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const cha
}
}
-void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *typef, const char *poll)
+void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set,
+ const char *typef, const char *poll)
{
StructRNA *srna = DefRNA.laststruct;
@@ -2057,7 +2087,9 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch
}
}
-void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
+void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end,
+ const char *get, const char *length, const char *lookupint,
+ const char *lookupstring, const char *assignint)
{
StructRNA *srna = DefRNA.laststruct;
@@ -2099,7 +2131,8 @@ void RNA_def_py_data(PropertyRNA *prop, void *py_data)
/* Compact definitions */
-PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, int default_value, const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, int default_value,
+ const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2111,8 +2144,8 @@ PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier,
return prop;
}
-PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
+ const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2125,8 +2158,8 @@ PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *ident
return prop;
}
-PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
+ const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2139,8 +2172,8 @@ PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *ident
return prop;
}
-PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char *identifier, int len,
+ int *default_value, const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2153,8 +2186,8 @@ PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char
return prop;
}
-PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
+ const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2167,8 +2200,8 @@ PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *iden
return prop;
}
-PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax,
- const char *ui_name, const char *ui_description, int softmin, int softmax)
+PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin,
+ int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2182,8 +2215,9 @@ PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int
return prop;
}
-PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value,
- int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
+PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value,
+ int hardmin, int hardmax, const char *ui_name, const char *ui_description,
+ int softmin, int softmax)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2198,8 +2232,9 @@ PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifi
return prop;
}
-PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value,
- int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
+PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value,
+ int hardmin, int hardmax, const char *ui_name, const char *ui_description,
+ int softmin, int softmax)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2214,8 +2249,8 @@ PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifie
return prop;
}
-PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen,
+ const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2228,8 +2263,8 @@ PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier,
return prop;
}
-PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
+ int maxlen, const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2242,8 +2277,8 @@ PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont_, const char *id
return prop;
}
-PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
+ int maxlen, const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2256,8 +2291,8 @@ PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont_, const char *ide
return prop;
}
-PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
+ int maxlen, const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2270,8 +2305,8 @@ PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *id
return prop;
}
-PropertyRNA *RNA_def_string_translate(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string_translate(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
+ int maxlen, const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2284,8 +2319,8 @@ PropertyRNA *RNA_def_string_translate(StructOrFunctionRNA *cont_, const char *id
return prop;
}
-PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items,
+ int default_value, const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2304,8 +2339,8 @@ PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, co
}
/* same as above but sets 'PROP_ENUM_FLAG' before setting the default value */
-PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items,
+ int default_value, const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2336,8 +2371,9 @@ void RNA_def_enum_py_data(PropertyRNA *prop, void *py_data)
eprop->py_data = py_data;
}
-PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value,
+ float hardmin, float hardmax, const char *ui_name, const char *ui_description,
+ float softmin, float softmax)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2351,8 +2387,9 @@ PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, f
return prop;
}
-PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len,
+ const float *default_value, float hardmin, float hardmax, const char *ui_name,
+ const char *ui_description, float softmin, float softmax)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2367,19 +2404,22 @@ PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identi
return prop;
}
-PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont_, const char *identifier, int len,
+ const float *default_value, float hardmin, float hardmax, const char *ui_name,
+ const char *ui_description, float softmin, float softmax)
{
PropertyRNA *prop;
- prop = RNA_def_float_vector(cont_, identifier, len, default_value, hardmin, hardmax, ui_name, ui_description, softmin, softmax);
+ prop = RNA_def_float_vector(cont_, identifier, len, default_value, hardmin, hardmax, ui_name, ui_description,
+ softmin, softmax);
prop->subtype = PROP_XYZ_LENGTH;
return prop;
}
-PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, int len,
+ const float *default_value, float hardmin, float hardmax, const char *ui_name,
+ const char *ui_description, float softmin, float softmax)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2395,8 +2435,9 @@ PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identif
}
-PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_, const char *identifier, int rows, int columns, const float *default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_, const char *identifier, int rows, int columns,
+ const float *default_value, float hardmin, float hardmax, const char *ui_name,
+ const char *ui_description, float softmin, float softmax)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2415,8 +2456,9 @@ PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_, const char *identi
return prop;
}
-PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *identifier, int len,
+ const float *default_value, float hardmin, float hardmax, const char *ui_name,
+ const char *ui_description, float softmin, float softmax)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2437,8 +2479,9 @@ PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *iden
return prop;
}
-PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, int len,
+ const float *default_value, float hardmin, float hardmax, const char *ui_name,
+ const char *ui_description, float softmin, float softmax)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2454,7 +2497,8 @@ PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identif
}
PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont_, const char *identifier, float default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+ float hardmin, float hardmax, const char *ui_name, const char *ui_description,
+ float softmin, float softmax)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2469,7 +2513,8 @@ PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont_, const char *id
}
PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, float default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+ float hardmin, float hardmax, const char *ui_name, const char *ui_description,
+ float softmin, float softmax)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2484,7 +2529,7 @@ PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identi
}
PropertyRNA *RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type,
- const char *ui_name, const char *ui_description)
+ const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2497,7 +2542,7 @@ PropertyRNA *RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier,
}
PropertyRNA *RNA_def_pointer_runtime(StructOrFunctionRNA *cont_, const char *identifier, StructRNA *type,
- const char *ui_name, const char *ui_description)
+ const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2510,7 +2555,7 @@ PropertyRNA *RNA_def_pointer_runtime(StructOrFunctionRNA *cont_, const char *ide
}
PropertyRNA *RNA_def_collection(StructOrFunctionRNA *cont_, const char *identifier, const char *type,
- const char *ui_name, const char *ui_description)
+ const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2523,7 +2568,7 @@ PropertyRNA *RNA_def_collection(StructOrFunctionRNA *cont_, const char *identifi
}
PropertyRNA *RNA_def_collection_runtime(StructOrFunctionRNA *cont_, const char *identifier, StructRNA *type,
- const char *ui_name, const char *ui_description)
+ const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2609,11 +2654,13 @@ FunctionRNA *RNA_def_function_runtime(StructRNA *srna, const char *identifier, C
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
{
if (ret->flag & PROP_DYNAMIC) {
- fprintf(stderr, "%s: \"%s.%s\", dynamic values are not allowed as strict returns, use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier);
+ fprintf(stderr, "%s: \"%s.%s\", dynamic values are not allowed as strict returns, "
+ "use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier);
return;
}
else if (ret->arraydimension) {
- fprintf(stderr, "%s: \"%s.%s\", arrays are not allowed as strict returns, use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier);
+ fprintf(stderr, "%s: \"%s.%s\", arrays are not allowed as strict returns, "
+ "use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier);
return;
}
@@ -2670,7 +2717,8 @@ int rna_parameter_size(PropertyRNA *parm)
if (parm->flag & PROP_THICK_WRAP) {
StringPropertyRNA *sparm = (StringPropertyRNA*)parm;
return sizeof(char) * sparm->maxlength;
- } else
+ }
+ else
return sizeof(char *);
case PROP_POINTER: {
#ifdef RNA_RUNTIME
@@ -2715,7 +2763,7 @@ void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropert
if (tot == 0) {
*items = MEM_callocN(sizeof(EnumPropertyItem)*8, "RNA_enum_items_add");
}
- else if (tot >= 8 && (tot&(tot-1)) == 0){
+ else if (tot >= 8 && (tot&(tot-1)) == 0) {
/* power of two > 8 */
newitems = MEM_callocN(sizeof(EnumPropertyItem)*tot*2, "RNA_enum_items_add");
memcpy(newitems, *items, sizeof(EnumPropertyItem)*tot);
@@ -2744,7 +2792,9 @@ void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, EnumProper
for (; item->identifier; item++) {
if (item->value == value) {
RNA_enum_item_add(items, totitem, item);
- break; /* break on first match - does this break anything? (is quick hack to get object->parent_type working ok for armature/lattice) */
+ /* break on first match - does this break anything?
+ * (is quick hack to get object->parent_type working ok for armature/lattice) */
+ break;
}
}
}
@@ -2800,7 +2850,8 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
int *iarray;
int a;
- /* annoying since we just added this to a hash, could make this add the correct key to the hash in the first place */
+ /* annoying since we just added this to a hash, could make this add the correct key to the hash
+ * in the first place */
if (prop->identifier) {
if (cont->prophash) {
BLI_ghash_remove(cont->prophash, (void*)prop->identifier, NULL, NULL);
@@ -2845,9 +2896,12 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
eprop->item = earray;
for (a = 0; a<eprop->totitem; a++) {
- if (eprop->item[a].identifier) eprop->item[a].identifier = BLI_strdup(eprop->item[a].identifier);
- if (eprop->item[a].name) eprop->item[a].name = BLI_strdup(eprop->item[a].name);
- if (eprop->item[a].description) eprop->item[a].description = BLI_strdup(eprop->item[a].description);
+ if (eprop->item[a].identifier)
+ eprop->item[a].identifier = BLI_strdup(eprop->item[a].identifier);
+ if (eprop->item[a].name)
+ eprop->item[a].name = BLI_strdup(eprop->item[a].name);
+ if (eprop->item[a].description)
+ eprop->item[a].description = BLI_strdup(eprop->item[a].description);
}
}
break;
@@ -2864,7 +2918,8 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
}
case PROP_STRING: {
StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
- if (sprop->defaultvalue) sprop->defaultvalue = BLI_strdup(sprop->defaultvalue);
+ if (sprop->defaultvalue)
+ sprop->defaultvalue = BLI_strdup(sprop->defaultvalue);
break;
}
default:
@@ -2879,34 +2934,44 @@ void RNA_def_property_free_pointers(PropertyRNA *prop)
if (prop->flag & PROP_FREE_POINTERS) {
int a;
- if (prop->identifier) MEM_freeN((void*)prop->identifier);
- if (prop->name) MEM_freeN((void*)prop->name);
- if (prop->description) MEM_freeN((void*)prop->description);
- if (prop->py_data) MEM_freeN(prop->py_data);
+ if (prop->identifier)
+ MEM_freeN((void*)prop->identifier);
+ if (prop->name)
+ MEM_freeN((void*)prop->name);
+ if (prop->description)
+ MEM_freeN((void*)prop->description);
+ if (prop->py_data)
+ MEM_freeN(prop->py_data);
switch (prop->type) {
case PROP_BOOLEAN: {
BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
- if (bprop->defaultarray) MEM_freeN((void*)bprop->defaultarray);
+ if (bprop->defaultarray)
+ MEM_freeN((void*)bprop->defaultarray);
break;
}
case PROP_INT: {
IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
- if (iprop->defaultarray) MEM_freeN((void*)iprop->defaultarray);
+ if (iprop->defaultarray)
+ MEM_freeN((void*)iprop->defaultarray);
break;
}
case PROP_FLOAT: {
FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
- if (fprop->defaultarray) MEM_freeN((void*)fprop->defaultarray);
+ if (fprop->defaultarray)
+ MEM_freeN((void*)fprop->defaultarray);
break;
}
case PROP_ENUM: {
EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
for (a = 0; a<eprop->totitem; a++) {
- if (eprop->item[a].identifier) MEM_freeN((void*)eprop->item[a].identifier);
- if (eprop->item[a].name) MEM_freeN((void*)eprop->item[a].name);
- if (eprop->item[a].description) MEM_freeN((void*)eprop->item[a].description);
+ if (eprop->item[a].identifier)
+ MEM_freeN((void*)eprop->item[a].identifier);
+ if (eprop->item[a].name)
+ MEM_freeN((void*)eprop->item[a].name);
+ if (eprop->item[a].description)
+ MEM_freeN((void*)eprop->item[a].description);
}
if (eprop->item) MEM_freeN((void*)eprop->item);
@@ -2914,7 +2979,8 @@ void RNA_def_property_free_pointers(PropertyRNA *prop)
}
case PROP_STRING: {
StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
- if (sprop->defaultvalue) MEM_freeN((void*)sprop->defaultvalue);
+ if (sprop->defaultvalue)
+ MEM_freeN((void*)sprop->defaultvalue);
break;
}
default:
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c
index e9e7f58b638..1e47965be15 100644
--- a/source/blender/makesrna/intern/rna_dynamicpaint.c
+++ b/source/blender/makesrna/intern/rna_dynamicpaint.c
@@ -1,4 +1,4 @@
-/**
+/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -6,11 +6,25 @@
* 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.
+ *
* Contributor(s): Miika Hämäläinen
*
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/makesrna/intern/rna_dynamicpaint.c
+ * \ingroup RNA
+ */
+
+
#include <stdlib.h>
#include <limits.h>
@@ -211,7 +225,8 @@ static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Objec
}
-static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *free)
{
DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
@@ -271,7 +286,8 @@ static void rna_def_canvas_surfaces(BlenderRNA *brna, PropertyRNA *cprop)
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, "rna_Surface_active_point_index_get", "rna_Surface_active_point_index_set", "rna_Surface_active_point_range");
+ RNA_def_property_int_funcs(prop, "rna_Surface_active_point_index_get", "rna_Surface_active_point_index_set",
+ "rna_Surface_active_point_range");
RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
@@ -500,7 +516,8 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_dissolve_log", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE_LOG);
- RNA_def_property_ui_text(prop, "Slow", "Use logarithmic dissolve (makes high values to fade faster than low values)");
+ RNA_def_property_ui_text(prop, "Slow",
+ "Use logarithmic dissolve (makes high values to fade faster than low values)");
prop = RNA_def_property(srna, "use_spread", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -613,7 +630,8 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0.00, 50.0);
RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
- RNA_def_property_ui_text(prop, "Max Displace", "Maximum level of depth intersection in object space (use 0.0 to disable)");
+ RNA_def_property_ui_text(prop, "Max Displace",
+ "Maximum level of depth intersection in object space (use 0.0 to disable)");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
prop = RNA_def_property(srna, "displace_factor", PROP_FLOAT, PROP_NONE);
@@ -694,7 +712,9 @@ static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna)
* Surface Slots
*/
prop = RNA_def_property(srna, "canvas_surfaces", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_DynamicPaint_surfaces_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_DynamicPaint_surfaces_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "DynamicPaintSurface");
RNA_def_property_ui_text(prop, "Paint Surface List", "Paint surface list");
rna_def_canvas_surfaces(brna, prop);
@@ -761,19 +781,22 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "mat");
- RNA_def_property_ui_text(prop, "Material", "Material to use (if not defined, material linked to the mesh is used)");
+ RNA_def_property_ui_text(prop, "Material",
+ "Material to use (if not defined, material linked to the mesh is used)");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
prop = RNA_def_property(srna, "use_absolute_alpha", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ABS_ALPHA);
- RNA_def_property_ui_text(prop, "Absolute Alpha", "Only increase alpha value if paint alpha is higher than existing");
+ RNA_def_property_ui_text(prop, "Absolute Alpha",
+ "Only increase alpha value if paint alpha is higher than existing");
prop = RNA_def_property(srna, "paint_wetness", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "wetness");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
- RNA_def_property_ui_text(prop, "Paint Wetness", "Paint wetness, visible in wetmap (some effects only affect wet paint)");
+ RNA_def_property_ui_text(prop, "Paint Wetness",
+ "Paint wetness, visible in wetmap (some effects only affect wet paint)");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
prop = RNA_def_property(srna, "use_paint_erase", PROP_BOOLEAN, PROP_NONE);
@@ -794,7 +817,8 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "wave_clamp", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.00, 50.0);
RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
- RNA_def_property_ui_text(prop, "Clamp Waves", "Maximum level of surface intersection used to influence waves (use 0.0 to disable)");
+ RNA_def_property_ui_text(prop, "Clamp Waves",
+ "Maximum level of surface intersection used to influence waves (use 0.0 to disable)");
prop = RNA_def_property(srna, "use_smudge", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DO_SMUDGE);
@@ -809,7 +833,8 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "max_velocity");
RNA_def_property_range(prop, 0.0001, 10.0);
RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2);
- RNA_def_property_ui_text(prop, "Max Velocity", "Velocity considered as maximum influence (Blender units per frame)");
+ RNA_def_property_ui_text(prop, "Max Velocity",
+ "Velocity considered as maximum influence (Blender units per frame)");
prop = RNA_def_property(srna, "use_velocity_alpha", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_ALPHA);
@@ -818,7 +843,8 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_velocity_depth", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_DEPTH);
- RNA_def_property_ui_text(prop, "Multiply Depth", "Multiply brush intersection depth (displace, waves) by velocity ramp alpha");
+ RNA_def_property_ui_text(prop, "Multiply Depth",
+ "Multiply brush intersection depth (displace, waves) by velocity ramp alpha");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
prop = RNA_def_property(srna, "use_velocity_color", PROP_BOOLEAN, PROP_NONE);
@@ -840,7 +866,8 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "paint_distance");
RNA_def_property_range(prop, 0.0, 500.0);
RNA_def_property_ui_range(prop, 0.0, 500.0, 10, 3);
- RNA_def_property_ui_text(prop, "Proximity Distance", "Maximum distance from brush to mesh surface to affect paint");
+ RNA_def_property_ui_text(prop, "Proximity Distance",
+ "Maximum distance from brush to mesh surface to affect paint");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
prop = RNA_def_property(srna, "use_proximity_ramp_alpha", PROP_BOOLEAN, PROP_NONE);
@@ -857,13 +884,16 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_proximity_project", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PROX_PROJECT);
- RNA_def_property_ui_text(prop, "Project", "Brush is projected to canvas from defined direction within brush proximity");
+ RNA_def_property_ui_text(prop, "Project",
+ "Brush is projected to canvas from defined direction within brush proximity");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
prop = RNA_def_property(srna, "ray_direction", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "ray_dir");
RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_ray_dir);
- RNA_def_property_ui_text(prop, "Ray Direction", "Ray direction to use for projection (if brush object is located in that direction it's painted)");
+ RNA_def_property_ui_text(prop, "Ray Direction",
+ "Ray direction to use for projection (if brush object is located in that direction "
+ "it's painted)");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
prop = RNA_def_property(srna, "invert_proximity", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 88878a5332f..2108daf23be 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -372,7 +372,7 @@ static void rna_FCurve_group_set(PointerRNA *ptr, PointerRNA value)
return;
}
- /* can only change group if we have info about the action the F-Curve is in
+ /* can only change group if we have info about the action the F-Curve is in
* (i.e. for drivers or random F-Curves, this cannot be done)
*/
if (act == NULL) {
@@ -735,7 +735,7 @@ static void rna_def_fmodifier_envelope_ctrl(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Envelope Control Point", "Control point for envelope F-Modifier");
RNA_def_struct_sdna(srna, "FCM_EnvelopeData");
- /* min/max extents
+ /* min/max extents
* - for now, these are allowed to go past each other, so that we can have inverted action
* - technically, the range is limited by the settings in the envelope-modifier data, not here...
*/
@@ -802,7 +802,8 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna)
{FCM_EXTRAPOLATE_NONE, "NONE", 0, "No Cycles", "Don't do anything"},
{FCM_EXTRAPOLATE_CYCLIC, "REPEAT", 0, "Repeat Motion", "Repeat keyframe range as-is"},
{FCM_EXTRAPOLATE_CYCLIC_OFFSET, "REPEAT_OFFSET", 0, "Repeat with Offset",
- "Repeat keyframe range, but with offset based on gradient between start and end values"},
+ "Repeat keyframe range, but with offset based on gradient between "
+ "start and end values"},
{FCM_EXTRAPOLATE_MIRROR, "MIRROR", 0, "Repeat Mirrored",
"Alternate between forward and reverse playback of keyframe range"},
{0, NULL, 0, NULL, NULL}};
@@ -820,7 +821,8 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna)
prop = RNA_def_property(srna, "cycles_before", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "before_cycles");
- RNA_def_property_ui_text(prop, "Before Cycles", "Maximum number of cycles to allow before first keyframe (0 = infinite)");
+ RNA_def_property_ui_text(prop, "Before Cycles",
+ "Maximum number of cycles to allow before first keyframe (0 = infinite)");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
/* after */
@@ -832,7 +834,8 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna)
prop = RNA_def_property(srna, "cycles_after", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "after_cycles");
- RNA_def_property_ui_text(prop, "After Cycles", "Maximum number of cycles to allow after last keyframe (0 = infinite)");
+ RNA_def_property_ui_text(prop, "After Cycles",
+ "Maximum number of cycles to allow after last keyframe (0 = infinite)");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
}
@@ -935,7 +938,8 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna)
prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "strength");
- RNA_def_property_ui_text(prop, "Strength", "Amplitude of the noise - the amount that it modifies the underlying curve");
+ RNA_def_property_ui_text(prop, "Strength",
+ "Amplitude of the noise - the amount that it modifies the underlying curve");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
@@ -959,7 +963,8 @@ static void rna_def_fmodifier_stepped(BlenderRNA *brna)
srna = RNA_def_struct(brna, "FModifierStepped", "FModifier");
RNA_def_struct_ui_text(srna, "Stepped Interpolation F-Modifier",
- "Hold each interpolated value from the F-Curve for several frames without changing the timing");
+ "Hold each interpolated value from the F-Curve for several frames without "
+ "changing the timing");
RNA_def_struct_sdna_from(srna, "FMod_Stepped", "data");
/* properties */
@@ -1062,13 +1067,15 @@ static void rna_def_fmodifier(BlenderRNA *brna)
prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "sfra");
RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_start_frame_range");
- RNA_def_property_ui_text(prop, "Start Frame", "Frame that modifier's influence starts (if Restrict Frame Range is in use)");
+ RNA_def_property_ui_text(prop, "Start Frame",
+ "Frame that modifier's influence starts (if Restrict Frame Range is in use)");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "efra");
RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_end_frame_range");
- RNA_def_property_ui_text(prop, "End Frame", "Frame that modifier's influence ends (if Restrict Frame Range is in use)");
+ RNA_def_property_ui_text(prop, "End Frame",
+ "Frame that modifier's influence ends (if Restrict Frame Range is in use)");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
@@ -1094,7 +1101,8 @@ static void rna_def_fmodifier(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "influence");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Influence", "Amount of influence F-Curve Modifier will have when not fading in/out");
+ RNA_def_property_ui_text(prop, "Influence",
+ "Amount of influence F-Curve Modifier will have when not fading in/out");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
}
@@ -1122,7 +1130,8 @@ static void rna_def_drivertarget(BlenderRNA *brna)
{DTAR_FLAG_LOCALSPACE, "TRANSFORM_SPACE", 0, "Transform Space",
"Transforms don't include parenting/restpose or constraints"},
{DTAR_FLAG_LOCALSPACE|DTAR_FLAG_LOCAL_CONSTS, "LOCAL_SPACE", 0, "Local Space",
- "Transforms include effects of constraints but not parenting/restpose"},
+ "Transforms include effects of constraints but not "
+ "parenting/restpose"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "DriverTarget", NULL);
@@ -1136,7 +1145,8 @@ static void rna_def_drivertarget(BlenderRNA *brna)
/* note: custom set function is ONLY to avoid rna setting a user for this. */
RNA_def_property_pointer_funcs(prop, NULL, "rna_DriverTarget_id_set", "rna_DriverTarget_id_typef", NULL);
RNA_def_property_ui_text(prop, "ID",
- "ID-block that the specific property used can be found from (id_type property must be set first)");
+ "ID-block that the specific property used can be found from "
+ "(id_type property must be set first)");
RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
@@ -1180,7 +1190,8 @@ static void rna_def_drivervar(BlenderRNA *brna)
static EnumPropertyItem prop_type_items[] = {
{DVAR_TYPE_SINGLE_PROP, "SINGLE_PROP", 0, "Single Property", "Use the value from some RNA property (Default)"},
- {DVAR_TYPE_TRANSFORM_CHAN, "TRANSFORMS", 0, "Transform Channel", "Final transformation value of object or bone"},
+ {DVAR_TYPE_TRANSFORM_CHAN, "TRANSFORMS", 0, "Transform Channel",
+ "Final transformation value of object or bone"},
{DVAR_TYPE_ROT_DIFF, "ROTATION_DIFF", 0, "Rotational Difference", "Use the angle between two bones"},
{DVAR_TYPE_LOC_DIFF, "LOC_DIFF", 0, "Distance", "Distance between two bones or objects"},
{0, NULL, 0, NULL, NULL}};
@@ -1206,7 +1217,8 @@ static void rna_def_drivervar(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); /* XXX */
/* Targets */
- /* TODO: for nicer api, only expose the relevant props via subclassing, instead of exposing the collection of targets */
+ /* TODO: for nicer api, only expose the relevant props via subclassing,
+ * instead of exposing the collection of targets */
prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "targets", "num_targets");
RNA_def_property_struct_type(prop, "DriverTarget");
@@ -1324,7 +1336,7 @@ static void rna_def_fpoint(BlenderRNA *brna)
/* duplicate of BezTriple in rna_curve.c
- * but with F-Curve specific options updates/functionality
+ * but with F-Curve specific options updates/functionality
*/
static void rna_def_fkeyframe(BlenderRNA *brna)
{
@@ -1416,7 +1428,8 @@ static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
/* Collection active property */
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "FModifier");
- RNA_def_property_pointer_funcs(prop, "rna_FCurve_active_modifier_get", "rna_FCurve_active_modifier_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_FCurve_active_modifier_get",
+ "rna_FCurve_active_modifier_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active F-Curve Modifier", "Active F-Curve Modifier");
@@ -1459,9 +1472,11 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "insert", "rna_FKeyframe_points_insert");
RNA_def_function_ui_description(func, "Add a keyframe point to a F-Curve");
- parm = RNA_def_float(func, "frame", 0.0f, -FLT_MAX, FLT_MAX, "", "X Value of this keyframe point", -FLT_MAX, FLT_MAX);
+ parm = RNA_def_float(func, "frame", 0.0f, -FLT_MAX, FLT_MAX, "",
+ "X Value of this keyframe point", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm = RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "", "Y Value of this keyframe point", -FLT_MAX, FLT_MAX);
+ parm = RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "",
+ "Y Value of this keyframe point", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_enum_flag(func, "options", keyframe_flag_items, 0, "", "Keyframe options");
@@ -1508,7 +1523,8 @@ static void rna_def_fcurve(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "extend");
RNA_def_property_enum_items(prop, prop_mode_extend_items);
RNA_def_property_ui_text(prop, "Extrapolation", "");
- RNA_def_property_update(prop, NC_ANIMATION, NULL); /* XXX need an update callback for this so that animation gets evaluated */
+ /* XXX need an update callback for this so that animation gets evaluated */
+ RNA_def_property_update(prop, NC_ANIMATION, NULL);
/* Pointers */
prop = RNA_def_property(srna, "driver", PROP_POINTER, PROP_NONE);
@@ -1524,26 +1540,30 @@ static void rna_def_fcurve(BlenderRNA *brna)
/* Path + Array Index */
prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_FCurve_RnaPath_get", "rna_FCurve_RnaPath_length", "rna_FCurve_RnaPath_set");
+ RNA_def_property_string_funcs(prop, "rna_FCurve_RnaPath_get", "rna_FCurve_RnaPath_length",
+ "rna_FCurve_RnaPath_set");
RNA_def_property_ui_text(prop, "Data Path", "RNA Path to property affected by F-Curve");
- RNA_def_property_update(prop, NC_ANIMATION, NULL); /* XXX need an update callback for this to that animation gets evaluated */
+ /* XXX need an update callback for this to that animation gets evaluated */
+ RNA_def_property_update(prop, NC_ANIMATION, NULL);
/* called 'index' when given as function arg */
prop = RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
- RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific property affected by F-Curve if applicable");
- RNA_def_property_update(prop, NC_ANIMATION, NULL); /* XXX need an update callback for this so that animation gets evaluated */
+ RNA_def_property_ui_text(prop, "RNA Array Index",
+ "Index to the specific property affected by F-Curve if applicable");
+ /* XXX need an update callback for this so that animation gets evaluated */
+ RNA_def_property_update(prop, NC_ANIMATION, NULL);
/* Color */
prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_mode_color_items);
RNA_def_property_ui_text(prop, "Color Mode", "Method used to determine color of F-Curve in Graph Editor");
- RNA_def_property_update(prop, NC_ANIMATION, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION, NULL);
prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_array(prop, 3);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Color", "Color of the F-Curve in the Graph Editor");
- RNA_def_property_update(prop, NC_ANIMATION, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION, NULL);
/* Flags */
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
@@ -1570,7 +1590,8 @@ static void rna_def_fcurve(BlenderRNA *brna)
prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FCURVE_DISABLED);
RNA_def_property_ui_text(prop, "Valid",
- "False when F-Curve could not be evaluated in past, so should be skipped when evaluating");
+ "False when F-Curve could not be evaluated in past, so should be skipped "
+ "when evaluating");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
/* Collections */
@@ -1593,7 +1614,8 @@ static void rna_def_fcurve(BlenderRNA *brna)
/* Functions */
func = RNA_def_function(srna, "evaluate", "evaluate_fcurve"); /* calls the C/API direct */
RNA_def_function_ui_description(func, "Evaluate F-Curve");
- parm = RNA_def_float(func, "frame", 1.0f, -FLT_MAX, FLT_MAX, "Frame", "Evaluate F-Curve at given frame", -FLT_MAX, FLT_MAX);
+ parm = RNA_def_float(func, "frame", 1.0f, -FLT_MAX, FLT_MAX, "Frame",
+ "Evaluate F-Curve at given frame", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(parm, PROP_REQUIRED);
/* return value */
parm = RNA_def_float(func, "position", 0, -FLT_MAX, FLT_MAX, "Position", "F-Curve position", -FLT_MAX, FLT_MAX);
@@ -1602,7 +1624,8 @@ static void rna_def_fcurve(BlenderRNA *brna)
func = RNA_def_function(srna, "range", "rna_fcurve_range");
RNA_def_function_ui_description(func, "Get the time extents for F-Curve");
/* return value */
- parm = RNA_def_float_vector(func, "range", 2, NULL, -FLT_MAX, FLT_MAX, "Range", "Min/Max values", -FLT_MAX, FLT_MAX);
+ parm = RNA_def_float_vector(func, "range", 2, NULL, -FLT_MAX, FLT_MAX, "Range",
+ "Min/Max values", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(parm, PROP_THICK_WRAP);
RNA_def_function_output(func, parm);
}
diff --git a/source/blender/makesrna/intern/rna_fcurve_api.c b/source/blender/makesrna/intern/rna_fcurve_api.c
index 4f596dd2b7d..1f8b827f320 100644
--- a/source/blender/makesrna/intern/rna_fcurve_api.c
+++ b/source/blender/makesrna/intern/rna_fcurve_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Joshua Leung
*
* ***** END GPL LICENSE BLOCK *****
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index 5a68fdf1c68..057f82a44e9 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -218,9 +218,13 @@ static void rna_def_fluidsim_slip(StructRNA *srna)
PropertyRNA *prop;
static EnumPropertyItem slip_items[] = {
- {OB_FSBND_NOSLIP, "NOSLIP", 0, "No Slip", "Obstacle causes zero normal and tangential velocity (=sticky), default for all (only option for moving objects)"},
- {OB_FSBND_PARTSLIP, "PARTIALSLIP", 0, "Partial Slip", "Mix between no-slip and free-slip (non moving objects only!)"},
- {OB_FSBND_FREESLIP, "FREESLIP", 0, "Free Slip", "Obstacle only causes zero normal velocity (=not sticky, non moving objects only!)"},
+ {OB_FSBND_NOSLIP, "NOSLIP", 0, "No Slip",
+ "Obstacle causes zero normal and tangential velocity (=sticky), default for all "
+ "(only option for moving objects)"},
+ {OB_FSBND_PARTSLIP, "PARTIALSLIP", 0, "Partial Slip",
+ "Mix between no-slip and free-slip (non moving objects only!)"},
+ {OB_FSBND_FREESLIP, "FREESLIP", 0, "Free Slip",
+ "Obstacle only causes zero normal velocity (=not sticky, non moving objects only!)"},
{0, NULL, 0, NULL, NULL}};
prop = RNA_def_property(srna, "slip_type", PROP_ENUM, PROP_NONE);
@@ -232,7 +236,8 @@ static void rna_def_fluidsim_slip(StructRNA *srna)
prop = RNA_def_property(srna, "partial_slip_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "partSlipValue");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Partial Slip Amount", "Amount of mixing between no- and free-slip, 0 is no slip and 1 is free slip");
+ RNA_def_property_ui_text(prop, "Partial Slip Amount",
+ "Amount of mixing between no- and free-slip, 0 is no slip and 1 is free slip");
}
static void rna_def_fluid_mesh_vertices(BlenderRNA *brna)
@@ -273,7 +278,8 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
srna = RNA_def_struct(brna, "DomainFluidSettings", "FluidSettings");
RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Domain Fluid Simulation Settings", "Fluid simulation settings for the domain of a fluid simulation");
+ RNA_def_struct_ui_text(srna, "Domain Fluid Simulation Settings",
+ "Fluid simulation settings for the domain of a fluid simulation");
/* standard settings */
@@ -306,12 +312,14 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_maxlength(prop, FILE_MAX);
RNA_def_property_string_sdna(prop, NULL, "surfdataPath");
- RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store baked fluid simulation files in");
+ RNA_def_property_ui_text(prop, "Path",
+ "Directory (and/or filename prefix) to store baked fluid simulation files in");
RNA_def_property_update(prop, 0, "rna_fluid_update");
prop = RNA_def_property(srna, "memory_estimate", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_DomainFluidSettings_memory_estimate_get", "rna_DomainFluidSettings_memory_estimate_length", NULL);
+ RNA_def_property_string_funcs(prop, "rna_DomainFluidSettings_memory_estimate_get",
+ "rna_DomainFluidSettings_memory_estimate_length", NULL);
RNA_def_property_ui_text(prop, "Memory Estimate", "Estimated amount of memory needed for baking the domain");
/* advanced settings */
@@ -323,7 +331,8 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_time_override", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_OVERRIDE_TIME);
- RNA_def_property_ui_text(prop, "Override Time", "Use a custom start and end time (in seconds) instead of the scene's timeline");
+ RNA_def_property_ui_text(prop, "Override Time",
+ "Use a custom start and end time (in seconds) instead of the scene's timeline");
prop = RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME);
RNA_def_property_float_sdna(prop, NULL, "animStart");
@@ -353,17 +362,21 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
prop = RNA_def_property(srna, "viscosity_preset", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "viscosityMode");
RNA_def_property_enum_items(prop, viscosity_items);
- RNA_def_property_ui_text(prop, "Viscosity Preset", "Set viscosity of the fluid to a preset value, or use manual input");
+ RNA_def_property_ui_text(prop, "Viscosity Preset",
+ "Set viscosity of the fluid to a preset value, or use manual input");
prop = RNA_def_property(srna, "viscosity_base", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "viscosityValue");
RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_text(prop, "Viscosity Base", "Viscosity setting: value that is multiplied by 10 to the power of (exponent*-1)");
+ RNA_def_property_ui_text(prop, "Viscosity Base",
+ "Viscosity setting: value that is multiplied by 10 to the power of (exponent*-1)");
prop = RNA_def_property(srna, "viscosity_exponent", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "viscosityExponent");
RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_text(prop, "Viscosity Exponent", "Negative exponent for the viscosity value (to simplify entering small values e.g. 5*10^-6)");
+ RNA_def_property_ui_text(prop, "Viscosity Exponent",
+ "Negative exponent for the viscosity value (to simplify entering small values "
+ "e.g. 5*10^-6)");
prop = RNA_def_property(srna, "grid_levels", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "maxRefine");
@@ -375,7 +388,9 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "gstar");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0.001, 0.1);
- RNA_def_property_ui_text(prop, "Compressibility", "Allowed compressibility due to gravitational force for standing fluid (directly affects simulation step size)");
+ RNA_def_property_ui_text(prop, "Compressibility",
+ "Allowed compressibility due to gravitational force for standing fluid "
+ "(directly affects simulation step size)");
/* domain boundary settings */
@@ -385,13 +400,17 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "surfaceSmoothing");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0.0, 5.0);
- RNA_def_property_ui_text(prop, "Surface Smoothing", "Amount of surface smoothing (a value of 0 is off, 1 is normal smoothing and more than 1 is extra smoothing)");
+ RNA_def_property_ui_text(prop, "Surface Smoothing",
+ "Amount of surface smoothing (a value of 0 is off, 1 is normal smoothing and "
+ "more than 1 is extra smoothing)");
prop = RNA_def_property(srna, "surface_subdivisions", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "surfaceSubdivs");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0, 5);
- RNA_def_property_ui_text(prop, "Surface Subdivisions", "Number of isosurface subdivisions (this is necessary for the inclusion of particles into the surface generation - WARNING: can lead to longer computation times !)");
+ RNA_def_property_ui_text(prop, "Surface Subdivisions",
+ "Number of isosurface subdivisions (this is necessary for the inclusion of particles "
+ "into the surface generation - WARNING: can lead to longer computation times !)");
prop = RNA_def_property(srna, "use_speed_vectors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "domainNovecgen", 0);
@@ -422,7 +441,9 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
prop = RNA_def_property(srna, "fluid_mesh_vertices", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "FluidMeshVertex");
RNA_def_property_ui_text(prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation");
- RNA_def_property_collection_funcs(prop, "rna_FluidMeshVertex_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_FluidMeshVertex_data_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_FluidMeshVertex_data_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_get",
+ "rna_FluidMeshVertex_data_length", NULL, NULL, NULL);
rna_def_fluid_mesh_vertices(brna);
}
@@ -445,7 +466,9 @@ static void rna_def_fluidsim_volume(StructRNA *srna)
prop = RNA_def_property(srna, "use_animated_mesh", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "domainNovecgen", 0);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Export Animated Mesh", "Export this mesh as an animated one (slower, only use if really necessary [e.g. armatures or parented objects], animated pos/rot/scale F-Curves do not require it)");
+ RNA_def_property_ui_text(prop, "Export Animated Mesh",
+ "Export this mesh as an animated one (slower, only use if really necessary [e.g. "
+ "armatures or parented objects], animated pos/rot/scale F-Curves do not require it)");
}
static void rna_def_fluidsim_active(StructRNA *srna)
@@ -464,7 +487,8 @@ static void rna_def_fluidsim_fluid(BlenderRNA *brna)
srna = RNA_def_struct(brna, "FluidFluidSettings", "FluidSettings");
RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Fluid Fluid Simulation Settings", "Fluid simulation settings for the fluid in the simulation");
+ RNA_def_struct_ui_text(srna, "Fluid Fluid Simulation Settings",
+ "Fluid simulation settings for the fluid in the simulation");
rna_def_fluidsim_active(srna);
rna_def_fluidsim_volume(srna);
@@ -483,7 +507,8 @@ static void rna_def_fluidsim_obstacle(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ObstacleFluidSettings", "FluidSettings");
RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Obstacle Fluid Simulation Settings", "Fluid simulation settings for obstacles in the simulation");
+ RNA_def_struct_ui_text(srna, "Obstacle Fluid Simulation Settings",
+ "Fluid simulation settings for obstacles in the simulation");
rna_def_fluidsim_active(srna);
rna_def_fluidsim_volume(srna);
@@ -493,7 +518,10 @@ static void rna_def_fluidsim_obstacle(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "surfaceSmoothing");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, -2.0, 10.0);
- RNA_def_property_ui_text(prop, "Impact Factor", "This is an unphysical value for moving objects - it controls the impact an obstacle has on the fluid, =0 behaves a bit like outflow (deleting fluid), =1 is default, while >1 results in high forces (can be used to tweak total mass)");
+ RNA_def_property_ui_text(prop, "Impact Factor",
+ "This is an unphysical value for moving objects - it controls the impact an obstacle "
+ "has on the fluid, =0 behaves a bit like outflow (deleting fluid), =1 is default, "
+ "while >1 results in high forces (can be used to tweak total mass)");
}
static void rna_def_fluidsim_inflow(BlenderRNA *brna)
@@ -503,7 +531,8 @@ static void rna_def_fluidsim_inflow(BlenderRNA *brna)
srna = RNA_def_struct(brna, "InflowFluidSettings", "FluidSettings");
RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Inflow Fluid Simulation Settings", "Fluid simulation settings for objects adding fluids in the simulation");
+ RNA_def_struct_ui_text(srna, "Inflow Fluid Simulation Settings",
+ "Fluid simulation settings for objects adding fluids in the simulation");
rna_def_fluidsim_active(srna);
rna_def_fluidsim_volume(srna);
@@ -517,7 +546,8 @@ static void rna_def_fluidsim_inflow(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_local_coords", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSINFLOW_LOCALCOORD);
- RNA_def_property_ui_text(prop, "Local Coordinates", "Use local coordinates for inflow (e.g. for rotating objects)");
+ RNA_def_property_ui_text(prop, "Local Coordinates",
+ "Use local coordinates for inflow (e.g. for rotating objects)");
}
static void rna_def_fluidsim_outflow(BlenderRNA *brna)
@@ -526,7 +556,8 @@ static void rna_def_fluidsim_outflow(BlenderRNA *brna)
srna = RNA_def_struct(brna, "OutflowFluidSettings", "FluidSettings");
RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Outflow Fluid Simulation Settings", "Fluid simulation settings for objects removing fluids from the simulation");
+ RNA_def_struct_ui_text(srna, "Outflow Fluid Simulation Settings",
+ "Fluid simulation settings for objects removing fluids from the simulation");
rna_def_fluidsim_active(srna);
rna_def_fluidsim_volume(srna);
@@ -539,7 +570,9 @@ static void rna_def_fluidsim_particle(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ParticleFluidSettings", "FluidSettings");
RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Particle Fluid Simulation Settings", "Fluid simulation settings for objects storing fluid particles generated by the simulation");
+ RNA_def_struct_ui_text(srna, "Particle Fluid Simulation Settings",
+ "Fluid simulation settings for objects storing fluid particles generated"
+ " by the simulation");
prop = RNA_def_property(srna, "use_drops", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_DROP);
@@ -556,12 +589,16 @@ static void rna_def_fluidsim_particle(BlenderRNA *brna)
prop = RNA_def_property(srna, "particle_influence", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "particleInfSize");
RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_text(prop, "Particle Influence", "Amount of particle size scaling: 0=off (all same size), 1=full (range 0.2-2.0), >1=stronger");
+ RNA_def_property_ui_text(prop, "Particle Influence",
+ "Amount of particle size scaling: 0=off (all same size), 1=full (range 0.2-2.0), "
+ ">1=stronger");
prop = RNA_def_property(srna, "alpha_influence", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "particleInfAlpha");
RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_text(prop, "Alpha Influence", "Amount of particle alpha change, inverse of size influence: 0=off (all same alpha), 1=full (large particles get lower alphas, smaller ones higher values)");
+ RNA_def_property_ui_text(prop, "Alpha Influence",
+ "Amount of particle alpha change, inverse of size influence: 0=off (all same alpha), "
+ "1=full (large particles get lower alphas, smaller ones higher values)");
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_maxlength(prop, FILE_MAX);
@@ -577,7 +614,8 @@ static void rna_def_fluidsim_control(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ControlFluidSettings", "FluidSettings");
RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Control Fluid Simulation Settings", "Fluid simulation settings for objects controlling the motion of fluid in the simulation");
+ RNA_def_struct_ui_text(srna, "Control Fluid Simulation Settings",
+ "Fluid simulation settings for objects controlling the motion of fluid in the simulation");
rna_def_fluidsim_active(srna);
@@ -594,7 +632,8 @@ static void rna_def_fluidsim_control(BlenderRNA *brna)
prop = RNA_def_property(srna, "attraction_strength", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "attractforceStrength");
RNA_def_property_range(prop, -10.0, 10.0);
- RNA_def_property_ui_text(prop, "Attraction Strength", "Force strength for directional attraction towards the control object");
+ RNA_def_property_ui_text(prop, "Attraction Strength",
+ "Force strength for directional attraction towards the control object");
prop = RNA_def_property(srna, "attraction_radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "attractforceRadius");
@@ -604,7 +643,9 @@ static void rna_def_fluidsim_control(BlenderRNA *brna)
prop = RNA_def_property(srna, "velocity_strength", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "velocityforceStrength");
RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_text(prop, "Velocity Strength", "Force strength of how much of the control object's velocity is influencing the fluid velocity");
+ RNA_def_property_ui_text(prop, "Velocity Strength",
+ "Force strength of how much of the control object's velocity is influencing the "
+ "fluid velocity");
prop = RNA_def_property(srna, "velocity_radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "velocityforceRadius");
@@ -615,7 +656,8 @@ static void rna_def_fluidsim_control(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "cpsQuality");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 5.0, 100.0);
- RNA_def_property_ui_text(prop, "Quality", "Quality which is used for object sampling (higher = better but slower)");
+ RNA_def_property_ui_text(prop, "Quality",
+ "Quality which is used for object sampling (higher = better but slower)");
prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_REVERSE);
@@ -631,13 +673,18 @@ void RNA_def_fluidsim(BlenderRNA *brna)
static EnumPropertyItem prop_fluid_type_items[] = {
{OB_FLUIDSIM_ENABLE, "NONE", 0, "None", ""},
- {OB_FLUIDSIM_DOMAIN, "DOMAIN", 0, "Domain", "Bounding box of this object represents the computational domain of the fluid simulation"},
+ {OB_FLUIDSIM_DOMAIN, "DOMAIN", 0, "Domain",
+ "Bounding box of this object represents the computational domain of the "
+ "fluid simulation"},
{OB_FLUIDSIM_FLUID, "FLUID", 0, "Fluid", "Object represents a volume of fluid in the simulation"},
{OB_FLUIDSIM_OBSTACLE, "OBSTACLE", 0, "Obstacle", "Object is a fixed obstacle"},
{OB_FLUIDSIM_INFLOW, "INFLOW", 0, "Inflow", "Object adds fluid to the simulation"},
{OB_FLUIDSIM_OUTFLOW, "OUTFLOW", 0, "Outflow", "Object removes fluid from the simulation"},
- {OB_FLUIDSIM_PARTICLE, "PARTICLE", 0, "Particle", "Object is made a particle system to display particles generated by a fluidsim domain object"},
- {OB_FLUIDSIM_CONTROL, "CONTROL", 0, "Control", "Object is made a fluid control mesh, which influences the fluid"},
+ {OB_FLUIDSIM_PARTICLE, "PARTICLE", 0, "Particle",
+ "Object is made a particle system to display particles generated by a "
+ "fluidsim domain object"},
+ {OB_FLUIDSIM_CONTROL, "CONTROL", 0, "Control",
+ "Object is made a fluid control mesh, which influences the fluid"},
{0, NULL, 0, NULL, NULL}};
@@ -645,7 +692,8 @@ void RNA_def_fluidsim(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "FluidsimSettings");
RNA_def_struct_refine_func(srna, "rna_FluidSettings_refine");
RNA_def_struct_path_func(srna, "rna_FluidSettings_path");
- RNA_def_struct_ui_text(srna, "Fluid Simulation Settings", "Fluid simulation settings for an object taking part in the simulation");
+ RNA_def_struct_ui_text(srna, "Fluid Simulation Settings",
+ "Fluid simulation settings for an object taking part in the simulation");
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "type");
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index fa8f9bf9d35..53ef1bdbf82 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -254,7 +254,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
/* expose as layers.active */
#if 0
- prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ACTIVE);
RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencilLayer_active_set");
RNA_def_property_ui_text(prop, "Active", "Set active layer for editing");
diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c
index 7c66110cb85..a34b3b5fed8 100644
--- a/source/blender/makesrna/intern/rna_group.c
+++ b/source/blender/makesrna/intern/rna_group.c
@@ -113,7 +113,8 @@ void RNA_def_group(BlenderRNA *brna)
srna = RNA_def_struct(brna, "Group", "ID");
RNA_def_struct_ui_text(srna, "Group", "Group of Object datablocks");
RNA_def_struct_ui_icon(srna, ICON_GROUP);
- RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); /* this is done on save/load in readfile.c, removed if no objects are in the group */
+ /* this is done on save/load in readfile.c, removed if no objects are in the group */
+ RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
prop = RNA_def_property(srna, "dupli_offset", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "dupli_ofs");
@@ -137,4 +138,3 @@ void RNA_def_group(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index ebd77219dc0..e5a0f43baf3 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -152,7 +152,8 @@ char *rna_ImageUser_path(PointerRNA *ptr)
return BLI_strdup("");
}
-static EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *free)
{
Image *ima = (Image*)ptr->data;
EnumPropertyItem *item = NULL;
@@ -190,7 +191,7 @@ static void rna_Image_file_format_set(PointerRNA *ptr, int value)
/*
ibuf= BKE_image_get_ibuf(image, NULL);
- if(ibuf)
+ if (ibuf)
ibuf->ftype= ftype;
*/
@@ -361,7 +362,8 @@ static void rna_def_imageuser(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "ImageUser", NULL);
- RNA_def_struct_ui_text(srna, "Image User", "Parameters defining how an Image datablock is used by another datablock");
+ RNA_def_struct_ui_text(srna, "Image User",
+ "Parameters defining how an Image datablock is used by another datablock");
RNA_def_struct_path_func(srna, "rna_ImageUser_path");
prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
@@ -390,7 +392,8 @@ static void rna_def_imageuser(BlenderRNA *brna)
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "sfra");
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Start Frame", "Global starting frame of the movie/sequence, assuming first picture has a #1");
+ RNA_def_property_ui_text(prop, "Start Frame",
+ "Global starting frame of the movie/sequence, assuming first picture has a #1");
RNA_def_property_update(prop, 0, "rna_ImageUser_update");
prop = RNA_def_property(srna, "fields_per_frame", PROP_INT, PROP_NONE);
@@ -489,7 +492,9 @@ static void rna_def_image(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_color_unpremultiply", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_CM_PREDIVIDE);
- RNA_def_property_ui_text(prop, "Color Unpremultiply", "For premultiplied alpha images, do color space conversion on colors without alpha, to avoid fringing for images with light backgrounds");
+ RNA_def_property_ui_text(prop, "Color Unpremultiply",
+ "For premultiplied alpha images, do color space conversion on colors without alpha, "
+ "to avoid fringing for images with light backgrounds");
RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_free_update");
prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
@@ -560,7 +565,8 @@ static void rna_def_image(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_tiles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_TILES);
- RNA_def_property_ui_text(prop, "Tiles", "Use of tilemode for faces (default shift-LMB to pick the tile for selected faces)");
+ RNA_def_property_ui_text(prop, "Tiles",
+ "Use of tilemode for faces (default shift-LMB to pick the tile for selected faces)");
RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop = RNA_def_property(srna, "tiles_x", PROP_INT, PROP_NONE);
@@ -605,7 +611,8 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Depth", "Image bit depth");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size" , "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
+ prop = RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size" ,
+ "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
RNA_def_property_int_funcs(prop, "rna_Image_size_get" , NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -629,4 +636,3 @@ void RNA_def_image(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 39561536a67..1b50db36a3d 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -1,11 +1,11 @@
/*
- *
+ *
* ***** 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.
+ * 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
@@ -19,7 +19,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Arystanbek Dyussenov
*
* ***** END GPL LICENSE BLOCK *****
@@ -83,7 +83,7 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
else {
/* temp swap out the color */
const unsigned char imb_planes_back = ibuf->planes;
- const float dither_back = ibuf->dither;
+ const float dither_back = ibuf->dither;
ibuf->planes = scene->r.im_format.planes;
ibuf->dither = scene->r.dither_intensity;
if (!BKE_write_ibuf(ibuf, path, &scene->r.im_format)) {
@@ -94,7 +94,8 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
}
BKE_image_release_ibuf(image, lock);
- } else {
+ }
+ else {
BKE_reportf(reports, RPT_ERROR, "Scene not in context, couldn't get save parameters");
}
}
@@ -207,7 +208,7 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint)mag);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
error = (int)glGetError();
}
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 3bc47f6743d..493b246e8d7 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -189,7 +189,9 @@ void rna_def_animviz_common(struct StructRNA *srna);
void rna_def_motionpath_common(struct StructRNA *srna);
void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable);
-void rna_def_mtex_common(struct BlenderRNA *brna, struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *activeeditable, const char *structname, const char *structname_slots, const char *update);
+void rna_def_mtex_common(struct BlenderRNA *brna, struct StructRNA *srna, const char *begin, const char *activeget,
+ const char *activeset, const char *activeeditable, const char *structname,
+ const char *structname_slots, const char *update);
void rna_def_render_layer_common(struct StructRNA *srna, int scene);
void rna_ID_name_get(struct PointerRNA *ptr, char *value);
@@ -200,7 +202,9 @@ struct IDProperty *rna_ID_idprops(struct PointerRNA *ptr, int create);
void rna_ID_fake_user_set(struct PointerRNA *ptr, int value);
struct IDProperty *rna_PropertyGroup_idprops(struct PointerRNA *ptr, int create);
void rna_PropertyGroup_unregister(struct Main *bmain, struct StructRNA *type);
-struct StructRNA *rna_PropertyGroup_register(struct Main *bmain, struct ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free);
+struct StructRNA *rna_PropertyGroup_register(struct Main *bmain, struct ReportList *reports, void *data,
+ const char *identifier, StructValidateFunc validate,
+ StructCallbackFunc call, StructFreeFunc free);
struct StructRNA* rna_PropertyGroup_refine(struct PointerRNA *ptr);
void rna_object_vgroup_name_index_get(struct PointerRNA *ptr, char *value, int index);
@@ -343,7 +347,8 @@ typedef struct ArrayIterator {
void *free_ptr; /* will be freed if set */
int itemsize;
- /* array length with no skip functins applied, take care not to compare against index from animsys or python indices */
+ /* array length with no skip functins applied, take care not to compare against index from animsys
+ * or python indices */
int length;
/* optional skip function, when set the array as viewed by rna can contain only a subset of the members.
@@ -351,7 +356,8 @@ typedef struct ArrayIterator {
IteratorSkipFunc skip;
} ArrayIterator;
-void rna_iterator_array_begin(struct CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, int free_ptr, IteratorSkipFunc skip);
+void rna_iterator_array_begin(struct CollectionPropertyIterator *iter, void *ptr, int itemsize, int length,
+ int free_ptr, IteratorSkipFunc skip);
void rna_iterator_array_next(struct CollectionPropertyIterator *iter);
void *rna_iterator_array_get(struct CollectionPropertyIterator *iter);
void *rna_iterator_array_dereference_get(struct CollectionPropertyIterator *iter);
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index 997f9d084c5..3fc6b0e4599 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -88,7 +88,8 @@ typedef int (*PropStringLengthFunc)(struct PointerRNA *ptr);
typedef void (*PropStringSetFunc)(struct PointerRNA *ptr, const char *value);
typedef int (*PropEnumGetFunc)(struct PointerRNA *ptr);
typedef void (*PropEnumSetFunc)(struct PointerRNA *ptr, int value);
-typedef EnumPropertyItem *(*PropEnumItemFunc)(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+typedef EnumPropertyItem *(*PropEnumItemFunc)(struct bContext *C, struct PointerRNA *ptr,
+ struct PropertyRNA *prop, int *free);
typedef PointerRNA (*PropPointerGetFunc)(struct PointerRNA *ptr);
typedef StructRNA* (*PropPointerTypeFunc)(struct PointerRNA *ptr);
typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, const PointerRNA value);
@@ -312,6 +313,8 @@ struct StructRNA {
const char *name;
/* single line description, displayed in the tooltip for example */
const char *description;
+ /* context for translation */
+ const char *translation_context;
/* icon ID */
int icon;
@@ -331,21 +334,21 @@ struct StructRNA {
struct StructRNA *nested;
/* function to give the more specific type */
- StructRefineFunc refine;
+ StructRefineFunc refine;
/* function to find path to this struct in an ID */
- StructPathFunc path;
+ StructPathFunc path;
/* function to register/unregister subclasses */
- StructRegisterFunc reg;
- StructUnregisterFunc unreg;
+ StructRegisterFunc reg;
+ StructUnregisterFunc unreg;
StructInstanceFunc instance;
/* callback to get id properties */
IDPropertiesFunc idproperties;
/* functions of this struct */
- ListBase functions;
+ ListBase functions;
};
/* Blender RNA
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index 9e7ea1379d9..834a9fd18dd 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -372,7 +372,7 @@ static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point)
if (ELEM(NULL, key, point))
return NULL;
- /* we'll need to manually search through the keyblocks and check
+ /* we'll need to manually search through the keyblocks and check
* if the point is somewhere in the middle of each block's data
*/
for (kb = key->block.first; kb; kb = kb->next) {
@@ -390,7 +390,7 @@ static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point)
return kb;
}
- /* determine where end of array is
+ /* determine where end of array is
* - elemsize is in bytes, so use char* cast to get array in terms of bytes
*/
end = (float *)((char *)start + (key->elemsize * kb->totelem));
@@ -408,7 +408,7 @@ static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point)
static int rna_ShapeKeyPoint_get_index(Key *key, KeyBlock *kb, float *point)
{
- /* if we frame the data array and point pointers as char*, then the difference between
+ /* if we frame the data array and point pointers as char*, then the difference between
* them will be in bytes. Thus, dividing through by key->elemsize (number of bytes per point)
* gives us the offset of point from start of array.
*/
@@ -426,7 +426,7 @@ static char *rna_ShapeKeyPoint_path(PointerRNA *ptr)
float *point = (float *)ptr->data;
/* if we can get a key block, we can construct a path */
- kb = rna_ShapeKeyData_find_keyblock(key, point);
+ kb = rna_ShapeKeyData_find_keyblock(key, point);
if (kb) {
int index = rna_ShapeKeyPoint_get_index(key, kb, point);
@@ -459,7 +459,8 @@ static void rna_def_keydata(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ShapeKeyCurvePoint", NULL);
RNA_def_struct_ui_text(srna, "Shape Key Curve Point", "Point in a shape key for curves");
- RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path"); /* there's nothing type specific here, so this is fine for now */
+ /* there's nothing type specific here, so this is fine for now */
+ RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 3);
@@ -474,7 +475,8 @@ static void rna_def_keydata(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ShapeKeyBezierPoint", NULL);
RNA_def_struct_ui_text(srna, "Shape Key Bezier Point", "Point in a shape key for Bezier curves");
- RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path"); /* there's nothing type specific here, so this is fine for now */
+ /* there's nothing type specific here, so this is fine for now */
+ RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 3);
@@ -484,19 +486,21 @@ static void rna_def_keydata(BlenderRNA *brna)
prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_handle_1_co_get", "rna_ShapeKeyBezierPoint_handle_1_co_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_handle_1_co_get",
+ "rna_ShapeKeyBezierPoint_handle_1_co_set", NULL);
RNA_def_property_ui_text(prop, "Handle 1 Location", "");
RNA_def_property_update(prop, 0, "rna_Key_update_data");
prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_handle_2_co_get", "rna_ShapeKeyBezierPoint_handle_2_co_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_handle_2_co_get",
+ "rna_ShapeKeyBezierPoint_handle_2_co_set", NULL);
RNA_def_property_ui_text(prop, "Handle 2 Location", "");
RNA_def_property_update(prop, 0, "rna_Key_update_data");
/* appears to be unused currently */
#if 0
- prop= RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_tilt_get", "rna_ShapeKeyBezierPoint_tilt_set", NULL);
RNA_def_property_ui_text(prop, "Tilt", "");
RNA_def_property_update(prop, 0, "rna_Key_update_data");
@@ -532,7 +536,8 @@ static void rna_def_keyblock(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Frame", "Frame for absolute keys");
RNA_def_property_update(prop, 0, "rna_Key_update_data");
- /* for now, this is editable directly, as users can set this even if they're not animating them (to test results) */
+ /* for now, this is editable directly, as users can set this even if they're not animating them
+ * (to test results) */
prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "curval");
RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_value_set", "rna_ShapeKey_value_range");
@@ -554,7 +559,8 @@ static void rna_def_keyblock(BlenderRNA *brna)
prop = RNA_def_property(srna, "relative_key", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "ShapeKey");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_ShapeKey_relative_key_get", "rna_ShapeKey_relative_key_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_ShapeKey_relative_key_get",
+ "rna_ShapeKey_relative_key_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Relative Key", "Shape used as a relative key");
RNA_def_property_update(prop, 0, "rna_Key_update_data");
@@ -581,7 +587,8 @@ static void rna_def_keyblock(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "data", "totelem");
RNA_def_property_struct_type(prop, "UnknownType");
RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", NULL, NULL, "rna_ShapeKey_data_get", "rna_ShapeKey_data_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", NULL, NULL, "rna_ShapeKey_data_get",
+ "rna_ShapeKey_data_length", NULL, NULL, NULL);
}
static void rna_def_key(BlenderRNA *brna)
@@ -619,7 +626,8 @@ static void rna_def_key(BlenderRNA *brna)
prop = RNA_def_property(srna, "slurph", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "slurph");
RNA_def_property_range(prop, -500, 500);
- RNA_def_property_ui_text(prop, "Slurph", "Create a delay (in frames) in applying keypositions, first vertex goes first");
+ RNA_def_property_ui_text(prop, "Slurph",
+ "Create a delay (in frames) in applying keypositions, first vertex goes first");
RNA_def_property_update(prop, 0, "rna_Key_update_data");
}
@@ -631,4 +639,3 @@ void RNA_def_key(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index f5ba7fbe816..671bee80523 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -297,7 +297,8 @@ static void rna_def_lamp_sky_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "atmosphere_distance_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "atm_distance_factor");
RNA_def_property_range(prop, 0.0f, 500.0f);
- RNA_def_property_ui_text(prop, "Atmosphere Distance Factor", "Multiplier to convert blender units to physical distance");
+ RNA_def_property_ui_text(prop, "Atmosphere Distance Factor",
+ "Multiplier to convert blender units to physical distance");
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
prop = RNA_def_property(srna, "sky_blend", PROP_FLOAT, PROP_NONE);
@@ -343,7 +344,8 @@ static void rna_def_lamp(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "dist");
RNA_def_property_range(prop, 0, INT_MAX);
RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
- RNA_def_property_ui_text(prop, "Distance", "Falloff distance - the light is at half the original intensity at this point");
+ RNA_def_property_ui_text(prop, "Distance",
+ "Falloff distance - the light is at half the original intensity at this point");
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
@@ -482,20 +484,24 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area)
prop = RNA_def_property(srna, "shadow_ray_sample_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "ray_samp_method");
RNA_def_property_enum_items(prop, (area)? prop_spot_ray_sampling_method_items: prop_ray_sampling_method_items);
- RNA_def_property_ui_text(prop, "Shadow Ray Sampling Method", "Method for generating shadow samples: Adaptive QMC is fastest, Constant QMC is less noisy but slower");
+ RNA_def_property_ui_text(prop, "Shadow Ray Sampling Method",
+ "Method for generating shadow samples: Adaptive QMC is fastest, "
+ "Constant QMC is less noisy but slower");
RNA_def_property_update(prop, 0, "rna_Lamp_update");
prop = RNA_def_property(srna, (area)? "shadow_ray_samples_x": "shadow_ray_samples", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "ray_samp");
RNA_def_property_range(prop, 1, 64);
- RNA_def_property_ui_text(prop, (area)? "Shadow Ray Samples": "Shadow Ray Samples X","Number of samples taken extra (samples x samples)");
+ RNA_def_property_ui_text(prop, (area)? "Shadow Ray Samples": "Shadow Ray Samples X",
+ "Number of samples taken extra (samples x samples)");
RNA_def_property_update(prop, 0, "rna_Lamp_update");
if (area) {
prop = RNA_def_property(srna, "shadow_ray_samples_y", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "ray_sampy");
RNA_def_property_range(prop, 1, 64);
- RNA_def_property_ui_text(prop, "Shadow Ray Samples Y", "Number of samples taken extra (samples x samples)");
+ RNA_def_property_ui_text(prop, "Shadow Ray Samples Y",
+ "Number of samples taken extra (samples x samples)");
RNA_def_property_update(prop, 0, "rna_Lamp_update");
}
@@ -577,7 +583,8 @@ static void rna_def_area_lamp(BlenderRNA *brna)
prop = RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "area_sizey");
RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
- RNA_def_property_ui_text(prop, "Size Y", "Size of the area of the area Lamp in the Y direction for Rectangle shapes");
+ RNA_def_property_ui_text(prop, "Size Y",
+ "Size of the area of the area Lamp in the Y direction for Rectangle shapes");
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
@@ -594,9 +601,14 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
static EnumPropertyItem prop_shadbuftype_items[] = {
{LA_SHADBUF_REGULAR , "REGULAR", 0, "Classical", "Classic shadow buffer"},
- {LA_SHADBUF_HALFWAY, "HALFWAY", 0, "Classic-Halfway", "Regular buffer, averaging the closest and 2nd closest Z value to reducing bias artifacts"},
- {LA_SHADBUF_IRREGULAR, "IRREGULAR", 0, "Irregular", "Irregular buffer produces sharp shadow always, but it doesn't show up for raytracing"},
- {LA_SHADBUF_DEEP, "DEEP", 0, "Deep", "Deep shadow buffer supports transparency and better filtering, at the cost of more memory usage and processing time"},
+ {LA_SHADBUF_HALFWAY, "HALFWAY", 0, "Classic-Halfway",
+ "Regular buffer, averaging the closest and 2nd closest Z value to reducing "
+ "bias artifacts"},
+ {LA_SHADBUF_IRREGULAR, "IRREGULAR", 0, "Irregular",
+ "Irregular buffer produces sharp shadow always, but it doesn't show up for raytracing"},
+ {LA_SHADBUF_DEEP, "DEEP", 0, "Deep",
+ "Deep shadow buffer supports transparency and better filtering, at the cost of "
+ "more memory usage and processing time"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_shadbuffiltertype_items[] = {
@@ -644,7 +656,9 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
prop = RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "bufsize");
RNA_def_property_range(prop, 512, 10240);
- RNA_def_property_ui_text(prop, "Shadow Buffer Size", "Resolution of the shadow buffer, higher values give crisper shadows but use more memory");
+ RNA_def_property_ui_text(prop, "Shadow Buffer Size",
+ "Resolution of the shadow buffer, higher values give crisper shadows "
+ "but use more memory");
RNA_def_property_int_funcs(prop, NULL, "rna_Lamp_buffer_size_set", NULL);
RNA_def_property_update(prop, 0, "rna_Lamp_update");
@@ -657,7 +671,8 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
prop = RNA_def_property(srna, "shadow_sample_buffers", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "buffers");
RNA_def_property_enum_items(prop, prop_numbuffer_items);
- RNA_def_property_ui_text(prop, "Shadow Sample Buffers", "Number of shadow buffers to render for better AA, this increases memory usage");
+ RNA_def_property_ui_text(prop, "Shadow Sample Buffers",
+ "Number of shadow buffers to render for better AA, this increases memory usage");
RNA_def_property_update(prop, 0, "rna_Lamp_update");
prop = RNA_def_property(srna, "spot_blend", PROP_FLOAT, PROP_NONE);
@@ -670,24 +685,28 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
/* RNA_def_property_float_sdna(prop, NULL, "spotsize"); */
RNA_def_property_range(prop, M_PI/180.0, M_PI);
RNA_def_property_ui_text(prop, "Spot Size", "Angle of the spotlight beam");
- RNA_def_property_float_funcs(prop, "rna_Lamp_spot_size_get", "rna_Lamp_spot_size_set", NULL); /* only for deg/rad conversion */
+ /* only for deg/rad conversion */
+ RNA_def_property_float_funcs(prop, "rna_Lamp_spot_size_get", "rna_Lamp_spot_size_set", NULL);
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
prop = RNA_def_property(srna, "show_cone", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SHOW_CONE);
- RNA_def_property_ui_text(prop, "Show Cone", "Draw transparent cone in 3D view to visualize which objects are contained in it");
+ RNA_def_property_ui_text(prop, "Show Cone",
+ "Draw transparent cone in 3D view to visualize which objects are contained in it");
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
prop = RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "clipsta");
RNA_def_property_range(prop, 0.0f, 9999.0f);
- RNA_def_property_ui_text(prop, "Shadow Buffer Clip Start", "Shadow map clip start, below which objects will not generate shadows");
+ RNA_def_property_ui_text(prop, "Shadow Buffer Clip Start",
+ "Shadow map clip start, below which objects will not generate shadows");
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
prop = RNA_def_property(srna, "shadow_buffer_clip_end", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "clipend");
RNA_def_property_range(prop, 0.0f, 9999.0f);
- RNA_def_property_ui_text(prop, "Shadow Buffer Clip End", "Shadow map clip end, beyond which objects will not generate shadows");
+ RNA_def_property_ui_text(prop, "Shadow Buffer Clip End",
+ "Shadow map clip end, beyond which objects will not generate shadows");
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
prop = RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
@@ -716,7 +735,8 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_auto_clip_start", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "bufflag", LA_SHADBUF_AUTO_START);
- RNA_def_property_ui_text(prop, "Autoclip Start", "Automatic calculation of clipping-start, based on visible vertices");
+ RNA_def_property_ui_text(prop, "Autoclip Start",
+ "Automatic calculation of clipping-start, based on visible vertices");
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
prop = RNA_def_property(srna, "use_auto_clip_end", PROP_BOOLEAN, PROP_NONE);
@@ -775,4 +795,3 @@ void RNA_def_lamp(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index 24445e652cc..5d8d8c7bd02 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -236,7 +236,9 @@ static void rna_def_latticepoint(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "VertexGroupElement");
RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this point is member of");
}
@@ -316,7 +318,8 @@ static void rna_def_lattice(BlenderRNA *brna)
prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "LatticePoint");
- RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Points", "Points of the lattice");
/* pointers */
@@ -330,4 +333,3 @@ void RNA_def_lattice(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 0a54fbf6728..3a596894fac 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -297,12 +297,14 @@ void RNA_def_main(BlenderRNA *brna)
{"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks", RNA_def_main_scenes},
{"objects", "Object", "rna_Main_object_begin", "Objects", "Object datablocks", RNA_def_main_objects},
{"materials", "Material", "rna_Main_mat_begin", "Materials", "Material datablocks", RNA_def_main_materials},
- {"node_groups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks", RNA_def_main_node_groups},
+ {"node_groups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks",
+ RNA_def_main_node_groups},
{"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh datablocks", RNA_def_main_meshes},
{"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp datablocks", RNA_def_main_lamps},
{"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library datablocks", RNA_def_main_libraries},
{"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen datablocks", RNA_def_main_screens},
- {"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks", RNA_def_main_window_managers},
+ {"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks",
+ RNA_def_main_window_managers},
{"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks", RNA_def_main_images},
{"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks", RNA_def_main_lattices},
{"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks", RNA_def_main_curves} ,
@@ -317,18 +319,23 @@ void RNA_def_main(BlenderRNA *brna)
{"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks", RNA_def_main_texts},
{"speakers", "Speaker", "rna_Main_speaker_begin", "Speakers", "Speaker datablocks", RNA_def_main_speakers},
{"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks", RNA_def_main_sounds},
- {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks", RNA_def_main_armatures},
+ {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks",
+ RNA_def_main_armatures},
{"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks", RNA_def_main_actions},
- {"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks", RNA_def_main_particles},
- {"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks", RNA_def_main_gpencil},
- {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip datablocks", RNA_def_main_movieclips},
+ {"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks",
+ RNA_def_main_particles},
+ {"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks",
+ RNA_def_main_gpencil},
+ {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip datablocks",
+ RNA_def_main_movieclips},
{"linestyles", "FreestyleLineStyle", "rna_Main_linestyle_begin", "Line Styles", "Line Style datablocks", RNA_def_main_linestyles},
{NULL, NULL, NULL, NULL, NULL, NULL}};
int i;
srna = RNA_def_struct(brna, "BlendData", NULL);
- RNA_def_struct_ui_text(srna, "Blendfile Data", "Main data structure representing a .blend file and all its datablocks");
+ RNA_def_struct_ui_text(srna, "Blendfile Data",
+ "Main data structure representing a .blend file and all its datablocks");
RNA_def_struct_ui_icon(srna, ICON_BLENDER);
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
@@ -351,7 +358,9 @@ void RNA_def_main(BlenderRNA *brna)
{
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", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, lists[i].iter_begin, "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, lists[i].name, lists[i].description);
/* collection functions */
@@ -376,4 +385,3 @@ void RNA_def_main(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index cd7b0e814c7..803e79d570b 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
@@ -119,7 +119,7 @@ Scene *rna_Main_scenes_new(Main *UNUSED(bmain), const char *name)
}
void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struct Scene *scene)
{
- /* dont call free_libblock(...) directly */
+ /* don't call free_libblock(...) directly */
Scene *newscene;
if (scene->id.prev)
@@ -532,7 +532,8 @@ MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *reports, con
clip = BKE_add_movieclip_file(filepath);
if (!clip)
- BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unable to load movie clip");
+ BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath,
+ errno ? strerror(errno) : "Unable to load movie clip");
return clip;
}
@@ -1568,4 +1569,3 @@ void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index e62f85a1f08..a765cbb6690 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -49,7 +49,8 @@ static EnumPropertyItem prop_texture_coordinates_items[] = {
{TEXCO_WINDOW, "WINDOW", 0, "Window", "Use screen coordinates as texture coordinates"},
{TEXCO_NORM, "NORMAL", 0, "Normal", "Use normal vector as texture coordinates"},
{TEXCO_REFL, "REFLECTION", 0, "Reflection", "Use reflection vector as texture coordinates"},
-{TEXCO_STRESS, "STRESS", 0, "Stress", "Use the difference of edge lengths compared to original coordinates of the mesh"},
+{TEXCO_STRESS, "STRESS", 0, "Stress",
+ "Use the difference of edge lengths compared to original coordinates of the mesh"},
{TEXCO_TANGENT, "TANGENT", 0, "Tangent", "Use the optional tangent vector as texture coordinates"},
{0, NULL, 0, NULL, NULL}};
@@ -70,8 +71,8 @@ EnumPropertyItem ramp_blend_items[] = {
{MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""},
{MA_RAMP_VAL, "VALUE", 0, "Value", ""},
{MA_RAMP_COLOR, "COLOR", 0, "Color", ""},
-{MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""},
-{MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""},
+{MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""},
+{MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""},
{0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
@@ -419,8 +420,9 @@ static void rna_def_material_mtex(BlenderRNA *brna)
{MTEX_COMPAT_BUMP, "BUMP_COMPATIBLE", 0, "Compatible", ""},
{MTEX_3TAP_BUMP, "BUMP_LOW_QUALITY", 0, "Low Quality", "Use 3 tap filtering"},
{MTEX_5TAP_BUMP, "BUMP_MEDIUM_QUALITY", 0, "Medium Quality", "Use 5 tap filtering"},
- {MTEX_BICUBIC_BUMP, "BUMP_BEST_QUALITY", 0, "Best Quality", "Use bicubic filtering (requires OpenGL 3.0+, "
- "it will fall back on medium setting for other systems)"},
+ {MTEX_BICUBIC_BUMP, "BUMP_BEST_QUALITY", 0,
+ "Best Quality", "Use bicubic filtering (requires OpenGL 3.0+, it will fall back on "
+ "medium setting for other systems)"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_bump_space_items[] = {
@@ -455,7 +457,8 @@ static void rna_def_material_mtex(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_from_dupli", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_DUPLI_MAPTO);
RNA_def_property_ui_text(prop, "From Dupli",
- "Dupli's instanced from verts, faces or particles, inherit texture coordinate from their parent");
+ "Dupli's instanced from verts, faces or particles, inherit texture coordinate "
+ "from their parent");
RNA_def_property_update(prop, 0, "rna_Material_update");
prop = RNA_def_property(srna, "use_from_original", PROP_BOOLEAN, PROP_NONE);
@@ -756,15 +759,17 @@ static void rna_def_material_gamesettings(BlenderRNA *brna)
{GEMAT_SOLID, "OPAQUE", 0, "Opaque", "Render color of textured face as color"},
{GEMAT_ADD, "ADD", 0, "Add", "Render face transparent and add color of face"},
{GEMAT_CLIP, "CLIP", 0, "Alpha Clip", "Use the image alpha values clipped with no blending (binary alpha)"},
- {GEMAT_ALPHA, "ALPHA", 0, "Alpha Blend", "Render polygon transparent, depending on alpha channel of the texture"},
- {GEMAT_ALPHA_SORT, "ALPHA_SORT", 0, "Alpha Sort", "Sort faces for correct alpha drawing (slow, use Alpha Clip instead when possible)"},
+ {GEMAT_ALPHA, "ALPHA", 0, "Alpha Blend",
+ "Render polygon transparent, depending on alpha channel of the texture"},
+ {GEMAT_ALPHA_SORT, "ALPHA_SORT", 0, "Alpha Sort",
+ "Sort faces for correct alpha drawing (slow, use Alpha Clip instead when possible)"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_face_orientation_items[] = {
{GEMAT_NORMAL,"NORMAL",0,"Normal","No tranformation"},
{GEMAT_HALO, "HALO", 0, "Halo", "Screen aligned billboard"},
{GEMAT_BILLBOARD, "BILLBOARD", 0, "Billboard", "Billboard with Z-axis constraint"},
- {GEMAT_SHADOW, "SHADOW", 0, "Shadow", "Faces are used for shadow"},
+ {GEMAT_SHADOW, "SHADOW", 0, "Shadow", "Faces are used for shadow"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "MaterialGameSettings", NULL);
@@ -1012,7 +1017,8 @@ static void rna_def_material_raymirror(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "aniso_gloss_mir");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Gloss Anisotropy",
- "The shape of the reflection, from 0.0 (circular) to 1.0 (fully stretched along the tangent");
+ "The shape of the reflection, from 0.0 (circular) to 1.0 "
+ "(fully stretched along the tangent");
RNA_def_property_update(prop, 0, "rna_Material_update");
prop = RNA_def_property(srna, "gloss_samples", PROP_INT, PROP_NONE);
@@ -1060,7 +1066,8 @@ static void rna_def_material_raytra(BlenderRNA *brna)
srna = RNA_def_struct(brna, "MaterialRaytraceTransparency", NULL);
RNA_def_struct_sdna(srna, "Material");
RNA_def_struct_nested(brna, srna, "Material");
- RNA_def_struct_ui_text(srna, "Material Raytrace Transparency", "Raytraced refraction settings for a Material datablock");
+ RNA_def_struct_ui_text(srna, "Material Raytrace Transparency",
+ "Raytraced refraction settings for a Material datablock");
prop = RNA_def_property(srna, "ior", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ang");
@@ -1170,7 +1177,8 @@ static void rna_def_material_volume(BlenderRNA *brna)
prop = RNA_def_property(srna, "light_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "shade_type");
RNA_def_property_enum_items(prop, prop_lighting_items);
- RNA_def_property_ui_text(prop, "Lighting Mode", "Method of shading, attenuating, and scattering light through the volume");
+ RNA_def_property_ui_text(prop, "Lighting Mode",
+ "Method of shading, attenuating, and scattering light through the volume");
RNA_def_property_update(prop, 0, "rna_Material_update");
prop = RNA_def_property(srna, "use_external_shadows", PROP_BOOLEAN, PROP_NONE);
@@ -1189,7 +1197,8 @@ static void rna_def_material_volume(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "precache_resolution");
RNA_def_property_range(prop, 1, 1024);
RNA_def_property_ui_text(prop, "Resolution",
- "Resolution of the voxel grid, low resolutions are faster, high resolutions use more memory");
+ "Resolution of the voxel grid, low resolutions are faster, "
+ "high resolutions use more memory");
RNA_def_property_update(prop, 0, "rna_Material_update");
prop = RNA_def_property(srna, "ms_diffusion", PROP_FLOAT, PROP_NONE);
@@ -1279,7 +1288,8 @@ static void rna_def_material_volume(BlenderRNA *brna)
prop = RNA_def_property(srna, "asymmetry", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "asymmetry");
RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Asymmetry", "Back scattering (-1.0) to Forward scattering (1.0) and the range in between");
+ RNA_def_property_ui_text(prop, "Asymmetry",
+ "Back scattering (-1.0) to Forward scattering (1.0) and the range in between");
RNA_def_property_update(prop, 0, "rna_Material_update");
}
@@ -1638,7 +1648,8 @@ static void rna_def_material_physics(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_fh_normal", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "dynamode", MA_FH_NOR);
RNA_def_property_ui_text(prop, "Align to Normal",
- "Align dynamic game objects along the surface normal, when inside the physics distance area");
+ "Align dynamic game objects along the surface normal, "
+ "when inside the physics distance area");
prop = RNA_def_property(srna, "fh_force", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "fh");
@@ -1784,7 +1795,8 @@ void RNA_def_material(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_light_group_exclusive", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_GROUP_NOLAY);
RNA_def_property_ui_text(prop, "Light Group Exclusive",
- "Material uses the light group exclusively - these lamps are excluded from other scene lighting");
+ "Material uses the light group exclusively - these lamps are excluded "
+ "from other scene lighting");
RNA_def_property_update(prop, 0, "rna_Material_update");
prop = RNA_def_property(srna, "use_raytrace", PROP_BOOLEAN, PROP_NONE);
@@ -1817,7 +1829,8 @@ void RNA_def_material(BlenderRNA *brna)
prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ZINV);
- RNA_def_property_ui_text(prop, "Invert Z Depth", "Render material's faces with an inverted Z buffer (scanline only)");
+ RNA_def_property_ui_text(prop, "Invert Z Depth",
+ "Render material's faces with an inverted Z buffer (scanline only)");
RNA_def_property_update(prop, 0, "rna_Material_update");
prop = RNA_def_property(srna, "offset_z", PROP_FLOAT, PROP_NONE);
@@ -1876,7 +1889,8 @@ void RNA_def_material(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_ray_shadow_bias", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAYBIAS);
RNA_def_property_ui_text(prop, "Ray Shadow Bias",
- "Prevent raytraced shadow errors on surfaces with smooth shaded normals (terminator problem)");
+ "Prevent raytraced shadow errors on surfaces with smooth shaded normals "
+ "(terminator problem)");
RNA_def_property_update(prop, 0, "rna_Material_update");
prop = RNA_def_property(srna, "use_full_oversampling", PROP_BOOLEAN, PROP_NONE);
@@ -2005,7 +2019,8 @@ void RNA_def_material(BlenderRNA *brna)
}
-static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const char *structname, const char *structname_slots)
+static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const char *structname,
+ const char *structname_slots)
{
StructRNA *srna;
@@ -2045,7 +2060,8 @@ void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin,
/* mtex */
prop = RNA_def_property(srna, "texture_slots", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, structname);
- RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end",
+ "rna_iterator_array_dereference_get", NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures");
rna_def_texture_slots(brna, prop, structname, structname_slots);
@@ -2066,5 +2082,3 @@ void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin,
}
#endif
-
-
diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c
index 473f2c03158..e6118f6c527 100644
--- a/source/blender/makesrna/intern/rna_material_api.c
+++ b/source/blender/makesrna/intern/rna_material_api.c
@@ -6,7 +6,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
@@ -20,7 +20,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 816ddc2758d..e4bf5b7163a 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -225,7 +225,7 @@ static float rna_MeshPolygon_area_get(PointerRNA *ptr)
return mesh_calc_poly_area(mp, me->mloop+mp->loopstart, me->mvert, NULL);
}
-static void rna_MeshFace_normal_get(PointerRNA *ptr, float *values)
+static void rna_MeshTessFace_normal_get(PointerRNA *ptr, float *values)
{
Mesh *me = rna_mesh(ptr);
MFace *mface = (MFace*)ptr->data;
@@ -237,7 +237,7 @@ static void rna_MeshFace_normal_get(PointerRNA *ptr, float *values)
normal_tri_v3(values, me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co);
}
-static float rna_MeshFace_area_get(PointerRNA *ptr)
+static float rna_MeshTessFace_area_get(PointerRNA *ptr)
{
Mesh *me = rna_mesh(ptr);
MFace *mface = (MFace*)ptr->data;
@@ -432,18 +432,18 @@ static void rna_MeshLoopColor_color_get(PointerRNA *ptr, float *values)
{
MLoopCol *mcol = (MLoopCol *)ptr->data;
- values[2] = (&mcol->r)[0]/255.0f;
- values[1] = (&mcol->r)[1]/255.0f;
- values[0] = (&mcol->r)[2]/255.0f;
+ values[0] = (&mcol->r)[0] / 255.0f;
+ values[1] = (&mcol->r)[1] / 255.0f;
+ values[2] = (&mcol->r)[2] / 255.0f;
}
static void rna_MeshLoopColor_color_set(PointerRNA *ptr, const float *values)
{
MLoopCol *mcol = (MLoopCol *)ptr->data;
- (&mcol->r)[2] = (char)(CLAMPIS(values[0]*255.0f, 0, 255));
- (&mcol->r)[1] = (char)(CLAMPIS(values[1]*255.0f, 0, 255));
- (&mcol->r)[0] = (char)(CLAMPIS(values[2]*255.0f, 0, 255));
+ (&mcol->r)[0] = (char)(CLAMPIS(values[0] * 255.0f, 0, 255));
+ (&mcol->r)[1] = (char)(CLAMPIS(values[1] * 255.0f, 0, 255));
+ (&mcol->r)[2] = (char)(CLAMPIS(values[2] * 255.0f, 0, 255));
}
static int rna_Mesh_texspace_editable(PointerRNA *ptr)
@@ -466,14 +466,6 @@ static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, Pointe
rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
}
-static void rna_MeshFace_material_index_range(PointerRNA *ptr, int *min, int *max)
-{
- Mesh *me = rna_mesh(ptr);
- *min = 0;
- *max = me->totcol-1;
- *max = MAX2(0, *max);
-}
-
static int rna_CustomDataLayer_active_get(PointerRNA *ptr, CustomData *data, int type, int render)
{
int n = ((CustomDataLayer*)ptr->data) - data->layers;
@@ -666,7 +658,7 @@ static void rna_MeshColorLayer_data_begin(CollectionPropertyIterator *iter, Poin
{
Mesh *me = rna_mesh(ptr);
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(CD_MCOL), me->totface, 0, NULL);
+ rna_iterator_array_begin(iter, layer->data, sizeof(MCol) * 4, me->totface, 0, NULL);
}
static int rna_MeshColorLayer_data_length(PointerRNA *ptr)
@@ -703,7 +695,7 @@ static void rna_MeshLoopColorLayer_data_begin(CollectionPropertyIterator *iter,
{
Mesh *me = rna_mesh(ptr);
CustomDataLayer *layer = (CustomDataLayer*)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(CD_MLOOPCOL), me->totloop, 0, NULL);
+ rna_iterator_array_begin(iter, layer->data, sizeof(MLoopCol), me->totloop, 0, NULL);
}
static int rna_MeshLoopColorLayer_data_length(PointerRNA *ptr)
@@ -861,7 +853,7 @@ static void rna_TextureFace_image_set(PointerRNA *ptr, PointerRNA value)
if (id) {
/* special exception here, individual faces don't count
* as reference, but we do ensure the refcount is not zero */
- if(id->us == 0)
+ if (id->us == 0)
id_us_plus(id);
else
id_lib_extern(id);
@@ -884,7 +876,7 @@ static float rna_Mesh_auto_smooth_angle_get(PointerRNA *ptr)
return DEG2RADF((float)me->smoothresh);
}
-static int rna_MeshFace_verts_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_MeshTessFace_verts_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
MFace *face = (MFace*)ptr->data;
@@ -896,13 +888,13 @@ static int rna_MeshFace_verts_get_length(PointerRNA *ptr, int length[RNA_MAX_ARR
return length[0];
}
-static void rna_MeshFace_verts_get(PointerRNA *ptr, int *values)
+static void rna_MeshTessFace_verts_get(PointerRNA *ptr, int *values)
{
MFace *face = (MFace*)ptr->data;
memcpy(values, &face->v1, (face->v4 ? 4 : 3) * sizeof(int));
}
-static void rna_MeshFace_verts_set(PointerRNA *ptr, const int *values)
+static void rna_MeshTessFace_verts_set(PointerRNA *ptr, const int *values)
{
MFace *face = (MFace*)ptr->data;
memcpy(&face->v1, values, (face->v4 ? 4 : 3) * sizeof(int));
@@ -938,6 +930,13 @@ static void rna_MeshPoly_vertices_set(PointerRNA *ptr, const int *values)
}
}
+static void rna_MeshPoly_material_index_range(PointerRNA *ptr, int *min, int *max)
+{
+ Mesh *me = rna_mesh(ptr);
+ *min = 0;
+ *max = me->totcol-1;
+ *max = MAX2(0, *max);
+}
static int rna_MeshVertex_index_get(PointerRNA *ptr)
{
@@ -953,7 +952,7 @@ static int rna_MeshEdge_index_get(PointerRNA *ptr)
return (int)(edge - me->medge);
}
-static int rna_MeshFace_index_get(PointerRNA *ptr)
+static int rna_MeshTessFace_index_get(PointerRNA *ptr)
{
Mesh *me = rna_mesh(ptr);
MFace *face = (MFace*)ptr->data;
@@ -996,9 +995,9 @@ static char *rna_MeshPolygon_path(PointerRNA *ptr)
return BLI_sprintfN("polygons[%d]", (int)((MPoly*)ptr->data - rna_mesh(ptr)->mpoly));
}
-static char *rna_MeshFace_path(PointerRNA *ptr)
+static char *rna_MeshTessFace_path(PointerRNA *ptr)
{
- return BLI_sprintfN("faces[%d]", (int)((MFace*)ptr->data - rna_mesh(ptr)->mface));
+ return BLI_sprintfN("tessfaces[%d]", (int)((MFace *)ptr->data - rna_mesh(ptr)->mface));
}
static char *rna_MeshEdge_path(PointerRNA *ptr)
@@ -1178,6 +1177,35 @@ static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, struct bContext *C,
return ptr;
}
+static PointerRNA rna_Mesh_tessface_vertex_color_new(struct Mesh *me, struct bContext *C, ReportList *reports,
+ const char *name)
+{
+ PointerRNA ptr;
+ CustomData *fdata;
+ CustomDataLayer *cdl = NULL;
+ int index;
+
+ if (me->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't add tessface colors's in editmode");
+ return PointerRNA_NULL;
+ }
+
+ if (me->mpoly) {
+ BKE_report(reports, RPT_ERROR, "Can't add tessface colors's when MPoly's exist");
+ return PointerRNA_NULL;
+ }
+
+ index = ED_mesh_color_add(C, NULL, NULL, me, name, FALSE);
+
+ if (index != -1) {
+ fdata = rna_mesh_fdata_helper(me);
+ cdl = &fdata->layers[CustomData_get_layer_index_n(fdata, CD_MCOL, index)];
+ }
+
+ RNA_pointer_create(&me->id, &RNA_MeshColorLayer, cdl, &ptr);
+ return ptr;
+}
+
static PointerRNA rna_Mesh_int_property_new(struct Mesh *me, struct bContext *C, const char *name)
{
PointerRNA ptr;
@@ -1242,12 +1270,12 @@ static PointerRNA rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, c
/* while this is supposed to be readonly,
* keep it to support importers that only make tessfaces */
-static PointerRNA rna_Mesh_uv_tessface_texture_new(struct Mesh *me, struct bContext *C, ReportList *reports,
+static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, struct bContext *C, ReportList *reports,
const char *name)
{
PointerRNA ptr;
CustomData *fdata;
- CustomDataLayer *cdl= NULL;
+ CustomDataLayer *cdl = NULL;
int index;
if (me->edit_btmesh) {
@@ -1262,9 +1290,9 @@ static PointerRNA rna_Mesh_uv_tessface_texture_new(struct Mesh *me, struct bCont
index = ED_mesh_uv_texture_add(C, me, name, FALSE);
- if(index != -1) {
- fdata= rna_mesh_fdata_helper(me);
- cdl= &fdata->layers[CustomData_get_layer_index_n(fdata, CD_MTFACE, index)];
+ if (index != -1) {
+ fdata = rna_mesh_fdata_helper(me);
+ cdl = &fdata->layers[CustomData_get_layer_index_n(fdata, CD_MTFACE, index)];
}
RNA_pointer_create(&me->id, &RNA_MeshTextureFaceLayer, cdl, &ptr);
@@ -1418,18 +1446,18 @@ static void rna_def_mface(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "MeshFace", NULL);
+ srna = RNA_def_struct(brna, "MeshTessFace", NULL);
RNA_def_struct_sdna(srna, "MFace");
- RNA_def_struct_ui_text(srna, "Mesh Face", "Face in a Mesh datablock");
- RNA_def_struct_path_func(srna, "rna_MeshFace_path");
+ RNA_def_struct_ui_text(srna, "Mesh TessFace", "TessFace in a Mesh datablock");
+ RNA_def_struct_path_func(srna, "rna_MeshTessFace_path");
RNA_def_struct_ui_icon(srna, ICON_FACESEL);
/* XXX allows creating invalid meshes */
prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
RNA_def_property_array(prop, 4);
RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_dynamic_array_funcs(prop, "rna_MeshFace_verts_get_length");
- RNA_def_property_int_funcs(prop, "rna_MeshFace_verts_get", "rna_MeshFace_verts_set", NULL);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_MeshTessFace_verts_get_length");
+ RNA_def_property_int_funcs(prop, "rna_MeshTessFace_verts_get", "rna_MeshTessFace_verts_set", NULL);
RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
/* leaving this fixed size array for foreach_set used in import scripts */
@@ -1441,7 +1469,7 @@ static void rna_def_mface(BlenderRNA *brna)
prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "mat_nr");
RNA_def_property_ui_text(prop, "Material Index", "");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshFace_material_index_range");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshPoly_material_index_range"); /* reuse for tessface is ok */
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
@@ -1468,17 +1496,17 @@ static void rna_def_mface(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MeshFace_normal_get", NULL, NULL);
+ RNA_def_property_float_funcs(prop, "rna_MeshTessFace_normal_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Face normal", "Local space unit length normal vector for this face");
prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MeshFace_area_get", NULL, NULL);
+ RNA_def_property_float_funcs(prop, "rna_MeshTessFace_area_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Face area", "Read only area of the face");
prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_MeshFace_index_get", NULL, NULL);
+ RNA_def_property_int_funcs(prop, "rna_MeshTessFace_index_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Index", "Index number of the vertex");
}
@@ -1519,7 +1547,7 @@ static void rna_def_mpolygon(BlenderRNA *brna)
RNA_def_struct_path_func(srna, "rna_MeshPolygon_path");
RNA_def_struct_ui_icon(srna, ICON_FACESEL);
- /* Faked, actually access to loop vertex values, dont this way because manually setting up
+ /* Faked, actually access to loop vertex values, don't this way because manually setting up
* vertex/edge per loop is very low level.
* Instead we setup poly sizes, assign indices, then calc edges automatic when creating
* meshes from rna/py. */
@@ -1543,7 +1571,7 @@ static void rna_def_mpolygon(BlenderRNA *brna)
prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "mat_nr");
RNA_def_property_ui_text(prop, "Material Index", "");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshFace_material_index_range");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshPoly_material_index_range");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
@@ -1943,7 +1971,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
/* Float */
srna = RNA_def_struct(brna, "MeshFloatPropertyLayer", NULL);
RNA_def_struct_sdna(srna, "CustomDataLayer");
- RNA_def_struct_ui_text(srna, "Mesh Float Property Layer", "User defined layer of floating pointer number values");
+ RNA_def_struct_ui_text(srna, "Mesh Float Property Layer", "User defined layer of floating point number values");
RNA_def_struct_path_func(srna, "rna_MeshFloatPropertyLayer_path");
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
@@ -2202,14 +2230,23 @@ static void rna_def_tessface_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
StructRNA *srna;
PropertyRNA *prop;
- /* FunctionRNA *func; */
- /* PropertyRNA *parm; */
+ FunctionRNA *func;
+ PropertyRNA *parm;
RNA_def_property_srna(cprop, "VertexColors");
srna = RNA_def_struct(brna, "VertexColors", NULL);
RNA_def_struct_sdna(srna, "Mesh");
RNA_def_struct_ui_text(srna, "Vertex Colors", "Collection of vertex colors");
+ /* eventually deprecate this */
+ func = RNA_def_function(srna, "new", "rna_Mesh_tessface_vertex_color_new");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
+ RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
+ parm = RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer");
+ RNA_def_property_flag(parm, PROP_RNAPTR);
+ RNA_def_function_return(func, parm);
+
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
RNA_def_property_struct_type(prop, "MeshColorLayer");
RNA_def_property_pointer_funcs(prop, "rna_Mesh_tessface_vertex_color_active_get",
@@ -2376,11 +2413,11 @@ static void rna_def_tessface_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_ui_text(srna, "UV Maps", "Collection of UV maps for tessellated faces");
/* eventually deprecate this */
- func= RNA_def_function(srna, "new", "rna_Mesh_uv_tessface_texture_new");
+ func = RNA_def_function(srna, "new", "rna_Mesh_tessface_uv_texture_new");
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Add a UV tessface-texture layer to Mesh (only for meshes with no polygons)");
RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
- parm= RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The newly created layer");
+ parm = RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The newly created layer");
RNA_def_property_flag(parm, PROP_RNAPTR);
RNA_def_function_return(func, parm);
@@ -2464,16 +2501,16 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Edges", "Edges of the mesh");
rna_def_mesh_edges(brna, prop);
- prop = RNA_def_property(srna, "faces", PROP_COLLECTION, PROP_NONE);
+ prop = RNA_def_property(srna, "tessfaces", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "mface", "totface");
- RNA_def_property_struct_type(prop, "MeshFace");
- RNA_def_property_ui_text(prop, "Faces", "Faces of the mesh");
+ RNA_def_property_struct_type(prop, "MeshTessFace");
+ RNA_def_property_ui_text(prop, "TessFaces", "Tessellation faces of the mesh (derived from polygons)");
rna_def_mesh_faces(brna, prop);
prop = RNA_def_property(srna, "loops", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "mloop", "totloop");
RNA_def_property_struct_type(prop, "MeshLoop");
- RNA_def_property_ui_text(prop, "Loops", "Loops of the mesh");
+ RNA_def_property_ui_text(prop, "Loops", "Loops of the mesh (polygon corners)");
rna_def_mesh_loops(brna, prop);
prop = RNA_def_property(srna, "polygons", PROP_COLLECTION, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index b58f568309a..c6aea38b55c 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
diff --git a/source/blender/makesrna/intern/rna_mesh_utils.h b/source/blender/makesrna/intern/rna_mesh_utils.h
index 9b67ad61470..b00271f0e16 100644
--- a/source/blender/makesrna/intern/rna_mesh_utils.h
+++ b/source/blender/makesrna/intern/rna_mesh_utils.h
@@ -1,4 +1,4 @@
-/*
+/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index 8ba391e1bb9..5fb432c9e8f 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -314,13 +314,14 @@ static void rna_def_metaball(BlenderRNA *brna)
/* texture space */
prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "texflag", MB_AUTOSPACE);
- RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjust active object's texture space automatically when transforming object");
+ RNA_def_property_ui_text(prop, "Auto Texture Space",
+ "Adjust active object's texture space automatically when transforming object");
prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
- RNA_def_property_float_funcs(prop, "rna_Meta_texspace_loc_get", "rna_Meta_texspace_loc_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_Meta_texspace_loc_get", "rna_Meta_texspace_loc_set", NULL);
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 6185d1dee79..e40ed254dba 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -59,7 +59,8 @@ EnumPropertyItem modifier_type_items[] = {
{eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
{eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""},
{eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""},
- {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Proximity", ""},
+ {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT,
+ "Vertex Weight Proximity", ""},
{0, "", 0, "Generate", ""},
{eModifierType_Array, "ARRAY", ICON_MOD_ARRAY, "Array", ""},
{eModifierType_Bevel, "BEVEL", ICON_MOD_BEVEL, "Bevel", ""},
@@ -575,7 +576,8 @@ static void rna_ShrinkwrapModifier_face_cull_set(struct PointerRNA *ptr, int val
{
ShrinkwrapModifierData *swm = (ShrinkwrapModifierData*)ptr->data;
- swm->shrinkOpts = (swm->shrinkOpts & ~(MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE|MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) | value;
+ swm->shrinkOpts =
+ (swm->shrinkOpts & ~(MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE|MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) | value;
}
static void rna_MeshDeformModifier_object_set(PointerRNA *ptr, PointerRNA value)
@@ -783,7 +785,8 @@ static void rna_def_modifier_generic_map_info(StructRNA *srna)
static EnumPropertyItem prop_texture_coordinates_items[] = {
{MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use the local coordinate system for the texture coordinates"},
{MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use the global coordinate system for the texture coordinates"},
- {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object", "Use the linked object's local coordinate system for the texture coordinates"},
+ {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object",
+ "Use the linked object's local coordinate system for the texture coordinates"},
{MOD_DISP_MAP_UV, "UV", 0, "UV", "Use UV coordinates for the texture coordinates"},
{0, NULL, 0, NULL, NULL}};
@@ -915,10 +918,12 @@ static void rna_def_modifier_multires(BlenderRNA *brna)
prop = RNA_def_property(srna, "is_external", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_MultiresModifier_external_get", NULL);
- RNA_def_property_ui_text(prop, "External", "Store multires displacements outside the .blend file, to save memory");
+ RNA_def_property_ui_text(prop, "External",
+ "Store multires displacements outside the .blend file, to save memory");
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_funcs(prop, "rna_MultiresModifier_filepath_get", "rna_MultiresModifier_filepath_length", "rna_MultiresModifier_filepath_set");
+ RNA_def_property_string_funcs(prop, "rna_MultiresModifier_filepath_get", "rna_MultiresModifier_filepath_length",
+ "rna_MultiresModifier_filepath_set");
RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -951,7 +956,8 @@ static void rna_def_modifier_lattice(BlenderRNA *brna)
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_ui_text(prop, "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LatticeModifier_vgroup_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
@@ -983,7 +989,8 @@ static void rna_def_modifier_curve(BlenderRNA *brna)
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_ui_text(prop, "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CurveModifier_vgroup_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -1162,7 +1169,8 @@ static void rna_def_modifier_wave(BlenderRNA *brna)
prop = RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "timeoffs");
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Time Offset", "Either the starting frame (for positive speed) or ending frame (for negative speed.)");
+ RNA_def_property_ui_text(prop, "Time Offset",
+ "Either the starting frame (for positive speed) or ending frame (for negative speed.)");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
@@ -1232,7 +1240,9 @@ static void rna_def_modifier_wave(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "narrow");
RNA_def_property_range(prop, 0, FLT_MAX);
RNA_def_property_ui_range(prop, 0, 10, 10, 2);
- RNA_def_property_ui_text(prop, "Narrowness", "Distance between the top and the base of a wave, the higher the value, the more narrow the wave");
+ RNA_def_property_ui_text(prop, "Narrowness",
+ "Distance between the top and the base of a wave, the higher the value, "
+ "the more narrow the wave");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
rna_def_modifier_generic_map_info(srna);
@@ -1271,12 +1281,14 @@ static void rna_def_modifier_armature(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_multi_modifier", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "multi", 0);
- RNA_def_property_ui_text(prop, "Multi Modifier", "Use same input as previous modifier, and mix results using overall vgroup");
+ RNA_def_property_ui_text(prop, "Multi Modifier",
+ "Use same input as previous modifier, and mix results using overall vgroup");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_ui_text(prop, "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ArmatureModifier_vgroup_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -1314,12 +1326,14 @@ static void rna_def_modifier_hook(BlenderRNA *brna)
prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "subtarget");
- RNA_def_property_ui_text(prop, "Sub-Target", "Name of Parent Bone for hook (if applicable), also recalculates and clears offset");
+ RNA_def_property_ui_text(prop, "Sub-Target",
+ "Name of Parent Bone for hook (if applicable), also recalculates and clears offset");
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_ui_text(prop, "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_HookModifier_vgroup_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
@@ -1353,7 +1367,8 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem prop_operation_items[] = {
- {eBooleanModifierOp_Intersect, "INTERSECT", 0, "Intersect", "Keep the part of the mesh that intersects with the other selected object"},
+ {eBooleanModifierOp_Intersect, "INTERSECT", 0, "Intersect",
+ "Keep the part of the mesh that intersects with the other selected object"},
{eBooleanModifierOp_Union, "UNION", 0, "Union", "Combine two meshes in an additive way"},
{eBooleanModifierOp_Difference, "DIFFERENCE", 0, "Difference", "Combine two meshes in a subtractive way"},
{0, NULL, 0, NULL, NULL}};
@@ -1382,7 +1397,8 @@ static void rna_def_modifier_array(BlenderRNA *brna)
static EnumPropertyItem prop_fit_type_items[] = {
{MOD_ARR_FIXEDCOUNT, "FIXED_COUNT", 0, "Fixed Count", "Duplicate the object a certain number of times"},
- {MOD_ARR_FITLENGTH, "FIT_LENGTH", 0, "Fit Length", "Duplicate the object as many times as fits in a certain length"},
+ {MOD_ARR_FITLENGTH, "FIT_LENGTH", 0, "Fit Length",
+ "Duplicate the object as many times as fits in a certain length"},
{MOD_ARR_FITCURVE, "FIT_CURVE", 0, "Fit Curve", "Fit the duplicated objects to a curve"},
{0, NULL, 0, NULL, NULL}};
@@ -1433,9 +1449,11 @@ static void rna_def_modifier_array(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Relative Offset", "Add an offset relative to the object's bounding box");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE); /* PROP_TRANSLATION causes units to be used which we dont want */
+ /* PROP_TRANSLATION causes units to be used which we don't want */
+ prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_ui_text(prop, "Relative Offset Displacement", "The size of the geometry will determine the distance between arrayed items");
+ RNA_def_property_ui_text(prop, "Relative Offset Displacement",
+ "The size of the geometry will determine the distance between arrayed items");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
/* Vertex merging parameters */
@@ -1464,7 +1482,9 @@ static void rna_def_modifier_array(BlenderRNA *brna)
prop = RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "offset_ob");
- RNA_def_property_ui_text(prop, "Object Offset", "Use the location and rotation of another object to determine the distance and rotational change between arrayed items");
+ RNA_def_property_ui_text(prop, "Object Offset",
+ "Use the location and rotation of another object to determine the distance and "
+ "rotational change between arrayed items");
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
@@ -1494,7 +1514,8 @@ static void rna_def_modifier_edgesplit(BlenderRNA *brna)
#if 1 /* expose as radians */
prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_funcs(prop, "rna_EdgeSplitModifier_split_angle_get", "rna_EdgeSplitModifier_split_angle_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_EdgeSplitModifier_split_angle_get",
+ "rna_EdgeSplitModifier_split_angle_set", NULL);
RNA_def_property_range(prop, 0, DEG2RAD(180));
RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2);
#else
@@ -1525,8 +1546,10 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
{MOD_DISP_DIR_X, "X", 0, "X", "Use the texture's intensity value to displace in the X direction"},
{MOD_DISP_DIR_Y, "Y", 0, "Y", "Use the texture's intensity value to displace in the Y direction"},
{MOD_DISP_DIR_Z, "Z", 0, "Z", "Use the texture's intensity value to displace in the Z direction"},
- {MOD_DISP_DIR_NOR, "NORMAL", 0, "Normal", "Use the texture's intensity value to displace in the normal direction"},
- {MOD_DISP_DIR_RGB_XYZ, "RGB_TO_XYZ", 0, "RGB to XYZ", "Use the texture's RGB values to displace the mesh in the XYZ direction"},
+ {MOD_DISP_DIR_NOR, "NORMAL", 0, "Normal",
+ "Use the texture's intensity value to displace in the normal direction"},
+ {MOD_DISP_DIR_RGB_XYZ, "RGB_TO_XYZ", 0, "RGB to XYZ",
+ "Use the texture's RGB values to displace the mesh in the XYZ direction"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "DisplaceModifier", "Modifier");
@@ -1536,7 +1559,8 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_ui_text(prop, "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DisplaceModifier_vgroup_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -1586,7 +1610,8 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
prop = RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "UVProjector");
- RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Projectors", "");
prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
@@ -1678,7 +1703,8 @@ static void rna_def_modifier_smooth(BlenderRNA *brna)
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_ui_text(prop, "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmoothModifier_vgroup_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
@@ -1706,7 +1732,8 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Control object: if available, its location determines the center of the effect");
+ RNA_def_property_ui_text(prop, "Object",
+ "Control object: if available, its location determines the center of the effect");
RNA_def_property_pointer_funcs(prop, NULL, "rna_CastModifier_object_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
@@ -1746,7 +1773,9 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_range(prop, 0, FLT_MAX);
RNA_def_property_ui_range(prop, 0, 100, 5, 2);
- RNA_def_property_ui_text(prop, "Radius", "Only deform vertices within this distance from the center of the effect (leave as 0 for infinite.)");
+ RNA_def_property_ui_text(prop, "Radius",
+ "Only deform vertices within this distance from the center of the effect "
+ "(leave as 0 for infinite.)");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
@@ -1808,7 +1837,9 @@ static void rna_def_modifier_meshdeform(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_dynamic_bind", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_DYNAMIC_BIND);
- RNA_def_property_ui_text(prop, "Dynamic", "Recompute binding dynamically on top of other deformers (slower and more memory consuming)");
+ RNA_def_property_ui_text(prop, "Dynamic",
+ "Recompute binding dynamically on top of other deformers "
+ "(slower and more memory consuming)");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
#if 0
@@ -1934,7 +1965,8 @@ static void rna_def_modifier_explode(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_MOD_EXPLODE);
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ExplodeModifier_vgroup_get", "rna_ExplodeModifier_vgroup_length", "rna_ExplodeModifier_vgroup_set");
+ RNA_def_property_string_funcs(prop, "rna_ExplodeModifier_vgroup_get", "rna_ExplodeModifier_vgroup_length",
+ "rna_ExplodeModifier_vgroup_set");
RNA_def_property_ui_text(prop, "Vertex Group", "");
prop = RNA_def_property(srna, "protect", PROP_FLOAT, PROP_NONE);
@@ -2066,7 +2098,8 @@ static void rna_def_modifier_collision(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "CollisionModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Collision Modifier", "Collision modifier defining modifier stack position used for collision");
+ RNA_def_struct_ui_text(srna, "Collision Modifier",
+ "Collision modifier defining modifier stack position used for collision");
RNA_def_struct_sdna(srna, "CollisionModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
@@ -2085,7 +2118,9 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
static EnumPropertyItem prop_limit_method_items[] = {
{0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"},
{BME_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"},
- {BME_BEVEL_WEIGHT, "WEIGHT", 0, "Weight", "Use bevel weights to determine how much bevel is applied; apply them separately in vert/edge select mode"},
+ {BME_BEVEL_WEIGHT, "WEIGHT", 0, "Weight",
+ "Use bevel weights to determine how much bevel is applied; "
+ "apply them separately in vert/edge select mode"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_edge_weight_method_items[] = {
@@ -2125,7 +2160,8 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
#if 1 /* expose as radians */
prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_funcs(prop, "rna_BevelModifier_angle_limit_get", "rna_BevelModifier_angle_limit_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_BevelModifier_angle_limit_get",
+ "rna_BevelModifier_angle_limit_set", NULL);
RNA_def_property_range(prop, 0, DEG2RAD(180));
RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2);
#else
@@ -2137,17 +2173,18 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- /* BMESH_BRANCH ONLY */
+#ifdef USE_BM_BEVEL_OP_AS_MOD
prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE); /* name matches solidify */
RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_EVEN);
RNA_def_property_ui_text(prop, "Even", "Use even bevel distance correction");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- /* BMESH_BRANCH ONLY */
+
prop = RNA_def_property(srna, "use_distance_offset", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_DIST);
- RNA_def_property_ui_text(prop, "Distance", "Use the width as a distance in rather then a factor of the face size");
+ RNA_def_property_ui_text(prop, "Distance",
+ "Use the width as a distance in rather then a factor of the face size");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- /* END BMESH_BRANCH ONLY */
+#endif
}
@@ -2157,9 +2194,12 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem shrink_type_items[] = {
- {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point", "Shrink the mesh to the nearest target surface"},
- {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrink the mesh to the nearest target surface along a given axis"},
- {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrink the mesh to the nearest target vertex"},
+ {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point",
+ "Shrink the mesh to the nearest target surface"},
+ {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project",
+ "Shrink the mesh to the nearest target surface along a given axis"},
+ {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex",
+ "Shrink the mesh to the nearest target vertex"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem shrink_face_cull_items[] = {
@@ -2169,7 +2209,8 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "ShrinkwrapModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Shrinkwrap Modifier", "Shrink wrapping modifier to shrink wrap and object to a target");
+ RNA_def_struct_ui_text(srna, "Shrinkwrap Modifier",
+ "Shrink wrapping modifier to shrink wrap and object to a target");
RNA_def_struct_sdna(srna, "ShrinkwrapModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_SHRINKWRAP);
@@ -2182,8 +2223,10 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "shrinkOpts");
RNA_def_property_enum_items(prop, shrink_face_cull_items);
- RNA_def_property_enum_funcs(prop, "rna_ShrinkwrapModifier_face_cull_get", "rna_ShrinkwrapModifier_face_cull_set", NULL);
- RNA_def_property_ui_text(prop, "Face Cull", "Stop vertices from projecting to a face on the target when facing towards/away");
+ RNA_def_property_enum_funcs(prop, "rna_ShrinkwrapModifier_face_cull_get",
+ "rna_ShrinkwrapModifier_face_cull_set", NULL);
+ RNA_def_property_ui_text(prop, "Face Cull",
+ "Stop vertices from projecting to a face on the target when facing towards/away");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -2195,7 +2238,8 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
prop = RNA_def_property(srna, "auxiliary_target", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "auxTarget");
RNA_def_property_ui_text(prop, "Auxiliary Target", "Additional mesh target to shrink to");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_auxiliary_target_set", NULL, "rna_Mesh_object_poll");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_auxiliary_target_set", NULL,
+ "rna_Mesh_object_poll");
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
@@ -2231,7 +2275,9 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "subsurfLevels");
RNA_def_property_range(prop, 0, 6);
RNA_def_property_ui_range(prop, 0, 6, 1, 0);
- RNA_def_property_ui_text(prop, "Subsurf Levels", "Number of subdivisions that must be performed before extracting vertices' positions and normals");
+ RNA_def_property_ui_text(prop, "Subsurf Levels",
+ "Number of subdivisions that must be performed before extracting vertices' "
+ "positions and normals");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "use_negative_direction", PROP_BOOLEAN, PROP_NONE);
@@ -2314,11 +2360,13 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
{MOD_SIMPLEDEFORM_MODE_TWIST, "TWIST", 0, "Twist", "Rotate around the Z axis of the modifier space"},
{MOD_SIMPLEDEFORM_MODE_BEND, "BEND", 0, "Bend", "Bend the mesh over the Z axis of the modifier space"},
{MOD_SIMPLEDEFORM_MODE_TAPER, "TAPER", 0, "Taper", "Linearly scale along Z axis of the modifier space"},
- {MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch", "Stretch the object along the Z axis of the modifier space"},
+ {MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch",
+ "Stretch the object along the Z axis of the modifier space"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "SimpleDeformModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "SimpleDeform Modifier", "Simple deformation modifier to apply effects such as twisting and bending");
+ RNA_def_struct_ui_text(srna, "SimpleDeform Modifier",
+ "Simple deformation modifier to apply effects such as twisting and bending");
RNA_def_struct_sdna(srna, "SimpleDeformModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_SIMPLEDEFORM);
@@ -2374,7 +2422,8 @@ static void rna_def_modifier_surface(BlenderRNA *brna)
StructRNA *srna;
srna = RNA_def_struct(brna, "SurfaceModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Surface Modifier", "Surface modifier defining modifier stack position used for surface fields");
+ RNA_def_struct_ui_text(srna, "Surface Modifier",
+ "Surface modifier defining modifier stack position used for surface fields");
RNA_def_struct_sdna(srna, "SurfaceModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
}
@@ -2385,7 +2434,8 @@ static void rna_def_modifier_solidify(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "SolidifyModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Solidify Modifier", "Create a solid skin by extruding, compensating for sharp angles");
+ RNA_def_struct_ui_text(srna, "Solidify Modifier",
+ "Create a solid skin by extruding, compensating for sharp angles");
RNA_def_struct_sdna(srna, "SolidifyModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_SOLIDIFY);
@@ -2400,7 +2450,8 @@ static void rna_def_modifier_solidify(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
- RNA_def_property_ui_text(prop, "Vertex Group Factor", "Thickness factor to use for zero vertex group influence");
+ RNA_def_property_ui_text(prop, "Vertex Group Factor",
+ "Thickness factor to use for zero vertex group influence");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
@@ -2451,17 +2502,21 @@ static void rna_def_modifier_solidify(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_rim", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_RIM);
- RNA_def_property_ui_text(prop, "Fill Rim", "Create edge loops between the inner and outer surfaces on face edges (slow, disable when not needed)");
+ RNA_def_property_ui_text(prop, "Fill Rim",
+ "Create edge loops between the inner and outer surfaces on face edges "
+ "(slow, disable when not needed)");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_EVEN);
- RNA_def_property_ui_text(prop, "Even Thickness", "Maintain thickness by adjusting for sharp corners (slow, disable when not needed)");
+ RNA_def_property_ui_text(prop, "Even Thickness",
+ "Maintain thickness by adjusting for sharp corners (slow, disable when not needed)");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "use_quality_normals", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_NORMAL_CALC);
- RNA_def_property_ui_text(prop, "High Quality Normals", "Calculate normals which result in more even thickness (slow, disable when not needed)");
+ RNA_def_property_ui_text(prop, "High Quality Normals",
+ "Calculate normals which result in more even thickness (slow, disable when not needed)");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
@@ -2705,11 +2760,12 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem weightvg_mix_set_items[] = {
- {MOD_WVG_SET_ALL, "ALL", 0, "All", "Affect all vertices (might add some to VGroup A)"},
- {MOD_WVG_SET_A, "A", 0, "VGroup A", "Affect vertices in VGroup A"},
- {MOD_WVG_SET_B, "B", 0, "VGroup B", "Affect vertices in VGroup B (might add some to VGroup A)"},
- {MOD_WVG_SET_OR, "OR", 0, "VGroup A or B", "Affect vertices in at least one of both VGroups (might add some to VGroup A)"},
- {MOD_WVG_SET_AND, "AND", 0, "VGroup A and B", "Affect vertices in both groups"},
+ {MOD_WVG_SET_ALL, "ALL", 0, "All", "Affect all vertices (might add some to VGroup A)"},
+ {MOD_WVG_SET_A, "A", 0, "VGroup A", "Affect vertices in VGroup A"},
+ {MOD_WVG_SET_B, "B", 0, "VGroup B", "Affect vertices in VGroup B (might add some to VGroup A)"},
+ {MOD_WVG_SET_OR, "OR", 0, "VGroup A or B",
+ "Affect vertices in at least one of both VGroups (might add some to VGroup A)"},
+ {MOD_WVG_SET_AND, "AND", 0, "VGroup A and B", "Affect vertices in both groups"},
{0, NULL, 0, NULL, NULL}};
StructRNA *srna;
@@ -2854,14 +2910,16 @@ static void rna_def_modifier_remesh(BlenderRNA *brna)
static EnumPropertyItem mode_items[] = {
{MOD_REMESH_CENTROID, "BLOCKS", 0, "Blocks", "Output a blocky surface with no smoothing"},
{MOD_REMESH_MASS_POINT, "SMOOTH", 0, "Smooth", "Output a smooth surface with no sharp-features detection"},
- {MOD_REMESH_SHARP_FEATURES, "SHARP", 0, "Sharp", "Output a surface that reproduces sharp edges and corners from the input mesh"},
+ {MOD_REMESH_SHARP_FEATURES, "SHARP", 0, "Sharp",
+ "Output a surface that reproduces sharp edges and corners from the input mesh"},
{0, NULL, 0, NULL, NULL}};
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "RemeshModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Remesh Modifier", "Generate a new surface with regular topology that follows the shape of the input mesh");
+ RNA_def_struct_ui_text(srna, "Remesh Modifier",
+ "Generate a new surface with regular topology that follows the shape of the input mesh");
RNA_def_struct_sdna(srna, "RemeshModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_REMESH);
@@ -2873,13 +2931,16 @@ static void rna_def_modifier_remesh(BlenderRNA *brna)
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_range(prop, 0, 0.99, 0.01, 3);
RNA_def_property_range(prop, 0, 0.99);
- RNA_def_property_ui_text(prop, "Scale", "The ratio of the largest dimension of the model over the size of the grid");
+ RNA_def_property_ui_text(prop, "Scale",
+ "The ratio of the largest dimension of the model over the size of the grid");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Threshold", "If removing disconnected pieces, minimum size of components to preserve as a ratio of the number of polygons in the largest component");
+ RNA_def_property_ui_text(prop, "Threshold",
+ "If removing disconnected pieces, minimum size of components to preserve as a ratio "
+ "of the number of polygons in the largest component");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "octree_depth", PROP_INT, PROP_NONE);
@@ -2891,7 +2952,9 @@ static void rna_def_modifier_remesh(BlenderRNA *brna)
prop = RNA_def_property(srna, "sharpness", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "hermite_num");
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
- RNA_def_property_ui_text(prop, "Sharpness", "Tolerance for outliers; lower values filter noise while higher values will reproduce edges closer to the input");
+ RNA_def_property_ui_text(prop, "Sharpness",
+ "Tolerance for outliers; lower values filter noise while higher values will reproduce "
+ "edges closer to the input");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "remove_disconnected_pieces", PROP_BOOLEAN, PROP_NONE);
@@ -2906,9 +2969,13 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem geometry_items[] = {
- {MOD_OCEAN_GEOM_GENERATE, "GENERATE", 0, "Generate", "Generate ocean surface geometry at the specified resolution"},
+ {MOD_OCEAN_GEOM_GENERATE, "GENERATE", 0, "Generate",
+ "Generate ocean surface geometry at the specified resolution"},
{MOD_OCEAN_GEOM_DISPLACE, "DISPLACE", 0, "Displace", "Displace existing geometry according to simulation"},
- /*{MOD_OCEAN_GEOM_SIM_ONLY, "SIM_ONLY", 0, "Sim Only", "Leaves geometry unchanged, but still runs simulation (to be used from texture)"}, */
+#if 0
+ {MOD_OCEAN_GEOM_SIM_ONLY, "SIM_ONLY", 0, "Sim Only",
+ "Leaves geometry unchanged, but still runs simulation (to be used from texture)"},
+#endif
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "OceanModifier", "Modifier");
@@ -2953,7 +3020,8 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_normals", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_NORMALS);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Generate Normals", "Output normals for bump mapping - disabling can speed up performance if its not needed");
+ RNA_def_property_ui_text(prop, "Generate Normals",
+ "Output normals for bump mapping - disabling can speed up performance if its not needed");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
prop = RNA_def_property(srna, "use_foam", PROP_BOOLEAN, PROP_NONE);
@@ -3136,7 +3204,9 @@ void RNA_def_modifier(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_apply_on_spline", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_ApplyOnSpline);
- RNA_def_property_ui_text(prop, "Apply on spline", "Apply this and all preceding deformation modifiers on splines' points rather than on filled curve/surface");
+ RNA_def_property_ui_text(prop, "Apply on spline",
+ "Apply this and all preceding deformation modifiers on splines' points rather than "
+ "on filled curve/surface");
RNA_def_property_ui_icon(prop, ICON_SURFACE_DATA, 0);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
index 9b558d9dcdf..ca06793cd49 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -77,8 +77,11 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna)
{IMB_TC_NONE, "NONE", 0, "No TC in use", ""},
{IMB_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run", "Use images in the order they are recorded"},
{IMB_TC_FREE_RUN, "FREE_RUN", 0, "Free Run", "Use global timestamp written by recording device"},
- {IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)", "Interpolate a global timestamp using the record date and time written by recording device"},
- {IMB_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps", "Record run, but ignore timecode, changes in framerate or dropouts"},
+ {IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)",
+ "Interpolate a global timestamp using the record date and time "
+ "written by recording device"},
+ {IMB_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps",
+ "Record run, but ignore timecode, changes in framerate or dropouts"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "MovieClipProxy", NULL);
@@ -124,7 +127,8 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna)
prop = RNA_def_property(srna, "build_undistorted_100", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_100);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original undistorted footage dimension");
+ RNA_def_property_ui_text(prop, "100%",
+ "Build proxy resolution 100% of the original undistorted footage dimension");
/* build timecodes */
prop = RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
@@ -178,7 +182,8 @@ static void rna_def_moviecliUser(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "MovieClipUser", NULL);
- RNA_def_struct_ui_text(srna, "Movie Clip User", "Parameters defining how a MovieClip datablock is used by another datablock");
+ RNA_def_struct_ui_text(srna, "Movie Clip User",
+ "Parameters defining how a MovieClip datablock is used by another datablock");
prop = RNA_def_property(srna, "current_frame", PROP_INT, PROP_TIME);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -190,7 +195,8 @@ static void rna_def_moviecliUser(BlenderRNA *brna)
prop = RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "render_size");
RNA_def_property_enum_items(prop, clip_render_size_items);
- RNA_def_property_ui_text(prop, "Proxy render size", "Draw preview using full resolution or different proxy resolutions");
+ RNA_def_property_ui_text(prop, "Proxy render size",
+ "Draw preview using full resolution or different proxy resolutions");
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
/* render undistorted */
@@ -238,10 +244,12 @@ static void rna_def_movieclip(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this clip");
+ RNA_def_property_ui_text(prop, "Use Proxy / Timecode",
+ "Use a preview proxy and/or timecode index for this clip");
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
- prop = RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size" , "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
+ prop = RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size",
+ "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
RNA_def_property_int_funcs(prop, "rna_MovieClip_size_get" , NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -263,7 +271,8 @@ static void rna_def_movieclip(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY_CUSTOM_DIR);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Create proxy images in a custom directory (default is movie location)");
+ RNA_def_property_ui_text(prop, "Proxy Custom Directory",
+ "Create proxy images in a custom directory (default is movie location)");
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update");
/* grease pencil */
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index f790f0c56d1..8d262c58f9b 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -103,7 +103,7 @@ static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value)
{
NlaStrip *data = (NlaStrip*)ptr->data;
- /* clamp value to lie within valid limits
+ /* clamp value to lie within valid limits
* - cannot start past the end of the strip + some flexibility threshold
* - cannot start before the previous strip (if present) ends
* -> but if it was a transition, we could go up to the start of the strip + some flexibility threshold
@@ -132,7 +132,7 @@ static void rna_NlaStrip_end_frame_set(PointerRNA *ptr, float value)
NlaStrip *data = (NlaStrip*)ptr->data;
/* clamp value to lie within valid limits
- * - must not have zero or negative length strip, so cannot start before the first frame
+ * - must not have zero or negative length strip, so cannot start before the first frame
* + some minimum-strip-length threshold
* - cannot end later than the start of the next strip (if present)
* -> but if it was a transition, we could go up to the start of the end - some flexibility threshold
@@ -173,7 +173,8 @@ static void rna_NlaStrip_scale_set(PointerRNA *ptr, float value)
NlaStrip *data = (NlaStrip*)ptr->data;
/* set scale value */
- CLAMP(value, 0.0001f, 1000.0f); /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
+ /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
+ CLAMP(value, 0.0001f, 1000.0f);
data->scale = value;
/* adjust the strip extents in response to this */
@@ -185,7 +186,8 @@ static void rna_NlaStrip_repeat_set(PointerRNA *ptr, float value)
NlaStrip *data = (NlaStrip*)ptr->data;
/* set repeat value */
- CLAMP(value, 0.01f, 1000.0f); /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
+ /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
+ CLAMP(value, 0.01f, 1000.0f);
data->repeat = value;
/* adjust the strip extents in response to this */
@@ -294,7 +296,8 @@ static void rna_NlaStrip_animated_time_set(PointerRNA *ptr, int value)
data->flag &= ~NLASTRIP_FLAG_USR_TIME;
}
-static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *reports, const char *UNUSED(name), int start, bAction *action)
+static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *reports, const char *UNUSED(name),
+ int start, bAction *action)
{
NlaStrip *strip = add_nlastrip(action);
@@ -307,12 +310,13 @@ static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *repo
strip->start = start;
if (BKE_nlastrips_add_strip(&track->strips, strip) == 0) {
- BKE_reportf(reports, RPT_ERROR, "Unable to add strip. Track doesn't have any space to accommodate this new strip");
+ BKE_reportf(reports, RPT_ERROR,
+ "Unable to add strip. Track doesn't have any space to accommodate this new strip");
free_nlastrip(NULL, strip);
return NULL;
}
- /* create dummy AnimData block so that BKE_nlastrip_validate_name()
+ /* create dummy AnimData block so that BKE_nlastrip_validate_name()
* can be used to ensure a valid name, as we don't have one here...
* - only the nla_tracks list is needed there, which we aim to reverse engineer here...
*/
@@ -357,14 +361,18 @@ static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *report
/* enum defines exported for rna_animation.c */
EnumPropertyItem nla_mode_blend_items[] = {
- {NLASTRIP_MODE_REPLACE, "REPLACE", 0, "Replace", "Result strip replaces the accumulated results by amount specified by influence"},
+ {NLASTRIP_MODE_REPLACE, "REPLACE", 0, "Replace",
+ "Result strip replaces the accumulated results by amount specified by influence"},
{NLASTRIP_MODE_ADD, "ADD", 0, "Add", "Weighted result of strip is added to the accumulated results"},
- {NLASTRIP_MODE_SUBTRACT, "SUBTRACT", 0, "Subtract", "Weighted result of strip is removed from the accumulated results"},
- {NLASTRIP_MODE_MULTIPLY, "MULITPLY", 0, "Multiply", "Weighted result of strip is multiplied with the accumulated results"},
+ {NLASTRIP_MODE_SUBTRACT, "SUBTRACT", 0, "Subtract",
+ "Weighted result of strip is removed from the accumulated results"},
+ {NLASTRIP_MODE_MULTIPLY, "MULITPLY", 0, "Multiply",
+ "Weighted result of strip is multiplied with the accumulated results"},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem nla_mode_extend_items[] = {
{NLASTRIP_EXTEND_NOTHING, "NOTHING", 0, "Nothing", "Strip has no influence past its extents"},
- {NLASTRIP_EXTEND_HOLD, "HOLD", 0, "Hold", "Hold the first frame if no previous strips in track, and always hold last frame"},
+ {NLASTRIP_EXTEND_HOLD, "HOLD", 0, "Hold",
+ "Hold the first frame if no previous strips in track, and always hold last frame"},
{NLASTRIP_EXTEND_HOLD_FORWARD, "HOLD_FORWARD", 0, "Hold Forward", "Only hold last frame"},
{0, NULL, 0, NULL, NULL}};
@@ -442,14 +450,16 @@ static void rna_def_nlastrip(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_auto_blend", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_AUTO_BLENDS);
- RNA_def_property_ui_text(prop, "Auto Blend In/Out", "Number of frames for Blending In/Out is automatically determined from overlapping strips");
+ RNA_def_property_ui_text(prop, "Auto Blend In/Out",
+ "Number of frames for Blending In/Out is automatically determined from "
+ "overlapping strips");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
/* Action */
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);
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? */
@@ -469,16 +479,20 @@ static void rna_def_nlastrip(BlenderRNA *brna)
/* Action Reuse */
prop = RNA_def_property(srna, "repeat", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "repeat");
+ RNA_def_property_float_sdna(prop, NULL, "repeat");
RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_repeat_set", NULL);
- RNA_def_property_range(prop, 0.1f, 1000.0f); /* these limits have currently be chosen arbitarily, but could be extended (minimum should still be > 0 though) if needed... */
+ /* these limits have currently be chosen arbitarily, but could be extended
+ * (minimum should still be > 0 though) if needed... */
+ RNA_def_property_range(prop, 0.1f, 1000.0f);
RNA_def_property_ui_text(prop, "Repeat", "Number of times to repeat the action range");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_float_sdna(prop, NULL, "scale");
RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_scale_set", NULL);
- RNA_def_property_range(prop, 0.0001f, 1000.0f); /* these limits can be extended, but beyond this, we can get some crazy+annoying bugs due to numeric errors */
+ /* these limits can be extended, but beyond this, we can get some crazy+annoying bugs
+ * due to numeric errors */
+ RNA_def_property_range(prop, 0.0001f, 1000.0f);
RNA_def_property_ui_text(prop, "Scale", "Scaling factor for action");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
@@ -495,7 +509,8 @@ static void rna_def_nlastrip(BlenderRNA *brna)
/* Strip's Sub-Strips (for Meta-Strips) */
prop = RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "NlaStrip");
- RNA_def_property_ui_text(prop, "NLA Strips", "NLA Strips that this strip acts as a container for (if it is of type Meta)");
+ RNA_def_property_ui_text(prop, "NLA Strips",
+ "NLA Strips that this strip acts as a container for (if it is of type Meta)");
/* Settings - Values necessary for evaluation */
prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE);
@@ -511,13 +526,15 @@ static void rna_def_nlastrip(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_animated_influence", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_INFLUENCE);
RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_influence_set");
- RNA_def_property_ui_text(prop, "Animated Influence", "Influence setting is controlled by an F-Curve rather than automatically determined");
+ RNA_def_property_ui_text(prop, "Animated Influence",
+ "Influence setting is controlled by an F-Curve rather than automatically determined");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
prop = RNA_def_property(srna, "use_animated_time", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME);
RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_time_set");
- RNA_def_property_ui_text(prop, "Animated Strip Time", "Strip time is controlled by an F-Curve rather than automatically determined");
+ RNA_def_property_ui_text(prop, "Animated Strip Time",
+ "Strip time is controlled by an F-Curve rather than automatically determined");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
prop = RNA_def_property(srna, "use_animated_time_cyclic", PROP_BOOLEAN, PROP_NONE);
@@ -527,7 +544,8 @@ static void rna_def_nlastrip(BlenderRNA *brna)
/* settings */
prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* can be made editable by hooking it up to the necessary NLA API methods */
+ /* can be made editable by hooking it up to the necessary NLA API methods */
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_ACTIVE);
RNA_def_property_ui_text(prop, "Active", "NLA Strip is active");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
@@ -544,7 +562,9 @@ static void rna_def_nlastrip(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_REVERSE);
- RNA_def_property_ui_text(prop, "Reversed", "NLA Strip is played back in reverse order (only when timing is automatically determined)");
+ RNA_def_property_ui_text(prop, "Reversed",
+ "NLA Strip is played back in reverse order (only when timing is "
+ "automatically determined)");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
/* TODO: */
@@ -567,7 +587,8 @@ static void rna_api_nlatrack_strips(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a new Action-Clip strip to the track");
parm = RNA_def_string(func, "name", "NlaStrip", 0, "", "Name for the NLA Strips");
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm = RNA_def_int(func, "start", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame for this strip", INT_MIN, INT_MAX);
+ parm = RNA_def_int(func, "start", 0, INT_MIN, INT_MAX, "Start Frame",
+ "Start frame for this strip", INT_MIN, INT_MAX);
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_pointer(func, "action", "Action", "", "Action to assign to this strip");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
@@ -606,15 +627,19 @@ static void rna_def_nlatrack(BlenderRNA *brna)
/* settings */
prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* can be made editable by hooking it up to the necessary NLA API methods */
+ /* can be made editable by hooking it up to the necessary NLA API methods */
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_ACTIVE);
RNA_def_property_ui_text(prop, "Active", "NLA Track is active");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
prop = RNA_def_property(srna, "is_solo", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* can be made editable by hooking it up to the necessary NLA API methods */
+ /* can be made editable by hooking it up to the necessary NLA API methods */
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_SOLO);
- RNA_def_property_ui_text(prop, "Solo", "NLA Track is evaluated itself (i.e. active Action and all other NLA Tracks in the same AnimData block are disabled)");
+ RNA_def_property_ui_text(prop, "Solo",
+ "NLA Track is evaluated itself (i.e. active Action and all other NLA Tracks in the "
+ "same AnimData block are disabled)");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index d3a2e406992..bad993c9c72 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -313,7 +313,7 @@ static void rna_Matte_t1_set(PointerRNA *ptr, float value)
chroma->t1 = value;
- if (value < chroma->t2)
+ if (value < chroma->t2)
chroma->t2 = value;
}
@@ -322,7 +322,7 @@ static void rna_Matte_t2_set(PointerRNA *ptr, float value)
bNode *node = (bNode*)ptr->data;
NodeChroma *chroma = node->storage;
- if (value > chroma->t1)
+ if (value > chroma->t1)
value = chroma->t1;
chroma->t2 = value;
@@ -491,7 +491,8 @@ static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
return item;
}
-static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *free)
{
bNode *node = (bNode*)ptr->data;
Image *ima = (Image *)node->id;
@@ -508,7 +509,8 @@ static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), Pointer
return item;
}
-static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *free)
{
bNode *node = (bNode*)ptr->data;
Scene *sce = (Scene *)node->id;
@@ -525,7 +527,8 @@ static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), Pointer
return item;
}
-static EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *free)
{
bNode *node = (bNode*)ptr->data;
EnumPropertyItem *item = NULL;
@@ -575,7 +578,8 @@ static EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA
return item;
}
-static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), ReportList *reports, int type, bNodeTree *group)
+static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), ReportList *reports,
+ int type, bNodeTree *group)
{
bNode *node;
bNodeTemplate ntemp;
@@ -604,7 +608,8 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), Repor
return node;
}
-static bNode *rna_NodeTree_node_composite_new(bNodeTree *ntree, bContext *C, ReportList *reports, int type, bNodeTree *group)
+static bNode *rna_NodeTree_node_composite_new(bNodeTree *ntree, bContext *C, ReportList *reports,
+ int type, bNodeTree *group)
{
/* raises error on failure */
bNode *node = rna_NodeTree_node_new(ntree, C, reports, type, group);
@@ -629,7 +634,8 @@ static bNode *rna_NodeTree_node_composite_new(bNodeTree *ntree, bContext *C, Rep
return node;
}
-static bNode *rna_NodeTree_node_texture_new(bNodeTree *ntree, bContext *C, ReportList *reports, int type, bNodeTree *group)
+static bNode *rna_NodeTree_node_texture_new(bNodeTree *ntree, bContext *C, ReportList *reports,
+ int type, bNodeTree *group)
{
/* raises error on failure */
bNode *node = rna_NodeTree_node_new(ntree, C, reports, type, group);
@@ -1170,7 +1176,8 @@ static void def_sh_mapping(StructRNA *srna)
RNA_def_property_ui_text(prop, "Location", "");
RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); /* Not PROP_XYZ, this is now in radians, no more degrees */
+ /* Not PROP_XYZ, this is now in radians, no more degrees */
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
RNA_def_property_float_sdna(prop, NULL, "rot");
RNA_def_property_ui_text(prop, "Rotation", "");
RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
@@ -1264,13 +1271,18 @@ static void def_sh_tex_sky(StructRNA *srna)
static void def_sh_tex_environment(StructRNA *srna)
{
static const EnumPropertyItem prop_color_space_items[] = {
- {SHD_COLORSPACE_COLOR, "COLOR", 0, "Color", "Image contains color data, and will be converted to linear color for rendering"},
- {SHD_COLORSPACE_NONE, "NONE", 0, "Non-Color Data", "Image contains non-color data, for example a displacement or normal map, and will not be converted"},
+ {SHD_COLORSPACE_COLOR, "COLOR", 0, "Color",
+ "Image contains color data, and will be converted to linear color for rendering"},
+ {SHD_COLORSPACE_NONE, "NONE", 0, "Non-Color Data",
+ "Image contains non-color data, for example a displacement or normal map, "
+ "and will not be converted"},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem prop_projection_items[] = {
- {SHD_PROJ_EQUIRECTANGULAR, "EQUIRECTANGULAR", 0, "Equirectangular", "Equirectangular or latitude-longitude projection"},
- {SHD_PROJ_MIRROR_BALL, "MIRROR_BALL", 0, "Mirror Ball", "Projection from an orthographic photo of a mirror ball"},
+ {SHD_PROJ_EQUIRECTANGULAR, "EQUIRECTANGULAR", 0, "Equirectangular",
+ "Equirectangular or latitude-longitude projection"},
+ {SHD_PROJ_MIRROR_BALL, "MIRROR_BALL", 0, "Mirror Ball",
+ "Projection from an orthographic photo of a mirror ball"},
{0, NULL, 0, NULL, NULL}};
PropertyRNA *prop;
@@ -1300,8 +1312,11 @@ static void def_sh_tex_environment(StructRNA *srna)
static void def_sh_tex_image(StructRNA *srna)
{
static const EnumPropertyItem prop_color_space_items[] = {
- {SHD_COLORSPACE_COLOR, "COLOR", 0, "Color", "Image contains color data, and will be converted to linear color for rendering"},
- {SHD_COLORSPACE_NONE, "NONE", 0, "Non-Color Data", "Image contains non-color data, for example a displacement or normal map, and will not be converted"},
+ {SHD_COLORSPACE_COLOR, "COLOR", 0, "Color",
+ "Image contains color data, and will be converted to linear color for rendering"},
+ {SHD_COLORSPACE_NONE, "NONE", 0, "Non-Color Data",
+ "Image contains non-color data, for example a displacement or normal map, "
+ "and will not be converted"},
{0, NULL, 0, NULL, NULL}};
PropertyRNA *prop;
@@ -1330,7 +1345,8 @@ static void def_sh_tex_gradient(StructRNA *srna)
{SHD_BLEND_EASING, "EASING", 0, "Easing", "Create a progression easing from one step to the next"},
{SHD_BLEND_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
{SHD_BLEND_SPHERICAL, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
- {SHD_BLEND_QUADRATIC_SPHERE, "QUADRATIC_SPHERE", 0, "Quadratic sphere", "Create a quadratic progression in the shape of a sphere"},
+ {SHD_BLEND_QUADRATIC_SPHERE, "QUADRATIC_SPHERE", 0, "Quadratic sphere",
+ "Create a quadratic progression in the shape of a sphere"},
{SHD_BLEND_RADIAL, "RADIAL", 0, "Radial", "Create a radial progression"},
{0, NULL, 0, NULL, NULL}};
@@ -1641,7 +1657,8 @@ static void def_cmp_vector_blur(StructRNA *srna)
prop = RNA_def_property(srna, "speed_min", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "minspeed");
RNA_def_property_range(prop, 0, 1024);
- RNA_def_property_ui_text(prop, "Min Speed", "Minimum speed for a pixel to be blurred (used to separate background from foreground)");
+ RNA_def_property_ui_text(prop, "Min Speed",
+ "Minimum speed for a pixel to be blurred (used to separate background from foreground)");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "speed_max", PROP_INT, PROP_NONE);
@@ -1653,7 +1670,8 @@ static void def_cmp_vector_blur(StructRNA *srna)
prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "fac");
RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Blur Factor", "Scaling factor for motion vectors (actually, 'shutter speed', in frames)");
+ RNA_def_property_ui_text(prop, "Blur Factor",
+ "Scaling factor for motion vectors (actually, 'shutter speed', in frames)");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "use_curved", PROP_BOOLEAN, PROP_NONE);
@@ -1712,13 +1730,16 @@ static void def_cmp_image(StructRNA *srna)
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "sfra");
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Start Frame", "Global starting frame of the movie/sequence, assuming first picture has a #1"); /* copied from the rna_image.c */
+ /* copied from the rna_image.c */
+ RNA_def_property_ui_text(prop, "Start Frame",
+ "Global starting frame of the movie/sequence, assuming first picture has a #1");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "offset");
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation"); /* copied from the rna_image.c */
+ /* copied from the rna_image.c */
+ RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
@@ -1728,7 +1749,8 @@ static void def_cmp_image(StructRNA *srna)
prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANIM_ALWAYS);
- RNA_def_property_ui_text(prop, "Auto-Refresh", "Always refresh image on frame changes"); /* copied from the rna_image.c */
+ /* copied from the rna_image.c */
+ RNA_def_property_ui_text(prop, "Auto-Refresh", "Always refresh image on frame changes");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
@@ -2171,7 +2193,8 @@ static void def_cmp_double_edge_mask(StructRNA * srna)
static EnumPropertyItem InnerEdgeMode_items[] = {
{0, "ALL", 0, "All", "All pixels on inner mask edge are considered during mask calculation"},
- {1, "ADJACENT_ONLY", 0, "Adjacent Only", "Only inner mask pixels adjacent to outer mask pixels are considered during mask calculation"},
+ {1, "ADJACENT_ONLY", 0, "Adjacent Only",
+ "Only inner mask pixels adjacent to outer mask pixels are considered during mask calculation"},
{0, NULL, 0, NULL, NULL}
};
@@ -2221,7 +2244,7 @@ static void def_cmp_defocus(StructRNA *srna)
RNA_def_property_ui_text(prop, "Bokeh Type", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
- /* TODO: angle in degrees */
+ /* TODO: angle in degrees */
prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "rotation");
RNA_def_property_range(prop, 0.0f, DEG2RADF(90.0f));
@@ -2237,7 +2260,9 @@ static void def_cmp_defocus(StructRNA *srna)
prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "fstop");
RNA_def_property_range(prop, 0.0f, 128.0f);
- RNA_def_property_ui_text(prop, "fStop", "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius");
+ RNA_def_property_ui_text(prop, "fStop",
+ "Amount of focal blur, 128=infinity=perfect focus, half the value doubles "
+ "the blur radius");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
@@ -2249,7 +2274,8 @@ static void def_cmp_defocus(StructRNA *srna)
prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "bthresh");
RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Threshold", "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
+ RNA_def_property_ui_text(prop, "Threshold",
+ "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
@@ -2265,13 +2291,17 @@ static void def_cmp_defocus(StructRNA *srna)
prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "no_zbuf", 1);
- RNA_def_property_ui_text(prop, "Use Z-Buffer", "Disable when using an image as input instead of actual z-buffer (auto enabled if node not image based, eg. time node)");
+ RNA_def_property_ui_text(prop, "Use Z-Buffer",
+ "Disable when using an image as input instead of actual z-buffer "
+ "(auto enabled if node not image based, eg. time node)");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "scale");
RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Z-Scale", "Scale the Z input when not using a z-buffer, controls maximum blur designated by the color white or input value 1");
+ RNA_def_property_ui_text(prop, "Z-Scale",
+ "Scale the Z input when not using a z-buffer, controls maximum blur designated "
+ "by the color white or input value 1");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
}
@@ -2430,7 +2460,7 @@ static void def_cmp_bilateral_blur(StructRNA *srna)
prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "sigma_space");
RNA_def_property_range(prop, 0.01f, 30.0f);
- RNA_def_property_ui_text(prop, "Space Sigma", "");
+ RNA_def_property_ui_text(prop, "Space Sigma", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
}
@@ -2479,7 +2509,9 @@ static void def_cmp_glare(StructRNA *srna)
prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "quality");
RNA_def_property_enum_items(prop, quality_items);
- RNA_def_property_ui_text(prop, "Quality", "If not set to high quality, the effect will be applied to a low-res copy of the source image");
+ RNA_def_property_ui_text(prop, "Quality",
+ "If not set to high quality, the effect will be applied to a low-res copy "
+ "of the source image");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
@@ -2491,19 +2523,23 @@ static void def_cmp_glare(StructRNA *srna)
prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "colmod");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Color Modulation", "Amount of Color Modulation, modulates colors of streaks and ghosts for a spectral dispersion effect");
+ RNA_def_property_ui_text(prop, "Color Modulation",
+ "Amount of Color Modulation, modulates colors of streaks and ghosts for "
+ "a spectral dispersion effect");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "mix");
RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
+ RNA_def_property_ui_text(prop, "Mix",
+ "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "threshold");
RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Threshold", "The glare filter will only be applied to pixels brighter than this value");
+ RNA_def_property_ui_text(prop, "Threshold",
+ "The glare filter will only be applied to pixels brighter than this value");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE);
@@ -2532,7 +2568,8 @@ static void def_cmp_glare(StructRNA *srna)
prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "size");
RNA_def_property_range(prop, 6, 9);
- RNA_def_property_ui_text(prop, "Size", "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
+ RNA_def_property_ui_text(prop, "Size",
+ "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
/* TODO */
@@ -2564,7 +2601,8 @@ static void def_cmp_tonemap(StructRNA *srna)
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "offset");
RNA_def_property_range(prop, 0.001f, 10.0f);
- RNA_def_property_ui_text(prop, "Offset", "Normally always 1, but can be used as an extra control to alter the brightness curve");
+ RNA_def_property_ui_text(prop, "Offset",
+ "Normally always 1, but can be used as an extra control to alter the brightness curve");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
@@ -2606,7 +2644,8 @@ static void def_cmp_lensdist(StructRNA *srna)
prop = RNA_def_property(srna, "use_projector", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "proj", 1);
- RNA_def_property_ui_text(prop, "Projector", "Enable/disable projector mode (the effect is applied in horizontal direction only)");
+ RNA_def_property_ui_text(prop, "Projector",
+ "Enable/disable projector mode (the effect is applied in horizontal direction only)");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE);
@@ -2616,7 +2655,8 @@ static void def_cmp_lensdist(StructRNA *srna)
prop = RNA_def_property(srna, "use_fit", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "fit", 1);
- RNA_def_property_ui_text(prop, "Fit", "For positive distortion factor only: scale image such that black areas are not visible");
+ RNA_def_property_ui_text(prop, "Fit",
+ "For positive distortion factor only: scale image such that black areas are not visible");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
}
@@ -2626,8 +2666,8 @@ static void def_cmp_colorbalance(StructRNA *srna)
static float default_1[3] = {1.f, 1.f, 1.f};
static EnumPropertyItem type_items[] = {
- {0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
- {1, "OFFSET_POWER_SLOPE", 0, "Offset/Power/Slope (ASC-CDL)", "ASC-CDL standard color correction"},
+ {0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
+ {1, "OFFSET_POWER_SLOPE", 0, "Offset/Power/Slope (ASC-CDL)", "ASC-CDL standard color correction"},
{0, NULL, 0, NULL, NULL}};
prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE);
@@ -3075,7 +3115,8 @@ static void rna_def_node_socket(BlenderRNA *brna)
prop = RNA_def_property(srna, "group_socket", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "groupsock");
RNA_def_property_struct_type(prop, "NodeSocket");
- RNA_def_property_ui_text(prop, "Group Socket", "For group nodes, the group input or output socket this corresponds to");
+ RNA_def_property_ui_text(prop, "Group Socket",
+ "For group nodes, the group input or output socket this corresponds to");
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_COLLAPSED);
@@ -3277,7 +3318,8 @@ static void rna_def_group_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int
parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
RNA_def_function_return(func, parm);
- func = RNA_def_function(srna, "expose", (in_out == SOCK_IN ? "rna_NodeTree_input_expose" : "rna_NodeTree_output_expose"));
+ func = RNA_def_function(srna, "expose",
+ (in_out == SOCK_IN ? "rna_NodeTree_input_expose" : "rna_NodeTree_output_expose"));
RNA_def_function_ui_description(func, "Expose an internal socket in the group tree");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "Internal node socket to expose");
@@ -3294,7 +3336,8 @@ static void rna_def_nodetree(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "NodeTree", "ID");
- RNA_def_struct_ui_text(srna, "Node Tree", "Node tree consisting of linked nodes used for shading, textures and compositing");
+ RNA_def_struct_ui_text(srna, "Node Tree",
+ "Node tree consisting of linked nodes used for shading, textures and compositing");
RNA_def_struct_sdna(srna, "bNodeTree");
RNA_def_struct_ui_icon(srna, ICON_NODETREE);
RNA_def_struct_refine_func(srna, "rna_NodeTree_refine");
@@ -3361,7 +3404,8 @@ static void rna_def_shader_nodetree(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree");
- RNA_def_struct_ui_text(srna, "Shader Node Tree", "Node tree consisting of linked nodes used for materials (and other shading datablocks)");
+ RNA_def_struct_ui_text(srna, "Shader Node Tree",
+ "Node tree consisting of linked nodes used for materials (and other shading datablocks)");
RNA_def_struct_sdna(srna, "bNodeTree");
RNA_def_struct_ui_icon(srna, ICON_NODETREE);
@@ -3410,7 +3454,8 @@ void RNA_def_nodetree(BlenderRNA *brna)
/* Generate RNA definitions for all socket subtypes */
#define SUBTYPE(socktype, stypename, id, idname) \
- rna_def_node_socket_subtype(brna, SOCK_##socktype, PROP_##id, "NodeSocket"#stypename#idname, #idname" "#stypename" Node Socket");
+ rna_def_node_socket_subtype(brna, SOCK_##socktype, PROP_##id, "NodeSocket"#stypename#idname, \
+ #idname" "#stypename" Node Socket");
NODE_DEFINE_SUBTYPES
#undef SUBTYPE
rna_def_node_socket_subtype(brna, SOCK_BOOLEAN, 0, "NodeSocketBoolean", "Boolean Node Socket");
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 088d4870143..e3cf9af6c39 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -46,6 +46,8 @@
#include "DNA_scene_types.h"
#include "DNA_meta_types.h"
+#include "BLI_utildefines.h"
+
#include "BKE_tessmesh.h"
#include "BKE_group.h" /* needed for object_in_group() */
@@ -161,7 +163,7 @@ static void rna_Object_internal_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- /* dont use compat so we get predictable rotation */
+ /* don't use compat so we get predictable rotation */
object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, FALSE, TRUE);
rna_Object_internal_update(bmain, scene, ptr);
}
@@ -196,7 +198,7 @@ static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
copy_m4_m4(ob->obmat, (float(*)[4])values);
}
- /* dont use compat so we get predictable rotation */
+ /* don't use compat so we get predictable rotation */
object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
}
@@ -406,9 +408,11 @@ static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), Point
if (par->type == OB_CURVE)
RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARCURVE);
else if (par->type == OB_LATTICE)
- RNA_enum_items_add_value(&item, &totitem, &parent_type_items[4], PARSKEL); /* special hack: prevents this overriding others */
+ /* special hack: prevents this overriding others */
+ RNA_enum_items_add_value(&item, &totitem, &parent_type_items[4], PARSKEL);
else if (par->type == OB_ARMATURE) {
- RNA_enum_items_add_value(&item, &totitem, &parent_type_items[3], PARSKEL); /* special hack: prevents this being overrided */
+ /* special hack: prevents this being overrided */
+ RNA_enum_items_add_value(&item, &totitem, &parent_type_items[3], PARSKEL);
RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE);
}
else if (par->type == OB_MESH) {
@@ -465,7 +469,8 @@ static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value)
if (object_in_group(ob, grp) == 0)
ob->dup_group = grp;
else
- BKE_report(NULL, RPT_ERROR, "Cannot set dupli-group as object belongs in group being instanced thus causing a cycle");
+ BKE_report(NULL, RPT_ERROR,
+ "Cannot set dupli-group as object belongs in group being instanced thus causing a cycle");
}
void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
@@ -864,20 +869,27 @@ static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr)
if (!(ob->gameflag & OB_COLLISION)) {
if (ob->gameflag & OB_OCCLUDER) {
ob->body_type = OB_BODY_TYPE_OCCLUDER;
- } else if (ob->gameflag & OB_NAVMESH){
+ }
+ else if (ob->gameflag & OB_NAVMESH) {
ob->body_type = OB_BODY_TYPE_NAVMESH;
- } else {
+ }
+ else {
ob->body_type = OB_BODY_TYPE_NO_COLLISION;
}
- } else if (ob->gameflag & OB_SENSOR) {
+ }
+ else if (ob->gameflag & OB_SENSOR) {
ob->body_type = OB_BODY_TYPE_SENSOR;
- } else if (!(ob->gameflag & OB_DYNAMIC)) {
+ }
+ else if (!(ob->gameflag & OB_DYNAMIC)) {
ob->body_type = OB_BODY_TYPE_STATIC;
- } else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) {
+ }
+ else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) {
ob->body_type = OB_BODY_TYPE_DYNAMIC;
- } else if (ob->gameflag & OB_RIGID_BODY) {
+ }
+ else if (ob->gameflag & OB_RIGID_BODY) {
ob->body_type = OB_BODY_TYPE_RIGID;
- } else {
+ }
+ else {
ob->body_type = OB_BODY_TYPE_SOFT;
/* create the structure here because we display soft body buttons in the main panel */
if (!ob->bsoft)
@@ -1165,7 +1177,8 @@ static void rna_Object_constraints_clear(Object *object)
WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, object);
}
-static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, const char *name, int type)
+static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports,
+ const char *name, int type)
{
return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
}
@@ -1258,7 +1271,7 @@ static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *report
if (weight < 0) {
BKE_reportf(reports, RPT_ERROR, "Vertex not in group");
}
- return weight;
+ return weight;
}
/* generic poll functions */
@@ -1313,12 +1326,14 @@ static void rna_def_vertex_group(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Name", "Vertex group name");
RNA_def_struct_name_property(srna, prop);
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set");
- RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data"); /* update data because modifiers may use [#24761] */
+ /* update data because modifiers may use [#24761] */
+ RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data");
prop = RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "", "Maintain the relative weights for the group");
RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
- RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data"); /* update data because modifiers may use [#24761] */
+ /* update data because modifiers may use [#24761] */
+ RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data");
prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1402,8 +1417,9 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
{OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", "Linear and angular physics"},
{OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", "Soft body"},
{OB_BODY_TYPE_OCCLUDER, "OCCLUDE", 0, "Occlude", "Occluder for optimizing scene rendering"},
- {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor",
- "Collision Sensor, detects static and dynamic objects but not the other collision sensor objects"},
+ {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor",
+ "Collision Sensor, detects static and dynamic objects but not the other "
+ "collision sensor objects"},
{OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"},
{0, NULL, 0, NULL, NULL}};
@@ -1450,7 +1466,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "body_type");
RNA_def_property_enum_items(prop, body_type_items);
- RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL);
+ RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get",
+ "rna_GameObjectSettings_physics_type_set", NULL);
RNA_def_property_ui_text(prop, "Physics Type", "Select the type of physical representation");
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1574,7 +1591,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "margin");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_text(prop, "Collision Margin",
- "Extra margin around object for collision detection, small amount required for stability");
+ "Extra margin around object for collision detection, small amount required "
+ "for stability");
prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "bsoft");
@@ -1640,7 +1658,8 @@ static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
/* Collection active property */
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Constraint");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_constraint_get", "rna_Object_active_constraint_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_Object_active_constraint_get",
+ "rna_Object_active_constraint_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
@@ -1775,7 +1794,8 @@ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_int_sdna(prop, NULL, "actdef");
- RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set",
+ RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get",
+ "rna_Object_active_vertex_group_index_set",
"rna_Object_active_vertex_group_index_range");
RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array");
RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
@@ -1832,7 +1852,8 @@ static void rna_def_object(BlenderRNA *brna)
{OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounds of the object"},
{OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"},
{OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (if solid drawing is enabled in the viewport)"},
- {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (if textures are enabled in the viewport)"},
+ {OB_TEXTURE, "TEXTURED", 0, "Textured",
+ "Draw the object with textures (if textures are enabled in the viewport)"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem boundtype_items[] = {
@@ -1850,7 +1871,8 @@ static void rna_def_object(BlenderRNA *brna)
{OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"},
{0, NULL, 0, NULL, NULL}};
- /* XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable */
+ /* XXX: this RNA enum define is currently duplicated for objects,
+ * since there is some text here which is not applicable */
static EnumPropertyItem prop_rotmode_items[] = {
{ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"},
{ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"},
@@ -1911,7 +1933,8 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Bounding Box",
- "Object's bounding box in object-space coordinates, all values are -1.0 when not available");
+ "Object's bounding box in object-space coordinates, all values are -1.0 when "
+ "not available");
/* parent */
prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
@@ -1940,7 +1963,8 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
/* Track and Up flags */
- /* XXX: these have been saved here for a bit longer (after old track was removed), since some other tools still refer to this */
+ /* XXX: these have been saved here for a bit longer (after old track was removed),
+ * since some other tools still refer to this */
prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "trackflag");
RNA_def_property_enum_items(prop, track_items);
@@ -1968,12 +1992,14 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
RNA_def_property_struct_type(prop, "MaterialSlot");
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL); /* don't dereference pointer! */
+ /* don't dereference pointer! */
+ RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object");
prop = RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Material");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", "rna_Object_active_material_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get",
+ "rna_Object_active_material_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
@@ -2006,7 +2032,8 @@ static void rna_def_object(BlenderRNA *brna)
*/
prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
RNA_def_property_array(prop, 4);
- RNA_def_property_float_funcs(prop, "rna_Object_rotation_axis_angle_get", "rna_Object_rotation_axis_angle_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_Object_rotation_axis_angle_get",
+ "rna_Object_rotation_axis_angle_set", NULL);
RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
RNA_def_property_float_array_default(prop, default_axisAngle);
RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
@@ -2062,7 +2089,8 @@ static void rna_def_object(BlenderRNA *brna)
#if 0 /* XXX not supported well yet... */
prop = RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
- RNA_def_property_float_sdna(prop, NULL, "dquat"); /* FIXME: this is not a single field any more! (drotAxis and drotAngle) */
+ /* FIXME: this is not a single field any more! (drotAxis and drotAngle) */
+ RNA_def_property_float_sdna(prop, NULL, "dquat");
RNA_def_property_float_array_default(prop, default_axisAngle);
RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)",
"Extra rotation added to the rotation of the object (when using Axis-Angle rotations)");
@@ -2091,7 +2119,8 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
- /* XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this! */
+ /* XXX this is sub-optimal - it really should be included above,
+ * but due to technical reasons we can't do this! */
prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
@@ -2210,7 +2239,8 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "pd");
RNA_def_property_struct_type(prop, "CollisionSettings");
RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the object as a collider in physics simulation");
+ RNA_def_property_ui_text(prop, "Collision Settings",
+ "Settings for using the object as a collider in physics simulation");
prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "soft");
@@ -2252,7 +2282,9 @@ static void rna_def_object(BlenderRNA *brna)
/* XXX: evil old crap */
prop = RNA_def_property(srna, "use_slow_parent", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
- RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship (beware: this isn't renderfarm safe and may be invalid after jumping around the timeline)");
+ RNA_def_property_ui_text(prop, "Slow Parent",
+ "Create a delay in the parent relationship (beware: this isn't renderfarm "
+ "safe and may be invalid after jumping around the timeline)");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
prop = RNA_def_property(srna, "slow_parent_offset", PROP_FLOAT, PROP_NONE|PROP_UNIT_TIME);
@@ -2270,7 +2302,8 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_dupli_frames_speed", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);
- RNA_def_property_ui_text(prop, "Dupli Frames Speed", "Set dupliframes to use the current frame instead of parent curve's evaluation time");
+ RNA_def_property_ui_text(prop, "Dupli Frames Speed",
+ "Set dupliframes to use the current frame instead of parent curve's evaluation time");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
prop = RNA_def_property(srna, "use_dupli_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
@@ -2377,7 +2410,8 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
- RNA_def_property_ui_text(prop, "X-Ray", "Make the object draw in front of others (unsupported for duplicator drawing)");
+ RNA_def_property_ui_text(prop, "X-Ray",
+ "Make the object draw in front of others (unsupported for duplicator drawing)");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
/* Grease Pencil */
@@ -2421,7 +2455,8 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "shapenr");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */
- RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set", "rna_Object_active_shape_key_index_range");
+ RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set",
+ "rna_Object_active_shape_key_index_range");
RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index");
RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index f33cf1a3993..0e97729c52c 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
@@ -155,22 +155,23 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
/* copies the data */
tmpmesh = copy_mesh( ob->data );
/* if not getting the original caged mesh, get final derived mesh */
- } else {
+ }
+ else {
/* Make a dummy mesh, saves copying */
DerivedMesh *dm;
/* CustomDataMask mask = CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL; */
CustomDataMask mask = CD_MASK_MESH; /* this seems more suitable, exporter,
- for example, needs CD_MASK_MDEFORMVERT */
+ * for example, needs CD_MASK_MDEFORMVERT */
/* Write the display mesh into the dummy mesh */
if (render)
- dm = mesh_create_derived_render( sce, ob, mask );
+ dm = mesh_create_derived_render(sce, ob, mask);
else
- dm = mesh_create_derived_view( sce, ob, mask );
+ dm = mesh_create_derived_view(sce, ob, mask);
- tmpmesh = add_mesh( "Mesh" );
- DM_to_mesh( dm, tmpmesh, ob );
- dm->release( dm );
+ tmpmesh = add_mesh("Mesh");
+ DM_to_mesh(dm, tmpmesh, ob);
+ dm->release(dm);
}
break;
@@ -184,7 +185,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
case OB_SURF:
case OB_FONT:
case OB_CURVE:
- tmpmesh->totcol = tmpcu->totcol;
+ tmpmesh->totcol = tmpcu->totcol;
/* free old material list (if it exists) and adjust user counts */
if ( tmpcu->mat ) {
@@ -326,7 +327,8 @@ void rna_Object_free_duplilist(Object *ob)
}
}
-static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports, const char *name, int from_mix)
+static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports,
+ const char *name, int from_mix)
{
Scene *scene = CTX_data_scene(C);
KeyBlock *kb = NULL;
@@ -351,7 +353,8 @@ int rna_Object_is_visible(Object *ob, Scene *sce)
}
#if 0
-static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int *indices, int totindex, float weight, int assignmode)
+static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int *indices, int totindex,
+ float weight, int assignmode)
{
if (ob->type != OB_MESH) {
BKE_report(reports, RPT_ERROR, "Object should be of MESH type");
@@ -371,7 +374,7 @@ static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int
}
/* makes a set of dVerts corresponding to the mVerts */
- if (!me->dvert)
+ if (!me->dvert)
create_dverts(&me->id);
/* loop list adding verts to group */
@@ -386,7 +389,8 @@ static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int
}
#endif
-void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start[3], float ray_end[3], float r_location[3], float r_normal[3], int *index)
+void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start[3], float ray_end[3],
+ float r_location[3], float r_normal[3], int *index)
{
BVHTreeFromMesh treeData = {NULL};
@@ -410,7 +414,8 @@ void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start[3], fl
dist = hit.dist = normalize_v3(ray_nor);
hit.index = -1;
- if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_nor, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1) {
+ if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_nor, 0.0f, &hit,
+ treeData.raycast_callback, &treeData) != -1) {
if (hit.dist <= dist) {
copy_v3_v3(r_location, hit.co);
copy_v3_v3(r_normal, hit.no);
@@ -425,12 +430,14 @@ void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start[3], fl
*index = -1;
}
-void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, float point_co[3], float max_dist, float n_location[3], float n_normal[3], int *index)
+void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, float point_co[3], float max_dist,
+ float n_location[3], float n_normal[3], int *index)
{
BVHTreeFromMesh treeData = {NULL};
if (ob->derivedFinal == NULL) {
- BKE_reportf(reports, RPT_ERROR, "object \"%s\" has no mesh data to be used for finding nearest point", ob->id.name+2);
+ BKE_reportf(reports, RPT_ERROR, "object \"%s\" has no mesh data to be used for finding nearest point",
+ ob->id.name+2);
return;
}
@@ -438,7 +445,8 @@ void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, float poi
bvhtree_from_mesh_faces(&treeData, ob->derivedFinal, 0.0f, 4, 6);
if (treeData.tree == NULL) {
- BKE_reportf(reports, RPT_ERROR, "object \"%s\" could not create internal data for finding nearest point", ob->id.name+2);
+ BKE_reportf(reports, RPT_ERROR, "object \"%s\" could not create internal data for finding nearest point",
+ ob->id.name+2);
return;
}
else {
@@ -527,7 +535,7 @@ void RNA_api_object(StructRNA *srna)
static EnumPropertyItem mesh_dm_info_items[] = {
{0, "SOURCE", 0, "Source", "Source mesh"},
{1, "DEFORM", 0, "Deform", "Objects deform mesh"},
- {2, "FINAL", 0, "Final", "Objects final mesh"},
+ {2, "FINAL", 0, "Final", "Objects final mesh"},
{0, NULL, 0, NULL, NULL}
};
#endif
@@ -542,7 +550,8 @@ void RNA_api_object(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object, remove it if it is only used for export");
+ parm = RNA_def_pointer(func, "mesh", "Mesh", "",
+ "Mesh created from object, remove it if it is only used for export");
RNA_def_function_return(func, parm);
/* duplis */
@@ -585,10 +594,12 @@ void RNA_api_object(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED);
/* return location and normal */
- parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The hit location of this ray cast", -1e4, 1e4);
+ parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
+ "The hit location of this ray cast", -1e4, 1e4);
RNA_def_property_flag(parm, PROP_THICK_WRAP);
RNA_def_function_output(func, parm);
- parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "The face normal at the ray cast hit location", -1e4, 1e4);
+ parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
+ "The face normal at the ray cast hit location", -1e4, 1e4);
RNA_def_property_flag(parm, PROP_THICK_WRAP);
RNA_def_function_output(func, parm);
@@ -607,10 +618,12 @@ void RNA_api_object(StructRNA *srna)
RNA_def_float(func, "max_dist", 1.844674352395373e+19, 0.0, FLT_MAX, "", "", 0.0, FLT_MAX);
/* return location and normal */
- parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The location on the object closest to the point", -1e4, 1e4);
+ parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
+ "The location on the object closest to the point", -1e4, 1e4);
RNA_def_property_flag(parm, PROP_THICK_WRAP);
RNA_def_function_output(func, parm);
- parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "The face normal at the closest point", -1e4, 1e4);
+ parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
+ "The face normal at the closest point", -1e4, 1e4);
RNA_def_property_flag(parm, PROP_THICK_WRAP);
RNA_def_function_output(func, parm);
@@ -657,7 +670,8 @@ void RNA_api_object_base(StructRNA *srna)
PropertyRNA *parm;
func = RNA_def_function(srna, "layers_from_view", "rna_ObjectBase_layers_from_view");
- RNA_def_function_ui_description(func, "Sets the object layers from a 3D View (use when adding an object in local view)");
+ RNA_def_function_ui_description(func,
+ "Sets the object layers from a 3D View (use when adding an object in local view)");
parm = RNA_def_pointer(func, "view", "SpaceView3D", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 287303d4efe..be28300eb01 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -570,7 +570,8 @@ static char *rna_FieldSettings_path(PointerRNA *ptr)
return BLI_sprintfN("force_field_1");
else if (part->pd2 == pd)
return BLI_sprintfN("force_field_2");
- } else {
+ }
+ else {
/* object force field */
Object *ob = (Object*)ptr->id.data;
@@ -607,7 +608,8 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr)
if (part->effector_weights == ew)
return BLI_sprintfN("effector_weights");
- } else {
+ }
+ else {
Object *ob = (Object*)ptr->id.data;
ModifierData *md;
@@ -647,8 +649,8 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr)
for (; surface; surface = surface->next) {
if (surface->effector_weights == ew)
- return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"].effector_weights",
- md->name, surface->name);
+ return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]"
+ ".effector_weights", md->name, surface->name);
}
}
}
@@ -734,7 +736,8 @@ static void rna_def_ptcache_point_caches(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches");
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set",
+ RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get",
+ "rna_Cache_active_point_cache_index_set",
"rna_Cache_active_point_cache_index_range");
RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
@@ -838,7 +841,8 @@ static void rna_def_pointcache(BlenderRNA *brna)
prop = RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "PointCache");
RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list");
rna_def_ptcache_point_caches(brna, prop);
@@ -1062,12 +1066,14 @@ static void rna_def_field(BlenderRNA *brna)
{0, "NONE", 0, "None", ""},
{PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Radial field toward the center of object"},
{PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Constant force along the force object's local Z axis"},
- {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Spiraling force that twists the force object's local Z axis"},
+ {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex",
+ "Spiraling force that twists the force object's local Z axis"},
{PFIELD_MAGNET, "MAGNET", ICON_FORCE_MAGNETIC, "Magnetic", "Forcefield depends on the speed of the particles"},
{PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic",
"The source of this force field is the zero point of a harmonic oscillator"},
{PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge",
- "Spherical forcefield based on the charge of particles, only influences other charge force fields"},
+ "Spherical forcefield based on the charge of particles, "
+ "only influences other charge force fields"},
{PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones",
"Forcefield based on the Lennard-Jones potential"},
{PFIELD_TEXTURE, "TEXTURE", ICON_FORCE_TEXTURE, "Texture", "Forcefield based on a texture"},
@@ -1243,7 +1249,8 @@ static void rna_def_field(BlenderRNA *brna)
prop = RNA_def_property(srna, "texture_nabla", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "tex_nabla");
RNA_def_property_range(prop, 0.0001f, 1.0f);
- RNA_def_property_ui_text(prop, "Nabla", "Defines size of derivative offset used for calculating gradient and curl");
+ RNA_def_property_ui_text(prop, "Nabla",
+ "Defines size of derivative offset used for calculating gradient and curl");
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
prop = RNA_def_property(srna, "noise", PROP_FLOAT, PROP_NONE);
@@ -1410,7 +1417,8 @@ static void rna_def_game_softbody(BlenderRNA *brna)
srna = RNA_def_struct(brna, "GameSoftBodySettings", NULL);
RNA_def_struct_sdna(srna, "BulletSoftBody");
- RNA_def_struct_ui_text(srna, "Game Soft Body Settings", "Soft body simulation settings for an object in the game engine");
+ RNA_def_struct_ui_text(srna, "Game Soft Body Settings",
+ "Soft body simulation settings for an object in the game engine");
/* Floats */
@@ -1432,7 +1440,8 @@ static void rna_def_game_softbody(BlenderRNA *brna)
prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "margin");
RNA_def_property_range(prop, 0.01f, 1.0f);
- RNA_def_property_ui_text(prop, "Margin", "Collision margin for soft body. Small value makes the algorithm unstable");
+ RNA_def_property_ui_text(prop, "Margin",
+ "Collision margin for soft body. Small value makes the algorithm unstable");
prop = RNA_def_property(srna, "weld_threshold", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "welding");
@@ -1536,7 +1545,8 @@ static void rna_def_softbody(BlenderRNA *brna)
prop = RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "vertgroup");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */
- RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length",
+ RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get",
+ "rna_SoftBodySettings_goal_vgroup_length",
"rna_SoftBodySettings_goal_vgroup_set");
RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values");
@@ -1556,7 +1566,8 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "defgoal");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value, when no Vertex Group used");
+ RNA_def_property_ui_text(prop, "Goal Default",
+ "Default Goal (vertex target position) value, when no Vertex Group used");
RNA_def_property_update(prop, 0, "rna_softbody_update");
prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
@@ -1660,7 +1671,8 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "rklimit");
RNA_def_property_range(prop, 0.001f, 10.0f);
RNA_def_property_ui_text(prop, "Error Limit",
- "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed");
+ "The Runge-Kutta ODE solver error limit, low value gives more precision, "
+ "high values speed");
RNA_def_property_update(prop, 0, "rna_softbody_update");
prop = RNA_def_property(srna, "step_min", PROP_INT, PROP_NONE);
@@ -1685,7 +1697,8 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "fuzzyness");
RNA_def_property_range(prop, 1, 100);
RNA_def_property_ui_text(prop, "Fuzzy",
- "Fuzziness while on collision, high values make collision handling faster but less stable");
+ "Fuzziness while on collision, high values make collision handling faster "
+ "but less stable");
RNA_def_property_update(prop, 0, "rna_softbody_update");
prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
@@ -1739,18 +1752,21 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_softbody_update");
prop = RNA_def_property(srna, "use_stiff_quads", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_stiff_quads_get", "rna_SoftBodySettings_stiff_quads_set");
+ RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_stiff_quads_get",
+ "rna_SoftBodySettings_stiff_quads_set");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Stiff Quads", "Add diagonal springs on 4-gons");
RNA_def_property_update(prop, 0, "rna_softbody_update");
prop = RNA_def_property(srna, "use_edge_collision", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_edge_collision_get", "rna_SoftBodySettings_edge_collision_set");
+ RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_edge_collision_get",
+ "rna_SoftBodySettings_edge_collision_set");
RNA_def_property_ui_text(prop, "Edge Collision", "Edges collide too");
RNA_def_property_update(prop, 0, "rna_softbody_update");
prop = RNA_def_property(srna, "use_face_collision", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_face_collision_get", "rna_SoftBodySettings_face_collision_set");
+ RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_face_collision_get",
+ "rna_SoftBodySettings_face_collision_set");
RNA_def_property_ui_text(prop, "Face Collision", "Faces collide too, can be very slow");
RNA_def_property_update(prop, 0, "rna_softbody_update");
@@ -1761,7 +1777,8 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_softbody_update");
prop = RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_self_collision_get", "rna_SoftBodySettings_self_collision_set");
+ RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_self_collision_get",
+ "rna_SoftBodySettings_self_collision_set");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Self Collision", "Enable naive vertex ball self collision");
RNA_def_property_update(prop, 0, "rna_softbody_update");
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index a4ed256b70c..b10639443c0 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -132,7 +132,8 @@ EnumPropertyItem part_hair_ren_as_items[] = {
#include "BKE_texture.h"
/* use for object space hair get/set */
-static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt, ParticleData **pa_pt)
+static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt,
+ ParticleData **pa_pt)
{
HairKey *hkey = (HairKey *)ptr->data;
Object *ob = (Object *)ptr->id.data;
@@ -510,7 +511,8 @@ void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value)
/* copy the new name into the name slot */
BLI_strncpy_utf8(part->name, value, sizeof(part->name));
- BLI_uniquename(&ob->particlesystem, part, "ParticleSystem", '.', offsetof(ParticleSystem, name), sizeof(part->name));
+ BLI_uniquename(&ob->particlesystem, part, "ParticleSystem", '.', offsetof(ParticleSystem, name),
+ sizeof(part->name));
}
static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
@@ -718,7 +720,8 @@ static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
strcpy(str, "No object");
}
-static EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
/*if(part->type==PART_REACTOR) */
/* return part_reactor_from_items; */
@@ -726,7 +729,8 @@ static EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA
return part_from_items;
}
-static EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
ParticleSettings *part = ptr->id.data;
@@ -736,7 +740,8 @@ static EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA
return part_dist_items;
}
-static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
ParticleSettings *part = ptr->id.data;
@@ -746,7 +751,8 @@ static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), Pointer
return part_draw_as_items;
}
-static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
ParticleSettings *part = ptr->id.data;
@@ -916,11 +922,14 @@ static void rna_def_particle_hair_key(BlenderRNA *brna)
prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Location (Object Space)", "Location of the hair key in object space");
- RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get", "rna_ParticleHairKey_location_object_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get",
+ "rna_ParticleHairKey_location_object_set", NULL);
prop = RNA_def_property(srna, "co_hair_space", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "co");
- RNA_def_property_ui_text(prop, "Location", "Location of the hair key in its internal coordinate system, relative to the emitting face");
+ RNA_def_property_ui_text(prop, "Location",
+ "Location of the hair key in its internal coordinate system, "
+ "relative to the emitting face");
}
static void rna_def_particle_key(BlenderRNA *brna)
@@ -957,7 +966,8 @@ static void rna_def_child_particle(BlenderRNA *brna)
/*PropertyRNA *prop; */
srna = RNA_def_struct(brna, "ChildParticle", NULL);
- RNA_def_struct_ui_text(srna, "Child Particle", "Child particle interpolated from simulated or edited particles");
+ RNA_def_struct_ui_text(srna, "Child Particle",
+ "Child particle interpolated from simulated or edited particles");
/* int num, parent; *//* num is face index on the final derived mesh */
@@ -1087,14 +1097,16 @@ static void rna_def_particle_dupliweight(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "ParticleDupliWeight");
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get", "rna_ParticleDupliWeight_name_length", NULL);
+ RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get",
+ "rna_ParticleDupliWeight_name_length", NULL);
RNA_def_property_ui_text(prop, "Name", "Particle dupliobject name");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
RNA_def_property_range(prop, 0, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Count", "The number of times this object is repeated with respect to other objects");
+ RNA_def_property_ui_text(prop, "Count",
+ "The number of times this object is repeated with respect to other objects");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
}
@@ -1134,24 +1146,28 @@ static void rna_def_fluid_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH);
- RNA_def_property_ui_text(prop, "Initial Rest Length", "Use the initial length as spring rest length instead of 2 * particle size");
+ RNA_def_property_ui_text(prop, "Initial Rest Length",
+ "Use the initial length as spring rest length instead of 2 * particle size");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "plasticity_constant");
RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Plasticity", "How much the spring rest length can change after the elastic limit is crossed");
+ RNA_def_property_ui_text(prop, "Plasticity",
+ "How much the spring rest length can change after the elastic limit is crossed");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "yield_ratio");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Elastic Limit", "How much the spring has to be stretched/compressed in order to change it's rest length");
+ RNA_def_property_ui_text(prop, "Elastic Limit",
+ "How much the spring has to be stretched/compressed in order to change it's rest length");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Spring Frames", "Create springs for this number of frames since particles birth (0 is always)");
+ RNA_def_property_ui_text(prop, "Spring Frames",
+ "Create springs for this number of frames since particles birth (0 is always)");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
/* Viscosity */
@@ -1181,7 +1197,8 @@ static void rna_def_fluid_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "stiffness_knear");
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Repulsion Factor", "How strongly the fluid tries to keep from clustering (factor of stiffness)");
+ RNA_def_property_ui_text(prop, "Repulsion Factor",
+ "How strongly the fluid tries to keep from clustering (factor of stiffness)");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
@@ -1196,7 +1213,9 @@ static void rna_def_fluid_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "buoyancy");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Buoyancy", "Artificial buoyancy force in negative gravity direction based on pressure differences inside the fluid");
+ RNA_def_property_ui_text(prop, "Buoyancy",
+ "Artificial buoyancy force in negative gravity direction based on pressure "
+ "differences inside the fluid");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
/* Factor flags */
@@ -1208,7 +1227,8 @@ static void rna_def_fluid_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "factor_density", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_DENSITY);
- RNA_def_property_ui_text(prop, "Factor Density", "Density is calculated as a factor of default density (depends on particle size)");
+ RNA_def_property_ui_text(prop, "Factor Density",
+ "Density is calculated as a factor of default density (depends on particle size)");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "factor_radius", PROP_BOOLEAN, PROP_NONE);
@@ -1237,7 +1257,8 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
{TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"},
{TEXCO_UV, "UV", 0, "UV", "Use UV coordinates for texture coordinates"},
{TEXCO_ORCO, "ORCO", 0, "Generated", "Use the original undeformed coordinates of the object"},
- {TEXCO_STRAND, "STRAND", 0, "Strand / Particle", "Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
+ {TEXCO_STRAND, "STRAND", 0, "Strand / Particle",
+ "Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_mapping_items[] = {
@@ -1270,12 +1291,14 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
RNA_def_struct_sdna(srna, "MTex");
- RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot", "Texture slot for textures in a Particle Settings datablock");
+ RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot",
+ "Texture slot for textures in a Particle Settings datablock");
prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "texco");
RNA_def_property_enum_items(prop, texco_items);
- RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background");
+ RNA_def_property_ui_text(prop, "Texture Coordinates",
+ "Texture coordinates used to map the texture onto the background");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
@@ -1487,7 +1510,12 @@ static void rna_def_particle_settings(BlenderRNA *brna)
static EnumPropertyItem ave_mode_items[] = {
{0, "NONE", 0, "None", ""},
- {PART_AVE_SPIN, "SPIN", 0, "Spin", ""},
+ {PART_AVE_VELOCITY, "VELOCITY", 0, "Velocity", ""},
+ {PART_AVE_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
+ {PART_AVE_VERTICAL, "VERTICAL", 0, "Vertical", ""},
+ {PART_AVE_GLOBAL_X, "GLOBAL_X", 0, "Global X", ""},
+ {PART_AVE_GLOBAL_Y, "GLOBAL_Y", 0, "Global Y", ""},
+ {PART_AVE_GLOBAL_Z, "GLOBAL_Z", 0, "Global Z", ""},
{PART_AVE_RAND, "RAND", 0, "Random", ""} ,
{0, NULL, 0, NULL, NULL}
};
@@ -1576,7 +1604,8 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get",
- "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot", "ParticleSettingsTextureSlots", "rna_Particle_reset");
+ "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot",
+ "ParticleSettingsTextureSlots", "rna_Particle_reset");
/* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */
prop = RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
@@ -1621,7 +1650,8 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Even Distribution", "Use even distribution from faces based on face areas or edge lengths");
+ RNA_def_property_ui_text(prop, "Even Distribution",
+ "Use even distribution from faces based on face areas or edge lengths");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
@@ -1636,10 +1666,16 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
+ prop = RNA_def_property(srna, "use_rotations", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROTATIONS);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Rotations", "Calculate particle rotations");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
prop = RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Dynamic", "Set rotation to dynamic/constant");
+ RNA_def_property_ui_text(prop, "Dynamic", "Particle rotations are effected by collisions and effectors");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
@@ -1730,14 +1766,14 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "rotmode");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, rot_mode_items);
- RNA_def_property_ui_text(prop, "Rotation", "Particle rotation axis");
+ RNA_def_property_ui_text(prop, "Orientation axis", "Particle orientation axis (does not effect eplode modifier results)");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "avemode");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, ave_mode_items);
- RNA_def_property_ui_text(prop, "Angular Velocity Mode", "Particle angular velocity mode");
+ RNA_def_property_ui_text(prop, "Angular Velocity Axis", "What axis is used to change particle rotation with time");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
@@ -1800,7 +1836,9 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_rotation_dupli", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ROTATE_OB);
- RNA_def_property_ui_text(prop, "Rotation", "Use object's rotation for duplication (global x-axis is aligned particle rotation axis)");
+ RNA_def_property_ui_text(prop, "Rotation",
+ "Use object's rotation for duplication (global x-axis is aligned "
+ "particle rotation axis)");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
prop = RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
@@ -2003,7 +2041,8 @@ static void rna_def_particle_settings(BlenderRNA *brna)
/* simplification */
prop = RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_ENABLE);
- RNA_def_property_ui_text(prop, "Child Simplification", "Remove child strands as the object becomes smaller on the screen");
+ RNA_def_property_ui_text(prop, "Child Simplification",
+ "Remove child strands as the object becomes smaller on the screen");
prop = RNA_def_property(srna, "use_simplify_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_VIEWPORT);
@@ -2075,14 +2114,18 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "Subframes", "Subframes to simulate for improved stability and finer granularity simulations (dt = timestep / (subframes + 1))");
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(prop, "Subframes",
+ "Subframes to simulate for improved stability and finer granularity simulations "
+ "(dt = timestep / (subframes + 1))");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.01, 10);
RNA_def_property_float_default(prop, 0.2);
- RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold", "The relative distance a particle can move before requiring more subframes (target Courant number); 0.1-0.3 is the recommended range");
+ RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold",
+ "The relative distance a particle can move before requiring more subframes "
+ "(target Courant number); 0.1-0.3 is the recommended range");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
@@ -2182,7 +2225,9 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "reactfac");
RNA_def_property_range(prop, -10.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Reactor", "Let the vector away from the target particle's location give the particle a starting speed");
+ RNA_def_property_ui_text(prop, "Reactor",
+ "Let the vector away from the target particle's location give the particle "
+ "a starting speed");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
@@ -2190,32 +2235,33 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_range(prop, -200.0f, 200.0f);
RNA_def_property_ui_range(prop, -100, 100, 1, 3);
- RNA_def_property_ui_text(prop, "Object Aligned", "Let the emitter object orientation give the particle a starting speed");
+ RNA_def_property_ui_text(prop, "Object Aligned",
+ "Let the emitter object orientation give the particle a starting speed");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "avefac");
RNA_def_property_range(prop, -200.0f, 200.0f);
RNA_def_property_ui_range(prop, -100, 100, 10, 3);
- RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount");
+ RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount (in radians per second)");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "phasefac");
RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Phase", "Initial rotation phase");
+ RNA_def_property_ui_text(prop, "Phase", "Rotation around the chosen orientation axis");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "randrotfac");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Random Rotation", "Randomize rotation");
+ RNA_def_property_ui_text(prop, "Random Orientation", "Randomize particle orientation");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "randphasefac");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation phase");
+ RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation around the chosen orientation axis");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE);
@@ -2433,13 +2479,15 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "parting_min");
RNA_def_property_range(prop, 0.0f, 180.0f);
- RNA_def_property_ui_text(prop, "Parting Minimum", "Minimum root to tip angle (tip distance/root distance for long hair)");
+ RNA_def_property_ui_text(prop, "Parting Minimum",
+ "Minimum root to tip angle (tip distance/root distance for long hair)");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
prop = RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "parting_max");
RNA_def_property_range(prop, 0.0f, 180.0f);
- RNA_def_property_ui_text(prop, "Parting Maximum", "Maximum root to tip angle (tip distance/root distance for long hair)");
+ RNA_def_property_ui_text(prop, "Parting Maximum",
+ "Maximum root to tip angle (tip distance/root distance for long hair)");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
/* branching */
@@ -2510,7 +2558,9 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active Dupli Object", "");
prop = RNA_def_property(srna, "active_dupliweight_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get", "rna_ParticleDupliWeight_active_index_set", "rna_ParticleDupliWeight_active_index_range");
+ RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get",
+ "rna_ParticleDupliWeight_active_index_set",
+ "rna_ParticleDupliWeight_active_index_range");
RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
prop = RNA_def_property(srna, "dupli_object", PROP_POINTER, PROP_NONE);
@@ -2537,7 +2587,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "SPHFluidSettings");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
+ RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
/* Effector weights */
prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
@@ -2586,7 +2636,8 @@ static void rna_def_particle_target(BlenderRNA *brna)
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "ob");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Target Object", "The object that has the target particle system (empty if same object)");
+ RNA_def_property_ui_text(prop, "Target Object",
+ "The object that has the target particle system (empty if same object)");
RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
prop = RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
@@ -2660,7 +2711,9 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(prop, "Child Seed", "Offset in the random number table for child particles, to get a different randomized result");
+ RNA_def_property_ui_text(prop, "Child Seed",
+ "Offset in the random number table for child particles, to get a different "
+ "randomized result");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
/* hair */
@@ -2685,13 +2738,16 @@ static void rna_def_particle_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "target_ob");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Reactor Target Object", "For reactor systems, the object that has the target particle system (empty if same object)");
+ RNA_def_property_ui_text(prop, "Reactor Target Object",
+ "For reactor systems, the object that has the target particle system "
+ "(empty if same object)");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "target_psys");
RNA_def_property_range(prop, 1, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Reactor Target Particle System", "For reactor systems, index of particle system on the target object");
+ RNA_def_property_ui_text(prop, "Reactor Target Particle System",
+ "For reactor systems, index of particle system on the target object");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
/* keyed */
@@ -2711,7 +2767,9 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active Particle Target", "");
prop = RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_ParticleSystem_active_particle_target_index_get", "rna_ParticleSystem_active_particle_target_index_set", "rna_ParticleSystem_active_particle_target_index_range");
+ RNA_def_property_int_funcs(prop, "rna_ParticleSystem_active_particle_target_index_get",
+ "rna_ParticleSystem_active_particle_target_index_set",
+ "rna_ParticleSystem_active_particle_target_index_range");
RNA_def_property_ui_text(prop, "Active Particle Target Index", "");
@@ -2734,7 +2792,7 @@ static void rna_def_particle_system(BlenderRNA *brna)
/* vertex groups */
/* note, internally store as ints, access as strings */
-#if 0 /* int access. works ok but isnt useful for the UI */
+#if 0 /* int access. works ok but isn't useful for the UI */
prop = RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[0]");
RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
@@ -2742,7 +2800,8 @@ static void rna_def_particle_system(BlenderRNA *brna)
#endif
prop = RNA_def_property(srna, "vertex_group_density", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_0", "rna_ParticleVGroup_name_len_0", "rna_ParticleVGroup_name_set_0");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_0", "rna_ParticleVGroup_name_len_0",
+ "rna_ParticleVGroup_name_set_0");
RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
@@ -2752,7 +2811,8 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "vertex_group_velocity", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_1", "rna_ParticleVGroup_name_len_1", "rna_ParticleVGroup_name_set_1");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_1", "rna_ParticleVGroup_name_len_1",
+ "rna_ParticleVGroup_name_set_1");
RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
@@ -2762,7 +2822,8 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "vertex_group_length", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_2", "rna_ParticleVGroup_name_len_2", "rna_ParticleVGroup_name_set_2");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_2", "rna_ParticleVGroup_name_len_2",
+ "rna_ParticleVGroup_name_set_2");
RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
@@ -2772,7 +2833,8 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_redo");
prop = RNA_def_property(srna, "vertex_group_clump", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_3", "rna_ParticleVGroup_name_len_3", "rna_ParticleVGroup_name_set_3");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_3", "rna_ParticleVGroup_name_len_3",
+ "rna_ParticleVGroup_name_set_3");
RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
@@ -2782,7 +2844,8 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
prop = RNA_def_property(srna, "vertex_group_kink", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_4", "rna_ParticleVGroup_name_len_4", "rna_ParticleVGroup_name_set_4");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_4", "rna_ParticleVGroup_name_len_4",
+ "rna_ParticleVGroup_name_set_4");
RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
@@ -2792,37 +2855,44 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
prop = RNA_def_property(srna, "vertex_group_roughness_1", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_5", "rna_ParticleVGroup_name_len_5", "rna_ParticleVGroup_name_set_5");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_5", "rna_ParticleVGroup_name_len_5",
+ "rna_ParticleVGroup_name_set_5");
RNA_def_property_ui_text(prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
prop = RNA_def_property(srna, "invert_vertex_group_roughness_1", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH1));
- RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate", "Negate the effect of the roughness 1 vertex group");
+ RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate",
+ "Negate the effect of the roughness 1 vertex group");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
prop = RNA_def_property(srna, "vertex_group_roughness_2", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_6", "rna_ParticleVGroup_name_len_6", "rna_ParticleVGroup_name_set_6");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_6", "rna_ParticleVGroup_name_len_6",
+ "rna_ParticleVGroup_name_set_6");
RNA_def_property_ui_text(prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
prop = RNA_def_property(srna, "invert_vertex_group_roughness_2", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH2));
- RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate", "Negate the effect of the roughness 2 vertex group");
+ RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate",
+ "Negate the effect of the roughness 2 vertex group");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
prop = RNA_def_property(srna, "vertex_group_roughness_end", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_7", "rna_ParticleVGroup_name_len_7", "rna_ParticleVGroup_name_set_7");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_7", "rna_ParticleVGroup_name_len_7",
+ "rna_ParticleVGroup_name_set_7");
RNA_def_property_ui_text(prop, "Vertex Group Roughness End", "Vertex group to control roughness end");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
prop = RNA_def_property(srna, "invert_vertex_group_roughness_end", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGHE));
- RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate", "Negate the effect of the roughness end vertex group");
+ RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate",
+ "Negate the effect of the roughness end vertex group");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
prop = RNA_def_property(srna, "vertex_group_size", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_8", "rna_ParticleVGroup_name_len_8", "rna_ParticleVGroup_name_set_8");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_8", "rna_ParticleVGroup_name_len_8",
+ "rna_ParticleVGroup_name_set_8");
RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
@@ -2832,7 +2902,8 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "vertex_group_tangent", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_9", "rna_ParticleVGroup_name_len_9", "rna_ParticleVGroup_name_set_9");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_9", "rna_ParticleVGroup_name_len_9",
+ "rna_ParticleVGroup_name_set_9");
RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
@@ -2842,7 +2913,8 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "vertex_group_rotation", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_10", "rna_ParticleVGroup_name_len_10", "rna_ParticleVGroup_name_set_10");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_10", "rna_ParticleVGroup_name_len_10",
+ "rna_ParticleVGroup_name_set_10");
RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
@@ -2852,7 +2924,8 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "vertex_group_field", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_11", "rna_ParticleVGroup_name_len_11", "rna_ParticleVGroup_name_set_11");
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_11", "rna_ParticleVGroup_name_len_11",
+ "rna_ParticleVGroup_name_set_11");
RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
@@ -2877,7 +2950,8 @@ static void rna_def_particle_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "parent");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Parent", "Use this object's coordinate system instead of global coordinate system");
+ RNA_def_property_ui_text(prop, "Parent",
+ "Use this object's coordinate system instead of global coordinate system");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
/* hair or cache editing */
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index e1abcb052be..4b1090c2ae0 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -45,7 +45,8 @@
-/* XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable */
+/* XXX: this RNA enum define is currently duplicated for objects,
+ * since there is some text here which is not applicable */
EnumPropertyItem posebone_rotmode_items[] = {
{ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock (default)"},
{ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order (prone to Gimbal Lock)"},
@@ -125,16 +126,13 @@ static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value)
memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
}
else {
- /* init custom colors with a generic multi-color rgb set, if not initialised already (for custom color set) */
+ /* init custom colors with a generic multi-color rgb set, if not initialized already
+ * (for custom color set) */
if (grp->cs.solid[0] == 0) {
/* define for setting colors in theme below */
- #define SETCOL(col, r, g, b, a) col[0] = r; col[1] = g; col[2] = b; col[3] = a;
-
- SETCOL(grp->cs.solid, 0xff, 0x00, 0x00, 255);
- SETCOL(grp->cs.select, 0x81, 0xe6, 0x14, 255);
- SETCOL(grp->cs.active, 0x18, 0xb6, 0xe0, 255);
-
- #undef SETCOL
+ rgba_char_args_set(grp->cs.solid, 0xff, 0x00, 0x00, 255);
+ rgba_char_args_set(grp->cs.select, 0x81, 0xe6, 0x14, 255);
+ rgba_char_args_set(grp->cs.active, 0x18, 0xb6, 0xe0, 255);
}
}
}
@@ -221,7 +219,8 @@ static void rna_PoseChannel_rotation_mode_set(PointerRNA *ptr, int value)
bPoseChannel *pchan = ptr->data;
/* use API Method for conversions... */
- BKE_rotMode_change_values(pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, (short)value);
+ BKE_rotMode_change_values(pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle,
+ pchan->rotmode, (short)value);
/* finally, set the new rotation type */
pchan->rotmode = value;
@@ -678,7 +677,8 @@ static void rna_def_bone_group(BlenderRNA *brna)
prop = RNA_def_property(srna, "colors", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
- RNA_def_property_pointer_sdna(prop, NULL, "cs"); /* NOTE: the DNA data is not really a pointer, but this code works :) */
+ /* NOTE: the DNA data is not really a pointer, but this code works :) */
+ RNA_def_property_pointer_sdna(prop, NULL, "cs");
RNA_def_property_ui_text(prop, "Colors", "Copy of the colors associated with the group's color set");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
}
@@ -790,7 +790,8 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "loc");
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable");
RNA_def_property_ui_text(prop, "Location", "");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
@@ -798,7 +799,8 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable");
RNA_def_property_float_array_default(prop, default_scale);
RNA_def_property_ui_text(prop, "Scale", "");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
@@ -806,7 +808,8 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
RNA_def_property_float_array_default(prop, default_quat);
RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
/* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
@@ -819,13 +822,15 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
RNA_def_property_float_array_default(prop, default_axisAngle);
RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
RNA_def_property_float_sdna(prop, NULL, "eul");
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
@@ -833,7 +838,8 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "rotmode");
RNA_def_property_enum_items(prop, posebone_rotmode_items); /* XXX move to using a single define of this someday */
RNA_def_property_enum_funcs(prop, NULL, "rna_PoseChannel_rotation_mode_set", NULL);
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_ui_text(prop, "Rotation Mode", "");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
@@ -858,7 +864,8 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "pose_mat");
RNA_def_property_multi_array(prop, 2, matrix_dimsize);
RNA_def_property_float_funcs(prop, NULL, "rna_PoseChannel_matrix_set", NULL);
- RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix after constraints and drivers are applied (object space)");
+ RNA_def_property_ui_text(prop, "Pose Matrix",
+ "Final 4x4 matrix after constraints and drivers are applied (object space)");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
/* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
@@ -1025,7 +1032,8 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "custom_tx");
RNA_def_property_struct_type(prop, "PoseBone");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Custom Shape Transform", "Bone that defines the display transform of this custom shape");
+ RNA_def_property_ui_text(prop, "Custom Shape Transform",
+ "Bone that defines the display transform of this custom shape");
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
@@ -1043,7 +1051,8 @@ static void rna_def_pose_channel(BlenderRNA *brna)
prop = RNA_def_property(srna, "bone_group", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "BoneGroup");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_bone_group_get", "rna_PoseChannel_bone_group_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_bone_group_get",
+ "rna_PoseChannel_bone_group_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Bone Group", "Bone Group this pose channel belongs to");
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
@@ -1065,7 +1074,8 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
- /* XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this! */
+ /* XXX this is sub-optimal - it really should be included above, but due to technical reasons
+ * we can't do this! */
prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)",
@@ -1099,12 +1109,14 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
{0, "ANIMATION", 0, "Animation",
"Stateless solver computing pose starting from current action and non-IK constraints"},
{ITASC_SIMULATION, "SIMULATION", 0, "Simulation",
- "Statefull solver running in real-time context and ignoring actions and non-IK constraints"},
+ "Statefull solver running in real-time context and ignoring actions "
+ "and non-IK constraints"},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem prop_itasc_reiteration_items[] = {
{0, "NEVER", 0, "Never", "The solver does not reiterate, not even on first frame (starts from rest pose)"},
{ITASC_INITIAL_REITERATION, "INITIAL", 0, "Initial",
- "The solver reiterates (converges) on the first frame but not on subsequent frame"},
+ "The solver reiterates (converges) on the first frame but not on "
+ "subsequent frame"},
{ITASC_INITIAL_REITERATION|ITASC_REITERATION, "ALWAYS", 0, "Always",
"The solver reiterates (converges) on all frames"},
{0, NULL, 0, NULL, NULL}};
@@ -1125,7 +1137,8 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "numiter");
RNA_def_property_range(prop, 1.f,1000.f);
- RNA_def_property_ui_text(prop, "Iterations", "Maximum number of iterations for convergence in case of reiteration");
+ RNA_def_property_ui_text(prop, "Iterations",
+ "Maximum number of iterations for convergence in case of reiteration");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
prop = RNA_def_property(srna, "step_count", PROP_INT, PROP_NONE);
@@ -1151,7 +1164,8 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ITASC_AUTO_STEP);
RNA_def_property_ui_text(prop, "Auto step",
- "Automatically determine the optimal number of steps for best performance/accuracy trade off");
+ "Automatically determine the optimal number of steps for best "
+ "performance/accuracy trade off");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
prop = RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_NONE);
@@ -1170,7 +1184,8 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "feedback");
RNA_def_property_range(prop, 0.0f,100.0f);
RNA_def_property_ui_text(prop, "Feedback",
- "Feedback coefficient for error correction, average response time is 1/feedback (default=20)");
+ "Feedback coefficient for error correction, average response time is 1/feedback "
+ "(default=20)");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
@@ -1216,7 +1231,8 @@ static void rna_def_pose_ikparam(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "iksolver");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, prop_iksolver_items);
- RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined, 0 for Legacy, 1 for iTaSC");
+ RNA_def_property_ui_text(prop, "IK Solver",
+ "IK solver for which these parameters are defined, 0 for Legacy, 1 for iTaSC");
}
/* pose.bone_groups */
@@ -1236,7 +1252,8 @@ static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "BoneGroup");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get",
+ "rna_Pose_active_bone_group_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
@@ -1263,7 +1280,9 @@ static void rna_def_pose(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL);
RNA_def_property_struct_type(prop, "PoseBone");
RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature");
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string", NULL); /* can be removed, only for fast lookup */
+ /* can be removed, only for fast lookup */
+ RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string", NULL);
+
/* bone groups */
prop = RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL);
diff --git a/source/blender/makesrna/intern/rna_pose_api.c b/source/blender/makesrna/intern/rna_pose_api.c
index 2720b992874..14f7b7c74f5 100644
--- a/source/blender/makesrna/intern/rna_pose_api.c
+++ b/source/blender/makesrna/intern/rna_pose_api.c
@@ -1,11 +1,11 @@
/*
- *
+ *
* ***** 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.
+ * 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
@@ -19,7 +19,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
@@ -53,7 +53,8 @@ static float rna_PoseBone_do_envelope(bPoseChannel *chan, float *vec)
float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
- return distfactor_to_bone(vec, chan->pose_head, chan->pose_tail, bone->rad_head * scale, bone->rad_tail * scale, bone->dist * scale);
+ return distfactor_to_bone(vec, chan->pose_head, chan->pose_tail, bone->rad_head * scale,
+ bone->rad_tail * scale, bone->dist * scale);
}
#else
diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c
index fd6c45c2828..3eac129a195 100644
--- a/source/blender/makesrna/intern/rna_property.c
+++ b/source/blender/makesrna/intern/rna_property.c
@@ -52,7 +52,7 @@ static StructRNA* rna_GameProperty_refine(struct PointerRNA *ptr)
{
bProperty *property = (bProperty*)ptr->data;
- switch (property->type){
+ switch (property->type) {
case GPROP_BOOL:
return &RNA_GameBooleanProperty;
case GPROP_INT:
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index 30cb80ef617..22e9bbf6dda 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -143,7 +143,8 @@ static void rna_RenderEngine_unregister(Main *UNUSED(bmain), StructRNA *type)
RNA_struct_free(&BLENDER_RNA, type);
}
-static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, void *data, const char *identifier,
+ StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
RenderEngineType *et, dummyet = {NULL};
RenderEngine dummyengine = {NULL};
@@ -160,7 +161,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo
if (strlen(identifier) >= sizeof(dummyet.idname)) {
BKE_reportf(reports, RPT_ERROR, "registering render engine class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummyet.idname));
+ identifier, (int)sizeof(dummyet.idname));
return NULL;
}
@@ -177,7 +178,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo
et = MEM_callocN(sizeof(RenderEngineType), "python render engine");
memcpy(et, &dummyet, sizeof(dummyet));
- et->ext.srna = RNA_def_struct(&BLENDER_RNA, et->idname, "RenderEngine");
+ et->ext.srna = RNA_def_struct(&BLENDER_RNA, et->idname, "RenderEngine");
et->ext.data = data;
et->ext.call = call;
et->ext.free = free;
@@ -273,7 +274,8 @@ static void rna_def_render_engine(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "RenderEngine");
RNA_def_struct_ui_text(srna, "Render Engine", "Render engine");
RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine");
- RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister", "rna_RenderEngine_instance");
+ RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister",
+ "rna_RenderEngine_instance");
/* final render callbacks */
func = RNA_def_function(srna, "update", NULL);
@@ -392,7 +394,8 @@ static void rna_def_render_result(BlenderRNA *brna)
RNA_def_function_ui_description(func, "Copies the pixels of this render result from an image file");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm = RNA_def_string_file_name(func, "filename", "", FILE_MAX, "File Name",
- "Filename to load into this render tile, must be no smaller than the render result");
+ "Filename to load into this render tile, must be no smaller than "
+ "the render result");
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_define_verify_sdna(0);
@@ -407,7 +410,9 @@ static void rna_def_render_result(BlenderRNA *brna)
parm = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(parm, "RenderLayer");
- RNA_def_property_collection_funcs(parm, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(parm, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
RNA_define_verify_sdna(1);
}
@@ -438,7 +443,9 @@ static void rna_def_render_layer(BlenderRNA *brna)
prop = RNA_def_property(srna, "passes", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "RenderPass");
- RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
prop = RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
@@ -524,4 +531,3 @@ void RNA_def_render(BlenderRNA *brna)
}
#endif /* RNA_RUNTIME */
-
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 153e9288375..e9f35debe72 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -129,6 +129,16 @@ static int rna_Struct_name_length(PointerRNA *ptr)
return strlen(((StructRNA*)ptr->data)->name);
}
+static void rna_Struct_translation_context_get(PointerRNA *ptr, char *value)
+{
+ strcpy(value, ((StructRNA*)ptr->data)->translation_context ? ((StructRNA*)ptr->data)->translation_context : "");
+}
+
+static int rna_Struct_translation_context_length(PointerRNA *ptr)
+{
+ return ((StructRNA*)ptr->data)->translation_context ? strlen(((StructRNA*)ptr->data)->translation_context) : 0;
+}
+
static PointerRNA rna_Struct_base_get(PointerRNA *ptr)
{
return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((StructRNA*)ptr->data)->base);
@@ -204,7 +214,8 @@ static void rna_inheritance_next_level_restart(CollectionPropertyIterator *iter,
}
}
-static void rna_inheritance_properties_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
+static void rna_inheritance_properties_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb,
+ IteratorSkipFunc skip)
{
rna_iterator_listbase_begin(iter, lb, skip);
rna_inheritance_next_level_restart(iter, skip, 0);
@@ -216,7 +227,8 @@ static void rna_inheritance_properties_listbase_next(CollectionPropertyIterator
rna_inheritance_next_level_restart(iter, skip, 0);
}
-static void rna_inheritance_functions_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
+static void rna_inheritance_functions_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb,
+ IteratorSkipFunc skip)
{
rna_iterator_listbase_begin(iter, lb, skip);
rna_inheritance_next_level_restart(iter, skip, 1);
@@ -511,7 +523,7 @@ static int rna_Property_readonly_get(PointerRNA *ptr)
{
PropertyRNA *prop = (PropertyRNA*)ptr->data;
- /* dont use this becaure it will call functions that check the internal
+ /* don't use this becaure it will call functions that check the internal
* data for introspection we only need to know if it can be edited so the
* flag is better for this */
/* return RNA_property_editable(ptr, prop); */
@@ -760,7 +772,8 @@ static int rna_StringProperty_max_length_get(PointerRNA *ptr)
return ((StringPropertyRNA*)prop)->maxlength;
}
-static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop_parent, int *free)
+static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr,
+ PropertyRNA *prop_parent, int *free)
{
PropertyRNA *prop = (PropertyRNA*)ptr->data;
EnumPropertyRNA *eprop;
@@ -982,6 +995,12 @@ static void rna_def_struct(BlenderRNA *brna)
RNA_def_property_string_funcs(prop, "rna_Struct_description_get", "rna_Struct_description_length", NULL);
RNA_def_property_ui_text(prop, "Description", "Description of the Struct's purpose");
+ prop = RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_Struct_translation_context_get",
+ "rna_Struct_translation_context_length", NULL);
+ RNA_def_property_ui_text(prop, "Translation Context", "Translation context of the struct's name");
+
prop = RNA_def_property(srna, "base", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Struct");
@@ -992,7 +1011,8 @@ static void rna_def_struct(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Struct");
RNA_def_property_pointer_funcs(prop, "rna_Struct_nested_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Nested", "Struct in which this struct is always nested, and to which it logically belongs");
+ RNA_def_property_ui_text(prop, "Nested",
+ "Struct in which this struct is always nested, and to which it logically belongs");
prop = RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1003,13 +1023,17 @@ static void rna_def_struct(BlenderRNA *brna)
prop = RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Property");
- RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next", "rna_iterator_listbase_end", "rna_Struct_properties_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next",
+ "rna_iterator_listbase_end", "rna_Struct_properties_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Properties", "Properties in the struct");
prop = RNA_def_property(srna, "functions", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Function");
- RNA_def_property_collection_funcs(prop, "rna_Struct_functions_begin", "rna_Struct_functions_next", "rna_iterator_listbase_end", "rna_Struct_functions_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_Struct_functions_begin", "rna_Struct_functions_next",
+ "rna_iterator_listbase_end", "rna_Struct_functions_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Functions", "");
}
@@ -1063,8 +1087,9 @@ static void rna_def_property(BlenderRNA *brna)
prop = RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Property_translation_context_get", "rna_Property_translation_context_length", NULL);
- RNA_def_property_ui_text(prop, "Translation Context", "Translation context of the property");
+ RNA_def_property_string_funcs(prop, "rna_Property_translation_context_get",
+ "rna_Property_translation_context_length", NULL);
+ RNA_def_property_ui_text(prop, "Translation Context", "Translation context of the property's name");
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1133,7 +1158,8 @@ static void rna_def_property(BlenderRNA *brna)
prop = RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_registered_optional_get", NULL);
- RNA_def_property_ui_text(prop, "Registered Optionally", "Property is optionally registered as part of type registration");
+ RNA_def_property_ui_text(prop, "Registered Optionally",
+ "Property is optionally registered as part of type registration");
prop = RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1169,7 +1195,9 @@ static void rna_def_function(BlenderRNA *brna)
prop = RNA_def_property(srna, "parameters", PROP_COLLECTION, PROP_NONE);
/*RNA_def_property_clear_flag(prop, PROP_EDITABLE);*/
RNA_def_property_struct_type(prop, "Property");
- RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Parameters", "Parameters for the function");
prop = RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
@@ -1180,12 +1208,14 @@ static void rna_def_function(BlenderRNA *brna)
prop = RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Function_registered_optional_get", NULL);
- RNA_def_property_ui_text(prop, "Registered Optionally", "Function is optionally registered as callback part of type registration");
+ RNA_def_property_ui_text(prop, "Registered Optionally",
+ "Function is optionally registered as callback part of type registration");
prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Function_no_self_get", NULL);
- RNA_def_property_ui_text(prop, "No Self", "Function does not pass its self as an argument (becomes a class method in python)");
+ RNA_def_property_ui_text(prop, "No Self",
+ "Function does not pass its self as an argument (becomes a class method in python)");
}
static void rna_def_number_property(StructRNA *srna, PropertyType type)
@@ -1320,7 +1350,8 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
prop = RNA_def_property(srna, "enum_items", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "EnumPropertyItem");
- RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Items", "Possible values for the property");
srna = RNA_def_struct(brna, "EnumPropertyItem", NULL);
@@ -1334,12 +1365,14 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_description_get", "rna_EnumPropertyItem_description_length", NULL);
+ RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_description_get",
+ "rna_EnumPropertyItem_description_length", NULL);
RNA_def_property_ui_text(prop, "Description", "Description of the item's purpose");
prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_identifier_get", "rna_EnumPropertyItem_identifier_length", NULL);
+ RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_identifier_get",
+ "rna_EnumPropertyItem_identifier_length", NULL);
RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
RNA_def_struct_name_property(srna, prop);
@@ -1396,7 +1429,8 @@ void RNA_def_rna(BlenderRNA *brna)
/* EnumProperty */
srna = RNA_def_struct(brna, "EnumProperty", "Property");
- RNA_def_struct_ui_text(srna, "Enum Definition", "RNA enumeration property definition, to choose from a number of predefined options");
+ RNA_def_struct_ui_text(srna, "Enum Definition",
+ "RNA enumeration property definition, to choose from a number of predefined options");
rna_def_enum_property(brna, srna);
/* PointerProperty */
@@ -1406,7 +1440,8 @@ void RNA_def_rna(BlenderRNA *brna)
/* CollectionProperty */
srna = RNA_def_struct(brna, "CollectionProperty", "Property");
- RNA_def_struct_ui_text(srna, "Collection Definition", "RNA collection property to define lists, arrays and mappings");
+ RNA_def_struct_ui_text(srna, "Collection Definition",
+ "RNA collection property to define lists, arrays and mappings");
rna_def_pointer_property(srna, PROP_COLLECTION);
/* Function */
@@ -1420,16 +1455,17 @@ void RNA_def_rna(BlenderRNA *brna)
prop = RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Struct");
- RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
/* included for speed, can be removed */
#if 0
- 0,0,0,0);
+ NULL, NULL, NULL, NULL);
#else
- "rna_BlenderRNA_structs_length", "rna_BlenderRNA_structs_lookup_int", "rna_BlenderRNA_structs_lookup_string", NULL);
+ "rna_BlenderRNA_structs_length", "rna_BlenderRNA_structs_lookup_int",
+ "rna_BlenderRNA_structs_lookup_string", NULL);
#endif
RNA_def_property_ui_text(prop, "Structs", "");
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index d3bab1a3a0b..40987d13593 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -55,7 +55,7 @@
#ifdef WITH_FFMPEG
#include "BKE_writeffmpeg.h"
-#include <libavcodec/avcodec.h>
+#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#endif
@@ -99,7 +99,8 @@ EnumPropertyItem proportional_falloff_items[] = {
EnumPropertyItem proportional_editing_items[] = {
{PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
{PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"},
- {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected", "Proportional Editing using connected geometry only"},
+ {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected",
+ "Proportional Editing using connected geometry only"},
{0, NULL, 0, NULL, NULL}};
/* keep for operators, not used here */
@@ -123,11 +124,13 @@ EnumPropertyItem snap_element_items[] = {
*/
#define R_IMF_ENUM_BMP {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
-#define R_IMF_ENUM_IRIS {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"},
+#define R_IMF_ENUM_IRIS {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", \
+ "Output image in (old!) SGI IRIS format"},
#define R_IMF_ENUM_PNG {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
#define R_IMF_ENUM_JPEG {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
#define R_IMF_ENUM_TAGA {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
-#define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"},
+#define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", \
+ "Output image in uncompressed Targa format"},
#ifdef WITH_DDS
@@ -137,13 +140,15 @@ EnumPropertyItem snap_element_items[] = {
#endif
#ifdef WITH_OPENJPEG
-# define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"},
+# define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", \
+ "Output image in JPEG 2000 format"},
#else
# define R_IMF_ENUM_JPEG2K
#endif
#ifdef WITH_CINEON
-# define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"},
+# define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", \
+ "Output image in Cineon format"},
# define R_IMF_ENUM_DPX {R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
#else
# define R_IMF_ENUM_CINEON
@@ -151,15 +156,19 @@ EnumPropertyItem snap_element_items[] = {
#endif
#ifdef WITH_OPENEXR
-# define R_IMF_ENUM_EXR_MULTI {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, "OpenEXR MultiLayer", "Output image in multilayer OpenEXR format"},
-# define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"},
+# define R_IMF_ENUM_EXR_MULTI {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \
+ "OpenEXR MultiLayer", \
+ "Output image in multilayer OpenEXR format"},
+# define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", \
+ "Output image in OpenEXR format"},
#else
# define R_IMF_ENUM_EXR_MULTI
# define R_IMF_ENUM_EXR
#endif
#ifdef WITH_HDR
-# define R_IMF_ENUM_HDR {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"},
+# define R_IMF_ENUM_HDR {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", \
+ "Output image in Radiance HDR format"},
#else
# define R_IMF_ENUM_HDR
#endif
@@ -193,7 +202,7 @@ EnumPropertyItem image_only_type_items[] = {
IMAGE_TYPE_ITEMS_IMAGE_ONLY
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}};
EnumPropertyItem image_type_items[] = {
{0, "", 0, "Image", NULL},
@@ -202,7 +211,8 @@ EnumPropertyItem image_type_items[] = {
{0, "", 0, "Movie", NULL},
#ifdef _WIN32
- {R_IMF_IMTYPE_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", "Output video in AVI format"}, /* XXX Missing codec menu */
+ /* XXX Missing codec menu */
+ {R_IMF_IMTYPE_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", "Output video in AVI format"},
#endif
{R_IMF_IMTYPE_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"},
{R_IMF_IMTYPE_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
@@ -331,7 +341,7 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report
/* this is similar to what object_add_type and add_object do */
base->lay = scene->lay;
- /* when linking to an inactive scene dont touch the layer */
+ /* when linking to an inactive scene don't touch the layer */
if (scene == scene_act)
ob->lay = base->lay;
@@ -480,7 +490,7 @@ static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
data->r.sfra = value;
if (data->r.sfra >= data->r.efra) {
- data->r.efra = MIN2(data->r.sfra + 1, MAXFRAME);
+ data->r.efra = MIN2(data->r.sfra, MAXFRAME);
}
}
@@ -491,7 +501,7 @@ static void rna_Scene_end_frame_set(PointerRNA *ptr, int value)
data->r.efra = value;
if (data->r.sfra >= data->r.efra) {
- data->r.sfra = MAX2(data->r.efra - 1, MINFRAME);
+ data->r.sfra = MAX2(data->r.efra, MINFRAME);
}
}
@@ -537,7 +547,7 @@ static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
if ((data->r.flag & SCER_PRV_RANGE) == 0) {
/* set start of preview range to start frame, then clamp as per normal */
/* TODO: or just refuse to set instead? */
- data->r.psfra = data->r.sfra;
+ data->r.psfra = data->r.sfra;
}
/* now set normally */
@@ -567,21 +577,21 @@ static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value)
/* get KeyingSet index stuff for list of Keying Sets editing UI
* - active_keyingset-1 since 0 is reserved for 'none'
- * - don't clamp, otherwise can never set builtins types as active...
+ * - don't clamp, otherwise can never set builtins types as active...
*/
static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->data;
+ Scene *scene = (Scene *)ptr->data;
return scene->active_keyingset-1;
}
/* get KeyingSet index stuff for list of Keying Sets editing UI
* - value+1 since 0 is reserved for 'none'
*/
-static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
+static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
{
- Scene *scene = (Scene *)ptr->data;
- scene->active_keyingset = value+1;
+ Scene *scene = (Scene *)ptr->data;
+ scene->active_keyingset = value+1;
}
/* XXX: evil... builtin_keyingsets is defined in keyingsets.c! */
@@ -592,7 +602,7 @@ static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, Poi
{
Scene *scene = (Scene*)ptr->data;
- /* start going over the scene KeyingSets first, while we still have pointer to it
+ /* start going over the scene KeyingSets first, while we still have pointer to it
* but only if we have any Keying Sets to use...
*/
if (scene->keyingsets.first)
@@ -868,7 +878,7 @@ static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bCon
tmp.value = codecTypeDesc->rnatmpvalue;
*((int*)id) = codecTypeDesc->codecType;
id[4] = 0;
- tmp.identifier = id;
+ tmp.identifier = id;
tmp.name = codecTypeDesc->codecName;
RNA_enum_item_add(&item, &totitem, &tmp);
}
@@ -876,7 +886,7 @@ static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bCon
RNA_enum_item_end(&item, &totitem);
*free = 1;
- return item;
+ return item;
}
#ifdef USE_QTKIT
@@ -907,7 +917,7 @@ static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf
if (!codecTypeDesc) break;
tmp.value = codecTypeDesc->rnatmpvalue;
- tmp.identifier = codecTypeDesc->codecName;
+ tmp.identifier = codecTypeDesc->codecName;
tmp.name = codecTypeDesc->codecName;
RNA_enum_item_add(&item, &totitem, &tmp);
}
@@ -915,7 +925,7 @@ static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf
RNA_enum_item_end(&item, &totitem);
*free = 1;
- return item;
+ return item;
}
#endif
#endif
@@ -990,12 +1000,14 @@ static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), con
return srl;
}
-static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports, SceneRenderLayer *srl)
+static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports,
+ SceneRenderLayer *srl)
{
Scene *scene = (Scene *)id;
if (!scene_remove_render_layer(bmain, scene, srl)) {
- BKE_reportf(reports, RPT_ERROR, "RenderLayer '%s' could not be removed from scene '%s'", srl->name, scene->id.name+2);
+ BKE_reportf(reports, RPT_ERROR, "RenderLayer '%s' could not be removed from scene '%s'",
+ srl->name, scene->id.name+2);
}
else {
WM_main_add_notifier(NC_SCENE|ND_RENDER_OPTIONS, NULL);
@@ -1161,7 +1173,7 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value
{
Scene *scene = (Scene*)ptr->id.data;
ToolSettings *ts = (ToolSettings*)ptr->data;
- int flag = (value[0] ? SCE_SELECT_VERTEX:0) | (value[1] ? SCE_SELECT_EDGE:0) | (value[2] ? SCE_SELECT_FACE:0);
+ int flag = (value[0] ? SCE_SELECT_VERTEX:0) | (value[1] ? SCE_SELECT_EDGE:0) | (value[2] ? SCE_SELECT_FACE : 0);
if (flag) {
ts->selectmode = flag;
@@ -1467,8 +1479,8 @@ static void rna_def_tool_settings(BlenderRNA *brna)
{UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
{0, NULL, 0, NULL, NULL}};
- /* the construction of this enum is quite special - everything is stored as bitflags,
- * with 1st position only for for on/off (and exposed as boolean), while others are mutually
+ /* the construction of this enum is quite special - everything is stored as bitflags,
+ * with 1st position only for for on/off (and exposed as boolean), while others are mutually
* exclusive options but which will only have any effect when autokey is enabled
*/
static EnumPropertyItem auto_key_items[] = {
@@ -1646,7 +1658,8 @@ static void rna_def_tool_settings(BlenderRNA *brna)
/* Grease Pencil */
prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON);
- RNA_def_property_ui_text(prop, "Use Sketching Sessions", "Allow drawing multiple strokes at a time with Grease Pencil");
+ RNA_def_property_ui_text(prop, "Use Sketching Sessions",
+ "Allow drawing multiple strokes at a time with Grease Pencil");
RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* xxx: need toolbar to be redrawn... */
/* Auto Keying */
@@ -1835,7 +1848,9 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_LOCK_SIZE);
- RNA_def_property_ui_text(prop, "Use Blender Units", "When locked brush stays same size relative to object; when unlocked brush size is given in pixels");
+ RNA_def_property_ui_text(prop, "Use Blender Units",
+ "When locked brush stays same size relative to object; "
+ "when unlocked brush size is given in pixels");
}
static void rna_def_unit_settings(BlenderRNA *brna)
@@ -1896,7 +1911,8 @@ void rna_def_render_layer_common(StructRNA *srna, int scene)
RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Material Override", "Material to override all other materials in this render layer");
+ RNA_def_property_ui_text(prop, "Material Override",
+ "Material to override all other materials in this render layer");
if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1940,7 +1956,8 @@ void rna_def_render_layer_common(StructRNA *srna, int scene)
prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK);
- RNA_def_property_ui_text(prop, "Zmask Negate", "For Zmask, only render what is behind solid z values instead of in front");
+ RNA_def_property_ui_text(prop, "Zmask Negate",
+ "For Zmask, only render what is behind solid z values instead of in front");
if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -2687,7 +2704,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
{SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox",
"Show the entire viewport in the display window, using bar horizontally or vertically"},
{SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend",
- "Show the entire viewport in the display window, viewing more horizontally or vertically"},
+ "Show the entire viewport in the display window, viewing more horizontally "
+ "or vertically"},
{SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"},
{0, NULL, 0, NULL, NULL}};
@@ -2870,7 +2888,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "gravity");
RNA_def_property_ui_range(prop, 0.0, 25.0, 1, 2);
RNA_def_property_range(prop, 0.0, 10000.0);
- RNA_def_property_ui_text(prop, "Physics Gravity", "Gravitational constant used for physics simulation in the game engine");
+ RNA_def_property_ui_text(prop, "Physics Gravity",
+ "Gravitational constant used for physics simulation in the game engine");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop = RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_NONE);
@@ -2919,7 +2938,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
/* mode */
prop = RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 5)); /*XXX mode hardcoded *//* WO_DBVT_CULLING */
- RNA_def_property_ui_text(prop, "DBVT culling", "Use optimized Bullet DBVT tree for view frustum and occlusion culling");
+ RNA_def_property_ui_text(prop, "DBVT culling",
+ "Use optimized Bullet DBVT tree for view frustum and occlusion culling");
/* not used *//* deprecated !!!!!!!!!!!!! */
prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
@@ -2937,7 +2957,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
/* booleans */
prop = RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_DEBUG_PROPS);
- RNA_def_property_ui_text(prop, "Show Debug Properties", "Show properties marked for debugging while the game runs");
+ RNA_def_property_ui_text(prop, "Show Debug Properties",
+ "Show properties marked for debugging while the game runs");
prop = RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE);
@@ -2946,7 +2967,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS);
- RNA_def_property_ui_text(prop, "Show Physics Visualization", "Show a visualization of physics bounds and interactions");
+ RNA_def_property_ui_text(prop, "Show Physics Visualization",
+ "Show a visualization of physics bounds and interactions");
prop = RNA_def_property(srna, "show_mouse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_MOUSE);
@@ -2954,15 +2976,18 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_frame_rate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_ENABLE_ALL_FRAMES);
- RNA_def_property_ui_text(prop, "Use Frame Rate", "Respect the frame rate rather than rendering as many frames as possible");
+ RNA_def_property_ui_text(prop, "Use Frame Rate",
+ "Respect the frame rate rather than rendering as many frames as possible");
prop = RNA_def_property(srna, "use_display_lists", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_DISPLAY_LISTS);
- RNA_def_property_ui_text(prop, "Display Lists", "Use display lists to speed up rendering by keeping geometry on the GPU");
+ RNA_def_property_ui_text(prop, "Display Lists",
+ "Use display lists to speed up rendering by keeping geometry on the GPU");
prop = RNA_def_property(srna, "use_deprecation_warnings", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_IGNORE_DEPRECATION_WARNINGS);
- RNA_def_property_ui_text(prop, "Deprecation Warnings", "Print warnings when using deprecated features in the python API");
+ RNA_def_property_ui_text(prop, "Deprecation Warnings",
+ "Print warnings when using deprecated features in the python API");
prop = RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD);
@@ -3017,7 +3042,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_glsl_extra_textures", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_EXTRA_TEX);
- RNA_def_property_ui_text(prop, "GLSL Extra Textures", "Use extra textures like normal or specular maps for GLSL rendering");
+ RNA_def_property_ui_text(prop, "GLSL Extra Textures",
+ "Use extra textures like normal or specular maps for GLSL rendering");
RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update");
/* obstacle simulation */
@@ -3030,7 +3056,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "level_height", PROP_FLOAT, PROP_ACCELERATION);
RNA_def_property_float_sdna(prop, NULL, "levelHeight");
RNA_def_property_range(prop, 0.0f, 200.0f);
- RNA_def_property_ui_text(prop, "Level height", "Max difference in heights of obstacles to enable their interaction");
+ RNA_def_property_ui_text(prop, "Level height",
+ "Max difference in heights of obstacles to enable their interaction");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop = RNA_def_property(srna, "show_obstacle_simulation", PROP_BOOLEAN, PROP_NONE);
@@ -3086,7 +3113,8 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop)
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "actlay");
- RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set",
+ RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get",
+ "rna_RenderSettings_active_layer_index_set",
"rna_RenderSettings_active_layer_index_range");
RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
@@ -3143,7 +3171,8 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "imtype");
RNA_def_property_enum_items(prop, image_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_ImageFormatSettings_file_format_set", "rna_ImageFormatSettings_file_format_itemf");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_ImageFormatSettings_file_format_set",
+ "rna_ImageFormatSettings_file_format_itemf");
RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
@@ -3188,7 +3217,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Preview", "When rendering animations, save JPG preview images in same directory");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- /* format spesific */
+ /* format specific */
#ifdef WITH_OPENEXR
/* OpenEXR */
@@ -3673,14 +3702,16 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "xasp");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 1.0f, 200.0f);
- RNA_def_property_ui_text(prop, "Pixel Aspect X", "Horizontal aspect ratio - for anamorphic or non-square pixel output");
+ RNA_def_property_ui_text(prop, "Pixel Aspect X",
+ "Horizontal aspect ratio - for anamorphic or non-square pixel output");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
prop = RNA_def_property(srna, "pixel_aspect_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "yasp");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 1.0f, 200.0f);
- RNA_def_property_ui_text(prop, "Pixel Aspect Y", "Vertical aspect ratio - for anamorphic or non-square pixel output");
+ RNA_def_property_ui_text(prop, "Pixel Aspect Y",
+ "Vertical aspect ratio - for anamorphic or non-square pixel output");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
#ifdef WITH_QUICKTIME
@@ -3780,7 +3811,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_OSA);
- RNA_def_property_ui_text(prop, "Anti-Aliasing", "Render and combine multiple samples per pixel to prevent jagged edges");
+ RNA_def_property_ui_text(prop, "Anti-Aliasing",
+ "Render and combine multiple samples per pixel to prevent jagged edges");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "antialiasing_samples", PROP_ENUM, PROP_NONE);
@@ -3830,7 +3862,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_raytrace", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_RAYTRACE);
- RNA_def_property_ui_text(prop, "Raytracing", "Pre-calculate the raytrace accelerator and render raytracing effects");
+ RNA_def_property_ui_text(prop, "Raytracing",
+ "Pre-calculate the raytrace accelerator and render raytracing effects");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE);
@@ -3866,7 +3899,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_range(prop, 1, BLENDER_MAX_THREADS);
RNA_def_property_int_funcs(prop, "rna_RenderSettings_threads_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Threads",
- "Number of CPU threads to use simultaneously while rendering (for multi-core/CPU systems)");
+ "Number of CPU threads to use simultaneously while rendering "
+ "(for multi-core/CPU systems)");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "threads_mode", PROP_ENUM, PROP_NONE);
@@ -3949,7 +3983,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_compositing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOCOMP);
RNA_def_property_ui_text(prop, "Compositing",
- "Process the render result through the compositing pipeline, if compositing nodes are enabled");
+ "Process the render result through the compositing pipeline, "
+ "if compositing nodes are enabled");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "use_sequencer", PROP_BOOLEAN, PROP_NONE);
@@ -3966,7 +4001,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_color_unpremultiply", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "color_mgt_flag", R_COLOR_MANAGEMENT_PREDIVIDE);
- RNA_def_property_ui_text(prop, "Color Unpremultipy", "For premultiplied alpha render output, do color space conversion on colors without alpha, to avoid fringing on light backgrounds");
+ RNA_def_property_ui_text(prop, "Color Unpremultiply",
+ "For premultiplied alpha render output, do color space conversion on "
+ "colors without alpha, to avoid fringing on light backgrounds");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE);
@@ -4078,12 +4115,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "bake_margin", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "bake_filter");
RNA_def_property_range(prop, 0, 64);
- RNA_def_property_ui_text(prop, "Margin", "Amount of pixels to extend the baked result with, as post process filter");
+ RNA_def_property_ui_text(prop, "Margin",
+ "Amount of pixels to extend the baked result with, as post process filter");
prop = RNA_def_property(srna, "bake_distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "bake_maxdist");
RNA_def_property_range(prop, 0.0, 1000.0);
- RNA_def_property_ui_text(prop, "Distance", "Maximum distance from active object to other object (in blender units)");
+ RNA_def_property_ui_text(prop, "Distance",
+ "Maximum distance from active object to other object (in blender units)");
prop = RNA_def_property(srna, "bake_bias", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "bake_biasdist");
@@ -4096,13 +4135,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_bake_lores_mesh", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_LORES_MESH);
- RNA_def_property_ui_text(prop, "Low Resolution Mesh", "Calculate heights against unsubdivided low resolution mesh");
+ RNA_def_property_ui_text(prop, "Low Resolution Mesh",
+ "Calculate heights against unsubdivided low resolution mesh");
/* stamp */
prop = RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_TIME);
- RNA_def_property_ui_text(prop, "Stamp Time", "Include the rendered frame timecode as HH:MM:SS.FF in image metadata");
+ RNA_def_property_ui_text(prop, "Stamp Time",
+ "Include the rendered frame timecode as HH:MM:SS.FF in image metadata");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "use_stamp_date", PROP_BOOLEAN, PROP_NONE);
@@ -4402,13 +4443,15 @@ static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop)
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyingSet");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get",
+ "rna_Scene_active_keying_set_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
- RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
+ RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get",
+ "rna_Scene_active_keying_set_index_set", NULL);
RNA_def_property_ui_text(prop, "Active Keying Set Index",
"Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
@@ -4429,13 +4472,15 @@ static void rna_def_scene_keying_sets_all(BlenderRNA *brna, PropertyRNA *cprop)
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyingSet");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get",
+ "rna_Scene_active_keying_set_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
- RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
+ RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get",
+ "rna_Scene_active_keying_set_index_set", NULL);
RNA_def_property_ui_text(prop, "Active Keying Set Index",
"Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
@@ -4523,7 +4568,8 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
RNA_def_property_struct_type(prop, "ObjectBase");
RNA_def_property_ui_text(prop, "Bases", "");
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_Scene_object_bases_lookup_string", NULL);
+ RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL,
+ "rna_Scene_object_bases_lookup_string", NULL);
rna_def_scene_bases(brna, prop);
prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
@@ -4535,11 +4581,12 @@ void RNA_def_scene(BlenderRNA *brna)
/* Layers */
prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* this seems to be too much trouble with depsgraph updates/etc. currently (20110420) */
+ /* this seems to be too much trouble with depsgraph updates/etc. currently (20110420) */
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
RNA_def_property_array(prop, 20);
RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_layer_set");
- RNA_def_property_ui_text(prop, "Layers", "Layers visible when rendering the scene");
+ RNA_def_property_ui_text(prop, "Layers", "Visible layers - Shift-Click to select multiple layers");
RNA_def_property_update(prop, NC_SCENE|ND_LAYER, "rna_Scene_layer_update");
/* active layer */
@@ -4554,7 +4601,8 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "r.cfra");
RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
RNA_def_property_int_funcs(prop, NULL, "rna_Scene_current_frame_set", NULL);
- RNA_def_property_ui_text(prop, "Current Frame", "Current Frame, to update animation data from python frame_set() instead");
+ RNA_def_property_ui_text(prop, "Current Frame",
+ "Current Frame, to update animation data from python frame_set() instead");
RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_frame_update");
prop = RNA_def_property(srna, "frame_subframe", PROP_FLOAT, PROP_TIME);
@@ -4583,16 +4631,18 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "r.frame_step");
RNA_def_property_range(prop, 0, MAXFRAME);
RNA_def_property_ui_range(prop, 1, 100, 1, 0);
- RNA_def_property_ui_text(prop, "Frame Step", "Number of frames to skip forward while rendering/playing back each frame");
+ RNA_def_property_ui_text(prop, "Frame Step",
+ "Number of frames to skip forward while rendering/playing back each frame");
RNA_def_property_update(prop, NC_SCENE|ND_FRAME, NULL);
/* Preview Range (frame-range for UI playback) */
- prop = RNA_def_property(srna, "use_preview_range", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_preview_range", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_PRV_RANGE);
RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_use_preview_range_set");
RNA_def_property_ui_text(prop, "Use Preview Range",
- "Use an alternative start/end frame for UI playback, rather than the scene start/end frame");
+ "Use an alternative start/end frame for UI playback, "
+ "rather than the scene start/end frame");
RNA_def_property_update(prop, NC_SCENE|ND_FRAME, NULL);
RNA_def_property_ui_icon(prop, ICON_PREVIEW_RANGE, 0);
@@ -4666,7 +4716,9 @@ void RNA_def_scene(BlenderRNA *brna)
rna_def_scene_keying_sets(brna, prop);
prop = RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "KeyingSet");
RNA_def_property_ui_text(prop, "All Keying Sets",
"All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)");
@@ -4809,4 +4861,3 @@ void RNA_def_scene(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 11659df3586..08ed7625a01 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Joshua Leung, Arystanbek Dyussenov
*
* ***** END GPL LICENSE BLOCK *****
@@ -59,7 +59,7 @@ static void rna_Scene_frame_set(Scene *scene, int frame, float subframe)
scene_update_for_newframe(G.main, scene, (1<<20) - 1);
scene_camera_switch_update(scene);
- /* cant use NC_SCENE|ND_FRAME because this casues wm_event_do_notifiers to call
+ /* cant use NC_SCENE|ND_FRAME because this casues wm_event_do_notifiers to call
* scene_update_for_newframe which will loose any un-keyed changes [#24690] */
/* WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); */
@@ -77,7 +77,8 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name
if (BKE_imtype_is_movie(rd->im_format.imtype))
BKE_makeanimstring(name, rd);
else
- BKE_makepicstring(name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, rd->im_format.imtype, rd->scemode & R_EXTENSION, TRUE);
+ BKE_makepicstring(name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, rd->im_format.imtype,
+ rd->scemode & R_EXTENSION, TRUE);
}
#ifdef WITH_COLLADA
@@ -105,7 +106,8 @@ void RNA_api_scene(StructRNA *srna)
RNA_def_float(func, "subframe", 0.0, 0.0, 1.0, "", "Sub-frame time, between 0.0 and 1.0", 0.0, 1.0);
func = RNA_def_function(srna, "update", "rna_Scene_update_tagged");
- RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators");
+ RNA_def_function_ui_description(func,
+ "Update data tagged to be updated from previous access to data or operators");
#ifdef WITH_COLLADA
/* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */
@@ -136,4 +138,3 @@ void RNA_api_scene_render(StructRNA *srna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index eea11aed803..c8aa5ebaaca 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -246,7 +246,8 @@ static void rna_def_sculpt(BlenderRNA *brna)
RNA_def_property_int_default(prop, 1);
RNA_def_property_range(prop, 1, 64);
RNA_def_property_ui_range(prop, 0, 32, 1, 1);
- RNA_def_property_ui_text(prop, "Radial Symmetry Count X Axis", "Number of times to copy strokes across the surface");
+ RNA_def_property_ui_text(prop, "Radial Symmetry Count X Axis",
+ "Number of times to copy strokes across the surface");
prop = RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X);
@@ -279,7 +280,8 @@ static void rna_def_sculpt(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP);
- RNA_def_property_ui_text(prop, "Use OpenMP", "Take advantage of multiple CPU cores to improve sculpting performance");
+ RNA_def_property_ui_text(prop, "Use OpenMP",
+ "Take advantage of multiple CPU cores to improve sculpting performance");
prop = RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_ONLY_DEFORM);
@@ -340,7 +342,8 @@ static void rna_def_image_paint(BlenderRNA *brna)
/* booleans */
prop = RNA_def_property(srna, "use_projection", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_DISABLE);
- RNA_def_property_ui_text(prop, "Project Paint", "Use projection painting for improved consistency in the brush strokes");
+ RNA_def_property_ui_text(prop, "Project Paint",
+ "Use projection painting for improved consistency in the brush strokes");
prop = RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY);
@@ -565,4 +568,3 @@ void RNA_def_sculpt_paint(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c
index aeb67cb0410..ff336ba6693 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c
@@ -146,7 +146,8 @@ EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRN
if (ptr->type == &RNA_Sensor || RNA_struct_is_a(ptr->type, &RNA_Sensor)) {
ob = (Object *)ptr->id.data;
- } else {
+ }
+ else {
/* can't use ob from ptr->id.data because that enum is also used by operators */
ob = CTX_data_active_object(C);
}
@@ -159,7 +160,7 @@ EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRN
RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ARMATURE);
}
}
- RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION);
RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_DELAY);
RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_JOYSTICK);
RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_KEYBOARD);
@@ -314,7 +315,9 @@ static void rna_def_sensor(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_level", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "level", 1);
- RNA_def_property_ui_text(prop, "Level", "Level detector, trigger controllers of new states(only applicable upon logic state transition)");
+ RNA_def_property_ui_text(prop, "Level",
+ "Level detector, trigger controllers of new states "
+ "(only applicable upon logic state transition)");
RNA_def_property_boolean_funcs(prop, NULL, "rna_Sensor_level_set");
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -337,14 +340,17 @@ static void rna_def_sensor(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_tap", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tap", 1);
RNA_def_property_boolean_funcs(prop, NULL, "rna_Sensor_tap_set");
- RNA_def_property_ui_text(prop, "Tap", "Trigger controllers only for an instant, even while the sensor remains true");
+ RNA_def_property_ui_text(prop, "Tap",
+ "Trigger controllers only for an instant, even while the sensor remains true");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
RNA_def_property_struct_type(prop, "Controller");
RNA_def_property_ui_text(prop, "Controllers", "The list containing the controllers connected to the sensor");
- RNA_def_property_collection_funcs(prop, "rna_Sensor_controllers_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", "rna_Sensor_controllers_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_Sensor_controllers_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_dereference_get",
+ "rna_Sensor_controllers_length", NULL, NULL, NULL);
RNA_api_sensor(srna);
@@ -583,18 +589,23 @@ static void rna_def_delay_sensor(BlenderRNA *brna)
RNA_def_struct_sdna_from(srna, "bDelaySensor", "data");
prop = RNA_def_property(srna, "delay", PROP_INT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Delay", "Delay in number of logic tics before the positive trigger (default 60 per second)");
+ RNA_def_property_ui_text(prop, "Delay",
+ "Delay in number of logic tics before the positive trigger (default 60 per second)");
RNA_def_property_range(prop, 0, 5000);
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "duration", PROP_INT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Duration", "If >0, delay in number of logic tics before the negative trigger following the positive trigger");
+ RNA_def_property_ui_text(prop, "Duration",
+ "If >0, delay in number of logic tics before the negative trigger following "
+ "the positive trigger");
RNA_def_property_range(prop, 0, 5000);
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "use_repeat", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_DELAY_REPEAT);
- RNA_def_property_ui_text(prop, "Repeat", "Toggle repeat option (if selected, the sensor restarts after Delay+Duration logic tics)");
+ RNA_def_property_ui_text(prop, "Repeat",
+ "Toggle repeat option (if selected, the sensor restarts after Delay+Duration "
+ "logic tics)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
}
@@ -604,7 +615,9 @@ static void rna_def_collision_sensor(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "CollisionSensor", "Sensor");
- RNA_def_struct_ui_text(srna, "Collision Sensor", "Sensor to detect objects colliding with the current object, with more settings than the Touch sensor");
+ RNA_def_struct_ui_text(srna, "Collision Sensor",
+ "Sensor to detect objects colliding with the current object, with more settings than "
+ "the Touch sensor");
RNA_def_struct_sdna_from(srna, "bCollisionSensor", "data");
prop = RNA_def_property(srna, "use_pulse", PROP_BOOLEAN, PROP_NONE);
@@ -653,7 +666,8 @@ static void rna_def_radar_sensor(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "RadarSensor", "Sensor");
- RNA_def_struct_ui_text(srna, "Radar Sensor", "Sensor to detect objects in a cone shaped radar emanating from the current object");
+ RNA_def_struct_ui_text(srna, "Radar Sensor",
+ "Sensor to detect objects in a cone shaped radar emanating from the current object");
RNA_def_struct_sdna_from(srna, "bRadarSensor", "data");
prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
@@ -713,7 +727,8 @@ static void rna_def_ray_sensor(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "RaySensor", "Sensor");
- RNA_def_struct_ui_text(srna, "Ray Sensor", "Sensor to detect intersections with a ray emanating from the current object");
+ RNA_def_struct_ui_text(srna, "Ray Sensor",
+ "Sensor to detect intersections with a ray emanating from the current object");
RNA_def_struct_sdna_from(srna, "bRaySensor", "data");
prop = RNA_def_property(srna, "ray_type", PROP_ENUM, PROP_NONE);
@@ -744,7 +759,8 @@ static void rna_def_ray_sensor(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_x_ray", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_RAY_XRAY);
- RNA_def_property_ui_text(prop, "X-Ray Mode", "Toggle X-Ray option (see through objects that don't have the property)");
+ RNA_def_property_ui_text(prop, "X-Ray Mode",
+ "Toggle X-Ray option (see through objects that don't have the property)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
@@ -769,7 +785,9 @@ static void rna_def_message_sensor(BlenderRNA *brna)
RNA_def_struct_sdna_from(srna, "bMessageSensor", "data");
prop = RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Subject", "Optional subject filter: only accept messages with this subject, or empty to accept all");
+ RNA_def_property_ui_text(prop, "Subject",
+ "Optional subject filter: only accept messages with this subject, "
+ "or empty to accept all");
RNA_def_property_update(prop, NC_LOGIC, NULL);
}
@@ -822,7 +840,8 @@ static void rna_def_joystick_sensor(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_all_events", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_JOY_ANY_EVENT);
- RNA_def_property_ui_text(prop, "All Events", "Triggered by all events on this joystick's current type (axis/button/hat)");
+ RNA_def_property_ui_text(prop, "All Events",
+ "Triggered by all events on this joystick's current type (axis/button/hat)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
/* Button */
@@ -894,4 +913,3 @@ void RNA_def_sensor(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_sensor_api.c b/source/blender/makesrna/intern/rna_sensor_api.c
index 8a5b11eb773..fd0c6f622ff 100644
--- a/source/blender/makesrna/intern/rna_sensor_api.c
+++ b/source/blender/makesrna/intern/rna_sensor_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s):
*
* ***** END GPL LICENSE BLOCK *****
@@ -60,13 +60,13 @@ void RNA_api_sensor(StructRNA *srna)
func = RNA_def_function(srna, "link", "rna_Sensor_link");
RNA_def_function_ui_description(func, "Link the sensor to a controller");
- parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to link to");
+ parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to link to");
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_property_update(parm, NC_LOGIC, NULL);
func = RNA_def_function(srna, "unlink", "rna_Sensor_unlink");
RNA_def_function_ui_description(func, "Unlink the sensor from a controller");
- parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to unlink from");
+ parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to unlink from");
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_property_update(parm, NC_LOGIC, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index d414658f32d..3491371ac06 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -37,6 +37,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
+#include "DNA_movieclip_types.h"
#include "BKE_animsys.h"
#include "BKE_global.h"
@@ -84,7 +85,7 @@ static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *it
internal->link = NULL;
do {
- seq = seq->tmp; /* XXX - seq's dont reference their parents! */
+ seq = seq->tmp; /* XXX - seq's don't reference their parents! */
if (seq && seq->next) {
internal->link = (Link*)seq->next;
break;
@@ -110,7 +111,8 @@ static int rna_SequenceEditor_elements_length(PointerRNA *ptr)
static void rna_SequenceEditor_elements_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Sequence *seq = (Sequence*)ptr->data;
- rna_iterator_array_begin(iter, (void*)seq->strip->stripdata, sizeof(StripElem), rna_SequenceEditor_elements_length(ptr), 0, NULL);
+ rna_iterator_array_begin(iter, (void*)seq->strip->stripdata, sizeof(StripElem),
+ rna_SequenceEditor_elements_length(ptr), 0, NULL);
}
static void rna_Sequence_frame_change_update(Scene *scene, Sequence *seq)
@@ -229,7 +231,8 @@ static void rna_Sequence_use_color_balance_set(PointerRNA *ptr, int value)
seq->strip->color_balance->gain[c] = 1.0f;
}
}
- } else {
+ }
+ else {
seq->flag ^= SEQ_USE_COLOR_BALANCE;
}
}
@@ -246,7 +249,8 @@ static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value)
seq->strip->proxy->build_size_flags
= SEQ_PROXY_IMAGE_SIZE_25;
}
- } else {
+ }
+ else {
seq->flag ^= SEQ_USE_PROXY;
}
}
@@ -259,7 +263,8 @@ static void rna_Sequence_use_translation_set(PointerRNA *ptr, int value)
if (seq->strip->transform == NULL) {
seq->strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform");
}
- } else {
+ }
+ else {
seq->flag ^= SEQ_USE_TRANSFORM;
}
}
@@ -272,7 +277,8 @@ static void rna_Sequence_use_crop_set(PointerRNA *ptr, int value)
if (seq->strip->crop == NULL) {
seq->strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop");
}
- } else {
+ }
+ else {
seq->flag ^= SEQ_USE_CROP;
}
}
@@ -371,7 +377,7 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value)
/* fix all the animation data which may link to this */
- /* dont rename everywhere because these are per scene */
+ /* don't rename everywhere because these are per scene */
/* BKE_all_animdata_fix_paths_rename("sequence_editor.sequences_all", oldname, seq->name+2); */
adt = BKE_animdata_from_id(&scene->id);
if (adt)
@@ -391,6 +397,8 @@ static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr)
return &RNA_SceneSequence;
case SEQ_MOVIE:
return &RNA_MovieSequence;
+ case SEQ_MOVIECLIP:
+ return &RNA_MovieClipSequence;
case SEQ_SOUND:
return &RNA_SoundSequence;
case SEQ_CROSS:
@@ -427,7 +435,7 @@ static char *rna_Sequence_path(PointerRNA *ptr)
{
Sequence *seq = (Sequence*)ptr->data;
- /* sequencer data comes from scene...
+ /* sequencer data comes from scene...
* TODO: would be nice to make SequenceEditor data a datablock of its own (for shorter paths)
*/
if (seq->name+2)
@@ -461,7 +469,8 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value)
sound_update_scene_sound(seq->scene_sound, seq->sound);
}
- BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name));
+ BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir),
+ sizeof(seq->strip->stripdata->name));
}
static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value)
@@ -539,7 +548,8 @@ static int rna_Sequence_input_count_get(PointerRNA *ptr)
/*static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value)
{
Sequence *seq= (Sequence*)(ptr->data);
- BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name));
+ BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir),
+ sizeof(seq->strip->stripdata->name));
}
static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value)
@@ -822,8 +832,8 @@ static void rna_def_strip_proxy(BlenderRNA *brna)
{SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)",
"Interpolate a global timestamp using the "
"record date and time written by recording device"},
- {SEQ_PROXY_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps",
- "Record run, but ignore timecode, "
+ {SEQ_PROXY_TC_RECORD_RUN_NO_GAPS, "RECORD_RUN_NO_GAPS", 0, "Record Run No Gaps",
+ "Like record run, but ignore timecode, "
"changes in framerate or dropouts"},
{0, NULL, 0, NULL, NULL}};
@@ -838,7 +848,8 @@ static void rna_def_strip_proxy(BlenderRNA *brna)
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_ui_text(prop, "Path", "Location of custom proxy file");
- RNA_def_property_string_funcs(prop, "rna_Sequence_proxy_filepath_get", "rna_Sequence_proxy_filepath_length", "rna_Sequence_proxy_filepath_set");
+ RNA_def_property_string_funcs(prop, "rna_Sequence_proxy_filepath_get", "rna_Sequence_proxy_filepath_length",
+ "rna_Sequence_proxy_filepath_set");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
@@ -942,39 +953,40 @@ static void rna_def_sequence(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem seq_type_items[] = {
- {SEQ_IMAGE, "IMAGE", 0, "Image", ""},
- {SEQ_META, "META", 0, "Meta", ""},
- {SEQ_SCENE, "SCENE", 0, "Scene", ""},
- {SEQ_MOVIE, "MOVIE", 0, "Movie", ""},
+ {SEQ_IMAGE, "IMAGE", 0, "Image", ""},
+ {SEQ_META, "META", 0, "Meta", ""},
+ {SEQ_SCENE, "SCENE", 0, "Scene", ""},
+ {SEQ_MOVIE, "MOVIE", 0, "Movie", ""},
+ {SEQ_MOVIECLIP, "MOVIECLIP", 0, "Clip", ""},
{SEQ_SOUND, "SOUND", 0, "Sound", ""},
- {SEQ_CROSS, "CROSS", 0, "Cross", ""},
- {SEQ_ADD, "ADD", 0, "Add", ""},
- {SEQ_SUB, "SUBTRACT", 0, "Subtract", ""},
- {SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
- {SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
- {SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
- {SEQ_MUL, "MULTIPLY", 0, "Multiply", ""},
- {SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
- {SEQ_PLUGIN, "PLUGIN", 0, "Plugin", ""},
- {SEQ_WIPE, "WIPE", 0, "Wipe", ""},
- {SEQ_GLOW, "GLOW", 0, "Glow", ""},
- {SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
- {SEQ_COLOR, "COLOR", 0, "Color", ""},
- {SEQ_SPEED, "SPEED", 0, "Speed", ""},
+ {SEQ_CROSS, "CROSS", 0, "Cross", ""},
+ {SEQ_ADD, "ADD", 0, "Add", ""},
+ {SEQ_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
+ {SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
+ {SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
+ {SEQ_MUL, "MULTIPLY", 0, "Multiply", ""},
+ {SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
+ {SEQ_PLUGIN, "PLUGIN", 0, "Plugin", ""},
+ {SEQ_WIPE, "WIPE", 0, "Wipe", ""},
+ {SEQ_GLOW, "GLOW", 0, "Glow", ""},
+ {SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
+ {SEQ_COLOR, "COLOR", 0, "Color", ""},
+ {SEQ_SPEED, "SPEED", 0, "Speed", ""},
{SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
{SEQ_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem blend_mode_items[] = {
- {SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
- {SEQ_CROSS, "CROSS", 0, "Cross", ""},
- {SEQ_ADD, "ADD", 0, "Add", ""},
- {SEQ_SUB, "SUBTRACT", 0, "Subtract", ""},
- {SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
- {SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
- {SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
- {SEQ_MUL, "MULTIPLY", 0, "Multiply", ""},
- {SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
+ {SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
+ {SEQ_CROSS, "CROSS", 0, "Cross", ""},
+ {SEQ_ADD, "ADD", 0, "Add", ""},
+ {SEQ_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
+ {SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
+ {SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
+ {SEQ_MUL, "MULTIPLY", 0, "Multiply", ""},
+ {SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "Sequence", NULL);
@@ -1044,7 +1056,8 @@ static void rna_def_sequence(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "len");
RNA_def_property_clear_flag(prop, PROP_EDITABLE|PROP_ANIMATABLE);
RNA_def_property_range(prop, 1, MAXFRAME);
- RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip before the handles are applied");
+ RNA_def_property_ui_text(prop, "Length",
+ "The length of the contents of this strip before the handles are applied");
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "start");
@@ -1057,16 +1070,21 @@ static void rna_def_sequence(BlenderRNA *brna)
prop = RNA_def_property(srna, "frame_final_start", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "startdisp");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Start Frame", "Start frame displayed in the sequence editor after offsets are applied, setting this is equivalent to moving the handle, not the actual start frame");
- RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_final_set", NULL); /* overlap tests and calc_seq_disp */
+ RNA_def_property_ui_text(prop, "Start Frame",
+ "Start frame displayed in the sequence editor after offsets are applied, setting this is "
+ "equivalent to moving the handle, not the actual start frame");
+ /* overlap tests and calc_seq_disp */
+ RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_final_set", NULL);
RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop = RNA_def_property(srna, "frame_final_end", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "enddisp");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "End Frame", "End frame displayed in the sequence editor after offsets are applied");
- RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_end_frame_final_set", NULL); /* overlap tests and calc_seq_disp */
+ RNA_def_property_ui_text(prop, "End Frame",
+ "End frame displayed in the sequence editor after offsets are applied");
+ /* overlap tests and calc_seq_disp */
+ RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_end_frame_final_set", NULL);
RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
@@ -1114,7 +1132,8 @@ static void rna_def_sequence(BlenderRNA *brna)
prop = RNA_def_property(srna, "blend_alpha", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Blend Opacity", "");
- RNA_def_property_float_funcs(prop, "rna_Sequence_opacity_get", "rna_Sequence_opacity_set", NULL); /* stupid 0-100 -> 0-1 */
+ /* stupid 0-100 -> 0-1 */
+ RNA_def_property_float_funcs(prop, "rna_Sequence_opacity_get", "rna_Sequence_opacity_set", NULL);
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop = RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_NONE);
@@ -1125,13 +1144,17 @@ static void rna_def_sequence(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_default_fade", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_EFFECT_DEFAULT_FADE);
- RNA_def_property_ui_text(prop, "Use Default Fade", "Fade effect using the built-in default (usually make transition as long as effect strip)");
+ RNA_def_property_ui_text(prop, "Use Default Fade",
+ "Fade effect using the built-in default (usually make transition as long as "
+ "effect strip)");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop = RNA_def_property(srna, "speed_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "speed_fader");
- RNA_def_property_ui_text(prop, "Speed factor", "Multiply the current speed of the sequence with this number or remap current frame to this frame");
+ RNA_def_property_ui_text(prop, "Speed factor",
+ "Multiply the current speed of the sequence with this number or remap current frame "
+ "to this frame");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
/* effect strip inputs */
@@ -1174,13 +1197,15 @@ static void rna_def_editor(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
RNA_def_property_struct_type(prop, "Sequence");
RNA_def_property_ui_text(prop, "Sequences", "");
- RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_sequences_all_begin", "rna_SequenceEditor_sequences_all_next", NULL, NULL, NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_sequences_all_begin",
+ "rna_SequenceEditor_sequences_all_next", NULL, NULL, NULL, NULL, NULL, NULL);
prop = RNA_def_property(srna, "meta_stack", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL);
RNA_def_property_struct_type(prop, "Sequence");
RNA_def_property_ui_text(prop, "Meta Stack", "Meta strip stack, last is currently edited meta strip");
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SequenceEditor_meta_stack_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SequenceEditor_meta_stack_get",
+ NULL, NULL, NULL, NULL);
prop = RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "act_seq");
@@ -1200,7 +1225,8 @@ static void rna_def_editor(BlenderRNA *brna)
/* access to fixed and relative frame */
prop = RNA_def_property(srna, "overlay_frame", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(prop, "Overlay Offset", "");
- RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get", "rna_SequenceEditor_overlay_frame_set", NULL);
+ RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get",
+ "rna_SequenceEditor_overlay_frame_set", NULL);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
RNA_def_property_ui_text(prop, "Active Strip", "Sequencer's active strip");
}
@@ -1350,7 +1376,9 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
RNA_def_property_struct_type(prop, "SequenceElement");
RNA_def_property_ui_text(prop, "Elements", "");
- RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_get",
+ "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
rna_def_filter_video(srna);
rna_def_proxy(srna);
@@ -1419,14 +1447,17 @@ static void rna_def_movie(BlenderRNA *brna)
prop = RNA_def_property(srna, "stream_index", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "streamindex");
RNA_def_property_range(prop, 0, 20);
- RNA_def_property_ui_text(prop, "Streamindex", "For files with several movie streams, use the stream with the given index");
+ RNA_def_property_ui_text(prop, "Streamindex",
+ "For files with several movie streams, use the stream with the given index");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update_reopen_files");
prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
RNA_def_property_struct_type(prop, "SequenceElement");
RNA_def_property_ui_text(prop, "Elements", "");
- RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_get",
+ "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_ui_text(prop, "File", "");
@@ -1439,13 +1470,38 @@ static void rna_def_movie(BlenderRNA *brna)
rna_def_input(srna);
}
+static void rna_def_movieclip(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MovieClipSequence", "Sequence");
+ RNA_def_struct_ui_text(srna, "MovieClip Sequence", "Sequence strip to load a video from the clip editor");
+ RNA_def_struct_sdna(srna, "Sequence");
+
+ prop = RNA_def_property(srna, "undistort", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "clip_flag", SEQ_MOVIECLIP_RENDER_UNDISTORTED);
+ RNA_def_property_ui_text(prop, "Undistort Clip", "Use the undistorted version of the clip");
+ RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "stabilize2d", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "clip_flag", SEQ_MOVIECLIP_RENDER_STABILIZED);
+ RNA_def_property_ui_text(prop, "Stabilize 2D Clip", "Use the 2D stabilized version of the clip");
+ RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
+
+ rna_def_filter_video(srna);
+ rna_def_input(srna);
+}
+
+
static void rna_def_sound(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "SoundSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "Sound Sequence", "Sequence strip defining a sound to be played over a period of time");
+ RNA_def_struct_ui_text(srna, "Sound Sequence",
+ "Sequence strip defining a sound to be played over a period of time");
RNA_def_struct_sdna(srna, "Sequence");
prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
@@ -1476,7 +1532,7 @@ static void rna_def_sound(BlenderRNA *brna)
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_ui_text(prop, "File", "");
- RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length",
+ RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length",
"rna_Sequence_filepath_set");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_filepath_update");
@@ -1488,7 +1544,8 @@ static void rna_def_effect(BlenderRNA *brna)
StructRNA *srna;
srna = RNA_def_struct(brna, "EffectSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "Effect Sequence", "Sequence strip applying an effect on the images created by other strips");
+ RNA_def_struct_ui_text(srna, "Effect Sequence",
+ "Sequence strip applying an effect on the images created by other strips");
RNA_def_struct_sdna(srna, "Sequence");
rna_def_filter_video(srna);
@@ -1501,7 +1558,8 @@ static void rna_def_multicam(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "MulticamSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "Multicam Select Sequence", "Sequence strip to perform multicam editing: select channel from below");
+ RNA_def_struct_ui_text(srna, "Multicam Select Sequence",
+ "Sequence strip to perform multicam editing: select channel from below");
RNA_def_struct_sdna(srna, "Sequence");
prop = RNA_def_property(srna, "multicam_source", PROP_INT, PROP_UNSIGNED);
@@ -1521,7 +1579,8 @@ static void rna_def_adjustment(BlenderRNA *brna)
/* PropertyRNA *prop; */
srna = RNA_def_struct(brna, "AdjustmentSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "Adjustment Layer Sequence", "Sequence strip to perform filter adjustments to layers below");
+ RNA_def_struct_ui_text(srna, "Adjustment Layer Sequence",
+ "Sequence strip to perform filter adjustments to layers below");
RNA_def_struct_sdna(srna, "Sequence");
rna_def_filter_video(srna);
@@ -1535,7 +1594,8 @@ static void rna_def_plugin(BlenderRNA *brna)
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_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);
@@ -1553,12 +1613,12 @@ static void rna_def_wipe(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem wipe_type_items[] = {
- {0, "SINGLE", 0, "Single", ""},
- {1, "DOUBLE", 0, "Double", ""},
+ {0, "SINGLE", 0, "Single", ""},
+ {1, "DOUBLE", 0, "Double", ""},
/* not used yet {2, "BOX", 0, "Box", ""}, */
/* not used yet {3, "CROSS", 0, "Cross", ""}, */
- {4, "IRIS", 0, "Iris", ""},
- {5, "CLOCK", 0, "Clock", ""},
+ {4, "IRIS", 0, "Iris", ""},
+ {5, "CLOCK", 0, "Clock", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -1575,7 +1635,8 @@ static void rna_def_wipe(BlenderRNA *brna)
prop = RNA_def_property(srna, "blur_width", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "edgeWidth");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Blur Width", "Width of the blur edge, in percentage relative to the image size");
+ RNA_def_property_ui_text(prop, "Blur Width",
+ "Width of the blur edge, in percentage relative to the image size");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
#if 1 /* expose as radians */
@@ -1667,7 +1728,8 @@ static void rna_def_transform(BlenderRNA *brna)
};
srna = RNA_def_struct(brna, "TransformSequence", "EffectSequence");
- RNA_def_struct_ui_text(srna, "Transform Sequence", "Sequence strip applying affine transformations to other strips");
+ RNA_def_struct_ui_text(srna, "Transform Sequence",
+ "Sequence strip applying affine transformations to other strips");
RNA_def_struct_sdna_from(srna, "TransformVars", "effectdata");
prop = RNA_def_property(srna, "scale_start_x", PROP_FLOAT, PROP_UNSIGNED);
@@ -1781,6 +1843,7 @@ void RNA_def_sequencer(BlenderRNA *brna)
rna_def_meta(brna);
rna_def_scene(brna);
rna_def_movie(brna);
+ rna_def_movieclip(brna);
rna_def_sound(brna);
rna_def_effect(brna);
rna_def_multicam(brna);
@@ -1794,4 +1857,3 @@ void RNA_def_sequencer(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index 899f6a6d32f..e47ec23bef5 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -67,7 +67,8 @@ void RNA_api_sequence_strip(StructRNA *srna)
parm = RNA_def_int(func, "frame", 0, -MAXFRAME, MAXFRAME, "Frame",
"The frame to get the strip element from", -MAXFRAME, MAXFRAME);
RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_function_return(func, RNA_def_pointer(func, "elem", "SequenceElement", "", "strip element of the current frame"));
+ RNA_def_function_return(func, RNA_def_pointer(func, "elem", "SequenceElement", "",
+ "strip element of the current frame"));
func = RNA_def_function(srna, "swap", "rna_Sequence_swap_internal");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index ee1dd52a93f..dfd3f5d8428 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -120,7 +120,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
static EnumPropertyItem prop_noise_type_items[] = {
{MOD_SMOKE_NOISEWAVE, "NOISEWAVE", 0, "Wavelet", ""},
#ifdef WITH_FFTW3
- {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""},
+ {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""},
#endif
/* {MOD_SMOKE_NOISECURL, "NOISECURL", 0, "Curl", ""}, */
{0, NULL, 0, NULL, NULL}};
@@ -132,7 +132,8 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
static EnumPropertyItem smoke_domain_colli_items[] = {
{SM_BORDER_OPEN, "BORDEROPEN", 0, "Open", "Smoke doesn't collide with any border"},
- {SM_BORDER_VERTICAL, "BORDERVERTICAL", 0, "Vertically Open", "Smoke doesn't collide with top and bottom sides"},
+ {SM_BORDER_VERTICAL, "BORDERVERTICAL", 0, "Vertically Open",
+ "Smoke doesn't collide with top and bottom sides"},
{SM_BORDER_CLOSED, "BORDERCLOSED", 0, "Collide All", "Smoke collides with every side"},
{0, NULL, 0, NULL, NULL}};
@@ -175,14 +176,16 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "alpha");
RNA_def_property_range(prop, -5.0, 5.0);
RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
- RNA_def_property_ui_text(prop, "Density", "How much density affects smoke motion (higher value results in faster rising smoke)");
+ RNA_def_property_ui_text(prop, "Density",
+ "How much density affects smoke motion (higher value results in faster rising smoke)");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
prop = RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "beta");
RNA_def_property_range(prop, -5.0, 5.0);
RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
- RNA_def_property_ui_text(prop, "Heat", "How much heat affects smoke motion (higher value results in faster rising smoke)");
+ RNA_def_property_ui_text(prop, "Heat",
+ "How much heat affects smoke motion (higher value results in faster rising smoke)");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
prop = RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE);
@@ -243,7 +246,8 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "border_collisions");
RNA_def_property_enum_items(prop, smoke_domain_colli_items);
- RNA_def_property_ui_text(prop, "Border Collisions", "Select which domain border will be treated as collision object");
+ RNA_def_property_ui_text(prop, "Border Collisions",
+ "Select which domain border will be treated as collision object");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
@@ -344,4 +348,3 @@ void RNA_def_smoke(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c
index 866b4787a9c..18499fa52fe 100644
--- a/source/blender/makesrna/intern/rna_sound.c
+++ b/source/blender/makesrna/intern/rna_sound.c
@@ -94,7 +94,8 @@ static void rna_def_sound(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_mono", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SOUND_FLAGS_MONO);
- RNA_def_property_ui_text(prop, "Mono", "If the file contains multiple audio channels they are rendered to a single one");
+ RNA_def_property_ui_text(prop, "Mono",
+ "If the file contains multiple audio channels they are rendered to a single one");
RNA_def_property_update(prop, 0, "rna_Sound_update");
}
@@ -104,5 +105,3 @@ void RNA_def_sound(BlenderRNA *brna)
}
#endif
-
-
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index d89af94d447..7cf2475f9de 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -76,7 +76,8 @@ EnumPropertyItem space_type_items[] = {
static EnumPropertyItem draw_channels_items[] = {
{0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
- {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"},
+ {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
+ "Draw image with RGB colors and alpha transparency"},
{SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
{SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer",
"Draw Z-buffer associated with image (mapped from camera clip start to end)"},
@@ -87,7 +88,8 @@ static EnumPropertyItem transform_orientation_items[] = {
{V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"},
{V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the Euler rotation axis as used for input"},
{V3D_MANIP_NORMAL, "NORMAL", 0, "Normal",
- "Align the transformation axes to average normal of selected elements (bone Y axis for pose mode)"},
+ "Align the transformation axes to average normal of selected elements "
+ "(bone Y axis for pose mode)"},
{V3D_MANIP_VIEW, "VIEW", 0, "View", "Align the transformation axes to the window"},
{V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
{0, NULL, 0, NULL, NULL}};
@@ -476,7 +478,8 @@ void rna_RegionView3D_update(ID *id, RegionView3D *rv3d)
}
}
-static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *free)
{
Scene *scene = ((bScreen*)ptr->id.data)->scene;
RenderEngineType *type = RE_engines_find(scene->r.engine);
@@ -599,7 +602,8 @@ static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *val
if (sima->flag & SI_COORDFLOATS) {
copy_v2_v2(values, sima->cursor);
- } else {
+ }
+ else {
int w, h;
ED_space_image_size(sima, &w, &h);
@@ -614,7 +618,8 @@ static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const floa
if (sima->flag & SI_COORDFLOATS) {
copy_v2_v2(sima->cursor, values);
- } else {
+ }
+ else {
int w, h;
ED_space_image_size(sima, &w, &h);
@@ -886,7 +891,7 @@ static void rna_SpaceGraphEditor_display_mode_update(Main *UNUSED(bmain), Scene
{
ScrArea *sa = rna_area_from_space(ptr);
- /* after changing view mode, must force recalculation of F-Curve colors
+ /* after changing view mode, must force recalculation of F-Curve colors
* which can only be achieved using refresh as opposed to redraw
*/
ED_area_tag_refresh(sa);
@@ -1142,7 +1147,8 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_normalized_coords", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_COORDFLOATS);
- RNA_def_property_ui_text(prop, "Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels");
+ RNA_def_property_ui_text(prop, "Normalized Coordinates",
+ "Display UV coordinates from 0.0 to 1.0 rather than in pixels");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
@@ -1166,7 +1172,8 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
prop = RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV);
- RNA_def_property_ui_text(prop, "Constrain to Image Bounds", "Constraint to stay within the image bounds while editing");
+ RNA_def_property_ui_text(prop, "Constrain to Image Bounds",
+ "Constraint to stay within the image bounds while editing");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
prop = RNA_def_property(srna, "use_live_unwrap", PROP_BOOLEAN, PROP_NONE);
@@ -1193,7 +1200,8 @@ static void rna_def_space_outliner(BlenderRNA *brna)
{SO_VISIBLE, "VISIBLE_LAYERS", 0, "Visible Layers", "Display datablocks in visible layers"},
{SO_SELECTED, "SELECTED", 0, "Selected", "Display datablocks of selected objects"},
{SO_ACTIVE, "ACTIVE", 0, "Active", "Display datablocks of active object"},
- {SO_SAME_TYPE, "SAME_TYPES", 0, "Same Types", "Display datablocks of all objects of same type as selected object"},
+ {SO_SAME_TYPE, "SAME_TYPES", 0, "Same Types",
+ "Display datablocks of all objects of same type as selected object"},
{SO_GROUPS, "GROUPS", 0, "Groups", "Display groups and their datablocks"},
{SO_LIBRARIES, "LIBRARIES", 0, "Libraries", "Display libraries"},
{SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence datablocks"},
@@ -1238,7 +1246,7 @@ static void rna_def_background_image(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- /* note: combinations work but dont flip so arnt that useful */
+ /* note: combinations work but don't flip so arnt that useful */
static EnumPropertyItem bgpic_axis_items[] = {
{0, "", 0, "X Axis", ""},
{(1<<RV3D_VIEW_LEFT), "LEFT", 0, "Left", "Show background image while looking to the left"},
@@ -1288,7 +1296,8 @@ static void rna_def_background_image(BlenderRNA *brna)
prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
+ RNA_def_property_ui_text(prop, "Image User",
+ "Parameters defining which layer, pass and frame of the image is displayed");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
@@ -1379,8 +1388,10 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
"Pivot around bounding box center of selected object(s)"},
{V3D_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
- {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Origins", "Pivot around each object's own origin"},
- {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", "Pivot around the median point of selected objects"},
+ {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
+ "Individual Origins", "Pivot around each object's own origin"},
+ {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point",
+ "Pivot around the median point of selected objects"},
{V3D_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", "Pivot around active object"},
{0, NULL, 0, NULL, NULL}};
@@ -1407,7 +1418,8 @@ static void rna_def_space_view3d(BlenderRNA *brna)
prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_sdna(prop, NULL, "camera");
- RNA_def_property_ui_text(prop, "Camera", "Active camera used in this view (when unlocked from the scene's active camera)");
+ RNA_def_property_ui_text(prop, "Camera",
+ "Active camera used in this view (when unlocked from the scene's active camera)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "lock_object", PROP_POINTER, PROP_NONE);
@@ -1435,12 +1447,14 @@ static void rna_def_space_view3d(BlenderRNA *brna)
prop = RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "localvd");
- RNA_def_property_ui_text(prop, "Local View", "Display an isolated sub-set of objects, apart from the scene visibility");
+ RNA_def_property_ui_text(prop, "Local View",
+ "Display an isolated sub-set of objects, apart from the scene visibility");
prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH);
RNA_def_property_array(prop, 3);
RNA_def_property_float_funcs(prop, "rna_View3D_CursorLocation_get", "rna_View3D_CursorLocation_set", NULL);
- RNA_def_property_ui_text(prop, "3D Cursor Location", "3D cursor location for this view (dependent on local view setting)");
+ RNA_def_property_ui_text(prop, "3D Cursor Location",
+ "3D cursor location for this view (dependent on local view setting)");
RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
@@ -1514,7 +1528,8 @@ static void rna_def_space_view3d(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_relationship_lines", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_HIDE_HELPLINES);
- RNA_def_property_ui_text(prop, "Relationship Lines", "Show dashed lines indicating parent or constraint relationships");
+ RNA_def_property_ui_text(prop, "Relationship Lines",
+ "Show dashed lines indicating parent or constraint relationships");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_textured_solid", PROP_BOOLEAN, PROP_NONE);
@@ -1547,7 +1562,8 @@ static void rna_def_space_view3d(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_background_images", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DISPBGPICS);
- RNA_def_property_ui_text(prop, "Display Background Images", "Display reference images behind objects in the 3D View");
+ RNA_def_property_ui_text(prop, "Display Background Images",
+ "Display reference images behind objects in the 3D View");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
@@ -1706,7 +1722,8 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "ofs"); /* cant use because its negated */
#else
RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_location_get", "rna_RegionView3D_view_location_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_location_get",
+ "rna_RegionView3D_view_location_set", NULL);
#endif
RNA_def_property_ui_text(prop, "View Location", "View pivot location");
RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
@@ -1717,7 +1734,8 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "viewquat");
#else
RNA_def_property_array(prop, 4);
- RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_rotation_get", "rna_RegionView3D_view_rotation_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_rotation_get",
+ "rna_RegionView3D_view_rotation_set", NULL);
#endif
RNA_def_property_ui_text(prop, "View Rotation", "Rotation in quaternions (keep normalized)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
@@ -1809,7 +1827,8 @@ static void rna_def_space_buttons(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "pinid");
RNA_def_property_struct_type(prop, "ID");
/* note: custom set function is ONLY to avoid rna setting a user for this. */
- RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set", "rna_SpaceProperties_pin_id_typef", NULL);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set",
+ "rna_SpaceProperties_pin_id_typef", NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update");
@@ -1837,7 +1856,8 @@ static void rna_def_space_image(BlenderRNA *brna)
prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
+ RNA_def_property_ui_text(prop, "Image User",
+ "Parameters defining which layer, pass and frame of the image is displayed");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
@@ -1905,7 +1925,8 @@ static void rna_def_space_image(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DISPGP);
- RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay");
+ RNA_def_property_ui_text(prop, "Use Grease Pencil",
+ "Display and edit the grease pencil freehand annotations overlay");
/* update */
prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
@@ -1982,7 +2003,8 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
/* flag's */
prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_NO_DRAW_CFRANUM);
- RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
+ RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
+ "Show frame number beside the current frame indicator line");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
prop = RNA_def_property(srna, "show_frames", PROP_BOOLEAN, PROP_NONE);
@@ -2002,12 +2024,13 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_safe_margin", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_SAFE_MARGINS);
- RNA_def_property_ui_text(prop, "Safe Margin", "Draw title safe margins in preview");
+ RNA_def_property_ui_text(prop, "Safe Margin", "Draw title safe margins in preview");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
prop = RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_GPENCIL);
- RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay");
+ RNA_def_property_ui_text(prop, "Use Grease Pencil",
+ "Display and edit the grease pencil freehand annotations overlay");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
@@ -2038,7 +2061,8 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
prop = RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "render_size");
RNA_def_property_enum_items(prop, proxy_render_size_items);
- RNA_def_property_ui_text(prop, "Proxy render size", "Draw preview using full resolution or different proxy resolutions");
+ RNA_def_property_ui_text(prop, "Proxy render size",
+ "Draw preview using full resolution or different proxy resolutions");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
}
@@ -2165,7 +2189,8 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
/* data */
prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceDopeSheetEditor_action_set", NULL, "rna_Action_actedit_assign_poll");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceDopeSheetEditor_action_set", NULL,
+ "rna_Action_actedit_assign_poll");
RNA_def_property_ui_text(prop, "Action", "Action displayed and edited in this space");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, "rna_SpaceDopeSheetEditor_action_update");
@@ -2184,7 +2209,8 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NODRAWCFRANUM);
- RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
+ RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
+ "Show frame number beside the current frame indicator line");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
prop = RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
@@ -2235,7 +2261,8 @@ static void rna_def_space_graph(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem mode_items[] = {
- {SIPO_MODE_ANIMATION, "FCURVES", ICON_IPO, "F-Curve Editor", "Edit animation/keyframes displayed as 2D curves"},
+ {SIPO_MODE_ANIMATION, "FCURVES", ICON_IPO, "F-Curve Editor",
+ "Edit animation/keyframes displayed as 2D curves"},
{SIPO_MODE_DRIVERS, "DRIVERS", ICON_DRIVER, "Drivers", "Edit drivers"},
{0, NULL, 0, NULL, NULL}};
@@ -2268,7 +2295,8 @@ static void rna_def_space_graph(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWCFRANUM);
- RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
+ RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
+ "Show frame number beside the current frame indicator line");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
prop = RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
@@ -2289,13 +2317,15 @@ static void rna_def_space_graph(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELVHANDLESONLY);
- RNA_def_property_ui_text(prop, "Only Selected Keyframes Handles", "Only show and edit handles of selected keyframes");
+ RNA_def_property_ui_text(prop, "Only Selected Keyframes Handles",
+ "Only show and edit handles of selected keyframes");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
prop = RNA_def_property(srna, "use_beauty_drawing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF);
RNA_def_property_ui_text(prop, "Use High Quality Drawing",
- "Draw F-Curves using Anti-Aliasing and other fancy effects (disable for better performance)");
+ "Draw F-Curves using Anti-Aliasing and other fancy effects "
+ "(disable for better performance)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
/* editing */
@@ -2342,7 +2372,8 @@ static void rna_def_space_graph(BlenderRNA *brna)
/* readonly state info */
prop = RNA_def_property(srna, "has_ghost_curves", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", 0); /* XXX: hack to make this compile, since this property doesn't actually exist*/
+ /* XXX: hack to make this compile, since this property doesn't actually exist*/
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
RNA_def_property_boolean_funcs(prop, "rna_SpaceGraphEditor_has_ghost_curves_get", NULL);
RNA_def_property_ui_text(prop, "Has Ghost Curves", "Graph Editor instance has some ghost curves stored");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
@@ -2365,7 +2396,8 @@ static void rna_def_space_nla(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NODRAWCFRANUM);
- RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
+ RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
+ "Show frame number beside the current frame indicator line");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
prop = RNA_def_property(srna, "show_strip_curves", PROP_BOOLEAN, PROP_NONE);
@@ -2403,15 +2435,17 @@ static void rna_def_space_time(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "SpaceTime");
RNA_def_struct_ui_text(srna, "Space Timeline Editor", "Timeline editor space data");
- /* view settings */
+ /* view settings */
prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ONLYACTSEL);
- RNA_def_property_ui_text(prop, "Only Selected Channels", "Show keyframes for active Object and/or its selected bones only");
+ RNA_def_property_ui_text(prop, "Only Selected Channels",
+ "Show keyframes for active Object and/or its selected bones only");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_CFRA_NUM);
- RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
+ RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
+ "Show frame number beside the current frame indicator line");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
@@ -2422,32 +2456,32 @@ static void rna_def_space_time(BlenderRNA *brna)
/* displaying cache status */
prop = RNA_def_property(srna, "show_cache", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DISPLAY);
- RNA_def_property_ui_text(prop, "Show Cache", "Show the status of cached frames in the timeline");
+ RNA_def_property_ui_text(prop, "Show Cache", "Show the status of cached frames in the timeline");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
prop = RNA_def_property(srna, "cache_softbody", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SOFTBODY);
- RNA_def_property_ui_text(prop, "Softbody", "Show the active object's softbody point cache");
+ RNA_def_property_ui_text(prop, "Softbody", "Show the active object's softbody point cache");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
prop = RNA_def_property(srna, "cache_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_PARTICLES);
- RNA_def_property_ui_text(prop, "Particles", "Show the active object's particle point cache");
+ RNA_def_property_ui_text(prop, "Particles", "Show the active object's particle point cache");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
prop = RNA_def_property(srna, "cache_cloth", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_CLOTH);
- RNA_def_property_ui_text(prop, "Cloth", "Show the active object's cloth point cache");
+ RNA_def_property_ui_text(prop, "Cloth", "Show the active object's cloth point cache");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
prop = RNA_def_property(srna, "cache_smoke", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SMOKE);
- RNA_def_property_ui_text(prop, "Smoke", "Show the active object's smoke cache");
+ RNA_def_property_ui_text(prop, "Smoke", "Show the active object's smoke cache");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
prop = RNA_def_property(srna, "cache_dynamicpaint", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DYNAMICPAINT);
- RNA_def_property_ui_text(prop, "Dynamic Paint", "Show the active object's Dynamic Paint cache");
+ RNA_def_property_ui_text(prop, "Dynamic Paint", "Show the active object's Dynamic Paint cache");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
}
@@ -2461,7 +2495,8 @@ static void rna_def_console_line(BlenderRNA *brna)
/* XXX using non-inited "prop", uh? RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL); */
prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ConsoleLine_body_get", "rna_ConsoleLine_body_length", "rna_ConsoleLine_body_set");
+ RNA_def_property_string_funcs(prop, "rna_ConsoleLine_body_get", "rna_ConsoleLine_body_length",
+ "rna_ConsoleLine_body_set");
RNA_def_property_ui_text(prop, "Line", "Text in the line");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
@@ -2525,8 +2560,10 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem file_sort_items[] = {
- {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", "Sort the file list alphabetically"},
- {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension"},
+ {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically",
+ "Sort the file list alphabetically"},
+ {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension",
+ "Sort the file list by extension"},
{FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"},
{FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"},
{0, NULL, 0, NULL, NULL}};
@@ -2610,7 +2647,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_filter_text", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filter", TEXTFILE);
RNA_def_property_ui_text(prop, "Filter Text", "Show text files");
- RNA_def_property_ui_icon(prop, ICON_FILE_BLANK, 0);
+ RNA_def_property_ui_icon(prop, ICON_FILE_TEXT, 0);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
prop = RNA_def_property(srna, "use_filter_folder", PROP_BOOLEAN, PROP_NONE);
@@ -2683,7 +2720,7 @@ static void rna_def_space_info(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_report_error", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_ERR);
RNA_def_property_ui_text(prop, "Show Error", "Display error text");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
}
static void rna_def_space_userpref(BlenderRNA *brna)
@@ -2873,7 +2910,8 @@ static void rna_def_space_clip(BlenderRNA *brna)
static EnumPropertyItem mode_items[] = {
{SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
- {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction", "Show tracking/reconstruction tools"},
+ {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction",
+ "Show tracking/reconstruction tools"},
{SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
{0, NULL, 0, NULL, NULL}};
@@ -2898,7 +2936,8 @@ static void rna_def_space_clip(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_struct_type(prop, "MovieClipUser");
RNA_def_property_pointer_sdna(prop, NULL, "user");
- RNA_def_property_ui_text(prop, "Movie Clip User", "Parameters defining which frame of the movie clip is displayed");
+ RNA_def_property_ui_text(prop, "Movie Clip User",
+ "Parameters defining which frame of the movie clip is displayed");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
/* mode */
@@ -2935,7 +2974,8 @@ static void rna_def_space_clip(BlenderRNA *brna)
/* lock to time cursor */
prop = RNA_def_property(srna, "lock_time_cursor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Lock to Time Cursor", "Lock curves view to time cursor during playback and tracking");
+ RNA_def_property_ui_text(prop, "Lock to Time Cursor",
+ "Lock curves view to time cursor during playback and tracking");
RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_LOCK_TIMECURSOR);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
@@ -3015,13 +3055,16 @@ static void rna_def_space_clip(BlenderRNA *brna)
/* show graph_frames */
prop = RNA_def_property(srna, "show_graph_frames", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_FRAMES);
- RNA_def_property_ui_text(prop, "Show Frames", "Show curve for per-frame average error (camera motion should be solved first)");
+ RNA_def_property_ui_text(prop, "Show Frames",
+ "Show curve for per-frame average error (camera motion should be solved first)");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
/* show graph_tracks */
prop = RNA_def_property(srna, "show_graph_tracks", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_TRACKS);
- RNA_def_property_ui_text(prop, "Show Tracks", "Display the speed curves (in \"x\" direction red, in \"y\" direction green) for the selected tracks");
+ RNA_def_property_ui_text(prop, "Show Tracks",
+ "Display the speed curves (in \"x\" direction red, in \"y\" direction green) "
+ "for the selected tracks");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
/* ** channels ** */
diff --git a/source/blender/makesrna/intern/rna_test.c b/source/blender/makesrna/intern/rna_test.c
index 175aa0046ae..e094423995e 100644
--- a/source/blender/makesrna/intern/rna_test.c
+++ b/source/blender/makesrna/intern/rna_test.c
@@ -133,7 +133,8 @@ void RNA_def_test(BlenderRNA *brna)
/* dynamic arrays */
- prop = RNA_def_float_array(srna, "fdarr", DYNAMIC_ARRAY_SIZE, NULL, 0.0f, 0.0f, "fdarr", "dynamic float array", 0.0f, 0.0f);
+ prop = RNA_def_float_array(srna, "fdarr", DYNAMIC_ARRAY_SIZE, NULL, 0.0f, 0.0f, "fdarr",
+ "dynamic float array", 0.0f, 0.0f);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdarr_get_length", "rna_Test_fdarr_set_length");
RNA_def_property_float_funcs(prop, "rna_Test_fdarr_get", "rna_Test_fdarr_set", NULL);
@@ -186,5 +187,3 @@ void RNA_def_test(BlenderRNA *brna)
}
#endif /* RNA_RUNTIME */
-
-
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index 267c8124611..36ee361de2c 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -203,7 +203,8 @@ static void rna_def_text(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_module", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISSCRIPT);
- RNA_def_property_ui_text(prop, "Register", "Register this text as a module on loading, Text name must end with \".py\"");
+ RNA_def_property_ui_text(prop, "Register",
+ "Register this text as a module on loading, Text name must end with \".py\"");
prop = RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_TABSTOSPACES);
@@ -223,7 +224,9 @@ static void rna_def_text(BlenderRNA *brna)
prop = RNA_def_property(srna, "current_character", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "curc");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Current Character", "Index of current character in current line, and also start index of character in selection if one exists");
+ RNA_def_property_ui_text(prop, "Current Character",
+ "Index of current character in current line, and also start index of "
+ "character in selection if one exists");
prop = RNA_def_property(srna, "select_end_line", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
@@ -235,7 +238,8 @@ static void rna_def_text(BlenderRNA *brna)
prop = RNA_def_property(srna, "select_end_character", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "selc");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Selection End Character", "Index of character after end of selection in the selection end line");
+ RNA_def_property_ui_text(prop, "Selection End Character",
+ "Index of character after end of selection in the selection end line");
prop = RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "TextMarker");
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index bfe23e97dd9..6a3dee72849 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -91,8 +91,8 @@ EnumPropertyItem blend_type_items[] = {
{MTEX_BLEND_SAT, "SATURATION", 0, "Saturation", ""},
{MTEX_BLEND_VAL, "VALUE", 0, "Value", ""},
{MTEX_BLEND_COLOR, "COLOR", 0, "Color", ""},
- {MTEX_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
- {MTEX_LIN_LIGHT , "LINEAR_LIGHT", 0, "Linear Light", ""},
+ {MTEX_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
+ {MTEX_LIN_LIGHT , "LINEAR_LIGHT", 0, "Linear Light", ""},
{0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
@@ -117,7 +117,7 @@ static StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
switch (tex->type) {
case TEX_BLEND:
- return &RNA_BlendTexture;
+ return &RNA_BlendTexture;
case TEX_CLOUDS:
return &RNA_CloudsTexture;
case TEX_DISTNOISE:
@@ -224,17 +224,17 @@ void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN
DAG_id_tag_update(id, 0);
switch (GS(id->name)) {
- case ID_MA:
+ case ID_MA:
WM_main_add_notifier(NC_MATERIAL|ND_SHADING, id);
WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, id);
break;
- case ID_WO:
+ case ID_WO:
WM_main_add_notifier(NC_WORLD, id);
break;
- case ID_LA:
+ case ID_LA:
WM_main_add_notifier(NC_LAMP|ND_LIGHTING, id);
break;
- case ID_BR:
+ case ID_BR:
WM_main_add_notifier(NC_BRUSH, id);
break;
case ID_PA:
@@ -330,7 +330,8 @@ static int rna_TextureSlot_output_node_get(PointerRNA *ptr)
}
-static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *free)
{
MTex *mtex = ptr->data;
Tex *tex = mtex->tex;
@@ -472,7 +473,8 @@ static void rna_def_texmapping(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Location", "");
RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); /* Not PROP_XYZ, this is now in radians, no more degrees */
+ /* Not PROP_XYZ, this is now in radians, no more degrees */
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
RNA_def_property_float_sdna(prop, NULL, "rot");
RNA_def_property_ui_text(prop, "Rotation", "");
RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
@@ -649,7 +651,8 @@ static void rna_def_mtex(BlenderRNA *brna)
prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "def_var");
RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Default Value", "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
+ RNA_def_property_ui_text(prop, "Default Value",
+ "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
prop = RNA_def_property(srna, "output_node", PROP_ENUM, PROP_NONE);
@@ -660,7 +663,7 @@ static void rna_def_mtex(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
}
-static void rna_def_filter_common(StructRNA *srna)
+static void rna_def_filter_common(StructRNA *srna)
{
PropertyRNA *prop;
@@ -685,14 +688,16 @@ static void rna_def_filter_common(StructRNA *srna)
RNA_def_property_int_sdna(prop, NULL, "afmax");
RNA_def_property_range(prop, 1, 256);
RNA_def_property_ui_text(prop, "Filter Probes",
- "Maximum number of samples (higher gives less blur at distant/oblique angles, but is also slower)");
+ "Maximum number of samples (higher gives less blur at distant/oblique angles, "
+ "but is also slower)");
RNA_def_property_update(prop, 0, "rna_Texture_update");
prop = RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "afmax");
RNA_def_property_range(prop, 1, 256);
RNA_def_property_ui_text(prop, "Filter Eccentricity",
- "Maximum eccentricity (higher gives less blur at distant/oblique angles, but is also slower)");
+ "Maximum eccentricity (higher gives less blur at distant/oblique angles, "
+ "but is also slower)");
RNA_def_property_update(prop, 0, "rna_Texture_update");
prop = RNA_def_property(srna, "use_filter_size_min", PROP_BOOLEAN, PROP_NONE);
@@ -726,7 +731,8 @@ static void rna_def_environment_map(BlenderRNA *brna)
srna = RNA_def_struct(brna, "EnvironmentMap", NULL);
RNA_def_struct_sdna(srna, "EnvMap");
- RNA_def_struct_ui_text(srna, "EnvironmentMap", "Environment map created by the renderer and cached for subsequent renders");
+ RNA_def_struct_ui_text(srna, "EnvironmentMap",
+ "Environment map created by the renderer and cached for subsequent renders");
prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "stype");
@@ -770,7 +776,8 @@ static void rna_def_environment_map(BlenderRNA *brna)
prop = RNA_def_property(srna, "layers_ignore", PROP_BOOLEAN, PROP_LAYER_MEMBER);
RNA_def_property_boolean_sdna(prop, NULL, "notlay", 1);
RNA_def_property_array(prop, 20);
- RNA_def_property_ui_text(prop, "Ignore Layers", "Hide objects on these layers when generating the Environment Map");
+ RNA_def_property_ui_text(prop, "Ignore Layers",
+ "Hide objects on these layers when generating the Environment Map");
RNA_def_property_update(prop, 0, "rna_Texture_update");
prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
@@ -1050,7 +1057,8 @@ static void rna_def_texture_blend(BlenderRNA *brna)
{TEX_EASE, "EASING", 0, "Easing", "Create a progression easing from one step to the next"},
{TEX_DIAG, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
{TEX_SPHERE, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
- {TEX_HALO, "QUADRATIC_SPHERE", 0, "Quadratic sphere", "Create a quadratic progression in the shape of a sphere"},
+ {TEX_HALO, "QUADRATIC_SPHERE", 0, "Quadratic sphere",
+ "Create a quadratic progression in the shape of a sphere"},
{TEX_RAD, "RADIAL", 0, "Radial", "Create a radial progression"},
{0, NULL, 0, NULL, NULL}};
@@ -1228,7 +1236,7 @@ static void rna_def_texture_image(BlenderRNA *brna)
#if 0
/* XXX: did this as an array, but needs better descriptions than "1 2 3 4"
- perhaps a new subtype could be added?
+ perhaps a new subtype could be added?
--I actually used single values for this, maybe change later with a RNA_Rect thing? */
prop = RNA_def_property(srna, "crop_rectangle", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "cropxmin");
@@ -1276,7 +1284,8 @@ static void rna_def_texture_image(BlenderRNA *brna)
prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
+ RNA_def_property_ui_text(prop, "Image User",
+ "Parameters defining which layer, pass and frame of the image is displayed");
RNA_def_property_update(prop, 0, "rna_Texture_update");
/* Normal Map */
@@ -1321,7 +1330,8 @@ static void rna_def_texture_environment_map(BlenderRNA *brna)
prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
+ RNA_def_property_ui_text(prop, "Image User",
+ "Parameters defining which layer, pass and frame of the image is displayed");
RNA_def_property_update(prop, 0, "rna_Texture_update");
rna_def_filter_common(srna);
@@ -1481,7 +1491,8 @@ static void rna_def_texture_voronoi(BlenderRNA *brna)
prop = RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "vn_distm");
RNA_def_property_enum_items(prop, prop_distance_metric_items);
- RNA_def_property_ui_text(prop, "Distance Metric", "Algorithm used to calculate distance of sample points to feature points");
+ RNA_def_property_ui_text(prop, "Distance Metric",
+ "Algorithm used to calculate distance of sample points to feature points");
RNA_def_property_update(prop, 0, "rna_Texture_update");
prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
@@ -1593,8 +1604,10 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem turbulence_influence_items[] = {
- {TEX_PD_NOISE_STATIC, "STATIC", 0, "Static", "Noise patterns will remain unchanged, faster and suitable for stills"},
- {TEX_PD_NOISE_VEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", "Turbulent noise driven by particle velocity"},
+ {TEX_PD_NOISE_STATIC, "STATIC", 0, "Static",
+ "Noise patterns will remain unchanged, faster and suitable for stills"},
+ {TEX_PD_NOISE_VEL, "PARTICLE_VELOCITY", 0, "Particle Velocity",
+ "Turbulent noise driven by particle velocity"},
{TEX_PD_NOISE_AGE, "PARTICLE_AGE", 0, "Particle Age",
"Turbulent noise driven by the particle's age between birth and death"},
{TEX_PD_NOISE_TIME, "GLOBAL_TIME", 0, "Global Time", "Turbulent noise driven by the global current frame"},
@@ -1743,18 +1756,21 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem interpolation_type_items[] = {
- {TEX_VD_NEARESTNEIGHBOR, "NEREASTNEIGHBOR", 0, "Nearest Neighbor", "No interpolation, fast but blocky and low quality"},
+ {TEX_VD_NEARESTNEIGHBOR, "NEREASTNEIGHBOR", 0, "Nearest Neighbor",
+ "No interpolation, fast but blocky and low quality"},
{TEX_VD_LINEAR, "TRILINEAR", 0, "Linear", "Good smoothness and speed"},
{TEX_VD_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Mid-range quality and speed"},
{TEX_VD_TRICUBIC_CATROM, "TRICUBIC_CATROM", 0, "Cubic Catmull-Rom", "High quality interpolation, but slower"},
- {TEX_VD_TRICUBIC_BSPLINE, "TRICUBIC_BSPLINE", 0, "Cubic B-Spline", "Smoothed high quality interpolation, but slower"},
+ {TEX_VD_TRICUBIC_BSPLINE, "TRICUBIC_BSPLINE", 0, "Cubic B-Spline",
+ "Smoothed high quality interpolation, but slower"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem file_format_items[] = {
{TEX_VD_BLENDERVOXEL, "BLENDER_VOXEL", 0, "Blender Voxel", "Default binary voxel file format"},
{TEX_VD_RAW_8BIT, "RAW_8BIT", 0, "8 bit RAW", "8 bit greyscale binary data"},
/*{TEX_VD_RAW_16BIT, "RAW_16BIT", 0, "16 bit RAW", ""}, */
- {TEX_VD_IMAGE_SEQUENCE, "IMAGE_SEQUENCE", 0, "Image Sequence", "Generate voxels from a sequence of image slices"},
+ {TEX_VD_IMAGE_SEQUENCE, "IMAGE_SEQUENCE", 0, "Image Sequence",
+ "Generate voxels from a sequence of image slices"},
{TEX_VD_SMOKE, "SMOKE", 0, "Smoke", "Render voxels from a Blender smoke simulation"},
{0, NULL, 0, NULL, NULL}};
@@ -1853,7 +1869,8 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna)
prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
+ RNA_def_property_ui_text(prop, "Image User",
+ "Parameters defining which layer, pass and frame of the image is displayed");
RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
}
diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c
index a3176ae4d34..034696b43c5 100644
--- a/source/blender/makesrna/intern/rna_texture_api.c
+++ b/source/blender/makesrna/intern/rna_texture_api.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
@@ -43,7 +43,8 @@
#include "RE_pipeline.h"
#include "RE_shader_ext.h"
-void save_envmap(struct EnvMap *env, bContext *C, ReportList *reports, const char* filepath, struct Scene *scene, float layout[12])
+void save_envmap(struct EnvMap *env, bContext *C, ReportList *reports, const char* filepath,
+ struct Scene *scene, float layout[12])
{
if (scene == NULL) {
scene = CTX_data_scene(C);
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index d2385daa526..70af5599a15 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -227,10 +227,10 @@ static void rna_tracking_trackerAlgorithm_update(Main *UNUSED(bmain), Scene *UNU
{
MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
- if (track->tracker == TRACKER_KLT)
- BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
- else
- BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
+ if (track->tracker == TRACKER_KLT)
+ BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
+ else
+ BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
}
static void rna_tracking_trackerPyramid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
@@ -485,7 +485,8 @@ void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int framenr)
#else
static EnumPropertyItem tracker_items[] = {
- {TRACKER_KLT, "KLT", 0, "KLT", "Kanade–Lucas–Tomasi tracker which works with most of video clips, a bit slower than SAD"},
+ {TRACKER_KLT, "KLT", 0, "KLT",
+ "Kanade–Lucas–Tomasi tracker which works with most of video clips, a bit slower than SAD"},
{TRACKER_SAD, "SAD", 0, "SAD", "Sum of Absolute Differences tracker which can be used when KLT tracker fails"},
{TRACKER_HYBRID, "Hybrid", 0, "Hybrid", "A hybrid tracker that uses SAD for rough tracking, KLT for refinement."},
{0, NULL, 0, NULL, NULL}};
@@ -520,17 +521,21 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
static EnumPropertyItem refine_items[] = {
{0, "NONE", 0, "Nothing", "Do not refine camera intrinsics"},
{REFINE_FOCAL_LENGTH, "FOCAL_LENGTH", 0, "Focal Length", "Refine focal length"},
- {REFINE_FOCAL_LENGTH|REFINE_RADIAL_DISTORTION_K1, "FOCAL_LENGTH_RADIAL_K1", 0, "Focal length, K1", "Refine focal length and radial distortion K1"},
+ {REFINE_FOCAL_LENGTH|REFINE_RADIAL_DISTORTION_K1, "FOCAL_LENGTH_RADIAL_K1", 0, "Focal length, K1",
+ "Refine focal length and radial distortion K1"},
{REFINE_FOCAL_LENGTH|
REFINE_RADIAL_DISTORTION_K1|
- REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_RADIAL_K1_K2", 0, "Focal length, K1, K2", "Refine focal length and radial distortion K1 and K2"},
+ REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_RADIAL_K1_K2", 0, "Focal length, K1, K2",
+ "Refine focal length and radial distortion K1 and K2"},
{REFINE_FOCAL_LENGTH|
REFINE_PRINCIPAL_POINT|
REFINE_RADIAL_DISTORTION_K1|
- REFINE_RADIAL_DISTORTION_K2,
- "FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2", 0, "Focal Length, Optical Center, K1, K2", "Refine focal length, optical center and radial distortion K1 and K2"},
+ REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2", 0,
+ "Focal Length, Optical Center, K1, K2",
+ "Refine focal length, optical center and radial distortion K1 and K2"},
{REFINE_FOCAL_LENGTH|
- REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Optical Center", "Refine focal length and optical center"},
+ REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Optical Center",
+ "Refine focal length and optical center"},
{0, NULL, 0, NULL, NULL}
};
@@ -541,7 +546,9 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
prop = RNA_def_property(srna, "speed", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, speed_items);
- RNA_def_property_ui_text(prop, "Speed", "Limit speed of tracking to make visual feedback easier (this does not affect the tracking quality)");
+ RNA_def_property_ui_text(prop, "Speed",
+ "Limit speed of tracking to make visual feedback easier "
+ "(this does not affect the tracking quality)");
/* keyframe_a */
prop = RNA_def_property(srna, "keyframe_a", PROP_INT, PROP_NONE);
@@ -576,7 +583,8 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_int_sdna(prop, NULL, "clean_frames");
RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Tracked Frames", "Effect on tracks which are tracked less than the specified amount of frames");
+ RNA_def_property_ui_text(prop, "Tracked Frames",
+ "Effect on tracks which are tracked less than the specified amount of frames");
/* re-projection error */
prop = RNA_def_property(srna, "clean_error", PROP_FLOAT, PROP_NONE);
@@ -611,7 +619,8 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_sdna(prop, NULL, "default_pattern_match");
RNA_def_property_enum_items(prop, pattern_match_items);
- RNA_def_property_ui_text(prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame");
+ RNA_def_property_ui_text(prop, "Pattern Match",
+ "Track pattern from given frame when tracking marker to next frame");
/* margin */
prop = RNA_def_property(srna, "default_margin", PROP_INT, PROP_NONE);
@@ -644,7 +653,9 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "default_minimum_correlation");
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Correlation", "Default minimal value of correlation between matched pattern and reference which is still treated as successful tracking");
+ RNA_def_property_ui_text(prop, "Correlation",
+ "Default minimal value of correlation between matched pattern and reference "
+ "which is still treated as successful tracking");
/* default pattern size */
prop = RNA_def_property(srna, "default_pattern_size", PROP_INT, PROP_NONE);
@@ -824,7 +835,7 @@ static void rna_def_trackingMarkers(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "find_frame", "rna_trackingMarkers_find_frame");
RNA_def_function_ui_description(func, "Get marker for specified frame");
parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
- "Frame number to find marker for", MINFRAME, MAXFRAME);
+ "Frame number to find marker for", MINFRAME, MAXFRAME);
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Marker for specified frame");
RNA_def_function_return(func, parm);
@@ -832,10 +843,11 @@ static void rna_def_trackingMarkers(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "insert_frame", "rna_trackingMarkers_insert_frame");
RNA_def_function_ui_description(func, "Add a number of tracks to this movie clip");
parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
- "Frame number to insert marker to", MINFRAME, MAXFRAME);
+ "Frame number to insert marker to", MINFRAME, MAXFRAME);
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_float_vector(func, "co", 2, 0, -1.0, 1.0, "Coordinate",
- "Place new marker at the given frame using specified in normalized space coordinates", -1.0, 1.0);
+ "Place new marker at the given frame using specified in normalized space coordinates",
+ -1.0, 1.0);
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Newly created marker");
RNA_def_function_return(func, parm);
@@ -843,7 +855,7 @@ static void rna_def_trackingMarkers(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "delete_frame", "rna_trackingMarkers_delete_frame");
RNA_def_function_ui_description(func, "Delete marker at specified frame");
parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
- "Frame number to delete marker from", MINFRAME, MAXFRAME);
+ "Frame number to delete marker from", MINFRAME, MAXFRAME);
RNA_def_property_flag(parm, PROP_REQUIRED);
}
@@ -873,7 +885,9 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
RNA_def_property_float_sdna(prop, NULL, "pat_min");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Pattern Min", "Left-bottom corner of pattern area in normalized coordinates relative to marker position");
+ RNA_def_property_ui_text(prop, "Pattern Min",
+ "Left-bottom corner of pattern area in normalized coordinates relative "
+ "to marker position");
RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update");
prop = RNA_def_property(srna, "pattern_max", PROP_FLOAT, PROP_TRANSLATION);
@@ -881,7 +895,9 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
RNA_def_property_float_sdna(prop, NULL, "pat_max");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Pattern Max", "Right-bottom corner of pattern area in normalized coordinates relative to marker position");
+ RNA_def_property_ui_text(prop, "Pattern Max",
+ "Right-bottom corner of pattern area in normalized coordinates relative "
+ "to marker position");
RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update");
/* Search */
@@ -890,7 +906,9 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
RNA_def_property_float_sdna(prop, NULL, "search_min");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Search Min", "Left-bottom corner of search area in normalized coordinates relative to marker position");
+ RNA_def_property_ui_text(prop, "Search Min",
+ "Left-bottom corner of search area in normalized coordinates relative "
+ "to marker position");
RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update");
prop = RNA_def_property(srna, "search_max", PROP_FLOAT, PROP_TRANSLATION);
@@ -898,7 +916,9 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
RNA_def_property_float_sdna(prop, NULL, "search_max");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Search Max", "Right-bottom corner of search area in normalized coordinates relative to marker position");
+ RNA_def_property_ui_text(prop, "Search Max",
+ "Right-bottom corner of search area in normalized coordinates relative "
+ "to marker position");
RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update");
/* limit frames */
@@ -915,7 +935,8 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "pattern_match");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, pattern_match_items);
- RNA_def_property_ui_text(prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame");
+ RNA_def_property_ui_text(prop, "Pattern Match",
+ "Track pattern from given frame when tracking marker to next frame");
/* margin */
prop = RNA_def_property(srna, "margin", PROP_INT, PROP_NONE);
@@ -948,7 +969,9 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "minimum_correlation");
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Correlation", "Minimal value of correlation between matched pattern and reference which is still treated as successful tracking");
+ RNA_def_property_ui_text(prop, "Correlation",
+ "Minimal value of correlation between matched pattern and reference "
+ "which is still treated as successful tracking");
/* markers */
prop = RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
@@ -1049,7 +1072,8 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_array(prop, 3);
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Color", "Color of the track in the Movie Track Editor and the 3D viewport after a solve");
+ RNA_def_property_ui_text(prop, "Color",
+ "Color of the track in the Movie Track Editor and the 3D viewport after a solve");
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
/* average error */
@@ -1083,7 +1107,9 @@ static void rna_def_trackingStabilization(BlenderRNA *brna)
/* tracks */
prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_tracking_stabTracks_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_tracking_stabTracks_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "MovieTrackingTrack");
RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks used for stabilization");
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
@@ -1099,14 +1125,17 @@ static void rna_def_trackingStabilization(BlenderRNA *brna)
prop = RNA_def_property(srna, "active_track_index", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "act_track");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, "rna_tracking_stabTracks_active_index_get", "rna_tracking_stabTracks_active_index_set", "rna_tracking_stabTracks_active_index_range");
+ RNA_def_property_int_funcs(prop, "rna_tracking_stabTracks_active_index_get",
+ "rna_tracking_stabTracks_active_index_set",
+ "rna_tracking_stabTracks_active_index_range");
RNA_def_property_ui_text(prop, "Active Track Index", "Index of active track in stabilization tracks list");
/* autoscale */
prop = RNA_def_property(srna, "use_autoscale", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_AUTOSCALE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Autoscale", "Automatically scale footage to cover unfilled areas when stabilizating");
+ RNA_def_property_ui_text(prop, "Autoscale",
+ "Automatically scale footage to cover unfilled areas when stabilizating");
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
/* max scale */
@@ -1158,7 +1187,8 @@ static void rna_def_reconstructedCamera(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "MovieReconstructedCamera", NULL);
- RNA_def_struct_ui_text(srna, "Movie tracking reconstructed camera data", "Match-moving reconstructed camera data from tracker");
+ RNA_def_struct_ui_text(srna, "Movie tracking reconstructed camera data",
+ "Match-moving reconstructed camera data from tracker");
/* frame */
prop = RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
@@ -1188,7 +1218,8 @@ static void rna_def_trackingReconstruction(BlenderRNA *brna)
rna_def_reconstructedCamera(brna);
srna = RNA_def_struct(brna, "MovieTrackingReconstruction", NULL);
- RNA_def_struct_ui_text(srna, "Movie tracking reconstruction data", "Match-moving reconstruction data from tracker");
+ RNA_def_struct_ui_text(srna, "Movie tracking reconstruction data",
+ "Match-moving reconstruction data from tracker");
/* is_valid */
prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
@@ -1282,7 +1313,9 @@ static void rna_def_trackingObject(BlenderRNA *brna)
/* tracks */
prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_trackingObject_tracks_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_trackingObject_tracks_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "MovieTrackingTrack");
RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks in this tracking data object");
RNA_def_property_srna(prop, "MovieTrackingObjectTracks");
@@ -1328,7 +1361,8 @@ static void rna_def_trackingObjects(BlenderRNA *brna, PropertyRNA *cprop)
/* active object */
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "MovieTrackingObject");
- RNA_def_property_pointer_funcs(prop, "rna_tracking_active_object_get", "rna_tracking_active_object_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_tracking_active_object_get",
+ "rna_tracking_active_object_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
RNA_def_property_ui_text(prop, "Active Object", "Active object in this tracking data object");
}
@@ -1361,7 +1395,9 @@ static void rna_def_tracking(BlenderRNA *brna)
/* tracks */
prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_trackingTracks_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_trackingTracks_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "MovieTrackingTrack");
RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks in this tracking data object");
RNA_def_property_srna(prop, "MovieTrackingTracks");
@@ -1376,7 +1412,9 @@ static void rna_def_tracking(BlenderRNA *brna)
/* objects */
prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_trackingObjects_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_trackingObjects_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "MovieTrackingObject");
RNA_def_property_ui_text(prop, "Objects", "Collection of objects in this tracking data object");
rna_def_trackingObjects(brna, prop);
@@ -1385,7 +1423,8 @@ static void rna_def_tracking(BlenderRNA *brna)
prop = RNA_def_property(srna, "active_object_index", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "objectnr");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, "rna_tracking_active_object_index_get", "rna_tracking_active_object_index_set", "rna_tracking_active_object_index_range");
+ RNA_def_property_int_funcs(prop, "rna_tracking_active_object_index_get", "rna_tracking_active_object_index_set",
+ "rna_tracking_active_object_index_range");
RNA_def_property_ui_text(prop, "Active Object Index", "Index of active object");
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 7258e6353da..a70eac58142 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -214,7 +214,7 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat
pt = MEM_callocN(sizeof(PanelType), "python buttons panel");
memcpy(pt, &dummypt, sizeof(dummypt));
- pt->ext.srna = RNA_def_struct(&BLENDER_RNA, pt->idname, "Panel");
+ pt->ext.srna = RNA_def_struct(&BLENDER_RNA, pt->idname, "Panel");
pt->ext.data = data;
pt->ext.call = call;
pt->ext.free = free;
@@ -329,7 +329,7 @@ static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *da
ht = MEM_callocN(sizeof(HeaderType), "python buttons header");
memcpy(ht, &dummyht, sizeof(dummyht));
- ht->ext.srna = RNA_def_struct(&BLENDER_RNA, ht->idname, "Header");
+ ht->ext.srna = RNA_def_struct(&BLENDER_RNA, ht->idname, "Header");
ht->ext.data = data;
ht->ext.call = call;
ht->ext.free = free;
@@ -462,7 +462,7 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data
mt->description = buf;
}
- mt->ext.srna = RNA_def_struct(&BLENDER_RNA, mt->idname, "Menu");
+ mt->ext.srna = RNA_def_struct(&BLENDER_RNA, mt->idname, "Menu");
mt->ext.data = data;
mt->ext.call = call;
mt->ext.free = free;
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index d390bedaa04..b4b8ee07924 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
@@ -38,7 +38,9 @@
#ifdef RNA_RUNTIME
-static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, int icon, int expand, int slider, int toggle, int icon_only, int event, int full_event, int emboss, int index)
+static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, int icon,
+ int expand, int slider, int toggle, int icon_only, int event, int full_event,
+ int emboss, int index)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
int flag = 0;
@@ -134,13 +136,17 @@ void RNA_api_ui_layout(StructRNA *srna)
func = RNA_def_function(srna, "row", "uiLayoutRow");
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
RNA_def_function_return(func, parm);
- RNA_def_function_ui_description(func, "Sub-layout. Items placed in this sublayout are placed next to each other in a row");
+ RNA_def_function_ui_description(func,
+ "Sub-layout. Items placed in this sublayout are placed next to each other "
+ "in a row");
RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");
func = RNA_def_function(srna, "column", "uiLayoutColumn");
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
RNA_def_function_return(func, parm);
- RNA_def_function_ui_description(func, "Sub-layout. Items placed in this sublayout are placed under each other in a column");
+ RNA_def_function_ui_description(func,
+ "Sub-layout. Items placed in this sublayout are placed under each other "
+ "in a column");
RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");
func = RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow");
@@ -428,9 +434,11 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm = RNA_def_pointer(func, "active_data", "AnyType", "", "Data from which to take property for the active element");
+ parm = RNA_def_pointer(func, "active_data", "AnyType", "",
+ "Data from which to take property for the active element");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
- parm = RNA_def_string(func, "active_property", "", 0, "", "Identifier of property in data, for the active element");
+ parm = RNA_def_string(func, "active_property", "", 0, "",
+ "Identifier of property in data, for the active element");
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_string(func, "prop_list", "", 0, "",
"Identifier of a string property in each data member, specifying which "
@@ -482,5 +490,5 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_string(func, "string", "", 1024*1024, "Descr", "DESCR");
RNA_def_function_return(func, parm);
}
-#endif
+#endif
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 68e713ef7c5..1e6a8d92a7a 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -199,7 +199,7 @@ static void rna_userdef_timecode_style_set(PointerRNA *ptr, int value)
/* set the timecode style */
userdef->timecode_style = value;
- /* adjust the v2d gridsize if needed so that timecodes don't overlap
+ /* adjust the v2d gridsize if needed so that timecodes don't overlap
* NOTE: most of these have been hand-picked to avoid overlaps while still keeping
* things from getting too blown out
*/
@@ -331,7 +331,8 @@ static PointerRNA rna_Theme_space_list_generic_get(PointerRNA *ptr)
#ifdef WITH_CYCLES
-static EnumPropertyItem *rna_userdef_compute_device_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_userdef_compute_device_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop), int *free)
{
EnumPropertyItem *item = NULL;
int totitem = 0;
@@ -357,7 +358,8 @@ static int rna_userdef_compute_device_get(PointerRNA *UNUSED(ptr))
return U.compute_device_id;
}
-static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop), int *free)
{
EnumPropertyItem tmp = {0, "", 0, "", ""};
EnumPropertyItem *item = NULL;
@@ -486,7 +488,7 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "ThemeFontStyle");
RNA_def_property_ui_text(prop, "Group Label Font", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
-*/
+*/
prop = RNA_def_property(srna, "widget_label", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "widgetlabel");
@@ -696,6 +698,10 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Menu Backdrop Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+ prop = RNA_def_property(srna, "wcol_tooltip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Tooltip Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "wcol_menu_item", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
@@ -784,7 +790,7 @@ static void rna_def_userdef_theme_space_generic(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_userdef_update");
/* buttons */
-/* if(! ELEM(spacetype, SPACE_BUTS, SPACE_OUTLINER)) { */
+/* if (! ELEM(spacetype, SPACE_BUTS, SPACE_OUTLINER)) { */
prop = RNA_def_property(srna, "button", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Region Background", "");
@@ -1089,6 +1095,16 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Speaker", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "camera", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Camera", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "empty", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Empty", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "object_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "select");
@@ -1728,6 +1744,12 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Movie Strip", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+ prop = RNA_def_property(srna, "movieclip_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "movieclip");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Clip Strip", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
prop = RNA_def_property(srna, "image_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "image");
RNA_def_property_array(prop, 3);
@@ -1787,6 +1809,12 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Draw Action", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "preview_back", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "preview_back");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Preview Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
}
static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
@@ -1962,7 +1990,8 @@ static void rna_def_userdef_theme_colorset(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_colored_constraints", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", TH_WIRECOLOR_CONSTCOLS);
- RNA_def_property_ui_text(prop, "Colored Constraints", "Allow the use of colors indicating constraints/keyed status");
+ RNA_def_property_ui_text(prop, "Colored Constraints",
+ "Allow the use of colors indicating constraints/keyed status");
RNA_def_property_update(prop, 0, "rna_userdef_update");
}
@@ -2001,7 +2030,7 @@ static void rna_def_userdef_theme_space_clip(BlenderRNA *brna)
prop = RNA_def_property(srna, "selected_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "sel_marker");
RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Selected Marker", "Color of sleected marker");
+ RNA_def_property_ui_text(prop, "Selected Marker", "Color of selected marker");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "disabled_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
@@ -2090,7 +2119,8 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Name", "Name of the theme");
RNA_def_struct_name_property(srna, prop);
- RNA_def_property_flag(prop, PROP_SKIP_SAVE); /* XXX: for now putting this in presets is silly - its just Default */
+ /* XXX: for now putting this in presets is silly - its just Default */
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_property(srna, "theme_area", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "active_theme_area");
@@ -2308,7 +2338,8 @@ static void rna_def_userdef_view(BlenderRNA *brna)
{USER_TIMECODE_MILLISECONDS, "MILLISECONDS", 0, "Compact with Milliseconds",
"Similar to SMPTE (Compact), except that instead of frames, "
"milliseconds are shown instead"},
- {USER_TIMECODE_SECONDS_ONLY, "SECONDS_ONLY", 0, "Only Seconds", "Direct conversion of frame numbers to seconds"},
+ {USER_TIMECODE_SECONDS_ONLY, "SECONDS_ONLY", 0, "Only Seconds",
+ "Direct conversion of frame numbers to seconds"},
{0, NULL, 0, NULL, NULL}};
PropertyRNA *prop;
@@ -2379,6 +2410,11 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Sub Level Menu Open Delay",
"Time delay in 1/10 seconds before automatically opening sub level menus");
+ prop = RNA_def_property(srna, "quit_dialog", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_QUIT_PROMPT);
+ RNA_def_property_ui_text(prop, "Prompt Quit",
+ "Asks for confirmation when quitting through the window close button");
+
/* Toolbox click-hold delay */
prop = RNA_def_property(srna, "open_left_mouse_delay", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "tb_leftmouse");
@@ -2399,7 +2435,8 @@ static void rna_def_userdef_view(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_directional_menus", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_MENUFIXEDORDER);
RNA_def_property_ui_text(prop, "Contents Follow Opening Direction",
- "Otherwise menus, etc will always be top to bottom, left to right, no matter opening direction");
+ "Otherwise menus, etc will always be top to bottom, left to right, "
+ "no matter opening direction");
prop = RNA_def_property(srna, "use_global_pivot", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_LOCKAROUND);
@@ -2407,7 +2444,8 @@ static void rna_def_userdef_view(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_mouse_auto_depth", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_ZBUF);
- RNA_def_property_ui_text(prop, "Auto Depth", "Use the depth under the mouse to improve view pan/rotate/zoom functionality");
+ RNA_def_property_ui_text(prop, "Auto Depth",
+ "Use the depth under the mouse to improve view pan/rotate/zoom functionality");
prop = RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_CAM_LOCK_NO_PARENT);
@@ -2419,7 +2457,8 @@ static void rna_def_userdef_view(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_zoom_to_mouse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_TO_MOUSEPOS);
RNA_def_property_ui_text(prop, "Zoom To Mouse Position",
- "Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center");
+ "Zoom in towards the mouse pointer's position in the 3D view, "
+ "rather than the 2D window center");
/* view rotation */
prop = RNA_def_property(srna, "use_auto_perspective", PROP_BOOLEAN, PROP_NONE);
@@ -2435,7 +2474,8 @@ static void rna_def_userdef_view(BlenderRNA *brna)
/* mini axis */
prop = RNA_def_property(srna, "show_mini_axis", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_ROTVIEWICON);
- RNA_def_property_ui_text(prop, "Show Mini Axes", "Show a small rotating 3D axes in the bottom left corner of the 3D View");
+ RNA_def_property_ui_text(prop, "Show Mini Axes",
+ "Show a small rotating 3D axes in the bottom left corner of the 3D View");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "mini_axis_size", PROP_INT, PROP_NONE);
@@ -2522,7 +2562,8 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
static const EnumPropertyItem material_link_items[] = {
{0, "OBDATA", 0, "ObData", "Toggle whether the material is linked to object data or the object block"},
- {USER_MAT_ON_OB, "OBJECT", 0, "Object", "Toggle whether the material is linked to object data or the object block"},
+ {USER_MAT_ON_OB, "OBJECT", 0, "Object",
+ "Toggle whether the material is linked to object data or the object block"},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem object_align_items[] = {
@@ -2548,7 +2589,8 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
RNA_def_property_enum_items(prop, object_align_items);
RNA_def_property_ui_text(prop, "Align Object To",
- "When adding objects from a 3D View menu, either align them with that view or with the world");
+ "When adding objects from a 3D View menu, either align them with that view or "
+ "with the world");
prop = RNA_def_property(srna, "use_enter_edit_mode", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_ADD_EDITMODE);
@@ -2556,7 +2598,8 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_drag_immediately", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_RELEASECONFIRM);
- RNA_def_property_ui_text(prop, "Release confirms", "Moving things with a mouse drag confirms when releasing the button");
+ RNA_def_property_ui_text(prop, "Release confirms",
+ "Moving things with a mouse drag confirms when releasing the button");
/* Undo */
prop = RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE);
@@ -2572,13 +2615,15 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_global_undo", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_GLOBALUNDO);
RNA_def_property_ui_text(prop, "Global Undo",
- "Global undo works by keeping a full copy of the file itself in memory, so takes extra memory");
+ "Global undo works by keeping a full copy of the file itself in memory, "
+ "so takes extra memory");
- /* auto keyframing */
+ /* auto keyframing */
prop = RNA_def_property(srna, "use_auto_keying", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
RNA_def_property_ui_text(prop, "Auto Keying Enable",
- "Automatic keyframe insertion for Objects and Bones (default setting used for new Scenes)");
+ "Automatic keyframe insertion for Objects and Bones "
+ "(default setting used for new Scenes)");
RNA_def_property_ui_icon(prop, ICON_REC, 0);
prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
@@ -2590,7 +2635,8 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_keyframe_insert_available", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTAVAIL);
- RNA_def_property_ui_text(prop, "Auto Keyframe Insert Available", "Automatic keyframe insertion in available F-Curves");
+ RNA_def_property_ui_text(prop, "Auto Keyframe Insert Available",
+ "Automatic keyframe insertion in available F-Curves");
/* keyframing settings */
prop = RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
@@ -2622,13 +2668,23 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
/* frame numbers */
prop = RNA_def_property(srna, "use_negative_frames", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_NONEGFRAMES);
- RNA_def_property_ui_text(prop, "Allow Negative Frames", "Current frame number can be manually set to a negative value");
+ RNA_def_property_ui_text(prop, "Allow Negative Frames",
+ "Current frame number can be manually set to a negative value");
+
+ /* fcurve opacity */
+ prop = RNA_def_property(srna, "fcurve_unselected_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "fcu_inactive_alpha");
+ RNA_def_property_range(prop, 0.001f, 1.0f);
+ RNA_def_property_ui_text(prop, "Unselected F-Curve Visibility",
+ "Amount that unselected F-Curves stand out from the background (Graph Editor)");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
/* grease pencil */
prop = RNA_def_property(srna, "grease_pencil_manhattan_distance", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "gp_manhattendist");
RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Grease Pencil Manhattan Distance", "Pixels moved by mouse per axis when drawing stroke");
+ RNA_def_property_ui_text(prop, "Grease Pencil Manhattan Distance",
+ "Pixels moved by mouse per axis when drawing stroke");
prop = RNA_def_property(srna, "grease_pencil_euclidean_distance", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "gp_euclideandist");
@@ -2789,7 +2845,8 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{USER_DRAW_AUTOMATIC, "AUTOMATIC", 0, "Automatic", "Automatically set based on graphics card and driver"},
{USER_DRAW_TRIPLE, "TRIPLE_BUFFER", 0, "Triple Buffer",
"Use a third buffer for minimal redraws at the cost of more memory"},
- {USER_DRAW_OVERLAP, "OVERLAP", 0, "Overlap", "Redraw all overlapping regions, minimal memory usage but more redraws"},
+ {USER_DRAW_OVERLAP, "OVERLAP", 0, "Overlap",
+ "Redraw all overlapping regions, minimal memory usage but more redraws"},
{USER_DRAW_OVERLAP_FLIP, "OVERLAP_FLIP", 0, "Overlap Flip",
"Redraw all overlapping regions, minimal memory usage but more redraws "
"(for graphics drivers that do flipping)"},
@@ -2879,7 +2936,8 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "author", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "author");
RNA_def_property_string_maxlength(prop, 80);
- RNA_def_property_ui_text(prop, "Author", "Name that will be used in exported files when format supports such feature");
+ RNA_def_property_ui_text(prop, "Author",
+ "Name that will be used in exported files when format supports such feature");
/* Language Selection */
@@ -2920,7 +2978,8 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "coba_weight");
RNA_def_property_struct_type(prop, "ColorRamp");
- RNA_def_property_ui_text(prop, "Weight Color Range", "Color range used for weight visualization in weight painting mode");
+ RNA_def_property_ui_text(prop, "Weight Color Range",
+ "Color range used for weight visualization in weight painting mode");
RNA_def_property_update(prop, 0, "rna_UserDef_weight_color_update");
prop = RNA_def_property(srna, "color_picker_type", PROP_ENUM, PROP_NONE);
@@ -2970,7 +3029,8 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_mipmaps", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_MIPMAP);
RNA_def_property_ui_text(prop, "Mipmaps",
- "Scale textures for the 3D View (looks nicer but uses more memory and slows image reloading)");
+ "Scale textures for the 3D View (looks nicer but uses more memory and slows image "
+ "reloading)");
RNA_def_property_update(prop, 0, "rna_userdef_mipmap_update");
prop = RNA_def_property(srna, "use_16bit_textures", PROP_BOOLEAN, PROP_NONE);
@@ -2980,19 +3040,23 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_vertex_buffer_objects", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_VBO);
- RNA_def_property_ui_text(prop, "VBOs", "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering");
- RNA_def_property_update(prop, NC_WINDOW, NULL); /* this isnt essential but nice to check if VBO draws any differently */
+ RNA_def_property_ui_text(prop, "VBOs",
+ "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering");
+ /* this isn't essential but nice to check if VBO draws any differently */
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_AA);
- RNA_def_property_ui_text(prop, "Anti-aliasing", "Use anti-aliasing for the 3D view (may impact redraw performance)");
+ RNA_def_property_ui_text(prop, "Anti-aliasing",
+ "Use anti-aliasing for the 3D view (may impact redraw performance)");
prop = RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter");
RNA_def_property_enum_items(prop, anisotropic_items);
RNA_def_property_enum_default(prop, 1);
RNA_def_property_ui_text(prop, "Anisotropic Filter",
- "Quality of the anisotropic filtering (values greater than 1.0 enable anisotropic filtering)");
+ "Quality of the anisotropic filtering (values greater than 1.0 enable anisotropic "
+ "filtering)");
RNA_def_property_update(prop, 0, "rna_userdef_anisotropic_update");
prop = RNA_def_property(srna, "gl_texture_limit", PROP_ENUM, PROP_NONE);
@@ -3058,7 +3122,8 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "screencast_wait_time", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "scrcastwait");
RNA_def_property_range(prop, 50, 1000);
- RNA_def_property_ui_text(prop, "Wait Timer (ms)", "Time in milliseconds between each frame recorded for screencast");
+ RNA_def_property_ui_text(prop, "Wait Timer (ms)",
+ "Time in milliseconds between each frame recorded for screencast");
prop = RNA_def_property(srna, "use_text_antialiasing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "text_render", USER_TEXT_DISABLE_AA);
@@ -3100,7 +3165,8 @@ static void rna_def_userdef_input(BlenderRNA *brna)
static EnumPropertyItem view_zoom_styles[] = {
{USER_ZOOM_CONT, "CONTINUE", 0, "Continue", "Old style zoom, continues while moving mouse up or down"},
{USER_ZOOM_DOLLY, "DOLLY", 0, "Dolly", "Zoom in and out based on vertical mouse movement"},
- {USER_ZOOM_SCALE, "SCALE", 0, "Scale", "Zoom in and out like scaling the view, mouse movements relative to center"},
+ {USER_ZOOM_SCALE, "SCALE", 0, "Scale",
+ "Zoom in and out like scaling the view, mouse movements relative to center"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem view_zoom_axes[] = {
@@ -3142,18 +3208,21 @@ static void rna_def_userdef_input(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_mouse_continuous", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_CONTINUOUS_MOUSE);
RNA_def_property_ui_text(prop, "Continuous Grab",
- "Allow moving the mouse outside the view on some manipulations (transform, ui control drag)");
+ "Allow moving the mouse outside the view on some manipulations "
+ "(transform, ui control drag)");
/* tweak tablet & mouse preset */
prop = RNA_def_property(srna, "drag_threshold", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "dragthreshold");
RNA_def_property_range(prop, 3, 40);
- RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens");
+ RNA_def_property_ui_text(prop, "Drag Threshold",
+ "Amount of pixels you have to drag before dragging UI items happens");
prop = RNA_def_property(srna, "tweak_threshold", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "tweak_threshold");
RNA_def_property_range(prop, 3, 1024);
- RNA_def_property_ui_text(prop, "Tweak Threshold", "Number of pixels you have to drag before tweak event is triggered");
+ RNA_def_property_ui_text(prop, "Tweak Threshold",
+ "Number of pixels you have to drag before tweak event is triggered");
/* 3D mouse settings */
/* global options */
@@ -3163,11 +3232,12 @@ static void rna_def_userdef_input(BlenderRNA *brna)
prop = RNA_def_property(srna, "ndof_zoom_updown", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ZOOM_UPDOWN);
- RNA_def_property_ui_text(prop, "Zoom = Up/Down", "Zoom using up/down on the device (otherwise forward/backward)");
+ RNA_def_property_ui_text(prop, "Zoom = Up/Down",
+ "Zoom using up/down on the device (otherwise forward/backward)");
prop = RNA_def_property(srna, "ndof_zoom_invert", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ZOOM_INVERT);
- RNA_def_property_ui_text(prop, "Invert Zoom", "Zoom using opposite direction");
+ RNA_def_property_ui_text(prop, "Invert Zoom", "Zoom using opposite direction");
/* 3D view */
prop = RNA_def_property(srna, "ndof_show_guide", PROP_BOOLEAN, PROP_NONE);
@@ -3232,7 +3302,8 @@ static void rna_def_userdef_input(BlenderRNA *brna)
/* middle mouse button */
prop = RNA_def_property(srna, "use_mouse_mmb_paste", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MMB_PASTE);
- RNA_def_property_ui_text(prop, "Middle Mouse Paste", "In text window, paste with middle mouse button instead of panning");
+ RNA_def_property_ui_text(prop, "Middle Mouse Paste",
+ "In text window, paste with middle mouse button instead of panning");
prop = RNA_def_property(srna, "invert_zoom_wheel", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_WHEELZOOMDIR);
@@ -3275,7 +3346,8 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_filter_files", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_FILTERFILEEXTS);
- RNA_def_property_ui_text(prop, "Filter File Extensions", "Display only files with extensions in the image select window");
+ RNA_def_property_ui_text(prop, "Filter File Extensions",
+ "Display only files with extensions in the image select window");
prop = RNA_def_property(srna, "hide_recent_locations", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_RECENT);
@@ -3311,11 +3383,13 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
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");
+ 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", "The default directory for rendering output, for new scenes");
+ RNA_def_property_ui_text(prop, "Render Output Directory",
+ "The default directory for rendering output, for new scenes");
prop = RNA_def_property(srna, "script_directory", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_sdna(prop, NULL, "pythondir");
@@ -3364,7 +3438,8 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
prop = RNA_def_property(srna, "auto_save_time", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "savetime");
RNA_def_property_range(prop, 1, 60);
- RNA_def_property_ui_text(prop, "Auto Save Time", "The time (in minutes) to wait between automatic temporary saves");
+ RNA_def_property_ui_text(prop, "Auto Save Time",
+ "The time (in minutes) to wait between automatic temporary saves");
RNA_def_property_update(prop, 0, "rna_userdef_autosave_update");
prop = RNA_def_property(srna, "recent_files", PROP_INT, PROP_NONE);
@@ -3373,7 +3448,8 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_save_preview_images", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_SAVE_PREVIEWS);
- RNA_def_property_ui_text(prop, "Save Preview Images", "Enables automatic saving of preview images in the .blend file");
+ RNA_def_property_ui_text(prop, "Save Preview Images",
+ "Enables automatic saving of preview images in the .blend file");
}
void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)
@@ -3427,7 +3503,8 @@ void RNA_def_userdef(BlenderRNA *brna)
prop = RNA_def_property(srna, "active_section", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "userpref");
RNA_def_property_enum_items(prop, user_pref_sections);
- RNA_def_property_ui_text(prop, "Active Section", "Active section of the user preferences shown in the user interface");
+ RNA_def_property_ui_text(prop, "Active Section",
+ "Active section of the user preferences shown in the user interface");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "themes", PROP_COLLECTION, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 18d599ca283..80dad69f124 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -357,7 +357,7 @@ EnumPropertyItem event_type_items[] = {
{NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "NDOF Button A", ""},
{NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "NDOF Button B", ""},
{NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "NDOF Button C", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}};
EnumPropertyItem keymap_propvalue_items[] = {
{0, "NONE", 0, "", ""},
@@ -377,7 +377,9 @@ EnumPropertyItem operator_flag_items[] = {
{OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"},
{OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"},
{OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"},
- {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", "Use so the operator grabs the mouse focus, enables wrapping when continuous grab is enabled"},
+ {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer",
+ "Use so the operator grabs the mouse focus, enables wrapping when continuous grab "
+ "is enabled"},
{OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"},
{OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"},
{0, NULL, 0, NULL, NULL}};
@@ -386,7 +388,8 @@ EnumPropertyItem operator_return_items[] = {
{OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", "Keep the operator running with blender"},
{OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", "When no action has been taken, operator exits"},
{OPERATOR_FINISHED, "FINISHED", 0, "Finished", "When the operator is complete, operator exits"},
- {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"}, /* used as a flag */
+ /* used as a flag */
+ {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"},
{0, NULL, 0, NULL, NULL}};
/* flag/enum */
@@ -498,7 +501,7 @@ static int rna_Event_ascii_length(PointerRNA *ptr)
static void rna_Event_unicode_get(PointerRNA *ptr, char *value)
{
- /* utf8 buf isnt \0 terminated */
+ /* utf8 buf isn't \0 terminated */
wmEvent *event = (wmEvent*)ptr->data;
size_t len = 0;
@@ -517,7 +520,8 @@ static int rna_Event_unicode_length(PointerRNA *ptr)
wmEvent *event = (wmEvent*)ptr->data;
if (event->utf8_buf[0]) {
- return BLI_str_utf8_size(event->utf8_buf); /* invalid value is checked on assignment so we dont need to account for this */
+ /* invalid value is checked on assignment so we don't need to account for this */
+ return BLI_str_utf8_size(event->utf8_buf);
}
else {
return 0;
@@ -606,7 +610,8 @@ static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
}
}
-static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
+ int *UNUSED(free))
{
int map_type = rna_wmKeyMapItem_map_type_get(ptr);
@@ -617,16 +622,21 @@ static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerR
else return event_type_items;
}
-static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
+ int *UNUSED(free))
{
int map_type = rna_wmKeyMapItem_map_type_get(ptr);
- if (map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF) return event_keymouse_value_items;
- if (map_type == KMI_TYPE_TWEAK) return event_tweak_value_items;
- else return event_value_items;
+ if (map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF)
+ return event_keymouse_value_items;
+ if (map_type == KMI_TYPE_TWEAK)
+ return event_tweak_value_items;
+ else
+ return event_value_items;
}
-static EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop),
+ int *UNUSED(free))
{
wmWindowManager *wm = CTX_wm_manager(C);
wmKeyConfig *kc;
@@ -992,7 +1002,8 @@ void macro_wrapper(wmOperatorType *ot, void *userdata);
static char _operator_idname[OP_MAX_TYPENAME];
static char _operator_name[OP_MAX_TYPENAME];
static char _operator_descr[RNA_DYN_DESCR_MAX];
-static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *data, const char *identifier,
+ StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
wmOperatorType dummyot = {NULL};
wmOperator dummyop = {NULL};
@@ -1029,7 +1040,9 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
dot++;
}
else {
- BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s', invalid bl_idname '%s', at position %d", identifier, _operator_idname, i);
+ BKE_reportf(reports, RPT_ERROR,
+ "registering operator class: '%s', invalid bl_idname '%s', at position %d",
+ identifier, _operator_idname, i);
return NULL;
}
@@ -1039,13 +1052,14 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
if (i > ((int)sizeof(dummyop.idname)) - 3) {
BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s', invalid bl_idname '%s', "
"is too long, maximum length is %d", identifier, _operator_idname,
- (int)sizeof(dummyop.idname) - 3);
+ (int)sizeof(dummyop.idname) - 3);
return NULL;
}
if (dot != 1) {
- BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s', invalid bl_idname '%s', "
- "must contain 1 '.' character", identifier, _operator_idname);
+ BKE_reportf(reports, RPT_ERROR,
+ "registering operator class: '%s', invalid bl_idname '%s', must contain 1 '.' character",
+ identifier, _operator_idname);
return NULL;
}
}
@@ -1056,7 +1070,8 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
int namelen = strlen(_operator_name) + 1;
int desclen = strlen(_operator_descr) + 1;
char *ch;
- ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */
+ /* 2 terminators and 3 to convert a.b -> A_OT_b */
+ ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname");
WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */
dummyot.idname = ch;
ch += idlen;
@@ -1106,7 +1121,8 @@ void **rna_Operator_instance(PointerRNA *ptr)
return &op->py_instance;
}
-static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, void *data, const char *identifier,
+ StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
wmOperatorType dummyot = {NULL};
wmOperator dummyop = {NULL};
@@ -1130,7 +1146,8 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v
int namelen = strlen(_operator_name) + 1;
int desclen = strlen(_operator_descr) + 1;
char *ch;
- ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */
+ /* 2 terminators and 3 to convert a.b -> A_OT_b */
+ ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname");
WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */
dummyot.idname = ch;
ch += idlen;
@@ -1247,7 +1264,8 @@ static void rna_def_operator(BlenderRNA *brna)
prop = RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* this is 'virtual' property */
RNA_def_property_boolean_funcs(prop, "rna_Operator_has_reports_get", NULL);
- RNA_def_property_ui_text(prop, "Has Reports", "Operator has a set of reports (warnings and errors) from last execution");
+ RNA_def_property_ui_text(prop, "Has Reports",
+ "Operator has a set of reports (warnings and errors) from last execution");
prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "UILayout");
@@ -1255,7 +1273,8 @@ static void rna_def_operator(BlenderRNA *brna)
/* Registration */
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME-3); /* else it uses the pointer size!. -3 because '.' -> '_OT_' */
+ /* else it uses the pointer size!. -3 because '.' -> '_OT_' */
+ RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME-3);
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
@@ -1298,11 +1317,13 @@ static void rna_def_macro_operator(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "Macro", NULL);
- RNA_def_struct_ui_text(srna, "Macro Operator", "Storage of a macro operator being executed, or registered after execution");
+ RNA_def_struct_ui_text(srna, "Macro Operator",
+ "Storage of a macro operator being executed, or registered after execution");
RNA_def_struct_sdna(srna, "wmOperator");
RNA_def_struct_refine_func(srna, "rna_MacroOperator_refine");
#ifdef WITH_PYTHON
- RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister", "rna_Operator_instance");
+ RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister",
+ "rna_Operator_instance");
#endif
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
@@ -1471,7 +1492,7 @@ static void rna_def_event(BlenderRNA *brna)
prop = RNA_def_property(srna, "mouse_prev_y", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "prevy");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mouse Previous Y Position", "The window relative horizontal location of the mouse");
+ RNA_def_property_ui_text(prop, "Mouse Previous Y Position", "The window relative horizontal location of the mouse");
/* modifiers */
@@ -1560,7 +1581,8 @@ static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop)
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get",
+ "rna_WindowManager_active_keyconfig_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active KeyConfig", "Active key configuration (preset)");
@@ -1572,12 +1594,16 @@ static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop)
prop = RNA_def_property(srna, "addon", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "addonconf");
RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_ui_text(prop, "Addon Key Configuration", "Key configuration that can be extended by addons, and is added to the active configuration when handling events");
+ RNA_def_property_ui_text(prop, "Addon Key Configuration",
+ "Key configuration that can be extended by addons, and is added to the active "
+ "configuration when handling events");
prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "userconf");
RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_ui_text(prop, "User Key Configuration", "Final key configuration that combines keymaps from the active and addon configurations, and can be edited by the user");
+ RNA_def_property_ui_text(prop, "User Key Configuration",
+ "Final key configuration that combines keymaps from the active and addon configurations, "
+ "and can be edited by the user");
RNA_api_keyconfigs(srna);
}
@@ -1588,7 +1614,8 @@ static void rna_def_windowmanager(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "WindowManager", "ID");
- RNA_def_struct_ui_text(srna, "Window Manager", "Window manager datablock defining open windows and other user interface data");
+ RNA_def_struct_ui_text(srna, "Window Manager",
+ "Window manager datablock defining open windows and other user interface data");
RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
RNA_def_struct_sdna(srna, "wmWindowManager");
@@ -1709,7 +1736,8 @@ static void rna_def_keyconfig(BlenderRNA *brna)
prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_MODAL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Modal Keymap", "Indicates that a keymap is used for translate modal events for an operator");
+ RNA_def_property_ui_text(prop, "Modal Keymap",
+ "Indicates that a keymap is used for translate modal events for an operator");
prop = RNA_def_property(srna, "show_expanded_items", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_EXPANDED);
@@ -1732,7 +1760,8 @@ static void rna_def_keyconfig(BlenderRNA *brna)
prop = RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "idname");
RNA_def_property_ui_text(prop, "Identifier", "Identifier of operator to call on input event");
- RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", "rna_wmKeyMapItem_idname_length", "rna_wmKeyMapItem_idname_set");
+ RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", "rna_wmKeyMapItem_idname_length",
+ "rna_wmKeyMapItem_idname_set");
RNA_def_struct_name_property(srna, prop);
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
@@ -1840,7 +1869,8 @@ static void rna_def_keyconfig(BlenderRNA *brna)
prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "User Defined", "Is this keymap item user defined (doesn't just replace a builtin item)");
+ RNA_def_property_ui_text(prop, "User Defined",
+ "Is this keymap item user defined (doesn't just replace a builtin item)");
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_userdefined_get", NULL);
RNA_api_keymapitem(srna);
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index bfe0f1cba65..bad122ab761 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
@@ -59,7 +59,7 @@ static void rna_Operator_report(wmOperator *op, int type, const char *msg)
BKE_report(op->reports, type, msg);
}
-/* since event isnt needed... */
+/* since event isn't needed... */
static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op)
{
WM_enum_search_invoke(C, op, NULL);
@@ -82,7 +82,8 @@ void rna_event_timer_remove(struct wmWindowManager *wm, wmTimer *timer)
WM_event_remove_timer(wm, timer->win, timer);
}
-static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, const char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
+static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, const char *idname, int type, int value,
+ int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
{
/* wmWindowManager *wm = CTX_wm_manager(C); */
char idname_bl[OP_MAX_TYPENAME];
@@ -106,7 +107,9 @@ static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, cons
return WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier);
}
-static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, ReportList *reports, const char *propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
+static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, ReportList *reports, const char *propvalue_str,
+ int type, int value, int any, int shift, int ctrl, int alt,
+ int oskey, int keymodifier)
{
int modifier = 0;
int propvalue = 0;
@@ -141,7 +144,8 @@ static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int sp
{
if (modal == 0) {
return WM_keymap_find(keyconf, idname, spaceid, regionid);
- } else {
+ }
+ else {
return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
}
}
@@ -198,8 +202,8 @@ void RNA_api_wm(StructRNA *srna)
func = RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
RNA_def_function_ui_description(func, "Opens a file selector with an operator. "
- "The string properties 'filepath', 'filename', 'directory' and a 'files' collection "
- "are assigned when present in the operator");
+ "The string properties 'filepath', 'filename', 'directory' and a 'files' "
+ "collection are assigned when present in the operator");
rna_generic_op_invoke(func, 0);
func = RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
@@ -279,7 +283,8 @@ void RNA_api_operator(StructRNA *srna)
parm = RNA_def_pointer(func, "context", "Context", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
- parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); /* better name? */
+ /* better name? */
+ parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
RNA_def_function_return(func, parm);
/* check */
@@ -301,7 +306,8 @@ void RNA_api_operator(StructRNA *srna)
parm = RNA_def_pointer(func, "event", "Event", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
- parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); /* better name? */
+ /* better name? */
+ parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "modal", NULL); /* same as invoke */
@@ -312,7 +318,8 @@ void RNA_api_operator(StructRNA *srna)
parm = RNA_def_pointer(func, "event", "Event", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
- parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); /* better name? */
+ /* better name? */
+ parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
RNA_def_function_return(func, parm);
/* draw */
@@ -329,7 +336,8 @@ void RNA_api_operator(StructRNA *srna)
parm = RNA_def_pointer(func, "context", "Context", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
- parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); /* better name? */
+ /* better name? */
+ parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
RNA_def_function_return(func, parm);
}
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 4c641062954..9bc1fa2e9e3 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -176,7 +176,8 @@ static void rna_def_world_mtex(BlenderRNA *brna)
prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "texco");
RNA_def_property_enum_items(prop, texco_items);
- RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background");
+ RNA_def_property_ui_text(prop, "Texture Coordinates",
+ "Texture coordinates used to map the texture onto the background");
RNA_def_property_update(prop, 0, "rna_World_update");
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
@@ -246,7 +247,8 @@ static void rna_def_lighting(BlenderRNA *brna)
/* ambient occlusion */
prop = RNA_def_property(srna, "use_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_AMB_OCC);
- RNA_def_property_ui_text(prop, "Use Ambient Occlusion", "Use Ambient Occlusion to add shadowing based on distance between objects");
+ RNA_def_property_ui_text(prop, "Use Ambient Occlusion",
+ "Use Ambient Occlusion to add shadowing based on distance between objects");
RNA_def_property_update(prop, 0, "rna_World_update");
prop = RNA_def_property(srna, "ao_factor", PROP_FLOAT, PROP_FACTOR);
@@ -314,30 +316,39 @@ static void rna_def_lighting(BlenderRNA *brna)
prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "aodist");
- RNA_def_property_ui_text(prop, "Distance", "Length of rays, defines how far away other faces give occlusion effect");
+ RNA_def_property_ui_text(prop, "Distance",
+ "Length of rays, defines how far away other faces give occlusion effect");
RNA_def_property_update(prop, 0, "rna_World_update");
prop = RNA_def_property(srna, "falloff_strength", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "aodistfac");
- RNA_def_property_ui_text(prop, "Strength", "Attenuation falloff strength, the higher, the less influence distant objects have");
+ RNA_def_property_ui_text(prop, "Strength",
+ "Attenuation falloff strength, the higher, the less influence distant objects have");
RNA_def_property_update(prop, 0, "rna_World_update");
prop = RNA_def_property(srna, "bias", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "aobias");
RNA_def_property_range(prop, 0, 0.5);
- RNA_def_property_ui_text(prop, "Bias", "Bias (in radians) to prevent smoothed faces from showing banding (for Raytrace Constant Jittered)");
+ RNA_def_property_ui_text(prop, "Bias",
+ "Bias (in radians) to prevent smoothed faces from showing banding "
+ "(for Raytrace Constant Jittered)");
RNA_def_property_update(prop, 0, "rna_World_update");
prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ao_adapt_thresh");
RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Threshold", "Samples below this threshold will be considered fully shadowed/unshadowed and skipped (for Raytrace Adaptive QMC)");
+ RNA_def_property_ui_text(prop, "Threshold",
+ "Samples below this threshold will be considered fully shadowed/unshadowed and skipped "
+ "(for Raytrace Adaptive QMC)");
RNA_def_property_update(prop, 0, "rna_World_update");
prop = RNA_def_property(srna, "adapt_to_speed", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ao_adapt_speed_fac");
RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Adapt To Speed", "Use the speed vector pass to reduce AO samples in fast moving pixels. Higher values result in more aggressive sample reduction. Requires Vec pass enabled (for Raytrace Adaptive QMC)");
+ RNA_def_property_ui_text(prop, "Adapt To Speed",
+ "Use the speed vector pass to reduce AO samples in fast moving pixels - "
+ "higher values result in more aggressive sample reduction "
+ "(requires Vec pass enabled, for Raytrace Adaptive QMC)");
RNA_def_property_update(prop, 0, "rna_World_update");
prop = RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
@@ -360,13 +371,15 @@ static void rna_def_lighting(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_cache", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "aomode", WO_AOCACHE);
- RNA_def_property_ui_text(prop, "Pixel Cache", "Cache AO results in pixels and interpolate over neighboring pixels for speedup");
+ RNA_def_property_ui_text(prop, "Pixel Cache",
+ "Cache AO results in pixels and interpolate over neighboring pixels for speedup");
RNA_def_property_update(prop, 0, "rna_World_update");
prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "aosamp");
RNA_def_property_range(prop, 1, 128);
- RNA_def_property_ui_text(prop, "Samples", "Amount of ray samples. Higher values give smoother results and longer rendering times");
+ RNA_def_property_ui_text(prop, "Samples",
+ "Amount of ray samples. Higher values give smoother results and longer rendering times");
RNA_def_property_update(prop, 0, "rna_World_update");
prop = RNA_def_property(srna, "sample_method", PROP_ENUM, PROP_NONE);
@@ -449,7 +462,7 @@ static void rna_def_world_stars(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "starsize");
RNA_def_property_range(prop, 0, 10);
RNA_def_property_ui_text(prop, "Size", "Average screen dimension of stars");
- RNA_def_property_update(prop, 0, "rna_World_draw_update"); /* use normal update since this isnt visualized */
+ RNA_def_property_update(prop, 0, "rna_World_draw_update"); /* use normal update since this isn't visualized */
prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "starmindist");
@@ -487,7 +500,8 @@ void RNA_def_world(BlenderRNA *brna)
#endif
srna = RNA_def_struct(brna, "World", "ID");
- RNA_def_struct_ui_text(srna, "World", "World datablock describing the environment and ambient lighting of a scene");
+ RNA_def_struct_ui_text(srna, "World",
+ "World datablock describing the environment and ambient lighting of a scene");
RNA_def_struct_ui_icon(srna, ICON_WORLD_DATA);
rna_def_animdata_common(srna);
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 96a8a4216d4..90ae423f8a3 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -30,6 +30,7 @@ set(INC
../blenkernel
../blenkernel/intern
../blenlib
+ ../blenfont
../blenloader
../makesdna
../makesrna
@@ -139,6 +140,10 @@ if(WITH_GAMEENGINE)
)
endif()
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
if(WITH_OPENMP)
add_definitions(-DPARALLEL=1)
endif()
diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript
index 4ab3874d6fe..2b506cce2cf 100644
--- a/source/blender/modifiers/SConscript
+++ b/source/blender/modifiers/SConscript
@@ -6,7 +6,7 @@ sources = env.Glob('intern/*.c')
incs = '. ./intern'
incs += ' #/intern/guardedalloc #/intern/decimation/extern #/intern/bsp/extern #/intern/elbeem/extern #/extern/glew/include'
incs += ' ../render/extern/include ../blenloader ../bmesh'
-incs += ' ../include ../blenlib ../makesdna ../makesrna ../blenkernel ../blenkernel/intern'
+incs += ' ../include ../blenlib ../blenfont ../makesdna ../makesrna ../blenkernel ../blenkernel/intern'
incs += ' ../gpu'
incs += ' ' + env['BF_ZLIB_INC']
@@ -33,6 +33,9 @@ if env['WITH_BF_GAMEENGINE']:
incs += ' #/extern/recastnavigation'
defs.append('WITH_GAMEENGINE')
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
env.BlenderLib ( libname = 'bf_modifiers', sources = sources,
includes = Split(incs), defines=defs,
libtype=['core','player'], priority = [80, 40] )
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index 7260e39e982..fd9730238f5 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -129,7 +129,7 @@ static void deformVerts(ModifierData *md, Object *ob,
numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
/* free cache */
- if(amd->prevCos) {
+ if (amd->prevCos) {
MEM_freeN(amd->prevCos);
amd->prevCos= NULL;
}
@@ -142,7 +142,7 @@ static void deformVertsEM(
ArmatureModifierData *amd = (ArmatureModifierData*) md;
DerivedMesh *dm = derivedData;
- if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+ if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
@@ -150,12 +150,12 @@ static void deformVertsEM(
numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
/* free cache */
- if(amd->prevCos) {
+ if (amd->prevCos) {
MEM_freeN(amd->prevCos);
amd->prevCos= NULL;
}
- if(!derivedData) dm->release(dm);
+ if (!derivedData) dm->release(dm);
}
static void deformMatricesEM(
@@ -166,12 +166,12 @@ static void deformMatricesEM(
ArmatureModifierData *amd = (ArmatureModifierData*) md;
DerivedMesh *dm = derivedData;
- if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+ if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts,
amd->deformflag, NULL, amd->defgrp_name);
- if(!derivedData) dm->release(dm);
+ if (!derivedData) dm->release(dm);
}
static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedData,
@@ -180,12 +180,12 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat
ArmatureModifierData *amd = (ArmatureModifierData*) md;
DerivedMesh *dm = derivedData;
- if(!derivedData) dm = CDDM_from_mesh((Mesh*)ob->data, ob);
+ if (!derivedData) dm = CDDM_from_mesh((Mesh*)ob->data, ob);
armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts,
amd->deformflag, NULL, amd->defgrp_name);
- if(!derivedData) dm->release(dm);
+ if (!derivedData) dm->release(dm);
}
ModifierTypeInfo modifierType_Armature = {
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 2fbec392b1e..621be8023a2 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -70,7 +70,7 @@ static void initData(ModifierData *md)
*/
amd->start_cap = amd->end_cap = amd->curve_ob = amd->offset_ob = NULL;
amd->count = 2;
- amd->offset[0] = amd->offset[1] = amd->offset[2] = 0;
+ zero_v3(amd->offset);
amd->scale[0] = 1;
amd->scale[1] = amd->scale[2] = 0;
amd->length = 0;
@@ -149,14 +149,14 @@ static float vertarray_size(MVert *mvert, int numVerts, int axis)
float min_co, max_co;
/* if there are no vertices, width is 0 */
- if(numVerts == 0) return 0;
+ if (numVerts == 0) return 0;
/* find the minimum and maximum coordinates on the desired axis */
min_co = max_co = mvert->co[axis];
++mvert;
- for(i = 1; i < numVerts; ++i, ++mvert) {
- if(mvert->co[axis] < min_co) min_co = mvert->co[axis];
- if(mvert->co[axis] > max_co) max_co = mvert->co[axis];
+ for (i = 1; i < numVerts; ++i, ++mvert) {
+ if (mvert->co[axis] < min_co) min_co = mvert->co[axis];
+ if (mvert->co[axis] > max_co) max_co = mvert->co[axis];
}
return max_co - min_co;
@@ -186,11 +186,11 @@ static void bm_merge_dm_transform(BMesh* bm, DerivedMesh *dm, float mat[4][4])
}
static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
- Scene *scene, Object *ob, DerivedMesh *dm,
- int UNUSED(initFlags))
+ Scene *scene, Object *ob, DerivedMesh *dm,
+ int UNUSED(initFlags))
{
DerivedMesh *result;
- BMEditMesh *em = DM_to_editbmesh(ob, dm, NULL, FALSE);
+ BMEditMesh *em = DM_to_editbmesh(dm, NULL, FALSE);
BMOperator op, oldop, weldop;
int i, j, indexLen;
/* offset matrix */
@@ -204,9 +204,9 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
MVert *src_mvert;
/* need to avoid infinite recursion here */
- if(amd->start_cap && amd->start_cap != ob)
+ if (amd->start_cap && amd->start_cap != ob)
start_cap = mesh_get_derived_final(scene, amd->start_cap, CD_MASK_MESH);
- if(amd->end_cap && amd->end_cap != ob)
+ if (amd->end_cap && amd->end_cap != ob)
end_cap = mesh_get_derived_final(scene, amd->end_cap, CD_MASK_MESH);
unit_m4(offset);
@@ -214,19 +214,19 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
src_mvert = dm->getVertArray(dm);
maxVerts = dm->getNumVerts(dm);
- if(amd->offset_type & MOD_ARR_OFF_CONST)
+ if (amd->offset_type & MOD_ARR_OFF_CONST)
add_v3_v3v3(offset[3], offset[3], amd->offset);
- if(amd->offset_type & MOD_ARR_OFF_RELATIVE) {
- for(j = 0; j < 3; j++)
+ if (amd->offset_type & MOD_ARR_OFF_RELATIVE) {
+ for (j = 0; j < 3; j++)
offset[3][j] += amd->scale[j] * vertarray_size(src_mvert,
maxVerts, j);
}
- if((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) {
+ if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) {
float obinv[4][4];
float result_mat[4][4];
- if(ob)
+ if (ob)
invert_m4_m4(obinv, ob->obmat);
else
unit_m4(obinv);
@@ -240,36 +240,36 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
/* calculate the offset matrix of the final copy (for merging) */
unit_m4(final_offset);
- for(j=0; j < count - 1; j++) {
+ for (j=0; j < count - 1; j++) {
mult_m4_m4m4(tmp_mat, offset, final_offset);
copy_m4_m4(final_offset, tmp_mat);
}
- if(amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob) {
+ if (amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob) {
Curve *cu = amd->curve_ob->data;
- if(cu) {
+ if (cu) {
float tmp_mat[3][3];
float scale;
object_to_mat3(amd->curve_ob, tmp_mat);
scale = mat3_to_scale(tmp_mat);
- if(!cu->path) {
+ if (!cu->path) {
cu->flag |= CU_PATH; // needed for path & bevlist
makeDispListCurveTypes(scene, amd->curve_ob, 0);
}
- if(cu->path)
+ if (cu->path)
length = scale*cu->path->totdist;
}
}
/* calculate the maximum number of copies which will fit within the
* prescribed length */
- if(amd->fit_type == MOD_ARR_FITLENGTH
+ if (amd->fit_type == MOD_ARR_FITLENGTH
|| amd->fit_type == MOD_ARR_FITCURVE) {
float dist = sqrt(dot_v3v3(offset[3], offset[3]));
- if(dist > 1e-6f)
+ if (dist > 1e-6f)
/* this gives length = first copy start to last copy end
* add a tiny offset for floating point rounding errors */
count = (length + 1e-6f) / dist;
@@ -278,7 +278,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
count = 1;
}
- if(count < 1)
+ if (count < 1)
count = 1;
/* BMESH_TODO: bumping up the stack level avoids computing the normals
@@ -349,7 +349,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
BMO_op_finish(em->bm, &findop);
}
- /* generate merge mappping using index map. we do this by using the
+ /* generate merge mapping using index map. we do this by using the
* operator slots as lookup arrays.*/
#define E(i) (i) < s1->len ? _E(s1, i) : _E(s2, (i)-s1->len)
@@ -377,7 +377,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
if ((start_cap || end_cap) &&
/* BMESH_TODO - theres a bug in DM_to_bmesh_ex() when in editmode!
- * this needs investigation, but for now at least dont crash */
+ * this needs investigation, but for now at least don't crash */
ob->mode != OB_MODE_EDIT
)
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 3e110909702..4bfcd86733c 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -83,19 +83,19 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(bmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+ if (bmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
return dataMask;
}
#define EDGE_MARK 1
+#ifdef USE_BM_BEVEL_OP_AS_MOD
/* BMESH_TODO
*
* this bevel calls the operator which is missing many of the options
* which the bevel modifier in trunk has.
- * - width is interpreted as percent (not distance)
* - no vertex bevel
* - no weight bevel
*
@@ -105,10 +105,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
* note: this code is very close to MOD_edgesplit.c.
* note: if 0'd code from trunk included below.
*/
-static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
- DerivedMesh *dm,
- int UNUSED(useRenderParams),
- int UNUSED(isFinalCalc))
+static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
+ DerivedMesh *dm,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *result;
BMesh *bm;
@@ -118,7 +118,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
BevelModifierData *bmd = (BevelModifierData*) md;
float threshold = cos((bmd->bevel_angle + 0.00001) * M_PI / 180.0);
- em = DM_to_editbmesh(ob, dm, NULL, FALSE);
+ em = DM_to_editbmesh(dm, NULL, FALSE);
bm = em->bm;
BM_mesh_normals_update(bm, FALSE);
@@ -157,7 +157,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
}
-#if 0 /* from trunk, see note above */
+#else /* from trunk, see note above */
static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
DerivedMesh *derivedData,
@@ -165,13 +165,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
int UNUSED(isFinalCalc))
{
DerivedMesh *result;
- BME_Mesh *bm;
+ BMEditMesh *em;
/*bDeformGroup *def;*/
int /*i,*/ options, defgrp_index = -1;
BevelModifierData *bmd = (BevelModifierData*) md;
- options = bmd->flags|bmd->val_flags|bmd->lim_flags|bmd->e_flags;
+ options = bmd->flags | bmd->val_flags | bmd->lim_flags | bmd->e_flags;
#if 0
if ((options & BME_BEVEL_VWEIGHT) && bmd->defgrp_name[0]) {
@@ -182,12 +182,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
}
#endif
- bm = BME_derivedmesh_to_bmesh(derivedData);
- BME_bevel(bm,bmd->value,bmd->res,options,defgrp_index,bmd->bevel_angle,NULL);
- result = BME_bmesh_to_derivedmesh(bm,derivedData);
- BME_free_mesh(bm);
-
- CDDM_calc_normals(result);
+ em = DM_to_editbmesh(derivedData, NULL, FALSE);
+ BME_bevel(em, bmd->value, bmd->res, options, defgrp_index, bmd->bevel_angle, NULL, FALSE);
+ BLI_assert(em->looptris == NULL);
+ result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE);
+ BMEdit_Free(em);
+ MEM_freeN(em);
return result;
}
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 76560d14e3b..e4e89db403d 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -38,6 +38,7 @@
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_modifier.h"
@@ -82,7 +83,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
{
BooleanModifierData *bmd = (BooleanModifierData*) md;
- if(bmd->object) {
+ if (bmd->object) {
DagNode *curNode = dag_get_node(forest, bmd->object);
dag_add_relation(forest, curNode, obNode,
@@ -95,14 +96,14 @@ static DerivedMesh *get_quick_derivedMesh(DerivedMesh *derivedData, DerivedMesh
{
DerivedMesh *result = NULL;
- if(derivedData->getNumPolys(derivedData) == 0 || dm->getNumPolys(dm) == 0) {
+ if (derivedData->getNumPolys(derivedData) == 0 || dm->getNumPolys(dm) == 0) {
switch(operation) {
case eBooleanModifierOp_Intersect:
result = CDDM_new(0, 0, 0, 0, 0);
break;
case eBooleanModifierOp_Union:
- if(derivedData->getNumPolys(derivedData)) result = derivedData;
+ if (derivedData->getNumPolys(derivedData)) result = derivedData;
else result = CDDM_copy(dm);
break;
@@ -124,20 +125,20 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
BooleanModifierData *bmd = (BooleanModifierData*) md;
DerivedMesh *dm;
- if(!bmd->object)
+ if (!bmd->object)
return derivedData;
dm = bmd->object->derivedFinal;
- if(dm) {
+ if (dm) {
DerivedMesh *result;
/* when one of objects is empty (has got no faces) we could speed up
* calculation a bit returning one of objects' derived meshes (or empty one)
- * Returning mesh is depended on modifieier's operation (sergey) */
+ * Returning mesh is depended on modifiers operation (sergey) */
result = get_quick_derivedMesh(derivedData, dm, bmd->operation);
- if(result == NULL) {
+ if (result == NULL) {
DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
DM_ensure_tessface(derivedData); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
@@ -152,10 +153,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* if new mesh returned, return it; otherwise there was
* an error, so delete the modifier object */
- if(result)
+ if (result)
return result;
else
- modifier_setError(md, "Can't execute boolean operation.");
+ modifier_setError(md, "%s", TIP_("Can't execute boolean operation."));
}
return derivedData;
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c
index 3fd4119c915..7d4ec3c3d81 100644
--- a/source/blender/modifiers/intern/MOD_boolean_util.c
+++ b/source/blender/modifiers/intern/MOD_boolean_util.c
@@ -185,17 +185,19 @@ static void FaceIt_Fill(CSG_IteratorPtr it, CSG_IFace *face)
/* reverse face vertices if necessary */
face->vertex_index[1] = mface->v2;
- if( face_it->flip == 0 ) {
+ if ( face_it->flip == 0 ) {
face->vertex_index[0] = mface->v1;
face->vertex_index[2] = mface->v3;
- } else {
+ }
+ else {
face->vertex_index[2] = mface->v1;
face->vertex_index[0] = mface->v3;
}
if (mface->v4) {
face->vertex_index[3] = mface->v4;
face->vertex_number = 4;
- } else {
+ }
+ else {
face->vertex_number = 3;
}
@@ -234,17 +236,22 @@ static void FaceIt_Construct(
if (ob->size[0] < 0.0f) {
if (ob->size[1] < 0.0f && ob->size[2] < 0.0f) {
it->flip = 1;
- } else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
+ }
+ else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
it->flip = 1;
- } else {
+ }
+ else {
it->flip = 0;
}
- } else {
+ }
+ else {
if (ob->size[1] < 0.0f && ob->size[2] < 0.0f) {
it->flip = 0;
- } else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
+ }
+ else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
it->flip = 0;
- } else {
+ }
+ else {
it->flip = 1;
}
}
@@ -354,9 +361,9 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
// create a new DerivedMesh
result = CDDM_new(vertex_it->num_elements, 0, face_it->num_elements, 0, 0);
- CustomData_merge(&dm1->faceData, &result->faceData, CD_MASK_DERIVEDMESH,
+ CustomData_merge(&dm1->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~(CD_MASK_NORMAL | CD_MASK_POLYINDEX | CD_MASK_ORIGINDEX),
CD_DEFAULT, face_it->num_elements);
- CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH,
+ CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~(CD_MASK_NORMAL | CD_MASK_POLYINDEX | CD_MASK_ORIGINDEX),
CD_DEFAULT, face_it->num_elements);
// step through the vertex iterators:
@@ -382,7 +389,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
origindex_layer = result->getTessFaceDataArray(result, CD_ORIGINDEX);
// step through the face iterators
- for(i = 0; !face_it->Done(face_it->it); i++) {
+ for (i = 0; !face_it->Done(face_it->it); i++) {
Mesh *orig_me;
Object *orig_ob;
Material *orig_mat;
@@ -422,8 +429,8 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
else
mface->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat));
}
- else if(orig_mat) {
- if(orig_ob == ob1) {
+ else if (orig_mat) {
+ if (orig_ob == ob1) {
// No need to change materian index for faces from left operand
}
else {
@@ -433,8 +440,8 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
int a;
mat_nr = 0;
- for(a = 0; a < ob1->totcol; a++) {
- if(give_current_material(ob1, a+1) == orig_mat) {
+ for (a = 0; a < ob1->totcol; a++) {
+ if (give_current_material(ob1, a+1) == orig_mat) {
mat_nr = a;
break;
}
@@ -456,7 +463,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
test_index_face(mface, &result->faceData, i, csgface.vertex_number);
- if(origindex_layer && orig_ob == ob2)
+ if (origindex_layer && orig_ob == ob2)
origindex_layer[i] = ORIGINDEX_NONE;
}
@@ -466,6 +473,17 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
CDDM_calc_edges_tessface(result);
CDDM_tessfaces_to_faces(result); /*builds ngon faces from tess (mface) faces*/
+
+ /* this fixes shading issues but SHOULD NOT.
+ * TODO, find out why face normals are wrong & flicker - campbell */
+#if 0
+ DM_debug_print(result);
+
+ CustomData_free(&result->faceData, result->numTessFaceData);
+ result->numTessFaceData = 0;
+ DM_ensure_tessface(result);
+#endif
+
CDDM_calc_normals(result);
return result;
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index a268f475bc8..ddfb793bd5d 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -172,7 +172,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
else if (numEdges_dst) {
MEdge *medge, *me;
- if(bmd->randomize)
+ if (bmd->randomize)
BLI_array_randomize(edgeMap, sizeof(*edgeMap),
numEdge_src, bmd->seed);
@@ -183,11 +183,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
for (i = 0; i < numEdges_dst; i++) {
me = medge + edgeMap[i];
- if(!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1))) {
+ if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1))) {
BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(me->v1),
SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
}
- if(!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2))) {
+ if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2))) {
BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(me->v2), SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
}
}
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 6ca3a82dd0e..15940112527 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -86,7 +86,7 @@ static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
flag = cmd->flag & (MOD_CAST_X|MOD_CAST_Y|MOD_CAST_Z);
- if((cmd->fac == 0.0f) || flag == 0) return 1;
+ if ((cmd->fac == 0.0f) || flag == 0) return 1;
return 0;
}
@@ -97,7 +97,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(cmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+ if (cmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
return dataMask;
}
@@ -157,7 +157,7 @@ static void sphere_do(
* space), by default, but if the user defined a control object,
* we use its location, transformed to ob's local space */
if (ctrl_ob) {
- if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+ if (flag & MOD_CAST_USE_OB_TRANSFORM) {
invert_m4_m4(ctrl_ob->imat, ctrl_ob->obmat);
mult_m4_m4m4(mat, ctrl_ob->imat, ob->obmat);
invert_m4_m4(imat, mat);
@@ -178,14 +178,14 @@ static void sphere_do(
* only those vertices should be affected */
modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index);
- if(flag & MOD_CAST_SIZE_FROM_RADIUS) {
+ if (flag & MOD_CAST_SIZE_FROM_RADIUS) {
len = cmd->radius;
}
else {
len = cmd->size;
}
- if(len <= 0) {
+ if (len <= 0) {
for (i = 0; i < numVerts; i++) {
len += len_v3v3(center, vertexCos[i]);
}
@@ -207,10 +207,11 @@ static void sphere_do(
float weight;
copy_v3_v3(tmp_co, vertexCos[i]);
- if(ctrl_ob) {
- if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+ if (ctrl_ob) {
+ if (flag & MOD_CAST_USE_OB_TRANSFORM) {
mul_m4_v3(mat, tmp_co);
- } else {
+ }
+ else {
sub_v3_v3(tmp_co, center);
}
}
@@ -239,10 +240,11 @@ static void sphere_do(
if (flag & MOD_CAST_Z)
tmp_co[2] = fac*vec[2]*len + facm*tmp_co[2];
- if(ctrl_ob) {
- if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+ if (ctrl_ob) {
+ if (flag & MOD_CAST_USE_OB_TRANSFORM) {
mul_m4_v3(imat, tmp_co);
- } else {
+ }
+ else {
add_v3_v3(tmp_co, center);
}
}
@@ -257,10 +259,11 @@ static void sphere_do(
float tmp_co[3];
copy_v3_v3(tmp_co, vertexCos[i]);
- if(ctrl_ob) {
- if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+ if (ctrl_ob) {
+ if (flag & MOD_CAST_USE_OB_TRANSFORM) {
mul_m4_v3(mat, tmp_co);
- } else {
+ }
+ else {
sub_v3_v3(tmp_co, center);
}
}
@@ -283,10 +286,11 @@ static void sphere_do(
if (flag & MOD_CAST_Z)
tmp_co[2] = fac*vec[2]*len + facm*tmp_co[2];
- if(ctrl_ob) {
- if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+ if (ctrl_ob) {
+ if (flag & MOD_CAST_USE_OB_TRANSFORM) {
mul_m4_v3(imat, tmp_co);
- } else {
+ }
+ else {
add_v3_v3(tmp_co, center);
}
}
@@ -329,7 +333,7 @@ static void cuboid_do(
modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index);
if (ctrl_ob) {
- if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+ if (flag & MOD_CAST_USE_OB_TRANSFORM) {
invert_m4_m4(ctrl_ob->imat, ctrl_ob->obmat);
mult_m4_m4m4(mat, ctrl_ob->imat, ob->obmat);
invert_m4_m4(imat, mat);
@@ -339,17 +343,19 @@ static void cuboid_do(
mul_v3_m4v3(center, ob->imat, ctrl_ob->obmat[3]);
}
- if((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) {
- for(i = 0; i < 3; i++) {
+ if ((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) {
+ for (i = 0; i < 3; i++) {
min[i] = -cmd->radius;
max[i] = cmd->radius;
}
- } else if(!(flag & MOD_CAST_SIZE_FROM_RADIUS) && cmd->size > 0) {
- for(i = 0; i < 3; i++) {
+ }
+ else if (!(flag & MOD_CAST_SIZE_FROM_RADIUS) && cmd->size > 0) {
+ for (i = 0; i < 3; i++) {
min[i] = -cmd->size;
max[i] = cmd->size;
}
- } else {
+ }
+ else {
/* get bound box */
/* We can't use the object's bound box because other modifiers
* may have changed the vertex data. */
@@ -406,10 +412,11 @@ static void cuboid_do(
float tmp_co[3];
copy_v3_v3(tmp_co, vertexCos[i]);
- if(ctrl_ob) {
- if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+ if (ctrl_ob) {
+ if (flag & MOD_CAST_USE_OB_TRANSFORM) {
mul_m4_v3(mat, tmp_co);
- } else {
+ }
+ else {
sub_v3_v3(tmp_co, center);
}
}
@@ -421,7 +428,7 @@ static void cuboid_do(
}
for (j = 0; j < dvert[i].totweight; ++j) {
- if(dvert[i].dw[j].def_nr == defgrp_index) {
+ if (dvert[i].dw[j].def_nr == defgrp_index) {
dw = &dvert[i].dw[j];
break;
}
@@ -482,10 +489,11 @@ static void cuboid_do(
if (flag & MOD_CAST_Z)
tmp_co[2] = facm * tmp_co[2] + fac * tmp_co[2] * fbb;
- if(ctrl_ob) {
- if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+ if (ctrl_ob) {
+ if (flag & MOD_CAST_USE_OB_TRANSFORM) {
mul_m4_v3(imat, tmp_co);
- } else {
+ }
+ else {
add_v3_v3(tmp_co, center);
}
}
@@ -502,10 +510,11 @@ static void cuboid_do(
float tmp_co[3];
copy_v3_v3(tmp_co, vertexCos[i]);
- if(ctrl_ob) {
- if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+ if (ctrl_ob) {
+ if (flag & MOD_CAST_USE_OB_TRANSFORM) {
mul_m4_v3(mat, tmp_co);
- } else {
+ }
+ else {
sub_v3_v3(tmp_co, center);
}
}
@@ -550,10 +559,11 @@ static void cuboid_do(
if (flag & MOD_CAST_Z)
tmp_co[2] = facm * tmp_co[2] + fac * tmp_co[2] * fbb;
- if(ctrl_ob) {
- if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+ if (ctrl_ob) {
+ if (flag & MOD_CAST_USE_OB_TRANSFORM) {
mul_m4_v3(imat, tmp_co);
- } else {
+ }
+ else {
add_v3_v3(tmp_co, center);
}
}
@@ -576,11 +586,12 @@ static void deformVerts(ModifierData *md, Object *ob,
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
cuboid_do(cmd, ob, dm, vertexCos, numVerts);
- } else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
+ }
+ else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
sphere_do(cmd, ob, dm, vertexCos, numVerts);
}
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
@@ -593,11 +604,12 @@ static void deformVertsEM(
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
cuboid_do(cmd, ob, dm, vertexCos, numVerts);
- } else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
+ }
+ else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
sphere_do(cmd, ob, dm, vertexCos, numVerts);
}
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index f23690454c0..d5d8439c749 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -61,7 +61,7 @@ static void initData(ModifierData *md)
clmd->point_cache = BKE_ptcache_add(&clmd->ptcaches);
/* check for alloc failing */
- if(!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache)
+ if (!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache)
return;
cloth_init (clmd);
@@ -78,12 +78,12 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
if (!clmd->sim_parms || !clmd->coll_parms) {
initData(md);
- if(!clmd->sim_parms || !clmd->coll_parms)
+ if (!clmd->sim_parms || !clmd->coll_parms)
return;
}
dm = get_dm(ob, NULL, derivedData, NULL, 0);
- if(dm == derivedData)
+ if (dm == derivedData)
dm = CDDM_copy(dm);
CDDM_apply_vert_coords(dm, vertexCos);
@@ -92,7 +92,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
clothModifier_do(clmd, md->scene, ob, dm, vertexCos);
- if(result) {
+ if (result) {
result->getVertCos(result, vertexCos);
result->release(result);
}
@@ -106,8 +106,8 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, Scene *scene, Ob
Base *base;
- if(clmd) {
- for(base = scene->base.first; base; base= base->next) {
+ if (clmd) {
+ for (base = scene->base.first; base; base= base->next) {
Object *ob1= base->object;
if (ob1 != ob) {
CollisionModifierData *coll_clmd = (CollisionModifierData *)modifiers_findByType(ob1, eModifierType_Collision);
@@ -125,10 +125,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
ClothModifierData *clmd = (ClothModifierData*)md;
- if(cloth_uses_vgroup(clmd))
+ if (cloth_uses_vgroup(clmd))
dataMask |= CD_MASK_MDEFORMVERT;
- if(clmd->sim_parms->shapekey_rest != 0)
+ if (clmd->sim_parms->shapekey_rest != 0)
dataMask |= CD_MASK_CLOTH_ORCO;
return dataMask;
@@ -139,20 +139,20 @@ static void copyData(ModifierData *md, ModifierData *target)
ClothModifierData *clmd = (ClothModifierData*) md;
ClothModifierData *tclmd = (ClothModifierData*) target;
- if(tclmd->sim_parms) {
- if(tclmd->sim_parms->effector_weights)
+ if (tclmd->sim_parms) {
+ if (tclmd->sim_parms->effector_weights)
MEM_freeN(tclmd->sim_parms->effector_weights);
MEM_freeN(tclmd->sim_parms);
}
- if(tclmd->coll_parms)
+ if (tclmd->coll_parms)
MEM_freeN(tclmd->coll_parms);
BKE_ptcache_free_list(&tclmd->ptcaches);
tclmd->point_cache = NULL;
tclmd->sim_parms = MEM_dupallocN(clmd->sim_parms);
- if(clmd->sim_parms->effector_weights)
+ if (clmd->sim_parms->effector_weights)
tclmd->sim_parms->effector_weights = MEM_dupallocN(clmd->sim_parms->effector_weights);
tclmd->coll_parms = MEM_dupallocN(clmd->coll_parms);
tclmd->point_cache = BKE_ptcache_copy_list(&tclmd->ptcaches, &clmd->ptcaches);
@@ -169,17 +169,17 @@ static void freeData(ModifierData *md)
ClothModifierData *clmd = (ClothModifierData*) md;
if (clmd) {
- if(G.rt > 0)
+ if (G.rt > 0)
printf("clothModifier_freeData\n");
cloth_free_modifier_extern (clmd);
- if(clmd->sim_parms) {
- if(clmd->sim_parms->effector_weights)
+ if (clmd->sim_parms) {
+ if (clmd->sim_parms->effector_weights)
MEM_freeN(clmd->sim_parms->effector_weights);
MEM_freeN(clmd->sim_parms);
}
- if(clmd->coll_parms)
+ if (clmd->coll_parms)
MEM_freeN(clmd->coll_parms);
BKE_ptcache_free_list(&clmd->ptcaches);
@@ -192,11 +192,11 @@ static void foreachIDLink(ModifierData *md, Object *ob,
{
ClothModifierData *clmd = (ClothModifierData*) md;
- if(clmd->coll_parms) {
+ if (clmd->coll_parms) {
walk(userData, ob, (ID **)&clmd->coll_parms->group);
}
- if(clmd->sim_parms && clmd->sim_parms->effector_weights) {
+ if (clmd->sim_parms && clmd->sim_parms->effector_weights) {
walk(userData, ob, (ID **)&clmd->sim_parms->effector_weights->group);
}
}
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index a1467c55ecf..b3faf6c140a 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -73,19 +73,19 @@ static void freeData(ModifierData *md)
if (collmd)
{
- if(collmd->bvhtree)
+ if (collmd->bvhtree)
BLI_bvhtree_free(collmd->bvhtree);
- if(collmd->x)
+ if (collmd->x)
MEM_freeN(collmd->x);
- if(collmd->xnew)
+ if (collmd->xnew)
MEM_freeN(collmd->xnew);
- if(collmd->current_x)
+ if (collmd->current_x)
MEM_freeN(collmd->current_x);
- if(collmd->current_xnew)
+ if (collmd->current_xnew)
MEM_freeN(collmd->current_xnew);
- if(collmd->current_v)
+ if (collmd->current_v)
MEM_freeN(collmd->current_v);
- if(collmd->mfaces)
+ if (collmd->mfaces)
MEM_freeN(collmd->mfaces);
collmd->x = NULL;
@@ -117,16 +117,16 @@ static void deformVerts(ModifierData *md, Object *ob,
MVert *tempVert = NULL;
/* if possible use/create DerivedMesh */
- if(derivedData) dm = CDDM_copy(derivedData);
- else if(ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, 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;
@@ -136,20 +136,20 @@ static void deformVerts(ModifierData *md, Object *ob,
current_time = BKE_curframe(md->scene);
- if(G.rt > 0)
+ if (G.rt > 0)
printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew);
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))
+ 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
@@ -176,7 +176,7 @@ static void deformVerts(ModifierData *md, Object *ob,
collmd->time_x = collmd->time_xnew = current_time;
}
- else if(numverts == collmd->numverts) {
+ else if (numverts == collmd->numverts) {
// put positions to old positions
tempVert = collmd->x;
collmd->x = collmd->xnew;
@@ -194,8 +194,8 @@ static void deformVerts(ModifierData *md, Object *ob,
memcpy(collmd->current_x, collmd->x, numverts*sizeof(MVert));
/* check if GUI setting has changed for bvh */
- if(collmd->bvhtree) {
- if(ob->pd->pdef_sboft != BLI_bvhtree_getepsilon(collmd->bvhtree)) {
+ if (collmd->bvhtree) {
+ if (ob->pd->pdef_sboft != BLI_bvhtree_getepsilon(collmd->bvhtree)) {
BLI_bvhtree_free(collmd->bvhtree);
collmd->bvhtree = bvhtree_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->current_x, numverts, ob->pd->pdef_sboft);
}
@@ -213,12 +213,12 @@ static void deformVerts(ModifierData *md, Object *ob,
collmd->time_xnew = current_time;
}
- else if(numverts != collmd->numverts) {
+ else if (numverts != collmd->numverts) {
freeData((ModifierData *)collmd);
}
}
- else if(current_time < collmd->time_xnew) {
+ else if (current_time < collmd->time_xnew) {
freeData((ModifierData *)collmd);
}
else {
@@ -228,7 +228,7 @@ static void deformVerts(ModifierData *md, Object *ob,
}
}
- if(dm)
+ if (dm)
dm->release(dm);
}
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index 0ff37c6fa76..f516f971dc0 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -73,7 +73,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(cmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+ if (cmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
return dataMask;
}
@@ -131,11 +131,11 @@ static void deformVertsEM(
{
DerivedMesh *dm = derivedData;
- if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+ if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0);
- if(!derivedData) dm->release(dm);
+ if (!derivedData) dm->release(dm);
}
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index bc7771d86b0..f55faf9c183 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -38,6 +38,8 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "MEM_guardedalloc.h"
#include "BKE_mesh.h"
@@ -95,9 +97,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
if (mf->v4) numTris++;
}
- if(numTris<3) {
- modifier_setError(md,
- "Modifier requires more than 3 input faces (triangles).");
+ if (numTris<3) {
+ modifier_setError(md, "%s", TIP_("Modifier requires more than 3 input faces (triangles)."));
dm = CDDM_copy(dm);
return dm;
}
@@ -108,7 +109,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
lod.vertex_num= totvert;
lod.face_num= numTris;
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
MVert *mv = &mvert[a];
float *vbCo = &lod.vertex_buffer[a*3];
float *vbNo = &lod.vertex_normal_buffer[a*3];
@@ -118,14 +119,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
}
numTris = 0;
- for(a=0; a<totface; a++) {
+ for (a=0; a<totface; a++) {
MFace *mf = &mface[a];
int *tri = &lod.triangle_index_buffer[3*numTris++];
tri[0]= mf->v1;
tri[1]= mf->v2;
tri[2]= mf->v3;
- if(mf->v4) {
+ if (mf->v4) {
tri = &lod.triangle_index_buffer[3*numTris++];
tri[0]= mf->v1;
tri[1]= mf->v3;
@@ -134,15 +135,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
}
dmd->faceCount = 0;
- if(LOD_LoadMesh(&lod) ) {
- if( LOD_PreprocessMesh(&lod) ) {
+ if (LOD_LoadMesh(&lod) ) {
+ if ( LOD_PreprocessMesh(&lod) ) {
/* we assume the decim_faces tells how much to reduce */
- while(lod.face_num > numTris*dmd->percent) {
- if( LOD_CollapseEdge(&lod)==0) break;
+ while (lod.face_num > numTris*dmd->percent) {
+ if ( LOD_CollapseEdge(&lod)==0) break;
}
- if(lod.vertex_num>2) {
+ if (lod.vertex_num>2) {
result = CDDM_new(lod.vertex_num, 0, lod.face_num, 0, 0);
dmd->faceCount = lod.face_num;
}
@@ -150,16 +151,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
result = CDDM_new(lod.vertex_num, 0, 0, 0, 0);
mvert = CDDM_get_verts(result);
- for(a=0; a<lod.vertex_num; a++) {
+ for (a=0; a<lod.vertex_num; a++) {
MVert *mv = &mvert[a];
float *vbCo = &lod.vertex_buffer[a*3];
copy_v3_v3(mv->co, vbCo);
}
- if(lod.vertex_num>2) {
+ if (lod.vertex_num>2) {
mface = CDDM_get_tessfaces(result);
- for(a=0; a<lod.face_num; a++) {
+ for (a=0; a<lod.face_num; a++) {
MFace *mf = &mface[a];
int *tri = &lod.triangle_index_buffer[a*3];
mf->v1 = tri[0];
@@ -172,12 +173,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
CDDM_calc_edges_tessface(result);
}
else
- modifier_setError(md, "Out of memory.");
+ modifier_setError(md, "%s", TIP_("Out of memory."));
LOD_FreeDecimationData(&lod);
}
else
- modifier_setError(md, "Non-manifold mesh as input.");
+ modifier_setError(md, "%s", TIP_("Non-manifold mesh as input."));
MEM_freeN(lod.vertex_buffer);
MEM_freeN(lod.vertex_normal_buffer);
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 55971e358a9..f3d7a24e517 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -87,10 +87,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(dmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+ if (dmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
/* ask for UV coordinates if we need them */
- if(dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE;
+ if (dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE;
return dataMask;
}
@@ -99,7 +99,7 @@ static int dependsOnTime(ModifierData *md)
{
DisplaceModifierData *dmd = (DisplaceModifierData *)md;
- if(dmd->texture) {
+ if (dmd->texture) {
return BKE_texture_dependsOnTime(dmd->texture);
}
else {
@@ -151,7 +151,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
{
DisplaceModifierData *dmd = (DisplaceModifierData*) md;
- if(dmd->map_object && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
+ if (dmd->map_object && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
DagNode *curNode = dag_get_node(forest, dmd->map_object);
dag_add_relation(forest, curNode, obNode,
@@ -159,7 +159,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
}
- if(dmd->texmapping == MOD_DISP_MAP_GLOBAL)
+ if (dmd->texmapping == MOD_DISP_MAP_GLOBAL)
dag_add_relation(forest, obNode, obNode,
DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Displace Modifier");
@@ -177,8 +177,8 @@ static void displaceModifier_do(
float (*tex_co)[3];
float weight= 1.0f; /* init value unused but some compilers may complain */
- if(!dmd->texture) return;
- if(dmd->strength == 0.0f) return;
+ if (!dmd->texture) return;
+ if (dmd->strength == 0.0f) return;
mvert = CDDM_get_verts(dm);
modifier_get_vgroup(ob, dm, dmd->defgrp_name, &dvert, &defgrp_index);
@@ -187,13 +187,13 @@ static void displaceModifier_do(
"displaceModifier_do tex_co");
get_texture_coords((MappingInfoModifierData *)dmd, ob, dm, vertexCos, tex_co, numVerts);
- for(i = 0; i < numVerts; ++i) {
+ for (i = 0; i < numVerts; ++i) {
TexResult texres;
float delta = 0, strength = dmd->strength;
- if(dvert) {
+ if (dvert) {
weight= defvert_find_weight(dvert + i, defgrp_index);
- if(weight == 0.0f) continue;
+ if (weight == 0.0f) continue;
}
texres.nor = NULL;
@@ -201,7 +201,7 @@ static void displaceModifier_do(
delta = texres.tin - dmd->midlevel;
- if(dvert) strength *= weight;
+ if (dvert) strength *= weight;
delta *= strength;
CLAMP(delta, -10000, 10000);
@@ -244,7 +244,7 @@ static void deformVerts(ModifierData *md, Object *ob,
displaceModifier_do((DisplaceModifierData *)md, ob, dm,
vertexCos, numVerts);
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
@@ -257,7 +257,7 @@ static void deformVertsEM(
displaceModifier_do((DisplaceModifierData *)md, ob, dm,
vertexCos, numVerts);
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index e567765d61b..5005e2c010d 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -75,7 +75,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
if (pmd->canvas) {
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
- for(; surface; surface=surface->next) {
+ for (; surface; surface=surface->next) {
/* tface */
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ ||
surface->init_color_type == MOD_DPAINT_INITIAL_TEXTURE) {
@@ -143,10 +143,10 @@ static void foreachIDLink(ModifierData *md, Object *ob,
{
DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
- if(pmd->canvas) {
+ if (pmd->canvas) {
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
- for(; surface; surface=surface->next) {
+ for (; surface; surface=surface->next) {
walk(userData, ob, (ID **)&surface->brush_group);
walk(userData, ob, (ID **)&surface->init_texture);
}
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index 481ab805c5a..6ffacba3b68 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -57,7 +57,7 @@
#define EDGE_MARK 1
-static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Object *ob)
+static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Object *UNUSED(ob))
{
DerivedMesh *result;
BMesh *bm;
@@ -66,7 +66,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
BMEdge *e;
float threshold = cos((emd->split_angle + 0.00001) * M_PI / 180.0);
- em = DM_to_editbmesh(ob, dm, NULL, FALSE);
+ em = DM_to_editbmesh(dm, NULL, FALSE);
bm = em->bm;
BM_mesh_normals_update(bm, FALSE);
@@ -103,6 +103,8 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
BMO_pop(bm);
+ /* BM_mesh_validate(bm); */ /* for troubleshooting */
+
BLI_assert(em->looptris == NULL);
result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE);
BMEdit_Free(em);
@@ -132,7 +134,7 @@ static void copyData(ModifierData *md, ModifierData *target)
static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd,
Object *ob, DerivedMesh *dm)
{
- if(!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG)))
+ if (!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG)))
return dm;
return doEdgeSplit(dm, emd, ob);
@@ -147,7 +149,7 @@ static DerivedMesh *applyModifier(
result = edgesplitModifier_do(emd, ob, derivedData);
- if(result != derivedData)
+ if (result != derivedData)
CDDM_calc_normals(result);
return result;
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index 05230abdcf5..ddc79c4e4f8 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -67,7 +67,7 @@ static void freeData(ModifierData *md)
{
ExplodeModifierData *emd= (ExplodeModifierData*) md;
- if(emd->facepa) MEM_freeN(emd->facepa);
+ if (emd->facepa) MEM_freeN(emd->facepa);
}
static void copyData(ModifierData *md, ModifierData *target)
{
@@ -88,7 +88,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
ExplodeModifierData *emd= (ExplodeModifierData*) md;
CustomDataMask dataMask = 0;
- if(emd->vgroup)
+ if (emd->vgroup)
dataMask |= CD_MASK_MDEFORMVERT;
return dataMask;
@@ -115,7 +115,7 @@ static void createFacepa(ExplodeModifierData *emd,
BLI_srandom(psys->seed);
- if(emd->facepa)
+ if (emd->facepa)
MEM_freeN(emd->facepa);
facepa = emd->facepa = MEM_callocN(sizeof(int)*totface, "explode_facepa");
@@ -123,21 +123,21 @@ static void createFacepa(ExplodeModifierData *emd,
vertpa = MEM_callocN(sizeof(int)*totvert, "explode_vertpa");
/* initialize all faces & verts to no particle */
- for(i=0; i<totface; i++)
+ for (i=0; i<totface; i++)
facepa[i]=totpart;
for (i=0; i<totvert; i++)
vertpa[i]=totpart;
/* set protected verts */
- if(emd->vgroup){
+ if (emd->vgroup) {
MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
- if(dvert){
+ if (dvert) {
const int defgrp_index= emd->vgroup-1;
- for(i=0; i<totvert; i++, dvert++){
+ for (i=0; i<totvert; i++, dvert++) {
float val = BLI_frand();
val = (1.0f-emd->protect)*val + emd->protect*0.5f;
- if(val < defvert_find_weight(dvert, defgrp_index))
+ if (val < defvert_find_weight(dvert, defgrp_index))
vertpa[i] = -1;
}
}
@@ -145,17 +145,17 @@ static void createFacepa(ExplodeModifierData *emd,
/* make tree of emitter locations */
tree=BLI_kdtree_new(totpart);
- for(p=0,pa=psys->particles; p<totpart; p++,pa++){
+ for (p=0,pa=psys->particles; p<totpart; p++,pa++) {
psys_particle_on_emitter(psmd,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,NULL,NULL,NULL,NULL,NULL);
BLI_kdtree_insert(tree, p, co, NULL);
}
BLI_kdtree_balance(tree);
/* set face-particle-indexes to nearest particle to face center */
- for(i=0,fa=mface; i<totface; i++,fa++){
+ for (i=0,fa=mface; i<totface; i++,fa++) {
add_v3_v3v3(center,mvert[fa->v1].co,mvert[fa->v2].co);
add_v3_v3(center, mvert[fa->v3].co);
- if(fa->v4){
+ if (fa->v4) {
add_v3_v3(center, mvert[fa->v4].co);
mul_v3_fl(center,0.25);
}
@@ -167,19 +167,19 @@ static void createFacepa(ExplodeModifierData *emd,
v1=vertpa[fa->v1];
v2=vertpa[fa->v2];
v3=vertpa[fa->v3];
- if(fa->v4)
+ if (fa->v4)
v4=vertpa[fa->v4];
- if(v1>=0 && v2>=0 && v3>=0 && (fa->v4==0 || v4>=0))
+ if (v1>=0 && v2>=0 && v3>=0 && (fa->v4==0 || v4>=0))
facepa[i]=p;
- if(v1>=0) vertpa[fa->v1]=p;
- if(v2>=0) vertpa[fa->v2]=p;
- if(v3>=0) vertpa[fa->v3]=p;
- if(fa->v4 && v4>=0) vertpa[fa->v4]=p;
+ if (v1>=0) vertpa[fa->v1]=p;
+ if (v2>=0) vertpa[fa->v2]=p;
+ if (v3>=0) vertpa[fa->v3]=p;
+ if (fa->v4 && v4>=0) vertpa[fa->v4]=p;
}
- if(vertpa) MEM_freeN(vertpa);
+ if (vertpa) MEM_freeN(vertpa);
BLI_kdtree_free(tree);
}
@@ -246,7 +246,7 @@ static void remap_uvs_3_6_9_12(DerivedMesh *dm, DerivedMesh *split, int numlayer
MTFace *mf, *df1, *df2, *df3;
int l;
- for(l=0; l<numlayer; l++) {
+ for (l=0; l<numlayer; l++) {
mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
df1 = mf+cur;
df2 = df1 + 1;
@@ -294,7 +294,7 @@ static void remap_uvs_5_10(DerivedMesh *dm, DerivedMesh *split, int numlayer, in
MTFace *mf, *df1, *df2;
int l;
- for(l=0; l<numlayer; l++) {
+ for (l=0; l<numlayer; l++) {
mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
df1 = mf+cur;
df2 = df1 + 1;
@@ -355,7 +355,7 @@ static void remap_uvs_15(DerivedMesh *dm, DerivedMesh *split, int numlayer, int
MTFace *mf, *df1, *df2, *df3, *df4;
int l;
- for(l=0; l<numlayer; l++) {
+ for (l=0; l<numlayer; l++) {
mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
df1 = mf+cur;
df2 = df1 + 1;
@@ -419,7 +419,7 @@ static void remap_uvs_7_11_13_14(DerivedMesh *dm, DerivedMesh *split, int numlay
MTFace *mf, *df1, *df2, *df3;
int l;
- for(l=0; l<numlayer; l++) {
+ for (l=0; l<numlayer; l++) {
mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
df1 = mf+cur;
df2 = df1 + 1;
@@ -468,7 +468,7 @@ static void remap_uvs_19_21_22(DerivedMesh *dm, DerivedMesh *split, int numlayer
MTFace *mf, *df1, *df2;
int l;
- for(l=0; l<numlayer; l++) {
+ for (l=0; l<numlayer; l++) {
mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
df1 = mf+cur;
df2 = df1 + 1;
@@ -519,7 +519,7 @@ static void remap_uvs_23(DerivedMesh *dm, DerivedMesh *split, int numlayer, int
MTFace *mf, *df1, *df2;
int l;
- for(l=0; l<numlayer; l++) {
+ for (l=0; l<numlayer; l++) {
mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
df1 = mf+cur;
df2 = df1 + 1;
@@ -569,7 +569,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
vertpa[mf->v1]=facepa[i];
vertpa[mf->v2]=facepa[i];
vertpa[mf->v3]=facepa[i];
- if(mf->v4)
+ if (mf->v4)
vertpa[mf->v4]=facepa[i];
}
@@ -579,37 +579,37 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
v2=vertpa[mf->v2];
v3=vertpa[mf->v3];
- if(v1!=v2){
+ if (v1!=v2) {
BLI_edgehash_insert(edgehash, mf->v1, mf->v2, NULL);
(*fs) |= 1;
}
- if(v2!=v3){
+ if (v2!=v3) {
BLI_edgehash_insert(edgehash, mf->v2, mf->v3, NULL);
(*fs) |= 2;
}
- if(mf->v4){
+ if (mf->v4) {
v4=vertpa[mf->v4];
- if(v3!=v4){
+ if (v3!=v4) {
BLI_edgehash_insert(edgehash, mf->v3, mf->v4, NULL);
(*fs) |= 4;
}
- if(v1!=v4){
+ if (v1!=v4) {
BLI_edgehash_insert(edgehash, mf->v1, mf->v4, NULL);
(*fs) |= 8;
}
/* mark center vertex as a fake edge split */
- if(*fs == 15)
+ if (*fs == 15)
BLI_edgehash_insert(edgehash, mf->v1, mf->v3, NULL);
}
else {
(*fs) |= 16; /* mark face as tri */
- if(v1!=v3){
+ if (v1!=v3) {
BLI_edgehash_insert(edgehash, mf->v1, mf->v3, NULL);
(*fs) |= 4;
}
@@ -619,21 +619,21 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
/* count splits & create indexes for new verts */
ehi= BLI_edgehashIterator_new(edgehash);
totesplit=totvert;
- for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+ for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totesplit));
totesplit++;
}
BLI_edgehashIterator_free(ehi);
/* count new faces due to splitting */
- for(i=0,fs=facesplit; i<totface; i++,fs++)
+ for (i=0,fs=facesplit; i<totface; i++,fs++)
totfsplit += add_faces[*fs];
splitdm= CDDM_from_template(dm, totesplit, 0, totface+totfsplit, 0, 0);
numlayer = CustomData_number_of_layers(&splitdm->faceData, CD_MTFACE);
/* copy new faces & verts (is it really this painful with custom data??) */
- for(i=0; i<totvert; i++){
+ for (i=0; i<totvert; i++) {
MVert source;
MVert *dest;
dm->getVert(dm, i, &source);
@@ -655,7 +655,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
/* create new verts */
ehi= BLI_edgehashIterator_new(edgehash);
- for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+ for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
BLI_edgehashIterator_getKey(ehi, &ed_v1, &ed_v2);
esplit= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
mv=CDDM_get_vert(splitdm, ed_v2);
@@ -675,7 +675,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
/* create new faces */
curdupface=0;//=totface;
//curdupin=totesplit;
- for(i=0,fs=facesplit; i<totface; i++,fs++){
+ for (i=0,fs=facesplit; i<totface; i++,fs++) {
mf = dm->getTessFaceData(dm, i, CD_MFACE);
switch(*fs) {
@@ -716,18 +716,18 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
case 9:
case 12:
remap_faces_3_6_9_12(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
- if(numlayer)
+ if (numlayer)
remap_uvs_3_6_9_12(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
break;
case 5:
case 10:
remap_faces_5_10(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
- if(numlayer)
+ if (numlayer)
remap_uvs_5_10(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
break;
case 15:
remap_faces_15(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
- if(numlayer)
+ if (numlayer)
remap_uvs_15(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
break;
case 7:
@@ -735,19 +735,19 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
case 13:
case 14:
remap_faces_7_11_13_14(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
- if(numlayer)
+ if (numlayer)
remap_uvs_7_11_13_14(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
break;
case 19:
case 21:
case 22:
remap_faces_19_21_22(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2]);
- if(numlayer)
+ if (numlayer)
remap_uvs_19_21_22(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2]);
break;
case 23:
remap_faces_23(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2]);
- if(numlayer)
+ if (numlayer)
remap_uvs_23(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2]);
break;
case 0:
@@ -755,7 +755,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
df1 = get_dface(dm, splitdm, curdupface, i, mf);
facepa[curdupface] = vertpa[mf->v1];
- if(df1->v4)
+ if (df1->v4)
df1->flag |= ME_FACE_SEL;
else
df1->flag &= ~ME_FACE_SEL;
@@ -765,7 +765,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
curdupface += add_faces[*fs]+1;
}
- for(i=0; i<curdupface; i++) {
+ for (i=0; i<curdupface; i++) {
mf = CDDM_get_tessface(splitdm, i);
test_index_face(mf, &splitdm->faceData, i, (mf->flag & ME_FACE_SEL ? 4 : 3));
}
@@ -774,6 +774,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
MEM_freeN(facesplit);
MEM_freeN(vertpa);
+ CDDM_calc_edges_tessface(splitdm);
CDDM_tessfaces_to_faces(splitdm); /*builds ngon faces from tess (mface) faces*/
return splitdm;
@@ -832,7 +833,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
/* do mindex + totvert to ensure the vertex index to be the first
* with BLI_edgehashIterator_getKey */
- if(facepa[i]==totpart || cfra < (pars+facepa[i])->time)
+ if (facepa[i]==totpart || cfra < (pars+facepa[i])->time)
mindex = totvert+totpart;
else
mindex = totvert+facepa[i];
@@ -843,13 +844,13 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
BLI_edgehash_insert(vertpahash, mf->v1, mindex, NULL);
BLI_edgehash_insert(vertpahash, mf->v2, mindex, NULL);
BLI_edgehash_insert(vertpahash, mf->v3, mindex, NULL);
- if(mf->v4)
+ if (mf->v4)
BLI_edgehash_insert(vertpahash, mf->v4, mindex, NULL);
}
/* make new vertice indexes & count total vertices after duplication */
ehi= BLI_edgehashIterator_new(vertpahash);
- for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+ for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totdup));
totdup++;
}
@@ -867,7 +868,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
/* duplicate & displace vertices */
ehi= BLI_edgehashIterator_new(vertpahash);
- for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+ for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
MVert source;
MVert *dest;
@@ -882,7 +883,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
DM_copy_vert_data(dm, explode, ed_v1, v, 1);
*dest = source;
- if(ed_v2 != totpart) {
+ if (ed_v2 != totpart) {
/* get particle */
pa= pars + ed_v2;
@@ -900,7 +901,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
sub_qt_qtqt(rot, state.rot, birth.rot);
mul_qt_v3(rot, vertco);
- if(emd->flag & eExplodeFlag_PaSize)
+ if (emd->flag & eExplodeFlag_PaSize)
mul_v3_fl(vertco,pa->size);
add_v3_v3(vertco, state.co);
@@ -918,9 +919,9 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
if (facepa[i]!=totpart) {
pa=pars+facepa[i];
- if(pa->alive==PARS_UNBORN && (emd->flag&eExplodeFlag_Unborn)==0) continue;
- if(pa->alive==PARS_ALIVE && (emd->flag&eExplodeFlag_Alive)==0) continue;
- if(pa->alive==PARS_DEAD && (emd->flag&eExplodeFlag_Dead)==0) continue;
+ if (pa->alive==PARS_UNBORN && (emd->flag&eExplodeFlag_Unborn)==0) continue;
+ if (pa->alive==PARS_ALIVE && (emd->flag&eExplodeFlag_Alive)==0) continue;
+ if (pa->alive==PARS_DEAD && (emd->flag&eExplodeFlag_Dead)==0) continue;
}
dm->getTessFace(dm,i,&source);
@@ -928,7 +929,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
orig_v4 = source.v4;
- if(facepa[i]!=totpart && cfra < pa->time)
+ if (facepa[i]!=totpart && cfra < pa->time)
mindex = totvert+totpart;
else
mindex = totvert+facepa[i];
@@ -936,7 +937,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
source.v1 = edgecut_get(vertpahash, source.v1, mindex);
source.v2 = edgecut_get(vertpahash, source.v2, mindex);
source.v3 = edgecut_get(vertpahash, source.v3, mindex);
- if(source.v4)
+ if (source.v4)
source.v4 = edgecut_get(vertpahash, source.v4, mindex);
DM_copy_tessface_data(dm,explode,i,u,1);
@@ -944,7 +945,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
*mf = source;
/* override uv channel for particle age */
- if(mtface) {
+ if (mtface) {
float age = (cfra - pa->time)/pa->lifetime;
/* Clamp to this range to avoid flipping to the other side of the coordinates. */
CLAMP(age, 0.001f, 0.999f);
@@ -967,7 +968,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
CDDM_tessfaces_to_faces(explode);
CDDM_calc_normals(explode);
- if(psmd->psys->lattice){
+ if (psmd->psys->lattice) {
end_latt_deform(psmd->psys->lattice);
psmd->psys->lattice= NULL;
}
@@ -980,8 +981,8 @@ static ParticleSystemModifierData * findPrecedingParticlesystem(Object *ob, Modi
ModifierData *md;
ParticleSystemModifierData *psmd= NULL;
- for (md=ob->modifiers.first; emd!=md; md=md->next){
- if(md->type==eModifierType_ParticleSystem)
+ for (md=ob->modifiers.first; emd!=md; md=md->next) {
+ if (md->type==eModifierType_ParticleSystem)
psmd= (ParticleSystemModifierData*) md;
}
return psmd;
@@ -997,29 +998,29 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
- if(psmd){
+ if (psmd) {
ParticleSystem * psys=psmd->psys;
- if(psys==NULL || psys->totpart==0) return derivedData;
- if(psys->part==NULL || psys->particles==NULL) return derivedData;
- if(psmd->dm==NULL) return derivedData;
+ if (psys==NULL || psys->totpart==0) return derivedData;
+ if (psys->part==NULL || psys->particles==NULL) return derivedData;
+ if (psmd->dm==NULL) return derivedData;
/* 1. find faces to be exploded if needed */
- if(emd->facepa == NULL
+ if (emd->facepa == NULL
|| psmd->flag&eParticleSystemFlag_Pars
|| emd->flag&eExplodeFlag_CalcFaces
|| MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumTessFaces(dm))
{
- if(psmd->flag & eParticleSystemFlag_Pars)
+ if (psmd->flag & eParticleSystemFlag_Pars)
psmd->flag &= ~eParticleSystemFlag_Pars;
- if(emd->flag & eExplodeFlag_CalcFaces)
+ if (emd->flag & eExplodeFlag_CalcFaces)
emd->flag &= ~eExplodeFlag_CalcFaces;
createFacepa(emd,psmd,derivedData);
}
/* 2. create new mesh */
- if(emd->flag & eExplodeFlag_EdgeCut){
+ if (emd->flag & eExplodeFlag_EdgeCut) {
int *facepa = emd->facepa;
DerivedMesh *splitdm=cutEdges(emd,dm);
DerivedMesh *explode=explodeMesh(emd, psmd, md->scene, ob, splitdm);
diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c
index 3df8718a7c1..9a80f241a00 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim.c
@@ -68,7 +68,7 @@ static void copyData(ModifierData *md, ModifierData *target)
FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
FluidsimModifierData *tfluidmd= (FluidsimModifierData*) target;
- if(tfluidmd->fss)
+ if (tfluidmd->fss)
MEM_freeN(tfluidmd->fss);
tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
@@ -85,7 +85,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
DerivedMesh *result = NULL;
/* check for alloc failing */
- if(!fluidmd->fss) {
+ if (!fluidmd->fss) {
initData(md);
if (!fluidmd->fss) {
@@ -105,15 +105,15 @@ static void updateDepgraph(
FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
Base *base;
- if(fluidmd && fluidmd->fss) {
- if(fluidmd->fss->type == OB_FLUIDSIM_DOMAIN) {
- for(base = scene->base.first; base; base= base->next) {
+ if (fluidmd && fluidmd->fss) {
+ if (fluidmd->fss->type == OB_FLUIDSIM_DOMAIN) {
+ for (base = scene->base.first; base; base= base->next) {
Object *ob1= base->object;
- if(ob1 != ob) {
+ if (ob1 != ob) {
FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob1, eModifierType_Fluidsim);
// only put dependancies from NON-DOMAIN fluids in here
- if(fluidmdtmp && fluidmdtmp->fss && (fluidmdtmp->fss->type!=OB_FLUIDSIM_DOMAIN)) {
+ if (fluidmdtmp && fluidmdtmp->fss && (fluidmdtmp->fss->type!=OB_FLUIDSIM_DOMAIN)) {
DagNode *curNode = dag_get_node(forest, ob1);
dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Fluidsim Object");
}
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 42a6f74aba5..9cd656c3621 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -66,13 +66,13 @@
void fluidsim_init(FluidsimModifierData *fluidmd)
{
#ifdef WITH_MOD_FLUID
- if(fluidmd)
+ if (fluidmd)
{
FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings");
fluidmd->fss = fss;
- if(!fss)
+ if (!fss)
return;
fss->fmd = fluidmd;
@@ -184,7 +184,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
// ------------------------------------------------
// get numverts + numfaces first
// ------------------------------------------------
- gzf = gzopen(filename, "rb");
+ gzf = BLI_gzopen(filename, "rb");
if (!gzf)
{
return NULL;
@@ -199,24 +199,24 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
// read number of normals
- if(gotBytes)
+ if (gotBytes)
gotBytes = gzread(gzf, &wri, sizeof(wri));
// skip normals
gotBytes = gzseek(gzf, numverts * 3 * sizeof(float), SEEK_CUR) != -1;
/* get no. of triangles */
- if(gotBytes)
+ if (gotBytes)
gotBytes = gzread(gzf, &wri, sizeof(wri));
numfaces = wri;
- gzclose( gzf );
+ gzclose(gzf);
// ------------------------------------------------
- if(!numfaces || !numverts || !gotBytes)
+ if (!numfaces || !numverts || !gotBytes)
return NULL;
- gzf = gzopen(filename, "rb");
+ gzf = BLI_gzopen(filename, "rb");
if (!gzf)
{
return NULL;
@@ -224,9 +224,9 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
dm = CDDM_new(numverts, 0, 0, numfaces * 3, numfaces);
- if(!dm)
+ if (!dm)
{
- gzclose( gzf );
+ gzclose(gzf);
return NULL;
}
@@ -236,30 +236,30 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
// read vertex position from file
mv = CDDM_get_verts(dm);
- for(i=0; i<numverts; i++, mv++)
+ for (i=0; i<numverts; i++, mv++)
gotBytes = gzread(gzf, mv->co, sizeof(float) * 3);
// should be the same as numverts
gotBytes = gzread(gzf, &wri, sizeof(wri));
- if(wri != numverts)
+ if (wri != numverts)
{
- if(dm)
+ if (dm)
dm->release(dm);
- gzclose( gzf );
+ gzclose(gzf);
return NULL;
}
normals = MEM_callocN(sizeof(short) * numverts * 3, "fluid_tmp_normals" );
- if(!normals)
+ if (!normals)
{
- if(dm)
+ if (dm)
dm->release(dm);
- gzclose( gzf );
+ gzclose(gzf);
return NULL;
}
// 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);
@@ -268,11 +268,11 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
/* read no. of triangles */
gotBytes = gzread(gzf, &wri, sizeof(wri));
- if(wri!=numfaces) {
+ if (wri!=numfaces) {
printf("Fluidsim: error in reading data from file.\n");
- if(dm)
+ if (dm)
dm->release(dm);
- gzclose( gzf );
+ gzclose(gzf);
MEM_freeN(normals);
return NULL;
}
@@ -280,7 +280,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
// read triangles from file
mp = CDDM_get_polys(dm);
ml = CDDM_get_loops(dm);
- for(i=0; i < numfaces; i++, mp++, ml += 3)
+ for (i=0; i < numfaces; i++, mp++, ml += 3)
{
int face[3];
@@ -299,7 +299,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
}
- gzclose( gzf );
+ gzclose(gzf);
CDDM_calc_edges(dm);
@@ -319,7 +319,7 @@ void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4],
int i;
float vec[3];
- if(totvert == 0) {
+ if (totvert == 0) {
zero_v3(start);
zero_v3(size);
return;
@@ -330,25 +330,25 @@ void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4],
bbsx = vec[0]; bbsy = vec[1]; bbsz = vec[2];
bbex = vec[0]; bbey = vec[1]; bbez = vec[2];
- for(i = 1; i < totvert; i++) {
+ for (i = 1; i < totvert; i++) {
copy_v3_v3(vec, mvert[i].co);
mul_m4_v3(obmat, vec);
- if(vec[0] < bbsx){ bbsx= vec[0]; }
- if(vec[1] < bbsy){ bbsy= vec[1]; }
- if(vec[2] < bbsz){ bbsz= vec[2]; }
- if(vec[0] > bbex){ bbex= vec[0]; }
- if(vec[1] > bbey){ bbey= vec[1]; }
- if(vec[2] > bbez){ bbez= vec[2]; }
+ if (vec[0] < bbsx) { bbsx= vec[0]; }
+ if (vec[1] < bbsy) { bbsy= vec[1]; }
+ if (vec[2] < bbsz) { bbsz= vec[2]; }
+ if (vec[0] > bbex) { bbex= vec[0]; }
+ if (vec[1] > bbey) { bbey= vec[1]; }
+ if (vec[2] > bbez) { bbez= vec[2]; }
}
// return values...
- if(start) {
+ if (start) {
start[0] = bbsx;
start[1] = bbsy;
start[2] = bbsz;
}
- if(size) {
+ if (size) {
size[0] = bbex-bbsx;
size[1] = bbey-bbsy;
size[2] = bbez-bbsz;
@@ -365,7 +365,7 @@ void fluid_estimate_memory(Object *ob, FluidsimSettings *fss, char *value)
value[0]= '\0';
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
/* use mesh bounding box and object scaling */
mesh= ob->data;
@@ -388,15 +388,15 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
// mesh and vverts have to be valid from loading...
- if(fss->meshVelocities)
+ if (fss->meshVelocities)
MEM_freeN(fss->meshVelocities);
- if(len<7)
+ if (len<7)
{
return;
}
- if(fss->domainNovecgen>0) return;
+ if (fss->domainNovecgen>0) return;
fss->meshVelocities = MEM_callocN(sizeof(FluidVertexVelocity)*dm->getNumVerts(dm), "Fluidsim_velocities");
fss->totvert = totvert;
@@ -409,7 +409,7 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
filename[len-5] = 'e';
filename[len-4] = 'l';
- gzf = gzopen(filename, "rb");
+ gzf = BLI_gzopen(filename, "rb");
if (!gzf)
{
MEM_freeN(fss->meshVelocities);
@@ -418,16 +418,16 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
}
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 (i=0; i<totvert;i++)
{
- for(j=0; j<3; j++)
+ for (j=0; j<3; j++)
{
gzread(gzf, &wrf, sizeof( wrf ));
velarray[i].vel[j] = wrf;
@@ -447,9 +447,10 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim
MPoly *mpoly;
MPoly mp_example = {0};
- if(!useRenderParams) {
+ if (!useRenderParams) {
displaymode = fss->guiDisplayMode;
- } else {
+ }
+ else {
displaymode = fss->renderDisplayMode;
}
@@ -483,15 +484,15 @@ 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
- if(G.background==1) {
- if(getenv(strEnvName2)) {
+ if (G.background==1) {
+ if (getenv(strEnvName2)) {
int elevel = atoi(getenv(strEnvName2));
- if(elevel>0) {
+ if (elevel>0) {
printf("Env. var %s set, fluid sim mesh '%s' not found, aborting render...\n",strEnvName2, targetFile);
exit(1);
}
@@ -509,7 +510,7 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim
fluidsim_read_vel_cache(fluidmd, dm, targetFile);
}
else {
- if(fss->meshVelocities)
+ if (fss->meshVelocities)
MEM_freeN(fss->meshVelocities);
fss->meshVelocities = NULL;
@@ -532,11 +533,11 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
framenr= (int)scene->r.cfra;
// only handle fluidsim domains
- if(fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN))
+ if (fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN))
return dm;
// sanity check
- if(!fluidmd || (fluidmd && !fluidmd->fss))
+ if (!fluidmd || (fluidmd && !fluidmd->fss))
return dm;
fss = fluidmd->fss;
@@ -552,7 +553,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
/* try to read from cache */
/* if the frame is there, fine, otherwise don't do anything */
- if((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams)))
+ if ((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams)))
return result;
return dm;
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 97e406c6960..d8fbb6f468f 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -81,8 +81,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(hmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
- if(hmd->indexar) dataMask |= CD_MASK_ORIGINDEX;
+ if (hmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+ if (hmd->indexar) dataMask |= CD_MASK_ORIGINDEX;
return dataMask;
}
@@ -130,12 +130,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
static float hook_falloff(float *co_1, float *co_2, const float falloff_squared, float fac)
{
- if(falloff_squared) {
+ if (falloff_squared) {
float len_squared = len_squared_v3v3(co_1, co_2);
- if(len_squared > falloff_squared) {
+ if (len_squared > falloff_squared) {
return 0.0f;
}
- else if(len_squared > 0.0f) {
+ else if (len_squared > 0.0f) {
return fac * (1.0f - (len_squared / falloff_squared));
}
}
@@ -178,28 +178,28 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
* not correct them on exit editmode. - zr
*/
- if(hmd->force == 0.0f) {
+ if (hmd->force == 0.0f) {
/* do nothing, avoid annoying checks in the loop */
}
- else if(hmd->indexar) { /* vertex indices? */
+ else if (hmd->indexar) { /* vertex indices? */
const float fac_orig= hmd->force;
float fac;
const int *origindex_ar;
/* if DerivedMesh is present and has original index data, use it */
- if(dm && (origindex_ar= dm->getVertDataArray(dm, CD_ORIGINDEX))) {
- for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
- if(*index_pt < numVerts) {
+ if (dm && (origindex_ar= dm->getVertDataArray(dm, CD_ORIGINDEX))) {
+ for (i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
+ if (*index_pt < numVerts) {
int j;
- for(j = 0; j < numVerts; j++) {
- if(origindex_ar[j] == *index_pt) {
+ for (j = 0; j < numVerts; j++) {
+ if (origindex_ar[j] == *index_pt) {
float *co = vertexCos[j];
- if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
- if(dvert)
+ if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+ if (dvert)
fac *= defvert_find_weight(dvert+j, defgrp_index);
- if(fac) {
+ if (fac) {
mul_v3_m4v3(vec, mat, co);
interp_v3_v3v3(co, co, vec, fac);
}
@@ -210,14 +210,14 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
}
}
else { /* missing dm or ORIGINDEX */
- for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
- if(*index_pt < numVerts) {
+ for (i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
+ if (*index_pt < numVerts) {
float *co = vertexCos[*index_pt];
- if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
- if(dvert)
+ if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+ if (dvert)
fac *= defvert_find_weight(dvert+(*index_pt), defgrp_index);
- if(fac) {
+ if (fac) {
mul_v3_m4v3(vec, mat, co);
interp_v3_v3v3(co, co, vec, fac);
}
@@ -226,16 +226,16 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
}
}
}
- else if(dvert) { /* vertex group hook */
+ else if (dvert) { /* vertex group hook */
const float fac_orig= hmd->force;
- for(i = 0; i < max_dvert; i++, dvert++) {
+ for (i = 0; i < max_dvert; i++, dvert++) {
float fac;
float *co = vertexCos[i];
- if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+ if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
fac *= defvert_find_weight(dvert, defgrp_index);
- if(fac) {
+ if (fac) {
mul_v3_m4v3(vec, mat, co);
interp_v3_v3v3(co, co, vec, fac);
}
@@ -251,12 +251,12 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
HookModifierData *hmd = (HookModifierData*) md;
DerivedMesh *dm = derivedData;
/* We need a valid dm for meshes when a vgroup is set... */
- if(!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
+ if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
dm = get_dm(ob, NULL, dm, NULL, 0);
deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
- if(derivedData != dm)
+ if (derivedData != dm)
dm->release(dm);
}
@@ -266,12 +266,12 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD
HookModifierData *hmd = (HookModifierData*) md;
DerivedMesh *dm = derivedData;
/* We need a valid dm for meshes when a vgroup is set... */
- if(!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
+ if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
dm = get_dm(ob, editData, dm, NULL, 0);
deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
- if(derivedData != dm)
+ if (derivedData != dm)
dm->release(dm);
}
diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index 00a634e8838..35503f9e462 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -65,7 +65,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(lmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+ if (lmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
return dataMask;
}
@@ -94,7 +94,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
{
LatticeModifierData *lmd = (LatticeModifierData*) md;
- if(lmd->object) {
+ if (lmd->object) {
DagNode *latNode = dag_get_node(forest, lmd->object);
dag_add_relation(forest, latNode, obNode,
@@ -124,11 +124,11 @@ static void deformVertsEM(
{
DerivedMesh *dm = derivedData;
- if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+ if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0);
- if(!derivedData) dm->release(dm);
+ if (!derivedData) dm->release(dm);
}
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index b9768ff9999..da4a489838f 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -203,7 +203,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
for (j= dv->totweight; j > 0; j--, dw++) {
if (dw->def_nr < defbase_tot) {
if (bone_select_array[dw->def_nr]) {
- if(dw->weight != 0.0f) {
+ if (dw->weight != 0.0f) {
break;
}
}
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index 84d1b3c92ad..08626e55231 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -39,6 +39,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"
@@ -65,14 +66,14 @@ static void freeData(ModifierData *md)
{
MeshDeformModifierData *mmd = (MeshDeformModifierData*) md;
- if(mmd->bindinfluences) MEM_freeN(mmd->bindinfluences);
- if(mmd->bindoffsets) MEM_freeN(mmd->bindoffsets);
- if(mmd->bindcagecos) MEM_freeN(mmd->bindcagecos);
- if(mmd->dyngrid) MEM_freeN(mmd->dyngrid);
- if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
- if(mmd->dynverts) MEM_freeN(mmd->dynverts);
- if(mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
- if(mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
+ if (mmd->bindinfluences) MEM_freeN(mmd->bindinfluences);
+ if (mmd->bindoffsets) MEM_freeN(mmd->bindoffsets);
+ if (mmd->bindcagecos) MEM_freeN(mmd->bindcagecos);
+ if (mmd->dyngrid) MEM_freeN(mmd->dyngrid);
+ if (mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
+ if (mmd->dynverts) MEM_freeN(mmd->dynverts);
+ if (mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
+ if (mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
}
static void copyData(ModifierData *md, ModifierData *target)
@@ -90,7 +91,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(mmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+ if (mmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
return dataMask;
}
@@ -140,20 +141,20 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3
totweight= 0.0f;
size= mmd->dyngridsize;
- for(i=0; i<3; i++) {
+ for (i=0; i<3; i++) {
gridvec[i]= (vec[i] - mmd->dyncellmin[i] - mmd->dyncellwidth*0.5f)/mmd->dyncellwidth;
ivec[i]= (int)gridvec[i];
dvec[i]= gridvec[i] - ivec[i];
}
- for(i=0; i<8; i++) {
- if(i & 1) { x= ivec[0]+1; wx= dvec[0]; }
+ for (i=0; i<8; i++) {
+ if (i & 1) { x= ivec[0]+1; wx= dvec[0]; }
else { x= ivec[0]; wx= 1.0f-dvec[0]; }
- if(i & 2) { y= ivec[1]+1; wy= dvec[1]; }
+ if (i & 2) { y= ivec[1]+1; wy= dvec[1]; }
else { y= ivec[1]; wy= 1.0f-dvec[1]; }
- if(i & 4) { z= ivec[2]+1; wz= dvec[2]; }
+ if (i & 4) { z= ivec[2]+1; wz= dvec[2]; }
else { z= ivec[2]; wz= 1.0f-dvec[2]; }
CLAMP(x, 0, size-1);
@@ -165,7 +166,7 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3
cell= &mmd->dyngrid[a];
inf= mmd->dyninfluences + cell->offset;
- for(j=0; j<cell->totinfluence; j++, inf++) {
+ for (j=0; j<cell->totinfluence; j++, inf++) {
cageco= dco[inf->vertex];
cageweight= weight*inf->weight;
co[0] += cageweight*cageco[0];
@@ -196,13 +197,13 @@ static void meshdeformModifier_do(
int a, b, totvert, totcagevert, defgrp_index;
float (*cagecos)[3];
- if(!mmd->object || (!mmd->bindcagecos && !mmd->bindfunc))
+ if (!mmd->object || (!mmd->bindcagecos && !mmd->bindfunc))
return;
/* get cage derivedmesh */
- if(em) {
+ if (em) {
tmpdm= editbmesh_get_derived_cage_and_final(md->scene, ob, em, &cagedm, 0);
- if(tmpdm)
+ if (tmpdm)
tmpdm->release(tmpdm);
}
else
@@ -210,14 +211,14 @@ static void meshdeformModifier_do(
/* if we don't have one computed, use derivedmesh from data
* without any modifiers */
- if(!cagedm) {
+ if (!cagedm) {
cagedm= get_dm(mmd->object, NULL, NULL, NULL, 0);
- if(cagedm)
+ if (cagedm)
cagedm->needsFree= 1;
}
- if(!cagedm) {
- modifier_setError(md, "Can't get mesh from cage object.");
+ if (!cagedm) {
+ modifier_setError(md, "%s", TIP_("Can't get mesh from cage object."));
return;
}
@@ -229,11 +230,11 @@ static void meshdeformModifier_do(
copy_m3_m4(icagemat, iobmat);
/* bind weights if needed */
- if(!mmd->bindcagecos) {
+ if (!mmd->bindcagecos) {
static int recursive = 0;
/* progress bar redraw can make this recursive .. */
- if(!recursive) {
+ if (!recursive) {
recursive = 1;
mmd->bindfunc(md->scene, mmd, (float*)vertexCos, numVerts, cagemat);
recursive = 0;
@@ -244,17 +245,18 @@ static void meshdeformModifier_do(
totvert= numVerts;
totcagevert= cagedm->getNumVerts(cagedm);
- if(mmd->totvert != totvert) {
- modifier_setError(md, "Verts changed from %d to %d.", mmd->totvert, totvert);
+ if (mmd->totvert != totvert) {
+ modifier_setError(md, TIP_("Verts changed from %d to %d."), mmd->totvert, totvert);
cagedm->release(cagedm);
return;
}
else if (mmd->totcagevert != totcagevert) {
- modifier_setError(md, "Cage verts changed from %d to %d.", mmd->totcagevert, totcagevert);
+ modifier_setError(md, TIP_("Cage verts changed from %d to %d."), mmd->totcagevert, totcagevert);
cagedm->release(cagedm);
return;
- } else if (mmd->bindcagecos == NULL) {
- modifier_setError(md, "Bind data missing.");
+ }
+ else if (mmd->bindcagecos == NULL) {
+ modifier_setError(md, "%s", TIP_("Bind data missing."));
cagedm->release(cagedm);
return;
}
@@ -268,11 +270,11 @@ static void meshdeformModifier_do(
bindcagecos= (float(*)[3])mmd->bindcagecos;
dco= MEM_callocN(sizeof(*dco)*totcagevert, "MDefDco");
- for(a=0; a<totcagevert; a++) {
+ for (a=0; a<totcagevert; a++) {
/* get cage vertex in world space with binding transform */
copy_v3_v3(co, cagecos[a]);
- if(G.rt != 527) {
+ if (G.rt != 527) {
mul_m4_v3(mmd->bindmat, co);
/* compute difference with world space bind coord */
sub_v3_v3v3(dco[a], co, bindcagecos[a]);
@@ -286,12 +288,12 @@ static void meshdeformModifier_do(
/* do deformation */
fac= 1.0f;
- for(b=0; b<totvert; b++) {
- if(mmd->flag & MOD_MDEF_DYNAMIC_BIND)
- if(!mmd->dynverts[b])
+ for (b=0; b<totvert; b++) {
+ if (mmd->flag & MOD_MDEF_DYNAMIC_BIND)
+ if (!mmd->dynverts[b])
continue;
- if(dvert) {
+ if (dvert) {
fac= defvert_find_weight(&dvert[b], defgrp_index);
if (mmd->flag & MOD_MDEF_INVERT_VGROUP) {
@@ -303,7 +305,7 @@ static void meshdeformModifier_do(
}
}
- if(mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
+ if (mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
/* transform coordinate into cage's local space */
mul_v3_m4v3(co, cagemat, vertexCos[b]);
totweight= meshdeform_dynamic_bind(mmd, dco, co);
@@ -312,17 +314,17 @@ static void meshdeformModifier_do(
totweight= 0.0f;
zero_v3(co);
- for(a=offsets[b]; a<offsets[b+1]; a++) {
+ for (a=offsets[b]; a<offsets[b+1]; a++) {
weight= influences[a].weight;
madd_v3_v3fl(co, dco[influences[a].vertex], weight);
totweight += weight;
}
}
- if(totweight > 0.0f) {
+ if (totweight > 0.0f) {
mul_v3_fl(co, fac/totweight);
mul_m3_v3(icagemat, co);
- if(G.rt != 527)
+ if (G.rt != 527)
add_v3_v3(vertexCos[b], co);
else
copy_v3_v3(vertexCos[b], co);
@@ -348,7 +350,7 @@ static void deformVerts(ModifierData *md, Object *ob,
meshdeformModifier_do(md, ob, dm, vertexCos, numVerts);
- if(dm && dm != derivedData)
+ if (dm && dm != derivedData)
dm->release(dm);
}
@@ -362,7 +364,7 @@ static void deformVertsEM(ModifierData *md, Object *ob,
meshdeformModifier_do(md, ob, dm, vertexCos, numVerts);
- if(dm && dm != derivedData)
+ if (dm && dm != derivedData)
dm->release(dm);
}
@@ -375,18 +377,18 @@ void modifier_mdef_compact_influences(ModifierData *md)
int totinfluence, totvert, totcagevert, a, b;
weights= mmd->bindweights;
- if(!weights)
+ if (!weights)
return;
totvert= mmd->totvert;
totcagevert= mmd->totcagevert;
/* count number of influences above threshold */
- for(b=0; b<totvert; b++) {
- for(a=0; a<totcagevert; a++) {
+ for (b=0; b<totvert; b++) {
+ for (a=0; a<totcagevert; a++) {
weight= weights[a + b*totcagevert];
- if(weight > MESHDEFORM_MIN_INFLUENCE)
+ if (weight > MESHDEFORM_MIN_INFLUENCE)
mmd->totinfluence++;
}
}
@@ -398,23 +400,23 @@ void modifier_mdef_compact_influences(ModifierData *md)
/* write influences */
totinfluence= 0;
- for(b=0; b<totvert; b++) {
+ for (b=0; b<totvert; b++) {
mmd->bindoffsets[b]= totinfluence;
totweight= 0.0f;
/* sum total weight */
- for(a=0; a<totcagevert; a++) {
+ for (a=0; a<totcagevert; a++) {
weight= weights[a + b*totcagevert];
- if(weight > MESHDEFORM_MIN_INFLUENCE)
+ if (weight > MESHDEFORM_MIN_INFLUENCE)
totweight += weight;
}
/* assign weights normalized */
- for(a=0; a<totcagevert; a++) {
+ for (a=0; a<totcagevert; a++) {
weight= weights[a + b*totcagevert];
- if(weight > MESHDEFORM_MIN_INFLUENCE) {
+ if (weight > MESHDEFORM_MIN_INFLUENCE) {
mmd->bindinfluences[totinfluence].weight= weight/totweight;
mmd->bindinfluences[totinfluence].vertex= a;
totinfluence++;
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index 51e65e2387a..1284d5a6769 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -84,7 +84,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
{
MirrorModifierData *mmd = (MirrorModifierData*) md;
- if(mmd->mirror_ob) {
+ if (mmd->mirror_ob) {
DagNode *latNode = dag_get_node(forest, mmd->mirror_ob);
dag_add_relation(forest, latNode, obNode,
@@ -162,7 +162,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
}
/* copy customdata to new geometry,
- * copy from its self becayse this data may have been created in the checks above */
+ * copy from its self because this data may have been created in the checks above */
DM_copy_vert_data(result, result, 0, maxVerts, maxVerts);
DM_copy_edge_data(result, result, 0, maxEdges, maxEdges);
/* loops are copied later */
@@ -272,8 +272,12 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
flip_map= defgroup_flip_map(ob, &flip_map_len, FALSE);
if (flip_map) {
- for (i = maxVerts; i-- > 0; dvert++) {
- defvert_flip(dvert, flip_map, flip_map_len);
+ for (i = 0; i < maxVerts; dvert++, i++) {
+ /* merged vertices get both groups, others get flipped */
+ if (do_vtargetmap && (vtargetmap[i] != -1))
+ defvert_flip_merged(dvert, flip_map, flip_map_len);
+ else
+ defvert_flip(dvert, flip_map, flip_map_len);
}
MEM_freeN(flip_map);
@@ -298,18 +302,18 @@ static DerivedMesh *mirrorModifier__doMirror(MirrorModifierData *mmd,
DerivedMesh *result = dm;
/* check which axes have been toggled and mirror accordingly */
- if(mmd->flag & MOD_MIR_AXIS_X) {
+ if (mmd->flag & MOD_MIR_AXIS_X) {
result = doMirrorOnAxis(mmd, ob, result, 0);
}
- if(mmd->flag & MOD_MIR_AXIS_Y) {
+ if (mmd->flag & MOD_MIR_AXIS_Y) {
DerivedMesh *tmp = result;
result = doMirrorOnAxis(mmd, ob, result, 1);
- if(tmp != dm) tmp->release(tmp); /* free intermediate results */
+ if (tmp != dm) tmp->release(tmp); /* free intermediate results */
}
- if(mmd->flag & MOD_MIR_AXIS_Z) {
+ if (mmd->flag & MOD_MIR_AXIS_Z) {
DerivedMesh *tmp = result;
result = doMirrorOnAxis(mmd, ob, result, 2);
- if(tmp != dm) tmp->release(tmp); /* free intermediate results */
+ if (tmp != dm) tmp->release(tmp); /* free intermediate results */
}
return result;
@@ -325,7 +329,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
result = mirrorModifier__doMirror(mmd, ob, derivedData);
- if(result != derivedData)
+ if (result != derivedData)
CDDM_calc_normals(result);
return result;
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c
index 00572eaad86..57268d04947 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -36,12 +36,14 @@
#include <stddef.h>
#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
#include "BKE_cdderivedmesh.h"
+#include "BKE_mesh.h"
#include "BKE_multires.h"
#include "BKE_modifier.h"
#include "BKE_paint.h"
-#include "BKE_particle.h"
+#include "BKE_subsurf.h"
#include "MOD_util.h"
@@ -71,34 +73,48 @@ static void copyData(ModifierData *md, ModifierData *target)
static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm,
int useRenderParams, int isFinalCalc)
{
- SculptSession *ss= ob->sculpt;
- int sculpting= (ob->mode & OB_MODE_SCULPT) && ss;
MultiresModifierData *mmd = (MultiresModifierData*)md;
DerivedMesh *result;
Mesh *me= (Mesh*)ob->data;
- if(mmd->totlvl) {
- if(!CustomData_get_layer(&me->ldata, CD_MDISPS)) {
+ if (mmd->totlvl) {
+ if (!CustomData_get_layer(&me->ldata, CD_MDISPS)) {
/* multires always needs a displacement layer */
CustomData_add_layer(&me->ldata, CD_MDISPS, CD_CALLOC, NULL, me->totloop);
}
}
- result = multires_dm_create_from_derived(mmd, 0, dm, ob, useRenderParams, isFinalCalc);
+ result = multires_dm_create_from_derived(mmd, 0, dm, ob, useRenderParams);
- if(result == dm)
+ if (result == dm)
return dm;
- if(useRenderParams || !isFinalCalc) {
- DerivedMesh *cddm= CDDM_copy(result);
+ if (useRenderParams || !isFinalCalc) {
+ DerivedMesh *cddm;
+
+ cddm= CDDM_copy(result);
+
+ /* copy hidden flag to vertices */
+ if (!useRenderParams) {
+ struct MDisps *mdisps;
+ mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
+ if (mdisps) {
+ subsurf_copy_grid_hidden(result, me->mpoly,
+ cddm->getVertArray(cddm),
+ mdisps);
+
+ mesh_flush_hidden_from_verts(cddm->getVertArray(cddm),
+ cddm->getLoopArray(cddm),
+ cddm->getEdgeArray(cddm),
+ cddm->getNumEdges(cddm),
+ cddm->getPolyArray(cddm),
+ cddm->getNumPolys(cddm));
+ }
+ }
+
result->release(result);
result= cddm;
}
- else if(sculpting) {
- /* would be created on the fly too, just nicer this
- * way on first stroke after e.g. switching levels */
- ss->pbvh= result->getPBVH(ob, result);
- }
return result;
}
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index b3553c04cf4..4119f49dcdb 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -240,7 +240,7 @@ static void dm_get_bounds(DerivedMesh *dm, float *sx, float *sy, float *ox, floa
copy_v3_v3(min, mvert->co);
copy_v3_v3(max, mvert->co);
- for(v=1; v<totvert; v++, mvert++) {
+ for (v=1; v<totvert; v++, mvert++) {
min[0]=MIN2(min[0],mvert->co[0]);
min[1]=MIN2(min[1],mvert->co[1]);
min[2]=MIN2(min[2],mvert->co[2]);
@@ -352,7 +352,7 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd)
/* add uvs */
cdlayer= CustomData_number_of_layers(&result->loopData, CD_MLOOPUV);
- if(cdlayer < MAX_MTFACE) {
+ if (cdlayer < MAX_MTFACE) {
MLoopUV *mloopuvs= CustomData_add_layer(&result->loopData, CD_MLOOPUV, CD_CALLOC, NULL, num_faces * 4);
if (mloopuvs) { /* unlikely to fail */
@@ -455,7 +455,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob,
if (omd->flag & MOD_OCEAN_GENERATE_FOAM) {
int cdlayer= CustomData_number_of_layers(&dm->loopData, CD_MLOOPCOL);
- if(cdlayer < MAX_MCOL) {
+ if (cdlayer < MAX_MCOL) {
MLoopCol *mloopcols= CustomData_add_layer_named(&dm->loopData, CD_MLOOPCOL, CD_CALLOC, NULL, num_faces * 4, omd->foamlayername);
if (mloopcols) { /* unlikely to fail */
@@ -540,7 +540,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
result = doOcean(md, ob, derivedData, 0);
- if(result != derivedData)
+ if (result != derivedData)
CDDM_calc_normals(result);
return result;
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index 3f600947b1a..628104295f7 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -126,27 +126,27 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
trackneg=((ob->trackflag>2)?1:0);
- if(pimd->ob==ob){
+ if (pimd->ob==ob) {
pimd->ob= NULL;
return derivedData;
}
- if(pimd->ob){
+ if (pimd->ob) {
psys = BLI_findlink(&pimd->ob->particlesystem,pimd->psys-1);
- if(psys==NULL || psys->totpart==0)
+ if (psys==NULL || psys->totpart==0)
return derivedData;
}
else return derivedData;
- if(pimd->flag & eParticleInstanceFlag_Parents)
+ if (pimd->flag & eParticleInstanceFlag_Parents)
totpart+=psys->totpart;
- if(pimd->flag & eParticleInstanceFlag_Children){
- if(totpart==0)
+ if (pimd->flag & eParticleInstanceFlag_Children) {
+ if (totpart==0)
first_particle=psys->totpart;
totpart+=psys->totchild;
}
- if(totpart==0)
+ if (totpart==0)
return derivedData;
sim.scene = md->scene;
@@ -154,20 +154,20 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
sim.psys = psys;
sim.psmd = psys_get_modifier(pimd->ob, psys);
- if(pimd->flag & eParticleInstanceFlag_UseSize) {
+ if (pimd->flag & eParticleInstanceFlag_UseSize) {
int p;
float *si;
si = size = MEM_callocN(totpart * sizeof(float), "particle size array");
- if(pimd->flag & eParticleInstanceFlag_Parents) {
- for(p=0, pa= psys->particles; p<psys->totpart; p++, pa++, si++)
+ if (pimd->flag & eParticleInstanceFlag_Parents) {
+ for (p=0, pa= psys->particles; p<psys->totpart; p++, pa++, si++)
*si = pa->size;
}
- if(pimd->flag & eParticleInstanceFlag_Children) {
+ if (pimd->flag & eParticleInstanceFlag_Children) {
ChildParticle *cpa = psys->child;
- for(p=0; p<psys->totchild; p++, cpa++, si++) {
+ for (p=0; p<psys->totchild; p++, cpa++, si++) {
*si = psys_get_child_size(psys, cpa, 0.0f, NULL);
}
}
@@ -183,7 +183,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
psys->lattice=psys_get_lattice(&sim);
- if(psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED){
+ if (psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) {
float min_r[3], max_r[3];
INIT_MINMAX(min_r, max_r);
@@ -197,7 +197,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
mvert=result->getVertArray(result);
orig_mvert=dm->getVertArray(dm);
- for(i=0; i<maxvert; i++){
+ for (i=0; i<maxvert; i++) {
MVert *inMV;
MVert *mv = mvert + i;
ParticleKey state;
@@ -212,20 +212,20 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
mv->co[(axis+1)%3]=temp_co[(track+1)%3];
mv->co[(axis+2)%3]=temp_co[(track+2)%3];
- if((psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) && pimd->flag & eParticleInstanceFlag_Path){
+ if ((psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) && pimd->flag & eParticleInstanceFlag_Path) {
float ran = 0.0f;
- if(pimd->random_position != 0.0f) {
+ if (pimd->random_position != 0.0f) {
BLI_srandom(psys->seed + (i/totvert)%totpart);
ran = pimd->random_position * BLI_frand();
}
- if(pimd->flag & eParticleInstanceFlag_KeepShape) {
+ if (pimd->flag & eParticleInstanceFlag_KeepShape) {
state.time = pimd->position * (1.0f - ran);
}
else {
state.time=(mv->co[axis]-min_co)/(max_co-min_co) * pimd->position * (1.0f - ran);
- if(trackneg)
+ if (trackneg)
state.time=1.0f-state.time;
mv->co[axis] = 0.0;
@@ -236,7 +236,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
normalize_v3(state.vel);
/* TODO: incremental rotations somehow */
- if(state.vel[axis] < -0.9999f || state.vel[axis] > 0.9999f) {
+ if (state.vel[axis] < -0.9999f || state.vel[axis] > 0.9999f) {
state.rot[0] = 1;
state.rot[1] = state.rot[2] = state.rot[3] = 0.0f;
}
@@ -251,13 +251,13 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
}
}
- else{
+ else {
state.time=-1.0;
psys_get_particle_state(&sim, first_particle + i/totvert, &state,1);
}
mul_qt_v3(state.rot,mv->co);
- if(pimd->flag & eParticleInstanceFlag_UseSize)
+ if (pimd->flag & eParticleInstanceFlag_UseSize)
mul_v3_fl(mv->co, size[i/totvert]);
add_v3_v3(mv->co, state.co);
}
@@ -265,31 +265,36 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
mface=result->getTessFaceArray(result);
orig_mface=dm->getTessFaceArray(dm);
- for(i=0; i<maxface; i++){
+ for (i=0; i<maxface; i++) {
MFace *inMF;
MFace *mf = mface + i;
- if(pimd->flag & eParticleInstanceFlag_Parents){
- if(i/totface>=psys->totpart){
- if(psys->part->childtype==PART_CHILD_PARTICLES)
+ if (pimd->flag & eParticleInstanceFlag_Parents) {
+ if (i/totface>=psys->totpart) {
+ if (psys->part->childtype==PART_CHILD_PARTICLES) {
pa=psys->particles+(psys->child+i/totface-psys->totpart)->parent;
- else
+ }
+ else {
pa= NULL;
+ }
}
- else
+ else {
pa=pars+i/totface;
+ }
}
- else{
- if(psys->part->childtype==PART_CHILD_PARTICLES)
+ else {
+ if (psys->part->childtype==PART_CHILD_PARTICLES) {
pa=psys->particles+(psys->child+i/totface)->parent;
- else
+ }
+ else {
pa= NULL;
+ }
}
- if(pa){
- if(pa->alive==PARS_UNBORN && (pimd->flag&eParticleInstanceFlag_Unborn)==0) continue;
- if(pa->alive==PARS_ALIVE && (pimd->flag&eParticleInstanceFlag_Alive)==0) continue;
- if(pa->alive==PARS_DEAD && (pimd->flag&eParticleInstanceFlag_Dead)==0) continue;
+ if (pa) {
+ if (pa->alive==PARS_UNBORN && (pimd->flag&eParticleInstanceFlag_Unborn)==0) continue;
+ if (pa->alive==PARS_ALIVE && (pimd->flag&eParticleInstanceFlag_Alive)==0) continue;
+ if (pa->alive==PARS_DEAD && (pimd->flag&eParticleInstanceFlag_Dead)==0) continue;
}
inMF = orig_mface + i%totface;
@@ -299,18 +304,19 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
mf->v1+=(i/totface)*totvert;
mf->v2+=(i/totface)*totvert;
mf->v3+=(i/totface)*totvert;
- if(mf->v4)
+ if (mf->v4) {
mf->v4+=(i/totface)*totvert;
+ }
}
CDDM_calc_edges_tessface(result);
- if(psys->lattice){
+ if (psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
- if(size)
+ if (size)
MEM_freeN(size);
CDDM_tessfaces_to_faces(result); /*builds ngon faces from tess (mface) faces*/
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index ad8642497fb..d93779fc07d 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -59,7 +59,7 @@ static void freeData(ModifierData *md)
{
ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md;
- if(psmd->dm){
+ if (psmd->dm) {
psmd->dm->needsFree = 1;
psmd->dm->release(psmd->dm);
psmd->dm = NULL;
@@ -67,7 +67,7 @@ static void freeData(ModifierData *md)
/* ED_object_modifier_remove may have freed this first before calling
* modifier_free (which calls this function) */
- if(psmd->psys)
+ if (psmd->psys)
psmd->psys->flag |= PSYS_DELETE;
}
static void copyData(ModifierData *md, ModifierData *target)
@@ -90,21 +90,21 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
MTex *mtex;
int i;
- if(!psmd->psys->part)
+ if (!psmd->psys->part)
return 0;
- for(i=0; i<MAX_MTEX; i++) {
+ for (i=0; i<MAX_MTEX; i++) {
mtex = psmd->psys->part->mtex[i];
- if(mtex && mtex->mapto && (mtex->texco & TEXCO_UV))
+ if (mtex && mtex->mapto && (mtex->texco & TEXCO_UV))
dataMask |= CD_MASK_MTFACE;
}
- if(psmd->psys->part->tanfac != 0.0f)
+ if (psmd->psys->part->tanfac != 0.0f)
dataMask |= CD_MASK_MTFACE;
/* ask for vertexgroups if we need them */
- for(i=0; i<PSYS_TOT_VG; i++){
- if(psmd->psys->vgroup[i]){
+ for (i=0; i<PSYS_TOT_VG; i++) {
+ if (psmd->psys->vgroup[i]) {
dataMask |= CD_MASK_MDEFORMVERT;
break;
}
@@ -132,29 +132,29 @@ static void deformVerts(ModifierData *md, Object *ob,
ParticleSystem * psys= NULL;
int needsFree=0;
- if(ob->particlesystem.first)
+ if (ob->particlesystem.first)
psys=psmd->psys;
else
return;
- if(!psys_check_enabled(ob, psys))
+ if (!psys_check_enabled(ob, psys))
return;
- if(dm==NULL) {
+ if (dm==NULL) {
dm= get_dm(ob, NULL, NULL, vertexCos, 1);
- if(!dm)
+ if (!dm)
return;
needsFree= 1;
}
/* clear old dm */
- if(psmd->dm){
+ if (psmd->dm) {
psmd->dm->needsFree = 1;
psmd->dm->release(psmd->dm);
}
- else if(psmd->flag & eParticleSystemFlag_file_loaded) {
+ else if (psmd->flag & eParticleSystemFlag_file_loaded) {
/* in file read dm just wasn't saved in file so no need to reset everything */
psmd->flag &= ~eParticleSystemFlag_file_loaded;
}
@@ -168,7 +168,7 @@ static void deformVerts(ModifierData *md, Object *ob,
CDDM_apply_vert_coords(psmd->dm, vertexCos);
CDDM_calc_normals(psmd->dm);
- if(needsFree){
+ if (needsFree) {
dm->needsFree = 1;
dm->release(dm);
}
@@ -177,9 +177,9 @@ static void deformVerts(ModifierData *md, Object *ob,
psmd->dm->needsFree = 0;
/* report change in mesh structure */
- if(psmd->dm->getNumVerts(psmd->dm)!=psmd->totdmvert ||
+ if (psmd->dm->getNumVerts(psmd->dm)!=psmd->totdmvert ||
psmd->dm->getNumEdges(psmd->dm)!=psmd->totdmedge ||
- psmd->dm->getNumTessFaces(psmd->dm)!=psmd->totdmface){
+ psmd->dm->getNumTessFaces(psmd->dm)!=psmd->totdmface) {
psys->recalc |= PSYS_RECALC_RESET;
@@ -188,7 +188,7 @@ static void deformVerts(ModifierData *md, Object *ob,
psmd->totdmface= psmd->dm->getNumTessFaces(psmd->dm);
}
- if(psys) {
+ if (psys) {
psmd->flag &= ~eParticleSystemFlag_psys_updated;
particle_system_update(md->scene, ob, psys);
psmd->flag |= eParticleSystemFlag_psys_updated;
@@ -204,11 +204,11 @@ static void deformVertsEM(
{
DerivedMesh *dm = derivedData;
- if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
+ if (!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
deformVerts(md, ob, dm, vertexCos, numVerts);
- if(!derivedData) dm->release(dm);
+ if (!derivedData) dm->release(dm);
}
#endif
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c
index a608defc434..ea3912afad5 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -101,7 +101,7 @@ static void *dualcon_alloc_output(int totvert, int totquad)
{
DualConOutput *output;
- if(!(output = MEM_callocN(sizeof(DualConOutput),
+ if (!(output = MEM_callocN(sizeof(DualConOutput),
"DualConOutput")))
return NULL;
@@ -135,7 +135,7 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4])
cur_poly->loopstart = output->curface * 4;
cur_poly->totloop = 4;
- for(i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
mloop[output->curface * 4 + i].v = vert_indices[i];
output->curface++;
@@ -160,7 +160,7 @@ static DerivedMesh *applyModifier(ModifierData *md,
init_dualcon_mesh(&input, dm);
- if(rmd->flag & MOD_REMESH_FLOOD_FILL)
+ if (rmd->flag & MOD_REMESH_FLOOD_FILL)
flags |= DUALCON_FLOOD_FILL;
switch(rmd->mode) {
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index f88c49fc6d7..ae21d3d66ad 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -175,7 +175,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
ScrewVertConnect *vc, *vc_tmp, *vert_connect= NULL;
- /* dont do anything? */
+ /* don't do anything? */
if (!totvert)
return CDDM_from_template(dm, 0, 0, 0, 0, 0);
@@ -207,11 +207,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
normalize_v3(axis_vec);
/* screw */
- if(ltmd->flag & MOD_SCREW_OBJECT_OFFSET) {
+ if (ltmd->flag & MOD_SCREW_OBJECT_OFFSET) {
/* find the offset along this axis relative to this objects matrix */
float totlen = len_v3(mtx_tx[3]);
- if(totlen != 0.0f) {
+ if (totlen != 0.0f) {
float zero[3]={0.0f, 0.0f, 0.0f};
float cp[3];
screw_ofs= closest_to_line_v3(cp, mtx_tx[3], zero, axis_vec);
@@ -224,7 +224,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* angle */
#if 0 // cant incluide this, not predictable enough, though quite fun,.
- if(ltmd->flag & MOD_SCREW_OBJECT_ANGLE) {
+ if (ltmd->flag & MOD_SCREW_OBJECT_ANGLE) {
float mtx3_tx[3][3];
copy_m3_m4(mtx3_tx, mtx_tx);
@@ -248,7 +248,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
cross_v3_v3v3(axis_tmp, cross1, c2);
normalize_v3(axis_tmp);
- if(len_v3v3(axis_tmp, axis_vec) > 1.0f)
+ if (len_v3v3(axis_tmp, axis_vec) > 1.0f)
angle= -angle;
}
@@ -276,7 +276,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
if (fabsf(screw_ofs) <= (FLT_EPSILON*100.0f) && fabsf(fabsf(angle) - ((float)M_PI * 2.0f)) <= (FLT_EPSILON*100.0f)) {
close= 1;
step_tot--;
- if(step_tot < 3) step_tot= 3;
+ if (step_tot < 3) step_tot= 3;
maxVerts = totvert * step_tot; /* -1 because we're joining back up */
maxEdges = (totvert * step_tot) + /* these are the edges between new verts */
@@ -287,7 +287,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
else {
close= 0;
- if(step_tot < 3) step_tot= 3;
+ if (step_tot < 3) step_tot= 3;
maxVerts = totvert * step_tot; /* -1 because we're joining back up */
maxEdges = (totvert * (step_tot-1)) + /* these are the edges between new verts */
@@ -333,7 +333,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
med_new->flag= med_orig->flag & ~ME_LOOSEEDGE;
}
- if(ltmd->flag & MOD_SCREW_NORMAL_CALC) {
+ if (ltmd->flag & MOD_SCREW_NORMAL_CALC) {
/*
* Normal Calculation (for face flipping)
* Sort edge verts for correct face flipping
@@ -388,7 +388,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vc->v[0]= vc->v[1]= -1;
mul_m4_v3(mtx_tx, vc->co);
- /* length in 2d, dont sqrt because this is only for comparison */
+ /* length in 2d, don't sqrt because this is only for comparison */
vc->dist = vc->co[other_axis_1]*vc->co[other_axis_1] +
vc->co[other_axis_2]*vc->co[other_axis_2];
@@ -405,7 +405,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vc->e[0]= vc->e[1]= NULL;
vc->v[0]= vc->v[1]= -1;
- /* length in 2d, dont sqrt because this is only for comparison */
+ /* length in 2d, don't sqrt because this is only for comparison */
vc->dist = vc->co[other_axis_1]*vc->co[other_axis_1] +
vc->co[other_axis_2]*vc->co[other_axis_2];
@@ -426,7 +426,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vc->e[1]= med_new;
}
else {
- vc->v[0]= vc->v[1]= -2; /* erro value - dont use, 3 edges on vert */
+ vc->v[0]= vc->v[1]= -2; /* erro value - don't use, 3 edges on vert */
}
vc= &vert_connect[med_new->v2];
@@ -441,7 +441,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vc->e[1]= med_new;
}
else {
- vc->v[0]= vc->v[1]= -2; /* erro value - dont use, 3 edges on vert */
+ vc->v[0]= vc->v[1]= -2; /* erro value - don't use, 3 edges on vert */
}
}
@@ -459,7 +459,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/*printf("Loop on connected vert: %i\n", i);*/
- for(j=0; j<2; j++) {
+ for (j=0; j<2; j++) {
/*printf("\tSide: %i\n", j);*/
screwvert_iter_init(&lt_iter, vert_connect, i, j);
if (j == 1) {
@@ -564,7 +564,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
ed_loop_flip= !ed_loop_flip;
/* if its closed, we only need 1 loop */
- for(j=ed_loop_closed; j<2; j++) {
+ for (j=ed_loop_closed; j<2; j++) {
/*printf("Ordering Side J %i\n", j);*/
screwvert_iter_init(&lt_iter, vert_connect, v_best, j);
@@ -587,7 +587,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
if (ed_loop_flip == 0) {
/*printf("\t\t\tFlipping 0\n");*/
SWAP(unsigned int, lt_iter.e->v1, lt_iter.e->v2);
- }/* else {
+ }
+ /* else {
printf("\t\t\tFlipping Not 0\n");
}*/
}
@@ -595,13 +596,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
if (ed_loop_flip == 1) {
/*printf("\t\t\tFlipping 1\n");*/
SWAP(unsigned int, lt_iter.e->v1, lt_iter.e->v2);
- }/* else {
+ }
+ /* else {
printf("\t\t\tFlipping Not 1\n");
}*/
- }/* else {
+ }
+ /* else {
printf("\t\tIncorrect edge topology");
}*/
- }/* else {
+ }
+ /* else {
printf("\t\tNo Edge at this point\n");
}*/
screwvert_iter_step(&lt_iter);
@@ -639,7 +643,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
else {
/* only 1 edge connected - same as above except
- * dont need to average edge direction */
+ * don't need to average edge direction */
if (vc->e && vc->e[0]->v2 == i) {
sub_v3_v3v3(tmp_vec1, mvert_new[i].co, mvert_new[vc->v[0]].co);
}
@@ -700,7 +704,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
copy_m3_m4(mat3, mat);
}
- if(screw_ofs)
+ if (screw_ofs)
madd_v3_v3fl(mat[3], axis_vec, screw_ofs * ((float)step / (float)(step_tot-1)));
/* copy a slice */
@@ -711,7 +715,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
for (j=0; j<totvert; j++, mv_new_base++, mv_new++) {
/* set normal */
- if(vert_connect) {
+ if (vert_connect) {
mul_v3_m3v3(nor_tx, mat3, vert_connect[j].no);
/* set the normal now its transformed */
@@ -744,7 +748,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
/* we can avoid if using vert alloc trick */
- if(vert_connect) {
+ if (vert_connect) {
MEM_freeN(vert_connect);
vert_connect= NULL;
}
@@ -776,7 +780,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
for (step=0; step < step_tot-1; step++) {
/* new face */
- if(do_flip) {
+ if (do_flip) {
ml_new[3].v = i1;
ml_new[2].v = i2;
ml_new[1].v = i2 + totvert;
@@ -822,7 +826,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* close the loop*/
if (close) {
- if(do_flip) {
+ if (do_flip) {
ml_new[3].v = i1;
ml_new[2].v = i2;
ml_new[1].v = med_new_firstloop->v2;
@@ -890,7 +894,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
#endif
- if((ltmd->flag & MOD_SCREW_NORMAL_CALC) == 0) {
+ if ((ltmd->flag & MOD_SCREW_NORMAL_CALC) == 0) {
/* BMESH_TODO, we only need to get vertex normals here, this is way overkill */
CDDM_calc_normals(result);
}
@@ -906,7 +910,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
{
ScrewModifierData *ltmd= (ScrewModifierData*) md;
- if(ltmd->ob_axis) {
+ if (ltmd->ob_axis) {
DagNode *curNode= dag_get_node(forest, ltmd->ob_axis);
dag_add_relation(forest, curNode, obNode,
diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c
index 8a93a8a6d6f..a91019b0228 100644
--- a/source/blender/modifiers/intern/MOD_shapekey.c
+++ b/source/blender/modifiers/intern/MOD_shapekey.c
@@ -58,9 +58,9 @@ static void deformVerts(ModifierData *md, Object *ob,
KeyBlock *kb= ob_get_keyblock(ob);
float (*deformedVerts)[3];
- if(kb && kb->totelem == numVerts) {
+ if (kb && kb->totelem == numVerts) {
deformedVerts= (float(*)[3])do_ob_key(md->scene, ob);
- if(deformedVerts) {
+ if (deformedVerts) {
memcpy(vertexCos, deformedVerts, sizeof(float)*3*numVerts);
MEM_freeN(deformedVerts);
}
@@ -76,13 +76,13 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat
(void)vertexCos; /* unused */
- if(kb && kb->totelem==numVerts && kb!=key->refkey) {
+ if (kb && kb->totelem==numVerts && kb!=key->refkey) {
int a;
- if(ob->shapeflag & OB_SHAPE_LOCK) scale_m3_fl(scale, 1);
+ if (ob->shapeflag & OB_SHAPE_LOCK) scale_m3_fl(scale, 1);
else scale_m3_fl(scale, kb->curval);
- for(a=0; a<numVerts; a++)
+ for (a=0; a<numVerts; a++)
copy_m3_m3(defMats[a], scale);
}
@@ -97,7 +97,7 @@ static void deformVertsEM(ModifierData *md, Object *ob,
{
Key *key= ob_get_key(ob);
- if(key && key->type == KEY_RELATIVE)
+ if (key && key->type == KEY_RELATIVE)
deformVerts(md, ob, derivedData, vertexCos, numVerts, 0, 0);
}
@@ -114,11 +114,11 @@ static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob,
(void)vertexCos; /* unused */
- if(kb && kb->totelem==numVerts && kb!=key->refkey) {
+ if (kb && kb->totelem==numVerts && kb!=key->refkey) {
int a;
scale_m3_fl(scale, kb->curval);
- for(a=0; a<numVerts; a++)
+ for (a=0; a<numVerts; a++)
copy_m3_m3(defMats[a], scale);
}
}
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index 1d68e201dc0..33736b7e426 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -83,10 +83,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(smd->vgroup_name[0])
+ if (smd->vgroup_name[0])
dataMask |= CD_MASK_MDEFORMVERT;
- if(smd->shrinkType == MOD_SHRINKWRAP_PROJECT
+ if (smd->shrinkType == MOD_SHRINKWRAP_PROJECT
&& smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL)
dataMask |= CD_MASK_MVERT;
@@ -119,12 +119,12 @@ static void deformVerts(ModifierData *md, Object *ob,
CustomDataMask dataMask = requiredDataMask(ob, md);
/* ensure we get a CDDM with applied vertex coords */
- if(dataMask)
+ if (dataMask)
dm= get_cddm(ob, NULL, dm, vertexCos);
shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, ob, dm, vertexCos, numVerts);
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
@@ -134,12 +134,12 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD
CustomDataMask dataMask = requiredDataMask(ob, md);
/* ensure we get a CDDM with applied vertex coords */
- if(dataMask)
+ if (dataMask)
dm= get_cddm(ob, editData, dm, vertexCos);
shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, ob, dm, vertexCos, numVerts);
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index 9fb72bb4abc..6c1325b0bde 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -58,8 +58,8 @@
static void axis_limit(int axis, const float limits[2], float co[3], float dcut[3])
{
float val = co[axis];
- if(limits[0] > val) val = limits[0];
- if(limits[1] < val) val = limits[1];
+ if (limits[0] > val) val = limits[0];
+ if (limits[1] < val) val = limits[1];
dcut[axis] = co[axis] - val;
co[axis] = val;
@@ -112,7 +112,7 @@ static void simpleDeform_twist(const float factor, const float *dcut, float *co)
co[1] = x*sint + y*cost;
co[2] = z;
- if(dcut) {
+ if (dcut) {
co[0] += dcut[0];
co[1] += dcut[1];
co[2] += dcut[2];
@@ -157,15 +157,15 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
MDeformVert *dvert;
//Safe-check
- if(smd->origin == ob) smd->origin = NULL; //No self references
+ if (smd->origin == ob) smd->origin = NULL; //No self references
- if(smd->limit[0] < 0.0f) smd->limit[0] = 0.0f;
- if(smd->limit[0] > 1.0f) smd->limit[0] = 1.0f;
+ if (smd->limit[0] < 0.0f) smd->limit[0] = 0.0f;
+ if (smd->limit[0] > 1.0f) smd->limit[0] = 1.0f;
smd->limit[0] = MIN2(smd->limit[0], smd->limit[1]); //Upper limit >= than lower limit
//Calculate matrixs do convert between coordinate spaces
- if(smd->origin) {
+ if (smd->origin) {
transf = &tmp_transf;
if (smd->originOpts & MOD_SIMPLEDEFORM_ORIGIN_LOCAL) {
@@ -185,12 +185,12 @@ 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]);
- if(transf) space_transform_apply(transf, tmp);
+ if (transf) space_transform_apply(transf, tmp);
lower = MIN2(lower, tmp[limit_axis]);
upper = MAX2(upper, tmp[limit_axis]);
@@ -216,30 +216,30 @@ 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) {
float co[3], dcut[3] = {0.0f, 0.0f, 0.0f};
- if(transf) {
+ if (transf) {
space_transform_apply(transf, vertexCos[i]);
}
copy_v3_v3(co, vertexCos[i]);
/* Apply axis limits */
- if(smd->mode != MOD_SIMPLEDEFORM_MODE_BEND) { /* Bend mode shoulnt have any lock axis */
- if(smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_X) axis_limit(0, lock_axis, co, dcut);
- if(smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_Y) axis_limit(1, lock_axis, co, dcut);
+ if (smd->mode != MOD_SIMPLEDEFORM_MODE_BEND) { /* Bend mode shoulnt have any lock axis */
+ if (smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_X) axis_limit(0, lock_axis, co, dcut);
+ if (smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_Y) axis_limit(1, lock_axis, co, dcut);
}
axis_limit(limit_axis, smd_limit, co, dcut);
simpleDeform_callback(smd_factor, dcut, co); //Apply deform
interp_v3_v3v3(vertexCos[i], vertexCos[i], co, weight); //Use vertex weight has coef of linear interpolation
- if(transf) space_transform_invert(transf, vertexCos[i]);
+ if (transf) space_transform_invert(transf, vertexCos[i]);
}
}
}
@@ -281,7 +281,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(smd->vgroup_name[0])
+ if (smd->vgroup_name[0])
dataMask |= CD_MASK_MDEFORMVERT;
return dataMask;
@@ -316,12 +316,12 @@ static void deformVerts(ModifierData *md, Object *ob,
/* we implement requiredDataMask but thats not really useful since
* mesh_calc_modifiers pass a NULL derivedData */
- if(dataMask)
+ if (dataMask)
dm= get_dm(ob, NULL, dm, NULL, 0);
SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts);
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
@@ -336,12 +336,12 @@ static void deformVertsEM(ModifierData *md, Object *ob,
/* we implement requiredDataMask but thats not really useful since
* mesh_calc_modifiers pass a NULL derivedData */
- if(dataMask)
+ if (dataMask)
dm= get_dm(ob, editData, dm, NULL, 0);
SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts);
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c
index 1472639739e..706c9817a0a 100644
--- a/source/blender/modifiers/intern/MOD_smoke.c
+++ b/source/blender/modifiers/intern/MOD_smoke.c
@@ -93,7 +93,7 @@ static void deformVerts(ModifierData *md, Object *ob,
smokeModifier_do(smd, md->scene, ob, dm);
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
@@ -110,20 +110,34 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
SmokeModifierData *smd = (SmokeModifierData *) md;
if (smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
- if (smd->domain->fluid_group) {
+ if (smd->domain->fluid_group || smd->domain->coll_group) {
GroupObject *go = NULL;
- for (go = smd->domain->fluid_group->gobject.first; go; go = go->next) {
- if (go->ob) {
- SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke);
-
- // check for initialized smoke object
- if (smd2 && (((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) || ((smd->type & MOD_SMOKE_TYPE_COLL) && smd2->coll))) {
- DagNode *curNode = dag_get_node(forest, go->ob);
- dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Smoke Flow");
+ if (smd->domain->fluid_group)
+ for (go = smd->domain->fluid_group->gobject.first; go; go = go->next) {
+ if (go->ob) {
+ SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke);
+
+ // check for initialized smoke object
+ if (smd2 && (smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) {
+ DagNode *curNode = dag_get_node(forest, go->ob);
+ dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Smoke Flow");
+ }
+ }
+ }
+
+ if (smd->domain->coll_group)
+ for (go = smd->domain->coll_group->gobject.first; go; go = go->next) {
+ if (go->ob) {
+ SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke);
+
+ // check for initialized smoke object
+ if (smd2 && (smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll) {
+ DagNode *curNode = dag_get_node(forest, go->ob);
+ dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Smoke Coll");
+ }
}
}
- }
}
else {
Base *base = scene->base.first;
@@ -131,9 +145,9 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
for ( ; base; base = base->next) {
SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(base->object, eModifierType_Smoke);
- if (smd2 && (((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) || ((smd->type & MOD_SMOKE_TYPE_COLL) && smd2->coll))) {
+ if (smd2 && (((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) || ((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll))) {
DagNode *curNode = dag_get_node(forest, base->object);
- dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Smoke Flow");
+ dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Smoke Flow/Coll");
}
}
}
@@ -145,12 +159,12 @@ static void foreachIDLink(ModifierData *md, Object *ob,
{
SmokeModifierData *smd = (SmokeModifierData*) md;
- if(smd->type==MOD_SMOKE_TYPE_DOMAIN && smd->domain) {
+ if (smd->type==MOD_SMOKE_TYPE_DOMAIN && smd->domain) {
walk(userData, ob, (ID **)&smd->domain->coll_group);
walk(userData, ob, (ID **)&smd->domain->fluid_group);
walk(userData, ob, (ID **)&smd->domain->eff_group);
- if(smd->domain->effector_weights) {
+ if (smd->domain->effector_weights) {
walk(userData, ob, (ID **)&smd->domain->effector_weights->group);
}
}
diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c
index 7b7597af6d6..b909e1f6512 100644
--- a/source/blender/modifiers/intern/MOD_smooth.c
+++ b/source/blender/modifiers/intern/MOD_smooth.c
@@ -78,7 +78,7 @@ static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
flag = smd->flag & (MOD_SMOOTH_X|MOD_SMOOTH_Y|MOD_SMOOTH_Z);
/* disable if modifier is off for X, Y and Z or if factor is 0 */
- if((smd->fac == 0.0f) || flag == 0) return 1;
+ if ((smd->fac == 0.0f) || flag == 0) return 1;
return 0;
}
@@ -89,7 +89,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+ if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
return dataMask;
}
@@ -221,7 +221,7 @@ static void deformVerts(
smoothModifier_do((SmoothModifierData *)md, ob, dm,
vertexCos, numVerts);
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
@@ -234,7 +234,7 @@ static void deformVertsEM(
smoothModifier_do((SmoothModifierData *)md, ob, dm,
vertexCos, numVerts);
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index b7c820991f1..5a749902a0c 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -84,7 +84,7 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3])
#endif
face_nors = CustomData_get_layer(&dm->polyData, CD_NORMAL);
- if(!face_nors) {
+ if (!face_nors) {
calc_face_nors = 1;
face_nors = CustomData_add_layer(&dm->polyData, CD_NORMAL, CD_CALLOC, NULL, numFaces);
}
@@ -119,11 +119,11 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3])
}
/* --- end define --- */
- for(i = 0; i < numFaces; i++, mp++) {
+ for (i = 0; i < numFaces; i++, mp++) {
int j;
f_no = face_nors[i];
- if(calc_face_nors)
+ if (calc_face_nors)
mesh_calc_poly_normal(mp, mloop+mp->loopstart, mvert, f_no);
ml = mloop + mp->loopstart;
@@ -132,7 +132,7 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3])
}
}
- for(edge_iter = BLI_edgehashIterator_new(edge_hash); !BLI_edgehashIterator_isDone(edge_iter); BLI_edgehashIterator_step(edge_iter)) {
+ for (edge_iter = BLI_edgehashIterator_new(edge_hash); !BLI_edgehashIterator_isDone(edge_iter); BLI_edgehashIterator_step(edge_iter)) {
/* Get the edge vert indices, and edge value (the face indices that use it)*/
BLI_edgehashIterator_getKey(edge_iter, &ed_v1, &ed_v2);
edge_ref = BLI_edgehashIterator_getValue(edge_iter);
@@ -143,7 +143,8 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3])
add_v3_v3v3(edge_normal, face_nors[edge_ref->f1], face_nors[edge_ref->f2]);
normalize_v3(edge_normal);
mul_v3_fl(edge_normal, angle_normalized_v3v3(face_nors[edge_ref->f1], face_nors[edge_ref->f2]));
- } else {
+ }
+ else {
/* only one face attached to that edge */
/* an edge without another attached- the weight on this is
* undefined, M_PI/2 is 90d in radians and that seems good enough */
@@ -158,8 +159,8 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3])
}
/* normalize vertex normals and assign */
- for(i = 0; i < numVerts; i++, mv++) {
- if(normalize_v3(temp_nors[i]) == 0.0f) {
+ for (i = 0; i < numVerts; i++, mv++) {
+ if (normalize_v3(temp_nors[i]) == 0.0f) {
normal_short_to_float_v3(temp_nors[i], mv->no);
}
}
@@ -192,7 +193,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+ if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
return dataMask;
}
@@ -257,17 +258,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
orig_mloop = dm->getLoopArray(dm);
orig_mpoly = dm->getPolyArray(dm);
- if(smd->flag & MOD_SOLIDIFY_RIM) {
+ if (smd->flag & MOD_SOLIDIFY_RIM) {
EdgeHash *edgehash = BLI_edgehash_new();
EdgeHashIterator *ehi;
unsigned int v1, v2;
int eidx;
- for(i=0, mv=orig_mvert; i<numVerts; i++, mv++) {
+ for (i=0, mv=orig_mvert; i<numVerts; i++, mv++) {
mv->flag &= ~ME_VERT_TMP_TAG;
}
- for(i=0, ed=orig_medge; i<numEdges; i++, ed++) {
+ for (i=0, ed=orig_medge; i<numEdges; i++, ed++) {
BLI_edgehash_insert(edgehash, ed->v1, ed->v2, SET_INT_IN_POINTER(i));
}
@@ -279,7 +280,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
const unsigned int ml_v1 = _v1; \
const unsigned int ml_v2 = _v2; \
eidx= GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, ml_v1, ml_v2)); \
- if(edge_users[eidx] == INVALID_UNUSED) { \
+ if (edge_users[eidx] == INVALID_UNUSED) { \
ed= orig_medge + eidx; \
edge_users[eidx] = (ml_v1 < ml_v2) == (ed->v1 < ed->v2) ? i : (i + numFaces); \
edge_order[eidx] = edge_ord; \
@@ -307,9 +308,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
#undef INVALID_PAIR
ehi= BLI_edgehashIterator_new(edgehash);
- for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+ for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
eidx= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
- if(edge_users[eidx] >= 0) {
+ if (edge_users[eidx] >= 0) {
BLI_edgehashIterator_getKey(ehi, &v1, &v2);
orig_mvert[v1].flag |= ME_VERT_TMP_TAG;
orig_mvert[v2].flag |= ME_VERT_TMP_TAG;
@@ -320,8 +321,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
BLI_edgehashIterator_free(ehi);
- for(i=0, mv=orig_mvert; i<numVerts; i++, mv++) {
- if(mv->flag & ME_VERT_TMP_TAG) {
+ for (i=0, mv=orig_mvert; i<numVerts; i++, mv++) {
+ if (mv->flag & ME_VERT_TMP_TAG) {
old_vert_arr[i] = BLI_array_count(new_vert_arr);
BLI_array_append(new_vert_arr, i);
newEdges++;
@@ -333,7 +334,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
BLI_edgehash_free(edgehash, NULL);
}
- if(smd->flag & MOD_SOLIDIFY_NORMAL_CALC) {
+ if (smd->flag & MOD_SOLIDIFY_NORMAL_CALC) {
vert_nors= MEM_callocN(sizeof(float) * numVerts * 3, "mod_solid_vno_hq");
dm_calc_normal(dm, vert_nors);
}
@@ -372,7 +373,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
mp->loopstart+(mp->totloop-j-1)+dm->numLoopData, 1);
}
- if(mat_ofs) {
+ if (mat_ofs) {
mp->mat_nr += mat_ofs;
CLAMP(mp->mat_nr, 0, mat_nr_max);
}
@@ -395,25 +396,25 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
}
- for(i=0, ed=medge+numEdges; i<numEdges; i++, ed++) {
+ for (i=0, ed=medge+numEdges; i<numEdges; i++, ed++) {
ed->v1 += numVerts;
ed->v2 += numVerts;
}
- /* note, copied vertex layers dont have flipped normals yet. do this after applying offset */
- if((smd->flag & MOD_SOLIDIFY_EVEN) == 0) {
+ /* note, copied vertex layers don't have flipped normals yet. do this after applying offset */
+ if ((smd->flag & MOD_SOLIDIFY_EVEN) == 0) {
/* no even thickness, very simple */
float scalar_short;
float scalar_short_vgroup;
- if(ofs_new != 0.0f) {
+ if (ofs_new != 0.0f) {
scalar_short= scalar_short_vgroup= ofs_new / 32767.0f;
mv= mvert + ((ofs_new >= ofs_orig) ? 0 : numVerts);
dv= dvert;
- for(i=0; i<numVerts; i++, mv++) {
- if(dv) {
- if(defgrp_invert) scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
+ for (i=0; i<numVerts; i++, mv++) {
+ if (dv) {
+ if (defgrp_invert) scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
else scalar_short_vgroup = defvert_find_weight(dv, defgrp_index);
scalar_short_vgroup= (offset_fac_vg + (scalar_short_vgroup * offset_fac_vg_inv)) * scalar_short;
dv++;
@@ -422,13 +423,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
}
- if(ofs_orig != 0.0f) {
+ if (ofs_orig != 0.0f) {
scalar_short= scalar_short_vgroup= ofs_orig / 32767.0f;
mv= mvert + ((ofs_new >= ofs_orig) ? numVerts : 0); /* same as above but swapped, intentional use of 'ofs_new' */
dv= dvert;
- for(i=0; i<numVerts; i++, mv++) {
- if(dv) {
- if(defgrp_invert) scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
+ for (i=0; i<numVerts; i++, mv++) {
+ if (dv) {
+ if (defgrp_invert) scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
else scalar_short_vgroup = defvert_find_weight(dv, defgrp_index);
scalar_short_vgroup= (offset_fac_vg + (scalar_short_vgroup * offset_fac_vg_inv)) * scalar_short;
dv++;
@@ -451,14 +452,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
int j, vidx;
face_nors = CustomData_get_layer(&dm->polyData, CD_NORMAL);
- if(!face_nors) {
+ if (!face_nors) {
face_nors = CustomData_add_layer(&dm->polyData, CD_NORMAL, CD_CALLOC, NULL, dm->numPolyData);
face_nors_calc= 1;
}
- if(vert_nors==NULL) {
+ if (vert_nors==NULL) {
vert_nors= MEM_mallocN(sizeof(float) * numVerts * 3, "mod_solid_vno");
- for(i=0, mv=mvert; i<numVerts; i++, mv++) {
+ for (i=0, mv=mvert; i<numVerts; i++, mv++) {
normal_short_to_float_v3(vert_nors[i], mv->no);
}
}
@@ -491,19 +492,19 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
BLI_array_free(face_angles);
/* vertex group support */
- if(dvert) {
+ if (dvert) {
float scalar;
dv= dvert;
- if(defgrp_invert) {
- for(i=0; i<numVerts; i++, dv++) {
+ if (defgrp_invert) {
+ for (i=0; i<numVerts; i++, dv++) {
scalar= 1.0f - defvert_find_weight(dv, defgrp_index);
scalar= offset_fac_vg + (scalar * offset_fac_vg_inv);
vert_angles[i] *= scalar;
}
}
else {
- for(i=0; i<numVerts; i++, dv++) {
+ for (i=0; i<numVerts; i++, dv++) {
scalar= defvert_find_weight(dv, defgrp_index);
scalar= offset_fac_vg + (scalar * offset_fac_vg_inv);
vert_angles[i] *= scalar;
@@ -511,21 +512,21 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
}
- if(ofs_new) {
+ if (ofs_new) {
mv= mvert + ((ofs_new >= ofs_orig) ? 0 : numVerts);
- for(i=0; i<numVerts; i++, mv++) {
- if(vert_accum[i]) { /* zero if unselected */
+ for (i=0; i<numVerts; i++, mv++) {
+ if (vert_accum[i]) { /* zero if unselected */
madd_v3_v3fl(mv->co, vert_nors[i], ofs_new * (vert_angles[i] / vert_accum[i]));
}
}
}
- if(ofs_orig) {
+ if (ofs_orig) {
mv= mvert + ((ofs_new >= ofs_orig) ? numVerts : 0); /* same as above but swapped, intentional use of 'ofs_new' */
- for(i=0; i<numVerts; i++, mv++) {
- if(vert_accum[i]) { /* zero if unselected */
+ for (i=0; i<numVerts; i++, mv++) {
+ if (vert_accum[i]) { /* zero if unselected */
madd_v3_v3fl(mv->co, vert_nors[i], ofs_orig * (vert_angles[i] / vert_accum[i]));
}
}
@@ -534,18 +535,18 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
MEM_freeN(vert_angles);
}
- if(vert_nors)
+ if (vert_nors)
MEM_freeN(vert_nors);
/* flip vertex normals for copied verts */
mv= mvert + numVerts;
- for(i=0; i<numVerts; i++, mv++) {
+ for (i=0; i<numVerts; i++, mv++) {
mv->no[0]= -mv->no[0];
mv->no[1]= -mv->no[1];
mv->no[2]= -mv->no[2];
}
- if(smd->flag & MOD_SOLIDIFY_RIM) {
+ if (smd->flag & MOD_SOLIDIFY_RIM) {
int *origindex;
/* bugger, need to re-calculate the normals for the new edge faces.
@@ -569,14 +570,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* add faces & edges */
origindex= result->getEdgeDataArray(result, CD_ORIGINDEX);
ed= medge + (numEdges * 2);
- for(i=0; i<newEdges; i++, ed++) {
+ for (i=0; i<newEdges; i++, ed++) {
ed->v1= new_vert_arr[i];
ed->v2= new_vert_arr[i] + numVerts;
ed->flag |= ME_EDGEDRAW;
origindex[numEdges * 2 + i]= ORIGINDEX_NONE;
- if(crease_rim)
+ if (crease_rim)
ed->crease= crease_rim;
}
@@ -587,12 +588,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
mp = mpoly + (numFaces * 2);
ml = mloop + (numLoops * 2);
j = 0;
- for(i=0; i<newFaces; i++, mp++) {
+ for (i=0; i<newFaces; i++, mp++) {
int eidx= new_edge_arr[i];
int fidx= edge_users[eidx];
int flip, k1, k2;
- if(fidx >= numFaces) {
+ if (fidx >= numFaces) {
fidx -= numFaces;
flip= 1;
}
@@ -620,7 +621,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops*2+j+2, 1);
CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops*2+j+3, 1);
- if(flip) {
+ if (flip) {
ml[j].v = ed->v1;
ml[j++].e = eidx;
@@ -653,18 +654,18 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
/* use the next material index if option enabled */
- if(mat_ofs_rim) {
+ if (mat_ofs_rim) {
mp->mat_nr += mat_ofs_rim;
CLAMP(mp->mat_nr, 0, mat_nr_max);
}
- if(crease_outer) {
+ if (crease_outer) {
/* crease += crease_outer; without wrapping */
unsigned char *cr= (unsigned char *)&(ed->crease);
int tcr= *cr + crease_outer;
*cr= tcr > 255 ? 255 : tcr;
}
- if(crease_inner) {
+ if (crease_inner) {
/* crease += crease_inner; without wrapping */
unsigned char *cr= (unsigned char *)&(medge[numEdges + eidx].crease);
int tcr= *cr + crease_inner;
@@ -685,7 +686,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
#ifdef SOLIDIFY_SIDE_NORMALS
ed= medge + (numEdges * 2);
- for(i=0; i<newEdges; i++, ed++) {
+ for (i=0; i<newEdges; i++, ed++) {
float nor_cpy[3];
short *nor_short;
int j;
@@ -693,7 +694,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* note, only the first vertex (lower half of the index) is calculated */
normalize_v3_v3(nor_cpy, edge_vert_nos[ed->v1]);
- for(j=0; j<2; j++) { /* loop over both verts of the edge */
+ for (j=0; j<2; j++) { /* loop over both verts of the edge */
nor_short= mvert[*(&ed->v1 + j)].no;
normal_short_to_float_v3(nor, nor_short);
add_v3_v3(nor, nor_cpy);
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index 5d6d6c2e82c..be1ceeee317 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -73,10 +73,10 @@ static void freeData(ModifierData *md)
{
SubsurfModifierData *smd = (SubsurfModifierData*) md;
- if(smd->mCache) {
+ if (smd->mCache) {
ccgSubSurf_free(smd->mCache);
}
- if(smd->emCache) {
+ if (smd->emCache) {
ccgSubSurf_free(smd->emCache);
}
}
@@ -100,7 +100,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
result = subsurf_make_derived_from_derived(derivedData, smd,
useRenderParams, NULL, isFinalCalc, 0, (ob->flag & OB_MODE_EDIT));
- if(useRenderParams || !isFinalCalc) {
+ if (useRenderParams || !isFinalCalc) {
DerivedMesh *cddm= CDDM_copy(result);
result->release(result);
result= cddm;
diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c
index ccb6e79eb64..86e11aca5b7 100644
--- a/source/blender/modifiers/intern/MOD_surface.c
+++ b/source/blender/modifiers/intern/MOD_surface.c
@@ -61,18 +61,18 @@ static void freeData(ModifierData *md)
SurfaceModifierData *surmd = (SurfaceModifierData*) md;
if (surmd) {
- if(surmd->bvhtree) {
+ if (surmd->bvhtree) {
free_bvhtree_from_mesh(surmd->bvhtree);
MEM_freeN(surmd->bvhtree);
}
- if(surmd->dm)
+ if (surmd->dm)
surmd->dm->release(surmd->dm);
- if(surmd->x)
+ if (surmd->x)
MEM_freeN(surmd->x);
- if(surmd->v)
+ if (surmd->v)
MEM_freeN(surmd->v);
surmd->bvhtree = NULL;
@@ -94,11 +94,11 @@ static void deformVerts(ModifierData *md, Object *ob,
{
SurfaceModifierData *surmd = (SurfaceModifierData*) md;
- if(surmd->dm)
+ if (surmd->dm)
surmd->dm->release(surmd->dm);
/* if possible use/create DerivedMesh */
- if(derivedData) surmd->dm = CDDM_copy(derivedData);
+ if (derivedData) surmd->dm = CDDM_copy(derivedData);
else surmd->dm = get_dm(ob, NULL, NULL, NULL, 0);
if (!ob->pd) {
@@ -106,7 +106,7 @@ static void deformVerts(ModifierData *md, Object *ob,
return;
}
- if(surmd->dm) {
+ if (surmd->dm) {
unsigned int numverts = 0, i = 0;
int init = 0;
float *vec;
@@ -117,12 +117,12 @@ static void deformVerts(ModifierData *md, Object *ob,
numverts = surmd->dm->getNumVerts ( surmd->dm );
- if(numverts != surmd->numverts || surmd->x == NULL || surmd->v == NULL || md->scene->r.cfra != surmd->cfra+1) {
- if(surmd->x) {
+ if (numverts != surmd->numverts || surmd->x == NULL || surmd->v == NULL || md->scene->r.cfra != surmd->cfra+1) {
+ if (surmd->x) {
MEM_freeN(surmd->x);
surmd->x = NULL;
}
- if(surmd->v) {
+ if (surmd->v) {
MEM_freeN(surmd->v);
surmd->v = NULL;
}
@@ -136,11 +136,11 @@ static void deformVerts(ModifierData *md, Object *ob,
}
/* convert to global coordinates and calculate velocity */
- for(i = 0, x = surmd->x, v = surmd->v; i<numverts; i++, x++, v++) {
+ for (i = 0, x = surmd->x, v = surmd->v; i<numverts; i++, x++, v++) {
vec = CDDM_get_vert(surmd->dm, i)->co;
mul_m4_v3(ob->obmat, vec);
- if(init)
+ if (init)
v->co[0] = v->co[1] = v->co[2] = 0.0f;
else
sub_v3_v3v3(v->co, vec, x->co);
@@ -150,12 +150,12 @@ static void deformVerts(ModifierData *md, Object *ob,
surmd->cfra = md->scene->r.cfra;
- if(surmd->bvhtree)
+ if (surmd->bvhtree)
free_bvhtree_from_mesh(surmd->bvhtree);
else
surmd->bvhtree = MEM_callocN(sizeof(BVHTreeFromMesh), "BVHTreeFromMesh");
- if(surmd->dm->getNumTessFaces(surmd->dm))
+ if (surmd->dm->getNumTessFaces(surmd->dm))
bvhtree_from_mesh_faces(surmd->bvhtree, surmd->dm, 0.0, 2, 6);
else
bvhtree_from_mesh_edges(surmd->bvhtree, surmd->dm, 0.0, 2, 6);
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index 11bf5bc6edf..17ff4dd1842 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -68,7 +68,7 @@ void get_texture_value(Tex *texture, float *tex_co, TexResult *texres)
* intensity, so calculate one (formula from do_material_tex).
* if the texture didn't give an RGB value, copy the intensity across
*/
- if(result_type & TEX_RGB)
+ if (result_type & TEX_RGB)
texres->tin = (0.35f * texres->tr + 0.45f * texres->tg
+ 0.2f * texres->tb);
else
@@ -84,16 +84,16 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob,
int texmapping = dmd->texmapping;
float mapob_imat[4][4];
- if(texmapping == MOD_DISP_MAP_OBJECT) {
- if(dmd->map_object)
+ if (texmapping == MOD_DISP_MAP_OBJECT) {
+ if (dmd->map_object)
invert_m4_m4(mapob_imat, dmd->map_object->obmat);
else /* if there is no map object, default to local */
texmapping = MOD_DISP_MAP_LOCAL;
}
/* UVs need special handling, since they come from faces */
- if(texmapping == MOD_DISP_MAP_UV) {
- if(CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) {
+ if (texmapping == MOD_DISP_MAP_UV) {
+ if (CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) {
MPoly *mpoly = dm->getPolyArray(dm);
MPoly *mp;
MLoop *mloop = dm->getLoopArray(dm);
@@ -107,7 +107,7 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob,
mloop_uv = CustomData_get_layer_named(&dm->loopData, CD_MLOOPUV, uvname);
/* verts are given the UV from the first face that uses them */
- for(i = 0, mp = mpoly; i < numPolys; ++i, ++mp) {
+ for (i = 0, mp = mpoly; i < numPolys; ++i, ++mp) {
unsigned int fidx= mp->totloop - 1;
do {
@@ -126,11 +126,12 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob,
MEM_freeN(done);
return;
- } else /* if there are no UVs, default to local */
+ }
+ else /* if there are no UVs, default to local */
texmapping = MOD_DISP_MAP_LOCAL;
}
- for(i = 0; i < numVerts; ++i, ++co, ++texco) {
+ for (i = 0; i < numVerts; ++i, ++co, ++texco) {
switch(texmapping) {
case MOD_DISP_MAP_LOCAL:
copy_v3_v3(*texco, *co);
@@ -148,9 +149,9 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob,
void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3])
{
- while((md=md->next) && md->type==eModifierType_Armature) {
+ while ((md=md->next) && md->type==eModifierType_Armature) {
ArmatureModifierData *amd = (ArmatureModifierData*) md;
- if(amd->multi && amd->prevCos==NULL)
+ if (amd->multi && amd->prevCos==NULL)
amd->prevCos= MEM_dupallocN(vertexCos);
else
break;
@@ -161,10 +162,10 @@ void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3])
/* returns a cdderivedmesh if dm == NULL or is another type of derivedmesh */
DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3])
{
- if(dm && dm->type == DM_TYPE_CDDM)
+ if (dm && dm->type == DM_TYPE_CDDM)
return dm;
- if(!dm) {
+ if (!dm) {
dm= get_dm(ob, em, dm, vertexCos, 0);
}
else {
@@ -172,7 +173,7 @@ DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float
CDDM_apply_vert_coords(dm, vertexCos);
}
- if(dm)
+ if (dm)
CDDM_calc_normals(dm);
return dm;
@@ -181,22 +182,22 @@ DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float
/* returns a derived mesh if dm == NULL, for deforming modifiers that need it */
DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco)
{
- if(dm)
+ if (dm)
return dm;
- if(ob->type==OB_MESH) {
- if(em) dm= CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE);
+ if (ob->type==OB_MESH) {
+ if (em) dm= CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE);
else dm = CDDM_from_mesh((struct Mesh *)(ob->data), ob);
- if(vertexCos) {
+ if (vertexCos) {
CDDM_apply_vert_coords(dm, vertexCos);
//CDDM_calc_normals(dm);
}
- if(orco)
+ if (orco)
DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, get_mesh_orco_verts(ob));
}
- else if(ELEM3(ob->type,OB_FONT,OB_CURVE,OB_SURF)) {
+ else if (ELEM3(ob->type,OB_FONT,OB_CURVE,OB_SURF)) {
dm= CDDM_from_curve(ob);
}
@@ -208,10 +209,10 @@ void modifier_get_vgroup(Object *ob, DerivedMesh *dm, const char *name, MDeformV
*defgrp_index = defgroup_name_index(ob, name);
*dvert = NULL;
- if(*defgrp_index >= 0) {
- if(ob->type == OB_LATTICE)
+ if (*defgrp_index >= 0) {
+ if (ob->type == OB_LATTICE)
*dvert = lattice_get_deform_verts(ob);
- else if(dm)
+ else if (dm)
*dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
}
}
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index cd4858fcb4d..1b96c586cbf 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -61,7 +61,7 @@ static void initData(ModifierData *md)
UVProjectModifierData *umd = (UVProjectModifierData*) md;
int i;
- for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
+ for (i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
umd->projectors[i] = NULL;
umd->image = NULL;
umd->flags = 0;
@@ -76,7 +76,7 @@ static void copyData(ModifierData *md, ModifierData *target)
UVProjectModifierData *tumd = (UVProjectModifierData*) target;
int i;
- for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
+ for (i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
tumd->projectors[i] = umd->projectors[i];
tumd->image = umd->image;
tumd->flags = umd->flags;
@@ -104,7 +104,7 @@ static void foreachObjectLink(ModifierData *md, Object *ob,
UVProjectModifierData *umd = (UVProjectModifierData*) md;
int i;
- for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
+ for (i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
walk(userData, ob, &umd->projectors[i]);
}
@@ -127,8 +127,8 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
UVProjectModifierData *umd = (UVProjectModifierData*) md;
int i;
- for(i = 0; i < umd->num_projectors; ++i) {
- if(umd->projectors[i]) {
+ for (i = 0; i < umd->num_projectors; ++i) {
+ if (umd->projectors[i]) {
DagNode *curNode = dag_get_node(forest, umd->projectors[i]);
dag_add_relation(forest, curNode, obNode,
@@ -167,21 +167,21 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
aspect = aspx / aspy;
- for(i = 0; i < umd->num_projectors; ++i)
- if(umd->projectors[i])
+ for (i = 0; i < umd->num_projectors; ++i)
+ if (umd->projectors[i])
projectors[num_projectors++].ob = umd->projectors[i];
- if(num_projectors == 0) return dm;
+ if (num_projectors == 0) return dm;
/* make sure there are UV Maps available */
- if(!CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) return dm;
+ if (!CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) return dm;
/* make sure we're using an existing layer */
CustomData_validate_layer_name(&dm->loopData, CD_MLOOPUV, umd->uvlayer_name, uvname);
/* calculate a projection matrix and normal for each projector */
- for(i = 0; i < num_projectors; ++i) {
+ for (i = 0; i < num_projectors; ++i) {
float tmpmat[4][4];
float offsetmat[4][4];
Camera *cam = NULL;
@@ -190,10 +190,10 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
projectors[i].uci= NULL;
- if(projectors[i].ob->type == OB_CAMERA) {
+ if (projectors[i].ob->type == OB_CAMERA) {
cam = (Camera *)projectors[i].ob->data;
- if(cam->flag & CAM_PANORAMA) {
+ if (cam->flag & CAM_PANORAMA) {
projectors[i].uci= project_camera_info(projectors[i].ob, NULL, aspx, aspy);
project_camera_info_scale(projectors[i].uci, scax, scay);
free_uci= 1;
@@ -204,7 +204,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
float scale= (cam->type == CAM_PERSP) ? cam->clipsta * sensor / cam->lens : cam->ortho_scale;
float xmax, xmin, ymax, ymin;
- if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+ if (sensor_fit==CAMERA_SENSOR_FIT_HOR) {
xmax = 0.5f * scale;
ymax = xmax / aspect;
}
@@ -222,17 +222,19 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
ymin *= scay;
ymax *= scay;
- if(cam->type == CAM_PERSP) {
+ if (cam->type == CAM_PERSP) {
float perspmat[4][4];
perspective_m4( perspmat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend);
mult_m4_m4m4(tmpmat, perspmat, projectors[i].projmat);
- } else { /* if(cam->type == CAM_ORTHO) */
+ }
+ else { /* if (cam->type == CAM_ORTHO) */
float orthomat[4][4];
orthographic_m4( orthomat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend);
mult_m4_m4m4(tmpmat, orthomat, projectors[i].projmat);
}
}
- } else {
+ }
+ else {
copy_m4_m4(tmpmat, projectors[i].projmat);
}
@@ -282,22 +284,22 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
dm->getVertCos(dm, coords);
/* convert coords to world space */
- for(i = 0, co = coords; i < numVerts; ++i, ++co)
+ for (i = 0, co = coords; i < numVerts; ++i, ++co)
mul_m4_v3(ob->obmat, *co);
/* if only one projector, project coords to UVs */
- if(num_projectors == 1 && projectors[0].uci==NULL)
- for(i = 0, co = coords; i < numVerts; ++i, ++co)
+ if (num_projectors == 1 && projectors[0].uci==NULL)
+ for (i = 0, co = coords; i < numVerts; ++i, ++co)
mul_project_m4_v3(projectors[0].projmat, *co);
mpoly = dm->getPolyArray(dm);
mloop = dm->getLoopArray(dm);
/* apply coords as UVs, and apply image if tfaces are new */
- for(i = 0, mp = mpoly; i < numPolys; ++i, ++mp, ++mt) {
- if(override_image || !image || (mtexpoly == NULL || mt->tpage == image)) {
- if(num_projectors == 1) {
- if(projectors[0].uci) {
+ for (i = 0, mp = mpoly; i < numPolys; ++i, ++mp, ++mt) {
+ if (override_image || !image || (mtexpoly == NULL || mt->tpage == image)) {
+ if (num_projectors == 1) {
+ if (projectors[0].uci) {
unsigned int fidx= mp->totloop - 1;
do {
unsigned int lidx= mp->loopstart + fidx;
@@ -314,7 +316,8 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
copy_v2_v2(mloop_uv[lidx].uv, coords[vidx]);
} while (fidx--);
}
- } else {
+ }
+ else {
/* multiple projectors, select the closest to face normal direction */
float face_no[3];
int j;
@@ -330,16 +333,16 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
best_dot = dot_v3v3(projectors[0].normal, face_no);
best_projector = &projectors[0];
- for(j = 1; j < num_projectors; ++j) {
+ for (j = 1; j < num_projectors; ++j) {
float tmp_dot = dot_v3v3(projectors[j].normal,
face_no);
- if(tmp_dot > best_dot) {
+ if (tmp_dot > best_dot) {
best_dot = tmp_dot;
best_projector = &projectors[j];
}
}
- if(best_projector->uci) {
+ if (best_projector->uci) {
unsigned int fidx= mp->totloop - 1;
do {
unsigned int lidx= mp->loopstart + fidx;
@@ -363,21 +366,25 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
}
}
- if(override_image && mtexpoly) {
+ if (override_image && mtexpoly) {
mt->tpage = image;
}
}
MEM_freeN(coords);
- if(free_uci) {
+ if (free_uci) {
int j;
- for(j = 0; j < num_projectors; ++j) {
- if(projectors[j].uci) {
+ for (j = 0; j < num_projectors; ++j) {
+ if (projectors[j].uci) {
MEM_freeN(projectors[j].uci);
}
}
}
+
+ /* Mark tessellated CD layers as dirty. */
+ dm->dirty |= DM_DIRTY_TESS_CDLAYERS;
+
return dm;
}
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index 4d058197be5..a318d9b68af 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -88,11 +88,11 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(wmd->defgrp_name[0]) dataMask |= (CD_MASK_MDEFORMVERT);
+ if (wmd->defgrp_name[0]) dataMask |= (CD_MASK_MDEFORMVERT);
dataMask |= (CD_MASK_MDEFORMVERT);
/* ask for UV coordinates if we need them */
- if(wmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE);
+ if (wmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE);
return dataMask;
}
@@ -101,7 +101,7 @@ static int dependsOnTime(ModifierData *md)
{
WarpModifierData *wmd = (WarpModifierData *)md;
- if(wmd->texture) {
+ if (wmd->texture) {
return BKE_texture_dependsOnTime(wmd->texture);
}
else {
@@ -153,7 +153,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN
{
WarpModifierData *wmd = (WarpModifierData*) md;
- if(wmd->object_from && wmd->object_to) {
+ if (wmd->object_from && wmd->object_to) {
DagNode *fromNode = dag_get_node(forest, wmd->object_from);
DagNode *toNode = dag_get_node(forest, wmd->object_to);
@@ -161,7 +161,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN
dag_add_relation(forest, toNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier2");
}
- if((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object) {
+ if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object) {
DagNode *curNode = dag_get_node(forest, wmd->map_object);
dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier3");
}
@@ -187,12 +187,12 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
float (*tex_co)[3]= NULL;
- if(!(wmd->object_from && wmd->object_to))
+ if (!(wmd->object_from && wmd->object_to))
return;
modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index);
- if(wmd->curfalloff==NULL) /* should never happen, but bad lib linking could cause it */
+ if (wmd->curfalloff==NULL) /* should never happen, but bad lib linking could cause it */
wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
invert_m4_m4(obinv, ob->obmat);
@@ -207,7 +207,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
unit_m4(mat_unit);
- if(strength < 0.0f) {
+ if (strength < 0.0f) {
float loc[3];
strength = -strength;
@@ -219,24 +219,24 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
}
weight= strength;
- if(wmd->texture) {
+ if (wmd->texture) {
tex_co = MEM_mallocN(sizeof(*tex_co) * numVerts, "warpModifier_do tex_co");
get_texture_coords((MappingInfoModifierData *)wmd, ob, dm, vertexCos, tex_co, numVerts);
}
- for(i = 0; i < numVerts; i++) {
+ for (i = 0; i < numVerts; i++) {
float *co = vertexCos[i];
- if(wmd->falloff_type==eWarp_Falloff_None ||
+ if (wmd->falloff_type==eWarp_Falloff_None ||
((fac=len_v3v3(co, mat_from[3])) < wmd->falloff_radius && (fac=(wmd->falloff_radius-fac)/wmd->falloff_radius)) ) {
/* skip if no vert group found */
- if(dvert && defgrp_index >= 0) {
+ if (dvert && defgrp_index >= 0) {
dv = &dvert[i];
- if(dv) {
+ if (dv) {
weight = defvert_find_weight(dv, defgrp_index) * strength;
- if(weight <= 0.0f) /* Should never occure... */
+ if (weight <= 0.0f) /* Should never occure... */
continue;
}
}
@@ -272,7 +272,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
fac *= weight;
- if(tex_co) {
+ if (tex_co) {
TexResult texres;
texres.nor = NULL;
get_texture_value(wmd->texture, tex_co[i], &texres);
@@ -282,11 +282,11 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
/* into the 'from' objects space */
mul_m4_v3(mat_from_inv, co);
- if(fac >= 1.0f) {
+ if (fac >= 1.0f) {
mul_m4_v3(mat_final, co);
}
- else if(fac > 0.0f) {
- if(wmd->flag & MOD_WARP_VOLUME_PRESERVE) {
+ else if (fac > 0.0f) {
+ if (wmd->flag & MOD_WARP_VOLUME_PRESERVE) {
/* interpolate the matrix for nicer locations */
blend_m4_m4m4(tmat, mat_unit, mat_final, fac);
mul_m4_v3(tmat, co);
@@ -303,7 +303,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
}
}
- if(tex_co)
+ if (tex_co)
MEM_freeN(tex_co);
}
@@ -319,14 +319,14 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
DerivedMesh *dm= NULL;
int use_dm= warp_needs_dm((WarpModifierData *)md);
- if(use_dm) {
+ if (use_dm) {
dm= get_cddm(ob, NULL, derivedData, vertexCos);
}
warpModifier_do((WarpModifierData *)md, ob, dm, vertexCos, numVerts);
- if(use_dm) {
- if(dm != derivedData) dm->release(dm);
+ if (use_dm) {
+ if (dm != derivedData) dm->release(dm);
}
}
@@ -336,15 +336,15 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD
DerivedMesh *dm = derivedData;
int use_dm= warp_needs_dm((WarpModifierData *)md);
- if(use_dm) {
- if(!derivedData)
+ if (use_dm) {
+ if (!derivedData)
dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
}
deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0);
- if(use_dm) {
- if(!derivedData) dm->release(dm);
+ if (use_dm) {
+ if (!derivedData) dm->release(dm);
}
}
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index 15f78e15073..87c0df3e12f 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -138,14 +138,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
{
WaveModifierData *wmd = (WaveModifierData*) md;
- if(wmd->objectcenter) {
+ if (wmd->objectcenter) {
DagNode *curNode = dag_get_node(forest, wmd->objectcenter);
dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA,
"Wave Modifier");
}
- if(wmd->map_object) {
+ if (wmd->map_object) {
DagNode *curNode = dag_get_node(forest, wmd->map_object);
dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA,
@@ -160,11 +160,11 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
/* ask for UV coordinates if we need them */
- if(wmd->texture && wmd->texmapping == MOD_DISP_MAP_UV)
+ if (wmd->texture && wmd->texmapping == MOD_DISP_MAP_UV)
dataMask |= CD_MASK_MTFACE;
/* ask for vertexgroups if we need them */
- if(wmd->defgrp_name[0])
+ if (wmd->defgrp_name[0])
dataMask |= CD_MASK_MDEFORMVERT;
return dataMask;
@@ -187,10 +187,10 @@ static void waveModifier_do(WaveModifierData *md,
const float falloff= wmd->falloff;
float falloff_fac= 1.0f; /* when falloff == 0.0f this stays at 1.0f */
- if(wmd->flag & MOD_WAVE_NORM && ob->type == OB_MESH)
+ if (wmd->flag & MOD_WAVE_NORM && ob->type == OB_MESH)
mvert = dm->getVertArray(dm);
- if(wmd->objectcenter){
+ if (wmd->objectcenter) {
float mat[4][4];
/* get the control object's location in local coordinates */
invert_m4_m4(ob->imat, ob->obmat);
@@ -203,32 +203,32 @@ static void waveModifier_do(WaveModifierData *md,
/* get the index of the deform group */
modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index);
- if(wmd->damp == 0) wmd->damp = 10.0f;
+ if (wmd->damp == 0) wmd->damp = 10.0f;
- if(wmd->lifetime != 0.0f) {
+ if (wmd->lifetime != 0.0f) {
float x = ctime - wmd->timeoffs;
- if(x > wmd->lifetime) {
+ if (x > wmd->lifetime) {
lifefac = x - wmd->lifetime;
- if(lifefac > wmd->damp) lifefac = 0.0;
+ if (lifefac > wmd->damp) lifefac = 0.0;
else lifefac =
(float)(wmd->height * (1.0f - sqrtf(lifefac / wmd->damp)));
}
}
- if(wmd->texture) {
+ if (wmd->texture) {
tex_co = MEM_mallocN(sizeof(*tex_co) * numVerts,
"waveModifier_do tex_co");
get_texture_coords((MappingInfoModifierData *)wmd, ob, dm, vertexCos, tex_co, numVerts);
}
- if(lifefac != 0.0f) {
+ if (lifefac != 0.0f) {
/* avoid divide by zero checks within the loop */
float falloff_inv= falloff ? 1.0f / falloff : 1.0f;
int i;
- for(i = 0; i < numVerts; i++) {
+ for (i = 0; i < numVerts; i++) {
float *co = vertexCos[i];
float x = co[0] - wmd->startx;
float y = co[1] - wmd->starty;
@@ -236,11 +236,11 @@ static void waveModifier_do(WaveModifierData *md,
float def_weight= 1.0f;
/* get weights */
- if(dvert) {
+ if (dvert) {
def_weight= defvert_find_weight(&dvert[i], defgrp_index);
/* if this vert isn't in the vgroup, don't deform it */
- if(def_weight == 0.0f) {
+ if (def_weight == 0.0f) {
continue;
}
}
@@ -260,12 +260,12 @@ static void waveModifier_do(WaveModifierData *md,
/* this way it makes nice circles */
amplit -= (ctime - wmd->timeoffs) * wmd->speed;
- if(wmd->flag & MOD_WAVE_CYCL) {
+ if (wmd->flag & MOD_WAVE_CYCL) {
amplit = (float)fmodf(amplit - wmd->width, 2.0f * wmd->width)
+ wmd->width;
}
- if(falloff != 0.0f) {
+ if (falloff != 0.0f) {
float dist = 0.0f;
switch(wmd_axis) {
@@ -285,12 +285,12 @@ static void waveModifier_do(WaveModifierData *md,
}
/* GAUSSIAN */
- if((falloff_fac != 0.0f) && (amplit > -wmd->width) && (amplit < wmd->width)) {
+ if ((falloff_fac != 0.0f) && (amplit > -wmd->width) && (amplit < wmd->width)) {
amplit = amplit * wmd->narrow;
amplit = (float)(1.0f / expf(amplit * amplit) - minfac);
/*apply texture*/
- if(wmd->texture) {
+ if (wmd->texture) {
TexResult texres;
texres.nor = NULL;
get_texture_value(wmd->texture, tex_co[i], &texres);
@@ -300,15 +300,15 @@ static void waveModifier_do(WaveModifierData *md,
/*apply weight & falloff */
amplit *= def_weight * falloff_fac;
- if(mvert) {
+ if (mvert) {
/* move along normals */
- if(wmd->flag & MOD_WAVE_NORM_X) {
+ if (wmd->flag & MOD_WAVE_NORM_X) {
co[0] += (lifefac * amplit) * mvert[i].no[0] / 32767.0f;
}
- if(wmd->flag & MOD_WAVE_NORM_Y) {
+ if (wmd->flag & MOD_WAVE_NORM_Y) {
co[1] += (lifefac * amplit) * mvert[i].no[1] / 32767.0f;
}
- if(wmd->flag & MOD_WAVE_NORM_Z) {
+ if (wmd->flag & MOD_WAVE_NORM_Z) {
co[2] += (lifefac * amplit) * mvert[i].no[2] / 32767.0f;
}
}
@@ -320,7 +320,7 @@ static void waveModifier_do(WaveModifierData *md,
}
}
- if(wmd->texture) MEM_freeN(tex_co);
+ if (wmd->texture) MEM_freeN(tex_co);
}
static void deformVerts(ModifierData *md, Object *ob,
@@ -333,14 +333,14 @@ static void deformVerts(ModifierData *md, Object *ob,
DerivedMesh *dm= derivedData;
WaveModifierData *wmd = (WaveModifierData *)md;
- if(wmd->flag & MOD_WAVE_NORM)
+ if (wmd->flag & MOD_WAVE_NORM)
dm= get_cddm(ob, NULL, dm, vertexCos);
- else if(wmd->texture || wmd->defgrp_name[0])
+ else if (wmd->texture || wmd->defgrp_name[0])
dm= get_dm(ob, NULL, dm, NULL, 0);
waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts);
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
@@ -351,14 +351,14 @@ static void deformVertsEM(
DerivedMesh *dm= derivedData;
WaveModifierData *wmd = (WaveModifierData *)md;
- if(wmd->flag & MOD_WAVE_NORM)
+ if (wmd->flag & MOD_WAVE_NORM)
dm= get_cddm(ob, editData, dm, vertexCos);
- else if(wmd->texture || wmd->defgrp_name[0])
+ else if (wmd->texture || wmd->defgrp_name[0])
dm= get_dm(ob, editData, dm, NULL, 0);
waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts);
- if(dm != derivedData)
+ if (dm != derivedData)
dm->release(dm);
}
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 3bc6c318d9f..47a2aeaf4a2 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -64,14 +64,14 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
/* Return immediately, if we have nothing to do! */
/* Also security checks... */
- if(((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL))
+ if (((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL))
|| !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) {
+ for (i = 0; i < num; ++i) {
float fac = new_w[i];
/* Code borrowed from the warp modifier. */
@@ -109,7 +109,7 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
* Return values are in org_w.
* If indices is not NULL, it must be a table of same length as org_w and new_w, mapping to the real
* vertex index (in case the weight tables do not cover the whole vertices...).
- * XXX The standard “factor” value is assumed in [0.0, 1.0] range. Else, weird results might appear.
+ * XXX The standard "factor" value is assumed in [0.0, 1.0] range. Else, weird results might appear.
*/
void weightvg_do_mask(int num, const int *indices, float *org_w, const float *new_w,
Object *ob, DerivedMesh *dm, float fact, const char defgrp_name[MAX_VGROUP_NAME],
@@ -146,7 +146,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
MEM_freeN(v_co);
/* For each weight (vertex), make the mix between org and new weights. */
- for(i = 0; i < num; ++i) {
+ for (i = 0; i < num; ++i) {
int idx = indices ? indices[i] : i;
TexResult texres;
float h, s, v; /* For HSV color space. */
@@ -237,7 +237,7 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws,
{
int i;
- for(i = 0; i < num; i++) {
+ for (i = 0; i < num; i++) {
float w = weights[i];
MDeformVert *dv = &dvert[indices ? indices[i] : i];
MDeformWeight *dw = dws ? dws[i] : defvert_find_index(dv, defgrp_idx);
@@ -246,8 +246,8 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws,
CLAMP(w, 0.0f, 1.0f);
/* If the vertex is in this vgroup, remove it if needed, or just update it. */
- if(dw != NULL) {
- if(do_rem && w < rem_thresh) {
+ if (dw != NULL) {
+ if (do_rem && w < rem_thresh) {
defvert_remove_group(dv, dw);
}
else {
@@ -255,7 +255,7 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws,
}
}
/* Else, add it if needed! */
- else if(do_add && w > add_thresh) {
+ else if (do_add && w > add_thresh) {
defvert_add_index_notest(dv, defgrp_idx, w);
}
}
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h
index a723d0f02e5..57ba115c04e 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.h
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.h
@@ -70,7 +70,7 @@ void weightvg_do_map(int num, float *new_w, short mode, struct CurveMapping *cma
* Return values are in org_w.
* If indices is not NULL, it must be a table of same length as org_w and new_w, mapping to the real
* vertex index (in case the weight tables do not cover the whole vertices...).
- * XXX The standard “factor” value is assumed in [0.0, 1.0] range. Else, weird results might appear.
+ * XXX The standard "factor" value is assumed in [0.0, 1.0] range. Else, weird results might appear.
*/
void weightvg_do_mask(int num, const int *indices, float *org_w, const float *new_w, Object *ob,
DerivedMesh *dm, float fact, const char defgrp_name[MAX_VGROUP_NAME], Tex *texture,
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index 45c934654d0..d6bcca5524a 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -111,10 +111,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
dataMask |= CD_MASK_MDEFORMVERT;
/* Ask for UV coordinates if we need them. */
- if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
+ if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
dataMask |= CD_MASK_MTFACE;
- /* No need to ask for CD_WEIGHT_MCOL... */
+ /* No need to ask for CD_PREVIEW_MLOOPCOL... */
return dataMask;
}
@@ -123,7 +123,7 @@ static int dependsOnTime(ModifierData *md)
{
WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
- if(wmd->mask_texture)
+ if (wmd->mask_texture)
return BKE_texture_dependsOnTime(wmd->mask_texture);
return 0;
}
@@ -156,14 +156,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN
WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
DagNode *curNode;
- if(wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
+ if (wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
curNode = dag_get_node(forest, wmd->mask_tex_map_obj);
dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
"WeightVGEdit Modifier");
}
- if(wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
+ if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
"WeightVGEdit Modifier");
}
@@ -211,15 +211,15 @@ 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)
+ if (!do_add)
return dm;
/* Else, add a valid data layer! */
dvert = CustomData_add_layer_named(&dm->vertData, CD_MDEFORMVERT, CD_CALLOC,
NULL, numVerts, wmd->defgrp_name);
/* Ultimate security check. */
- if(!dvert)
+ if (!dvert)
return dm;
/* Get org weights, assuming 0.0 for vertices not in given vgroup. */
@@ -228,7 +228,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
dw = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGEdit Modifier, dw");
for (i = 0; i < numVerts; i++) {
dw[i] = defvert_find_index(&dvert[i], defgrp_idx);
- if(dw[i]) {
+ if (dw[i]) {
org_w[i] = new_w[i] = dw[i]->weight;
}
else {
@@ -252,7 +252,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* If weight preview enabled... */
#if 0 /* XXX Currently done in mod stack :/ */
- if(do_prev)
+ if (do_prev)
DM_update_weight_mcol(ob, dm, 0, org_w, 0, NULL);
#endif
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index 81a6ecc99e5..cf4f9b31a7f 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -153,10 +153,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
dataMask |= CD_MASK_MDEFORMVERT;
/* Ask for UV coordinates if we need them. */
- if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
+ if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
dataMask |= CD_MASK_MTFACE;
- /* No need to ask for CD_WEIGHT_MCOL... */
+ /* No need to ask for CD_PREVIEW_MLOOPCOL... */
return dataMask;
}
@@ -165,7 +165,7 @@ static int dependsOnTime(ModifierData *md)
{
WeightVGMixModifierData *wmd = (WeightVGMixModifierData*) md;
- if(wmd->mask_texture)
+ if (wmd->mask_texture)
return BKE_texture_dependsOnTime(wmd->mask_texture);
return 0;
}
@@ -198,14 +198,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN
WeightVGMixModifierData *wmd = (WeightVGMixModifierData*) md;
DagNode *curNode;
- if(wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
+ if (wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
curNode = dag_get_node(forest, wmd->mask_tex_map_obj);
dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
"WeightVGMix Modifier");
}
- if(wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
+ if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
"WeightVGMix Modifier");
}
@@ -258,15 +258,15 @@ 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)
+ if (wmd->mix_set != MOD_WVG_SET_ALL)
return dm;
/* Else, add a valid data layer! */
dvert = CustomData_add_layer_named(&dm->vertData, CD_MDEFORMVERT, CD_CALLOC,
NULL, numVerts, wmd->defgrp_name_a);
/* Ultimate security check. */
- if(!dvert)
+ if (!dvert)
return dm;
/* Find out which vertices to work on. */
@@ -278,7 +278,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* All vertices in first vgroup. */
for (i = 0; i < numVerts; i++) {
MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx);
- if(dw) {
+ if (dw) {
tdw1[numIdx] = dw;
tdw2[numIdx] = defvert_find_index(&dvert[i], defgrp_idx2);
tidx[numIdx++] = i;
@@ -289,7 +289,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* All vertices in second vgroup. */
for (i = 0; i < numVerts; i++) {
MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx2);
- if(dw) {
+ if (dw) {
tdw1[numIdx] = defvert_find_index(&dvert[i], defgrp_idx);
tdw2[numIdx] = dw;
tidx[numIdx++] = i;
@@ -301,7 +301,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
for (i = 0; i < numVerts; i++) {
MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx);
MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2);
- if(adw || bdw) {
+ if (adw || bdw) {
tdw1[numIdx] = adw;
tdw2[numIdx] = bdw;
tidx[numIdx++] = i;
@@ -313,7 +313,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
for (i = 0; i < numVerts; i++) {
MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx);
MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2);
- if(adw && bdw) {
+ if (adw && bdw) {
tdw1[numIdx] = adw;
tdw2[numIdx] = bdw;
tidx[numIdx++] = i;
@@ -330,7 +330,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
numIdx = -1;
break;
}
- if(numIdx == 0) {
+ if (numIdx == 0) {
/* Use no vertices! Hence, return org data. */
MEM_freeN(tdw1);
MEM_freeN(tdw2);
@@ -380,7 +380,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* If weight preview enabled... */
#if 0 /* XXX Currently done in mod stack :/ */
- if(do_prev)
+ if (do_prev)
DM_update_weight_mcol(ob, dm, 0, org_w, numIdx, indices);
#endif
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index ec9b2b80d83..241fcd05eab 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -80,7 +80,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3],
if (dist_v) {
/* Create a bvh-tree of the given target's verts. */
bvhtree_from_mesh_verts(&treeData_v, target, 0.0, 2, 6);
- if(treeData_v.tree == NULL) {
+ if (treeData_v.tree == NULL) {
OUT_OF_MEMORY();
return;
}
@@ -88,7 +88,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3],
if (dist_e) {
/* Create a bvh-tree of the given target's edges. */
bvhtree_from_mesh_edges(&treeData_e, target, 0.0, 2, 6);
- if(treeData_e.tree == NULL) {
+ if (treeData_e.tree == NULL) {
OUT_OF_MEMORY();
return;
}
@@ -96,7 +96,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3],
if (dist_f) {
/* Create a bvh-tree of the given target's faces. */
bvhtree_from_mesh_faces(&treeData_f, target, 0.0, 2, 6);
- if(treeData_f.tree == NULL) {
+ if (treeData_f.tree == NULL) {
OUT_OF_MEMORY();
return;
}
@@ -165,7 +165,7 @@ static void get_vert2ob_distance(int numVerts, float (*v_cos)[3], float *dist,
float v_wco[3];
unsigned int i= numVerts;
- while(i-- > 0) {
+ while (i-- > 0) {
/* Get world-coordinates of the vertex (constraints and anim included). */
mul_v3_m4v3(v_wco, ob->obmat, v_cos[i]);
/* Return distance between both coordinates. */
@@ -183,33 +183,33 @@ static float get_ob2ob_distance(const Object* ob, const Object* obr)
}
/**
- * Maps distances to weights, with an optionnal “smoothing” mapping.
+ * Maps distances to weights, with an optionnal "smoothing" mapping.
*/
void do_map(float *weights, const int nidx, const float min_d, const float max_d, short mode)
{
const float range_inv= 1.0f / (max_d - min_d); /* invert since multiplication is faster */
unsigned int i= nidx;
- if(max_d == min_d) {
+ if (max_d == min_d) {
while (i-- > 0) {
weights[i] = (weights[i] >= max_d) ? 1.0f : 0.0f; /* "Step" behavior... */
}
}
- else if(max_d > min_d) {
+ else if (max_d > min_d) {
while (i-- > 0) {
if (weights[i] >= max_d) weights[i]= 1.0f; /* most likely case first */
- else if(weights[i] <= min_d) weights[i]= 0.0f;
+ else if (weights[i] <= min_d) weights[i]= 0.0f;
else weights[i]= (weights[i] - min_d) * range_inv;
}
}
else {
while (i-- > 0) {
if (weights[i] <= max_d) weights[i]= 1.0f; /* most likely case first */
- else if(weights[i] >= min_d) weights[i]= 0.0f;
+ else if (weights[i] >= min_d) weights[i]= 0.0f;
else weights[i]= (weights[i] - min_d) * range_inv;
}
}
- if(!ELEM(mode, MOD_WVG_MAPPING_NONE, MOD_WVG_MAPPING_CURVE)) {
+ if (!ELEM(mode, MOD_WVG_MAPPING_NONE, MOD_WVG_MAPPING_CURVE)) {
weightvg_do_map(nidx, weights, mode, NULL);
}
}
@@ -264,10 +264,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
dataMask |= CD_MASK_MDEFORMVERT;
/* Ask for UV coordinates if we need them. */
- if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
+ if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
dataMask |= CD_MASK_MTFACE;
- /* No need to ask for CD_WEIGHT_MCOL... */
+ /* No need to ask for CD_PREVIEW_MLOOPCOL... */
return dataMask;
}
@@ -276,7 +276,7 @@ static int dependsOnTime(ModifierData *md)
{
WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData*) md;
- if(wmd->mask_texture)
+ if (wmd->mask_texture)
return BKE_texture_dependsOnTime(wmd->mask_texture);
return 0;
}
@@ -316,14 +316,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN
"WeightVGProximity Modifier");
}
- if(wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
+ if (wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
curNode = dag_get_node(forest, wmd->mask_tex_map_obj);
dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
"WeightVGProximity Modifier");
}
- if(wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
+ if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
"WeightVGProximity Modifier");
}
@@ -385,7 +385,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.
* As this modifier never add vertices to vgroup, just return. */
- if(!dvert)
+ if (!dvert)
return dm;
/* Find out which vertices to work on (all vertices in vgroup), and get their relevant weight.
@@ -395,20 +395,20 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
tdw = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGProximity Modifier, tdw");
for (i = 0; i < numVerts; i++) {
MDeformWeight *_dw = defvert_find_index(&dvert[i], defgrp_idx);
- if(_dw) {
+ if (_dw) {
tidx[numIdx] = i;
tw[numIdx] = _dw->weight;
tdw[numIdx++] = _dw;
}
}
/* If no vertices found, return org data! */
- if(numIdx == 0) {
+ if (numIdx == 0) {
MEM_freeN(tidx);
MEM_freeN(tw);
MEM_freeN(tdw);
return dm;
}
- if(numIdx != numVerts) {
+ if (numIdx != numVerts) {
indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGProximity Modifier, indices");
memcpy(indices, tidx, sizeof(int) * numIdx);
org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, org_w");
@@ -427,7 +427,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* Get our vertex coordinates. */
v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos");
- if(numIdx != numVerts) {
+ if (numIdx != numVerts) {
/* XXX In some situations, this code can be up to about 50 times more performant
* than simply using getVertCo for each affected vertex...
*/
@@ -443,7 +443,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* Compute wanted distances. */
if (wmd->proximity_mode == MOD_WVG_PROXIMITY_OBJECT) {
const float dist = get_ob2ob_distance(ob, obr);
- for(i = 0; i < numIdx; i++)
+ for (i = 0; i < numIdx; i++)
new_w[i] = dist;
}
else if (wmd->proximity_mode == MOD_WVG_PROXIMITY_GEOMETRY) {
@@ -477,17 +477,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
space_transform_setup(&loc2trgt, ob, obr);
get_vert2geom_distance(numIdx, v_cos, dists_v, dists_e, dists_f,
target_dm, &loc2trgt);
- for(i = 0; i < numIdx; i++) {
+ for (i = 0; i < numIdx; i++) {
new_w[i] = dists_v ? dists_v[i] : FLT_MAX;
- if(dists_e)
+ if (dists_e)
new_w[i] = minf(dists_e[i], new_w[i]);
- if(dists_f)
+ if (dists_f)
new_w[i] = minf(dists_f[i], new_w[i]);
}
- if(free_target_dm) target_dm->release(target_dm);
- if(dists_v) MEM_freeN(dists_v);
- if(dists_e) MEM_freeN(dists_e);
- if(dists_f) MEM_freeN(dists_f);
+ if (free_target_dm) target_dm->release(target_dm);
+ if (dists_v) MEM_freeN(dists_v);
+ if (dists_e) MEM_freeN(dists_e);
+ if (dists_f) MEM_freeN(dists_f);
}
/* Else, fall back to default obj2vert behavior. */
else {
@@ -512,7 +512,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* If weight preview enabled... */
#if 0 /* XXX Currently done in mod stack :/ */
- if(do_prev)
+ if (do_prev)
DM_update_weight_mcol(ob, dm, 0, org_w, numIdx, indices);
#endif
@@ -520,7 +520,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
MEM_freeN(org_w);
MEM_freeN(new_w);
MEM_freeN(dw);
- if(indices)
+ if (indices)
MEM_freeN(indices);
MEM_freeN(v_cos);
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index aabf13f3bb2..9bcbc91265c 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -222,6 +222,10 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
if(WITH_IMAGE_OPENEXR)
add_definitions(-DWITH_OPENEXR)
endif()
diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript
index d7dbed51282..fcf00bdef78 100644
--- a/source/blender/nodes/SConscript
+++ b/source/blender/nodes/SConscript
@@ -26,6 +26,9 @@ if env['WITH_BF_PYTHON']:
if env['BF_DEBUG']:
defs.append('_DEBUG')
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index 0ebed7105f0..b60e962f534 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -63,8 +63,8 @@
static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
{
Scene *sce;
- for(sce= main->scene.first; sce; sce= sce->id.next) {
- if(sce->nodetree) {
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->nodetree) {
func(calldata, &sce->id, sce->nodetree);
}
}
@@ -88,8 +88,8 @@ static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node)
{
bNodeSocket *sock;
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(sock->cache) {
+ for (sock= node->outputs.first; sock; sock= sock->next) {
+ if (sock->cache) {
free_compbuf(sock->cache);
sock->cache= NULL;
}
@@ -99,7 +99,7 @@ static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node)
static void free_cache(bNodeTree *ntree)
{
bNode *node;
- for(node= ntree->nodes.first; node; node= node->next)
+ for (node= ntree->nodes.first; node; node= node->next)
free_node_cache(ntree, node);
}
@@ -107,8 +107,8 @@ static void update_node(bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock;
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(sock->cache) {
+ for (sock= node->outputs.first; sock; sock= sock->next) {
+ if (sock->cache) {
//free_compbuf(sock->cache);
//sock->cache= NULL;
}
@@ -126,23 +126,23 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree)
bNode *node, *node_next;
bNodeSocket *sock;
- for(node= ntree->nodes.first; node; node= node->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
/* ensure new user input gets handled ok */
node->need_exec= 0;
/* move over the compbufs */
/* right after ntreeCopyTree() oldsock pointers are valid */
- if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
- if(node->id) {
- if(node->flag & NODE_DO_OUTPUT)
+ if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+ if (node->id) {
+ if (node->flag & NODE_DO_OUTPUT)
node->new_node->id= (ID *)copy_image((Image *)node->id);
else
node->new_node->id= NULL;
}
}
- for(sock= node->outputs.first; sock; sock= sock->next) {
+ for (sock= node->outputs.first; sock; sock= sock->next) {
sock->new_sock->cache= sock->cache;
compbuf_set_node(sock->new_sock->cache, node->new_node);
@@ -177,11 +177,11 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
bNode *lnode;
/* move over the compbufs and previews */
- for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
- if( (lnode->exec & NODE_READY) && !(lnode->exec & NODE_SKIPPED) ) {
- if(ntreeNodeExists(ntree, lnode->new_node)) {
+ for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+ if ( (lnode->exec & NODE_READY) && !(lnode->exec & NODE_SKIPPED) ) {
+ if (ntreeNodeExists(ntree, lnode->new_node)) {
- if(lnode->preview && lnode->preview->rect) {
+ if (lnode->preview && lnode->preview->rect) {
nodeFreePreview(lnode->new_node);
lnode->new_node->preview= lnode->preview;
lnode->preview= NULL;
@@ -197,28 +197,28 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
bNodeSocket *lsock;
/* move over the compbufs and previews */
- for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
- if(ntreeNodeExists(ntree, lnode->new_node)) {
- if(ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
- if(lnode->id && (lnode->flag & NODE_DO_OUTPUT)) {
+ for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+ if (ntreeNodeExists(ntree, lnode->new_node)) {
+ if (ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+ if (lnode->id && (lnode->flag & NODE_DO_OUTPUT)) {
/* image_merge does sanity check for pointers */
BKE_image_merge((Image *)lnode->new_node->id, (Image *)lnode->id);
}
}
- else if(lnode->type==CMP_NODE_MOVIEDISTORTION) {
+ else if (lnode->type==CMP_NODE_MOVIEDISTORTION) {
/* special case for distortion node: distortion context is allocating in exec function
and to achive much better performance on further calls this context should be
copied back to original node */
- if(lnode->storage) {
- if(lnode->new_node->storage)
+ if (lnode->storage) {
+ if (lnode->new_node->storage)
BKE_tracking_distortion_destroy(lnode->new_node->storage);
lnode->new_node->storage= BKE_tracking_distortion_copy(lnode->storage);
}
}
- for(lsock= lnode->outputs.first; lsock; lsock= lsock->next) {
- if(ntreeOutputExists(lnode->new_node, lsock->new_sock)) {
+ for (lsock= lnode->outputs.first; lsock; lsock= lsock->next) {
+ if (ntreeOutputExists(lnode->new_node, lsock->new_sock)) {
lsock->new_sock->cache= lsock->cache;
compbuf_set_node(lsock->new_sock->cache, lnode->new_node);
lsock->cache= NULL;
@@ -276,21 +276,21 @@ struct bNodeTreeExec *ntreeCompositBeginExecTree(bNodeTree *ntree, int use_tree_
exec = ntree_exec_begin(ntree);
- for(node= exec->nodetree->nodes.first; node; node= node->next) {
+ for (node= exec->nodetree->nodes.first; node; node= node->next) {
/* initialize needed for groups */
node->exec= 0;
- for(sock= node->outputs.first; sock; sock= sock->next) {
+ for (sock= node->outputs.first; sock; sock= sock->next) {
bNodeStack *ns= node_get_socket_stack(exec->stack, sock);
- if(ns && sock->cache) {
+ if (ns && sock->cache) {
ns->data= sock->cache;
sock->cache= NULL;
}
}
/* cannot initialize them while using in threads */
- if(ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT)) {
+ if (ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT)) {
curvemapping_initialize(node->storage);
- if(node->type==CMP_NODE_CURVE_RGB)
+ if (node->type==CMP_NODE_CURVE_RGB)
curvemapping_premultiply(node->storage, 0);
}
}
@@ -310,22 +310,22 @@ struct bNodeTreeExec *ntreeCompositBeginExecTree(bNodeTree *ntree, int use_tree_
*/
void ntreeCompositEndExecTree(bNodeTreeExec *exec, int use_tree_data)
{
- if(exec) {
+ if (exec) {
bNodeTree *ntree= exec->nodetree;
bNode *node;
bNodeStack *ns;
- for(node= exec->nodetree->nodes.first; node; node= node->next) {
+ for (node= exec->nodetree->nodes.first; node; node= node->next) {
bNodeSocket *sock;
- for(sock= node->outputs.first; sock; sock= sock->next) {
+ for (sock= node->outputs.first; sock; sock= sock->next) {
ns = node_get_socket_stack(exec->stack, sock);
- if(ns && ns->data) {
+ if (ns && ns->data) {
sock->cache= ns->data;
ns->data= NULL;
}
}
- if(node->type==CMP_NODE_CURVE_RGB)
+ if (node->type==CMP_NODE_CURVE_RGB)
curvemapping_premultiply(node->storage, 1);
node->need_exec= 0;
@@ -347,14 +347,14 @@ static int node_only_value(bNode *node)
{
bNodeSocket *sock;
- if(ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_VALUE, CMP_NODE_RGB))
+ if (ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_VALUE, CMP_NODE_RGB))
return 1;
/* doing this for all node types goes wrong. memory free errors */
- if(node->inputs.first && node->type==CMP_NODE_MAP_VALUE) {
+ if (node->inputs.first && node->type==CMP_NODE_MAP_VALUE) {
int retval= 1;
- for(sock= node->inputs.first; sock; sock= sock->next) {
- if(sock->link)
+ for (sock= node->inputs.first; sock; sock= sock->next) {
+ if (sock->link)
retval &= node_only_value(sock->link->fromnode);
}
return retval;
@@ -378,7 +378,7 @@ static void *exec_composite_node(void *nodeexec_v)
node_get_stack(node, thd->stack, nsin, nsout);
- if(node->typeinfo->execfunc)
+ if (node->typeinfo->execfunc)
node->typeinfo->execfunc(thd->rd, node, nsin, nsout);
else if (node->typeinfo->newexecfunc)
node->typeinfo->newexecfunc(thd->rd, 0, node, nodeexec->data, nsin, nsout);
@@ -399,13 +399,13 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
int n, totnode= 0, group_edit= 0;
/* if we are in group edit, viewer nodes get skipped when group has viewer */
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
- if(ntreeHasType((bNodeTree *)node->id, CMP_NODE_VIEWER))
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
+ if (ntreeHasType((bNodeTree *)node->id, CMP_NODE_VIEWER))
group_edit= 1;
/* NB: using the exec data list here to have valid dependency sort */
- for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
int a;
node = nodeexec->node;
@@ -413,9 +413,9 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
/* test the outputs */
/* skip value-only nodes (should be in type!) */
- if(!node_only_value(node)) {
- for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
- if(nsout[a]->data==NULL && nsout[a]->hasoutput) {
+ if (!node_only_value(node)) {
+ for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
+ if (nsout[a]->data==NULL && nsout[a]->hasoutput) {
node->need_exec= 1;
break;
}
@@ -423,18 +423,18 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
}
/* test the inputs */
- for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
+ for (a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
/* skip viewer nodes in bg render or group edit */
- if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && (G.background || group_edit))
+ if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && (G.background || group_edit))
node->need_exec= 0;
/* is sock in use? */
- else if(sock->link) {
+ else if (sock->link) {
bNodeLink *link= sock->link;
/* this is the test for a cyclic case */
- if(link->fromnode==NULL || link->tonode==NULL);
- else if(link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) {
- if(link->fromnode->need_exec) {
+ if (link->fromnode==NULL || link->tonode==NULL);
+ else if (link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) {
+ if (link->fromnode->need_exec) {
node->need_exec= 1;
break;
}
@@ -446,11 +446,11 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
}
}
- if(node->need_exec) {
+ if (node->need_exec) {
/* free output buffers */
- for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
- if(nsout[a]->data) {
+ for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
+ if (nsout[a]->data) {
free_compbuf(nsout[a]->data);
nsout[a]->data= NULL;
}
@@ -470,11 +470,11 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
/* last step: set the stack values for only-value nodes */
/* just does all now, compared to a full buffer exec this is nothing */
- if(totnode) {
- for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ if (totnode) {
+ for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
node = nodeexec->node;
- if(node->need_exec==0 && node_only_value(node)) {
- if(node->typeinfo->execfunc) {
+ if (node->need_exec==0 && node_only_value(node)) {
+ if (node->typeinfo->execfunc) {
node_get_stack(node, exec->stack, nsin, nsout);
node->typeinfo->execfunc(thd->rd, node, nsin, nsout);
}
@@ -499,28 +499,28 @@ static void freeExecutableNode(bNodeTreeExec *exec)
int n;
/* set exec flag for finished nodes that might need freed */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type!=CMP_NODE_R_LAYERS)
- if(node->exec & NODE_FINISHED)
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type!=CMP_NODE_R_LAYERS)
+ if (node->exec & NODE_FINISHED)
node->exec |= NODE_FREEBUFS;
}
/* clear this flag for input links that are not done yet.
* Using the exec data for valid dependency sort.
*/
- for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
node = nodeexec->node;
- if((node->exec & NODE_FINISHED)==0) {
- for(sock= node->inputs.first; sock; sock= sock->next)
- if(sock->link)
+ if ((node->exec & NODE_FINISHED)==0) {
+ for (sock= node->inputs.first; sock; sock= sock->next)
+ if (sock->link)
sock->link->fromnode->exec &= ~NODE_FREEBUFS;
}
}
/* now we can free buffers */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->exec & NODE_FREEBUFS) {
- for(sock= node->outputs.first; sock; sock= sock->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->exec & NODE_FREEBUFS) {
+ for (sock= node->outputs.first; sock; sock= sock->next) {
bNodeStack *ns= node_get_socket_stack(exec->stack, sock);
- if(ns && ns->data) {
+ if (ns && ns->data) {
free_compbuf(ns->data);
ns->data= NULL;
// printf("freed buf node %s \n", node->name);
@@ -536,15 +536,15 @@ static bNodeExec *getExecutableNode(bNodeTreeExec *exec)
bNodeSocket *sock;
int n;
- for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
- if(nodeexec->node->exec==0) {
+ for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ if (nodeexec->node->exec==0) {
/* input sockets should be ready */
- for(sock= nodeexec->node->inputs.first; sock; sock= sock->next) {
- if(sock->link && sock->link->fromnode)
- if((sock->link->fromnode->exec & NODE_READY)==0)
+ for (sock= nodeexec->node->inputs.first; sock; sock= sock->next) {
+ if (sock->link && sock->link->fromnode)
+ if ((sock->link->fromnode->exec & NODE_READY)==0)
break;
}
- if(sock==NULL)
+ if (sock==NULL)
return nodeexec;
}
}
@@ -556,12 +556,12 @@ static void ntree_composite_texnode(bNodeTree *ntree, int init)
{
bNode *node;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_TEXTURE && node->id) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type==CMP_NODE_TEXTURE && node->id) {
Tex *tex= (Tex *)node->id;
- if(tex->nodetree && tex->use_nodes) {
+ if (tex->nodetree && tex->use_nodes) {
/* has internal flag to detect it only does it once */
- if(init) {
+ if (init) {
if (!tex->nodetree->execdata)
tex->nodetree->execdata = ntreeTexBeginExecTree(tex->nodetree, 1);
}
@@ -584,11 +584,11 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
int totnode, curnode, rendering= 1, n;
bNodeTreeExec *exec;
- if(ntree==NULL) return;
+ if (ntree==NULL) return;
exec = ntree->execdata;
- if(do_preview)
+ if (do_preview)
ntreeInitPreview(ntree, 0, 0);
if (!ntree->execdata) {
@@ -598,7 +598,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
ntree_composite_texnode(ntree, 1);
/* prevent unlucky accidents */
- if(G.background)
+ if (G.background)
rd->scemode &= ~R_COMP_CROP;
/* setup callerdata for thread callback */
@@ -613,15 +613,15 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
BLI_init_threads(&threads, exec_composite_node, rd->threads);
- while(rendering) {
+ while (rendering) {
- if(BLI_available_threads(&threads)) {
+ if (BLI_available_threads(&threads)) {
nodeexec= getExecutableNode(exec);
- if(nodeexec) {
+ if (nodeexec) {
node = nodeexec->node;
- if(ntree->progress && totnode)
+ if (ntree->progress && totnode)
ntree->progress(ntree->prh, (1.0f - curnode/(float)totnode));
- if(ntree->stats_draw) {
+ if (ntree->stats_draw) {
char str[128];
BLI_snprintf(str, sizeof(str), "Compositing %d %s", curnode, node->name);
ntree->stats_draw(ntree->sdh, str);
@@ -640,21 +640,21 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
rendering= 0;
/* test for ESC */
- if(ntree->test_break && ntree->test_break(ntree->tbh)) {
- for(node= ntree->nodes.first; node; node= node->next)
+ if (ntree->test_break && ntree->test_break(ntree->tbh)) {
+ for (node= ntree->nodes.first; node; node= node->next)
node->exec |= NODE_READY;
}
/* check for ready ones, and if we need to continue */
- for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
node = nodeexec->node;
- if(node->exec & NODE_READY) {
- if((node->exec & NODE_FINISHED)==0) {
+ if (node->exec & NODE_READY) {
+ if ((node->exec & NODE_FINISHED)==0) {
BLI_remove_thread(&threads, nodeexec); /* this waits for running thread to finish btw */
node->exec |= NODE_FINISHED;
/* freeing unused buffers */
- if(rd->scemode & R_COMP_FREE)
+ if (rd->scemode & R_COMP_FREE)
freeExecutableNode(exec);
}
}
@@ -675,10 +675,10 @@ static void force_hidden_passes(bNode *node, int passflag)
{
bNodeSocket *sock;
- for(sock= node->outputs.first; sock; sock= sock->next)
+ for (sock= node->outputs.first; sock; sock= sock->next)
sock->flag &= ~SOCK_UNAVAIL;
- if(!(passflag & SCE_PASS_COMBINED)) {
+ if (!(passflag & SCE_PASS_COMBINED)) {
sock= BLI_findlink(&node->outputs, RRES_OUT_IMAGE);
sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_ALPHA);
@@ -686,60 +686,60 @@ static void force_hidden_passes(bNode *node, int passflag)
}
sock= BLI_findlink(&node->outputs, RRES_OUT_Z);
- if(!(passflag & SCE_PASS_Z)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_Z)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_NORMAL);
- if(!(passflag & SCE_PASS_NORMAL)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_NORMAL)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_VEC);
- if(!(passflag & SCE_PASS_VECTOR)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_VECTOR)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_UV);
- if(!(passflag & SCE_PASS_UV)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_UV)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_RGBA);
- if(!(passflag & SCE_PASS_RGBA)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_RGBA)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF);
- if(!(passflag & SCE_PASS_DIFFUSE)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_DIFFUSE)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_SPEC);
- if(!(passflag & SCE_PASS_SPEC)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_SPEC)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_SHADOW);
- if(!(passflag & SCE_PASS_SHADOW)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_SHADOW)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_AO);
- if(!(passflag & SCE_PASS_AO)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_AO)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_REFLECT);
- if(!(passflag & SCE_PASS_REFLECT)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_REFLECT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_REFRACT);
- if(!(passflag & SCE_PASS_REFRACT)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_REFRACT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_INDIRECT);
- if(!(passflag & SCE_PASS_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXOB);
- if(!(passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXMA);
- if(!(passflag & SCE_PASS_INDEXMA)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_INDEXMA)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_MIST);
- if(!(passflag & SCE_PASS_MIST)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_MIST)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_EMIT);
- if(!(passflag & SCE_PASS_EMIT)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_EMIT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_ENV);
- if(!(passflag & SCE_PASS_ENVIRONMENT)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_ENVIRONMENT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_DIRECT);
- if(!(passflag & SCE_PASS_DIFFUSE_DIRECT)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_DIFFUSE_DIRECT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_INDIRECT);
- if(!(passflag & SCE_PASS_DIFFUSE_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_DIFFUSE_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_COLOR);
- if(!(passflag & SCE_PASS_DIFFUSE_COLOR)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_DIFFUSE_COLOR)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_DIRECT);
- if(!(passflag & SCE_PASS_GLOSSY_DIRECT)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_GLOSSY_DIRECT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_INDIRECT);
- if(!(passflag & SCE_PASS_GLOSSY_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_GLOSSY_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_COLOR);
- if(!(passflag & SCE_PASS_GLOSSY_COLOR)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_GLOSSY_COLOR)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_DIRECT);
- if(!(passflag & SCE_PASS_TRANSM_DIRECT)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_TRANSM_DIRECT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_INDIRECT);
- if(!(passflag & SCE_PASS_TRANSM_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_TRANSM_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_COLOR);
- if(!(passflag & SCE_PASS_TRANSM_COLOR)) sock->flag |= SOCK_UNAVAIL;
+ if (!(passflag & SCE_PASS_TRANSM_COLOR)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_COLOR);
}
@@ -748,27 +748,27 @@ void ntreeCompositForceHidden(bNodeTree *ntree, Scene *curscene)
{
bNode *node;
- if(ntree==NULL) return;
+ if (ntree==NULL) return;
- for(node= ntree->nodes.first; node; node= node->next) {
- if( node->type==CMP_NODE_R_LAYERS) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if ( node->type==CMP_NODE_R_LAYERS) {
Scene *sce= node->id?(Scene *)node->id:curscene;
SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
- if(srl)
+ if (srl)
force_hidden_passes(node, srl->passflag);
}
- else if( node->type==CMP_NODE_IMAGE) {
+ else if ( node->type==CMP_NODE_IMAGE) {
Image *ima= (Image *)node->id;
- if(ima) {
- if(ima->rr) {
+ if (ima) {
+ if (ima->rr) {
ImageUser *iuser= node->storage;
RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
- if(rl)
+ if (rl)
force_hidden_passes(node, rl->passflag);
else
force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
}
- else if(ima->type!=IMA_TYPE_MULTILAYER) { /* if ->rr not yet read we keep inputs */
+ else if (ima->type!=IMA_TYPE_MULTILAYER) { /* if ->rr not yet read we keep inputs */
force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA|RRES_OUT_Z);
}
else
@@ -787,14 +787,14 @@ void ntreeCompositTagRender(Scene *curscene)
{
Scene *sce;
- for(sce= G.main->scene.first; sce; sce= sce->id.next) {
- if(sce->nodetree) {
+ for (sce= G.main->scene.first; sce; sce= sce->id.next) {
+ if (sce->nodetree) {
bNode *node;
- for(node= sce->nodetree->nodes.first; node; node= node->next) {
- if(node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE)
+ for (node= sce->nodetree->nodes.first; node; node= node->next) {
+ if (node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE)
nodeUpdate(sce->nodetree, node);
- else if(node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */
+ else if (node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */
nodeUpdate(sce->nodetree, node);
}
}
@@ -856,31 +856,31 @@ int ntreeCompositTagAnimated(bNodeTree *ntree)
bNode *node;
int tagged= 0;
- if(ntree==NULL) return 0;
+ if (ntree==NULL) return 0;
- for(node= ntree->nodes.first; node; node= node->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
tagged = node_animation_properties(ntree, node);
/* otherwise always tag these node types */
- if(node->type==CMP_NODE_IMAGE) {
+ if (node->type==CMP_NODE_IMAGE) {
Image *ima= (Image *)node->id;
- if(ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ if (ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
nodeUpdate(ntree, node);
tagged= 1;
}
}
- else if(node->type==CMP_NODE_TIME) {
+ else if (node->type==CMP_NODE_TIME) {
nodeUpdate(ntree, node);
tagged= 1;
}
/* here was tag render layer, but this is called after a render, so re-composites fail */
- else if(node->type==NODE_GROUP) {
- if( ntreeCompositTagAnimated((bNodeTree *)node->id) ) {
+ else if (node->type==NODE_GROUP) {
+ if ( ntreeCompositTagAnimated((bNodeTree *)node->id) ) {
nodeUpdate(ntree, node);
}
}
- else if(ELEM(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_TRANSFORM)) {
+ else if (ELEM(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_TRANSFORM)) {
nodeUpdate(ntree, node);
tagged= 1;
}
@@ -895,10 +895,10 @@ void ntreeCompositTagGenerators(bNodeTree *ntree)
{
bNode *node;
- if(ntree==NULL) return;
+ if (ntree==NULL) return;
- for(node= ntree->nodes.first; node; node= node->next) {
- if( ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE))
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if ( ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE))
nodeUpdate(ntree, node);
}
}
@@ -908,11 +908,11 @@ void ntreeCompositClearTags(bNodeTree *ntree)
{
bNode *node;
- if(ntree==NULL) return;
+ if (ntree==NULL) return;
- for(node= ntree->nodes.first; node; node= node->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
node->need_exec= 0;
- if(node->type==NODE_GROUP)
+ if (node->type==NODE_GROUP)
ntreeCompositClearTags((bNodeTree *)node->id);
}
}
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index f51cd008904..8e98c055157 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -42,21 +42,21 @@ CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc)
cbuf->yrad= sizey/2;
cbuf->type= type;
- if(alloc) {
- if(cbuf->type==CB_RGBA)
+ if (alloc) {
+ if (cbuf->type==CB_RGBA)
cbuf->rect= MEM_mapallocN(4*sizeof(float)*sizex*sizey, "compbuf RGBA rect");
- else if(cbuf->type==CB_VEC3)
+ else if (cbuf->type==CB_VEC3)
cbuf->rect= MEM_mapallocN(3*sizeof(float)*sizex*sizey, "compbuf Vector3 rect");
- else if(cbuf->type==CB_VEC2)
+ else if (cbuf->type==CB_VEC2)
cbuf->rect= MEM_mapallocN(2*sizeof(float)*sizex*sizey, "compbuf Vector2 rect");
else
cbuf->rect= MEM_mapallocN(sizeof(float)*sizex*sizey, "compbuf Fac rect");
cbuf->malloc= 1;
}
- cbuf->disprect.xmin= 0;
- cbuf->disprect.ymin= 0;
- cbuf->disprect.xmax= sizex;
- cbuf->disprect.ymax= sizey;
+ cbuf->disprect.xmin = 0;
+ cbuf->disprect.ymin = 0;
+ cbuf->disprect.xmax = sizex;
+ cbuf->disprect.ymax = sizey;
return cbuf;
}
@@ -64,7 +64,7 @@ CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc)
CompBuf *dupalloc_compbuf(CompBuf *cbuf)
{
CompBuf *dupbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1);
- if(dupbuf) {
+ if (dupbuf) {
memcpy(dupbuf->rect, cbuf->rect, cbuf->type*sizeof(float)*cbuf->x*cbuf->y);
dupbuf->xof= cbuf->xof;
@@ -79,15 +79,15 @@ CompBuf *pass_on_compbuf(CompBuf *cbuf)
CompBuf *dupbuf= (cbuf)? alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 0): NULL;
CompBuf *lastbuf;
- if(dupbuf) {
+ if (dupbuf) {
dupbuf->rect= cbuf->rect;
dupbuf->xof= cbuf->xof;
dupbuf->yof= cbuf->yof;
dupbuf->malloc= 0;
/* get last buffer in list, and append dupbuf */
- for(lastbuf= cbuf; lastbuf; lastbuf= lastbuf->next)
- if(lastbuf->next==NULL)
+ for (lastbuf= cbuf; lastbuf; lastbuf= lastbuf->next)
+ if (lastbuf->next==NULL)
break;
lastbuf->next= dupbuf;
dupbuf->prev= lastbuf;
@@ -99,13 +99,13 @@ CompBuf *pass_on_compbuf(CompBuf *cbuf)
void free_compbuf(CompBuf *cbuf)
{
/* check referencing, then remove from list and set malloc tag */
- if(cbuf->prev || cbuf->next) {
- if(cbuf->prev)
+ if (cbuf->prev || cbuf->next) {
+ if (cbuf->prev)
cbuf->prev->next= cbuf->next;
- if(cbuf->next)
+ if (cbuf->next)
cbuf->next->prev= cbuf->prev;
- if(cbuf->malloc) {
- if(cbuf->prev)
+ if (cbuf->malloc) {
+ if (cbuf->prev)
cbuf->prev->malloc= 1;
else
cbuf->next->malloc= 1;
@@ -113,7 +113,7 @@ void free_compbuf(CompBuf *cbuf)
}
}
- if(cbuf->malloc && cbuf->rect)
+ if (cbuf->malloc && cbuf->rect)
MEM_freeN(cbuf->rect);
MEM_freeN(cbuf);
@@ -138,16 +138,16 @@ CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, in
float *outfp;
int dx, y;
- if(disprect.xmax>rectx) disprect.xmax= rectx;
- if(disprect.ymax>recty) disprect.ymax= recty;
- if(disprect.xmin>= disprect.xmax) return NULL;
- if(disprect.ymin>= disprect.ymax) return NULL;
+ if (disprect.xmax>rectx) disprect.xmax = rectx;
+ if (disprect.ymax>recty) disprect.ymax = recty;
+ if (disprect.xmin>= disprect.xmax) return NULL;
+ if (disprect.ymin>= disprect.ymax) return NULL;
cbuf= alloc_compbuf(disprect.xmax-disprect.xmin, disprect.ymax-disprect.ymin, type, 1);
outfp= cbuf->rect;
rectf += type*(disprect.ymin*rectx + disprect.xmin);
dx= type*cbuf->x;
- for(y=cbuf->y; y>0; y--, outfp+=dx, rectf+=type*rectx)
+ for (y=cbuf->y; y>0; y--, outfp+=dx, rectf+=type*rectx)
memcpy(outfp, rectf, sizeof(float)*dx);
return cbuf;
@@ -160,7 +160,7 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy)
int x, y, c, pixsize= inbuf->type;
int ofsx, ofsy, stepx, stepy;
- if(inbuf->x==newx && inbuf->y==newy)
+ if (inbuf->x==newx && inbuf->y==newy)
return dupalloc_compbuf(inbuf);
outbuf= alloc_compbuf(newx, newy, inbuf->type, 1);
@@ -170,7 +170,7 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy)
stepy = (65536.0 * (inbuf->y - 1.0) / (newy - 1.0)) + 0.5;
ofsy = 32768;
- for (y = newy; y > 0 ; y--){
+ for (y = newy; y > 0 ; y--) {
rectf = inbuf->rect;
rectf += pixsize * (ofsy >> 16) * inbuf->x;
@@ -180,7 +180,7 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy)
for (x = newx ; x>0 ; x--) {
rf= rectf + pixsize*(ofsx >> 16);
- for(c=0; c<pixsize; c++)
+ for (c=0; c<pixsize; c++)
newrectf[c] = rf[c];
newrectf+= pixsize;
@@ -194,65 +194,65 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy)
void typecheck_compbuf_color(float *out, float *in, int outtype, int intype)
{
- if(intype == outtype) {
+ if (intype == outtype) {
memcpy(out, in, sizeof(float)*outtype);
}
- else if(outtype==CB_VAL) {
- if(intype==CB_VEC2) {
+ else if (outtype==CB_VAL) {
+ if (intype==CB_VEC2) {
*out= 0.5f*(in[0]+in[1]);
}
- else if(intype==CB_VEC3) {
+ else if (intype==CB_VEC3) {
*out= 0.333333f*(in[0]+in[1]+in[2]);
}
- else if(intype==CB_RGBA) {
+ else if (intype==CB_RGBA) {
*out= in[0]*0.35f + in[1]*0.45f + in[2]*0.2f;
}
}
- else if(outtype==CB_VEC2) {
- if(intype==CB_VAL) {
+ else if (outtype==CB_VEC2) {
+ if (intype==CB_VAL) {
out[0]= in[0];
out[1]= in[0];
}
- else if(intype==CB_VEC3) {
+ else if (intype==CB_VEC3) {
out[0]= in[0];
out[1]= in[1];
}
- else if(intype==CB_RGBA) {
+ else if (intype==CB_RGBA) {
out[0]= in[0];
out[1]= in[1];
}
}
- else if(outtype==CB_VEC3) {
- if(intype==CB_VAL) {
+ else if (outtype==CB_VEC3) {
+ if (intype==CB_VAL) {
out[0]= in[0];
out[1]= in[0];
out[2]= in[0];
}
- else if(intype==CB_VEC2) {
+ else if (intype==CB_VEC2) {
out[0]= in[0];
out[1]= in[1];
out[2]= 0.0f;
}
- else if(intype==CB_RGBA) {
+ else if (intype==CB_RGBA) {
out[0]= in[0];
out[1]= in[1];
out[2]= in[2];
}
}
- else if(outtype==CB_RGBA) {
- if(intype==CB_VAL) {
+ else if (outtype==CB_RGBA) {
+ if (intype==CB_VAL) {
out[0]= in[0];
out[1]= in[0];
out[2]= in[0];
out[3]= 1.0f;
}
- else if(intype==CB_VEC2) {
+ else if (intype==CB_VEC2) {
out[0]= in[0];
out[1]= in[1];
out[2]= 0.0f;
out[3]= 1.0f;
}
- else if(intype==CB_VEC3) {
+ else if (intype==CB_VEC3) {
out[0]= in[0];
out[1]= in[1];
out[2]= in[2];
@@ -263,7 +263,7 @@ void typecheck_compbuf_color(float *out, float *in, int outtype, int intype)
CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
{
- if(inbuf && inbuf->type!=type) {
+ if (inbuf && inbuf->type!=type) {
CompBuf *outbuf;
float *inrf, *outrf;
int x;
@@ -274,7 +274,7 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
outbuf->xof= inbuf->xof;
outbuf->yof= inbuf->yof;
- if(inbuf->rect_procedural) {
+ if (inbuf->rect_procedural) {
outbuf->rect_procedural= inbuf->rect_procedural;
copy_v3_v3(outbuf->procedural_size, inbuf->procedural_size);
copy_v3_v3(outbuf->procedural_offset, inbuf->procedural_offset);
@@ -287,82 +287,82 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
outrf= outbuf->rect;
x= inbuf->x*inbuf->y;
- if(type==CB_VAL) {
- if(inbuf->type==CB_VEC2) {
- for(; x>0; x--, outrf+= 1, inrf+= 2)
+ if (type==CB_VAL) {
+ if (inbuf->type==CB_VEC2) {
+ for (; x>0; x--, outrf+= 1, inrf+= 2)
*outrf= 0.5f*(inrf[0]+inrf[1]);
}
- else if(inbuf->type==CB_VEC3) {
- for(; x>0; x--, outrf+= 1, inrf+= 3)
+ else if (inbuf->type==CB_VEC3) {
+ for (; x>0; x--, outrf+= 1, inrf+= 3)
*outrf= 0.333333f*(inrf[0]+inrf[1]+inrf[2]);
}
- else if(inbuf->type==CB_RGBA) {
- for(; x>0; x--, outrf+= 1, inrf+= 4)
+ else if (inbuf->type==CB_RGBA) {
+ for (; x>0; x--, outrf+= 1, inrf+= 4)
*outrf= inrf[0]*0.35f + inrf[1]*0.45f + inrf[2]*0.2f;
}
}
- else if(type==CB_VEC2) {
- if(inbuf->type==CB_VAL) {
- for(; x>0; x--, outrf+= 2, inrf+= 1) {
+ else if (type==CB_VEC2) {
+ if (inbuf->type==CB_VAL) {
+ for (; x>0; x--, outrf+= 2, inrf+= 1) {
outrf[0]= inrf[0];
outrf[1]= inrf[0];
}
}
- else if(inbuf->type==CB_VEC3) {
- for(; x>0; x--, outrf+= 2, inrf+= 3) {
+ else if (inbuf->type==CB_VEC3) {
+ for (; x>0; x--, outrf+= 2, inrf+= 3) {
outrf[0]= inrf[0];
outrf[1]= inrf[1];
}
}
- else if(inbuf->type==CB_RGBA) {
- for(; x>0; x--, outrf+= 2, inrf+= 4) {
+ else if (inbuf->type==CB_RGBA) {
+ for (; x>0; x--, outrf+= 2, inrf+= 4) {
outrf[0]= inrf[0];
outrf[1]= inrf[1];
}
}
}
- else if(type==CB_VEC3) {
- if(inbuf->type==CB_VAL) {
- for(; x>0; x--, outrf+= 3, inrf+= 1) {
+ else if (type==CB_VEC3) {
+ if (inbuf->type==CB_VAL) {
+ for (; x>0; x--, outrf+= 3, inrf+= 1) {
outrf[0]= inrf[0];
outrf[1]= inrf[0];
outrf[2]= inrf[0];
}
}
- else if(inbuf->type==CB_VEC2) {
- for(; x>0; x--, outrf+= 3, inrf+= 2) {
+ else if (inbuf->type==CB_VEC2) {
+ for (; x>0; x--, outrf+= 3, inrf+= 2) {
outrf[0]= inrf[0];
outrf[1]= inrf[1];
outrf[2]= 0.0f;
}
}
- else if(inbuf->type==CB_RGBA) {
- for(; x>0; x--, outrf+= 3, inrf+= 4) {
+ else if (inbuf->type==CB_RGBA) {
+ for (; x>0; x--, outrf+= 3, inrf+= 4) {
outrf[0]= inrf[0];
outrf[1]= inrf[1];
outrf[2]= inrf[2];
}
}
}
- else if(type==CB_RGBA) {
- if(inbuf->type==CB_VAL) {
- for(; x>0; x--, outrf+= 4, inrf+= 1) {
+ else if (type==CB_RGBA) {
+ if (inbuf->type==CB_VAL) {
+ for (; x>0; x--, outrf+= 4, inrf+= 1) {
outrf[0]= inrf[0];
outrf[1]= inrf[0];
outrf[2]= inrf[0];
outrf[3]= 1.0f;
}
}
- else if(inbuf->type==CB_VEC2) {
- for(; x>0; x--, outrf+= 4, inrf+= 2) {
+ else if (inbuf->type==CB_VEC2) {
+ for (; x>0; x--, outrf+= 4, inrf+= 2) {
outrf[0]= inrf[0];
outrf[1]= inrf[1];
outrf[2]= 0.0f;
outrf[3]= 1.0f;
}
}
- else if(inbuf->type==CB_VEC3) {
- for(; x>0; x--, outrf+= 4, inrf+= 3) {
+ else if (inbuf->type==CB_VEC3) {
+ for (; x>0; x--, outrf+= 4, inrf+= 3) {
outrf[0]= inrf[0];
outrf[1]= inrf[1];
outrf[2]= inrf[2];
@@ -378,8 +378,8 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y, int xrad, int yrad)
{
- if(cbuf) {
- if(cbuf->rect_procedural) {
+ if (cbuf) {
+ if (cbuf->rect_procedural) {
cbuf->rect_procedural(cbuf, use, (float)x/(float)xrad, (float)y/(float)yrad);
return use;
}
@@ -390,8 +390,8 @@ float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y,
x-= cbuf->xof;
y-= cbuf->yof;
- if(y<-cbuf->yrad || y>= -cbuf->yrad+cbuf->y) return col;
- if(x<-cbuf->xrad || x>= -cbuf->xrad+cbuf->x) return col;
+ if (y<-cbuf->yrad || y>= -cbuf->yrad+cbuf->y) return col;
+ if (x<-cbuf->xrad || x>= -cbuf->xrad+cbuf->x) return col;
return cbuf->rect + cbuf->type*( (cbuf->yrad+y)*cbuf->x + (cbuf->xrad+x) );
}
@@ -407,7 +407,7 @@ static CompBuf *composit_check_compbuf(CompBuf *cbuf, int type, CompBuf *outbuf)
CompBuf *dbuf= typecheck_compbuf(cbuf, type);
/* if same as output and translated, duplicate so pixels don't interfere */
- if(dbuf == outbuf && !dbuf->rect_procedural && (dbuf->xof || dbuf->yof))
+ if (dbuf == outbuf && !dbuf->rect_procedural && (dbuf->xof || dbuf->yof))
dbuf= dupalloc_compbuf(dbuf);
return dbuf;
@@ -428,14 +428,14 @@ void composit1_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa
xrad= out->xrad;
yrad= out->yrad;
- for(y= -yrad; y<-yrad+out->y; y++) {
- for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
+ for (y= -yrad; y<-yrad+out->y; y++) {
+ for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad);
func(node, outfp, srcfp);
}
}
- if(src_use!=src_buf)
+ if (src_use!=src_buf)
free_compbuf(src_use);
}
@@ -455,17 +455,17 @@ void composit2_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa
xrad= out->xrad;
yrad= out->yrad;
- for(y= -yrad; y<-yrad+out->y; y++) {
- for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
+ for (y= -yrad; y<-yrad+out->y; y++) {
+ for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad);
facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad);
func(node, outfp, srcfp, facfp);
}
}
- if(src_use!=src_buf)
+ if (src_use!=src_buf)
free_compbuf(src_use);
- if(fac_use!=fac_buf)
+ if (fac_use!=fac_buf)
free_compbuf(fac_use);
}
@@ -486,8 +486,8 @@ void composit3_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo
xrad= out->xrad;
yrad= out->yrad;
- for(y= -yrad; y<-yrad+out->y; y++) {
- for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
+ for (y= -yrad; y<-yrad+out->y; y++) {
+ for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad);
src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad);
facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad);
@@ -496,11 +496,11 @@ void composit3_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo
}
}
- if(src1_use!=src1_buf)
+ if (src1_use!=src1_buf)
free_compbuf(src1_use);
- if(src2_use!=src2_buf)
+ if (src2_use!=src2_buf)
free_compbuf(src2_use);
- if(fac_use!=fac_buf)
+ if (fac_use!=fac_buf)
free_compbuf(fac_use);
}
@@ -523,8 +523,8 @@ void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo
xrad= out->xrad;
yrad= out->yrad;
- for(y= -yrad; y<-yrad+out->y; y++) {
- for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
+ for (y= -yrad; y<-yrad+out->y; y++) {
+ for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad);
src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad);
fac1fp= compbuf_get_pixel(fac1_use, fac1, color, x, y, xrad, yrad);
@@ -534,13 +534,13 @@ void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo
}
}
- if(src1_use!=src1_buf)
+ if (src1_use!=src1_buf)
free_compbuf(src1_use);
- if(src2_use!=src2_buf)
+ if (src2_use!=src2_buf)
free_compbuf(src2_use);
- if(fac1_use!=fac1_buf)
+ if (fac1_use!=fac1_buf)
free_compbuf(fac1_use);
- if(fac2_use!=fac2_buf)
+ if (fac2_use!=fac2_buf)
free_compbuf(fac2_use);
}
@@ -562,7 +562,7 @@ CompBuf *valbuf_from_rgbabuf(CompBuf *cbuf, int channel)
rectf= cbuf->rect + channel;
- for(tot= cbuf->x*cbuf->y; tot>0; tot--, valf++, rectf+=4)
+ for (tot= cbuf->x*cbuf->y; tot>0; tot--, valf++, rectf+=4)
*valf= *rectf;
return valbuf;
@@ -580,8 +580,8 @@ static CompBuf *generate_procedural_preview(CompBuf *cbuf, int newx, int newy)
xrad= outbuf->xrad;
yrad= outbuf->yrad;
- for(y= -yrad; y<-yrad+outbuf->y; y++)
- for(x= -xrad; x<-xrad+outbuf->x; x++, outfp+=outbuf->type)
+ for (y= -yrad; y<-yrad+outbuf->y; y++)
+ for (x= -xrad; x<-xrad+outbuf->x; x++, outfp+=outbuf->type)
cbuf->rect_procedural(cbuf, outfp, (float)x/(float)xrad, (float)y/(float)yrad);
return outbuf;
@@ -597,14 +597,14 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
int dither= 0;
unsigned char *rect;
- if(preview && stackbuf) {
+ if (preview && stackbuf) {
CompBuf *cbuf, *stackbuf_use;
- if(stackbuf->rect==NULL && stackbuf->rect_procedural==NULL) return;
+ if (stackbuf->rect==NULL && stackbuf->rect_procedural==NULL) return;
stackbuf_use= typecheck_compbuf(stackbuf, CB_RGBA);
- if(stackbuf->x > stackbuf->y) {
+ if (stackbuf->x > stackbuf->y) {
xsize= 140;
ysize= (140*stackbuf->y)/stackbuf->x;
}
@@ -613,7 +613,7 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
xsize= (140*stackbuf->x)/stackbuf->y;
}
- if(stackbuf_use->rect_procedural)
+ if (stackbuf_use->rect_procedural)
cbuf= generate_procedural_preview(stackbuf_use, xsize, ysize);
else
cbuf= scalefast_compbuf(stackbuf_use, xsize, ysize);
@@ -626,12 +626,12 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
xsize, ysize, xsize, xsize);
free_compbuf(cbuf);
- if(stackbuf_use!=stackbuf)
+ if (stackbuf_use!=stackbuf)
free_compbuf(stackbuf_use);
BLI_lock_thread(LOCK_PREVIEW);
- if(preview->rect)
+ if (preview->rect)
MEM_freeN(preview->rect);
preview->xsize= xsize;
preview->ysize= ysize;
@@ -705,21 +705,21 @@ void gamma_correct_compbuf(CompBuf *img, int inversed)
float *drect;
int x;
- if(img->type!=CB_RGBA) return;
+ if (img->type!=CB_RGBA) return;
drect= img->rect;
- if(inversed) {
- for(x=img->x*img->y; x>0; x--, drect+=4) {
- if(drect[0]>0.0f) drect[0]= sqrt(drect[0]); else drect[0]= 0.0f;
- if(drect[1]>0.0f) drect[1]= sqrt(drect[1]); else drect[1]= 0.0f;
- if(drect[2]>0.0f) drect[2]= sqrt(drect[2]); else drect[2]= 0.0f;
+ if (inversed) {
+ for (x=img->x*img->y; x>0; x--, drect+=4) {
+ if (drect[0]>0.0f) drect[0]= sqrt(drect[0]); else drect[0]= 0.0f;
+ if (drect[1]>0.0f) drect[1]= sqrt(drect[1]); else drect[1]= 0.0f;
+ if (drect[2]>0.0f) drect[2]= sqrt(drect[2]); else drect[2]= 0.0f;
}
}
else {
- for(x=img->x*img->y; x>0; x--, drect+=4) {
- if(drect[0]>0.0f) drect[0]*= drect[0]; else drect[0]= 0.0f;
- if(drect[1]>0.0f) drect[1]*= drect[1]; else drect[1]= 0.0f;
- if(drect[2]>0.0f) drect[2]*= drect[2]; else drect[2]= 0.0f;
+ for (x=img->x*img->y; x>0; x--, drect+=4) {
+ if (drect[0]>0.0f) drect[0]*= drect[0]; else drect[0]= 0.0f;
+ if (drect[1]>0.0f) drect[1]*= drect[1]; else drect[1]= 0.0f;
+ if (drect[2]>0.0f) drect[2]*= drect[2]; else drect[2]= 0.0f;
}
}
}
@@ -729,12 +729,12 @@ void premul_compbuf(CompBuf *img, int inversed)
float *drect;
int x;
- if(img->type!=CB_RGBA) return;
+ if (img->type!=CB_RGBA) return;
drect= img->rect;
- if(inversed) {
- for(x=img->x*img->y; x>0; x--, drect+=4) {
- if(fabsf(drect[3]) < 1e-5f) {
+ if (inversed) {
+ for (x=img->x*img->y; x>0; x--, drect+=4) {
+ if (fabsf(drect[3]) < 1e-5f) {
drect[0]= 0.0f;
drect[1]= 0.0f;
drect[2]= 0.0f;
@@ -747,7 +747,7 @@ void premul_compbuf(CompBuf *img, int inversed)
}
}
else {
- for(x=img->x*img->y; x>0; x--, drect+=4) {
+ for (x=img->x*img->y; x>0; x--, drect+=4) {
drect[0] *= drect[3];
drect[1] *= drect[3];
drect[2] *= drect[3];
@@ -1104,11 +1104,11 @@ void convolve(CompBuf* dst, CompBuf* in1, CompBuf* in2)
// sets fcol to pixelcolor at (x, y)
void qd_getPixel(CompBuf* src, int x, int y, float* col)
{
- if(src->rect_procedural) {
+ if (src->rect_procedural) {
float bc[4];
src->rect_procedural(src, bc, (float)x/(float)src->xrad, (float)y/(float)src->yrad);
- switch(src->type){
+ switch(src->type) {
/* these fallthrough to get all the channels */
case CB_RGBA: col[3]=bc[3];
case CB_VEC3: col[2]=bc[2];
@@ -1118,7 +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];
@@ -1127,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;
@@ -1142,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_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index 3a783f0f32d..5a716e18660 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -48,10 +48,10 @@ static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, flo
{
/* Zero alpha values should still permit an add of RGB data */
- if(over[3]<0.0f) {
+ if (over[3]<0.0f) {
copy_v4_v4(out, src);
}
- else if(fac[0]==1.0f && over[3]>=1.0f) {
+ else if (fac[0]==1.0f && over[3]>=1.0f) {
copy_v4_v4(out, over);
}
else {
@@ -68,10 +68,10 @@ static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, flo
static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
{
- if(over[3]<=0.0f) {
+ if (over[3]<=0.0f) {
copy_v4_v4(out, src);
}
- else if(fac[0]==1.0f && over[3]>=1.0f) {
+ else if (fac[0]==1.0f && over[3]>=1.0f) {
copy_v4_v4(out, over);
}
else {
@@ -89,10 +89,10 @@ static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float
static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over, float *fac)
{
- if(over[3]<=0.0f) {
+ if (over[3]<=0.0f) {
copy_v4_v4(out, src);
}
- else if(fac[0]==1.0f && over[3]>=1.0f) {
+ else if (fac[0]==1.0f && over[3]>=1.0f) {
copy_v4_v4(out, over);
}
else {
@@ -115,11 +115,11 @@ static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeS
{
/* stack order in: col col */
/* stack order out: col */
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
/* input no image? then only color operation */
- if(in[1]->data==NULL && in[2]->data==NULL) {
+ if (in[1]->data==NULL && in[2]->data==NULL) {
do_alphaover_premul(node, out[0]->vec, in[1]->vec, in[2]->vec, in[0]->vec);
}
else {
@@ -128,9 +128,9 @@ static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeS
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
NodeTwoFloats *ntf= node->storage;
- if(ntf->x != 0.0f)
+ if (ntf->x != 0.0f)
composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_mixed, CB_RGBA, CB_RGBA, CB_VAL);
- else if(node->custom1)
+ else if (node->custom1)
composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_key, CB_RGBA, CB_RGBA, CB_VAL);
else
composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_premul, CB_RGBA, CB_RGBA, CB_VAL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
index fe359372270..8faa060244a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
@@ -102,10 +102,10 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
int deltas[8];
short found_determinator= 0;
- if(img == NULL || out[0]->hasoutput == 0)
+ if (img == NULL || out[0]->hasoutput == 0)
return;
- if(img->type != CB_RGBA) {
+ if (img->type != CB_RGBA) {
img= typecheck_compbuf(in[0]->data, CB_RGBA);
}
@@ -114,9 +114,9 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
pix= img->type;
step= pix * imgx;
- if(refimg) {
- if(refimg->x == imgx && refimg->y == imgy) {
- if(ELEM3(refimg->type, CB_VAL, CB_VEC2, CB_VEC3)) {
+ if (refimg) {
+ if (refimg->x == imgx && refimg->y == imgy) {
+ if (ELEM3(refimg->type, CB_VAL, CB_VEC2, CB_VEC3)) {
refimg= typecheck_compbuf(in[1]->data, CB_RGBA);
found_determinator= 1;
}
@@ -147,23 +147,23 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
weight_tab[1] = weight_tab[3] = weight_tab[5] = weight_tab[7] = i2sigma_space * 2;
/* iterations */
- for(i= 0; i < nbbd->iter; i++) {
+ for (i= 0; i < nbbd->iter; i++) {
src= source->rect;
ref= refimg->rect;
dest= new->rect;
/*goes through image, there are more loops for 1st/last line and all other lines*/
/*kernel element accumulates surrounding colors, which are then written with the update_output function*/
- for(x= 0; x < imgx; x++, src+= pix, ref+= pix) {
+ for (x= 0; x < imgx; x++, src+= pix, ref+= pix) {
INIT_C3;
KERNEL_ELEMENT_C3(6);
- if(x > 0) {
+ if (x > 0) {
KERNEL_ELEMENT_C3(5);
KERNEL_ELEMENT_C3(4);
}
- if(x < imgx - 1) {
+ if (x < imgx - 1) {
KERNEL_ELEMENT_C3(7);
KERNEL_ELEMENT_C3(0);
}
@@ -173,7 +173,7 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
dest+= step;
- for(y= 1; y < imgy - 1; y++, dest+= step, src+= pix, ref+= pix) {
+ for (y= 1; y < imgy - 1; y++, dest+= step, src+= pix, ref+= pix) {
x= 0;
INIT_C3;
@@ -189,7 +189,7 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
src+= pix;
ref+= pix;
- for(x= 1; x < imgx - 1; x++, src+= pix, ref+= pix) {
+ for (x= 1; x < imgx - 1; x++, src+= pix, ref+= pix) {
INIT_C3;
KERNEL_ELEMENT_C3(0);
@@ -215,16 +215,16 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
UPDATE_OUTPUT_C3;
}
- for(x= 0; x < imgx; x++, src+= pix, ref+= pix) {
+ for (x= 0; x < imgx; x++, src+= pix, ref+= pix) {
INIT_C3;
KERNEL_ELEMENT_C3(2);
- if(x > 0) {
+ if (x > 0) {
KERNEL_ELEMENT_C3(3);
KERNEL_ELEMENT_C3(4);
}
- if(x < imgx - 1) {
+ if (x < imgx - 1) {
KERNEL_ELEMENT_C3(1);
KERNEL_ELEMENT_C3(0);
}
@@ -232,16 +232,16 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
UPDATE_OUTPUT_C3;
}
- if(node->exec & NODE_BREAK) break;
+ if (node->exec & NODE_BREAK) break;
SWAP(CompBuf, *source, *new);
}
- if(img != in[0]->data)
+ if (img != in[0]->data)
free_compbuf(img);
- if(found_determinator == 1) {
- if(refimg != in[1]->data)
+ if (found_determinator == 1) {
+ if (refimg != in[1]->data)
free_compbuf(refimg);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c
index fad80723ca3..354bb458ea9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_blur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_blur.c
@@ -61,7 +61,7 @@ static float *make_gausstab(int filtertype, int rad)
}
sum= 1.0f/sum;
- for(i=0; i<n; i++)
+ for (i=0; i<n; i++)
gausstab[i]*= sum;
return gausstab;
@@ -101,14 +101,14 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
work= alloc_compbuf(imgx, imgy, img->type, 1); /* allocs */
/* horizontal */
- if(nbd->sizex == 0) {
+ if (nbd->sizex == 0) {
memcpy(work->rect, img->rect, sizeof(float) * img->type * imgx * imgy);
}
else {
rad = scale*(float)nbd->sizex;
- if(rad>imgx/2)
+ if (rad>imgx/2)
rad= imgx/2;
- else if(rad<1)
+ else if (rad<1)
rad= 1;
gausstab= make_gausstab(nbd->filtertype, rad);
@@ -130,7 +130,7 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
val= gausstabcent[i];
sum+= val;
rval += val * (*src++);
- if(pix==4) {
+ if (pix==4) {
gval += val * (*src++);
bval += val * (*src++);
aval += val * (*src++);
@@ -138,13 +138,13 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
}
sum= 1.0f/sum;
*dest++ = rval*sum;
- if(pix==4) {
+ if (pix==4) {
*dest++ = gval*sum;
*dest++ = bval*sum;
*dest++ = aval*sum;
}
}
- if(node->exec & NODE_BREAK)
+ if (node->exec & NODE_BREAK)
break;
}
@@ -152,14 +152,14 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
MEM_freeN(gausstab);
}
- if(nbd->sizey == 0) {
+ if (nbd->sizey == 0) {
memcpy(new->rect, work->rect, sizeof(float) * img->type * imgx * imgy);
}
else {
rad = scale*(float)nbd->sizey;
- if(rad>imgy/2)
+ if (rad>imgy/2)
rad= imgy/2;
- else if(rad<1)
+ else if (rad<1)
rad= 1;
gausstab= make_gausstab(nbd->filtertype, rad);
@@ -182,7 +182,7 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
val= gausstabcent[i];
sum+= val;
rval += val * src[0];
- if(pix==4) {
+ if (pix==4) {
gval += val * src[1];
bval += val * src[2];
aval += val * src[3];
@@ -191,14 +191,14 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
}
sum= 1.0f/sum;
dest[0] = rval*sum;
- if(pix==4) {
+ if (pix==4) {
dest[1] = gval*sum;
dest[2] = bval*sum;
dest[3] = aval*sum;
}
dest+= bigstep;
}
- if(node->exec & NODE_BREAK)
+ if (node->exec & NODE_BREAK)
break;
}
MEM_freeN(gausstab);
@@ -225,21 +225,21 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref
/* horizontal */
radx = (float)nbd->sizex;
- if(radx>imgx/2)
+ if (radx>imgx/2)
radx= imgx/2;
- else if(radx<1)
+ else if (radx<1)
radx= 1;
/* vertical */
rady = (float)nbd->sizey;
- if(rady>imgy/2)
+ if (rady>imgy/2)
rady= imgy/2;
- else if(rady<1)
+ else if (rady<1)
rady= 1;
x= MAX2(radx, rady);
maintabs= MEM_mallocN(x*sizeof(void *), "gauss array");
- for(i= 0; i<x; i++)
+ for (i= 0; i<x; i++)
maintabs[i]= make_bloomtab(i+1);
/* vars to store before we go */
@@ -258,12 +258,12 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref
int refradx= (int)(radxf*0.3f*src[3]*(src[0]+src[1]+src[2]));
int refrady= (int)(radyf*0.3f*src[3]*(src[0]+src[1]+src[2]));
- if(refradx>radx) refradx= radx;
- else if(refradx<1) refradx= 1;
- if(refrady>rady) refrady= rady;
- else if(refrady<1) refrady= 1;
+ if (refradx>radx) refradx= radx;
+ else if (refradx<1) refradx= 1;
+ if (refrady>rady) refrady= rady;
+ else if (refrady<1) refrady= 1;
- if(refradx==1 && refrady==1) {
+ if (refradx==1 && refrady==1) {
wb= wbuf->rect + ( y*imgx + x);
dest= new->rect + 4*( y*imgx + x);
wb[0]+= 1.0f;
@@ -306,7 +306,7 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref
x= imgx*imgy;
dest= new->rect;
wb= wbuf->rect;
- while(x--) {
+ while (x--) {
val= 1.0f/wb[0];
dest[0]*= val;
dest[1]*= val;
@@ -319,7 +319,7 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref
free_compbuf(wbuf);
x= MAX2(radx, rady);
- for(i= 0; i<x; i++)
+ for (i= 0; i<x; i++)
MEM_freeN(maintabs[i]);
MEM_freeN(maintabs);
@@ -331,9 +331,9 @@ static float hexagon_filter(float fi, float fj)
fi= fabs(fi);
fj= fabs(fj);
- if(fj>0.33f) {
+ if (fj>0.33f) {
fj= (fj-0.33f)/0.66f;
- if(fi+fj>1.0f)
+ if (fi+fj>1.0f)
return 0.0f;
else
return 1.0f;
@@ -357,16 +357,16 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
/* horizontal */
radxf = fac*(float)nbd->sizex;
- if(radxf>imgx/2.0f)
+ if (radxf>imgx/2.0f)
radxf= imgx/2.0f;
- else if(radxf<1.0f)
+ else if (radxf<1.0f)
radxf= 1.0f;
/* vertical */
radyf = fac*(float)nbd->sizey;
- if(radyf>imgy/2.0f)
+ if (radyf>imgy/2.0f)
radyf= imgy/2.0f;
- else if(radyf<1.0f)
+ else if (radyf<1.0f)
radyf= 1.0f;
radx= ceil(radxf);
@@ -378,8 +378,8 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
gausstab= MEM_mallocN(sizeof(float)*n, "filter tab");
dgauss= gausstab;
val= 0.0f;
- for(j=-rady; j<=rady; j++) {
- for(i=-radx; i<=radx; i++, dgauss++) {
+ for (j=-rady; j<=rady; j++) {
+ for (i=-radx; i<=radx; i++, dgauss++) {
float fj= (float)j/radyf;
float fi= (float)i/radxf;
float dist= sqrt(fj*fj + fi*fi);
@@ -391,17 +391,17 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
}
}
- if(val!=0.0f) {
+ if (val!=0.0f) {
val= 1.0f/val;
- for(j= n -1; j>=0; j--)
+ for (j= n -1; j>=0; j--)
gausstab[j]*= val;
}
else gausstab[4]= 1.0f;
for (y = -rady+1; y < imgy+rady-1; y++) {
- if(y<=0) srcd= img->rect;
- else if(y<imgy) srcd+= pix*imgx;
+ if (y<=0) srcd= img->rect;
+ else if (y<imgy) srcd+= pix*imgx;
else srcd= img->rect + pix*(imgy-1)*imgx;
for (x = -radx+1; x < imgx+radx-1 ; x++) {
@@ -413,8 +413,8 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
float *destd= new->rect + pix*( (y + minyr)*imgx + x + minxr);
float *dgausd= gausstab + (minyr+rady)*(2*radx+1) + minxr+radx;
- if(x<=0) src= srcd;
- else if(x<imgx) src+= pix;
+ if (x<=0) src= srcd;
+ else if (x<imgx) src+= pix;
else src= srcd + pix*(imgx-1);
for (i= minyr; i <=maxyr; i++, destd+= pix*imgx, dgausd+= 2*radx + 1) {
@@ -422,9 +422,9 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
dgauss= dgausd;
for (j= minxr; j <=maxxr; j++, dest+=pix, dgauss++) {
val= *dgauss;
- if(val!=0.0f) {
+ if (val!=0.0f) {
dest[0] += val * src[0];
- if(pix>1) {
+ if (pix>1) {
dest[1] += val * src[1];
dest[2] += val * src[2];
dest[3] += val * src[3];
@@ -433,7 +433,7 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
}
}
}
- if(node->exec & NODE_BREAK)
+ if (node->exec & NODE_BREAK)
break;
}
@@ -459,7 +459,7 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
float proccol[4]; /* local color if compbuf is procedural */
int refradx, refrady;
- if(ref->x!=img->x || ref->y!=img->y)
+ if (ref->x!=img->x || ref->y!=img->y)
return;
ref_use= typecheck_compbuf(ref, CB_VAL);
@@ -470,9 +470,9 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
blurbuf->yof= ref_use->yof;
blurd= blurbuf->rect;
refd= ref_use->rect;
- for(x= imgx*imgy; x>0; x--, refd++, blurd++) {
- if(refd[0]<0.0f) blurd[0]= 0.0f;
- else if(refd[0]>1.0f) blurd[0]= 1.0f;
+ for (x= imgx*imgy; x>0; x--, refd++, blurd++) {
+ if (refd[0]<0.0f) blurd[0]= 0.0f;
+ else if (refd[0]>1.0f) blurd[0]= 1.0f;
else blurd[0]= refd[0];
}
@@ -480,21 +480,21 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
/* horizontal */
radx = (float)nbd->sizex;
- if(radx>imgx/2)
+ if (radx>imgx/2)
radx= imgx/2;
- else if(radx<1)
+ else if (radx<1)
radx= 1;
/* vertical */
rady = (float)nbd->sizey;
- if(rady>imgy/2)
+ if (rady>imgy/2)
rady= imgy/2;
- else if(rady<1)
+ else if (rady<1)
rady= 1;
x= MAX2(radx, rady);
maintabs= MEM_mallocN(x*sizeof(void *), "gauss array");
- for(i= 0; i<x; i++)
+ for (i= 0; i<x; i++)
maintabs[i]= make_gausstab(nbd->filtertype, i+1);
dest= new->rect;
@@ -507,14 +507,14 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
refradx= (int)(refd[0]*radxf);
refrady= (int)(refd[0]*radyf);
- if(refradx>radx) refradx= radx;
- else if(refradx<1) refradx= 1;
- if(refrady>rady) refrady= rady;
- else if(refrady<1) refrady= 1;
+ if (refradx>radx) refradx= radx;
+ else if (refradx<1) refradx= 1;
+ if (refrady>rady) refrady= rady;
+ else if (refrady<1) refrady= 1;
- if(refradx==1 && refrady==1) {
+ if (refradx==1 && refrady==1) {
src= img->rect + pix*( y*imgx + x);
- if(pix==1)
+ if (pix==1)
dest[0]= src[0];
else
copy_v4_v4(dest, src);
@@ -541,7 +541,7 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
val= gausstabcenty[i]*gausstabcentx[j];
sum+= val;
rval += val * src[0];
- if(pix>1) {
+ if (pix>1) {
gval += val * src[1];
bval += val * src[2];
aval += val * src[3];
@@ -550,25 +550,25 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
}
sum= 1.0f/sum;
dest[0] = rval*sum;
- if(pix>1) {
+ if (pix>1) {
dest[1] = gval*sum;
dest[2] = bval*sum;
dest[3] = aval*sum;
}
}
}
- if(node->exec & NODE_BREAK)
+ if (node->exec & NODE_BREAK)
break;
}
free_compbuf(blurbuf);
x= MAX2(radx, rady);
- for(i= 0; i<x; i++)
+ for (i= 0; i<x; i++)
MEM_freeN(maintabs[i]);
MEM_freeN(maintabs);
- if(ref_use!=ref)
+ if (ref_use!=ref)
free_compbuf(ref_use);
}
@@ -577,15 +577,15 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
CompBuf *new, *img= in[0]->data;
NodeBlurData *nbd= node->storage;
- if(img==NULL) return;
+ if (img==NULL) return;
/* store image in size that is needed for absolute/relative conversions on ui level */
nbd->image_in_width= img->x;
nbd->image_in_height= img->y;
- if(out[0]->hasoutput==0) return;
+ if (out[0]->hasoutput==0) return;
- if(nbd->relative) {
+ if (nbd->relative) {
if (nbd->aspect==CMP_NODE_BLUR_ASPECT_NONE) {
nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width);
nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height);
@@ -635,14 +635,15 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
}
out[0]->data = new;
- } else {
+ }
+ else {
/* All non fast gauss blur methods */
- if(img->type==CB_VEC2 || img->type==CB_VEC3) {
+ if (img->type==CB_VEC2 || img->type==CB_VEC3) {
img= typecheck_compbuf(in[0]->data, CB_RGBA);
}
/* if fac input, we do it different */
- if(in[1]->data) {
+ if (in[1]->data) {
CompBuf *gammabuf;
/* make output size of input image */
@@ -652,7 +653,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
new->xof = img->xof;
new->yof = img->yof;
- if(nbd->gamma) {
+ if (nbd->gamma) {
gammabuf= dupalloc_compbuf(img);
gamma_correct_compbuf(gammabuf, 0);
}
@@ -660,11 +661,11 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
blur_with_reference(node, new, gammabuf, in[1]->data);
- if(nbd->gamma) {
+ if (nbd->gamma) {
gamma_correct_compbuf(new, 1);
free_compbuf(gammabuf);
}
- if(node->exec & NODE_BREAK) {
+ if (node->exec & NODE_BREAK) {
free_compbuf(new);
new= NULL;
}
@@ -672,7 +673,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
}
else {
- if(in[1]->vec[0]<=0.001f) { /* time node inputs can be a tiny value */
+ if (in[1]->vec[0]<=0.001f) { /* time node inputs can be a tiny value */
new= pass_on_compbuf(img);
}
else {
@@ -685,31 +686,31 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
new->xof = img->xof;
new->yof = img->yof;
- if(nbd->gamma) {
+ if (nbd->gamma) {
gammabuf= dupalloc_compbuf(img);
gamma_correct_compbuf(gammabuf, 0);
}
else gammabuf= img;
- if(nbd->bokeh)
+ if (nbd->bokeh)
bokeh_single_image(node, new, gammabuf, in[1]->vec[0]);
- else if(1)
+ else if (1)
blur_single_image(node, new, gammabuf, in[1]->vec[0]);
else /* bloom experimental... */
bloom_with_reference(new, gammabuf, NULL, in[1]->vec[0], nbd);
- if(nbd->gamma) {
+ if (nbd->gamma) {
gamma_correct_compbuf(new, 1);
free_compbuf(gammabuf);
}
- if(node->exec & NODE_BREAK) {
+ if (node->exec & NODE_BREAK) {
free_compbuf(new);
new= NULL;
}
}
out[0]->data= new;
}
- if(img!=in[0]->data)
+ if (img!=in[0]->data)
free_compbuf(img);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c
index 83607ac66b3..caae5f313cd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_brightness.c
+++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c
@@ -70,7 +70,7 @@ static void do_brightnesscontrast(bNode *UNUSED(node), float *out, float *in, fl
b = a * (brightness + delta);
}
- for(c=0; c<3; c++){
+ for (c=0; c<3; c++) {
i = in[c];
v = a*i + b;
out[c] = v;
@@ -79,15 +79,15 @@ static void do_brightnesscontrast(bNode *UNUSED(node), float *out, float *in, fl
static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
- if(in[0]->data) {
+ if (in[0]->data) {
CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
stackbuf= dupalloc_compbuf(cbuf);
composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, do_brightnesscontrast, CB_RGBA, CB_VAL, CB_VAL);
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_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
index 785786dacbe..132b1659fa5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
@@ -105,10 +105,10 @@ static void do_channel_matte(bNode *node, float *out, float *in)
alpha=1-alpha;
/* test range*/
- if(alpha>c->t1) {
+ if (alpha>c->t1) {
alpha=in[3]; /*whatever it was prior */
}
- else if(alpha<c->t2){
+ else if (alpha<c->t2) {
alpha=0.0;
}
else {/*blend */
@@ -130,9 +130,9 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
CompBuf *cbuf;
CompBuf *outbuf;
- if(in[0]->hasinput==0) return;
- if(in[0]->data==NULL) return;
- if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
+ 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);
@@ -177,10 +177,10 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
generate_preview(data, node, outbuf);
out[0]->data=outbuf;
- if(out[1]->hasoutput)
+ if (out[1]->hasoutput)
out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A);
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
index b6f490a0320..2df8e1b6139 100644
--- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
@@ -111,14 +111,14 @@ static void do_chroma_key(bNode *node, float *out, float *in)
out[1]=in[1];
out[2]=in[2];
- if(kfg>0.0f) { /* found a pixel that is within key color */
+ 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. */
/* if beta is within the cutoff angle */
- if(fabsf(beta) < (angle2/2.0f)) {
+ if (fabsf(beta) < (angle2/2.0f)) {
alpha=0.0;
}
@@ -144,9 +144,9 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack
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;
+ 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);
@@ -166,12 +166,12 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack
composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_ycca_to_rgba_normalized, CB_RGBA);
out[0]->data= chromabuf;
- if(out[1]->hasoutput)
+ if (out[1]->hasoutput)
out[1]->data= valbuf_from_rgbabuf(chromabuf, CHAN_A);
generate_preview(data, node, chromabuf);
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
index 2d56c9e5973..12b6e802555 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
@@ -54,7 +54,7 @@ static void do_color_key(bNode *node, float *out, float *in)
copy_v3_v3(out, in);
- if(
+ if (
/* do hue last because it needs to wrap, and does some more checks */
/* sat */ (fabsf(in[1]-c->key[1]) < c->t2) &&
@@ -79,9 +79,9 @@ static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack *
CompBuf *colorbuf;
NodeChroma *c;
- if(in[0]->hasinput==0) return;
- if(in[0]->data==NULL) return;
- if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
+ 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);
@@ -103,12 +103,12 @@ static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack *
composit1_pixel_processor(node, colorbuf, colorbuf, in[0]->vec, do_hsva_to_rgba, CB_RGBA);
out[0]->data= colorbuf;
- if(out[1]->hasoutput)
+ if (out[1]->hasoutput)
out[1]->data= valbuf_from_rgbabuf(colorbuf, CHAN_A);
generate_preview(data, node, colorbuf);
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
index af6a295cf7f..026d74aafc4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
@@ -141,7 +141,7 @@ static void do_apply_spillmap_red(bNode *node, float* out, float *in, float *map
{
NodeColorspill *ncs;
ncs=node->storage;
- if(map[0]>0) {
+ if (map[0]>0) {
out[0]=in[0]-(ncs->uspillr*map[0]);
out[1]=in[1]+(ncs->uspillg*map[0]);
out[2]=in[2]+(ncs->uspillb*map[0]);
@@ -157,7 +157,7 @@ static void do_apply_spillmap_green(bNode *node, float* out, float *in, float *m
{
NodeColorspill *ncs;
ncs=node->storage;
- if(map[0]>0) {
+ if (map[0]>0) {
out[0]=in[0]+(ncs->uspillr*map[0]);
out[1]=in[1]-(ncs->uspillg*map[0]);
out[2]=in[2]+(ncs->uspillb*map[0]);
@@ -173,7 +173,7 @@ static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *ma
{
NodeColorspill *ncs;
ncs=node->storage;
- if(map[0]>0) {
+ if (map[0]>0) {
out[0]=in[0]+(ncs->uspillr*map[0]);
out[1]=in[1]+(ncs->uspillg*map[0]);
out[2]=in[2]-(ncs->uspillb*map[0]);
@@ -197,9 +197,9 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
ncs=node->storage;
/* early out for missing connections */
- if(out[0]->hasoutput==0 ) return;
- if(in[0]->hasinput==0) return;
- if(in[0]->data==NULL) return;
+ if (out[0]->hasoutput==0 ) return;
+ if (in[0]->hasinput==0) return;
+ if (in[0]->data==NULL) return;
cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
/* mask= */ /* UNUSED */ typecheck_compbuf(in[1]->data, CB_VAL);
@@ -216,7 +216,8 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
{
if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_red, CB_RGBA);
- } else {
+ }
+ else {
composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_red_fac, CB_RGBA, CB_VAL);
}
break;
@@ -225,13 +226,14 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
{
if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_red, CB_RGBA);
- } else {
+ }
+ else {
composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_red_fac, CB_RGBA, CB_VAL);
}
break;
}
}
- if(ncs->unspill==0) {
+ if (ncs->unspill==0) {
ncs->uspillr=1.0f;
ncs->uspillg=0.0f;
ncs->uspillb=0.0f;
@@ -247,7 +249,8 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
{
if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_green, CB_RGBA);
- } else {
+ }
+ else {
composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_green_fac, CB_RGBA, CB_VAL);
}
break;
@@ -256,13 +259,14 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
{
if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_green, CB_RGBA);
- } else {
+ }
+ else {
composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_green_fac, CB_RGBA, CB_VAL);
}
break;
}
}
- if(ncs->unspill==0) {
+ if (ncs->unspill==0) {
ncs->uspillr=0.0f;
ncs->uspillg=1.0f;
ncs->uspillb=0.0f;
@@ -278,7 +282,8 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
{
if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_blue, CB_RGBA);
- } else {
+ }
+ else {
composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_blue_fac, CB_RGBA, CB_VAL);
}
break;
@@ -287,13 +292,14 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
{
if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_blue, CB_RGBA);
- } else {
+ }
+ else {
composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_blue_fac, CB_RGBA, CB_VAL);
}
break;
}
}
- if(ncs->unspill==0) {
+ if (ncs->unspill==0) {
ncs->uspillr=0.0f;
ncs->uspillg=0.0f;
ncs->uspillb=1.0f;
@@ -307,7 +313,7 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
out[0]->data=rgbbuf;
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
free_compbuf(spillmap);
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
index 26d7aa0a3a0..f77e4cd9c4e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
@@ -69,7 +69,7 @@ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slop
/* note: lift_lgg is just 2-lift, gamma_inv is 1.0/gamma */
DO_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float gain)
{
- /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isnt pretty
+ /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isn'tisn't pretty
* but best keep it this way, sice testing for durian shows a similar calculation
* without lin/srgb conversions gives bad results (over-saturated shadows) with colors
* slightly below 1.0. some correction can be done but it ends up looking bad for shadows or lighter tones - campbell */
@@ -130,9 +130,9 @@ static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNo
/* stack order input: fac, image */
/* stack order output: image */
- if(out[0]->hasoutput==0) return;
+ if (out[0]->hasoutput==0) return;
- if(in[0]->vec[0] == 0.f && in[0]->data == NULL) {
+ if (in[0]->vec[0] == 0.f && in[0]->data == NULL) {
out[0]->data = pass_on_compbuf(cbuf);
return;
}
@@ -158,7 +158,8 @@ static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNo
else {
composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_colorbalance_lgg_fac, CB_RGBA, CB_VAL);
}
- } else {
+ }
+ else {
/* offset/power/slope : ASC-CDL */
if ((in[0]->data==NULL) && (in[0]->vec[0] >= 1.f)) {
composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_colorbalance_cdl, CB_RGBA);
diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c
index 73a84676caa..9b1e5e451c4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_composite.c
+++ b/source/blender/nodes/composite/nodes/node_composite_composite.c
@@ -48,27 +48,27 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i
/* image assigned to output */
/* stack order input sockets: col, alpha, z */
- if(node->flag & NODE_DO_OUTPUT) { /* only one works on out */
+ if (node->flag & NODE_DO_OUTPUT) { /* only one works on out */
Scene *scene= (Scene *)node->id;
RenderData *rd= data;
- if(scene && (rd->scemode & R_DOCOMP)) {
+ if (scene && (rd->scemode & R_DOCOMP)) {
Render *re= RE_GetRender(scene->id.name);
RenderResult *rr= RE_AcquireResultWrite(re);
- if(rr) {
+ if (rr) {
CompBuf *outbuf, *zbuf=NULL;
- if(rr->rectf)
+ if (rr->rectf)
MEM_freeN(rr->rectf);
outbuf= alloc_compbuf(rr->rectx, rr->recty, CB_RGBA, 1);
- if(in[1]->data==NULL)
+ if (in[1]->data==NULL)
composit1_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, do_copy_rgba, CB_RGBA);
else
composit2_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_copy_a_rgba, CB_RGBA, CB_VAL);
- if(in[2]->data) {
- if(rr->rectz)
+ if (in[2]->data) {
+ if (rr->rectz)
MEM_freeN(rr->rectz);
zbuf= alloc_compbuf(rr->rectx, rr->recty, CB_VAL, 1);
composit1_pixel_processor(node, zbuf, in[2]->data, in[2]->vec, do_copy_value, CB_VAL);
@@ -93,7 +93,7 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i
RE_ReleaseResult(re);
}
}
- if(in[0]->data)
+ if (in[0]->data)
generate_preview(data, node, in[0]->data);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c
index 3697f3e4c5c..242bc8396d7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_crop.c
+++ b/source/blender/nodes/composite/nodes/node_composite_crop.c
@@ -45,7 +45,7 @@ static bNodeSocketTemplate cmp_node_crop_out[]= {
static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(in[0]->data) {
+ if (in[0]->data) {
NodeTwoXYs *ntxy= node->storage;
CompBuf *cbuf= in[0]->data;
CompBuf *stackbuf;
@@ -53,7 +53,7 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
float *srcfp, *outfp;
rcti outputrect;
- if(node->custom2) {
+ if (node->custom2) {
ntxy->x1= cbuf->x* ntxy->fac_x1;
ntxy->x2= cbuf->x* ntxy->fac_x2;
ntxy->y1= cbuf->y* ntxy->fac_y1;
@@ -61,16 +61,16 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
}
/* check input image size */
- if(cbuf->x <= ntxy->x1 + 1)
+ if (cbuf->x <= ntxy->x1 + 1)
ntxy->x1= cbuf->x - 1;
- if(cbuf->y <= ntxy->y1 + 1)
+ if (cbuf->y <= ntxy->y1 + 1)
ntxy->y1= cbuf->y - 1;
- if(cbuf->x <= ntxy->x2 + 1)
+ if (cbuf->x <= ntxy->x2 + 1)
ntxy->x2= cbuf->x - 1;
- if(cbuf->y <= ntxy->y2 + 1)
+ if (cbuf->y <= ntxy->y2 + 1)
ntxy->y2= cbuf->y - 1;
/* figure out the minimums and maximums */
@@ -79,7 +79,7 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
outputrect.ymax=MAX2(ntxy->y1, ntxy->y2) + 1;
outputrect.ymin=MIN2(ntxy->y1, ntxy->y2);
- if(node->custom1) {
+ if (node->custom1) {
/* this option crops the image size too */
stackbuf= get_cropped_compbuf(&outputrect, cbuf->rect, cbuf->x, cbuf->y, cbuf->type);
}
@@ -89,10 +89,10 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
stackbuf = alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1);
/* select the cropped part of the image and set it to the output */
- for(y=outputrect.ymin; y<outputrect.ymax; y++){
+ for (y=outputrect.ymin; y<outputrect.ymax; y++) {
srcfp= cbuf->rect + (y * cbuf->x + outputrect.xmin) * cbuf->type;
outfp= stackbuf->rect + (y * stackbuf->x + outputrect.xmin) * stackbuf->type;
- for(x=outputrect.xmin; x<outputrect.xmax; x++, outfp+= stackbuf->type, srcfp+= cbuf->type)
+ for (x=outputrect.xmin; x<outputrect.xmax; x++, outfp+= stackbuf->type, srcfp+= cbuf->type)
memcpy(outfp, srcfp, sizeof(float)*stackbuf->type);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c
index 81424586a11..d17a7bf5dc8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_curves.c
+++ b/source/blender/nodes/composite/nodes/node_composite_curves.c
@@ -47,7 +47,7 @@ static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack *
/* stack order output: fac */
float fac= 0.0f;
- if(node->custom1 < node->custom2)
+ if (node->custom1 < node->custom2)
fac= (rd->cfra - node->custom1)/(float)(node->custom2-node->custom1);
fac= curvemapping_evaluateF(node->storage, 0, fac);
@@ -140,9 +140,9 @@ static void do_curves(bNode *node, float *out, float *in)
static void do_curves_fac(bNode *node, float *out, float *in, float *fac)
{
- if(*fac >= 1.0f)
+ if (*fac >= 1.0f)
curvemapping_evaluate_premulRGBF(node->storage, out, in);
- else if(*fac <= 0.0f) {
+ else if (*fac <= 0.0f) {
copy_v3_v3(out, in);
}
else {
@@ -160,11 +160,11 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS
/* stack order input: fac, image, black level, white level */
/* stack order output: image */
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
/* input no image? then only color operation */
- if(in[1]->data==NULL) {
+ if (in[1]->data==NULL) {
curvemapping_evaluateRGBF(node->storage, out[0]->vec, in[1]->vec);
}
else {
@@ -174,7 +174,7 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS
curvemapping_set_black_white(node->storage, in[2]->vec, in[3]->vec);
- if(in[0]->data==NULL && in[0]->vec[0] == 1.0f)
+ if (in[0]->data==NULL && in[0]->vec[0] == 1.0f)
composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_curves, CB_RGBA);
else
composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_curves_fac, CB_RGBA, CB_VAL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c
index 1ff2dac2900..fc6e6847f34 100644
--- a/source/blender/nodes/composite/nodes/node_composite_defocus.c
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c
@@ -376,7 +376,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
wts->rect[px] = 0.f;
}
// esc set by main calling process
- if(node->exec & NODE_BREAK)
+ if (node->exec & NODE_BREAK)
break;
}
}
@@ -385,9 +385,9 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
// main loop
#ifndef __APPLE__ /* can crash on Mac, see bug #22856, disabled for now */
#ifdef __INTEL_COMPILER /* icc doesn't like the compound statement -- internal error: 0_1506 */
- #pragma omp parallel for private(y) if(!nqd->preview) schedule(guided)
+ #pragma omp parallel for private(y) if (!nqd->preview) schedule(guided)
#else
- #pragma omp parallel for private(y) if(!nqd->preview && img->y*img->x > 16384) schedule(guided)
+ #pragma omp parallel for private(y) if (!nqd->preview && img->y*img->x > 16384) schedule(guided)
#endif
#endif
for (y=0; y<img->y; y++) {
@@ -400,7 +400,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
#pragma omp critical
{
if (((ydone & 7)==0) || (ydone==(img->y-1))) {
- if(G.background==0) {
+ if (G.background==0) {
printf("\rdefocus: Processing Line %d of %d ... ", ydone+1, img->y);
fflush(stdout);
}
@@ -411,7 +411,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
// esc set by main calling process. don't break because openmp doesn't
// allow it, just continue and do nothing
- if(node->exec & NODE_BREAK)
+ if (node->exec & NODE_BREAK)
continue;
zp = y * img->x;
@@ -850,7 +850,7 @@ static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeSta
premul_compbuf(new, 0);
free_compbuf(old);
}
- if(node->exec & NODE_BREAK) {
+ if (node->exec & NODE_BREAK) {
free_compbuf(new);
new= NULL;
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
index eae59dea3f4..027786d8b22 100644
--- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
@@ -63,15 +63,15 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *
copy_v3_v3(outColor, inColor1);
/*make 100% transparent*/
- if(difference < tolerence) {
+ if (difference < tolerence) {
outColor[3]=0.0;
}
/*in the falloff region, make partially transparent */
- else if(difference < falloff+tolerence) {
+ else if (difference < falloff+tolerence) {
difference=difference-tolerence;
alpha=difference/falloff;
/*only change if more transparent than before */
- if(alpha < inColor1[3]) {
+ if (alpha < inColor1[3]) {
outColor[3]=alpha;
}
else { /* leave as before */
@@ -92,16 +92,16 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **
/* NodeChroma *c; */ /* UNUSED */
/*is anything connected?*/
- if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
+ if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
/*must have an image imput*/
- if(in[0]->data==NULL) return;
+ if (in[0]->data==NULL) return;
imbuf1=typecheck_compbuf(in[0]->data, CB_RGBA);
/* if there's an image, use that, if not use the color */
- if(in[1]->data) {
+ if (in[1]->data) {
imbuf2=typecheck_compbuf(in[1]->data, CB_RGBA);
}
@@ -112,14 +112,14 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **
composit2_pixel_processor(node, outbuf, imbuf1, in[0]->vec, imbuf2, in[1]->vec, do_diff_matte, CB_RGBA, CB_RGBA);
out[0]->data=outbuf;
- if(out[1]->hasoutput)
+ if (out[1]->hasoutput)
out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A);
generate_preview(data, node, outbuf);
- if(imbuf1!=in[0]->data)
+ if (imbuf1!=in[0]->data)
free_compbuf(imbuf1);
- if(imbuf2!=in[1]->data)
+ if (imbuf2!=in[1]->data)
free_compbuf(imbuf2);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c
index f8abf96e742..ee857dd0007 100644
--- a/source/blender/nodes/composite/nodes/node_composite_dilate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c
@@ -117,11 +117,11 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod
{
/* stack order in: mask */
/* stack order out: mask */
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
/* input no image? then only color operation */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
out[0]->vec[0] = out[0]->vec[1] = out[0]->vec[2] = 0.0f;
out[0]->vec[3] = 0.0f;
}
@@ -134,12 +134,13 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod
if (node->custom2 > 0) { // positive, dilate
for (i = 0; i < node->custom2; i++)
morpho_dilate(stackbuf);
- } else if (node->custom2 < 0) { // negative, erode
+ }
+ else if (node->custom2 < 0) { // negative, erode
for (i = 0; i > node->custom2; i--)
morpho_erode(stackbuf);
}
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
out[0]->data= stackbuf;
diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
index d0f7feccf2e..f65b3312bea 100644
--- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
@@ -68,37 +68,37 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap,
rot= itsc * spin;
/* blur the image */
- for(i= 0; i < iterations; ++i) {
+ for (i= 0; i < iterations; ++i) {
const float cs= cosf(rot), ss= sinf(rot);
const float isc= 1.f / (1.f + sc);
unsigned int x, y;
float col[4]= {0,0,0,0};
- for(y= 0; y < img->y; ++y) {
+ for (y= 0; y < img->y; ++y) {
const float v= isc * (y - center_y_pix) + ty;
- for(x= 0; x < img->x; ++x) {
+ for (x= 0; x < img->x; ++x) {
const float u= isc * (x - center_x_pix) + tx;
unsigned int p= (x + y * img->x) * img->type;
getpix(tmp, cs * u + ss * v + center_x_pix, cs * v - ss * u + center_y_pix, col);
/* mix img and transformed tmp */
- for(j= 0; j < 4; ++j) {
+ for (j= 0; j < 4; ++j) {
img->rect[p + j]= 0.5f * (img->rect[p + j] + col[j]);
}
}
}
/* copy img to tmp */
- if(i != (iterations - 1))
+ if (i != (iterations - 1))
memcpy(tmp->rect, img->rect, sizeof(float) * img->x * img->y * img->type);
/* double transformations */
tx *= 2.f, ty *= 2.f;
sc *= 2.f, rot *= 2.f;
- if(node->exec & NODE_BREAK) break;
+ if (node->exec & NODE_BREAK) break;
}
free_compbuf(tmp);
@@ -112,7 +112,7 @@ static void node_composit_exec_dblur(void *UNUSED(data), bNode *node, bNodeStack
NodeDBlurData *ndbd= node->storage;
CompBuf *new, *img= in[0]->data;
- if((img == NULL) || (out[0]->hasoutput == 0)) return;
+ if ((img == NULL) || (out[0]->hasoutput == 0)) return;
if (img->type != CB_RGBA)
new = typecheck_compbuf(img, CB_RGBA);
diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c
index ad7c1fa589e..6e4bbc632ea 100644
--- a/source/blender/nodes/composite/nodes/node_composite_displace.c
+++ b/source/blender/nodes/composite/nodes/node_composite_displace.c
@@ -66,8 +66,8 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *
ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
ibuf->rect_float= cbuf->rect;
- for(y=0; y < stackbuf->y; y++) {
- for(x=0; x < stackbuf->x; x++) {
+ for (y=0; y < stackbuf->y; y++) {
+ for (x=0; x < stackbuf->x; x++) {
/* calc pixel coordinates */
qd_getPixel(vecbuf, x-vecbuf->xof, y-vecbuf->yof, vec);
@@ -117,10 +117,10 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *
ibuf_sample(ibuf, u, v, dxt, dyt, col);
qd_setPixel(stackbuf, x, y, col);
- if(node->exec & NODE_BREAK) break;
+ if (node->exec & NODE_BREAK) break;
}
- if(node->exec & NODE_BREAK) break;
+ if (node->exec & NODE_BREAK) break;
}
IMB_freeImBuf(ibuf);
@@ -133,8 +133,8 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *
float vec[3];
float col[3];
- for(y=0; y < stackbuf->y; y++) {
- for(x=0; x < stackbuf->x; x++) {
+ for (y=0; y < stackbuf->y; y++) {
+ for (x=0; x < stackbuf->x; x++) {
qd_getPixel(vecbuf, x, y, vec);
dx = vec[0] * (xscale[0]);
@@ -153,10 +153,10 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *
static void node_composit_exec_displace(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
- if(in[0]->data && in[1]->data) {
+ if (in[0]->data && in[1]->data) {
CompBuf *cbuf= in[0]->data;
CompBuf *vecbuf= in[1]->data;
CompBuf *xbuf= in[2]->data;
@@ -175,9 +175,9 @@ static void node_composit_exec_displace(void *UNUSED(data), bNode *node, bNodeSt
out[0]->data= stackbuf;
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
- if(vecbuf!=in[1]->data)
+ if (vecbuf!=in[1]->data)
free_compbuf(vecbuf);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
index 292bb66613d..7aaaa7ed9b4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
@@ -62,15 +62,15 @@ static void do_distance_matte(bNode *node, float *out, float *in)
copy_v3_v3(out, in);
/*make 100% transparent */
- if(distance < tolerence) {
+ if (distance < tolerence) {
out[3]=0.0;
}
/*in the falloff region, make partially transparent */
- else if(distance < falloff+tolerence){
+ else if (distance < falloff+tolerence) {
distance=distance-tolerence;
alpha=distance/falloff;
/*only change if more transparent than before */
- if(alpha < in[3]) {
+ if (alpha < in[3]) {
out[3]=alpha;
}
else { /* leave as before */
@@ -93,9 +93,9 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac
NodeChroma *c;
/*is anything connected?*/
- if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
+ if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
/*must have an image imput*/
- if(in[0]->data==NULL) return;
+ if (in[0]->data==NULL) return;
inbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
@@ -112,11 +112,11 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac
out[0]->data=workbuf;
- if(out[1]->hasoutput)
+ if (out[1]->hasoutput)
out[1]->data=valbuf_from_rgbabuf(workbuf, CHAN_A);
generate_preview(data, node, workbuf);
- if(inbuf!=in[0]->data)
+ if (inbuf!=in[0]->data)
free_compbuf(inbuf);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
index 7b2e682e968..966d8f8a21a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
@@ -33,1025 +33,1112 @@
static bNodeSocketTemplate cmp_node_doubleedgemask_in[]= {
- { SOCK_FLOAT, 1, "Inner Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, // inner mask socket definition
- { SOCK_FLOAT, 1, "Outer Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, // outer mask socket definition
- { -1, 0, "" } // input socket array terminator
+ { SOCK_FLOAT, 1, "Inner Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, // inner mask socket definition
+ { SOCK_FLOAT, 1, "Outer Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, // outer mask socket definition
+ { -1, 0, "" } // input socket array terminator
};
static bNodeSocketTemplate cmp_node_doubleedgemask_out[]= {
- { SOCK_FLOAT, 0, "Mask"}, // output socket definition
- { -1, 0, "" } // output socket array terminator
+ { SOCK_FLOAT, 0, "Mask"}, // output socket definition
+ { -1, 0, "" } // output socket array terminator
};
static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
{
- int x;
- unsigned int isz=0; // inner edge size
- unsigned int osz=0; // outer edge size
- unsigned int gsz=0; // gradient fill area size
- /* Test the four corners */
- /* upper left corner */
- x=t-rw+1;
- // test if inner mask is filled
- if(limask[x]){
- // test if pixel underneath, or to the right, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- /* upper right corner */
- x=t;
- // test if inner mask is filled
- if(limask[x]){
- // test if pixel underneath, or to the left, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- /* lower left corner */
- x=0;
- // test if inner mask is filled
- if(limask[x]){
- // test if pixel above, or to the right, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- /* lower right corner */
- x=rw-1;
- // test if inner mask is filled
- if(limask[x]){
- // test if pixel above, or to the left, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
-
- /* Test the TOP row of pixels in buffer, except corners */
- for(x= t-1; x>=(t-rw)+2; x--) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if pixel to the right, or to the left, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- }
-
- /* Test the BOTTOM row of pixels in buffer, except corners */
- for(x= rw-2; x; x--) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if pixel to the right, or to the left, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- }
- /* Test the LEFT edge of pixels in buffer, except corners */
- for(x= t-(rw<<1)+1; x>=rw; x-=rw) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if pixel underneath, or above, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- }
-
- /* Test the RIGHT edge of pixels in buffer, except corners */
- for(x= t-rw; x>rw; x-=rw) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if pixel underneath, or above, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- }
-
- rsize[0]=isz; // fill in our return sizes for edges + fill
- rsize[1]=osz;
- rsize[2]=gsz;
+ int x;
+ unsigned int isz=0; // inner edge size
+ unsigned int osz=0; // outer edge size
+ unsigned int gsz=0; // gradient fill area size
+ /* Test the four corners */
+ /* upper left corner */
+ x=t-rw+1;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel underneath, or to the right, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ /* upper right corner */
+ x=t;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel underneath, or to the left, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ /* lower left corner */
+ x=0;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel above, or to the right, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ /* lower right corner */
+ x=rw-1;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel above, or to the left, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+
+ /* Test the TOP row of pixels in buffer, except corners */
+ for (x= t-1; x>=(t-rw)+2; x--) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel to the right, or to the left, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ }
+
+ /* Test the BOTTOM row of pixels in buffer, except corners */
+ for (x= rw-2; x; x--) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel to the right, or to the left, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ }
+ /* Test the LEFT edge of pixels in buffer, except corners */
+ for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel underneath, or above, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ }
+
+ /* Test the RIGHT edge of pixels in buffer, except corners */
+ for (x= t-rw; x>rw; x-=rw) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel underneath, or above, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ }
+
+ rsize[0]=isz; // fill in our return sizes for edges + fill
+ rsize[1]=osz;
+ rsize[2]=gsz;
}
static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
{
- int x;
- unsigned int isz=0; // inner edge size
- unsigned int osz=0; // outer edge size
- unsigned int gsz=0; // gradient fill area size
- /* Test the four corners */
- /* upper left corner */
- x=t-rw+1;
- // test if inner mask is filled
- if(limask[x]){
- // test if pixel underneath, or to the right, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- if(!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- /* upper right corner */
- x=t;
- // test if inner mask is filled
- if(limask[x]){
- // test if pixel underneath, or to the left, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- if(!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- /* lower left corner */
- x=0;
- // test if inner mask is filled
- if(limask[x]){
- // test if pixel above, or to the right, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- if(!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty above or to the right
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- /* lower right corner */
- x=rw-1;
- // test if inner mask is filled
- if(limask[x]){
- // test if pixel above, or to the left, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- if(!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- /* Test the TOP row of pixels in buffer, except corners */
- for(x= t-1; x>=(t-rw)+2; x--) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if pixel to the left, or to the right, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- }
-
- /* Test the BOTTOM row of pixels in buffer, except corners */
- for(x= rw-2; x; x--) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if pixel to the left, or to the right, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- }
- /* Test the LEFT edge of pixels in buffer, except corners */
- for(x= t-(rw<<1)+1; x>=rw; x-=rw) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if pixel underneath, or above, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- }
-
- /* Test the RIGHT edge of pixels in buffer, except corners */
- for(x= t-rw; x>rw; x-=rw) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if pixel underneath, or above, are empty in the inner mask,
- // but filled in the outer mask
- if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- }
-
- rsize[0]=isz; // fill in our return sizes for edges + fill
- rsize[1]=osz;
- rsize[2]=gsz;
+ int x;
+ unsigned int isz=0; // inner edge size
+ unsigned int osz=0; // outer edge size
+ unsigned int gsz=0; // gradient fill area size
+ /* Test the four corners */
+ /* upper left corner */
+ x=t-rw+1;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel underneath, or to the right, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ /* upper right corner */
+ x=t;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel underneath, or to the left, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ /* lower left corner */
+ x=0;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel above, or to the right, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty above or to the right
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ /* lower right corner */
+ x=rw-1;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel above, or to the left, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ /* Test the TOP row of pixels in buffer, except corners */
+ for (x= t-1; x>=(t-rw)+2; x--) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel to the left, or to the right, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ }
+
+ /* Test the BOTTOM row of pixels in buffer, except corners */
+ for (x= rw-2; x; x--) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel to the left, or to the right, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ }
+ /* Test the LEFT edge of pixels in buffer, except corners */
+ for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel underneath, or above, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ }
+
+ /* Test the RIGHT edge of pixels in buffer, except corners */
+ for (x= t-rw; x>rw; x-=rw) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if pixel underneath, or above, are empty in the inner mask,
+ // but filled in the outer mask
+ if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ }
+
+ rsize[0]=isz; // fill in our return sizes for edges + fill
+ rsize[1]=osz;
+ rsize[2]=gsz;
}
static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
{
- int x;
- unsigned int isz=0; // inner edge size
- unsigned int osz=0; // outer edge size
- unsigned int gsz=0; // gradient fill area size
- /* Test the four corners */
- /* upper left corner */
- x=t-rw+1;
- // test if inner mask is filled
- if(limask[x]){
- // test if the inner mask is empty underneath or to the right
- if(!limask[x-rw] || !limask[x+1]){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- /* upper right corner */
- x=t;
- // test if inner mask is filled
- if(limask[x]){
- // test if the inner mask is empty underneath or to the left
- if(!limask[x-rw] || !limask[x-1]){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- /* lower left corner */
- x=0;
- // test if inner mask is filled
- if(limask[x]){
- // test if inner mask is empty above or to the right
- if(!limask[x+rw] || !limask[x+1]){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- /* lower right corner */
- x=rw-1;
- // test if inner mask is filled
- if(limask[x]){
- // test if inner mask is empty above or to the left
- if(!limask[x+rw] || !limask[x-1]){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
-
- /* Test the TOP row of pixels in buffer, except corners */
- for(x= t-1; x>=(t-rw)+2; x--) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if inner mask is empty to the left or to the right
- if(!limask[x-1] || !limask[x+1]) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- }
-
- /* Test the BOTTOM row of pixels in buffer, except corners */
- for(x= rw-2; x; x--) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if inner mask is empty to the left or to the right
- if(!limask[x-1] || !limask[x+1]) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- }
- /* Test the LEFT edge of pixels in buffer, except corners */
- for(x= t-(rw<<1)+1; x>=rw; x-=rw) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if inner mask is empty underneath or above
- if(!limask[x-rw] || !limask[x+rw]) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- }
-
- /* Test the RIGHT edge of pixels in buffer, except corners */
- for(x= t-rw; x>rw; x-=rw) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if inner mask is empty underneath or above
- if(!limask[x-rw] || !limask[x+rw]) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- }
- }
-
- rsize[0]=isz; // fill in our return sizes for edges + fill
- rsize[1]=osz;
- rsize[2]=gsz;
+ int x;
+ unsigned int isz=0; // inner edge size
+ unsigned int osz=0; // outer edge size
+ unsigned int gsz=0; // gradient fill area size
+ /* Test the four corners */
+ /* upper left corner */
+ x=t-rw+1;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if the inner mask is empty underneath or to the right
+ if (!limask[x-rw] || !limask[x+1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ /* upper right corner */
+ x=t;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if the inner mask is empty underneath or to the left
+ if (!limask[x-rw] || !limask[x-1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ /* lower left corner */
+ x=0;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty above or to the right
+ if (!limask[x+rw] || !limask[x+1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ /* lower right corner */
+ x=rw-1;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty above or to the left
+ if (!limask[x+rw] || !limask[x-1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+
+ /* Test the TOP row of pixels in buffer, except corners */
+ for (x= t-1; x>=(t-rw)+2; x--) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty to the left or to the right
+ if (!limask[x-1] || !limask[x+1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ }
+
+ /* Test the BOTTOM row of pixels in buffer, except corners */
+ for (x= rw-2; x; x--) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty to the left or to the right
+ if (!limask[x-1] || !limask[x+1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ }
+ /* Test the LEFT edge of pixels in buffer, except corners */
+ for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty underneath or above
+ if (!limask[x-rw] || !limask[x+rw]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ }
+
+ /* Test the RIGHT edge of pixels in buffer, except corners */
+ for (x= t-rw; x>rw; x-=rw) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty underneath or above
+ if (!limask[x-rw] || !limask[x+rw]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ }
+
+ rsize[0]=isz; // fill in our return sizes for edges + fill
+ rsize[1]=osz;
+ rsize[2]=gsz;
}
static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
{
- int x;
- unsigned int isz=0; // inner edge size
- unsigned int osz=0; // outer edge size
- unsigned int gsz=0; // gradient fill area size
- /* Test the four corners */
- /* upper left corner */
- x=t-rw+1;
- // test if inner mask is filled
- if(limask[x]){
- // test if the inner mask is empty underneath or to the right
- if(!limask[x-rw] || !limask[x+1]){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- if(!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- /* upper right corner */
- x=t;
- // test if inner mask is filled
- if(limask[x]){
- // test if the inner mask is empty underneath or to the left
- if(!limask[x-rw] || !limask[x-1]){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- if(!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- /* lower left corner */
- x=0;
- // test if inner mask is filled
- if(limask[x]){
- // test if inner mask is empty above or to the right
- if(!limask[x+rw] || !limask[x+1]){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- if(!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- /* lower right corner */
- x=rw-1;
- // test if inner mask is filled
- if(limask[x]){
- // test if inner mask is empty above or to the left
- if(!limask[x+rw] || !limask[x-1]){
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled
- if(!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- /* Test the TOP row of pixels in buffer, except corners */
- for(x= t-1; x>=(t-rw)+2; x--) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if inner mask is empty to the left or to the right
- if(!limask[x-1] || !limask[x+1]) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- }
-
- /* Test the BOTTOM row of pixels in buffer, except corners */
- for(x= rw-2; x; x--) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if inner mask is empty to the left or to the right
- if(!limask[x-1] || !limask[x+1]) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- }
- /* Test the LEFT edge of pixels in buffer, except corners */
- for(x= t-(rw<<1)+1; x>=rw; x-=rw) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if inner mask is empty underneath or above
- if(!limask[x-rw] || !limask[x+rw]) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- }
-
- /* Test the RIGHT edge of pixels in buffer, except corners */
- for(x= t-rw; x>rw; x-=rw) {
- // test if inner mask is filled
- if(limask[x]) {
- // test if inner mask is empty underneath or above
- if(!limask[x-rw] || !limask[x+rw]) {
- isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
- } else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
- }
- } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled
- if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
- osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
- } else {
- gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
- }
- }
- }
-
- rsize[0]=isz; // fill in our return sizes for edges + fill
- rsize[1]=osz;
- rsize[2]=gsz;
+ int x;
+ unsigned int isz=0; // inner edge size
+ unsigned int osz=0; // outer edge size
+ unsigned int gsz=0; // gradient fill area size
+ /* Test the four corners */
+ /* upper left corner */
+ x=t-rw+1;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if the inner mask is empty underneath or to the right
+ if (!limask[x-rw] || !limask[x+1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ /* upper right corner */
+ x=t;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if the inner mask is empty underneath or to the left
+ if (!limask[x-rw] || !limask[x-1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ /* lower left corner */
+ x=0;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty above or to the right
+ if (!limask[x+rw] || !limask[x+1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ /* lower right corner */
+ x=rw-1;
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty above or to the left
+ if (!limask[x+rw] || !limask[x-1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ /* Test the TOP row of pixels in buffer, except corners */
+ for (x= t-1; x>=(t-rw)+2; x--) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty to the left or to the right
+ if (!limask[x-1] || !limask[x+1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ }
+
+ /* Test the BOTTOM row of pixels in buffer, except corners */
+ for (x= rw-2; x; x--) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty to the left or to the right
+ if (!limask[x-1] || !limask[x+1]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ }
+ /* Test the LEFT edge of pixels in buffer, except corners */
+ for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty underneath or above
+ if (!limask[x-rw] || !limask[x+rw]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ }
+
+ /* Test the RIGHT edge of pixels in buffer, except corners */
+ for (x= t-rw; x>rw; x-=rw) {
+ // test if inner mask is filled
+ if (limask[x]) {
+ // test if inner mask is empty underneath or above
+ if (!limask[x-rw] || !limask[x+rw]) {
+ isz++; // increment inner edge size
+ lres[x]=4; // flag pixel as inner edge
+ }
+ else {
+ res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ }
+ }
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
+ osz++; // increment outer edge size
+ lres[x]=3; // flag pixel as outer edge
+ }
+ else {
+ gsz++; // increment the gradient pixel count
+ lres[x]=2; // flag pixel as gradient
+ }
+ }
+ }
+
+ rsize[0]=isz; // fill in our return sizes for edges + fill
+ rsize[1]=osz;
+ rsize[2]=gsz;
}
static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz)
{
- int x; // x = pixel loop counter
- int a; // a = pixel loop counter
- int dx; // dx = delta x
- int pix_prevRow; // pix_prevRow = pixel one row behind the one we are testing in a loop
- int pix_nextRow; // pix_nextRow = pixel one row in front of the one we are testing in a loop
- int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop
- int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop
- /* Test all rows between the FIRST and LAST rows, excluding left and right edges */
- for(x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
- a=x-2;
- pix_prevRow=a+rw;
- pix_nextRow=a-rw;
- pix_prevCol=a+1;
- pix_nextCol=a-1;
- while(a>dx-2) {
- if(!limask[a]) { // if the inner mask is empty
- if(lomask[a]) { // if the outer mask is full
- /*
- Next we test all 4 directions around the current pixel: next/prev/up/down
- The test ensures that the outer mask is empty and that the inner mask
- is also empty. If both conditions are true for any one of the 4 adjacent pixels
- then the current pixel is counted as being a true outer edge pixel.
- */
- if((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
- (!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
- (!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
- (!lomask[pix_prevRow] && !limask[pix_prevRow]))
+ int x; // x = pixel loop counter
+ int a; // a = pixel loop counter
+ int dx; // dx = delta x
+ int pix_prevRow; // pix_prevRow = pixel one row behind the one we are testing in a loop
+ int pix_nextRow; // pix_nextRow = pixel one row in front of the one we are testing in a loop
+ int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop
+ int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop
+ /* Test all rows between the FIRST and LAST rows, excluding left and right edges */
+ for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
+ a=x-2;
+ pix_prevRow=a+rw;
+ pix_nextRow=a-rw;
+ pix_prevCol=a+1;
+ pix_nextCol=a-1;
+ while (a>dx-2) {
+ if (!limask[a]) { // if the inner mask is empty
+ if (lomask[a]) { // if the outer mask is full
+ /*
+ * Next we test all 4 directions around the current pixel: next/prev/up/down
+ * The test ensures that the outer mask is empty and that the inner mask
+ * is also empty. If both conditions are true for any one of the 4 adjacent pixels
+ * then the current pixel is counted as being a true outer edge pixel.
+ */
+ if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
+ (!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
+ (!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
+ (!lomask[pix_prevRow] && !limask[pix_prevRow]))
{
- in_osz++; // increment the outer boundary pixel count
- lres[a]=3; // flag pixel as part of outer edge
- } else { // it's not a boundary pixel, but it is a gradient pixel
- in_gsz++; // increment the gradient pixel count
- lres[a]=2; // flag pixel as gradient
- }
- }
-
- } else {
- if(!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) {
- in_isz++; // increment the inner boundary pixel count
- lres[a]=4; // flag pixel as part of inner edge
- } else {
- res[a]=1.0f; // pixel is part of inner mask, but not at an edge
- }
- }
- a--;
- pix_prevRow--;
- pix_nextRow--;
- pix_prevCol--;
- pix_nextCol--;
- }
- }
-
- rsize[0]=in_isz; // fill in our return sizes for edges + fill
- rsize[1]=in_osz;
- rsize[2]=in_gsz;
+ in_osz++; // increment the outer boundary pixel count
+ lres[a]=3; // flag pixel as part of outer edge
+ }
+ else { // it's not a boundary pixel, but it is a gradient pixel
+ in_gsz++; // increment the gradient pixel count
+ lres[a]=2; // flag pixel as gradient
+ }
+ }
+
+ }
+ else {
+ if (!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) {
+ in_isz++; // increment the inner boundary pixel count
+ lres[a]=4; // flag pixel as part of inner edge
+ }
+ else {
+ res[a]=1.0f; // pixel is part of inner mask, but not at an edge
+ }
+ }
+ a--;
+ pix_prevRow--;
+ pix_nextRow--;
+ pix_prevCol--;
+ pix_nextCol--;
+ }
+ }
+
+ rsize[0]=in_isz; // fill in our return sizes for edges + fill
+ rsize[1]=in_osz;
+ rsize[2]=in_gsz;
}
static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz)
{
- int x; // x = pixel loop counter
- int a; // a = pixel loop counter
- int dx; // dx = delta x
- int pix_prevRow; // pix_prevRow = pixel one row behind the one we are testing in a loop
- int pix_nextRow; // pix_nextRow = pixel one row in front of the one we are testing in a loop
- int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop
- int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop
- /* Test all rows between the FIRST and LAST rows, excluding left and right edges */
- for(x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
- a=x-2;
- pix_prevRow=a+rw;
- pix_nextRow=a-rw;
- pix_prevCol=a+1;
- pix_nextCol=a-1;
- while(a>dx-2) {
- if(!limask[a]) { // if the inner mask is empty
- if(lomask[a]) { // if the outer mask is full
- /*
- Next we test all 4 directions around the current pixel: next/prev/up/down
- The test ensures that the outer mask is empty and that the inner mask
- is also empty. If both conditions are true for any one of the 4 adjacent pixels
- then the current pixel is counted as being a true outer edge pixel.
- */
- if((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
- (!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
- (!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
- (!lomask[pix_prevRow] && !limask[pix_prevRow]))
+ int x; // x = pixel loop counter
+ int a; // a = pixel loop counter
+ int dx; // dx = delta x
+ int pix_prevRow; // pix_prevRow = pixel one row behind the one we are testing in a loop
+ int pix_nextRow; // pix_nextRow = pixel one row in front of the one we are testing in a loop
+ int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop
+ int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop
+ /* Test all rows between the FIRST and LAST rows, excluding left and right edges */
+ for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
+ a=x-2;
+ pix_prevRow=a+rw;
+ pix_nextRow=a-rw;
+ pix_prevCol=a+1;
+ pix_nextCol=a-1;
+ while (a>dx-2) {
+ if (!limask[a]) { // if the inner mask is empty
+ if (lomask[a]) { // if the outer mask is full
+ /*
+ * Next we test all 4 directions around the current pixel: next/prev/up/down
+ * The test ensures that the outer mask is empty and that the inner mask
+ * is also empty. If both conditions are true for any one of the 4 adjacent pixels
+ * then the current pixel is counted as being a true outer edge pixel.
+ */
+ if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
+ (!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
+ (!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
+ (!lomask[pix_prevRow] && !limask[pix_prevRow]))
{
- in_osz++; // increment the outer boundary pixel count
- lres[a]=3; // flag pixel as part of outer edge
- } else { // it's not a boundary pixel, but it is a gradient pixel
- in_gsz++; // increment the gradient pixel count
- lres[a]=2; // flag pixel as gradient
- }
- }
-
- } else {
- if((!limask[pix_nextCol] && lomask[pix_nextCol]) ||
- (!limask[pix_prevCol] && lomask[pix_prevCol]) ||
- (!limask[pix_nextRow] && lomask[pix_nextRow]) ||
- (!limask[pix_prevRow] && lomask[pix_prevRow]))
+ in_osz++; // increment the outer boundary pixel count
+ lres[a]=3; // flag pixel as part of outer edge
+ }
+ else { // it's not a boundary pixel, but it is a gradient pixel
+ in_gsz++; // increment the gradient pixel count
+ lres[a]=2; // flag pixel as gradient
+ }
+ }
+
+ }
+ else {
+ if ((!limask[pix_nextCol] && lomask[pix_nextCol]) ||
+ (!limask[pix_prevCol] && lomask[pix_prevCol]) ||
+ (!limask[pix_nextRow] && lomask[pix_nextRow]) ||
+ (!limask[pix_prevRow] && lomask[pix_prevRow]))
{
- in_isz++; // increment the inner boundary pixel count
- lres[a]=4; // flag pixel as part of inner edge
- } else {
- res[a]=1.0f; // pixel is part of inner mask, but not at an edge
- }
- }
- a--;
- pix_prevRow--; // advance all four "surrounding" pixel pointers
- pix_nextRow--;
- pix_prevCol--;
- pix_nextCol--;
- }
- }
-
- rsize[0]=in_isz; // fill in our return sizes for edges + fill
- rsize[1]=in_osz;
- rsize[2]=in_gsz;
+ in_isz++; // increment the inner boundary pixel count
+ lres[a]=4; // flag pixel as part of inner edge
+ }
+ else {
+ res[a]=1.0f; // pixel is part of inner mask, but not at an edge
+ }
+ }
+ a--;
+ pix_prevRow--; // advance all four "surrounding" pixel pointers
+ pix_nextRow--;
+ pix_prevCol--;
+ pix_nextCol--;
+ }
+ }
+
+ rsize[0]=in_isz; // fill in our return sizes for edges + fill
+ rsize[1]=in_osz;
+ rsize[2]=in_gsz;
}
static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz)
{
- int x; // x = pixel loop counter
- int a; // a = temporary pixel index buffer loop counter
- unsigned int ud; // ud = unscaled edge distance
- unsigned int dmin; // dmin = minimun edge distance
-
- unsigned int rsl; // long used for finding fast 1.0/sqrt
- unsigned int gradientFillOffset;
- unsigned int innerAccum=0; // for looping inner edge pixel indexes, represents current position from offset
- unsigned int outerAccum=0; // for looping outer edge pixel indexes, represents current position from offset
- unsigned int gradientAccum=0; // for looping gradient pixel indexes, represents current position from offset
- /*
- Here we compute the size of buffer needed to hold (row,col) coordinates
- for each pixel previously determined to be either gradient, inner edge,
- or outer edge.
-
- Allocation is done by requesting 4 bytes "sizeof(int)" per pixel, even
- though gbuf[] is declared as unsigned short* (2 bytes) because we don't
- store the pixel indexes, we only store x,y location of pixel in buffer.
-
- This does make the assumption that x and y can fit in 16 unsigned bits
- so if Blender starts doing renders greater than 65536 in either direction
- this will need to allocate gbuf[] as unsigned int* and allocate 8 bytes
- per flagged pixel.
-
- In general, the buffer on-screen:
-
- Example: 9 by 9 pixel block
-
- . = pixel non-white in both outer and inner mask
- o = pixel white in outer, but not inner mask, adjacent to "." pixel
- g = pixel white in outer, but not inner mask, not adjacent to "." pixel
- i = pixel white in inner mask, adjacent to "g" or "." pixel
- F = pixel white in inner mask, only adjacent to other pixels white in the inner mask
-
-
- ......... <----- pixel #80
- ..oooo...
- .oggggo..
- .oggiggo.
- .ogiFigo.
- .oggiggo.
- .oggggo..
- ..oooo...
- pixel #00 -----> .........
-
- gsz = 18 (18 "g" pixels above)
- isz = 4 (4 "i" pixels above)
- osz = 18 (18 "o" pixels above)
-
-
- The memory in gbuf[] after filling will look like this:
-
- gradientFillOffset (0 pixels) innerEdgeOffset (18 pixels) outerEdgeOffset (22 pixels)
- / / /
- / / /
- |X Y X Y X Y X Y > <X Y X Y > <X Y X Y X Y > <X Y X Y | <- (x,y)
- +--------------------------------> <----------------> <------------------------> <----------------+
- |0 2 4 6 8 10 12 14 > ... <68 70 72 74 > ... <80 82 84 86 88 90 > ... <152 154 156 158 | <- bytes
- +--------------------------------> <----------------> <------------------------> <----------------+
- |g0 g0 g1 g1 g2 g2 g3 g3 > <g17 g17 i0 i0 > <i2 i2 i3 i3 o0 o0 > <o16 o16 o17 o17 | <- pixel
- / / /
- / / /
- / / /
- +---------- gradientAccum (18) ---------+ +--- innerAccum (22) ---+ +--- outerAccum (40) ---+
-
-
- Ultimately we do need the pixel's memory buffer index to set the output
- pixel color, but it's faster to reconstruct the memory buffer location
- each iteration of the final gradient calculation than it is to deconstruct
- a memory location into x,y pairs each round.
-*/
-
-
- gradientFillOffset=0; // since there are likely "more" of these, put it first. :)
- *innerEdgeOffset=gradientFillOffset+gsz; // set start of inner edge indexes
- *outerEdgeOffset=(*innerEdgeOffset)+isz; // set start of outer edge indexes
- /* set the accumulators to correct positions */ // set up some accumulator variables for loops
- gradientAccum = gradientFillOffset; // each accumulator variable starts at its respective
- innerAccum = *innerEdgeOffset; // section's offset so when we start filling, each
- outerAccum = *outerEdgeOffset; // section fills up it's allocated space in gbuf
- //uses dmin=row, rsl=col
- for(x=0,dmin=0; x<t; x+=rw,dmin++) {
- for(rsl=0; rsl<rw; rsl++) {
- a=x+rsl;
- if(lres[a]==2) { // it is a gradient pixel flagged by 2
- ud=gradientAccum<<1; // double the index to reach correct unsigned short location
- gbuf[ud]=dmin; // insert pixel's row into gradient pixel location buffer
- gbuf[ud+1]=rsl; // insert pixel's column into gradient pixel location buffer
- gradientAccum++; // increment gradient index buffer pointer
- } else if(lres[a]==3) { // it is an outer edge pixel flagged by 3
- ud=outerAccum<<1; // double the index to reach correct unsigned short location
- gbuf[ud]=dmin; // insert pixel's row into outer edge pixel location buffer
- gbuf[ud+1]=rsl; // insert pixel's column into outer edge pixel location buffer
- outerAccum++; // increment outer edge index buffer pointer
- res[a]=0.0f; // set output pixel intensity now since it won't change later
- } else if(lres[a]==4) { // it is an inner edge pixel flagged by 4
- ud=innerAccum<<1; // double int index to reach correct unsigned short location
- gbuf[ud]=dmin; // insert pixel's row into inner edge pixel location buffer
- gbuf[ud+1]=rsl; // insert pixel's column into inner edge pixel location buffer
- innerAccum++; // increment inner edge index buffer pointer
- res[a]=1.0f; // set output pixel intensity now since it won't change later
- }
- }
- }
+ int x; // x = pixel loop counter
+ int a; // a = temporary pixel index buffer loop counter
+ unsigned int ud; // ud = unscaled edge distance
+ unsigned int dmin; // dmin = minimun edge distance
+
+ unsigned int rsl; // long used for finding fast 1.0/sqrt
+ unsigned int gradientFillOffset;
+ unsigned int innerAccum=0; // for looping inner edge pixel indexes, represents current position from offset
+ unsigned int outerAccum=0; // for looping outer edge pixel indexes, represents current position from offset
+ unsigned int gradientAccum=0; // for looping gradient pixel indexes, represents current position from offset
+ /*
+ * Here we compute the size of buffer needed to hold (row,col) coordinates
+ * for each pixel previously determined to be either gradient, inner edge,
+ * or outer edge.
+ *
+ * Allocation is done by requesting 4 bytes "sizeof(int)" per pixel, even
+ * though gbuf[] is declared as unsigned short* (2 bytes) because we don't
+ * store the pixel indexes, we only store x,y location of pixel in buffer.
+ *
+ * This does make the assumption that x and y can fit in 16 unsigned bits
+ * so if Blender starts doing renders greater than 65536 in either direction
+ * this will need to allocate gbuf[] as unsigned int* and allocate 8 bytes
+ * per flagged pixel.
+ *
+ * In general, the buffer on-screen:
+ *
+ * Example: 9 by 9 pixel block
+ *
+ * . = pixel non-white in both outer and inner mask
+ * o = pixel white in outer, but not inner mask, adjacent to "." pixel
+ * g = pixel white in outer, but not inner mask, not adjacent to "." pixel
+ * i = pixel white in inner mask, adjacent to "g" or "." pixel
+ * F = pixel white in inner mask, only adjacent to other pixels white in the inner mask
+ *
+ *
+ * ......... <----- pixel #80
+ * ..oooo...
+ * .oggggo..
+ * .oggiggo.
+ * .ogiFigo.
+ * .oggiggo.
+ * .oggggo..
+ * ..oooo...
+ * pixel #00 -----> .........
+ *
+ * gsz = 18 (18 "g" pixels above)
+ * isz = 4 (4 "i" pixels above)
+ * osz = 18 (18 "o" pixels above)
+ *
+ *
+ * The memory in gbuf[] after filling will look like this:
+ *
+ * gradientFillOffset (0 pixels) innerEdgeOffset (18 pixels) outerEdgeOffset (22 pixels)
+ * / / /
+ * / / /
+ * |X Y X Y X Y X Y > <X Y X Y > <X Y X Y X Y > <X Y X Y | <- (x,y)
+ * +--------------------------------> <----------------> <------------------------> <----------------+
+ * |0 2 4 6 8 10 12 14 > ... <68 70 72 74 > ... <80 82 84 86 88 90 > ... <152 154 156 158 | <- bytes
+ * +--------------------------------> <----------------> <------------------------> <----------------+
+ * |g0 g0 g1 g1 g2 g2 g3 g3 > <g17 g17 i0 i0 > <i2 i2 i3 i3 o0 o0 > <o16 o16 o17 o17 | <- pixel
+ * / / /
+ * / / /
+ * / / /
+ * +---------- gradientAccum (18) ---------+ +--- innerAccum (22) ---+ +--- outerAccum (40) ---+
+ *
+ *
+ * Ultimately we do need the pixel's memory buffer index to set the output
+ * pixel color, but it's faster to reconstruct the memory buffer location
+ * each iteration of the final gradient calculation than it is to deconstruct
+ * a memory location into x,y pairs each round.
+ */
+
+
+ gradientFillOffset=0; // since there are likely "more" of these, put it first. :)
+ *innerEdgeOffset=gradientFillOffset+gsz; // set start of inner edge indexes
+ *outerEdgeOffset=(*innerEdgeOffset)+isz; // set start of outer edge indexes
+ /* set the accumulators to correct positions */ // set up some accumulator variables for loops
+ gradientAccum = gradientFillOffset; // each accumulator variable starts at its respective
+ innerAccum = *innerEdgeOffset; // section's offset so when we start filling, each
+ outerAccum = *outerEdgeOffset; // section fills up it's allocated space in gbuf
+ //uses dmin=row, rsl=col
+ for (x=0,dmin=0; x<t; x+=rw,dmin++) {
+ for (rsl=0; rsl<rw; rsl++) {
+ a=x+rsl;
+ if (lres[a]==2) { // it is a gradient pixel flagged by 2
+ ud=gradientAccum<<1; // double the index to reach correct unsigned short location
+ gbuf[ud]=dmin; // insert pixel's row into gradient pixel location buffer
+ gbuf[ud+1]=rsl; // insert pixel's column into gradient pixel location buffer
+ gradientAccum++; // increment gradient index buffer pointer
+ }
+ else if (lres[a]==3) { // it is an outer edge pixel flagged by 3
+ ud=outerAccum<<1; // double the index to reach correct unsigned short location
+ gbuf[ud]=dmin; // insert pixel's row into outer edge pixel location buffer
+ gbuf[ud+1]=rsl; // insert pixel's column into outer edge pixel location buffer
+ outerAccum++; // increment outer edge index buffer pointer
+ res[a]=0.0f; // set output pixel intensity now since it won't change later
+ }
+ else if (lres[a]==4) { // it is an inner edge pixel flagged by 4
+ ud=innerAccum<<1; // double int index to reach correct unsigned short location
+ gbuf[ud]=dmin; // insert pixel's row into inner edge pixel location buffer
+ gbuf[ud+1]=rsl; // insert pixel's column into inner edge pixel location buffer
+ innerAccum++; // increment inner edge index buffer pointer
+ res[a]=1.0f; // set output pixel intensity now since it won't change later
+ }
+ }
+ }
}
static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset)
{
- int x; // x = pixel loop counter
- int a; // a = temporary pixel index buffer loop counter
- int fsz; // size of the frame
- unsigned int rsl; // long used for finding fast 1.0/sqrt
- float rsf; // float used for finding fast 1.0/sqrt
- const float rsopf = 1.5f; // constant float used for finding fast 1.0/sqrt
-
- unsigned int gradientFillOffset;
- unsigned int t;
- unsigned int ud; // ud = unscaled edge distance
- unsigned int dmin; // dmin = minimun edge distance
- float odist; // odist = current outer edge distance
- float idist; // idist = current inner edge distance
- int dx; // dx = X-delta (used for distance proportion calculation)
- int dy; // dy = Y-delta (used for distance proportion calculation)
-
- /*
- The general algorithm used to color each gradient pixel is:
-
- 1.) Loop through all gradient pixels.
- A.) For each gradient pixel:
- a.) Loop though all outside edge pixels, looking for closest one
- to the gradient pixel we are in.
- b.) Loop through all inside edge pixels, looking for closest one
- to the gradient pixel we are in.
- c.) Find proportion of distance from gradient pixel to inside edge
- pixel compared to sum of distance to inside edge and distance to
- outside edge.
-
- In an image where:
- . = blank (black) pixels, not covered by inner mask or outer mask
- + = desired gradient pixels, covered only by outer mask
- * = white full mask pixels, covered by at least inner mask
-
- ...............................
- ...............+++++++++++.....
- ...+O++++++..++++++++++++++....
- ..+++\++++++++++++++++++++.....
- .+++++G+++++++++*******+++.....
- .+++++|+++++++*********+++.....
- .++***I****************+++.....
- .++*******************+++......
- .+++*****************+++.......
- ..+++***************+++........
- ....+++**********+++...........
- ......++++++++++++.............
- ...............................
-
- O = outside edge pixel
- \
- G = gradient pixel
- |
- I = inside edge pixel
-
- __
- *note that IO does not need to be a straight line, in fact
- many cases can arise where straight lines do not work
- correctly.
-
- __ __ __
- d.) Pixel color is assigned as |GO| / ( |GI| + |GO| )
-
- The implementation does not compute distance, but the reciprocal of the
- distance. This is done to avoid having to compute a square root, as a
- reciprocal square root can be computed faster. Therefore, the code computes
- pixel color as |GI| / (|GI| + |GO|). Since these are reciprocals, GI serves the
- purpose of GO for the proportion calculation.
-
- For the purposes of the minimun distance comparisons, we only check
- the sums-of-squares against eachother, since they are in the same
- mathematical sort-order as if we did go ahead and take square roots
-
- Loop through all gradient pixels.
- */
-
- for(x= gsz-1; x>=0; x--) {
- gradientFillOffset=x<<1;
- t=gbuf[gradientFillOffset]; // calculate column of pixel indexed by gbuf[x]
- fsz=gbuf[gradientFillOffset+1]; // calculate row of pixel indexed by gbuf[x]
- dmin=0xffffffff; // reset min distance to edge pixel
- for(a=outerEdgeOffset+osz-1; a>=outerEdgeOffset; a--) { // loop through all outer edge buffer pixels
- ud=a<<1;
- dy=t-gbuf[ud]; // set dx to gradient pixel column - outer edge pixel row
- dx=fsz-gbuf[ud+1]; // set dy to gradient pixel row - outer edge pixel column
- ud=dx*dx+dy*dy; // compute sum of squares
- if(ud<dmin) { // if our new sum of squares is less than the current minimum
- dmin=ud; // set a new minimum equal to the new lower value
- }
- }
- odist=(float)(dmin); // cast outer min to a float
- rsf=odist*0.5f; //
- rsl=*(unsigned int*)&odist; // use some peculiar properties of the way bits are stored
- rsl=0x5f3759df-(rsl>>1); // in floats vs. unsigned ints to compute an approximate
- odist=*(float*)&rsl; // reciprocal square root
- odist=odist*(rsopf-(rsf*odist*odist)); // -- ** this line can be iterated for more accuracy ** --
- dmin=0xffffffff; // reset min distance to edge pixel
- for(a= innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) { // loop through all inside edge pixels
- ud=a<<1;
- dy=t-gbuf[ud]; // compute delta in Y from gradient pixel to inside edge pixel
- dx=fsz-gbuf[ud+1]; // compute delta in X from gradient pixel to inside edge pixel
- ud=dx*dx+dy*dy; // compute sum of squares
- if(ud<dmin) { // if our new sum of squares is less than the current minimum we've found
- dmin=ud; // set a new minimum equal to the new lower value
- }
- }
- idist=(float)(dmin); // cast inner min to a float
- rsf=idist*0.5f; //
- rsl=*(unsigned int*)&idist; //
- rsl=0x5f3759df-(rsl>>1); // see notes above
- idist=*(float*)&rsl; //
- idist=idist*(rsopf-(rsf*idist*idist)); //
- /*
- Note once again that since we are using reciprocals of distance values our
- proportion is already the correct intensity, and does not need to be
- subracted from 1.0 like it would have if we used real distances.
- */
-
- /*
- Here we reconstruct the pixel's memory location in the CompBuf by
- Pixel Index = Pixel Column + ( Pixel Row * Row Width )
- */
- res[gbuf[gradientFillOffset+1]+(gbuf[gradientFillOffset]*rw)]=(idist/(idist+odist)); //set intensity
- }
+ int x; // x = pixel loop counter
+ int a; // a = temporary pixel index buffer loop counter
+ int fsz; // size of the frame
+ unsigned int rsl; // long used for finding fast 1.0/sqrt
+ float rsf; // float used for finding fast 1.0/sqrt
+ const float rsopf = 1.5f; // constant float used for finding fast 1.0/sqrt
+
+ unsigned int gradientFillOffset;
+ unsigned int t;
+ unsigned int ud; // ud = unscaled edge distance
+ unsigned int dmin; // dmin = minimun edge distance
+ float odist; // odist = current outer edge distance
+ float idist; // idist = current inner edge distance
+ int dx; // dx = X-delta (used for distance proportion calculation)
+ int dy; // dy = Y-delta (used for distance proportion calculation)
+ /*
+ * The general algorithm used to color each gradient pixel is:
+ *
+ * 1.) Loop through all gradient pixels.
+ * A.) For each gradient pixel:
+ * a.) Loop though all outside edge pixels, looking for closest one
+ * to the gradient pixel we are in.
+ * b.) Loop through all inside edge pixels, looking for closest one
+ * to the gradient pixel we are in.
+ * c.) Find proportion of distance from gradient pixel to inside edge
+ * pixel compared to sum of distance to inside edge and distance to
+ * outside edge.
+ *
+ * In an image where:
+ * . = blank (black) pixels, not covered by inner mask or outer mask
+ * + = desired gradient pixels, covered only by outer mask
+ * * = white full mask pixels, covered by at least inner mask
+ *
+ * ...............................
+ * ...............+++++++++++.....
+ * ...+O++++++..++++++++++++++....
+ * ..+++\++++++++++++++++++++.....
+ * .+++++G+++++++++*******+++.....
+ * .+++++|+++++++*********+++.....
+ * .++***I****************+++.....
+ * .++*******************+++......
+ * .+++*****************+++.......
+ * ..+++***************+++........
+ * ....+++**********+++...........
+ * ......++++++++++++.............
+ * ...............................
+ *
+ * O = outside edge pixel
+ * \
+ * G = gradient pixel
+ * |
+ * I = inside edge pixel
+ *
+ * __
+ * *note that IO does not need to be a straight line, in fact
+ * many cases can arise where straight lines do not work
+ * correctly.
+ *
+ * __ __ __
+ * d.) Pixel color is assigned as |GO| / ( |GI| + |GO| )
+ *
+ * The implementation does not compute distance, but the reciprocal of the
+ * distance. This is done to avoid having to compute a square root, as a
+ * reciprocal square root can be computed faster. Therefore, the code computes
+ * pixel color as |GI| / (|GI| + |GO|). Since these are reciprocals, GI serves the
+ * purpose of GO for the proportion calculation.
+ *
+ * For the purposes of the minimun distance comparisons, we only check
+ * the sums-of-squares against each other, since they are in the same
+ * mathematical sort-order as if we did go ahead and take square roots
+ *
+ * Loop through all gradient pixels.
+ */
+
+ for (x= gsz-1; x>=0; x--) {
+ gradientFillOffset=x<<1;
+ t=gbuf[gradientFillOffset]; // calculate column of pixel indexed by gbuf[x]
+ fsz=gbuf[gradientFillOffset+1]; // calculate row of pixel indexed by gbuf[x]
+ dmin=0xffffffff; // reset min distance to edge pixel
+ for (a=outerEdgeOffset+osz-1; a>=outerEdgeOffset; a--) { // loop through all outer edge buffer pixels
+ ud=a<<1;
+ dy=t-gbuf[ud]; // set dx to gradient pixel column - outer edge pixel row
+ dx=fsz-gbuf[ud+1]; // set dy to gradient pixel row - outer edge pixel column
+ ud=dx*dx+dy*dy; // compute sum of squares
+ if (ud<dmin) { // if our new sum of squares is less than the current minimum
+ dmin=ud; // set a new minimum equal to the new lower value
+ }
+ }
+ odist=(float)(dmin); // cast outer min to a float
+ rsf=odist*0.5f; //
+ rsl=*(unsigned int*)&odist; // use some peculiar properties of the way bits are stored
+ rsl=0x5f3759df-(rsl>>1); // in floats vs. unsigned ints to compute an approximate
+ odist=*(float*)&rsl; // reciprocal square root
+ odist=odist*(rsopf-(rsf*odist*odist)); // -- ** this line can be iterated for more accuracy ** --
+ dmin=0xffffffff; // reset min distance to edge pixel
+ for (a= innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) { // loop through all inside edge pixels
+ ud=a<<1;
+ dy=t-gbuf[ud]; // compute delta in Y from gradient pixel to inside edge pixel
+ dx=fsz-gbuf[ud+1]; // compute delta in X from gradient pixel to inside edge pixel
+ ud=dx*dx+dy*dy; // compute sum of squares
+ if (ud<dmin) { // if our new sum of squares is less than the current minimum we've found
+ dmin=ud; // set a new minimum equal to the new lower value
+ }
+ }
+ idist=(float)(dmin); // cast inner min to a float
+ rsf=idist*0.5f; //
+ rsl=*(unsigned int*)&idist; //
+ rsl=0x5f3759df-(rsl>>1); // see notes above
+ idist=*(float*)&rsl; //
+ idist=idist*(rsopf-(rsf*idist*idist)); //
+ /*
+ * Note once again that since we are using reciprocals of distance values our
+ * proportion is already the correct intensity, and does not need to be
+ * subracted from 1.0 like it would have if we used real distances.
+ */
+
+ /*
+ * Here we reconstruct the pixel's memory location in the CompBuf by
+ * Pixel Index = Pixel Column + ( Pixel Row * Row Width )
+ */
+ res[gbuf[gradientFillOffset+1]+(gbuf[gradientFillOffset]*rw)]=(idist/(idist+odist)); //set intensity
+ }
}
@@ -1059,136 +1146,139 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g
static void node_composit_exec_doubleedgemask(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
- float *imask; // imask = pointer to inner mask pixel buffer
- float *omask; // omask = pointer to outer mask pixel buffer
- float *res; // res = pointer to output mask
-
- unsigned int *lres; // lres = unsigned int pointer to output pixel buffer (for bit operations)
- unsigned int *limask; // limask = unsigned int pointer to inner mask (for bit operations)
- unsigned int *lomask; // lomask = unsigned int pointer to outer mask (for bit operations)
-
- int rw; // rw = pixel row width
- int t; // t = total number of pixels in buffer - 1 (used for loop starts)
- int fsz; // size of the frame
-
- unsigned int isz=0; // size (in pixels) of inside edge pixel index buffer
- unsigned int osz=0; // size (in pixels) of outside edge pixel index buffer
- unsigned int gsz=0; // size (in pixels) of gradient pixel index buffer
- unsigned int rsize[3]; // size storage to pass to helper functions
- unsigned int innerEdgeOffset=0; // offset into final buffer where inner edge pixel indexes start
- unsigned int outerEdgeOffset=0; // offset into final buffer where outer edge pixel indexes start
-
- unsigned short *gbuf; // gradient/inner/outer pixel location index buffer
-
- CompBuf *cbuf; // pointer, will be set to inner mask data
- CompBuf *dbuf; // pointer, will be set to outer mask data
- CompBuf *stackbuf; // pointer, will get allocated as output buffer
-
- if(out[0]->hasoutput==0) { // if the node's output socket is not connected to anything...
- return; // do not execute any further, just exit the node immediately
- }
-
- if(in[0]->data && in[1]->data) { // if both input sockets have some data coming in...
- cbuf= in[0]->data; // get a pointer to the inner mask data
- dbuf= in[1]->data; // get a pointer to the outer mask data
- if(cbuf->type!=CB_VAL || dbuf->type!=CB_VAL) { // if either input socket has an incorrect data type coming in
- return; // exit the node immediately
- }
-
- t=(cbuf->x*cbuf->y)-1; // determine size of the frame
-
- stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); // allocate the output buffer
-
- imask= cbuf->rect; // set the inner mask
- omask= dbuf->rect; // set the outer mask
- res= stackbuf->rect; // set output pointer
- lres= (unsigned int*)res; // unsigned int pointer to output buffer (for bit level ops)
- limask=(unsigned int*)imask; // unsigned int pointer to input mask (for bit level ops)
- lomask=(unsigned int*)omask; // unsigned int pointer to output mask (for bit level ops)
- rw= cbuf->x; // width of a row of pixels
-
-
- /*
- The whole buffer is broken up into 4 parts. The four CORNERS, the FIRST and LAST rows, the
- LEFT and RIGHT edges (excluding the corner pixels), and all OTHER rows.
- This allows for quick computation of outer edge pixels where
- a screen edge pixel is marked to be gradient.
-
- The pixel type (gradient vs inner-edge vs outer-edge) tests change
- depending on the user selected "Inner Edge Mode" and the user selected
- "Buffer Edge Mode" on the node's GUI. There are 4 sets of basically the
- same algorithm:
-
- 1.) Inner Edge -> Adjacent Only
- Buffer Edge -> Keep Inside
-
- 2.) Inner Edge -> Adjacent Only
- Buffer Edge -> Bleed Out
-
- 3.) Inner Edge -> All
- Buffer Edge -> Keep Inside
-
- 4.) Inner Edge -> All
- Buffer Edge -> Bleed Out
-
- Each version has slightly different criteria for detecting an edge pixel.
- */
- if(node->custom2) { // if "adjacent only" inner edge mode is turned on
- if(node->custom1) { // if "keep inside" buffer edge mode is turned on
- do_adjacentKeepBorders(t,rw,limask,lomask,lres,res,rsize);
- }else{ // "bleed out" buffer edge mode is turned on
- do_adjacentBleedBorders(t,rw,limask,lomask,lres,res,rsize);
- }
- isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass
- osz=rsize[1];
- gsz=rsize[2];
- // detect edges in all non-border pixels in the buffer
- do_adjacentEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
- }else{ // "all" inner edge mode is turned on
- if(node->custom1) { // if "keep inside" buffer edge mode is turned on
- do_allKeepBorders(t,rw,limask,lomask,lres,res,rsize);
- }else{ // "bleed out" buffer edge mode is turned on
- do_allBleedBorders(t,rw,limask,lomask,lres,res,rsize);
- }
- isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass
- osz=rsize[1];
- gsz=rsize[2];
- // detect edges in all non-border pixels in the buffer
- do_allEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
- }
-
- isz=rsize[0]; // set edge and gradient buffer sizes once again...
- osz=rsize[1]; // the sizes in rsize[] may have been modified
- gsz=rsize[2]; // by the do_*EdgeDetection() function.
-
- // quick check for existance of edges in the buffer...
- // if we don't have any one of the three sizes, the other two make no difference visually,
- // so we can just pass the inner input buffer back as output.
- if(!gsz || !isz || !osz) {
- out[0]->data= stackbuf; // point the node output buffer to our filled buffer
- return;
- }
-
-
- fsz=gsz+isz+osz; // calculate size of pixel index buffer needed
- gbuf= MEM_mallocN(fsz*sizeof(int), "grd buf"); // allocate edge/gradient pixel index buffer
-
- do_createEdgeLocationBuffer(t,rw,lres,res,gbuf,&innerEdgeOffset,&outerEdgeOffset,isz,gsz);
- do_fillGradientBuffer(rw,res,gbuf,isz,osz,gsz,innerEdgeOffset,outerEdgeOffset);
-
- MEM_freeN(gbuf); // free the gradient index buffer
- out[0]->data= stackbuf; // point the node output buffer to our filled buffer
- }
+ float *imask; // imask = pointer to inner mask pixel buffer
+ float *omask; // omask = pointer to outer mask pixel buffer
+ float *res; // res = pointer to output mask
+
+ unsigned int *lres; // lres = unsigned int pointer to output pixel buffer (for bit operations)
+ unsigned int *limask; // limask = unsigned int pointer to inner mask (for bit operations)
+ unsigned int *lomask; // lomask = unsigned int pointer to outer mask (for bit operations)
+
+ int rw; // rw = pixel row width
+ int t; // t = total number of pixels in buffer - 1 (used for loop starts)
+ int fsz; // size of the frame
+
+ unsigned int isz=0; // size (in pixels) of inside edge pixel index buffer
+ unsigned int osz=0; // size (in pixels) of outside edge pixel index buffer
+ unsigned int gsz=0; // size (in pixels) of gradient pixel index buffer
+ unsigned int rsize[3]; // size storage to pass to helper functions
+ unsigned int innerEdgeOffset=0; // offset into final buffer where inner edge pixel indexes start
+ unsigned int outerEdgeOffset=0; // offset into final buffer where outer edge pixel indexes start
+
+ unsigned short *gbuf; // gradient/inner/outer pixel location index buffer
+
+ CompBuf *cbuf; // pointer, will be set to inner mask data
+ CompBuf *dbuf; // pointer, will be set to outer mask data
+ CompBuf *stackbuf; // pointer, will get allocated as output buffer
+
+ if (out[0]->hasoutput==0) { // if the node's output socket is not connected to anything...
+ return; // do not execute any further, just exit the node immediately
+ }
+
+ if (in[0]->data && in[1]->data) { // if both input sockets have some data coming in...
+ cbuf= in[0]->data; // get a pointer to the inner mask data
+ dbuf= in[1]->data; // get a pointer to the outer mask data
+ if (cbuf->type!=CB_VAL || dbuf->type!=CB_VAL) { // if either input socket has an incorrect data type coming in
+ return; // exit the node immediately
+ }
+
+ t=(cbuf->x*cbuf->y)-1; // determine size of the frame
+
+ stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); // allocate the output buffer
+
+ imask= cbuf->rect; // set the inner mask
+ omask= dbuf->rect; // set the outer mask
+ res= stackbuf->rect; // set output pointer
+ lres= (unsigned int*)res; // unsigned int pointer to output buffer (for bit level ops)
+ limask=(unsigned int*)imask; // unsigned int pointer to input mask (for bit level ops)
+ lomask=(unsigned int*)omask; // unsigned int pointer to output mask (for bit level ops)
+ rw= cbuf->x; // width of a row of pixels
+
+
+ /*
+ * The whole buffer is broken up into 4 parts. The four CORNERS, the FIRST and LAST rows, the
+ * LEFT and RIGHT edges (excluding the corner pixels), and all OTHER rows.
+ * This allows for quick computation of outer edge pixels where
+ * a screen edge pixel is marked to be gradient.
+ *
+ * The pixel type (gradient vs inner-edge vs outer-edge) tests change
+ * depending on the user selected "Inner Edge Mode" and the user selected
+ * "Buffer Edge Mode" on the node's GUI. There are 4 sets of basically the
+ * same algorithm:
+ *
+ * 1.) Inner Edge -> Adjacent Only
+ * Buffer Edge -> Keep Inside
+ *
+ * 2.) Inner Edge -> Adjacent Only
+ * Buffer Edge -> Bleed Out
+ *
+ * 3.) Inner Edge -> All
+ * Buffer Edge -> Keep Inside
+ *
+ * 4.) Inner Edge -> All
+ * Buffer Edge -> Bleed Out
+ *
+ * Each version has slightly different criteria for detecting an edge pixel.
+ */
+ if (node->custom2) { // if "adjacent only" inner edge mode is turned on
+ if (node->custom1) { // if "keep inside" buffer edge mode is turned on
+ do_adjacentKeepBorders(t,rw,limask,lomask,lres,res,rsize);
+ }
+ else { // "bleed out" buffer edge mode is turned on
+ do_adjacentBleedBorders(t,rw,limask,lomask,lres,res,rsize);
+ }
+ isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass
+ osz=rsize[1];
+ gsz=rsize[2];
+ // detect edges in all non-border pixels in the buffer
+ do_adjacentEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
+ }
+ else { // "all" inner edge mode is turned on
+ if (node->custom1) { // if "keep inside" buffer edge mode is turned on
+ do_allKeepBorders(t,rw,limask,lomask,lres,res,rsize);
+ }
+ else { // "bleed out" buffer edge mode is turned on
+ do_allBleedBorders(t,rw,limask,lomask,lres,res,rsize);
+ }
+ isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass
+ osz=rsize[1];
+ gsz=rsize[2];
+ // detect edges in all non-border pixels in the buffer
+ do_allEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
+ }
+
+ isz=rsize[0]; // set edge and gradient buffer sizes once again...
+ osz=rsize[1]; // the sizes in rsize[] may have been modified
+ gsz=rsize[2]; // by the do_*EdgeDetection() function.
+
+ // quick check for existance of edges in the buffer...
+ // if we don't have any one of the three sizes, the other two make no difference visually,
+ // so we can just pass the inner input buffer back as output.
+ if (!gsz || !isz || !osz) {
+ out[0]->data= stackbuf; // point the node output buffer to our filled buffer
+ return;
+ }
+
+
+ fsz=gsz+isz+osz; // calculate size of pixel index buffer needed
+ gbuf= MEM_mallocN(fsz*sizeof(int), "grd buf"); // allocate edge/gradient pixel index buffer
+
+ do_createEdgeLocationBuffer(t,rw,lres,res,gbuf,&innerEdgeOffset,&outerEdgeOffset,isz,gsz);
+ do_fillGradientBuffer(rw,res,gbuf,isz,osz,gsz,innerEdgeOffset,outerEdgeOffset);
+
+ MEM_freeN(gbuf); // free the gradient index buffer
+ out[0]->data= stackbuf; // point the node output buffer to our filled buffer
+ }
}
void register_node_type_cmp_doubleedgemask(bNodeTreeType *ttype)
{
- static bNodeType ntype; // allocate a node type data structure
+ static bNodeType ntype; // allocate a node type data structure
- node_type_base(ttype, &ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, NODE_OPTIONS);
- node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out);
- node_type_size(&ntype, 210, 210, 210);
- node_type_exec(&ntype, node_composit_exec_doubleedgemask);
+ node_type_base(ttype, &ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out);
+ node_type_size(&ntype, 210, 210, 210);
+ node_type_exec(&ntype, node_composit_exec_doubleedgemask);
- nodeRegisterType(ttype, &ntype);
+ nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c
index 94a109de8f2..6d470467cb0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_filter.c
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.c
@@ -51,24 +51,24 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac)
rowlen= in->x;
- for(y=0; y<in->y; y++) {
+ for (y=0; y<in->y; y++) {
/* setup rows */
- if(y==0) row1= in->rect;
+ if (y==0) row1= in->rect;
else row1= in->rect + pix*(y-1)*rowlen;
row2= in->rect + y*pix*rowlen;
- if(y==in->y-1) row3= row2;
+ if (y==in->y-1) row3= row2;
else row3= row2 + pix*rowlen;
fp= out->rect + pix*y*rowlen;
- if(pix==CB_RGBA) {
+ if (pix==CB_RGBA) {
copy_v4_v4(fp, row2);
fp+= pix;
- for(x=2; x<rowlen; x++) {
- for(c=0; c<3; c++) {
+ for (x=2; x<rowlen; x++) {
+ for (c=0; c<3; c++) {
f1= filter[0]*row1[0] + filter[1]*row1[4] + filter[2]*row1[8] + filter[3]*row2[0] + filter[4]*row2[4] + filter[5]*row2[8] + filter[6]*row3[0] + filter[7]*row3[4] + filter[8]*row3[8];
f2= filter[0]*row1[0] + filter[3]*row1[4] + filter[6]*row1[8] + filter[1]*row2[0] + filter[4]*row2[4] + filter[7]*row2[8] + filter[2]*row3[0] + filter[5]*row3[4] + filter[8]*row3[8];
fp[0]= mfac*row2[4] + fac*sqrt(f1*f1 + f2*f2);
@@ -80,9 +80,9 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac)
}
copy_v4_v4(fp, row2+4);
}
- else if(pix==CB_VAL) {
+ else if (pix==CB_VAL) {
fp+= pix;
- for(x=2; x<rowlen; x++) {
+ for (x=2; x<rowlen; x++) {
f1= filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2];
f2= filter[0]*row1[0] + filter[3]*row1[1] + filter[6]*row1[2] + filter[1]*row2[0] + filter[4]*row2[1] + filter[7]*row2[2] + filter[2]*row3[0] + filter[5]*row3[1] + filter[8]*row3[2];
fp[0]= mfac*row2[1] + fac*sqrt(f1*f1 + f2*f2);
@@ -101,35 +101,35 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
rowlen= in->x;
- for(y=0; y<in->y; y++) {
+ for (y=0; y<in->y; y++) {
/* setup rows */
- if(y==0) row1= in->rect;
+ if (y==0) row1= in->rect;
else row1= in->rect + pixlen*(y-1)*rowlen;
row2= in->rect + y*pixlen*rowlen;
- if(y==in->y-1) row3= row2;
+ if (y==in->y-1) row3= row2;
else row3= row2 + pixlen*rowlen;
fp= out->rect + pixlen*(y)*rowlen;
- if(pixlen==1) {
+ if (pixlen==1) {
fp[0]= row2[0];
fp+= 1;
- for(x=2; x<rowlen; x++) {
+ for (x=2; x<rowlen; x++) {
fp[0]= mfac*row2[1] + fac*(filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2]);
fp++; row1++; row2++; row3++;
}
fp[0]= row2[1];
}
- else if(pixlen==2) {
+ else if (pixlen==2) {
fp[0]= row2[0];
fp[1]= row2[1];
fp+= 2;
- for(x=2; x<rowlen; x++) {
- for(c=0; c<2; c++) {
+ for (x=2; x<rowlen; x++) {
+ for (c=0; c<2; c++) {
fp[0]= mfac*row2[2] + fac*(filter[0]*row1[0] + filter[1]*row1[2] + filter[2]*row1[4] + filter[3]*row2[0] + filter[4]*row2[2] + filter[5]*row2[4] + filter[6]*row3[0] + filter[7]*row3[2] + filter[8]*row3[4]);
fp++; row1++; row2++; row3++;
}
@@ -137,12 +137,12 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
fp[0]= row2[2];
fp[1]= row2[3];
}
- else if(pixlen==3) {
+ else if (pixlen==3) {
copy_v3_v3(fp, row2);
fp+= 3;
- for(x=2; x<rowlen; x++) {
- for(c=0; c<3; c++) {
+ for (x=2; x<rowlen; x++) {
+ for (c=0; c<3; c++) {
fp[0]= mfac*row2[3] + fac*(filter[0]*row1[0] + filter[1]*row1[3] + filter[2]*row1[6] + filter[3]*row2[0] + filter[4]*row2[3] + filter[5]*row2[6] + filter[6]*row3[0] + filter[7]*row3[3] + filter[8]*row3[6]);
fp++; row1++; row2++; row3++;
}
@@ -153,8 +153,8 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
copy_v4_v4(fp, row2);
fp+= 4;
- for(x=2; x<rowlen; x++) {
- for(c=0; c<4; c++) {
+ for (x=2; x<rowlen; x++) {
+ for (c=0; c<4; c++) {
fp[0]= mfac*row2[4] + fac*(filter[0]*row1[0] + filter[1]*row1[4] + filter[2]*row1[8] + filter[3]*row2[0] + filter[4]*row2[4] + filter[5]*row2[8] + filter[6]*row3[0] + filter[7]*row3[4] + filter[8]*row3[8]);
fp++; row1++; row2++; row3++;
}
@@ -175,12 +175,12 @@ static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in,
float kirsch[9]= {5,5,5,-3,-3,-3,-2,-2,-2};
float shadow[9]= {1,2,1,0,1,0,-1,-2,-1};
- if(out[0]->hasoutput==0) return;
+ if (out[0]->hasoutput==0) return;
/* stack order in: Image */
/* stack order out: Image */
- if(in[1]->data) {
+ if (in[1]->data) {
/* make output size of first available input image */
CompBuf *cbuf= in[1]->data;
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1); /* allocs */
diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c
index 974a14037eb..3c297299edc 100644
--- a/source/blender/nodes/composite/nodes/node_composite_flip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_flip.c
@@ -45,7 +45,7 @@ static bNodeSocketTemplate cmp_node_flip_out[]= {
static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(in[0]->data) {
+ if (in[0]->data) {
CompBuf *cbuf= in[0]->data;
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1); /* note, this returns zero'd image */
int i, src_pix, src_width, src_height, srcydelt, outydelt, x, y;
@@ -59,20 +59,20 @@ static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack
srcydelt= src_width*src_pix;
outydelt= srcydelt;
- if(node->custom1) { /*set up output pointer for y flip*/
+ if (node->custom1) { /*set up output pointer for y flip*/
outfp+= (src_height-1)*outydelt;
outydelt= -outydelt;
}
- for(y=0; y<src_height; y++) {
- if(node->custom1 == 1) { /* no x flip so just copy line*/
+ for (y=0; y<src_height; y++) {
+ if (node->custom1 == 1) { /* no x flip so just copy line*/
memcpy(outfp, srcfp, sizeof(float) * src_pix * src_width);
srcfp+=srcydelt;
}
else {
outfp += (src_width-1)*src_pix;
- for(x=0; x<src_width; x++) {
- for(i=0; i<src_pix; i++) {
+ for (x=0; x<src_width; x++) {
+ for (i=0; i<src_pix; i++) {
outfp[i]= srcfp[i];
}
outfp -= src_pix;
diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c
index 90135b5cf35..ae793b44f2c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_gamma.c
+++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c
@@ -48,7 +48,7 @@ static bNodeSocketTemplate cmp_node_gamma_out[]= {
static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac)
{
int i=0;
- for(i=0; i<3; i++) {
+ for (i=0; i<3; i++) {
/* check for negative to avoid nan's */
out[i] = (in[i] > 0.0f)? powf(in[i],fac[0]): in[i];
}
@@ -58,10 +58,10 @@ static void node_composit_exec_gamma(void *UNUSED(data), bNode *node, bNodeStack
{
/* stack order in: Fac, Image */
/* stack order out: Image */
- if(out[0]->hasoutput==0) return;
+ if (out[0]->hasoutput==0) return;
/* input no image? then only color operation */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
do_gamma(node, out[0]->vec, in[0]->vec, in[1]->vec);
}
else {
diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c
index d4e15f780e5..42760ddfc4e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_glare.c
+++ b/source/blender/nodes/composite/nodes/node_composite_glare.c
@@ -436,7 +436,8 @@ static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack
if (img->type != CB_RGBA) {
new = typecheck_compbuf(img, CB_RGBA);
src = typecheck_compbuf(img, CB_RGBA);
- } else {
+ }
+ else {
new = dupalloc_compbuf(img);
src = dupalloc_compbuf(img);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
index c4598717e00..7349d1dd4bf 100644
--- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
@@ -48,12 +48,12 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac)
{
NodeHueSat *nhs= node->storage;
- if(*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0f || nhs->val!=1.0f)) {
+ if (*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0f || nhs->val!=1.0f)) {
float col[3], hsv[3], mfac= 1.0f - *fac;
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
hsv[0]+= (nhs->hue - 0.5f);
- if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f;
+ if (hsv[0]>1.0f) hsv[0]-=1.0f; else if (hsv[0]<0.0f) hsv[0]+= 1.0f;
hsv[1]*= nhs->sat;
hsv[2]*= nhs->val;
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
@@ -72,10 +72,10 @@ static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeSta
{
/* stack order in: Fac, Image */
/* stack order out: Image */
- if(out[0]->hasoutput==0) return;
+ if (out[0]->hasoutput==0) return;
/* input no image? then only color operation */
- if(in[1]->data==NULL) {
+ if (in[1]->data==NULL) {
do_hue_sat_fac(node, out[0]->vec, in[1]->vec, in[0]->vec);
}
else {
@@ -88,7 +88,7 @@ static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeSta
out[0]->data= stackbuf;
/* get rid of intermediary cbuf if it's extra */
- if(stackbuf!=cbuf)
+ if (stackbuf!=cbuf)
free_compbuf(cbuf);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
index 6b0849b2391..23d04a28276 100644
--- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
+++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
@@ -109,16 +109,16 @@ static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNode
/* stack order input: fac, image, black level, white level */
/* stack order output: image */
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
- if(in[0]->vec[0] == 0.f && in[0]->data == NULL) {
+ if (in[0]->vec[0] == 0.f && in[0]->data == NULL) {
out[0]->data = pass_on_compbuf(cbuf);
return;
}
/* input no image? then only color operation */
- if(in[1]->data==NULL) {
+ if (in[1]->data==NULL) {
do_huecorrect_fac(node, out[0]->vec, in[1]->vec, in[0]->vec);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c
index 0600e44b0d0..c1dba471f20 100644
--- a/source/blender/nodes/composite/nodes/node_composite_idMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c
@@ -52,15 +52,15 @@ static void do_idmask(CompBuf *stackbuf, CompBuf *cbuf, float idnr)
char *abuf= MEM_mapallocN(cbuf->x*cbuf->y, "anti ali buf");
rect= cbuf->rect;
- for(x= cbuf->x*cbuf->y - 1; x>=0; x--)
- if(rect[x]==idnr)
+ for (x= cbuf->x*cbuf->y - 1; x>=0; x--)
+ if (rect[x]==idnr)
abuf[x]= 255;
antialias_tagbuf(cbuf->x, cbuf->y, abuf);
rect= stackbuf->rect;
- for(x= cbuf->x*cbuf->y - 1; x>=0; x--)
- if(abuf[x]>1)
+ for (x= cbuf->x*cbuf->y - 1; x>=0; x--)
+ if (abuf[x]>1)
rect[x]= (1.0f/255.0f)*(float)abuf[x];
MEM_freeN(abuf);
@@ -74,8 +74,8 @@ static void do_idmask_fsa(CompBuf *stackbuf, CompBuf *cbuf, float idnr)
rect= cbuf->rect;
rs= stackbuf->rect;
- for(x= cbuf->x*cbuf->y - 1; x>=0; x--)
- if(rect[x]==idnr)
+ for (x= cbuf->x*cbuf->y - 1; x>=0; x--)
+ if (rect[x]==idnr)
rs[x]= 1.0f;
}
@@ -85,19 +85,19 @@ static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in,
{
RenderData *rd= data;
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
- if(in[0]->data) {
+ if (in[0]->data) {
CompBuf *cbuf= in[0]->data;
CompBuf *stackbuf;
- if(cbuf->type!=CB_VAL)
+ if (cbuf->type!=CB_VAL)
return;
stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); /* allocs */;
- if((rd->scemode & R_FULL_SAMPLE) || node->custom2 == 0)
+ if ((rd->scemode & R_FULL_SAMPLE) || node->custom2 == 0)
do_idmask_fsa(stackbuf, cbuf, (float)node->custom1);
else
do_idmask(stackbuf, cbuf, (float)node->custom1);
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index 997bd72d5c4..44efbc6f9db 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -75,8 +75,8 @@ float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc)
*alloc= FALSE;
- if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
- if(ibuf->profile != IB_PROFILE_NONE) {
+ if (rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
+ if (ibuf->profile != IB_PROFILE_NONE) {
rect= ibuf->rect_float;
}
else {
@@ -90,7 +90,7 @@ float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc)
}
}
else {
- if(ibuf->profile == IB_PROFILE_NONE) {
+ if (ibuf->profile == IB_PROFILE_NONE) {
rect= ibuf->rect_float;
}
else {
@@ -119,7 +119,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
int alloc= FALSE;
ibuf= BKE_image_get_ibuf(ima, iuser);
- if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
+ if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
return NULL;
}
@@ -129,7 +129,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
/* now we need a float buffer from the image with matching color management */
/* XXX weak code, multilayer is excluded from this */
- if(ibuf->channels == 4 && ima->rr==NULL) {
+ if (ibuf->channels == 4 && ima->rr==NULL) {
rect= node_composit_get_float_buffer(rd, ibuf, &alloc);
}
else {
@@ -141,9 +141,9 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
type= ibuf->channels;
- if(rd->scemode & R_COMP_CROP) {
+ if (rd->scemode & R_COMP_CROP) {
stackbuf= get_cropped_compbuf(&rd->disprect, rect, ibuf->x, ibuf->y, type);
- if(alloc)
+ if (alloc)
MEM_freeN(rect);
}
else {
@@ -176,8 +176,8 @@ static CompBuf *node_composit_get_zimage(bNode *node, RenderData *rd)
ImBuf *ibuf= BKE_image_get_ibuf((Image *)node->id, node->storage);
CompBuf *zbuf= NULL;
- if(ibuf && ibuf->zbuf_float) {
- if(rd->scemode & R_COMP_CROP) {
+ if (ibuf && ibuf->zbuf_float) {
+ if (rd->scemode & R_COMP_CROP) {
zbuf= get_cropped_compbuf(&rd->disprect, ibuf->zbuf_float, ibuf->x, ibuf->y, CB_VAL);
}
else {
@@ -194,11 +194,11 @@ static CompBuf *compbuf_multilayer_get(RenderData *rd, RenderLayer *rl, Image *i
RenderPass *rpass;
short index;
- for(index=0, rpass= rl->passes.first; rpass; rpass= rpass->next, index++)
- if(rpass->passtype==passtype)
+ for (index=0, rpass= rl->passes.first; rpass; rpass= rpass->next, index++)
+ if (rpass->passtype==passtype)
break;
- if(rpass) {
+ if (rpass) {
CompBuf *cbuf;
iuser->pass= index;
@@ -212,58 +212,58 @@ static CompBuf *compbuf_multilayer_get(RenderData *rd, RenderLayer *rl, Image *i
static void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, Image *ima, ImageUser *iuser)
{
- if(out[RRES_OUT_Z]->hasoutput)
+ if (out[RRES_OUT_Z]->hasoutput)
out[RRES_OUT_Z]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_Z);
- if(out[RRES_OUT_VEC]->hasoutput)
+ if (out[RRES_OUT_VEC]->hasoutput)
out[RRES_OUT_VEC]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_VECTOR);
- if(out[RRES_OUT_NORMAL]->hasoutput)
+ if (out[RRES_OUT_NORMAL]->hasoutput)
out[RRES_OUT_NORMAL]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_NORMAL);
- if(out[RRES_OUT_UV]->hasoutput)
+ if (out[RRES_OUT_UV]->hasoutput)
out[RRES_OUT_UV]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_UV);
- if(out[RRES_OUT_RGBA]->hasoutput)
+ if (out[RRES_OUT_RGBA]->hasoutput)
out[RRES_OUT_RGBA]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_RGBA);
- if(out[RRES_OUT_DIFF]->hasoutput)
+ if (out[RRES_OUT_DIFF]->hasoutput)
out[RRES_OUT_DIFF]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE);
- if(out[RRES_OUT_SPEC]->hasoutput)
+ if (out[RRES_OUT_SPEC]->hasoutput)
out[RRES_OUT_SPEC]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_SPEC);
- if(out[RRES_OUT_SHADOW]->hasoutput)
+ if (out[RRES_OUT_SHADOW]->hasoutput)
out[RRES_OUT_SHADOW]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_SHADOW);
- if(out[RRES_OUT_AO]->hasoutput)
+ if (out[RRES_OUT_AO]->hasoutput)
out[RRES_OUT_AO]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_AO);
- if(out[RRES_OUT_REFLECT]->hasoutput)
+ if (out[RRES_OUT_REFLECT]->hasoutput)
out[RRES_OUT_REFLECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_REFLECT);
- if(out[RRES_OUT_REFRACT]->hasoutput)
+ if (out[RRES_OUT_REFRACT]->hasoutput)
out[RRES_OUT_REFRACT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_REFRACT);
- if(out[RRES_OUT_INDIRECT]->hasoutput)
+ if (out[RRES_OUT_INDIRECT]->hasoutput)
out[RRES_OUT_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDIRECT);
- if(out[RRES_OUT_INDEXOB]->hasoutput)
+ if (out[RRES_OUT_INDEXOB]->hasoutput)
out[RRES_OUT_INDEXOB]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXOB);
- if(out[RRES_OUT_INDEXMA]->hasoutput)
+ if (out[RRES_OUT_INDEXMA]->hasoutput)
out[RRES_OUT_INDEXMA]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXMA);
- if(out[RRES_OUT_MIST]->hasoutput)
+ if (out[RRES_OUT_MIST]->hasoutput)
out[RRES_OUT_MIST]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_MIST);
- if(out[RRES_OUT_EMIT]->hasoutput)
+ if (out[RRES_OUT_EMIT]->hasoutput)
out[RRES_OUT_EMIT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_EMIT);
- if(out[RRES_OUT_ENV]->hasoutput)
+ if (out[RRES_OUT_ENV]->hasoutput)
out[RRES_OUT_ENV]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_ENVIRONMENT);
- if(out[RRES_OUT_DIFF_DIRECT]->hasoutput)
+ if (out[RRES_OUT_DIFF_DIRECT]->hasoutput)
out[RRES_OUT_DIFF_DIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE_DIRECT);
- if(out[RRES_OUT_DIFF_INDIRECT]->hasoutput)
+ if (out[RRES_OUT_DIFF_INDIRECT]->hasoutput)
out[RRES_OUT_DIFF_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE_INDIRECT);
- if(out[RRES_OUT_DIFF_COLOR]->hasoutput)
+ if (out[RRES_OUT_DIFF_COLOR]->hasoutput)
out[RRES_OUT_DIFF_COLOR]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE_COLOR);
- if(out[RRES_OUT_GLOSSY_DIRECT]->hasoutput)
+ if (out[RRES_OUT_GLOSSY_DIRECT]->hasoutput)
out[RRES_OUT_GLOSSY_DIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_GLOSSY_DIRECT);
- if(out[RRES_OUT_GLOSSY_INDIRECT]->hasoutput)
+ if (out[RRES_OUT_GLOSSY_INDIRECT]->hasoutput)
out[RRES_OUT_GLOSSY_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_GLOSSY_INDIRECT);
- if(out[RRES_OUT_GLOSSY_COLOR]->hasoutput)
+ if (out[RRES_OUT_GLOSSY_COLOR]->hasoutput)
out[RRES_OUT_GLOSSY_COLOR]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_GLOSSY_COLOR);
- if(out[RRES_OUT_TRANSM_DIRECT]->hasoutput)
+ if (out[RRES_OUT_TRANSM_DIRECT]->hasoutput)
out[RRES_OUT_TRANSM_DIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_TRANSM_DIRECT);
- if(out[RRES_OUT_TRANSM_INDIRECT]->hasoutput)
+ if (out[RRES_OUT_TRANSM_INDIRECT]->hasoutput)
out[RRES_OUT_TRANSM_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_TRANSM_INDIRECT);
- if(out[RRES_OUT_TRANSM_COLOR]->hasoutput)
+ if (out[RRES_OUT_TRANSM_COLOR]->hasoutput)
out[RRES_OUT_TRANSM_COLOR]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_TRANSM_COLOR);
}
@@ -273,7 +273,7 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
/* image assigned to output */
/* stack order input sockets: col, alpha */
- if(node->id) {
+ if (node->id) {
RenderData *rd= data;
Image *ima= (Image *)node->id;
ImageUser *iuser= (ImageUser *)node->storage;
@@ -283,13 +283,13 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
BKE_image_user_calc_frame(iuser, rd->cfra, 0);
/* force a load, we assume iuser index will be set OK anyway */
- if(ima->type==IMA_TYPE_MULTILAYER)
+ if (ima->type==IMA_TYPE_MULTILAYER)
BKE_image_get_ibuf(ima, iuser);
- if(ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
+ if (ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
- if(rl) {
+ if (rl) {
out[0]->data= stackbuf= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_COMBINED);
/* go over all layers */
@@ -325,14 +325,14 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
/* put image on stack */
out[0]->data= stackbuf;
- if(out[2]->hasoutput)
+ if (out[2]->hasoutput)
out[2]->data= node_composit_get_zimage(node, rd);
}
}
/* alpha and preview for both types */
- if(stackbuf) {
- if(out[1]->hasoutput)
+ if (stackbuf) {
+ if (out[1]->hasoutput)
out[1]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A);
generate_preview(data, node, stackbuf);
@@ -370,18 +370,18 @@ void register_node_type_cmp_image(bNodeTreeType *ttype)
static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, int recty, int passcode)
{
float *fp= RE_RenderLayerGetPass(rl, passcode);
- if(fp) {
+ if (fp) {
CompBuf *buf;
int buftype= CB_VEC3;
- if(ELEM4(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST, SCE_PASS_INDEXMA))
+ if (ELEM4(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST, SCE_PASS_INDEXMA))
buftype= CB_VAL;
- else if(passcode==SCE_PASS_VECTOR)
+ else if (passcode==SCE_PASS_VECTOR)
buftype= CB_VEC4;
- else if(ELEM(passcode, SCE_PASS_COMBINED, SCE_PASS_RGBA))
+ else if (ELEM(passcode, SCE_PASS_COMBINED, SCE_PASS_RGBA))
buftype= CB_RGBA;
- if(rd->scemode & R_COMP_CROP)
+ if (rd->scemode & R_COMP_CROP)
buf= get_cropped_compbuf(&rd->disprect, fp, rectx, recty, buftype);
else {
buf= alloc_compbuf(rectx, recty, buftype, 0);
@@ -394,58 +394,58 @@ static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, in
static void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out, int rectx, int recty)
{
- if(out[RRES_OUT_Z]->hasoutput)
+ if (out[RRES_OUT_Z]->hasoutput)
out[RRES_OUT_Z]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_Z);
- if(out[RRES_OUT_VEC]->hasoutput)
+ if (out[RRES_OUT_VEC]->hasoutput)
out[RRES_OUT_VEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_VECTOR);
- if(out[RRES_OUT_NORMAL]->hasoutput)
+ if (out[RRES_OUT_NORMAL]->hasoutput)
out[RRES_OUT_NORMAL]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_NORMAL);
- if(out[RRES_OUT_UV]->hasoutput)
+ if (out[RRES_OUT_UV]->hasoutput)
out[RRES_OUT_UV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_UV);
- if(out[RRES_OUT_RGBA]->hasoutput)
+ if (out[RRES_OUT_RGBA]->hasoutput)
out[RRES_OUT_RGBA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_RGBA);
- if(out[RRES_OUT_DIFF]->hasoutput)
+ if (out[RRES_OUT_DIFF]->hasoutput)
out[RRES_OUT_DIFF]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE);
- if(out[RRES_OUT_SPEC]->hasoutput)
+ if (out[RRES_OUT_SPEC]->hasoutput)
out[RRES_OUT_SPEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SPEC);
- if(out[RRES_OUT_SHADOW]->hasoutput)
+ if (out[RRES_OUT_SHADOW]->hasoutput)
out[RRES_OUT_SHADOW]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SHADOW);
- if(out[RRES_OUT_AO]->hasoutput)
+ if (out[RRES_OUT_AO]->hasoutput)
out[RRES_OUT_AO]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_AO);
- if(out[RRES_OUT_REFLECT]->hasoutput)
+ if (out[RRES_OUT_REFLECT]->hasoutput)
out[RRES_OUT_REFLECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFLECT);
- if(out[RRES_OUT_REFRACT]->hasoutput)
+ if (out[RRES_OUT_REFRACT]->hasoutput)
out[RRES_OUT_REFRACT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFRACT);
- if(out[RRES_OUT_INDIRECT]->hasoutput)
+ if (out[RRES_OUT_INDIRECT]->hasoutput)
out[RRES_OUT_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDIRECT);
- if(out[RRES_OUT_INDEXOB]->hasoutput)
+ if (out[RRES_OUT_INDEXOB]->hasoutput)
out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB);
- if(out[RRES_OUT_INDEXMA]->hasoutput)
+ if (out[RRES_OUT_INDEXMA]->hasoutput)
out[RRES_OUT_INDEXMA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXMA);
- if(out[RRES_OUT_MIST]->hasoutput)
+ if (out[RRES_OUT_MIST]->hasoutput)
out[RRES_OUT_MIST]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_MIST);
- if(out[RRES_OUT_EMIT]->hasoutput)
+ if (out[RRES_OUT_EMIT]->hasoutput)
out[RRES_OUT_EMIT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_EMIT);
- if(out[RRES_OUT_ENV]->hasoutput)
+ if (out[RRES_OUT_ENV]->hasoutput)
out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT);
- if(out[RRES_OUT_DIFF_DIRECT]->hasoutput)
+ if (out[RRES_OUT_DIFF_DIRECT]->hasoutput)
out[RRES_OUT_DIFF_DIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE_DIRECT);
- if(out[RRES_OUT_DIFF_INDIRECT]->hasoutput)
+ if (out[RRES_OUT_DIFF_INDIRECT]->hasoutput)
out[RRES_OUT_DIFF_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE_INDIRECT);
- if(out[RRES_OUT_DIFF_COLOR]->hasoutput)
+ if (out[RRES_OUT_DIFF_COLOR]->hasoutput)
out[RRES_OUT_DIFF_COLOR]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE_COLOR);
- if(out[RRES_OUT_GLOSSY_DIRECT]->hasoutput)
+ if (out[RRES_OUT_GLOSSY_DIRECT]->hasoutput)
out[RRES_OUT_GLOSSY_DIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_GLOSSY_DIRECT);
- if(out[RRES_OUT_GLOSSY_INDIRECT]->hasoutput)
+ if (out[RRES_OUT_GLOSSY_INDIRECT]->hasoutput)
out[RRES_OUT_GLOSSY_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_GLOSSY_INDIRECT);
- if(out[RRES_OUT_GLOSSY_COLOR]->hasoutput)
+ if (out[RRES_OUT_GLOSSY_COLOR]->hasoutput)
out[RRES_OUT_GLOSSY_COLOR]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_GLOSSY_COLOR);
- if(out[RRES_OUT_TRANSM_DIRECT]->hasoutput)
+ if (out[RRES_OUT_TRANSM_DIRECT]->hasoutput)
out[RRES_OUT_TRANSM_DIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_TRANSM_DIRECT);
- if(out[RRES_OUT_TRANSM_INDIRECT]->hasoutput)
+ if (out[RRES_OUT_TRANSM_INDIRECT]->hasoutput)
out[RRES_OUT_TRANSM_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_TRANSM_INDIRECT);
- if(out[RRES_OUT_TRANSM_COLOR]->hasoutput)
+ if (out[RRES_OUT_TRANSM_COLOR]->hasoutput)
out[RRES_OUT_TRANSM_COLOR]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_TRANSM_COLOR);
}
@@ -456,24 +456,24 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU
RenderData *rd= data;
RenderResult *rr= NULL;
- if(re)
+ if (re)
rr= RE_AcquireResultRead(re);
- if(rr) {
+ if (rr) {
SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
- if(srl) {
+ if (srl) {
RenderLayer *rl= RE_GetRenderLayer(rr, srl->name);
- if(rl && rl->rectf) {
+ if (rl && rl->rectf) {
CompBuf *stackbuf;
/* we put render rect on stack, cbuf knows rect is from other ibuf when freed! */
- if(rd->scemode & R_COMP_CROP)
+ if (rd->scemode & R_COMP_CROP)
stackbuf= get_cropped_compbuf(&rd->disprect, rl->rectf, rr->rectx, rr->recty, CB_RGBA);
else {
stackbuf= alloc_compbuf(rr->rectx, rr->recty, CB_RGBA, 0);
stackbuf->rect= rl->rectf;
}
- if(stackbuf==NULL) {
+ if (stackbuf==NULL) {
printf("Error; Preview Panel in UV Window returns zero sized image\n");
}
else {
@@ -483,7 +483,7 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU
/* put on stack */
out[RRES_OUT_IMAGE]->data= stackbuf;
- if(out[RRES_OUT_ALPHA]->hasoutput)
+ if (out[RRES_OUT_ALPHA]->hasoutput)
out[RRES_OUT_ALPHA]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A);
node_composit_rlayers_out(rd, rl, out, rr->rectx, rr->recty);
@@ -494,7 +494,7 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU
}
}
- if(re)
+ if (re)
RE_ReleaseResult(re);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c
index 4fda90e0a1e..8f3a6fc2e25 100644
--- a/source/blender/nodes/composite/nodes/node_composite_invert.c
+++ b/source/blender/nodes/composite/nodes/node_composite_invert.c
@@ -45,14 +45,16 @@ static bNodeSocketTemplate cmp_node_invert_out[]= {
static void do_invert(bNode *node, float *out, float *in)
{
- if(node->custom1 & CMP_CHAN_RGB) {
+ if (node->custom1 & CMP_CHAN_RGB) {
out[0] = 1.0f - in[0];
out[1] = 1.0f - in[1];
out[2] = 1.0f - in[2];
- } else
+ }
+ else {
copy_v3_v3(out, in);
+ }
- if(node->custom1 & CMP_CHAN_A)
+ if (node->custom1 & CMP_CHAN_A)
out[3] = 1.0f - in[3];
else
out[3] = in[3];
@@ -67,12 +69,12 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac)
/* blend inverted result against original input with fac */
facm = 1.0f - fac[0];
- if(node->custom1 & CMP_CHAN_RGB) {
+ if (node->custom1 & CMP_CHAN_RGB) {
col[0] = fac[0]*col[0] + (facm*in[0]);
col[1] = fac[0]*col[1] + (facm*in[1]);
col[2] = fac[0]*col[2] + (facm*in[2]);
}
- if(node->custom1 & CMP_CHAN_A)
+ if (node->custom1 & CMP_CHAN_A)
col[3] = fac[0]*col[3] + (facm*in[3]);
copy_v4_v4(out, col);
@@ -84,10 +86,10 @@ static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStac
/* stack order out: Image */
float *fac= in[0]->vec;
- if(out[0]->hasoutput==0) return;
+ if (out[0]->hasoutput==0) return;
/* input no image? then only color operation */
- if(in[1]->data==NULL && in[0]->data==NULL) {
+ if (in[1]->data==NULL && in[0]->data==NULL) {
do_invert_fac(node, out[0]->vec, in[1]->vec, fac);
}
else {
@@ -105,7 +107,8 @@ static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStac
out[0]->data= stackbuf;
return;
- } else {
+ }
+ else {
out[0]->data = pass_on_compbuf(cbuf);
return;
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c
index 9417e504a1b..ec6d2006296 100644
--- a/source/blender/nodes/composite/nodes/node_composite_levels.c
+++ b/source/blender/nodes/composite/nodes/node_composite_levels.c
@@ -57,13 +57,13 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins)
int x,y;
/*fill bins */
- for(y=0; y<in->y; y++) {
- for(x=0; x<in->x; x++) {
+ for (y=0; y<in->y; y++) {
+ for (x=0; x<in->x; x++) {
/* get the pixel */
qd_getPixel(in, x, y, value);
- if(value[3] > 0.0f) { /* don't count transparent pixels */
+ if (value[3] > 0.0f) { /* don't count transparent pixels */
switch(node->custom1) {
case 1: { /* all colors */
rgb_tobw(value[0],value[1],value[2], &value[0]);
@@ -97,8 +97,8 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins)
} /*end switch */
/*clip*/
- if(ivalue<0) ivalue=0;
- if(ivalue>255) ivalue=255;
+ if (ivalue<0) ivalue=0;
+ if (ivalue>255) ivalue=255;
/*put in the correct bin*/
bins[ivalue]+=1;
@@ -114,13 +114,13 @@ static float brightness_mean(bNode* node, CompBuf* in)
int x,y;
float value[4];
- for(x=0; x< in->x; x++) {
- for(y=0; y < in->y; y++) {
+ for (x=0; x< in->x; x++) {
+ for (y=0; y < in->y; y++) {
/* get the pixel */
qd_getPixel(in, x, y, value);
- if(value[3] > 0.0f) { /* don't count transparent pixels */
+ if (value[3] > 0.0f) { /* don't count transparent pixels */
numPixels++;
switch(node->custom1)
{
@@ -166,13 +166,13 @@ static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean)
int x,y;
float value[4];
- for(x=0; x< in->x; x++) {
- for(y=0; y < in->y; y++) {
+ for (x=0; x< in->x; x++) {
+ for (y=0; y < in->y; y++) {
/* get the pixel */
qd_getPixel(in, x, y, value);
- if(value[3] > 0.0f) { /* don't count transparent pixels */
+ if (value[3] > 0.0f) { /* don't count transparent pixels */
numPixels++;
switch(node->custom1)
{
@@ -224,18 +224,18 @@ static void draw_histogram(bNode *node, CompBuf *out, int* bins)
/* find max value */
max=0;
- for(x=0; x<256; x++) {
- if(bins[x]>max) max=bins[x];
+ for (x=0; x<256; x++) {
+ if (bins[x]>max) max=bins[x];
}
/*draw histogram in buffer */
- for(x=0; x<out->x; x++) {
- for(y=0;y<out->y; y++) {
+ for (x=0; x<out->x; x++) {
+ for (y=0;y<out->y; y++) {
/* get normalized value (0..255) */
value=((float)bins[x]/(float)max)*255.0f;
- if(y < (int)value) { /*if the y value is below the height of the bar for this line then draw with the color */
+ if (y < (int)value) { /*if the y value is below the height of the bar for this line then draw with the color */
switch (node->custom1) {
case 1: { /* draw in black */
color[0]=0.0; color[1]=0.0; color[2]=0.0; color[3]=1.0;
@@ -259,7 +259,7 @@ static void draw_histogram(bNode *node, CompBuf *out, int* bins)
}
}
}
- else{
+ else {
color[0]=0.8; color[1]=0.8; color[2]=0.8; color[3]=1.0;
}
@@ -277,14 +277,14 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
int bins[256];
int x;
- if(in[0]->hasinput==0) return;
- if(in[0]->data==NULL) return;
+ if (in[0]->hasinput==0) return;
+ if (in[0]->data==NULL) return;
histogram=alloc_compbuf(256, 256, CB_RGBA, 1);
cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
/*initalize bins*/
- for(x=0; x<256; x++) {
+ for (x=0; x<256; x++) {
bins[x]=0;
}
@@ -303,14 +303,14 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
printf("Std Dev: %f\n", std_dev);
*/
- if(out[0]->hasoutput)
+ if (out[0]->hasoutput)
out[0]->vec[0]= mean;
- if(out[1]->hasoutput)
+ if (out[1]->hasoutput)
out[1]->vec[0]= std_dev;
generate_preview(data, node, histogram);
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
free_compbuf(histogram);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
index ad5e9d423e5..85c291fd9ec 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
@@ -51,10 +51,10 @@ static void do_luma_matte(bNode *node, float *out, float *in)
float alpha;
/* test range*/
- if(in[0]>c->t1) {
+ if (in[0]>c->t1) {
alpha=1.0;
}
- else if(in[0]<c->t2){
+ else if (in[0]<c->t2) {
alpha=0.0;
}
else {/*blend */
@@ -76,9 +76,9 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack **
CompBuf *cbuf;
CompBuf *outbuf;
- if(in[0]->hasinput==0) return;
- if(in[0]->data==NULL) return;
- if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
+ 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);
@@ -92,7 +92,7 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack **
out[0]->data=outbuf;
if (out[1]->hasoutput)
out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A);
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
index 1ca729c8393..7d62e6b8030 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
@@ -64,10 +64,10 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
sx= stackbuf->x;
sy= stackbuf->y;
- for(y=0; y<sy; y++) {
- for(x=0; x<sx; x++, out+=4, uv+=3, uvnext+=3, uvprev+=3) {
- if(x>0 && x<sx-1 && y>0 && y<sy-1) {
- if(uv[2]!=0.0f) {
+ for (y=0; y<sy; y++) {
+ for (x=0; x<sx; x++, out+=4, uv+=3, uvnext+=3, uvprev+=3) {
+ if (x>0 && x<sx-1 && y>0 && y<sy-1) {
+ if (uv[2]!=0.0f) {
float uv_l, uv_r;
/* adaptive sampling, red (U) channel */
@@ -113,16 +113,16 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
/* UV to alpha threshold */
alpha= 1.0f - threshold*(dx+dy);
- if(alpha<0.0f) alpha= 0.0f;
+ if (alpha<0.0f) alpha= 0.0f;
else alpha*= uv[2];
/* should use mipmap */
- if(dx > 0.20f) dx= 0.20f;
- if(dy > 0.20f) dy= 0.20f;
+ if (dx > 0.20f) dx= 0.20f;
+ if (dy > 0.20f) dy= 0.20f;
ibuf_sample(ibuf, uv[0], uv[1], dx, dy, out);
/* premul */
- if(alpha<1.0f) {
+ if (alpha<1.0f) {
out[0]*= alpha;
out[1]*= alpha;
out[2]*= alpha;
@@ -139,10 +139,10 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
- if(in[0]->data && in[1]->data) {
+ if (in[0]->data && in[1]->data) {
CompBuf *cbuf= in[0]->data;
CompBuf *uvbuf= in[1]->data;
CompBuf *stackbuf;
@@ -155,9 +155,9 @@ static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack
out[0]->data= stackbuf;
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
- if(uvbuf!=in[1]->data)
+ if (uvbuf!=in[1]->data)
free_compbuf(uvbuf);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
index 380aa0b716b..2fd115261f8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
@@ -47,11 +47,11 @@ static void do_map_value(bNode *node, float *out, float *src)
TexMapping *texmap= node->storage;
out[0]= (src[0] + texmap->loc[0])*texmap->size[0];
- if(texmap->flag & TEXMAP_CLIP_MIN)
- if(out[0]<texmap->min[0])
+ if (texmap->flag & TEXMAP_CLIP_MIN)
+ if (out[0]<texmap->min[0])
out[0]= texmap->min[0];
- if(texmap->flag & TEXMAP_CLIP_MAX)
- if(out[0]>texmap->max[0])
+ if (texmap->flag & TEXMAP_CLIP_MAX)
+ if (out[0]>texmap->max[0])
out[0]= texmap->max[0];
}
@@ -59,10 +59,10 @@ static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeS
{
/* stack order in: valbuf */
/* stack order out: valbuf */
- if(out[0]->hasoutput==0) return;
+ if (out[0]->hasoutput==0) return;
/* input no image? then only value operation */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
do_map_value(node, out[0]->vec, in[0]->vec);
}
else {
diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c
index 6c2cbb9a92b..6f3d2f6baaf 100644
--- a/source/blender/nodes/composite/nodes/node_composite_math.c
+++ b/source/blender/nodes/composite/nodes/node_composite_math.c
@@ -59,7 +59,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
break;
case 3: /* Divide */
{
- if(in2[0]==0) /* We don't want to divide by zero. */
+ if (in2[0]==0) /* We don't want to divide by zero. */
out[0]= 0.0;
else
out[0]= in[0] / in2[0];
@@ -77,7 +77,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
case 7: /* Arc-Sine */
{
/* Can't do the impossible... */
- if(in[0] <= 1 && in[0] >= -1 )
+ if (in[0] <= 1 && in[0] >= -1 )
out[0]= asin(in[0]);
else
out[0]= 0.0;
@@ -86,7 +86,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
case 8: /* Arc-Cosine */
{
/* Can't do the impossible... */
- if( in[0] <= 1 && in[0] >= -1 )
+ if ( in[0] <= 1 && in[0] >= -1 )
out[0]= acos(in[0]);
else
out[0]= 0.0;
@@ -98,14 +98,16 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
case 10: /* Power */
{
/* Only raise negative numbers by full integers */
- if( in[0] >= 0 ) {
+ if ( in[0] >= 0 ) {
out[0]= pow(in[0], in2[0]);
- } else {
+ }
+ else {
float y_mod_1 = fmod(in2[0], 1);
/* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */
if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
out[0]= powf(in[0], floorf(in2[0] + 0.5f));
- } else {
+ }
+ else {
out[0] = 0.0f;
}
}
@@ -114,7 +116,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
case 11: /* Logarithm */
{
/* Don't want any imaginary numbers... */
- if( in[0] > 0 && in2[0] > 0 )
+ if ( in[0] > 0 && in2[0] > 0 )
out[0]= log(in[0]) / log(in2[0]);
else
out[0]= 0.0;
@@ -122,7 +124,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
break;
case 12: /* Minimum */
{
- if( in[0] < in2[0] )
+ if ( in[0] < in2[0] )
out[0]= in[0];
else
out[0]= in2[0];
@@ -130,7 +132,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
break;
case 13: /* Maximum */
{
- if( in[0] > in2[0] )
+ if ( in[0] > in2[0] )
out[0]= in[0];
else
out[0]= in2[0];
@@ -139,7 +141,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
case 14: /* Round */
{
/* round by the second value */
- if( in2[0] != 0.0f )
+ if ( in2[0] != 0.0f )
out[0]= floorf(in[0] / in2[0] + 0.5f) * in2[0];
else
out[0]= floorf(in[0] + 0.5f);
@@ -147,7 +149,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
break;
case 15: /* Less Than */
{
- if( in[0] < in2[0] )
+ if ( in[0] < in2[0] )
out[0]= 1.0f;
else
out[0]= 0.0f;
@@ -155,7 +157,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
break;
case 16: /* Greater Than */
{
- if( in[0] > in2[0] )
+ if ( in[0] > in2[0] )
out[0]= 1.0f;
else
out[0]= 0.0f;
@@ -171,16 +173,16 @@ static void node_composit_exec_math(void *UNUSED(data), bNode *node, bNodeStack
CompBuf *stackbuf;
/* check for inputs and outputs for early out*/
- if(out[0]->hasoutput==0) return;
+ if (out[0]->hasoutput==0) return;
/* no image-color operation */
- if(in[0]->data==NULL && in[1]->data==NULL) {
+ if (in[0]->data==NULL && in[1]->data==NULL) {
do_math(node, out[0]->vec, in[0]->vec, in[1]->vec);
return;
}
/*create output based on first input */
- if(cbuf) {
+ if (cbuf) {
stackbuf=alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);
}
/* and if it doesn't exist use the second input since we
diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
index 0296fa417d6..6539e81beec 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
@@ -48,7 +48,7 @@ static void do_mix_rgb(bNode *node, float *out, float *in1, float *in2, float *f
float col[3];
copy_v3_v3(col, in1);
- if(node->custom2)
+ if (node->custom2)
ramp_blend(node->custom1, col, in2[3]*fac[0], in2);
else
ramp_blend(node->custom1, col, fac[0], in2);
@@ -62,10 +62,10 @@ static void node_composit_exec_mix_rgb(void *data, bNode *node, bNodeStack **in,
/* stack order out: Image */
float *fac= in[0]->vec;
- if(out[0]->hasoutput==0) return;
+ if (out[0]->hasoutput==0) return;
/* input no image? then only color operation */
- if(in[1]->data==NULL && in[2]->data==NULL) {
+ if (in[1]->data==NULL && in[2]->data==NULL) {
do_mix_rgb(node, out[0]->vec, in[1]->vec, in[2]->vec, fac);
}
else {
diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
index 6ec64ef7c09..dd2c169fe9a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
@@ -53,7 +53,7 @@ static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, Mov
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;
}
@@ -67,7 +67,7 @@ static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, Mov
}
/* now we need a float buffer from the image with matching color management */
- if(ibuf->channels == 4) {
+ if (ibuf->channels == 4) {
rect= node_composit_get_float_buffer(rd, ibuf, &alloc);
}
else {
@@ -76,16 +76,16 @@ static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, Mov
}
/* done coercing into the correct color management */
- if(!alloc) {
+ if (!alloc) {
rect= MEM_dupallocN(rect);
alloc= 1;
}
type= ibuf->channels;
- if(rd->scemode & R_COMP_CROP) {
+ if (rd->scemode & R_COMP_CROP) {
stackbuf= get_cropped_compbuf(&rd->disprect, rect, ibuf->x, ibuf->y, type);
- if(alloc)
+ if (alloc)
MEM_freeN(rect);
}
else {
@@ -102,7 +102,7 @@ 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) {
+ if (node->id) {
RenderData *rd= data;
MovieClip *clip= (MovieClip *)node->id;
MovieClipUser *user= (MovieClipUser *)node->storage;
@@ -118,7 +118,7 @@ static void node_composit_exec_movieclip(void *data, bNode *node, bNodeStack **U
/* put image on stack */
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,
diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
index bc3f648a374..d9f0da9b8aa 100644
--- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
+++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
@@ -30,6 +30,8 @@
* \ingroup cmpnodes
*/
+#include "BLF_translation.h"
+
#include "node_composite_util.h"
@@ -47,8 +49,8 @@ static bNodeSocketTemplate cmp_node_moviedistortion_out[]= {
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(in[0]->data) {
- if(node->id) {
+ 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);
@@ -56,7 +58,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
- if(ibuf) {
+ if (ibuf) {
RenderData *rd= data;
ImBuf *obuf;
MovieTracking *tracking= &clip->tracking;
@@ -70,10 +72,10 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
BKE_movieclip_get_size(clip, &user, &width, &height);
- if(!node->storage)
+ if (!node->storage)
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);
@@ -91,9 +93,10 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
/* pass on output and free */
out[0]->data= stackbuf;
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
- } else {
+ }
+ else {
CompBuf *cbuf= in[0]->data;
CompBuf *stackbuf= pass_on_compbuf(cbuf);
@@ -104,15 +107,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
static const char *label(bNode *node)
{
- if(node->custom1==0)
- return "Undistortion";
+ if (node->custom1==0)
+ return IFACE_("Undistortion");
else
- return "Distortion";
+ return IFACE_("Distortion");
}
static void storage_free(bNode *node)
{
- if(node->storage)
+ if (node->storage)
BKE_tracking_distortion_destroy(node->storage);
node->storage= NULL;
@@ -120,7 +123,7 @@ static void storage_free(bNode *node)
static void storage_copy(bNode *orig_node, bNode *new_node)
{
- if(orig_node->storage)
+ if (orig_node->storage)
new_node->storage= BKE_tracking_distortion_copy(orig_node->storage);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c
index 638f67c4207..e9b5f10172c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normal.c
@@ -63,12 +63,12 @@ static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStac
/* stack order output: normal, value */
/* input no image? then only vector op */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
copy_v3_v3(out[0]->vec, nor);
/* render normals point inside... the widget points outside */
out[1]->vec[0]= -dot_v3v3(out[0]->vec, in[0]->vec);
}
- else if(out[1]->hasoutput) {
+ else if (out[1]->hasoutput) {
/* make output size of input image */
CompBuf *cbuf= in[0]->data;
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); /* allocs */
diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c
index 455966e4f38..69386c3b816 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normalize.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c
@@ -65,10 +65,10 @@ static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeS
{
/* stack order in: valbuf */
/* stack order out: valbuf */
- if(out[0]->hasoutput==0) return;
+ if (out[0]->hasoutput==0) return;
/* Input has no image buffer? Then pass the value */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
copy_v4_v4(out[0]->vec, in[0]->vec);
}
else {
@@ -93,7 +93,8 @@ static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeS
if ((max-min) != 0.0f) {
mult = 1.0f/(max-min);
composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, NULL, &min, NULL, &mult, do_normalize, CB_VAL, CB_VAL, CB_VAL);
- } else {
+ }
+ else {
memcpy(stackbuf->rect, cbuf->rect, sizeof(float) * cbuf->x * cbuf->y);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index fc92c3aabc8..e93c250e756 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -55,7 +55,7 @@ bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, con
sock->storage = sockdata;
sock->struct_type = SOCK_STRUCT_OUTPUT_FILE;
- if(im_format) {
+ if (im_format) {
sockdata->format= *im_format;
if (BKE_imtype_is_movie(sockdata->format.imtype)) {
sockdata->format.imtype= R_IMF_IMTYPE_OPENEXR;
@@ -186,7 +186,7 @@ static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack
BLI_join_dirfile(path, FILE_MAX, nimf->base_path, sock->name);
BKE_makepicstring(filename, path, bmain->name, rd->cfra, format->imtype, (rd->scemode & R_EXTENSION), TRUE);
- if(0 == BKE_write_ibuf(ibuf, filename, format))
+ if (0 == BKE_write_ibuf(ibuf, filename, format))
printf("Cannot save Node File Output to %s\n", filename);
else
printf("Saved: %s\n", filename);
@@ -199,7 +199,7 @@ static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack
has_preview = 1;
}
- if(in[i]->data != cbuf)
+ if (in[i]->data != cbuf)
free_compbuf(cbuf);
}
}
@@ -287,7 +287,7 @@ static void exec_output_file_multilayer(RenderData *rd, bNode *node, bNodeStack
}
/* when the filename has no permissions, this can fail */
- if(IMB_exr_begin_write(exrhandle, filename, rectx, recty, nimf->format.exr_codec)) {
+ if (IMB_exr_begin_write(exrhandle, filename, rectx, recty, nimf->format.exr_codec)) {
IMB_exr_write_channels(exrhandle);
}
else {
diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
index bf934fcd0f7..3d8b0108bbb 100644
--- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c
+++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
@@ -46,17 +46,17 @@ static bNodeSocketTemplate cmp_node_premulkey_out[]= {
static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
- if(in[0]->data) {
+ if (in[0]->data) {
CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
stackbuf= dupalloc_compbuf(cbuf);
premul_compbuf(stackbuf, node->custom1 == 1);
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_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c
index 141fcef457f..6952817248d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rotate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c
@@ -48,10 +48,10 @@ static bNodeSocketTemplate cmp_node_rotate_out[]= {
static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
- if(in[0]->data) {
+ if (in[0]->data) {
CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* note, this returns zero'd image */
float rad, u, v, s, c, centx, centy, miny, maxy, minx, maxx;
@@ -75,14 +75,14 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac
ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0);
- if(ibuf && obuf){
+ if (ibuf && obuf) {
ibuf->rect_float=cbuf->rect;
obuf->rect_float=stackbuf->rect;
- for(y=miny; y<maxy; y++) {
+ for (y=miny; y<maxy; y++) {
yo= y+(int)centy;
- for(x=minx; x<maxx;x++) {
+ for (x=minx; x<maxx;x++) {
u=c*x + y*s + centx;
v=-s*x + c*y + centy;
xo= x+(int)centx;
@@ -115,7 +115,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac
/* pass on output and free */
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_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c
index 188449df5fb..38cce50904b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_scale.c
+++ b/source/blender/nodes/composite/nodes/node_composite_scale.c
@@ -49,27 +49,28 @@ static bNodeSocketTemplate cmp_node_scale_out[]= {
/* node->custom1 stores if input values are absolute or relative scale */
static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
- if(in[0]->data) {
+ if (in[0]->data) {
RenderData *rd= data;
CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
ImBuf *ibuf;
int newx, newy;
- if(node->custom1==CMP_SCALE_RELATIVE) {
+ if (node->custom1==CMP_SCALE_RELATIVE) {
newx= MAX2((int)(in[1]->vec[0]*cbuf->x), 1);
newy= MAX2((int)(in[2]->vec[0]*cbuf->y), 1);
}
- else if(node->custom1==CMP_SCALE_SCENEPERCENT) {
+ else if (node->custom1==CMP_SCALE_SCENEPERCENT) {
newx = cbuf->x * (rd->size / 100.0f);
newy = cbuf->y * (rd->size / 100.0f);
}
else if (node->custom1==CMP_SCALE_RENDERPERCENT) {
newx= (rd->xsch * rd->size)/100;
newy= (rd->ysch * rd->size)/100;
- } else { /* CMP_SCALE_ABSOLUTE */
+ }
+ else { /* CMP_SCALE_ABSOLUTE */
newx= MAX2((int)in[1]->vec[0], 1);
newy= MAX2((int)in[2]->vec[0], 1);
}
@@ -77,11 +78,11 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
newy= MIN2(newy, CMP_SCALE_MAX);
ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
- if(ibuf) {
+ if (ibuf) {
ibuf->rect_float= cbuf->rect;
IMB_scaleImBuf(ibuf, newx, newy);
- if(ibuf->rect_float == cbuf->rect) {
+ if (ibuf->rect_float == cbuf->rect) {
/* no scaling happened. */
stackbuf= pass_on_compbuf(in[0]->data);
}
@@ -105,7 +106,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
}
out[0]->data= stackbuf;
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
}
else if (node->custom1==CMP_SCALE_ABSOLUTE) {
@@ -120,7 +121,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
fp = stackbuf->rect;
a = stackbuf->x * stackbuf->y;
- while(a--) {
+ while (a--) {
copy_v4_v4(fp, in[0]->vec);
fp += 4;
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
index cde54cfd132..6dac2d16401 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
@@ -64,7 +64,7 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta
/* stack order in: col */
/* input no image? then only color operation */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
float h, s, v;
rgb_to_hsv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &h, &s, &v);
@@ -83,17 +83,17 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta
composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sephsva, CB_RGBA);
/* separate each of those channels */
- if(out[0]->hasoutput)
+ if (out[0]->hasoutput)
out[0]->data= valbuf_from_rgbabuf(cbuf2, CHAN_R);
- if(out[1]->hasoutput)
+ if (out[1]->hasoutput)
out[1]->data= valbuf_from_rgbabuf(cbuf2, CHAN_G);
- if(out[2]->hasoutput)
+ if (out[2]->hasoutput)
out[2]->data= valbuf_from_rgbabuf(cbuf2, CHAN_B);
- if(out[3]->hasoutput)
+ if (out[3]->hasoutput)
out[3]->data= valbuf_from_rgbabuf(cbuf2, CHAN_A);
/*not used anymore */
- if(cbuf2!=cbuf)
+ if (cbuf2!=cbuf)
free_compbuf(cbuf2);
free_compbuf(cbuf);
}
@@ -142,7 +142,7 @@ static void node_composit_exec_combhsva(void *UNUSED(data), bNode *node, bNodeSt
/* stack order in: 4 value channels */
/* input no image? then only color operation in HSV */
- if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
+ if ((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
hsv_to_rgb(in[0]->vec[0], in[1]->vec[0], in[2]->vec[0],
&out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2]);
out[0]->vec[3] = in[3]->vec[0];
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
index 1f0b504f161..be4a8ac76fe 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
@@ -51,7 +51,7 @@ static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node),
/* stack order in: col */
/* input no image? then only color operation */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
out[0]->vec[0] = in[0]->vec[0];
out[1]->vec[0] = in[0]->vec[1];
out[2]->vec[0] = in[0]->vec[2];
@@ -62,16 +62,16 @@ static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node),
CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
/* don't do any pixel processing, just copy the stack directly (faster, I presume) */
- if(out[0]->hasoutput)
+ if (out[0]->hasoutput)
out[0]->data= valbuf_from_rgbabuf(cbuf, CHAN_R);
- if(out[1]->hasoutput)
+ if (out[1]->hasoutput)
out[1]->data= valbuf_from_rgbabuf(cbuf, CHAN_G);
- if(out[2]->hasoutput)
+ if (out[2]->hasoutput)
out[2]->data= valbuf_from_rgbabuf(cbuf, CHAN_B);
- if(out[3]->hasoutput)
+ if (out[3]->hasoutput)
out[3]->data= valbuf_from_rgbabuf(cbuf, CHAN_A);
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
}
@@ -118,7 +118,7 @@ static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeSt
/* stack order in: 4 value channels */
/* input no image? then only color operation */
- if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
+ if ((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
out[0]->vec[0] = in[0]->vec[0];
out[0]->vec[1] = in[1]->vec[0];
out[0]->vec[2] = in[2]->vec[0];
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
index a5f827b094d..b12f08bb13d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
@@ -88,7 +88,7 @@ static void do_sepycca_jfif(bNode *UNUSED(node), float *out, float *in)
static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* input no image? then only color operation */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
float y, cb, cr;
switch(node->custom1)
@@ -132,17 +132,17 @@ static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeSta
}
/* separate each of those channels */
- if(out[0]->hasoutput)
+ if (out[0]->hasoutput)
out[0]->data= valbuf_from_rgbabuf(cbuf2, CHAN_R);
- if(out[1]->hasoutput)
+ if (out[1]->hasoutput)
out[1]->data= valbuf_from_rgbabuf(cbuf2, CHAN_G);
- if(out[2]->hasoutput)
+ if (out[2]->hasoutput)
out[2]->data= valbuf_from_rgbabuf(cbuf2, CHAN_B);
- if(out[3]->hasoutput)
+ if (out[3]->hasoutput)
out[3]->data= valbuf_from_rgbabuf(cbuf2, CHAN_A);
/*not used anymore */
- if(cbuf2!=cbuf)
+ if (cbuf2!=cbuf)
free_compbuf(cbuf2);
free_compbuf(cbuf);
}
@@ -235,7 +235,7 @@ static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeSt
/* stack order in: 4 value channels */
/* input no image? then only color operation */
- if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
+ if ((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
float y = in[0]->vec[0] * 255;
float cb = in[1]->vec[0] * 255;
float cr = in[2]->vec[0] * 255;
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
index 2a2f64a5209..8dd551643f5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
@@ -64,7 +64,7 @@ static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeSta
/* stack order in: col */
/* input no image? then only color operation */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
float y, u, v;
rgb_to_yuv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &u, &v);
@@ -83,17 +83,17 @@ static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeSta
composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepyuva, CB_RGBA);
/* separate each of those channels */
- if(out[0]->hasoutput)
+ if (out[0]->hasoutput)
out[0]->data= valbuf_from_rgbabuf(cbuf2, CHAN_R);
- if(out[1]->hasoutput)
+ if (out[1]->hasoutput)
out[1]->data= valbuf_from_rgbabuf(cbuf2, CHAN_G);
- if(out[2]->hasoutput)
+ if (out[2]->hasoutput)
out[2]->data= valbuf_from_rgbabuf(cbuf2, CHAN_B);
- if(out[3]->hasoutput)
+ if (out[3]->hasoutput)
out[3]->data= valbuf_from_rgbabuf(cbuf2, CHAN_A);
/*not used anymore */
- if(cbuf2!=cbuf)
+ if (cbuf2!=cbuf)
free_compbuf(cbuf2);
free_compbuf(cbuf);
}
@@ -143,7 +143,7 @@ static void node_composit_exec_combyuva(void *UNUSED(data), bNode *node, bNodeSt
/* stack order in: 4 value channels */
/* input no image? then only color operation */
- if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
+ if ((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
out[0]->vec[0] = in[0]->vec[0];
out[0]->vec[1] = in[1]->vec[0];
out[0]->vec[2] = in[2]->vec[0];
diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
index 6c24185bb88..646bcc47617 100644
--- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c
+++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
@@ -49,7 +49,7 @@ static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeSt
/* stack order in: col, alpha */
/* input no image? then only color operation */
- if(in[0]->data==NULL && in[1]->data==NULL) {
+ if (in[0]->data==NULL && in[1]->data==NULL) {
out[0]->vec[0] = in[0]->vec[0];
out[0]->vec[1] = in[0]->vec[1];
out[0]->vec[2] = in[0]->vec[2];
@@ -60,7 +60,7 @@ static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeSt
CompBuf *cbuf= in[0]->data?in[0]->data:in[1]->data;
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
- if(in[1]->data==NULL && in[1]->vec[0]==1.0f) {
+ if (in[1]->data==NULL && in[1]->vec[0]==1.0f) {
/* pass on image */
composit1_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, do_copy_rgb, CB_RGBA);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
index 16356098fe6..c2263053987 100644
--- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
@@ -41,7 +41,7 @@ static bNodeSocketTemplate cmp_node_splitviewer_in[]= {
static void do_copy_split_rgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *fac)
{
- if(*fac==0.0f) {
+ if (*fac==0.0f) {
copy_v4_v4(out, in1);
}
else {
@@ -54,10 +54,10 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
/* image assigned to output */
/* stack order input sockets: image image */
- if(in[0]->data==NULL || in[1]->data==NULL)
+ if (in[0]->data==NULL || in[1]->data==NULL)
return;
- if(node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */
+ if (node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */
Image *ima= (Image *)node->id;
RenderData *rd= data;
ImBuf *ibuf;
@@ -73,7 +73,7 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
/* always returns for viewer image, but we check nevertheless */
ibuf= BKE_image_acquire_ibuf(ima, node->storage, &lock);
- if(ibuf==NULL) {
+ if (ibuf==NULL) {
printf("node_composit_exec_viewer error\n");
BKE_image_release_ibuf(ima, lock);
return;
@@ -100,7 +100,7 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
/* Check which offset mode is selected and limit offset if needed */
- if(node->custom2 == 0) {
+ if (node->custom2 == 0) {
offset = buf1->x / 100.0f * node->custom1;
CLAMP(offset, 0, buf1->x);
}
@@ -109,17 +109,17 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
CLAMP(offset, 0, buf1->y);
}
- if(node->custom2 == 0) {
- for(y=0; y<buf1->y; y++) {
+ if (node->custom2 == 0) {
+ for (y=0; y<buf1->y; y++) {
float *fac= mask->rect + y*buf1->x;
- for(x=offset; x>0; x--, fac++)
+ for (x=offset; x>0; x--, fac++)
*fac= 1.0f;
}
}
else {
- for(y=0; y<offset; y++) {
+ for (y=0; y<offset; y++) {
float *fac= mask->rect + y*buf1->x;
- for(x=buf1->x; x>0; x--, fac++)
+ for (x=buf1->x; x>0; x--, fac++)
*fac= 1.0f;
}
}
@@ -132,9 +132,9 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
free_compbuf(cbuf);
free_compbuf(mask);
- if(in[0]->data != buf1)
+ if (in[0]->data != buf1)
free_compbuf(buf1);
- if(in[1]->data != buf2)
+ if (in[1]->data != buf2)
free_compbuf(buf2);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
index f41751b3e15..0eac85c4030 100644
--- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
+++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
@@ -47,7 +47,7 @@ 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) {
+ if (in[0]->data && node->id) {
RenderData *rd= data;
MovieClip *clip= (MovieClip *)node->id;
CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
@@ -61,7 +61,7 @@ static void node_composit_exec_stabilize2d(void *data, bNode *node, bNodeStack *
/* pass on output and free */
out[0]->data= stackbuf;
- if(cbuf!=in[0]->data)
+ if (cbuf!=in[0]->data)
free_compbuf(cbuf);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c
index 7f8f14bcfc5..562e2b2737e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_texture.c
+++ b/source/blender/nodes/composite/nodes/node_composite_texture.c
@@ -60,19 +60,19 @@ static void texture_procedural(CompBuf *cbuf, float *out, float xco, float yco)
retval= multitex_ext((Tex *)node->id, vec, NULL, NULL, 0, &texres);
- if(type==CB_VAL) {
- if(texres.talpha)
+ if (type==CB_VAL) {
+ if (texres.talpha)
col[0]= texres.ta;
else
col[0]= texres.tin;
}
- else if(type==CB_RGBA) {
- if(texres.talpha)
+ else if (type==CB_RGBA) {
+ if (texres.talpha)
col[3]= texres.ta;
else
col[3]= texres.tin;
- if((retval & TEX_RGB)) {
+ if ((retval & TEX_RGB)) {
col[0]= texres.tr;
col[1]= texres.tg;
col[2]= texres.tb;
@@ -92,7 +92,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
{
/* outputs: value, color, normal */
- if(node->id) {
+ if (node->id) {
RenderData *rd= data;
short sizex, sizey;
@@ -113,7 +113,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
sizex = (rd->size*rd->xsch)/100;
sizey = (rd->size*rd->ysch)/100;
- if(out[0]->hasoutput) {
+ if (out[0]->hasoutput) {
CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_VAL, 1); /* alloc */
stackbuf->rect_procedural= texture_procedural;
@@ -126,7 +126,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
out[0]->data= stackbuf;
}
- if(out[1]->hasoutput) {
+ if (out[1]->hasoutput) {
CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_RGBA, 1); /* alloc */
stackbuf->rect_procedural= texture_procedural;
diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
index 9b34e117496..baa5ba046dd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c
+++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
@@ -142,7 +142,7 @@ static void node_composit_exec_tonemap(void *UNUSED(data), bNode *node, bNodeSta
out[0]->data = new;
- if(img!=in[0]->data)
+ if (img!=in[0]->data)
free_compbuf(img);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c
index a016f3d1d96..a610d8a66c4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_transform.c
+++ b/source/blender/nodes/composite/nodes/node_composite_transform.c
@@ -77,14 +77,14 @@ CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, f
ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
obuf= IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0);
- if(ibuf && obuf) {
+ if (ibuf && obuf) {
int i, j;
ibuf->rect_float= cbuf->rect;
obuf->rect_float= stackbuf->rect;
- for(j=0; j<cbuf->y; j++) {
- for(i=0; i<cbuf->x;i++) {
+ 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);
@@ -113,7 +113,7 @@ 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) {
+ if (in[0]->data) {
CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
CompBuf *stackbuf;
@@ -122,7 +122,7 @@ static void node_composit_exec_transform(void *UNUSED(data), bNode *node, bNodeS
/* pass on output and free */
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_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c
index 073b035add0..970e2c79f14 100644
--- a/source/blender/nodes/composite/nodes/node_composite_translate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_translate.c
@@ -48,7 +48,7 @@ static bNodeSocketTemplate cmp_node_translate_out[]= {
static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
- if(in[0]->data) {
+ if (in[0]->data) {
CompBuf *cbuf= in[0]->data;
CompBuf *stackbuf= pass_on_compbuf(cbuf);
diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
index 30f624641d1..86986f6038d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
@@ -54,12 +54,12 @@ static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeSt
/* stack order in: fac */
/* stack order out: col, alpha */
- if(out[0]->hasoutput==0 && out[1]->hasoutput==0)
+ if (out[0]->hasoutput==0 && out[1]->hasoutput==0)
return;
- if(node->storage) {
+ if (node->storage) {
/* input no image? then only color operation */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
do_colorband(node->storage, in[0]->vec[0], out[0]->vec);
}
else {
@@ -71,7 +71,7 @@ static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeSt
out[0]->data= stackbuf;
- if(out[1]->hasoutput)
+ if (out[1]->hasoutput)
out[1]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A);
}
@@ -119,11 +119,11 @@ static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeSta
/* stack order out: bw */
/* stack order in: col */
- if(out[0]->hasoutput==0)
+ if (out[0]->hasoutput==0)
return;
/* input no image? then only color operation */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
do_rgbtobw(node, out[0]->vec, in[0]->vec);
}
else {
diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
index 69f896e9bb5..1d4662aa87b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
@@ -52,21 +52,21 @@ static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeSta
NodeBlurData *nbd= node->storage;
CompBuf *new, *img= in[0]->data, *vecbuf= in[2]->data, *zbuf= in[1]->data;
- if(img==NULL || vecbuf==NULL || zbuf==NULL || out[0]->hasoutput==0)
+ if (img==NULL || vecbuf==NULL || zbuf==NULL || out[0]->hasoutput==0)
return;
- if(vecbuf->x!=img->x || vecbuf->y!=img->y) {
+ if (vecbuf->x!=img->x || vecbuf->y!=img->y) {
printf("ERROR: cannot do different sized vecbuf yet\n");
return;
}
- if(vecbuf->type!=CB_VEC4) {
+ if (vecbuf->type!=CB_VEC4) {
printf("ERROR: input should be vecbuf\n");
return;
}
- if(zbuf->type!=CB_VAL) {
+ if (zbuf->type!=CB_VAL) {
printf("ERROR: input should be zbuf\n");
return;
}
- if(zbuf->x!=img->x || zbuf->y!=img->y) {
+ if (zbuf->x!=img->x || zbuf->y!=img->y) {
printf("ERROR: cannot do different sized zbuf yet\n");
return;
}
@@ -81,7 +81,7 @@ static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeSta
out[0]->data= new;
- if(img!=in[0]->data)
+ if (img!=in[0]->data)
free_compbuf(img);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c
index f1a6cae62ab..f9b1e55f29f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_viewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c
@@ -47,7 +47,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
/* image assigned to output */
/* stack order input sockets: col, alpha, z */
- if(node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */
+ if (node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */
RenderData *rd= data;
Image *ima= (Image *)node->id;
ImBuf *ibuf;
@@ -59,7 +59,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
/* always returns for viewer image, but we check nevertheless */
ibuf= BKE_image_acquire_ibuf(ima, node->storage, &lock);
- if(ibuf==NULL) {
+ if (ibuf==NULL) {
printf("node_composit_exec_viewer error\n");
BKE_image_release_ibuf(ima, lock);
return;
@@ -72,7 +72,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
/* get size */
tbuf= in[0]->data?in[0]->data:(in[1]->data?in[1]->data:in[2]->data);
- if(tbuf==NULL) {
+ if (tbuf==NULL) {
rectx= 320; recty= 256;
}
else {
@@ -92,14 +92,14 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
cbuf->rect= ibuf->rect_float;
/* when no alpha, we can simply copy */
- if(in[1]->data==NULL) {
+ if (in[1]->data==NULL) {
composit1_pixel_processor(node, cbuf, in[0]->data, in[0]->vec, do_copy_rgba, CB_RGBA);
}
else
composit2_pixel_processor(node, cbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_copy_a_rgba, CB_RGBA, CB_VAL);
/* zbuf option */
- if(in[2]->data) {
+ if (in[2]->data) {
CompBuf *zbuf= alloc_compbuf(rectx, recty, CB_VAL, 1);
ibuf->zbuf_float= zbuf->rect;
ibuf->mall |= IB_zbuffloat;
@@ -117,7 +117,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
free_compbuf(cbuf);
}
- else if(in[0]->data) {
+ else if (in[0]->data) {
generate_preview(data, node, in[0]->data);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
index 57b0b7bbf14..64342751e84 100644
--- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c
+++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
@@ -53,7 +53,7 @@ static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *
float alpha;
float malpha;
- if(*z1 <= *z2) {
+ if (*z1 <= *z2) {
if (node->custom1) {
// use alpha in combine operation
alpha= src1[3];
@@ -83,16 +83,16 @@ static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *
copy_v4_v4(out, src1);
}
- if(node->custom2)
+ if (node->custom2)
*z1= *z2;
}
}
static void do_zcombine_mask(bNode *node, float *out, float *z1, float *z2)
{
- if(*z1 > *z2) {
+ if (*z1 > *z2) {
*out= 1.0f;
- if(node->custom2)
+ if (node->custom2)
*z1= *z2;
}
}
@@ -145,24 +145,24 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
/* stack order in: col z col z */
/* stack order out: col z */
- if(out[0]->hasoutput==0 && out[1]->hasoutput==0)
+ if (out[0]->hasoutput==0 && out[1]->hasoutput==0)
return;
/* no input image; do nothing now */
- if(in[0]->data==NULL) {
+ if (in[0]->data==NULL) {
return;
}
- if(out[1]->hasoutput) {
+ if (out[1]->hasoutput) {
/* copy or make a buffer for for the first z value, here we write result in */
- if(in[1]->data)
+ if (in[1]->data)
zbuf= dupalloc_compbuf(in[1]->data);
else {
float *zval;
int tot= cbuf->x*cbuf->y;
zbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);
- for(zval= zbuf->rect; tot; tot--, zval++)
+ for (zval= zbuf->rect; tot; tot--, zval++)
*zval= in[1]->vec[0];
}
/* lazy coder hack */
@@ -174,7 +174,7 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
zbuf= in[1]->data;
}
- if(rd->scemode & R_FULL_SAMPLE) {
+ if (rd->scemode & R_FULL_SAMPLE) {
/* make output size of first input image */
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); // allocs
@@ -199,16 +199,16 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
/* convert to char */
aabuf= MEM_mallocN(cbuf->x*cbuf->y, "aa buf");
fp= mbuf->rect;
- for(x= cbuf->x*cbuf->y-1; x>=0; x--)
- if(fp[x]==0.0f) aabuf[x]= 0;
+ for (x= cbuf->x*cbuf->y-1; x>=0; x--)
+ if (fp[x]==0.0f) aabuf[x]= 0;
else aabuf[x]= 255;
antialias_tagbuf(cbuf->x, cbuf->y, aabuf);
/* convert to float */
fp= mbuf->rect;
- for(x= cbuf->x*cbuf->y-1; x>=0; x--)
- if(aabuf[x]>1)
+ for (x= cbuf->x*cbuf->y-1; x>=0; x--)
+ if (aabuf[x]>1)
fp[x]= (1.0f/255.0f)*(float)aabuf[x];
composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[2]->data, in[2]->vec, mbuf, NULL,
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index e5571b19614..d2ec5ee032b 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -40,6 +40,8 @@
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_global.h"
@@ -103,7 +105,7 @@ bNodeSocket *node_group_add_extern_socket(bNodeTree *UNUSED(ntree), ListBase *lb
sock->default_value = node_socket_make_default_value(sock->type);
node_socket_copy_default_value(sock->type, sock->default_value, gsock->default_value);
- if(lb)
+ if (lb)
BLI_addtail(lb, sock);
return sock;
@@ -123,42 +125,42 @@ bNode *node_group_make_from_selected(bNodeTree *ntree)
INIT_MINMAX2(min, max);
/* is there something to group? also do some clearing */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->flag & NODE_SELECT) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->flag & NODE_SELECT) {
/* no groups in groups */
- if(node->type==NODE_GROUP)
+ if (node->type==NODE_GROUP)
return NULL;
DO_MINMAX2( (&node->locx), min, max);
totnode++;
}
node->done= 0;
}
- if(totnode==0) return NULL;
+ if (totnode==0) return NULL;
/* check if all connections are OK, no unselected node has both
inputs and outputs to a selection */
- for(link= ntree->links.first; link; link= link->next) {
- if(link->fromnode && link->tonode && link->fromnode->flag & NODE_SELECT)
+ for (link= ntree->links.first; link; link= link->next) {
+ if (link->fromnode && link->tonode && link->fromnode->flag & NODE_SELECT)
link->tonode->done |= 1;
- if(link->fromnode && link->tonode && link->tonode->flag & NODE_SELECT)
+ if (link->fromnode && link->tonode && link->tonode->flag & NODE_SELECT)
link->fromnode->done |= 2;
}
- for(node= ntree->nodes.first; node; node= node->next) {
- if((node->flag & NODE_SELECT)==0)
- if(node->done==3)
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if ((node->flag & NODE_SELECT)==0)
+ if (node->done==3)
break;
}
- if(node)
+ if (node)
return NULL;
/* OK! new nodetree */
ngroup= ntreeAddTree("NodeGroup", ntree->type, NODE_GROUP);
/* move nodes over */
- for(node= ntree->nodes.first; node; node= nextn) {
+ for (node= ntree->nodes.first; node; node= nextn) {
nextn= node->next;
- if(node->flag & NODE_SELECT) {
+ if (node->flag & NODE_SELECT) {
/* keep track of this node's RNA "base" path (the part of the pat identifying the node)
* if the old nodetree has animation data which potentially covers this node
*/
@@ -208,20 +210,20 @@ bNode *node_group_make_from_selected(bNodeTree *ntree)
gnode->locy= 0.5f*(min[1]+max[1]);
/* relink external sockets */
- for(link= ntree->links.first; link; link= linkn) {
+ for (link= ntree->links.first; link; link= linkn) {
linkn= link->next;
- if(link->fromnode && link->tonode && (link->fromnode->flag & link->tonode->flag & NODE_SELECT)) {
+ if (link->fromnode && link->tonode && (link->fromnode->flag & link->tonode->flag & NODE_SELECT)) {
BLI_remlink(&ntree->links, link);
BLI_addtail(&ngroup->links, link);
}
- else if(link->tonode && (link->tonode->flag & NODE_SELECT)) {
+ else if (link->tonode && (link->tonode->flag & NODE_SELECT)) {
gsock = node_group_expose_socket(ngroup, link->tosock, SOCK_IN);
link->tosock->link = nodeAddLink(ngroup, NULL, gsock, link->tonode, link->tosock);
link->tosock = node_group_add_extern_socket(ntree, &gnode->inputs, SOCK_IN, gsock);
link->tonode = gnode;
}
- else if(link->fromnode && (link->fromnode->flag & NODE_SELECT)) {
+ else if (link->fromnode && (link->fromnode->flag & NODE_SELECT)) {
/* search for existing group node socket */
for (gsock=ngroup->outputs.first; gsock; gsock=gsock->next)
if (gsock->link && gsock->link->fromsock==link->fromsock)
@@ -256,10 +258,10 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
ListBase anim_basepaths = {NULL, NULL};
ngroup= (bNodeTree *)gnode->id;
- if(ngroup==NULL) return 0;
+ if (ngroup==NULL) return 0;
/* clear new pointers, set in copytree */
- for(node= ntree->nodes.first; node; node= node->next)
+ for (node= ntree->nodes.first; node; node= node->next)
node->new_node= NULL;
/* wgroup is a temporary copy of the NodeTree we're merging in
@@ -269,7 +271,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
wgroup= ntreeCopyTree(ngroup);
/* add the nodes into the ntree */
- for(node= wgroup->nodes.first; node; node= nextn) {
+ for (node= wgroup->nodes.first; node; node= nextn) {
nextn= node->next;
/* keep track of this node's RNA "base" path (the part of the pat identifying the node)
@@ -297,7 +299,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
}
/* restore external links to and from the gnode */
- for(link= ntree->links.first; link; link= link->next) {
+ for (link= ntree->links.first; link; link= link->next) {
if (link->fromnode==gnode) {
if (link->fromsock->groupsock) {
bNodeSocket *gsock= link->fromsock->groupsock;
@@ -324,13 +326,13 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
}
}
/* remove internal output links, these are not used anymore */
- for(link=wgroup->links.first; link; link= linkn) {
+ for (link=wgroup->links.first; link; link= linkn) {
linkn = link->next;
if (!link->tonode)
nodeRemLink(wgroup, link);
}
/* restore links from internal nodes */
- for(link= wgroup->links.first; link; link= link->next) {
+ for (link= wgroup->links.first; link; link= link->next) {
/* indicates link to group input */
if (!link->fromnode) {
/* NB: can't use find_group_node_input here,
@@ -353,7 +355,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
}
/* add internal links to the ntree */
- for(link= wgroup->links.first; link; link= linkn) {
+ for (link= wgroup->links.first; link; link= linkn) {
linkn= link->next;
BLI_remlink(&wgroup->links, link);
BLI_addtail(&ntree->links, link);
@@ -487,7 +489,7 @@ void node_group_remove_socket(bNodeTree *ngroup, bNodeSocket *gsock, int in_out)
/* groups display their internal tree name as label */
const char *node_group_label(bNode *node)
{
- return (node->id)? node->id->name+2: "Missing Datablock";
+ return (node->id)? node->id->name+2: IFACE_("Missing Datablock");
}
int node_group_valid(bNodeTree *ntree, bNodeTemplate *ntemp)
@@ -541,11 +543,11 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_o
if (gsock->flag & SOCK_INTERNAL)
return NULL;
- for(sock= lb->first; sock; sock= sock->next) {
- if(sock->own_index==gsock->own_index)
+ for (sock= lb->first; sock; sock= sock->next) {
+ if (sock->own_index==gsock->own_index)
break;
}
- if(sock) {
+ if (sock) {
sock->groupsock = gsock;
BLI_strncpy(sock->name, gsock->name, sizeof(sock->name));
@@ -613,7 +615,7 @@ struct bNodeTree *node_group_edit_set(bNode *node, int edit)
if (edit) {
bNodeTree *ngroup= (bNodeTree*)node->id;
if (ngroup) {
- if(ngroup->id.lib)
+ if (ngroup->id.lib)
ntreeMakeLocal(ngroup);
node->flag |= NODE_GROUP_EDIT;
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index eaf19ad71b6..3b757e753a4 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -55,13 +55,13 @@ void node_get_stack(bNode *node, bNodeStack *stack, bNodeStack **in, bNodeStack
/* build pointer stack */
if (in) {
- for(sock= node->inputs.first; sock; sock= sock->next) {
+ for (sock= node->inputs.first; sock; sock= sock->next) {
*(in++) = node_get_socket_stack(stack, sock);
}
}
if (out) {
- for(sock= node->outputs.first; sock; sock= sock->next) {
+ for (sock= node->outputs.first; sock; sock= sock->next) {
*(out++) = node_get_socket_stack(stack, sock);
}
}
@@ -135,7 +135,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
bNode **nodelist;
int totnodes, n;
- if((ntree->init & NTREE_TYPE_INIT)==0)
+ if ((ntree->init & NTREE_TYPE_INIT)==0)
ntreeInitTypes(ntree);
/* get a dependency-sorted list of nodes */
@@ -147,10 +147,10 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
exec->nodetree = ntree;
/* group inputs essentially work as outputs */
- for(gsock=ntree->inputs.first; gsock; gsock = gsock->next)
+ for (gsock=ntree->inputs.first; gsock; gsock = gsock->next)
node_init_output_index(gsock, &index);
/* set stack indexes */
- for(n=0; n < totnodes; ++n) {
+ for (n=0; n < totnodes; ++n) {
node = nodelist[n];
node->stack_index = index;
@@ -162,7 +162,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
node_init_output_index(sock, &index);
}
/* group outputs essentially work as inputs */
- for(gsock=ntree->outputs.first; gsock; gsock = gsock->next)
+ for (gsock=ntree->outputs.first; gsock; gsock = gsock->next)
node_init_input_index(gsock, &index);
/* allocated exec data pointers for nodes */
@@ -181,13 +181,13 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
/* ns = */ setup_stack(exec->stack, sock);
}
/* prepare all internal nodes for execution */
- for(n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) {
+ for (n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) {
node = nodeexec->node = nodelist[n];
/* tag inputs */
for (sock=node->inputs.first; sock; sock=sock->next) {
/* disable the node if an input link is invalid */
- if(sock->link && !(sock->link->flag & NODE_LINK_VALID))
+ if (sock->link && !(sock->link->flag & NODE_LINK_VALID))
node->need_exec= 0;
ns = setup_stack(exec->stack, sock);
@@ -199,7 +199,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
/* ns = */ setup_stack(exec->stack, sock);
}
- if(node->typeinfo->initexecfunc)
+ if (node->typeinfo->initexecfunc)
nodeexec->data = node->typeinfo->initexecfunc(node);
}
/* prepare group tree outputs */
@@ -222,7 +222,7 @@ void ntree_exec_end(bNodeTreeExec *exec)
if (exec->stack)
MEM_freeN(exec->stack);
- for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
if (nodeexec->node->typeinfo->freeexecfunc)
nodeexec->node->typeinfo->freeexecfunc(nodeexec->node, nodeexec->data);
}
@@ -240,8 +240,8 @@ bNodeThreadStack *ntreeGetThreadStack(bNodeTreeExec *exec, int thread)
ListBase *lb= &exec->threadstack[thread];
bNodeThreadStack *nts;
- for(nts=lb->first; nts; nts=nts->next) {
- if(!nts->used) {
+ for (nts=lb->first; nts; nts=nts->next) {
+ if (!nts->used) {
nts->used= 1;
break;
}
@@ -272,15 +272,15 @@ void ntreeExecNodes(bNodeTreeExec *exec, void *callerdata, int thread)
/* nodes are presorted, so exec is in order of list */
- for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
node = nodeexec->node;
- if(node->need_exec) {
+ if (node->need_exec) {
node_get_stack(node, exec->stack, nsin, nsout);
/* Handle muted nodes...
* If the mute func is not set, assume the node should never be muted,
* and hence execute it!
*/
- if(node->typeinfo->execfunc)
+ if (node->typeinfo->execfunc)
node->typeinfo->execfunc(callerdata, node, nsin, nsout);
else if (node->typeinfo->newexecfunc)
node->typeinfo->newexecfunc(callerdata, thread, node, nodeexec->data, nsin, nsout);
@@ -298,15 +298,15 @@ void ntreeExecThreadNodes(bNodeTreeExec *exec, bNodeThreadStack *nts, void *call
/* nodes are presorted, so exec is in order of list */
- for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
node = nodeexec->node;
- if(node->need_exec) {
+ if (node->need_exec) {
node_get_stack(node, nts->stack, nsin, nsout);
/* Handle muted nodes...
* If the mute func is not set, assume the node should never be muted,
* and hence execute it!
*/
- if(node->typeinfo->execfunc)
+ if (node->typeinfo->execfunc)
node->typeinfo->execfunc(callerdata, node, nsin, nsout);
else if (node->typeinfo->newexecfunc)
node->typeinfo->newexecfunc(callerdata, thread, node, nodeexec->data, nsin, nsout);
diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c
index f03aff8fb92..4e6cf1f9bdd 100644
--- a/source/blender/nodes/intern/node_socket.c
+++ b/source/blender/nodes/intern/node_socket.c
@@ -485,13 +485,13 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in
{
bNodeSocket *sock;
- for(sock= socklist->first; sock; sock= sock->next) {
- if(!(sock->flag & SOCK_DYNAMIC) && strncmp(sock->name, stemp->name, NODE_MAXSTR)==0)
+ for (sock= socklist->first; sock; sock= sock->next) {
+ if (!(sock->flag & SOCK_DYNAMIC) && strncmp(sock->name, stemp->name, NODE_MAXSTR)==0)
break;
}
- if(sock) {
+ if (sock) {
sock->type= stemp->type; /* in future, read this from tydefs! */
- if(stemp->limit==0) sock->limit= 0xFFF;
+ if (stemp->limit==0) sock->limit= 0xFFF;
else sock->limit= stemp->limit;
sock->flag |= stemp->flag;
@@ -550,7 +550,7 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou
bNodeSocketTemplate *stemp;
/* no inputs anymore? */
- if(stemp_first==NULL) {
+ if (stemp_first==NULL) {
for (sock = (bNodeSocket*)socklist->first; sock; sock=nextsock) {
nextsock = sock->next;
if (!(sock->flag & SOCK_DYNAMIC))
@@ -560,7 +560,7 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou
else {
/* step by step compare */
stemp= stemp_first;
- while(stemp->type != -1) {
+ while (stemp->type != -1) {
stemp->sock= verify_socket_template(ntree, node, in_out, socklist, stemp);
stemp++;
}
@@ -578,14 +578,14 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou
* so we can add static sockets infront of it.
*/
sock = socklist->first;
- while(stemp->type != -1) {
+ while (stemp->type != -1) {
/* put static sockets infront of dynamic */
BLI_insertlinkbefore(socklist, sock, stemp->sock);
stemp++;
}
}
else {
- while(stemp->type != -1) {
+ while (stemp->type != -1) {
BLI_addtail(socklist, stemp->sock);
stemp++;
}
@@ -600,7 +600,7 @@ void node_verify_socket_templates(bNodeTree *ntree, bNode *node)
* This also prevents group node sockets from being removed, without the need to explicitly
* check the node type here.
*/
- if(ntype && ((ntype->inputs && ntype->inputs[0].type>=0) || (ntype->outputs && ntype->outputs[0].type>=0))) {
+ if (ntype && ((ntype->inputs && ntype->inputs[0].type>=0) || (ntype->outputs && ntype->outputs[0].type>=0))) {
verify_socket_template_list(ntree, node, SOCK_IN, &node->inputs, ntype->inputs);
verify_socket_template_list(ntree, node, SOCK_OUT, &node->outputs, ntype->outputs);
}
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c
index 19b3ba63f9a..1c38bdf39d7 100644
--- a/source/blender/nodes/intern/node_util.c
+++ b/source/blender/nodes/intern/node_util.c
@@ -36,6 +36,8 @@
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_colortools.h"
#include "BKE_node.h"
@@ -74,69 +76,95 @@ const char *node_blend_label(bNode *node)
{
const char *name;
RNA_enum_name(ramp_blend_items, node->custom1, &name);
- return name;
+ return IFACE_(name);
}
const char *node_math_label(bNode *node)
{
const char *name;
RNA_enum_name(node_math_items, node->custom1, &name);
- return name;
+ return IFACE_(name);
}
const char *node_vect_math_label(bNode *node)
{
const char *name;
RNA_enum_name(node_vec_math_items, node->custom1, &name);
- return name;
+ return IFACE_(name);
}
const char *node_filter_label(bNode *node)
{
const char *name;
RNA_enum_name(node_filter_items, node->custom1, &name);
- return name;
+ return IFACE_(name);
}
ListBase node_internal_connect_default(bNodeTree *ntree, bNode *node)
{
- static int types[] = { SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA };
- bNodeLink *link;
- bNodeSocket *fromsock, *tosock;
ListBase ret;
- int in, out, i;
+ bNodeSocket *fromsock_first=NULL, *tosock_first=NULL; /* used for fallback link if no other reconnections are found */
+ int datatype;
+ int num_links_in = 0, num_links_out = 0, num_reconnect = 0;
ret.first = ret.last = NULL;
/* Security check! */
- if(!ntree)
+ if (!ntree)
return ret;
- /* Connect the first input of each type with first output of the same type. */
-
- for (i=0; i < 3; ++i) {
- /* find input socket */
- for (in=0, fromsock=node->inputs.first; fromsock; in++, fromsock=fromsock->next) {
- if (fromsock->type==types[i] && nodeCountSocketLinks(ntree, fromsock) > 0)
+ for (datatype=0; datatype < NUM_SOCKET_TYPES; ++datatype) {
+ bNodeSocket *fromsock=NULL, *tosock=NULL;
+ bNodeLink *link;
+
+ /* Connect the first input of each type with outputs of the same type. */
+
+ for (link=ntree->links.first; link; link=link->next) {
+ if (link->tonode == node && link->tosock->type == datatype) {
+ fromsock = link->tosock;
+ ++num_links_in;
+ if (!fromsock_first)
+ fromsock_first = fromsock;
break;
- }
- if (fromsock) {
- for (out=0, tosock=node->outputs.first; tosock; out++, tosock=tosock->next) {
- if (tosock->type==types[i] && (nodeCountSocketLinks(ntree, tosock) > 0))
- break;
}
- if (tosock) {
- link = MEM_callocN(sizeof(bNodeLink), "internal node link");
- link->fromnode = node;
- link->fromsock = fromsock;
- link->tonode = node;
- link->tosock = tosock;
- /* internal link is always valid */
- link->flag |= NODE_LINK_VALID;
- BLI_addtail(&ret, link);
+ }
+
+ for (link=ntree->links.first; link; link=link->next) {
+ if (link->fromnode == node && link->fromsock->type == datatype) {
+ tosock = link->fromsock;
+ ++num_links_out;
+ if (!tosock_first)
+ tosock_first = tosock;
+
+ if (fromsock) {
+ bNodeLink *ilink = MEM_callocN(sizeof(bNodeLink), "internal node link");
+ ilink->fromnode = node;
+ ilink->fromsock = fromsock;
+ ilink->tonode = node;
+ ilink->tosock = tosock;
+ /* internal link is always valid */
+ ilink->flag |= NODE_LINK_VALID;
+ BLI_addtail(&ret, ilink);
+
+ ++num_reconnect;
+ }
}
}
}
-
+
+ /* if there is one input and one output link, but no reconnections by type,
+ * simply connect those two sockets.
+ */
+ if (num_reconnect==0 && num_links_in==1 && num_links_out==1) {
+ bNodeLink *ilink = MEM_callocN(sizeof(bNodeLink), "internal node link");
+ ilink->fromnode = node;
+ ilink->fromsock = fromsock_first;
+ ilink->tonode = node;
+ ilink->tosock = tosock_first;
+ /* internal link is always valid */
+ ilink->flag |= NODE_LINK_VALID;
+ BLI_addtail(&ret, ilink);
+ }
+
return ret;
}
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index e12ac4dee49..c028ca83664 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -65,16 +65,16 @@ static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
Lamp *la;
World *wo;
- for(ma= main->mat.first; ma; ma= ma->id.next)
- if(ma->nodetree)
+ for (ma= main->mat.first; ma; ma= ma->id.next)
+ if (ma->nodetree)
func(calldata, &ma->id, ma->nodetree);
- for(la= main->lamp.first; la; la= la->id.next)
- if(la->nodetree)
+ for (la= main->lamp.first; la; la= la->id.next)
+ if (la->nodetree)
func(calldata, &la->id, la->nodetree);
- for(wo= main->world.first; wo; wo= wo->id.next)
- if(wo->nodetree)
+ for (wo= main->world.first; wo; wo= wo->id.next)
+ if (wo->nodetree)
func(calldata, &wo->id, wo->nodetree);
}
@@ -83,7 +83,7 @@ static void foreach_nodeclass(Scene *scene, void *calldata, bNodeClassCallback f
func(calldata, NODE_CLASS_INPUT, IFACE_("Input"));
func(calldata, NODE_CLASS_OUTPUT, IFACE_("Output"));
- if(scene_use_new_shading_nodes(scene)) {
+ if (scene_use_new_shading_nodes(scene)) {
func(calldata, NODE_CLASS_SHADER, IFACE_("Shader"));
func(calldata, NODE_CLASS_TEXTURE, IFACE_("Texture"));
}
@@ -115,12 +115,12 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
bNode *lnode;
/* copy over contents of previews */
- for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
- if(ntreeNodeExists(ntree, lnode->new_node)) {
+ for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+ if (ntreeNodeExists(ntree, lnode->new_node)) {
bNode *node= lnode->new_node;
- if(node->preview && node->preview->rect) {
- if(lnode->preview && lnode->preview->rect) {
+ if (node->preview && node->preview->rect) {
+ if (lnode->preview && lnode->preview->rect) {
int xsize= node->preview->xsize;
int ysize= node->preview->ysize;
memcpy(node->preview->rect, lnode->preview->rect, 4*xsize + xsize*ysize*sizeof(char)*4);
@@ -202,7 +202,7 @@ bNodeTreeExec *ntreeShaderBeginExecTree(bNodeTree *ntree, int use_tree_data)
/* allocate the thread stack listbase array */
exec->threadstack= MEM_callocN(BLENDER_MAX_THREADS*sizeof(ListBase), "thread stack array");
- for(node= exec->nodetree->nodes.first; node; node= node->next)
+ for (node= exec->nodetree->nodes.first; node; node= node->next)
node->need_exec= 1;
if (use_tree_data) {
@@ -220,14 +220,14 @@ bNodeTreeExec *ntreeShaderBeginExecTree(bNodeTree *ntree, int use_tree_data)
*/
void ntreeShaderEndExecTree(bNodeTreeExec *exec, int use_tree_data)
{
- if(exec) {
+ if (exec) {
bNodeTree *ntree= exec->nodetree;
bNodeThreadStack *nts;
int a;
- if(exec->threadstack) {
- for(a=0; a<BLENDER_MAX_THREADS; a++) {
- for(nts=exec->threadstack[a].first; nts; nts=nts->next)
+ if (exec->threadstack) {
+ for (a=0; a<BLENDER_MAX_THREADS; a++) {
+ for (nts=exec->threadstack[a].first; nts; nts=nts->next)
if (nts->stack) MEM_freeN(nts->stack);
BLI_freelistN(&exec->threadstack[a]);
}
@@ -266,7 +266,7 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
/* ensure execdata is only initialized once */
if (!exec) {
BLI_lock_thread(LOCK_NODES);
- if(!ntree->execdata)
+ if (!ntree->execdata)
ntree->execdata = ntreeShaderBeginExecTree(ntree, 1);
BLI_unlock_thread(LOCK_NODES);
@@ -280,7 +280,7 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
// \note: set material back to preserved material
shi->mat = mat;
/* better not allow negative for now */
- if(shr->combined[0]<0.0f) shr->combined[0]= 0.0f;
- if(shr->combined[1]<0.0f) shr->combined[1]= 0.0f;
- if(shr->combined[2]<0.0f) shr->combined[2]= 0.0f;
+ if (shr->combined[0]<0.0f) shr->combined[0]= 0.0f;
+ if (shr->combined[1]<0.0f) shr->combined[1]= 0.0f;
+ if (shr->combined[2]<0.0f) shr->combined[2]= 0.0f;
}
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 6e79c4acbeb..df2f7879231 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -42,14 +42,14 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
{
float *from= ns->vec;
- if(type_in==SOCK_FLOAT) {
- if(ns->sockettype==SOCK_FLOAT)
+ if (type_in==SOCK_FLOAT) {
+ if (ns->sockettype==SOCK_FLOAT)
*in= *from;
else
*in= 0.333333f*(from[0]+from[1]+from[2]);
}
- else if(type_in==SOCK_VECTOR) {
- if(ns->sockettype==SOCK_FLOAT) {
+ else if (type_in==SOCK_VECTOR) {
+ if (ns->sockettype==SOCK_FLOAT) {
in[0]= from[0];
in[1]= from[0];
in[2]= from[0];
@@ -59,10 +59,10 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
}
}
else { /* type_in==SOCK_RGBA */
- if(ns->sockettype==SOCK_RGBA) {
+ if (ns->sockettype==SOCK_RGBA) {
copy_v4_v4(in, from);
}
- else if(ns->sockettype==SOCK_FLOAT) {
+ else if (ns->sockettype==SOCK_FLOAT) {
in[0]= from[0];
in[1]= from[0];
in[2]= from[0];
@@ -84,22 +84,22 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo
bNodeSocket *sock;
int a;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==SH_NODE_TEXTURE) {
- if((r_mode & R_OSA) && node->id) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type==SH_NODE_TEXTURE) {
+ if ((r_mode & R_OSA) && node->id) {
Tex *tex= (Tex *)node->id;
if ELEM3(tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP)
*texco |= TEXCO_OSA|NEED_UV;
}
/* usability exception... without input we still give the node orcos */
sock= node->inputs.first;
- if(sock==NULL || sock->link==NULL)
+ if (sock==NULL || sock->link==NULL)
*texco |= TEXCO_ORCO|NEED_UV;
}
- else if(node->type==SH_NODE_GEOMETRY) {
+ else if (node->type==SH_NODE_GEOMETRY) {
/* 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) {
+ for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
+ if (sock->flag & SOCK_IN_USE) {
switch(a) {
case GEOM_OUT_GLOB:
*texco |= TEXCO_GLOB|NEED_UV; break;
@@ -125,17 +125,17 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo
/* nodes that use ID data get synced with local data */
void nodeShaderSynchronizeID(bNode *node, int copyto)
{
- if(node->id==NULL) return;
+ if (node->id==NULL) return;
- if(ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
+ if (ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
bNodeSocket *sock;
Material *ma= (Material *)node->id;
int a;
- /* hrmf, case in loop isnt super fast, but we dont edit 100s of material at same time either! */
- for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
- if(!nodeSocketIsHidden(sock)) {
- if(copyto) {
+ /* hrmf, case in loop isn't super fast, but we don't edit 100s of material at same time either! */
+ for (a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
+ if (!nodeSocketIsHidden(sock)) {
+ if (copyto) {
switch(a) {
case MAT_IN_COLOR:
copy_v3_v3(&ma->r, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
@@ -249,19 +249,19 @@ bNode *nodeGetActiveTexture(bNodeTree *ntree)
/* this is the node we texture paint and draw in textured draw */
bNode *node;
- if(!ntree)
+ if (!ntree)
return NULL;
/* check for group edit */
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->flag & NODE_GROUP_EDIT)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->flag & NODE_GROUP_EDIT)
break;
- if(node)
+ if (node)
ntree= (bNodeTree*)node->id;
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->flag & NODE_ACTIVE_TEXTURE)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->flag & NODE_ACTIVE_TEXTURE)
return node;
return NULL;
@@ -280,31 +280,31 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs)
stack= exec->stack;
- for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
node = nodeexec->node;
doit = 0;
/* for groups, only execute outputs for edited group */
- if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
- if(do_outputs && (node->flag & NODE_DO_OUTPUT))
+ if (node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+ if (do_outputs && (node->flag & NODE_DO_OUTPUT))
doit = 1;
}
else
doit = 1;
if (doit) {
- if(node->typeinfo->gpufunc) {
+ if (node->typeinfo->gpufunc) {
node_get_stack(node, stack, nsin, nsout);
gpu_stack_from_data_list(gpuin, &node->inputs, nsin);
gpu_stack_from_data_list(gpuout, &node->outputs, nsout);
- if(node->typeinfo->gpufunc(mat, node, gpuin, gpuout))
+ if (node->typeinfo->gpufunc(mat, node, gpuin, gpuout))
data_from_gpu_stack_list(&node->outputs, nsout, gpuout);
}
- else if(node->typeinfo->gpuextfunc) {
+ else if (node->typeinfo->gpuextfunc) {
node_get_stack(node, stack, nsin, nsout);
gpu_stack_from_data_list(gpuin, &node->inputs, nsin);
gpu_stack_from_data_list(gpuout, &node->outputs, nsout);
- if(node->typeinfo->gpuextfunc(mat, node, nodeexec->data, gpuin, gpuout))
+ if (node->typeinfo->gpuextfunc(mat, node, nodeexec->data, gpuin, gpuout))
data_from_gpu_stack_list(&node->outputs, nsout, gpuout);
}
}
@@ -318,7 +318,7 @@ void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in
float domin= (texmap->flag & TEXMAP_CLIP_MIN) != 0;
float domax= (texmap->flag & TEXMAP_CLIP_MAX) != 0;
- if(domin || domax || !(texmap->flag & TEXMAP_UNIT_MATRIX)) {
+ if (domin || domax || !(texmap->flag & TEXMAP_UNIT_MATRIX)) {
GPUNodeLink *tmat = GPU_uniform((float*)texmap->mat);
GPUNodeLink *tmin = GPU_uniform(texmap->min);
GPUNodeLink *tmax = GPU_uniform(texmap->max);
diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c
index 3ec75dfa4fd..69a6a5c04a9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_camera.c
+++ b/source/blender/nodes/shader/nodes/node_shader_camera.c
@@ -43,7 +43,7 @@ static bNodeSocketTemplate sh_node_camera_out[]= {
static void node_shader_exec_camera(void *data, bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **out)
{
- if(data) {
+ if (data) {
ShadeInput *shi= ((ShaderCallData *)data)->shi; /* Data we need for shading. */
copy_v3_v3(out[0]->vec, shi->co); /* get view vector */
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c
index d30434f4e32..50bf4c58e4d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.c
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.c
@@ -106,7 +106,7 @@ static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeSta
/* stack order output: vec */
nodestack_get_vec(vec, SOCK_VECTOR, in[1]);
curvemapping_evaluateRGBF(node->storage, out[0]->vec, vec);
- if(in[0]->vec[0] != 1.0f) {
+ if (in[0]->vec[0] != 1.0f) {
interp_v3_v3v3(out[0]->vec, vec, out[0]->vec, *in[0]->vec);
}
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_dynamic.c b/source/blender/nodes/shader/nodes/node_shader_dynamic.c
index 0c6c53b38e4..5a6a92b5e27 100644
--- a/source/blender/nodes/shader/nodes/node_shader_dynamic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_dynamic.c
@@ -83,7 +83,7 @@ static bNodeType *node_dynamic_find_typeinfo(ListBase *list, ID *id)
{
bNodeType *ntype = list->first;
- while(ntype) {
+ while (ntype) {
if (ntype->type == NODE_DYNAMIC && ntype->id == id)
break;
ntype = ntype->next;
@@ -459,7 +459,8 @@ static int node_dynamic_parse(struct bNode *node)
if (!pyresult) {
if (BTST(node->custom1, NODE_DYNAMIC_LOADED)) {
node_dynamic_disable(node);
- } else {
+ }
+ else {
node_dynamic_disable_all_by_id(node->id);
}
node_dynamic_pyerror_print(node);
@@ -574,7 +575,8 @@ static void node_dynamic_setup(bNode *node)
}
else { nodeMakeDynamicType(node); }
- } else {
+ }
+ else {
node_dynamic_rem_all_links(node->typeinfo);
node_dynamic_free_typeinfo_sockets(node->typeinfo);
node_dynamic_update_socket_links(node, NULL);
diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c
index cf6f400ee2a..37ab8ac3f5b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_geom.c
+++ b/source/blender/nodes/shader/nodes/node_shader_geom.c
@@ -53,17 +53,17 @@ static bNodeSocketTemplate sh_node_geom_out[]= {
/* node execute callback */
static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
- if(data) {
+ if (data) {
ShadeInput *shi= ((ShaderCallData *)data)->shi;
NodeGeometry *ngeo= (NodeGeometry*)node->storage;
ShadeInputUV *suv= &shi->uv[shi->actuv];
static float defaultvcol[4] = {1.0f, 1.0f, 1.0f, 1.0f};
int i;
- if(ngeo->uvname[0]) {
+ if (ngeo->uvname[0]) {
/* find uv map by name */
- for(i = 0; i < shi->totuv; i++) {
- if(strcmp(shi->uv[i].name, ngeo->uvname)==0) {
+ for (i = 0; i < shi->totuv; i++) {
+ if (strcmp(shi->uv[i].name, ngeo->uvname)==0) {
suv= &shi->uv[i];
break;
}
@@ -82,9 +82,9 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
/* find vertex color layer by name */
ShadeInputCol *scol= &shi->col[0];
- if(ngeo->colname[0]) {
- for(i = 0; i < shi->totcol; i++) {
- if(strcmp(shi->col[i].name, ngeo->colname)==0) {
+ if (ngeo->colname[0]) {
+ for (i = 0; i < shi->totcol; i++) {
+ if (strcmp(shi->col[i].name, ngeo->colname)==0) {
scol= &shi->col[i];
break;
}
@@ -100,7 +100,7 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
out[GEOM_OUT_VCOL_ALPHA]->vec[0]= 1.0f;
}
- if(shi->osatex) {
+ if (shi->osatex) {
out[GEOM_OUT_GLOB]->data= shi->dxgl;
out[GEOM_OUT_GLOB]->datatype= NS_OSA_VECTORS;
out[GEOM_OUT_LOCAL]->data= shi->dxco;
diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
index 0f85196a45d..12b97e65be8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
@@ -50,12 +50,12 @@ static bNodeSocketTemplate sh_node_hue_sat_out[]= {
/* note: it would be possible to use CMP version for both nodes */
static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *sat, float *val, float *in, float *fac)
{
- if(*fac!=0.0f && (*hue!=0.5f || *sat!=1.0f || *val!=1.0f)) {
+ if (*fac!=0.0f && (*hue!=0.5f || *sat!=1.0f || *val!=1.0f)) {
float col[3], hsv[3], mfac= 1.0f - *fac;
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
hsv[0]+= (*hue - 0.5f);
- if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f;
+ if (hsv[0]>1.0f) hsv[0]-=1.0f; else if (hsv[0]<0.0f) hsv[0]+= 1.0f;
hsv[1]*= *sat;
hsv[2]*= *val;
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c
index c2a58d49161..b7b080fa2df 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mapping.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c
@@ -54,15 +54,15 @@ static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
mul_m4_v3(texmap->mat, vec);
- if(texmap->flag & TEXMAP_CLIP_MIN) {
- if(vec[0]<texmap->min[0]) vec[0]= texmap->min[0];
- if(vec[1]<texmap->min[1]) vec[1]= texmap->min[1];
- if(vec[2]<texmap->min[2]) vec[2]= texmap->min[2];
+ if (texmap->flag & TEXMAP_CLIP_MIN) {
+ if (vec[0]<texmap->min[0]) vec[0]= texmap->min[0];
+ if (vec[1]<texmap->min[1]) vec[1]= texmap->min[1];
+ if (vec[2]<texmap->min[2]) vec[2]= texmap->min[2];
}
- if(texmap->flag & TEXMAP_CLIP_MAX) {
- if(vec[0]>texmap->max[0]) vec[0]= texmap->max[0];
- if(vec[1]>texmap->max[1]) vec[1]= texmap->max[1];
- if(vec[2]>texmap->max[2]) vec[2]= texmap->max[2];
+ if (texmap->flag & TEXMAP_CLIP_MAX) {
+ if (vec[0]>texmap->max[0]) vec[0]= texmap->max[0];
+ if (vec[1]>texmap->max[1]) vec[1]= texmap->max[1];
+ if (vec[2]>texmap->max[2]) vec[2]= texmap->max[2];
}
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c
index decd3bb225f..279bbfa8d1b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_material.c
@@ -78,7 +78,7 @@ static bNodeSocketTemplate sh_node_material_ext_out[]= {
static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(data && node->id) {
+ if (data && node->id) {
ShadeResult shrnode;
ShadeInput *shi;
ShaderCallData *shcd= data;
@@ -103,17 +103,17 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
shi->har= shi->mat->har;
/* write values */
- if(hasinput[MAT_IN_COLOR])
+ if (hasinput[MAT_IN_COLOR])
nodestack_get_vec(&shi->r, SOCK_VECTOR, in[MAT_IN_COLOR]);
- if(hasinput[MAT_IN_SPEC])
+ if (hasinput[MAT_IN_SPEC])
nodestack_get_vec(&shi->specr, SOCK_VECTOR, in[MAT_IN_SPEC]);
- if(hasinput[MAT_IN_REFL])
+ if (hasinput[MAT_IN_REFL])
nodestack_get_vec(&shi->refl, SOCK_FLOAT, in[MAT_IN_REFL]);
/* retrieve normal */
- if(hasinput[MAT_IN_NORMAL]) {
+ if (hasinput[MAT_IN_NORMAL]) {
nodestack_get_vec(shi->vn, SOCK_VECTOR, in[MAT_IN_NORMAL]);
normalize_v3(shi->vn);
}
@@ -121,24 +121,24 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
copy_v3_v3(shi->vn, shi->vno);
/* custom option to flip normal */
- if(node->custom1 & SH_NODE_MAT_NEG) {
+ if (node->custom1 & SH_NODE_MAT_NEG) {
negate_v3(shi->vn);
}
if (node->type == SH_NODE_MATERIAL_EXT) {
- if(hasinput[MAT_IN_MIR])
+ if (hasinput[MAT_IN_MIR])
nodestack_get_vec(&shi->mirr, SOCK_VECTOR, in[MAT_IN_MIR]);
- if(hasinput[MAT_IN_AMB])
+ if (hasinput[MAT_IN_AMB])
nodestack_get_vec(&shi->amb, SOCK_FLOAT, in[MAT_IN_AMB]);
- if(hasinput[MAT_IN_EMIT])
+ if (hasinput[MAT_IN_EMIT])
nodestack_get_vec(&shi->emit, SOCK_FLOAT, in[MAT_IN_EMIT]);
- if(hasinput[MAT_IN_SPECTRA])
+ if (hasinput[MAT_IN_SPECTRA])
nodestack_get_vec(&shi->spectra, SOCK_FLOAT, in[MAT_IN_SPECTRA]);
- if(hasinput[MAT_IN_RAY_MIRROR])
+ if (hasinput[MAT_IN_RAY_MIRROR])
nodestack_get_vec(&shi->ray_mirror, SOCK_FLOAT, in[MAT_IN_RAY_MIRROR]);
- if(hasinput[MAT_IN_ALPHA])
+ if (hasinput[MAT_IN_ALPHA])
nodestack_get_vec(&shi->alpha, SOCK_FLOAT, in[MAT_IN_ALPHA]);
- if(hasinput[MAT_IN_TRANSLUCENCY])
+ if (hasinput[MAT_IN_TRANSLUCENCY])
nodestack_get_vec(&shi->translucency, SOCK_FLOAT, in[MAT_IN_TRANSLUCENCY]);
}
@@ -147,13 +147,13 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
shi->nodes= 0;
/* write to outputs */
- if(node->custom1 & SH_NODE_MAT_DIFF) {
+ if (node->custom1 & SH_NODE_MAT_DIFF) {
copy_v3_v3(col, shrnode.combined);
- if(!(node->custom1 & SH_NODE_MAT_SPEC)) {
+ if (!(node->custom1 & SH_NODE_MAT_SPEC)) {
sub_v3_v3(col, shrnode.spec);
}
}
- else if(node->custom1 & SH_NODE_MAT_SPEC) {
+ else if (node->custom1 & SH_NODE_MAT_SPEC) {
copy_v3_v3(col, shrnode.spec);
}
else
@@ -161,13 +161,13 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
col[3]= shrnode.alpha;
- if(shi->do_preview)
+ if (shi->do_preview)
nodeAddToPreview(node, col, shi->xs, shi->ys, shi->do_manage);
copy_v3_v3(out[MAT_OUT_COLOR]->vec, col);
out[MAT_OUT_ALPHA]->vec[0]= shrnode.alpha;
- if(node->custom1 & SH_NODE_MAT_NEG) {
+ if (node->custom1 & SH_NODE_MAT_NEG) {
shi->vn[0]= -shi->vn[0];
shi->vn[1]= -shi->vn[1];
shi->vn[2]= -shi->vn[2];
@@ -185,7 +185,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
}
/* copy passes, now just active node */
- if(node->flag & NODE_ACTIVE_ID) {
+ if (node->flag & NODE_ACTIVE_ID) {
float combined[4], alpha;
copy_v4_v4(combined, shcd->shr->combined);
@@ -218,7 +218,7 @@ static GPUNodeLink *gpu_get_input_link(GPUNodeStack *in)
static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(node->id) {
+ if (node->id) {
GPUShadeInput shi;
GPUShadeResult shr;
bNodeSocket *sock;
@@ -235,47 +235,47 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
GPU_shadeinput_set(mat, (Material*)node->id, &shi);
/* write values */
- if(hasinput[MAT_IN_COLOR])
+ if (hasinput[MAT_IN_COLOR])
shi.rgb = gpu_get_input_link(&in[MAT_IN_COLOR]);
- if(hasinput[MAT_IN_SPEC])
+ if (hasinput[MAT_IN_SPEC])
shi.specrgb = gpu_get_input_link(&in[MAT_IN_SPEC]);
- if(hasinput[MAT_IN_REFL])
+ if (hasinput[MAT_IN_REFL])
shi.refl = gpu_get_input_link(&in[MAT_IN_REFL]);
/* retrieve normal */
- if(hasinput[MAT_IN_NORMAL]) {
+ if (hasinput[MAT_IN_NORMAL]) {
GPUNodeLink *tmp;
shi.vn = gpu_get_input_link(&in[MAT_IN_NORMAL]);
GPU_link(mat, "vec_math_normalize", shi.vn, &shi.vn, &tmp);
}
/* custom option to flip normal */
- if(node->custom1 & SH_NODE_MAT_NEG)
+ if (node->custom1 & SH_NODE_MAT_NEG)
GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn);
if (node->type == SH_NODE_MATERIAL_EXT) {
- if(hasinput[MAT_IN_AMB])
+ if (hasinput[MAT_IN_AMB])
shi.amb= gpu_get_input_link(&in[MAT_IN_AMB]);
- if(hasinput[MAT_IN_EMIT])
+ if (hasinput[MAT_IN_EMIT])
shi.emit= gpu_get_input_link(&in[MAT_IN_EMIT]);
- if(hasinput[MAT_IN_ALPHA])
+ if (hasinput[MAT_IN_ALPHA])
shi.alpha= gpu_get_input_link(&in[MAT_IN_ALPHA]);
}
GPU_shaderesult_set(&shi, &shr); /* clears shr */
/* write to outputs */
- if(node->custom1 & SH_NODE_MAT_DIFF) {
+ if (node->custom1 & SH_NODE_MAT_DIFF) {
out[MAT_OUT_COLOR].link= shr.combined;
- if(!(node->custom1 & SH_NODE_MAT_SPEC)) {
+ if (!(node->custom1 & SH_NODE_MAT_SPEC)) {
GPUNodeLink *link;
GPU_link(mat, "vec_math_sub", shr.combined, shr.spec, &out[MAT_OUT_COLOR].link, &link);
}
}
- else if(node->custom1 & SH_NODE_MAT_SPEC) {
+ else if (node->custom1 & SH_NODE_MAT_SPEC) {
out[MAT_OUT_COLOR].link= shr.spec;
}
else
@@ -285,7 +285,7 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
out[MAT_OUT_ALPHA].link = shr.alpha; //
- if(node->custom1 & SH_NODE_MAT_NEG)
+ if (node->custom1 & SH_NODE_MAT_NEG)
GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn);
out[MAT_OUT_NORMAL].link = shi.vn;
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c
index c9234c626aa..045fef1b010 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];
@@ -61,7 +61,7 @@ bNodeStack **out)
break;
case 3: /* Divide */
{
- if(in[1]->vec[0]==0) /* We don't want to divide by zero. */
+ if (in[1]->vec[0]==0) /* We don't want to divide by zero. */
out[0]->vec[0]= 0.0;
else
out[0]->vec[0]= in[0]->vec[0] / in[1]->vec[0];
@@ -69,7 +69,7 @@ bNodeStack **out)
break;
case 4: /* Sine */
{
- if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= sin(in[0]->vec[0]);
else
out[0]->vec[0]= sin(in[1]->vec[0]);
@@ -77,7 +77,7 @@ bNodeStack **out)
break;
case 5: /* Cosine */
{
- if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= cos(in[0]->vec[0]);
else
out[0]->vec[0]= cos(in[1]->vec[0]);
@@ -85,7 +85,7 @@ bNodeStack **out)
break;
case 6: /* Tangent */
{
- if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= tan(in[0]->vec[0]);
else
out[0]->vec[0]= tan(in[1]->vec[0]);
@@ -93,16 +93,16 @@ bNodeStack **out)
break;
case 7: /* Arc-Sine */
{
- if(in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
/* Can't do the impossible... */
- if( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
+ if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
out[0]->vec[0]= asin(in[0]->vec[0]);
else
out[0]->vec[0]= 0.0;
}
else {
/* Can't do the impossible... */
- if( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
+ if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
out[0]->vec[0]= asin(in[1]->vec[0]);
else
out[0]->vec[0]= 0.0;
@@ -111,16 +111,16 @@ bNodeStack **out)
break;
case 8: /* Arc-Cosine */
{
- if(in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
/* Can't do the impossible... */
- if( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
+ if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
out[0]->vec[0]= acos(in[0]->vec[0]);
else
out[0]->vec[0]= 0.0;
}
else {
/* Can't do the impossible... */
- if( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
+ if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
out[0]->vec[0]= acos(in[1]->vec[0]);
else
out[0]->vec[0]= 0.0;
@@ -129,7 +129,7 @@ bNodeStack **out)
break;
case 9: /* Arc-Tangent */
{
- if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= atan(in[0]->vec[0]);
else
out[0]->vec[0]= atan(in[1]->vec[0]);
@@ -138,7 +138,7 @@ bNodeStack **out)
case 10: /* Power */
{
/* Don't want any imaginary numbers... */
- if( in[0]->vec[0] >= 0 )
+ if ( in[0]->vec[0] >= 0 )
out[0]->vec[0]= pow(in[0]->vec[0], in[1]->vec[0]);
else
out[0]->vec[0]= 0.0;
@@ -147,7 +147,7 @@ bNodeStack **out)
case 11: /* Logarithm */
{
/* Don't want any imaginary numbers... */
- if( in[0]->vec[0] > 0 && in[1]->vec[0] > 0 )
+ if ( in[0]->vec[0] > 0 && in[1]->vec[0] > 0 )
out[0]->vec[0]= log(in[0]->vec[0]) / log(in[1]->vec[0]);
else
out[0]->vec[0]= 0.0;
@@ -155,7 +155,7 @@ bNodeStack **out)
break;
case 12: /* Minimum */
{
- if( in[0]->vec[0] < in[1]->vec[0] )
+ if ( in[0]->vec[0] < in[1]->vec[0] )
out[0]->vec[0]= in[0]->vec[0];
else
out[0]->vec[0]= in[1]->vec[0];
@@ -163,7 +163,7 @@ bNodeStack **out)
break;
case 13: /* Maximum */
{
- if( in[0]->vec[0] > in[1]->vec[0] )
+ if ( in[0]->vec[0] > in[1]->vec[0] )
out[0]->vec[0]= in[0]->vec[0];
else
out[0]->vec[0]= in[1]->vec[0];
@@ -171,7 +171,7 @@ bNodeStack **out)
break;
case 14: /* Round */
{
- if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= (in[0]->vec[0]<0)?(int)(in[0]->vec[0] - 0.5f):(int)(in[0]->vec[0] + 0.5f);
else
out[0]->vec[0]= (in[1]->vec[0]<0)?(int)(in[1]->vec[0] - 0.5f):(int)(in[1]->vec[0] + 0.5f);
@@ -179,7 +179,7 @@ bNodeStack **out)
break;
case 15: /* Less Than */
{
- if( in[0]->vec[0] < in[1]->vec[0] )
+ if ( in[0]->vec[0] < in[1]->vec[0] )
out[0]->vec[0]= 1.0f;
else
out[0]->vec[0]= 0.0f;
@@ -187,7 +187,7 @@ bNodeStack **out)
break;
case 16: /* Greater Than */
{
- if( in[0]->vec[0] > in[1]->vec[0] )
+ if ( in[0]->vec[0] > in[1]->vec[0] )
out[0]->vec[0]= 1.0f;
else
out[0]->vec[0]= 0.0f;
@@ -224,7 +224,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN
case 8:
case 9:
case 14:
- if(in[0].hasinput || !in[1].hasinput)
+ if (in[0].hasinput || !in[1].hasinput)
GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0]));
else
GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1]));
diff --git a/source/blender/nodes/shader/nodes/node_shader_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c
index 8b0e9a5803b..14a115a8353 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output.c
@@ -41,7 +41,7 @@ static bNodeSocketTemplate sh_node_output_in[]= {
static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
- if(data) {
+ if (data) {
ShadeInput *shi= ((ShaderCallData *)data)->shi;
float col[4];
@@ -49,12 +49,12 @@ static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bN
nodestack_get_vec(col, SOCK_VECTOR, in[0]);
nodestack_get_vec(col+3, SOCK_FLOAT, in[1]);
- if(shi->do_preview) {
+ if (shi->do_preview) {
nodeAddToPreview(node, col, shi->xs, shi->ys, shi->do_manage);
node->lasty= shi->ys;
}
- if(node->flag & NODE_DO_OUTPUT) {
+ if (node->flag & NODE_DO_OUTPUT) {
ShadeResult *shr= ((ShaderCallData *)data)->shr;
copy_v4_v4(shr->combined, col);
@@ -70,7 +70,7 @@ static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack
GPUNodeLink *outlink;
#if 0
- if(in[1].hasinput)
+ if (in[1].hasinput)
GPU_material_enable_alpha(mat);
#endif
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
index 551b70d9b8a..2fff2bab1d4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
@@ -54,7 +54,7 @@ static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode* node,
static int node_shader_gpu_tex_checker(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
index 8ecff6e3767..852c056dc28 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
@@ -55,13 +55,13 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNod
Image *ima= (Image*)node->id;
ImageUser *iuser= NULL;
- if(!ima) {
+ if (!ima) {
float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
GPUNodeLink *vec = GPU_uniform(black);
return GPU_stack_link(mat, "set_rgba", out, out, vec);
}
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_builtin(GPU_VIEW_POSITION);
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
index a2403b6bdec..769cf845b42 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
@@ -52,7 +52,7 @@ static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode* node,
static int node_shader_gpu_tex_gradient(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
index aa7ff279178..69e45469174 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -54,13 +54,13 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack
Image *ima= (Image*)node->id;
ImageUser *iuser= NULL;
- if(!ima) {
+ if (!ima) {
float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
GPUNodeLink *vec = GPU_uniform(black);
return GPU_stack_link(mat, "set_rgba", out, out, vec);
}
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_MTFACE, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
index 3a270220667..e2c0cfc020f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
@@ -57,7 +57,7 @@ static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, GPUNodeStack
NodeTexMagic *tex = (NodeTexMagic*)node->storage;
float depth = tex->depth;
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
index 015b78687fd..9fe3e652eea 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
@@ -58,7 +58,7 @@ static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode* node,
static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
index bb365cf5a33..2667d2a5867 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
@@ -54,7 +54,7 @@ static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode* node, bN
static int node_shader_gpu_tex_noise(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
index a4131f3ca6c..b4855faaf94 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
@@ -54,7 +54,7 @@ static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode* node, bNod
static int node_shader_gpu_tex_sky(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
index 9adaab22b03..eebd4886c59 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
@@ -53,7 +53,7 @@ static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode* node,
static int node_shader_gpu_tex_voronoi(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
index d359a407bc0..3e079ffc4f4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
@@ -56,7 +56,7 @@ static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode* node, bNo
static int node_shader_gpu_tex_wave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c
index 02818496dab..8b6386fe2f6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_texture.c
+++ b/source/blender/nodes/shader/nodes/node_shader_texture.c
@@ -48,7 +48,7 @@ static bNodeSocketTemplate sh_node_texture_out[]= {
static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(data && node->id) {
+ if (data && node->id) {
ShadeInput *shi= ((ShaderCallData *)data)->shi;
TexResult texres;
bNodeSocket *sock_vector= node->inputs.first;
@@ -65,14 +65,14 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
texres.tr= texres.tg= texres.tb= 0.0f;
/* don't use in[0]->hasinput, see material node for explanation */
- if(sock_vector->link) {
+ if (sock_vector->link) {
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
- if(in[0]->datatype==NS_OSA_VECTORS) {
+ if (in[0]->datatype==NS_OSA_VECTORS) {
float *fp= in[0]->data;
retval= multitex_nodes((Tex *)node->id, vec, fp, fp+3, shi->osatex, &texres, thread, which_output, NULL, NULL);
}
- else if(in[0]->datatype==NS_OSA_VALUES) {
+ else if (in[0]->datatype==NS_OSA_VALUES) {
float *fp= in[0]->data;
float dxt[3], dyt[3];
@@ -89,18 +89,18 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
}
/* stupid exception */
- if( ((Tex *)node->id)->type==TEX_STUCCI) {
+ if ( ((Tex *)node->id)->type==TEX_STUCCI) {
texres.tin= 0.5f + 0.7f*texres.nor[0];
CLAMP(texres.tin, 0.0f, 1.0f);
}
/* intensity and color need some handling */
- if(texres.talpha)
+ if (texres.talpha)
out[0]->vec[0]= texres.ta;
else
out[0]->vec[0]= texres.tin;
- if((retval & TEX_RGB)==0) {
+ if ((retval & TEX_RGB)==0) {
out[1]->vec[0]= out[0]->vec[0];
out[1]->vec[1]= out[0]->vec[0];
out[1]->vec[2]= out[0]->vec[0];
@@ -115,7 +115,7 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
copy_v3_v3(out[2]->vec, nor);
- if(shi->do_preview)
+ if (shi->do_preview)
nodeAddToPreview(node, out[1]->vec, shi->xs, shi->ys, shi->do_manage);
}
@@ -125,7 +125,7 @@ static int gpu_shader_texture(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G
{
Tex *tex = (Tex*)node->id;
- if(tex && tex->type == TEX_IMAGE && tex->ima) {
+ if (tex && tex->type == TEX_IMAGE && tex->ima) {
GPUNodeLink *texlink = GPU_image(tex->ima, NULL);
return GPU_stack_link(mat, "texture_image", in, out, texlink);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
index f0a94928985..a9513eec6ea 100644
--- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
@@ -48,7 +48,7 @@ static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStac
/* stack order in: fac */
/* stack order out: col, alpha */
- if(node->storage) {
+ if (node->storage) {
float fac;
nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
index 75dbff11b6e..9b57780cd9d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
@@ -54,39 +54,39 @@ static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeSta
nodestack_get_vec(vec1, SOCK_VECTOR, in[0]);
nodestack_get_vec(vec2, SOCK_VECTOR, in[1]);
- if(node->custom1 == 0) { /* Add */
+ if (node->custom1 == 0) { /* Add */
out[0]->vec[0]= vec1[0] + vec2[0];
out[0]->vec[1]= vec1[1] + vec2[1];
out[0]->vec[2]= vec1[2] + vec2[2];
out[1]->vec[0]= (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3;
}
- else if(node->custom1 == 1) { /* Subtract */
+ else if (node->custom1 == 1) { /* Subtract */
out[0]->vec[0]= vec1[0] - vec2[0];
out[0]->vec[1]= vec1[1] - vec2[1];
out[0]->vec[2]= vec1[2] - vec2[2];
out[1]->vec[0]= (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3;
}
- else if(node->custom1 == 2) { /* Average */
+ else if (node->custom1 == 2) { /* Average */
out[0]->vec[0]= vec1[0] + vec2[0];
out[0]->vec[1]= vec1[1] + vec2[1];
out[0]->vec[2]= vec1[2] + vec2[2];
out[1]->vec[0] = normalize_v3( out[0]->vec );
}
- else if(node->custom1 == 3) { /* Dot product */
+ else if (node->custom1 == 3) { /* Dot product */
out[1]->vec[0]= (vec1[0] * vec2[0]) + (vec1[1] * vec2[1]) + (vec1[2] * vec2[2]);
}
- else if(node->custom1 == 4) { /* Cross product */
+ else if (node->custom1 == 4) { /* Cross product */
out[0]->vec[0]= (vec1[1] * vec2[2]) - (vec1[2] * vec2[1]);
out[0]->vec[1]= (vec1[2] * vec2[0]) - (vec1[0] * vec2[2]);
out[0]->vec[2]= (vec1[0] * vec2[1]) - (vec1[1] * vec2[0]);
out[1]->vec[0] = normalize_v3( out[0]->vec );
}
- else if(node->custom1 == 5) { /* Normalize */
- if(in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
+ else if (node->custom1 == 5) { /* Normalize */
+ if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= vec1[0];
out[0]->vec[1]= vec1[1];
out[0]->vec[2]= vec1[2];
@@ -118,7 +118,7 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
GPU_socket(&in[0]), GPU_socket(&in[1]));
break;
case 5:
- if(in[0].hasinput || !in[1].hasinput)
+ if (in[0].hasinput || !in[1].hasinput)
GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0]));
else
GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1]));
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c
index 2795cbd3e5a..add9fdb0b30 100644
--- a/source/blender/nodes/texture/node_texture_tree.c
+++ b/source/blender/nodes/texture/node_texture_tree.c
@@ -57,8 +57,8 @@
static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
{
Tex *tx;
- for(tx= main->tex.first; tx; tx= tx->id.next) {
- if(tx->nodetree) {
+ for (tx= main->tex.first; tx; tx= tx->id.next) {
+ if (tx->nodetree) {
func(calldata, &tx->id, tx->nodetree);
}
}
@@ -97,12 +97,12 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
bNode *lnode;
/* copy over contents of previews */
- for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
- if(ntreeNodeExists(ntree, lnode->new_node)) {
+ for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+ if (ntreeNodeExists(ntree, lnode->new_node)) {
bNode *node= lnode->new_node;
- if(node->preview && node->preview->rect) {
- if(lnode->preview && lnode->preview->rect) {
+ if (node->preview && node->preview->rect) {
+ if (lnode->preview && lnode->preview->rect) {
int xsize= node->preview->xsize;
int ysize= node->preview->ysize;
memcpy(node->preview->rect, lnode->preview->rect, 4*xsize + xsize*ysize*sizeof(char)*4);
@@ -135,15 +135,15 @@ int ntreeTexTagAnimated(bNodeTree *ntree)
{
bNode *node;
- if(ntree==NULL) return 0;
+ if (ntree==NULL) return 0;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==TEX_NODE_CURVE_TIME) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type==TEX_NODE_CURVE_TIME) {
nodeUpdate(ntree, node);
return 1;
}
- else if(node->type==NODE_GROUP) {
- if( ntreeTexTagAnimated((bNodeTree *)node->id) ) {
+ else if (node->type==NODE_GROUP) {
+ if ( ntreeTexTagAnimated((bNodeTree *)node->id) ) {
return 1;
}
}
@@ -174,7 +174,7 @@ bNodeTreeExec *ntreeTexBeginExecTree(bNodeTree *ntree, int use_tree_data)
/* allocate the thread stack listbase array */
exec->threadstack= MEM_callocN(BLENDER_MAX_THREADS*sizeof(ListBase), "thread stack array");
- for(node= exec->nodetree->nodes.first; node; node= node->next)
+ for (node= exec->nodetree->nodes.first; node; node= node->next)
node->need_exec= 1;
if (use_tree_data) {
@@ -194,10 +194,10 @@ static void tex_free_delegates(bNodeTreeExec *exec)
bNodeStack *ns;
int th, a;
- for(th=0; th<BLENDER_MAX_THREADS; th++)
- for(nts=exec->threadstack[th].first; nts; nts=nts->next)
- for(ns= nts->stack, a=0; a<exec->stacksize; a++, ns++)
- if(ns->data && !ns->is_copy)
+ for (th=0; th<BLENDER_MAX_THREADS; th++)
+ for (nts=exec->threadstack[th].first; nts; nts=nts->next)
+ for (ns= nts->stack, a=0; a<exec->stacksize; a++, ns++)
+ if (ns->data && !ns->is_copy)
MEM_freeN(ns->data);
}
@@ -206,16 +206,16 @@ static void tex_free_delegates(bNodeTreeExec *exec)
*/
void ntreeTexEndExecTree(bNodeTreeExec *exec, int use_tree_data)
{
- if(exec) {
+ if (exec) {
bNodeTree *ntree= exec->nodetree;
bNodeThreadStack *nts;
int a;
- if(exec->threadstack) {
+ if (exec->threadstack) {
tex_free_delegates(exec);
- for(a=0; a<BLENDER_MAX_THREADS; a++) {
- for(nts=exec->threadstack[a].first; nts; nts=nts->next)
+ for (a=0; a<BLENDER_MAX_THREADS; a++) {
+ for (nts=exec->threadstack[a].first; nts; nts=nts->next)
if (nts->stack) MEM_freeN(nts->stack);
BLI_freelistN(&exec->threadstack[a]);
}
@@ -246,7 +246,7 @@ int ntreeTexExecTree(
int preview,
ShadeInput *shi,
MTex *mtex
-){
+) {
TexCallData data;
float *nor= texres->nor;
int retval = TEX_INT;
@@ -268,7 +268,7 @@ int ntreeTexExecTree(
/* ensure execdata is only initialized once */
if (!exec) {
BLI_lock_thread(LOCK_NODES);
- if(!nodes->execdata)
+ if (!nodes->execdata)
ntreeTexBeginExecTree(nodes, 1);
BLI_unlock_thread(LOCK_NODES);
@@ -279,7 +279,7 @@ int ntreeTexExecTree(
ntreeExecThreadNodes(exec, nts, &data, thread);
ntreeReleaseThreadStack(nts);
- if(texres->nor) retval |= TEX_NOR;
+ if (texres->nor) retval |= TEX_NOR;
retval |= TEX_RGB;
/* confusing stuff; the texture output node sets this to NULL to indicate no normal socket was set
however, the texture code checks this for other reasons (namely, a normal is required for material) */
diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c
index a528f8cb7a7..255ed9e51fc 100644
--- a/source/blender/nodes/texture/node_texture_util.c
+++ b/source/blender/nodes/texture/node_texture_util.c
@@ -53,10 +53,10 @@
static void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, short thread)
{
- if(dg->node->need_exec) {
+ if (dg->node->need_exec) {
dg->fn(out, params, dg->node, dg->in, thread);
- if(dg->cdata->do_preview)
+ if (dg->cdata->do_preview)
tex_do_preview(dg->node, params->previewco, out);
}
}
@@ -64,10 +64,10 @@ static void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, sh
static void tex_input(float *out, int sz, bNodeStack *in, TexParams *params, short thread)
{
TexDelegate *dg = in->data;
- if(dg) {
+ if (dg) {
tex_call_delegate(dg, in->vec, params, thread);
- if(in->hasoutput && in->sockettype == SOCK_FLOAT)
+ if (in->hasoutput && in->sockettype == SOCK_FLOAT)
in->vec[1] = in->vec[2] = in->vec[0];
}
memcpy(out, in->vec, sz * sizeof(float));
@@ -118,7 +118,7 @@ void tex_do_preview(bNode *node, float *co, float *col)
{
bNodePreview *preview= node->preview;
- if(preview) {
+ if (preview) {
int xs= ((co[0] + 1.0f)*0.5f)*preview->xsize;
int ys= ((co[1] + 1.0f)*0.5f)*preview->ysize;
@@ -129,7 +129,7 @@ void tex_do_preview(bNode *node, float *co, float *col)
void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata)
{
TexDelegate *dg;
- if(!out->data)
+ if (!out->data)
/* Freed in tex_end_exec (node.c) */
dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate");
else
@@ -145,20 +145,21 @@ void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexC
void ntreeTexCheckCyclics(struct bNodeTree *ntree)
{
bNode *node;
- for(node= ntree->nodes.first; node; node= node->next) {
+ for (node= ntree->nodes.first; node; node= node->next) {
- if(node->type == TEX_NODE_TEXTURE && node->id) {
+ if (node->type == TEX_NODE_TEXTURE && node->id) {
/* custom2 stops the node from rendering */
- if(node->custom1) {
+ if (node->custom1) {
node->custom2 = 1;
node->custom1 = 0;
- } else {
+ }
+ else {
Tex *tex = (Tex *)node->id;
node->custom2 = 0;
node->custom1 = 1;
- if(tex->use_nodes && tex->nodetree) {
+ if (tex->use_nodes && tex->nodetree) {
ntreeTexCheckCyclics(tex->nodetree);
}
node->custom1 = 0;
diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c
index 9e76309bce9..ac8799762bd 100644
--- a/source/blender/nodes/texture/nodes/node_texture_bricks.c
+++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c
@@ -91,7 +91,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
rownum = (int)floor(y / row_height);
- if( node->custom1 && node->custom2 ) {
+ if ( node->custom1 && node->custom2 ) {
brick_width *= ((int)(rownum) % node->custom2 ) ? 1.0f : node->custom4; /* squash */
offset = ((int)(rownum) % node->custom1 ) ? 0 : (brick_width*node->custom3); /* offset */
}
@@ -104,11 +104,12 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
tint = noise((rownum << 16) + (bricknum & 0xFFFF)) + bias;
CLAMP(tint,0.0f,1.0f);
- if( ins_x < mortar_thickness || ins_y < mortar_thickness ||
+ if ( ins_x < mortar_thickness || ins_y < mortar_thickness ||
ins_x > (brick_width - mortar_thickness) ||
ins_y > (row_height - mortar_thickness) ) {
copy_v4_v4( out, mortar );
- } else {
+ }
+ else {
copy_v4_v4( out, bricks1 );
ramp_blend( MA_RAMP_BLEND, out, tint, bricks2 );
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c
index 6b5848270ba..c96a73d09f2 100644
--- a/source/blender/nodes/texture/nodes/node_texture_checker.c
+++ b/source/blender/nodes/texture/nodes/node_texture_checker.c
@@ -57,9 +57,10 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **
int yi = (int)fabs(floor(0.00001f + y / sz));
int zi = (int)fabs(floor(0.00001f + z / sz));
- if( (xi % 2 == yi % 2) == (zi % 2) ) {
+ if ( (xi % 2 == yi % 2) == (zi % 2) ) {
tex_input_rgba(out, in[0], p, thread);
- } else {
+ }
+ else {
tex_input_rgba(out, in[1], p, thread);
}
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c
index 5256db98d78..a3ac196ab12 100644
--- a/source/blender/nodes/texture/nodes/node_texture_compose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_compose.c
@@ -48,7 +48,7 @@ static bNodeSocketTemplate outputs[]= {
static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
int i;
- for(i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
out[i] = tex_input_value(in[i], p, thread);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c
index 08e7efc1606..0f7213a5be0 100644
--- a/source/blender/nodes/texture/nodes/node_texture_curves.c
+++ b/source/blender/nodes/texture/nodes/node_texture_curves.c
@@ -46,7 +46,7 @@ static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNU
/* stack order output: fac */
float fac= 0.0f;
- if(node->custom1 < node->custom2)
+ if (node->custom1 < node->custom2)
fac = (p->cfra - node->custom1)/(float)(node->custom2-node->custom1);
fac = curvemapping_evaluateF(node->storage, 0, fac);
diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
index e566fb0298a..d5a957a3b28 100644
--- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
+++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
@@ -49,16 +49,16 @@ static bNodeSocketTemplate outputs[]= {
static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat, float val, float *in, float fac)
{
- if(fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) {
+ if (fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) {
float col[3], hsv[3], mfac= 1.0f - fac;
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
hsv[0]+= (hue - 0.5f);
- if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f;
+ if (hsv[0]>1.0f) hsv[0]-=1.0f; else if (hsv[0]<0.0f) hsv[0]+= 1.0f;
hsv[1]*= sat;
- if(hsv[1]>1.0f) hsv[1]= 1.0f; else if(hsv[1]<0.0f) hsv[1]= 0.0f;
+ if (hsv[1]>1.0f) hsv[1]= 1.0f; else if (hsv[1]<0.0f) hsv[1]= 0.0f;
hsv[2]*= val;
- if(hsv[2]>1.0f) hsv[2]= 1.0f; else if(hsv[2]<0.0f) hsv[2]= 0.0f;
+ if (hsv[2]>1.0f) hsv[2]= 1.0f; else if (hsv[2]<0.0f) hsv[2]= 0.0f;
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
out[0]= mfac*in[0] + fac*col[0];
diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index 0acfe62ed82..d0bc30089e2 100644
--- a/source/blender/nodes/texture/nodes/node_texture_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -45,9 +45,9 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i
Image *ima= (Image *)node->id;
ImageUser *iuser= (ImageUser *)node->storage;
- if( ima ) {
+ if ( ima ) {
ImBuf *ibuf = BKE_image_get_ibuf(ima, iuser);
- if( ibuf ) {
+ if ( ibuf ) {
float xsize, ysize;
float xoff, yoff;
int px, py;
@@ -61,19 +61,19 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i
px = (int)( (x-xoff) * xsize );
py = (int)( (y-yoff) * ysize );
- if( (!xsize) || (!ysize) ) return;
+ if ( (!xsize) || (!ysize) ) return;
- if( !ibuf->rect_float ) {
+ if ( !ibuf->rect_float ) {
BLI_lock_thread(LOCK_IMAGE);
- if( !ibuf->rect_float )
+ if ( !ibuf->rect_float )
IMB_float_from_rect(ibuf);
BLI_unlock_thread(LOCK_IMAGE);
}
- while( px < 0 ) px += ibuf->x;
- while( py < 0 ) py += ibuf->y;
- while( px >= ibuf->x ) px -= ibuf->x;
- while( py >= ibuf->y ) py -= ibuf->y;
+ while ( px < 0 ) px += ibuf->x;
+ while ( py < 0 ) py += ibuf->y;
+ while ( px >= ibuf->x ) px -= ibuf->x;
+ while ( py >= ibuf->y ) py -= ibuf->y;
result = ibuf->rect_float + py*ibuf->x*4 + px*4;
copy_v4_v4( out, result );
diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c
index 4659aa2b6c0..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;
@@ -64,7 +64,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
break;
case 3: /* Divide */
{
- if(in1==0) /* We don't want to divide by zero. */
+ if (in1==0) /* We don't want to divide by zero. */
*out= 0.0;
else
*out= in0 / in1;
@@ -88,7 +88,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
case 7: /* Arc-Sine */
{
/* Can't do the impossible... */
- if( in0 <= 1 && in0 >= -1 )
+ if ( in0 <= 1 && in0 >= -1 )
*out= asin(in0);
else
*out= 0.0;
@@ -97,7 +97,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
case 8: /* Arc-Cosine */
{
/* Can't do the impossible... */
- if( in0 <= 1 && in0 >= -1 )
+ if ( in0 <= 1 && in0 >= -1 )
*out= acos(in0);
else
*out= 0.0;
@@ -111,13 +111,15 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
case 10: /* Power */
{
/* Only raise negative numbers by full integers */
- if( in0 >= 0 ) {
+ if ( in0 >= 0 ) {
out[0]= pow(in0, in1);
- } else {
+ }
+ else {
float y_mod_1 = fmod(in1, 1);
if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
*out = pow(in0, floor(in1 + 0.5f));
- } else {
+ }
+ else {
*out = 0.0;
}
}
@@ -126,7 +128,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
case 11: /* Logarithm */
{
/* Don't want any imaginary numbers... */
- if( in0 > 0 && in1 > 0 )
+ if ( in0 > 0 && in1 > 0 )
*out= log(in0) / log(in1);
else
*out= 0.0;
@@ -134,7 +136,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
break;
case 12: /* Minimum */
{
- if( in0 < in1 )
+ if ( in0 < in1 )
*out= in0;
else
*out= in1;
@@ -142,7 +144,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
break;
case 13: /* Maximum */
{
- if( in0 > in1 )
+ if ( in0 > in1 )
*out= in0;
else
*out= in1;
@@ -156,7 +158,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
case 15: /* Less Than */
{
- if( in0 < in1 )
+ if ( in0 < in1 )
*out= 1.0f;
else
*out= 0.0f;
@@ -165,7 +167,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
case 16: /* Greater Than */
{
- if( in0 > in1 )
+ if ( in0 > in1 )
*out= 1.0f;
else
*out= 0.0f;
diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c
index 36b31a864a5..2b899fde593 100644
--- a/source/blender/nodes/texture/nodes/node_texture_output.c
+++ b/source/blender/nodes/texture/nodes/node_texture_output.c
@@ -46,11 +46,11 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o
TexCallData *cdata = (TexCallData *)data;
TexResult *target = cdata->target;
- if(cdata->do_preview) {
+ if (cdata->do_preview) {
TexParams params;
params_from_cdata(&params, cdata);
- if(in[1] && in[1]->hasinput && !in[0]->hasinput)
+ if (in[1] && in[1]->hasinput && !in[0]->hasinput)
tex_input_rgba(&target->tr, in[1], &params, cdata->thread);
else
tex_input_rgba(&target->tr, in[0], &params, cdata->thread);
@@ -58,7 +58,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o
}
else {
/* 0 means don't care, so just use first */
- if(cdata->which_output == node->custom1 || (cdata->which_output == 0 && node->custom1 == 1)) {
+ if (cdata->which_output == node->custom1 || (cdata->which_output == 0 && node->custom1 == 1)) {
TexParams params;
params_from_cdata(&params, cdata);
@@ -67,8 +67,8 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o
target->tin = (target->tr + target->tg + target->tb) / 3.0f;
target->talpha = 1;
- if(target->nor) {
- if(in[1] && in[1]->hasinput)
+ if (target->nor) {
+ if (in[1] && in[1]->hasinput)
tex_input_vec(target->nor, in[1], &params, cdata->thread);
else
target->nor = NULL;
@@ -87,23 +87,24 @@ static void unique_name(bNode *node)
char *name = tno->name;
i = node;
- while(i->prev) i = i->prev;
- for(; i; i=i->next) {
- if(
+ 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)
)
continue;
- if(!new_name) {
+ if (!new_name) {
int len = strlen(name);
- if(len >= 4 && sscanf(name + len - 4, ".%03d", &suffix) == 1) {
+ if (len >= 4 && sscanf(name + len - 4, ".%03d", &suffix) == 1) {
new_len = len;
- } else {
+ }
+ else {
suffix = 0;
new_len = len + 4;
- if(new_len > (sizeof(tno->name) - 1))
+ if (new_len > (sizeof(tno->name) - 1))
new_len = (sizeof(tno->name) - 1);
}
@@ -114,7 +115,7 @@ static void unique_name(bNode *node)
sprintf(new_name + new_len - 4, ".%03d", ++suffix);
}
- if(new_name) {
+ if (new_name) {
strcpy(tno->name, new_name);
MEM_freeN(new_name);
}
@@ -126,13 +127,13 @@ static void assign_index(struct bNode *node)
int index = 1;
tnode = node;
- while(tnode->prev)
+ while (tnode->prev)
tnode = tnode->prev;
check_index:
- for(; tnode; tnode= tnode->next)
- if(tnode->type == TEX_NODE_OUTPUT && tnode != node)
- if(tnode->custom1 == index) {
+ for (; tnode; tnode= tnode->next)
+ if (tnode->type == TEX_NODE_OUTPUT && tnode != node)
+ if (tnode->custom1 == index) {
index ++;
goto check_index;
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c
index efc8228c01c..348827bd26c 100644
--- a/source/blender/nodes/texture/nodes/node_texture_proc.c
+++ b/source/blender/nodes/texture/nodes/node_texture_proc.c
@@ -62,7 +62,7 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char
TexResult texres;
int textype;
- if(is_normal) {
+ if (is_normal) {
texres.nor = result;
}
else
@@ -71,10 +71,10 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char
textype = multitex_nodes(tex, p->co, p->dxt, p->dyt, p->osatex,
&texres, thread, 0, p->shi, p->mtex);
- if(is_normal)
+ if (is_normal)
return;
- if(textype & TEX_RGB) {
+ if (textype & TEX_RGB) {
copy_v4_v4(result, &texres.tr);
}
else {
@@ -108,7 +108,7 @@ static int count_outputs(bNode *node)
{
bNodeSocket *sock;
int num = 0;
- for(sock= node->outputs.first; sock; sock= sock->next) {
+ for (sock= node->outputs.first; sock; sock= sock->next) {
num++;
}
return num;
@@ -132,8 +132,8 @@ static int count_outputs(bNode *node)
static void name##_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) \
{ \
int outs = count_outputs(node); \
- if(outs >= 1) tex_output(node, in, out[0], &name##_colorfn, data); \
- if(outs >= 2) tex_output(node, in, out[1], &name##_normalfn, data); \
+ if (outs >= 1) tex_output(node, in, out[0], &name##_colorfn, data); \
+ if (outs >= 2) tex_output(node, in, out[1], &name##_normalfn, data); \
}
@@ -289,7 +289,7 @@ static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(nt
default_tex(tex);
tex->type = node->type - TEX_NODE_PROC;
- if(tex->type == TEX_WOOD)
+ if (tex->type == TEX_WOOD)
tex->stype = TEX_BANDNOISE;
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c
index d408b874b84..bf93231c306 100644
--- a/source/blender/nodes/texture/nodes/node_texture_texture.c
+++ b/source/blender/nodes/texture/nodes/node_texture_texture.c
@@ -63,11 +63,11 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
zero_v3(dyt);
}
- if(node->custom2 || node->need_exec==0) {
+ if (node->custom2 || node->need_exec==0) {
/* this node refers to its own texture tree! */
copy_v4_v4(out, (fabs(co[0] - co[1]) < .01) ? white : red );
}
- else if(nodetex) {
+ else if (nodetex) {
TexResult texres;
int textype;
float nor[] = {0,0,0};
@@ -80,7 +80,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
textype = multitex_nodes(nodetex, co, dxt, dyt, p->osatex,
&texres, thread, 0, p->shi, p->mtex);
- if(textype & TEX_RGB) {
+ if (textype & TEX_RGB) {
copy_v4_v4(out, &texres.tr);
}
else {
diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
index c0efa43c14f..1d282b4d4cc 100644
--- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
@@ -45,7 +45,7 @@ static bNodeSocketTemplate valtorgb_out[]= {
static void valtorgb_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
{
- if(node->storage) {
+ if (node->storage) {
float fac = tex_input_value(in[0], p, thread);
do_colorband(node->storage, fac, out);
diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c
index 401e72761e3..0d7a04b06e2 100644
--- a/source/blender/nodes/texture/nodes/node_texture_viewer.c
+++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c
@@ -46,7 +46,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o
{
TexCallData *cdata = (TexCallData *)data;
- if(cdata->do_preview) {
+ if (cdata->do_preview) {
TexParams params;
float col[4];
params_from_cdata(&params, cdata);
diff --git a/source/blender/python/bmesh/CMakeLists.txt b/source/blender/python/bmesh/CMakeLists.txt
index 2b5a58171b6..40bde7161b6 100644
--- a/source/blender/python/bmesh/CMakeLists.txt
+++ b/source/blender/python/bmesh/CMakeLists.txt
@@ -33,13 +33,17 @@ set(INC_SYS
set(SRC
bmesh_py_api.c
- bmesh_py_select.c
bmesh_py_types.c
+ bmesh_py_types_customdata.c
+ bmesh_py_types_meshdata.c
+ bmesh_py_types_select.c
bmesh_py_utils.c
bmesh_py_api.h
- bmesh_py_select.h
bmesh_py_types.h
+ bmesh_py_types_customdata.h
+ bmesh_py_types_meshdata.h
+ bmesh_py_types_select.h
bmesh_py_utils.h
)
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
index 3990005d139..77276df49f2 100644
--- a/source/blender/python/bmesh/bmesh_py_api.c
+++ b/source/blender/python/bmesh/bmesh_py_api.c
@@ -31,127 +31,73 @@
#include <Python.h>
+#include "BLI_utildefines.h"
+
#include "bmesh.h"
#include "bmesh_py_types.h"
-#include "bmesh_py_utils.h"
-#include "bmesh_py_select.h"
+#include "bmesh_py_types_select.h"
+#include "bmesh_py_types_customdata.h"
+#include "bmesh_py_types_meshdata.h"
-#include "BLI_utildefines.h"
+#include "bmesh_py_utils.h"
#include "BKE_tessmesh.h"
-#include "BKE_depsgraph.h"
#include "DNA_mesh_types.h"
-#include "DNA_object_types.h"
#include "../generic/py_capi_utils.h"
#include "bmesh_py_api.h" /* own include */
-
PyDoc_STRVAR(bpy_bm_new_doc,
".. method:: new()\n"
"\n"
-" :return: Retyrn a new, empty mesh.\n"
-" :rtype: :class:`BMesh`\n"
+" :return: Return a new, empty BMesh.\n"
+" :rtype: :class:`bmesh.types.BMesh`\n"
);
static PyObject *bpy_bm_new(PyObject *UNUSED(self))
{
- BPy_BMesh *py_bmesh;
BMesh *bm;
- bm = BM_mesh_create(NULL, &bm_mesh_allocsize_default);
+ bm = BM_mesh_create(&bm_mesh_allocsize_default);
- py_bmesh = (BPy_BMesh *)BPy_BMesh_CreatePyObject(bm);
- py_bmesh->py_owns = TRUE;
- return (PyObject *)py_bmesh;
+ return BPy_BMesh_CreatePyObject(bm, BPY_BMFLAG_NOP);
}
-PyDoc_STRVAR(bpy_bm_from_mesh_doc,
-".. method:: from_mesh(mesh)\n"
+PyDoc_STRVAR(bpy_bm_from_edit_mesh_doc,
+".. method:: from_edit_mesh(mesh)\n"
"\n"
" Return a BMesh from this mesh, currently the mesh must already be in editmode.\n"
"\n"
" :return: the BMesh assosiated with this mesh.\n"
" :rtype: :class:`bmesh.types.BMesh`\n"
);
-
-static PyObject *bpy_bm_from_mesh(PyObject *UNUSED(self), PyObject *value)
+static PyObject *bpy_bm_from_edit_mesh(PyObject *UNUSED(self), PyObject *value)
{
- BPy_BMesh *py_bmesh;
BMesh *bm;
Mesh *me = PyC_RNA_AsPointer(value, "Mesh");
- int py_owns;
if (me == NULL) {
return NULL;
}
- /* temp! */
- if (!me->edit_btmesh) {
- bm = BM_mesh_create(NULL, &bm_mesh_allocsize_default);
- BM_mesh_to_bmesh(bm, me, 0, 0); /* BMESH_TODO add args */
- py_owns = TRUE;
- }
- else {
- bm = me->edit_btmesh->bm;
- py_owns = FALSE;
- }
-
- py_bmesh = (BPy_BMesh *)BPy_BMesh_CreatePyObject(bm);
- py_bmesh->py_owns = py_owns;
- return (PyObject *)py_bmesh;
-}
-
-PyDoc_STRVAR(bpy_bm_to_mesh_doc,
-".. method:: to_mesh(mesh, bmesh)\n"
-"\n"
-" Return a BMesh from this mesh, currently the mesh must already be in editmode.\n"
-"\n"
-" :return: the BMesh assosiated with this mesh.\n"
-" :rtype: :class:`bmesh.types.BMesh`\n"
-);
-
-static PyObject *bpy_bm_to_mesh(PyObject *UNUSED(self), PyObject *args)
-{
- PyObject *py_mesh;
- BPy_BMesh *py_bmesh;
- Mesh *me;
- BMesh *bm;
-
- if (!PyArg_ParseTuple(args, "OO!:to_mesh", &py_mesh, &BPy_BMesh_Type, &py_bmesh) ||
- !(me = PyC_RNA_AsPointer(py_mesh, "Mesh")))
- {
- return NULL;
- }
-
- BPY_BM_CHECK_OBJ(py_bmesh);
-
- if (me->edit_btmesh) {
- PyErr_Format(PyExc_ValueError,
- "to_mesh(): Mesh '%s' is in editmode", me->id.name + 2);
+ if (me->edit_btmesh == NULL) {
+ PyErr_SetString(PyExc_ValueError,
+ "The mesh must be in editmode");
return NULL;
}
- bm = py_bmesh->bm;
-
- BM_mesh_from_bmesh(bm, me, FALSE);
+ bm = me->edit_btmesh->bm;
- /* we could have the user do this but if they forget blender can easy crash
- * since the references arrays for the objects derived meshes are now invalid */
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
-
- Py_RETURN_NONE;
+ return BPy_BMesh_CreatePyObject(bm, BPY_BMFLAG_IS_WRAPPED);
}
static struct PyMethodDef BPy_BM_methods[] = {
- /* THESE NAMES MAY CHANGE! */
- {"new", (PyCFunction)bpy_bm_new, METH_NOARGS, bpy_bm_new_doc},
- {"from_mesh", (PyCFunction)bpy_bm_from_mesh, METH_O, bpy_bm_from_mesh_doc},
- {"to_mesh", (PyCFunction)bpy_bm_to_mesh, METH_VARARGS, bpy_bm_to_mesh_doc},
+ {"new", (PyCFunction)bpy_bm_new, METH_NOARGS, bpy_bm_new_doc},
+ {"from_edit_mesh", (PyCFunction)bpy_bm_from_edit_mesh, METH_O, bpy_bm_from_edit_mesh_doc},
{NULL, NULL, 0, NULL}
};
@@ -163,6 +109,9 @@ PyDoc_STRVAR(BPy_BM_doc,
"\n"
"* :mod:`bmesh.utils`\n"
"* :mod:`bmesh.types`\n"
+"\n"
+"\n"
+".. include:: include__bmesh.rst\n"
);
static struct PyModuleDef BPy_BM_module_def = {
PyModuleDef_HEAD_INIT,
@@ -183,17 +132,18 @@ PyObject *BPyInit_bmesh(void)
PyObject *sys_modules = PySys_GetObject("modules"); /* not pretty */
BPy_BM_init_types();
- BPy_BM_init_select_types();
-
+ BPy_BM_init_types_select();
+ BPy_BM_init_types_customdata();
+ BPy_BM_init_types_meshdata();
mod = PyModule_Create(&BPy_BM_module_def);
/* bmesh.types */
- PyModule_AddObject(mod, "types", (submodule=BPyInit_bmesh_types()));
+ PyModule_AddObject(mod, "types", (submodule = BPyInit_bmesh_types()));
PyDict_SetItemString(sys_modules, "bmesh.types", submodule);
Py_INCREF(submodule);
- PyModule_AddObject(mod, "utils", (submodule=BPyInit_bmesh_utils()));
+ PyModule_AddObject(mod, "utils", (submodule = BPyInit_bmesh_utils()));
PyDict_SetItemString(sys_modules, "bmesh.utils", submodule);
Py_INCREF(submodule);
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index c15323186ac..04ad9a298fd 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -31,7 +31,13 @@
#include "BLI_math.h"
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
+#include "DNA_material_types.h"
+
+#include "BKE_depsgraph.h"
#include "BKE_customdata.h"
+#include "BKE_DerivedMesh.h"
#include "bmesh.h"
@@ -39,8 +45,10 @@
#include "../generic/py_capi_utils.h"
-#include "bmesh_py_select.h"
#include "bmesh_py_types.h" /* own include */
+#include "bmesh_py_types_select.h"
+#include "bmesh_py_types_customdata.h"
+#include "bmesh_py_types_meshdata.h"
/* Common Flags
* ************ */
@@ -173,7 +181,7 @@ static int bpy_bm_elem_index_set(BPy_BMElem *self, PyObject *value, void *UNUSED
}
}
-/* type spesific get/sets
+/* type specific get/sets
* ---------------------- */
@@ -181,22 +189,42 @@ static int bpy_bm_elem_index_set(BPy_BMElem *self, PyObject *value, void *UNUSED
* ^^^^ */
/* doc-strings for all uses of this funcion */
-PyDoc_STRVAR(bpy_bmesh_verts_doc,
-"This meshes vert sequence (read-only).\n\n:type: :class:`BMElemSeq`"
-);
-PyDoc_STRVAR(bpy_bmesh_edges_doc,
-"This meshes edge sequence (read-only).\n\n:type: :class:`BMElemSeq`"
+
+PyDoc_STRVAR(bpy_bmvertseq_doc,
+"This meshes vert sequence (read-only).\n\n:type: :class:`BMVertSeq`"
);
-PyDoc_STRVAR(bpy_bmesh_faces_doc,
-"This meshes face sequence (read-only).\n\n:type: :class:`BMElemSeq`"
+static PyObject *bpy_bmvertseq_get(BPy_BMesh *self, void *UNUSED(closure))
+{
+ BPY_BM_CHECK_OBJ(self);
+ return BPy_BMVertSeq_CreatePyObject(self->bm);
+}
+
+PyDoc_STRVAR(bpy_bmedgeseq_doc,
+"This meshes edge sequence (read-only).\n\n:type: :class:`BMEdgeSeq`"
);
+static PyObject *bpy_bmedgeseq_get(BPy_BMesh *self, void *UNUSED(closure))
+{
+ BPY_BM_CHECK_OBJ(self);
+ return BPy_BMEdgeSeq_CreatePyObject(self->bm);
+}
-static PyObject *bpy_bmelemseq_get(BPy_BMesh *self, void *itype)
+PyDoc_STRVAR(bpy_bmfaceseq_doc,
+"This meshes face sequence (read-only).\n\n:type: :class:`BMFaceSeq`"
+);
+static PyObject *bpy_bmfaceseq_get(BPy_BMesh *self, void *UNUSED(closure))
{
BPY_BM_CHECK_OBJ(self);
- return BPy_BMElemSeq_CreatePyObject(self->bm, NULL, GET_INT_FROM_POINTER(itype));
+ return BPy_BMFaceSeq_CreatePyObject(self->bm);
}
+PyDoc_STRVAR(bpy_bmloopseq_doc,
+"This meshes face sequence (read-only).\n\n:type: :class:`BMLoopSeq`"
+);
+static PyObject *bpy_bmloopseq_get(BPy_BMesh *self, void *UNUSED(closure))
+{
+ BPY_BM_CHECK_OBJ(self);
+ return BPy_BMLoopSeq_CreatePyObject(self->bm);
+}
/* vert */
PyDoc_STRVAR(bpy_bmvert_link_edges_doc,
@@ -248,6 +276,15 @@ static PyObject *bpy_bm_is_valid_get(BPy_BMGeneric *self)
return PyBool_FromLong(BPY_BM_IS_VALID(self));
}
+PyDoc_STRVAR(bpy_bmesh_is_wrapped_doc,
+"True when this mesh is owned by blender (typically the editmode BMesh).\n\n:type: boolean"
+);
+static PyObject *bpy_bmesh_is_wrapped_get(BPy_BMesh *self)
+{
+ BPY_BM_CHECK_OBJ(self);
+
+ return PyBool_FromLong(self->flag & BPY_BMFLAG_IS_WRAPPED);
+}
PyDoc_STRVAR(bpy_bmesh_select_mode_doc,
"The selection mode, values can be {'VERT', 'EDGE', 'FACE'}, can't be assigned an empty set.\n\n:type: set"
@@ -288,12 +325,11 @@ static PyObject *bpy_bmesh_select_history_get(BPy_BMesh *self)
return BPy_BMEditSel_CreatePyObject(self->bm);
}
-static int bpy_bmesh_select_history_set(BPy_BMesh *self, PyObject *UNUSED(value))
+static int bpy_bmesh_select_history_set(BPy_BMesh *self, PyObject *value)
{
BPY_BM_CHECK_INT(self);
- PyErr_SetString(PyExc_NotImplementedError, "not yet functional");
- return -1;
+ return BPy_BMEditSel_Assign(self, value);
}
/* Vert
@@ -349,7 +385,7 @@ PyDoc_STRVAR(bpy_bmvert_is_manifold_doc,
static PyObject *bpy_bmvert_is_manifold_get(BPy_BMVert *self)
{
BPY_BM_CHECK_OBJ(self);
- return PyBool_FromLong(BM_vert_is_manifold(self->bm, self->v));
+ return PyBool_FromLong(BM_vert_is_manifold(self->v));
}
@@ -359,7 +395,7 @@ PyDoc_STRVAR(bpy_bmvert_is_wire_doc,
static PyObject *bpy_bmvert_is_wire_get(BPy_BMVert *self)
{
BPY_BM_CHECK_OBJ(self);
- return PyBool_FromLong(BM_vert_is_wire(self->bm, self->v));
+ return PyBool_FromLong(BM_vert_is_wire(self->v));
}
@@ -372,7 +408,7 @@ PyDoc_STRVAR(bpy_bmedge_is_manifold_doc,
static PyObject *bpy_bmedge_is_manifold_get(BPy_BMEdge *self)
{
BPY_BM_CHECK_OBJ(self);
- return PyBool_FromLong(BM_edge_is_manifold(self->bm, self->e));
+ return PyBool_FromLong(BM_edge_is_manifold(self->e));
}
@@ -382,7 +418,7 @@ PyDoc_STRVAR(bpy_bmedge_is_wire_doc,
static PyObject *bpy_bmedge_is_wire_get(BPy_BMEdge *self)
{
BPY_BM_CHECK_OBJ(self);
- return PyBool_FromLong(BM_edge_is_wire(self->bm, self->e));
+ return PyBool_FromLong(BM_edge_is_wire(self->e));
}
@@ -420,6 +456,40 @@ static int bpy_bmface_normal_set(BPy_BMFace *self, PyObject *value)
}
}
+PyDoc_STRVAR(bpy_bmface_material_index_doc,
+"The faces material index.\n\n:type: int"
+);
+static PyObject *bpy_bmface_material_index_get(BPy_BMFace *self)
+{
+ BPY_BM_CHECK_OBJ(self);
+ return PyLong_FromLong(self->f->mat_nr);
+}
+
+static int bpy_bmface_material_index_set(BPy_BMFace *self, PyObject *value)
+{
+ int param;
+
+ BPY_BM_CHECK_INT(self);
+
+ param = PyLong_AsLong(value);
+
+ if (param == -1 && PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "expected an int type");
+ return -1;
+ }
+ else if ((param < 0) || (param > MAXMAT)) {
+ /* normally we clamp but in this case raise an error */
+ PyErr_SetString(PyExc_ValueError,
+ "material index outside of usable range (0 - 32766)");
+ return -1;
+ }
+ else {
+ self->f->mat_nr = (short)param;
+ return 0;
+ }
+}
+
/* Loop
* ^^^^ */
@@ -470,17 +540,32 @@ static PyObject *bpy_bmloop_link_loop_prev_get(BPy_BMLoop *self)
return BPy_BMLoop_CreatePyObject(self->bm, self->l->prev);
}
+/* ElemSeq
+ * ^^^^^^^ */
+
+/* note: use for bmvert/edge/face/loop seq's use these, not bmelemseq directly */
+PyDoc_STRVAR(bpy_bmelemseq_layers_doc,
+"blah blah (read-only).\n\n:type: :class:`BMLayerAccess`"
+);
+static PyObject *bpy_bmelemseq_layers_get(BPy_BMElemSeq *self, void *htype)
+{
+ BPY_BM_CHECK_OBJ(self);
+
+ return BPy_BMLayerAccess_CreatePyObject(self->bm, GET_INT_FROM_POINTER(htype));
+}
static PyGetSetDef bpy_bmesh_getseters[] = {
- {(char *)"verts", (getter)bpy_bmelemseq_get, (setter)NULL, (char *)bpy_bmesh_verts_doc, (void *)BM_VERTS_OF_MESH},
- {(char *)"edges", (getter)bpy_bmelemseq_get, (setter)NULL, (char *)bpy_bmesh_edges_doc, (void *)BM_EDGES_OF_MESH},
- {(char *)"faces", (getter)bpy_bmelemseq_get, (setter)NULL, (char *)bpy_bmesh_faces_doc, (void *)BM_FACES_OF_MESH},
+ {(char *)"verts", (getter)bpy_bmvertseq_get, (setter)NULL, (char *)bpy_bmvertseq_doc, NULL},
+ {(char *)"edges", (getter)bpy_bmedgeseq_get, (setter)NULL, (char *)bpy_bmedgeseq_doc, NULL},
+ {(char *)"faces", (getter)bpy_bmfaceseq_get, (setter)NULL, (char *)bpy_bmfaceseq_doc, NULL},
+ {(char *)"loops", (getter)bpy_bmloopseq_get, (setter)NULL, (char *)bpy_bmloopseq_doc, NULL},
{(char *)"select_mode", (getter)bpy_bmesh_select_mode_get, (setter)bpy_bmesh_select_mode_set, (char *)bpy_bmesh_select_mode_doc, NULL},
{(char *)"select_history", (getter)bpy_bmesh_select_history_get, (setter)bpy_bmesh_select_history_set, (char *)bpy_bmesh_select_history_doc, NULL},
/* readonly checks */
- {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+ {(char *)"is_wrapped", (getter)bpy_bmesh_is_wrapped_get, (setter)NULL, (char *)bpy_bmesh_is_wrapped_doc, NULL}, /* as with mathutils */
+ {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -544,6 +629,8 @@ static PyGetSetDef bpy_bmface_getseters[] = {
{(char *)"normal", (getter)bpy_bmface_normal_get, (setter)bpy_bmface_normal_set, (char *)bpy_bmface_normal_doc, NULL},
+ {(char *)"material_index", (getter)bpy_bmface_material_index_get, (setter)bpy_bmface_material_index_set, (char *)bpy_bmface_material_index_doc, NULL},
+
/* connectivity data */
{(char *)"verts", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmface_verts_doc, (void *)BM_VERTS_OF_FACE},
{(char *)"edges", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmface_edges_doc, (void *)BM_EDGES_OF_FACE},
@@ -578,6 +665,23 @@ static PyGetSetDef bpy_bmloop_getseters[] = {
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
+static PyGetSetDef bpy_bmvertseq_getseters[] = {
+ {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_VERT},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+static PyGetSetDef bpy_bmedgeseq_getseters[] = {
+ {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_EDGE},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+static PyGetSetDef bpy_bmfaceseq_getseters[] = {
+ {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_FACE},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+static PyGetSetDef bpy_bmloopseq_getseters[] = {
+ {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_LOOP},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
/* Methods
* ======= */
@@ -586,6 +690,195 @@ static PyGetSetDef bpy_bmloop_getseters[] = {
/* Mesh
* ---- */
+PyDoc_STRVAR(bpy_bmesh_copy_doc,
+".. method:: copy()\n"
+"\n"
+" :return: A copy of this BMesh.\n"
+" :rtype: :class:`BMesh`\n"
+);
+static PyObject *bpy_bmesh_copy(BPy_BMesh *self)
+{
+ BMesh *bm;
+ BMesh *bm_copy;
+
+ BPY_BM_CHECK_OBJ(self);
+
+ bm = self->bm;
+
+ bm_copy = BM_mesh_copy(bm);
+
+ if (bm_copy) {
+ return BPy_BMesh_CreatePyObject(bm_copy, BPY_BMFLAG_NOP);
+ }
+ else {
+ PyErr_SetString(PyExc_SystemError, "Unable to copy BMesh, internal error");
+ return NULL;
+ }
+}
+
+PyDoc_STRVAR(bpy_bmesh_clear_doc,
+".. method:: clear()\n"
+"\n"
+" Clear all mesh data.\n"
+);
+static PyObject *bpy_bmesh_clear(BPy_BMesh *self)
+{
+ BMesh *bm;
+
+ BPY_BM_CHECK_OBJ(self);
+
+ bm = self->bm;
+
+ BM_mesh_clear(bm);
+
+ Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(bpy_bmesh_free_doc,
+".. method:: free()\n"
+"\n"
+" Explicitly free the BMesh data from memory, causing exceptions on further access.\n"
+"\n"
+" .. note::\n"
+"\n"
+" The BMesh is freed automatically, typically when the script finishes executing.\n"
+" However in some cases its hard to predict when this will be and its useful to\n"
+" explicitly free the data.\n"
+);
+static PyObject *bpy_bmesh_free(BPy_BMesh *self)
+{
+ if (self->bm) {
+ BMesh *bm = self->bm;
+
+ if ((self->flag & BPY_BMFLAG_IS_WRAPPED) == 0) {
+ BM_mesh_free(bm);
+ }
+
+ bpy_bm_generic_invalidate((BPy_BMGeneric *)self);
+ }
+
+ Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(bpy_bmesh_to_mesh_doc,
+".. method:: to_mesh(mesh)\n"
+"\n"
+" Writes this BMesh data into an existing Mesh datablock.\n"
+"\n"
+" :arg mesh: The mesh data to write into.\n"
+" :type mesh: :class:`Mesh`\n"
+);
+static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
+{
+ PyObject *py_mesh;
+ Mesh *me;
+ BMesh *bm;
+
+ BPY_BM_CHECK_OBJ(self);
+
+ if (!PyArg_ParseTuple(args, "O:to_mesh", &py_mesh) ||
+ !(me = PyC_RNA_AsPointer(py_mesh, "Mesh")))
+ {
+ return NULL;
+ }
+
+ /* we could allow this but its almost certainly _not_ what script authors want */
+ if (me->edit_btmesh) {
+ PyErr_Format(PyExc_ValueError,
+ "to_mesh(): Mesh '%s' is in editmode", me->id.name + 2);
+ return NULL;
+ }
+
+ bm = self->bm;
+
+ BM_mesh_bm_to_me(bm, me, FALSE);
+
+ /* we could have the user do this but if they forget blender can easy crash
+ * since the references arrays for the objects derived meshes are now invalid */
+ DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+
+ Py_RETURN_NONE;
+}
+
+/* note: rna_Object_to_mesh() also has apply_modifiers arg that works the same way */
+PyDoc_STRVAR(bpy_bmesh_from_object_doc,
+".. method:: from_object(mesh, apply_modifiers=True)\n"
+"\n"
+" Initialize this bmesh from existing object datablock.\n"
+"\n"
+" :arg object: The object data to load.\n"
+" :type object: :class:`Object`\n"
+" :arg apply_modifiers: Use the final display mesh rather then the deformed cage.\n"
+" :type apply_modifiers: boolean\n"
+);
+static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args)
+{
+ PyObject *py_object;
+ Object *ob;
+ BMesh *bm;
+ int apply_modifiers = TRUE;
+ DerivedMesh *dm;
+
+ BPY_BM_CHECK_OBJ(self);
+
+ if (!PyArg_ParseTuple(args, "O|i:from_object", &py_object, &apply_modifiers) ||
+ !(ob = PyC_RNA_AsPointer(py_object, "Object")))
+ {
+ return NULL;
+ }
+
+ dm = apply_modifiers ? ob->derivedFinal : ob->derivedDeform;
+
+ if (dm == NULL) {
+ PyErr_Format(PyExc_ValueError,
+ "from_object(...): Object '%s' has no usable mesh data", ob->id.name + 2);
+ return NULL;
+ }
+
+ bm = self->bm;
+
+ DM_to_bmesh_ex(dm, bm);
+
+ Py_RETURN_NONE;
+}
+
+
+PyDoc_STRVAR(bpy_bmesh_from_mesh_doc,
+".. method:: from_mesh(mesh, use_shape_key=False, shape_key_index=0)\n"
+"\n"
+" Initialize this bmesh from existing mesh datablock.\n"
+"\n"
+" :arg mesh: The mesh data to load.\n"
+" :type mesh: :class:`Mesh`\n"
+" :arg use_shape_key: Use the locations from a shape key.\n"
+" :type use_shape_key: boolean\n"
+" :arg shape_key_index: The shape key index to use.\n"
+" :type shape_key_index: int\n"
+);
+static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *kw)
+{
+ static const char *kwlist[] = {"mesh", "use_shape_key", "shape_key_index", NULL};
+ BMesh *bm;
+ PyObject *py_mesh;
+ Mesh *me;
+ int use_shape_key = FALSE;
+ int shape_key_index = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:from_mesh", (char **)kwlist,
+ &py_mesh, &use_shape_key, &shape_key_index) ||
+ !(me = PyC_RNA_AsPointer(py_mesh, "Mesh")))
+ {
+ return NULL;
+ }
+
+ bm = self->bm;
+
+ BM_mesh_bm_from_me(bm, me, use_shape_key, shape_key_index + 1);
+
+ Py_RETURN_NONE;
+}
+
+
PyDoc_STRVAR(bpy_bmesh_select_flush_mode_doc,
".. method:: select_flush_mode()\n"
"\n"
@@ -734,6 +1027,11 @@ PyDoc_STRVAR(bpy_bm_elem_select_set_doc,
"\n"
" :arg select: Select or de-select.\n"
" :type select: boolean\n"
+"\n"
+" .. note::\n"
+"\n"
+" Currently this only flushes down, so selecting a face will select all its vertices but de-selecting a vertex "
+" won't de-select all the faces that use it, before finishing with a mesh typically flushing is still needed.\n"
);
static PyObject *bpy_bm_elem_select_set(BPy_BMElem *self, PyObject *value)
{
@@ -836,7 +1134,7 @@ static PyObject *bpy_bmvert_copy_from_vert_interp(BPy_BMVert *self, PyObject *ar
Py_ssize_t vert_seq_len; /* always 2 */
vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2,
- &vert_seq_len, &BPy_BMVert_Type,
+ &vert_seq_len, BM_VERT,
TRUE, TRUE, "BMVert.copy_from_vert_interp(...)");
if (vert_array == NULL) {
@@ -899,7 +1197,7 @@ PyDoc_STRVAR(bpy_bmvert_calc_edge_angle_doc,
static PyObject *bpy_bmvert_calc_edge_angle(BPy_BMVert *self)
{
BPY_BM_CHECK_OBJ(self);
- return PyFloat_FromDouble(BM_vert_edge_angle(self->bm, self->v));
+ return PyFloat_FromDouble(BM_vert_edge_angle(self->v));
}
@@ -921,18 +1219,28 @@ static PyObject *bpy_bmvert_normal_update(BPy_BMVert *self)
/* Edge
* ---- */
+PyDoc_STRVAR(bpy_bmedge_calc_length_doc,
+".. method:: calc_length()\n"
+"\n"
+" :return: The length between both verts.\n"
+" :rtype: float\n"
+);
+static PyObject *bpy_bmedge_calc_length(BPy_BMEdge *self)
+{
+ BPY_BM_CHECK_OBJ(self);
+ return PyFloat_FromDouble(len_v3v3(self->e->v1->co, self->e->v2->co));
+}
+
PyDoc_STRVAR(bpy_bmedge_calc_face_angle_doc,
".. method:: calc_face_angle()\n"
"\n"
-" Return the angle between 2 connected faces.\n"
-"\n"
-" :return: The angle between both faces in radians.\n"
+" :return: The angle between 2 connected faces in radians.\n"
" :rtype: float\n"
);
static PyObject *bpy_bmedge_calc_face_angle(BPy_BMEdge *self)
{
BPY_BM_CHECK_OBJ(self);
- return PyFloat_FromDouble(BM_edge_face_angle(self->bm, self->e));
+ return PyFloat_FromDouble(BM_edge_face_angle(self->e));
}
@@ -1190,25 +1498,69 @@ static PyObject *bpy_bmloop_copy_from_face_interp(BPy_BMLoop *self, PyObject *ar
}
-PyDoc_STRVAR(bpy_bmloop_calc_face_angle_doc,
-".. method:: calc_face_angle()\n"
+PyDoc_STRVAR(bpy_bmloop_calc_angle_doc,
+".. method:: calc_angle()\n"
"\n"
-" Return angle at this loops corner of the face.\n"
+" Return the angle at this loops corner of the face.\n"
" This is calculated so sharper corners give lower angles.\n"
"\n"
" :return: The angle in radians.\n"
" :rtype: float\n"
);
-static PyObject *bpy_bmloop_calc_face_angle(BPy_BMLoop *self)
+static PyObject *bpy_bmloop_calc_angle(BPy_BMLoop *self)
{
BPY_BM_CHECK_OBJ(self);
- return PyFloat_FromDouble(BM_loop_face_angle(self->bm, self->l));
+ return PyFloat_FromDouble(BM_loop_face_angle(self->l));
}
+PyDoc_STRVAR(bpy_bmloop_calc_normal_doc,
+".. method:: calc_normal()\n"
+"\n"
+" Return normal at this loops corner of the face.\n"
+" Falls back to the face normal for straignt lines.\n"
+"\n"
+" :return: a normalized vector.\n"
+" :rtype: :class:`mathutils.Vector`\n"
+);
+static PyObject *bpy_bmloop_calc_normal(BPy_BMLoop *self)
+{
+ float vec[3];
+ BPY_BM_CHECK_OBJ(self);
+ BM_loop_face_normal(self->l, vec);
+ return Vector_CreatePyObject(vec, 3, Py_NEW, NULL);
+}
+
+PyDoc_STRVAR(bpy_bmloop_calc_tangent_doc,
+".. method:: calc_tangent()\n"
+"\n"
+" Return the tangent at this loops corner of the face (pointing inward into the face).\n"
+" Falls back to the face normal for straignt lines.\n"
+"\n"
+" :return: a normalized vector.\n"
+" :rtype: :class:`mathutils.Vector`\n"
+);
+static PyObject *bpy_bmloop_calc_tangent(BPy_BMLoop *self)
+{
+ float vec[3];
+ BPY_BM_CHECK_OBJ(self);
+ BM_loop_face_tangent(self->l, vec);
+ return Vector_CreatePyObject(vec, 3, Py_NEW, NULL);
+}
/* Vert Seq
* -------- */
-
+PyDoc_STRVAR(bpy_bmvertseq_new_doc,
+".. method:: new(co=(0.0, 0.0, 0.0), example=None)\n"
+"\n"
+" Create a new vertex.\n"
+"\n"
+" :arg co: The initial location of the vertex (optional argument).\n"
+" :type co: float triplet\n"
+" :arg example: Existing vert to initialize settings.\n"
+" :type example: :class:`BMVert`\n"
+" :return: The newly created edge.\n"
+" :rtype: :class:`BMVert`\n"
+);
static PyObject *bpy_bmvertseq_new(BPy_BMElemSeq *self, PyObject *args)
{
PyObject *py_co = NULL;
@@ -1254,7 +1606,18 @@ static PyObject *bpy_bmvertseq_new(BPy_BMElemSeq *self, PyObject *args)
/* Edge Seq
* -------- */
-
+PyDoc_STRVAR(bpy_bmedgeseq_new_doc,
+".. method:: new(verts, example=None)\n"
+"\n"
+" Create a new edge from a given pair of verts.\n"
+"\n"
+" :arg verts: Vertex pair.\n"
+" :type verts: pair of :class:`BMVert`\n"
+" :arg example: Existing edge to initialize settings (optional argument).\n"
+" :type example: :class:`BMEdge`\n"
+" :return: The newly created edge.\n"
+" :rtype: :class:`BMEdge`\n"
+);
static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
{
PyObject *vert_seq;
@@ -1280,7 +1643,7 @@ static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
}
vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2,
- &vert_seq_len, &BPy_BMVert_Type,
+ &vert_seq_len, BM_VERT,
TRUE, TRUE, "edges.new(...)");
if (vert_array == NULL) {
@@ -1316,7 +1679,18 @@ cleanup:
/* Face Seq
* -------- */
-
+PyDoc_STRVAR(bpy_bmfaceseq_new_doc,
+".. method:: new(verts, example=None)\n"
+"\n"
+" Create a new face from a given set of verts.\n"
+"\n"
+" :arg verts: Sequence of 3 or more verts.\n"
+" :type verts: :class:`BMVert`\n"
+" :arg example: Existing face to initialize settings (optional argument).\n"
+" :type example: :class:`BMFace`\n"
+" :return: The newly created face.\n"
+" :rtype: :class:`BMFace`\n"
+);
static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
{
PyObject *vert_seq;
@@ -1347,7 +1721,7 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
}
vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 3, PY_SSIZE_T_MAX,
- &vert_seq_len, &BPy_BMVert_Type,
+ &vert_seq_len, BM_VERT,
TRUE, TRUE, "faces.new(...)");
if (vert_array == NULL) {
@@ -1367,7 +1741,7 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
edge_array = (BMEdge **)PyMem_MALLOC(vert_seq_len * sizeof(BMEdge **));
/* ensure edges */
- for (i = vert_seq_len - 1, i_next = 0; i_next < vert_seq_len; (i=i_next++)) {
+ for (i = vert_seq_len - 1, i_next = 0; i_next < vert_seq_len; (i = i_next++)) {
edge_array[i] = BM_edge_create(bm, vert_array[i], vert_array[i_next], NULL, TRUE);
}
@@ -1396,60 +1770,11 @@ cleanup:
/* Elem Seq
* -------- */
-/* eek - 3 docstrings in 1!, we might need to split up this seq at some point */
-PyDoc_STRVAR(bpy_bmelemseq_new_doc,
-".. method:: new(co=(0.0, 0.0, 0.0), example=None)\n"
-"\n"
-" *Vertex Sequence*\n"
-"\n"
-" :arg co: The initial location of the vertex (optional argument).\n"
-" :type co: float triplet\n"
-" :arg example: Existing vert to initialize settings.\n"
-" :type example: :class:`BMVert`\n"
-" :return: The newly created edge.\n"
-" :rtype: :class:`BMVert`\n"
-"\n"
-"\n"
-".. method:: new(verts, example=None)\n"
-"\n"
-" *Edge Sequence*\n"
-"\n"
-" :arg verts: Vertex pair.\n"
-" :type verts: pair of :class:`BMVert`\n"
-" :arg example: Existing edge to initialize settings (optional argument).\n"
-" :type example: :class:`BMEdge`\n"
-" :return: The newly created edge.\n"
-" :rtype: :class:`BMEdge`\n"
-"\n"
-".. method:: new(verts, example=None)\n"
-"\n"
-" *Face Sequence*\n"
+PyDoc_STRVAR(bpy_bmvertseq_remove_doc,
+".. method:: remove(vert)\n"
"\n"
-" Create a new vert/edge/face.\n"
-"\n"
-" :arg verts: Sequence of 3 or more verts.\n"
-" :type verts: :class:`BMVert`\n"
-" :arg example: Existing face to initialize settings (optional argument).\n"
-" :type example: :class:`BMFace`\n"
-" :return: The newly created face.\n"
-" :rtype: :class:`BMFace`\n"
+" Remove a vert.\n"
);
-static PyObject *bpy_bmelemseq_new(BPy_BMElemSeq *self, PyObject *args)
-{
- switch ((BMIterType)self->itype) {
- case BM_VERTS_OF_MESH:
- return bpy_bmvertseq_new(self, args);
- case BM_EDGES_OF_MESH:
- return bpy_bmedgeseq_new(self, args);
- case BM_FACES_OF_MESH:
- return bpy_bmfaceseq_new(self, args);
- default:
- PyErr_SetString(PyExc_TypeError,
- ".new(...): function is not valid for this sequence");
- return NULL;
- }
-}
-
static PyObject *bpy_bmvertseq_remove(BPy_BMElemSeq *self, BPy_BMVert *value)
{
BPY_BM_CHECK_OBJ(self);
@@ -1464,7 +1789,7 @@ static PyObject *bpy_bmvertseq_remove(BPy_BMElemSeq *self, BPy_BMVert *value)
if (value->bm != bm) {
PyErr_SetString(PyExc_ValueError,
- "faces.remove(vert): vertex is from another mesh");
+ "verts.remove(vert): vert is from another mesh");
return NULL;
}
@@ -1475,6 +1800,11 @@ static PyObject *bpy_bmvertseq_remove(BPy_BMElemSeq *self, BPy_BMVert *value)
}
}
+PyDoc_STRVAR(bpy_bmedgeseq_remove_doc,
+".. method:: remove(edge)\n"
+"\n"
+" Remove a edge.\n"
+);
static PyObject *bpy_bmedgeseq_remove(BPy_BMElemSeq *self, BPy_BMEdge *value)
{
BPY_BM_CHECK_OBJ(self);
@@ -1489,7 +1819,7 @@ static PyObject *bpy_bmedgeseq_remove(BPy_BMElemSeq *self, BPy_BMEdge *value)
if (value->bm != bm) {
PyErr_SetString(PyExc_ValueError,
- "faces.remove(vert): vertex is from another mesh");
+ "edges.remove(edge): edge is from another mesh");
return NULL;
}
@@ -1500,6 +1830,11 @@ static PyObject *bpy_bmedgeseq_remove(BPy_BMElemSeq *self, BPy_BMEdge *value)
}
}
+PyDoc_STRVAR(bpy_bmfaceseq_remove_doc,
+".. method:: remove(face)\n"
+"\n"
+" Remove a face.\n"
+);
static PyObject *bpy_bmfaceseq_remove(BPy_BMElemSeq *self, BPy_BMFace *value)
{
BPY_BM_CHECK_OBJ(self);
@@ -1514,7 +1849,7 @@ static PyObject *bpy_bmfaceseq_remove(BPy_BMElemSeq *self, BPy_BMFace *value)
if (value->bm != bm) {
PyErr_SetString(PyExc_ValueError,
- "faces.remove(vert): vertex is from another mesh");
+ "faces.remove(face): face is from another mesh");
return NULL;
}
@@ -1525,30 +1860,18 @@ static PyObject *bpy_bmfaceseq_remove(BPy_BMElemSeq *self, BPy_BMFace *value)
}
}
-
-PyDoc_STRVAR(bpy_bmelemseq_remove_doc,
-".. method:: remove(elem)\n"
+PyDoc_STRVAR(bpy_bmedgeseq_get__method_doc,
+".. method:: get(verts, fallback=None)\n"
"\n"
-" Remove a vert/edge/face.\n"
+" Return a edge which uses the **verts** passed.\n"
+"\n"
+" :arg verts: Sequence of verts.\n"
+" :type verts: :class:`BMVert`\n"
+" :arg fallback: Return this value if nothing is found.\n"
+" :return: The edge found or None\n"
+" :rtype: :class:`BMEdge`\n"
);
-static PyObject *bpy_bmelemseq_remove(BPy_BMElemSeq *self, PyObject *value)
-{
- switch ((BMIterType)self->itype) {
- case BM_VERTS_OF_MESH:
- return bpy_bmvertseq_remove(self, (BPy_BMVert *)value);
- case BM_EDGES_OF_MESH:
- return bpy_bmedgeseq_remove(self, (BPy_BMEdge *)value);
- case BM_FACES_OF_MESH:
- return bpy_bmfaceseq_remove(self, (BPy_BMFace *)value);
- default:
- PyErr_SetString(PyExc_TypeError,
- ".remove(item): function is not valid for this sequence");
- return NULL;
- }
-}
-
-
-static PyObject *bpy_bmedgeseq_get(BPy_BMElemSeq *self, PyObject *args)
+static PyObject *bpy_bmedgeseq_get__method(BPy_BMElemSeq *self, PyObject *args)
{
PyObject *vert_seq;
PyObject *fallback = Py_None; /* optional */
@@ -1569,7 +1892,7 @@ static PyObject *bpy_bmedgeseq_get(BPy_BMElemSeq *self, PyObject *args)
PyObject *ret = NULL;
vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2,
- &vert_seq_len, &BPy_BMVert_Type,
+ &vert_seq_len, BM_VERT,
TRUE, TRUE, "edges.get(...)");
if (vert_array == NULL) {
@@ -1589,8 +1912,18 @@ static PyObject *bpy_bmedgeseq_get(BPy_BMElemSeq *self, PyObject *args)
}
}
-
-static PyObject *bpy_bmfaceseq_get(BPy_BMElemSeq *self, PyObject *args)
+PyDoc_STRVAR(bpy_bmfaceseq_get__method_doc,
+".. method:: get(verts, fallback=None)\n"
+"\n"
+" Return a face which uses the **verts** passed.\n"
+"\n"
+" :arg verts: Sequence of verts.\n"
+" :type verts: :class:`BMVert`\n"
+" :arg fallback: Return this value if nothing is found.\n"
+" :return: The face found or None\n"
+" :rtype: :class:`BMFace`\n"
+);
+static PyObject *bpy_bmfaceseq_get__method(BPy_BMElemSeq *self, PyObject *args)
{
PyObject *vert_seq;
PyObject *fallback = Py_None; /* optional */
@@ -1611,7 +1944,7 @@ static PyObject *bpy_bmfaceseq_get(BPy_BMElemSeq *self, PyObject *args)
PyObject *ret = NULL;
vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 1, PY_SSIZE_T_MAX,
- &vert_seq_len, &BPy_BMVert_Type,
+ &vert_seq_len, BM_VERT,
TRUE, TRUE, "faces.get(...)");
if (vert_array == NULL) {
@@ -1631,31 +1964,6 @@ static PyObject *bpy_bmfaceseq_get(BPy_BMElemSeq *self, PyObject *args)
}
}
-
-PyDoc_STRVAR(bpy_bmelemseq_get__method_doc,
-".. method:: get(verts, fallback=None)\n"
-"\n"
-" Return a face/edge which uses the **verts** passed.\n"
-"\n"
-" :arg verts: Sequence of verts.\n"
-" :type verts: :class:`BMVert`\n"
-" :arg fallback: Return this value if nothing is found.\n"
-);
-static PyObject *bpy_bmelemseq_get__method(BPy_BMElemSeq *self, PyObject *args)
-{
- switch ((BMIterType)self->itype) {
- case BM_EDGES_OF_MESH:
- return bpy_bmedgeseq_get(self, args);
- case BM_FACES_OF_MESH:
- return bpy_bmfaceseq_get(self, args);
- default:
- PyErr_SetString(PyExc_TypeError,
- ".get(item): function is not valid for this sequence");
- return NULL;
- }
-}
-
-
PyDoc_STRVAR(bpy_bmelemseq_index_update_doc,
".. method:: index_update()\n"
"\n"
@@ -1702,7 +2010,7 @@ static PyObject *bpy_bmelemseq_index_update(BPy_BMElemSeq *self)
}
if (htype & (BM_VERT | BM_EDGE | BM_FACE)) {
- /* since this isnt the normal vert/edge/face loops,
+ /* since this isn't the normal vert/edge/face loops,
* we're setting dirty values here. so tag as dirty. */
bm->elem_index_dirty |= htype;
}
@@ -1716,6 +2024,17 @@ static PyObject *bpy_bmelemseq_index_update(BPy_BMElemSeq *self)
static struct PyMethodDef bpy_bmesh_methods[] = {
+ /* utility */
+ {"copy", (PyCFunction)bpy_bmesh_copy, METH_NOARGS, bpy_bmesh_copy_doc},
+ {"clear", (PyCFunction)bpy_bmesh_clear, METH_NOARGS, bpy_bmesh_clear_doc},
+ {"free", (PyCFunction)bpy_bmesh_free, METH_NOARGS, bpy_bmesh_free_doc},
+
+ /* conversion */
+ {"from_object", (PyCFunction)bpy_bmesh_from_object, METH_VARARGS | METH_KEYWORDS, bpy_bmesh_from_object_doc},
+ {"from_mesh", (PyCFunction)bpy_bmesh_from_mesh, METH_VARARGS | METH_KEYWORDS, bpy_bmesh_from_mesh_doc},
+ {"to_mesh", (PyCFunction)bpy_bmesh_to_mesh, METH_VARARGS, bpy_bmesh_to_mesh_doc},
+
+ /* meshdata */
{"select_flush_mode", (PyCFunction)bpy_bmesh_select_flush_mode, METH_NOARGS, bpy_bmesh_select_flush_mode_doc},
{"select_flush", (PyCFunction)bpy_bmesh_select_flush, METH_O, bpy_bmesh_select_flush_doc},
{"normal_update", (PyCFunction)bpy_bmesh_normal_update, METH_VARARGS, bpy_bmesh_normal_update_doc},
@@ -1744,6 +2063,7 @@ static struct PyMethodDef bpy_bmedge_methods[] = {
{"other_vert", (PyCFunction)bpy_bmedge_other_vert, METH_O, bpy_bmedge_other_vert_doc},
+ {"calc_length", (PyCFunction)bpy_bmedge_calc_length, METH_NOARGS, bpy_bmedge_calc_length_doc},
{"calc_face_angle", (PyCFunction)bpy_bmedge_calc_face_angle, METH_NOARGS, bpy_bmedge_calc_face_angle_doc},
{"normal_update", (PyCFunction)bpy_bmedge_normal_update, METH_NOARGS, bpy_bmedge_normal_update_doc},
@@ -1773,16 +2093,50 @@ static struct PyMethodDef bpy_bmloop_methods[] = {
{"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
{"copy_from_face_interp", (PyCFunction)bpy_bmloop_copy_from_face_interp, METH_O, bpy_bmloop_copy_from_face_interp_doc},
- {"calc_angle", (PyCFunction)bpy_bmloop_calc_face_angle, METH_NOARGS, bpy_bmloop_calc_face_angle_doc},
+ {"calc_angle", (PyCFunction)bpy_bmloop_calc_angle, METH_NOARGS, bpy_bmloop_calc_angle_doc},
+ {"calc_normal", (PyCFunction)bpy_bmloop_calc_normal, METH_NOARGS, bpy_bmloop_calc_normal_doc},
+ {"calc_tangent", (PyCFunction)bpy_bmloop_calc_tangent, METH_NOARGS, bpy_bmloop_calc_tangent_doc},
{NULL, NULL, 0, NULL}
};
static struct PyMethodDef bpy_bmelemseq_methods[] = {
- {"new", (PyCFunction)bpy_bmelemseq_new, METH_VARARGS, bpy_bmelemseq_new_doc},
- {"remove", (PyCFunction)bpy_bmelemseq_remove, METH_O, bpy_bmelemseq_remove_doc},
+ /* odd function, initializes index values */
+ {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+ {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmvertseq_methods[] = {
+ {"new", (PyCFunction)bpy_bmvertseq_new, METH_VARARGS, bpy_bmvertseq_new_doc},
+ {"remove", (PyCFunction)bpy_bmvertseq_remove, METH_O, bpy_bmvertseq_remove_doc},
+
+ /* odd function, initializes index values */
+ {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+ {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmedgeseq_methods[] = {
+ {"new", (PyCFunction)bpy_bmedgeseq_new, METH_VARARGS, bpy_bmedgeseq_new_doc},
+ {"remove", (PyCFunction)bpy_bmedgeseq_remove, METH_O, bpy_bmedgeseq_remove_doc},
+ /* 'bpy_bmelemseq_get' for different purpose */
+ {"get", (PyCFunction)bpy_bmedgeseq_get__method, METH_VARARGS, bpy_bmedgeseq_get__method_doc},
+
+ /* odd function, initializes index values */
+ {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+ {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmfaceseq_methods[] = {
+ {"new", (PyCFunction)bpy_bmfaceseq_new, METH_VARARGS, bpy_bmfaceseq_new_doc},
+ {"remove", (PyCFunction)bpy_bmfaceseq_remove, METH_O, bpy_bmfaceseq_remove_doc},
/* 'bpy_bmelemseq_get' for different purpose */
- {"get", (PyCFunction)bpy_bmelemseq_get__method, METH_VARARGS, bpy_bmelemseq_get__method_doc},
+ {"get", (PyCFunction)bpy_bmfaceseq_get__method, METH_VARARGS, bpy_bmfaceseq_get__method_doc},
+
+ /* odd function, initializes index values */
+ {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+ {NULL, NULL, 0, NULL}
+};
+static struct PyMethodDef bpy_bmloopseq_methods[] = {
/* odd function, initializes index values */
{"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
{NULL, NULL, 0, NULL}
@@ -1791,6 +2145,9 @@ static struct PyMethodDef bpy_bmelemseq_methods[] = {
/* Sequences
* ========= */
+/* BMElemSeq / Iter
+ * ---------------- */
+
static PyTypeObject *bpy_bm_itype_as_pytype(const char itype)
{
/* should cover all types */
@@ -1928,7 +2285,7 @@ static PyObject *bpy_bmelemseq_subscript_slice(BPy_BMElemSeq *self, Py_ssize_t s
static PyObject *bpy_bmelemseq_subscript(BPy_BMElemSeq *self, PyObject *key)
{
- /* dont need error check here */
+ /* don't need error check here */
if (PyIndex_Check(key)) {
Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
@@ -1999,6 +2356,23 @@ static int bpy_bmelemseq_contains(BPy_BMElemSeq *self, PyObject *value)
return 0;
}
+/* BMElem (customdata)
+ * ------------------- */
+
+static PyObject *bpy_bmelem_subscript(BPy_BMElem *self, BPy_BMLayerItem *key)
+{
+ BPY_BM_CHECK_OBJ(self);
+
+ return BPy_BMLayerItem_GetItem(self, key);
+}
+
+static int bpy_bmelem_ass_subscript(BPy_BMElem *self, BPy_BMLayerItem *key, PyObject *value)
+{
+ BPY_BM_CHECK_INT(self);
+
+ return BPy_BMLayerItem_SetItem(self, key, value);
+}
+
static PySequenceMethods bpy_bmelemseq_as_sequence = {
(lenfunc)bpy_bmelemseq_length, /* sq_length */
NULL, /* sq_concat */
@@ -2018,6 +2392,13 @@ static PyMappingMethods bpy_bmelemseq_as_mapping = {
(objobjargproc)NULL, /* mp_ass_subscript */
};
+/* for customdata access */
+static PyMappingMethods bpy_bm_elem_as_mapping = {
+ (lenfunc)NULL, /* mp_length */ /* keep this empty, messes up 'if elem: ...' test */
+ (binaryfunc)bpy_bmelem_subscript, /* mp_subscript */
+ (objobjargproc)bpy_bmelem_ass_subscript, /* mp_ass_subscript */
+};
+
/* Iterator
* -------- */
@@ -2060,10 +2441,10 @@ static void bpy_bmesh_dealloc(BPy_BMesh *self)
BM_data_layer_free(bm, &bm->ldata, CD_BM_ELEM_PYPTR);
bm->py_handle = NULL;
- }
- if (self->py_owns) {
- BM_mesh_free(bm);
+ if ((self->flag & BPY_BMFLAG_IS_WRAPPED) == 0) {
+ BM_mesh_free(bm);
+ }
}
PyObject_DEL(self);
@@ -2175,8 +2556,9 @@ static PyObject *bpy_bmvert_repr(BPy_BMVert *self)
BMesh *bm = self->bm;
if (bm) {
+ BMVert *v = self->v;
return PyUnicode_FromFormat("<BMVert(%p), index=%d>",
- self->v, BM_elem_index_get(self->v));
+ v, BM_elem_index_get(v));
}
else {
return PyUnicode_FromFormat("<BMVert dead at %p>", self);
@@ -2188,10 +2570,11 @@ static PyObject *bpy_bmedge_repr(BPy_BMEdge *self)
BMesh *bm = self->bm;
if (bm) {
+ BMEdge *e = self->e;
return PyUnicode_FromFormat("<BMEdge(%p), index=%d, verts=(%p/%d, %p/%d)>",
- self->e, BM_elem_index_get(self->e),
- self->e->v1, BM_elem_index_get(self->e->v1),
- self->e->v2, BM_elem_index_get(self->e->v2));
+ e, BM_elem_index_get(e),
+ e->v1, BM_elem_index_get(e->v1),
+ e->v2, BM_elem_index_get(e->v2));
}
else {
return PyUnicode_FromFormat("<BMEdge dead at %p>", self);
@@ -2203,9 +2586,10 @@ static PyObject *bpy_bmface_repr(BPy_BMFace *self)
BMesh *bm = self->bm;
if (bm) {
+ BMFace *f = self->f;
return PyUnicode_FromFormat("<BMFace(%p), index=%d, totverts=%d>",
- self->f, BM_elem_index_get(self->f),
- self->f->len);
+ f, BM_elem_index_get(f),
+ f->len);
}
else {
return PyUnicode_FromFormat("<BMFace dead at %p>", self);
@@ -2217,11 +2601,12 @@ static PyObject *bpy_bmloop_repr(BPy_BMLoop *self)
BMesh *bm = self->bm;
if (bm) {
+ BMLoop *l = self->l;
return PyUnicode_FromFormat("<BMLoop(%p), index=%d, vert=%p/%d, edge=%p/%d, face=%p/%d>",
- self->l, BM_elem_index_get(self->l),
- self->l->v, BM_elem_index_get(self->l->v),
- self->l->e, BM_elem_index_get(self->l->e),
- self->l->f, BM_elem_index_get(self->l->f));
+ l, BM_elem_index_get(l),
+ l->v, BM_elem_index_get(l->v),
+ l->e, BM_elem_index_get(l->e),
+ l->f, BM_elem_index_get(l->f));
}
else {
return PyUnicode_FromFormat("<BMLoop dead at %p>", self);
@@ -2237,6 +2622,10 @@ PyTypeObject BPy_BMEdge_Type = {{{0}}};
PyTypeObject BPy_BMFace_Type = {{{0}}};
PyTypeObject BPy_BMLoop_Type = {{{0}}};
PyTypeObject BPy_BMElemSeq_Type = {{{0}}};
+PyTypeObject BPy_BMVertSeq_Type = {{{0}}};
+PyTypeObject BPy_BMEdgeSeq_Type = {{{0}}};
+PyTypeObject BPy_BMFaceSeq_Type = {{{0}}};
+PyTypeObject BPy_BMLoopSeq_Type = {{{0}}};
PyTypeObject BPy_BMIter_Type = {{{0}}};
@@ -2249,6 +2638,10 @@ void BPy_BM_init_types(void)
BPy_BMFace_Type.tp_basicsize = sizeof(BPy_BMFace);
BPy_BMLoop_Type.tp_basicsize = sizeof(BPy_BMLoop);
BPy_BMElemSeq_Type.tp_basicsize = sizeof(BPy_BMElemSeq);
+ BPy_BMVertSeq_Type.tp_basicsize = sizeof(BPy_BMElemSeq);
+ BPy_BMEdgeSeq_Type.tp_basicsize = sizeof(BPy_BMElemSeq);
+ BPy_BMFaceSeq_Type.tp_basicsize = sizeof(BPy_BMElemSeq);
+ BPy_BMLoopSeq_Type.tp_basicsize = sizeof(BPy_BMElemSeq);
BPy_BMIter_Type.tp_basicsize = sizeof(BPy_BMIter);
@@ -2258,6 +2651,10 @@ void BPy_BM_init_types(void)
BPy_BMFace_Type.tp_name = "BMFace";
BPy_BMLoop_Type.tp_name = "BMLoop";
BPy_BMElemSeq_Type.tp_name = "BMElemSeq";
+ BPy_BMVertSeq_Type.tp_name = "BMVertSeq";
+ BPy_BMEdgeSeq_Type.tp_name = "BMEdgeSeq";
+ BPy_BMFaceSeq_Type.tp_name = "BMFaceSeq";
+ BPy_BMLoopSeq_Type.tp_name = "BMLoopSeq";
BPy_BMIter_Type.tp_name = "BMIter";
@@ -2267,6 +2664,10 @@ void BPy_BM_init_types(void)
BPy_BMFace_Type.tp_doc = bpy_bmface_doc;
BPy_BMLoop_Type.tp_doc = bpy_bmloop_doc;
BPy_BMElemSeq_Type.tp_doc = bpy_bmelemseq_doc;
+ BPy_BMVertSeq_Type.tp_doc = NULL;
+ BPy_BMEdgeSeq_Type.tp_doc = NULL;
+ BPy_BMFaceSeq_Type.tp_doc = NULL;
+ BPy_BMLoopSeq_Type.tp_doc = NULL;
BPy_BMIter_Type.tp_doc = bpy_bmiter_doc;
@@ -2276,6 +2677,10 @@ void BPy_BM_init_types(void)
BPy_BMFace_Type.tp_repr = (reprfunc)bpy_bmface_repr;
BPy_BMLoop_Type.tp_repr = (reprfunc)bpy_bmloop_repr;
BPy_BMElemSeq_Type.tp_repr = NULL;
+ BPy_BMVertSeq_Type.tp_repr = NULL;
+ BPy_BMEdgeSeq_Type.tp_repr = NULL;
+ BPy_BMFaceSeq_Type.tp_repr = NULL;
+ BPy_BMLoopSeq_Type.tp_repr = NULL;
BPy_BMIter_Type.tp_repr = NULL;
@@ -2285,6 +2690,10 @@ void BPy_BM_init_types(void)
BPy_BMFace_Type.tp_getset = bpy_bmface_getseters;
BPy_BMLoop_Type.tp_getset = bpy_bmloop_getseters;
BPy_BMElemSeq_Type.tp_getset = NULL;
+ BPy_BMVertSeq_Type.tp_getset = bpy_bmvertseq_getseters;
+ BPy_BMEdgeSeq_Type.tp_getset = bpy_bmedgeseq_getseters;
+ BPy_BMFaceSeq_Type.tp_getset = bpy_bmfaceseq_getseters;
+ BPy_BMLoopSeq_Type.tp_getset = bpy_bmloopseq_getseters;
BPy_BMIter_Type.tp_getset = NULL;
@@ -2294,6 +2703,10 @@ void BPy_BM_init_types(void)
BPy_BMFace_Type.tp_methods = bpy_bmface_methods;
BPy_BMLoop_Type.tp_methods = bpy_bmloop_methods;
BPy_BMElemSeq_Type.tp_methods = bpy_bmelemseq_methods;
+ BPy_BMVertSeq_Type.tp_methods = bpy_bmvertseq_methods;
+ BPy_BMEdgeSeq_Type.tp_methods = bpy_bmedgeseq_methods;
+ BPy_BMFaceSeq_Type.tp_methods = bpy_bmfaceseq_methods;
+ BPy_BMLoopSeq_Type.tp_methods = bpy_bmloopseq_methods;
BPy_BMIter_Type.tp_methods = NULL;
@@ -2303,13 +2716,35 @@ void BPy_BM_init_types(void)
BPy_BMFace_Type.tp_hash = bpy_bm_elem_hash;
BPy_BMLoop_Type.tp_hash = bpy_bm_elem_hash;
BPy_BMElemSeq_Type.tp_hash = NULL;
+ BPy_BMVertSeq_Type.tp_hash = NULL;
+ BPy_BMEdgeSeq_Type.tp_hash = NULL;
+ BPy_BMFaceSeq_Type.tp_hash = NULL;
+ BPy_BMLoopSeq_Type.tp_hash = NULL;
BPy_BMIter_Type.tp_hash = NULL;
BPy_BMElemSeq_Type.tp_as_sequence = &bpy_bmelemseq_as_sequence;
+ BPy_BMVertSeq_Type.tp_as_sequence = &bpy_bmelemseq_as_sequence;
+ BPy_BMEdgeSeq_Type.tp_as_sequence = &bpy_bmelemseq_as_sequence;
+ BPy_BMFaceSeq_Type.tp_as_sequence = &bpy_bmelemseq_as_sequence;
+ BPy_BMLoopSeq_Type.tp_as_sequence = NULL; /* this is not a seq really, only for layer access */
BPy_BMElemSeq_Type.tp_as_mapping = &bpy_bmelemseq_as_mapping;
+ BPy_BMVertSeq_Type.tp_as_mapping = &bpy_bmelemseq_as_mapping;
+ BPy_BMEdgeSeq_Type.tp_as_mapping = &bpy_bmelemseq_as_mapping;
+ BPy_BMFaceSeq_Type.tp_as_mapping = &bpy_bmelemseq_as_mapping;
+ BPy_BMLoopSeq_Type.tp_as_mapping = NULL; /* this is not a seq really, only for layer access */
+
+ /* layer access */
+ BPy_BMVert_Type.tp_as_mapping = &bpy_bm_elem_as_mapping;
+ BPy_BMEdge_Type.tp_as_mapping = &bpy_bm_elem_as_mapping;
+ BPy_BMFace_Type.tp_as_mapping = &bpy_bm_elem_as_mapping;
+ BPy_BMLoop_Type.tp_as_mapping = &bpy_bm_elem_as_mapping;
BPy_BMElemSeq_Type.tp_iter = (getiterfunc)bpy_bmelemseq_iter;
+ BPy_BMVertSeq_Type.tp_iter = (getiterfunc)bpy_bmelemseq_iter;
+ BPy_BMEdgeSeq_Type.tp_iter = (getiterfunc)bpy_bmelemseq_iter;
+ BPy_BMFaceSeq_Type.tp_iter = (getiterfunc)bpy_bmelemseq_iter;
+ BPy_BMLoopSeq_Type.tp_iter = NULL; /* no mapping */
/* only 1 iteratir so far */
BPy_BMIter_Type.tp_iternext = (iternextfunc)bpy_bmiter_next;
@@ -2321,24 +2756,22 @@ void BPy_BM_init_types(void)
BPy_BMFace_Type.tp_dealloc = (destructor)bpy_bmface_dealloc;
BPy_BMLoop_Type.tp_dealloc = (destructor)bpy_bmloop_dealloc;
BPy_BMElemSeq_Type.tp_dealloc = (destructor)bpy_bmelemseq_dealloc;
+ BPy_BMVertSeq_Type.tp_dealloc = (destructor)bpy_bmelemseq_dealloc;
+ BPy_BMEdgeSeq_Type.tp_dealloc = (destructor)bpy_bmelemseq_dealloc;
+ BPy_BMFaceSeq_Type.tp_dealloc = (destructor)bpy_bmelemseq_dealloc;
+ BPy_BMLoopSeq_Type.tp_dealloc = (destructor)bpy_bmelemseq_dealloc;
BPy_BMIter_Type.tp_dealloc = NULL;
- /*
- * BPy_BMesh_Type.
- * BPy_BMVert_Type.
- * BPy_BMEdge_Type.
- * BPy_BMFace_Type.
- * BPy_BMLoop_Type.
- * BPy_BMElemSeq_Type.
- * BPy_BMIter_Type.
- */
-
BPy_BMesh_Type.tp_flags = Py_TPFLAGS_DEFAULT;
BPy_BMVert_Type.tp_flags = Py_TPFLAGS_DEFAULT;
BPy_BMEdge_Type.tp_flags = Py_TPFLAGS_DEFAULT;
BPy_BMFace_Type.tp_flags = Py_TPFLAGS_DEFAULT;
BPy_BMLoop_Type.tp_flags = Py_TPFLAGS_DEFAULT;
BPy_BMElemSeq_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+ BPy_BMVertSeq_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+ BPy_BMEdgeSeq_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+ BPy_BMFaceSeq_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+ BPy_BMLoopSeq_Type.tp_flags = Py_TPFLAGS_DEFAULT;
BPy_BMIter_Type.tp_flags = Py_TPFLAGS_DEFAULT;
@@ -2348,6 +2781,10 @@ void BPy_BM_init_types(void)
PyType_Ready(&BPy_BMFace_Type);
PyType_Ready(&BPy_BMLoop_Type);
PyType_Ready(&BPy_BMElemSeq_Type);
+ PyType_Ready(&BPy_BMVertSeq_Type);
+ PyType_Ready(&BPy_BMEdgeSeq_Type);
+ PyType_Ready(&BPy_BMFaceSeq_Type);
+ PyType_Ready(&BPy_BMLoopSeq_Type);
PyType_Ready(&BPy_BMIter_Type);
}
@@ -2375,15 +2812,30 @@ PyObject *BPyInit_bmesh_types(void)
#define mod_type_add(s, t) \
PyModule_AddObject(s, t.tp_name, (PyObject *)&t); Py_INCREF((PyObject *)&t)
+ /* bmesh_py_types.c */
mod_type_add(submodule, BPy_BMesh_Type);
mod_type_add(submodule, BPy_BMVert_Type);
mod_type_add(submodule, BPy_BMEdge_Type);
mod_type_add(submodule, BPy_BMFace_Type);
mod_type_add(submodule, BPy_BMLoop_Type);
mod_type_add(submodule, BPy_BMElemSeq_Type);
+ mod_type_add(submodule, BPy_BMVertSeq_Type);
+ mod_type_add(submodule, BPy_BMEdgeSeq_Type);
+ mod_type_add(submodule, BPy_BMFaceSeq_Type);
+ mod_type_add(submodule, BPy_BMLoopSeq_Type);
mod_type_add(submodule, BPy_BMIter_Type);
+ /* bmesh_py_types_select.c */
mod_type_add(submodule, BPy_BMEditSelSeq_Type);
mod_type_add(submodule, BPy_BMEditSelIter_Type);
+ /* bmesh_py_types_customdata.c */
+ mod_type_add(submodule, BPy_BMLayerAccessVert_Type);
+ mod_type_add(submodule, BPy_BMLayerAccessEdge_Type);
+ mod_type_add(submodule, BPy_BMLayerAccessFace_Type);
+ mod_type_add(submodule, BPy_BMLayerAccessLoop_Type);
+ mod_type_add(submodule, BPy_BMLayerCollection_Type);
+ mod_type_add(submodule, BPy_BMLayerItem_Type);
+ /* bmesh_py_types_meshdata.c */
+ mod_type_add(submodule, BPy_BMLoopUV_Type);
#undef mod_type_add
@@ -2393,7 +2845,7 @@ PyObject *BPyInit_bmesh_types(void)
/* Utility Functions
* ***************** */
-PyObject *BPy_BMesh_CreatePyObject(BMesh *bm)
+PyObject *BPy_BMesh_CreatePyObject(BMesh *bm, int flag)
{
BPy_BMesh *self;
@@ -2404,6 +2856,8 @@ PyObject *BPy_BMesh_CreatePyObject(BMesh *bm)
else {
self = PyObject_New(BPy_BMesh, &BPy_BMesh_Type);
self->bm = bm;
+ self->flag = flag;
+
bm->py_handle = self; /* point back */
BM_data_layer_add(bm, &bm->vdata, CD_BM_ELEM_PYPTR);
@@ -2531,6 +2985,42 @@ PyObject *BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, const char
return (PyObject *)self;
}
+PyObject *BPy_BMVertSeq_CreatePyObject(BMesh *bm)
+{
+ BPy_BMElemSeq *self = PyObject_New(BPy_BMElemSeq, &BPy_BMVertSeq_Type);
+ self->bm = bm;
+ self->py_ele = NULL; /* unused */
+ self->itype = BM_VERTS_OF_MESH;
+ return (PyObject *)self;
+}
+
+PyObject *BPy_BMEdgeSeq_CreatePyObject(BMesh *bm)
+{
+ BPy_BMElemSeq *self = PyObject_New(BPy_BMElemSeq, &BPy_BMEdgeSeq_Type);
+ self->bm = bm;
+ self->py_ele = NULL; /* unused */
+ self->itype = BM_EDGES_OF_MESH;
+ return (PyObject *)self;
+}
+
+PyObject *BPy_BMFaceSeq_CreatePyObject(BMesh *bm)
+{
+ BPy_BMElemSeq *self = PyObject_New(BPy_BMElemSeq, &BPy_BMFaceSeq_Type);
+ self->bm = bm;
+ self->py_ele = NULL; /* unused */
+ self->itype = BM_FACES_OF_MESH;
+ return (PyObject *)self;
+}
+
+PyObject *BPy_BMLoopSeq_CreatePyObject(BMesh *bm)
+{
+ BPy_BMElemSeq *self = PyObject_New(BPy_BMElemSeq, &BPy_BMLoopSeq_Type);
+ self->bm = bm;
+ self->py_ele = NULL; /* unused */
+ self->itype = 0; /* should never be passed to the iterator function */
+ return (PyObject *)self;
+}
+
PyObject *BPy_BMIter_CreatePyObject(BMesh *bm)
{
BPy_BMIter *self = PyObject_New(BPy_BMIter, &BPy_BMIter_Type);
@@ -2581,7 +3071,7 @@ void bpy_bm_generic_invalidate(BPy_BMGeneric *self)
* The 'bm_r' value is assigned when empty, and used when set.
*/
void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size,
- PyTypeObject *type,
+ const char htype,
const char do_unique_check, const char do_bm_check,
const char *error_prefix)
{
@@ -2615,16 +3105,16 @@ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_
for (i = 0; i < seq_len; i++) {
item = (BPy_BMElem *)PySequence_Fast_GET_ITEM(seq_fast, i);
- if (Py_TYPE(item) != type) {
+ if (!BPy_BMElem_CheckHType(Py_TYPE(item), htype)) {
PyErr_Format(PyExc_TypeError,
- "%s: expected '%.200s', not '%.200s'",
- error_prefix, type->tp_name, Py_TYPE(item)->tp_name);
+ "%s: expected %.200s, not '%.200s'",
+ error_prefix, BPy_BMElem_StringFromHType(htype), Py_TYPE(item)->tp_name);
goto err_cleanup;
}
else if (!BPY_BM_IS_VALID(item)) {
PyErr_Format(PyExc_TypeError,
"%s: %d %s has been removed",
- error_prefix, i, type->tp_name);
+ error_prefix, i, Py_TYPE(item)->tp_name);
goto err_cleanup;
}
/* trick so we can ensure all items have the same mesh,
@@ -2632,7 +3122,7 @@ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_
else if (do_bm_check && (bm && bm != item->bm)) {
PyErr_Format(PyExc_ValueError,
"%s: %d %s is from another mesh",
- error_prefix, i, type->tp_name);
+ error_prefix, i, BPy_BMElem_StringFromHType(htype));
goto err_cleanup;
}
@@ -2655,14 +3145,14 @@ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_
ok = FALSE;
}
- /* ensure we dont leave this enabled */
+ /* ensure we don't leave this enabled */
BM_elem_flag_disable(alloc[i], BM_ELEM_INTERNAL_TAG);
}
if (ok == FALSE) {
PyErr_Format(PyExc_ValueError,
- "%s: found the same %s used multiple times",
- error_prefix, type->tp_name);
+ "%s: found the same %.200s used multiple times",
+ error_prefix, BPy_BMElem_StringFromHType(htype));
goto err_cleanup;
}
}
@@ -2690,3 +3180,35 @@ PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_
return ret;
}
+
+int BPy_BMElem_CheckHType(PyTypeObject *type, const char htype)
+{
+ return (((htype & BM_VERT) && (type == &BPy_BMVert_Type)) ||
+ ((htype & BM_EDGE) && (type == &BPy_BMEdge_Type)) ||
+ ((htype & BM_FACE) && (type == &BPy_BMFace_Type)) ||
+ ((htype & BM_LOOP) && (type == &BPy_BMLoop_Type)));
+}
+
+/**
+ * Use for error strings only, not thread safe,
+ *
+ * \return a sting like '(BMVert/BMEdge/BMFace/BMLoop)'
+ */
+char *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32])
+{
+ /* zero to ensure string is always NULL terminated */
+ char *ret_ptr = ret;
+ if (htype & BM_VERT) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMVert_Type.tp_name);
+ if (htype & BM_EDGE) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMEdge_Type.tp_name);
+ if (htype & BM_FACE) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMFace_Type.tp_name);
+ if (htype & BM_LOOP) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMLoop_Type.tp_name);
+ ret[0] = '(';
+ *ret_ptr = ')';
+ return ret;
+}
+char *BPy_BMElem_StringFromHType(const char htype)
+{
+ /* zero to ensure string is always NULL terminated */
+ static char ret[32];
+ return BPy_BMElem_StringFromHType_ex(htype, ret);
+}
diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h
index 52a82c50dd1..0a94b346485 100644
--- a/source/blender/python/bmesh/bmesh_py_types.h
+++ b/source/blender/python/bmesh/bmesh_py_types.h
@@ -35,7 +35,13 @@ extern PyTypeObject BPy_BMVert_Type;
extern PyTypeObject BPy_BMEdge_Type;
extern PyTypeObject BPy_BMFace_Type;
extern PyTypeObject BPy_BMLoop_Type;
+
extern PyTypeObject BPy_BMElemSeq_Type;
+extern PyTypeObject BPy_BMVertSeq_Type;
+extern PyTypeObject BPy_BMEdgeSeq_Type;
+extern PyTypeObject BPy_BMFaceSeq_Type;
+extern PyTypeObject BPy_BMLoopSeq_Type;
+
extern PyTypeObject BPy_BMIter_Type;
#define BPy_BMesh_Check(v) (Py_TYPE(v) == &BPy_BMesh_Type)
@@ -44,6 +50,10 @@ extern PyTypeObject BPy_BMIter_Type;
#define BPy_BMFace_Check(v) (Py_TYPE(v) == &BPy_BMFace_Type)
#define BPy_BMLoop_Check(v) (Py_TYPE(v) == &BPy_BMLoop_Type)
#define BPy_BMElemSeq_Check(v) (Py_TYPE(v) == &BPy_BMElemSeq_Type)
+#define BPy_BMVertSeq_Check(v) (Py_TYPE(v) == &BPy_BMVertSeq_Type)
+#define BPy_BMEdgeSeq_Check(v) (Py_TYPE(v) == &BPy_BMEdgeSeq_Type)
+#define BPy_BMFaceSeq_Check(v) (Py_TYPE(v) == &BPy_BMFaceSeq_Type)
+#define BPy_BMLoopSeq_Check(v) (Py_TYPE(v) == &BPy_BMLoopSeq_Type)
#define BPy_BMIter_Check(v) (Py_TYPE(v) == &BPy_BMIter_Type)
/* cast from _any_ bmesh type - they all have BMesh first */
@@ -62,7 +72,7 @@ typedef struct BPy_BMElem {
typedef struct BPy_BMesh {
PyObject_VAR_HEAD
struct BMesh *bm; /* keep first */
- char py_owns;
+ int flag;
} BPy_BMesh;
/* element types */
@@ -93,6 +103,13 @@ typedef struct BPy_BMLoop {
/* iterators */
+/* used for ...
+ * - BPy_BMElemSeq_Type
+ * - BPy_BMVertSeq_Type
+ * - BPy_BMEdgeSeq_Type
+ * - BPy_BMFaceSeq_Type
+ * - BPy_BMLoopSeq_Type
+ */
typedef struct BPy_BMElemSeq {
PyObject_VAR_HEAD
struct BMesh *bm; /* keep first */
@@ -120,12 +137,21 @@ void BPy_BM_init_types(void);
PyObject *BPyInit_bmesh_types(void);
-PyObject *BPy_BMesh_CreatePyObject(BMesh *bm);
+enum {
+ BPY_BMFLAG_NOP = 0, /* do nothing */
+ BPY_BMFLAG_IS_WRAPPED = 1 /* the mesh is owned by editmode */
+};
+
+PyObject *BPy_BMesh_CreatePyObject(BMesh *bm, int flag);
PyObject *BPy_BMVert_CreatePyObject(BMesh *bm, BMVert *v);
PyObject *BPy_BMEdge_CreatePyObject(BMesh *bm, BMEdge *e);
PyObject *BPy_BMFace_CreatePyObject(BMesh *bm, BMFace *f);
PyObject *BPy_BMLoop_CreatePyObject(BMesh *bm, BMLoop *l);
PyObject *BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, const char itype);
+PyObject *BPy_BMVertSeq_CreatePyObject(BMesh *bm);
+PyObject *BPy_BMEdgeSeq_CreatePyObject(BMesh *bm);
+PyObject *BPy_BMFaceSeq_CreatePyObject(BMesh *bm);
+PyObject *BPy_BMLoopSeq_CreatePyObject(BMesh *bm);
PyObject *BPy_BMIter_CreatePyObject(BMesh *bm);
PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele); /* just checks type and creates v/e/f/l */
@@ -134,11 +160,14 @@ int bpy_bm_generic_valid_check(BPy_BMGeneric *self);
void bpy_bm_generic_invalidate(BPy_BMGeneric *self);
void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size,
- PyTypeObject *type,
+ const char htype,
const char do_unique_check, const char do_bm_check,
const char *error_prefix);
PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len);
+int BPy_BMElem_CheckHType(PyTypeObject *type, const char htype);
+char *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32]);
+char *BPy_BMElem_StringFromHType(const char htype);
#define BPY_BM_CHECK_OBJ(obj) if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { return NULL; } (void)0
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
new file mode 100644
index 00000000000..1f7f7290030
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -0,0 +1,952 @@
+/*
+ * ***** 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) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/bmesh/bmesh_py_types_customdata.c
+ * \ingroup pybmesh
+ *
+ * This file defines the types for 'BMesh.verts/edges/faces/loops.layers'
+ * customdata layer access.
+ */
+
+#include <Python.h>
+
+#include "BLI_string.h"
+#include "BLI_math_vector.h"
+
+#include "bmesh.h"
+
+#include "bmesh_py_types.h"
+#include "bmesh_py_types_customdata.h"
+#include "bmesh_py_types_meshdata.h"
+
+#include "../mathutils/mathutils.h"
+
+#include "BKE_customdata.h"
+
+#include "DNA_meshdata_types.h"
+
+static CustomData *bpy_bm_customdata_get(BMesh *bm, char htype)
+{
+ switch (htype) {
+ case BM_VERT: return &bm->vdata;
+ case BM_EDGE: return &bm->edata;
+ case BM_FACE: return &bm->pdata;
+ case BM_LOOP: return &bm->ldata;
+ }
+
+ BLI_assert(0);
+ return NULL;
+}
+
+static CustomDataLayer *bpy_bmlayeritem_get(BPy_BMLayerItem *self)
+{
+ CustomData *data = bpy_bm_customdata_get(self->bm, self->htype);
+ return &data->layers[CustomData_get_layer_index_n(data, self->type, self->index)];
+}
+
+/* py-type definitions
+ * ******************* */
+
+/* getseters
+ * ========= */
+
+/* used for many different types */
+
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__float_doc,
+"Generic float custom-data layer.\n\ntype: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__int_doc,
+"Generic int custom-data layer.\n\ntype: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__string_doc,
+"Generic string custom-data layer (exposed as bytes, 255 max length).\n\ntype: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__deform_doc,
+"Vertex deform weight :class:`BMDeformVert` (TODO).\n\ntype: :class:`BMLayerCollection`" // TYPE DOESN'T EXIST YET
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__shape_doc,
+"Vertex shapekey absolute location (as a 3D Vector).\n\n:type: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__bevel_weight_doc,
+"Bevel weight float in [0 - 1].\n\n:type: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__crease_doc,
+"Edge crease for subsurf - float in [0 - 1].\n\n:type: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__tex_doc,
+"Accessor for :class:`BMTexPoly` layer (TODO).\n\ntype: :class:`BMLayerCollection`" // TYPE DOESN'T EXIST YET
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__uv_doc,
+"Accessor for :class:`BMLoopUV` UV (as a 2D Vector).\n\ntype: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__color_doc,
+"Accessor for vertex color layer.\n\ntype: :class:`BMLayerCollection`"
+);
+
+static PyObject *bpy_bmlayeraccess_collection_get(BPy_BMLayerAccess *self, void *flag)
+{
+ const int type = (int)GET_INT_FROM_POINTER(flag);
+
+ BPY_BM_CHECK_OBJ(self);
+
+ return BPy_BMLayerCollection_CreatePyObject(self->bm, self->htype, type);
+}
+
+
+PyDoc_STRVAR(bpy_bmlayercollection_active_doc,
+"This meshes vert sequence (read-only).\n\n:type: :class:`BMVertSeq`"
+);
+static PyObject *bpy_bmlayercollection_active_get(BPy_BMLayerItem *self, void *UNUSED(flag))
+{
+ CustomData *data;
+ int index;
+
+ BPY_BM_CHECK_OBJ(self);
+
+ data = bpy_bm_customdata_get(self->bm, self->htype);
+ index = CustomData_get_active_layer_index(data, self->type);
+
+ if (index != -1) {
+ return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
+ }
+ else {
+ Py_RETURN_NONE;
+ }
+}
+
+PyDoc_STRVAR(bpy_bmlayercollection_name_doc,
+"The layers unique name (read-only).\n\n:type: string"
+);
+static PyObject *bpy_bmlayeritem_name_get(BPy_BMLayerItem *self, void *UNUSED(flag))
+{
+ CustomDataLayer *layer;
+
+ BPY_BM_CHECK_OBJ(self);
+
+ layer = bpy_bmlayeritem_get(self);
+ return PyUnicode_FromString(layer->name);
+}
+
+static PyGetSetDef bpy_bmlayeraccess_vert_getseters[] = {
+ {(char *)"deform", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__deform_doc, (void *)CD_MDEFORMVERT},
+
+ {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+ {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+ {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+
+ {(char *)"shape", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__shape_doc, (void *)CD_SHAPEKEY},
+ {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__bevel_weight_doc, (void *)CD_BWEIGHT},
+
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmlayeraccess_edge_getseters[] = {
+ {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+ {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+ {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+
+ {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__bevel_weight_doc, (void *)CD_BWEIGHT},
+ {(char *)"crease", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__crease_doc, (void *)CD_CREASE},
+
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmlayeraccess_face_getseters[] = {
+ {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+ {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+ {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+
+ {(char *)"tex", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__tex_doc, (void *)CD_MTEXPOLY},
+
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmlayeraccess_loop_getseters[] = {
+ {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+ {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+ {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+
+ {(char *)"uv", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__uv_doc, (void *)CD_MLOOPUV},
+ {(char *)"color", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__color_doc, (void *)CD_MLOOPCOL},
+
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+
+static PyGetSetDef bpy_bmlayercollection_getseters[] = {
+ /* BMESH_TODO, make writeable */
+ {(char *)"active", (getter)bpy_bmlayercollection_active_get, (setter)NULL, (char *)bpy_bmlayercollection_active_doc, NULL},
+
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmlayeritem_getseters[] = {
+ /* BMESH_TODO, make writeable */
+ {(char *)"name", (getter)bpy_bmlayeritem_name_get, (setter)NULL, (char *)bpy_bmlayercollection_name_doc, NULL},
+
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+
+/* Methods
+ * ======= */
+
+/* BMLayerCollection
+ * ----------------- */
+
+PyDoc_STRVAR(bpy_bmlayercollection_keys_doc,
+".. method:: keys()\n"
+"\n"
+" Return the identifiers of collection members\n"
+" (matching pythons dict.keys() functionality).\n"
+"\n"
+" :return: the identifiers for each member of this collection.\n"
+" :rtype: list of strings\n"
+);
+static PyObject *bpy_bmlayercollection_keys(BPy_BMLayerCollection *self)
+{
+ PyObject *ret;
+ PyObject *item;
+ 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);
+
+ ret = PyList_New(0);
+
+ if (index != -1) {
+ int tot = CustomData_number_of_layers(data, self->type);
+ for ( ; tot-- > 0; index++) {
+ item = PyUnicode_FromString(data->layers[index].name);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ }
+ }
+
+ return ret;
+}
+
+PyDoc_STRVAR(bpy_bmlayercollection_values_doc,
+".. method:: items()\n"
+"\n"
+" Return the identifiers of collection members\n"
+" (matching pythons dict.items() functionality).\n"
+"\n"
+" :return: (key, value) pairs for each member of this collection.\n"
+" :rtype: list of tuples\n"
+);
+static PyObject *bpy_bmlayercollection_values(BPy_BMLayerCollection *self)
+{
+ PyObject *ret;
+ PyObject *item;
+ 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);
+
+ ret = PyList_New(0);
+
+ if (index != -1) {
+ int tot = CustomData_number_of_layers(data, self->type);
+ for ( ; tot-- > 0; index++) {
+ item = PyTuple_New(2);
+ PyTuple_SET_ITEM(item, 0, PyUnicode_FromString(data->layers[index].name));
+ PyTuple_SET_ITEM(item, 1, BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index));
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ }
+ }
+
+ return ret;
+}
+
+PyDoc_STRVAR(bpy_bmlayercollection_items_doc,
+".. method:: values()\n"
+"\n"
+" Return the values of collection\n"
+" (matching pythons dict.values() functionality).\n"
+"\n"
+" :return: the members of this collection.\n"
+" :rtype: list\n"
+);
+static PyObject *bpy_bmlayercollection_items(BPy_BMLayerCollection *self)
+{
+ PyObject *ret;
+ PyObject *item;
+ 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);
+
+ ret = PyList_New(0);
+
+ if (index != -1) {
+ int tot = CustomData_number_of_layers(data, self->type);
+ for ( ; tot-- > 0; index++) {
+ item = BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ }
+ }
+
+ return ret;
+}
+
+PyDoc_STRVAR(bpy_bmlayercollection_get_doc,
+".. method:: get(key, default=None)\n"
+"\n"
+" Returns the value of the layer matching the key or default\n"
+" when not found (matches pythons dictionary function of the same name).\n"
+"\n"
+" :arg key: The key associated with the layer.\n"
+" :type key: string\n"
+" :arg default: Optional argument for the value to return if\n"
+" *key* is not found.\n"
+" :type default: Undefined\n"
+);
+static PyObject *bpy_bmlayercollection_get(BPy_BMLayerCollection *self, PyObject *args)
+{
+ const char *key;
+ PyObject *def = Py_None;
+
+ BPY_BM_CHECK_OBJ(self);
+
+ if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) {
+ return NULL;
+ }
+ else {
+ CustomData *data;
+ int index;
+
+ data = bpy_bm_customdata_get(self->bm, self->htype);
+ index = CustomData_get_named_layer_index(data, self->type, key);
+
+ if (index != -1) {
+ return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
+ }
+ }
+
+ return Py_INCREF(def), def;
+}
+
+static struct PyMethodDef bpy_bmelemseq_methods[] = {
+ {"keys", (PyCFunction)bpy_bmlayercollection_keys, METH_NOARGS, bpy_bmlayercollection_keys_doc},
+ {"values", (PyCFunction)bpy_bmlayercollection_values, METH_NOARGS, bpy_bmlayercollection_values_doc},
+ {"items", (PyCFunction)bpy_bmlayercollection_items, METH_NOARGS, bpy_bmlayercollection_items_doc},
+ {"get", (PyCFunction)bpy_bmlayercollection_get, METH_VARARGS, bpy_bmlayercollection_get_doc},
+
+ /* for later! */
+#if 0
+
+ {"new", (PyCFunction)bpy_bmlayercollection_new, METH_O, bpy_bmlayercollection_new_doc},
+ {"remove", (PyCFunction)bpy_bmlayercollection_new, METH_O, bpy_bmlayercollection_remove_doc},
+#endif
+ {NULL, NULL, 0, NULL}
+};
+
+
+
+/* Sequences
+ * ========= */
+
+static Py_ssize_t bpy_bmlayercollection_length(BPy_BMLayerCollection *self)
+{
+ CustomData *data;
+
+ BPY_BM_CHECK_INT(self);
+
+ data = bpy_bm_customdata_get(self->bm, self->htype);
+
+ return CustomData_number_of_layers(data, self->type);
+}
+
+static PyObject *bpy_bmlayercollection_subscript_str(BPy_BMLayerCollection *self, const char *keyname)
+{
+ CustomData *data;
+ int index;
+
+ BPY_BM_CHECK_OBJ(self);
+
+ data = bpy_bm_customdata_get(self->bm, self->htype);
+ index = CustomData_get_named_layer_index(data, self->type, keyname);
+
+ if (index != -1) {
+ return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
+ }
+ else {
+ PyErr_Format(PyExc_KeyError,
+ "BMLayerCollection[key]: key \"%.200s\" not found", keyname);
+ return NULL;
+ }
+}
+
+static PyObject *bpy_bmlayercollection_subscript_int(BPy_BMLayerCollection *self, int keynum)
+{
+ Py_ssize_t len;
+ BPY_BM_CHECK_OBJ(self);
+
+ len = bpy_bmlayercollection_length(self);
+
+ if (keynum < 0) keynum += len;
+ if (keynum >= 0) {
+ if (keynum < len) {
+ return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, keynum);
+ }
+ }
+
+ PyErr_Format(PyExc_IndexError,
+ "BMLayerCollection[index]: index %d out of range", keynum);
+ return NULL;
+}
+
+static PyObject *bpy_bmlayercollection_subscript_slice(BPy_BMLayerCollection *self, Py_ssize_t start, Py_ssize_t stop)
+{
+ Py_ssize_t len = bpy_bmlayercollection_length(self);
+ int count = 0;
+
+ PyObject *tuple;
+
+ BPY_BM_CHECK_OBJ(self);
+
+ if (start >= start) start = len - 1;
+ if (stop >= stop) stop = len - 1;
+
+ tuple = PyTuple_New(stop - start);
+
+ for (count = start; count < stop; count++) {
+ PyTuple_SET_ITEM(tuple, count - start, BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, count));
+ }
+
+ return tuple;
+}
+
+static PyObject *bpy_bmlayercollection_subscript(BPy_BMLayerCollection *self, PyObject *key)
+{
+ /* don't need error check here */
+ if (PyUnicode_Check(key)) {
+ return bpy_bmlayercollection_subscript_str(self, _PyUnicode_AsString(key));
+ }
+ else if (PyIndex_Check(key)) {
+ Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
+ if (i == -1 && PyErr_Occurred())
+ return NULL;
+ return bpy_bmlayercollection_subscript_int(self, i);
+ }
+ else if (PySlice_Check(key)) {
+ PySliceObject *key_slice = (PySliceObject *)key;
+ Py_ssize_t step = 1;
+
+ if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
+ return NULL;
+ }
+ else if (step != 1) {
+ PyErr_SetString(PyExc_TypeError,
+ "BMLayerCollection[slice]: slice steps not supported");
+ return NULL;
+ }
+ else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
+ return bpy_bmlayercollection_subscript_slice(self, 0, PY_SSIZE_T_MAX);
+ }
+ else {
+ Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
+
+ /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
+ if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
+ if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) return NULL;
+
+ if (start < 0 || stop < 0) {
+ /* only get the length for negative values */
+ Py_ssize_t len = bpy_bmlayercollection_length(self);
+ if (start < 0) start += len;
+ if (stop < 0) start += len;
+ }
+
+ if (stop - start <= 0) {
+ return PyTuple_New(0);
+ }
+ else {
+ return bpy_bmlayercollection_subscript_slice(self, start, stop);
+ }
+ }
+ }
+ else {
+ PyErr_SetString(PyExc_AttributeError,
+ "BMLayerCollection[key]: invalid key, key must be an int");
+ return NULL;
+ }
+}
+
+static int bpy_bmlayercollection_contains(BPy_BMLayerCollection *self, PyObject *value)
+{
+ const char *keyname = _PyUnicode_AsString(value);
+ CustomData *data;
+ int index;
+
+ BPY_BM_CHECK_INT(self);
+
+ if (keyname == NULL) {
+ PyErr_SetString(PyExc_TypeError,
+ "BMLayerCollection.__contains__: expected a string");
+ return -1;
+ }
+
+ data = bpy_bm_customdata_get(self->bm, self->htype);
+ index = CustomData_get_named_layer_index(data, self->type, keyname);
+
+ return (index != -1) ? 1 : 0;
+}
+
+static PySequenceMethods bpy_bmlayercollection_as_sequence = {
+ (lenfunc)bpy_bmlayercollection_length, /* sq_length */
+ NULL, /* sq_concat */
+ NULL, /* sq_repeat */
+ (ssizeargfunc)bpy_bmlayercollection_subscript_int, /* sq_item */ /* Only set this so PySequence_Check() returns True */
+ NULL, /* sq_slice */
+ (ssizeobjargproc)NULL, /* sq_ass_item */
+ NULL, /* *was* sq_ass_slice */
+ (objobjproc)bpy_bmlayercollection_contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
+};
+
+static PyMappingMethods bpy_bmlayercollection_as_mapping = {
+ (lenfunc)bpy_bmlayercollection_length, /* mp_length */
+ (binaryfunc)bpy_bmlayercollection_subscript, /* mp_subscript */
+ (objobjargproc)NULL, /* mp_ass_subscript */
+};
+
+/* Iterator
+ * -------- */
+
+static PyObject *bpy_bmlayercollection_iter(BPy_BMLayerCollection *self)
+{
+ /* fake it with a list iterator */
+ PyObject *ret;
+ PyObject *iter = NULL;
+
+ BPY_BM_CHECK_OBJ(self);
+
+ ret = bpy_bmlayercollection_subscript_slice(self, 0, PY_SSIZE_T_MIN);
+
+ if (ret) {
+ iter = PyObject_GetIter(ret);
+ Py_DECREF(ret);
+ }
+
+ return iter;
+}
+
+PyDoc_STRVAR(bpy_bmlayeraccess_type_doc,
+"Exposes custom-data layer attributes."
+);
+
+PyDoc_STRVAR(bpy_bmlayercollection_type_doc,
+"Gives access to a collection of custom-data layers of the same type and behaves like python dictionaries, "
+"except for the ability to do list like index access."
+);
+
+PyDoc_STRVAR(bpy_bmlayeritem_type_doc,
+"Exposes a single custom data layer, "
+"their main purpose is for use as item accessors to custom-data when used with vert/edge/face/loop data."
+);
+
+
+PyTypeObject BPy_BMLayerAccessVert_Type = {{{0}}}; /* bm.verts.layers */
+PyTypeObject BPy_BMLayerAccessEdge_Type = {{{0}}}; /* bm.edges.layers */
+PyTypeObject BPy_BMLayerAccessFace_Type = {{{0}}}; /* bm.faces.layers */
+PyTypeObject BPy_BMLayerAccessLoop_Type = {{{0}}}; /* bm.loops.layers */
+PyTypeObject BPy_BMLayerCollection_Type = {{{0}}}; /* bm.loops.layers.uv */
+PyTypeObject BPy_BMLayerItem_Type = {{{0}}}; /* bm.loops.layers.uv["UVMap"] */
+
+
+PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, const char htype)
+{
+ BPy_BMLayerAccess *self;
+ PyTypeObject *type;
+
+ switch (htype) {
+ case BM_VERT: type = &BPy_BMLayerAccessVert_Type; break;
+ case BM_EDGE: type = &BPy_BMLayerAccessEdge_Type; break;
+ case BM_FACE: type = &BPy_BMLayerAccessFace_Type; break;
+ case BM_LOOP: type = &BPy_BMLayerAccessLoop_Type; break;
+ default:
+ {
+ BLI_assert(0);
+ type = NULL;
+ break;
+ }
+ }
+
+ self = PyObject_New(BPy_BMLayerAccess, type);
+ self->bm = bm;
+ self->htype = htype;
+ return (PyObject *)self;
+}
+
+PyObject *BPy_BMLayerCollection_CreatePyObject(BMesh *bm, const char htype, int type)
+{
+ BPy_BMLayerCollection *self = PyObject_New(BPy_BMLayerCollection, &BPy_BMLayerCollection_Type);
+ self->bm = bm;
+ self->htype = htype;
+ self->type = type;
+ return (PyObject *)self;
+}
+
+PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, const char htype, int type, int index)
+{
+ BPy_BMLayerItem *self = PyObject_New(BPy_BMLayerItem, &BPy_BMLayerItem_Type);
+ self->bm = bm;
+ self->htype = htype;
+ self->type = type;
+ self->index = index;
+ return (PyObject *)self;
+}
+
+
+void BPy_BM_init_types_customdata(void)
+{
+ BPy_BMLayerAccessVert_Type.tp_basicsize = sizeof(BPy_BMLayerAccess);
+ BPy_BMLayerAccessEdge_Type.tp_basicsize = sizeof(BPy_BMLayerAccess);
+ BPy_BMLayerAccessFace_Type.tp_basicsize = sizeof(BPy_BMLayerAccess);
+ BPy_BMLayerAccessLoop_Type.tp_basicsize = sizeof(BPy_BMLayerAccess);
+ BPy_BMLayerCollection_Type.tp_basicsize = sizeof(BPy_BMLayerCollection);
+ BPy_BMLayerItem_Type.tp_basicsize = sizeof(BPy_BMLayerItem);
+
+ BPy_BMLayerAccessVert_Type.tp_name = "BMLayerAccessVert";
+ BPy_BMLayerAccessEdge_Type.tp_name = "BMLayerAccessEdge";
+ BPy_BMLayerAccessFace_Type.tp_name = "BMLayerAccessFace";
+ BPy_BMLayerAccessLoop_Type.tp_name = "BMLayerAccessLoop";
+ BPy_BMLayerCollection_Type.tp_name = "BMLayerCollection";
+ BPy_BMLayerItem_Type.tp_name = "BMLayerItem";
+
+ /* todo */
+ BPy_BMLayerAccessVert_Type.tp_doc = bpy_bmlayeraccess_type_doc;
+ BPy_BMLayerAccessEdge_Type.tp_doc = bpy_bmlayeraccess_type_doc;
+ BPy_BMLayerAccessFace_Type.tp_doc = bpy_bmlayeraccess_type_doc;
+ BPy_BMLayerAccessLoop_Type.tp_doc = bpy_bmlayeraccess_type_doc;
+ BPy_BMLayerCollection_Type.tp_doc = bpy_bmlayercollection_type_doc;
+ BPy_BMLayerItem_Type.tp_doc = bpy_bmlayeritem_type_doc;
+
+ BPy_BMLayerAccessVert_Type.tp_repr = (reprfunc)NULL;
+ BPy_BMLayerAccessEdge_Type.tp_repr = (reprfunc)NULL;
+ BPy_BMLayerAccessFace_Type.tp_repr = (reprfunc)NULL;
+ BPy_BMLayerAccessLoop_Type.tp_repr = (reprfunc)NULL;
+ BPy_BMLayerCollection_Type.tp_repr = (reprfunc)NULL;
+ BPy_BMLayerItem_Type.tp_repr = (reprfunc)NULL;
+
+ BPy_BMLayerAccessVert_Type.tp_getset = bpy_bmlayeraccess_vert_getseters;
+ BPy_BMLayerAccessEdge_Type.tp_getset = bpy_bmlayeraccess_edge_getseters;
+ BPy_BMLayerAccessFace_Type.tp_getset = bpy_bmlayeraccess_face_getseters;
+ BPy_BMLayerAccessLoop_Type.tp_getset = bpy_bmlayeraccess_loop_getseters;
+ BPy_BMLayerCollection_Type.tp_getset = bpy_bmlayercollection_getseters;
+ BPy_BMLayerItem_Type.tp_getset = bpy_bmlayeritem_getseters;
+
+
+// BPy_BMLayerAccess_Type.tp_methods = bpy_bmeditselseq_methods;
+ BPy_BMLayerCollection_Type.tp_methods = bpy_bmelemseq_methods;
+
+ BPy_BMLayerCollection_Type.tp_as_sequence = &bpy_bmlayercollection_as_sequence;
+
+ BPy_BMLayerCollection_Type.tp_as_mapping = &bpy_bmlayercollection_as_mapping;
+
+ BPy_BMLayerCollection_Type.tp_iter = (getiterfunc)bpy_bmlayercollection_iter;
+
+ BPy_BMLayerAccessVert_Type.tp_dealloc = NULL;
+ BPy_BMLayerAccessEdge_Type.tp_dealloc = NULL;
+ BPy_BMLayerAccessFace_Type.tp_dealloc = NULL;
+ BPy_BMLayerAccessLoop_Type.tp_dealloc = NULL;
+ BPy_BMLayerCollection_Type.tp_dealloc = NULL;
+ BPy_BMLayerItem_Type.tp_dealloc = NULL;
+
+
+
+ BPy_BMLayerAccessVert_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+ BPy_BMLayerAccessEdge_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+ BPy_BMLayerAccessFace_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+ BPy_BMLayerAccessLoop_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+ BPy_BMLayerCollection_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+ BPy_BMLayerItem_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+
+ PyType_Ready(&BPy_BMLayerAccessVert_Type);
+ PyType_Ready(&BPy_BMLayerAccessEdge_Type);
+ PyType_Ready(&BPy_BMLayerAccessFace_Type);
+ PyType_Ready(&BPy_BMLayerAccessLoop_Type);
+ PyType_Ready(&BPy_BMLayerCollection_Type);
+ PyType_Ready(&BPy_BMLayerItem_Type);
+}
+
+
+/* Per Element Get/Set
+ * ******************* */
+
+/**
+ * helper function for get/set, NULL return means the error is set
+*/
+static void *bpy_bmlayeritem_ptr_get(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
+{
+ void *value;
+ BMElem *ele = py_ele->ele;
+ CustomData *data;
+
+ /* error checking */
+ if (UNLIKELY(!BPy_BMLayerItem_Check(py_layer))) {
+ PyErr_SetString(PyExc_AttributeError,
+ "BMElem[key]: invalid key, must be a BMLayerItem");
+ return NULL;
+ }
+ else if (UNLIKELY(py_ele->bm != py_layer->bm)) {
+ PyErr_SetString(PyExc_ValueError,
+ "BMElem[layer]: layer is from another mesh");
+ return NULL;
+ }
+ else if (UNLIKELY(ele->head.htype != py_layer->htype)) {
+ char namestr_1[32], namestr_2[32];
+ PyErr_Format(PyExc_ValueError,
+ "Layer/Element type mismatch, expected %.200s got layer type %.200s",
+ BPy_BMElem_StringFromHType_ex(ele->head.htype, namestr_1),
+ BPy_BMElem_StringFromHType_ex(py_layer->htype, namestr_2));
+ return NULL;
+ }
+
+ data = bpy_bm_customdata_get(py_layer->bm, py_layer->htype);
+
+ value = CustomData_bmesh_get_n(data, ele->head.data, py_layer->type, py_layer->index);
+
+ if (UNLIKELY(value == NULL)) {
+ /* this should be fairly unlikely but possible if layers move about after we get them */
+ PyErr_SetString(PyExc_KeyError,
+ "BMElem[key]: layer not found");
+ return NULL;
+ }
+ else {
+ return value;
+ }
+}
+
+
+/**
+ *\brief BMElem.__getitem__()
+ *
+ * assume all error checks are done, eg:
+ *
+ * uv = vert[uv_layer]
+ */
+PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
+{
+ void *value = bpy_bmlayeritem_ptr_get(py_ele, py_layer);
+ PyObject *ret;
+
+ if (UNLIKELY(value == NULL)) {
+ return NULL;
+ }
+
+ switch (py_layer->type) {
+ case CD_MDEFORMVERT:
+ {
+ ret = Py_NotImplemented; /* TODO */
+ Py_INCREF(ret);
+ break;
+ }
+ case CD_PROP_FLT:
+ {
+ ret = PyFloat_FromDouble(*(float *)value);
+ break;
+ }
+ case CD_PROP_INT:
+ {
+ ret = PyLong_FromSsize_t((Py_ssize_t)(*(int *)value));
+ break;
+ }
+ case CD_PROP_STR:
+ {
+ MStringProperty *mstring = value;
+ ret = PyBytes_FromStringAndSize(mstring->s, BLI_strnlen(mstring->s, sizeof(mstring->s)));
+ break;
+ }
+ case CD_MTEXPOLY:
+ {
+ ret = Py_NotImplemented; /* TODO */
+ Py_INCREF(ret);
+ break;
+ }
+ case CD_MLOOPUV:
+ {
+ ret = BPy_BMLoopUV_CreatePyObject(value);
+ break;
+ }
+ case CD_MLOOPCOL:
+ {
+ ret = BPy_BMLoopColor_CreatePyObject(value);
+ break;
+ }
+ case CD_SHAPEKEY:
+ {
+ ret = Vector_CreatePyObject((float *)value, 3, Py_WRAP, NULL);
+ break;
+ }
+ case CD_BWEIGHT:
+ {
+ ret = PyFloat_FromDouble(*(float *)value);
+ break;
+ }
+ case CD_CREASE:
+ {
+ ret = PyFloat_FromDouble(*(float *)value);
+ break;
+ }
+ default:
+ {
+ ret = Py_NotImplemented; /* TODO */
+ Py_INCREF(ret);
+ break;
+ }
+ }
+
+ return ret;
+}
+
+int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObject *py_value)
+{
+ int ret = 0;
+ void *value = bpy_bmlayeritem_ptr_get(py_ele, py_layer);
+
+ if (UNLIKELY(value == NULL)) {
+ return -1;
+ }
+
+ switch (py_layer->type) {
+ case CD_MDEFORMVERT:
+ {
+ PyErr_SetString(PyExc_AttributeError, "readonly"); /* could make this writeable later */
+ ret = -1;
+ break;
+ }
+ case CD_PROP_FLT:
+ {
+ float tmp_val = PyFloat_AsDouble(py_value);
+ if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
+ PyErr_Format(PyExc_TypeError, "expected a float, not a %.200s", Py_TYPE(py_value)->tp_name);
+ ret = -1;
+ }
+ else {
+ *(float *)value = tmp_val;
+ }
+ break;
+ }
+ case CD_PROP_INT:
+ {
+ int tmp_val = PyLong_AsSsize_t(py_value);
+ if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
+ PyErr_Format(PyExc_TypeError, "expected an int, not a %.200s", Py_TYPE(py_value)->tp_name);
+ ret = -1;
+ }
+ else {
+ *(int *)value = tmp_val;
+ }
+ break;
+ }
+ case CD_PROP_STR:
+ {
+ MStringProperty *mstring = value;
+ const char *tmp_val = PyBytes_AsString(py_value);
+ if (UNLIKELY(tmp_val == NULL)) {
+ PyErr_Format(PyExc_TypeError, "expected bytes, not a %.200s", Py_TYPE(py_value)->tp_name);
+ ret = -1;
+ }
+ else {
+ BLI_strncpy(mstring->s, tmp_val, sizeof(mstring->s));
+ }
+ break;
+ }
+ case CD_MTEXPOLY:
+ {
+ PyErr_SetString(PyExc_AttributeError, "readonly"); /* could make this writeable later */
+ ret = -1;
+ break;
+ }
+ case CD_MLOOPUV:
+ {
+ ret = BPy_BMLoopUV_AssignPyObject(value, py_value);
+ break;
+ }
+ case CD_MLOOPCOL:
+ {
+ ret = BPy_BMLoopColor_AssignPyObject(value, py_value);
+ break;
+ }
+ case CD_SHAPEKEY:
+ {
+ float tmp_val[3];
+ if (UNLIKELY(mathutils_array_parse(tmp_val, 3, 3, py_value, "BMVert[shape] = value") == -1)) {
+ ret = -1;
+ }
+ else {
+ copy_v3_v3((float *)value, tmp_val);
+ }
+ break;
+ }
+ case CD_BWEIGHT:
+ {
+ float tmp_val = PyFloat_AsDouble(py_value);
+ if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
+ PyErr_Format(PyExc_TypeError, "expected a float, not a %.200s", Py_TYPE(py_value)->tp_name);
+ ret = -1;
+ }
+ else {
+ *(float *)value = CLAMPIS(tmp_val, 0.0f, 1.0f);
+ }
+ break;
+ }
+ case CD_CREASE:
+ {
+ float tmp_val = PyFloat_AsDouble(py_value);
+ if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
+ PyErr_Format(PyExc_TypeError, "expected a float, not a %.200s", Py_TYPE(py_value)->tp_name);
+ ret = -1;
+ }
+ else {
+ *(float *)value = CLAMPIS(tmp_val, 0.0f, 1.0f);
+ }
+ break;
+ }
+ default:
+ {
+ PyErr_SetString(PyExc_AttributeError, "readonly / unsupported type");
+ ret = -1;
+ break;
+ }
+ }
+
+ return ret;
+}
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.h b/source/blender/python/bmesh/bmesh_py_types_customdata.h
new file mode 100644
index 00000000000..b16b2806235
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.h
@@ -0,0 +1,81 @@
+/*
+ * ***** 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) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/bmesh/bmesh_py_types_customdata.h
+ * \ingroup pybmesh
+ */
+
+#ifndef __BMESH_PY_TYPES_CUSTOMDATA_H__
+#define __BMESH_PY_TYPES_CUSTOMDATA_H__
+
+/* all use BPy_BMLayerAccess struct */
+extern PyTypeObject BPy_BMLayerAccessVert_Type;
+extern PyTypeObject BPy_BMLayerAccessEdge_Type;
+extern PyTypeObject BPy_BMLayerAccessFace_Type;
+extern PyTypeObject BPy_BMLayerAccessLoop_Type;
+
+extern PyTypeObject BPy_BMLayerCollection_Type;
+extern PyTypeObject BPy_BMLayerItem_Type;
+
+#define BPy_BMLayerAccess_Check(v) (Py_TYPE(v) == &BPy_BMLayerAccess_Type)
+#define BPy_BMLayerCollection_Check(v) (Py_TYPE(v) == &BPy_BMLayerCollection_Type)
+#define BPy_BMLayerItem_Check(v) (Py_TYPE(v) == &BPy_BMLayerItem_Type)
+
+/* all layers for vert/edge/face/loop */
+typedef struct BPy_BMLayerAccess {
+ PyObject_VAR_HEAD
+ struct BMesh *bm; /* keep first */
+ char htype;
+} BPy_BMLayerAccess;
+
+/* access different layer types deform/uv/vertexcolor */
+typedef struct BPy_BMLayerCollection {
+ PyObject_VAR_HEAD
+ struct BMesh *bm; /* keep first */
+ char htype;
+ int type; /* customdata type - CD_XXX */
+} BPy_BMLayerCollection;
+
+/* access a specific layer directly */
+typedef struct BPy_BMLayerItem {
+ PyObject_VAR_HEAD
+ struct BMesh *bm; /* keep first */
+ char htype;
+ int type; /* customdata type - CD_XXX */
+ int index; /* index of this layer type */
+} BPy_BMLayerItem;
+
+PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, const char htype);
+PyObject *BPy_BMLayerCollection_CreatePyObject(BMesh *bm, const char htype, int type);
+PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, const char htype, int type, int index);
+
+void BPy_BM_init_types_customdata(void);
+
+/* __getitem__ / __setitem__ */
+PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer);
+int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObject *value);
+
+
+#endif /* __BMESH_PY_TYPES_CUSTOMDATA_H__ */
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
new file mode 100644
index 00000000000..56b3d764156
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -0,0 +1,260 @@
+/*
+ * ***** 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) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/bmesh/bmesh_py_types_meshdata.c
+ * \ingroup pybmesh
+ *
+ * This file defines customdata types which can't be accessed as primitive
+ * python types such as MDeformVert, MLoopUV, MTexPoly
+ */
+
+#include <Python.h>
+
+#include "../mathutils/mathutils.h"
+
+#include "DNA_meshdata_types.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_math_vector.h"
+
+/* Mesh Loop UV
+ * ************ */
+
+#define BPy_BMLoopUV_Check(v) (Py_TYPE(v) == &BPy_BMLoopUV_Type)
+
+typedef struct BPy_BMLoopUV {
+ PyObject_VAR_HEAD
+ MLoopUV *data;
+} BPy_BMLoopUV;
+
+PyDoc_STRVAR(bpy_bmloopuv_uv_doc,
+"Loops UV (as a 2D Vector).\n\n:type: :class:`mathutils.Vector`"
+);
+static PyObject *bpy_bmloopuv_uv_get(BPy_BMLoopUV *self, void *UNUSED(closure))
+{
+ return Vector_CreatePyObject(self->data->uv, 2, Py_WRAP, NULL);
+}
+
+static int bpy_bmloopuv_uv_set(BPy_BMLoopUV *self, PyObject *value, void *UNUSED(closure))
+{
+ float tvec[2];
+ if (mathutils_array_parse(tvec, 2, 2, value, "BMLoopUV.uv") != -1) {
+ copy_v2_v2(self->data->uv, tvec);
+ return 0;
+ }
+ else {
+ return -1;
+ }
+}
+
+PyDoc_STRVAR(bpy_bmloopuv_flag__pin_uv_doc,
+"UV pin state.\n\n:type: boolean"
+);
+PyDoc_STRVAR(bpy_bmloopuv_flag__select_doc,
+"UV select state.\n\n:type: boolean"
+);
+PyDoc_STRVAR(bpy_bmloopuv_flag__select_edge_doc,
+"UV edge select state.\n\n:type: boolean"
+);
+
+
+static PyObject *bpy_bmloopuv_flag_get(BPy_BMLoopUV *self, void *flag_p)
+{
+ const int flag = GET_INT_FROM_POINTER(flag_p);
+ return PyBool_FromLong(self->data->flag & flag);
+}
+
+static int bpy_bmloopuv_flag_set(BPy_BMLoopUV *self, PyObject *value, void *flag_p)
+{
+ const int flag = GET_INT_FROM_POINTER(flag_p);
+
+ switch (PyLong_AsLong(value)) {
+ case TRUE:
+ self->data->flag |= flag;
+ return 0;
+ case FALSE:
+ self->data->flag &= ~flag;
+ return 0;
+ default:
+ PyErr_SetString(PyExc_TypeError,
+ "expected a boolean type 0/1");
+ return -1;
+ }
+}
+
+static PyGetSetDef bpy_bmloopuv_getseters[] = {
+ /* attributes match rna_def_mloopuv */
+ {(char *)"uv", (getter)bpy_bmloopuv_uv_get, (setter)bpy_bmloopuv_uv_set, (char *)bpy_bmloopuv_uv_doc, NULL},
+ {(char *)"pin_uv", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__pin_uv_doc, (void *)MLOOPUV_PINNED},
+ {(char *)"select", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__select_doc, (void *)MLOOPUV_VERTSEL},
+ {(char *)"select_edge", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__select_edge_doc, (void *)MLOOPUV_EDGESEL},
+
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+PyTypeObject BPy_BMLoopUV_Type = {{{0}}}; /* bm.loops.layers.uv.active */
+
+static void bm_init_types_bmloopuv(void)
+{
+ BPy_BMLoopUV_Type.tp_basicsize = sizeof(BPy_BMLoopUV);
+
+ BPy_BMLoopUV_Type.tp_name = "BMLoopUV";
+
+ BPy_BMLoopUV_Type.tp_doc = NULL; // todo
+
+ BPy_BMLoopUV_Type.tp_getset = bpy_bmloopuv_getseters;
+
+ BPy_BMLoopUV_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+
+ PyType_Ready(&BPy_BMLoopUV_Type);
+}
+
+int BPy_BMLoopUV_AssignPyObject(struct MLoopUV *mloopuv, PyObject *value)
+{
+ if (UNLIKELY(!BPy_BMLoopUV_Check(value))) {
+ PyErr_Format(PyExc_TypeError, "expected BMLoopUV, not a %.200s", Py_TYPE(value)->tp_name);
+ return -1;
+ }
+ else {
+ *((MLoopUV *)mloopuv) = *((MLoopUV *)((BPy_BMLoopUV *)value)->data);
+ return 0;
+ }
+}
+
+PyObject *BPy_BMLoopUV_CreatePyObject(struct MLoopUV *mloopuv)
+{
+ BPy_BMLoopUV *self = PyObject_New(BPy_BMLoopUV, &BPy_BMLoopUV_Type);
+ self->data = mloopuv;
+ return (PyObject *)self;
+}
+
+/* --- End Mesh Loop UV --- */
+
+/* Mesh Loop Color
+ * *************** */
+
+/* This simply provices a color wrapper for
+ * color which uses mathutils callbacks for mathutils.Color
+ */
+
+#define MLOOPCOL_FROM_CAPSULE(color_capsule) \
+ ((MLoopCol *)PyCapsule_GetPointer(color_capsule, NULL))
+
+static void mloopcol_to_float(const MLoopCol *mloopcol, float col_r[3])
+{
+ rgb_uchar_to_float(col_r, (unsigned char *)&mloopcol->r);
+}
+
+static void mloopcol_from_float(MLoopCol *mloopcol, const float col[3])
+{
+ rgb_float_to_uchar((unsigned char *)&mloopcol->r, col);
+}
+
+static unsigned char mathutils_bmloopcol_cb_index = -1;
+
+static int mathutils_bmloopcol_check(BaseMathObject *UNUSED(bmo))
+{
+ /* always ok */
+ return 0;
+}
+
+static int mathutils_bmloopcol_get(BaseMathObject *bmo, int UNUSED(subtype))
+{
+ MLoopCol *mloopcol = MLOOPCOL_FROM_CAPSULE(bmo->cb_user);
+ mloopcol_to_float(mloopcol, bmo->data);
+ return 0;
+}
+
+static int mathutils_bmloopcol_set(BaseMathObject *bmo, int UNUSED(subtype))
+{
+ MLoopCol *mloopcol = MLOOPCOL_FROM_CAPSULE(bmo->cb_user);
+ mloopcol_from_float(mloopcol, bmo->data);
+ return 0;
+}
+
+static int mathutils_bmloopcol_get_index(BaseMathObject *bmo, int subtype, int UNUSED(index))
+{
+ /* lazy, avoid repeteing the case statement */
+ if (mathutils_bmloopcol_get(bmo, subtype) == -1)
+ return -1;
+ return 0;
+}
+
+static int mathutils_bmloopcol_set_index(BaseMathObject *bmo, int subtype, int index)
+{
+ const float f = bmo->data[index];
+
+ /* lazy, avoid repeteing the case statement */
+ if (mathutils_bmloopcol_get(bmo, subtype) == -1)
+ return -1;
+
+ bmo->data[index] = f;
+ return mathutils_bmloopcol_set(bmo, subtype);
+}
+
+Mathutils_Callback mathutils_bmloopcol_cb = {
+ mathutils_bmloopcol_check,
+ mathutils_bmloopcol_get,
+ mathutils_bmloopcol_set,
+ mathutils_bmloopcol_get_index,
+ mathutils_bmloopcol_set_index
+};
+
+static void bm_init_types_bmloopcol(void)
+{
+ /* pass */
+ mathutils_bmloopcol_cb_index = Mathutils_RegisterCallback(&mathutils_bmloopcol_cb);
+}
+
+int BPy_BMLoopColor_AssignPyObject(struct MLoopCol *mloopcol, PyObject *value)
+{
+ float tvec[3];
+ if (mathutils_array_parse(tvec, 3, 3, value, "BMLoopCol") != -1) {
+ mloopcol_from_float(mloopcol, tvec);
+ return 0;
+ }
+ else {
+ return -1;
+ }
+}
+
+PyObject *BPy_BMLoopColor_CreatePyObject(struct MLoopCol *data)
+{
+ PyObject *color_capsule;
+ color_capsule = PyCapsule_New(data, NULL, NULL);
+ return Color_CreatePyObject_cb(color_capsule, mathutils_bmloopcol_cb_index, 0);
+}
+
+#undef MLOOPCOL_FROM_CAPSULE
+
+/* --- End Mesh Loop Color --- */
+
+
+/* call to init all types */
+void BPy_BM_init_types_meshdata(void)
+{
+ bm_init_types_bmloopuv();
+ bm_init_types_bmloopcol();
+}
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.h b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
new file mode 100644
index 00000000000..75a4778571c
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
@@ -0,0 +1,52 @@
+/*
+ * ***** 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) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/bmesh/bmesh_py_types_meshdata.h
+ * \ingroup pybmesh
+ */
+
+#ifndef __BMESH_PY_TYPES_MESHDATA_H__
+#define __BMESH_PY_TYPES_MESHDATA_H__
+
+extern PyTypeObject BPy_BMLoopUV_Type;
+
+#define BPy_BMLoopUV_Check(v) (Py_TYPE(v) == &BPy_BMLoopUV_Type)
+
+typedef struct BPy_BMGenericMeshData {
+ PyObject_VAR_HEAD
+ void *data;
+} BPy_BMGenericMeshData;
+
+struct MLoopUV;
+
+int BPy_BMLoopUV_AssignPyObject(struct MLoopUV *data, PyObject *value);
+PyObject *BPy_BMLoopUV_CreatePyObject(struct MLoopUV *data);
+
+int BPy_BMLoopColor_AssignPyObject(struct MLoopUV *data, PyObject *value);
+PyObject *BPy_BMLoopColor_CreatePyObject(struct MLoopUV *data);
+
+void BPy_BM_init_types_meshdata(void);
+
+#endif /* __BMESH_PY_TYPES_MESHDATA_H__ */
diff --git a/source/blender/python/bmesh/bmesh_py_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c
index c5c66c0aaaa..4f3501944b0 100644
--- a/source/blender/python/bmesh/bmesh_py_select.c
+++ b/source/blender/python/bmesh/bmesh_py_types_select.c
@@ -23,22 +23,25 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/bmesh/bmesh_py_select.c
+/** \file blender/python/bmesh/bmesh_py_types_select.c
* \ingroup pybmesh
*
* This file defines the types for 'BMesh.select_history'
* sequence and iterator.
+ *
+ * select_history is very loosely based on pytons set() type,
+ * since items can only exist once. however they do have an order.
*/
#include <Python.h>
+#include "BLI_utildefines.h"
+#include "BLI_listbase.h"
+
#include "bmesh.h"
#include "bmesh_py_types.h"
-#include "bmesh_py_select.h"
-
-#include "BLI_utildefines.h"
-#include "BLI_listbase.h"
+#include "bmesh_py_types_select.h"
#include "BKE_tessmesh.h"
@@ -69,8 +72,98 @@ static PyGetSetDef bpy_bmeditselseq_getseters[] = {
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
+PyDoc_STRVAR(bpy_bmeditselseq_validate_doc,
+".. method:: validate()\n"
+"\n"
+" Ensures all elements in the selection history are selected.\n"
+);
+static PyObject *bpy_bmeditselseq_validate(BPy_BMEditSelSeq *self)
+{
+ BPY_BM_CHECK_OBJ(self);
+ BM_select_history_validate(self->bm);
+ Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(bpy_bmeditselseq_clear_doc,
+".. method:: clear()\n"
+"\n"
+" Empties the selection history.\n"
+);
+static PyObject *bpy_bmeditselseq_clear(BPy_BMEditSelSeq *self)
+{
+ BPY_BM_CHECK_OBJ(self);
+ BM_select_history_clear(self->bm);
+ Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(bpy_bmeditselseq_add_doc,
+".. method:: add(element)\n"
+"\n"
+" Add an element to the selection history (no action taken if its already added).\n"
+);
+static PyObject *bpy_bmeditselseq_add(BPy_BMEditSelSeq *self, BPy_BMElem *value)
+{
+ BPY_BM_CHECK_OBJ(self);
+
+ if ((BPy_BMVert_Check(value) ||
+ BPy_BMEdge_Check(value) ||
+ BPy_BMFace_Check(value)) == FALSE)
+ {
+ PyErr_Format(PyExc_TypeError,
+ "Expected a BMVert/BMedge/BMFace not a %.200s", Py_TYPE(value)->tp_name);
+ return NULL;
+ }
+
+ BPY_BM_CHECK_OBJ(value);
+
+ if (self->bm != value->bm) {
+ PyErr_SetString(PyExc_ValueError,
+ "Element is not from this mesh");
+ return NULL;
+ }
+
+ BM_select_history_store(self->bm, value->ele);
+
+ Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(bpy_bmeditselseq_remove_doc,
+".. method:: remove(element)\n"
+"\n"
+" Remove an element from the selection history.\n"
+);
+static PyObject *bpy_bmeditselseq_remove(BPy_BMEditSelSeq *self, BPy_BMElem *value)
+{
+ BPY_BM_CHECK_OBJ(self);
+
+ if ((BPy_BMVert_Check(value) ||
+ BPy_BMEdge_Check(value) ||
+ BPy_BMFace_Check(value)) == FALSE)
+ {
+ PyErr_Format(PyExc_TypeError,
+ "Expected a BMVert/BMedge/BMFace not a %.200s", Py_TYPE(value)->tp_name);
+ return NULL;
+ }
+
+ BPY_BM_CHECK_OBJ(value);
+
+ if ((self->bm != value->bm) ||
+ (BM_select_history_remove(self->bm, value->ele) == FALSE))
+ {
+ PyErr_SetString(PyExc_ValueError,
+ "Element not found in selection history");
+ return NULL;
+ }
+
+ Py_RETURN_NONE;
+}
+
static struct PyMethodDef bpy_bmeditselseq_methods[] = {
- // {"select_flush_mode", (PyCFunction)bpy_bmesh_select_flush_mode, METH_NOARGS, bpy_bmesh_select_flush_mode_doc},
+ {"validate", (PyCFunction)bpy_bmeditselseq_validate, METH_NOARGS, bpy_bmeditselseq_validate_doc},
+ {"clear", (PyCFunction)bpy_bmeditselseq_clear, METH_NOARGS, bpy_bmeditselseq_clear_doc},
+
+ {"add", (PyCFunction)bpy_bmeditselseq_add, METH_O, bpy_bmeditselseq_add_doc},
+ {"remove", (PyCFunction)bpy_bmeditselseq_remove, METH_O, bpy_bmeditselseq_remove_doc},
{NULL, NULL, 0, NULL}
};
@@ -103,7 +196,7 @@ static PyObject *bpy_bmeditselseq_subscript_int(BPy_BMEditSelSeq *self, int keyn
}
else {
PyErr_Format(PyExc_IndexError,
- "BMElemSeq[index]: index %d out of range", keynum);
+ "BMElemSeq[index]: index %d out of range", keynum);
return NULL;
}
}
@@ -154,7 +247,7 @@ static PyObject *bpy_bmeditselseq_subscript_slice(BPy_BMEditSelSeq *self, Py_ssi
static PyObject *bpy_bmeditselseq_subscript(BPy_BMEditSelSeq *self, PyObject *key)
{
- /* dont need error check here */
+ /* don't need error check here */
if (PyIndex_Check(key)) {
Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
@@ -213,15 +306,7 @@ static int bpy_bmeditselseq_contains(BPy_BMEditSelSeq *self, PyObject *value)
value_bm_ele = (BPy_BMElem *)value;
if (value_bm_ele->bm == self->bm) {
- BMEditSelection *ese_test;
- BMElem *ele;
-
- ele = value_bm_ele->ele;
- for (ese_test = self->bm->selected.first; ese_test; ese_test = ese_test->next) {
- if (ele == ese_test->ele) {
- return 1;
- }
- }
+ return BM_select_history_check(self->bm, value_bm_ele->ele);
}
return 0;
@@ -274,7 +359,7 @@ static PyObject *bpy_bmeditseliter_next(BPy_BMEditSelIter *self)
}
}
-PyTypeObject BPy_BMEditSelSeq_Type = {{{0}}};
+PyTypeObject BPy_BMEditSelSeq_Type = {{{0}}};
PyTypeObject BPy_BMEditSelIter_Type = {{{0}}};
@@ -294,7 +379,7 @@ PyObject *BPy_BMEditSelIter_CreatePyObject(BMesh *bm)
return (PyObject *)self;
}
-void BPy_BM_init_select_types(void)
+void BPy_BM_init_types_select(void)
{
BPy_BMEditSelSeq_Type.tp_basicsize = sizeof(BPy_BMEditSelSeq);
BPy_BMEditSelIter_Type.tp_basicsize = sizeof(BPy_BMEditSelIter);
@@ -332,3 +417,38 @@ void BPy_BM_init_select_types(void)
PyType_Ready(&BPy_BMEditSelSeq_Type);
PyType_Ready(&BPy_BMEditSelIter_Type);
}
+
+
+/* utility function */
+
+/**
+ * \note doesnt actually check selection.
+ */
+int BPy_BMEditSel_Assign(BPy_BMesh *self, PyObject *value)
+{
+ BMesh *bm;
+ Py_ssize_t value_len;
+ Py_ssize_t i;
+ BMElem **value_array = NULL;
+
+ BPY_BM_CHECK_INT(self);
+
+ bm = self->bm;
+
+ value_array = BPy_BMElem_PySeq_As_Array(&bm, value, 0, PY_SSIZE_T_MAX,
+ &value_len, BM_VERT | BM_EDGE | BM_FACE,
+ TRUE, TRUE, "BMesh.select_history = value");
+
+ if (value_array == NULL) {
+ return -1;
+ }
+
+ BM_select_history_clear(bm);
+
+ for (i = 0; i < value_len; i++) {
+ BM_select_history_store_notest(bm, value_array[i]);
+ }
+
+ PyMem_FREE(value_array);
+ return 0;
+}
diff --git a/source/blender/python/bmesh/bmesh_py_select.h b/source/blender/python/bmesh/bmesh_py_types_select.h
index d1bfcdcb6b3..4741e229400 100644
--- a/source/blender/python/bmesh/bmesh_py_select.h
+++ b/source/blender/python/bmesh/bmesh_py_types_select.h
@@ -23,12 +23,14 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/bmesh/bmesh_py_select.h
+/** \file blender/python/bmesh/bmesh_py_types_select.h
* \ingroup pybmesh
*/
-#ifndef __BMESH_PY_SELECT_H__
-#define __BMESH_PY_SELECT_H__
+#ifndef __BMESH_PY_TYPES_SELECT_H__
+#define __BMESH_PY_TYPES_SELECT_H__
+
+struct BPy_BMesh;
extern PyTypeObject BPy_BMEditSelSeq_Type;
extern PyTypeObject BPy_BMEditSelIter_Type;
@@ -47,9 +49,10 @@ typedef struct BPy_BMEditSelIter {
struct BMEditSelection *ese;
} BPy_BMEditSelIter;
-void BPy_BM_init_select_types(void);
+void BPy_BM_init_types_select(void);
PyObject *BPy_BMEditSel_CreatePyObject(BMesh *bm);
PyObject *BPy_BMEditSelIter_CreatePyObject(BMesh *bm);
+int BPy_BMEditSel_Assign(struct BPy_BMesh *self, PyObject *value);
#endif /* __BMESH_PY_SELECT_H__ */
diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c
index 8e9537f1d86..bbec871a44b 100644
--- a/source/blender/python/bmesh/bmesh_py_utils.c
+++ b/source/blender/python/bmesh/bmesh_py_utils.c
@@ -32,14 +32,14 @@
#include <Python.h>
-#include "bmesh.h"
-
-#include "bmesh_py_types.h"
-
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
+#include "bmesh.h"
+
+#include "bmesh_py_types.h"
+
#include "bmesh_py_utils.h" /* own include */
@@ -49,11 +49,11 @@ PyDoc_STRVAR(bpy_bm_utils_vert_collapse_edge_doc,
" Collapse a vertex into an edge.\n"
"\n"
" :arg vert: The vert that will be collapsed.\n"
-" :type vert: :class:`BMVert`\n"
+" :type vert: :class:`bmesh.types.BMVert`\n"
" :arg edge: The edge to collapse into.\n"
-" :type edge: :class:`BMEdge`\n"
+" :type edge: :class:`bmesh.types.BMEdge`\n"
" :return: The resulting edge from the collapse operation.\n"
-" :rtype: :class:`BMEdge`\n"
+" :rtype: :class:`bmesh.types.BMEdge`\n"
);
static PyObject *bpy_bm_utils_vert_collapse_edge(PyObject *UNUSED(self), PyObject *args)
{
@@ -109,13 +109,13 @@ PyDoc_STRVAR(bpy_bm_utils_vert_collapse_faces_doc,
" Split an edge, return the newly created data.\n"
"\n"
" :arg vert: The vert that will be collapsed.\n"
-" :type vert: :class:`BMVert`\n"
+" :type vert: :class:`bmesh.types.BMVert`\n"
" :arg edge: The edge to collapse into.\n"
-" :type edge: :class:`BMEdge`\n"
+" :type edge: :class:`bmesh.types.BMEdge`\n"
" :arg fac: The factor to use when merging customdata [0 - 1].\n"
" :type fac: float\n"
" :return: The resulting edge from the collapse operation.\n"
-" :rtype: :class:`BMEdge`\n"
+" :rtype: :class:`bmesh.types.BMEdge`\n"
);
static PyObject *bpy_bm_utils_vert_collapse_faces(PyObject *UNUSED(self), PyObject *args)
{
@@ -175,7 +175,7 @@ PyDoc_STRVAR(bpy_bm_utils_vert_dissolve_doc,
" Dissolve this vertex (will be removed).\n"
"\n"
" :arg vert: The vert to be dissolved.\n"
-" :type vert: :class:`BMVert`\n"
+" :type vert: :class:`bmesh.types.BMVert`\n"
" :return: True when the vertex dissolve is successful.\n"
" :rtype: boolean\n"
);
@@ -204,11 +204,11 @@ PyDoc_STRVAR(bpy_bm_utils_vert_separate_doc,
" Separate this vertex at every edge.\n"
"\n"
" :arg vert: The vert to be separated.\n"
-" :type vert: :class:`BMVert`\n"
+" :type vert: :class:`bmesh.types.BMVert`\n"
" :arg edges: The edges to separated.\n"
-" :type edges: :class:`BMEdge`\n"
+" :type edges: :class:`bmesh.types.BMEdge`\n"
" :return: The newly separated verts (including the vertex passed).\n"
-" :rtype: tuple of :class:`BMVert`\n"
+" :rtype: tuple of :class:`bmesh.types.BMVert`\n"
);
static PyObject *bpy_bm_utils_vert_separate(PyObject *UNUSED(self), PyObject *args)
{
@@ -238,7 +238,7 @@ static PyObject *bpy_bm_utils_vert_separate(PyObject *UNUSED(self), PyObject *ar
bm = py_vert->bm;
edge_array = BPy_BMElem_PySeq_As_Array(&bm, edge_seq, 0, PY_SSIZE_T_MAX,
- &edge_array_len, &BPy_BMEdge_Type,
+ &edge_array_len, BM_EDGE,
TRUE, TRUE, "vert_separate(...)");
if (edge_array == NULL) {
@@ -266,9 +266,9 @@ PyDoc_STRVAR(bpy_bm_utils_edge_split_doc,
" Split an edge, return the newly created data.\n"
"\n"
" :arg edge: The edge to split.\n"
-" :type edge: :class:`BMEdge`\n"
+" :type edge: :class:`bmesh.types.BMEdge`\n"
" :arg vert: One of the verts on the edge, defines the split direction.\n"
-" :type vert: :class:`BMVert`\n"
+" :type vert: :class:`bmesh.types.BMVert`\n"
" :arg fac: The point on the edge where the new vert will be created [0 - 1].\n"
" :type fac: float\n"
" :return: The newly created (edge, vert) pair.\n"
@@ -329,11 +329,11 @@ PyDoc_STRVAR(bpy_bm_utils_edge_rotate_doc,
" If rotating the edge fails, None will be returned.\n"
"\n"
" :arg edge: The edge to rotate.\n"
-" :type edge: :class:`BMEdge`\n"
+" :type edge: :class:`bmesh.types.BMEdge`\n"
" :arg ccw: When True the edge will be rotated counter clockwise.\n"
" :type ccw: boolean\n"
" :return: The newly rotated edge.\n"
-" :rtype: :class:`BMEdge`\n"
+" :rtype: :class:`bmesh.types.BMEdge`\n"
);
static PyObject *bpy_bm_utils_edge_rotate(PyObject *UNUSED(self), PyObject *args)
{
@@ -371,13 +371,13 @@ PyDoc_STRVAR(bpy_bm_utils_face_split_doc,
" Split an edge, return the newly created data.\n"
"\n"
" :arg face: The face to cut.\n"
-" :type face: :class:`BMFace`\n"
+" :type face: :class:`bmesh.types.BMFace`\n"
" :arg vert_a: First vertex to cut in the face (face must contain the vert).\n"
-" :type vert_a: :class:`BMVert`\n"
+" :type vert_a: :class:`bmesh.types.BMVert`\n"
" :arg vert_b: Second vertex to cut in the face (face must contain the vert).\n"
-" :type vert_b: :class:`BMVert`\n"
+" :type vert_b: :class:`bmesh.types.BMVert`\n"
" :arg edge_example: Optional edge argument, newly created edge will copy settings from this one.\n"
-" :type edge_example: :class:`BMEdge`\n"
+" :type edge_example: :class:`bmesh.types.BMEdge`\n"
);
static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args)
{
@@ -448,9 +448,9 @@ PyDoc_STRVAR(bpy_bm_utils_face_join_doc,
" Joins a sequence of faces.\n"
"\n"
" :arg faces: Sequence of faces.\n"
-" :type faces: :class:`BMFace`\n"
+" :type faces: :class:`bmesh.types.BMFace`\n"
" :return: The newly created face or None on failure.\n"
-" :rtype: :class:`BMFace`\n"
+" :rtype: :class:`bmesh.types.BMFace`\n"
);
static PyObject *bpy_bm_utils_face_join(PyObject *UNUSED(self), PyObject *value)
{
@@ -460,7 +460,7 @@ static PyObject *bpy_bm_utils_face_join(PyObject *UNUSED(self), PyObject *value)
BMFace *f_new;
face_array = BPy_BMElem_PySeq_As_Array(&bm, value, 2, PY_SSIZE_T_MAX,
- &face_seq_len, &BPy_BMFace_Type,
+ &face_seq_len, BM_FACE,
TRUE, TRUE, "face_join(...)");
if (face_array == NULL) {
@@ -488,11 +488,11 @@ PyDoc_STRVAR(bpy_bm_utils_face_vert_separate_doc,
" Rip a vertex in a face away and add a new vertex.\n"
"\n"
" :arg face: The face to separate.\n"
-" :type face: :class:`BMFace`\n"
+" :type face: :class:`bmesh.types.BMFace`\n"
" :arg vert: A vertex in the face to separate.\n"
-" :type vert: :class:`BMVert`\n"
+" :type vert: :class:`bmesh.types.BMVert`\n"
" :return vert: The newly created vertex or None of failure.\n"
-" :rtype vert: :class:`BMVert`\n"
+" :rtype vert: :class:`bmesh.types.BMVert`\n"
"\n"
" .. note::\n"
"\n"
@@ -550,7 +550,7 @@ PyDoc_STRVAR(bpy_bm_utils_face_flip_doc,
" Flip the faces direction.\n"
"\n"
" :arg face: Face to flip.\n"
-" :type face: :class:`BMFace`\n"
+" :type face: :class:`bmesh.types.BMFace`\n"
);
static PyObject *bpy_bm_utils_face_flip(PyObject *UNUSED(self), BPy_BMFace *value)
{
@@ -576,9 +576,9 @@ PyDoc_STRVAR(bpy_bm_utils_loop_separate_doc,
" Rip a vertex in a face away and add a new vertex.\n"
"\n"
" :arg loop: The to separate.\n"
-" :type loop: :class:`BMFace`\n"
+" :type loop: :class:`bmesh.types.BMFace`\n"
" :return vert: The newly created vertex or None of failure.\n"
-" :rtype vert: :class:`BMVert`\n"
+" :rtype vert: :class:`bmesh.types.BMVert`\n"
);
static PyObject *bpy_bm_utils_loop_separate(PyObject *UNUSED(self), BPy_BMLoop *value)
{
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index e32444976dd..48052febfb7 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -80,10 +80,10 @@ static PyObject *Buffer_repr(Buffer *self);
static PyObject *Buffer_to_list(Buffer *self)
{
- int i, len= self->dimensions[0];
- PyObject *list= PyList_New(len);
+ int i, len = self->dimensions[0];
+ PyObject *list = PyList_New(len);
- for (i=0; i<len; i++) {
+ for (i = 0; i < len; i++) {
PyList_SET_ITEM(list, i, Buffer_item(self, i));
}
@@ -95,17 +95,17 @@ static PyObject *Buffer_to_list_recursive(Buffer *self)
PyObject *list;
if (self->ndimensions > 1) {
- int i, len= self->dimensions[0];
- list= PyList_New(len);
+ int i, len = self->dimensions[0];
+ list = PyList_New(len);
- for (i=0; i<len; i++) {
- Buffer *sub= (Buffer *)Buffer_item(self, i);
+ for (i = 0; i < len; i++) {
+ Buffer *sub = (Buffer *)Buffer_item(self, i);
PyList_SET_ITEM(list, i, Buffer_to_list_recursive(sub));
Py_DECREF(sub);
}
}
else {
- list= Buffer_to_list(self);
+ list = Buffer_to_list(self);
}
return list;
@@ -113,10 +113,10 @@ static PyObject *Buffer_to_list_recursive(Buffer *self)
static PyObject *Buffer_dimensions(Buffer *self, void *UNUSED(arg))
{
- PyObject *list= PyList_New(self->ndimensions);
+ PyObject *list = PyList_New(self->ndimensions);
int i;
- for (i= 0; i<self->ndimensions; i++) {
+ for (i = 0; i < self->ndimensions; i++) {
PyList_SET_ITEM(list, i, PyLong_FromLong(self->dimensions[i]));
}
@@ -239,16 +239,16 @@ static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) \
int BGL_typeSize(int type)
{
switch (type) {
- case GL_BYTE:
- return sizeof(char);
- case GL_SHORT:
- return sizeof(short);
- case GL_INT:
- return sizeof(int);
- case GL_FLOAT:
- return sizeof(float);
- case GL_DOUBLE:
- return sizeof(double);
+ case GL_BYTE:
+ return sizeof(char);
+ case GL_SHORT:
+ return sizeof(short);
+ case GL_INT:
+ return sizeof(int);
+ case GL_FLOAT:
+ return sizeof(float);
+ case GL_DOUBLE:
+ return sizeof(double);
}
return -1;
}
@@ -256,30 +256,31 @@ int BGL_typeSize(int type)
Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuffer)
{
Buffer *buffer;
- void *buf= NULL;
+ void *buf = NULL;
int i, size, length;
-
- length= 1;
- for (i=0; i<ndimensions; i++)
- length*= dimensions[i];
-
- size= BGL_typeSize(type);
-
- buf= MEM_mallocN(length*size, "Buffer buffer");
-
- buffer= (Buffer *) PyObject_NEW(Buffer, &BGL_bufferType);
- buffer->parent= NULL;
- buffer->ndimensions= ndimensions;
- buffer->dimensions= MEM_mallocN(ndimensions*sizeof(int), "Buffer dimensions");
- memcpy(buffer->dimensions, dimensions, ndimensions*sizeof(int));
- buffer->type= type;
- buffer->buf.asvoid= buf;
+
+ length = 1;
+ for (i = 0; i < ndimensions; i++) {
+ length *= dimensions[i];
+ }
+
+ size = BGL_typeSize(type);
+
+ buf = MEM_mallocN(length * size, "Buffer buffer");
+
+ buffer = (Buffer *)PyObject_NEW(Buffer, &BGL_bufferType);
+ buffer->parent = NULL;
+ buffer->ndimensions = ndimensions;
+ buffer->dimensions = MEM_mallocN(ndimensions * sizeof(int), "Buffer dimensions");
+ memcpy(buffer->dimensions, dimensions, ndimensions * sizeof(int));
+ buffer->type = type;
+ buffer->buf.asvoid = buf;
if (initbuffer) {
- memcpy(buffer->buf.asvoid, initbuffer, length*size);
+ memcpy(buffer->buf.asvoid, initbuffer, length * size);
}
else {
- memset(buffer->buf.asvoid, 0, length*size);
+ memset(buffer->buf.asvoid, 0, length * size);
}
return buffer;
}
@@ -288,10 +289,10 @@ Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuf
#define MAX_DIMENSIONS 256
static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
{
- PyObject *length_ob= NULL, *init= NULL;
+ PyObject *length_ob = NULL, *init = NULL;
Buffer *buffer;
int dimensions[MAX_DIMENSIONS];
-
+
int type;
Py_ssize_t i, ndimensions = 0;
@@ -312,15 +313,15 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
}
if (PyLong_Check(length_ob)) {
- ndimensions= 1;
- if (((dimensions[0]= PyLong_AsLong(length_ob)) < 1)) {
+ ndimensions = 1;
+ if (((dimensions[0] = PyLong_AsLong(length_ob)) < 1)) {
PyErr_SetString(PyExc_AttributeError,
"dimensions must be between 1 and "STRINGIFY(MAX_DIMENSIONS));
return NULL;
}
}
else if (PySequence_Check(length_ob)) {
- ndimensions= PySequence_Size(length_ob);
+ ndimensions = PySequence_Size(length_ob);
if (ndimensions > MAX_DIMENSIONS) {
PyErr_SetString(PyExc_AttributeError,
"too many dimensions, max is "STRINGIFY(MAX_DIMENSIONS));
@@ -331,11 +332,13 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
"sequence must have at least one dimension");
return NULL;
}
- for (i=0; i<ndimensions; i++) {
- PyObject *ob= PySequence_GetItem(length_ob, i);
+ for (i = 0; i < ndimensions; i++) {
+ PyObject *ob = PySequence_GetItem(length_ob, i);
- if (!PyLong_Check(ob)) dimensions[i]= 1;
- else dimensions[i]= PyLong_AsLong(ob);
+ if (!PyLong_Check(ob))
+ dimensions[i] = 1;
+ else
+ dimensions[i] = PyLong_AsLong(ob);
Py_DECREF(ob);
if (dimensions[i] < 1) {
@@ -351,16 +354,16 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
"or an int, not a %.200s", Py_TYPE(length_ob)->tp_name);
return NULL;
}
-
- buffer= BGL_MakeBuffer(type, ndimensions, dimensions, NULL);
+
+ buffer = BGL_MakeBuffer(type, ndimensions, dimensions, NULL);
if (init && ndimensions) {
if (Buffer_ass_slice(buffer, 0, dimensions[0], init)) {
Py_DECREF(buffer);
return NULL;
}
}
-
- return (PyObject *) buffer;
+
+ return (PyObject *)buffer;
}
/*@ Buffer sequence methods */
@@ -377,12 +380,12 @@ static PyObject *Buffer_item(Buffer *self, int i)
return NULL;
}
- if (self->ndimensions==1) {
+ if (self->ndimensions == 1) {
switch (self->type) {
- case GL_BYTE: return Py_BuildValue("b", self->buf.asbyte[i]);
- case GL_SHORT: return Py_BuildValue("h", self->buf.asshort[i]);
- case GL_INT: return Py_BuildValue("i", self->buf.asint[i]);
- case GL_FLOAT: return PyFloat_FromDouble(self->buf.asfloat[i]);
+ case GL_BYTE: return Py_BuildValue("b", self->buf.asbyte[i]);
+ case GL_SHORT: return Py_BuildValue("h", self->buf.asshort[i]);
+ case GL_INT: return Py_BuildValue("i", self->buf.asint[i]);
+ case GL_FLOAT: return PyFloat_FromDouble(self->buf.asfloat[i]);
case GL_DOUBLE: return Py_BuildValue("d", self->buf.asdouble[i]);
}
}
@@ -390,26 +393,24 @@ static PyObject *Buffer_item(Buffer *self, int i)
Buffer *newbuf;
int j, length, size;
- length= 1;
- for (j=1; j < self->ndimensions; j++) {
+ length = 1;
+ for (j = 1; j < self->ndimensions; j++) {
length *= self->dimensions[j];
}
- size= BGL_typeSize(self->type);
+ size = BGL_typeSize(self->type);
- newbuf= (Buffer *) PyObject_NEW(Buffer, &BGL_bufferType);
+ newbuf = (Buffer *)PyObject_NEW(Buffer, &BGL_bufferType);
Py_INCREF(self);
- newbuf->parent= (PyObject *)self;
+ newbuf->parent = (PyObject *)self;
- newbuf->ndimensions= self->ndimensions - 1;
- newbuf->type= self->type;
- newbuf->buf.asvoid= self->buf.asbyte + i*length*size;
- newbuf->dimensions= MEM_mallocN(newbuf->ndimensions*sizeof(int),
- "Buffer dimensions");
- memcpy(newbuf->dimensions, self->dimensions+1,
- newbuf->ndimensions*sizeof(int));
+ newbuf->ndimensions = self->ndimensions - 1;
+ newbuf->type = self->type;
+ newbuf->buf.asvoid = self->buf.asbyte + i * length * size;
+ newbuf->dimensions = MEM_mallocN(newbuf->ndimensions * sizeof(int), "Buffer dimensions");
+ memcpy(newbuf->dimensions, self->dimensions + 1, newbuf->ndimensions * sizeof(int));
- return (PyObject *) newbuf;
+ return (PyObject *)newbuf;
}
return NULL;
@@ -420,13 +421,13 @@ static PyObject *Buffer_slice(Buffer *self, int begin, int end)
PyObject *list;
int count;
- if (begin < 0) begin= 0;
- if (end > self->dimensions[0]) end= self->dimensions[0];
- if (begin > end) begin= end;
+ if (begin < 0) begin = 0;
+ if (end > self->dimensions[0]) end = self->dimensions[0];
+ if (begin > end) begin = end;
- list= PyList_New(end-begin);
+ list = PyList_New(end - begin);
- for (count= begin; count<end; count++) {
+ for (count = begin; count < end; count++) {
PyList_SET_ITEM(list, count-begin, Buffer_item(self, count));
}
return list;
@@ -440,11 +441,11 @@ static int Buffer_ass_item(Buffer *self, int i, PyObject *v)
return -1;
}
- if (self->ndimensions!=1) {
- Buffer *row= (Buffer *)Buffer_item(self, i);
+ if (self->ndimensions != 1) {
+ Buffer *row = (Buffer *)Buffer_item(self, i);
if (row) {
- int ret= Buffer_ass_slice(row, 0, self->dimensions[1], v);
+ int ret = Buffer_ass_slice(row, 0, self->dimensions[1], v);
Py_DECREF(row);
return ret;
}
@@ -454,29 +455,23 @@ static int Buffer_ass_item(Buffer *self, int i, PyObject *v)
}
switch (self->type) {
- case GL_BYTE:
- return PyArg_Parse(v, "b:Expected ints", &self->buf.asbyte[i]) ? 0:-1;
- case GL_SHORT:
- return PyArg_Parse(v, "h:Expected ints", &self->buf.asshort[i]) ? 0:-1;
- case GL_INT:
- return PyArg_Parse(v, "i:Expected ints", &self->buf.asint[i]) ? 0:-1;
- case GL_FLOAT:
- return PyArg_Parse(v, "f:Expected floats", &self->buf.asfloat[i]) ? 0:-1;
- case GL_DOUBLE:
- return PyArg_Parse(v, "d:Expected floats", &self->buf.asdouble[i]) ? 0:-1;
- default:
- return 0; /* should never happen */
+ case GL_BYTE: return PyArg_Parse(v, "b:Expected ints", &self->buf.asbyte[i]) ? 0 : -1;
+ case GL_SHORT: return PyArg_Parse(v, "h:Expected ints", &self->buf.asshort[i]) ? 0 : -1;
+ case GL_INT: return PyArg_Parse(v, "i:Expected ints", &self->buf.asint[i]) ? 0 : -1;
+ case GL_FLOAT: return PyArg_Parse(v, "f:Expected floats", &self->buf.asfloat[i]) ? 0 : -1;
+ case GL_DOUBLE: return PyArg_Parse(v, "d:Expected floats", &self->buf.asdouble[i]) ? 0 : -1;
+ default: return 0; /* should never happen */
}
}
static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
{
PyObject *item;
- int count, err=0;
+ int count, err = 0;
- if (begin < 0) begin= 0;
- if (end > self->dimensions[0]) end= self->dimensions[0];
- if (begin > end) begin= end;
+ if (begin < 0) begin = 0;
+ if (end > self->dimensions[0]) end = self->dimensions[0];
+ if (begin > end) begin = end;
if (!PySequence_Check(seq)) {
PyErr_Format(PyExc_TypeError,
@@ -487,23 +482,25 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
}
/* re-use count var */
- if ((count= PySequence_Size(seq)) != (end - begin)) {
+ if ((count = PySequence_Size(seq)) != (end - begin)) {
PyErr_Format(PyExc_TypeError,
"buffer[:] = value, size mismatch in assignment. "
"Expected: %d (given: %d)", count, end - begin);
return -1;
}
- for (count= begin; count < end; count++) {
- item= PySequence_GetItem(seq, count - begin);
+ for (count = begin; count < end; count++) {
+ item = PySequence_GetItem(seq, count - begin);
if (item) {
- err= Buffer_ass_item(self, count, item);
+ err = Buffer_ass_item(self, count, item);
Py_DECREF(item);
}
else {
- err= -1;
+ err = -1;
+ }
+ if (err) {
+ break;
}
- if (err) break;
}
return err;
}
@@ -580,8 +577,12 @@ static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value)
static void Buffer_dealloc(Buffer *self)
{
- if (self->parent) Py_DECREF(self->parent);
- else MEM_freeN (self->buf.asvoid);
+ if (self->parent) {
+ Py_DECREF(self->parent);
+ }
+ else {
+ MEM_freeN(self->buf.asvoid);
+ }
MEM_freeN(self->dimensions);
@@ -591,19 +592,20 @@ static void Buffer_dealloc(Buffer *self)
static PyObject *Buffer_repr(Buffer *self)
{
- PyObject *list= Buffer_to_list_recursive(self);
+ PyObject *list = Buffer_to_list_recursive(self);
PyObject *repr;
- const char *typestr= "UNKNOWN";
+ const char *typestr;
switch (self->type) {
- case GL_BYTE: typestr= "GL_BYTE"; break;
- case GL_SHORT: typestr= "GL_SHORT"; break;
- case GL_INT: typestr= "GL_BYTE"; break;
- case GL_FLOAT: typestr= "GL_FLOAT"; break;
- case GL_DOUBLE: typestr= "GL_DOUBLE"; break;
+ case GL_BYTE: typestr = "GL_BYTE"; break;
+ case GL_SHORT: typestr = "GL_SHORT"; break;
+ case GL_INT: typestr = "GL_BYTE"; break;
+ case GL_FLOAT: typestr = "GL_FLOAT"; break;
+ case GL_DOUBLE: typestr = "GL_DOUBLE"; break;
+ default: typestr = "UNKNOWN"; break;
}
- repr= PyUnicode_FromFormat("Buffer(%s, %R)", typestr, list);
+ repr = PyUnicode_FromFormat("Buffer(%s, %R)", typestr, list);
Py_DECREF(list);
return repr;
@@ -1296,21 +1298,20 @@ static struct PyModuleDef BGL_module_def = {
PyObject *BPyInit_bgl(void)
{
PyObject *submodule, *dict, *item;
- submodule= PyModule_Create(&BGL_module_def);
- dict= PyModule_GetDict(submodule);
-
+ submodule = PyModule_Create(&BGL_module_def);
+ dict = PyModule_GetDict(submodule);
+
if (PyType_Ready(&BGL_bufferType) < 0)
return NULL; /* should never happen */
-
PyModule_AddObject(submodule, "Buffer", (PyObject *)&BGL_bufferType);
Py_INCREF((PyObject *)&BGL_bufferType);
-#define EXPP_ADDCONST(x) PyDict_SetItemString(dict, #x, item=PyLong_FromLong((int)x)); Py_DECREF(item)
+#define EXPP_ADDCONST(x) PyDict_SetItemString(dict, #x, item = PyLong_FromLong((int)x)); Py_DECREF(item)
/* So, for example:
* EXPP_ADDCONST(GL_CURRENT_BIT) becomes
- * PyDict_SetItemString(dict, "GL_CURRENT_BIT", item=PyLong_FromLong(GL_CURRENT_BIT)); Py_DECREF(item) */
+ * PyDict_SetItemString(dict, "GL_CURRENT_BIT", item = PyLong_FromLong(GL_CURRENT_BIT)); Py_DECREF(item) */
EXPP_ADDCONST(GL_CURRENT_BIT);
EXPP_ADDCONST(GL_POINT_BIT);
@@ -1795,4 +1796,3 @@ PyObject *BPyInit_bgl(void)
return submodule;
}
-
diff --git a/source/blender/python/generic/bgl.h b/source/blender/python/generic/bgl.h
index 9df08882b8a..daebd7a5194 100644
--- a/source/blender/python/generic/bgl.h
+++ b/source/blender/python/generic/bgl.h
@@ -44,10 +44,10 @@ PyObject *BPyInit_bgl(void);
/*@ Create a buffer object */
/*@ dimensions is an array of ndimensions integers representing the size of each dimension */
/*@ initbuffer if not NULL holds a contiguous buffer with the correct format from which the buffer will be initialized */
-struct _Buffer *BGL_MakeBuffer( int type, int ndimensions, int *dimensions, void *initbuffer );
+struct _Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuffer);
/*@ Return the size of buffer element, type must be one of GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT or GL_DOUBLE */
/*@ returns -1 otherwise */
-int BGL_typeSize( int type );
+int BGL_typeSize(int type);
/*@ Buffer Object */
/*@ For Python access to OpenGL functions requiring a pointer. */
@@ -312,23 +312,23 @@ extern PyTypeObject BGL_bufferType;
#define ret_ret_void return Py_INCREF(Py_None), Py_None
#define ret_def_GLint int ret_int
-#define ret_set_GLint ret_int=
+#define ret_set_GLint ret_int =
#define ret_ret_GLint return PyLong_FromLong(ret_int)
#define ret_def_GLuint unsigned int ret_uint
-#define ret_set_GLuint ret_uint=
+#define ret_set_GLuint ret_uint =
#define ret_ret_GLuint return PyLong_FromLong((long) ret_uint)
#define ret_def_GLenum unsigned int ret_uint
-#define ret_set_GLenum ret_uint=
+#define ret_set_GLenum ret_uint =
#define ret_ret_GLenum return PyLong_FromLong((long) ret_uint)
#define ret_def_GLboolean unsigned char ret_bool
-#define ret_set_GLboolean ret_bool=
+#define ret_set_GLboolean ret_bool =
#define ret_ret_GLboolean return PyLong_FromLong((long) ret_bool)
#define ret_def_GLstring const unsigned char *ret_str;
-#define ret_set_GLstring ret_str=
+#define ret_set_GLstring ret_str =
#define ret_ret_GLstring \
if (ret_str) { \
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index a4373e46e23..5b5438defee 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -182,7 +182,7 @@ static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
BLF_width_and_height(fontid, text, &r_width, &r_height);
- ret= PyTuple_New(2);
+ ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(r_width));
PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(r_height));
return ret;
@@ -356,7 +356,7 @@ PyDoc_STRVAR(py_blf_load_doc,
);
static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
{
- char* filename;
+ char *filename;
if (!PyArg_ParseTuple(args, "s:blf.load", &filename))
return NULL;
@@ -374,7 +374,7 @@ PyDoc_STRVAR(py_blf_unload_doc,
);
static PyObject *py_blf_unload(PyObject *UNUSED(self), PyObject *args)
{
- char* filename;
+ char *filename;
if (!PyArg_ParseTuple(args, "s:blf.unload", &filename))
return NULL;
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 36308cdc3e5..4ce68f108f6 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -101,7 +101,7 @@ void bpy_text_filename_get(char *fn, size_t fn_len, Text *text)
PyObject *bpy_text_import(Text *text)
{
char *buf = NULL;
- char modulename[MAX_ID_NAME+2];
+ char modulename[MAX_ID_NAME + 2];
int len;
if (!text->compiled) {
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 33c5d3bd06d..b9785fc375c 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -74,21 +74,21 @@ static PyObject *idprop_py_from_idp_int(IDProperty *prop)
static PyObject *idprop_py_from_idp_float(IDProperty *prop)
{
- return PyFloat_FromDouble((double)(*(float*)(&prop->data.val)));
+ return PyFloat_FromDouble((double)(*(float *)(&prop->data.val)));
}
static PyObject *idprop_py_from_idp_double(IDProperty *prop)
{
- return PyFloat_FromDouble((*(double*)(&prop->data.val)));
+ return PyFloat_FromDouble((*(double *)(&prop->data.val)));
}
static PyObject *idprop_py_from_idp_group(ID *id, IDProperty *prop, IDProperty *parent)
{
- BPy_IDProperty *group= PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type);
+ BPy_IDProperty *group = PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type);
group->id = id;
group->prop = prop;
group->parent = parent; /* can be NULL */
- return (PyObject*) group;
+ return (PyObject*)group;
}
static PyObject *idprop_py_from_idp_array(ID *id, IDProperty *prop)
@@ -96,13 +96,13 @@ static PyObject *idprop_py_from_idp_array(ID *id, IDProperty *prop)
BPy_IDProperty *array = PyObject_New(BPy_IDProperty, &BPy_IDArray_Type);
array->id = id;
array->prop = prop;
- return (PyObject*) array;
+ return (PyObject*)array;
}
static PyObject *idprop_py_from_idp_idparray(ID *id, IDProperty *prop)
{
PyObject *seq = PyList_New(prop->len), *wrap;
- IDProperty *array= IDP_IDPArray(prop);
+ IDProperty *array = IDP_IDPArray(prop);
int i;
if (!seq) {
@@ -112,8 +112,8 @@ static PyObject *idprop_py_from_idp_idparray(ID *id, IDProperty *prop)
return NULL;
}
- for (i=0; i<prop->len; i++) {
- wrap= BPy_IDGroup_WrapData(id, array++, prop);
+ for (i = 0; i < prop->len; i++) {
+ wrap = BPy_IDGroup_WrapData(id, array++, prop);
if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
return NULL;
@@ -134,28 +134,20 @@ static Py_hash_t BPy_IDGroup_hash(BPy_IDProperty *self)
static PyObject *BPy_IDGroup_repr(BPy_IDProperty *self)
{
- return PyUnicode_FromFormat( "<bpy id property from \"%s\">", self->id->name);
+ return PyUnicode_FromFormat("<bpy id property from \"%s\">", self->id->name);
}
PyObject *BPy_IDGroup_WrapData(ID *id, IDProperty *prop, IDProperty *parent)
{
switch (prop->type) {
- case IDP_STRING:
- return idprop_py_from_idp_string(prop);
- case IDP_INT:
- return idprop_py_from_idp_int(prop);
- case IDP_FLOAT:
- return idprop_py_from_idp_float(prop);
- case IDP_DOUBLE:
- return idprop_py_from_idp_double(prop);
- case IDP_GROUP:
- return idprop_py_from_idp_group(id, prop, parent);
- case IDP_ARRAY:
- return idprop_py_from_idp_array(id, prop);
- case IDP_IDPARRAY: /* this could be better a internal type */
- return idprop_py_from_idp_idparray(id, prop);
- default:
- Py_RETURN_NONE;
+ case IDP_STRING: return idprop_py_from_idp_string(prop);
+ case IDP_INT: return idprop_py_from_idp_int(prop);
+ case IDP_FLOAT: return idprop_py_from_idp_float(prop);
+ case IDP_DOUBLE: return idprop_py_from_idp_double(prop);
+ case IDP_GROUP: return idprop_py_from_idp_group(id, prop, parent);
+ case IDP_ARRAY: return idprop_py_from_idp_array(id, prop);
+ case IDP_IDPARRAY: return idprop_py_from_idp_idparray(id, prop); /* this could be better a internal type */
+ default: Py_RETURN_NONE;
}
}
@@ -174,10 +166,10 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
#ifdef USE_STRING_COERCE
{
int alloc_len;
- PyObject *value_coerce= NULL;
+ PyObject *value_coerce = NULL;
- st= (char *)PyC_UnicodeAsByte(value, &value_coerce);
- alloc_len= strlen(st) + 1;
+ st = (char *)PyC_UnicodeAsByte(value, &value_coerce);
+ alloc_len = strlen(st) + 1;
st = _PyUnicode_AsString(value);
IDP_ResizeArray(prop, alloc_len);
@@ -195,8 +187,8 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
case IDP_INT:
{
- int ivalue= PyLong_AsSsize_t(value);
- if (ivalue==-1 && PyErr_Occurred()) {
+ int ivalue = PyLong_AsSsize_t(value);
+ if (ivalue == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected an int type");
return -1;
}
@@ -205,22 +197,22 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
}
case IDP_FLOAT:
{
- float fvalue= (float)PyFloat_AsDouble(value);
- if (fvalue==-1 && PyErr_Occurred()) {
+ float fvalue = (float)PyFloat_AsDouble(value);
+ if (fvalue == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected a float");
return -1;
}
- *(float*)&self->prop->data.val = fvalue;
+ *(float *)&self->prop->data.val = fvalue;
break;
}
case IDP_DOUBLE:
{
- double dvalue= PyFloat_AsDouble(value);
- if (dvalue==-1 && PyErr_Occurred()) {
+ double dvalue = PyFloat_AsDouble(value);
+ if (dvalue == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected a float");
return -1;
}
- *(double*)&self->prop->data.val = dvalue;
+ *(double *)&self->prop->data.val = dvalue;
break;
}
default:
@@ -289,16 +281,16 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
return NULL;
}
- name= _PyUnicode_AsString(item);
+ name = _PyUnicode_AsString(item);
if (name == NULL) {
PyErr_SetString(PyExc_TypeError, "only strings are allowed as keys of ID properties");
return NULL;
}
- idprop= IDP_GetPropertyFromGroup(self->prop, name);
+ idprop = IDP_GetPropertyFromGroup(self->prop, name);
- if (idprop==NULL) {
+ if (idprop == NULL) {
PyErr_SetString(PyExc_KeyError, "key not in subgroup dict");
return NULL;
}
@@ -306,21 +298,21 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
return BPy_IDGroup_WrapData(self->id, idprop, self->prop);
}
-/*returns NULL on success, error string on failure*/
+/* returns NULL on success, error string on failure */
static int idp_sequence_type(PyObject *seq)
{
PyObject *item;
- int type= IDP_INT;
+ int type = IDP_INT;
Py_ssize_t i, len = PySequence_Size(seq);
- for (i=0; i < len; i++) {
+ for (i = 0; i < len; i++) {
item = PySequence_GetItem(seq, i);
if (PyFloat_Check(item)) {
if (type == IDP_IDPARRAY) { /* mixed dict/int */
Py_DECREF(item);
return -1;
}
- type= IDP_DOUBLE;
+ type = IDP_DOUBLE;
}
else if (PyLong_Check(item)) {
if (type == IDP_IDPARRAY) { /* mixed dict/int */
@@ -333,7 +325,7 @@ static int idp_sequence_type(PyObject *seq)
Py_DECREF(item);
return -1;
}
- type= IDP_IDPARRAY;
+ type = IDP_IDPARRAY;
}
else {
Py_XDECREF(item);
@@ -353,7 +345,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
IDProperty *prop = NULL;
IDPropertyTemplate val = {0};
- const char *name= "";
+ const char *name = "";
if (name_obj) {
Py_ssize_t name_size;
@@ -373,7 +365,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
}
else if (PyUnicode_Check(ob)) {
#ifdef USE_STRING_COERCE
- PyObject *value_coerce= NULL;
+ PyObject *value_coerce = NULL;
val.string.str = (char *)PyC_UnicodeAsByte(ob, &value_coerce);
val.string.subtype = IDP_STRING_SUB_UTF8;
prop = IDP_New(IDP_STRING, &val, name);
@@ -384,19 +376,19 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
#endif
}
else if (PyBytes_Check(ob)) {
- val.string.str= PyBytes_AS_STRING(ob);
- val.string.len= PyBytes_GET_SIZE(ob);
- val.string.subtype= IDP_STRING_SUB_BYTE;
+ val.string.str = PyBytes_AS_STRING(ob);
+ val.string.len = PyBytes_GET_SIZE(ob);
+ val.string.subtype = IDP_STRING_SUB_BYTE;
prop = IDP_New(IDP_STRING, &val, name);
//prop = IDP_NewString(PyBytes_AS_STRING(ob), name, PyBytes_GET_SIZE(ob));
- //prop->subtype= IDP_STRING_SUB_BYTE;
+ //prop->subtype = IDP_STRING_SUB_BYTE;
}
else if (PySequence_Check(ob)) {
PyObject *item;
int i;
- if ((val.array.type= idp_sequence_type(ob)) == -1)
+ if ((val.array.type = idp_sequence_type(ob)) == -1)
return "only floats, ints and dicts are allowed in ID property arrays";
/* validate sequence and derive type.
@@ -406,34 +398,34 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
val.array.len = PySequence_Size(ob);
switch (val.array.type) {
- case IDP_DOUBLE:
- prop = IDP_New(IDP_ARRAY, &val, name);
- for (i=0; i<val.array.len; i++) {
- item = PySequence_GetItem(ob, i);
- ((double*)IDP_Array(prop))[i] = (float)PyFloat_AsDouble(item);
- Py_DECREF(item);
- }
- break;
- case IDP_INT:
- prop = IDP_New(IDP_ARRAY, &val, name);
- for (i=0; i<val.array.len; i++) {
- item = PySequence_GetItem(ob, i);
- ((int*)IDP_Array(prop))[i] = (int)PyLong_AsSsize_t(item);
- Py_DECREF(item);
- }
- break;
- case IDP_IDPARRAY:
- prop= IDP_NewIDPArray(name);
- for (i=0; i<val.array.len; i++) {
- const char *error;
- item = PySequence_GetItem(ob, i);
- error= BPy_IDProperty_Map_ValidateAndCreate(NULL, prop, item);
- Py_DECREF(item);
-
- if (error)
- return error;
- }
- break;
+ case IDP_DOUBLE:
+ prop = IDP_New(IDP_ARRAY, &val, name);
+ for (i = 0; i < val.array.len; i++) {
+ item = PySequence_GetItem(ob, i);
+ ((double *)IDP_Array(prop))[i] = (float)PyFloat_AsDouble(item);
+ Py_DECREF(item);
+ }
+ break;
+ case IDP_INT:
+ prop = IDP_New(IDP_ARRAY, &val, name);
+ for (i = 0; i < val.array.len; i++) {
+ item = PySequence_GetItem(ob, i);
+ ((int *)IDP_Array(prop))[i] = (int)PyLong_AsSsize_t(item);
+ Py_DECREF(item);
+ }
+ break;
+ case IDP_IDPARRAY:
+ prop = IDP_NewIDPArray(name);
+ for (i = 0; i < val.array.len; i++) {
+ const char *error;
+ item = PySequence_GetItem(ob, i);
+ error = BPy_IDProperty_Map_ValidateAndCreate(NULL, prop, item);
+ Py_DECREF(item);
+
+ if (error)
+ return error;
+ }
+ break;
}
}
else if (PyMapping_Check(ob)) {
@@ -447,7 +439,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
* we can delete it easily enough.*/
prop = IDP_New(IDP_GROUP, &val, name);
len = PyMapping_Length(ob);
- for (i=0; i<len; i++) {
+ for (i = 0; i < len; i++) {
key = PySequence_GetItem(keys, i);
pval = PySequence_GetItem(vals, i);
if (!PyUnicode_Check(key)) {
@@ -476,7 +468,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
}
else return "invalid property value";
- if (group->type==IDP_IDPARRAY) {
+ if (group->type == IDP_IDPARRAY) {
IDP_AppendArray(group, prop);
// IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory
MEM_freeN(prop);
@@ -518,7 +510,7 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
err = BPy_IDProperty_Map_ValidateAndCreate(key, prop, val);
if (err) {
- PyErr_SetString(PyExc_KeyError, err );
+ PyErr_SetString(PyExc_KeyError, err);
return -1;
}
@@ -538,107 +530,107 @@ static PyObject *BPy_IDGroup_iter(BPy_IDProperty *self)
iter->mode = IDPROP_ITER_KEYS;
iter->cur = self->prop->data.group.first;
Py_XINCREF(iter);
- return (PyObject*) iter;
+ return (PyObject*)iter;
}
/* for simple, non nested types this is the same as BPy_IDGroup_WrapData */
static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
{
switch (prop->type) {
- case IDP_STRING:
- return idprop_py_from_idp_string(prop);
- case IDP_INT:
- return idprop_py_from_idp_int(prop);
- case IDP_FLOAT:
- return idprop_py_from_idp_float(prop);
- case IDP_DOUBLE:
- return idprop_py_from_idp_double(prop);
- case IDP_ARRAY:
- {
- PyObject *seq = PyList_New(prop->len);
- int i;
-
- if (!seq) {
- PyErr_Format(PyExc_RuntimeError,
- "%s: IDP_ARRAY: PyList_New(%d) failed",
- __func__, prop->len);
- return NULL;
- }
-
- switch (prop->subtype) {
+ case IDP_STRING:
+ return idprop_py_from_idp_string(prop);
+ case IDP_INT:
+ return idprop_py_from_idp_int(prop);
case IDP_FLOAT:
- {
- float *array= (float*)IDP_Array(prop);
- for (i=0; i<prop->len; i++) {
- PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
- }
- break;
- }
+ return idprop_py_from_idp_float(prop);
case IDP_DOUBLE:
+ return idprop_py_from_idp_double(prop);
+ case IDP_ARRAY:
{
- double *array= (double*)IDP_Array(prop);
- for (i=0; i<prop->len; i++) {
- PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
- }
- break;
- }
- case IDP_INT:
- {
- int *array= (int*)IDP_Array(prop);
- for (i=0; i<prop->len; i++) {
- PyList_SET_ITEM(seq, i, PyLong_FromLong(array[i]));
+ PyObject *seq = PyList_New(prop->len);
+ int i;
+
+ if (!seq) {
+ PyErr_Format(PyExc_RuntimeError,
+ "%s: IDP_ARRAY: PyList_New(%d) failed",
+ __func__, prop->len);
+ return NULL;
}
- break;
- }
- default:
- PyErr_Format(PyExc_RuntimeError,
- "%s: invalid/corrupt array type '%d'!",
- __func__, prop->subtype);
- Py_DECREF(seq);
- return NULL;
- }
- return seq;
- }
- case IDP_IDPARRAY:
- {
- PyObject *seq = PyList_New(prop->len), *wrap;
- IDProperty *array= IDP_IDPArray(prop);
- int i;
+ switch (prop->subtype) {
+ case IDP_FLOAT:
+ {
+ float *array = (float *)IDP_Array(prop);
+ for (i = 0; i < prop->len; i++) {
+ PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
+ }
+ break;
+ }
+ case IDP_DOUBLE:
+ {
+ double *array = (double *)IDP_Array(prop);
+ for (i = 0; i < prop->len; i++) {
+ PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
+ }
+ break;
+ }
+ case IDP_INT:
+ {
+ int *array = (int *)IDP_Array(prop);
+ for (i = 0; i < prop->len; i++) {
+ PyList_SET_ITEM(seq, i, PyLong_FromLong(array[i]));
+ }
+ break;
+ }
+ default:
+ PyErr_Format(PyExc_RuntimeError,
+ "%s: invalid/corrupt array type '%d'!",
+ __func__, prop->subtype);
+ Py_DECREF(seq);
+ return NULL;
+ }
- if (!seq) {
- PyErr_Format(PyExc_RuntimeError,
- "%s: IDP_IDPARRAY: PyList_New(%d) failed",
- __func__, prop->len);
- return NULL;
+ return seq;
}
+ case IDP_IDPARRAY:
+ {
+ PyObject *seq = PyList_New(prop->len), *wrap;
+ IDProperty *array = IDP_IDPArray(prop);
+ int i;
+
+ if (!seq) {
+ PyErr_Format(PyExc_RuntimeError,
+ "%s: IDP_IDPARRAY: PyList_New(%d) failed",
+ __func__, prop->len);
+ return NULL;
+ }
- for (i=0; i<prop->len; i++) {
- wrap= BPy_IDGroup_MapDataToPy(array++);
+ for (i = 0; i < prop->len; i++) {
+ wrap = BPy_IDGroup_MapDataToPy(array++);
- if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
- return NULL;
+ if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
+ return NULL;
- PyList_SET_ITEM(seq, i, wrap);
+ PyList_SET_ITEM(seq, i, wrap);
+ }
+ return seq;
}
- return seq;
- }
- case IDP_GROUP:
- {
- PyObject *dict = PyDict_New(), *wrap;
- IDProperty *loop;
+ case IDP_GROUP:
+ {
+ PyObject *dict = PyDict_New(), *wrap;
+ IDProperty *loop;
- for (loop=prop->data.group.first; loop; loop=loop->next) {
- wrap = BPy_IDGroup_MapDataToPy(loop);
+ for (loop = prop->data.group.first; loop; loop = loop->next) {
+ wrap = BPy_IDGroup_MapDataToPy(loop);
- if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
- return NULL;
+ if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
+ return NULL;
- PyDict_SetItemString(dict, loop->name, wrap);
- Py_DECREF(wrap);
+ PyDict_SetItemString(dict, loop->name, wrap);
+ Py_DECREF(wrap);
+ }
+ return dict;
}
- return dict;
- }
}
PyErr_Format(PyExc_RuntimeError,
@@ -660,7 +652,7 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
return NULL;
}
- idprop= IDP_GetPropertyFromGroup(self->prop, name);
+ idprop = IDP_GetPropertyFromGroup(self->prop, name);
if (idprop) {
pyform = BPy_IDGroup_MapDataToPy(idprop);
@@ -687,7 +679,7 @@ static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
iter->mode = IDPROP_ITER_ITEMS;
iter->cur = self->prop->data.group.first;
Py_XINCREF(iter);
- return (PyObject*) iter;
+ return (PyObject*)iter;
}
/* utility function */
@@ -698,7 +690,7 @@ static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len,
printf("%s: ID Property Error found and corrected!\n", func);
/*fill rest of list with valid references to None*/
- for (j=len; j<prop->len; j++) {
+ for (j = len; j < prop->len; j++) {
Py_INCREF(Py_None);
PyList_SET_ITEM(seq, j, Py_None);
}
@@ -713,11 +705,13 @@ PyObject *BPy_Wrap_GetKeys(IDProperty *prop)
IDProperty *loop;
int i;
- for (i=0, loop=prop->data.group.first; loop && (i < prop->len); loop=loop->next, i++)
+ for (i = 0, loop = prop->data.group.first; loop && (i < prop->len); loop = loop->next, i++)
PyList_SET_ITEM(list, i, PyUnicode_FromString(loop->name));
/* if the id prop is corrupt, count the remaining */
- for (; loop; loop=loop->next, i++) {}
+ for ( ; loop; loop = loop->next, i++) {
+ /* pass */
+ }
if (i != prop->len) { /* if the loop didnt finish, we know the length is wrong */
BPy_IDGroup_CorrectListLen(prop, list, i, __func__);
@@ -735,7 +729,7 @@ PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop)
IDProperty *loop;
int i;
- for (i=0, loop=prop->data.group.first; loop; loop=loop->next, i++) {
+ for (i = 0, loop = prop->data.group.first; loop; loop = loop->next, i++) {
PyList_SET_ITEM(list, i, BPy_IDGroup_WrapData(id, loop, prop));
}
@@ -755,8 +749,8 @@ PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop)
IDProperty *loop;
int i;
- for (i=0, loop=prop->data.group.first; loop; loop=loop->next, i++) {
- PyObject *item= PyTuple_New(2);
+ for (i = 0, loop = prop->data.group.first; loop; loop = loop->next, i++) {
+ PyObject *item = PyTuple_New(2);
PyTuple_SET_ITEM(item, 0, PyUnicode_FromString(loop->name));
PyTuple_SET_ITEM(item, 1, BPy_IDGroup_WrapData(id, loop, prop));
PyList_SET_ITEM(seq, i, item);
@@ -805,7 +799,7 @@ static int BPy_IDGroup_Contains(BPy_IDProperty *self, PyObject *value)
static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *value)
{
PyObject *pkey, *pval;
- Py_ssize_t i=0;
+ Py_ssize_t i = 0;
if (!PyDict_Check(value)) {
PyErr_Format(PyExc_TypeError,
@@ -829,18 +823,18 @@ static PyObject *BPy_IDGroup_to_dict(BPy_IDProperty *self)
/* Matches python dict.get(key, [default]) */
-static PyObject* BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args)
+static PyObject *BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args)
{
IDProperty *idprop;
char *key;
- PyObject* def = Py_None;
+ PyObject *def = Py_None;
if (!PyArg_ParseTuple(args, "s|O:get", &key, &def))
return NULL;
- idprop= IDP_GetPropertyFromGroup(self->prop, key);
+ idprop = IDP_GetPropertyFromGroup(self->prop, key);
if (idprop) {
- PyObject* pyobj = BPy_IDGroup_WrapData(self->id, idprop, self->prop);
+ PyObject *pyobj = BPy_IDGroup_WrapData(self->id, idprop, self->prop);
if (pyobj)
return pyobj;
}
@@ -955,17 +949,17 @@ static PyTypeObject *idp_array_py_type(BPy_IDArray *self, short *is_double)
{
switch (self->prop->subtype) {
case IDP_FLOAT:
- *is_double= 0;
+ *is_double = 0;
return &PyFloat_Type;
case IDP_DOUBLE:
- *is_double= 1;
+ *is_double = 1;
return &PyFloat_Type;
case IDP_INT:
- *is_double= 0;
+ *is_double = 0;
return &PyLong_Type;
}
- *is_double= 0;
+ *is_double = 0;
return NULL;
}
@@ -977,12 +971,9 @@ static PyObject *BPy_IDArray_repr(BPy_IDArray *self)
static PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
{
switch (self->prop->subtype) {
- case IDP_FLOAT:
- return PyUnicode_FromString("f");
- case IDP_DOUBLE:
- return PyUnicode_FromString("d");
- case IDP_INT:
- return PyUnicode_FromString("i");
+ case IDP_FLOAT: return PyUnicode_FromString("f");
+ case IDP_DOUBLE: return PyUnicode_FromString("d");
+ case IDP_INT: return PyUnicode_FromString("i");
}
PyErr_Format(PyExc_RuntimeError,
@@ -1023,11 +1014,11 @@ static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
switch (self->prop->subtype) {
case IDP_FLOAT:
- return PyFloat_FromDouble(((float*)IDP_Array(self->prop))[index]);
+ return PyFloat_FromDouble(((float *)IDP_Array(self->prop))[index]);
case IDP_DOUBLE:
- return PyFloat_FromDouble(((double*)IDP_Array(self->prop))[index]);
+ return PyFloat_FromDouble(((double *)IDP_Array(self->prop))[index]);
case IDP_INT:
- return PyLong_FromLong((long)((int*)IDP_Array(self->prop))[index]);
+ return PyLong_FromLong((long)((int *)IDP_Array(self->prop))[index]);
}
PyErr_Format(PyExc_RuntimeError,
@@ -1050,29 +1041,29 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
switch (self->prop->subtype) {
case IDP_FLOAT:
- f= (float)PyFloat_AsDouble(value);
- if (f==-1 && PyErr_Occurred()) {
+ f = (float)PyFloat_AsDouble(value);
+ if (f == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected a float");
return -1;
}
- ((float*)IDP_Array(self->prop))[index] = f;
+ ((float *)IDP_Array(self->prop))[index] = f;
break;
case IDP_DOUBLE:
- d= PyFloat_AsDouble(value);
- if (d==-1 && PyErr_Occurred()) {
+ d = PyFloat_AsDouble(value);
+ if (d == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected a float");
return -1;
}
- ((double*)IDP_Array(self->prop))[index] = d;
+ ((double *)IDP_Array(self->prop))[index] = d;
break;
case IDP_INT:
- i= PyLong_AsSsize_t(value);
- if (i==-1 && PyErr_Occurred()) {
+ i = PyLong_AsSsize_t(value);
+ if (i == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected an int type");
return -1;
}
- ((int*)IDP_Array(self->prop))[index] = i;
+ ((int *)IDP_Array(self->prop))[index] = i;
break;
}
return 0;
@@ -1097,21 +1088,21 @@ static PySequenceMethods BPy_IDArray_Seq = {
/* sequence slice (get): idparr[a:b] */
static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
{
- IDProperty *prop= self->prop;
+ IDProperty *prop = self->prop;
PyObject *tuple;
int count;
CLAMP(begin, 0, prop->len);
- if (end<0) end= prop->len+end+1;
+ if (end < 0) end = prop->len + end + 1;
CLAMP(end, 0, prop->len);
- begin= MIN2(begin, end);
+ begin = MIN2(begin, end);
- tuple= PyTuple_New(end - begin);
+ tuple = PyTuple_New(end - begin);
switch (prop->subtype) {
case IDP_FLOAT:
{
- float *array= (float*)IDP_Array(prop);
+ float *array = (float *)IDP_Array(prop);
for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
}
@@ -1119,7 +1110,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
}
case IDP_DOUBLE:
{
- double *array= (double*)IDP_Array(prop);
+ double *array = (double *)IDP_Array(prop);
for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
}
@@ -1127,7 +1118,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
}
case IDP_INT:
{
- int *array= (int*)IDP_Array(prop);
+ int *array = (int *)IDP_Array(prop);
for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyLong_FromLong(array[count]));
}
@@ -1140,10 +1131,10 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
/* sequence slice (set): idparr[a:b] = value */
static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject *seq)
{
- IDProperty *prop= self->prop;
- short is_double= 0;
- const PyTypeObject *py_type= idp_array_py_type(self, &is_double);
- const size_t elem_size= is_double ? sizeof(double) : sizeof(float);
+ IDProperty *prop = self->prop;
+ short is_double = 0;
+ const PyTypeObject *py_type = idp_array_py_type(self, &is_double);
+ const size_t elem_size = is_double ? sizeof(double) : sizeof(float);
size_t alloc_len;
size_t size;
void *vec;
@@ -1153,9 +1144,9 @@ static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject
begin = MIN2(begin, end);
size = (end - begin);
- alloc_len= size * elem_size;
+ alloc_len = size * elem_size;
- vec= MEM_mallocN(alloc_len, "array assignment"); /* NOTE: we count on int/float being the same size here */
+ vec = MEM_mallocN(alloc_len, "array assignment"); /* NOTE: we count on int/float being the same size here */
if (PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) {
MEM_freeN(vec);
return -1;
@@ -1167,7 +1158,7 @@ static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject
return 0;
}
-static PyObject *BPy_IDArray_subscript(BPy_IDArray* self, PyObject* item)
+static PyObject *BPy_IDArray_subscript(BPy_IDArray *self, PyObject *item)
{
if (PyIndex_Check(item)) {
Py_ssize_t i;
@@ -1203,7 +1194,7 @@ static PyObject *BPy_IDArray_subscript(BPy_IDArray* self, PyObject* item)
}
}
-static int BPy_IDArray_ass_subscript(BPy_IDArray* self, PyObject* item, PyObject* value)
+static int BPy_IDArray_ass_subscript(BPy_IDArray *self, PyObject *item, PyObject *value)
{
if (PyIndex_Check(item)) {
Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
@@ -1331,12 +1322,14 @@ static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
{
- IDProperty *cur=NULL;
- PyObject *ret;
if (self->cur) {
+ PyObject *ret;
+ IDProperty *cur;
+
cur = self->cur;
self->cur = self->cur->next;
+
if (self->mode == IDPROP_ITER_ITEMS) {
ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(cur->name));
@@ -1357,7 +1350,7 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
/* For printing, in format "<module>.<name>" */
"Blender IDGroup_Iter", /* char *tp_name; */
- sizeof( BPy_IDGroup_Iter ), /* int tp_basicsize; */
+ sizeof(BPy_IDGroup_Iter), /* int tp_basicsize; */
0, /* tp_itemsize; For allocation */
/* Methods to implement standard operations */
@@ -1367,7 +1360,7 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) IDGroup_Iter_repr, /* reprfunc tp_repr; */
+ (reprfunc) IDGroup_Iter_repr, /* reprfunc tp_repr; */
/* Method suites for standard classes */
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 9e373fc8048..11607ad78b8 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -67,28 +67,28 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
/* for each type */
if (type == &PyFloat_Type) {
if (is_double) {
- double *array_double= array;
- for (i=0; i<length; i++) {
+ double *array_double = array;
+ for (i = 0; i < length; i++) {
array_double[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else {
- float *array_float= array;
- for (i=0; i<length; i++) {
+ float *array_float = array;
+ for (i = 0; i < length; i++) {
array_float[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
}
else if (type == &PyLong_Type) {
/* could use is_double for 'long int' but no use now */
- int *array_int= array;
- for (i=0; i<length; i++) {
+ int *array_int = array;
+ for (i = 0; i < length; i++) {
array_int[i] = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else if (type == &PyBool_Type) {
- int *array_bool= array;
- for (i=0; i<length; i++) {
+ int *array_bool = array;
+ for (i = 0; i < length; i++) {
array_bool[i] = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
}
}
@@ -117,7 +117,7 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
void PyC_ObSpit(const char *name, PyObject *var)
{
fprintf(stderr, "<%s> : ", name);
- if (var==NULL) {
+ if (var == NULL) {
fprintf(stderr, "<NIL>");
}
else {
@@ -156,10 +156,10 @@ void PyC_FileAndNum(const char **filename, int *lineno)
{
PyFrameObject *frame;
- if (filename) *filename= NULL;
+ if (filename) *filename = NULL;
if (lineno) *lineno = -1;
- if (!(frame= PyThreadState_GET()->frame)) {
+ if (!(frame = PyThreadState_GET()->frame)) {
return;
}
@@ -172,16 +172,16 @@ void PyC_FileAndNum(const char **filename, int *lineno)
if (filename && *filename == NULL) {
/* try an alternative method to get the filename - module based
* references below are all borrowed (double checked) */
- PyObject *mod_name= PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
+ PyObject *mod_name = PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
if (mod_name) {
- PyObject *mod= PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
+ PyObject *mod = PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
if (mod) {
- *filename= PyModule_GetFilename(mod);
+ *filename = PyModule_GetFilename(mod);
}
/* unlikely, fallback */
if (*filename == NULL) {
- *filename= _PyUnicode_AsString(mod_name);
+ *filename = _PyUnicode_AsString(mod_name);
}
}
}
@@ -204,13 +204,13 @@ void PyC_FileAndNum_Safe(const char **filename, int *lineno)
PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
{
Py_ssize_t i;
- PyObject *item= o;
+ PyObject *item = o;
char *attr;
va_list vargs;
va_start(vargs, n);
- for (i=0; i<n; i++) {
+ for (i = 0; i < n; i++) {
attr = va_arg(vargs, char *);
item = PyObject_GetAttrString(item, attr);
@@ -238,7 +238,7 @@ PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *for
va_list args;
va_start(args, format);
- error_value_prefix= PyUnicode_FromFormatV(format, args); /* can fail and be NULL */
+ error_value_prefix = PyUnicode_FromFormatV(format, args); /* can fail and be NULL */
va_end(args);
if (PyErr_Occurred()) {
@@ -271,22 +271,22 @@ PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *for
PyObject *PyC_ExceptionBuffer(void)
{
- PyObject *traceback_mod= NULL;
- PyObject *format_tb_func= NULL;
- PyObject *ret= NULL;
+ PyObject *traceback_mod = NULL;
+ PyObject *format_tb_func = NULL;
+ PyObject *ret = NULL;
- if (! (traceback_mod= PyImport_ImportModule("traceback")) ) {
+ if (!(traceback_mod = PyImport_ImportModule("traceback"))) {
goto error_cleanup;
}
- else if (! (format_tb_func= PyObject_GetAttrString(traceback_mod, "format_exc"))) {
+ else if (!(format_tb_func = PyObject_GetAttrString(traceback_mod, "format_exc"))) {
goto error_cleanup;
}
- ret= PyObject_CallObject(format_tb_func, NULL);
+ ret = PyObject_CallObject(format_tb_func, NULL);
if (ret == Py_None) {
Py_DECREF(ret);
- ret= NULL;
+ ret = NULL;
}
error_cleanup:
@@ -303,8 +303,8 @@ PyObject *PyC_ExceptionBuffer(void)
PyObject *stderr_backup = PySys_GetObject("stderr"); /* borrowed */
PyObject *string_io = NULL;
PyObject *string_io_buf = NULL;
- PyObject *string_io_mod= NULL;
- PyObject *string_io_getvalue= NULL;
+ PyObject *string_io_mod = NULL;
+ PyObject *string_io_getvalue = NULL;
PyObject *error_type, *error_value, *error_traceback;
@@ -319,17 +319,17 @@ PyObject *PyC_ExceptionBuffer(void)
* string_io = io.StringIO()
*/
- if (! (string_io_mod= PyImport_ImportModule("io")) ) {
+ if (!(string_io_mod = PyImport_ImportModule("io"))) {
goto error_cleanup;
}
- else if (! (string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) {
+ else if (!(string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) {
goto error_cleanup;
}
- else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) {
+ else if (!(string_io_getvalue = PyObject_GetAttrString(string_io, "getvalue"))) {
goto error_cleanup;
}
- Py_INCREF(stdout_backup); // since these were borrowed we dont want them freed when replaced.
+ Py_INCREF(stdout_backup); // since these were borrowed we don't want them freed when replaced.
Py_INCREF(stderr_backup);
PySys_SetObject("stdout", string_io); // both of these are freed when restoring
@@ -374,7 +374,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
{
const char *result;
- result= _PyUnicode_AsString(py_str);
+ result = _PyUnicode_AsString(py_str);
if (result) {
/* 99% of the time this is enough but we better support non unicode
@@ -387,7 +387,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
if (PyBytes_Check(py_str)) {
return PyBytes_AS_STRING(py_str);
}
- else if ((*coerce= PyUnicode_EncodeFSDefault(py_str))) {
+ else if ((*coerce = PyUnicode_EncodeFSDefault(py_str))) {
return PyBytes_AS_STRING(*coerce);
}
else {
@@ -399,7 +399,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size)
{
- PyObject *result= PyUnicode_FromStringAndSize(str, size);
+ PyObject *result = PyUnicode_FromStringAndSize(str, size);
if (result) {
/* 99% of the time this is enough but we better support non unicode
* chars since blender doesnt limit this */
@@ -408,7 +408,7 @@ PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size)
else {
PyErr_Clear();
/* this means paths will always be accessible once converted, on all OS's */
- result= PyUnicode_DecodeFSDefaultAndSize(str, size);
+ result = PyUnicode_DecodeFSDefaultAndSize(str, size);
return result;
}
}
@@ -432,13 +432,15 @@ PyObject *PyC_UnicodeFromByte(const char *str)
****************************************************************************/
PyObject *PyC_DefaultNameSpace(const char *filename)
{
- PyInterpreterState *interp= PyThreadState_GET()->interp;
- PyObject *mod_main= PyModule_New("__main__");
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
+ PyObject *mod_main = PyModule_New("__main__");
PyDict_SetItemString(interp->modules, "__main__", mod_main);
Py_DECREF(mod_main); /* sys.modules owns now */
PyModule_AddStringConstant(mod_main, "__name__", "__main__");
- if (filename)
- PyModule_AddStringConstant(mod_main, "__file__", filename); /* __file__ only for nice UI'ness */
+ if (filename) {
+ /* __file__ mainly for nice UI'ness */
+ PyModule_AddObject(mod_main, "__file__", PyUnicode_DecodeFSDefault(filename));
+ }
PyModule_AddObject(mod_main, "__builtins__", interp->builtins);
Py_INCREF(interp->builtins); /* AddObject steals a reference */
return PyModule_GetDict(mod_main);
@@ -447,14 +449,14 @@ PyObject *PyC_DefaultNameSpace(const char *filename)
/* restore MUST be called after this */
void PyC_MainModule_Backup(PyObject **main_mod)
{
- PyInterpreterState *interp= PyThreadState_GET()->interp;
- *main_mod= PyDict_GetItemString(interp->modules, "__main__");
- Py_XINCREF(*main_mod); /* dont free */
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
+ *main_mod = PyDict_GetItemString(interp->modules, "__main__");
+ Py_XINCREF(*main_mod); /* don't free */
}
void PyC_MainModule_Restore(PyObject *main_mod)
{
- PyInterpreterState *interp= PyThreadState_GET()->interp;
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
PyDict_SetItemString(interp->modules, "__main__", main_mod);
Py_XDECREF(main_mod);
}
@@ -462,7 +464,7 @@ void PyC_MainModule_Restore(PyObject *main_mod)
/* must be called before Py_Initialize, expects output of BLI_get_folder(BLENDER_PYTHON, NULL) */
void PyC_SetHomePath(const char *py_path_bundle)
{
- if (py_path_bundle==NULL) {
+ if (py_path_bundle == NULL) {
/* Common enough to have bundled *nix python but complain on OSX/Win */
#if defined(__APPLE__) || defined(_WIN32)
fprintf(stderr, "Warning! bundled python not found and is expected on this platform. "
@@ -506,34 +508,34 @@ void PyC_SetHomePath(const char *py_path_bundle)
/* Would be nice if python had this built in */
void PyC_RunQuicky(const char *filepath, int n, ...)
{
- FILE *fp= fopen(filepath, "r");
+ FILE *fp = fopen(filepath, "r");
if (fp) {
- PyGILState_STATE gilstate= PyGILState_Ensure();
+ PyGILState_STATE gilstate = PyGILState_Ensure();
va_list vargs;
- int *sizes= PyMem_MALLOC(sizeof(int) * (n / 2));
+ int *sizes = PyMem_MALLOC(sizeof(int) * (n / 2));
int i;
PyObject *py_dict = PyC_DefaultNameSpace(filepath);
- PyObject *values= PyList_New(n / 2); /* namespace owns this, dont free */
+ PyObject *values = PyList_New(n / 2); /* namespace owns this, don't free */
PyObject *py_result, *ret;
- PyObject *struct_mod= PyImport_ImportModule("struct");
- PyObject *calcsize= PyObject_GetAttrString(struct_mod, "calcsize"); /* struct.calcsize */
- PyObject *pack= PyObject_GetAttrString(struct_mod, "pack"); /* struct.pack */
- PyObject *unpack= PyObject_GetAttrString(struct_mod, "unpack"); /* struct.unpack */
+ PyObject *struct_mod = PyImport_ImportModule("struct");
+ PyObject *calcsize = PyObject_GetAttrString(struct_mod, "calcsize"); /* struct.calcsize */
+ PyObject *pack = PyObject_GetAttrString(struct_mod, "pack"); /* struct.pack */
+ PyObject *unpack = PyObject_GetAttrString(struct_mod, "unpack"); /* struct.unpack */
Py_DECREF(struct_mod);
va_start(vargs, n);
- for (i=0; i * 2<n; i++) {
+ for (i = 0; i * 2 < n; i++) {
char *format = va_arg(vargs, char *);
void *ptr = va_arg(vargs, void *);
- ret= PyObject_CallFunction(calcsize, (char *)"s", format);
+ ret = PyObject_CallFunction(calcsize, (char *)"s", format);
if (ret) {
sizes[i]= PyLong_AsSsize_t(ret);
@@ -554,7 +556,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
else {
if (PyTuple_GET_SIZE(ret) == 1) {
/* convenience, convert single tuples into single values */
- PyObject *tmp= PyTuple_GET_ITEM(ret, 0);
+ PyObject *tmp = PyTuple_GET_ITEM(ret, 0);
Py_INCREF(tmp);
Py_DECREF(ret);
ret = tmp;
@@ -576,29 +578,29 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
/* we could skip this but then only slice assignment would work
* better not be so strict */
- values= PyDict_GetItemString(py_dict, "values");
+ values = PyDict_GetItemString(py_dict, "values");
if (values && PyList_Check(values)) {
- /* dont use the result */
+ /* don't use the result */
Py_DECREF(py_result);
- py_result= NULL;
+ py_result = NULL;
/* now get the values back */
va_start(vargs, n);
- for (i=0; i*2 <n; i++) {
+ for (i = 0; i * 2 < n; i++) {
char *format = va_arg(vargs, char *);
void *ptr = va_arg(vargs, void *);
PyObject *item;
PyObject *item_new;
/* prepend the string formatting and remake the tuple */
- item= PyList_GET_ITEM(values, i);
+ item = PyList_GET_ITEM(values, i);
if (PyTuple_CheckExact(item)) {
- int ofs= PyTuple_GET_SIZE(item);
- item_new= PyTuple_New(ofs + 1);
+ int ofs = PyTuple_GET_SIZE(item);
+ item_new = PyTuple_New(ofs + 1);
while (ofs--) {
- PyObject *member= PyTuple_GET_ITEM(item, ofs);
+ PyObject *member = PyTuple_GET_ITEM(item, ofs);
PyTuple_SET_ITEM(item_new, ofs + 1, member);
Py_INCREF(member);
}
@@ -606,7 +608,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
PyTuple_SET_ITEM(item_new, 0, PyUnicode_FromString(format));
}
else {
- item_new= Py_BuildValue("sO", format, item);
+ item_new = Py_BuildValue("sO", format, item);
}
ret = PyObject_Call(pack, item_new, NULL);
@@ -650,8 +652,8 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
/* generic function to avoid depending on RNA */
void *PyC_RNA_AsPointer(PyObject *value, const char *type_name)
{
- PyObject* as_pointer;
- PyObject* pointer;
+ PyObject *as_pointer;
+ PyObject *pointer;
if (!strcmp(Py_TYPE(value)->tp_name, type_name) &&
(as_pointer = PyObject_GetAttrString(value, "as_pointer")) != NULL &&
@@ -705,8 +707,8 @@ char *PyC_FlagSet_AsString(PyC_FlagSet *item)
int PyC_FlagSet_ValueFromID_int(PyC_FlagSet *item, const char *identifier, int *value)
{
- for( ; item->identifier; item++) {
- if(strcmp(item->identifier, identifier) == 0) {
+ for ( ; item->identifier; item++) {
+ if (strcmp(item->identifier, identifier) == 0) {
*value = item->value;
return 1;
}
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 8a74153646c..e07ac93b098 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -73,12 +73,17 @@ PyDoc_STRVAR(bpy_script_paths_doc,
static PyObject *bpy_script_paths(PyObject *UNUSED(self))
{
PyObject *ret = PyTuple_New(2);
+ PyObject *item;
char *path;
path = BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL);
- PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
+ item = PyUnicode_DecodeFSDefault(path ? path : "");
+ BLI_assert(item != NULL);
+ PyTuple_SET_ITEM(ret, 0, item);
path = BLI_get_folder(BLENDER_USER_SCRIPTS, NULL);
- PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:""));
+ item = PyUnicode_DecodeFSDefault(path ? path : "");
+ BLI_assert(item != NULL);
+ PyTuple_SET_ITEM(ret, 1, item);
return ret;
}
@@ -202,7 +207,7 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj
path = BLI_get_folder_version(folder_id, (major * 100) + minor, FALSE);
- return PyUnicode_DecodeFSDefault(path);
+ return PyUnicode_DecodeFSDefault(path ? path : "");
}
static PyMethodDef meth_bpy_script_paths =
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index f4962cd39b6..2974e3cf3cb 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -47,6 +47,8 @@ static PyStructSequence_Field app_cb_info_fields[] = {
{(char *)"render_pre", (char *)"Callback list - on render (before)"},
{(char *)"render_post", (char *)"Callback list - on render (after)"},
{(char *)"render_stats", (char *)"Callback list - on printing render statistics"},
+ {(char *)"render_complete", (char *)"Callback list - on completion of render job"},
+ {(char *)"render_cancel", (char *)"Callback list - on cancelling a render job"},
{(char *)"load_pre", (char *)"Callback list - on loading a new blend file (before)"},
{(char *)"load_post", (char *)"Callback list - on loading a new blend file (after)"},
{(char *)"save_pre", (char *)"Callback list - on saving a blend file (before)"},
@@ -254,10 +256,10 @@ void BPY_app_handlers_reset(const short do_all)
for (i = PyList_GET_SIZE(ls) - 1; i >= 0; i--) {
- if ( (PyFunction_Check((item = PyList_GET_ITEM(ls, i)))) &&
- (dict_ptr = _PyObject_GetDictPtr(item)) &&
- (*dict_ptr) &&
- (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
+ if ((PyFunction_Check((item = PyList_GET_ITEM(ls, i)))) &&
+ (dict_ptr = _PyObject_GetDictPtr(item)) &&
+ (*dict_ptr) &&
+ (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
{
/* keep */
}
@@ -277,13 +279,12 @@ void BPY_app_handlers_reset(const short do_all)
void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *arg)
{
PyObject *cb_list = py_cb_array[GET_INT_FROM_POINTER(arg)];
- Py_ssize_t cb_list_len;
- if ((cb_list_len = PyList_GET_SIZE(cb_list)) > 0) {
+ if (PyList_GET_SIZE(cb_list) > 0) {
PyGILState_STATE gilstate = PyGILState_Ensure();
- PyObject* args = PyTuple_New(1); // save python creating each call
- PyObject* func;
- PyObject* ret;
+ PyObject *args = PyTuple_New(1); // save python creating each call
+ PyObject *func;
+ PyObject *ret;
Py_ssize_t pos;
/* setup arguments */
@@ -297,8 +298,9 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
Py_INCREF(Py_None);
}
- // Iterate the list and run the callbacks
- for (pos = 0; pos < cb_list_len; pos++) {
+ /* Iterate the list and run the callbacks
+ * note: don't store the list size since the scripts may remove themselves */
+ for (pos = 0; pos < PyList_GET_SIZE(cb_list); pos++) {
func = PyList_GET_ITEM(cb_list, pos);
ret = PyObject_Call(func, args, NULL);
if (ret == NULL) {
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index 95b00b18f43..e2acef7bb73 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -70,7 +70,7 @@ int bpy_pydriver_create_dict(void)
mod = PyImport_ImportModule("math");
if (mod) {
- PyDict_Merge(d, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */
+ PyDict_Merge(d, PyModule_GetDict(mod), 0); /* 0 - don't overwrite existing values */
Py_DECREF(mod);
}
@@ -159,14 +159,14 @@ static void pydriver_error(ChannelDriver *driver)
/* This evals py driver expressions, 'expr' is a Python expression that
* should evaluate to a float number, which is returned.
*
- * (old)note: PyGILState_Ensure() isnt always called because python can call
+ * (old)note: PyGILState_Ensure() isn't always called because python can call
* the bake operator which intern starts a thread which calls scene update
* which does a driver update. to avoid a deadlock check PYC_INTERPRETER_ACTIVE
* if PyGILState_Ensure() is needed - see [#27683]
*
* (new)note: checking if python is running is not threadsafe [#28114]
* now release the GIL on python operator execution instead, using
- * PyEval_SaveThread() / PyEval_RestoreThread() so we dont lock up blender.
+ * PyEval_SaveThread() / PyEval_RestoreThread() so we don't lock up blender.
*/
float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
{
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 1ef9c0d3214..f3d21c74080 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -52,6 +52,7 @@
#include "DNA_text_types.h"
#include "BLI_path_util.h"
+#include "BLI_fileops.h"
#include "BLI_math_base.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
@@ -96,7 +97,7 @@ void bpy_context_update(bContext *C)
{
BPy_SetContext(C);
bpy_import_main_set(CTX_data_main(C));
- BPY_modules_update(C); /* can give really bad results if this isnt here */
+ BPY_modules_update(C); /* can give really bad results if this isn't here */
}
void bpy_context_set(bContext *C, PyGILState_STATE *gilstate)
@@ -238,7 +239,7 @@ void BPY_python_start(int argc, const char **argv)
Py_Initialize();
// PySys_SetArgv(argc, argv); // broken in py3, not a huge deal
- /* sigh, why do python guys not have a char** version anymore? :( */
+ /* sigh, why do python guys not have a (char **) version anymore? */
{
int i;
PyObject *py_argv = PyList_New(argc);
@@ -388,7 +389,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
}
else {
- FILE *fp = fopen(fn, "r");
+ FILE *fp = BLI_fopen(fn, "r");
if (fp) {
py_dict = PyC_DefaultNameSpace(fn);
@@ -497,7 +498,7 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
mod = PyImport_ImportModule("math");
if (mod) {
- PyDict_Merge(py_dict, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */
+ PyDict_Merge(py_dict, PyModule_GetDict(mod), 0); /* 0 - don't overwrite existing values */
Py_DECREF(mod);
}
else { /* highly unlikely but possibly */
@@ -705,7 +706,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
#ifdef WITH_PYTHON_MODULE
#include "BLI_fileops.h"
-/* TODO, reloading the module isnt functional at the moment. */
+/* TODO, reloading the module isn't functional at the moment. */
static void bpy_module_free(void *mod);
extern int main_python_enter(int argc, const char **argv);
@@ -782,7 +783,7 @@ PyInit_bpy(void)
* we may end up having to rename this module so there is no naming conflict here eg:
* 'from blender import bpy'
*
- * 3) we dont know the filename at this point, workaround by assigning a dummy value
+ * 3) we don't know the filename at this point, workaround by assigning a dummy value
* which calls back when its freed so the real loading can take place.
*/
diff --git a/source/blender/python/intern/bpy_interface_atexit.c b/source/blender/python/intern/bpy_interface_atexit.c
index 536cb7785e4..db97d361c73 100644
--- a/source/blender/python/intern/bpy_interface_atexit.c
+++ b/source/blender/python/intern/bpy_interface_atexit.c
@@ -62,7 +62,7 @@ static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg)
PyObject *ret;
PyTuple_SET_ITEM(args, 0, atexit_func_arg);
- Py_INCREF(atexit_func_arg); /* only incref so we dont dec'ref along with 'args' */
+ Py_INCREF(atexit_func_arg); /* only incref so we don't dec'ref along with 'args' */
ret = PyObject_CallObject(atexit_func, args);
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index ed3b758a6b4..9148ccde9a0 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -62,7 +62,7 @@
#endif
typedef struct {
- PyObject_HEAD /* required python macro */
+ PyObject_HEAD /* required python macro */
/* collection iterator specific parts */
char relpath[FILE_MAX];
char abspath[FILE_MAX]; /* absolute path */
@@ -186,7 +186,7 @@ static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *
{
static const char *kwlist[] = {"filepath", "link", "relative", NULL};
BPy_Library *ret;
- const char* filename = NULL;
+ const char *filename = NULL;
int is_rel = 0, is_link = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ii:load", (char **)kwlist, &filename, &is_link, &is_rel))
@@ -199,8 +199,8 @@ static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *
BLI_path_abs(ret->abspath, G.main->name);
ret->blo_handle = NULL;
- ret->flag= (is_link ? FILE_LINK : 0) |
- (is_rel ? FILE_RELPATH : 0);
+ ret->flag = ((is_link ? FILE_LINK : 0) |
+ (is_rel ? FILE_RELPATH : 0));
ret->dict = PyDict_New();
@@ -431,7 +431,7 @@ int bpy_lib_init(PyObject *mod_par)
PyModule_AddObject(mod_par, "_library_load", PyCFunction_New(&load_meth, NULL));
- /* some compilers dont like accessing this directly, delay assignment */
+ /* some compilers don't like accessing this directly, delay assignment */
bpy_lib_Type.tp_getattro = PyObject_GenericGetAttr;
if (PyType_Ready(&bpy_lib_Type) < 0)
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 140e2f3ad7c..14058c96633 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -225,7 +225,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
ReportList *reports;
reports = MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
- BKE_reports_init(reports, RPT_STORE | RPT_OP_HOLD); /* own so these dont move into global reports */
+ BKE_reports_init(reports, RPT_STORE | RPT_OP_HOLD); /* own so these don't move into global reports */
#ifdef BPY_RELEASE_GIL
/* release GIL, since a thread could be started from an operator
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index ac832611ded..ae818eb2491 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -155,10 +155,10 @@ static void printf_func_error(PyObject *py_func)
/* use py style error */
fprintf(stderr, "File \"%s\", line %d, in %s\n",
- _PyUnicode_AsString(f_code->co_filename),
- f_code->co_firstlineno,
- _PyUnicode_AsString(((PyFunctionObject *)py_func)->func_name)
- );
+ _PyUnicode_AsString(f_code->co_filename),
+ f_code->co_firstlineno,
+ _PyUnicode_AsString(((PyFunctionObject *)py_func)->func_name)
+ );
}
/* operators and classes use this so it can store the args given but defer
@@ -372,7 +372,7 @@ static int bpy_struct_id_used(StructRNA *srna, char *identifier)
/* Function that sets RNA, NOTE - self is NULL when called from python,
* but being abused from C so we can pass the srna along.
- * This isnt incorrect since its a python object - but be careful */
+ * This isn't incorrect since its a python object - but be careful */
PyDoc_STRVAR(BPy_BoolProperty_doc,
".. function:: BoolProperty(name=\"\", "
"description=\"\", "
@@ -1033,14 +1033,14 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
item = PySequence_Fast_GET_ITEM(seq_fast, i);
- if ( (PyTuple_CheckExact(item)) &&
- (item_size = PyTuple_GET_SIZE(item)) &&
- (item_size == 3 || item_size == 4) &&
- (tmp.identifier = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
- (tmp.name = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
- (tmp.description = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
- /* TODO, number isnt ensured to be unique from the script author */
- (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1))
+ if ((PyTuple_CheckExact(item)) &&
+ (item_size = PyTuple_GET_SIZE(item)) &&
+ (item_size == 3 || item_size == 4) &&
+ (tmp.identifier = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
+ (tmp.name = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
+ (tmp.description = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
+ /* TODO, number isn't ensured to be unique from the script author */
+ (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1))
{
if (is_enum_flag) {
if (item_size < 4) {
@@ -1260,7 +1260,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
}
/* items can be a list or a callable */
- if (PyFunction_Check(items)) { /* dont use PyCallable_Check because we need the function code for errors */
+ if (PyFunction_Check(items)) { /* don't use PyCallable_Check because we need the function code for errors */
PyCodeObject *f_code = (PyCodeObject *)PyFunction_GET_CODE(items);
if (f_code->co_argcount != 2) {
PyErr_Format(PyExc_ValueError,
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index b543f426751..d66b7f98796 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -85,7 +85,7 @@
#define USE_MATHUTILS
#define USE_STRING_COERCE
-static PyObject* pyrna_struct_Subtype(PointerRNA *ptr);
+static PyObject *pyrna_struct_Subtype(PointerRNA *ptr);
static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self);
#define BPY_DOC_ID_PROP_TYPE_NOTE \
@@ -372,7 +372,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback);
/* bpyrna vector/euler/quat callbacks */
-static int mathutils_rna_array_cb_index = -1; /* index for our callbacks */
+static unsigned char mathutils_rna_array_cb_index = -1; /* index for our callbacks */
/* subtype not used much yet */
#define MATHUTILS_CB_SUBTYPE_EUL 0
@@ -517,7 +517,7 @@ static Mathutils_Callback mathutils_rna_array_cb = {
/* bpyrna matrix callbacks */
-static int mathutils_rna_matrix_cb_index = -1; /* index for our callbacks */
+static unsigned char mathutils_rna_matrix_cb_index = -1; /* index for our callbacks */
static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
{
@@ -756,15 +756,15 @@ int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int
static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
{
- return ( (a->ptr.data == b->ptr.data) &&
- (a->ptr.type == b->ptr.type)) ? 0 : -1;
+ return (((a->ptr.data == b->ptr.data) &&
+ (a->ptr.type == b->ptr.type)) ? 0 : -1);
}
static int pyrna_prop_compare(BPy_PropertyRNA *a, BPy_PropertyRNA *b)
{
- return ( (a->prop == b->prop) &&
+ return (((a->prop == b->prop) &&
(a->ptr.data == b->ptr.data) &&
- (a->ptr.type == b->ptr.type) ) ? 0 : -1;
+ (a->ptr.type == b->ptr.type)) ? 0 : -1);
}
static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
@@ -776,21 +776,21 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
ok = pyrna_struct_compare((BPy_StructRNA *)a, (BPy_StructRNA *)b);
switch (op) {
- case Py_NE:
- ok = !ok; /* pass through */
- case Py_EQ:
- res = ok ? Py_False : Py_True;
- break;
+ case Py_NE:
+ ok = !ok; /* pass through */
+ case Py_EQ:
+ res = ok ? Py_False : Py_True;
+ break;
- case Py_LT:
- case Py_LE:
- case Py_GT:
- case Py_GE:
- res = Py_NotImplemented;
- break;
- default:
- PyErr_BadArgument();
- return NULL;
+ case Py_LT:
+ case Py_LE:
+ case Py_GT:
+ case Py_GE:
+ res = Py_NotImplemented;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
}
return Py_INCREF(res), res;
@@ -805,21 +805,21 @@ static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
ok = pyrna_prop_compare((BPy_PropertyRNA *)a, (BPy_PropertyRNA *)b);
switch (op) {
- case Py_NE:
- ok = !ok; /* pass through */
- case Py_EQ:
- res = ok ? Py_False : Py_True;
- break;
+ case Py_NE:
+ ok = !ok; /* pass through */
+ case Py_EQ:
+ res = ok ? Py_False : Py_True;
+ break;
- case Py_LT:
- case Py_LE:
- case Py_GT:
- case Py_GE:
- res = Py_NotImplemented;
- break;
- default:
- PyErr_BadArgument();
- return NULL;
+ case Py_LT:
+ case Py_LE:
+ case Py_GT:
+ case Py_GE:
+ res = Py_NotImplemented;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
}
return Py_INCREF(res), res;
@@ -912,7 +912,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
int len = -1;
char *c = type_fmt;
- while ((*c++= tolower(*type_id++))) {}
+ while ((*c++ = tolower(*type_id++))) {}
if (type == PROP_COLLECTION) {
len = pyrna_prop_collection_length(self);
@@ -1694,9 +1694,9 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
* if this causes problems in the future it should be removed.
*/
if ((ptr_type == &RNA_AnyType) &&
- (BPy_StructRNA_Check(value)) &&
- (RNA_struct_is_a(((BPy_StructRNA *)value)->ptr.type, &RNA_Operator))
- ) {
+ (BPy_StructRNA_Check(value)) &&
+ (RNA_struct_is_a(((BPy_StructRNA *)value)->ptr.type, &RNA_Operator)))
+ {
value = PyObject_GetAttrString(value, "properties");
value_new = value;
}
@@ -2640,7 +2640,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
RNA_property_float_get_array(ptr, prop, values);
for (count = start; count < stop; count++) {
- fval = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, count-start));
+ fval = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, count - start));
CLAMP(fval, min, max);
values[count] = fval;
}
@@ -2660,7 +2660,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
RNA_property_boolean_get_array(ptr, prop, values);
for (count = start; count < stop; count++)
- values[count] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
+ values[count] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count - start));
if (PyErr_Occurred()) ret = -1;
else RNA_property_boolean_set_array(ptr, prop, values);
@@ -3282,25 +3282,42 @@ static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self)
return pyrna_struct_CreatePyObject(&r_ptr);
}
+static void pyrna_dir_members_py__add_keys(PyObject *list, PyObject *dict)
+{
+ PyObject *list_tmp;
+
+ list_tmp = PyDict_Keys(dict);
+ PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
+ Py_DECREF(list_tmp);
+}
+
static void pyrna_dir_members_py(PyObject *list, PyObject *self)
{
PyObject *dict;
PyObject **dict_ptr;
- PyObject *list_tmp;
dict_ptr = _PyObject_GetDictPtr((PyObject *)self);
if (dict_ptr && (dict = *dict_ptr)) {
- list_tmp = PyDict_Keys(dict);
- PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
- Py_DECREF(list_tmp);
+ pyrna_dir_members_py__add_keys(list, dict);
}
dict = ((PyTypeObject *)Py_TYPE(self))->tp_dict;
if (dict) {
- list_tmp = PyDict_Keys(dict);
- PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
- Py_DECREF(list_tmp);
+ pyrna_dir_members_py__add_keys(list, dict);
+ }
+
+ /* since this is least common case, handle it last */
+ if (BPy_PropertyRNA_Check(self)) {
+ BPy_PropertyRNA *self_prop = (BPy_PropertyRNA *)self;
+ PointerRNA r_ptr;
+
+ if (RNA_property_collection_type_get(&self_prop->ptr, self_prop->prop, &r_ptr)) {
+ PyObject *cls = pyrna_struct_Subtype(&r_ptr); /* borrows */
+ dict = ((PyTypeObject *)cls)->tp_dict;
+ pyrna_dir_members_py__add_keys(list, dict);
+ Py_DECREF(cls);
+ }
}
}
@@ -3770,8 +3787,10 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
PyErr_Fetch(&error_type, &error_value, &error_traceback);
PyErr_Clear();
- cls = pyrna_struct_Subtype(&r_ptr); /* borrows */
+ cls = pyrna_struct_Subtype(&r_ptr);
ret = PyObject_GenericGetAttr(cls, pyname);
+ Py_DECREF(cls);
+
/* restore the original error */
if (ret == NULL) {
PyErr_Restore(error_type, error_value, error_traceback);
@@ -3919,6 +3938,12 @@ static PyGetSetDef pyrna_struct_getseters[] = {
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
+static PyObject *pyrna_func_doc_get(BPy_FunctionRNA *self, void *closure);
+
+static PyGetSetDef pyrna_func_getseters[] = {
+ {(char *)"__doc__", (getter)pyrna_func_doc_get, (setter)NULL, NULL, NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
PyDoc_STRVAR(pyrna_prop_collection_keys_doc,
".. method:: keys()\n"
@@ -3927,7 +3952,7 @@ PyDoc_STRVAR(pyrna_prop_collection_keys_doc,
" (matching pythons dict.keys() functionality).\n"
"\n"
" :return: the identifiers for each member of this collection.\n"
-" :rtype: list of stings\n"
+" :rtype: list of strings\n"
);
static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
{
@@ -4034,7 +4059,7 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
IDProperty *group, *idprop;
const char *key;
- PyObject* def = Py_None;
+ PyObject *def = Py_None;
PYRNA_STRUCT_CHECK_OBJ(self);
@@ -4092,7 +4117,7 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
PointerRNA newptr;
PyObject *key_ob;
- PyObject* def = Py_None;
+ PyObject *def = Py_None;
PYRNA_PROP_CHECK_OBJ(self);
@@ -4166,16 +4191,16 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key
return PyLong_FromSsize_t(index);
}
-static void foreach_attr_type( BPy_PropertyRNA *self, const char *attr,
- /* values to assign */
- RawPropertyType *raw_type, int *attr_tot, int *attr_signed)
+static void foreach_attr_type(BPy_PropertyRNA *self, const char *attr,
+ /* values to assign */
+ RawPropertyType *raw_type, int *attr_tot, int *attr_signed)
{
PropertyRNA *prop;
*raw_type = PROP_RAW_UNSET;
*attr_tot = 0;
*attr_signed = FALSE;
- /* note: this is fail with zero length lists, so dont let this get caled in that case */
+ /* 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) {
prop = RNA_struct_find_property(&itemptr, attr);
*raw_type = RNA_property_raw_type(prop);
@@ -4190,8 +4215,8 @@ static void foreach_attr_type( BPy_PropertyRNA *self, const char *attr,
static int foreach_parse_args(
BPy_PropertyRNA *self, PyObject *args,
- /*values to assign */
- const char **attr, PyObject **seq, int *tot, int *size,
+ /* values to assign */
+ const char **attr, PyObject **seq, int *tot, int *size,
RawPropertyType *raw_type, int *attr_tot, int *attr_signed
)
{
@@ -4236,7 +4261,7 @@ static int foreach_parse_args(
#endif
}
- /* check 'attr_tot' otherwise we dont know if any values were set
+ /* check 'attr_tot' otherwise we don't know if any values were set
* this isn't ideal because it means running on an empty list may fail silently when its not compatible. */
if (*size == 0 && *attr_tot != 0) {
PyErr_SetString(PyExc_AttributeError, "attribute does not support foreach method");
@@ -4250,21 +4275,21 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons
char f = format ? *format:'B'; /* B is assumed when not set */
switch (raw_type) {
- case PROP_RAW_CHAR:
- if (attr_signed) return (f == 'b') ? 1:0;
- else return (f == 'B') ? 1:0;
- case PROP_RAW_SHORT:
- if (attr_signed) return (f == 'h') ? 1:0;
- else return (f == 'H') ? 1:0;
- case PROP_RAW_INT:
- if (attr_signed) return (f == 'i') ? 1:0;
- else return (f == 'I') ? 1:0;
- case PROP_RAW_FLOAT:
- return (f == 'f') ? 1:0;
- case PROP_RAW_DOUBLE:
- return (f == 'd') ? 1:0;
- case PROP_RAW_UNSET:
- return 0;
+ case PROP_RAW_CHAR:
+ if (attr_signed) return (f == 'b') ? 1:0;
+ else return (f == 'B') ? 1:0;
+ case PROP_RAW_SHORT:
+ if (attr_signed) return (f == 'h') ? 1:0;
+ else return (f == 'H') ? 1:0;
+ case PROP_RAW_INT:
+ if (attr_signed) return (f == 'i') ? 1:0;
+ else return (f == 'I') ? 1:0;
+ case PROP_RAW_FLOAT:
+ return (f == 'f') ? 1:0;
+ case PROP_RAW_DOUBLE:
+ return (f == 'd') ? 1:0;
+ case PROP_RAW_UNSET:
+ return 0;
}
return 0;
@@ -4314,25 +4339,25 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
for ( ; i < tot; i++) {
item = PySequence_GetItem(seq, i);
switch (raw_type) {
- case PROP_RAW_CHAR:
- ((char *)array)[i] = (char)PyLong_AsLong(item);
- break;
- case PROP_RAW_SHORT:
- ((short *)array)[i] = (short)PyLong_AsLong(item);
- break;
- case PROP_RAW_INT:
- ((int *)array)[i] = (int)PyLong_AsLong(item);
- break;
- case PROP_RAW_FLOAT:
- ((float *)array)[i] = (float)PyFloat_AsDouble(item);
- break;
- case PROP_RAW_DOUBLE:
- ((double *)array)[i] = (double)PyFloat_AsDouble(item);
- break;
- case PROP_RAW_UNSET:
- /* should never happen */
- BLI_assert(!"Invalid array type - set");
- break;
+ case PROP_RAW_CHAR:
+ ((char *)array)[i] = (char)PyLong_AsLong(item);
+ break;
+ case PROP_RAW_SHORT:
+ ((short *)array)[i] = (short)PyLong_AsLong(item);
+ break;
+ case PROP_RAW_INT:
+ ((int *)array)[i] = (int)PyLong_AsLong(item);
+ break;
+ case PROP_RAW_FLOAT:
+ ((float *)array)[i] = (float)PyFloat_AsDouble(item);
+ break;
+ case PROP_RAW_DOUBLE:
+ ((double *)array)[i] = (double)PyFloat_AsDouble(item);
+ break;
+ case PROP_RAW_UNSET:
+ /* should never happen */
+ BLI_assert(!"Invalid array type - set");
+ break;
}
Py_DECREF(item);
@@ -4369,27 +4394,27 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
for ( ; i < tot; i++) {
switch (raw_type) {
- case PROP_RAW_CHAR:
- item = PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
- break;
- case PROP_RAW_SHORT:
- item = PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
- break;
- case PROP_RAW_INT:
- item = PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
- break;
- case PROP_RAW_FLOAT:
- item = PyFloat_FromDouble((double) ((float *)array)[i]);
- break;
- case PROP_RAW_DOUBLE:
- item = PyFloat_FromDouble((double) ((double *)array)[i]);
- break;
- default: /* PROP_RAW_UNSET */
- /* should never happen */
- BLI_assert(!"Invalid array type - get");
- item = Py_None;
- Py_INCREF(item);
- break;
+ case PROP_RAW_CHAR:
+ item = PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
+ break;
+ case PROP_RAW_SHORT:
+ item = PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
+ break;
+ case PROP_RAW_INT:
+ item = PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
+ break;
+ case PROP_RAW_FLOAT:
+ item = PyFloat_FromDouble((double) ((float *)array)[i]);
+ break;
+ case PROP_RAW_DOUBLE:
+ item = PyFloat_FromDouble((double) ((double *)array)[i]);
+ break;
+ default: /* PROP_RAW_UNSET */
+ /* should never happen */
+ BLI_assert(!"Invalid array type - get");
+ item = Py_None;
+ Py_INCREF(item);
+ break;
}
PySequence_SetItem(seq, i, item);
@@ -4524,7 +4549,7 @@ static struct PyMethodDef pyrna_struct_methods[] = {
{"type_recast", (PyCFunction)pyrna_struct_type_recast, METH_NOARGS, pyrna_struct_type_recast_doc},
{"__dir__", (PyCFunction)pyrna_struct_dir, METH_NOARGS, NULL},
- /* experemental */
+ /* experimental */
{"callback_add", (PyCFunction)pyrna_callback_add, METH_VARARGS, NULL},
{"callback_remove", (PyCFunction)pyrna_callback_remove, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
@@ -4993,7 +5018,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
/* Check if we gave args that don't exist in the function
* printing the error is slow but it should only happen when developing.
* the if below is quick, checking if it passed less keyword args then we gave.
- * (Dont overwrite the error if we have one, otherwise can skip important messages and confuse with args)
+ * (Don't overwrite the error if we have one, otherwise can skip important messages and confuse with args)
*/
if (err == 0 && kw && (pykw_len > kw_tot)) {
PyObject *key, *value;
@@ -5131,6 +5156,22 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
Py_RETURN_NONE;
}
+static PyObject *pyrna_func_doc_get(BPy_FunctionRNA *self, void *UNUSED(closure))
+{
+ PyObject *ret;
+ char *args;
+
+ args = RNA_function_as_string_keywords(NULL, self->func, NULL, TRUE, TRUE);
+
+ ret = PyUnicode_FromFormat("%.200s.%.200s(%.200s)\n%s",
+ RNA_struct_identifier(self->ptr.type),
+ RNA_function_identifier(self->func),
+ args, RNA_function_ui_description(self->func));
+
+ MEM_freeN(args);
+
+ return ret;
+}
/* subclasses of pyrna_struct_Type which support idprop definitions use this as a metaclass */
/* note: tp_base member is set to &PyType_Type on init */
@@ -5707,7 +5748,7 @@ PyTypeObject pyrna_func_Type = {
/*** Attribute descriptor and subclassing stuff ***/
NULL, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
+ pyrna_func_getseters, /* struct PyGetSetDef *tp_getset; */
NULL, /* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */
@@ -5922,10 +5963,10 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
/* done with rna instance */
}
-static PyObject* pyrna_srna_Subtype(StructRNA *srna);
+static PyObject *pyrna_srna_Subtype(StructRNA *srna);
/* return a borrowed reference */
-static PyObject* pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict)
+static PyObject *pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict)
{
/* Assume RNA_struct_py_type_get(srna) was already checked */
StructRNA *base;
@@ -5952,7 +5993,7 @@ static PyObject* pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict
* return a borrowed reference */
static PyObject *bpy_types_dict = NULL;
-static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
+static PyObject *pyrna_srna_ExternalType(StructRNA *srna)
{
const char *idname = RNA_struct_identifier(srna);
PyObject *newclass;
@@ -6002,7 +6043,7 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
return newclass;
}
-static PyObject* pyrna_srna_Subtype(StructRNA *srna)
+static PyObject *pyrna_srna_Subtype(StructRNA *srna)
{
PyObject *newclass = NULL;
@@ -6035,8 +6076,8 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
// if (!descr) descr = "(no docs)";
// "__doc__", descr
- if ( RNA_struct_idprops_check(srna) &&
- !PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type))
+ if (RNA_struct_idprops_check(srna) &&
+ !PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type))
{
metaclass = (PyObject *)&pyrna_struct_meta_idprop_Type;
}
@@ -6045,7 +6086,7 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
}
/* always use O not N when calling, N causes refcount errors */
- newclass = PyObject_CallFunction(metaclass, (char *)"s(O){sss()}",
+ newclass = PyObject_CallFunction(metaclass, (char *)"s(O) {sss()}",
idname, py_base, "__module__","bpy.types", "__slots__");
/* newclass will now have 2 ref's, ???, probably 1 is internal since decrefing here segfaults */
@@ -6082,7 +6123,7 @@ static StructRNA *srna_from_ptr(PointerRNA *ptr)
}
/* always returns a new ref, be sure to decref when done */
-static PyObject* pyrna_struct_Subtype(PointerRNA *ptr)
+static PyObject *pyrna_struct_Subtype(PointerRNA *ptr)
{
return pyrna_srna_Subtype(srna_from_ptr(ptr));
}
@@ -6588,10 +6629,10 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject
*
* So only scan base classes which are not subclasses if blender types.
* This best fits having 'mix-in' classes for operators and render engines.
- * */
+ */
if (py_superclass != &PyBaseObject_Type &&
- !PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&pyrna_struct_Type)
- ) {
+ !PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&pyrna_struct_Type))
+ {
ret = pyrna_deferred_register_class_recursive(srna, py_superclass);
if (ret != 0) {
@@ -6606,7 +6647,7 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject
int pyrna_deferred_register_class(StructRNA *srna, PyObject *py_class)
{
- /* Panels and Menus dont need this
+ /* Panels and Menus don't need this
* save some time and skip the checks here */
if (!RNA_struct_idprops_register_check(srna))
return 0;
@@ -6704,7 +6745,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
func_arg_count = rna_function_arg_count(func);
- if (func_arg_count >= 0) { /* -1 if we dont care*/
+ if (func_arg_count >= 0) { /* -1 if we don't care*/
arg_count = ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount;
/* note, the number of args we check for and the number of args we give to
@@ -7016,8 +7057,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
if (err == -1) {
PyC_Err_Format_Prefix(PyExc_RuntimeError,
"class %.200s, function %.200s: incompatible return value ",
- RNA_struct_identifier(ptr->type), RNA_function_identifier(func)
- );
+ RNA_struct_identifier(ptr->type), RNA_function_identifier(func));
}
}
else if (ret_len > 1) {
@@ -7065,10 +7105,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
if (err != 0) {
ReportList *reports;
/* alert the user, else they wont know unless they see the console. */
- if ( (!is_static) &&
- (ptr->data) &&
- (RNA_struct_is_a(ptr->type, &RNA_Operator)) &&
- (is_valid_wm == (CTX_wm_manager(C) != NULL)))
+ if ((!is_static) &&
+ (ptr->data) &&
+ (RNA_struct_is_a(ptr->type, &RNA_Operator)) &&
+ (is_valid_wm == (CTX_wm_manager(C) != NULL)))
{
wmOperator *op = ptr->data;
reports = op->reports;
@@ -7106,7 +7146,7 @@ static void bpy_class_free(void *pyob_ptr)
PyErr_Clear();
#if 0 /* needs further investigation, too annoying so quiet for now */
- if (G.f&G_DEBUG) {
+ if (G.f & G_DEBUG) {
if (self->ob_refcnt > 1) {
PyC_ObSpit("zombie class - ref should be 1", self);
}
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index 187db194c36..6e6eb015387 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -550,21 +550,21 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data,
{
int ret;
switch (RNA_property_type(prop)) {
- case PROP_FLOAT:
- ret = py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float),
- py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
- break;
- case PROP_INT:
- ret = py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int),
- py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
- break;
- case PROP_BOOLEAN:
- ret = py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int),
- py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "not an array type");
- ret = -1;
+ case PROP_FLOAT:
+ ret = py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float),
+ py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
+ break;
+ case PROP_INT:
+ ret = py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int),
+ py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
+ break;
+ case PROP_BOOLEAN:
+ ret = py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int),
+ py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "not an array type");
+ ret = -1;
}
return ret;
@@ -575,21 +575,21 @@ int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, in
{
int ret;
switch (RNA_property_type(prop)) {
- case PROP_FLOAT:
- ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
- py_float_check, "float", py_to_float, float_set_index, error_prefix);
- break;
- case PROP_INT:
- ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
- py_int_check, "int", py_to_int, int_set_index, error_prefix);
- break;
- case PROP_BOOLEAN:
- ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
- py_bool_check, "boolean", py_to_bool, bool_set_index, error_prefix);
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "not an array type");
- ret = -1;
+ case PROP_FLOAT:
+ ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+ py_float_check, "float", py_to_float, float_set_index, error_prefix);
+ break;
+ case PROP_INT:
+ ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+ py_int_check, "int", py_to_int, int_set_index, error_prefix);
+ break;
+ case PROP_BOOLEAN:
+ ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+ py_bool_check, "boolean", py_to_bool, bool_set_index, error_prefix);
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "not an array type");
+ ret = -1;
}
return ret;
@@ -600,18 +600,18 @@ PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index)
PyObject *item;
switch (RNA_property_type(prop)) {
- case PROP_FLOAT:
- item = PyFloat_FromDouble(RNA_property_float_get_index(ptr, prop, index));
- break;
- case PROP_BOOLEAN:
- item = PyBool_FromLong(RNA_property_boolean_get_index(ptr, prop, index));
- break;
- case PROP_INT:
- item = PyLong_FromSsize_t(RNA_property_int_get_index(ptr, prop, index));
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "not an array type");
- item = NULL;
+ case PROP_FLOAT:
+ item = PyFloat_FromDouble(RNA_property_float_get_index(ptr, prop, index));
+ break;
+ case PROP_BOOLEAN:
+ item = PyBool_FromLong(RNA_property_boolean_get_index(ptr, prop, index));
+ break;
+ case PROP_INT:
+ item = PyLong_FromSsize_t(RNA_property_int_get_index(ptr, prop, index));
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "not an array type");
+ item = NULL;
}
return item;
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index 7704ab2a417..13532b24e55 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -137,7 +137,7 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
ED_region_draw_cb_exit(((ARegion *)self->ptr.data)->type, handle);
}
- /* dont allow reuse */
+ /* don't allow reuse */
PyCapsule_SetName(py_handle, RNA_CAPSULE_ID_INVALID);
Py_RETURN_NONE;
diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c
index 01eb2653681..aaba90604f5 100644
--- a/source/blender/python/intern/bpy_traceback.c
+++ b/source/blender/python/intern/bpy_traceback.c
@@ -54,7 +54,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
/* new style errors. `err' is an instance */
- if (! (v = PyObject_GetAttrString(err, "msg")))
+ if (!(v = PyObject_GetAttrString(err, "msg")))
goto finally;
*message = v;
@@ -62,7 +62,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
goto finally;
if (v == Py_None)
*filename = NULL;
- else if (! (*filename = _PyUnicode_AsString(v)))
+ else if (!(*filename = _PyUnicode_AsString(v)))
goto finally;
Py_DECREF(v);
@@ -131,8 +131,8 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
if (parse_syntax_error(value, &message, &filename, lineno, offset, &text)) {
/* python adds a '/', prefix, so check for both */
if ((BLI_path_cmp(filename, filepath) == 0) ||
- ((filename[0] == '\\' || filename[0] == '/') && BLI_path_cmp(filename + 1, filepath) == 0)
- ) {
+ ((filename[0] == '\\' || filename[0] == '/') && BLI_path_cmp(filename + 1, filepath) == 0))
+ {
/* good */
}
else {
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index 552abaaf414..cc7506f863e 100644
--- a/source/blender/python/intern/gpu.c
+++ b/source/blender/python/intern/gpu.c
@@ -77,7 +77,7 @@ static struct PyModuleDef gpumodule = {
PyMODINIT_FUNC
PyInit_gpu(void)
{
- PyObject* m;
+ PyObject *m;
m = PyModule_Create(&gpumodule);
if (m == NULL)
@@ -155,14 +155,14 @@ PyDoc_STRVAR(GPU_export_shader_doc,
" :return: Dictionary defining the shader, uniforms and attributes.\n"
" :rtype: Dict"
);
-static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObject *kwds)
+static PyObject *GPU_export_shader(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)
{
- PyObject* pyscene;
- PyObject* pymat;
- PyObject* result;
- PyObject* dict;
- PyObject* val;
- PyObject* seq;
+ PyObject *pyscene;
+ PyObject *pymat;
+ PyObject *result;
+ PyObject *dict;
+ PyObject *val;
+ PyObject *seq;
int i;
Scene *scene;
@@ -174,7 +174,7 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
static const char *kwlist[] = {"scene", "material", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char**)(kwlist), &pyscene, &pymat))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char **)(kwlist), &pyscene, &pymat))
return NULL;
scene = (Scene *)PyC_RNA_AsPointer(pyscene, "Scene");
@@ -202,7 +202,7 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
PY_DICT_ADD_STRING(result,shader,vertex);
}
seq = PyList_New(BLI_countlist(&shader->uniforms));
- for (i=0, uniform=shader->uniforms.first; uniform; uniform=uniform->next, i++) {
+ for (i = 0, uniform = shader->uniforms.first; uniform; uniform = uniform->next, i++) {
dict = PyDict_New();
PY_DICT_ADD_STRING(dict,uniform,varname);
PY_DICT_ADD_LONG(dict,uniform,datatype);
@@ -230,7 +230,7 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
Py_DECREF(seq);
seq = PyList_New(BLI_countlist(&shader->attributes));
- for (i=0, attribute=shader->attributes.first; attribute; attribute=attribute->next, i++) {
+ for (i = 0, attribute = shader->attributes.first; attribute; attribute = attribute->next, i++) {
dict = PyDict_New();
PY_DICT_ADD_STRING(dict,attribute,varname);
PY_DICT_ADD_LONG(dict,attribute,datatype);
@@ -260,9 +260,9 @@ static PyMethodDef meth_export_shader[] = {
{"export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS, GPU_export_shader_doc}
};
-PyObject* GPU_initPython(void)
+PyObject *GPU_initPython(void)
{
- PyObject* module = PyInit_gpu();
+ PyObject *module = PyInit_gpu();
PyModule_AddObject(module, "export_shader", (PyObject *)PyCFunction_New(meth_export_shader, NULL));
PyDict_SetItemString(PyImport_GetModuleDict(), "gpu", module);
diff --git a/source/blender/python/intern/gpu.h b/source/blender/python/intern/gpu.h
index bffbae13ba2..68e7fa4aa9e 100644
--- a/source/blender/python/intern/gpu.h
+++ b/source/blender/python/intern/gpu.h
@@ -32,5 +32,5 @@
/**
* Initalizes the gpu Python module.
*/
-PyObject* GPU_initPython(void);
+PyObject *GPU_initPython(void);
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 8e4d3955c80..ff551206fae 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -52,8 +52,8 @@ static int mathutils_array_parse_fast(float *array,
i = size;
do {
i--;
- if ( ((array[i] = PyFloat_AsDouble((item = PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
- PyErr_Occurred())
+ if (((array[i] = PyFloat_AsDouble((item = PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
+ PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"%.200s: sequence index %d expected a number, "
@@ -75,10 +75,10 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *
#if 1 /* approx 6x speedup for mathutils types */
- if ( (size = VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
- (size = EulerObject_Check(value) ? 3 : 0) ||
- (size = QuaternionObject_Check(value) ? 4 : 0) ||
- (size = ColorObject_Check(value) ? 3 : 0))
+ if ((size = VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
+ (size = EulerObject_Check(value) ? 3 : 0) ||
+ (size = QuaternionObject_Check(value) ? 4 : 0) ||
+ (size = ColorObject_Check(value) ? 3 : 0))
{
if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
@@ -139,10 +139,10 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c
#if 1 /* approx 6x speedup for mathutils types */
- if ( (size = VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
- (size = EulerObject_Check(value) ? 3 : 0) ||
- (size = QuaternionObject_Check(value) ? 4 : 0) ||
- (size = ColorObject_Check(value) ? 3 : 0))
+ if ((size = VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
+ (size = EulerObject_Check(value) ? 3 : 0) ||
+ (size = QuaternionObject_Check(value) ? 4 : 0) ||
+ (size = ColorObject_Check(value) ? 3 : 0))
{
if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
@@ -284,18 +284,21 @@ PyObject *mathutils_dynstr_to_py(struct DynStr *ds)
/* Mathutils Callbacks */
/* for mathutils internal use only, eventually should re-alloc but to start with we only have a few users */
-static Mathutils_Callback *mathutils_callbacks[8] = {NULL};
+#define MATHUTILS_TOT_CB 8
+static Mathutils_Callback *mathutils_callbacks[MATHUTILS_TOT_CB] = {NULL};
-int Mathutils_RegisterCallback(Mathutils_Callback *cb)
+unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb)
{
- int i;
+ unsigned char i;
/* find the first free slot */
for (i = 0; mathutils_callbacks[i]; i++) {
if (mathutils_callbacks[i] == cb) /* already registered? */
return i;
}
-
+
+ BLI_assert(i < MATHUTILS_TOT_CB);
+
mathutils_callbacks[i] = cb;
return i;
}
diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h
index 854cb2e962a..75ea18c2df1 100644
--- a/source/blender/python/mathutils/mathutils.h
+++ b/source/blender/python/mathutils/mathutils.h
@@ -67,8 +67,8 @@ typedef struct {
#include "mathutils_geometry.h"
#include "mathutils_noise.h"
-PyObject *BaseMathObject_owner_get( BaseMathObject * self, void * );
-PyObject *BaseMathObject_is_wrapped_get( BaseMathObject *self, void * );
+PyObject *BaseMathObject_owner_get(BaseMathObject * self, void *);
+PyObject *BaseMathObject_is_wrapped_get(BaseMathObject *self, void *);
int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg);
int BaseMathObject_clear(BaseMathObject *self);
@@ -98,7 +98,7 @@ struct Mathutils_Callback {
BaseMathSetIndexFunc set_index;
};
-int Mathutils_RegisterCallback(Mathutils_Callback *cb);
+unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb);
int _BaseMathObject_ReadCallback(BaseMathObject *self);
int _BaseMathObject_WriteCallback(BaseMathObject *self);
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index e925b115178..21fbac2d570 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -159,21 +159,21 @@ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op)
}
switch (op) {
- case Py_NE:
- ok = !ok; /* pass through */
- case Py_EQ:
- res = ok ? Py_False : Py_True;
- break;
-
- case Py_LT:
- case Py_LE:
- case Py_GT:
- case Py_GE:
- res = Py_NotImplemented;
- break;
- default:
- PyErr_BadArgument();
- return NULL;
+ case Py_NE:
+ ok = !ok; /* pass through */
+ case Py_EQ:
+ res = ok ? Py_False : Py_True;
+ break;
+
+ case Py_LT:
+ case Py_LE:
+ case Py_GT:
+ case Py_GE:
+ res = Py_NotImplemented;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
}
return Py_INCREF(res), res;
@@ -218,7 +218,7 @@ static int Color_ass_item(ColorObject *self, int i, PyObject *value)
return -1;
}
- if (i < 0) i= COLOR_SIZE - i;
+ if (i < 0) i = COLOR_SIZE - i;
if (i < 0 || i >= COLOR_SIZE) {
PyErr_SetString(PyExc_IndexError, "color[attribute] = x: "
@@ -504,7 +504,7 @@ static PyObject *Color_mul(PyObject *v1, PyObject *v2)
/* make sure v1 is always the vector */
if (color1 && color2) {
- /* col * col, dont support yet! */
+ /* col * col, don't support yet! */
}
else if (color1) {
if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* COLOR * FLOAT */
@@ -885,14 +885,15 @@ PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type)
return (PyObject *)self;
}
-PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
+PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
+ unsigned char cb_type, unsigned char cb_subtype)
{
ColorObject *self = (ColorObject *)Color_CreatePyObject(NULL, Py_NEW, NULL);
if (self) {
Py_INCREF(cb_user);
- self->cb_user = cb_user;
- self->cb_type = (unsigned char)cb_type;
- self->cb_subtype = (unsigned char)cb_subtype;
+ self->cb_user = cb_user;
+ self->cb_type = cb_type;
+ self->cb_subtype = cb_subtype;
PyObject_GC_Track(self);
}
diff --git a/source/blender/python/mathutils/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h
index cfa83a9630e..2bf6ba2ef1f 100644
--- a/source/blender/python/mathutils/mathutils_Color.h
+++ b/source/blender/python/mathutils/mathutils_Color.h
@@ -48,7 +48,8 @@ typedef struct {
* blender (stored in blend_data). This is an either/or struct not both*/
//prototypes
-PyObject *Color_CreatePyObject( float *col, int type, PyTypeObject *base_type);
-PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype);
+PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type);
+PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
+ unsigned char cb_type, unsigned char cb_subtype);
#endif /* __MATHUTILS_COLOR_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 17e4115233b..957649e6365 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -349,21 +349,21 @@ static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op)
}
switch (op) {
- case Py_NE:
- ok = !ok; /* pass through */
- case Py_EQ:
- res = ok ? Py_False : Py_True;
- break;
-
- case Py_LT:
- case Py_LE:
- case Py_GT:
- case Py_GE:
- res = Py_NotImplemented;
- break;
- default:
- PyErr_BadArgument();
- return NULL;
+ case Py_NE:
+ ok = !ok; /* pass through */
+ case Py_EQ:
+ res = ok ? Py_False : Py_True;
+ break;
+
+ case Py_LT:
+ case Py_LE:
+ case Py_GT:
+ case Py_GE:
+ res = Py_NotImplemented;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
}
return Py_INCREF(res), res;
@@ -732,14 +732,15 @@ PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *
return (PyObject *)self;
}
-PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype)
+PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order,
+ unsigned char cb_type, unsigned char cb_subtype)
{
EulerObject *self = (EulerObject *)Euler_CreatePyObject(NULL, order, Py_NEW, NULL);
if (self) {
Py_INCREF(cb_user);
- self->cb_user = cb_user;
- self->cb_type = (unsigned char)cb_type;
- self->cb_subtype = (unsigned char)cb_subtype;
+ self->cb_user = cb_user;
+ self->cb_type = cb_type;
+ self->cb_subtype = cb_subtype;
PyObject_GC_Track(self);
}
diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h
index d9ed86401dc..56199f4a546 100644
--- a/source/blender/python/mathutils/mathutils_Euler.h
+++ b/source/blender/python/mathutils/mathutils_Euler.h
@@ -50,8 +50,9 @@ typedef struct {
* blender (stored in blend_data). This is an either/or struct not both */
//prototypes
-PyObject *Euler_CreatePyObject( float *eul, short order, int type, PyTypeObject *base_type);
-PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype);
+PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type);
+PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order,
+ unsigned char cb_type, unsigned char cb_subtype);
short euler_order_from_string(const char *str, const char *error_prefix);
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index ea329b17013..b352726dc44 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -78,7 +78,7 @@ static int matrix_col_vector_check(MatrixObject *mat, VectorObject *vec, int col
* matrix row callbacks
* this is so you can do matrix[i][j] = val OR matrix.row[i][j] = val */
-int mathutils_matrix_row_cb_index = -1;
+unsigned char mathutils_matrix_row_cb_index = -1;
static int mathutils_matrix_row_check(BaseMathObject *bmo)
{
@@ -162,7 +162,7 @@ Mathutils_Callback mathutils_matrix_row_cb = {
* matrix row callbacks
* this is so you can do matrix.col[i][j] = val */
-int mathutils_matrix_col_cb_index = -1;
+unsigned char mathutils_matrix_col_cb_index = -1;
static int mathutils_matrix_col_check(BaseMathObject *bmo)
{
@@ -255,7 +255,7 @@ Mathutils_Callback mathutils_matrix_col_cb = {
* this is so you can do matrix.translation = val
* note, this is _exactly like matrix.col except the 4th component is always omitted */
-int mathutils_matrix_translation_cb_index = -1;
+unsigned char mathutils_matrix_translation_cb_index = -1;
static int mathutils_matrix_translation_check(BaseMathObject *bmo)
{
@@ -780,7 +780,7 @@ PyDoc_STRVAR(C_Matrix_Shear_doc,
" :arg size: The size of the shear matrix to construct [2, 4].\n"
" :type size: int\n"
" :arg factor: The factor of shear to apply. For a 3 or 4 *size* matrix\n"
-" pass a pair of floats corrasponding with the *plane* axis.\n"
+" pass a pair of floats corresponding with the *plane* axis.\n"
" :type factor: float or float pair\n"
" :return: A new shear matrix.\n"
" :rtype: :class:`Matrix`\n"
@@ -1601,28 +1601,28 @@ static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op)
if (BaseMath_ReadCallback(matA) == -1 || BaseMath_ReadCallback(matB) == -1)
return NULL;
- ok = ( (matA->num_row == matB->num_row) &&
- (matA->num_col == matB->num_col) &&
- EXPP_VectorsAreEqual(matA->matrix, matB->matrix, (matA->num_col * matA->num_row), 1)
- ) ? 0 : -1;
+ ok = ((matA->num_row == matB->num_row) &&
+ (matA->num_col == matB->num_col) &&
+ EXPP_VectorsAreEqual(matA->matrix, matB->matrix, (matA->num_col * matA->num_row), 1)
+ ) ? 0 : -1;
}
switch (op) {
- case Py_NE:
- ok = !ok; /* pass through */
- case Py_EQ:
- res = ok ? Py_False : Py_True;
- break;
-
- case Py_LT:
- case Py_LE:
- case Py_GT:
- case Py_GE:
- res = Py_NotImplemented;
- break;
- default:
- PyErr_BadArgument();
- return NULL;
+ case Py_NE:
+ ok = !ok; /* pass through */
+ case Py_EQ:
+ res = ok ? Py_False : Py_True;
+ break;
+
+ case Py_LT:
+ case Py_LE:
+ case Py_GT:
+ case Py_GE:
+ res = Py_NotImplemented;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
}
return Py_INCREF(res), res;
@@ -1739,8 +1739,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
tuple = PyTuple_New(end - begin);
for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin,
- Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_row_cb_index, count));
-
+ Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_row_cb_index, count));
}
return tuple;
@@ -1850,8 +1849,7 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
PyErr_Format(PyExc_TypeError,
"Matrix subtraction: (%s - %s) "
"invalid type for this operation",
- Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name
- );
+ Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name);
return NULL;
}
@@ -2400,14 +2398,14 @@ PyObject *Matrix_CreatePyObject(float *mat,
PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user,
const unsigned short num_col, const unsigned short num_row,
- int cb_type, int cb_subtype)
+ unsigned char cb_type, unsigned char cb_subtype)
{
MatrixObject *self = (MatrixObject *)Matrix_CreatePyObject(NULL, num_col, num_row, Py_NEW, NULL);
if (self) {
Py_INCREF(cb_user);
- self->cb_user = cb_user;
- self->cb_type = (unsigned char)cb_type;
- self->cb_subtype = (unsigned char)cb_subtype;
+ self->cb_user = cb_user;
+ self->cb_type = cb_type;
+ self->cb_subtype = cb_subtype;
PyObject_GC_Track(self);
}
return (PyObject *) self;
diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h
index e8719e947ec..fe9bf2ccb2a 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.h
+++ b/source/blender/python/mathutils/mathutils_Matrix.h
@@ -71,11 +71,11 @@ PyObject *Matrix_CreatePyObject(float *mat,
int type, PyTypeObject *base_type);
PyObject *Matrix_CreatePyObject_cb(PyObject *user,
const unsigned short num_col, const unsigned short num_row,
- int cb_type, int cb_subtype);
+ unsigned char cb_type, unsigned char cb_subtype);
-extern int mathutils_matrix_row_cb_index; /* default */
-extern int mathutils_matrix_col_cb_index;
-extern int mathutils_matrix_translation_cb_index;
+extern unsigned char mathutils_matrix_row_cb_index; /* default */
+extern unsigned char mathutils_matrix_col_cb_index;
+extern unsigned char mathutils_matrix_translation_cb_index;
extern struct Mathutils_Callback mathutils_matrix_row_cb; /* default */
extern struct Mathutils_Callback mathutils_matrix_col_cb;
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index b3767d2b8bb..80910c409bc 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -527,21 +527,21 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
}
switch (op) {
- case Py_NE:
- ok = !ok; /* pass through */
- case Py_EQ:
- res = ok ? Py_False : Py_True;
- break;
-
- case Py_LT:
- case Py_LE:
- case Py_GT:
- case Py_GE:
- res = Py_NotImplemented;
- break;
- default:
- PyErr_BadArgument();
- return NULL;
+ case Py_NE:
+ ok = !ok; /* pass through */
+ case Py_EQ:
+ res = ok ? Py_False : Py_True;
+ break;
+
+ case Py_LT:
+ case Py_LE:
+ case Py_GT:
+ case Py_GE:
+ res = Py_NotImplemented;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
}
return Py_INCREF(res), res;
@@ -558,7 +558,7 @@ static int Quaternion_len(QuaternionObject *UNUSED(self))
//sequence accessor (get)
static PyObject *Quaternion_item(QuaternionObject *self, int i)
{
- if (i < 0) i = QUAT_SIZE-i;
+ if (i < 0) i = QUAT_SIZE - i;
if (i < 0 || i >= QUAT_SIZE) {
PyErr_SetString(PyExc_IndexError,
@@ -585,7 +585,7 @@ static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob)
return -1;
}
- if (i < 0) i = QUAT_SIZE-i;
+ if (i < 0) i = QUAT_SIZE - i;
if (i < 0 || i >= QUAT_SIZE) {
PyErr_SetString(PyExc_IndexError,
@@ -805,12 +805,12 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
return NULL;
}
- if (quat1 && quat2) { /* QUAT*QUAT (cross product) */
+ if (quat1 && quat2) { /* QUAT * QUAT (cross product) */
mul_qt_qtqt(quat, quat1->quat, quat2->quat);
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1));
}
- /* the only case this can happen (for a supported type is "FLOAT*QUAT") */
- else if (quat2) { /* FLOAT*QUAT */
+ /* the only case this can happen (for a supported type is "FLOAT * QUAT") */
+ else if (quat2) { /* FLOAT * QUAT */
if (((scalar = PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred()) == 0) {
return quat_mul_float(quat2, scalar);
}
@@ -1101,21 +1101,22 @@ static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObjec
}
}
-/* axis vector suffers from precission errors, use this function to ensure */
+/* axis vector suffers from precision errors, use this function to ensure */
static void quat__axis_angle_sanitize(float axis[3], float *angle)
{
if (axis) {
- if ( !finite(axis[0]) ||
- !finite(axis[1]) ||
- !finite(axis[2]))
+ if (is_zero_v3(axis) ||
+ !finite(axis[0]) ||
+ !finite(axis[1]) ||
+ !finite(axis[2]))
{
axis[0] = 1.0f;
axis[1] = 0.0f;
axis[2] = 0.0f;
}
- else if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
- EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
- EXPP_FloatsAreEqual(axis[2], 0.0f, 10))
+ else if (EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
+ EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
+ EXPP_FloatsAreEqual(axis[2], 0.0f, 10))
{
axis[0] = 1.0f;
}
@@ -1268,14 +1269,15 @@ PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_ty
return (PyObject *) self;
}
-PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
+PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user,
+ unsigned char cb_type, unsigned char cb_subtype)
{
QuaternionObject *self = (QuaternionObject *)Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
if (self) {
Py_INCREF(cb_user);
- self->cb_user = cb_user;
- self->cb_type = (unsigned char)cb_type;
- self->cb_subtype = (unsigned char)cb_subtype;
+ self->cb_user = cb_user;
+ self->cb_type = cb_type;
+ self->cb_subtype = cb_subtype;
PyObject_GC_Track(self);
}
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.h b/source/blender/python/mathutils/mathutils_Quaternion.h
index 556e6d80948..09faff192de 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.h
+++ b/source/blender/python/mathutils/mathutils_Quaternion.h
@@ -48,7 +48,8 @@ typedef struct {
* blender (stored in blend_data). This is an either/or struct not both */
//prototypes
-PyObject *Quaternion_CreatePyObject( float *quat, int type, PyTypeObject *base_type);
-PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype);
+PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_type);
+PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user,
+ unsigned char cb_type, unsigned char cb_subtype);
#endif /* __MATHUTILS_QUATERNION_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 6a7ace9c2a4..771db838c69 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -247,7 +247,7 @@ static PyObject *C_Vector_Linspace(PyObject *cls, PyObject *args)
return NULL;
}
- step = (end - start)/(float)(size-1);
+ step = (end - start) / (float)(size - 1);
vec = PyMem_Malloc(size * sizeof(float));
@@ -734,19 +734,19 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
}
else if (strlen(strack) == 1) {
switch (strack[0]) {
- case '-':
- case 'X':
- track = 0;
- break;
- case 'Y':
- track = 1;
- break;
- case 'Z':
- track = 2;
- break;
- default:
- PyErr_SetString(PyExc_ValueError, axis_err_msg);
- return NULL;
+ case '-':
+ case 'X':
+ track = 0;
+ break;
+ case 'Y':
+ track = 1;
+ break;
+ case 'Z':
+ track = 2;
+ break;
+ default:
+ PyErr_SetString(PyExc_ValueError, axis_err_msg);
+ return NULL;
}
}
else {
@@ -759,18 +759,18 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
const char *axis_err_msg = "only X, Y or Z for up axis";
if (strlen(sup) == 1) {
switch (*sup) {
- case 'X':
- up = 0;
- break;
- case 'Y':
- up = 1;
- break;
- case 'Z':
- up = 2;
- break;
- default:
- PyErr_SetString(PyExc_ValueError, axis_err_msg);
- return NULL;
+ case 'X':
+ up = 0;
+ break;
+ case 'Y':
+ up = 1;
+ break;
+ case 'Z':
+ up = 2;
+ break;
+ default:
+ PyErr_SetString(PyExc_ValueError, axis_err_msg);
+ return NULL;
}
}
else {
@@ -920,7 +920,7 @@ PyDoc_STRVAR(Vector_angle_doc,
" :return: angle in radians or fallback when given\n"
" :rtype: float\n"
"\n"
-" .. note:: Zero length vectors raise an :exc:`AttributeError`.\n"
+" .. note:: Zero length vectors raise an :exc:`ValueError`.\n"
);
static PyObject *Vector_angle(VectorObject *self, PyObject *args)
{
@@ -971,6 +971,62 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
return PyFloat_FromDouble(saacos(dot / (sqrt(dot_self) * sqrt(dot_other))));
}
+PyDoc_STRVAR(Vector_angle_signed_doc,
+".. function:: angle_signed(other, fallback)\n"
+"\n"
+" Return the signed angle between two 2D vectors (clockwise is positive).\n"
+"\n"
+" :arg other: another vector to compare the angle with\n"
+" :type other: :class:`Vector`\n"
+" :arg fallback: return this value when the angle cant be calculated\n"
+" (zero length vector)\n"
+" :type fallback: any\n"
+" :return: angle in radians or fallback when given\n"
+" :rtype: float\n"
+"\n"
+" .. note:: Zero length vectors raise an :exc:`ValueError`.\n"
+);
+static PyObject *Vector_angle_signed(VectorObject *self, PyObject *args)
+{
+ float tvec[2];
+
+ PyObject *value;
+ PyObject *fallback = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|O:angle_signed", &value, &fallback))
+ return NULL;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ if (mathutils_array_parse(tvec, 2, 2, value, "Vector.angle_signed(other), invalid 'other' arg") == -1)
+ return NULL;
+
+ if (self->size != 2) {
+ PyErr_SetString(PyExc_ValueError,
+ "Vector must be 2D");
+ return NULL;
+ }
+
+ if (is_zero_v2(self->vec) || is_zero_v2(tvec)) {
+ /* avoid exception */
+ if (fallback) {
+ Py_INCREF(fallback);
+ return fallback;
+ }
+ else {
+ PyErr_SetString(PyExc_ValueError,
+ "Vector.angle_signed(other): "
+ "zero length vectors have no valid angle");
+ return NULL;
+ }
+ }
+
+
+ return PyFloat_FromDouble(angle_signed_v2v2(self->vec, tvec));
+}
+
+
PyDoc_STRVAR(Vector_rotation_difference_doc,
".. function:: rotation_difference(other)\n"
"\n"
@@ -1203,10 +1259,10 @@ static int Vector_len(VectorObject *self)
/* sequence accessor (get): vector[index] */
static PyObject *vector_item_internal(VectorObject *self, int i, const int is_attr)
{
- if (i < 0) i = self->size-i;
+ if (i < 0) i = self->size - i;
if (i < 0 || i >= self->size) {
- if (is_attr) {
+ if (is_attr) {
PyErr_Format(PyExc_AttributeError,
"Vector.%c: unavailable on %dd vector",
*(((char *)"xyzw") + i), self->size);
@@ -1239,7 +1295,7 @@ static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value,
return -1;
}
- if (i < 0) i = self->size-i;
+ if (i < 0) i = self->size - i;
if (i < 0 || i >= self->size) {
if (is_attr) {
@@ -2190,9 +2246,9 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
size_from = axis_from;
}
- else if ( (PyErr_Clear()), /* run but ignore the result */
- (size_from = mathutils_array_parse(vec_assign, 2, 4, value,
- "mathutils.Vector.**** = swizzle assignment")) == -1)
+ else if ((PyErr_Clear()), /* run but ignore the result */
+ (size_from = mathutils_array_parse(vec_assign, 2, 4, value,
+ "mathutils.Vector.**** = swizzle assignment")) == -1)
{
return -1;
}
@@ -2595,11 +2651,11 @@ while len(axises) >= 2:
if len(axises)>2:
for axis_2 in axises:
axis_2_pos = axis_pos[axis_2]
- axis_dict[axis_0 + axis_1 + axis_2] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)))' % (axis_0_pos, axis_1_pos, axis_2_pos)
+ axis_dict[axis_0 + axis_1 + axis_2] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS * 2)))' % (axis_0_pos, axis_1_pos, axis_2_pos)
if len(axises)>3:
for axis_3 in axises:
axis_3_pos = axis_pos[axis_3]
- axis_dict[axis_0 + axis_1 + axis_2 + axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos)
+ axis_dict[axis_0 + axis_1 + axis_2 + axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS * 3))) ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos)
axises = axises[:-1]
@@ -2611,7 +2667,7 @@ unique = set()
for key, val in items:
num = eval(val)
set_str = 'Vector_setSwizzle' if (len(set(key)) == len(key)) else 'NULL'
- print '\t{"%s", %s(getter)Vector_getSwizzle, (setter)%s, NULL, SET_INT_IN_POINTER(%s)}, // %s' % (key, (' '*(4-len(key))), set_str, axis_dict[key], num)
+ print '\t{"%s", %s(getter)Vector_getSwizzle, (setter)%s, NULL, SET_INT_IN_POINTER(%s)}, // %s' % (key, (' '*(4 - len(key))), set_str, axis_dict[key], num)
unique.add(num)
if len(unique) != len(items):
@@ -2705,6 +2761,7 @@ static struct PyMethodDef Vector_methods[] = {
{"cross", (PyCFunction) Vector_cross, METH_O, Vector_cross_doc},
{"dot", (PyCFunction) Vector_dot, METH_O, Vector_dot_doc},
{"angle", (PyCFunction) Vector_angle, METH_VARARGS, Vector_angle_doc},
+ {"angle_signed", (PyCFunction) Vector_angle_signed, METH_VARARGS, Vector_angle_signed_doc},
{"rotation_difference", (PyCFunction) Vector_rotation_difference, METH_O, Vector_rotation_difference_doc},
{"project", (PyCFunction) Vector_project, METH_O, Vector_project_doc},
{"lerp", (PyCFunction) Vector_lerp, METH_VARARGS, Vector_lerp_doc},
@@ -2856,15 +2913,15 @@ PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTy
return (PyObject *) self;
}
-PyObject *Vector_CreatePyObject_cb(PyObject *cb_user, int size, int cb_type, int cb_subtype)
+PyObject *Vector_CreatePyObject_cb(PyObject *cb_user, int size, unsigned char cb_type, unsigned char cb_subtype)
{
float dummy[4] = {0.0, 0.0, 0.0, 0.0}; /* dummy init vector, callbacks will be used on access */
VectorObject *self = (VectorObject *)Vector_CreatePyObject(dummy, size, Py_NEW, NULL);
if (self) {
Py_INCREF(cb_user);
- self->cb_user = cb_user;
- self->cb_type = (unsigned char)cb_type;
- self->cb_subtype = (unsigned char)cb_subtype;
+ self->cb_user = cb_user;
+ self->cb_type = cb_type;
+ self->cb_subtype = cb_subtype;
PyObject_GC_Track(self);
}
diff --git a/source/blender/python/mathutils/mathutils_Vector.h b/source/blender/python/mathutils/mathutils_Vector.h
index 88de991ba43..04fd0adcda5 100644
--- a/source/blender/python/mathutils/mathutils_Vector.h
+++ b/source/blender/python/mathutils/mathutils_Vector.h
@@ -46,7 +46,8 @@ typedef struct {
/*prototypes*/
PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type);
-PyObject *Vector_CreatePyObject_cb(PyObject *user, int size, int callback_type, int subtype);
+PyObject *Vector_CreatePyObject_cb(PyObject *user, int size,
+ unsigned char cb_type, unsigned char subtype);
PyObject *Vector_CreatePyObject_alloc(float *vec, const int size, PyTypeObject *base_type);
#endif /* __MATHUTILS_VECTOR_H__ */
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index bddd8027f93..cca62621e06 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -99,11 +99,11 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject *
return NULL;
}
- if ( BaseMath_ReadCallback(vec1) == -1 ||
- BaseMath_ReadCallback(vec2) == -1 ||
- BaseMath_ReadCallback(vec3) == -1 ||
- BaseMath_ReadCallback(ray) == -1 ||
- BaseMath_ReadCallback(ray_off) == -1)
+ if (BaseMath_ReadCallback(vec1) == -1 ||
+ BaseMath_ReadCallback(vec2) == -1 ||
+ BaseMath_ReadCallback(vec3) == -1 ||
+ BaseMath_ReadCallback(ray) == -1 ||
+ BaseMath_ReadCallback(ray_off) == -1)
{
return NULL;
}
@@ -199,10 +199,10 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
return NULL;
}
- if ( BaseMath_ReadCallback(vec1) == -1 ||
- BaseMath_ReadCallback(vec2) == -1 ||
- BaseMath_ReadCallback(vec3) == -1 ||
- BaseMath_ReadCallback(vec4) == -1)
+ if (BaseMath_ReadCallback(vec1) == -1 ||
+ BaseMath_ReadCallback(vec2) == -1 ||
+ BaseMath_ReadCallback(vec3) == -1 ||
+ BaseMath_ReadCallback(vec4) == -1)
{
return NULL;
}
@@ -298,9 +298,9 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- if ( BaseMath_ReadCallback(vec1) == -1 ||
- BaseMath_ReadCallback(vec2) == -1 ||
- BaseMath_ReadCallback(vec3) == -1)
+ if (BaseMath_ReadCallback(vec1) == -1 ||
+ BaseMath_ReadCallback(vec2) == -1 ||
+ BaseMath_ReadCallback(vec3) == -1)
{
return NULL;
}
@@ -327,10 +327,10 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- if ( BaseMath_ReadCallback(vec1) == -1 ||
- BaseMath_ReadCallback(vec2) == -1 ||
- BaseMath_ReadCallback(vec3) == -1 ||
- BaseMath_ReadCallback(vec4) == -1)
+ if (BaseMath_ReadCallback(vec1) == -1 ||
+ BaseMath_ReadCallback(vec2) == -1 ||
+ BaseMath_ReadCallback(vec3) == -1 ||
+ BaseMath_ReadCallback(vec4) == -1)
{
return NULL;
}
@@ -374,9 +374,9 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- if ( BaseMath_ReadCallback(vec1) == -1 ||
- BaseMath_ReadCallback(vec2) == -1 ||
- BaseMath_ReadCallback(vec3) == -1)
+ if (BaseMath_ReadCallback(vec1) == -1 ||
+ BaseMath_ReadCallback(vec2) == -1 ||
+ BaseMath_ReadCallback(vec3) == -1)
{
return NULL;
}
@@ -424,10 +424,10 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj
return NULL;
}
- if ( BaseMath_ReadCallback(line_a1) == -1 ||
- BaseMath_ReadCallback(line_a2) == -1 ||
- BaseMath_ReadCallback(line_b1) == -1 ||
- BaseMath_ReadCallback(line_b2) == -1)
+ if (BaseMath_ReadCallback(line_a1) == -1 ||
+ BaseMath_ReadCallback(line_a2) == -1 ||
+ BaseMath_ReadCallback(line_b1) == -1 ||
+ BaseMath_ReadCallback(line_b2) == -1)
{
return NULL;
}
@@ -474,10 +474,10 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
return NULL;
}
- if ( BaseMath_ReadCallback(line_a) == -1 ||
- BaseMath_ReadCallback(line_b) == -1 ||
- BaseMath_ReadCallback(plane_co) == -1 ||
- BaseMath_ReadCallback(plane_no) == -1)
+ if (BaseMath_ReadCallback(line_a) == -1 ||
+ BaseMath_ReadCallback(line_b) == -1 ||
+ BaseMath_ReadCallback(plane_co) == -1 ||
+ BaseMath_ReadCallback(plane_no) == -1)
{
return NULL;
}
@@ -530,10 +530,10 @@ static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObje
return NULL;
}
- if ( BaseMath_ReadCallback(plane_a_co) == -1 ||
- BaseMath_ReadCallback(plane_a_no) == -1 ||
- BaseMath_ReadCallback(plane_b_co) == -1 ||
- BaseMath_ReadCallback(plane_b_no) == -1)
+ if (BaseMath_ReadCallback(plane_a_co) == -1 ||
+ BaseMath_ReadCallback(plane_a_no) == -1 ||
+ BaseMath_ReadCallback(plane_b_co) == -1 ||
+ BaseMath_ReadCallback(plane_b_no) == -1)
{
return NULL;
}
@@ -592,9 +592,9 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
return NULL;
}
- if ( BaseMath_ReadCallback(line_a) == -1 ||
- BaseMath_ReadCallback(line_b) == -1 ||
- BaseMath_ReadCallback(sphere_co) == -1)
+ if (BaseMath_ReadCallback(line_a) == -1 ||
+ BaseMath_ReadCallback(line_b) == -1 ||
+ BaseMath_ReadCallback(sphere_co) == -1)
{
return NULL;
}
@@ -613,17 +613,17 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
PyObject *ret = PyTuple_New(2);
switch (isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
- case 1:
- if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
- use_b = FALSE;
- break;
- case 2:
- if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
- if (!(!clip || (((lambda = line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE;
- break;
- default:
- use_a = FALSE;
- use_b = FALSE;
+ case 1:
+ if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+ use_b = FALSE;
+ break;
+ case 2:
+ if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+ if (!(!clip || (((lambda = line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE;
+ break;
+ default:
+ use_a = FALSE;
+ use_b = FALSE;
}
if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 3, Py_NEW, NULL)); }
@@ -672,9 +672,9 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
return NULL;
}
- if ( BaseMath_ReadCallback(line_a) == -1 ||
- BaseMath_ReadCallback(line_b) == -1 ||
- BaseMath_ReadCallback(sphere_co) == -1)
+ if (BaseMath_ReadCallback(line_a) == -1 ||
+ BaseMath_ReadCallback(line_b) == -1 ||
+ BaseMath_ReadCallback(sphere_co) == -1)
{
return NULL;
}
@@ -686,17 +686,17 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
PyObject *ret = PyTuple_New(2);
switch (isect_line_sphere_v2(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
- case 1:
- if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
- use_b = FALSE;
- break;
- case 2:
- if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
- if (!(!clip || (((lambda = line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE;
- break;
- default:
- use_a = FALSE;
- use_b = FALSE;
+ case 1:
+ if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+ use_b = FALSE;
+ break;
+ case 2:
+ if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+ if (!(!clip || (((lambda = line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE;
+ break;
+ default:
+ use_a = FALSE;
+ use_b = FALSE;
}
if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 2, Py_NEW, NULL)); }
@@ -737,9 +737,9 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec
return NULL;
}
- if ( BaseMath_ReadCallback(pt) == -1 ||
- BaseMath_ReadCallback(line_1) == -1 ||
- BaseMath_ReadCallback(line_2) == -1)
+ if (BaseMath_ReadCallback(pt) == -1 ||
+ BaseMath_ReadCallback(line_1) == -1 ||
+ BaseMath_ReadCallback(line_2) == -1)
{
return NULL;
}
@@ -791,10 +791,10 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj
return NULL;
}
- if ( BaseMath_ReadCallback(pt_vec) == -1 ||
- BaseMath_ReadCallback(tri_p1) == -1 ||
- BaseMath_ReadCallback(tri_p2) == -1 ||
- BaseMath_ReadCallback(tri_p3) == -1)
+ if (BaseMath_ReadCallback(pt_vec) == -1 ||
+ BaseMath_ReadCallback(tri_p1) == -1 ||
+ BaseMath_ReadCallback(tri_p2) == -1 ||
+ BaseMath_ReadCallback(tri_p3) == -1)
{
return NULL;
}
@@ -834,11 +834,11 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb
return NULL;
}
- if ( BaseMath_ReadCallback(pt_vec) == -1 ||
- BaseMath_ReadCallback(quad_p1) == -1 ||
- BaseMath_ReadCallback(quad_p2) == -1 ||
- BaseMath_ReadCallback(quad_p3) == -1 ||
- BaseMath_ReadCallback(quad_p4) == -1)
+ if (BaseMath_ReadCallback(pt_vec) == -1 ||
+ BaseMath_ReadCallback(quad_p1) == -1 ||
+ BaseMath_ReadCallback(quad_p2) == -1 ||
+ BaseMath_ReadCallback(quad_p3) == -1 ||
+ BaseMath_ReadCallback(quad_p4) == -1)
{
return NULL;
}
@@ -872,9 +872,9 @@ static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyOb
return NULL;
}
- if ( BaseMath_ReadCallback(pt) == -1 ||
- BaseMath_ReadCallback(plene_co) == -1 ||
- BaseMath_ReadCallback(plane_no) == -1)
+ if (BaseMath_ReadCallback(pt) == -1 ||
+ BaseMath_ReadCallback(plene_co) == -1 ||
+ BaseMath_ReadCallback(plane_no) == -1)
{
return NULL;
}
@@ -923,13 +923,13 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje
return NULL;
}
- if ( vec_pt->size != 3 ||
- vec_t1_src->size != 3 ||
- vec_t2_src->size != 3 ||
- vec_t3_src->size != 3 ||
- vec_t1_tar->size != 3 ||
- vec_t2_tar->size != 3 ||
- vec_t3_tar->size != 3)
+ if (vec_pt->size != 3 ||
+ vec_t1_src->size != 3 ||
+ vec_t2_src->size != 3 ||
+ vec_t3_src->size != 3 ||
+ vec_t1_tar->size != 3 ||
+ vec_t2_tar->size != 3 ||
+ vec_t3_tar->size != 3)
{
PyErr_SetString(PyExc_ValueError,
"One of more of the vector arguments wasn't a 3D vector");
@@ -993,10 +993,10 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject
return NULL;
}
- if ( BaseMath_ReadCallback(vec_k1) == -1 ||
- BaseMath_ReadCallback(vec_h1) == -1 ||
- BaseMath_ReadCallback(vec_k2) == -1 ||
- BaseMath_ReadCallback(vec_h2) == -1)
+ if (BaseMath_ReadCallback(vec_k1) == -1 ||
+ BaseMath_ReadCallback(vec_h1) == -1 ||
+ BaseMath_ReadCallback(vec_k2) == -1 ||
+ BaseMath_ReadCallback(vec_h2) == -1)
{
return NULL;
}
@@ -1023,8 +1023,8 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject
}
-PyDoc_STRVAR(M_Geometry_tesselate_polygon_doc,
-".. function:: tesselate_polygon(veclist_list)\n"
+PyDoc_STRVAR(M_Geometry_tessellate_polygon_doc,
+".. function:: tessellate_polygon(veclist_list)\n"
"\n"
" Takes a list of polylines (each point a vector) and returns the point indices for a polyline filled with triangles.\n"
"\n"
@@ -1032,7 +1032,7 @@ PyDoc_STRVAR(M_Geometry_tesselate_polygon_doc,
" :rtype: list\n"
);
/* PolyFill function, uses Blenders scanfill to fill multiple poly lines */
-static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq)
+static PyObject *M_Geometry_tessellate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq)
{
PyObject *tri_list; /*return this list of tri's */
PyObject *polyLine, *polyVec;
@@ -1063,7 +1063,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
}
len_polypoints = PySequence_Size(polyLine);
- if (len_polypoints > 0) { /* dont bother adding edges as polylines */
+ if (len_polypoints > 0) { /* don't bother adding edges as polylines */
#if 0
if (EXPP_check_sequence_consistency(polyLine, &vector_Type) != 1) {
freedisplist(&dispbase);
@@ -1141,7 +1141,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
freedisplist(&dispbase);
}
else {
- /* no points, do this so scripts dont barf */
+ /* no points, do this so scripts don't barf */
freedisplist(&dispbase); /* possible some dl was allocated */
tri_list = PyList_New(0);
}
@@ -1280,7 +1280,7 @@ static PyMethodDef M_Geometry_methods[] = {
{"barycentric_transform", (PyCFunction) M_Geometry_barycentric_transform, METH_VARARGS, M_Geometry_barycentric_transform_doc},
#ifndef MATH_STANDALONE
{"interpolate_bezier", (PyCFunction) M_Geometry_interpolate_bezier, METH_VARARGS, M_Geometry_interpolate_bezier_doc},
- {"tesselate_polygon", (PyCFunction) M_Geometry_tesselate_polygon, METH_O, M_Geometry_tesselate_polygon_doc},
+ {"tessellate_polygon", (PyCFunction) M_Geometry_tessellate_polygon, METH_O, M_Geometry_tessellate_polygon_doc},
{"box_pack_2d", (PyCFunction) M_Geometry_box_pack_2d, METH_O, M_Geometry_box_pack_2d_doc},
#endif
{NULL, NULL, 0, NULL}
diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
index 8114e32a5fb..03295ac2752 100644
--- a/source/blender/python/mathutils/mathutils_noise.c
+++ b/source/blender/python/mathutils/mathutils_noise.c
@@ -199,7 +199,7 @@ static float frand(void)
/* Fills an array of length size with random numbers in the range (-1, 1)*/
static void rand_vn(float *array_tar, const int size)
{
- float *array_pt = array_tar + (size-1);
+ float *array_pt = array_tar + (size - 1);
int i = size;
while (i--) { *(array_pt--) = 2.0f * frand() - 1.0f; }
}
@@ -335,7 +335,7 @@ PyDoc_STRVAR(M_Noise_random_vector_doc,
static PyObject *M_Noise_random_vector(PyObject *UNUSED(self), PyObject *args)
{
float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f};
- int size= 3;
+ int size = 3;
if (!PyArg_ParseTuple(args, "|i:random_vector", &size))
return NULL;
@@ -484,7 +484,7 @@ static PyObject *M_Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *arg
PyObject *value;
float vec[3], r_vec[3];
int oct, hd, nb = 1;
- float as =0.5f, fs = 2.0f;
+ float as = 0.5f, fs = 2.0f;
if (!PyArg_ParseTuple(args, "Oii|iff:turbulence_vector", &value, &oct, &hd, &nb, &as, &fs))
return NULL;
diff --git a/source/blender/python/simple_enum_gen.py b/source/blender/python/simple_enum_gen.py
index ec2eead522c..7e54f3dbb41 100644
--- a/source/blender/python/simple_enum_gen.py
+++ b/source/blender/python/simple_enum_gen.py
@@ -40,7 +40,7 @@ defs = """
"""
print '\tmod = PyModule_New("dummy");'
-print '\tPyModule_AddObject( submodule, "key", mod );'
+print '\tPyModule_AddObject(submodule, "key", mod);'
for d in defs.split('\n'):
@@ -58,7 +58,7 @@ for d in defs.split('\n'):
val = w[0]
py_val = w[0]
- print '\tPyModule_AddObject( mod, "%s", PyLong_FromSize_t(%s) );' % (val, py_val)
+ print '\tPyModule_AddObject(mod, "%s", PyLong_FromSize_t(%s));' % (val, py_val)
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m
index db47952e45f..b4a89eae89e 100644
--- a/source/blender/quicktime/apple/qtkit_export.m
+++ b/source/blender/quicktime/apple/qtkit_export.m
@@ -243,7 +243,7 @@ void filepath_qt(char *string, RenderData *rd)
BLI_make_existing_file(string);
if (!BLI_testextensie(string, ".mov")) {
- /* if we dont have any #'s to insert numbers into, use 4 numbers by default */
+ /* if we don't have any #'s to insert numbers into, use 4 numbers by default */
if (strchr(string, '#')==NULL)
strcat(string, "####"); /* 4 numbers */
@@ -485,7 +485,8 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
qtexport->audioFile = NULL;
[qtexport->audioFileName release];
qtexport->audioFileName = nil;
- } else {
+ }
+ else {
UInt32 prop,propSize;
/* Set up codec properties */
if (rd->qtcodecsettings.audiocodecType == kAudioFormatMPEG4AAC) { /*Lossy compressed format*/
@@ -535,7 +536,8 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
qtexport->movie = [[QTMovie alloc] initToWritableFile:qtexport->videoTempFileName error:&error];
}
- } else
+ }
+ else
qtexport->movie = [[QTMovie alloc] initToWritableFile:qtexport->filename error:&error];
if(qtexport->movie == nil) {
@@ -548,7 +550,8 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
if (qtexport->videoTempFileName) [qtexport->videoTempFileName release];
qtexport->videoTempFileName = nil;
[QTMovie exitQTKitOnThread];
- } else {
+ }
+ else {
[qtexport->movie retain];
[qtexport->movie setAttribute:[NSNumber numberWithBool:YES] forKey:QTMovieEditableAttribute];
[qtexport->movie setAttribute:@"Made with Blender" forKey:QTMovieCopyrightAttribute];
@@ -661,7 +664,8 @@ int append_qt(struct RenderData *rd, int start_frame, int frame, int *pixels, in
if (qtexport->audioOutputFormat.mFramesPerPacket) {
// this is the common case: format has constant frames per packet
qtexport->audioTotalSavedFrames += (audioPacketsConverted * qtexport->audioOutputFormat.mFramesPerPacket);
- } else {
+ }
+ else {
unsigned int i;
// if there are variable frames per packet, then we have to do this for each packeet
for (i = 0; i < audioPacketsConverted; ++i)
diff --git a/source/blender/quicktime/apple/qtkit_import.m b/source/blender/quicktime/apple/qtkit_import.m
index 633d92e05c1..197cbdc2f0b 100644
--- a/source/blender/quicktime/apple/qtkit_import.m
+++ b/source/blender/quicktime/apple/qtkit_import.m
@@ -81,7 +81,7 @@ int anim_is_quicktime (const char *name)
{
NSAutoreleasePool *pool;
- // dont let quicktime movie import handle these
+ // don't let quicktime movie import handle these
if( BLI_testextensie(name, ".swf") ||
BLI_testextensie(name, ".txt") ||
BLI_testextensie(name, ".mpg") ||
@@ -396,7 +396,7 @@ int imb_is_a_quicktime (char *name)
pool = [[NSAutoreleasePool alloc] init];
- // dont let quicktime image import handle these
+ // don't let quicktime image import handle these
if( BLI_testextensie(name, ".swf") ||
BLI_testextensie(name, ".txt") ||
BLI_testextensie(name, ".mpg") ||
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c
index 6a4413fdc8d..599268b225a 100644
--- a/source/blender/quicktime/apple/quicktime_export.c
+++ b/source/blender/quicktime/apple/quicktime_export.c
@@ -187,7 +187,7 @@ int quicktime_videocodecType_from_rnatmpvalue(int rnatmpvalue)
static void CheckError(OSErr err, char *msg, ReportList *reports)
{
- if(err != noErr) {
+ if (err != noErr) {
BKE_reportf(reports, RPT_ERROR, "%s: %d", msg, err);
}
}
@@ -207,7 +207,8 @@ static OSErr QT_SaveCodecSettingsToScene(RenderData *rd, ReportList *reports)
// check if current scene already has qtcodec settings, and clear them
if (qcd) {
free_qtcodecdata(qcd);
- } else {
+ }
+ else {
qcd = rd->qtcodecdata = MEM_callocN(sizeof(QuicktimeCodecData), "QuicktimeCodecData");
}
@@ -237,7 +238,8 @@ static OSErr QT_SaveCodecSettingsToScene(RenderData *rd, ReportList *reports)
qcd->cdSize = mySize;
GetCodecInfo (&ci, qtdata->gSpatialSettings.codecType, 0);
- } else {
+ }
+ else {
BKE_reportf(reports, RPT_ERROR, "Quicktime: QT_SaveCodecSettingsToScene failed\n");
}
@@ -265,7 +267,7 @@ static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
}
// restore codecsettings to the quicktime component
- if(qcd->cdParms && qcd->cdSize) {
+ if (qcd->cdParms && qcd->cdSize) {
myErr = SCSetSettingsFromAtomContainer((GraphicsExportComponent)qtdata->theComponent, (QTAtomContainer)myHandle);
if (myErr != noErr) {
BKE_reportf(reports, RPT_ERROR, "Quicktime: SCSetSettingsFromAtomContainer failed\n");
@@ -293,7 +295,8 @@ static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
rd->qtcodecsettings.minTemporalQuality = (qtdata->aDataRateSetting.minTemporalQuality * 100) / codecLosslessQuality;
//Frame duration is already known (qtdata->aDataRateSetting.frameDuration)
- } else {
+ }
+ else {
BKE_reportf(reports, RPT_ERROR, "Quicktime: QT_GetCodecSettingsFromScene failed\n");
}
bail:
@@ -411,8 +414,8 @@ static void QT_StartAddVideoSamplesToMedia (const Rect *trackFrame, int rectx, i
// the new callback based api for proper encoding, but that's not
// really compatible with rendering out frames sequentially
gTemporalSettings = qtdata->gTemporalSettings;
- if(qtdata->gSpatialSettings.codecType == kH264CodecType) {
- if(gTemporalSettings.temporalQuality != codecMinQuality) {
+ if (qtdata->gSpatialSettings.codecType == kH264CodecType) {
+ if (gTemporalSettings.temporalQuality != codecMinQuality) {
BKE_reportf(reports, RPT_WARNING, "Only minimum quality compression supported for QuickTime H.264.\n");
gTemporalSettings.temporalQuality = codecMinQuality;
}
@@ -455,7 +458,7 @@ static void QT_DoAddVideoSamplesToMedia (int frame, int *pixels, int rectx, int
//parse RGBA bitmap into Quicktime's ARGB GWorld
boxsize = rectx * recty;
- for( index = 0; index < boxsize; index++) {
+ for ( index = 0; index < boxsize; index++) {
to[0] = from[3];
to[1] = from[0];
to[2] = from[1];
@@ -533,18 +536,19 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
#endif
int success= 1;
- if(qtexport == NULL) qtexport = MEM_callocN(sizeof(QuicktimeExport), "QuicktimeExport");
+ if (qtexport == NULL) qtexport = MEM_callocN(sizeof(QuicktimeExport), "QuicktimeExport");
- if(qtdata) {
- if(qtdata->theComponent) CloseComponent(qtdata->theComponent);
+ if (qtdata) {
+ if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
free_qtcomponentdata();
}
qtdata = MEM_callocN(sizeof(QuicktimeComponentData), "QuicktimeCodecDataExt");
- if(rd->qtcodecdata == NULL || rd->qtcodecdata->cdParms == NULL) {
+ if (rd->qtcodecdata == NULL || rd->qtcodecdata->cdParms == NULL) {
get_qtcodec_settings(rd, reports);
- } else {
+ }
+ else {
qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
QT_GetCodecSettingsFromScene(rd, reports);
@@ -589,13 +593,14 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
&qtexport->theMovie );
CheckError(err, "CreateMovieFile error", reports);
- if(err != noErr) {
+ if (err != noErr) {
BKE_reportf(reports, RPT_ERROR, "Unable to create Quicktime movie: %s", name);
success= 0;
#ifdef __APPLE__
ExitMoviesOnThread();
#endif
- } else {
+ }
+ else {
//printf("Created QuickTime movie: %s\n", name);
QT_CreateMyVideoTrack(rectx, recty, reports);
@@ -617,7 +622,7 @@ void end_qt(void)
OSErr err = noErr;
short resId = movieInDataForkResID;
- if(qtexport->theMovie) {
+ if (qtexport->theMovie) {
QT_EndCreateMyVideoTrack(NULL);
err = AddMovieResource (qtexport->theMovie, qtexport->resRefNum, &resId, qtexport->qtfilename);
@@ -629,7 +634,7 @@ void end_qt(void)
err = UpdateMovieResource(qtexport->theMovie, qtexport->resRefNum, resId, qtexport->qtfilename);
CheckError(err, "UpdateMovieResource error", NULL);
- if(qtexport->resRefNum) CloseMovieFile(qtexport->resRefNum);
+ if (qtexport->resRefNum) CloseMovieFile(qtexport->resRefNum);
DisposeMovie(qtexport->theMovie);
@@ -640,7 +645,7 @@ void end_qt(void)
ExitMoviesOnThread();
#endif
- if(qtexport) {
+ if (qtexport) {
MEM_freeN(qtexport);
qtexport = NULL;
}
@@ -649,8 +654,8 @@ void end_qt(void)
void free_qtcomponentdata(void)
{
- if(qtdata) {
- if(qtdata->theComponent) CloseComponent(qtdata->theComponent);
+ if (qtdata) {
+ if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
MEM_freeN(qtdata);
qtdata = NULL;
}
@@ -665,7 +670,7 @@ static void check_renderbutton_framerate(RenderData *rd, ReportList *reports)
err = SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
CheckError(err, "SCGetInfo fr error", reports);
- if( (rd->frs_sec == 24 || rd->frs_sec == 30 || rd->frs_sec == 60) &&
+ if ( (rd->frs_sec == 24 || rd->frs_sec == 30 || rd->frs_sec == 60) &&
(qtdata->gTemporalSettings.frameRate == 1571553 ||
qtdata->gTemporalSettings.frameRate == 1964113 ||
qtdata->gTemporalSettings.frameRate == 3928227))
@@ -681,16 +686,19 @@ static void check_renderbutton_framerate(RenderData *rd, ReportList *reports)
err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
CheckError( err, "SCSetInfo error", reports );
- if(qtdata->gTemporalSettings.frameRate == 1571553) { // 23.98 fps
+ if (qtdata->gTemporalSettings.frameRate == 1571553) { // 23.98 fps
qtdata->kVideoTimeScale = 24000;
qtdata->duration = 1001;
- } else if (qtdata->gTemporalSettings.frameRate == 1964113) { // 29.97 fps
+ }
+ else if (qtdata->gTemporalSettings.frameRate == 1964113) { // 29.97 fps
qtdata->kVideoTimeScale = 30000;
qtdata->duration = 1001;
- } else if (qtdata->gTemporalSettings.frameRate == 3928227) { // 59.94 fps
+ }
+ else if (qtdata->gTemporalSettings.frameRate == 3928227) { // 59.94 fps
qtdata->kVideoTimeScale = 60000;
qtdata->duration = 1001;
- } else {
+ }
+ else {
qtdata->kVideoTimeScale = (qtdata->gTemporalSettings.frameRate >> 16) * 100;
qtdata->duration = 100;
}
@@ -717,8 +725,8 @@ int get_qtcodec_settings(RenderData *rd, ReportList *reports)
{
OSErr err = noErr;
// erase any existing codecsetting
- if(qtdata) {
- if(qtdata->theComponent) CloseComponent(qtdata->theComponent);
+ if (qtdata) {
+ if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
free_qtcomponentdata();
}
@@ -727,9 +735,10 @@ int get_qtcodec_settings(RenderData *rd, ReportList *reports)
qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
// get previous selected codecsetting, from qtatom or detailed settings
- if(rd->qtcodecdata && rd->qtcodecdata->cdParms) {
+ if (rd->qtcodecdata && rd->qtcodecdata->cdParms) {
QT_GetCodecSettingsFromScene(rd, reports);
- } else {
+ }
+ else {
SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
@@ -768,8 +777,8 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op)
RenderData *rd = &scene->r;
// erase any existing codecsetting
- if(qtdata) {
- if(qtdata->theComponent) CloseComponent(qtdata->theComponent);
+ if (qtdata) {
+ if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
free_qtcomponentdata();
}
@@ -778,9 +787,10 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op)
qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
// get previous selected codecsetting, from qtatom or detailed settings
- if(rd->qtcodecdata && rd->qtcodecdata->cdParms) {
+ if (rd->qtcodecdata && rd->qtcodecdata->cdParms) {
QT_GetCodecSettingsFromScene(rd, op->reports);
- } else {
+ }
+ else {
SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
@@ -836,25 +846,28 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op)
QT_SaveCodecSettingsToScene(rd, op->reports);
// framerate jugglin'
- if(qtdata->gTemporalSettings.frameRate == 1571553) { // 23.98 fps
+ if (qtdata->gTemporalSettings.frameRate == 1571553) { // 23.98 fps
qtdata->kVideoTimeScale = 24000;
qtdata->duration = 1001;
rd->frs_sec = 24;
rd->frs_sec_base = 1.001;
- } else if (qtdata->gTemporalSettings.frameRate == 1964113) { // 29.97 fps
+ }
+ else if (qtdata->gTemporalSettings.frameRate == 1964113) { // 29.97 fps
qtdata->kVideoTimeScale = 30000;
qtdata->duration = 1001;
rd->frs_sec = 30;
rd->frs_sec_base = 1.001;
- } else if (qtdata->gTemporalSettings.frameRate == 3928227) { // 59.94 fps
+ }
+ else if (qtdata->gTemporalSettings.frameRate == 3928227) { // 59.94 fps
qtdata->kVideoTimeScale = 60000;
qtdata->duration = 1001;
rd->frs_sec = 60;
rd->frs_sec_base = 1.001;
- } else {
+ }
+ else {
double fps = qtdata->gTemporalSettings.frameRate;
qtdata->kVideoTimeScale = 60000;
@@ -863,7 +876,8 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op)
if ((qtdata->gTemporalSettings.frameRate & 0xffff) == 0) {
rd->frs_sec = fps / 65536;
rd->frs_sec_base = 1.0;
- } else {
+ }
+ else {
/* we do our very best... */
rd->frs_sec = fps / 65536;
rd->frs_sec_base = 1.0;
@@ -893,20 +907,20 @@ int fromcocoa_request_qtcodec_settings(bContext *C, wmOperator *op)
void SCENE_OT_render_data_set_quicktime_codec(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Change codec";
- ot->description= "Change Quicktime codec Settings";
- ot->idname= "SCENE_OT_render_data_set_quicktime_codec";
+ ot->name = "Change codec";
+ ot->description = "Change Quicktime codec Settings";
+ ot->idname = "SCENE_OT_render_data_set_quicktime_codec";
/* api callbacks */
#if defined(__APPLE__) && defined(GHOST_COCOA)
ot->exec = cocoa_request_qtcodec_settings;
#else
- ot->exec= request_qtcodec_settings;
+ ot->exec = request_qtcodec_settings;
#endif
- ot->poll= ED_operator_setqtcodec;
+ ot->poll = ED_operator_setqtcodec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
#endif /* USE_QTKIT */
diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c
index a7d09682a14..a1f35935877 100644
--- a/source/blender/quicktime/apple/quicktime_import.c
+++ b/source/blender/quicktime/apple/quicktime_import.c
@@ -125,7 +125,7 @@ void quicktime_exit(void)
{
#if defined(_WIN32) || defined(__APPLE__)
#ifdef WITH_QUICKTIME
- if(G.have_quicktime) {
+ if (G.have_quicktime) {
free_qtcomponentdata();
ExitMovies();
#ifdef _WIN32
@@ -147,22 +147,24 @@ char *get_valid_qtname(char *name)
dwRet = GetCurrentDirectory(MAX_PATH, Buffer);
- if(name[1] != ':') {
+ if (name[1] != ':') {
char drive[2];
- if(name[0] == '/' || name[0] == '\\') {
+ if (name[0] == '/' || name[0] == '\\') {
drive[0] = Buffer[0];
drive[1] = '\0';
BLI_dynstr_append(ds, drive);
BLI_dynstr_append(ds, ":");
BLI_dynstr_append(ds, name);
- } else {
+ }
+ else {
BLI_dynstr_append(ds, Buffer);
BLI_dynstr_append(ds, "/");
BLI_dynstr_append(ds, name);
}
- } else {
+ }
+ else {
BLI_dynstr_append(ds, name);
}
@@ -191,8 +193,8 @@ int anim_is_quicktime (const char *name)
#endif
OSErr err = noErr;
- // dont let quicktime movie import handle these
- if( BLI_testextensie(name, ".swf") ||
+ // 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 ;)
@@ -204,7 +206,7 @@ int anim_is_quicktime (const char *name)
BLI_testextensie(name, ".zip") ||
BLI_testextensie(name, ".mp3")) return 0;
- if(QTIME_DEBUG) printf("qt: checking as movie: %s\n", name);
+ if (QTIME_DEBUG) printf("qt: checking as movie: %s\n", name);
#ifdef __APPLE__
sprintf(theFullPath, "%s", name);
@@ -257,16 +259,16 @@ void free_anim_quicktime (struct anim *anim)
UnlockPixels(anim->qtime->offscreenPixMap);
- if(anim->qtime->have_gw)
+ if (anim->qtime->have_gw)
DisposeGWorld( anim->qtime->offscreenGWorld );
- if(anim->qtime->ibuf)
+ if (anim->qtime->ibuf)
IMB_freeImBuf(anim->qtime->ibuf);
DisposeMovie( anim->qtime->movie );
CloseMovieFile( anim->qtime->movieRefNum );
- if(anim->qtime->frameIndex) MEM_freeN (anim->qtime->frameIndex);
- if(anim->qtime) MEM_freeN (anim->qtime);
+ if (anim->qtime->frameIndex) MEM_freeN (anim->qtime->frameIndex);
+ if (anim->qtime) MEM_freeN (anim->qtime);
anim->qtime = NULL;
@@ -305,7 +307,7 @@ static OSErr QT_get_frameIndexes(struct anim *anim)
GetMovieNextInterestingTime(anim->qtime->movie, nextTimeMediaSample, 1, &media, (TimeValue)1, 0, &tmpstartPoint, NULL);
anim->qtime->frameIndex[0] = startPoint;
- for(i = 1; i < anim->qtime->framecount; i++) {
+ for (i = 1; i < anim->qtime->framecount; i++) {
nextTime = 0;
GetMovieNextInterestingTime(anim->qtime->movie, nextTimeMediaSample, 1, &media, startPoint, 0, &nextTime, NULL);
startPoint = nextTime;
@@ -367,7 +369,7 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position)
from= (unsigned char *)readPos;
to= (unsigned char *)changePos;
- for( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
+ for ( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
to[3] = from[0];
to[0] = from[1];
to[1] = from[2];
@@ -376,14 +378,14 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position)
#endif
#ifdef _WIN32
- for( index = 0; index < boxsize; index++, changePos++, readPos++ )
+ for ( index = 0; index < boxsize; index++, changePos++, readPos++ )
*( changePos ) = *(readPos );
- if(anim->qtime->depth < 32) {
+ if (anim->qtime->depth < 32) {
//add alpha to ibuf
boxsize = anim->x * anim->y * 4;
crect = (unsigned char *) rect;
- for( index = 0; index < boxsize; index+=4, crect+=4 ) {
+ for ( index = 0; index < boxsize; index+=4, crect+=4 ) {
crect[3] = 0xFF;
}
}
@@ -425,7 +427,7 @@ static short GetFirstVideoTrackPixelDepth(struct anim *anim)
SampleDescriptionHandle imageDescH = (SampleDescriptionHandle)NewHandle(sizeof(Handle));
// long trackIndex = 0; /*unused*/
- if(!GetFirstVideoMedia(anim))
+ if (!GetFirstVideoMedia(anim))
return -1;
if (!anim->qtime->trackIndex || !anim->qtime->theMedia) return -1; // we need both
@@ -453,11 +455,11 @@ int startquicktime (struct anim *anim)
anim->qtime->have_gw = FALSE;
if (anim->qtime == NULL) {
- if(QTIME_DEBUG) printf("Can't alloc qtime: %s\n", anim->name);
+ if (QTIME_DEBUG) printf("Can't alloc qtime: %s\n", anim->name);
return -1;
}
- if(QTIME_DEBUG) printf("qt: attempting to load as movie %s\n", anim->name);
+ if (QTIME_DEBUG) printf("qt: attempting to load as movie %s\n", anim->name);
#ifdef __APPLE__
sprintf(theFullPath, "%s", anim->name);
@@ -476,18 +478,18 @@ int startquicktime (struct anim *anim)
err = OpenMovieFile(&theFSSpec, &anim->qtime->movieRefNum, fsRdPerm);
if (err == noErr) {
- if(QTIME_DEBUG) printf("qt: movie opened\n");
+ if (QTIME_DEBUG) printf("qt: movie opened\n");
err = NewMovieFromFile(&anim->qtime->movie,
anim->qtime->movieRefNum,
&anim->qtime->movieResId, NULL, newMovieActive, NULL);
}
if (err) {
- if(QTIME_DEBUG) printf("qt: bad movie %s\n", anim->name);
+ if (QTIME_DEBUG) printf("qt: bad movie %s\n", anim->name);
if (anim->qtime->movie) {
DisposeMovie(anim->qtime->movie);
MEM_freeN(anim->qtime);
- if(QTIME_DEBUG) printf("qt: can't load %s\n", anim->name);
+ if (QTIME_DEBUG) printf("qt: can't load %s\n", anim->name);
return -1;
}
}
@@ -495,10 +497,10 @@ int startquicktime (struct anim *anim)
GetMovieBox(anim->qtime->movie, &anim->qtime->movieBounds);
anim->x = anim->qtime->movWidth = RECT_WIDTH(anim->qtime->movieBounds);
anim->y = anim->qtime->movHeight = RECT_HEIGHT(anim->qtime->movieBounds);
- if(QTIME_DEBUG) printf("qt: got bounds %s\n", anim->name);
+ if (QTIME_DEBUG) printf("qt: got bounds %s\n", anim->name);
- if(anim->x == 0 && anim->y == 0) {
- if(QTIME_DEBUG) printf("qt: error, no dimensions\n");
+ if (anim->x == 0 && anim->y == 0) {
+ if (QTIME_DEBUG) printf("qt: error, no dimensions\n");
free_anim_quicktime(anim);
return -1;
}
@@ -521,7 +523,7 @@ int startquicktime (struct anim *anim)
anim->x * 4);
#endif /* _WIN32 */
- if(err == noErr) {
+ if (err == noErr) {
anim->qtime->have_gw = TRUE;
SetMovieGWorld(anim->qtime->movie,
@@ -550,7 +552,7 @@ int startquicktime (struct anim *anim)
anim->curposition = 0;
- if(QTIME_DEBUG) printf("qt: load %s %dx%dx%d frames %d\n", anim->name, anim->qtime->movWidth,
+ if (QTIME_DEBUG) printf("qt: load %s %dx%dx%d frames %d\n", anim->name, anim->qtime->movWidth,
anim->qtime->movHeight, anim->qtime->depth, anim->qtime->framecount);
return 0;
@@ -575,12 +577,12 @@ int imb_is_a_quicktime (char *name)
#endif
OSErr err = noErr;
- if(!G.have_quicktime) return 0;
+ if (!G.have_quicktime) return 0;
- if(QTIME_DEBUG) printf("qt: checking as image %s\n", name);
+ if (QTIME_DEBUG) printf("qt: checking as image %s\n", name);
- // dont let quicktime image import handle these
- if( BLI_testextensie(name, ".swf") ||
+ // 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") ||
@@ -600,7 +602,7 @@ int imb_is_a_quicktime (char *name)
GetGraphicsImporterForFile(&theFSSpec, &theImporter);
if (theImporter != NULL) {
- if(QTIME_DEBUG) printf("qt: %s valid\n", name);
+ if (QTIME_DEBUG) printf("qt: %s valid\n", name);
CloseComponent(theImporter);
return 1;
}
@@ -643,7 +645,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
if (mem == NULL || !G.have_quicktime)
goto bail;
- if(QTIME_DEBUG) printf("qt: attempt to load mem as image\n");
+ if (QTIME_DEBUG) printf("qt: attempt to load mem as image\n");
dataref= (PointerDataRef)NewHandle(sizeof(PointerDataRefRecord));
(**dataref).data = mem;
@@ -657,25 +659,25 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
kDataHCanRead,
&dataHandler);
if (err != noErr) {
- if(QTIME_DEBUG) printf("no datahandler\n");
+ if (QTIME_DEBUG) printf("no datahandler\n");
goto bail;
}
err = GetGraphicsImporterForDataRef((Handle)dataref, PointerDataHandlerSubType, &gImporter);
if (err != noErr) {
- if(QTIME_DEBUG) printf("no graphimport\n");
+ if (QTIME_DEBUG) printf("no graphimport\n");
goto bail;
}
err = GraphicsImportGetNaturalBounds(gImporter, &myRect);
if (err != noErr) {
- if(QTIME_DEBUG) printf("no bounds\n");
+ if (QTIME_DEBUG) printf("no bounds\n");
goto bail;
}
err = GraphicsImportGetImageDescription (gImporter, &desc );
if (err != noErr) {
- if(QTIME_DEBUG) printf("no imagedescription\n");
+ if (QTIME_DEBUG) printf("no imagedescription\n");
goto bail;
}
@@ -710,9 +712,10 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
#endif
if (err != noErr) {
- if(QTIME_DEBUG) printf("no newgworld\n");
+ if (QTIME_DEBUG) printf("no newgworld\n");
goto bail;
- } else {
+ }
+ else {
have_gw = TRUE;
}
@@ -740,7 +743,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
from= (unsigned char *)readPos;
to= (unsigned char *)changePos;
- for( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
+ for ( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
to[3] = from[0];
to[0] = from[1];
to[1] = from[2];
@@ -752,7 +755,7 @@ bail:
DisposeHandle((Handle)dataref);
UnlockPixels(myPixMap);
- if(have_gw) DisposeGWorld(offGWorld);
+ if (have_gw) DisposeGWorld(offGWorld);
#ifdef __APPLE__
if (wbuf) {
@@ -764,14 +767,14 @@ bail:
if (gImporter != NULL) CloseComponent(gImporter);
if (err != noErr) {
- if(QTIME_DEBUG) printf("quicktime import unsuccesfull\n");
+ if (QTIME_DEBUG) printf("quicktime import unsuccesfull\n");
if (ibuf) {
IMB_freeImBuf (ibuf);
ibuf = NULL;
}
}
- if(ibuf) {
+ if (ibuf) {
#ifdef _WIN32
// add non transparent alpha layer, so images without alpha show up in the sequence editor
@@ -781,8 +784,8 @@ bail:
int box = x * y;
unsigned char *arect = (unsigned char *) ibuf->rect;
- if( depth < 32 && (**desc).cType != kGIFCodecType) {
- for(i = 0; i < box; i++, arect+=4)
+ if ( depth < 32 && (**desc).cType != kGIFCodecType) {
+ for (i = 0; i < box; i++, arect+=4)
arect[3] = 0xFF;
}
#endif
diff --git a/source/blender/render/intern/include/sunsky.h b/source/blender/render/intern/include/sunsky.h
index 62b68484629..6a41517b113 100644
--- a/source/blender/render/intern/include/sunsky.h
+++ b/source/blender/render/intern/include/sunsky.h
@@ -79,7 +79,7 @@ void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_b
void GetSkyXYZRadiance(struct SunSky *sunsky, float theta, float phi, float color_out[3]);
void GetSkyXYZRadiancef(struct SunSky *sunsky, const float varg[3], float color_out[3]);
void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float rayf, float inscattf, float extincf, float disf);
-void AtmospherePixleShader( struct SunSky *sunSky, float view[3], float s, float rgb[3]);
+void AtmospherePixleShader(struct SunSky *sunSky, float view[3], float s, float rgb[3]);
void ClipColor(float c[3]);
#endif /*__SUNSKY_H__*/
diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp
index 3f675a1b9ab..687498ba66e 100644
--- a/source/blender/render/intern/raytrace/rayobject.cpp
+++ b/source/blender/render/intern/raytrace/rayobject.cpp
@@ -60,7 +60,7 @@ 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;
@@ -77,13 +77,13 @@ 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 : 0);
- 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);
- if(RE_rayface_isQuad(rayface))
+ if (RE_rayface_isQuad(rayface))
mul_m4_v3(obi->mat, rayface->v4);
}
}
@@ -109,11 +109,11 @@ MALWAYS_INLINE int vlr_check_intersect(Isect *is, ObjectInstanceRen *obi, VlakRe
{
/* for baking selected to active non-traceable materials might still
* be in the raytree */
- if(!(vlr->flag & R_TRACEBLE))
+ if (!(vlr->flag & R_TRACEBLE))
return 0;
/* I know... cpu cycle waste, might do smarter once */
- if(is->mode==RE_RAY_MIRROR)
+ if (is->mode==RE_RAY_MIRROR)
return !(vlr->mat->mode & MA_ONLYCAST);
else
return (is->lay & obi->lay);
@@ -159,21 +159,21 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], float dir[3], RayFace *face, fl
sub_v3_v3v3(m, start, co3);
det1= dot_v3v3(m, x);
- if(divdet != 0.0f) {
+ if (divdet != 0.0f) {
divdet= 1.0f/divdet;
v= det1*divdet;
- if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
+ if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
float cros[3];
cross_v3_v3v3(cros, m, t0);
u= divdet*dot_v3v3(cros, r);
- if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
+ if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
l= divdet*dot_v3v3(cros, t1);
/* check if intersection is within ray length */
- if(l > -RE_RAYTRACE_EPSILON && l < *lambda) {
+ if (l > -RE_RAYTRACE_EPSILON && l < *lambda) {
uv[0]= u;
uv[1]= v;
*lambda= l;
@@ -184,25 +184,25 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], float dir[3], RayFace *face, fl
}
/* intersect second triangle in quad */
- if(quad) {
+ if (quad) {
copy_v3_v3(co4, face->v4);
sub_v3_v3v3(t0, co3, co4);
divdet= dot_v3v3(t0, x);
- if(divdet != 0.0f) {
+ if (divdet != 0.0f) {
divdet= 1.0f/divdet;
v = det1*divdet;
- if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
+ if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
float cros[3];
cross_v3_v3v3(cros, m, t0);
u= divdet*dot_v3v3(cros, r);
- if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
+ if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
l= divdet*dot_v3v3(cros, t1);
- if(l >- RE_RAYTRACE_EPSILON && l < *lambda) {
+ if (l >- RE_RAYTRACE_EPSILON && l < *lambda) {
uv[0]= u;
uv[1]= -(1.0f + v + u);
*lambda= l;
@@ -242,38 +242,38 @@ MALWAYS_INLINE int isec_tri_quad_neighbour(float start[3], float dir[3], RayFace
sub_v3_v3v3(m, start, co3);
det1= dot_v3v3(m, x);
- if(divdet != 0.0f) {
+ if (divdet != 0.0f) {
divdet= 1.0f/divdet;
v= det1*divdet;
- if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
+ if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
float cros[3];
cross_v3_v3v3(cros, m, t0);
u= divdet*dot_v3v3(cros, r);
- if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
+ if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
return 1;
}
}
/* intersect second triangle in quad */
- if(quad) {
+ if (quad) {
copy_v3_v3(co4, face->v4);
sub_v3_v3v3(t0, co3, co4);
divdet= dot_v3v3(t0, x);
- if(divdet != 0.0f) {
+ if (divdet != 0.0f) {
divdet= 1.0f/divdet;
v = det1*divdet;
- if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
+ if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
float cros[3];
cross_v3_v3v3(cros, m, t0);
u= divdet*dot_v3v3(cros, r);
- if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
+ if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
return 2;
}
}
@@ -291,24 +291,24 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
int ok= 0;
/* avoid self-intersection */
- if(is->orig.ob == face->ob && is->orig.face == face->face)
+ if (is->orig.ob == face->ob && is->orig.face == face->face)
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)
+ 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)
+ 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)
+ if (vlr_check_intersect_solid(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
return 0;
}
- else if(is->check == RE_CHECK_VLR_BAKE) {
- if(vlr_check_bake(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
+ else if (is->check == RE_CHECK_VLR_BAKE) {
+ if (vlr_check_bake(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
return 0;
}
@@ -318,13 +318,13 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
dist= is->dist;
ok= isec_tri_quad(is->start, is->dir, face, uv, &dist);
- if(ok) {
+ if (ok) {
/* 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 (is->skip & RE_SKIP_VLR_NEIGHBOUR)
{
- if(dist < 0.1f && is->orig.ob == face->ob)
+ if (dist < 0.1f && is->orig.ob == face->ob)
{
VlakRen * a = (VlakRen*)is->orig.face;
VlakRen * b = (VlakRen*)face->face;
@@ -332,7 +332,7 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
/* 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
+ 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))) {
@@ -341,7 +341,7 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
ObjectInstanceRen *ob= (ObjectInstanceRen*)is->orig.ob;
rayface_from_vlak(&origface, ob, (VlakRen*)is->orig.face);
- if(!isec_tri_quad_neighbour(is->start, is->dir, &origface))
+ if (!isec_tri_quad_neighbour(is->start, is->dir, &origface))
{
return 0;
}
@@ -375,7 +375,7 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
RE_RC_COUNT(isec->raycounter->raycast.test);
/* setup vars used on raycast */
- for(i=0; i<3; i++)
+ for (i=0; i<3; i++)
{
isec->idot_axis[i] = 1.0f / isec->dir[i];
@@ -388,11 +388,11 @@ 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);
@@ -405,7 +405,7 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
isec->hit_hint = 0;
#endif
- if(RE_rayobject_intersect(r, isec))
+ if (RE_rayobject_intersect(r, isec))
{
RE_RC_COUNT(isec->raycounter->raycast.hit);
@@ -420,11 +420,11 @@ 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);
@@ -433,7 +433,7 @@ int RE_rayobject_intersect(RayObject *r, Isect *i)
return intersect_rayface(r, &nface, i);
}
- else if(RE_rayobject_isRayAPI(r))
+ else if (RE_rayobject_isRayAPI(r))
{
r = RE_rayobject_align(r);
return r->api->raycast(r, i);
@@ -466,11 +466,11 @@ void RE_rayobject_free(RayObject *r)
float RE_rayobject_cost(RayObject *r)
{
- if(RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
+ if (RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
{
return 1.0f;
}
- else if(RE_rayobject_isRayAPI(r))
+ else if (RE_rayobject_isRayAPI(r))
{
r = RE_rayobject_align(r);
return r->api->cost(r);
@@ -485,16 +485,16 @@ 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);
DO_MINMAX(face->v2, min, max);
DO_MINMAX(face->v3, min, max);
- if(RE_rayface_isQuad(face)) DO_MINMAX(face->v4, 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;
@@ -503,9 +503,9 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
DO_MINMAX(nface.v1, min, max);
DO_MINMAX(nface.v2, min, max);
DO_MINMAX(nface.v3, min, max);
- if(RE_rayface_isQuad(&nface)) DO_MINMAX(nface.v4, min, max);
+ if (RE_rayface_isQuad(&nface)) DO_MINMAX(nface.v4, min, max);
}
- else if(RE_rayobject_isRayAPI(r))
+ else if (RE_rayobject_isRayAPI(r))
{
r = RE_rayobject_align(r);
r->api->bb(r, min, max);
@@ -518,11 +518,11 @@ 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);
@@ -535,7 +535,7 @@ void RE_rayobject_hint_bb(RayObject *r, RayHint *hint, float *min, float *max)
int RE_rayobjectcontrol_test_break(RayObjectControl *control)
{
- if(control->test_break)
+ if (control->test_break)
return control->test_break(control->data);
return 0;
@@ -543,7 +543,7 @@ int RE_rayobjectcontrol_test_break(RayObjectControl *control)
void RE_rayobject_set_control(RayObject *r, void *data, RE_rayobjectcontrol_test_break_callback test_break)
{
- if(RE_rayobject_isRayAPI(r))
+ if (RE_rayobject_isRayAPI(r))
{
r = RE_rayobject_align(r);
r->control.data = data;
diff --git a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
index f5a60308561..165b62cfbe4 100644
--- a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
@@ -102,11 +102,11 @@ 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)
+ if (isec->mode == RE_RAY_SHADOW)
hit->dist = 0;
else
hit->dist = isec->dist;
@@ -154,10 +154,10 @@ static void RE_rayobject_blibvh_free(RayObject *o)
{
BVHObject *obj = (BVHObject*)o;
- if(obj->bvh)
+ if (obj->bvh)
BLI_bvhtree_free(obj->bvh);
- if(obj->leafs)
+ if (obj->leafs)
MEM_freeN(obj->leafs);
MEM_freeN(obj);
diff --git a/source/blender/render/intern/raytrace/rayobject_instance.cpp b/source/blender/render/intern/raytrace/rayobject_instance.cpp
index c7af501a808..2e803ce0fd3 100644
--- a/source/blender/render/intern/raytrace/rayobject_instance.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_instance.cpp
@@ -99,7 +99,7 @@ static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec)
int changed = 0, i, res;
// TODO - this is disabling self intersection on instances
- if(isec->orig.ob == obj->ob && obj->ob)
+ if (isec->orig.ob == obj->ob && obj->ob)
{
changed = 1;
isec->orig.ob = obj->target_ob;
@@ -117,7 +117,7 @@ static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec)
isec->dist *= normalize_v3(isec->dir);
// update idot_axis and bv_index
- for(i=0; i<3; i++)
+ for (i=0; i<3; i++)
{
isec->idot_axis[i] = 1.0f / isec->dir[i];
@@ -132,7 +132,7 @@ 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;
}
@@ -161,11 +161,11 @@ static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec)
copy_v3_v3(isec->dir, dir);
copy_v3_v3(isec->idot_axis, idot_axis);
- if(changed)
+ if (changed)
isec->orig.ob = obj->ob;
// restore bv_index
- for(i=0; i<3; i++)
+ for (i=0; i<3; i++)
{
isec->bv_index[2*i] = isec->idot_axis[i] < 0.0 ? 1 : 0;
isec->bv_index[2*i+1] = 1 - isec->bv_index[2*i];
@@ -202,9 +202,9 @@ 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];
+ 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 3e2c60cfcc0..197b3f14c7a 100644
--- a/source/blender/render/intern/raytrace/rayobject_octree.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp
@@ -133,7 +133,7 @@ static void calc_ocval_face(float *v1, float *v2, float *v3, float *v4, short x,
copy_v3_v3(max, v1);
DO_MINMAX(v2, min, max);
DO_MINMAX(v3, min, max);
- if(v4) {
+ if (v4) {
DO_MINMAX(v4, min, max);
}
@@ -155,28 +155,31 @@ static void calc_ocval_ray(OcVal *ov, float xo, float yo, float zo, float *vec1,
{
int ocmin, ocmax;
- if(vec1[0]<vec2[0]) {
+ if (vec1[0]<vec2[0]) {
ocmin= OCVALRES*(vec1[0] - xo);
ocmax= OCVALRES*(vec2[0] - xo);
- } else {
+ }
+ else {
ocmin= OCVALRES*(vec2[0] - xo);
ocmax= OCVALRES*(vec1[0] - xo);
}
ov->ocx= BROW16(ocmin, ocmax);
- if(vec1[1]<vec2[1]) {
+ if (vec1[1]<vec2[1]) {
ocmin= OCVALRES*(vec1[1] - yo);
ocmax= OCVALRES*(vec2[1] - yo);
- } else {
+ }
+ else {
ocmin= OCVALRES*(vec2[1] - yo);
ocmax= OCVALRES*(vec1[1] - yo);
}
ov->ocy= BROW16(ocmin, ocmax);
- if(vec1[2]<vec2[2]) {
+ if (vec1[2]<vec2[2]) {
ocmin= OCVALRES*(vec1[2] - zo);
ocmax= OCVALRES*(vec2[2] - zo);
- } else {
+ }
+ else {
ocmin= OCVALRES*(vec2[2] - zo);
ocmax= OCVALRES*(vec1[2] - zo);
}
@@ -189,15 +192,15 @@ static Branch *addbranch(Octree *oc, Branch *br, short ocb)
{
int index;
- if(br->b[ocb]) return br->b[ocb];
+ if (br->b[ocb]) return br->b[ocb];
oc->branchcount++;
index= oc->branchcount>>12;
- if(oc->adrbranch[index]==NULL)
+ if (oc->adrbranch[index]==NULL)
oc->adrbranch[index]= (Branch*)MEM_callocN(4096*sizeof(Branch), "new oc branch");
- if(oc->branchcount>= BRANCH_ARRAY*4096) {
+ if (oc->branchcount>= BRANCH_ARRAY*4096) {
printf("error; octree branches full\n");
oc->branchcount=0;
}
@@ -212,10 +215,10 @@ static Node *addnode(Octree *oc)
oc->nodecount++;
index= oc->nodecount>>12;
- if(oc->adrnode[index]==NULL)
+ if (oc->adrnode[index]==NULL)
oc->adrnode[index]= (Node*)MEM_callocN(4096*sizeof(Node),"addnode");
- if(oc->nodecount> NODE_ARRAY*NODE_ARRAY) {
+ if (oc->nodecount> NODE_ARRAY*NODE_ARRAY) {
printf("error; octree nodes full\n");
oc->nodecount=0;
}
@@ -229,7 +232,7 @@ static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3]
float fx, fy, fz;
// init static vars
- if(face) {
+ if (face) {
normal_tri_v3( nor,rtf[0], rtf[1], rtf[2]);
d= -nor[0]*rtf[0][0] - nor[1]*rtf[0][1] - nor[2]*rtf[0][2];
return 0;
@@ -239,25 +242,25 @@ static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3]
fy= y;
fz= z;
- if((fx)*nor[0] + (fy)*nor[1] + (fz)*nor[2] + d > 0.0f) {
- if((fx+1)*nor[0] + (fy )*nor[1] + (fz )*nor[2] + d < 0.0f) return 1;
- if((fx )*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d < 0.0f) return 1;
- if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d < 0.0f) return 1;
+ if ((fx)*nor[0] + (fy)*nor[1] + (fz)*nor[2] + d > 0.0f) {
+ if ((fx+1)*nor[0] + (fy )*nor[1] + (fz )*nor[2] + d < 0.0f) return 1;
+ if ((fx )*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d < 0.0f) return 1;
+ if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d < 0.0f) return 1;
- if((fx )*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
- if((fx+1)*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
- if((fx )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
- if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
+ if ((fx )*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
+ if ((fx+1)*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
+ if ((fx )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
+ if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
}
else {
- if((fx+1)*nor[0] + (fy )*nor[1] + (fz )*nor[2] + d > 0.0f) return 1;
- if((fx )*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d > 0.0f) return 1;
- if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d > 0.0f) return 1;
+ if ((fx+1)*nor[0] + (fy )*nor[1] + (fz )*nor[2] + d > 0.0f) return 1;
+ if ((fx )*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d > 0.0f) return 1;
+ if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d > 0.0f) return 1;
- if((fx )*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
- if((fx+1)*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
- if((fx )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
- if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
+ if ((fx )*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
+ if ((fx+1)*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
+ if ((fx )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
+ if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
}
return 0;
@@ -274,15 +277,15 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
br= oc->adrbranch[0];
- if(oc->ocres==512) {
+ if (oc->ocres==512) {
oc0= ((x & 1024)+(y & 512)+(z & 256))>>8;
br= addbranch(oc, br, oc0);
}
- if(oc->ocres>=256) {
+ if (oc->ocres>=256) {
oc0= ((x & 512)+(y & 256)+(z & 128))>>7;
br= addbranch(oc, br, oc0);
}
- if(oc->ocres>=128) {
+ if (oc->ocres>=128) {
oc0= ((x & 256)+(y & 128)+(z & 64))>>6;
br= addbranch(oc, br, oc0);
}
@@ -300,12 +303,12 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
br= addbranch(oc, br,oc3);
br= addbranch(oc, br,oc4);
no= (Node *)br->b[oc5];
- if(no==NULL) br->b[oc5]= (Branch *)(no= addnode(oc));
+ if (no==NULL) br->b[oc5]= (Branch *)(no= addnode(oc));
while(no->next) no= no->next;
a= 0;
- if(no->v[7]) { /* node full */
+ if (no->v[7]) { /* node full */
no->next= addnode(oc);
no= no->next;
}
@@ -315,7 +318,7 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
no->v[a]= (RayFace*) RE_rayobject_align(face);
- if(quad)
+ if (quad)
calc_ocval_face(rtf[0], rtf[1], rtf[2], rtf[3], x>>2, y>>1, z, &no->ov[a]);
else
calc_ocval_face(rtf[0], rtf[1], rtf[2], NULL, x>>2, y>>1, z, &no->ov[a]);
@@ -333,7 +336,7 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa
ocx2= rts[b2][c1];
ocy2= rts[b2][c2];
- if(ocx1==ocx2 && ocy1==ocy2) {
+ if (ocx1==ocx2 && ocy1==ocy2) {
ocface[oc->ocres*ocx1+ocy1]= 1;
return;
}
@@ -343,32 +346,36 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa
ox2= rtf[b2][c1];
oy2= rtf[b2][c2];
- if(ox1!=ox2) {
- if(ox2-ox1>0.0f) {
+ if (ox1!=ox2) {
+ if (ox2-ox1>0.0f) {
labdax= (ox1-ocx1-1.0f)/(ox1-ox2);
ldx= -1.0f/(ox1-ox2);
dx= 1;
- } else {
+ }
+ else {
labdax= (ox1-ocx1)/(ox1-ox2);
ldx= 1.0f/(ox1-ox2);
dx= -1;
}
- } else {
+ }
+ else {
labdax=1.0f;
ldx=0;
}
- if(oy1!=oy2) {
- if(oy2-oy1>0.0f) {
+ if (oy1!=oy2) {
+ if (oy2-oy1>0.0f) {
labday= (oy1-ocy1-1.0f)/(oy1-oy2);
ldy= -1.0f/(oy1-oy2);
dy= 1;
- } else {
+ }
+ else {
labday= (oy1-ocy1)/(oy1-oy2);
ldy= 1.0f/(oy1-oy2);
dy= -1;
}
- } else {
+ }
+ else {
labday=1.0f;
ldy=0;
}
@@ -378,27 +385,29 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa
while(TRUE) {
- if(x<0 || y<0 || x>=oc->ocres || y>=oc->ocres);
+ if (x<0 || y<0 || x>=oc->ocres || y>=oc->ocres);
else ocface[oc->ocres*x+y]= 1;
labdao=labda;
- if(labdax==labday) {
+ if (labdax==labday) {
labdax+=ldx;
x+=dx;
labday+=ldy;
y+=dy;
- } else {
- if(labdax<labday) {
+ }
+ else {
+ if (labdax<labday) {
labdax+=ldx;
x+=dx;
- } else {
+ }
+ else {
labday+=ldy;
y+=dy;
}
}
labda=MIN2(labdax,labday);
- if(labda==labdao) break;
- if(labda>=1.0f) break;
+ if (labda==labdao) break;
+ if (labda>=1.0f) break;
}
ocface[oc->ocres*ocx2+ocy2]=1;
}
@@ -407,15 +416,15 @@ static void filltriangle(Octree *oc, short c1, short c2, char *ocface, short *oc
{
int a, x, y, y1, y2;
- for(x=ocmin[c1];x<=ocmax[c1];x++) {
+ for (x=ocmin[c1];x<=ocmax[c1];x++) {
a= oc->ocres*x;
- for(y=ocmin[c2];y<=ocmax[c2];y++) {
- if(ocface[a+y]) {
+ for (y=ocmin[c2];y<=ocmax[c2];y++) {
+ if (ocface[a+y]) {
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;
+ for (y1=ocmax[c2];y1>y;y1--) {
+ if (ocface[a+y1]) {
+ for (y2=y;y2<=y1;y2++) ocface[a+y2]=1;
y1=0;
}
}
@@ -435,10 +444,10 @@ static void RE_rayobject_octree_free(RayObject *tree)
printf("ray coherent %d \n", coherent_ray);
printf("accepted %d rejected %d\n", accepted, rejected);
#endif
- if(oc->ocface)
+ if (oc->ocface)
MEM_freeN(oc->ocface);
- if(oc->adrbranch) {
+ if (oc->adrbranch) {
int a= 0;
while(oc->adrbranch[a]) {
MEM_freeN(oc->adrbranch[a]);
@@ -450,7 +459,7 @@ static void RE_rayobject_octree_free(RayObject *tree)
}
oc->branchcount= 0;
- if(oc->adrnode) {
+ if (oc->adrnode) {
int a= 0;
while(oc->adrnode[a]) {
MEM_freeN(oc->adrnode[a]);
@@ -511,27 +520,27 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
copy_v3_v3(co1, face->v1);
copy_v3_v3(co2, face->v2);
copy_v3_v3(co3, face->v3);
- if(face->v4)
+ if (face->v4)
copy_v3_v3(co4, face->v4);
- for(c=0;c<3;c++) {
+ for (c=0;c<3;c++) {
rtf[0][c] = (co1[c] - oc->min[c]) * ocfac[c];
rts[0][c] = (short)rtf[0][c];
rtf[1][c] = (co2[c] - oc->min[c]) * ocfac[c];
rts[1][c] = (short)rtf[1][c];
rtf[2][c] = (co3[c] - oc->min[c]) * ocfac[c];
rts[2][c] = (short)rtf[2][c];
- if(RE_rayface_isQuad(face)) {
+ if (RE_rayface_isQuad(face)) {
rtf[3][c] = (co4[c] - oc->min[c]) * ocfac[c];
rts[3][c] = (short)rtf[3][c];
}
}
- for(c=0;c<3;c++) {
+ for (c=0;c<3;c++) {
oc1= rts[0][c];
oc2= rts[1][c];
oc3= rts[2][c];
- if(!RE_rayface_isQuad(face)) {
+ if (!RE_rayface_isQuad(face)) {
ocmin[c]= MIN3(oc1,oc2,oc3);
ocmax[c]= MAX3(oc1,oc2,oc3);
}
@@ -540,11 +549,11 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
ocmin[c]= MIN4(oc1,oc2,oc3,oc4);
ocmax[c]= MAX4(oc1,oc2,oc3,oc4);
}
- if(ocmax[c]>oc->ocres-1) ocmax[c]=oc->ocres-1;
- if(ocmin[c]<0) ocmin[c]=0;
+ if (ocmax[c]>oc->ocres-1) ocmax[c]=oc->ocres-1;
+ if (ocmin[c]<0) ocmin[c]=0;
}
- if(ocmin[0]==ocmax[0] && ocmin[1]==ocmax[1] && ocmin[2]==ocmax[2]) {
+ if (ocmin[0]==ocmax[0] && ocmin[1]==ocmax[1] && ocmin[2]==ocmax[2]) {
ocwrite(oc, face, RE_rayface_isQuad(face), ocmin[0], ocmin[1], ocmin[2], rtf);
}
else {
@@ -555,7 +564,7 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
d2dda(oc, 1,2,0,1,ocface+ocres2,rts,rtf);
d2dda(oc, 1,2,0,2,ocface,rts,rtf);
d2dda(oc, 1,2,1,2,ocface+2*ocres2,rts,rtf);
- if(!RE_rayface_isQuad(face)) {
+ if (!RE_rayface_isQuad(face)) {
d2dda(oc, 2,0,0,1,ocface+ocres2,rts,rtf);
d2dda(oc, 2,0,0,2,ocface,rts,rtf);
d2dda(oc, 2,0,1,2,ocface+2*ocres2,rts,rtf);
@@ -576,14 +585,14 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
/* init static vars here */
face_in_node(face, 0,0,0, rtf);
- for(x=ocmin[0];x<=ocmax[0];x++) {
+ for (x=ocmin[0];x<=ocmax[0];x++) {
a= oc->ocres*x;
- for(y=ocmin[1];y<=ocmax[1];y++) {
- if(ocface[a+y+ocres2]) {
+ for (y=ocmin[1];y<=ocmax[1];y++) {
+ if (ocface[a+y+ocres2]) {
b= oc->ocres*y+2*ocres2;
- for(z=ocmin[2];z<=ocmax[2];z++) {
- if(ocface[b+z] && ocface[a+z]) {
- if(face_in_node(NULL, x, y, z, rtf))
+ for (z=ocmin[2];z<=ocmax[2];z++) {
+ if (ocface[b+z] && ocface[a+z]) {
+ if (face_in_node(NULL, x, y, z, rtf))
ocwrite(oc, face, RE_rayface_isQuad(face), x,y,z, rtf);
}
}
@@ -592,14 +601,14 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
}
/* same loops to clear octree, doubt it can be done smarter */
- for(x=ocmin[0];x<=ocmax[0];x++) {
+ for (x=ocmin[0];x<=ocmax[0];x++) {
a= oc->ocres*x;
- for(y=ocmin[1];y<=ocmax[1];y++) {
+ for (y=ocmin[1];y<=ocmax[1];y++) {
/* x-y */
ocface[a+y+ocres2]= 0;
b= oc->ocres*y + 2*ocres2;
- for(z=ocmin[2];z<=ocmax[2];z++) {
+ for (z=ocmin[2];z<=ocmax[2];z++) {
/* y-z */
ocface[b+z]= 0;
/* x-z */
@@ -620,7 +629,7 @@ static void RE_rayobject_octree_done(RayObject *tree)
INIT_MINMAX(oc->min, oc->max);
/* Calculate Bounding Box */
- for(c=0; c<oc->ro_nodes_used; c++)
+ for (c=0; c<oc->ro_nodes_used; c++)
RE_rayobject_merge_bb( RE_rayobject_unalignRayFace(oc->ro_nodes[c]), oc->min, oc->max);
/* Alloc memory */
@@ -633,7 +642,7 @@ static void RE_rayobject_octree_done(RayObject *tree)
oc->ocface= (char*)MEM_callocN( 3*ocres2 + 8, "ocface");
memset(oc->ocface, 0, 3*ocres2);
- for(c=0;c<3;c++) { /* octree enlarge, still needed? */
+ for (c=0;c<3;c++) { /* octree enlarge, still needed? */
oc->min[c]-= 0.01f;
oc->max[c]+= 0.01f;
}
@@ -649,7 +658,7 @@ static void RE_rayobject_octree_done(RayObject *tree)
oc->ocsize= sqrt(t00*t00+t01*t01+t02*t02); /* global, max size octree */
- for(c=0; c<oc->ro_nodes_used; c++)
+ for (c=0; c<oc->ro_nodes_used; c++)
{
octree_fill_rayface(oc, oc->ro_nodes[c]);
}
@@ -677,19 +686,19 @@ static int testnode(Octree *UNUSED(oc), Isect *is, Node *no, OcVal ocval)
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++)
+ 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 (!face) break;
- if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
+ if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
{
- if( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) )
+ if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) )
return 1;
}
}
@@ -698,17 +707,17 @@ static int testnode(Octree *UNUSED(oc), Isect *is, Node *no, OcVal ocval)
{ /* else mirror or glass or shadowtra, return closest face */
int found= 0;
- for(; no; no = no->next)
- for(nr=0; nr<8; nr++)
+ 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 (!face) break;
- if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
+ if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
{
- if( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) )
+ if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) )
found= 1;
}
}
@@ -730,43 +739,43 @@ static Node *ocread(Octree *oc, int x, int y, int z)
br= oc->adrbranch[0];
- if(oc->ocres==512) {
+ if (oc->ocres==512) {
oc1= ((x & 1024)+(y & 512)+(z & 256))>>8;
br= br->b[oc1];
- if(br==NULL) {
+ if (br==NULL) {
return NULL;
}
}
- if(oc->ocres>=256) {
+ if (oc->ocres>=256) {
oc1= ((x & 512)+(y & 256)+(z & 128))>>7;
br= br->b[oc1];
- if(br==NULL) {
+ if (br==NULL) {
return NULL;
}
}
- if(oc->ocres>=128) {
+ if (oc->ocres>=128) {
oc1= ((x & 256)+(y & 128)+(z & 64))>>6;
br= br->b[oc1];
- if(br==NULL) {
+ if (br==NULL) {
return NULL;
}
}
oc1= ((x & 128)+(y & 64)+(z & 32))>>5;
br= br->b[oc1];
- if(br) {
+ if (br) {
oc1= ((x & 64)+(y & 32)+(z & 16))>>4;
br= br->b[oc1];
- if(br) {
+ if (br) {
oc1= ((x & 32)+(y & 16)+(z & 8))>>3;
br= br->b[oc1];
- if(br) {
+ if (br) {
oc1= ((x & 16)+(y & 8)+(z & 4))>>2;
br= br->b[oc1];
- if(br) {
+ if (br) {
oc1= ((x & 8)+(y & 4)+(z & 2))>>1;
br= br->b[oc1];
- if(br) {
+ if (br) {
oc1= ((x & 4)+(y & 2)+(z & 1));
return (Node *)br->b[oc1];
}
@@ -782,24 +791,24 @@ static int cliptest(float p, float q, float *u1, float *u2)
{
float r;
- if(p<0.0f) {
- if(q<p) return 0;
- else if(q<0.0f) {
+ if (p<0.0f) {
+ if (q<p) return 0;
+ else if (q<0.0f) {
r= q/p;
- if(r>*u2) return 0;
- else if(r>*u1) *u1=r;
+ if (r>*u2) return 0;
+ else if (r>*u1) *u1=r;
}
}
else {
- if(p>0.0f) {
- if(q<0.0f) return 0;
- else if(q<p) {
+ if (p>0.0f) {
+ if (q<0.0f) return 0;
+ else if (q<p) {
r= q/p;
- if(r<*u1) return 0;
- else if(r<*u2) *u2=r;
+ if (r<*u1) return 0;
+ else if (r<*u2) *u2=r;
}
}
- else if(q<0.0f) return 0;
+ else if (q<0.0f) return 0;
}
return 1;
}
@@ -827,7 +836,7 @@ static int do_coherence_test(int ocx1, int ocx2, int ocy1, int ocy2, int ocz1, i
short *sp;
sp= coh_nodes[ (ocx2 & 15) + 16*(ocy2 & 15) + 256*(ocz2 & 15) ];
- if(sp[0]==ocx1 && sp[1]==ocy1 && sp[2]==ocz1 &&
+ if (sp[0]==ocx1 && sp[1]==ocy1 && sp[2]==ocz1 &&
sp[3]==ocx2 && sp[4]==ocy2 && sp[5]==ocz2) return 1;
return 0;
}
@@ -850,7 +859,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
int ocx1,ocx2,ocy1, ocy2,ocz1,ocz2;
/* clip with octree */
- if(oc->branchcount==0) return 0;
+ if (oc->branchcount==0) return 0;
/* do this before intersect calls */
#if 0
@@ -868,22 +877,22 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
u2= 1.0f;
/* clip with octree cube */
- if(cliptest(-ldx, start[0]-oc->min[0], &u1,&u2)) {
- if(cliptest(ldx, oc->max[0]-start[0], &u1,&u2)) {
+ if (cliptest(-ldx, start[0]-oc->min[0], &u1,&u2)) {
+ if (cliptest(ldx, oc->max[0]-start[0], &u1,&u2)) {
ldy= is->dir[1]*is->dist;
- if(cliptest(-ldy, start[1]-oc->min[1], &u1,&u2)) {
- if(cliptest(ldy, oc->max[1]-start[1], &u1,&u2)) {
+ if (cliptest(-ldy, start[1]-oc->min[1], &u1,&u2)) {
+ if (cliptest(ldy, oc->max[1]-start[1], &u1,&u2)) {
ldz = is->dir[2]*is->dist;
- if(cliptest(-ldz, start[2]-oc->min[2], &u1,&u2)) {
- if(cliptest(ldz, oc->max[2]-start[2], &u1,&u2)) {
+ if (cliptest(-ldz, start[2]-oc->min[2], &u1,&u2)) {
+ if (cliptest(ldz, oc->max[2]-start[2], &u1,&u2)) {
c1=1;
- if(u2<1.0f) {
+ if (u2<1.0f) {
end[0] = start[0]+u2*ldx;
end[1] = start[1]+u2*ldy;
end[2] = start[2]+u2*ldz;
}
- if(u1>0.0f) {
+ if (u1>0.0f) {
start[0] += u1*ldx;
start[1] += u1*ldy;
start[2] += u1*ldz;
@@ -895,7 +904,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
}
}
- if(c1==0) return 0;
+ if (c1==0) return 0;
/* reset static variables in ocread */
//ocread(oc, oc->ocres, 0, 0);
@@ -915,14 +924,14 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
ocy2= (int)oy2;
ocz2= (int)oz2;
- if(ocx1==ocx2 && ocy1==ocy2 && ocz1==ocz2) {
+ if (ocx1==ocx2 && ocy1==ocy2 && ocz1==ocz2) {
no= ocread(oc, ocx1, ocy1, ocz1);
- if(no) {
+ if (no) {
/* exact intersection with node */
vec1[0]= ox1; vec1[1]= oy1; vec1[2]= oz1;
vec2[0]= ox2; vec2[1]= oy2; vec2[2]= oz2;
calc_ocval_ray(&ocval, (float)ocx1, (float)ocy1, (float)ocz1, vec1, vec2);
- if( testnode(oc, is, no, ocval) ) return 1;
+ if ( testnode(oc, is, no, ocval) ) return 1;
}
}
else {
@@ -936,43 +945,49 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
doy= oy1-oy2;
doz= oz1-oz2;
- if(dox<-FLT_EPSILON) {
+ if (dox<-FLT_EPSILON) {
ldx= -1.0f/dox;
labdax= (ocx1-ox1+1.0f)*ldx;
dx= 1;
- } else if(dox>FLT_EPSILON) {
+ }
+ else if (dox>FLT_EPSILON) {
ldx= 1.0f/dox;
labdax= (ox1-ocx1)*ldx;
dx= -1;
- } else {
+ }
+ else {
labdax=1.0f;
ldx=0;
dx= 0;
}
- if(doy<-FLT_EPSILON) {
+ if (doy<-FLT_EPSILON) {
ldy= -1.0f/doy;
labday= (ocy1-oy1+1.0f)*ldy;
dy= 1;
- } else if(doy>FLT_EPSILON) {
+ }
+ else if (doy>FLT_EPSILON) {
ldy= 1.0f/doy;
labday= (oy1-ocy1)*ldy;
dy= -1;
- } else {
+ }
+ else {
labday=1.0f;
ldy=0;
dy= 0;
}
- if(doz<-FLT_EPSILON) {
+ if (doz<-FLT_EPSILON) {
ldz= -1.0f/doz;
labdaz= (ocz1-oz1+1.0f)*ldz;
dz= 1;
- } else if(doz>FLT_EPSILON) {
+ }
+ else if (doz>FLT_EPSILON) {
ldz= 1.0f/doz;
labdaz= (oz1-ocz1)*ldz;
dz= -1;
- } else {
+ }
+ else {
labdaz=1.0f;
ldz=0;
dz= 0;
@@ -991,7 +1006,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
while(TRUE) {
no= ocread(oc, xo, yo, zo);
- if(no) {
+ if (no) {
/* calculate ray intersection with octree node */
copy_v3_v3(vec1, vec2);
@@ -1002,10 +1017,10 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
calc_ocval_ray(&ocval, (float)xo, (float)yo, (float)zo, vec1, vec2);
//is->dist = (u1+ddalabda*(u2-u1))*olabda;
- if( testnode(oc, is, no, ocval) )
+ if ( testnode(oc, is, no, ocval) )
found = 1;
- if(is->dist < (u1+ddalabda*(u2-u1))*olabda)
+ if (is->dist < (u1+ddalabda*(u2-u1))*olabda)
return found;
}
@@ -1015,17 +1030,17 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
/* traversing ocree nodes need careful detection of smallest values, with proper
* exceptions for equal labdas */
eqval= (labdax==labday);
- if(labday==labdaz) eqval += 2;
- if(labdax==labdaz) eqval += 4;
+ if (labday==labdaz) eqval += 2;
+ if (labdax==labdaz) eqval += 4;
- if(eqval) { // only 4 cases exist!
- if(eqval==7) { // x=y=z
+ if (eqval) { // only 4 cases exist!
+ if (eqval==7) { // x=y=z
xo+=dx; labdax+=ldx;
yo+=dy; labday+=ldy;
zo+=dz; labdaz+=ldz;
}
- else if(eqval==1) { // x=y
- if(labday < labdaz) {
+ else if (eqval==1) { // x=y
+ if (labday < labdaz) {
xo+=dx; labdax+=ldx;
yo+=dy; labday+=ldy;
}
@@ -1033,8 +1048,8 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
zo+=dz; labdaz+=ldz;
}
}
- else if(eqval==2) { // y=z
- if(labdax < labday) {
+ else if (eqval==2) { // y=z
+ if (labdax < labday) {
xo+=dx; labdax+=ldx;
}
else {
@@ -1043,7 +1058,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
}
}
else { // x=z
- if(labday < labdax) {
+ if (labday < labdax) {
yo+=dy; labday+=ldy;
}
else {
@@ -1054,13 +1069,13 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
}
else { // all three different, just three cases exist
eqval= (labdax<labday);
- if(labday<labdaz) eqval += 2;
- if(labdax<labdaz) eqval += 4;
+ if (labday<labdaz) eqval += 2;
+ if (labdax<labdaz) eqval += 4;
- if(eqval==7 || eqval==5) { // x smallest
+ if (eqval==7 || eqval==5) { // x smallest
xo+=dx; labdax+=ldx;
}
- else if(eqval==2 || eqval==6) { // y smallest
+ else if (eqval==2 || eqval==6) { // y smallest
yo+=dy; labday+=ldy;
}
else { // z smallest
@@ -1070,9 +1085,9 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
}
ddalabda=MIN3(labdax,labday,labdaz);
- if(ddalabda==labdao) break;
+ if (ddalabda==labdao) break;
/* to make sure the last node is always checked */
- if(labdao>=1.0f) break;
+ if (labdao>=1.0f) break;
}
}
diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
index f7d38bf0fa3..437d7f433b5 100644
--- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
@@ -71,14 +71,14 @@ void bvh_done<QBVHTree>(QBVHTree *obj)
//TODO do this in 1 pass (half memory usage during building)
VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);
- if(RE_rayobjectcontrol_test_break(&obj->rayobj.control))
+ if (RE_rayobjectcontrol_test_break(&obj->rayobj.control))
{
BLI_memarena_free(arena1);
BLI_memarena_free(arena2);
return;
}
- if(root) {
+ if (root) {
pushup_simd<VBVHNode,4>(root);
obj->root = Reorganize_SVBVH<VBVHNode>(arena2).transform(root);
}
@@ -99,8 +99,8 @@ template<int StackSize>
int intersect(QBVHTree *obj, Isect* isec)
{
//TODO renable hint support
- if(RE_rayobject_isAligned(obj->root)) {
- if(isec->mode == RE_RAY_SHADOW)
+ if (RE_rayobject_isAligned(obj->root)) {
+ if (isec->mode == RE_RAY_SHADOW)
return svbvh_node_stack_raycast<StackSize,true>(obj->root, isec);
else
return svbvh_node_stack_raycast<StackSize,false>(obj->root, isec);
@@ -141,7 +141,7 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
{
static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
- if(maxstacksize <= 1024) return &bvh_api256;
+ if (maxstacksize <= 1024) return &bvh_api256;
assert(maxstacksize <= 256);
return 0;
}
diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
index 6988e3fcc38..54901db8bdd 100644
--- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
@@ -54,10 +54,10 @@ static void rtbuild_init(RTBuilder *b)
b->primitives.end = 0;
b->primitives.maxsize = 0;
- for(int i=0; i<RTBUILD_MAX_CHILDS; i++)
+ for (int i=0; i<RTBUILD_MAX_CHILDS; i++)
b->child_offset[i] = 0;
- for(int i=0; i<3; i++)
+ for (int i=0; i<3; i++)
b->sorted_begin[i] = b->sorted_end[i] = 0;
INIT_MINMAX(b->bb, b->bb+3);
@@ -74,7 +74,7 @@ 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];
@@ -86,10 +86,10 @@ RTBuilder* rtbuild_create(int size)
void rtbuild_free(RTBuilder *b)
{
- if(b->primitives.begin) MEM_freeN(b->primitives.begin);
+ if (b->primitives.begin) MEM_freeN(b->primitives.begin);
- for(int i=0; i<3; i++)
- if(b->sorted_begin[i])
+ for (int i=0; i<3; i++)
+ if (b->sorted_begin[i])
MEM_freeN(b->sorted_begin[i]);
MEM_freeN(b);
@@ -107,16 +107,16 @@ void rtbuild_add(RTBuilder *b, RayObject *o)
/* skip objects with invalid bounding boxes, nan causes DO_MINMAX
* to do nothing, so we get these invalid values. this shouldn't
* happen usually, but bugs earlier in the pipeline can cause it. */
- if(bb[0] > bb[3] || bb[1] > bb[4] || bb[2] > bb[5])
+ if (bb[0] > bb[3] || bb[1] > bb[4] || bb[2] > bb[5])
return;
/* skip objects with inf bounding boxes */
- if(!finite(bb[0]) || !finite(bb[1]) || !finite(bb[2]))
+ if (!finite(bb[0]) || !finite(bb[1]) || !finite(bb[2]))
return;
- if(!finite(bb[3]) || !finite(bb[4]) || !finite(bb[5]))
+ if (!finite(bb[3]) || !finite(bb[4]) || !finite(bb[5]))
return;
/* skip objects with zero bounding box, they are of no use, and
* will give problems in rtbuild_heuristic_object_split later */
- if(bb[0] == bb[3] && bb[1] == bb[4] && bb[2] == bb[5])
+ if (bb[0] == bb[3] && bb[1] == bb[4] && bb[2] == bb[5])
return;
copy_v3_v3(b->primitives.end->bb, bb);
@@ -124,7 +124,7 @@ void rtbuild_add(RTBuilder *b, RayObject *o)
b->primitives.end->obj = o;
b->primitives.end->cost = RE_rayobject_cost(o);
- for(int i=0; i<3; i++)
+ for (int i=0; i<3; i++)
{
*(b->sorted_end[i]) = b->primitives.end;
b->sorted_end[i]++;
@@ -141,7 +141,7 @@ int rtbuild_size(RTBuilder *b)
template<class Obj,int Axis>
static bool obj_bb_compare(const Obj &a, const Obj &b)
{
- if(a->bb[Axis] != b->bb[Axis])
+ if (a->bb[Axis] != b->bb[Axis])
return a->bb[Axis] < b->bb[Axis];
return a->obj < b->obj;
}
@@ -149,18 +149,18 @@ static bool obj_bb_compare(const Obj &a, const Obj &b)
template<class Item>
static void object_sort(Item *begin, Item *end, int axis)
{
- if(axis == 0) return std::sort(begin, end, obj_bb_compare<Item,0> );
- if(axis == 1) return std::sort(begin, end, obj_bb_compare<Item,1> );
- if(axis == 2) return std::sort(begin, end, obj_bb_compare<Item,2> );
+ if (axis == 0) return std::sort(begin, end, obj_bb_compare<Item,0> );
+ if (axis == 1) return std::sort(begin, end, obj_bb_compare<Item,1> );
+ if (axis == 2) return std::sort(begin, end, obj_bb_compare<Item,2> );
assert(false);
}
void rtbuild_done(RTBuilder *b, RayObjectControl* ctrl)
{
- for(int i=0; i<3; i++)
- if(b->sorted_begin[i])
+ for (int i=0; i<3; i++)
+ if (b->sorted_begin[i])
{
- if(RE_rayobjectcontrol_test_break(ctrl)) break;
+ if (RE_rayobjectcontrol_test_break(ctrl)) break;
object_sort( b->sorted_begin[i], b->sorted_end[i], i );
}
}
@@ -174,8 +174,8 @@ 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])
+ for (int i=0; i<3; 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];
@@ -191,9 +191,9 @@ RTBuilder* rtbuild_get_child(RTBuilder *b, int child, RTBuilder *tmp)
void rtbuild_calc_bb(RTBuilder *b)
{
- if(b->bb[0] == 1.0e30f)
+ if (b->bb[0] == 1.0e30f)
{
- for(RTBuilder::Object **index = b->sorted_begin[0]; index != b->sorted_end[0]; index++)
+ 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);
}
}
@@ -225,20 +225,20 @@ int rtbuild_mean_split(RTBuilder *b, int nchilds, int axis)
assert(nchilds <= RTBUILD_MAX_CHILDS);
//TODO optimize calc of leafs_per_child
- for(s=nchilds; s<tot_leafs; s*=nchilds);
+ for (s=nchilds; s<tot_leafs; s*=nchilds);
Mleafs_per_child = s/nchilds;
mleafs_per_child = Mleafs_per_child/nchilds;
//split min leafs per child
b->child_offset[0] = 0;
- for(i=1; i<=nchilds; i++)
+ for (i=1; i<=nchilds; i++)
b->child_offset[i] = mleafs_per_child;
//split remaining leafs
missing_leafs = tot_leafs - mleafs_per_child*nchilds;
- for(i=1; i<=nchilds; i++)
+ for (i=1; i<=nchilds; i++)
{
- if(missing_leafs > Mleafs_per_child - mleafs_per_child)
+ if (missing_leafs > Mleafs_per_child - mleafs_per_child)
{
b->child_offset[i] += Mleafs_per_child - mleafs_per_child;
missing_leafs -= Mleafs_per_child - mleafs_per_child;
@@ -252,11 +252,11 @@ int rtbuild_mean_split(RTBuilder *b, int nchilds, int axis)
}
//adjust for accumulative offsets
- for(i=1; i<=nchilds; i++)
+ for (i=1; i<=nchilds; i++)
b->child_offset[i] += b->child_offset[i-1];
//Count created childs
- for(i=nchilds; b->child_offset[i] == b->child_offset[i-1]; i--);
+ for (i=nchilds; b->child_offset[i] == b->child_offset[i-1]; i--);
split_leafs(b, b->child_offset, i, axis);
assert( b->child_offset[0] == 0 && b->child_offset[i] == tot_leafs );
@@ -281,7 +281,7 @@ int rtbuild_median_split(RTBuilder *b, float *separators, int nchilds, int axis)
int size = rtbuild_size(b);
assert(nchilds <= RTBUILD_MAX_CHILDS);
- if(size <= nchilds)
+ if (size <= nchilds)
{
return rtbuild_mean_split(b, nchilds, axis);
}
@@ -293,12 +293,12 @@ int rtbuild_median_split(RTBuilder *b, float *separators, int nchilds, int axis)
//Calculate child offsets
b->child_offset[0] = 0;
- for(i=0; i<nchilds-1; i++)
+ for (i=0; i<nchilds-1; i++)
b->child_offset[i+1] = split_leafs_by_plane(b, b->child_offset[i], size, separators[i]);
b->child_offset[nchilds] = size;
- for(i=0; i<nchilds; i++)
- if(b->child_offset[i+1] - b->child_offset[i] == size)
+ for (i=0; i<nchilds; i++)
+ if (b->child_offset[i+1] - b->child_offset[i] == size)
return rtbuild_mean_split(b, nchilds, axis);
return nchilds;
@@ -313,7 +313,7 @@ int rtbuild_median_split_largest_axis(RTBuilder *b, int nchilds)
rtbuild_calc_bb(b);
la = bb_largest_axis(b->bb,b->bb+3);
- for(i=1; i<nchilds; i++)
+ for (i=1; i<nchilds; i++)
separators[i-1] = (b->bb[la+3]-b->bb[la])*i / nchilds;
return rtbuild_median_split(b, separators, nchilds, la);
@@ -337,23 +337,23 @@ 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--)
+ for (int i=size-1; i>=0; i--)
{
- if(i == size-1)
+ if (i == size-1)
{
copy_v3_v3(sweep[i].bb, obj[i]->bb);
copy_v3_v3(sweep[i].bb+3, obj[i]->bb+3);
@@ -380,9 +380,9 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
sweep_left.bb[5] = obj[0]->bb[5];
sweep_left.cost = obj[0]->cost;
-// right_cost -= obj[0]->cost; if(right_cost < 0) right_cost = 0;
+// 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;
@@ -398,10 +398,10 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
assert(left_side >= 0);
assert(right_side >= 0);
- if(left_side > bcost) break; //No way we can find a better heuristic in this axis
+ if (left_side > bcost) break; //No way we can find a better heuristic in this axis
assert(hcost >= 0);
- if( hcost < bcost
+ 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;
@@ -412,7 +412,7 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
DO_MAX( obj[i]->bb+3, sweep_left.bb+3 );
sweep_left.cost += obj[i]->cost;
-// right_cost -= obj[i]->cost; if(right_cost < 0) right_cost = 0;
+// right_cost -= obj[i]->cost; if (right_cost < 0) right_cost = 0;
}
//assert(baxis >= 0 && baxis < 3);
@@ -423,12 +423,12 @@ 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;
@@ -441,9 +441,9 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
/* Adjust sorted arrays for childs */
- for(int i=0; i<boffset; i++) b->sorted_begin[baxis][i]->selected = true;
- for(int i=boffset; i<size; i++) b->sorted_begin[baxis][i]->selected = false;
- for(int i=0; i<3; i++)
+ for (int i=0; i<boffset; i++) b->sorted_begin[baxis][i]->selected = true;
+ for (int i=boffset; i<size; i++) b->sorted_begin[baxis][i]->selected = false;
+ for (int i=0; i<3; i++)
std::stable_partition( b->sorted_begin[i], b->sorted_end[i], selected_node );
return nchilds;
@@ -460,13 +460,13 @@ static void split_leafs(RTBuilder *b, int *nth, int partitions, int split_axis)
int i;
b->split_axis = split_axis;
- for(i=0; i < partitions-1; i++)
+ for (i=0; i < partitions-1; i++)
{
assert(nth[i] < nth[i+1] && nth[i+1] < nth[partitions]);
- if(split_axis == 0) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,0>);
- if(split_axis == 1) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,1>);
- if(split_axis == 2) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,2>);
+ if (split_axis == 0) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,0>);
+ if (split_axis == 1) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,1>);
+ if (split_axis == 2) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,2>);
}
}
#endif
@@ -500,16 +500,16 @@ 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])
+ if (sub[0] > sub[2])
return 0;
else
return 2;
}
else
{
- if(sub[1] > sub[2])
+ if (sub[1] > sub[2])
return 1;
else
return 2;
@@ -519,11 +519,11 @@ int bb_largest_axis(float *min, float *max)
int bb_fits_inside(float *outer_min, float *outer_max, float *inner_min, float *inner_max)
{
int i;
- for(i=0; i<3; i++)
- if(outer_min[i] > inner_min[i]) return 0;
+ for (i=0; i<3; i++)
+ if (outer_min[i] > inner_min[i]) return 0;
- for(i=0; i<3; i++)
- if(outer_max[i] < inner_max[i]) return 0;
+ for (i=0; i<3; i++)
+ if (outer_max[i] < inner_max[i]) return 0;
return 1;
}
diff --git a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
index 7ce444a2e99..02821d45c50 100644
--- a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
@@ -79,11 +79,11 @@ 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);
@@ -106,14 +106,14 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj)
//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;
}
- if(root) {
+ if (root) {
VBVH_optimalPackSIMD<OVBVHNode,PackCost>(PackCost()).transform(root);
obj->root = Reorganize_SVBVH<OVBVHNode>(arena2).transform(root);
}
@@ -135,8 +135,8 @@ template<int StackSize>
int intersect(SVBVHTree *obj, Isect* isec)
{
//TODO renable hint support
- if(RE_rayobject_isAligned(obj->root)) {
- if(isec->mode == RE_RAY_SHADOW)
+ if (RE_rayobject_isAligned(obj->root)) {
+ if (isec->mode == RE_RAY_SHADOW)
return svbvh_node_stack_raycast<StackSize,true>(obj->root, isec);
else
return svbvh_node_stack_raycast<StackSize,false>(obj->root, isec);
@@ -177,7 +177,7 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
{
static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
- if(maxstacksize <= 1024) return &bvh_api256;
+ if (maxstacksize <= 1024) return &bvh_api256;
assert(maxstacksize <= 256);
return 0;
}
diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
index 75323cfe56a..84395a9ad50 100644
--- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
@@ -87,16 +87,16 @@ 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;
}
- if(root) {
+ if (root) {
reorganize(root);
remove_useless(root, &root);
bvh_refit(root);
@@ -137,8 +137,8 @@ template<int StackSize>
int intersect(VBVHTree *obj, Isect* isec)
{
//TODO renable hint support
- if(RE_rayobject_isAligned(obj->root)) {
- if(isec->mode == RE_RAY_SHADOW)
+ if (RE_rayobject_isAligned(obj->root)) {
+ if (isec->mode == RE_RAY_SHADOW)
return bvh_node_stack_raycast<VBVHNode,StackSize,false,true>( obj->root, isec);
else
return bvh_node_stack_raycast<VBVHNode,StackSize,false,false>( obj->root, isec);
@@ -159,9 +159,9 @@ 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.f & G_DEBUG) {
+ if (G.f & G_DEBUG) {
printf("tot pushups: %d\n", tot_pushup);
printf("tot pushdowns: %d\n", tot_pushdown);
printf("tot moves: %d\n", tot_moves);
@@ -199,7 +199,7 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
{
static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
- if(maxstacksize <= 1024) return &bvh_api256;
+ if (maxstacksize <= 1024) return &bvh_api256;
assert(maxstacksize <= 256);
return 0;
}
diff --git a/source/blender/render/intern/raytrace/reorganize.h b/source/blender/render/intern/raytrace/reorganize.h
index 6efe37b81a3..11d12dac23c 100644
--- a/source/blender/render/intern/raytrace/reorganize.h
+++ b/source/blender/render/intern/raytrace/reorganize.h
@@ -271,8 +271,9 @@ void pushdown(Node *parent)
s_child = next_s_child;
}
- for(Node *i = parent->child; RE_rayobject_isAligned(i) && i; i = i->sibling)
- pushdown( i );
+ for (Node *i = parent->child; RE_rayobject_isAligned(i) && i; i = i->sibling) {
+ pushdown(i);
+ }
}
diff --git a/source/blender/render/intern/raytrace/vbvh.h b/source/blender/render/intern/raytrace/vbvh.h
index 7d4d25c8d00..e1b4ec420ef 100644
--- a/source/blender/render/intern/raytrace/vbvh.h
+++ b/source/blender/render/intern/raytrace/vbvh.h
@@ -167,8 +167,8 @@ struct BuildBinaryVBVH
{
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 );
+ rtbuild_merge_bb(builder, node->bb, node->bb+3);
+ node->child = (Node *) rtbuild_get_primitive(builder, 0);
return node;
}
else
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 31bf6457385..fe709a941fe 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -172,7 +172,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
int x, y, z, sx, sy, sz, ex, ey, ez, done = 0;
unsigned int totstar= 0;
- if(initfunc) {
+ if (initfunc) {
scene= scenev3d;
wrld= scene->world;
}
@@ -196,7 +196,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
if (re) re->flag |= R_HALO;
else stargrid *= 1.0f; /* then it draws fewer */
- if(re) invert_m4_m4(mat, re->viewmat);
+ if (re) invert_m4_m4(mat, re->viewmat);
else unit_m4(mat);
/* BOUNDING BOX CALCULATION
@@ -207,7 +207,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
camera= re ? RE_GetCamera(re) : scene->camera;
- if(camera==NULL || camera->type != OB_CAMERA)
+ if (camera==NULL || camera->type != OB_CAMERA)
return;
cam = camera->data;
@@ -230,7 +230,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
initfunc();
}
- if(re) /* add render object for stars */
+ if (re) /* add render object for stars */
obr= RE_addRenderObject(re, NULL, NULL, 0, 0, 0);
for (x = sx, fx = sx * stargrid; x <= ex; x++, fx += stargrid) {
@@ -244,7 +244,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
vec[3] = 1.0;
if (vertexfunc) {
- if(done & 1) vertexfunc(vec);
+ if (done & 1) vertexfunc(vec);
done++;
}
else {
@@ -268,7 +268,8 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
else if (alpha <= starmindist) alpha = 0.0;
else if (alpha <= 2.0f * starmindist) {
alpha = (alpha - starmindist) / starmindist;
- } else {
+ }
+ else {
alpha -= 2.0f * starmindist;
alpha /= (clipend - 2.0f * starmindist);
alpha = 1.0f - alpha;
@@ -299,8 +300,8 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
}
/* break out of the loop if generating stars takes too long */
- if(re && !(totstar % 1000000)) {
- if(re->test_break(re->tbh)) {
+ if (re && !(totstar % 1000000)) {
+ if (re->test_break(re->tbh)) {
x= ex + 1;
y= ey + 1;
z= ez + 1;
@@ -315,7 +316,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
}
if (termfunc) termfunc();
- if(obr)
+ if (obr)
re->tothalo += obr->tothalo;
}
@@ -355,11 +356,13 @@ static void split_v_renderfaces(ObjectRen *obr, int startvlak, int UNUSED(startv
if (v==vLen-1) {
VlakRen *vlr = RE_findOrAddVlak(obr, startvlak + vLen*uIndex + 0);
vlr->v1 = vert;
- } else {
+ }
+ else {
VlakRen *vlr = RE_findOrAddVlak(obr, startvlak + vLen*uIndex + v+1);
vlr->v1 = vert;
}
- } else {
+ }
+ else {
vlr->v2 = vert;
if (v<vLen-1) {
@@ -397,16 +400,16 @@ static void calc_edge_stress(Render *UNUSED(re), ObjectRen *obr, Mesh *me)
float loc[3], size[3], *accum, *acc, *accumoffs, *stress;
int a;
- if(obr->totvert==0) return;
+ if (obr->totvert==0) return;
mesh_get_texspace(me, loc, NULL, size);
accum= MEM_callocN(2*sizeof(float)*obr->totvert, "temp accum for stress");
/* de-normalize orco */
- for(a=0; a<obr->totvert; a++) {
+ for (a=0; a<obr->totvert; a++) {
VertRen *ver= RE_findOrAddVert(obr, a);
- if(ver->orco) {
+ if (ver->orco) {
ver->orco[0]= ver->orco[0]*size[0] +loc[0];
ver->orco[1]= ver->orco[1]*size[1] +loc[1];
ver->orco[2]= ver->orco[2]*size[2] +loc[2];
@@ -415,14 +418,14 @@ static void calc_edge_stress(Render *UNUSED(re), ObjectRen *obr, Mesh *me)
/* add stress values */
accumoffs= accum; /* so we can use vertex index */
- for(a=0; a<obr->totvlak; a++) {
+ for (a=0; a<obr->totvlak; a++) {
VlakRen *vlr= RE_findOrAddVlak(obr, a);
- if(vlr->v1->orco && vlr->v4) {
+ if (vlr->v1->orco && vlr->v4) {
calc_edge_stress_add(accumoffs, vlr->v1, vlr->v2);
calc_edge_stress_add(accumoffs, vlr->v2, vlr->v3);
calc_edge_stress_add(accumoffs, vlr->v3, vlr->v1);
- if(vlr->v4) {
+ if (vlr->v4) {
calc_edge_stress_add(accumoffs, vlr->v3, vlr->v4);
calc_edge_stress_add(accumoffs, vlr->v4, vlr->v1);
calc_edge_stress_add(accumoffs, vlr->v2, vlr->v4);
@@ -430,12 +433,12 @@ static void calc_edge_stress(Render *UNUSED(re), ObjectRen *obr, Mesh *me)
}
}
- for(a=0; a<obr->totvert; a++) {
+ for (a=0; a<obr->totvert; a++) {
VertRen *ver= RE_findOrAddVert(obr, a);
- if(ver->orco) {
+ if (ver->orco) {
/* find stress value */
acc= accumoffs + 2*ver->index;
- if(acc[1]!=0.0f)
+ if (acc[1]!=0.0f)
acc[0]/= acc[1];
stress= RE_vertren_get_stress(obr, ver, 1);
*stress= *acc;
@@ -459,25 +462,25 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
float *uv1, *uv2, *uv3, *uv4;
float uv[4][2];
- if(tface) {
+ if (tface) {
uv1= tface->uv[0];
uv2= tface->uv[1];
uv3= tface->uv[2];
uv4= tface->uv[3];
}
- else if(v1->orco) {
+ else if (v1->orco) {
uv1= uv[0]; uv2= uv[1]; uv3= uv[2]; uv4= uv[3];
map_to_sphere( &uv[0][0], &uv[0][1],v1->orco[0], v1->orco[1], v1->orco[2]);
map_to_sphere( &uv[1][0], &uv[1][1],v2->orco[0], v2->orco[1], v2->orco[2]);
map_to_sphere( &uv[2][0], &uv[2][1],v3->orco[0], v3->orco[1], v3->orco[2]);
- if(v4)
+ if (v4)
map_to_sphere( &uv[3][0], &uv[3][1],v4->orco[0], v4->orco[1], v4->orco[2]);
}
else return;
tangent_from_uv(uv1, uv2, uv3, v1->co, v2->co, v3->co, vlr->n, tang);
- if(do_tangent) {
+ if (do_tangent) {
tav= RE_vertren_get_tangent(obr, v1, 1);
add_v3_v3(tav, tang);
tav= RE_vertren_get_tangent(obr, v2, 1);
@@ -486,16 +489,16 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
add_v3_v3(tav, tang);
}
- if(do_nmap_tangent) {
+ if (do_nmap_tangent) {
sum_or_add_vertex_tangent(arena, &vtangents[v1->index], tang, uv1);
sum_or_add_vertex_tangent(arena, &vtangents[v2->index], tang, uv2);
sum_or_add_vertex_tangent(arena, &vtangents[v3->index], tang, uv3);
}
- if(v4) {
+ if (v4) {
tangent_from_uv(uv1, uv3, uv4, v1->co, v3->co, v4->co, vlr->n, tang);
- if(do_tangent) {
+ if (do_tangent) {
tav= RE_vertren_get_tangent(obr, v1, 1);
add_v3_v3(tav, tang);
tav= RE_vertren_get_tangent(obr, v3, 1);
@@ -504,7 +507,7 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
add_v3_v3(tav, tang);
}
- if(do_nmap_tangent) {
+ if (do_nmap_tangent) {
sum_or_add_vertex_tangent(arena, &vtangents[v1->index], tang, uv1);
sum_or_add_vertex_tangent(arena, &vtangents[v3->index], tang, uv3);
sum_or_add_vertex_tangent(arena, &vtangents[v4->index], tang, uv4);
@@ -557,11 +560,11 @@ static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[
MTFace *tface= RE_vlakren_get_tface(pMesh->obr, vlr, pMesh->obr->actmtface, NULL, 0);
const float *coord;
- if(tface != NULL) {
+ if (tface != NULL) {
coord= tface->uv[vert_index];
fUV[0]= coord[0]; fUV[1]= coord[1];
}
- else if((coord= (&vlr->v1)[vert_index]->orco)) {
+ else if ((coord= (&vlr->v1)[vert_index]->orco)) {
map_to_sphere(&fUV[0], &fUV[1], coord[0], coord[1], coord[2]);
}
else { /* else we get un-initialized value, 0.0 ok default? */
@@ -583,7 +586,7 @@ static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent
SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData;
VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num);
float * ftang= RE_vlakren_get_nmap_tangent(pMesh->obr, vlr, 1);
- if(ftang!=NULL) {
+ if (ftang!=NULL) {
copy_v3_v3(&ftang[iVert*4+0], fvTangent);
ftang[iVert*4+3]=fSign;
}
@@ -595,7 +598,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
VertexTangent **vtangents= NULL;
int a;
- if(do_nmap_tangent) {
+ if (do_nmap_tangent) {
arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "nmap tangent arena");
BLI_memarena_use_calloc(arena);
@@ -603,23 +606,23 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
}
/* clear all vertex normals */
- for(a=0; a<obr->totvert; a++) {
+ for (a=0; a<obr->totvert; a++) {
VertRen *ver= RE_findOrAddVert(obr, a);
ver->n[0]=ver->n[1]=ver->n[2]= 0.0f;
}
/* calculate cos of angles and point-masses, use as weight factor to
* add face normal to vertex */
- for(a=0; a<obr->totvlak; a++) {
+ for (a=0; a<obr->totvlak; a++) {
VlakRen *vlr= RE_findOrAddVlak(obr, a);
- if(vlr->flag & ME_SMOOTH) {
+ if (vlr->flag & ME_SMOOTH) {
float *n4= (vlr->v4)? vlr->v4->n: NULL;
float *c4= (vlr->v4)? vlr->v4->co: NULL;
accumulate_vertex_normals(vlr->v1->n, vlr->v2->n, vlr->v3->n, n4,
vlr->n, vlr->v1->co, vlr->v2->co, vlr->v3->co, c4);
}
- if(do_nmap_tangent || do_tangent) {
+ if (do_nmap_tangent || do_tangent) {
/* tangents still need to be calculated for flat faces too */
/* weighting removed, they are not vertexnormals */
calc_tangent_vector(obr, vtangents, arena, vlr, do_nmap_tangent, do_tangent);
@@ -627,21 +630,21 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
}
/* do solid faces */
- for(a=0; a<obr->totvlak; a++) {
+ for (a=0; a<obr->totvlak; a++) {
VlakRen *vlr= RE_findOrAddVlak(obr, a);
- if((vlr->flag & ME_SMOOTH)==0) {
- if(is_zero_v3(vlr->v1->n)) copy_v3_v3(vlr->v1->n, vlr->n);
- if(is_zero_v3(vlr->v2->n)) copy_v3_v3(vlr->v2->n, vlr->n);
- if(is_zero_v3(vlr->v3->n)) copy_v3_v3(vlr->v3->n, vlr->n);
- if(vlr->v4 && is_zero_v3(vlr->v4->n)) copy_v3_v3(vlr->v4->n, vlr->n);
+ if ((vlr->flag & ME_SMOOTH)==0) {
+ if (is_zero_v3(vlr->v1->n)) copy_v3_v3(vlr->v1->n, vlr->n);
+ if (is_zero_v3(vlr->v2->n)) copy_v3_v3(vlr->v2->n, vlr->n);
+ if (is_zero_v3(vlr->v3->n)) copy_v3_v3(vlr->v3->n, vlr->n);
+ if (vlr->v4 && is_zero_v3(vlr->v4->n)) copy_v3_v3(vlr->v4->n, vlr->n);
}
- if(do_nmap_tangent) {
+ if (do_nmap_tangent) {
VertRen *v1=vlr->v1, *v2=vlr->v2, *v3=vlr->v3, *v4=vlr->v4;
MTFace *tface= RE_vlakren_get_tface(obr, vlr, obr->actmtface, NULL, 0);
- if(tface) {
+ if (tface) {
int k=0;
float *vtang, *ftang= RE_vlakren_get_nmap_tangent(obr, vlr, 1);
@@ -654,12 +657,12 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
vtang= find_vertex_tangent(vtangents[v3->index], tface->uv[2]);
copy_v3_v3(ftang+8, vtang);
normalize_v3(ftang+8);
- if(v4) {
+ if (v4) {
vtang= find_vertex_tangent(vtangents[v4->index], tface->uv[3]);
copy_v3_v3(ftang+12, vtang);
normalize_v3(ftang+12);
}
- for(k=0; k<4; k++) ftang[4*k+3]=1;
+ for (k=0; k<4; k++) ftang[4*k+3]=1;
}
}
}
@@ -668,7 +671,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
for (a=0; a<obr->totvert; a++) {
VertRen *ver= RE_findOrAddVert(obr, a);
normalize_v3(ver->n);
- if(do_tangent) {
+ if (do_tangent) {
float *tav= RE_vertren_get_tangent(obr, ver, 0);
if (tav) {
/* orthonorm. */
@@ -703,9 +706,9 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
genTangSpaceDefault(&sContext);
}
- if(arena)
+ if (arena)
BLI_memarena_free(arena);
- if(vtangents)
+ if (vtangents)
MEM_freeN(vtangents);
}
@@ -729,16 +732,16 @@ static void as_addvert(ASvert *asv, VertRen *v1, VlakRen *vlr)
ASface *asf;
int a;
- if(v1 == NULL) return;
+ if (v1 == NULL) return;
- if(asv->faces.first==NULL) {
+ if (asv->faces.first==NULL) {
asf= MEM_callocN(sizeof(ASface), "asface");
BLI_addtail(&asv->faces, asf);
}
asf= asv->faces.last;
- for(a=0; a<4; a++) {
- if(asf->vlr[a]==NULL) {
+ for (a=0; a<4; a++) {
+ if (asf->vlr[a]==NULL) {
asf->vlr[a]= vlr;
asv->totface++;
break;
@@ -746,7 +749,7 @@ static void as_addvert(ASvert *asv, VertRen *v1, VlakRen *vlr)
}
/* new face struct */
- if(a==4) {
+ if (a==4) {
asf= MEM_callocN(sizeof(ASface), "asface");
BLI_addtail(&asv->faces, asf);
asf->vlr[0]= vlr;
@@ -761,14 +764,14 @@ static int as_testvertex(VlakRen *vlr, VertRen *UNUSED(ver), ASvert *asv, float
float inp;
int a;
- if(vlr==0) return 0;
+ if (vlr==0) return 0;
asf= asv->faces.first;
- while(asf) {
- for(a=0; a<4; a++) {
- if(asf->vlr[a] && asf->vlr[a]!=vlr) {
+ while (asf) {
+ for (a=0; a<4; a++) {
+ if (asf->vlr[a] && asf->vlr[a]!=vlr) {
inp = fabsf(dot_v3v3(vlr->n, asf->vlr[a]->n));
- if(inp < thresh) return 1;
+ if (inp < thresh) return 1;
}
}
asf= asf->next;
@@ -785,13 +788,13 @@ static VertRen *as_findvertex(VlakRen *vlr, VertRen *UNUSED(ver), ASvert *asv, f
int a;
asf= asv->faces.first;
- while(asf) {
- for(a=0; a<4; a++) {
- if(asf->vlr[a] && asf->vlr[a]!=vlr) {
+ while (asf) {
+ for (a=0; a<4; a++) {
+ if (asf->vlr[a] && asf->vlr[a]!=vlr) {
/* this face already made a copy for this vertex! */
- if(asf->nver[a]) {
+ if (asf->nver[a]) {
inp = fabsf(dot_v3v3(vlr->n, asf->vlr[a]->n));
- if(inp >= thresh) {
+ if (inp >= thresh) {
return asf->nver[a];
}
}
@@ -814,7 +817,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
float thresh;
int a, b, totvert;
- if(obr->totvert==0) return;
+ if (obr->totvert==0) return;
asverts= MEM_callocN(sizeof(ASvert)*obr->totvert, "all smooth verts");
thresh= cosf(DEG2RADF((0.5f + (float)degr)));
@@ -823,43 +826,43 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
/* step one: construct listbase of all vertices and pointers to faces */
- for(a=0; a<obr->totvlak; a++) {
+ for (a=0; a<obr->totvlak; a++) {
vlr= RE_findOrAddVlak(obr, a);
/* skip wire faces */
- if(vlr->v2 != vlr->v3) {
+ if (vlr->v2 != vlr->v3) {
as_addvert(asverts+vlr->v1->index, vlr->v1, vlr);
as_addvert(asverts+vlr->v2->index, vlr->v2, vlr);
as_addvert(asverts+vlr->v3->index, vlr->v3, vlr);
- if(vlr->v4)
+ if (vlr->v4)
as_addvert(asverts+vlr->v4->index, vlr->v4, vlr);
}
}
totvert= obr->totvert;
/* we now test all vertices, when faces have a normal too much different: they get a new vertex */
- for(a=0, asv=asverts; a<totvert; a++, asv++) {
- if(asv && asv->totface>1) {
+ for (a=0, asv=asverts; a<totvert; a++, asv++) {
+ if (asv && asv->totface>1) {
ver= RE_findOrAddVert(obr, a);
asf= asv->faces.first;
- while(asf) {
- for(b=0; b<4; b++) {
+ while (asf) {
+ for (b=0; b<4; b++) {
/* is there a reason to make a new vertex? */
vlr= asf->vlr[b];
- if( as_testvertex(vlr, ver, asv, thresh) ) {
+ if ( as_testvertex(vlr, ver, asv, thresh) ) {
/* already made a new vertex within threshold? */
v1= as_findvertex(vlr, ver, asv, thresh);
- if(v1==NULL) {
+ if (v1==NULL) {
/* make a new vertex */
v1= RE_vertren_copy(obr, ver);
}
asf->nver[b]= v1;
- if(vlr->v1==ver) vlr->v1= v1;
- if(vlr->v2==ver) vlr->v2= v1;
- if(vlr->v3==ver) vlr->v3= v1;
- if(vlr->v4==ver) vlr->v4= v1;
+ if (vlr->v1==ver) vlr->v1= v1;
+ if (vlr->v2==ver) vlr->v2= v1;
+ if (vlr->v3==ver) vlr->v3= v1;
+ if (vlr->v4==ver) vlr->v4= v1;
}
}
asf= asf->next;
@@ -868,22 +871,22 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
}
/* free */
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
BLI_freelistN(&asverts[a].faces);
}
MEM_freeN(asverts);
/* rotate vertices and calculate normal of faces */
- for(a=0; a<obr->totvert; a++) {
+ for (a=0; a<obr->totvert; a++) {
ver= RE_findOrAddVert(obr, a);
mul_m4_v3(mat, ver->co);
}
- for(a=0; a<obr->totvlak; a++) {
+ for (a=0; a<obr->totvlak; a++) {
vlr= RE_findOrAddVlak(obr, a);
/* skip wire faces */
- if(vlr->v2 != vlr->v3) {
- if(vlr->v4)
+ if (vlr->v2 != vlr->v3) {
+ if (vlr->v4)
normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
else
normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
@@ -907,7 +910,8 @@ static float *get_object_orco(Render *re, Object *ob)
if (!orco) {
if (ELEM(ob->type, OB_CURVE, OB_FONT)) {
orco = make_orco_curve(re->scene, ob);
- } else if (ob->type==OB_SURF) {
+ }
+ else if (ob->type==OB_SURF) {
orco = make_orco_surf(ob);
}
@@ -943,16 +947,16 @@ static void check_material_mapto(Material *ma)
* this can avoid a bit of time spent iterating through all the texture slots, map inputs and map tos
* every time a property which may or may not be textured is accessed */
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a] && ma->mtex[a]->tex) {
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a] && ma->mtex[a]->tex) {
/* currently used only in volume render, so we'll check for those flags */
- if(ma->mtex[a]->mapto & MAP_DENSITY) ma->mapto_textured |= MAP_DENSITY;
- if(ma->mtex[a]->mapto & MAP_EMISSION) ma->mapto_textured |= MAP_EMISSION;
- if(ma->mtex[a]->mapto & MAP_EMISSION_COL) ma->mapto_textured |= MAP_EMISSION_COL;
- if(ma->mtex[a]->mapto & MAP_SCATTERING) ma->mapto_textured |= MAP_SCATTERING;
- if(ma->mtex[a]->mapto & MAP_TRANSMISSION_COL) ma->mapto_textured |= MAP_TRANSMISSION_COL;
- if(ma->mtex[a]->mapto & MAP_REFLECTION) ma->mapto_textured |= MAP_REFLECTION;
- if(ma->mtex[a]->mapto & MAP_REFLECTION_COL) ma->mapto_textured |= MAP_REFLECTION_COL;
+ if (ma->mtex[a]->mapto & MAP_DENSITY) ma->mapto_textured |= MAP_DENSITY;
+ if (ma->mtex[a]->mapto & MAP_EMISSION) ma->mapto_textured |= MAP_EMISSION;
+ if (ma->mtex[a]->mapto & MAP_EMISSION_COL) ma->mapto_textured |= MAP_EMISSION_COL;
+ if (ma->mtex[a]->mapto & MAP_SCATTERING) ma->mapto_textured |= MAP_SCATTERING;
+ if (ma->mtex[a]->mapto & MAP_TRANSMISSION_COL) ma->mapto_textured |= MAP_TRANSMISSION_COL;
+ if (ma->mtex[a]->mapto & MAP_REFLECTION) ma->mapto_textured |= MAP_REFLECTION;
+ if (ma->mtex[a]->mapto & MAP_REFLECTION_COL) ma->mapto_textured |= MAP_REFLECTION_COL;
}
}
}
@@ -960,17 +964,17 @@ static void flag_render_node_material(Render *re, bNodeTree *ntree)
{
bNode *node;
- for(node=ntree->nodes.first; node; node= node->next) {
- if(node->id) {
- if(GS(node->id->name)==ID_MA) {
+ for (node=ntree->nodes.first; node; node= node->next) {
+ if (node->id) {
+ if (GS(node->id->name)==ID_MA) {
Material *ma= (Material *)node->id;
- if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
+ if ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
re->flag |= R_ZTRA;
ma->flag |= MA_IS_USED;
}
- else if(node->type==NODE_GROUP)
+ else if (node->type==NODE_GROUP)
flag_render_node_material(re, (bNodeTree *)node->id);
}
}
@@ -982,22 +986,22 @@ static Material *give_render_material(Render *re, Object *ob, short nr)
Material *ma;
ma= give_current_material(ob, nr);
- if(ma==NULL)
+ if (ma==NULL)
ma= &defmaterial;
- if(re->r.mode & R_SPEED) ma->texco |= NEED_UV;
+ if (re->r.mode & R_SPEED) ma->texco |= NEED_UV;
- if(ma->material_type == MA_TYPE_VOLUME) {
+ if (ma->material_type == MA_TYPE_VOLUME) {
ma->mode |= MA_TRANSP;
ma->mode &= ~MA_SHADBUF;
}
- if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
+ if ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
re->flag |= R_ZTRA;
/* for light groups and SSS */
ma->flag |= MA_IS_USED;
- if(ma->nodetree && ma->use_nodes)
+ if (ma->nodetree && ma->use_nodes)
flag_render_node_material(re, ma->nodetree);
check_material_mapto(ma);
@@ -1037,10 +1041,10 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
dy= re->winy*cross[1]*re->winmat[1][1];
w= sqrt(dx*dx + dy*dy)/w;
- if(w!=0.0f) {
+ if (w!=0.0f) {
float fac;
- if(ma->strand_ease!=0.0f) {
- if(ma->strand_ease<0.0f)
+ if (ma->strand_ease!=0.0f) {
+ if (ma->strand_ease<0.0f)
fac= pow(sd->time, 1.0f+ma->strand_ease);
else
fac= pow(sd->time, 1.0f/(1.0f-ma->strand_ease));
@@ -1050,11 +1054,11 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
width= ((1.0f-fac)*ma->strand_sta + (fac)*ma->strand_end);
/* use actual Blender units for strand width and fall back to minimum width */
- if(ma->mode & MA_STR_B_UNITS){
+ if (ma->mode & MA_STR_B_UNITS) {
crosslen= len_v3(cross);
w= 2.0f*crosslen*ma->strand_min/w;
- if(width < w)
+ if (width < w)
width= w;
/*cross is the radius of the strand so we want it to be half of full width */
@@ -1066,17 +1070,17 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
mul_v3_fl(cross, width);
}
- if(ma->mode & MA_TANGENT_STR)
+ if (ma->mode & MA_TANGENT_STR)
flag= R_SMOOTH|R_TANGENT;
else
flag= R_SMOOTH;
/* only 1 pixel wide strands filled in as quads now, otherwise zbuf errors */
- if(ma->strand_sta==1.0f)
+ if (ma->strand_sta==1.0f)
flag |= R_STRAND;
/* single face line */
- if(sd->line) {
+ if (sd->line) {
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
vlr->flag= flag;
vlr->v1= RE_findOrAddVert(obr, obr->totvert++);
@@ -1113,13 +1117,13 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
vlr->mat= ma;
vlr->ec= ME_V2V3;
- if(sd->surfnor) {
+ if (sd->surfnor) {
float *snor= RE_vlakren_get_surfnor(obr, vlr, 1);
copy_v3_v3(snor, sd->surfnor);
}
- if(sd->uvco){
- for(i=0; i<sd->totuv; i++){
+ if (sd->uvco) {
+ for (i=0; i<sd->totuv; i++) {
MTFace *mtf;
mtf=RE_vlakren_get_tface(obr,vlr,i,NULL,1);
mtf->uv[0][0]=mtf->uv[1][0]=
@@ -1127,7 +1131,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
mtf->uv[0][1]=mtf->uv[1][1]=
mtf->uv[2][1]=mtf->uv[3][1]=(sd->uvco+2*i)[1];
}
- if(sd->override_uv>=0){
+ if (sd->override_uv>=0) {
MTFace *mtf;
mtf=RE_vlakren_get_tface(obr,vlr,sd->override_uv,NULL,0);
@@ -1138,8 +1142,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
mtf->uv[2][1]=mtf->uv[3][1]=1.0f;
}
}
- if(sd->mcol){
- for(i=0; i<sd->totcol; i++){
+ if (sd->mcol) {
+ for (i=0; i<sd->totcol; i++) {
MCol *mc;
mc=RE_vlakren_get_mcol(obr,vlr,i,NULL,1);
mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
@@ -1148,8 +1152,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
}
}
/* first two vertices of a strand */
- else if(sd->first) {
- if(sd->adapt){
+ else if (sd->first) {
+ if (sd->adapt) {
copy_v3_v3(anor, nor);
copy_v3_v3(avec, vec);
second=1;
@@ -1172,7 +1176,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
}
/* more vertices & faces to strand */
else {
- if(sd->adapt==0 || second){
+ if (sd->adapt==0 || second) {
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
vlr->flag= flag;
vlr->v1= v1;
@@ -1184,14 +1188,14 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
v2= vlr->v3; // cycle
- if(sd->adapt){
+ if (sd->adapt) {
second=0;
copy_v3_v3(anor,nor);
copy_v3_v3(avec,vec);
}
}
- else if(sd->adapt){
+ else if (sd->adapt) {
float dvec[3],pvec[3];
sub_v3_v3v3(dvec,avec,vec);
project_v3_v3v3(pvec,dvec,vec);
@@ -1201,7 +1205,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
dx= re->winx*dvec[0]*re->winmat[0][0]/w;
dy= re->winy*dvec[1]*re->winmat[1][1]/w;
w= sqrt(dx*dx + dy*dy);
- if(dot_v3v3(anor,nor)<sd->adapt_angle && w>sd->adapt_pix){
+ if (dot_v3v3(anor,nor)<sd->adapt_angle && w>sd->adapt_pix) {
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
vlr->flag= flag;
vlr->v1= v1;
@@ -1215,7 +1219,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
copy_v3_v3(anor,nor);
copy_v3_v3(avec,vec);
}
- else{
+ else {
vlr= RE_findOrAddVlak(obr, obr->totvlak-1);
}
}
@@ -1237,13 +1241,13 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
vlr->mat= ma;
vlr->ec= ME_V2V3;
- if(sd->surfnor) {
+ if (sd->surfnor) {
float *snor= RE_vlakren_get_surfnor(obr, vlr, 1);
copy_v3_v3(snor, sd->surfnor);
}
- if(sd->uvco){
- for(i=0; i<sd->totuv; i++){
+ if (sd->uvco) {
+ for (i=0; i<sd->totuv; i++) {
MTFace *mtf;
mtf=RE_vlakren_get_tface(obr,vlr,i,NULL,1);
mtf->uv[0][0]=mtf->uv[1][0]=
@@ -1251,7 +1255,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
mtf->uv[0][1]=mtf->uv[1][1]=
mtf->uv[2][1]=mtf->uv[3][1]=(sd->uvco+2*i)[1];
}
- if(sd->override_uv>=0){
+ if (sd->override_uv>=0) {
MTFace *mtf;
mtf=RE_vlakren_get_tface(obr,vlr,sd->override_uv,NULL,0);
@@ -1262,8 +1266,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
mtf->uv[2][1]=mtf->uv[3][1]=(vlr->v3->accum+1.0f)/2.0f;
}
}
- if(sd->mcol){
- for(i=0; i<sd->totcol; i++){
+ if (sd->mcol) {
+ for (i=0; i<sd->totcol; i++) {
MCol *mc;
mc=RE_vlakren_get_mcol(obr,vlr,i,NULL,1);
mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
@@ -1278,7 +1282,7 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, const float vec[3
VlakRen *vlr;
static VertRen *v1;
- if(line) {
+ if (line) {
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
vlr->v1= RE_findOrAddVert(obr, obr->totvert++);
vlr->v2= RE_findOrAddVert(obr, obr->totvert++);
@@ -1297,7 +1301,7 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, const float vec[3
vlr->ec= ME_V1V2;
}
- else if(first) {
+ else if (first) {
v1= RE_findOrAddVert(obr, obr->totvert++);
copy_v3_v3(v1->co, vec);
}
@@ -1325,11 +1329,11 @@ static void particle_curve(Render *re, ObjectRen *obr, DerivedMesh *dm, Material
{
HaloRen *har=0;
- if(ma->material_type == MA_TYPE_WIRE)
+ if (ma->material_type == MA_TYPE_WIRE)
static_particle_wire(obr, ma, loc, loc1, sd->first, sd->line);
- else if(ma->material_type == MA_TYPE_HALO) {
+ else if (ma->material_type == MA_TYPE_HALO) {
har= RE_inithalo_particle(re, obr, dm, ma, loc, loc1, sd->orco, sd->uvco, sd->size, 1.0, seed, pa_co);
- if(har) har->lay= obr->ob->lay;
+ if (har) har->lay= obr->ob->lay;
}
else
static_particle_strand(re, obr, ma, sd, loc, loc1);
@@ -1378,17 +1382,17 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
vlr->mat= ma;
vlr->ec= ME_V2V3;
- if(bb->uv_split > 1){
+ if (bb->uv_split > 1) {
uvdx = uvdy = 1.0f / (float)bb->uv_split;
- if(ELEM(bb->anim, PART_BB_ANIM_AGE, PART_BB_ANIM_FRAME)) {
- if(bb->anim == PART_BB_ANIM_FRAME)
+ if (ELEM(bb->anim, PART_BB_ANIM_AGE, PART_BB_ANIM_FRAME)) {
+ if (bb->anim == PART_BB_ANIM_FRAME)
time = ((int)(bb->time * bb->lifetime) % totsplit)/(float)totsplit;
else
time = bb->time;
}
- else if(bb->anim == PART_BB_ANIM_ANGLE) {
- if(bb->align == PART_BB_VIEW) {
+ else if (bb->anim == PART_BB_ANIM_ANGLE) {
+ if (bb->align == PART_BB_VIEW) {
time = (float)fmod((bb->tilt + 1.0f) / 2.0f, 1.0);
}
else {
@@ -1398,23 +1402,23 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
axis1[(bb->align + 1) % 3] = 1.0f;
axis2[(bb->align + 2) % 3] = 1.0f;
- if(bb->lock == 0) {
+ if (bb->lock == 0) {
zvec[bb->align] = 0.0f;
normalize_v3(zvec);
}
time = saacos(dot_v3v3(zvec, axis1)) / (float)M_PI;
- if(dot_v3v3(zvec, axis2) < 0.0f)
+ if (dot_v3v3(zvec, axis2) < 0.0f)
time = 1.0f - time / 2.0f;
else
time /= 2.0f;
}
}
- if(bb->split_offset == PART_BB_OFF_LINEAR)
+ if (bb->split_offset == PART_BB_OFF_LINEAR)
time = (float)fmod(time + (float)bb->num / (float)totsplit, 1.0f);
- else if(bb->split_offset==PART_BB_OFF_RANDOM)
+ else if (bb->split_offset==PART_BB_OFF_RANDOM)
time = (float)fmod(time + bb->random, 1.0f);
/* Find the coordinates in tile space (integer), then convert to UV
@@ -1428,7 +1432,7 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
}
/* normal UVs */
- if(bb->uv[0] >= 0){
+ if (bb->uv[0] >= 0) {
mtf = RE_vlakren_get_tface(obr, vlr, bb->uv[0], NULL, 1);
mtf->uv[0][0] = 1.0f;
mtf->uv[0][1] = 1.0f;
@@ -1441,14 +1445,14 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
}
/* time-index UVs */
- if(bb->uv[1] >= 0){
+ if (bb->uv[1] >= 0) {
mtf = RE_vlakren_get_tface(obr, vlr, bb->uv[1], NULL, 1);
mtf->uv[0][0] = mtf->uv[1][0] = mtf->uv[2][0] = mtf->uv[3][0] = bb->time;
mtf->uv[0][1] = mtf->uv[1][1] = mtf->uv[2][1] = mtf->uv[3][1] = (float)bb->num/(float)bb->totnum;
}
/* split UVs */
- if(bb->uv_split > 1 && bb->uv[2] >= 0){
+ if (bb->uv_split > 1 && bb->uv[2] >= 0) {
mtf = RE_vlakren_get_tface(obr, vlr, bb->uv[2], NULL, 1);
mtf->uv[0][0] = uvx + uvdx;
mtf->uv[0][1] = uvy + uvdy;
@@ -1466,7 +1470,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re
copy_v3_v3(loc, state->co);
- if(ren_as != PART_DRAW_BB)
+ if (ren_as != PART_DRAW_BB)
mul_m4_v3(re->viewmat, loc);
switch(ren_as) {
@@ -1479,7 +1483,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re
mul_mat3_m4_v3(re->viewmat, vel);
normalize_v3(vel);
- if(part->draw & PART_DRAW_VEL_LENGTH)
+ if (part->draw & PART_DRAW_VEL_LENGTH)
mul_v3_fl(vel, len_v3(state->vel));
madd_v3_v3v3fl(loc0, loc, vel, -part->draw_line[0]);
@@ -1504,7 +1508,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re
har = RE_inithalo_particle(re, obr, dm, ma, loc, NULL, sd->orco, sd->uvco, hasize, 0.0, seed, pa_co);
- if(har) har->lay= obr->ob->lay;
+ if (har) har->lay= obr->ob->lay;
break;
}
@@ -1515,9 +1519,9 @@ static void get_particle_uvco_mcol(short from, DerivedMesh *dm, float *fuv, int
int i;
/* get uvco */
- if(sd->uvco && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
- for(i=0; i<sd->totuv; i++) {
- if(num != DMCACHE_NOTFOUND) {
+ if (sd->uvco && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
+ for (i=0; i<sd->totuv; i++) {
+ if (num != DMCACHE_NOTFOUND) {
MFace *mface = dm->getTessFaceData(dm, num, CD_MFACE);
MTFace *mtface = (MTFace*)CustomData_get_layer_n(&dm->faceData, CD_MTFACE, i);
mtface += num;
@@ -1532,9 +1536,9 @@ static void get_particle_uvco_mcol(short from, DerivedMesh *dm, float *fuv, int
}
/* get mcol */
- if(sd->mcol && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
- for(i=0; i<sd->totcol; i++) {
- if(num != DMCACHE_NOTFOUND) {
+ if (sd->mcol && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
+ for (i=0; i<sd->totcol; i++) {
+ if (num != DMCACHE_NOTFOUND) {
MFace *mface = dm->getTessFaceData(dm, num, CD_MFACE);
MCol *mc = (MCol*)CustomData_get_layer_n(&dm->faceData, CD_MCOL, i);
mc += num * 4;
@@ -1579,23 +1583,23 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
char **uv_name=0;
/* 1. check that everything is ok & updated */
- if(psys==NULL)
+ if (psys==NULL)
return 0;
part=psys->part;
pars=psys->particles;
- if(part==NULL || pars==NULL || !psys_check_enabled(ob, psys))
+ if (part==NULL || pars==NULL || !psys_check_enabled(ob, psys))
return 0;
- if(part->ren_as==PART_DRAW_OB || part->ren_as==PART_DRAW_GR || part->ren_as==PART_DRAW_NOT)
+ if (part->ren_as==PART_DRAW_OB || part->ren_as==PART_DRAW_GR || part->ren_as==PART_DRAW_NOT)
return 1;
/* 2. start initializing things */
/* last possibility to bail out! */
psmd = psys_get_modifier(ob,psys);
- if(!(psmd->modifier.mode & eModifierMode_Render))
+ if (!(psmd->modifier.mode & eModifierMode_Render))
return 0;
sim.scene= re->scene;
@@ -1603,16 +1607,16 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
sim.psys= psys;
sim.psmd= psmd;
- if(part->phystype==PART_PHYS_KEYED)
+ if (part->phystype==PART_PHYS_KEYED)
psys_count_keyed_targets(&sim);
totchild=psys->totchild;
/* can happen for disconnected/global hair */
- if(part->type==PART_HAIR && !psys->childcache)
+ if (part->type==PART_HAIR && !psys->childcache)
totchild= 0;
- if(G.rendering == 0) { /* preview render */
+ if (G.rendering == 0) { /* preview render */
totchild = (int)((float)totchild * (float)part->disp / 100.0f);
}
@@ -1629,7 +1633,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
ma= give_render_material(re, ob, part->omat);
#if 0 // XXX old animation system
- if(ma->ipo){
+ if (ma->ipo) {
calc_ipo(ma->ipo, cfra);
execute_ipo((ID *)ma, ma->ipo);
}
@@ -1644,10 +1648,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
sd.totuv = CustomData_number_of_layers(&psmd->dm->faceData, CD_MTFACE);
sd.totcol = CustomData_number_of_layers(&psmd->dm->faceData, CD_MCOL);
- if(ma->texco & TEXCO_UV && sd.totuv) {
+ if (ma->texco & TEXCO_UV && sd.totuv) {
sd.uvco = MEM_callocN(sd.totuv * 2 * sizeof(float), "particle_uvs");
- if(ma->strand_uvname[0]) {
+ if (ma->strand_uvname[0]) {
sd.override_uv = CustomData_get_named_layer_index(&psmd->dm->faceData, CD_MTFACE, ma->strand_uvname);
sd.override_uv -= CustomData_get_layer_index(&psmd->dm->faceData, CD_MTFACE);
}
@@ -1655,22 +1659,22 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
else
sd.uvco = NULL;
- if(sd.totcol)
+ if (sd.totcol)
sd.mcol = MEM_callocN(sd.totcol * sizeof(MCol), "particle_mcols");
/* 2.2 setup billboards */
- if(part->ren_as == PART_DRAW_BB) {
+ if (part->ren_as == PART_DRAW_BB) {
int first_uv = CustomData_get_layer_index(&psmd->dm->faceData, CD_MTFACE);
bb.uv[0] = CustomData_get_named_layer_index(&psmd->dm->faceData, CD_MTFACE, psys->bb_uvname[0]);
- if(bb.uv[0] < 0)
+ if (bb.uv[0] < 0)
bb.uv[0] = CustomData_get_active_layer_index(&psmd->dm->faceData, CD_MTFACE);
bb.uv[1] = CustomData_get_named_layer_index(&psmd->dm->faceData, CD_MTFACE, psys->bb_uvname[1]);
bb.uv[2] = CustomData_get_named_layer_index(&psmd->dm->faceData, CD_MTFACE, psys->bb_uvname[2]);
- if(first_uv >= 0) {
+ if (first_uv >= 0) {
bb.uv[0] -= first_uv;
bb.uv[1] -= first_uv;
bb.uv[2] -= first_uv;
@@ -1691,24 +1695,24 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
copy_m3_m4(nmat, ob->imat);
transpose_m3(nmat);
- if(psys->flag & PSYS_USE_IMAT) {
+ if (psys->flag & PSYS_USE_IMAT) {
/* psys->imat is the original emitter's inverse matrix, ob->obmat is the duplicated object's matrix */
mult_m4_m4m4(duplimat, ob->obmat, psys->imat);
use_duplimat = 1;
}
/* 2.6 setup strand rendering */
- if(part->ren_as == PART_DRAW_PATH && psys->pathcache){
+ if (part->ren_as == PART_DRAW_PATH && psys->pathcache) {
path_nbr=(int)pow(2.0,(double) part->ren_step);
- if(path_nbr) {
- if(!ELEM(ma->material_type, MA_TYPE_HALO, MA_TYPE_WIRE)) {
+ if (path_nbr) {
+ if (!ELEM(ma->material_type, MA_TYPE_HALO, MA_TYPE_WIRE)) {
sd.orco = MEM_mallocN(3*sizeof(float)*(totpart+totchild), "particle orcos");
set_object_orco(re, psys, sd.orco);
}
}
- if(part->draw & PART_DRAW_REN_ADAPT) {
+ if (part->draw & PART_DRAW_REN_ADAPT) {
sd.adapt = 1;
sd.adapt_pix = (float)part->adapt_pix;
sd.adapt_angle = cosf(DEG2RADF((float)part->adapt_angle));
@@ -1726,29 +1730,29 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
strandbuf->overrideuv= sd.override_uv;
strandbuf->minwidth= ma->strand_min;
- if(ma->strand_widthfade == 0.0f)
+ if (ma->strand_widthfade == 0.0f)
strandbuf->widthfade= 0.0f;
- else if(ma->strand_widthfade >= 1.0f)
+ else if (ma->strand_widthfade >= 1.0f)
strandbuf->widthfade= 2.0f - ma->strand_widthfade;
else
strandbuf->widthfade= 1.0f/MAX2(ma->strand_widthfade, 1e-5f);
- if(part->flag & PART_HAIR_BSPLINE)
+ if (part->flag & PART_HAIR_BSPLINE)
strandbuf->flag |= R_STRAND_BSPLINE;
- if(ma->mode & MA_STR_B_UNITS)
+ if (ma->mode & MA_STR_B_UNITS)
strandbuf->flag |= R_STRAND_B_UNITS;
svert= strandbuf->vert;
- if(re->r.mode & R_SPEED)
+ if (re->r.mode & R_SPEED)
dosurfacecache= 1;
- else if((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && (re->wrld.ao_gather_method == WO_AOGATHER_APPROX))
- if(ma->amb != 0.0f)
+ else if ((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && (re->wrld.ao_gather_method == WO_AOGATHER_APPROX))
+ if (ma->amb != 0.0f)
dosurfacecache= 1;
totface= psmd->dm->getNumTessFaces(psmd->dm);
origindex= psmd->dm->getTessFaceDataArray(psmd->dm, CD_ORIGINDEX);
- for(a=0; a<totface; a++)
+ for (a=0; a<totface; a++)
strandbuf->totbound= MAX2(strandbuf->totbound, (origindex)? origindex[a]: a);
strandbuf->totbound++;
@@ -1758,20 +1762,20 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
}
}
- if(sd.orco == 0) {
+ if (sd.orco == 0) {
sd.orco = MEM_mallocN(3 * sizeof(float), "particle orco");
orco1 = 1;
}
- if(path_nbr == 0)
+ if (path_nbr == 0)
psys->lattice = psys_get_lattice(&sim);
/* 3. start creating renderable things */
- for(a=0,pa=pars; a<totpart+totchild; a++, pa++, seed++) {
+ for (a=0,pa=pars; a<totpart+totchild; a++, pa++, seed++) {
random = rng_getFloat(rng);
/* setup per particle individual stuff */
- if(a<totpart){
- if(pa->flag & PARS_UNEXIST) continue;
+ if (a<totpart) {
+ if (pa->flag & PARS_UNEXIST) continue;
pa_time=(cfra-pa->time)/pa->lifetime;
pa_birthtime = pa->time;
@@ -1780,7 +1784,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
hasize = ma->hasize;
/* get orco */
- if(tpsys && part->phystype==PART_PHYS_NO){
+ if (tpsys && part->phystype==PART_PHYS_NO) {
tpa=tpsys->particles+pa->num;
psys_particle_on_emitter(psmd,tpart->from,tpa->num,pa->num_dmcache,tpa->fuv,tpa->foffset,co,nor,0,0,sd.orco,0);
}
@@ -1790,8 +1794,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
/* get uvco & mcol */
num= pa->num_dmcache;
- if(num == DMCACHE_NOTFOUND)
- if(pa->num < psmd->dm->getNumTessFaces(psmd->dm))
+ if (num == DMCACHE_NOTFOUND)
+ if (pa->num < psmd->dm->getNumTessFaces(psmd->dm))
num= pa->num;
get_particle_uvco_mcol(part->from, psmd->dm, pa->fuv, num, &sd);
@@ -1801,20 +1805,20 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
r_tilt = 2.0f*(PSYS_FRAND(a) - 0.5f);
r_length = PSYS_FRAND(a+1);
- if(path_nbr) {
+ if (path_nbr) {
cache = psys->pathcache[a];
max_k = (int)cache->steps;
}
- if(totchild && (part->draw&PART_DRAW_PARENT)==0) continue;
+ if (totchild && (part->draw&PART_DRAW_PARENT)==0) continue;
}
else {
ChildParticle *cpa= psys->child+a-totpart;
- if(path_nbr) {
+ if (path_nbr) {
cache = psys->childcache[a-totpart];
- if(cache->steps < 0)
+ if (cache->steps < 0)
continue;
max_k = (int)cache->steps;
@@ -1829,7 +1833,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
num = cpa->num;
/* get orco */
- if(part->childtype == PART_CHILD_FACES) {
+ if (part->childtype == PART_CHILD_FACES) {
psys_particle_on_emitter(psmd,
PART_FROM_FACE, cpa->num,DMCACHE_ISCHILD,
cpa->fuv,cpa->foffset,co,nor,0,0,sd.orco,0);
@@ -1842,15 +1846,15 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
}
/* get uvco & mcol */
- if(part->childtype==PART_CHILD_FACES) {
+ if (part->childtype==PART_CHILD_FACES) {
get_particle_uvco_mcol(PART_FROM_FACE, psmd->dm, cpa->fuv, cpa->num, &sd);
}
else {
ParticleData *parent = psys->particles + cpa->parent;
num = parent->num_dmcache;
- if(num == DMCACHE_NOTFOUND)
- if(parent->num < psmd->dm->getNumTessFaces(psmd->dm))
+ if (num == DMCACHE_NOTFOUND)
+ if (parent->num < psmd->dm->getNumTessFaces(psmd->dm))
num = parent->num;
get_particle_uvco_mcol(part->from, psmd->dm, parent->fuv, num, &sd);
@@ -1858,10 +1862,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
dosimplify = psys_render_simplify_params(psys, cpa, simplify);
- if(strandbuf) {
+ if (strandbuf) {
int orignum= (origindex)? origindex[cpa->num]: cpa->num;
- if(orignum > sbound - strandbuf->bound) {
+ if (orignum > sbound - strandbuf->bound) {
sbound= strandbuf->bound + orignum;
sbound->start= sbound->end= obr->totstrand;
}
@@ -1874,7 +1878,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
pa_co[2] = 0.f;
/* surface normal shading setup */
- if(ma->mode_l & MA_STR_SURFDIFF) {
+ if (ma->mode_l & MA_STR_SURFDIFF) {
mul_m3_v3(nmat, nor);
sd.surfnor= nor;
}
@@ -1882,31 +1886,31 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
sd.surfnor= NULL;
/* strand render setup */
- if(strandbuf) {
+ if (strandbuf) {
strand= RE_findOrAddStrand(obr, obr->totstrand++);
strand->buffer= strandbuf;
strand->vert= svert;
copy_v3_v3(strand->orco, sd.orco);
- if(dosimplify) {
+ if (dosimplify) {
float *ssimplify= RE_strandren_get_simplify(obr, strand, 1);
ssimplify[0]= simplify[0];
ssimplify[1]= simplify[1];
}
- if(sd.surfnor) {
+ if (sd.surfnor) {
float *snor= RE_strandren_get_surfnor(obr, strand, 1);
copy_v3_v3(snor, sd.surfnor);
}
- if(dosurfacecache && num >= 0) {
+ if (dosurfacecache && num >= 0) {
int *facenum= RE_strandren_get_face(obr, strand, 1);
*facenum= num;
}
- if(sd.uvco) {
- for(i=0; i<sd.totuv; i++) {
- if(i != sd.override_uv) {
+ if (sd.uvco) {
+ for (i=0; i<sd.totuv; i++) {
+ if (i != sd.override_uv) {
float *uv= RE_strandren_get_uv(obr, strand, i, NULL, 1);
uv[0]= sd.uvco[2*i];
@@ -1914,8 +1918,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
}
}
}
- if(sd.mcol) {
- for(i=0; i<sd.totcol; i++) {
+ if (sd.mcol) {
+ for (i=0; i<sd.totcol; i++) {
MCol *mc= RE_strandren_get_mcol(obr, strand, i, NULL, 1);
*mc = sd.mcol[i];
}
@@ -1925,43 +1929,43 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
}
/* strandco computation setup */
- if(path_nbr) {
+ if (path_nbr) {
strandlen= 0.0f;
curlen= 0.0f;
- for(k=1; k<=path_nbr; k++)
- if(k<=max_k)
+ for (k=1; k<=path_nbr; k++)
+ if (k<=max_k)
strandlen += len_v3v3((cache+k-1)->co, (cache+k)->co);
}
- if(path_nbr) {
+ if (path_nbr) {
/* render strands */
- for(k=0; k<=path_nbr; k++){
+ for (k=0; k<=path_nbr; k++) {
float time;
- if(k<=max_k){
+ if (k<=max_k) {
copy_v3_v3(state.co,(cache+k)->co);
copy_v3_v3(state.vel,(cache+k)->vel);
}
else
continue;
- if(k > 0)
+ if (k > 0)
curlen += len_v3v3((cache+k-1)->co, (cache+k)->co);
time= curlen/strandlen;
copy_v3_v3(loc,state.co);
mul_m4_v3(re->viewmat,loc);
- if(strandbuf) {
+ if (strandbuf) {
copy_v3_v3(svert->co, loc);
svert->strandco= -1.0f + 2.0f*time;
svert++;
strand->totvert++;
}
- else{
+ else {
sd.size = hasize;
- if(k==1){
+ if (k==1) {
sd.first = 1;
sd.time = 0.0f;
sub_v3_v3v3(loc0,loc1,loc);
@@ -1973,7 +1977,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
sd.first = 0;
sd.time = time;
- if(k)
+ if (k)
particle_curve(re, obr, psmd->dm, ma, &sd, loc, loc1, seed, pa_co);
copy_v3_v3(loc1,loc);
@@ -1983,7 +1987,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
}
else {
/* render normal particles */
- if(part->trail_count > 1) {
+ if (part->trail_count > 1) {
float length = part->path_end * (1.0f - part->randlength * r_length);
int trail_count = part->trail_count * (1.0f - part->randlength * r_length);
float ct = (part->draw & PART_ABS_PATH_TIME) ? cfra : pa_time;
@@ -1992,24 +1996,24 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
/* make sure we have pointcache in memory before getting particle on path */
psys_make_temp_pointcache(ob, psys);
- for(i=0; i < trail_count; i++, ct -= dt) {
- if(part->draw & PART_ABS_PATH_TIME) {
- if(ct < pa_birthtime || ct > pa_dietime)
+ for (i=0; i < trail_count; i++, ct -= dt) {
+ if (part->draw & PART_ABS_PATH_TIME) {
+ if (ct < pa_birthtime || ct > pa_dietime)
continue;
}
- else if(ct < 0.0f || ct > 1.0f)
+ else if (ct < 0.0f || ct > 1.0f)
continue;
state.time = (part->draw & PART_ABS_PATH_TIME) ? -ct : ct;
psys_get_particle_on_path(&sim,a,&state,1);
- if(psys->parent)
+ if (psys->parent)
mul_m4_v3(psys->parent->obmat, state.co);
- if(use_duplimat)
+ if (use_duplimat)
mul_m4_v4(duplimat, state.co);
- if(part->ren_as == PART_DRAW_BB) {
+ if (part->ren_as == PART_DRAW_BB) {
bb.random = random;
bb.offset[0] = part->bb_offset[0];
bb.offset[1] = part->bb_offset[1];
@@ -2038,16 +2042,16 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
}
else {
state.time=cfra;
- if(psys_get_particle_state(&sim,a,&state,0)==0)
+ if (psys_get_particle_state(&sim,a,&state,0)==0)
continue;
- if(psys->parent)
+ if (psys->parent)
mul_m4_v3(psys->parent->obmat, state.co);
- if(use_duplimat)
+ if (use_duplimat)
mul_m4_v3(duplimat, state.co);
- if(part->ren_as == PART_DRAW_BB) {
+ if (part->ren_as == PART_DRAW_BB) {
bb.random = random;
bb.offset[0] = part->bb_offset[0];
bb.offset[1] = part->bb_offset[1];
@@ -2073,46 +2077,46 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
}
}
- if(orco1==0)
+ if (orco1==0)
sd.orco+=3;
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
break;
}
- if(dosurfacecache)
+ if (dosurfacecache)
strandbuf->surface= cache_strand_surface(re, obr, psmd->dm, mat, timeoffset);
/* 4. clean up */
#if 0 // XXX old animation system
- if(ma) do_mat_ipo(re->scene, ma);
+ if (ma) do_mat_ipo(re->scene, ma);
#endif // XXX old animation system
- if(orco1)
+ if (orco1)
MEM_freeN(sd.orco);
- if(sd.uvco)
+ if (sd.uvco)
MEM_freeN(sd.uvco);
- if(sd.mcol)
+ if (sd.mcol)
MEM_freeN(sd.mcol);
- if(uv_name)
+ if (uv_name)
MEM_freeN(uv_name);
- if(states)
+ if (states)
MEM_freeN(states);
rng_free(rng);
psys->flag &= ~PSYS_DRAWING;
- if(psys->lattice){
+ if (psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
- if(path_nbr && (ma->mode_l & MA_TANGENT_STR)==0)
+ if (path_nbr && (ma->mode_l & MA_TANGENT_STR)==0)
calc_vertexnormals(re, obr, 0, 0);
return 1;
@@ -2135,16 +2139,16 @@ static void make_render_halos(Render *re, ObjectRen *obr, Mesh *UNUSED(me), int
re->flag |= R_HALO;
- for(a=0; a<totvert; a++, mvert++) {
+ for (a=0; a<totvert; a++, mvert++) {
ok= 1;
- if(ok) {
+ if (ok) {
hasize= ma->hasize;
copy_v3_v3(vec, mvert->co);
mul_m4_v3(mat, vec);
- if(ma->mode & MA_HALOPUNO) {
+ if (ma->mode & MA_HALOPUNO) {
xn= mvert->no[0];
yn= mvert->no[1];
zn= mvert->no[2];
@@ -2159,15 +2163,15 @@ static void make_render_halos(Render *re, ObjectRen *obr, Mesh *UNUSED(me), int
normalize_v3(view);
zn = dot_v3v3(nor, view);
- if(zn>=0.0f) hasize= 0.0f;
+ if (zn>=0.0f) hasize= 0.0f;
else hasize*= zn*zn*zn*zn;
}
- if(orco) har= RE_inithalo(re, obr, ma, vec, NULL, orco, hasize, 0.0, seed);
+ if (orco) har= RE_inithalo(re, obr, ma, vec, NULL, orco, hasize, 0.0, seed);
else har= RE_inithalo(re, obr, ma, vec, NULL, mvert->co, hasize, 0.0, seed);
- if(har) har->lay= ob->lay;
+ if (har) har->lay= ob->lay;
}
- if(orco) orco+= 3;
+ if (orco) orco+= 3;
seed++;
}
}
@@ -2177,8 +2181,8 @@ static int verghalo(const void *a1, const void *a2)
const HaloRen *har1= *(const HaloRen**)a1;
const HaloRen *har2= *(const HaloRen**)a2;
- if(har1->zs < har2->zs) return 1;
- else if(har1->zs > har2->zs) return -1;
+ if (har1->zs < har2->zs) return 1;
+ else if (har1->zs > har2->zs) return -1;
return 0;
}
@@ -2188,14 +2192,14 @@ static void sort_halos(Render *re, int totsort)
HaloRen *har= NULL, **haso;
int a;
- if(re->tothalo==0) return;
+ if (re->tothalo==0) return;
re->sortedhalos= MEM_callocN(sizeof(HaloRen*)*re->tothalo, "sorthalos");
haso= re->sortedhalos;
- for(obr=re->objecttable.first; obr; obr=obr->next) {
- for(a=0; a<obr->tothalo; a++) {
- if((a & 255)==0) har= obr->bloha[a>>8];
+ for (obr=re->objecttable.first; obr; obr=obr->next) {
+ for (a=0; a<obr->tothalo; a++) {
+ if ((a & 255)==0) har= obr->bloha[a>>8];
else har++;
*(haso++)= har;
@@ -2218,7 +2222,7 @@ static short test_for_displace(Render *re, Object *ob)
for (i=1; i<=ob->totcol; i++) {
ma=give_render_material(re, ob, i);
/* ma->mapto is ORed total of all mapto channels */
- if(ma && (ma->mapto & MAP_DISPLACE)) return 1;
+ if (ma && (ma->mapto & MAP_DISPLACE)) return 1;
}
return 0;
}
@@ -2236,10 +2240,10 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve
/* vertex normal is used for textures type 'col' and 'var' */
copy_v3_v3(shi->vn, vr->n);
- if(mat)
+ if (mat)
mul_m4_v3(mat, shi->co);
- if(imat) {
+ if (imat) {
shi->vn[0] = dot_v3v3(imat[0], vr->n);
shi->vn[1] = dot_v3v3(imat[1], vr->n);
shi->vn[2] = dot_v3v3(imat[2], vr->n);
@@ -2267,7 +2271,7 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve
}
if (texco & TEXCO_STICKY) {
float *sticky= RE_vertren_get_sticky(obr, vr, 0);
- if(sticky) {
+ if (sticky) {
shi->sticky[0]= sticky[0];
shi->sticky[1]= sticky[1];
shi->sticky[2]= 0.0f;
@@ -2280,15 +2284,15 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve
if (texco & TEXCO_NORM) {
copy_v3_v3(shi->orn, shi->vn);
}
- if(texco & TEXCO_REFL) {
+ if (texco & TEXCO_REFL) {
/* not (yet?) */
}
- if(texco & TEXCO_STRESS) {
+ if (texco & TEXCO_STRESS) {
float *s= RE_vertren_get_stress(obr, vr, 0);
- if(s) {
+ if (s) {
shi->stress= *s;
- if(shi->stress<1.0f) shi->stress-= 1.0f;
+ if (shi->stress<1.0f) shi->stress-= 1.0f;
else shi->stress= (shi->stress-1.0f)/shi->stress;
}
else
@@ -2306,7 +2310,7 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve
displace[1]= shi->displace[1] * scale[1];
displace[2]= shi->displace[2] * scale[2];
- if(mat)
+ if (mat)
mul_m3_v3(imat, displace);
/* 0.5 could become button once? */
@@ -2341,7 +2345,7 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
/* set up shadeinput struct for multitex() */
- /* memset above means we dont need this */
+ /* memset above means we don't need this */
/*shi.osatex= 0;*/ /* signal not to use dx[] and dy[] texture AA vectors */
shi.obr= obr;
@@ -2378,7 +2382,7 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
}
/* Recalculate the face normal - if flipped before, flip now */
- if(vlr->v4) {
+ if (vlr->v4) {
normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
}
else {
@@ -2397,19 +2401,19 @@ static void do_displacement(Render *re, ObjectRen *obr, float mat[][4], float im
/* Object Size with parenting */
obt=obr->ob;
- while(obt){
+ while (obt) {
mul_v3_v3v3(temp, obt->size, obt->dscale);
scale[0]*=temp[0]; scale[1]*=temp[1]; scale[2]*=temp[2];
obt=obt->parent;
}
/* Clear all flags */
- for(i=0; i<obr->totvert; i++){
+ for (i=0; i<obr->totvert; i++) {
vr= RE_findOrAddVert(obr, i);
vr->flag= 0;
}
- for(i=0; i<obr->totvlak; i++){
+ for (i=0; i<obr->totvlak; i++) {
vlr=RE_findOrAddVlak(obr, i);
displace_render_face(re, obr, vlr, scale, mat, imat);
}
@@ -2430,7 +2434,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
VlakRen *vlr, *vlr1;
Material *ma;
float *data, *nors, *orco=NULL, mat[4][4], imat[3][3], xn, yn, zn;
- int a, need_orco, vlakindex, *index;
+ int a, need_orco, vlakindex, *index, negative_scale;
ListBase dispbase= {NULL, NULL};
if (ob!=find_basis_mball(re->scene, ob))
@@ -2439,21 +2443,22 @@ static void init_render_mball(Render *re, ObjectRen *obr)
mult_m4_m4m4(mat, re->viewmat, ob->obmat);
invert_m4_m4(ob->imat, mat);
copy_m3_m4(imat, ob->imat);
+ negative_scale = is_negative_m4(mat);
ma= give_render_material(re, ob, 1);
need_orco= 0;
- if(ma->texco & TEXCO_ORCO) {
+ if (ma->texco & TEXCO_ORCO) {
need_orco= 1;
}
makeDispListMBall_forRender(re->scene, ob, &dispbase);
dl= dispbase.first;
- if(dl==0) return;
+ if (dl==0) return;
data= dl->verts;
nors= dl->nors;
- if(need_orco) {
+ if (need_orco) {
orco= get_object_orco(re, ob);
if (!orco) {
@@ -2463,7 +2468,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
}
}
- for(a=0; a<dl->nr; a++, data+=3, nors+=3) {
+ for (a=0; a<dl->nr; a++, data+=3, nors+=3) {
ver= RE_findOrAddVert(obr, obr->totvert++);
copy_v3_v3(ver->co, data);
@@ -2481,14 +2486,14 @@ static void init_render_mball(Render *re, ObjectRen *obr)
normalize_v3(ver->n);
//if(ob->transflag & OB_NEG_SCALE) negate_v3(ver->n);
- if(need_orco) {
+ if (need_orco) {
ver->orco= orco;
orco+=3;
}
}
index= dl->index;
- for(a=0; a<dl->parts; a++, index+=4) {
+ for (a=0; a<dl->parts; a++, index+=4) {
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
vlr->v1= RE_findOrAddVert(obr, index[0]);
@@ -2496,7 +2501,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
vlr->v3= RE_findOrAddVert(obr, index[2]);
vlr->v4= 0;
- if(ob->transflag & OB_NEG_SCALE)
+ if (negative_scale)
normal_tri_v3( vlr->n,vlr->v1->co, vlr->v2->co, vlr->v3->co);
else
normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
@@ -2506,14 +2511,14 @@ static void init_render_mball(Render *re, ObjectRen *obr)
vlr->ec= 0;
/* mball -too bad- always has triangles, because quads can be non-planar */
- if(index[3] && index[3]!=index[2]) {
+ if (index[3] && index[3]!=index[2]) {
vlr1= RE_findOrAddVlak(obr, obr->totvlak++);
vlakindex= vlr1->index;
*vlr1= *vlr;
vlr1->index= vlakindex;
vlr1->v2= vlr1->v3;
vlr1->v3= RE_findOrAddVert(obr, index[3]);
- if(ob->transflag & OB_NEG_SCALE)
+ if (negative_scale)
normal_tri_v3( vlr1->n,vlr1->v1->co, vlr1->v2->co, vlr1->v3->co);
else
normal_tri_v3( vlr1->n,vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
@@ -2546,7 +2551,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
for (u = 0; u < sizeu; u++) {
v1 = RE_findOrAddVert(obr, obr->totvert++); /* save this for possible V wrapping */
copy_v3_v3(v1->co, data); data += 3;
- if(orco) {
+ if (orco) {
v1->orco= orco; orco+= 3; orcoret++;
}
mul_m4_v3(mat, v1->co);
@@ -2554,7 +2559,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
for (v = 1; v < sizev; v++) {
ver= RE_findOrAddVert(obr, obr->totvert++);
copy_v3_v3(ver->co, data); data += 3;
- if(orco) {
+ if (orco) {
ver->orco= orco; orco+= 3; orcoret++;
}
mul_m4_v3(mat, ver->co);
@@ -2563,7 +2568,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
if (dl->flag & DL_CYCL_U) {
ver= RE_findOrAddVert(obr, obr->totvert++);
copy_v3_v3(ver->co, v1->co);
- if(orco) {
+ if (orco) {
ver->orco= orco; orco+=3; orcoret++; //orcobase + 3*(u*sizev + 0);
}
}
@@ -2579,7 +2584,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
v1= RE_findOrAddVert(obr, startvert + v);
ver= RE_findOrAddVert(obr, obr->totvert++);
copy_v3_v3(ver->co, v1->co);
- if(orco) {
+ if (orco) {
ver->orco= orco; orco+=3; orcoret++; //ver->orco= orcobase + 3*(0*sizev + v);
}
}
@@ -2590,13 +2595,13 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
startvlak= obr->totvlak;
- for(u = 0; u < sizeu - 1; u++) {
+ for (u = 0; u < sizeu - 1; u++) {
p1 = startvert + u * sizev; /* walk through face list */
p2 = p1 + 1;
p3 = p2 + sizev;
p4 = p3 - 1;
- for(v = 0; v < sizev - 1; v++) {
+ for (v = 0; v < sizev - 1; v++) {
v1= RE_findOrAddVert(obr, p1);
v2= RE_findOrAddVert(obr, p2);
v3= RE_findOrAddVert(obr, p3);
@@ -2680,7 +2685,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
copy_v3_v3(vlr2->v2->n, n1);
copy_v3_v3(vlr3->v4->n, n1);
}
- for(a = startvert; a < obr->totvert; a++) {
+ for (a = startvert; a < obr->totvert; a++) {
ver= RE_findOrAddVert(obr, a);
normalize_v3(ver->n);
}
@@ -2705,18 +2710,18 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
mvert= dm->getVertArray(dm);
totvert= dm->getNumVerts(dm);
- for(a=0; a<totvert; a++, mvert++) {
+ for (a=0; a<totvert; a++, mvert++) {
ver= RE_findOrAddVert(obr, obr->totvert++);
copy_v3_v3(ver->co, mvert->co);
mul_m4_v3(mat, ver->co);
- if(orco) {
+ if (orco) {
ver->orco= orco;
orco+=3;
}
}
- if(!timeoffset) {
+ if (!timeoffset) {
/* store customdata names, because DerivedMesh is freed */
RE_set_customdata_names(obr, &dm->faceData);
@@ -2724,16 +2729,16 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
/* faces in order of color blocks */
vertofs= obr->totvert - totvert;
- for(mat_iter= 0; (mat_iter < ob->totcol || (mat_iter==0 && ob->totcol==0)); mat_iter++) {
+ for (mat_iter= 0; (mat_iter < ob->totcol || (mat_iter==0 && ob->totcol==0)); mat_iter++) {
ma= give_render_material(re, ob, mat_iter+1);
end= dm->getNumTessFaces(dm);
mface= dm->getTessFaceArray(dm);
- for(a=0; a<end; a++, mface++) {
+ for (a=0; a<end; a++, mface++) {
int v1, v2, v3, v4, flag;
- if(mface->mat_nr == mat_iter) {
+ if (mface->mat_nr == mat_iter) {
float len;
v1= mface->v1;
@@ -2746,11 +2751,11 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
vlr->v1= RE_findOrAddVert(obr, vertofs+v1);
vlr->v2= RE_findOrAddVert(obr, vertofs+v2);
vlr->v3= RE_findOrAddVert(obr, vertofs+v3);
- if(v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
+ if (v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
else vlr->v4= 0;
/* render normals are inverted in render */
- if(vlr->v4)
+ if (vlr->v4)
len= normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
else
len= normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
@@ -2759,7 +2764,7 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
vlr->flag= flag;
vlr->ec= 0; /* mesh edges rendered separately */
- if(len==0) obr->totvlak--;
+ if (len==0) obr->totvlak--;
else {
CustomDataLayer *layer;
MTFace *mtface, *mtf;
@@ -2767,16 +2772,16 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
int index, mtfn= 0, mcn= 0;
char *name;
- for(index=0; index<dm->faceData.totlayer; index++) {
+ for (index=0; index<dm->faceData.totlayer; index++) {
layer= &dm->faceData.layers[index];
name= layer->name;
- if(layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
+ if (layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
mtf= RE_vlakren_get_tface(obr, vlr, mtfn++, &name, 1);
mtface= (MTFace*)layer->data;
*mtf= mtface[a];
}
- else if(layer->type == CD_MCOL && mcn < MAX_MCOL) {
+ else if (layer->type == CD_MCOL && mcn < MAX_MCOL) {
mc= RE_vlakren_get_mcol(obr, vlr, mcn++, &name, 1);
mcol= (MCol*)layer->data;
memcpy(mc, &mcol[a*4], sizeof(MCol)*4);
@@ -2807,7 +2812,7 @@ static void init_render_surf(Render *re, ObjectRen *obr, int timeoffset)
cu= ob->data;
nu= cu->nurb.first;
- if(nu==0) return;
+ if (nu==0) return;
mult_m4_m4m4(mat, re->viewmat, ob->obmat);
invert_m4_m4(ob->imat, mat);
@@ -2816,36 +2821,37 @@ static void init_render_surf(Render *re, ObjectRen *obr, int timeoffset)
totmat= ob->totcol+1;
matar= MEM_callocN(sizeof(Material*)*totmat, "init_render_surf matar");
- for(a=0; a<totmat; a++) {
+ for (a=0; a<totmat; a++) {
matar[a]= give_render_material(re, ob, a+1);
- if(matar[a] && matar[a]->texco & TEXCO_ORCO)
+ if (matar[a] && matar[a]->texco & TEXCO_ORCO)
need_orco= 1;
}
- if(ob->parent && (ob->parent->type==OB_LATTICE)) need_orco= 1;
+ if (ob->parent && (ob->parent->type==OB_LATTICE)) need_orco= 1;
makeDispListSurf(re->scene, ob, &displist, &dm, 1, 0);
if (dm) {
- if(need_orco) {
+ if (need_orco) {
orco= makeOrcoDispList(re->scene, ob, dm, 1);
- if(orco) {
+ if (orco) {
set_object_orco(re, ob, orco);
}
}
init_render_dm(dm, re, obr, timeoffset, orco, mat);
dm->release(dm);
- } else {
- if(need_orco) {
+ }
+ else {
+ if (need_orco) {
orco= get_object_orco(re, ob);
}
/* walk along displaylist and create rendervertices/-faces */
- for(dl=displist.first; dl; dl=dl->next) {
+ for (dl=displist.first; dl; dl=dl->next) {
/* watch out: u ^= y, v ^= x !! */
- if(dl->type==DL_SURF)
+ if (dl->type==DL_SURF)
orco+= 3*dl_surf_to_renderdata(obr, dl, matar, orco, mat);
}
}
@@ -2871,12 +2877,12 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
int need_orco=0, totmat;
cu= ob->data;
- if(ob->type==OB_FONT && cu->str==NULL) return;
- else if(ob->type==OB_CURVE && cu->nurb.first==NULL) return;
+ if (ob->type==OB_FONT && cu->str==NULL) return;
+ else if (ob->type==OB_CURVE && cu->nurb.first==NULL) return;
makeDispListCurveTypes_forRender(re->scene, ob, &disp, &dm, 0);
dl= disp.first;
- if(dl==NULL) return;
+ if (dl==NULL) return;
mult_m4_m4m4(mat, re->viewmat, ob->obmat);
invert_m4_m4(ob->imat, mat);
@@ -2885,39 +2891,40 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
totmat= ob->totcol+1;
matar= MEM_callocN(sizeof(Material*)*totmat, "init_render_surf matar");
- for(a=0; a<totmat; a++) {
+ for (a=0; a<totmat; a++) {
matar[a]= give_render_material(re, ob, a+1);
- if(matar[a] && matar[a]->texco & TEXCO_ORCO)
+ if (matar[a] && matar[a]->texco & TEXCO_ORCO)
need_orco= 1;
}
if (dm) {
- if(need_orco) {
+ if (need_orco) {
orco= makeOrcoDispList(re->scene, ob, dm, 1);
- if(orco) {
+ if (orco) {
set_object_orco(re, ob, orco);
}
}
init_render_dm(dm, re, obr, timeoffset, orco, mat);
dm->release(dm);
- } else {
- if(need_orco) {
+ }
+ else {
+ if (need_orco) {
orco= get_object_orco(re, ob);
}
- while(dl) {
- if(dl->col > ob->totcol) {
+ while (dl) {
+ if (dl->col > ob->totcol) {
/* pass */
}
- else if(dl->type==DL_INDEX3) {
+ else if (dl->type==DL_INDEX3) {
int *index;
startvert= obr->totvert;
data= dl->verts;
- for(a=0; a<dl->nr; a++, data+=3) {
+ for (a=0; a<dl->nr; a++, data+=3) {
ver= RE_findOrAddVert(obr, obr->totvert++);
copy_v3_v3(ver->co, data);
@@ -2929,20 +2936,20 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
}
}
- if(timeoffset==0) {
+ if (timeoffset==0) {
float tmp[3];
const int startvlak= obr->totvlak;
zero_v3(n);
index= dl->index;
- for(a=0; a<dl->parts; a++, index+=3) {
+ for (a=0; a<dl->parts; a++, index+=3) {
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
vlr->v1= RE_findOrAddVert(obr, startvert+index[0]);
vlr->v2= RE_findOrAddVert(obr, startvert+index[1]);
vlr->v3= RE_findOrAddVert(obr, startvert+index[2]);
vlr->v4= NULL;
- if(area_tri_v3(vlr->v3->co, vlr->v2->co, vlr->v1->co)>FLT_EPSILON) {
+ if (area_tri_v3(vlr->v3->co, vlr->v2->co, vlr->v1->co)>FLT_EPSILON) {
normal_tri_v3(tmp, vlr->v3->co, vlr->v2->co, vlr->v1->co);
add_v3_v3(n, tmp);
}
@@ -2955,7 +2962,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
normalize_v3(n);
/* vertex normals */
- for(a= startvlak; a<obr->totvlak; a++) {
+ for (a= startvlak; a<obr->totvlak; a++) {
vlr= RE_findOrAddVlak(obr, a);
copy_v3_v3(vlr->n, n);
@@ -2963,7 +2970,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
add_v3_v3(vlr->v3->n, vlr->n);
add_v3_v3(vlr->v2->n, vlr->n);
}
- for(a=startvert; a<obr->totvert; a++) {
+ for (a=startvert; a<obr->totvert; a++) {
ver= RE_findOrAddVert(obr, a);
normalize_v3(ver->n);
}
@@ -2982,7 +2989,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
startvert= obr->totvert;
nr= dl->nr*dl->parts;
- while(nr--) {
+ while (nr--) {
ver= RE_findOrAddVert(obr, obr->totvert++);
copy_v3_v3(ver->co, fp);
@@ -2995,10 +3002,10 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
}
}
- if(dl->bevelSplitFlag || timeoffset==0) {
+ if (dl->bevelSplitFlag || timeoffset==0) {
const int startvlak= obr->totvlak;
- for(a=0; a<dl->parts; a++) {
+ for (a=0; a<dl->parts; a++) {
if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
break;
@@ -3008,7 +3015,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
p3+= startvert;
p4+= startvert;
- for(; b<dl->nr; b++) {
+ for (; b<dl->nr; b++) {
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
/* important 1 offset in order is kept [#24913] */
vlr->v1= RE_findOrAddVert(obr, p2);
@@ -3016,7 +3023,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
vlr->v3= RE_findOrAddVert(obr, p3);
vlr->v4= RE_findOrAddVert(obr, p4);
vlr->ec= ME_V2V3+ME_V3V4;
- if(a==0) vlr->ec+= ME_V1V2;
+ if (a==0) vlr->ec+= ME_V1V2;
vlr->flag= dl->rt;
@@ -3031,13 +3038,13 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
}
if (dl->bevelSplitFlag) {
- for(a=0; a<dl->parts-1+!!(dl->flag&DL_CYCL_V); a++)
- if(dl->bevelSplitFlag[a>>5]&(1<<(a&0x1F)))
+ for (a=0; a<dl->parts-1+!!(dl->flag&DL_CYCL_V); a++)
+ if (dl->bevelSplitFlag[a>>5]&(1<<(a&0x1F)))
split_v_renderfaces(obr, startvlak, startvert, dl->parts, dl->nr, a, dl->flag&DL_CYCL_V, dl->flag&DL_CYCL_U);
}
/* vertex normals */
- for(a= startvlak; a<obr->totvlak; a++) {
+ for (a= startvlak; a<obr->totvlak; a++) {
vlr= RE_findOrAddVlak(obr, a);
add_v3_v3(vlr->v1->n, vlr->n);
@@ -3045,7 +3052,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
add_v3_v3(vlr->v2->n, vlr->n);
add_v3_v3(vlr->v4->n, vlr->n);
}
- for(a=startvert; a<obr->totvert; a++) {
+ for (a=startvert; a<obr->totvert; a++) {
ver= RE_findOrAddVert(obr, a);
normalize_v3(ver->n);
}
@@ -3093,10 +3100,10 @@ static int vergedgesort(const void *v1, const void *v2)
{
const struct edgesort *x1=v1, *x2=v2;
- if( x1->v1 > x2->v1) return 1;
- else if( x1->v1 < x2->v1) return -1;
- else if( x1->v2 > x2->v2) return 1;
- else if( x1->v2 < x2->v2) return -1;
+ if ( x1->v1 > x2->v1) return 1;
+ else if ( x1->v1 < x2->v1) return -1;
+ else if ( x1->v2 > x2->v2) return 1;
+ else if ( x1->v2 < x2->v2) return -1;
return 0;
}
@@ -3114,27 +3121,27 @@ static struct edgesort *make_mesh_edge_lookup(DerivedMesh *dm, int *totedgesort)
tface= dm->getTessFaceDataArray(dm, CD_MTFACE);
mcol= dm->getTessFaceDataArray(dm, CD_MCOL);
- if(mcol==NULL && tface==NULL) return NULL;
+ if (mcol==NULL && tface==NULL) return NULL;
/* make sorted table with edges and face indices in it */
- for(a= totface, mf= mface; a>0; a--, mf++) {
- if(mf->v4) totedge+=4;
- else if(mf->v3) totedge+=3;
+ for (a= totface, mf= mface; a>0; a--, mf++) {
+ if (mf->v4) totedge+=4;
+ else if (mf->v3) totedge+=3;
}
- if(totedge==0)
+ if (totedge==0)
return NULL;
ed= edsort= MEM_callocN(totedge*sizeof(struct edgesort), "edgesort");
- for(a=0, mf=mface; a<totface; a++, mf++) {
+ for (a=0, mf=mface; a<totface; a++, mf++) {
to_edgesort(ed++, 0, 1, mf->v1, mf->v2, a);
to_edgesort(ed++, 1, 2, mf->v2, mf->v3, a);
- if(mf->v4) {
+ if (mf->v4) {
to_edgesort(ed++, 2, 3, mf->v3, mf->v4, a);
to_edgesort(ed++, 3, 0, mf->v4, mf->v1, a);
}
- else if(mf->v3)
+ else if (mf->v3)
to_edgesort(ed++, 2, 3, mf->v3, mf->v1, a);
}
@@ -3154,7 +3161,7 @@ static void use_mesh_edge_lookup(ObjectRen *obr, DerivedMesh *dm, MEdge *medge,
int index, mtfn, mcn;
char *name;
- if(medge->v1 < medge->v2) {
+ if (medge->v1 < medge->v2) {
ed.v1= medge->v1;
ed.v2= medge->v2;
}
@@ -3166,14 +3173,14 @@ static void use_mesh_edge_lookup(ObjectRen *obr, DerivedMesh *dm, MEdge *medge,
edp= bsearch(&ed, edgetable, totedge, sizeof(struct edgesort), vergedgesort);
/* since edges have different index ordering, we have to duplicate mcol and tface */
- if(edp) {
+ if (edp) {
mtfn= mcn= 0;
- for(index=0; index<dm->faceData.totlayer; index++) {
+ for (index=0; index<dm->faceData.totlayer; index++) {
layer= &dm->faceData.layers[index];
name= layer->name;
- if(layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
+ if (layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
mtface= &((MTFace*)layer->data)[edp->f];
mtf= RE_vlakren_get_tface(obr, vlr, mtfn++, &name, 1);
@@ -3184,7 +3191,7 @@ static void use_mesh_edge_lookup(ObjectRen *obr, DerivedMesh *dm, MEdge *medge,
memcpy(mtf->uv[2], mtface->uv[1], sizeof(float)*2);
memcpy(mtf->uv[3], mtface->uv[1], sizeof(float)*2);
}
- else if(layer->type == CD_MCOL && mcn < MAX_MCOL) {
+ else if (layer->type == CD_MCOL && mcn < MAX_MCOL) {
mcol= &((MCol*)layer->data)[edp->f*4];
mc= RE_vlakren_get_mcol(obr, vlr, mcn++, &name, 1);
@@ -3206,8 +3213,8 @@ static void init_camera_inside_volumes(Render *re)
VolumeOb *vo;
float co[3] = {0.f, 0.f, 0.f};
- for(vo= re->volumes.first; vo; vo= vo->next) {
- for(obi= re->instancetable.first; obi; obi= obi->next) {
+ for (vo= re->volumes.first; vo; vo= vo->next) {
+ for (obi= re->instancetable.first; obi; obi= obi->next) {
if (obi->obr == vo->obr) {
if (point_inside_volume_objectinstance(re, obi, co)) {
MatInside *mi;
@@ -3288,25 +3295,25 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
copy_m3_m4(imat, ob->imat);
negative_scale= is_negative_m4(mat);
- if(me->totvert==0)
+ if (me->totvert==0)
return;
need_orco= 0;
- for(a=1; a<=ob->totcol; a++) {
+ for (a=1; a<=ob->totcol; a++) {
ma= give_render_material(re, ob, a);
- if(ma) {
- if(ma->texco & (TEXCO_ORCO|TEXCO_STRESS))
+ if (ma) {
+ if (ma->texco & (TEXCO_ORCO|TEXCO_STRESS))
need_orco= 1;
- if(ma->texco & TEXCO_STRESS)
+ if (ma->texco & TEXCO_STRESS)
need_stress= 1;
/* normalmaps, test if tangents needed, separated from shading */
- if(ma->mode_l & MA_TANGENT_V) {
+ if (ma->mode_l & MA_TANGENT_V) {
need_tangent= 1;
- if(me->mtface==NULL)
+ if (me->mtface==NULL)
need_orco= 1;
}
- if(ma->mode_l & MA_NORMAP_TANG) {
- if(me->mtface==NULL) {
+ if (ma->mode_l & MA_NORMAP_TANG) {
+ if (me->mtface==NULL) {
need_orco= 1;
need_tangent= 1;
}
@@ -3315,9 +3322,9 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
}
}
- if(re->flag & R_NEED_TANGENT) {
+ if (re->flag & R_NEED_TANGENT) {
/* exception for tangent space baking */
- if(me->mtface==NULL) {
+ if (me->mtface==NULL) {
need_orco= 1;
need_tangent= 1;
}
@@ -3326,22 +3333,22 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
/* check autosmooth and displacement, we then have to skip only-verts optimize */
do_autosmooth |= (me->flag & ME_AUTOSMOOTH);
- if(do_autosmooth)
+ if (do_autosmooth)
timeoffset= 0;
- if(test_for_displace(re, ob ) )
+ if (test_for_displace(re, ob ) )
timeoffset= 0;
mask= CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL;
- if(!timeoffset)
- if(need_orco)
+ if (!timeoffset)
+ if (need_orco)
mask |= CD_MASK_ORCO;
dm= mesh_create_derived_render(re->scene, ob, mask);
- if(dm==NULL) return; /* in case duplicated object fails? */
+ if (dm==NULL) return; /* in case duplicated object fails? */
- if(mask & CD_MASK_ORCO) {
+ if (mask & CD_MASK_ORCO) {
orco= dm->getVertDataArray(dm, CD_ORCO);
- if(orco) {
+ if (orco) {
orco= MEM_dupallocN(orco);
set_object_orco(re, ob, orco);
}
@@ -3351,7 +3358,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
totvert= dm->getNumVerts(dm);
/* attempt to autsmooth on original mesh, only without subsurf */
- if(do_autosmooth && me->totvert==totvert && me->totface==dm->getNumTessFaces(dm))
+ if (do_autosmooth && me->totvert==totvert && me->totface==dm->getNumTessFaces(dm))
use_original_normals= 1;
ms = (totvert==me->totvert)?me->msticky:NULL;
@@ -3359,15 +3366,15 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
ma= give_render_material(re, ob, 1);
- if(ma->material_type == MA_TYPE_HALO) {
+ if (ma->material_type == MA_TYPE_HALO) {
make_render_halos(re, obr, me, totvert, mvert, ma, orco);
}
else {
- for(a=0; a<totvert; a++, mvert++) {
+ for (a=0; a<totvert; a++, mvert++) {
ver= RE_findOrAddVert(obr, obr->totvert++);
copy_v3_v3(ver->co, mvert->co);
- if(do_autosmooth==0) { /* autosmooth on original unrotated data to prevent differences between frames */
+ if (do_autosmooth==0) { /* autosmooth on original unrotated data to prevent differences between frames */
normal_short_to_float_v3(ver->n, mvert->no);
mul_m4_v3(mat, ver->co);
mul_transposed_m3_v3(imat, ver->n);
@@ -3375,19 +3382,18 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
negate_v3(ver->n);
}
- if(orco) {
+ if (orco) {
ver->orco= orco;
orco+=3;
}
- if(ms) {
+ if (ms) {
float *sticky= RE_vertren_get_sticky(obr, ver, 1);
- sticky[0]= ms->co[0];
- sticky[1]= ms->co[1];
+ copy_v2_v2(sticky, ms->co);
ms++;
}
}
- if(!timeoffset) {
+ if (!timeoffset) {
EdgeHash *edge_hash;
MEdge *medge;
int totedge;
@@ -3401,43 +3407,43 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
RE_set_customdata_names(obr, &dm->faceData);
/* add tangent layer if we need one */
- if(need_nmap_tangent!=0 && CustomData_get_layer_index(&dm->faceData, CD_TANGENT) == -1)
+ if (need_nmap_tangent!=0 && CustomData_get_layer_index(&dm->faceData, CD_TANGENT) == -1)
DM_add_tangent_layer(dm);
/* still to do for keys: the correct local texture coordinate */
/* faces in order of color blocks */
vertofs= obr->totvert - totvert;
- for(a1=0; (a1<ob->totcol || (a1==0 && ob->totcol==0)); a1++) {
+ for (a1=0; (a1<ob->totcol || (a1==0 && ob->totcol==0)); a1++) {
ma= give_render_material(re, ob, a1+1);
/* test for 100% transparant */
ok= 1;
- if(ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f && (ma->mode & MA_TRANSP) && (ma->mode & MA_RAYMIRROR)==0) {
+ if (ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f && (ma->mode & MA_TRANSP) && (ma->mode & MA_RAYMIRROR)==0) {
ok= 0;
/* texture on transparency? */
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a] && ma->mtex[a]->tex) {
- if(ma->mtex[a]->mapto & MAP_ALPHA) ok= 1;
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a] && ma->mtex[a]->tex) {
+ if (ma->mtex[a]->mapto & MAP_ALPHA) ok= 1;
}
}
}
/* if wire material, and we got edges, don't do the faces */
- if(ma->material_type == MA_TYPE_WIRE) {
+ if (ma->material_type == MA_TYPE_WIRE) {
end= dm->getNumEdges(dm);
- if(end) ok= 0;
+ if (end) ok= 0;
}
- if(ok) {
+ if (ok) {
end= dm->getNumTessFaces(dm);
mface= dm->getTessFaceArray(dm);
- for(a=0; a<end; a++, mface++) {
+ for (a=0; a<end; a++, mface++) {
int v1, v2, v3, v4, flag;
- if( mface->mat_nr==a1 ) {
+ if ( mface->mat_nr==a1 ) {
float len;
int edge_mark= 0;
@@ -3453,7 +3459,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
vlr->v1= RE_findOrAddVert(obr, vertofs+v1);
vlr->v2= RE_findOrAddVert(obr, vertofs+v2);
vlr->v3= RE_findOrAddVert(obr, vertofs+v3);
- if(v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
+ if (v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
else vlr->v4= 0;
/* Freestyle edge marks */
@@ -3468,17 +3474,17 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
vlr->freestyle_edge_mark= edge_mark;
/* render normals are inverted in render */
- if(use_original_normals) {
+ if (use_original_normals) {
MFace *mf= me->mface+a;
MVert *mv= me->mvert;
- if(vlr->v4)
+ if (vlr->v4)
len= normal_quad_v3( vlr->n, mv[mf->v4].co, mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
else
len= normal_tri_v3( vlr->n,mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
}
else {
- if(vlr->v4)
+ if (vlr->v4)
len= normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
else
len= normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
@@ -3488,7 +3494,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
vlr->flag= flag;
vlr->ec= 0; /* mesh edges rendered separately */
- if(len==0) obr->totvlak--;
+ if (len==0) obr->totvlak--;
else {
CustomDataLayer *layer;
MTFace *mtface, *mtf;
@@ -3497,30 +3503,30 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
char *name;
int nr_verts = v4!=0 ? 4 : 3;
- for(index=0; index<dm->faceData.totlayer; index++) {
+ for (index=0; index<dm->faceData.totlayer; index++) {
layer= &dm->faceData.layers[index];
name= layer->name;
- if(layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
+ if (layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
int t;
mtf= RE_vlakren_get_tface(obr, vlr, mtfn++, &name, 1);
mtface= (MTFace*)layer->data;
*mtf= mtface[a]; // copy face info
- for(vindex=0; vindex<nr_verts; vindex++)
- for(t=0; t<2; t++)
+ for (vindex=0; vindex<nr_verts; vindex++)
+ for (t=0; t<2; t++)
mtf->uv[vindex][t]=mtface[a].uv[rev_tab[vindex]][t];
}
- else if(layer->type == CD_MCOL && mcn < MAX_MCOL) {
+ else if (layer->type == CD_MCOL && mcn < MAX_MCOL) {
mc= RE_vlakren_get_mcol(obr, vlr, mcn++, &name, 1);
mcol= (MCol*)layer->data;
- for(vindex=0; vindex<nr_verts; vindex++)
+ for (vindex=0; vindex<nr_verts; vindex++)
mc[vindex]=mcol[a*4+rev_tab[vindex]];
}
else if (layer->type == CD_TANGENT && mtng < 1) {
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);
@@ -3542,7 +3548,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
end= dm->getNumEdges(dm);
mvert= dm->getVertArray(dm);
ma= give_render_material(re, ob, 1);
- if(end && (ma->material_type == MA_TYPE_WIRE)) {
+ if (end && (ma->material_type == MA_TYPE_WIRE)) {
MEdge *medge;
struct edgesort *edgetable;
int totedge= 0;
@@ -3553,7 +3559,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
/* we want edges to have UV and vcol too... */
edgetable= make_mesh_edge_lookup(dm, &totedge);
- for(a1=0; a1<end; a1++, medge++) {
+ for (a1=0; a1<end; a1++, medge++) {
if (medge->flag&ME_EDGERENDER) {
MVert *v0 = &mvert[medge->v1];
MVert *v1 = &mvert[medge->v2];
@@ -3564,7 +3570,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
vlr->v3= vlr->v2;
vlr->v4= NULL;
- if(edgetable)
+ if (edgetable)
use_mesh_edge_lookup(obr, dm, medge, vlr, edgetable, totedge);
xn= -(v0->no[0]+v1->no[0]);
@@ -3581,31 +3587,31 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
vlr->ec= ME_V1V2;
}
}
- if(edgetable)
+ if (edgetable)
MEM_freeN(edgetable);
}
}
}
- if(!timeoffset) {
- if(need_stress)
+ if (!timeoffset) {
+ if (need_stress)
calc_edge_stress(re, obr, me);
if (test_for_displace(re, ob ) ) {
recalc_normals= 1;
calc_vertexnormals(re, obr, 0, 0);
- if(do_autosmooth)
+ if (do_autosmooth)
do_displacement(re, obr, mat, imat);
else
do_displacement(re, obr, NULL, NULL);
}
- if(do_autosmooth) {
+ if (do_autosmooth) {
recalc_normals= 1;
autosmooth(re, obr, mat, me->smoothresh);
}
- if(recalc_normals!=0 || need_tangent!=0)
+ if (recalc_normals!=0 || need_tangent!=0)
calc_vertexnormals(re, obr, need_tangent, need_nmap_tangent);
}
@@ -3621,21 +3627,21 @@ static void initshadowbuf(Render *re, LampRen *lar, float mat[][4])
struct ShadBuf *shb;
float viewinv[4][4];
- /* if(la->spsi<16) return; */
+ /* if (la->spsi<16) return; */
/* memory alloc */
shb= (struct ShadBuf *)MEM_callocN( sizeof(struct ShadBuf),"initshadbuf");
lar->shb= shb;
- if(shb==NULL) return;
+ if (shb==NULL) return;
VECCOPY(shb->co, lar->co); /* int copy */
/* percentage render: keep track of min and max */
shb->size= (lar->bufsize*re->r.size)/100;
- if(shb->size<512) shb->size= 512;
- else if(shb->size > lar->bufsize) shb->size= lar->bufsize;
+ if (shb->size<512) shb->size= 512;
+ else if (shb->size > lar->bufsize) shb->size= lar->bufsize;
shb->size &= ~15; /* make sure its multiples of 16 */
@@ -3660,7 +3666,7 @@ static void initshadowbuf(Render *re, LampRen *lar, float mat[][4])
shb->bias= (0.02f*lar->bias)*0x7FFFFFFF;
/* halfway method (average of first and 2nd z) reduces bias issues */
- if(ELEM(lar->buftype, LA_SHADBUF_HALFWAY, LA_SHADBUF_DEEP))
+ if (ELEM(lar->buftype, LA_SHADBUF_HALFWAY, LA_SHADBUF_DEEP))
shb->bias= 0.1f*shb->bias;
shb->compressthresh= lar->compressthresh;
@@ -3709,11 +3715,11 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
int c;
/* previewrender sets this to zero... prevent accidents */
- if(la==NULL) return NULL;
+ if (la==NULL) return NULL;
/* prevent only shadow from rendering light */
- if(la->mode & LA_ONLYSHADOW)
- if((re->r.mode & R_SHADOW)==0)
+ if (la->mode & LA_ONLYSHADOW)
+ if ((re->r.mode & R_SHADOW)==0)
return NULL;
re->totlamp++;
@@ -3736,7 +3742,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
lar->bufsize = la->bufsize;
lar->samp = la->samp;
lar->buffers= la->buffers;
- if(lar->buffers==0) lar->buffers= 1;
+ if (lar->buffers==0) lar->buffers= 1;
lar->buftype= la->buftype;
lar->filtertype= la->filtertype;
lar->soft = la->soft;
@@ -3751,7 +3757,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
lar->mode= la->mode;
lar->energy= la->energy;
- if(la->mode & LA_NEG) lar->energy= -lar->energy;
+ if (la->mode & LA_NEG) lar->energy= -lar->energy;
lar->vec[0]= -mat[2][0];
lar->vec[1]= -mat[2][1];
@@ -3784,7 +3790,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
/* Annoying, lamp UI does this, but the UI might not have been used? - add here too.
* make sure this matches buttons_shading.c's logic */
- if(ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL) && (la->mode & LA_SHAD_RAY))
+ if (ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL) && (la->mode & LA_SHAD_RAY))
if (ELEM3(la->type, LA_SPOT, LA_SUN, LA_LOCAL))
if (la->ray_samp_method == LA_SAMP_CONSTANT) la->ray_samp_method = LA_SAMP_HALTON;
@@ -3794,12 +3800,12 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
lar->adapt_thresh= la->adapt_thresh;
lar->sunsky = NULL;
- if( ELEM(lar->type, LA_SPOT, LA_LOCAL)) {
+ if ( ELEM(lar->type, LA_SPOT, LA_LOCAL)) {
lar->ray_totsamp= lar->ray_samp*lar->ray_samp;
lar->area_shape = LA_AREA_SQUARE;
lar->area_sizey= lar->area_size;
}
- else if(lar->type==LA_AREA) {
+ else if (lar->type==LA_AREA) {
switch(lar->area_shape) {
case LA_AREA_SQUARE:
lar->ray_totsamp= lar->ray_samp*lar->ray_samp;
@@ -3824,13 +3830,13 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
area_lamp_vectors(lar);
init_jitter_plane(lar); // subsamples
}
- else if(lar->type==LA_SUN){
+ else if (lar->type==LA_SUN) {
lar->ray_totsamp= lar->ray_samp*lar->ray_samp;
lar->area_shape = LA_AREA_SQUARE;
lar->area_sizey= lar->area_size;
- if((la->sun_effect_type & LA_SUN_EFFECT_SKY) ||
- (la->sun_effect_type & LA_SUN_EFFECT_AP)){
+ if ((la->sun_effect_type & LA_SUN_EFFECT_SKY) ||
+ (la->sun_effect_type & LA_SUN_EFFECT_AP)) {
lar->sunsky = (struct SunSky*)MEM_callocN(sizeof(struct SunSky), "sunskyren");
lar->sunsky->effect_type = la->sun_effect_type;
@@ -3848,8 +3854,8 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
else lar->ray_totsamp= 0;
lar->spotsi= la->spotsize;
- if(lar->mode & LA_HALO) {
- if(lar->spotsi>170.0f) lar->spotsi= 170.0f;
+ if (lar->mode & LA_HALO) {
+ if (lar->spotsi>170.0f) lar->spotsi= 170.0f;
}
lar->spotsi= cosf( (float)M_PI*lar->spotsi/360.0f );
lar->spotbl= (1.0f-lar->spotsi)*la->spotblend;
@@ -3863,7 +3869,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
lar->ld2= la->att2;
lar->curfalloff = curvemapping_copy(la->curfalloff);
- if(lar->type==LA_SPOT) {
+ if (lar->type==LA_SPOT) {
normalize_v3(lar->imat[0]);
normalize_v3(lar->imat[1]);
@@ -3873,15 +3879,15 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
xn= sin(xn)/cos(xn);
lar->spottexfac= 1.0f/(xn);
- if(lar->mode & LA_ONLYSHADOW) {
- if((lar->mode & (LA_SHAD_BUF|LA_SHAD_RAY))==0) lar->mode -= LA_ONLYSHADOW;
+ if (lar->mode & LA_ONLYSHADOW) {
+ if ((lar->mode & (LA_SHAD_BUF|LA_SHAD_RAY))==0) lar->mode -= LA_ONLYSHADOW;
}
}
/* set flag for spothalo en initvars */
- if(la->type==LA_SPOT && (la->mode & LA_HALO) && (la->buftype != LA_SHADBUF_DEEP)) {
- if(la->haint>0.0f) {
+ if (la->type==LA_SPOT && (la->mode & LA_HALO) && (la->buftype != LA_SHADBUF_DEEP)) {
+ if (la->haint>0.0f) {
re->flag |= R_LAMPHALO;
/* camera position (0,0,0) rotate around lamp */
@@ -3899,25 +3905,25 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
lar->sh_invcampos[2]*= lar->sh_zfac;
/* halfway shadow buffer doesn't work for volumetric effects */
- if(lar->buftype == LA_SHADBUF_HALFWAY)
+ if (lar->buftype == LA_SHADBUF_HALFWAY)
lar->buftype = LA_SHADBUF_REGULAR;
}
}
- else if(la->type==LA_HEMI) {
+ else if (la->type==LA_HEMI) {
lar->mode &= ~(LA_SHAD_RAY|LA_SHAD_BUF);
}
- for(c=0; c<MAX_MTEX; c++) {
- if(la->mtex[c] && la->mtex[c]->tex) {
+ for (c=0; c<MAX_MTEX; c++) {
+ if (la->mtex[c] && la->mtex[c]->tex) {
if (la->mtex[c]->mapto & LAMAP_COL)
lar->mode |= LA_TEXTURE;
if (la->mtex[c]->mapto & LAMAP_SHAD)
lar->mode |= LA_SHAD_TEX;
- if(G.rendering) {
- if(re->osa) {
- if(la->mtex[c]->tex->type==TEX_IMAGE) lar->mode |= LA_OSATEX;
+ if (G.rendering) {
+ if (re->osa) {
+ if (la->mtex[c]->tex->type==TEX_IMAGE) lar->mode |= LA_OSATEX;
}
}
}
@@ -3926,15 +3932,15 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
/* old code checked for internal render (aka not yafray) */
{
/* to make sure we can check ray shadow easily in the render code */
- if(lar->mode & LA_SHAD_RAY) {
- if( (re->r.mode & R_RAYTRACE)==0)
+ if (lar->mode & LA_SHAD_RAY) {
+ if ( (re->r.mode & R_RAYTRACE)==0)
lar->mode &= ~LA_SHAD_RAY;
}
- if(re->r.mode & R_SHADOW) {
+ if (re->r.mode & R_SHADOW) {
- if(la->type==LA_AREA && (lar->mode & LA_SHAD_RAY) && (lar->ray_samp_method == LA_SAMP_CONSTANT)) {
+ if (la->type==LA_AREA && (lar->mode & LA_SHAD_RAY) && (lar->ray_samp_method == LA_SAMP_CONSTANT)) {
init_jitter_plane(lar);
}
else if (la->type==LA_SPOT && (lar->mode & LA_SHAD_BUF) ) {
@@ -3946,7 +3952,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
/* this is the way used all over to check for shadow */
- if(lar->shb || (lar->mode & LA_SHAD_RAY)) {
+ if (lar->shb || (lar->mode & LA_SHAD_RAY)) {
LampShadowSample *ls;
LampShadowSubSample *lss;
int a, b;
@@ -3957,9 +3963,9 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
ls= lar->shadsamp;
/* shadfacs actually mean light, let's put them to 1 to prevent unitialized accidents */
- for(a=0; a<re->r.threads; a++, ls++) {
+ for (a=0; a<re->r.threads; a++, ls++) {
lss= ls->s;
- for(b=0; b<re->r.osa; b++, lss++) {
+ for (b=0; b<re->r.osa; b++, lss++) {
lss->samplenr= -1; /* used to detect whether we store or read */
lss->shadfac[0]= 1.0f;
lss->shadfac[1]= 1.0f;
@@ -3983,20 +3989,20 @@ static void add_lightgroup(Render *re, Group *group, int exclusive)
/* it's a bit too many loops in loops... but will survive */
/* note that 'exclusive' will remove it from the global list */
- for(go= group->gobject.first; go; go= go->next) {
+ for (go= group->gobject.first; go; go= go->next) {
go->lampren= NULL;
- if(go->ob->lay & re->lay) {
- if(go->ob && go->ob->type==OB_LAMP) {
- for(gol= re->lights.first; gol; gol= gol->next) {
- if(gol->ob==go->ob) {
+ if (go->ob->lay & re->lay) {
+ if (go->ob && go->ob->type==OB_LAMP) {
+ for (gol= re->lights.first; gol; gol= gol->next) {
+ if (gol->ob==go->ob) {
go->lampren= gol->lampren;
break;
}
}
- if(go->lampren==NULL)
+ if (go->lampren==NULL)
gol= add_render_lamp(re, go->ob);
- if(gol && exclusive) {
+ if (gol && exclusive) {
BLI_remlink(&re->lights, gol);
MEM_freeN(gol);
}
@@ -4011,16 +4017,16 @@ static void set_material_lightgroups(Render *re)
Material *ma;
/* not for preview render */
- if(re->scene->r.scemode & R_PREVIEWBUTS)
+ if (re->scene->r.scemode & R_PREVIEWBUTS)
return;
- for(group= re->main->group.first; group; group=group->id.next)
+ for (group= re->main->group.first; group; group=group->id.next)
group->id.flag |= LIB_DOIT;
/* it's a bit too many loops in loops... but will survive */
/* hola! materials not in use...? */
- for(ma= re->main->mat.first; ma; ma=ma->id.next) {
- if(ma->group && (ma->group->id.flag & LIB_DOIT))
+ for (ma= re->main->mat.first; ma; ma=ma->id.next) {
+ if (ma->group && (ma->group->id.flag & LIB_DOIT))
add_lightgroup(re, ma->group, ma->mode & MA_GROUP_NOLAY);
}
}
@@ -4029,8 +4035,8 @@ static void set_renderlayer_lightgroups(Render *re, Scene *sce)
{
SceneRenderLayer *srl;
- for(srl= sce->r.layers.first; srl; srl= srl->next) {
- if(srl->light_override)
+ for (srl= sce->r.layers.first; srl; srl= srl->next) {
+ if (srl->light_override)
add_lightgroup(re, srl->light_override, 0);
}
}
@@ -4044,7 +4050,7 @@ void init_render_world(Render *re)
int a;
char *cp;
- if(re->scene && re->scene->world) {
+ if (re->scene && re->scene->world) {
re->wrld= *(re->scene->world);
cp= (char *)&re->wrld.fastcol;
@@ -4058,14 +4064,14 @@ void init_render_world(Render *re)
normalize_v3(re->grvec);
copy_m3_m4(re->imat, re->viewinv);
- for(a=0; a<MAX_MTEX; a++)
- if(re->wrld.mtex[a] && re->wrld.mtex[a]->tex) re->wrld.skytype |= WO_SKYTEX;
+ for (a=0; a<MAX_MTEX; a++)
+ if (re->wrld.mtex[a] && re->wrld.mtex[a]->tex) re->wrld.skytype |= WO_SKYTEX;
/* AO samples should be OSA minimum */
- if(re->osa)
- while(re->wrld.aosamp*re->wrld.aosamp < re->osa)
+ if (re->osa)
+ while (re->wrld.aosamp*re->wrld.aosamp < re->osa)
re->wrld.aosamp++;
- if(!(re->r.mode & R_RAYTRACE) && (re->wrld.ao_gather_method == WO_AOGATHER_RAYTRACE))
+ if (!(re->r.mode & R_RAYTRACE) && (re->wrld.ao_gather_method == WO_AOGATHER_RAYTRACE))
re->wrld.mode &= ~(WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT);
}
else {
@@ -4101,37 +4107,37 @@ static void set_phong_threshold(ObjectRen *obr)
* are taken into account. This threshold is meant to work on smooth geometry, not
/ for extreme cases (ton) */
- for(i=0; i<obr->totvlak; i++) {
+ for (i=0; i<obr->totvlak; i++) {
vlr= RE_findOrAddVlak(obr, i);
- if(vlr->flag & R_SMOOTH) {
+ if (vlr->flag & R_SMOOTH) {
dot= dot_v3v3(vlr->n, vlr->v1->n);
dot= ABS(dot);
- if(dot>0.9f) {
+ if (dot>0.9f) {
thresh+= dot; tot++;
}
dot= dot_v3v3(vlr->n, vlr->v2->n);
dot= ABS(dot);
- if(dot>0.9f) {
+ if (dot>0.9f) {
thresh+= dot; tot++;
}
dot= dot_v3v3(vlr->n, vlr->v3->n);
dot= ABS(dot);
- if(dot>0.9f) {
+ if (dot>0.9f) {
thresh+= dot; tot++;
}
- if(vlr->v4) {
+ if (vlr->v4) {
dot= dot_v3v3(vlr->n, vlr->v4->n);
dot= ABS(dot);
- if(dot>0.9f) {
+ if (dot>0.9f) {
thresh+= dot; tot++;
}
}
}
}
- if(tot) {
+ if (tot) {
thresh/= (float)tot;
obr->ob->smoothresh= cosf(0.5f*(float)M_PI-saacos(thresh));
}
@@ -4147,21 +4153,21 @@ static void set_fullsample_trace_flag(Render *re, ObjectRen *obr)
osa= re->osa;
trace= re->r.mode & R_RAYTRACE;
- for(a=obr->totvlak-1; a>=0; a--) {
+ for (a=obr->totvlak-1; a>=0; a--) {
vlr= RE_findOrAddVlak(obr, a);
mode= vlr->mat->mode;
- if(trace && (mode & MA_TRACEBLE))
+ if (trace && (mode & MA_TRACEBLE))
vlr->flag |= R_TRACEBLE;
- if(osa) {
- if(mode & MA_FULL_OSA) {
+ if (osa) {
+ if (mode & MA_FULL_OSA) {
vlr->flag |= R_FULL_OSA;
}
- else if(trace) {
- if(mode & MA_SHLESS);
- else if(vlr->mat->material_type == MA_TYPE_VOLUME);
- else if((mode & MA_RAYMIRROR) || ((mode & MA_TRANSP) && (mode & MA_RAYTRANSP))) {
+ else if (trace) {
+ if (mode & MA_SHLESS);
+ else if (vlr->mat->material_type == MA_TYPE_VOLUME);
+ else if ((mode & MA_RAYMIRROR) || ((mode & MA_TRANSP) && (mode & MA_RAYTRANSP))) {
/* for blurry reflect/refract, better to take more samples
* inside the raytrace than as OSA samples */
if ((vlr->mat->gloss_mir == 1.0f) && (vlr->mat->gloss_tra == 1.0f))
@@ -4180,18 +4186,18 @@ static void split_quads(ObjectRen *obr, int dir)
VlakRen *vlr, *vlr1;
int a;
- for(a=obr->totvlak-1; a>=0; a--) {
+ for (a=obr->totvlak-1; a>=0; a--) {
vlr= RE_findOrAddVlak(obr, a);
/* test if rendering as a quad or triangle, skip wire */
- if(vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->material_type != MA_TYPE_WIRE)) {
+ if (vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->material_type != MA_TYPE_WIRE)) {
- if(vlr->v4) {
+ if (vlr->v4) {
vlr1= RE_vlakren_copy(obr, vlr);
vlr1->flag |= R_FACE_SPLIT;
- if( dir==2 ) vlr->flag |= R_DIVIDE_24;
+ if ( dir==2 ) vlr->flag |= R_DIVIDE_24;
else vlr->flag &= ~R_DIVIDE_24;
/* new vertex pointers */
@@ -4230,11 +4236,11 @@ static void check_non_flat_quads(ObjectRen *obr)
float nor[3], xn, flen;
int a;
- for(a=obr->totvlak-1; a>=0; a--) {
+ for (a=obr->totvlak-1; a>=0; a--) {
vlr= RE_findOrAddVlak(obr, a);
/* test if rendering as a quad or triangle, skip wire */
- if(vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->material_type != MA_TYPE_WIRE)) {
+ if (vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->material_type != MA_TYPE_WIRE)) {
/* check if quad is actually triangle */
v1= vlr->v1;
@@ -4242,7 +4248,7 @@ static void check_non_flat_quads(ObjectRen *obr)
v3= vlr->v3;
v4= vlr->v4;
sub_v3_v3v3(nor, v1->co, v2->co);
- if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
+ if ( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
vlr->v1= v2;
vlr->v2= v3;
vlr->v3= v4;
@@ -4250,26 +4256,26 @@ static void check_non_flat_quads(ObjectRen *obr)
}
else {
sub_v3_v3v3(nor, v2->co, v3->co);
- if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
+ if ( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
vlr->v2= v3;
vlr->v3= v4;
vlr->v4= NULL;
}
else {
sub_v3_v3v3(nor, v3->co, v4->co);
- if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
+ if ( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
vlr->v4= NULL;
}
else {
sub_v3_v3v3(nor, v4->co, v1->co);
- if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
+ if ( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
vlr->v4= NULL;
}
}
}
}
- if(vlr->v4) {
+ if (vlr->v4) {
/* Face is divided along edge with the least gradient */
/* Flagged with R_DIVIDE_24 if divide is from vert 2 to 4 */
@@ -4280,11 +4286,11 @@ static void check_non_flat_quads(ObjectRen *obr)
/* render normals are inverted in render! we calculate normal of single tria here */
flen= normal_tri_v3( nor,vlr->v4->co, vlr->v3->co, vlr->v1->co);
- if(flen==0.0f) normal_tri_v3( nor,vlr->v4->co, vlr->v2->co, vlr->v1->co);
+ if (flen==0.0f) normal_tri_v3( nor,vlr->v4->co, vlr->v2->co, vlr->v1->co);
xn = dot_v3v3(nor, vlr->n);
- if(ABS(xn) < 0.999995f ) { // checked on noisy fractal grid
+ if (ABS(xn) < 0.999995f ) { // checked on noisy fractal grid
float d1, d2;
@@ -4298,7 +4304,7 @@ static void check_non_flat_quads(ObjectRen *obr)
normal_tri_v3( nor,vlr->v2->co, vlr->v3->co, vlr->v4->co);
d2 = dot_v3v3(nor, vlr->v2->n);
- if( fabs(d1) < fabs(d2) ) vlr->flag |= R_DIVIDE_24;
+ if ( fabs(d1) < fabs(d2) ) vlr->flag |= R_DIVIDE_24;
else vlr->flag &= ~R_DIVIDE_24;
/* new vertex pointers */
@@ -4357,25 +4363,26 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset)
float min[3], max[3], smin[3], smax[3];
int a, b;
- if(obr->totvert || obr->totvlak || obr->tothalo || obr->totstrand) {
+ if (obr->totvert || obr->totvlak || obr->tothalo || obr->totstrand) {
/* the exception below is because displace code now is in init_render_mesh call,
I will look at means to have autosmooth enabled for all object types
and have it as general postprocess, like displace */
- if(ob->type!=OB_MESH && test_for_displace(re, ob))
+ if (ob->type!=OB_MESH && test_for_displace(re, ob))
do_displacement(re, obr, NULL, NULL);
- if(!timeoffset) {
+ if (!timeoffset) {
/* phong normal interpolation can cause error in tracing
* (terminator problem) */
ob->smoothresh= 0.0;
- if((re->r.mode & R_RAYTRACE) && (re->r.mode & R_SHADOW))
+ if ((re->r.mode & R_RAYTRACE) && (re->r.mode & R_SHADOW))
set_phong_threshold(obr);
if (re->flag & R_BAKING && re->r.bake_quad_split != 0) {
/* Baking lets us define a quad split order */
split_quads(obr, re->r.bake_quad_split);
- } else {
- if((re->r.mode & R_SIMPLIFY && re->r.simplify_flag & R_SIMPLE_NO_TRIANGULATE) == 0)
+ }
+ else {
+ if ((re->r.mode & R_SIMPLIFY && re->r.simplify_flag & R_SIMPLE_NO_TRIANGULATE) == 0)
check_non_flat_quads(obr);
}
@@ -4383,29 +4390,29 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset)
/* compute bounding boxes for clipping */
INIT_MINMAX(min, max);
- for(a=0; a<obr->totvert; a++) {
- if((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
+ for (a=0; a<obr->totvert; a++) {
+ if ((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
else ver++;
DO_MINMAX(ver->co, min, max);
}
- if(obr->strandbuf) {
+ if (obr->strandbuf) {
float width;
/* compute average bounding box of strandpoint itself (width) */
- if(obr->strandbuf->flag & R_STRAND_B_UNITS)
+ if (obr->strandbuf->flag & R_STRAND_B_UNITS)
obr->strandbuf->maxwidth= MAX2(obr->strandbuf->ma->strand_sta, obr->strandbuf->ma->strand_end);
else
obr->strandbuf->maxwidth= 0.0f;
width= obr->strandbuf->maxwidth;
sbound= obr->strandbuf->bound;
- for(b=0; b<obr->strandbuf->totbound; b++, sbound++) {
+ for (b=0; b<obr->strandbuf->totbound; b++, sbound++) {
INIT_MINMAX(smin, smax);
- for(a=sbound->start; a<sbound->end; a++) {
+ for (a=sbound->start; a<sbound->end; a++) {
strand= RE_findOrAddStrand(obr, a);
strand_minmax(strand, smin, smax, width);
}
@@ -4445,8 +4452,8 @@ static void find_dupli_instances(Render *re, ObjectRen *obr)
/* for objects instanced by dupliverts/faces/particles, we go over the
* list of instances to find ones that instance obr, and setup their
* matrices and obr pointer */
- for(obi=re->instancetable.last; obi; obi=obi->prev) {
- if(!obi->obr && obi->ob == obr->ob && obi->psysindex == obr->psysindex) {
+ for (obi=re->instancetable.last; obi; obi=obi->prev) {
+ if (!obi->obr && obi->ob == obr->ob && obi->psysindex == obr->psysindex) {
obi->obr= obr;
/* compute difference between object matrix and
@@ -4458,7 +4465,7 @@ static void find_dupli_instances(Render *re, ObjectRen *obr)
invert_m3_m3(obi->nmat, nmat);
transpose_m3(obi->nmat);
- if(!first) {
+ if (!first) {
re->totvert += obr->totvert;
re->totvlak += obr->totvlak;
re->tothalo += obr->tothalo;
@@ -4500,13 +4507,13 @@ static ObjectRen *find_dupligroup_dupli(Render *re, Object *ob, int psysindex)
/* if the object is itself instanced, we don't want to create an instance
* for it */
- if(ob->transflag & OB_RENDER_DUPLI)
+ if (ob->transflag & OB_RENDER_DUPLI)
return NULL;
/* try to find an object that was already created so we can reuse it
* and save memory */
- for(obr=re->objecttable.first; obr; obr=obr->next)
- if(obr->ob == ob && obr->psysindex == psysindex && (obr->flag & R_INSTANCEABLE))
+ for (obr=re->objecttable.first; obr; obr=obr->next)
+ if (obr->ob == ob && obr->psysindex == psysindex && (obr->flag & R_INSTANCEABLE))
return obr;
return NULL;
@@ -4522,14 +4529,14 @@ static void set_dupli_tex_mat(Render *re, ObjectInstanceRen *obi, DupliObject *d
static int needtexmat= 0;
/* init */
- if(!re) {
+ if (!re) {
lastob= NULL;
needtexmat= 0;
return;
}
/* check if we actually need it */
- if(lastob != dob->ob) {
+ if (lastob != dob->ob) {
Material ***material;
short a, *totmaterial;
@@ -4539,13 +4546,13 @@ static void set_dupli_tex_mat(Render *re, ObjectInstanceRen *obi, DupliObject *d
totmaterial= give_totcolp(dob->ob);
material= give_matarar(dob->ob);
- if(totmaterial && material)
- for(a= 0; a<*totmaterial; a++)
- if((*material)[a] && (*material)[a]->texco & TEXCO_OBJECT)
+ if (totmaterial && material)
+ for (a= 0; a<*totmaterial; a++)
+ if ((*material)[a] && (*material)[a]->texco & TEXCO_OBJECT)
needtexmat= 1;
}
- if(needtexmat) {
+ if (needtexmat) {
float imat[4][4];
obi->duplitexmat= BLI_memarena_alloc(re->memArena, sizeof(float)*4*4);
@@ -4560,8 +4567,8 @@ static void init_render_object_data(Render *re, ObjectRen *obr, int timeoffset)
ParticleSystem *psys;
int i;
- if(obr->psysindex) {
- if((!obr->prev || obr->prev->ob != ob || (obr->prev->flag & R_INSTANCEABLE)==0) && ob->type==OB_MESH) {
+ if (obr->psysindex) {
+ if ((!obr->prev || obr->prev->ob != ob || (obr->prev->flag & R_INSTANCEABLE)==0) && ob->type==OB_MESH) {
/* the emitter mesh wasn't rendered so the modifier stack wasn't
* evaluated with render settings */
DerivedMesh *dm;
@@ -4569,7 +4576,7 @@ static void init_render_object_data(Render *re, ObjectRen *obr, int timeoffset)
dm->release(dm);
}
- for(psys=ob->particlesystem.first, i=0; i<obr->psysindex-1; i++)
+ for (psys=ob->particlesystem.first, i=0; i<obr->psysindex-1; i++)
psys= psys->next;
render_new_particle_system(re, obr, psys, timeoffset);
@@ -4577,11 +4584,11 @@ static void init_render_object_data(Render *re, ObjectRen *obr, int timeoffset)
else {
if ELEM(ob->type, OB_FONT, OB_CURVE)
init_render_curve(re, obr, timeoffset);
- else if(ob->type==OB_SURF)
+ else if (ob->type==OB_SURF)
init_render_surf(re, obr, timeoffset);
- else if(ob->type==OB_MESH)
+ else if (ob->type==OB_MESH)
init_render_mesh(re, obr, timeoffset);
- else if(ob->type==OB_MBALL)
+ else if (ob->type==OB_MBALL)
init_render_mball(re, obr);
}
@@ -4604,31 +4611,31 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject *
/* the emitter has to be processed first (render levels of modifiers) */
/* so here we only check if the emitter should be rendered */
- if(ob->particlesystem.first) {
+ if (ob->particlesystem.first) {
show_emitter= 0;
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
show_emitter += psys->part->draw & PART_DRAW_EMITTER;
psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy, timeoffset);
}
/* if no psys has "show emitter" selected don't render emitter */
- if(show_emitter == 0)
+ if (show_emitter == 0)
allow_render= 0;
}
/* one render object for the data itself */
- if(allow_render) {
+ if (allow_render) {
obr= RE_addRenderObject(re, ob, par, index, 0, ob->lay);
- if((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) {
+ if ((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) {
obr->flag |= R_INSTANCEABLE;
copy_m4_m4(obr->obmat, ob->obmat);
}
init_render_object_data(re, obr, timeoffset);
/* only add instance for objects that have not been used for dupli */
- if(!(ob->transflag & OB_RENDER_DUPLI)) {
+ if (!(ob->transflag & OB_RENDER_DUPLI)) {
obi= RE_addRenderInstance(re, obr, ob, par, index, 0, NULL, ob->lay);
- if(dob) set_dupli_tex_mat(re, obi, dob);
+ if (dob) set_dupli_tex_mat(re, obi, dob);
}
else
find_dupli_instances(re, obr);
@@ -4641,24 +4648,24 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject *
}
/* and one render object per particle system */
- if(ob->particlesystem.first) {
+ if (ob->particlesystem.first) {
psysindex= 1;
- for(psys=ob->particlesystem.first; psys; psys=psys->next, psysindex++) {
+ for (psys=ob->particlesystem.first; psys; psys=psys->next, psysindex++) {
obr= RE_addRenderObject(re, ob, par, index, psysindex, ob->lay);
- if((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) {
+ if ((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) {
obr->flag |= R_INSTANCEABLE;
copy_m4_m4(obr->obmat, ob->obmat);
}
- if(dob)
+ if (dob)
psys->flag |= PSYS_USE_IMAT;
init_render_object_data(re, obr, timeoffset);
psys_render_restore(ob, psys);
psys->flag &= ~PSYS_USE_IMAT;
/* only add instance for objects that have not been used for dupli */
- if(!(ob->transflag & OB_RENDER_DUPLI)) {
+ if (!(ob->transflag & OB_RENDER_DUPLI)) {
obi= RE_addRenderInstance(re, obr, ob, par, index, psysindex, NULL, ob->lay);
- if(dob) set_dupli_tex_mat(re, obi, dob);
+ if (dob) set_dupli_tex_mat(re, obi, dob);
}
else
find_dupli_instances(re, obr);
@@ -4674,9 +4681,9 @@ static void init_render_object(Render *re, Object *ob, Object *par, DupliObject
double time;
float mat[4][4];
- if(ob->type==OB_LAMP)
+ if (ob->type==OB_LAMP)
add_render_lamp(re, ob);
- else if(render_object_type(ob->type))
+ else if (render_object_type(ob->type))
add_render_object(re, ob, par, dob, timeoffset);
else {
mult_m4_m4m4(mat, re->viewmat, ob->obmat);
@@ -4684,7 +4691,7 @@ static void init_render_object(Render *re, Object *ob, Object *par, DupliObject
}
time= PIL_check_seconds_timer();
- if(time - lasttime > 1.0) {
+ if (time - lasttime > 1.0) {
lasttime= time;
/* clumsy copying still */
re->i.totvert= re->totvert;
@@ -4703,8 +4710,8 @@ void RE_Database_Free(Render *re)
LampRen *lar;
/* statistics for debugging render memory usage */
- if((G.f & G_DEBUG) && (G.rendering)) {
- if((re->r.scemode & R_PREVIEWBUTS)==0) {
+ if ((G.f & G_DEBUG) && (G.rendering)) {
+ if ((re->r.scemode & R_PREVIEWBUTS)==0) {
BKE_image_print_memlist();
MEM_printmemlist_stats();
}
@@ -4712,11 +4719,11 @@ void RE_Database_Free(Render *re)
/* FREE */
- for(lar= re->lampren.first; lar; lar= lar->next) {
+ for (lar= re->lampren.first; lar; lar= lar->next) {
freeshadowbuf(lar);
- if(lar->jitter) MEM_freeN(lar->jitter);
- if(lar->shadsamp) MEM_freeN(lar->shadsamp);
- if(lar->sunsky) MEM_freeN(lar->sunsky);
+ if (lar->jitter) MEM_freeN(lar->jitter);
+ if (lar->shadsamp) MEM_freeN(lar->shadsamp);
+ if (lar->sunsky) MEM_freeN(lar->sunsky);
curvemapping_free(lar->curfalloff);
}
@@ -4739,20 +4746,20 @@ void RE_Database_Free(Render *re)
free_camera_inside_volumes(re);
- if(re->wrld.aosphere) {
+ if (re->wrld.aosphere) {
MEM_freeN(re->wrld.aosphere);
re->wrld.aosphere= NULL;
re->scene->world->aosphere= NULL;
}
- if(re->wrld.aotables) {
+ if (re->wrld.aotables) {
MEM_freeN(re->wrld.aotables);
re->wrld.aotables= NULL;
re->scene->world->aotables= NULL;
}
- if(re->r.mode & R_RAYTRACE)
+ if (re->r.mode & R_RAYTRACE)
free_render_qmcsampler(re);
- if(re->r.mode & R_RAYTRACE) freeraytree(re);
+ if (re->r.mode & R_RAYTRACE) freeraytree(re);
free_sss(re);
free_occ(re);
@@ -4763,12 +4770,12 @@ void RE_Database_Free(Render *re)
re->bakebuf= NULL;
- if(re->scene)
- if(re->scene->r.scemode & R_FREE_IMAGE)
- if((re->r.scemode & R_PREVIEWBUTS)==0)
+ if (re->scene)
+ if (re->scene->r.scemode & R_FREE_IMAGE)
+ if ((re->r.scemode & R_PREVIEWBUTS)==0)
BKE_image_free_all_textures();
- if(re->memArena) {
+ if (re->memArena) {
BLI_memarena_free(re->memArena);
re->memArena = NULL;
}
@@ -4777,19 +4784,19 @@ void RE_Database_Free(Render *re)
static int allow_render_object(Render *re, Object *ob, int nolamps, int onlyselected, Object *actob)
{
/* override not showing object when duplis are used with particles */
- if(ob->transflag & OB_DUPLIPARTS)
+ if (ob->transflag & OB_DUPLIPARTS)
; /* let particle system(s) handle showing vs. not showing */
- else if((ob->transflag & OB_DUPLI) && !(ob->transflag & OB_DUPLIFRAMES))
+ else if ((ob->transflag & OB_DUPLI) && !(ob->transflag & OB_DUPLIFRAMES))
return 0;
/* don't add non-basic meta objects, ends up having renderobjects with no geometry */
if (ob->type == OB_MBALL && ob!=find_basis_mball(re->scene, ob))
return 0;
- if(nolamps && (ob->type==OB_LAMP))
+ if (nolamps && (ob->type==OB_LAMP))
return 0;
- if(onlyselected && (ob!=actob && !(ob->flag & SELECT)))
+ if (onlyselected && (ob!=actob && !(ob->flag & SELECT)))
return 0;
return 1;
@@ -4805,16 +4812,16 @@ static int allow_render_dupli_instance(Render *UNUSED(re), DupliObject *dob, Obj
* all halo's to sort them globally in advance */
totmaterial= give_totcolp(obd);
- if(totmaterial) {
- for(a= 0; a<*totmaterial; a++) {
+ if (totmaterial) {
+ for (a= 0; a<*totmaterial; a++) {
ma= give_current_material(obd, a);
- if(ma && (ma->material_type == MA_TYPE_HALO))
+ if (ma && (ma->material_type == MA_TYPE_HALO))
return 0;
}
}
- for(psys=obd->particlesystem.first; psys; psys=psys->next)
- if(!ELEM5(psys->part->ren_as, PART_DRAW_BB, PART_DRAW_LINE, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR))
+ for (psys=obd->particlesystem.first; psys; psys=psys->next)
+ if (!ELEM5(psys->part->ren_as, PART_DRAW_BB, PART_DRAW_LINE, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR))
return 0;
/* don't allow lamp, animated duplis, or radio render */
@@ -4831,35 +4838,35 @@ static void dupli_render_particle_set(Render *re, Object *ob, int timeoffset, in
ParticleSystem *psys;
DerivedMesh *dm;
- if(level >= MAX_DUPLI_RECUR)
+ if (level >= MAX_DUPLI_RECUR)
return;
- if(ob->transflag & OB_DUPLIPARTS) {
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
- if(ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
- if(enable)
+ if (ob->transflag & OB_DUPLIPARTS) {
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+ if (ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
+ if (enable)
psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy, timeoffset);
else
psys_render_restore(ob, psys);
}
}
- if(enable) {
+ if (enable) {
/* this is to make sure we get render level duplis in groups:
* the derivedmesh must be created before init_render_mesh,
* since object_duplilist does dupliparticles before that */
dm = mesh_create_derived_render(re->scene, ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
dm->release(dm);
- for(psys=ob->particlesystem.first; psys; psys=psys->next)
+ for (psys=ob->particlesystem.first; psys; psys=psys->next)
psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
}
}
- if(ob->dup_group==NULL) return;
+ if (ob->dup_group==NULL) return;
group= ob->dup_group;
- for(go= group->gobject.first; go; go= go->next)
+ for (go= group->gobject.first; go; go= go->next)
dupli_render_particle_set(re, go->ob, timeoffset, level+1, enable);
}
@@ -4868,8 +4875,8 @@ static int get_vector_renderlayers(Scene *sce)
SceneRenderLayer *srl;
unsigned int lay= 0;
- for(srl= sce->r.layers.first; srl; srl= srl->next)
- if(srl->passflag & SCE_PASS_VECTOR)
+ for (srl= sce->r.layers.first; srl; srl= srl->next)
+ if (srl->passflag & SCE_PASS_VECTOR)
lay |= srl->lay;
return lay;
@@ -4881,20 +4888,20 @@ static void add_group_render_dupli_obs(Render *re, Group *group, int nolamps, in
Object *ob;
/* simple preventing of too deep nested groups */
- if(level>MAX_DUPLI_RECUR) return;
+ if (level>MAX_DUPLI_RECUR) return;
/* recursively go into dupligroups to find objects with OB_RENDER_DUPLI
* that were not created yet */
- for(go= group->gobject.first; go; go= go->next) {
+ for (go= group->gobject.first; go; go= go->next) {
ob= go->ob;
- if(ob->flag & OB_DONE) {
- if(ob->transflag & OB_RENDER_DUPLI) {
- if(allow_render_object(re, ob, nolamps, onlyselected, actob)) {
+ if (ob->flag & OB_DONE) {
+ if (ob->transflag & OB_RENDER_DUPLI) {
+ if (allow_render_object(re, ob, nolamps, onlyselected, actob)) {
init_render_object(re, ob, NULL, 0, timeoffset);
ob->transflag &= ~OB_RENDER_DUPLI;
- if(ob->dup_group)
+ if (ob->dup_group)
add_group_render_dupli_obs(re, ob->dup_group, nolamps, onlyselected, actob, timeoffset, level+1);
}
}
@@ -4918,12 +4925,12 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
set_dupli_tex_mat(NULL, NULL, NULL);
/* loop over all objects rather then using SETLOOPER because we may
- * reference an mtex-mapped object which isnt rendered or is an
+ * reference an mtex-mapped object which isn't rendered or is an
* empty in a dupli group. We could scan all render material/lamp/world
* mtex's for mapto objects but its easier just to set the
* 'imat' / 'imat_ren' on all and unlikely to be a performance hit
* See bug: [#28744] - campbell */
- for(ob= re->main->object.first; ob; ob= ob->id.next) {
+ for (ob= re->main->object.first; ob; ob= ob->id.next) {
/* imat objects has to be done here, since displace can have texture using Object map-input */
mult_m4_m4m4(mat, re->viewmat, ob->obmat);
invert_m4_m4(ob->imat_ren, mat);
@@ -4933,7 +4940,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
ob->transflag &= ~OB_RENDER_DUPLI;
}
- for(SETLOOPER(re->scene, sce_iter, base)) {
+ for (SETLOOPER(re->scene, sce_iter, base)) {
ob= base->object;
/* in the prev/next pass for making speed vectors, avoid creating
@@ -4943,21 +4950,21 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
lay= (timeoffset)? renderlay & vectorlay: renderlay;
/* if the object has been restricted from rendering in the outliner, ignore it */
- if(ob->restrictflag & OB_RESTRICT_RENDER) continue;
+ if (ob->restrictflag & OB_RESTRICT_RENDER) continue;
/* OB_DONE means the object itself got duplicated, so was already converted */
- if(ob->flag & OB_DONE) {
+ if (ob->flag & OB_DONE) {
/* OB_RENDER_DUPLI means instances for it were already created, now
* it still needs to create the ObjectRen containing the data */
- if(ob->transflag & OB_RENDER_DUPLI) {
- if(allow_render_object(re, ob, nolamps, onlyselected, actob)) {
+ if (ob->transflag & OB_RENDER_DUPLI) {
+ if (allow_render_object(re, ob, nolamps, onlyselected, actob)) {
init_render_object(re, ob, NULL, 0, timeoffset);
ob->transflag &= ~OB_RENDER_DUPLI;
}
}
}
- else if((base->lay & lay) || (ob->type==OB_LAMP && (base->lay & re->lay)) ) {
- if((ob->transflag & OB_DUPLI) && (ob->type!=OB_MBALL)) {
+ else if ((base->lay & lay) || (ob->type==OB_LAMP && (base->lay & re->lay)) ) {
+ if ((ob->transflag & OB_DUPLI) && (ob->type!=OB_MBALL)) {
DupliObject *dob;
ListBase *lb;
@@ -4967,25 +4974,25 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
lb= object_duplilist(re->scene, ob);
dupli_render_particle_set(re, ob, timeoffset, 0, 0);
- for(dob= lb->first; dob; dob= dob->next) {
+ for (dob= lb->first; dob; dob= dob->next) {
Object *obd= dob->ob;
copy_m4_m4(obd->obmat, dob->mat);
/* group duplis need to set ob matrices correct, for deform. so no_draw is part handled */
- if(!(obd->transflag & OB_RENDER_DUPLI) && dob->no_draw)
+ if (!(obd->transflag & OB_RENDER_DUPLI) && dob->no_draw)
continue;
- if(obd->restrictflag & OB_RESTRICT_RENDER)
+ if (obd->restrictflag & OB_RESTRICT_RENDER)
continue;
- if(obd->type==OB_MBALL)
+ if (obd->type==OB_MBALL)
continue;
- if(!allow_render_object(re, obd, nolamps, onlyselected, actob))
+ if (!allow_render_object(re, obd, nolamps, onlyselected, actob))
continue;
- if(allow_render_dupli_instance(re, dob, obd)) {
+ if (allow_render_dupli_instance(re, dob, obd)) {
ParticleSystem *psys;
ObjectRen *obr = NULL;
int psysindex;
@@ -4996,13 +5003,13 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
/* instances instead of the actual object are added in two cases, either
* this is a duplivert/face/particle, or it is a non-animated object in
* a dupligroup that has already been created before */
- if(dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, 0))) {
+ if (dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, 0))) {
mult_m4_m4m4(mat, re->viewmat, dob->mat);
obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, 0, mat, obd->lay);
/* fill in instance variables for texturing */
set_dupli_tex_mat(re, obi, dob);
- if(dob->type != OB_DUPLIGROUP) {
+ if (dob->type != OB_DUPLIGROUP) {
copy_v3_v3(obi->dupliorco, dob->orco);
obi->dupliuv[0]= dob->uv[0];
obi->dupliuv[1]= dob->uv[1];
@@ -5013,7 +5020,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
* itself was duplicated. for the first case find_dupli_instances
* will be called later. */
assign_dupligroup_dupli(re, obi, obr);
- if(obd->transflag & OB_RENDER_DUPLI)
+ if (obd->transflag & OB_RENDER_DUPLI)
find_dupli_instances(re, obr);
}
}
@@ -5021,31 +5028,31 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
/* same logic for particles, each particle system has it's own object, so
* need to go over them separately */
psysindex= 1;
- for(psys=obd->particlesystem.first; psys; psys=psys->next) {
- if(dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, psysindex))) {
- if(obi == NULL)
+ for (psys=obd->particlesystem.first; psys; psys=psys->next) {
+ if (dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, psysindex))) {
+ if (obi == NULL)
mult_m4_m4m4(mat, re->viewmat, dob->mat);
obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, psysindex++, mat, obd->lay);
set_dupli_tex_mat(re, obi, dob);
- if(dob->type != OB_DUPLIGROUP) {
+ if (dob->type != OB_DUPLIGROUP) {
copy_v3_v3(obi->dupliorco, dob->orco);
obi->dupliuv[0]= dob->uv[0];
obi->dupliuv[1]= dob->uv[1];
}
else {
assign_dupligroup_dupli(re, obi, obr);
- if(obd->transflag & OB_RENDER_DUPLI)
+ if (obd->transflag & OB_RENDER_DUPLI)
find_dupli_instances(re, obr);
}
}
}
- if(obi==NULL)
+ if (obi==NULL)
/* can't instance, just create the object */
init_render_object(re, obd, ob, dob, timeoffset);
- if(dob->type != OB_DUPLIGROUP) {
+ if (dob->type != OB_DUPLIGROUP) {
obd->flag |= OB_DONE;
obd->transflag |= OB_RENDER_DUPLI;
}
@@ -5053,26 +5060,26 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
else
init_render_object(re, obd, ob, dob, timeoffset);
- if(re->test_break(re->tbh)) break;
+ if (re->test_break(re->tbh)) break;
}
free_object_duplilist(lb);
- if(allow_render_object(re, ob, nolamps, onlyselected, actob))
+ if (allow_render_object(re, ob, nolamps, onlyselected, actob))
init_render_object(re, ob, NULL, 0, timeoffset);
}
- else if(allow_render_object(re, ob, nolamps, onlyselected, actob))
+ else if (allow_render_object(re, ob, nolamps, onlyselected, actob))
init_render_object(re, ob, NULL, 0, timeoffset);
}
- if(re->test_break(re->tbh)) break;
+ if (re->test_break(re->tbh)) break;
}
/* objects in groups with OB_RENDER_DUPLI set still need to be created,
* since they may not be part of the scene */
- for(group= re->main->group.first; group; group=group->id.next)
+ for (group= re->main->group.first; group; group=group->id.next)
add_group_render_dupli_obs(re, group, nolamps, onlyselected, actob, timeoffset, 0);
- if(!re->test_break(re->tbh))
+ if (!re->test_break(re->tbh))
RE_makeRenderInstances(re);
}
@@ -5104,18 +5111,18 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
re->i.partsdone= 0; /* signal now in use for previewrender */
/* in localview, lamps are using normal layers, objects only local bits */
- if(re->lay & 0xFF000000)
+ if (re->lay & 0xFF000000)
lay &= 0xFF000000;
/* applies changes fully */
- if((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0)
+ if ((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0)
scene_update_for_newframe(re->main, re->scene, lay);
/* if no camera, viewmat should have been set! */
- if(use_camera_view && camera) {
+ if (use_camera_view && camera) {
/* called before but need to call again in case of lens animation from the
* above call to scene_update_for_newframe, fixes bug. [#22702].
- * following calls dont depend on 'RE_SetCamera' */
+ * following calls don't depend on 'RE_SetCamera' */
RE_SetCamera(re, camera);
normalize_m4(camera->obmat);
@@ -5125,10 +5132,10 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
}
init_render_world(re); /* do first, because of ambient. also requires re->osa set correct */
- if(re->r.mode & R_RAYTRACE) {
+ if (re->r.mode & R_RAYTRACE) {
init_render_qmcsampler(re);
- if(re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT))
+ if (re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT))
if (re->wrld.ao_samp_method == WO_AOSAMP_CONSTANT)
init_ao_sphere(&re->wrld);
}
@@ -5142,11 +5149,11 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
/* MAKE RENDER DATA */
database_init_objects(re, lay, 0, 0, 0, 0);
- if(!re->test_break(re->tbh)) {
+ if (!re->test_break(re->tbh)) {
int tothalo;
set_material_lightgroups(re);
- for(sce= re->scene; sce; sce= sce->set)
+ for (sce= re->scene; sce; sce= sce->set)
set_renderlayer_lightgroups(re, sce);
slurph_opt= 1;
@@ -5161,8 +5168,8 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
/* don't sort stars */
tothalo= re->tothalo;
- if(!re->test_break(re->tbh)) {
- if(re->wrld.mode & WO_STARS) {
+ if (!re->test_break(re->tbh)) {
+ if (re->wrld.mode & WO_STARS) {
re->i.infostr= "Creating Starfield";
re->stats_draw(re->sdh, &re->i);
RE_make_stars(re, NULL, NULL, NULL, NULL);
@@ -5181,43 +5188,43 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
/* old code checked for internal render (aka not yafray) */
{
/* raytree */
- if(!re->test_break(re->tbh)) {
- if(re->r.mode & R_RAYTRACE) {
+ if (!re->test_break(re->tbh)) {
+ if (re->r.mode & R_RAYTRACE) {
makeraytree(re);
}
}
/* ENVIRONMENT MAPS */
- if(!re->test_break(re->tbh))
+ if (!re->test_break(re->tbh))
make_envmaps(re);
/* point density texture */
- if(!re->test_break(re->tbh))
+ if (!re->test_break(re->tbh))
make_pointdensities(re);
/* voxel data texture */
- if(!re->test_break(re->tbh))
+ if (!re->test_break(re->tbh))
make_voxeldata(re);
}
- if(!re->test_break(re->tbh))
+ if (!re->test_break(re->tbh))
project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0, 1);
/* Occlusion */
- if((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && !re->test_break(re->tbh))
- if(re->wrld.ao_gather_method == WO_AOGATHER_APPROX)
- if(re->r.mode & R_SHADOW)
+ if ((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && !re->test_break(re->tbh))
+ if (re->wrld.ao_gather_method == WO_AOGATHER_APPROX)
+ if (re->r.mode & R_SHADOW)
make_occ_tree(re);
/* SSS */
- if((re->r.mode & R_SSS) && !re->test_break(re->tbh))
+ if ((re->r.mode & R_SSS) && !re->test_break(re->tbh))
make_sss_tree(re);
- if(!re->test_break(re->tbh))
- if(re->r.mode & R_RAYTRACE)
+ if (!re->test_break(re->tbh))
+ if (re->r.mode & R_RAYTRACE)
volume_precache(re);
}
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
RE_Database_Free(re);
else
re->i.convertdone= 1;
@@ -5259,7 +5266,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la
slurph_opt= 0;
/* in localview, lamps are using normal layers, objects only local bits */
- if(re->lay & 0xFF000000)
+ if (re->lay & 0xFF000000)
lay &= 0xFF000000;
/* applies changes fully */
@@ -5267,7 +5274,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la
scene_update_for_newframe(re->main, re->scene, lay);
/* if no camera, viewmat should have been set! */
- if(camera) {
+ if (camera) {
normalize_m4(camera->obmat);
invert_m4_m4(mat, camera->obmat);
RE_SetView(re, mat);
@@ -5276,7 +5283,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la
/* MAKE RENDER DATA */
database_init_objects(re, lay, 0, 0, 0, timeoffset);
- if(!re->test_break(re->tbh))
+ if (!re->test_break(re->tbh))
project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0, 1);
/* do this in end, particles for example need cfra */
@@ -5291,11 +5298,11 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con
float div;
/* initialize */
- if(re) {
+ if (re) {
pano= re->r.mode & R_PANORAMA;
/* precalculate amount of radians 1 pixel rotates */
- if(pano) {
+ if (pano) {
/* size of 1 pixel mapped to viewplane coords */
float psize= (re->viewplane.xmax-re->viewplane.xmin)/(float)re->winx;
/* x angle of a pixel */
@@ -5312,17 +5319,17 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con
}
/* now map hocos to screenspace, uses very primitive clip still */
- if(ho[3]<0.1f) div= 10.0f;
+ if (ho[3]<0.1f) div= 10.0f;
else div= 1.0f/ho[3];
/* use cylinder projection */
- if(pano) {
+ if (pano) {
float vec[3], ang;
/* angle between (0,0,-1) and (co) */
copy_v3_v3(vec, co);
ang= saacos(-vec[2]/sqrtf(vec[0]*vec[0] + vec[2]*vec[2]));
- if(vec[0]<0.0f) ang= -ang;
+ if (vec[0]<0.0f) ang= -ang;
zco[0]= ang/pixelphix + zmulx;
ang= 0.5f*(float)M_PI - saacos(vec[1] / len_v3(vec));
@@ -5345,21 +5352,21 @@ static void calculate_speedvector(const float vectors[2], int step, float winsq,
zco[1]= vectors[1] - zco[1];
/* enable nice masks for hardly moving stuff or float inaccuracy */
- if(zco[0]<0.1f && zco[0]>-0.1f && zco[1]<0.1f && zco[1]>-0.1f ) {
+ if (zco[0]<0.1f && zco[0]>-0.1f && zco[1]<0.1f && zco[1]>-0.1f ) {
zco[0]= 0.0f;
zco[1]= 0.0f;
}
/* maximize speed for image width, otherwise it never looks good */
len= zco[0]*zco[0] + zco[1]*zco[1];
- if(len > winsq) {
+ if (len > winsq) {
len= winroot/sqrtf(len);
zco[0]*= len;
zco[1]*= len;
}
/* note; in main vecblur loop speedvec is negated again */
- if(step) {
+ if (step) {
speed[2]= -zco[0];
speed[3]= -zco[1];
}
@@ -5371,21 +5378,21 @@ static void calculate_speedvector(const float vectors[2], int step, float winsq,
static float *calculate_strandsurface_speedvectors(Render *re, ObjectInstanceRen *obi, StrandSurface *mesh)
{
- if(mesh->co && mesh->prevco && mesh->nextco) {
+ if (mesh->co && mesh->prevco && mesh->nextco) {
float winsq= (float)re->winx*(float)re->winy; /* int's can wrap on large images */
float winroot= sqrt(winsq);
float (*winspeed)[4];
float ho[4], prevho[4], nextho[4], winmat[4][4], vec[2];
int a;
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mult_m4_m4m4(winmat, re->winmat, obi->mat);
else
copy_m4_m4(winmat, re->winmat);
winspeed= MEM_callocN(sizeof(float)*4*mesh->totvert, "StrandSurfWin");
- for(a=0; a<mesh->totvert; a++) {
+ for (a=0; a<mesh->totvert; a++) {
projectvert(mesh->co[a], winmat, ho);
projectvert(mesh->prevco[a], winmat, prevho);
@@ -5415,14 +5422,14 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve
float winsq= (float)re->winx*(float)re->winy, winroot= sqrt(winsq); /* int's can wrap on large images */
int a, *face, *index;
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mult_m4_m4m4(winmat, re->winmat, obi->mat);
else
copy_m4_m4(winmat, re->winmat);
- if(obr->vertnodes) {
- for(a=0; a<obr->totvert; a++, vectors+=2) {
- if((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
+ if (obr->vertnodes) {
+ for (a=0; a<obr->totvert; a++, vectors+=2) {
+ if ((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
else ver++;
speed= RE_vertren_get_winspeed(obi, ver, 1);
@@ -5431,21 +5438,21 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve
}
}
- if(obr->strandnodes) {
+ if (obr->strandnodes) {
strandbuf= obr->strandbuf;
mesh= (strandbuf)? strandbuf->surface: NULL;
/* compute speed vectors at surface vertices */
- if(mesh)
+ if (mesh)
winspeed= (float(*)[4])calculate_strandsurface_speedvectors(re, obi, mesh);
- if(winspeed) {
- for(a=0; a<obr->totstrand; a++, vectors+=2) {
- if((a & 255)==0) strand= obr->strandnodes[a>>8].strand;
+ if (winspeed) {
+ for (a=0; a<obr->totstrand; a++, vectors+=2) {
+ if ((a & 255)==0) strand= obr->strandnodes[a>>8].strand;
else strand++;
index= RE_strandren_get_face(obr, strand, 0);
- if(index && *index < mesh->totface) {
+ if (index && *index < mesh->totface) {
speed= RE_strandren_get_winspeed(obi, strand, 1);
/* interpolate speed vectors from strand surface */
@@ -5462,7 +5469,7 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve
madd_v4_v4fl(speed, winspeed[face[0]], w[0]);
madd_v4_v4fl(speed, winspeed[face[1]], w[1]);
madd_v4_v4fl(speed, winspeed[face[2]], w[2]);
- if(face[3])
+ if (face[3])
madd_v4_v4fl(speed, winspeed[face[3]], w[3]);
}
}
@@ -5489,9 +5496,9 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
FluidVertexVelocity *velarray = NULL;
/* only one step needed */
- if(step) return 1;
+ if (step) return 1;
- if(fluidmd)
+ if (fluidmd)
fss = fluidmd->fss;
else
return 0;
@@ -5500,16 +5507,16 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
invert_m4_m4(imat, mat);
/* set first vertex OK */
- if(!fss->meshVelocities) return 0;
+ if (!fss->meshVelocities) return 0;
- if( obr->totvert != fss->totvert) {
+ if ( obr->totvert != fss->totvert) {
//fprintf(stderr, "load_fluidsimspeedvectors - modified fluidsim mesh, not using speed vectors (%d,%d)...\n", obr->totvert, fsob->fluidsimSettings->meshSurface->totvert); // DEBUG
return 0;
}
velarray = fss->meshVelocities;
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mult_m4_m4m4(winmat, re->winmat, obi->mat);
else
copy_m4_m4(winmat, re->winmat);
@@ -5518,15 +5525,15 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
/* better solution would be fixing getVelocityAt() in intern/elbeem/intern/solver_util.cpp
so that also small drops/little water volumes return a velocity != 0.
But I had no luck in fixing that function - DG */
- for(a=0; a<obr->totvert; a++) {
- for(j=0;j<3;j++) avgvel[j] += velarray[a].vel[j];
+ for (a=0; a<obr->totvert; a++) {
+ for (j=0;j<3;j++) avgvel[j] += velarray[a].vel[j];
}
- for(j=0;j<3;j++) avgvel[j] /= (float)(obr->totvert);
+ for (j=0;j<3;j++) avgvel[j] /= (float)(obr->totvert);
- for(a=0; a<obr->totvert; a++, vectors+=2) {
- if((a & 255)==0)
+ for (a=0; a<obr->totvert; a++, vectors+=2) {
+ if ((a & 255)==0)
ver= obr->vertnodes[a>>8].vert;
else
ver++;
@@ -5534,7 +5541,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
// get fluid velocity
fsvec[3] = 0.;
//fsvec[0] = fsvec[1] = fsvec[2] = fsvec[3] = 0.; fsvec[2] = 2.; // NT fixed test
- for(j=0;j<3;j++) fsvec[j] = velarray[a].vel[j];
+ for (j=0;j<3;j++) fsvec[j] = velarray[a].vel[j];
/* (bad) HACK insert average velocity if none is there (see previous comment) */
if ((fsvec[0] == 0.0f) && (fsvec[1] == 0.0f) && (fsvec[2] == 0.0f)) {
@@ -5554,14 +5561,14 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
/* now map hocos to screenspace, uses very primitive clip still */
// use ho[3] of original vertex, xy component of vel. direction
- if(ho[3]<0.1f) div= 10.0f;
+ if (ho[3]<0.1f) div= 10.0f;
else div= 1.0f/ho[3];
zco[0]= zmulx*hoco[0]*div;
zco[1]= zmuly*hoco[1]*div;
// maximize speed as usual
len= zco[0]*zco[0] + zco[1]*zco[1];
- if(len > winsq) {
+ if (len > winsq) {
len= winroot/sqrtf(len);
zco[0]*= len; zco[1]*= len;
}
@@ -5586,7 +5593,7 @@ static void copy_dbase_object_vectors(Render *re, ListBase *lb)
float *vec, ho[4], winmat[4][4];
int a, totvector;
- for(obi= re->instancetable.first; obi; obi= obi->next) {
+ for (obi= re->instancetable.first; obi; obi= obi->next) {
obr= obi->obr;
obilb= MEM_mallocN(sizeof(ObjectInstanceRen), "ObInstanceVector");
@@ -5595,16 +5602,16 @@ static void copy_dbase_object_vectors(Render *re, ListBase *lb)
obilb->totvector= totvector= obr->totvert;
- if(totvector > 0) {
+ if (totvector > 0) {
vec= obilb->vectors= MEM_mallocN(2*sizeof(float)*totvector, "vector array");
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mult_m4_m4m4(winmat, re->winmat, obi->mat);
else
copy_m4_m4(winmat, re->winmat);
- for(a=0; a<obr->totvert; a++, vec+=2) {
- if((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
+ for (a=0; a<obr->totvert; a++, vec+=2) {
+ if ((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
else ver++;
projectvert(ver->co, winmat, ho);
@@ -5618,8 +5625,8 @@ static void free_dbase_object_vectors(ListBase *lb)
{
ObjectInstanceRen *obi;
- for(obi= lb->first; obi; obi= obi->next)
- if(obi->vectors)
+ for (obi= lb->first; obi; obi= obi->next)
+ if (obi->vectors)
MEM_freeN(obi->vectors);
BLI_freelistN(lb);
}
@@ -5650,7 +5657,7 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
RE_Database_Free(re);
re->strandsurface= strandsurface;
- if(!re->test_break(re->tbh)) {
+ if (!re->test_break(re->tbh)) {
/* creates entire dbase */
re->i.infostr= "Calculating next frame vectors";
@@ -5665,55 +5672,55 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
RE_Database_Free(re);
re->strandsurface= strandsurface;
- if(!re->test_break(re->tbh))
+ if (!re->test_break(re->tbh))
RE_Database_FromScene(re, bmain, sce, lay, 1);
- if(!re->test_break(re->tbh)) {
+ if (!re->test_break(re->tbh)) {
int vectorlay= get_vector_renderlayers(re->scene);
- for(step= 0; step<2; step++) {
+ for (step= 0; step<2; step++) {
- if(step)
+ if (step)
table= &newtable;
else
table= &oldtable;
oldobi= table->first;
- for(obi= re->instancetable.first; obi && oldobi; obi= obi->next) {
+ for (obi= re->instancetable.first; obi && oldobi; obi= obi->next) {
int ok= 1;
FluidsimModifierData *fluidmd;
- if(!(obi->lay & vectorlay))
+ if (!(obi->lay & vectorlay))
continue;
obi->totvector= obi->obr->totvert;
/* find matching object in old table */
- if(oldobi->ob!=obi->ob || oldobi->par!=obi->par || oldobi->index!=obi->index || oldobi->psysindex!=obi->psysindex) {
+ if (oldobi->ob!=obi->ob || oldobi->par!=obi->par || oldobi->index!=obi->index || oldobi->psysindex!=obi->psysindex) {
ok= 0;
- for(oldobi= table->first; oldobi; oldobi= oldobi->next)
- if(oldobi->ob==obi->ob && oldobi->par==obi->par && oldobi->index==obi->index && oldobi->psysindex==obi->psysindex)
+ for (oldobi= table->first; oldobi; oldobi= oldobi->next)
+ if (oldobi->ob==obi->ob && oldobi->par==obi->par && oldobi->index==obi->index && oldobi->psysindex==obi->psysindex)
break;
- if(oldobi==NULL)
+ if (oldobi==NULL)
oldobi= table->first;
else
ok= 1;
}
- if(ok==0) {
+ if (ok==0) {
printf("speed table: missing object %s\n", obi->ob->id.name+2);
continue;
}
// NT check for fluidsim special treatment
fluidmd = (FluidsimModifierData *)modifiers_findByType(obi->ob, eModifierType_Fluidsim);
- if(fluidmd && fluidmd->fss && (fluidmd->fss->type & OB_FLUIDSIM_DOMAIN)) {
+ if (fluidmd && fluidmd->fss && (fluidmd->fss->type & OB_FLUIDSIM_DOMAIN)) {
// use preloaded per vertex simulation data , only does calculation for step=1
// NOTE/FIXME - velocities and meshes loaded unnecessarily often during the database_fromscene_vectors calls...
load_fluidsimspeedvectors(re, obi, oldobi->vectors, step);
}
else {
/* check if both have same amounts of vertices */
- if(obi->totvector==oldobi->totvector)
+ if (obi->totvector==oldobi->totvector)
calculate_speedvectors(re, obi, oldobi->vectors, step);
else
printf("Warning: object %s has different amount of vertices or strands on other frame\n", obi->ob->id.name+2);
@@ -5727,12 +5734,12 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
free_dbase_object_vectors(&oldtable);
free_dbase_object_vectors(&newtable);
- for(mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
- if(mesh->prevco) {
+ for (mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
+ if (mesh->prevco) {
MEM_freeN(mesh->prevco);
mesh->prevco= NULL;
}
- if(mesh->nextco) {
+ if (mesh->nextco) {
MEM_freeN(mesh->nextco);
mesh->nextco= NULL;
}
@@ -5776,18 +5783,18 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
re->flag |= R_BAKING;
re->excludeob= actob;
- if(actob)
+ if (actob)
re->flag |= R_BAKE_TRACE;
- if(type==RE_BAKE_NORMALS && re->r.bake_normal_space==R_BAKE_SPACE_TANGENT)
+ if (type==RE_BAKE_NORMALS && re->r.bake_normal_space==R_BAKE_SPACE_TANGENT)
re->flag |= R_NEED_TANGENT;
- if(!actob && ELEM4(type, RE_BAKE_LIGHT, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_DISPLACEMENT)) {
+ if (!actob && ELEM4(type, RE_BAKE_LIGHT, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_DISPLACEMENT)) {
re->r.mode &= ~R_SHADOW;
re->r.mode &= ~R_RAYTRACE;
}
- if(!actob && (type==RE_BAKE_SHADOW)) {
+ if (!actob && (type==RE_BAKE_SHADOW)) {
re->r.mode |= R_SHADOW;
}
@@ -5799,13 +5806,13 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
re->lampren.first= re->lampren.last= NULL;
/* in localview, lamps are using normal layers, objects only local bits */
- if(re->lay & 0xFF000000)
+ if (re->lay & 0xFF000000)
lay &= 0xFF000000;
camera= RE_GetCamera(re);
/* if no camera, set unit */
- if(camera) {
+ if (camera) {
normalize_m4(camera->obmat);
invert_m4_m4(mat, camera->obmat);
RE_SetView(re, mat);
@@ -5824,10 +5831,10 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
/* done setting dummy values */
init_render_world(re); /* do first, because of ambient. also requires re->osa set correct */
- if(re->r.mode & R_RAYTRACE) {
+ if (re->r.mode & R_RAYTRACE) {
init_render_qmcsampler(re);
- if(re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT))
+ if (re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT))
if (re->wrld.ao_samp_method == WO_AOSAMP_CONSTANT)
init_ao_sphere(&re->wrld);
}
@@ -5846,27 +5853,27 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
set_material_lightgroups(re);
/* SHADOW BUFFER */
- if(type!=RE_BAKE_LIGHT)
- if(re->r.mode & R_SHADOW)
+ if (type!=RE_BAKE_LIGHT)
+ if (re->r.mode & R_SHADOW)
threaded_makeshadowbufs(re);
/* raytree */
- if(!re->test_break(re->tbh))
- if(re->r.mode & R_RAYTRACE)
+ if (!re->test_break(re->tbh))
+ if (re->r.mode & R_RAYTRACE)
makeraytree(re);
/* point density texture */
- if(!re->test_break(re->tbh))
+ if (!re->test_break(re->tbh))
make_pointdensities(re);
/* voxel data texture */
- if(!re->test_break(re->tbh))
+ if (!re->test_break(re->tbh))
make_voxeldata(re);
/* occlusion */
- if((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && !re->test_break(re->tbh))
- if(re->wrld.ao_gather_method == WO_AOGATHER_APPROX)
- if(re->r.mode & R_SHADOW)
+ if ((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && !re->test_break(re->tbh))
+ if (re->wrld.ao_gather_method == WO_AOGATHER_APPROX)
+ if (re->r.mode & R_SHADOW)
make_occ_tree(re);
}
@@ -5886,19 +5893,19 @@ void RE_make_sticky(Scene *scene, View3D *v3d)
int a;
Object *camera= NULL;
- if(v3d==NULL) {
+ if (v3d==NULL) {
printf("Need a 3d view to make sticky\n");
return;
}
- if(v3d) camera= V3D_CAMERA_LOCAL(v3d);
- if(camera == NULL) camera= scene->camera;
+ if (v3d) camera= V3D_CAMERA_LOCAL(v3d);
+ if (camera == NULL) camera= scene->camera;
- if(camera==NULL) {
+ if (camera==NULL) {
printf("Need camera to make sticky\n");
return;
}
- if(scene->obedit) {
+ if (scene->obedit) {
printf("Unable to make sticky in Edit Mode\n");
return;
}
@@ -5914,14 +5921,14 @@ void RE_make_sticky(Scene *scene, View3D *v3d)
invert_m4_m4(mat, camera->obmat);
RE_SetView(re, mat);
- for(base= FIRSTBASE; base; base= base->next) {
+ for (base= FIRSTBASE; base; base= base->next) {
if TESTBASELIB(v3d, base) {
- if(base->object->type==OB_MESH) {
+ if (base->object->type==OB_MESH) {
ob= base->object;
me= ob->data;
mvert= me->mvert;
- if(me->msticky)
+ if (me->msticky)
CustomData_free_layer_active(&me->vdata, CD_MSTICKY, me->totvert);
me->msticky= CustomData_add_layer(&me->vdata, CD_MSTICKY,
CD_CALLOC, NULL, me->totvert);
@@ -5930,7 +5937,7 @@ void RE_make_sticky(Scene *scene, View3D *v3d)
mult_m4_m4m4(mat, re->viewmat, ob->obmat);
ms= me->msticky;
- for(a=0; a<me->totvert; a++, ms++, mvert++) {
+ for (a=0; a<me->totvert; a++, ms++, mvert++) {
copy_v3_v3(ho, mvert->co);
mul_m4_v3(mat, ho);
projectverto(ho, re->winmat, ho);
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index f9641ed9fbe..fa7b9cb7ea1 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -76,7 +76,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
/* after lock we test cube[1], if set the other thread has done it fine */
BLI_lock_thread(LOCK_IMAGE);
- if(env->cube[1]==NULL) {
+ if (env->cube[1]==NULL) {
BKE_free_envmapdata(env);
@@ -85,18 +85,20 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
if (3*dx == ibuf->x) {
env->type = ENV_CUBE;
env->ok= ENV_OSA;
- } else if (ibuf->x == ibuf->y) {
+ }
+ else if (ibuf->x == ibuf->y) {
env->type = ENV_PLANE;
env->ok= ENV_OSA;
- } else {
+ }
+ else {
printf("Incorrect envmap size\n");
env->ok= 0;
env->ima->ok= 0;
}
- if(env->ok) {
+ if (env->ok) {
if (env->type == ENV_CUBE) {
- for(part=0; part<6; part++) {
+ for (part=0; part<6; part++) {
env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect|IB_rectfloat);
}
IMB_float_from_rect(ibuf);
@@ -214,19 +216,24 @@ static void envmap_transmatrix(float mat[][4], int part)
eul[0]= eul[1]= eul[2]= 0.0;
- if(part==0) { /* neg z */
+ if (part==0) { /* neg z */
;
- } else if(part==1) { /* pos z */
+ }
+ else if (part==1) { /* pos z */
eul[0]= M_PI;
- } else if(part==2) { /* pos y */
+ }
+ else if (part==2) { /* pos y */
eul[0]= M_PI/2.0;
- } else if(part==3) { /* neg x */
+ }
+ else if (part==3) { /* neg x */
eul[0]= M_PI/2.0;
eul[2]= M_PI/2.0;
- } else if(part==4) { /* neg y */
+ }
+ else if (part==4) { /* neg y */
eul[0]= M_PI/2.0;
eul[2]= M_PI;
- } else { /* pos x */
+ }
+ else { /* pos x */
eul[0]= M_PI/2.0;
eul[2]= -M_PI/2.0;
}
@@ -250,7 +257,7 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
float imat[3][3], pmat[4][4], smat[4][4], tmat[4][4], cmat[3][3], tmpmat[4][4];
int a;
- if(mode==0) {
+ if (mode==0) {
invert_m4_m4(tmat, mat);
copy_m3_m4(imat, tmat);
}
@@ -259,13 +266,13 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
copy_m3_m4(imat, mat);
}
- for(obi=re->instancetable.first; obi; obi=obi->next) {
+ for (obi=re->instancetable.first; obi; obi=obi->next) {
/* append or set matrix depending on dupli */
- if(obi->flag & R_DUPLI_TRANSFORMED) {
+ if (obi->flag & R_DUPLI_TRANSFORMED) {
copy_m4_m4(tmpmat, obi->mat);
mult_m4_m4m4(obi->mat, tmat, tmpmat);
}
- else if(mode==1)
+ else if (mode==1)
copy_m4_m4(obi->mat, tmat);
else
unit_m4(obi->mat);
@@ -275,23 +282,23 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
transpose_m3(obi->nmat);
/* indicate the renderer has to use transform matrices */
- if(mode==0)
+ if (mode==0)
obi->flag &= ~R_ENV_TRANSFORMED;
else
obi->flag |= R_ENV_TRANSFORMED;
}
- for(obr=re->objecttable.first; obr; obr=obr->next) {
- for(a=0; a<obr->tothalo; a++) {
- if((a & 255)==0) har= obr->bloha[a>>8];
+ for (obr=re->objecttable.first; obr; obr=obr->next) {
+ for (a=0; a<obr->tothalo; a++) {
+ if ((a & 255)==0) har= obr->bloha[a>>8];
else har++;
mul_m4_v3(tmat, har->co);
}
}
- for(go=re->lights.first; go; go= go->next) {
+ for (go=re->lights.first; go; go= go->next) {
lar= go->lampren;
/* removed here some horrible code of someone in NaN who tried to fix
@@ -309,8 +316,8 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
mul_m3_v3(lar->imat, lar->sh_invcampos);
lar->sh_invcampos[2]*= lar->sh_zfac;
- if(lar->shb) {
- if(mode==1) {
+ if (lar->shb) {
+ if (mode==1) {
invert_m4_m4(pmat, mat);
mult_m4_m4m4(smat, lar->shb->viewmat, pmat);
mult_m4_m4m4(lar->shb->persmat, lar->shb->winmat, smat);
@@ -339,10 +346,10 @@ static void env_layerflags(Render *re, unsigned int notlay)
notlay= ~notlay;
- for(obr=re->objecttable.first; obr; obr=obr->next) {
- if((obr->lay & notlay)==0) {
- for(a=0; a<obr->totvlak; a++) {
- if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+ for (obr=re->objecttable.first; obr; obr=obr->next) {
+ if ((obr->lay & notlay)==0) {
+ for (a=0; a<obr->totvlak; a++) {
+ if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
else vlr++;
vlr->flag |= R_HIDDEN;
@@ -357,12 +364,12 @@ static void env_hideobject(Render *re, Object *ob)
VlakRen *vlr = NULL;
int a;
- for(obr=re->objecttable.first; obr; obr=obr->next) {
- for(a=0; a<obr->totvlak; a++) {
- if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+ for (obr=re->objecttable.first; obr; obr=obr->next) {
+ for (a=0; a<obr->totvlak; a++) {
+ if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
else vlr++;
- if(obr->ob == ob)
+ if (obr->ob == ob)
vlr->flag |= R_HIDDEN;
}
}
@@ -374,9 +381,9 @@ static void env_showobjects(Render *re)
VlakRen *vlr = NULL;
int a;
- for(obr=re->objecttable.first; obr; obr=obr->next) {
- for(a=0; a<obr->totvlak; a++) {
- if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+ for (obr=re->objecttable.first; obr; obr=obr->next) {
+ for (a=0; a<obr->totvlak; a++) {
+ if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
else vlr++;
vlr->flag &= ~R_HIDDEN;
@@ -392,7 +399,7 @@ static void env_set_imats(Render *re)
float mat[4][4];
base= re->scene->base.first;
- while(base) {
+ while (base) {
mult_m4_m4m4(mat, re->viewmat, base->object->obmat);
invert_m4_m4(base->object->imat, mat);
@@ -426,8 +433,8 @@ static void render_envmap(Render *re, EnvMap *env)
invert_m4_m4(tmat, mat);
copy_m3_m4(env->obimat, tmat);
- for(part=0; part<6; part++) {
- if(env->type==ENV_PLANE && part!=1)
+ for (part=0; part<6; part++) {
+ if (env->type==ENV_PLANE && part!=1)
continue;
re->display_clear(re->dch, envre->result);
@@ -451,7 +458,7 @@ static void render_envmap(Render *re, EnvMap *env)
env_hideobject(envre, env->object);
env_set_imats(envre);
- if(re->test_break(re->tbh)==0) {
+ if (re->test_break(re->tbh)==0) {
RE_TileProcessor(envre);
}
@@ -459,7 +466,7 @@ static void render_envmap(Render *re, EnvMap *env)
env_showobjects(envre);
env_rotate_scene(envre, tmat, 0);
- if(re->test_break(re->tbh)==0) {
+ if (re->test_break(re->tbh)==0) {
RenderLayer *rl= envre->result->layers.first;
int y;
float *alpha;
@@ -472,19 +479,19 @@ static void render_envmap(Render *re, EnvMap *env)
/* envmap renders without alpha */
alpha= ((float *)ibuf->rect_float)+3;
- for(y= ibuf->x*ibuf->y - 1; y>=0; y--, alpha+=4)
+ for (y= ibuf->x*ibuf->y - 1; y>=0; y--, alpha+=4)
*alpha= 1.0;
env->cube[part]= ibuf;
}
- if(re->test_break(re->tbh)) break;
+ if (re->test_break(re->tbh)) break;
}
- if(re->test_break(re->tbh)) BKE_free_envmapdata(env);
+ if (re->test_break(re->tbh)) BKE_free_envmapdata(env);
else {
- if(envre->r.mode & R_OSA) env->ok= ENV_OSA;
+ if (envre->r.mode & R_OSA) env->ok= ENV_OSA;
else env->ok= ENV_NORMAL;
env->lastframe= re->scene->r.cfra;
}
@@ -504,7 +511,7 @@ void make_envmaps(Render *re)
if (!(re->r.mode & R_ENVMAP)) return;
- /* we dont raytrace, disabling the flag will cause ray_transp render solid */
+ /* we don't raytrace, disabling the flag will cause ray_transp render solid */
trace= (re->r.mode & R_RAYTRACE);
re->r.mode &= ~R_RAYTRACE;
@@ -512,15 +519,15 @@ void make_envmaps(Render *re)
re->stats_draw(re->sdh, &re->i);
/* 5 = hardcoded max recursion level */
- while(depth<5) {
+ while (depth<5) {
tex= re->main->tex.first;
- while(tex) {
- if(tex->id.us && tex->type==TEX_ENVMAP) {
- if(tex->env && tex->env->object) {
+ while (tex) {
+ if (tex->id.us && tex->type==TEX_ENVMAP) {
+ if (tex->env && tex->env->object) {
EnvMap *env= tex->env;
- if(env->object->lay & re->lay) {
- if(env->stype==ENV_LOAD) {
+ if (env->object->lay & re->lay) {
+ if (env->stype==ENV_LOAD) {
float orthmat[4][4], mat[4][4], tmat[4][4];
/* precalc orthmat for object */
@@ -535,29 +542,29 @@ void make_envmaps(Render *re)
else {
/* decide if to render an envmap (again) */
- if(env->depth >= depth) {
+ if (env->depth >= depth) {
/* set 'recalc' to make sure it does an entire loop of recalcs */
- if(env->ok) {
+ if (env->ok) {
/* free when OSA, and old one isn't OSA */
- if((re->r.mode & R_OSA) && env->ok==ENV_NORMAL)
+ if ((re->r.mode & R_OSA) && env->ok==ENV_NORMAL)
BKE_free_envmapdata(env);
/* free when size larger */
- else if(env->lastsize < re->r.size)
+ else if (env->lastsize < re->r.size)
BKE_free_envmapdata(env);
/* free when env is in recalcmode */
- else if(env->recalc)
+ else if (env->recalc)
BKE_free_envmapdata(env);
}
- if(env->ok==0 && depth==0) env->recalc= 1;
+ if (env->ok==0 && depth==0) env->recalc= 1;
- if(env->ok==0) {
+ if (env->ok==0) {
do_init= 1;
render_envmap(re, env);
- if(depth==env->depth) env->recalc= 0;
+ if (depth==env->depth) env->recalc= 0;
}
}
}
@@ -569,7 +576,7 @@ void make_envmaps(Render *re)
depth++;
}
- if(do_init) {
+ if (do_init) {
re->display_init(re->dih, re->result);
re->display_clear(re->dch, re->result);
// re->flag |= R_REDRAW_PRV;
@@ -586,7 +593,7 @@ static int envcube_isect(EnvMap *env, float *vec, float *answ)
float labda;
int face;
- if(env->type==ENV_PLANE) {
+ if (env->type==ENV_PLANE) {
face= 1;
labda= 1.0f/vec[2];
@@ -595,7 +602,7 @@ static int envcube_isect(EnvMap *env, float *vec, float *answ)
}
else {
/* which face */
- if( vec[2] <= -fabsf(vec[0]) && vec[2] <= -fabsf(vec[1]) ) {
+ if ( vec[2] <= -fabsf(vec[0]) && vec[2] <= -fabsf(vec[1]) ) {
face= 0;
labda= -1.0f/vec[2];
answ[0]= labda*vec[0];
@@ -642,13 +649,13 @@ static int envcube_isect(EnvMap *env, float *vec, float *answ)
static void set_dxtdyt(float *dxts, float *dyts, float *dxt, float *dyt, int face)
{
- if(face==2 || face==4) {
+ if (face==2 || face==4) {
dxts[0]= dxt[0];
dyts[0]= dyt[0];
dxts[1]= dxt[2];
dyts[1]= dyt[2];
}
- else if(face==3 || face==5) {
+ else if (face==3 || face==5) {
dxts[0]= dxt[1];
dxts[1]= dxt[2];
dyts[0]= dyt[1];
@@ -674,17 +681,17 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
int face, face1;
env= tex->env;
- if(env==NULL || (env->stype!=ENV_LOAD && env->object==NULL)) {
+ if (env==NULL || (env->stype!=ENV_LOAD && env->object==NULL)) {
texres->tin= 0.0;
return 0;
}
- if(env->stype==ENV_LOAD) {
+ if (env->stype==ENV_LOAD) {
env->ima= tex->ima;
- if(env->ima && env->ima->ok) {
- if(env->cube[1]==NULL) {
+ if (env->ima && env->ima->ok) {
+ if (env->cube[1]==NULL) {
ImBuf *ibuf_ima= BKE_image_get_ibuf(env->ima, NULL);
- if(ibuf_ima)
+ if (ibuf_ima)
envmap_split_ima(env, ibuf_ima);
else
env->ok= 0;
@@ -692,21 +699,21 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
}
}
- if(env->ok==0) {
+ if (env->ok==0) {
texres->tin= 0.0;
return 0;
}
/* rotate to envmap space, if object is set */
copy_v3_v3(vec, texvec);
- if(env->object) mul_m3_v3(env->obimat, vec);
+ if (env->object) mul_m3_v3(env->obimat, vec);
else mul_mat3_m4_v3(R.viewinv, vec);
face= envcube_isect(env, vec, sco);
ibuf= env->cube[face];
- if(osatex) {
- if(env->object) {
+ if (osatex) {
+ if (env->object) {
mul_m3_v3(env->obimat, dxt);
mul_m3_v3(env->obimat, dyt);
}
@@ -719,7 +726,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
/* edges? */
- if(texres->ta<1.0f) {
+ if (texres->ta<1.0f) {
TexResult texr1, texr2;
texr1.nor= texr2.nor= NULL;
@@ -729,7 +736,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
face1= envcube_isect(env, vec, sco);
sub_v3_v3(vec, dxt);
- if(face!=face1) {
+ if (face!=face1) {
ibuf= env->cube[face1];
set_dxtdyt(dxts, dyts, dxt, dyt, face1);
imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, &texr1);
@@ -742,7 +749,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
face1= envcube_isect(env, vec, sco);
sub_v3_v3(vec, dyt);
- if(face!=face1) {
+ if (face!=face1) {
ibuf= env->cube[face1];
set_dxtdyt(dxts, dyts, dxt, dyt, face1);
imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, &texr2);
@@ -750,7 +757,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
else texr2.tr= texr2.tg= texr2.tb= texr2.ta= 0.0;
fac= (texres->ta+texr1.ta+texr2.ta);
- if(fac!=0.0f) {
+ if (fac!=0.0f) {
fac= 1.0f/fac;
texres->tr= fac*(texres->ta*texres->tr + texr1.ta*texr1.tr + texr2.ta*texr2.tr );
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 335de2dd055..ea352a16934 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -42,6 +42,7 @@
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BKE_global.h"
#include "BKE_report.h"
#include "BKE_scene.h"
@@ -90,13 +91,13 @@ void RE_engines_exit(void)
{
RenderEngineType *type, *next;
- for(type=R_engines.first; type; type=next) {
+ for (type=R_engines.first; type; type=next) {
next= type->next;
BLI_remlink(&R_engines, type);
- if(!(type->flag & RE_INTERNAL)) {
- if(type->ext.free)
+ if (!(type->flag & RE_INTERNAL)) {
+ if (type->ext.free)
type->ext.free(type->ext.data);
MEM_freeN(type);
@@ -109,7 +110,7 @@ RenderEngineType *RE_engines_find(const char *idname)
RenderEngineType *type;
type= BLI_findstring(&R_engines, idname, offsetof(RenderEngineType, idname));
- if(!type)
+ if (!type)
type= &internal_render_type;
return type;
@@ -134,12 +135,12 @@ RenderEngine *RE_engine_create(RenderEngineType *type)
void RE_engine_free(RenderEngine *engine)
{
#ifdef WITH_PYTHON
- if(engine->py_instance) {
+ if (engine->py_instance) {
BPY_DECREF(engine->py_instance);
}
#endif
- if(engine->text)
+ if (engine->text)
MEM_freeN(engine->text);
MEM_freeN(engine);
@@ -159,16 +160,16 @@ RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w,
CLAMP(w, 0, re->result->rectx);
CLAMP(h, 0, re->result->recty);
- if(x + w > re->result->rectx)
+ if (x + w > re->result->rectx)
w= re->result->rectx - x;
- if(y + h > re->result->recty)
+ if (y + h > re->result->recty)
h= re->result->recty - y;
/* allocate a render result */
- disprect.xmin= x;
- disprect.xmax= x+w;
- disprect.ymin= y;
- disprect.ymax= y+h;
+ disprect.xmin = x;
+ disprect.xmax = x+w;
+ disprect.ymin = y;
+ disprect.ymax = y+h;
result= render_result_new(re, &disprect, 0, RR_USE_MEM);
BLI_addtail(&engine->fullresult, result);
@@ -185,7 +186,7 @@ void RE_engine_update_result(RenderEngine *engine, RenderResult *result)
{
Render *re= engine->re;
- if(result) {
+ if (result) {
result->renlay= result->layers.first; // weak, draws first layer always
re->display_draw(re->ddh, result, NULL);
}
@@ -195,15 +196,15 @@ void RE_engine_end_result(RenderEngine *engine, RenderResult *result)
{
Render *re= engine->re;
- if(!result)
+ if (!result)
return;
/* merge. on break, don't merge in result for preview renders, looks nicer */
- if(!(re->test_break(re->tbh) && (re->r.scemode & R_PREVIEWBUTS)))
+ if (!(re->test_break(re->tbh) && (re->r.scemode & R_PREVIEWBUTS)))
render_result_merge(re->result, result);
/* draw */
- if(!re->test_break(re->tbh)) {
+ if (!re->test_break(re->tbh)) {
result->renlay= result->layers.first; // weak, draws first layer always
re->display_draw(re->ddh, result, NULL);
}
@@ -218,7 +219,7 @@ int RE_engine_test_break(RenderEngine *engine)
{
Render *re= engine->re;
- if(re)
+ if (re)
return re->test_break(re->tbh);
return 0;
@@ -231,7 +232,7 @@ void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char
Render *re= engine->re;
/* stats draw callback */
- if(re) {
+ if (re) {
re->i.statstr= stats;
re->i.infostr= info;
re->stats_draw(re->sdh, &re->i);
@@ -240,16 +241,16 @@ void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char
}
/* set engine text */
- if(engine->text) {
+ if (engine->text) {
MEM_freeN(engine->text);
engine->text= NULL;
}
- if(stats && stats[0] && info && info[0])
+ if (stats && stats[0] && info && info[0])
engine->text= BLI_sprintfN("%s | %s", stats, info);
- else if(info && info[0])
+ else if (info && info[0])
engine->text= BLI_strdup(info);
- else if(stats && stats[0])
+ else if (stats && stats[0])
engine->text= BLI_strdup(stats);
}
@@ -257,7 +258,7 @@ void RE_engine_update_progress(RenderEngine *engine, float progress)
{
Render *re= engine->re;
- if(re) {
+ if (re) {
CLAMP(progress, 0.0f, 1.0f);
re->progress(re->prh, progress);
}
@@ -276,25 +277,25 @@ int RE_engine_render(Render *re, int do_all)
RenderEngine *engine;
/* verify if we can render */
- if(!type->render)
+ if (!type->render)
return 0;
- if((re->r.scemode & R_PREVIEWBUTS) && !(type->flag & RE_USE_PREVIEW))
+ if ((re->r.scemode & R_PREVIEWBUTS) && !(type->flag & RE_USE_PREVIEW))
return 0;
- if(do_all && !(type->flag & RE_USE_POSTPROCESS))
+ if (do_all && !(type->flag & RE_USE_POSTPROCESS))
return 0;
- if(!do_all && (type->flag & RE_USE_POSTPROCESS))
+ if (!do_all && (type->flag & RE_USE_POSTPROCESS))
return 0;
/* create render result */
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
- if(re->result==NULL || !(re->r.scemode & R_PREVIEWBUTS)) {
- if(re->result)
+ if (re->result==NULL || !(re->r.scemode & R_PREVIEWBUTS)) {
+ if (re->result)
render_result_free(re->result);
re->result= render_result_new(re, &re->disprect, 0, 0);
}
BLI_rw_mutex_unlock(&re->resultmutex);
- if(re->result==NULL)
+ if (re->result==NULL)
return 1;
/* set render info */
@@ -306,23 +307,26 @@ int RE_engine_render(Render *re, int do_all)
engine = RE_engine_create(type);
engine->re= re;
- if(re->flag & R_ANIMATION)
+ if (re->flag & R_ANIMATION)
engine->flag |= RE_ENGINE_ANIMATION;
- if(re->r.scemode & R_PREVIEWBUTS)
+ if (re->r.scemode & R_PREVIEWBUTS)
engine->flag |= RE_ENGINE_PREVIEW;
- if((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0)
+ if ((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0)
scene_update_for_newframe(re->main, re->scene, re->lay);
- if(type->update)
+ if (type->update)
type->update(engine, re->main, re->scene);
- if(type->render)
+ if (type->render)
type->render(engine, re->scene);
render_result_free_list(&engine->fullresult, engine->fullresult.first);
RE_engine_free(engine);
+ if (BKE_reports_contain(re->reports, RPT_ERROR))
+ G.afbreek = 1;
+
return 1;
}
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 4a6558474f0..260a2de4858 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -85,12 +85,12 @@ static void ibuf_get_color(float *col, struct ImBuf *ibuf, int x, int y)
{
int ofs = y * ibuf->x + x;
- if(ibuf->rect_float) {
- if(ibuf->channels==4) {
+ if (ibuf->rect_float) {
+ if (ibuf->channels==4) {
float *fp= ibuf->rect_float + 4*ofs;
copy_v4_v4(col, fp);
}
- else if(ibuf->channels==3) {
+ else if (ibuf->channels==3) {
float *fp= ibuf->rect_float + 3*ofs;
copy_v3_v3(col, fp);
col[3]= 1.0f;
@@ -122,23 +122,23 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
retval= texres->nor?3:1;
/* quick tests */
- if(ibuf==NULL && ima==NULL)
+ if (ibuf==NULL && ima==NULL)
return retval;
- if(ima) {
+ if (ima) {
/* hack for icon render */
- if(ima->ibufs.first==NULL && (R.r.scemode & R_NO_IMAGE_LOAD))
+ if (ima->ibufs.first==NULL && (R.r.scemode & R_NO_IMAGE_LOAD))
return retval;
ibuf= BKE_image_get_ibuf(ima, &tex->iuser);
ima->flag|= IMA_USED_FOR_RENDER;
}
- if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
+ if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
return retval;
/* setup mapping */
- if(tex->imaflag & TEX_IMAROT) {
+ if (tex->imaflag & TEX_IMAROT) {
fy= texvec[0];
fx= texvec[1];
}
@@ -147,7 +147,7 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
fy= texvec[1];
}
- if(tex->extend == TEX_CHECKER) {
+ if (tex->extend == TEX_CHECKER) {
int xs, ys;
xs= (int)floor(fx);
@@ -155,14 +155,14 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
fx-= xs;
fy-= ys;
- if( (tex->flag & TEX_CHECKER_ODD)==0) {
- if((xs+ys) & 1);else return retval;
+ if ( (tex->flag & TEX_CHECKER_ODD)==0) {
+ if ((xs+ys) & 1);else return retval;
}
- if( (tex->flag & TEX_CHECKER_EVEN)==0) {
- if((xs+ys) & 1) return retval;
+ if ( (tex->flag & TEX_CHECKER_EVEN)==0) {
+ if ((xs+ys) & 1) return retval;
}
/* scale around center, (0.5, 0.5) */
- if(tex->checkerdist<1.0f) {
+ if (tex->checkerdist<1.0f) {
fx= (fx-0.5f)/(1.0f-tex->checkerdist) +0.5f;
fy= (fy-0.5f)/(1.0f-tex->checkerdist) +0.5f;
}
@@ -171,37 +171,37 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
x= xi= (int)floorf(fx*ibuf->x);
y= yi= (int)floorf(fy*ibuf->y);
- if(tex->extend == TEX_CLIPCUBE) {
- if(x<0 || y<0 || x>=ibuf->x || y>=ibuf->y || texvec[2]<-1.0f || texvec[2]>1.0f) {
+ if (tex->extend == TEX_CLIPCUBE) {
+ if (x<0 || y<0 || x>=ibuf->x || y>=ibuf->y || texvec[2]<-1.0f || texvec[2]>1.0f) {
return retval;
}
}
- else if( tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
- if(x<0 || y<0 || x>=ibuf->x || y>=ibuf->y) {
+ else if ( tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
+ if (x<0 || y<0 || x>=ibuf->x || y>=ibuf->y) {
return retval;
}
}
else {
- if(tex->extend==TEX_EXTEND) {
- if(x>=ibuf->x) x = ibuf->x-1;
- else if(x<0) x= 0;
+ if (tex->extend==TEX_EXTEND) {
+ if (x>=ibuf->x) x = ibuf->x-1;
+ else if (x<0) x= 0;
}
else {
x= x % ibuf->x;
- if(x<0) x+= ibuf->x;
+ if (x<0) x+= ibuf->x;
}
- if(tex->extend==TEX_EXTEND) {
- if(y>=ibuf->y) y = ibuf->y-1;
- else if(y<0) y= 0;
+ if (tex->extend==TEX_EXTEND) {
+ if (y>=ibuf->y) y = ibuf->y-1;
+ else if (y<0) y= 0;
}
else {
y= y % ibuf->y;
- if(y<0) y+= ibuf->y;
+ if (y<0) y+= ibuf->y;
}
}
/* warning, no return before setting back! */
- if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
+ if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
ibuf->rect+= (ibuf->x*ibuf->y);
}
@@ -230,12 +230,12 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
ibuf_get_color(&texres->tr, ibuf, x, y);
}
- if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
+ if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
ibuf->rect-= (ibuf->x*ibuf->y);
}
- if(texres->nor) {
- if(tex->imaflag & TEX_NORMALMAP) {
+ if (texres->nor) {
+ if (tex->imaflag & TEX_NORMALMAP) {
// qdn: normal from color
// The invert of the red channel is to make
// the normal map compliant with the outside world.
@@ -251,14 +251,14 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
/* bump: take three samples */
val1= texres->tr+texres->tg+texres->tb;
- if(x<ibuf->x-1) {
+ if (x<ibuf->x-1) {
float col[4];
ibuf_get_color(col, ibuf, x+1, y);
val2= (col[0]+col[1]+col[2]);
}
else val2= val1;
- if(y<ibuf->y-1) {
+ if (y<ibuf->y-1) {
float col[4];
ibuf_get_color(col, ibuf, x, y+1);
val3= (col[0]+col[1]+col[2]);
@@ -271,16 +271,16 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
}
}
- if(texres->talpha) texres->tin= texres->ta;
- else if(tex->imaflag & TEX_CALCALPHA) {
+ if (texres->talpha) texres->tin= texres->ta;
+ else if (tex->imaflag & TEX_CALCALPHA) {
texres->ta= texres->tin= MAX3(texres->tr, texres->tg, texres->tb);
}
else texres->ta= texres->tin= 1.0;
- if(tex->flag & TEX_NEGALPHA) texres->ta= 1.0f-texres->ta;
+ if (tex->flag & TEX_NEGALPHA) texres->ta= 1.0f-texres->ta;
/* de-premul, this is being premulled in shade_input_do_shade() */
- if(texres->ta!=1.0f && texres->ta>1e-4f) {
+ if (texres->ta!=1.0f && texres->ta>1e-4f) {
fx= 1.0f/texres->ta;
texres->tr*= fx;
texres->tg*= fx;
@@ -299,45 +299,45 @@ static void clipx_rctf_swap(rctf *stack, short *count, float x1, float x2)
a= *count;
rf= stack;
- for(;a>0;a--) {
- if(rf->xmin<x1) {
- if(rf->xmax<x1) {
+ for (;a>0;a--) {
+ if (rf->xmin<x1) {
+ if (rf->xmax<x1) {
rf->xmin+= (x2-x1);
rf->xmax+= (x2-x1);
}
else {
- if(rf->xmax>x2) rf->xmax= x2;
+ if (rf->xmax>x2) rf->xmax = x2;
newrct= stack+ *count;
(*count)++;
- newrct->xmax= x2;
- newrct->xmin= rf->xmin+(x2-x1);
- newrct->ymin= rf->ymin;
- newrct->ymax= rf->ymax;
+ newrct->xmax = x2;
+ newrct->xmin = rf->xmin+(x2-x1);
+ newrct->ymin = rf->ymin;
+ newrct->ymax = rf->ymax;
- if(newrct->xmin==newrct->xmax) (*count)--;
+ if (newrct->xmin ==newrct->xmax) (*count)--;
- rf->xmin= x1;
+ rf->xmin = x1;
}
}
- else if(rf->xmax>x2) {
- if(rf->xmin>x2) {
+ else if (rf->xmax>x2) {
+ if (rf->xmin>x2) {
rf->xmin-= (x2-x1);
rf->xmax-= (x2-x1);
}
else {
- if(rf->xmin<x1) rf->xmin= x1;
+ if (rf->xmin<x1) rf->xmin = x1;
newrct= stack+ *count;
(*count)++;
- newrct->xmin= x1;
- newrct->xmax= rf->xmax-(x2-x1);
- newrct->ymin= rf->ymin;
- newrct->ymax= rf->ymax;
+ newrct->xmin = x1;
+ newrct->xmax = rf->xmax-(x2-x1);
+ newrct->ymin = rf->ymin;
+ newrct->ymax = rf->ymax;
- if(newrct->xmin==newrct->xmax) (*count)--;
+ if (newrct->xmin ==newrct->xmax) (*count)--;
- rf->xmax= x2;
+ rf->xmax = x2;
}
}
rf++;
@@ -352,45 +352,45 @@ static void clipy_rctf_swap(rctf *stack, short *count, float y1, float y2)
a= *count;
rf= stack;
- for(;a>0;a--) {
- if(rf->ymin<y1) {
- if(rf->ymax<y1) {
+ for (;a>0;a--) {
+ if (rf->ymin<y1) {
+ if (rf->ymax<y1) {
rf->ymin+= (y2-y1);
rf->ymax+= (y2-y1);
}
else {
- if(rf->ymax>y2) rf->ymax= y2;
+ if (rf->ymax>y2) rf->ymax = y2;
newrct= stack+ *count;
(*count)++;
- newrct->ymax= y2;
- newrct->ymin= rf->ymin+(y2-y1);
- newrct->xmin= rf->xmin;
- newrct->xmax= rf->xmax;
+ newrct->ymax = y2;
+ newrct->ymin = rf->ymin+(y2-y1);
+ newrct->xmin = rf->xmin;
+ newrct->xmax = rf->xmax;
- if(newrct->ymin==newrct->ymax) (*count)--;
+ if (newrct->ymin==newrct->ymax) (*count)--;
- rf->ymin= y1;
+ rf->ymin = y1;
}
}
- else if(rf->ymax>y2) {
- if(rf->ymin>y2) {
+ else if (rf->ymax>y2) {
+ if (rf->ymin>y2) {
rf->ymin-= (y2-y1);
rf->ymax-= (y2-y1);
}
else {
- if(rf->ymin<y1) rf->ymin= y1;
+ if (rf->ymin<y1) rf->ymin = y1;
newrct= stack+ *count;
(*count)++;
- newrct->ymin= y1;
- newrct->ymax= rf->ymax-(y2-y1);
- newrct->xmin= rf->xmin;
- newrct->xmax= rf->xmax;
+ newrct->ymin = y1;
+ newrct->ymax = rf->ymax-(y2-y1);
+ newrct->xmin = rf->xmin;
+ newrct->xmax = rf->xmax;
- if(newrct->ymin==newrct->ymax) (*count)--;
+ if (newrct->ymin==newrct->ymax) (*count)--;
- rf->ymax= y2;
+ rf->ymax = y2;
}
}
rf++;
@@ -412,17 +412,17 @@ static float clipx_rctf(rctf *rf, float x1, float x2)
size= rf->xmax - rf->xmin;
- if(rf->xmin<x1) {
- rf->xmin= x1;
+ if (rf->xmin<x1) {
+ rf->xmin = x1;
}
- if(rf->xmax>x2) {
- rf->xmax= x2;
+ if (rf->xmax>x2) {
+ rf->xmax = x2;
}
- if(rf->xmin > rf->xmax) {
+ if (rf->xmin > rf->xmax) {
rf->xmin = rf->xmax;
return 0.0;
}
- else if(size!=0.0f) {
+ else if (size!=0.0f) {
return (rf->xmax - rf->xmin)/size;
}
return 1.0;
@@ -434,18 +434,18 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
size= rf->ymax - rf->ymin;
- if(rf->ymin<y1) {
- rf->ymin= y1;
+ if (rf->ymin<y1) {
+ rf->ymin = y1;
}
- if(rf->ymax>y2) {
- rf->ymax= y2;
+ if (rf->ymax>y2) {
+ rf->ymax = y2;
}
- if(rf->ymin > rf->ymax) {
+ if (rf->ymin > rf->ymax) {
rf->ymin = rf->ymax;
return 0.0;
}
- else if(size!=0.0f) {
+ else if (size!=0.0f) {
return (rf->ymax - rf->ymin)/size;
}
return 1.0;
@@ -465,27 +465,27 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
starty= (int)floor(rf->ymin);
endy= (int)floor(rf->ymax);
- if(startx < 0) startx= 0;
- if(starty < 0) starty= 0;
- if(endx>=ibuf->x) endx= ibuf->x-1;
- if(endy>=ibuf->y) endy= ibuf->y-1;
+ if (startx < 0) startx= 0;
+ if (starty < 0) starty= 0;
+ if (endx>=ibuf->x) endx= ibuf->x-1;
+ if (endy>=ibuf->y) endy= ibuf->y-1;
- if(starty==endy && startx==endx) {
+ if (starty==endy && startx==endx) {
ibuf_get_color(&texres->tr, ibuf, startx, starty);
}
else {
div= texres->tr= texres->tg= texres->tb= texres->ta= 0.0;
- for(y=starty; y<=endy; y++) {
+ for (y=starty; y<=endy; y++) {
muly= 1.0;
- if(starty==endy);
+ if (starty==endy);
else {
- if(y==starty) muly= 1.0f-(rf->ymin - y);
- if(y==endy) muly= (rf->ymax - y);
+ if (y==starty) muly= 1.0f-(rf->ymin - y);
+ if (y==endy) muly= (rf->ymax - y);
}
- if(startx==endx) {
+ if (startx==endx) {
mulx= muly;
ibuf_get_color(col, ibuf, startx, y);
@@ -497,14 +497,14 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
div+= mulx;
}
else {
- for(x=startx; x<=endx; x++) {
+ for (x=startx; x<=endx; x++) {
mulx= muly;
- if(x==startx) mulx*= 1.0f-(rf->xmin - x);
- if(x==endx) mulx*= (rf->xmax - x);
+ if (x==startx) mulx*= 1.0f-(rf->xmin - x);
+ if (x==endx) mulx*= (rf->xmax - x);
ibuf_get_color(col, ibuf, x, y);
- if(mulx==1.0f) {
+ if (mulx==1.0f) {
texres->ta+= col[3];
texres->tr+= col[0];
texres->tg+= col[1];
@@ -522,7 +522,7 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
}
}
- if(div!=0.0f) {
+ if (div!=0.0f) {
div= 1.0f/div;
texres->tb*= div;
texres->tg*= div;
@@ -542,7 +542,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
* If variable 'imaprepeat' has been set, the
* clipped-away parts are sampled as well.
*/
- /* note: actually minx etc isnt in the proper range... this due to filter size and offset vectors for bump */
+ /* note: actually minx etc isn't in the proper range... this due to filter size and offset vectors for bump */
/* note: talpha must be initialized */
/* note: even when 'imaprepeat' is set, this can only repeate once in any direction.
* the point which min/max is derived from is assumed to be wrapped */
@@ -552,46 +552,46 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
short count=1;
rf= stack;
- rf->xmin= minx*(ibuf->x);
- rf->xmax= maxx*(ibuf->x);
- rf->ymin= miny*(ibuf->y);
- rf->ymax= maxy*(ibuf->y);
+ rf->xmin = minx*(ibuf->x);
+ rf->xmax = maxx*(ibuf->x);
+ rf->ymin = miny*(ibuf->y);
+ rf->ymax = maxy*(ibuf->y);
texr.talpha= texres->talpha; /* is read by boxsample_clip */
- if(imapextend) {
+ if (imapextend) {
CLAMP(rf->xmin, 0.0f, ibuf->x-1);
CLAMP(rf->xmax, 0.0f, ibuf->x-1);
}
- else if(imaprepeat)
+ else if (imaprepeat)
clipx_rctf_swap(stack, &count, 0.0, (float)(ibuf->x));
else {
alphaclip= clipx_rctf(rf, 0.0, (float)(ibuf->x));
- if(alphaclip<=0.0f) {
+ if (alphaclip<=0.0f) {
texres->tr= texres->tb= texres->tg= texres->ta= 0.0;
return;
}
}
- if(imapextend) {
+ if (imapextend) {
CLAMP(rf->ymin, 0.0f, ibuf->y-1);
CLAMP(rf->ymax, 0.0f, ibuf->y-1);
}
- else if(imaprepeat)
+ else if (imaprepeat)
clipy_rctf_swap(stack, &count, 0.0, (float)(ibuf->y));
else {
alphaclip*= clipy_rctf(rf, 0.0, (float)(ibuf->y));
- if(alphaclip<=0.0f) {
+ if (alphaclip<=0.0f) {
texres->tr= texres->tb= texres->tg= texres->ta= 0.0;
return;
}
}
- if(count>1) {
+ if (count>1) {
tot= texres->tr= texres->tb= texres->tg= texres->ta= 0.0;
- while(count--) {
+ while (count--) {
boxsampleclip(ibuf, rf, &texr);
opp= square_rctf(rf);
@@ -600,22 +600,22 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
texres->tr+= opp*texr.tr;
texres->tg+= opp*texr.tg;
texres->tb+= opp*texr.tb;
- if(texres->talpha) texres->ta+= opp*texr.ta;
+ if (texres->talpha) texres->ta+= opp*texr.ta;
rf++;
}
- if(tot!= 0.0f) {
+ if (tot!= 0.0f) {
texres->tr/= tot;
texres->tg/= tot;
texres->tb/= tot;
- if(texres->talpha) texres->ta/= tot;
+ if (texres->talpha) texres->ta/= tot;
}
}
else
boxsampleclip(ibuf, rf, texres);
- if(texres->talpha==0) texres->ta= 1.0;
+ if (texres->talpha==0) texres->ta= 1.0;
- if(alphaclip!=1.0f) {
+ if (alphaclip!=1.0f) {
/* premul it all */
texres->tr*= alphaclip;
texres->tg*= alphaclip;
@@ -978,17 +978,17 @@ static void alpha_clip_aniso(ImBuf *ibuf, float minx, float miny, float maxx, fl
// TXF apha: we're doing the same alphaclip here as boxsample, but i'm doubting
// if this is actually correct for the all the filtering algorithms ..
- if(!(extflag == TXC_REPT || extflag == TXC_EXTD)) {
- rf.xmin= minx*(ibuf->x);
- rf.xmax= maxx*(ibuf->x);
- rf.ymin= miny*(ibuf->y);
- rf.ymax= maxy*(ibuf->y);
+ if (!(extflag == TXC_REPT || extflag == TXC_EXTD)) {
+ rf.xmin = minx*(ibuf->x);
+ rf.xmax = maxx*(ibuf->x);
+ rf.ymin = miny*(ibuf->y);
+ rf.ymax = maxy*(ibuf->y);
alphaclip = clipx_rctf(&rf, 0.0, (float)(ibuf->x));
alphaclip*= clipy_rctf(&rf, 0.0, (float)(ibuf->y));
alphaclip= MAX2(alphaclip, 0.0f);
- if(alphaclip!=1.0f) {
+ if (alphaclip!=1.0f) {
/* premul it all */
texres->tr*= alphaclip;
texres->tg*= alphaclip;
@@ -1213,9 +1213,9 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
// brecht: added stupid clamping here, large dx/dy can give very large
// filter sizes which take ages to render, it may be better to do this
// more intelligently later in the code .. probably it's not noticeable
- if(AFD.dxt[0]*AFD.dxt[0] + AFD.dxt[1]*AFD.dxt[1] > 2.0f*2.0f)
+ if (AFD.dxt[0]*AFD.dxt[0] + AFD.dxt[1]*AFD.dxt[1] > 2.0f*2.0f)
mul_v2_fl(AFD.dxt, 2.0f/len_v2(AFD.dxt));
- if(AFD.dyt[0]*AFD.dyt[0] + AFD.dyt[1]*AFD.dyt[1] > 2.0f*2.0f)
+ if (AFD.dyt[0]*AFD.dyt[0] + AFD.dyt[1]*AFD.dyt[1] > 2.0f*2.0f)
mul_v2_fl(AFD.dyt, 2.0f/len_v2(AFD.dyt));
// choice:
@@ -1434,32 +1434,32 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
retval= texres->nor?3:1;
/* quick tests */
- if(ibuf==NULL && ima==NULL)
+ if (ibuf==NULL && ima==NULL)
return retval;
- if(ima) {
+ if (ima) {
/* hack for icon render */
- if(ima->ibufs.first==NULL && (R.r.scemode & R_NO_IMAGE_LOAD))
+ if (ima->ibufs.first==NULL && (R.r.scemode & R_NO_IMAGE_LOAD))
return retval;
ibuf= BKE_image_get_ibuf(ima, &tex->iuser);
ima->flag|= IMA_USED_FOR_RENDER;
}
- if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
+ if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
return retval;
/* mipmap test */
image_mipmap_test(tex, ibuf);
- if(tex->imaflag & TEX_USEALPHA) {
- if(tex->imaflag & TEX_CALCALPHA);
+ if (tex->imaflag & TEX_USEALPHA) {
+ if (tex->imaflag & TEX_CALCALPHA);
else texres->talpha= 1;
}
texr.talpha= texres->talpha;
- if(tex->imaflag & TEX_IMAROT) {
+ if (tex->imaflag & TEX_IMAROT) {
fy= texvec[0];
fx= texvec[1];
}
@@ -1468,9 +1468,9 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
fy= texvec[1];
}
- if(ibuf->flags & IB_fields) {
- if(R.r.mode & R_FIELDS) { /* field render */
- if(R.flag & R_SEC_FIELD) { /* correction for 2nd field */
+ if (ibuf->flags & IB_fields) {
+ if (R.r.mode & R_FIELDS) { /* field render */
+ if (R.flag & R_SEC_FIELD) { /* correction for 2nd field */
/* fac1= 0.5/( (float)ibuf->y ); */
/* fy-= fac1; */
}
@@ -1491,16 +1491,16 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
minx= (maxx-minx)/2.0f;
miny= (maxy-miny)/2.0f;
- if(tex->imaflag & TEX_FILTER_MIN) {
+ if (tex->imaflag & TEX_FILTER_MIN) {
/* make sure the filtersize is minimal in pixels (normal, ref map can have miniature pixel dx/dy) */
float addval= (0.5f * tex->filtersize) / (float) MIN2(ibuf->x, ibuf->y);
- if(addval > minx)
+ if (addval > minx)
minx= addval;
- if(addval > miny)
+ if (addval > miny)
miny= addval;
}
- else if(tex->filtersize!=1.0f) {
+ else if (tex->filtersize!=1.0f) {
minx*= tex->filtersize;
miny*= tex->filtersize;
@@ -1510,33 +1510,33 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
dyt[1]*= tex->filtersize;
}
- if(tex->imaflag & TEX_IMAROT) SWAP(float, minx, miny);
+ if (tex->imaflag & TEX_IMAROT) SWAP(float, minx, miny);
- if(minx>0.25f) minx= 0.25f;
- else if(minx<0.00001f) minx= 0.00001f; /* side faces of unit-cube */
- if(miny>0.25f) miny= 0.25f;
- else if(miny<0.00001f) miny= 0.00001f;
+ if (minx>0.25f) minx= 0.25f;
+ else if (minx<0.00001f) minx= 0.00001f; /* side faces of unit-cube */
+ if (miny>0.25f) miny= 0.25f;
+ else if (miny<0.00001f) miny= 0.00001f;
/* repeat and clip */
imaprepeat= (tex->extend==TEX_REPEAT);
imapextend= (tex->extend==TEX_EXTEND);
- if(tex->extend == TEX_REPEAT) {
- if(tex->flag & (TEX_REPEAT_XMIR|TEX_REPEAT_YMIR)) {
+ if (tex->extend == TEX_REPEAT) {
+ if (tex->flag & (TEX_REPEAT_XMIR|TEX_REPEAT_YMIR)) {
imaprepeat= 0;
imapextend= 1;
}
}
- if(tex->extend == TEX_CHECKER) {
+ if (tex->extend == TEX_CHECKER) {
int xs, ys, xs1, ys1, xs2, ys2, boundary;
xs= (int)floor(fx);
ys= (int)floor(fy);
// both checkers available, no boundary exceptions, checkerdist will eat aliasing
- if( (tex->flag & TEX_CHECKER_ODD) && (tex->flag & TEX_CHECKER_EVEN) ) {
+ if ( (tex->flag & TEX_CHECKER_ODD) && (tex->flag & TEX_CHECKER_EVEN) ) {
fx-= xs;
fy-= ys;
}
@@ -1548,37 +1548,37 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
ys2= (int)floor(fy+miny);
boundary= (xs1!=xs2) || (ys1!=ys2);
- if(boundary==0) {
- if( (tex->flag & TEX_CHECKER_ODD)==0) {
- if((xs+ys) & 1);
+ if (boundary==0) {
+ if ( (tex->flag & TEX_CHECKER_ODD)==0) {
+ if ((xs+ys) & 1);
else return retval;
}
- if( (tex->flag & TEX_CHECKER_EVEN)==0) {
- if((xs+ys) & 1) return retval;
+ if ( (tex->flag & TEX_CHECKER_EVEN)==0) {
+ if ((xs+ys) & 1) return retval;
}
fx-= xs;
fy-= ys;
}
else {
- if(tex->flag & TEX_CHECKER_ODD) {
- if((xs1+ys) & 1) fx-= xs2;
+ if (tex->flag & TEX_CHECKER_ODD) {
+ if ((xs1+ys) & 1) fx-= xs2;
else fx-= xs1;
- if((ys1+xs) & 1) fy-= ys2;
+ if ((ys1+xs) & 1) fy-= ys2;
else fy-= ys1;
}
- if(tex->flag & TEX_CHECKER_EVEN) {
- if((xs1+ys) & 1) fx-= xs1;
+ if (tex->flag & TEX_CHECKER_EVEN) {
+ if ((xs1+ys) & 1) fx-= xs1;
else fx-= xs2;
- if((ys1+xs) & 1) fy-= ys1;
+ if ((ys1+xs) & 1) fy-= ys1;
else fy-= ys2;
}
}
}
/* scale around center, (0.5, 0.5) */
- if(tex->checkerdist<1.0f) {
+ if (tex->checkerdist<1.0f) {
fx= (fx-0.5f)/(1.0f-tex->checkerdist) +0.5f;
fy= (fy-0.5f)/(1.0f-tex->checkerdist) +0.5f;
minx/= (1.0f-tex->checkerdist);
@@ -1586,74 +1586,74 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
}
}
- if(tex->extend == TEX_CLIPCUBE) {
- if(fx+minx<0.0f || fy+miny<0.0f || fx-minx>1.0f || fy-miny>1.0f || texvec[2]<-1.0f || texvec[2]>1.0f) {
+ if (tex->extend == TEX_CLIPCUBE) {
+ if (fx+minx<0.0f || fy+miny<0.0f || fx-minx>1.0f || fy-miny>1.0f || texvec[2]<-1.0f || texvec[2]>1.0f) {
return retval;
}
}
- else if(tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
- if(fx+minx<0.0f || fy+miny<0.0f || fx-minx>1.0f || fy-miny>1.0f) {
+ else if (tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
+ if (fx+minx<0.0f || fy+miny<0.0f || fx-minx>1.0f || fy-miny>1.0f) {
return retval;
}
}
else {
- if(imapextend) {
- if(fx>1.0f) fx = 1.0f;
- else if(fx<0.0f) fx= 0.0f;
+ if (imapextend) {
+ if (fx>1.0f) fx = 1.0f;
+ else if (fx<0.0f) fx= 0.0f;
}
else {
- if(fx>1.0f) fx -= (int)(fx);
- else if(fx<0.0f) fx+= 1-(int)(fx);
+ if (fx>1.0f) fx -= (int)(fx);
+ else if (fx<0.0f) fx+= 1-(int)(fx);
}
- if(imapextend) {
- if(fy>1.0f) fy = 1.0f;
- else if(fy<0.0f) fy= 0.0f;
+ if (imapextend) {
+ if (fy>1.0f) fy = 1.0f;
+ else if (fy<0.0f) fy= 0.0f;
}
else {
- if(fy>1.0f) fy -= (int)(fy);
- else if(fy<0.0f) fy+= 1-(int)(fy);
+ if (fy>1.0f) fy -= (int)(fy);
+ else if (fy<0.0f) fy+= 1-(int)(fy);
}
}
/* warning no return! */
- if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
+ if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
ibuf->rect+= (ibuf->x*ibuf->y);
}
/* choice: */
- if(tex->imaflag & TEX_MIPMAP) {
+ if (tex->imaflag & TEX_MIPMAP) {
ImBuf *previbuf, *curibuf;
float bumpscale;
dx= minx;
dy= miny;
maxd= MAX2(dx, dy);
- if(maxd>0.5f) maxd= 0.5f;
+ if (maxd>0.5f) maxd= 0.5f;
pixsize = 1.0f/ (float) MIN2(ibuf->x, ibuf->y);
bumpscale= pixsize/maxd;
- if(bumpscale>1.0f) bumpscale= 1.0f;
+ if (bumpscale>1.0f) bumpscale= 1.0f;
else bumpscale*=bumpscale;
curmap= 0;
previbuf= curibuf= ibuf;
- while(curmap<IB_MIPMAP_LEVELS && ibuf->mipmap[curmap]) {
- if(maxd < pixsize) break;
+ while (curmap<IB_MIPMAP_LEVELS && ibuf->mipmap[curmap]) {
+ if (maxd < pixsize) break;
previbuf= curibuf;
curibuf= ibuf->mipmap[curmap];
pixsize= 1.0f / (float)MIN2(curibuf->x, curibuf->y);
curmap++;
}
- if(previbuf!=curibuf || (tex->imaflag & TEX_INTERPOL)) {
+ if (previbuf!=curibuf || (tex->imaflag & TEX_INTERPOL)) {
/* sample at least 1 pixel */
if (minx < 0.5f / ibuf->x) minx = 0.5f / ibuf->x;
if (miny < 0.5f / ibuf->y) miny = 0.5f / ibuf->y;
}
- if(texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) {
+ if (texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) {
/* a bit extra filter */
//minx*= 1.35f;
//miny*= 1.35f;
@@ -1669,13 +1669,13 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
texres->nor[0]= (val1-val2);
texres->nor[1]= (val1-val3);
- if(previbuf!=curibuf) { /* interpolate */
+ if (previbuf!=curibuf) { /* interpolate */
boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend);
/* calc rgb */
dx= 2.0f*(pixsize-maxd)/pixsize;
- if(dx>=1.0f) {
+ if (dx>=1.0f) {
texres->ta= texr.ta; texres->tb= texr.tb;
texres->tg= texr.tg; texres->tr= texr.tr;
}
@@ -1696,7 +1696,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
texres->nor[0]= (val1-val2); /* vals have been interpolated above! */
texres->nor[1]= (val1-val3);
- if(dx<1.0f) {
+ if (dx<1.0f) {
dy= 1.0f-dx;
texres->tb= dy*texres->tb+ dx*texr.tb;
texres->tg= dy*texres->tg+ dx*texr.tg;
@@ -1715,15 +1715,16 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend);
- if(previbuf!=curibuf) { /* interpolate */
+ if (previbuf!=curibuf) { /* interpolate */
boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend);
fx= 2.0f*(pixsize-maxd)/pixsize;
- if(fx>=1.0f) {
+ if (fx>=1.0f) {
texres->ta= texr.ta; texres->tb= texr.tb;
texres->tg= texr.tg; texres->tr= texr.tr;
- } else {
+ }
+ else {
fy= 1.0f-fx;
texres->tb= fy*texres->tb+ fx*texr.tb;
texres->tg= fy*texres->tg+ fx*texr.tg;
@@ -1741,7 +1742,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
if (miny < 0.5f / ibuf->y) miny = 0.5f / ibuf->y;
}
- if(texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) {
+ if (texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) {
boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend);
val1= texres->tr+texres->tg+texres->tb;
boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend);
@@ -1757,18 +1758,18 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend);
}
- if(tex->imaflag & TEX_CALCALPHA) {
+ if (tex->imaflag & TEX_CALCALPHA) {
texres->ta= texres->tin= texres->ta*MAX3(texres->tr, texres->tg, texres->tb);
}
else texres->tin= texres->ta;
- if(tex->flag & TEX_NEGALPHA) texres->ta= 1.0f-texres->ta;
+ if (tex->flag & TEX_NEGALPHA) texres->ta= 1.0f-texres->ta;
- if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
+ if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
ibuf->rect-= (ibuf->x*ibuf->y);
}
- if(texres->nor && (tex->imaflag & TEX_NORMALMAP)) {
+ if (texres->nor && (tex->imaflag & TEX_NORMALMAP)) {
// qdn: normal from color
// The invert of the red channel is to make
// the normal map compliant with the outside world.
@@ -1782,7 +1783,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
}
/* de-premul, this is being premulled in shade_input_do_shade() */
- if(texres->ta!=1.0f && texres->ta>1e-4f) {
+ if (texres->ta!=1.0f && texres->ta>1e-4f) {
fx= 1.0f/texres->ta;
texres->tr*= fx;
texres->tg*= fx;
@@ -1799,12 +1800,12 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res
TexResult texres;
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- if(ibuf==NULL) {
+ if (ibuf==NULL) {
result[0]= result[1]= result[2]= result[3]= 0.0f;
return;
}
- if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
+ if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
ibuf->rect+= (ibuf->x*ibuf->y);
texres.talpha= 1; /* boxsample expects to be initialized */
@@ -1814,7 +1815,7 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res
result[2]= texres.tb;
result[3]= texres.ta;
- if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
+ if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
ibuf->rect-= (ibuf->x*ibuf->y);
ima->flag|= IMA_USED_FOR_RENDER;
@@ -1825,7 +1826,7 @@ void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *res
TexResult texres;
afdata_t AFD;
- if(ibuf==NULL) {
+ if (ibuf==NULL) {
return;
}
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index b7254cd1221..f7f592c9407 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -92,7 +92,7 @@ static void init_render_jit(Render *re)
static int lastjit= 0;
static int last_mblur_jit= 0;
- if(lastjit!=re->r.osa || last_mblur_jit != re->r.mblur_samples) {
+ if (lastjit!=re->r.osa || last_mblur_jit != re->r.mblur_samples) {
memset(jit, 0, sizeof(jit));
BLI_initjit(jit[0], re->r.osa);
@@ -169,11 +169,11 @@ float RE_filter_value(int type, float x)
switch(type) {
case R_FILTER_BOX:
- if(x>1.0f) return 0.0f;
+ if (x>1.0f) return 0.0f;
return 1.0f;
case R_FILTER_TENT:
- if(x>1.0f) return 0.0f;
+ if (x>1.0f) return 0.0f;
return 1.0f-x;
case R_FILTER_GAUSS:
@@ -200,7 +200,7 @@ static float calc_weight(Render *re, float *weight, int i, int j)
float x, y, dist, totw= 0.0;
int a;
- for(a=0; a<re->osa; a++) {
+ for (a=0; a<re->osa; a++) {
x= re->jit[a][0] + i;
y= re->jit[a][1] + j;
dist= sqrt(x*x+y*y);
@@ -210,11 +210,11 @@ static float calc_weight(Render *re, float *weight, int i, int j)
/* Weighting choices */
switch(re->r.filtertype) {
case R_FILTER_BOX:
- if(i==0 && j==0) weight[a]= 1.0;
+ if (i==0 && j==0) weight[a]= 1.0;
break;
case R_FILTER_TENT:
- if(dist < re->r.gauss)
+ if (dist < re->r.gauss)
weight[a]= re->r.gauss - dist;
break;
@@ -251,8 +251,8 @@ void free_sample_tables(Render *re)
{
int a;
- if(re->samples) {
- for(a=0; a<9; a++) {
+ if (re->samples) {
+ for (a=0; a<9; a++) {
MEM_freeN(re->samples->fmask1[a]);
MEM_freeN(re->samples->fmask2[a]);
}
@@ -273,7 +273,7 @@ void make_sample_tables(Render *re)
int i, j, a;
/* optimization tables, only once */
- if(firsttime) {
+ if (firsttime) {
firsttime= 0;
}
@@ -281,7 +281,7 @@ void make_sample_tables(Render *re)
init_render_jit(re); /* needed for mblur too */
- if(re->osa==0) {
+ if (re->osa==0) {
/* just prevents cpu cycles for larger render and copying */
re->r.filtertype= 0;
return;
@@ -289,78 +289,78 @@ void make_sample_tables(Render *re)
st= re->samples= MEM_callocN(sizeof(SampleTables), "sample tables");
- for(a=0; a<9;a++) {
+ for (a=0; a<9;a++) {
st->fmask1[a]= MEM_callocN(256*sizeof(float), "initfilt");
st->fmask2[a]= MEM_callocN(256*sizeof(float), "initfilt");
}
- for(a=0; a<256; a++) {
+ for (a=0; a<256; a++) {
st->cmask[a]= 0;
- if(a & 1) st->cmask[a]++;
- if(a & 2) st->cmask[a]++;
- if(a & 4) st->cmask[a]++;
- if(a & 8) st->cmask[a]++;
- if(a & 16) st->cmask[a]++;
- if(a & 32) st->cmask[a]++;
- if(a & 64) st->cmask[a]++;
- if(a & 128) st->cmask[a]++;
+ if (a & 1) st->cmask[a]++;
+ if (a & 2) st->cmask[a]++;
+ if (a & 4) st->cmask[a]++;
+ if (a & 8) st->cmask[a]++;
+ if (a & 16) st->cmask[a]++;
+ if (a & 32) st->cmask[a]++;
+ if (a & 64) st->cmask[a]++;
+ if (a & 128) st->cmask[a]++;
}
st->centmask= MEM_mallocN((1<<re->osa), "Initfilt3");
- for(a=0; a<16; a++) {
+ for (a=0; a<16; a++) {
st->centLut[a]= -0.45f+((float)a)/16.0f;
}
/* calculate totw */
totw= 0.0;
- for(j= -1; j<2; j++) {
- for(i= -1; i<2; i++) {
+ for (j= -1; j<2; j++) {
+ for (i= -1; i<2; i++) {
totw+= calc_weight(re, weight, i, j);
}
}
- for(j= -1; j<2; j++) {
- for(i= -1; i<2; i++) {
+ for (j= -1; j<2; j++) {
+ for (i= -1; i<2; i++) {
/* calculate using jit, with offset the weights */
memset(weight, 0, sizeof(weight));
calc_weight(re, weight, i, j);
- for(a=0; a<16; a++) flweight[a]= weight[a]*(1.0f/totw);
+ for (a=0; a<16; a++) flweight[a]= weight[a]*(1.0f/totw);
m3= st->fmask1[ 3*(j+1)+i+1 ];
m4= st->fmask2[ 3*(j+1)+i+1 ];
- for(a=0; a<256; a++) {
- if(a & 1) {
+ for (a=0; a<256; a++) {
+ if (a & 1) {
m3[a]+= flweight[0];
m4[a]+= flweight[8];
}
- if(a & 2) {
+ if (a & 2) {
m3[a]+= flweight[1];
m4[a]+= flweight[9];
}
- if(a & 4) {
+ if (a & 4) {
m3[a]+= flweight[2];
m4[a]+= flweight[10];
}
- if(a & 8) {
+ if (a & 8) {
m3[a]+= flweight[3];
m4[a]+= flweight[11];
}
- if(a & 16) {
+ if (a & 16) {
m3[a]+= flweight[4];
m4[a]+= flweight[12];
}
- if(a & 32) {
+ if (a & 32) {
m3[a]+= flweight[5];
m4[a]+= flweight[13];
}
- if(a & 64) {
+ if (a & 64) {
m3[a]+= flweight[6];
m4[a]+= flweight[14];
}
- if(a & 128) {
+ if (a & 128) {
m3[a]+= flweight[7];
m4[a]+= flweight[15];
}
@@ -374,52 +374,52 @@ void make_sample_tables(Render *re)
fpx2= MEM_mallocN(256*sizeof(float), "initgauss4");
fpy1= MEM_mallocN(256*sizeof(float), "initgauss4");
fpy2= MEM_mallocN(256*sizeof(float), "initgauss4");
- for(a=0; a<256; a++) {
+ for (a=0; a<256; a++) {
fpx1[a]= fpx2[a]= 0.0;
fpy1[a]= fpy2[a]= 0.0;
- if(a & 1) {
+ if (a & 1) {
fpx1[a]+= re->jit[0][0];
fpy1[a]+= re->jit[0][1];
fpx2[a]+= re->jit[8][0];
fpy2[a]+= re->jit[8][1];
}
- if(a & 2) {
+ if (a & 2) {
fpx1[a]+= re->jit[1][0];
fpy1[a]+= re->jit[1][1];
fpx2[a]+= re->jit[9][0];
fpy2[a]+= re->jit[9][1];
}
- if(a & 4) {
+ if (a & 4) {
fpx1[a]+= re->jit[2][0];
fpy1[a]+= re->jit[2][1];
fpx2[a]+= re->jit[10][0];
fpy2[a]+= re->jit[10][1];
}
- if(a & 8) {
+ if (a & 8) {
fpx1[a]+= re->jit[3][0];
fpy1[a]+= re->jit[3][1];
fpx2[a]+= re->jit[11][0];
fpy2[a]+= re->jit[11][1];
}
- if(a & 16) {
+ if (a & 16) {
fpx1[a]+= re->jit[4][0];
fpy1[a]+= re->jit[4][1];
fpx2[a]+= re->jit[12][0];
fpy2[a]+= re->jit[12][1];
}
- if(a & 32) {
+ if (a & 32) {
fpx1[a]+= re->jit[5][0];
fpy1[a]+= re->jit[5][1];
fpx2[a]+= re->jit[13][0];
fpy2[a]+= re->jit[13][1];
}
- if(a & 64) {
+ if (a & 64) {
fpx1[a]+= re->jit[6][0];
fpy1[a]+= re->jit[6][1];
fpx2[a]+= re->jit[14][0];
fpy2[a]+= re->jit[14][1];
}
- if(a & 128) {
+ if (a & 128) {
fpx1[a]+= re->jit[7][0];
fpy1[a]+= re->jit[7][1];
fpx2[a]+= re->jit[15][0];
@@ -427,7 +427,7 @@ void make_sample_tables(Render *re)
}
}
- for(a= (1<<re->osa)-1; a>0; a--) {
+ for (a= (1<<re->osa)-1; a>0; a--) {
val= st->cmask[a & 255] + st->cmask[a>>8];
i= 8+(15.9f*(fpy1[a & 255]+fpy2[a>>8])/val);
CLAMP(i, 0, 15);
@@ -531,9 +531,9 @@ void freeparts(Render *re)
{
RenderPart *part= re->parts.first;
- while(part) {
- if(part->rectp) MEM_freeN(part->rectp);
- if(part->rectz) MEM_freeN(part->rectz);
+ while (part) {
+ if (part->rectp) MEM_freeN(part->rectp);
+ if (part->rectz) MEM_freeN(part->rectz);
part= part->next;
}
BLI_freelistN(&re->parts);
@@ -561,16 +561,16 @@ void initparts(Render *re)
yparts= re->r.yparts;
/* mininum part size, but for exr tile saving it was checked already */
- if(!(re->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE))) {
- if(re->r.mode & R_PANORAMA) {
- if(ceil(re->rectx/(float)xparts) < 8)
+ if (!(re->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE))) {
+ if (re->r.mode & R_PANORAMA) {
+ if (ceil(re->rectx/(float)xparts) < 8)
xparts= 1 + re->rectx/8;
}
else
- if(ceil(re->rectx/(float)xparts) < 64)
+ if (ceil(re->rectx/(float)xparts) < 64)
xparts= 1 + re->rectx/64;
- if(ceil(re->recty/(float)yparts) < 64)
+ if (ceil(re->recty/(float)yparts) < 64)
yparts= 1 + re->recty/64;
}
@@ -584,43 +584,43 @@ void initparts(Render *re)
re->party= party;
/* calculate rotation factor of 1 pixel */
- if(re->r.mode & R_PANORAMA)
+ if (re->r.mode & R_PANORAMA)
re->panophi= panorama_pixel_rot(re);
- for(nr=0; nr<xparts*yparts; nr++) {
+ for (nr=0; nr<xparts*yparts; nr++) {
rcti disprect;
int rectx, recty;
xd= (nr % xparts);
yd= (nr-xd)/xparts;
- disprect.xmin= xminb+ xd*partx;
- disprect.ymin= yminb+ yd*party;
+ disprect.xmin = xminb+ xd*partx;
+ disprect.ymin = yminb+ yd*party;
/* ensure we cover the entire picture, so last parts go to end */
- if(xd<xparts-1) {
- disprect.xmax= disprect.xmin + partx;
- if(disprect.xmax > xmaxb)
+ if (xd<xparts-1) {
+ disprect.xmax = disprect.xmin + partx;
+ if (disprect.xmax > xmaxb)
disprect.xmax = xmaxb;
}
- else disprect.xmax= xmaxb;
+ else disprect.xmax = xmaxb;
- if(yd<yparts-1) {
- disprect.ymax= disprect.ymin + party;
- if(disprect.ymax > ymaxb)
+ if (yd<yparts-1) {
+ disprect.ymax = disprect.ymin + party;
+ if (disprect.ymax > ymaxb)
disprect.ymax = ymaxb;
}
- else disprect.ymax= ymaxb;
+ else disprect.ymax = ymaxb;
rectx= disprect.xmax - disprect.xmin;
recty= disprect.ymax - disprect.ymin;
/* so, now can we add this part? */
- if(rectx>0 && recty>0) {
+ if (rectx>0 && recty>0) {
RenderPart *pa= MEM_callocN(sizeof(RenderPart), "new part");
/* Non-box filters need 2 pixels extra to work */
- if((re->r.filtertype || (re->r.mode & R_EDGE))) {
+ if ((re->r.filtertype || (re->r.mode & R_EDGE))) {
pa->crop= 2;
disprect.xmin -= pa->crop;
disprect.ymin -= pa->crop;
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index 47b13cd484d..436eaefd155 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -148,7 +148,7 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr,
float l, u, v, *v1, *v2, *v3;
/* init */
- if(vlr->v4) {
+ if (vlr->v4) {
shi->u= u= 0.5f;
shi->v= v= 0.5f;
}
@@ -184,13 +184,13 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr,
shade_input_set_normals(shi);
/* no normal flip */
- if(shi->flippednor)
+ if (shi->flippednor)
shade_input_flip_normals(shi);
madd_v3_v3fl(shi->co, shi->vn, 0.0001f); /* ugly.. */
/* not a pretty solution, but fixes common cases */
- if(shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
+ if (shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
negate_v3(shi->vn);
negate_v3(shi->vno);
negate_v3(shi->nmapnorm);
@@ -224,7 +224,7 @@ static void occ_build_shade(Render *re, OcclusionTree *tree)
ssamp.shi[0].combinedflag= ~(SCE_PASS_SPEC);
ssamp.tot= 1;
- for(a=0; a<tree->totface; a++) {
+ for (a=0; a<tree->totface; a++) {
obi= &R.objectinstance[tree->face[a].obi];
vlr= RE_findOrAddVlak(obi->obr, tree->face[a].facenr);
@@ -248,7 +248,7 @@ static void sh_mul(float *sh, float f)
{
int i;
- for(i=0; i<9; i++)
+ for (i=0; i<9; i++)
sh[i] *= f;
}
@@ -256,7 +256,7 @@ static void sh_add(float *shresult, float *sh1, float *sh2)
{
int i;
- for(i=0; i<9; i++)
+ for (i=0; i<9; i++)
shresult[i]= sh1[i] + sh2[i];
}
@@ -319,40 +319,40 @@ static void occ_face(const OccFace *face, float co[3], float normal[3], float *a
obi= &R.objectinstance[face->obi];
vlr= RE_findOrAddVlak(obi->obr, face->facenr);
- if(co) {
- if(vlr->v4)
+ if (co) {
+ if (vlr->v4)
mid_v3_v3v3(co, vlr->v1->co, vlr->v3->co);
else
cent_tri_v3(co, vlr->v1->co, vlr->v2->co, vlr->v3->co);
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mul_m4_v3(obi->mat, co);
}
- if(normal) {
+ if (normal) {
normal[0]= -vlr->n[0];
normal[1]= -vlr->n[1];
normal[2]= -vlr->n[2];
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mul_m3_v3(obi->nmat, normal);
}
- if(area) {
+ if (area) {
copy_v3_v3(v1, vlr->v1->co);
copy_v3_v3(v2, vlr->v2->co);
copy_v3_v3(v3, vlr->v3->co);
- if(vlr->v4) copy_v3_v3(v4, vlr->v4->co);
+ if (vlr->v4) copy_v3_v3(v4, vlr->v4->co);
- if(obi->flag & R_TRANSFORMED) {
+ if (obi->flag & R_TRANSFORMED) {
mul_m4_v3(obi->mat, v1);
mul_m4_v3(obi->mat, v2);
mul_m4_v3(obi->mat, v3);
- if(vlr->v4) mul_m4_v3(obi->mat, v4);
+ if (vlr->v4) mul_m4_v3(obi->mat, v4);
}
/* todo: correct area for instances */
- if(vlr->v4)
+ if (vlr->v4)
*area= area_quad_v3(v1, v2, v3, v4);
else
*area= area_tri_v3(v1, v2, v3);
@@ -367,33 +367,33 @@ static void occ_sum_occlusion(OcclusionTree *tree, OccNode *node)
occ= 0.0f;
totarea= 0.0f;
- if(indirect) zero_v3(rad);
+ if (indirect) zero_v3(rad);
- for(b=0; b<TOTCHILD; b++) {
- if(node->childflag & (1<<b)) {
+ for (b=0; b<TOTCHILD; b++) {
+ if (node->childflag & (1<<b)) {
a= node->child[b].face;
occ_face(&tree->face[a], 0, 0, &area);
occ += area*tree->occlusion[a];
- if(indirect) madd_v3_v3fl(rad, tree->rad[a], area);
+ if (indirect) madd_v3_v3fl(rad, tree->rad[a], area);
totarea += area;
}
- else if(node->child[b].node) {
+ else if (node->child[b].node) {
child= node->child[b].node;
occ_sum_occlusion(tree, child);
occ += child->area*child->occlusion;
- if(indirect) madd_v3_v3fl(rad, child->rad, child->area);
+ if (indirect) madd_v3_v3fl(rad, child->rad, child->area);
totarea += child->area;
}
}
- if(totarea != 0.0f) {
+ if (totarea != 0.0f) {
occ /= totarea;
- if(indirect) mul_v3_fl(rad, 1.0f/totarea);
+ if (indirect) mul_v3_fl(rad, 1.0f/totarea);
}
node->occlusion= occ;
- if(indirect) copy_v3_v3(node->rad, rad);
+ if (indirect) copy_v3_v3(node->rad, rad);
}
static int occ_find_bbox_axis(OcclusionTree *tree, int begin, int end, float *min, float *max)
@@ -403,13 +403,14 @@ static int occ_find_bbox_axis(OcclusionTree *tree, int begin, int end, float *mi
INIT_MINMAX(min, max);
- for(a=begin; a<end; a++)
- DO_MINMAX(tree->co[a], min, max)
+ for (a = begin; a < end; a++) {
+ DO_MINMAX(tree->co[a], min, max);
+ }
- for(a=0; a<3; a++) {
+ for (a=0; a<3; a++) {
len= max[a] - min[a];
- if(len > maxlen) {
+ if (len > maxlen) {
maxlen= len;
axis= a;
}
@@ -430,13 +431,13 @@ static void occ_node_from_face(OccFace *face, OccNode *node)
static void occ_build_dco(OcclusionTree *tree, OccNode *node, const float co[3], float *dco)
{
int b;
- for(b=0; b<TOTCHILD; b++) {
+ for (b=0; b<TOTCHILD; b++) {
float dist, d[3], nco[3];
- if(node->childflag & (1<<b)) {
+ if (node->childflag & (1<<b)) {
occ_face(tree->face+node->child[b].face, nco, NULL, NULL);
}
- else if(node->child[b].node) {
+ else if (node->child[b].node) {
OccNode *child= node->child[b].node;
occ_build_dco(tree, child, co, dco);
copy_v3_v3(nco, child->co);
@@ -447,7 +448,7 @@ static void occ_build_dco(OcclusionTree *tree, OccNode *node, const float co[3],
sub_v3_v3v3(d, nco, co);
dist= dot_v3v3(d, d);
- if(dist > *dco)
+ if (dist > *dco)
*dco= dist;
}
}
@@ -465,8 +466,8 @@ static void occ_build_split(OcclusionTree *tree, int begin, int end, int *split)
a= begin;
enda= end;
- while(a<enda) {
- if(tree->co[a][axis] > mid) {
+ while (a<enda) {
+ if (tree->co[a][axis] > mid) {
enda--;
SWAP(OccFace, tree->face[a], tree->face[enda]);
SWAP(float, tree->co[a][0], tree->co[enda][0]);
@@ -488,7 +489,7 @@ static void occ_build_8_split(OcclusionTree *tree, int begin, int end, int *offs
occ_build_split(tree, begin, end, &splitx);
/* force split if none found, to deal with degenerate geometry */
- if(splitx == begin || splitx == end)
+ if (splitx == begin || splitx == end)
splitx= (begin+end)/2;
occ_build_split(tree, begin, splitx, &splity[0]);
@@ -508,7 +509,7 @@ static void occ_build_8_split(OcclusionTree *tree, int begin, int end, int *offs
offset[6]= splity[1];
offset[7]= splitz[3];
- for(b=0; b<7; b++)
+ for (b=0; b<7; b++)
count[b]= offset[b+1] - offset[b];
count[7]= end - offset[7];
}
@@ -536,8 +537,8 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
node->occlusion= 1.0f;
/* leaf node with only children */
- if(end - begin <= TOTCHILD) {
- for(a=begin, b=0; a<end; a++, b++) {
+ if (end - begin <= TOTCHILD) {
+ for (a=begin, b=0; a<end; a++, b++) {
/* face= &tree->face[a]; */
node->child[b].face= a;
node->childflag |= (1<<b);
@@ -547,33 +548,33 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
/* order faces */
occ_build_8_split(tree, begin, end, offset, count);
- if(depth == 1 && tree->dothreadedbuild)
+ if (depth == 1 && tree->dothreadedbuild)
BLI_init_threads(&threads, exec_occ_build, tree->totbuildthread);
- for(b=0; b<TOTCHILD; b++) {
- if(count[b] == 0) {
+ for (b=0; b<TOTCHILD; b++) {
+ if (count[b] == 0) {
node->child[b].node= NULL;
}
- else if(count[b] == 1) {
+ else if (count[b] == 1) {
/* face= &tree->face[offset[b]]; */
node->child[b].face= offset[b];
node->childflag |= (1<<b);
}
else {
- if(tree->dothreadedbuild)
+ if (tree->dothreadedbuild)
BLI_lock_thread(LOCK_CUSTOM1);
child= BLI_memarena_alloc(tree->arena, sizeof(OccNode));
node->child[b].node= child;
/* keep track of maximum depth for stack */
- if(depth+1 > tree->maxdepth)
+ if (depth+1 > tree->maxdepth)
tree->maxdepth= depth+1;
- if(tree->dothreadedbuild)
+ if (tree->dothreadedbuild)
BLI_unlock_thread(LOCK_CUSTOM1);
- if(depth == 1 && tree->dothreadedbuild) {
+ if (depth == 1 && tree->dothreadedbuild) {
othreads[totthread].tree= tree;
othreads[totthread].node= child;
othreads[totthread].begin= offset[b];
@@ -587,13 +588,13 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
}
}
- if(depth == 1 && tree->dothreadedbuild)
+ if (depth == 1 && tree->dothreadedbuild)
BLI_end_threads(&threads);
}
/* combine area, position and sh */
- for(b=0; b<TOTCHILD; b++) {
- if(node->childflag & (1<<b)) {
+ for (b=0; b<TOTCHILD; b++) {
+ if (node->childflag & (1<<b)) {
child= &tmpnode;
occ_node_from_face(tree->face+node->child[b].face, &tmpnode);
}
@@ -601,19 +602,19 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
child= node->child[b].node;
}
- if(child) {
+ if (child) {
node->area += child->area;
sh_add(node->sh, node->sh, child->sh);
madd_v3_v3fl(node->co, child->co, child->area);
}
}
- if(node->area != 0.0f)
+ if (node->area != 0.0f)
mul_v3_fl(node->co, 1.0f/node->area);
/* compute maximum distance from center */
node->dco= 0.0f;
- if(node->area > 0.0f)
+ if (node->area > 0.0f)
occ_build_dco(tree, node, node->co, &node->dco);
}
@@ -623,12 +624,12 @@ static void occ_build_sh_normalize(OccNode *node)
* we can clamp the dot product and then mutliply by area */
int b;
- if(node->area != 0.0f)
+ if (node->area != 0.0f)
sh_mul(node->sh, 1.0f/node->area);
- for(b=0; b<TOTCHILD; b++) {
- if(node->childflag & (1<<b));
- else if(node->child[b].node)
+ for (b=0; b<TOTCHILD; b++) {
+ if (node->childflag & (1<<b));
+ else if (node->child[b].node)
occ_build_sh_normalize(node->child[b].node);
}
}
@@ -644,20 +645,20 @@ static OcclusionTree *occ_tree_build(Render *re)
/* count */
totface= 0;
- for(obi=re->instancetable.first; obi; obi=obi->next) {
+ for (obi=re->instancetable.first; obi; obi=obi->next) {
obr= obi->obr;
- for(a=0; a<obr->totvlak; a++) {
- if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+ for (a=0; a<obr->totvlak; a++) {
+ if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
else vlr++;
ma= vlr->mat;
- if((ma->shade_flag & MA_APPROX_OCCLUSION) && (ma->material_type == MA_TYPE_SURFACE))
+ if ((ma->shade_flag & MA_APPROX_OCCLUSION) && (ma->material_type == MA_TYPE_SURFACE))
totface++;
}
}
- if(totface == 0)
+ if (totface == 0)
return NULL;
tree= MEM_callocN(sizeof(OcclusionTree), "OcclusionTree");
@@ -672,26 +673,26 @@ static OcclusionTree *occ_tree_build(Render *re)
tree->arena= BLI_memarena_new(0x8000 * sizeof(OccNode), "occ tree arena");
BLI_memarena_use_calloc(tree->arena);
- if(re->wrld.aomode & WO_AOCACHE)
+ if (re->wrld.aomode & WO_AOCACHE)
tree->cache= MEM_callocN(sizeof(OcclusionCache)*BLENDER_MAX_THREADS, "OcclusionCache");
tree->face= MEM_callocN(sizeof(OccFace)*totface, "OcclusionFace");
tree->co= MEM_callocN(sizeof(float)*3*totface, "OcclusionCo");
tree->occlusion= MEM_callocN(sizeof(float)*totface, "OcclusionOcclusion");
- if(tree->doindirect)
+ if (tree->doindirect)
tree->rad= MEM_callocN(sizeof(float)*3*totface, "OcclusionRad");
/* make array of face pointers */
- for(b=0, c=0, obi=re->instancetable.first; obi; obi=obi->next, c++) {
+ for (b=0, c=0, obi=re->instancetable.first; obi; obi=obi->next, c++) {
obr= obi->obr;
- for(a=0; a<obr->totvlak; a++) {
- if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+ for (a=0; a<obr->totvlak; a++) {
+ if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
else vlr++;
ma= vlr->mat;
- if((ma->shade_flag & MA_APPROX_OCCLUSION) && (ma->material_type == MA_TYPE_SURFACE)) {
+ if ((ma->shade_flag & MA_APPROX_OCCLUSION) && (ma->material_type == MA_TYPE_SURFACE)) {
tree->face[b].obi= c;
tree->face[b].facenr= a;
tree->occlusion[b]= 1.0f;
@@ -710,7 +711,7 @@ static OcclusionTree *occ_tree_build(Render *re)
tree->maxdepth= 1;
occ_build_recursive(tree, tree->root, 0, totface, 1);
- if(tree->doindirect) {
+ if (tree->doindirect) {
occ_build_shade(re, tree);
occ_sum_occlusion(tree, tree->root);
}
@@ -720,7 +721,7 @@ static OcclusionTree *occ_tree_build(Render *re)
occ_build_sh_normalize(tree->root);
- for(a=0; a<BLENDER_MAX_THREADS; a++)
+ for (a=0; a<BLENDER_MAX_THREADS; a++)
tree->stack[a]= MEM_callocN(sizeof(OccNode)*TOTCHILD*(tree->maxdepth+1), "OccStack");
return tree;
@@ -730,15 +731,15 @@ static void occ_free_tree(OcclusionTree *tree)
{
int a;
- if(tree) {
- if(tree->arena) BLI_memarena_free(tree->arena);
- for(a=0; a<BLENDER_MAX_THREADS; a++)
- if(tree->stack[a])
+ if (tree) {
+ if (tree->arena) BLI_memarena_free(tree->arena);
+ for (a=0; a<BLENDER_MAX_THREADS; a++)
+ if (tree->stack[a])
MEM_freeN(tree->stack[a]);
- if(tree->occlusion) MEM_freeN(tree->occlusion);
- if(tree->cache) MEM_freeN(tree->cache);
- if(tree->face) MEM_freeN(tree->face);
- if(tree->rad) MEM_freeN(tree->rad);
+ if (tree->occlusion) MEM_freeN(tree->occlusion);
+ if (tree->cache) MEM_freeN(tree->cache);
+ if (tree->face) MEM_freeN(tree->face);
+ if (tree->rad) MEM_freeN(tree->rad);
MEM_freeN(tree);
}
}
@@ -781,20 +782,20 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
sd[1]= dot_v3v3(n, v1) - c;
sd[2]= dot_v3v3(n, v2) - c;
- if(fabsf(sd[0]) < epsilon) sd[0] = 0.0f;
- if(fabsf(sd[1]) < epsilon) sd[1] = 0.0f;
- if(fabsf(sd[2]) < epsilon) sd[2] = 0.0f;
+ if (fabsf(sd[0]) < epsilon) sd[0] = 0.0f;
+ if (fabsf(sd[1]) < epsilon) sd[1] = 0.0f;
+ if (fabsf(sd[2]) < epsilon) sd[2] = 0.0f;
- if(sd[0] > 0) {
- if(sd[1] > 0) {
- if(sd[2] > 0) {
+ if (sd[0] > 0) {
+ if (sd[1] > 0) {
+ if (sd[2] > 0) {
// +++
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// ++-
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
@@ -809,15 +810,15 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
copy_v3_v3(q3, q2);
}
}
- else if(sd[1] < 0) {
- if(sd[2] > 0) {
+ else if (sd[1] < 0) {
+ if (sd[2] > 0) {
// +-+
copy_v3_v3(q0, v0);
VecAddDir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
VecAddDir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
copy_v3_v3(q3, v2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// +--
copy_v3_v3(q0, v0);
VecAddDir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
@@ -833,14 +834,14 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
}
}
else {
- if(sd[2] > 0) {
+ if (sd[2] > 0) {
// +0+
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// +0-
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
@@ -856,16 +857,16 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
}
}
}
- else if(sd[0] < 0) {
- if(sd[1] > 0) {
- if(sd[2] > 0) {
+ else if (sd[0] < 0) {
+ if (sd[1] > 0) {
+ if (sd[2] > 0) {
// -++
VecAddDir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
VecAddDir(q3, v0, v2, (sd[0]/(sd[0]-sd[2])));
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// -+-
VecAddDir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
copy_v3_v3(q1, v1);
@@ -880,15 +881,15 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
copy_v3_v3(q3, q2);
}
}
- else if(sd[1] < 0) {
- if(sd[2] > 0) {
+ else if (sd[1] < 0) {
+ if (sd[2] > 0) {
// --+
VecAddDir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
VecAddDir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// ---
return 0;
}
@@ -898,14 +899,14 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
}
}
else {
- if(sd[2] > 0) {
+ if (sd[2] > 0) {
// -0+
VecAddDir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// -0-
return 0;
}
@@ -916,15 +917,15 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
}
}
else {
- if(sd[1] > 0) {
- if(sd[2] > 0) {
+ if (sd[1] > 0) {
+ if (sd[2] > 0) {
// 0++
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// 0+-
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
@@ -939,15 +940,15 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
copy_v3_v3(q3, q2);
}
}
- else if(sd[1] < 0) {
- if(sd[2] > 0) {
+ else if (sd[1] < 0) {
+ if (sd[2] > 0) {
// 0-+
copy_v3_v3(q0, v0);
VecAddDir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// 0--
return 0;
}
@@ -957,14 +958,14 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
}
}
else {
- if(sd[2] > 0) {
+ if (sd[2] > 0) {
// 00+
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
- else if(sd[2] < 0) {
+ else if (sd[2] < 0) {
// 00-
return 0;
}
@@ -990,20 +991,20 @@ typedef union {
static vFloat vec_splat_float(float val)
{
- return (vFloat){val, val, val, val};
+ return (vFloat) {val, val, val, val};
}
static float occ_quad_form_factor(float *p, float *n, float *q0, float *q1, float *q2, float *q3)
{
vFloat vcos, rlen, vrx, vry, vrz, vsrx, vsry, vsrz, gx, gy, gz, vangle;
- vUInt8 rotate = (vUInt8){4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3};
+ vUInt8 rotate = (vUInt8) {4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3};
vFloatResult vresult;
float result;
/* compute r* */
- vrx = (vFloat){q0[0], q1[0], q2[0], q3[0]} - vec_splat_float(p[0]);
- vry = (vFloat){q0[1], q1[1], q2[1], q3[1]} - vec_splat_float(p[1]);
- vrz = (vFloat){q0[2], q1[2], q2[2], q3[2]} - vec_splat_float(p[2]);
+ vrx = (vFloat) {q0[0], q1[0], q2[0], q3[0]} - vec_splat_float(p[0]);
+ vry = (vFloat) {q0[1], q1[1], q2[1], q3[1]} - vec_splat_float(p[1]);
+ vrz = (vFloat) {q0[2], q1[2], q2[2], q3[2]} - vec_splat_float(p[2]);
/* normalize r* */
rlen = vec_rsqrte(vrx*vrx + vry*vry + vrz*vrz + vec_splat_float(1e-16f));
@@ -1119,7 +1120,7 @@ static void normalizef(float *n)
d= dot_v3v3(n, n);
- if(d > 1.0e-35F) {
+ if (d > 1.0e-35F) {
d= 1.0f/sqrtf(d);
n[0] *= d;
@@ -1177,21 +1178,21 @@ static float occ_form_factor(OccFace *face, float *p, float *n)
copy_v3_v3(v2, vlr->v2->co);
copy_v3_v3(v3, vlr->v3->co);
- if(obi->flag & R_TRANSFORMED) {
+ if (obi->flag & R_TRANSFORMED) {
mul_m4_v3(obi->mat, v1);
mul_m4_v3(obi->mat, v2);
mul_m4_v3(obi->mat, v3);
}
- if(occ_visible_quad(p, n, v1, v2, v3, q0, q1, q2, q3))
+ if (occ_visible_quad(p, n, v1, v2, v3, q0, q1, q2, q3))
contrib += occ_quad_form_factor(p, n, q0, q1, q2, q3);
- if(vlr->v4) {
+ if (vlr->v4) {
copy_v3_v3(v4, vlr->v4->co);
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mul_m4_v3(obi->mat, v4);
- if(occ_visible_quad(p, n, v1, v3, v4, q0, q1, q2, q3))
+ if (occ_visible_quad(p, n, v1, v3, v4, q0, q1, q2, q3))
contrib += occ_quad_form_factor(p, n, q0, q1, q2, q3);
}
@@ -1211,7 +1212,7 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
copy_v3_v3(n, pn);
madd_v3_v3fl(p, n, 1e-4f);
- if(bentn)
+ if (bentn)
copy_v3_v3(bentn, n);
error= tree->error;
@@ -1225,7 +1226,7 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
stack[0]= tree->root;
totstack= 1;
- while(totstack) {
+ while (totstack) {
/* pop point off the stack */
node= stack[--totstack];
@@ -1233,10 +1234,10 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
d2= dot_v3v3(v, v) + 1e-16f;
emitarea= MAX2(node->area, node->dco);
- if(d2*error > emitarea) {
- if(distfac != 0.0f) {
+ if (d2*error > emitarea) {
+ if (distfac != 0.0f) {
fac= 1.0f/(1.0f + distfac*d2);
- if(fac < 0.01f)
+ if (fac < 0.01f)
continue;
}
else
@@ -1246,12 +1247,12 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
invd2 = 1.0f/sqrtf(d2);
weight= occ_solid_angle(node, v, d2, invd2, n);
- if(rad)
+ if (rad)
madd_v3_v3fl(resultrad, node->rad, weight*fac);
weight *= node->occlusion;
- if(bentn) {
+ if (bentn) {
bentn[0] -= weight*invd2*v[0];
bentn[1] -= weight*invd2*v[1];
bentn[2] -= weight*invd2*v[2];
@@ -1261,20 +1262,20 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
}
else {
/* traverse into children */
- for(b=0; b<TOTCHILD; b++) {
- if(node->childflag & (1<<b)) {
+ for (b=0; b<TOTCHILD; b++) {
+ if (node->childflag & (1<<b)) {
f= node->child[b].face;
face= &tree->face[f];
/* accumulate occlusion with face form factor */
- if(!exclude || !(face->obi == exclude->obi && face->facenr == exclude->facenr)) {
- if(bentn || distfac != 0.0f) {
+ if (!exclude || !(face->obi == exclude->obi && face->facenr == exclude->facenr)) {
+ if (bentn || distfac != 0.0f) {
occ_face(face, co, NULL, NULL);
sub_v3_v3v3(v, co, p);
d2= dot_v3v3(v, v) + 1e-16f;
fac= (distfac == 0.0f)? 1.0f: 1.0f/(1.0f + distfac*d2);
- if(fac < 0.01f)
+ if (fac < 0.01f)
continue;
}
else
@@ -1282,12 +1283,12 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
weight= occ_form_factor(face, p, n);
- if(rad)
+ if (rad)
madd_v3_v3fl(resultrad, tree->rad[f], weight*fac);
weight *= tree->occlusion[f];
- if(bentn) {
+ if (bentn) {
invd2= 1.0f/sqrtf(d2);
bentn[0] -= weight*invd2*v[0];
bentn[1] -= weight*invd2*v[1];
@@ -1297,7 +1298,7 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
resultocc += weight*fac;
}
}
- else if(node->child[b].node) {
+ else if (node->child[b].node) {
/* push child on the stack */
stack[totstack++]= node->child[b].node;
}
@@ -1305,17 +1306,17 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
}
}
- if(occ) *occ= resultocc;
- if(rad) copy_v3_v3(rad, resultrad);
+ if (occ) *occ= resultocc;
+ if (rad) copy_v3_v3(rad, resultrad);
#if 0
- if(rad && exclude) {
+ if (rad && exclude) {
int a;
- for(a=0; a<tree->totface; a++)
- if((tree->face[a].obi == exclude->obi && tree->face[a].facenr == exclude->facenr))
+ for (a=0; a<tree->totface; a++)
+ if ((tree->face[a].obi == exclude->obi && tree->face[a].facenr == exclude->facenr))
copy_v3_v3(rad, tree->rad[a]);
}
#endif
- if(bentn) normalize_v3(bentn);
+ if (bentn) normalize_v3(bentn);
}
static void occ_compute_bounces(Render *re, OcclusionTree *tree, int totbounce)
@@ -1326,8 +1327,8 @@ static void occ_compute_bounces(Render *re, OcclusionTree *tree, int totbounce)
rad= MEM_callocN(sizeof(float)*3*tree->totface, "OcclusionBounceRad");
sum= MEM_dupallocN(tree->rad);
- for(bounce=1; bounce<totbounce; bounce++) {
- for(i=0; i<tree->totface; i++) {
+ for (bounce=1; bounce<totbounce; bounce++) {
+ for (i=0; i<tree->totface; i++) {
occ_face(&tree->face[i], co, n, NULL);
madd_v3_v3fl(co, n, 1e-8f);
@@ -1337,11 +1338,11 @@ static void occ_compute_bounces(Render *re, OcclusionTree *tree, int totbounce)
rad[i][2]= MAX2(rad[i][2], 0.0f);
add_v3_v3(sum[i], rad[i]);
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
break;
}
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
break;
tmp= tree->rad;
@@ -1355,7 +1356,7 @@ static void occ_compute_bounces(Render *re, OcclusionTree *tree, int totbounce)
MEM_freeN(tree->rad);
tree->rad= sum;
- if(!re->test_break(re->tbh))
+ if (!re->test_break(re->tbh))
occ_sum_occlusion(tree, tree->root);
}
@@ -1366,23 +1367,23 @@ static void occ_compute_passes(Render *re, OcclusionTree *tree, int totpass)
occ= MEM_callocN(sizeof(float)*tree->totface, "OcclusionPassOcc");
- for(pass=0; pass<totpass; pass++) {
- for(i=0; i<tree->totface; i++) {
+ for (pass=0; pass<totpass; pass++) {
+ for (i=0; i<tree->totface; i++) {
occ_face(&tree->face[i], co, n, NULL);
negate_v3(n);
madd_v3_v3fl(co, n, 1e-8f);
occ_lookup(tree, 0, &tree->face[i], co, n, &occ[i], NULL, NULL);
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
break;
}
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
break;
- for(i=0; i<tree->totface; i++) {
+ for (i=0; i<tree->totface; i++) {
tree->occlusion[i] -= occ[i]; //MAX2(1.0f-occ[i], 0.0f);
- if(tree->occlusion[i] < 0.0f)
+ if (tree->occlusion[i] < 0.0f)
tree->occlusion[i]= 0.0f;
}
@@ -1398,7 +1399,7 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f
int envcolor;
envcolor= re->wrld.aocolor;
- if(onlyshadow)
+ if (onlyshadow)
envcolor= WO_AOPLAIN;
negate_v3_v3(nn, n);
@@ -1409,12 +1410,12 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f
occlusion= (1.0f-correction)*(1.0f-occ);
CLAMP(occlusion, 0.0f, 1.0f);
- if(correction != 0.0f)
+ if (correction != 0.0f)
occlusion += correction*expf(-occ);
- if(env) {
+ if (env) {
/* sky shading using bent normal */
- if(ELEM(envcolor, WO_AOSKYCOL, WO_AOSKYTEX)) {
+ if (ELEM(envcolor, WO_AOSKYCOL, WO_AOSKYTEX)) {
fac= 0.5f * (1.0f + dot_v3v3(bn, re->grvec));
env[0]= (1.0f-fac)*re->wrld.horr + fac*re->wrld.zenr;
env[1]= (1.0f-fac)*re->wrld.horg + fac*re->wrld.zeng;
@@ -1441,13 +1442,13 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f
#endif
}
- if(ao) {
+ if (ao) {
ao[0]= occlusion;
ao[1]= occlusion;
ao[2]= occlusion;
}
- if(tree->doindirect) copy_v3_v3(indirect, rad);
+ if (tree->doindirect) copy_v3_v3(indirect, rad);
else zero_v3(indirect);
}
@@ -1463,7 +1464,7 @@ static OcclusionCacheSample *find_occ_sample(OcclusionCache *cache, int x, int y
x *= cache->step;
y *= cache->step;
- if(x < 0 || x >= cache->w || y < 0 || y >= cache->h)
+ if (x < 0 || x >= cache->w || y < 0 || y >= cache->h)
return NULL;
else
return &cache->sample[y*cache->w + x];
@@ -1477,18 +1478,18 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
float d[3], dist2;
int i, x1, y1, x2, y2;
- if(!tree->cache)
+ if (!tree->cache)
return 0;
/* first try to find a sample in the same pixel */
cache= &tree->cache[thread];
- if(cache->sample && cache->step) {
+ if (cache->sample && cache->step) {
sample= &cache->sample[(y-cache->y)*cache->w + (x-cache->x)];
- if(sample->filled) {
+ if (sample->filled) {
sub_v3_v3v3(d, sample->co, co);
dist2= dot_v3v3(d, d);
- if(dist2 < 0.5f*sample->dist2 && dot_v3v3(sample->n, n) > 0.98f) {
+ if (dist2 < 0.5f*sample->dist2 && dot_v3v3(sample->n, n) > 0.98f) {
copy_v3_v3(ao, sample->ao);
copy_v3_v3(env, sample->env);
copy_v3_v3(indirect, sample->indirect);
@@ -1505,15 +1506,15 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
samples[2]= find_occ_sample(cache, x, y+cache->step);
samples[3]= find_occ_sample(cache, x+cache->step, y+cache->step);
- for(i=0; i<4; i++)
- if(!samples[i] || !samples[i]->filled)
+ for (i=0; i<4; i++)
+ if (!samples[i] || !samples[i]->filled)
return 0;
/* require intensities not being too different */
mino= MIN4(samples[0]->intensity, samples[1]->intensity, samples[2]->intensity, samples[3]->intensity);
maxo= MAX4(samples[0]->intensity, samples[1]->intensity, samples[2]->intensity, samples[3]->intensity);
- if(maxo - mino > 0.05f)
+ if (maxo - mino > 0.05f)
return 0;
/* compute weighted interpolation between samples */
@@ -1535,7 +1536,7 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
wb[1]= (1.0f-tx)*(ty);
wb[0]= tx*ty;
- for(i=0; i<4; i++) {
+ for (i=0; i<4; i++) {
sub_v3_v3v3(d, samples[i]->co, co);
//dist2= dot_v3v3(d, d);
@@ -1550,7 +1551,7 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
madd_v3_v3fl(indirect, samples[i]->indirect, w);
}
- if(totw >= 0.9f) {
+ if (totw >= 0.9f) {
totw= 1.0f/totw;
mul_v3_fl(ao, totw);
mul_v3_fl(env, totw);
@@ -1568,7 +1569,7 @@ static void sample_occ_surface(ShadeInput *shi)
int *face, *index = RE_strandren_get_face(shi->obr, strand, 0);
float w[4], *co1, *co2, *co3, *co4;
- if(mesh && mesh->face && mesh->co && mesh->ao && index) {
+ if (mesh && mesh->face && mesh->co && mesh->ao && index) {
face= mesh->face[*index];
co1= mesh->co[face[0]];
@@ -1591,7 +1592,7 @@ static void sample_occ_surface(ShadeInput *shi)
madd_v3_v3fl(shi->ao, mesh->ao[face[2]], w[2]);
madd_v3_v3fl(shi->env, mesh->env[face[2]], w[2]);
madd_v3_v3fl(shi->indirect, mesh->indirect[face[2]], w[2]);
- if(face[3]) {
+ if (face[3]) {
madd_v3_v3fl(shi->ao, mesh->ao[face[3]], w[3]);
madd_v3_v3fl(shi->env, mesh->env[face[3]], w[3]);
madd_v3_v3fl(shi->indirect, mesh->indirect[face[3]], w[3]);
@@ -1616,13 +1617,13 @@ static void *exec_strandsurface_sample(void *data)
float ao[3], env[3], indirect[3], co[3], n[3], *co1, *co2, *co3, *co4;
int a, *face;
- for(a=othread->begin; a<othread->end; a++) {
+ for (a=othread->begin; a<othread->end; a++) {
face= mesh->face[a];
co1= mesh->co[face[0]];
co2= mesh->co[face[1]];
co3= mesh->co[face[2]];
- if(face[3]) {
+ if (face[3]) {
co4= mesh->co[face[3]];
mid_v3_v3v3(co, co1, co3);
@@ -1660,14 +1661,14 @@ void make_occ_tree(Render *re)
re->occlusiontree= tree= occ_tree_build(re);
- if(tree) {
- if(re->wrld.ao_approx_passes > 0)
+ if (tree) {
+ if (re->wrld.ao_approx_passes > 0)
occ_compute_passes(re, tree, re->wrld.ao_approx_passes);
- if(tree->doindirect && (re->wrld.mode & WO_INDIRECT_LIGHT))
+ if (tree->doindirect && (re->wrld.mode & WO_INDIRECT_LIGHT))
occ_compute_bounces(re, tree, re->wrld.ao_indirect_bounces);
- for(mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
- if(!mesh->face || !mesh->co || !mesh->ao)
+ for (mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
+ if (!mesh->face || !mesh->co || !mesh->ao)
continue;
count= MEM_callocN(sizeof(int)*mesh->totvert, "OcclusionCount");
@@ -1677,7 +1678,7 @@ void make_occ_tree(Render *re)
totthread= (mesh->totface > 10000)? re->r.threads: 1;
totface= mesh->totface/totthread;
- for(a=0; a<totthread; a++) {
+ for (a=0; a<totthread; a++) {
othreads[a].re= re;
othreads[a].faceao= faceao;
othreads[a].faceenv= faceenv;
@@ -1688,19 +1689,19 @@ void make_occ_tree(Render *re)
othreads[a].end= (a == totthread-1)? mesh->totface: (a+1)*totface;
}
- if(totthread == 1) {
+ if (totthread == 1) {
exec_strandsurface_sample(&othreads[0]);
}
else {
BLI_init_threads(&threads, exec_strandsurface_sample, totthread);
- for(a=0; a<totthread; a++)
+ for (a=0; a<totthread; a++)
BLI_insert_thread(&threads, &othreads[a]);
BLI_end_threads(&threads);
}
- for(a=0; a<mesh->totface; a++) {
+ for (a=0; a<mesh->totface; a++) {
face= mesh->face[a];
copy_v3_v3(ao, faceao[a]);
@@ -1720,7 +1721,7 @@ void make_occ_tree(Render *re)
add_v3_v3(mesh->indirect[face[2]], indirect);
count[face[2]]++;
- if(face[3]) {
+ if (face[3]) {
add_v3_v3(mesh->ao[face[3]], ao);
add_v3_v3(mesh->env[face[3]], env);
add_v3_v3(mesh->indirect[face[3]], indirect);
@@ -1728,8 +1729,8 @@ void make_occ_tree(Render *re)
}
}
- for(a=0; a<mesh->totvert; a++) {
- if(count[a]) {
+ for (a=0; a<mesh->totvert; a++) {
+ if (count[a]) {
mul_v3_fl(mesh->ao[a], 1.0f/count[a]);
mul_v3_fl(mesh->env[a], 1.0f/count[a]);
mul_v3_fl(mesh->indirect[a], 1.0f/count[a]);
@@ -1746,7 +1747,7 @@ void make_occ_tree(Render *re)
void free_occ(Render *re)
{
- if(re->occlusiontree) {
+ if (re->occlusiontree) {
occ_free_tree(re->occlusiontree);
re->occlusiontree = NULL;
}
@@ -1760,12 +1761,12 @@ void sample_occ(Render *re, ShadeInput *shi)
OccFace exclude;
int onlyshadow;
- if(tree) {
- if(shi->strand) {
+ if (tree) {
+ if (shi->strand) {
sample_occ_surface(shi);
}
/* try to get result from the cache if possible */
- else if(shi->depth!=0 || !sample_occ_cache(tree, shi->co, shi->vno, shi->xs, shi->ys, shi->thread, shi->ao, shi->env, shi->indirect)) {
+ else if (shi->depth!=0 || !sample_occ_cache(tree, shi->co, shi->vno, shi->xs, shi->ys, shi->thread, shi->ao, shi->env, shi->indirect)) {
/* no luck, let's sample the occlusion */
exclude.obi= shi->obi - re->objectinstance;
exclude.facenr= shi->vlr->index;
@@ -1773,10 +1774,10 @@ void sample_occ(Render *re, ShadeInput *shi)
sample_occ_tree(re, tree, &exclude, shi->co, shi->vno, shi->thread, onlyshadow, shi->ao, shi->env, shi->indirect);
/* fill result into sample, each time */
- if(tree->cache) {
+ if (tree->cache) {
cache= &tree->cache[shi->thread];
- if(cache->sample && cache->step) {
+ if (cache->sample && cache->step) {
sample= &cache->sample[(shi->ys-cache->y)*cache->w + (shi->xs-cache->x)];
copy_v3_v3(sample->co, shi->co);
copy_v3_v3(sample->n, shi->vno);
@@ -1819,7 +1820,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
int *ro=NULL, *rp=NULL, *rz=NULL, onlyshadow;
int x, y, step = CACHE_STEP;
- if(!tree->cache)
+ if (!tree->cache)
return;
cache= &tree->cache[pa->thread];
@@ -1831,7 +1832,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
cache->sample= MEM_callocN(sizeof(OcclusionCacheSample)*cache->w*cache->h, "OcclusionCacheSample");
sample= cache->sample;
- if(re->osa) {
+ if (re->osa) {
rd= pa->rectdaps;
}
else {
@@ -1845,20 +1846,20 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
}
/* compute a sample at every step pixels */
- for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
- for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, sample++, rd++, ro++, rp++, rz++) {
- if(!(((x - pa->disprect.xmin + step) % step) == 0 || x == pa->disprect.xmax-1))
+ for (y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
+ for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, sample++, rd++, ro++, rp++, rz++) {
+ if (!(((x - pa->disprect.xmin + step) % step) == 0 || x == pa->disprect.xmax-1))
continue;
- if(!(((y - pa->disprect.ymin + step) % step) == 0 || y == pa->disprect.ymax-1))
+ if (!(((y - pa->disprect.ymin + step) % step) == 0 || y == pa->disprect.ymax-1))
continue;
- if(re->osa) {
- if(!*rd) continue;
+ if (re->osa) {
+ if (!*rd) continue;
shade_samples_fill_with_ps(ssamp, (PixStr *)(*rd), x, y);
}
else {
- if(!*rp) continue;
+ if (!*rp) continue;
ps.obi= *ro;
ps.facenr= *rp;
@@ -1867,7 +1868,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
}
shi= ssamp->shi;
- if(shi->vlr) {
+ if (shi->vlr) {
onlyshadow= (shi->mat->mode & MA_ONLYSHADOW);
exclude.obi= shi->obi - re->objectinstance;
exclude.facenr= shi->vlr->index;
@@ -1887,7 +1888,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
sample->filled= 1;
}
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
break;
}
}
@@ -1898,10 +1899,10 @@ void free_occ_samples(Render *re, RenderPart *pa)
OcclusionTree *tree= re->occlusiontree;
OcclusionCache *cache;
- if(tree->cache) {
+ if (tree->cache) {
cache= &tree->cache[pa->thread];
- if(cache->sample)
+ if (cache->sample)
MEM_freeN(cache->sample);
cache->w= 0;
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index b0bcf793ce5..e722859614a 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -161,16 +161,16 @@ static void stats_background(void *UNUSED(arg), RenderStats *rs)
fprintf(stdout, "Fra:%d Mem:%.2fM (%.2fM, peak %.2fM) ", rs->cfra,
megs_used_memory, mmap_used_memory, megs_peak_memory);
- if(rs->curfield)
+ if (rs->curfield)
fprintf(stdout, "Field %d ", rs->curfield);
- if(rs->curblur)
+ if (rs->curblur)
fprintf(stdout, "Blur %d ", rs->curblur);
- if(rs->infostr) {
+ if (rs->infostr) {
fprintf(stdout, "| %s", rs->infostr);
}
else {
- if(rs->tothalo)
+ if (rs->tothalo)
fprintf(stdout, "Sce: %s Ve:%d Fa:%d Ha:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->tothalo, rs->totlamp);
else
fprintf(stdout, "Sce: %s Ve:%d Fa:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->totlamp);
@@ -191,8 +191,8 @@ float *RE_RenderLayerGetPass(RenderLayer *rl, int passtype)
{
RenderPass *rpass;
- for(rpass=rl->passes.first; rpass; rpass= rpass->next)
- if(rpass->passtype== passtype)
+ for (rpass=rl->passes.first; rpass; rpass= rpass->next)
+ if (rpass->passtype== passtype)
return rpass->rect;
return NULL;
}
@@ -201,10 +201,10 @@ RenderLayer *RE_GetRenderLayer(RenderResult *rr, const char *name)
{
RenderLayer *rl;
- if(rr==NULL) return NULL;
+ if (rr==NULL) return NULL;
- for(rl= rr->layers.first; rl; rl= rl->next)
- if(strncmp(rl->name, name, RE_MAXNAME)==0)
+ for (rl= rr->layers.first; rl; rl= rl->next)
+ if (strncmp(rl->name, name, RE_MAXNAME)==0)
return rl;
return NULL;
}
@@ -218,7 +218,7 @@ RenderLayer *render_get_active_layer(Render *re, RenderResult *rr)
{
RenderLayer *rl= BLI_findlink(&rr->layers, re->r.actlay);
- if(rl)
+ if (rl)
return rl;
else
return rr->layers.first;
@@ -228,9 +228,9 @@ static int render_scene_needs_vector(Render *re)
{
SceneRenderLayer *srl;
- for(srl= re->scene->r.layers.first; srl; srl= srl->next)
- if(!(srl->layflag & SCE_LAY_DISABLE))
- if(srl->passflag & SCE_PASS_VECTOR)
+ for (srl= re->scene->r.layers.first; srl; srl= srl->next)
+ if (!(srl->layflag & SCE_LAY_DISABLE))
+ if (srl->passflag & SCE_PASS_VECTOR)
return 1;
return 0;
@@ -243,8 +243,8 @@ Render *RE_GetRender(const char *name)
Render *re;
/* search for existing renders */
- for(re= RenderGlobal.renderlist.first; re; re= re->next)
- if(strncmp(re->name, name, RE_MAXNAME)==0)
+ for (re= RenderGlobal.renderlist.first; re; re= re->next)
+ if (strncmp(re->name, name, RE_MAXNAME)==0)
break;
return re;
@@ -253,7 +253,7 @@ Render *RE_GetRender(const char *name)
/* if you want to know exactly what has been done */
RenderResult *RE_AcquireResultRead(Render *re)
{
- if(re) {
+ if (re) {
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_READ);
return re->result;
}
@@ -263,7 +263,7 @@ RenderResult *RE_AcquireResultRead(Render *re)
RenderResult *RE_AcquireResultWrite(Render *re)
{
- if(re) {
+ if (re) {
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
return re->result;
}
@@ -274,7 +274,7 @@ RenderResult *RE_AcquireResultWrite(Render *re)
void RE_SwapResult(Render *re, RenderResult **rr)
{
/* for keeping render buffers */
- if(re) {
+ if (re) {
SWAP(RenderResult*, re->result, *rr);
}
}
@@ -282,14 +282,14 @@ void RE_SwapResult(Render *re, RenderResult **rr)
void RE_ReleaseResult(Render *re)
{
- if(re)
+ if (re)
BLI_rw_mutex_unlock(&re->resultmutex);
}
/* displist.c util.... */
Scene *RE_GetScene(Render *re)
{
- if(re)
+ if (re)
return re->scene;
return NULL;
}
@@ -299,10 +299,10 @@ void RE_AcquireResultImage(Render *re, RenderResult *rr)
{
memset(rr, 0, sizeof(RenderResult));
- if(re) {
+ if (re) {
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_READ);
- if(re->result) {
+ if (re->result) {
RenderLayer *rl;
rr->rectx= re->result->rectx;
@@ -315,10 +315,10 @@ void RE_AcquireResultImage(Render *re, RenderResult *rr)
/* active layer */
rl= render_get_active_layer(re, re->result);
- if(rl) {
- if(rr->rectf==NULL)
+ if (rl) {
+ if (rr->rectf==NULL)
rr->rectf= rl->rectf;
- if(rr->rectz==NULL)
+ if (rr->rectz==NULL)
rr->rectz= RE_RenderLayerGetPass(rl, SCE_PASS_Z);
}
@@ -330,7 +330,7 @@ void RE_AcquireResultImage(Render *re, RenderResult *rr)
void RE_ReleaseResultImage(Render *re)
{
- if(re)
+ if (re)
BLI_rw_mutex_unlock(&re->resultmutex);
}
@@ -355,7 +355,7 @@ Render *RE_NewRender(const char *name)
/* only one render per name exists */
re= RE_GetRender(name);
- if(re==NULL) {
+ if (re==NULL) {
/* new render data struct */
re= MEM_callocN(sizeof(Render), "new render");
@@ -373,7 +373,7 @@ Render *RE_NewRender(const char *name)
}
/* called for new renders and when finishing rendering so
- * we calways have valid callbacks on a render */
+ * we always have valid callbacks on a render */
void RE_InitRenderCB(Render *re)
{
/* set default empty callbacks */
@@ -382,7 +382,7 @@ void RE_InitRenderCB(Render *re)
re->display_draw= result_rcti_nothing;
re->progress= float_nothing;
re->test_break= default_break;
- if(G.background)
+ if (G.background)
re->stats_draw= stats_background;
else
re->stats_draw= stats_nothing;
@@ -408,7 +408,7 @@ void RE_FreeRender(Render *re)
/* exit blender */
void RE_FreeAllRender(void)
{
- while(RenderGlobal.renderlist.first) {
+ while (RenderGlobal.renderlist.first) {
RE_FreeRender(RenderGlobal.renderlist.first);
}
}
@@ -427,31 +427,31 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
re->winx= winx;
re->winy= winy;
- if(disprect) {
+ if (disprect) {
re->disprect= *disprect;
re->rectx= disprect->xmax-disprect->xmin;
re->recty= disprect->ymax-disprect->ymin;
}
else {
- re->disprect.xmin= re->disprect.ymin= 0;
- re->disprect.xmax= winx;
- re->disprect.ymax= winy;
+ re->disprect.xmin = re->disprect.ymin = 0;
+ re->disprect.xmax = winx;
+ re->disprect.ymax = winy;
re->rectx= winx;
re->recty= winy;
}
- if(re->rectx < 2 || re->recty < 2 || (BKE_imtype_is_movie(rd->im_format.imtype) &&
+ if (re->rectx < 2 || re->recty < 2 || (BKE_imtype_is_movie(rd->im_format.imtype) &&
(re->rectx < 16 || re->recty < 16) )) {
BKE_report(re->reports, RPT_ERROR, "Image too small");
re->ok= 0;
return;
}
- if((re->r.mode & (R_OSA))==0)
+ if ((re->r.mode & (R_OSA))==0)
re->r.scemode &= ~R_FULL_SAMPLE;
#ifdef WITH_OPENEXR
- if(re->r.scemode & R_FULL_SAMPLE)
+ if (re->r.scemode & R_FULL_SAMPLE)
re->r.scemode |= R_EXR_TILE_FILE; /* enable automatic */
/* Until use_border is made compatible with save_buffers/full_sample, render without the later instead of not rendering at all.*/
@@ -465,18 +465,18 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
#endif
/* fullsample wants uniform osa levels */
- if(source && (re->r.scemode & R_FULL_SAMPLE)) {
+ if (source && (re->r.scemode & R_FULL_SAMPLE)) {
/* but, if source has no full sample we disable it */
- if((source->r.scemode & R_FULL_SAMPLE)==0)
+ if ((source->r.scemode & R_FULL_SAMPLE)==0)
re->r.scemode &= ~R_FULL_SAMPLE;
else
re->r.osa= re->osa= source->osa;
}
else {
/* check state variables, osa? */
- if(re->r.mode & (R_OSA)) {
+ if (re->r.mode & (R_OSA)) {
re->osa= re->r.osa;
- if(re->osa>16) re->osa= 16;
+ if (re->osa>16) re->osa= 16;
}
else re->osa= 0;
}
@@ -495,8 +495,8 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
/* if preview render, we try to keep old result */
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
- if(re->r.scemode & R_PREVIEWBUTS) {
- if(re->result && re->result->rectx==re->rectx && re->result->recty==re->recty);
+ if (re->r.scemode & R_PREVIEWBUTS) {
+ if (re->result && re->result->rectx==re->rectx && re->result->recty==re->recty);
else {
render_result_free(re->result);
re->result= NULL;
@@ -609,7 +609,7 @@ void RE_AddObject(Render *UNUSED(re), Object *UNUSED(ob))
static int render_display_draw_enabled(Render *re)
{
/* don't show preprocess for previewrender sss */
- if(re->sss_points)
+ if (re->sss_points)
return !(re->r.scemode & R_PREVIEWBUTS);
else
return 1;
@@ -621,27 +621,27 @@ static void *do_part_thread(void *pa_v)
RenderPart *pa= pa_v;
/* need to return nicely all parts on esc */
- if(R.test_break(R.tbh)==0) {
+ if (R.test_break(R.tbh)==0) {
- if(!R.sss_points && (R.r.scemode & R_FULL_SAMPLE))
+ if (!R.sss_points && (R.r.scemode & R_FULL_SAMPLE))
pa->result= render_result_new_full_sample(&R, &pa->fullresult, &pa->disprect, pa->crop, RR_USE_MEM);
else
pa->result= render_result_new(&R, &pa->disprect, pa->crop, RR_USE_MEM);
- if(R.sss_points)
+ if (R.sss_points)
zbufshade_sss_tile(pa);
- else if(R.osa)
+ else if (R.osa)
zbufshadeDA_tile(pa);
else
zbufshade_tile(pa);
/* merge too on break! */
- if(R.result->exrhandle) {
+ if (R.result->exrhandle) {
render_result_exr_file_merge(R.result, pa->result);
}
- else if(render_display_draw_enabled(&R)) {
+ else if (render_display_draw_enabled(&R)) {
/* on break, don't merge in result for preview renders, looks nicer */
- if(R.test_break(R.tbh) && (R.r.scemode & R_PREVIEWBUTS));
+ if (R.test_break(R.tbh) && (R.r.scemode & R_PREVIEWBUTS));
else render_result_merge(R.result, pa->result);
}
}
@@ -685,16 +685,16 @@ static RenderPart *find_next_pano_slice(Render *re, int *minx, rctf *viewplane)
*minx= re->winx;
/* most left part of the non-rendering parts */
- for(pa= re->parts.first; pa; pa= pa->next) {
- if(pa->ready==0 && pa->nr==0) {
- if(pa->disprect.xmin < *minx) {
+ for (pa= re->parts.first; pa; pa= pa->next) {
+ if (pa->ready==0 && pa->nr==0) {
+ if (pa->disprect.xmin < *minx) {
best= pa;
*minx= pa->disprect.xmin;
}
}
}
- if(best) {
+ if (best) {
float phi= panorama_pixel_rot(re);
R.panodxp= (re->winx - (best->disprect.xmin + best->disprect.xmax) )/2;
@@ -723,8 +723,8 @@ static RenderPart *find_next_part(Render *re, int minx)
long long int mindist= (long long int)re->winx * (long long int)re->winy;
/* find center of rendered parts, image center counts for 1 too */
- for(pa= re->parts.first; pa; pa= pa->next) {
- if(pa->ready) {
+ for (pa= re->parts.first; pa; pa= pa->next) {
+ if (pa->ready) {
centx+= (pa->disprect.xmin+pa->disprect.xmax)/2;
centy+= (pa->disprect.ymin+pa->disprect.ymax)/2;
tot++;
@@ -734,14 +734,14 @@ static RenderPart *find_next_part(Render *re, int minx)
centy/=tot;
/* closest of the non-rendering parts */
- for(pa= re->parts.first; pa; pa= pa->next) {
- if(pa->ready==0 && pa->nr==0) {
+ for (pa= re->parts.first; pa; pa= pa->next) {
+ if (pa->ready==0 && pa->nr==0) {
long long int distx= centx - (pa->disprect.xmin+pa->disprect.xmax)/2;
long long int disty= centy - (pa->disprect.ymin+pa->disprect.ymax)/2;
distx= (long long int)sqrt(distx*distx + disty*disty);
- if(distx<mindist) {
- if(re->r.mode & R_PANORAMA) {
- if(pa->disprect.xmin==minx) {
+ if (distx<mindist) {
+ if (re->r.mode & R_PANORAMA) {
+ if (pa->disprect.xmin==minx) {
best= pa;
mindist= distx;
}
@@ -776,12 +776,12 @@ static void threaded_tile_processor(Render *re)
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
/* first step; free the entire render result, make new, and/or prepare exr buffer saving */
- if(re->result==NULL || !(re->r.scemode & R_PREVIEWBUTS)) {
+ if (re->result==NULL || !(re->r.scemode & R_PREVIEWBUTS)) {
render_result_free(re->result);
- if(re->sss_points && render_display_draw_enabled(re))
+ if (re->sss_points && render_display_draw_enabled(re))
re->result= render_result_new(re, &re->disprect, 0, RR_USE_MEM);
- else if(re->r.scemode & R_FULL_SAMPLE)
+ else if (re->r.scemode & R_FULL_SAMPLE)
re->result= render_result_new_full_sample(re, &re->fullresult, &re->disprect, 0, RR_USE_EXR);
else
re->result= render_result_new(re, &re->disprect, 0,
@@ -790,14 +790,14 @@ static void threaded_tile_processor(Render *re)
BLI_rw_mutex_unlock(&re->resultmutex);
- if(re->result==NULL)
+ if (re->result==NULL)
return;
/* warning; no return here without closing exr file */
initparts(re);
- if(re->result->exrhandle)
+ if (re->result->exrhandle)
render_result_exr_file_begin(re);
BLI_init_threads(&threads, do_part_thread, re->r.threads);
@@ -809,16 +809,16 @@ static void threaded_tile_processor(Render *re)
R.test_break= thread_break;
/* timer loop demands to sleep when no parts are left, so we enter loop with a part */
- if(re->r.mode & R_PANORAMA)
+ if (re->r.mode & R_PANORAMA)
nextpa= find_next_pano_slice(re, &minx, &viewplane);
else
nextpa= find_next_part(re, 0);
- while(rendering) {
+ while (rendering) {
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
PIL_sleep_ms(50);
- else if(nextpa && BLI_available_threads(&threads)) {
+ else if (nextpa && BLI_available_threads(&threads)) {
drawtimer= 0;
nextpa->nr= counter++; /* for nicest part, and for stats */
nextpa->thread= BLI_available_thread_index(&threads); /* sample index */
@@ -826,8 +826,8 @@ static void threaded_tile_processor(Render *re)
nextpa= find_next_part(re, minx);
}
- else if(re->r.mode & R_PANORAMA) {
- if(nextpa==NULL && BLI_available_threads(&threads)==re->r.threads)
+ else if (re->r.mode & R_PANORAMA) {
+ if (nextpa==NULL && BLI_available_threads(&threads)==re->r.threads)
nextpa= find_next_pano_slice(re, &minx, &viewplane);
else {
PIL_sleep_ms(50);
@@ -842,13 +842,13 @@ static void threaded_tile_processor(Render *re)
/* check for ready ones to display, and if we need to continue */
rendering= 0;
hasdrawn= 0;
- for(pa= re->parts.first; pa; pa= pa->next) {
- if(pa->ready) {
+ for (pa= re->parts.first; pa; pa= pa->next) {
+ if (pa->ready) {
BLI_remove_thread(&threads, pa);
- if(pa->result) {
- if(render_display_draw_enabled(re))
+ if (pa->result) {
+ if (render_display_draw_enabled(re))
re->display_draw(re->ddh, pa->result, NULL);
print_part_stats(re, pa);
@@ -861,23 +861,23 @@ static void threaded_tile_processor(Render *re)
}
else {
rendering= 1;
- if(pa->nr && pa->result && drawtimer>20) {
- if(render_display_draw_enabled(re))
+ if (pa->nr && pa->result && drawtimer>20) {
+ if (render_display_draw_enabled(re))
re->display_draw(re->ddh, pa->result, &pa->result->renrect);
hasdrawn= 1;
}
}
}
- if(hasdrawn)
+ if (hasdrawn)
drawtimer= 0;
/* on break, wait for all slots to get freed */
- if( (g_break=re->test_break(re->tbh)) && BLI_available_threads(&threads)==re->r.threads)
+ if ( (g_break=re->test_break(re->tbh)) && BLI_available_threads(&threads)==re->r.threads)
rendering= 0;
}
- if(re->result->exrhandle) {
+ if (re->result->exrhandle) {
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
render_result_exr_file_end(re);
BLI_rw_mutex_unlock(&re->resultmutex);
@@ -904,7 +904,7 @@ static void add_freestyle(Render *re);
static void do_render_3d(Render *re)
{
/* try external */
- if(RE_engine_render(re, 0))
+ if (RE_engine_render(re, 0))
return;
/* internal */
@@ -913,24 +913,24 @@ static void do_render_3d(Render *re)
re->scene->r.subframe = re->mblur_offs + re->field_offs;
/* lock drawing in UI during data phase */
- if(re->draw_lock)
+ if (re->draw_lock)
re->draw_lock(re->dlh, 1);
/* make render verts/faces/halos/lamps */
- if(render_scene_needs_vector(re))
+ if (render_scene_needs_vector(re))
RE_Database_FromScene_Vectors(re, re->main, re->scene, re->lay);
else
RE_Database_FromScene(re, re->main, re->scene, re->lay, 1);
/* clear UI drawing locks */
- if(re->draw_lock)
+ if (re->draw_lock)
re->draw_lock(re->dlh, 0);
threaded_tile_processor(re);
/* do left-over 3d post effects (flares) */
- if(re->flag & R_HALO)
- if(!re->test_break(re->tbh))
+ if (re->flag & R_HALO)
+ if (!re->test_break(re->tbh))
add_halo_flare(re);
/* Freestyle */
@@ -951,17 +951,17 @@ static void addblur_rect_key(RenderResult *rr, float *rectf, float *rectf1, floa
int a, b, stride= 4*rr->rectx;
int len= stride*sizeof(float);
- for(a=0; a<rr->recty; a++) {
- if(blurfac==1.0f) {
+ for (a=0; a<rr->recty; a++) {
+ if (blurfac==1.0f) {
memcpy(rectf, rectf1, len);
}
else {
float *rf= rectf, *rf1= rectf1;
- for( b= rr->rectx; b>0; b--, rf+=4, rf1+=4) {
- if(rf1[3]<0.01f)
+ for ( b= rr->rectx; b>0; b--, rf+=4, rf1+=4) {
+ if (rf1[3]<0.01f)
rf[3]= mfac*rf[3];
- else if(rf[3]<0.01f) {
+ else if (rf[3]<0.01f) {
rf[0]= rf1[0];
rf[1]= rf1[1];
rf[2]= rf1[2];
@@ -987,14 +987,14 @@ static void addblur_rect(RenderResult *rr, float *rectf, float *rectf1, float bl
int a, b, stride= channels*rr->rectx;
int len= stride*sizeof(float);
- for(a=0; a<rr->recty; a++) {
- if(blurfac==1.0f) {
+ for (a=0; a<rr->recty; a++) {
+ if (blurfac==1.0f) {
memcpy(rectf, rectf1, len);
}
else {
float *rf= rectf, *rf1= rectf1;
- for( b= rr->rectx*channels; b>0; b--, rf++, rf1++) {
+ for ( b= rr->rectx*channels; b>0; b--, rf++, rf1++) {
rf[0]= mfac*rf[0] + blurfac*rf1[0];
}
}
@@ -1011,11 +1011,11 @@ static void merge_renderresult_blur(RenderResult *rr, RenderResult *brr, float b
RenderPass *rpass, *rpass1;
rl1= brr->layers.first;
- for(rl= rr->layers.first; rl && rl1; rl= rl->next, rl1= rl1->next) {
+ for (rl= rr->layers.first; rl && rl1; rl= rl->next, rl1= rl1->next) {
/* combined */
- if(rl->rectf && rl1->rectf) {
- if(key_alpha)
+ if (rl->rectf && rl1->rectf) {
+ if (key_alpha)
addblur_rect_key(rr, rl->rectf, rl1->rectf, blurfac);
else
addblur_rect(rr, rl->rectf, rl1->rectf, blurfac, 4);
@@ -1023,7 +1023,7 @@ static void merge_renderresult_blur(RenderResult *rr, RenderResult *brr, float b
/* passes are allocated in sync */
rpass1= rl1->passes.first;
- for(rpass= rl->passes.first; rpass && rpass1; rpass= rpass->next, rpass1= rpass1->next) {
+ for (rpass= rl->passes.first; rpass && rpass1; rpass= rpass->next, rpass1= rpass1->next) {
addblur_rect(rr, rpass->rect, rpass1->rect, blurfac, rpass->channels);
}
}
@@ -1040,7 +1040,7 @@ static void do_render_blur_3d(Render *re)
rres= render_result_new(re, &re->disprect, 0, RR_USE_MEM);
/* do the blur steps */
- while(blur--) {
+ while (blur--) {
re->mblur_offs = re->r.blurfac*((float)(re->r.mblur_samples-blur))/(float)re->r.mblur_samples;
re->i.curblur= re->r.mblur_samples-blur; /* stats */
@@ -1050,7 +1050,7 @@ static void do_render_blur_3d(Render *re)
blurfac= 1.0f/(float)(re->r.mblur_samples-blur);
merge_renderresult_blur(rres, re->result, blurfac, re->r.alphamode & R_ALPHAKEY);
- if(re->test_break(re->tbh)) break;
+ if (re->test_break(re->tbh)) break;
}
/* swap results */
@@ -1074,7 +1074,7 @@ static void interleave_rect(RenderResult *rr, float *rectf, float *rectf1, float
int a, stride= channels*rr->rectx;
int len= stride*sizeof(float);
- for(a=0; a<rr->recty; a+=2) {
+ for (a=0; a<rr->recty; a+=2) {
memcpy(rectf, rectf1, len);
rectf+= stride;
rectf1+= stride;
@@ -1092,16 +1092,16 @@ static void merge_renderresult_fields(RenderResult *rr, RenderResult *rr1, Rende
rl1= rr1->layers.first;
rl2= rr2->layers.first;
- for(rl= rr->layers.first; rl && rl1 && rl2; rl= rl->next, rl1= rl1->next, rl2= rl2->next) {
+ for (rl= rr->layers.first; rl && rl1 && rl2; rl= rl->next, rl1= rl1->next, rl2= rl2->next) {
/* combined */
- if(rl->rectf && rl1->rectf && rl2->rectf)
+ if (rl->rectf && rl1->rectf && rl2->rectf)
interleave_rect(rr, rl->rectf, rl1->rectf, rl2->rectf, 4);
/* passes are allocated in sync */
rpass1= rl1->passes.first;
rpass2= rl2->passes.first;
- for(rpass= rl->passes.first; rpass && rpass1 && rpass2; rpass= rpass->next, rpass1= rpass1->next, rpass2= rpass2->next) {
+ for (rpass= rl->passes.first; rpass && rpass1 && rpass2; rpass= rpass->next, rpass1= rpass1->next, rpass2= rpass2->next) {
interleave_rect(rr, rpass->rect, rpass1->rect, rpass2->rect, rpass->channels);
}
}
@@ -1124,7 +1124,7 @@ static void do_render_fields_3d(Render *re)
/* first field, we have to call camera routine for correct aspect and subpixel offset */
RE_SetCamera(re, camera);
- if(re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
+ if (re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
do_render_blur_3d(re);
else
do_render_3d(re);
@@ -1135,16 +1135,16 @@ static void do_render_fields_3d(Render *re)
BLI_rw_mutex_unlock(&re->resultmutex);
/* second field */
- if(!re->test_break(re->tbh)) {
+ if (!re->test_break(re->tbh)) {
re->i.curfield= 2; /* stats */
re->flag |= R_SEC_FIELD;
- if((re->r.mode & R_FIELDSTILL)==0) {
+ if ((re->r.mode & R_FIELDSTILL)==0) {
re->field_offs = 0.5f;
}
RE_SetCamera(re, camera);
- if(re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
+ if (re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
do_render_blur_3d(re);
else
do_render_3d(re);
@@ -1164,8 +1164,8 @@ static void do_render_fields_3d(Render *re)
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
re->result= render_result_new(re, &re->disprect, 0, RR_USE_MEM);
- if(rr2) {
- if(re->r.mode & R_ODDFIELD)
+ if (rr2) {
+ if (re->r.mode & R_ODDFIELD)
merge_renderresult_fields(re->result, rr2, rr1);
else
merge_renderresult_fields(re->result, rr1, rr2);
@@ -1190,7 +1190,7 @@ static void do_render_fields_blur_3d(Render *re)
{
Object *camera= RE_GetCamera(re);
/* also check for camera here */
- if(camera == NULL) {
+ if (camera == NULL) {
printf("ERROR: Cannot render, no camera\n");
G.afbreek= 1;
return;
@@ -1199,17 +1199,17 @@ static void do_render_fields_blur_3d(Render *re)
/* now use renderdata and camera to set viewplane */
RE_SetCamera(re, camera);
- if(re->r.mode & R_FIELDS)
+ if (re->r.mode & R_FIELDS)
do_render_fields_3d(re);
- else if(re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
+ else if (re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
do_render_blur_3d(re);
else
do_render_3d(re);
/* when border render, check if we have to insert it in black */
- if(re->result) {
- if(re->r.mode & R_BORDER) {
- if((re->r.mode & R_CROP)==0) {
+ if (re->result) {
+ if (re->r.mode & R_BORDER) {
+ if ((re->r.mode & R_CROP)==0) {
RenderResult *rres;
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
@@ -1219,9 +1219,9 @@ static void do_render_fields_blur_3d(Render *re)
/* this copying sequence could become function? */
/* weak is: it chances disprect from border */
- re->disprect.xmin= re->disprect.ymin= 0;
- re->disprect.xmax= re->winx;
- re->disprect.ymax= re->winy;
+ re->disprect.xmin = re->disprect.ymin = 0;
+ re->disprect.xmax = re->winx;
+ re->disprect.ymax = re->winy;
re->rectx= re->winx;
re->recty= re->winy;
@@ -1262,7 +1262,7 @@ static void render_scene(Render *re, Scene *sce, int cfra)
scene_camera_switch_update(sce);
/* exception: scene uses own size (unfinished code) */
- if(0) {
+ if (0) {
winx= (sce->r.size*sce->r.xsch)/100;
winy= (sce->r.size*sce->r.ysch)/100;
}
@@ -1295,13 +1295,13 @@ static int composite_needs_render(Scene *sce, int this_scene)
bNodeTree *ntree= sce->nodetree;
bNode *node;
- if(ntree==NULL) return 1;
- if(sce->use_nodes==0) return 1;
- if((sce->r.scemode & R_DOCOMP)==0) return 1;
+ if (ntree==NULL) return 1;
+ if (sce->use_nodes==0) return 1;
+ if ((sce->r.scemode & R_DOCOMP)==0) return 1;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS)
- if(this_scene==0 || node->id==NULL || node->id==&sce->id)
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type==CMP_NODE_R_LAYERS)
+ if (this_scene==0 || node->id==NULL || node->id==&sce->id)
return 1;
}
return 0;
@@ -1312,19 +1312,19 @@ static void tag_scenes_for_render(Render *re)
bNode *node;
Scene *sce;
- for(sce= re->main->scene.first; sce; sce= sce->id.next)
+ for (sce= re->main->scene.first; sce; sce= sce->id.next)
sce->id.flag &= ~LIB_DOIT;
- if(RE_GetCamera(re) && composite_needs_render(re->scene, 1))
+ if (RE_GetCamera(re) && composite_needs_render(re->scene, 1))
re->scene->id.flag |= LIB_DOIT;
- if(re->scene->nodetree==NULL) return;
+ if (re->scene->nodetree==NULL) return;
/* check for render-layers nodes using other scenes, we tag them LIB_DOIT */
- for(node= re->scene->nodetree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS) {
- if(node->id) {
- if(node->id != (ID *)re->scene)
+ for (node= re->scene->nodetree->nodes.first; node; node= node->next) {
+ if (node->type==CMP_NODE_R_LAYERS) {
+ if (node->id) {
+ if (node->id != (ID *)re->scene)
node->id->flag |= LIB_DOIT;
}
}
@@ -1338,16 +1338,16 @@ static void ntree_render_scenes(Render *re)
int cfra= re->scene->r.cfra;
int restore_scene= 0;
- if(re->scene->nodetree==NULL) return;
+ if (re->scene->nodetree==NULL) return;
tag_scenes_for_render(re);
/* now foreach render-result node tagged we do a full render */
/* results are stored in a way compisitor will find it */
- for(node= re->scene->nodetree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS) {
- if(node->id && node->id != (ID *)re->scene) {
- if(node->id->flag & LIB_DOIT) {
+ for (node= re->scene->nodetree->nodes.first; node; node= node->next) {
+ if (node->type==CMP_NODE_R_LAYERS) {
+ if (node->id && node->id != (ID *)re->scene) {
+ if (node->id->flag & LIB_DOIT) {
Scene *scene = (Scene*)node->id;
render_scene(re, scene, cfra);
@@ -1361,7 +1361,7 @@ static void ntree_render_scenes(Render *re)
}
/* restore scene if we rendered another last */
- if(restore_scene)
+ if (restore_scene)
set_scene_bg(re->main, re->scene);
}
@@ -1441,7 +1441,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
int sample;
/* interaction callbacks */
- if(ntree) {
+ if (ntree) {
ntree->stats_draw= render_composit_stats;
ntree->test_break= re->test_break;
ntree->progress= re->progress;
@@ -1456,7 +1456,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
/* we accumulate in here */
rectf= MEM_mapallocN(re->rectx*re->recty*sizeof(float)*4, "fullsample rgba");
- for(sample=0; sample<re->r.osa; sample++) {
+ for (sample=0; sample<re->r.osa; sample++) {
Render *re1;
RenderResult rres;
int x, y, mask;
@@ -1468,10 +1468,10 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
/* also function below assumes this */
tag_scenes_for_render(re);
- for(re1= RenderGlobal.renderlist.first; re1; re1= re1->next) {
- if(re1->scene->id.flag & LIB_DOIT) {
- if(re1->r.scemode & R_FULL_SAMPLE) {
- if(sample) {
+ for (re1= RenderGlobal.renderlist.first; re1; re1= re1->next) {
+ if (re1->scene->id.flag & LIB_DOIT) {
+ if (re1->r.scemode & R_FULL_SAMPLE) {
+ if (sample) {
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
render_result_exr_file_read(re1, sample);
if( re1->r.mode & R_EDGE_FRS)
@@ -1484,7 +1484,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
}
/* composite */
- if(ntree) {
+ if (ntree) {
ntreeCompositTagRender(re->scene);
ntreeCompositTagAnimated(ntree);
@@ -1498,15 +1498,15 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
mask= (1<<sample);
mask_array(mask, filt);
- for(y=0; y<re->recty; y++) {
+ for (y=0; y<re->recty; y++) {
float *rf= rectf + 4*y*re->rectx;
float *col= rres.rectf + 4*y*re->rectx;
- for(x=0; x<re->rectx; x++, rf+=4, col+=4) {
+ for (x=0; x<re->rectx; x++, rf+=4, col+=4) {
/* clamping to 1.0 is needed for correct AA */
- if(col[0]<0.0f) col[0]=0.0f; else if(col[0] > 1.0f) col[0]= 1.0f;
- if(col[1]<0.0f) col[1]=0.0f; else if(col[1] > 1.0f) col[1]= 1.0f;
- if(col[2]<0.0f) col[2]=0.0f; else if(col[2] > 1.0f) col[2]= 1.0f;
+ if (col[0]<0.0f) col[0]=0.0f; else if (col[0] > 1.0f) col[0]= 1.0f;
+ if (col[1]<0.0f) col[1]=0.0f; else if (col[1] > 1.0f) col[1]= 1.0f;
+ if (col[2]<0.0f) col[2]=0.0f; else if (col[2] > 1.0f) col[2]= 1.0f;
add_filt_fmask_coord(filt, col, rf, re->rectx, re->recty, x, y);
}
@@ -1515,18 +1515,18 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
RE_ReleaseResultImage(re);
/* show stuff */
- if(sample!=re->osa-1) {
+ if (sample!=re->osa-1) {
/* weak... the display callback wants an active renderlayer pointer... */
re->result->renlay= render_get_active_layer(re, re->result);
re->display_draw(re->ddh, re->result, NULL);
}
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
break;
}
/* clear interaction callbacks */
- if(ntree) {
+ if (ntree) {
ntree->stats_draw= NULL;
ntree->test_break= NULL;
ntree->progress= NULL;
@@ -1537,7 +1537,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
R.i.curfsa= 0;
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
- if(re->result->rectf)
+ if (re->result->rectf)
MEM_freeN(re->result->rectf);
re->result->rectf= rectf;
BLI_rw_mutex_unlock(&re->resultmutex);
@@ -1558,15 +1558,15 @@ void RE_MergeFullSample(Render *re, Main *bmain, Scene *sce, bNodeTree *ntree)
/* first call RE_ReadRenderResult on every renderlayer scene. this creates Render structs */
/* tag scenes unread */
- for(scene= re->main->scene.first; scene; scene= scene->id.next)
+ for (scene= re->main->scene.first; scene; scene= scene->id.next)
scene->id.flag |= LIB_DOIT;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type==CMP_NODE_R_LAYERS) {
Scene *nodescene= (Scene *)node->id;
- if(nodescene==NULL) nodescene= sce;
- if(nodescene->id.flag & LIB_DOIT) {
+ if (nodescene==NULL) nodescene= sce;
+ if (nodescene->id.flag & LIB_DOIT) {
nodescene->r.mode |= R_OSA; /* render struct needs tables */
RE_ReadRenderResult(sce, nodescene);
nodescene->id.flag &= ~LIB_DOIT;
@@ -1575,7 +1575,7 @@ void RE_MergeFullSample(Render *re, Main *bmain, Scene *sce, bNodeTree *ntree)
}
/* own render result should be read/allocated */
- if(re->scene->id.flag & LIB_DOIT) {
+ if (re->scene->id.flag & LIB_DOIT) {
RE_ReadRenderResult(re->scene, re->scene);
re->scene->id.flag &= ~LIB_DOIT;
}
@@ -1596,7 +1596,7 @@ static void do_render_composite_fields_blur_3d(Render *re)
/* INIT seeding, compositor can use random texture */
BLI_srandom(re->r.cfra);
- if(composite_needs_render(re->scene, 1)) {
+ if (composite_needs_render(re->scene, 1)) {
/* save memory... free all cached images */
ntreeFreeCache(ntree);
@@ -1616,25 +1616,25 @@ static void do_render_composite_fields_blur_3d(Render *re)
}
/* swap render result */
- if(re->r.scemode & R_SINGLE_LAYER) {
+ if (re->r.scemode & R_SINGLE_LAYER) {
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
render_result_single_layer_end(re);
BLI_rw_mutex_unlock(&re->resultmutex);
}
- if(!re->test_break(re->tbh)) {
+ if (!re->test_break(re->tbh)) {
- if(ntree) {
+ if (ntree) {
ntreeCompositTagRender(re->scene);
ntreeCompositTagAnimated(ntree);
}
- if(ntree && re->scene->use_nodes && re->r.scemode & R_DOCOMP) {
+ if (ntree && re->scene->use_nodes && re->r.scemode & R_DOCOMP) {
/* checks if there are render-result nodes that need scene */
- if((re->r.scemode & R_SINGLE_LAYER)==0)
+ if ((re->r.scemode & R_SINGLE_LAYER)==0)
ntree_render_scenes(re);
- if(!re->test_break(re->tbh)) {
+ if (!re->test_break(re->tbh)) {
ntree->stats_draw= render_composit_stats;
ntree->test_break= re->test_break;
ntree->progress= re->progress;
@@ -1649,7 +1649,7 @@ static void do_render_composite_fields_blur_3d(Render *re)
if (update_newframe)
scene_update_for_newframe(re->main, re->scene, re->lay);
- if(re->r.scemode & R_FULL_SAMPLE)
+ if (re->r.scemode & R_FULL_SAMPLE)
do_merge_fullsample(re, ntree);
else {
ntreeCompositExecTree(ntree, &re->r, G.background==0);
@@ -1661,7 +1661,7 @@ static void do_render_composite_fields_blur_3d(Render *re)
ntree->tbh= ntree->sdh= ntree->prh= NULL;
}
}
- else if(re->r.scemode & R_FULL_SAMPLE)
+ else if (re->r.scemode & R_FULL_SAMPLE)
do_merge_fullsample(re, NULL);
}
@@ -1710,20 +1710,21 @@ static void do_render_seq(Render * re)
re->i.cfra= cfra;
- if(recurs_depth==0) {
- /* otherwise sequencer animation isnt updated */
+ if (recurs_depth==0) {
+ /* otherwise sequencer animation isn't updated */
BKE_animsys_evaluate_all_animation(re->main, re->scene, (float)cfra); // XXX, was BKE_curframe(re->scene)
}
recurs_depth++;
- if((re->r.mode & R_BORDER) && (re->r.mode & R_CROP)==0) {
+ if ((re->r.mode & R_BORDER) && (re->r.mode & R_CROP)==0) {
/* if border rendering is used and cropping is disabled, final buffer should
* be as large as the whole frame */
context = seq_new_render_data(re->main, re->scene,
re->winx, re->winy,
100);
- } else {
+ }
+ else {
context = seq_new_render_data(re->main, re->scene,
re->result->rectx, re->result->recty,
100);
@@ -1737,7 +1738,7 @@ static void do_render_seq(Render * re)
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
- if(ibuf) {
+ if (ibuf) {
/* copy ibuf into combined pixel rect */
render_result_rect_from_ibuf(rr, &re->r, ibuf);
@@ -1759,7 +1760,7 @@ static void do_render_seq(Render * re)
re->r.scemode |= R_DOSEQ;
/* set overall progress of sequence rendering */
- if(re->r.efra!=re->r.sfra)
+ if (re->r.efra!=re->r.sfra)
re->progress(re->prh, (float)(cfra-re->r.sfra) / (re->r.efra-re->r.sfra));
else
re->progress(re->prh, 1.0f);
@@ -1777,12 +1778,12 @@ static void do_render_all_options(Render *re)
/* ensure no images are in memory from previous animated sequences */
BKE_image_all_free_anim_ibufs(re->r.cfra);
- if(RE_engine_render(re, 1)) {
+ if (RE_engine_render(re, 1)) {
/* in this case external render overrides all */
}
- else if(RE_seq_render_active(re->scene, &re->r)) {
+ else if (RE_seq_render_active(re->scene, &re->r)) {
/* note: do_render_seq() frees rect32 when sequencer returns float images */
- if(!re->test_break(re->tbh))
+ if (!re->test_break(re->tbh))
do_render_seq(re);
re->stats_draw(re->sdh, &re->i);
@@ -1797,7 +1798,7 @@ static void do_render_all_options(Render *re)
re->stats_draw(re->sdh, &re->i);
/* stamp image info here */
- if((re->r.stamp & R_STAMP_ALL) && (re->r.stamp & R_STAMP_DRAW)) {
+ if ((re->r.stamp & R_STAMP_ALL) && (re->r.stamp & R_STAMP_DRAW)) {
renderresult_stampinfo(re);
re->display_draw(re->ddh, re->result, NULL);
}
@@ -1810,20 +1811,21 @@ static int check_valid_camera(Scene *scene, Object *camera_override)
if (camera_override == NULL && scene->camera == NULL)
scene->camera= scene_find_camera(scene);
- if(scene->r.scemode&R_DOSEQ) {
- if(scene->ed) {
+ if (scene->r.scemode&R_DOSEQ) {
+ if (scene->ed) {
Sequence *seq= scene->ed->seqbase.first;
check_comp= 0;
- while(seq) {
- if(seq->type == SEQ_SCENE && seq->scene) {
- if(!seq->scene_camera) {
- if(!seq->scene->camera && !scene_find_camera(seq->scene)) {
- if(seq->scene == scene) {
+ while (seq) {
+ if (seq->type == SEQ_SCENE && seq->scene) {
+ if (!seq->scene_camera) {
+ if (!seq->scene->camera && !scene_find_camera(seq->scene)) {
+ if (seq->scene == scene) {
/* for current scene camera could be unneeded due to compisite nodes */
check_comp= 1;
- } else {
+ }
+ else {
/* for other scenes camera is necessary */
return 0;
}
@@ -1836,15 +1838,15 @@ static int check_valid_camera(Scene *scene, Object *camera_override)
}
}
- if(check_comp) { /* no sequencer or sequencer depends on compositor */
- if(scene->r.scemode&R_DOCOMP && scene->use_nodes) {
+ if (check_comp) { /* no sequencer or sequencer depends on compositor */
+ if (scene->r.scemode&R_DOCOMP && scene->use_nodes) {
bNode *node= scene->nodetree->nodes.first;
- while(node) {
- if(node->type == CMP_NODE_R_LAYERS) {
+ while (node) {
+ if (node->type == CMP_NODE_R_LAYERS) {
Scene *sce= node->id ? (Scene*)node->id : scene;
- if(!sce->camera && !scene_find_camera(sce)) {
+ if (!sce->camera && !scene_find_camera(sce)) {
/* all render layers nodes need camera */
return 0;
}
@@ -1852,7 +1854,8 @@ static int check_valid_camera(Scene *scene, Object *camera_override)
node= node->next;
}
- } else {
+ }
+ else {
return (camera_override != NULL || scene->camera != NULL);
}
}
@@ -1864,15 +1867,15 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
{
SceneRenderLayer *srl;
- if(scene->r.mode & R_BORDER) {
- if(scene->r.border.xmax <= scene->r.border.xmin ||
+ if (scene->r.mode & R_BORDER) {
+ if (scene->r.border.xmax <= scene->r.border.xmin ||
scene->r.border.ymax <= scene->r.border.ymin) {
BKE_report(reports, RPT_ERROR, "No border area selected.");
return 0;
}
}
- if(scene->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) {
+ if (scene->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) {
char str[FILE_MAX];
render_result_exr_file_path(scene, 0, str);
@@ -1883,7 +1886,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
}
/* no fullsample and edge */
- if((scene->r.scemode & R_FULL_SAMPLE) && (scene->r.mode & R_EDGE)) {
+ if ((scene->r.scemode & R_FULL_SAMPLE) && (scene->r.mode & R_EDGE)) {
BKE_report(reports, RPT_ERROR, "Full Sample doesn't support Edge Enhance");
return 0;
}
@@ -1892,27 +1895,27 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
else
scene->r.scemode &= ~R_FULL_SAMPLE; /* clear to be sure */
- if(scene->r.scemode & R_DOCOMP) {
- if(scene->use_nodes) {
+ if (scene->r.scemode & R_DOCOMP) {
+ if (scene->use_nodes) {
bNodeTree *ntree= scene->nodetree;
bNode *node;
- if(ntree==NULL) {
+ if (ntree==NULL) {
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)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->type==CMP_NODE_COMPOSITE)
break;
- if(node==NULL) {
+ if (node==NULL) {
BKE_report(reports, RPT_ERROR, "No Render Output Node in Scene");
return 0;
}
- if(scene->r.scemode & R_FULL_SAMPLE) {
- if(composite_needs_render(scene, 0)==0) {
+ if (scene->r.scemode & R_FULL_SAMPLE) {
+ if (composite_needs_render(scene, 0)==0) {
BKE_report(reports, RPT_ERROR, "Full Sample AA not supported without 3d rendering");
return 0;
}
@@ -1921,7 +1924,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
}
/* check valid camera, without camera render is OK (compo, seq) */
- if(!check_valid_camera(scene, camera_override)) {
+ if (!check_valid_camera(scene, camera_override)) {
BKE_report(reports, RPT_ERROR, "No camera");
return 0;
}
@@ -1930,24 +1933,24 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
object_camera_mode(&scene->r, camera_override ? camera_override : scene->camera);
/* forbidden combinations */
- if(scene->r.mode & R_PANORAMA) {
- if(scene->r.mode & R_ORTHO) {
+ if (scene->r.mode & R_PANORAMA) {
+ if (scene->r.mode & R_ORTHO) {
BKE_report(reports, RPT_ERROR, "No Ortho render possible for Panorama");
return 0;
}
}
/* layer flag tests */
- if(scene->r.scemode & R_SINGLE_LAYER) {
+ if (scene->r.scemode & R_SINGLE_LAYER) {
srl= BLI_findlink(&scene->r.layers, scene->r.actlay);
/* force layer to be enabled */
srl->layflag &= ~SCE_LAY_DISABLE;
}
- for(srl= scene->r.layers.first; srl; srl= srl->next)
- if(!(srl->layflag & SCE_LAY_DISABLE))
+ for (srl= scene->r.layers.first; srl; srl= srl->next)
+ if (!(srl->layflag & SCE_LAY_DISABLE))
break;
- if(srl==NULL) {
+ if (srl==NULL) {
BKE_report(reports, RPT_ERROR, "All RenderLayers are disabled");
return 0;
}
@@ -1957,13 +1960,14 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
static void validate_render_settings(Render *re)
{
- if(re->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) {
+ if (re->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) {
/* no osa + fullsample won't work... */
- if(re->r.osa==0)
+ if (re->r.osa==0)
re->r.scemode &= ~R_FULL_SAMPLE;
- } else re->r.scemode &= ~R_FULL_SAMPLE; /* clear to be sure */
+ }
+ else re->r.scemode &= ~R_FULL_SAMPLE; /* clear to be sure */
- if(RE_engine_is_external(re)) {
+ if (RE_engine_is_external(re)) {
/* not supported yet */
re->r.scemode &= ~(R_EXR_TILE_FILE|R_FULL_SAMPLE);
re->r.mode &= ~(R_FIELDS|R_MBLUR);
@@ -2001,17 +2005,17 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc
winy= (scene->r.size*scene->r.ysch)/100;
/* we always render smaller part, inserting it in larger image is compositor bizz, it uses disprect for it */
- if(scene->r.mode & R_BORDER) {
- disprect.xmin= scene->r.border.xmin*winx;
- disprect.xmax= scene->r.border.xmax*winx;
+ if (scene->r.mode & R_BORDER) {
+ disprect.xmin = scene->r.border.xmin*winx;
+ disprect.xmax = scene->r.border.xmax*winx;
- disprect.ymin= scene->r.border.ymin*winy;
- disprect.ymax= scene->r.border.ymax*winy;
+ disprect.ymin = scene->r.border.ymin*winy;
+ disprect.ymax = scene->r.border.ymax*winy;
}
else {
- disprect.xmin= disprect.ymin= 0;
- disprect.xmax= winx;
- disprect.ymax= winy;
+ disprect.xmin = disprect.ymin = 0;
+ disprect.xmax = winx;
+ disprect.ymax = winy;
}
re->main= bmain;
@@ -2020,7 +2024,7 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc
re->lay= lay;
/* not too nice, but it survives anim-border render */
- if(anim) {
+ if (anim) {
re->disprect= disprect;
return 1;
}
@@ -2033,19 +2037,19 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc
* can be later set as render profile option
* and default for background render.
*/
- if(0) {
+ if (0) {
/* make sure dynamics are up to date */
update_physics_cache(re, scene, anim_init);
}
- if(srl || scene->r.scemode & R_SINGLE_LAYER) {
+ if (srl || scene->r.scemode & R_SINGLE_LAYER) {
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
render_result_single_layer_begin(re);
BLI_rw_mutex_unlock(&re->resultmutex);
}
RE_InitState(re, NULL, &scene->r, srl, winx, winy, &disprect);
- if(!re->ok) /* if an error was printed, abort */
+ if (!re->ok) /* if an error was printed, abort */
return 0;
/* initstate makes new result, have to send changed tags around */
@@ -2072,15 +2076,15 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
scene->r.cfra= frame;
- if(render_initialize_from_main(re, bmain, scene, srl, camera_override, lay, 0, 0)) {
+ if (render_initialize_from_main(re, bmain, scene, srl, camera_override, lay, 0, 0)) {
MEM_reset_peak_memory();
BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE);
do_render_all_options(re);
- if(write_still && !G.afbreek) {
- if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (write_still && !G.afbreek) {
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
/* operator checks this but in case its called from elsewhere */
printf("Error: cant write single images with a movie format!\n");
}
@@ -2096,6 +2100,8 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
}
+ BLI_exec_cb(re->main, (ID *)scene, G.afbreek ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE);
+
/* UGLY WARNING */
G.rendering= 0;
}
@@ -2119,11 +2125,11 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
RE_AcquireResultImage(re, &rres);
/* write movie or image */
- if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
int dofree = 0;
unsigned int *rect32 = (unsigned int *)rres.rect32;
/* note; the way it gets 32 bits rects is weak... */
- if(rres.rect32 == NULL) {
+ if (rres.rect32 == NULL) {
rect32 = MEM_mapallocN(sizeof(int)*rres.rectx*rres.recty, "temp 32 bits rect");
RE_ResultGet32(re, rect32);
dofree = 1;
@@ -2131,19 +2137,19 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
ok= mh->append_movie(&re->r, scene->r.sfra, scene->r.cfra, (int *)rect32,
rres.rectx, rres.recty, re->reports);
- if(dofree) {
+ if (dofree) {
MEM_freeN(rect32);
}
printf("Append frame %d", scene->r.cfra);
}
else {
- if(name_override)
+ if (name_override)
BLI_strncpy(name, name_override, sizeof(name));
else
BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE);
- if(re->r.im_format.imtype==R_IMF_IMTYPE_MULTILAYER) {
- if(re->result) {
+ if (re->r.im_format.imtype==R_IMF_IMTYPE_MULTILAYER) {
+ if (re->result) {
RE_WriteRenderResult(re->reports, re->result, name, scene->r.im_format.exr_codec);
printf("Saved: %s", name);
}
@@ -2153,17 +2159,17 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format);
- if(ok==0) {
+ if (ok==0) {
printf("Render error: cannot save %s\n", name);
}
else printf("Saved: %s", name);
/* optional preview images for exr */
- if(ok && scene->r.im_format.imtype==R_IMF_IMTYPE_OPENEXR && (scene->r.im_format.flag & R_IMF_FLAG_PREVIEW_JPG)) {
+ if (ok && scene->r.im_format.imtype==R_IMF_IMTYPE_OPENEXR && (scene->r.im_format.flag & R_IMF_FLAG_PREVIEW_JPG)) {
ImageFormatData imf= scene->r.im_format;
imf.imtype= R_IMF_IMTYPE_JPEG90;
- if(BLI_testextensie(name, ".exr"))
+ if (BLI_testextensie(name, ".exr"))
name[strlen(name)-4]= 0;
BKE_add_image_extension(name, R_IMF_IMTYPE_JPEG90);
ibuf->planes= 24;
@@ -2197,7 +2203,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
int nfra, totrendered= 0, totskipped= 0;
/* do not fully call for each frame, it initializes & pops output window */
- if(!render_initialize_from_main(re, bmain, scene, NULL, camera_override, lay, 0, 1))
+ if (!render_initialize_from_main(re, bmain, scene, NULL, camera_override, lay, 0, 1))
return;
/* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */
@@ -2206,8 +2212,8 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
re->flag |= R_ANIMATION;
- if(BKE_imtype_is_movie(scene->r.im_format.imtype))
- if(!mh->start_movie(scene, &re->r, re->rectx, re->recty, re->reports))
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype))
+ if (!mh->start_movie(scene, &re->r, re->rectx, re->recty, re->reports))
G.afbreek= 1;
if (mh->get_next_frame) {
@@ -2221,28 +2227,29 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
do_render_all_options(re);
totrendered++;
- if(re->test_break(re->tbh) == 0) {
- if(!do_write_image_or_movie(re, bmain, scene, mh, NULL))
+ if (re->test_break(re->tbh) == 0) {
+ if (!do_write_image_or_movie(re, bmain, scene, mh, NULL))
G.afbreek= 1;
}
- if(G.afbreek == 0) {
+ if (G.afbreek == 0) {
BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
}
}
else {
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
G.afbreek= 1;
}
}
- } else {
- for(nfra= sfra, scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) {
+ }
+ else {
+ for (nfra= sfra, scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) {
char name[FILE_MAX];
/* only border now, todo: camera lens. (ton) */
render_initialize_from_main(re, bmain, scene, NULL, camera_override, lay, 1, 0);
- if(nfra!=scene->r.cfra) {
+ if (nfra!=scene->r.cfra) {
/*
* Skip this frame, but update for physics and particles system.
* From convertblender.c:
@@ -2250,7 +2257,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
*/
unsigned int updatelay;
- if(re->lay & 0xFF000000)
+ if (re->lay & 0xFF000000)
updatelay= re->lay & 0xFF000000;
else
updatelay= re->lay;
@@ -2262,16 +2269,16 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
nfra+= tfra;
/* Touch/NoOverwrite options are only valid for image's */
- if(BKE_imtype_is_movie(scene->r.im_format.imtype) == 0) {
- if(scene->r.mode & (R_NO_OVERWRITE | R_TOUCH))
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype) == 0) {
+ if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH))
BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE);
- if(scene->r.mode & R_NO_OVERWRITE && BLI_exists(name)) {
+ if (scene->r.mode & R_NO_OVERWRITE && BLI_exists(name)) {
printf("skipping existing frame \"%s\"\n", name);
totskipped++;
continue;
}
- if(scene->r.mode & R_TOUCH && !BLI_exists(name)) {
+ if (scene->r.mode & R_TOUCH && !BLI_exists(name)) {
BLI_make_existing_file(name); /* makes the dir if its not there */
BLI_file_touch(name);
}
@@ -2286,17 +2293,17 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
do_render_all_options(re);
totrendered++;
- if(re->test_break(re->tbh) == 0) {
- if(!G.afbreek)
- if(!do_write_image_or_movie(re, bmain, scene, mh, NULL))
+ if (re->test_break(re->tbh) == 0) {
+ if (!G.afbreek)
+ if (!do_write_image_or_movie(re, bmain, scene, mh, NULL))
G.afbreek= 1;
}
else
G.afbreek= 1;
- if(G.afbreek==1) {
+ if (G.afbreek==1) {
/* remove touched file */
- if(BKE_imtype_is_movie(scene->r.im_format.imtype) == 0) {
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype) == 0) {
if (scene->r.mode & R_TOUCH && BLI_exists(name) && BLI_file_size(name) == 0) {
BLI_delete(name, 0, 0);
}
@@ -2305,23 +2312,25 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
break;
}
- if(G.afbreek==0) {
+ if (G.afbreek==0) {
BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
}
}
}
/* end movie */
- if(BKE_imtype_is_movie(scene->r.im_format.imtype))
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype))
mh->end_movie();
- if(totskipped && totrendered == 0)
+ if (totskipped && totrendered == 0)
BKE_report(re->reports, RPT_INFO, "No frames rendered, skipped to not overwrite");
scene->r.cfra= cfrao;
re->flag &= ~R_ANIMATION;
+ BLI_exec_cb(re->main, (ID *)scene, G.afbreek ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE);
+
/* UGLY WARNING */
G.rendering= 0;
}
@@ -2360,25 +2369,25 @@ int RE_ReadRenderResult(Scene *scene, Scene *scenode)
winy= (scene->r.size*scene->r.ysch)/100;
/* only in movie case we render smaller part */
- if(scene->r.mode & R_BORDER) {
- disprect.xmin= scene->r.border.xmin*winx;
- disprect.xmax= scene->r.border.xmax*winx;
+ if (scene->r.mode & R_BORDER) {
+ disprect.xmin = scene->r.border.xmin*winx;
+ disprect.xmax = scene->r.border.xmax*winx;
- disprect.ymin= scene->r.border.ymin*winy;
- disprect.ymax= scene->r.border.ymax*winy;
+ disprect.ymin = scene->r.border.ymin*winy;
+ disprect.ymax = scene->r.border.ymax*winy;
}
else {
- disprect.xmin= disprect.ymin= 0;
- disprect.xmax= winx;
- disprect.ymax= winy;
+ disprect.xmin = disprect.ymin = 0;
+ disprect.xmax = winx;
+ disprect.ymax = winy;
}
- if(scenode)
+ if (scenode)
scene= scenode;
/* get render: it can be called from UI with draw callbacks */
re= RE_GetRender(scene->id.name);
- if(re==NULL)
+ if (re==NULL)
re= RE_NewRender(scene->id.name);
RE_InitState(re, NULL, &scene->r, NULL, winx, winy, &disprect);
re->scene= scene;
@@ -2394,43 +2403,47 @@ void RE_set_max_threads(int threads)
{
if (threads==0) {
RenderGlobal.threads = BLI_system_thread_count();
- } else if(threads>=1 && threads<=BLENDER_MAX_THREADS) {
+ }
+ else if (threads>=1 && threads<=BLENDER_MAX_THREADS) {
RenderGlobal.threads= threads;
- } else {
+ }
+ else {
printf("Error, threads has to be in range 0-%d\n", BLENDER_MAX_THREADS);
}
}
void RE_init_threadcount(Render *re)
{
- if(RenderGlobal.threads >= 1) { /* only set as an arg in background mode */
+ if (RenderGlobal.threads >= 1) { /* only set as an arg in background mode */
re->r.threads= MIN2(RenderGlobal.threads, BLENDER_MAX_THREADS);
- } else if ((re->r.mode & R_FIXED_THREADS)==0 || RenderGlobal.threads == 0) { /* Automatic threads */
+ }
+ else if ((re->r.mode & R_FIXED_THREADS)==0 || RenderGlobal.threads == 0) { /* Automatic threads */
re->r.threads = BLI_system_thread_count();
}
}
/* loads in image into a result, size must match
- * x/y offsets are only used on a partial copy when dimensions dont match */
+ * x/y offsets are only used on a partial copy when dimensions don't match */
void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char *filename, int x, int y)
{
ImBuf *ibuf = IMB_loadiffname(filename, IB_rect);
- if(ibuf && (ibuf->rect || ibuf->rect_float)) {
+ if (ibuf && (ibuf->rect || ibuf->rect_float)) {
if (ibuf->x == layer->rectx && ibuf->y == layer->recty) {
- if(ibuf->rect_float==NULL)
+ if (ibuf->rect_float==NULL)
IMB_float_from_rect(ibuf);
memcpy(layer->rectf, ibuf->rect_float, sizeof(float)*4*layer->rectx*layer->recty);
- } else {
+ }
+ else {
if ((ibuf->x - x >= layer->rectx) && (ibuf->y - y >= layer->recty)) {
ImBuf *ibuf_clip;
- if(ibuf->rect_float==NULL)
+ if (ibuf->rect_float==NULL)
IMB_float_from_rect(ibuf);
ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat);
- if(ibuf_clip) {
+ if (ibuf_clip) {
IMB_rectcpy(ibuf_clip, ibuf, 0,0, x,y, layer->rectx, layer->recty);
memcpy(layer->rectf, ibuf_clip->rect_float, sizeof(float)*4*layer->rectx*layer->recty);
@@ -2454,7 +2467,7 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char
void RE_result_load_from_file(RenderResult *result, ReportList *reports, const char *filename)
{
- if(!render_result_exr_file_read_path(result, filename)) {
+ if (!render_result_exr_file_read_path(result, filename)) {
BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'\n", filename);
return;
}
@@ -2471,7 +2484,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
int maxX=0,maxY=0,i=0;
char filepath[FILE_MAX];
- if(env->cube[1]==NULL) {
+ if (env->cube[1]==NULL) {
BKE_report(reports, RPT_ERROR, "There is no generated environment map available to save");
return 0;
}
@@ -2513,7 +2526,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
IMB_freeImBuf(ibuf);
- if(ok) {
+ if (ok) {
return TRUE;
}
else {
diff --git a/source/blender/render/intern/source/pixelblending.c b/source/blender/render/intern/source/pixelblending.c
index 0a8a59a860c..48ce611fed7 100644
--- a/source/blender/render/intern/source/pixelblending.c
+++ b/source/blender/render/intern/source/pixelblending.c
@@ -119,28 +119,28 @@ void addalphaAddfacFloat(float *dest, float *source, char addfac)
/* blend colors*/
c= (m * dest[0]) + source[0];
#ifdef RE_FLOAT_COLOR_CLIPPING
- if(c >= RE_FULL_COLOR_FLOAT) dest[0] = RE_FULL_COLOR_FLOAT;
+ if (c >= RE_FULL_COLOR_FLOAT) dest[0] = RE_FULL_COLOR_FLOAT;
else
#endif
dest[0]= c;
c= (m * dest[1]) + source[1];
#ifdef RE_FLOAT_COLOR_CLIPPING
- if(c >= RE_FULL_COLOR_FLOAT) dest[1] = RE_FULL_COLOR_FLOAT;
+ if (c >= RE_FULL_COLOR_FLOAT) dest[1] = RE_FULL_COLOR_FLOAT;
else
#endif
dest[1]= c;
c= (m * dest[2]) + source[2];
#ifdef RE_FLOAT_COLOR_CLIPPING
- if(c >= RE_FULL_COLOR_FLOAT) dest[2] = RE_FULL_COLOR_FLOAT;
+ if (c >= RE_FULL_COLOR_FLOAT) dest[2] = RE_FULL_COLOR_FLOAT;
else
#endif
dest[2]= c;
c= (m * dest[3]) + source[3];
#ifdef RE_ALPHA_CLIPPING
- if(c >= RE_FULL_COLOR_FLOAT) dest[3] = RE_FULL_COLOR_FLOAT;
+ if (c >= RE_FULL_COLOR_FLOAT) dest[3] = RE_FULL_COLOR_FLOAT;
else
#endif
dest[3]= c;
@@ -172,12 +172,12 @@ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w)
maskand= (mask & 255);
maskshift= (mask >>8);
- for(j=2; j>=0; j--) {
+ for (j=2; j>=0; j--) {
a= j;
val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if(val!=0.0f) {
+ if (val!=0.0f) {
rb1[0]+= val*r;
rb1[1]+= val*g;
rb1[2]+= val*b;
@@ -186,7 +186,7 @@ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w)
a+=3;
val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if(val!=0.0f) {
+ if (val!=0.0f) {
rb2[0]+= val*r;
rb2[1]+= val*g;
rb2[2]+= val*b;
@@ -195,7 +195,7 @@ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w)
a+=3;
val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if(val!=0.0f) {
+ if (val!=0.0f) {
rb3[0]+= val*r;
rb3[1]+= val*g;
rb3[2]+= val*b;
@@ -216,7 +216,7 @@ void mask_array(unsigned int mask, float filt[][3])
unsigned int maskshift= (mask >>8);
int a, j;
- for(j=2; j>=0; j--) {
+ for (j=2; j>=0; j--) {
a= j;
@@ -269,7 +269,7 @@ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w,
fpoin[1][2]= fpoin[1][1] + 4;
fpoin[2][2]= fpoin[2][1] + 4;
- if(y==0) {
+ if (y==0) {
fpoin[0][0]= fpoin[1][0];
fpoin[0][1]= fpoin[1][1];
fpoin[0][2]= fpoin[1][2];
@@ -278,7 +278,7 @@ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w,
lfilt[0][1]= filt[2][1];
lfilt[0][2]= filt[2][2];
}
- else if(y==col_h-1) {
+ else if (y==col_h-1) {
fpoin[2][0]= fpoin[1][0];
fpoin[2][1]= fpoin[1][1];
fpoin[2][2]= fpoin[1][2];
@@ -288,7 +288,7 @@ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w,
lfilt[2][2]= filt[0][2];
}
- if(x==0) {
+ if (x==0) {
fpoin[2][0]= fpoin[2][1];
fpoin[1][0]= fpoin[1][1];
fpoin[0][0]= fpoin[0][1];
@@ -297,7 +297,7 @@ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w,
lfilt[1][0]= filt[1][2];
lfilt[0][0]= filt[0][2];
}
- else if(x==row_w-1) {
+ else if (x==row_w-1) {
fpoin[2][2]= fpoin[2][1];
fpoin[1][2]= fpoin[1][1];
fpoin[0][2]= fpoin[0][1];
@@ -309,7 +309,7 @@ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w,
/* loop unroll */
-#define MASKFILT(i, j) val= lfilt[i][j]; if(val!=0.0f) {float *fp= fpoin[i][j]; fp[0]+= val*r; fp[1]+= val*g; fp[2]+= val*b; fp[3]+= val*al; }
+#define MASKFILT(i, j) val= lfilt[i][j]; if (val!=0.0f) {float *fp= fpoin[i][j]; fp[0]+= val*r; fp[1]+= val*g; fp[2]+= val*b; fp[3]+= val*al; }
MASKFILT(0, 0)
MASKFILT(0, 1)
@@ -338,27 +338,27 @@ void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row
maskand= (mask & 255);
maskshift= (mask >>8);
- for(j=2; j>=0; j--) {
+ for (j=2; j>=0; j--) {
a= j;
val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if(val!=0.0f) {
- for(i= 0; i<pixsize; i++)
+ if (val!=0.0f) {
+ for (i= 0; i<pixsize; i++)
rb1[i]+= val*in[i];
}
a+=3;
val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if(val!=0.0f) {
- for(i= 0; i<pixsize; i++)
+ if (val!=0.0f) {
+ for (i= 0; i<pixsize; i++)
rb2[i]+= val*in[i];
}
a+=3;
val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if(val!=0.0f) {
- for(i= 0; i<pixsize; i++)
+ if (val!=0.0f) {
+ for (i= 0; i<pixsize; i++)
rb3[i]+= val*in[i];
}
@@ -373,7 +373,7 @@ void addalphaAddFloat(float *dest, float *source)
{
/* Makes me wonder whether this is required... */
- if( dest[3] < RE_EMPTY_COLOR_FLOAT) {
+ if ( dest[3] < RE_EMPTY_COLOR_FLOAT) {
dest[0] = source[0];
dest[1] = source[1];
dest[2] = source[2];
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 965abb361fd..826a31e17a8 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -89,14 +89,14 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
vn= har->no;
- for(go=R.lights.first; go; go= go->next) {
+ for (go=R.lights.first; go; go= go->next) {
lar= go->lampren;
/* test for lamplayer */
- if(lar->mode & LA_LAYER) if((lar->lay & har->lay)==0) continue;
+ if (lar->mode & LA_LAYER) if ((lar->lay & har->lay)==0) continue;
/* lampdist cacluation */
- if(lar->type==LA_SUN || lar->type==LA_HEMI) {
+ if (lar->type==LA_SUN || lar->type==LA_HEMI) {
copy_v3_v3(lv, lar->vec);
lampdist= 1.0;
}
@@ -111,11 +111,11 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
/* ld is re-used further on (texco's) */
- if(lar->mode & LA_QUAD) {
+ if (lar->mode & LA_QUAD) {
t= 1.0;
- if(lar->ld1>0.0f)
+ if (lar->ld1>0.0f)
t= lar->dist/(lar->dist+lar->ld1*ld);
- if(lar->ld2>0.0f)
+ if (lar->ld2>0.0f)
t*= lar->distkw/(lar->distkw+lar->ld2*ld*ld);
lampdist= t;
@@ -124,9 +124,9 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
lampdist= (lar->dist/(lar->dist+ld));
}
- if(lar->mode & LA_SPHERE) {
+ if (lar->mode & LA_SPHERE) {
t= lar->dist - ld;
- if(t<0.0f) continue;
+ if (t<0.0f) continue;
t/= lar->dist;
lampdist*= (t);
@@ -138,7 +138,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
lacol[1]= lar->g;
lacol[2]= lar->b;
- if(lar->mode & LA_TEXTURE) {
+ if (lar->mode & LA_TEXTURE) {
ShadeInput shi;
/* Warning, This is not that nice, and possibly a bit slow,
@@ -152,10 +152,10 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
do_lamp_tex(lar, lv, &shi, lacol, LA_TEXTURE);
}
- if(lar->type==LA_SPOT) {
+ if (lar->type==LA_SPOT) {
- if(lar->mode & LA_SQUARE) {
- if(lv[0]*lar->vec[0]+lv[1]*lar->vec[1]+lv[2]*lar->vec[2]>0.0f) {
+ if (lar->mode & LA_SQUARE) {
+ if (lv[0]*lar->vec[0]+lv[1]*lar->vec[1]+lv[2]*lar->vec[2]>0.0f) {
float x, lvrot[3];
/* rotate view to lampspace */
@@ -174,25 +174,25 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
}
t= lar->spotsi;
- if(inpr<t) continue;
+ if (inpr<t) continue;
else {
t= inpr-t;
soft= 1.0;
- if(t<lar->spotbl && lar->spotbl!=0.0f) {
+ if (t<lar->spotbl && lar->spotbl!=0.0f) {
/* soft area */
i= t/lar->spotbl;
t= i*i;
soft= (3.0f*t-2.0f*t*i);
inpr*= soft;
}
- if(lar->mode & LA_ONLYSHADOW) {
- /* if(ma->mode & MA_SHADOW) { */
+ if (lar->mode & LA_ONLYSHADOW) {
+ /* if (ma->mode & MA_SHADOW) { */
/* dot product positive: front side face! */
inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2];
- if(inp>0.0f) {
+ if (inp>0.0f) {
/* testshadowbuf==0.0 : 100% shadow */
shadfac = testshadowbuf(&R, lar->shb, rco, dco, dco, inp, 0.0f);
- if( shadfac>0.0f ) {
+ if ( shadfac>0.0f ) {
shadfac*= inp*soft*lar->energy;
ir -= shadfac;
ig -= shadfac;
@@ -205,7 +205,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
}
lampdist*=inpr;
}
- if(lar->mode & LA_ONLYSHADOW) continue;
+ if (lar->mode & LA_ONLYSHADOW) continue;
}
@@ -217,32 +217,32 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
i= inp;
- if(lar->type==LA_HEMI) {
+ if (lar->type==LA_HEMI) {
i= 0.5f*i+0.5f;
}
- if(i>0.0f) {
+ if (i>0.0f) {
i*= lampdist;
}
/* shadow */
- if(i> -0.41f) { /* heuristic valua! */
- if(lar->shb) {
+ if (i> -0.41f) { /* heuristic valua! */
+ if (lar->shb) {
shadfac = testshadowbuf(&R, lar->shb, rco, dco, dco, inp, 0.0f);
- if(shadfac==0.0f) continue;
+ if (shadfac==0.0f) continue;
i*= shadfac;
}
}
- if(i>0.0f) {
+ if (i>0.0f) {
ir+= i*lacol[0];
ig+= i*lacol[1];
ib+= i*lacol[2];
}
}
- if(ir<0.0f) ir= 0.0f;
- if(ig<0.0f) ig= 0.0f;
- if(ib<0.0f) ib= 0.0f;
+ if (ir<0.0f) ir= 0.0f;
+ if (ig<0.0f) ig= 0.0f;
+ if (ib<0.0f) ib= 0.0f;
col_r[0]*= ir;
col_r[1]*= ig;
@@ -260,11 +260,11 @@ static float haloZtoDist(int z)
{
float zco = 0;
- if(z >= 0x7FFFFF)
+ if (z >= 0x7FFFFF)
return 10e10;
else {
zco = (float)z/(float)0x7FFFFF;
- if(R.r.mode & R_ORTHO)
+ if (R.r.mode & R_ORTHO)
return (R.winmat[3][2] - zco*R.winmat[3][3])/(R.winmat[2][2]);
else
return (R.winmat[3][2])/(R.winmat[2][2] - R.winmat[2][3]*zco);
@@ -287,8 +287,8 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz,
float t, zn, radist, ringf=0.0f, linef=0.0f, alpha, si, co;
int a;
- if(R.wrld.mode & WO_MIST) {
- if(har->type & HA_ONLYSKY) {
+ if (R.wrld.mode & WO_MIST) {
+ if (har->type & HA_ONLYSKY) {
/* stars but no mist */
alpha= har->alfa;
}
@@ -299,37 +299,37 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz,
}
else alpha= har->alfa;
- if(alpha==0.0f)
+ if (alpha==0.0f)
return 0;
/* soften the halo if it intersects geometry */
- if(har->mat && har->mat->mode & MA_HALO_SOFT) {
+ if (har->mat && har->mat->mode & MA_HALO_SOFT) {
float segment_length, halo_depth, distance_from_z /* , visible_depth */ /* UNUSED */, soften;
/* calculate halo depth */
segment_length= har->hasize*sasqrt(1.0f - dist/(har->rad*har->rad));
halo_depth= 2.0f*segment_length;
- if(halo_depth < FLT_EPSILON)
+ if (halo_depth < FLT_EPSILON)
return 0;
/* calculate how much of this depth is visible */
distance_from_z = haloZtoDist(zz) - haloZtoDist(har->zs);
/* visible_depth = halo_depth; */ /* UNUSED */
- if(distance_from_z < segment_length) {
+ if (distance_from_z < segment_length) {
soften= (segment_length + distance_from_z)/halo_depth;
/* apply softening to alpha */
- if(soften < 1.0f)
+ if (soften < 1.0f)
alpha *= soften;
- if(alpha <= 0.0f)
+ if (alpha <= 0.0f)
return 0;
}
}
else {
/* not a soft halo. use the old softening code */
/* halo being intersected? */
- if(har->zs> zz-har->zd) {
+ if (har->zs> zz-har->zd) {
t= ((float)(zz-har->zs))/(float)har->zd;
alpha*= sqrtf(sqrtf(t));
}
@@ -338,31 +338,31 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz,
radist= sqrt(dist);
/* watch it: not used nicely: flarec is set at zero in pixstruct */
- if(flarec) har->pixels+= (int)(har->rad-radist);
+ if (flarec) har->pixels+= (int)(har->rad-radist);
- if(har->ringc) {
+ if (har->ringc) {
float *rc, fac;
int ofs;
/* per ring an antialised circle */
ofs= har->seed;
- for(a= har->ringc; a>0; a--, ofs+=2) {
+ for (a= har->ringc; a>0; a--, ofs+=2) {
rc= hashvectf + (ofs % 768);
fac= fabsf( rc[1]*(har->rad*fabsf(rc[0]) - radist) );
- if(fac< 1.0f) {
+ if (fac< 1.0f) {
ringf+= (1.0f-fac);
}
}
}
- if(har->type & HA_VECT) {
+ if (har->type & HA_VECT) {
dist= fabsf( har->cos*(yn) - har->sin*(xn) )/har->rad;
- if(dist>1.0f) dist= 1.0f;
- if(har->tex) {
+ if (dist>1.0f) dist= 1.0f;
+ if (har->tex) {
zn= har->sin*xn - har->cos*yn;
yn= har->cos*xn + har->sin*yn;
xn= zn;
@@ -370,49 +370,49 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz,
}
else dist= dist/har->radsq;
- if(har->type & HA_FLARECIRC) {
+ if (har->type & HA_FLARECIRC) {
dist= 0.5+fabs(dist-0.5f);
}
- if(har->hard>=30) {
+ if (har->hard>=30) {
dist= sqrt(dist);
- if(har->hard>=40) {
+ if (har->hard>=40) {
dist= sinf(dist*(float)M_PI_2);
- if(har->hard>=50) {
+ if (har->hard>=50) {
dist= sqrt(dist);
}
}
}
- else if(har->hard<20) dist*=dist;
+ else if (har->hard<20) dist*=dist;
- if(dist < 1.0f)
+ if (dist < 1.0f)
dist= (1.0f-dist);
else
dist= 0.0f;
- if(har->linec) {
+ if (har->linec) {
float *rc, fac;
int ofs;
/* per starpoint an antialiased line */
ofs= har->seed;
- for(a= har->linec; a>0; a--, ofs+=3) {
+ for (a= har->linec; a>0; a--, ofs+=3) {
rc= hashvectf + (ofs % 768);
fac= fabs( (xn)*rc[0]+(yn)*rc[1]);
- if(fac< 1.0f )
+ if (fac< 1.0f )
linef+= (1.0f-fac);
}
linef*= dist;
}
- if(har->starpoints) {
+ if (har->starpoints) {
float ster, angle;
/* rotation */
angle= atan2(yn, xn);
@@ -424,15 +424,15 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz,
angle= (co*xn+si*yn)*(co*yn-si*xn);
ster= fabs(angle);
- if(ster>1.0f) {
+ if (ster>1.0f) {
ster= (har->rad)/(ster);
- if(ster<1.0f) dist*= sqrtf(ster);
+ if (ster<1.0f) dist*= sqrtf(ster);
}
}
/* disputable optimize... (ton) */
- if(dist<=0.00001f)
+ if (dist<=0.00001f)
return 0;
dist*= alpha;
@@ -441,7 +441,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz,
/* The color is either the rgb spec-ed by the user, or extracted from */
/* the texture */
- if(har->tex) {
+ if (har->tex) {
col[0]= har->r;
col[1]= har->g;
col[2]= har->b;
@@ -458,41 +458,41 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz,
col[0]= dist*har->r;
col[1]= dist*har->g;
col[2]= dist*har->b;
- if(har->type & HA_XALPHA) col[3]= dist*dist;
+ if (har->type & HA_XALPHA) col[3]= dist*dist;
else col[3]= dist;
}
- if(har->mat) {
- if(har->mat->mode & MA_HALO_SHADE) {
+ if (har->mat) {
+ if (har->mat->mode & MA_HALO_SHADE) {
/* we test for lights because of preview... */
- if(R.lights.first) render_lighting_halo(har, col);
+ if (R.lights.first) render_lighting_halo(har, col);
}
/* Next, we do the line and ring factor modifications. */
- if(linef!=0.0f) {
+ if (linef!=0.0f) {
Material *ma= har->mat;
col[0]+= linef * ma->specr;
col[1]+= linef * ma->specg;
col[2]+= linef * ma->specb;
- if(har->type & HA_XALPHA) col[3]+= linef*linef;
+ if (har->type & HA_XALPHA) col[3]+= linef*linef;
else col[3]+= linef;
}
- if(ringf!=0.0f) {
+ if (ringf!=0.0f) {
Material *ma= har->mat;
col[0]+= ringf * ma->mirr;
col[1]+= ringf * ma->mirg;
col[2]+= ringf * ma->mirb;
- if(har->type & HA_XALPHA) col[3]+= ringf*ringf;
+ if (har->type & HA_XALPHA) col[3]+= ringf*ringf;
else col[3]+= ringf;
}
}
/* alpha requires clip, gives black dots */
- if(col[3] > 1.0f)
+ if (col[3] > 1.0f)
col[3]= 1.0f;
return 1;
@@ -510,15 +510,15 @@ void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const
skyflag = WO_ZENUP;
/* Some view vector stuff. */
- if(R.wrld.skytype & WO_SKYREAL) {
+ if (R.wrld.skytype & WO_SKYREAL) {
blend = dot_v3v3(view, R.grvec);
- if(blend<0.0f) skyflag= 0;
+ if (blend<0.0f) skyflag= 0;
blend= fabs(blend);
}
- else if(R.wrld.skytype & WO_SKYPAPER) {
+ else if (R.wrld.skytype & WO_SKYPAPER) {
blend= 0.5f + 0.5f * view[1];
}
else {
@@ -531,9 +531,9 @@ void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const
/* Careful: SKYTEX and SKYBLEND are NOT mutually exclusive! If */
/* SKYBLEND is active, the texture and color blend are added. */
- if(R.wrld.skytype & WO_SKYTEX) {
+ if (R.wrld.skytype & WO_SKYTEX) {
copy_v3_v3(lo, view);
- if(R.wrld.skytype & WO_SKYREAL) {
+ if (R.wrld.skytype & WO_SKYREAL) {
mul_m3_v3(R.imat, lo);
@@ -543,15 +543,16 @@ void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const
do_sky_tex(rco, lo, dxyview, hor, zen, &blend, skyflag, thread);
}
- if(blend>1.0f) blend= 1.0f;
+ if (blend>1.0f) blend= 1.0f;
blendm= 1.0f-blend;
/* No clipping, no conversion! */
- if(R.wrld.skytype & WO_SKYBLEND) {
+ if (R.wrld.skytype & WO_SKYBLEND) {
col_r[0] = (blendm*hor[0] + blend*zen[0]);
col_r[1] = (blendm*hor[1] + blend*zen[1]);
col_r[2] = (blendm*hor[2] + blend*zen[2]);
- } else {
+ }
+ else {
/* Done when a texture was grabbed. */
col_r[0]= hor[0];
col_r[1]= hor[1];
@@ -567,13 +568,13 @@ void shadeSunView(float col_r[3], const float view[3])
float sview[3];
int do_init= 1;
- for(go=R.lights.first; go; go= go->next) {
+ for (go=R.lights.first; go; go= go->next) {
lar= go->lampren;
- if(lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_SKY)){
+ if (lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_SKY)) {
float sun_collector[3];
float colorxyz[3];
- if(do_init) {
+ if (do_init) {
normalize_v3_v3(sview, view);
mul_m3_v3(R.imat, sview);
@@ -608,7 +609,7 @@ void shadeSkyPixel(float collector[4], float fx, float fy, short thread)
float fac;
- if((R.wrld.skytype & (WO_SKYBLEND+WO_SKYTEX))==0) {
+ if ((R.wrld.skytype & (WO_SKYBLEND+WO_SKYTEX))==0) {
/* 1. solid color */
copy_v3_v3(collector, &R.wrld.horr);
@@ -618,7 +619,7 @@ void shadeSkyPixel(float collector[4], float fx, float fy, short thread)
/* 2. */
/* This one true because of the context of this routine */
- if(R.wrld.skytype & WO_SKYPAPER) {
+ if (R.wrld.skytype & WO_SKYPAPER) {
view[0]= -1.0f + 2.0f*(fx/(float)R.winx);
view[1]= -1.0f + 2.0f*(fy/(float)R.winy);
view[2]= 0.0;
@@ -630,7 +631,7 @@ void shadeSkyPixel(float collector[4], float fx, float fy, short thread)
calc_view_vector(view, fx, fy);
fac= normalize_v3(view);
- if(R.wrld.skytype & WO_SKYTEX) {
+ if (R.wrld.skytype & WO_SKYTEX) {
dxyview[0]= -R.viewdx/fac;
dxyview[1]= -R.viewdy/fac;
}
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index 1904d5dce63..5d4f9db9a02 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -151,7 +151,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
for (i=0, pa=psys->particles; i < total_particles; i++, pa++) {
state.time = cfra;
- if(psys_get_particle_state(&sim, i, &state, 0)) {
+ if (psys_get_particle_state(&sim, i, &state, 0)) {
copy_v3_v3(partco, state.co);
@@ -159,7 +159,8 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
mul_m4_v3(ob->imat, partco);
else if (pd->psys_cache_space == TEX_PD_OBJECTLOC) {
sub_v3_v3(partco, ob->loc);
- } else {
+ }
+ else {
/* TEX_PD_WORLDSPACE */
}
@@ -175,7 +176,8 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
if (i < psys->totpart) {
pa_time = (cfra - pa->time)/pa->lifetime;
- } else {
+ }
+ else {
ChildParticle *cpa= (psys->child + i) - psys->totpart;
float pa_birthtime, pa_dietime;
@@ -191,7 +193,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
BLI_bvhtree_balance(pd->point_tree);
dm->release(dm);
- if(psys->lattice){
+ if (psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice=0;
}
@@ -214,7 +216,7 @@ static void pointdensity_cache_object(Render *re, PointDensity *pd, Object *ob)
pd->point_tree = BLI_bvhtree_new(pd->totpoints, 0.0, 4, 6);
- for(i=0; i < pd->totpoints; i++, mvert++) {
+ for (i=0; i < pd->totpoints; i++, mvert++) {
float co[3];
copy_v3_v3(co, mvert->co);
@@ -243,7 +245,7 @@ void cache_pointdensity(Render *re, Tex *tex)
{
PointDensity *pd = tex->pd;
- if(!pd)
+ if (!pd)
return;
if (pd->point_tree) {
@@ -293,14 +295,14 @@ void make_pointdensities(Render *re)
{
Tex *tex;
- if(re->scene->r.scemode & R_PREVIEWBUTS)
+ if (re->scene->r.scemode & R_PREVIEWBUTS)
return;
re->i.infostr= "Caching Point Densities";
re->stats_draw(re->sdh, &re->i);
for (tex= re->main->tex.first; tex; tex= tex->id.next) {
- if(tex->id.us && tex->type==TEX_POINTDENSITY) {
+ if (tex->id.us && tex->type==TEX_POINTDENSITY) {
cache_pointdensity(re, tex);
}
}
@@ -313,11 +315,11 @@ void free_pointdensities(Render *re)
{
Tex *tex;
- if(re->scene->r.scemode & R_PREVIEWBUTS)
+ if (re->scene->r.scemode & R_PREVIEWBUTS)
return;
for (tex= re->main->tex.first; tex; tex= tex->id.next) {
- if(tex->id.us && tex->type==TEX_POINTDENSITY) {
+ if (tex->id.us && tex->type==TEX_POINTDENSITY) {
free_pointdensity(re, tex);
}
}
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 9272dcf5b30..1222dd121a7 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -87,7 +87,7 @@ 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;
@@ -99,7 +99,7 @@ static RayObject* RE_rayobject_create(Render *re, int type, int size)
{
RayObject * res = NULL;
- if(type == R_RAYSTRUCTURE_AUTO)
+ if (type == R_RAYSTRUCTURE_AUTO)
{
//TODO
//if(detect_simd())
@@ -111,7 +111,7 @@ static RayObject* RE_rayobject_create(Render *re, int type, int size)
}
#ifndef __SSE__
- if(type == R_RAYSTRUCTURE_SIMD_SVBVH || type == R_RAYSTRUCTURE_SIMD_QBVH)
+ if (type == R_RAYSTRUCTURE_SIMD_SVBVH || type == R_RAYSTRUCTURE_SIMD_QBVH)
{
puts("Warning: Using VBVH (SSE was disabled at compile time)");
type = R_RAYSTRUCTURE_VBVH;
@@ -119,22 +119,22 @@ static RayObject* RE_rayobject_create(Render *re, int type, int size)
#endif
- if(type == R_RAYSTRUCTURE_OCTREE) //TODO dynamic ocres
+ if (type == R_RAYSTRUCTURE_OCTREE) //TODO dynamic ocres
res = RE_rayobject_octree_create(re->r.ocres, size);
- else if(type == R_RAYSTRUCTURE_BLIBVH)
+ else if (type == R_RAYSTRUCTURE_BLIBVH)
res = RE_rayobject_blibvh_create(size);
- else if(type == R_RAYSTRUCTURE_VBVH)
+ else if (type == R_RAYSTRUCTURE_VBVH)
res = RE_rayobject_vbvh_create(size);
- else if(type == R_RAYSTRUCTURE_SIMD_SVBVH)
+ else if (type == R_RAYSTRUCTURE_SIMD_SVBVH)
res = RE_rayobject_svbvh_create(size);
- else if(type == R_RAYSTRUCTURE_SIMD_QBVH)
+ else if (type == R_RAYSTRUCTURE_SIMD_QBVH)
res = RE_rayobject_qbvh_create(size);
else
res = RE_rayobject_vbvh_create(size); //Fallback
- if(res)
- RE_rayobject_config_control( res, re );
+ if (res)
+ RE_rayobject_config_control(res, re);
return res;
}
@@ -148,36 +148,36 @@ 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;
@@ -189,7 +189,7 @@ void freeraytree(Render *re)
RayCounter sum;
memset( &sum, 0, sizeof(sum) );
int i;
- for(i=0; i<BLENDER_MAX_THREADS; i++)
+ for (i=0; i<BLENDER_MAX_THREADS; i++)
RE_RC_MERGE(&sum, re_rc_counter+i);
RE_RC_INFO(&sum);
}
@@ -199,8 +199,8 @@ void freeraytree(Render *re)
static int is_raytraceable_vlr(Render *re, VlakRen *vlr)
{
/* note: volumetric must be tracable, wire must not */
- if((re->flag & R_BAKE_TRACE) || (vlr->flag & R_TRACEBLE) || (vlr->mat->material_type == MA_TYPE_VOLUME))
- if(vlr->mat->material_type != MA_TYPE_WIRE)
+ if ((re->flag & R_BAKE_TRACE) || (vlr->flag & R_TRACEBLE) || (vlr->mat->material_type == MA_TYPE_VOLUME))
+ if (vlr->mat->material_type != MA_TYPE_WIRE)
return 1;
return 0;
}
@@ -210,13 +210,13 @@ static int is_raytraceable(Render *re, ObjectInstanceRen *obi)
int v;
ObjectRen *obr = obi->obr;
- if(re->excludeob && obr->ob == re->excludeob)
+ if (re->excludeob && obr->ob == re->excludeob)
return 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))
return 1;
}
@@ -232,7 +232,7 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
// update render stats
ObjectRen *obr = obi->obr;
- if(obr->raytree == NULL)
+ if (obr->raytree == NULL)
{
RayObject *raytree;
RayFace *face = NULL;
@@ -241,10 +241,10 @@ 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))
+ if (is_raytraceable_vlr(re, vlr))
faces++;
}
@@ -253,17 +253,17 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
//Create Ray cast accelaration structure
raytree = RE_rayobject_create( re, re->r.raytrace_structure, faces );
- if( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
+ if ( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
vlakprimitive = obr->rayprimitives = (VlakPrimitive*)MEM_callocN(faces*sizeof(VlakPrimitive), "ObjectRen primitives");
else
face = obr->rayfaces = (RayFace*)MEM_callocN(faces*sizeof(RayFace), "ObjectRen faces");
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 ) );
@@ -279,38 +279,38 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
RE_rayobject_done( raytree );
/* in case of cancel during build, raytree is not usable */
- if(test_break(re))
+ if (test_break(re))
RE_rayobject_free(raytree);
else
obr->raytree= raytree;
}
- if(obr->raytree) {
- if((obi->flag & R_TRANSFORMED) && obi->raytree == NULL)
+ if (obr->raytree) {
+ 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 );
}
}
- if(obi->raytree) return obi->raytree;
+ if (obi->raytree) return obi->raytree;
return obi->obr->raytree;
}
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)
+ if (faces > 4)
return 1;
}
}
@@ -328,8 +328,8 @@ static void makeraytree_single(Render *re)
VlakPrimitive *vlakprimitive = NULL;
int faces = 0, obs = 0, special = 0;
- for(obi=re->instancetable.first; obi; obi=obi->next)
- if(is_raytraceable(re, obi))
+ for (obi=re->instancetable.first; obi; obi=obi->next)
+ if (is_raytraceable(re, obi))
{
ObjectRen *obr = obi->obr;
obs++;
@@ -339,16 +339,16 @@ 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))
+ if (is_raytraceable_vlr(re, vlr))
faces++;
}
}
}
- if(faces + special == 0)
+ if (faces + special == 0)
{
re->raytree = RE_rayobject_empty_create();
return;
@@ -357,7 +357,7 @@ static void makeraytree_single(Render *re)
//Create raytree
raytree = re->raytree = RE_rayobject_create( re, re->r.raytrace_structure, faces+special );
- if( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
+ if ( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
{
vlakprimitive = re->rayprimitives = (VlakPrimitive*)MEM_callocN(faces*sizeof(VlakPrimitive), "Raytrace vlak-primitives");
}
@@ -365,16 +365,16 @@ static void makeraytree_single(Render *re)
face = re->rayfaces = (RayFace*)MEM_callocN(faces*sizeof(RayFace), "Render ray faces");
}
- for(obi=re->instancetable.first; obi; obi=obi->next)
- if(is_raytraceable(re, obi))
+ for (obi=re->instancetable.first; obi; obi=obi->next)
+ if (is_raytraceable(re, obi))
{
- if(test_break(re))
+ if (test_break(re))
break;
if (has_special_rayobject(re, obi)) {
RayObject *obj = makeraytree_object(re, obi);
- if(test_break(re))
+ if (test_break(re))
break;
if (obj)
@@ -384,12 +384,12 @@ 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)) {
@@ -400,12 +400,12 @@ 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);
- if(RE_rayface_isQuad(face))
+ if (RE_rayface_isQuad(face))
mul_m4_v3(obi->mat, face->v4);
}
@@ -417,7 +417,7 @@ 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);
@@ -436,7 +436,7 @@ void makeraytree(Render *re)
/* disable options not yet supported by octree,
* they might actually never be supported (unless people really need it) */
- if(re->r.raytrace_structure == R_RAYSTRUCTURE_OCTREE)
+ if (re->r.raytrace_structure == R_RAYSTRUCTURE_OCTREE)
re->r.raytrace_options &= ~( R_RAYTRACE_USE_INSTANCES | R_RAYTRACE_USE_LOCAL_COORDS);
makeraytree_single(re);
@@ -452,7 +452,7 @@ 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;
@@ -460,7 +460,7 @@ void makeraytree(Render *re)
}
re->maxdist = dot_v3v3(sub, sub);
- if(re->maxdist > 0.0f) re->maxdist= sqrt(re->maxdist);
+ if (re->maxdist > 0.0f) re->maxdist= sqrt(re->maxdist);
re->i.infostr= "Raytree finished";
re->stats_draw(re->sdh, &re->i);
@@ -471,7 +471,7 @@ void makeraytree(Render *re)
#endif
}
-/* if(shi->osatex) */
+/* if (shi->osatex) */
static void shade_ray_set_derivative(ShadeInput *shi)
{
float detsh, t00, t10, t01, t11;
@@ -481,7 +481,7 @@ static void shade_ray_set_derivative(ShadeInput *shi)
axis_dominant_v3(&axis1, &axis2, shi->facenor);
/* compute u,v and derivatives */
- if(shi->obi->flag & R_TRANSFORMED) {
+ if (shi->obi->flag & R_TRANSFORMED) {
float v1[3], v2[3], v3[3];
mul_v3_m3v3(v1, shi->obi->nmat, shi->v1->co);
@@ -535,7 +535,7 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr)
shi->mat= vlr->mat;
shade_input_init_material(shi);
- if(is->isect==2)
+ if (is->isect==2)
shade_input_set_triangle_i(shi, obi, vlr, 0, 2, 3);
else
shade_input_set_triangle_i(shi, obi, vlr, 0, 1, 2);
@@ -544,21 +544,22 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr)
shi->v= is->v;
shi->dx_u= shi->dx_v= shi->dy_u= shi->dy_v= 0.0f;
- if(shi->osatex)
+ if (shi->osatex)
shade_ray_set_derivative(shi);
shade_input_set_normals(shi);
shade_input_set_shade_texco(shi);
if (shi->mat->material_type == MA_TYPE_VOLUME) {
- if(ELEM(is->mode, RE_RAY_SHADOW, RE_RAY_SHADOW_TRA)) {
+ if (ELEM(is->mode, RE_RAY_SHADOW, RE_RAY_SHADOW_TRA)) {
shade_volume_shadow(shi, shr, is);
- } else {
+ }
+ else {
shade_volume_outside(shi, shr);
}
}
- else if(is->mode==RE_RAY_SHADOW_TRA) {
+ else if (is->mode==RE_RAY_SHADOW_TRA) {
/* temp hack to prevent recursion */
- if(shi->nodes==0 && shi->mat->nodetree && shi->mat->use_nodes) {
+ if (shi->nodes==0 && shi->mat->nodetree && shi->mat->use_nodes) {
ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
shi->mat= vlr->mat; /* shi->mat is being set in nodetree */
}
@@ -566,7 +567,7 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr)
shade_color(shi, shr);
}
else {
- if(shi->mat->nodetree && shi->mat->use_nodes) {
+ if (shi->mat->nodetree && shi->mat->use_nodes) {
ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
shi->mat= vlr->mat; /* shi->mat is being set in nodetree */
}
@@ -588,15 +589,15 @@ static int refraction(float refract[3], const float n[3], const float view[3], f
dot = dot_v3v3(view, n);
- if(dot>0.0f) {
+ if (dot>0.0f) {
index = 1.0f/index;
fac= 1.0f - (1.0f - dot*dot)*index*index;
- if(fac<= 0.0f) return 0;
+ if (fac<= 0.0f) return 0;
fac= -dot*index + sqrtf(fac);
}
else {
fac= 1.0f - (1.0f - dot*dot)*index*index;
- if(fac<= 0.0f) return 0;
+ if (fac<= 0.0f) return 0;
fac= -dot*index - sqrtf(fac);
}
@@ -622,7 +623,7 @@ static void reflection(float ref[3], float n[3], const float view[3], const floa
/* test phong normals, then we should prevent vector going to the back */
f1= dot_v3v3(ref, orn);
- if(f1>0.0f) {
+ if (f1>0.0f) {
f1+= 0.01f;
ref[0]-= f1*orn[0];
ref[1]-= f1*orn[1];
@@ -672,7 +673,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr)
d= shi->mat->tx_limit;
p = shi->mat->tx_falloff;
- if(p < 0.0f) p= 0.0f;
+ if (p < 0.0f) p= 0.0f;
else if (p > 10.0f) p= 10.0f;
shr->alpha *= powf(d, p);
@@ -688,7 +689,8 @@ static void ray_fadeout_endcolor(float col[3], ShadeInput *origshi, ShadeInput *
/* un-intersected rays get either rendered material color or sky color */
if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOMAT) {
copy_v3_v3(col, shr->combined);
- } else if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOSKY) {
+ }
+ else if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOSKY) {
copy_v3_v3(shi->view, vec);
normalize_v3(shi->view);
@@ -729,7 +731,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
isec.orig.face = vlr;
RE_RC_INIT(isec, shi);
- if(RE_rayobject_raycast(R.raytree, &isec)) {
+ if (RE_rayobject_raycast(R.raytree, &isec)) {
ShadeResult shr= {{0}};
float d= 1.0f;
@@ -741,13 +743,13 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
shi.osatex= origshi->osatex;
shi.depth= origshi->depth + 1; /* only used to indicate tracing */
shi.thread= origshi->thread;
- //shi.sample= 0; // memset above, so dont need this
+ //shi.sample= 0; // memset above, so don't need this
shi.xs= origshi->xs;
shi.ys= origshi->ys;
shi.lay= origshi->lay;
shi.passflag= SCE_PASS_COMBINED; /* result of tracing needs no pass info */
shi.combinedflag= 0xFFFFFF; /* ray trace does all options */
- //shi.do_preview= 0; // memset above, so dont need this
+ //shi.do_preview= 0; // memset above, so don't need this
shi.light_override= origshi->light_override;
shi.mat_override= origshi->mat_override;
@@ -756,10 +758,10 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
if (traflag & RAY_INSIDE)
d= shade_by_transmission(&isec, &shi, &shr);
- if(depth>0) {
+ if (depth>0) {
float fr, fg, fb, f, f1;
- if((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f && (shi.mat->mode_l & (MA_ZTRANSP | MA_RAYTRANSP))) {
+ if ((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f && (shi.mat->mode_l & (MA_ZTRANSP | MA_RAYTRANSP))) {
float nf, f, refract[3], tracol[4];
tracol[0]= shi.r;
@@ -767,11 +769,11 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
tracol[2]= shi.b;
tracol[3]= col[3]; // we pass on and accumulate alpha
- if((shi.mat->mode & MA_TRANSP) && (shi.mat->mode & MA_RAYTRANSP)) {
+ if ((shi.mat->mode & MA_TRANSP) && (shi.mat->mode & MA_RAYTRANSP)) {
/* don't overwrite traflag, it's value is used in mirror reflection */
int new_traflag = traflag;
- if(new_traflag & RAY_INSIDE) {
+ if (new_traflag & RAY_INSIDE) {
/* inside the material, so use inverse normal */
float norm[3];
norm[0]= - shi.vn[0];
@@ -820,13 +822,13 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
else
col[3]= 1.0f;
- if(shi.mat->mode_l & MA_RAYMIRROR) {
+ if (shi.mat->mode_l & MA_RAYMIRROR) {
f= shi.ray_mirror;
- if(f!=0.0f) f*= fresnel_fac(shi.view, shi.vn, shi.mat->fresnel_mir_i, shi.mat->fresnel_mir);
+ if (f!=0.0f) f*= fresnel_fac(shi.view, shi.vn, shi.mat->fresnel_mir_i, shi.mat->fresnel_mir);
}
else f= 0.0f;
- if(f!=0.0f) {
+ if (f!=0.0f) {
float mircol[4];
float ref[3];
@@ -891,16 +893,16 @@ static void DP_energy(float *table, float vec[2], int tot, float xsize, float ys
min*= min;
result[0]= result[1]= 0.0f;
- for(y= -1; y<2; y++) {
+ for (y= -1; y<2; y++) {
dy= ysize*y;
- for(x= -1; x<2; x++) {
+ for (x= -1; x<2; x++) {
dx= xsize*x;
fp= table;
- for(a=0; a<tot; a++, fp+= 2) {
+ for (a=0; a<tot; a++, fp+= 2) {
force[0]= vec[0] - fp[0]-dx;
force[1]= vec[1] - fp[1]-dy;
dist= force[0]*force[0] + force[1]*force[1];
- if(dist < min && dist>0.0f) {
+ if (dist < min && dist>0.0f) {
result[0]+= force[0]/dist;
result[1]+= force[1]/dist;
}
@@ -922,11 +924,11 @@ static void jitter_plane_offset(float *jitter1, float *jitter2, int tot, float s
float hsizex= 0.5f*sizex, hsizey= 0.5f*sizey;
int x;
- for(x=tot; x>0; x--, jitter1+=2, jitter2+=2) {
+ for (x=tot; x>0; x--, jitter1+=2, jitter2+=2) {
jitter2[0]= jitter1[0] + dsizex;
jitter2[1]= jitter1[1] + dsizey;
- if(jitter2[0] > hsizex) jitter2[0]-= sizex;
- if(jitter2[1] > hsizey) jitter2[1]-= sizey;
+ if (jitter2[0] > hsizex) jitter2[0]-= sizex;
+ if (jitter2[1] > hsizey) jitter2[1]-= sizey;
}
}
@@ -938,29 +940,29 @@ void init_jitter_plane(LampRen *lar)
int x, tot= lar->ray_totsamp;
/* test if already initialized */
- if(lar->jitter) return;
+ if (lar->jitter) return;
/* at least 4, or max threads+1 tables */
- if(BLENDER_MAX_THREADS < 4) x= 4;
+ if (BLENDER_MAX_THREADS < 4) x= 4;
else x= BLENDER_MAX_THREADS+1;
fp= lar->jitter= MEM_callocN(x*tot*2*sizeof(float), "lamp jitter tab");
/* if 1 sample, we leave table to be zero's */
- if(tot>1) {
+ if (tot>1) {
int iter=12;
/* set per-lamp fixed seed */
BLI_srandom(tot);
/* fill table with random locations, area_size large */
- for(x=0; x<tot; x++, fp+=2) {
+ for (x=0; x<tot; x++, fp+=2) {
fp[0]= (BLI_frand()-0.5f)*lar->area_size;
fp[1]= (BLI_frand()-0.5f)*lar->area_sizey;
}
- while(iter--) {
+ while (iter--) {
fp= lar->jitter;
- for(x=tot; x>0; x--, fp+=2) {
+ for (x=tot; x>0; x--, fp+=2) {
DP_energy(lar->jitter, fp, tot, lar->area_size, lar->area_sizey);
}
}
@@ -978,17 +980,17 @@ static float *give_jitter_plane(LampRen *lar, int thread, int xs, int ys)
tot= lar->ray_totsamp;
- if(lar->ray_samp_type & LA_SAMP_JITTER) {
+ if (lar->ray_samp_type & LA_SAMP_JITTER) {
/* made it threadsafe */
- if(lar->xold[thread]!=xs || lar->yold[thread]!=ys) {
+ if (lar->xold[thread]!=xs || lar->yold[thread]!=ys) {
jitter_plane_offset(lar->jitter, lar->jitter+2*(thread+1)*tot, tot, lar->area_size, lar->area_sizey, BLI_thread_frand(thread), BLI_thread_frand(thread));
lar->xold[thread]= xs;
lar->yold[thread]= ys;
}
return lar->jitter+2*(thread+1)*tot;
}
- if(lar->ray_samp_type & LA_SAMP_DITHER) {
+ if (lar->ray_samp_type & LA_SAMP_DITHER) {
return lar->jitter + 2*tot*((xs & 1)+2*(ys & 1));
}
@@ -1203,8 +1205,8 @@ static QMCSampler *get_thread_qmcsampler(Render *re, int thread, int type, int t
/* create qmc samplers as needed, since recursion makes it hard to
* predict how many are needed */
- for(qsa=re->qmcsamplers[thread].first; qsa; qsa=qsa->next) {
- if(qsa->type == type && qsa->tot == tot && !qsa->used) {
+ for (qsa=re->qmcsamplers[thread].first; qsa; qsa=qsa->next) {
+ if (qsa->type == type && qsa->tot == tot && !qsa->used) {
qsa->used= 1;
return qsa;
}
@@ -1224,11 +1226,11 @@ static void release_thread_qmcsampler(Render *UNUSED(re), int UNUSED(thread), QM
void free_render_qmcsampler(Render *re)
{
- if(re->qmcsamplers) {
+ if (re->qmcsamplers) {
QMCSampler *qsa, *next;
int a;
- for(a=0; a<BLENDER_MAX_THREADS; a++) {
- for(qsa=re->qmcsamplers[a].first; qsa; qsa=next) {
+ for (a=0; a<BLENDER_MAX_THREADS; a++) {
+ for (qsa=re->qmcsamplers[a].first; qsa; qsa=next) {
next= qsa->next;
QMC_freeSampler(qsa);
}
@@ -1270,7 +1272,8 @@ static int adaptive_sample_contrast_val(int samples, float prev, float val, floa
* going to be the same is wasting effort */
if (fabsf( prev/(float)(samples-1) - val/(float)samples ) < thresh) {
return 1;
- } else
+ }
+ else
return 0;
}
@@ -1318,16 +1321,18 @@ static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr)
/* all samples are generated per pixel */
qsa = get_thread_qmcsampler(&R, shi->thread, samp_type, max_samples);
QMC_initPixel(qsa, shi->thread);
- } else
+ }
+ else
max_samples = 1;
while (samples < max_samples) {
- if(refraction(v_refract, shi->vn, shi->view, shi->ang)) {
+ if (refraction(v_refract, shi->vn, shi->view, shi->ang)) {
traflag |= RAY_INSIDE;
- } else {
+ }
+ else {
/* total external reflection can happen for materials with IOR < 1.0 */
- if((shi->vlr->flag & R_SMOOTH))
+ if ((shi->vlr->flag & R_SMOOTH))
reflection(v_refract, shi->vn, shi->view, shi->facenor);
else
reflection_simple(v_refract, shi->vn, shi->view);
@@ -1349,7 +1354,8 @@ static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr)
add_v3_v3(v_refract_new, orthy);
normalize_v3(v_refract_new);
- } else {
+ }
+ else {
/* no blurriness, use the original normal */
copy_v3_v3(v_refract_new, v_refract);
}
@@ -1417,7 +1423,8 @@ static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float
/* all samples are generated per pixel */
qsa = get_thread_qmcsampler(&R, shi->thread, samp_type, max_samples);
QMC_initPixel(qsa, shi->thread);
- } else
+ }
+ else
max_samples = 1;
while (samples < max_samples) {
@@ -1433,7 +1440,8 @@ static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float
copy_v3_v3(orthy, shi->tang);
mul_v3_fl(orthx, samp3d[0]);
mul_v3_fl(orthy, samp3d[1]*aniso);
- } else {
+ }
+ else {
ortho_basis_v3v3_v3( orthx, orthy,shi->vn);
mul_v3_fl(orthx, samp3d[0]);
mul_v3_fl(orthy, samp3d[1]);
@@ -1443,12 +1451,13 @@ static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float
add_v3_v3v3(v_nor_new, shi->vn, orthx);
add_v3_v3(v_nor_new, orthy);
normalize_v3(v_nor_new);
- } else {
+ }
+ else {
/* no blurriness, use the original normal */
copy_v3_v3(v_nor_new, shi->vn);
}
- if((shi->vlr->flag & R_SMOOTH))
+ if ((shi->vlr->flag & R_SMOOTH))
reflection(v_reflect, v_nor_new, shi->view, shi->facenor);
else
reflection_simple(v_reflect, v_nor_new, shi->view);
@@ -1511,12 +1520,12 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
do_mir= ((shi->mat->mode & MA_RAYMIRROR) && shi->ray_mirror!=0.0f && (shi->depth <= shi->mat->ray_depth));
/* raytrace mirror and refract like to separate the spec color */
- if(shi->combinedflag & SCE_PASS_SPEC)
+ if (shi->combinedflag & SCE_PASS_SPEC)
sub_v3_v3v3(diff, shr->combined, shr->spec);
else
copy_v3_v3(diff, shr->combined);
- if(do_tra) {
+ if (do_tra) {
float olddiff[3], f;
trace_refract(tracol, shi, shr);
@@ -1533,18 +1542,18 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
diff[1]= f*diff[1] + f1*fg*tracol[1];
diff[2]= f*diff[2] + f1*fb*tracol[2];
- if(shi->passflag & SCE_PASS_REFRACT)
+ if (shi->passflag & SCE_PASS_REFRACT)
sub_v3_v3v3(shr->refr, diff, olddiff);
- if(!(shi->combinedflag & SCE_PASS_REFRACT))
+ if (!(shi->combinedflag & SCE_PASS_REFRACT))
sub_v3_v3v3(diff, diff, shr->refr);
shr->alpha= MIN2(1.0f, tracol[3]);
}
- if(do_mir) {
+ if (do_mir) {
const float i= shi->ray_mirror*fresnel_fac(shi->view, shi->vn, shi->mat->fresnel_mir_i, shi->mat->fresnel_mir);
- if(i!=0.0f) {
+ if (i!=0.0f) {
trace_reflect(mircol, shi, shr, i);
@@ -1552,14 +1561,14 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
fg= i*shi->mirg;
fb= i*shi->mirb;
- if(shi->passflag & SCE_PASS_REFLECT) {
+ if (shi->passflag & SCE_PASS_REFLECT) {
/* mirror pass is not blocked out with spec */
shr->refl[0]= fr*mircol[0] - fr*diff[0];
shr->refl[1]= fg*mircol[1] - fg*diff[1];
shr->refl[2]= fb*mircol[2] - fb*diff[2];
}
- if(shi->combinedflag & SCE_PASS_REFLECT) {
+ if (shi->combinedflag & SCE_PASS_REFLECT) {
/* values in shr->spec can be greater then 1.0.
* In this case the mircol uses a zero blending factor, so ignoring it is ok.
* Fixes bug #18837 - when the spec is higher then 1.0,
@@ -1571,14 +1580,14 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
diff[1] *= f1;
diff[2] *= f1;
- if(shr->spec[0]<1.0f) diff[0] += mircol[0] * (fr*(1.0f-shr->spec[0]));
- if(shr->spec[1]<1.0f) diff[1] += mircol[1] * (fg*(1.0f-shr->spec[1]));
- if(shr->spec[2]<1.0f) diff[2] += mircol[2] * (fb*(1.0f-shr->spec[2]));
+ if (shr->spec[0]<1.0f) diff[0] += mircol[0] * (fr*(1.0f-shr->spec[0]));
+ if (shr->spec[1]<1.0f) diff[1] += mircol[1] * (fg*(1.0f-shr->spec[1]));
+ if (shr->spec[2]<1.0f) diff[2] += mircol[2] * (fb*(1.0f-shr->spec[2]));
}
}
}
/* put back together */
- if(shi->combinedflag & SCE_PASS_SPEC)
+ if (shi->combinedflag & SCE_PASS_SPEC)
add_v3_v3v3(shr->combined, diff, shr->spec);
else
copy_v3_v3(shr->combined, diff);
@@ -1607,7 +1616,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int
* if it has col[3]>0.0f continue. so exit when alpha is full */
const float initial_dist = is->dist;
- if(RE_rayobject_raycast(R.raytree, is)) {
+ if (RE_rayobject_raycast(R.raytree, is)) {
/* Warning regarding initializing to zero's, This is not that nice,
* and possibly a bit slow for every ray, however some variables were
* not initialized properly in, unless using
@@ -1637,7 +1646,8 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int
1.0f;
/* mix colors based on shadfac (rgb + amount of light factor) */
addAlphaLight(col, shr.diff, shr.alpha, d*shi.mat->filter);
- } else if (shi.mat->material_type == MA_TYPE_VOLUME) {
+ }
+ else if (shi.mat->material_type == MA_TYPE_VOLUME) {
const float a = col[3];
col[0] = a*col[0] + shr.alpha*shr.combined[0];
@@ -1647,7 +1657,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int
col[3] = (1.0f - shr.alpha)*a;
}
- if(depth>0 && col[3]>0.0f) {
+ if (depth>0 && col[3]>0.0f) {
/* adapt isect struct */
copy_v3_v3(is->start, shi.co);
@@ -1676,7 +1686,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult *
assert(0);
- if(only_one) {
+ if (only_one) {
return 0;
}
only_one= 1;
@@ -1691,7 +1701,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult *
RE_RC_INIT(isec, shi);
- for(a=0; a<8*8; a++) {
+ for (a=0; a<8*8; a++) {
counter+=3;
counter %= 768;
@@ -1705,7 +1715,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult *
copy_v3_v3(isec.dir, vec );
isec.dist = RE_RAYTRACE_MAXDIST;
- if(RE_rayobject_raycast(R.raytree, &isec)) {
+ if (RE_rayobject_raycast(R.raytree, &isec)) {
float fac;
/* Warning, This is not that nice, and possibly a bit slow for every ray,
@@ -1724,7 +1734,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult *
else div+= 1.0f;
}
- if(div!=0.0f) {
+ if (div!=0.0f) {
shr->diff[0]+= accum[0]/div;
shr->diff[1]+= accum[1]/div;
shr->diff[2]+= accum[2]/div;
@@ -1757,10 +1767,10 @@ static void DS_energy(float *sphere, int tot, float vec[3])
res[0]= res[1]= res[2]= 0.0f;
- for(a=0, fp=sphere; a<tot; a++, fp+=3) {
+ for (a=0, fp=sphere; a<tot; a++, fp+=3) {
sub_v3_v3v3(force, vec, fp);
fac = dot_v3v3(force, force);
- if(fac!=0.0f) {
+ if (fac!=0.0f) {
fac= 1.0f/fac;
res[0]+= fac*force[0];
res[1]+= fac*force[1];
@@ -1792,12 +1802,12 @@ void init_ao_sphere(World *wrld)
/* init */
fp= wrld->aosphere;
- for(a=0; a<tot; a++, fp+= 3) {
+ for (a=0; a<tot; a++, fp+= 3) {
RandomSpherical(fp);
}
- while(iter--) {
- for(a=0, fp= wrld->aosphere; a<tot; a++, fp+= 3) {
+ while (iter--) {
+ for (a=0, fp= wrld->aosphere; a<tot; a++, fp+= 3) {
DS_energy(wrld->aosphere, tot, fp);
}
}
@@ -1812,14 +1822,14 @@ static float *threadsafe_table_sphere(int test, int thread, int xs, int ys, int
static int xso[BLENDER_MAX_THREADS], yso[BLENDER_MAX_THREADS];
static int firsttime= 1;
- if(firsttime) {
+ if (firsttime) {
memset(xso, 255, sizeof(xso));
memset(yso, 255, sizeof(yso));
firsttime= 0;
}
- if(xs==xso[thread] && ys==yso[thread]) return R.wrld.aotables+ thread*tot*3;
- if(test) return NULL;
+ if (xs==xso[thread] && ys==yso[thread]) return R.wrld.aotables+ thread*tot*3;
+ if (test) return NULL;
xso[thread]= xs; yso[thread]= ys;
return R.wrld.aotables+ thread*tot*3;
}
@@ -1852,7 +1862,7 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in
// returns table if xs and ys were equal to last call, and not resetting
sphere= (reset)? NULL: threadsafe_table_sphere(1, thread, xs, ys, tot);
- if(sphere==NULL) {
+ if (sphere==NULL) {
float cosfi, sinfi, cost, sint;
float ang;
int a;
@@ -1920,16 +1930,16 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
/* prevent sky colors to be added for only shadow (shadow becomes alpha) */
envcolor= R.wrld.aocolor;
- if(shi->mat->mode & MA_ONLYSHADOW)
+ if (shi->mat->mode & MA_ONLYSHADOW)
envcolor= WO_AOPLAIN;
- if(envcolor == WO_AOSKYTEX) {
+ if (envcolor == WO_AOSKYTEX) {
dxyview[0]= 1.0f/(float)R.wrld.aosamp;
dxyview[1]= 1.0f/(float)R.wrld.aosamp;
dxyview[2]= 0.0f;
}
- if(shi->vlr->flag & R_SMOOTH) {
+ if (shi->vlr->flag & R_SMOOTH) {
copy_v3_v3(nrm, shi->vn);
}
else {
@@ -1948,7 +1958,8 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
if (max_samples < 5) max_samples = 5;
qsa = get_thread_qmcsampler(&R, shi->thread, SAMP_TYPE_HALTON, max_samples);
- } else if (R.wrld.ao_samp_method==WO_AOSAMP_HAMMERSLEY)
+ }
+ else if (R.wrld.ao_samp_method==WO_AOSAMP_HAMMERSLEY)
qsa = get_thread_qmcsampler(&R, shi->thread, SAMP_TYPE_HAMMERSLEY, max_samples);
QMC_initPixel(qsa, shi->thread);
@@ -1971,11 +1982,11 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
prev = fac;
- if(RE_rayobject_raycast(R.raytree, &isec)) {
+ if (RE_rayobject_raycast(R.raytree, &isec)) {
if (R.wrld.aomode & WO_AODIST) fac+= expf(-isec.dist*R.wrld.aodistfac);
else fac+= 1.0f;
}
- else if(envcolor!=WO_AOPLAIN) {
+ else if (envcolor!=WO_AOPLAIN) {
float skycol[4];
float view[3];
@@ -1984,7 +1995,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
view[2]= -dir[2];
normalize_v3(view);
- if(envcolor==WO_AOSKYCOL) {
+ if (envcolor==WO_AOSKYCOL) {
const float skyfac= 0.5f * (1.0f + dot_v3v3(view, R.grvec));
env[0]+= (1.0f-skyfac)*R.wrld.horr + skyfac*R.wrld.zenr;
env[1]+= (1.0f-skyfac)*R.wrld.horg + skyfac*R.wrld.zeng;
@@ -2016,7 +2027,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
/* average color times distances/hits formula */
ao[0]= ao[1]= ao[2]= 1.0f - fac/(float)samples;
- if(envcolor!=WO_AOPLAIN && skyadded)
+ if (envcolor!=WO_AOPLAIN && skyadded)
mul_v3_fl(env, (1.0f - fac/(float)samples)/((float)skyadded));
else
copy_v3_v3(env, ao);
@@ -2058,7 +2069,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
zero_v3(env);
/* bias prevents smoothed faces to appear flat */
- if(shi->vlr->flag & R_SMOOTH) {
+ if (shi->vlr->flag & R_SMOOTH) {
bias= R.wrld.aobias;
nrm= shi->vn;
}
@@ -2069,10 +2080,10 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
/* prevent sky colors to be added for only shadow (shadow becomes alpha) */
envcolor= R.wrld.aocolor;
- if(shi->mat->mode & MA_ONLYSHADOW)
+ if (shi->mat->mode & MA_ONLYSHADOW)
envcolor= WO_AOPLAIN;
- if(resol>32) resol= 32;
+ if (resol>32) resol= 32;
/* get sphere samples. for faces we get the same samples for sample x/y values,
* for strand render we always require a new sampler because x/y are not set */
@@ -2081,20 +2092,20 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
// warning: since we use full sphere now, and dotproduct is below, we do twice as much
tot= 2*resol*resol;
- if(envcolor == WO_AOSKYTEX) {
+ if (envcolor == WO_AOSKYTEX) {
dxyview[0]= 1.0f/(float)resol;
dxyview[1]= 1.0f/(float)resol;
dxyview[2]= 0.0f;
}
- while(tot--) {
+ while (tot--) {
if (dot_v3v3(vec, nrm) > bias) {
/* only ao samples for mask */
- if(R.r.mode & R_OSA) {
+ if (R.r.mode & R_OSA) {
j++;
- if(j==R.osa) j= 0;
- if(!(shi->mask & (1<<j))) {
+ if (j==R.osa) j= 0;
+ if (!(shi->mask & (1<<j))) {
vec+=3;
continue;
}
@@ -2109,11 +2120,11 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
isec.dist = maxdist;
/* do the trace */
- if(RE_rayobject_raycast(R.raytree, &isec)) {
+ if (RE_rayobject_raycast(R.raytree, &isec)) {
if (R.wrld.aomode & WO_AODIST) sh+= expf(-isec.dist*R.wrld.aodistfac);
else sh+= 1.0f;
}
- else if(envcolor!=WO_AOPLAIN) {
+ else if (envcolor!=WO_AOPLAIN) {
float skycol[4];
float view[3];
@@ -2122,7 +2133,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
view[2]= -vec[2];
normalize_v3(view);
- if(envcolor==WO_AOSKYCOL) {
+ if (envcolor==WO_AOSKYCOL) {
const float fac = 0.5f * (1.0f + dot_v3v3(view, R.grvec));
env[0]+= (1.0f-fac)*R.wrld.horr + fac*R.wrld.zenr;
env[1]+= (1.0f-fac)*R.wrld.horg + fac*R.wrld.zeng;
@@ -2142,13 +2153,13 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
vec+= 3;
}
- if(actual==0) sh= 1.0f;
+ if (actual==0) sh= 1.0f;
else sh = 1.0f - sh/((float)actual);
/* average color times distances/hits formula */
ao[0]= ao[1]= ao[2]= sh;
- if(envcolor!=WO_AOPLAIN && skyadded)
+ if (envcolor!=WO_AOPLAIN && skyadded)
mul_v3_fl(env, sh/((float)skyadded));
else
copy_v3_v3(env, ao);
@@ -2177,17 +2188,17 @@ static void ray_shadow_jittered_coords(ShadeInput *shi, int max, float jitco[RE_
/* for better antialising shadow samples are distributed over the subpixel
* sample coordinates, this only works for raytracing depth 0 though */
- if(!shi->strand && shi->depth == 0 && count > 1 && count <= max) {
+ if (!shi->strand && shi->depth == 0 && count > 1 && count <= max) {
float xs, ys, zs, view[3];
int samp, ordsamp, tot= 0;
- for(samp=0; samp<R.osa; samp++) {
- if(R.osa == 8) ordsamp = order8[samp];
- else if(R.osa == 11) ordsamp = order11[samp];
- else if(R.osa == 16) ordsamp = order16[samp];
+ for (samp=0; samp<R.osa; samp++) {
+ if (R.osa == 8) ordsamp = order8[samp];
+ else if (R.osa == 11) ordsamp = order11[samp];
+ else if (R.osa == 16) ordsamp = order16[samp];
else ordsamp = samp;
- if(shi->mask & (1<<ordsamp)) {
+ if (shi->mask & (1<<ordsamp)) {
/* zbuffer has this inverse corrected, ensures xs,ys are inside pixel */
xs= (float)shi->scanco[0] + R.jit[ordsamp][0] + 0.5f;
ys= (float)shi->scanco[1] + R.jit[ordsamp][1] + 0.5f;
@@ -2226,9 +2237,10 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
int totjitco;
colsq[0] = colsq[1] = colsq[2] = 0.0;
- if(isec->mode==RE_RAY_SHADOW_TRA) {
+ if (isec->mode==RE_RAY_SHADOW_TRA) {
shadfac[0]= shadfac[1]= shadfac[2]= shadfac[3]= 0.0f;
- } else
+ }
+ else
shadfac[3]= 1.0f;
if (lar->ray_totsamp < 2) do_soft = 0;
@@ -2237,7 +2249,8 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
if (full_osa) {
if (do_soft) max_samples = max_samples/R.osa + 1;
else max_samples = 1;
- } else {
+ }
+ else {
if (do_soft) max_samples = lar->ray_totsamp;
else if (shi->depth == 0) max_samples = (R.osa > 4)?R.osa:5;
else max_samples = 1;
@@ -2254,7 +2267,7 @@ 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);
}
@@ -2305,11 +2318,12 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
end[0] = vec[0]+samp3d[0];
end[1] = vec[1]+samp3d[1];
end[2] = vec[2]+samp3d[2];
- } else {
+ }
+ else {
copy_v3_v3(end, vec);
}
- if(shi->strand) {
+ if (shi->strand) {
/* bias away somewhat to avoid self intersection */
float jitbias= 0.5f*(len_v3(shi->dxco) + len_v3(shi->dyco));
float v[3];
@@ -2329,7 +2343,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
isec->dist = normalize_v3(isec->dir);
/* trace the ray */
- if(isec->mode==RE_RAY_SHADOW_TRA) {
+ if (isec->mode==RE_RAY_SHADOW_TRA) {
float col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
ray_trace_shadow_tra(isec, shi, DEPTH_SHADOW_TRA, 0, col);
@@ -2344,7 +2358,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
colsq[2] += col[2]*col[2];
}
else {
- if( RE_rayobject_raycast(R.raytree, isec) ) fac+= 1.0f;
+ if ( RE_rayobject_raycast(R.raytree, isec) ) fac+= 1.0f;
}
samples++;
@@ -2358,7 +2372,8 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
break;
else if (adaptive_sample_variance(samples, shadfac, colsq, adapt_thresh))
break;
- } else {
+ }
+ else {
if ((fac / samples > (1.0f-adapt_thresh)) || (fac / samples < adapt_thresh))
break;
}
@@ -2366,12 +2381,13 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
}
}
- if(isec->mode==RE_RAY_SHADOW_TRA) {
+ if (isec->mode==RE_RAY_SHADOW_TRA) {
shadfac[0] /= samples;
shadfac[1] /= samples;
shadfac[2] /= samples;
shadfac[3] /= samples;
- } else
+ }
+ else
shadfac[3]= 1.0f-fac/samples;
if (qsa)
@@ -2386,7 +2402,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
int a, j= -1, mask;
RayHint point_hint;
- if(isec->mode==RE_RAY_SHADOW_TRA) {
+ if (isec->mode==RE_RAY_SHADOW_TRA) {
shadfac[0]= shadfac[1]= shadfac[2]= shadfac[3]= 0.0f;
}
else shadfac[3]= 1.0f;
@@ -2398,8 +2414,8 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
/* this correction to make sure we always take at least 1 sample */
mask= shi->mask;
- if(a==4) mask |= (mask>>4)|(mask>>8);
- else if(a==9) mask |= (mask>>9);
+ if (a==4) mask |= (mask>>4)|(mask>>8);
+ else if (a==9) mask |= (mask>>9);
copy_v3_v3(isec->start, shi->co);
isec->orig.ob = shi->obi;
@@ -2407,12 +2423,12 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
RE_rayobject_hint_bb( R.raytree, &point_hint, isec->start, isec->start );
isec->hint = &point_hint;
- while(a--) {
+ while (a--) {
- if(R.r.mode & R_OSA) {
+ if (R.r.mode & R_OSA) {
j++;
- if(j>=R.osa) j= 0;
- if(!(mask & (1<<j))) {
+ if (j>=R.osa) j= 0;
+ if (!(mask & (1<<j))) {
jitlamp+= 2;
continue;
}
@@ -2431,7 +2447,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
isec->check = RE_CHECK_VLR_RENDER;
isec->skip = RE_SKIP_VLR_NEIGHBOUR;
- if(isec->mode==RE_RAY_SHADOW_TRA) {
+ if (isec->mode==RE_RAY_SHADOW_TRA) {
/* isec.col is like shadfac, so defines amount of light (0.0 is full shadow) */
float col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
@@ -2441,13 +2457,13 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
shadfac[2] += col[2];
shadfac[3] += col[3];
}
- else if( RE_rayobject_raycast(R.raytree, isec) ) fac+= 1.0f;
+ else if ( RE_rayobject_raycast(R.raytree, isec) ) fac+= 1.0f;
div+= 1.0f;
jitlamp+= 2;
}
- if(isec->mode==RE_RAY_SHADOW_TRA) {
+ if (isec->mode==RE_RAY_SHADOW_TRA) {
shadfac[0] /= div;
shadfac[1] /= div;
shadfac[2] /= div;
@@ -2455,7 +2471,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
}
else {
// sqrt makes nice umbra effect
- if(lar->ray_samp_type & LA_SAMP_UMBRA)
+ if (lar->ray_samp_type & LA_SAMP_UMBRA)
shadfac[3]= sqrt(1.0f-fac/div);
else
shadfac[3]= 1.0f-fac/div;
@@ -2469,24 +2485,24 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4])
/* setup isec */
RE_RC_INIT(isec, *shi);
- if(shi->mat->mode & MA_SHADOW_TRA) isec.mode= RE_RAY_SHADOW_TRA;
+ if (shi->mat->mode & MA_SHADOW_TRA) isec.mode= RE_RAY_SHADOW_TRA;
else isec.mode= RE_RAY_SHADOW;
isec.hint = 0;
- if(lar->mode & (LA_LAYER|LA_LAYER_SHADOW))
+ if (lar->mode & (LA_LAYER|LA_LAYER_SHADOW))
isec.lay= lar->lay;
else
isec.lay= -1;
/* only when not mir tracing, first hit optimm */
- if(shi->depth==0) {
+ if (shi->depth==0) {
isec.last_hit = lar->last_hit[shi->thread];
}
else {
isec.last_hit = NULL;
}
- if(lar->type==LA_SUN || lar->type==LA_HEMI) {
+ if (lar->type==LA_SUN || lar->type==LA_HEMI) {
/* jitter and QMC sampling add a displace vector to the lamp position
* that's incorrect because a SUN lamp does not has an exact position
* and the displace should be done at the ray vector instead of the
@@ -2512,8 +2528,9 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4])
ray_shadow_qmc(shi, lar, lampco, shadfac, &isec);
- } else {
- if(lar->ray_totsamp<2) {
+ }
+ else {
+ if (lar->ray_totsamp<2) {
isec.orig.ob = shi->obi;
isec.orig.face = shi->vlr;
@@ -2525,14 +2542,14 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4])
sub_v3_v3v3(isec.dir, lampco, isec.start);
isec.dist = normalize_v3(isec.dir);
- if(isec.mode==RE_RAY_SHADOW_TRA) {
+ if (isec.mode==RE_RAY_SHADOW_TRA) {
/* isec.col is like shadfac, so defines amount of light (0.0 is full shadow) */
float col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
ray_trace_shadow_tra(&isec, shi, DEPTH_SHADOW_TRA, 0, col);
copy_v4_v4(shadfac, col);
}
- else if(RE_rayobject_raycast(R.raytree, &isec))
+ else if (RE_rayobject_raycast(R.raytree, &isec))
shadfac[3]= 0.0f;
}
else {
@@ -2541,7 +2558,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4])
}
/* for first hit optim, set last interesected shadow face */
- if(shi->depth==0) {
+ if (shi->depth==0) {
lar->last_hit[shi->thread] = isec.last_hit;
}
@@ -2561,9 +2578,9 @@ static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float
isec.mode= RE_RAY_SHADOW_TRA;
isec.hint = 0;
- if(lar->mode & LA_LAYER) isec.lay= lar->lay; else isec.lay= -1;
+ if (lar->mode & LA_LAYER) isec.lay= lar->lay; else isec.lay= -1;
- if(lar->type==LA_SUN || lar->type==LA_HEMI) {
+ if (lar->type==LA_SUN || lar->type==LA_HEMI) {
lampco[0]= shi->co[0] - RE_RAYTRACE_MAXDIST*lar->vec[0];
lampco[1]= shi->co[1] - RE_RAYTRACE_MAXDIST*lar->vec[1];
lampco[2]= shi->co[2] - RE_RAYTRACE_MAXDIST*lar->vec[2];
@@ -2579,7 +2596,7 @@ static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float
copy_v3_v3(isec.start, shi->co);
copy_v3_v3(isec.end, lampco);
- if(RE_rayobject_raycast(R.raytree, &isec)) {
+ if (RE_rayobject_raycast(R.raytree, &isec)) {
/* we got a face */
/* render co */
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index b6c93d9b15f..0231a51214b 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -62,19 +62,19 @@
void render_result_free(RenderResult *res)
{
- if(res==NULL) return;
+ if (res==NULL) return;
- while(res->layers.first) {
+ while (res->layers.first) {
RenderLayer *rl= res->layers.first;
- if(rl->rectf) MEM_freeN(rl->rectf);
+ if (rl->rectf) MEM_freeN(rl->rectf);
/* acolrect and scolrect are optionally allocated in shade_tile, only free here since it can be used for drawing */
- if(rl->acolrect) MEM_freeN(rl->acolrect);
- if(rl->scolrect) MEM_freeN(rl->scolrect);
+ if (rl->acolrect) MEM_freeN(rl->acolrect);
+ if (rl->scolrect) MEM_freeN(rl->scolrect);
- while(rl->passes.first) {
+ while (rl->passes.first) {
RenderPass *rpass= rl->passes.first;
- if(rpass->rect) MEM_freeN(rpass->rect);
+ if (rpass->rect) MEM_freeN(rpass->rect);
BLI_remlink(&rl->passes, rpass);
MEM_freeN(rpass);
}
@@ -82,13 +82,13 @@ void render_result_free(RenderResult *res)
MEM_freeN(rl);
}
- if(res->rect32)
+ if (res->rect32)
MEM_freeN(res->rect32);
- if(res->rectz)
+ if (res->rectz)
MEM_freeN(res->rectz);
- if(res->rectf)
+ if (res->rectf)
MEM_freeN(res->rectf);
- if(res->text)
+ if (res->text)
MEM_freeN(res->text);
MEM_freeN(res);
@@ -99,10 +99,10 @@ void render_result_free_list(ListBase *lb, RenderResult *rr)
{
RenderResult *rrnext;
- for(; rr; rr= rrnext) {
+ for (; rr; rr= rrnext) {
rrnext= rr->next;
- if(lb && lb->first)
+ if (lb && lb->first)
BLI_remlink(lb, rr);
render_result_free(rr);
@@ -116,167 +116,167 @@ void render_result_free_list(ListBase *lb, RenderResult *rr)
static const char *get_pass_name(int passtype, int channel)
{
- if(passtype == SCE_PASS_COMBINED) {
- if(channel==-1) return "Combined";
- if(channel==0) return "Combined.R";
- if(channel==1) return "Combined.G";
- if(channel==2) return "Combined.B";
+ if (passtype == SCE_PASS_COMBINED) {
+ if (channel==-1) return "Combined";
+ if (channel==0) return "Combined.R";
+ if (channel==1) return "Combined.G";
+ if (channel==2) return "Combined.B";
return "Combined.A";
}
- if(passtype == SCE_PASS_Z) {
- if(channel==-1) return "Depth";
+ if (passtype == SCE_PASS_Z) {
+ if (channel==-1) return "Depth";
return "Depth.Z";
}
- if(passtype == SCE_PASS_VECTOR) {
- if(channel==-1) return "Vector";
- if(channel==0) return "Vector.X";
- if(channel==1) return "Vector.Y";
- if(channel==2) return "Vector.Z";
+ if (passtype == SCE_PASS_VECTOR) {
+ if (channel==-1) return "Vector";
+ if (channel==0) return "Vector.X";
+ if (channel==1) return "Vector.Y";
+ if (channel==2) return "Vector.Z";
return "Vector.W";
}
- if(passtype == SCE_PASS_NORMAL) {
- if(channel==-1) return "Normal";
- if(channel==0) return "Normal.X";
- if(channel==1) return "Normal.Y";
+ if (passtype == SCE_PASS_NORMAL) {
+ if (channel==-1) return "Normal";
+ if (channel==0) return "Normal.X";
+ if (channel==1) return "Normal.Y";
return "Normal.Z";
}
- if(passtype == SCE_PASS_UV) {
- if(channel==-1) return "UV";
- if(channel==0) return "UV.U";
- if(channel==1) return "UV.V";
+ if (passtype == SCE_PASS_UV) {
+ if (channel==-1) return "UV";
+ if (channel==0) return "UV.U";
+ if (channel==1) return "UV.V";
return "UV.A";
}
- if(passtype == SCE_PASS_RGBA) {
- if(channel==-1) return "Color";
- if(channel==0) return "Color.R";
- if(channel==1) return "Color.G";
- if(channel==2) return "Color.B";
+ if (passtype == SCE_PASS_RGBA) {
+ if (channel==-1) return "Color";
+ if (channel==0) return "Color.R";
+ if (channel==1) return "Color.G";
+ if (channel==2) return "Color.B";
return "Color.A";
}
- if(passtype == SCE_PASS_EMIT) {
- if(channel==-1) return "Emit";
- if(channel==0) return "Emit.R";
- if(channel==1) return "Emit.G";
+ if (passtype == SCE_PASS_EMIT) {
+ if (channel==-1) return "Emit";
+ if (channel==0) return "Emit.R";
+ if (channel==1) return "Emit.G";
return "Emit.B";
}
- if(passtype == SCE_PASS_DIFFUSE) {
- if(channel==-1) return "Diffuse";
- if(channel==0) return "Diffuse.R";
- if(channel==1) return "Diffuse.G";
+ if (passtype == SCE_PASS_DIFFUSE) {
+ if (channel==-1) return "Diffuse";
+ if (channel==0) return "Diffuse.R";
+ if (channel==1) return "Diffuse.G";
return "Diffuse.B";
}
- if(passtype == SCE_PASS_SPEC) {
- if(channel==-1) return "Spec";
- if(channel==0) return "Spec.R";
- if(channel==1) return "Spec.G";
+ if (passtype == SCE_PASS_SPEC) {
+ if (channel==-1) return "Spec";
+ if (channel==0) return "Spec.R";
+ if (channel==1) return "Spec.G";
return "Spec.B";
}
- if(passtype == SCE_PASS_SHADOW) {
- if(channel==-1) return "Shadow";
- if(channel==0) return "Shadow.R";
- if(channel==1) return "Shadow.G";
+ if (passtype == SCE_PASS_SHADOW) {
+ if (channel==-1) return "Shadow";
+ if (channel==0) return "Shadow.R";
+ if (channel==1) return "Shadow.G";
return "Shadow.B";
}
- if(passtype == SCE_PASS_AO) {
- if(channel==-1) return "AO";
- if(channel==0) return "AO.R";
- if(channel==1) return "AO.G";
+ if (passtype == SCE_PASS_AO) {
+ if (channel==-1) return "AO";
+ if (channel==0) return "AO.R";
+ if (channel==1) return "AO.G";
return "AO.B";
}
- if(passtype == SCE_PASS_ENVIRONMENT) {
- if(channel==-1) return "Env";
- if(channel==0) return "Env.R";
- if(channel==1) return "Env.G";
+ if (passtype == SCE_PASS_ENVIRONMENT) {
+ if (channel==-1) return "Env";
+ if (channel==0) return "Env.R";
+ if (channel==1) return "Env.G";
return "Env.B";
}
- if(passtype == SCE_PASS_INDIRECT) {
- if(channel==-1) return "Indirect";
- if(channel==0) return "Indirect.R";
- if(channel==1) return "Indirect.G";
+ if (passtype == SCE_PASS_INDIRECT) {
+ if (channel==-1) return "Indirect";
+ if (channel==0) return "Indirect.R";
+ if (channel==1) return "Indirect.G";
return "Indirect.B";
}
- if(passtype == SCE_PASS_REFLECT) {
- if(channel==-1) return "Reflect";
- if(channel==0) return "Reflect.R";
- if(channel==1) return "Reflect.G";
+ if (passtype == SCE_PASS_REFLECT) {
+ if (channel==-1) return "Reflect";
+ if (channel==0) return "Reflect.R";
+ if (channel==1) return "Reflect.G";
return "Reflect.B";
}
- if(passtype == SCE_PASS_REFRACT) {
- if(channel==-1) return "Refract";
- if(channel==0) return "Refract.R";
- if(channel==1) return "Refract.G";
+ if (passtype == SCE_PASS_REFRACT) {
+ if (channel==-1) return "Refract";
+ if (channel==0) return "Refract.R";
+ if (channel==1) return "Refract.G";
return "Refract.B";
}
- if(passtype == SCE_PASS_INDEXOB) {
- if(channel==-1) return "IndexOB";
+ if (passtype == SCE_PASS_INDEXOB) {
+ if (channel==-1) return "IndexOB";
return "IndexOB.X";
}
- if(passtype == SCE_PASS_INDEXMA) {
- if(channel==-1) return "IndexMA";
+ if (passtype == SCE_PASS_INDEXMA) {
+ if (channel==-1) return "IndexMA";
return "IndexMA.X";
}
- if(passtype == SCE_PASS_MIST) {
- if(channel==-1) return "Mist";
+ if (passtype == SCE_PASS_MIST) {
+ if (channel==-1) return "Mist";
return "Mist.Z";
}
- if(passtype == SCE_PASS_RAYHITS) {
- if(channel==-1) return "Rayhits";
- if(channel==0) return "Rayhits.R";
- if(channel==1) return "Rayhits.G";
+ if (passtype == SCE_PASS_RAYHITS) {
+ if (channel==-1) return "Rayhits";
+ if (channel==0) return "Rayhits.R";
+ if (channel==1) return "Rayhits.G";
return "Rayhits.B";
}
- if(passtype == SCE_PASS_DIFFUSE_DIRECT) {
- if(channel==-1) return "DiffDir";
- if(channel==0) return "DiffDir.R";
- if(channel==1) return "DiffDir.G";
+ if (passtype == SCE_PASS_DIFFUSE_DIRECT) {
+ if (channel==-1) return "DiffDir";
+ if (channel==0) return "DiffDir.R";
+ if (channel==1) return "DiffDir.G";
return "DiffDir.B";
}
- if(passtype == SCE_PASS_DIFFUSE_INDIRECT) {
- if(channel==-1) return "DiffInd";
- if(channel==0) return "DiffInd.R";
- if(channel==1) return "DiffInd.G";
+ if (passtype == SCE_PASS_DIFFUSE_INDIRECT) {
+ if (channel==-1) return "DiffInd";
+ if (channel==0) return "DiffInd.R";
+ if (channel==1) return "DiffInd.G";
return "DiffInd.B";
}
- if(passtype == SCE_PASS_DIFFUSE_COLOR) {
- if(channel==-1) return "DiffCol";
- if(channel==0) return "DiffCol.R";
- if(channel==1) return "DiffCol.G";
+ if (passtype == SCE_PASS_DIFFUSE_COLOR) {
+ if (channel==-1) return "DiffCol";
+ if (channel==0) return "DiffCol.R";
+ if (channel==1) return "DiffCol.G";
return "DiffCol.B";
}
- if(passtype == SCE_PASS_GLOSSY_DIRECT) {
- if(channel==-1) return "GlossDir";
- if(channel==0) return "GlossDir.R";
- if(channel==1) return "GlossDir.G";
+ if (passtype == SCE_PASS_GLOSSY_DIRECT) {
+ if (channel==-1) return "GlossDir";
+ if (channel==0) return "GlossDir.R";
+ if (channel==1) return "GlossDir.G";
return "GlossDir.B";
}
- if(passtype == SCE_PASS_GLOSSY_INDIRECT) {
- if(channel==-1) return "GlossInd";
- if(channel==0) return "GlossInd.R";
- if(channel==1) return "GlossInd.G";
+ if (passtype == SCE_PASS_GLOSSY_INDIRECT) {
+ if (channel==-1) return "GlossInd";
+ if (channel==0) return "GlossInd.R";
+ if (channel==1) return "GlossInd.G";
return "GlossInd.B";
}
- if(passtype == SCE_PASS_GLOSSY_COLOR) {
- if(channel==-1) return "GlossCol";
- if(channel==0) return "GlossCol.R";
- if(channel==1) return "GlossCol.G";
+ if (passtype == SCE_PASS_GLOSSY_COLOR) {
+ if (channel==-1) return "GlossCol";
+ if (channel==0) return "GlossCol.R";
+ if (channel==1) return "GlossCol.G";
return "GlossCol.B";
}
- if(passtype == SCE_PASS_TRANSM_DIRECT) {
- if(channel==-1) return "TransDir";
- if(channel==0) return "TransDir.R";
- if(channel==1) return "TransDir.G";
+ if (passtype == SCE_PASS_TRANSM_DIRECT) {
+ if (channel==-1) return "TransDir";
+ if (channel==0) return "TransDir.R";
+ if (channel==1) return "TransDir.G";
return "TransDir.B";
}
- if(passtype == SCE_PASS_TRANSM_INDIRECT) {
- if(channel==-1) return "TransInd";
- if(channel==0) return "TransInd.R";
- if(channel==1) return "TransInd.G";
+ if (passtype == SCE_PASS_TRANSM_INDIRECT) {
+ if (channel==-1) return "TransInd";
+ if (channel==0) return "TransInd.R";
+ if (channel==1) return "TransInd.G";
return "TransInd.B";
}
- if(passtype == SCE_PASS_TRANSM_COLOR) {
- if(channel==-1) return "TransCol";
- if(channel==0) return "TransCol.R";
- if(channel==1) return "TransCol.G";
+ if (passtype == SCE_PASS_TRANSM_COLOR) {
+ if (channel==-1) return "TransCol";
+ if (channel==0) return "TransCol.R";
+ if (channel==1) return "TransCol.G";
return "TransCol.B";
}
return "Unknown";
@@ -285,88 +285,88 @@ static const char *get_pass_name(int passtype, int channel)
static int passtype_from_name(const char *str)
{
- if(strcmp(str, "Combined")==0)
+ if (strcmp(str, "Combined")==0)
return SCE_PASS_COMBINED;
- if(strcmp(str, "Depth")==0)
+ if (strcmp(str, "Depth")==0)
return SCE_PASS_Z;
- if(strcmp(str, "Vector")==0)
+ if (strcmp(str, "Vector")==0)
return SCE_PASS_VECTOR;
- if(strcmp(str, "Normal")==0)
+ if (strcmp(str, "Normal")==0)
return SCE_PASS_NORMAL;
- if(strcmp(str, "UV")==0)
+ if (strcmp(str, "UV")==0)
return SCE_PASS_UV;
- if(strcmp(str, "Color")==0)
+ if (strcmp(str, "Color")==0)
return SCE_PASS_RGBA;
- if(strcmp(str, "Emit")==0)
+ if (strcmp(str, "Emit")==0)
return SCE_PASS_EMIT;
- if(strcmp(str, "Diffuse")==0)
+ if (strcmp(str, "Diffuse")==0)
return SCE_PASS_DIFFUSE;
- if(strcmp(str, "Spec")==0)
+ if (strcmp(str, "Spec")==0)
return SCE_PASS_SPEC;
- if(strcmp(str, "Shadow")==0)
+ if (strcmp(str, "Shadow")==0)
return SCE_PASS_SHADOW;
- if(strcmp(str, "AO")==0)
+ if (strcmp(str, "AO")==0)
return SCE_PASS_AO;
- if(strcmp(str, "Env")==0)
+ if (strcmp(str, "Env")==0)
return SCE_PASS_ENVIRONMENT;
- if(strcmp(str, "Indirect")==0)
+ if (strcmp(str, "Indirect")==0)
return SCE_PASS_INDIRECT;
- if(strcmp(str, "Reflect")==0)
+ if (strcmp(str, "Reflect")==0)
return SCE_PASS_REFLECT;
- if(strcmp(str, "Refract")==0)
+ if (strcmp(str, "Refract")==0)
return SCE_PASS_REFRACT;
- if(strcmp(str, "IndexOB")==0)
+ if (strcmp(str, "IndexOB")==0)
return SCE_PASS_INDEXOB;
- if(strcmp(str, "IndexMA")==0)
+ if (strcmp(str, "IndexMA")==0)
return SCE_PASS_INDEXMA;
- if(strcmp(str, "Mist")==0)
+ if (strcmp(str, "Mist")==0)
return SCE_PASS_MIST;
- if(strcmp(str, "RayHits")==0)
+ if (strcmp(str, "RayHits")==0)
return SCE_PASS_RAYHITS;
- if(strcmp(str, "DiffDir")==0)
+ if (strcmp(str, "DiffDir")==0)
return SCE_PASS_DIFFUSE_DIRECT;
- if(strcmp(str, "DiffInd")==0)
+ if (strcmp(str, "DiffInd")==0)
return SCE_PASS_DIFFUSE_INDIRECT;
- if(strcmp(str, "DiffCol")==0)
+ if (strcmp(str, "DiffCol")==0)
return SCE_PASS_DIFFUSE_COLOR;
- if(strcmp(str, "GlossDir")==0)
+ if (strcmp(str, "GlossDir")==0)
return SCE_PASS_GLOSSY_DIRECT;
- if(strcmp(str, "GlossInd")==0)
+ if (strcmp(str, "GlossInd")==0)
return SCE_PASS_GLOSSY_INDIRECT;
- if(strcmp(str, "GlossCol")==0)
+ if (strcmp(str, "GlossCol")==0)
return SCE_PASS_GLOSSY_COLOR;
- if(strcmp(str, "TransDir")==0)
+ if (strcmp(str, "TransDir")==0)
return SCE_PASS_TRANSM_DIRECT;
- if(strcmp(str, "TransInd")==0)
+ if (strcmp(str, "TransInd")==0)
return SCE_PASS_TRANSM_INDIRECT;
- if(strcmp(str, "TransCol")==0)
+ if (strcmp(str, "TransCol")==0)
return SCE_PASS_TRANSM_COLOR;
return 0;
@@ -387,9 +387,9 @@ static void render_layer_add_pass(RenderResult *rr, RenderLayer *rl, int channel
rpass->recty= rl->recty;
BLI_strncpy(rpass->name, get_pass_name(rpass->passtype, -1), sizeof(rpass->name));
- if(rr->exrhandle) {
+ if (rr->exrhandle) {
int a;
- for(a=0; a<channels; a++)
+ for (a=0; a<channels; a++)
IMB_exr_add_channel(rr->exrhandle, rl->name, get_pass_name(passtype, a), 0, 0, NULL);
}
else {
@@ -398,15 +398,15 @@ static void render_layer_add_pass(RenderResult *rr, RenderLayer *rl, int channel
rpass->rect= MEM_mapallocN(sizeof(float)*rectsize, typestr);
- if(passtype==SCE_PASS_VECTOR) {
+ if (passtype==SCE_PASS_VECTOR) {
/* initialize to max speed */
rect= rpass->rect;
- for(x= rectsize-1; x>=0; x--)
+ for (x= rectsize-1; x>=0; x--)
rect[x]= PASS_VECTOR_MAX;
}
- else if(passtype==SCE_PASS_Z) {
+ else if (passtype==SCE_PASS_Z) {
rect= rpass->rect;
- for(x= rectsize-1; x>=0; x--)
+ for (x= rectsize-1; x>=0; x--)
rect[x]= 10e10;
}
}
@@ -426,32 +426,32 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
rectx= partrct->xmax - partrct->xmin;
recty= partrct->ymax - partrct->ymin;
- if(rectx<=0 || recty<=0)
+ if (rectx<=0 || recty<=0)
return NULL;
rr= MEM_callocN(sizeof(RenderResult), "new render result");
rr->rectx= rectx;
rr->recty= recty;
- rr->renrect.xmin= 0; rr->renrect.xmax= rectx-2*crop;
+ rr->renrect.xmin = 0; rr->renrect.xmax = rectx-2*crop;
/* crop is one or two extra pixels rendered for filtering, is used for merging and display too */
rr->crop= crop;
/* tilerect is relative coordinates within render disprect. do not subtract crop yet */
- rr->tilerect.xmin= partrct->xmin - re->disprect.xmin;
- rr->tilerect.xmax= partrct->xmax - re->disprect.xmax;
- rr->tilerect.ymin= partrct->ymin - re->disprect.ymin;
- rr->tilerect.ymax= partrct->ymax - re->disprect.ymax;
+ rr->tilerect.xmin = partrct->xmin - re->disprect.xmin;
+ rr->tilerect.xmax = partrct->xmax - re->disprect.xmax;
+ rr->tilerect.ymin = partrct->ymin - re->disprect.ymin;
+ rr->tilerect.ymax = partrct->ymax - re->disprect.ymax;
- if(savebuffers) {
+ if (savebuffers) {
rr->exrhandle= IMB_exr_get_handle();
}
/* check renderdata for amount of layers */
- for(nr=0, srl= re->r.layers.first; srl; srl= srl->next, nr++) {
+ for (nr=0, srl= re->r.layers.first; srl; srl= srl->next, nr++) {
- if((re->r.scemode & R_SINGLE_LAYER) && nr!=re->r.actlay)
+ if ((re->r.scemode & R_SINGLE_LAYER) && nr!=re->r.actlay)
continue;
- if(srl->layflag & SCE_LAY_DISABLE)
+ if (srl->layflag & SCE_LAY_DISABLE)
continue;
rl= MEM_callocN(sizeof(RenderLayer), "new render layer");
@@ -468,7 +468,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
rl->rectx= rectx;
rl->recty= recty;
- if(rr->exrhandle) {
+ if (rr->exrhandle) {
IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.R", 0, 0, NULL);
IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.G", 0, 0, NULL);
IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.B", 0, 0, NULL);
@@ -477,64 +477,64 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
else
rl->rectf= MEM_mapallocN(rectx*recty*sizeof(float)*4, "Combined rgba");
- if(srl->passflag & SCE_PASS_Z)
+ if (srl->passflag & SCE_PASS_Z)
render_layer_add_pass(rr, rl, 1, SCE_PASS_Z);
- if(srl->passflag & SCE_PASS_VECTOR)
+ if (srl->passflag & SCE_PASS_VECTOR)
render_layer_add_pass(rr, rl, 4, SCE_PASS_VECTOR);
- if(srl->passflag & SCE_PASS_NORMAL)
+ if (srl->passflag & SCE_PASS_NORMAL)
render_layer_add_pass(rr, rl, 3, SCE_PASS_NORMAL);
- if(srl->passflag & SCE_PASS_UV)
+ if (srl->passflag & SCE_PASS_UV)
render_layer_add_pass(rr, rl, 3, SCE_PASS_UV);
- if(srl->passflag & SCE_PASS_RGBA)
+ if (srl->passflag & SCE_PASS_RGBA)
render_layer_add_pass(rr, rl, 4, SCE_PASS_RGBA);
- if(srl->passflag & SCE_PASS_EMIT)
+ if (srl->passflag & SCE_PASS_EMIT)
render_layer_add_pass(rr, rl, 3, SCE_PASS_EMIT);
- if(srl->passflag & SCE_PASS_DIFFUSE)
+ if (srl->passflag & SCE_PASS_DIFFUSE)
render_layer_add_pass(rr, rl, 3, SCE_PASS_DIFFUSE);
- if(srl->passflag & SCE_PASS_SPEC)
+ if (srl->passflag & SCE_PASS_SPEC)
render_layer_add_pass(rr, rl, 3, SCE_PASS_SPEC);
- if(srl->passflag & SCE_PASS_AO)
+ if (srl->passflag & SCE_PASS_AO)
render_layer_add_pass(rr, rl, 3, SCE_PASS_AO);
- if(srl->passflag & SCE_PASS_ENVIRONMENT)
+ if (srl->passflag & SCE_PASS_ENVIRONMENT)
render_layer_add_pass(rr, rl, 3, SCE_PASS_ENVIRONMENT);
- if(srl->passflag & SCE_PASS_INDIRECT)
+ if (srl->passflag & SCE_PASS_INDIRECT)
render_layer_add_pass(rr, rl, 3, SCE_PASS_INDIRECT);
- if(srl->passflag & SCE_PASS_SHADOW)
+ if (srl->passflag & SCE_PASS_SHADOW)
render_layer_add_pass(rr, rl, 3, SCE_PASS_SHADOW);
- if(srl->passflag & SCE_PASS_REFLECT)
+ if (srl->passflag & SCE_PASS_REFLECT)
render_layer_add_pass(rr, rl, 3, SCE_PASS_REFLECT);
- if(srl->passflag & SCE_PASS_REFRACT)
+ if (srl->passflag & SCE_PASS_REFRACT)
render_layer_add_pass(rr, rl, 3, SCE_PASS_REFRACT);
- if(srl->passflag & SCE_PASS_INDEXOB)
+ if (srl->passflag & SCE_PASS_INDEXOB)
render_layer_add_pass(rr, rl, 1, SCE_PASS_INDEXOB);
- if(srl->passflag & SCE_PASS_INDEXMA)
+ if (srl->passflag & SCE_PASS_INDEXMA)
render_layer_add_pass(rr, rl, 1, SCE_PASS_INDEXMA);
- if(srl->passflag & SCE_PASS_MIST)
+ if (srl->passflag & SCE_PASS_MIST)
render_layer_add_pass(rr, rl, 1, SCE_PASS_MIST);
- if(rl->passflag & SCE_PASS_RAYHITS)
+ if (rl->passflag & SCE_PASS_RAYHITS)
render_layer_add_pass(rr, rl, 4, SCE_PASS_RAYHITS);
- if(srl->passflag & SCE_PASS_DIFFUSE_DIRECT)
+ if (srl->passflag & SCE_PASS_DIFFUSE_DIRECT)
render_layer_add_pass(rr, rl, 3, SCE_PASS_DIFFUSE_DIRECT);
- if(srl->passflag & SCE_PASS_DIFFUSE_INDIRECT)
+ if (srl->passflag & SCE_PASS_DIFFUSE_INDIRECT)
render_layer_add_pass(rr, rl, 3, SCE_PASS_DIFFUSE_INDIRECT);
- if(srl->passflag & SCE_PASS_DIFFUSE_COLOR)
+ if (srl->passflag & SCE_PASS_DIFFUSE_COLOR)
render_layer_add_pass(rr, rl, 3, SCE_PASS_DIFFUSE_COLOR);
- if(srl->passflag & SCE_PASS_GLOSSY_DIRECT)
+ if (srl->passflag & SCE_PASS_GLOSSY_DIRECT)
render_layer_add_pass(rr, rl, 3, SCE_PASS_GLOSSY_DIRECT);
- if(srl->passflag & SCE_PASS_GLOSSY_INDIRECT)
+ if (srl->passflag & SCE_PASS_GLOSSY_INDIRECT)
render_layer_add_pass(rr, rl, 3, SCE_PASS_GLOSSY_INDIRECT);
- if(srl->passflag & SCE_PASS_GLOSSY_COLOR)
+ if (srl->passflag & SCE_PASS_GLOSSY_COLOR)
render_layer_add_pass(rr, rl, 3, SCE_PASS_GLOSSY_COLOR);
- if(srl->passflag & SCE_PASS_TRANSM_DIRECT)
+ if (srl->passflag & SCE_PASS_TRANSM_DIRECT)
render_layer_add_pass(rr, rl, 3, SCE_PASS_TRANSM_DIRECT);
- if(srl->passflag & SCE_PASS_TRANSM_INDIRECT)
+ if (srl->passflag & SCE_PASS_TRANSM_INDIRECT)
render_layer_add_pass(rr, rl, 3, SCE_PASS_TRANSM_INDIRECT);
- if(srl->passflag & SCE_PASS_TRANSM_COLOR)
+ if (srl->passflag & SCE_PASS_TRANSM_COLOR)
render_layer_add_pass(rr, rl, 3, SCE_PASS_TRANSM_COLOR);
}
/* sss, previewrender and envmap don't do layers, so we make a default one */
- if(rr->layers.first==NULL) {
+ if (rr->layers.first==NULL) {
rl= MEM_callocN(sizeof(RenderLayer), "new render layer");
BLI_addtail(&rr->layers, rl);
@@ -542,7 +542,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
rl->recty= recty;
/* duplicate code... */
- if(rr->exrhandle) {
+ if (rr->exrhandle) {
IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.R", 0, 0, NULL);
IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.G", 0, 0, NULL);
IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.B", 0, 0, NULL);
@@ -572,10 +572,10 @@ RenderResult *render_result_new_full_sample(Render *re, ListBase *lb, rcti *part
{
int a;
- if(re->osa==0)
+ if (re->osa==0)
return render_result_new(re, partrct, crop, savebuffers);
- for(a=0; a<re->osa; a++) {
+ for (a=0; a<re->osa; a++) {
RenderResult *rr= render_result_new(re, partrct, crop, savebuffers);
BLI_addtail(lb, rr);
rr->sample_nr= a;
@@ -607,12 +607,12 @@ static void ml_addpass_cb(void *UNUSED(base), void *lay, char *str, float *rect,
rpass->channels= totchan;
rpass->passtype= passtype_from_name(str);
- if(rpass->passtype==0) printf("unknown pass %s\n", str);
+ if (rpass->passtype==0) printf("unknown pass %s\n", str);
rl->passflag |= rpass->passtype;
BLI_strncpy(rpass->name, str, EXR_PASS_MAXNAME);
/* channel id chars */
- for(a=0; a<totchan; a++)
+ for (a=0; a<totchan; a++)
rpass->chan_id[a]= chan_id[a];
rpass->rect= rect;
@@ -630,11 +630,11 @@ RenderResult *render_result_new_from_exr(void *exrhandle, int rectx, int recty)
IMB_exr_multilayer_convert(exrhandle, rr, ml_addlayer_cb, ml_addpass_cb);
- for(rl=rr->layers.first; rl; rl=rl->next) {
+ for (rl=rr->layers.first; rl; rl=rl->next) {
rl->rectx= rectx;
rl->recty= recty;
- for(rpass=rl->passes.first; rpass; rpass=rpass->next) {
+ for (rpass=rl->passes.first; rpass; rpass=rpass->next) {
rpass->rectx= rectx;
rpass->recty= recty;
}
@@ -652,7 +652,7 @@ static void do_merge_tile(RenderResult *rr, RenderResult *rrpart, float *target,
copylen= tilex= rrpart->rectx;
tiley= rrpart->recty;
- if(rrpart->crop) { /* filters add pixel extra */
+ if (rrpart->crop) { /* filters add pixel extra */
tile+= pixsize*(rrpart->crop + rrpart->crop*tilex);
copylen= tilex - 2*rrpart->crop;
@@ -670,7 +670,7 @@ static void do_merge_tile(RenderResult *rr, RenderResult *rrpart, float *target,
tilex *= pixsize;
ofs= pixsize*rr->rectx;
- for(y=0; y<tiley; y++) {
+ for (y=0; y<tiley; y++) {
memcpy(target, tile, copylen);
target+= ofs;
tile+= tilex;
@@ -685,14 +685,14 @@ void render_result_merge(RenderResult *rr, RenderResult *rrpart)
RenderLayer *rl, *rlp;
RenderPass *rpass, *rpassp;
- for(rl= rr->layers.first, rlp= rrpart->layers.first; rl && rlp; rl= rl->next, rlp= rlp->next) {
+ for (rl= rr->layers.first, rlp= rrpart->layers.first; rl && rlp; rl= rl->next, rlp= rlp->next) {
/* combined */
- if(rl->rectf && rlp->rectf)
+ if (rl->rectf && rlp->rectf)
do_merge_tile(rr, rrpart, rl->rectf, rlp->rectf, 4);
/* passes are allocated in sync */
- for(rpass= rl->passes.first, rpassp= rlp->passes.first; rpass && rpassp; rpass= rpass->next, rpassp= rpassp->next) {
+ for (rpass= rl->passes.first, rpassp= rlp->passes.first; rpass && rpassp; rpass= rpass->next, rpassp= rpassp->next) {
do_merge_tile(rr, rrpart, rpass->rect, rpassp->rect, rpass->channels);
}
}
@@ -725,7 +725,7 @@ int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *file
BLI_make_existing_file(filename);
/* composite result */
- if(rr->rectf) {
+ if (rr->rectf) {
IMB_exr_add_channel(exrhandle, "Composite", "Combined.R", 4, 4*rr->rectx, rr->rectf);
IMB_exr_add_channel(exrhandle, "Composite", "Combined.G", 4, 4*rr->rectx, rr->rectf+1);
IMB_exr_add_channel(exrhandle, "Composite", "Combined.B", 4, 4*rr->rectx, rr->rectf+2);
@@ -733,21 +733,21 @@ int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *file
}
/* add layers/passes and assign channels */
- for(rl= rr->layers.first; rl; rl= rl->next) {
+ for (rl= rr->layers.first; rl; rl= rl->next) {
/* combined */
- if(rl->rectf) {
+ if (rl->rectf) {
int a, xstride= 4;
- for(a=0; a<xstride; a++)
+ for (a=0; a<xstride; a++)
IMB_exr_add_channel(exrhandle, rl->name, get_pass_name(SCE_PASS_COMBINED, a),
xstride, xstride*rr->rectx, rl->rectf+a);
}
/* passes are allocated in sync */
- for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
int a, xstride= rpass->channels;
- for(a=0; a<xstride; a++) {
- if(rpass->passtype)
+ for (a=0; a<xstride; a++) {
+ if (rpass->passtype)
IMB_exr_add_channel(exrhandle, rl->name, get_pass_name(rpass->passtype, a),
xstride, xstride*rr->rectx, rpass->rect+a);
else
@@ -758,7 +758,7 @@ int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *file
}
/* when the filename has no permissions, this can fail */
- if(IMB_exr_begin_write(exrhandle, filename, rr->rectx, rr->recty, compress)) {
+ if (IMB_exr_begin_write(exrhandle, filename, rr->rectx, rr->recty, compress)) {
IMB_exr_write_channels(exrhandle);
success= TRUE;
}
@@ -793,15 +793,15 @@ void render_result_single_layer_end(Render *re)
RenderLayer *rl;
int nr;
- if(re->result==NULL) {
+ if (re->result==NULL) {
printf("pop render result error; no current result!\n");
return;
}
- if(!re->pushedresult)
+ if (!re->pushedresult)
return;
- if(re->pushedresult->rectx==re->result->rectx && re->pushedresult->recty==re->result->recty) {
+ if (re->pushedresult->rectx==re->result->rectx && re->pushedresult->recty==re->result->recty) {
/* find which layer in re->pushedresult should be replaced */
rl= re->result->layers.first;
@@ -809,12 +809,12 @@ void render_result_single_layer_end(Render *re)
BLI_remlink(&re->result->layers, rl);
/* reconstruct render result layers */
- for(nr=0, srl= re->scene->r.layers.first; srl; srl= srl->next, nr++) {
- if(nr==re->r.actlay)
+ for (nr=0, srl= re->scene->r.layers.first; srl; srl= srl->next, nr++) {
+ if (nr==re->r.actlay)
BLI_addtail(&re->result->layers, rl);
else {
rlpush= RE_GetRenderLayer(re->pushedresult, srl->name);
- if(rlpush) {
+ if (rlpush) {
BLI_remlink(&re->pushedresult->layers, rlpush);
BLI_addtail(&re->result->layers, rlpush);
}
@@ -836,9 +836,9 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart)
BLI_lock_thread(LOCK_IMAGE);
- for(rlp= rrpart->layers.first; rlp; rlp= rlp->next) {
+ for (rlp= rrpart->layers.first; rlp; rlp= rlp->next) {
- if(rrpart->crop) { /* filters add pixel extra */
+ if (rrpart->crop) { /* filters add pixel extra */
offs= (rrpart->crop + rrpart->crop*rrpart->rectx);
}
else {
@@ -846,17 +846,17 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart)
}
/* combined */
- if(rlp->rectf) {
+ if (rlp->rectf) {
int a, xstride= 4;
- for(a=0; a<xstride; a++)
+ for (a=0; a<xstride; a++)
IMB_exr_set_channel(rr->exrhandle, rlp->name, get_pass_name(SCE_PASS_COMBINED, a),
xstride, xstride*rrpart->rectx, rlp->rectf+a + xstride*offs);
}
/* passes are allocated in sync */
- for(rpassp= rlp->passes.first; rpassp; rpassp= rpassp->next) {
+ for (rpassp= rlp->passes.first; rpassp; rpassp= rpassp->next) {
int a, xstride= rpassp->channels;
- for(a=0; a<xstride; a++)
+ for (a=0; a<xstride; a++)
IMB_exr_set_channel(rr->exrhandle, rlp->name, get_pass_name(rpassp->passtype, a),
xstride, xstride*rrpart->rectx, rpassp->rect+a + xstride*offs);
}
@@ -875,11 +875,11 @@ static void save_empty_result_tiles(Render *re)
RenderPart *pa;
RenderResult *rr;
- for(rr= re->result; rr; rr= rr->next) {
+ for (rr= re->result; rr; rr= rr->next) {
IMB_exrtile_clear_channels(rr->exrhandle);
- for(pa= re->parts.first; pa; pa= pa->next) {
- if(pa->ready==0) {
+ for (pa= re->parts.first; pa; pa= pa->next) {
+ if (pa->ready==0) {
int party= pa->disprect.ymin - re->disprect.ymin + pa->crop;
int partx= pa->disprect.xmin - re->disprect.xmin + pa->crop;
IMB_exrtile_write_channels(rr->exrhandle, partx, party, 0);
@@ -894,7 +894,7 @@ void render_result_exr_file_begin(Render *re)
RenderResult *rr;
char str[FILE_MAX];
- for(rr= re->result; rr; rr= rr->next) {
+ for (rr= re->result; rr; rr= rr->next) {
render_result_exr_file_path(re->scene, rr->sample_nr, str);
printf("write exr tmp file, %dx%d, %s\n", rr->rectx, rr->recty, str);
@@ -909,7 +909,7 @@ void render_result_exr_file_end(Render *re)
save_empty_result_tiles(re);
- for(rr= re->result; rr; rr= rr->next) {
+ for (rr= re->result; rr; rr= rr->next) {
IMB_exr_close(rr->exrhandle);
rr->exrhandle= NULL;
}
@@ -923,7 +923,7 @@ void render_result_exr_file_end(Render *re)
/* save part into exr file */
void render_result_exr_file_merge(RenderResult *rr, RenderResult *rrpart)
{
- for(; rr && rrpart; rr= rr->next, rrpart= rrpart->next)
+ for (; rr && rrpart; rr= rr->next, rrpart= rrpart->next)
save_render_result_tile(rr, rrpart);
}
@@ -935,7 +935,7 @@ void render_result_exr_file_path(Scene *scene, int sample, char *filepath)
BLI_strncpy(di, G.main->name, FILE_MAX);
BLI_splitdirstring(di, fi);
- if(sample==0)
+ if (sample==0)
BLI_snprintf(name, sizeof(name), "%s_%s.exr", fi, scene->id.name+2);
else
BLI_snprintf(name, sizeof(name), "%s_%s%d.exr", fi, scene->id.name+2, sample);
@@ -955,7 +955,7 @@ int render_result_exr_file_read(Render *re, int sample)
render_result_exr_file_path(re->scene, sample, str);
printf("read exr tmp file: %s\n", str);
- if(render_result_exr_file_read_path(re->result, str)) {
+ if (render_result_exr_file_read_path(re->result, str)) {
success= TRUE;
}
else {
@@ -975,14 +975,14 @@ int render_result_exr_file_read_path(RenderResult *rr, const char *filepath)
void *exrhandle= IMB_exr_get_handle();
int rectx, recty;
- if(IMB_exr_begin_read(exrhandle, filepath, &rectx, &recty)==0) {
+ if (IMB_exr_begin_read(exrhandle, filepath, &rectx, &recty)==0) {
printf("failed being read %s\n", filepath);
IMB_exr_close(exrhandle);
return 0;
}
- if(rr == NULL || rectx!=rr->rectx || recty!=rr->recty) {
- if(rr)
+ if (rr == NULL || rectx!=rr->rectx || recty!=rr->recty) {
+ if (rr)
printf("error in reading render result: dimensions don't match\n");
else
printf("error in reading render result: NULL result pointer\n");
@@ -990,19 +990,19 @@ int render_result_exr_file_read_path(RenderResult *rr, const char *filepath)
return 0;
}
- for(rl= rr->layers.first; rl; rl= rl->next) {
+ for (rl= rr->layers.first; rl; rl= rl->next) {
/* combined */
- if(rl->rectf) {
+ if (rl->rectf) {
int a, xstride= 4;
- for(a=0; a<xstride; a++)
+ for (a=0; a<xstride; a++)
IMB_exr_set_channel(exrhandle, rl->name, get_pass_name(SCE_PASS_COMBINED, a),
xstride, xstride*rectx, rl->rectf+a);
}
/* passes are allocated in sync */
- for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
int a, xstride= rpass->channels;
- for(a=0; a<xstride; a++)
+ for (a=0; a<xstride; a++)
IMB_exr_set_channel(exrhandle, rl->name, get_pass_name(rpass->passtype, a),
xstride, xstride*rectx, rpass->rect+a);
@@ -1038,14 +1038,15 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd)
ibuf->profile = IB_PROFILE_SRGB;
if (BKE_imtype_valid_depths(rd->im_format.imtype) & (R_IMF_CHAN_DEPTH_12|R_IMF_CHAN_DEPTH_16|R_IMF_CHAN_DEPTH_24|R_IMF_CHAN_DEPTH_32))
IMB_float_from_rect(ibuf);
- } else {
+ }
+ else {
ibuf->profile = IB_PROFILE_LINEAR_RGB;
}
}
/* color -> greyscale */
/* editing directly would alter the render view */
- if(rd->im_format.planes == R_IMF_PLANES_BW) {
+ if (rd->im_format.planes == R_IMF_PLANES_BW) {
ImBuf *ibuf_bw= IMB_dupImBuf(ibuf);
IMB_color_to_bw(ibuf_bw);
IMB_freeImBuf(ibuf);
@@ -1057,7 +1058,7 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd)
void render_result_rect_from_ibuf(RenderResult *rr, RenderData *rd, ImBuf *ibuf)
{
- if(ibuf->rect_float) {
+ if (ibuf->rect_float) {
/* color management: when off ensure rectf is non-lin, since thats what the internal
* render engine delivers */
int profile_to= (rd->color_mgt_flag & R_COLOR_MANAGEMENT)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB;
@@ -1073,19 +1074,19 @@ void render_result_rect_from_ibuf(RenderResult *rr, RenderData *rd, ImBuf *ibuf)
/* TSK! Since sequence render doesn't free the *rr render result, the old rect32
* can hang around when sequence render has rendered a 32 bits one before */
- if(rr->rect32) {
+ if (rr->rect32) {
MEM_freeN(rr->rect32);
rr->rect32= NULL;
}
}
- else if(ibuf->rect) {
+ else if (ibuf->rect) {
if (!rr->rect32)
rr->rect32= MEM_mallocN(sizeof(int)*rr->rectx*rr->recty, "render_seq rect");
memcpy(rr->rect32, ibuf->rect, 4*rr->rectx*rr->recty);
/* Same things as above, old rectf can hang around from previous render. */
- if(rr->rectf) {
+ if (rr->rectf) {
MEM_freeN(rr->rectf);
rr->rectf= NULL;
}
@@ -1104,10 +1105,10 @@ void render_result_rect_fill_zero(RenderResult *rr)
void render_result_rect_get_pixels(RenderResult *rr, RenderData *rd, unsigned int *rect, int rectx, int recty)
{
- if(rr->rect32) {
+ if (rr->rect32) {
memcpy(rect, rr->rect32, sizeof(int)*rr->rectx*rr->recty);
}
- else if(rr->rectf) {
+ else if (rr->rectf) {
int profile_from= (rd->color_mgt_flag & R_COLOR_MANAGEMENT)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB;
int predivide= (rd->color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
int dither= 0;
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index ede314a42e1..3346cf3c261 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -96,39 +96,39 @@ static void init_render_texture(Render *re, Tex *tex)
{
int cfra= re->scene->r.cfra;
- if(re) cfra= re->r.cfra;
+ if (re) cfra= re->r.cfra;
/* imap test */
- if(tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
BKE_image_user_calc_frame(&tex->iuser, cfra, re?re->flag & R_SEC_FIELD:0);
}
- if(tex->type==TEX_PLUGIN) {
- if(tex->plugin && tex->plugin->doit) {
- if(tex->plugin->cfra) {
+ if (tex->type==TEX_PLUGIN) {
+ if (tex->plugin && tex->plugin->doit) {
+ if (tex->plugin->cfra) {
*(tex->plugin->cfra)= (float)cfra; //BKE_curframe(re->scene); // XXX old animsys - timing stuff to be fixed
}
}
}
- else if(tex->type==TEX_ENVMAP) {
+ else if (tex->type==TEX_ENVMAP) {
/* just in case */
tex->imaflag |= TEX_INTERPOL | TEX_MIPMAP;
tex->extend= TEX_CLIP;
- if(tex->env) {
- if(tex->env->type==ENV_PLANE)
+ if (tex->env) {
+ if (tex->env->type==ENV_PLANE)
tex->extend= TEX_EXTEND;
/* only free envmap when rendermode was set to render envmaps, for previewrender */
- if(G.rendering && re) {
+ if (G.rendering && re) {
if (re->r.mode & R_ENVMAP)
- if(tex->env->stype==ENV_ANIM)
+ if (tex->env->stype==ENV_ANIM)
BKE_free_envmapdata(tex->env);
}
}
}
- if(tex->nodetree && tex->use_nodes) {
+ if (tex->nodetree && tex->use_nodes) {
ntreeTexBeginExecTree(tex->nodetree, 1); /* has internal flag to detect it only does it once */
}
}
@@ -140,23 +140,23 @@ void init_render_textures(Render *re)
Tex *tex;
tex= re->main->tex.first;
- while(tex) {
- if(tex->id.us) init_render_texture(re, tex);
+ while (tex) {
+ if (tex->id.us) init_render_texture(re, tex);
tex= tex->id.next;
}
}
static void end_render_texture(Tex *tex)
{
- if(tex && tex->use_nodes && tex->nodetree && tex->nodetree->execdata)
+ if (tex && tex->use_nodes && tex->nodetree && tex->nodetree->execdata)
ntreeTexEndExecTree(tex->nodetree->execdata, 1);
}
void end_render_textures(Render *re)
{
Tex *tex;
- for(tex= re->main->tex.first; tex; tex= tex->id.next)
- if(tex->id.us)
+ for (tex= re->main->tex.first; tex; tex= tex->id.next)
+ if (tex->id.us)
end_render_texture(tex);
}
@@ -197,7 +197,7 @@ static int blend(Tex *tex, float *texvec, TexResult *texres)
{
float x, y, t;
- if(tex->flag & TEX_FLIPBLEND) {
+ if (tex->flag & TEX_FLIPBLEND) {
x= texvec[1];
y= texvec[0];
}
@@ -206,33 +206,33 @@ static int blend(Tex *tex, float *texvec, TexResult *texres)
y= texvec[1];
}
- if(tex->stype==TEX_LIN) { /* lin */
+ if (tex->stype==TEX_LIN) { /* lin */
texres->tin= (1.0f+x)/2.0f;
}
- else if(tex->stype==TEX_QUAD) { /* quad */
+ else if (tex->stype==TEX_QUAD) { /* quad */
texres->tin= (1.0f+x)/2.0f;
- if(texres->tin<0.0f) texres->tin= 0.0f;
+ if (texres->tin<0.0f) texres->tin= 0.0f;
else texres->tin*= texres->tin;
}
- else if(tex->stype==TEX_EASE) { /* ease */
+ else if (tex->stype==TEX_EASE) { /* ease */
texres->tin= (1.0f+x)/2.0f;
- if(texres->tin<=0.0f) texres->tin= 0.0f;
- else if(texres->tin>=1.0f) texres->tin= 1.0f;
+ if (texres->tin<=0.0f) texres->tin= 0.0f;
+ else if (texres->tin>=1.0f) texres->tin= 1.0f;
else {
t= texres->tin*texres->tin;
texres->tin= (3.0f*t-2.0f*t*texres->tin);
}
}
- else if(tex->stype==TEX_DIAG) { /* diag */
+ else if (tex->stype==TEX_DIAG) { /* diag */
texres->tin= (2.0f+x+y)/4.0f;
}
- else if(tex->stype==TEX_RAD) { /* radial */
+ else if (tex->stype==TEX_RAD) { /* radial */
texres->tin= (atan2(y,x) / (2*M_PI) + 0.5);
}
else { /* sphere TEX_SPHERE */
texres->tin= 1.0-sqrt(x*x+ y*y+texvec[2]*texvec[2]);
- if(texres->tin<0.0f) texres->tin= 0.0f;
- if(tex->stype==TEX_HALO) texres->tin*= texres->tin; /* halo */
+ if (texres->tin<0.0f) texres->tin= 0.0f;
+ if (tex->stype==TEX_HALO) texres->tin*= texres->tin; /* halo */
}
BRICONT;
@@ -426,37 +426,37 @@ static int magic(Tex *tex, float *texvec, TexResult *texres)
x= sin( ( texvec[0]+texvec[1]+texvec[2])*5.0f );
y= cos( (-texvec[0]+texvec[1]-texvec[2])*5.0f );
z= -cos( (-texvec[0]-texvec[1]+texvec[2])*5.0f );
- if(n>0) {
+ if (n>0) {
x*= turb;
y*= turb;
z*= turb;
y= -cos(x-y+z);
y*= turb;
- if(n>1) {
+ if (n>1) {
x= cos(x-y-z);
x*= turb;
- if(n>2) {
+ if (n>2) {
z= sin(-x-y-z);
z*= turb;
- if(n>3) {
+ if (n>3) {
x= -cos(-x+y-z);
x*= turb;
- if(n>4) {
+ if (n>4) {
y= -sin(-x+y+z);
y*= turb;
- if(n>5) {
+ if (n>5) {
y= -cos(-x+y+z);
y*= turb;
- if(n>6) {
+ if (n>6) {
x= cos(x+y+z);
x*= turb;
- if(n>7) {
+ if (n>7) {
z= sin(x+y-z);
z*= turb;
- if(n>8) {
+ if (n>8) {
x= -cos(-x-y+z);
x*= turb;
- if(n>9) {
+ if (n>9) {
y= -sin(x-y+z);
y*= turb;
}
@@ -470,7 +470,7 @@ static int magic(Tex *tex, float *texvec, TexResult *texres)
}
}
- if(turb!=0.0f) {
+ if (turb!=0.0f) {
turb*= 2.0f;
x/= turb;
y/= turb;
@@ -500,19 +500,19 @@ static int stucci(Tex *tex, float *texvec, TexResult *texres)
ofs= tex->turbul/200.0f;
- if(tex->stype) ofs*=(b2*b2);
+ if (tex->stype) ofs*=(b2*b2);
nor[0] = BLI_gNoise(tex->noisesize, texvec[0]+ofs, texvec[1], texvec[2], (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
nor[1] = BLI_gNoise(tex->noisesize, texvec[0], texvec[1]+ofs, texvec[2], (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
nor[2] = BLI_gNoise(tex->noisesize, texvec[0], texvec[1], texvec[2]+ofs, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
texres->tin= nor[2];
- if(texres->nor) {
+ if (texres->nor) {
copy_v3_v3(texres->nor, nor);
tex_normal_derivate(tex, texres);
- if(tex->stype==TEX_WALLOUT) {
+ if (tex->stype==TEX_WALLOUT) {
texres->nor[0]= -texres->nor[0];
texres->nor[1]= -texres->nor[1];
texres->nor[2]= -texres->nor[2];
@@ -521,10 +521,10 @@ static int stucci(Tex *tex, float *texvec, TexResult *texres)
retval |= TEX_NOR;
}
- if(tex->stype==TEX_WALLOUT)
+ if (tex->stype==TEX_WALLOUT)
texres->tin= 1.0f-texres->tin;
- if(texres->tin<0.0f)
+ if (texres->tin<0.0f)
texres->tin= 0.0f;
return retval;
@@ -733,7 +733,7 @@ static int texnoise(Tex *tex, TexResult *texres)
val= (ran & 3);
loop= tex->noisedepth;
- while(loop--) {
+ while (loop--) {
ran= (ran>>2);
val*= (ran & 3);
div*= 3.0f;
@@ -756,21 +756,23 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex
texres->tin= 0.0;
pit= tex->plugin;
- if(pit && pit->doit) {
- if(texres->nor) {
+ if (pit && pit->doit) {
+ if (texres->nor) {
if (pit->version < 6) {
copy_v3_v3(pit->result+5, texres->nor);
- } else {
+ }
+ else {
copy_v3_v3(result+5, texres->nor);
}
}
if (pit->version < 6) {
- if(osatex) rgbnor= ((TexDoitold)pit->doit)(tex->stype,
+ if (osatex) rgbnor= ((TexDoitold)pit->doit)(tex->stype,
pit->data, texvec, dxt, dyt);
else rgbnor= ((TexDoitold)pit->doit)(tex->stype,
pit->data, texvec, NULL, NULL);
- } else {
- if(osatex) rgbnor= ((TexDoit)pit->doit)(tex->stype,
+ }
+ else {
+ if (osatex) rgbnor= ((TexDoit)pit->doit)(tex->stype,
pit->data, texvec, dxt, dyt, result);
else rgbnor= ((TexDoit)pit->doit)(tex->stype,
pit->data, texvec, NULL, NULL, result);
@@ -778,27 +780,30 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex
if (pit->version < 6) {
texres->tin = pit->result[0];
- } else {
+ }
+ else {
texres->tin = result[0]; /* XXX, assigning garbage value, fixme! */
}
- if(rgbnor & TEX_NOR) {
- if(texres->nor) {
+ if (rgbnor & TEX_NOR) {
+ if (texres->nor) {
if (pit->version < 6) {
copy_v3_v3(texres->nor, pit->result+5);
- } else {
+ }
+ else {
copy_v3_v3(texres->nor, result+5);
}
}
}
- if(rgbnor & TEX_RGB) {
+ if (rgbnor & TEX_RGB) {
if (pit->version < 6) {
texres->tr = pit->result[1];
texres->tg = pit->result[2];
texres->tb = pit->result[3];
texres->ta = pit->result[4];
- } else {
+ }
+ else {
texres->tr = result[1];
texres->tg = result[2];
texres->tb = result[3];
@@ -820,7 +825,7 @@ static int cubemap_glob(float *n, float x, float y, float z, float *adr1, float
float x1, y1, z1, nor[3];
int ret;
- if(n==NULL) {
+ if (n==NULL) {
nor[0]= x; nor[1]= y; nor[2]= z; // use local render coord
}
else {
@@ -832,12 +837,12 @@ static int cubemap_glob(float *n, float x, float y, float z, float *adr1, float
y1= fabs(nor[1]);
z1= fabs(nor[2]);
- if(z1>=x1 && z1>=y1) {
+ if (z1>=x1 && z1>=y1) {
*adr1 = (x + 1.0f) / 2.0f;
*adr2 = (y + 1.0f) / 2.0f;
ret= 0;
}
- else if(y1>=x1 && y1>=z1) {
+ else if (y1>=x1 && y1>=z1) {
*adr1 = (x + 1.0f) / 2.0f;
*adr2 = (z + 1.0f) / 2.0f;
ret= 1;
@@ -857,24 +862,24 @@ static int cubemap(MTex *mtex, VlakRen *vlr, float *n, float x, float y, float z
{
int proj[4]={0, ME_PROJXY, ME_PROJXZ, ME_PROJYZ}, ret= 0;
- if(vlr) {
+ if (vlr) {
int index;
/* Mesh vertices have such flags, for others we calculate it once based on orco */
- if((vlr->puno & (ME_PROJXY|ME_PROJXZ|ME_PROJYZ))==0) {
+ if ((vlr->puno & (ME_PROJXY|ME_PROJXZ|ME_PROJYZ))==0) {
/* test for v1, vlr can be faked for baking */
- if(vlr->v1 && vlr->v1->orco) {
+ if (vlr->v1 && vlr->v1->orco) {
float nor[3];
normal_tri_v3( nor,vlr->v1->orco, vlr->v2->orco, vlr->v3->orco);
- if( fabs(nor[0])<fabs(nor[2]) && fabs(nor[1])<fabs(nor[2]) ) vlr->puno |= ME_PROJXY;
- else if( fabs(nor[0])<fabs(nor[1]) && fabs(nor[2])<fabs(nor[1]) ) vlr->puno |= ME_PROJXZ;
+ if ( fabs(nor[0])<fabs(nor[2]) && fabs(nor[1])<fabs(nor[2]) ) vlr->puno |= ME_PROJXY;
+ else if ( fabs(nor[0])<fabs(nor[1]) && fabs(nor[2])<fabs(nor[1]) ) vlr->puno |= ME_PROJXZ;
else vlr->puno |= ME_PROJYZ;
}
else return cubemap_glob(n, x, y, z, adr1, adr2);
}
- if(mtex) {
+ if (mtex) {
/* the mtex->proj{xyz} have type char. maybe this should be wider? */
/* casting to int ensures that the index type is right. */
index = (int) mtex->projx;
@@ -887,11 +892,11 @@ static int cubemap(MTex *mtex, VlakRen *vlr, float *n, float x, float y, float z
proj[index]= ME_PROJYZ;
}
- if(vlr->puno & proj[1]) {
+ if (vlr->puno & proj[1]) {
*adr1 = (x + 1.0f) / 2.0f;
*adr2 = (y + 1.0f) / 2.0f;
}
- else if(vlr->puno & proj[2]) {
+ else if (vlr->puno & proj[2]) {
*adr1 = (x + 1.0f) / 2.0f;
*adr2 = (z + 1.0f) / 2.0f;
ret= 1;
@@ -916,21 +921,21 @@ static int cubemap_ob(Object *ob, float *n, float x, float y, float z, float *ad
float x1, y1, z1, nor[3];
int ret;
- if(n==NULL) return 0;
+ if (n==NULL) return 0;
copy_v3_v3(nor, n);
- if(ob) mul_mat3_m4_v3(ob->imat, nor);
+ if (ob) mul_mat3_m4_v3(ob->imat, nor);
x1= fabs(nor[0]);
y1= fabs(nor[1]);
z1= fabs(nor[2]);
- if(z1>=x1 && z1>=y1) {
+ if (z1>=x1 && z1>=y1) {
*adr1 = (x + 1.0f) / 2.0f;
*adr2 = (y + 1.0f) / 2.0f;
ret= 0;
}
- else if(y1>=x1 && y1>=z1) {
+ else if (y1>=x1 && y1>=z1) {
*adr1 = (x + 1.0f) / 2.0f;
*adr2 = (z + 1.0f) / 2.0f;
ret= 1;
@@ -958,53 +963,53 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
ob= mtex->object;
texco= mtex->texco;
- if(R.osa==0) {
+ if (R.osa==0) {
- if(wrap==MTEX_FLAT) {
+ if (wrap==MTEX_FLAT) {
fx = (t[0] + 1.0f) / 2.0f;
fy = (t[1] + 1.0f) / 2.0f;
}
- else if(wrap==MTEX_TUBE) map_to_tube( &fx, &fy,t[0], t[1], t[2]);
- else if(wrap==MTEX_SPHERE) map_to_sphere( &fx, &fy,t[0], t[1], t[2]);
+ else if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy,t[0], t[1], t[2]);
+ else if (wrap==MTEX_SPHERE) map_to_sphere( &fx, &fy,t[0], t[1], t[2]);
else {
- if(texco==TEXCO_OBJECT) cubemap_ob(ob, n, t[0], t[1], t[2], &fx, &fy);
- else if(texco==TEXCO_GLOB) cubemap_glob(n, t[0], t[1], t[2], &fx, &fy);
+ if (texco==TEXCO_OBJECT) cubemap_ob(ob, n, t[0], t[1], t[2], &fx, &fy);
+ else if (texco==TEXCO_GLOB) cubemap_glob(n, t[0], t[1], t[2], &fx, &fy);
else cubemap(mtex, vlr, n, t[0], t[1], t[2], &fx, &fy);
}
/* repeat */
- if(tex->extend==TEX_REPEAT) {
- if(tex->xrepeat>1) {
+ if (tex->extend==TEX_REPEAT) {
+ if (tex->xrepeat>1) {
float origf= fx *= tex->xrepeat;
- if(fx>1.0f) fx -= (int)(fx);
- else if(fx<0.0f) fx+= 1-(int)(fx);
+ if (fx>1.0f) fx -= (int)(fx);
+ else if (fx<0.0f) fx+= 1-(int)(fx);
- if(tex->flag & TEX_REPEAT_XMIR) {
+ if (tex->flag & TEX_REPEAT_XMIR) {
int orig= (int)floor(origf);
- if(orig & 1)
+ if (orig & 1)
fx= 1.0f-fx;
}
}
- if(tex->yrepeat>1) {
+ if (tex->yrepeat>1) {
float origf= fy *= tex->yrepeat;
- if(fy>1.0f) fy -= (int)(fy);
- else if(fy<0.0f) fy+= 1-(int)(fy);
+ if (fy>1.0f) fy -= (int)(fy);
+ else if (fy<0.0f) fy+= 1-(int)(fy);
- if(tex->flag & TEX_REPEAT_YMIR) {
+ if (tex->flag & TEX_REPEAT_YMIR) {
int orig= (int)floor(origf);
- if(orig & 1)
+ if (orig & 1)
fy= 1.0f-fy;
}
}
}
/* crop */
- if(tex->cropxmin!=0.0f || tex->cropxmax!=1.0f) {
+ if (tex->cropxmin!=0.0f || tex->cropxmax!=1.0f) {
fac1= tex->cropxmax - tex->cropxmin;
fx= tex->cropxmin+ fx*fac1;
}
- if(tex->cropymin!=0.0f || tex->cropymax!=1.0f) {
+ if (tex->cropymin!=0.0f || tex->cropymax!=1.0f) {
fac1= tex->cropymax - tex->cropymin;
fy= tex->cropymin+ fy*fac1;
}
@@ -1014,7 +1019,7 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
}
else {
- if(wrap==MTEX_FLAT) {
+ if (wrap==MTEX_FLAT) {
fx= (t[0] + 1.0f) / 2.0f;
fy= (t[1] + 1.0f) / 2.0f;
dxt[0]/= 2.0f;
@@ -1027,15 +1032,15 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
else if ELEM(wrap, MTEX_TUBE, MTEX_SPHERE) {
/* exception: the seam behind (y<0.0) */
ok= 1;
- if(t[1]<=0.0f) {
+ if (t[1]<=0.0f) {
fx= t[0]+dxt[0];
fy= t[0]+dyt[0];
- if(fx>=0.0f && fy>=0.0f && t[0]>=0.0f);
- else if(fx<=0.0f && fy<=0.0f && t[0]<=0.0f);
+ if (fx>=0.0f && fy>=0.0f && t[0]>=0.0f);
+ else if (fx<=0.0f && fy<=0.0f && t[0]<=0.0f);
else ok= 0;
}
- if(ok) {
- if(wrap==MTEX_TUBE) {
+ if (ok) {
+ if (wrap==MTEX_TUBE) {
map_to_tube( area, area+1,t[0], t[1], t[2]);
map_to_tube( area+2, area+3,t[0]+dxt[0], t[1]+dxt[1], t[2]+dxt[2]);
map_to_tube( area+4, area+5,t[0]+dyt[0], t[1]+dyt[1], t[2]+dyt[2]);
@@ -1048,7 +1053,7 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
areaflag= 1;
}
else {
- if(wrap==MTEX_TUBE) map_to_tube( &fx, &fy,t[0], t[1], t[2]);
+ if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy,t[0], t[1], t[2]);
else map_to_sphere( &fx, &fy,t[0], t[1], t[2]);
dxt[0]/= 2.0f;
dxt[1]/= 2.0f;
@@ -1058,15 +1063,15 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
}
else {
- if(texco==TEXCO_OBJECT) proj = cubemap_ob(ob, n, t[0], t[1], t[2], &fx, &fy);
+ if (texco==TEXCO_OBJECT) proj = cubemap_ob(ob, n, t[0], t[1], t[2], &fx, &fy);
else if (texco==TEXCO_GLOB) proj = cubemap_glob(n, t[0], t[1], t[2], &fx, &fy);
else proj = cubemap(mtex, vlr, n, t[0], t[1], t[2], &fx, &fy);
- if(proj==1) {
+ if (proj==1) {
SWAP(float, dxt[1], dxt[2]);
SWAP(float, dyt[1], dyt[2]);
}
- else if(proj==2) {
+ else if (proj==2) {
float f1= dxt[0], f2= dyt[0];
dxt[0]= dxt[1];
dyt[0]= dyt[1];
@@ -1087,7 +1092,7 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
}
/* if area, then reacalculate dxt[] and dyt[] */
- if(areaflag) {
+ if (areaflag) {
fx= area[0];
fy= area[1];
dxt[0]= area[2]-fx;
@@ -1097,19 +1102,19 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
}
/* repeat */
- if(tex->extend==TEX_REPEAT) {
+ if (tex->extend==TEX_REPEAT) {
float max= 1.0f;
- if(tex->xrepeat>1) {
+ if (tex->xrepeat>1) {
float origf= fx *= tex->xrepeat;
// TXF: omit mirror here, see comments in do_material_tex() after do_2d_mapping() call
if (tex->texfilter == TXF_BOX) {
- if(fx>1.0f) fx -= (int)(fx);
- else if(fx<0.0f) fx+= 1-(int)(fx);
+ if (fx>1.0f) fx -= (int)(fx);
+ else if (fx<0.0f) fx+= 1-(int)(fx);
- if(tex->flag & TEX_REPEAT_XMIR) {
+ if (tex->flag & TEX_REPEAT_XMIR) {
int orig= (int)floor(origf);
- if(orig & 1)
+ if (orig & 1)
fx= 1.0f-fx;
}
}
@@ -1119,41 +1124,41 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
dxt[0]*= tex->xrepeat;
dyt[0]*= tex->xrepeat;
}
- if(tex->yrepeat>1) {
+ if (tex->yrepeat>1) {
float origf= fy *= tex->yrepeat;
// TXF: omit mirror here, see comments in do_material_tex() after do_2d_mapping() call
if (tex->texfilter == TXF_BOX) {
- if(fy>1.0f) fy -= (int)(fy);
- else if(fy<0.0f) fy+= 1-(int)(fy);
+ if (fy>1.0f) fy -= (int)(fy);
+ else if (fy<0.0f) fy+= 1-(int)(fy);
- if(tex->flag & TEX_REPEAT_YMIR) {
+ if (tex->flag & TEX_REPEAT_YMIR) {
int orig= (int)floor(origf);
- if(orig & 1)
+ if (orig & 1)
fy= 1.0f-fy;
}
}
- if(max<tex->yrepeat)
+ if (max<tex->yrepeat)
max= tex->yrepeat;
dxt[1]*= tex->yrepeat;
dyt[1]*= tex->yrepeat;
}
- if(max!=1.0f) {
+ if (max!=1.0f) {
dxt[2]*= max;
dyt[2]*= max;
}
}
/* crop */
- if(tex->cropxmin!=0.0f || tex->cropxmax!=1.0f) {
+ if (tex->cropxmin!=0.0f || tex->cropxmax!=1.0f) {
fac1= tex->cropxmax - tex->cropxmin;
fx= tex->cropxmin+ fx*fac1;
dxt[0]*= fac1;
dyt[0]*= fac1;
}
- if(tex->cropymin!=0.0f || tex->cropymax!=1.0f) {
+ if (tex->cropymin!=0.0f || tex->cropymax!=1.0f) {
fac1= tex->cropymax - tex->cropymin;
fy= tex->cropymin+ fy*fac1;
dxt[1]*= fac1;
@@ -1175,7 +1180,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
texres->talpha= 0; /* is set when image texture returns alpha (considered premul) */
- if(tex->use_nodes && tex->nodetree) {
+ if (tex->use_nodes && tex->nodetree) {
retval = ntreeTexExecTree(tex->nodetree, texres, texvec, dxt, dyt, osatex, thread,
tex, which_output, R.r.cfra, (R.r.scemode & R_TEXNODE_PREVIEW) != 0, NULL, NULL);
}
@@ -1207,7 +1212,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
retval= texnoise(tex, texres);
break;
case TEX_IMAGE:
- if(osatex) retval= imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres);
+ if (osatex) retval= imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres);
else retval= imagewrap(tex, tex->ima, NULL, texvec, texres);
tag_image_time(tex->ima); /* tag image as having being used */
break;
@@ -1287,27 +1292,27 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
/* this is called from the shader and texture nodes */
int multitex_nodes(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output, ShadeInput *shi, MTex *mtex)
{
- if(tex==NULL) {
+ if (tex==NULL) {
memset(texres, 0, sizeof(TexResult));
return 0;
}
- if(mtex)
+ if (mtex)
which_output= mtex->which_output;
- if(tex->type==TEX_IMAGE) {
+ if (tex->type==TEX_IMAGE) {
int rgbnor;
- if(mtex) {
+ if (mtex) {
/* we have mtex, use it for 2d mapping images only */
do_2d_mapping(mtex, texvec, shi->vlr, shi->facenor, dxt, dyt);
rgbnor= multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output);
- if(mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) {
+ if (mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) {
ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
/* don't linearize float buffers, assumed to be linear */
- if(ibuf && !(ibuf->rect_float) && R.r.color_mgt_flag & R_COLOR_MANAGEMENT)
+ if (ibuf && !(ibuf->rect_float) && R.r.color_mgt_flag & R_COLOR_MANAGEMENT)
srgb_to_linearrgb_v3_v3(&texres->tr, &texres->tr);
}
}
@@ -1322,7 +1327,7 @@ int multitex_nodes(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
localmtex.texco= TEXCO_ORCO;
copy_v3_v3(texvec_l, texvec);
- if(dxt && dyt) {
+ if (dxt && dyt) {
copy_v3_v3(dxt_l, dxt);
copy_v3_v3(dyt_l, dyt);
}
@@ -1346,7 +1351,7 @@ int multitex_mtex(ShadeInput *shi, MTex *mtex, float *texvec, float *dxt, float
{
Tex *tex= mtex->tex;
- if(tex->use_nodes && tex->nodetree) {
+ if (tex->use_nodes && tex->nodetree) {
/* stupid exception here .. but we have to pass shi and mtex to
* textures nodes for 2d mapping and color management for images */
return ntreeTexExecTree(tex->nodetree, texres, texvec, dxt, dyt, shi->osatex, shi->thread,
@@ -1414,15 +1419,15 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
fact*= facg;
facm= 1.0f-facg;
- if(out[0] < 0.5f)
+ if (out[0] < 0.5f)
in[0] = out[0] * (facm + 2.0f*fact*tex[0]);
else
in[0] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[0])) * (1.0f - out[0]);
- if(out[1] < 0.5f)
+ if (out[1] < 0.5f)
in[1] = out[1] * (facm + 2.0f*fact*tex[1]);
else
in[1] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[1])) * (1.0f - out[1]);
- if(out[2] < 0.5f)
+ if (out[2] < 0.5f)
in[2] = out[2] * (facm + 2.0f*fact*tex[2]);
else
in[2] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[2])) * (1.0f - out[2]);
@@ -1441,11 +1446,11 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
fact*= facg;
facm= 1.0f-fact;
- if(tex[0]!=0.0f)
+ if (tex[0]!=0.0f)
in[0]= facm*out[0] + fact*out[0]/tex[0];
- if(tex[1]!=0.0f)
+ if (tex[1]!=0.0f)
in[1]= facm*out[1] + fact*out[1]/tex[1];
- if(tex[2]!=0.0f)
+ if (tex[2]!=0.0f)
in[2]= facm*out[2] + fact*out[2]/tex[2];
break;
@@ -1463,22 +1468,22 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
facm= 1.0f-fact;
col= tex[0]+((1-tex[0])*facm);
- if(col < out[0]) in[0]= col; else in[0]= out[0];
+ if (col < out[0]) in[0]= col; else in[0]= out[0];
col= tex[1]+((1-tex[1])*facm);
- if(col < out[1]) in[1]= col; else in[1]= out[1];
+ if (col < out[1]) in[1]= col; else in[1]= out[1];
col= tex[2]+((1-tex[2])*facm);
- if(col < out[2]) in[2]= col; else in[2]= out[2];
+ if (col < out[2]) in[2]= col; else in[2]= out[2];
break;
case MTEX_LIGHT:
fact*= facg;
col= fact*tex[0];
- if(col > out[0]) in[0]= col; else in[0]= out[0];
+ if (col > out[0]) in[0]= col; else in[0]= out[0];
col= fact*tex[1];
- if(col > out[1]) in[1]= col; else in[1]= out[1];
+ if (col > out[1]) in[1]= col; else in[1]= out[1];
col= fact*tex[2];
- if(col > out[2]) in[2]= col; else in[2]= out[2];
+ if (col > out[2]) in[2]= col; else in[2]= out[2];
break;
case MTEX_BLEND_HUE:
@@ -1523,7 +1528,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
fact*= facg;
facm= 1.0f-fact;
- if(flip) SWAP(float, fact, facm);
+ if (flip) SWAP(float, fact, facm);
switch(blendtype) {
case MTEX_BLEND:
@@ -1542,7 +1547,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
case MTEX_OVERLAY:
facm= 1.0f-facg;
- if(out < 0.5f)
+ if (out < 0.5f)
in = out * (facm + 2.0f*fact*tex);
else
in = 1.0f - (facm + 2.0f*fact*(1.0f - tex)) * (1.0f - out);
@@ -1555,7 +1560,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
break;
case MTEX_DIV:
- if(tex!=0.0f)
+ if (tex!=0.0f)
in= facm*out + fact*out/tex;
break;
@@ -1565,12 +1570,12 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
case MTEX_DARK:
col= fact*tex;
- if(col < out) in= col; else in= out;
+ if (col < out) in= col; else in= out;
break;
case MTEX_LIGHT:
col= fact*tex;
- if(col > out) in= col; else in= out;
+ if (col > out) in= col; else in= out;
break;
case MTEX_SOFT_LIGHT:
@@ -1702,14 +1707,14 @@ static void compatible_bump_uv_derivs(CompatibleBump *compat_bump, ShadeInput *s
// NOTE: test for shi->obr->ob here, since vlr/obr/obi can be 'fake' when called from fastshade(), another reason to move it..
// NOTE: shi->v1 is NULL when called from displace_render_vert, assigning verts in this case is not trivial because the shi quad face side is not know.
if ((mtex->texflag & MTEX_COMPAT_BUMP) && shi->obr && shi->obr->ob && shi->v1) {
- if(mtex->mapto & (MAP_NORM|MAP_WARP) && !((mtex->tex->type==TEX_IMAGE) && (mtex->tex->imaflag & TEX_NORMALMAP))) {
+ if (mtex->mapto & (MAP_NORM|MAP_WARP) && !((mtex->tex->type==TEX_IMAGE) && (mtex->tex->imaflag & TEX_NORMALMAP))) {
MTFace* tf = RE_vlakren_get_tface(shi->obr, shi->vlr, i, NULL, 0);
int j1 = shi->i1, j2 = shi->i2, j3 = shi->i3;
vlr_set_uv_indices(shi->vlr, &j1, &j2, &j3);
// compute ortho basis around normal
- if(!compat_bump->nunvdone) {
+ if (!compat_bump->nunvdone) {
// render normal is negated
compat_bump->nn[0] = -shi->vn[0];
compat_bump->nn[1] = -shi->vn[1];
@@ -1763,7 +1768,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
du = dv = 0.01f;
// compute ortho basis around normal
- if(!compat_bump->nunvdone) {
+ if (!compat_bump->nunvdone) {
// render normal is negated
negate_v3_v3(compat_bump->nn, shi->vn);
ortho_basis_v3v3_v3(compat_bump->nu, compat_bump->nv, compat_bump->nn);
@@ -1932,15 +1937,16 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
float *nvec = texres->nor;
texres->nor = NULL;
- if(found_deriv_map==0) {
- if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
- if(tex->ima)
+ if (found_deriv_map==0) {
+ if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
+ if (tex->ima)
Hscale *= 13.0f; // appears to be a sensible default value
- } else
+ }
+ else
Hscale *= 0.1f; // factor 0.1 proved to look like the previous bump code
}
- if( !ntap_bump->init_done ) {
+ if ( !ntap_bump->init_done ) {
copy_v3_v3(ntap_bump->vNacc, shi->vn);
copy_v3_v3(ntap_bump->vNorg, shi->vn);
ntap_bump->fPrevMagnitude = 1.0f;
@@ -1950,7 +1956,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
}
// resolve image dimensions
- if(found_deriv_map || (mtex->texflag&MTEX_BUMP_TEXTURESPACE)!=0) {
+ if (found_deriv_map || (mtex->texflag&MTEX_BUMP_TEXTURESPACE)!=0) {
ImBuf* ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
if (ibuf) {
dimx = ibuf->x;
@@ -1959,13 +1965,13 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
}
}
- if(found_deriv_map) {
+ if (found_deriv_map) {
float dBdu, dBdv, auto_bump = 1.0f;
float s = 1; // negate this if flipped texture coordinate
texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres);
- if(shi->obr->ob->derivedFinal) {
+ if (shi->obr->ob->derivedFinal) {
auto_bump = shi->obr->ob->derivedFinal->auto_bump_scale;
}
@@ -1982,14 +1988,14 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
dHdx = dBdu*dxt[0] + s * dBdv*dxt[1];
dHdy = dBdu*dyt[0] + s * dBdv*dyt[1];
}
- else if(!(mtex->texflag & MTEX_5TAP_BUMP)) {
+ else if (!(mtex->texflag & MTEX_5TAP_BUMP)) {
// compute height derivatives with respect to output image pixel coordinates x and y
float STll[3], STlr[3], STul[3];
float Hll, Hlr, Hul;
texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
- for(c=0; c<nr_channels; c++) {
+ for (c=0; c<nr_channels; c++) {
// dx contains the derivatives (du/dx, dv/dx)
// dy contains the derivatives (du/dy, dv/dy)
STll[c] = texvec[c];
@@ -1998,7 +2004,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
}
// clear unused derivatives
- for(c=nr_channels; c<3; c++) {
+ for (c=nr_channels; c<3; c++) {
STll[c] = 0.0f;
STlr[c] = 0.0f;
STul[c] = 0.0f;
@@ -2025,7 +2031,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
- for(c=0; c<nr_channels; c++) {
+ for (c=0; c<nr_channels; c++) {
STc[c] = texvec[c];
STl[c] = texvec[c] - 0.5f*dxt[c];
STr[c] = texvec[c] + 0.5f*dxt[c];
@@ -2034,7 +2040,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
}
// clear unused derivatives
- for(c=nr_channels; c<3; c++) {
+ for (c=nr_channels; c<3; c++) {
STc[c] = 0.0f;
STl[c] = 0.0f;
STr[c] = 0.0f;
@@ -2067,14 +2073,14 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
* [Mik10] Mikkelsen M. S.: Bump Mapping Unparametrized Surfaces on the GPU.
* -> http://jbit.net/~sparky/sfgrad_bump/mm_sfgrad_bump.pdf */
- if( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
+ if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
iBumpSpace = 1;
- else if( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
+ else if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
iBumpSpace = 2;
else
iBumpSpace = 4; // ViewSpace
- if( ntap_bump->iPrevBumpSpace != iBumpSpace ) {
+ if ( ntap_bump->iPrevBumpSpace != iBumpSpace ) {
// initialize normal perturbation vectors
int xyz;
@@ -2087,7 +2093,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
copy_v3_v3(dPdy, shi->dyco);
copy_v3_v3(vN, ntap_bump->vNorg);
- if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) {
+ if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) {
// TODO: these calculations happen for every pixel!
// -> move to shi->obi
mult_m4_m4m4(tmp, R.viewmat, shi->obr->ob->obmat);
@@ -2108,8 +2114,8 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
ntap_bump->sgn_det = (fDet < 0)? -1.0f: 1.0f;
abs_fDet = ntap_bump->sgn_det * fDet;
- if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
- if(tex->ima) {
+ if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
+ if (tex->ima) {
// crazy hack solution that gives results similar to normal mapping - part 1
normalize_v3(ntap_bump->vR1);
normalize_v3(ntap_bump->vR2);
@@ -2118,7 +2124,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
}
fMagnitude = abs_fDet;
- if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) {
+ if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) {
// pre do transform of texres->nor by the inverse transposed of obj2view
mul_transposed_m3_v3( view2obj, vN );
mul_transposed_m3_v3( view2obj, ntap_bump->vR1 );
@@ -2127,16 +2133,16 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
fMagnitude *= len_v3(vN);
}
- if(ntap_bump->fPrevMagnitude > 0.0f)
- for(xyz=0; xyz<3; xyz++)
+ if (ntap_bump->fPrevMagnitude > 0.0f)
+ for (xyz=0; xyz<3; xyz++)
ntap_bump->vNacc[xyz] *= fMagnitude / ntap_bump->fPrevMagnitude;
ntap_bump->fPrevMagnitude = fMagnitude;
ntap_bump->iPrevBumpSpace = iBumpSpace;
}
- if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
- if(tex->ima) {
+ if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
+ if (tex->ima) {
// crazy hack solution that gives results similar to normal mapping - part 2
float vec[2];
const float imag_tspace_dimension_y = aspect*imag_tspace_dimension_x;
@@ -2151,7 +2157,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
}
// subtract the surface gradient from vNacc
- for(c=0; c<3; c++) {
+ for (c=0; c<3; c++) {
float vSurfGrad_compi = ntap_bump->sgn_det * (dHdx * ntap_bump->vR1[c] + dHdy * ntap_bump->vR2[c]);
ntap_bump->vNacc[c] -= vSurfGrad_compi;
texres->nor[c] = ntap_bump->vNacc[c]; // copy
@@ -2182,42 +2188,42 @@ void do_material_tex(ShadeInput *shi, Render *re)
if (re->r.scemode & R_NO_TEX) return;
/* here: test flag if there's a tex (todo) */
- for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+ for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
/* separate tex switching */
- if(shi->mat->septex & (1<<tex_nr)) continue;
+ if (shi->mat->septex & (1<<tex_nr)) continue;
- if(shi->mat->mtex[tex_nr]) {
+ if (shi->mat->mtex[tex_nr]) {
mtex= shi->mat->mtex[tex_nr];
tex= mtex->tex;
- if(tex==0) continue;
+ if (tex==0) continue;
found_deriv_map = (tex->type==TEX_IMAGE) && (tex->imaflag & TEX_DERIVATIVEMAP);
use_compat_bump= (mtex->texflag & MTEX_COMPAT_BUMP);
use_ntap_bump= ((mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP))!=0 || found_deriv_map!=0) ? 1 : 0;
/* XXX texture node trees don't work for this yet */
- if(tex->nodetree && tex->use_nodes) {
+ if (tex->nodetree && tex->use_nodes) {
use_compat_bump = 0;
use_ntap_bump = 0;
}
/* case displacement mapping */
- if(shi->osatex==0 && use_ntap_bump) {
+ if (shi->osatex==0 && use_ntap_bump) {
use_ntap_bump = 0;
use_compat_bump = 1;
}
/* case ocean */
- if(tex->type == TEX_OCEAN) {
+ if (tex->type == TEX_OCEAN) {
use_ntap_bump = 0;
use_compat_bump = 0;
}
/* which coords */
- if(mtex->texco==TEXCO_ORCO) {
- if(mtex->texflag & MTEX_DUPLI_MAPTO) {
+ if (mtex->texco==TEXCO_ORCO) {
+ if (mtex->texflag & MTEX_DUPLI_MAPTO) {
co= shi->duplilo; dx= dxt; dy= dyt;
dxt[0]= dxt[1]= dxt[2]= 0.0f;
dyt[0]= dyt[1]= dyt[2]= 0.0f;
@@ -2226,21 +2232,21 @@ void do_material_tex(ShadeInput *shi, Render *re)
co= shi->lo; dx= shi->dxlo; dy= shi->dylo;
}
}
- else if(mtex->texco==TEXCO_STICKY) {
+ else if (mtex->texco==TEXCO_STICKY) {
co= shi->sticky; dx= shi->dxsticky; dy= shi->dysticky;
}
- else if(mtex->texco==TEXCO_OBJECT) {
+ else if (mtex->texco==TEXCO_OBJECT) {
Object *ob= mtex->object;
- if(ob) {
+ if (ob) {
co= tempvec;
dx= dxt;
dy= dyt;
copy_v3_v3(tempvec, shi->co);
- if(mtex->texflag & MTEX_OB_DUPLI_ORIG)
- if(shi->obi && shi->obi->duplitexmat)
+ if (mtex->texflag & MTEX_OB_DUPLI_ORIG)
+ if (shi->obi && shi->obi->duplitexmat)
mul_m4_v3(shi->obi->duplitexmat, tempvec);
mul_m4_v3(ob->imat_ren, tempvec);
- if(shi->osatex) {
+ if (shi->osatex) {
copy_v3_v3(dxt, shi->dxco);
copy_v3_v3(dyt, shi->dyco);
mul_mat3_m4_v3(ob->imat_ren, dxt);
@@ -2253,21 +2259,21 @@ void do_material_tex(ShadeInput *shi, Render *re)
dx= shi->dxco; dy= shi->dyco;
}
}
- else if(mtex->texco==TEXCO_REFL) {
+ else if (mtex->texco==TEXCO_REFL) {
calc_R_ref(shi);
co= shi->ref; dx= shi->dxref; dy= shi->dyref;
}
- else if(mtex->texco==TEXCO_NORM) {
+ else if (mtex->texco==TEXCO_NORM) {
co= shi->orn; dx= shi->dxno; dy= shi->dyno;
}
- else if(mtex->texco==TEXCO_TANGENT) {
+ else if (mtex->texco==TEXCO_TANGENT) {
co= shi->tang; dx= shi->dxno; dy= shi->dyno;
}
- else if(mtex->texco==TEXCO_GLOB) {
+ else if (mtex->texco==TEXCO_GLOB) {
co= shi->gl; dx= shi->dxgl; dy= shi->dygl;
}
- else if(mtex->texco==TEXCO_UV) {
- if(mtex->texflag & MTEX_DUPLI_MAPTO) {
+ else if (mtex->texco==TEXCO_UV) {
+ if (mtex->texflag & MTEX_DUPLI_MAPTO) {
co= shi->dupliuv; dx= dxt; dy= dyt;
dxt[0]= dxt[1]= dxt[2]= 0.0f;
dyt[0]= dyt[1]= dyt[2]= 0.0f;
@@ -2276,9 +2282,9 @@ void do_material_tex(ShadeInput *shi, Render *re)
ShadeInputUV *suv= &shi->uv[shi->actuv];
int i = shi->actuv;
- if(mtex->uvname[0] != 0) {
- for(i = 0; i < shi->totuv; i++) {
- if(strcmp(shi->uv[i].name, mtex->uvname)==0) {
+ if (mtex->uvname[0] != 0) {
+ for (i = 0; i < shi->totuv; i++) {
+ if (strcmp(shi->uv[i].name, mtex->uvname)==0) {
suv= &shi->uv[i];
break;
}
@@ -2292,10 +2298,10 @@ void do_material_tex(ShadeInput *shi, Render *re)
compatible_bump_uv_derivs(&compat_bump, shi, mtex, i);
}
}
- else if(mtex->texco==TEXCO_WINDOW) {
+ else if (mtex->texco==TEXCO_WINDOW) {
co= shi->winco; dx= shi->dxwin; dy= shi->dywin;
}
- else if(mtex->texco==TEXCO_STRAND) {
+ else if (mtex->texco==TEXCO_STRAND) {
co= tempvec; dx= dxt; dy= dyt;
co[0]= shi->strandco;
co[1]= co[2]= 0.0f;
@@ -2304,7 +2310,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
dy[0]= shi->dystrand;
dy[1]= dy[2]= 0.0f;
}
- else if(mtex->texco==TEXCO_STRESS) {
+ else if (mtex->texco==TEXCO_STRESS) {
co= tempvec; dx= dxt; dy= dyt;
co[0]= shi->stress;
co[1]= co[2]= 0.0f;
@@ -2316,24 +2322,24 @@ void do_material_tex(ShadeInput *shi, Render *re)
else continue; // can happen when texco defines disappear and it renders old files
/* the pointer defines if bumping happens */
- if(mtex->mapto & (MAP_NORM|MAP_WARP)) {
+ if (mtex->mapto & (MAP_NORM|MAP_WARP)) {
texres.nor= norvec;
norvec[0]= norvec[1]= norvec[2]= 0.0;
}
else texres.nor= NULL;
- if(warpdone) {
+ if (warpdone) {
add_v3_v3v3(tempvec, co, warpvec);
co= tempvec;
}
/* XXX texture node trees don't work for this yet */
- if(texres.nor && !((tex->type==TEX_IMAGE) && (tex->imaflag & TEX_NORMALMAP))) {
- if(use_compat_bump) {
+ if (texres.nor && !((tex->type==TEX_IMAGE) && (tex->imaflag & TEX_NORMALMAP))) {
+ if (use_compat_bump) {
rgbnor = compatible_bump_compute(&compat_bump, shi, mtex, tex,
&texres, Tnor*stencilTin, co, dx, dy, texvec, dxt, dyt);
}
- else if(use_ntap_bump) {
+ else if (use_ntap_bump) {
rgbnor = ntap_bump_compute(&ntap_bump, shi, mtex, tex,
&texres, Tnor*stencilTin, co, dx, dy, texvec, dxt, dyt);
}
@@ -2349,20 +2355,20 @@ void do_material_tex(ShadeInput *shi, Render *re)
/* texture output */
- if( (rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
+ if ( (rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
rgbnor-= TEX_RGB;
}
- if(mtex->texflag & MTEX_NEGATIVE) {
- if(rgbnor & TEX_RGB) {
+ if (mtex->texflag & MTEX_NEGATIVE) {
+ if (rgbnor & TEX_RGB) {
texres.tr= 1.0f-texres.tr;
texres.tg= 1.0f-texres.tg;
texres.tb= 1.0f-texres.tb;
}
texres.tin= 1.0f-texres.tin;
}
- if(mtex->texflag & MTEX_STENCIL) {
- if(rgbnor & TEX_RGB) {
+ if (mtex->texflag & MTEX_STENCIL) {
+ if (rgbnor & TEX_RGB) {
fact= texres.ta;
texres.ta*= stencilTin;
stencilTin*= fact;
@@ -2377,10 +2383,10 @@ void do_material_tex(ShadeInput *shi, Render *re)
Tnor*= stencilTin;
}
- if(texres.nor) {
- if((rgbnor & TEX_NOR)==0) {
+ if (texres.nor) {
+ if ((rgbnor & TEX_NOR)==0) {
/* make our own normal */
- if(rgbnor & TEX_RGB) {
+ if (rgbnor & TEX_RGB) {
texres.nor[0]= texres.tr;
texres.nor[1]= texres.tg;
texres.nor[2]= texres.tb;
@@ -2400,10 +2406,10 @@ void do_material_tex(ShadeInput *shi, Render *re)
}
}
// warping, local space
- if(mtex->mapto & MAP_WARP) {
+ if (mtex->mapto & MAP_WARP) {
float *warpnor= texres.nor, warpnor_[3];
- if(use_ntap_bump) {
+ if (use_ntap_bump) {
copy_v3_v3(warpnor_, texres.nor);
warpnor= warpnor_;
normalize_v3(warpnor_);
@@ -2414,10 +2420,10 @@ void do_material_tex(ShadeInput *shi, Render *re)
warpdone= 1;
}
#if 0
- if(mtex->texflag & MTEX_VIEWSPACE) {
+ if (mtex->texflag & MTEX_VIEWSPACE) {
// rotate to global coords
- if(mtex->texco==TEXCO_ORCO || mtex->texco==TEXCO_UV) {
- if(shi->vlr && shi->obr && shi->obr->ob) {
+ if (mtex->texco==TEXCO_ORCO || mtex->texco==TEXCO_UV) {
+ if (shi->vlr && shi->obr && shi->obr->ob) {
float len= normalize_v3(texres.nor);
// can be optimized... (ton)
mul_mat3_m4_v3(shi->obr->ob->obmat, texres.nor);
@@ -2431,19 +2437,19 @@ void do_material_tex(ShadeInput *shi, Render *re)
}
/* mapping */
- if(mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) {
+ if (mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) {
float tcol[3];
/* stencil maps on the texture control slider, not texture intensity value */
tcol[0]=texres.tr; tcol[1]=texres.tg; tcol[2]=texres.tb;
- if((rgbnor & TEX_RGB)==0) {
+ if ((rgbnor & TEX_RGB)==0) {
tcol[0]= mtex->r;
tcol[1]= mtex->g;
tcol[2]= mtex->b;
}
- else if(mtex->mapto & MAP_ALPHA) {
+ else if (mtex->mapto & MAP_ALPHA) {
texres.tin= stencilTin;
}
else texres.tin= texres.ta;
@@ -2458,19 +2464,19 @@ void do_material_tex(ShadeInput *shi, Render *re)
srgb_to_linearrgb_v3_v3(tcol, tcol);
}
- if(mtex->mapto & MAP_COL) {
+ if (mtex->mapto & MAP_COL) {
float colfac= mtex->colfac*stencilTin;
texture_rgb_blend(&shi->r, tcol, &shi->r, texres.tin, colfac, mtex->blendtype);
}
- if(mtex->mapto & MAP_COLSPEC) {
+ if (mtex->mapto & MAP_COLSPEC) {
float colspecfac= mtex->colspecfac*stencilTin;
texture_rgb_blend(&shi->specr, tcol, &shi->specr, texres.tin, colspecfac, mtex->blendtype);
}
- if(mtex->mapto & MAP_COLMIR) {
+ if (mtex->mapto & MAP_COLMIR) {
float mirrfac= mtex->mirrfac*stencilTin;
// exception for envmap only
- if(tex->type==TEX_ENVMAP && mtex->blendtype==MTEX_BLEND) {
+ if (tex->type==TEX_ENVMAP && mtex->blendtype==MTEX_BLEND) {
fact= texres.tin*mirrfac;
facm= 1.0f- fact;
shi->refcol[0]= fact + facm*shi->refcol[0];
@@ -2483,8 +2489,8 @@ void do_material_tex(ShadeInput *shi, Render *re)
}
}
}
- if( (mtex->mapto & MAP_NORM) ) {
- if(texres.nor) {
+ if ( (mtex->mapto & MAP_NORM) ) {
+ if (texres.nor) {
float norfac= mtex->norfac;
/* we need to code blending modes for normals too once.. now 1 exception hardcoded */
@@ -2502,7 +2508,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
fact = Tnor*fabsf(norfac);
if (fact>1.f) fact = 1.f;
facm = 1.f-fact;
- if(mtex->normapspace == MTEX_NSPACE_TANGENT) {
+ if (mtex->normapspace == MTEX_NSPACE_TANGENT) {
/* qdn: tangent space */
float B[3], tv[3];
const float * no = iFirstTimeNMap!=0 ? shi->nmapnorm : shi->vn;
@@ -2522,12 +2528,12 @@ void do_material_tex(ShadeInput *shi, Render *re)
copy_v3_v3(nor, texres.nor);
- if(mtex->normapspace == MTEX_NSPACE_CAMERA);
- else if(mtex->normapspace == MTEX_NSPACE_WORLD) {
+ if (mtex->normapspace == MTEX_NSPACE_CAMERA);
+ else if (mtex->normapspace == MTEX_NSPACE_WORLD) {
mul_mat3_m4_v3(re->viewmat, nor);
}
- else if(mtex->normapspace == MTEX_NSPACE_OBJECT) {
- if(shi->obr && shi->obr->ob)
+ else if (mtex->normapspace == MTEX_NSPACE_OBJECT) {
+ if (shi->obr && shi->obr->ob)
mul_mat3_m4_v3(shi->obr->ob->obmat, nor);
mul_mat3_m4_v3(re->viewmat, nor);
}
@@ -2550,7 +2556,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
else {
float nor[3], dot;
- if(shi->mat->mode & MA_TANGENT_V) {
+ if (shi->mat->mode & MA_TANGENT_V) {
shi->tang[0]+= Tnor*norfac*texres.nor[0];
shi->tang[1]+= Tnor*norfac*texres.nor[1];
shi->tang[2]+= Tnor*norfac*texres.nor[2];
@@ -2577,10 +2583,10 @@ void do_material_tex(ShadeInput *shi, Render *re)
}
}
- if( mtex->mapto & MAP_DISPLACE ) {
+ if ( mtex->mapto & MAP_DISPLACE ) {
/* Now that most textures offer both Nor and Intensity, allow */
/* both to work, and let user select with slider. */
- if(texres.nor) {
+ if (texres.nor) {
float norfac= mtex->norfac;
shi->displace[0]+= 0.2f*Tnor*norfac*texres.nor[0];
@@ -2588,94 +2594,94 @@ void do_material_tex(ShadeInput *shi, Render *re)
shi->displace[2]+= 0.2f*Tnor*norfac*texres.nor[2];
}
- if(rgbnor & TEX_RGB) {
+ if (rgbnor & TEX_RGB) {
texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
}
factt= (0.5f-texres.tin)*mtex->dispfac*stencilTin; facmm= 1.0f-factt;
- if(mtex->blendtype==MTEX_BLEND) {
+ if (mtex->blendtype==MTEX_BLEND) {
shi->displace[0]= factt*shi->vn[0] + facmm*shi->displace[0];
shi->displace[1]= factt*shi->vn[1] + facmm*shi->displace[1];
shi->displace[2]= factt*shi->vn[2] + facmm*shi->displace[2];
}
- else if(mtex->blendtype==MTEX_MUL) {
+ else if (mtex->blendtype==MTEX_MUL) {
shi->displace[0]*= factt*shi->vn[0];
shi->displace[1]*= factt*shi->vn[1];
shi->displace[2]*= factt*shi->vn[2];
}
else { /* add or sub */
- if(mtex->blendtype==MTEX_SUB) factt= -factt;
+ if (mtex->blendtype==MTEX_SUB) factt= -factt;
shi->displace[0]+= factt*shi->vn[0];
shi->displace[1]+= factt*shi->vn[1];
shi->displace[2]+= factt*shi->vn[2];
}
}
- if(mtex->mapto & MAP_VARS) {
+ if (mtex->mapto & MAP_VARS) {
/* stencil maps on the texture control slider, not texture intensity value */
- if(rgbnor & TEX_RGB) {
- if(texres.talpha) texres.tin= texres.ta;
+ if (rgbnor & TEX_RGB) {
+ if (texres.talpha) texres.tin= texres.ta;
else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
}
- if(mtex->mapto & MAP_REF) {
+ if (mtex->mapto & MAP_REF) {
float difffac= mtex->difffac*stencilTin;
shi->refl= texture_value_blend(mtex->def_var, shi->refl, texres.tin, difffac, mtex->blendtype);
- if(shi->refl<0.0f) shi->refl= 0.0f;
+ if (shi->refl<0.0f) shi->refl= 0.0f;
}
- if(mtex->mapto & MAP_SPEC) {
+ if (mtex->mapto & MAP_SPEC) {
float specfac= mtex->specfac*stencilTin;
shi->spec= texture_value_blend(mtex->def_var, shi->spec, texres.tin, specfac, mtex->blendtype);
- if(shi->spec<0.0f) shi->spec= 0.0f;
+ if (shi->spec<0.0f) shi->spec= 0.0f;
}
- if(mtex->mapto & MAP_EMIT) {
+ if (mtex->mapto & MAP_EMIT) {
float emitfac= mtex->emitfac*stencilTin;
shi->emit= texture_value_blend(mtex->def_var, shi->emit, texres.tin, emitfac, mtex->blendtype);
- if(shi->emit<0.0f) shi->emit= 0.0f;
+ if (shi->emit<0.0f) shi->emit= 0.0f;
}
- if(mtex->mapto & MAP_ALPHA) {
+ if (mtex->mapto & MAP_ALPHA) {
float alphafac= mtex->alphafac*stencilTin;
shi->alpha= texture_value_blend(mtex->def_var, shi->alpha, texres.tin, alphafac, mtex->blendtype);
- if(shi->alpha<0.0f) shi->alpha= 0.0f;
- else if(shi->alpha>1.0f) shi->alpha= 1.0f;
+ if (shi->alpha<0.0f) shi->alpha= 0.0f;
+ else if (shi->alpha>1.0f) shi->alpha= 1.0f;
}
- if(mtex->mapto & MAP_HAR) {
+ if (mtex->mapto & MAP_HAR) {
float har; // have to map to 0-1
float hardfac= mtex->hardfac*stencilTin;
har= ((float)shi->har)/128.0f;
har= 128.0f*texture_value_blend(mtex->def_var, har, texres.tin, hardfac, mtex->blendtype);
- if(har<1.0f) shi->har= 1;
- else if(har>511) shi->har= 511;
+ if (har<1.0f) shi->har= 1;
+ else if (har>511) shi->har= 511;
else shi->har= (int)har;
}
- if(mtex->mapto & MAP_RAYMIRR) {
+ if (mtex->mapto & MAP_RAYMIRR) {
float raymirrfac= mtex->raymirrfac*stencilTin;
shi->ray_mirror= texture_value_blend(mtex->def_var, shi->ray_mirror, texres.tin, raymirrfac, mtex->blendtype);
- if(shi->ray_mirror<0.0f) shi->ray_mirror= 0.0f;
- else if(shi->ray_mirror>1.0f) shi->ray_mirror= 1.0f;
+ if (shi->ray_mirror<0.0f) shi->ray_mirror= 0.0f;
+ else if (shi->ray_mirror>1.0f) shi->ray_mirror= 1.0f;
}
- if(mtex->mapto & MAP_TRANSLU) {
+ if (mtex->mapto & MAP_TRANSLU) {
float translfac= mtex->translfac*stencilTin;
shi->translucency= texture_value_blend(mtex->def_var, shi->translucency, texres.tin, translfac, mtex->blendtype);
- if(shi->translucency<0.0f) shi->translucency= 0.0f;
- else if(shi->translucency>1.0f) shi->translucency= 1.0f;
+ if (shi->translucency<0.0f) shi->translucency= 0.0f;
+ else if (shi->translucency>1.0f) shi->translucency= 1.0f;
}
- if(mtex->mapto & MAP_AMB) {
+ if (mtex->mapto & MAP_AMB) {
float ambfac= mtex->ambfac*stencilTin;
shi->amb= texture_value_blend(mtex->def_var, shi->amb, texres.tin, ambfac, mtex->blendtype);
- if(shi->amb<0.0f) shi->amb= 0.0f;
- else if(shi->amb>1.0f) shi->amb= 1.0f;
+ if (shi->amb<0.0f) shi->amb= 0.0f;
+ else if (shi->amb>1.0f) shi->amb= 1.0f;
shi->ambr= shi->amb*re->wrld.ambr;
shi->ambg= shi->amb*re->wrld.ambg;
@@ -2705,35 +2711,35 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col
if (re->r.scemode & R_NO_TEX) return;
/* here: test flag if there's a tex (todo) */
- for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+ for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
/* separate tex switching */
- if(shi->mat->septex & (1<<tex_nr)) continue;
+ if (shi->mat->septex & (1<<tex_nr)) continue;
- if(shi->mat->mtex[tex_nr]) {
+ if (shi->mat->mtex[tex_nr]) {
mtex= shi->mat->mtex[tex_nr];
tex= mtex->tex;
- if(tex==0) continue;
+ if (tex==0) continue;
/* only process if this texture is mapped
* to one that we're interested in */
if (!(mtex->mapto & mapto_flag)) continue;
/* which coords */
- if(mtex->texco==TEXCO_OBJECT) {
+ if (mtex->texco==TEXCO_OBJECT) {
Object *ob= mtex->object;
- if(ob) {
+ if (ob) {
copy_v3_v3(co, xyz);
- if(mtex->texflag & MTEX_OB_DUPLI_ORIG) {
- if(shi->obi && shi->obi->duplitexmat)
+ if (mtex->texflag & MTEX_OB_DUPLI_ORIG) {
+ if (shi->obi && shi->obi->duplitexmat)
mul_m4_v3(shi->obi->duplitexmat, co);
}
mul_m4_v3(ob->imat_ren, co);
}
}
/* not really orco, but 'local' */
- else if(mtex->texco==TEXCO_ORCO) {
+ else if (mtex->texco==TEXCO_ORCO) {
- if(mtex->texflag & MTEX_DUPLI_MAPTO) {
+ if (mtex->texflag & MTEX_DUPLI_MAPTO) {
copy_v3_v3(co, shi->duplilo);
}
else {
@@ -2742,7 +2748,7 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col
mul_m4_v3(ob->imat_ren, co);
}
}
- else if(mtex->texco==TEXCO_GLOB) {
+ else if (mtex->texco==TEXCO_GLOB) {
copy_v3_v3(co, xyz);
mul_m4_v3(re->viewinv, co);
}
@@ -2750,19 +2756,19 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col
texres.nor= NULL;
- if(tex->type==TEX_IMAGE) {
+ if (tex->type==TEX_IMAGE) {
continue; /* not supported yet */
//do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
}
else {
/* placement */
- if(mtex->projx) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
+ if (mtex->projx) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
- if(mtex->projy) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
+ if (mtex->projy) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
else texvec[1]= mtex->size[1]*(mtex->ofs[1]);
- if(mtex->projz) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
+ if (mtex->projz) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
}
@@ -2770,20 +2776,20 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col
/* texture output */
- if( (rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
+ if ( (rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
rgbnor-= TEX_RGB;
}
- if(mtex->texflag & MTEX_NEGATIVE) {
- if(rgbnor & TEX_RGB) {
+ if (mtex->texflag & MTEX_NEGATIVE) {
+ if (rgbnor & TEX_RGB) {
texres.tr= 1.0f-texres.tr;
texres.tg= 1.0f-texres.tg;
texres.tb= 1.0f-texres.tb;
}
texres.tin= 1.0f-texres.tin;
}
- if(mtex->texflag & MTEX_STENCIL) {
- if(rgbnor & TEX_RGB) {
+ if (mtex->texflag & MTEX_STENCIL) {
+ if (rgbnor & TEX_RGB) {
fact= texres.ta;
texres.ta*= stencilTin;
stencilTin*= fact;
@@ -2796,70 +2802,71 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col
}
- if((mapto_flag & (MAP_EMISSION_COL+MAP_TRANSMISSION_COL+MAP_REFLECTION_COL)) && (mtex->mapto & (MAP_EMISSION_COL+MAP_TRANSMISSION_COL+MAP_REFLECTION_COL))) {
+ if ((mapto_flag & (MAP_EMISSION_COL+MAP_TRANSMISSION_COL+MAP_REFLECTION_COL)) && (mtex->mapto & (MAP_EMISSION_COL+MAP_TRANSMISSION_COL+MAP_REFLECTION_COL))) {
float tcol[3];
/* stencil maps on the texture control slider, not texture intensity value */
- if((rgbnor & TEX_RGB)==0) {
+ if ((rgbnor & TEX_RGB)==0) {
tcol[0]= mtex->r;
tcol[1]= mtex->g;
tcol[2]= mtex->b;
- } else {
+ }
+ else {
tcol[0]=texres.tr;
tcol[1]=texres.tg;
tcol[2]=texres.tb;
- if(texres.talpha)
+ if (texres.talpha)
texres.tin= texres.ta;
}
/* used for emit */
- if((mapto_flag & MAP_EMISSION_COL) && (mtex->mapto & MAP_EMISSION_COL)) {
+ if ((mapto_flag & MAP_EMISSION_COL) && (mtex->mapto & MAP_EMISSION_COL)) {
float colemitfac= mtex->colemitfac*stencilTin;
texture_rgb_blend(col, tcol, col, texres.tin, colemitfac, mtex->blendtype);
}
- if((mapto_flag & MAP_REFLECTION_COL) && (mtex->mapto & MAP_REFLECTION_COL)) {
+ if ((mapto_flag & MAP_REFLECTION_COL) && (mtex->mapto & MAP_REFLECTION_COL)) {
float colreflfac= mtex->colreflfac*stencilTin;
texture_rgb_blend(col, tcol, col, texres.tin, colreflfac, mtex->blendtype);
}
- if((mapto_flag & MAP_TRANSMISSION_COL) && (mtex->mapto & MAP_TRANSMISSION_COL)) {
+ if ((mapto_flag & MAP_TRANSMISSION_COL) && (mtex->mapto & MAP_TRANSMISSION_COL)) {
float coltransfac= mtex->coltransfac*stencilTin;
texture_rgb_blend(col, tcol, col, texres.tin, coltransfac, mtex->blendtype);
}
}
- if((mapto_flag & MAP_VARS) && (mtex->mapto & MAP_VARS)) {
+ if ((mapto_flag & MAP_VARS) && (mtex->mapto & MAP_VARS)) {
/* stencil maps on the texture control slider, not texture intensity value */
/* convert RGB to intensity if intensity info isn't provided */
if (!(rgbnor & TEX_INT)) {
if (rgbnor & TEX_RGB) {
- if(texres.talpha) texres.tin= texres.ta;
+ if (texres.talpha) texres.tin= texres.ta;
else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
}
}
- if((mapto_flag & MAP_EMISSION) && (mtex->mapto & MAP_EMISSION)) {
+ if ((mapto_flag & MAP_EMISSION) && (mtex->mapto & MAP_EMISSION)) {
float emitfac= mtex->emitfac*stencilTin;
*val = texture_value_blend(mtex->def_var, *val, texres.tin, emitfac, mtex->blendtype);
- if(*val<0.0f) *val= 0.0f;
+ if (*val<0.0f) *val= 0.0f;
}
- if((mapto_flag & MAP_DENSITY) && (mtex->mapto & MAP_DENSITY)) {
+ if ((mapto_flag & MAP_DENSITY) && (mtex->mapto & MAP_DENSITY)) {
float densfac= mtex->densfac*stencilTin;
*val = texture_value_blend(mtex->def_var, *val, texres.tin, densfac, mtex->blendtype);
CLAMP(*val, 0.0f, 1.0f);
}
- if((mapto_flag & MAP_SCATTERING) && (mtex->mapto & MAP_SCATTERING)) {
+ if ((mapto_flag & MAP_SCATTERING) && (mtex->mapto & MAP_SCATTERING)) {
float scatterfac= mtex->scatterfac*stencilTin;
*val = texture_value_blend(mtex->def_var, *val, texres.tin, scatterfac, mtex->blendtype);
CLAMP(*val, 0.0f, 1.0f);
}
- if((mapto_flag & MAP_REFLECTION) && (mtex->mapto & MAP_REFLECTION)) {
+ if ((mapto_flag & MAP_REFLECTION) && (mtex->mapto & MAP_REFLECTION)) {
float reflfac= mtex->reflfac*stencilTin;
*val = texture_value_blend(mtex->def_var, *val, texres.tin, reflfac, mtex->blendtype);
@@ -2883,8 +2890,8 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
if (R.r.scemode & R_NO_TEX) return;
mtex= har->mat->mtex[0];
- if(har->mat->septex & (1<<0)) return;
- if(mtex->tex==NULL) return;
+ if (har->mat->septex & (1<<0)) return;
+ if (mtex->tex==NULL) return;
/* no normal mapping */
texres.nor= NULL;
@@ -2896,32 +2903,32 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
osatex= (har->mat->texco & TEXCO_OSA);
/* placement */
- if(mtex->projx) texvec[0]= mtex->size[0]*(texvec[mtex->projx-1]+mtex->ofs[0]);
+ if (mtex->projx) texvec[0]= mtex->size[0]*(texvec[mtex->projx-1]+mtex->ofs[0]);
else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
- if(mtex->projy) texvec[1]= mtex->size[1]*(texvec[mtex->projy-1]+mtex->ofs[1]);
+ if (mtex->projy) texvec[1]= mtex->size[1]*(texvec[mtex->projy-1]+mtex->ofs[1]);
else texvec[1]= mtex->size[1]*(mtex->ofs[1]);
- if(mtex->projz) texvec[2]= mtex->size[2]*(texvec[mtex->projz-1]+mtex->ofs[2]);
+ if (mtex->projz) texvec[2]= mtex->size[2]*(texvec[mtex->projz-1]+mtex->ofs[2]);
else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
- if(osatex) {
+ if (osatex) {
dx= 1.0f/har->rad;
- if(mtex->projx) {
+ if (mtex->projx) {
dxt[0]= mtex->size[0]*dx;
dyt[0]= mtex->size[0]*dx;
}
else dxt[0]= dyt[0]= 0.0;
- if(mtex->projy) {
+ if (mtex->projy) {
dxt[1]= mtex->size[1]*dx;
dyt[1]= mtex->size[1]*dx;
}
else dxt[1]= dyt[1]= 0.0;
- if(mtex->projz) {
+ if (mtex->projz) {
dxt[2]= 0.0;
dyt[2]= 0.0;
}
@@ -2929,17 +2936,17 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
}
- if(mtex->tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
+ if (mtex->tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
rgb= multitex(mtex->tex, texvec, dxt, dyt, osatex, &texres, 0, mtex->which_output);
/* texture output */
- if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
+ if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
rgb= 0;
}
- if(mtex->texflag & MTEX_NEGATIVE) {
- if(rgb) {
+ if (mtex->texflag & MTEX_NEGATIVE) {
+ if (rgb) {
texres.tr= 1.0f-texres.tr;
texres.tg= 1.0f-texres.tg;
texres.tb= 1.0f-texres.tb;
@@ -2948,14 +2955,14 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
}
/* mapping */
- if(mtex->mapto & MAP_COL) {
+ if (mtex->mapto & MAP_COL) {
- if(rgb==0) {
+ if (rgb==0) {
texres.tr= mtex->r;
texres.tg= mtex->g;
texres.tb= mtex->b;
}
- else if(mtex->mapto & MAP_ALPHA) {
+ else if (mtex->mapto & MAP_ALPHA) {
texres.tin= 1.0;
}
else texres.tin= texres.ta;
@@ -2973,18 +2980,18 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
fact= texres.tin*mtex->colfac;
facm= 1.0f-fact;
- if(mtex->blendtype==MTEX_MUL) {
+ if (mtex->blendtype==MTEX_MUL) {
facm= 1.0f-mtex->colfac;
}
- if(mtex->blendtype==MTEX_SUB) fact= -fact;
+ if (mtex->blendtype==MTEX_SUB) fact= -fact;
- if(mtex->blendtype==MTEX_BLEND) {
+ if (mtex->blendtype==MTEX_BLEND) {
col_r[0]= (fact*texres.tr + facm*har->r);
col_r[1]= (fact*texres.tg + facm*har->g);
col_r[2]= (fact*texres.tb + facm*har->b);
}
- else if(mtex->blendtype==MTEX_MUL) {
+ else if (mtex->blendtype==MTEX_MUL) {
col_r[0]= (facm+fact*texres.tr)*har->r;
col_r[1]= (facm+fact*texres.tg)*har->g;
col_r[2]= (facm+fact*texres.tb)*har->b;
@@ -2999,9 +3006,9 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
CLAMP(col_r[2], 0.0f, 1.0f);
}
}
- if(mtex->mapto & MAP_ALPHA) {
- if(rgb) {
- if(texres.talpha) texres.tin= texres.ta;
+ if (mtex->mapto & MAP_ALPHA) {
+ if (rgb) {
+ if (texres.talpha) texres.tin= texres.ta;
else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
}
@@ -3025,19 +3032,19 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
/* todo: add flag to test if there's a tex */
texres.nor= NULL;
- for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
- if(R.wrld.mtex[tex_nr]) {
+ for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+ if (R.wrld.mtex[tex_nr]) {
mtex= R.wrld.mtex[tex_nr];
tex= mtex->tex;
- if(tex==0) continue;
- /* if(mtex->mapto==0) continue; */
+ if (tex==0) continue;
+ /* if (mtex->mapto==0) continue; */
/* which coords */
co= lo;
/* dxt dyt just from 1 value */
- if(dxyview) {
+ if (dxyview) {
dxt[0]= dxt[1]= dxt[2]= dxyview[0];
dyt[0]= dyt[1]= dyt[2]= dxyview[1];
}
@@ -3051,7 +3058,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
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 */
- if(lo[0] || lo[1]) { /* check for zero case [#24807] */
+ if (lo[0] || lo[1]) { /* check for zero case [#24807] */
fact= (1.0f/(float)M_PI)*saacos(lo[2])/(sqrtf(lo[0]*lo[0] + lo[1]*lo[1]));
tempvec[0]= lo[0]*fact;
tempvec[1]= lo[1]*fact;
@@ -3069,8 +3076,8 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
case TEXCO_H_SPHEREMAP:
case TEXCO_H_TUBEMAP:
- if(skyflag & WO_ZENUP) {
- if(mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1,lo[0], lo[2], lo[1]);
+ if (skyflag & WO_ZENUP) {
+ if (mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1,lo[0], lo[2], lo[1]);
else map_to_sphere( tempvec, tempvec+1,lo[0], lo[2], lo[1]);
/* tube/spheremap maps for outside view, not inside */
tempvec[0]= 1.0f-tempvec[0];
@@ -3094,7 +3101,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
co= tempvec;
break;
case TEXCO_OBJECT:
- if(mtex->object) {
+ if (mtex->object) {
copy_v3_v3(tempvec, lo);
mul_m4_v3(mtex->object->imat_ren, tempvec);
co= tempvec;
@@ -3102,7 +3109,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
break;
case TEXCO_GLOB:
- if(rco) {
+ if (rco) {
copy_v3_v3(tempvec, rco);
mul_m4_v3(R.viewinv, tempvec);
co= tempvec;
@@ -3118,35 +3125,35 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
}
/* placement */
- if(mtex->projx) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
+ if (mtex->projx) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
- if(mtex->projy) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
+ if (mtex->projy) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
else texvec[1]= mtex->size[1]*(mtex->ofs[1]);
- if(mtex->projz) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
+ if (mtex->projz) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
/* texture */
- if(tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
+ if (tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
rgb= multitex(mtex->tex, texvec, dxt, dyt, R.osa, &texres, thread, mtex->which_output);
/* texture output */
- if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
+ if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
rgb= 0;
}
- if(mtex->texflag & MTEX_NEGATIVE) {
- if(rgb) {
+ if (mtex->texflag & MTEX_NEGATIVE) {
+ if (rgb) {
texres.tr= 1.0f-texres.tr;
texres.tg= 1.0f-texres.tg;
texres.tb= 1.0f-texres.tb;
}
else texres.tin= 1.0f-texres.tin;
}
- if(mtex->texflag & MTEX_STENCIL) {
- if(rgb) {
+ if (mtex->texflag & MTEX_STENCIL) {
+ if (rgb) {
fact= texres.ta;
texres.ta*= stencilTin;
stencilTin*= fact;
@@ -3158,15 +3165,15 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
}
}
else {
- if(rgb) texres.ta *= stencilTin;
+ if (rgb) texres.ta *= stencilTin;
else texres.tin*= stencilTin;
}
/* color mapping */
- if(mtex->mapto & (WOMAP_HORIZ+WOMAP_ZENUP+WOMAP_ZENDOWN)) {
+ if (mtex->mapto & (WOMAP_HORIZ+WOMAP_ZENUP+WOMAP_ZENDOWN)) {
float tcol[3];
- if(rgb==0) {
+ if (rgb==0) {
texres.tr= mtex->r;
texres.tg= mtex->g;
texres.tb= mtex->b;
@@ -3185,29 +3192,29 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
srgb_to_linearrgb_v3_v3(tcol, tcol);
}
- if(mtex->mapto & WOMAP_HORIZ) {
+ if (mtex->mapto & WOMAP_HORIZ) {
texture_rgb_blend(hor, tcol, hor, texres.tin, mtex->colfac, mtex->blendtype);
}
- if(mtex->mapto & (WOMAP_ZENUP+WOMAP_ZENDOWN)) {
+ if (mtex->mapto & (WOMAP_ZENUP+WOMAP_ZENDOWN)) {
float zenfac = 0.0f;
- if(R.wrld.skytype & WO_SKYREAL) {
- if((skyflag & WO_ZENUP)) {
- if(mtex->mapto & WOMAP_ZENUP) zenfac= mtex->zenupfac;
+ if (R.wrld.skytype & WO_SKYREAL) {
+ if ((skyflag & WO_ZENUP)) {
+ if (mtex->mapto & WOMAP_ZENUP) zenfac= mtex->zenupfac;
}
- else if(mtex->mapto & WOMAP_ZENDOWN) zenfac= mtex->zendownfac;
+ else if (mtex->mapto & WOMAP_ZENDOWN) zenfac= mtex->zendownfac;
}
else {
- if(mtex->mapto & WOMAP_ZENUP) zenfac= mtex->zenupfac;
- else if(mtex->mapto & WOMAP_ZENDOWN) zenfac= mtex->zendownfac;
+ if (mtex->mapto & WOMAP_ZENUP) zenfac= mtex->zenupfac;
+ else if (mtex->mapto & WOMAP_ZENDOWN) zenfac= mtex->zendownfac;
}
- if(zenfac != 0.0f)
+ if (zenfac != 0.0f)
texture_rgb_blend(zen, tcol, zen, texres.tin, zenfac, mtex->blendtype);
}
}
- if(mtex->mapto & WOMAP_BLEND) {
- if(rgb) texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
+ if (mtex->mapto & WOMAP_BLEND) {
+ if (rgb) texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
*blend= texture_value_blend(mtex->def_var, *blend, texres.tin, mtex->blendfac, mtex->blendtype);
}
@@ -3231,25 +3238,25 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
if (R.r.scemode & R_NO_TEX) return;
tex_nr= 0;
- for(; tex_nr<MAX_MTEX; tex_nr++) {
+ for (; tex_nr<MAX_MTEX; tex_nr++) {
- if(la->mtex[tex_nr]) {
+ if (la->mtex[tex_nr]) {
mtex= la->mtex[tex_nr];
tex= mtex->tex;
- if(tex==NULL) continue;
+ if (tex==NULL) continue;
texres.nor= NULL;
/* which coords */
- if(mtex->texco==TEXCO_OBJECT) {
+ if (mtex->texco==TEXCO_OBJECT) {
ob= mtex->object;
- if(ob) {
+ if (ob) {
co= tempvec;
dx= dxt;
dy= dyt;
copy_v3_v3(tempvec, shi->co);
mul_m4_v3(ob->imat_ren, tempvec);
- if(shi->osatex) {
+ if (shi->osatex) {
copy_v3_v3(dxt, shi->dxco);
copy_v3_v3(dyt, shi->dyco);
mul_mat3_m4_v3(ob->imat_ren, dxt);
@@ -3261,17 +3268,17 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
dx= shi->dxco; dy= shi->dyco;
}
}
- else if(mtex->texco==TEXCO_GLOB) {
+ else if (mtex->texco==TEXCO_GLOB) {
co= shi->gl; dx= shi->dxco; dy= shi->dyco;
copy_v3_v3(shi->gl, shi->co);
mul_m4_v3(R.viewinv, shi->gl);
}
- else if(mtex->texco==TEXCO_VIEW) {
+ else if (mtex->texco==TEXCO_VIEW) {
copy_v3_v3(tempvec, lavec);
mul_m3_v3(la->imat, tempvec);
- if(la->type==LA_SPOT) {
+ if (la->type==LA_SPOT) {
tempvec[0]*= la->spottexfac;
tempvec[1]*= la->spottexfac;
/* project from 3d to 2d */
@@ -3281,7 +3288,7 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
co= tempvec;
dx= dxt; dy= dyt;
- if(shi->osatex) {
+ if (shi->osatex) {
copy_v3_v3(dxt, shi->dxlv);
copy_v3_v3(dyt, shi->dylv);
/* need some matrix conversion here? la->imat is a [3][3] matrix!!! **/
@@ -3295,39 +3302,43 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
/* placement */
- if(mtex->projx && co) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
+ if (mtex->projx && co) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
- if(mtex->projy && co) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
+ if (mtex->projy && co) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
else texvec[1]= mtex->size[1]*(mtex->ofs[1]);
- if(mtex->projz && co) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
+ if (mtex->projz && co) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
- if(shi->osatex) {
+ if (shi->osatex) {
if (!dx) {
- for(i=0;i<2;i++) {
+ for (i=0;i<2;i++) {
dxt[i] = dyt[i] = 0.0;
}
- } else {
- if(mtex->projx) {
+ }
+ else {
+ if (mtex->projx) {
dxt[0]= mtex->size[0]*dx[mtex->projx-1];
dyt[0]= mtex->size[0]*dy[mtex->projx-1];
- } else {
+ }
+ else {
dxt[0]= 0.0;
dyt[0]= 0.0;
}
- if(mtex->projy) {
+ if (mtex->projy) {
dxt[1]= mtex->size[1]*dx[mtex->projy-1];
dyt[1]= mtex->size[1]*dy[mtex->projy-1];
- } else {
+ }
+ else {
dxt[1]= 0.0;
dyt[1]= 0.0;
}
- if(mtex->projz) {
+ if (mtex->projz) {
dxt[2]= mtex->size[2]*dx[mtex->projz-1];
dyt[2]= mtex->size[2]*dy[mtex->projz-1];
- } else {
+ }
+ else {
dxt[2]= 0.0;
dyt[2]= 0.0;
}
@@ -3335,27 +3346,27 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
}
/* texture */
- if(tex->type==TEX_IMAGE) {
+ if (tex->type==TEX_IMAGE) {
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
}
rgb= multitex(tex, texvec, dxt, dyt, shi->osatex, &texres, shi->thread, mtex->which_output);
/* texture output */
- if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
+ if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
rgb= 0;
}
- if(mtex->texflag & MTEX_NEGATIVE) {
- if(rgb) {
+ if (mtex->texflag & MTEX_NEGATIVE) {
+ if (rgb) {
texres.tr= 1.0f-texres.tr;
texres.tg= 1.0f-texres.tg;
texres.tb= 1.0f-texres.tb;
}
else texres.tin= 1.0f-texres.tin;
}
- if(mtex->texflag & MTEX_STENCIL) {
- if(rgb) {
+ if (mtex->texflag & MTEX_STENCIL) {
+ if (rgb) {
fact= texres.ta;
texres.ta*= stencilTin;
stencilTin*= fact;
@@ -3367,20 +3378,20 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
}
}
else {
- if(rgb) texres.ta*= stencilTin;
+ if (rgb) texres.ta*= stencilTin;
else texres.tin*= stencilTin;
}
/* mapping */
- if(((mtex->mapto & LAMAP_COL) && (effect & LA_TEXTURE))||((mtex->mapto & LAMAP_SHAD) && (effect & LA_SHAD_TEX))) {
+ if (((mtex->mapto & LAMAP_COL) && (effect & LA_TEXTURE))||((mtex->mapto & LAMAP_SHAD) && (effect & LA_SHAD_TEX))) {
float col[3];
- if(rgb==0) {
+ if (rgb==0) {
texres.tr= mtex->r;
texres.tg= mtex->g;
texres.tb= mtex->b;
}
- else if(mtex->mapto & MAP_ALPHA) {
+ else if (mtex->mapto & MAP_ALPHA) {
texres.tin= stencilTin;
}
else texres.tin= texres.ta;
@@ -3416,27 +3427,27 @@ int externtex(MTex *mtex, const float vec[3], float *tin, float *tr, float *tg,
int rgb;
tex= mtex->tex;
- if(tex==NULL) return 0;
+ if (tex==NULL) return 0;
texr.nor= NULL;
/* placement */
- if(mtex->projx) texvec[0]= mtex->size[0]*(vec[mtex->projx-1]+mtex->ofs[0]);
+ if (mtex->projx) texvec[0]= mtex->size[0]*(vec[mtex->projx-1]+mtex->ofs[0]);
else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
- if(mtex->projy) texvec[1]= mtex->size[1]*(vec[mtex->projy-1]+mtex->ofs[1]);
+ if (mtex->projy) texvec[1]= mtex->size[1]*(vec[mtex->projy-1]+mtex->ofs[1]);
else texvec[1]= mtex->size[1]*(mtex->ofs[1]);
- if(mtex->projz) texvec[2]= mtex->size[2]*(vec[mtex->projz-1]+mtex->ofs[2]);
+ if (mtex->projz) texvec[2]= mtex->size[2]*(vec[mtex->projz-1]+mtex->ofs[2]);
else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
/* texture */
- if(tex->type==TEX_IMAGE) {
+ if (tex->type==TEX_IMAGE) {
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
}
rgb= multitex(tex, texvec, dxt, dyt, 0, &texr, thread, mtex->which_output);
- if(rgb) {
+ if (rgb) {
texr.tin= (0.35f*texr.tr+0.45f*texr.tg+0.2f*texr.tb);
}
else {
@@ -3467,12 +3478,12 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
ShadeInputUV *suv= &shi->uv[shi->actuv];
int a;
- if(R.r.scemode & R_NO_TEX) return;
+ if (R.r.scemode & R_NO_TEX) return;
- if(firsttime) {
+ if (firsttime) {
BLI_lock_thread(LOCK_IMAGE);
- if(firsttime) {
- for(a=0; a<BLENDER_MAX_THREADS; a++) {
+ if (firsttime) {
+ for (a=0; a<BLENDER_MAX_THREADS; a++) {
memset(&imatex[a], 0, sizeof(Tex));
default_tex(&imatex[a]);
imatex[a].type= TEX_IMAGE;
@@ -3489,7 +3500,7 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
texvec[0]= 0.5f+0.5f*suv->uv[0];
texvec[1]= 0.5f+0.5f*suv->uv[1];
texvec[2] = 0.0f; // initalize it because imagewrap looks at it.
- if(shi->osatex) {
+ if (shi->osatex) {
dx[0]= 0.5f*suv->dxuv[0];
dx[1]= 0.5f*suv->dxuv[1];
dy[0]= 0.5f*suv->dyuv[0];
@@ -3498,7 +3509,7 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
texr.nor= NULL;
- if(shi->osatex) imagewraposa(tex, ima, NULL, texvec, dx, dy, &texr);
+ if (shi->osatex) imagewraposa(tex, ima, NULL, texvec, dx, dy, &texr);
else imagewrap(tex, ima, NULL, texvec, &texr);
shi->vcol[0]*= texr.tr;
@@ -3550,13 +3561,13 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene)
BKE_animsys_evaluate_animdata(scene, &mat->id, mat->adt, BKE_curframe(scene), ADT_RECALC_ANIM);
/* strip material copy from unsupported flags */
- for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
- if(mat->septex & (1<<tex_nr)) continue;
+ for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+ if (mat->septex & (1<<tex_nr)) continue;
- if(mat->mtex[tex_nr]) {
+ if (mat->mtex[tex_nr]) {
MTex *mtex = mat->mtex[tex_nr];
- if(!mtex->tex) continue;
+ if (!mtex->tex) continue;
/* only keep compatible texflags */
mtex->texflag = mtex->texflag & (MTEX_RGBTOINT | MTEX_STENCIL | MTEX_NEGATIVE | MTEX_ALPHAMIX);
@@ -3582,9 +3593,9 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene)
}
/* if mapped to an object, calculate inverse matrices */
- if(mtex->texco==TEXCO_OBJECT) {
+ if (mtex->texco==TEXCO_OBJECT) {
Object *ob= mtex->object;
- if(ob) {
+ if (ob) {
invert_m4_m4(ob->imat, ob->obmat);
copy_m4_m4(ob->imat_ren, ob->imat);
}
@@ -3597,10 +3608,10 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene)
BKE_animsys_evaluate_animdata(scene, &tex->id, tex->adt, BKE_curframe(scene), ADT_RECALC_ANIM);
/* update texture cache if required */
- if(tex->type==TEX_VOXELDATA) {
+ if (tex->type==TEX_VOXELDATA) {
cache_voxeldata(tex, (int)scene->r.cfra);
}
- if(tex->type==TEX_POINTDENSITY) {
+ if (tex->type==TEX_POINTDENSITY) {
/* set dummy values for render and do cache */
Render dummy_re = {0};
dummy_re.scene = scene;
@@ -3612,8 +3623,8 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene)
}
/* update image sequences and movies */
- if(tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
- if(tex->iuser.flag & IMA_ANIM_ALWAYS)
+ if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ if (tex->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_calc_frame(&tex->iuser, (int)scene->r.cfra, 0);
}
}
@@ -3627,12 +3638,12 @@ void RE_free_sample_material(Material *mat)
int tex_nr;
/* free textures */
- for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
- if(mat->septex & (1<<tex_nr)) continue;
- if(mat->mtex[tex_nr]) {
+ for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+ if (mat->septex & (1<<tex_nr)) continue;
+ if (mat->mtex[tex_nr]) {
MTex *mtex= mat->mtex[tex_nr];
- if(mtex->tex) {
+ if (mtex->tex) {
free_texture(mtex->tex);
MEM_freeN(mtex->tex);
mtex->tex = NULL;
@@ -3703,7 +3714,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
/* for every uv map set coords and name */
for (i=0; i<layers; i++) {
- if(layer_index >= 0) {
+ if (layer_index >= 0) {
float *uv1, *uv2, *uv3;
float l;
CustomData *data = &orcoDm->faceData;
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 28988af64c4..f5e36125299 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -97,12 +97,12 @@ void calc_view_vector(float *view, float x, float y)
view[2]= -ABS(R.clipsta);
- if(R.r.mode & R_ORTHO) {
+ if (R.r.mode & R_ORTHO) {
view[0]= view[1]= 0.0f;
}
else {
- if(R.r.mode & R_PANORAMA) {
+ if (R.r.mode & R_PANORAMA) {
x-= R.panodxp;
}
@@ -113,13 +113,13 @@ void calc_view_vector(float *view, float x, float y)
y= (y/(float)R.winy);
view[1]= R.viewplane.ymin + y*(R.viewplane.ymax - R.viewplane.ymin);
-// if(R.flag & R_SEC_FIELD) {
-// if(R.r.mode & R_ODDFIELD) view[1]= (y+R.ystart)*R.ycor;
+// if (R.flag & R_SEC_FIELD) {
+// if (R.r.mode & R_ODDFIELD) view[1]= (y+R.ystart)*R.ycor;
// else view[1]= (y+R.ystart+1.0)*R.ycor;
// }
// else view[1]= (y+R.ystart+R.bluroffsy+0.5)*R.ycor;
- if(R.r.mode & R_PANORAMA) {
+ if (R.r.mode & R_PANORAMA) {
float u= view[0] + R.panodxv; float v= view[2];
view[0]= R.panoco*u + R.panosi*v;
view[2]= -R.panosi*u + R.panoco*v;
@@ -157,7 +157,7 @@ void calc_renderco_zbuf(float co[3], const float view[3], int z)
/* also used in zbuf.c and shadbuf.c */
int count_mask(unsigned short mask)
{
- if(R.samples)
+ if (R.samples)
return (R.samples->cmask[mask & 255]+R.samples->cmask[mask>>8]);
return 0;
}
@@ -165,8 +165,8 @@ int count_mask(unsigned short mask)
static int calchalo_z(HaloRen *har, int zz)
{
- if(har->type & HA_ONLYSKY) {
- if(zz < 0x7FFFFFF0) zz= - 0x7FFFFF; /* edge render messes zvalues */
+ if (har->type & HA_ONLYSKY) {
+ if (zz < 0x7FFFFFF0) zz= - 0x7FFFFF; /* edge render messes zvalues */
}
else {
zz= (zz>>8);
@@ -186,18 +186,18 @@ static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, in
accol[0]=accol[1]=accol[2]=accol[3]= 0.0f;
flarec= har->flarec;
- while(ps) {
+ while (ps) {
amountm= count_mask(ps->mask);
amount+= amountm;
zz= calchalo_z(har, ps->z);
- if((zz> har->zs) || (har->mat && (har->mat->mode & MA_HALO_SOFT))) {
- if(shadeHaloFloat(har, col, zz, dist, xn, yn, flarec)) {
+ if ((zz> har->zs) || (har->mat && (har->mat->mode & MA_HALO_SOFT))) {
+ if (shadeHaloFloat(har, col, zz, dist, xn, yn, flarec)) {
flarec= 0;
- if(fullsample) {
- for(sample=0; sample<totsample; sample++)
- if(ps->mask & (1 << sample))
+ if (fullsample) {
+ for (sample=0; sample<totsample; sample++)
+ if (ps->mask & (1 << sample))
addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
}
else {
@@ -216,9 +216,9 @@ static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, in
/* now do the sky sub-pixels */
amount= R.osa-amount;
- if(amount) {
- if(shadeHaloFloat(har, col, 0x7FFFFF, dist, xn, yn, flarec)) {
- if(!fullsample) {
+ if (amount) {
+ if (shadeHaloFloat(har, col, 0x7FFFFF, dist, xn, yn, flarec)) {
+ if (!fullsample) {
fac= ((float)amount)/(float)R.osa;
accol[0]+= fac*col[0];
accol[1]+= fac*col[1];
@@ -228,9 +228,9 @@ static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, in
}
}
- if(fullsample) {
- for(sample=0; sample<totsample; sample++)
- if(!(mask & (1 << sample)))
+ if (fullsample) {
+ for (sample=0; sample<totsample; sample++)
+ if (!(mask & (1 << sample)))
addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
}
else {
@@ -239,7 +239,7 @@ static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, in
col[2]= accol[2];
col[3]= accol[3];
- for(sample=0; sample<totsample; sample++)
+ for (sample=0; sample<totsample; sample++)
addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
}
}
@@ -257,7 +257,7 @@ static void halo_tile(RenderPart *pa, RenderLayer *rl)
unsigned int lay= rl->lay;
/* we don't render halos in the cropped area, gives errors in flare counter */
- if(pa->crop) {
+ if (pa->crop) {
testrect.xmin+= pa->crop;
testrect.xmax-= pa->crop;
testrect.ymin+= pa->crop;
@@ -266,20 +266,20 @@ static void halo_tile(RenderPart *pa, RenderLayer *rl)
totsample= get_sample_layers(pa, rl, rlpp);
- for(a=0; a<R.tothalo; a++) {
+ for (a=0; a<R.tothalo; a++) {
har= R.sortedhalos[a];
/* layer test, clip halo with y */
- if((har->lay & lay)==0);
- else if(testrect.ymin > har->maxy);
- else if(testrect.ymax < har->miny);
+ if ((har->lay & lay)==0);
+ else if (testrect.ymin > har->maxy);
+ else if (testrect.ymax < har->miny);
else {
minx= floor(har->xs-har->rad);
maxx= ceil(har->xs+har->rad);
- if(testrect.xmin > maxx);
- else if(testrect.xmax < minx);
+ if (testrect.xmin > maxx);
+ else if (testrect.xmax < minx);
else {
minx= MAX2(minx, testrect.xmin);
@@ -288,41 +288,41 @@ static void halo_tile(RenderPart *pa, RenderLayer *rl)
miny= MAX2(har->miny, testrect.ymin);
maxy= MIN2(har->maxy, testrect.ymax);
- for(y=miny; y<maxy; y++) {
+ for (y=miny; y<maxy; y++) {
int rectofs= (y-disprect.ymin)*pa->rectx + (minx - disprect.xmin);
rz= pa->rectz + rectofs;
od= rectofs;
- if(pa->rectdaps)
+ if (pa->rectdaps)
rd= pa->rectdaps + rectofs;
yn= (y-har->ys)*R.ycor;
ysq= yn*yn;
- for(x=minx; x<maxx; x++, rz++, od++) {
+ for (x=minx; x<maxx; x++, rz++, od++) {
xn= x- har->xs;
xsq= xn*xn;
dist= xsq+ysq;
- if(dist<har->radsq) {
- if(rd && *rd) {
+ if (dist<har->radsq) {
+ if (rd && *rd) {
halo_pixelstruct(har, rlpp, totsample, od, dist, xn, yn, (PixStr *)*rd);
}
else {
zz= calchalo_z(har, *rz);
- if((zz> har->zs) || (har->mat && (har->mat->mode & MA_HALO_SOFT))) {
- if(shadeHaloFloat(har, col, zz, dist, xn, yn, har->flarec)) {
- for(sample=0; sample<totsample; sample++)
+ if ((zz> har->zs) || (har->mat && (har->mat->mode & MA_HALO_SOFT))) {
+ if (shadeHaloFloat(har, col, zz, dist, xn, yn, har->flarec)) {
+ for (sample=0; sample<totsample; sample++)
addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
}
}
}
}
- if(rd) rd++;
+ if (rd) rd++;
}
}
}
}
- if(R.test_break(R.tbh) ) break;
+ if (R.test_break(R.tbh) ) break;
}
}
@@ -341,17 +341,17 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
shade_input_initialize(&shi, pa, rl, 0); /* this zero's ShadeInput for us */
- for(od=0, y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
- for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, rz++, od++) {
+ for (od=0, y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
+ for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, rz++, od++) {
calc_view_vector(shi.view, x, y);
- if(rd && *rd) {
+ if (rd && *rd) {
PixStr *ps= (PixStr *)*rd;
int count, totsamp= 0, mask= 0;
- while(ps) {
- if(R.r.mode & R_ORTHO)
+ while (ps) {
+ if (R.r.mode & R_ORTHO)
calc_renderco_ortho(shi.co, (float)x, (float)y, ps->z);
else
calc_renderco_zbuf(shi.co, shi.view, ps->z);
@@ -362,15 +362,15 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
col[0]= col[1]= col[2]= col[3]= 0.0f;
renderspothalo(&shi, col, 1.0f);
- if(fullsample) {
- for(sample=0; sample<totsample; sample++) {
- if(ps->mask & (1 << sample)) {
+ if (fullsample) {
+ for (sample=0; sample<totsample; sample++) {
+ if (ps->mask & (1 << sample)) {
pass= rlpp[sample]->rectf + od*4;
pass[0]+= col[0];
pass[1]+= col[1];
pass[2]+= col[2];
pass[3]+= col[3];
- if(pass[3]>1.0f) pass[3]= 1.0f;
+ if (pass[3]>1.0f) pass[3]= 1.0f;
}
}
}
@@ -381,27 +381,27 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
pass[1]+= fac*col[1];
pass[2]+= fac*col[2];
pass[3]+= fac*col[3];
- if(pass[3]>1.0f) pass[3]= 1.0f;
+ if (pass[3]>1.0f) pass[3]= 1.0f;
}
ps= ps->next;
}
- if(totsamp<R.osa) {
+ if (totsamp<R.osa) {
shi.co[2]= 0.0f;
col[0]= col[1]= col[2]= col[3]= 0.0f;
renderspothalo(&shi, col, 1.0f);
- if(fullsample) {
- for(sample=0; sample<totsample; sample++) {
- if(!(mask & (1 << sample))) {
+ if (fullsample) {
+ for (sample=0; sample<totsample; sample++) {
+ if (!(mask & (1 << sample))) {
pass= rlpp[sample]->rectf + od*4;
pass[0]+= col[0];
pass[1]+= col[1];
pass[2]+= col[2];
pass[3]+= col[3];
- if(pass[3]>1.0f) pass[3]= 1.0f;
+ if (pass[3]>1.0f) pass[3]= 1.0f;
}
}
}
@@ -412,12 +412,12 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
pass[1]+= fac*col[1];
pass[2]+= fac*col[2];
pass[3]+= fac*col[3];
- if(pass[3]>1.0f) pass[3]= 1.0f;
+ if (pass[3]>1.0f) pass[3]= 1.0f;
}
}
}
else {
- if(R.r.mode & R_ORTHO)
+ if (R.r.mode & R_ORTHO)
calc_renderco_ortho(shi.co, (float)x, (float)y, *rz);
else
calc_renderco_zbuf(shi.co, shi.view, *rz);
@@ -425,20 +425,20 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
col[0]= col[1]= col[2]= col[3]= 0.0f;
renderspothalo(&shi, col, 1.0f);
- for(sample=0; sample<totsample; sample++) {
+ for (sample=0; sample<totsample; sample++) {
pass= rlpp[sample]->rectf + od*4;
pass[0]+= col[0];
pass[1]+= col[1];
pass[2]+= col[2];
pass[3]+= col[3];
- if(pass[3]>1.0f) pass[3]= 1.0f;
+ if (pass[3]>1.0f) pass[3]= 1.0f;
}
}
- if(rd) rd++;
+ if (rd) rd++;
}
- if(y&1)
- if(R.test_break(R.tbh)) break;
+ if (y&1)
+ if (R.test_break(R.tbh)) break;
}
}
@@ -453,7 +453,7 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
/* combined rgb */
add_filt_fmask(curmask, shr->combined, rl->rectf + 4*offset, rectx);
- for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
float *fp, *col= NULL;
int pixsize= 3;
@@ -498,7 +498,7 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
break;
case SCE_PASS_UV:
/* box filter only, gauss will screwup UV too much */
- if(shi->totuv) {
+ if (shi->totuv) {
float mult= (float)count_mask(curmask)/(float)R.osa;
fp= rpass->rect + 3*offset;
fp[0]+= mult*(0.5f + 0.5f*shi->uv[shi->actuv].uv[0]);
@@ -508,17 +508,17 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
break;
case SCE_PASS_INDEXOB:
/* no filter */
- if(shi->vlr) {
+ if (shi->vlr) {
fp= rpass->rect + offset;
- if(*fp==0.0f)
+ if (*fp==0.0f)
*fp= (float)shi->obr->ob->index;
}
break;
case SCE_PASS_INDEXMA:
/* no filter */
- if(shi->vlr) {
+ if (shi->vlr) {
fp= rpass->rect + offset;
- if(*fp==0.0f)
+ if (*fp==0.0f)
*fp= (float)shi->mat->index;
}
break;
@@ -532,11 +532,11 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
{
/* add minimum speed in pixel, no filter */
fp= rpass->rect + 4*offset;
- if( (ABS(shr->winspeed[0]) + ABS(shr->winspeed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
+ if ( (ABS(shr->winspeed[0]) + ABS(shr->winspeed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
fp[0]= shr->winspeed[0];
fp[1]= shr->winspeed[1];
}
- if( (ABS(shr->winspeed[2]) + ABS(shr->winspeed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
+ if ( (ABS(shr->winspeed[2]) + ABS(shr->winspeed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
fp[2]= shr->winspeed[2];
fp[3]= shr->winspeed[3];
}
@@ -549,7 +549,7 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
pixsize= 4;
break;
}
- if(col) {
+ if (col) {
fp= rpass->rect + pixsize*offset;
add_filt_fmask_pixsize(curmask, col, fp, rectx, pixsize);
}
@@ -565,7 +565,7 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
fp= rl->rectf + 4*offset;
copy_v4_v4(fp, shr->combined);
- for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
float *col= NULL, uvcol[3];
int a, pixsize= 3;
@@ -609,7 +609,7 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
col= shr->nor;
break;
case SCE_PASS_UV:
- if(shi->totuv) {
+ if (shi->totuv) {
uvcol[0]= 0.5f + 0.5f*shi->uv[shi->actuv].uv[0];
uvcol[1]= 0.5f + 0.5f*shi->uv[shi->actuv].uv[1];
uvcol[2]= 1.0f;
@@ -621,13 +621,13 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
pixsize= 4;
break;
case SCE_PASS_INDEXOB:
- if(shi->vlr) {
+ if (shi->vlr) {
fp= rpass->rect + offset;
*fp= (float)shi->obr->ob->index;
}
break;
case SCE_PASS_INDEXMA:
- if(shi->vlr) {
+ if (shi->vlr) {
fp= rpass->rect + offset;
*fp= (float)shi->mat->index;
}
@@ -641,9 +641,9 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
pixsize= 4;
break;
}
- if(col) {
+ if (col) {
fp= rpass->rect + pixsize*offset;
- for(a=0; a<pixsize; a++)
+ for (a=0; a<pixsize; a++)
fp[a]= col[a];
}
}
@@ -652,10 +652,10 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
int get_sample_layers(RenderPart *pa, RenderLayer *rl, RenderLayer **rlpp)
{
- if(pa->fullresult.first) {
+ if (pa->fullresult.first) {
int sample, nr= BLI_findindex(&pa->result->layers, rl);
- for(sample=0; sample<R.osa; sample++) {
+ for (sample=0; sample<R.osa; sample++) {
RenderResult *rr= BLI_findlink(&pa->fullresult, sample);
rlpp[sample]= BLI_findlink(&rr->layers, nr);
@@ -675,27 +675,27 @@ static void sky_tile(RenderPart *pa, RenderLayer *rl)
RenderLayer *rlpp[RE_MAX_OSA];
int x, y, od=0, totsample;
- if(R.r.alphamode!=R_ADDSKY)
+ if (R.r.alphamode!=R_ADDSKY)
return;
totsample= get_sample_layers(pa, rl, rlpp);
- for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
- for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, od+=4) {
+ for (y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
+ for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, od+=4) {
float col[4];
int sample, done= 0;
- for(sample= 0; sample<totsample; sample++) {
+ for (sample= 0; sample<totsample; sample++) {
float *pass= rlpp[sample]->rectf + od;
- if(pass[3]<1.0f) {
+ if (pass[3]<1.0f) {
- if(done==0) {
+ if (done==0) {
shadeSkyPixel(col, x, y, pa->thread);
done= 1;
}
- if(pass[3]==0.0f) {
+ if (pass[3]==0.0f) {
copy_v4_v4(pass, col);
}
else {
@@ -705,8 +705,8 @@ static void sky_tile(RenderPart *pa, RenderLayer *rl)
}
}
- if(y&1)
- if(R.test_break(R.tbh)) break;
+ if (y&1)
+ if (R.test_break(R.tbh)) break;
}
}
@@ -722,67 +722,67 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl)
totsample= get_sample_layers(pa, rl, rlpp);
/* check that z pass is enabled */
- if(pa->rectz==NULL) return;
- for(zpass= rl->passes.first; zpass; zpass= zpass->next)
- if(zpass->passtype==SCE_PASS_Z)
+ if (pa->rectz==NULL) return;
+ for (zpass= rl->passes.first; zpass; zpass= zpass->next)
+ if (zpass->passtype==SCE_PASS_Z)
break;
- if(zpass==NULL) return;
+ if (zpass==NULL) return;
/* check for at least one sun lamp that its atmosphere flag is enabled */
- for(go=R.lights.first; go; go= go->next) {
+ for (go=R.lights.first; go; go= go->next) {
lar= go->lampren;
- if(lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_AP))
+ if (lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_AP))
break;
}
/* do nothign and return if there is no sun lamp */
- if(go==NULL)
+ if (go==NULL)
return;
/* for each x,y and each sample, and each sun lamp*/
- for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
- for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, od++) {
+ for (y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
+ for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, od++) {
int sample;
- for(sample=0; sample<totsample; sample++) {
+ for (sample=0; sample<totsample; sample++) {
float *zrect= RE_RenderLayerGetPass(rlpp[sample], SCE_PASS_Z) + od;
float *rgbrect = rlpp[sample]->rectf + 4*od;
float rgb[3] = {0};
int done= 0;
- for(go=R.lights.first; go; go= go->next) {
+ for (go=R.lights.first; go; go= go->next) {
lar= go->lampren;
- if(lar->type==LA_SUN && lar->sunsky) {
+ if (lar->type==LA_SUN && lar->sunsky) {
/* if it's sky continue and don't apply atmosphere effect on it */
- if(*zrect >= 9.9e10f || rgbrect[3]==0.0f) {
+ if (*zrect >= 9.9e10f || rgbrect[3]==0.0f) {
continue;
}
- if((lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) {
+ if ((lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) {
float tmp_rgb[3];
/* skip if worldspace lamp vector is below horizon */
- if(go->ob->obmat[2][2] < 0.f) {
+ if (go->ob->obmat[2][2] < 0.f) {
continue;
}
copy_v3_v3(tmp_rgb, rgbrect);
- if(rgbrect[3]!=1.0f) { /* de-premul */
+ if (rgbrect[3]!=1.0f) { /* de-premul */
mul_v3_fl(tmp_rgb, 1.0f/rgbrect[3]);
}
shadeAtmPixel(lar->sunsky, tmp_rgb, x, y, *zrect);
- if(rgbrect[3]!=1.0f) { /* premul */
+ if (rgbrect[3]!=1.0f) { /* premul */
mul_v3_fl(tmp_rgb, rgbrect[3]);
}
- if(done==0) {
+ if (done==0) {
copy_v3_v3(rgb, tmp_rgb);
done = 1;
}
- else{
+ else {
rgb[0] = 0.5f*rgb[0] + 0.5f*tmp_rgb[0];
rgb[1] = 0.5f*rgb[1] + 0.5f*tmp_rgb[1];
rgb[2] = 0.5f*rgb[2] + 0.5f*tmp_rgb[2];
@@ -792,7 +792,7 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl)
}
/* if at least for one sun lamp aerial perspective was applied*/
- if(done) {
+ if (done) {
copy_v3_v3(rgbrect, rgb);
}
}
@@ -808,10 +808,10 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
int samp;
int x, y, seed, crop=0, offs=0, od;
- if(R.test_break(R.tbh)) return;
+ if (R.test_break(R.tbh)) return;
/* irregular shadowb buffer creation */
- if(R.r.mode & R_SHADOW)
+ if (R.r.mode & R_SHADOW)
ISB_create(pa, NULL);
/* we set per pixel a fixed seed, for random AO and shadow samples */
@@ -821,45 +821,45 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
shade_sample_initialize(&ssamp, pa, rl);
/* occlusion caching */
- if(R.occlusiontree)
+ if (R.occlusiontree)
cache_occ_samples(&R, pa, &ssamp);
/* filtered render, for now we assume only 1 filter size */
- if(pa->crop) {
+ if (pa->crop) {
crop= 1;
rectdaps+= pa->rectx + 1;
offs= pa->rectx + 1;
}
/* scanline updates have to be 2 lines behind */
- rr->renrect.ymin= 0;
- rr->renrect.ymax= -2*crop;
+ rr->renrect.ymin = 0;
+ rr->renrect.ymax = -2*crop;
rr->renlay= rl;
- for(y=pa->disprect.ymin+crop; y<pa->disprect.ymax-crop; y++, rr->renrect.ymax++) {
+ for (y=pa->disprect.ymin+crop; y<pa->disprect.ymax-crop; y++, rr->renrect.ymax++) {
rd= rectdaps;
od= offs;
- for(x=pa->disprect.xmin+crop; x<pa->disprect.xmax-crop; x++, rd++, od++) {
+ for (x=pa->disprect.xmin+crop; x<pa->disprect.xmax-crop; x++, rd++, od++) {
BLI_thread_srandom(pa->thread, seed++);
- if(*rd) {
- if(shade_samples(&ssamp, (PixStr *)(*rd), x, y)) {
+ if (*rd) {
+ if (shade_samples(&ssamp, (PixStr *)(*rd), x, y)) {
/* multisample buffers or filtered mask filling? */
- if(pa->fullresult.first) {
+ if (pa->fullresult.first) {
int a;
- for(samp=0; samp<ssamp.tot; samp++) {
+ for (samp=0; samp<ssamp.tot; samp++) {
int smask= ssamp.shi[samp].mask;
- for(a=0; a<R.osa; a++) {
+ for (a=0; a<R.osa; a++) {
int mask= 1<<a;
- if(smask & mask)
+ if (smask & mask)
add_passes(ssamp.rlpp[a], od, &ssamp.shi[samp], &ssamp.shr[samp]);
}
}
}
else {
- for(samp=0; samp<ssamp.tot; samp++)
+ for (samp=0; samp<ssamp.tot; samp++)
add_filt_passes(rl, ssamp.shi[samp].mask, pa->rectx, od, &ssamp.shi[samp], &ssamp.shr[samp]);
}
}
@@ -869,16 +869,16 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
rectdaps+= pa->rectx;
offs+= pa->rectx;
- if(y&1) if(R.test_break(R.tbh)) break;
+ if (y&1) if (R.test_break(R.tbh)) break;
}
/* disable scanline updating */
rr->renlay= NULL;
- if(R.r.mode & R_SHADOW)
+ if (R.r.mode & R_SHADOW)
ISB_free(pa);
- if(R.occlusiontree)
+ if (R.occlusiontree)
free_occ_samples(&R, pa);
}
@@ -902,9 +902,9 @@ static void freeps(ListBase *lb)
{
PixStrMain *psm, *psmnext;
- for(psm= lb->first; psm; psm= psmnext) {
+ for (psm= lb->first; psm; psm= psmnext) {
psmnext= psm->next;
- if(psm->ps)
+ if (psm->ps)
MEM_freeN(psm->ps);
MEM_freeN(psm);
}
@@ -916,11 +916,11 @@ static void addps(ListBase *lb, intptr_t *rd, int obi, int facenr, int z, int ma
PixStrMain *psm;
PixStr *ps, *last= NULL;
- if(*rd) {
+ if (*rd) {
ps= (PixStr *)(*rd);
- while(ps) {
- if( ps->obi == obi && ps->facenr == facenr ) {
+ while (ps) {
+ if ( ps->obi == obi && ps->facenr == facenr ) {
ps->mask |= mask;
return;
}
@@ -932,12 +932,12 @@ static void addps(ListBase *lb, intptr_t *rd, int obi, int facenr, int z, int ma
/* make new PS (pixel struct) */
psm= lb->last;
- if(psm->counter==4095)
+ if (psm->counter==4095)
psm= addpsmain(lb);
ps= psm->ps + psm->counter++;
- if(last) last->next= ps;
+ if (last) last->next= ps;
else *rd= (intptr_t)ps;
ps->next= NULL;
@@ -954,11 +954,11 @@ static void edge_enhance_add(RenderPart *pa, float *rectf, float *arect)
float addcol[4];
int pix;
- if(arect==NULL)
+ if (arect==NULL)
return;
- for(pix= pa->rectx*pa->recty; pix>0; pix--, arect++, rectf+=4) {
- if(*arect != 0.0f) {
+ for (pix= pa->rectx*pa->recty; pix>0; pix--, arect++, rectf+=4) {
+ if (*arect != 0.0f) {
addcol[0]= *arect * R.r.edgeR;
addcol[1]= *arect * R.r.edgeG;
addcol[2]= *arect * R.r.edgeB;
@@ -975,12 +975,12 @@ static void convert_to_key_alpha(RenderPart *pa, RenderLayer *rl)
totsample= get_sample_layers(pa, rl, rlpp);
- for(sample= 0; sample<totsample; sample++) {
+ for (sample= 0; sample<totsample; sample++) {
float *rectf= rlpp[sample]->rectf;
- for(y= pa->rectx*pa->recty; y>0; y--, rectf+=4) {
- if(rectf[3] >= 1.0f);
- else if(rectf[3] > 0.0f) {
+ for (y= pa->rectx*pa->recty; y>0; y--, rectf+=4) {
+ if (rectf[3] >= 1.0f);
+ else if (rectf[3] > 0.0f) {
rectf[0] /= rectf[3];
rectf[1] /= rectf[3];
rectf[2] /= rectf[3];
@@ -999,10 +999,10 @@ static void edge_enhance_tile(RenderPart *pa, float *rectf, int *rectz)
/* shift values in zbuffer 4 to the right (anti overflows), for filter we need multiplying with 12 max */
rz= rectz;
- if(rz==NULL) return;
+ if (rz==NULL) return;
- for(y=0; y<pa->recty; y++)
- for(x=0; x<pa->rectx; x++, rz++) (*rz)>>= 4;
+ for (y=0; y<pa->recty; y++)
+ for (x=0; x<pa->rectx; x++, rz++) (*rz)>>= 4;
rz1= rectz;
rz2= rz1+pa->rectx;
@@ -1010,8 +1010,8 @@ static void edge_enhance_tile(RenderPart *pa, float *rectf, int *rectz)
rf= rectf+pa->rectx+1;
- for(y=0; y<pa->recty-2; y++) {
- for(x=0; x<pa->rectx-2; x++, rz1++, rz2++, rz3++, rf++) {
+ for (y=0; y<pa->recty-2; y++) {
+ for (x=0; x<pa->rectx-2; x++, rz1++, rz2++, rz3++, rf++) {
/* prevent overflow with sky z values */
zval1= rz1[0] + 2*rz1[1] + rz1[2];
@@ -1019,19 +1019,19 @@ static void edge_enhance_tile(RenderPart *pa, float *rectf, int *rectz)
zval3= rz3[0] + 2*rz3[1] + rz3[2];
col= ( 4*rz2[1] - (zval1 + zval2 + zval3)/3 );
- if(col<0) col= -col;
+ if (col<0) col= -col;
col >>= 5;
- if(col > (1<<16)) col= (1<<16);
+ if (col > (1<<16)) col= (1<<16);
else col= (R.r.edgeint*col)>>8;
- if(col>0) {
+ if (col>0) {
float fcol;
- if(col>255) fcol= 1.0f;
+ if (col>255) fcol= 1.0f;
else fcol= (float)col/255.0f;
- if(R.osa)
+ if (R.osa)
*rf+= fcol/(float)R.osa;
else
*rf= fcol;
@@ -1045,8 +1045,8 @@ static void edge_enhance_tile(RenderPart *pa, float *rectf, int *rectz)
/* shift back zbuf values, we might need it still */
rz= rectz;
- for(y=0; y<pa->recty; y++)
- for(x=0; x<pa->rectx; x++, rz++) (*rz)<<= 4;
+ for (y=0; y<pa->recty; y++)
+ for (x=0; x<pa->rectx; x++, rz++) (*rz)<<= 4;
}
@@ -1059,12 +1059,12 @@ static void reset_sky_speed(RenderPart *pa, RenderLayer *rl)
totsample= get_sample_layers(pa, rl, rlpp);
- for(sample= 0; sample<totsample; sample++) {
+ for (sample= 0; sample<totsample; sample++) {
fp= RE_RenderLayerGetPass(rlpp[sample], SCE_PASS_VECTOR);
- if(fp==NULL) break;
+ if (fp==NULL) break;
- for(a= 4*pa->rectx*pa->recty - 1; a>=0; a--)
- if(fp[a] == PASS_VECTOR_MAX) fp[a]= 0.0f;
+ for (a= 4*pa->rectx*pa->recty - 1; a>=0; a--)
+ if (fp[a] == PASS_VECTOR_MAX) fp[a]= 0.0f;
}
}
@@ -1074,16 +1074,16 @@ static unsigned short *make_solid_mask(RenderPart *pa)
unsigned short *solidmask, *sp;
int x;
- if(rd==NULL) return NULL;
+ if (rd==NULL) return NULL;
sp=solidmask= MEM_mallocN(sizeof(short)*pa->rectx*pa->recty, "solidmask");
- for(x=pa->rectx*pa->recty; x>0; x--, rd++, sp++) {
- if(*rd) {
+ for (x=pa->rectx*pa->recty; x>0; x--, rd++, sp++) {
+ if (*rd) {
PixStr *ps= (PixStr *)*rd;
*sp= ps->mask;
- for(ps= ps->next; ps; ps= ps->next)
+ for (ps= ps->next; ps; ps= ps->next)
*sp |= ps->mask;
}
else
@@ -1098,10 +1098,10 @@ static void addAlphaOverFloatMask(float *dest, float *source, unsigned short dma
unsigned short shared= dmask & smask;
float mul= 1.0f - source[3];
- if(shared) { /* overlapping masks */
+ if (shared) { /* overlapping masks */
/* masks differ, we make a mixture of 'add' and 'over' */
- if(shared!=dmask) {
+ if (shared!=dmask) {
float shared_bits= (float)count_mask(shared); /* alpha over */
float tot_bits= (float)count_mask(smask|dmask); /* alpha add */
@@ -1109,7 +1109,7 @@ static void addAlphaOverFloatMask(float *dest, float *source, unsigned short dma
mul= add + (1.0f-add)*mul;
}
}
- else if(dmask && smask) {
+ else if (dmask && smask) {
/* works for premul only, of course */
dest[0]+= source[0];
dest[1]+= source[1];
@@ -1143,16 +1143,16 @@ static void make_pixelstructs(RenderPart *pa, ZSpan *zspan, int sample, void *da
int x, y;
int mask= 1<<sample;
- for(y=0; y<pa->recty; y++) {
- for(x=0; x<pa->rectx; x++, rd++, rp++, ro++, rz++, rm++) {
- if(*rp) {
+ for (y=0; y<pa->recty; y++) {
+ for (x=0; x<pa->rectx; x++, rd++, rp++, ro++, rz++, rm++) {
+ if (*rp) {
addps(lb, rd, *ro, *rp, *rz, (zspan->rectmask)? *rm: 0, mask);
}
}
}
- if(sdata->rl->layflag & SCE_LAY_EDGE)
- if(R.r.mode & R_EDGE)
+ if (sdata->rl->layflag & SCE_LAY_EDGE)
+ if (R.r.mode & R_EDGE)
edge_enhance_tile(pa, sdata->edgerect, zspan->rectz);
}
@@ -1170,47 +1170,47 @@ void zbufshadeDA_tile(RenderPart *pa)
pa->recto= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "recto");
pa->rectp= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectp");
pa->rectz= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectz");
- for(rl= rr->layers.first; rl; rl= rl->next) {
- if((rl->layflag & SCE_LAY_ZMASK) && (rl->layflag & SCE_LAY_NEG_ZMASK))
+ for (rl= rr->layers.first; rl; rl= rl->next) {
+ if ((rl->layflag & SCE_LAY_ZMASK) && (rl->layflag & SCE_LAY_NEG_ZMASK))
pa->rectmask= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectmask");
/* initialize pixelstructs and edge buffer */
addpsmain(&psmlist);
pa->rectdaps= MEM_callocN(sizeof(intptr_t)*pa->rectx*pa->recty+4, "zbufDArectd");
- if(rl->layflag & SCE_LAY_EDGE)
- if(R.r.mode & R_EDGE)
+ if (rl->layflag & SCE_LAY_EDGE)
+ if (R.r.mode & R_EDGE)
edgerect= MEM_callocN(sizeof(float)*pa->rectx*pa->recty, "rectedge");
/* always fill visibility */
- for(pa->sample=0; pa->sample<R.osa; pa->sample+=4) {
+ for (pa->sample=0; pa->sample<R.osa; pa->sample+=4) {
ZbufSolidData sdata;
sdata.rl= rl;
sdata.psmlist= &psmlist;
sdata.edgerect= edgerect;
zbuffer_solid(pa, rl, make_pixelstructs, &sdata);
- if(R.test_break(R.tbh)) break;
+ if (R.test_break(R.tbh)) break;
}
/* shades solid */
- if(rl->layflag & SCE_LAY_SOLID)
+ if (rl->layflag & SCE_LAY_SOLID)
shadeDA_tile(pa, rl);
/* lamphalo after solid, before ztra, looks nicest because ztra does own halo */
- if(R.flag & R_LAMPHALO)
- if(rl->layflag & SCE_LAY_HALO)
+ if (R.flag & R_LAMPHALO)
+ if (rl->layflag & SCE_LAY_HALO)
lamphalo_tile(pa, rl);
/* halo before ztra, because ztra fills in zbuffer now */
- if(R.flag & R_HALO)
- if(rl->layflag & SCE_LAY_HALO)
+ if (R.flag & R_HALO)
+ if (rl->layflag & SCE_LAY_HALO)
halo_tile(pa, rl);
/* transp layer */
- if(R.flag & R_ZTRA || R.totstrand) {
- if(rl->layflag & (SCE_LAY_ZTRA|SCE_LAY_STRAND)) {
- if(pa->fullresult.first) {
+ if (R.flag & R_ZTRA || R.totstrand) {
+ if (rl->layflag & (SCE_LAY_ZTRA|SCE_LAY_STRAND)) {
+ if (pa->fullresult.first) {
zbuffer_transp_shade(pa, rl, rl->rectf, &psmlist);
}
else {
@@ -1225,17 +1225,17 @@ void zbufshadeDA_tile(RenderPart *pa)
SWAP(float *, rl->acolrect, rl->rectf);
/* zbuffer transp only returns ztramask if there's solid rendered */
- if(ztramask)
+ if (ztramask)
solidmask= make_solid_mask(pa);
- if(ztramask && solidmask) {
+ if (ztramask && solidmask) {
unsigned short *sps= solidmask, *spz= ztramask;
unsigned short fullmask= (1<<R.osa)-1;
float *fcol= rl->rectf; float *acol= rl->acolrect;
int x;
- for(x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4, sps++, spz++) {
- if(*sps == fullmask)
+ for (x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4, sps++, spz++) {
+ if (*sps == fullmask)
addAlphaOverFloat(fcol, acol);
else
addAlphaOverFloatMask(fcol, acol, *sps, *spz);
@@ -1244,44 +1244,44 @@ void zbufshadeDA_tile(RenderPart *pa)
else {
float *fcol= rl->rectf; float *acol= rl->acolrect;
int x;
- for(x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4) {
+ for (x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4) {
addAlphaOverFloat(fcol, acol);
}
}
- if(solidmask) MEM_freeN(solidmask);
- if(ztramask) MEM_freeN(ztramask);
+ if (solidmask) MEM_freeN(solidmask);
+ if (ztramask) MEM_freeN(ztramask);
}
}
}
/* sun/sky */
- if(rl->layflag & SCE_LAY_SKY)
+ if (rl->layflag & SCE_LAY_SKY)
atm_tile(pa, rl);
/* sky before edge */
- if(rl->layflag & SCE_LAY_SKY)
+ if (rl->layflag & SCE_LAY_SKY)
sky_tile(pa, rl);
/* extra layers */
- if(rl->layflag & SCE_LAY_EDGE)
- if(R.r.mode & R_EDGE)
+ if (rl->layflag & SCE_LAY_EDGE)
+ if (R.r.mode & R_EDGE)
edge_enhance_add(pa, rl->rectf, edgerect);
- if(rl->passflag & SCE_PASS_VECTOR)
+ if (rl->passflag & SCE_PASS_VECTOR)
reset_sky_speed(pa, rl);
/* de-premul alpha */
- if(R.r.alphamode & R_ALPHAKEY)
+ if (R.r.alphamode & R_ALPHAKEY)
convert_to_key_alpha(pa, rl);
/* free stuff within loop! */
MEM_freeN(pa->rectdaps); pa->rectdaps= NULL;
freeps(&psmlist);
- if(edgerect) MEM_freeN(edgerect);
+ if (edgerect) MEM_freeN(edgerect);
edgerect= NULL;
- if(pa->rectmask) {
+ if (pa->rectmask) {
MEM_freeN(pa->rectmask);
pa->rectmask= NULL;
}
@@ -1293,7 +1293,7 @@ void zbufshadeDA_tile(RenderPart *pa)
MEM_freeN(pa->rectz); pa->rectz= NULL;
/* display active layer */
- rr->renrect.ymin=rr->renrect.ymax= 0;
+ rr->renrect.ymin=rr->renrect.ymax = 0;
rr->renlay= render_get_active_layer(&R, rr);
}
@@ -1319,8 +1319,8 @@ void zbufshade_tile(RenderPart *pa)
pa->rectp= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectp");
pa->rectz= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectz");
- for(rl= rr->layers.first; rl; rl= rl->next) {
- if((rl->layflag & SCE_LAY_ZMASK) && (rl->layflag & SCE_LAY_NEG_ZMASK))
+ for (rl= rr->layers.first; rl; rl= rl->next) {
+ if ((rl->layflag & SCE_LAY_ZMASK) && (rl->layflag & SCE_LAY_NEG_ZMASK))
pa->rectmask= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectmask");
/* general shader info, passes */
@@ -1328,21 +1328,21 @@ void zbufshade_tile(RenderPart *pa)
zbuffer_solid(pa, rl, NULL, NULL);
- if(!R.test_break(R.tbh)) { /* NOTE: this if() is not consistent */
+ if (!R.test_break(R.tbh)) { /* NOTE: this if () is not consistent */
/* edges only for solid part, ztransp doesn't support it yet anti-aliased */
- if(rl->layflag & SCE_LAY_EDGE) {
- if(R.r.mode & R_EDGE) {
+ if (rl->layflag & SCE_LAY_EDGE) {
+ if (R.r.mode & R_EDGE) {
edgerect= MEM_callocN(sizeof(float)*pa->rectx*pa->recty, "rectedge");
edge_enhance_tile(pa, edgerect, pa->rectz);
}
}
/* initialize scanline updates for main thread */
- rr->renrect.ymin= 0;
+ rr->renrect.ymin = 0;
rr->renlay= rl;
- if(rl->layflag & SCE_LAY_SOLID) {
+ if (rl->layflag & SCE_LAY_SOLID) {
float *fcol= rl->rectf;
int *ro= pa->recto, *rp= pa->rectp, *rz= pa->rectz;
int x, y, offs=0, seed;
@@ -1351,35 +1351,35 @@ void zbufshade_tile(RenderPart *pa)
seed= pa->rectx*pa->disprect.ymin;
/* irregular shadowb buffer creation */
- if(R.r.mode & R_SHADOW)
+ if (R.r.mode & R_SHADOW)
ISB_create(pa, NULL);
- if(R.occlusiontree)
+ if (R.occlusiontree)
cache_occ_samples(&R, pa, &ssamp);
- for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
- for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, ro++, rz++, rp++, fcol+=4, offs++) {
+ for (y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
+ for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, ro++, rz++, rp++, fcol+=4, offs++) {
/* per pixel fixed seed */
BLI_thread_srandom(pa->thread, seed++);
- if(*rp) {
+ if (*rp) {
ps.obi= *ro;
ps.facenr= *rp;
ps.z= *rz;
- if(shade_samples(&ssamp, &ps, x, y)) {
+ if (shade_samples(&ssamp, &ps, x, y)) {
/* combined and passes */
add_passes(rl, offs, ssamp.shi, ssamp.shr);
}
}
}
- if(y&1)
- if(R.test_break(R.tbh)) break;
+ if (y&1)
+ if (R.test_break(R.tbh)) break;
}
- if(R.occlusiontree)
+ if (R.occlusiontree)
free_occ_samples(&R, pa);
- if(R.r.mode & R_SHADOW)
+ if (R.r.mode & R_SHADOW)
ISB_free(pa);
}
@@ -1388,17 +1388,17 @@ void zbufshade_tile(RenderPart *pa)
}
/* lamphalo after solid, before ztra, looks nicest because ztra does own halo */
- if(R.flag & R_LAMPHALO)
- if(rl->layflag & SCE_LAY_HALO)
+ if (R.flag & R_LAMPHALO)
+ if (rl->layflag & SCE_LAY_HALO)
lamphalo_tile(pa, rl);
/* halo before ztra, because ztra fills in zbuffer now */
- if(R.flag & R_HALO)
- if(rl->layflag & SCE_LAY_HALO)
+ if (R.flag & R_HALO)
+ if (rl->layflag & SCE_LAY_HALO)
halo_tile(pa, rl);
- if(R.flag & R_ZTRA || R.totstrand) {
- if(rl->layflag & (SCE_LAY_ZTRA|SCE_LAY_STRAND)) {
+ if (R.flag & R_ZTRA || R.totstrand) {
+ if (rl->layflag & (SCE_LAY_ZTRA|SCE_LAY_STRAND)) {
float *fcol, *acol;
int x;
@@ -1411,44 +1411,44 @@ void zbufshade_tile(RenderPart *pa)
SWAP(float *, rl->acolrect, rl->rectf);
fcol= rl->rectf; acol= rl->acolrect;
- for(x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4) {
+ for (x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4) {
addAlphaOverFloat(fcol, acol);
}
}
}
/* sun/sky */
- if(rl->layflag & SCE_LAY_SKY)
+ if (rl->layflag & SCE_LAY_SKY)
atm_tile(pa, rl);
/* sky before edge */
- if(rl->layflag & SCE_LAY_SKY)
+ if (rl->layflag & SCE_LAY_SKY)
sky_tile(pa, rl);
- if(!R.test_break(R.tbh)) {
- if(rl->layflag & SCE_LAY_EDGE)
- if(R.r.mode & R_EDGE)
+ if (!R.test_break(R.tbh)) {
+ if (rl->layflag & SCE_LAY_EDGE)
+ if (R.r.mode & R_EDGE)
edge_enhance_add(pa, rl->rectf, edgerect);
}
- if(rl->passflag & SCE_PASS_VECTOR)
+ if (rl->passflag & SCE_PASS_VECTOR)
reset_sky_speed(pa, rl);
/* de-premul alpha */
- if(R.r.alphamode & R_ALPHAKEY)
+ if (R.r.alphamode & R_ALPHAKEY)
convert_to_key_alpha(pa, rl);
- if(edgerect) MEM_freeN(edgerect);
+ if (edgerect) MEM_freeN(edgerect);
edgerect= NULL;
- if(pa->rectmask) {
+ if (pa->rectmask) {
MEM_freeN(pa->rectmask);
pa->rectmask= NULL;
}
}
/* display active layer */
- rr->renrect.ymin=rr->renrect.ymax= 0;
+ rr->renrect.ymin=rr->renrect.ymax = 0;
rr->renlay= render_get_active_layer(&R, rr);
MEM_freeN(pa->recto); pa->recto= NULL;
@@ -1470,37 +1470,37 @@ static void addps_sss(void *cb_handle, int obi, int facenr, int x, int y, int z)
/* extra border for filter gives double samples on part edges,
* don't use those */
- if(x<pa->crop || x>=pa->rectx-pa->crop)
+ if (x<pa->crop || x>=pa->rectx-pa->crop)
return;
- if(y<pa->crop || y>=pa->recty-pa->crop)
+ if (y<pa->crop || y>=pa->recty-pa->crop)
return;
- if(pa->rectall) {
+ if (pa->rectall) {
intptr_t *rs= pa->rectall + pa->rectx*y + x;
addps(&handle->psmlist, rs, obi, facenr, z, 0, 0);
handle->totps++;
}
- if(pa->rectz) {
+ if (pa->rectz) {
int *rz= pa->rectz + pa->rectx*y + x;
int *rp= pa->rectp + pa->rectx*y + x;
int *ro= pa->recto + pa->rectx*y + x;
- if(z < *rz) {
- if(*rp == 0)
+ if (z < *rz) {
+ if (*rp == 0)
handle->totps++;
*rz= z;
*rp= facenr;
*ro= obi;
}
}
- if(pa->rectbackz) {
+ if (pa->rectbackz) {
int *rz= pa->rectbackz + pa->rectx*y + x;
int *rp= pa->rectbackp + pa->rectx*y + x;
int *ro= pa->rectbacko + pa->rectx*y + x;
- if(z >= *rz) {
- if(*rp == 0)
+ if (z >= *rz) {
+ if (*rp == 0)
handle->totps++;
*rz= z;
*rp= facenr;
@@ -1518,7 +1518,7 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
/* cache for shadow */
shi->samplenr= R.shadowsamplenr[shi->thread]++;
- if(quad)
+ if (quad)
shade_input_set_triangle_i(shi, obi, vlr, 0, 2, 3);
else
shade_input_set_triangle_i(shi, obi, vlr, 0, 1, 2);
@@ -1548,11 +1548,11 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
shade_input_set_normals(shi);
/* we don't want flipped normals, they screw up back scattering */
- if(shi->flippednor)
+ if (shi->flippednor)
shade_input_flip_normals(shi);
/* not a pretty solution, but fixes common cases */
- if(shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
+ if (shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
negate_v3(shi->vn);
negate_v3(shi->vno);
negate_v3(shi->nmapnorm);
@@ -1560,7 +1560,7 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
/* if nodetree, use the material that we are currently preprocessing
* instead of the node material */
- if(shi->mat->nodetree && shi->mat->use_nodes)
+ if (shi->mat->nodetree && shi->mat->use_nodes)
shi->mat= mat;
/* init material vars */
@@ -1638,7 +1638,7 @@ void zbufshade_sss_tile(RenderPart *pa)
shade_sample_initialize(&ssamp, pa, rr->layers.first);
ssamp.tot= 1;
- for(rl=rr->layers.first; rl; rl=rl->next) {
+ for (rl=rr->layers.first; rl; rl=rl->next) {
ssamp.shi[0].lay |= rl->lay;
ssamp.shi[0].layflag |= rl->layflag;
ssamp.shi[0].passflag |= rl->passflag;
@@ -1655,7 +1655,7 @@ void zbufshade_sss_tile(RenderPart *pa)
/* create the pixelstrs to be used later */
zbuffer_sss(pa, lay, &handle, addps_sss);
- if(handle.totps==0) {
+ if (handle.totps==0) {
zbufshade_sss_free(pa);
return;
}
@@ -1668,13 +1668,13 @@ void zbufshade_sss_tile(RenderPart *pa)
#if 0
/* create ISB (does not work currently!) */
- if(re->r.mode & R_SHADOW)
+ if (re->r.mode & R_SHADOW)
ISB_create(pa, NULL);
#endif
- if(display) {
+ if (display) {
/* initialize scanline updates for main thread */
- rr->renrect.ymin= 0;
+ rr->renrect.ymin = 0;
rr->renlay= rl;
}
@@ -1691,15 +1691,15 @@ void zbufshade_sss_tile(RenderPart *pa)
#endif
totpoint= 0;
- for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
- for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, fcol+=4) {
+ for (y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
+ for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, fcol+=4) {
/* per pixel fixed seed */
BLI_thread_srandom(pa->thread, seed++);
#if 0
- if(rs) {
+ if (rs) {
/* for each sample in this pixel, shade it */
- for(ps=(PixStr*)*rs; ps; ps=ps->next) {
+ for (ps=(PixStr*)*rs; ps; ps=ps->next) {
ObjectInstanceRen *obi= &re->objectinstance[ps->obi];
ObjectRen *obr= obi->obr;
vlr= RE_findOrAddVlak(obr, (ps->facenr-1) & RE_QUAD_MASK);
@@ -1718,8 +1718,8 @@ void zbufshade_sss_tile(RenderPart *pa)
rs++;
}
#else
- if(rp) {
- if(*rp != 0) {
+ if (rp) {
+ if (*rp != 0) {
ObjectInstanceRen *obi= &re->objectinstance[*ro];
ObjectRen *obr= obi->obr;
@@ -1738,8 +1738,8 @@ void zbufshade_sss_tile(RenderPart *pa)
rp++; rz++; ro++;
}
- if(rbp) {
- if(*rbp != 0 && !(*rbp == *(rp-1) && *rbo == *(ro-1))) {
+ if (rbp) {
+ if (*rbp != 0 && !(*rbp == *(rp-1) && *rbo == *(ro-1))) {
ObjectInstanceRen *obi= &re->objectinstance[*rbo];
ObjectRen *obr= obi->obr;
@@ -1763,12 +1763,12 @@ void zbufshade_sss_tile(RenderPart *pa)
#endif
}
- if(y&1)
- if(re->test_break(re->tbh)) break;
+ if (y&1)
+ if (re->test_break(re->tbh)) break;
}
/* note: after adding we do not free these arrays, sss keeps them */
- if(totpoint > 0) {
+ if (totpoint > 0) {
sss_add_points(re, co, color, area, totpoint);
}
else {
@@ -1778,13 +1778,13 @@ void zbufshade_sss_tile(RenderPart *pa)
}
#if 0
- if(re->r.mode & R_SHADOW)
+ if (re->r.mode & R_SHADOW)
ISB_free(pa);
#endif
- if(display) {
+ if (display) {
/* display active layer */
- rr->renrect.ymin=rr->renrect.ymax= 0;
+ rr->renrect.ymin=rr->renrect.ymax = 0;
rr->renlay= render_get_active_layer(&R, rr);
}
@@ -1806,37 +1806,37 @@ static void renderhalo_post(RenderResult *rr, float *rectf, HaloRen *har) /* pos
har->miny= miny= haloys - har->rad/R.ycor;
har->maxy= maxy= haloys + har->rad/R.ycor;
- if(maxy<0);
- else if(rr->recty<miny);
+ if (maxy<0);
+ else if (rr->recty<miny);
else {
minx= floor(haloxs-har->rad);
maxx= ceil(haloxs+har->rad);
- if(maxx<0);
- else if(rr->rectx<minx);
+ if (maxx<0);
+ else if (rr->rectx<minx);
else {
- if(minx<0) minx= 0;
- if(maxx>=rr->rectx) maxx= rr->rectx-1;
- if(miny<0) miny= 0;
- if(maxy>rr->recty) maxy= rr->recty;
+ if (minx<0) minx= 0;
+ if (maxx>=rr->rectx) maxx= rr->rectx-1;
+ if (miny<0) miny= 0;
+ if (maxy>rr->recty) maxy= rr->recty;
rectft= rectf+ 4*rr->rectx*miny;
- for(y=miny; y<maxy; y++) {
+ for (y=miny; y<maxy; y++) {
rtf= rectft+4*minx;
yn= (y - haloys)*R.ycor;
ysq= yn*yn;
- for(x=minx; x<=maxx; x++) {
+ for (x=minx; x<=maxx; x++) {
xn= x - haloxs;
xsq= xn*xn;
dist= xsq+ysq;
- if(dist<har->radsq) {
+ if (dist<har->radsq) {
- if(shadeHaloFloat(har, colf, 0x7FFFFF, dist, xn, yn, har->flarec))
+ if (shadeHaloFloat(har, colf, 0x7FFFFF, dist, xn, yn, har->flarec))
addalphaAddfacFloat(rtf, colf, har->add);
}
rtf+=4;
@@ -1844,7 +1844,7 @@ static void renderhalo_post(RenderResult *rr, float *rectf, HaloRen *har) /* pos
rectft+= 4*rr->rectx;
- if(R.test_break(R.tbh)) break;
+ if (R.test_break(R.tbh)) break;
}
}
}
@@ -1885,7 +1885,7 @@ static void renderflare(RenderResult *rr, float *rectf, HaloRen *har)
/* next halo's: the flares */
rc= hashvectf + ma->seed2;
- for(b=1; b<har->flarec; b++) {
+ for (b=1; b<har->flarec; b++) {
fla.r= fabs(rc[0]);
fla.g= fabs(rc[1]);
@@ -1898,7 +1898,7 @@ static void renderflare(RenderResult *rr, float *rectf, HaloRen *har)
fla.rad= ma->subsize*sqrtf(fabs(2.0f*har->rad*rc[4]));
- if(type==3) {
+ if (type==3) {
fla.rad*= 3.0f;
fla.rad+= R.rectx/10;
}
@@ -1912,16 +1912,16 @@ static void renderflare(RenderResult *rr, float *rectf, HaloRen *har)
fla.xs= R.winx/2 + vec[0] + (1.2f+rc[8])*R.rectx*vec[0]/vec[2];
fla.ys= R.winy/2 + vec[1] + (1.2f+rc[8])*R.rectx*vec[1]/vec[2];
- if(R.flag & R_SEC_FIELD) {
- if(R.r.mode & R_ODDFIELD) fla.ys += 0.5f;
+ if (R.flag & R_SEC_FIELD) {
+ if (R.r.mode & R_ODDFIELD) fla.ys += 0.5f;
else fla.ys -= 0.5f;
}
- if(type & 1) fla.type= HA_FLARECIRC;
+ if (type & 1) fla.type= HA_FLARECIRC;
else fla.type= 0;
renderhalo_post(rr, rectf, &fla);
fla.alfa*= 0.5f;
- if(type & 2) fla.type= HA_FLARECIRC;
+ if (type & 2) fla.type= HA_FLARECIRC;
else fla.type= 0;
renderhalo_post(rr, rectf, &fla);
@@ -1938,11 +1938,11 @@ void add_halo_flare(Render *re)
int a, mode, do_draw=0;
/* for now, we get the first renderlayer in list with halos set */
- for(rl= rr->layers.first; rl; rl= rl->next)
- if(rl->layflag & SCE_LAY_HALO)
+ for (rl= rr->layers.first; rl; rl= rl->next)
+ if (rl->layflag & SCE_LAY_HALO)
break;
- if(rl==NULL || rl->rectf==NULL)
+ if (rl==NULL || rl->rectf==NULL)
return;
mode= R.r.mode;
@@ -1950,16 +1950,16 @@ void add_halo_flare(Render *re)
project_renderdata(&R, projectverto, 0, 0, 0);
- for(a=0; a<R.tothalo; a++) {
+ for (a=0; a<R.tothalo; a++) {
har= R.sortedhalos[a];
- if(har->flarec) {
+ if (har->flarec) {
do_draw= 1;
renderflare(rr, rl->rectf, har);
}
}
- if(do_draw) {
+ if (do_draw) {
/* weak... the display callback wants an active renderlayer pointer... */
rr->renlay= rl;
re->display_draw(re->ddh, rr, NULL);
@@ -1998,7 +1998,7 @@ typedef struct BakeShade {
static void bake_set_shade_input(ObjectInstanceRen *obi, VlakRen *vlr, ShadeInput *shi, int quad, int UNUSED(isect), int x, int y, float u, float v)
{
- if(quad)
+ if (quad)
shade_input_set_triangle_i(shi, obi, vlr, 0, 2, 3);
else
shade_input_set_triangle_i(shi, obi, vlr, 0, 1, 2);
@@ -2017,7 +2017,7 @@ static void bake_set_shade_input(ObjectInstanceRen *obi, VlakRen *vlr, ShadeInpu
shade_input_set_normals(shi);
/* no normal flip */
- if(shi->flippednor)
+ if (shi->flippednor)
shade_input_flip_normals(shi);
/* set up view vector to look right at the surface (note that the normal
@@ -2036,10 +2036,10 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
shade_input_init_material(shi);
- if(bs->type==RE_BAKE_AO) {
+ if (bs->type==RE_BAKE_AO) {
ambient_occlusion(shi);
- if(R.r.bake_flag & R_BAKE_NORMALIZE) {
+ if (R.r.bake_flag & R_BAKE_NORMALIZE) {
copy_v3_v3(shr.combined, shi->ao);
}
else {
@@ -2055,27 +2055,27 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
/* only do AO for a full bake (and obviously AO bakes)
* AO for light bakes is a leftover and might not be needed */
- if( ELEM3(bs->type, RE_BAKE_ALL, RE_BAKE_AO, RE_BAKE_LIGHT))
+ if ( ELEM3(bs->type, RE_BAKE_ALL, RE_BAKE_AO, RE_BAKE_LIGHT))
shade_samples_do_AO(ssamp);
- if(shi->mat->nodetree && shi->mat->use_nodes) {
+ if (shi->mat->nodetree && shi->mat->use_nodes) {
ntreeShaderExecTree(shi->mat->nodetree, shi, &shr);
shi->mat= vlr->mat; /* shi->mat is being set in nodetree */
}
else
shade_material_loop(shi, &shr);
- if(bs->type==RE_BAKE_NORMALS) {
+ if (bs->type==RE_BAKE_NORMALS) {
float nor[3];
copy_v3_v3(nor, shi->vn);
- if(R.r.bake_normal_space == R_BAKE_SPACE_CAMERA);
- else if(R.r.bake_normal_space == R_BAKE_SPACE_TANGENT) {
+ if (R.r.bake_normal_space == R_BAKE_SPACE_CAMERA);
+ else if (R.r.bake_normal_space == R_BAKE_SPACE_TANGENT) {
float mat[3][3], imat[3][3];
/* bitangent */
- if(tvn && ttang) {
+ if (tvn && ttang) {
copy_v3_v3(mat[0], ttang);
cross_v3_v3v3(mat[1], tvn, ttang);
mul_v3_fl(mat[1], ttang[3]);
@@ -2091,9 +2091,9 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
invert_m3_m3(imat, mat);
mul_m3_v3(imat, nor);
}
- else if(R.r.bake_normal_space == R_BAKE_SPACE_OBJECT)
+ else if (R.r.bake_normal_space == R_BAKE_SPACE_OBJECT)
mul_mat3_m4_v3(ob->imat_ren, nor); /* ob->imat_ren includes viewinv! */
- else if(R.r.bake_normal_space == R_BAKE_SPACE_WORLD)
+ else if (R.r.bake_normal_space == R_BAKE_SPACE_WORLD)
mul_mat3_m4_v3(R.viewinv, nor);
normalize_v3(nor); /* in case object has scaling */
@@ -2108,47 +2108,47 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
shr.combined[1]= nor[1]/2.0f + 0.5f;
shr.combined[2]= nor[2]/2.0f + 0.5f;
}
- else if(bs->type==RE_BAKE_TEXTURE) {
+ else if (bs->type==RE_BAKE_TEXTURE) {
shr.combined[0]= shi->r;
shr.combined[1]= shi->g;
shr.combined[2]= shi->b;
shr.alpha = shi->alpha;
}
- else if(bs->type==RE_BAKE_SHADOW) {
+ else if (bs->type==RE_BAKE_SHADOW) {
copy_v3_v3(shr.combined, shr.shad);
shr.alpha = shi->alpha;
}
- else if(bs->type==RE_BAKE_SPEC_COLOR) {
+ else if (bs->type==RE_BAKE_SPEC_COLOR) {
shr.combined[0]= shi->specr;
shr.combined[1]= shi->specg;
shr.combined[2]= shi->specb;
shr.alpha = 1.0f;
}
- else if(bs->type==RE_BAKE_SPEC_INTENSITY) {
+ else if (bs->type==RE_BAKE_SPEC_INTENSITY) {
shr.combined[0]=
shr.combined[1]=
shr.combined[2]= shi->spec;
shr.alpha = 1.0f;
}
- else if(bs->type==RE_BAKE_MIRROR_COLOR) {
+ else if (bs->type==RE_BAKE_MIRROR_COLOR) {
shr.combined[0]= shi->mirr;
shr.combined[1]= shi->mirg;
shr.combined[2]= shi->mirb;
shr.alpha = 1.0f;
}
- else if(bs->type==RE_BAKE_MIRROR_INTENSITY) {
+ else if (bs->type==RE_BAKE_MIRROR_INTENSITY) {
shr.combined[0]=
shr.combined[1]=
shr.combined[2]= shi->ray_mirror;
shr.alpha = 1.0f;
}
- else if(bs->type==RE_BAKE_ALPHA) {
+ else if (bs->type==RE_BAKE_ALPHA) {
shr.combined[0]=
shr.combined[1]=
shr.combined[2]= shi->alpha;
shr.alpha = 1.0f;
}
- else if(bs->type==RE_BAKE_EMIT) {
+ else if (bs->type==RE_BAKE_EMIT) {
shr.combined[0]=
shr.combined[1]=
shr.combined[2]= shi->emit;
@@ -2156,12 +2156,13 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
}
}
- if(bs->rect_float) {
+ if (bs->rect_float) {
float *col= bs->rect_float + 4*(bs->rectx*y + x);
copy_v3_v3(col, shr.combined);
if (bs->type==RE_BAKE_ALL || bs->type==RE_BAKE_TEXTURE) {
col[3]= shr.alpha;
- } else {
+ }
+ else {
col[3]= 1.0;
}
}
@@ -2177,7 +2178,8 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
if (ELEM(bs->type, RE_BAKE_ALL, RE_BAKE_TEXTURE)) {
col[3]= FTOCHAR(shr.alpha);
- } else {
+ }
+ else {
col[3]= 255;
}
}
@@ -2192,17 +2194,19 @@ static void bake_displacement(void *handle, ShadeInput *UNUSED(shi), float dist,
BakeShade *bs= handle;
float disp;
- if(R.r.bake_flag & R_BAKE_NORMALIZE && R.r.bake_maxdist) {
+ if (R.r.bake_flag & R_BAKE_NORMALIZE && R.r.bake_maxdist) {
disp = (dist+R.r.bake_maxdist) / (R.r.bake_maxdist*2); /* alter the range from [-bake_maxdist, bake_maxdist] to [0, 1]*/
- } else {
+ }
+ else {
disp = 0.5f + dist; /* alter the range from [-0.5,0.5] to [0,1]*/
}
- if(bs->rect_float) {
+ if (bs->rect_float) {
float *col= bs->rect_float + 4*(bs->rectx*y + x);
col[0] = col[1] = col[2] = disp;
col[3]= 1.0f;
- } else {
+ }
+ else {
char *col= (char *)(bs->rect + bs->rectx*y + x);
col[0] = col[1] = col[2] = FTOCHAR(disp);
col[3]= 255;
@@ -2218,7 +2222,7 @@ static int bake_intersect_tree(RayObject* raytree, Isect* isect, float *start, f
int hit;
/* might be useful to make a user setting for maxsize*/
- if(R.r.bake_maxdist > 0.0f)
+ if (R.r.bake_maxdist > 0.0f)
maxdist= R.r.bake_maxdist;
else
maxdist= RE_RAYTRACE_MAXDIST + R.r.bake_biasdist;
@@ -2231,7 +2235,7 @@ static int bake_intersect_tree(RayObject* raytree, Isect* isect, float *start, f
isect->dist = maxdist;
hit = RE_rayobject_raycast(raytree, isect);
- if(hit) {
+ if (hit) {
madd_v3_v3v3fl(hitco, isect->start, isect->dir, isect->dist);
*dist= isect->dist;
@@ -2245,7 +2249,7 @@ static void bake_set_vlr_dxyco(BakeShade *bs, float *uv1, float *uv2, float *uv3
VlakRen *vlr= bs->vlr;
float A, d1, d2, d3, *v1, *v2, *v3;
- if(bs->quad) {
+ if (bs->quad) {
v1= vlr->v1->co;
v2= vlr->v3->co;
v3= vlr->v4->co;
@@ -2261,7 +2265,7 @@ static void bake_set_vlr_dxyco(BakeShade *bs, float *uv1, float *uv2, float *uv3
* then taking u and v partial derivatives to get dxco and dyco */
A= (uv2[0] - uv1[0])*(uv3[1] - uv1[1]) - (uv3[0] - uv1[0])*(uv2[1] - uv1[1]);
- if(fabsf(A) > FLT_EPSILON) {
+ if (fabsf(A) > FLT_EPSILON) {
A= 0.5f/A;
d1= uv2[1] - uv3[1];
@@ -2283,7 +2287,7 @@ static void bake_set_vlr_dxyco(BakeShade *bs, float *uv1, float *uv2, float *uv3
bs->dyco[0]= bs->dyco[1]= bs->dyco[2]= 0.0f;
}
- if(bs->obi->flag & R_TRANSFORMED) {
+ if (bs->obi->flag & R_TRANSFORMED) {
mul_m3_v3(bs->obi->nmat, bs->dxco);
mul_m3_v3(bs->obi->nmat, bs->dyco);
}
@@ -2301,11 +2305,11 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
ShadeInput *shi= ssamp->shi;
/* fast threadsafe break test */
- if(R.test_break(R.tbh))
+ if (R.test_break(R.tbh))
return;
/* setup render coordinates */
- if(bs->quad) {
+ if (bs->quad) {
v1= vlr->v1->co;
v2= vlr->v3->co;
v3= vlr->v4->co;
@@ -2323,7 +2327,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
shi->co[1]= l*v3[1]+u*v1[1]+v*v2[1];
shi->co[2]= l*v3[2]+u*v1[2]+v*v2[2];
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mul_m4_v3(obi->mat, shi->co);
copy_v3_v3(shi->dxco, bs->dxco);
@@ -2332,14 +2336,14 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
quad= bs->quad;
bake_set_shade_input(obi, vlr, shi, quad, 0, x, y, u, v);
- if(bs->type==RE_BAKE_NORMALS && R.r.bake_normal_space==R_BAKE_SPACE_TANGENT) {
+ if (bs->type==RE_BAKE_NORMALS && R.r.bake_normal_space==R_BAKE_SPACE_TANGENT) {
shade_input_set_shade_texco(shi);
copy_v3_v3(tvn, shi->nmapnorm);
copy_v4_v4(ttang, shi->nmaptang);
}
/* if we are doing selected to active baking, find point on other face */
- if(bs->actob) {
+ if (bs->actob) {
Isect isec, minisec;
float co[3], minco[3], dist, mindist=0.0f;
int hit, sign, dir=1;
@@ -2351,7 +2355,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
copy_v3_v3(bs->dir, shi->vn);
- for(sign=-1; sign<=1; sign+=2) {
+ for (sign=-1; sign<=1; sign+=2) {
memset(&isec, 0, sizeof(isec));
isec.mode= RE_RAY_MIRROR;
@@ -2361,8 +2365,8 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
isec.check = RE_CHECK_VLR_BAKE;
isec.skip = RE_SKIP_VLR_NEIGHBOUR;
- if(bake_intersect_tree(R.raytree, &isec, shi->co, shi->vn, sign, co, &dist)) {
- if(!hit || len_squared_v3v3(shi->co, co) < len_squared_v3v3(shi->co, minco)) {
+ if (bake_intersect_tree(R.raytree, &isec, shi->co, shi->vn, sign, co, &dist)) {
+ if (!hit || len_squared_v3v3(shi->co, co) < len_squared_v3v3(shi->co, minco)) {
minisec= isec;
mindist= dist;
copy_v3_v3(minco, co);
@@ -2373,7 +2377,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
}
if (bs->type==RE_BAKE_DISPLACEMENT) {
- if(hit)
+ if (hit)
bake_displacement(handle, shi, (dir==-1)? mindist:-mindist, x, y);
else
bake_displacement(handle, shi, 0.0f, x, y);
@@ -2381,7 +2385,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
}
/* if hit, we shade from the new point, otherwise from point one starting face */
- if(hit) {
+ if (hit) {
obi= (ObjectInstanceRen*)minisec.hit.ob;
vlr= (VlakRen*)minisec.hit.face;
quad= (minisec.isect == 2);
@@ -2393,7 +2397,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
}
}
- if(bs->type==RE_BAKE_NORMALS && R.r.bake_normal_space==R_BAKE_SPACE_TANGENT)
+ if (bs->type==RE_BAKE_NORMALS && R.r.bake_normal_space==R_BAKE_SPACE_TANGENT)
bake_shade(handle, ob, shi, quad, x, y, u, v, tvn, ttang);
else
bake_shade(handle, ob, shi, quad, x, y, u, v, 0, 0);
@@ -2407,7 +2411,7 @@ static int get_next_bake_face(BakeShade *bs)
static int v= 0, vdone= 0;
static ObjectInstanceRen *obi= NULL;
- if(bs==NULL) {
+ if (bs==NULL) {
vlr= NULL;
v= vdone= 0;
obi= R.instancetable.first;
@@ -2416,44 +2420,44 @@ static int get_next_bake_face(BakeShade *bs)
BLI_lock_thread(LOCK_CUSTOM1);
- for(; obi; obi=obi->next, v=0) {
+ for (; obi; obi=obi->next, v=0) {
obr= obi->obr;
- for(; v<obr->totvlak; v++) {
+ for (; v<obr->totvlak; v++) {
vlr= RE_findOrAddVlak(obr, v);
- if((bs->actob && bs->actob == obr->ob) || (!bs->actob && (obr->ob->flag & SELECT))) {
+ if ((bs->actob && bs->actob == obr->ob) || (!bs->actob && (obr->ob->flag & SELECT))) {
tface= RE_vlakren_get_tface(obr, vlr, obr->bakemtface, NULL, 0);
- if(tface && tface->tpage) {
+ if (tface && tface->tpage) {
Image *ima= tface->tpage;
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
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};
- if(ibuf==NULL)
+ if (ibuf==NULL)
continue;
- if(ibuf->rect==NULL && ibuf->rect_float==NULL)
+ if (ibuf->rect==NULL && ibuf->rect_float==NULL)
continue;
- if(ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
+ if (ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
continue;
- if(ima->flag & IMA_USED_FOR_RENDER) {
+ if (ima->flag & IMA_USED_FOR_RENDER) {
ima->id.flag &= ~LIB_DOIT;
continue;
}
/* find the image for the first time? */
- if(ima->id.flag & LIB_DOIT) {
+ if (ima->id.flag & LIB_DOIT) {
ima->id.flag &= ~LIB_DOIT;
/* we either fill in float or char, this ensures things go fine */
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
imb_freerectImBuf(ibuf);
/* clear image */
- if(R.r.bake_flag & R_BAKE_CLEAR)
+ if (R.r.bake_flag & R_BAKE_CLEAR)
IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
/* might be read by UI to set active image for display */
@@ -2489,7 +2493,7 @@ static void shade_tface(BakeShade *bs)
int a, i1, i2, i3;
/* check valid zspan */
- if(ima!=bs->ima) {
+ if (ima!=bs->ima) {
bs->ima= ima;
bs->ibuf= BKE_image_get_ibuf(ima, NULL);
/* note, these calls only free/fill contents of zspan struct, not zspan itself */
@@ -2510,13 +2514,14 @@ static void shade_tface(BakeShade *bs)
bs->ibuf->userdata = (void *)MEM_callocN(sizeof(char)*bs->rectx*bs->recty, "BakeMask");
bs->rect_mask= (char *)bs->ibuf->userdata;
BLI_unlock_thread(LOCK_CUSTOM1);
- } else {
+ }
+ else {
bs->rect_mask= (char *)bs->ibuf->userdata;
}
}
/* get pixel level vertex coordinates */
- for(a=0; a<4; a++) {
+ for (a=0; a<4; a++) {
/* Note, workaround for pixel aligned UVs which are common and can screw up our intersection tests
* where a pixel gets in between 2 faces or the middle of a quad,
* camera aligned quads also have this problem but they are less common.
@@ -2531,7 +2536,7 @@ static void shade_tface(BakeShade *bs)
bake_set_vlr_dxyco(bs, vec[i1], vec[i2], vec[i3]);
zspan_scanconvert(bs->zspan, bs, vec[i1], vec[i2], vec[i3], do_bake_shade);
- if(vlr->v4) {
+ if (vlr->v4) {
bs->quad= 1;
bake_set_vlr_dxyco(bs, vec[0], vec[2], vec[3]);
zspan_scanconvert(bs->zspan, bs, vec[0], vec[2], vec[3], do_bake_shade);
@@ -2542,16 +2547,16 @@ static void *do_bake_thread(void *bs_v)
{
BakeShade *bs= bs_v;
- while(get_next_bake_face(bs)) {
+ while (get_next_bake_face(bs)) {
shade_tface(bs);
/* fast threadsafe break test */
- if(R.test_break(R.tbh))
+ if (R.test_break(R.tbh))
break;
/* access is not threadsafe but since its just true/false probably ok
* only used for interactive baking */
- if(bs->do_update)
+ if (bs->do_update)
*bs->do_update= TRUE;
}
bs->ready= 1;
@@ -2565,16 +2570,16 @@ void RE_bake_ibuf_filter(ImBuf *ibuf, char *mask, const int filter)
const short is_new_alpha= (ibuf->planes != R_IMF_PLANES_RGBA) && BKE_alphatest_ibuf(ibuf);
/* Margin */
- if(filter) {
+ if (filter) {
IMB_filter_extend(ibuf, mask, filter);
}
/* if the bake results in new alpha then change the image setting */
- if(is_new_alpha) {
+ if (is_new_alpha) {
ibuf->planes= R_IMF_PLANES_RGBA;
}
else {
- if(filter && ibuf->planes != R_IMF_PLANES_RGBA) {
+ if (filter && ibuf->planes != R_IMF_PLANES_RGBA) {
/* clear alpha added by filtering */
IMB_rectfill_alpha(ibuf, 1.0f);
}
@@ -2603,13 +2608,13 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
usemask = 1;
/* baker uses this flag to detect if image was initialized */
- for(ima= G.main->image.first; ima; ima= ima->id.next) {
+ for (ima= G.main->image.first; ima; ima= ima->id.next) {
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
ima->id.flag |= LIB_DOIT;
ima->flag&= ~IMA_USED_FOR_RENDER;
- if(ibuf) {
+ if (ibuf) {
ibuf->userdata = NULL; /* use for masking if needed */
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
ibuf->profile = IB_PROFILE_LINEAR_RGB;
}
}
@@ -2619,13 +2624,14 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
handles= MEM_callocN(sizeof(BakeShade)*re->r.threads, "BakeShade");
/* get the threads running */
- for(a=0; a<re->r.threads; a++) {
+ for (a=0; a<re->r.threads; a++) {
/* set defaults in handles */
handles[a].ssamp.shi[0].lay= re->lay;
if (type==RE_BAKE_SHADOW) {
handles[a].ssamp.shi[0].passflag= SCE_PASS_SHADOW;
- } else {
+ }
+ else {
handles[a].ssamp.shi[0].passflag= SCE_PASS_COMBINED;
}
handles[a].ssamp.shi[0].combinedflag= ~(SCE_PASS_SPEC);
@@ -2645,30 +2651,30 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
/* wait for everything to be done */
a= 0;
- while(a!=re->r.threads) {
+ while (a!=re->r.threads) {
PIL_sleep_ms(50);
/* calculate progress */
- for(vdone=0, a=0; a<re->r.threads; a++)
+ for (vdone=0, a=0; a<re->r.threads; a++)
vdone+= handles[a].vdone;
if (progress)
*progress = (float)(vdone / (float)re->totvlak);
- for(a=0; a<re->r.threads; a++) {
- if(handles[a].ready==0)
+ for (a=0; a<re->r.threads; a++) {
+ if (handles[a].ready==0)
break;
}
}
/* filter and refresh images */
- for(ima= G.main->image.first; ima; ima= ima->id.next) {
- if((ima->id.flag & LIB_DOIT)==0) {
+ for (ima= G.main->image.first; ima; ima= ima->id.next) {
+ if ((ima->id.flag & LIB_DOIT)==0) {
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- if(ima->flag & IMA_USED_FOR_RENDER)
+ if (ima->flag & IMA_USED_FOR_RENDER)
result= BAKE_RESULT_FEEDBACK_LOOP;
- if(!ibuf)
+ if (!ibuf)
continue;
RE_bake_ibuf_filter(ibuf, (char *)ibuf->userdata, re->r.bake_filter);
@@ -2679,7 +2685,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
}
/* calculate return value */
- for(a=0; a<re->r.threads; a++) {
+ for (a=0; a<re->r.threads; a++) {
zbuf_free_span(handles[a].zspan);
MEM_freeN(handles[a].zspan);
}
@@ -2688,7 +2694,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
BLI_end_threads(&threads);
- if(vdone==0)
+ if (vdone==0)
result= BAKE_RESULT_NO_OBJECTS;
return result;
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index c04daa11b3e..d238087cfb1 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -90,7 +90,7 @@
/* ------------------------------------------------------------------------- */
-/* More dynamic allocation of options for render vertices and faces, so we dont
+/* More dynamic allocation of options for render vertices and faces, so we don't
* have to reserve this space inside vertices.
* Important; vertices and faces, should have been created already (to get tables
* checked) that's a reason why the calls demand VertRen/VlakRen * as arg, not
@@ -120,8 +120,8 @@ float *RE_vertren_get_sticky(ObjectRen *obr, VertRen *ver, int verify)
int nr= ver->index>>8;
sticky= obr->vertnodes[nr].sticky;
- if(sticky==NULL) {
- if(verify)
+ if (sticky==NULL) {
+ if (verify)
sticky= obr->vertnodes[nr].sticky= MEM_mallocN(256*RE_STICKY_ELEMS*sizeof(float), "sticky table");
else
return NULL;
@@ -135,8 +135,8 @@ float *RE_vertren_get_stress(ObjectRen *obr, VertRen *ver, int verify)
int nr= ver->index>>8;
stress= obr->vertnodes[nr].stress;
- if(stress==NULL) {
- if(verify)
+ if (stress==NULL) {
+ if (verify)
stress= obr->vertnodes[nr].stress= MEM_mallocN(256*RE_STRESS_ELEMS*sizeof(float), "stress table");
else
return NULL;
@@ -151,8 +151,8 @@ float *RE_vertren_get_rad(ObjectRen *obr, VertRen *ver, int verify)
int nr= ver->index>>8;
rad= obr->vertnodes[nr].rad;
- if(rad==NULL) {
- if(verify)
+ if (rad==NULL) {
+ if (verify)
rad= obr->vertnodes[nr].rad= MEM_callocN(256*RE_RAD_ELEMS*sizeof(float), "rad table");
else
return NULL;
@@ -166,8 +166,8 @@ float *RE_vertren_get_strand(ObjectRen *obr, VertRen *ver, int verify)
int nr= ver->index>>8;
strand= obr->vertnodes[nr].strand;
- if(strand==NULL) {
- if(verify)
+ if (strand==NULL) {
+ if (verify)
strand= obr->vertnodes[nr].strand= MEM_mallocN(256*RE_STRAND_ELEMS*sizeof(float), "strand table");
else
return NULL;
@@ -182,8 +182,8 @@ float *RE_vertren_get_tangent(ObjectRen *obr, VertRen *ver, int verify)
int nr= ver->index>>8;
tangent= obr->vertnodes[nr].tangent;
- if(tangent==NULL) {
- if(verify)
+ if (tangent==NULL) {
+ if (verify)
tangent= obr->vertnodes[nr].tangent= MEM_callocN(256*RE_TANGENT_ELEMS*sizeof(float), "tangent table");
else
return NULL;
@@ -199,8 +199,8 @@ float *RE_vertren_get_winspeed(ObjectInstanceRen *obi, VertRen *ver, int verify)
int totvector;
winspeed= obi->vectors;
- if(winspeed==NULL) {
- if(verify) {
+ if (winspeed==NULL) {
+ if (verify) {
totvector= obi->obr->totvert + obi->obr->totstrand;
winspeed= obi->vectors= MEM_callocN(totvector*RE_WINSPEED_ELEMS*sizeof(float), "winspeed table");
}
@@ -220,27 +220,27 @@ VertRen *RE_vertren_copy(ObjectRen *obr, VertRen *ver)
v1->index= index;
fp1= RE_vertren_get_sticky(obr, ver, 0);
- if(fp1) {
+ if (fp1) {
fp2= RE_vertren_get_sticky(obr, v1, 1);
memcpy(fp2, fp1, RE_STICKY_ELEMS*sizeof(float));
}
fp1= RE_vertren_get_stress(obr, ver, 0);
- if(fp1) {
+ if (fp1) {
fp2= RE_vertren_get_stress(obr, v1, 1);
memcpy(fp2, fp1, RE_STRESS_ELEMS*sizeof(float));
}
fp1= RE_vertren_get_rad(obr, ver, 0);
- if(fp1) {
+ if (fp1) {
fp2= RE_vertren_get_rad(obr, v1, 1);
memcpy(fp2, fp1, RE_RAD_ELEMS*sizeof(float));
}
fp1= RE_vertren_get_strand(obr, ver, 0);
- if(fp1) {
+ if (fp1) {
fp2= RE_vertren_get_strand(obr, v1, 1);
memcpy(fp2, fp1, RE_STRAND_ELEMS*sizeof(float));
}
fp1= RE_vertren_get_tangent(obr, ver, 0);
- if(fp1) {
+ if (fp1) {
fp2= RE_vertren_get_tangent(obr, v1, 1);
memcpy(fp2, fp1, RE_TANGENT_ELEMS*sizeof(float));
}
@@ -253,7 +253,7 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
VertRen *v;
int a;
- if(nr<0) {
+ if (nr<0) {
printf("error in findOrAddVert: %d\n",nr);
return NULL;
}
@@ -263,21 +263,21 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
temp= obr->vertnodes;
obr->vertnodes= MEM_mallocN(sizeof(VertTableNode)*(obr->vertnodeslen+TABLEINITSIZE) , "vertnodes");
- if(temp) memcpy(obr->vertnodes, temp, obr->vertnodeslen*sizeof(VertTableNode));
+ if (temp) memcpy(obr->vertnodes, temp, obr->vertnodeslen*sizeof(VertTableNode));
memset(obr->vertnodes+obr->vertnodeslen, 0, TABLEINITSIZE*sizeof(VertTableNode));
obr->vertnodeslen+=TABLEINITSIZE;
- if(temp) MEM_freeN(temp);
+ if (temp) MEM_freeN(temp);
}
v= obr->vertnodes[a].vert;
- if(v==NULL) {
+ if (v==NULL) {
int i;
v= (VertRen *)MEM_callocN(256*sizeof(VertRen),"findOrAddVert");
obr->vertnodes[a].vert= v;
- for(i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++) {
+ for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++) {
v[a].index= i;
}
}
@@ -295,14 +295,14 @@ MTFace *RE_vlakren_get_tface(ObjectRen *obr, VlakRen *vlr, int n, char **name, i
node= &obr->vlaknodes[nr];
- if(verify) {
- if(n>=node->totmtface) {
+ if (verify) {
+ if (n>=node->totmtface) {
MTFace *mtface= node->mtface;
int size= (n+1)*256;
node->mtface= MEM_callocN(size*sizeof(MTFace), "Vlak mtface");
- if(mtface) {
+ if (mtface) {
size= node->totmtface*256;
memcpy(node->mtface, mtface, size*sizeof(MTFace));
MEM_freeN(mtface);
@@ -312,10 +312,10 @@ MTFace *RE_vlakren_get_tface(ObjectRen *obr, VlakRen *vlr, int n, char **name, i
}
}
else {
- if(n>=node->totmtface)
+ if (n>=node->totmtface)
return NULL;
- if(name) *name= obr->mtface[n];
+ if (name) *name= obr->mtface[n];
}
return node->mtface + index;
@@ -329,14 +329,14 @@ MCol *RE_vlakren_get_mcol(ObjectRen *obr, VlakRen *vlr, int n, char **name, int
node= &obr->vlaknodes[nr];
- if(verify) {
- if(n>=node->totmcol) {
+ if (verify) {
+ if (n>=node->totmcol) {
MCol *mcol= node->mcol;
int size= (n+1)*256;
node->mcol= MEM_callocN(size*sizeof(MCol)*RE_MCOL_ELEMS, "Vlak mcol");
- if(mcol) {
+ if (mcol) {
size= node->totmcol*256;
memcpy(node->mcol, mcol, size*sizeof(MCol)*RE_MCOL_ELEMS);
MEM_freeN(mcol);
@@ -346,10 +346,10 @@ MCol *RE_vlakren_get_mcol(ObjectRen *obr, VlakRen *vlr, int n, char **name, int
}
}
else {
- if(n>=node->totmcol)
+ if (n>=node->totmcol)
return NULL;
- if(name) *name= obr->mcol[n];
+ if (name) *name= obr->mcol[n];
}
return node->mcol + index*RE_MCOL_ELEMS;
@@ -361,8 +361,8 @@ float *RE_vlakren_get_surfnor(ObjectRen *obr, VlakRen *vlak, int verify)
int nr= vlak->index>>8;
surfnor= obr->vlaknodes[nr].surfnor;
- if(surfnor==NULL) {
- if(verify)
+ if (surfnor==NULL) {
+ if (verify)
surfnor= obr->vlaknodes[nr].surfnor= MEM_callocN(256*RE_SURFNOR_ELEMS*sizeof(float), "surfnor table");
else
return NULL;
@@ -376,8 +376,8 @@ float *RE_vlakren_get_nmap_tangent(ObjectRen *obr, VlakRen *vlak, int verify)
int nr= vlak->index>>8;
tangent= obr->vlaknodes[nr].tangent;
- if(tangent==NULL) {
- if(verify)
+ if (tangent==NULL) {
+ if (verify)
tangent= obr->vlaknodes[nr].tangent= MEM_callocN(256*RE_NMAP_TANGENT_ELEMS*sizeof(float), "tangent table");
else
return NULL;
@@ -391,8 +391,8 @@ RadFace **RE_vlakren_get_radface(ObjectRen *obr, VlakRen *vlak, int verify)
int nr= vlak->index>>8;
radface= obr->vlaknodes[nr].radface;
- if(radface==NULL) {
- if(verify)
+ if (radface==NULL) {
+ if (verify)
radface= obr->vlaknodes[nr].radface= MEM_callocN(256*RE_RADFACE_ELEMS*sizeof(void*), "radface table");
else
return NULL;
@@ -424,19 +424,19 @@ VlakRen *RE_vlakren_copy(ObjectRen *obr, VlakRen *vlr)
}
surfnor= RE_vlakren_get_surfnor(obr, vlr, 0);
- if(surfnor) {
+ if (surfnor) {
surfnor1= RE_vlakren_get_surfnor(obr, vlr1, 1);
copy_v3_v3(surfnor1, surfnor);
}
tangent= RE_vlakren_get_nmap_tangent(obr, vlr, 0);
- if(tangent) {
+ if (tangent) {
tangent1= RE_vlakren_get_nmap_tangent(obr, vlr1, 1);
memcpy(tangent1, tangent, sizeof(float)*RE_NMAP_TANGENT_ELEMS);
}
radface= RE_vlakren_get_radface(obr, vlr, 0);
- if(radface) {
+ if (radface) {
radface1= RE_vlakren_get_radface(obr, vlr1, 1);
*radface1= *radface;
}
@@ -448,7 +448,7 @@ void RE_vlakren_get_normal(Render *UNUSED(re), ObjectInstanceRen *obi, VlakRen *
{
float (*nmat)[3]= obi->nmat;
- if(obi->flag & R_TRANSFORMED) {
+ if (obi->flag & R_TRANSFORMED) {
mul_v3_m3v3(nor, nmat, vlr->n);
normalize_v3(nor);
}
@@ -496,32 +496,32 @@ VlakRen *RE_findOrAddVlak(ObjectRen *obr, int nr)
VlakRen *v;
int a;
- if(nr<0) {
+ if (nr<0) {
printf("error in findOrAddVlak: %d\n",nr);
return obr->vlaknodes[0].vlak;
}
a= nr>>8;
- if (a>=obr->vlaknodeslen-1){ /* Need to allocate more columns..., and keep last element NULL for free loop */
+ if (a>=obr->vlaknodeslen-1) { /* Need to allocate more columns..., and keep last element NULL for free loop */
temp= obr->vlaknodes;
obr->vlaknodes= MEM_mallocN(sizeof(VlakTableNode)*(obr->vlaknodeslen+TABLEINITSIZE) , "vlaknodes");
- if(temp) memcpy(obr->vlaknodes, temp, obr->vlaknodeslen*sizeof(VlakTableNode));
+ if (temp) memcpy(obr->vlaknodes, temp, obr->vlaknodeslen*sizeof(VlakTableNode));
memset(obr->vlaknodes+obr->vlaknodeslen, 0, TABLEINITSIZE*sizeof(VlakTableNode));
obr->vlaknodeslen+=TABLEINITSIZE; /*Does this really need to be power of 2?*/
- if(temp) MEM_freeN(temp);
+ if (temp) MEM_freeN(temp);
}
v= obr->vlaknodes[a].vlak;
- if(v==NULL) {
+ if (v==NULL) {
int i;
v= (VlakRen *)MEM_callocN(256*sizeof(VlakRen),"findOrAddVlak");
obr->vlaknodes[a].vlak= v;
- for(i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
+ for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
v[a].index= i;
}
v+= (nr & 255);
@@ -536,8 +536,8 @@ float *RE_strandren_get_surfnor(ObjectRen *obr, StrandRen *strand, int verify)
int nr= strand->index>>8;
surfnor= obr->strandnodes[nr].surfnor;
- if(surfnor==NULL) {
- if(verify)
+ if (surfnor==NULL) {
+ if (verify)
surfnor= obr->strandnodes[nr].surfnor= MEM_callocN(256*RE_SURFNOR_ELEMS*sizeof(float), "surfnor strand table");
else
return NULL;
@@ -553,14 +553,14 @@ float *RE_strandren_get_uv(ObjectRen *obr, StrandRen *strand, int n, char **name
node= &obr->strandnodes[nr];
- if(verify) {
- if(n>=node->totuv) {
+ if (verify) {
+ if (n>=node->totuv) {
float *uv= node->uv;
int size= (n+1)*256;
node->uv= MEM_callocN(size*sizeof(float)*RE_UV_ELEMS, "strand uv table");
- if(uv) {
+ if (uv) {
size= node->totuv*256;
memcpy(node->uv, uv, size*sizeof(float)*RE_UV_ELEMS);
MEM_freeN(uv);
@@ -570,10 +570,10 @@ float *RE_strandren_get_uv(ObjectRen *obr, StrandRen *strand, int n, char **name
}
}
else {
- if(n>=node->totuv)
+ if (n>=node->totuv)
return NULL;
- if(name) *name= obr->mtface[n];
+ if (name) *name= obr->mtface[n];
}
return node->uv + index*RE_UV_ELEMS;
@@ -587,14 +587,14 @@ MCol *RE_strandren_get_mcol(ObjectRen *obr, StrandRen *strand, int n, char **nam
node= &obr->strandnodes[nr];
- if(verify) {
- if(n>=node->totmcol) {
+ if (verify) {
+ if (n>=node->totmcol) {
MCol *mcol= node->mcol;
int size= (n+1)*256;
node->mcol= MEM_callocN(size*sizeof(MCol)*RE_MCOL_ELEMS, "strand mcol table");
- if(mcol) {
+ if (mcol) {
size= node->totmcol*256;
memcpy(node->mcol, mcol, size*sizeof(MCol)*RE_MCOL_ELEMS);
MEM_freeN(mcol);
@@ -604,10 +604,10 @@ MCol *RE_strandren_get_mcol(ObjectRen *obr, StrandRen *strand, int n, char **nam
}
}
else {
- if(n>=node->totmcol)
+ if (n>=node->totmcol)
return NULL;
- if(name) *name= obr->mcol[n];
+ if (name) *name= obr->mcol[n];
}
return node->mcol + index*RE_MCOL_ELEMS;
@@ -619,8 +619,8 @@ float *RE_strandren_get_simplify(struct ObjectRen *obr, struct StrandRen *strand
int nr= strand->index>>8;
simplify= obr->strandnodes[nr].simplify;
- if(simplify==NULL) {
- if(verify)
+ if (simplify==NULL) {
+ if (verify)
simplify= obr->strandnodes[nr].simplify= MEM_callocN(256*RE_SIMPLIFY_ELEMS*sizeof(float), "simplify strand table");
else
return NULL;
@@ -634,8 +634,8 @@ int *RE_strandren_get_face(ObjectRen *obr, StrandRen *strand, int verify)
int nr= strand->index>>8;
face= obr->strandnodes[nr].face;
- if(face==NULL) {
- if(verify)
+ if (face==NULL) {
+ if (verify)
face= obr->strandnodes[nr].face= MEM_callocN(256*RE_FACE_ELEMS*sizeof(int), "face strand table");
else
return NULL;
@@ -650,8 +650,8 @@ float *RE_strandren_get_winspeed(ObjectInstanceRen *obi, StrandRen *strand, int
int totvector;
winspeed= obi->vectors;
- if(winspeed==NULL) {
- if(verify) {
+ if (winspeed==NULL) {
+ if (verify) {
totvector= obi->obr->totvert + obi->obr->totstrand;
winspeed= obi->vectors= MEM_callocN(totvector*RE_WINSPEED_ELEMS*sizeof(float), "winspeed strand table");
}
@@ -667,32 +667,32 @@ StrandRen *RE_findOrAddStrand(ObjectRen *obr, int nr)
StrandRen *v;
int a;
- if(nr<0) {
+ if (nr<0) {
printf("error in findOrAddStrand: %d\n",nr);
return obr->strandnodes[0].strand;
}
a= nr>>8;
- if (a>=obr->strandnodeslen-1){ /* Need to allocate more columns..., and keep last element NULL for free loop */
+ if (a>=obr->strandnodeslen-1) { /* Need to allocate more columns..., and keep last element NULL for free loop */
temp= obr->strandnodes;
obr->strandnodes= MEM_mallocN(sizeof(StrandTableNode)*(obr->strandnodeslen+TABLEINITSIZE) , "strandnodes");
- if(temp) memcpy(obr->strandnodes, temp, obr->strandnodeslen*sizeof(StrandTableNode));
+ if (temp) memcpy(obr->strandnodes, temp, obr->strandnodeslen*sizeof(StrandTableNode));
memset(obr->strandnodes+obr->strandnodeslen, 0, TABLEINITSIZE*sizeof(StrandTableNode));
obr->strandnodeslen+=TABLEINITSIZE; /*Does this really need to be power of 2?*/
- if(temp) MEM_freeN(temp);
+ if (temp) MEM_freeN(temp);
}
v= obr->strandnodes[a].strand;
- if(v==NULL) {
+ if (v==NULL) {
int i;
v= (StrandRen *)MEM_callocN(256*sizeof(StrandRen),"findOrAddStrand");
obr->strandnodes[a].strand= v;
- for(i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
+ for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
v[a].index= i;
}
v+= (nr & 255);
@@ -733,22 +733,22 @@ void free_renderdata_vertnodes(VertTableNode *vertnodes)
{
int a;
- if(vertnodes==NULL) return;
+ if (vertnodes==NULL) return;
- for(a=0; vertnodes[a].vert; a++) {
+ for (a=0; vertnodes[a].vert; a++) {
MEM_freeN(vertnodes[a].vert);
- if(vertnodes[a].rad)
+ if (vertnodes[a].rad)
MEM_freeN(vertnodes[a].rad);
- if(vertnodes[a].sticky)
+ if (vertnodes[a].sticky)
MEM_freeN(vertnodes[a].sticky);
- if(vertnodes[a].strand)
+ if (vertnodes[a].strand)
MEM_freeN(vertnodes[a].strand);
- if(vertnodes[a].tangent)
+ if (vertnodes[a].tangent)
MEM_freeN(vertnodes[a].tangent);
- if(vertnodes[a].stress)
+ if (vertnodes[a].stress)
MEM_freeN(vertnodes[a].stress);
- if(vertnodes[a].winspeed)
+ if (vertnodes[a].winspeed)
MEM_freeN(vertnodes[a].winspeed);
}
@@ -759,20 +759,20 @@ void free_renderdata_vlaknodes(VlakTableNode *vlaknodes)
{
int a;
- if(vlaknodes==NULL) return;
+ if (vlaknodes==NULL) return;
- for(a=0; vlaknodes[a].vlak; a++) {
+ for (a=0; vlaknodes[a].vlak; a++) {
MEM_freeN(vlaknodes[a].vlak);
- if(vlaknodes[a].mtface)
+ if (vlaknodes[a].mtface)
MEM_freeN(vlaknodes[a].mtface);
- if(vlaknodes[a].mcol)
+ if (vlaknodes[a].mcol)
MEM_freeN(vlaknodes[a].mcol);
- if(vlaknodes[a].surfnor)
+ if (vlaknodes[a].surfnor)
MEM_freeN(vlaknodes[a].surfnor);
- if(vlaknodes[a].tangent)
+ if (vlaknodes[a].tangent)
MEM_freeN(vlaknodes[a].tangent);
- if(vlaknodes[a].radface)
+ if (vlaknodes[a].radface)
MEM_freeN(vlaknodes[a].radface);
}
@@ -783,22 +783,22 @@ static void free_renderdata_strandnodes(StrandTableNode *strandnodes)
{
int a;
- if(strandnodes==NULL) return;
+ if (strandnodes==NULL) return;
- for(a=0; strandnodes[a].strand; a++) {
+ for (a=0; strandnodes[a].strand; a++) {
MEM_freeN(strandnodes[a].strand);
- if(strandnodes[a].uv)
+ if (strandnodes[a].uv)
MEM_freeN(strandnodes[a].uv);
- if(strandnodes[a].mcol)
+ if (strandnodes[a].mcol)
MEM_freeN(strandnodes[a].mcol);
- if(strandnodes[a].winspeed)
+ if (strandnodes[a].winspeed)
MEM_freeN(strandnodes[a].winspeed);
- if(strandnodes[a].surfnor)
+ if (strandnodes[a].surfnor)
MEM_freeN(strandnodes[a].surfnor);
- if(strandnodes[a].simplify)
+ if (strandnodes[a].simplify)
MEM_freeN(strandnodes[a].simplify);
- if(strandnodes[a].face)
+ if (strandnodes[a].face)
MEM_freeN(strandnodes[a].face);
}
@@ -812,7 +812,7 @@ void free_renderdata_tables(Render *re)
StrandBuffer *strandbuf;
int a=0;
- for(obr=re->objecttable.first; obr; obr=obr->next) {
+ for (obr=re->objecttable.first; obr; obr=obr->next) {
if (obr->vertnodes) {
free_renderdata_vertnodes(obr->vertnodes);
obr->vertnodes= NULL;
@@ -827,7 +827,7 @@ void free_renderdata_tables(Render *re)
}
if (obr->bloha) {
- for(a=0; obr->bloha[a]; a++)
+ for (a=0; obr->bloha[a]; a++)
MEM_freeN(obr->bloha[a]);
MEM_freeN(obr->bloha);
@@ -842,9 +842,9 @@ void free_renderdata_tables(Render *re)
}
strandbuf= obr->strandbuf;
- if(strandbuf) {
- if(strandbuf->vert) MEM_freeN(strandbuf->vert);
- if(strandbuf->bound) MEM_freeN(strandbuf->bound);
+ if (strandbuf) {
+ if (strandbuf->vert) MEM_freeN(strandbuf->vert);
+ if (strandbuf->bound) MEM_freeN(strandbuf->bound);
MEM_freeN(strandbuf);
}
@@ -870,13 +870,13 @@ void free_renderdata_tables(Render *re)
}
}
- if(re->objectinstance) {
- for(obi=re->instancetable.first; obi; obi=obi->next)
+ if (re->objectinstance) {
+ for (obi=re->instancetable.first; obi; obi=obi->next)
{
- if(obi->vectors)
+ if (obi->vectors)
MEM_freeN(obi->vectors);
- if(obi->raytree)
+ if (obi->raytree)
RE_rayobject_free(obi->raytree);
}
@@ -886,7 +886,7 @@ void free_renderdata_tables(Render *re)
re->instancetable.first= re->instancetable.last= NULL;
}
- if(re->sortedhalos) {
+ if (re->sortedhalos) {
MEM_freeN(re->sortedhalos);
re->sortedhalos= NULL;
}
@@ -903,26 +903,26 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
HaloRen *h, **temp;
int a;
- if(nr<0) {
+ if (nr<0) {
printf("error in findOrAddHalo: %d\n",nr);
return NULL;
}
a= nr>>8;
- if (a>=obr->blohalen-1){ /* Need to allocate more columns..., and keep last element NULL for free loop */
+ if (a>=obr->blohalen-1) { /* Need to allocate more columns..., and keep last element NULL for free loop */
//printf("Allocating %i more halo groups. %i total.\n",
// TABLEINITSIZE, obr->blohalen+TABLEINITSIZE );
temp=obr->bloha;
obr->bloha=(HaloRen**)MEM_callocN(sizeof(void*)*(obr->blohalen+TABLEINITSIZE) , "Bloha");
- if(temp) memcpy(obr->bloha, temp, obr->blohalen*sizeof(void*));
+ if (temp) memcpy(obr->bloha, temp, obr->blohalen*sizeof(void*));
memset(&(obr->bloha[obr->blohalen]), 0, TABLEINITSIZE*sizeof(void*));
obr->blohalen+=TABLEINITSIZE; /*Does this really need to be power of 2?*/
- if(temp) MEM_freeN(temp);
+ if (temp) MEM_freeN(temp);
}
h= obr->bloha[a];
- if(h==NULL) {
+ if (h==NULL) {
h= (HaloRen *)MEM_callocN(256*sizeof(HaloRen),"findOrAdHalo");
obr->bloha[a]= h;
}
@@ -940,13 +940,13 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f
float tin, tr, tg, tb, ta;
float xn, yn, zn, texvec[3], hoco[4], hoco1[4];
- if(hasize==0.0f) return NULL;
+ if (hasize==0.0f) return NULL;
projectverto(vec, re->winmat, hoco);
- if(hoco[3]==0.0f) return NULL;
- if(vec1) {
+ if (hoco[3]==0.0f) return NULL;
+ if (vec1) {
projectverto(vec1, re->winmat, hoco1);
- if(hoco1[3]==0.0f) return NULL;
+ if (hoco1[3]==0.0f) return NULL;
}
har= RE_findOrAddHalo(obr, obr->tothalo++);
@@ -963,13 +963,13 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f
har->zBufDist = 0x7FFFFFFF*(hoco[2]/zn);
/* halovect */
- if(vec1) {
+ if (vec1) {
har->type |= HA_VECT;
xn= har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]);
yn= har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]);
- if(xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0f;
+ if (xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0f;
else zn= atan2(yn, xn);
har->sin= sin(zn);
@@ -982,7 +982,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f
normalize_v3(har->no);
}
- if(ma->mode & MA_HALO_XALPHA) har->type |= HA_XALPHA;
+ if (ma->mode & MA_HALO_XALPHA) har->type |= HA_XALPHA;
har->alfa= ma->alpha;
har->r= ma->r;
@@ -993,32 +993,32 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f
har->hard= ma->har;
har->seed= seed % 256;
- if(ma->mode & MA_STAR) har->starpoints= ma->starc;
- if(ma->mode & MA_HALO_LINES) har->linec= ma->linec;
- if(ma->mode & MA_HALO_RINGS) har->ringc= ma->ringc;
- if(ma->mode & MA_HALO_FLARE) har->flarec= ma->flarec;
+ if (ma->mode & MA_STAR) har->starpoints= ma->starc;
+ if (ma->mode & MA_HALO_LINES) har->linec= ma->linec;
+ if (ma->mode & MA_HALO_RINGS) har->ringc= ma->ringc;
+ if (ma->mode & MA_HALO_FLARE) har->flarec= ma->flarec;
- if(ma->mtex[0]) {
+ if (ma->mtex[0]) {
- if( (ma->mode & MA_HALOTEX) ) har->tex= 1;
- else if(har->mat->septex & (1<<0)); /* only 1 level textures */
+ if ( (ma->mode & MA_HALOTEX) ) har->tex= 1;
+ else if (har->mat->septex & (1<<0)); /* only 1 level textures */
else {
mtex= ma->mtex[0];
copy_v3_v3(texvec, vec);
- if(mtex->texco & TEXCO_NORM) {
+ if (mtex->texco & TEXCO_NORM) {
;
}
- else if(mtex->texco & TEXCO_OBJECT) {
+ else if (mtex->texco & TEXCO_OBJECT) {
/* texvec[0]+= imatbase->ivec[0]; */
/* texvec[1]+= imatbase->ivec[1]; */
/* texvec[2]+= imatbase->ivec[2]; */
/* mul_m3_v3(imatbase->imat, texvec); */
}
else {
- if(orco) {
+ if (orco) {
copy_v3_v3(texvec, orco);
}
}
@@ -1028,16 +1028,16 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f
yn= tin*mtex->colfac;
//zn= tin*mtex->alphafac;
- if(mtex->mapto & MAP_COL) {
+ if (mtex->mapto & MAP_COL) {
zn= 1.0f-yn;
har->r= (yn*tr+ zn*ma->r);
har->g= (yn*tg+ zn*ma->g);
har->b= (yn*tb+ zn*ma->b);
}
- if(mtex->texco & TEXCO_UV) {
+ if (mtex->texco & TEXCO_UV) {
har->alfa= tin;
}
- if(mtex->mapto & MAP_ALPHA)
+ if (mtex->mapto & MAP_ALPHA)
har->alfa= tin;
}
}
@@ -1054,13 +1054,13 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
float xn, yn, zn, texvec[3], hoco[4], hoco1[4], in[3],tex[3],out[3];
int i, hasrgb;
- if(hasize==0.0f) return NULL;
+ if (hasize==0.0f) return NULL;
projectverto(vec, re->winmat, hoco);
- if(hoco[3]==0.0f) return NULL;
- if(vec1) {
+ if (hoco[3]==0.0f) return NULL;
+ if (vec1) {
projectverto(vec1, re->winmat, hoco1);
- if(hoco1[3]==0.0f) return NULL;
+ if (hoco1[3]==0.0f) return NULL;
}
har= RE_findOrAddHalo(obr, obr->tothalo++);
@@ -1077,13 +1077,13 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
har->zBufDist = 0x7FFFFFFF*(hoco[2]/zn);
/* halovect */
- if(vec1) {
+ if (vec1) {
har->type |= HA_VECT;
xn= har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]);
yn= har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]);
- if(xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0;
+ if (xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0;
else zn= atan2(yn, xn);
har->sin= sin(zn);
@@ -1096,7 +1096,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
normalize_v3(har->no);
}
- if(ma->mode & MA_HALO_XALPHA) har->type |= HA_XALPHA;
+ if (ma->mode & MA_HALO_XALPHA) har->type |= HA_XALPHA;
har->alfa= ma->alpha;
har->r= ma->r;
@@ -1107,32 +1107,32 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
har->hard= ma->har;
har->seed= seed % 256;
- if(ma->mode & MA_STAR) har->starpoints= ma->starc;
- if(ma->mode & MA_HALO_LINES) har->linec= ma->linec;
- if(ma->mode & MA_HALO_RINGS) har->ringc= ma->ringc;
- if(ma->mode & MA_HALO_FLARE) har->flarec= ma->flarec;
+ if (ma->mode & MA_STAR) har->starpoints= ma->starc;
+ if (ma->mode & MA_HALO_LINES) har->linec= ma->linec;
+ if (ma->mode & MA_HALO_RINGS) har->ringc= ma->ringc;
+ if (ma->mode & MA_HALO_FLARE) har->flarec= ma->flarec;
- if((ma->mode & MA_HALOTEX) && ma->mtex[0])
+ if ((ma->mode & MA_HALOTEX) && ma->mtex[0])
har->tex= 1;
- for(i=0; i<MAX_MTEX; i++)
- if(ma->mtex[i] && (ma->septex & (1<<i))==0) {
+ for (i=0; i<MAX_MTEX; i++)
+ if (ma->mtex[i] && (ma->septex & (1<<i))==0) {
mtex= ma->mtex[i];
copy_v3_v3(texvec, vec);
- if(mtex->texco & TEXCO_NORM) {
+ if (mtex->texco & TEXCO_NORM) {
;
}
- else if(mtex->texco & TEXCO_OBJECT) {
- if(mtex->object)
+ else if (mtex->texco & TEXCO_OBJECT) {
+ if (mtex->object)
mul_m4_v3(mtex->object->imat_ren,texvec);
}
- else if(mtex->texco & TEXCO_GLOB){
+ else if (mtex->texco & TEXCO_GLOB) {
copy_v3_v3(texvec,vec);
}
- else if(mtex->texco & TEXCO_UV && uvco){
+ else if (mtex->texco & TEXCO_UV && uvco) {
int uv_index=CustomData_get_named_layer_index(&dm->faceData,CD_MTFACE,mtex->uvname);
- if(uv_index<0)
+ if (uv_index<0)
uv_index=CustomData_get_active_layer_index(&dm->faceData,CD_MTFACE);
uv_index-=CustomData_get_layer_index(&dm->faceData,CD_MTFACE);
@@ -1141,13 +1141,13 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
texvec[1]=2.0f*uvco[2*uv_index+1]-1.0f;
texvec[2]=0.0f;
}
- else if(mtex->texco & TEXCO_PARTICLE) {
+ else if (mtex->texco & TEXCO_PARTICLE) {
/* particle coordinates in range [0,1] */
texvec[0] = 2.f * pa_co[0] - 1.f;
texvec[1] = 2.f * pa_co[1] - 1.f;
texvec[2] = pa_co[2];
}
- else if(orco) {
+ else if (orco) {
copy_v3_v3(texvec, orco);
}
@@ -1155,7 +1155,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
//yn= tin*mtex->colfac;
//zn= tin*mtex->alphafac;
- if(mtex->mapto & MAP_COL) {
+ if (mtex->mapto & MAP_COL) {
tex[0]=tr;
tex[1]=tg;
tex[2]=tb;
@@ -1174,16 +1174,16 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
}
/* alpha returned, so let's use it instead of intensity */
- if(hasrgb)
+ if (hasrgb)
tin = ta;
- if(mtex->mapto & MAP_ALPHA)
+ if (mtex->mapto & MAP_ALPHA)
har->alfa = texture_value_blend(mtex->def_var,har->alfa,tin,mtex->alphafac,mtex->blendtype);
- if(mtex->mapto & MAP_HAR)
+ if (mtex->mapto & MAP_HAR)
har->hard = 1.0f+126.0f*texture_value_blend(mtex->def_var,((float)har->hard)/127.0f,tin,mtex->hardfac,mtex->blendtype);
- if(mtex->mapto & MAP_RAYMIRR)
+ if (mtex->mapto & MAP_RAYMIRR)
har->hasize = 100.0f*texture_value_blend(mtex->def_var,har->hasize/100.0f,tin,mtex->raymirrfac,mtex->blendtype);
- if(mtex->mapto & MAP_TRANSLU) {
+ if (mtex->mapto & MAP_TRANSLU) {
float add = texture_value_blend(mtex->def_var,(float)har->add/255.0f,tin,mtex->translfac,mtex->blendtype);
CLAMP(add, 0.f, 1.f);
har->add = 255.0f*add;
@@ -1206,19 +1206,19 @@ static int panotestclip(Render *re, int do_pano, float *v)
float abs4;
short c=0;
- if(do_pano==0) return testclip(v);
+ if (do_pano==0) return testclip(v);
abs4= fabs(v[3]);
- if(v[2]< -abs4) c=16; /* this used to be " if(v[2]<0) ", see clippz() */
- else if(v[2]> abs4) c+= 32;
+ if (v[2]< -abs4) c=16; /* this used to be " if (v[2]<0) ", see clippz() */
+ else if (v[2]> abs4) c+= 32;
- if( v[1]>abs4) c+=4;
- else if( v[1]< -abs4) c+=8;
+ if ( v[1]>abs4) c+=4;
+ else if ( v[1]< -abs4) c+=8;
abs4*= re->xparts;
- if( v[0]>abs4) c+=2;
- else if( v[0]< -abs4) c+=1;
+ if ( v[0]>abs4) c+=2;
+ else if ( v[0]< -abs4) c+=1;
return c;
}
@@ -1240,20 +1240,20 @@ void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat
float zn, vec[3], hoco[4];
int a;
- if(do_pano) {
+ if (do_pano) {
float panophi= xoffs;
re->panosi= sin(panophi);
re->panoco= cos(panophi);
}
- for(obr=re->objecttable.first; obr; obr=obr->next) {
+ for (obr=re->objecttable.first; obr; obr=obr->next) {
/* calculate view coordinates (and zbuffer value) */
- for(a=0; a<obr->tothalo; a++) {
- if((a & 255)==0) har= obr->bloha[a>>8];
+ for (a=0; a<obr->tothalo; a++) {
+ if ((a & 255)==0) har= obr->bloha[a>>8];
else har++;
- if(do_pano) {
+ if (do_pano) {
vec[0]= re->panoco*har->co[0] + re->panosi*har->co[2];
vec[1]= har->co[1];
vec[2]= -re->panosi*har->co[0] + re->panoco*har->co[2];
@@ -1268,10 +1268,10 @@ void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat
hoco[0]*= 0.5f;
hoco[1]*= 0.5f;
- if( panotestclip(re, do_pano, hoco) ) {
+ if ( panotestclip(re, do_pano, hoco) ) {
har->miny= har->maxy= -10000; /* that way render clips it */
}
- else if(hoco[3]<0.0f) {
+ else if (hoco[3]<0.0f) {
har->miny= har->maxy= -10000; /* render clips it */
}
else /* do the projection...*/
@@ -1296,8 +1296,8 @@ void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat
har->rad= fabsf(har->xs- 0.5f*re->winx*(1.0f+hoco[0]/zn));
/* this clip is not really OK, to prevent stars to become too large */
- if(har->type & HA_ONLYSKY) {
- if(har->rad>3.0f) har->rad= 3.0f;
+ if (har->type & HA_ONLYSKY) {
+ if (har->rad>3.0f) har->rad= 3.0f;
}
har->radsq= har->rad*har->rad;
@@ -1334,7 +1334,7 @@ ObjectInstanceRen *RE_addRenderInstance(Render *re, ObjectRen *obr, Object *ob,
obi->psysindex= psysindex;
obi->lay= lay;
- if(mat) {
+ if (mat) {
copy_m4_m4(obi->mat, mat);
copy_m3_m4(mat3, mat);
invert_m3_m3(obi->nmat, mat3);
@@ -1360,10 +1360,10 @@ void RE_makeRenderInstances(Render *re)
newlist.first= newlist.last= NULL;
obi= re->objectinstance;
- for(oldobi=re->instancetable.first; oldobi; oldobi=oldobi->next) {
+ for (oldobi=re->instancetable.first; oldobi; oldobi=oldobi->next) {
*obi= *oldobi;
- if(obi->obr) {
+ if (obi->obr) {
obi->prev= obi->next= NULL;
BLI_addtail(&newlist, obi);
obi++;
@@ -1383,7 +1383,7 @@ int clip_render_object(float boundbox[][3], float *bounds, float winmat[][4])
copy_m4_m4(mat, winmat);
- for(a=0; a<8; a++) {
+ for (a=0; a<8; a++) {
vec[0]= (a & 1)? boundbox[0][0]: boundbox[1][0];
vec[1]= (a & 2)? boundbox[0][1]: boundbox[1][1];
vec[2]= (a & 4)? boundbox[0][2]: boundbox[1][2];
@@ -1391,25 +1391,25 @@ int clip_render_object(float boundbox[][3], float *bounds, float winmat[][4])
mul_m4_v4(mat, vec);
fl= 0;
- if(bounds) {
- if(vec[0] < bounds[0]*vec[3]) fl |= 1;
- else if(vec[0] > bounds[1]*vec[3]) fl |= 2;
+ if (bounds) {
+ if (vec[0] < bounds[0]*vec[3]) fl |= 1;
+ else if (vec[0] > bounds[1]*vec[3]) fl |= 2;
- if(vec[1] > bounds[3]*vec[3]) fl |= 4;
- else if(vec[1]< bounds[2]*vec[3]) fl |= 8;
+ if (vec[1] > bounds[3]*vec[3]) fl |= 4;
+ else if (vec[1]< bounds[2]*vec[3]) fl |= 8;
}
else {
- if(vec[0] < -vec[3]) fl |= 1;
- else if(vec[0] > vec[3]) fl |= 2;
+ if (vec[0] < -vec[3]) fl |= 1;
+ else if (vec[0] > vec[3]) fl |= 2;
- if(vec[1] > vec[3]) fl |= 4;
- else if(vec[1] < -vec[3]) fl |= 8;
+ if (vec[1] > vec[3]) fl |= 4;
+ else if (vec[1] < -vec[3]) fl |= 8;
}
- if(vec[2] < -vec[3]) fl |= 16;
- else if(vec[2] > vec[3]) fl |= 32;
+ if (vec[2] < -vec[3]) fl |= 16;
+ else if (vec[2] > vec[3]) fl |= 32;
flag &= fl;
- if(flag==0) return 0;
+ if (flag==0) return 0;
}
return flag;
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 3ef62f7b383..742d28d89b7 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -91,14 +91,14 @@ static void copy_to_ztile(int *rectz, int size, int x1, int y1, int tile, char *
x2= x1+tile;
y2= y1+tile;
- if(x2>=size) x2= size-1;
- if(y2>=size) y2= size-1;
+ if (x2>=size) x2= size-1;
+ if (y2>=size) y2= size-1;
- if(x1>=x2 || y1>=y2) return;
+ if (x1>=x2 || y1>=y2) return;
len4= 4*(x2- x1);
rz= rectz + size*y1 + x1;
- for(; y1<y2; y1++) {
+ for (; y1<y2; y1++) {
memcpy(r1, rz, len4);
rz+= size;
r1+= len4;
@@ -132,12 +132,12 @@ static float *give_jitter_tab(int samp)
static char ctab[17]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int a, offset=0;
- if(samp<2) samp= 2;
- else if(samp>16) samp= 16;
+ if (samp<2) samp= 2;
+ else if (samp>16) samp= 16;
- for(a=0; a<samp-1; a++) offset+= tab[a];
+ for (a=0; a<samp-1; a++) offset+= tab[a];
- if(ctab[samp]==0) {
+ if (ctab[samp]==0) {
ctab[samp]= 1;
BLI_initjit(jit[offset], samp*samp);
}
@@ -154,10 +154,10 @@ static void make_jitter_weight_tab(Render *re, ShadBuf *shb, short filtertype)
shb->weight= MEM_mallocN(sizeof(float)*tot, "weight tab lamp");
- for(jit= shb->jit, a=0; a<tot; a++, jit+=2) {
- if(filtertype==LA_SHADBUF_TENT)
+ for (jit= shb->jit, a=0; a<tot; a++, jit+=2) {
+ if (filtertype==LA_SHADBUF_TENT)
shb->weight[a]= 0.71f - sqrt(jit[0]*jit[0] + jit[1]*jit[1]);
- else if(filtertype==LA_SHADBUF_GAUSS)
+ else if (filtertype==LA_SHADBUF_GAUSS)
shb->weight[a]= RE_filter_value(R_FILTER_GAUSS, 1.8f*sqrt(jit[0]*jit[0] + jit[1]*jit[1]));
else
shb->weight[a]= 1.0f;
@@ -166,7 +166,7 @@ static void make_jitter_weight_tab(Render *re, ShadBuf *shb, short filtertype)
}
totw= 1.0f/totw;
- for(a=0; a<tot; a++) {
+ for (a=0; a<tot; a++) {
shb->weight[a]*= totw;
}
}
@@ -176,8 +176,8 @@ static int verg_deepsample(const void *poin1, const void *poin2)
const DeepSample *ds1= (const DeepSample*)poin1;
const DeepSample *ds2= (const DeepSample*)poin2;
- if(ds1->z < ds2->z) return -1;
- else if(ds1->z == ds2->z) return 0;
+ if (ds1->z < ds2->z) return -1;
+ else if (ds1->z == ds2->z) return 0;
else return 1;
}
@@ -191,8 +191,8 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
int a, first, z, newtot= 0;
#if 0
- if(print) {
- for(a=0, ds=dsample; a<tot; a++, ds++)
+ if (print) {
+ for (a=0, ds=dsample; a<tot; a++, ds++)
printf("%lf,%f ", ds->z/(double)0x7FFFFFFF, ds->v);
printf("\n");
}
@@ -204,17 +204,17 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
a= 0;
/* as long as we are not at the end of the array */
- for(a++, ds++; a<tot; a++, ds++) {
+ for (a++, ds++; a<tot; a++, ds++) {
slopemin= 0.0f;
slopemax= 0.0f;
first= 1;
- for(; a<tot; a++, ds++) {
+ for (; a<tot; a++, ds++) {
//dz= ds->z - newds->z;
- if(ds->z == newds->z) {
+ if (ds->z == newds->z) {
/* still in same z position, simply check
* visibility difference against epsilon */
- if(!(fabs(newds->v - ds->v) <= epsilon)) {
+ if (!(fabs(newds->v - ds->v) <= epsilon)) {
break;
}
}
@@ -225,7 +225,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
max= ((ds->v + epsilon) - newds->v)*div;
/* adapt existing slopes */
- if(first) {
+ if (first) {
newmin= min;
newmax= max;
first= 0;
@@ -235,7 +235,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
newmax= MIN2(slopemax, max);
/* verify if there is still space between the slopes */
- if(newmin > newmax) {
+ if (newmin > newmax) {
ds--;
a--;
break;
@@ -247,7 +247,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
}
}
- if(a == tot) {
+ if (a == tot) {
ds--;
a--;
}
@@ -255,7 +255,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
/* always previous z */
z= ds->z;
- if(first || a==tot-1) {
+ if (first || a==tot-1) {
/* if slopes were not initialized, use last visibility */
v= ds->v;
}
@@ -272,12 +272,12 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
newds->v= v;
}
- if(newtot == 0 || (newds->v != (newds-1)->v))
+ if (newtot == 0 || (newds->v != (newds-1)->v))
newtot++;
#if 0
- if(print) {
- for(a=0, ds=dsample; a<newtot; a++, ds++)
+ if (print) {
+ for (a=0, ds=dsample; a<newtot; a++, ds++)
printf("%lf,%f ", ds->z/(double)0x7FFFFFFF, ds->v);
printf("\n");
}
@@ -291,7 +291,7 @@ static float deep_alpha(Render *re, int obinr, int facenr, int strand)
ObjectInstanceRen *obi= &re->objectinstance[obinr];
Material *ma;
- if(strand) {
+ if (strand) {
StrandRen *strand= RE_findOrAddStrand(obi->obr, facenr-1);
ma= strand->buffer->ma;
}
@@ -327,32 +327,32 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
ap= apixbuf;
aps= apixbufstrand;
- for(a=0; a<size*size; a++, ap++, aps++) {
+ for (a=0; a<size*size; a++, ap++, aps++) {
/* count number of samples */
- for(c=0; c<totbuf; c++)
+ for (c=0; c<totbuf; c++)
sampletot[c]= 0;
tot= 0;
- for(apn=ap; apn; apn=apn->next)
- for(b=0; b<4; b++)
- if(apn->p[b])
- for(c=0; c<totbuf; c++)
- if(apn->mask[b] & (1<<c))
+ for (apn=ap; apn; apn=apn->next)
+ for (b=0; b<4; b++)
+ if (apn->p[b])
+ for (c=0; c<totbuf; c++)
+ if (apn->mask[b] & (1<<c))
sampletot[c]++;
- if(apixbufstrand) {
- for(apns=aps; apns; apns=apns->next)
- for(b=0; b<4; b++)
- if(apns->p[b])
- for(c=0; c<totbuf; c++)
- if(apns->mask[b] & (1<<c))
+ if (apixbufstrand) {
+ for (apns=aps; apns; apns=apns->next)
+ for (b=0; b<4; b++)
+ if (apns->p[b])
+ for (c=0; c<totbuf; c++)
+ if (apns->mask[b] & (1<<c))
sampletot[c]++;
}
- for(c=0; c<totbuf; c++)
+ for (c=0; c<totbuf; c++)
tot += sampletot[c];
- if(tot == 0) {
+ if (tot == 0) {
shsample->deepbuf[a]= NULL;
shsample->totbuf[a]= 0;
continue;
@@ -360,14 +360,14 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
/* fill samples */
ds[0]= sampleds[0]= MEM_callocN(sizeof(DeepSample)*tot*2, "deepsample");
- for(c=1; c<totbuf; c++)
+ for (c=1; c<totbuf; c++)
ds[c]= sampleds[c]= sampleds[c-1] + sampletot[c-1]*2;
- for(apn=ap; apn; apn=apn->next) {
- for(b=0; b<4; b++) {
- if(apn->p[b]) {
- for(c=0; c<totbuf; c++) {
- if(apn->mask[b] & (1<<c)) {
+ for (apn=ap; apn; apn=apn->next) {
+ for (b=0; b<4; b++) {
+ if (apn->p[b]) {
+ for (c=0; c<totbuf; c++) {
+ if (apn->mask[b] & (1<<c)) {
/* two entries to create step profile */
ds[c]->z= apn->z[b];
ds[c]->v= 1.0f; /* not used */
@@ -381,12 +381,12 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
}
}
- if(apixbufstrand) {
- for(apns=aps; apns; apns=apns->next) {
- for(b=0; b<4; b++) {
- if(apns->p[b]) {
- for(c=0; c<totbuf; c++) {
- if(apns->mask[b] & (1<<c)) {
+ if (apixbufstrand) {
+ for (apns=aps; apns; apns=apns->next) {
+ for (b=0; b<4; b++) {
+ if (apns->p[b]) {
+ for (c=0; c<totbuf; c++) {
+ if (apns->mask[b] & (1<<c)) {
/* two entries to create step profile */
ds[c]->z= apns->z[b];
ds[c]->v= 1.0f; /* not used */
@@ -401,7 +401,7 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
}
}
- for(c=0; c<totbuf; c++) {
+ for (c=0; c<totbuf; c++) {
/* sort by increasing z */
qsort(sampleds[c], sampletot[c], sizeof(DeepSample)*2, verg_deepsample);
@@ -409,7 +409,7 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
visibility= 1.0f;
ds[c]= sampleds[c];
- for(b=0; b<sampletot[c]; b++) {
+ for (b=0; b<sampletot[c]; b++) {
/* two entries creating step profile */
ds[c]->v= visibility;
ds[c]++;
@@ -421,8 +421,8 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
/* halfway trick, probably won't work well for volumes? */
ds[c]= sampleds[c];
- for(b=0; b<sampletot[c]; b++) {
- if(b+1 < sampletot[c]) {
+ for (b=0; b<sampletot[c]; b++) {
+ if (b+1 < sampletot[c]) {
ds[c]->z= (ds[c]->z>>1) + ((ds[c]+2)->z>>1);
ds[c]++;
ds[c]->z= (ds[c]->z>>1) + ((ds[c]+2)->z>>1);
@@ -450,27 +450,27 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
minz= 0;
found= 0;
- for(c=0; c<totbuf; c++) {
- if(sampletot[c] && (!found || ds[c]->z < minz)) {
+ for (c=0; c<totbuf; c++) {
+ if (sampletot[c] && (!found || ds[c]->z < minz)) {
minz= ds[c]->z;
found= 1;
}
}
- if(!found)
+ if (!found)
break;
dsb->z= minz;
dsb->v= 0.0f;
visibility= 0.0f;
- for(c=0; c<totbuf; c++) {
- if(sampletot[c] && ds[c]->z == minz) {
+ for (c=0; c<totbuf; c++) {
+ if (sampletot[c] && ds[c]->z == minz) {
ds[c]++;
sampletot[c]--;
}
- if(sampleds[c] == ds[c])
+ if (sampleds[c] == ds[c])
visibility += totbuf_f_inv;
else
visibility += (ds[c]-1)->v / totbuf_f;
@@ -488,7 +488,7 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
shsample->totbuf[a]= newtot;
totsamplec += newtot;
- if(newtot < prevtot) {
+ if (newtot < prevtot) {
newbuf= MEM_mallocN(sizeof(DeepSample)*newtot, "cdeepsample");
memcpy(newbuf, shsample->deepbuf[a], sizeof(DeepSample)*newtot);
MEM_freeN(shsample->deepbuf[a]);
@@ -523,20 +523,20 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
/* help buffer */
rcline= MEM_mallocN(256*4+sizeof(int), "makeshadbuf2");
- for(y=0; y<size; y+=16) {
- if(y< size/2) miny= y+15-size/2;
+ for (y=0; y<size; y+=16) {
+ if (y< size/2) miny= y+15-size/2;
else miny= y-size/2;
- for(x=0; x<size; x+=16) {
+ for (x=0; x<size; x+=16) {
/* is tile within spotbundle? */
a= size/2;
- if(x< a) minx= x+15-a;
+ if (x< a) minx= x+15-a;
else minx= x-a;
dist= sqrt( (float)(minx*minx+miny*miny) );
- if(square==0 && dist>(float)(a+12)) { /* 12, tested with a onlyshadow lamp */
+ if (square==0 && dist>(float)(a+12)) { /* 12, tested with a onlyshadow lamp */
a= 256; verg= 0; /* 0x80000000; */ /* 0x7FFFFFFF; */
rz1= (&verg)+1;
}
@@ -546,11 +546,11 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
verg= (*rz1 & 0xFFFFFF00);
- for(a=0;a<256;a++,rz1++) {
- if( (*rz1 & 0xFFFFFF00) !=verg) break;
+ for (a=0;a<256;a++,rz1++) {
+ if ( (*rz1 & 0xFFFFFF00) !=verg) break;
}
}
- if(a==256) { /* complete empty tile */
+ if (a==256) { /* complete empty tile */
*ctile= 0;
*ztile= *(rz1-1);
}
@@ -564,13 +564,13 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
verg1= rc[BCOMP];
rc+= 4;
byt1= 1; byt2= 1;
- for(a=1;a<256;a++,rc+=4) {
+ for (a=1;a<256;a++,rc+=4) {
byt1 &= (verg==rc[ACOMP]);
byt2 &= (verg1==rc[BCOMP]);
- if(byt1==0) break;
+ if (byt1==0) break;
}
- if(byt1 && byt2) { /* only store byte */
+ if (byt1 && byt2) { /* only store byte */
*ctile= 1;
*ztile= (uintptr_t)MEM_mallocN(256+4, "tile1");
rz= (int *)*ztile;
@@ -578,9 +578,9 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
zt= (char *)(rz+1);
rc= rcline;
- for(a=0; a<256; a++, zt++, rc+=4) *zt= rc[GCOMP];
+ for (a=0; a<256; a++, zt++, rc+=4) *zt= rc[GCOMP];
}
- else if(byt1) { /* only store short */
+ else if (byt1) { /* only store short */
*ctile= 2;
*ztile= (uintptr_t)MEM_mallocN(2*256+4,"Tile2");
rz= (int *)*ztile;
@@ -588,7 +588,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
zt= (char *)(rz+1);
rc= rcline;
- for(a=0; a<256; a++, zt+=2, rc+=4) {
+ for (a=0; a<256; a++, zt+=2, rc+=4) {
zt[0]= rc[BCOMP];
zt[1]= rc[GCOMP];
}
@@ -599,7 +599,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
zt= (char *)*ztile;
rc= rcline;
- for(a=0; a<256; a++, zt+=3, rc+=4) {
+ for (a=0; a<256; a++, zt+=3, rc+=4) {
zt[0]= rc[ACOMP];
zt[1]= rc[BCOMP];
zt[2]= rc[GCOMP];
@@ -630,19 +630,19 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
minz= 1.0e30f; maxz= -1.0e30f;
copy_m4_m4(viewmat, lar->shb->viewmat);
- if(lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
+ if (lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
maxtotvert= 0;
- for(obr=re->objecttable.first; obr; obr=obr->next)
+ for (obr=re->objecttable.first; obr; obr=obr->next)
maxtotvert= MAX2(obr->totvert, maxtotvert);
clipflag= MEM_callocN(sizeof(char)*maxtotvert, "autoclipflag");
/* set clip in vertices when face visible */
- for(i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
+ for (i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
obr= obi->obr;
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mult_m4_m4m4(obviewmat, viewmat, obi->mat);
else
copy_m4_m4(obviewmat, viewmat);
@@ -650,35 +650,35 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
memset(clipflag, 0, sizeof(char)*obr->totvert);
/* clear clip, is being set if face is visible (clip is calculated for real later) */
- for(a=0; a<obr->totvlak; a++) {
- if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+ for (a=0; a<obr->totvlak; a++) {
+ if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
else vlr++;
/* note; these conditions are copied from zbuffer_shadow() */
- if(vlr->mat!= ma) {
+ if (vlr->mat!= ma) {
ma= vlr->mat;
ok= 1;
- if((ma->mode & MA_SHADBUF)==0) ok= 0;
+ if ((ma->mode & MA_SHADBUF)==0) ok= 0;
}
- if(ok && (obi->lay & lay)) {
+ if (ok && (obi->lay & lay)) {
clipflag[vlr->v1->index]= 1;
clipflag[vlr->v2->index]= 1;
clipflag[vlr->v3->index]= 1;
- if(vlr->v4) clipflag[vlr->v4->index]= 1;
+ if (vlr->v4) clipflag[vlr->v4->index]= 1;
}
}
/* calculate min and max */
- for(a=0; a< obr->totvert;a++) {
- if((a & 255)==0) ver= RE_findOrAddVert(obr, a);
+ for (a=0; a< obr->totvert;a++) {
+ if ((a & 255)==0) ver= RE_findOrAddVert(obr, a);
else ver++;
- if(clipflag[a]) {
+ if (clipflag[a]) {
copy_v3_v3(vec, ver->co);
mul_m4_v3(obviewmat, vec);
/* Z on visible side of lamp space */
- if(vec[2] < 0.0f) {
+ if (vec[2] < 0.0f) {
float inpr, z= -vec[2];
/* since vec is rotated in lampspace, this is how to get the cosine of angle */
@@ -687,9 +687,9 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
normalize_v3(vec);
inpr= - vec[2];
- if(inpr>=lar->spotsi) {
- if(z<minz) minz= z;
- if(z>maxz) maxz= z;
+ if (inpr>=lar->spotsi) {
+ if (z<minz) minz= z;
+ if (z>maxz) maxz= z;
}
}
}
@@ -699,13 +699,13 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
MEM_freeN(clipflag);
/* set clipping min and max */
- if(minz < maxz) {
+ if (minz < maxz) {
float delta= (maxz - minz); /* threshold to prevent precision issues */
//printf("minz %f maxz %f delta %f\n", minz, maxz, delta);
- if(lar->bufflag & LA_SHADBUF_AUTO_START)
+ if (lar->bufflag & LA_SHADBUF_AUTO_START)
lar->shb->d= minz - delta*0.02f; /* 0.02 is arbitrary... needs more thinking! */
- if(lar->bufflag & LA_SHADBUF_AUTO_END)
+ if (lar->bufflag & LA_SHADBUF_AUTO_END)
lar->shb->clipend= maxz + delta*0.1f;
/* bias was calculated as percentage, we scale it to prevent animation issues */
@@ -723,12 +723,12 @@ static void makeflatshadowbuf(Render *re, LampRen *lar, float *jitbuf)
/* zbuffering */
rectz= MEM_mapallocN(sizeof(int)*shb->size*shb->size, "makeshadbuf");
- for(samples=0; samples<shb->totbuf; samples++) {
+ for (samples=0; samples<shb->totbuf; samples++) {
zbuffer_shadow(re, shb->persmat, lar, rectz, shb->size, jitbuf[2*samples], jitbuf[2*samples+1]);
/* create Z tiles (for compression): this system is 24 bits!!! */
compress_shadowbuf(shb, rectz, lar->mode & LA_SQUARE);
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
break;
}
@@ -744,7 +744,7 @@ static void makedeepshadowbuf(Render *re, LampRen *lar, float *jitbuf)
/* zbuffering */
apixbuf= MEM_callocN(sizeof(APixstr)*shb->size*shb->size, "APixbuf");
- if(re->totstrand)
+ if (re->totstrand)
apixbufstrand= MEM_callocN(sizeof(APixstrand)*shb->size*shb->size, "APixbufstrand");
zbuffer_abuf_shadow(re, lar, shb->persmat, apixbuf, apixbufstrand, &apsmbase, shb->size,
@@ -754,7 +754,7 @@ static void makedeepshadowbuf(Render *re, LampRen *lar, float *jitbuf)
compress_deepshadowbuf(re, shb, apixbuf, apixbufstrand);
MEM_freeN(apixbuf);
- if(apixbufstrand)
+ if (apixbufstrand)
MEM_freeN(apixbufstrand);
freepsA(&apsmbase);
}
@@ -764,11 +764,11 @@ void makeshadowbuf(Render *re, LampRen *lar)
ShadBuf *shb= lar->shb;
float wsize, *jitbuf, twozero[2]= {0.0f, 0.0f}, angle, temp;
- if(lar->bufflag & (LA_SHADBUF_AUTO_START|LA_SHADBUF_AUTO_END))
+ if (lar->bufflag & (LA_SHADBUF_AUTO_START|LA_SHADBUF_AUTO_END))
shadowbuf_autoclip(re, lar);
/* just to enforce identical behavior of all irregular buffers */
- if(lar->buftype==LA_SHADBUF_IRREGULAR)
+ if (lar->buftype==LA_SHADBUF_IRREGULAR)
shb->size= 1024;
/* matrices and window: in winmat the transformation is being put,
@@ -782,7 +782,7 @@ void makeshadowbuf(Render *re, LampRen *lar)
perspective_m4( shb->winmat,-wsize, wsize, -wsize, wsize, shb->d, shb->clipend);
mult_m4_m4m4(shb->persmat, shb->winmat, shb->viewmat);
- if(ELEM3(lar->buftype, LA_SHADBUF_REGULAR, LA_SHADBUF_HALFWAY, LA_SHADBUF_DEEP)) {
+ if (ELEM3(lar->buftype, LA_SHADBUF_REGULAR, LA_SHADBUF_HALFWAY, LA_SHADBUF_DEEP)) {
shb->totbuf= lar->buffers;
/* jitter, weights - not threadsafe! */
@@ -791,12 +791,12 @@ void makeshadowbuf(Render *re, LampRen *lar)
make_jitter_weight_tab(re, shb, lar->filtertype);
BLI_unlock_thread(LOCK_CUSTOM1);
- if(shb->totbuf==4) jitbuf= give_jitter_tab(2);
- else if(shb->totbuf==9) jitbuf= give_jitter_tab(3);
+ if (shb->totbuf==4) jitbuf= give_jitter_tab(2);
+ else if (shb->totbuf==9) jitbuf= give_jitter_tab(3);
else jitbuf= twozero;
/* zbuffering */
- if(lar->buftype == LA_SHADBUF_DEEP) {
+ if (lar->buftype == LA_SHADBUF_DEEP) {
makedeepshadowbuf(re, lar, jitbuf);
shb->totbuf= 1;
}
@@ -814,8 +814,8 @@ static void *do_shadow_thread(void *re_v)
do {
BLI_lock_thread(LOCK_CUSTOM1);
- for(lar=re->lampren.first; lar; lar=lar->next) {
- if(lar->shb && !lar->thread_assigned) {
+ for (lar=re->lampren.first; lar; lar=lar->next) {
+ if (lar->shb && !lar->thread_assigned) {
lar->thread_assigned= 1;
break;
}
@@ -823,7 +823,7 @@ static void *do_shadow_thread(void *re_v)
BLI_unlock_thread(LOCK_CUSTOM1);
/* if type is irregular, this only sets the perspective matrix and autoclips */
- if(lar) {
+ if (lar) {
makeshadowbuf(re, lar);
BLI_lock_thread(LOCK_CUSTOM1);
lar->thread_ready= 1;
@@ -848,9 +848,9 @@ void threaded_makeshadowbufs(Render *re)
int (*test_break)(void *);
/* count number of threads to use */
- if(G.rendering) {
- for(lar=re->lampren.first; lar; lar= lar->next)
- if(lar->shb)
+ if (G.rendering) {
+ for (lar=re->lampren.first; lar; lar= lar->next)
+ if (lar->shb)
totthread++;
totthread= MIN2(totthread, re->r.threads);
@@ -858,10 +858,10 @@ void threaded_makeshadowbufs(Render *re)
else
totthread= 1; /* preview render */
- if(totthread <= 1) {
- for(lar=re->lampren.first; lar; lar= lar->next) {
- if(re->test_break(re->tbh)) break;
- if(lar->shb) {
+ if (totthread <= 1) {
+ for (lar=re->lampren.first; lar; lar= lar->next) {
+ if (re->test_break(re->tbh)) break;
+ if (lar->shb) {
/* if type is irregular, this only sets the perspective matrix and autoclips */
makeshadowbuf(re, lar);
}
@@ -872,26 +872,26 @@ void threaded_makeshadowbufs(Render *re)
test_break= re->test_break;
re->test_break= thread_break;
- for(lar=re->lampren.first; lar; lar= lar->next) {
+ for (lar=re->lampren.first; lar; lar= lar->next) {
lar->thread_assigned= 0;
lar->thread_ready= 0;
}
BLI_init_threads(&threads, do_shadow_thread, totthread);
- for(a=0; a<totthread; a++)
+ for (a=0; a<totthread; a++)
BLI_insert_thread(&threads, re);
/* keep rendering as long as there are shadow buffers not ready */
do {
- if((g_break=test_break(re->tbh)))
+ if ((g_break=test_break(re->tbh)))
break;
PIL_sleep_ms(50);
BLI_lock_thread(LOCK_CUSTOM1);
- for(lar=re->lampren.first; lar; lar= lar->next)
- if(lar->shb && !lar->thread_ready)
+ for (lar=re->lampren.first; lar; lar= lar->next)
+ if (lar->shb && !lar->thread_ready)
break;
BLI_unlock_thread(LOCK_CUSTOM1);
} while(lar);
@@ -906,16 +906,16 @@ void threaded_makeshadowbufs(Render *re)
void freeshadowbuf(LampRen *lar)
{
- if(lar->shb) {
+ if (lar->shb) {
ShadBuf *shb= lar->shb;
ShadSampleBuf *shsample;
int b, v;
- for(shsample= shb->buffers.first; shsample; shsample= shsample->next) {
- if(shsample->deepbuf) {
+ for (shsample= shb->buffers.first; shsample; shsample= shsample->next) {
+ if (shsample->deepbuf) {
v= shb->size*shb->size;
- for(b=0; b<v; b++)
- if(shsample->deepbuf[b])
+ for (b=0; b<v; b++)
+ if (shsample->deepbuf[b])
MEM_freeN(shsample->deepbuf[b]);
MEM_freeN(shsample->deepbuf);
@@ -926,8 +926,8 @@ void freeshadowbuf(LampRen *lar)
char *ctile= shsample->cbuf;
v= (shb->size*shb->size)/256;
- for(b=0; b<v; b++, ztile++, ctile++)
- if(*ctile) MEM_freeN((void *) *ztile);
+ for (b=0; b<v; b++, ztile++, ctile++)
+ if (*ctile) MEM_freeN((void *) *ztile);
MEM_freeN(shsample->zbuf);
MEM_freeN(shsample->cbuf);
@@ -935,7 +935,7 @@ void freeshadowbuf(LampRen *lar)
}
BLI_freelistN(&shb->buffers);
- if(shb->weight) MEM_freeN(shb->weight);
+ if (shb->weight) MEM_freeN(shb->weight);
MEM_freeN(lar->shb);
lar->shb= NULL;
@@ -949,22 +949,22 @@ static int firstreadshadbuf(ShadBuf *shb, ShadSampleBuf *shsample, int **rz, int
int ofs;
char *ct;
- if(shsample->deepbuf)
+ if (shsample->deepbuf)
return 0;
/* always test borders of shadowbuffer */
- if(xs<0) xs= 0; else if(xs>=shb->size) xs= shb->size-1;
- if(ys<0) ys= 0; else if(ys>=shb->size) ys= shb->size-1;
+ if (xs<0) xs= 0; else if (xs>=shb->size) xs= shb->size-1;
+ if (ys<0) ys= 0; else if (ys>=shb->size) ys= shb->size-1;
/* calc z */
ofs= (ys>>4)*(shb->size>>4) + (xs>>4);
ct= shsample->cbuf+ofs;
- if(*ct==0) {
- if(nr==0) {
+ if (*ct==0) {
+ if (nr==0) {
*rz= *( (int **)(shsample->zbuf+ofs) );
return 1;
}
- else if(*rz!= *( (int **)(shsample->zbuf+ofs) )) return 0;
+ else if (*rz!= *( (int **)(shsample->zbuf+ofs) )) return 0;
return 1;
}
@@ -983,21 +983,21 @@ static float readdeepvisibility(DeepSample *dsample, int tot, int z, int bias, f
ds= dsample;
for (a=0; a<tot && (z-bias > ds->z); a++, ds++) {}
- if(a == tot) {
- if(biast)
+ if (a == tot) {
+ if (biast)
*biast= 0.0f;
return (ds-1)->v; /* completely behind all samples */
}
/* check if this read needs bias blending */
- if(biast) {
- if(z > ds->z)
+ if (biast) {
+ if (z > ds->z)
*biast= (float)(z - ds->z)/(float)bias;
else
*biast= 0.0f;
}
- if(a == 0)
+ if (a == 0)
return 1.0f; /* completely in front of all samples */
/* converting to float early here because ds->z - prevds->z can overflow */
@@ -1011,18 +1011,18 @@ static float readdeepshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias,
float v, biasv, biast;
int ofs, tot;
- if(zs < - 0x7FFFFE00 + bias)
+ if (zs < - 0x7FFFFE00 + bias)
return 1.0; /* extreme close to clipstart */
/* calc z */
ofs= ys*shb->size + xs;
tot= shsample->totbuf[ofs];
- if(tot == 0)
+ if (tot == 0)
return 1.0f;
v= readdeepvisibility(shsample->deepbuf[ofs], tot, zs, bias, &biast);
- if(biast != 0.0f) {
+ if (biast != 0.0f) {
/* in soft bias area */
biasv= readdeepvisibility(shsample->deepbuf[ofs], tot, zs, 0, 0);
@@ -1042,14 +1042,14 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
char *ct, *cz;
/* simpleclip */
- /* if(xs<0 || ys<0) return 1.0; */
- /* if(xs>=shb->size || ys>=shb->size) return 1.0; */
+ /* if (xs<0 || ys<0) return 1.0; */
+ /* if (xs>=shb->size || ys>=shb->size) return 1.0; */
/* always test borders of shadowbuffer */
- if(xs<0) xs= 0; else if(xs>=shb->size) xs= shb->size-1;
- if(ys<0) ys= 0; else if(ys>=shb->size) ys= shb->size-1;
+ if (xs<0) xs= 0; else if (xs>=shb->size) xs= shb->size-1;
+ if (ys<0) ys= 0; else if (ys>=shb->size) ys= shb->size-1;
- if(shsample->deepbuf)
+ if (shsample->deepbuf)
return readdeepshadowbuf(shb, shsample, bias, xs, ys, zs);
/* calc z */
@@ -1057,14 +1057,14 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
ct= shsample->cbuf+ofs;
rz= *( (int **)(shsample->zbuf+ofs) );
- if(*ct==3) {
+ if (*ct==3) {
ct= ((char *)rz)+3*16*(ys & 15)+3*(xs & 15);
cz= (char *)&zsamp;
cz[ACOMP]= ct[0];
cz[BCOMP]= ct[1];
cz[GCOMP]= ct[2];
}
- else if(*ct==2) {
+ else if (*ct==2) {
ct= ((char *)rz);
ct+= 4+2*16*(ys & 15)+2*(xs & 15);
zsamp= *rz;
@@ -1073,7 +1073,7 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
cz[BCOMP]= ct[0];
cz[GCOMP]= ct[1];
}
- else if(*ct==1) {
+ else if (*ct==1) {
ct= ((char *)rz);
ct+= 4+16*(ys & 15)+(xs & 15);
zsamp= *rz;
@@ -1090,9 +1090,9 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
/* tricky stuff here; we use ints which can overflow easily with bias values */
- if(zsamp > zs) return 1.0; /* absolute no shadow */
- else if(zs < - 0x7FFFFE00 + bias) return 1.0; /* extreme close to clipstart */
- else if(zsamp < zs-bias) return 0.0 ; /* absolute in shadow */
+ if (zsamp > zs) return 1.0; /* absolute no shadow */
+ else if (zs < - 0x7FFFFE00 + bias) return 1.0; /* extreme close to clipstart */
+ else if (zsamp < zs-bias) return 0.0; /* absolute in shadow */
else { /* soft area */
temp= ( (float)(zs- zsamp) )/(float)bias;
@@ -1112,7 +1112,7 @@ static void shadowbuf_project_co(float *x, float *y, float *z, ShadBuf *shb, con
*x= size*(1.0f+hco[0]/hco[3]);
*y= size*(1.0f+hco[1]/hco[3]);
- if(z) *z= (hco[2]/hco[3]);
+ if (z) *z= (hco[2]/hco[3]);
}
/* the externally called shadow testing (reading) function */
@@ -1126,11 +1126,11 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
short a, num;
/* crash preventer */
- if(shb->buffers.first==NULL)
+ if (shb->buffers.first==NULL)
return 1.0f;
/* when facing away, assume fully in shadow */
- if(inp <= 0.0f)
+ if (inp <= 0.0f)
return 0.0f;
/* project coordinate to pixel space */
@@ -1138,9 +1138,9 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
/* clip z coordinate, z is projected so that (-1.0, 1.0) matches
* (clipstart, clipend), so we can do this simple test */
- if(zs1>=1.0f)
+ if (zs1>=1.0f)
return 0.0f;
- else if(zs1<= -1.0f)
+ else if (zs1<= -1.0f)
return 1.0f;
zs= ((float)0x7FFFFFFF)*zs1;
@@ -1151,15 +1151,15 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
fac= shb->soft;
/* compute z bias */
- if(mat_bias!=0.0f) biasf= shb->bias*mat_bias;
+ if (mat_bias!=0.0f) biasf= shb->bias*mat_bias;
else biasf= shb->bias;
/* with inp==1.0, bias is half the size. correction value was 1.1, giving errors
* on cube edges, with one side being almost frontal lighted (ton) */
bias= (1.5f-inp*inp)*biasf;
/* in case of no filtering we can do things simpler */
- if(num==1) {
- for(shsample= shb->buffers.first; shsample; shsample= shsample->next)
+ if (num==1) {
+ for (shsample= shb->buffers.first; shsample; shsample= shsample->next)
shadfac += readshadowbuf(shb, shsample, bias, (int)xs1, (int)ys1, zs);
return shadfac/(float)shb->totbuf;
@@ -1178,20 +1178,20 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
xres= fac*(fabs(dx[0]) + fabs(dy[0]));
yres= fac*(fabs(dx[1]) + fabs(dy[1]));
- if(xres<1.0f) xres= 1.0f;
- if(yres<1.0f) yres= 1.0f;
+ if (xres<1.0f) xres= 1.0f;
+ if (yres<1.0f) yres= 1.0f;
/* make xs1/xs1 corner of sample area */
xs1 -= xres*0.5f;
ys1 -= yres*0.5f;
/* in case we have a constant value in a tile, we can do quicker lookup */
- if(xres<16.0f && yres<16.0f) {
+ if (xres<16.0f && yres<16.0f) {
shsample= shb->buffers.first;
- if(firstreadshadbuf(shb, shsample, &rz, (int)xs1, (int)ys1, 0)) {
- if(firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)ys1, 1)) {
- if(firstreadshadbuf(shb, shsample, &rz, (int)xs1, (int)(ys1+yres), 1)) {
- if(firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)(ys1+yres), 1)) {
+ if (firstreadshadbuf(shb, shsample, &rz, (int)xs1, (int)ys1, 0)) {
+ if (firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)ys1, 1)) {
+ if (firstreadshadbuf(shb, shsample, &rz, (int)xs1, (int)(ys1+yres), 1)) {
+ if (firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)(ys1+yres), 1)) {
return readshadowbuf(shb, shsample, bias,(int)xs1, (int)ys1, zs);
}
}
@@ -1200,11 +1200,11 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
}
/* full jittered shadow buffer lookup */
- for(shsample= shb->buffers.first; shsample; shsample= shsample->next) {
+ for (shsample= shb->buffers.first; shsample; shsample= shsample->next) {
jit= shb->jit;
weight= shb->weight;
- for(a=num; a>0; a--, jit+=2, weight++) {
+ for (a=num; a>0; a--, jit+=2, weight++) {
/* instead of jit i tried random: ugly! */
/* note: the plus 0.5 gives best sampling results, jit goes from -0.5 to 0.5 */
/* xs1 and ys1 are already corrected to be corner of sample area */
@@ -1232,15 +1232,15 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
bias= -shb->bias;
/* simpleclip */
- if(xs<0 || ys<0) return 0.0;
- if(xs>=shb->size || ys>=shb->size) return 0.0;
+ if (xs<0 || ys<0) return 0.0;
+ if (xs>=shb->size || ys>=shb->size) return 0.0;
/* calc z */
ofs= (ys>>4)*(shb->size>>4) + (xs>>4);
ct= shsample->cbuf+ofs;
rz= *( (int **)(shsample->zbuf+ofs) );
- if(*ct==3) {
+ if (*ct==3) {
ct= ((char *)rz)+3*16*(ys & 15)+3*(xs & 15);
cz= (char *)&zsamp;
zsamp= 0;
@@ -1248,7 +1248,7 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
cz[BCOMP]= ct[1];
cz[GCOMP]= ct[2];
}
- else if(*ct==2) {
+ else if (*ct==2) {
ct= ((char *)rz);
ct+= 4+2*16*(ys & 15)+2*(xs & 15);
zsamp= *rz;
@@ -1257,7 +1257,7 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
cz[BCOMP]= ct[0];
cz[GCOMP]= ct[1];
}
- else if(*ct==1) {
+ else if (*ct==1) {
ct= ((char *)rz);
ct+= 4+16*(ys & 15)+(xs & 15);
zsamp= *rz;
@@ -1274,16 +1274,16 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
/* NO schadow when sampled at 'eternal' distance */
- if(zsamp >= 0x7FFFFE00) return 1.0;
+ if (zsamp >= 0x7FFFFE00) return 1.0;
- if(zsamp > zs) return 1.0; /* absolute no shadww */
+ if (zsamp > zs) return 1.0; /* absolute no shadww */
else {
/* bias is negative, so the (zs-bias) can be beyond 0x7fffffff */
zbias= 0x7fffffff - zs;
- if(zbias > -bias) {
- if( zsamp < zs-bias) return 0.0 ; /* absolute in shadow */
+ if (zbias > -bias) {
+ if ( zsamp < zs-bias) return 0.0; /* absolute in shadow */
}
- else return 0.0 ; /* absolute shadow */
+ else return 0.0; /* absolute shadow */
}
/* soft area */
@@ -1331,8 +1331,8 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
xs1= (int)xf1;
ys1= (int)yf1;
- if(xf1 != xf2) {
- if(xf2-xf1 > 0.0f) {
+ if (xf1 != xf2) {
+ if (xf2-xf1 > 0.0f) {
labdax= (xf1-xs1-1.0f)/(xf1-xf2);
ldx= -shb->shadhalostep/(xf1-xf2);
dx= shb->shadhalostep;
@@ -1348,8 +1348,8 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
ldx= 0.0;
}
- if(yf1 != yf2) {
- if(yf2-yf1 > 0.0f) {
+ if (yf1 != yf2) {
+ if (yf2-yf1 > 0.0f) {
labday= (yf1-ys1-1.0f)/(yf1-yf2);
ldy= -shb->shadhalostep/(yf1-yf2);
dy= shb->shadhalostep;
@@ -1374,42 +1374,43 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
while(1) {
labdao= labda;
- if(labdax==labday) {
+ if (labdax==labday) {
labdax+= ldx;
x+= dx;
labday+= ldy;
y+= dy;
}
else {
- if(labdax<labday) {
+ if (labdax<labday) {
labdax+= ldx;
x+= dx;
- } else {
+ }
+ else {
labday+= ldy;
y+= dy;
}
}
labda= MIN2(labdax, labday);
- if(labda==labdao || labda>=1.0f) break;
+ if (labda==labdao || labda>=1.0f) break;
zf= zf1 + labda*(zf2-zf1);
count+= (float)shb->totbuf;
- if(zf<= -1.0f) lightcount += 1.0f; /* close to the spot */
+ if (zf<= -1.0f) lightcount += 1.0f; /* close to the spot */
else {
/* make sure, behind the clipend we extend halolines. */
- if(zf>=1.0f) z= 0x7FFFF000;
+ if (zf>=1.0f) z= 0x7FFFF000;
else z= (int)(0x7FFFF000*zf);
- for(shsample= shb->buffers.first; shsample; shsample= shsample->next)
+ for (shsample= shb->buffers.first; shsample; shsample= shsample->next)
lightcount+= readshadowbuf_halo(shb, shsample, x, y, z);
}
}
- if(count!=0.0f) return (lightcount/count);
+ if (count!=0.0f) return (lightcount/count);
return 0.0f;
}
@@ -1462,10 +1463,10 @@ typedef struct BSPFace {
/* boxes are in lamp projection */
static void init_box(Boxf *box)
{
- box->xmin= 1000000.0f;
- box->xmax= 0;
- box->ymin= 1000000.0f;
- box->ymax= 0;
+ box->xmin = 1000000.0f;
+ box->xmax = 0;
+ box->ymin = 1000000.0f;
+ box->ymax = 0;
box->zmin= 0x7FFFFFFF;
box->zmax= - 0x7FFFFFFF;
}
@@ -1473,21 +1474,21 @@ static void init_box(Boxf *box)
/* use v1 to calculate boundbox */
static void bound_boxf(Boxf *box, const float v1[3])
{
- if(v1[0] < box->xmin) box->xmin= v1[0];
- if(v1[0] > box->xmax) box->xmax= v1[0];
- if(v1[1] < box->ymin) box->ymin= v1[1];
- if(v1[1] > box->ymax) box->ymax= v1[1];
- if(v1[2] < box->zmin) box->zmin= v1[2];
- if(v1[2] > box->zmax) box->zmax= v1[2];
+ if (v1[0] < box->xmin) box->xmin = v1[0];
+ if (v1[0] > box->xmax) box->xmax = v1[0];
+ if (v1[1] < box->ymin) box->ymin = v1[1];
+ if (v1[1] > box->ymax) box->ymax = v1[1];
+ if (v1[2] < box->zmin) box->zmin= v1[2];
+ if (v1[2] > box->zmax) box->zmax= v1[2];
}
/* use v1 to calculate boundbox */
static void bound_rectf(rctf *box, const float v1[2])
{
- if(v1[0] < box->xmin) box->xmin= v1[0];
- if(v1[0] > box->xmax) box->xmax= v1[0];
- if(v1[1] < box->ymin) box->ymin= v1[1];
- if(v1[1] > box->ymax) box->ymax= v1[1];
+ if (v1[0] < box->xmin) box->xmin = v1[0];
+ if (v1[0] > box->xmax) box->xmax = v1[0];
+ if (v1[1] < box->ymin) box->ymin = v1[1];
+ if (v1[1] > box->ymax) box->ymax = v1[1];
}
@@ -1496,7 +1497,7 @@ static void isb_bsp_split_init(ISBBranch *root, MemArena *mem, int level)
{
/* if level > 0 we create new branches and go deeper*/
- if(level > 0) {
+ if (level > 0) {
ISBBranch *left, *right;
int i;
@@ -1505,7 +1506,7 @@ static void isb_bsp_split_init(ISBBranch *root, MemArena *mem, int level)
root->divider[1]= 0.5f*(root->box.ymin+root->box.ymax);
/* find best splitpoint */
- if(root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
+ if (root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
i= root->index= 0;
else
i= root->index= 1;
@@ -1516,13 +1517,13 @@ static void isb_bsp_split_init(ISBBranch *root, MemArena *mem, int level)
/* box info */
left->box= root->box;
right->box= root->box;
- if(i==0) {
- left->box.xmax= root->divider[0];
- right->box.xmin= root->divider[0];
+ if (i==0) {
+ left->box.xmax = root->divider[0];
+ right->box.xmin = root->divider[0];
}
else {
- left->box.ymax= root->divider[1];
- right->box.ymin= root->divider[1];
+ left->box.ymax = root->divider[1];
+ right->box.ymin = root->divider[1];
}
isb_bsp_split_init(left, mem, level-1);
isb_bsp_split_init(right, mem, level-1);
@@ -1542,7 +1543,7 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
/* splitpoint */
root->divider[0]= root->divider[1]= 0.0f;
- for(a=BSPMAX_SAMPLE-1; a>=0; a--) {
+ for (a=BSPMAX_SAMPLE-1; a>=0; a--) {
root->divider[0]+= root->samples[a]->zco[0];
root->divider[1]+= root->samples[a]->zco[1];
}
@@ -1550,7 +1551,7 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
root->divider[1]/= BSPMAX_SAMPLE;
/* find best splitpoint */
- if(root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
+ if (root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
i= root->index= 0;
else
i= root->index= 1;
@@ -1564,15 +1565,15 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
right->samples= samples; // tmp
/* split samples */
- for(a=BSPMAX_SAMPLE-1; a>=0; a--) {
+ for (a=BSPMAX_SAMPLE-1; a>=0; a--) {
int comp= 0;
/* this prevents adding samples all to 1 branch when divider is equal to samples */
- if(root->samples[a]->zco[i] == root->divider[i])
+ if (root->samples[a]->zco[i] == root->divider[i])
comp= a & 1;
- else if(root->samples[a]->zco[i] < root->divider[i])
+ else if (root->samples[a]->zco[i] < root->divider[i])
comp= 1;
- if(comp==1) {
+ if (comp==1) {
left->samples[left->totsamp]= root->samples[a];
left->totsamp++;
}
@@ -1590,13 +1591,13 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
/* box info */
left->box= root->box;
right->box= root->box;
- if(i==0) {
- left->box.xmax= root->divider[0];
- right->box.xmin= root->divider[0];
+ if (i==0) {
+ left->box.xmax = root->divider[0];
+ right->box.xmin = root->divider[0];
}
else {
- left->box.ymax= root->divider[1];
- right->box.ymin= root->divider[1];
+ left->box.ymax = root->divider[1];
+ right->box.ymin = root->divider[1];
}
}
@@ -1613,7 +1614,7 @@ static int isb_bsp_insert(ISBBranch *root, MemArena *memarena, ISBSample *sample
/* going over branches until last one found */
while(bspn->left) {
- if(zco[bspn->index] <= bspn->divider[bspn->index])
+ if (zco[bspn->index] <= bspn->divider[bspn->index])
bspn= bspn->left;
else
bspn= bspn->right;
@@ -1621,7 +1622,7 @@ static int isb_bsp_insert(ISBBranch *root, MemArena *memarena, ISBSample *sample
}
/* bspn now is the last branch */
- if(bspn->totsamp==BSPMAX_SAMPLE) {
+ if (bspn->totsamp==BSPMAX_SAMPLE) {
printf("error in bsp branch\n"); /* only for debug, cannot happen */
return 1;
}
@@ -1631,8 +1632,8 @@ static int isb_bsp_insert(ISBBranch *root, MemArena *memarena, ISBSample *sample
bspn->totsamp++;
/* split if allowed and needed */
- if(bspn->totsamp==BSPMAX_SAMPLE) {
- if(i==BSPMAX_DEPTH) {
+ if (bspn->totsamp==BSPMAX_SAMPLE) {
+ if (i==BSPMAX_DEPTH) {
bspn->totsamp--; /* stop filling in... will give errors */
return 1;
}
@@ -1648,7 +1649,7 @@ static void bspface_init_strand(BSPFace *face)
face->radline= 0.5f* len_v2v2(face->v1, face->v2);
mid_v3_v3v3(face->vec1, face->v1, face->v2);
- if(face->v4)
+ if (face->v4)
mid_v3_v3v3(face->vec2, face->v3, face->v4);
else
copy_v3_v3(face->vec2, face->v3);
@@ -1659,7 +1660,7 @@ static void bspface_init_strand(BSPFace *face)
face->len= face->rc[0]*face->rc[0]+ face->rc[1]*face->rc[1];
- if(face->len!=0.0f) {
+ if (face->len!=0.0f) {
face->radline_end= face->radline/sqrt(face->len);
face->len= 1.0f/face->len;
}
@@ -1673,18 +1674,18 @@ static int point_behind_strand(const float p[3], BSPFace *face)
/* using code from dist_to_line_segment_v2(), distance vec to line-piece */
- if(face->len==0.0f) {
+ if (face->len==0.0f) {
rc[0]= p[0]-face->vec1[0];
rc[1]= p[1]-face->vec1[1];
dist= (float)(sqrt(rc[0]*rc[0]+ rc[1]*rc[1]));
- if(dist < face->radline)
+ if (dist < face->radline)
return 1;
}
else {
float labda= ( face->rc[0]*(p[0]-face->vec1[0]) + face->rc[1]*(p[1]-face->vec1[1]) )*face->len;
- if(labda > -face->radline_end && labda < 1.0f+face->radline_end) {
+ if (labda > -face->radline_end && labda < 1.0f+face->radline_end) {
/* hesse for dist: */
//dist= (float)(fabs( (p[0]-vec2[0])*rc[1] + (p[1]-vec2[1])*rc[0])/len);
@@ -1695,9 +1696,9 @@ static int point_behind_strand(const float p[3], BSPFace *face)
rc[1]= pt[1]-p[1];
dist= (float)sqrt(rc[0]*rc[0]+ rc[1]*rc[1]);
- if(dist < face->radline) {
+ if (dist < face->radline) {
float zval= face->vec1[2] + labda*face->rc[2];
- if(p[2] > zval)
+ if (p[2] > zval)
return 1;
}
}
@@ -1718,7 +1719,7 @@ static int point_behind_tria2d(const float p[3], const float v1[3], const float
c[1] = v3[1] - v1[1];
div = a[0]*c[1] - a[1]*c[0];
- if(div==0.0f)
+ if (div==0.0f)
return 0;
h[0] = p[0] - v1[0];
@@ -1727,13 +1728,13 @@ static int point_behind_tria2d(const float p[3], const float v1[3], const float
div = 1.0f/div;
u = (h[0]*c[1] - h[1]*c[0])*div;
- if(u >= 0.0f) {
+ if (u >= 0.0f) {
v = (a[0]*h[1] - a[1]*h[0])*div;
- if(v >= 0.0f) {
- if( u + v <= 1.0f) {
+ if (v >= 0.0f) {
+ if ( u + v <= 1.0f) {
/* inside, now check if point p is behind */
float z= (1.0f-u-v)*v1[2] + u*v2[2] + v*v3[2];
- if(z <= p[2])
+ if (z <= p[2])
return 1;
}
}
@@ -1758,10 +1759,10 @@ static int rect_outside_line(rctf *rect, const float v1[3], const float v2[3], c
side= a*v3[0] + b*v3[1] + c < 0.0f;
/* the four quad points */
- if( side==(rect->xmin*a + rect->ymin*b + c >= 0.0f) )
- if( side==(rect->xmax*a + rect->ymin*b + c >= 0.0f) )
- if( side==(rect->xmax*a + rect->ymax*b + c >= 0.0f) )
- if( side==(rect->xmin*a + rect->ymax*b + c >= 0.0f) )
+ if ( side==(rect->xmin*a + rect->ymin*b + c >= 0.0f) )
+ if ( side==(rect->xmax*a + rect->ymin*b + c >= 0.0f) )
+ if ( side==(rect->xmax*a + rect->ymax*b + c >= 0.0f) )
+ if ( side==(rect->xmin*a + rect->ymax*b + c >= 0.0f) )
return 1;
return 0;
}
@@ -1769,11 +1770,11 @@ static int rect_outside_line(rctf *rect, const float v1[3], const float v2[3], c
/* check if one of the triangle edges separates all rect points on 1 side */
static int rect_isect_tria(rctf *rect, const float v1[3], const float v2[3], const float v3[3])
{
- if(rect_outside_line(rect, v1, v2, v3))
+ if (rect_outside_line(rect, v1, v2, v3))
return 0;
- if(rect_outside_line(rect, v2, v3, v1))
+ if (rect_outside_line(rect, v2, v3, v1))
return 0;
- if(rect_outside_line(rect, v3, v1, v2))
+ if (rect_outside_line(rect, v3, v1, v2))
return 0;
return 1;
}
@@ -1784,18 +1785,18 @@ static void isb_bsp_face_inside(ISBBranch *bspn, BSPFace *face)
{
/* are we descending? */
- if(bspn->left) {
+ if (bspn->left) {
/* hrmf, the box struct cannot be addressed with index */
- if(bspn->index==0) {
- if(face->box.xmin <= bspn->divider[0])
+ if (bspn->index==0) {
+ if (face->box.xmin <= bspn->divider[0])
isb_bsp_face_inside(bspn->left, face);
- if(face->box.xmax > bspn->divider[0])
+ if (face->box.xmax > bspn->divider[0])
isb_bsp_face_inside(bspn->right, face);
}
else {
- if(face->box.ymin <= bspn->divider[1])
+ if (face->box.ymin <= bspn->divider[1])
isb_bsp_face_inside(bspn->left, face);
- if(face->box.ymax > bspn->divider[1])
+ if (face->box.ymax > bspn->divider[1])
isb_bsp_face_inside(bspn->right, face);
}
}
@@ -1803,42 +1804,42 @@ static void isb_bsp_face_inside(ISBBranch *bspn, BSPFace *face)
/* else: end branch reached */
int a;
- if(bspn->totsamp==0) return;
+ if (bspn->totsamp==0) return;
/* check for nodes entirely in shadow, can be skipped */
- if(bspn->totsamp==bspn->full)
+ if (bspn->totsamp==bspn->full)
return;
/* if bsp node is entirely in front of face, give up */
- if(bspn->box.zmax < face->box.zmin)
+ if (bspn->box.zmax < face->box.zmin)
return;
/* if face boundbox is outside of branch rect, give up */
- if(0==BLI_isect_rctf((rctf *)&face->box, (rctf *)&bspn->box, NULL))
+ if (0==BLI_isect_rctf((rctf *)&face->box, (rctf *)&bspn->box, NULL))
return;
/* test all points inside branch */
- for(a=bspn->totsamp-1; a>=0; a--) {
+ for (a=bspn->totsamp-1; a>=0; a--) {
ISBSample *samp= bspn->samples[a];
- if((samp->facenr!=face->facenr || samp->obi!=face->obi) && samp->shadfac) {
- if(face->box.zmin < samp->zco[2]) {
- if(BLI_in_rctf((rctf *)&face->box, samp->zco[0], samp->zco[1])) {
+ if ((samp->facenr!=face->facenr || samp->obi!=face->obi) && samp->shadfac) {
+ if (face->box.zmin < samp->zco[2]) {
+ if (BLI_in_rctf((rctf *)&face->box, samp->zco[0], samp->zco[1])) {
int inshadow= 0;
- if(face->type) {
- if(point_behind_strand(samp->zco, face))
+ if (face->type) {
+ if (point_behind_strand(samp->zco, face))
inshadow= 1;
}
- else if( point_behind_tria2d(samp->zco, face->v1, face->v2, face->v3))
+ else if ( point_behind_tria2d(samp->zco, face->v1, face->v2, face->v3))
inshadow= 1;
- else if(face->v4 && point_behind_tria2d(samp->zco, face->v1, face->v3, face->v4))
+ else if (face->v4 && point_behind_tria2d(samp->zco, face->v1, face->v3, face->v4))
inshadow= 1;
- if(inshadow) {
+ if (inshadow) {
*(samp->shadfac) += face->shad_alpha;
/* optimize; is_full means shad_alpha==4096 */
- if(*(samp->shadfac) >= 4096 || face->is_full) {
+ if (*(samp->shadfac) >= 4096 || face->is_full) {
bspn->full++;
samp->shadfac= NULL;
}
@@ -1853,15 +1854,15 @@ static void isb_bsp_face_inside(ISBBranch *bspn, BSPFace *face)
/* based on available samples, recalculate the bounding box for bsp nodes, recursive */
static void isb_bsp_recalc_box(ISBBranch *root)
{
- if(root->left) {
+ if (root->left) {
isb_bsp_recalc_box(root->left);
isb_bsp_recalc_box(root->right);
}
- else if(root->totsamp) {
+ else if (root->totsamp) {
int a;
init_box(&root->box);
- for(a=root->totsamp-1; a>=0; a--)
+ for (a=root->totsamp-1; a>=0; a--)
bound_boxf(&root->box, root->samples[a]->zco);
}
}
@@ -1878,7 +1879,7 @@ static void isb_bsp_test_strand(ZSpan *zspan, int obi, int zvlnr, float *v1, flo
face.obi= obi;
face.facenr= zvlnr & ~RE_QUAD_OFFS;
face.type= R_STRAND;
- if(R.osa)
+ if (R.osa)
face.shad_alpha= (short)ceil(4096.0f*zspan->shad_alpha/(float)R.osa);
else
face.shad_alpha= (short)ceil(4096.0f*zspan->shad_alpha);
@@ -1890,7 +1891,7 @@ static void isb_bsp_test_strand(ZSpan *zspan, int obi, int zvlnr, float *v1, flo
bound_boxf(&face.box, v1);
bound_boxf(&face.box, v2);
bound_boxf(&face.box, v3);
- if(v4)
+ if (v4)
bound_boxf(&face.box, v4);
/* optimize values */
@@ -1912,7 +1913,7 @@ static void isb_bsp_test_face(ZSpan *zspan, int obi, int zvlnr, float *v1, float
face.obi= obi;
face.facenr= zvlnr & ~RE_QUAD_OFFS;
face.type= 0;
- if(R.osa)
+ if (R.osa)
face.shad_alpha= (short)ceil(4096.0f*zspan->shad_alpha/(float)R.osa);
else
face.shad_alpha= (short)ceil(4096.0f*zspan->shad_alpha);
@@ -1924,7 +1925,7 @@ static void isb_bsp_test_face(ZSpan *zspan, int obi, int zvlnr, float *v1, float
bound_boxf(&face.box, v1);
bound_boxf(&face.box, v2);
bound_boxf(&face.box, v3);
- if(v4)
+ if (v4)
bound_boxf(&face.box, v4);
isb_bsp_face_inside((ISBBranch *)zspan->rectz, &face);
@@ -1935,11 +1936,11 @@ static int testclip_minmax(const float ho[4], const float minmax[4])
float wco= ho[3];
int flag= 0;
- if( ho[0] > minmax[1]*wco) flag = 1;
- else if( ho[0]< minmax[0]*wco) flag = 2;
+ if ( ho[0] > minmax[1]*wco) flag = 1;
+ else if ( ho[0]< minmax[0]*wco) flag = 2;
- if( ho[1] > minmax[3]*wco) flag |= 4;
- else if( ho[1]< minmax[2]*wco) flag |= 8;
+ if ( ho[1] > minmax[3]*wco) flag |= 4;
+ else if ( ho[1]< minmax[2]*wco) flag |= 8;
return flag;
}
@@ -1966,7 +1967,7 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
minmaxf[2]= (2.0f*root->box.ymin - size-2.0f)/size;
minmaxf[3]= (2.0f*root->box.ymax - size+2.0f)/size;
- if(lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
+ if (lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
/* (ab)use zspan, since we use zbuffer clipping code */
zbuf_alloc_span(&zspan, size, size, re->clipcrop);
@@ -1985,29 +1986,29 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
zspan.zbuffunc= isb_bsp_test_face;
zspanstrand.zbuffunc= isb_bsp_test_strand;
- for(i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
+ for (i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
obr= obi->obr;
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mult_m4_m4m4(winmat, shb->persmat, obi->mat);
else
copy_m4_m4(winmat, shb->persmat);
- for(a=0; a<obr->totvlak; a++) {
+ for (a=0; a<obr->totvlak; a++) {
- if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+ if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
else vlr++;
/* note, these conditions are copied in shadowbuf_autoclip() */
- if(vlr->mat!= ma) {
+ if (vlr->mat!= ma) {
ma= vlr->mat;
ok= 1;
- if((ma->mode & MA_SHADBUF)==0) ok= 0;
- if(ma->material_type == MA_TYPE_WIRE) ok= 0;
+ if ((ma->mode & MA_SHADBUF)==0) ok= 0;
+ if (ma->material_type == MA_TYPE_WIRE) ok= 0;
zspanstrand.shad_alpha= zspan.shad_alpha= ma->shad_alpha;
}
- if(ok && (obi->lay & lay)) {
+ if (ok && (obi->lay & lay)) {
float hoco[4][4];
int c1, c2, c3, c4=0;
int d1, d2, d3, d4=0;
@@ -2017,32 +2018,32 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
projectvert(vlr->v1->co, winmat, hoco[0]); d1= testclip_minmax(hoco[0], minmaxf);
projectvert(vlr->v2->co, winmat, hoco[1]); d2= testclip_minmax(hoco[1], minmaxf);
projectvert(vlr->v3->co, winmat, hoco[2]); d3= testclip_minmax(hoco[2], minmaxf);
- if(vlr->v4) {
+ if (vlr->v4) {
projectvert(vlr->v4->co, winmat, hoco[3]); d4= testclip_minmax(hoco[3], minmaxf);
}
/* minmax clipping */
- if(vlr->v4) partclip= d1 & d2 & d3 & d4;
+ if (vlr->v4) partclip= d1 & d2 & d3 & d4;
else partclip= d1 & d2 & d3;
- if(partclip==0) {
+ if (partclip==0) {
/* window clipping */
c1= testclip(hoco[0]);
c2= testclip(hoco[1]);
c3= testclip(hoco[2]);
- if(vlr->v4)
+ if (vlr->v4)
c4= testclip(hoco[3]);
/* ***** NO WIRE YET */
- if(ma->material_type == MA_TYPE_WIRE) {
- if(vlr->v4)
+ if (ma->material_type == MA_TYPE_WIRE) {
+ if (vlr->v4)
zbufclipwire(&zspan, i, a+1, vlr->ec, hoco[0], hoco[1], hoco[2], hoco[3], c1, c2, c3, c4);
else
zbufclipwire(&zspan, i, a+1, vlr->ec, hoco[0], hoco[1], hoco[2], 0, c1, c2, c3, 0);
}
- else if(vlr->v4) {
- if(vlr->flag & R_STRAND)
+ else if (vlr->v4) {
+ if (vlr->flag & R_STRAND)
zbufclip4(&zspanstrand, i, a+1, hoco[0], hoco[1], hoco[2], hoco[3], c1, c2, c3, c4);
else
zbufclip4(&zspan, i, a+1, hoco[0], hoco[1], hoco[2], hoco[3], c1, c2, c3, c4);
@@ -2066,7 +2067,7 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
RE_vlakren_get_normal(&R, obi, vlr, nor);
copy_v3_v3(v1, vlr->v1->co);
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mul_m4_v3(obi->mat, v1);
/* from shadepixel() */
@@ -2074,7 +2075,7 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
hoco[3]= 1.0f;
/* ortho viewplane cannot intersect using view vector originating in (0,0,0) */
- if(R.r.mode & R_ORTHO) {
+ if (R.r.mode & R_ORTHO) {
/* x and y 3d coordinate can be derived from pixel coord and winmat */
float fx= 2.0f/(R.winx*R.winmat[0][0]);
float fy= 2.0f/(R.winy*R.winmat[1][1]);
@@ -2083,7 +2084,7 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
hoco[1]= (y - 0.5f*R.winy)*fy - R.winmat[3][1]/R.winmat[1][1];
/* using a*x + b*y + c*z = d equation, (a b c) is normal */
- if(nor[2]!=0.0f)
+ if (nor[2]!=0.0f)
hoco[2]= (dface - nor[0]*hoco[0] - nor[1]*hoco[1])/nor[2];
else
hoco[2]= 0.0f;
@@ -2110,11 +2111,11 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
/* clip We can test for -1.0/1.0 because of the properties of the
* coordinate transformations. */
fac= fabs(hoco[3]);
- if(hoco[0]<-fac || hoco[0]>fac)
+ if (hoco[0]<-fac || hoco[0]>fac)
return 0;
- if(hoco[1]<-fac || hoco[1]>fac)
+ if (hoco[1]<-fac || hoco[1]>fac)
return 0;
- if(hoco[2]<-fac || hoco[2]>fac)
+ if (hoco[2]<-fac || hoco[2]>fac)
return 0;
siz= 0.5f*(float)shb->size;
@@ -2135,7 +2136,7 @@ static void isb_add_shadfac(ISBShadfacA **isbsapp, MemArena *mem, int obi, int f
float shadfacf;
/* in osa case, the samples were filled in with factor 1.0/R.osa. if fewer samples we have to correct */
- if(R.osa)
+ if (R.osa)
shadfacf= ((float)shadfac*R.osa)/(4096.0f*samples);
else
shadfacf= ((float)shadfac)/(4096.0f);
@@ -2144,7 +2145,7 @@ static void isb_add_shadfac(ISBShadfacA **isbsapp, MemArena *mem, int obi, int f
new->obi= obi;
new->facenr= facenr & ~RE_QUAD_OFFS;
new->shadfac= shadfacf;
- if(*isbsapp)
+ if (*isbsapp)
new->next= (*isbsapp);
else
new->next= NULL;
@@ -2161,25 +2162,25 @@ static int isb_add_samples(RenderPart *pa, ISBBranch *root, MemArena *memarena,
/* bsp split doesn't like to handle regular sequences */
xcos= MEM_mallocN( pa->rectx*sizeof(int), "xcos");
ycos= MEM_mallocN( pa->recty*sizeof(int), "ycos");
- for(xi=0; xi<pa->rectx; xi++)
+ for (xi=0; xi<pa->rectx; xi++)
xcos[xi]= xi;
- for(yi=0; yi<pa->recty; yi++)
+ for (yi=0; yi<pa->recty; yi++)
ycos[yi]= yi;
BLI_array_randomize(xcos, sizeof(int), pa->rectx, 12345);
BLI_array_randomize(ycos, sizeof(int), pa->recty, 54321);
- for(sample=0; sample<(R.osa?R.osa:1); sample++) {
+ for (sample=0; sample<(R.osa?R.osa:1); sample++) {
ISBSample *samp= samplebuf[sample], *samp1;
- for(yi=0; yi<pa->recty; yi++) {
+ for (yi=0; yi<pa->recty; yi++) {
int y= ycos[yi];
- for(xi=0; xi<pa->rectx; xi++) {
+ for (xi=0; xi<pa->rectx; xi++) {
int x= xcos[xi];
samp1= samp + y*pa->rectx + x;
- if(samp1->facenr)
+ if (samp1->facenr)
bsp_err |= isb_bsp_insert(root, memarena, samp1);
}
- if(bsp_err) break;
+ if (bsp_err) break;
}
}
@@ -2215,47 +2216,47 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
BLI_memarena_use_calloc(memarena);
/* samplebuf is in camera view space (pixels) */
- for(sample=0; sample<(R.osa?R.osa:1); sample++)
+ for (sample=0; sample<(R.osa?R.osa:1); sample++)
samplebuf[sample]= MEM_callocN(sizeof(ISBSample)*pa->rectx*pa->recty, "isb samplebuf");
/* for end result, ISBSamples point to this in non OSA case, otherwise to pixstruct->shadfac */
- if(R.osa==0)
+ if (R.osa==0)
isbdata->shadfacs= MEM_callocN(pa->rectx*pa->recty*sizeof(short), "isb shadfacs");
/* setup bsp root */
memset(&root, 0, sizeof(ISBBranch));
- root.box.xmin= (float)shb->size;
- root.box.ymin= (float)shb->size;
+ root.box.xmin = (float)shb->size;
+ root.box.ymin = (float)shb->size;
/* create the sample buffers */
- for(sindex=0, y=0; y<pa->recty; y++) {
- for(x=0; x<pa->rectx; x++, sindex++) {
+ for (sindex=0, y=0; y<pa->recty; y++) {
+ for (x=0; x<pa->rectx; x++, sindex++) {
/* this makes it a long function, but splitting it out would mean 10+ arguments */
/* first check OSA case */
- if(R.osa) {
+ if (R.osa) {
rd= pa->rectdaps + sindex;
- if(*rd) {
+ if (*rd) {
float xs= (float)(x + pa->disprect.xmin);
float ys= (float)(y + pa->disprect.ymin);
- for(sample=0; sample<R.osa; sample++) {
+ for (sample=0; sample<R.osa; sample++) {
PixStr *ps= (PixStr *)(*rd);
int mask= (1<<sample);
while(ps) {
- if(ps->mask & mask)
+ if (ps->mask & mask)
break;
ps= ps->next;
}
- if(ps && ps->facenr>0) {
+ if (ps && ps->facenr>0) {
ObjectInstanceRen *obi= &R.objectinstance[ps->obi];
ObjectRen *obr= obi->obr;
VlakRen *vlr= RE_findOrAddVlak(obr, (ps->facenr-1) & RE_QUAD_MASK);
samp= samplebuf[sample] + sindex;
/* convert image plane pixel location to lamp buffer space */
- if(viewpixel_to_lampbuf(shb, obi, vlr, xs + R.jit[sample][0], ys + R.jit[sample][1], samp->zco)) {
+ if (viewpixel_to_lampbuf(shb, obi, vlr, xs + R.jit[sample][0], ys + R.jit[sample][1], samp->zco)) {
samp->obi= ps->obi;
samp->facenr= ps->facenr & ~RE_QUAD_OFFS;
ps->shadfac= 0;
@@ -2269,7 +2270,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
else {
rectp= pa->rectp + sindex;
recto= pa->recto + sindex;
- if(*rectp>0) {
+ if (*rectp>0) {
ObjectInstanceRen *obi= &R.objectinstance[*recto];
ObjectRen *obr= obi->obr;
VlakRen *vlr= RE_findOrAddVlak(obr, (*rectp-1) & RE_QUAD_MASK);
@@ -2278,7 +2279,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
samp= samplebuf[0] + sindex;
/* convert image plane pixel location to lamp buffer space */
- if(viewpixel_to_lampbuf(shb, obi, vlr, xs, ys, samp->zco)) {
+ if (viewpixel_to_lampbuf(shb, obi, vlr, xs, ys, samp->zco)) {
samp->obi= *recto;
samp->facenr= *rectp & ~RE_QUAD_OFFS;
samp->shadfac= isbdata->shadfacs + sindex;
@@ -2290,7 +2291,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
}
/* simple method to see if we have samples */
- if(root.box.xmin != (float)shb->size) {
+ if (root.box.xmin != (float)shb->size) {
/* now create a regular split, root.box has the initial bounding box of all pixels */
/* split bsp 8 levels deep, in regular grid (16 x 16) */
isb_bsp_split_init(&root, memarena, 8);
@@ -2298,24 +2299,24 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
/* insert all samples in BSP now */
bsp_err= isb_add_samples(pa, &root, memarena, samplebuf);
- if(bsp_err==0) {
+ if (bsp_err==0) {
/* go over all faces and fill in shadow values */
isb_bsp_fillfaces(&R, lar, &root); /* shb->persmat should have been calculated */
/* copy shadow samples to persistent buffer, reduce memory overhead */
- if(R.osa) {
+ if (R.osa) {
ISBShadfacA **isbsa= isbdata->shadfaca= MEM_callocN(pa->rectx*pa->recty*sizeof(void *), "isb shadfacs");
isbdata->memarena = BLI_memarena_new(0x8000 * sizeof(ISBSampleA), "isb arena");
BLI_memarena_use_calloc(isbdata->memarena);
- for(rd= pa->rectdaps, x=pa->rectx*pa->recty; x>0; x--, rd++, isbsa++) {
+ for (rd= pa->rectdaps, x=pa->rectx*pa->recty; x>0; x--, rd++, isbsa++) {
- if(*rd) {
+ if (*rd) {
PixStr *ps= (PixStr *)(*rd);
while(ps) {
- if(ps->shadfac)
+ if (ps->shadfac)
isb_add_shadfac(isbsa, isbdata->memarena, ps->obi, ps->facenr, ps->shadfac, count_mask(ps->mask));
ps= ps->next;
}
@@ -2325,7 +2326,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
}
}
else {
- if(isbdata->shadfacs) {
+ if (isbdata->shadfacs) {
MEM_freeN(isbdata->shadfacs);
isbdata->shadfacs= NULL;
}
@@ -2335,10 +2336,10 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
BLI_memarena_free(memarena);
/* free samples */
- for(x=0; x<(R.osa?R.osa:1); x++)
+ for (x=0; x<(R.osa?R.osa:1); x++)
MEM_freeN(samplebuf[x]);
- if(bsp_err) printf("error in filling bsp\n");
+ if (bsp_err) printf("error in filling bsp\n");
}
/* add sample to buffer, isbsa is the root sample in a buffer */
@@ -2347,7 +2348,7 @@ static ISBSampleA *isb_alloc_sample_transp(ISBSampleA **isbsa, MemArena *mem)
ISBSampleA *new;
new= BLI_memarena_alloc(mem, sizeof(ISBSampleA));
- if(*isbsa)
+ if (*isbsa)
new->next= (*isbsa);
else
new->next= NULL;
@@ -2365,19 +2366,19 @@ static int isb_add_samples_transp(RenderPart *pa, ISBBranch *root, MemArena *mem
/* bsp split doesn't like to handle regular sequences */
xcos= MEM_mallocN( pa->rectx*sizeof(int), "xcos");
ycos= MEM_mallocN( pa->recty*sizeof(int), "ycos");
- for(xi=0; xi<pa->rectx; xi++)
+ for (xi=0; xi<pa->rectx; xi++)
xcos[xi]= xi;
- for(yi=0; yi<pa->recty; yi++)
+ for (yi=0; yi<pa->recty; yi++)
ycos[yi]= yi;
BLI_array_randomize(xcos, sizeof(int), pa->rectx, 12345);
BLI_array_randomize(ycos, sizeof(int), pa->recty, 54321);
- for(sample=0; sample<(R.osa?R.osa:1); sample++) {
+ for (sample=0; sample<(R.osa?R.osa:1); sample++) {
ISBSampleA **samp= samplebuf[sample], *samp1;
- for(yi=0; yi<pa->recty; yi++) {
+ for (yi=0; yi<pa->recty; yi++) {
int y= ycos[yi];
- for(xi=0; xi<pa->rectx; xi++) {
+ for (xi=0; xi<pa->rectx; xi++) {
int x= xcos[xi];
samp1= *(samp + y*pa->rectx + x);
@@ -2386,7 +2387,7 @@ static int isb_add_samples_transp(RenderPart *pa, ISBBranch *root, MemArena *mem
samp1= samp1->next;
}
}
- if(bsp_err) break;
+ if (bsp_err) break;
}
}
@@ -2423,27 +2424,27 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
BLI_memarena_use_calloc(memarena);
/* samplebuf is in camera view space (pixels) */
- for(sample=0; sample<(R.osa?R.osa:1); sample++)
+ for (sample=0; sample<(R.osa?R.osa:1); sample++)
samplebuf[sample]= MEM_callocN(sizeof(void *)*pa->rectx*pa->recty, "isb alpha samplebuf");
/* setup bsp root */
memset(&root, 0, sizeof(ISBBranch));
- root.box.xmin= (float)shb->size;
- root.box.ymin= (float)shb->size;
+ root.box.xmin = (float)shb->size;
+ root.box.ymin = (float)shb->size;
/* create the sample buffers */
- for(ap= apixbuf, sindex=0, y=0; y<pa->recty; y++) {
- for(x=0; x<pa->rectx; x++, sindex++, ap++) {
+ for (ap= apixbuf, sindex=0, y=0; y<pa->recty; y++) {
+ for (x=0; x<pa->rectx; x++, sindex++, ap++) {
- if(ap->p[0]) {
+ if (ap->p[0]) {
APixstr *apn;
float xs= (float)(x + pa->disprect.xmin);
float ys= (float)(y + pa->disprect.ymin);
- for(apn=ap; apn; apn= apn->next) {
+ for (apn=ap; apn; apn= apn->next) {
int a;
- for(a=0; a<4; a++) {
- if(apn->p[a]) {
+ for (a=0; a<4; a++) {
+ if (apn->p[a]) {
ObjectInstanceRen *obi= &R.objectinstance[apn->obi[a]];
ObjectRen *obr= obi->obr;
VlakRen *vlr= RE_findOrAddVlak(obr, (apn->p[a]-1) & RE_QUAD_MASK);
@@ -2452,14 +2453,14 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
/* here we store shadfac, easier to create the end storage buffer. needs zero'ed, multiple shadowbufs use it */
apn->shadfac[a]= 0;
- if(R.osa) {
- for(sample=0; sample<R.osa; sample++) {
+ if (R.osa) {
+ for (sample=0; sample<R.osa; sample++) {
int mask= (1<<sample);
- if(apn->mask[a] & mask) {
+ if (apn->mask[a] & mask) {
/* convert image plane pixel location to lamp buffer space */
- if(viewpixel_to_lampbuf(shb, obi, vlr, xs + R.jit[sample][0], ys + R.jit[sample][1], zco)) {
+ if (viewpixel_to_lampbuf(shb, obi, vlr, xs + R.jit[sample][0], ys + R.jit[sample][1], zco)) {
samp= isb_alloc_sample_transp(samplebuf[sample] + sindex, memarena);
samp->obi= apn->obi[a];
samp->facenr= apn->p[a] & ~RE_QUAD_OFFS;
@@ -2474,7 +2475,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
else {
/* convert image plane pixel location to lamp buffer space */
- if(viewpixel_to_lampbuf(shb, obi, vlr, xs, ys, zco)) {
+ if (viewpixel_to_lampbuf(shb, obi, vlr, xs, ys, zco)) {
samp= isb_alloc_sample_transp(samplebuf[0] + sindex, memarena);
samp->obi= apn->obi[a];
@@ -2493,7 +2494,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
}
/* simple method to see if we have samples */
- if(root.box.xmin != (float)shb->size) {
+ if (root.box.xmin != (float)shb->size) {
/* now create a regular split, root.box has the initial bounding box of all pixels */
/* split bsp 8 levels deep, in regular grid (16 x 16) */
isb_bsp_split_init(&root, memarena, 8);
@@ -2501,7 +2502,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
/* insert all samples in BSP now */
bsp_err= isb_add_samples_transp(pa, &root, memarena, samplebuf);
- if(bsp_err==0) {
+ if (bsp_err==0) {
ISBShadfacA **isbsa;
/* go over all faces and fill in shadow values */
@@ -2512,15 +2513,15 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
isbdata->memarena = BLI_memarena_new(0x8000 * sizeof(ISBSampleA), "isb arena");
- for(ap= apixbuf, x=pa->rectx*pa->recty; x>0; x--, ap++, isbsa++) {
+ for (ap= apixbuf, x=pa->rectx*pa->recty; x>0; x--, ap++, isbsa++) {
- if(ap->p[0]) {
+ if (ap->p[0]) {
APixstr *apn;
- for(apn=ap; apn; apn= apn->next) {
+ for (apn=ap; apn; apn= apn->next) {
int a;
- for(a=0; a<4; a++) {
- if(apn->p[a] && apn->shadfac[a]) {
- if(R.osa)
+ for (a=0; a<4; a++) {
+ if (apn->p[a] && apn->shadfac[a]) {
+ if (R.osa)
isb_add_shadfac(isbsa, isbdata->memarena, apn->obi[a], apn->p[a], apn->shadfac[a], count_mask(apn->mask[a]));
else
isb_add_shadfac(isbsa, isbdata->memarena, apn->obi[a], apn->p[a], apn->shadfac[a], 0);
@@ -2536,10 +2537,10 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
BLI_memarena_free(memarena);
/* free samples */
- for(x=0; x<(R.osa?R.osa:1); x++)
+ for (x=0; x<(R.osa?R.osa:1); x++)
MEM_freeN(samplebuf[x]);
- if(bsp_err) printf("error in filling bsp\n");
+ if (bsp_err) printf("error in filling bsp\n");
}
@@ -2551,18 +2552,18 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
float ISB_getshadow(ShadeInput *shi, ShadBuf *shb)
{
/* if raytracing, we can't accept irregular shadow */
- if(shi->depth==0) {
+ if (shi->depth==0) {
ISBData *isbdata= shb->isb_result[shi->thread];
- if(isbdata) {
- if(isbdata->shadfacs || isbdata->shadfaca) {
+ if (isbdata) {
+ if (isbdata->shadfacs || isbdata->shadfaca) {
int x= shi->xs - isbdata->minx;
- if(x >= 0 && x < isbdata->rectx) {
+ if (x >= 0 && x < isbdata->rectx) {
int y= shi->ys - isbdata->miny;
- if(y >= 0 && y < isbdata->recty) {
- if(isbdata->shadfacs) {
+ if (y >= 0 && y < isbdata->recty) {
+ if (isbdata->shadfacs) {
short *sp= isbdata->shadfacs + y*isbdata->rectx + x;
return *sp>=4096?0.0f:1.0f - ((float)*sp)/4096.0f;
}
@@ -2572,7 +2573,7 @@ float ISB_getshadow(ShadeInput *shi, ShadBuf *shb)
ISBShadfacA *isbsa= *(isbdata->shadfaca + sindex);
while(isbsa) {
- if(isbsa->facenr==shi->facenr+1 && isbsa->obi==obi)
+ if (isbsa->facenr==shi->facenr+1 && isbsa->obi==obi)
return isbsa->shadfac>=1.0f?0.0f:1.0f - isbsa->shadfac;
isbsa= isbsa->next;
}
@@ -2591,15 +2592,15 @@ void ISB_create(RenderPart *pa, APixstr *apixbuf)
GroupObject *go;
/* go over all lamps, and make the irregular buffers */
- for(go=R.lights.first; go; go= go->next) {
+ for (go=R.lights.first; go; go= go->next) {
LampRen *lar= go->lampren;
- if(lar->type==LA_SPOT && lar->shb && lar->buftype==LA_SHADBUF_IRREGULAR) {
+ if (lar->type==LA_SPOT && lar->shb && lar->buftype==LA_SHADBUF_IRREGULAR) {
/* create storage for shadow, per thread */
lar->shb->isb_result[pa->thread]= MEM_callocN(sizeof(ISBData), "isb data");
- if(apixbuf)
+ if (apixbuf)
isb_make_buffer_transp(pa, apixbuf, lar);
else
isb_make_buffer(pa, lar);
@@ -2614,19 +2615,19 @@ void ISB_free(RenderPart *pa)
GroupObject *go;
/* go over all lamps, and free the irregular buffers */
- for(go=R.lights.first; go; go= go->next) {
+ for (go=R.lights.first; go; go= go->next) {
LampRen *lar= go->lampren;
- if(lar->type==LA_SPOT && lar->shb && lar->buftype==LA_SHADBUF_IRREGULAR) {
+ if (lar->type==LA_SPOT && lar->shb && lar->buftype==LA_SHADBUF_IRREGULAR) {
ISBData *isbdata= lar->shb->isb_result[pa->thread];
- if(isbdata) {
- if(isbdata->shadfacs)
+ if (isbdata) {
+ if (isbdata->shadfacs)
MEM_freeN(isbdata->shadfacs);
- if(isbdata->shadfaca)
+ if (isbdata->shadfaca)
MEM_freeN(isbdata->shadfaca);
- if(isbdata->memarena)
+ if (isbdata->memarena)
BLI_memarena_free(isbdata->memarena);
MEM_freeN(isbdata);
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index 29c1318727c..611c21cf0f2 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -108,7 +108,7 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr)
shade_lamp_loop(shi, shr); /* clears shr */
- if(shi->translucency!=0.0f) {
+ if (shi->translucency!=0.0f) {
ShadeResult shr_t;
float fac= shi->translucency;
@@ -121,11 +121,11 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr)
/* a couple of passes */
VECADDISFAC(shr->combined, shr_t.combined, fac);
- if(shi->passflag & SCE_PASS_SPEC)
+ if (shi->passflag & SCE_PASS_SPEC)
VECADDISFAC(shr->spec, shr_t.spec, fac);
- if(shi->passflag & SCE_PASS_DIFFUSE)
+ if (shi->passflag & SCE_PASS_DIFFUSE)
VECADDISFAC(shr->diff, shr_t.diff, fac);
- if(shi->passflag & SCE_PASS_SHADOW)
+ if (shi->passflag & SCE_PASS_SHADOW)
VECADDISFAC(shr->shad, shr_t.shad, fac);
negate_v3(shi->vn);
@@ -133,20 +133,20 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr)
}
/* depth >= 1 when ray-shading */
- if(shi->depth==0 || shi->volume_depth > 0) {
- if(R.r.mode & R_RAYTRACE) {
- if(shi->ray_mirror!=0.0f || ((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) {
+ if (shi->depth==0 || shi->volume_depth > 0) {
+ if (R.r.mode & R_RAYTRACE) {
+ if (shi->ray_mirror!=0.0f || ((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) {
/* ray trace works on combined, but gives pass info */
ray_trace(shi, shr);
}
}
/* disable adding of sky for raytransp */
- if((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP))
- if((shi->layflag & SCE_LAY_SKY) && (R.r.alphamode==R_ADDSKY))
+ if ((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP))
+ if ((shi->layflag & SCE_LAY_SKY) && (R.r.alphamode==R_ADDSKY))
shr->alpha= 1.0f;
}
- if(R.r.mode & R_RAYTRACE) {
+ if (R.r.mode & R_RAYTRACE) {
if (R.render_volumes_inside.first)
shade_volume_inside(shi, shr);
}
@@ -163,7 +163,7 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
memset(&shi->raycounter, 0, sizeof(shi->raycounter));
#endif
- if(shi->mat->nodetree && shi->mat->use_nodes) {
+ if (shi->mat->nodetree && shi->mat->use_nodes) {
ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
}
else {
@@ -171,36 +171,37 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
shade_input_init_material(shi);
if (shi->mat->material_type == MA_TYPE_VOLUME) {
- if(R.r.mode & R_RAYTRACE) {
+ if (R.r.mode & R_RAYTRACE) {
shade_volume_outside(shi, shr);
}
- } else { /* MA_TYPE_SURFACE, MA_TYPE_WIRE */
+ }
+ else { /* MA_TYPE_SURFACE, MA_TYPE_WIRE */
shade_material_loop(shi, shr);
}
}
/* copy additional passes */
- if(shi->passflag & (SCE_PASS_VECTOR|SCE_PASS_NORMAL)) {
+ if (shi->passflag & (SCE_PASS_VECTOR|SCE_PASS_NORMAL)) {
copy_v4_v4(shr->winspeed, shi->winspeed);
copy_v3_v3(shr->nor, shi->vn);
}
/* MIST */
- if((shi->passflag & SCE_PASS_MIST) || ((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0)) {
- if(R.r.mode & R_ORTHO)
+ if ((shi->passflag & SCE_PASS_MIST) || ((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0)) {
+ if (R.r.mode & R_ORTHO)
shr->mist= mistfactor(-shi->co[2], shi->co);
else
shr->mist= mistfactor(len_v3(shi->co), shi->co);
}
else shr->mist= 0.0f;
- if((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0 ) {
+ if ((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0 ) {
alpha= shr->mist;
}
else alpha= 1.0f;
/* add mist and premul color */
- if(shr->alpha!=1.0f || alpha!=1.0f) {
+ if (shr->alpha!=1.0f || alpha!=1.0f) {
float fac= alpha*(shr->alpha);
shr->combined[3]= fac;
@@ -215,7 +216,7 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
/* RAYHITS */
#if 0
- if(1 || shi->passflag & SCE_PASS_RAYHITS) {
+ if (1 || shi->passflag & SCE_PASS_RAYHITS) {
shr->rayhits[0] = (float)shi->raycounter.faces.test;
shr->rayhits[1] = (float)shi->raycounter.bb.hit;
shr->rayhits[2] = 0.0;
@@ -240,15 +241,15 @@ void vlr_set_uv_indices(VlakRen *vlr, int *i1, int *i2, int *i3)
/* 1---2 1---2 0 = orig face, 1 = new face */
/* Update vert nums to point to correct verts of original face */
- if(vlr->flag & R_DIVIDE_24) {
- if(vlr->flag & R_FACE_SPLIT) {
+ if (vlr->flag & R_DIVIDE_24) {
+ if (vlr->flag & R_FACE_SPLIT) {
(*i1)++; (*i2)++; (*i3)++;
}
else {
(*i3)++;
}
}
- else if(vlr->flag & R_FACE_SPLIT) {
+ else if (vlr->flag & R_FACE_SPLIT) {
(*i2)++; (*i3)++;
}
}
@@ -282,12 +283,12 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen
RE_vlakren_get_normal(&R, obi, vlr, shi->facenor);
/* calculate vertexnormals */
- if(vlr->flag & R_SMOOTH) {
+ if (vlr->flag & R_SMOOTH) {
copy_v3_v3(shi->n1, shi->v1->n);
copy_v3_v3(shi->n2, shi->v2->n);
copy_v3_v3(shi->n3, shi->v3->n);
- if(obi->flag & R_TRANSFORMED) {
+ if (obi->flag & R_TRANSFORMED) {
mul_m3_v3(obi->nmat, shi->n1); normalize_v3(shi->n1);
mul_m3_v3(obi->nmat, shi->n2); normalize_v3(shi->n2);
mul_m3_v3(obi->nmat, shi->n3); normalize_v3(shi->n3);
@@ -302,14 +303,14 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen
/* copy data from face to ShadeInput, scanline case */
void shade_input_set_triangle(ShadeInput *shi, volatile int obi, volatile int facenr, int UNUSED(normal_flip))
{
- if(facenr>0) {
+ if (facenr>0) {
shi->obi= &R.objectinstance[obi];
shi->obr= shi->obi->obr;
shi->facenr= (facenr-1) & RE_QUAD_MASK;
- if( shi->facenr < shi->obr->totvlak ) {
+ if ( shi->facenr < shi->obr->totvlak ) {
VlakRen *vlr= RE_findOrAddVlak(shi->obr, shi->facenr);
- if(facenr & RE_QUAD_OFFS)
+ if (facenr & RE_QUAD_OFFS)
shade_input_set_triangle_i(shi, shi->obi, vlr, 0, 2, 3);
else
shade_input_set_triangle_i(shi, shi->obi, vlr, 0, 1, 2);
@@ -345,7 +346,7 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo
shi->xs= (int)spoint->x;
shi->ys= (int)spoint->y;
- if(shi->osatex || (R.r.mode & R_SHADOW)) {
+ if (shi->osatex || (R.r.mode & R_SHADOW)) {
copy_v3_v3(shi->dxco, spoint->dtco);
copy_v3_v3(shi->dyco, spoint->dsco);
}
@@ -356,7 +357,7 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo
copy_v3_v3(shi->facenor, spoint->nor);
/* shade_input_set_normals equivalent */
- if(shi->mat->mode & MA_TANGENT_STR) {
+ if (shi->mat->mode & MA_TANGENT_STR) {
copy_v3_v3(shi->vn, spoint->tan);
}
else {
@@ -366,7 +367,7 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo
cross_v3_v3v3(shi->vn, cross, spoint->tan);
normalize_v3(shi->vn);
- if(dot_v3v3(shi->vn, shi->view) < 0.0f)
+ if (dot_v3v3(shi->vn, shi->view) < 0.0f)
negate_v3(shi->vn);
}
@@ -381,57 +382,57 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
int mode= shi->mode; /* or-ed result for all nodes */
short texco= shi->mat->texco;
- if((shi->mat->texco & TEXCO_REFL)) {
+ if ((shi->mat->texco & TEXCO_REFL)) {
/* shi->dxview, shi->dyview, not supported */
}
- if(shi->osatex && (texco & (TEXCO_NORM|TEXCO_REFL))) {
+ if (shi->osatex && (texco & (TEXCO_NORM|TEXCO_REFL))) {
/* not supported */
}
- if(mode & (MA_TANGENT_V|MA_NORMAP_TANG)) {
+ if (mode & (MA_TANGENT_V|MA_NORMAP_TANG)) {
copy_v3_v3(shi->tang, spoint->tan);
copy_v3_v3(shi->nmaptang, spoint->tan);
}
- if(mode & MA_STR_SURFDIFF) {
+ if (mode & MA_STR_SURFDIFF) {
float *surfnor= RE_strandren_get_surfnor(obr, strand, 0);
- if(surfnor)
+ if (surfnor)
copy_v3_v3(shi->surfnor, surfnor);
else
copy_v3_v3(shi->surfnor, shi->vn);
- if(shi->mat->strand_surfnor > 0.0f) {
+ if (shi->mat->strand_surfnor > 0.0f) {
shi->surfdist= 0.0f;
- for(sv=strand->vert; sv!=svert; sv++)
+ for (sv=strand->vert; sv!=svert; sv++)
shi->surfdist+=len_v3v3(sv->co, (sv+1)->co);
shi->surfdist += spoint->t*len_v3v3(sv->co, (sv+1)->co);
}
}
- if(R.r.mode & R_SPEED) {
+ if (R.r.mode & R_SPEED) {
float *speed;
speed= RE_strandren_get_winspeed(shi->obi, strand, 0);
- if(speed)
+ if (speed)
copy_v4_v4(shi->winspeed, speed);
else
shi->winspeed[0]= shi->winspeed[1]= shi->winspeed[2]= shi->winspeed[3]= 0.0f;
}
/* shade_input_set_shade_texco equivalent */
- if(texco & NEED_UV) {
- if(texco & TEXCO_ORCO) {
+ if (texco & NEED_UV) {
+ if (texco & TEXCO_ORCO) {
copy_v3_v3(shi->lo, strand->orco);
/* no shi->osatex, orco derivatives are zero */
}
- if(texco & TEXCO_GLOB) {
+ if (texco & TEXCO_GLOB) {
copy_v3_v3(shi->gl, shi->co);
mul_m4_v3(R.viewinv, shi->gl);
- if(shi->osatex) {
+ if (shi->osatex) {
copy_v3_v3(shi->dxgl, shi->dxco);
mul_mat3_m4_v3(R.viewinv, shi->dxgl);
copy_v3_v3(shi->dygl, shi->dyco);
@@ -439,16 +440,16 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
}
}
- if(texco & TEXCO_STRAND) {
+ if (texco & TEXCO_STRAND) {
shi->strandco= spoint->strandco;
- if(shi->osatex) {
+ if (shi->osatex) {
shi->dxstrand= spoint->dtstrandco;
shi->dystrand= 0.0f;
}
}
- if((texco & TEXCO_UV) || (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE))) {
+ if ((texco & TEXCO_UV) || (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE))) {
MCol *mcol;
float *uv;
char *name;
@@ -459,7 +460,7 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
shi->actuv= obr->actmtface;
shi->actcol= obr->actmcol;
- if(mode & (MA_VERTEXCOL|MA_VERTEXCOLP)) {
+ if (mode & (MA_VERTEXCOL|MA_VERTEXCOLP)) {
for (i=0; (mcol=RE_strandren_get_mcol(obr, strand, i, &name, 0)); i++) {
ShadeInputCol *scol= &shi->col[i];
char *cp= (char*)mcol;
@@ -473,7 +474,7 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
scol->col[3]= cp[0]/255.0f;
}
- if(shi->totcol) {
+ if (shi->totcol) {
shi->vcol[0]= shi->col[shi->actcol].col[0];
shi->vcol[1]= shi->col[shi->actcol].col[1];
shi->vcol[2]= shi->col[shi->actcol].col[2];
@@ -493,7 +494,7 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
shi->totuv++;
suv->name= name;
- if(strandbuf->overrideuv == i) {
+ if (strandbuf->overrideuv == i) {
suv->uv[0]= -1.0f;
suv->uv[1]= spoint->strandco;
suv->uv[2]= 0.0f;
@@ -504,15 +505,15 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
suv->uv[2]= 0.0f; /* texture.c assumes there are 3 coords */
}
- if(shi->osatex) {
+ if (shi->osatex) {
suv->dxuv[0]= 0.0f;
suv->dxuv[1]= 0.0f;
suv->dyuv[0]= 0.0f;
suv->dyuv[1]= 0.0f;
}
- if((mode & MA_FACETEXTURE) && i==obr->actmtface) {
- if((mode & (MA_VERTEXCOL|MA_VERTEXCOLP))==0) {
+ if ((mode & MA_FACETEXTURE) && i==obr->actmtface) {
+ if ((mode & (MA_VERTEXCOL|MA_VERTEXCOLP))==0) {
shi->vcol[0]= 1.0f;
shi->vcol[1]= 1.0f;
shi->vcol[2]= 1.0f;
@@ -521,14 +522,14 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
}
}
- if(shi->totuv == 0) {
+ if (shi->totuv == 0) {
ShadeInputUV *suv= &shi->uv[0];
suv->uv[0]= 0.0f;
suv->uv[1]= spoint->strandco;
suv->uv[2]= 0.0f; /* texture.c assumes there are 3 coords */
- if(mode & MA_FACETEXTURE) {
+ if (mode & MA_FACETEXTURE) {
/* no tface? set at 1.0f */
shi->vcol[0]= 1.0f;
shi->vcol[1]= 1.0f;
@@ -539,18 +540,18 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
}
- if(texco & TEXCO_NORM) {
+ if (texco & TEXCO_NORM) {
shi->orn[0]= -shi->vn[0];
shi->orn[1]= -shi->vn[1];
shi->orn[2]= -shi->vn[2];
}
- if(texco & TEXCO_STRESS) {
+ if (texco & TEXCO_STRESS) {
/* not supported */
}
- if(texco & TEXCO_TANGENT) {
- if((mode & MA_TANGENT_V)==0) {
+ if (texco & TEXCO_TANGENT) {
+ if ((mode & MA_TANGENT_V)==0) {
/* just prevent surprises */
shi->tang[0]= shi->tang[1]= shi->tang[2]= 0.0f;
shi->nmaptang[0]= shi->nmaptang[1]= shi->nmaptang[2]= 0.0f;
@@ -559,14 +560,14 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
}
/* this only avalailable for scanline renders */
- if(shi->depth==0) {
- if(texco & TEXCO_WINDOW) {
+ if (shi->depth==0) {
+ if (texco & TEXCO_WINDOW) {
shi->winco[0]= -1.0f + 2.0f*spoint->x/(float)R.winx;
shi->winco[1]= -1.0f + 2.0f*spoint->y/(float)R.winy;
shi->winco[2]= 0.0f;
/* not supported */
- if(shi->osatex) {
+ if (shi->osatex) {
shi->dxwin[0]= 0.0f;
shi->dywin[1]= 0.0f;
shi->dxwin[0]= 0.0f;
@@ -574,13 +575,13 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
}
}
- if(texco & TEXCO_STICKY) {
+ if (texco & TEXCO_STICKY) {
/* not supported */
}
}
if (shi->do_manage) {
- if(mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) {
+ if (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) {
srgb_to_linearrgb_v3_v3(shi->vcol, shi->vcol);
}
}
@@ -593,10 +594,10 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float v
/* returns not normalized, so is in viewplane coords */
calc_view_vector(view, x, y);
- if(shi->mat->material_type == MA_TYPE_WIRE) {
+ if (shi->mat->material_type == MA_TYPE_WIRE) {
/* wire cannot use normal for calculating shi->co, so
* we reconstruct the coordinate less accurate */
- if(R.r.mode & R_ORTHO)
+ if (R.r.mode & R_ORTHO)
calc_renderco_ortho(co, x, y, z);
else
calc_renderco_zbuf(co, view, z);
@@ -606,13 +607,13 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float v
float fac, dface, v1[3];
copy_v3_v3(v1, shi->v1->co);
- if(shi->obi->flag & R_TRANSFORMED)
+ if (shi->obi->flag & R_TRANSFORMED)
mul_m4_v3(shi->obi->mat, v1);
dface = dot_v3v3(v1, shi->facenor);
/* ortho viewplane cannot intersect using view vector originating in (0,0,0) */
- if(R.r.mode & R_ORTHO) {
+ if (R.r.mode & R_ORTHO) {
/* x and y 3d coordinate can be derived from pixel coord and winmat */
float fx= 2.0f/(R.winx*R.winmat[0][0]);
float fy= 2.0f/(R.winy*R.winmat[1][1]);
@@ -621,28 +622,28 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float v
co[1]= (y - 0.5f*R.winy)*fy - R.winmat[3][1]/R.winmat[1][1];
/* using a*x + b*y + c*z = d equation, (a b c) is normal */
- if(shi->facenor[2]!=0.0f)
+ if (shi->facenor[2]!=0.0f)
co[2]= (dface - shi->facenor[0]*co[0] - shi->facenor[1]*co[1])/shi->facenor[2];
else
co[2]= 0.0f;
- if(dxco && dyco) {
+ if (dxco && dyco) {
dxco[0]= fx;
dxco[1]= 0.0f;
- if(shi->facenor[2]!=0.0f)
+ if (shi->facenor[2]!=0.0f)
dxco[2]= -(shi->facenor[0]*fx)/shi->facenor[2];
else
dxco[2]= 0.0f;
dyco[0]= 0.0f;
dyco[1]= fy;
- if(shi->facenor[2]!=0.0f)
+ if (shi->facenor[2]!=0.0f)
dyco[2]= -(shi->facenor[1]*fy)/shi->facenor[2];
else
dyco[2]= 0.0f;
- if(dxyview) {
- if(co[2]!=0.0f) fac= 1.0f/co[2]; else fac= 0.0f;
+ if (dxyview) {
+ if (co[2]!=0.0f) fac= 1.0f/co[2]; else fac= 0.0f;
dxyview[0]= -R.viewdx*fac;
dxyview[1]= -R.viewdy*fac;
}
@@ -660,7 +661,7 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float v
co[2]= fac*view[2];
/* pixel dx/dy for render coord */
- if(dxco && dyco) {
+ if (dxco && dyco) {
float u= dface/(div - R.viewdx*shi->facenor[0]);
float v= dface/(div - R.viewdy*shi->facenor[1]);
@@ -672,8 +673,8 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float v
dyco[1]= co[1]- (view[1]-R.viewdy)*v;
dyco[2]= co[2]- (view[2])*v;
- if(dxyview) {
- if(fac!=0.0f) fac= 1.0f/fac;
+ if (dxyview) {
+ if (fac!=0.0f) fac= 1.0f/fac;
dxyview[0]= -R.viewdx*fac;
dxyview[1]= -R.viewdy*fac;
}
@@ -704,11 +705,11 @@ void shade_input_set_viewco(ShadeInput *shi, float x, float y, float xs, float y
shi->scanco[2]= z;
/* check if we need derivatives */
- if(shi->osatex || (R.r.mode & R_SHADOW)) {
+ if (shi->osatex || (R.r.mode & R_SHADOW)) {
dxco= shi->dxco;
dyco= shi->dyco;
- if((shi->mat->texco & TEXCO_REFL))
+ if ((shi->mat->texco & TEXCO_REFL))
dxyview= &shi->dxview;
}
@@ -720,27 +721,27 @@ void shade_input_set_uv(ShadeInput *shi)
{
VlakRen *vlr= shi->vlr;
- if((vlr->flag & R_SMOOTH) || (shi->mat->texco & NEED_UV) || (shi->passflag & SCE_PASS_UV)) {
+ if ((vlr->flag & R_SMOOTH) || (shi->mat->texco & NEED_UV) || (shi->passflag & SCE_PASS_UV)) {
float v1[3], v2[3], v3[3];
copy_v3_v3(v1, shi->v1->co);
copy_v3_v3(v2, shi->v2->co);
copy_v3_v3(v3, shi->v3->co);
- if(shi->obi->flag & R_TRANSFORMED) {
+ if (shi->obi->flag & R_TRANSFORMED) {
mul_m4_v3(shi->obi->mat, v1);
mul_m4_v3(shi->obi->mat, v2);
mul_m4_v3(shi->obi->mat, v3);
}
/* exception case for wire render of edge */
- if(vlr->v2==vlr->v3) {
+ if (vlr->v2==vlr->v3) {
float lend, lenc;
lend= len_v3v3(v2, v1);
lenc= len_v3v3(shi->co, v1);
- if(lend==0.0f) {
+ if (lend==0.0f) {
shi->u=shi->v= 0.0f;
}
else {
@@ -748,7 +749,7 @@ void shade_input_set_uv(ShadeInput *shi)
shi->v= 0.0f;
}
- if(shi->osatex) {
+ if (shi->osatex) {
shi->dx_u= 0.0f;
shi->dx_v= 0.0f;
shi->dy_u= 0.0f;
@@ -774,7 +775,7 @@ void shade_input_set_uv(ShadeInput *shi)
shi->u= (shi->co[axis1]-v3[axis1])*t11-(shi->co[axis2]-v3[axis2])*t10;
shi->v= (shi->co[axis2]-v3[axis2])*t00-(shi->co[axis1]-v3[axis1])*t01;
- if(shi->osatex) {
+ if (shi->osatex) {
shi->dx_u= shi->dxco[axis1]*t11- shi->dxco[axis2]*t10;
shi->dx_v= shi->dxco[axis2]*t00- shi->dxco[axis1]*t01;
shi->dy_u= shi->dyco[axis1]*t11- shi->dyco[axis2]*t10;
@@ -796,18 +797,18 @@ void shade_input_set_normals(ShadeInput *shi)
shi->flippednor = 0;
/* test flip normals to viewing direction */
- if(!(shi->vlr->flag & R_TANGENT)) {
- if(dot_v3v3(shi->facenor, shi->view) < 0.0f) {
+ if (!(shi->vlr->flag & R_TANGENT)) {
+ if (dot_v3v3(shi->facenor, shi->view) < 0.0f) {
negate_v3(shi->facenor);
shi->flippednor= 1;
}
}
/* calculate vertexnormals */
- if(shi->vlr->flag & R_SMOOTH) {
+ if (shi->vlr->flag & R_SMOOTH) {
float *n1= shi->n1, *n2= shi->n2, *n3= shi->n3;
- if(shi->flippednor) {
+ if (shi->flippednor) {
negate_v3(n1);
negate_v3(n2);
negate_v3(n3);
@@ -831,8 +832,8 @@ void shade_input_set_normals(ShadeInput *shi)
copy_v3_v3(shi->vno, shi->vn);
/* flip normals to viewing direction */
- if(!(shi->vlr->flag & R_TANGENT))
- if(dot_v3v3(shi->facenor, shi->view) < 0.0f)
+ if (!(shi->vlr->flag & R_TANGENT))
+ if (dot_v3v3(shi->facenor, shi->view) < 0.0f)
shade_input_flip_normals(shi);
}
@@ -843,7 +844,7 @@ void shade_input_set_vertex_normals(ShadeInput *shi)
float l= 1.0f+u+v;
/* calculate vertexnormals */
- if(shi->vlr->flag & R_SMOOTH) {
+ if (shi->vlr->flag & R_SMOOTH) {
float *n1= shi->n1, *n2= shi->n2, *n3= shi->n3;
shi->vn[0]= l*n3[0]-u*n1[0]-v*n2[0];
@@ -898,9 +899,9 @@ void shade_input_set_shade_texco(ShadeInput *shi)
short texco= shi->mat->texco;
/* calculate dxno */
- if(shi->vlr->flag & R_SMOOTH) {
+ if (shi->vlr->flag & R_SMOOTH) {
- if(shi->osatex && (texco & (TEXCO_NORM|TEXCO_REFL)) ) {
+ if (shi->osatex && (texco & (TEXCO_NORM|TEXCO_REFL)) ) {
float *n1= shi->n1, *n2= shi->n2, *n3= shi->n3;
dl= shi->dx_u+shi->dx_v;
@@ -920,7 +921,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
float *tangent, *s1, *s2, *s3;
float tl, tu, tv;
- if(shi->vlr->flag & R_SMOOTH) {
+ if (shi->vlr->flag & R_SMOOTH) {
tl= l;
tu= u;
tv= v;
@@ -936,17 +937,17 @@ void shade_input_set_shade_texco(ShadeInput *shi)
shi->tang[0]= shi->tang[1]= shi->tang[2]= 0.0f;
shi->nmaptang[0]= shi->nmaptang[1]= shi->nmaptang[2]= 0.0f;
- if(mode & MA_TANGENT_V) {
+ if (mode & MA_TANGENT_V) {
s1 = RE_vertren_get_tangent(obr, v1, 0);
s2 = RE_vertren_get_tangent(obr, v2, 0);
s3 = RE_vertren_get_tangent(obr, v3, 0);
- if(s1 && s2 && s3) {
+ if (s1 && s2 && s3) {
shi->tang[0]= (tl*s3[0] - tu*s1[0] - tv*s2[0]);
shi->tang[1]= (tl*s3[1] - tu*s1[1] - tv*s2[1]);
shi->tang[2]= (tl*s3[2] - tu*s1[2] - tv*s2[2]);
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mul_m3_v3(obi->nmat, shi->tang);
normalize_v3(shi->tang);
@@ -954,10 +955,10 @@ void shade_input_set_shade_texco(ShadeInput *shi)
}
}
- if(mode & MA_NORMAP_TANG || R.flag & R_NEED_TANGENT) {
+ if (mode & MA_NORMAP_TANG || R.flag & R_NEED_TANGENT) {
tangent= RE_vlakren_get_nmap_tangent(obr, shi->vlr, 0);
- if(tangent) {
+ if (tangent) {
int j1= shi->i1, j2= shi->i2, j3= shi->i3;
float c0[3], c1[3], c2[3];
@@ -988,12 +989,12 @@ void shade_input_set_shade_texco(ShadeInput *shi)
}
}
- if(mode & MA_STR_SURFDIFF) {
+ if (mode & MA_STR_SURFDIFF) {
float *surfnor= RE_vlakren_get_surfnor(obr, shi->vlr, 0);
- if(surfnor) {
+ if (surfnor) {
copy_v3_v3(shi->surfnor, surfnor);
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mul_m3_v3(obi->nmat, shi->surfnor);
}
else
@@ -1002,13 +1003,13 @@ void shade_input_set_shade_texco(ShadeInput *shi)
shi->surfdist= 0.0f;
}
- if(R.r.mode & R_SPEED) {
+ if (R.r.mode & R_SPEED) {
float *s1, *s2, *s3;
s1= RE_vertren_get_winspeed(obi, v1, 0);
s2= RE_vertren_get_winspeed(obi, v2, 0);
s3= RE_vertren_get_winspeed(obi, v3, 0);
- if(s1 && s2 && s3) {
+ if (s1 && s2 && s3) {
shi->winspeed[0]= (l*s3[0] - u*s1[0] - v*s2[0]);
shi->winspeed[1]= (l*s3[1] - u*s1[1] - v*s2[1]);
shi->winspeed[2]= (l*s3[2] - u*s1[2] - v*s2[2]);
@@ -1020,14 +1021,14 @@ void shade_input_set_shade_texco(ShadeInput *shi)
}
/* pass option forces UV calc */
- if(shi->passflag & SCE_PASS_UV)
+ if (shi->passflag & SCE_PASS_UV)
texco |= (NEED_UV|TEXCO_UV);
/* texture coordinates. shi->dxuv shi->dyuv have been set */
- if(texco & NEED_UV) {
+ if (texco & NEED_UV) {
- if(texco & TEXCO_ORCO) {
- if(v1->orco) {
+ if (texco & TEXCO_ORCO) {
+ if (v1->orco) {
float *o1, *o2, *o3;
o1= v1->orco;
@@ -1038,7 +1039,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
shi->lo[1]= l*o3[1]-u*o1[1]-v*o2[1];
shi->lo[2]= l*o3[2]-u*o1[2]-v*o2[2];
- if(shi->osatex) {
+ if (shi->osatex) {
dl= shi->dx_u+shi->dx_v;
shi->dxlo[0]= dl*o3[0]-shi->dx_u*o1[0]-shi->dx_v*o2[0];
shi->dxlo[1]= dl*o3[1]-shi->dx_u*o1[1]-shi->dx_v*o2[1];
@@ -1053,10 +1054,10 @@ void shade_input_set_shade_texco(ShadeInput *shi)
copy_v3_v3(shi->duplilo, obi->dupliorco);
}
- if(texco & TEXCO_GLOB) {
+ if (texco & TEXCO_GLOB) {
copy_v3_v3(shi->gl, shi->co);
mul_m4_v3(R.viewinv, shi->gl);
- if(shi->osatex) {
+ if (shi->osatex) {
copy_v3_v3(shi->dxgl, shi->dxco);
mul_mat3_m4_v3(R.viewinv, shi->dxgl);
copy_v3_v3(shi->dygl, shi->dyco);
@@ -1064,9 +1065,9 @@ void shade_input_set_shade_texco(ShadeInput *shi)
}
}
- if(texco & TEXCO_STRAND) {
+ if (texco & TEXCO_STRAND) {
shi->strandco= (l*v3->accum - u*v1->accum - v*v2->accum);
- if(shi->osatex) {
+ if (shi->osatex) {
dl= shi->dx_u+shi->dx_v;
shi->dxstrand= dl*v3->accum-shi->dx_u*v1->accum-shi->dx_v*v2->accum;
dl= shi->dy_u+shi->dy_v;
@@ -1074,7 +1075,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
}
}
- if((texco & TEXCO_UV) || (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE))) {
+ if ((texco & TEXCO_UV) || (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE))) {
VlakRen *vlr= shi->vlr;
MTFace *tface;
MCol *mcol;
@@ -1089,7 +1090,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
shi->actuv= obr->actmtface;
shi->actcol= obr->actmcol;
- if(mode & (MA_VERTEXCOL|MA_VERTEXCOLP)) {
+ if (mode & (MA_VERTEXCOL|MA_VERTEXCOLP)) {
for (i=0; (mcol=RE_vlakren_get_mcol(obr, vlr, i, &name, 0)); i++) {
ShadeInputCol *scol= &shi->col[i];
char *cp1, *cp2, *cp3;
@@ -1119,7 +1120,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
}
}
- if(shi->totcol) {
+ if (shi->totcol) {
shi->vcol[0]= shi->col[shi->actcol].col[0];
shi->vcol[1]= shi->col[shi->actcol].col[1];
shi->vcol[2]= shi->col[shi->actcol].col[2];
@@ -1148,7 +1149,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
suv->uv[1]= -1.0f + 2.0f*(l*uv3[1]-u*uv1[1]-v*uv2[1]);
suv->uv[2]= 0.0f; /* texture.c assumes there are 3 coords */
- if(shi->osatex) {
+ if (shi->osatex) {
float duv[2];
dl= shi->dx_u+shi->dx_v;
@@ -1166,14 +1167,14 @@ void shade_input_set_shade_texco(ShadeInput *shi)
suv->dyuv[1]= 2.0f*(dl*uv3[1]-duv[0]*uv1[1]-duv[1]*uv2[1]);
}
- if((mode & MA_FACETEXTURE) && i==obr->actmtface) {
- if((mode & (MA_VERTEXCOL|MA_VERTEXCOLP))==0) {
+ if ((mode & MA_FACETEXTURE) && i==obr->actmtface) {
+ if ((mode & (MA_VERTEXCOL|MA_VERTEXCOLP))==0) {
shi->vcol[0]= 1.0f;
shi->vcol[1]= 1.0f;
shi->vcol[2]= 1.0f;
shi->vcol[3]= 1.0f;
}
- if(tface->tpage) {
+ if (tface->tpage) {
render_realtime_texture(shi, tface->tpage);
}
}
@@ -1185,14 +1186,14 @@ void shade_input_set_shade_texco(ShadeInput *shi)
shi->dupliuv[1]= -1.0f + 2.0f*obi->dupliuv[1];
shi->dupliuv[2]= 0.0f;
- if(shi->totuv == 0) {
+ if (shi->totuv == 0) {
ShadeInputUV *suv= &shi->uv[0];
suv->uv[0]= 2.0f*(u+.5f);
suv->uv[1]= 2.0f*(v+.5f);
suv->uv[2]= 0.0f; /* texture.c assumes there are 3 coords */
- if(mode & MA_FACETEXTURE) {
+ if (mode & MA_FACETEXTURE) {
/* no tface? set at 1.0f */
shi->vcol[0]= 1.0f;
shi->vcol[1]= 1.0f;
@@ -1202,28 +1203,28 @@ void shade_input_set_shade_texco(ShadeInput *shi)
}
}
- if(texco & TEXCO_NORM) {
+ if (texco & TEXCO_NORM) {
shi->orn[0]= -shi->vn[0];
shi->orn[1]= -shi->vn[1];
shi->orn[2]= -shi->vn[2];
}
- if(texco & TEXCO_STRESS) {
+ if (texco & TEXCO_STRESS) {
float *s1, *s2, *s3;
s1= RE_vertren_get_stress(obr, v1, 0);
s2= RE_vertren_get_stress(obr, v2, 0);
s3= RE_vertren_get_stress(obr, v3, 0);
- if(s1 && s2 && s3) {
+ if (s1 && s2 && s3) {
shi->stress= l*s3[0] - u*s1[0] - v*s2[0];
- if(shi->stress<1.0f) shi->stress-= 1.0f;
+ if (shi->stress<1.0f) shi->stress-= 1.0f;
else shi->stress= (shi->stress-1.0f)/shi->stress;
}
else shi->stress= 0.0f;
}
- if(texco & TEXCO_TANGENT) {
- if((mode & MA_TANGENT_V)==0) {
+ if (texco & TEXCO_TANGENT) {
+ if ((mode & MA_TANGENT_V)==0) {
/* just prevent surprises */
shi->tang[0]= shi->tang[1]= shi->tang[2]= 0.0f;
shi->nmaptang[0]= shi->nmaptang[1]= shi->nmaptang[2]= 0.0f;
@@ -1232,15 +1233,15 @@ void shade_input_set_shade_texco(ShadeInput *shi)
}
/* this only avalailable for scanline renders */
- if(shi->depth==0) {
+ if (shi->depth==0) {
float x= shi->xs;
float y= shi->ys;
- if(texco & TEXCO_WINDOW) {
+ if (texco & TEXCO_WINDOW) {
shi->winco[0]= -1.0f + 2.0f*x/(float)R.winx;
shi->winco[1]= -1.0f + 2.0f*y/(float)R.winy;
shi->winco[2]= 0.0f;
- if(shi->osatex) {
+ if (shi->osatex) {
shi->dxwin[0]= 2.0f/(float)R.winx;
shi->dywin[1]= 2.0f/(float)R.winy;
shi->dxwin[1]= shi->dxwin[2]= 0.0f;
@@ -1248,14 +1249,14 @@ void shade_input_set_shade_texco(ShadeInput *shi)
}
}
- if(texco & TEXCO_STICKY) {
+ if (texco & TEXCO_STICKY) {
float *s1, *s2, *s3;
s1= RE_vertren_get_sticky(obr, v1, 0);
s2= RE_vertren_get_sticky(obr, v2, 0);
s3= RE_vertren_get_sticky(obr, v3, 0);
- if(s1 && s2 && s3) {
+ if (s1 && s2 && s3) {
float obwinmat[4][4], winmat[4][4], ho1[4], ho2[4], ho3[4];
float Zmulx, Zmuly;
float hox, hoy, l, dl, u, v;
@@ -1265,7 +1266,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
Zmulx= ((float)R.winx)/2.0f; Zmuly= ((float)R.winy)/2.0f;
zbuf_make_winmat(&R, winmat);
- if(shi->obi->flag & R_TRANSFORMED)
+ if (shi->obi->flag & R_TRANSFORMED)
mult_m4_m4m4(obwinmat, winmat, obi->mat);
else
copy_m4_m4(obwinmat, winmat);
@@ -1295,7 +1296,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
shi->sticky[1]= l*s3[1]-u*s1[1]-v*s2[1];
shi->sticky[2]= 0.0f;
- if(shi->osatex) {
+ if (shi->osatex) {
float dxuv[2], dyuv[2];
dxuv[0]= s11/Zmulx;
dxuv[1]= - s01/Zmulx;
@@ -1318,7 +1319,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
* else un-initialized values are used
*/
if (shi->do_manage) {
- if(mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) {
+ if (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) {
srgb_to_linearrgb_v3_v3(shi->vcol, shi->vcol);
}
}
@@ -1355,7 +1356,7 @@ void shade_sample_initialize(ShadeSample *ssamp, RenderPart *pa, RenderLayer *rl
tot= R.osa==0?1:R.osa;
- for(a=0; a<tot; a++) {
+ for (a=0; a<tot; a++) {
shade_input_initialize(&ssamp->shi[a], pa, rl, a);
memset(&ssamp->shr[a], 0, sizeof(ShadeResult));
}
@@ -1366,19 +1367,19 @@ void shade_sample_initialize(ShadeSample *ssamp, RenderPart *pa, RenderLayer *rl
/* Do AO or (future) GI */
void shade_samples_do_AO(ShadeSample *ssamp)
{
- if(!(R.r.mode & R_SHADOW))
+ if (!(R.r.mode & R_SHADOW))
return;
- if(!(R.r.mode & R_RAYTRACE) && !(R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
+ if (!(R.r.mode & R_RAYTRACE) && !(R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
return;
- if(R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) {
+ if (R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) {
ShadeInput *shi= &ssamp->shi[0];
int sample;
- if(((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
+ if (((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
|| (shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
- for(sample=0; sample<ssamp->tot; shi++, sample++)
- if(!(shi->mode & MA_SHLESS))
+ for (sample=0; sample<ssamp->tot; shi++, sample++)
+ if (!(shi->mode & MA_SHLESS))
ambient_occlusion(shi); /* stores in shi->ao[] */
}
}
@@ -1391,23 +1392,23 @@ void shade_samples_fill_with_ps(ShadeSample *ssamp, PixStr *ps, int x, int y)
ssamp->tot= 0;
- for(shi= ssamp->shi; ps; ps= ps->next) {
+ for (shi= ssamp->shi; ps; ps= ps->next) {
shade_input_set_triangle(shi, ps->obi, ps->facenr, 1);
- if(shi->vlr) { /* NULL happens for env material or for 'all z' */
+ if (shi->vlr) { /* NULL happens for env material or for 'all z' */
unsigned short curmask= ps->mask;
/* full osa is only set for OSA renders */
- if(shi->vlr->flag & R_FULL_OSA) {
+ if (shi->vlr->flag & R_FULL_OSA) {
short shi_cp= 0, samp;
- for(samp=0; samp<R.osa; samp++) {
- if(curmask & (1<<samp)) {
+ for (samp=0; samp<R.osa; samp++) {
+ if (curmask & (1<<samp)) {
/* zbuffer has this inverse corrected, ensures xs,ys are inside pixel */
xs= (float)x + R.jit[samp][0] + 0.5f;
ys= (float)y + R.jit[samp][1] + 0.5f;
- if(shi_cp)
+ if (shi_cp)
shade_input_copy_triangle(shi, shi-1);
shi->mask= (1<<samp);
@@ -1415,7 +1416,7 @@ void shade_samples_fill_with_ps(ShadeSample *ssamp, PixStr *ps, int x, int y)
shi->samplenr= R.shadowsamplenr[shi->thread]++; /* this counter is not being reset per pixel */
shade_input_set_viewco(shi, x, y, xs, ys, (float)ps->z);
shade_input_set_uv(shi);
- if(shi_cp==0)
+ if (shi_cp==0)
shade_input_set_normals(shi);
else /* XXX shi->flippednor messes up otherwise */
shade_input_set_vertex_normals(shi);
@@ -1426,7 +1427,7 @@ void shade_samples_fill_with_ps(ShadeSample *ssamp, PixStr *ps, int x, int y)
}
}
else {
- if(R.osa) {
+ if (R.osa) {
short b= R.samples->centmask[curmask];
xs= (float)x + R.samples->centLut[b & 15] + 0.5f;
ys= (float)y + R.samples->centLut[b>>4] + 0.5f;
@@ -1445,7 +1446,7 @@ void shade_samples_fill_with_ps(ShadeSample *ssamp, PixStr *ps, int x, int y)
}
/* total sample amount, shi->sample is static set in initialize */
- if(shi!=ssamp->shi)
+ if (shi!=ssamp->shi)
ssamp->tot= (shi-1)->sample + 1;
}
}
@@ -1456,7 +1457,7 @@ int shade_samples(ShadeSample *ssamp, PixStr *ps, int x, int y)
{
shade_samples_fill_with_ps(ssamp, ps, x, y);
- if(ssamp->tot) {
+ if (ssamp->tot) {
ShadeInput *shi= ssamp->shi;
ShadeResult *shr= ssamp->shr;
int samp;
@@ -1465,15 +1466,15 @@ int shade_samples(ShadeSample *ssamp, PixStr *ps, int x, int y)
shade_samples_do_AO(ssamp);
/* if shade (all shadepinputs have same passflag) */
- if(ssamp->shi[0].passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB|SCE_PASS_INDEXMA)) {
+ if (ssamp->shi[0].passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB|SCE_PASS_INDEXMA)) {
- for(samp=0; samp<ssamp->tot; samp++, shi++, shr++) {
+ for (samp=0; samp<ssamp->tot; samp++, shi++, shr++) {
shade_input_set_shade_texco(shi);
shade_input_do_shade(shi, shr);
}
}
- else if(shi->passflag & SCE_PASS_Z) {
- for(samp=0; samp<ssamp->tot; samp++, shi++, shr++)
+ else if (shi->passflag & SCE_PASS_Z) {
+ for (samp=0; samp<ssamp->tot; samp++, shi++, shr++)
shr->z= -shi->co[2];
}
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 346f42eaab1..e56c9874467 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -66,11 +66,11 @@ extern struct Render R;
ListBase *get_lights(ShadeInput *shi)
{
- if(R.r.scemode & R_PREVIEWBUTS)
+ if (R.r.scemode & R_PREVIEWBUTS)
return &R.lights;
- if(shi->light_override)
+ if (shi->light_override)
return &shi->light_override->gobject;
- if(shi->mat && shi->mat->group)
+ if (shi->mat && shi->mat->group)
return &shi->mat->group->gobject;
return &R.lights;
@@ -96,7 +96,7 @@ static void fogcolor(float *colf, float *rco, float *view)
dview[2]= -stepsize;
startdist= -rco[2] + BLI_frand();
- for(dist= startdist; dist>R.wrld.miststa; dist-= stepsize) {
+ for (dist= startdist; dist>R.wrld.miststa; dist-= stepsize) {
hor[0]= R.wrld.horr; hor[1]= R.wrld.horg; hor[2]= R.wrld.horb;
alpha= 1.0f;
@@ -127,13 +127,13 @@ float mistfactor(float zcor, float const co[3])
/* fac= -co[2]-R.wrld.miststa; */
- if(fac>0.0f) {
- if(fac< R.wrld.mistdist) {
+ if (fac>0.0f) {
+ if (fac< R.wrld.mistdist) {
fac= (fac/(R.wrld.mistdist));
- if(R.wrld.mistype==0) fac*= fac;
- else if(R.wrld.mistype==1);
+ if (R.wrld.mistype==0) fac*= fac;
+ else if (R.wrld.mistype==1);
else fac= sqrt(fac);
}
else fac= 1.0f;
@@ -141,13 +141,13 @@ float mistfactor(float zcor, float const co[3])
else fac= 0.0f;
/* height switched off mist */
- if(R.wrld.misthi!=0.0f && fac!=0.0f) {
+ if (R.wrld.misthi!=0.0f && fac!=0.0f) {
/* at height misthi the mist is completely gone */
hi= R.viewinv[0][2]*co[0]+R.viewinv[1][2]*co[1]+R.viewinv[2][2]*co[2]+R.viewinv[3][2];
- if(hi>R.wrld.misthi) fac= 0.0f;
- else if(hi>0.0f) {
+ if (hi>R.wrld.misthi) fac= 0.0f;
+ else if (hi>0.0f) {
hi= (R.wrld.misthi-hi)/R.wrld.misthi;
fac*= hi*hi;
}
@@ -166,7 +166,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
*intens= 0.0f;
haint= lar->haint;
- if(R.r.mode & R_ORTHO) {
+ if (R.r.mode & R_ORTHO) {
/* camera pos (view vector) cannot be used... */
/* camera position (cox,coy,0) rotate around lamp */
p1[0]= shi->co[0]-lar->co[0];
@@ -186,17 +186,17 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
copy_v3db_v3fl(nray, shi->view);
mul_m3_v3_double(lar->imat, nray);
- if(R.wrld.mode & WO_MIST) {
+ if (R.wrld.mode & WO_MIST) {
/* patchy... */
haint *= mistfactor(-lar->co[2], lar->co);
- if(haint==0.0f) {
+ if (haint==0.0f) {
return;
}
}
/* rotate maxz */
- if(shi->co[2]==0.0f) doclip= 0; /* for when halo at sky */
+ if (shi->co[2]==0.0f) doclip= 0; /* for when halo at sky */
else {
p1[0]= shi->co[0]-lar->co[0];
p1[1]= shi->co[1]-lar->co[1];
@@ -206,7 +206,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
maxz*= lar->sh_zfac;
maxy= lar->imat[0][1]*p1[0]+lar->imat[1][1]*p1[1]+lar->imat[2][1]*p1[2];
- if( fabs(nray[2]) < FLT_EPSILON ) use_yco= 1;
+ if ( fabs(nray[2]) < FLT_EPSILON ) use_yco= 1;
}
/* scale z to make sure volume is normalized */
@@ -230,7 +230,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
else {
disc = b*b - a*c;
- if(disc==0.0) {
+ if (disc==0.0) {
t1=t2= (-b)/ a;
snijp= 2;
}
@@ -241,11 +241,11 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
snijp= 2;
}
}
- if(snijp==2) {
+ if (snijp==2) {
int ok1=0, ok2=0;
/* sort */
- if(t1>t2) {
+ if (t1>t2) {
a= t1; t1= t2; t2= a;
}
@@ -254,52 +254,52 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
p2[2]= npos[2] + t2*nray[2];
/* evaluate both points */
- if(p1[2]<=0.0f) ok1= 1;
- if(p2[2]<=0.0f && t1!=t2) ok2= 1;
+ if (p1[2]<=0.0f) ok1= 1;
+ if (p2[2]<=0.0f && t1!=t2) ok2= 1;
/* at least 1 point with negative z */
- if(ok1==0 && ok2==0) return;
+ if (ok1==0 && ok2==0) return;
/* intersction point with -ladist, the bottom of the cone */
- if(use_yco==0) {
+ if (use_yco==0) {
t3= ((double)(-ladist)-npos[2])/nray[2];
/* de we have to replace one of the intersection points? */
- if(ok1) {
- if(p1[2]<-ladist) t1= t3;
+ if (ok1) {
+ if (p1[2]<-ladist) t1= t3;
}
else {
t1= t3;
}
- if(ok2) {
- if(p2[2]<-ladist) t2= t3;
+ if (ok2) {
+ if (p2[2]<-ladist) t2= t3;
}
else {
t2= t3;
}
}
- else if(ok1==0 || ok2==0) return;
+ else if (ok1==0 || ok2==0) return;
/* at least 1 visible interesction point */
- if(t1<0.0 && t2<0.0) return;
+ if (t1<0.0 && t2<0.0) return;
- if(t1<0.0) t1= 0.0;
- if(t2<0.0) t2= 0.0;
+ if (t1<0.0) t1= 0.0;
+ if (t2<0.0) t2= 0.0;
- if(t1==t2) return;
+ if (t1==t2) return;
/* sort again to be sure */
- if(t1>t2) {
+ if (t1>t2) {
a= t1; t1= t2; t2= a;
}
/* calculate t0: is the maximum visible z (when halo is intersected by face) */
- if(doclip) {
- if(use_yco==0) t0= (maxz-npos[2])/nray[2];
+ if (doclip) {
+ if (use_yco==0) t0= (maxz-npos[2])/nray[2];
else t0= (maxy-npos[1])/nray[1];
- if(t0<t1) return;
- if(t0<t2) t2= t0;
+ if (t0<t1) return;
+ if (t0<t2) t2= t0;
}
/* calc points */
@@ -327,17 +327,17 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
/* WATCH IT: do not clip a,b en c at 1.0, this gives nasty little overflows
* at the edges (especially with narrow halos) */
- if(*intens<=0.0f) return;
+ if (*intens<=0.0f) return;
/* soft area */
/* not needed because t0 has been used for p1/p2 as well */
- /* if(doclip && t0<t2) { */
+ /* if (doclip && t0<t2) { */
/* *intens *= (t0-t1)/(t2-t1); */
/* } */
*intens *= haint;
- if(lar->shb && lar->shb->shadhalostep) {
+ if (lar->shb && lar->shb->shadhalostep) {
*intens *= shadow_halo(lar, p1, p2);
}
@@ -351,23 +351,23 @@ void renderspothalo(ShadeInput *shi, float col[4], float alpha)
LampRen *lar;
float i;
- if(alpha==0.0f) return;
+ if (alpha==0.0f) return;
lights= get_lights(shi);
- for(go=lights->first; go; go= go->next) {
+ for (go=lights->first; go; go= go->next) {
lar= go->lampren;
- if(lar==NULL) continue;
+ if (lar==NULL) continue;
- if(lar->type==LA_SPOT && (lar->mode & LA_HALO) && (lar->buftype != LA_SHADBUF_DEEP) && lar->haint>0) {
+ if (lar->type==LA_SPOT && (lar->mode & LA_HALO) && (lar->buftype != LA_SHADBUF_DEEP) && lar->haint>0) {
- if(lar->mode & LA_LAYER)
- if(shi->vlr && (lar->lay & shi->obi->lay)==0)
+ if (lar->mode & LA_LAYER)
+ if (shi->vlr && (lar->lay & shi->obi->lay)==0)
continue;
- if((lar->lay & shi->lay)==0)
+ if ((lar->lay & shi->lay)==0)
continue;
spothalo(lar, shi, &i);
- if(i>0.0f) {
+ if (i>0.0f) {
col[3]+= i*alpha; // all premul
col[0]+= i*lar->r*alpha;
col[1]+= i*lar->g*alpha;
@@ -376,7 +376,7 @@ void renderspothalo(ShadeInput *shi, float col[4], float alpha)
}
}
/* clip alpha, is needed for unified 'alpha threshold' (vanillaRenderPipe.c) */
- if(col[3]>1.0f) col[3]= 1.0f;
+ if (col[3]>1.0f) col[3]= 1.0f;
}
@@ -389,13 +389,14 @@ static double Normalize_d(double *n)
d= n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
- if(d>0.00000000000000001) {
+ if (d>0.00000000000000001) {
d= sqrt(d);
n[0]/=d;
n[1]/=d;
n[2]/=d;
- } else {
+ }
+ else {
n[0]=n[1]=n[2]= 0.0;
d= 0.0;
}
@@ -407,23 +408,23 @@ float fresnel_fac(float *view, float *vn, float grad, float fac)
{
float t1, t2;
- if(fac==0.0f) return 1.0f;
+ if (fac==0.0f) return 1.0f;
t1= (view[0]*vn[0] + view[1]*vn[1] + view[2]*vn[2]);
- if(t1>0.0f) t2= 1.0f+t1;
+ if (t1>0.0f) t2= 1.0f+t1;
else t2= 1.0f-t1;
t2= grad + (1.0f-grad)*powf(t2, fac);
- if(t2<0.0f) return 0.0f;
- else if(t2>1.0f) return 1.0f;
+ if (t2<0.0f) return 0.0f;
+ else if (t2>1.0f) return 1.0f;
return t2;
}
static double saacos_d(double fac)
{
- if(fac<= -1.0) return M_PI;
- else if(fac>=1.0) return 0.0;
+ if (fac<= -1.0) return M_PI;
+ else if (fac>=1.0) return 0.0;
else return acos(fac);
}
@@ -473,7 +474,7 @@ static float area_lamp_energy(float (*area)[3], float *co, float *vn)
fac+= rad[2]*(vn[0]*cross[2][0]+ vn[1]*cross[2][1]+ vn[2]*cross[2][2]);
fac+= rad[3]*(vn[0]*cross[3][0]+ vn[1]*cross[3][1]+ vn[2]*cross[3][2]);
- if(fac<=0.0) return 0.0;
+ if (fac<=0.0) return 0.0;
return fac;
}
@@ -486,10 +487,10 @@ static float area_lamp_energy_multisample(LampRen *lar, float *co, float *vn)
/* test if co is behind lamp */
sub_v3_v3v3(vec, co, lar->co);
- if(dot_v3v3(vec, lar->vec) < 0.0f)
+ if (dot_v3v3(vec, lar->vec) < 0.0f)
return 0.0f;
- while(a--) {
+ while (a--) {
vec[0]= jitlamp[0];
vec[1]= jitlamp[1];
vec[2]= 0.0f;
@@ -513,35 +514,35 @@ static float spec(float inp, int hard)
{
float b1;
- if(inp>=1.0f) return 1.0f;
+ if (inp>=1.0f) return 1.0f;
else if (inp<=0.0f) return 0.0f;
b1= inp*inp;
/* avoid FPE */
- if(b1<0.01f) b1= 0.01f;
+ if (b1<0.01f) b1= 0.01f;
- if((hard & 1)==0) inp= 1.0f;
- if(hard & 2) inp*= b1;
+ if ((hard & 1)==0) inp= 1.0f;
+ if (hard & 2) inp*= b1;
b1*= b1;
- if(hard & 4) inp*= b1;
+ if (hard & 4) inp*= b1;
b1*= b1;
- if(hard & 8) inp*= b1;
+ if (hard & 8) inp*= b1;
b1*= b1;
- if(hard & 16) inp*= b1;
+ if (hard & 16) inp*= b1;
b1*= b1;
/* avoid FPE */
- if(b1<0.001f) b1= 0.0f;
+ if (b1<0.001f) b1= 0.0f;
- if(hard & 32) inp*= b1;
+ if (hard & 32) inp*= b1;
b1*= b1;
- if(hard & 64) inp*=b1;
+ if (hard & 64) inp*=b1;
b1*= b1;
- if(hard & 128) inp*=b1;
+ if (hard & 128) inp*=b1;
- if(b1<0.001f) b1= 0.0f;
+ if (b1<0.001f) b1= 0.0f;
- if(hard & 256) {
+ if (hard & 256) {
b1*= b1;
inp*=b1;
}
@@ -560,9 +561,9 @@ static float Phong_Spec( float *n, float *l, float *v, int hard, int tangent )
normalize_v3(h);
rslt = h[0]*n[0] + h[1]*n[1] + h[2]*n[2];
- if(tangent) rslt= sasqrt(1.0f - rslt*rslt);
+ if (tangent) rslt= sasqrt(1.0f - rslt*rslt);
- if( rslt > 0.0f ) rslt= spec(rslt, hard);
+ if ( rslt > 0.0f ) rslt= spec(rslt, hard);
else rslt = 0.0f;
return rslt;
@@ -580,12 +581,12 @@ static float CookTorr_Spec(float *n, float *l, float *v, int hard, int tangent)
normalize_v3(h);
nh= n[0]*h[0]+n[1]*h[1]+n[2]*h[2];
- if(tangent) nh= sasqrt(1.0f - nh*nh);
- else if(nh<0.0f) return 0.0f;
+ if (tangent) nh= sasqrt(1.0f - nh*nh);
+ else if (nh<0.0f) return 0.0f;
nv= n[0]*v[0]+n[1]*v[1]+n[2]*v[2];
- if(tangent) nv= sasqrt(1.0f - nv*nv);
- else if(nv<0.0f) nv= 0.0f;
+ if (tangent) nv= sasqrt(1.0f - nv*nv);
+ else if (nv<0.0f) nv= 0.0f;
i= spec(nh, hard);
@@ -599,11 +600,11 @@ static float Blinn_Spec(float *n, float *l, float *v, float refrac, float spec_p
float i, nh, nv, nl, vh, h[3];
float a, b, c, g=0.0f, p, f, ang;
- if(refrac < 1.0f) return 0.0f;
- if(spec_power == 0.0f) return 0.0f;
+ if (refrac < 1.0f) return 0.0f;
+ if (spec_power == 0.0f) return 0.0f;
/* conversion from 'hardness' (1-255) to 'spec_power' (50 maps at 0.1) */
- if(spec_power<100.0f)
+ if (spec_power<100.0f)
spec_power= sqrt(1.0f/spec_power);
else spec_power= 10.0f/spec_power;
@@ -613,36 +614,36 @@ static float Blinn_Spec(float *n, float *l, float *v, float refrac, float spec_p
normalize_v3(h);
nh= n[0]*h[0]+n[1]*h[1]+n[2]*h[2]; /* Dot product between surface normal and half-way vector */
- if(tangent) nh= sasqrt(1.0f - nh*nh);
- else if(nh<0.0f) return 0.0f;
+ if (tangent) nh= sasqrt(1.0f - nh*nh);
+ else if (nh<0.0f) return 0.0f;
nv= n[0]*v[0]+n[1]*v[1]+n[2]*v[2]; /* Dot product between surface normal and view vector */
- if(tangent) nv= sasqrt(1.0f - nv*nv);
- if(nv<=0.01f) nv= 0.01f; /* hrms... */
+ if (tangent) nv= sasqrt(1.0f - nv*nv);
+ if (nv<=0.01f) nv= 0.01f; /* hrms... */
nl= n[0]*l[0]+n[1]*l[1]+n[2]*l[2]; /* Dot product between surface normal and light vector */
- if(tangent) nl= sasqrt(1.0f - nl*nl);
- if(nl<=0.01f) {
+ if (tangent) nl= sasqrt(1.0f - nl*nl);
+ if (nl<=0.01f) {
return 0.0f;
}
vh= v[0]*h[0]+v[1]*h[1]+v[2]*h[2]; /* Dot product between view vector and half-way vector */
- if(vh<=0.0f) vh= 0.01f;
+ if (vh<=0.0f) vh= 0.01f;
a = 1.0f;
b = (2.0f*nh*nv)/vh;
c = (2.0f*nh*nl)/vh;
- if( a < b && a < c ) g = a;
- else if( b < a && b < c ) g = b;
- else if( c < a && c < b ) g = c;
+ if ( a < b && a < c ) g = a;
+ else if ( b < a && b < c ) g = b;
+ else if ( c < a && c < b ) g = c;
p = sqrt( (double)((refrac * refrac)+(vh*vh)-1.0f) );
f = (((p-vh)*(p-vh))/((p+vh)*(p+vh)))*(1+((((vh*(p+vh))-1.0f)*((vh*(p+vh))-1.0f))/(((vh*(p-vh))+1.0f)*((vh*(p-vh))+1.0f))));
ang = saacos(nh);
i= f * g * exp((double)(-(ang*ang) / (2.0f*spec_power*spec_power)));
- if(i<0.0f) i= 0.0f;
+ if (i<0.0f) i= 0.0f;
return i;
}
@@ -660,12 +661,12 @@ static float Toon_Spec( float *n, float *l, float *v, float size, float smooth,
normalize_v3(h);
rslt = h[0]*n[0] + h[1]*n[1] + h[2]*n[2];
- if(tangent) rslt = sasqrt(1.0f - rslt*rslt);
+ if (tangent) rslt = sasqrt(1.0f - rslt*rslt);
ang = saacos( rslt );
- if( ang < size ) rslt = 1.0f;
- else if( ang >= (size + smooth) || smooth == 0.0f ) rslt = 0.0f;
+ if ( ang < size ) rslt = 1.0f;
+ else if ( ang >= (size + smooth) || smooth == 0.0f ) rslt = 0.0f;
else rslt = 1.0f - ((ang - size) / smooth);
return rslt;
@@ -684,16 +685,16 @@ static float WardIso_Spec( float *n, float *l, float *v, float rms, int tangent)
normalize_v3(h);
nh = n[0]*h[0]+n[1]*h[1]+n[2]*h[2]; /* Dot product between surface normal and half-way vector */
- if(tangent) nh = sasqrt(1.0f - nh*nh);
- if(nh<=0.0f) nh = 0.001f;
+ if (tangent) nh = sasqrt(1.0f - nh*nh);
+ if (nh<=0.0f) nh = 0.001f;
nv = n[0]*v[0]+n[1]*v[1]+n[2]*v[2]; /* Dot product between surface normal and view vector */
- if(tangent) nv = sasqrt(1.0f - nv*nv);
- if(nv<=0.0f) nv = 0.001f;
+ if (tangent) nv = sasqrt(1.0f - nv*nv);
+ if (nv<=0.0f) nv = 0.001f;
nl = n[0]*l[0]+n[1]*l[1]+n[2]*l[2]; /* Dot product between surface normal and light vector */
- if(tangent) nl = sasqrt(1.0f - nl*nl);
- if(nl<=0.0f) nl = 0.001f;
+ if (tangent) nl = sasqrt(1.0f - nl*nl);
+ if (nl<=0.0f) nl = 0.001f;
angle = tan(saacos(nh));
alpha = MAX2(rms, 0.001f);
@@ -712,8 +713,8 @@ static float Toon_Diff( float *n, float *l, float *UNUSED(v), float size, float
ang = saacos( (double)(rslt) );
- if( ang < size ) rslt = 1.0f;
- else if( ang >= (size + smooth) || smooth == 0.0f ) rslt = 0.0f;
+ if ( ang < size ) rslt = 1.0f;
+ else if ( ang >= (size + smooth) || smooth == 0.0f ) rslt = 0.0f;
else rslt = 1.0f - ((ang - size) / smooth);
return rslt;
@@ -735,17 +736,17 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough
normalize_v3(h);
/* nh= n[0]*h[0]+n[1]*h[1]+n[2]*h[2]; */ /* Dot product between surface normal and half-way vector */
- /* if(nh<0.0f) nh = 0.0f; */
+ /* if (nh<0.0f) nh = 0.0f; */
nv= n[0]*v[0]+n[1]*v[1]+n[2]*v[2]; /* Dot product between surface normal and view vector */
- if(nv<=0.0f) nv= 0.0f;
+ if (nv<=0.0f) nv= 0.0f;
realnl= n[0]*l[0]+n[1]*l[1]+n[2]*l[2]; /* Dot product between surface normal and light vector */
- if(realnl<=0.0f) return 0.0f;
- if(nl<0.0f) return 0.0f; /* value from area light */
+ if (realnl<=0.0f) return 0.0f;
+ if (nl<0.0f) return 0.0f; /* value from area light */
/* vh= v[0]*h[0]+v[1]*h[1]+v[2]*h[2]; */ /* Dot product between view vector and halfway vector */
- /* if(vh<=0.0f) vh= 0.0f; */
+ /* if (vh<=0.0f) vh= 0.0f; */
Lit_A = saacos(realnl);
View_A = saacos( nv );
@@ -761,9 +762,9 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough
normalize_v3( View_B );
t = Lit_B[0]*View_B[0] + Lit_B[1]*View_B[1] + Lit_B[2]*View_B[2];
- if( t < 0 ) t = 0;
+ if ( t < 0 ) t = 0;
- if( Lit_A > View_A ) {
+ if ( Lit_A > View_A ) {
a = Lit_A;
b = View_A;
}
@@ -822,8 +823,8 @@ void calc_R_ref(ShadeInput *shi)
shi->ref[0]= (shi->view[0]+i*shi->vn[0]);
shi->ref[1]= (shi->view[1]+i*shi->vn[1]);
shi->ref[2]= (shi->view[2]+i*shi->vn[2]);
- if(shi->osatex) {
- if(shi->vlr->flag & R_SMOOTH) {
+ if (shi->osatex) {
+ if (shi->vlr->flag & R_SMOOTH) {
i= -2*( (shi->vn[0]+shi->dxno[0])*(shi->view[0]+shi->dxview) +
(shi->vn[1]+shi->dxno[1])*shi->view[1]+ (shi->vn[2]+shi->dxno[2])*shi->view[2] );
@@ -864,24 +865,24 @@ void shade_color(ShadeInput *shi, ShadeResult *shr)
{
Material *ma= shi->mat;
- if(ma->mode & (MA_FACETEXTURE)) {
+ if (ma->mode & (MA_FACETEXTURE)) {
shi->r= shi->vcol[0];
shi->g= shi->vcol[1];
shi->b= shi->vcol[2];
- if(ma->mode & (MA_FACETEXTURE_ALPHA))
+ if (ma->mode & (MA_FACETEXTURE_ALPHA))
shi->alpha= shi->vcol[3];
}
- else if(ma->mode & (MA_VERTEXCOLP)) {
+ else if (ma->mode & (MA_VERTEXCOLP)) {
float neg_alpha = 1.0f - shi->vcol[3];
shi->r= shi->r*neg_alpha + shi->vcol[0]*shi->vcol[3];
shi->g= shi->g*neg_alpha + shi->vcol[1]*shi->vcol[3];
shi->b= shi->b*neg_alpha + shi->vcol[2]*shi->vcol[3];
}
- if(ma->texco)
+ if (ma->texco)
do_material_tex(shi, &R);
- if(ma->fresnel_tra!=0.0f)
+ if (ma->fresnel_tra!=0.0f)
shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
if (!(shi->mode & MA_TRANSP)) shi->alpha= 1.0f;
@@ -898,8 +899,8 @@ static void ramp_diffuse_result(float *diff, ShadeInput *shi)
Material *ma= shi->mat;
float col[4];
- if(ma->ramp_col) {
- if(ma->rampin_col==MA_RAMP_IN_RESULT) {
+ if (ma->ramp_col) {
+ if (ma->rampin_col==MA_RAMP_IN_RESULT) {
float fac = rgb_to_grayscale(diff);
do_colorband(ma->ramp_col, fac, col);
@@ -916,10 +917,10 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa
{
Material *ma= shi->mat;
- if(ma->ramp_col && (ma->mode & MA_RAMP_COL)) {
+ if (ma->ramp_col && (ma->mode & MA_RAMP_COL)) {
/* MA_RAMP_IN_RESULT is exceptional */
- if(ma->rampin_col==MA_RAMP_IN_RESULT) {
+ if (ma->rampin_col==MA_RAMP_IN_RESULT) {
// normal add
diff[0] += r * shi->r;
diff[1] += g * shi->g;
@@ -973,7 +974,7 @@ static void ramp_spec_result(float spec_col[3], ShadeInput *shi)
{
Material *ma= shi->mat;
- if(ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) {
+ if (ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) {
float col[4];
float fac = rgb_to_grayscale(spec_col);
@@ -997,7 +998,7 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3])
spec[2]= shi->specb;
/* MA_RAMP_IN_RESULT is exception */
- if(ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) {
+ if (ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) {
float fac;
float col[4];
@@ -1030,10 +1031,10 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3])
/* preprocess, textures were not done, don't use shi->amb for that reason */
void ambient_occlusion(ShadeInput *shi)
{
- if((R.wrld.ao_gather_method == WO_AOGATHER_APPROX) && shi->mat->amb!=0.0f) {
+ if ((R.wrld.ao_gather_method == WO_AOGATHER_APPROX) && shi->mat->amb!=0.0f) {
sample_occ(&R, shi);
}
- else if((R.r.mode & R_RAYTRACE) && shi->mat->amb!=0.0f) {
+ else if ((R.r.mode & R_RAYTRACE) && shi->mat->amb!=0.0f) {
ray_ao(shi, shi->ao, shi->env);
}
else {
@@ -1050,21 +1051,21 @@ static void ambient_occlusion_apply(ShadeInput *shi, ShadeResult *shr)
float f= R.wrld.aoenergy;
float tmp[3], tmpspec[3];
- if(!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
+ if (!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
return;
- if(f == 0.0f)
+ if (f == 0.0f)
return;
- if(R.wrld.aomix==WO_AOADD) {
+ if (R.wrld.aomix==WO_AOADD) {
shr->combined[0] += shi->ao[0]*shi->r*shi->refl*f;
shr->combined[1] += shi->ao[1]*shi->g*shi->refl*f;
shr->combined[2] += shi->ao[2]*shi->b*shi->refl*f;
}
- else if(R.wrld.aomix==WO_AOMUL) {
+ else if (R.wrld.aomix==WO_AOMUL) {
mul_v3_v3v3(tmp, shr->combined, shi->ao);
mul_v3_v3v3(tmpspec, shr->spec, shi->ao);
- if(f == 1.0f) {
+ if (f == 1.0f) {
copy_v3_v3(shr->combined, tmp);
copy_v3_v3(shr->spec, tmpspec);
}
@@ -1079,9 +1080,9 @@ void environment_lighting_apply(ShadeInput *shi, ShadeResult *shr)
{
float f= R.wrld.ao_env_energy*shi->amb;
- if(!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
+ if (!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
return;
- if(f == 0.0f)
+ if (f == 0.0f)
return;
shr->combined[0] += shi->env[0]*shi->r*shi->refl*f;
@@ -1093,9 +1094,9 @@ static void indirect_lighting_apply(ShadeInput *shi, ShadeResult *shr)
{
float f= R.wrld.ao_indirect_energy;
- if(!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
+ if (!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
return;
- if(f == 0.0f)
+ if (f == 0.0f)
return;
shr->combined[0] += shi->indirect[0]*shi->r*shi->refl*f;
@@ -1108,21 +1109,21 @@ void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float shadfac[4],
{
LampShadowSubSample *lss= &(lar->shadsamp[shi->thread].s[shi->sample]);
- if(do_real || lss->samplenr!=shi->samplenr) {
+ if (do_real || lss->samplenr!=shi->samplenr) {
shadfac[0]= shadfac[1]= shadfac[2]= shadfac[3]= 1.0f;
- if(lar->shb) {
- if(lar->buftype==LA_SHADBUF_IRREGULAR)
+ if (lar->shb) {
+ if (lar->buftype==LA_SHADBUF_IRREGULAR)
shadfac[3]= ISB_getshadow(shi, lar->shb);
else
shadfac[3] = testshadowbuf(&R, lar->shb, shi->co, shi->dxco, shi->dyco, inp, shi->mat->lbias);
}
- else if(lar->mode & LA_SHAD_RAY) {
+ else if (lar->mode & LA_SHAD_RAY) {
ray_shadow(shi, lar, shadfac);
}
- if(shi->depth==0) {
+ if (shi->depth==0) {
copy_v4_v4(lss->shadfac, shadfac);
lss->samplenr= shi->samplenr;
}
@@ -1135,7 +1136,7 @@ void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float shadfac[4],
/* lampdistance and spot angle, writes in lv and dist */
float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *dist)
{
- if(lar->type==LA_SUN || lar->type==LA_HEMI) {
+ if (lar->type==LA_SUN || lar->type==LA_HEMI) {
*dist= 1.0f;
copy_v3_v3(lv, lar->vec);
return 1.0f;
@@ -1149,7 +1150,7 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
mul_v3_fl(lv, t);
/* area type has no quad or sphere option */
- if(lar->type==LA_AREA) {
+ if (lar->type==LA_AREA) {
/* area is single sided */
//if(dot_v3v3(lv, lar->vec) > 0.0f)
// visifac= 1.0f;
@@ -1174,9 +1175,9 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
visifac = lar->dist / (lar->dist + dist[0]*dist[0]);
break;
case LA_FALLOFF_SLIDERS:
- if(lar->ld1>0.0f)
+ if (lar->ld1>0.0f)
visifac= lar->dist/(lar->dist+lar->ld1*dist[0]);
- if(lar->ld2>0.0f)
+ if (lar->ld2>0.0f)
visifac*= lar->distkw/(lar->distkw+lar->ld2*dist[0]*dist[0]);
break;
case LA_FALLOFF_CURVE:
@@ -1184,20 +1185,20 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
break;
}
- if(lar->mode & LA_SPHERE) {
+ if (lar->mode & LA_SPHERE) {
float t= lar->dist - dist[0];
- if(t<=0.0f)
+ if (t<=0.0f)
visifac= 0.0f;
else
visifac*= t/lar->dist;
}
- if(visifac > 0.0f) {
- if(lar->type==LA_SPOT) {
+ if (visifac > 0.0f) {
+ if (lar->type==LA_SPOT) {
float inpr;
- if(lar->mode & LA_SQUARE) {
- if(dot_v3v3(lv, lar->vec) > 0.0f) {
+ if (lar->mode & LA_SQUARE) {
+ if (dot_v3v3(lv, lar->vec) > 0.0f) {
float lvrot[3], x;
/* rotate view to lampspace */
@@ -1216,11 +1217,11 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
}
t= lar->spotsi;
- if(inpr<=t)
+ if (inpr<=t)
visifac= 0.0f;
else {
t= inpr-t;
- if(t<lar->spotbl && lar->spotbl!=0.0f) {
+ if (t<lar->spotbl && lar->spotbl!=0.0f) {
/* soft area */
float i= t/lar->spotbl;
t= i*i;
@@ -1259,11 +1260,11 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
/* lampdist, spot angle, area side, ... */
visifac= lamp_get_visibility(lar, shi->co, lv, &lampdist);
- if(visifac==0.0f)
+ if (visifac==0.0f)
return;
- if(lar->type==LA_SPOT) {
- if(lar->mode & LA_OSATEX) {
+ if (lar->type==LA_SPOT) {
+ if (lar->mode & LA_OSATEX) {
shi->osatex= 1; /* signal for multitex() */
shi->dxlv[0]= lv[0] - (shi->co[0]-lar->co[0]+shi->dxco[0])/lampdist;
@@ -1285,15 +1286,15 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
lashdw[1]= lar->shdwg;
lashdw[2]= lar->shdwb;
- if(lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv, shi, lacol, LA_TEXTURE);
- if(lar->mode & LA_SHAD_TEX) do_lamp_tex(lar, lv, shi, lashdw, LA_SHAD_TEX);
+ if (lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv, shi, lacol, LA_TEXTURE);
+ if (lar->mode & LA_SHAD_TEX) do_lamp_tex(lar, lv, shi, lashdw, LA_SHAD_TEX);
/* tangent case; calculate fake face normal, aligned with lampvector */
/* note, vnor==vn is used as tangent trigger for buffer shadow */
- if(vlr->flag & R_TANGENT) {
+ if (vlr->flag & R_TANGENT) {
float cross[3], nstrand[3], blend;
- if(ma->mode & MA_STR_SURFDIFF) {
+ if (ma->mode & MA_STR_SURFDIFF) {
cross_v3_v3v3(cross, shi->surfnor, vn);
cross_v3_v3v3(nstrand, vn, cross);
@@ -1310,8 +1311,8 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
normalize_v3(vnor);
}
- if(ma->strand_surfnor > 0.0f) {
- if(ma->strand_surfnor > shi->surfdist) {
+ if (ma->strand_surfnor > 0.0f) {
+ if (ma->strand_surfnor > shi->surfdist) {
blend= (ma->strand_surfnor - shi->surfdist)/ma->strand_surfnor;
interp_v3_v3v3(vnor, vnor, shi->surfnor, blend);
normalize_v3(vnor);
@@ -1336,18 +1337,18 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
/* phong threshold to prevent backfacing faces having artefacts on ray shadow (terminator problem) */
/* this complex construction screams for a nicer implementation! (ton) */
- if(R.r.mode & R_SHADOW) {
- if(ma->mode & MA_SHADOW) {
- if(lar->type==LA_HEMI || lar->type==LA_AREA);
- else if((ma->mode & MA_RAYBIAS) && (lar->mode & LA_SHAD_RAY) && (vlr->flag & R_SMOOTH)) {
+ if (R.r.mode & R_SHADOW) {
+ if (ma->mode & MA_SHADOW) {
+ if (lar->type==LA_HEMI || lar->type==LA_AREA);
+ else if ((ma->mode & MA_RAYBIAS) && (lar->mode & LA_SHAD_RAY) && (vlr->flag & R_SMOOTH)) {
float thresh= shi->obr->ob->smoothresh;
- if(inp>thresh)
+ if (inp>thresh)
phongcorr= (inp-thresh)/(inp*(1.0f-thresh));
else
phongcorr= 0.0f;
}
- else if(ma->sbias!=0.0f && ((lar->mode & LA_SHAD_RAY) || lar->shb)) {
- if(inp>ma->sbias)
+ else if (ma->sbias!=0.0f && ((lar->mode & LA_SHAD_RAY) || lar->shb)) {
+ if (inp>ma->sbias)
phongcorr= (inp-ma->sbias)/(inp*(1.0f-ma->sbias));
else
phongcorr= 0.0f;
@@ -1356,57 +1357,57 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
}
/* diffuse shaders */
- if(lar->mode & LA_NO_DIFF) {
+ if (lar->mode & LA_NO_DIFF) {
is= 0.0f; // skip shaders
}
- else if(lar->type==LA_HEMI) {
+ else if (lar->type==LA_HEMI) {
is= 0.5f*inp + 0.5f;
}
else {
- if(lar->type==LA_AREA)
+ if (lar->type==LA_AREA)
inp= area_lamp_energy_multisample(lar, shi->co, vn);
/* diffuse shaders (oren nayer gets inp from area light) */
- if(ma->diff_shader==MA_DIFF_ORENNAYAR) is= OrenNayar_Diff(inp, vn, lv, view, ma->roughness);
- else if(ma->diff_shader==MA_DIFF_TOON) is= Toon_Diff(vn, lv, view, ma->param[0], ma->param[1]);
- else if(ma->diff_shader==MA_DIFF_MINNAERT) is= Minnaert_Diff(inp, vn, view, ma->darkness);
- else if(ma->diff_shader==MA_DIFF_FRESNEL) is= Fresnel_Diff(vn, lv, view, ma->param[0], ma->param[1]);
+ if (ma->diff_shader==MA_DIFF_ORENNAYAR) is= OrenNayar_Diff(inp, vn, lv, view, ma->roughness);
+ else if (ma->diff_shader==MA_DIFF_TOON) is= Toon_Diff(vn, lv, view, ma->param[0], ma->param[1]);
+ else if (ma->diff_shader==MA_DIFF_MINNAERT) is= Minnaert_Diff(inp, vn, view, ma->darkness);
+ else if (ma->diff_shader==MA_DIFF_FRESNEL) is= Fresnel_Diff(vn, lv, view, ma->param[0], ma->param[1]);
else is= inp; // Lambert
}
/* 'is' is diffuse */
- if((ma->shade_flag & MA_CUBIC) && is>0.0f && is<1.0f)
+ if ((ma->shade_flag & MA_CUBIC) && is>0.0f && is<1.0f)
is= 3.0f*is*is - 2.0f*is*is*is; // nicer termination of shades
i= is*phongcorr;
- if(i>0.0f) {
+ if (i>0.0f) {
i*= visifac*shi->refl;
}
i_noshad= i;
vn= shi->vn; // bring back original vector, we use special specular shaders for tangent
- if(ma->mode & MA_TANGENT_V)
+ if (ma->mode & MA_TANGENT_V)
vn= shi->tang;
/* init transp shadow */
shadfac[0]= shadfac[1]= shadfac[2]= shadfac[3]= 1.0f;
/* shadow and spec, (visifac==0 outside spot) */
- if(visifac> 0.0f) {
+ if (visifac> 0.0f) {
- if((R.r.mode & R_SHADOW)) {
- if(ma->mode & MA_SHADOW) {
- if(lar->shb || (lar->mode & LA_SHAD_RAY)) {
+ if ((R.r.mode & R_SHADOW)) {
+ if (ma->mode & MA_SHADOW) {
+ if (lar->shb || (lar->mode & LA_SHAD_RAY)) {
- if(vn==vnor) /* tangent trigger */
+ if (vn==vnor) /* tangent trigger */
lamp_get_shadow(lar, shi, dot_v3v3(shi->vn, lv), shadfac, shi->depth);
else
lamp_get_shadow(lar, shi, inp, shadfac, shi->depth);
/* warning, here it skips the loop */
- if((lar->mode & LA_ONLYSHADOW) && i>0.0f) {
+ if ((lar->mode & LA_ONLYSHADOW) && i>0.0f) {
shadfac[3]= i*lar->energy*(1.0f-shadfac[3]);
shr->shad[0] -= shadfac[3]*shi->r*(1.0f-lashdw[0]);
@@ -1427,9 +1428,9 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
}
/* in case 'no diffuse' we still do most calculus, spec can be in shadow.*/
- if(!(lar->mode & LA_NO_DIFF)) {
- if(i>0.0f) {
- if(ma->mode & MA_SHADOW_TRA)
+ if (!(lar->mode & LA_NO_DIFF)) {
+ if (i>0.0f) {
+ if (ma->mode & MA_SHADOW_TRA)
add_to_diffuse(shr->shad, shi, is, i*shadfac[0]*lacol[0], i*shadfac[1]*lacol[1], i*shadfac[2]*lacol[2]);
else
add_to_diffuse(shr->shad, shi, is, i*lacol[0], i*lacol[1], i*lacol[2]);
@@ -1438,8 +1439,8 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
if (i_noshad>i && !(lashdw[0]==0 && lashdw[1]==0 && lashdw[2]==0)) {
add_to_diffuse(shr->shad, shi, is, lashdw[0]*(i_noshad-i)*lacol[0], lashdw[1]*(i_noshad-i)*lacol[1], lashdw[2]*(i_noshad-i)*lacol[2]);
}
- if(i_noshad>0.0f) {
- if(passflag & (SCE_PASS_DIFFUSE|SCE_PASS_SHADOW)) {
+ if (i_noshad>0.0f) {
+ if (passflag & (SCE_PASS_DIFFUSE|SCE_PASS_SHADOW)) {
add_to_diffuse(shr->diff, shi, is, i_noshad*lacol[0], i_noshad*lacol[1], i_noshad*lacol[2]);
}
else
@@ -1450,10 +1451,10 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
/* specularity */
shadfac[3]*= phongcorr; /* note, shadfac not allowed to be stored nonlocal */
- if(shadfac[3]>0.0f && shi->spec!=0.0f && !(lar->mode & LA_NO_SPEC) && !(lar->mode & LA_ONLYSHADOW)) {
+ if (shadfac[3]>0.0f && shi->spec!=0.0f && !(lar->mode & LA_NO_SPEC) && !(lar->mode & LA_ONLYSHADOW)) {
- if(!(passflag & (SCE_PASS_COMBINED|SCE_PASS_SPEC)));
- else if(lar->type==LA_HEMI) {
+ if (!(passflag & (SCE_PASS_COMBINED|SCE_PASS_SPEC)));
+ else if (lar->type==LA_HEMI) {
float t;
/* hemi uses no spec shaders (yet) */
@@ -1465,7 +1466,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
t= vn[0]*lv[0]+vn[1]*lv[1]+vn[2]*lv[2];
- if(lar->type==LA_HEMI) {
+ if (lar->type==LA_HEMI) {
t= 0.5f*t+0.5f;
}
@@ -1479,23 +1480,23 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
/* specular shaders */
float specfac, t;
- if(ma->spec_shader==MA_SPEC_PHONG)
+ if (ma->spec_shader==MA_SPEC_PHONG)
specfac= Phong_Spec(vn, lv, view, shi->har, (vlr->flag & R_TANGENT) || (ma->mode & MA_TANGENT_V));
- else if(ma->spec_shader==MA_SPEC_COOKTORR)
+ else if (ma->spec_shader==MA_SPEC_COOKTORR)
specfac= CookTorr_Spec(vn, lv, view, shi->har, (vlr->flag & R_TANGENT) || (ma->mode & MA_TANGENT_V));
- else if(ma->spec_shader==MA_SPEC_BLINN)
+ else if (ma->spec_shader==MA_SPEC_BLINN)
specfac= Blinn_Spec(vn, lv, view, ma->refrac, (float)shi->har, (vlr->flag & R_TANGENT) || (ma->mode & MA_TANGENT_V));
- else if(ma->spec_shader==MA_SPEC_WARDISO)
+ else if (ma->spec_shader==MA_SPEC_WARDISO)
specfac= WardIso_Spec( vn, lv, view, ma->rms, (vlr->flag & R_TANGENT) || (ma->mode & MA_TANGENT_V));
else
specfac= Toon_Spec(vn, lv, view, ma->param[2], ma->param[3], (vlr->flag & R_TANGENT) || (ma->mode & MA_TANGENT_V));
/* area lamp correction */
- if(lar->type==LA_AREA) specfac*= inp;
+ if (lar->type==LA_AREA) specfac*= inp;
t= shadfac[3]*shi->spec*visifac*specfac;
- if(ma->mode & MA_RAMP_SPEC) {
+ if (ma->mode & MA_RAMP_SPEC) {
float spec[3];
do_specular_ramp(shi, specfac, t, spec);
shr->spec[0]+= t*(lacol[0] * spec[0]);
@@ -1515,7 +1516,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
{
- if(R.r.mode & R_SHADOW) {
+ if (R.r.mode & R_SHADOW) {
ListBase *lights;
LampRen *lar;
GroupObject *go;
@@ -1529,28 +1530,28 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
accum= ir= 0.0f;
lights= get_lights(shi);
- for(go=lights->first; go; go= go->next) {
+ for (go=lights->first; go; go= go->next) {
lar= go->lampren;
- if(lar==NULL) continue;
+ if (lar==NULL) continue;
/* yafray: ignore shading by photonlights, not used in Blender */
if (lar->type==LA_YF_PHOTON) continue;
- if(lar->mode & LA_LAYER) if((lar->lay & shi->obi->lay)==0) continue;
- if((lar->lay & shi->lay)==0) continue;
+ if (lar->mode & LA_LAYER) if ((lar->lay & shi->obi->lay)==0) continue;
+ if ((lar->lay & shi->lay)==0) continue;
- if(lar->shb || (lar->mode & LA_SHAD_RAY)) {
+ if (lar->shb || (lar->mode & LA_SHAD_RAY)) {
visifac= lamp_get_visibility(lar, shi->co, lv, &lampdist);
ir+= 1.0f;
- if(visifac <= 0.0f) {
+ if (visifac <= 0.0f) {
if (shi->mat->shadowonly_flag == MA_SO_OLD)
accum+= 1.0f;
continue;
}
inpr= dot_v3v3(shi->vn, lv);
- if(inpr <= 0.0f) {
+ if (inpr <= 0.0f) {
if (shi->mat->shadowonly_flag == MA_SO_OLD)
accum+= 1.0f;
@@ -1574,7 +1575,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
}
/* Apply shadows as alpha */
- if(ir>0.0f) {
+ if (ir>0.0f) {
if (shi->mat->shadowonly_flag == MA_SO_OLD) {
accum = 1.0f - accum/ir;
}
@@ -1604,13 +1605,13 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
}
/* quite disputable this... also note it doesn't mirror-raytrace */
- if((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT)) && shi->amb!=0.0f) {
+ if ((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT)) && shi->amb!=0.0f) {
float f;
- if(R.wrld.mode & WO_AMB_OCC) {
+ if (R.wrld.mode & WO_AMB_OCC) {
f= R.wrld.aoenergy*shi->amb;
- if(R.wrld.aomix==WO_AOADD) {
+ if (R.wrld.aomix==WO_AOADD) {
if (shi->mat->shadowonly_flag == MA_SO_OLD) {
f= f*(1.0f - rgb_to_grayscale(shi->ao));
shr->alpha= (shr->alpha + f)*f;
@@ -1624,7 +1625,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
shr->alpha= (1.0f - f)*shr->alpha + f*(1.0f - (1.0f - shr->alpha)*rgb_to_grayscale(shi->ao));
}
- if(R.wrld.mode & WO_ENV_LIGHT) {
+ if (R.wrld.mode & WO_ENV_LIGHT) {
if (shi->mat->shadowonly_flag == MA_SO_OLD) {
f= R.wrld.ao_env_energy*shi->amb*(1.0f - rgb_to_grayscale(shi->env));
shr->alpha= (shr->alpha + f)*f;
@@ -1654,10 +1655,10 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
memset(shr, 0, sizeof(ShadeResult));
- if(!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
+ if (!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
/* separate loop */
- if(ma->mode & MA_ONLYSHADOW) {
+ if (ma->mode & MA_ONLYSHADOW) {
shade_lamp_loop_only_shadow(shi, shr);
return;
}
@@ -1666,27 +1667,27 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shi->refcol[0]= shi->refcol[1]= shi->refcol[2]= shi->refcol[3]= 0.0f;
/* material color itself */
- if(passflag & (SCE_PASS_COMBINED|SCE_PASS_RGBA)) {
- if(ma->mode & (MA_FACETEXTURE)) {
+ if (passflag & (SCE_PASS_COMBINED|SCE_PASS_RGBA)) {
+ if (ma->mode & (MA_FACETEXTURE)) {
shi->r= shi->vcol[0];
shi->g= shi->vcol[1];
shi->b= shi->vcol[2];
- if(ma->mode & (MA_FACETEXTURE_ALPHA))
+ if (ma->mode & (MA_FACETEXTURE_ALPHA))
shi->alpha= shi->vcol[3];
}
- else if(ma->vcol_alpha) {
+ else if (ma->vcol_alpha) {
shi->r= shi->vcol[0];
shi->g= shi->vcol[1];
shi->b= shi->vcol[2];
shi->alpha= shi->vcol[3];
}
- else if(ma->mode & (MA_VERTEXCOLP)) {
+ else if (ma->mode & (MA_VERTEXCOLP)) {
float neg_alpha = 1.0f - shi->vcol[3];
shi->r= shi->r*neg_alpha + shi->vcol[0]*shi->vcol[3];
shi->g= shi->g*neg_alpha + shi->vcol[1]*shi->vcol[3];
shi->b= shi->b*neg_alpha + shi->vcol[2]*shi->vcol[3];
}
- if(ma->texco){
+ if (ma->texco) {
do_material_tex(shi, &R);
if (!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
}
@@ -1696,8 +1697,8 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shr->col[2]= shi->b*shi->alpha;
shr->col[3]= shi->alpha;
- if((ma->sss_flag & MA_DIFF_SSS) && !sss_pass_done(&R, ma)) {
- if(ma->sss_texfac == 0.0f) {
+ if ((ma->sss_flag & MA_DIFF_SSS) && !sss_pass_done(&R, ma)) {
+ if (ma->sss_texfac == 0.0f) {
shi->r= shi->g= shi->b= shi->alpha= 1.0f;
shr->col[0]= shr->col[1]= shr->col[2]= shr->col[3]= 1.0f;
}
@@ -1715,7 +1716,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
}
}
- if(ma->mode & MA_SHLESS) {
+ if (ma->mode & MA_SHLESS) {
shr->combined[0]= shi->r;
shr->combined[1]= shi->g;
shr->combined[2]= shi->b;
@@ -1723,7 +1724,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
return;
}
- if( (ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))== MA_VERTEXCOL ) { // vertexcolor light
+ if ( (ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))== MA_VERTEXCOL ) { // vertexcolor light
shr->emit[0]= shi->r*(shi->emit+shi->vcol[0]*shi->vcol[3]);
shr->emit[1]= shi->g*(shi->emit+shi->vcol[1]*shi->vcol[3]);
shr->emit[2]= shi->b*(shi->emit+shi->vcol[2]*shi->vcol[3]);
@@ -1735,12 +1736,12 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
}
/* AO pass */
- if(R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) {
- if(((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
+ if (R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) {
+ if (((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
|| (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) {
- if(R.r.mode & R_SHADOW) {
+ if (R.r.mode & R_SHADOW) {
/* AO was calculated for scanline already */
- if(shi->depth || shi->volume_depth)
+ if (shi->depth || shi->volume_depth)
ambient_occlusion(shi);
copy_v3_v3(shr->ao, shi->ao);
copy_v3_v3(shr->env, shi->env); // XXX multiply
@@ -1750,22 +1751,22 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
}
/* lighting pass */
- if(passflag & (SCE_PASS_COMBINED|SCE_PASS_DIFFUSE|SCE_PASS_SPEC|SCE_PASS_SHADOW)) {
+ if (passflag & (SCE_PASS_COMBINED|SCE_PASS_DIFFUSE|SCE_PASS_SPEC|SCE_PASS_SHADOW)) {
GroupObject *go;
ListBase *lights;
LampRen *lar;
lights= get_lights(shi);
- for(go=lights->first; go; go= go->next) {
+ for (go=lights->first; go; go= go->next) {
lar= go->lampren;
- if(lar==NULL) continue;
+ if (lar==NULL) continue;
/* yafray: ignore shading by photonlights, not used in Blender */
if (lar->type==LA_YF_PHOTON) continue;
/* test for lamp layer */
- if(lar->mode & LA_LAYER) if((lar->lay & shi->obi->lay)==0) continue;
- if((lar->lay & shi->lay)==0) continue;
+ if (lar->mode & LA_LAYER) if ((lar->lay & shi->obi->lay)==0) continue;
+ if ((lar->lay & shi->lay)==0) continue;
/* accumulates in shr->diff and shr->spec and shr->shad (diffuse with shadow!) */
shade_one_light(lar, shi, shr, passflag);
@@ -1781,18 +1782,18 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
if (shr->shad[1] < 0) shr->shad[1] = 0;
if (shr->shad[2] < 0) shr->shad[2] = 0;
- if(ma->sss_flag & MA_DIFF_SSS) {
+ if (ma->sss_flag & MA_DIFF_SSS) {
float sss[3], col[3], invalpha, texfac= ma->sss_texfac;
/* this will return false in the preprocess stage */
- if(sample_sss(&R, ma, shi->co, sss)) {
+ if (sample_sss(&R, ma, shi->co, sss)) {
invalpha= (shr->col[3] > FLT_EPSILON)? 1.0f/shr->col[3]: 1.0f;
- if(texfac==0.0f) {
+ if (texfac==0.0f) {
copy_v3_v3(col, shr->col);
mul_v3_fl(col, invalpha);
}
- else if(texfac==1.0f) {
+ else if (texfac==1.0f) {
col[0]= col[1]= col[2]= 1.0f;
mul_v3_fl(col, invalpha);
}
@@ -1808,7 +1809,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shr->diff[1]= sss[1]*col[1];
shr->diff[2]= sss[2]*col[2];
- if(shi->combinedflag & SCE_PASS_SHADOW) {
+ if (shi->combinedflag & SCE_PASS_SHADOW) {
shr->shad[0]= shr->diff[0];
shr->shad[1]= shr->diff[1];
shr->shad[2]= shr->diff[2];
@@ -1816,43 +1817,43 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
}
}
- if(shi->combinedflag & SCE_PASS_SHADOW)
+ if (shi->combinedflag & SCE_PASS_SHADOW)
copy_v3_v3(shr->combined, shr->shad); /* note, no ';' ! */
else
copy_v3_v3(shr->combined, shr->diff);
/* calculate shadow pass, we use a multiplication mask */
/* if diff = 0,0,0 it doesn't matter what the shadow pass is, so leave it as is */
- if(passflag & SCE_PASS_SHADOW && !(shr->diff[0]==0.0f && shr->diff[1]==0.0f && shr->diff[2]==0.0f)) {
- if(shr->diff[0]!=0.0f) shr->shad[0]= shr->shad[0]/shr->diff[0];
+ if (passflag & SCE_PASS_SHADOW && !(shr->diff[0]==0.0f && shr->diff[1]==0.0f && shr->diff[2]==0.0f)) {
+ if (shr->diff[0]!=0.0f) shr->shad[0]= shr->shad[0]/shr->diff[0];
/* can't determine proper shadow from shad/diff (0/0), so use shadow intensity */
- else if(shr->shad[0]==0.0f) shr->shad[0]= shr->shad[3];
+ else if (shr->shad[0]==0.0f) shr->shad[0]= shr->shad[3];
- if(shr->diff[1]!=0.0f) shr->shad[1]= shr->shad[1]/shr->diff[1];
- else if(shr->shad[1]==0.0f) shr->shad[1]= shr->shad[3];
+ if (shr->diff[1]!=0.0f) shr->shad[1]= shr->shad[1]/shr->diff[1];
+ else if (shr->shad[1]==0.0f) shr->shad[1]= shr->shad[3];
- if(shr->diff[2]!=0.0f) shr->shad[2]= shr->shad[2]/shr->diff[2];
- else if(shr->shad[2]==0.0f) shr->shad[2]= shr->shad[3];
+ if (shr->diff[2]!=0.0f) shr->shad[2]= shr->shad[2]/shr->diff[2];
+ else if (shr->shad[2]==0.0f) shr->shad[2]= shr->shad[3];
}
/* exposure correction */
- if((R.wrld.exp!=0.0f || R.wrld.range!=1.0f) && !R.sss_points) {
+ if ((R.wrld.exp!=0.0f || R.wrld.range!=1.0f) && !R.sss_points) {
wrld_exposure_correct(shr->combined); /* has no spec! */
wrld_exposure_correct(shr->spec);
}
}
/* alpha in end, spec can influence it */
- if(passflag & (SCE_PASS_COMBINED)) {
- if((ma->fresnel_tra!=0.0f) && (shi->mode & MA_TRANSP))
+ if (passflag & (SCE_PASS_COMBINED)) {
+ if ((ma->fresnel_tra!=0.0f) && (shi->mode & MA_TRANSP))
shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
/* note: shi->mode! */
- if(shi->mode & MA_TRANSP && (shi->mode & (MA_ZTRANSP|MA_RAYTRANSP))) {
- if(shi->spectra!=0.0f) {
+ if (shi->mode & MA_TRANSP && (shi->mode & (MA_ZTRANSP|MA_RAYTRANSP))) {
+ if (shi->spectra!=0.0f) {
float t = MAX3(shr->spec[0], shr->spec[1], shr->spec[2]);
t *= shi->spectra;
- if(t>1.0f) t= 1.0f;
+ if (t>1.0f) t= 1.0f;
shi->alpha= (1.0f-t)*shi->alpha+t;
}
}
@@ -1860,19 +1861,19 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shr->alpha= shi->alpha;
/* from now stuff everything in shr->combined: ambient, AO, radio, ramps, exposure */
- if(!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) {
- if(R.r.mode & R_SHADOW) {
+ if (!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) {
+ if (R.r.mode & R_SHADOW) {
/* add AO in combined? */
- if(R.wrld.mode & WO_AMB_OCC)
- if(shi->combinedflag & SCE_PASS_AO)
+ if (R.wrld.mode & WO_AMB_OCC)
+ if (shi->combinedflag & SCE_PASS_AO)
ambient_occlusion_apply(shi, shr);
- if(R.wrld.mode & WO_ENV_LIGHT)
- if(shi->combinedflag & SCE_PASS_ENVIRONMENT)
+ if (R.wrld.mode & WO_ENV_LIGHT)
+ if (shi->combinedflag & SCE_PASS_ENVIRONMENT)
environment_lighting_apply(shi, shr);
- if(R.wrld.mode & WO_INDIRECT_LIGHT)
- if(shi->combinedflag & SCE_PASS_INDIRECT)
+ if (R.wrld.mode & WO_INDIRECT_LIGHT)
+ if (shi->combinedflag & SCE_PASS_INDIRECT)
indirect_lighting_apply(shi, shr);
}
@@ -1880,36 +1881,36 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shr->combined[1]+= shi->ambg;
shr->combined[2]+= shi->ambb;
- if(ma->mode & MA_RAMP_COL) ramp_diffuse_result(shr->combined, shi);
+ if (ma->mode & MA_RAMP_COL) ramp_diffuse_result(shr->combined, shi);
}
- if(ma->mode & MA_RAMP_SPEC) ramp_spec_result(shr->spec, shi);
+ if (ma->mode & MA_RAMP_SPEC) ramp_spec_result(shr->spec, shi);
/* refcol is for envmap only */
- if(shi->refcol[0]!=0.0f) {
+ if (shi->refcol[0]!=0.0f) {
float result[3];
result[0]= shi->mirr*shi->refcol[1] + (1.0f - shi->mirr*shi->refcol[0])*shr->combined[0];
result[1]= shi->mirg*shi->refcol[2] + (1.0f - shi->mirg*shi->refcol[0])*shr->combined[1];
result[2]= shi->mirb*shi->refcol[3] + (1.0f - shi->mirb*shi->refcol[0])*shr->combined[2];
- if(passflag & SCE_PASS_REFLECT)
+ if (passflag & SCE_PASS_REFLECT)
sub_v3_v3v3(shr->refl, result, shr->combined);
- if(shi->combinedflag & SCE_PASS_REFLECT)
+ if (shi->combinedflag & SCE_PASS_REFLECT)
copy_v3_v3(shr->combined, result);
}
/* and add emit and spec */
- if(shi->combinedflag & SCE_PASS_EMIT)
+ if (shi->combinedflag & SCE_PASS_EMIT)
add_v3_v3(shr->combined, shr->emit);
- if(shi->combinedflag & SCE_PASS_SPEC)
+ if (shi->combinedflag & SCE_PASS_SPEC)
add_v3_v3(shr->combined, shr->spec);
/* modulate by the object color */
- if((ma->shade_flag & MA_OBCOLOR) && shi->obr->ob) {
- if(!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) {
+ if ((ma->shade_flag & MA_OBCOLOR) && shi->obr->ob) {
+ if (!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) {
float obcol[4];
copy_v4_v4(obcol, shi->obr->ob->col);
diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c
index a60db8a963f..dd1bddc5020 100644
--- a/source/blender/render/intern/source/sss.c
+++ b/source/blender/render/intern/source/sss.c
@@ -77,8 +77,6 @@
#include "sss.h"
#include "zbuf.h"
-extern Render R; // meh
-
/* Generic Multiple Scattering API */
/* Relevant papers:
@@ -186,26 +184,26 @@ static float compute_reduced_albedo(ScatterSettings *ss)
fxn= f_Rd(xn, ss->A, ss->ro);
fxn_1= f_Rd(xn_1, ss->A, ss->ro);
- for(i= 0; i < max_iteration_count; i++) {
+ for (i= 0; i < max_iteration_count; i++) {
fsub= (fxn - fxn_1);
- if(fabsf(fsub) < tolerance)
+ if (fabsf(fsub) < tolerance)
break;
d= ((xn - xn_1)/fsub)*fxn;
- if(fabsf(d) < tolerance)
+ if (fabsf(d) < tolerance)
break;
xn_1= xn;
fxn_1= fxn;
xn= xn - d;
- if(xn > 1.0f) xn= 1.0f;
- if(xn_1 > 1.0f) xn_1= 1.0f;
+ if (xn > 1.0f) xn= 1.0f;
+ if (xn_1 > 1.0f) xn_1= 1.0f;
fxn= f_Rd(xn, ss->A, ss->ro);
}
/* avoid division by zero later */
- if(xn <= 0.0f)
+ if (xn <= 0.0f)
xn= 0.00001f;
return xn;
@@ -242,15 +240,15 @@ static void approximate_Rd_rgb(ScatterSettings **ss, float rr, float *rd)
float indexf, t, idxf;
int index;
- if(rr > (RD_TABLE_RANGE_2*RD_TABLE_RANGE_2));
- else if(rr > RD_TABLE_RANGE) {
+ if (rr > (RD_TABLE_RANGE_2*RD_TABLE_RANGE_2));
+ else if (rr > RD_TABLE_RANGE) {
rr= sqrt(rr);
indexf= rr*(RD_TABLE_SIZE/RD_TABLE_RANGE_2);
index= (int)indexf;
idxf= (float)index;
t= indexf - idxf;
- if(index >= 0 && index < RD_TABLE_SIZE) {
+ if (index >= 0 && index < RD_TABLE_SIZE) {
rd[0]= (ss[0]->tableRd2[index]*(1-t) + ss[0]->tableRd2[index+1]*t);
rd[1]= (ss[1]->tableRd2[index]*(1-t) + ss[1]->tableRd2[index+1]*t);
rd[2]= (ss[2]->tableRd2[index]*(1-t) + ss[2]->tableRd2[index+1]*t);
@@ -263,7 +261,7 @@ static void approximate_Rd_rgb(ScatterSettings **ss, float rr, float *rd)
idxf= (float)index;
t= indexf - idxf;
- if(index >= 0 && index < RD_TABLE_SIZE) {
+ if (index >= 0 && index < RD_TABLE_SIZE) {
rd[0]= (ss[0]->tableRd[index]*(1-t) + ss[0]->tableRd[index+1]*t);
rd[1]= (ss[1]->tableRd[index]*(1-t) + ss[1]->tableRd[index+1]*t);
rd[2]= (ss[2]->tableRd[index]*(1-t) + ss[2]->tableRd[index+1]*t);
@@ -285,7 +283,7 @@ static void build_Rd_table(ScatterSettings *ss)
ss->tableRd= MEM_mallocN(sizeof(float)*size, "scatterTableRd");
ss->tableRd2= MEM_mallocN(sizeof(float)*size, "scatterTableRd");
- for(i= 0; i < size; i++) {
+ for (i= 0; i < size; i++) {
r= i*(RD_TABLE_RANGE/RD_TABLE_SIZE);
/*if(r < ss->invsigma_t_*ss->invsigma_t_)
r= ss->invsigma_t_*ss->invsigma_t_;*/
@@ -355,7 +353,7 @@ static void add_radiance(ScatterTree *tree, float *frontrad, float *backrad, flo
approximate_Rd_rgb(tree->ss, rr, rd);
- if(frontrad && area) {
+ if (frontrad && area) {
frontrd[0] = rd[0]*area;
frontrd[1] = rd[1]*area;
frontrd[2] = rd[2]*area;
@@ -368,7 +366,7 @@ static void add_radiance(ScatterTree *tree, float *frontrad, float *backrad, flo
result->rdsum[1] += frontrd[1];
result->rdsum[2] += frontrd[2];
}
- if(backrad && backarea) {
+ if (backrad && backarea) {
backrd[0] = rd[0]*backarea;
backrd[1] = rd[1]*backarea;
backrd[2] = rd[2]*backarea;
@@ -388,15 +386,15 @@ static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int
float sub[3], dist;
int i, index = 0;
- if(node->totpoint > 0) {
+ if (node->totpoint > 0) {
/* leaf - add radiance from all samples */
- for(i=0; i<node->totpoint; i++) {
+ for (i=0; i<node->totpoint; i++) {
ScatterPoint *p= &node->points[i];
sub_v3_v3v3(sub, co, p->co);
dist= dot_v3v3(sub, sub);
- if(p->back)
+ if (p->back)
add_radiance(tree, NULL, p->rad, 0.0f, p->area, dist, result);
else
add_radiance(tree, p->rad, NULL, p->area, 0.0f, dist, result);
@@ -407,11 +405,11 @@ static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int
if (self)
index = SUBNODE_INDEX(co, node->split);
- for(i=0; i<8; i++) {
- if(node->child[i]) {
+ for (i=0; i<8; i++) {
+ if (node->child[i]) {
ScatterNode *subnode= node->child[i];
- if(self && index == i) {
+ if (self && index == i) {
/* always traverse node containing the point */
traverse_octree(tree, subnode, co, 1, result);
}
@@ -421,7 +419,7 @@ static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int
dist= dot_v3v3(sub, sub);
/* actually area/dist > error, but this avoids division */
- if(subnode->area+subnode->backarea>tree->error*dist) {
+ if (subnode->area+subnode->backarea>tree->error*dist) {
traverse_octree(tree, subnode, co, 0, result);
}
else {
@@ -458,13 +456,13 @@ static void compute_radiance(ScatterTree *tree, float *co, float *rad)
copy_v3_v3(rdsum, result.rdsum);
add_v3_v3v3(backrdsum, result.rdsum, result.backrdsum);
- if(rdsum[0] > 1e-16f) rad[0]= tree->ss[0]->color*rad[0]/rdsum[0];
- if(rdsum[1] > 1e-16f) rad[1]= tree->ss[1]->color*rad[1]/rdsum[1];
- if(rdsum[2] > 1e-16f) rad[2]= tree->ss[2]->color*rad[2]/rdsum[2];
+ if (rdsum[0] > 1e-16f) rad[0]= tree->ss[0]->color*rad[0]/rdsum[0];
+ if (rdsum[1] > 1e-16f) rad[1]= tree->ss[1]->color*rad[1]/rdsum[1];
+ if (rdsum[2] > 1e-16f) rad[2]= tree->ss[2]->color*rad[2]/rdsum[2];
- if(backrdsum[0] > 1e-16f) backrad[0]= tree->ss[0]->color*backrad[0]/backrdsum[0];
- if(backrdsum[1] > 1e-16f) backrad[1]= tree->ss[1]->color*backrad[1]/backrdsum[1];
- if(backrdsum[2] > 1e-16f) backrad[2]= tree->ss[2]->color*backrad[2]/backrdsum[2];
+ if (backrdsum[0] > 1e-16f) backrad[0]= tree->ss[0]->color*backrad[0]/backrdsum[0];
+ if (backrdsum[1] > 1e-16f) backrad[1]= tree->ss[1]->color*backrad[1]/backrdsum[1];
+ if (backrdsum[2] > 1e-16f) backrad[2]= tree->ss[2]->color*backrad[2]/backrdsum[2];
rad[0]= MAX2(rad[0], backrad[0]);
rad[1]= MAX2(rad[1], backrad[1]);
@@ -485,7 +483,7 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
/* compute total rad, rad weighted average position,
* and total area */
- for(i=0; i<node->totpoint; i++) {
+ for (i=0; i<node->totpoint; i++) {
p= &node->points[i];
rad= p->area*fabsf(p->rad[0] + p->rad[1] + p->rad[2]);
@@ -495,7 +493,7 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
node->co[1] += rad*p->co[1];
node->co[2] += rad*p->co[2];
- if(p->back) {
+ if (p->back) {
node->backrad[0] += p->rad[0]*p->area;
node->backrad[1] += p->rad[1]*p->area;
node->backrad[2] += p->rad[2]*p->area;
@@ -511,20 +509,20 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
}
}
- if(node->area > 1e-16f) {
+ if (node->area > 1e-16f) {
inv= 1.0f/node->area;
node->rad[0] *= inv;
node->rad[1] *= inv;
node->rad[2] *= inv;
}
- if(node->backarea > 1e-16f) {
+ if (node->backarea > 1e-16f) {
inv= 1.0f/node->backarea;
node->backrad[0] *= inv;
node->backrad[1] *= inv;
node->backrad[2] *= inv;
}
- if(totrad > 1e-16f) {
+ if (totrad > 1e-16f) {
inv= 1.0f/totrad;
node->co[0] *= inv;
node->co[1] *= inv;
@@ -533,7 +531,7 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
else {
/* make sure that if radiance is 0.0f, we still have these points in
* the tree at a good position, they count for rdsum too */
- for(i=0; i<node->totpoint; i++) {
+ for (i=0; i<node->totpoint; i++) {
p= &node->points[i];
node->co[0] += p->co[0];
@@ -559,8 +557,8 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
/* compute total rad, rad weighted average position,
* and total area */
- for(i=0; i<8; i++) {
- if(node->child[i] == NULL)
+ for (i=0; i<8; i++) {
+ if (node->child[i] == NULL)
continue;
subnode= node->child[i];
@@ -585,20 +583,20 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
node->backarea += subnode->backarea;
}
- if(node->area > 1e-16f) {
+ if (node->area > 1e-16f) {
inv= 1.0f/node->area;
node->rad[0] *= inv;
node->rad[1] *= inv;
node->rad[2] *= inv;
}
- if(node->backarea > 1e-16f) {
+ if (node->backarea > 1e-16f) {
inv= 1.0f/node->backarea;
node->backrad[0] *= inv;
node->backrad[1] *= inv;
node->backrad[2] *= inv;
}
- if(totrad > 1e-16f) {
+ if (totrad > 1e-16f) {
inv= 1.0f/totrad;
node->co[0] *= inv;
node->co[1] *= inv;
@@ -609,8 +607,8 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
* the tree at a good position, they count for rdsum too */
totnode= 0;
- for(i=0; i<8; i++) {
- if(node->child[i]) {
+ for (i=0; i<8; i++) {
+ if (node->child[i]) {
subnode= node->child[i];
node->co[0] += subnode->co[0];
@@ -629,14 +627,14 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
static void sum_radiance(ScatterTree *tree, ScatterNode *node)
{
- if(node->totpoint > 0) {
+ if (node->totpoint > 0) {
sum_leaf_radiance(tree, node);
}
else {
int i;
- for(i=0; i<8; i++)
- if(node->child[i])
+ for (i=0; i<8; i++)
+ if (node->child[i])
sum_radiance(tree, node->child[i]);
sum_branch_radiance(tree, node);
@@ -660,8 +658,8 @@ static void create_octree_node(ScatterTree *tree, ScatterNode *node, float *mid,
float submid[3], subsize[3];
/* stopping condition */
- if(node->totpoint <= MAX_OCTREE_NODE_POINTS || depth == MAX_OCTREE_DEPTH) {
- for(i=0; i<node->totpoint; i++)
+ if (node->totpoint <= MAX_OCTREE_NODE_POINTS || depth == MAX_OCTREE_DEPTH) {
+ for (i=0; i<node->totpoint; i++)
node->points[i]= *(refpoints[i]);
return;
@@ -679,7 +677,7 @@ static void create_octree_node(ScatterTree *tree, ScatterNode *node, float *mid,
memset(noffset, 0, sizeof(noffset));
/* count points in subnodes */
- for(i=0; i<node->totpoint; i++) {
+ for (i=0; i<node->totpoint; i++) {
index= SUBNODE_INDEX(refpoints[i]->co, node->split);
tmppoints[i]= refpoints[i];
nsize[index]++;
@@ -688,31 +686,31 @@ static void create_octree_node(ScatterTree *tree, ScatterNode *node, float *mid,
/* here we check if only one subnode is used. if this is the case, we don't
* create a new node, but rather call this function again, with different
* size and middle position for the same node. */
- for(usedi=0, usednodes=0, i=0; i<8; i++) {
- if(nsize[i]) {
+ for (usedi=0, usednodes=0, i=0; i<8; i++) {
+ if (nsize[i]) {
usednodes++;
usedi = i;
}
- if(i != 0)
+ if (i != 0)
noffset[i]= noffset[i-1]+nsize[i-1];
}
- if(usednodes<=1) {
+ if (usednodes<=1) {
subnode_middle(usedi, mid, subsize, submid);
create_octree_node(tree, node, submid, subsize, refpoints, depth+1);
return;
}
/* reorder refpoints by subnode */
- for(i=0; i<node->totpoint; i++) {
+ for (i=0; i<node->totpoint; i++) {
index= SUBNODE_INDEX(tmppoints[i]->co, node->split);
refpoints[noffset[index]]= tmppoints[i];
noffset[index]++;
}
/* create subnodes */
- for(subco=0, i=0; i<8; subco+=nsize[i], i++) {
- if(nsize[i] > 0) {
+ for (subco=0, i=0; i<8; subco+=nsize[i], i++) {
+ if (nsize[i] > 0) {
subnode= BLI_memarena_alloc(tree->arena, sizeof(ScatterNode));
node->child[i]= subnode;
subnode->points= node->points + subco;
@@ -760,7 +758,7 @@ ScatterTree *scatter_tree_new(ScatterSettings *ss[3], float scale, float error,
/* build points */
INIT_MINMAX(tree->min, tree->max);
- for(i=0; i<totpoint; i++) {
+ for (i=0; i<totpoint; i++) {
copy_v3_v3(points[i].co, co[i]);
copy_v3_v3(points[i].rad, color[i]);
points[i].area= fabsf(area[i])/(tree->scale*tree->scale);
@@ -859,7 +857,7 @@ static void sss_create_tree_mat(Render *re, Material *mat)
float (*co)[3] = NULL, (*color)[3] = NULL, *area = NULL;
int totpoint = 0, osa, osaflag, partsdone;
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
return;
points.first= points.last= NULL;
@@ -880,14 +878,14 @@ static void sss_create_tree_mat(Render *re, Material *mat)
re->sss_mat= mat;
re->i.partsdone= 0;
- if(!(re->r.scemode & R_PREVIEWBUTS))
+ if (!(re->r.scemode & R_PREVIEWBUTS))
re->result= NULL;
BLI_rw_mutex_unlock(&re->resultmutex);
RE_TileProcessor(re);
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
- if(!(re->r.scemode & R_PREVIEWBUTS)) {
+ if (!(re->r.scemode & R_PREVIEWBUTS)) {
RE_FreeRenderResult(re->result);
re->result= rr;
}
@@ -900,19 +898,19 @@ static void sss_create_tree_mat(Render *re, Material *mat)
if (osaflag) re->r.mode |= R_OSA;
/* no points? no tree */
- if(!points.first)
+ if (!points.first)
return;
/* merge points together into a single buffer */
- if(!re->test_break(re->tbh)) {
- for(totpoint=0, p=points.first; p; p=p->next)
+ if (!re->test_break(re->tbh)) {
+ for (totpoint=0, p=points.first; p; p=p->next)
totpoint += p->totpoint;
co= MEM_mallocN(sizeof(*co)*totpoint, "SSSCo");
color= MEM_mallocN(sizeof(*color)*totpoint, "SSSColor");
area= MEM_mallocN(sizeof(*area)*totpoint, "SSSArea");
- for(totpoint=0, p=points.first; p; p=p->next) {
+ for (totpoint=0, p=points.first; p; p=p->next) {
memcpy(co+totpoint, p->co, sizeof(*co)*p->totpoint);
memcpy(color+totpoint, p->color, sizeof(*color)*p->totpoint);
memcpy(area+totpoint, p->area, sizeof(*area)*p->totpoint);
@@ -921,7 +919,7 @@ static void sss_create_tree_mat(Render *re, Material *mat)
}
/* free points */
- for(p=points.first; p; p=p->next) {
+ for (p=points.first; p; p=p->next) {
MEM_freeN(p->co);
MEM_freeN(p->color);
MEM_freeN(p->area);
@@ -929,7 +927,7 @@ static void sss_create_tree_mat(Render *re, Material *mat)
BLI_freelistN(&points);
/* build tree */
- if(!re->test_break(re->tbh)) {
+ if (!re->test_break(re->tbh)) {
SSSData *sss= MEM_callocN(sizeof(*sss), "SSSData");
float ior= mat->sss_ior, cfac= mat->sss_colfac;
float *radius= mat->sss_radius;
@@ -937,7 +935,7 @@ static void sss_create_tree_mat(Render *re, Material *mat)
float error = mat->sss_error;
error= get_render_aosss_error(&re->r, error);
- if((re->r.scemode & R_PREVIEWBUTS) && error < 0.5f)
+ if ((re->r.scemode & R_PREVIEWBUTS) && error < 0.5f)
error= 0.5f;
sss->ss[0]= scatter_settings_new(mat->sss_col[0], radius[0], ior, cfac, fw, bw);
@@ -965,7 +963,7 @@ void sss_add_points(Render *re, float (*co)[3], float (*color)[3], float *area,
{
SSSPoints *p;
- if(totpoint > 0) {
+ if (totpoint > 0) {
p= MEM_callocN(sizeof(SSSPoints), "SSSPoints");
p->co= co;
@@ -999,15 +997,15 @@ void make_sss_tree(Render *re)
re->i.infostr= "SSS preprocessing";
re->stats_draw(re->sdh, &re->i);
- for(mat= re->main->mat.first; mat; mat= mat->id.next)
- if(mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS))
+ for (mat= re->main->mat.first; mat; mat= mat->id.next)
+ if (mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS))
sss_create_tree_mat(re, mat);
/* XXX preview exception */
/* localizing preview render data is not fun for node trees :( */
- if(re->main!=G.main) {
- for(mat= G.main->mat.first; mat; mat= mat->id.next)
- if(mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS))
+ if (re->main!=G.main) {
+ for (mat= G.main->mat.first; mat; mat= mat->id.next)
+ if (mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS))
sss_create_tree_mat(re, mat);
}
@@ -1015,10 +1013,10 @@ void make_sss_tree(Render *re)
void free_sss(Render *re)
{
- if(re->sss_hash) {
+ if (re->sss_hash) {
GHashIterator *it= BLI_ghashIterator_new(re->sss_hash);
- while(!BLI_ghashIterator_isDone(it)) {
+ while (!BLI_ghashIterator_isDone(it)) {
sss_free_tree(BLI_ghashIterator_getValue(it));
BLI_ghashIterator_step(it);
}
@@ -1031,10 +1029,10 @@ void free_sss(Render *re)
int sample_sss(Render *re, Material *mat, float *co, float *color)
{
- if(re->sss_hash) {
+ if (re->sss_hash) {
SSSData *sss= BLI_ghash_lookup(re->sss_hash, mat);
- if(sss) {
+ if (sss) {
scatter_tree_sample(sss->tree, co, color);
return 1;
}
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index 5f034ee9aeb..e29623aee22 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -74,8 +74,8 @@ static float strand_eval_width(Material *ma, float strandco)
strandco= 0.5f*(strandco + 1.0f);
- if(ma->strand_ease!=0.0f) {
- if(ma->strand_ease<0.0f)
+ if (ma->strand_ease!=0.0f) {
+ if (ma->strand_ease<0.0f)
fac= pow(strandco, 1.0f+ma->strand_ease);
else
fac= pow(strandco, 1.0f/(1.0f-ma->strand_ease));
@@ -103,27 +103,27 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint)
copy_v3_v3(p[2], sseg->v[2]->co);
copy_v3_v3(p[3], sseg->v[3]->co);
- if(sseg->obi->flag & R_TRANSFORMED) {
+ if (sseg->obi->flag & R_TRANSFORMED) {
mul_m4_v3(sseg->obi->mat, p[0]);
mul_m4_v3(sseg->obi->mat, p[1]);
mul_m4_v3(sseg->obi->mat, p[2]);
mul_m4_v3(sseg->obi->mat, p[3]);
}
- if(t == 0.0f) {
+ if (t == 0.0f) {
copy_v3_v3(spoint->co, p[1]);
spoint->strandco= sseg->v[1]->strandco;
spoint->dtstrandco= (sseg->v[2]->strandco - sseg->v[0]->strandco);
- if(sseg->v[0] != sseg->v[1])
+ if (sseg->v[0] != sseg->v[1])
spoint->dtstrandco *= 0.5f;
}
- else if(t == 1.0f) {
+ else if (t == 1.0f) {
copy_v3_v3(spoint->co, p[2]);
spoint->strandco= sseg->v[2]->strandco;
spoint->dtstrandco= (sseg->v[3]->strandco - sseg->v[1]->strandco);
- if(sseg->v[3] != sseg->v[2])
+ if (sseg->v[3] != sseg->v[2])
spoint->dtstrandco *= 0.5f;
}
else {
@@ -157,17 +157,17 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint)
dy= strandbuf->winy*cross[1]*strandbuf->winmat[1][1]/w;
w= sqrt(dx*dx + dy*dy);
- if(w > 0.0f) {
- if(strandbuf->flag & R_STRAND_B_UNITS) {
+ if (w > 0.0f) {
+ if (strandbuf->flag & R_STRAND_B_UNITS) {
const float crosslen= len_v3(cross);
w= 2.0f*crosslen*strandbuf->minwidth/w;
- if(spoint->width < w) {
+ if (spoint->width < w) {
spoint->alpha= spoint->width/w;
spoint->width= w;
}
- if(simplify)
+ if (simplify)
/* squared because we only change width, not length */
spoint->width *= simplify[0]*simplify[0];
@@ -211,45 +211,45 @@ static void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float
interpolate_vec4(shr1->combined, shr2->combined, t, negt, shr->combined);
- if(addpassflag & SCE_PASS_VECTOR) {
+ if (addpassflag & SCE_PASS_VECTOR) {
interpolate_vec4(shr1->winspeed, shr2->winspeed, t, negt, shr->winspeed);
}
/* optim... */
- if(addpassflag & ~(SCE_PASS_VECTOR)) {
- if(addpassflag & SCE_PASS_Z)
+ if (addpassflag & ~(SCE_PASS_VECTOR)) {
+ if (addpassflag & SCE_PASS_Z)
interpolate_vec1(&shr1->z, &shr2->z, t, negt, &shr->z);
- if(addpassflag & SCE_PASS_RGBA)
+ if (addpassflag & SCE_PASS_RGBA)
interpolate_vec4(shr1->col, shr2->col, t, negt, shr->col);
- if(addpassflag & SCE_PASS_NORMAL) {
+ if (addpassflag & SCE_PASS_NORMAL) {
interpolate_vec3(shr1->nor, shr2->nor, t, negt, shr->nor);
normalize_v3(shr->nor);
}
- if(addpassflag & SCE_PASS_EMIT)
+ if (addpassflag & SCE_PASS_EMIT)
interpolate_vec3(shr1->emit, shr2->emit, t, negt, shr->emit);
- if(addpassflag & SCE_PASS_DIFFUSE)
+ if (addpassflag & SCE_PASS_DIFFUSE)
interpolate_vec3(shr1->diff, shr2->diff, t, negt, shr->diff);
- if(addpassflag & SCE_PASS_SPEC)
+ if (addpassflag & SCE_PASS_SPEC)
interpolate_vec3(shr1->spec, shr2->spec, t, negt, shr->spec);
- if(addpassflag & SCE_PASS_SHADOW)
+ if (addpassflag & SCE_PASS_SHADOW)
interpolate_vec3(shr1->shad, shr2->shad, t, negt, shr->shad);
- if(addpassflag & SCE_PASS_AO)
+ if (addpassflag & SCE_PASS_AO)
interpolate_vec3(shr1->ao, shr2->ao, t, negt, shr->ao);
- if(addpassflag & SCE_PASS_ENVIRONMENT)
+ if (addpassflag & SCE_PASS_ENVIRONMENT)
interpolate_vec3(shr1->env, shr2->env, t, negt, shr->env);
- if(addpassflag & SCE_PASS_INDIRECT)
+ if (addpassflag & SCE_PASS_INDIRECT)
interpolate_vec3(shr1->indirect, shr2->indirect, t, negt, shr->indirect);
- if(addpassflag & SCE_PASS_REFLECT)
+ if (addpassflag & SCE_PASS_REFLECT)
interpolate_vec3(shr1->refl, shr2->refl, t, negt, shr->refl);
- if(addpassflag & SCE_PASS_REFRACT)
+ if (addpassflag & SCE_PASS_REFRACT)
interpolate_vec3(shr1->refr, shr2->refr, t, negt, shr->refr);
- if(addpassflag & SCE_PASS_MIST)
+ if (addpassflag & SCE_PASS_MIST)
interpolate_vec1(&shr1->mist, &shr2->mist, t, negt, &shr->mist);
}
}
static void strand_apply_shaderesult_alpha(ShadeResult *shr, float alpha)
{
- if(alpha < 1.0f) {
+ if (alpha < 1.0f) {
shr->combined[0] *= alpha;
shr->combined[1] *= alpha;
shr->combined[2] *= alpha;
@@ -273,7 +273,7 @@ static void strand_shade_point(Render *re, ShadeSample *ssamp, StrandSegment *ss
memset(&vlr, 0, sizeof(vlr));
vlr.flag= R_SMOOTH;
- if(sseg->buffer->ma->mode & MA_TANGENT_STR)
+ if (sseg->buffer->ma->mode & MA_TANGENT_STR)
vlr.flag |= R_TANGENT;
shi->vlr= &vlr;
@@ -308,8 +308,8 @@ static void strand_shade_point(Render *re, ShadeSample *ssamp, StrandSegment *ss
strand_apply_shaderesult_alpha(shr, spoint->alpha);
/* include lamphalos for strand, since halo layer was added already */
- if(re->flag & R_LAMPHALO)
- if(shi->layflag & SCE_LAY_HALO)
+ if (re->flag & R_LAMPHALO)
+ if (shi->layflag & SCE_LAY_HALO)
renderspothalo(shi, shr->combined, shr->combined[3]);
shi->strand= NULL;
@@ -352,7 +352,7 @@ static void strand_shade_get(Render *re, StrandShadeCache *cache, ShadeSample *s
hashshr= BLI_ghash_lookup(cache->resulthash, svert);
refcount= BLI_ghash_lookup(cache->refcounthash, svert);
- if(!hashshr) {
+ if (!hashshr) {
/* not shaded yet, shade and insert into hash */
p.t= (sseg->v[1] == svert)? 0.0f: 1.0f;
strand_eval_point(sseg, &p);
@@ -368,7 +368,7 @@ static void strand_shade_get(Render *re, StrandShadeCache *cache, ShadeSample *s
/* lower reference count and remove if not needed anymore by any samples */
(*refcount)--;
- if(*refcount == 0) {
+ if (*refcount == 0) {
BLI_ghash_remove(cache->resulthash, svert, NULL, (GHashValFreeFP)MEM_freeN);
BLI_ghash_remove(cache->refcounthash, svert, NULL, NULL);
}
@@ -387,7 +387,7 @@ void strand_shade_segment(Render *re, StrandShadeCache *cache, StrandSegment *ss
interpolate_shade_result(&shr1, &shr2, t, ssamp->shr, addpassflag);
/* apply alpha along width */
- if(sseg->buffer->widthfade != 0.0f) {
+ if (sseg->buffer->widthfade != 0.0f) {
s = 1.0f - pow(fabs(s), sseg->buffer->widthfade);
strand_apply_shaderesult_alpha(ssamp->shr, s);
@@ -402,7 +402,7 @@ void strand_shade_unref(StrandShadeCache *cache, StrandVert *svert)
refcount= BLI_ghash_lookup(cache->refcounthash, svert);
(*refcount)--;
- if(*refcount == 0) {
+ if (*refcount == 0) {
BLI_ghash_remove(cache->resulthash, svert, NULL, (GHashValFreeFP)MEM_freeN);
BLI_ghash_remove(cache->refcounthash, svert, NULL, NULL);
}
@@ -412,7 +412,7 @@ static void strand_shade_refcount(StrandShadeCache *cache, StrandVert *svert)
{
int *refcount= BLI_ghash_lookup(cache->refcounthash, svert);
- if(!refcount) {
+ if (!refcount) {
refcount= BLI_memarena_alloc(cache->memarena, sizeof(int));
*refcount= 1;
BLI_ghash_insert(cache->refcounthash, svert, refcount);
@@ -454,9 +454,9 @@ static int compare_strand_segment(const void *poin1, const void *poin2)
const StrandSortSegment *seg1= (const StrandSortSegment*)poin1;
const StrandSortSegment *seg2= (const StrandSortSegment*)poin2;
- if(seg1->z < seg2->z)
+ if (seg1->z < seg2->z)
return -1;
- else if(seg1->z == seg2->z)
+ else if (seg1->z == seg2->z)
return 0;
else
return 1;
@@ -493,7 +493,7 @@ static APixstrand *addpsmainAstrand(ListBase *lb)
static APixstrand *addpsAstrand(ZSpan *zspan)
{
/* make new PS */
- if(zspan->apstrandmcounter==0) {
+ if (zspan->apstrandmcounter==0) {
zspan->curpstrand= addpsmainAstrand(zspan->apsmbase);
zspan->apstrandmcounter= 4095;
}
@@ -524,19 +524,19 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
/* check against solid z-buffer */
zverg= (int)z;
- if(spart->rectdaps) {
+ if (spart->rectdaps) {
/* find the z of the sample */
PixStr *ps;
intptr_t *rd= spart->rectdaps + offset;
bufferz= 0x7FFFFFFF;
- if(spart->rectmask) maskz= 0x7FFFFFFF;
+ if (spart->rectmask) maskz= 0x7FFFFFFF;
- if(*rd) {
- for(ps= (PixStr *)(*rd); ps; ps= ps->next) {
- if(mask & ps->mask) {
+ if (*rd) {
+ for (ps= (PixStr *)(*rd); ps; ps= ps->next) {
+ if (mask & ps->mask) {
bufferz= ps->z;
- if(spart->rectmask)
+ if (spart->rectmask)
maskz= ps->maskz;
break;
}
@@ -545,25 +545,25 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
}
else {
bufferz= (spart->rectz)? spart->rectz[offset]: 0x7FFFFFFF;
- if(spart->rectmask)
+ if (spart->rectmask)
maskz= spart->rectmask[offset];
}
#define CHECK_ADD(n) \
- if(apn->p[n]==strnr && apn->obi[n]==obi && apn->seg[n]==seg) \
- { if(!(apn->mask[n] & mask)) { apn->mask[n] |= mask; apn->v[n] += t; apn->u[n] += s; } break; }
+ if (apn->p[n]==strnr && apn->obi[n]==obi && apn->seg[n]==seg) \
+ { if (!(apn->mask[n] & mask)) { apn->mask[n] |= mask; apn->v[n] += t; apn->u[n] += s; } break; }
#define CHECK_ASSIGN(n) \
- if(apn->p[n]==0) \
+ if (apn->p[n]==0) \
{apn->obi[n]= obi; apn->p[n]= strnr; apn->z[n]= zverg; apn->mask[n]= mask; apn->v[n]= t; apn->u[n]= s; apn->seg[n]= seg; break; }
/* add to pixel list */
- if(zverg < bufferz && (spart->totapixbuf[offset] < MAX_ZROW)) {
- if(!spart->rectmask || zverg > maskz) {
+ if (zverg < bufferz && (spart->totapixbuf[offset] < MAX_ZROW)) {
+ if (!spart->rectmask || zverg > maskz) {
t = u*spart->t[0] + v*spart->t[1] + (1.0f-u-v)*spart->t[2];
s = fabs(u*spart->s[0] + v*spart->s[1] + (1.0f-u-v)*spart->s[2]);
apn= spart->apixbuf + offset;
- while(apn) {
+ while (apn) {
CHECK_ADD(0);
CHECK_ADD(1);
CHECK_ADD(2);
@@ -579,7 +579,7 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
CHECK_ASSIGN(0);
}
- if(cache) {
+ if (cache) {
strand_shade_refcount(cache, sseg->v[1]);
strand_shade_refcount(cache, sseg->v[2]);
}
@@ -599,11 +599,11 @@ static int strand_test_clip(float winmat[][4], ZSpan *UNUSED(zspan), float *boun
/* we compare z without perspective division for segment sorting */
*zcomp= hoco[2];
- if(hoco[0]+widthx < bounds[0]*hoco[3]) clipflag |= 1;
- else if(hoco[0]-widthx > bounds[1]*hoco[3]) clipflag |= 2;
+ if (hoco[0]+widthx < bounds[0]*hoco[3]) clipflag |= 1;
+ else if (hoco[0]-widthx > bounds[1]*hoco[3]) clipflag |= 2;
- if(hoco[1]-widthy > bounds[3]*hoco[3]) clipflag |= 4;
- else if(hoco[1]+widthy < bounds[2]*hoco[3]) clipflag |= 8;
+ if (hoco[1]-widthy > bounds[3]*hoco[3]) clipflag |= 4;
+ else if (hoco[1]+widthy < bounds[2]*hoco[3]) clipflag |= 8;
clipflag |= testclip(hoco);
@@ -619,7 +619,7 @@ static void do_scanconvert_strand(Render *UNUSED(re), StrandPart *spart, ZSpan *
copy_v3_v3(jco3, co3);
copy_v3_v3(jco4, co4);
- if(spart->jit) {
+ if (spart->jit) {
jx= -spart->jit[sample][0];
jy= -spart->jit[sample][1];
@@ -651,13 +651,13 @@ static void do_scanconvert_strand(Render *UNUSED(re), StrandPart *spart, ZSpan *
static void strand_render(Render *re, StrandSegment *sseg, float winmat[][4], StrandPart *spart, ZSpan *zspan, int totzspan, StrandPoint *p1, StrandPoint *p2)
{
- if(spart) {
+ if (spart) {
float t= p2->t;
float dt= p2->t - p1->t;
int a;
- if(re->osa) {
- for(a=0; a<re->osa; a++)
+ if (re->osa) {
+ for (a=0; a<re->osa; a++)
do_scanconvert_strand(re, spart, zspan, t, dt, p1->zco2, p1->zco1, p2->zco1, p2->zco2, a);
}
else
@@ -674,13 +674,13 @@ static void strand_render(Render *re, StrandSegment *sseg, float winmat[][4], St
projectvert(p2->co, winmat, hoco2);
- for(a=0; a<totzspan; a++) {
+ for (a=0; a<totzspan; a++) {
#if 0
/* render both strand and single pixel wire to counter aliasing */
zbufclip4(re, &zspan[a], obi, index, p1->hoco2, p1->hoco1, p2->hoco1, p2->hoco2, p1->clip2, p1->clip1, p2->clip1, p2->clip2);
#endif
/* only render a line for now, which makes the shadow map more
- * similiar across frames, and so reduces flicker */
+ * similar across frames, and so reduces flicker */
zbufsinglewire(&zspan[a], obi, index, hoco1, hoco2);
}
}
@@ -692,7 +692,7 @@ static int strand_segment_recursive(Render *re, float winmat[][4], StrandPart *s
StrandBuffer *buffer= sseg->buffer;
float dot, d1[2], d2[2], len1, len2;
- if(depth == buffer->maxdepth)
+ if (depth == buffer->maxdepth)
return 0;
p.t= (p1->t + p2->t)*0.5f;
@@ -707,14 +707,14 @@ static int strand_segment_recursive(Render *re, float winmat[][4], StrandPart *s
d2[1]= (p2->y - p.y);
len2= d2[0]*d2[0] + d2[1]*d2[1];
- if(len1 == 0.0f || len2 == 0.0f)
+ if (len1 == 0.0f || len2 == 0.0f)
return 0;
dot= d1[0]*d2[0] + d1[1]*d2[1];
- if(dot*dot > sseg->sqadaptcos*len1*len2)
+ if (dot*dot > sseg->sqadaptcos*len1*len2)
return 0;
- if(spart) {
+ if (spart) {
do_strand_point_project(winmat, zspan, p.co1, p.hoco1, p.zco1);
do_strand_point_project(winmat, zspan, p.co2, p.hoco2, p.zco2);
}
@@ -727,9 +727,9 @@ static int strand_segment_recursive(Render *re, float winmat[][4], StrandPart *s
#endif
}
- if(!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, p1, &p, depth+1))
+ if (!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, p1, &p, depth+1))
strand_render(re, sseg, winmat, spart, zspan, totzspan, p1, &p);
- if(!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, &p, p2, depth+1))
+ if (!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, &p, p2, depth+1))
strand_render(re, sseg, winmat, spart, zspan, totzspan, &p, p2);
return 1;
@@ -749,7 +749,7 @@ void render_strand_segment(Render *re, float winmat[][4], StrandPart *spart, ZSp
strand_eval_point(sseg, p2);
strand_project_point(buffer->winmat, buffer->winx, buffer->winy, p2);
- if(spart) {
+ if (spart) {
do_strand_point_project(winmat, zspan, p1->co1, p1->hoco1, p1->zco1);
do_strand_point_project(winmat, zspan, p1->co2, p1->hoco2, p1->zco2);
do_strand_point_project(winmat, zspan, p2->co1, p2->hoco1, p2->zco1);
@@ -768,7 +768,7 @@ void render_strand_segment(Render *re, float winmat[][4], StrandPart *spart, ZSp
#endif
}
- if(!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, p1, p2, 0))
+ if (!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, p1, p2, 0))
strand_render(re, sseg, winmat, spart, zspan, totzspan, p1, p2);
}
@@ -788,9 +788,9 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
float z[4], bounds[4], obwinmat[4][4];
int a, b, c, i, totsegment, clip[4];
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
return 0;
- if(re->totstrand == 0)
+ if (re->totstrand == 0)
return 0;
/* setup StrandPart */
@@ -818,7 +818,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
zspan.zofsy= -pa->disprect.ymin;
/* to center the sample position */
- if(!shadow) {
+ if (!shadow) {
zspan.zofsx -= 0.5f;
zspan.zofsy -= 0.5f;
}
@@ -836,17 +836,17 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
totsegment= 0;
/* for all object instances */
- for(obi=re->instancetable.first, i=0; obi; obi=obi->next, i++) {
+ for (obi=re->instancetable.first, i=0; obi; obi=obi->next, i++) {
Material *ma;
float widthx, widthy;
obr= obi->obr;
- if(!obr->strandbuf || !(obr->strandbuf->lay & lay))
+ if (!obr->strandbuf || !(obr->strandbuf->lay & lay))
continue;
/* compute matrix and try clipping whole object */
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mult_m4_m4m4(obwinmat, winmat, obi->mat);
else
copy_m4_m4(obwinmat, winmat);
@@ -854,12 +854,12 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
/* test if we should skip it */
ma = obr->strandbuf->ma;
- if(shadow && !(ma->mode & MA_SHADBUF))
+ if (shadow && !(ma->mode & MA_SHADBUF))
continue;
- else if(!shadow && (ma->mode & MA_ONLYCAST))
+ else if (!shadow && (ma->mode & MA_ONLYCAST))
continue;
- if(clip_render_object(obi->obr->boundbox, bounds, obwinmat))
+ if (clip_render_object(obi->obr->boundbox, bounds, obwinmat))
continue;
widthx= obr->strandbuf->maxwidth*obwinmat[0][0];
@@ -867,12 +867,12 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
/* for each bounding box containing a number of strands */
sbound= obr->strandbuf->bound;
- for(c=0; c<obr->strandbuf->totbound; c++, sbound++) {
- if(clip_render_object(sbound->boundbox, bounds, obwinmat))
+ for (c=0; c<obr->strandbuf->totbound; c++, sbound++) {
+ if (clip_render_object(sbound->boundbox, bounds, obwinmat))
continue;
/* for each strand in this bounding box */
- for(a=sbound->start; a<sbound->end; a++) {
+ for (a=sbound->start; a<sbound->end; a++) {
strand= RE_findOrAddStrand(obr, a);
svert= strand->vert;
@@ -881,9 +881,9 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
clip[2]= strand_test_clip(obwinmat, &zspan, bounds, (svert+1)->co, &z[2], widthx, widthy);
clip[0]= clip[1]; z[0]= z[1];
- for(b=0; b<strand->totvert-1; b++, svert++) {
+ for (b=0; b<strand->totvert-1; b++, svert++) {
/* compute 4th point clipping and z depth */
- if(b < strand->totvert-2) {
+ if (b < strand->totvert-2) {
clip[3]= strand_test_clip(obwinmat, &zspan, bounds, (svert+2)->co, &z[3], widthx, widthy);
}
else {
@@ -891,7 +891,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
}
/* check clipping and add to sortsegments buffer */
- if(!(clip[0] & clip[1] & clip[2] & clip[3])) {
+ if (!(clip[0] & clip[1] & clip[2] & clip[3])) {
sortseg= BLI_memarena_alloc(memarena, sizeof(StrandSortSegment));
sortseg->obi= i;
sortseg->strand= strand->index;
@@ -913,10 +913,10 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
}
}
- if(!re->test_break(re->tbh)) {
+ if (!re->test_break(re->tbh)) {
/* convert list to array and sort */
sortsegments= MEM_mallocN(sizeof(StrandSortSegment)*totsegment, "StrandSortSegment");
- for(a=0, sortseg=firstseg; a<totsegment; a++, sortseg=sortseg->next)
+ for (a=0, sortseg=firstseg; a<totsegment; a++, sortseg=sortseg->next)
sortsegments[a]= *sortseg;
qsort(sortsegments, totsegment, sizeof(StrandSortSegment), compare_strand_segment);
}
@@ -925,11 +925,11 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
spart.totapixbuf= MEM_callocN(sizeof(int)*pa->rectx*pa->recty, "totapixbuf");
- if(!re->test_break(re->tbh)) {
+ if (!re->test_break(re->tbh)) {
/* render segments in sorted order */
sortseg= sortsegments;
- for(a=0; a<totsegment; a++, sortseg++) {
- if(re->test_break(re->tbh))
+ for (a=0; a<totsegment; a++, sortseg++) {
+ if (re->test_break(re->tbh))
break;
obi= &re->objectinstance[sortseg->obi];
@@ -954,7 +954,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
}
}
- if(sortsegments)
+ if (sortsegments)
MEM_freeN(sortsegments);
MEM_freeN(spart.totapixbuf);
@@ -976,12 +976,12 @@ StrandSurface *cache_strand_surface(Render *re, ObjectRen *obr, DerivedMesh *dm,
totvert= dm->getNumVerts(dm);
totface= dm->getNumTessFaces(dm);
- for(mesh=re->strandsurface.first; mesh; mesh=mesh->next)
- if(mesh->obr.ob == obr->ob && mesh->obr.par == obr->par
+ for (mesh=re->strandsurface.first; mesh; mesh=mesh->next)
+ if (mesh->obr.ob == obr->ob && mesh->obr.par == obr->par
&& mesh->obr.index == obr->index && mesh->totvert==totvert && mesh->totface==totface)
break;
- if(!mesh) {
+ if (!mesh) {
mesh= MEM_callocN(sizeof(StrandSurface), "StrandSurface");
mesh->obr= *obr;
mesh->totvert= totvert;
@@ -993,23 +993,23 @@ StrandSurface *cache_strand_surface(Render *re, ObjectRen *obr, DerivedMesh *dm,
BLI_addtail(&re->strandsurface, mesh);
}
- if(timeoffset == -1 && !mesh->prevco)
+ if (timeoffset == -1 && !mesh->prevco)
mesh->prevco= co= MEM_callocN(sizeof(float)*3*mesh->totvert, "StrandSurfCo");
- else if(timeoffset == 0 && !mesh->co)
+ else if (timeoffset == 0 && !mesh->co)
mesh->co= co= MEM_callocN(sizeof(float)*3*mesh->totvert, "StrandSurfCo");
- else if(timeoffset == 1 && !mesh->nextco)
+ else if (timeoffset == 1 && !mesh->nextco)
mesh->nextco= co= MEM_callocN(sizeof(float)*3*mesh->totvert, "StrandSurfCo");
else
return mesh;
mvert= dm->getVertArray(dm);
- for(a=0; a<mesh->totvert; a++, mvert++) {
+ for (a=0; a<mesh->totvert; a++, mvert++) {
copy_v3_v3(co[a], mvert->co);
mul_m4_v3(mat, co[a]);
}
mface= dm->getTessFaceArray(dm);
- for(a=0; a<mesh->totface; a++, mface++) {
+ for (a=0; a<mesh->totface; a++, mface++) {
mesh->face[a][0]= mface->v1;
mesh->face[a][1]= mface->v2;
mesh->face[a][2]= mface->v3;
@@ -1023,14 +1023,14 @@ void free_strand_surface(Render *re)
{
StrandSurface *mesh;
- for(mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
- if(mesh->co) MEM_freeN(mesh->co);
- if(mesh->prevco) MEM_freeN(mesh->prevco);
- if(mesh->nextco) MEM_freeN(mesh->nextco);
- if(mesh->ao) MEM_freeN(mesh->ao);
- if(mesh->env) MEM_freeN(mesh->env);
- if(mesh->indirect) MEM_freeN(mesh->indirect);
- if(mesh->face) MEM_freeN(mesh->face);
+ for (mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
+ if (mesh->co) MEM_freeN(mesh->co);
+ if (mesh->prevco) MEM_freeN(mesh->prevco);
+ if (mesh->nextco) MEM_freeN(mesh->nextco);
+ if (mesh->ao) MEM_freeN(mesh->ao);
+ if (mesh->env) MEM_freeN(mesh->env);
+ if (mesh->indirect) MEM_freeN(mesh->indirect);
+ if (mesh->face) MEM_freeN(mesh->face);
}
BLI_freelistN(&re->strandsurface);
@@ -1042,11 +1042,11 @@ void strand_minmax(StrandRen *strand, float *min, float *max, float width)
float vec[3], width2= 2.0f*width;
int a;
- for(a=0, svert=strand->vert; a<strand->totvert; a++, svert++) {
+ for (a=0, svert=strand->vert; a<strand->totvert; a++, svert++) {
copy_v3_v3(vec, svert->co);
DO_MINMAX(vec, min, max);
- if(width!=0.0f) {
+ if (width!=0.0f) {
vec[0]+= width; vec[1]+= width; vec[2]+= width;
DO_MINMAX(vec, min, max);
vec[0]-= width2; vec[1]-= width2; vec[2]-= width2;
diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c
index 1ecf197f694..1fa18c4ebb4 100644
--- a/source/blender/render/intern/source/sunsky.c
+++ b/source/blender/render/intern/source/sunsky.c
@@ -273,7 +273,7 @@ void GetSkyXYZRadiance(struct SunSky* sunsky, float theta, float phi, float colo
y = PerezFunction(sunsky, sunsky->perez_y, theta, gamma, sunsky->zenith_y);
Y = 6.666666667e-5f * nfade * hfade * PerezFunction(sunsky, sunsky->perez_Y, theta, gamma, sunsky->zenith_Y);
- if(sunsky->sky_exposure!=0.0f)
+ if (sunsky->sky_exposure!=0.0f)
Y = 1.0 - exp(Y*sunsky->sky_exposure);
X = (x / y) * Y;
@@ -335,7 +335,7 @@ 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)));
diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c
index f99eb0298bf..bd01c75ef3f 100644
--- a/source/blender/render/intern/source/volume_precache.c
+++ b/source/blender/render/intern/source/volume_precache.c
@@ -89,7 +89,8 @@ static int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset
isect->orig.ob= isect->hit.ob;
return intersect_outside_volume(tree, isect, offset, limit-1, depth+1);
- } else {
+ }
+ else {
return depth;
}
}
@@ -140,14 +141,14 @@ void global_bounds_obi(Render *re, ObjectInstanceRen *obi, float *bbmin, float *
INIT_MINMAX(bbmin, bbmax);
- for(a=0; a<obr->totvert; a++) {
- if((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
+ for (a=0; a<obr->totvert; a++) {
+ if ((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
else ver++;
copy_v3_v3(co, ver->co);
/* transformed object instance in camera space */
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mul_m4_v3(obi->mat, co);
/* convert to global space */
@@ -409,7 +410,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
sb[j] += vp->data_b[i];
/* Displays progress every second */
- if(time-lasttime>1.0) {
+ if (time-lasttime>1.0) {
char str[64];
BLI_snprintf(str, sizeof(str), "Simulating multiple scattering: %d%%", (int)(100.0f * (c / total)));
re->i.infostr= str;
@@ -446,7 +447,8 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
/* conserve energy - half single, half multiple */
origf = 0.5f;
fac *= 0.5f;
- } else {
+ }
+ else {
origf = 0.0f;
}
@@ -735,25 +737,25 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o
queue.done = BLI_thread_queue_init();
BLI_thread_queue_nowait(queue.work);
- for(pa= re->volume_precache_parts.first; pa; pa= pa->next)
+ for (pa= re->volume_precache_parts.first; pa; pa= pa->next)
BLI_thread_queue_push(queue.work, pa);
/* launch threads */
BLI_init_threads(&threads, vol_precache_part, totthread);
- for(thread= 0; thread<totthread; thread++)
+ for (thread= 0; thread<totthread; thread++)
BLI_insert_thread(&threads, &queue);
/* loop waiting for work to be done */
- while(counter < totparts) {
- if(re->test_break && re->test_break(re->tbh))
+ while (counter < totparts) {
+ if (re->test_break && re->test_break(re->tbh))
break;
- if(BLI_thread_queue_pop_timeout(queue.done, 50))
+ if (BLI_thread_queue_pop_timeout(queue.done, 50))
counter++;
time= PIL_check_seconds_timer();
- if(time-lasttime>1.0) {
+ if (time-lasttime>1.0) {
char str[64];
BLI_snprintf(str, sizeof(str), "Precaching volume: %d%%", (int)(100.0f * ((float)counter / (float)totparts)));
re->i.infostr= str;
@@ -769,7 +771,7 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o
BLI_thread_queue_free(queue.done);
BLI_freelistN(&re->volume_precache_parts);
- if(tree) {
+ if (tree) {
//TODO: makeraytree_object creates a tree and saves it on OBI, if we free this tree we should also clear other pointers to it
//RE_rayobject_free(tree);
//tree= NULL;
@@ -799,18 +801,18 @@ void volume_precache(Render *re)
re->i.infostr= "Volume preprocessing";
re->stats_draw(re->sdh, &re->i);
- for(vo= re->volumes.first; vo; vo= vo->next) {
+ for (vo= re->volumes.first; vo; vo= vo->next) {
if (using_lightcache(vo->ma)) {
- for(obi= re->instancetable.first; obi; obi= obi->next) {
+ for (obi= re->instancetable.first; obi; obi= obi->next) {
if (obi->obr == vo->obr) {
vol_precache_objectinstance_threads(re, obi, vo->ma);
- if(re->test_break && re->test_break(re->tbh))
+ if (re->test_break && re->test_break(re->tbh))
break;
}
}
- if(re->test_break && re->test_break(re->tbh))
+ if (re->test_break && re->test_break(re->tbh))
break;
}
}
@@ -823,7 +825,7 @@ void free_volume_precache(Render *re)
{
ObjectInstanceRen *obi;
- for(obi= re->instancetable.first; obi; obi= obi->next) {
+ for (obi= re->instancetable.first; obi; obi= obi->next) {
if (obi->volume_precache != NULL) {
MEM_freeN(obi->volume_precache->data_r);
MEM_freeN(obi->volume_precache->data_g);
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index 36895f8ad53..02dcc72f525 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -69,7 +69,7 @@ extern struct Render R;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* luminance rec. 709 */
-BM_INLINE float luminance(const float col[3])
+BLI_INLINE float luminance(const float col[3])
{
return (0.212671f*col[0] + 0.71516f*col[1] + 0.072169f*col[2]);
}
@@ -79,21 +79,23 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
{
float visibility = 1.f;
- if(lar->shb) {
+ if (lar->shb) {
float dxco[3]={0.f, 0.f, 0.f}, dyco[3]={0.f, 0.f, 0.f};
visibility = testshadowbuf(&R, lar->shb, co, dxco, dyco, 1.0, 0.0);
- } else if (lar->mode & LA_SHAD_RAY) {
+ }
+ else if (lar->mode & LA_SHAD_RAY) {
/* trace shadow manually, no good lamp api atm */
Isect is;
copy_v3_v3(is.start, co);
- if(lar->type==LA_SUN || lar->type==LA_HEMI) {
+ if (lar->type==LA_SUN || lar->type==LA_HEMI) {
is.dir[0] = -lar->vec[0];
is.dir[1] = -lar->vec[1];
is.dir[2] = -lar->vec[2];
is.dist = R.maxdist;
- } else {
+ }
+ else {
sub_v3_v3v3(is.dir, lar->co, is.start);
is.dist = normalize_v3( is.dir );
}
@@ -102,7 +104,7 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
is.check = RE_CHECK_VLR_NON_SOLID_MATERIAL;
is.skip = 0;
- if(lar->mode & (LA_LAYER|LA_LAYER_SHADOW))
+ if (lar->mode & (LA_LAYER|LA_LAYER_SHADOW))
is.lay= lar->lay;
else
is.lay= -1;
@@ -111,7 +113,7 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
is.orig.face = NULL;
is.last_hit = lar->last_hit[shi->thread];
- if(RE_rayobject_raycast(R.raytree,&is)) {
+ if (RE_rayobject_raycast(R.raytree,&is)) {
visibility = 0.f;
}
@@ -142,7 +144,7 @@ static int vol_get_bounds(ShadeInput *shi, const float co[3], const float vec[3]
isect->orig.ob = NULL;
}
- if(RE_rayobject_raycast(R.raytree, isect)) {
+ if (RE_rayobject_raycast(R.raytree, isect)) {
hitco[0] = isect->start[0] + isect->dist*isect->dir[0];
hitco[1] = isect->start[1] + isect->dist*isect->dir[1];
hitco[2] = isect->start[2] + isect->dist*isect->dir[2];
@@ -203,9 +205,10 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], f
isect.lay= -1;
/* check to see if there's anything behind the volume, otherwise shade the sky */
- if(RE_rayobject_raycast(R.raytree, &isect)) {
+ if (RE_rayobject_raycast(R.raytree, &isect)) {
shade_intersection(shi, col_r, &isect);
- } else {
+ }
+ else {
shadeSkyView(col_r, co, shi->view, NULL, shi->thread);
shadeSunView(col_r, shi->view);
}
@@ -377,7 +380,8 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3
if (g == 0.f) { /* isotropic */
return normalize * 1.f;
- } else { /* schlick */
+ }
+ else { /* schlick */
const float k = 1.55f * g - .55f * g * g * g;
const float kcostheta = k * dot_v3v3(w, wp);
return normalize * (1.f - k*k) / ((1.f - kcostheta) * (1.f - kcostheta));
@@ -471,7 +475,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const
float hitco[3], *atten_co;
float p, ref_col[3];
- if (lar->mode & LA_LAYER) if((lar->lay & shi->obi->lay)==0) return;
+ if (lar->mode & LA_LAYER) if ((lar->lay & shi->obi->lay)==0) return;
if ((lar->lay & shi->lay)==0) return;
if (lar->energy == 0.0f) return;
@@ -479,7 +483,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const
copy_v3_v3(lacol, &lar->r);
- if(lar->mode & LA_TEXTURE) {
+ if (lar->mode & LA_TEXTURE) {
shi->osatex= 0;
do_lamp_tex(lar, lv, shi, lacol, LA_TEXTURE);
}
@@ -517,7 +521,8 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const
atten_co = hitco;
else if ( lampdist < dist ) {
atten_co = lar->co;
- } else
+ }
+ else
atten_co = hitco;
vol_get_transmittance(shi, tr, co, atten_co);
@@ -554,7 +559,7 @@ void vol_get_scattering(ShadeInput *shi, float scatter_col[3], const float co[3]
zero_v3(scatter_col);
lights= get_lights(shi);
- for(go=lights->first; go; go= go->next)
+ for (go=lights->first; go; go= go->next)
{
float lacol[3] = {0.f, 0.f, 0.f};
lar= go->lampren;
@@ -627,7 +632,8 @@ static void volumeintegrate(struct ShadeInput *shi, float col[4], const float co
p2[2] = p[2] + (step_vec[2] * 0.5f);
vol_get_precached_scattering(&R, shi, scatter_col, p2);
- } else
+ }
+ else
vol_get_scattering(shi, scatter_col, p, shi->view);
radiance[0] += stepd * tr[0] * (emit_col[0] + scatter_col[0]);
@@ -694,7 +700,8 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
if (!ztransp)
/* trace behind the volume object */
vol_trace_behind(shi, shi->vlr, endco, col);
- } else {
+ }
+ else {
/* we're tracing through the volume between the camera
* and a solid surface, so use that pre-shaded radiance */
copy_v4_v4(col, shr->combined);
@@ -716,7 +723,8 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
if (vlr->mat == shi->mat) {
/* trace behind the 2nd (raytrace) hit point */
vol_trace_behind(shi, (VlakRen *)is.hit.face, endco, col);
- } else {
+ }
+ else {
shade_intersection(shi, col, &is);
}
}
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 88571bb297b..1f49b654ef8 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -65,7 +65,7 @@
static int is_vd_res_ok(VoxelData *vd)
{
- /* arbitrary large value so corrupt headers dont break */
+ /* arbitrary large value so corrupt headers don't break */
const int min= 1, max= 100000;
return (vd->resol[0] >= min && vd->resol[0] <= max) &&
(vd->resol[1] >= min && vd->resol[1] <= max) &&
@@ -83,15 +83,15 @@ static int load_frame_blendervoxel(VoxelData *vd, FILE *fp, int frame)
const size_t size = vd_resol_size(vd);
size_t offset = sizeof(VoxelDataHeader);
- if(is_vd_res_ok(vd) == FALSE)
+ if (is_vd_res_ok(vd) == FALSE)
return 0;
vd->dataset = MEM_mapallocN(sizeof(float)*size, "voxel dataset");
- if(vd->dataset == NULL) return 0;
+ if (vd->dataset == NULL) return 0;
- if(fseek(fp, frame*size*sizeof(float)+offset, 0) == -1)
+ if (fseek(fp, frame*size*sizeof(float)+offset, 0) == -1)
return 0;
- if(fread(vd->dataset, sizeof(float), size, fp) != size)
+ if (fread(vd->dataset, sizeof(float), size, fp) != size)
return 0;
vd->cachedframe = frame;
@@ -105,25 +105,25 @@ static int load_frame_raw8(VoxelData *vd, FILE *fp, int frame)
char *data_c;
int i;
- if(is_vd_res_ok(vd) == FALSE)
+ if (is_vd_res_ok(vd) == FALSE)
return 0;
vd->dataset = MEM_mapallocN(sizeof(float)*size, "voxel dataset");
- if(vd->dataset == NULL) return 0;
+ if (vd->dataset == NULL) return 0;
data_c = (char *)MEM_mallocN(sizeof(char)*size, "temporary voxel file reading storage");
- if(data_c == NULL) {
+ if (data_c == NULL) {
MEM_freeN(vd->dataset);
vd->dataset= NULL;
return 0;
}
- if(fseek(fp,(frame-1)*size*sizeof(char),0) == -1) {
+ if (fseek(fp,(frame-1)*size*sizeof(char),0) == -1) {
MEM_freeN(data_c);
MEM_freeN(vd->dataset);
vd->dataset= NULL;
return 0;
}
- if(fread(data_c, sizeof(char), size, fp) != size) {
+ if (fread(data_c, sizeof(char), size, fp) != size) {
MEM_freeN(data_c);
MEM_freeN(vd->dataset);
vd->dataset= NULL;
@@ -204,7 +204,7 @@ static int read_voxeldata_header(FILE *fp, struct VoxelData *vd)
VoxelDataHeader *h=(VoxelDataHeader *)MEM_mallocN(sizeof(VoxelDataHeader), "voxel data header");
rewind(fp);
- if(fread(h,sizeof(VoxelDataHeader),1,fp) != 1) {
+ if (fread(h,sizeof(VoxelDataHeader),1,fp) != 1) {
MEM_freeN(h);
return 0;
}
@@ -232,8 +232,8 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
SmokeModifierData *smd = (SmokeModifierData *)md;
- if(smd->domain && smd->domain->fluid) {
- if(cfra < smd->domain->point_cache[0]->startframe)
+ if (smd->domain && smd->domain->fluid) {
+ if (cfra < smd->domain->point_cache[0]->startframe)
; /* don't show smoke before simulation starts, this could be made an option in the future */
else if (vd->smoked_type == TEX_VD_SMOKEHEAT) {
size_t totRes;
@@ -284,7 +284,8 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
if (smd->domain->flags & MOD_SMOKE_HIGHRES) {
smoke_turbulence_get_res(smd->domain->wt, vd->resol);
density = smoke_turbulence_get_density(smd->domain->wt);
- } else {
+ }
+ else {
copy_v3_v3_int(vd->resol, smd->domain->res);
density = smoke_get_density(smd->domain->fluid);
}
@@ -342,10 +343,10 @@ void cache_voxeldata(Tex *tex, int scene_frame)
case TEX_VD_BLENDERVOXEL:
BLI_path_abs(path, G.main->name);
if (!BLI_exists(path)) return;
- fp = fopen(path,"rb");
+ fp = BLI_fopen(path,"rb");
if (!fp) return;
- if(read_voxeldata_header(fp, vd))
+ if (read_voxeldata_header(fp, vd))
load_frame_blendervoxel(vd, fp, curframe-1);
fclose(fp);
@@ -353,7 +354,7 @@ void cache_voxeldata(Tex *tex, int scene_frame)
case TEX_VD_RAW_8BIT:
BLI_path_abs(path, G.main->name);
if (!BLI_exists(path)) return;
- fp = fopen(path,"rb");
+ fp = BLI_fopen(path,"rb");
if (!fp) return;
load_frame_raw8(vd, fp, curframe);
@@ -371,7 +372,7 @@ void make_voxeldata(struct Render *re)
/* XXX: should be doing only textures used in this render */
for (tex= re->main->tex.first; tex; tex= tex->id.next) {
- if(tex->id.us && tex->type==TEX_VOXELDATA) {
+ if (tex->id.us && tex->type==TEX_VOXELDATA) {
cache_voxeldata(tex, re->r.cfra);
}
}
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index d5ed5c7a824..74c4bf19faf 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -101,9 +101,9 @@ void zbuf_alloc_span(ZSpan *zspan, int rectx, int recty, float clipcrop)
void zbuf_free_span(ZSpan *zspan)
{
- if(zspan) {
- if(zspan->span1) MEM_freeN(zspan->span1);
- if(zspan->span2) MEM_freeN(zspan->span2);
+ if (zspan) {
+ if (zspan->span1) MEM_freeN(zspan->span1);
+ if (zspan->span2) MEM_freeN(zspan->span2);
zspan->span1= zspan->span2= NULL;
}
}
@@ -122,7 +122,7 @@ static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
float xx1, dx0, xs0;
int y, my0, my2;
- if(v1[1]<v2[1]) {
+ if (v1[1]<v2[1]) {
minv= v1; maxv= v2;
}
else {
@@ -132,18 +132,18 @@ static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
my0= ceil(minv[1]);
my2= floor(maxv[1]);
- if(my2<0 || my0>= zspan->recty) return;
+ if (my2<0 || my0>= zspan->recty) return;
/* clip top */
- if(my2>=zspan->recty) my2= zspan->recty-1;
+ if (my2>=zspan->recty) my2= zspan->recty-1;
/* clip bottom */
- if(my0<0) my0= 0;
+ if (my0<0) my0= 0;
- if(my0>my2) return;
- /* if(my0>my2) should still fill in, that way we get spans that skip nicely */
+ if (my0>my2) return;
+ /* if (my0>my2) should still fill in, that way we get spans that skip nicely */
xx1= maxv[1]-minv[1];
- if(xx1>FLT_EPSILON) {
+ if (xx1>FLT_EPSILON) {
dx0= (minv[0]-maxv[0])/xx1;
xs0= dx0*(minv[1]-my2) + minv[0];
}
@@ -153,11 +153,11 @@ static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
}
/* empty span */
- if(zspan->maxp1 == NULL) {
+ if (zspan->maxp1 == NULL) {
span= zspan->span1;
}
else { /* does it complete left span? */
- if( maxv == zspan->minp1 || minv==zspan->maxp1) {
+ if ( maxv == zspan->minp1 || minv==zspan->maxp1) {
span= zspan->span1;
}
else {
@@ -165,30 +165,30 @@ static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
}
}
- if(span==zspan->span1) {
+ if (span==zspan->span1) {
// printf("left span my0 %d my2 %d\n", my0, my2);
- if(zspan->minp1==NULL || zspan->minp1[1] > minv[1] ) {
+ if (zspan->minp1==NULL || zspan->minp1[1] > minv[1] ) {
zspan->minp1= minv;
}
- if(zspan->maxp1==NULL || zspan->maxp1[1] < maxv[1] ) {
+ if (zspan->maxp1==NULL || zspan->maxp1[1] < maxv[1] ) {
zspan->maxp1= maxv;
}
- if(my0<zspan->miny1) zspan->miny1= my0;
- if(my2>zspan->maxy1) zspan->maxy1= my2;
+ if (my0<zspan->miny1) zspan->miny1= my0;
+ if (my2>zspan->maxy1) zspan->maxy1= my2;
}
else {
// printf("right span my0 %d my2 %d\n", my0, my2);
- if(zspan->minp2==NULL || zspan->minp2[1] > minv[1] ) {
+ if (zspan->minp2==NULL || zspan->minp2[1] > minv[1] ) {
zspan->minp2= minv;
}
- if(zspan->maxp2==NULL || zspan->maxp2[1] < maxv[1] ) {
+ if (zspan->maxp2==NULL || zspan->maxp2[1] < maxv[1] ) {
zspan->maxp2= maxv;
}
- if(my0<zspan->miny2) zspan->miny2= my0;
- if(my2>zspan->maxy2) zspan->maxy2= my2;
+ if (my0<zspan->miny2) zspan->miny2= my0;
+ if (my2>zspan->maxy2) zspan->maxy2= my2;
}
- for(y=my2; y>=my0; y--, xs0+= dx0) {
+ for (y=my2; y>=my0; y--, xs0+= dx0) {
/* xs0 is the xcoord! */
span[y]= xs0;
}
@@ -204,7 +204,7 @@ void fillrect(int *rect, int x, int y, int val)
len= x*y;
drect= rect;
- while(len>0) {
+ while (len>0) {
len--;
*drect= val;
drect++;
@@ -216,24 +216,24 @@ static short cliptestf(float a, float b, float c, float d, float *u1, float *u2)
{
float p= a + b, q= c + d, r;
- if(p<0.0f) {
- if(q<p) return 0;
- else if(q<0.0f) {
+ if (p<0.0f) {
+ if (q<p) return 0;
+ else if (q<0.0f) {
r= q/p;
- if(r>*u2) return 0;
- else if(r>*u1) *u1=r;
+ if (r>*u2) return 0;
+ else if (r>*u1) *u1=r;
}
}
else {
- if(p>0.0f) {
- if(q<0.0f) return 0;
- else if(q<p) {
+ if (p>0.0f) {
+ if (q<0.0f) return 0;
+ else if (q<p) {
r= q/p;
- if(r<*u1) return 0;
- else if(r<*u2) *u2=r;
+ if (r<*u1) return 0;
+ else if (r<*u2) *u2=r;
}
}
- else if(q<0.0f) return 0;
+ else if (q<0.0f) return 0;
}
return 1;
}
@@ -247,14 +247,14 @@ int testclip(const float v[4])
* prevents issues with vertices lying exact on borders */
abs4= fabsf(v[3]) + FLT_EPSILON;
- if( v[0] < -abs4) c+=1;
- else if( v[0] > abs4) c+=2;
+ if ( v[0] < -abs4) c+=1;
+ else if ( v[0] > abs4) c+=2;
- if( v[1] > abs4) c+=4;
- else if( v[1] < -abs4) c+=8;
+ if ( v[1] > abs4) c+=4;
+ else if ( v[1] < -abs4) c+=8;
- if(v[2] < -abs4) c+=16; /* this used to be " if(v[2]<0) ", see clippz() */
- else if(v[2]> abs4) c+= 32;
+ if (v[2] < -abs4) c+=16; /* this used to be " if (v[2]<0) ", see clippz() */
+ else if (v[2]> abs4) c+= 32;
return c;
}
@@ -279,9 +279,9 @@ void freepsA(ListBase *lb)
{
APixstrMain *psm, *psmnext;
- for(psm= lb->first; psm; psm= psmnext) {
+ for (psm= lb->first; psm; psm= psmnext) {
psmnext= psm->next;
- if(psm->ps)
+ if (psm->ps)
MEM_freeN(psm->ps);
MEM_freeN(psm);
}
@@ -290,7 +290,7 @@ void freepsA(ListBase *lb)
static APixstr *addpsA(ZSpan *zspan)
{
/* make new PS */
- if(zspan->apsmcounter==0) {
+ if (zspan->apsmcounter==0) {
zspan->curpstr= addpsmainA(zspan->apsmbase);
zspan->apsmcounter= 4095;
}
@@ -317,7 +317,7 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
/* set spans */
zbuf_add_to_span(zspan, v1, v2);
zbuf_add_to_span(zspan, v2, v3);
- if(v4) {
+ if (v4) {
zbuf_add_to_span(zspan, v3, v4);
zbuf_add_to_span(zspan, v4, v1);
}
@@ -325,12 +325,12 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
zbuf_add_to_span(zspan, v3, v1);
/* clipped */
- if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+ if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
- if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
- if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+ if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+ if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
- if(my2<my0) return;
+ if (my2<my0) return;
/* ZBUF DX DY, in floats still */
x1= v1[0]- v2[0];
@@ -343,7 +343,7 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
y0= z1*x2-x1*z2;
z0= x1*y2-y1*x2;
- if(z0==0.0f) return;
+ if (z0==0.0f) return;
xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
@@ -360,7 +360,7 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
/* correct span */
sn1= (my0 + my2)/2;
- if(zspan->span1[sn1] < zspan->span2[sn1]) {
+ if (zspan->span1[sn1] < zspan->span2[sn1]) {
span1= zspan->span1+my2;
span2= zspan->span2+my2;
}
@@ -369,16 +369,16 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
span2= zspan->span1+my2;
}
- for(y=my2; y>=my0; y--, span1--, span2--) {
+ for (y=my2; y>=my0; y--, span1--, span2--) {
sn1= floor(*span1);
sn2= floor(*span2);
sn1++;
- if(sn2>=rectx) sn2= rectx-1;
- if(sn1<0) sn1= 0;
+ if (sn2>=rectx) sn2= rectx-1;
+ if (sn1<0) sn1= 0;
- if(sn2>=sn1) {
+ if (sn2>=sn1) {
int intzverg;
zverg= (double)sn1*zxd + zy0;
@@ -389,23 +389,23 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
zverg-= zspan->polygon_offset;
- while(x>=0) {
+ while (x>=0) {
intzverg= (int)CLAMPIS(zverg, INT_MIN, INT_MAX);
- if( intzverg < *rz) {
- if(!zspan->rectmask || intzverg > *rm) {
+ if ( intzverg < *rz) {
+ if (!zspan->rectmask || intzverg > *rm) {
apn= ap;
- while(apn) {
- if(apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= intzverg; apn->mask[0]= mask; break; }
- if(apn->p[0]==zvlnr && apn->obi[0]==obi) {apn->mask[0]|= mask; break; }
- if(apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= intzverg; apn->mask[1]= mask; break; }
- if(apn->p[1]==zvlnr && apn->obi[1]==obi) {apn->mask[1]|= mask; break; }
- if(apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= intzverg; apn->mask[2]= mask; break; }
- if(apn->p[2]==zvlnr && apn->obi[2]==obi) {apn->mask[2]|= mask; break; }
- if(apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= intzverg; apn->mask[3]= mask; break; }
- if(apn->p[3]==zvlnr && apn->obi[3]==obi) {apn->mask[3]|= mask; break; }
- if(apn->next==NULL) apn->next= addpsA(zspan);
+ while (apn) {
+ if (apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= intzverg; apn->mask[0]= mask; break; }
+ if (apn->p[0]==zvlnr && apn->obi[0]==obi) {apn->mask[0]|= mask; break; }
+ if (apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= intzverg; apn->mask[1]= mask; break; }
+ if (apn->p[1]==zvlnr && apn->obi[1]==obi) {apn->mask[1]|= mask; break; }
+ if (apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= intzverg; apn->mask[2]= mask; break; }
+ if (apn->p[2]==zvlnr && apn->obi[2]==obi) {apn->mask[2]|= mask; break; }
+ if (apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= intzverg; apn->mask[3]= mask; break; }
+ if (apn->p[3]==zvlnr && apn->obi[3]==obi) {apn->mask[3]|= mask; break; }
+ if (apn->next==NULL) apn->next= addpsA(zspan);
apn= apn->next;
}
}
@@ -441,10 +441,10 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
mask= zspan->mask;
- if(fabs(dx) > fabs(dy)) {
+ if (fabs(dx) > fabs(dy)) {
/* all lines from left to right */
- if(vec1[0]<vec2[0]) {
+ if (vec1[0]<vec2[0]) {
copy_v3_v3(v1, vec1);
copy_v3_v3(v2, vec2);
}
@@ -456,7 +456,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
start= floor(v1[0]);
end= start+floor(dx);
- if(end>=zspan->rectx) end= zspan->rectx-1;
+ if (end>=zspan->rectx) end= zspan->rectx-1;
oldy= floor(v1[1]);
dy/= dx;
@@ -464,40 +464,40 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
vergz= v1[2];
vergz-= zspan->polygon_offset;
dz= (v2[2]-v1[2])/dx;
- if(vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
+ if (vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
rectz= (int *)(zspan->arectz+zspan->rectx*(oldy) +start);
rectmask= (int *)(zspan->rectmask+zspan->rectx*(oldy) +start);
ap= (zspan->apixbuf+ zspan->rectx*(oldy) +start);
- if(dy<0) ofs= -zspan->rectx;
+ if (dy<0) ofs= -zspan->rectx;
else ofs= zspan->rectx;
- for(x= start; x<=end; x++, rectz++, rectmask++, ap++) {
+ for (x= start; x<=end; x++, rectz++, rectmask++, ap++) {
y= floor(v1[1]);
- if(y!=oldy) {
+ if (y!=oldy) {
oldy= y;
rectz+= ofs;
rectmask+= ofs;
ap+= ofs;
}
- if(x>=0 && y>=0 && y<zspan->recty) {
- if(vergz<*rectz) {
- if(!zspan->rectmask || vergz>*rectmask) {
+ if (x>=0 && y>=0 && y<zspan->recty) {
+ if (vergz<*rectz) {
+ if (!zspan->rectmask || vergz>*rectmask) {
apn= ap;
- while(apn) { /* loop unrolled */
- if(apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= vergz; apn->mask[0]= mask; break; }
- if(apn->p[0]==zvlnr && apn->obi[0]==obi) {apn->mask[0]|= mask; break; }
- if(apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= vergz; apn->mask[1]= mask; break; }
- if(apn->p[1]==zvlnr && apn->obi[1]==obi) {apn->mask[1]|= mask; break; }
- if(apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= vergz; apn->mask[2]= mask; break; }
- if(apn->p[2]==zvlnr && apn->obi[2]==obi) {apn->mask[2]|= mask; break; }
- if(apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= vergz; apn->mask[3]= mask; break; }
- if(apn->p[3]==zvlnr && apn->obi[3]==obi) {apn->mask[3]|= mask; break; }
- if(apn->next==0) apn->next= addpsA(zspan);
+ while (apn) { /* loop unrolled */
+ if (apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= vergz; apn->mask[0]= mask; break; }
+ if (apn->p[0]==zvlnr && apn->obi[0]==obi) {apn->mask[0]|= mask; break; }
+ if (apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= vergz; apn->mask[1]= mask; break; }
+ if (apn->p[1]==zvlnr && apn->obi[1]==obi) {apn->mask[1]|= mask; break; }
+ if (apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= vergz; apn->mask[2]= mask; break; }
+ if (apn->p[2]==zvlnr && apn->obi[2]==obi) {apn->mask[2]|= mask; break; }
+ if (apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= vergz; apn->mask[3]= mask; break; }
+ if (apn->p[3]==zvlnr && apn->obi[3]==obi) {apn->mask[3]|= mask; break; }
+ if (apn->next==0) apn->next= addpsA(zspan);
apn= apn->next;
}
}
@@ -505,14 +505,14 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
}
v1[1]+= dy;
- if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+ if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
else vergz+= dz;
}
}
else {
/* all lines from top to bottom */
- if(vec1[1]<vec2[1]) {
+ if (vec1[1]<vec2[1]) {
copy_v3_v3(v1, vec1);
copy_v3_v3(v2, vec2);
}
@@ -525,9 +525,9 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
start= floor(v1[1]);
end= start+floor(dy);
- if(start>=zspan->recty || end<0) return;
+ if (start>=zspan->recty || end<0) return;
- if(end>=zspan->recty) end= zspan->recty-1;
+ if (end>=zspan->recty) end= zspan->recty-1;
oldx= floor(v1[0]);
dx/= dy;
@@ -535,40 +535,40 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
vergz= v1[2];
vergz-= zspan->polygon_offset;
dz= (v2[2]-v1[2])/dy;
- if(vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
+ if (vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
rectz= (int *)( zspan->arectz+ (start)*zspan->rectx+ oldx );
rectmask= (int *)( zspan->rectmask+ (start)*zspan->rectx+ oldx );
ap= (zspan->apixbuf+ zspan->rectx*(start) +oldx);
- if(dx<0) ofs= -1;
+ if (dx<0) ofs= -1;
else ofs= 1;
- for(y= start; y<=end; y++, rectz+=zspan->rectx, rectmask+=zspan->rectx, ap+=zspan->rectx) {
+ for (y= start; y<=end; y++, rectz+=zspan->rectx, rectmask+=zspan->rectx, ap+=zspan->rectx) {
x= floor(v1[0]);
- if(x!=oldx) {
+ if (x!=oldx) {
oldx= x;
rectz+= ofs;
rectmask+= ofs;
ap+= ofs;
}
- if(x>=0 && y>=0 && x<zspan->rectx) {
- if(vergz<*rectz) {
- if(!zspan->rectmask || vergz>*rectmask) {
+ if (x>=0 && y>=0 && x<zspan->rectx) {
+ if (vergz<*rectz) {
+ if (!zspan->rectmask || vergz>*rectmask) {
apn= ap;
- while(apn) { /* loop unrolled */
- if(apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= vergz; apn->mask[0]= mask; break; }
- if(apn->p[0]==zvlnr) {apn->mask[0]|= mask; break; }
- if(apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= vergz; apn->mask[1]= mask; break; }
- if(apn->p[1]==zvlnr) {apn->mask[1]|= mask; break; }
- if(apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= vergz; apn->mask[2]= mask; break; }
- if(apn->p[2]==zvlnr) {apn->mask[2]|= mask; break; }
- if(apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= vergz; apn->mask[3]= mask; break; }
- if(apn->p[3]==zvlnr) {apn->mask[3]|= mask; break; }
- if(apn->next==0) apn->next= addpsA(zspan);
+ while (apn) { /* loop unrolled */
+ if (apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= vergz; apn->mask[0]= mask; break; }
+ if (apn->p[0]==zvlnr) {apn->mask[0]|= mask; break; }
+ if (apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= vergz; apn->mask[1]= mask; break; }
+ if (apn->p[1]==zvlnr) {apn->mask[1]|= mask; break; }
+ if (apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= vergz; apn->mask[2]= mask; break; }
+ if (apn->p[2]==zvlnr) {apn->mask[2]|= mask; break; }
+ if (apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= vergz; apn->mask[3]= mask; break; }
+ if (apn->p[3]==zvlnr) {apn->mask[3]|= mask; break; }
+ if (apn->next==0) apn->next= addpsA(zspan);
apn= apn->next;
}
}
@@ -576,7 +576,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
}
v1[0]+= dx;
- if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+ if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
else vergz+= dz;
}
}
@@ -595,10 +595,10 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
dx= vec2[0]-vec1[0];
dy= vec2[1]-vec1[1];
- if(fabs(dx) > fabs(dy)) {
+ if (fabs(dx) > fabs(dy)) {
/* all lines from left to right */
- if(vec1[0]<vec2[0]) {
+ if (vec1[0]<vec2[0]) {
copy_v3_v3(v1, vec1);
copy_v3_v3(v2, vec2);
}
@@ -610,27 +610,27 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
start= floor(v1[0]);
end= start+floor(dx);
- if(end>=zspan->rectx) end= zspan->rectx-1;
+ if (end>=zspan->rectx) end= zspan->rectx-1;
oldy= floor(v1[1]);
dy/= dx;
vergz= floor(v1[2]);
dz= floor((v2[2]-v1[2])/dx);
- if(vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
+ if (vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
rectz= zspan->rectz + oldy*zspan->rectx+ start;
rectp= zspan->rectp + oldy*zspan->rectx+ start;
recto= zspan->recto + oldy*zspan->rectx+ start;
rectmask= zspan->rectmask + oldy*zspan->rectx+ start;
- if(dy<0) ofs= -zspan->rectx;
+ if (dy<0) ofs= -zspan->rectx;
else ofs= zspan->rectx;
- for(x= start; x<=end; x++, rectz++, rectp++, recto++, rectmask++) {
+ for (x= start; x<=end; x++, rectz++, rectp++, recto++, rectmask++) {
y= floor(v1[1]);
- if(y!=oldy) {
+ if (y!=oldy) {
oldy= y;
rectz+= ofs;
rectp+= ofs;
@@ -638,9 +638,9 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
rectmask+= ofs;
}
- if(x>=0 && y>=0 && y<zspan->recty) {
- if(vergz<*rectz) {
- if(!zspan->rectmask || vergz>*rectmask) {
+ if (x>=0 && y>=0 && y<zspan->recty) {
+ if (vergz<*rectz) {
+ if (!zspan->rectmask || vergz>*rectmask) {
*recto= obi;
*rectz= vergz;
*rectp= zvlnr;
@@ -650,13 +650,13 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
v1[1]+= dy;
- if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+ if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
else vergz+= dz;
}
}
else {
/* all lines from top to bottom */
- if(vec1[1]<vec2[1]) {
+ if (vec1[1]<vec2[1]) {
copy_v3_v3(v1, vec1);
copy_v3_v3(v2, vec2);
}
@@ -669,27 +669,27 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
start= floor(v1[1]);
end= start+floor(dy);
- if(end>=zspan->recty) end= zspan->recty-1;
+ if (end>=zspan->recty) end= zspan->recty-1;
oldx= floor(v1[0]);
dx/= dy;
vergz= floor(v1[2]);
dz= floor((v2[2]-v1[2])/dy);
- if(vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
+ if (vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
rectz= zspan->rectz + start*zspan->rectx+ oldx;
rectp= zspan->rectp + start*zspan->rectx+ oldx;
recto= zspan->recto + start*zspan->rectx+ oldx;
rectmask= zspan->rectmask + start*zspan->rectx+ oldx;
- if(dx<0) ofs= -1;
+ if (dx<0) ofs= -1;
else ofs= 1;
- for(y= start; y<=end; y++, rectz+=zspan->rectx, rectp+=zspan->rectx, recto+=zspan->rectx, rectmask+=zspan->rectx) {
+ for (y= start; y<=end; y++, rectz+=zspan->rectx, rectp+=zspan->rectx, recto+=zspan->rectx, rectmask+=zspan->rectx) {
x= floor(v1[0]);
- if(x!=oldx) {
+ if (x!=oldx) {
oldx= x;
rectz+= ofs;
rectp+= ofs;
@@ -697,9 +697,9 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
rectmask+= ofs;
}
- if(x>=0 && y>=0 && x<zspan->rectx) {
- if(vergz<*rectz) {
- if(!zspan->rectmask || vergz>*rectmask) {
+ if (x>=0 && y>=0 && x<zspan->rectx) {
+ if (vergz<*rectz) {
+ if (!zspan->rectmask || vergz>*rectmask) {
*rectz= vergz;
*rectp= zvlnr;
*recto= obi;
@@ -708,7 +708,7 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
}
v1[0]+= dx;
- if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+ if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
else vergz+= dz;
}
}
@@ -725,10 +725,10 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo
dx= vec2[0]-vec1[0];
dy= vec2[1]-vec1[1];
- if(fabs(dx) > fabs(dy)) {
+ if (fabs(dx) > fabs(dy)) {
/* all lines from left to right */
- if(vec1[0]<vec2[0]) {
+ if (vec1[0]<vec2[0]) {
copy_v3_v3(v1, vec1);
copy_v3_v3(v2, vec2);
}
@@ -740,51 +740,51 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo
start= floor(v1[0]);
end= start+floor(dx);
- if(end>=zspan->rectx) end= zspan->rectx-1;
+ if (end>=zspan->rectx) end= zspan->rectx-1;
oldy= floor(v1[1]);
dy/= dx;
vergz= floor(v1[2]);
dz= floor((v2[2]-v1[2])/dx);
- if(vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
+ if (vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
rectz= zspan->rectz + oldy*zspan->rectx+ start;
- if(zspan->rectz1)
+ if (zspan->rectz1)
rectz1= zspan->rectz1 + oldy*zspan->rectx+ start;
- if(dy<0) ofs= -zspan->rectx;
+ if (dy<0) ofs= -zspan->rectx;
else ofs= zspan->rectx;
- for(x= start; x<=end; x++, rectz++) {
+ for (x= start; x<=end; x++, rectz++) {
y= floor(v1[1]);
- if(y!=oldy) {
+ if (y!=oldy) {
oldy= y;
rectz+= ofs;
- if(rectz1) rectz1+= ofs;
+ if (rectz1) rectz1+= ofs;
}
- if(x>=0 && y>=0 && y<zspan->recty) {
- if(vergz < *rectz) {
- if(rectz1) *rectz1= *rectz;
+ if (x>=0 && y>=0 && y<zspan->recty) {
+ if (vergz < *rectz) {
+ if (rectz1) *rectz1= *rectz;
*rectz= vergz;
}
- else if(rectz1 && vergz < *rectz1)
+ else if (rectz1 && vergz < *rectz1)
*rectz1= vergz;
}
v1[1]+= dy;
- if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+ if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
else vergz+= dz;
- if(rectz1) rectz1++;
+ if (rectz1) rectz1++;
}
}
else {
/* all lines from top to bottom */
- if(vec1[1]<vec2[1]) {
+ if (vec1[1]<vec2[1]) {
copy_v3_v3(v1, vec1);
copy_v3_v3(v2, vec2);
}
@@ -797,45 +797,45 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo
start= floor(v1[1]);
end= start+floor(dy);
- if(end>=zspan->recty) end= zspan->recty-1;
+ if (end>=zspan->recty) end= zspan->recty-1;
oldx= floor(v1[0]);
dx/= dy;
vergz= floor(v1[2]);
dz= floor((v2[2]-v1[2])/dy);
- if(vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
+ if (vergz>0x50000000 && dz>0) maxtest= 1; // prevent overflow
rectz= zspan->rectz + start*zspan->rectx+ oldx;
- if(zspan->rectz1)
+ if (zspan->rectz1)
rectz1= zspan->rectz1 + start*zspan->rectx+ oldx;
- if(dx<0) ofs= -1;
+ if (dx<0) ofs= -1;
else ofs= 1;
- for(y= start; y<=end; y++, rectz+=zspan->rectx) {
+ for (y= start; y<=end; y++, rectz+=zspan->rectx) {
x= floor(v1[0]);
- if(x!=oldx) {
+ if (x!=oldx) {
oldx= x;
rectz+= ofs;
- if(rectz1) rectz1+= ofs;
+ if (rectz1) rectz1+= ofs;
}
- if(x>=0 && y>=0 && x<zspan->rectx) {
- if(vergz < *rectz) {
- if(rectz1) *rectz1= *rectz;
+ if (x>=0 && y>=0 && x<zspan->rectx) {
+ if (vergz < *rectz) {
+ if (rectz1) *rectz1= *rectz;
*rectz= vergz;
}
- else if(rectz1 && vergz < *rectz1)
+ else if (rectz1 && vergz < *rectz1)
*rectz1= vergz;
}
v1[0]+= dx;
- if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+ if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
else vergz+= dz;
- if(rectz1)
+ if (rectz1)
rectz1+=zspan->rectx;
}
}
@@ -854,28 +854,28 @@ static int clipline(float v1[4], float v2[4]) /* return 0: do not draw */
* filled in with zbufwire correctly when rendering in parts. otherwise
* you see line endings at edges... */
- if(cliptestf(-dz, -dw, v1[3], v1[2], &u1,&u2)) {
- if(cliptestf(dz, -dw, v1[3], -v1[2], &u1,&u2)) {
+ if (cliptestf(-dz, -dw, v1[3], v1[2], &u1,&u2)) {
+ if (cliptestf(dz, -dw, v1[3], -v1[2], &u1,&u2)) {
dx= v2[0]-v1[0];
dz= 1.01f*(v2[3]-v1[3]);
v13= 1.01f*v1[3];
- if(cliptestf(-dx, -dz, v1[0], v13, &u1,&u2)) {
- if(cliptestf(dx, -dz, v13, -v1[0], &u1,&u2)) {
+ if (cliptestf(-dx, -dz, v1[0], v13, &u1,&u2)) {
+ if (cliptestf(dx, -dz, v13, -v1[0], &u1,&u2)) {
dy= v2[1]-v1[1];
- if(cliptestf(-dy, -dz, v1[1], v13, &u1,&u2)) {
- if(cliptestf(dy, -dz, v13, -v1[1], &u1,&u2)) {
+ if (cliptestf(-dy, -dz, v1[1], v13, &u1,&u2)) {
+ if (cliptestf(dy, -dz, v13, -v1[1], &u1,&u2)) {
- if(u2<1.0f) {
+ if (u2<1.0f) {
v2[0]= v1[0]+u2*dx;
v2[1]= v1[1]+u2*dy;
v2[2]= v1[2]+u2*dz;
v2[3]= v1[3]+u2*dw;
}
- if(u1>0.0f) {
+ if (u1>0.0f) {
v1[0]= v1[0]+u1*dx;
v1[1]= v1[1]+u1*dy;
v1[2]= v1[2]+u1*dz;
@@ -908,9 +908,9 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
int and, or;
/* edgecode: 1= draw */
- if(ec==0) return;
+ if (ec==0) return;
- if(ho4) {
+ if (ho4) {
and= (c1 & c2 & c3 & c4);
or= (c1 | c2 | c3 | c4);
}
@@ -919,44 +919,44 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
or= (c1 | c2 | c3);
}
- if(or) { /* not in the middle */
- if(and) { /* out completely */
+ if (or) { /* not in the middle */
+ if (and) { /* out completely */
return;
}
else { /* clipping */
- if(ec & ME_V1V2) {
+ if (ec & ME_V1V2) {
copy_v4_v4(vez, ho1);
copy_v4_v4(vez+4, ho2);
- if( clipline(vez, vez+4)) {
+ if ( clipline(vez, vez+4)) {
hoco_to_zco(zspan, vez, vez);
hoco_to_zco(zspan, vez+4, vez+4);
zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
}
}
- if(ec & ME_V2V3) {
+ if (ec & ME_V2V3) {
copy_v4_v4(vez, ho2);
copy_v4_v4(vez+4, ho3);
- if( clipline(vez, vez+4)) {
+ if ( clipline(vez, vez+4)) {
hoco_to_zco(zspan, vez, vez);
hoco_to_zco(zspan, vez+4, vez+4);
zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
}
}
- if(ho4) {
- if(ec & ME_V3V4) {
+ if (ho4) {
+ if (ec & ME_V3V4) {
copy_v4_v4(vez, ho3);
copy_v4_v4(vez+4, ho4);
- if( clipline(vez, vez+4)) {
+ if ( clipline(vez, vez+4)) {
hoco_to_zco(zspan, vez, vez);
hoco_to_zco(zspan, vez+4, vez+4);
zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
}
}
- if(ec & ME_V4V1) {
+ if (ec & ME_V4V1) {
copy_v4_v4(vez, ho4);
copy_v4_v4(vez+4, ho1);
- if( clipline(vez, vez+4)) {
+ if ( clipline(vez, vez+4)) {
hoco_to_zco(zspan, vez, vez);
hoco_to_zco(zspan, vez+4, vez+4);
zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
@@ -964,10 +964,10 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
}
}
else {
- if(ec & ME_V3V1) {
+ if (ec & ME_V3V1) {
copy_v4_v4(vez, ho3);
copy_v4_v4(vez+4, ho1);
- if( clipline(vez, vez+4)) {
+ if ( clipline(vez, vez+4)) {
hoco_to_zco(zspan, vez, vez);
hoco_to_zco(zspan, vez+4, vez+4);
zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
@@ -982,18 +982,18 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
hoco_to_zco(zspan, vez, ho1);
hoco_to_zco(zspan, vez+4, ho2);
hoco_to_zco(zspan, vez+8, ho3);
- if(ho4) {
+ if (ho4) {
hoco_to_zco(zspan, vez+12, ho4);
- if(ec & ME_V3V4) zspan->zbuflinefunc(zspan, obi, zvlnr, vez+8, vez+12);
- if(ec & ME_V4V1) zspan->zbuflinefunc(zspan, obi, zvlnr, vez+12, vez);
+ if (ec & ME_V3V4) zspan->zbuflinefunc(zspan, obi, zvlnr, vez+8, vez+12);
+ if (ec & ME_V4V1) zspan->zbuflinefunc(zspan, obi, zvlnr, vez+12, vez);
}
else {
- if(ec & ME_V3V1) zspan->zbuflinefunc(zspan, obi, zvlnr, vez+8, vez);
+ if (ec & ME_V3V1) zspan->zbuflinefunc(zspan, obi, zvlnr, vez+8, vez);
}
- if(ec & ME_V1V2) zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
- if(ec & ME_V2V3) zspan->zbuflinefunc(zspan, obi, zvlnr, vez+4, vez+8);
+ if (ec & ME_V1V2) zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
+ if (ec & ME_V2V3) zspan->zbuflinefunc(zspan, obi, zvlnr, vez+4, vez+8);
}
@@ -1005,12 +1005,12 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const
c1= testclip(ho1);
c2= testclip(ho2);
- if(c1 | c2) { /* not in the middle */
- if(!(c1 & c2)) { /* not out completely */
+ if (c1 | c2) { /* not in the middle */
+ if (!(c1 & c2)) { /* not out completely */
copy_v4_v4(f1, ho1);
copy_v4_v4(f2, ho2);
- if(clipline(f1, f2)) {
+ if (clipline(f1, f2)) {
hoco_to_zco(zspan, f1, f1);
hoco_to_zco(zspan, f2, f2);
zspan->zbuflinefunc(zspan, obi, zvlnr, f1, f2);
@@ -1057,7 +1057,7 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
/* set spans */
zbuf_add_to_span(zspan, v1, v2);
zbuf_add_to_span(zspan, v2, v3);
- if(v4) {
+ if (v4) {
zbuf_add_to_span(zspan, v3, v4);
zbuf_add_to_span(zspan, v4, v1);
}
@@ -1065,13 +1065,13 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
zbuf_add_to_span(zspan, v3, v1);
/* clipped */
- if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+ if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
- if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
- if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+ if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+ if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
// printf("my %d %d\n", my0, my2);
- if(my2<my0) return;
+ if (my2<my0) return;
/* ZBUF DX DY, in floats still */
@@ -1085,7 +1085,7 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
y0= z1*x2-x1*z2;
z0= x1*y2-y1*x2;
- if(z0==0.0f) return;
+ if (z0==0.0f) return;
xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
@@ -1102,7 +1102,7 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
/* correct span */
sn1= (my0 + my2)/2;
- if(zspan->span1[sn1] < zspan->span2[sn1]) {
+ if (zspan->span1[sn1] < zspan->span2[sn1]) {
span1= zspan->span1+my2;
span2= zspan->span2+my2;
}
@@ -1111,16 +1111,16 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
span2= zspan->span1+my2;
}
- for(y=my2; y>=my0; y--, span1--, span2--) {
+ for (y=my2; y>=my0; y--, span1--, span2--) {
sn1= floor(*span1);
sn2= floor(*span2);
sn1++;
- if(sn2>=rectx) sn2= rectx-1;
- if(sn1<0) sn1= 0;
+ if (sn2>=rectx) sn2= rectx-1;
+ if (sn1<0) sn1= 0;
- if(sn2>=sn1) {
+ if (sn2>=sn1) {
int intzverg;
zverg= (double)sn1*zxd + zy0;
@@ -1130,11 +1130,11 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
rm= rectmaskofs+sn1;
x= sn2-sn1;
- while(x>=0) {
+ while (x>=0) {
intzverg= (int)CLAMPIS(zverg, INT_MIN, INT_MAX);
- if( intzverg > *rz || *rz==0x7FFFFFFF) { /* UNIQUE LINE: see comment above */
- if(!zspan->rectmask || intzverg > *rm) {
+ if ( intzverg > *rz || *rz==0x7FFFFFFF) { /* UNIQUE LINE: see comment above */
+ if (!zspan->rectmask || intzverg > *rm) {
*ro= obi; /* UNIQUE LINE: see comment above (order differs) */
*rz= intzverg;
*rp= zvlnr;
@@ -1179,7 +1179,7 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
/* set spans */
zbuf_add_to_span(zspan, v1, v2);
zbuf_add_to_span(zspan, v2, v3);
- if(v4) {
+ if (v4) {
zbuf_add_to_span(zspan, v3, v4);
zbuf_add_to_span(zspan, v4, v1);
}
@@ -1187,13 +1187,13 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
zbuf_add_to_span(zspan, v3, v1);
/* clipped */
- if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+ if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
- if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
- if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+ if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+ if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
// printf("my %d %d\n", my0, my2);
- if(my2<my0) return;
+ if (my2<my0) return;
/* ZBUF DX DY, in floats still */
@@ -1207,7 +1207,7 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
y0= z1*x2-x1*z2;
z0= x1*y2-y1*x2;
- if(z0==0.0f) return;
+ if (z0==0.0f) return;
xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
@@ -1224,7 +1224,7 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
/* correct span */
sn1= (my0 + my2)/2;
- if(zspan->span1[sn1] < zspan->span2[sn1]) {
+ if (zspan->span1[sn1] < zspan->span2[sn1]) {
span1= zspan->span1+my2;
span2= zspan->span2+my2;
}
@@ -1233,16 +1233,16 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
span2= zspan->span1+my2;
}
- for(y=my2; y>=my0; y--, span1--, span2--) {
+ for (y=my2; y>=my0; y--, span1--, span2--) {
sn1= floor(*span1);
sn2= floor(*span2);
sn1++;
- if(sn2>=rectx) sn2= rectx-1;
- if(sn1<0) sn1= 0;
+ if (sn2>=rectx) sn2= rectx-1;
+ if (sn1<0) sn1= 0;
- if(sn2>=sn1) {
+ if (sn2>=sn1) {
int intzverg;
zverg= (double)sn1*zxd + zy0;
@@ -1252,11 +1252,11 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
rm= rectmaskofs+sn1;
x= sn2-sn1;
- while(x>=0) {
+ while (x>=0) {
intzverg= (int)CLAMPIS(zverg, INT_MIN, INT_MAX);
- if(intzverg < *rz) { /* ONLY UNIQUE LINE: see comment above */
- if(!zspan->rectmask || intzverg > *rm) {
+ if (intzverg < *rz) { /* ONLY UNIQUE LINE: see comment above */
+ if (!zspan->rectmask || intzverg > *rm) {
*rz= intzverg;
*rp= zvlnr;
*ro= obi; /* UNIQUE LINE: see comment above (order differs) */
@@ -1306,7 +1306,7 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
/* set spans */
zbuf_add_to_span(zspan, v1, v2);
zbuf_add_to_span(zspan, v2, v3);
- if(v4) {
+ if (v4) {
zbuf_add_to_span(zspan, v3, v4);
zbuf_add_to_span(zspan, v4, v1);
}
@@ -1314,13 +1314,13 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
zbuf_add_to_span(zspan, v3, v1);
/* clipped */
- if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+ if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
- if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
- if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+ if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+ if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
// printf("my %d %d\n", my0, my2);
- if(my2<my0) return;
+ if (my2<my0) return;
/* ZBUF DX DY, in floats still */
@@ -1334,7 +1334,7 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
y0= z1*x2-x1*z2;
z0= x1*y2-y1*x2;
- if(z0==0.0f) return;
+ if (z0==0.0f) return;
xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
@@ -1345,12 +1345,12 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
/* start-offset in rect */
rectx= zspan->rectx;
rectzofs= (zspan->rectz+rectx*my2);
- if(zspan->rectz1)
+ if (zspan->rectz1)
rectzofs1= (zspan->rectz1+rectx*my2);
/* correct span */
sn1= (my0 + my2)/2;
- if(zspan->span1[sn1] < zspan->span2[sn1]) {
+ if (zspan->span1[sn1] < zspan->span2[sn1]) {
span1= zspan->span1+my2;
span2= zspan->span2+my2;
}
@@ -1359,30 +1359,30 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
span2= zspan->span1+my2;
}
- for(y=my2; y>=my0; y--, span1--, span2--) {
+ for (y=my2; y>=my0; y--, span1--, span2--) {
sn1= floor(*span1);
sn2= floor(*span2);
sn1++;
- if(sn2>=rectx) sn2= rectx-1;
- if(sn1<0) sn1= 0;
+ if (sn2>=rectx) sn2= rectx-1;
+ if (sn1<0) sn1= 0;
- if(sn2>=sn1) {
+ if (sn2>=sn1) {
zverg= (double)sn1*zxd + zy0;
rz= rectzofs+sn1;
rz1= rectzofs1+sn1;
x= sn2-sn1;
- while(x>=0) {
+ while (x>=0) {
int zvergi= (int)CLAMPIS(zverg, INT_MIN, INT_MAX);
/* option: maintain two depth values, closest and 2nd closest */
- if(zvergi < *rz) {
- if(rectzofs1) *rz1= *rz;
+ if (zvergi < *rz) {
+ if (rectzofs1) *rz1= *rz;
*rz= zvergi;
}
- else if(rectzofs1 && zvergi < *rz1)
+ else if (rectzofs1 && zvergi < *rz1)
*rz1= zvergi;
zverg+= zxd;
@@ -1395,7 +1395,7 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
zy0-=zyd;
rectzofs-= rectx;
- if(rectzofs1) rectzofs1-= rectx;
+ if (rectzofs1) rectzofs1-= rectx;
}
}
@@ -1416,13 +1416,13 @@ void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2,
zbuf_add_to_span(zspan, v3, v1);
/* clipped */
- if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+ if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
- if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
- if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+ if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+ if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
// printf("my %d %d\n", my0, my2);
- if(my2<my0) return;
+ if (my2<my0) return;
/* ZBUF DX DY, in floats still */
x1= v1[0]- v2[0];
@@ -1436,7 +1436,7 @@ void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2,
y0= z1*x2-x1*z2;
z0= x1*y2-y1*x2;
- if(z0==0.0f) return;
+ if (z0==0.0f) return;
xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
zxd= -(double)x0/(double)z0;
@@ -1467,7 +1467,7 @@ void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2,
/* correct span */
sn1= (my0 + my2)/2;
- if(zspan->span1[sn1] < zspan->span2[sn1]) {
+ if (zspan->span1[sn1] < zspan->span2[sn1]) {
span1= zspan->span1+my2;
span2= zspan->span2+my2;
}
@@ -1476,20 +1476,20 @@ void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2,
span2= zspan->span1+my2;
}
- for(y=my2; y>=my0; y--, span1--, span2--) {
+ for (y=my2; y>=my0; y--, span1--, span2--) {
sn1= floor(*span1);
sn2= floor(*span2);
sn1++;
- if(sn2>=rectx) sn2= rectx-1;
- if(sn1<0) sn1= 0;
+ if (sn2>=rectx) sn2= rectx-1;
+ if (sn1<0) sn1= 0;
u= (double)sn1*uxd + uy0;
v= (double)sn1*vxd + vy0;
z= (double)sn1*zxd + zy0;
- for(x= sn1; x<=sn2; x++, u+=uxd, v+=vxd, z+=zxd)
+ for (x= sn1; x<=sn2; x++, u+=uxd, v+=vxd, z+=zxd)
func(handle, x, y, u, v, z);
uy0 -= uyd;
@@ -1516,13 +1516,13 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
zbuf_add_to_span(zspan, v3, v1);
/* clipped */
- if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+ if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
- if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
- if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+ if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+ if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
// printf("my %d %d\n", my0, my2);
- if(my2<my0) return;
+ if (my2<my0) return;
/* ZBUF DX DY, in floats still */
x1= v1[0]- v2[0];
@@ -1537,7 +1537,7 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
y0= z1*x2-x1*z2;
z0= x1*y2-y1*x2;
- if(z0==0.0f) return;
+ if (z0==0.0f) return;
xx1= (x0*v1[0] + y0*v1[1])/z0 + 1.0f;
uxd= -(double)x0/(double)z0;
@@ -1557,7 +1557,7 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
/* correct span */
sn1= (my0 + my2)/2;
- if(zspan->span1[sn1] < zspan->span2[sn1]) {
+ if (zspan->span1[sn1] < zspan->span2[sn1]) {
span1= zspan->span1+my2;
span2= zspan->span2+my2;
}
@@ -1566,19 +1566,19 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
span2= zspan->span1+my2;
}
- for(y=my2; y>=my0; y--, span1--, span2--) {
+ for (y=my2; y>=my0; y--, span1--, span2--) {
sn1= floor(*span1);
sn2= floor(*span2);
sn1++;
- if(sn2>=rectx) sn2= rectx-1;
- if(sn1<0) sn1= 0;
+ if (sn2>=rectx) sn2= rectx-1;
+ if (sn1<0) sn1= 0;
u= (double)sn1*uxd + uy0;
v= (double)sn1*vxd + vy0;
- for(x= sn1; x<=sn2; x++, u+=uxd, v+=vxd)
+ for (x= sn1; x<=sn2; x++, u+=uxd, v+=vxd)
func(handle, x, y, u, v);
uy0 -= uyd;
@@ -1612,7 +1612,7 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a
da= v2[a]-v1[a];
/* prob; we clip slightly larger, osa renders add 2 pixels on edges, should become variable? */
/* or better; increase r.winx/y size, but thats quite a complex one. do it later */
- if(a==2) {
+ if (a==2) {
dw= (v2[3]-v1[3]);
v13= v1[3];
}
@@ -1627,18 +1627,21 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a
* who would have thought that of L&B!
*/
- if(cliptestf(-da, -dw, v13, v1[a], &u1,&u2)) {
- if(cliptestf(da, -dw, v13, -v1[a], &u1,&u2)) {
+ if (cliptestf(-da, -dw, v13, v1[a], &u1,&u2)) {
+ if (cliptestf(da, -dw, v13, -v1[a], &u1,&u2)) {
*b3=1;
- if(u2<1.0f) {
+ if (u2<1.0f) {
labda[1]= u2;
*b2=1;
}
else labda[1]=1.0; /* u2 */
- if(u1>0.0f) {
- labda[0]= u1;
- *b2=1;
- } else labda[0]=0.0;
+ if (u1>0.0f) {
+ labda[0] = u1;
+ *b2 = 1;
+ }
+ else {
+ labda[0] = 0.0;
+ }
}
}
}
@@ -1665,8 +1668,8 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo
l1= labda[0];
l2= labda[1];
- if(l1!= -1.0f) {
- if(l1!= 0.0f) {
+ if (l1!= -1.0f) {
+ if (l1!= 0.0f) {
adr= vez+4*(*clve);
trias[*b1]=adr;
(*clve)++;
@@ -1679,8 +1682,8 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo
(*b1)++;
}
- if(l2!= -1.0f) {
- if(l2!= 1.0f) {
+ if (l2!= -1.0f) {
+ if (l2!= 1.0f) {
adr= vez+4*(*clve);
trias[*b1]=adr;
(*clve)++;
@@ -1740,11 +1743,11 @@ static void zbuf_project_cache_clear(ZbufProjectCache *cache, int size)
{
int i;
- if(size > ZBUF_PROJECT_CACHE_SIZE)
+ if (size > ZBUF_PROJECT_CACHE_SIZE)
size= ZBUF_PROJECT_CACHE_SIZE;
memset(cache, 0, sizeof(ZbufProjectCache)*size);
- for(i=0; i<size; i++)
+ for (i=0; i<size; i++)
cache[i].index= -1;
}
@@ -1752,7 +1755,7 @@ static int zbuf_shadow_project(ZbufProjectCache *cache, int index, float winmat[
{
int cindex= index & 255;
- if(cache[cindex].index == index) {
+ if (cache[cindex].index == index) {
copy_v4_v4(ho, cache[cindex].ho);
return cache[cindex].clip;
}
@@ -1782,7 +1785,7 @@ static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][
float vec[3];
int cindex= index & 255;
- if(cache[cindex].index == index) {
+ if (cache[cindex].index == index) {
copy_v4_v4(ho, cache[cindex].ho);
return cache[cindex].clip;
}
@@ -1793,10 +1796,10 @@ static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][
projectvert(co, winmat, ho);
wco= ho[3];
- if(ho[0] < bounds[0]*wco) clipflag |= 1;
- else if(ho[0] > bounds[1]*wco) clipflag |= 2;
- if(ho[1] > bounds[3]*wco) clipflag |= 4;
- else if(ho[1] < bounds[2]*wco) clipflag |= 8;
+ if (ho[0] < bounds[0]*wco) clipflag |= 1;
+ else if (ho[0] > bounds[1]*wco) clipflag |= 2;
+ if (ho[1] > bounds[3]*wco) clipflag |= 4;
+ else if (ho[1] < bounds[2]*wco) clipflag |= 8;
copy_v4_v4(cache[cindex].ho, ho);
cache[cindex].clip= clipflag;
@@ -1816,7 +1819,7 @@ void zbuf_render_project(float winmat[][4], const float co[3], float ho[4])
void zbuf_make_winmat(Render *re, float winmat[][4])
{
- if(re->r.mode & R_PANORAMA) {
+ if (re->r.mode & R_PANORAMA) {
float panomat[4][4]= MAT4_UNITY;
panomat[0][0]= re->panoco;
@@ -1837,10 +1840,11 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
float *vlzp[32][3], labda[3][2];
float vez[400], *trias[40];
- if(c1 | c2 | c3) { /* not in middle */
- if(c1 & c2 & c3) { /* completely out */
+ if (c1 | c2 | c3) { /* not in middle */
+ if (c1 & c2 & c3) { /* completely out */
return;
- } else { /* clipping */
+ }
+ else { /* clipping */
int arg, v, b, clipflag[3], b1, b2, b3, c4, clve=3, clvlo, clvl=1;
vez[0]= f1[0]; vez[1]= f1[1]; vez[2]= f1[2]; vez[3]= f1[3];
@@ -1852,24 +1856,24 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
vlzp[0][2]= vez+8;
clipflag[0]= ( (c1 & 48) | (c2 & 48) | (c3 & 48) );
- if(clipflag[0]==0) { /* othwerwise it needs to be calculated again, after the first (z) clip */
+ if (clipflag[0]==0) { /* othwerwise it needs to be calculated again, after the first (z) clip */
clipflag[1]= ( (c1 & 3) | (c2 & 3) | (c3 & 3) );
clipflag[2]= ( (c1 & 12) | (c2 & 12) | (c3 & 12) );
}
else clipflag[1]=clipflag[2]= 0;
- for(b=0;b<3;b++) {
+ for (b=0;b<3;b++) {
- if(clipflag[b]) {
+ if (clipflag[b]) {
clvlo= clvl;
- for(v=0; v<clvlo; v++) {
+ for (v=0; v<clvlo; v++) {
- if(vlzp[v][0]!=NULL) { /* face is still there */
+ if (vlzp[v][0]!=NULL) { /* face is still there */
b2= b3 =0; /* clip flags */
- if(b==0) arg= 2;
+ if (b==0) arg= 2;
else if (b==1) arg= 0;
else arg= 1;
@@ -1877,27 +1881,29 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
clippyra(labda[1], vlzp[v][1],vlzp[v][2], &b2,&b3, arg, zspan->clipcrop);
clippyra(labda[2], vlzp[v][2],vlzp[v][0], &b2,&b3, arg, zspan->clipcrop);
- if(b2==0 && b3==1) {
- /* completely 'in', but we copy because of last for() loop in this section */;
+ if (b2==0 && b3==1) {
+ /* completely 'in', but we copy because of last for () loop in this section */;
vlzp[clvl][0]= vlzp[v][0];
vlzp[clvl][1]= vlzp[v][1];
vlzp[clvl][2]= vlzp[v][2];
vlzp[v][0]= NULL;
clvl++;
- } else if(b3==0) {
+ }
+ else if (b3==0) {
vlzp[v][0]= NULL;
/* completely 'out' */;
- } else {
+ }
+ else {
b1=0;
makevertpyra(vez, labda[0], trias, vlzp[v][0],vlzp[v][1], &b1,&clve);
makevertpyra(vez, labda[1], trias, vlzp[v][1],vlzp[v][2], &b1,&clve);
makevertpyra(vez, labda[2], trias, vlzp[v][2],vlzp[v][0], &b1,&clve);
/* after front clip done: now set clip flags */
- if(b==0) {
+ if (b==0) {
clipflag[1]= clipflag[2]= 0;
f1= vez;
- for(b3=0; b3<clve; b3++) {
+ for (b3=0; b3<clve; b3++) {
c4= testclip(f1);
clipflag[1] |= (c4 & 3);
clipflag[2] |= (c4 & 12);
@@ -1906,8 +1912,8 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
}
vlzp[v][0]= NULL;
- if(b1>2) {
- for(b3=3; b3<=b1; b3++) {
+ if (b1>2) {
+ for (b3=3; b3<=b1; b3++) {
vlzp[clvl][0]= trias[0];
vlzp[clvl][1]= trias[b3-2];
vlzp[clvl][2]= trias[b3-1];
@@ -1921,16 +1927,16 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
}
/* warning, this should never happen! */
- if(clve>38 || clvl>31) printf("clip overflow: clve clvl %d %d\n",clve,clvl);
+ if (clve>38 || clvl>31) printf("clip overflow: clve clvl %d %d\n",clve,clvl);
/* perspective division */
f1=vez;
- for(c1=0;c1<clve;c1++) {
+ for (c1=0;c1<clve;c1++) {
hoco_to_zco(zspan, f1, f1);
f1+=4;
}
- for(b=1;b<clvl;b++) {
- if(vlzp[b][0]) {
+ for (b=1;b<clvl;b++) {
+ if (vlzp[b][0]) {
zspan->zbuffunc(zspan, obi, zvlnr, vlzp[b][0],vlzp[b][1],vlzp[b][2], NULL);
}
}
@@ -1949,10 +1955,11 @@ void zbufclip4(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3
{
float vez[16];
- if(c1 | c2 | c3 | c4) { /* not in middle */
- if(c1 & c2 & c3 & c4) { /* completely out */
+ if (c1 | c2 | c3 | c4) { /* not in middle */
+ if (c1 & c2 & c3 & c4) { /* completely out */
return;
- } else { /* clipping */
+ }
+ else { /* clipping */
zbufclip(zspan, obi, zvlnr, f1, f2, f3, c1, c2, c3);
zbufclip(zspan, obi, zvlnr, f1, f3, f4, c1, c3, c4);
}
@@ -1970,7 +1977,7 @@ void zbufclip4(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3
/* ************** ZMASK ******************************** */
-#define EXTEND_PIXEL(a) if(temprectp[a]) {z+= rectz[a]; tot++;}
+#define EXTEND_PIXEL(a) if (temprectp[a]) {z+= rectz[a]; tot++;}
/* changes the zbuffer to be ready for z-masking: applies an extend-filter, and then clears */
static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
@@ -1983,21 +1990,21 @@ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
/* extend: if pixel is not filled in, we check surrounding pixels and average z value */
- for(y=1; y<=ys; y++) {
+ for (y=1; y<=ys; y++) {
/* setup row indices */
row1= (y-2)*xs;
row2= row1 + xs;
row3= row2 + xs;
- if(y==1)
+ if (y==1)
row1= row2;
- else if(y==ys)
+ else if (y==ys)
row3= row2;
curp= rectp + (y-1)*xs;
curz= rectz + (y-1)*xs;
- for(x=0; x<xs; x++, curp++, curz++) {
- if(curp[0]==0) {
+ for (x=0; x<xs; x++, curp++, curz++) {
+ if (curp[0]==0) {
int tot= 0;
float z= 0.0f;
@@ -2006,19 +2013,19 @@ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
EXTEND_PIXEL(row3);
EXTEND_PIXEL(row1 + 1);
EXTEND_PIXEL(row3 + 1);
- if(x!=xs-1) {
+ if (x!=xs-1) {
EXTEND_PIXEL(row1 + 2);
EXTEND_PIXEL(row2 + 2);
EXTEND_PIXEL(row3 + 2);
}
- if(tot) {
+ if (tot) {
len++;
curz[0]= (int)(z/(float)tot);
curp[0]= -1; /* env */
}
}
- if(x!=0) {
+ if (x!=0) {
row1++; row2++; row3++;
}
}
@@ -2026,11 +2033,11 @@ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
MEM_freeN(temprectp);
- if(neg); /* z values for negative are already correct */
+ if (neg); /* z values for negative are already correct */
else {
/* clear not filled z values */
- for(len= xs*ys -1; len>=0; len--) {
- if(rectp[len]==0) {
+ for (len= xs*ys -1; len>=0; len--) {
+ if (rectp[len]==0) {
rectz[len] = -0x7FFFFFFF;
rectp[len]= -1; /* env code */
}
@@ -2065,7 +2072,7 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
samples= (R.osa? R.osa: 1);
samples= MIN2(4, samples-pa->sample);
- for(zsample=0; zsample<samples; zsample++) {
+ for (zsample=0; zsample<samples; zsample++) {
zspan= &zspans[zsample];
zbuffer_part_bounds(R.winx, R.winy, pa, bounds);
@@ -2075,11 +2082,11 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
zspan->zmulx= ((float)R.winx)/2.0f;
zspan->zmuly= ((float)R.winy)/2.0f;
- if(R.osa) {
+ if (R.osa) {
zspan->zofsx= -pa->disprect.xmin - R.jit[pa->sample+zsample][0];
zspan->zofsy= -pa->disprect.ymin - R.jit[pa->sample+zsample][1];
}
- else if(R.i.curblur) {
+ else if (R.i.curblur) {
zspan->zofsx= -pa->disprect.xmin - R.mblur_jit[R.i.curblur-1][0];
zspan->zofsy= -pa->disprect.ymin - R.mblur_jit[R.i.curblur-1][1];
}
@@ -2092,11 +2099,11 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
zspan->zofsy -= 0.5f;
/* the buffers */
- if(zsample == samples-1) {
+ if (zsample == samples-1) {
zspan->rectp= pa->rectp;
zspan->recto= pa->recto;
- if(neg_zmask)
+ if (neg_zmask)
zspan->rectz= pa->rectmask;
else
zspan->rectz= pa->rectz;
@@ -2113,17 +2120,17 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
}
/* in case zmask we fill Z for objects in lay_zmask first, then clear Z, and then do normal zbuffering */
- if(rl->layflag & SCE_LAY_ZMASK)
+ if (rl->layflag & SCE_LAY_ZMASK)
zmaskpass= 1;
- for(; zmaskpass >=0; zmaskpass--) {
+ for (; zmaskpass >=0; zmaskpass--) {
ma= NULL;
/* filling methods */
- for(zsample=0; zsample<samples; zsample++) {
+ for (zsample=0; zsample<samples; zsample++) {
zspan= &zspans[zsample];
- if(zmaskpass && neg_zmask)
+ if (zmaskpass && neg_zmask)
zspan->zbuffunc= zbuffillGLinv4;
else
zspan->zbuffunc= zbuffillGL4;
@@ -2131,48 +2138,48 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
}
/* regular zbuffering loop, does all sample buffers */
- for(i=0, obi=R.instancetable.first; obi; i++, obi=obi->next) {
+ for (i=0, obi=R.instancetable.first; obi; i++, obi=obi->next) {
obr= obi->obr;
/* continue happens in 2 different ways... zmaskpass only does lay_zmask stuff */
- if(zmaskpass) {
- if((obi->lay & lay_zmask)==0)
+ if (zmaskpass) {
+ if ((obi->lay & lay_zmask)==0)
continue;
}
- else if(!all_z && !(obi->lay & (lay|lay_zmask)))
+ else if (!all_z && !(obi->lay & (lay|lay_zmask)))
continue;
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mult_m4_m4m4(obwinmat, winmat, obi->mat);
else
copy_m4_m4(obwinmat, winmat);
- if(clip_render_object(obi->obr->boundbox, bounds, obwinmat))
+ if (clip_render_object(obi->obr->boundbox, bounds, obwinmat))
continue;
zbuf_project_cache_clear(cache, obr->totvert);
- for(v=0; v<obr->totvlak; v++) {
- if((v & 255)==0) vlr= obr->vlaknodes[v>>8].vlak;
+ for (v=0; v<obr->totvlak; v++) {
+ if ((v & 255)==0) vlr= obr->vlaknodes[v>>8].vlak;
else vlr++;
/* the cases: visible for render, only z values, zmask, nothing */
- if(obi->lay & lay) {
- if(vlr->mat!=ma) {
+ if (obi->lay & lay) {
+ if (vlr->mat!=ma) {
ma= vlr->mat;
nofill= (ma->mode & MA_ONLYCAST) || ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP));
env= (ma->mode & MA_ENV);
wire= (ma->material_type == MA_TYPE_WIRE);
- for(zsample=0; zsample<samples; zsample++) {
- if(ma->mode & MA_ZINV || (zmaskpass && neg_zmask))
+ for (zsample=0; zsample<samples; zsample++) {
+ if (ma->mode & MA_ZINV || (zmaskpass && neg_zmask))
zspans[zsample].zbuffunc= zbuffillGLinv4;
else
zspans[zsample].zbuffunc= zbuffillGL4;
}
}
}
- else if(all_z || (obi->lay & lay_zmask)) {
+ else if (all_z || (obi->lay & lay_zmask)) {
env= 1;
nofill= 0;
ma= NULL;
@@ -2182,7 +2189,7 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
ma= NULL; /* otherwise nofill can hang */
}
- if(!(vlr->flag & R_HIDDEN) && nofill==0) {
+ if (!(vlr->flag & R_HIDDEN) && nofill==0) {
unsigned short partclip;
v1= vlr->v1;
@@ -2196,39 +2203,39 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
/* partclipping doesn't need viewplane clipping */
partclip= c1 & c2 & c3;
- if(v4) {
+ if (v4) {
c4= zbuf_part_project(cache, v4->index, obwinmat, bounds, v4->co, ho4);
partclip &= c4;
}
- if(partclip==0) {
+ if (partclip==0) {
- if(env) zvlnr= -1;
+ if (env) zvlnr= -1;
else zvlnr= v+1;
c1= testclip(ho1);
c2= testclip(ho2);
c3= testclip(ho3);
- if(v4)
+ if (v4)
c4= testclip(ho4);
- for(zsample=0; zsample<samples; zsample++) {
+ for (zsample=0; zsample<samples; zsample++) {
zspan= &zspans[zsample];
- if(wire) {
- if(v4)
+ if (wire) {
+ if (v4)
zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
else
zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, 0, c1, c2, c3, 0);
}
else {
/* strands allow to be filled in as quad */
- if(v4 && (vlr->flag & R_STRAND)) {
+ if (v4 && (vlr->flag & R_STRAND)) {
zbufclip4(zspan, i, zvlnr, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
}
else {
zbufclip(zspan, i, zvlnr, ho1, ho2, ho3, c1, c2, c3);
- if(v4)
+ if (v4)
zbufclip(zspan, i, (env)? zvlnr: zvlnr+RE_QUAD_OFFS, ho1, ho3, ho4, c1, c3, c4);
}
}
@@ -2239,13 +2246,13 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
}
/* clear all z to close value, so it works as mask for next passes (ztra+strand) */
- if(zmaskpass) {
- for(zsample=0; zsample<samples; zsample++) {
+ if (zmaskpass) {
+ for (zsample=0; zsample<samples; zsample++) {
zspan= &zspans[zsample];
- if(neg_zmask) {
+ if (neg_zmask) {
zspan->rectmask= zspan->rectz;
- if(zsample == samples-1)
+ if (zsample == samples-1)
zspan->rectz= pa->rectz;
else
zspan->rectz= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectz");
@@ -2259,17 +2266,17 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
}
}
- for(zsample=0; zsample<samples; zsample++) {
+ for (zsample=0; zsample<samples; zsample++) {
zspan= &zspans[zsample];
- if(fillfunc)
+ if (fillfunc)
fillfunc(pa, zspan, pa->sample+zsample, data);
- if(zsample != samples-1) {
+ if (zsample != samples-1) {
MEM_freeN(zspan->rectz);
MEM_freeN(zspan->rectp);
MEM_freeN(zspan->recto);
- if(zspan->rectmask)
+ if (zspan->rectmask)
MEM_freeN(zspan->rectmask);
}
@@ -2292,7 +2299,7 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
float obwinmat[4][4], ho1[4], ho2[4], ho3[4], ho4[4];
int a, b, c, i, c1, c2, c3, c4, ok=1, lay= -1;
- if(lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
+ if (lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
/* 1.0f for clipping in clippyra()... bad stuff actually */
zbuf_alloc_span(&zspan, size, size, 1.0f);
@@ -2305,7 +2312,7 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
/* the buffers */
zspan.rectz= rectz;
fillrect(rectz, size, size, 0x7FFFFFFE);
- if(lar->buftype==LA_SHADBUF_HALFWAY) {
+ if (lar->buftype==LA_SHADBUF_HALFWAY) {
zspan.rectz1= MEM_mallocN(size*size*sizeof(int), "seconday z buffer");
fillrect(zspan.rectz1, size, size, 0x7FFFFFFE);
}
@@ -2314,44 +2321,44 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
zspan.zbuflinefunc= zbufline_onlyZ;
zspan.zbuffunc= zbuffillGL_onlyZ;
- for(i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
+ for (i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
obr= obi->obr;
- if(obr->ob==re->excludeob)
+ if (obr->ob==re->excludeob)
continue;
- else if(!(obi->lay & lay))
+ else if (!(obi->lay & lay))
continue;
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mult_m4_m4m4(obwinmat, winmat, obi->mat);
else
copy_m4_m4(obwinmat, winmat);
- if(clip_render_object(obi->obr->boundbox, NULL, obwinmat))
+ if (clip_render_object(obi->obr->boundbox, NULL, obwinmat))
continue;
zbuf_project_cache_clear(cache, obr->totvert);
/* faces */
- for(a=0; a<obr->totvlak; a++) {
+ for (a=0; a<obr->totvlak; a++) {
- if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+ if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
else vlr++;
/* note, these conditions are copied in shadowbuf_autoclip() */
- if(vlr->mat!= ma) {
+ if (vlr->mat!= ma) {
ma= vlr->mat;
ok= 1;
- if((ma->mode & MA_SHADBUF)==0) ok= 0;
+ if ((ma->mode & MA_SHADBUF)==0) ok= 0;
}
- if(ok && (obi->lay & lay) && !(vlr->flag & R_HIDDEN)) {
+ if (ok && (obi->lay & lay) && !(vlr->flag & R_HIDDEN)) {
c1= zbuf_shadow_project(cache, vlr->v1->index, obwinmat, vlr->v1->co, ho1);
c2= zbuf_shadow_project(cache, vlr->v2->index, obwinmat, vlr->v2->co, ho2);
c3= zbuf_shadow_project(cache, vlr->v3->index, obwinmat, vlr->v3->co, ho3);
- if((ma->material_type == MA_TYPE_WIRE) || (vlr->flag & R_STRAND)) {
- if(vlr->v4) {
+ if ((ma->material_type == MA_TYPE_WIRE) || (vlr->flag & R_STRAND)) {
+ if (vlr->v4) {
c4= zbuf_shadow_project(cache, vlr->v4->index, obwinmat, vlr->v4->co, ho4);
zbufclipwire(&zspan, 0, a+1, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
}
@@ -2359,7 +2366,7 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
zbufclipwire(&zspan, 0, a+1, vlr->ec, ho1, ho2, ho3, 0, c1, c2, c3, 0);
}
else {
- if(vlr->v4) {
+ if (vlr->v4) {
c4= zbuf_shadow_project(cache, vlr->v4->index, obwinmat, vlr->v4->co, ho4);
zbufclip4(&zspan, 0, 0, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
}
@@ -2368,20 +2375,20 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
}
}
- if((a & 255)==255 && re->test_break(re->tbh))
+ if ((a & 255)==255 && re->test_break(re->tbh))
break;
}
/* strands */
- if(obr->strandbuf) {
+ if (obr->strandbuf) {
/* for each bounding box containing a number of strands */
sbound= obr->strandbuf->bound;
- for(c=0; c<obr->strandbuf->totbound; c++, sbound++) {
- if(clip_render_object(sbound->boundbox, NULL, obwinmat))
+ for (c=0; c<obr->strandbuf->totbound; c++, sbound++) {
+ if (clip_render_object(sbound->boundbox, NULL, obwinmat))
continue;
/* for each strand in this bounding box */
- for(a=sbound->start; a<sbound->end; a++) {
+ for (a=sbound->start; a<sbound->end; a++) {
strand= RE_findOrAddStrand(obr, a);
sseg.obi= obi;
@@ -2392,16 +2399,16 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
svert= strand->vert;
/* note, these conditions are copied in shadowbuf_autoclip() */
- if(sseg.buffer->ma!= ma) {
+ if (sseg.buffer->ma!= ma) {
ma= sseg.buffer->ma;
ok= 1;
- if((ma->mode & MA_SHADBUF)==0) ok= 0;
+ if ((ma->mode & MA_SHADBUF)==0) ok= 0;
}
- if(ok && (sseg.buffer->lay & lay)) {
+ if (ok && (sseg.buffer->lay & lay)) {
zbuf_project_cache_clear(cache, strand->totvert);
- for(b=0; b<strand->totvert-1; b++, svert++) {
+ for (b=0; b<strand->totvert-1; b++, svert++) {
sseg.v[0]= (b > 0)? (svert-1): svert;
sseg.v[1]= svert;
sseg.v[2]= svert+1;
@@ -2412,24 +2419,24 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
c3= zbuf_shadow_project(cache, sseg.v[2]-strand->vert, obwinmat, sseg.v[2]->co, ho3);
c4= zbuf_shadow_project(cache, sseg.v[3]-strand->vert, obwinmat, sseg.v[3]->co, ho4);
- if(!(c1 & c2 & c3 & c4))
+ if (!(c1 & c2 & c3 & c4))
render_strand_segment(re, winmat, NULL, &zspan, 1, &sseg);
}
}
- if((a & 255)==255 && re->test_break(re->tbh))
+ if ((a & 255)==255 && re->test_break(re->tbh))
break;
}
}
}
- if(re->test_break(re->tbh))
+ if (re->test_break(re->tbh))
break;
}
/* merge buffers */
- if(lar->buftype==LA_SHADBUF_HALFWAY) {
- for(a=size*size -1; a>=0; a--)
+ if (lar->buftype==LA_SHADBUF_HALFWAY) {
+ for (a=size*size -1; a>=0; a--)
rectz[a]= (rectz[a]>>1) + (zspan.rectz1[a]>>1);
MEM_freeN(zspan.rectz1);
@@ -2449,7 +2456,7 @@ static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
/* set spans */
zbuf_add_to_span(zspan, v1, v2);
zbuf_add_to_span(zspan, v2, v3);
- if(v4) {
+ if (v4) {
zbuf_add_to_span(zspan, v3, v4);
zbuf_add_to_span(zspan, v4, v1);
}
@@ -2457,12 +2464,12 @@ static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
zbuf_add_to_span(zspan, v3, v1);
/* clipped */
- if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+ if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
- if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
- if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+ if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+ if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
- if(my2<my0) return;
+ if (my2<my0) return;
/* ZBUF DX DY, in floats still */
x1= v1[0]- v2[0];
@@ -2476,7 +2483,7 @@ static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
y0= z1*x2-x1*z2;
z0= x1*y2-y1*x2;
- if(z0==0.0f) return;
+ if (z0==0.0f) return;
xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
zxd= -(double)x0/(double)z0;
@@ -2485,7 +2492,7 @@ static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
/* correct span */
sn1= (my0 + my2)/2;
- if(zspan->span1[sn1] < zspan->span2[sn1]) {
+ if (zspan->span1[sn1] < zspan->span2[sn1]) {
span1= zspan->span1+my2;
span2= zspan->span2+my2;
}
@@ -2494,17 +2501,17 @@ static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
span2= zspan->span1+my2;
}
- for(y=my2; y>=my0; y--, span1--, span2--) {
+ for (y=my2; y>=my0; y--, span1--, span2--) {
sn1= floor(*span1);
sn2= floor(*span2);
sn1++;
- if(sn2>=rectx) sn2= rectx-1;
- if(sn1<0) sn1= 0;
+ if (sn2>=rectx) sn2= rectx-1;
+ if (sn1<0) sn1= 0;
z= (double)sn1*zxd + zy0;
- for(x= sn1; x<=sn2; x++, z+=zxd)
+ for (x= sn1; x<=sn2; x++, z+=zxd)
zspan->sss_func(zspan->sss_handle, obi, zvlnr, x, y, z);
zy0 -= zyd;
@@ -2544,41 +2551,41 @@ void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(vo
zspan.zbuffunc= zbuffill_sss;
/* fill front and back zbuffer */
- if(pa->rectz) {
+ if (pa->rectz) {
fillrect(pa->recto, pa->rectx, pa->recty, 0);
fillrect(pa->rectp, pa->rectx, pa->recty, 0);
fillrect(pa->rectz, pa->rectx, pa->recty, 0x7FFFFFFF);
}
- if(pa->rectbackz) {
+ if (pa->rectbackz) {
fillrect(pa->rectbacko, pa->rectx, pa->recty, 0);
fillrect(pa->rectbackp, pa->rectx, pa->recty, 0);
fillrect(pa->rectbackz, pa->rectx, pa->recty, -0x7FFFFFFF);
}
- for(i=0, obi=R.instancetable.first; obi; i++, obi=obi->next) {
+ for (i=0, obi=R.instancetable.first; obi; i++, obi=obi->next) {
obr= obi->obr;
- if(!(obi->lay & lay))
+ if (!(obi->lay & lay))
continue;
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mult_m4_m4m4(obwinmat, winmat, obi->mat);
else
copy_m4_m4(obwinmat, winmat);
- if(clip_render_object(obi->obr->boundbox, bounds, obwinmat))
+ if (clip_render_object(obi->obr->boundbox, bounds, obwinmat))
continue;
zbuf_project_cache_clear(cache, obr->totvert);
- for(v=0; v<obr->totvlak; v++) {
- if((v & 255)==0) vlr= obr->vlaknodes[v>>8].vlak;
+ for (v=0; v<obr->totvlak; v++) {
+ if ((v & 255)==0) vlr= obr->vlaknodes[v>>8].vlak;
else vlr++;
- if(material_in_material(vlr->mat, sss_ma)) {
+ if (material_in_material(vlr->mat, sss_ma)) {
/* three cases, visible for render, only z values and nothing */
- if(obi->lay & lay) {
- if(vlr->mat!=ma) {
+ if (obi->lay & lay) {
+ if (vlr->mat!=ma) {
ma= vlr->mat;
nofill= ma->mode & MA_ONLYCAST;
env= (ma->mode & MA_ENV);
@@ -2590,7 +2597,7 @@ void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(vo
ma= NULL; /* otherwise nofill can hang */
}
- if(nofill==0 && wire==0 && env==0) {
+ if (nofill==0 && wire==0 && env==0) {
unsigned short partclip;
v1= vlr->v1;
@@ -2604,19 +2611,19 @@ void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(vo
/* partclipping doesn't need viewplane clipping */
partclip= c1 & c2 & c3;
- if(v4) {
+ if (v4) {
c4= zbuf_part_project(cache, v4->index, obwinmat, bounds, v4->co, ho4);
partclip &= c4;
}
- if(partclip==0) {
+ if (partclip==0) {
c1= testclip(ho1);
c2= testclip(ho2);
c3= testclip(ho3);
zvlnr= v+1;
zbufclip(&zspan, i, zvlnr, ho1, ho2, ho3, c1, c2, c3);
- if(v4) {
+ if (v4) {
c4= testclip(ho4);
zbufclip(&zspan, i, zvlnr+RE_QUAD_OFFS, ho1, ho3, ho4, c1, c3, c4);
}
@@ -2658,13 +2665,13 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
zbuf_add_to_span(zspan, v4, v1);
/* clipped */
- if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+ if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
- if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
- if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+ if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+ if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
// printf("my %d %d\n", my0, my2);
- if(my2<my0) return;
+ if (my2<my0) return;
/* ZBUF DX DY, in floats still */
x1= v1[0]- v2[0];
@@ -2677,7 +2684,7 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
y0= z1*x2-x1*z2;
z0= x1*y2-y1*x2;
- if(z0==0.0f) return;
+ if (z0==0.0f) return;
xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
@@ -2692,7 +2699,7 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
/* correct span */
sn1= (my0 + my2)/2;
- if(zspan->span1[sn1] < zspan->span2[sn1]) {
+ if (zspan->span1[sn1] < zspan->span2[sn1]) {
span1= zspan->span1+my2;
span2= zspan->span2+my2;
}
@@ -2701,23 +2708,23 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
span2= zspan->span1+my2;
}
- for(y=my2; y>=my0; y--, span1--, span2--) {
+ for (y=my2; y>=my0; y--, span1--, span2--) {
sn1= floor(*span1);
sn2= floor(*span2);
sn1++;
- if(sn2>=rectx) sn2= rectx-1;
- if(sn1<0) sn1= 0;
+ if (sn2>=rectx) sn2= rectx-1;
+ if (sn1<0) sn1= 0;
- if(sn2>=sn1) {
+ if (sn2>=sn1) {
zverg= (double)sn1*zxd + zy0;
rz= rectzofs+sn1;
rp= rectpofs+sn1;
x= sn2-sn1;
- while(x>=0) {
- if( zverg < *rz) {
+ while (x>=0) {
+ if ( zverg < *rz) {
*rz= zverg;
*rp= *col;
}
@@ -2743,14 +2750,14 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
int a, x, y, step;
/* 1: tag pixels to be candidate for AA */
- for(y=2; y<ysize; y++) {
+ for (y=2; y<ysize; y++) {
/* setup rows */
row1= rectmove + (y-2)*xsize;
row2= row1 + xsize;
row3= row2 + xsize;
- for(x=2; x<xsize; x++, row1++, row2++, row3++) {
- if(row2[1]) {
- if(row2[0]==0 || row2[2]==0 || row1[1]==0 || row3[1]==0)
+ for (x=2; x<xsize; x++, row1++, row2++, row3++) {
+ if (row2[1]) {
+ if (row2[0]==0 || row2[2]==0 || row1[1]==0 || row3[1]==0)
row2[1]= 128;
}
}
@@ -2758,22 +2765,22 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
/* 2: evaluate horizontal scanlines and calculate alphas */
row1= rectmove;
- for(y=0; y<ysize; y++) {
+ for (y=0; y<ysize; y++) {
row1++;
- for(x=1; x<xsize; x++, row1++) {
- if(row1[0]==128 && row1[1]==128) {
+ for (x=1; x<xsize; x++, row1++) {
+ if (row1[0]==128 && row1[1]==128) {
/* find previous color and next color and amount of steps to blend */
prev= row1[-1];
step= 1;
- while(x+step<xsize && row1[step]==128)
+ while (x+step<xsize && row1[step]==128)
step++;
- if(x+step!=xsize) {
+ if (x+step!=xsize) {
/* now we can blend values */
next= row1[step];
/* note, prev value can be next value, but we do this loop to clear 128 then */
- for(a=0; a<step; a++) {
+ for (a=0; a<step; a++) {
int fac, mfac;
fac= ((a+1)<<8)/(step+1);
@@ -2788,22 +2795,22 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
/* 3: evaluate vertical scanlines and calculate alphas */
/* use for reading a copy of the original tagged buffer */
- for(x=0; x<xsize; x++) {
+ for (x=0; x<xsize; x++) {
row1= rectmove + x+xsize;
- for(y=1; y<ysize; y++, row1+=xsize) {
- if(row1[0]==128 && row1[xsize]==128) {
+ for (y=1; y<ysize; y++, row1+=xsize) {
+ if (row1[0]==128 && row1[xsize]==128) {
/* find previous color and next color and amount of steps to blend */
prev= row1[-xsize];
step= 1;
- while(y+step<ysize && row1[step*xsize]==128)
+ while (y+step<ysize && row1[step*xsize]==128)
step++;
- if(y+step!=ysize) {
+ if (y+step!=ysize) {
/* now we can blend values */
next= row1[step*xsize];
/* note, prev value can be next value, but we do this loop to clear 128 then */
- for(a=0; a<step; a++) {
+ for (a=0; a<step; a++) {
int fac, mfac;
fac= ((a+1)<<8)/(step+1);
@@ -2817,14 +2824,14 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
}
/* last: pixels with 0 we fill in zbuffer, with 1 we skip for mask */
- for(y=2; y<ysize; y++) {
+ for (y=2; y<ysize; y++) {
/* setup rows */
row1= rectmove + (y-2)*xsize;
row2= row1 + xsize;
row3= row2 + xsize;
- for(x=2; x<xsize; x++, row1++, row2++, row3++) {
- if(row2[1]==0) {
- if(row2[0]>1 || row2[2]>1 || row1[1]>1 || row3[1]>1)
+ for (x=2; x<xsize; x++, row1++, row2++, row3++) {
+ if (row2[1]==0) {
+ if (row2[0]>1 || row2[2]>1 || row1[1]>1 || row3[1]>1)
row2[1]= 1;
}
}
@@ -2895,16 +2902,16 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
/* debug... check if PASS_VECTOR_MAX still is in buffers */
dvec1= vecbufrect;
- for(x= 4*xsize*ysize; x>0; x--, dvec1++) {
- if(dvec1[0]==PASS_VECTOR_MAX) {
+ for (x= 4*xsize*ysize; x>0; x--, dvec1++) {
+ if (dvec1[0]==PASS_VECTOR_MAX) {
dvec1[0]= 0.0f;
tsktsk= 1;
}
}
- if(tsktsk) printf("Found uninitialized speed in vector buffer... fixed.\n");
+ if (tsktsk) printf("Found uninitialized speed in vector buffer... fixed.\n");
/* min speed? then copy speedbuffer to recalculate speed vectors */
- if(nbd->minspeed) {
+ if (nbd->minspeed) {
float minspeed= (float)nbd->minspeed;
float minspeedsq= minspeed*minspeed;
@@ -2912,14 +2919,14 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
dvec1= vecbufrect;
dvec2= minvecbufrect;
- for(x= 2*xsize*ysize; x>0; x--, dvec1+=2, dvec2+=2) {
- if(dvec1[0]==0.0f && dvec1[1]==0.0f) {
+ for (x= 2*xsize*ysize; x>0; x--, dvec1+=2, dvec2+=2) {
+ if (dvec1[0]==0.0f && dvec1[1]==0.0f) {
dvec2[0]= dvec1[0];
dvec2[1]= dvec1[1];
}
else {
float speedsq= dvec1[0]*dvec1[0] + dvec1[1]*dvec1[1];
- if(speedsq <= minspeedsq) {
+ if (speedsq <= minspeedsq) {
dvec2[0]= 0.0f;
dvec2[1]= 0.0f;
}
@@ -2936,70 +2943,70 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
/* make vertex buffer with averaged speed and zvalues */
rectvz= MEM_mapallocN(4*sizeof(float)*(xsize+1)*(ysize+1), "vertices");
dvz= rectvz;
- for(y=0; y<=ysize; y++) {
+ for (y=0; y<=ysize; y++) {
- if(y==0)
+ if (y==0)
dvec1= vecbufrect + 4*y*xsize;
else
dvec1= vecbufrect + 4*(y-1)*xsize;
- if(y==ysize)
+ if (y==ysize)
dvec2= vecbufrect + 4*(y-1)*xsize;
else
dvec2= vecbufrect + 4*y*xsize;
- for(x=0; x<=xsize; x++) {
+ for (x=0; x<=xsize; x++) {
/* two vectors, so a step loop */
- for(step=0; step<2; step++, dvec1+=2, dvec2+=2, dvz+=2) {
+ for (step=0; step<2; step++, dvec1+=2, dvec2+=2, dvz+=2) {
/* average on minimal speed */
int div= 0;
- if(x!=0) {
- if(dvec1[-4]!=0.0f || dvec1[-3]!=0.0f) {
+ if (x!=0) {
+ if (dvec1[-4]!=0.0f || dvec1[-3]!=0.0f) {
dvz[0]= dvec1[-4];
dvz[1]= dvec1[-3];
div++;
}
- if(dvec2[-4]!=0.0f || dvec2[-3]!=0.0f) {
- if(div==0) {
+ if (dvec2[-4]!=0.0f || dvec2[-3]!=0.0f) {
+ if (div==0) {
dvz[0]= dvec2[-4];
dvz[1]= dvec2[-3];
div++;
}
- else if( (ABS(dvec2[-4]) + ABS(dvec2[-3]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
+ else if ( (ABS(dvec2[-4]) + ABS(dvec2[-3]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
dvz[0]= dvec2[-4];
dvz[1]= dvec2[-3];
}
}
}
- if(x!=xsize) {
- if(dvec1[0]!=0.0f || dvec1[1]!=0.0f) {
- if(div==0) {
+ if (x!=xsize) {
+ if (dvec1[0]!=0.0f || dvec1[1]!=0.0f) {
+ if (div==0) {
dvz[0]= dvec1[0];
dvz[1]= dvec1[1];
div++;
}
- else if( (ABS(dvec1[0]) + ABS(dvec1[1]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
+ else if ( (ABS(dvec1[0]) + ABS(dvec1[1]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
dvz[0]= dvec1[0];
dvz[1]= dvec1[1];
}
}
- if(dvec2[0]!=0.0f || dvec2[1]!=0.0f) {
- if(div==0) {
+ if (dvec2[0]!=0.0f || dvec2[1]!=0.0f) {
+ if (div==0) {
dvz[0]= dvec2[0];
dvz[1]= dvec2[1];
}
- else if( (ABS(dvec2[0]) + ABS(dvec2[1]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
+ else if ( (ABS(dvec2[0]) + ABS(dvec2[1]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
dvz[0]= dvec2[0];
dvz[1]= dvec2[1];
}
}
}
- if(maxspeed) {
+ if (maxspeed) {
float speedsq= dvz[0]*dvz[0] + dvz[1]*dvz[1];
- if(speedsq > maxspeedsq) {
+ if (speedsq > maxspeedsq) {
speedsq= (float)maxspeed/sqrt(speedsq);
dvz[0]*= speedsq;
dvz[1]*= speedsq;
@@ -3012,7 +3019,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
/* set border speeds to keep border speeds on border */
dz1= rectvz;
dz2= rectvz+4*(ysize)*(xsize+1);
- for(x=0; x<=xsize; x++, dz1+=4, dz2+=4) {
+ for (x=0; x<=xsize; x++, dz1+=4, dz2+=4) {
dz1[1]= 0.0f;
dz2[1]= 0.0f;
dz1[3]= 0.0f;
@@ -3020,7 +3027,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
}
dz1= rectvz;
dz2= rectvz+4*(xsize);
- for(y=0; y<=ysize; y++, dz1+=4*(xsize+1), dz2+=4*(xsize+1)) {
+ for (y=0; y<=ysize; y++, dz1+=4*(xsize+1), dz2+=4*(xsize+1)) {
dz1[0]= 0.0f;
dz2[0]= 0.0f;
dz1[2]= 0.0f;
@@ -3030,15 +3037,15 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
/* tag moving pixels, only these faces we draw */
dm= rectmove;
dvec1= vecbufrect;
- for(x=xsize*ysize; x>0; x--, dm++, dvec1+=4) {
- if((dvec1[0]!=0.0f || dvec1[1]!=0.0f || dvec1[2]!=0.0f || dvec1[3]!=0.0f))
+ for (x=xsize*ysize; x>0; x--, dm++, dvec1+=4) {
+ if ((dvec1[0]!=0.0f || dvec1[1]!=0.0f || dvec1[2]!=0.0f || dvec1[3]!=0.0f))
*dm= 255;
}
antialias_tagbuf(xsize, ysize, rectmove);
/* has to become static, the init-jit calls a random-seed, screwing up texture noise node */
- if(firsttime) {
+ if (firsttime) {
firsttime= 0;
BLI_initjit(jit[0], 256);
}
@@ -3047,26 +3054,26 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
/* accumulate */
samples/= 2;
- for(step= 1; step<=samples; step++) {
+ for (step= 1; step<=samples; step++) {
float speedfac= 0.5f*nbd->fac*(float)step/(float)(samples+1);
int side;
- for(side=0; side<2; side++) {
+ for (side=0; side<2; side++) {
float blendfac, ipodata[4];
/* clear zbuf, if we draw future we fill in not moving pixels */
- if(0)
- for(x= xsize*ysize-1; x>=0; x--) rectz[x]= 10e16;
+ if (0)
+ for (x= xsize*ysize-1; x>=0; x--) rectz[x]= 10e16;
else
- for(x= xsize*ysize-1; x>=0; x--) {
- if(rectmove[x]==0)
+ for (x= xsize*ysize-1; x>=0; x--) {
+ if (rectmove[x]==0)
rectz[x]= zbufrect[x];
else
rectz[x]= 10e16;
}
/* clear drawing buffer */
- for(x= xsize*ysize-1; x>=0; x--) rectdraw[x].colpoin= NULL;
+ for (x= xsize*ysize-1; x>=0; x--) rectdraw[x].colpoin= NULL;
dimg= imgrect;
dm= rectmove;
@@ -3074,8 +3081,8 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
dz1= rectvz;
dz2= rectvz + 4*(xsize + 1);
- if(side) {
- if(nbd->curved==0) {
+ if (side) {
+ if (nbd->curved==0) {
dz1+= 2;
dz2+= 2;
}
@@ -3084,15 +3091,15 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
set_quad_bezier_ipo(0.5f + 0.5f*speedfac, ipodata);
- for(fy= -0.5f+jit[step & 255][0], y=0; y<ysize; y++, fy+=1.0f) {
- for(fx= -0.5f+jit[step & 255][1], x=0; x<xsize; x++, fx+=1.0f, dimg+=4, dz1+=4, dz2+=4, dm++, dz++) {
- if(*dm>1) {
+ for (fy= -0.5f+jit[step & 255][0], y=0; y<ysize; y++, fy+=1.0f) {
+ for (fx= -0.5f+jit[step & 255][1], x=0; x<xsize; x++, fx+=1.0f, dimg+=4, dz1+=4, dz2+=4, dm++, dz++) {
+ if (*dm>1) {
float jfx = fx + 0.5f;
float jfy = fy + 0.5f;
DrawBufPixel col;
/* make vertices */
- if(nbd->curved) { /* curved */
+ if (nbd->curved) { /* curved */
quad_bezier_2d(v1, dz1, dz1+2, ipodata);
v1[0]+= jfx; v1[1]+= jfy; v1[2]= *dz;
@@ -3111,8 +3118,8 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
v3[0]= speedfac*dz2[4]+jfx+1.0f; v3[1]= speedfac*dz2[5]+jfy+1.0f; v3[2]= *dz;
v4[0]= speedfac*dz2[0]+jfx; v4[1]= speedfac*dz2[1]+jfy+1.0f; v4[2]= *dz;
}
- if(*dm==255) col.alpha= 1.0f;
- else if(*dm<2) col.alpha= 0.0f;
+ if (*dm==255) col.alpha= 1.0f;
+ else if (*dm<2) col.alpha= 0.0f;
else col.alpha= ((float)*dm)/255.0f;
col.colpoin= dimg;
@@ -3137,8 +3144,8 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
/* accum */
rw= rectweight;
rm= rectmax;
- for(dr= rectdraw, dz2=newrect, x= xsize*ysize-1; x>=0; x--, dr++, dz2+=4, rw++, rm++) {
- if(dr->colpoin) {
+ for (dr= rectdraw, dz2=newrect, x= xsize*ysize-1; x>=0; x--, dr++, dz2+=4, rw++, rm++) {
+ if (dr->colpoin) {
float bfac= dr->alpha*blendfac;
dz2[0] += bfac*dr->colpoin[0];
@@ -3158,7 +3165,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
rm= rectmax;
ro= imgrect;
dm= rectmove;
- for(dz2=newrect, x= xsize*ysize-1; x>=0; x--, dz2+=4, ro+=4, rw++, rm++, dm++) {
+ for (dz2=newrect, x= xsize*ysize-1; x>=0; x--, dz2+=4, ro+=4, rw++, rm++, dm++) {
float mfac = *rm;
float fac = (*rw == 0.0f)? 0.0f: mfac/(*rw);
float nfac = 1.0f - mfac;
@@ -3175,7 +3182,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
MEM_freeN(rectvz);
MEM_freeN(rectweight);
MEM_freeN(rectmax);
- if(minvecbufrect) MEM_freeN(vecbufrect); /* rects were swapped! */
+ if (minvecbufrect) MEM_freeN(vecbufrect); /* rects were swapped! */
zbuf_free_span(&zspan);
}
@@ -3191,18 +3198,18 @@ static void copyto_abufz(RenderPart *pa, int *arectz, int *rectmask, int sample)
int x, y, *rza, *rma;
intptr_t *rd;
- if(R.osa==0) {
- if(!pa->rectz)
+ if (R.osa==0) {
+ if (!pa->rectz)
fillrect(arectz, pa->rectx, pa->recty, 0x7FFFFFFE);
else
memcpy(arectz, pa->rectz, sizeof(int)*pa->rectx*pa->recty);
- if(rectmask && pa->rectmask)
+ if (rectmask && pa->rectmask)
memcpy(rectmask, pa->rectmask, sizeof(int)*pa->rectx*pa->recty);
return;
}
- else if(!pa->rectdaps) {
+ else if (!pa->rectdaps) {
fillrect(arectz, pa->rectx, pa->recty, 0x7FFFFFFE);
return;
}
@@ -3213,17 +3220,17 @@ static void copyto_abufz(RenderPart *pa, int *arectz, int *rectmask, int sample)
sample= (1<<sample);
- for(y=0; y<pa->recty; y++) {
- for(x=0; x<pa->rectx; x++) {
+ for (y=0; y<pa->recty; y++) {
+ for (x=0; x<pa->rectx; x++) {
*rza= 0x7FFFFFFF;
- if(rectmask) *rma= 0x7FFFFFFF;
- if(*rd) {
+ if (rectmask) *rma= 0x7FFFFFFF;
+ if (*rd) {
/* when there's a sky pixstruct, fill in sky-Z, otherwise solid Z */
- for(ps= (PixStr *)(*rd); ps; ps= ps->next) {
- if(sample & ps->mask) {
+ for (ps= (PixStr *)(*rd); ps; ps= ps->next) {
+ if (sample & ps->mask) {
*rza= ps->z;
- if(rectmask) *rma= ps->maskz;
+ if (rectmask) *rma= ps->maskz;
break;
}
}
@@ -3257,7 +3264,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
zbuffer_part_bounds(winx, winy, pa, bounds);
- for(zsample=0; zsample<samples; zsample++) {
+ for (zsample=0; zsample<samples; zsample++) {
zspan= &zspans[zsample];
zbuf_alloc_span(zspan, pa->rectx, pa->recty, re->clipcrop);
@@ -3271,7 +3278,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
zspan->apixbuf= APixbuf;
zspan->apsmbase= apsmbase;
- if(negzmask)
+ if (negzmask)
zspan->rectmask= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "Arectmask");
/* filling methods */
@@ -3281,7 +3288,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
copyto_abufz(pa, zspan->arectz, zspan->rectmask, zsample); /* init zbuffer */
zspan->mask= 1<<zsample;
- if(jit) {
+ if (jit) {
zspan->zofsx= -pa->disprect.xmin - jit[zsample][0];
zspan->zofsy= -pa->disprect.ymin - jit[zsample][1];
}
@@ -3298,37 +3305,37 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
/* we use this to test if nothing was filled in */
zvlnr= 0;
- for(i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
+ for (i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
obr= obi->obr;
- if(!(obi->lay & lay))
+ if (!(obi->lay & lay))
continue;
- if(obi->flag & R_TRANSFORMED)
+ if (obi->flag & R_TRANSFORMED)
mult_m4_m4m4(obwinmat, winmat, obi->mat);
else
copy_m4_m4(obwinmat, winmat);
- if(clip_render_object(obi->obr->boundbox, bounds, obwinmat))
+ if (clip_render_object(obi->obr->boundbox, bounds, obwinmat))
continue;
zbuf_project_cache_clear(cache, obr->totvert);
- for(v=0; v<obr->totvlak; v++) {
- if((v & 255)==0)
+ for (v=0; v<obr->totvlak; v++) {
+ if ((v & 255)==0)
vlr= obr->vlaknodes[v>>8].vlak;
else vlr++;
- if(vlr->mat!=ma) {
+ if (vlr->mat!=ma) {
ma= vlr->mat;
- if(shadow)
+ if (shadow)
dofill= (ma->mode & MA_SHADBUF);
else
dofill= (((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) && !(ma->mode & MA_ONLYCAST));
}
- if(dofill) {
- if(!(vlr->flag & R_HIDDEN) && (obi->lay & lay)) {
+ if (dofill) {
+ if (!(vlr->flag & R_HIDDEN) && (obi->lay & lay)) {
unsigned short partclip;
v1= vlr->v1;
@@ -3342,14 +3349,14 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
/* partclipping doesn't need viewplane clipping */
partclip= c1 & c2 & c3;
- if(v4) {
+ if (v4) {
c4= zbuf_part_project(cache, v4->index, obwinmat, bounds, v4->co, ho4);
partclip &= c4;
}
- if(partclip==0) {
+ if (partclip==0) {
/* a little advantage for transp rendering (a z offset) */
- if(!shadow && ma->zoffs != 0.0f) {
+ if (!shadow && ma->zoffs != 0.0f) {
mul= 0x7FFFFFFF;
zval= mul*(1.0f+ho1[2]/ho1[3]);
@@ -3368,45 +3375,45 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
c1= testclip(ho1);
c2= testclip(ho2);
c3= testclip(ho3);
- if(v4)
+ if (v4)
c4= testclip(ho4);
- for(zsample=0; zsample<samples; zsample++) {
+ for (zsample=0; zsample<samples; zsample++) {
zspan= &zspans[zsample];
zspan->polygon_offset= polygon_offset;
- if(ma->material_type == MA_TYPE_WIRE) {
- if(v4)
+ if (ma->material_type == MA_TYPE_WIRE) {
+ if (v4)
zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
else
zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, 0, c1, c2, c3, 0);
}
else {
- if(v4 && (vlr->flag & R_STRAND)) {
+ if (v4 && (vlr->flag & R_STRAND)) {
zbufclip4(zspan, i, zvlnr, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
}
else {
zbufclip(zspan, i, zvlnr, ho1, ho2, ho3, c1, c2, c3);
- if(v4)
+ if (v4)
zbufclip(zspan, i, zvlnr+RE_QUAD_OFFS, ho1, ho3, ho4, c1, c3, c4);
}
}
}
}
- if((v & 255)==255)
- if(re->test_break(re->tbh))
+ if ((v & 255)==255)
+ if (re->test_break(re->tbh))
break;
}
}
}
- if(re->test_break(re->tbh)) break;
+ if (re->test_break(re->tbh)) break;
}
- for(zsample=0; zsample<samples; zsample++) {
+ for (zsample=0; zsample<samples; zsample++) {
zspan= &zspans[zsample];
MEM_freeN(zspan->arectz);
- if(zspan->rectmask)
+ if (zspan->rectmask)
MEM_freeN(zspan->rectmask);
zbuf_free_span(zspan);
}
@@ -3422,18 +3429,18 @@ static int zbuffer_abuf_render(RenderPart *pa, APixstr *APixbuf, APixstrand *APi
samples= (R.osa)? R.osa: 1;
negzmask= ((rl->layflag & SCE_LAY_ZMASK) && (rl->layflag & SCE_LAY_NEG_ZMASK));
- if(R.osa)
+ if (R.osa)
jit= R.jit;
- else if(R.i.curblur)
+ else if (R.i.curblur)
jit= &R.mblur_jit[R.i.curblur-1];
else
jit= NULL;
zbuf_make_winmat(&R, winmat);
- if(rl->layflag & SCE_LAY_ZTRA)
+ if (rl->layflag & SCE_LAY_ZTRA)
doztra+= zbuffer_abuf(&R, pa, APixbuf, apsmbase, rl->lay, negzmask, winmat, R.winx, R.winy, samples, jit, R.clipcrop, 0);
- if((rl->layflag & SCE_LAY_STRAND) && APixbufstrand)
+ if ((rl->layflag & SCE_LAY_STRAND) && APixbufstrand)
doztra+= zbuffer_strands_abuf(&R, pa, APixbufstrand, apsmbase, rl->lay, negzmask, winmat, R.winx, R.winy, samples, jit, R.clipcrop, 0, sscache);
return doztra;
@@ -3444,18 +3451,18 @@ void zbuffer_abuf_shadow(Render *re, LampRen *lar, float winmat[][4], APixstr *A
RenderPart pa;
int lay= -1;
- if(lar->mode & LA_LAYER) lay= lar->lay;
+ if (lar->mode & LA_LAYER) lay= lar->lay;
memset(&pa, 0, sizeof(RenderPart));
pa.rectx= size;
pa.recty= size;
- pa.disprect.xmin= 0;
- pa.disprect.ymin= 0;
- pa.disprect.xmax= size;
- pa.disprect.ymax= size;
+ pa.disprect.xmin = 0;
+ pa.disprect.ymin = 0;
+ pa.disprect.xmax = size;
+ pa.disprect.ymax = size;
zbuffer_abuf(re, &pa, APixbuf, apsmbase, lay, 0, winmat, size, size, samples, jit, 1.0f, 1);
- if(APixbufstrand)
+ if (APixbufstrand)
zbuffer_strands_abuf(re, &pa, APixbufstrand, apsmbase, lay, 0, winmat, size, size, samples, jit, 1.0f, 1, NULL);
}
@@ -3467,27 +3474,27 @@ void add_transp_speed(RenderLayer *rl, int offset, float *speed, float alpha, in
{
RenderPass *rpass;
- for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
- if(rpass->passtype==SCE_PASS_VECTOR) {
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
+ if (rpass->passtype==SCE_PASS_VECTOR) {
float *fp= rpass->rect + 4*offset;
- if(speed==NULL) {
+ if (speed==NULL) {
/* clear */
- if(fp[0]==PASS_VECTOR_MAX) fp[0]= 0.0f;
- if(fp[1]==PASS_VECTOR_MAX) fp[1]= 0.0f;
- if(fp[2]==PASS_VECTOR_MAX) fp[2]= 0.0f;
- if(fp[3]==PASS_VECTOR_MAX) fp[3]= 0.0f;
+ if (fp[0]==PASS_VECTOR_MAX) fp[0]= 0.0f;
+ if (fp[1]==PASS_VECTOR_MAX) fp[1]= 0.0f;
+ if (fp[2]==PASS_VECTOR_MAX) fp[2]= 0.0f;
+ if (fp[3]==PASS_VECTOR_MAX) fp[3]= 0.0f;
}
- else if(rdrect==NULL || rdrect[offset]==0 || alpha>0.95f) {
+ else if (rdrect==NULL || rdrect[offset]==0 || alpha>0.95f) {
copy_v4_v4(fp, speed);
}
else {
/* add minimum speed in pixel */
- if( (ABS(speed[0]) + ABS(speed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
+ if ( (ABS(speed[0]) + ABS(speed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
fp[0]= speed[0];
fp[1]= speed[1];
}
- if( (ABS(speed[2]) + ABS(speed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
+ if ( (ABS(speed[2]) + ABS(speed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
fp[2]= speed[2];
fp[3]= speed[3];
}
@@ -3501,8 +3508,8 @@ static void add_transp_obindex(RenderLayer *rl, int offset, Object *ob)
{
RenderPass *rpass;
- for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
- if(rpass->passtype == SCE_PASS_INDEXOB||rpass->passtype == SCE_PASS_INDEXMA) {
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
+ if (rpass->passtype == SCE_PASS_INDEXOB||rpass->passtype == SCE_PASS_INDEXMA) {
float *fp= rpass->rect + offset;
*fp= (float)ob->index;
break;
@@ -3518,7 +3525,7 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
float weight= 1.0f/((float)R.osa);
int delta= sizeof(ShadeResult)/4;
- for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
float *col= NULL;
int pixsize= 3;
@@ -3573,16 +3580,16 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
int samp;
/* add minimum speed in pixel */
- for(samp= 1; samp<R.osa; samp++, shr_t++) {
+ for (samp= 1; samp<R.osa; samp++, shr_t++) {
- if(shr_t->combined[3] > 0.0f) {
+ if (shr_t->combined[3] > 0.0f) {
float *speed= shr_t->winspeed;
- if( (ABS(speed[0]) + ABS(speed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
+ if ( (ABS(speed[0]) + ABS(speed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
fp[0]= speed[0];
fp[1]= speed[1];
}
- if( (ABS(speed[2]) + ABS(speed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
+ if ( (ABS(speed[2]) + ABS(speed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
fp[2]= speed[2];
fp[3]= speed[3];
}
@@ -3591,23 +3598,23 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
}
break;
}
- if(col) {
+ if (col) {
float *fp= col+delta;
int samp;
- for(samp= 1; samp<R.osa; samp++, fp+=delta) {
+ for (samp= 1; samp<R.osa; samp++, fp+=delta) {
col[0]+= fp[0];
- if(pixsize>1) {
+ if (pixsize>1) {
col[1]+= fp[1];
col[2]+= fp[2];
- if(pixsize==4) col[3]+= fp[3];
+ if (pixsize==4) col[3]+= fp[3];
}
}
col[0]*= weight;
- if(pixsize>1) {
+ if (pixsize>1) {
col[1]*= weight;
col[2]*= weight;
- if(pixsize==4) col[3]*= weight;
+ if (pixsize==4) col[3]*= weight;
}
}
}
@@ -3618,14 +3625,14 @@ void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alph
{
RenderPass *rpass;
- for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
float *fp, *col= NULL;
int pixsize= 3;
switch(rpass->passtype) {
case SCE_PASS_Z:
fp= rpass->rect + offset;
- if(shr->z < *fp)
+ if (shr->z < *fp)
*fp= shr->z;
break;
case SCE_PASS_RGBA:
@@ -3667,11 +3674,11 @@ void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alph
pixsize= 1;
break;
}
- if(col) {
+ if (col) {
fp= rpass->rect + pixsize*offset;
fp[0]= col[0] + (1.0f-alpha)*fp[0];
- if(pixsize==3) {
+ if (pixsize==3) {
fp[1]= col[1] + (1.0f-alpha)*fp[1];
fp[2]= col[2] + (1.0f-alpha)*fp[2];
}
@@ -3692,8 +3699,8 @@ static int vergzvlak(const void *a1, const void *a2)
{
const ZTranspRow *r1 = a1, *r2 = a2;
- if(r1->z < r2->z) return 1;
- else if(r1->z > r2->z) return -1;
+ if (r1->z < r2->z) return 1;
+ else if (r1->z > r2->z) return -1;
return 0;
}
@@ -3732,10 +3739,10 @@ static void unref_strand_samples(StrandShadeCache *cache, ZTranspRow *row, int t
/* remove references to samples that are not being rendered, but we still
* need to remove them so that the reference count of strand vertex shade
* samples correctly drops to zero */
- while(totface > 0) {
+ while (totface > 0) {
totface--;
- if(row[totface].segment != -1) {
+ if (row[totface].segment != -1) {
obi= R.objectinstance + row[totface].obi;
obr= obi->obr;
strand= RE_findOrAddStrand(obr, row[totface].p-1);
@@ -3757,18 +3764,18 @@ static void shade_tra_samples_fill(ShadeSample *ssamp, int x, int y, int z, int
shade_input_set_triangle(shi, obi, facenr, 1);
/* officially should always be true... we have no sky info */
- if(shi->vlr) {
+ if (shi->vlr) {
/* full osa is only set for OSA renders */
- if(shi->vlr->flag & R_FULL_OSA) {
+ if (shi->vlr->flag & R_FULL_OSA) {
short shi_inc= 0, samp;
- for(samp=0; samp<R.osa; samp++) {
- if(curmask & (1<<samp)) {
+ for (samp=0; samp<R.osa; samp++) {
+ if (curmask & (1<<samp)) {
xs= (float)x + R.jit[samp][0] + 0.5f; /* zbuffer has this inverse corrected, ensures xs,ys are inside pixel */
ys= (float)y + R.jit[samp][1] + 0.5f;
- if(shi_inc) {
+ if (shi_inc) {
shade_input_copy_triangle(shi+1, shi);
shi++;
}
@@ -3776,7 +3783,7 @@ static void shade_tra_samples_fill(ShadeSample *ssamp, int x, int y, int z, int
shi->samplenr= R.shadowsamplenr[shi->thread]++;
shade_input_set_viewco(shi, x, y, xs, ys, (float)z);
shade_input_set_uv(shi);
- if(shi_inc==0)
+ if (shi_inc==0)
shade_input_set_normals(shi);
else /* XXX shi->flippednor messes up otherwise */
shade_input_set_vertex_normals(shi);
@@ -3786,7 +3793,7 @@ static void shade_tra_samples_fill(ShadeSample *ssamp, int x, int y, int z, int
}
}
else {
- if(R.osa) {
+ if (R.osa) {
short b= R.samples->centmask[curmask];
xs= (float)x + R.samples->centLut[b & 15] + 0.5f;
ys= (float)y + R.samples->centLut[b>>4] + 0.5f;
@@ -3809,14 +3816,14 @@ static void shade_tra_samples_fill(ShadeSample *ssamp, int x, int y, int z, int
static int shade_tra_samples(ShadeSample *ssamp, StrandShadeCache *cache, int x, int y, ZTranspRow *row, int addpassflag)
{
- if(row->segment != -1) {
+ if (row->segment != -1) {
shade_strand_samples(cache, ssamp, x, y, row, addpassflag);
return 1;
}
shade_tra_samples_fill(ssamp, x, y, row->z, row->obi, row->p, row->mask);
- if(ssamp->tot) {
+ if (ssamp->tot) {
ShadeInput *shi= ssamp->shi;
ShadeResult *shr= ssamp->shr;
int samp;
@@ -3825,19 +3832,19 @@ static int shade_tra_samples(ShadeSample *ssamp, StrandShadeCache *cache, int x,
shade_samples_do_AO(ssamp);
/* if shade (all shadepinputs have same passflag) */
- if(shi->passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB|SCE_PASS_INDEXMA)) {
- for(samp=0; samp<ssamp->tot; samp++, shi++, shr++) {
+ if (shi->passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB|SCE_PASS_INDEXMA)) {
+ for (samp=0; samp<ssamp->tot; samp++, shi++, shr++) {
shade_input_set_shade_texco(shi);
shade_input_do_shade(shi, shr);
/* include lamphalos for ztra, since halo layer was added already */
- if(R.flag & R_LAMPHALO)
- if(shi->layflag & SCE_LAY_HALO)
+ if (R.flag & R_LAMPHALO)
+ if (shi->layflag & SCE_LAY_HALO)
renderspothalo(shi, shr->combined, shr->combined[3]);
}
}
- else if(shi->passflag & SCE_PASS_Z) {
- for(samp=0; samp<ssamp->tot; samp++, shi++, shr++)
+ else if (shi->passflag & SCE_PASS_Z) {
+ for (samp=0; samp<ssamp->tot; samp++, shi++, shr++)
shr->z= -shi->co[2];
}
@@ -3857,66 +3864,66 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf
{
int a, sample, osa = (R.osa? R.osa: 1), retval = osa;
- for(a=0; a < osa; a++, samp_shr++) {
+ for (a=0; a < osa; a++, samp_shr++) {
ShadeInput *shi= ssamp->shi;
ShadeResult *shr= ssamp->shr;
- for(sample=0; sample<ssamp->tot; sample++, shi++, shr++) {
+ for (sample=0; sample<ssamp->tot; sample++, shi++, shr++) {
- if(shi->mask & (1<<a)) {
+ if (shi->mask & (1<<a)) {
float fac= (1.0f - samp_shr->combined[3])*shr->combined[3];
addAlphaUnderFloat(samp_shr->combined, shr->combined);
samp_shr->z= MIN2(samp_shr->z, shr->z);
- if(addpassflag & SCE_PASS_VECTOR) {
+ if (addpassflag & SCE_PASS_VECTOR) {
copy_v4_v4(samp_shr->winspeed, shr->winspeed);
}
/* optim... */
- if(addpassflag & ~(SCE_PASS_VECTOR)) {
+ if (addpassflag & ~(SCE_PASS_VECTOR)) {
- if(addpassflag & SCE_PASS_RGBA)
+ if (addpassflag & SCE_PASS_RGBA)
addAlphaUnderFloat(samp_shr->col, shr->col);
- if(addpassflag & SCE_PASS_NORMAL)
+ if (addpassflag & SCE_PASS_NORMAL)
addvecmul(samp_shr->nor, shr->nor, fac);
- if(addpassflag & SCE_PASS_EMIT)
+ if (addpassflag & SCE_PASS_EMIT)
addvecmul(samp_shr->emit, shr->emit, fac);
- if(addpassflag & SCE_PASS_DIFFUSE)
+ if (addpassflag & SCE_PASS_DIFFUSE)
addvecmul(samp_shr->diff, shr->diff, fac);
- if(addpassflag & SCE_PASS_SPEC)
+ if (addpassflag & SCE_PASS_SPEC)
addvecmul(samp_shr->spec, shr->spec, fac);
- if(addpassflag & SCE_PASS_SHADOW)
+ if (addpassflag & SCE_PASS_SHADOW)
addvecmul(samp_shr->shad, shr->shad, fac);
- if(addpassflag & SCE_PASS_AO)
+ if (addpassflag & SCE_PASS_AO)
addvecmul(samp_shr->ao, shr->ao, fac);
- if(addpassflag & SCE_PASS_ENVIRONMENT)
+ if (addpassflag & SCE_PASS_ENVIRONMENT)
addvecmul(samp_shr->env, shr->env, fac);
- if(addpassflag & SCE_PASS_INDIRECT)
+ if (addpassflag & SCE_PASS_INDIRECT)
addvecmul(samp_shr->indirect, shr->indirect, fac);
- if(addpassflag & SCE_PASS_REFLECT)
+ if (addpassflag & SCE_PASS_REFLECT)
addvecmul(samp_shr->refl, shr->refl, fac);
- if(addpassflag & SCE_PASS_REFRACT)
+ if (addpassflag & SCE_PASS_REFRACT)
addvecmul(samp_shr->refr, shr->refr, fac);
- if(addpassflag & SCE_PASS_MIST)
+ if (addpassflag & SCE_PASS_MIST)
samp_shr->mist= samp_shr->mist+fac*shr->mist;
}
}
}
- if(samp_shr->combined[3]>0.999f) retval--;
+ if (samp_shr->combined[3]>0.999f) retval--;
}
return retval;
}
@@ -3929,11 +3936,11 @@ static void reset_sky_speedvectors(RenderPart *pa, RenderLayer *rl, float *rectf
int a;
fp= RE_RenderLayerGetPass(rl, SCE_PASS_VECTOR);
- if(fp==NULL) return;
+ if (fp==NULL) return;
col= rectf+3;
- for(a= 4*pa->rectx*pa->recty -4; a>=0; a-=4) {
- if(col[a]==0.0f) {
+ for (a= 4*pa->rectx*pa->recty -4; a>=0; a-=4) {
+ if (col[a]==0.0f) {
fp[a]= PASS_VECTOR_MAX;
fp[a+1]= PASS_VECTOR_MAX;
fp[a+2]= PASS_VECTOR_MAX;
@@ -3966,17 +3973,17 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
unsigned short *ztramask= NULL, filled;
/* looks nicer for calling code */
- if(R.test_break(R.tbh))
+ if (R.test_break(R.tbh))
return NULL;
- if(R.osa>16) { /* MAX_OSA */
+ if (R.osa>16) { /* MAX_OSA */
printf("zbuffer_transp_shade: osa too large\n");
G.afbreek= 1;
return NULL;
}
APixbuf= MEM_callocN(pa->rectx*pa->recty*sizeof(APixstr), "APixbuf");
- if(R.totstrand && (rl->layflag & SCE_LAY_STRAND)) {
+ if (R.totstrand && (rl->layflag & SCE_LAY_STRAND)) {
APixbufstrand= MEM_callocN(pa->rectx*pa->recty*sizeof(APixstrand), "APixbufstrand");
sscache= strand_shade_cache_create();
}
@@ -3985,7 +3992,7 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
shade_sample_initialize(&ssamp, pa, rl);
addpassflag= rl->passflag & ~(SCE_PASS_COMBINED);
- if(R.osa)
+ if (R.osa)
sampalpha= 1.0f/(float)R.osa;
else
sampalpha= 1.0f;
@@ -3993,12 +4000,12 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
/* fill the Apixbuf */
doztra= zbuffer_abuf_render(pa, APixbuf, APixbufstrand, &apsmbase, rl, sscache);
- if(doztra == 0) {
+ if (doztra == 0) {
/* nothing filled in */
MEM_freeN(APixbuf);
- if(APixbufstrand)
+ if (APixbufstrand)
MEM_freeN(APixbufstrand);
- if(sscache)
+ if (sscache)
strand_shade_cache_free(sscache);
freepsA(&apsmbase);
return NULL;
@@ -4012,20 +4019,20 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
totfullsample= get_sample_layers(pa, rl, rlpp);
/* irregular shadowb buffer creation */
- if(R.r.mode & R_SHADOW)
+ if (R.r.mode & R_SHADOW)
ISB_create(pa, APixbuf);
/* masks, to have correct alpha combine */
- if(R.osa && (rl->layflag & SCE_LAY_SOLID) && pa->fullresult.first==NULL)
+ if (R.osa && (rl->layflag & SCE_LAY_SOLID) && pa->fullresult.first==NULL)
ztramask= MEM_callocN(pa->rectx*pa->recty*sizeof(short), "ztramask");
/* zero alpha pixels get speed vector max again */
- if(addpassflag & SCE_PASS_VECTOR)
- if(rl->layflag & SCE_LAY_SOLID)
+ if (addpassflag & SCE_PASS_VECTOR)
+ if (rl->layflag & SCE_LAY_SOLID)
reset_sky_speedvectors(pa, rl, rl->acolrect?rl->acolrect:rl->rectf); /* if acolrect is set we use it */
/* filtered render, for now we assume only 1 filter size */
- if(pa->crop) {
+ if (pa->crop) {
crop= 1;
offs= pa->rectx + 1;
passrect+= 4*offs;
@@ -4034,40 +4041,40 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
}
/* init scanline updates */
- rr->renrect.ymin= 0;
- rr->renrect.ymax= -pa->crop;
+ rr->renrect.ymin = 0;
+ rr->renrect.ymax = -pa->crop;
rr->renlay= rl;
/* render the tile */
- for(y=pa->disprect.ymin+crop; y<pa->disprect.ymax-crop; y++, rr->renrect.ymax++) {
+ for (y=pa->disprect.ymin+crop; y<pa->disprect.ymax-crop; y++, rr->renrect.ymax++) {
pass= passrect;
ap= aprect;
apstrand= aprectstrand;
od= offs;
- if(R.test_break(R.tbh))
+ if (R.test_break(R.tbh))
break;
- for(x=pa->disprect.xmin+crop; x<pa->disprect.xmax-crop; x++, ap++, apstrand++, pass+=4, od++) {
+ for (x=pa->disprect.xmin+crop; x<pa->disprect.xmax-crop; x++, ap++, apstrand++, pass+=4, od++) {
- if(ap->p[0]==0 && (!APixbufstrand || apstrand->p[0]==0)) {
- if(addpassflag & SCE_PASS_VECTOR)
+ if (ap->p[0]==0 && (!APixbufstrand || apstrand->p[0]==0)) {
+ if (addpassflag & SCE_PASS_VECTOR)
add_transp_speed(rl, od, NULL, 0.0f, rdrect);
}
else {
/* sort in z */
totface= 0;
apn= ap;
- while(apn) {
- for(a=0; a<4; a++) {
- if(apn->p[a]) {
+ while (apn) {
+ for (a=0; a<4; a++) {
+ if (apn->p[a]) {
zrow[totface].obi= apn->obi[a];
zrow[totface].z= apn->z[a];
zrow[totface].p= apn->p[a];
zrow[totface].mask= apn->mask[a];
zrow[totface].segment= -1;
totface++;
- if(totface>=MAX_ZROW) totface= MAX_ZROW-1;
+ if (totface>=MAX_ZROW) totface= MAX_ZROW-1;
}
else break;
}
@@ -4075,19 +4082,19 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
}
apnstrand= (APixbufstrand)? apstrand: NULL;
- while(apnstrand) {
- for(a=0; a<4; a++) {
- if(apnstrand->p[a]) {
+ while (apnstrand) {
+ for (a=0; a<4; a++) {
+ if (apnstrand->p[a]) {
zrow[totface].obi= apnstrand->obi[a];
zrow[totface].z= apnstrand->z[a];
zrow[totface].p= apnstrand->p[a];
zrow[totface].mask= apnstrand->mask[a];
zrow[totface].segment= apnstrand->seg[a];
- if(R.osa) {
+ if (R.osa) {
totsample= 0;
- for(b=0; b<R.osa; b++)
- if(zrow[totface].mask & (1<<b))
+ for (b=0; b<R.osa; b++)
+ if (zrow[totface].mask & (1<<b))
totsample++;
}
else
@@ -4096,43 +4103,43 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
zrow[totface].u= apnstrand->u[a]/totsample;
zrow[totface].v= apnstrand->v[a]/totsample;
totface++;
- if(totface>=MAX_ZROW) totface= MAX_ZROW-1;
+ if (totface>=MAX_ZROW) totface= MAX_ZROW-1;
}
}
apnstrand= apnstrand->next;
}
- if(totface==2) {
- if(zrow[0].z < zrow[1].z) {
+ if (totface==2) {
+ if (zrow[0].z < zrow[1].z) {
SWAP(ZTranspRow, zrow[0], zrow[1]);
}
}
- else if(totface>2) {
+ else if (totface>2) {
qsort(zrow, totface, sizeof(ZTranspRow), vergzvlak);
}
/* front face does index pass for transparent, no AA or filters, but yes FSA */
- if(addpassflag & SCE_PASS_INDEXOB) {
+ if (addpassflag & SCE_PASS_INDEXOB) {
ObjectRen *obr= R.objectinstance[zrow[totface-1].obi].obr;
- if(obr->ob) {
- for(a= 0; a<totfullsample; a++)
+ if (obr->ob) {
+ for (a= 0; a<totfullsample; a++)
add_transp_obindex(rlpp[a], od, obr->ob);
}
}
- if(addpassflag & SCE_PASS_INDEXMA) {
+ if (addpassflag & SCE_PASS_INDEXMA) {
ObjectRen *obr= R.objectinstance[zrow[totface-1].obi].obr;
- if(obr->ob) {
- for(a= 0; a<totfullsample; a++)
+ if (obr->ob) {
+ for (a= 0; a<totfullsample; a++)
add_transp_obindex(rlpp[a], od, obr->ob);
}
}
/* for each mask-sample we alpha-under colors. then in end it's added using filter */
memset(samp_shr, 0, sizeof(ShadeResult)*osa);
- for(a=0; a<osa; a++) {
+ for (a=0; a<osa; a++) {
samp_shr[a].z= 10e10f;
- if(addpassflag & SCE_PASS_VECTOR) {
+ if (addpassflag & SCE_PASS_VECTOR) {
samp_shr[a].winspeed[0]= PASS_VECTOR_MAX;
samp_shr[a].winspeed[1]= PASS_VECTOR_MAX;
samp_shr[a].winspeed[2]= PASS_VECTOR_MAX;
@@ -4140,16 +4147,16 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
}
}
- if(R.osa==0) {
- while(totface>0) {
+ if (R.osa==0) {
+ while (totface>0) {
totface--;
- if(shade_tra_samples(&ssamp, sscache, x, y, &zrow[totface], addpassflag)) {
+ if (shade_tra_samples(&ssamp, sscache, x, y, &zrow[totface], addpassflag)) {
filled= addtosamp_shr(samp_shr, &ssamp, addpassflag);
addAlphaUnderFloat(pass, ssamp.shr[0].combined);
- if(filled == 0) {
- if(sscache)
+ if (filled == 0) {
+ if (sscache)
unref_strand_samples(sscache, zrow, totface);
break;
}
@@ -4157,25 +4164,25 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
}
alpha= samp_shr->combined[3];
- if(alpha!=0.0f) {
+ if (alpha!=0.0f) {
add_transp_passes(rl, od, samp_shr, alpha);
- if(addpassflag & SCE_PASS_VECTOR)
+ if (addpassflag & SCE_PASS_VECTOR)
add_transp_speed(rl, od, samp_shr->winspeed, alpha, rdrect);
}
}
else {
short *sp= (short *)(ztramask+od);
- while(totface>0) {
+ while (totface>0) {
totface--;
- if(shade_tra_samples(&ssamp, sscache, x, y, &zrow[totface], addpassflag)) {
+ if (shade_tra_samples(&ssamp, sscache, x, y, &zrow[totface], addpassflag)) {
filled= addtosamp_shr(samp_shr, &ssamp, addpassflag);
- if(ztramask)
+ if (ztramask)
*sp |= zrow[totface].mask;
- if(filled==0) {
- if(sscache)
+ if (filled==0) {
+ if (sscache)
unref_strand_samples(sscache, zrow, totface);
break;
}
@@ -4183,16 +4190,16 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
}
/* multisample buffers or filtered mask filling? */
- if(pa->fullresult.first) {
- for(a=0; a<R.osa; a++) {
+ if (pa->fullresult.first) {
+ for (a=0; a<R.osa; a++) {
alpha= samp_shr[a].combined[3];
- if(alpha!=0.0f) {
+ if (alpha!=0.0f) {
RenderLayer *rl= ssamp.rlpp[a];
addAlphaOverFloat(rl->rectf + 4*od, samp_shr[a].combined);
add_transp_passes(rl, od, &samp_shr[a], alpha);
- if(addpassflag & SCE_PASS_VECTOR)
+ if (addpassflag & SCE_PASS_VECTOR)
add_transp_speed(rl, od, samp_shr[a].winspeed, alpha, rdrect);
}
}
@@ -4201,19 +4208,19 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
alpha= 0.0f;
/* note; cannot use pass[3] for alpha due to filtermask */
- for(a=0; a<R.osa; a++) {
+ for (a=0; a<R.osa; a++) {
add_filt_fmask(1<<a, samp_shr[a].combined, pass, rr->rectx);
alpha+= samp_shr[a].combined[3];
}
- if(addpassflag) {
+ if (addpassflag) {
alpha*= sampalpha;
/* merge all in one, and then add */
merge_transp_passes(rl, samp_shr);
add_transp_passes(rl, od, samp_shr, alpha);
- if(addpassflag & SCE_PASS_VECTOR)
+ if (addpassflag & SCE_PASS_VECTOR)
add_transp_speed(rl, od, samp_shr[0].winspeed, alpha, rdrect);
}
}
@@ -4231,13 +4238,13 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
rr->renlay= NULL;
MEM_freeN(APixbuf);
- if(APixbufstrand)
+ if (APixbufstrand)
MEM_freeN(APixbufstrand);
- if(sscache)
+ if (sscache)
strand_shade_cache_free(sscache);
freepsA(&apsmbase);
- if(R.r.mode & R_SHADOW)
+ if (R.r.mode & R_SHADOW)
ISB_free(pa);
return ztramask;
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index ee84b318e04..4a46568c98c 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -137,4 +137,10 @@ if(WITH_BUILDINFO)
add_definitions(-DWITH_BUILDINFO)
endif()
+if(WIN322)
+ list(APPEND INC
+ ../../../intern/utfconv
+ )
+endif()
+
blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript
index edc56f8424c..efd404c76a8 100644
--- a/source/blender/windowmanager/SConscript
+++ b/source/blender/windowmanager/SConscript
@@ -33,6 +33,7 @@ if env['OURPLATFORM'] == 'linux':
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
+ incs += ' ../../intern/utfconv'
if env['OURPLATFORM'] != 'darwin' or env['WITH_GHOST_COCOA']:
sources.remove('intern' + os.sep + 'wm_apple.c')
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 21ea1bf909f..a794cf10a86 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -214,6 +214,9 @@ void WM_operator_properties_select_all(struct wmOperatorType *ot);
int WM_operator_check_ui_enabled(const struct bContext *C, const char *idname);
wmOperator *WM_operator_last_redo(const struct bContext *C);
+int WM_operator_last_properties_init(struct wmOperator *op);
+int WM_operator_last_properties_store(struct wmOperator *op);
+
/* MOVE THIS SOMEWHERE ELSE */
#define SEL_TOGGLE 0
#define SEL_SELECT 1
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index dbb000cef01..d6f0c490289 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -349,8 +349,8 @@ typedef struct wmEvent {
int mval[2]; /* region mouse position, name convention pre 2.5 :) */
char utf8_buf[6]; /* from, ghost if utf8 is enabled for the platform,
* BLI_str_utf8_size() must _always_ be valid, check
- * when assigning s we dont need to check on every access after */
- char ascii; /* from ghost, fallback if utf8 isnt set */
+ * when assigning s we don't need to check on every access after */
+ char ascii; /* from ghost, fallback if utf8 isn't set */
char pad;
/* previous state */
@@ -429,6 +429,8 @@ typedef struct wmTimer {
int sleep; /* internal, put timers to sleep when needed */
} wmTimer;
+/* Default context for operator names/labels. */
+#define WM_OPERATOR_DEFAULT_I18NCONTEXT "Operator"
typedef struct wmOperatorType {
const char *name; /* text for ui, undo */
@@ -465,6 +467,9 @@ typedef struct wmOperatorType {
/* rna for properties */
struct StructRNA *srna;
+ /* previous settings - for initializing on re-use */
+ struct IDProperty *last_properties;
+
/* rna property to use for generic invoke functions.
* menus, enum search... etc */
PropertyRNA *prop;
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index ea0a7388059..9fd9defc0ce 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -75,31 +75,31 @@ void WM_operator_free(wmOperator *op)
{
#ifdef WITH_PYTHON
- if(op->py_instance) {
+ if (op->py_instance) {
/* do this first in case there are any __del__ functions or
* similar that use properties */
BPY_DECREF(op->py_instance);
}
#endif
- if(op->ptr) {
+ if (op->ptr) {
op->properties= op->ptr->data;
MEM_freeN(op->ptr);
}
- if(op->properties) {
+ if (op->properties) {
IDP_FreeProperty(op->properties);
MEM_freeN(op->properties);
}
- if(op->reports && (op->reports->flag & RPT_FREE)) {
+ if (op->reports && (op->reports->flag & RPT_FREE)) {
BKE_reports_clear(op->reports);
MEM_freeN(op->reports);
}
- if(op->macro.first) {
+ if (op->macro.first) {
wmOperator *opm, *opmnext;
- for(opm= op->macro.first; opm; opm= opmnext) {
+ for (opm= op->macro.first; opm; opm= opmnext) {
opmnext = opm->next;
WM_operator_free(opm);
}
@@ -124,7 +124,7 @@ void wm_operator_register(bContext *C, wmOperator *op)
BLI_addtail(&wm->operators, op);
tot= BLI_countlist(&wm->operators);
- while(tot>MAX_OP_REGISTERED) {
+ while (tot>MAX_OP_REGISTERED) {
wmOperator *opt= wm->operators.first;
BLI_remlink(&wm->operators, opt);
WM_operator_free(opt);
@@ -141,7 +141,7 @@ void WM_operator_stack_clear(wmWindowManager *wm)
{
wmOperator *op;
- while((op= wm->operators.first)) {
+ while ((op= wm->operators.first)) {
BLI_remlink(&wm->operators, op);
WM_operator_free(op);
}
@@ -159,11 +159,11 @@ MenuType *WM_menutype_find(const char *idname, int quiet)
if (idname[0]) {
mt= BLI_ghash_lookup(menutypes_hash, idname);
- if(mt)
+ if (mt)
return mt;
}
- if(!quiet)
+ if (!quiet)
printf("search for unknown menutype %s\n", idname);
return NULL;
@@ -190,9 +190,9 @@ void WM_menutype_free(void)
{
GHashIterator *iter= BLI_ghashIterator_new(menutypes_hash);
- for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+ for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
MenuType *mt= BLI_ghashIterator_getValue(iter);
- if(mt->ext.free) {
+ if (mt->ext.free) {
mt->ext.free(mt->ext.data);
}
}
@@ -209,19 +209,19 @@ void WM_keymap_init(bContext *C)
wmWindowManager *wm= CTX_wm_manager(C);
/* create standard key configs */
- if(!wm->defaultconf)
+ if (!wm->defaultconf)
wm->defaultconf= WM_keyconfig_new(wm, "Blender");
- if(!wm->addonconf)
+ if (!wm->addonconf)
wm->addonconf= WM_keyconfig_new(wm, "Blender Addon");
- if(!wm->userconf)
+ if (!wm->userconf)
wm->userconf= WM_keyconfig_new(wm, "Blender User");
/* initialize only after python init is done, for keymaps that
* use python operators */
- if(CTX_py_init_get(C) && (wm->initialized & WM_INIT_KEYMAP) == 0) {
+ if (CTX_py_init_get(C) && (wm->initialized & WM_INIT_KEYMAP) == 0) {
/* create default key config, only initialize once,
* it's persistent across sessions */
- if(!(wm->defaultconf->flag & KEYCONF_INIT_DEFAULT)) {
+ if (!(wm->defaultconf->flag & KEYCONF_INIT_DEFAULT)) {
wm_window_keymap(wm->defaultconf);
ED_spacetypes_keymap(wm->defaultconf);
@@ -240,16 +240,16 @@ void WM_check(bContext *C)
wmWindowManager *wm= CTX_wm_manager(C);
/* wm context */
- if(wm==NULL) {
+ if (wm==NULL) {
wm= CTX_data_main(C)->wm.first;
CTX_wm_manager_set(C, wm);
}
- if(wm==NULL) return;
- if(wm->windows.first==NULL) return;
+ if (wm==NULL) return;
+ if (wm->windows.first==NULL) return;
if (!G.background) {
/* case: fileread */
- if((wm->initialized & WM_INIT_WINDOW) == 0) {
+ if ((wm->initialized & WM_INIT_WINDOW) == 0) {
WM_keymap_init(C);
WM_autosave_init(wm);
}
@@ -260,7 +260,7 @@ void WM_check(bContext *C)
/* case: fileread */
/* note: this runs in bg mode to set the screen context cb */
- if((wm->initialized & WM_INIT_WINDOW) == 0) {
+ if ((wm->initialized & WM_INIT_WINDOW) == 0) {
ED_screens_initialize(wm);
wm->initialized |= WM_INIT_WINDOW;
}
@@ -272,14 +272,14 @@ void wm_clear_default_size(bContext *C)
wmWindow *win;
/* wm context */
- if(wm==NULL) {
+ if (wm==NULL) {
wm= CTX_data_main(C)->wm.first;
CTX_wm_manager_set(C, wm);
}
- if(wm==NULL) return;
- if(wm->windows.first==NULL) return;
+ if (wm==NULL) return;
+ if (wm->windows.first==NULL) return;
- for(win= wm->windows.first; win; win= win->next) {
+ for (win= wm->windows.first; win; win= win->next) {
win->sizex = 0;
win->sizey = 0;
win->posx = 0;
@@ -314,22 +314,22 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
wmOperator *op;
wmKeyConfig *keyconf;
- if(wm->autosavetimer)
+ if (wm->autosavetimer)
wm_autosave_timer_ended(wm);
- while((win= wm->windows.first)) {
+ while ((win= wm->windows.first)) {
BLI_remlink(&wm->windows, win);
win->screen= NULL; /* prevent draw clear to use screen */
wm_draw_window_clear(win);
wm_window_free(C, wm, win);
}
- while((op= wm->operators.first)) {
+ while ((op= wm->operators.first)) {
BLI_remlink(&wm->operators, op);
WM_operator_free(op);
}
- while((keyconf=wm->keyconfigs.first)) {
+ while ((keyconf=wm->keyconfigs.first)) {
BLI_remlink(&wm->keyconfigs, keyconf);
WM_keyconfig_free(keyconf);
}
@@ -341,14 +341,14 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
wm_reports_free(wm);
- if(C && CTX_wm_manager(C)==wm) CTX_wm_manager_set(C, NULL);
+ if (C && CTX_wm_manager(C)==wm) CTX_wm_manager_set(C, NULL);
}
void wm_close_and_free_all(bContext *C, ListBase *wmlist)
{
wmWindowManager *wm;
- while((wm=wmlist->first)) {
+ while ((wm=wmlist->first)) {
wm_close_and_free(C, wm);
BLI_remlink(wmlist, wm);
MEM_freeN(wm);
@@ -357,7 +357,7 @@ void wm_close_and_free_all(bContext *C, ListBase *wmlist)
void WM_main(bContext *C)
{
- while(1) {
+ while (1) {
/* get events from ghost, handle window events, add to window queues */
wm_window_process_events(C);
diff --git a/source/blender/windowmanager/intern/wm_apple.c b/source/blender/windowmanager/intern/wm_apple.c
index 1b2a4e490a4..a79d20ff8b6 100644
--- a/source/blender/windowmanager/intern/wm_apple.c
+++ b/source/blender/windowmanager/intern/wm_apple.c
@@ -127,7 +127,8 @@ void wm_set_apple_prefsize(int scr_x, int scr_y)
WM_setprefsize(left +10,scr_y - bottom +10,right-left -20,bottom - 64);
G.windowstate= 0;
- } else {
+ }
+ else {
/* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */
WM_setprefsize(120, 40, 850, 684);
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index e35a1a269ae..2f0a118b54a 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -88,7 +88,8 @@ static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useB
cursor->big_sizex,cursor->big_sizey,
cursor->big_hotx,cursor->big_hoty,
cursor->fg_color, cursor->bg_color);
- } else {
+ }
+ else {
GHOST_SetCustomCursorShapeEx(win->ghostwin,
(GHOST_TUns8 *)cursor->small_bm, (GHOST_TUns8 *)cursor->small_mask,
cursor->small_sizex,cursor->small_sizey,
@@ -114,19 +115,19 @@ void WM_cursor_set(wmWindow *win, int curs)
#ifdef _WIN32
/* the default win32 cross cursor is barely visible,
* only 1 pixel thick, use another one instead */
- if(curs==CURSOR_EDIT)
+ if (curs==CURSOR_EDIT)
curs= BC_CROSSCURSOR;
#endif
GHOST_SetCursorVisibility(win->ghostwin, 1);
- if(curs == CURSOR_STD && win->modalcursor)
+ if (curs == CURSOR_STD && win->modalcursor)
curs= win->modalcursor;
win->cursor= curs;
/* detect if we use system cursor or Blender cursor */
- if(curs>=BC_GHOST_CURSORS) {
+ if (curs>=BC_GHOST_CURSORS) {
GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
}
else {
@@ -146,7 +147,7 @@ void WM_cursor_set(wmWindow *win, int curs)
void WM_cursor_modal(wmWindow *win, int val)
{
- if(win->lastcursor == 0)
+ if (win->lastcursor == 0)
win->lastcursor = win->cursor;
win->modalcursor = val;
WM_cursor_set(win, val);
@@ -155,7 +156,7 @@ void WM_cursor_modal(wmWindow *win, int val)
void WM_cursor_restore(wmWindow *win)
{
win->modalcursor = 0;
- if(win->lastcursor)
+ if (win->lastcursor)
WM_cursor_set(win, win->lastcursor);
win->lastcursor = 0;
}
@@ -163,14 +164,15 @@ void WM_cursor_restore(wmWindow *win)
/* to allow usage all over, we do entire WM */
void WM_cursor_wait(int val)
{
- if(!G.background) {
+ if (!G.background) {
wmWindowManager *wm= G.main->wm.first;
wmWindow *win= wm?wm->windows.first:NULL;
- for(; win; win= win->next) {
- if(val) {
+ for (; win; win= win->next) {
+ if (val) {
WM_cursor_modal(win, BC_WAITCURSOR);
- } else {
+ }
+ else {
WM_cursor_restore(win);
}
}
@@ -184,8 +186,8 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds)
* */
GHOST_TGrabCursorMode mode = GHOST_kGrabNormal;
- if(hide) mode = GHOST_kGrabHide;
- else if(wrap) mode = GHOST_kGrabWrap;
+ if (hide) mode = GHOST_kGrabHide;
+ else if (wrap) mode = GHOST_kGrabWrap;
if ((G.f & G_DEBUG) == 0) {
if (win && win->ghostwin) {
const GHOST_TabletData *tabletdata= GHOST_GetTabletData(win->ghostwin);
@@ -203,7 +205,7 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds)
void WM_cursor_ungrab(wmWindow *win)
{
if ((G.f & G_DEBUG) == 0) {
- if(win && win->ghostwin) {
+ if (win && win->ghostwin) {
GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable, NULL);
win->grabcursor = GHOST_kGrabDisable;
}
@@ -213,18 +215,21 @@ void WM_cursor_ungrab(wmWindow *win)
/* give it a modal keymap one day? */
int wm_cursor_arrow_move(wmWindow *win, wmEvent *event)
{
- if(win && event->val==KM_PRESS) {
+ if (win && event->val==KM_PRESS) {
- if(event->type==UPARROWKEY) {
+ if (event->type==UPARROWKEY) {
WM_cursor_warp(win, event->x, event->y+1);
return 1;
- } else if(event->type==DOWNARROWKEY) {
+ }
+ else if (event->type==DOWNARROWKEY) {
WM_cursor_warp(win, event->x, event->y-1);
return 1;
- } else if(event->type==LEFTARROWKEY) {
+ }
+ else if (event->type==LEFTARROWKEY) {
WM_cursor_warp(win, event->x-1, event->y);
return 1;
- } else if(event->type==RIGHTARROWKEY) {
+ }
+ else if (event->type==RIGHTARROWKEY) {
WM_cursor_warp(win, event->x+1, event->y);
return 1;
}
@@ -253,7 +258,7 @@ void WM_timecursor(wmWindow *win, int nr)
unsigned char bitmap[16][2]= {{0}};
int i, idx;
- if(win->lastcursor == 0)
+ if (win->lastcursor == 0)
win->lastcursor= win->cursor;
memset(&mask, 0xFF, sizeof(mask));
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 299266154dd..d60a97ad9bc 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -83,9 +83,9 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
{
wmDropBoxMap *dm;
- for(dm= dropboxes.first; dm; dm= dm->next)
- if(dm->spaceid==spaceid && dm->regionid==regionid)
- if(0==strncmp(idname, dm->idname, KMAP_MAX_NAME))
+ for (dm= dropboxes.first; dm; dm= dm->next)
+ if (dm->spaceid==spaceid && dm->regionid==regionid)
+ if (0==strncmp(idname, dm->idname, KMAP_MAX_NAME))
return &dm->dropboxes;
dm= MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list");
@@ -109,7 +109,7 @@ wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(bContext
drop->ot= WM_operatortype_find(idname, 0);
drop->opcontext= WM_OP_INVOKE_DEFAULT;
- if(drop->ot==NULL) {
+ if (drop->ot==NULL) {
MEM_freeN(drop);
printf("Error: dropbox with unknown operator: %s\n", idname);
return NULL;
@@ -125,11 +125,11 @@ void wm_dropbox_free(void)
{
wmDropBoxMap *dm;
- for(dm= dropboxes.first; dm; dm= dm->next) {
+ for (dm= dropboxes.first; dm; dm= dm->next) {
wmDropBox *drop;
- for(drop= dm->dropboxes.first; drop; drop= drop->next) {
- if(drop->ptr) {
+ for (drop= dm->dropboxes.first; drop; drop= drop->next) {
+ if (drop->ptr) {
WM_operator_properties_free(drop->ptr);
MEM_freeN(drop->ptr);
}
@@ -154,7 +154,7 @@ wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin,
BLI_addtail(&wm->drags, drag);
drag->icon= icon;
drag->type= type;
- if(type==WM_DRAG_PATH)
+ if (type==WM_DRAG_PATH)
BLI_strncpy(drag->path, poin, FILE_MAX);
else
drag->poin= poin;
@@ -175,11 +175,11 @@ void WM_event_drag_image(wmDrag *drag, ImBuf *imb, float scale, int sx, int sy)
static const char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag, wmEvent *event)
{
wmEventHandler *handler= handlers->first;
- for(; handler; handler= handler->next) {
- if(handler->dropboxes) {
+ for (; handler; handler= handler->next) {
+ if (handler->dropboxes) {
wmDropBox *drop= handler->dropboxes->first;
- for(; drop; drop= drop->next) {
- if(drop->poll(C, drag, event))
+ for (; drop; drop= drop->next) {
+ if (drop->poll(C, drag, event))
return drop->ot->name;
}
}
@@ -196,13 +196,13 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, wmEvent *event)
const char *name;
name= dropbox_active(C, &win->handlers, drag, event);
- if(name) return name;
+ if (name) return name;
name= dropbox_active(C, &sa->handlers, drag, event);
- if(name) return name;
+ if (name) return name;
name= dropbox_active(C, &ar->handlers, drag, event);
- if(name) return name;
+ if (name) return name;
return NULL;
}
@@ -213,19 +213,19 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, wmEvent *event)
wmWindow *win= CTX_wm_window(C);
/* for multiwin drags, we only do this if mouse inside */
- if(event->x<0 || event->y<0 || event->x>win->sizex || event->y>win->sizey)
+ if (event->x<0 || event->y<0 || event->x>win->sizex || event->y>win->sizey)
return;
drag->opname[0]= 0;
/* check buttons (XXX todo rna and value) */
- if( UI_but_active_drop_name(C) ) {
+ if ( UI_but_active_drop_name(C) ) {
strcpy(drag->opname, "Paste name");
}
else {
const char *opname= wm_dropbox_active(C, drag, event);
- if(opname) {
+ if (opname) {
BLI_strncpy(drag->opname, opname, FILE_MAX);
// WM_cursor_modal(win, CURSOR_COPY);
}
@@ -241,7 +241,7 @@ void wm_drags_check_ops(bContext *C, wmEvent *event)
wmWindowManager *wm= CTX_wm_manager(C);
wmDrag *drag;
- for(drag= wm->drags.first; drag; drag= drag->next) {
+ for (drag= wm->drags.first; drag; drag= drag->next) {
wm_drop_operator_options(C, drag, event);
}
}
@@ -279,14 +279,14 @@ static const char *wm_drag_name(wmDrag *drag)
static void drag_rect_minmax(rcti *rect, int x1, int y1, int x2, int y2)
{
- if(rect->xmin > x1)
- rect->xmin= x1;
- if(rect->xmax < x2)
- rect->xmax= x2;
- if(rect->ymin > y1)
- rect->ymin= y1;
- if(rect->ymax < y2)
- rect->ymax= y2;
+ if (rect->xmin > x1)
+ rect->xmin = x1;
+ if (rect->xmax < x2)
+ rect->xmax = x2;
+ if (rect->ymin > y1)
+ rect->ymin = y1;
+ if (rect->ymax < y2)
+ rect->ymax = y2;
}
/* called in wm_draw.c */
@@ -299,21 +299,21 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
cursorx= win->eventstate->x;
cursory= win->eventstate->y;
- if(rect) {
- rect->xmin= rect->xmax= cursorx;
- rect->ymin= rect->ymax= cursory;
+ if (rect) {
+ rect->xmin = rect->xmax = cursorx;
+ rect->ymin = rect->ymax = cursory;
}
/* XXX todo, multiline drag draws... but maybe not, more types mixed wont work well */
glEnable(GL_BLEND);
- for(drag= wm->drags.first; drag; drag= drag->next) {
+ for (drag= wm->drags.first; drag; drag= drag->next) {
/* image or icon */
- if(drag->imb) {
+ if (drag->imb) {
x= cursorx - drag->sx/2;
y= cursory - drag->sy/2;
- if(rect)
+ if (rect)
drag_rect_minmax(rect, x, y, x+drag->sx, y+drag->sy);
else {
glColor4f(1.0, 1.0, 1.0, 0.65); /* this blends texture */
@@ -325,14 +325,14 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
y= cursory - 2;
/* icons assumed to be 16 pixels */
- if(rect)
+ if (rect)
drag_rect_minmax(rect, x, y, x+16, y+16);
else
UI_icon_draw_aspect(x, y, drag->icon, 1.0, 0.8);
}
/* item name */
- if(drag->imb) {
+ if (drag->imb) {
x= cursorx - drag->sx/2;
y= cursory - drag->sy/2 - 16;
}
@@ -341,7 +341,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
y= cursory + 1;
}
- if(rect) {
+ if (rect) {
int w= UI_GetStringWidth(wm_drag_name(drag));
drag_rect_minmax(rect, x, y, x+w, y+16);
}
@@ -351,8 +351,8 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
}
/* operator name with roundbox */
- if(drag->opname[0]) {
- if(drag->imb) {
+ if (drag->opname[0]) {
+ if (drag->imb) {
x= cursorx - drag->sx/2;
y= cursory + drag->sy/2 + 4;
}
@@ -361,7 +361,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
y= cursory + 16;
}
- if(rect) {
+ if (rect) {
int w= UI_GetStringWidth(wm_drag_name(drag));
drag_rect_minmax(rect, x, y, x+w, y+16);
}
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 4751dbb87ff..588839ad18f 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -78,14 +78,14 @@ static void wm_paintcursor_draw(bContext *C, ARegion *ar)
{
wmWindowManager *wm= CTX_wm_manager(C);
- if(wm->paintcursors.first) {
+ if (wm->paintcursors.first) {
wmWindow *win= CTX_wm_window(C);
bScreen *screen= win->screen;
wmPaintCursor *pc;
- if(screen->subwinactive == ar->swinid) {
- for(pc= wm->paintcursors.first; pc; pc= pc->next) {
- if(pc->poll == NULL || pc->poll(C)) {
+ if (screen->subwinactive == ar->swinid) {
+ for (pc= wm->paintcursors.first; pc; pc= pc->next) {
+ if (pc->poll == NULL || pc->poll(C)) {
ARegion *ar_other= CTX_wm_region(C);
if (ELEM(win->grabcursor, GHOST_kGrabWrap, GHOST_kGrabHide)) {
int x = 0, y = 0;
@@ -111,13 +111,13 @@ static void wm_paintcursor_draw(bContext *C, ARegion *ar)
static void wm_area_mark_invalid_backbuf(ScrArea *sa)
{
- if(sa->spacetype == SPACE_VIEW3D)
+ if (sa->spacetype == SPACE_VIEW3D)
((View3D*)sa->spacedata.first)->flag |= V3D_INVALID_BACKBUF;
}
static int wm_area_test_invalid_backbuf(ScrArea *sa)
{
- if(sa->spacetype == SPACE_VIEW3D)
+ if (sa->spacetype == SPACE_VIEW3D)
return (((View3D*)sa->spacedata.first)->flag & V3D_INVALID_BACKBUF);
else
return 1;
@@ -125,11 +125,11 @@ static int wm_area_test_invalid_backbuf(ScrArea *sa)
static void wm_region_test_render_do_draw(ScrArea *sa, ARegion *ar)
{
- if(sa->spacetype == SPACE_VIEW3D) {
+ if (sa->spacetype == SPACE_VIEW3D) {
RegionView3D *rv3d = ar->regiondata;
RenderEngine *engine = (rv3d)? rv3d->render_engine: NULL;
- if(engine && (engine->flag & RE_ENGINE_DO_DRAW)) {
+ if (engine && (engine->flag & RE_ENGINE_DO_DRAW)) {
ar->do_draw = 1;
engine->flag &= ~RE_ENGINE_DO_DRAW;
}
@@ -146,11 +146,11 @@ static void wm_method_draw_full(bContext *C, wmWindow *win)
ARegion *ar;
/* draw area regions */
- for(sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
CTX_wm_area_set(C, sa);
- for(ar=sa->regionbase.first; ar; ar= ar->next) {
- if(ar->swinid) {
+ for (ar=sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->swinid) {
CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar);
wm_paintcursor_draw(C, ar);
@@ -167,15 +167,15 @@ static void wm_method_draw_full(bContext *C, wmWindow *win)
ED_area_overdraw(C);
/* draw overlapping regions */
- for(ar=screen->regionbase.first; ar; ar= ar->next) {
- if(ar->swinid) {
+ for (ar=screen->regionbase.first; ar; ar= ar->next) {
+ if (ar->swinid) {
CTX_wm_menu_set(C, ar);
ED_region_do_draw(C, ar);
CTX_wm_menu_set(C, NULL);
}
}
- if(screen->do_draw_gesture)
+ if (screen->do_draw_gesture)
wm_gesture_draw(win);
}
@@ -191,9 +191,9 @@ static void wm_flush_regions_down(bScreen *screen, rcti *dirty)
ScrArea *sa;
ARegion *ar;
- for(sa= screen->areabase.first; sa; sa= sa->next) {
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
- if(BLI_isect_rcti(dirty, &ar->winrct, NULL)) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (BLI_isect_rcti(dirty, &ar->winrct, NULL)) {
ar->do_draw= RGN_DRAW;
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
ar->swap= WIN_NONE_OK;
@@ -207,8 +207,8 @@ static void wm_flush_regions_up(bScreen *screen, rcti *dirty)
{
ARegion *ar;
- for(ar= screen->regionbase.first; ar; ar= ar->next) {
- if(BLI_isect_rcti(dirty, &ar->winrct, NULL)) {
+ for (ar= screen->regionbase.first; ar; ar= ar->next) {
+ if (BLI_isect_rcti(dirty, &ar->winrct, NULL)) {
ar->do_draw= RGN_DRAW;
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
ar->swap= WIN_NONE_OK;
@@ -225,58 +225,58 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
static rcti rect= {0, 0, 0, 0};
/* after backbuffer selection draw, we need to redraw */
- for(sa= screen->areabase.first; sa; sa= sa->next)
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->swinid && !wm_area_test_invalid_backbuf(sa))
+ for (sa= screen->areabase.first; sa; sa= sa->next)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
+ if (ar->swinid && !wm_area_test_invalid_backbuf(sa))
ED_region_tag_redraw(ar);
/* flush overlapping regions */
- if(screen->regionbase.first) {
+ if (screen->regionbase.first) {
/* flush redraws of area regions up to overlapping regions */
- for(sa= screen->areabase.first; sa; sa= sa->next)
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->swinid && ar->do_draw)
+ for (sa= screen->areabase.first; sa; sa= sa->next)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
+ if (ar->swinid && ar->do_draw)
wm_flush_regions_up(screen, &ar->winrct);
/* flush between overlapping regions */
- for(ar= screen->regionbase.last; ar; ar= ar->prev)
- if(ar->swinid && ar->do_draw)
+ for (ar= screen->regionbase.last; ar; ar= ar->prev)
+ if (ar->swinid && ar->do_draw)
wm_flush_regions_up(screen, &ar->winrct);
/* flush redraws of overlapping regions down to area regions */
- for(ar= screen->regionbase.last; ar; ar= ar->prev)
- if(ar->swinid && ar->do_draw)
+ for (ar= screen->regionbase.last; ar; ar= ar->prev)
+ if (ar->swinid && ar->do_draw)
wm_flush_regions_down(screen, &ar->winrct);
}
/* flush drag item */
- if(rect.xmin!=rect.xmax) {
+ if (rect.xmin!=rect.xmax) {
wm_flush_regions_down(screen, &rect);
- rect.xmin= rect.xmax = 0;
+ rect.xmin = rect.xmax = 0;
}
- if(wm->drags.first) {
+ if (wm->drags.first) {
/* doesnt draw, fills rect with boundbox */
wm_drags_draw(C, win, &rect);
}
/* draw marked area regions */
- for(sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
CTX_wm_area_set(C, sa);
- for(ar=sa->regionbase.first; ar; ar= ar->next) {
- if(ar->swinid) {
- if(ar->do_draw) {
+ for (ar=sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->swinid) {
+ if (ar->do_draw) {
CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar);
wm_paintcursor_draw(C, ar);
ED_area_overdraw_flush(sa, ar);
CTX_wm_region_set(C, NULL);
- if(exchange)
+ if (exchange)
ar->swap= WIN_FRONT_OK;
}
- else if(exchange) {
- if(ar->swap == WIN_FRONT_OK) {
+ else if (exchange) {
+ if (ar->swap == WIN_FRONT_OK) {
CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar);
wm_paintcursor_draw(C, ar);
@@ -285,9 +285,9 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
ar->swap= WIN_BOTH_OK;
}
- else if(ar->swap == WIN_BACK_OK)
+ else if (ar->swap == WIN_BACK_OK)
ar->swap= WIN_FRONT_OK;
- else if(ar->swap == WIN_BOTH_OK)
+ else if (ar->swap == WIN_BOTH_OK)
ar->swap= WIN_BOTH_OK;
}
}
@@ -298,39 +298,39 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
}
/* after area regions so we can do area 'overlay' drawing */
- if(screen->do_draw) {
+ if (screen->do_draw) {
ED_screen_draw(win);
- if(exchange)
+ if (exchange)
screen->swap= WIN_FRONT_OK;
}
- else if(exchange) {
- if(screen->swap==WIN_FRONT_OK) {
+ else if (exchange) {
+ if (screen->swap==WIN_FRONT_OK) {
ED_screen_draw(win);
screen->swap= WIN_BOTH_OK;
}
- else if(screen->swap==WIN_BACK_OK)
+ else if (screen->swap==WIN_BACK_OK)
screen->swap= WIN_FRONT_OK;
- else if(screen->swap==WIN_BOTH_OK)
+ else if (screen->swap==WIN_BOTH_OK)
screen->swap= WIN_BOTH_OK;
}
ED_area_overdraw(C);
/* draw marked overlapping regions */
- for(ar=screen->regionbase.first; ar; ar= ar->next) {
- if(ar->swinid && ar->do_draw) {
+ for (ar=screen->regionbase.first; ar; ar= ar->next) {
+ if (ar->swinid && ar->do_draw) {
CTX_wm_menu_set(C, ar);
ED_region_do_draw(C, ar);
CTX_wm_menu_set(C, NULL);
}
}
- if(screen->do_draw_gesture)
+ if (screen->do_draw_gesture)
wm_gesture_draw(win);
/* needs pixel coords in screen */
- if(wm->drags.first) {
+ if (wm->drags.first) {
wm_drags_draw(C, win, NULL);
}
}
@@ -368,13 +368,13 @@ static void split_width(int x, int n, int *splitx, int *nx)
int a, newnx, waste;
/* if already power of two just use it */
- if(is_power_of_2_i(x)) {
+ if (is_power_of_2_i(x)) {
splitx[0]= x;
(*nx)++;
return;
}
- if(n == 1) {
+ if (n == 1) {
/* last part, we have to go larger */
splitx[0]= power_of_2_max_i(x);
(*nx)++;
@@ -385,12 +385,12 @@ static void split_width(int x, int n, int *splitx, int *nx)
newnx= ++(*nx);
split_width(x-splitx[0], n-1, splitx+1, &newnx);
- for(waste=0, a=0; a<n; a++)
+ for (waste=0, a=0; a<n; a++)
waste += splitx[a];
/* if we waste more space or use the same amount,
* revert deeper splits and just use larger */
- if(waste >= power_of_2_max_i(x)) {
+ if (waste >= power_of_2_max_i(x)) {
splitx[0]= power_of_2_max_i(x);
memset(splitx+1, 0, sizeof(int)*(n-1));
}
@@ -401,7 +401,7 @@ static void split_width(int x, int n, int *splitx, int *nx)
static void wm_draw_triple_free(wmWindow *win)
{
- if(win->drawdata) {
+ if (win->drawdata) {
wmDrawTriple *triple= win->drawdata;
glDeleteTextures(triple->nx*triple->ny, triple->bind);
@@ -426,14 +426,14 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
int x, y;
/* compute texture sizes */
- if(GLEW_ARB_texture_rectangle || GLEW_NV_texture_rectangle || GLEW_EXT_texture_rectangle) {
+ if (GLEW_ARB_texture_rectangle || GLEW_NV_texture_rectangle || GLEW_EXT_texture_rectangle) {
triple->target= GL_TEXTURE_RECTANGLE_ARB;
triple->nx= 1;
triple->ny= 1;
triple->x[0]= win->sizex;
triple->y[0]= win->sizey;
}
- else if(GPU_non_power_of_two_support()) {
+ else if (GPU_non_power_of_two_support()) {
triple->target= GL_TEXTURE_2D;
triple->nx= 1;
triple->ny= 1;
@@ -451,19 +451,19 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
/* generate texture names */
glGenTextures(triple->nx*triple->ny, triple->bind);
- if(!triple->bind[0]) {
+ if (!triple->bind[0]) {
/* not the typical failure case but we handle it anyway */
printf("WM: failed to allocate texture for triple buffer drawing (glGenTextures).\n");
return 0;
}
- for(y=0; y<triple->ny; y++) {
- for(x=0; x<triple->nx; x++) {
+ for (y=0; y<triple->ny; y++) {
+ for (x=0; x<triple->nx; x++) {
/* proxy texture is only guaranteed to test for the cases that
* there is only one texture in use, which may not be the case */
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
- if(triple->x[x] > maxsize || triple->y[y] > maxsize) {
+ if (triple->x[x] > maxsize || triple->y[y] > maxsize) {
glBindTexture(triple->target, 0);
printf("WM: failed to allocate texture for triple buffer drawing "
"(texture too large for graphics card).\n");
@@ -480,7 +480,7 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
glBindTexture(triple->target, 0);
/* not sure if this works everywhere .. */
- if(glGetError() == GL_OUT_OF_MEMORY) {
+ if (glGetError() == GL_OUT_OF_MEMORY) {
printf("WM: failed to allocate texture for triple buffer drawing (out of memory).\n");
return 0;
}
@@ -497,8 +497,8 @@ static void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple)
glEnable(triple->target);
- for(y=0, offy=0; y<triple->ny; offy+=triple->y[y], y++) {
- for(x=0, offx=0; x<triple->nx; offx+=triple->x[x], x++) {
+ for (y=0, offy=0; y<triple->ny; offy+=triple->y[y], y++) {
+ for (x=0, offx=0; x<triple->nx; offx+=triple->x[x], x++) {
sizex= (x == triple->nx-1)? win->sizex-offx: triple->x[x];
sizey= (y == triple->ny-1)? win->sizey-offy: triple->y[y];
@@ -509,7 +509,7 @@ static void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple)
halfy= 0.375f;
/* texture rectangle has unnormalized coordinates */
- if(triple->target == GL_TEXTURE_2D) {
+ if (triple->target == GL_TEXTURE_2D) {
ratiox /= triple->x[x];
ratioy /= triple->y[y];
halfx /= triple->x[x];
@@ -543,8 +543,8 @@ static void wm_triple_copy_textures(wmWindow *win, wmDrawTriple *triple)
{
int x, y, sizex, sizey, offx, offy;
- for(y=0, offy=0; y<triple->ny; offy+=triple->y[y], y++) {
- for(x=0, offx=0; x<triple->nx; offx+=triple->x[x], x++) {
+ for (y=0, offy=0; y<triple->ny; offy+=triple->y[y], y++) {
+ for (x=0, offx=0; x<triple->nx; offx+=triple->x[x], x++) {
sizex= (x == triple->nx-1)? win->sizex-offx: triple->x[x];
sizey= (y == triple->ny-1)? win->sizey-offy: triple->y[y];
@@ -565,7 +565,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
ARegion *ar;
int copytex= 0, paintcursor= 1;
- if(win->drawdata) {
+ if (win->drawdata) {
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
@@ -576,7 +576,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
else {
win->drawdata= MEM_callocN(sizeof(wmDrawTriple), "wmDrawTriple");
- if(!wm_triple_gen_textures(win, win->drawdata)) {
+ if (!wm_triple_gen_textures(win, win->drawdata)) {
wm_draw_triple_fail(C, win);
return;
}
@@ -585,11 +585,11 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
triple= win->drawdata;
/* draw marked area regions */
- for(sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
CTX_wm_area_set(C, sa);
- for(ar=sa->regionbase.first; ar; ar= ar->next) {
- if(ar->swinid && ar->do_draw) {
+ for (ar=sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->swinid && ar->do_draw) {
CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar);
ED_area_overdraw_flush(sa, ar);
@@ -602,7 +602,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
CTX_wm_area_set(C, NULL);
}
- if(copytex) {
+ if (copytex) {
wmSubWindowSet(win, screen->mainwin);
ED_area_overdraw(C);
@@ -613,8 +613,8 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
ED_screen_draw(win);
/* draw overlapping regions */
- for(ar=screen->regionbase.first; ar; ar= ar->next) {
- if(ar->swinid) {
+ for (ar=screen->regionbase.first; ar; ar= ar->next) {
+ if (ar->swinid) {
CTX_wm_menu_set(C, ar);
ED_region_do_draw(C, ar);
CTX_wm_menu_set(C, NULL);
@@ -624,13 +624,13 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
}
/* always draw, not only when screen tagged */
- if(win->gesture.first)
+ if (win->gesture.first)
wm_gesture_draw(win);
- if(paintcursor && wm->paintcursors.first) {
- for(sa= screen->areabase.first; sa; sa= sa->next) {
- for(ar=sa->regionbase.first; ar; ar= ar->next) {
- if(ar->swinid == screen->subwinactive) {
+ if (paintcursor && wm->paintcursors.first) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (ar=sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->swinid == screen->subwinactive) {
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
@@ -648,7 +648,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
}
/* needs pixel coords in screen */
- if(wm->drags.first) {
+ if (wm->drags.first) {
wm_drags_draw(C, win, NULL);
}
@@ -663,36 +663,36 @@ static int wm_draw_update_test_window(wmWindow *win)
ARegion *ar;
int do_draw= 0;
- for(ar= win->screen->regionbase.first; ar; ar= ar->next) {
- if(ar->do_draw_overlay) {
+ for (ar= win->screen->regionbase.first; ar; ar= ar->next) {
+ if (ar->do_draw_overlay) {
wm_tag_redraw_overlay(win, ar);
ar->do_draw_overlay= 0;
}
- if(ar->swinid && ar->do_draw)
+ if (ar->swinid && ar->do_draw)
do_draw= 1;
}
- for(sa= win->screen->areabase.first; sa; sa= sa->next) {
- for(ar=sa->regionbase.first; ar; ar= ar->next) {
+ for (sa= win->screen->areabase.first; sa; sa= sa->next) {
+ for (ar=sa->regionbase.first; ar; ar= ar->next) {
wm_region_test_render_do_draw(sa, ar);
- if(ar->swinid && ar->do_draw)
+ if (ar->swinid && ar->do_draw)
do_draw = 1;
}
}
- if(do_draw)
+ if (do_draw)
return 1;
- if(win->screen->do_refresh)
+ if (win->screen->do_refresh)
return 1;
- if(win->screen->do_draw)
+ if (win->screen->do_draw)
return 1;
- if(win->screen->do_draw_gesture)
+ if (win->screen->do_draw_gesture)
return 1;
- if(win->screen->do_draw_paintcursor)
+ if (win->screen->do_draw_paintcursor)
return 1;
- if(win->screen->do_draw_drag)
+ if (win->screen->do_draw_drag)
return 1;
return 0;
@@ -705,24 +705,24 @@ static int wm_automatic_draw_method(wmWindow *win)
* for sculpting or drawing overlapping menus. For typically lower end cards
* copy to texture is slow though and so we use overlap instead there. */
- if(win->drawmethod == USER_DRAW_AUTOMATIC) {
+ if (win->drawmethod == USER_DRAW_AUTOMATIC) {
/* ATI opensource driver is known to be very slow at this */
- if(GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE))
+ if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE))
return USER_DRAW_OVERLAP;
/* also Intel drivers are slow */
- else if(GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_UNIX, GPU_DRIVER_ANY))
+ else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_UNIX, GPU_DRIVER_ANY))
return USER_DRAW_OVERLAP;
- else if(GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_WIN, GPU_DRIVER_ANY))
+ else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_WIN, GPU_DRIVER_ANY))
return USER_DRAW_OVERLAP_FLIP;
- else if(GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_ANY))
+ else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_ANY))
return USER_DRAW_OVERLAP_FLIP;
/* Windows software driver darkens color on each redraw */
- else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE))
+ else if (GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE))
return USER_DRAW_OVERLAP_FLIP;
- else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_UNIX, GPU_DRIVER_SOFTWARE))
+ else if (GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_UNIX, GPU_DRIVER_SOFTWARE))
return USER_DRAW_OVERLAP;
/* drawing lower color depth again degrades colors each time */
- else if(GPU_color_depth() < 24)
+ else if (GPU_color_depth() < 24)
return USER_DRAW_OVERLAP;
else
return USER_DRAW_TRIPLE;
@@ -734,8 +734,8 @@ static int wm_automatic_draw_method(wmWindow *win)
void wm_tag_redraw_overlay(wmWindow *win, ARegion *ar)
{
/* for draw triple gestures, paint cursors don't need region redraw */
- if(ar && win) {
- if(wm_automatic_draw_method(win) != USER_DRAW_TRIPLE)
+ if (ar && win) {
+ if (wm_automatic_draw_method(win) != USER_DRAW_TRIPLE)
ED_region_tag_redraw(ar);
win->screen->do_draw_paintcursor= 1;
}
@@ -749,33 +749,33 @@ void wm_draw_update(bContext *C)
GPU_free_unused_buffers();
- for(win= wm->windows.first; win; win= win->next) {
- if(win->drawmethod != U.wmdrawmethod) {
+ for (win= wm->windows.first; win; win= win->next) {
+ if (win->drawmethod != U.wmdrawmethod) {
wm_draw_window_clear(win);
win->drawmethod= U.wmdrawmethod;
}
- if(wm_draw_update_test_window(win)) {
+ if (wm_draw_update_test_window(win)) {
CTX_wm_window_set(C, win);
/* sets context window+screen */
wm_window_make_drawable(C, win);
/* notifiers for screen redraw */
- if(win->screen->do_refresh)
+ if (win->screen->do_refresh)
ED_screen_refresh(wm, win);
drawmethod= wm_automatic_draw_method(win);
- if(win->drawfail)
+ if (win->drawfail)
wm_method_draw_overlap_all(C, win, 0);
- else if(drawmethod == USER_DRAW_FULL)
+ else if (drawmethod == USER_DRAW_FULL)
wm_method_draw_full(C, win);
- else if(drawmethod == USER_DRAW_OVERLAP)
+ else if (drawmethod == USER_DRAW_OVERLAP)
wm_method_draw_overlap_all(C, win, 0);
- else if(drawmethod == USER_DRAW_OVERLAP_FLIP)
+ else if (drawmethod == USER_DRAW_OVERLAP_FLIP)
wm_method_draw_overlap_all(C, win, 1);
- else // if(drawmethod == USER_DRAW_TRIPLE)
+ else // if (drawmethod == USER_DRAW_TRIPLE)
wm_method_draw_triple(C, win);
win->screen->do_draw_gesture= 0;
@@ -796,13 +796,13 @@ void wm_draw_window_clear(wmWindow *win)
ARegion *ar;
int drawmethod= wm_automatic_draw_method(win);
- if(drawmethod == USER_DRAW_TRIPLE)
+ if (drawmethod == USER_DRAW_TRIPLE)
wm_draw_triple_free(win);
/* clear screen swap flags */
- if(screen) {
- for(sa= screen->areabase.first; sa; sa= sa->next)
- for(ar=sa->regionbase.first; ar; ar= ar->next)
+ if (screen) {
+ for (sa= screen->areabase.first; sa; sa= sa->next)
+ for (ar=sa->regionbase.first; ar; ar= ar->next)
ar->swap= WIN_NONE_OK;
screen->swap= WIN_NONE_OK;
@@ -813,7 +813,7 @@ void wm_draw_region_clear(wmWindow *win, ARegion *ar)
{
int drawmethod= wm_automatic_draw_method(win);
- if(ELEM(drawmethod, USER_DRAW_OVERLAP, USER_DRAW_OVERLAP_FLIP))
+ if (ELEM(drawmethod, USER_DRAW_OVERLAP, USER_DRAW_OVERLAP_FLIP))
wm_flush_regions_down(win->screen, &ar->winrct);
win->screen->do_draw= 1;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index e15ed7b8929..fb5a531cc38 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -97,10 +97,10 @@ void wm_event_add(wmWindow *win, wmEvent *event_to_add)
void wm_event_free(wmEvent *event)
{
- if(event->customdata) {
- if(event->customdatafree) {
+ if (event->customdata) {
+ if (event->customdatafree) {
/* note: pointer to listbase struct elsewhere */
- if(event->custom==EVT_DATA_LISTBASE)
+ if (event->custom==EVT_DATA_LISTBASE)
BLI_freelistN(event->customdata);
else
MEM_freeN(event->customdata);
@@ -113,7 +113,7 @@ void wm_event_free_all(wmWindow *win)
{
wmEvent *event;
- while((event= win->queue.first)) {
+ while ((event= win->queue.first)) {
BLI_remlink(&win->queue, event);
wm_event_free(event);
}
@@ -125,8 +125,8 @@ static int wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, vo
{
wmNotifier *note;
- for(note=wm->queue.first; note; note=note->next)
- if((note->category|note->data|note->subtype|note->action) == type && note->reference == reference)
+ for (note=wm->queue.first; note; note=note->next)
+ if ((note->category|note->data|note->subtype|note->action) == type && note->reference == reference)
return 1;
return 0;
@@ -142,7 +142,7 @@ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference
note->window= CTX_wm_window(C);
- if(CTX_wm_region(C))
+ if (CTX_wm_region(C))
note->swinid= CTX_wm_region(C)->swinid;
note->category= type & NOTE_CATEGORY;
@@ -158,7 +158,7 @@ void WM_main_add_notifier(unsigned int type, void *reference)
Main *bmain= G.main;
wmWindowManager *wm= bmain->wm.first;
- if(wm && !wm_test_duplicate_notifier(wm, type, reference)) {
+ if (wm && !wm_test_duplicate_notifier(wm, type, reference)) {
wmNotifier *note= MEM_callocN(sizeof(wmNotifier), "notifier");
note->wm= wm;
@@ -177,7 +177,7 @@ static wmNotifier *wm_notifier_next(wmWindowManager *wm)
{
wmNotifier *note= wm->queue.first;
- if(note) BLI_remlink(&wm->queue, note);
+ if (note) BLI_remlink(&wm->queue, note);
return note;
}
@@ -189,36 +189,36 @@ void wm_event_do_notifiers(bContext *C)
wmWindow *win;
uint64_t win_combine_v3d_datamask= 0;
- if(wm==NULL)
+ if (wm==NULL)
return;
/* cache & catch WM level notifiers, such as frame change, scene/screen set */
- for(win= wm->windows.first; win; win= win->next) {
+ for (win= wm->windows.first; win; win= win->next) {
int do_anim= 0;
CTX_wm_window_set(C, win);
- for(note= wm->queue.first; note; note= next) {
+ for (note= wm->queue.first; note; note= next) {
next= note->next;
- if(note->category==NC_WM) {
- if( ELEM(note->data, ND_FILEREAD, ND_FILESAVE)) {
+ if (note->category==NC_WM) {
+ if ( ELEM(note->data, ND_FILEREAD, ND_FILESAVE)) {
wm->file_saved= 1;
wm_window_title(wm, win);
}
- else if(note->data==ND_DATACHANGED)
+ else if (note->data==ND_DATACHANGED)
wm_window_title(wm, win);
}
- if(note->window==win) {
- if(note->category==NC_SCREEN) {
- if(note->data==ND_SCREENBROWSE) {
+ if (note->window==win) {
+ if (note->category==NC_SCREEN) {
+ if (note->data==ND_SCREENBROWSE) {
ED_screen_set(C, note->reference); // XXX hrms, think this over!
- if(G.f & G_DEBUG)
+ if (G.f & G_DEBUG)
printf("screen set %p\n", note->reference);
}
- else if(note->data==ND_SCREENDELETE) {
+ else if (note->data==ND_SCREENDELETE) {
ED_screen_delete(C, note->reference); // XXX hrms, think this over!
- if(G.f & G_DEBUG)
+ if (G.f & G_DEBUG)
printf("screen delete %p\n", note->reference);
}
}
@@ -227,22 +227,22 @@ void wm_event_do_notifiers(bContext *C)
if (note->window == win ||
(note->window == NULL && (note->reference == NULL || note->reference == CTX_data_scene(C))))
{
- if(note->category==NC_SCENE) {
- if(note->data==ND_FRAME)
+ if (note->category==NC_SCENE) {
+ if (note->data==ND_FRAME)
do_anim= 1;
}
}
- if(ELEM5(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_SCENE, NC_WM)) {
+ if (ELEM5(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_SCENE, NC_WM)) {
ED_info_stats_clear(CTX_data_scene(C));
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO, NULL);
}
}
- if(do_anim) {
+ if (do_anim) {
/* XXX, quick frame changes can cause a crash if framechange and rendering
* collide (happens on slow scenes), scene_update_for_newframe can be called
* twice which can depgraph update the same object at once */
- if(!G.rendering) {
+ if (!G.rendering) {
/* depsgraph gets called, might send more notifiers */
ED_update_for_newframe(CTX_data_main(C), win->screen->scene, win->screen, 1);
@@ -251,12 +251,12 @@ void wm_event_do_notifiers(bContext *C)
}
/* the notifiers are sent without context, to keep it clean */
- while( (note=wm_notifier_next(wm)) ) {
- for(win= wm->windows.first; win; win= win->next) {
+ while ( (note=wm_notifier_next(wm)) ) {
+ for (win= wm->windows.first; win; win= win->next) {
/* filter out notifiers */
- if(note->category==NC_SCREEN && note->reference && note->reference!=win->screen);
- else if(note->category==NC_SCENE && note->reference && note->reference!=win->screen->scene);
+ if (note->category==NC_SCREEN && note->reference && note->reference!=win->screen);
+ else if (note->category==NC_SCENE && note->reference && note->reference!=win->screen->scene);
else {
ScrArea *sa;
ARegion *ar;
@@ -267,13 +267,13 @@ void wm_event_do_notifiers(bContext *C)
/* printf("notifier win %d screen %s cat %x\n", win->winid, win->screen->id.name+2, note->category); */
ED_screen_do_listen(C, note);
- for(ar=win->screen->regionbase.first; ar; ar= ar->next) {
+ for (ar=win->screen->regionbase.first; ar; ar= ar->next) {
ED_region_do_listen(ar, note);
}
- for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+ for (sa= win->screen->areabase.first; sa; sa= sa->next) {
ED_area_do_listen(sa, note);
- for(ar=sa->regionbase.first; ar; ar= ar->next) {
+ for (ar=sa->regionbase.first; ar; ar= ar->next) {
ED_region_do_listen(ar, note);
}
}
@@ -284,24 +284,24 @@ void wm_event_do_notifiers(bContext *C)
}
/* combine datamasks so 1 win doesn't disable UV's in another [#26448] */
- for(win= wm->windows.first; win; win= win->next) {
+ for (win= wm->windows.first; win; win= win->next) {
win_combine_v3d_datamask |= ED_view3d_screen_datamask(win->screen);
}
/* cached: editor refresh callbacks now, they get context */
- for(win= wm->windows.first; win; win= win->next) {
+ for (win= wm->windows.first; win; win= win->next) {
ScrArea *sa;
CTX_wm_window_set(C, win);
- for(sa= win->screen->areabase.first; sa; sa= sa->next) {
- if(sa->do_refresh) {
+ for (sa= win->screen->areabase.first; sa; sa= sa->next) {
+ if (sa->do_refresh) {
CTX_wm_area_set(C, sa);
ED_area_do_refresh(C, sa);
}
}
/* XXX make lock in future, or separated derivedmesh users in scene */
- if(!G.rendering) {
+ if (!G.rendering) {
/* depsgraph & animation: update tagged datablocks */
Main *bmain = CTX_data_main(C);
@@ -337,22 +337,22 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *eve
/* UI is quite aggressive with swallowing events, like scrollwheel */
/* I realize this is not extremely nice code... when UI gets keymaps it can be maybe smarter */
- if(do_wheel_ui==0) {
- if(is_wheel)
+ if (do_wheel_ui==0) {
+ if (is_wheel)
return WM_HANDLER_CONTINUE;
- else if(wm_event_always_pass(event)==0)
+ else if (wm_event_always_pass(event)==0)
do_wheel_ui= 1;
}
/* we set context to where ui handler came from */
- if(handler->ui_area) CTX_wm_area_set(C, handler->ui_area);
- if(handler->ui_region) CTX_wm_region_set(C, handler->ui_region);
- if(handler->ui_menu) CTX_wm_menu_set(C, handler->ui_menu);
+ if (handler->ui_area) CTX_wm_area_set(C, handler->ui_area);
+ if (handler->ui_region) CTX_wm_region_set(C, handler->ui_region);
+ if (handler->ui_menu) CTX_wm_menu_set(C, handler->ui_menu);
retval= handler->ui_handle(C, event, handler->ui_userdata);
/* putting back screen context */
- if((retval != WM_UI_HANDLER_BREAK) || always_pass) {
+ if ((retval != WM_UI_HANDLER_BREAK) || always_pass) {
CTX_wm_area_set(C, area);
CTX_wm_region_set(C, region);
CTX_wm_menu_set(C, menu);
@@ -364,11 +364,11 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *eve
CTX_wm_menu_set(C, NULL);
}
- if(retval == WM_UI_HANDLER_BREAK)
+ if (retval == WM_UI_HANDLER_BREAK)
return WM_HANDLER_BREAK;
/* event not handled in UI, if wheel then we temporarily disable it */
- if(is_wheel)
+ if (is_wheel)
do_wheel_ui= 0;
return WM_HANDLER_CONTINUE;
@@ -380,13 +380,13 @@ static void wm_handler_ui_cancel(bContext *C)
ARegion *ar= CTX_wm_region(C);
wmEventHandler *handler, *nexthandler;
- if(!ar)
+ if (!ar)
return;
- for(handler= ar->handlers.first; handler; handler= nexthandler) {
+ for (handler= ar->handlers.first; handler; handler= nexthandler) {
nexthandler= handler->next;
- if(handler->ui_handle) {
+ if (handler->ui_handle) {
wmEvent event= *(win->eventstate);
event.type= EVT_BUT_CANCEL;
handler->ui_handle(C, &event, handler->ui_userdata);
@@ -400,17 +400,17 @@ int WM_operator_poll(bContext *C, wmOperatorType *ot)
{
wmOperatorTypeMacro *otmacro;
- for(otmacro= ot->macro.first; otmacro; otmacro= otmacro->next) {
+ for (otmacro= ot->macro.first; otmacro; otmacro= otmacro->next) {
wmOperatorType *ot_macro= WM_operatortype_find(otmacro->idname, 0);
- if(0==WM_operator_poll(C, ot_macro))
+ if (0==WM_operator_poll(C, ot_macro))
return 0;
}
/* python needs operator type, so we added exception for it */
- if(ot->pyop_poll)
+ if (ot->pyop_poll)
return ot->pyop_poll(C, ot);
- else if(ot->poll)
+ else if (ot->poll)
return ot->poll(C);
return 1;
@@ -435,7 +435,7 @@ static void wm_operator_print(bContext *C, wmOperator *op)
void WM_event_print(wmEvent *event)
{
- if(event) {
+ if (event) {
const char *unknown= "UNKNOWN";
const char *type_id= unknown;
const char *val_id= unknown;
@@ -464,13 +464,13 @@ void WM_event_print(wmEvent *event)
static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int caller_owns_reports)
{
if (caller_owns_reports == FALSE) { /* popup */
- if(op->reports->list.first) {
+ if (op->reports->list.first) {
/* FIXME, temp setting window, see other call to uiPupMenuReports for why */
wmWindow *win_prev= CTX_wm_window(C);
ScrArea *area_prev= CTX_wm_area(C);
ARegion *ar_prev= CTX_wm_region(C);
- if(win_prev==NULL)
+ if (win_prev==NULL)
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
uiPupMenuReports(C, op->reports);
@@ -481,8 +481,8 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int cal
}
}
- if(retval & OPERATOR_FINISHED) {
- if(G.f & G_DEBUG) {
+ if (retval & OPERATOR_FINISHED) {
+ if (G.f & G_DEBUG) {
/* todo - this print may double up, might want to check more flags then the FINISHED */
wm_operator_print(C, op);
}
@@ -492,7 +492,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int cal
}
if (op->type->flag & OPTYPE_REGISTER) {
- if(G.background == 0) { /* ends up printing these in the terminal, gets annoying */
+ if (G.background == 0) { /* ends up printing these in the terminal, gets annoying */
/* Report the python string representation of the operator */
char *buf = WM_operator_pystring(C, op->type, op->ptr, 1);
BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf);
@@ -539,18 +539,18 @@ static void wm_operator_finished(bContext *C, wmOperator *op, int repeat)
/* we don't want to do undo pushes for operators that are being
* called from operators that already do an undo push. usually
* this will happen for python operators that call C operators */
- if(wm->op_undo_depth == 0)
- if(op->type->flag & OPTYPE_UNDO)
+ if (wm->op_undo_depth == 0)
+ if (op->type->flag & OPTYPE_UNDO)
ED_undo_push_op(C, op);
- if(repeat==0) {
- if(G.f & G_DEBUG) {
+ if (repeat==0) {
+ if (G.f & G_DEBUG) {
char *buf = WM_operator_pystring(C, op->type, op->ptr, 1);
BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf);
MEM_freeN(buf);
}
- if(wm_operator_register_check(wm, op->type))
+ if (wm_operator_register_check(wm, op->type))
wm_operator_register(C, op);
else
WM_operator_free(op);
@@ -565,30 +565,37 @@ static int wm_operator_exec(bContext *C, wmOperator *op, int repeat)
CTX_wm_operator_poll_msg_set(C, NULL);
- if(op==NULL || op->type==NULL)
+ if (op==NULL || op->type==NULL)
return retval;
- if(0==WM_operator_poll(C, op->type))
+ if (0==WM_operator_poll(C, op->type))
return retval;
- if(op->type->exec) {
- if(op->type->flag & OPTYPE_UNDO)
+ if (op->type->exec) {
+ if (op->type->flag & OPTYPE_UNDO)
wm->op_undo_depth++;
retval= op->type->exec(C, op);
OPERATOR_RETVAL_CHECK(retval);
- if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+ if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
wm->op_undo_depth--;
}
if (retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED) && repeat == 0)
wm_operator_reports(C, op, retval, FALSE);
- if(retval & OPERATOR_FINISHED)
+ if (retval & OPERATOR_FINISHED) {
+ if (repeat) {
+ if (wm->op_undo_depth == 0) { /* not called by py script */
+ WM_operator_last_properties_store(op);
+ }
+ }
wm_operator_finished(C, op, repeat);
- else if(repeat==0)
+ }
+ else if (repeat==0) {
WM_operator_free(op);
+ }
return retval | OPERATOR_HANDLED;
@@ -599,7 +606,7 @@ static int wm_operator_exec_notest(bContext *C, wmOperator *op)
{
int retval= OPERATOR_CANCELLED;
- if(op==NULL || op->type==NULL || op->type->exec==NULL)
+ if (op==NULL || op->type==NULL || op->type->exec==NULL)
return retval;
retval= op->type->exec(C, op);
@@ -649,7 +656,7 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P
/* initialize properties, either copy or create */
op->ptr= MEM_callocN(sizeof(PointerRNA), "wmOperatorPtrRNA");
- if(properties && properties->data) {
+ if (properties && properties->data) {
op->properties= IDP_CopyProperty(properties->data);
}
else {
@@ -668,13 +675,13 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P
}
/* recursive filling of operator macro list */
- if(ot->macro.first) {
+ if (ot->macro.first) {
static wmOperator *motherop= NULL;
wmOperatorTypeMacro *otmacro;
int root = 0;
/* ensure all ops are in execution order in 1 list */
- if(motherop==NULL) {
+ if (motherop==NULL) {
motherop = op;
root = 1;
}
@@ -704,7 +711,8 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P
}
}
RNA_STRUCT_END;
- } else {
+ }
+ else {
for (otmacro = ot->macro.first; otmacro; otmacro = otmacro->next) {
wmOperatorType *otm= WM_operatortype_find(otmacro->idname, 0);
wmOperator *opm= wm_operator_create(wm, otm, otmacro->ptr, NULL);
@@ -726,7 +734,7 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P
static void wm_region_mouse_co(bContext *C, wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
- if(ar) {
+ if (ar) {
/* compatibility convention */
event->mval[0]= event->x - ar->winrct.xmin;
event->mval[1]= event->y - ar->winrct.ymin;
@@ -738,29 +746,24 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event)
}
}
-static int wm_operator_init_from_last(wmWindowManager *wm, wmOperator *op)
+int WM_operator_last_properties_init(wmOperator *op)
{
int change= FALSE;
- wmOperator *lastop;
-
- for(lastop= wm->operators.last; lastop; lastop= lastop->prev) {
- /* equality check is a bit paranoid but just in case */
- if((op != lastop) && (op->type == (lastop->type))) {
- break;
- }
- }
- if (lastop && op != lastop) {
+ if (op->type->last_properties) {
PropertyRNA *iterprop;
- iterprop= RNA_struct_iterator_property(op->type->srna);
+
+ if (G.f & G_DEBUG) printf("%s: loading previous properties for '%s'\n", __func__, op->type->idname);
+
+ iterprop = RNA_struct_iterator_property(op->type->srna);
RNA_PROP_BEGIN(op->ptr, itemptr, iterprop) {
PropertyRNA *prop= itemptr.data;
- if((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
+ if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
if (!RNA_property_is_set(op->ptr, prop)) { /* don't override a setting already set */
const char *identifier= RNA_property_identifier(prop);
- IDProperty *idp_src= IDP_GetPropertyFromGroup(lastop->properties, identifier);
- if(idp_src) {
+ IDProperty *idp_src= IDP_GetPropertyFromGroup(op->type->last_properties, identifier);
+ if (idp_src) {
IDProperty *idp_dst = IDP_CopyProperty(idp_src);
/* note - in the future this may need to be done recursively,
@@ -779,46 +782,65 @@ static int wm_operator_init_from_last(wmWindowManager *wm, wmOperator *op)
return change;
}
+int WM_operator_last_properties_store(wmOperator *op)
+{
+ if (op->type->last_properties) {
+ IDP_FreeProperty(op->type->last_properties);
+ MEM_freeN(op->type->last_properties);
+ op->type->last_properties = NULL;
+ }
+
+ if (op->properties) {
+ if (G.f & G_DEBUG) printf("%s: storing properties for '%s'\n", __func__, op->type->idname);
+ op->type->last_properties = IDP_CopyProperty(op->properties);
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, PointerRNA *properties, ReportList *reports, short poll_only)
{
wmWindowManager *wm= CTX_wm_manager(C);
int retval= OPERATOR_PASS_THROUGH;
/* this is done because complicated setup is done to call this function that is better not duplicated */
- if(poll_only)
+ if (poll_only)
return WM_operator_poll(C, ot);
- if(WM_operator_poll(C, ot)) {
+ if (WM_operator_poll(C, ot)) {
wmOperator *op= wm_operator_create(wm, ot, properties, reports); /* if reports==NULL, theyll be initialized */
+ const short is_nested_call = (wm->op_undo_depth != 0);
/* initialize setting from previous run */
- if(wm->op_undo_depth == 0 && (ot->flag & OPTYPE_REGISTER)) { /* not called by py script */
- wm_operator_init_from_last(wm, op);
+ if (!is_nested_call) { /* not called by py script */
+ WM_operator_last_properties_init(op);
}
- if((G.f & G_DEBUG) && event && event->type!=MOUSEMOVE)
+ if ((G.f & G_DEBUG) && event && event->type!=MOUSEMOVE)
printf("handle evt %d win %d op %s\n", event?event->type:0, CTX_wm_screen(C)->subwinactive, ot->idname);
- if(op->type->invoke && event) {
+ if (op->type->invoke && event) {
wm_region_mouse_co(C, event);
- if(op->type->flag & OPTYPE_UNDO)
+ if (op->type->flag & OPTYPE_UNDO)
wm->op_undo_depth++;
retval= op->type->invoke(C, op, event);
OPERATOR_RETVAL_CHECK(retval);
- if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+ if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
wm->op_undo_depth--;
}
- else if(op->type->exec) {
- if(op->type->flag & OPTYPE_UNDO)
+ else if (op->type->exec) {
+ if (op->type->flag & OPTYPE_UNDO)
wm->op_undo_depth++;
retval= op->type->exec(C, op);
OPERATOR_RETVAL_CHECK(retval);
- if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+ if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
wm->op_undo_depth--;
}
else {
@@ -833,16 +855,19 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
wm_operator_reports(C, op, retval, (reports != NULL));
}
- if(retval & OPERATOR_HANDLED)
+ if (retval & OPERATOR_HANDLED)
; /* do nothing, wm_operator_exec() has been called somewhere */
- else if(retval & OPERATOR_FINISHED) {
+ else if (retval & OPERATOR_FINISHED) {
+ if (!is_nested_call) { /* not called by py script */
+ WM_operator_last_properties_store(op);
+ }
wm_operator_finished(C, op, 0);
}
- else if(retval & OPERATOR_RUNNING_MODAL) {
+ else if (retval & OPERATOR_RUNNING_MODAL) {
/* grab cursor during blocking modal ops (X11)
* Also check for macro
*/
- if(ot->flag & OPTYPE_BLOCKING || (op->opm && op->opm->type->flag & OPTYPE_BLOCKING)) {
+ if (ot->flag & OPTYPE_BLOCKING || (op->opm && op->opm->type->flag & OPTYPE_BLOCKING)) {
int bounds[4] = {-1,-1,-1,-1};
int wrap;
@@ -856,14 +881,14 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
}
/* exception, cont. grab in header is annoying */
- if(wrap) {
+ if (wrap) {
ARegion *ar= CTX_wm_region(C);
- if(ar && ar->regiontype == RGN_TYPE_HEADER) {
+ if (ar && ar->regiontype == RGN_TYPE_HEADER) {
wrap= FALSE;
}
}
- if(wrap) {
+ if (wrap) {
rcti *winrect= NULL;
ARegion *ar= CTX_wm_region(C);
ScrArea *sa= CTX_wm_area(C);
@@ -873,11 +898,11 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
{
winrect= &ar->winrct;
}
- else if(sa) {
+ else if (sa) {
winrect= &sa->totrct;
}
- if(winrect) {
+ if (winrect) {
bounds[0]= winrect->xmin;
bounds[1]= winrect->ymax;
bounds[2]= winrect->xmax;
@@ -916,7 +941,7 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
CTX_wm_operator_poll_msg_set(C, NULL);
/* dummie test */
- if(ot && C) {
+ if (ot && C) {
switch(context) {
case WM_OP_INVOKE_DEFAULT:
case WM_OP_INVOKE_REGION_WIN:
@@ -966,9 +991,9 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
break;
}
- if(!(ar && ar->regiontype == type) && area) {
+ if (!(ar && ar->regiontype == type) && area) {
ARegion *ar1= BKE_area_find_region_type(area, type);
- if(ar1)
+ if (ar1)
CTX_wm_region_set(C, ar1);
}
@@ -1020,7 +1045,7 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
int WM_operator_name_call(bContext *C, const char *opstring, int context, PointerRNA *properties)
{
wmOperatorType *ot= WM_operatortype_find(opstring, 0);
- if(ot)
+ if (ot)
return wm_operator_call_internal(C, ot, properties, NULL, context, FALSE);
return 0;
@@ -1040,21 +1065,31 @@ int WM_operator_call_py(bContext *C, wmOperatorType *ot, int context, PointerRNA
op= wm_operator_create(wm, ot, properties, reports);
if (op->type->exec) {
- if(op->type->flag & OPTYPE_UNDO)
+ if (op->type->flag & OPTYPE_UNDO)
wm->op_undo_depth++;
retval= op->type->exec(C, op);
OPERATOR_RETVAL_CHECK(retval);
- if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+ if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
wm->op_undo_depth--;
}
else
printf("error \"%s\" operator has no exec function, python cannot call it\n", op->type->name);
#endif
- retval= wm_operator_call_internal(C, ot, properties, reports, context, FALSE);
+ /* not especially nice using undo depth here, its used so py never
+ * triggers undo or stores operators last used state.
+ *
+ * we could have some more obvious way of doing this like passing a flag.
+ */
+ wmWindowManager *wm = CTX_wm_manager(C);
+ if (wm) wm->op_undo_depth++;
+
+ retval = wm_operator_call_internal(C, ot, properties, reports, context, FALSE);
+ if (wm && (wm == CTX_wm_manager(C))) wm->op_undo_depth--;
+
/* keep the reports around if needed later */
if ( (retval & OPERATOR_RUNNING_MODAL) ||
((retval & OPERATOR_FINISHED) && wm_operator_register_check(CTX_wm_manager(C), ot))
@@ -1079,29 +1114,29 @@ static void wm_handler_op_context(bContext *C, wmEventHandler *handler)
{
bScreen *screen= CTX_wm_screen(C);
- if(screen && handler->op) {
- if(handler->op_area==NULL)
+ if (screen && handler->op) {
+ if (handler->op_area==NULL)
CTX_wm_area_set(C, NULL);
else {
ScrArea *sa;
- for(sa= screen->areabase.first; sa; sa= sa->next)
- if(sa==handler->op_area)
+ for (sa= screen->areabase.first; sa; sa= sa->next)
+ if (sa==handler->op_area)
break;
- if(sa==NULL) {
+ if (sa==NULL) {
/* when changing screen layouts with running modal handlers (like render display), this
* is not an error to print */
- if(handler->op==NULL)
+ if (handler->op==NULL)
printf("internal error: handler (%s) has invalid area\n", handler->op->type->idname);
}
else {
ARegion *ar;
CTX_wm_area_set(C, sa);
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar==handler->op_region)
+ for (ar= sa->regionbase.first; ar; ar= ar->next)
+ if (ar==handler->op_region)
break;
/* XXX no warning print here, after full-area and back regions are remade */
- if(ar)
+ if (ar)
CTX_wm_region_set(C, ar);
}
}
@@ -1115,22 +1150,22 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers)
wmWindowManager *wm= CTX_wm_manager(C);
/* C is zero on freeing database, modal handlers then already were freed */
- while((handler=handlers->first)) {
+ while ((handler=handlers->first)) {
BLI_remlink(handlers, handler);
- if(handler->op) {
- if(handler->op->type->cancel) {
+ if (handler->op) {
+ if (handler->op->type->cancel) {
ScrArea *area= CTX_wm_area(C);
ARegion *region= CTX_wm_region(C);
wm_handler_op_context(C, handler);
- if(handler->op->type->flag & OPTYPE_UNDO)
+ if (handler->op->type->flag & OPTYPE_UNDO)
wm->op_undo_depth++;
handler->op->type->cancel(C, handler->op);
- if(handler->op->type->flag & OPTYPE_UNDO)
+ if (handler->op->type->flag & OPTYPE_UNDO)
wm->op_undo_depth--;
CTX_wm_area_set(C, area);
@@ -1140,14 +1175,14 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers)
WM_cursor_ungrab(CTX_wm_window(C));
WM_operator_free(handler->op);
}
- else if(handler->ui_remove) {
+ else if (handler->ui_remove) {
ScrArea *area= CTX_wm_area(C);
ARegion *region= CTX_wm_region(C);
ARegion *menu= CTX_wm_menu(C);
- if(handler->ui_area) CTX_wm_area_set(C, handler->ui_area);
- if(handler->ui_region) CTX_wm_region_set(C, handler->ui_region);
- if(handler->ui_menu) CTX_wm_menu_set(C, handler->ui_menu);
+ if (handler->ui_area) CTX_wm_area_set(C, handler->ui_area);
+ if (handler->ui_region) CTX_wm_region_set(C, handler->ui_region);
+ if (handler->ui_menu) CTX_wm_menu_set(C, handler->ui_menu);
handler->ui_remove(C, handler->ui_userdata);
@@ -1165,37 +1200,37 @@ int WM_userdef_event_map(int kmitype)
{
switch(kmitype) {
case SELECTMOUSE:
- if(U.flag & USER_LMOUSESELECT)
+ if (U.flag & USER_LMOUSESELECT)
return LEFTMOUSE;
else
return RIGHTMOUSE;
case ACTIONMOUSE:
- if(U.flag & USER_LMOUSESELECT)
+ if (U.flag & USER_LMOUSESELECT)
return RIGHTMOUSE;
else
return LEFTMOUSE;
case WHEELOUTMOUSE:
- if(U.uiflag & USER_WHEELZOOMDIR)
+ if (U.uiflag & USER_WHEELZOOMDIR)
return WHEELUPMOUSE;
else
return WHEELDOWNMOUSE;
case WHEELINMOUSE:
- if(U.uiflag & USER_WHEELZOOMDIR)
+ if (U.uiflag & USER_WHEELZOOMDIR)
return WHEELDOWNMOUSE;
else
return WHEELUPMOUSE;
case EVT_TWEAK_A:
- if(U.flag & USER_LMOUSESELECT)
+ if (U.flag & USER_LMOUSESELECT)
return EVT_TWEAK_R;
else
return EVT_TWEAK_L;
case EVT_TWEAK_S:
- if(U.flag & USER_LMOUSESELECT)
+ if (U.flag & USER_LMOUSESELECT)
return EVT_TWEAK_L;
else
return EVT_TWEAK_R;
@@ -1209,8 +1244,8 @@ static void wm_eventemulation(wmEvent *event)
static int mmb_emulated = 0; /* this should be in a data structure somwhere */
/* middlemouse emulation */
- if(U.flag & USER_TWOBUTTONMOUSE) {
- if(event->type == LEFTMOUSE && (event->alt || mmb_emulated == KM_PRESS)) {
+ if (U.flag & USER_TWOBUTTONMOUSE) {
+ if (event->type == LEFTMOUSE && (event->alt || mmb_emulated == KM_PRESS)) {
event->type = MIDDLEMOUSE;
event->alt = 0;
mmb_emulated = event->val;
@@ -1219,8 +1254,8 @@ static void wm_eventemulation(wmEvent *event)
#ifdef __APPLE__
/* rightmouse emulation */
- if(U.flag & USER_TWOBUTTONMOUSE) {
- if(event->type == LEFTMOUSE && (event->oskey || mmb_emulated == KM_PRESS)) {
+ if (U.flag & USER_TWOBUTTONMOUSE) {
+ if (event->type == LEFTMOUSE && (event->oskey || mmb_emulated == KM_PRESS)) {
event->type = RIGHTMOUSE;
event->oskey = 0;
mmb_emulated = event->val;
@@ -1229,7 +1264,7 @@ static void wm_eventemulation(wmEvent *event)
#endif
/* numpad emulation */
- if(U.flag & USER_NONUMPAD) {
+ if (U.flag & USER_NONUMPAD) {
switch(event->type) {
case ZEROKEY: event->type = PAD0; break;
case ONEKEY: event->type = PAD1; break;
@@ -1252,35 +1287,35 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi)
{
int kmitype= WM_userdef_event_map(kmi->type);
- if(kmi->flag & KMI_INACTIVE) return 0;
+ if (kmi->flag & KMI_INACTIVE) return 0;
/* the matching rules */
- if(kmitype==KM_TEXTINPUT)
- if(ISTEXTINPUT(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1;
- if(kmitype!=KM_ANY)
- if(winevent->type!=kmitype) return 0;
+ if (kmitype==KM_TEXTINPUT)
+ if (ISTEXTINPUT(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1;
+ if (kmitype!=KM_ANY)
+ if (winevent->type!=kmitype) return 0;
- if(kmi->val!=KM_ANY)
- if(winevent->val!=kmi->val) return 0;
+ if (kmi->val!=KM_ANY)
+ if (winevent->val!=kmi->val) return 0;
/* modifiers also check bits, so it allows modifier order */
- if(kmi->shift!=KM_ANY)
- if(winevent->shift != kmi->shift && !(winevent->shift & kmi->shift)) return 0;
- if(kmi->ctrl!=KM_ANY)
- if(winevent->ctrl != kmi->ctrl && !(winevent->ctrl & kmi->ctrl)) return 0;
- if(kmi->alt!=KM_ANY)
- if(winevent->alt != kmi->alt && !(winevent->alt & kmi->alt)) return 0;
- if(kmi->oskey!=KM_ANY)
- if(winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey)) return 0;
-
- if(kmi->keymodifier)
- if(winevent->keymodifier!=kmi->keymodifier) return 0;
+ if (kmi->shift!=KM_ANY)
+ if (winevent->shift != kmi->shift && !(winevent->shift & kmi->shift)) return 0;
+ if (kmi->ctrl!=KM_ANY)
+ if (winevent->ctrl != kmi->ctrl && !(winevent->ctrl & kmi->ctrl)) return 0;
+ if (kmi->alt!=KM_ANY)
+ if (winevent->alt != kmi->alt && !(winevent->alt & kmi->alt)) return 0;
+ if (kmi->oskey!=KM_ANY)
+ if (winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey)) return 0;
+
+ if (kmi->keymodifier)
+ if (winevent->keymodifier!=kmi->keymodifier) return 0;
/* key modifiers always check when event has it */
/* otherwise regular keypresses with keymodifier still work */
- if(winevent->keymodifier)
- if(ISTEXTINPUT(winevent->type))
- if(winevent->keymodifier!=kmi->keymodifier) return 0;
+ if (winevent->keymodifier)
+ if (ISTEXTINPUT(winevent->type))
+ if (winevent->keymodifier!=kmi->keymodifier) return 0;
return 1;
}
@@ -1293,12 +1328,12 @@ static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *eve
if (op->opm)
op = op->opm;
- if(op->type->modalkeymap) {
+ if (op->type->modalkeymap) {
wmKeyMap *keymap= WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
wmKeyMapItem *kmi;
- for(kmi= keymap->items.first; kmi; kmi= kmi->next) {
- if(wm_eventmatch(event, kmi)) {
+ for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
+ if (wm_eventmatch(event, kmi)) {
event->type= EVT_MODAL_MAP;
event->val= kmi->propvalue;
@@ -1314,11 +1349,11 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
int retval= OPERATOR_PASS_THROUGH;
/* derived, modal or blocking operator */
- if(handler->op) {
+ if (handler->op) {
wmOperator *op= handler->op;
wmOperatorType *ot= op->type;
- if(ot->modal) {
+ if (ot->modal) {
/* we set context to where modal handler came from */
wmWindowManager *wm= CTX_wm_manager(C);
ScrArea *area= CTX_wm_area(C);
@@ -1328,7 +1363,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
wm_region_mouse_co(C, event);
wm_event_modalkeymap(C, op, event);
- if(ot->flag & OPTYPE_UNDO)
+ if (ot->flag & OPTYPE_UNDO)
wm->op_undo_depth++;
retval= ot->modal(C, op, event);
@@ -1337,13 +1372,13 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
/* when this is _not_ the case the modal modifier may have loaded
* a new blend file (demo mode does this), so we have to assume
* the event, operator etc have all been freed. - campbell */
- if(CTX_wm_manager(C) == wm) {
+ if (CTX_wm_manager(C) == wm) {
- if(ot->flag & OPTYPE_UNDO)
+ if (ot->flag & OPTYPE_UNDO)
wm->op_undo_depth--;
/* putting back screen context, reval can pass trough after modal failures! */
- if((retval & OPERATOR_PASS_THROUGH) || wm_event_always_pass(event)) {
+ if ((retval & OPERATOR_PASS_THROUGH) || wm_event_always_pass(event)) {
CTX_wm_area_set(C, area);
CTX_wm_region_set(C, region);
}
@@ -1353,20 +1388,20 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
CTX_wm_region_set(C, NULL);
}
- if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED))
+ if (retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED))
wm_operator_reports(C, op, retval, FALSE);
- if(retval & OPERATOR_FINISHED) {
+ if (retval & OPERATOR_FINISHED) {
wm_operator_finished(C, op, 0);
handler->op= NULL;
}
- else if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) {
+ else if (retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) {
WM_operator_free(op);
handler->op= NULL;
}
/* remove modal handler, operator itself should have been canceled and freed */
- if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) {
+ if (retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) {
WM_cursor_ungrab(CTX_wm_window(C));
BLI_remlink(handlers, handler);
@@ -1384,20 +1419,20 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
else {
wmOperatorType *ot= WM_operatortype_find(event->keymap_idname, 0);
- if(ot)
+ if (ot)
retval= wm_operator_invoke(C, ot, event, properties, NULL, FALSE);
}
/* Finished and pass through flag as handled */
/* Finished and pass through flag as handled */
- if(retval == (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH))
+ if (retval == (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH))
return WM_HANDLER_HANDLED;
/* Modal unhandled, break */
- if(retval == (OPERATOR_PASS_THROUGH|OPERATOR_RUNNING_MODAL))
+ if (retval == (OPERATOR_PASS_THROUGH|OPERATOR_RUNNING_MODAL))
return (WM_HANDLER_BREAK|WM_HANDLER_MODAL);
- if(retval & OPERATOR_PASS_THROUGH)
+ if (retval & OPERATOR_PASS_THROUGH)
return WM_HANDLER_CONTINUE;
return WM_HANDLER_BREAK;
@@ -1410,9 +1445,9 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
SpaceFile *sfile;
int action= WM_HANDLER_CONTINUE;
- if(event->type != EVT_FILESELECT)
+ if (event->type != EVT_FILESELECT)
return action;
- if(handler->op != (wmOperator *)event->customdata)
+ if (handler->op != (wmOperator *)event->customdata)
return action;
switch(event->val) {
@@ -1431,7 +1466,7 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
sa = handler->op_area;
}
- if(event->val==EVT_FILESELECT_OPEN) {
+ if (event->val==EVT_FILESELECT_OPEN) {
ED_area_newspace(C, sa, SPACE_FILE); /* 'sa' is modified in-place */
}
else {
@@ -1462,8 +1497,8 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
/* remlink now, for load file case before removing*/
BLI_remlink(handlers, handler);
- if(event->val!=EVT_FILESELECT_EXTERNAL_CANCEL) {
- if(screen != handler->filescreen) {
+ if (event->val!=EVT_FILESELECT_EXTERNAL_CANCEL) {
+ if (screen != handler->filescreen) {
ED_screen_full_prevspace(C, CTX_wm_area(C));
}
else {
@@ -1475,7 +1510,7 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
/* needed for uiPupMenuReports */
- if(event->val==EVT_FILESELECT_EXEC) {
+ if (event->val==EVT_FILESELECT_EXEC) {
#if 0 // use REDALERT now
/* a bit weak, might become arg for WM_event_fileselect? */
@@ -1485,7 +1520,7 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
char *path= RNA_string_get_alloc(handler->op->ptr, "filepath", NULL, 0);
/* this gives ownership to pupmenu */
uiPupMenuSaveOver(C, handler->op, (path)? path: "");
- if(path)
+ if (path)
MEM_freeN(path);
}
else
@@ -1493,25 +1528,25 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
{
int retval;
- if(handler->op->type->flag & OPTYPE_UNDO)
+ if (handler->op->type->flag & OPTYPE_UNDO)
wm->op_undo_depth++;
retval= handler->op->type->exec(C, handler->op);
/* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
- if(handler->op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+ if (handler->op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
wm->op_undo_depth--;
if (retval & OPERATOR_FINISHED)
- if(G.f & G_DEBUG)
+ if (G.f & G_DEBUG)
wm_operator_print(C, handler->op);
/* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
- if(CTX_wm_manager(C) == wm && wm->op_undo_depth == 0)
- if(handler->op->type->flag & OPTYPE_UNDO)
+ if (CTX_wm_manager(C) == wm && wm->op_undo_depth == 0)
+ if (handler->op->type->flag & OPTYPE_UNDO)
ED_undo_push_op(C, handler->op);
- if(handler->op->reports->list.first) {
+ if (handler->op->reports->list.first) {
/* FIXME, temp setting window, this is really bad!
* only have because lib linking errors need to be seen by users :(
@@ -1520,7 +1555,7 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
ScrArea *area_prev= CTX_wm_area(C);
ARegion *ar_prev= CTX_wm_region(C);
- if(win_prev==NULL)
+ if (win_prev==NULL)
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
handler->op->reports->printlevel = RPT_WARNING;
@@ -1535,17 +1570,21 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
CTX_wm_region_set(C, ar_prev);
}
+ if (retval & OPERATOR_FINISHED) {
+ WM_operator_last_properties_store(handler->op);
+ }
+
WM_operator_free(handler->op);
}
}
else {
- if(handler->op->type->cancel) {
- if(handler->op->type->flag & OPTYPE_UNDO)
+ if (handler->op->type->cancel) {
+ if (handler->op->type->flag & OPTYPE_UNDO)
wm->op_undo_depth++;
handler->op->type->cancel(C, handler->op);
- if(handler->op->type->flag & OPTYPE_UNDO)
+ if (handler->op->type->flag & OPTYPE_UNDO)
wm->op_undo_depth--;
}
@@ -1566,22 +1605,22 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
static int handler_boundbox_test(wmEventHandler *handler, wmEvent *event)
{
- if(handler->bbwin) {
- if(handler->bblocal) {
+ if (handler->bbwin) {
+ if (handler->bblocal) {
rcti rect= *handler->bblocal;
BLI_translate_rcti(&rect, handler->bbwin->xmin, handler->bbwin->ymin);
- if(BLI_in_rcti(&rect, event->x, event->y))
+ if (BLI_in_rcti(&rect, event->x, event->y))
return 1;
- else if(event->type==MOUSEMOVE && BLI_in_rcti(&rect, event->prevx, event->prevy))
+ else if (event->type==MOUSEMOVE && BLI_in_rcti(&rect, event->prevx, event->prevy))
return 1;
else
return 0;
}
else {
- if(BLI_in_rcti(handler->bbwin, event->x, event->y))
+ if (BLI_in_rcti(handler->bbwin, event->x, event->y))
return 1;
- else if(event->type==MOUSEMOVE && BLI_in_rcti(handler->bbwin, event->prevx, event->prevy))
+ else if (event->type==MOUSEMOVE && BLI_in_rcti(handler->bbwin, event->prevx, event->prevy))
return 1;
else
return 0;
@@ -1602,60 +1641,60 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
int action= WM_HANDLER_CONTINUE;
int always_pass;
- if(handlers==NULL) return action;
+ if (handlers==NULL) return action;
/* modal handlers can get removed in this loop, we keep the loop this way */
- for(handler= handlers->first; handler; handler= nexthandler) {
+ for (handler= handlers->first; handler; handler= nexthandler) {
nexthandler= handler->next;
/* during this loop, ui handlers for nested menus can tag multiple handlers free */
- if(handler->flag & WM_HANDLER_DO_FREE);
+ if (handler->flag & WM_HANDLER_DO_FREE);
/* optional boundbox */
- else if(handler_boundbox_test(handler, event)) {
+ else if (handler_boundbox_test(handler, event)) {
/* in advance to avoid access to freed event on window close */
always_pass= wm_event_always_pass(event);
/* modal+blocking handler */
- if(handler->flag & WM_HANDLER_BLOCKING)
+ if (handler->flag & WM_HANDLER_BLOCKING)
action |= WM_HANDLER_BREAK;
- if(handler->keymap) {
+ if (handler->keymap) {
wmKeyMap *keymap= WM_keymap_active(wm, handler->keymap);
wmKeyMapItem *kmi;
- if(!keymap->poll || keymap->poll(C)) {
- for(kmi= keymap->items.first; kmi; kmi= kmi->next) {
- if(wm_eventmatch(event, kmi)) {
+ if (!keymap->poll || keymap->poll(C)) {
+ for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
+ if (wm_eventmatch(event, kmi)) {
/* weak, but allows interactive callback to not use rawkey */
event->keymap_idname = kmi->idname;
action |= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr);
- if(action & WM_HANDLER_BREAK) /* not always_pass here, it denotes removed handler */
+ if (action & WM_HANDLER_BREAK) /* not always_pass here, it denotes removed handler */
break;
}
}
}
}
- else if(handler->ui_handle) {
+ else if (handler->ui_handle) {
action |= wm_handler_ui_call(C, handler, event, always_pass);
}
- else if(handler->type==WM_HANDLER_FILESELECT) {
+ else if (handler->type==WM_HANDLER_FILESELECT) {
/* screen context changes here */
action |= wm_handler_fileselect_call(C, handlers, handler, event);
}
- else if(handler->dropboxes) {
- if(event->type==EVT_DROP) {
+ else if (handler->dropboxes) {
+ if (event->type==EVT_DROP) {
wmDropBox *drop= handler->dropboxes->first;
- for(; drop; drop= drop->next) {
+ for (; drop; drop= drop->next) {
/* other drop custom types allowed */
- if(event->custom==EVT_DATA_LISTBASE) {
+ if (event->custom==EVT_DATA_LISTBASE) {
ListBase *lb= (ListBase *)event->customdata;
wmDrag *drag;
- for(drag= lb->first; drag; drag= drag->next) {
- if(drop->poll(C, drag, event)) {
+ for (drag= lb->first; drag; drag= drag->next) {
+ if (drop->poll(C, drag, event)) {
drop->copy(drag, drop);
@@ -1668,7 +1707,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
action |= WM_HANDLER_BREAK;
/* XXX fileread case */
- if(CTX_wm_window(C)==NULL)
+ if (CTX_wm_window(C)==NULL)
return action;
/* escape from drag loop, got freed */
@@ -1684,8 +1723,8 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
action |= wm_handler_operator_call(C, handlers, handler, event, NULL);
}
- if(action & WM_HANDLER_BREAK) {
- if(always_pass)
+ if (action & WM_HANDLER_BREAK) {
+ if (always_pass)
action &= ~WM_HANDLER_BREAK;
else
break;
@@ -1694,15 +1733,15 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
/* XXX fileread case, if the wm is freed then the handler's
* will have been too so the code below need not run. */
- if(CTX_wm_window(C)==NULL) {
+ if (CTX_wm_window(C)==NULL) {
return action;
}
/* XXX code this for all modal ops, and ensure free only happens here */
/* modal ui handler can be tagged to be freed */
- if(BLI_findindex(handlers, handler) != -1) { /* could be freed already by regular modal ops */
- if(handler->flag & WM_HANDLER_DO_FREE) {
+ if (BLI_findindex(handlers, handler) != -1) { /* could be freed already by regular modal ops */
+ if (handler->flag & WM_HANDLER_DO_FREE) {
BLI_remlink(handlers, handler);
wm_event_free_handler(handler);
}
@@ -1749,7 +1788,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
}
}
- if(action == (WM_HANDLER_BREAK|WM_HANDLER_MODAL))
+ if (action == (WM_HANDLER_BREAK|WM_HANDLER_MODAL))
wm_cursor_arrow_move(CTX_wm_window(C), event);
return action;
@@ -1757,12 +1796,12 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
static int wm_event_inside_i(wmEvent *event, rcti *rect)
{
- if(wm_event_always_pass(event))
+ if (wm_event_always_pass(event))
return 1;
- if(BLI_in_rcti(rect, event->x, event->y))
+ if (BLI_in_rcti(rect, event->x, event->y))
return 1;
- if(event->type==MOUSEMOVE) {
- if( BLI_in_rcti(rect, event->prevx, event->prevy)) {
+ if (event->type==MOUSEMOVE) {
+ if ( BLI_in_rcti(rect, event->prevx, event->prevy)) {
return 1;
}
return 0;
@@ -1775,9 +1814,9 @@ static ScrArea *area_event_inside(bContext *C, int x, int y)
bScreen *screen= CTX_wm_screen(C);
ScrArea *sa;
- if(screen)
- for(sa= screen->areabase.first; sa; sa= sa->next)
- if(BLI_in_rcti(&sa->totrct, x, y))
+ if (screen)
+ for (sa= screen->areabase.first; sa; sa= sa->next)
+ if (BLI_in_rcti(&sa->totrct, x, y))
return sa;
return NULL;
}
@@ -1788,18 +1827,18 @@ static ARegion *region_event_inside(bContext *C, int x, int y)
ScrArea *area= CTX_wm_area(C);
ARegion *ar;
- if(screen && area)
- for(ar= area->regionbase.first; ar; ar= ar->next)
- if(BLI_in_rcti(&ar->winrct, x, y))
+ if (screen && area)
+ for (ar= area->regionbase.first; ar; ar= ar->next)
+ if (BLI_in_rcti(&ar->winrct, x, y))
return ar;
return NULL;
}
static void wm_paintcursor_tag(bContext *C, wmPaintCursor *pc, ARegion *ar)
{
- if(ar) {
- for(; pc; pc= pc->next) {
- if(pc->poll == NULL || pc->poll(C)) {
+ if (ar) {
+ for (; pc; pc= pc->next) {
+ if (pc->poll == NULL || pc->poll(C)) {
wmWindow *win= CTX_wm_window(C);
win->screen->do_draw_paintcursor= 1;
wm_tag_redraw_overlay(win, ar);
@@ -1814,14 +1853,14 @@ static void wm_paintcursor_test(bContext *C, wmEvent *event)
{
wmWindowManager *wm= CTX_wm_manager(C);
- if(wm->paintcursors.first) {
+ if (wm->paintcursors.first) {
ARegion *ar= CTX_wm_region(C);
- if(ar)
+ if (ar)
wm_paintcursor_tag(C, wm->paintcursors.first, ar);
/* if previous position was not in current region, we have to set a temp new context */
- if(ar==NULL || !BLI_in_rcti(&ar->winrct, event->prevx, event->prevy)) {
+ if (ar==NULL || !BLI_in_rcti(&ar->winrct, event->prevx, event->prevy)) {
ScrArea *sa= CTX_wm_area(C);
CTX_wm_area_set(C, area_event_inside(C, event->prevx, event->prevy));
@@ -1837,20 +1876,20 @@ static void wm_paintcursor_test(bContext *C, wmEvent *event)
static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *event)
{
- if(wm->drags.first==NULL) return;
+ if (wm->drags.first==NULL) return;
- if(event->type==MOUSEMOVE)
+ if (event->type==MOUSEMOVE)
win->screen->do_draw_drag= 1;
- else if(event->type==ESCKEY) {
+ else if (event->type==ESCKEY) {
BLI_freelistN(&wm->drags);
win->screen->do_draw_drag= 1;
}
- else if(event->type==LEFTMOUSE && event->val==KM_RELEASE) {
+ else if (event->type==LEFTMOUSE && event->val==KM_RELEASE) {
event->type= EVT_DROP;
/* create customdata, first free existing */
- if(event->customdata) {
- if(event->customdatafree)
+ if (event->customdata) {
+ if (event->customdatafree)
MEM_freeN(event->customdata);
}
@@ -1866,8 +1905,8 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even
}
/* overlap fails otherwise */
- if(win->screen->do_draw_drag)
- if(win->drawmethod == USER_DRAW_OVERLAP)
+ if (win->screen->do_draw_drag)
+ if (win->drawmethod == USER_DRAW_OVERLAP)
win->screen->do_draw= 1;
}
@@ -1882,31 +1921,31 @@ void wm_event_do_handlers(bContext *C)
/* update key configuration before handling events */
WM_keyconfig_update(wm);
- for(win= wm->windows.first; win; win= win->next) {
+ for (win= wm->windows.first; win; win= win->next) {
wmEvent *event;
- if( win->screen==NULL )
+ if ( win->screen==NULL )
wm_event_free_all(win);
else {
Scene* scene = win->screen->scene;
- if(scene) {
+ if (scene) {
int playing = sound_scene_playing(win->screen->scene);
- if(playing != -1) {
+ if (playing != -1) {
CTX_wm_window_set(C, win);
CTX_wm_screen_set(C, win->screen);
CTX_data_scene_set(C, scene);
- if(((playing == 1) && (!win->screen->animtimer)) || ((playing == 0) && (win->screen->animtimer))){
+ if (((playing == 1) && (!win->screen->animtimer)) || ((playing == 0) && (win->screen->animtimer))) {
ED_screen_animation_play(C, -1, 1);
}
- if(playing == 0) {
+ if (playing == 0) {
float time = sound_sync_scene(scene);
- if(finite(time)) {
+ if (finite(time)) {
int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f;
- if(ncfra != scene->r.cfra) {
+ if (ncfra != scene->r.cfra) {
scene->r.cfra = ncfra;
ED_update_for_newframe(CTX_data_main(C), scene, win->screen, 1);
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -1921,10 +1960,10 @@ void wm_event_do_handlers(bContext *C)
}
}
- while( (event= win->queue.first) ) {
+ while ( (event= win->queue.first) ) {
int action = WM_HANDLER_CONTINUE;
- if((G.f & G_DEBUG) && event && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE))
+ if ((G.f & G_DEBUG) && event && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE))
printf("pass on evt %d val %d\n", event->type, event->val);
wm_eventemulation(event);
@@ -1944,7 +1983,7 @@ void wm_event_do_handlers(bContext *C)
action |= wm_handlers_do(C, event, &win->modalhandlers);
/* fileread case */
- if(CTX_wm_window(C)==NULL)
+ if (CTX_wm_window(C)==NULL)
return;
/* check dragging, creates new event or frees, adds draw tag */
@@ -1953,13 +1992,13 @@ void wm_event_do_handlers(bContext *C)
/* builtin tweak, if action is break it removes tweak */
wm_tweakevent_test(C, event, action);
- if((action & WM_HANDLER_BREAK) == 0) {
+ if ((action & WM_HANDLER_BREAK) == 0) {
ScrArea *sa;
ARegion *ar;
int doit= 0;
/* Note: setting subwin active should be done here, after modal handlers have been done */
- if(event->type==MOUSEMOVE) {
+ if (event->type==MOUSEMOVE) {
/* state variables in screen, cursors. Also used in wm_draw.c, fails for modal handlers though */
ED_screen_set_subwinactive(C, event);
/* for regions having custom cursors */
@@ -1969,13 +2008,13 @@ void wm_event_do_handlers(bContext *C)
win->addmousemove = TRUE;
}
- for(sa= win->screen->areabase.first; sa; sa= sa->next) {
- if(wm_event_inside_i(event, &sa->totrct)) {
+ for (sa= win->screen->areabase.first; sa; sa= sa->next) {
+ if (wm_event_inside_i(event, &sa->totrct)) {
CTX_wm_area_set(C, sa);
- if((action & WM_HANDLER_BREAK) == 0) {
- for(ar=sa->regionbase.first; ar; ar= ar->next) {
- if(wm_event_inside_i(event, &ar->winrct)) {
+ if ((action & WM_HANDLER_BREAK) == 0) {
+ for (ar=sa->regionbase.first; ar; ar= ar->next) {
+ if (wm_event_inside_i(event, &ar->winrct)) {
CTX_wm_region_set(C, ar);
/* call even on non mouse events, since the */
@@ -1983,19 +2022,19 @@ void wm_event_do_handlers(bContext *C)
/* does polls for drop regions and checks uibuts */
/* need to be here to make sure region context is true */
- if(ELEM(event->type, MOUSEMOVE, EVT_DROP)) {
+ if (ELEM(event->type, MOUSEMOVE, EVT_DROP)) {
wm_drags_check_ops(C, event);
}
action |= wm_handlers_do(C, event, &ar->handlers);
/* fileread case (python), [#29489] */
- if(CTX_wm_window(C)==NULL)
+ if (CTX_wm_window(C)==NULL)
return;
doit |= (BLI_in_rcti(&ar->winrct, event->x, event->y));
- if(action & WM_HANDLER_BREAK)
+ if (action & WM_HANDLER_BREAK)
break;
}
}
@@ -2003,7 +2042,7 @@ void wm_event_do_handlers(bContext *C)
CTX_wm_region_set(C, NULL);
- if((action & WM_HANDLER_BREAK) == 0) {
+ if ((action & WM_HANDLER_BREAK) == 0) {
wm_region_mouse_co(C, event); /* only invalidates event->mval in this case */
action |= wm_handlers_do(C, event, &sa->handlers);
}
@@ -2013,7 +2052,7 @@ void wm_event_do_handlers(bContext *C)
}
}
- if((action & WM_HANDLER_BREAK) == 0) {
+ if ((action & WM_HANDLER_BREAK) == 0) {
/* also some non-modal handlers need active area/region */
CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
@@ -2023,13 +2062,13 @@ void wm_event_do_handlers(bContext *C)
action |= wm_handlers_do(C, event, &win->handlers);
/* fileread case */
- if(CTX_wm_window(C)==NULL)
+ if (CTX_wm_window(C)==NULL)
return;
}
/* XXX hrmf, this gives reliable previous mouse coord for area change, feels bad?
* doing it on ghost queue gives errors when mousemoves go over area borders */
- if(doit && win->screen && win->screen->subwinactive != win->screen->mainwin) {
+ if (doit && win->screen && win->screen->subwinactive != win->screen->mainwin) {
win->eventstate->prevx= event->x;
win->eventstate->prevy= event->y;
//printf("win->eventstate->prev = %d %d\n", event->x, event->y);
@@ -2050,20 +2089,23 @@ void wm_event_do_handlers(bContext *C)
win->eventstate->prevclickx = event->x;
win->eventstate->prevclicky = event->y;
}
- } else {
+ }
+ else {
/* reset click time if event type not the same */
win->eventstate->prevclicktime = 0;
}
win->eventstate->prevval = event->val;
win->eventstate->prevtype = event->type;
- } else if (event->val == KM_CLICK) { /* keep click for double click later */
+ }
+ else if (event->val == KM_CLICK) { /* keep click for double click later */
win->eventstate->prevtype = event->type;
win->eventstate->prevval = event->val;
win->eventstate->prevclicktime = PIL_check_seconds_timer();
win->eventstate->prevclickx = event->x;
win->eventstate->prevclicky = event->y;
- } else { /* reset if not */
+ }
+ else { /* reset if not */
win->eventstate->prevtype = -1;
win->eventstate->prevval = 0;
win->eventstate->prevclicktime = 0;
@@ -2077,7 +2119,7 @@ void wm_event_do_handlers(bContext *C)
}
/* only add mousemove when queue was read entirely */
- if(win->addmousemove && win->eventstate) {
+ if (win->addmousemove && win->eventstate) {
wmEvent tevent= *(win->eventstate);
//printf("adding MOUSEMOVE %d %d\n", tevent.x, tevent.y);
tevent.type= MOUSEMOVE;
@@ -2101,7 +2143,7 @@ void WM_event_fileselect_event(bContext *C, void *ophandle, int eventval)
/* add to all windows! */
wmWindow *win;
- for(win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
+ for (win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
wmEvent event= *win->eventstate;
event.type= EVT_FILESELECT;
@@ -2127,11 +2169,11 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
int full= 1; // XXX preset?
/* only allow 1 file selector open per window */
- for(handler= win->modalhandlers.first; handler; handler=handlernext) {
+ for (handler= win->modalhandlers.first; handler; handler=handlernext) {
handlernext= handler->next;
- if(handler->type == WM_HANDLER_FILESELECT) {
- if(handler->op)
+ if (handler->type == WM_HANDLER_FILESELECT) {
+ if (handler->op)
WM_operator_free(handler->op);
BLI_remlink(&win->modalhandlers, handler);
wm_event_free_handler(handler);
@@ -2150,7 +2192,7 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
/* check props once before invoking if check is available
* ensures initial properties are valid */
- if(op->type->check) {
+ if (op->type->check) {
op->type->check(C, op); /* ignore return value */
}
@@ -2171,7 +2213,7 @@ wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op)
wmWindow *win= CTX_wm_window(C);
/* operator was part of macro */
- if(op->opm) {
+ if (op->opm) {
/* give the mother macro to the handler */
handler->op= op->opm;
/* mother macro opm becomes the macro element */
@@ -2192,14 +2234,14 @@ wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap
{
wmEventHandler *handler;
- if(!keymap) {
+ if (!keymap) {
printf("WM_event_add_keymap_handler called with NULL keymap\n");
return NULL;
}
/* only allow same keymap once */
- for(handler= handlers->first; handler; handler= handler->next)
- if(handler->keymap==keymap)
+ for (handler= handlers->first; handler; handler= handler->next)
+ if (handler->keymap==keymap)
return handler;
handler= MEM_callocN(sizeof(wmEventHandler), "event keymap handler");
@@ -2227,7 +2269,7 @@ wmEventHandler *WM_event_add_keymap_handler_bb(ListBase *handlers, wmKeyMap *key
{
wmEventHandler *handler= WM_event_add_keymap_handler(handlers, keymap);
- if(handler) {
+ if (handler) {
handler->bblocal= bblocal;
handler->bbwin= bbwin;
}
@@ -2238,8 +2280,8 @@ void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
{
wmEventHandler *handler;
- for(handler= handlers->first; handler; handler= handler->next) {
- if(handler->keymap==keymap) {
+ for (handler= handlers->first; handler; handler= handler->next) {
+ if (handler->keymap==keymap) {
BLI_remlink(handlers, handler);
wm_event_free_handler(handler);
break;
@@ -2263,16 +2305,16 @@ wmEventHandler *WM_event_add_ui_handler(const bContext *C, ListBase *handlers,
return handler;
}
-/* set "postpone" for win->modalhandlers, this is in a running for() loop in wm_handlers_do() */
+/* set "postpone" for win->modalhandlers, this is in a running for () loop in wm_handlers_do() */
void WM_event_remove_ui_handler(ListBase *handlers,
wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata, int postpone)
{
wmEventHandler *handler;
- for(handler= handlers->first; handler; handler= handler->next) {
- if(handler->ui_handle == func && handler->ui_remove == remove && handler->ui_userdata == userdata) {
+ for (handler= handlers->first; handler; handler= handler->next) {
+ if (handler->ui_handle == func && handler->ui_remove == remove && handler->ui_userdata == userdata) {
/* handlers will be freed in wm_handlers_do() */
- if(postpone) {
+ if (postpone) {
handler->flag |= WM_HANDLER_DO_FREE;
}
else {
@@ -2289,8 +2331,8 @@ wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropb
wmEventHandler *handler;
/* only allow same dropbox once */
- for(handler= handlers->first; handler; handler= handler->next)
- if(handler->dropboxes==dropboxes)
+ for (handler= handlers->first; handler; handler= handler->next)
+ if (handler->dropboxes==dropboxes)
return handler;
handler= MEM_callocN(sizeof(wmEventHandler), "dropbox handler");
@@ -2307,7 +2349,7 @@ void WM_event_remove_area_handler(ListBase *handlers, void *area)
{
wmEventHandler *handler, *nexthandler;
- for(handler = handlers->first; handler; handler= nexthandler) {
+ for (handler = handlers->first; handler; handler= nexthandler) {
nexthandler = handler->next;
if (handler->type != WM_HANDLER_FILESELECT) {
if (handler->ui_area == area) {
@@ -2352,7 +2394,7 @@ int WM_modal_tweak_exit(wmEvent *evt, int tweak_event)
else {
/* if the initial event wasn't a tweak event then
* ignore USER_RELEASECONFIRM setting: see [#26756] */
- if(ELEM3(tweak_event, EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R) == 0) {
+ if (ELEM3(tweak_event, EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R) == 0) {
return 1;
}
}
@@ -2375,13 +2417,17 @@ static int convert_key(GHOST_TKey key)
{
if (key>=GHOST_kKeyA && key<=GHOST_kKeyZ) {
return (AKEY + ((int) key - GHOST_kKeyA));
- } else if (key>=GHOST_kKey0 && key<=GHOST_kKey9) {
+ }
+ else if (key>=GHOST_kKey0 && key<=GHOST_kKey9) {
return (ZEROKEY + ((int) key - GHOST_kKey0));
- } else if (key>=GHOST_kKeyNumpad0 && key<=GHOST_kKeyNumpad9) {
+ }
+ else if (key>=GHOST_kKeyNumpad0 && key<=GHOST_kKeyNumpad9) {
return (PAD0 + ((int) key - GHOST_kKeyNumpad0));
- } else if (key>=GHOST_kKeyF1 && key<=GHOST_kKeyF19) {
+ }
+ else if (key>=GHOST_kKeyF1 && key<=GHOST_kKeyF19) {
return (F1KEY + ((int) key - GHOST_kKeyF1));
- } else {
+ }
+ else {
switch (key) {
case GHOST_kKeyBackSpace: return BACKSPACEKEY;
case GHOST_kKeyTab: return TABKEY;
@@ -2519,18 +2565,18 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
{
int mx= evt->x, my= evt->y;
- if(wm->windows.first== wm->windows.last)
+ if (wm->windows.first== wm->windows.last)
return NULL;
/* top window bar... */
- if(mx<0 || my<0 || mx>win->sizex || my>win->sizey+30) {
+ if (mx<0 || my<0 || mx>win->sizex || my>win->sizey+30) {
wmWindow *owin;
wmEventHandler *handler;
/* let's skip windows having modal handlers now */
/* potential XXX ugly... I wouldn't have added a modalhandlers list (introduced in rev 23331, ton) */
- for(handler= win->modalhandlers.first; handler; handler= handler->next)
- if(handler->ui_handle || handler->op)
+ for (handler= win->modalhandlers.first; handler; handler= handler->next)
+ if (handler->ui_handle || handler->op)
return NULL;
/* to desktop space */
@@ -2538,10 +2584,10 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
my += (int)win->posy;
/* check other windows to see if it has mouse inside */
- for(owin= wm->windows.first; owin; owin= owin->next) {
+ for (owin= wm->windows.first; owin; owin= owin->next) {
- if(owin!=win) {
- if(mx-owin->posx >= 0 && my-owin->posy >= 0 &&
+ if (owin!=win) {
+ if (mx-owin->posx >= 0 && my-owin->posy >= 0 &&
mx-owin->posx <= owin->sizex && my-owin->posy <= owin->sizey) {
evt->x= mx - (int)owin->posx;
evt->y= my - (int)owin->posy;
@@ -2567,7 +2613,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
switch (type) {
/* mouse move */
case GHOST_kEventCursorMove: {
- if(win->active) {
+ if (win->active) {
GHOST_TEventCursorData *cd= customdata;
wmEvent *lastevent= win->queue.last;
int cx, cy;
@@ -2584,7 +2630,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
/* some painting operators want accurate mouse events, they can
* handle in between mouse move moves, others can happily ignore
* them for better performance */
- if(lastevent && lastevent->type == MOUSEMOVE)
+ if (lastevent && lastevent->type == MOUSEMOVE)
lastevent->type = INBETWEEN_MOUSEMOVE;
update_tablet_data(win, &event);
@@ -2595,7 +2641,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
/* also add to other window if event is there, this makes overdraws disappear nicely */
/* it remaps mousecoord to other window in event */
owin= wm_event_cursor_other_windows(wm, win, &event);
- if(owin) {
+ if (owin) {
wmEvent oevent= *(owin->eventstate);
oevent.x=owin->eventstate->x= event.x;
@@ -2658,7 +2704,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
else
event.type= MIDDLEMOUSE;
- if(win->active==0) {
+ if (win->active==0) {
int cx, cy;
/* entering window, update mouse pos. (ghost sends win-activate *after* the mouseclick in window!) */
@@ -2670,7 +2716,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
/* add to other window if event is there (not to both!) */
owin= wm_event_cursor_other_windows(wm, win, &event);
- if(owin) {
+ if (owin) {
wmEvent oevent= *(owin->eventstate);
oevent.x= event.x;
@@ -2698,7 +2744,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event.val= (type==GHOST_kEventKeyDown)?KM_PRESS:KM_RELEASE;
/* exclude arrow keys, esc, etc from text input */
- if(type==GHOST_kEventKeyUp) {
+ if (type==GHOST_kEventKeyUp) {
event.ascii= '\0';
/* ghost should do this already for key up */
@@ -2746,9 +2792,9 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
FALSE;
break;
default:
- if(event.val == KM_PRESS && event.keymodifier==0)
+ if (event.val == KM_PRESS && event.keymodifier==0)
evt->keymodifier= event.type; /* only set in eventstate, for next event */
- else if(event.val==KM_RELEASE && event.keymodifier==event.type)
+ else if (event.val==KM_RELEASE && event.keymodifier==event.type)
event.keymodifier= evt->keymodifier= 0;
break;
}
@@ -2757,16 +2803,16 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
* generate press events without release, we still want to keep the
* modifier in win->eventstate, but for the press event of the same
* key we don't want the key modifier */
- if(event.keymodifier == event.type)
+ if (event.keymodifier == event.type)
event.keymodifier= 0;
/* this case happened with an external numpad, it's not really clear
* why, but it's also impossible to map a key modifier to an unknwon
* key, so it shouldn't harm */
- if(event.keymodifier == UNKNOWNKEY)
+ if (event.keymodifier == UNKNOWNKEY)
event.keymodifier= 0;
/* if test_break set, it catches this. XXX Keep global for now? */
- if(event.type==ESCKEY)
+ if (event.type==ESCKEY)
G.afbreek= 1;
wm_event_add(win, &event);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index facc6136d3f..e57fb96dc73 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -140,11 +140,11 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
/* first wrap up running stuff */
/* code copied from wm_init_exit.c */
- for(wm= wmlist->first; wm; wm= wm->id.next) {
+ for (wm= wmlist->first; wm; wm= wm->id.next) {
WM_jobs_stop_all(wm);
- for(win= wm->windows.first; win; win= win->next) {
+ for (win= wm->windows.first; win; win= win->next) {
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
WM_event_remove_handlers(C, &win->handlers);
@@ -160,13 +160,13 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
/* just had return; here from r12991, this code could just get removed?*/
#if 0
- if(wm==NULL) return;
- if(G.fileflags & G_FILE_NO_UI) return;
+ if (wm==NULL) return;
+ if (G.fileflags & G_FILE_NO_UI) return;
/* we take apart the used screens from non-active window */
- for(win= wm->windows.first; win; win= win->next) {
+ for (win= wm->windows.first; win; win= win->next) {
BLI_strncpy(win->screenname, win->screen->id.name, MAX_ID_NAME);
- if(win!=wm->winactive) {
+ if (win!=wm->winactive) {
BLI_remlink(&G.main->screen, win->screen);
//BLI_addtail(screenbase, win->screen);
}
@@ -187,8 +187,8 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
wmWindow *oldwin, *win;
/* cases 1 and 2 */
- if(oldwmlist->first==NULL) {
- if(G.main->wm.first); /* nothing todo */
+ if (oldwmlist->first==NULL) {
+ if (G.main->wm.first); /* nothing todo */
else
wm_add_default(C);
}
@@ -196,18 +196,18 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
/* cases 3 and 4 */
/* we've read file without wm..., keep current one entirely alive */
- if(G.main->wm.first==NULL) {
+ if (G.main->wm.first==NULL) {
bScreen *screen= NULL;
/* when loading without UI, no matching needed */
- if(!(G.fileflags & G_FILE_NO_UI) && (screen= CTX_wm_screen(C))) {
+ if (!(G.fileflags & G_FILE_NO_UI) && (screen= CTX_wm_screen(C))) {
/* match oldwm to new dbase, only old files */
- for(wm= oldwmlist->first; wm; wm= wm->id.next) {
+ for (wm= oldwmlist->first; wm; wm= wm->id.next) {
- for(win= wm->windows.first; win; win= win->next) {
+ for (win= wm->windows.first; win; win= win->next) {
/* all windows get active screen from file */
- if(screen->winid==0)
+ if (screen->winid==0)
win->screen= screen;
else
win->screen= ED_screen_duplicate(win, screen);
@@ -245,16 +245,16 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
wm->winactive= NULL;
/* only first wm in list has ghostwins */
- for(win= wm->windows.first; win; win= win->next) {
- for(oldwin= oldwm->windows.first; oldwin; oldwin= oldwin->next) {
+ for (win= wm->windows.first; win; win= win->next) {
+ for (oldwin= oldwm->windows.first; oldwin; oldwin= oldwin->next) {
- if(oldwin->winid == win->winid ) {
+ if (oldwin->winid == win->winid ) {
win->ghostwin= oldwin->ghostwin;
win->active= oldwin->active;
- if(win->active)
+ if (win->active)
wm->winactive= win;
- if(!G.background) /* file loading in background mode still calls this */
+ if (!G.background) /* file loading in background mode still calls this */
GHOST_SetWindowUserData(win->ghostwin, win); /* pointer back */
oldwin->ghostwin= NULL;
@@ -283,12 +283,12 @@ static void wm_init_userdef(bContext *C)
sound_init(CTX_data_main(C));
/* needed so loading a file from the command line respects user-pref [#26156] */
- if(U.flag & USER_FILENOUI) G.fileflags |= G_FILE_NO_UI;
+ if (U.flag & USER_FILENOUI) G.fileflags |= G_FILE_NO_UI;
else G.fileflags &= ~G_FILE_NO_UI;
/* set the python auto-execute setting from user prefs */
/* enabled by default, unless explicitly enabled in the command line which overrides */
- if((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
+ if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC;
else G.f &= ~G_SCRIPT_AUTOEXEC;
}
@@ -306,6 +306,7 @@ static void wm_init_userdef(bContext *C)
#define BKE_READ_EXOTIC_OK_BLEND 0 /* .blend file */
#define BKE_READ_EXOTIC_OK_OTHER 1 /* other supported formats */
+
/* intended to check for non-blender formats but for now it only reads blends */
static int wm_read_exotic(Scene *UNUSED(scene), const char *name)
{
@@ -321,8 +322,7 @@ static int wm_read_exotic(Scene *UNUSED(scene), const char *name)
retval= BKE_READ_EXOTIC_FAIL_PATH;
}
else {
- gzfile = gzopen(name,"rb");
-
+ gzfile = BLI_gzopen(name,"rb");
if (gzfile == NULL) {
retval= BKE_READ_EXOTIC_FAIL_OPEN;
}
@@ -335,7 +335,7 @@ static int wm_read_exotic(Scene *UNUSED(scene), const char *name)
else {
//XXX waitcursor(1);
#if 0 /* historic stuff - no longer used */
- if(is_foo_format(name)) {
+ if (is_foo_format(name)) {
read_foo(name);
retval= BKE_READ_EXOTIC_OK_OTHER;
}
@@ -382,7 +382,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
/* this flag is initialized by the operator but overwritten on read.
* need to re-enable it here else drivers + registered scripts wont work. */
- if(G.f != G_f) {
+ if (G.f != G_f) {
const int flags_keep= (G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
G.f= (G.f & ~flags_keep) | (G_f & flags_keep);
}
@@ -393,14 +393,14 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
// XXX mainwindow_set_filename_to_title(G.main->name);
- if(retval == BKE_READ_FILE_OK_USERPREFS) {
+ if (retval == BKE_READ_FILE_OK_USERPREFS) {
/* in case a userdef is read from regular .blend */
wm_init_userdef(C);
}
if (retval != BKE_READ_FILE_FAIL) {
G.relbase_valid = 1;
- if(!G.background) /* assume automated tasks with background, dont write recent file list */
+ if (!G.background) /* assume automated tasks with background, don't write recent file list */
write_history();
}
@@ -454,16 +454,16 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
BKE_reset_undo();
BKE_write_undo(C, "original"); /* save current state */
}
- else if(retval == BKE_READ_EXOTIC_OK_OTHER)
+ else if (retval == BKE_READ_EXOTIC_OK_OTHER)
BKE_write_undo(C, "Import file");
- else if(retval == BKE_READ_EXOTIC_FAIL_OPEN) {
+ else if (retval == BKE_READ_EXOTIC_FAIL_OPEN) {
BKE_reportf(reports, RPT_ERROR, IFACE_("Can't read file: \"%s\", %s."), filepath,
errno ? strerror(errno) : IFACE_("Unable to open the file"));
}
- else if(retval == BKE_READ_EXOTIC_FAIL_FORMAT) {
+ else if (retval == BKE_READ_EXOTIC_FAIL_FORMAT) {
BKE_reportf(reports, RPT_ERROR, IFACE_("File format is not supported in file: \"%s\"."), filepath);
}
- else if(retval == BKE_READ_EXOTIC_FAIL_PATH) {
+ else if (retval == BKE_READ_EXOTIC_FAIL_PATH) {
BKE_reportf(reports, RPT_ERROR, IFACE_("File path invalid: \"%s\"."), filepath);
}
else {
@@ -492,7 +492,8 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
if (cfgdir) {
BLI_make_file_string(G.main->name, tstr, cfgdir, BLENDER_STARTUP_FILE);
- } else {
+ }
+ else {
tstr[0] = '\0';
from_memory = 1;
}
@@ -507,12 +508,12 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
if (!from_memory && BLI_exists(tstr)) {
success = (BKE_read_file(C, tstr, NULL) != BKE_READ_FILE_FAIL);
- if(U.themes.first==NULL) {
+ if (U.themes.first==NULL) {
printf("\nError: No valid "STRINGIFY(BLENDER_STARTUP_FILE)", fall back to built-in default.\n\n");
success = 0;
}
}
- if(success==0) {
+ if (success==0) {
success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL);
if (wmbase.first == NULL) wm_clear_default_size(C);
@@ -554,7 +555,7 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
DAG_on_visible_update(CTX_data_main(C), TRUE);
#ifdef WITH_PYTHON
- if(CTX_py_init_get(C)) {
+ if (CTX_py_init_get(C)) {
/* sync addons, these may have changed from the defaults */
BPY_string_exec(C, "__import__('addon_utils').reset_all()");
@@ -567,7 +568,7 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
/* in background mode the scene will stay NULL */
- if(!G.background) {
+ if (!G.background) {
CTX_wm_window_set(C, NULL); /* exits queues */
}
@@ -622,15 +623,15 @@ static void write_history(void)
/* will be NULL in background mode */
user_config_dir = BLI_get_folder_create(BLENDER_USER_CONFIG, NULL);
- if(!user_config_dir)
+ if (!user_config_dir)
return;
BLI_make_file_string("/", name, user_config_dir, BLENDER_HISTORY_FILE);
recent = G.recent_files.first;
/* refresh recent-files.txt of recent opened files, when current file was changed */
- if(!(recent) || (BLI_path_cmp(recent->filepath, G.main->name)!=0)) {
- fp= fopen(name, "w");
+ if (!(recent) || (BLI_path_cmp(recent->filepath, G.main->name)!=0)) {
+ fp= BLI_fopen(name, "w");
if (fp) {
/* add current file to the beginning of list */
recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
@@ -641,7 +642,7 @@ static void write_history(void)
recent = recent->next;
i=1;
/* write rest of recent opened files to recent-files.txt */
- while((i<U.recent_files) && (recent)){
+ while ((i<U.recent_files) && (recent)) {
/* this prevents to have duplicities in list */
if (BLI_path_cmp(recent->filepath, G.main->name)!=0) {
fprintf(fp, "%s\n", recent->filepath);
@@ -673,7 +674,7 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
*thumb_pt= NULL;
/* scene can be NULL if running a script at startup and calling the save operator */
- if(G.background || scene==NULL || scene->camera==NULL)
+ if (G.background || scene==NULL || scene->camera==NULL)
return NULL;
/* gets scaled to BLEN_THUMB_SIZE */
@@ -681,7 +682,7 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2,
IB_rect, OB_SOLID, FALSE, err_out);
- if(ibuf) {
+ if (ibuf) {
float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
/* dirty oversampling */
@@ -718,7 +719,7 @@ int write_crash_blend(void)
BLI_strncpy(path, G.main->name, sizeof(path));
BLI_replace_extension(path, sizeof(path), "_crash.blend");
- if(BLO_write_file(G.main, path, fileflags, NULL, NULL)) {
+ if (BLO_write_file(G.main, path, fileflags, NULL, NULL)) {
printf("written: %s\n", path);
return 1;
}
@@ -751,7 +752,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
BLI_strncpy(filepath, target, FILE_MAX);
BLI_replace_extension(filepath, FILE_MAX, ".blend");
- /* dont use 'target' anymore */
+ /* don't use 'target' anymore */
/* send the OnSave event */
for (li= G.main->library.first; li; li= li->id.next) {
@@ -763,7 +764,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
/* blend file thumbnail */
/* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */
- if(U.flag & USER_SAVE_PREVIEWS) {
+ if (U.flag & USER_SAVE_PREVIEWS) {
ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb);
}
@@ -784,21 +785,21 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
fileflags |= G_FILE_HISTORY; /* write file history */
if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
- if(!copy) {
+ if (!copy) {
G.relbase_valid = 1;
BLI_strncpy(G.main->name, filepath, sizeof(G.main->name)); /* is guaranteed current file */
G.save_over = 1; /* disable untitled.blend convention */
}
- if(fileflags & G_FILE_COMPRESS) G.fileflags |= G_FILE_COMPRESS;
+ if (fileflags & G_FILE_COMPRESS) G.fileflags |= G_FILE_COMPRESS;
else G.fileflags &= ~G_FILE_COMPRESS;
- if(fileflags & G_FILE_AUTOPLAY) G.fileflags |= G_FILE_AUTOPLAY;
+ if (fileflags & G_FILE_AUTOPLAY) G.fileflags |= G_FILE_AUTOPLAY;
else G.fileflags &= ~G_FILE_AUTOPLAY;
/* prevent background mode scripts from clobbering history */
- if(!G.background) {
+ if (!G.background) {
write_history();
}
@@ -810,11 +811,11 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
IMB_freeImBuf(ibuf_thumb);
}
- if(thumb) MEM_freeN(thumb);
+ if (thumb) MEM_freeN(thumb);
}
else {
- if(ibuf_thumb) IMB_freeImBuf(ibuf_thumb);
- if(thumb) MEM_freeN(thumb);
+ if (ibuf_thumb) IMB_freeImBuf(ibuf_thumb);
+ if (thumb) MEM_freeN(thumb);
WM_cursor_wait(0);
return -1;
@@ -834,7 +835,7 @@ int WM_write_homefile(bContext *C, wmOperator *op)
int fileflags;
/* check current window and close it if temp */
- if(win->screen->temp)
+ if (win->screen->temp)
wm_window_close(C, wm, win);
/* update keymaps in user preferences */
@@ -846,7 +847,7 @@ int WM_write_homefile(bContext *C, wmOperator *op)
/* force save as regular blend file */
fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN | G_FILE_HISTORY);
- if(BLO_write_file(CTX_data_main(C), filepath, fileflags, op->reports, NULL) == 0) {
+ if (BLO_write_file(CTX_data_main(C), filepath, fileflags, op->reports, NULL) == 0) {
printf("fail\n");
return OPERATOR_CANCELLED;
}
@@ -892,7 +893,7 @@ void WM_autosave_init(wmWindowManager *wm)
{
wm_autosave_timer_ended(wm);
- if(U.flag & USER_AUTOSAVE)
+ if (U.flag & USER_AUTOSAVE)
wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0);
}
@@ -906,9 +907,9 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
WM_event_remove_timer(wm, NULL, wm->autosavetimer);
/* if a modal operator is running, don't autosave, but try again in 10 seconds */
- for(win=wm->windows.first; win; win=win->next) {
- for(handler=win->modalhandlers.first; handler; handler=handler->next) {
- if(handler->op) {
+ for (win=wm->windows.first; win; win=win->next) {
+ for (handler=win->modalhandlers.first; handler; handler=handler->next) {
+ if (handler->op) {
wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0);
return;
}
@@ -929,7 +930,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
void wm_autosave_timer_ended(wmWindowManager *wm)
{
- if(wm->autosavetimer) {
+ if (wm->autosavetimer) {
WM_event_remove_timer(wm, NULL, wm->autosavetimer);
wm->autosavetimer= NULL;
}
@@ -941,12 +942,12 @@ void wm_autosave_delete(void)
wm_autosave_location(filename);
- if(BLI_exists(filename)) {
+ if (BLI_exists(filename)) {
char str[FILE_MAX];
BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend");
/* if global undo; remove tempsave, otherwise rename */
- if(U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, 0, 0);
+ if (U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, 0, 0);
else BLI_rename(filename, str);
}
}
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index b9b8f57b971..a2630b5c6e1 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -79,17 +79,18 @@ wmGesture *WM_gesture_new(bContext *C, wmEvent *event, int type)
rcti *rect= MEM_callocN(sizeof(rcti), "gesture rect new");
gesture->customdata= rect;
- rect->xmin= event->x - sx;
- rect->ymin= event->y - sy;
- if(type==WM_GESTURE_CIRCLE) {
+ rect->xmin = event->x - sx;
+ rect->ymin = event->y - sy;
+ if (type==WM_GESTURE_CIRCLE) {
#ifdef GESTURE_MEMORY
- rect->xmax= circle_select_size;
+ rect->xmax = circle_select_size;
#else
- rect->xmax= 25; // XXX temp
+ rect->xmax = 25; // XXX temp
#endif
- } else {
- rect->xmax= event->x - sx;
- rect->ymax= event->y - sy;
+ }
+ else {
+ rect->xmax = event->x - sx;
+ rect->ymax = event->y - sy;
}
}
else if (ELEM(type, WM_GESTURE_LINES, WM_GESTURE_LASSO)) {
@@ -108,7 +109,7 @@ void WM_gesture_end(bContext *C, wmGesture *gesture)
{
wmWindow *win= CTX_wm_window(C);
- if(win->tweak==gesture)
+ if (win->tweak==gesture)
win->tweak= NULL;
BLI_remlink(&win->gesture, gesture);
MEM_freeN(gesture->customdata);
@@ -119,7 +120,7 @@ void WM_gestures_remove(bContext *C)
{
wmWindow *win= CTX_wm_window(C);
- while(win->gesture.first)
+ while (win->gesture.first)
WM_gesture_end(C, win->gesture.first);
}
@@ -127,32 +128,32 @@ void WM_gestures_remove(bContext *C)
/* tweak and line gestures */
int wm_gesture_evaluate(wmGesture *gesture)
{
- if(gesture->type==WM_GESTURE_TWEAK) {
+ if (gesture->type==WM_GESTURE_TWEAK) {
rcti *rect= gesture->customdata;
int dx= rect->xmax - rect->xmin;
int dy= rect->ymax - rect->ymin;
- if(ABS(dx)+ABS(dy) > U.tweak_threshold) {
+ if (ABS(dx)+ABS(dy) > U.tweak_threshold) {
int theta= (int)floor(4.0f*atan2f((float)dy, (float)dx)/(float)M_PI + 0.5f);
int val= EVT_GESTURE_W;
- if(theta==0) val= EVT_GESTURE_E;
- else if(theta==1) val= EVT_GESTURE_NE;
- else if(theta==2) val= EVT_GESTURE_N;
- else if(theta==3) val= EVT_GESTURE_NW;
- else if(theta==-1) val= EVT_GESTURE_SE;
- else if(theta==-2) val= EVT_GESTURE_S;
- else if(theta==-3) val= EVT_GESTURE_SW;
+ if (theta==0) val= EVT_GESTURE_E;
+ else if (theta==1) val= EVT_GESTURE_NE;
+ else if (theta==2) val= EVT_GESTURE_N;
+ else if (theta==3) val= EVT_GESTURE_NW;
+ else if (theta==-1) val= EVT_GESTURE_SE;
+ else if (theta==-2) val= EVT_GESTURE_S;
+ else if (theta==-3) val= EVT_GESTURE_SW;
#if 0
/* debug */
- if(val==1) printf("tweak north\n");
- if(val==2) printf("tweak north-east\n");
- if(val==3) printf("tweak east\n");
- if(val==4) printf("tweak south-east\n");
- if(val==5) printf("tweak south\n");
- if(val==6) printf("tweak south-west\n");
- if(val==7) printf("tweak west\n");
- if(val==8) printf("tweak north-west\n");
+ if (val==1) printf("tweak north\n");
+ if (val==2) printf("tweak north-east\n");
+ if (val==3) printf("tweak east\n");
+ if (val==4) printf("tweak south-east\n");
+ if (val==5) printf("tweak south\n");
+ if (val==6) printf("tweak south-west\n");
+ if (val==7) printf("tweak west\n");
+ if (val==8) printf("tweak north-west\n");
#endif
return val;
}
@@ -250,7 +251,7 @@ static void draw_filled_lasso(wmGesture *gt)
}
/* highly unlikely this will fail, but could crash if (gt->points == 0) */
- if(firstv) {
+ if (firstv) {
BLI_addfilledge(firstv, v);
BLI_edgefill(0);
@@ -280,9 +281,9 @@ static void wm_gesture_draw_lasso(wmGesture *gt)
glColor3ub(96, 96, 96);
glLineStipple(1, 0xAAAA);
glBegin(GL_LINE_STRIP);
- for(i=0; i<gt->points; i++, lasso+=2)
+ for (i=0; i<gt->points; i++, lasso+=2)
glVertex2sv(lasso);
- if(gt->type==WM_GESTURE_LASSO)
+ if (gt->type==WM_GESTURE_LASSO)
glVertex2sv((short *)gt->customdata);
glEnd();
@@ -290,9 +291,9 @@ static void wm_gesture_draw_lasso(wmGesture *gt)
glLineStipple(1, 0x5555);
glBegin(GL_LINE_STRIP);
lasso= (short *)gt->customdata;
- for(i=0; i<gt->points; i++, lasso+=2)
+ for (i=0; i<gt->points; i++, lasso+=2)
glVertex2sv(lasso);
- if(gt->type==WM_GESTURE_LASSO)
+ if (gt->type==WM_GESTURE_LASSO)
glVertex2sv((short *)gt->customdata);
glEnd();
@@ -322,27 +323,27 @@ void wm_gesture_draw(wmWindow *win)
{
wmGesture *gt= (wmGesture *)win->gesture.first;
- for(; gt; gt= gt->next) {
+ for (; gt; gt= gt->next) {
/* all in subwindow space */
wmSubWindowSet(win, gt->swinid);
- if(gt->type==WM_GESTURE_RECT)
+ if (gt->type==WM_GESTURE_RECT)
wm_gesture_draw_rect(gt);
-// else if(gt->type==WM_GESTURE_TWEAK)
+// else if (gt->type==WM_GESTURE_TWEAK)
// wm_gesture_draw_line(gt);
- else if(gt->type==WM_GESTURE_CIRCLE)
+ else if (gt->type==WM_GESTURE_CIRCLE)
wm_gesture_draw_circle(gt);
- else if(gt->type==WM_GESTURE_CROSS_RECT) {
- if(gt->mode==1)
+ else if (gt->type==WM_GESTURE_CROSS_RECT) {
+ if (gt->mode==1)
wm_gesture_draw_rect(gt);
else
wm_gesture_draw_cross(win, gt);
}
- else if(gt->type==WM_GESTURE_LINES)
+ else if (gt->type==WM_GESTURE_LINES)
wm_gesture_draw_lasso(gt);
- else if(gt->type==WM_GESTURE_LASSO)
+ else if (gt->type==WM_GESTURE_LASSO)
wm_gesture_draw_lasso(gt);
- else if(gt->type==WM_GESTURE_STRAIGHTLINE)
+ else if (gt->type==WM_GESTURE_STRAIGHTLINE)
wm_gesture_draw_line(gt);
}
}
@@ -353,7 +354,7 @@ void wm_gesture_tag_redraw(bContext *C)
bScreen *screen= CTX_wm_screen(C);
ARegion *ar= CTX_wm_region(C);
- if(screen)
+ if (screen)
screen->do_draw_gesture= 1;
wm_tag_redraw_overlay(win, ar);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index f5dec4dbcd3..0255a2249f5 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -193,7 +193,7 @@ void WM_init(bContext *C, int argc, const char **argv)
/* allow a path of "", this is what happens when making a new file */
#if 0
- if(G.main->name[0] == 0)
+ if (G.main->name[0] == 0)
BLI_make_file_string("/", G.main->name, BLI_getDefaultDocumentFolder(), "untitled.blend");
#endif
@@ -202,11 +202,11 @@ void WM_init(bContext *C, int argc, const char **argv)
void WM_init_splash(bContext *C)
{
- if((U.uiflag & USER_SPLASH_DISABLE) == 0) {
+ if ((U.uiflag & USER_SPLASH_DISABLE) == 0) {
wmWindowManager *wm= CTX_wm_manager(C);
wmWindow *prevwin= CTX_wm_window(C);
- if(wm->windows.first) {
+ if (wm->windows.first) {
CTX_wm_window_set(C, wm->windows.first);
WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL);
CTX_wm_window_set(C, prevwin);
@@ -233,7 +233,7 @@ int WM_init_game(bContext *C)
win = wm->windows.first;
//first to get a valid window
- if(win)
+ if (win)
CTX_wm_window_set(C, win);
sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0);
@@ -247,25 +247,25 @@ int WM_init_game(bContext *C)
CTX_wm_region_set(C, ar);
/* disable quad view */
- if(ar->alignment == RGN_ALIGN_QSPLIT)
+ if (ar->alignment == RGN_ALIGN_QSPLIT)
WM_operator_name_call(C, "SCREEN_OT_region_quadview", WM_OP_EXEC_DEFAULT, NULL);
/* toolbox, properties panel and header are hidden */
- for(arhide=sa->regionbase.first; arhide; arhide=arhide->next) {
- if(arhide->regiontype != RGN_TYPE_WINDOW) {
- if(!(arhide->flag & RGN_FLAG_HIDDEN)) {
+ for (arhide=sa->regionbase.first; arhide; arhide=arhide->next) {
+ if (arhide->regiontype != RGN_TYPE_WINDOW) {
+ if (!(arhide->flag & RGN_FLAG_HIDDEN)) {
ED_region_toggle_hidden(C, arhide);
}
}
}
/* full screen the area */
- if(!sa->full) {
+ if (!sa->full) {
ED_screen_full_toggle(C, win, sa);
}
/* Fullscreen */
- if((scene->gm.playerflag & GAME_PLAYER_FULLSCREEN)) {
+ if ((scene->gm.playerflag & GAME_PLAYER_FULLSCREEN)) {
WM_operator_name_call(C, "WM_OT_window_fullscreen_toggle", WM_OP_EXEC_DEFAULT, NULL);
wm_get_screensize(&ar->winrct.xmax, &ar->winrct.ymax);
ar->winx = ar->winrct.xmax + 1;
@@ -308,7 +308,7 @@ static void free_openrecent(void)
{
struct RecentFile *recent;
- for(recent = G.recent_files.first; recent; recent=recent->next)
+ for (recent = G.recent_files.first; recent; recent=recent->next)
MEM_freeN(recent->filepath);
BLI_freelistN(&(G.recent_files));
@@ -317,9 +317,6 @@ static void free_openrecent(void)
/* bad stuff*/
-extern wchar_t *copybuf;
-extern wchar_t *copybufinfo;
-
// XXX copy/paste buffer stuff...
extern void free_anim_copybuf(void);
extern void free_anim_drivers_copybuf(void);
@@ -338,11 +335,11 @@ void WM_exit_ext(bContext *C, const short do_python)
/* first wrap up running stuff, we assume only the active WM is running */
/* modal handlers are on window level freed, others too? */
/* note; same code copied in wm_files.c */
- if(C && CTX_wm_manager(C)) {
+ if (C && CTX_wm_manager(C)) {
WM_jobs_stop_all(CTX_wm_manager(C));
- for(win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
+ for (win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
WM_event_remove_handlers(C, &win->handlers);
@@ -355,7 +352,7 @@ void WM_exit_ext(bContext *C, const short do_python)
WM_menutype_free();
/* all non-screen and non-space stuff editors did, like editmode */
- if(C)
+ if (C)
ED_editors_exit(C);
// XXX
@@ -371,7 +368,7 @@ void WM_exit_ext(bContext *C, const short do_python)
ED_preview_free_dbase(); /* frees a Main dbase, before free_blender! */
- if(C && CTX_wm_manager(C))
+ if (C && CTX_wm_manager(C))
wm_free_reports(C); /* before free_blender! - since the ListBases get freed there */
seq_free_clipboard(); /* sequencer.c */
@@ -402,7 +399,7 @@ void WM_exit_ext(bContext *C, const short do_python)
#ifdef WITH_PYTHON
/* option not to close python so we can use 'atexit' */
- if(do_python) {
+ if (do_python) {
/* XXX - old note */
/* before free_blender so py's gc happens while library still exists */
/* needed at least for a rare sigsegv that can happen in pydrivers */
@@ -419,9 +416,7 @@ void WM_exit_ext(bContext *C, const short do_python)
GPU_global_buffer_pool_free();
GPU_free_unused_buffers();
GPU_extensions_exit();
-
-// if (copybuf) MEM_freeN(copybuf);
-// if (copybufinfo) MEM_freeN(copybufinfo);
+
if (!G.background) {
BKE_undo_save_quit(); // saves quit.blend if global undo is on
}
@@ -443,7 +438,7 @@ void WM_exit_ext(bContext *C, const short do_python)
GHOST_DisposeSystemPaths();
- if(MEM_get_memory_blocks_in_use()!=0) {
+ if (MEM_get_memory_blocks_in_use()!=0) {
printf("Error: Not freed memory blocks: %d\n", MEM_get_memory_blocks_in_use());
MEM_printmemlist();
}
@@ -453,7 +448,7 @@ void WM_exit_ext(bContext *C, const short do_python)
#ifdef WIN32
/* ask user to press enter when in debug mode */
- if(G.f & G_DEBUG) {
+ if (G.f & G_DEBUG) {
printf("press enter key to exit...\n\n");
getchar();
}
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 5e09a701755..4cef3f18e14 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -136,8 +136,8 @@ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const char *name)
{
wmJob *steve, *found=NULL;
- for(steve= wm->jobs.first; steve; steve= steve->next)
- if(steve->owner==owner) {
+ for (steve= wm->jobs.first; steve; steve= steve->next)
+ if (steve->owner==owner) {
found= steve;
if (name && strcmp(steve->name, name)==0)
return steve;
@@ -155,7 +155,7 @@ wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *
{
wmJob *steve= wm_job_find(wm, owner, name);
- if(steve==NULL) {
+ if (steve==NULL) {
steve= MEM_callocN(sizeof(wmJob), "new job");
BLI_addtail(&wm->jobs, steve);
@@ -173,9 +173,9 @@ int WM_jobs_test(wmWindowManager *wm, void *owner)
{
wmJob *steve;
- for(steve= wm->jobs.first; steve; steve= steve->next)
- if(steve->owner==owner)
- if(steve->running)
+ for (steve= wm->jobs.first; steve; steve= steve->next)
+ if (steve->owner==owner)
+ if (steve->running)
return 1;
return 0;
}
@@ -209,7 +209,8 @@ void* WM_jobs_get_customdata(wmJob * steve)
{
if (!steve->customdata) {
return steve->run_customdata;
- } else {
+ }
+ else {
return steve->customdata;
}
}
@@ -217,13 +218,13 @@ void* WM_jobs_get_customdata(wmJob * steve)
void WM_jobs_customdata(wmJob *steve, void *customdata, void (*free)(void *))
{
/* pending job? just free */
- if(steve->customdata)
+ if (steve->customdata)
steve->free(steve->customdata);
steve->customdata= customdata;
steve->free= free;
- if(steve->running) {
+ if (steve->running) {
/* signal job to end */
steve->stop= 1;
}
@@ -258,37 +259,37 @@ static void *do_job_thread(void *job_v)
return NULL;
}
-/* dont allow same startjob to be executed twice */
+/* don't allow same startjob to be executed twice */
static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
{
wmJob *steve;
int suspend= 0;
/* job added with suspend flag, we wait 1 timer step before activating it */
- if(test->flag & WM_JOB_SUSPEND) {
+ if (test->flag & WM_JOB_SUSPEND) {
suspend= 1;
test->flag &= ~WM_JOB_SUSPEND;
}
else {
/* check other jobs */
- for(steve= wm->jobs.first; steve; steve= steve->next) {
+ for (steve= wm->jobs.first; steve; steve= steve->next) {
/* obvious case, no test needed */
- if(steve==test || !steve->running) continue;
+ if (steve==test || !steve->running) continue;
/* if new job is not render, then check for same startjob */
- if(0==(test->flag & WM_JOB_EXCL_RENDER))
- if(steve->startjob!=test->startjob)
+ if (0==(test->flag & WM_JOB_EXCL_RENDER))
+ if (steve->startjob!=test->startjob)
continue;
/* if new job is render, any render job should be stopped */
- if(test->flag & WM_JOB_EXCL_RENDER)
- if(0==(steve->flag & WM_JOB_EXCL_RENDER))
+ if (test->flag & WM_JOB_EXCL_RENDER)
+ if (0==(steve->flag & WM_JOB_EXCL_RENDER))
continue;
suspend= 1;
/* if this job has higher priority, stop others */
- if(test->flag & WM_JOB_PRIORITY) {
+ if (test->flag & WM_JOB_PRIORITY) {
steve->stop= 1;
// printf("job stopped: %s\n", steve->name);
}
@@ -297,25 +298,25 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
/* possible suspend ourselfs, waiting for other jobs, or de-suspend */
test->suspended= suspend;
- // if(suspend) printf("job suspended: %s\n", test->name);
+ // if (suspend) printf("job suspended: %s\n", test->name);
}
/* if job running, the same owner gave it a new job */
/* if different owner starts existing startjob, it suspends itself */
void WM_jobs_start(wmWindowManager *wm, wmJob *steve)
{
- if(steve->running) {
+ if (steve->running) {
/* signal job to end and restart */
steve->stop= 1;
// printf("job started a running job, ending... %s\n", steve->name);
}
else {
- if(steve->customdata && steve->startjob) {
+ if (steve->customdata && steve->startjob) {
wm_jobs_test_suspend_stop(wm, steve);
- if(steve->suspended==0) {
+ if (steve->suspended==0) {
/* copy to ensure proper free in end */
steve->run_customdata= steve->customdata;
steve->run_free= steve->free;
@@ -323,7 +324,7 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *steve)
steve->customdata= NULL;
steve->running= 1;
- if(steve->initjob)
+ if (steve->initjob)
steve->initjob(steve->run_customdata);
steve->stop= 0;
@@ -337,7 +338,7 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *steve)
}
/* restarted job has timer already */
- if(steve->wt==NULL)
+ if (steve->wt==NULL)
steve->wt= WM_event_add_timer(wm, steve->win, TIMERJOBS, steve->timestep);
}
else printf("job fails, not initialized\n");
@@ -347,20 +348,20 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *steve)
/* stop job, free data completely */
static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *steve)
{
- if(steve->running) {
+ if (steve->running) {
/* signal job to end */
steve->stop= 1;
BLI_end_threads(&steve->threads);
- if(steve->endjob)
+ if (steve->endjob)
steve->endjob(steve->run_customdata);
}
- if(steve->wt)
+ if (steve->wt)
WM_event_remove_timer(wm, steve->win, steve->wt);
- if(steve->customdata)
+ if (steve->customdata)
steve->free(steve->customdata);
- if(steve->run_customdata)
+ if (steve->run_customdata)
steve->run_free(steve->run_customdata);
/* remove steve */
@@ -373,7 +374,7 @@ void WM_jobs_stop_all(wmWindowManager *wm)
{
wmJob *steve;
- while((steve= wm->jobs.first))
+ while ((steve= wm->jobs.first))
wm_jobs_kill_job(wm, steve);
}
@@ -383,9 +384,9 @@ void WM_jobs_stop(wmWindowManager *wm, void *owner, void *startjob)
{
wmJob *steve;
- for(steve= wm->jobs.first; steve; steve= steve->next)
- if(steve->owner==owner || steve->startjob==startjob)
- if(steve->running)
+ for (steve= wm->jobs.first; steve; steve= steve->next)
+ if (steve->owner==owner || steve->startjob==startjob)
+ if (steve->running)
steve->stop= 1;
}
@@ -395,12 +396,13 @@ void WM_jobs_kill(wmWindowManager *wm, void *owner, void (*startjob)(void *, sho
wmJob *steve;
steve= wm->jobs.first;
- while(steve) {
- if(steve->owner==owner || steve->startjob==startjob) {
+ while (steve) {
+ if (steve->owner==owner || steve->startjob==startjob) {
wmJob* bill = steve;
steve= steve->next;
wm_jobs_kill_job(wm, bill);
- } else {
+ }
+ else {
steve= steve->next;
}
}
@@ -412,8 +414,8 @@ void wm_jobs_timer_ended(wmWindowManager *wm, wmTimer *wt)
{
wmJob *steve;
- for(steve= wm->jobs.first; steve; steve= steve->next) {
- if(steve->wt==wt) {
+ for (steve= wm->jobs.first; steve; steve= steve->next) {
+ if (steve->wt==wt) {
wm_jobs_kill_job(wm, steve);
return;
}
@@ -428,19 +430,19 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
float jobs_progress=0;
- for(; steve; steve= stevenext) {
+ for (; steve; steve= stevenext) {
stevenext= steve->next;
- if(steve->wt==wt) {
+ if (steve->wt==wt) {
/* running threads */
- if(steve->threads.first) {
+ if (steve->threads.first) {
/* always call note and update when ready */
- if(steve->do_update || steve->ready) {
- if(steve->update)
+ if (steve->do_update || steve->ready) {
+ if (steve->update)
steve->update(steve->run_customdata);
- if(steve->note)
+ if (steve->note)
WM_event_add_notifier(C, steve->note, NULL);
if (steve->flag & WM_JOB_PROGRESS)
@@ -448,8 +450,8 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
steve->do_update= 0;
}
- if(steve->ready) {
- if(steve->endjob)
+ if (steve->ready) {
+ if (steve->endjob)
steve->endjob(steve->run_customdata);
/* free own data */
@@ -457,19 +459,19 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
steve->run_customdata= NULL;
steve->run_free= NULL;
- // if(steve->stop) printf("job ready but stopped %s\n", steve->name);
+ // if (steve->stop) printf("job ready but stopped %s\n", steve->name);
// else printf("job finished %s\n", steve->name);
steve->running= 0;
BLI_end_threads(&steve->threads);
- if(steve->endnote)
+ if (steve->endnote)
WM_event_add_notifier(C, steve->endnote, NULL);
WM_event_add_notifier(C, NC_WM|ND_JOB, NULL);
/* new job added for steve? */
- if(steve->customdata) {
+ if (steve->customdata) {
// printf("job restarted with new data %s\n", steve->name);
WM_jobs_start(wm, steve);
}
@@ -481,18 +483,19 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
BLI_remlink(&wm->jobs, steve);
MEM_freeN(steve);
}
- } else if (steve->flag & WM_JOB_PROGRESS) {
+ }
+ else if (steve->flag & WM_JOB_PROGRESS) {
/* accumulate global progress for running jobs */
jobs_progress++;
total_progress += steve->progress;
}
}
- else if(steve->suspended) {
+ else if (steve->suspended) {
WM_jobs_start(wm, steve);
}
}
- else if(steve->threads.first && !steve->ready) {
- if(steve->flag & WM_JOB_PROGRESS) {
+ else if (steve->threads.first && !steve->ready) {
+ if (steve->flag & WM_JOB_PROGRESS) {
/* accumulate global progress for running jobs */
jobs_progress++;
total_progress += steve->progress;
@@ -501,12 +504,13 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
}
/* on file load 'winactive' can be NULL, possibly it should not happen but for now do a NULL check - campbell */
- if(wm->winactive) {
+ if (wm->winactive) {
/* if there are running jobs, set the global progress indicator */
if (jobs_progress > 0) {
float progress = total_progress / (float)jobs_progress;
WM_progress_set(wm->winactive, progress);
- } else {
+ }
+ else {
WM_progress_clear(wm->winactive);
}
}
@@ -516,8 +520,8 @@ int WM_jobs_has_running(wmWindowManager *wm)
{
wmJob *steve;
- for(steve= wm->jobs.first; steve; steve= steve->next)
- if(steve->running)
+ for (steve= wm->jobs.first; steve; steve= steve->next)
+ if (steve->running)
return 1;
return 0;
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 107ebd8699c..8814a044901 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -70,7 +70,7 @@ static wmKeyMapItem *wm_keymap_item_copy(wmKeyMapItem *kmi)
kmin->prev= kmin->next= NULL;
kmin->flag &= ~KMI_UPDATE;
- if(kmin->properties) {
+ if (kmin->properties) {
kmin->ptr= MEM_callocN(sizeof(PointerRNA), "UserKeyMapItemPtr");
WM_operator_properties_create(kmin->ptr, kmin->idname);
@@ -84,7 +84,7 @@ static wmKeyMapItem *wm_keymap_item_copy(wmKeyMapItem *kmi)
static void wm_keymap_item_free(wmKeyMapItem *kmi)
{
/* not kmi itself */
- if(kmi->ptr) {
+ if (kmi->ptr) {
WM_operator_properties_free(kmi->ptr);
MEM_freeN(kmi->ptr);
}
@@ -98,14 +98,14 @@ static void wm_keymap_item_properties_set(wmKeyMapItem *kmi)
static int wm_keymap_item_equals_result(wmKeyMapItem *a, wmKeyMapItem *b)
{
- if(strcmp(a->idname, b->idname) != 0)
+ if (strcmp(a->idname, b->idname) != 0)
return 0;
- if(!((a->ptr==NULL && b->ptr==NULL) ||
+ 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))
+ if ((a->flag & KMI_INACTIVE) != (b->flag & KMI_INACTIVE))
return 0;
return (a->propvalue == b->propvalue);
@@ -144,9 +144,9 @@ static wmKeyMapDiffItem *wm_keymap_diff_item_copy(wmKeyMapDiffItem *kmdi)
wmKeyMapDiffItem *kmdin = MEM_dupallocN(kmdi);
kmdin->next = kmdin->prev = NULL;
- if(kmdi->add_item)
+ if (kmdi->add_item)
kmdin->add_item = wm_keymap_item_copy(kmdi->add_item);
- if(kmdi->remove_item)
+ if (kmdi->remove_item)
kmdin->remove_item = wm_keymap_item_copy(kmdi->remove_item);
return kmdin;
@@ -154,11 +154,11 @@ static wmKeyMapDiffItem *wm_keymap_diff_item_copy(wmKeyMapDiffItem *kmdi)
static void wm_keymap_diff_item_free(wmKeyMapDiffItem *kmdi)
{
- if(kmdi->remove_item) {
+ if (kmdi->remove_item) {
wm_keymap_item_free(kmdi->remove_item);
MEM_freeN(kmdi->remove_item);
}
- if(kmdi->add_item) {
+ if (kmdi->add_item) {
wm_keymap_item_free(kmdi->add_item);
MEM_freeN(kmdi->add_item);
}
@@ -205,7 +205,7 @@ void WM_keyconfig_free(wmKeyConfig *keyconf)
{
wmKeyMap *km;
- while((km= keyconf->keymaps.first)) {
+ while ((km= keyconf->keymaps.first)) {
WM_keymap_free(km);
BLI_freelinkN(&keyconf->keymaps, km);
}
@@ -217,8 +217,8 @@ static wmKeyConfig *wm_keyconfig_list_find(ListBase *lb, char *idname)
{
wmKeyConfig *kc;
- for(kc= lb->first; kc; kc= kc->next)
- if(0==strncmp(idname, kc->idname, KMAP_MAX_NAME))
+ for (kc= lb->first; kc; kc= kc->next)
+ if (0==strncmp(idname, kc->idname, KMAP_MAX_NAME))
return kc;
return NULL;
@@ -230,7 +230,7 @@ static wmKeyConfig *WM_keyconfig_active(wmWindowManager *wm)
/* first try from preset */
keyconf= wm_keyconfig_list_find(&wm->keyconfigs, U.keyconfigstr);
- if(keyconf)
+ if (keyconf)
return keyconf;
/* otherwise use default */
@@ -275,12 +275,12 @@ static wmKeyMap *wm_keymap_copy(wmKeyMap *keymap)
keymapn->items.first= keymapn->items.last= NULL;
keymapn->flag &= ~(KEYMAP_UPDATE|KEYMAP_EXPANDED);
- for(kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
+ for (kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
kmdin= wm_keymap_diff_item_copy(kmdi);
BLI_addtail(&keymapn->items, kmdin);
}
- for(kmi=keymap->items.first; kmi; kmi=kmi->next) {
+ for (kmi=keymap->items.first; kmi; kmi=kmi->next) {
kmin= wm_keymap_item_copy(kmi);
BLI_addtail(&keymapn->items, kmin);
}
@@ -293,10 +293,10 @@ void WM_keymap_free(wmKeyMap *keymap)
wmKeyMapItem *kmi;
wmKeyMapDiffItem *kmdi;
- for(kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next)
+ for (kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next)
wm_keymap_diff_item_free(kmdi);
- for(kmi=keymap->items.first; kmi; kmi=kmi->next)
+ for (kmi=keymap->items.first; kmi; kmi=kmi->next)
wm_keymap_item_free(kmi);
BLI_freelistN(&keymap->diff_items);
@@ -309,7 +309,7 @@ static void keymap_event_set(wmKeyMapItem *kmi, short type, short val, int modif
kmi->val= val;
kmi->keymodifier= keymodifier;
- if(modifier == KM_ANY) {
+ if (modifier == KM_ANY) {
kmi->shift= kmi->ctrl= kmi->alt= kmi->oskey= KM_ANY;
}
else {
@@ -325,7 +325,8 @@ static void keymap_item_set_id(wmKeyMap *keymap, wmKeyMapItem *kmi)
keymap->kmi_id++;
if ((keymap->flag & KEYMAP_USER) == 0) {
kmi->id = keymap->kmi_id;
- } else {
+ }
+ else {
kmi->id = -keymap->kmi_id; // User defined keymap entries have negative ids
}
}
@@ -335,11 +336,11 @@ wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, const char *idname, int ty
{
wmKeyMapItem *kmi;
- for(kmi= keymap->items.first; kmi; kmi= kmi->next)
- if(strncmp(kmi->idname, idname, OP_MAX_TYPENAME)==0)
+ for (kmi = keymap->items.first; kmi; kmi = kmi->next)
+ if (strncmp(kmi->idname, idname, OP_MAX_TYPENAME)==0)
break;
- if(kmi==NULL) {
- kmi= MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
+ if (kmi==NULL) {
+ kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
BLI_addtail(&keymap->items, kmi);
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
@@ -355,7 +356,7 @@ wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, const char *idname, int ty
/* always add item */
wmKeyMapItem *WM_keymap_add_item(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
{
- wmKeyMapItem *kmi= MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
+ wmKeyMapItem *kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
BLI_addtail(&keymap->items, kmi);
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
@@ -373,15 +374,15 @@ wmKeyMapItem *WM_keymap_add_item(wmKeyMap *keymap, const char *idname, int type,
/* menu wrapper for WM_keymap_add_item */
wmKeyMapItem *WM_keymap_add_menu(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
{
- wmKeyMapItem *kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", type, val, modifier, keymodifier);
+ wmKeyMapItem *kmi = WM_keymap_add_item(keymap, "WM_OT_call_menu", type, val, modifier, keymodifier);
RNA_string_set(kmi->ptr, "name", idname);
return kmi;
}
void WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
{
- if(BLI_findindex(&keymap->items, kmi) != -1) {
- if(kmi->ptr) {
+ if (BLI_findindex(&keymap->items, kmi) != -1) {
+ if (kmi->ptr) {
WM_operator_properties_free(kmi->ptr);
MEM_freeN(kmi->ptr);
}
@@ -401,7 +402,7 @@ static void wm_keymap_addon_add(wmKeyMap *keymap, wmKeyMap *addonmap)
{
wmKeyMapItem *kmi, *kmin;
- for(kmi=addonmap->items.first; kmi; kmi=kmi->next) {
+ for (kmi=addonmap->items.first; kmi; kmi=kmi->next) {
kmin = wm_keymap_item_copy(kmi);
keymap_item_set_id(keymap, kmin);
BLI_addhead(&keymap->items, kmin);
@@ -412,8 +413,8 @@ static wmKeyMapItem *wm_keymap_find_item_equals(wmKeyMap *km, wmKeyMapItem *need
{
wmKeyMapItem *kmi;
- for(kmi=km->items.first; kmi; kmi=kmi->next)
- if(wm_keymap_item_equals(kmi, needle))
+ for (kmi=km->items.first; kmi; kmi=kmi->next)
+ if (wm_keymap_item_equals(kmi, needle))
return kmi;
return NULL;
@@ -423,8 +424,8 @@ static wmKeyMapItem *wm_keymap_find_item_equals_result(wmKeyMap *km, wmKeyMapIte
{
wmKeyMapItem *kmi;
- for(kmi=km->items.first; kmi; kmi=kmi->next)
- if(wm_keymap_item_equals_result(kmi, needle))
+ for (kmi=km->items.first; kmi; kmi=kmi->next)
+ if (wm_keymap_item_equals_result(kmi, needle))
return kmi;
return NULL;
@@ -435,16 +436,16 @@ static void wm_keymap_diff(wmKeyMap *diff_km, wmKeyMap *from_km, wmKeyMap *to_km
wmKeyMapItem *kmi, *to_kmi, *orig_kmi;
wmKeyMapDiffItem *kmdi;
- for(kmi=from_km->items.first; kmi; kmi=kmi->next) {
+ for (kmi=from_km->items.first; kmi; kmi=kmi->next) {
to_kmi = WM_keymap_item_find_id(to_km, kmi->id);
- if(!to_kmi) {
+ if (!to_kmi) {
/* remove item */
kmdi = MEM_callocN(sizeof(wmKeyMapDiffItem), "wmKeyMapDiffItem");
kmdi->remove_item = wm_keymap_item_copy(kmi);
BLI_addtail(&diff_km->diff_items, kmdi);
}
- else if(to_kmi && !wm_keymap_item_equals(kmi, to_kmi)) {
+ else if (to_kmi && !wm_keymap_item_equals(kmi, to_kmi)) {
/* replace item */
kmdi = MEM_callocN(sizeof(wmKeyMapDiffItem), "wmKeyMapDiffItem");
kmdi->remove_item = wm_keymap_item_copy(kmi);
@@ -453,21 +454,21 @@ static void wm_keymap_diff(wmKeyMap *diff_km, wmKeyMap *from_km, wmKeyMap *to_km
}
/* sync expanded flag back to original so we don't loose it on repatch */
- if(to_kmi) {
+ if (to_kmi) {
orig_kmi = WM_keymap_item_find_id(orig_km, kmi->id);
- if(!orig_kmi)
+ if (!orig_kmi)
orig_kmi = wm_keymap_find_item_equals(addon_km, kmi);
- if(orig_kmi) {
+ if (orig_kmi) {
orig_kmi->flag &= ~KMI_EXPANDED;
orig_kmi->flag |= (to_kmi->flag & KMI_EXPANDED);
}
}
}
- for(kmi=to_km->items.first; kmi; kmi=kmi->next) {
- if(kmi->id < 0) {
+ for (kmi=to_km->items.first; kmi; kmi=kmi->next) {
+ if (kmi->id < 0) {
/* add item */
kmdi = MEM_callocN(sizeof(wmKeyMapDiffItem), "wmKeyMapDiffItem");
kmdi->add_item = wm_keymap_item_copy(kmi);
@@ -481,23 +482,23 @@ static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km)
wmKeyMapDiffItem *kmdi;
wmKeyMapItem *kmi_remove, *kmi_add;
- for(kmdi=diff_km->diff_items.first; kmdi; kmdi=kmdi->next) {
+ for (kmdi=diff_km->diff_items.first; kmdi; kmdi=kmdi->next) {
/* find item to remove */
kmi_remove = NULL;
- if(kmdi->remove_item) {
+ if (kmdi->remove_item) {
kmi_remove = wm_keymap_find_item_equals(km, kmdi->remove_item);
- if(!kmi_remove)
+ if (!kmi_remove)
kmi_remove = wm_keymap_find_item_equals_result(km, kmdi->remove_item);
}
/* add item */
- if(kmdi->add_item) {
+ if (kmdi->add_item) {
/* only if nothing to remove or item to remove found */
- if(!kmdi->remove_item || kmi_remove) {
+ if (!kmdi->remove_item || kmi_remove) {
kmi_add = wm_keymap_item_copy(kmdi->add_item);
kmi_add->flag |= KMI_USER_MODIFIED;
- if(kmi_remove) {
+ if (kmi_remove) {
kmi_add->flag &= ~KMI_EXPANDED;
kmi_add->flag |= (kmi_remove->flag & KMI_EXPANDED);
kmi_add->id = kmi_remove->id;
@@ -511,7 +512,7 @@ static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km)
}
/* remove item */
- if(kmi_remove) {
+ if (kmi_remove) {
wm_keymap_item_free(kmi_remove);
BLI_freelinkN(&km->items, kmi_remove);
}
@@ -525,14 +526,14 @@ static wmKeyMap *wm_keymap_patch_update(ListBase *lb, wmKeyMap *defaultmap, wmKe
/* remove previous keymap in list, we will replace it */
km = WM_keymap_list_find(lb, defaultmap->idname, defaultmap->spaceid, defaultmap->regionid);
- if(km) {
+ if (km) {
expanded = (km->flag & (KEYMAP_EXPANDED|KEYMAP_CHILDREN_EXPANDED));
WM_keymap_free(km);
BLI_freelinkN(lb, km);
}
/* copy new keymap from an existing one */
- if(usermap && !(usermap->flag & KEYMAP_DIFF)) {
+ if (usermap && !(usermap->flag & KEYMAP_DIFF)) {
/* for compatibiltiy with old user preferences with non-diff
* keymaps we override the original entirely */
wmKeyMapItem *kmi, *orig_kmi;
@@ -540,12 +541,12 @@ static wmKeyMap *wm_keymap_patch_update(ListBase *lb, wmKeyMap *defaultmap, wmKe
km = wm_keymap_copy(usermap);
/* try to find corresponding id's for items */
- for(kmi=km->items.first; kmi; kmi=kmi->next) {
+ for (kmi=km->items.first; kmi; kmi=kmi->next) {
orig_kmi = wm_keymap_find_item_equals(defaultmap, kmi);
- if(!orig_kmi)
+ if (!orig_kmi)
orig_kmi = wm_keymap_find_item_equals_result(defaultmap, kmi);
- if(orig_kmi)
+ if (orig_kmi)
kmi->id = orig_kmi->id;
else
kmi->id = -(km->kmi_id++);
@@ -557,16 +558,16 @@ static wmKeyMap *wm_keymap_patch_update(ListBase *lb, wmKeyMap *defaultmap, wmKe
km = wm_keymap_copy(defaultmap);
/* add addon keymap items */
- if(addonmap)
+ if (addonmap)
wm_keymap_addon_add(km, addonmap);
/* tag as being user edited */
- if(usermap)
+ if (usermap)
km->flag |= KEYMAP_USER_MODIFIED;
km->flag |= KEYMAP_USER|expanded;
/* apply user changes of diff keymap */
- if(usermap && (usermap->flag & KEYMAP_DIFF))
+ if (usermap && (usermap->flag & KEYMAP_DIFF))
wm_keymap_patch(km, usermap);
/* add to list */
@@ -582,14 +583,14 @@ static void wm_keymap_diff_update(ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *
/* create temporary default + addon keymap for diff */
origmap = defaultmap;
- if(addonmap) {
+ if (addonmap) {
defaultmap = wm_keymap_copy(defaultmap);
wm_keymap_addon_add(defaultmap, addonmap);
}
/* remove previous diff keymap in list, we will replace it */
prevmap = WM_keymap_list_find(lb, km->idname, km->spaceid, km->regionid);
- if(prevmap) {
+ if (prevmap) {
WM_keymap_free(prevmap);
BLI_freelinkN(lb, prevmap);
}
@@ -597,12 +598,12 @@ static void wm_keymap_diff_update(ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *
/* create diff keymap */
diffmap= wm_keymap_new(km->idname, km->spaceid, km->regionid);
diffmap->flag |= KEYMAP_DIFF;
- if(defaultmap->flag & KEYMAP_MODAL)
+ if (defaultmap->flag & KEYMAP_MODAL)
diffmap->flag |= KEYMAP_MODAL;
wm_keymap_diff(diffmap, defaultmap, km, origmap, addonmap);
/* add to list if not empty */
- if(diffmap->diff_items.first) {
+ if (diffmap->diff_items.first) {
BLI_addtail(lb, diffmap);
}
else {
@@ -611,7 +612,7 @@ static void wm_keymap_diff_update(ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *
}
/* free temporary default map */
- if(addonmap) {
+ if (addonmap) {
WM_keymap_free(defaultmap);
MEM_freeN(defaultmap);
}
@@ -627,9 +628,9 @@ wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int
{
wmKeyMap *km;
- for(km= lb->first; km; km= km->next)
- if(km->spaceid==spaceid && km->regionid==regionid)
- if(0==strncmp(idname, km->idname, KMAP_MAX_NAME))
+ for (km= lb->first; km; km= km->next)
+ if (km->spaceid==spaceid && km->regionid==regionid)
+ if (0==strncmp(idname, km->idname, KMAP_MAX_NAME))
return km;
return NULL;
@@ -639,7 +640,7 @@ wmKeyMap *WM_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid,
{
wmKeyMap *km= WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
- if(km==NULL) {
+ if (km==NULL) {
km= wm_keymap_new(idname, spaceid, regionid);
BLI_addtail(&keyconf->keymaps, km);
@@ -666,12 +667,12 @@ wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, const char *idname, EnumPrope
km->flag |= KEYMAP_MODAL;
km->modal_items= items;
- if(!items) {
+ if (!items) {
/* init modal items from default config */
wmWindowManager *wm = G.main->wm.first;
wmKeyMap *defaultkm= WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, 0, 0);
- if(defaultkm) {
+ if (defaultkm) {
km->modal_items = defaultkm->modal_items;
km->poll = defaultkm->poll;
}
@@ -684,9 +685,9 @@ wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, const char *idname)
{
wmKeyMap *km;
- for(km= keyconf->keymaps.first; km; km= km->next)
- if(km->flag & KEYMAP_MODAL)
- if(0==strncmp(idname, km->idname, KMAP_MAX_NAME))
+ for (km= keyconf->keymaps.first; km; km= km->next)
+ if (km->flag & KEYMAP_MODAL)
+ if (0==strncmp(idname, km->idname, KMAP_MAX_NAME))
break;
return km;
@@ -695,7 +696,7 @@ wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, const char *idname)
wmKeyMapItem *WM_modalkeymap_add_item(wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value)
{
- wmKeyMapItem *kmi= MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
+ wmKeyMapItem *kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
BLI_addtail(&km->items, kmi);
kmi->propvalue= value;
@@ -713,8 +714,8 @@ void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
{
wmOperatorType *ot= WM_operatortype_find(opname, 0);
- if(ot)
- ot->modalkeymap= km;
+ if (ot)
+ ot->modalkeymap = km;
else
printf("error: modalkeymap_assign, unknown operator %s\n", opname);
}
@@ -724,7 +725,7 @@ void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
const char *WM_key_event_string(short type)
{
const char *name= NULL;
- if(RNA_enum_name(event_type_items, (int)type, &name))
+ if (RNA_enum_name(event_type_items, (int)type, &name))
return name;
return "";
@@ -742,21 +743,22 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
kmi->oskey == KM_ANY) {
strcat(buf, "Any ");
- } else {
- if(kmi->shift)
+ }
+ else {
+ if (kmi->shift)
strcat(buf, "Shift ");
- if(kmi->ctrl)
+ if (kmi->ctrl)
strcat(buf, "Ctrl ");
- if(kmi->alt)
+ if (kmi->alt)
strcat(buf, "Alt ");
- if(kmi->oskey)
+ if (kmi->oskey)
strcat(buf, "Cmd ");
}
- if(kmi->keymodifier) {
+ if (kmi->keymodifier) {
strcat(buf, WM_key_event_string(kmi->keymodifier));
strcat(buf, " ");
}
@@ -777,25 +779,25 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
wmKeyMapItem *kmi;
/* find keymap item in handlers */
- for(handler=handlers->first; handler; handler=handler->next) {
+ for (handler=handlers->first; handler; handler=handler->next) {
keymap= WM_keymap_active(wm, handler->keymap);
- if(keymap && (!keymap->poll || keymap->poll((bContext*)C))) {
- for(kmi=keymap->items.first; kmi; kmi=kmi->next) {
+ if (keymap && (!keymap->poll || keymap->poll((bContext*)C))) {
+ for (kmi=keymap->items.first; kmi; kmi=kmi->next) {
- if(strcmp(kmi->idname, opname) == 0 && WM_key_event_string(kmi->type)[0]) {
+ if (strcmp(kmi->idname, opname) == 0 && WM_key_event_string(kmi->type)[0]) {
if (hotkey)
if (!ISHOTKEY(kmi->type))
continue;
- if(compare_props) {
- if(kmi->ptr && IDP_EqualsProperties(properties, kmi->ptr->data)) {
- if(keymap_r) *keymap_r= keymap;
+ if (compare_props) {
+ if (kmi->ptr && IDP_EqualsProperties(properties, kmi->ptr->data)) {
+ if (keymap_r) *keymap_r= keymap;
return kmi;
}
}
else {
- if(keymap_r) *keymap_r= keymap;
+ if (keymap_r) *keymap_r= keymap;
return kmi;
}
}
@@ -804,7 +806,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
}
/* ensure un-initialized keymap is never used */
- if(keymap_r) *keymap_r= NULL;
+ if (keymap_r) *keymap_r= NULL;
return NULL;
}
@@ -818,39 +820,39 @@ static wmKeyMapItem *wm_keymap_item_find_props(
wmKeyMapItem *found= NULL;
/* look into multiple handler lists to find the item */
- if(win)
+ if (win)
found= wm_keymap_item_find_handlers(C, &win->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
- if(sa && found==NULL)
+ if (sa && found==NULL)
found= wm_keymap_item_find_handlers(C, &sa->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
- if(found==NULL) {
- if(ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
- if(sa) {
+ if (found==NULL) {
+ if (ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
+ if (sa) {
if (!(ar && ar->regiontype == RGN_TYPE_WINDOW))
ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if(ar)
+ if (ar)
found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
}
}
- else if(ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) {
+ else if (ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) {
if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS))
ar= BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
- if(ar)
+ if (ar)
found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
}
- else if(ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) {
+ else if (ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) {
if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW))
ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
- if(ar)
+ if (ar)
found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
}
else {
- if(ar)
+ if (ar)
found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
}
}
@@ -864,7 +866,7 @@ static wmKeyMapItem *wm_keymap_item_find(
{
wmKeyMapItem *found= wm_keymap_item_find_props(C, opname, opcontext, properties, 1, hotkey, keymap_r);
- if(!found && sloppy)
+ if (!found && sloppy)
found= wm_keymap_item_find_props(C, opname, opcontext, NULL, 0, hotkey, keymap_r);
return found;
@@ -874,9 +876,9 @@ char *WM_key_event_operator_string(
const bContext *C, const char *opname, int opcontext,
IDProperty *properties, const short sloppy, char *str, int len)
{
- wmKeyMapItem *kmi= wm_keymap_item_find(C, opname, opcontext, properties, 0, sloppy, NULL);
+ wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, 0, sloppy, NULL);
- if(kmi) {
+ if (kmi) {
WM_keymap_item_to_string(kmi, str, len);
return str;
}
@@ -888,9 +890,9 @@ int WM_key_event_operator_id(
const bContext *C, const char *opname, int opcontext,
IDProperty *properties, int hotkey, wmKeyMap **keymap_r)
{
- wmKeyMapItem *kmi= wm_keymap_item_find(C, opname, opcontext, properties, hotkey, TRUE, keymap_r);
+ wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, hotkey, TRUE, keymap_r);
- if(kmi)
+ if (kmi)
return kmi->id;
else
return 0;
@@ -907,10 +909,10 @@ int WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
k1type = WM_userdef_event_map(k1->type);
k2type = WM_userdef_event_map(k2->type);
- if(k1type != KM_ANY && k2type != KM_ANY && k1type != k2type)
+ if (k1type != KM_ANY && k2type != KM_ANY && k1type != k2type)
return 0;
- if(k1->val != KM_ANY && k2->val != KM_ANY) {
+ if (k1->val != KM_ANY && k2->val != KM_ANY) {
/* take click, press, release conflict into account */
if (k1->val == KM_CLICK && ELEM3(k2->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0)
return 0;
@@ -920,19 +922,19 @@ int WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
return 0;
}
- if(k1->shift != KM_ANY && k2->shift != KM_ANY && k1->shift != k2->shift)
+ if (k1->shift != KM_ANY && k2->shift != KM_ANY && k1->shift != k2->shift)
return 0;
- if(k1->ctrl != KM_ANY && k2->ctrl != KM_ANY && k1->ctrl != k2->ctrl)
+ if (k1->ctrl != KM_ANY && k2->ctrl != KM_ANY && k1->ctrl != k2->ctrl)
return 0;
- if(k1->alt != KM_ANY && k2->alt != KM_ANY && k1->alt != k2->alt)
+ if (k1->alt != KM_ANY && k2->alt != KM_ANY && k1->alt != k2->alt)
return 0;
- if(k1->oskey != KM_ANY && k2->oskey != KM_ANY && k1->oskey != k2->oskey)
+ if (k1->oskey != KM_ANY && k2->oskey != KM_ANY && k1->oskey != k2->oskey)
return 0;
- if(k1->keymodifier != k2->keymodifier)
+ if (k1->keymodifier != k2->keymodifier)
return 0;
return 1;
@@ -950,9 +952,9 @@ void WM_keyconfig_update_tag(wmKeyMap *km, wmKeyMapItem *kmi)
/* quick tag to do delayed keymap updates */
WM_KEYMAP_UPDATE= 1;
- if(km)
+ if (km)
km->flag |= KEYMAP_UPDATE;
- if(kmi)
+ if (kmi)
kmi->flag |= KMI_UPDATE;
}
@@ -964,7 +966,7 @@ static int wm_keymap_test_and_clear_update(wmKeyMap *km)
update= (km->flag & KEYMAP_UPDATE);
km->flag &= ~KEYMAP_UPDATE;
- for(kmi=km->items.first; kmi; kmi=kmi->next) {
+ for (kmi=km->items.first; kmi; kmi=kmi->next) {
update= update || (kmi->flag & KMI_UPDATE);
kmi->flag &= ~KMI_UPDATE;
}
@@ -978,7 +980,7 @@ static wmKeyMap *wm_keymap_preset(wmWindowManager *wm, wmKeyMap *km)
wmKeyMap *keymap;
keymap= WM_keymap_list_find(&keyconf->keymaps, km->idname, km->spaceid, km->regionid);
- if(!keymap)
+ if (!keymap)
keymap= WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, km->spaceid, km->regionid);
return keymap;
@@ -991,42 +993,42 @@ void WM_keyconfig_update(wmWindowManager *wm)
wmKeyMapDiffItem *kmdi;
int compat_update = 0;
- if(G.background)
+ if (G.background)
return;
- if(!WM_KEYMAP_UPDATE)
+ if (!WM_KEYMAP_UPDATE)
return;
/* update operator properties for non-modal user keymaps */
- for(km=U.user_keymaps.first; km; km=km->next) {
- if((km->flag & KEYMAP_MODAL) == 0) {
- for(kmdi=km->diff_items.first; kmdi; kmdi=kmdi->next) {
- if(kmdi->add_item)
+ for (km=U.user_keymaps.first; km; km=km->next) {
+ if ((km->flag & KEYMAP_MODAL) == 0) {
+ for (kmdi=km->diff_items.first; kmdi; kmdi=kmdi->next) {
+ if (kmdi->add_item)
wm_keymap_item_properties_set(kmdi->add_item);
- if(kmdi->remove_item)
+ if (kmdi->remove_item)
wm_keymap_item_properties_set(kmdi->remove_item);
}
- for(kmi=km->items.first; kmi; kmi=kmi->next)
+ for (kmi=km->items.first; kmi; kmi=kmi->next)
wm_keymap_item_properties_set(kmi);
}
}
/* update U.user_keymaps with user key configuration changes */
- for(km=wm->userconf->keymaps.first; km; km=km->next) {
+ for (km=wm->userconf->keymaps.first; km; km=km->next) {
/* only diff if the user keymap was modified */
- if(wm_keymap_test_and_clear_update(km)) {
+ if (wm_keymap_test_and_clear_update(km)) {
/* find keymaps */
defaultmap= wm_keymap_preset(wm, km);
addonmap= WM_keymap_list_find(&wm->addonconf->keymaps, km->idname, km->spaceid, km->regionid);
/* diff */
- if(defaultmap)
+ if (defaultmap)
wm_keymap_diff_update(&U.user_keymaps, defaultmap, addonmap, km);
}
}
/* create user key configuration from preset + addon + user preferences */
- for(km=wm->defaultconf->keymaps.first; km; km=km->next) {
+ for (km=wm->defaultconf->keymaps.first; km; km=km->next) {
/* find keymaps */
defaultmap= wm_keymap_preset(wm, km);
addonmap= WM_keymap_list_find(&wm->addonconf->keymaps, km->idname, km->spaceid, km->regionid);
@@ -1035,7 +1037,7 @@ void WM_keyconfig_update(wmWindowManager *wm)
/* add */
kmn= wm_keymap_patch_update(&wm->userconf->keymaps, defaultmap, addonmap, usermap);
- if(kmn) {
+ if (kmn) {
kmn->modal_items= km->modal_items;
kmn->poll= km->poll;
}
@@ -1046,7 +1048,7 @@ void WM_keyconfig_update(wmWindowManager *wm)
WM_KEYMAP_UPDATE= 0;
- if(compat_update) {
+ if (compat_update) {
WM_keyconfig_update_tag(NULL, NULL);
WM_keyconfig_update(wm);
}
@@ -1061,13 +1063,13 @@ wmKeyMap *WM_keymap_active(wmWindowManager *wm, wmKeyMap *keymap)
{
wmKeyMap *km;
- if(!keymap)
+ if (!keymap)
return NULL;
/* first user defined keymaps */
km= WM_keymap_list_find(&wm->userconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
- if(km)
+ if (km)
return km;
return keymap;
@@ -1082,14 +1084,14 @@ void WM_keymap_restore_item_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
wmKeyMap *defaultmap, *addonmap;
wmKeyMapItem *orig;
- if(!keymap)
+ if (!keymap)
return;
/* construct default keymap from preset + addons */
defaultmap= wm_keymap_preset(wm, keymap);
addonmap= WM_keymap_list_find(&wm->addonconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
- if(addonmap) {
+ if (addonmap) {
defaultmap = wm_keymap_copy(defaultmap);
wm_keymap_addon_add(defaultmap, addonmap);
}
@@ -1097,15 +1099,15 @@ void WM_keymap_restore_item_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
/* find original item */
orig = WM_keymap_item_find_id(defaultmap, kmi->id);
- if(orig) {
+ if (orig) {
/* restore to original */
- if(strcmp(orig->idname, kmi->idname) != 0) {
+ if (strcmp(orig->idname, kmi->idname) != 0) {
BLI_strncpy(kmi->idname, orig->idname, sizeof(kmi->idname));
WM_keymap_properties_reset(kmi, NULL);
}
if (orig->properties) {
- if(kmi->properties) {
+ if (kmi->properties) {
IDP_FreeProperty(kmi->properties);
MEM_freeN(kmi->properties);
kmi->properties= NULL;
@@ -1129,7 +1131,7 @@ void WM_keymap_restore_item_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
}
/* free temporary keymap */
- if(addonmap) {
+ if (addonmap) {
WM_keymap_free(defaultmap);
MEM_freeN(defaultmap);
}
@@ -1143,7 +1145,7 @@ void WM_keymap_restore_to_default(wmKeyMap *keymap, bContext *C)
/* remove keymap from U.user_keymaps and update */
usermap= WM_keymap_list_find(&U.user_keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
- if(usermap) {
+ if (usermap) {
WM_keymap_free(usermap);
BLI_freelinkN(&U.user_keymaps, usermap);
@@ -1204,7 +1206,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
km = WM_keymap_find_all(C, "Mesh", 0, 0);
/* some mesh operators are active in object mode too, like add-prim */
- if(km && km->poll && km->poll((bContext *)C)==0) {
+ if (km && km->poll && km->poll((bContext *)C)==0) {
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
}
}
@@ -1212,7 +1214,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
km = WM_keymap_find_all(C, "Curve", 0, 0);
/* some curve operators are active in object mode too, like add-prim */
- if(km && km->poll && km->poll((bContext *)C)==0) {
+ if (km && km->poll && km->poll((bContext *)C)==0) {
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
}
}
@@ -1236,7 +1238,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
km = WM_keymap_find_all(C, "Metaball", 0, 0);
/* some mball operators are active in object mode too, like add-prim */
- if(km && km->poll && km->poll((bContext *)C)==0) {
+ if (km && km->poll && km->poll((bContext *)C)==0) {
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
}
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 22e6d5be383..a973eb4fe2c 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -108,7 +108,7 @@ static GHash *global_ops_hash= NULL;
wmOperatorType *WM_operatortype_find(const char *idname, int quiet)
{
- if(idname[0]) {
+ if (idname[0]) {
wmOperatorType *ot;
/* needed to support python style names without the _OT_ syntax */
@@ -116,16 +116,16 @@ wmOperatorType *WM_operatortype_find(const char *idname, int quiet)
WM_operator_bl_idname(idname_bl, idname);
ot= BLI_ghash_lookup(global_ops_hash, idname_bl);
- if(ot) {
+ if (ot) {
return ot;
}
- if(!quiet) {
+ if (!quiet) {
printf("search for unknown operator '%s', '%s'\n", idname_bl, idname);
}
}
else {
- if(!quiet) {
+ if (!quiet) {
printf("search for empty operator\n");
}
}
@@ -145,17 +145,18 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType*))
wmOperatorType *ot;
ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
- ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+ ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+ /* Set the default i18n context now, so that opfunc can redefine it if needed! */
+ RNA_def_struct_translation_context(ot->srna, WM_OPERATOR_DEFAULT_I18NCONTEXT);
opfunc(ot);
- if(ot->name==NULL) {
+ if (ot->name==NULL) {
fprintf(stderr, "ERROR: Operator %s has no name property!\n", ot->idname);
- ot->name= IFACE_("Dummy Name");
+ ot->name = N_("Dummy Name");
}
// XXX All ops should have a description but for now allow them not to.
- RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:IFACE_("(undocumented operator)"));
-
+ RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:N_("(undocumented operator)"));
RNA_def_struct_identifier(ot->srna, ot->idname);
BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
@@ -166,9 +167,11 @@ void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType*, void*), void *us
wmOperatorType *ot;
ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
- ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+ ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+ /* Set the default i18n context now, so that opfunc can redefine it if needed! */
+ RNA_def_struct_translation_context(ot->srna, WM_OPERATOR_DEFAULT_I18NCONTEXT);
opfunc(ot, userdata);
- RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:IFACE_("(undocumented operator)"));
+ RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:N_("(undocumented operator)"));
RNA_def_struct_identifier(ot->srna, ot->idname);
BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
@@ -217,16 +220,17 @@ static int wm_macro_exec(bContext *C, wmOperator *op)
wm_macro_start(op);
- for(opm= op->macro.first; opm; opm= opm->next) {
+ for (opm= op->macro.first; opm; opm= opm->next) {
- if(opm->type->exec) {
+ if (opm->type->exec) {
retval= opm->type->exec(C, opm);
OPERATOR_RETVAL_CHECK(retval);
if (retval & OPERATOR_FINISHED) {
MacroData *md = op->customdata;
md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
- } else {
+ }
+ else {
break; /* operator didn't finish, end macro */
}
}
@@ -240,10 +244,10 @@ static int wm_macro_invoke_internal(bContext *C, wmOperator *op, wmEvent *event,
int retval= OPERATOR_FINISHED;
/* start from operator received as argument */
- for( ; opm; opm= opm->next) {
- if(opm->type->invoke)
+ for ( ; opm; opm= opm->next) {
+ if (opm->type->invoke)
retval= opm->type->invoke(C, opm, event);
- else if(opm->type->exec)
+ else if (opm->type->exec)
retval= opm->type->exec(C, opm);
OPERATOR_RETVAL_CHECK(retval);
@@ -253,7 +257,8 @@ static int wm_macro_invoke_internal(bContext *C, wmOperator *op, wmEvent *event,
if (retval & OPERATOR_FINISHED) {
MacroData *md = op->customdata;
md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
- } else {
+ }
+ else {
break; /* operator didn't finish, end macro */
}
}
@@ -272,7 +277,7 @@ static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event)
wmOperator *opm = op->opm;
int retval= OPERATOR_FINISHED;
- if(opm==NULL)
+ if (opm==NULL)
printf("%s: macro error, calling NULL modal()\n", __func__);
else {
retval = opm->type->modal(C, opm, event);
@@ -305,13 +310,13 @@ static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event)
/* if operator is blocking, grab cursor
* This may end up grabbing twice, but we don't care.
* */
- if(op->opm->type->flag & OPTYPE_BLOCKING) {
+ if (op->opm->type->flag & OPTYPE_BLOCKING) {
int bounds[4] = {-1,-1,-1,-1};
int wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER));
- if(wrap) {
+ if (wrap) {
ARegion *ar= CTX_wm_region(C);
- if(ar) {
+ if (ar) {
bounds[0]= ar->winrct.xmin;
bounds[1]= ar->winrct.ymax;
bounds[2]= ar->winrct.xmax;
@@ -343,29 +348,30 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
{
wmOperatorType *ot;
- if(WM_operatortype_find(idname, TRUE)) {
+ if (WM_operatortype_find(idname, TRUE)) {
printf("%s: macro error: operator %s exists\n", __func__, idname);
return NULL;
}
ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
- ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+ ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
- ot->idname= idname;
- ot->name= name;
- ot->flag= OPTYPE_MACRO|flag;
+ ot->idname = idname;
+ ot->name = name;
+ ot->flag = OPTYPE_MACRO|flag;
- ot->exec= wm_macro_exec;
- ot->invoke= wm_macro_invoke;
- ot->modal= wm_macro_modal;
- ot->cancel= wm_macro_cancel;
- ot->poll= NULL;
+ ot->exec = wm_macro_exec;
+ ot->invoke = wm_macro_invoke;
+ ot->modal = wm_macro_modal;
+ ot->cancel = wm_macro_cancel;
+ ot->poll = NULL;
- if(!ot->description)
- ot->description= IFACE_("(undocumented operator)");
+ if (!ot->description) /* XXX All ops should have a description but for now allow them not to. */
+ ot->description = N_("(undocumented operator)");
- RNA_def_struct_ui_text(ot->srna, ot->name, ot->description); // XXX All ops should have a description but for now allow them not to.
+ RNA_def_struct_ui_text(ot->srna, ot->name, ot->description);
RNA_def_struct_identifier(ot->srna, ot->idname);
+ RNA_def_struct_translation_context(ot->srna, WM_OPERATOR_DEFAULT_I18NCONTEXT);
BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
@@ -377,18 +383,20 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType*, void*), vo
wmOperatorType *ot;
ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
- ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+ ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
- ot->flag= OPTYPE_MACRO;
- ot->exec= wm_macro_exec;
- ot->invoke= wm_macro_invoke;
- ot->modal= wm_macro_modal;
- ot->cancel= wm_macro_cancel;
- ot->poll= NULL;
+ ot->flag = OPTYPE_MACRO;
+ ot->exec = wm_macro_exec;
+ ot->invoke = wm_macro_invoke;
+ ot->modal = wm_macro_modal;
+ ot->cancel = wm_macro_cancel;
+ ot->poll = NULL;
- if(!ot->description)
- ot->description= IFACE_("(undocumented operator)");
+ if (!ot->description)
+ ot->description = N_("(undocumented operator)");
+ /* Set the default i18n context now, so that opfunc can redefine it if needed! */
+ RNA_def_struct_translation_context(ot->srna, WM_OPERATOR_DEFAULT_I18NCONTEXT);
opfunc(ot, userdata);
RNA_def_struct_ui_text(ot->srna, ot->name, ot->description);
@@ -410,9 +418,9 @@ wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char
BLI_addtail(&ot->macro, otmacro);
{
- /* operator should always be found but in the event its not. dont segfault */
+ /* operator should always be found but in the event its not. don't segfault */
wmOperatorType *otsub = WM_operatortype_find(idname, 0);
- if(otsub) {
+ if (otsub) {
RNA_def_pointer_runtime(ot->srna, otsub->idname, otsub->srna,
otsub->name, otsub->description);
}
@@ -425,8 +433,8 @@ static void wm_operatortype_free_macro(wmOperatorType *ot)
{
wmOperatorTypeMacro *otmacro;
- for(otmacro= ot->macro.first; otmacro; otmacro= otmacro->next) {
- if(otmacro->ptr) {
+ for (otmacro= ot->macro.first; otmacro; otmacro= otmacro->next) {
+ if (otmacro->ptr) {
WM_operator_properties_free(otmacro->ptr);
MEM_freeN(otmacro->ptr);
}
@@ -443,8 +451,13 @@ int WM_operatortype_remove(const char *idname)
return 0;
RNA_struct_free(&BLENDER_RNA, ot->srna);
-
- if(ot->macro.first)
+
+ if (ot->last_properties) {
+ IDP_FreeProperty(ot->last_properties);
+ MEM_freeN(ot->last_properties);
+ }
+
+ if (ot->macro.first)
wm_operatortype_free_macro(ot);
BLI_ghash_remove(global_ops_hash, (void *)ot->idname, NULL, NULL);
@@ -457,7 +470,7 @@ int WM_operatortype_remove(const char *idname)
void WM_operator_py_idname(char *to, const char *from)
{
char *sep= strstr(from, "_OT_");
- if(sep) {
+ if (sep) {
int ofs= (sep-from);
/* note, we use ascii tolower instead of system tolower, because the
@@ -480,7 +493,7 @@ void WM_operator_bl_idname(char *to, const char *from)
if (from) {
char *sep= strchr(from, '.');
- if(sep) {
+ if (sep) {
int ofs= (sep-from);
memcpy(to, from, sizeof(char)*ofs);
@@ -506,70 +519,31 @@ void WM_operator_bl_idname(char *to, const char *from)
*/
char *WM_operator_pystring(bContext *C, wmOperatorType *ot, PointerRNA *opptr, int all_args)
{
- const char *arg_name= NULL;
char idname_py[OP_MAX_TYPENAME];
- PropertyRNA *prop, *iterprop;
-
/* for building the string */
DynStr *dynstr= BLI_dynstr_new();
- char *cstring, *buf;
- int first_iter=1, ok= 1;
-
+ char *cstring;
+ char *cstring_args;
/* only to get the orginal props for comparisons */
PointerRNA opptr_default;
- PropertyRNA *prop_default;
- char *buf_default;
- if(all_args==0 || opptr==NULL) {
+
+ if (all_args==0 || opptr==NULL) {
WM_operator_properties_create_ptr(&opptr_default, ot);
- if(opptr==NULL)
+ if (opptr==NULL)
opptr = &opptr_default;
}
-
WM_operator_py_idname(idname_py, ot->idname);
BLI_dynstr_appendf(dynstr, "bpy.ops.%s(", idname_py);
- iterprop= RNA_struct_iterator_property(opptr->type);
-
- RNA_PROP_BEGIN(opptr, propptr, iterprop) {
- prop= propptr.data;
- arg_name= RNA_property_identifier(prop);
-
- if (strcmp(arg_name, "rna_type")==0) continue;
-
- buf= RNA_property_as_string(C, opptr, prop);
-
- ok= 1;
-
- if(!all_args) {
- /* not verbose, so only add in attributes that use non-default values
- * slow but good for tooltips */
- prop_default= RNA_struct_find_property(&opptr_default, arg_name);
+ cstring_args = RNA_pointer_as_string_keywords(C, opptr, &opptr_default, FALSE, all_args);
+ BLI_dynstr_append(dynstr, cstring_args);
+ MEM_freeN(cstring_args);
- if(prop_default) {
- buf_default= RNA_property_as_string(C, &opptr_default, prop_default);
-
- if(strcmp(buf, buf_default)==0)
- ok= 0; /* values match, dont bother printing */
-
- MEM_freeN(buf_default);
- }
-
- }
- if(ok) {
- BLI_dynstr_appendf(dynstr, first_iter?"%s=%s":", %s=%s", arg_name, buf);
- first_iter = 0;
- }
-
- MEM_freeN(buf);
-
- }
- RNA_PROP_END;
-
- if(all_args==0 || opptr==&opptr_default )
+ if (all_args==0 || opptr==&opptr_default )
WM_operator_properties_free(&opptr_default);
BLI_dynstr_append(dynstr, ")");
@@ -588,7 +562,7 @@ void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
{
wmOperatorType *ot= WM_operatortype_find(opstring, 0);
- if(ot)
+ if (ot)
WM_operator_properties_create_ptr(ptr, ot);
else
RNA_pointer_create(NULL, &RNA_OperatorProperties, NULL, ptr);
@@ -598,12 +572,12 @@ void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
* used for keymaps and macros */
void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *opstring)
{
- if(*properties==NULL) {
+ if (*properties==NULL) {
IDPropertyTemplate val = {0};
*properties= IDP_New(IDP_GROUP, &val, "wmOpItemProp");
}
- if(*ptr==NULL) {
+ if (*ptr==NULL) {
*ptr= MEM_callocN(sizeof(PointerRNA), "wmOpItemPtr");
WM_operator_properties_create(*ptr, opstring);
}
@@ -650,7 +624,7 @@ void WM_operator_properties_reset(wmOperator *op)
RNA_PROP_BEGIN(op->ptr, itemptr, iterprop) {
PropertyRNA *prop= itemptr.data;
- if((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
+ if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
const char *identifier = RNA_property_identifier(prop);
RNA_struct_idprops_unset(op->ptr, identifier);
}
@@ -663,7 +637,7 @@ void WM_operator_properties_free(PointerRNA *ptr)
{
IDProperty *properties= ptr->data;
- if(properties) {
+ if (properties) {
IDP_FreeProperty(properties);
MEM_freeN(properties);
ptr->data= NULL; /* just in case */
@@ -679,7 +653,7 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
uiPopupMenu *pup;
uiLayout *layout;
- if(prop==NULL) {
+ if (prop==NULL) {
printf("%s: %s has no enum property set\n", __func__, op->type->idname);
}
else if (RNA_property_type(prop) != PROP_ENUM) {
@@ -708,7 +682,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *arg_ot, cons
wmOperatorType *ot = (wmOperatorType *)arg_ot;
PropertyRNA *prop= ot->prop;
- if(prop==NULL) {
+ if (prop==NULL) {
printf("%s: %s has no enum property set\n",
__func__, ot->idname);
}
@@ -725,14 +699,14 @@ static void operator_enum_search_cb(const struct bContext *C, void *arg_ot, cons
RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
RNA_property_enum_items((bContext *)C, &ptr, prop, &item_array, NULL, &do_free);
- for(item= item_array; item->identifier; item++) {
+ for (item= item_array; item->identifier; item++) {
/* note: need to give the intex rather than the dientifier because the enum can be freed */
- if(BLI_strcasestr(item->name, str))
- if(0==uiSearchItemAdd(items, item->name, SET_INT_IN_POINTER(item->value), 0))
+ if (BLI_strcasestr(item->name, str))
+ if (0==uiSearchItemAdd(items, item->name, SET_INT_IN_POINTER(item->value), 0))
break;
}
- if(do_free)
+ if (do_free)
MEM_freeN(item_array);
}
}
@@ -741,8 +715,8 @@ static void operator_enum_call_cb(struct bContext *C, void *arg1, void *arg2)
{
wmOperatorType *ot= arg1;
- if(ot) {
- if(ot->prop) {
+ if (ot) {
+ if (ot->prop) {
PointerRNA props_ptr;
WM_operator_properties_create_ptr(&props_ptr, ot);
RNA_property_enum_set(&props_ptr, ot->prop, GET_INT_FROM_POINTER(arg2));
@@ -767,8 +741,8 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op)
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
- //uiDefBut(block, LABEL, 0, op->type->name, 10, 10, 180, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); // ok, this isnt so easy...
- but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
+ //uiDefBut(block, LABEL, 0, op->type->name, 10, 10, 180, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); // ok, this isn't so easy...
+ but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
uiButSetSearchFunc(but, operator_enum_search_cb, op->type, operator_enum_call_cb, NULL);
/* fake button, it holds space for search items */
@@ -801,7 +775,7 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, const char *message
uiLayout *layout;
IDProperty *properties= op->ptr->data;
- if(properties && properties->len)
+ if (properties && properties->len)
properties= IDP_CopyProperty(op->ptr->data);
else
properties= NULL;
@@ -845,16 +819,16 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
{0, NULL, 0, NULL, NULL}};
- if(flag & WM_FILESEL_FILEPATH)
+ if (flag & WM_FILESEL_FILEPATH)
RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, "File Path", "Path to file");
- if(flag & WM_FILESEL_DIRECTORY)
+ if (flag & WM_FILESEL_DIRECTORY)
RNA_def_string_dir_path(ot->srna, "directory", "", FILE_MAX, "Directory", "Directory of the file");
- if(flag & WM_FILESEL_FILENAME)
+ if (flag & WM_FILESEL_FILENAME)
RNA_def_string_file_name(ot->srna, "filename", "", FILE_MAX, "File Name", "Name of the file");
- if(flag & WM_FILESEL_FILES)
+ if (flag & WM_FILESEL_FILES)
RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
if (action == FILE_SAVE) {
@@ -888,7 +862,7 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
FILE_LOADLIB, FILE_SPECIAL);
RNA_def_property_flag(prop, PROP_HIDDEN);
- if(flag & WM_FILESEL_RELPATH)
+ if (flag & WM_FILESEL_RELPATH)
RNA_def_boolean(ot->srna, "relative_path", TRUE, "Relative Path", "Select the file relative to the blend file");
prop= RNA_def_enum(ot->srna, "display_type", file_display_items, display, "Display Type", "");
@@ -916,7 +890,7 @@ void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend)
RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
- if(extend)
+ if (extend)
RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
}
@@ -927,7 +901,7 @@ void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, "Y Start", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, "Y End", "", INT_MIN, INT_MAX);
- if(cursor)
+ if (cursor)
RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, "Cursor", "Mouse cursor style to use during the modal operator", 0, INT_MAX);
}
@@ -935,7 +909,7 @@ void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
/* op->poll */
int WM_operator_winactive(bContext *C)
{
- if(CTX_wm_window(C)==NULL) return 0;
+ if (CTX_wm_window(C)==NULL) return 0;
return 1;
}
@@ -954,8 +928,8 @@ wmOperator *WM_operator_last_redo(const bContext *C)
wmOperator *op;
/* only for operators that are registered and did an undo push */
- for(op= wm->operators.last; op; op= op->prev)
- if((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO))
+ for (op= wm->operators.last; op; op= op->prev)
+ if ((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO))
break;
return op;
@@ -984,8 +958,8 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
if (!WM_operator_check_ui_enabled(C, op->type->name))
uiLayoutSetEnabled(layout, 0);
- if(op->type->flag & OPTYPE_MACRO) {
- for(op= op->macro.first; op; op= op->next) {
+ if (op->type->flag & OPTYPE_MACRO) {
+ for (op= op->macro.first; op; op= op->next) {
uiItemL(layout, op->type->name, ICON_NONE);
uiLayoutOperatorButs(C, layout, op, NULL, 'H', UI_LAYOUT_OP_SHOW_TITLE);
}
@@ -1030,8 +1004,8 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
static void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg))
{
wmOperator *op= op_ptr;
- if(op->type->check) {
- if(op->type->check(C, op)) {
+ if (op->type->check) {
+ if (op->type->check(C, op)) {
/* refresh */
}
}
@@ -1105,7 +1079,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
static void wm_operator_ui_popup_cancel(void *userData)
{
wmOpPopUp *data= userData;
- if(data->free_op && data->op) {
+ if (data->free_op && data->op) {
wmOperator *op= data->op;
WM_operator_free(op);
}
@@ -1118,7 +1092,7 @@ static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval)
wmOpPopUp *data= arg;
wmOperator *op= data->op;
- if(op && retval > 0)
+ if (op && retval > 0)
WM_operator_call(C, op);
}
@@ -1137,7 +1111,7 @@ int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- if((op->type->flag & OPTYPE_REGISTER)==0) {
+ if ((op->type->flag & OPTYPE_REGISTER)==0) {
BKE_reportf(op->reports, RPT_ERROR,
"Operator '%s' does not have register enabled, incorrect invoke function.", op->type->idname);
return OPERATOR_CANCELLED;
@@ -1169,11 +1143,11 @@ int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int h
int WM_operator_redo_popup(bContext *C, wmOperator *op)
{
/* CTX_wm_reports(C) because operator is on stack, not active in event system */
- if((op->type->flag & OPTYPE_REGISTER)==0) {
+ if ((op->type->flag & OPTYPE_REGISTER)==0) {
BKE_reportf(CTX_wm_reports(C), RPT_ERROR, "Operator redo '%s' does not have register enabled, incorrect invoke function.", op->type->idname);
return OPERATOR_CANCELLED;
}
- if(op->type->poll && op->type->poll(C)==0) {
+ if (op->type->poll && op->type->poll(C)==0) {
BKE_reportf(CTX_wm_reports(C), RPT_ERROR, "Operator redo '%s': wrong context.", op->type->idname);
return OPERATOR_CANCELLED;
}
@@ -1202,13 +1176,13 @@ static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
static void WM_OT_debug_menu(wmOperatorType *ot)
{
- ot->name= "Debug Menu";
- ot->idname= "WM_OT_debug_menu";
- ot->description= "Open a popup to set the debug level";
+ ot->name = "Debug Menu";
+ ot->idname = "WM_OT_debug_menu";
+ ot->description = "Open a popup to set the debug level";
- ot->invoke= wm_debug_menu_invoke;
- ot->exec= wm_debug_menu_exec;
- ot->poll= WM_operator_winactive;
+ ot->invoke = wm_debug_menu_invoke;
+ ot->exec = wm_debug_menu_exec;
+ ot->poll = WM_operator_winactive;
RNA_def_int(ot->srna, "debug_value", 0, -10000, 10000, "Debug Value", "", INT_MIN, INT_MAX);
}
@@ -1240,17 +1214,17 @@ static int wm_resource_check_prev(void)
char *res= BLI_get_folder_version(BLENDER_RESOURCE_PATH_USER, BLENDER_VERSION, TRUE);
- // if(res) printf("USER: %s\n", res);
+ // if (res) printf("USER: %s\n", res);
#if 0 /* ignore the local folder */
- if(res == NULL) {
- /* with a local dir, copying old files isnt useful since local dir get priority for config */
+ if (res == NULL) {
+ /* with a local dir, copying old files isn't useful since local dir get priority for config */
res= BLI_get_folder_version(BLENDER_RESOURCE_PATH_LOCAL, BLENDER_VERSION, TRUE);
}
#endif
- // if(res) printf("LOCAL: %s\n", res);
- if(res) {
+ // if (res) printf("LOCAL: %s\n", res);
+ if (res) {
return FALSE;
}
else {
@@ -1266,7 +1240,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiStyle *style= UI_GetStyle();
struct RecentFile *recent;
int i;
- MenuType *mt= WM_menutype_find("USERPREF_MT_splash", TRUE);
+ MenuType *mt = WM_menutype_find("USERPREF_MT_splash", TRUE);
char url[96];
#ifndef WITH_HEADLESS
@@ -1297,7 +1271,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
- but= uiDefBut(block, BUT_IMAGE, 0, "", 0, 10, 501, 282, ibuf, 0.0, 0.0, 0, 0, ""); /* button owns the imbuf now */
+ but = uiDefBut(block, BUT_IMAGE, 0, "", 0, 10, 501, 282, ibuf, 0.0, 0.0, 0, 0, ""); /* button owns the imbuf now */
uiButSetFunc(but, wm_block_splash_close, block, NULL);
uiBlockSetFunc(block, wm_block_splash_refreshmenu, block, NULL);
@@ -1332,7 +1306,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual");
uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org");
uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community");
- if(strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release")==0) {
+ if (strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release")==0) {
BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION/100, BLENDER_VERSION%100);
}
else {
@@ -1343,13 +1317,13 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
col = uiLayoutColumn(split, 0);
- if(wm_resource_check_prev()) {
+ if (wm_resource_check_prev()) {
uiItemO(col, NULL, ICON_NEW, "WM_OT_copy_prev_settings");
uiItemS(col);
}
uiItemL(col, IFACE_("Recent"), ICON_NONE);
- for(recent = G.recent_files.first, i=0; (i<5) && (recent); recent = recent->next, i++) {
+ for (recent = G.recent_files.first, i=0; (i<5) && (recent); recent = recent->next, i++) {
uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
}
@@ -1372,12 +1346,12 @@ static int wm_splash_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED
static void WM_OT_splash(wmOperatorType *ot)
{
- ot->name= "Splash Screen";
- ot->idname= "WM_OT_splash";
- ot->description= "Opens a blocking popup region with release info";
+ ot->name = "Splash Screen";
+ ot->idname = "WM_OT_splash";
+ ot->description = "Opens a blocking popup region with release info";
- ot->invoke= wm_splash_invoke;
- ot->poll= WM_operator_winactive;
+ ot->invoke = wm_splash_invoke;
+ ot->poll = WM_operator_winactive;
}
@@ -1386,7 +1360,7 @@ static void operator_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2)
{
wmOperatorType *ot= arg2;
- if(ot)
+ if (ot)
WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
}
@@ -1394,14 +1368,14 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons
{
GHashIterator *iter= WM_operatortype_iter();
- for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+ for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
- if((ot->flag & OPTYPE_INTERNAL) && (G.f & G_DEBUG) == 0)
+ if ((ot->flag & OPTYPE_INTERNAL) && (G.f & G_DEBUG) == 0)
continue;
- if(BLI_strcasestr(ot->name, str)) {
- if(WM_operator_poll((bContext*)C, ot)) {
+ if (BLI_strcasestr(ot->name, str)) {
+ if (WM_operator_poll((bContext*)C, ot)) {
char name[256];
int len= strlen(ot->name);
@@ -1417,7 +1391,7 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons
}
}
- if(0==uiSearchItemAdd(items, name, ot, 0))
+ if (0==uiSearchItemAdd(items, name, ot, 0))
break;
}
}
@@ -1436,7 +1410,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
- but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
+ but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
/* fake button, it holds space for search items */
@@ -1470,18 +1444,18 @@ static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
/* op->poll */
static int wm_search_menu_poll(bContext *C)
{
- if(CTX_wm_window(C)==NULL) {
+ if (CTX_wm_window(C)==NULL) {
return 0;
}
else {
ScrArea *sa= CTX_wm_area(C);
- if(sa) {
- if(sa->spacetype==SPACE_CONSOLE) return 0; // XXX - so we can use the shortcut in the console
- if(sa->spacetype==SPACE_TEXT) return 0; // XXX - so we can use the spacebar in the text editor
+ if (sa) {
+ if (sa->spacetype==SPACE_CONSOLE) return 0; // XXX - so we can use the shortcut in the console
+ if (sa->spacetype==SPACE_TEXT) return 0; // XXX - so we can use the spacebar in the text editor
}
else {
Object *editob= CTX_data_edit_object(C);
- if(editob && editob->type==OB_FONT) return 0; // XXX - so we can use the spacebar for entering text
+ if (editob && editob->type==OB_FONT) return 0; // XXX - so we can use the spacebar for entering text
}
}
return 1;
@@ -1489,12 +1463,12 @@ static int wm_search_menu_poll(bContext *C)
static void WM_OT_search_menu(wmOperatorType *ot)
{
- ot->name= "Search Menu";
- ot->idname= "WM_OT_search_menu";
+ ot->name = "Search Menu";
+ ot->idname = "WM_OT_search_menu";
- ot->invoke= wm_search_menu_invoke;
- ot->exec= wm_search_menu_exec;
- ot->poll= wm_search_menu_poll;
+ ot->invoke = wm_search_menu_invoke;
+ ot->exec = wm_search_menu_exec;
+ ot->poll = wm_search_menu_poll;
}
static int wm_call_menu_exec(bContext *C, wmOperator *op)
@@ -1509,13 +1483,13 @@ static int wm_call_menu_exec(bContext *C, wmOperator *op)
static void WM_OT_call_menu(wmOperatorType *ot)
{
- ot->name= "Call Menu";
- ot->idname= "WM_OT_call_menu";
+ ot->name = "Call Menu";
+ ot->idname = "WM_OT_call_menu";
- ot->exec= wm_call_menu_exec;
- ot->poll= WM_operator_winactive;
+ ot->exec = wm_call_menu_exec;
+ ot->poll = WM_operator_winactive;
- ot->flag= OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_INTERNAL;
RNA_def_string(ot->srna, "name", "", BKE_ST_MAXNAME, "Name", "Name of the menu");
}
@@ -1528,7 +1502,7 @@ static int wm_operator_winactive_normal(bContext *C)
{
wmWindow *win= CTX_wm_window(C);
- if(win==NULL || win->screen==NULL || win->screen->full != SCREENNORMAL)
+ if (win==NULL || win->screen==NULL || win->screen->full != SCREENNORMAL)
return 0;
return 1;
@@ -1536,44 +1510,44 @@ static int wm_operator_winactive_normal(bContext *C)
static void WM_OT_window_duplicate(wmOperatorType *ot)
{
- ot->name= "Duplicate Window";
- ot->idname= "WM_OT_window_duplicate";
- ot->description="Duplicate the current Blender window";
+ ot->name = "Duplicate Window";
+ ot->idname = "WM_OT_window_duplicate";
+ ot->description = "Duplicate the current Blender window";
- ot->exec= wm_window_duplicate_exec;
- ot->poll= wm_operator_winactive_normal;
+ ot->exec = wm_window_duplicate_exec;
+ ot->poll = wm_operator_winactive_normal;
}
static void WM_OT_save_homefile(wmOperatorType *ot)
{
- ot->name= "Save User Settings";
- ot->idname= "WM_OT_save_homefile";
- ot->description="Make the current file the default .blend file";
+ ot->name = "Save User Settings";
+ ot->idname = "WM_OT_save_homefile";
+ ot->description = "Make the current file the default .blend file";
- ot->invoke= WM_operator_confirm;
- ot->exec= WM_write_homefile;
- ot->poll= WM_operator_winactive;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = WM_write_homefile;
+ ot->poll = WM_operator_winactive;
}
static void WM_OT_read_homefile(wmOperatorType *ot)
{
- ot->name= "Reload Start-Up File";
- ot->idname= "WM_OT_read_homefile";
- ot->description="Open the default file (doesn't save the current file)";
+ ot->name = "Reload Start-Up File";
+ ot->idname = "WM_OT_read_homefile";
+ ot->description = "Open the default file (doesn't save the current file)";
- ot->invoke= WM_operator_confirm;
- ot->exec= WM_read_homefile_exec;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = WM_read_homefile_exec;
/* ommit poll to run in background mode */
}
static void WM_OT_read_factory_settings(wmOperatorType *ot)
{
- ot->name= "Load Factory Settings";
- ot->idname= "WM_OT_read_factory_settings";
- ot->description="Load default file and user preferences";
+ ot->name = "Load Factory Settings";
+ ot->idname = "WM_OT_read_factory_settings";
+ ot->description = "Load default file and user preferences";
- ot->invoke= WM_operator_confirm;
- ot->exec= WM_read_homefile_exec;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = WM_read_homefile_exec;
/* ommit poll to run in background mode */
}
@@ -1581,13 +1555,13 @@ static void WM_OT_read_factory_settings(wmOperatorType *ot)
static void open_set_load_ui(wmOperator *op)
{
- if(!RNA_struct_property_is_set(op->ptr, "load_ui"))
+ if (!RNA_struct_property_is_set(op->ptr, "load_ui"))
RNA_boolean_set(op->ptr, "load_ui", !(U.flag & USER_FILENOUI));
}
static void open_set_use_scripts(wmOperator *op)
{
- if(!RNA_struct_property_is_set(op->ptr, "use_scripts")) {
+ if (!RNA_struct_property_is_set(op->ptr, "use_scripts")) {
/* use G_SCRIPT_AUTOEXEC rather than the userpref because this means if
* the flag has been disabled from the command line, then opening
* from the menu wont enable this setting. */
@@ -1599,7 +1573,7 @@ static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
{
const char *openname= G.main->name;
- if(CTX_wm_window(C) == NULL) {
+ if (CTX_wm_window(C) == NULL) {
/* in rare cases this could happen, when trying to invoke in background
* mode on load for example. Don't use poll for this because exec()
* can still run without a window */
@@ -1630,12 +1604,12 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
open_set_load_ui(op);
open_set_use_scripts(op);
- if(RNA_boolean_get(op->ptr, "load_ui"))
+ if (RNA_boolean_get(op->ptr, "load_ui"))
G.fileflags &= ~G_FILE_NO_UI;
else
G.fileflags |= G_FILE_NO_UI;
- if(RNA_boolean_get(op->ptr, "use_scripts"))
+ if (RNA_boolean_get(op->ptr, "use_scripts"))
G.f |= G_SCRIPT_AUTOEXEC;
else
G.f &= ~G_SCRIPT_AUTOEXEC;
@@ -1651,12 +1625,12 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
static void WM_OT_open_mainfile(wmOperatorType *ot)
{
- ot->name= "Open Blender File";
- ot->idname= "WM_OT_open_mainfile";
- ot->description="Open a Blender file";
+ ot->name = "Open Blender File";
+ ot->idname = "WM_OT_open_mainfile";
+ ot->description = "Open a Blender file";
- ot->invoke= wm_open_mainfile_invoke;
- ot->exec= wm_open_mainfile_exec;
+ ot->invoke = wm_open_mainfile_invoke;
+ ot->exec = wm_open_mainfile_exec;
/* ommit window poll so this can work in background mode */
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE,
@@ -1671,12 +1645,12 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
int wm_link_append_poll(bContext *C)
{
- if(WM_operator_winactive(C)) {
+ if (WM_operator_winactive(C)) {
/* linking changes active object which is pretty useful in general,
* but which totally confuses edit mode (i.e. it becoming not so obvious
* to leave from edit mode and inwalid tools in toolbar might be displayed)
* so disable link/append when in edit mode (sergey) */
- if(CTX_data_edit_object(C))
+ if (CTX_data_edit_object(C))
return 0;
return 1;
@@ -1687,15 +1661,15 @@ int wm_link_append_poll(bContext *C)
static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- if(RNA_struct_property_is_set(op->ptr, "filepath")) {
+ if (RNA_struct_property_is_set(op->ptr, "filepath")) {
return WM_operator_call_notest(C, op);
}
else {
/* XXX TODO solve where to get last linked library from */
- if(G.lib[0] != '\0') {
+ if (G.lib[0] != '\0') {
RNA_string_set(op->ptr, "filepath", G.lib);
}
- else if(G.relbase_valid) {
+ else if (G.relbase_valid) {
char path[FILE_MAX];
BLI_strncpy(path, G.main->name, sizeof(G.main->name));
BLI_parent_dir(path);
@@ -1710,11 +1684,11 @@ static short wm_link_append_flag(wmOperator *op)
{
short flag= 0;
- if(RNA_boolean_get(op->ptr, "autoselect")) flag |= FILE_AUTOSELECT;
- if(RNA_boolean_get(op->ptr, "active_layer")) flag |= FILE_ACTIVELAY;
- if(RNA_boolean_get(op->ptr, "relative_path")) flag |= FILE_RELPATH;
- if(RNA_boolean_get(op->ptr, "link")) flag |= FILE_LINK;
- if(RNA_boolean_get(op->ptr, "instance_groups")) flag |= FILE_GROUP_INSTANCE;
+ if (RNA_boolean_get(op->ptr, "autoselect")) flag |= FILE_AUTOSELECT;
+ if (RNA_boolean_get(op->ptr, "active_layer")) flag |= FILE_ACTIVELAY;
+ if (RNA_boolean_get(op->ptr, "relative_path")) flag |= FILE_RELPATH;
+ if (RNA_boolean_get(op->ptr, "link")) flag |= FILE_LINK;
+ if (RNA_boolean_get(op->ptr, "instance_groups")) flag |= FILE_GROUP_INSTANCE;
return flag;
}
@@ -1734,38 +1708,38 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "directory", dir);
/* test if we have a valid data */
- if(BLO_is_a_library(dir, libname, group) == 0) {
+ if (BLO_is_a_library(dir, libname, group) == 0) {
BKE_report(op->reports, RPT_ERROR, "Not a library");
return OPERATOR_CANCELLED;
}
- else if(group[0] == 0) {
+ else if (group[0] == 0) {
BKE_report(op->reports, RPT_ERROR, "Nothing indicated");
return OPERATOR_CANCELLED;
}
- else if(BLI_path_cmp(bmain->name, libname) == 0) {
+ else if (BLI_path_cmp(bmain->name, libname) == 0) {
BKE_report(op->reports, RPT_ERROR, "Cannot use current file as library");
return OPERATOR_CANCELLED;
}
/* check if something is indicated for append/link */
prop = RNA_struct_find_property(op->ptr, "files");
- if(prop) {
+ if (prop) {
totfiles= RNA_property_collection_length(op->ptr, prop);
- if(totfiles == 0) {
- if(name[0] == '\0') {
+ if (totfiles == 0) {
+ if (name[0] == '\0') {
BKE_report(op->reports, RPT_ERROR, "Nothing indicated");
return OPERATOR_CANCELLED;
}
}
}
- else if(name[0] == '\0') {
+ else if (name[0] == '\0') {
BKE_report(op->reports, RPT_ERROR, "Nothing indicated");
return OPERATOR_CANCELLED;
}
bh = BLO_blendhandle_from_file(libname, op->reports);
- if(bh == NULL) {
+ if (bh == NULL) {
/* unlikely since we just browsed it, but possible
* error reports will have been made by BLO_blendhandle_from_file() */
return OPERATOR_CANCELLED;
@@ -1777,14 +1751,14 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
idcode = BKE_idcode_from_name(group);
/* now we have or selected, or an indicated file */
- if(RNA_boolean_get(op->ptr, "autoselect"))
+ if (RNA_boolean_get(op->ptr, "autoselect"))
scene_deselect_all(scene);
flag = wm_link_append_flag(op);
/* sanity checks for flag */
- if(scene->id.lib && (flag & FILE_GROUP_INSTANCE)) {
+ if (scene->id.lib && (flag & FILE_GROUP_INSTANCE)) {
/* TODO, user never gets this message */
BKE_reportf(op->reports, RPT_WARNING, "Scene '%s' is linked, group instance disabled", scene->id.name+2);
flag &= ~FILE_GROUP_INSTANCE;
@@ -1799,7 +1773,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
/* here appending/linking starts */
mainl = BLO_library_append_begin(bmain, &bh, libname);
- if(totfiles == 0) {
+ if (totfiles == 0) {
BLO_library_append_named_part_ex(C, mainl, &bh, name, idcode, flag);
}
else {
@@ -1815,9 +1789,9 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
recalc_all_library_objects(bmain);
/* append, rather than linking */
- if((flag & FILE_LINK)==0) {
+ if ((flag & FILE_LINK)==0) {
Library *lib= BLI_findstring(&bmain->library, libname, offsetof(Library, filepath));
- if(lib) BKE_library_make_local(bmain, lib, 1);
+ if (lib) BKE_library_make_local(bmain, lib, 1);
else BLI_assert(!"cant find name of just added library!");
}
@@ -1841,13 +1815,13 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
static void WM_OT_link_append(wmOperatorType *ot)
{
- ot->name= "Link/Append from Library";
- ot->idname= "WM_OT_link_append";
- ot->description= "Link or Append from a Library .blend file";
+ ot->name = "Link/Append from Library";
+ ot->idname = "WM_OT_link_append";
+ ot->description = "Link or Append from a Library .blend file";
- ot->invoke= wm_link_append_invoke;
- ot->exec= wm_link_append_exec;
- ot->poll= wm_link_append_poll;
+ ot->invoke = wm_link_append_invoke;
+ ot->exec = wm_link_append_exec;
+ ot->poll = wm_link_append_poll;
ot->flag |= OPTYPE_UNDO;
@@ -1884,12 +1858,12 @@ static int wm_recover_last_session_exec(bContext *C, wmOperator *op)
static void WM_OT_recover_last_session(wmOperatorType *ot)
{
- ot->name= "Recover Last Session";
- ot->idname= "WM_OT_recover_last_session";
- ot->description="Open the last closed file (\"quit.blend\")";
+ ot->name = "Recover Last Session";
+ ot->idname = "WM_OT_recover_last_session";
+ ot->description = "Open the last closed file (\"quit.blend\")";
- ot->exec= wm_recover_last_session_exec;
- ot->poll= WM_operator_winactive;
+ ot->exec = wm_recover_last_session_exec;
+ ot->poll = WM_operator_winactive;
}
/* *************** recover auto save **************** */
@@ -1927,13 +1901,13 @@ static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, wmEvent *UNU
static void WM_OT_recover_auto_save(wmOperatorType *ot)
{
- ot->name= "Recover Auto Save";
- ot->idname= "WM_OT_recover_auto_save";
- ot->description="Open an automatically saved file to recover it";
+ ot->name = "Recover Auto Save";
+ ot->idname = "WM_OT_recover_auto_save";
+ ot->description = "Open an automatically saved file to recover it";
- ot->exec= wm_recover_auto_save_exec;
- ot->invoke= wm_recover_auto_save_invoke;
- ot->poll= WM_operator_winactive;
+ ot->exec = wm_recover_auto_save_exec;
+ ot->invoke = wm_recover_auto_save_invoke;
+ ot->poll = WM_operator_winactive;
WM_operator_properties_filesel(ot, BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_LONGDISPLAY);
}
@@ -1942,10 +1916,10 @@ static void WM_OT_recover_auto_save(wmOperatorType *ot)
static void untitled(char *name)
{
- if(G.save_over == 0 && strlen(name) < FILE_MAX-16) {
+ if (G.save_over == 0 && strlen(name) < FILE_MAX-16) {
char *c= BLI_last_slash(name);
- if(c)
+ if (c)
strcpy(&c[1], "untitled.blend");
else
strcpy(name, "untitled.blend");
@@ -1954,8 +1928,8 @@ static void untitled(char *name)
static void save_set_compress(wmOperator *op)
{
- if(!RNA_struct_property_is_set(op->ptr, "compress")) {
- if(G.save_over) /* keep flag for existing file */
+ if (!RNA_struct_property_is_set(op->ptr, "compress")) {
+ if (G.save_over) /* keep flag for existing file */
RNA_boolean_set(op->ptr, "compress", G.fileflags & G_FILE_COMPRESS);
else /* use userdef for new file */
RNA_boolean_set(op->ptr, "compress", U.flag & USER_FILECOMPRESS);
@@ -1969,7 +1943,7 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
save_set_compress(op);
/* if not saved before, get the name of the most recently used .blend file */
- if(G.main->name[0]==0 && G.recent_files.first) {
+ if (G.main->name[0]==0 && G.recent_files.first) {
struct RecentFile *recent = G.recent_files.first;
BLI_strncpy(name, recent->filepath, FILE_MAX);
}
@@ -1993,27 +1967,27 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
save_set_compress(op);
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
RNA_string_get(op->ptr, "filepath", path);
else {
BLI_strncpy(path, G.main->name, FILE_MAX);
untitled(path);
}
- if(RNA_struct_property_is_set(op->ptr, "copy"))
+ if (RNA_struct_property_is_set(op->ptr, "copy"))
copy = RNA_boolean_get(op->ptr, "copy");
fileflags= G.fileflags;
/* set compression flag */
- if(RNA_boolean_get(op->ptr, "compress")) fileflags |= G_FILE_COMPRESS;
+ if (RNA_boolean_get(op->ptr, "compress")) fileflags |= G_FILE_COMPRESS;
else fileflags &= ~G_FILE_COMPRESS;
- if(RNA_boolean_get(op->ptr, "relative_remap")) fileflags |= G_FILE_RELATIVE_REMAP;
+ if (RNA_boolean_get(op->ptr, "relative_remap")) fileflags |= G_FILE_RELATIVE_REMAP;
else fileflags &= ~G_FILE_RELATIVE_REMAP;
#ifdef USE_BMESH_SAVE_AS_COMPAT
/* property only exists for 'Save As' */
if (RNA_struct_find_property(op->ptr, "use_mesh_compat")) {
- if(RNA_boolean_get(op->ptr, "use_mesh_compat")) fileflags |= G_FILE_MESH_COMPAT;
+ if (RNA_boolean_get(op->ptr, "use_mesh_compat")) fileflags |= G_FILE_MESH_COMPAT;
else fileflags &= ~G_FILE_MESH_COMPAT;
}
else {
@@ -2034,7 +2008,7 @@ static int blend_save_check(bContext *UNUSED(C), wmOperator *op)
{
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
- if(!BLO_has_bfile_extension(filepath)) {
+ if (!BLO_has_bfile_extension(filepath)) {
/* some users would prefer BLI_replace_extension(),
* we keep getting knit-picking bug reports about this - campbell */
BLI_ensure_extension(filepath, FILE_MAX, ".blend");
@@ -2046,13 +2020,13 @@ static int blend_save_check(bContext *UNUSED(C), wmOperator *op)
static void WM_OT_save_as_mainfile(wmOperatorType *ot)
{
- ot->name= "Save As Blender File";
- ot->idname= "WM_OT_save_as_mainfile";
- ot->description="Save the current file in the desired location";
+ ot->name = "Save As Blender File";
+ ot->idname = "WM_OT_save_as_mainfile";
+ ot->description = "Save the current file in the desired location";
- ot->invoke= wm_save_as_mainfile_invoke;
- ot->exec= wm_save_as_mainfile_exec;
- ot->check= blend_save_check;
+ ot->invoke = wm_save_as_mainfile_invoke;
+ ot->exec = wm_save_as_mainfile_exec;
+ ot->check = blend_save_check;
/* ommit window poll so this can work in background mode */
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -2079,7 +2053,7 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
save_set_compress(op);
/* if not saved before, get the name of the most recently used .blend file */
- if(G.main->name[0]==0 && G.recent_files.first) {
+ if (G.main->name[0]==0 && G.recent_files.first) {
struct RecentFile *recent = G.recent_files.first;
BLI_strncpy(name, recent->filepath, FILE_MAX);
}
@@ -2113,13 +2087,13 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
static void WM_OT_save_mainfile(wmOperatorType *ot)
{
- ot->name= "Save Blender File";
- ot->idname= "WM_OT_save_mainfile";
- ot->description="Save the current Blender file";
+ ot->name = "Save Blender File";
+ ot->idname = "WM_OT_save_mainfile";
+ ot->description = "Save the current Blender file";
- ot->invoke= wm_save_mainfile_invoke;
- ot->exec= wm_save_as_mainfile_exec;
- ot->check= blend_save_check;
+ ot->invoke = wm_save_mainfile_invoke;
+ ot->exec = wm_save_as_mainfile_exec;
+ ot->check = blend_save_check;
/* ommit window poll so this can work in background mode */
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -2134,7 +2108,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot)
static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- if(!RNA_struct_property_is_set(op->ptr, "filepath")) {
+ if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
char filepath[FILE_MAX];
BLI_strncpy(filepath, G.main->name, sizeof(filepath));
BLI_replace_extension(filepath, sizeof(filepath), ".dae");
@@ -2152,7 +2126,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
char filename[FILE_MAX];
int selected, second_life;
- if(!RNA_struct_property_is_set(op->ptr, "filepath")) {
+ if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
BKE_report(op->reports, RPT_ERROR, "No filename given");
return OPERATOR_CANCELLED;
}
@@ -2160,7 +2134,7 @@ 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");
- if(collada_export(CTX_data_scene(C), filename, selected, second_life)) {
+ if (collada_export(CTX_data_scene(C), filename, selected, second_life)) {
return OPERATOR_FINISHED;
}
else {
@@ -2170,12 +2144,12 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
static void WM_OT_collada_export(wmOperatorType *ot)
{
- ot->name= "Export COLLADA";
- ot->idname= "WM_OT_collada_export";
+ ot->name = "Export COLLADA";
+ ot->idname = "WM_OT_collada_export";
- ot->invoke= wm_collada_export_invoke;
- ot->exec= wm_collada_export_exec;
- ot->poll= WM_operator_winactive;
+ ot->invoke = wm_collada_export_invoke;
+ ot->exec = wm_collada_export_exec;
+ ot->poll = WM_operator_winactive;
WM_operator_properties_filesel(ot, FOLDERFILE|COLLADAFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "selected", 0, "Export only selected",
@@ -2189,13 +2163,13 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
{
char filename[FILE_MAX];
- if(!RNA_struct_property_is_set(op->ptr, "filepath")) {
+ if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
BKE_report(op->reports, RPT_ERROR, "No filename given");
return OPERATOR_CANCELLED;
}
RNA_string_get(op->ptr, "filepath", filename);
- if(collada_import(C, filename)) return OPERATOR_FINISHED;
+ if (collada_import(C, filename)) return OPERATOR_FINISHED;
BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document. Please see console for error log.");
@@ -2204,12 +2178,12 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
static void WM_OT_collada_import(wmOperatorType *ot)
{
- ot->name= "Import COLLADA";
- ot->idname= "WM_OT_collada_import";
+ ot->name = "Import COLLADA";
+ ot->idname = "WM_OT_collada_import";
- ot->invoke= WM_operator_filesel;
- ot->exec= wm_collada_import_exec;
- ot->poll= WM_operator_winactive;
+ ot->invoke = WM_operator_filesel;
+ ot->exec = wm_collada_import_exec;
+ ot->poll = WM_operator_winactive;
WM_operator_properties_filesel(ot, FOLDERFILE|COLLADAFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
}
@@ -2221,12 +2195,12 @@ static void WM_OT_collada_import(wmOperatorType *ot)
static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot)
{
- ot->name= "Toggle Fullscreen";
- ot->idname= "WM_OT_window_fullscreen_toggle";
- ot->description="Toggle the current window fullscreen";
+ ot->name = "Toggle Fullscreen";
+ ot->idname = "WM_OT_window_fullscreen_toggle";
+ ot->description = "Toggle the current window fullscreen";
- ot->exec= wm_window_fullscreen_toggle_exec;
- ot->poll= WM_operator_winactive;
+ ot->exec = wm_window_fullscreen_toggle_exec;
+ ot->poll = WM_operator_winactive;
}
static int wm_exit_blender_op(bContext *C, wmOperator *op)
@@ -2240,13 +2214,13 @@ static int wm_exit_blender_op(bContext *C, wmOperator *op)
static void WM_OT_quit_blender(wmOperatorType *ot)
{
- ot->name= "Quit Blender";
- ot->idname= "WM_OT_quit_blender";
- ot->description= "Quit Blender";
+ ot->name = "Quit Blender";
+ ot->idname = "WM_OT_quit_blender";
+ ot->description = "Quit Blender";
- ot->invoke= WM_operator_confirm;
- ot->exec= wm_exit_blender_op;
- ot->poll= WM_operator_winactive;
+ ot->invoke = WM_operator_confirm;
+ ot->exec = wm_exit_blender_op;
+ ot->poll = WM_operator_winactive;
}
/* *********************** */
@@ -2261,12 +2235,12 @@ static int wm_console_toggle_op(bContext *UNUSED(C), wmOperator *UNUSED(op))
static void WM_OT_console_toggle(wmOperatorType *ot)
{
- ot->name= "Toggle System Console";
- ot->idname= "WM_OT_console_toggle";
- ot->description= "Toggle System Console";
+ ot->name = "Toggle System Console";
+ ot->idname = "WM_OT_console_toggle";
+ ot->description = "Toggle System Console";
- ot->exec= wm_console_toggle_op;
- ot->poll= WM_operator_winactive;
+ ot->exec = wm_console_toggle_op;
+ ot->poll = WM_operator_winactive;
}
#endif
@@ -2296,8 +2270,8 @@ void WM_paint_cursor_end(wmWindowManager *wm, void *handle)
{
wmPaintCursor *pc;
- for(pc= wm->paintcursors.first; pc; pc= pc->next) {
- if(pc == (wmPaintCursor *)handle) {
+ for (pc= wm->paintcursors.first; pc; pc= pc->next) {
+ if (pc == (wmPaintCursor *)handle) {
BLI_remlink(&wm->paintcursors, pc);
MEM_freeN(pc);
return;
@@ -2324,7 +2298,7 @@ static int border_apply_rect(wmOperator *op)
wmGesture *gesture= op->customdata;
rcti *rect= gesture->customdata;
- if(rect->xmin==rect->xmax || rect->ymin==rect->ymax)
+ if (rect->xmin ==rect->xmax || rect->ymin==rect->ymax)
return 0;
@@ -2343,7 +2317,7 @@ static int border_apply(bContext *C, wmOperator *op, int gesture_mode)
return 0;
/* XXX weak; border should be configured for this without reading event types */
- if( RNA_struct_find_property(op->ptr, "gesture_mode") )
+ if ( RNA_struct_find_property(op->ptr, "gesture_mode") )
RNA_int_set(op->ptr, "gesture_mode", gesture_mode);
op->type->exec(C, op);
@@ -2359,13 +2333,13 @@ static void wm_gesture_end(bContext *C, wmOperator *op)
ED_area_tag_redraw(CTX_wm_area(C));
- if( RNA_struct_find_property(op->ptr, "cursor") )
+ if ( RNA_struct_find_property(op->ptr, "cursor") )
WM_cursor_restore(CTX_wm_window(C));
}
int WM_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(ISTWEAK(event->type))
+ if (ISTWEAK(event->type))
op->customdata= WM_gesture_new(C, event, WM_GESTURE_RECT);
else
op->customdata= WM_gesture_new(C, event, WM_GESTURE_CROSS_RECT);
@@ -2384,16 +2358,16 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
rcti *rect= gesture->customdata;
int sx, sy;
- if(event->type== MOUSEMOVE) {
+ if (event->type== MOUSEMOVE) {
wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
- if(gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
- rect->xmin= rect->xmax= event->x - sx;
- rect->ymin= rect->ymax= event->y - sy;
+ if (gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
+ rect->xmin = rect->xmax = event->x - sx;
+ rect->ymin = rect->ymax = event->y - sy;
}
else {
- rect->xmax= event->x - sx;
- rect->ymax= event->y - sy;
+ rect->xmax = event->x - sx;
+ rect->ymax = event->y - sy;
}
border_apply_rect(op);
@@ -2402,7 +2376,7 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
else if (event->type==EVT_MODAL_MAP) {
switch (event->val) {
case GESTURE_MODAL_BEGIN:
- if(gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
+ if (gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
gesture->mode= 1;
wm_gesture_tag_redraw(C);
}
@@ -2411,7 +2385,7 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
case GESTURE_MODAL_DESELECT:
case GESTURE_MODAL_IN:
case GESTURE_MODAL_OUT:
- if(border_apply(C, op, event->val)) {
+ if (border_apply(C, op, event->val)) {
wm_gesture_end(C, op);
return OPERATOR_FINISHED;
}
@@ -2464,7 +2438,7 @@ static void gesture_circle_apply(bContext *C, wmOperator *op)
wmGesture *gesture= op->customdata;
rcti *rect= gesture->customdata;
- if(RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_NOP)
+ if (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_NOP)
return;
/* operator arguments and storage. */
@@ -2472,7 +2446,7 @@ static void gesture_circle_apply(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "y", rect->ymin);
RNA_int_set(op->ptr, "radius", rect->xmax);
- if(op->type->exec)
+ if (op->type->exec)
op->type->exec(C, op);
#ifdef GESTURE_MEMORY
circle_select_size= rect->xmax;
@@ -2485,15 +2459,15 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
rcti *rect= gesture->customdata;
int sx, sy;
- if(event->type== MOUSEMOVE) {
+ if (event->type== MOUSEMOVE) {
wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
- rect->xmin= event->x - sx;
- rect->ymin= event->y - sy;
+ rect->xmin = event->x - sx;
+ rect->ymin = event->y - sy;
wm_gesture_tag_redraw(C);
- if(gesture->mode)
+ if (gesture->mode)
gesture_circle_apply(C, op);
}
else if (event->type==EVT_MODAL_MAP) {
@@ -2504,16 +2478,16 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
case GESTURE_MODAL_CIRCLE_SUB:
rect->xmax -= 2 + rect->xmax/10;
- if(rect->xmax < 1) rect->xmax= 1;
+ if (rect->xmax < 1) rect->xmax = 1;
wm_gesture_tag_redraw(C);
break;
case GESTURE_MODAL_SELECT:
case GESTURE_MODAL_DESELECT:
case GESTURE_MODAL_NOP:
- if(RNA_struct_find_property(op->ptr, "gesture_mode"))
+ if (RNA_struct_find_property(op->ptr, "gesture_mode"))
RNA_int_set(op->ptr, "gesture_mode", event->val);
- if(event->val != GESTURE_MODAL_NOP) {
+ if (event->val != GESTURE_MODAL_NOP) {
/* apply first click */
gesture_circle_apply(C, op);
gesture->mode= 1;
@@ -2524,7 +2498,7 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
case GESTURE_MODAL_CANCEL:
case GESTURE_MODAL_CONFIRM:
wm_gesture_end(C, op);
- return OPERATOR_FINISHED; /* use finish or we dont get an undo */
+ return OPERATOR_FINISHED; /* use finish or we don't get an undo */
}
}
// // Allow view navigation???
@@ -2546,14 +2520,14 @@ int WM_gesture_circle_cancel(bContext *C, wmOperator *op)
/* template to copy from */
void WM_OT_circle_gesture(wmOperatorType *ot)
{
- ot->name= "Circle Gesture";
- ot->idname= "WM_OT_circle_gesture";
- ot->description="Enter rotate mode with a circular gesture";
+ ot->name = "Circle Gesture";
+ ot->idname = "WM_OT_circle_gesture";
+ ot->description = "Enter rotate mode with a circular gesture";
- ot->invoke= WM_gesture_circle_invoke;
- ot->modal= WM_gesture_circle_modal;
+ ot->invoke = WM_gesture_circle_invoke;
+ ot->modal = WM_gesture_circle_modal;
- ot->poll= WM_operator_winactive;
+ ot->poll = WM_operator_winactive;
RNA_def_property(ot->srna, "x", PROP_INT, PROP_NONE);
RNA_def_property(ot->srna, "y", PROP_INT, PROP_NONE);
@@ -2577,16 +2551,16 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event)
wm_subwindow_getorigin(window, gesture->swinid, &sx, &sy);
- rect->xmax= event->x - sx;
- rect->ymax= event->y - sy;
+ rect->xmax = event->x - sx;
+ rect->ymax = event->y - sy;
- if((val= wm_gesture_evaluate(gesture))) {
+ if ((val= wm_gesture_evaluate(gesture))) {
wmEvent tevent;
tevent= *(window->eventstate);
- if(gesture->event_type==LEFTMOUSE)
+ if (gesture->event_type==LEFTMOUSE)
tevent.type= EVT_TWEAK_L;
- else if(gesture->event_type==RIGHTMOUSE)
+ else if (gesture->event_type==RIGHTMOUSE)
tevent.type= EVT_TWEAK_R;
else
tevent.type= EVT_TWEAK_M;
@@ -2602,7 +2576,7 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event)
case LEFTMOUSE:
case RIGHTMOUSE:
case MIDDLEMOUSE:
- if(gesture->event_type==event->type) {
+ if (gesture->event_type==event->type) {
WM_gesture_end(C, gesture);
/* when tweak fails we should give the other keymap entries a chance */
@@ -2610,7 +2584,7 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event)
}
break;
default:
- if(!ISTIMER(event->type)) {
+ if (!ISTIMER(event->type)) {
WM_gesture_end(C, gesture);
}
break;
@@ -2622,17 +2596,17 @@ void wm_tweakevent_test(bContext *C, wmEvent *event, int action)
{
wmWindow *win= CTX_wm_window(C);
- if(win->tweak==NULL) {
- if(CTX_wm_region(C)) {
- if(event->val==KM_PRESS) {
- if( ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) )
+ if (win->tweak==NULL) {
+ if (CTX_wm_region(C)) {
+ if (event->val==KM_PRESS) {
+ if ( ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) )
win->tweak= WM_gesture_new(C, event, WM_GESTURE_TWEAK);
}
}
}
else {
/* no tweaks if event was handled */
- if((action & WM_HANDLER_BREAK)) {
+ if ((action & WM_HANDLER_BREAK)) {
WM_gesture_end(C, win->tweak);
}
else
@@ -2651,7 +2625,7 @@ int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, wmEvent *event)
wm_gesture_tag_redraw(C);
- if( RNA_struct_find_property(op->ptr, "cursor") )
+ if ( RNA_struct_find_property(op->ptr, "cursor") )
WM_cursor_modal(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
return OPERATOR_RUNNING_MODAL;
@@ -2666,7 +2640,7 @@ int WM_gesture_lines_invoke(bContext *C, wmOperator *op, wmEvent *event)
wm_gesture_tag_redraw(C);
- if( RNA_struct_find_property(op->ptr, "cursor") )
+ if ( RNA_struct_find_property(op->ptr, "cursor") )
WM_cursor_modal(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
return OPERATOR_RUNNING_MODAL;
@@ -2683,7 +2657,8 @@ static void gesture_lasso_apply(bContext *C, wmOperator *op)
/* operator storage as path. */
- for(i=0; i<gesture->points; i++, lasso+=2) {
+ RNA_collection_clear(op->ptr, "path");
+ for (i=0; i<gesture->points; i++, lasso+=2) {
loc[0]= lasso[0];
loc[1]= lasso[1];
RNA_collection_add(op->ptr, "path", &itemptr);
@@ -2692,7 +2667,7 @@ static void gesture_lasso_apply(bContext *C, wmOperator *op)
wm_gesture_end(C, op);
- if(op->type->exec)
+ if (op->type->exec)
op->type->exec(C, op);
}
@@ -2709,7 +2684,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
- if(gesture->points == gesture->size) {
+ if (gesture->points == gesture->size) {
short *old_lasso = gesture->customdata;
gesture->customdata= MEM_callocN(2*sizeof(short)*(gesture->size + WM_LASSO_MIN_POINTS), "lasso points");
memcpy(gesture->customdata, old_lasso, 2*sizeof(short)*gesture->size);
@@ -2728,7 +2703,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
/* make a simple distance check to get a smoother lasso
* add only when at least 2 pixels between this and previous location */
- if((x*x+y*y) > 4) {
+ if ((x*x+y*y) > 4) {
lasso += 2;
lasso[0] = event->x - sx;
lasso[1] = event->y - sy;
@@ -2740,7 +2715,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
case LEFTMOUSE:
case MIDDLEMOUSE:
case RIGHTMOUSE:
- if(event->val==KM_RELEASE) { /* key release */
+ if (event->val==KM_RELEASE) { /* key release */
gesture_lasso_apply(C, op);
return OPERATOR_FINISHED;
}
@@ -2791,15 +2766,15 @@ void WM_OT_lasso_gesture(wmOperatorType *ot)
{
PropertyRNA *prop;
- ot->name= "Lasso Gesture";
- ot->idname= "WM_OT_lasso_gesture";
- ot->description="Select objects within the lasso as you move the pointer";
+ ot->name = "Lasso Gesture";
+ ot->idname = "WM_OT_lasso_gesture";
+ ot->description = "Select objects within the lasso as you move the pointer";
- ot->invoke= WM_gesture_lasso_invoke;
- ot->modal= WM_gesture_lasso_modal;
- ot->exec= gesture_lasso_exec;
+ ot->invoke = WM_gesture_lasso_invoke;
+ ot->modal = WM_gesture_lasso_modal;
+ ot->exec = gesture_lasso_exec;
- ot->poll= WM_operator_winactive;
+ ot->poll = WM_operator_winactive;
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
@@ -2813,7 +2788,7 @@ static int straightline_apply(bContext *C, wmOperator *op)
wmGesture *gesture= op->customdata;
rcti *rect= gesture->customdata;
- if(rect->xmin==rect->xmax && rect->ymin==rect->ymax)
+ if (rect->xmin ==rect->xmax && rect->ymin==rect->ymax)
return 0;
/* operator arguments and storage. */
@@ -2822,7 +2797,7 @@ static int straightline_apply(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "xend", rect->xmax);
RNA_int_set(op->ptr, "yend", rect->ymax);
- if(op->type->exec)
+ if (op->type->exec)
op->type->exec(C, op);
return 1;
@@ -2838,7 +2813,7 @@ int WM_gesture_straightline_invoke(bContext *C, wmOperator *op, wmEvent *event)
wm_gesture_tag_redraw(C);
- if( RNA_struct_find_property(op->ptr, "cursor") )
+ if ( RNA_struct_find_property(op->ptr, "cursor") )
WM_cursor_modal(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
return OPERATOR_RUNNING_MODAL;
@@ -2850,16 +2825,16 @@ int WM_gesture_straightline_modal(bContext *C, wmOperator *op, wmEvent *event)
rcti *rect= gesture->customdata;
int sx, sy;
- if(event->type== MOUSEMOVE) {
+ if (event->type== MOUSEMOVE) {
wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
- if(gesture->mode==0) {
- rect->xmin= rect->xmax= event->x - sx;
- rect->ymin= rect->ymax= event->y - sy;
+ if (gesture->mode==0) {
+ rect->xmin = rect->xmax = event->x - sx;
+ rect->ymin = rect->ymax = event->y - sy;
}
else {
- rect->xmax= event->x - sx;
- rect->ymax= event->y - sy;
+ rect->xmax = event->x - sx;
+ rect->ymax = event->y - sy;
straightline_apply(C, op);
}
@@ -2868,13 +2843,13 @@ int WM_gesture_straightline_modal(bContext *C, wmOperator *op, wmEvent *event)
else if (event->type==EVT_MODAL_MAP) {
switch (event->val) {
case GESTURE_MODAL_BEGIN:
- if(gesture->mode==0) {
+ if (gesture->mode==0) {
gesture->mode= 1;
wm_gesture_tag_redraw(C);
}
break;
case GESTURE_MODAL_SELECT:
- if(straightline_apply(C, op)) {
+ if (straightline_apply(C, op)) {
wm_gesture_end(C, op);
return OPERATOR_FINISHED;
}
@@ -2905,15 +2880,15 @@ void WM_OT_straightline_gesture(wmOperatorType *ot)
{
PropertyRNA *prop;
- ot->name= "Straight Line Gesture";
- ot->idname= "WM_OT_straightline_gesture";
- ot->description="Draw a straight line as you move the pointer";
+ ot->name = "Straight Line Gesture";
+ ot->idname = "WM_OT_straightline_gesture";
+ ot->description = "Draw a straight line as you move the pointer";
- ot->invoke= WM_gesture_straightline_invoke;
- ot->modal= WM_gesture_straightline_modal;
- ot->exec= gesture_straightline_exec;
+ ot->invoke = WM_gesture_straightline_invoke;
+ ot->modal = WM_gesture_straightline_modal;
+ ot->exec = gesture_straightline_exec;
- ot->poll= WM_operator_winactive;
+ ot->poll = WM_operator_winactive;
WM_operator_properties_gesture_straightline(ot, 0);
}
@@ -2959,7 +2934,7 @@ static void radial_control_set_initial_mouse(RadialControl *rc, wmEvent *event)
return;
}
- if(rc->zoom_prop) {
+ if (rc->zoom_prop) {
RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
d[0] *= zoom[0];
d[1] *= zoom[1];
@@ -2975,7 +2950,7 @@ static void radial_control_set_tex(RadialControl *rc)
switch(RNA_type_to_ID_code(rc->image_id_ptr.type)) {
case ID_BR:
- if((ibuf = brush_gen_radial_control_imbuf(rc->image_id_ptr.data))) {
+ if ((ibuf = brush_gen_radial_control_imbuf(rc->image_id_ptr.data))) {
glGenTextures(1, &rc->gltex);
glBindTexture(GL_TEXTURE_2D, rc->gltex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, ibuf->x, ibuf->y, 0,
@@ -2995,18 +2970,18 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
float rot;
/* set fill color */
- if(rc->fill_col_prop)
+ if (rc->fill_col_prop)
RNA_property_float_get_array(&rc->fill_col_ptr, rc->fill_col_prop, col);
glColor4f(col[0], col[1], col[2], alpha);
- if(rc->gltex) {
+ if (rc->gltex) {
glBindTexture(GL_TEXTURE_2D, rc->gltex);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
/* set up rotation if available */
- if(rc->rot_prop) {
+ if (rc->rot_prop) {
rot = RNA_property_float_get(&rc->rot_ptr, rc->rot_prop);
glPushMatrix();
glRotatef(RAD2DEGF(rot), 0, 0, 1);
@@ -3027,7 +3002,7 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
glDisable(GL_TEXTURE_2D);
/* undo rotation */
- if(rc->rot_prop)
+ if (rc->rot_prop)
glPopMatrix();
}
else {
@@ -3074,7 +3049,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
glEnable(GL_LINE_SMOOTH);
/* apply zoom if available */
- if(rc->zoom_prop) {
+ if (rc->zoom_prop) {
RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
glScalef(zoom[0], zoom[1], 1);
}
@@ -3083,11 +3058,11 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
radial_control_paint_tex(rc, tex_radius, alpha);
/* set line color */
- if(rc->col_prop)
+ if (rc->col_prop)
RNA_property_float_get_array(&rc->col_ptr, rc->col_prop, col);
glColor4f(col[0], col[1], col[2], 0.5);
- if(rc->subtype == PROP_ANGLE) {
+ if (rc->subtype == PROP_ANGLE) {
glPushMatrix();
/* draw original angle line */
glRotatef(RAD2DEGF(rc->initial_value), 0, 0, 1);
@@ -3124,28 +3099,28 @@ static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op,
char *str;
/* check flags */
- if((flags & RC_PROP_REQUIRE_BOOL) && (flags & RC_PROP_REQUIRE_FLOAT)) {
+ if ((flags & RC_PROP_REQUIRE_BOOL) && (flags & RC_PROP_REQUIRE_FLOAT)) {
BKE_reportf(op->reports, RPT_ERROR, "Property can't be both boolean and float");
return 0;
}
/* get an rna string path from the operator's properties */
- if(!(str = RNA_string_get_alloc(op->ptr, name, NULL, 0)))
+ if (!(str = RNA_string_get_alloc(op->ptr, name, NULL, 0)))
return 1;
- if(str[0] == '\0') {
- if(r_prop) *r_prop = NULL;
+ if (str[0] == '\0') {
+ if (r_prop) *r_prop = NULL;
MEM_freeN(str);
return 1;
}
- if(!r_prop)
+ if (!r_prop)
r_prop = &unused_prop;
/* get rna from path */
- if(!RNA_path_resolve(ctx_ptr, str, r_ptr, r_prop)) {
+ if (!RNA_path_resolve(ctx_ptr, str, r_ptr, r_prop)) {
MEM_freeN(str);
- if(flags & RC_PROP_ALLOW_MISSING)
+ if (flags & RC_PROP_ALLOW_MISSING)
return 1;
else {
BKE_reportf(op->reports, RPT_ERROR, "Couldn't resolve path %s", name);
@@ -3154,10 +3129,10 @@ static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op,
}
/* check property type */
- if(flags & (RC_PROP_REQUIRE_BOOL | RC_PROP_REQUIRE_FLOAT)) {
+ if (flags & (RC_PROP_REQUIRE_BOOL | RC_PROP_REQUIRE_FLOAT)) {
PropertyType prop_type = RNA_property_type(*r_prop);
- if(((flags & RC_PROP_REQUIRE_BOOL) && (prop_type != PROP_BOOLEAN)) ||
+ if (((flags & RC_PROP_REQUIRE_BOOL) && (prop_type != PROP_BOOLEAN)) ||
((flags & RC_PROP_REQUIRE_FLOAT) && prop_type != PROP_FLOAT)) {
MEM_freeN(str);
BKE_reportf(op->reports, RPT_ERROR,
@@ -3167,7 +3142,7 @@ static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op,
}
/* check property's array length */
- if(*r_prop && (len = RNA_property_array_length(r_ptr, *r_prop)) != req_length) {
+ if (*r_prop && (len = RNA_property_array_length(r_ptr, *r_prop)) != req_length) {
MEM_freeN(str);
BKE_reportf(op->reports, RPT_ERROR,
"Property from path %s has length %d instead of %d",
@@ -3191,47 +3166,47 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
RNA_pointer_create(NULL, &RNA_Context, C, &ctx_ptr);
/* check if we use primary or secondary path */
- if(!radial_control_get_path(&ctx_ptr, op, "use_secondary",
+ if (!radial_control_get_path(&ctx_ptr, op, "use_secondary",
&use_secondary_ptr, &use_secondary_prop,
0, (RC_PROP_ALLOW_MISSING|
RC_PROP_REQUIRE_BOOL))) {
return 0;
}
else {
- if(use_secondary_prop &&
+ if (use_secondary_prop &&
RNA_property_boolean_get(&use_secondary_ptr, use_secondary_prop))
data_path = "data_path_secondary";
else
data_path = "data_path_primary";
}
- if(!radial_control_get_path(&ctx_ptr, op, data_path, &rc->ptr, &rc->prop, 0, 0))
+ if (!radial_control_get_path(&ctx_ptr, op, data_path, &rc->ptr, &rc->prop, 0, 0))
return 0;
/* data path is required */
- if(!rc->prop)
+ if (!rc->prop)
return 0;
- if(!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 0, RC_PROP_REQUIRE_FLOAT))
+ if (!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 0, RC_PROP_REQUIRE_FLOAT))
return 0;
- if(!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 3, RC_PROP_REQUIRE_FLOAT))
+ if (!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 3, RC_PROP_REQUIRE_FLOAT))
return 0;
- if(!radial_control_get_path(&ctx_ptr, op, "fill_color_path", &rc->fill_col_ptr, &rc->fill_col_prop, 3, RC_PROP_REQUIRE_FLOAT))
+ if (!radial_control_get_path(&ctx_ptr, op, "fill_color_path", &rc->fill_col_ptr, &rc->fill_col_prop, 3, RC_PROP_REQUIRE_FLOAT))
return 0;
/* slightly ugly; allow this property to not resolve
* correctly. needed because 3d texture paint shares the same
* keymap as 2d image paint */
- if(!radial_control_get_path(&ctx_ptr, op, "zoom_path",
+ 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))
+ if (!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0))
return 0;
- else if(rc->image_id_ptr.data) {
+ else if (rc->image_id_ptr.data) {
/* extra check, pointer must be to an ID */
- if(!RNA_struct_is_ID(rc->image_id_ptr.type)) {
+ if (!RNA_struct_is_ID(rc->image_id_ptr.type)) {
BKE_report(op->reports, RPT_ERROR,
"Pointer from path image_id is not an ID");
return 0;
@@ -3248,10 +3223,10 @@ static int radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
int min_value_int, max_value_int, step_int;
float step_float, precision;
- if(!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl")))
+ if (!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl")))
return OPERATOR_CANCELLED;
- if(!radial_control_get_properties(C, op)) {
+ if (!radial_control_get_properties(C, op)) {
MEM_freeN(rc);
return OPERATOR_CANCELLED;
}
@@ -3278,7 +3253,7 @@ static int radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* get subtype of property */
rc->subtype = RNA_property_subtype(rc->prop);
- if(!ELEM3(rc->subtype, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE)) {
+ if (!ELEM3(rc->subtype, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE)) {
BKE_report(op->reports, RPT_ERROR, "Property must be a distance, a factor, or an angle");
MEM_freeN(rc);
return OPERATOR_CANCELLED;
@@ -3353,7 +3328,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
delta[0]= rc->initial_mouse[0] - event->x;
delta[1]= rc->initial_mouse[1] - event->y;
- if(rc->zoom_prop) {
+ if (rc->zoom_prop) {
RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
delta[0] /= zoom[0];
delta[1] /= zoom[1];
@@ -3365,15 +3340,15 @@ static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
switch(rc->subtype) {
case PROP_DISTANCE:
new_value = dist;
- if(snap) new_value = ((int)new_value + 5) / 10*10;
+ if (snap) new_value = ((int)new_value + 5) / 10*10;
break;
case PROP_FACTOR:
new_value = 1 - dist / WM_RADIAL_CONTROL_DISPLAY_SIZE;
- if(snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
+ if (snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
break;
case PROP_ANGLE:
new_value = atan2(delta[1], delta[0]) + M_PI;
- if(snap) new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10*10);
+ if (snap) new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10*10);
break;
default:
new_value = dist; /* dummy value, should this ever happen? - campbell */
@@ -3402,7 +3377,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
ED_region_tag_redraw(CTX_wm_region(C));
- if(ret != OPERATOR_RUNNING_MODAL)
+ if (ret != OPERATOR_RUNNING_MODAL)
radial_control_cancel(C, op);
return ret;
@@ -3410,14 +3385,14 @@ static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
static void WM_OT_radial_control(wmOperatorType *ot)
{
- ot->name= "Radial Control";
- ot->idname= "WM_OT_radial_control";
+ ot->name = "Radial Control";
+ ot->idname = "WM_OT_radial_control";
- ot->invoke= radial_control_invoke;
- ot->modal= radial_control_modal;
- ot->cancel= radial_control_cancel;
+ ot->invoke = radial_control_invoke;
+ ot->modal = radial_control_modal;
+ ot->cancel = radial_control_cancel;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* all paths relative to the context */
RNA_def_string(ot->srna, "data_path_primary", "", 0, "Primary Data Path", "Primary path of property to be set by the radial control");
@@ -3439,7 +3414,7 @@ static void redraw_timer_window_swap(bContext *C)
wmWindow *win= CTX_wm_window(C);
ScrArea *sa;
- for(sa= CTX_wm_screen(C)->areabase.first; sa; sa= sa->next)
+ for (sa= CTX_wm_screen(C)->areabase.first; sa; sa= sa->next)
ED_area_tag_redraw(sa);
wm_draw_update(C);
@@ -3468,9 +3443,9 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
WM_cursor_wait(1);
- for(a=0; a<iter; a++) {
+ for (a=0; a<iter; a++) {
if (type==0) {
- if(ar)
+ if (ar)
ED_region_do_draw(C, ar);
}
else if (type==1) {
@@ -3488,12 +3463,12 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
ScrArea *sa_back= CTX_wm_area(C);
ARegion *ar_back= CTX_wm_region(C);
- for(sa= CTX_wm_screen(C)->areabase.first; sa; sa= sa->next) {
+ for (sa= CTX_wm_screen(C)->areabase.first; sa; sa= sa->next) {
ARegion *ar_iter;
CTX_wm_area_set(C, sa);
- for(ar_iter= sa->regionbase.first; ar_iter; ar_iter= ar_iter->next) {
- if(ar_iter->swinid) {
+ for (ar_iter= sa->regionbase.first; ar_iter; ar_iter= ar_iter->next) {
+ if (ar_iter->swinid) {
CTX_wm_region_set(C, ar_iter);
ED_region_do_draw(C, ar_iter);
}
@@ -3512,7 +3487,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
- if(a & 1) scene->r.cfra--;
+ if (a & 1) scene->r.cfra--;
else scene->r.cfra++;
scene_update_for_newframe(bmain, scene, scene->lay);
}
@@ -3523,10 +3498,10 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
int tot= (scene->r.efra - scene->r.sfra) + 1;
- while(tot--) {
+ while (tot--) {
/* todo, ability to escape! */
scene->r.cfra++;
- if(scene->r.cfra > scene->r.efra)
+ if (scene->r.cfra > scene->r.efra)
scene->r.cfra= scene->r.sfra;
scene_update_for_newframe(bmain, scene, scene->lay);
@@ -3552,15 +3527,15 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
static void WM_OT_redraw_timer(wmOperatorType *ot)
{
- ot->name= "Redraw Timer";
- ot->idname= "WM_OT_redraw_timer";
- ot->description="Simple redraw timer to test the speed of updating the interface";
+ ot->name = "Redraw Timer";
+ ot->idname = "WM_OT_redraw_timer";
+ ot->description = "Simple redraw timer to test the speed of updating the interface";
- ot->invoke= WM_menu_invoke;
- ot->exec= redraw_timer_exec;
- ot->poll= WM_operator_winactive;
+ ot->invoke = WM_menu_invoke;
+ ot->exec = redraw_timer_exec;
+ ot->poll = WM_operator_winactive;
- ot->prop= RNA_def_enum(ot->srna, "type", redraw_timer_type_items, 0, "Type", "");
+ ot->prop = RNA_def_enum(ot->srna, "type", redraw_timer_type_items, 0, "Type", "");
RNA_def_int(ot->srna, "iterations", 10, 1,INT_MAX, "Iterations", "Number of times to redraw", 1,1000);
}
@@ -3575,11 +3550,11 @@ static int memory_statistics_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
static void WM_OT_memory_statistics(wmOperatorType *ot)
{
- ot->name= "Memory Statistics";
- ot->idname= "WM_OT_memory_statistics";
- ot->description= "Print memory statistics to the console";
+ ot->name = "Memory Statistics";
+ ot->idname = "WM_OT_memory_statistics";
+ ot->description = "Print memory statistics to the console";
- ot->exec= memory_statistics_exec;
+ ot->exec = memory_statistics_exec;
}
/* ************************** memory statistics for testing ***************** */
@@ -3597,11 +3572,11 @@ static int dependency_relations_exec(bContext *C, wmOperator *UNUSED(op))
static void WM_OT_dependency_relations(wmOperatorType *ot)
{
- ot->name= "Dependency Relations";
- ot->idname= "WM_OT_dependency_relations";
- ot->description= "Print dependency graph relations to the console";
+ ot->name = "Dependency Relations";
+ ot->idname = "WM_OT_dependency_relations";
+ ot->description = "Print dependency graph relations to the console";
- ot->exec= dependency_relations_exec;
+ ot->exec = dependency_relations_exec;
}
/* ******************************************************* */
@@ -3612,12 +3587,12 @@ static int wm_ndof_sensitivity_exec(bContext *UNUSED(C), wmOperator *op)
float change;
float sensitivity = U.ndof_sensitivity;
- if(RNA_boolean_get(op->ptr, "fast"))
+ if (RNA_boolean_get(op->ptr, "fast"))
change = 0.5f; // 50% change
else
change = 0.1f; // 10%
- if(RNA_boolean_get(op->ptr, "decrease")) {
+ if (RNA_boolean_get(op->ptr, "decrease")) {
sensitivity -= sensitivity * change;
if (sensitivity < min)
sensitivity = min;
@@ -3637,11 +3612,11 @@ static int wm_ndof_sensitivity_exec(bContext *UNUSED(C), wmOperator *op)
static void WM_OT_ndof_sensitivity_change(wmOperatorType *ot)
{
- ot->name= "Change NDOF sensitivity";
- ot->idname= "WM_OT_ndof_sensitivity_change";
- ot->description="Change NDOF sensitivity";
+ ot->name = "Change NDOF sensitivity";
+ ot->idname = "WM_OT_ndof_sensitivity_change";
+ ot->description = "Change NDOF sensitivity";
- ot->exec= wm_ndof_sensitivity_exec;
+ ot->exec = wm_ndof_sensitivity_exec;
RNA_def_boolean(ot->srna, "decrease", 1, "Decrease NDOF sensitivity", "If true then action decreases NDOF sensitivity instead of increasing");
RNA_def_boolean(ot->srna, "fast", 0, "Fast NDOF sensitivity change", "If true then sensitivity changes 50%, otherwise 10%");
@@ -3650,10 +3625,15 @@ static void WM_OT_ndof_sensitivity_change(wmOperatorType *ot)
static void operatortype_ghash_free_cb(wmOperatorType *ot)
{
- if(ot->macro.first)
+ if (ot->last_properties) {
+ IDP_FreeProperty(ot->last_properties);
+ MEM_freeN(ot->last_properties);
+ }
+
+ if (ot->macro.first)
wm_operatortype_free_macro(ot);
- if(ot->ext.srna) /* python operator, allocs own string */
+ if (ot->ext.srna) /* python operator, allocs own string */
MEM_freeN((void *)ot->idname);
MEM_freeN(ot);
@@ -3723,7 +3703,7 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Gesture Circle");
/* this function is called for each spacetype, only needs to add map once */
- if(keymap) return;
+ if (keymap) return;
keymap= WM_modalkeymap_add(keyconf, "View3D Gesture Circle", modal_items);
@@ -3770,7 +3750,7 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Straight Line");
/* this function is called for each spacetype, only needs to add map once */
- if(keymap) return;
+ if (keymap) return;
keymap= WM_modalkeymap_add(keyconf, "Gesture Straight Line", modal_items);
@@ -3799,7 +3779,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Border");
/* this function is called for each spacetype, only needs to add map once */
- if(keymap) return;
+ if (keymap) return;
keymap= WM_modalkeymap_add(keyconf, "Gesture Border", modal_items);
@@ -3830,6 +3810,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_assign(keymap, "MARKER_OT_select_border");
WM_modalkeymap_assign(keymap, "NLA_OT_select_border");
WM_modalkeymap_assign(keymap, "NODE_OT_select_border");
+ WM_modalkeymap_assign(keymap, "PAINT_OT_hide_show");
WM_modalkeymap_assign(keymap, "OUTLINER_OT_select_border");
// WM_modalkeymap_assign(keymap, "SCREEN_OT_border_select"); // template
WM_modalkeymap_assign(keymap, "SEQUENCER_OT_select_border");
@@ -3857,7 +3838,7 @@ static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Zoom Border");
/* this function is called for each spacetype, only needs to add map once */
- if(keymap) return;
+ if (keymap) return;
keymap= WM_modalkeymap_add(keyconf, "Gesture Zoom Border", modal_items);
@@ -3879,7 +3860,7 @@ static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
/* default keymap for windows and screens, only call once per WM */
void wm_window_keymap(wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Window", 0, 0);
+ wmKeyMap *keymap = WM_keymap_find(keyconf, "Window", 0, 0);
wmKeyMapItem *kmi;
/* note, this doesn't replace existing keymap items */
@@ -3898,7 +3879,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "WM_OT_link_append", OKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
- kmi= WM_keymap_add_item(keymap, "WM_OT_link_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_link_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "link", FALSE);
RNA_boolean_set(kmi->ptr, "instance_groups", FALSE);
@@ -3906,7 +3887,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "WM_OT_save_mainfile", WKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", F2KEY, KM_PRESS, 0, 0);
- kmi= WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "copy", TRUE);
WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, KM_ALT, 0);
@@ -3966,19 +3947,19 @@ void wm_window_keymap(wmKeyConfig *keyconf)
RNA_string_set(kmi->ptr, "value", "DOPESHEET_EDITOR");
/* ndof speed */
- kmi= WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_PLUS, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_PLUS, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "decrease", FALSE);
RNA_boolean_set(kmi->ptr, "fast", FALSE);
- kmi= WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_MINUS, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_MINUS, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "decrease", TRUE);
RNA_boolean_set(kmi->ptr, "fast", FALSE);
- kmi= WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_PLUS, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_PLUS, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "decrease", FALSE);
RNA_boolean_set(kmi->ptr, "fast", TRUE);
- kmi= WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_MINUS, KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_MINUS, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "decrease", TRUE);
RNA_boolean_set(kmi->ptr, "fast", TRUE);
@@ -3995,8 +3976,8 @@ static EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(pt
int totitem= 0;
int i= 0;
- for( ; id; id= id->next) {
- if(local==FALSE || id->lib==NULL) {
+ for ( ; id; id= id->next) {
+ if (local==FALSE || id->lib==NULL) {
item_tmp.identifier= item_tmp.name= id->name+2;
item_tmp.value= i++;
RNA_enum_item_add(&item, &totitem, &item_tmp);
@@ -4045,3 +4026,12 @@ EnumPropertyItem *RNA_scene_local_itemf(bContext *C, PointerRNA *ptr, PropertyRN
{
return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->scene.first : NULL, TRUE);
}
+
+EnumPropertyItem *RNA_movieclip_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
+{
+ return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->movieclip.first : NULL, FALSE);
+}
+EnumPropertyItem *RNA_movieclip_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
+{
+ return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->movieclip.first : NULL, TRUE);
+}
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 5e11e31c045..149c1355c06 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -87,7 +87,7 @@ void wm_subwindows_free(wmWindow *win)
{
wmSubWindow *swin;
- for(swin= win->subwindows.first; swin; swin= swin->next)
+ for (swin= win->subwindows.first; swin; swin= swin->next)
wm_subwindow_free(swin);
BLI_freelistN(&win->subwindows);
@@ -96,7 +96,7 @@ void wm_subwindows_free(wmWindow *win)
int wm_subwindow_get(wmWindow *win)
{
- if(win->curswin)
+ if (win->curswin)
return win->curswin->swinid;
return 0;
}
@@ -105,8 +105,8 @@ static wmSubWindow *swin_from_swinid(wmWindow *win, int swinid)
{
wmSubWindow *swin;
- for(swin= win->subwindows.first; swin; swin= swin->next)
- if(swin->swinid==swinid)
+ for (swin= win->subwindows.first; swin; swin= swin->next)
+ if (swin->swinid==swinid)
break;
return swin;
}
@@ -115,7 +115,7 @@ void wm_subwindow_getsize(wmWindow *win, int swinid, int *x, int *y)
{
wmSubWindow *swin= swin_from_swinid(win, swinid);
- if(swin) {
+ if (swin) {
*x= swin->winrct.xmax - swin->winrct.xmin + 1;
*y= swin->winrct.ymax - swin->winrct.ymin + 1;
}
@@ -125,7 +125,7 @@ void wm_subwindow_getorigin(wmWindow *win, int swinid, int *x, int *y)
{
wmSubWindow *swin= swin_from_swinid(win, swinid);
- if(swin) {
+ if (swin) {
*x= swin->winrct.xmin;
*y= swin->winrct.ymin;
}
@@ -135,9 +135,9 @@ void wm_subwindow_getmatrix(wmWindow *win, int swinid, float mat[][4])
{
wmSubWindow *swin= swin_from_swinid(win, swinid);
- if(swin) {
+ if (swin) {
/* used by UI, should find a better way to get the matrix there */
- if(swinid == win->screen->mainwin) {
+ if (swinid == win->screen->mainwin) {
int width, height;
wm_subwindow_getsize(win, swin->swinid, &width, &height);
@@ -156,14 +156,14 @@ int wm_subwindow_open(wmWindow *win, rcti *winrct)
int width, height;
int freewinid= 1;
- for(swin= win->subwindows.first; swin; swin= swin->next)
- if(freewinid <= swin->swinid)
+ for (swin= win->subwindows.first; swin; swin= swin->next)
+ if (freewinid <= swin->swinid)
freewinid= swin->swinid+1;
win->curswin= swin= MEM_callocN(sizeof(wmSubWindow), "swinopen");
BLI_addtail(&win->subwindows, swin);
- if(G.f & G_DEBUG) printf("swin %d added\n", freewinid);
+ if (G.f & G_DEBUG) printf("swin %d added\n", freewinid);
swin->swinid= freewinid;
swin->winrct= *winrct;
@@ -201,7 +201,7 @@ void wm_subwindow_position(wmWindow *win, int swinid, rcti *winrct)
{
wmSubWindow *swin= swin_from_swinid(win, swinid);
- if(swin) {
+ if (swin) {
int width, height;
swin->winrct= *winrct;
@@ -220,9 +220,9 @@ void wm_subwindow_position(wmWindow *win, int swinid, rcti *winrct)
*/
if (swin->winrct.xmax > win->sizex)
- swin->winrct.xmax= win->sizex;
+ swin->winrct.xmax = win->sizex;
if (swin->winrct.ymax > win->sizey)
- swin->winrct.ymax= win->sizey;
+ swin->winrct.ymax = win->sizey;
/* extra service */
wmSubWindowSet(win, swinid);
@@ -246,7 +246,7 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct)
int width, height;
_curswin= swin_from_swinid(win, swinid);
- if(_curswin==NULL) {
+ if (_curswin==NULL) {
printf("wmSubWindowSet %d: doesn't exist\n", swinid);
return;
}
@@ -258,7 +258,7 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct)
height= _curswin->winrct.ymax - _curswin->winrct.ymin + 1;
glViewport(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
- if(srct) {
+ if (srct) {
width= srct->xmax - srct->xmin + 1;
height= srct->ymax - srct->ymin + 1;
glScissor(srct->xmin, srct->ymin, width, height);
@@ -300,8 +300,8 @@ void wmOrtho(float x1, float x2, float y1, float y2, float n, float f)
void wmOrtho2(float x1, float x2, float y1, float y2)
{
/* prevent opengl from generating errors */
- if(x1==x2) x2+=1.0f;
- if(y1==y2) y2+=1.0f;
+ if (x1==x2) x2+=1.0f;
+ if (y1==y2) y2+=1.0f;
wmOrtho(x1, x2, y1, y2, -100, 100);
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index ed1a5f9d577..b79a89b89bd 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -78,9 +78,20 @@
/* the global to talk to ghost */
static GHOST_SystemHandle g_system= NULL;
+typedef enum WinOverrideFlag {
+ WIN_OVERRIDE_GEOM = (1 << 0),
+ WIN_OVERRIDE_WINSTATE = (1 << 1)
+} WinOverrideFlag;
+
/* set by commandline */
-static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, initialstate= GHOST_kWindowStateNormal;
-static unsigned short useprefsize= 0;
+static struct WMInitStruct {
+ /* window geometry */
+ int size_x, size_y;
+ int start_x, start_y;
+
+ int windowstate;
+ WinOverrideFlag override_flag;
+} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0};
/* ******** win open & close ************ */
@@ -108,33 +119,33 @@ static void wm_window_check_position(rcti *rect)
height -= 70;
#endif
- if(rect->xmin < 0) {
+ if (rect->xmin < 0) {
rect->xmax -= rect->xmin;
rect->xmin = 0;
}
- if(rect->ymin < 0) {
+ if (rect->ymin < 0) {
rect->ymax -= rect->ymin;
rect->ymin = 0;
}
- if(rect->xmax > width) {
+ if (rect->xmax > width) {
d= rect->xmax - width;
rect->xmax -= d;
rect->xmin -= d;
}
- if(rect->ymax > height) {
+ if (rect->ymax > height) {
d= rect->ymax - height;
rect->ymax -= d;
rect->ymin -= d;
}
- if(rect->xmin < 0) rect->xmin= 0;
- if(rect->ymin < 0) rect->ymin= 0;
+ if (rect->xmin < 0) rect->xmin = 0;
+ if (rect->ymin < 0) rect->ymin = 0;
}
static void wm_ghostwindow_destroy(wmWindow *win)
{
- if(win->ghostwin) {
+ if (win->ghostwin) {
GHOST_DisposeWindow(g_system, win->ghostwin);
win->ghostwin= NULL;
}
@@ -147,11 +158,11 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
wmTimer *wt, *wtnext;
/* update context */
- if(C) {
+ if (C) {
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
- if(CTX_wm_window(C)==win)
+ if (CTX_wm_window(C)==win)
CTX_wm_window_set(C, NULL);
}
@@ -161,25 +172,25 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
wm->winactive= NULL;
/* end running jobs, a job end also removes its timer */
- for(wt= wm->timers.first; wt; wt= wtnext) {
+ for (wt= wm->timers.first; wt; wt= wtnext) {
wtnext= wt->next;
- if(wt->win==win && wt->event_type==TIMERJOBS)
+ if (wt->win==win && wt->event_type==TIMERJOBS)
wm_jobs_timer_ended(wm, wt);
}
/* timer removing, need to call this api function */
- for(wt= wm->timers.first; wt; wt=wtnext) {
+ for (wt= wm->timers.first; wt; wt=wtnext) {
wtnext= wt->next;
- if(wt->win==win)
+ if (wt->win==win)
WM_event_remove_timer(wm, win, wt);
}
- if(win->eventstate) MEM_freeN(win->eventstate);
+ if (win->eventstate) MEM_freeN(win->eventstate);
wm_event_free_all(win);
wm_subwindows_free(win);
- if(win->drawdata)
+ if (win->drawdata)
MEM_freeN(win->drawdata);
wm_ghostwindow_destroy(win);
@@ -192,14 +203,14 @@ static int find_free_winid(wmWindowManager *wm)
wmWindow *win;
int id= 1;
- for(win= wm->windows.first; win; win= win->next)
- if(id <= win->winid)
+ for (win= wm->windows.first; win; win= win->next)
+ if (id <= win->winid)
id= win->winid+1;
return id;
}
-/* dont change context itself */
+/* don't change context itself */
wmWindow *wm_window_new(bContext *C)
{
wmWindowManager *wm= CTX_wm_manager(C);
@@ -239,8 +250,25 @@ wmWindow *wm_window_copy(bContext *C, wmWindow *winorig)
/* this is event from ghost, or exit-blender op */
void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
{
+ wmWindow *tmpwin;
bScreen *screen= win->screen;
+ /* first check if we have any non-temp remaining windows */
+ if ((U.uiflag & USER_QUIT_PROMPT) && !wm->file_saved) {
+ if (wm->windows.first) {
+ for (tmpwin = wm->windows.first; tmpwin; tmpwin = tmpwin->next) {
+ if (tmpwin == win)
+ continue;
+ if (tmpwin->screen->temp == 0)
+ break;
+ }
+ if (tmpwin == NULL) {
+ if (!GHOST_confirmQuit(win->ghostwin))
+ return;
+ }
+ }
+ }
+
BLI_remlink(&wm->windows, win);
wm_draw_window_clear(win);
@@ -252,18 +280,18 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
wm_window_free(C, wm, win);
/* if temp screen, delete it after window free (it stops jobs that can access it) */
- if(screen->temp) {
+ if (screen->temp) {
Main *bmain= CTX_data_main(C);
free_libblock(&bmain->screen, screen);
}
/* check remaining windows */
- if(wm->windows.first) {
- for(win= wm->windows.first; win; win= win->next)
- if(win->screen->temp == 0)
+ if (wm->windows.first) {
+ for (win= wm->windows.first; win; win= win->next)
+ if (win->screen->temp == 0)
break;
/* in this case we close all */
- if(win==NULL)
+ if (win==NULL)
WM_exit(C);
}
else
@@ -273,15 +301,15 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
void wm_window_title(wmWindowManager *wm, wmWindow *win)
{
/* handle the 'temp' window, only set title when not set before */
- if(win->screen && win->screen->temp) {
+ if (win->screen && win->screen->temp) {
char *title= GHOST_GetTitle(win->ghostwin);
- if(title==NULL || title[0]==0)
+ if (title==NULL || title[0]==0)
GHOST_SetTitle(win->ghostwin, "Blender");
}
else {
/* this is set to 1 if you don't have startup.blend open */
- if(G.save_over && G.main->name[0]) {
+ if (G.save_over && G.main->name[0]) {
char str[sizeof(G.main->name) + 12];
BLI_snprintf(str, sizeof(str), "Blender%s [%s]", wm->file_saved ? "":"*", G.main->name);
GHOST_SetTitle(win->ghostwin, str);
@@ -295,7 +323,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
GHOST_SetWindowModifiedState(win->ghostwin, (GHOST_TUns8)!wm->file_saved);
#if defined(__APPLE__) && !defined(GHOST_COCOA)
- if(wm->file_saved)
+ if (wm->file_saved)
GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateUnModified);
else
GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateModified);
@@ -337,13 +365,13 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
win->ghostwin= ghostwin;
GHOST_SetWindowUserData(ghostwin, win); /* pointer back */
- if(win->eventstate==NULL)
+ if (win->eventstate==NULL)
win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state");
/* until screens get drawn, make it nice grey */
glClearColor(.55, .55, .55, 0.0);
/* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */
- if(!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) {
+ if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) {
glClear(GL_COLOR_BUFFER_BIT);
}
@@ -370,47 +398,52 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
* Note that these values will be used only
* when there is no startup.blend yet.
*/
- if (!prefsizx) {
- wm_get_screensize(&prefsizx, &prefsizy);
+ if (wm_init_state.size_x == 0) {
+ wm_get_screensize(&wm_init_state.size_x, &wm_init_state.size_y);
#if defined(__APPLE__) && !defined(GHOST_COCOA)
//Cocoa provides functions to get correct max window size
{
extern void wm_set_apple_prefsize(int, int); /* wm_apple.c */
- wm_set_apple_prefsize(prefsizx, prefsizy);
+ wm_set_apple_prefsize(wm_init_state.size_x, wm_init_state.size_y);
}
#else
- prefstax= 0;
- prefstay= 0;
+ wm_init_state.start_x = 0;
+ wm_init_state.start_y = 0;
#endif
}
- for(win= wm->windows.first; win; win= win->next) {
- if(win->ghostwin==NULL) {
- if(win->sizex==0 || useprefsize) {
- win->posx= prefstax;
- win->posy= prefstay;
- win->sizex= prefsizx;
- win->sizey= prefsizy;
- win->windowstate= initialstate;
- useprefsize= 0;
+ for (win= wm->windows.first; win; win= win->next) {
+ if (win->ghostwin==NULL) {
+ if ((win->sizex == 0) || (wm_init_state.override_flag & WIN_OVERRIDE_GEOM)) {
+ win->posx = wm_init_state.start_x;
+ win->posy = wm_init_state.start_y;
+ win->sizex = wm_init_state.size_x;
+ win->sizey = wm_init_state.size_y;
+ wm_init_state.override_flag &= ~WIN_OVERRIDE_GEOM;
}
+
+ if (wm_init_state.override_flag & WIN_OVERRIDE_WINSTATE) {
+ win->windowstate = wm_init_state.windowstate;
+ wm_init_state.override_flag &= ~WIN_OVERRIDE_WINSTATE;
+ }
+
wm_window_add_ghostwindow("Blender", win);
}
/* happens after fileread */
- if(win->eventstate==NULL)
+ if (win->eventstate==NULL)
win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state");
/* add keymap handlers (1 handler for all keys in map!) */
- keymap= WM_keymap_find(wm->defaultconf, "Window", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Window", 0, 0);
WM_event_add_keymap_handler(&win->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Screen", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Screen", 0, 0);
WM_event_add_keymap_handler(&win->handlers, keymap);
- keymap= WM_keymap_find(wm->defaultconf, "Screen Editing", 0, 0);
+ keymap = WM_keymap_find(wm->defaultconf, "Screen Editing", 0, 0);
WM_event_add_keymap_handler(&win->modalhandlers, keymap);
/* add drop boxes */
@@ -455,12 +488,12 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
wm_window_check_position(position);
/* test if we have a temp screen already */
- for(win= CTX_wm_manager(C)->windows.first; win; win= win->next)
- if(win->screen->temp)
+ for (win= CTX_wm_manager(C)->windows.first; win; win= win->next)
+ if (win->screen->temp)
break;
/* add new window? */
- if(win==NULL) {
+ if (win==NULL) {
win= wm_window_new(C);
win->posx= position->xmin;
@@ -470,13 +503,13 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
win->sizex= position->xmax - position->xmin;
win->sizey= position->ymax - position->ymin;
- if(win->ghostwin) {
+ if (win->ghostwin) {
wm_window_set_size(win, win->sizex, win->sizey);
wm_window_raise(win);
}
/* add new screen? */
- if(win->screen==NULL)
+ if (win->screen==NULL)
win->screen= ED_screen_add(win, CTX_data_scene(C), "temp");
win->screen->temp = 1;
@@ -488,7 +521,7 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
sa= win->screen->areabase.first;
CTX_wm_area_set(C, sa);
- if(type==WM_WINDOW_RENDER) {
+ if (type==WM_WINDOW_RENDER) {
ED_area_newspace(C, sa, SPACE_IMAGE);
}
else {
@@ -497,11 +530,11 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
ED_screen_set(C, win->screen);
- if(sa->spacetype==SPACE_IMAGE)
+ if (sa->spacetype==SPACE_IMAGE)
GHOST_SetTitle(win->ghostwin, IFACE_("Blender Render"));
- else if(ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
+ else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
GHOST_SetTitle(win->ghostwin, IFACE_("Blender User Preferences"));
- else if(sa->spacetype==SPACE_FILE)
+ else if (sa->spacetype==SPACE_FILE)
GHOST_SetTitle(win->ghostwin, IFACE_("Blender File View"));
else
GHOST_SetTitle(win->ghostwin, "Blender");
@@ -528,11 +561,11 @@ int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
wmWindow *window= CTX_wm_window(C);
GHOST_TWindowState state;
- if(G.background)
+ if (G.background)
return OPERATOR_CANCELLED;
state= GHOST_GetWindowState(window->ghostwin);
- if(state!=GHOST_kWindowStateFullScreen)
+ if (state!=GHOST_kWindowStateFullScreen)
GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateFullScreen);
else
GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateNormal);
@@ -592,7 +625,7 @@ void wm_window_make_drawable(bContext *C, wmWindow *win)
// win->lmbut= 0; /* keeps hanging when mousepressed while other window opened */
wm->windrawable= win;
- if(G.f & G_DEBUG) printf("set drawable %d\n", win->winid);
+ if (G.f & G_DEBUG) printf("set drawable %d\n", win->winid);
GHOST_ActivateWindowDrawingContext(win->ghostwin);
}
}
@@ -607,7 +640,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
if (type == GHOST_kEventQuit) {
WM_exit(C);
- } else {
+ }
+ else {
GHOST_WindowHandle ghostwin= GHOST_GetEventWindow(evt);
GHOST_TEventDataPtr data= GHOST_GetEventData(evt);
wmWindow *win;
@@ -617,12 +651,14 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
// what is it?
puts("<!> event has no window");
return 1;
- } else if (!GHOST_ValidWindow(g_system, ghostwin)) {
+ }
+ else if (!GHOST_ValidWindow(g_system, ghostwin)) {
// XXX - should be checked, why are we getting an event here, and
// what is it?
puts("<!> event has invalid window");
return 1;
- } else {
+ }
+ else {
win= GHOST_GetWindowUserData(ghostwin);
}
@@ -680,7 +716,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
break;
}
case GHOST_kEventWindowUpdate: {
- if(G.f & G_DEBUG) printf("ghost redraw\n");
+ if (G.f & G_DEBUG) printf("ghost redraw\n");
wm_window_make_drawable(C, win);
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -694,7 +730,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
win->windowstate = state;
/* win32: gives undefined window size when minimized */
- if(state!=GHOST_kWindowStateMinimized) {
+ if (state!=GHOST_kWindowStateMinimized) {
GHOST_RectangleHandle client_rect;
int l, t, r, b, scr_w, scr_h;
int sizex, sizey, posx, posy;
@@ -729,24 +765,24 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
win->posy= posy;
/* debug prints */
- if(0) {
+ if (0) {
state = GHOST_GetWindowState(win->ghostwin);
- if(state==GHOST_kWindowStateNormal) {
- if(G.f & G_DEBUG) printf("window state: normal\n");
+ if (state==GHOST_kWindowStateNormal) {
+ if (G.f & G_DEBUG) printf("window state: normal\n");
}
- else if(state==GHOST_kWindowStateMinimized) {
- if(G.f & G_DEBUG) printf("window state: minimized\n");
+ else if (state==GHOST_kWindowStateMinimized) {
+ if (G.f & G_DEBUG) printf("window state: minimized\n");
}
- else if(state==GHOST_kWindowStateMaximized) {
- if(G.f & G_DEBUG) printf("window state: maximized\n");
+ else if (state==GHOST_kWindowStateMaximized) {
+ if (G.f & G_DEBUG) printf("window state: maximized\n");
}
- else if(state==GHOST_kWindowStateFullScreen) {
- if(G.f & G_DEBUG) printf("window state: fullscreen\n");
+ else if (state==GHOST_kWindowStateFullScreen) {
+ if (G.f & G_DEBUG) printf("window state: fullscreen\n");
}
- if(type!=GHOST_kEventWindowSize) {
- if(G.f & G_DEBUG) {
+ if (type!=GHOST_kEventWindowSize) {
+ if (G.f & G_DEBUG) {
printf("win move event pos %d %d size %d %d\n",
win->posx, win->posy, win->sizex, win->sizey);
}
@@ -823,11 +859,11 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
/* add drag data to wm for paths: */
- if(ddd->dataType == GHOST_kDragnDropTypeFilenames) {
+ if (ddd->dataType == GHOST_kDragnDropTypeFilenames) {
GHOST_TStringArray *stra= ddd->data;
int a, icon;
- for(a=0; a<stra->count; a++) {
+ for (a=0; a<stra->count; a++) {
printf("drop file %s\n", stra->strings[a]);
/* try to get icon type from extension */
icon= ED_file_extension_icon((char *)stra->strings[a]);
@@ -867,22 +903,22 @@ static int wm_window_timer(const bContext *C)
double time= PIL_check_seconds_timer();
int retval= 0;
- for(wt= wm->timers.first; wt; wt= wtnext) {
+ for (wt= wm->timers.first; wt; wt= wtnext) {
wtnext= wt->next; /* in case timer gets removed */
win= wt->win;
- if(wt->sleep==0) {
- if(time > wt->ntime) {
+ if (wt->sleep==0) {
+ if (time > wt->ntime) {
wt->delta= time - wt->ltime;
wt->duration += wt->delta;
wt->ltime= time;
wt->ntime= wt->stime + wt->timestep*ceil(wt->duration/wt->timestep);
- if(wt->event_type == TIMERJOBS)
+ if (wt->event_type == TIMERJOBS)
wm_jobs_timer(C, wm, wt);
- else if(wt->event_type == TIMERAUTOSAVE)
+ else if (wt->event_type == TIMERAUTOSAVE)
wm_autosave_timer(C, wm, wt);
- else if(win) {
+ else if (win) {
wmEvent event= *(win->eventstate);
event.type= wt->event_type;
@@ -902,19 +938,19 @@ void wm_window_process_events(const bContext *C)
{
int hasevent= GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
- if(hasevent)
+ if (hasevent)
GHOST_DispatchEvents(g_system);
hasevent |= wm_window_timer(C);
/* no event, we sleep 5 milliseconds */
- if(hasevent==0)
+ if (hasevent==0)
PIL_sleep_ms(5);
}
void wm_window_process_events_nosleep(void)
{
- if(GHOST_ProcessEvents(g_system, 0))
+ if (GHOST_ProcessEvents(g_system, 0))
GHOST_DispatchEvents(g_system);
}
@@ -930,7 +966,7 @@ void wm_window_testbreak(void)
if ((curtime-ltime)>.05) {
int hasevent= GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
- if(hasevent)
+ if (hasevent)
GHOST_DispatchEvents(g_system);
ltime= curtime;
@@ -951,7 +987,7 @@ void wm_ghost_init(bContext *C)
void wm_ghost_exit(void)
{
- if(g_system)
+ if (g_system)
GHOST_DisposeSystem(g_system);
g_system= NULL;
@@ -964,11 +1000,11 @@ void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *t
{
wmTimer *wt;
- for(wt= wm->timers.first; wt; wt= wt->next)
- if(wt==timer)
+ for (wt= wm->timers.first; wt; wt= wt->next)
+ if (wt==timer)
break;
- if(wt)
+ if (wt)
wt->sleep= dosleep;
}
@@ -993,15 +1029,15 @@ void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *
wmTimer *wt;
/* extra security check */
- for(wt= wm->timers.first; wt; wt= wt->next)
- if(wt==timer)
+ for (wt= wm->timers.first; wt; wt= wt->next)
+ if (wt==timer)
break;
- if(wt) {
- if(wm->reports.reporttimer == wt)
+ if (wt) {
+ if (wm->reports.reporttimer == wt)
wm->reports.reporttimer= NULL;
BLI_remlink(&wm->timers, wt);
- if(wt->customdata)
+ if (wt->customdata)
MEM_freeN(wt->customdata);
MEM_freeN(wt);
}
@@ -1013,18 +1049,18 @@ char *WM_clipboard_text_get(int selection)
{
char *p, *p2, *buf, *newbuf;
- if(G.background)
+ if (G.background)
return NULL;
buf= (char*)GHOST_getClipboard(selection);
- if(!buf)
+ if (!buf)
return NULL;
/* always convert from \r\n to \n */
newbuf= MEM_callocN(strlen(buf)+1, "WM_clipboard_text_get");
- for(p= buf, p2= newbuf; *p; p++) {
- if(*p != '\r')
+ for (p= buf, p2= newbuf; *p; p++) {
+ if (*p != '\r')
*(p2++)= *p;
}
*p2= '\0';
@@ -1036,14 +1072,14 @@ char *WM_clipboard_text_get(int selection)
void WM_clipboard_text_set(char *buf, int selection)
{
- if(!G.background) {
+ if (!G.background) {
#ifdef _WIN32
/* do conversion from \n to \r\n on Windows */
char *p, *p2, *newbuf;
int newlen= 0;
- for(p= buf; *p; p++) {
- if(*p == '\n')
+ for (p= buf; *p; p++) {
+ if (*p == '\n')
newlen += 2;
else
newlen++;
@@ -1051,8 +1087,8 @@ void WM_clipboard_text_set(char *buf, int selection)
newbuf= MEM_callocN(newlen+1, "WM_clipboard_text_set");
- for(p= buf, p2= newbuf; *p; p++, p2++) {
- if(*p == '\n') {
+ for (p= buf, p2= newbuf; *p; p++, p2++) {
+ if (*p == '\n') {
*(p2++)= '\r'; *p2= '\n';
}
else *p2= *p;
@@ -1094,7 +1130,7 @@ void wm_window_get_size(wmWindow *win, int *width_r, int *height_r)
}
/* exceptional case: - splash is called before events are processed
- * this means we dont actually know the window size so get this from GHOST */
+ * this means we don't actually know the window size so get this from GHOST */
void wm_window_get_size_ghost(wmWindow *win, int *width_r, int *height_r)
{
GHOST_RectangleHandle bounds= GHOST_GetClientBounds(win->ghostwin);
@@ -1144,22 +1180,24 @@ void wm_get_cursor_position(wmWindow *win, int *x, int *y)
/* called whem no ghost system was initialized */
void WM_setprefsize(int stax, int stay, int sizx, int sizy)
{
- prefstax= stax;
- prefstay= stay;
- prefsizx= sizx;
- prefsizy= sizy;
- useprefsize= 1;
+ wm_init_state.start_x = stax; /* left hand pos */
+ wm_init_state.start_y = stay; /* bottom pos */
+ wm_init_state.size_x = sizx;
+ wm_init_state.size_y = sizy;
+ wm_init_state.override_flag |= WIN_OVERRIDE_GEOM;
}
/* for borderless and border windows set from command-line */
void WM_setinitialstate_fullscreen(void)
{
- initialstate= GHOST_kWindowStateFullScreen;
+ wm_init_state.windowstate = GHOST_kWindowStateFullScreen;
+ wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
}
void WM_setinitialstate_normal(void)
{
- initialstate= GHOST_kWindowStateNormal;
+ wm_init_state.windowstate = GHOST_kWindowStateNormal;
+ wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
}
/* This function requires access to the GHOST_SystemHandle (g_system) */